diff --git a/1. CCNA 200-301 Official Cert Guide, Volume 1 conv.txt b/1. CCNA 200-301 Official Cert Guide, Volume 1 conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..9775b295b42b02a70ef9be40064f05904191990e --- /dev/null +++ b/1. CCNA 200-301 Official Cert Guide, Volume 1 conv.txt @@ -0,0 +1,57062 @@ +|||||||||||||||||||| + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + +CCNA 200-301, Volume 1 Official Cert Guide + + +In addition to the wealth of updated content, this new edition includes a series of free hands-on exercises to help you master several real-world configuration and troubleshooting activities. These exercises can be performed on the CCNA 200-301 Network Simulator Lite, Volume 1 software included for free on the companion website that accompanies this book. This software, which simulates the experience of working on actual Cisco routers and switches, contains the following 21 free lab exercises, covering topics in Part II and Part III, the first hands-on configuration sections of the book: +1. Configuring Local Usernames +2. Configuring Hostnames +3. Interface Status I +4. Interface Status II +5. Interface Status III +6. Interface Status IV +7. Configuring Switch IP Settings +8. Switch IP Address +9. Switch IP Connectivity I +10. Switch CLI Configuration Process I +11. Switch CLI Configuration Process II +12. Switch CLI Exec Mode +13. Setting Switch Passwords +14. Interface Settings I +15. Interface Settings II +16. Interface Settings III +17. Switch Forwarding I +18. Switch Security I +19. Switch Interfaces and Forwarding Configuration Scenario +20. Configuring VLANs Configuration Scenario +21. VLAN Troubleshooting +If you are interested in exploring more hands-on labs and practice configuration and trouble-shooting with more router and switch commands, go to www.pearsonitcertification.com/ networksimulator for demos and to review the latest products for sale. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + +CCNA +200-301 + + +Official Cert +Volume 1 + +Guide, + + +WENDELL ODOM, CCIE No. 1624 Emeritus + + + + + + + + + + + + + + + + + + + + + + + + + +Cisco Press 221 River St. (3D11C) +Hoboken, NJ 07030 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +ii CCNA 200-301 Official Cert Guide, Volume 1 + +CCNA 200-301 Official Cert Guide, +Volume 1 Wendell Odom +Copyright © 2020 Pearson Education, Inc, + +Published by: Cisco Press + +All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review. +ScoutAutomatedPrintCode + +Library of Congress Control Number: 2019908180 + +ISBN-13: 978-0-13-579273-5 ISBN-10: 0-13-579273-8 + +Warning and Disclaimer +This book is designed to provide information about the Cisco CCNA 200-301 exam. Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. + +The information is provided on an “as is” basis. The authors, Cisco Press, and Cisco Systems, Inc. shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accompany it. + +The opinions expressed in this book belong to the author and are not necessarily those of Cisco Systems, Inc. + +Trademark Acknowledgments +All terms mentioned in this book that are known to be trademarks or service marks have been appropri-ately capitalized. Cisco Press or Cisco Systems, Inc., cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +iii + +Special Sales +For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@pearsoned.com or (800) 382-3419. + +For government sales inquiries, please contact governmentsales@pearsoned.com. + +For questions about sales outside the U.S., please contact intlcs@pearson.com. + + +Feedback Information +At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community. + +Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve the quality of this book, or otherwise alter it to better suit your needs, you can contact us through email at feedback@ciscopress.com. Please make sure to include the book title and ISBN in your message. + + +We greatly appreciate your assistance. + +Editor-in-Chief: Mark Taub + +Business Operation Manager, Cisco Press: Ronald Fligge + +Director ITP Product Management: Brett Bartow + +Managing Editor: Sandra Schroeder + +Development Editor: Christopher Cleveland + +Senior Project Editor: Tonya Simpson + +Copy Editor: Chuck Hutchinson + + +Technical Editor: Elan Beer + +Editorial Assistant: Cindy Teeters + +Cover Designer: Chuti Prasertsith + +Composition: Tricia Bronkella + +Indexer: Ken Johnson + +Proofreader: Debbie Williams + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +iv CCNA 200-301 Official Cert Guide, Volume 1 + +About the Author + +Wendell Odom, CCIE No. 1624 Emeritus, has been in the networking industry since 1981. He has worked as a network engineer, consultant, systems engineer, instructor, and course developer; he currently works writing and creating certification study tools. This book is his 28th edition of some product for Pearson, and he is the author of all editions of the CCNA Cert Guides about Routing and Switching from Cisco Press. He has written books about topics from networking basics, certification guides throughout the years +for CCENT, CCNA R&S, CCNA DC, CCNP ROUTE, CCNP QoS, and CCIE R&S. He maintains study tools, links to his blogs, and other resources at www.certskills.com. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +v + +About the Contributing Author + +David Hucaby, CCIE No. 4594, CWNE No. 292, is a network engineer for University of Kentucky Healthcare. He has been authoring Cisco Press titles for 20 years, with a focus on wireless and LAN switching topics. David has bachelor of science and master of sci-ence degrees in electrical engineering. He lives in Kentucky with his wife, Marci, and two daughters. + +About the Technical Reviewer + +Elan Beer, CCIE No. 1837, is a senior consultant and Cisco instructor specializing in data center architecture and multiprotocol network design. For the past 27 years, Elan has designed networks and trained thousands of industry experts in data center archi-tecture, routing, and switching. Elan has been instrumental in large-scale professional service efforts designing and troubleshooting internetworks, performing data center and network audits, and assisting clients with their short- and long-term design objectives. Elan has a global perspective of network architectures via his international clientele. Elan has used his expertise to design and troubleshoot data centers and internetworks in Malaysia, North America, Europe, Australia, Africa, China, and the Middle East. Most recently, Elan has been focused on data center design, configuration, and troubleshoot-ing as well as service provider technologies. In 1993, Elan was among the first to obtain the Cisco Certified System Instructor (CCSI) certification, and in 1996, he was among the first to attain the Cisco System highest technical certification, the Cisco Certified Internetworking Expert. Since then, Elan has been involved in numerous large-scale data center and telecommunications networking projects worldwide. + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +vi CCNA 200-301 Official Cert Guide, Volume 1 + +Acknowledgments + +Brett Bartow and I have been a team for a few decades. His support and wisdom have been a big help through what is the most significant change to the Cisco CCNA and CCNP certifications since their beginnings back in 1998. He’s always a great partner on working through big picture direction as well as features to make the books the best they can be for our readers. Once again he’s the starting point of the team! (And one of the things he does is gather the rest of the team that you see below…) + +I don’t mean this to sound too melodramatic, but I am too psyched: I got Dave Hucaby to join my team as a coauthor for this edition of the book! Dave’s been writing about LAN switching, wireless LANs, and security topics for Cisco Press almost as long as I have, and I’ve always loved the accuracy and style of his books. Cisco added more than a little wireless LAN content to CCNA this time around. One thing led to another, I won-dered if Dave might be willing to join in, and now we get Dave on the wireless chapters! I hope you’ll enjoy those chapters as much as I did when preparing the book. + +Chris Cleveland did the development editing for the very first Cisco Press exam certi-fication guide way back in 1998, and he still can’t seem to get away from us! Seriously, when Brett and I first discuss any new book, the first question is whether Chris has time to develop the book. It’s always a pleasure working with you, Chris, for what seems like the 20th time or so by now. + +The second question for Brett when starting a new book is whether we might be able to get Elan Beer to do the tech editing. Elan has the right wiring, skills, and experience to do a great job for us with all aspects of the tech editing process. Fantastic job as usual; thanks, Elan. + +Sometimes, with a short book timeline as with this book, I don’t know who’s working on the project for the production group until I’ve written these notes, but I heard Sandra’s and Tonya’s names early this time. Knowing they would be on the project again really did give me a chance to exhale, and I have to say that knowing they would be on the project gave me a great sense of calm going into the production phase of the book. + +Thanks to Sandra Schroeder, Tonya Simpson, and all the production team for making the magic happen. Not to sound too much like a broken record, but getting to work with familiar people who have been a great help in the past really does help reduce the stress when writing, besides getting the highest-quality product out the door in print and e-book forms. From fixing all my grammar and passive-voice sentences to pulling the design and layout together, they do it all; thanks for putting it all together and making it look easy. And Tonya got to juggle two books of mine at the same time (again)—thanks for managing the whole production process again. + +Mike Tanamachi, illustrator and mind reader, did a great job on the figures again. I use a different process with the figures than most authors, with Mike drawing new figures as soon as I outline a new section or chapter. It means more edits when I change my mind and lots of mind reading of what Wendell really wanted versus what I drew poorly on my iPad. Mike came through again with some beautiful finished products. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +vii + +I could not have made the timeline for this book without Chris Burns of Certskills Professional. Chris owns much of the PTP question support and administration process, works on the labs we put on my blog, and then catches anything I need to toss over my shoulder so I can focus on the books. Chris, you are the man! + +A special thank you to you readers who write in with suggestions and possible errors, and especially those of you who post online at the Cisco Learning Network and at my blog (blog.certskills.com). Without question, the comments I receive directly and over-hear by participating at CLN made this edition a better book. + +Thanks to my wonderful wife, Kris, who helps make this sometimes challenging work lifestyle a breeze. I love walking this journey with you, doll. Thanks to my daughter Hannah, launching to college just as this book releases! And thanks to Jesus Christ, Lord of everything in my life. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +viii CCNA 200-301 Official Cert Guide, Volume 1 + +Contents at a Glance + +Introduction xxxv + +Your Study Plan 2 + +Part I Introduction to Networking 11 Chapter 1 Introduction to TCP/IP Networking 12 +Chapter 2 Fundamentals of Ethernet LANs 32 + +Chapter 3 Fundamentals of WANs and IP Routing 58 + +Part I Review 80 + +Part II Implementing Ethernet LANs 83 Chapter 4 Using the Command-Line Interface 84 +Chapter 5 Analyzing Ethernet LAN Switching 106 + +Chapter 6 Configuring Basic Switch Management 126 + +Chapter 7 Configuring and Verifying Switch Interfaces 150 + +Part II Review 172 + +Part III Implementing VLANs and STP 175 Chapter 8 Implementing Ethernet Virtual LANs 176 +Chapter 9 Spanning Tree Protocol Concepts 210 + +Chapter 10 RSTP and EtherChannel Configuration 238 + +Part III Review 260 + +Part IV IPv4 Addressing 263 + +Chapter 11 Perspectives on IPv4 Subnetting 264 + +Chapter 12 Analyzing Classful IPv4 Networks 288 + +Chapter 13 Analyzing Subnet Masks 302 + +Chapter 14 Analyzing Existing Subnets 320 + +Part IV Review 344 + +Part V IPv4 Routing 347 Chapter 15 Operating Cisco Routers 348 +Chapter 16 Configuring IPv4 Addresses and Static Routes 366 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +ix + +Chapter 17 IP Routing in the LAN 392 + +Chapter 18 Troubleshooting IPv4 Routing 418 + +Part V Review 436 + +Part VI OSPF 439 + +Chapter 19 Understanding OSPF Concepts 440 + +Chapter 20 Implementing OSPF 468 + +Chapter 21 OSPF Network Types and Neighbors 498 + +Part VI Review 518 + +Part VII IP Version 6 521 + +Chapter 22 Fundamentals of IP Version 6 522 + +Chapter 23 IPv6 Addressing and Subnetting 540 + +Chapter 24 Implementing IPv6 Addressing on Routers 554 + +Chapter 25 Implementing IPv6 Routing 580 + +Part VII Review 606 + +Part VIII Wireless LANs 609 + +Chapter 26 Fundamentals of Wireless Networks 610 + +Chapter 27 Analyzing Cisco Wireless Architectures 632 + +Chapter 28 Securing Wireless Networks 650 + +Chapter 29 Building a Wireless LAN 666 + +Part VIII Review 688 + +Part IX Appendixes 691 Appendix A Numeric Reference Tables 693 +Appendix B CCNA 200-301, Volume 1 Exam Updates 699 + +Appendix C Answers to the “Do I Know This Already?” Quizzes 701 + +Glossary 724 + +Index 758 + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +x CCNA 200-301 Official Cert Guide, Volume 1 + +Online Appendixes + + +Appendix D + +Appendix E + +Appendix F + +Appendix G + +Appendix H + +Appendix I + +Appendix J + +Appendix K + +Appendix L + +Appendix M + +Appendix N + +Appendix O + +Appendix P + +Appendix Q + +Appendix R + +Practice for Chapter 12: Analyzing Classful IPv4 Networks + +Practice for Chapter 13: Analyzing Subnet Masks + +Practice for Chapter 14: Analyzing Existing Subnets + +Practice for Chapter 22: Fundamentals of IP Version 6 + +Practice for Chapter 24: Implementing IPv6 Addressing on Routers + +Study Planner + +Topics from Previous Editions + +Analyzing Ethernet LAN Designs + +Subnet Design + +Practice for Appendix L: Subnet Design + +Variable-Length Subnet Masks + +Spanning Tree Protocol Implementation + +LAN Troubleshooting + +Troubleshooting IPv4 Routing Protocols + +Exam Topics Cross Reference + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xi + +Contents + +Introduction xxxv + +Your Study Plan 2 +A Brief Perspective on Cisco Certification Exams 2 Five Study Plan Steps 3 +Step 1: Think in Terms of Parts and Chapters 3 +Step 2: Build Your Study Habits Around the Chapter 4 Step 3: Use Book Parts for Major Milestones 5 +Step 4: Use Volume 2’s Final Review Chapter 6 Step 5: Set Goals and Track Your Progress 6 +Things to Do Before Starting the First Chapter 7 Bookmark the Companion Website 7 Bookmark/Install Pearson Test Prep 7 +Understand This Book’s PTP Databases and Modes 8 Practice Viewing Per-Chapter DIKTA Questions 9 Practice Viewing Per-Part Review Questions 9 +Join the Cisco Learning Network CCNA Study Group 9 Getting Started: Now 9 +Part I Introduction to Networking 11 + +Chapter 1 Introduction to TCP/IP Networking 12 “Do I Know This Already?” Quiz 12 Foundation Topics 14 +Perspectives on Networking 14 TCP/IP Networking Model 16 +History Leading to TCP/IP 16 +Overview of the TCP/IP Networking Model 18 TCP/IP Application Layer 19 +HTTP Overview 19 +HTTP Protocol Mechanisms 19 TCP/IP Transport Layer 20 +TCP Error Recovery Basics 21 +Same-Layer and Adjacent-Layer Interactions 21 + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xii CCNA 200-301 Official Cert Guide, Volume 1 + +TCP/IP Network Layer 22 +Internet Protocol and the Postal Service 22 Internet Protocol Addressing Basics 23 +IP Routing Basics 24 +TCP/IP Data-Link and Physical Layers 25 Data Encapsulation Terminology 27 +Names of TCP/IP Messages 28 +OSI Networking Model and Terminology 28 +Comparing OSI and TCP/IP Layer Names and Numbers 29 OSI Data Encapsulation Terminology 30 +Chapter Review 30 + +Chapter 2 Fundamentals of Ethernet LANs 32 “Do I Know This Already?” Quiz 32 Foundation Topics 34 +An Overview of LANs 34 Typical SOHO LANs 35 Typical Enterprise LANs 36 +The Variety of Ethernet Physical Layer Standards 37 +Consistent Behavior over All Links Using the Ethernet Data-Link Layer 38 +Building Physical Ethernet LANs with UTP 39 Transmitting Data Using Twisted Pairs 39 Breaking Down a UTP Ethernet Link 40 +UTP Cabling Pinouts for 10BASE-T and 100BASE-T 42 Straight-Through Cable Pinout 42 +Choosing the Right Cable Pinouts 44 UTP Cabling Pinouts for 1000BASE-T 45 +Building Physical Ethernet LANs with Fiber 46 Fiber Cabling Transmission Concepts 46 Using Fiber with Ethernet 48 +Sending Data in Ethernet Networks 49 Ethernet Data-Link Protocols 49 +Ethernet Addressing 50 +Identifying Network Layer Protocols with the Ethernet Type Field 52 +Error Detection with FCS 53 + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xiii + +Sending Ethernet Frames with Switches and Hubs 53 +Sending in Modern Ethernet LANs Using Full Duplex 53 Using Half Duplex with LAN Hubs 54 +Chapter Review 56 + +Chapter 3 Fundamentals of WANs and IP Routing 58 “Do I Know This Already?” Quiz 58 Foundation Topics 60 +Wide-Area Networks 60 Leased-Line WANs 61 +Physical Details of Leased Lines 61 +HDLC Data-Link Details of Leased Lines 63 How Routers Use a WAN Data Link 64 +Ethernet as a WAN Technology 65 +Ethernet WANs That Create a Layer 2 Service 66 +How Routers Route IP Packets Using Ethernet Emulation 67 IP Routing 68 +Network Layer Routing (Forwarding) Logic 68 +Host Forwarding Logic: Send the Packet to the Default Router 69 R1 and R2’s Logic: Routing Data Across the Network 70 +R3’s Logic: Delivering Data to the End Destination 70 How Network Layer Routing Uses LANs and WANs 70 How IP Addressing Helps IP Routing 72 +Rules for Groups of IP Addresses (Networks and Subnets) 73 The IP Header 73 +How IP Routing Protocols Help IP Routing 74 Other Network Layer Features 75 +Using Names and the Domain Name System 76 The Address Resolution Protocol 77 +ICMP Echo and the ping Command 78 Chapter Review 79 +Part I Review 80 + +Part II Implementing Ethernet LANs 83 + +Chapter 4 Using the Command-Line Interface 84 “Do I Know This Already?” Quiz 84 Foundation Topics 86 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xiv CCNA 200-301 Official Cert Guide, Volume 1 + +Accessing the Cisco Catalyst Switch CLI 86 Cisco Catalyst Switches 86 +Accessing the Cisco IOS CLI 87 Cabling the Console Connection 88 +Accessing the CLI with Telnet and SSH 90 User and Enable (Privileged) Modes 91 +Password Security for CLI Access from the Console 93 CLI Help Features 94 +The debug and show Commands 95 Configuring Cisco IOS Software 96 +Configuration Submodes and Contexts 97 Storing Switch Configuration Files 99 Copying and Erasing Configuration Files 101 +Chapter Review 102 + +Chapter 5 Analyzing Ethernet LAN Switching 106 “Do I Know This Already?” Quiz 106 Foundation Topics 108 +LAN Switching Concepts 108 Overview of Switching Logic 109 +Forwarding Known Unicast Frames 110 Learning MAC Addresses 113 +Flooding Unknown Unicast and Broadcast Frames 114 Avoiding Loops Using Spanning Tree Protocol 114 LAN Switching Summary 115 +Verifying and Analyzing Ethernet Switching 116 Demonstrating MAC Learning 117 +Switch Interfaces 118 +Finding Entries in the MAC Address Table 120 Managing the MAC Address Table (Aging, Clearing) 121 MAC Address Tables with Multiple Switches 123 +Chapter Review 124 + +Chapter 6 Configuring Basic Switch Management 126 “Do I Know This Already?” Quiz 126 Foundation Topics 128 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xv + +Securing the Switch CLI 128 +Securing User Mode and Privileged Mode with Simple Passwords 129 Securing User Mode Access with Local Usernames and Passwords 133 Securing User Mode Access with External Authentication Servers 135 Securing Remote Access with Secure Shell 136 +Enabling IPv4 for Remote Access 139 Host and Switch IP Settings 140 Configuring IPv4 on a Switch 142 +Configuring a Switch to Learn Its IP Address with DHCP 143 Verifying IPv4 on a Switch 143 +Miscellaneous Settings Useful in the Lab 144 History Buffer Commands 144 +The logging synchronous, exec-timeout, and no ip domain-lookup Commands 145 +Chapter Review 146 + +Chapter 7 Configuring and Verifying Switch Interfaces 150 “Do I Know This Already?” Quiz 150 +Foundation Topics 152 Configuring Switch Interfaces 152 +Configuring Speed, Duplex, and Description 152 +Configuring Multiple Interfaces with the interface range Command 154 Administratively Controlling Interface State with shutdown 155 Removing Configuration with the no Command 157 +Autonegotiation 158 +Autonegotiation Under Working Conditions 158 +Autonegotiation Results When Only One Node Uses Autonegotiation 160 +Autonegotiation and LAN Hubs 161 Analyzing Switch Interface Status and Statistics 162 +Interface Status Codes and Reasons for Nonworking States 162 Interface Speed and Duplex Issues 163 +Common Layer 1 Problems on Working Interfaces 166 Chapter Review 168 + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xvi CCNA 200-301 Official Cert Guide, Volume 1 + +Part II Review 172 + +Part III Implementing VLANs and STP 175 + +Chapter 8 Implementing Ethernet Virtual LANs 176 “Do I Know This Already?” Quiz 177 Foundation Topics 179 +Virtual LAN Concepts 179 +Creating Multiswitch VLANs Using Trunking 180 VLAN Tagging Concepts 181 +The 802.1Q and ISL VLAN Trunking Protocols 182 Forwarding Data Between VLANs 183 +The Need for Routing Between VLANs 183 Routing Packets Between VLANs with a Router 184 +VLAN and VLAN Trunking Configuration and Verification 185 Creating VLANs and Assigning Access VLANs to an Interface 185 +VLAN Configuration Example 1: Full VLAN Configuration 186 VLAN Configuration Example 2: Shorter VLAN Configuration 189 +VLAN Trunking Protocol 189 VLAN Trunking Configuration 191 +Implementing Interfaces Connected to Phones 196 Data and Voice VLAN Concepts 196 +Data and Voice VLAN Configuration and Verification 198 Summary: IP Telephony Ports on Switches 200 +Troubleshooting VLANs and VLAN Trunks 200 Access VLANs Undefined or Disabled 201 Mismatched Trunking Operational States 202 The Supported VLAN List on Trunks 203 Mismatched Native VLAN on a Trunk 205 +Chapter Review 205 + +Chapter 9 Spanning Tree Protocol Concepts 210 “Do I Know This Already?” Quiz 210 Foundation Topics 212 +STP and RSTP Basics 212 +The Need for Spanning Tree 213 What Spanning Tree Does 215 How Spanning Tree Works 216 +The STP Bridge ID and Hello BPDU 218 Electing the Root Switch 218 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xvii + +Choosing Each Switch’s Root Port 220 +Choosing the Designated Port on Each LAN Segment 222 Configuring to Influence the STP Topology 223 +Details Specific to STP (and Not RSTP) 224 +STP Activity When the Network Remains Stable 224 STP Timers That Manage STP Convergence 225 Changing Interface States with STP 227 +Rapid STP Concepts 228 Comparing STP and RSTP 229 +RSTP and the Alternate (Root) Port Role 230 RSTP States and Processes 232 +RSTP and the Backup (Designated) Port Role 233 RSTP Port Types 233 +Optional STP Features 234 EtherChannel 234 PortFast 235 +BPDU Guard 236 Chapter Review 236 +Chapter 10 RSTP and EtherChannel Configuration 238 “Do I Know This Already?” Quiz 238 Foundation Topics 240 +Understanding RSTP Through Configuration 240 The Need for Multiple Spanning Trees 241 STP Modes and Standards 242 +The Bridge ID and System ID Extension 243 +How Switches Use the Priority and System ID Extension 245 RSTP Methods to Support Multiple Spanning Trees 246 Other RSTP Configuration Options 247 +Configuring Layer 2 EtherChannel 247 +Configuring a Manual Layer 2 EtherChannel 248 Configuring Dynamic EtherChannels 250 +Physical Interface Configuration and EtherChannels 251 EtherChannel Load Distribution 253 +Configuration Options for EtherChannel Load Distribution 254 The Effects of the EtherChannel Load Distribution Algorithm 255 +Chapter Review 257 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xviii CCNA 200-301 Official Cert Guide, Volume 1 + +Part III Review 260 + +Part IV IPv4 Addressing 263 + +Chapter 11 Perspectives on IPv4 Subnetting 264 “Do I Know This Already?” Quiz 264 Foundation Topics 266 +Introduction to Subnetting 266 +Subnetting Defined Through a Simple Example 267 Operational View Versus Design View of Subnetting 267 +Analyze Subnetting and Addressing Needs 268 +Rules About Which Hosts Are in Which Subnet 268 Determining the Number of Subnets 270 Determining the Number of Hosts per Subnet 271 One Size Subnet Fits All—Or Not 272 +Defining the Size of a Subnet 272 One Size Subnet Fits All 273 +Multiple Subnet Sizes (Variable-Length Subnet Masks) 274 One Mask for All Subnets, or More Than One 274 +Make Design Choices 275 +Choose a Classful Network 275 Public IP Networks 276 +Growth Exhausts the Public IP Address Space 276 Private IP Networks 278 +Choosing an IP Network During the Design Phase 278 Choose the Mask 279 +Classful IP Networks Before Subnetting 279 Borrowing Host Bits to Create Subnet Bits 280 Choosing Enough Subnet and Host Bits 281 +Example Design: 172.16.0.0, 200 Subnets, 200 Hosts 282 Masks and Mask Formats 282 +Build a List of All Subnets 283 Plan the Implementation 284 +Assigning Subnets to Different Locations 285 Choose Static and Dynamic Ranges per Subnet 286 +Chapter Review 287 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xix + +Chapter 12 Analyzing Classful IPv4 Networks 288 “Do I Know This Already?” Quiz 288 Foundation Topics 289 +Classful Network Concepts 289 +IPv4 Network Classes and Related Facts 290 +The Number and Size of the Class A, B, and C Networks 291 Address Formats 291 +Default Masks 292 +Number of Hosts per Network 293 +Deriving the Network ID and Related Numbers 293 +Unusual Network IDs and Network Broadcast Addresses 295 Practice with Classful Networks 296 +Practice Deriving Key Facts Based on an IP Address 296 Practice Remembering the Details of Address Classes 297 +Chapter Review 298 + +Chapter 13 Analyzing Subnet Masks 302 +“Do I Know This Already?” Quiz 302 Foundation Topics 304 +Subnet Mask Conversion 304 Three Mask Formats 304 +Converting Between Binary and Prefix Masks 305 Converting Between Binary and DDN Masks 306 Converting Between Prefix and DDN Masks 308 Practice Converting Subnet Masks 309 +Identifying Subnet Design Choices Using Masks 309 +Masks Divide the Subnet’s Addresses into Two Parts 311 Masks and Class Divide Addresses into Three Parts 312 Classless and Classful Addressing 312 +Calculations Based on the IPv4 Address Format 313 Practice Analyzing Subnet Masks 315 +Chapter Review 315 + +Chapter 14 Analyzing Existing Subnets 320 “Do I Know This Already?” Quiz 320 Foundation Topics 322 +Defining a Subnet 322 +An Example with Network 172.16.0.0 and Four Subnets 322 Subnet ID Concepts 324 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xx CCNA 200-301 Official Cert Guide, Volume 1 + +Subnet Broadcast Address 325 Range of Usable Addresses 325 +Analyzing Existing Subnets: Binary 326 Finding the Subnet ID: Binary 326 +Finding the Subnet Broadcast Address: Binary 327 Binary Practice Problems 328 +Shortcut for the Binary Process 330 Brief Note About Boolean Math 331 Finding the Range of Addresses 331 +Analyzing Existing Subnets: Decimal 331 Analysis with Easy Masks 332 Predictability in the Interesting Octet 333 Finding the Subnet ID: Difficult Masks 334 +Resident Subnet Example 1 334 Resident Subnet Example 2 335 Resident Subnet Practice Problems 336 +Finding the Subnet Broadcast Address: Difficult Masks 336 Subnet Broadcast Example 1 337 +Subnet Broadcast Example 2 337 +Subnet Broadcast Address Practice Problems 338 Practice Analyzing Existing Subnets 338 +A Choice: Memorize or Calculate 338 Chapter Review 339 +Part IV Review 344 + +Part V IPv4 Routing 347 + +Chapter 15 Operating Cisco Routers 348 +“Do I Know This Already?” Quiz 348 Foundation Topics 350 +Installing Cisco Routers 350 Installing Enterprise Routers 350 +Cisco Integrated Services Routers 352 Physical Installation 353 +Installing SOHO Routers 354 + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxi + +Enabling IPv4 Support on Cisco Router Interfaces 355 Accessing the Router CLI 355 +Router Interfaces 356 Interface Status Codes 358 +Router Interface IP Addresses 360 +Bandwidth and Clock Rate on Serial Interfaces 361 Router Auxiliary Port 362 +Chapter Review 362 + +Chapter 16 Configuring IPv4 Addresses and Static Routes 366 “Do I Know This Already?” Quiz 367 +Foundation Topics 369 IP Routing 369 +IPv4 Routing Process Reference 369 An Example of IP Routing 371 +Host Forwards the IP Packet to the Default Router (Gateway) 372 Routing Step 1: Decide Whether to Process the Incoming Frame 373 Routing Step 2: De-encapsulation of the IP Packet 373 +Routing Step 3: Choosing Where to Forward the Packet 374 Routing Step 4: Encapsulating the Packet in a New Frame 375 Routing Step 5: Transmitting the Frame 376 +Configuring IP Addresses and Connected Routes 376 Connected Routes and the ip address Command 376 The ARP Table on a Cisco Router 378 +Configuring Static Routes 379 Static Network Routes 379 Static Host Routes 381 Floating Static Routes 381 Static Default Routes 383 +Troubleshooting Static Routes 384 +Troubleshooting Incorrect Static Routes That Appear in the IP Routing Table 385 +The Static Route Does Not Appear in the IP Routing Table 385 The Correct Static Route Appears but Works Poorly 386 +IP Forwarding with the Longest Prefix Match 386 Using show ip route to Find the Best Route 386 +Using show ip route address to Find the Best Route 388 Interpreting the IP Routing Table 388 +Chapter Review 390 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxii CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter 17 IP Routing in the LAN 392 +“Do I Know This Already?” Quiz 393 Foundation Topics 395 +VLAN Routing with Router 802.1Q Trunks 395 Configuring ROAS 396 +Verifying ROAS 398 Troubleshooting ROAS 400 +VLAN Routing with Layer 3 Switch SVIs 401 Configuring Routing Using Switch SVIs 401 Verifying Routing with SVIs 403 Troubleshooting Routing with SVIs 404 +VLAN Routing with Layer 3 Switch Routed Ports 406 Implementing Routed Interfaces on Switches 407 Implementing Layer 3 EtherChannels 410 Troubleshooting Layer 3 EtherChannels 413 +Chapter Review 414 + +Chapter 18 Troubleshooting IPv4 Routing 418 “Do I Know This Already?” Quiz 418 Foundation Topics 419 +Problem Isolation Using the ping Command 419 Ping Command Basics 419 +Strategies and Results When Testing with the ping Command 420 Testing Longer Routes from Near the Source of the Problem 421 Using Extended Ping to Test the Reverse Route 423 +Testing LAN Neighbors with Standard Ping 425 Testing LAN Neighbors with Extended Ping 426 Testing WAN Neighbors with Standard Ping 427 +Using Ping with Names and with IP Addresses 427 Problem Isolation Using the traceroute Command 428 +traceroute Basics 429 +How the traceroute Command Works 429 Standard and Extended traceroute 431 +Telnet and SSH 432 +Common Reasons to Use the IOS Telnet and SSH Client 432 IOS Telnet and SSH Examples 433 +Chapter Review 435 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxiii + +Part V Review 436 + +Part VI OSPF 439 + +Chapter 19 Understanding OSPF Concepts 440 “Do I Know This Already?” Quiz 440 Foundation Topics 442 +Comparing Dynamic Routing Protocol Features 442 Routing Protocol Functions 443 +Interior and Exterior Routing Protocols 444 Comparing IGPs 445 +IGP Routing Protocol Algorithms 445 Metrics 446 +Other IGP Comparisons 447 Administrative Distance 448 +OSPF Concepts and Operation 449 OSPF Overview 449 +Topology Information and LSAs 450 +Applying Dijkstra SPF Math to Find the Best Routes 451 Becoming OSPF Neighbors 451 +The Basics of OSPF Neighbors 451 +Meeting Neighbors and Learning Their Router ID 452 Exchanging the LSDB Between Neighbors 454 +Fully Exchanging LSAs with Neighbors 454 Maintaining Neighbors and the LSDB 455 +Using Designated Routers on Ethernet Links 456 Calculating the Best Routes with SPF 457 +OSPF Areas and LSAs 459 OSPF Areas 460 +How Areas Reduce SPF Calculation Time 461 (OSPFv2) Link-State Advertisements 462 +Router LSAs Build Most of the Intra-Area Topology 463 Network LSAs Complete the Intra-Area Topology 464 +Chapter Review 465 + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxiv CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter 20 Implementing OSPF 468 +“Do I Know This Already?” Quiz 469 Foundation Topics 470 +Implementing Single-Area OSPFv2 470 OSPF Single-Area Configuration 471 +Wildcard Matching with the network Command 473 Verifying OSPF Operation 475 +Verifying OSPF Configuration 478 Configuring the OSPF Router ID 480 Implementing Multiarea OSPF 482 +Using OSPFv2 Interface Subcommands 483 OSPF Interface Configuration Example 483 +Verifying OSPF Interface Configuration 485 Additional OSPFv2 Features 486 +OSPF Passive Interfaces 487 OSPF Default Routes 489 OSPF Metrics (Cost) 491 +Setting the Cost Directly 491 +Setting the Cost Based on Interface and Reference Bandwidth 492 OSPF Load Balancing 494 +Chapter Review 494 + +Chapter 21 OSPF Network Types and Neighbors 498 “Do I Know This Already?” Quiz 498 Foundation Topics 500 +OSPF Network Types 500 +The OSPF Broadcast Network Type 501 +Verifying Operations with Network Type Broadcast 502 Configuring to Influence the DR/BDR Election 504 +The OSPF Point-to-Point Network Type 506 OSPF Neighbor Relationships 508 +OSPF Neighbor Requirements 508 +Issues That Prevent Neighbor Adjacencies 510 Finding Area Mismatches 511 +Finding Duplicate OSPF Router IDs 511 +Finding OSPF Hello and Dead Timer Mismatches 512 Shutting Down the OSPF Process 513 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxv + +Issues That Allow Adjacencies but Prevent IP Routes 515 Mismatched MTU Settings 515 +Mismatched OSPF Network Types 515 Chapter Review 516 +Part VI Review 518 + +Part VII IP Version 6 521 + +Chapter 22 Fundamentals of IP Version 6 522 “Do I Know This Already?” Quiz 522 Foundation Topics 524 +Introduction to IPv6 524 +The Historical Reasons for IPv6 524 The IPv6 Protocols 526 +IPv6 Routing 527 +IPv6 Routing Protocols 529 +IPv6 Addressing Formats and Conventions 530 Representing Full (Unabbreviated) IPv6 Addresses 530 Abbreviating and Expanding IPv6 Addresses 531 +Abbreviating IPv6 Addresses 531 Expanding Abbreviated IPv6 Addresses 532 +Representing the Prefix Length of an Address 533 Calculating the IPv6 Prefix (Subnet ID) 533 Finding the IPv6 Prefix 533 +Working with More-Difficult IPv6 Prefix Lengths 535 Chapter Review 536 +Chapter 23 IPv6 Addressing and Subnetting 540 “Do I Know This Already?” Quiz 540 Foundation Topics 542 +Global Unicast Addressing Concepts 542 Public and Private IPv6 Addresses 542 The IPv6 Global Routing Prefix 543 +Address Ranges for Global Unicast Addresses 544 IPv6 Subnetting Using Global Unicast Addresses 545 +Deciding Where IPv6 Subnets Are Needed 546 +The Mechanics of Subnetting IPv6 Global Unicast Addresses 546 Listing the IPv6 Subnet Identifier 548 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxvi CCNA 200-301 Official Cert Guide, Volume 1 + +List All IPv6 Subnets 548 +Assign Subnets to the Internetwork Topology 549 Assigning Addresses to Hosts in a Subnet 550 +Unique Local Unicast Addresses 551 +Subnetting with Unique Local IPv6 Addresses 551 The Need for Globally Unique Local Addresses 552 +Chapter Review 553 + +Chapter 24 Implementing IPv6 Addressing on Routers 554 “Do I Know This Already?” Quiz 554 +Foundation Topics 556 +Implementing Unicast IPv6 Addresses on Routers 556 Static Unicast Address Configuration 557 +Configuring the Full 128-Bit Address 557 Enabling IPv6 Routing 558 +Verifying the IPv6 Address Configuration 558 +Generating a Unique Interface ID Using Modified EUI-64 560 Dynamic Unicast Address Configuration 564 +Special Addresses Used by Routers 565 Link-Local Addresses 566 +Link-Local Address Concepts 566 +Creating Link-Local Addresses on Routers 566 +Routing IPv6 with Only Link-Local Addresses on an Interface 568 IPv6 Multicast Addresses 569 +Reserved Multicast Addresses 569 Multicast Address Scopes 571 +Solicited-Node Multicast Addresses 573 Miscellaneous IPv6 Addresses 574 +Anycast Addresses 574 +IPv6 Addressing Configuration Summary 576 Chapter Review 576 +Chapter 25 Implementing IPv6 Routing 580 “Do I Know This Already?” Quiz 580 Foundation Topics 583 +Connected and Local IPv6 Routes 583 +Rules for Connected and Local Routes 583 Example of Connected IPv6 Routes 584 Examples of Local IPv6 Routes 585 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxvii + +Static IPv6 Routes 586 +Static Routes Using the Outgoing Interface 587 Static Routes Using Next-Hop IPv6 Address 588 +Example Static Route with a Global Unicast Next-Hop Address 589 Example Static Route with a Link-Local Next-Hop Address 589 Static Routes over Ethernet Links 591 +Static Default Routes 592 Static IPv6 Host Routes 593 Floating Static IPv6 Routes 593 +Troubleshooting Static IPv6 Routes 595 +Troubleshooting Incorrect Static Routes That Appear in the IPv6 Routing Table 595 +The Static Route Does Not Appear in the IPv6 Routing Table 598 The Neighbor Discovery Protocol 598 +Discovering Neighbor Link Addresses with NDP NS and NA 598 Discovering Routers with NDP RS and RA 600 +Using SLAAC with NDP RS and RA 601 +Discovering Duplicate Addresses Using NDP NS and NA 602 NDP Summary 603 +Chapter Review 603 + +Part VII Review 606 + +Part VIII Wireless LANs 609 + +Chapter 26 Fundamentals of Wireless Networks 610 “Do I Know This Already?” Quiz 610 Foundation Topics 612 +Comparing Wired and Wireless Networks 612 Wireless LAN Topologies 613 +Basic Service Set 614 Distribution System 616 Extended Service Set 618 +Independent Basic Service Set 619 Other Wireless Topologies 620 +Repeater 620 Workgroup Bridge 621 Outdoor Bridge 621 Mesh Network 622 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxviii CCNA 200-301 Official Cert Guide, Volume 1 + +RF Overview 623 +Wireless Bands and Channels 626 APs and Wireless Standards 628 +Chapter Review 629 + +Chapter 27 Analyzing Cisco Wireless Architectures 632 “Do I Know This Already?” Quiz 632 Foundation Topics 634 +Autonomous AP Architecture 634 Cloud-based AP Architecture 636 Split-MAC Architectures 638 +Comparing Wireless LAN Controller Deployments 642 Cisco AP Modes 647 +Chapter Review 647 + +Chapter 28 Securing Wireless Networks 650 “Do I Know This Already?” Quiz 650 Foundation Topics 652 +Anatomy of a Secure Connection 652 Authentication 653 +Message Privacy 655 Message Integrity 656 +Wireless Client Authentication Methods 656 Open Authentication 656 +WEP 657 802.1x/EAP 657 +LEAP 659 EAP-FAST 659 PEAP 659 EAP-TLS 660 +Wireless Privacy and Integrity Methods 660 TKIP 660 +CCMP 661 GCMP 661 +WPA, WPA2, and WPA3 661 Chapter Review 664 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xxix + +Chapter 29 Building a Wireless LAN 666 +“Do I Know This Already?” Quiz 666 Foundation Topics 668 +Connecting a Cisco AP 668 Accessing a Cisco WLC 669 Connecting a Cisco WLC 671 +Using WLC Ports 672 Using WLC Interfaces 673 +Configuring a WLAN 675 +Step 1. Configure a RADIUS Server 676 Step 2. Create a Dynamic Interface 678 Step 3. Create a New WLAN 679 Configuring WLAN Security 681 Configuring WLAN QoS 683 +Configuring Advanced WLAN Settings 684 Finalizing WLAN Configuration 685 +Chapter Review 686 + +Part VIII Review 688 + +Part IX Appendixes 691 + +Appendix A Numeric Reference Tables 693 + +Appendix B CCNA 200-301, Volume 1 Exam Updates 699 + +Appendix C Answers to the “Do I Know This Already?” Quizzes 701 + +Glossary 724 + +Index 758 + +Online Appendixes + + +Appendix D + +Appendix E + +Appendix F + +Appendix G + +Appendix H + +Appendix I + +Practice for Chapter 12: Analyzing Classful IPv4 Networks + +Practice for Chapter 13: Analyzing Subnet Masks + +Practice for Chapter 14: Analyzing Existing Subnets + +Practice for Chapter 22: Fundamentals of IP Version 6 + +Practice for Chapter 24: Implementing IPv6 Addressing on Routers + +Study Planner + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxx CCNA 200-301 Official Cert Guide, Volume 1 + + +Appendix J + +Appendix K + +Appendix L + +Appendix M + +Appendix N + +Appendix O + +Appendix P + +Appendix Q + +Appendix R + +Topics from Previous Editions + +Analyzing Ethernet LAN Designs + +Subnet Design + +Practice for Appendix L: Subnet Design + +Variable-Length Subnet Masks + +Spanning Tree Protocol Implementation + +LAN Troubleshooting + +Troubleshooting IPv4 Routing Protocols + +Exam Topics Cross Reference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xxxi + +Reader Services + +To access additional content for this book, simply register your product. To start the registration process, go to www.ciscopress.com/register and log in or create an account*. +Enter the product ISBN 9780135792735 and click Submit. After the process is com-plete, you will find any available bonus content under Registered Products. + +*Be sure to check the box that you would like to hear from us to receive exclusive dis-counts on future editions of this product. + +Icons Used in This Book + + + + + +Printer + + + + + +Router + + + + + +Access Point + + + + +Cable (Various) + +PC + + + + + +Switch + + + + + +ASA + + + + +Serial Line + +Laptop + + + + + +Layer 3 Switch + + + + + +Network Cloud + + + + +Virtual Circuit + +Server + + + + +Hub + + + + + +Cable Modem + + + + +Ethernet WAN + + +IP Phone + + + + +Bridge + + + + + +CSU/DSU + + + + +Wireless + + +Command Syntax Conventions + +The conventions used to present command syntax in this book are the same conventions used in the IOS Command Reference. The Command Reference describes these conven-tions as follows: + +■ Boldface indicates commands and keywords that are entered literally as shown. In actual configuration examples and output (not general command syntax), boldface indicates commands that are manually input by the user (such as a show command). + +■ Italic indicates arguments for which you supply actual values. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxxii CCNA 200-301 Official Cert Guide, Volume 1 + +■ Vertical bars (|) separate alternative, mutually exclusive elements. + +■ Square brackets ([ ]) indicate an optional element. + +■ Braces ({ }) indicate a required choice. + +■ Braces within brackets ([{ }]) indicate a required choice within an optional element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xxxiii + +Introduction + +About Cisco Certifications and CCNA +Congratulations! If you’re reading far enough to look at this book’s Introduction, you’ve probably already decided to go for your Cisco certification, and the CCNA certification is the one place to begin that journey. If you want to succeed as a technical person in the networking industry at all, you need to know Cisco. Cisco has a ridiculously high market share in the router and switch marketplace, with more than 80 percent market share in some markets. In many geographies and markets around the world, networking equals Cisco. If you want to be taken seriously as a network engineer, Cisco certification makes perfect sense. + +The first few pages of this Introduction explain the core features of Cisco’s Career Certification program, of which the Cisco Certified Network Associate (CCNA) serves as the foundation for all the other certifications in the program. This section begins with a comparison of the old to the new certifications due to some huge program changes in 2019. It then gives the key features of CCNA, how to get it, and what’s on the exam. + +The Big Changes to Cisco Certifications in 2019 +Cisco announced sweeping changes to its career certification program around mid-year 2019. Because so many of you will have read and heard about the old versions of the CCNA certification, this intro begins with a few comparisons between the old and new CCNA as well as some of the other Cisco career certifications. + +First, consider Cisco’s career certifications before 2019 as shown in Figure I-1. At that time, Cisco offered 10 separate CCNA certifications in different technology tracks. Cisco also had eight Professional-level (CCNP, or Cisco Certified Network Professional) certifications. + + + +Collaboration Data Center Routing & Wireless Security Switching +CCIE + +Service Provider + + + + +Collaboration Data Center Routing & Wireless Switching + +Security Service Cloud Provider + +CCNP + + + +Collaboration Data Center Routing & Wireless Security Switching +CCNA + +Service Cloud Provider + + +Cyber Industrial Ops + + +Figure I-1 Old Cisco Certification Silo Concepts + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxxiv CCNA 200-301 Official Cert Guide, Volume 1 + +Why so many? Cisco began with one track—Routing and Switching—back in 1998. Over time, Cisco identified more and more technology areas that had grown to have enough content to justify another set of CCNA and CCNP certifications on those topics, so Cisco added more tracks. Many of those also grew to support expert level topics with CCIE (Cisco Certified Internetwork Expert). + +In 2019, Cisco consolidated the tracks and moved the topics around quite a bit, as shown in Figure I-2. + +Collaboration Data Center Enterprise Security Service Provider + +CCIE + + +Collaboration Data Center Enterprise Security Service Provider + +CCNP + + + +CCNA + +Figure I-2 New Cisco Certification Tracks and Structure + +All the tracks now begin with the content in the one remaining CCNA certification. For CCNP, you now have a choice of five technology areas for your next steps, as shown in Figure I-2. (Note that Cisco replaced “Routing and Switching” with the term “Enterprise.”) + +Cisco made the following changes with the 2019 announcements: + +CCENT: Retired the only Entry-level certification (CCENT, or Cisco Certified Entry Network Technician), with no replacement. +CCNA: Retired all the CCNA certifications except what was then known as “CCNA Routing and Switching,” which became simply “CCNA.” +CCNP: Consolidated the Professional level (CCNP) certifications to five tracks, includ-ing merging CCNP Routing and Switching and CCNP Wireless into CCNP Enterprise. +CCIE: Achieved better alignment with CCNP tracks through the consolidations. +Cisco needed to move many of the individual exam topics from one exam to another because of the number of changes. For instance, Cisco retired nine CCNA certifications plus the CCDA (Design Associate) certification—but those technologies didn’t disap-pear! Cisco just moved the topics around to different exams in different certifications. + +Consider wireless LANs as an example. The 2019 announcements retired both CCNA Wireless and CCNP Wireless as certifications. Some of the old CCNA Wireless topics landed in the new CCNA, while others landed in the two CCNP Enterprise exams about wireless LANs. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xxxv + +For those of you who want to learn more about the transition, check out my blog (blog.certskills.com) and look for posts in the News category from around June 2019. Now on to the details about CCNA as it exists starting in 2019! + +How to Get Your CCNA Certification +As you saw in Figure I-2, all career certification paths now begin with CCNA. So how do you get it? Today, you have one and only one option to achieve CCNA certification: + +Take and pass one exam: The Cisco 200-301 CCNA exam. +To take the 200-301 exam, or any Cisco exam, you will use the services of Pearson VUE (vue.com). The process works something like this: +1. Establish a login at https://home.pearsonvue.com/ (or use your existing login). + +2. Register for, schedule a time and place, and pay for the Cisco 200-301 exam, all from the VUE website. + +3. Take the exam at the VUE testing center. + +4. You will receive a notice of your score, and whether you passed, before you leave the testing center. + +Types of Questions on CCNA 200-301 Exam +The Cisco CCNA and CCNP exams all follow the same general format, with these types of questions: + +■ Multiple-choice, single-answer + +■ Multiple-choice, multiple-answer + +■ Testlet (one scenario with multiple multiple-choice questions) + +■ Drag-and-drop + +■ Simulated lab (sim) + +■ Simlet + +Although the first four types of questions in the list should be somewhat familiar to you from other tests in school, the last two are more common to IT tests and Cisco exams +in particular. Both use a network simulator to ask questions so that you control and use simulated Cisco devices. In particular: + +Sim questions: You see a network topology and lab scenario, and can access the devic-es. Your job is to fix a problem with the configuration. +Simlet questions: This style combines sim and testlet question formats. As with a sim question, you see a network topology and lab scenario, and can access the devices. However, as with a testlet, you also see multiple multiple-choice questions. Instead of changing/fixing the configuration, you answer questions about the current state of the network. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxxvi CCNA 200-301 Official Cert Guide, Volume 1 + +These two question styles with the simulator give Cisco the ability to test your configu-ration skills with sim questions, and your verification and troubleshooting skills with simlet questions. + +Before taking the test, learn the exam user interface by watching some videos Cisco pro-vides about the exam user interface. To find the videos, just go to cisco.com and search for “Cisco Certification Exam Tutorial Videos.” + +CCNA 200-301 Exam Content, Per Cisco +Ever since I was in grade school, whenever the teacher announced that we were having a test soon, someone would always ask, “What’s on the test?” We all want to know, and we all want to study what matters and avoid studying what doesn’t matter. + +Cisco tells the world the topics on each of its exams. Cisco wants the public to know the variety of topics and get an idea about the kinds of knowledge and skills required for each topic for every Cisco certification exam. To find the details, go to www.cisco.com/ go/certifications, look for the CCNA page, and navigate until you see the exam topics. + +This book also lists those same exam topics in several places. From one perspective, every chapter sets about to explain a small set of exam topics, so each chapter begins with the list of exam topics covered in that chapter. However, you might want to also see the exam topics in one place, so Appendix R, “Exam Topics Cross Reference,” lists all the exam topics. You may want to download Appendix R in PDF form and keep it handy. The appendix lists the exam topics with two different cross references: + +■ A list of exam topics and the chapter(s) that covers each topic + +■ A list of chapters and the exam topics covered in each chapter + +Exam Topic Verbs and Depth +Reading and understanding the exam topics, especially deciding the depth of skills required for each exam topic, require some thought. Each exam topic mentions the name of some technology, but it also lists a verb that implies the depth to which you must master the topic. The primary exam topics each list one or more verbs that describe the skill level required. For example, consider the following exam topic: + +Configure and verify IPv4 addressing and subnetting +Note that this one exam topic has two verbs (configure and verify). Per this exam topic, you should be able to not only configure IPv4 addresses and subnets, but you should understand them well enough to verify that the configuration works. In contrast, the fol-lowing exam topic asks you to describe a technology but does not ask you to configure it: + +Describe the purpose of first hop redundancy protocol +The describe verb tells you to be ready to describe whatever a “first hop redundancy protocol” is. That exam topic also implies that you do not then need to be ready to con-figure or verify any first hop redundancy protocols (HSRP, VRRP, and GLBP). + +Finally, note that the configure and verify exam topics imply that you should be able to describe and explain and otherwise master the concepts so that you understand what you have configured. The earlier “Configure and verify IPv4 addressing and subnetting” + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xxxvii + +does not mean that you should know how to type commands but have no clue as to what you configured. You must first master the conceptual exam topic verbs. The pro-gression runs something like this: + +Describe, Identify, Explain, Compare/Contrast, Configure, Verify, Troubleshoot +For instance, an exam topic that lists “compare and contrast” means that you should be able to describe, identify, and explain the technology. Also, an exam topic with “config-ure and verify” tells you to also be ready to describe, explain, and compare/contrast. + +The Context Surrounding the Exam Topics +Take a moment to navigate to www.cisco.com/go/certifications and find the list of exam topics for the CCNA 200-301 exam. Did your eyes go straight to the list of exam top-ics? Or did you take the time to read the paragraphs above the exam topics first? + +That list of exam topics for the CCNA 200-301 exam includes a little over 50 primary exam topics and about 50 more secondary exam topics. The primary topics have those verbs as just discussed, which tell you something about the depth of skill required. The secondary topics list only the names of more technologies to know. + +However, the top of the web page that lists the exam topics also lists some important information that tells us some important facts about the exam topics. In particular, that leading text, found at the beginning of Cisco exam topic pages of most every exam, tells us + +■ The guidelines may change over time. + +■ The exam topics are general guidelines about what may be on the exam. + +■ The actual exam may include “other related topics.” + +Interpreting these three facts in order, I would not expect to see a change to the pub-lished list of exam topics for the exam. I’ve been writing the Cisco Press CCNA Cert Guides since Cisco announced CCNA back in 1998, and I’ve never seen Cisco change the official exam topics in the middle of an exam—not even to fix typos. But the intro-ductory words say that they might change the exam topics, so it’s worth checking. + +As for the second item in the preceding list, even before you know what the acronyms mean, you can see that the exam topics give you a general but not detailed idea about each topic. The exam topics do not attempt to clarify every nook and cranny or to list every command and parameter; however, this book serves as a great tool in that it acts as a much more detailed interpretation of the exam topics. We examine every exam topic, and if we think a concept or command is possibly within an exam topic, we put it into the book. So, the exam topics give us general guidance, and these books give us much more detailed guidance. + +The third item in the list uses literal wording that runs something like this: “However, other related topics may also appear on any specific delivery of the exam.” That one statement can be a bit jarring to test takers, but what does it really mean? Unpacking the statement, it says that such questions may appear on any one exam but may not; in other words, they don’t set about to ask every test taker some questions that include concepts + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xxxviii CCNA 200-301 Official Cert Guide, Volume 1 + +not mentioned in the exam topics. Second, the phrase “…other related topics…” empha-sizes that any such questions would be related to some exam topic, rather than being far afield—a fact that helps us in how we respond to this particular program policy. + +For instance, the CCNA 200-301 exam includes configuring and verifying the OSPF routing protocol, but it does not mention the EIGRP routing protocol. I personally would be unsurprised to see an OSPF question that required a term or fact not specifi-cally mentioned in the exam topics. I would be surprised to see one that (in my opinion) ventures far away from the OSPF features in the exam topics. Also, I would not expect to see a question about how to configure and verify EIGRP. + +And just as one final side point, note that Cisco does on occasion ask a test taker some unscored questions, and those may appear to be in this vein of questions from outside topics. When you sit down to take the exam, the small print mentions that you may see unscored questions and you won’t know which ones are unscored. (These questions give Cisco a way to test possible new questions.) But some of these might be ones that fall into the “other related topics” category, but then not affect your score. + +You should prepare a little differently for any Cisco exam, in comparison to say an exam back in school, in light of Cisco’s “other related questions” policy: + +■ Do not approach an exam topic with an “I’ll learn the core concepts and ignore the edges” approach. + +■ Instead, approach each exam topic with a “pick up all the points I can” approach by mastering each exam topic, both in breadth and in depth. + +■ Go beyond each exam topic when practicing configuration and verification by taking a little extra time to look for additional show commands and configuration options, and make sure you understand as much of the show command output that you can. + +By mastering the known topics, and looking for places to go a little deeper, you will hopefully pick up the most points you can from questions about the exam topics. Then the extra practice you do with commands may happen to help you learn beyond the exam topics in a way that can help you pick up other points as well. + +CCNA 200-301 Exam Content, Per This Book +When we created the Official Cert Guide content for the CCNA 200-301 exam, we considered a few options for how to package the content, and we landed on releasing a two-book set. Figure I-3 shows the setup of the content, with roughly 60 percent of the content in Volume 1 and the rest in Volume 2. + + + +Fundamentals Ethernet LANs IPv4 Routing IPv6 Routing Wireless LANs + +Vol. 1 - 60% + + +Security +IP Services Automation Architecture +Vol. 2 - 40% + + +Figure I-3 Two Books for CCNA 200-301 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xxxix + +The two books together cover all the exam topics in the CCNA 200-301 exam. Each chapter in each book develops the concepts and commands related to an exam topic, with clear and detailed explanations, frequent figures, and many examples that build your understanding of how Cisco networks work. + +As for choosing what content to put into the books, note that we begin and finish with Cisco’s exam topics, but with an eye toward predicting as many of the “other related topics” as we can. We start with the list of exam topics and apply a fair amount of expe-rience, discussion, and other secret sauce to come up with an interpretation of what specific concepts and commands are worthy of being in the books or not. At the end +of the writing process, the books should cover all the published exam topics, with addi-tional depth and breadth that I choose based on the analysis of the exam. As we have done from the very first edition of the CCNA Official Cert Guide, we intend to cover each and every topic in depth. But as you would expect, we cannot predict every single fact on the exam given the nature of the exam policies, but we do our best to cover all known topics. + +Book Features +This book includes many study features beyond the core explanations and examples in each chapter. This section acts as a reference to the various features in the book. + +Chapter Features and How to Use Each Chapter +Each chapter of this book is a self-contained short course about one small topic area, organized for reading and study, as follows: + +“Do I Know This Already?” quizzes: Each chapter begins with a pre-chapter quiz. Foundation Topics: This is the heading for the core content section of the chapter. +Chapter Review: This section includes a list of study tasks useful to help you remem-ber concepts, connect ideas, and practice skills-based content in the chapter. +Figure I-4 shows how each chapter uses these three key elements. You start with the DIKTA quiz. You can use the score to determine whether you already know a lot, or not so much, and determine how to approach reading the Foundation Topics (that is, the technology content in the chapter). When finished, use the Chapter Review tasks to start working on mastering your memory of the facts and skills with configuration, verifica-tion, and troubleshooting. + +DIKTA Quiz Foundation Topics Chapter Review + + +High Score Take Quiz +Low Score + + +(Skim) Foundation Topics +(Read) Foundation Topics + + +1) In-Chapter, or... +2) Companion Website + + +Figure I-4 Three Primary Tasks for a First Pass Through Each Chapter + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xl CCNA 200-301 Official Cert Guide, Volume 1 + +In addition to these three main chapter features, each “Chapter Review” section uses a variety of other book features, including the following: + +■ Review Key Topics: Inside the “Foundation Topics” section, the Key Topic icon appears next to the most important items, for the purpose of later review and mas-tery. While all content matters, some is, of course, more important to learn, or needs more review to master, so these items are noted as key topics. The Chapter Review lists the key topics in a table; scan the chapter for these items to review them. Or review the key topics interactively using the companion website. + +■ Complete Tables from Memory: Instead of just rereading an important table of information, you will find some tables have been turned into memory tables, an inter-active exercise found on the companion website. Memory tables repeat the table, +but with parts of the table removed. You can then fill in the table to exercise your memory, and click to check your work. + +■ Key Terms You Should Know: You do not need to be able to write a formal defini-tion of all terms from scratch; however, you do need to understand each term well enough to understand exam questions and answers. The Chapter Review lists the key terminology from the chapter. Make sure you have a good understanding of each term and use the Glossary to cross-check your own mental definitions. You can also review key terms with the “Key Terms Flashcards” app on the companion website. + +■ Labs: Many exam topics use verbs such as configure and verify; all these refer to skills you should practice at the user interface (CLI) of a router or switch. The +Chapter and Part Reviews refer you to these other tools. The upcoming section titled “About Building Hands-On Skills” discusses your options. + +■ Command References: Some book chapters cover a large number of router and switch commands. The Chapter Review includes reference tables for the commands used in that chapter, along with an explanation. Use these tables for reference, but also use them for study. Just cover one column of the table, and see how much you can remember and complete mentally. + +■ Review DIKTA Questions: Although you have already seen the DIKTA questions from the chapters, re-answering those questions can prove a useful way to review facts. The Part Review suggests that you repeat the DIKTA questions but using the Pearson Test Prep (PTP) exam. + +■ Subnetting Exercises: Chapters 12, 13, 14, 22, and 24 ask you to perform some math processes related to either IPv4 or IPv6 addressing. The Chapter Review asks you +to do additional practice problems. The problems can be found in Appendices D through H, in PDF form, on the companion website. The website also includes inter-active versions of most of the exercises from those appendices. + +Part Features and How to Use the Part Review +The book organizes the chapters into parts for the purpose of helping you study for the exam. Each part groups a small number of related chapters together. Then the study +process (described just before Chapter 1) suggests that you pause after each part to do a + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xli + +review of all chapters in the part. Figure I-5 lists the titles of the eight parts and the chap-ters in those parts (by chapter number) for this book. + +7 IP Version 6 (22-25) 8 Wireless LANs (26-29) + + +4 IPv4 Addressing (11-14) + +5 IPv4 Routing (15-18) + +6 OSPF (19-21) + + + +2 Implementing Ethernet LANs (4-7) + +3 Implementing VLANs and STP (8-10) + + + +1 + +Figure I-5 + +Introduction to Networking (1-3) + +The Book Parts (by Title), and Chapter Numbers in Each Part + + +The Part Review that ends each part acts as a tool to help you with spaced review ses-sions. Spaced reviews—that is, reviewing content several times over the course of your study—help improve retention. The Part Review activities include many of the same kinds of activities seen in the Chapter Review. Avoid skipping the Part Review, and take the time to do the review; it will help you in the long run. + +The Companion Website for Online Content Review +We created an electronic version of every Chapter and Part Review task that could be improved though an interactive version of the tool. For instance, you can take a “Do I Know This Already?” quiz by reading the pages of the book, but you can also use our testing software. As another example, when you want to review the key topics from a chapter, you can find all those in electronic form as well. + +All the electronic review elements, as well as other electronic components of the book, exist on this book’s companion website. The companion website gives you a big advan-tage: you can do most of your Chapter and Part Review work from anywhere using the interactive tools on the site. The advantages include + +■ Easier to use: Instead of having to print out copies of the appendixes and do the work on paper, you can use these new apps, which provide you with an easy-to-use, interactive experience that you can easily run over and over. + +■ Convenient: When you have a spare 5–10 minutes, go to the book’s website and review content from one of your recently finished chapters. + +■ Untethered from the book: You can access your review activities from anywhere— no need to have the book with you. + +■ Good for tactile learners: Sometimes looking at a static page after reading a chapter lets your mind wander. Tactile learners might do better by at least typing answers into an app, or clicking inside an app to navigate, to help keep you focused on the activity. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xlii CCNA 200-301 Official Cert Guide, Volume 1 + +The interactive Chapter Review elements should improve your chances of passing as well. Our in-depth reader surveys over the years show that those who do the Chapter and Part Reviews learn more. Those who use the interactive versions of the review ele-ments also tend to do more of the Chapter and Part Review work. So take advantage of the tools and maybe you will be more successful as well. Table I-1 summarizes these interactive applications and the traditional book features that cover the same content. + +Table I-1 Book Features with Both Traditional and App Options + + +Feature Key Topic +Config Checklist +Key Terms + +Subnetting Practice + +Traditional +Table with list; flip pages to find + +Just one of many types of key topics + +Listed in each “Chapter Review” section, with the Glossary in the back of the book +Appendixes D–H, with practice problems and answers + +App +Key Topics Table app + +Config Checklist app + +Glossary Flash Cards app + +A variety of apps, one per problem type + + + +The companion website also includes links to download, navigate, or stream for these types of content: + +■ Pearson Sim Lite Desktop App + +■ Pearson Test Prep (PT) Desktop App + +■ Pearson Test Prep (PT) Web App + +■ Videos as mentioned in book chapters + +How to Access the Companion Website +To access the companion website, which gives you access to the electronic content with this book, start by establishing a login at www.ciscopress.com and register your book. To do so, simply go to www.ciscopress.com/register and enter the ISBN of the print book: 9780135792735. After you have registered your book, go to your account page and click the Registered Products tab. From there, click the Access Bonus Content link to get access to the book’s companion website. + +Note that if you buy the Premium Edition eBook and Practice Test version of this book from Cisco Press, your book will automatically be registered on your account page. Simply go to your account page, click the Registered Products tab, and select Access Bonus Content to access the book’s companion website. + +How to Access the Pearson Test Prep (PTP) App +You have two options for installing and using the Pearson Test Prep application: a web app and a desktop app. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xliii + +To use the Pearson Test Prep application, start by finding the registration code that comes with the book. You can find the code in these ways: + +■ Print book: Look in the cardboard sleeve in the back of the book for a piece of paper with your book’s unique PTP code. + +■ Premium Edition: If you purchase the Premium Edition eBook and Practice Test directly from the Cisco Press website, the code will be populated on your account page after purchase. Just log in at www.ciscopress.com, click account to see details of your account, and click the digital purchases tab. + +■ Amazon Kindle: For those who purchase a Kindle edition from Amazon, the access code will be supplied directly from Amazon. + +■ Other Bookseller E-books: Note that if you purchase an e-book version from any other source, the practice test is not included because other vendors to date have not chosen to vend the required unique access code. + + +NOTE Do not lose the activation code because it is the only means with which you can access the QA content with the book. + +Once you have the access code, to find instructions about both the PTP web app and the desktop app, follow these steps: +Step 1. Open this book’s companion website, as was shown earlier in this Introduction under the heading “How to Access the Companion Website.” + +Step 2. Click the Practice Exams button. + +Step 3. Follow the instructions listed there both for installing the desktop app and for using the web app. + + +Note that if you want to use the web app only at this point, just navigate to www.pearsontestprep.com, establish a free login if you do not already have one, and register this book’s practice tests using the registration code you just found. The process should take only a couple of minutes. + +NOTE Amazon eBook (Kindle) customers: It is easy to miss Amazon’s email that lists your PTP access code. Soon after you purchase the Kindle eBook, Amazon should send an email. However, the email uses very generic text, and makes no specific mention of PTP or practice exams. To find your code, read every email from Amazon after you purchase the book. Also do the usual checks for ensuring your email arrives like checking your spam folder. + + +NOTE Other eBook customers: As of the time of publication, only the publisher and Amazon supply PTP access codes when you purchase their eBook editions of this book. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xliv CCNA 200-301 Official Cert Guide, Volume 1 + +Feature Reference +The following list provides an easy reference to get the basic idea behind each book feature: + +■ Practice exam: The book gives you the rights to the Pearson Test Prep (PTP) testing software, available as a web app and desktop app. Use the access code on a piece of cardboard in the sleeve in the back of the book, and use the companion website +to download the desktop app or navigate to the web app (or just go to www.pearsontestprep.com). + +■ E-book: Pearson offers an e-book version of this book that includes extra practice tests. If interested, look for the special offer on a coupon card inserted in the sleeve in the back of the book. This offer enables you to purchase the CCNA 200-301 Official Cert Guide, Volume 1, Premium Edition eBook and Practice Test at a 70 percent discount off the list price. The product includes three versions of the e-book, PDF (for reading on your computer), EPUB (for reading on your tablet, mobile device, or Nook or other e-reader), and Mobi (the native Kindle version). It also includes additional practice test questions and enhanced practice test features. + +■ Subnetting videos: The companion website contains a series of videos that show you how to calculate various facts about IP addressing and subnetting (in particular, using the shortcuts described in this book). + +■ Mentoring videos: The companion website also includes a number of videos about other topics as mentioned in individual chapters. + +■ Subnetting practice apps: The companion website contains appendixes with a set of subnetting practice problems and answers. This is a great resource to practice build-ing subnetting skills. You can also do these same practice problems with applications from the “Chapter and Part Review” section of the companion website. + +■ CCNA 200-301 Network Simulator Lite: This lite version of the best-selling CCNA Network Simulator from Pearson provides you with a means, right now, to experi-ence the Cisco command-line interface (CLI). No need to go buy real gear or buy a full simulator to start learning the CLI. Just install it from the companion website. + +■ CCNA Simulator: If you are looking for more hands-on practice, you might want to consider purchasing the CCNA Network Simulator. You can purchase a copy of this software from Pearson at http://pearsonitcertification.com/networksimulator or other retail outlets. To help you with your studies, Pearson has created a mapping guide that maps each of the labs in the simulator to the specific sections in each volume of the CCNA Cert Guide. You can get this mapping guide free on the Extras tab on the book product page: www.ciscopress.com/title/9780135792735. + +■ PearsonITCertification.com: The website www.pearsonitcertification.com is a great resource for all things IT-certification related. Check out the great CCNA articles, videos, blogs, and other certification preparation tools from the industry’s best authors and trainers. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xlv + +■ Author’s website and blogs: The author maintains a website that hosts tools and links useful when studying for CCNA. In particular, the site has a large number of free lab exercises about CCNA content, additional sample questions, and other exercises. Additionally, the site indexes all content so you can study based on the book chap-ters and parts. To find it, navigate to blog.certskills.com. + +Book Organization, Chapters, and Appendixes +This book contains 29 core chapters, with each chapter covering a subset of the topics on the CCNA exam. The book organizes the chapters into parts of three to five chapters. The core chapters cover the following topics: + +■ Part I: Introduction to Networking + +■ Chapter 1, “Introduction to TCP/IP Networking,” introduces the central ideas and terms used by TCP/IP, and contrasts the TCP/IP networking model with the OSI model. +■ Chapter 2, “Fundamentals of Ethernet LANs,” introduces the concepts and terms used when building Ethernet LANs. +■ Chapter 3, “Fundamentals of WANs and IP Routing,” covers the basics of the data-link layer for WANs in the context of IP routing but emphasizes the main net- +work layer protocol for TCP/IP. This chapter introduces the basics of IPv4, including IPv4 addressing and routing. +■ Part II: Implementing Ethernet LANs + +■ Chapter 4, “Using the Command-Line Interface,” explains how to access the text-based user interface of Cisco Catalyst LAN switches. +■ Chapter 5, “Analyzing Ethernet LAN Switching,” shows how to use the Cisco CLI to verify the current status of an Ethernet LAN and how it switches Ethernet frames. +■ Chapter 6, “Configuring Basic Switch Management,” explains how to configure Cisco switches for basic management features, such as remote access using Telnet and SSH. +■ Chapter 7, “Configuring and Verifying Switch Interfaces,” shows how to configure a variety of switch features that apply to interfaces, including duplex/speed. +■ Part III: Implementing VLANs and STP + +■ Chapter 8, “Implementing Ethernet Virtual LANs,” explains the concepts and configuration surrounding virtual LANs, including VLAN trunking. +■ Chapter 9, “Spanning Tree Protocol Concepts,” discusses the concepts behind IEEE Spanning Tree Protocol (STP), including Rapid STP (RSTP) and how they make some switch interfaces block frames to prevent frames from looping continuously around a redundant switched LAN. +■ Chapter 10, “RSTP and EtherChannel Configuration,” shows how to configure and verify RSTP and Layer 2 EtherChannels on Cisco switches. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xlvi CCNA 200-301 Official Cert Guide, Volume 1 + +■ Part IV: IPv4 Addressing + +■ Chapter 11, “Perspectives on IPv4 Subnetting,” walks you through the entire concept of subnetting, from starting with a Class A, B, or C network to a completed subnetting design as implemented in an enterprise IPv4 network. +■ Chapter 12, “Analyzing Classful IPv4 Networks,” explains how IPv4 addresses originally fell into several classes, with unicast IP addresses being in Class A, B, and C. This chapter explores all things related to address classes and the IP network concept created by those classes. +■ Chapter 13, “Analyzing Subnet Masks,” shows how an engineer can analyze the key facts about a subnetting design based on the subnet mask. This chapter shows how to look at the mask and IP network to determine the size of each subnet and the number of subnets. +■ Chapter 14, “Analyzing Existing Subnets,” describes how most troubleshooting of IP connectivity problems starts with an IP address and mask. This chapter shows how to take those two facts and find key facts about the IP subnet in which that host resides. +■ Part V: IPv4 Routing + +■ Chapter 15, “Operating Cisco Routers,” is like Chapter 8, focusing on basic device management, but it focuses on routers instead of switches. +■ Chapter 16, “Configuring IPv4 Addressing and Static Routes,” discusses how to add IPv4 address configuration to router interfaces and how to configure static IPv4 routes. +■ Chapter 17, “IP Routing in the LAN,” shows how to configure and troubleshoot different methods of routing between VLANs, including Router-on-a-Stick (ROAS), Layer 3 switching with SVIs, Layer 3 switching with routed ports, and using Layer 3 EtherChannels. +■ Chapter 18, “Troubleshooting IPv4 Routing,” focuses on how to use two key troubleshooting tools to find routing problems: the ping and traceroute com-mands. +■ Part VI: OSPF + +■ Chapter 19, “Understanding OSPF Concepts,” introduces the fundamental operation of the Open Shortest Path First (OSPF) protocol, focusing on link state fundamentals, neighbor relationships, flooding link state data, and calculating routes based on the lowest cost metric. +■ Chapter 20, “Implementing OSPF,” takes the concepts discussed in the previous chapter and shows how to configure and verify those same features. +■ Chapter 21, “OSPF Network Types and Neighbors,” takes the next steps in OSPF configuration and verification by looking in more depth at the concepts of how routers enable OSPF on interfaces, and the conditions that must be true before two routers will succeed in becoming OSPF neighbors. +■ Part VII: IP Version 6 + +■ Chapter 22, “Fundamentals of IP Version 6,” discusses the most basic concepts of IP version 6, focusing on the rules for writing and interpreting IPv6 addresses. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xlvii + +■ Chapter 23, “IPv6 Addressing and Subnetting,” works through the two branches of unicast IPv6 addresses—global unicast addresses and unique local addresses— that act somewhat like IPv4 public and private addresses, respectively. +■ Chapter 24, “Implementing IPv6 Addressing on Routers,” shows how to config-ure IPv6 routing and addresses on routers, while discussing a variety of special IPv6 addresses. +■ Chapter 25, “Implementing IPv6 Routing,” shows how to add static routes to an IPv6 router’s routing table. +■ Part VIII: Wireless LANs + +■ Chapter 26, “Fundamentals of Wireless Networks,” introduces the foundational concepts of wireless 802.11 LANs, including wireless topologies and basic wireless radio communications protocols. +■ Chapter 27, “Analyzing Cisco Wireless Architectures,” turns your attention to the questions related to systematic and architectural issues surrounding how to build wireless LANs and explains the primary options available for use. +■ Chapter 28, “Securing Wireless Networks,” explains the unique security chal-lenges that exist in a wireless LAN and the protocols and standards used to prevent different kinds of attacks. +■ Chapter 29, “Building a Wireless LAN,” shows how to configure and secure a wire-less LAN using a Wireless LAN Controller (WLC). +■ Part IX: Print Appendixes + +■ Appendix A, “Numeric Reference Tables,” lists several tables of numeric informa-tion, including a binary-to-decimal conversion table and a list of powers of 2. +■ Appendix B, “CCNA 200-301, Volume 1 Exam Updates,” is a place for the author to add book content mid-edition. Always check online for the latest PDF version of this appendix; the appendix lists download instructions. +■ Appendix C, “Answers to the ‘Do I Know This Already?’ Quizzes,” includes the explanations to all the “Do I Know This Already” quizzes. +■ The Glossary contains definitions for all the terms listed in the “Key Terms You Should Know” sections at the conclusion of the chapters. +■ Part X: Online Appendixes + +■ Practice Appendixes + +The following appendixes are available in digital format from the companion website. These appendixes provide additional practice for several networking processes that use some math. + +■ Appendix D, “Practice for Chapter 12: Analyzing Classful IPv4 Networks” + +■ Appendix E, “Practice for Chapter 13: Analyzing Subnet Masks” + +■ Appendix F, “Practice for Chapter 14: Analyzing Existing Subnets” + +■ Appendix G, “Practice for Chapter 22: Fundamentals of IP Version 6” + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +xlviii CCNA 200-301 Official Cert Guide, Volume 1 + +■ Appendix H, “Practice for Chapter 24: Implementing IPv6 Addressing on Routers” + +■ Content from Previous Editions + +Although the publisher restarts numbering at edition “1” each time, the name of the related exam changes in a significant way. In function, this book is in effect part of the 9th edition of the CCNA Cert Guide materials from Cisco Press. From edition to edition, some readers over the years have asked that we keep some select chapters with the book. Keeping content that Cisco removed from the exam, but that may still be useful, can help the average reader as well as instructors who use the materials to +teach courses with this book. The following appendices hold this edition’s content from previous editions: + +■ Appendix J, “Topics from Previous Editions,” is a collection of small topics from prior editions. None of the topics justify a complete appendix by themselves, so we collect the small topics into this single appendix. + +■ Appendix K, “Analyzing Ethernet LAN Designs,” examines various ways to design Ethernet LANs, discussing the pros and cons, and explains common design terminology. + +■ Appendix L, “Subnet Design,” takes a design approach to subnetting. This appendix begins with a classful IPv4 network and asks why a particular mask might be chosen, and if chosen, what subnet IDs exist. + +■ Appendix M, “Practice for Appendix L: Subnet Design” + +■ Appendix N, “Variable-Length Subnet Masks,” moves away from the assumption of one subnet mask per network to multiple subnet masks per network, which makes subnetting math and processes much more challenging. This appendix explains those challenges. + +■ Appendix O, “Spanning Tree Protocol Implementation,” shows how to configure and verify STP on Cisco switches. + +■ Appendix P, “LAN Troubleshooting,” examines the most common LAN switch-ing issues and how to discover those issues when troubleshooting a network. The +appendix includes troubleshooting topics for STP/RSTP, Layer 2 EtherChannel, LAN switching, VLANs, and VLAN trunking. + +■ Appendix Q, “Troubleshooting IPv4 Routing Protocols,” walks through the most common problems with IPv4 routing protocols, while alternating between OSPF examples and EIGRP examples. + +■ Miscellaneous Appendixes + +■ Appendix I, “Study Planner,” is a spreadsheet with major study milestones, where you can track your progress through your study. +■ Appendix R, “Exam Topics Cross Reference,” provides some tables to help you find where each exam objective is covered in the book. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +xlix + +About Building Hands-On Skills +You need skills in using Cisco routers and switches, specifically the Cisco command-line interface (CLI). The Cisco CLI is a text-based command-and-response user interface; you type a command, and the device (a router or switch) displays messages in response. To answer sim and simlet questions on the exams, you need to know a lot of commands, and you need to be able to navigate to the right place in the CLI to use those commands. + +This next section walks through the options of what is included in the book, with a brief description of lab options outside the book. + +Config Lab Exercises +Some router and switch features require multiple configuration commands. Part of the skill you need to learn is to remember which configuration commands work together, which ones are required, and which ones are optional. So, the challenge level goes beyond just picking the right parameters on one command. You have to choose which commands to use, in which combination, typically on multiple devices. And getting good at that kind of task requires practice. + +Each Config Lab lists details about a straightforward lab exercise for which you should create a small set of configuration commands for a few devices. Each lab presents a sample lab topology, with some requirements, and you have to decide what to configure on each device. The answer then shows a sample configuration. Your job is to create the configuration and then check your answer versus the supplied answer. + +Config Lab content resides outside the book at the author’s blog site (blog.certskills. com). You can navigate to the Config Lab in a couple of ways from the site, or just go directly to https://blog.certskills.com/category/hands-on/config-lab/ to reach a list of all Config Labs. Figure I-6 shows the logo that you will see with each Config Lab. + + + + + + + +Figure I-6 Config Lab Logo in the Author’s Blogs + +These Config Labs have several benefits, including the following: + +Untethered and responsive: Do them from anywhere, from any web browser, from your phone or tablet, untethered from the book or DVD. +Designed for idle moments: Each lab is designed as a 5- to 10-minute exercise if all you are doing is typing in a text editor or writing your answer on paper. +Two outcomes, both good: Practice getting better and faster with basic configuration, or if you get lost, you have discovered a topic that you can now go back and reread +to complete your knowledge. Either way, you are a step closer to being ready for the exam! + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +l CCNA 200-301 Official Cert Guide, Volume 1 + +Blog format: The format allows easy adds and changes by me and easy comments by you. +Self-assessment: As part of final review, you should be able to do all the Config Labs, without help, and with confidence. +Note that the blog organizes these Config Lab posts by book chapter, so you can easily use these at both Chapter Review and Part Review. See the “Your Study Plan” element that follows the Introduction for more details about those review sections. + +A Quick Start with Pearson Network Simulator Lite +The decision of how to get hands-on skills can be a little scary at first. The good news: You have a free and simple first step to experience the CLI: install and use the Pearson Network Simulator Lite (or NetSim Lite) that comes with this book. + +This book comes with a lite version of the best-selling CCNA Network Simulator from Pearson, which provides you with a means, right now, to experience the Cisco CLI. No need to go buy real gear or buy a full simulator to start learning the CLI. Just install it from the companion website. + +This latest version of NetSim Lite includes labs associated with Part II of this book, plus a few more from Part III. Part I includes concepts only, with Part II being the first part with commands. So, make sure to use the NetSim Lite to learn the basics of the CLI to get a good start. + +Of course, one reason that you get access to the NetSim Lite is that the publisher hopes you will buy the full product. However, even if you do not use the full product, you can still learn from the labs that come with NetSim Lite while deciding about what options to pursue. + +The Pearson Network Simulator +The Config Labs and the Pearson Network Simulator Lite both fill specific needs, and they both come with the book. However, you need more than those two tools. + +The single best option for lab work to do along with this book is the paid version of the Pearson Network Simulator. This simulator product simulates Cisco routers and switches so that you can learn for CCNA certification. But more importantly, it focuses on learn-ing for the exam by providing a large number of useful lab exercises. Reader surveys tell us that those people who use the Simulator along with the book love the learning pro-cess and rave about how the book and Simulator work well together. + +Of course, you need to make a decision for yourself and consider all the options. Thankfully, you can get a great idea of how the full Simulator product works by using the Pearson Network Simulator Lite product included with the book. Both have the same base code, same user interface, and same types of labs. Try the Lite version to decide if you want to buy the full product. + +Note that the Simulator and the books work on a different release schedule. For a time in 2019 (and probably into 2020), the Simulator will be the one created for the previ-ous versions of the exams (ICND1 100-101, ICND2 200-101, and CCNA 200-120). + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +li + +Interestingly, Cisco did not add a large number of new topics that require CLI skills to the CCNA 200-301 exam as compared with its predecessor, so the old Simulator covers most of the CLI topics. So, during the interim before the products based on the 200-301 exam come out, the old Simulator products should be quite useful. + +On a practical note, when you want to do labs when reading a chapter or doing Part Review, the Simulator organizes the labs to match the book. Just look for the Sort by Chapter tab in the Simulator’s user interface. However, during the months in 2019 for which the Simulator is the older edition listing the older exams in the title, you will need to refer to a PDF that lists those labs versus this book’s organization. You can find that PDF on the book product page under the Downloads tab here: www.ciscopress.com/ title/9780135792735. + +More Lab Options +If you decide against using the full Pearson Network Simulator, you still need hands-on experience. You should plan to use some lab environment to practice as much CLI as possible. + +First, you can use real Cisco routers and switches. You can buy them, new or used, or borrow them at work. You can rent them for a fee. If you have the right mix of gear, you could even do the Config Lab exercises from my blog on that gear or try to re-create examples from the book. + +Cisco also makes a simulator that works very well as a learning tool: Cisco Packet Tracer. Cisco now makes Packet Tracer available for free. However, unlike the Pearson Network Simulator, it does not include lab exercises that direct you as to how to go about learn-ing each topic. If interested in more information about Packet Tracer, check out my series about using Packet Tracer at my blog (blog.certskills.com); just search for “Packet Tracer.” + +Cisco offers a virtualization product that lets you run router and switch operating system (OS) images in a virtual environment. This tool, the Virtual Internet Routing Lab (VIRL), lets you create a lab topology, start the topology, and connect to real router and switch OS images. Check out http://virl.cisco.com for more information. + +You can even rent virtual Cisco router and switch lab pods from Cisco, in an offering called Cisco Learning Labs (https://learningnetworkstore.cisco.com/cisco-learning-labs). + +This book does not tell you what option to use, but you should plan on getting some hands-on practice somehow. The important thing to know is that most people need to practice using the Cisco CLI to be ready to pass these exams. + +For More Information +If you have any comments about the book, submit them via www.ciscopress.com. Just go to the website, select Contact Us, and type your message. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +lii CCNA 200-301 Official Cert Guide, Volume 1 + +Cisco might make changes that affect the CCNA certification from time to time. You should always check www.cisco.com/go/ccna for the latest details. + +The CCNA 200-301 Official Cert Guide, Volume 1, helps you attain CCNA certifica-tion. This is the CCNA certification book from the only Cisco-authorized publisher. We at Cisco Press believe that this book certainly can help you achieve CCNA certification, but the real work is up to you! I trust that your time will be well spent. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + +Your Study Plan + + +You just got this book. You have probably already read (or quickly skimmed) the Introduction. You are probably now wondering whether to start reading here or skip ahead to Chapter 1, “Introduction to TCP/IP Networking.” + +Stop to read this section about how to create your own study plan for the CCNA 200-301 exam. Your study will go much better if you take time (maybe 15 minutes) to think about a few key points about how to study before starting on this journey. That is what this section will help you do. + +A Brief Perspective on Cisco Certification Exams +Cisco sets the bar pretty high for passing the CCNA 200-301 exam. Most anyone can study and pass the exam, but it takes more than just a quick read through the book and the cash to pay for the exam. + +The challenge of the exam comes from many angles. First, the exam covers a lot of concepts and many commands specific to Cisco devices. Beyond knowledge, all these Cisco exams also require deep skills. You must be able to analyze and predict what really happens in +a network, and you must be able to configure Cisco devices to work correctly in those networks. + +The more challenging questions on these exams work a lot like a jigsaw puzzle, but with four out of every five puzzle pieces not even in the room. To solve the puzzle, you have to men-tally re-create the missing pieces. To do that, you must know each networking concept and remember how the concepts work together. + +For instance, you might encounter a question that asks you why two routers cannot exchange routing information using the OSPF routing protocol. The question would supply some of the information, like some pieces of the jigsaw puzzle, as represented with the white pieces in Figure 1. You have to apply your knowledge of IPv4 routing, IPv4 addressing, and the OSPF protocol to the scenario in the question to come up with some of the other pieces of the puzzle. For a given question, some pieces of the puzzle might remain a mystery, but with enough of the puzzle filled in, you should be able to answer the question. And some pieces will just remain unknown for a given question. + +These skills require that you prepare by doing more than just reading and memorizing. Of course, you need to read many pages in this book to learn many individual facts and how these facts relate to each other. But a big part of this book lists exercises that require more than just simply reading, exercises that help you build the skills to solve these networking puzzles. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + +Given: Output of show ip ospf neighbors + + + + +Predict Output: show ip route + + + + + + + +Predict Output: show ip ospf interfaces + + +Predict Configuration: OSPF on Routers + + + + + + +Given: +Router Topology Drawing + + +Calculate: IPv4 subnet IDs + + + +Figure 1 Filling In Puzzle Pieces with Your Analysis Skills + +Five Study Plan Steps +What do you need to do to be ready to pass, beyond reading and remembering all the facts? You need to develop skills. You need to mentally link each idea with other related ideas. Doing that requires additional work. To help you along the way, the next few pages give you five key plan-ning steps to take so that you can more effectively build those skills and make those connections, before you dive into this exciting but challenging world of learning networking on Cisco gear. + +Step 1: Think in Terms of Parts and Chapters +The first step in your study plan is to get the right mindset about the size and nature of the task you have set out to accomplish. This is a large book, and to be ready for the CCNA 200-301 exam, you need to complete it and then the CCNA 200-301 Official Cert Guide, Volume 2. You cannot think about these two books as one huge task, or you might get dis-couraged. So break the task down into smaller tasks. + +The good news here is that the book is designed with obvious breakpoints and built-in exten-sive review activities. In short, the book is more of a study system than a book. + +The first step in your study plan is to visualize this book not as one large book but as compo-nents. First, visualize the book as eight smaller parts. Then, within each part, visualize each part as three or four chapters. Your study plan has you working through the chapters in each part and then reviewing the material in that part before moving on, as shown in Figure 2. + +Now your plan has the following: + +1 large task: Read and master all content in the book. 8 medium tasks/book: Read and master a part. +4 small tasks/part: Read and master a chapter. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +Part I Part II Part III Part IV + +Chapter 1 Review +Chapter 2 Review +Chapter 3 +Review + + +P A R T + +R E V I E W + +Chapter 4 Review +Chapter 5 Review +Chapter 6 Review +Chapter 7 +Review + + +P A R T + +R E V I E W + +Chapter 8 Review +Chapter 9 Review +Chapter 10 +Review + + +P A R T + +R E V I E W + +Chapter 11 Review +Chapter 12 Review +Chapter 13 Review +Chapter 14 +Review + + +P A R T + +R E V I E W + + +Part V Part VI Part VII Part VIII Final Review + +Chapter 15 Review +Chapter 16 Review +Chapter 17 Review +Chapter 18 +Review + + +P A R T + +R E V I E W + + +Chapter 19 Review +Chapter 20 Review +Chapter 21 +Review + + +P A R T + +R E V I E W + + +Chapter 22 Review +Chapter 23 Review +Chapter 24 Review +Chapter 25 +Review + + +P A R T + +R E V I E W + + +Chapter 26 Review +Chapter 27 Review +Chapter 28 Review +Chapter 29 +Review + + +P A R T + +R E V I E W + +Practice Exams +Do Labs +Review Concepts +Practice Subnetting +. +. +. + + +Figure 2 Eight Parts, with an Average of Four Chapters Each, with Part Reviews + +Step 2: Build Your Study Habits Around the Chapter +For your second step, possibly the most important step, approach each chapter with the same process as shown in Figure 3. The chapter pre-quiz (called a DIKTA quiz, or “Do I Know This Already?” quiz) helps you decide how much time to spend reading versus skim-ming the core of the chapter, called the “Foundation Topics.” The “Chapter Review” section then gives you instructions about how to study and review what you just read. + +DIKTA Quiz Foundation Topics Chapter Review + + +High Score Take Quiz +Low Score + + +(Skim) Foundation Topics +(Read) Foundation Topics + + +1) In-Chapter, or... +2) Companion Website + + +Figure 3 Suggested Approach to Each Chapter + +The book has no long chapters, on purpose. They average about 20 pages for the Foundation Topics (which is the part of the chapter with new content). Because we kept the size reason-able, you can complete all of a chapter in one or two short study sessions. For instance, when you begin a new chapter, if you have an hour or an hour and a half, you should be able to complete a first reading of the chapter and at least make a great start on it. And even if you do not have enough time to read the entire chapter, look for the major headings inside the chapter; each chapter has two to three major headings, and those make a great place to stop reading when you need to wait to complete the reading in the next study sessions. + +The Chapter Review tasks are very important to your exam-day success. Doing these tasks after you’ve read the chapter really does help you get ready. Do not put off using these tasks until later! The chapter-ending review tasks help you with the first phase of deepening + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Your Study Plan 5 + +your knowledge and skills of the key topics, remembering terms, and linking the concepts together in your brain so that you can remember how it all fits together. The following list describes most of the activities you will find in the “Chapter Review” sections: + +■ Review key topics ■ Review key terms +■ Answer the DIKTA questions ■ Re-create config checklists +■ Review command tables ■ Review memory tables ■ Do lab exercises +■ Watch video +■ Do subnetting exercises + +Step 3: Use Book Parts for Major Milestones +Studies show that to master a concept and/or skill, you should plan to go through multiple study sessions to review the concept and to practice the skill. The “Chapter Review” section at the end of each chapter is the first such review, while the Part Review, at the end of each part, acts as that second review. + +Plan time to do the Part Review task at the end of each part, using the Part Review elements found at the end of each part. You should expect to spend about as much time on one Part Review as you would on one entire chapter. So in terms of planning your time, think of the Part Review itself as another chapter. + +Figure 4 lists the names of the parts in this book, with some color coding. Note that Parts II and III are related (Ethernet), and Parts IV through VII are also related (IP version 4 and IP Version 6). Each part ends with a Part Review section of two to four pages, with notes about what tools and activities to use. + +7 IP Version 6 (22-25) 8 Wireless LANs (26-29) + + +4 IPv4 Addressing (11-14) + +5 IPv4 Routing (15-18) + +6 OSPF (19-21) + + + +2 Implementing Ethernet LANs (4-7) + +3 Implementing VLANs and STP (8-10) + + + +1 + +Figure 4 + +Introduction to Networking (1-3) + +Parts as Major Milestones + + +Also, consider setting a goal date for finishing each part of the book (and a reward, as well). Plan a break, some family time, some time out exercising, eating some good food, whatever helps you get refreshed and motivated for the next part. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +Step 4: Use Volume 2’s Final Review Chapter +Your fourth step has one overall task: perform the details outlined in the “Final Exam Review” chapter at the end of the CCNA 200-301 Official Cert Guide, Volume 2. Note that you have no exam to take at the end of this Volume 1 book, so keep working with Volume +2 when you complete this book. Once you’re finished with both books, Volume 2’s “Final Exam Review” will direct you. + +Step 5: Set Goals and Track Your Progress +Your fifth study plan step spans the entire timeline of your study effort. Before you start reading the book and doing the rest of these study tasks, take the time to make a plan, set some goals, and be ready to track your progress. + +While making lists of tasks may or may not appeal to you, depending on your personality, goal setting can help everyone studying for these exams. And to do the goal setting, you need to know what tasks you plan to do. + +NOTE If you read this, and decide that you want to try to do better with goal setting beyond your exam study, check out a blog series I wrote about planning your networking career here: http://blog.certskills.com/tag/development-plan/. + +As for the list of tasks to do when studying, you do not have to use a detailed task list. (You could list every single task in every chapter-ending “Chapter Review” section, every task in the Part Reviews, and every task in the “Final Review” chapter.) However, listing the major tasks can be enough. + +You should track at least two tasks for each typical chapter: reading the “Foundation Topics” section and doing the Chapter Review at the end of the chapter. And, of course, do not for-get to list tasks for Part Reviews and Final Review. Table 1 shows a sample for Part I of this book. + +Table 1 Sample Excerpt from a Planning Table + +Element + +Chapter 1 + +Chapter 1 + +Chapter 2 + +Chapter 2 + +Chapter 3 + +Chapter 3 + +Part I Review + +Task Goal Date +Read Foundation Topics + +Do Chapter Review tasks + +Read Foundation Topics + +Do Chapter Review tasks + +Read Foundation Topics + +Do Chapter Review tasks + +Do Part Review activities + +First Date Completed + +Second Date Completed (Optional) + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Your Study Plan 7 + + +NOTE Appendix I, “Study Planner,” on the companion website, contains a complete plan-ning checklist like Table 1 for the tasks in this book. This spreadsheet allows you to update and save the file to note your goal dates and the tasks you have completed. + +Use your goal dates as a way to manage your study, and not as a way to get discouraged if you miss a date. Pick reasonable dates that you can meet. When setting your goals, think about how fast you read and the length of each chapter’s “Foundation Topics” section, as listed in the table of contents. Then, when you finish a task sooner than planned, move up the next few goal dates. + +If you miss a few dates, do not start skipping the tasks listed at the ends of the chapters! Instead, think about what is impacting your schedule—real life, commitment, and so on— and either adjust your goals or work a little harder on your study. + +Things to Do Before Starting the First Chapter +Now that you understand the big ideas behind a good study plan for the book, take a few more minutes for a few overhead actions that will help. Before leaving this section, look at some other tasks you should do either now or around the time you are reading the first few chapters to help make a good start in the book. + +Bookmark the Companion Website +The companion website contains links to all the tools you need for chapter and part review. In fact, it includes a chapter-by-chapter and part-by-part breakdown of all the review activities. Before you finish the first chapter, make sure and follow the instructions in the Introduction’s section titled “The Companion Website for Online Content Review,” get access, and bookmark the page. + +Also, if you did not yet read about the companion website in the Introduction or explore the site, take a few minutes to look at the resources available on the site. + +Bookmark/Install Pearson Test Prep +This book, like many other Cisco Press books, includes the rights to use the Pearson Test Prep (PTP) software, along with rights to use some exam questions related to this book. PTP has many useful study features: + +■ Both a web and desktop version for your convenience and choice +■ History tracking of your simulated exam attempts, synchronized between web and desktop +■ Study mode, which lets you see the correct answers with each question and the related explanations +■ Practice exam mode, which simulates exam conditions, hiding answers/explanations and timing the exam event +■ Filters to let you choose questions based on chapter(s) and/or part(s) + +You should take a few minutes to set up your PTP installation. Refer to the section titled “How to Access the Pearson Test Prep (PTP) App” in the Introduction for details. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Understand This Book’s PTP Databases and Modes +When you activate a product in PTP, you gain the rights to that product’s exams. Under-standing those exams helps you choose when to use them and when to delay using differ-ent exams to save those questions for later. The retail version of this book comes with four exams, as shown in Figure 5; the premium edition adds exams 3 and 4, which are similar in purpose to exams 1 and 2. + + + +DIKTA (“Book”) + +Part Review + +Vol 1 Exam #1 + +Vol 1 Exam #2 + + +Figure 5 PTP Exams/Exam Databases and When to Use Them + +When using PTP, you can choose to use any of these exam databases at any time, both in study mode and practice exam mode. However, many people find it best to avoid using +some exams until you do your final exam review at the end of reading the CCNA 200-301 Official Cert Guide, Volume 2. So, consider using this plan: + +■ During Chapter Review, use PTP to review the DIKTA questions for that chapter, using study mode. +■ During Part Review, use the questions built specifically for Part Review (the Part Review questions) for that part of the book, using study mode. +■ Save the remaining exams to use with the “Final Review” chapter at the end of the Volume 2 book. + +Alternatively, use exams 1 and 2 at any time during your study, and consider buying the premium edition of the book to add two more exams. For instance, you could review each chapter by answering the questions from that chapter in exams 1 and 2, and wait to use exams 3 and 4 until your final exam review at the end of Volume 2. + +NOTE The CCNA 200-301 Official Cert Guide, Volume 2, includes several CCNA exams as well—exams that include questions from Volume 1 and Volume 2. You can use those exams during final review to practice simulated CCNA 200-301 exams. + +Additionally, take the time to experiment with the study modes in the PTP applications: + +Study mode: Study mode works best when you are still working on understanding and learning the content. In study mode, you can see the answers immediately, so you can study the topics more easily. +Practice mode: This mode lets you practice an exam event somewhat like the actual exam. It gives you a preset number of questions, from all chapters, with a timed event. Practice exam mode also gives you a score for that timed event. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Your Study Plan 9 + +Practice Viewing Per-Chapter DIKTA Questions +Take a few minutes to experiment with and understand how to use PTP to answer questions from a single chapter’s DIKTA quiz, as follows: +Step 1. Start the PTP web or desktop app. + +Step 2. From the main (home) menu, select the item for this product, with a name like CCNA 200-301 Official Cert Guide, Volume 1, and click Open Exam. + +Step 3. The top of the next window that appears should list some exams. Check the Book Questions box, and uncheck the other boxes. This selects the “book” questions (that is, the DIKTA questions from the beginning of each chapter). +Step 4. On this same window, click at the bottom of the screen to deselect all objec-tives (chapters). Then select the box beside each chapter in the part of the book you are reviewing. +Step 5. Select any other options on the right side of the window. + +Step 6. Click Start to start reviewing the questions. + + +Practice Viewing Per-Part Review Questions +Your PTP access also includes a Part Review exam created solely for study during the Part Review process. To view these questions, follow the same process as you did with +DIKTA/book questions, but select the Part Review database rather than the book database. PTP has a clear name for this database: Part Review Questions. + +Join the Cisco Learning Network CCNA Study Group +Register (for free) at the Cisco Learning Network (CLN, http://learningnetwork.cisco.com) and join the CCNA study group. This group allows you to both lurk and participate in dis-cussions about topics related to the CCNA exam. Register (for free), join the groups, and set up an email filter to redirect the messages to a separate folder. Even if you do not spend +time reading all the posts yet, later, when you have time to read, you can browse through the posts to find interesting topics (or just search the posts from the CLN website). + +Getting Started: Now +Now dive in to your first of many short, manageable tasks: reading the relatively short Chapter 1. Enjoy! + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +This first part of the book introduces the fundamentals of the most important topics in TCP/IP networking. Chapter 1 provides a broad look at TCP/IP, introducing the common terms, big concepts, and major protocols for TCP/IP. Chapter 2 then examines local-area networks (LAN), which are networks that connect devices that are located near each other; for instance, in the same building. Chapter 3 then shows how to connect those LANs across long distances with wide-area networks (WAN) with a focus on how routers connect LANs and WANs to forward data between any two devices in the network. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part I + + +Introduction to Networking + + + + +Chapter 1: Introduction to TCP/IP Networking + +Chapter 2: Fundamentals of Ethernet LANs + +Chapter 3: Fundamentals of WANs and IP Routing + +Part I Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 1 + + +Introduction to TCP/IP Networking This chapter covers the following exam topics: +1.0 Network Fundamentals +1.3 Compare physical interface and cabling types + +1.3.a Single-mode fiber, multimode fiber, copper + +1.3.b Connections (Ethernet shared media and point-to-point) + +Welcome to the first chapter in your study for CCNA! This chapter begins Part I, which focuses on the basics of networking. + +Networks work correctly because the various devices and software follow the rules. Those rules come in the form of standards and protocols, which are agreements of a particular part of how a network should work. However, the sheer number of standards and protocols available can make it difficult for the average network engineer to think about and work with networks—so the world of networking has used several networking models over time. Networking models define a structure and different categories (layers) of standards and pro- +tocols. As new standards and protocols emerge over time, networkers can think of those new details in the context of a working model. + +You can think of a networking model as you think of a set of architectural plans for building a house. A lot of different people work on building your house, such as framers, electricians, bricklayers, painters, and so on. The blueprint helps ensure that all the different pieces of the house work together as a whole. Similarly, the people who make networking products, and the people who use those products to build their own computer networks, follow a particular networking model. That networking model defines rules about how each part of the network +should work, as well as how the parts should work together so that the entire network functions correctly. + +Today, TCP/IP rules as the most pervasive networking model in use. You can find support for TCP/IP on practically every computer operating system (OS) in existence today, from mobile phones to mainframe computers. Every network built using Cisco products today supports TCP/IP. And not surprisingly, the CCNA exam focuses heavily on TCP/IP. This chapter uses TCP/IP for one of its main purposes: to present various concepts about networking using the context of the different roles and functions in the TCP/IP model. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + +Table 1-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Perspectives on Networking +TCP/IP Networking Model + +Data Encapsulation Terminology + +Questions None +1–4 + +5–7 + + + +1. Which of the following protocols are examples of TCP/IP transport layer protocols? (Choose two answers.) +a. Ethernet b. HTTP c. IP +d. UDP e. SMTP f. TCP +2. Which of the following protocols are examples of TCP/IP data-link layer protocols? (Choose two answers.) +a. Ethernet b. HTTP c. IP +d. UDP e. SMTP f. TCP g. PPP +3. The process of HTTP asking TCP to send some data and making sure that it is received correctly is an example of what? +a. Same-layer interaction +b. Adjacent-layer interaction c. OSI model +d. All of these answers are correct. + +4. The process of TCP on one computer marking a TCP segment as segment 1, and the receiving computer then acknowledging the receipt of TCP segment 1 is an example of what? +a. Data encapsulation +b. Same-layer interaction +c. Adjacent-layer interaction d. OSI model +e. All of these answers are correct. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +5. The process of a web server adding a TCP header to the contents of a web page, fol-lowed by adding an IP header and then adding a data-link header and trailer, is an example of what? +a. Data encapsulation +b. Same-layer interaction c. OSI model +d. All of these answers are correct. + +6. Which of the following terms is used specifically to identify the entity created when encapsulating data inside data-link layer headers and trailers? +a. Data b. Chunk +c. Segment d. Frame e. Packet +7. Which OSI encapsulation term can be used instead of the term frame? + +a. Layer 1 PDU b. Layer 2 PDU c. Layer 3 PDU d. Layer 5 PDU e. Layer 7 PDU + +Foundation Topics + +Perspectives on Networking +So, you are new to networking. Like many people, your perspective about networks might be that of a user of the network, as opposed to the network engineer who builds networks. For some, your view of networking might be based on how you use the Internet, from home, using a high-speed Internet connection like digital subscriber line (DSL) or cable TV, as shown in Figure 1-1. + + +Ethernet Cable + + +Wireless + +CATV Cable + +The Internet + +DSL + + + +Figure 1-1 End-User Perspective on High-Speed Internet Connections + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 1: Introduction to TCP/IP Networking + +The top part of the figure shows a typical high-speed cable Internet user. The PC connects to a cable modem using an Ethernet cable. The cable modem then connects to a cable TV (CATV) outlet in the wall using a round coaxial cable—the same kind of cable used to con-nect your TV to the CATV wall outlet. Because cable Internet services provide service con-tinuously, the user can just sit down at the PC and start sending email, browsing websites, making Internet phone calls, and using other tools and applications. + +The lower part of the figure uses two different technologies. First, the tablet computer uses wireless technology that goes by the name wireless local-area network (wireless LAN), or +Wi-Fi, instead of using an Ethernet cable. In this example, the router uses a different technol-ogy, DSL, to communicate with the Internet. + +Both home-based networks and networks built for use by a company make use of similar networking technologies. The Information Technology (IT) world refers to a network created by one corporation, or enterprise, for the purpose of allowing its employees to communi-cate, as an enterprise network. The smaller networks at home, when used for business pur-poses, often go by the name small office/home office (SOHO) networks. + +Users of enterprise networks have some idea about the enterprise network at their company or school. People realize that they use a network for many tasks. PC users might realize that their PC connects through an Ethernet cable to a matching wall outlet, as shown at the top of Figure 1-2. Those same users might use wireless LANs with their laptop when going to a meeting in the conference room as well. Figure 1-2 shows these two end-user perspectives +on an enterprise network. + +15 + + + +1 + + + + +Ethernet +Cable SW1 + +Enterprise Network + +Wireless + + + +Figure 1-2 Example Representation of an Enterprise Network + + +NOTE In networking diagrams, a cloud represents a part of a network whose details are not important to the purpose of the diagram. In this case, Figure 1-2 ignores the details of how to create an enterprise network. + +Some users might not even have a concept of the network at all. Instead, these users just enjoy the functions of the network—the ability to post messages to social media sites, make phone calls, search for information on the Internet, listen to music, and download countless apps to their phones—without caring about how it works or how their favorite device con-nects to the network. + +Regardless of how much you already know about how networks work, this book and the related certification help you learn how networks do their job. That job is simply this: moving data from one device to another. The rest of this chapter, and the rest of this first + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +part of the book, reveals the basics of how to build enterprise networks so that they can deliver data between two devices. + +TCP/IP Networking Model +A networking model, sometimes also called either a networking architecture or network-ing blueprint, refers to a comprehensive set of documents. Individually, each document describes one small function required for a network; collectively, these documents define everything that should happen for a computer network to work. Some documents define +a protocol, which is a set of logical rules that devices must follow to communicate. Other documents define some physical requirements for networking. For example, a document could define the voltage and current levels used on a particular cable when transmitting data. + +You can think of a networking model as you think of an architectural blueprint for building a house. Sure, you can build a house without the blueprint. However, the blueprint can ensure that the house has the right foundation and structure so that it will not fall down, and it has the correct hidden spaces to accommodate the plumbing, electrical, gas, and so on. Also, the many different people that build the house using the blueprint—such as framers, electricians, bricklayers, painters, and so on—know that if they follow the blueprint, their part of the work should not cause problems for the other workers. + +Similarly, you could build your own network—write your own software, build your own networking cards, and so on—to create a network. However, it is much easier to simply buy and use products that already conform to some well-known networking model or blueprint. Because the networking product vendors build their products with some networking model in mind, their products should work well together. + +History Leading to TCP/IP +Today, the world of computer networking uses one networking model: TCP/IP. However, the world has not always been so simple. Once upon a time, networking protocols didn’t exist, including TCP/IP. Vendors created the first networking protocols; these protocols supported only that vendor’s computers. + +For example, IBM, the computer company with the largest market share in many markets back in the 1970s and 1980s, published its Systems Network Architecture (SNA) networking model in 1974. Other vendors also created their own proprietary networking models. As a result, if your company bought computers from three vendors, network engineers often had to create three different networks based on the networking models created by each compa-ny, and then somehow connect those networks, making the combined networks much more complex. The left side of Figure 1-3 shows the general idea of what a company’s enterprise network might have looked like back in the 1980s, before TCP/IP became common in enter-prise internetworks. + + + + +Answers to the “Do I Know This Already?” quiz: 1 D and F 2 A and G 3 B 4 B 5 A 6 D 7 B + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 1: Introduction to TCP/IP Networking 17 + + + +IBM DEC IBM DEC 1 + + + +Other Vendor + + +TCP/IP TCP/IP + + + +Other Vendor + +1980s 1990s 2000s + +Figure 1-3 Historical Progression: Proprietary Models to the Open TCP/IP Model + +Although vendor-defined proprietary networking models often worked well, having an open, vendor-neutral networking model would aid competition and reduce complexity. The International Organization for Standardization (ISO) took on the task to create such a model, starting as early as the late 1970s, beginning work on what would become known +as the Open Systems Interconnection (OSI) networking model. ISO had a noble goal for the OSI model: to standardize data networking protocols to allow communication among all computers across the entire planet. ISO worked toward this ambitious and noble goal, with participants from most of the technologically developed nations on Earth participating in the process. + +A second, less-formal effort to create an open, vendor-neutral, public networking model sprouted forth from a U.S. Department of Defense (DoD) contract. Researchers at various universities volunteered to help further develop the protocols surrounding the original DoD work. These efforts resulted in a competing open networking model called TCP/IP. + +During the 1990s, companies began adding OSI, TCP/IP, or both to their enterprise networks. However, by the end of the 1990s, TCP/IP had become the common choice, and OSI fell away. The center part of Figure 1-3 shows the general idea behind enterprise networks in that decade—still with networks built upon multiple networking models but including TCP/IP. + +Here in the twenty-first century, TCP/IP dominates. Proprietary networking models still exist, but they have mostly been discarded in favor of TCP/IP. The OSI model, whose devel-opment suffered in part because of a slower formal standardization process as compared with TCP/IP, never succeeded in the marketplace. And TCP/IP, the networking model origi-nally created almost entirely by a bunch of volunteers, has become the most prolific network model ever, as shown on the right side of Figure 1-3. + +In this chapter, you will read about some of the basics of TCP/IP. Although you will learn some interesting facts about TCP/IP, the true goal of this chapter is to help you understand what a networking model or networking architecture really is and how it works. + +Also in this chapter, you will learn about some of the jargon used with OSI. Will any of you ever work on a computer that is using the full OSI protocols instead of TCP/IP? Probably not. However, you will often use terms relating to OSI. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +Overview of the TCP/IP Networking Model +The TCP/IP model both defines and references a large collection of protocols that allow computers to communicate. To define a protocol, TCP/IP uses documents called Requests For Comments (RFC). (You can find these RFCs using any online search engine.) The TCP/IP model also avoids repeating work already done by some other standards body or vendor con-sortium by simply referring to standards or protocols created by those groups. For example, the Institute of Electrical and Electronic Engineers (IEEE) defines Ethernet LANs; the TCP/IP model does not define Ethernet in RFCs, but refers to IEEE Ethernet as an option. + +The TCP/IP model creates a set of rules that allows us all to take a computer (or mobile device) out of the box, plug in all the right cables, turn it on, and connect to and use the network. You can use a web browser to connect to your favorite website, use most any app, and it all works. How? Well, the OS on the computer implements parts of the TCP/IP model. The Ethernet card, or wireless LAN card, built in to the computer implements some LAN standards referenced by the TCP/IP model. In short, the vendors that created the hardware and software implemented TCP/IP. + +To help people understand a networking model, each model breaks the functions into a small number of categories called layers. Each layer includes protocols and standards that relate to that category of functions, as shown in Figure 1-4. + +TCP/IP Model + + +Application + +Transport Network Data Link Physical +Figure 1-4 The TCP/IP Networking Models + +The TCP/IP model shows the more common terms and layers used when people talk about TCP/IP today. The bottom layer focuses on how to transmit bits over each individual link. The data-link layer focuses on sending data over one type of physical link: for instance, networks use different data-link protocols for Ethernet LANs versus wireless LANs. The net-work layer focuses on delivering data over the entire path from the original sending comput-er to the final destination computer. And the top two layers focus more on the applications that need to send and receive data. + +NOTE A slightly different four-layer original version of the TCP/IP model exists in RFC 1122, but for the purposes of both real networking and for today’s CCNA, use the five-layer model shown here in Figure 1-4. + +Many of you will have already heard of several TCP/IP protocols, like the examples listed in Table 1-2. Most of the protocols and standards in this table will be explained in more detail as you work through this book. Following the table, this section takes a closer look at the layers of the TCP/IP model. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 1: Introduction to TCP/IP Networking 19 + +Table 1-2 TCP/IP Architectural Model and Example Protocols + +TCP/IP Architecture Layer Application +Transport + +Internet + +Data Link & Physical + +Example Protocols 1 HTTP, POP3, SMTP +TCP, UDP + +IP, ICMP + +Ethernet, 802.11 (Wi-Fi) + + + +TCP/IP Application Layer +TCP/IP application layer protocols provide services to the application software running on a computer. The application layer does not define the application itself, but it defines services that applications need. For example, application protocol HTTP defines how web browsers can pull the contents of a web page from a web server. In short, the application layer pro-vides an interface between software running on a computer and the network itself. + +Arguably, the most popular TCP/IP application today is the web browser. Many major soft-ware vendors either have already changed or are changing their application software to sup-port access from a web browser. And thankfully, using a web browser is easy: You start a web browser on your computer and select a website by typing the name of the website, and the web page appears. + +HTTP Overview +What really happens to allow that web page to appear on your web browser? + +Imagine that Bob opens his browser. His browser has been configured to automatically ask for web server Larry’s default web page, or home page. The general logic looks like Figure 1-5. + + +Web Server - Larry +Give me your web page + +Here is the file home.htm + +Web Browser - Bob + +1 + +2 + + +Figure 1-5 Basic Application Logic to Get a Web Page + +So, what really happened? Bob’s initial request actually asks Larry to send his home page back to Bob. Larry’s web server software has been configured to know that the default web page is contained in a file called home.htm. Bob receives the file from Larry and displays the contents of the file in Bob’s web browser window. + +HTTP Protocol Mechanisms +Taking a closer look, this example shows how applications on each endpoint computer—spe-cifically, the web browser application and web server application—use a TCP/IP application layer protocol. To make the request for a web page and return the contents of the web page, the applications use the Hypertext Transfer Protocol (HTTP). + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +20 CCNA 200-301 Official Cert Guide, Volume 1 + +HTTP did not exist until Tim Berners-Lee created the first web browser and web server in the early 1990s. Berners-Lee gave HTTP functionality to ask for the contents of web pages, specifically by giving the web browser the ability to request files from the server and giv-ing the server a way to return the content of those files. The overall logic matches what was shown in Figure 1-5; Figure 1-6 shows the same idea, but with details specific to HTTP. + +NOTE The full version of most web addresses—also called Uniform Resource Locators (URL) or Universal Resource Identifiers (URI)—begins with the letters http, which means that HTTP is used to transfer the web pages. + + +Web Server +Larry +HTTP Header +OK + +HTTP Header +GET home.htm 1 + +Data +home.htm 2 + + +Web Browser Bob + + +Data +More of file home.htm 3 + +Figure 1-6 HTTP GET Request, HTTP Reply, and One Data-Only Message + +To get the web page from Larry, at Step 1, Bob sends a message with an HTTP header. Generally, protocols use headers as a place to put information used by that protocol. This HTTP header includes the request to “get” a file. The request typically contains the name of the file (home.htm, in this case), or if no filename is mentioned, the web server assumes that Bob wants the default web page. + +Step 2 in Figure 1-6 shows the response from web server Larry. The message begins with an HTTP header, with a return code (200), which means something as simple as “OK” returned in the header. HTTP also defines other return codes so that the server can tell the browser whether the request worked. (Here is another example: If you ever looked for a web page that was not found, and then received an HTTP 404 “not found” error, you received an HTTP return code of 404.) The second message also includes the first part of the requested file. + +Step 3 in Figure 1-6 shows another message from web server Larry to web browser Bob, but this time without an HTTP header. HTTP transfers the data by sending multiple messages, each with a part of the file. Rather than wasting space by sending repeated HTTP headers that list the same information, these additional messages simply omit the header. + +TCP/IP Transport Layer +Although many TCP/IP application layer protocols exist, the TCP/IP transport layer includes a smaller number of protocols. The two most commonly used transport layer protocols are the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). + +Transport layer protocols provide services to the application layer protocols that reside one layer higher in the TCP/IP model. How does a transport layer protocol provide a service to a higher-layer protocol? This section introduces that general concept by focusing on a single service provided by TCP: error recovery. The CCNA 200-301 Official Cert Guide, Volume 2, includes a chapter, “Introduction to TCP/IP Transport and Applications,” which examines the transport layer. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 1: Introduction to TCP/IP Networking 21 + +TCP Error Recovery Basics +To appreciate what the transport layer protocols do, you must think about the layer above 1 the transport layer, the application layer. Why? Well, each layer provides a service to the +layer above it, like the error-recovery service provided to application layer protocols by TCP. + +For example, in Figure 1-5, Bob and Larry used HTTP to transfer the home page from web server Larry to Bob’s web browser. But what would have happened if Bob’s HTTP GET request had been lost in transit through the TCP/IP network? Or, what would have happened if Larry’s response, which included the contents of the home page, had been lost? Well, as you might expect, in either case, the page would not have shown up in Bob’s browser. + +TCP/IP needs a mechanism to guarantee delivery of data across a network. Because many application layer protocols probably want a way to guarantee delivery of data across a net-work, the creators of TCP included an error-recovery feature. To recover from errors, TCP uses the concept of acknowledgments. Figure 1-7 outlines the basic idea behind how TCP notices lost data and asks the sender to try again. + + +Web Server Larry + +TCP HTTP Data +SEQ = 1 OK Web Page + +TCP Data +SEQ = 2 More Web Page + + +Web 1 Browser +Bob Lost! +2 + + + +TCP Data +SEQ = 3 Rest of Web Page + + +3 + +TCP +Send 2 Next 4 + + +Figure 1-7 TCP Error-Recovery Services as Provided to HTTP + +Figure 1-7 shows web server Larry sending a web page to web browser Bob, using three sep-arate messages. Note that this figure shows the same HTTP headers as Figure 1-6, but it also shows a TCP header. The TCP header shows a sequence number (SEQ) with each message. In this example, the network has a problem, and the network fails to deliver the TCP message (called a segment) with sequence number 2. When Bob receives messages with sequence numbers 1 and 3, but does not receive a message with sequence number 2, Bob realizes that message 2 was lost. That realization by Bob’s TCP logic causes Bob to send a TCP segment back to Larry, asking Larry to send message 2 again. + +Same-Layer and Adjacent-Layer Interactions +Figure 1-7 also demonstrates a function called adjacent-layer interaction, which refers to the concepts of how adjacent layers in a networking model, on the same computer, work together. In this example, the higher-layer protocol (HTTP) wants error recovery, so it uses the next lower-layer protocol (TCP) to perform the service of error recovery; the lower layer provides a service to the layer above it. + +Figure 1-7 also shows an example of a similar function called same-layer interaction. When a particular layer on one computer wants to communicate with the same layer on another computer, the two computers use headers to hold the information that they want + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +22 CCNA 200-301 Official Cert Guide, Volume 1 + +to communicate. For example, in Figure 1-7, Larry set the sequence numbers to 1, 2, and 3 so that Bob could notice when some of the data did not arrive. Larry’s TCP process created that TCP header with the sequence number; Bob’s TCP process received and reacted to the TCP segments. + +Table 1-3 summarizes the key points about how adjacent layers work together on a single computer and how one layer on one computer works with the same networking layer on another computer. + + +Table 1-3 +Concept + +Summary: Same-Layer and Adjacent-Layer Interactions +Description + + + +Same-layer interaction on different computers + +Adjacent-layer interaction on the same computer + +The two computers use a protocol to communicate with the same layer on another computer. The protocol defines a header that communicates what each computer wants to do. +On a single computer, one lower layer provides a service to the layer just above. The software or hardware that implements the higher layer requests that the next lower layer perform the needed function. + + + +TCP/IP Network Layer +The application layer includes many protocols. The transport layer includes fewer protocols, most notably, TCP and UDP. The TCP/IP network layer includes a small number of protocols, but only one major protocol: the Internet Protocol (IP). In fact, the name TCP/IP is simply the names of the two most common protocols (TCP and IP) separated by a /. + +IP provides several features, most importantly, addressing and routing. This section begins by comparing IP’s addressing and routing with another commonly known system that uses +addressing and routing: the postal service. Following that, this section introduces IP addressing and routing. (More details follow in Chapter 3, “Fundamentals of WANs and IP Routing.”) + +Internet Protocol and the Postal Service +Imagine that you just wrote two letters: one to a friend on the other side of the country and one to a friend on the other side of town. You addressed the envelopes and put on the stamps, so both are ready to give to the postal service. Is there much difference in how you treat each letter? Not really. Typically, you would just put them in the same mailbox and expect the postal service to deliver both letters. + +The postal service, however, must think about each letter separately, and then make a deci-sion of where to send each letter so that it is delivered. For the letter sent across town, the people in the local post office probably just need to put the letter on another truck. + +For the letter that needs to go across the country, the postal service sends the letter to anoth-er post office, then another, and so on, until the letter gets delivered across the country. At each post office, the postal service must process the letter and choose where to send it next. + +To make it all work, the postal service has regular routes for small trucks, large trucks, planes, boats, and so on, to move letters between postal service sites. The service must be able to receive and forward the letters, and it must make good decisions about where to send each letter next, as shown in Figure 1-8. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 1: Introduction to TCP/IP Networking 23 + +Postal Service +Local 1 + +California + + + + + + + + +Figure 1-8 Postal Service Forwarding (Routing) Letters + +Still thinking about the postal service, consider the difference between the person sending the letter and the work that the postal service does. The person sending the letters expects that the postal service will deliver the letter most of the time. However, the person sending the letter does not need to know the details of exactly what path the letters take. In con-trast, the postal service does not create the letter, but it accepts the letter from the customer. Then, the postal service must know the details about addresses and postal codes that group addresses into larger groups, and it must have the ability to deliver the letters. + +The TCP/IP application and transport layers act like the person sending letters through the postal service. These upper layers work the same way regardless of whether the endpoint host computers are on the same LAN or are separated by the entire Internet. To send a mes-sage, these upper layers ask the layer below them, the network layer, to deliver the message. + +The lower layers of the TCP/IP model act more like the postal service to deliver those mes-sages to the correct destinations. To do so, these lower layers must understand the underly-ing physical network because they must choose how to best deliver the data from one host to another. + +So, what does this all matter to networking? Well, the network layer of the TCP/IP network-ing model, primarily defined by the Internet Protocol (IP), works much like the postal ser-vice. IP defines that each host computer should have a different IP address, just as the postal service defines addressing that allows unique addresses for each house, apartment, and busi-ness. Similarly, IP defines the process of routing so that devices called routers can work like the post office, forwarding packets of data so that they are delivered to the correct destina-tions. Just as the postal service created the necessary infrastructure to deliver letters—post offices, sorting machines, trucks, planes, and personnel—the network layer defines the details of how a network infrastructure should be created so that the network can deliver data to all computers in the network. + +Internet Protocol Addressing Basics +IP defines addresses for several important reasons. First, each device that uses TCP/IP—each TCP/IP host—needs a unique address so that it can be identified in the network. IP also defines how to group addresses together, just like the postal system groups addresses based on postal codes (like ZIP codes in the United States). + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +24 CCNA 200-301 Official Cert Guide, Volume 1 + +To understand the basics, examine Figure 1-9, which shows the familiar web server Larry and web browser Bob; but now, instead of ignoring the network between these two computers, part of the network infrastructure is included. + + +Addresses: 1.__.__.__ + +Larry + + +R1 +1.1.1.1 + +Addresses: 2.__.__.__ + +Bob + +R2 +2.2.2.2 + + +Archie + +R3 3.3.3.3 + +Addresses: 3.__.__.__ + +Figure 1-9 Simple TCP/IP Network: Three Routers with IP Addresses Grouped + +First, note that Figure 1-9 shows some sample IP addresses. Each IP address has four num-bers, separated by periods. In this case, Larry uses IP address 1.1.1.1, and Bob uses 2.2.2.2. This style of number is called a dotted-decimal notation (DDN). + +Figure 1-9 also shows three groups of addresses. In this example, all IP addresses that begin with 1 must be on the upper left, as shown in shorthand in the figure as 1.__.__.__. All addresses that begin with 2 must be on the right, as shown in shorthand as 2.__.__.__. Finally, all IP addresses that begin with 3 must be at the bottom of the figure. + +In addition, Figure 1-9 introduces icons that represent IP routers. Routers are networking devices that connect the parts of the TCP/IP network together for the purpose of routing (forwarding) IP packets to the correct destination. Routers do the equivalent of the work done by each post office site: They receive IP packets on various physical interfaces, make decisions based on the IP address included with the packet, and then physically forward the packet out some other network interface. + +IP Routing Basics +The TCP/IP network layer, using the IP protocol, provides a service of forwarding IP packets from one device to another. Any device with an IP address can connect to the TCP/IP net-work and send packets. This section shows a basic IP routing example for perspective. + +NOTE The term IP host refers to any device, regardless of size or power, that has an IP address and connects to any TCP/IP network. + +Figure 1-10 repeats the familiar case in which web server Larry wants to send part of a web page to Bob, but now with details related to IP. On the lower left, note that server Larry has the familiar application data, HTTP header, and TCP header ready to send. In addition, the message now contains an IP header. The IP header includes a source IP address of Larry’s IP address (1.1.1.1) and a destination IP address of Bob’s IP address (2.2.2.2). + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 1: Introduction to TCP/IP Networking 25 + + + +Always to R1 + +To 2._____ Send to R2 + +To 2._____ +Send Locally 1 + + + +Larry 1 1.1.1.1 + +2 3 Bob R1 R2 2.2.2.2 + + +IP TCP HTTP Addresses: 2._____ + +Destination 2.2.2.2 +Source 1.1.1.1 R3 + +Figure 1-10 Basic Routing Example + +Step 1, on the left of Figure 1-10, begins with Larry being ready to send an IP packet. Larry’s IP process chooses to send the packet to some router—a nearby router on the same LAN—with the expectation that the router will know how to forward the packet. (This logic is much like you or me sending all our letters by putting them in a nearby mailbox.) Larry doesn’t need to know anything more about the topology or the other routers. + +At Step 2, Router R1 receives the IP packet, and R1’s IP process makes a decision. R1 looks at the destination address (2.2.2.2), compares that address to its known IP routes, and chooses to forward the packet to Router R2. This process of forwarding the IP packet is called IP routing (or simply routing). + +At Step 3, Router R2 repeats the same kind of logic used by Router R1. R2’s IP process will compare the packet’s destination IP address (2.2.2.2) to R2’s known IP routes and make a choice to forward the packet to the right, on to Bob. + +You will learn IP in more depth than any other protocol while preparing for CCNA. More than half the chapters in this book discuss some feature that relates to addressing, IP routing, and how routers perform routing. + +TCP/IP Data-Link and Physical Layers +The TCP/IP model’s data-link and physical layers define the protocols and hardware required to deliver data across some physical network. The two work together quite closely; in fact, some standards define both the data-link and physical layer functions. The physical layer defines the cabling and energy (for example, electrical signals) that flow over the cables. Some rules and conventions exist when sending data over the cable; however, those rules exist in the data-link layer of the TCP/IP model. + +Focusing on the data-link layer for a moment, just like every layer in any networking model, the TCP/IP data-link layer provides services to the layer above it in the model (the network layer). When a host’s or router’s IP process chooses to send an IP packet to another router or host, that host or router then uses link-layer details to send that packet to the next host/ router. + +Because each layer provides a service to the layer above it, take a moment to think about the IP logic related to Figure 1-10. In that example, host Larry’s IP logic chooses to send the IP + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +26 CCNA 200-301 Official Cert Guide, Volume 1 + +packet to a nearby router (R1). However, while Figure 1-10 shows a simple line between Larry and router R1, that drawing means that some Ethernet LAN sits between the two. Figure +1-11 shows four steps of what occurs at the link layer to allow Larry to send the IP packet to R1. + + + +Larry 1.1.1.1 + + +IP Packet + +1 Encapsulate + + +R1 + + +IP Packet + +4 De-encapsulate + + + +Ethernet +Header + + +IP Packet + +Eth. Trailer + +Ethernet +Header + + +IP Packet + +Eth. Trailer + + +2 Transmit 3 Receive + +Figure 1-11 Larry Using Ethernet to Forward an IP Packet to Router R1 + + +NOTE Figure 1-11 depicts the Ethernet as a series of lines. Networking diagrams often use this convention when drawing Ethernet LANs, in cases where the actual LAN cabling and LAN devices are not important to some discussion, as is the case here. The LAN would have cables and devices, like LAN switches, which are not shown in this figure. + +Figure 1-11 shows four steps. The first two occur on Larry, and the last two occur on Router R1, as follows: +Step 1. Larry encapsulates the IP packet between an Ethernet header and Ethernet trailer, creating an Ethernet frame. + +Step 2. Larry physically transmits the bits of this Ethernet frame, using electricity flowing over the Ethernet cabling. + +Step 3. Router R1 physically receives the electrical signal over a cable and re-creates the same bits by interpreting the meaning of the electrical signals. + +Step 4. Router R1 de-encapsulates the IP packet from the Ethernet frame by removing and discarding the Ethernet header and trailer. + + +By the end of this process, Larry and R1 have worked together to deliver the packet from Larry to Router R1. + +NOTE Protocols define both headers and trailers for the same general reason, but headers exist at the beginning of the message and trailers exist at the end. + +The data-link and physical layers include a large number of protocols and standards. For example, the link layer includes all the variations of Ethernet protocols and wireless LAN protocols discussed throughout this book. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 1: Introduction to TCP/IP Networking + +In short, the TCP/IP physical and data-link layers include two distinct functions, respec-tively: functions related to the physical transmission of the data, plus the protocols and rules +that control the use of the physical media. + +27 + + + +1 + + +Data Encapsulation Terminology +As you can see from the explanations of how HTTP, TCP, IP, and Ethernet do their jobs, when sending data, each layer adds its own header (and for data-link protocols, also a trailer) to the data supplied by the higher layer. The term encapsulation refers to the process of putting headers (and sometimes trailers) around some data. + +Many of the examples in this chapter show the encapsulation process. For example, web server Larry encapsulated the contents of the home page inside an HTTP header in Figure 1-6. The TCP layer encapsulated the HTTP headers and data inside a TCP header in Figure +1-7. IP encapsulated the TCP headers and the data inside an IP header in Figure 1-10. Finally, the Ethernet link layer encapsulated the IP packets inside both a header and a trailer in Figure 1-11. + +The process by which a TCP/IP host sends data can be viewed as a five-step process. The first four steps relate to the encapsulation performed by the four TCP/IP layers, and the last step is the actual physical transmission of the data by the host. In fact, if you use the five-layer TCP/IP model, one step corresponds to the role of each layer. The steps are summarized in the following list: +Step 1. Create and encapsulate the application data with any required application layer headers. For example, the HTTP OK message can be returned in an HTTP header, followed by part of the contents of a web page. +Step 2. Encapsulate the data supplied by the application layer inside a transport layer header. For end-user applications, a TCP or UDP header is typically used. + +Step 3. Encapsulate the data supplied by the transport layer inside a network layer (IP) header. IP defines the IP addresses that uniquely identify each computer. + +Step 4. Encapsulate the data supplied by the network layer inside a data-link layer header and trailer. This layer uses both a header and a trailer. + +Step 5. Transmit the bits. The physical layer encodes a signal onto the medium to transmit the frame. + + +The numbers in Figure 1-12 correspond to the five steps in this list, graphically showing the same concepts. Note that because the application layer often does not need to add a header, the figure does not show a specific application layer header, but the application layer will also at times add a header as well. + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +28 CCNA 200-301 Official Cert Guide, Volume 1 + + +1 +Data +2 +TCP Data +3 +IP TCP Data + +1 +Application + +2 +Transport + +3 +Network + + + +4 +Data Link IP TCP + + +4 +Data Data Link + +4 +Data Link + + + +5 +Transmit Bits + +5 +Physical + + +Figure 1-12 Five Steps of Data Encapsulation: TCP/IP + +Names of TCP/IP Messages +One reason this chapter takes the time to show the encapsulation steps in detail has to do with terminology. When talking and writing about networking, people use segment, packet, and frame to refer to the messages shown in Figure 1-13 and the related list. Each term has a specific meaning, referring to the headers (and possibly trailers) defined by a particular layer and the data encapsulated following that header. Each term, however, refers to a different layer: segment for the transport layer, packet for the network layer, and frame for the link layer. Figure 1-13 shows each layer along with the associated term. + +TCP Data Segment + +IP Data Packet + +LH Data LT Frame + +Figure 1-13 Perspectives on Encapsulation and “Data”* + +* The letters LH and LT stand for link header and link trailer, respectively, and refer to the data-link layer header and trailer. + +Figure 1-13 also shows the encapsulated data as simply “data.” When focusing on the work done by a particular layer, the encapsulated data typically is unimportant. For example, an IP packet can indeed have a TCP header after the IP header, an HTTP header after the TCP header, and data for a web page after the HTTP header. However, when discussing IP, you probably just care about the IP header, so everything after the IP header is just called data. So, when drawing IP packets, everything after the IP header is typically shown simply as data. + +OSI Networking Model and Terminology +At one point in the history of the OSI model, many people thought that OSI would win the battle of the networking models discussed earlier. If that had occurred, instead of running TCP/IP on every computer in the world, those computers would be running with OSI. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 1: Introduction to TCP/IP Networking + +However, OSI did not win that battle. In fact, OSI no longer exists as a networking model that could be used instead of TCP/IP, although some of the original protocols referenced by the OSI model still exist. + +So, why is OSI even in this book? Terminology. During those years in which many people thought the OSI model would become commonplace in the world of networking (mostly in the late 1980s and early 1990s), many vendors and protocol documents started using termi-nology from the OSI model. That terminology remains today. So, while you will never need to work with a computer that uses OSI, to understand modern networking terminology, you +need to understand something about OSI. + +29 + + + +1 + + +Comparing OSI and TCP/IP Layer Names and Numbers +The OSI model has many similarities to the TCP/IP model from a basic conceptual perspec-tive. It has layers, and each layer defines a set of typical networking functions. As with TCP/ IP, the OSI layers each refer to multiple protocols and standards that implement the functions specified by each layer. In other cases, just as for TCP/IP, the OSI committees did not create new protocols or standards, but instead referenced other protocols that were already defined. For example, the IEEE defines Ethernet standards, so the OSI committees did not waste time specifying a new type of Ethernet; it simply referred to the IEEE Ethernet standards. + +Today, the OSI model can be used as a standard of comparison to other networking models. Figure 1-14 compares the seven-layer OSI model with both the four-layer and five-layer TCP/IP models. + + +OSI +7 Application +6 Presentation 5 - 7 5 Session +4 Transport 4 3 Network 3 2 Data Link 2 +1 Physical 1 + +TCP/IP + + +Application + + +Transport Network Data Link +Physical + + +Figure 1-14 OSI Model Compared to the Two TCP/IP Models + +Note that the TCP/IP model in use today, on the right side of the figure, uses the exact same layer names as OSI at the lower layers. The functions generally match as well, so for the pur-pose of discussing networking, and reading networking documentation, think of the bottom four layers as equivalent, in name, in number, and in meaning. + +Even though the world uses TCP/IP today rather than OSI, we tend to use the numbering from the OSI layer. For instance, when referring to an application layer protocol in a TCP/IP network, the world still refers to the protocol as a “Layer 7 protocol.” Also, while TCP/IP includes more functions at its application layer, OSI breaks those intro session, presentation, and application layers. Most of the time, no one cares much about the distinction, so you will see references like “Layer 5–7 protocol,” again using OSI numbering. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +30 CCNA 200-301 Official Cert Guide, Volume 1 + +For the purposes of this book, know the mapping between the five-layer TCP/IP model and the seven-layer OSI model shown in Figure 1-14, and know that layer number references to Layer 7 really do match the application layer of TCP/IP as well. + +OSI Data Encapsulation Terminology +Like TCP/IP, each OSI layer asks for services from the next lower layer. To provide the ser-vices, each layer makes use of a header and possibly a trailer. The lower layer encapsulates the higher layer’s data behind a header. + +OSI uses a more generic term to refer to messages, rather than frame, packet, and segment. OSI uses the term protocol data unit (PDU). A PDU represents the bits that include the headers and trailers for that layer, as well as the encapsulated data. For example, an IP packet, as shown in Figure 1-13, using OSI terminology, is a PDU, more specifically a Layer 3 PDU (abbreviated L3PDU) because IP is a Layer 3 protocol. OSI simply refers to the Layer x +PDU (LxPDU), with x referring to the number of the layer being discussed, as shown in Figure 1-15. + +L#H - Layer # Header L7H Data L7PDU L#T - Layer # Trailer + +L6H Data L6PDU + +L5H Data L5PDU + +L4H Data L4PDU + +L3H Data L3PDU + +L2H Data L2T L2PDU + +Figure 1-15 OSI Encapsulation and Protocol Data Units + + +Chapter Review + +The “Your Study Plan” element, just before Chapter 1, discusses how you should study and practice the content and skills for each chapter before moving on to the next chapter. That element introduces the tools used here at the end of each chapter. If you haven’t already done so, take a few minutes to read that section. Then come back here and do the useful work of reviewing the chapter to help lock into memory what you just read. + +Review this chapter’s material using either the tools in the book or the interactive tools for the same material found on the book’s companion website. Table 1-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 1: Introduction to TCP/IP Networking 31 + +Table 1-4 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Answer DIKTA questions + +Review Date(s) Resource Used 1 Book, website +Book, website + +Book, PTP Online + + + +Review All the Key Topics + +Table 1-5 Key Topics for Chapter 1 + +Key Topic Elements +Table 1-3 + +Figure 1-10 + +Figure 1-11 + +Figure 1-12 + +Figure 1-13 + +Figure 1-14 + +Figure 1-15 + +Description Page Number +Provides definitions of same-layer and adjacent-layer interaction 22 + +Shows the general concept of IP routing 25 + +Depicts the data-link services provided to IP for the purpose of 26 delivering IP packets from host to host +Five steps to encapsulate data on the sending host 28 + +Shows the meaning of the terms segment, packet, and frame 28 + +Compares the OSI and TCP/IP network models 29 + +Terminology related to encapsulation 30 + + + +Key Terms You Should Know +adjacent-layer interaction, de-encapsulation, encapsulation, frame, networking model, packet, protocol data unit (PDU), same-layer interaction, segment + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 2 + + +Fundamentals of Ethernet LANs This chapter covers the following exam topics: +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.b L2 and L3 Switches + +1.2 Describe characteristics of network topology architectures + +1.2.e Small office/home office (SOHO) + +1.3 Compare physical interface and cabling types + +1.3.a Single-mode fiber, multimode fiber, copper + +1.3.b Connections (Ethernet shared media and point-to-point) + +Most enterprise computer networks can be separated into two general types of technol-ogy: local-area networks (LANs) and wide-area networks (WANs). LANs typically connect nearby devices: devices in the same room, in the same building, or in a campus of buildings. +In contrast, WANs connect devices that are typically relatively far apart. Together, LANs and WANs create a complete enterprise computer network, working together to do the job of a computer network: delivering data from one device to another. + +Many types of LANs have existed over the years, but today’s networks use two general types of LANs: Ethernet LANs and wireless LANs. Ethernet LANs happen to use cables for the links between nodes, and because many types of cables use copper wires, Ethernet LANs are often called wired LANs. Ethernet LANs also make use of fiber-optic cabling, which includes a fiberglass core that devices use to send data using light. In comparison to Ethernet, wireless LANs do not use wires or cables, instead using radio waves for the links between nodes; Part V of this book discusses Wireless LANs at length. + +This chapter introduces Ethernet LANs, with more detailed coverage in Parts II and III of this book. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Table 2-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section An Overview of LANs +Building Physical Ethernet LANs with UTP + +Building Physical Ethernet LANs with Fiber + +Sending Data in Ethernet Networks + +Questions 1–2 +3–4 + +5 + +6–9 + + + +1. In the LAN for a small office, some user devices connect to the LAN using a cable, while others connect using wireless technology (and no cable). Which of the following is true regarding the use of Ethernet in this LAN? +a. Only the devices that use cables are using Ethernet. b. Only the devices that use wireless are using Ethernet. +c. Both the devices using cables and those using wireless are using Ethernet. d. None of the devices are using Ethernet. +2. Which of the following Ethernet standards defines Gigabit Ethernet over UTP cabling? a. 10GBASE-T +b. 100BASE-T c. 1000BASE-T +d. None of the other answers is correct. +3. Which of the following is true about Ethernet crossover cables for Fast Ethernet? a. Pins 1 and 2 are reversed on the other end of the cable. +b. Pins 1 and 2 on one end of the cable connect to pins 3 and 6 on the other end of the cable. +c. Pins 1 and 2 on one end of the cable connect to pins 3 and 4 on the other end of the cable. +d. The cable can be up to 1000 meters long to cross over between buildings. e. None of the other answers is correct. +4. Each answer lists two types of devices used in a 100BASE-T network. If these devices were connected with UTP Ethernet cables, which pairs of devices would require a straight-through cable? (Choose three answers.) +a. PC and router b. PC and switch c. Hub and switch d. Router and hub +e. Wireless access point (Ethernet port) and switch + + +|||||||||||||||||||| +|||||||||||||||||||| + + +34 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Which of the following are advantages of using multimode fiber for an Ethernet link instead of UTP or single-mode fiber? +a. To achieve the longest distance possible for that single link. +b. To extend the link beyond 100 meters while keeping initial costs as low as possible. c. To make use of an existing stock of laser-based SFP/SFP+ modules. +d. To make use of an existing stock of LED-based SFP/SFP+ modules. + +6. Which of the following is true about the CSMA/CD algorithm? a. The algorithm never allows collisions to occur. +b. Collisions can happen, but the algorithm defines how the computers should notice a collision and how to recover. +c. The algorithm works with only two devices on the same Ethernet. d. None of the other answers is correct. +7. Which of the following is true about the Ethernet FCS field? a. Ethernet uses FCS for error recovery. +b. It is 2 bytes long. +c. It resides in the Ethernet trailer, not the Ethernet header. d. It is used for encryption. +8. Which of the following are true about the format of Ethernet addresses? (Choose three answers.) +a. Each manufacturer puts a unique OUI code into the first 2 bytes of the address. b. Each manufacturer puts a unique OUI code into the first 3 bytes of the address. c. Each manufacturer puts a unique OUI code into the first half of the address. +d. The part of the address that holds this manufacturer’s code is called the MAC. e. The part of the address that holds this manufacturer’s code is called the OUI. +f. The part of the address that holds this manufacturer’s code has no specific name. + +9. Which of the following terms describe Ethernet addresses that can be used to send one frame that is delivered to multiple devices on the LAN? (Choose two answers.) + +a. Burned-in address b. Unicast address c. Broadcast address d. Multicast address + +Foundation Topics + +An Overview of LANs +The term Ethernet refers to a family of LAN standards that together define the physical and data-link layers of the world’s most popular wired LAN technology. The standards, defined by the Institute of Electrical and Electronics Engineers (IEEE), define the cabling, + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 35 + +the connectors on the ends of the cables, the protocol rules, and everything else required to create an Ethernet LAN. + + +Typical SOHO LANs +To begin, first think about a small office/home office (SOHO) LAN today, specifically a LAN that uses only Ethernet LAN technology. First, the LAN needs a device called an Ethernet LAN switch, which provides many physical ports into which cables can be con-nected. An Ethernet uses Ethernet cables, which is a general reference to any cable that conforms to any of several Ethernet standards. The LAN uses Ethernet cables to connect dif-ferent Ethernet devices or nodes to one of the switch’s Ethernet ports. + +Figure 2-1 shows a drawing of a SOHO Ethernet LAN. The figure shows a single LAN switch, five cables, and five other Ethernet nodes: three PCs, a printer, and one network device called a router. (The router connects the LAN to the WAN, in this case to the +Internet.) + + + +2 + + +To Internet + + +Router + +F0/1 F0/3 + +Switch +F0/2 F0/4 + +Figure 2-1 Typical Small Ethernet-Only SOHO LAN + +Although Figure 2-1 shows the switch and router as separate devices, many SOHO Ethernet LANs today combine the router and switch into a single device. Vendors sell consumer-grade integrated networking devices that work as a router and Ethernet switch, as well as doing other functions. These devices typically have “router” on the packaging, but many models also have four-port or eight-port Ethernet LAN switch ports built in to the device. + +Typical SOHO LANs today also support wireless LAN connections. You can build a single SOHO LAN that includes both Ethernet LAN technology as well as wireless LAN technol-ogy, which is also defined by the IEEE. Wireless LANs, defined by the IEEE using standards that begin with 802.11, use radio waves to send the bits from one node to the next. + +Most wireless LANs rely on yet another networking device: a wireless LAN access point (AP). The AP acts somewhat like an Ethernet switch, in that all the wireless LAN nodes com-municate with the wireless AP. If the network uses an AP that is a separate physical device, the AP then needs a single Ethernet link to connect the AP to the Ethernet LAN, as shown in Figure 2-2. + +Note that Figure 2-2 shows the router, Ethernet switch, and wireless LAN access point as three separate devices so that you can better understand the different roles. However, most SOHO networks today would use a single device, often labeled as a “wireless router,” that does all these functions. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +36 CCNA 200-301 Official Cert Guide, Volume 1 + +To Internet + + +Router +Tablets + +F0/1 + +F0/2 Switch Access Point + +Figure 2-2 Typical Small Wired and Wireless SOHO LAN + +Typical Enterprise LANs +Enterprise networks have similar needs compared to a SOHO network, but on a much larger scale. For example, enterprise Ethernet LANs begin with LAN switches installed in a wiring closet behind a locked door on each floor of a building. The electricians install the Ethernet cabling from that wiring closet to cubicles and conference rooms where devices might need to connect to the LAN. At the same time, most enterprises also support wireless LANs in the same space, to allow people to roam around and still work and to support a growing number of devices that do not have an Ethernet LAN interface. + +Figure 2-3 shows a conceptual view of a typical enterprise LAN in a three-story building. Each floor has an Ethernet LAN switch and a wireless LAN AP. To allow communication between floors, each per-floor switch connects to one centralized distribution switch. For example, PC3 can send data to PC2, but it would first flow through switch SW3 to the first floor to the dis-tribution switch (SWD) and then back up through switch SW2 on the second floor. + +Building +PC3 3rd Floor + + +SW3 + +PC2 2nd Floor + + +SW2 + + +PC1 + + +SW1 SWD + +1st Floor + +To Rest of Enterprise Network + + +Figure 2-3 Single-Building Enterprise Wired and Wireless LAN + + +Answers to the “Do I Know This Already?” quiz: +1 A 2 C 3 B 4 B, D, and E 5 B 6 B 7 C 8 B, C, and E 9 C and D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 37 + +The figure also shows the typical way to connect a LAN to a WAN using a router. LAN switches and wireless access points work to create the LAN itself. Routers connect to both the LAN and the WAN. To connect to the LAN, the router simply uses an Ethernet LAN interface and an Ethernet cable, as shown on the lower right of Figure 2-3. + +The rest of this chapter focuses on Ethernet in particular. 2 + +The Variety of Ethernet Physical Layer Standards +The term Ethernet refers to an entire family of standards. Some standards define the specif-ics of how to send data over a particular type of cabling, and at a particular speed. Other standards define protocols, or rules, that the Ethernet nodes must follow to be a part of an Ethernet LAN. All these Ethernet standards come from the IEEE and include the number 802.3 as the beginning part of the standard name. + +Ethernet supports a large variety of options for physical Ethernet links given its long history over the last 40 or so years. Today, Ethernet includes many standards for different kinds of optical and copper cabling, and for speeds from 10 megabits per second (Mbps) up to 400 gigabits per second (Gbps). The standards also differ as far as the types and length of the cables. + +The most fundamental cabling choice has to do with the materials used inside the cable for the physical transmission of bits: either copper wires or glass fibers. Devices using UTP cabling transmit data over electrical circuits via the copper wires inside the cable. Fiber-optic cabling, the more expensive alternative, allows Ethernet nodes to send light over glass fibers in the center of the cable. Although more expensive, optical cables typically allow longer cabling distances between nodes. + +To be ready to choose the products to purchase for a new Ethernet LAN, a network engineer must know the names and features of the different Ethernet standards supported in Ethernet products. The IEEE defines Ethernet physical layer standards using a couple of naming con-ventions. The formal name begins with 802.3 followed by some suffix letters. The IEEE also uses more meaningful shortcut names that identify the speed, as well as a clue about whether the cabling is UTP (with a suffix that includes T) or fiber (with a suffix that includes X). Table 2-2 lists a few Ethernet physical layer standards. First, the table lists enough names so that you get a sense of the IEEE naming conventions. + + +Table 2-2 +Speed + + +Examples of Types of Ethernet +Common Name Informal IEEE Standard Name + + +Formal IEEE Standard Name + + +Cable Type, Maximum Length + + + +10 Mbps + +100 Mbps + +1000 Mbps + +1000 Mbps + +10 Gbps + +Ethernet + +Fast Ethernet + +Gigabit Ethernet + +Gigabit Ethernet + +10 Gig Ethernet + +10BASE-T + +100BASE-T + +1000BASE-LX + +1000BASE-T + +10GBASE-T + +802.3 + +802.3u + +802.3z + +802.3ab + +802.3an + +Copper, 100 m + +Copper, 100 m + +Fiber, 5000 m + +Copper, 100 m + +Copper, 100 m + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +38 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE Fiber-optic cabling contains long thin strands of fiberglass. The attached Ethernet nodes send light over the glass fiber in the cable, encoding the bits as changes in the light. + + +NOTE You might expect that a standard that began at the IEEE almost 40 years ago would be stable and unchanging, but the opposite is true. The IEEE, along with active industry partners, continues to develop new Ethernet standards with longer distances, different cabling options, and faster speeds. Check out the Ethernet Alliance web page (www.EthernetAlliance.org) and look for the roadmap for some great graphics and tables about the latest happenings with Ethernet. + + +Consistent Behavior over All Links Using the Ethernet Data-Link Layer Although Ethernet includes many physical layer standards, Ethernet acts like a single LAN technology because it uses the same data-link layer standard over all types of Ethernet phys-ical links. That standard defines a common Ethernet header and trailer. (As a reminder, the header and trailer are bytes of overhead data that Ethernet uses to do its job of sending data over a LAN.) No matter whether the data flows over a UTP cable or any kind of fiber cable, and no matter the speed, the data-link header and trailer use the same format. +While the physical layer standards focus on sending bits over a cable, the Ethernet data-link protocols focus on sending an Ethernet frame from source to destination Ethernet node. From a data-link perspective, nodes build and forward frames. As first defined in Chapter 1, “Introduction to TCP/IP Networking,” the term frame specifically refers to the header and trailer of a data-link protocol, plus the data encapsulated inside that header and trailer. The various Ethernet nodes simply forward the frame, over all the required links, to deliver the frame to the correct destination. + +Figure 2-4 shows an example of the process. In this case, PC1 sends an Ethernet frame to PC3. The frame travels over a UTP link to Ethernet switch SW1, then over fiber links to Ethernet switches SW2 and SW3, and finally over another UTP link to PC3. Note that the bits actually travel at four different speeds in this example: 10 Mbps, 1 Gbps, 10 Gbps, and 100 Mbps, respectively. + +2 3 + + +200m +SW1 1 Gbps SW2 Fiber + +1km +10 Gbps SW3 Fiber + + +4 + + + +10 Mbps 1 Gbps UTP UTP + +100 Mbps UTP + +1 1 2 3 Eth Data Eth + +Eth Data Eth + +Figure 2-4 Ethernet LAN Forwards a Data-Link Frame over Many Types of Links + +So, what is an Ethernet LAN? It is a combination of user devices, LAN switches, and dif-ferent kinds of cabling. Each link can use different types of cables, at different speeds. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 2: Fundamentals of Ethernet LANs + +However, they all work together to deliver Ethernet frames from the one device on the LAN to some other device. + +The rest of this chapter takes these concepts a little deeper. The next section examines how to build a physical Ethernet network using UTP cabling, followed by a similar look at using fiber cabling to build Ethernet LANs. The chapter ends with some discussion of the rules for +forwarding frames through an Ethernet LAN. + +39 + + + + + + +2 + + +Building Physical Ethernet LANs with UTP +The next section of this chapter focuses on the individual physical links between any two Ethernet nodes, specifically those that use Unshielded Twisted Pair (UTP) cabling. Before the Ethernet network as a whole can send Ethernet frames between user devices, each node must be ready and able to send data over an individual physical link. + +This section focuses on the three most commonly used Ethernet standards: 10BASE-T (Ethernet), 100BASE-T (Fast Ethernet, or FE), and 1000BASE-T (Gigabit Ethernet, or GE). Specifically, this section looks at the details of sending data in both directions over a UTP cable. It then examines the specific wiring of the UTP cables used for 10-Mbps, 100-Mbps, and 1000-Mbps Ethernet. + +Transmitting Data Using Twisted Pairs +While it is true that Ethernet sends data over UTP cables, the physical means to send the data uses electricity that flows over the wires inside the UTP cable. To better understand how Ethernet sends data using electricity, break the idea down into two parts: how to create an electrical circuit and then how to make that electrical signal communicate 1s and 0s. + +First, to create one electrical circuit, Ethernet defines how to use the two wires inside a single twisted pair of wires, as shown in Figure 2-5. The figure does not show a UTP cable between two nodes, but instead shows two individual wires that are inside the UTP cable. An electrical circuit requires a complete loop, so the two nodes, using circuitry on their Ethernet ports, connect the wires in one pair to complete a loop, allowing electricity to flow. + + +One Wire in a Pair + +Transmitter Electrical Current Receiver + +Other Wire, Same Pair + +Node 1 Node 2 + +Figure 2-5 Creating One Electrical Circuit over One Pair to Send in One Direction + +To send data, the two devices follow some rules called an encoding scheme. The idea works a lot like when two people talk using the same language: The speaker says some words in a particular language, and the listener, because she speaks the same language, can understand the spoken words. With an encoding scheme, the transmitting node changes the electrical signal over time, while the other node, the receiver, using the same rules, interprets those changes as either 0s or 1s. (For example, 10BASE-T uses an encoding scheme that encodes + + +|||||||||||||||||||| +|||||||||||||||||||| + + +40 CCNA 200-301 Official Cert Guide, Volume 1 + +a binary 0 as a transition from higher voltage to lower voltage during the middle of a 1/10,000,000th-of-a-second interval.) + +Note that in an actual UTP cable, the wires will be twisted together, instead of being paral-lel as shown in Figure 2-5. The twisting helps solve some important physical transmission issues. When electrical current passes over any wire, it creates electromagnetic interference (EMI) that interferes with the electrical signals in nearby wires, including the wires in the same cable. (EMI between wire pairs in the same cable is called crosstalk.) Twisting the wire pairs together helps cancel out most of the EMI, so most networking physical links that use copper wires use twisted pairs. + +Breaking Down a UTP Ethernet Link +The term Ethernet link refers to any physical cable between two Ethernet nodes. To learn about how a UTP Ethernet link works, it helps to break down the physical link into those basic pieces, as shown in Figure 2-6: the cable itself, the connectors on the ends of the cable, and the matching ports on the devices into which the connectors will be inserted. + +RJ-45 Connectors + + + +RJ-45 Port + + + +Node + +Figure 2-6 + +RJ-45 Cable with Wires Inside Port + + +Node + +Basic Components of an Ethernet Link + + +First, think about the UTP cable itself. The cable holds some copper wires, grouped as twisted pairs. The 10BASE-T and 100BASE-T standards require two pairs of wires, while the 1000BASE-T standard requires four pairs. Each wire has a color-coded plastic coating, with the wires in a pair having a color scheme. For example, for the blue wire pair, one wire’s coat-ing is all blue, while the other wire’s coating is blue-and-white striped. + +Many Ethernet UTP cables use an RJ-45 connector on both ends. The RJ-45 connector has eight physical locations into which the eight wires in the cable can be inserted, called pin positions, or simply pins. These pins create a place where the ends of the copper wires can touch the electronics inside the nodes at the end of the physical link so that electricity can flow. + +NOTE If available, find a nearby Ethernet UTP cable and examine the connectors closely. Look for the pin positions and the colors of the wires in the connector. + +To complete the physical link, the nodes each need an RJ-45 Ethernet port that matches the RJ-45 connectors on the cable so that the connectors on the ends of the cable can con-nect to each node. PCs often include this RJ-45 Ethernet port as part of a network interface +card (NIC), which can be an expansion card on the PC or can be built in to the system itself. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 41 + +Switches typically have many RJ-45 ports because switches give user devices a place to con-nect to the Ethernet LAN. Figure 2-7 shows photos of the cables, connectors, and ports. + + +Ethernet NIC +2 + + + + +RJ-45 Connector + + + + + + +RJ-45 Ports + + + + + + + +LAN Switch +Figure 2-7 RJ-45 Connectors and Ports (Ethernet NIC © Oleg Begunenko/123RF, RJ-45 Connector © Anton Samsonov/123RF) + +The figure shows a connector on the left and ports on the right. The left shows the eight pin positions in the end of the RJ-45 connector. The upper right shows an Ethernet NIC that is not yet installed in a computer. The lower-right part of the figure shows the side of a Cisco switch, with multiple RJ-45 ports, allowing multiple devices to easily connect to the Ethernet network. + +Finally, while RJ-45 connectors with UTP cabling can be common, Cisco LAN switches often support other types of connectors as well. When you buy one of the many models of Cisco switches, you need to think about the mix and numbers of each type of physical ports you want on the switch. + +To give its customers flexibility as to the type of Ethernet links, even after the customer has bought the switch, Cisco switches include some physical ports whose port hardware (the transceiver) can be changed later, after you purchase the switch. + +For example, Figure 2-8 shows a photo of a Cisco switch with one of the swappable trans-ceivers. In this case, the figure shows an enhanced small form-factor pluggable (SFP+) trans-ceiver, which runs at 10 Gbps, just outside two SFP+ slots on a Cisco 3560CX switch. The SFP+ itself is the silver-colored part below the switch, with a black cable connected to it. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +42 CCNA 200-301 Official Cert Guide, Volume 1 + + + + + + + + + + +Cable SFP+ + + + + + + +Figure 2-8 10-Gbps SFP+ with Cable Sitting Just Outside a Catalyst 3560CX Switch + +Gigabit Ethernet Interface Converter (GBIC): The original form factor for a removable transceiver for Gigabit interfaces; larger than SFPs +Small Form Pluggable (SFP): The replacement for GBICs, used on Gigabit interfaces, with a smaller size, taking less space on the side of the networking card or switch. +Small Form Pluggable Plus (SFP+): Same size as the SFP, but used on 10-Gbps interfaces. (The Plus refers to the increase in speed compared to SFPs.) + +UTP Cabling Pinouts for 10BASE-T and 100BASE-T +So far in this section, you have learned about the equivalent of how to drive a truck on a 1000-acre ranch: You could drive the truck all over the ranch, any place you wanted to go, and the police would not mind. However, as soon as you get on the public roads, the police want you to behave and follow the rules. Similarly, so far this chapter has discussed the general principles of how to send data, but it has not yet detailed some important rules for Ethernet cabling: the rules of the road so that all the devices send data using the right wires inside the cable. + +This next topic discusses some of those rules, specifically for the 10-Mbps 10BASE-T and the 100-Mbps 100BASE-T. Both use UTP cabling in similar ways (including the use of only two wire pairs). A short comparison of the wiring for 1000BASE-T (Gigabit Ethernet), which uses four pairs, follows. + +Straight-Through Cable Pinout +10BASE-T and 100BASE-T use two pairs of wires in a UTP cable, one for each direction, as shown in Figure 2-9. The figure shows four wires, all of which sit inside a single UTP cable that connects a PC and a LAN switch. In this example, the PC on the left transmits using the top pair, and the switch on the right transmits using the bottom pair. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 43 + + +1 One Twisted Pair 1 + +Transmitter Data Flow Receiver + +2 2 2 + +3 One Twisted Pair 3 + +Receiver Data Flow Transmitter + +6 6 + +PC Switch + +Figure 2-9 Using One Pair for Each Transmission Direction with 10- and 100-Mbps Ethernet + +For correct transmission over the link, the wires in the UTP cable must be connected to the correct pin positions in the RJ-45 connectors. For example, in Figure 2-9, the transmitter on the PC on the left must know the pin positions of the two wires it should use to transmit. Those two wires must be connected to the correct pins in the RJ-45 connector on the switch so that the switch’s receiver logic can use the correct wires. + +To understand the wiring of the cable—which wires need to be in which pin positions on both ends of the cable—you need to first understand how the NICs and switches work. As a rule, Ethernet NIC transmitters use the pair connected to pins 1 and 2; the NIC receivers use a pair of wires at pin positions 3 and 6. LAN switches, knowing those facts about what +Ethernet NICs do, do the opposite: Their receivers use the wire pair at pins 1 and 2, and their transmitters use the wire pair at pins 3 and 6. + +To allow a PC NIC to communicate with a switch, the UTP cable must also use a straight-through cable pinout. The term pinout refers to the wiring of which color wire is placed in each of the eight numbered pin positions in the RJ-45 connector. An Ethernet straight- +through cable connects the wire at pin 1 on one end of the cable to pin 1 at the other end of the cable; the wire at pin 2 needs to connect to pin 2 on the other end of the cable; pin 3 on one end connects to pin 3 on the other, and so on, as seen in Figure 2-10. Also, it uses the wires in one wire pair at pins 1 and 2, and another pair at pins 3 and 6. + + + +1 2 3 4 5 6 7 8 Ports +1 2 3 4 5 6 7 8 + +1 2 3 4 5 6 7 8 +1 2 3 4 5 6 7 8 + + + +Connectors + + + + +Figure 2-10 10BASE-T and 100BASE-T Straight-Through Cable Pinout + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +44 CCNA 200-301 Official Cert Guide, Volume 1 + +Figure 2-11 shows one final perspective on the straight-through cable pinout. In this case, PC Larry connects to a LAN switch. Note that the figure again does not show the UTP cable, but instead shows the wires that sit inside the cable, to emphasize the idea of wire pairs and pins. + + +Larry + + + + + + +(1,2) NIC +(3,6) + +Straight-Through Cable + +(1,2) + +(3,6) Switch + + +Figure 2-11 Ethernet Straight-Through Cable Concept + +A straight-through cable works correctly when the nodes use opposite pairs for transmitting data. However, when two like devices connect to an Ethernet link, they both transmit on the same pins. In that case, you then need another type of cabling pinout called a crossover cable. The crossover cable pinout crosses the pair at the transmit pins on each device to the receive pins on the opposite device. + +While that previous sentence is true, this concept is much clearer with a figure such as Figure 2-12. The figure shows what happens on a link between two switches. The two switches both transmit on the pair at pins 3 and 6, and they both receive on the pair at pins 1 and 2. So, the cable must connect a pair at pins 3 and 6 on each side to pins 1 and 2 on the other side, connecting to the other node’s receiver logic. The top of the figure shows the literal pin-outs, and the bottom half shows a conceptual diagram. + + +RJ-45 Pins +1 2 +3 + +6 + + + +3,6 + +1,2 + +RJ-45 Pins +1 +2 +3 + +6 + + + +3,6 + +1,2 + + +Figure 2-12 Crossover Ethernet Cable + +Choosing the Right Cable Pinouts +For the exam, you should be well prepared to choose which type of cable (straight-through or crossover) is needed in each part of the network. The key is to know whether a device + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 45 + +acts like a PC NIC, transmitting at pins 1 and 2, or like a switch, transmitting at pins 3 and 6. Then, just apply the following logic: + +Crossover cable: If the endpoints transmit on the same pin pair +Straight-through cable: If the endpoints transmit on different pin pairs +Table 2-3 lists the devices and the pin pairs they use, assuming that they use 10BASE-T and 2 100BASE-T. + +Table 2-3 10BASE-T and 100BASE-T Pin Pairs Used + +Transmits on Pins 1,2 PC NICs +Routers + +Wireless access point (Ethernet interface) + +Transmits on Pins 3,6 Hubs +Switches + +— + + + +For example, Figure 2-13 shows a campus LAN in a single building. In this case, several straight-through cables are used to connect PCs to switches. In addition, the cables connect-ing the switches require crossover cables. + +Building 1 Building 2 + + + + +Straight-Through Cables + +Switch 11 Switch 21 +Crossover Cables + + +Straight-Through Cables + + +Switch 12 Switch 22 + + +Figure 2-13 Typical Uses for Straight-Through and Crossover Ethernet Cables + + +NOTE If you have some experience with installing LANs, you might be thinking that you have used the wrong cable before (straight-through or crossover), but the cable worked. Cisco switches have a feature called auto-mdix that notices when the wrong cable is used and automatically changes its logic to make the link work. However, for the exams, be ready to identify whether the correct cable is shown in the figures. + + +UTP Cabling Pinouts for 1000BASE-T +1000BASE-T (Gigabit Ethernet) differs from 10BASE-T and 100BASE-T as far as the cabling and pinouts. First, 1000BASE-T requires four wire pairs. Second, it uses more advanced electronics that allow both ends to transmit and receive simultaneously on each wire pair. However, the wiring pinouts for 1000BASE-T work almost identically to the earlier stan-dards, adding details for the additional two pairs. + +The straight-through cable for 1000BASE-T uses the four wire pairs to create four circuits, but the pins need to match. It uses the same pinouts for two pairs as do the 10BASE-T and + + +|||||||||||||||||||| +|||||||||||||||||||| + + +46 CCNA 200-301 Official Cert Guide, Volume 1 + +100BASE-T standards, and it adds a pair at pins 4 and 5 and the final pair at pins 7 and 8, as shown in Figure 2-14. + +1 1 + +2 2 +3 3 + +6 6 4 4 + +5 5 +7 7 + +8 8 +PC Switch + +Figure 2-14 Four-Pair Straight-Through Cable to 1000BASE-T + +The Gigabit Ethernet crossover cable crosses the same two-wire pairs as the crossover cable for the other types of Ethernet (the pairs at pins 1,2 and 3,6). It also crosses the two new pairs as well (the pair at pins 4,5 with the pair at pins 7,8). + +Building Physical Ethernet LANs with Fiber +The capability of many UTP-based Ethernet standards to use a cable length up to 100 meters means that the majority of Ethernet cabling in an enterprise uses UTP cables. The distance from an Ethernet switch to every endpoint on the floor of a building will likely be less than 100m. In some cases, however, an engineer might prefer to use fiber cabling for some links in an Ethernet LAN, first to reach greater distances, but for other reasons as well. This next sec-tion examines a few of the tradeoffs after discussing the basics of how to transmit data over fiber cabling. + +Fiber Cabling Transmission Concepts +Fiber-optic cabling uses glass as the medium through which light passes, varying that light over time to encode 0s and 1s. It might seem strange at first to use glass given that most of us think of glass in windows. Window glass is hard, unbending, and if you hit or bend it enough, the glass will probably shatter—all bad characteristics for a cabling material. + +Instead, fiber-optic cables use fiberglass, which allows a manufacturer to spin a long thin string (fiber) of flexible glass. A fiber-optic cable holds the fiber in the middle of the cable, allowing the light to pass through the glass—which is a very important attribute for the pur-poses of sending data. + +Although sending data through a glass fiber works well, the glass fiber by itself needs some help. The glass could break, so the glass fiber needs some protection and strengthening. Figure 2-15 shows a cutout with the components of a fiber cable for perspective. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 47 + +Outer Jacket + + + + + +Cladding + +Core + + + + + +Figure 2-15 + +Strengthener + +Buffer +2 + + + + + + +Components of a Fiber-Optic Cable + + +The three outer layers of the cable protect the interior of the cable and make the cables easier to install and manage, while the inner cladding and core work together to create the environment to allow transmission of light over the cable. A light source, called the optical transmitter, shines a light into the core. Light can pass through the core; however, +light reflects off the cladding back into the core. Figure 2-16 shows an example with a light emitting diode (LED) transmitter. You can see how the cladding reflects the light back into the core as it travels through the core. + + +Cladding + +LED Core + +Cladding + + +Figure 2-16 Transmission on Multimode Fiber with Internal Reflection + +The figure shows the normal operation of a multimode fiber, characterized by the fact that the cable allows for multiple angles (modes) of light waves entering the core. + +In contrast, single-mode fiber uses a smaller-diameter core, around one-fifth the diameter of common multimode cables (see Figure 2-17). To transmit light into a much smaller core, a laser-based transmitter sends light at a single angle (hence the name single-mode). + + +Cladding + +Laser Core + +Cladding + +Figure 2-17 Transmission on Single-Mode Fiber with Laser Transmitter + +Both multimode and single-mode cabling have important roles in Ethernet and meet differ-ent needs. Multimode improves the maximum distances over UTP, and it uses less expensive + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +48 CCNA 200-301 Official Cert Guide, Volume 1 + +transmitters as compared with single-mode. Standards do vary; for instance, the standards for 10 Gigabit Ethernet over Fiber allow for distances up to 400m, which would often allow for connection of devices in different buildings in the same office park. Single-mode allows dis-tances into the tens of kilometers, but with slightly more expensive SFP/SFP+ hardware. + +To transmit between two devices, you need two cables, one for each direction, as shown in Figure 2-18. The concept works much like having two electrical circuits with the original UTP Ethernet standards. Note that the transmit port on one device connects to a cable that connects to a receive port on the other device, and vice versa with the other cable. + + +Tx + + +Rx + +Figure 2-18 + +Rx + + +Tx + +Two Fiber Cables with Tx Connected to Rx on Each Cable + + +Using Fiber with Ethernet +To use fiber with Ethernet switches, you need to use a switch with either built-in ports that support a particular optical Ethernet standard, or a switch with modular ports that allow you to change the Ethernet standard used on the port. Refer back to Figure 2-8, which shows a photo of a switch with two SFP+ ports, into which you could insert any of the supported SFP+ modules. Those SFP+ ports support a variety of 10-Gbps standards like those listed in Table 2-4. + +Table 2-4 A Sampling of IEEE 802.3 10-Gbps Fiber Standards + +Standard 10GBASE-S +10GBASE-LX4 + +10GBASE-LR + +10GBASE-E + +Cable Type MM +MM + +SM + +SM + +Max Distance* 400m +300m + +10km + +30km + + +* The maximum distances are based on the IEEE standards with no repeaters. + +For instance, to build an Ethernet LAN in an office park, you might need to use some multi-mode and single-mode fiber links. In fact, many office parks might already have fiber cabling installed for the expected future use by the tenants in the buildings. If each building was within a few hundred meters of at least one other building, you could use multimode fiber between the buildings and connect switches to create your LAN. + +NOTE Outside the need to study for CCNA, if you need to look more deeply at fiber Ethernet and SFP/SFP+, check out tmgmatrix.cisco.com as a place to search for and learn about compatible SFP/SFP+ hardware from Cisco. + +Although distance might be the first criterion to consider when thinking about whether to use UTP or fiber cabling, a few other tradeoffs exist as well. UTP wins again on cost, + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 49 + +because the cost goes up as you move from UTP, to multimode, and then to single-mode, due to the extra cost for the transmitters like the SFP and SFP+ modules. UTP has some negatives, however. First, UTP might work poorly in some electrically noisy environments such as factories, because UTP can be affected by electromagnetic interference (EMI). Also, +UTP cables emit a faint signal outside the cable, so highly secure networks may choose to +use fiber, which does not create similar emissions, to make the network more secure. Table 2 +2-5 summarizes these tradeoffs. + +Table 2-5 Comparisons Between UTP, MM, and SM Ethernet Cabling + +Criteria UTP Relative Cost of Cabling Low +Relative Cost of a Switch Port Low + +Approximate Max Distance 100m + +Relative Susceptibility to Interference Some + +Relative Risk of Copying from Cable Emissions Some + +Multimode Medium +Medium + +500m + +None + +None + +Single-Mode Medium +High + +40km + +None + +None + + + +Sending Data in Ethernet Networks +Although physical layer standards vary quite a bit, other parts of the Ethernet standards work the same regardless of the type of physical Ethernet link. Next, this final major section of this chapter looks at several protocols and rules that Ethernet uses regardless of the type of link. In particular, this section examines the details of the Ethernet data-link layer protocol, plus how Ethernet nodes, switches, and hubs forward Ethernet frames through an Ethernet LAN. + +Ethernet Data-Link Protocols +One of the most significant strengths of the Ethernet family of protocols is that these pro-tocols use the same data-link standard. In fact, the core parts of the data-link standard date back to the original Ethernet standards. + +The Ethernet data-link protocol defines the Ethernet frame: an Ethernet header at the front, the encapsulated data in the middle, and an Ethernet trailer at the end. Ethernet actually defines a few alternate formats for the header, with the frame format shown in Figure 2-19 being commonly used today. +Header Trailer + +Preamble SFD Destination Source Type Data and Pad FCS Bytes 7 1 6 6 2 46 – 1500 4 + +Figure 2-19 Commonly Used Ethernet Frame Format + +While all the fields in the frame matter, some matter more to the topics discussed in this book. Table 2-6 lists the fields in the header and trailer and a brief description for reference, with the upcoming pages including more detail about a few of these fields. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +50 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 2-6 IEEE 802.3 Ethernet Header and Trailer Fields + +Field Preamble +Start Frame Delimiter (SFD) +Destination MAC Address +Source MAC Address +Type + +Data and Pad* + + +Frame Check Sequence (FCS) + +Bytes 7 +1 + +6 + +6 + +2 + +46– 1500 + + +4 + +Description Synchronization. +Signifies that the next byte begins the Destination MAC Address field. +Identifies the intended recipient of this frame. + +Identifies the sender of this frame. + +Defines the type of protocol listed inside the frame; today, most likely identifies IP version 4 (IPv4) or IP version 6 (IPv6). +Holds data from a higher layer, typically an L3PDU (usually an IPv4 or IPv6 packet). The sender adds padding to meet the minimum length requirement for this field (46 bytes). +Provides a method for the receiving NIC to determine whether the frame experienced transmission errors. + + +* The IEEE 802.3 specification limits the data portion of the 802.3 frame to a minimum of 46 and a maxi-mum of 1500 bytes. The term maximum transmission unit (MTU) defines the maximum Layer 3 packet that can be sent over a medium. Because the Layer 3 packet rests inside the data portion of an Ethernet frame, 1500 bytes is the largest IP MTU allowed over an Ethernet. + +Ethernet Addressing +The source and destination Ethernet address fields play a huge role in how Ethernet LANs work. The general idea for each is relatively simple: the sending node puts its own address in the source address field and the intended Ethernet destination device’s address in the desti-nation address field. The sender transmits the frame, expecting that the Ethernet LAN, as a whole, will deliver the frame to that correct destination. + +Ethernet addresses, also called Media Access Control (MAC) addresses, are 6-byte-long (48-bit-long) binary numbers. For convenience, most computers list MAC addresses as 12-digit hexadecimal numbers. Cisco devices typically add some periods to the number for easier readability as well; for example, a Cisco switch might list a MAC address as 0000.0C12.3456. + +Most MAC addresses represent a single NIC or other Ethernet port, so these addresses are often called a unicast Ethernet address. The term unicast is simply a formal way to refer to the fact that the address represents one interface to the Ethernet LAN. (This term also con-trasts with two other types of Ethernet addresses, broadcast and multicast, which will be defined later in this section.) + +The entire idea of sending data to a destination unicast MAC address works well, but it works only if all the unicast MAC addresses are unique. If two NICs tried to use the same MAC address, there could be confusion. (The problem would be like the confusion caused to the postal service if you and I both tried to use the same mailing address—would the postal service deliver mail to your house or mine?) If two PCs on the same Ethernet tried to use the same MAC address, to which PC should frames sent to that MAC address be delivered? + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 51 + +Ethernet solves this problem using an administrative process so that, at the time of manufac-ture, all Ethernet devices are assigned a universally unique MAC address. Before a manufac-turer can build Ethernet products, it must ask the IEEE to assign the manufacturer a univer-sally unique 3-byte code, called the organizationally unique identifier (OUI). The manufac- +turer agrees to give all NICs (and other Ethernet products) a MAC address that begins with +its assigned 3-byte OUI. The manufacturer also assigns a unique value for the last 3 bytes, 2 +a number that manufacturer has never used with that OUI. As a result, the MAC address of every device in the universe is unique. + +NOTE The IEEE also calls these universal MAC addresses global MAC addresses. + +Figure 2-20 shows the structure of the unicast MAC address, with the OUI. + + +Organizationally Unique Identifier (OUI) + +Vendor Assigned (NIC Cards, Interfaces) + + + +Size, in bits + +Size, in hex digits + +Example + + +24 Bits + +6 Hex Digits + +00 60 2F + + +24 Bits + +6 Hex Digits + +3A 07 BC + + +Figure 2-20 Structure of Unicast Ethernet Addresses + +Ethernet addresses go by many names: LAN address, Ethernet address, hardware address, burned-in address, physical address, universal address, or MAC address. For example, the term burned-in address (BIA) refers to the idea that a permanent MAC address has been encoded (burned into) the ROM chip on the NIC. As another example, the IEEE uses the term universal address to emphasize the fact that the address assigned to a NIC by a manu-facturer should be unique among all MAC addresses in the universe. + +In addition to unicast addresses, Ethernet also uses group addresses. Group addresses iden-tify more than one LAN interface card. A frame sent to a group address might be delivered to a small set of devices on the LAN, or even to all devices on the LAN. In fact, the IEEE defines two general categories of group addresses for Ethernet: + +Broadcast address: Frames sent to this address should be delivered to all devices on the Ethernet LAN. It has a value of FFFF.FFFF.FFFF. +Multicast addresses: Frames sent to a multicast Ethernet address will be copied and for-warded to a subset of the devices on the LAN that volunteers to receive frames sent to a specific multicast address. +Table 2-7 summarizes most of the details about MAC addresses. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +52 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 2-7 LAN MAC Address Terminology and Features + +LAN Addressing Term or Feature +MAC + +Description + +Media Access Control. 802.3 (Ethernet) defines the MAC sublayer of IEEE Ethernet. + +Ethernet address, NIC Other names often used instead of MAC address. These terms address, LAN address describe the 6-byte address of the LAN interface card. + +Burned-in address + +Unicast address + +Broadcast address + +Multicast address + +The 6-byte address assigned by the vendor making the card. + +A term for a MAC address that represents a single LAN interface. + +An address that means “all devices that reside on this LAN right now.” + +On Ethernet, a multicast address implies some subset of all devices currently on the Ethernet LAN. + + + +Identifying Network Layer Protocols with the Ethernet Type Field +While the Ethernet header’s address fields play an important and more obvious role in Ethernet LANs, the Ethernet Type field plays a much less obvious role. The Ethernet Type field, or EtherType, sits in the Ethernet data-link layer header, but its purpose is to directly help the network processing on routers and hosts. Basically, the Type field identifies the type of network layer (Layer 3) packet that sits inside the Ethernet frame. + +First, think about what sits inside the data part of the Ethernet frame shown earlier in Figure 2-14. Typically, it holds the network layer packet created by the network layer protocol on some device in the network. Over the years, those protocols have included IBM Systems Network Architecture (SNA), Novell NetWare, Digital Equipment Corporation’s DECnet, and Apple Computer’s AppleTalk. Today, the most common network layer protocols are both from TCP/IP: IP version 4 (IPv4) and IP version 6 (IPv6). + +The original host has a place to insert a value (a hexadecimal number) to identify the type of packet encapsulated inside the Ethernet frame. However, what number should the sender put in the header to identify an IPv4 packet as the type? Or an IPv6 packet? As it turns out, the IEEE manages a list of EtherType values, so that every network layer protocol that needs a unique EtherType value can have a number. The sender just has to know the list. (Anyone can view the list; just go to www.ieee.org and search for EtherType.) + +For example, a host can send one Ethernet frame with an IPv4 packet and the next Ethernet frame with an IPv6 packet. Each frame would have a different Ethernet Type field value, using the values reserved by the IEEE, as shown in Figure 2-21. + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 53 + + + +SW1 R1 + + +Eth Header IPv4 Eth Trailer +2 Type = 0800 + +Eth Header IPv6 Eth Trailer + +Type = 86DD + +Figure 2-21 Use of Ethernet Type Field + +Error Detection with FCS +Ethernet also defines a way for nodes to find out whether a frame’s bits changed while cross-ing over an Ethernet link. (Usually, the bits could change because of some kind of electrical interference, or a bad NIC.) Ethernet, like most data-link protocols, uses a field in the data-link trailer for the purpose of error detection. + +The Ethernet Frame Check Sequence (FCS) field in the Ethernet trailer—the only field in the Ethernet trailer—gives the receiving node a way to compare results with the sender, to discover whether errors occurred in the frame. The sender applies a complex math formula +to the frame before sending it, storing the result of the formula in the FCS field. The receiver applies the same math formula to the received frame. The receiver then compares its own results with the sender’s results. If the results are the same, the frame did not change; other-wise, an error occurred, and the receiver discards the frame. + +Note that error detection does not also mean error recovery. Ethernet defines that the errored frame should be discarded, but Ethernet does not attempt to recover the lost frame. Other pro-tocols, notably TCP, recover the lost data by noticing that it is lost and sending the data again. + +Sending Ethernet Frames with Switches and Hubs +Ethernet LANs behave slightly differently depending on whether the LAN has mostly mod-ern devices, in particular, LAN switches instead of some older LAN devices called LAN hubs. Basically, the use of more modern switches allows the use of full-duplex logic, which is much faster and simpler than half-duplex logic, which is required when using hubs. The final topic in this chapter looks at these basic differences. + +Sending in Modern Ethernet LANs Using Full Duplex +Modern Ethernet LANs use a variety of Ethernet physical standards, but with standard Ethernet frames that can flow over any of these types of physical links. Each individual link can run at a different speed, but each link allows the attached nodes to send the bits in the frame to the next node. They must work together to deliver the data from the sending Ethernet node to the destination node. + +The process is relatively simple, on purpose; the simplicity lets each device send a large number of frames per second. Figure 2-22 shows an example in which PC1 sends an Ethernet frame to PC2. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +54 CCNA 200-301 Official Cert Guide, Volume 1 + +2 + + + + + + +1 +Eth Data Eth + +G0/1 SW1 +10BASE-T Full +1 + +1000Base-T +Full + + +3 +SW2 100BASE-T F0/2 Full +2 +Eth Data + + + + + + +Eth +4 + +Source = PC1 Dest = PC2 + +Figure 2-22 Example of Sending Data in a Modern Ethernet LAN Following the steps in the figure: +1. PC1 builds and sends the original Ethernet frame, using its own MAC address as the source address and PC2’s MAC address as the destination address. +2. Switch SW1 receives and forwards the Ethernet frame out its G0/1 interface (short for Gigabit interface 0/1) to SW2. +3. Switch SW2 receives and forwards the Ethernet frame out its F0/2 interface (short for Fast Ethernet interface 0/2) to PC2. +4. PC2 receives the frame, recognizes the destination MAC address as its own, and pro-cesses the frame. + +The Ethernet network in Figure 2-22 uses full duplex on each link, but the concept might be difficult to see. + +Full duplex means that that the NIC or switch port has no half-duplex restrictions. So, to understand full duplex, you need to understand half duplex, as follows: + +Half duplex: The device must wait to send if it is currently receiving a frame; in other words, it cannot send and receive at the same time. +Full duplex: The device does not have to wait before sending; it can send and receive at the same time. +So, with all PCs and LAN switches, and no LAN hubs, all the nodes can use full duplex. All nodes can send and receive on their port at the same instant in time. For example, in Figure 2-22, PC1 and PC2 could send frames to each other simultaneously, in both directions, with-out any half-duplex restrictions. + +Using Half Duplex with LAN Hubs +To understand the need for half-duplex logic in some cases, you have to understand a little about an older type of networking device called a LAN hub. When the IEEE first intro-duced 10BASE-T in 1990, Ethernet switches did not exist yet; instead, networks used a device called a LAN hub. Like a switch, a LAN hub provided a number of RJ-45 ports as a place to connect links to PCs; however, hubs used different rules for forwarding data. + +LAN hubs forward data using physical layer standards rather than data-link standards and are therefore considered to be Layer 1 devices. When an electrical signal comes in one hub port, the hub repeats that electrical signal out all other ports (except the incoming port). By doing + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 2: Fundamentals of Ethernet LANs + +so, the data reaches all the rest of the nodes connected to the hub, so the data hopefully reaches the correct destination. The hub has no concept of Ethernet frames, of addresses, making decisions based on those addresses, and so on. + +The downside of using LAN hubs is that if two or more devices transmitted a signal at the same instant, the electrical signal collides and becomes garbled. The hub repeats all received electrical signals, even if it receives multiple signals at the same time. For example, Figure +2-23 shows the idea, with PCs Archie and Bob sending an electrical signal at the same instant of time (at Steps 1A and 1B) and the hub repeating both electrical signals out toward +Larry on the left (Step 2). + +55 + + + + + + +2 + + + + +Larry 2 + +Collision! +Hub 1 + +Archie 1A + +1B +Bob + + +Figure 2-23 Collision Occurring Because of LAN Hub Behavior + + +NOTE For completeness, note that the hub floods each frame out all other ports (except the incoming port). So, Archie’s frame goes to both Larry and Bob; Bob’s frame goes to Larry and Archie. + +If you replace the hub in Figure 2-23 with a LAN switch, the switch prevents the collision on the left. The switch operates as a Layer 2 device, meaning that it looks at the data-link header and trailer. A switch would look at the MAC addresses, and even if the switch needed to for-ward both frames to Larry on the left, the switch would send one frame and queue the other frame until the first frame was finished. + +Now back to the issue created by the hub’s logic: collisions. To prevent these collisions, the Ethernet nodes must use half-duplex logic instead of full-duplex logic. A problem occurs only when two or more devices send at the same time; half-duplex logic tells the nodes that if someone else is sending, wait before sending. + +For example, back in Figure 2-23, imagine that Archie began sending his frame early enough so that Bob received the first bits of that frame before Bob tried to send his own frame. Bob, at Step 1B, would notice that he was receiving a frame from someone else, and using half-duplex logic, would simply wait to send the frame listed at Step 1B. + +Nodes that use half-duplex logic actually use a relatively well-known algorithm called car-rier sense multiple access with collision detection (CSMA/CD). The algorithm takes care of the obvious cases but also the cases caused by unfortunate timing. For example, two nodes could check for an incoming frame at the exact same instant, both realize that no other node is sending, and both send their frames at the exact same instant, causing a collision. CSMA/ CD covers these cases as well, as follows: +Step 1. A device with a frame to send listens until the Ethernet is not busy. + +Step 2. When the Ethernet is not busy, the sender begins sending the frame. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +56 CCNA 200-301 Official Cert Guide, Volume 1 + +Step 3. The sender listens while sending to discover whether a collision occurs; colli-sions might be caused by many reasons, including unfortunate timing. If a colli-sion occurs, all currently sending nodes do the following: +A. They send a jamming signal that tells all nodes that a collision happened. + +B. They independently choose a random time to wait before trying again, to avoid unfortunate timing. + +C. The next attempt starts again at Step 1. + +Although most modern LANs do not often use hubs and therefore do not need to use half duplex, enough old hubs still exist in enterprise networks so that you need to be ready +to understand duplex issues. Each NIC and switch port has a duplex setting. For all links between PCs and switches, or between switches, use full duplex. However, for any link con-nected to a LAN hub, the connected LAN switch and NIC port should use half duplex. Note that the hub itself does not use half-duplex logic, instead just repeating incoming signals out every other port. + +Figure 2-24 shows an example, with full-duplex links on the left and a single LAN hub on the right. The hub then requires SW2’s F0/2 interface to use half-duplex logic, along with the PCs connected to the hub. + +Full Full Half Hub + +SW1 Full + +Full A + +Figure 2-24 + +SW2 F0/2 Full + +Full Half B C + +Full and Half Duplex in an Ethernet LAN + + +Before closing the chapter, note that the discussion of full and half duplex connects to two specific terms from CCNA exam topic 1.3.b, but those connections may not be obvious. First, the term Ethernet shared media (from the exam topic) refers to designs that use hubs, require CSMA/CD, and therefore share the bandwidth. The idea behind the term comes from the fact that the devices connected to the hub share the network because they must use CSMA/CD, and CSMA/CD enforces rules that allow only one device to successfully send a frame at any point in time. + +By contrast, the term Ethernet point-to-point in that same exam topic emphasizes the fact that in a network built with switches, each (point-to-point) link works independently of the others. Because of the full-duplex logic discussed in this section, a frame can be sent on every point-to-point link in an Ethernet at the same time. + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 2: Fundamentals of Ethernet LANs 57 + +more details. Table 2-8 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + +Table 2-8 Chapter Review Tracking +Review Element Review Date(s) +Review key topics + +Review key terms + +Answer DIKTA questions + +Review memory tables + + +Resource Used 2 Book, website +Book, website + +Book, PTP + +Book, website + + + +Review All the Key Topics + +Table 2-9 Key Topics for Chapter 2 + +Key Topic Element +Figure 2-3 + +Table 2-2 + +Figure 2-9 + +Figure 2-10 + +Figure 2-12 + +Table 2-3 + +Figure 2-13 + +Figure 2-16 + +Table 2-5 + +Figure 2-20 + +List + +Description Page Number +Drawing of a typical wired and wireless enterprise LAN 36 + +Several types of Ethernet LANs and some details about each 37 + +Conceptual drawing of transmitting in one direction each over 43 two different electrical circuits between two Ethernet nodes +10- and 100-Mbps Ethernet straight-through cable pinouts 43 + +10- and 100-Mbps Ethernet crossover cable pinouts 44 + +List of devices that transmit on wire pair 1,2 and pair 3,6 45 + +Typical uses for straight-through and crossover Ethernet cables 45 + +Physical transmission concepts in a multimode cable 47 + +Comparison between UTP, MM, and SM Ethernet Cabling 49 + +Format of Ethernet MAC addresses 51 + +Definitions of half duplex and full duplex 54 + + +Figure 2-24 Examples of which interfaces use full duplex and which interfaces 56 use half duplex + + +Key Terms You Should Know +Ethernet, IEEE, wired LAN, wireless LAN, Ethernet frame, 10BASE-T, 100BASE-T, 1000BASE-T, Fast Ethernet, Gigabit Ethernet, Ethernet link, RJ-45, Ethernet port, network interface card (NIC), straight-through cable, crossover cable, Ethernet address, MAC address, unicast address, broadcast address, Frame Check Sequence, transceiver, Multimode (MM), single-mode (SM), electromagnetic Interference (EMI), core, cladding, fiber-optic cable + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 3 + + +Fundamentals of WANs and IP Routing + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.a Routers + +1.2 Describe characteristics of network topology architectures + +1.2.d WAN + +This chapter introduces WANs and the various features of the TCP/IP network layer. + +First, for WANs, note that the current CCNA blueprint does not examine WANs in detail as an end to themselves. However, to understand IP routing, you need to understand the basics of the two types of WAN links introduced in the first major section of this chapter: serial links and Ethernet WAN links. In their most basic form, these WAN links connect rout- +ers that sit at sites that can be miles to hundreds of miles apart, allowing communications between remote sites. + +The rest of the chapter then turns to the TCP/IP Network layer, with IP as the center of the discussion. The second section of the chapter discusses the major features of IP: routing, addressing, and routing protocols. The final section of the chapter examines a few protocols other than IP that also help the TCP/IP Network layer create a network that allows end-to-end communication between endpoints. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 3-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Wide-Area Networks +IP Routing + +Other Network Layer Functions + +Questions 1, 2 +3–6 + +7 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Which of the following fields in the HDLC header used by Cisco routers does Cisco add, beyond the ISO standard HDLC? +a. Flag b. Type +c. Address d. FCS +2. Two routers, R1 and R2, connect using an Ethernet over MPLS service. The service provides point-to-point service between these two routers only, as a Layer 2 Ethernet service. Which of the following are the most likely to be true about this WAN? (Choose two answers.) +a. R1 will connect to a physical Ethernet link, with the other end of the cable con-nected to R2. +b. R1 will connect to a physical Ethernet link, with the other end of the cable con-nected to a device at the WAN service provider point of presence. +c. R1 will forward data-link frames to R2 using an HDLC header/trailer. d. R1 will forward data-link frames to R2 using an Ethernet header/trailer. +3. Imagine a network with two routers that are connected with a point-to-point HDLC serial link. Each router has an Ethernet, with PC1 sharing the Ethernet with Router1 and PC2 sharing the Ethernet with Router2. When PC1 sends data to PC2, which of the following is true? +a. Router1 strips the Ethernet header and trailer off the frame received from PC1, never to be used again. +b. Router1 encapsulates the Ethernet frame inside an HDLC header and sends the frame to Router2, which extracts the Ethernet frame for forwarding to PC2. +c. Router1 strips the Ethernet header and trailer off the frame received from PC1, which is exactly re-created by Router2 before forwarding data to PC2. +d. Router1 removes the Ethernet, IP, and TCP headers and rebuilds the appropriate headers before forwarding the packet to Router2. + +4. Which of the following does a router normally use when making a decision about routing TCP/IP packets? +a. Destination MAC address b. Source MAC address +c. Destination IP address d. Source IP address +e. Destination MAC and IP addresses + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +60 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Which of the following are true about a LAN-connected TCP/IP host and its IP rout-ing (forwarding) choices? +a. The host always sends packets to its default gateway. b. The host never sends packets to its default gateway. +c. The host sends packets to its default gateway if the destination IP address is in a different subnet than the host. +d. The host sends packets to its default gateway if the destination IP address is in the same subnet as the host. + +6. Which of the following are functions of a routing protocol? (Choose two answers.) a. Advertising known routes to neighboring routers +b. Learning routes for subnets directly connected to the router +c. Learning routes and putting those routes into the routing table for routes adver-tised to the router by its neighboring routers +d. Forwarding IP packets based on a packet’s destination IP address + +7. A company implements a TCP/IP network, with PC1 sitting on an Ethernet LAN. Which of the following protocols and features requires PC1 to learn information from some other server device? +a. ARP b. ping c. DNS +d. None of these answers is correct. + + +Foundation Topics + +Wide-Area Networks +Imagine a typical day at the branch office at some enterprise. The user sits at some endpoint device: a PC, tablet, phone, and so on. It connects to a LAN, either via an Ethernet cable or using a wireless LAN. However, the user happens to be checking information on a website, and that web server sits at the home office of the company. To make that work, the data trav-els over one or more wide-area network (WAN) links. + +WAN technologies define the physical (Layer 1) standards and data-link (Layer 2) protocols used to communicate long distances. This first section examines two such technologies: leased-line WANs and Ethernet WANs. Leased-line WANs have been an option for net-works for half a century, are becoming much less common today, but you may still see some leased-line WAN links in the exam. Ethernet WAN links do use the same data-link protocols as Ethernet LANs, but they use additional features to make the links work over the much +longer distances required for WANs. The next few pages examine leased-line WANs first, fol-lowed by Ethernet WANs. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 61 + +Leased-Line WANs +To connect LANs using a WAN, the internetwork uses a router connected to each LAN, with a WAN link between the routers. First, the enterprise’s network engineer would order some kind of WAN link. A router at each site connects to both the WAN link and the LAN, as shown in Figure 3-1. Note that a crooked line between the routers is the common way to represent a leased line when the drawing does not need to show any of the physical details of the line. + +PC1 PC2 3 + +R1 R2 + +LAN WAN LAN + +Figure 3-1 Small Enterprise Network with One Leased Line + +This section begins by examining the physical details of leased lines, followed by a discus-sion of the default data-link protocol for leased lines (HDLC). + +Physical Details of Leased Lines +The leased line service delivers bits in both directions, at a predetermined speed, using full-duplex logic. In fact, conceptually it acts as if you had a full-duplex crossover Ethernet link between two routers, as shown in Figure 3-2. The leased line uses two pairs of wires, one pair for each direction of sending data, which allows full-duplex operation. + +Building 1 Building 2 + +SW11 SW21 + +1000 Miles + +SW12 R1 R2 SW22 + +Figure 3-2 Conceptual View of the Leased-Line Service + +Of course, leased lines have many differences compared to an Ethernet crossover cable. To create such possibly long links, or circuits, a leased line does not actually exist as a single long cable between the two sites. Instead, the telephone company (telco) that creates the leased line installs a large network of cables and specialized switching devices to create its own computer network. The telco network creates a service that acts like a crossover cable between two points, but the physical reality is hidden from the customer. + +Leased lines come with their own set of terminology as well. First, the term leased line refers to the fact that the company using the leased line does not own the line but instead pays a monthly lease fee to use it. Table 3-2 lists some of the many names for leased lines, mainly so that in a networking job, you have a chance to translate from the terms each per-son uses with a basic description as to the meaning of the name. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +62 CCNA 200-301 Official Cert Guide, Volume 1 + + +Table 3-2 +Name + +Different Names for a Leased Line +Meaning or Reference + + + +Leased circuit, Circuit + +Serial link, Serial line + +Point-to-point link, Point-to-point line +T1 + + +The words line and circuit are often used as synonyms in telco terminology; circuit makes reference to the electrical circuit between the two endpoints. + +The words link and line are also often used as synonyms. Serial in this case refers to the fact that the bits flow serially and that routers use serial interfaces. +These terms refer to the fact that the topology stretches between two points, and two points only. (Some older leased lines allowed more than two devices.) +This specific type of leased line transmits data at 1.544 megabits per second (1.544 Mbps). + +WAN link, Link Both of these terms are very general, with no reference to any specific technology. +Private line This term refers to the fact that the data sent over the line cannot be copied by other telco customers, so the data is private. + + +To create a leased line, some physical path must exist between the two routers on the ends of the link. The physical cabling must leave the customer buildings where each router sits. However, the telco does not simply install one cable between the two buildings. Instead, it uses what is typically a large and complex network that creates the appearance of a cable between the two routers. + +Figure 3-3 gives a little insight into the cabling that could exist inside the telco for a short leased line. Telcos put their equipment in buildings called central offices (CO). The telco installs cables from the CO to most every other building in the city, expecting to sell ser-vices to the people in those buildings one day. The telco would then configure its switches to use some of the capacity on each cable to send data in both directions, creating the equiva-lent of a crossover cable between the two routers. + + +Customer Site1 + + + + + +R1 + + +Telco CO1 + + + + +Switch-1 + + +Telco CO2 + + + + +Switch-2 + +Customer Site2 + + + + + +R2 + + + + +Underground + +Figure 3-3 Possible Cabling Inside a Telco for a Short Leased Line + +Answers to the “Do I Know This Already?” quiz: 1 B 2 B, D 3 A 4 C 5 C 6 A, C 7 C + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 63 + +Although the customer does not need to know all the details of how a telco creates a partic-ular leased line, enterprise engineers do need to know about the parts of the link that exist inside the customer’s building at the router. However, for the purposes of CCNA, you can think of any serial link as a point-to-point connection between two routers. + +HDLC Data-Link Details of Leased Lines +A leased line provides a Layer 1 service. In other words, it promises to deliver bits between +the devices connected to the leased line. However, the leased line itself does not define a +data-link layer protocol to be used on the leased line. 3 + +Because leased lines define only the Layer 1 transmission service, many companies and stan-dards organizations have created data-link protocols to control and use leased lines. Today, the two most popular data-link layer protocols used for leased lines between two routers are High-Level Data Link Control (HDLC) and Point-to-Point Protocol (PPP). + +All data-link protocols perform a similar role: to control the correct delivery of data over a physical link of a particular type. For example, the Ethernet data-link protocol uses a des-tination address field to identify the correct device that should receive the data and an FCS field that allows the receiving device to determine whether the data arrived correctly. HDLC provides similar functions. + +HDLC has less work to do than Ethernet because of the simple point-to-point topology of a leased line. When one router sends an HDLC frame, the frame can go only one place: to the other end of the link. So, while HDLC has an address field, the destination is implied, and the actual address is unimportant. The idea is sort of like when I have lunch with my friend Gary, and only Gary. I do not need to start every sentence with “Hey, Gary”—he knows I am talking to him. + +HDLC has other fields and functions similar to Ethernet as well. Table 3-3 lists the HDLC fields, with the similar Ethernet header/trailer field, just for the sake of learning HDLC based on something you have already learned about (Ethernet). + +Table 3-3 Comparing HDLC Header Fields to Ethernet +HDLC Ethernet Description Field Equivalent + +Flag Preamble, SFD + +Lists a recognizable bit pattern so that the receiving nodes realize that a new frame is arriving. + +Address Destination Identifies the destination device. Address + +Control N/A + +Type Type + +FCS FCS + +Mostly used for purposes no longer in use today for links between routers. +Identifies the type of Layer 3 packet encapsulated inside the frame. + +Identifies a field used by the error detection process. (It is the only trailer field in this table.) + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| +Flag +Address +Control +Type +Data +FCS + + +64 CCNA 200-301 Official Cert Guide, Volume 1 + +HDLC exists today as a standard of the International Organization for Standardization (ISO), the same organization that brought us the OSI model. However, ISO standard HDLC does not have a Type field, and routers need to know the type of packet inside the frame. So, Cisco routers use a Cisco-proprietary variation of HDLC that adds a Type field, as shown in Figure 3-4. + +Proprietary Cisco HDLC (Adds Type Field) + +Bytes 1 1 1 2 Variable 2 + + + +Figure 3-4 HDLC Framing + +How Routers Use a WAN Data Link +Leased lines connect to routers, and routers focus on delivering packets to a destination host. However, routers physically connect to both LANs and WANs, with those LANs and WANs requiring that data be sent inside data-link frames. So, now that you know a little about HDLC, it helps to think about how routers use the HDLC protocol when sending data. + +First, the TCP/IP network layer focuses on forwarding IP packets from the sending host to the destination host. The underlying LANs and WANs just act as a way to move the packets to the next router or end-user device. Figure 3-5 shows that network layer perspective. + + +Final Destination PC2? Send to R1 Next + +Final Destination PC2? Send to R2 Next + +Final Destination PC2? Send to PC2 Next + + +1 LAN 2 WAN 3 LAN + + + +To PC2 R1 To PC2 PC1 + +R2 To PC2 +PC2 + + +Figure 3-5 IP Routing Logic over LANs and WANs + +Following the steps in the figure, for a packet sent by PC1 to PC2’s IP address: + +1. PC1’s network layer (IP) logic tells it to send the packet to a nearby router (R1). +2. Router R1’s network layer logic tells it to forward (route) the packet out the leased line to Router R2 next. +3. Router R2’s network layer logic tells it to forward (route) the packet out the LAN link to PC2 next. + +While Figure 3-5 shows the network layer logic, the PCs and routers must rely on the LANs and WANs in the figure to actually move the bits in the packet. Figure 3-6 shows the same figure, with the same packet, but this time showing some of the data-link layer logic used by the hosts and routers. Basically, three separate data-link layer steps encapsulate the packet, inside a data-link frame, over three hops through the internetwork: from PC1 to R1, from R1 to R2, and from R2 to PC2. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 65 + +LAN1 HDLC LAN2 +PC1 PC2 + +R1 R2 + + + +1 + +802.3 802.3 +IP Packet +Header Trailer + +2 + +Header IP Packet Trailer +HDLC HDLC + +3 + +802.3 802.3 +IP Packet +Header Trailer + +Figure 3-6 General Concept of Routers De-encapsulating and Re-encapsulating IP 3 Packets + +Following the steps in the figure, again for a packet sent by PC1 to PC2’s IP address: + +1. To send the IP packet to Router R1 next, PC1 encapsulates the IP packet in an Ethernet frame that has the destination MAC address of R1. +2. Router R1 de-encapsulates (removes) the IP packet from the Ethernet frame, encapsu-lates the packet into an HDLC frame using an HDLC header and trailer, and forwards the HDLC frame to Router R2 next. +3. Router R2 de-encapsulates (removes) the IP packet from the HDLC frame, encapsu-lates the packet into an Ethernet frame that has the destination MAC address of PC2, and forwards the Ethernet frame to PC2. + +In summary, a leased line with HDLC creates a WAN link between two routers so that they can forward packets for the devices on the attached LANs. The leased line itself provides the physical means to transmit the bits, in both directions. The HDLC frames provide the means to encapsulate the network layer packet correctly so that it crosses the link between routers. + +Leased lines have many benefits that have led to their relatively long life in the WAN market-place. These lines are simple for the customer, are widely available, are of high quality, and are private. However, they do have some negatives as well compared to newer WAN tech-nologies, including a higher cost and typically longer lead times to get the service installed. Additionally, by today’s standards, leased-line LANs are slow, with faster speeds in the tens of megabits per second (Mbps). New faster WAN technology has been replacing leased lines for a long time, including the second WAN technology discussed in this book: Ethernet. + +Ethernet as a WAN Technology +For the first several decades of the existence of Ethernet, Ethernet was only appropriate for LANs. The restrictions on cable lengths and devices might allow a LAN that stretched a kilo-meter or two, to support a campus LAN, but that was the limit. + +As time passed, the IEEE improved Ethernet standards in ways that made Ethernet a reason-able WAN technology. For example, the 1000BASE-LX standard uses single-mode fiber cabling, with support for a 5-km cable length; the 1000BASE-ZX standard supports an even longer 70-km cable length. As time went by, and as the IEEE improved cabling distances for fiber Ethernet links, Ethernet became a reasonable WAN technology. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +66 CCNA 200-301 Official Cert Guide, Volume 1 + +Today, many WAN service providers (SP) offer WAN services that take advantage of Ethernet. SPs offer a wide variety of these Ethernet WAN services, with many different names. But all of them use a similar model, with Ethernet used between the customer site and the SP’s network, as shown in Figure 3-7. + + + + + +Customer Site + +R1 CPE +Fiber Ethernet Access Link + +Service Provider PoP + +SP1 + + +Service Provider’s Ethernet WAN Service + +Service Provider PoP + +SP2 + + +Customer Site + +R2 CPE +Fiber Ethernet Access Link + + +Figure 3-7 Fiber Ethernet Link to Connect a CPE Router to a Service Provider’s WAN + +The model shown in Figure 3-7 has many of the same ideas of how a telco creates a leased line, as shown earlier in Figure 3-3, but now with Ethernet links and devices. The customer con-nects to an Ethernet link using a router interface. The (fiber) Ethernet link leaves the customer building and connects to some nearby SP location called a point of presence (PoP). Instead of a telco switch as shown in Figure 3-3, the SP uses an Ethernet switch. Inside the SP’s network, the SP uses any technology that it wants to create the specific Ethernet WAN services. + +Ethernet WANs That Create a Layer 2 Service +Ethernet WAN services include a variety of specific services that vary in ways that change how routers use those services. However, for the purposes of CCNA, you just need to under-stand the most basic Ethernet WAN service, one that works much like an Ethernet crossover cable—just over a WAN. In other words: + +■ Logically, behaves like a point-to-point connection between two routers +■ Physically, behaves as if a physical fiber Ethernet link existed between the two routers + + +NOTE For perspective about the broad world of the service provider network shown in Figure 3-7, look for more information about the Cisco CCNA, CCNP Service Provider, and CCIE Service Provider certifications. See www.cisco.com/go/certifications for more details. + +This book refers to this particular Ethernet WAN service with a couple of the common names: + +Ethernet WAN: A generic name to differentiate it from an Ethernet LAN. +Ethernet Line Service (E-Line): A term from the Metro Ethernet Forum (MEF) for the kind of point-to-point Ethernet WAN service shown throughout this book. +Ethernet emulation: A term emphasizing that the link is not a literal Ethernet link from end to end. +Ethernet over MPLS (EoMPLS): A term that refers to Multiprotocol Label Switching (MPLS), a technology that can be used to create the Ethernet service for the customer. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 67 + +So, if you can imagine two routers, with a single Ethernet link between the two routers, you understand what this particular EoMPLS service does, as shown in Figure 3-8. In this case, the two routers, R1 and R2, connect with an EoMPLS service instead of a serial link. The routers use Ethernet interfaces, and they can send data in both directions at the same time. Physically, each router actually connects to some SP PoP, as shown earlier in Figure 3-7, but logically, the two routers can send Ethernet frames to each other over the link. + + +Fiber Optic +PC1 Ethernet Link G0/1 G0/0 +R1 R2 + + +PC2 3 + + +Ethernet LAN EoMPLS WAN Ethernet LAN + +Figure 3-8 EoMPLS Acting Like a Simple Ethernet Link Between Two Routers + +How Routers Route IP Packets Using Ethernet Emulation +WANs, by their very nature, give IP routers a way to forward IP packets from a LAN at one site, over the WAN, and to another LAN at another site. Routing over an EoMPLS WAN link still uses the WAN like a WAN, as a way to forward IP packets from one site to another. However, the WAN link happens to use the same Ethernet protocols as the Ethernet LAN links at each site. + +The EoMPLS link uses Ethernet for both Layer 1 and Layer 2 functions. That means the link uses the same familiar Ethernet header and trailer, as shown in the middle of Figure 3-9. Note that the figure shows a small cloud over the Ethernet link as a way to tell us that the link is an Ethernet WAN link, rather than an Ethernet LAN link. + +LAN1 EoMPLS WAN LAN2 +PC1 PC2 G0/1 G0/0 +R1 R2 + + +1 +802.3 802.3 +IP Packet +Header Trailer + +2 +802.3 802.3 +IP Packet +Header Trailer + +3 +802.3 802.3 +IP Packet +Header Trailer + + +Source = R1 G0/1 MAC Destination = R2 G0/0 MAC + +Figure 3-9 Routing over an EoMPLS Link + + +NOTE The 802.3 headers/trailers in the figure are different at each stage! Make sure to notice the reasons in the step-by-step explanations that follow. + +The figure shows the same three routing steps as shown with the serial link in the earlier Figure 3-6. In this case, all three routing steps use the same Ethernet (802.3) protocol. However, note that each frame’s data-link header and trailer are different. Each router + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +68 CCNA 200-301 Official Cert Guide, Volume 1 + +discards the old data-link header/trailer and adds a new set, as described in these steps. Focus mainly on Step 2, because compared to the similar example shown in Figure 3-6, Steps 1 and 3 are unchanged: +1. To send the IP packet to Router R1 next, PC1 encapsulates the IP packet in an Ethernet frame that has the destination MAC address of R1. +2. Router R1 de-encapsulates (removes) the IP packet from the Ethernet frame and encap-sulates the packet into a new Ethernet frame, with a new Ethernet header and trailer. The destination MAC address is R2’s G0/0 MAC address, and the source MAC address is R1’s G0/1 MAC address. R1 forwards this frame over the EoMPLS service to R2 next. +3. Router R2 de-encapsulates (removes) the IP packet from the Ethernet frame, encapsu-lates the packet into an Ethernet frame that has the destination MAC address of PC2, and forwards the Ethernet frame to PC2. + +Throughout this book, the WAN links (serial and Ethernet) will connect routers as shown here, with the focus being on the LANs and IP routing. The rest of the chapter turns our attention to a closer look at IP routing. + +IP Routing +Many protocol models have existed over the years, but today the TCP/IP model dominates. And at the network layer of TCP/IP, two options exist for the main protocol around which all other network layer functions revolve: IP version 4 (IPv4) and IP version 6 (IPv6). Both IPv4 and IPv6 define the same kinds of network layer functions, but with different details. This chapter introduces these network layer functions for IPv4. + +NOTE All references to IP in this chapter refer to the older and more established IPv4. + +Internet Protocol (IP) focuses on the job of routing data, in the form of IP packets, from the source host to the destination host. IP does not concern itself with the physical transmission of data, instead relying on the lower TCP/IP layers to do the physical transmission of the data. Instead, IP concerns itself with the logical details, rather than physical details, of delivering data. In particular, the network layer specifies how packets travel end to end over a TCP/IP net-work, even when the packet crosses many different types of LAN and WAN links. + +This next major section of the chapter examines IP routing in more depth. First, IP defines what it means to route an IP packet from sending host to destination host, while using suc-cessive data-link protocols. This section then examines how IP addressing rules help to make IP routing much more efficient by grouping addresses into subnets. This section closes by looking at the role of IP routing protocols, which give routers a means by which to learn routes to all the IP subnets in an internetwork. + +Network Layer Routing (Forwarding) Logic +Routers and end-user computers (called hosts in a TCP/IP network) work together to perform IP routing. The host operating system (OS) has TCP/IP software, including the software that implements the network layer. Hosts use that software to choose where to send IP packets, + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 69 + +often to a nearby router. Those routers make choices of where to send the IP packet next. Together, the hosts and routers deliver the IP packet to the correct destination, as shown in the example in Figure 3-10. + + +150.150.1.10 + +PC1 + + + + +R1 S0 +Serial + + +Destination Is in Another Group; Send to Nearby Router + +IP Packet + + +My Route Says: Send to R2 3 + +IP Packet + + + + + + + +EoMPLS + + + +Subnet 150.150.4.0 + + +R2 F0/0 + + + +R3 G0/0 + +PC2 + +My Route Says: Send to R3 + +IP Packet + + + +My Route Says: Send Directly to PC2 + +IP Packet + + +150.150.4.10 + + +Figure 3-10 Routing Logic: PC1 Sending an IP Packet to PC2 + +The IP packet, created by PC1, goes from the top of the figure all the way to PC2 at the bot-tom of the figure. The next few pages discuss the network layer routing logic used by each device along the path. + +NOTE The term path selection is sometimes used to refer to the routing process shown in Figure 3-10. At other times, it refers to routing protocols, specifically how routing protocols select the best route among the competing routes to the same destination. + + +Host Forwarding Logic: Send the Packet to the Default Router +In this example, PC1 does some basic analysis and then chooses to send the IP packet to the router so that the router will forward the packet. PC1 analyzes the destination address and realizes that PC2’s address (150.150.4.10) is not on the same LAN as PC1. So PC1’s logic tells it to send the packet to a device whose job it is to know where to route data: a nearby router, on the same LAN, called PC1’s default router. + +To send the IP packet to the default router, the sender sends a data-link frame across the medium to the nearby router; this frame includes the packet in the data portion of the frame. That frame uses data-link layer (Layer 2) addressing in the data-link header to ensure that the nearby router receives the frame. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +70 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE The default router is also referred to as the default gateway. + + +R1 and R2’s Logic: Routing Data Across the Network +All routers use the same general process to route the packet. Each router keeps an IP rout-ing table. This table lists IP address groupings, called IP networks and IP subnets. When a router receives a packet, it compares the packet’s destination IP address to the entries in the routing table and makes a match. This matching entry also lists directions that tell the router where to forward the packet next. + +In Figure 3-10, R1 would have matched the destination address (150.150.4.10) to a routing table entry, which in turn told R1 to send the packet to R2 next. Similarly, R2 would have matched a routing table entry that told R2 to send the packet, over an Ethernet WAN link, to R3 next. + +The routing concept works a little like driving down the freeway when approaching a big inter-change. You look up and see signs for nearby towns, telling you which exits to take to go to each town. Similarly, the router looks at the IP routing table (the equivalent of the road signs) and directs each packet over the correct next LAN or WAN link (the equivalent of a road). + +R3’s Logic: Delivering Data to the End Destination +The final router in the path, R3, uses almost the same logic as R1 and R2, but with one minor difference. R3 needs to forward the packet directly to PC2, not to some other router. On +the surface, that difference seems insignificant. In the next section, when you read about how the network layer uses LANs and WANs, the significance of the difference will become obvious. + +How Network Layer Routing Uses LANs and WANs +While the network layer routing logic ignores the physical transmission details, the bits still have to be transmitted. To do that work, the network layer logic in a host or router must hand off the packet to the data-link layer protocols, which, in turn, ask the physical layer +to actually send the data. The data-link layer adds the appropriate header and trailer to the packet, creating a frame, before sending the frames over each physical network. + +The routing process forwards the network layer packet from end to end through the net-work, while each data-link frame only takes a smaller part of the trip. Each successive data-link layer frame moves the packet to the next device that thinks about network layer logic. In short, the network layer thinks about the bigger view of the goal, like “Send this packet to the specified next router or host…,” while the data-link layer thinks about the specifics, like “Encapsulate the packet in a data-link frame and transmit it.” The following list summarizes +the major steps in a router’s internal network layer routing for each packet beginning with the a frame arriving in a router interface: +Step 1. Use the data-link Frame Check Sequence (FCS) field to ensure that the frame had no errors; if errors occurred, discard the frame. + +Step 2. Assuming that the frame was not discarded at Step 1, discard the old data-link header and trailer, leaving the IP packet. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 71 + +Step 3. Compare the IP packet’s destination IP address to the routing table, and find the route that best matches the destination address. This route identifies the outgo-ing interface of the router and possibly the next-hop router IP address. +Step 4. Encapsulate the IP packet inside a new data-link header and trailer, appropriate for the outgoing interface, and forward the frame. + + +Figure 3-11 works through a repeat example of a packet sent by PC1 to PC2, followed by a +detailed analysis of each device’s routing logic. Each explanation includes the details about 3 how PC1 and each of the three routers builds the appropriate new data-link headers. + +150.150.1.10 +A PC1 Eth IP Packet Eth + +R1 Routing Table 150.150.1.4 + +Subnet +150.150.4.0 + +Interface +Serial0 + +Next Hop +150.150.2.7 + + +B R1 HDLC IP Packet HDLC S0 + + +R2 Routing Table 150.150.2.7 + +Subnet +150.150.4.0 + +Interface Next Hop +FastEth0/0 150.150.3.1 + + +C R2 Eth IP Packet Eth F0/0 + + +R3 Routing Table 150.150.3.1 + +Subnet +150.150.4.0 + +Interface Next Hop +Gigabit0/0 N/A + + +D R3 Eth IP Packet Eth G0/0 + + +Subnet PC2 150.150.4.10 150.150.4.0 + +Figure 3-11 Network Layer and Data-Link Layer Encapsulation + +The following list explains the forwarding logic at each router, focusing on how the routing integrates with the data link. +Step A. PC1 sends the packet to its default router. PC1’s network layer logic builds the IP packet, with a destination address of PC2’s IP address (150.150.4.10). The network layer also performs the analysis to decide that 150.150.4.10 is not in the local IP subnet, so PC1 needs to send the packet to R1 (PC1’s default router). PC1 places the IP packet into an Ethernet data-link frame, with a desti- +nation Ethernet address of R1’s Ethernet address. PC1 sends the frame on to the Ethernet. +Step B. R1 processes the incoming frame and forwards the packet to R2. Because the incoming Ethernet frame has a destination MAC of R1’s Ethernet MAC, R1 decides to process the frame. R1 checks the frame’s FCS for errors, and if none, R1 discards the Ethernet header and trailer. Next, R1 compares the packet’s + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +72 CCNA 200-301 Official Cert Guide, Volume 1 + +destination address (150.150.4.10) to its routing table and finds the entry for subnet 150.150.4.0. Because the destination address of 150.150.4.10 is in that subnet, R1 forwards the packet out the interface listed in that matching route (Serial0) to next-hop Router R2 (150.150.2.7). R1 must first encapsulate the IP packet into an HDLC frame. +Step C. R2 processes the incoming frame and forwards the packet to R3. R2 repeats the same general process as R1 when R2 receives the HDLC frame. R2 checks the FCS field and finds that no errors occurred and then discards the HDLC header and trailer. Next, R2 compares the packet’s destination address (150.150.4.10) to its routing table and finds the entry for subnet 150.150.4.0, +a route that directs R2 to send the packet out interface Fast Ethernet 0/0 to next-hop router 150.150.3.1 (R3). But first, R2 must encapsulate the packet in an Ethernet header. That header uses R2’s MAC address and R3’s MAC +address on the Ethernet WAN link as the source and destination MAC address, respectively. +Step D. R3 processes the incoming frame and forwards the packet to PC2. Like R1 and R2, R3 checks the FCS, discards the old data-link header and trailer, and matches its own route for subnet 150.150.4.0. R3’s routing table entry for 150.150.4.0 shows that the outgoing interface is R3’s Ethernet interface, but there is no next-hop router because R3 is connected directly to subnet 150.150.4.0. All R3 has to do is encapsulate the packet inside a new Ethernet header and trailer, but with a destination Ethernet address of PC2’s MAC address. + + +Because the routers build new data-link headers and trailers, and because the new headers contain data-link addresses, the PCs and routers must have some way to decide what data-link addresses to use. An example of how the router determines which data-link address to use is the IP Address Resolution Protocol (ARP). ARP dynamically learns the data-link address of an IP host connected to a LAN. For example, at the last step, at the bottom of Figure 3-11, Router R3 would use ARP once to learn PC2’s MAC address before sending any packets to PC2. + +How IP Addressing Helps IP Routing +IP defines network layer addresses that identify any host or router interface that connects to a TCP/IP network. The idea basically works like a postal address: Any interface that expects to receive IP packets needs an IP address, just like you need a postal address before receiving mail from the postal service. This next short topic introduces the idea of IP networks and subnets, which are the groups of addresses defined by IP. + +NOTE IP defines the word network to mean a very specific concept. To avoid confusion when writing about IP addressing, this book (and others) often avoids using the term net-work for other uses. In particular, this book uses the term internetwork to refer more gener-ally to a network made up of routers, switches, cables, and other equipment. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 3: Fundamentals of WANs and IP Routing + +Rules for Groups of IP Addresses (Networks and Subnets) +TCP/IP groups IP addresses together so that IP addresses used on the same physical network are part of the same group. IP calls these address groups an IP network or an IP subnet. Using that same postal service analogy, each IP network and IP subnet works like a postal code (or in the United States, a ZIP code). All nearby postal addresses are in the same postal code (ZIP code), while all nearby IP addresses must be in the same IP network or IP subnet. + +IP defines specific rules about which IP address should be in the same IP network or IP sub-net. Numerically, the addresses in the same group have the same value in the first part of the addresses. For example, Figures 3-10 and 3-11 could have used the following conventions: + +■ Hosts on the top Ethernet: Addresses start with 150.150.1 +■ Hosts on the R1–R2 serial link: Addresses start with 150.150.2 +■ Hosts on the R2–R3 EoMPLS link: Addresses start with 150.150.3 +■ Hosts on the bottom Ethernet: Addresses start with 150.150.4 + +73 + + + + + + + + + +3 + + +From the perspective of IP routing, the grouping of IP addresses means that the routing table can be much smaller. A router can list one routing table entry for each IP network or subnet, instead of one entry for every single IP address. + +While the list shows just one example of how IP addresses may be grouped, the rules for how to group addresses using subnets will require some work to master the concepts and math. Part III of this book details IP addressing and subnetting, and you can find other subnetting video and practice products listed in the Introduction to the book. However, the brief version of two of the foundational rules of subnetting can be summarized as follows: + +■ Two IP addresses, not separated from each other by a router, must be in the same group (subnet). +■ Two IP addresses, separated from each other by at least one router, must be in different groups (subnets). + +It’s similar to the USPS ZIP code system and how it requires local governments to assign addresses to new buildings. It would be ridiculous to have two houses next door to each other, whose addresses had different postal/ZIP codes. Similarly, it would be silly to have people who live on opposite sides of the country to have addresses with the same postal/ ZIP code. + +The IP Header +The routing process also makes use of the IPv4 header, as shown in Figure 3-12. The header lists a 32-bit source IP address, as well as a 32-bit destination IP address. The header, of course, has other fields, a few of which matter for other discussions in this book. The book will refer to this figure as needed, but otherwise, be aware of the 20-byte IP header and the existence of the source and destination IP address fields. Note that in the examples so far in this chapter, while routers remove and add data-link headers each time it routes a packet, the IP header remains, with the IP addresses unchanged by the IP routing process. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +74 CCNA 200-301 Official Cert Guide, Volume 1 + +4 Bytes + +Version Length DS Field Packet Length + +Identification Flags Fragment Offset + +Time to Live Protocol Header Checksum + +Source IP Address + +Destination IP Address + +Figure 3-12 IPv4 Header, Organized as 4 Bytes Wide for a Total of 20 Bytes + +How IP Routing Protocols Help IP Routing +For routing logic to work on both hosts and routers, each host and router needs to know some-thing about the TCP/IP internetwork. Hosts need to know the IP address of their default router so that hosts can send packets to remote destinations. Routers, however, need to know routes so they forward packets to each and every reachable IP network and IP subnet. + +The best method for routers to know all the useful routes is to configure the routers to use the same IP routing protocol. Alternately, a network engineer could configure (type) all the required routes, on every router. However, if you enable the same routing protocol on all the routers in a TCP/IP internetwork, with the correct settings, the routers will send routing protocol messages to each other. As a result, all the routers will learn routes for all the IP networks and subnets in the TCP/IP internetwork. + +IP supports a small number of different IP routing protocols. All use some similar ideas and processes to learn IP routes, but different routing protocols do have some internal differenc-es; otherwise, you would not need more than one routing protocol. However, many routing protocols use the same general steps for learning routes: +Step 1. Each router, independent of the routing protocol, adds a route to its routing table for each subnet directly connected to the router. + +Step 2. Each router’s routing protocol tells its neighbors about the routes in its routing table, including the directly connected routes and routes learned from other routers. +Step 3. After learning a new route from a neighbor, the router’s routing protocol adds a route to its IP routing table, with the next-hop router of that route typically being the neighbor from which the route was learned. + + +Also, note that at the final step, routers may have to choose between multiple routes to reach a single subnet. When that happens, routers place the best currently available route to reach a subnet (based on a measurement called a metric) into the routing table. + +Figure 3-13 shows an example of how a routing protocol works, using the same diagram as in Figures 3-10 and 3-11. In this case, IP subnet 150.150.4.0, which consists of all addresses that begin with 150.150.4.0, sits on the Ethernet at the bottom of the figure. The figure shows the advertisement of routes for subnet 150.150.4.0 from bottom to top, as described in detail fol-lowing the figure. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 75 + + +PC1 PC11 + + +R1 Routing Table + +F +R1 + + +Subnet Interface Next Hop + +S0 150.150.4.0 Serial0 150.150.2.7 E + +150.150.2.7 + +R2 + + +R2 Routing Table 3 D Subnet Interface Next Hop + +F0/0 150.150.4.0 FastEth0/0 150.150.3.1 C +150.150.3.1 R3 Routing Table + + +Subnet 150.150.4.0 + +B +R3 G0/0 +A + + +Subnet +150.150.4.0 + + +Interface Next Hop +Gigabit0/0 N/A + +PC2 +150.150.4.10 + +Figure 3-13 Example of How Routing Protocols Advertise About Networks and Subnets + +Follow items A through F shown in the figure to see how each router learns its route to 150.150.4.0. +Step A. Subnet 150.150.4.0 exists as a subnet at the bottom of the figure, connected to Router R3. + +Step B. R3 adds a connected route for 150.150.4.0 to its IP routing table; this happens without help from the routing protocol. + +Step C. R3 sends a routing protocol message, called a routing update, to R2, causing R2 to learn about subnet 150.150.4.0. + +Step D. R2 adds a route for subnet 150.150.4.0 to its routing table. + +Step E. R2 sends a similar routing update to R1, causing R1 to learn about subnet 150.150.4.0. + +Step F. R1 adds a route for subnet 150.150.4.0 to its routing table. The route lists R1’s own Serial0 as the outgoing interface and R2 as the next-hop router IP address (150.150.2.7). + + +Other Network Layer Features +The TCP/IP network layer defines many functions beyond IP. Sure, IP plays a huge role in networking today, defining IP addressing and IP routing. However, other protocols and stan-dards, defined in other Requests For Comments (RFC), play an important role for network layer functions as well. For example, routing protocols like Open Shortest Path First (OSPF) exist as separate protocols, defined in separate RFCs. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +76 CCNA 200-301 Official Cert Guide, Volume 1 + +This last short section of the chapter introduces three other network layer features that should be helpful to you when reading through the rest of this book. These last three top-ics just help fill in a few holes, helping to give you some perspective and helping you make sense of later discussions as well. The three topics are + +■ Domain Name System (DNS) +■ Address Resolution Protocol (ARP) ■ Ping + +Using Names and the Domain Name System +Can you imagine a world in which every time you used an application, you had to refer to it by IP address? Instead of using easy names like google.com or facebook.com, you would +have to remember and type IP addresses, like 64.233.177.100. (At press time, 64.233.177.100 was an address used by Google, and you could reach Google’s website by typing that address in a browser.) Certainly, asking users to remember IP addresses would not be user friendly and could drive some people away from using computers at all. + +Thankfully, TCP/IP defines a way to use hostnames to identify other computers. The user either never thinks about the other computer or refers to the other computer by name. Then, protocols dynamically discover all the necessary information to allow communications based on that name. + +For example, when you open a web browser and type in the hostname www.google.com, your computer does not send an IP packet with destination IP address www.google.com; it sends an IP packet to an IP address used by the web server for Google. TCP/IP needs a way to let a computer find the IP address used by the listed hostname, and that method uses the Domain Name System (DNS). + +Enterprises use the DNS process to resolve names into the matching IP address, as shown in the example in Figure 3-14. In this case, PC11, on the left, needs to connect to a server named Server1. At some point, the user either types in the name Server1 or some applica-tion on PC11 refers to that server by name. At Step 1, PC11 sends a DNS message—a DNS query—to the DNS server. At Step 2, the DNS server sends back a DNS reply that lists Server1’s IP address. At Step 3, PC11 can now send an IP packet to destination address 10.1.2.3, the address used by Server1. + + +DNS Server Name Database + + +Name Server1 +Server2 + +Address DNS 10.1.2.3 Server +10.1.2.6 + + + + + +TCP/IP Network + + +PC11 1 IP Address of Server1? 11 2 Server1 = 10.1.2.3 +3 + +Server1 10.1.2.3 + + +Figure 3-14 Basic DNS Name Resolution Request + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 3: Fundamentals of WANs and IP Routing + +Note that the example in Figure 3-14 shows a cloud for the TCP/IP network because the details of the network, including routers, do not matter to the name resolution process. Routers treat the DNS messages just like any other IP packet, routing them based on the destination IP address. For example, at Step 1 in the figure, the DNS query will list the DNS server’s IP address as the destination address, which any routers will use to forward the packet. + +Finally, DNS defines much more than just a few messages. DNS defines protocols, as well as standards for the text names used throughout the world, and a worldwide set of distributed DNS servers. The domain names that people use every day when web browsing, which look like www.example.com, follow the DNS naming standards. Also, no single DNS server knows all the names and matching IP addresses, but the information is distributed across many DNS servers. So, the DNS servers of the world work together, forwarding queries to each other, +until the server that knows the answer supplies the desired IP address information. + +77 + + + + + + + + + +3 + + +The Address Resolution Protocol +As discussed in depth throughout this chapter, IP routing logic requires that hosts and rout-ers encapsulate IP packets inside data-link layer frames. For Ethernet interfaces, how does a router know what MAC address to use for the destination? It uses ARP. + +On Ethernet LANs, whenever a host or router needs to encapsulate an IP packet in a new Ethernet frame, the host or router knows all the important facts to build that header—except for the destination MAC address. The host knows the IP address of the next device, either another host IP address or the default router IP address. A router knows the IP route used for forwarding the IP packet, which lists the next router’s IP address. However, the hosts and routers do not know those neighboring devices’ MAC addresses beforehand. + +TCP/IP defines the Address Resolution Protocol (ARP) as the method by which any host or router on a LAN can dynamically learn the MAC address of another IP host or router on the same LAN. ARP defines a protocol that includes the ARP Request, which is a message that makes the simple request “if this is your IP address, please reply with your MAC address.” ARP also defines the ARP Reply message, which indeed lists both the original IP address and the matching MAC address. + +Figure 3-15 shows an example that uses the same router and host from the bottom part of the earlier Figure 3-13. The figure shows the ARP Request sent by router R3, on the left of the figure, as a LAN broadcast. All devices on the LAN will then process the received frame. On the right, at Step 2, host PC2 sends back an ARP Reply, identifying PC2’s MAC address. The text beside each message shows the contents inside the ARP message itself, which lets PC2 learn R3’s IP address and matching MAC address, and R3 learn PC2’s IP address and matching MAC address. + +Note that hosts and routers remember the ARP results, keeping the information in their ARP cache or ARP table. A host or router only needs to use ARP occasionally, to build the ARP cache the first time. Each time a host or router needs to send a packet encapsulated in an Ethernet frame, it first checks its ARP cache for the correct IP address and matching MAC address. Hosts and routers will let ARP cache entries time out to clean up the table, so occa-sional ARP Requests can be seen. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +78 CCNA 200-301 Official Cert Guide, Volume 1 + +Ethernet Broadcast +1 ARP Request R3 + + +Sender IP = R3’s IP Sender MAC = R3’s MAC Target IP = 150.150.4.10 Target MAC = ??? + +Target IP = R3’s IP Target Mac = R3’s MAC +Sender IP = 150.150.4.10 Sender MAC = 0200.2222.2222 + +ARP Reply 2 +PC2 Ethernet Unicast (to R3) + +150.150.4.10 0200.2222.2222 + +Figure 3-15 Sample ARP Process + + +NOTE You can see the contents of the ARP cache on most PC operating systems by using the arp -a command from a command prompt. + + +ICMP Echo and the ping Command +After you have implemented a TCP/IP internetwork, you need a way to test basic IP connec-tivity without relying on any applications to be working. The primary tool for testing basic network connectivity is the ping command. + +Ping (Packet Internet Groper) uses the Internet Control Message Protocol (ICMP), sending a message called an ICMP echo request to another IP address. The computer with that IP address should reply with an ICMP echo reply. If that works, you successfully have tested the IP network. In other words, you know that the network can deliver a packet from one host to the other and back. ICMP does not rely on any application, so it really just tests basic IP connectivity—Layers 1, 2, and 3 of the OSI model. Figure 3-16 outlines the basic process. + +Hannah Harold + +ping Harold + + + +Eth IP ICMP Echo Request + +Eth IP ICMP Echo Reply + +Figure 3-16 Sample Network, ping Command + +Note that while the ping command uses ICMP, ICMP does much more. ICMP defines many messages that devices can use to help manage and control the IP network. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 3: Fundamentals of WANs and IP Routing 79 + +Chapter Review + +The “Your Study Plan” element, just before Chapter 1, discusses how you should study and practice the content and skills for each chapter before moving on to the next chapter. That element introduces the tools used here at the end of each chapter. If you haven’t already done so, take a few minutes to read that section. Then come back here and do the useful work of reviewing the chapter to help lock into memory what you just read. + +Review this chapter’s material using either the tools in the book or interactive tools for the 3 +same material found on the book’s companion website. Table 3-4 outlines the key review ele-ments and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 3-4 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Review Date(s) Resource Used Book, website +Book, website + +Book, PTP + +Book, website + + + +Review All the Key Topics + +Table 3-5 Key Topics for Chapter 3 + +Key Topic Element +Figure 3-7 + +List + +Description Page Number +Ethernet over MPLS—physical connections 66 + +Four-step process of how routers route (forward) packets 70 + + +Figure 3-11 IP Routing and Encapsulation 71 + +List Two statements about how IP expects IP addresses to be grouped into 73 networks or subnets +List Three-step process of how routing protocols learn routes 74 + +Figure 3-13 IP Routing Protocol Basic Process 75 + +Figure 3-14 Example that shows the purpose and process of DNS name resolution 76 + +Figure 3-15 Example of the purpose and process of ARP 78 + + +Key Terms You Should Know +leased line, wide-area network (WAN), telco, serial interface, HDLC, Ethernet over MPLS, Ethernet Line Service (E-Line), default router (default gateway), routing table, IP network, IP subnet, IP packet, routing protocol, dotted-decimal notation (DDN), IPv4 address, unicast IP address, subnetting, hostname, DNS, ARP, ping + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part I Review + +Keep track of your part review progress with the checklist shown in Table P1-1. Details on each task follow the table. + +Table P1-1 Part I Review Checklist +Activity 1st Date Completed 2nd Date Completed +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + + +Repeat All DIKTA Questions +For this task, answer the “Do I Know This Already?” questions again for the chapters in this part of the book, using the PTP software. Refer to the Introduction to this book, the section titled “How to View Only DIKTA Questions by Chapter or Part,” for help with how to make the PTP software show you DIKTA questions for this part only. + +Answer Part Review Questions +For this task, answer the Part Review questions for this part of the book, using the PTP software. Refer to the Introduction to this book, the section titled “How to View Part Review Questions,” for help with how to make the PTP software show you Part Review questions for this part only. (Note that if you use the questions but then want even more, get the Premium Edition of the book, as detailed in the Introduction, in the section “Other Features,” under the item labeled “eBook.”) + +Review Key Topics +Browse back through the chapters and look for the Key Topic icons. If you do not remem-ber some details, take the time to reread those topics, or use the Key Topics application(s) found on the companion website. + +Use Per-Chapter Interactive Review Elements +Using the companion website, browse through the interactive review elements, like memo-ry tables and key term flashcards, to review the content from each chapter. + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +Part I provided a broad look at the fundamentals of all parts of networking, focusing on Ethernet LANs, WANs, and IP routing. Parts II and III now drill into depth about the details of Ethernet, which was introduced in Chapter 2, “Fundamentals of Ethernet LANs.” + +Part II begins that journey by discussing the basics of building a small Ethernet LAN with Cisco Catalyst switches. The journey begins by showing how to access the user interface of a Cisco switch so that you can see evidence of what the switch is doing and configure the switch to act in the ways you want it to act. At this point, you should start using whatever lab practice option you chose in the “Your Study Plan” section that preceded Chapter 1, “Introduction to TCP/IP Networking.” (And if you have not yet finalized your plan for how to practice your hands-on skills, now is the time.) + +After you complete Chapter 4 and see how to get into the command-line interface (CLI) of a switch, the next three chapters step through some important foundations of how to implement LANs—foundations used by every company that builds LANs with Cisco gear. +Chapter 5 takes a close look at Ethernet switching—that is, the logic used by a switch—and how to know what a particular switch is doing. Chapter 6 shows the ways to configure a switch for remote access with Telnet and Secure Shell (SSH), along with a variety of other useful commands that will help you when you work with any real lab gear, simulator, or any other practice tools. Chapter 7, the final chapter in Part II, shows how to configure and verify the operation of switch interfaces for several important features, including speed, duplex, and autonegotiation. + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part II + + +Implementing Ethernet LANs + + + + +Chapter 4: Using the Command-Line Interface + +Chapter 5: Analyzing Ethernet LAN Switching + +Chapter 6: Configuring Basic Switch Management + +Chapter 7: Configuring and Verifying Switch Interfaces + +Part II Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 4 + + +Using the Command-Line Interface This chapter covers the following exam topics: +None +This chapter explains foundational skills required before you can learn about the roughly 15 exam topics that use the verbs configure and verify. However, Cisco does not list the +foundational skills described in this chapter as a separate exam topic, so there are no specific exam topics included in this chapter. + +To create an Ethernet LAN, network engineers start by planning. They consider the require-ments, create a design, buy the switches, contract to install cables, and configure the switch-es to use the right features. + +The CCNA exam focuses on skills like understanding how LANs work, configuring different switch features, verifying that those features work correctly, and finding the root cause of the problem when a feature is not working correctly. The first skill you need to learn before doing all the configuration and verification tasks is to learn how to access and use the user interface of the switch, called the command-line interface (CLI). + +This chapter begins that process by showing the basics of how to access the switch’s CLI. These skills include how to access the CLI and how to issue verification commands to check on the status of the LAN. This chapter also includes the processes of how to configure the switch and how to save that configuration. + +Note that this chapter focuses on processes that provide a foundation for most every exam topic that includes the verbs configure and/or verify. Most of the rest of the chapters in Parts II and III of this book then go on to include details of the particular commands you can use to verify and configure different switch features. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 4-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Accessing the Cisco Catalyst Switch CLI + +Configuring Cisco IOS Software + +Questions 1–3 +4–6 + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. In what modes can you type the command show mac address-table and expect to get a response with MAC table entries? (Choose two answers.) +a. User mode b. Enable mode +c. Global configuration mode d. Interface configuration mode +2. In which of the following modes of the CLI could you type the command reload and expect the switch to reboot? +a. User mode b. Enable mode +c. Global configuration mode d. Interface configuration mode +3. Which of the following is a difference between Telnet and SSH as supported by a Cisco switch? +a. SSH encrypts the passwords used at login, but not other traffic; Telnet encrypts nothing. +b. SSH encrypts all data exchange, including login passwords; Telnet encrypts nothing. +c. Telnet is used from Microsoft operating systems, and SSH is used from UNIX and Linux operating systems. +d. Telnet encrypts only password exchanges; SSH encrypts all data exchanges. + +4. What type of switch memory is used to store the configuration used by the switch when it is up and working? +a. RAM b. ROM c. Flash +d. NVRAM e. Bubble +5. What command copies the configuration from RAM into NVRAM? a. copy running-config tftp +b. copy tftp running-config +c. copy running-config start-up-config d. copy start-up-config running-config e. copy startup-config running-config f. copy running-config startup-config + + +|||||||||||||||||||| +|||||||||||||||||||| + + +86 CCNA 200-301 Official Cert Guide, Volume 1 + +6. A switch user is currently in console line configuration mode. Which of the following would place the user in enable mode? (Choose two answers.) + +a. Using the exit command once b. Using the end command once +c. Pressing the Ctrl+Z key sequence once d. Using the quit command + +Foundation Topics + +Accessing the Cisco Catalyst Switch CLI +Cisco uses the concept of a command-line interface (CLI) with its router products and most of its Catalyst LAN switch products. The CLI is a text-based interface in which the user, typ-ically a network engineer, enters a text command and presses Enter. Pressing Enter sends the command to the switch, which tells the device to do something. The switch does what the command says, and in some cases, the switch replies with some messages stating the results of the command. + +Cisco Catalyst switches also support other methods to both monitor and configure a switch. For example, a switch can provide a web interface so that an engineer can open a web brows-er to connect to a web server running in the switch. Switches also can be controlled and operated using network management software. + +This book discusses only Cisco Catalyst enterprise-class switches, and in particular, how to use the Cisco CLI to monitor and control these switches. This first major section of the chapter first examines these Catalyst switches in more detail and then explains how a net-work engineer can get access to the CLI to issue commands. + +Cisco Catalyst Switches +Within the Cisco Catalyst brand of LAN switches, Cisco produces a wide variety of switch series or families. Each switch series includes several specific models of switches that have similar features, similar price-versus-performance tradeoffs, and similar internal components. + +For example, at the time this book was published, the Cisco 2960-XR series of switches was a current switch model series. Cisco positions the 2960-XR series (family) of switches as full-featured, low-cost wiring closet switches for enterprises. That means that you would expect to use 2960-XR switches as access switches in a typical campus LAN design. + +Figure 4-1 shows a photo of 10 different models from the 2960-XR switch model series from Cisco. Each switch series includes several models, with a mix of features. For example, some of the switches have 48 RJ-45 unshielded twisted-pair (UTP) 10/100/1000 ports, meaning that these ports can autonegotiate the use of 10BASE-T (10 Mbps), 100BASE-T (100 Mbps), or 1000BASE-T (1 Gbps) Ethernet. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 87 + + + + + +Figure 4-1 Cisco 2960-XR Catalyst Switch Series + +Cisco refers to a switch’s physical connectors as either interfaces or ports, with an interface type and interface number. The interface type, as used in commands on the switch, is either Ethernet, Fast Ethernet, Gigabit Ethernet, and so on for faster speeds. For Ethernet interfaces that support running at multiple speeds, the permanent name for the interface refers to the fastest supported speed. For example, a 10/100/1000 interface (that is, an interface that runs at 10 Mbps, 100 Mbps, or 1000 Mbps) would be called Gigabit Ethernet no matter what +speed is currently in use. 4 +To uniquely number each different interface, some Catalyst switches use a two-digit interface number (x/y), while others have a three-digit number (x/y/z). For instance, two 10/100/1000 ports on many older Cisco Catalyst switches would be called GigabitEthernet 0/0 and GigabitEthernet 0/1, while on the newer 2960-XR series, two interfaces would be GigabitEthernet 1/0/1 and GigabitEthernet 1/0/2. + +Accessing the Cisco IOS CLI +Like any other piece of computer hardware, Cisco switches need some kind of operating system software. Cisco calls this OS the Internetwork Operating System (IOS). + +Cisco IOS Software for Catalyst switches implements and controls logic and functions per-formed by a Cisco switch. Besides controlling the switch’s performance and behavior, Cisco IOS also defines an interface for humans called the CLI. The Cisco IOS CLI allows the user to use +a terminal emulation program, which accepts text entered by the user. When the user presses Enter, the terminal emulator sends that text to the switch. The switch processes the text as if it is a command, does what the command says, and sends text back to the terminal emulator. + +The switch CLI can be accessed through three popular methods—the console, Telnet, and Secure Shell (SSH). Two of these methods (Telnet and SSH) use the IP network in which the switch resides to reach the switch. The console is a physical port built specifically to allow access to the CLI. Figure 4-2 depicts the options. + +2960 Switch (Short) Console Cable Console + + + +Serial RJ-45 or USB or USB + +User Mode + + +Interface + + + + +TCP/IP Network + +Telnet and SSH + +Figure 4-2 CLI Access Options + + +|||||||||||||||||||| +|||||||||||||||||||| + + +88 CCNA 200-301 Official Cert Guide, Volume 1 + +Console access requires both a physical connection between a PC (or other user device) and the switch’s console port, as well as some software on the PC. Telnet and SSH require soft-ware on the user’s device, but they rely on the existing TCP/IP network to transmit data. The next few pages detail how to connect the console and set up the software for each method to access the CLI. + +Cabling the Console Connection +The physical console connection, both old and new, uses three main components: the physi-cal console port on the switch, a physical serial port on the PC, and a cable that works with the console and serial ports. However, the physical cabling details have changed slowly over time, mainly because of advances and changes with serial interfaces on PC hardware. For this next topic, the text looks at three cases: newer connectors on both the PC and the switch, older connectors on both, and a third case with the newer (USB) connector on the PC but with an older connector on the switch. + +Most PCs today use a familiar standard USB cable for the console connection. Cisco has been including USB ports as console ports in newer routers and switches as well. All you have to do is look at the switch to make sure you have the correct style of USB cable end to match the USB console port. In the simplest form, you can use any USB port on the PC, with a USB cable, connected to the USB console port on the switch or router, as shown on the far right side of Figure 4-3. +SW1 +SW2 +SW3 + + + + +SW1 +RJ-45 Console + +Rollover Cable + + + + +Serial Port + +SW2 +RJ-45 Console + +Rollover Cable + +USB Converter + +USB Cable + +USB Port + +SW3 +USB Console + + + + +USB Cable + +USB Port + + + +1 + +Figure 4-3 + +2 3 + +Console Connection to a Switch + + +Older console connections use a PC serial port that pre-dates USB, a UTP cable, and an +RJ-45 console port on the switch, as shown on the left side of Figure 4-3. The PC serial port typically has a D-shell connector (roughly rectangular) with nine pins (often called a DB-9). The console port looks like any Ethernet RJ-45 port (but is typically colored in blue and with the word console beside it on the switch). + +The cabling for this older-style console connection can be simple or require some effort, depending on what cable you use. You can use the purpose-built console cable that ships with new Cisco switches and routers and not think about the details. However, you can make + +Answers to the “Do I Know This Already?” quiz: 1 A, B 2 B 3 B 4 A 5 F 6 B, C + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 89 + +your own cable with a standard serial cable (with a connector that matches the PC), a stan-dard RJ-45 to DB-9 converter plug, and a UTP cable. However, the UTP cable does not use the same pinouts as Ethernet; instead, the cable uses rollover cable pinouts rather than any of the standard Ethernet cabling pinouts. The rollover pinout uses eight wires, rolling the wire at pin 1 to pin 8, pin 2 to pin 7, pin 3 to pin 6, and so on. + +As it turns out, USB ports became common on PCs before Cisco began commonly using USB for its console ports. So, you also have to be ready to use a PC that has only a USB port and not an old serial port, but a router or switch that has the older RJ-45 console port (and no USB console port). The center of Figure 4-3 shows that case. To connect such a PC to +a router or switch console, you need a USB converter that converts from the older console cable to a USB connector, and a rollover UTP cable, as shown in the middle of Figure 4-3. +4 +NOTE When using the USB options, you typically also need to install a software driver so that your PC’s OS knows that the device on the other end of the USB connection is the console of a Cisco device. Also, you can easily find photos of these cables and components online, with searches like “cisco console cable,” “cisco usb console cable,” or “console cable converter.” + +The 2960-XR series, for instance, supports both the older RJ-45 console port and a USB console port. Figure 4-4 points to the two console ports; you would use only one or the other. Note that the USB console port uses a mini-B port rather than the more commonly seen rectangular standard USB Type A port. + +USB Console (Mini-B) + + + + + + + + + + + + + + + +RJ-45 Console +Figure 4-4 A Part of a 2960-XR Switch with Console Ports Shown + +After the PC is physically connected to the console port, a terminal emulator software pack-age must be installed and configured on the PC. The terminal emulator software treats all data as text. It accepts the text typed by the user and sends it over the console connection to the switch. Similarly, any bits coming into the PC over the console connection are displayed as text for the user to read. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +90 CCNA 200-301 Official Cert Guide, Volume 1 + +The emulator must be configured to use the PC’s serial port to match the settings on the switch’s console port settings. The default console port settings on a switch are as follows. Note that the last three parameters are referred to collectively as 8N1: + +■ 9600 bits/second +■ No hardware flow control ■ 8-bit ASCII +■ No parity bits ■ 1 stop bit + +Figure 4-5 shows one such terminal emulator. The image shows the window created by the emulator software in the background, with some output of a show command. The fore-ground, in the upper right, shows a settings window that lists the default console settings as listed just before this paragraph. + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 4-5 Terminal Settings for Console Access + +Accessing the CLI with Telnet and SSH +For many years, terminal emulator applications have supported far more than the ability to communicate over a serial port to a local device (like a switch’s console). Terminal emulators support a variety of TCP/IP applications as well, including Telnet and SSH. Telnet and SSH both allow the user to connect to another device’s CLI, but instead of connecting through + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 91 + +a console cable to the console port, the traffic flows over the same IP network that the net-working devices are helping to create. + +Telnet uses the concept of a Telnet client (the terminal application) and a Telnet server (the switch in this case). A Telnet client, the device that sits in front of the user, accepts keyboard input and sends those commands to the Telnet server. The Telnet server accepts the text, interprets the text as a command, and replies back. + +Cisco Catalyst switches enable a Telnet server by default, but switches need a few more con-figuration settings before you can successfully use Telnet to connect to a switch. Chapter 6, “Configuring Basic Switch Management,” covers switch configuration to support Telnet and SSH in detail. +Using Telnet in a lab today makes sense, but Telnet poses a significant security risk in pro- 4 duction networks. Telnet sends all data (including any username and password for login to +the switch) as clear-text data. SSH gives us a much better option. + +Think of SSH as the much more secure Telnet cousin. Outwardly, you still open a terminal emulator, connect to the switch’s IP address, and see the switch CLI, no matter whether you use Telnet or SSH. The differences exist behind the scenes: SSH encrypts the contents of all messages, including the passwords, avoiding the possibility of someone capturing packets in the network and stealing the password to network devices. + +User and Enable (Privileged) Modes +All three CLI access methods covered so far (console, Telnet, and SSH) place the user in +an area of the CLI called user EXEC mode. User EXEC mode, sometimes also called user mode, allows the user to look around but not break anything. The “EXEC mode” part of the name refers to the fact that in this mode, when you enter a command, the switch executes the command and then displays messages that describe the command’s results. + +NOTE If you have not used the CLI before, you might want to experiment with the CLI from the Sim Lite product, or view the video about CLI basics. You can find these resources on the companion website as mentioned in the Introduction. + +Cisco IOS supports a more powerful EXEC mode called enable mode (also known as privi-leged mode or privileged EXEC mode). Enable mode gets its name from the enable com-mand, which moves the user from user mode to enable mode, as shown in Figure 4-6. The other name for this mode, privileged mode, refers to the fact that powerful (or privileged) commands can be executed there. For example, you can use the reload command, which tells the switch to reinitialize or reboot Cisco IOS, only from enable mode. + +NOTE If the command prompt lists the hostname followed by a >, the user is in user mode; if it is the hostname followed by the #, the user is in enable mode. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +92 CCNA 200-301 Official Cert Guide, Volume 1 + + + + + + + + + +Console + +Telnet User Mode + +SSH + +Enable (Command) + +Enable Mode (Privileged Mode) + +Disable (Command) + + +Figure 4-6 User and Privileged Modes + +Example 4-1 demonstrates the differences between user and enable modes. The example shows the output that you could see in a terminal emulator window, for instance, when con-necting from the console. In this case, the user sits at the user mode prompt (“Certskills1>”) and tries the reload command. The reload command tells the switch to reinitialize or reboot Cisco IOS, so IOS allows this powerful command to be used only from enable mode. IOS rejects the reload command when used in user mode. Then the user moves to enable mode— also called privileged mode—(using the enable EXEC command). At that point, IOS accepts the reload command now that the user is in enable mode. + +Example 4-1 Example of Privileged Mode Commands Being Rejected in User Mode + +Press RETURN to get started. + +User Access Verification + +Password: +Certskills1> +Certskills1> reload +Translating "reload" +% Unknown command or computer name, or unable to find computer address +Certskills1> enable +Password: +Certskills1# +Certskills1# reload + +Proceed with reload? [confirm] y +00:08:42: %SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command. + + + +NOTE The commands that can be used in either user (EXEC) mode or enable (EXEC) mode are called EXEC commands. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 93 + +This example is the first instance of this book showing you the output from the CLI, so it is worth noting a few conventions. The bold text represents what the user typed, and the non-bold text is what the switch sent back to the terminal emulator. Also, the typed passwords do not show up on the screen for security purposes. Finally, note that this switch has been preconfigured with a hostname of Certskills1, so the command prompt on the left shows that hostname on each line. + +Password Security for CLI Access from the Console +A Cisco switch, with default settings, remains relatively secure when locked inside a wir-ing closet, because by default, a switch allows console access only. By default, the console requires no password at all, and no password to reach enable mode for users that happened +to connect from the console. The reason is that if you have access to the physical console 4 port of the switch, you already have pretty much complete control over the switch. You +could literally get out your screwdriver and walk off with it, or you could unplug the power, or follow well-published procedures to go through password recovery to break into the CLI and then configure anything you want to configure. + +However, many people go ahead and set up simple password protection for console users. Simple passwords can be configured at two points in the login process from the console: when the user connects from the console, and when any user moves to enable mode (using the enable EXEC command). You may have noticed that back in Example 4-1, the user saw a password prompt at both points. + +Example 4-2 shows the additional configuration commands that were configured prior to collecting the output in Example 4-1. The output holds an excerpt from the EXEC command show running-config, which lists the current configuration in the switch. + +Example 4-2 Nondefault Basic Configuration + +Certskills1# show running-config +! Output has been formatted to show only the parts relevant to this discussion +hostname Certskills1 +! +enable secret love +! +line console 0 +login +password faith +! The rest of the output has been omitted +Certskills1# + + +Working from top to bottom, note that the first configuration command listed by the show running-config command sets the switch’s hostname to Certskills1. You might have noticed that the command prompts in Example 4-1 all began with Certskills1, and that’s why the command prompt begins with the hostname of the switch. + +Next, note that the lines with a ! in them are comment lines, both in the text of this book and in the real switch CLI. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +94 CCNA 200-301 Official Cert Guide, Volume 1 + +The enable secret love configuration command defines the password that all users must use to reach enable mode. So, no matter whether users connect from the console, Telnet, or SSH, they would use the password love when prompted for a password after typing the enable EXEC command. + +Finally, the last three lines configure the console password. The first line (line console 0) is the command that identifies the console, basically meaning “these next commands apply to the console only.” The login command tells IOS to perform simple password checking (at the console). Remember, by default, the switch does not ask for a password for console users. Finally, the password faith command defines the password the console user must type when prompted. + +This example just scratches the surface of the kinds of security configuration you might choose to configure on a switch, but it does give you enough detail to configure switches +in your lab and get started (which is the reason I put these details in this first chapter of Part II). Note that Chapter 6 shows the configuration steps to add support for Telnet and SSH (including password security), and Chapter 5 of the CCNA 200-301 Official Cert Guide, Volume 2, “Securing Network Devices,” shows additional security configuration as well. + +CLI Help Features +If you printed the Cisco IOS Command Reference documents, you would end up with a stack of paper several feet tall. No one should expect to memorize all the commands—and no one does. You can use several very easy, convenient tools to help remember commands and save time typing. As you progress through your Cisco certifications, the exams will cover progressively more commands. However, you should know the methods of getting command help. + +Table 4-2 summarizes command-recall help options available at the CLI. Note that, in the first column, command represents any command. Likewise, parm represents a command’s parameter. For example, the second row lists command ?, which means that commands such as show ? and copy ? would list help for the show and copy commands, respectively. + +Table 4-2 Cisco IOS Software Command Help + +What You Enter ? +command ? + +com? + +command parm? + +command parm + +command parm1 ? + +What Help You Get +Provides help for all commands available in this mode. + +With a space between the command and the ?, the switch lists text to describe all the first parameter options for the command. +Lists commands that start with com. + +Lists all parameters beginning with the parameter typed so far. (Notice that there is no space between parm and the ?.) +Pressing the Tab key causes IOS to spell out the rest of the word, assuming that you have typed enough of the word so there is only one option that begins with that string of characters. +If a space is inserted before the question mark, the CLI lists all the next parameters and gives a brief explanation of each. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 95 + +When you enter the ?, the Cisco IOS CLI reacts immediately; that is, you don’t need to press the Enter key or any other keys. The device running Cisco IOS also redisplays what you entered before the ? to save you some keystrokes. If you press Enter immediately after the ?, Cisco IOS tries to execute the command with only the parameters you have entered so far. + +The information supplied by using help depends on the CLI mode. For example, when ? is entered in user mode, the commands allowed in user mode are displayed, but com-mands available only in enable mode (not in user mode) are not displayed. Also, help is +available in configuration mode, which is the mode used to configure the switch. In fact, configuration mode has many different subconfiguration modes, as explained in the section “Configuration Submodes and Contexts,” later in this chapter. So, you can get help for the commands available in each configuration submode as well. (Note that this might be a good +time to use the free Sim Lite product on the companion website—open any lab, use the 4 question mark, and try some commands.) + +Cisco IOS stores the commands that you enter in a history buffer, storing ten commands by default. The CLI allows you to move backward and forward in the historical list of com- +mands and then edit the command before reissuing it. These key sequences can help you use the CLI more quickly on the exams. Table 4-3 lists the commands used to manipulate previ-ously entered commands. + +Table 4-3 Key Sequences for Command Edit and Recall + +Keyboard Command Up arrow or Ctrl+P + + +Down arrow or Ctrl+N + + +Left arrow or Ctrl+B + +Right arrow or Ctrl+F + +Backspace + +What Happens +This displays the most recently used command. If you press it again, the next most recent command appears, until the history buffer is exhausted. (The P stands for previous.) +If you have gone too far back into the history buffer, these keys take you forward to the more recently entered commands. (The N stands for next.) +This moves the cursor backward in the currently displayed command without deleting characters. (The B stands for back.) +This moves the cursor forward in the currently displayed command without deleting characters. (The F stands for forward.) +This moves the cursor backward in the currently displayed command, deleting characters. + + + +The debug and show Commands +By far, the single most popular Cisco IOS command is the show command. The show com-mand has a large variety of options, and with those options, you can find the status of almost every feature of Cisco IOS. Essentially, the show command lists the currently known facts about the switch’s operational status. The only work the switch does in reaction to show commands is to find the current status and list the information in messages sent to the user. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +96 CCNA 200-301 Official Cert Guide, Volume 1 + +For example, consider the output from the show mac address-table dynamic command listed in Example 4-3. This show command, issued from user mode, lists the table the switch uses to make forwarding decisions. A switch’s MAC address table basically lists the data a switch uses to do its primary job. + +Example 4-3 Nondefault Basic Configuration + +Certskills1> show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +31 0200.1111.1111 +31 0200.3333.3333 +31 1833.9d7b.0e9a +10 1833.9d7b.0e9a +10 30f7.0d29.8561 +1 1833.9d7b.0e9a +12 1833.9d7b.0e9a + +Type Ports +-------- ----- +DYNAMIC Gi0/1 +DYNAMIC Fa0/3 +DYNAMIC Gi0/1 +DYNAMIC Gi0/1 +DYNAMIC Gi0/1 +DYNAMIC Gi0/1 +DYNAMIC Gi0/1 + +Total Mac Addresses for this criterion: 7 +Certskills1> + + +The debug command also tells the user details about the operation of the switch. However, while the show command lists status information at one instant of time—more like a photo-graph—the debug command acts more like a live video camera feed. Once you issue a debug command, IOS remembers, issuing messages that any switch user can choose to see. The console sees these messages by default. Most of the commands used throughout this book to verify operation of switches and routers are show commands. + +Configuring Cisco IOS Software +You will want to configure every switch in an Enterprise network, even though the switches will forward traffic even with default configuration. This section covers the basic configu-ration processes, including the concept of a configuration file and the locations in which the configuration files can be stored. Although this section focuses on the configuration process, and not on the configuration commands themselves, you should know all the com-mands covered in this chapter for the exams, in addition to the configuration processes. + +Configuration mode is another mode for the Cisco CLI, similar to user mode and privileged mode. User mode lets you issue nondisruptive commands and displays some information. Privileged mode supports a superset of commands compared to user mode, including com-mands that might disrupt switch operations. However, not one of the commands in user or privileged mode changes the switch’s configuration. Configuration mode accepts configura-tion commands—commands that tell the switch the details of what to do and how to do +it. Figure 4-7 illustrates the relationships among configuration mode, user EXEC mode, and privileged EXEC mode. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 97 + +enable configure terminal + +User Mode Enable Mode Configuration Mode + +disable end or Ctl-Z + +Figure 4-7 CLI Configuration Mode Versus EXEC Modes + +Commands entered in configuration mode update the active configuration file. These chang-es to the configuration occur immediately each time you press the Enter key at the end of a command. Be careful when you enter a configuration command! + +Configuration Submodes and Contexts 4 Configuration mode itself contains a multitude of commands. To help organize the configu- +ration, IOS groups some kinds of configuration commands together. To do that, when using configuration mode, you move from the initial mode—global configuration mode—into subcommand modes. Context-setting commands move you from one configuration sub-command mode, or context, to another. These context-setting commands tell the switch the topic about which you will enter the next few configuration commands. More importantly, the context tells the switch the topic you care about right now, so when you use the ? to get help, the switch gives you help about that topic only. + +NOTE Context-setting is not a Cisco term. It is just a description used here to help make sense of configuration mode. + +The best way to learn about configuration submodes is to use them, but first, take a look at these upcoming examples. For instance, the interface command is one of the most com- +monly used context-setting configuration commands. For example, the CLI user could enter interface configuration mode by entering the interface FastEthernet 0/1 configuration com-mand. Asking for help in interface configuration mode displays only commands that are use-ful when configuring Ethernet interfaces. Commands used in this context are called subcom-mands—or, in this specific case, interface subcommands. When you begin practicing with the CLI with real equipment, the navigation between modes can become natural. For now, consider Example 4-4, which shows the following: + +■ Movement from enable mode to global configuration mode by using the configure terminal EXEC command +■ Using a hostname Fred global configuration command to configure the switch’s name +■ Movement from global configuration mode to console line configuration mode (using the line console 0 command) +■ Setting the console’s simple password to hope (using the password hope line subcommand) +■ Movement from console configuration mode to interface configuration mode (using the interface type number command) + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +98 CCNA 200-301 Official Cert Guide, Volume 1 + +■ Setting the speed to 100 Mbps for interface Fa0/1 (using the speed 100 interface subcommand) +■ Movement from interface configuration mode back to global configuration mode (using the exit command) + +Example 4-4 Navigating Between Different Configuration Modes + +Switch# configure terminal +Switch(config)# hostname Fred +Fred(config)# line console 0 +Fred(config-line)# password hope +Fred(config-line)# interface FastEthernet 0/1 +Fred(config-if)# speed 100 +Fred(config-if)# exit +Fred(config)# + + +The text inside parentheses in the command prompt identifies the configuration mode. For example, the first command prompt after you enter configuration mode lists (config), mean-ing global configuration mode. After the line console 0 command, the text expands to (con-fig-line), meaning line configuration mode. Each time the command prompt changes within config mode, you have moved to another configuration mode. + +Table 4-4 shows the most common command prompts in configuration mode, the names of those modes, and the context-setting commands used to reach those modes. + +Table 4-4 Common Switch Configuration Modes + +Prompt + +hostname(config)# + +hostname(config-line)# + + +hostname(config-if)# + +hostname(vlan)# + +Name of Mode + +Global + +Line + + +Interface + +VLAN + +Context-Setting Command(s) to Reach This Mode +None—first mode after configure terminal + +line console 0 + +line vty 0 15 + +interface type number + +vlan number + + + +You should practice until you become comfortable moving between the different configura-tion modes, back to enable mode, and then back into the configuration modes. However, you can learn these skills just doing labs about the topics in later chapters of the book. For now, Figure 4-8 shows most of the navigation between global configuration mode and the four configuration submodes listed in Table 4-4. + +NOTE You can also move directly from one configuration submode to another, without first using the exit command to move back to global configuration mode. Just use the com-mands listed in bold in the center of the figure. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 99 + + + +interface type/number +exit + +Interface Mode + + + +configure terminal + +Enable Mode + +End or Ctl-Z + + +vlan x +Global Config +Mode line console 0 + + +VLAN exit Mode + + +Console Line exit Mode + + + + +line vty 0 15 +exit + +VTY Line +Mode 4 + + + +End or Ctl-Z + +Figure 4-8 Navigation In and Out of Switch Configuration Modes + +You really should stop and try navigating around these configuration modes. If you have not yet decided on a lab strategy, install the Pearson Sim Lite software from the companion web-site. It includes the simulator and a couple of lab exercises. Start any lab, ignore the instruc-tions, and just get into configuration mode and move around between the configuration modes shown in Figure 4-8. + +No set rules exist for what commands are global commands or subcommands. Generally, however, when multiple instances of a parameter can be set in a single switch, the command used to set the parameter is likely a configuration subcommand. Items that are set once +for the entire switch are likely global commands. For example, the hostname command is a global command because there is only one hostname per switch. Conversely, the speed command is an interface subcommand that applies to each switch interface that can run at +different speeds, so it is a subcommand, applying to the particular interface under which it is configured. + +Storing Switch Configuration Files +When you configure a switch, it needs to use the configuration. It also needs to be able to retain the configuration in case the switch loses power. Cisco switches contain random- +access memory (RAM) to store data while Cisco IOS is using it, but RAM loses its contents when the switch loses power or is reloaded. To store information that must be retained when the switch loses power or is reloaded, Cisco switches use several types of more permanent memory, none of which has any moving parts. By avoiding components with moving parts (such as traditional disk drives), switches can maintain better uptime and availability. + +The following list details the four main types of memory found in Cisco switches, as well as the most common use of each type: + +■ RAM: Sometimes called DRAM, for dynamic random-access memory, RAM is used by the switch just as it is used by any other computer: for working storage. The running (active) configuration file is stored here. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +100 CCNA 200-301 Official Cert Guide, Volume 1 + +■ Flash memory: Either a chip inside the switch or a removable memory card, flash mem-ory stores fully functional Cisco IOS images and is the default location where the switch gets its Cisco IOS at boot time. Flash memory also can be used to store any other files, including backup copies of configuration files. +■ ROM: Read-only memory (ROM) stores a bootstrap (or boothelper) program that is load-ed when the switch first powers on. This bootstrap program then finds the full Cisco IOS image and manages the process of loading Cisco IOS into RAM, at which point Cisco IOS takes over operation of the switch. +■ NVRAM: Nonvolatile RAM (NVRAM) stores the initial or startup configuration file that is used when the switch is first powered on and when the switch is reloaded. + +Figure 4-9 summarizes this same information in a briefer and more convenient form for memorization and study. + + +RAM +(Working Memory and Running Configuration) + +Flash +(Cisco IOS Software) + +ROM +(Bootstrap Program) + +NVRAM +(Startup Configuration) + + +Figure 4-9 Cisco Switch Memory Types + +Cisco IOS stores the collection of configuration commands in a configuration file. In fact, switches use multiple configuration files—one file for the initial configuration used when powering on, and another configuration file for the active, currently used running configura-tion as stored in RAM. Table 4-5 lists the names of these two files, their purpose, and their storage location. + +Table 4-5 Names and Purposes of the Two Main Cisco IOS Configuration Files + +Configuration Filename +startup-config + +running-config + +Purpose + +Stores the initial configuration used anytime the switch reloads Cisco IOS. +Stores the currently used configuration commands. This file changes dynamically when someone enters commands in configuration mode. + +Where It Is Stored + +NVRAM + +RAM + + + +Essentially, when you use configuration mode, you change only the running-config file. This means that the configuration example earlier in this chapter (Example 4-4) updates only +the running-config file. However, if the switch lost power right after that example, all that configuration would be lost. If you want to keep that configuration, you have to copy the running-config file into NVRAM, overwriting the old startup-config file. + +Example 4-5 demonstrates that commands used in configuration mode change only the run-ning configuration in RAM. The example shows the following concepts and steps: +Step 1. The example begins with both the running and startup-config having the same hostname, per the hostname hannah command. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 101 + +Step 2. The hostname is changed in configuration mode using the hostname harold command. + +Step 3. The show running-config and show startup-config commands show the fact that the hostnames are now different, with the hostname harold command found only in the running-config. + + +Example 4-5 How Configuration Mode Commands Change the Running-Config File, Not the Startup-Config File + +! Step 1 next (two commands) +! +hannah# show running-config 4 ! (lines omitted) +hostname hannah +! (rest of lines omitted) + +hannah# show startup-config +! (lines omitted) +hostname hannah +! (rest of lines omitted) +! Step 2 next. Notice that the command prompt changes immediately after +! the hostname command. + +hannah# configure terminal +hannah(config)# hostname harold +harold(config)# exit +! Step 3 next (two commands) +! +harold# show running-config +! (lines omitted) - just showing the part with the hostname command +hostname harold +! +harold# show startup-config +! (lines omitted) - just showing the part with the hostname command +hostname hannah + + +Copying and Erasing Configuration Files +The configuration process updates the running-config file, which is lost if the router loses power or is reloaded. Clearly, IOS needs to provide us a way to copy the running +configuration so that it will not be lost, so it will be used the next time the switch reloads or powers on. For instance, Example 4-5 ended with a different running configuration (with the hostname harold command) versus the startup configuration. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +102 CCNA 200-301 Official Cert Guide, Volume 1 + +In short, the EXEC command copy running-config startup-config backs up the running-config to the startup-config file. This command overwrites the current startup-config file with what is currently in the running-configuration file. + +In addition, in the lab, you may want to just get rid of all existing configuration and start over with a clean configuration. To do that, you can erase the startup-config file using three different commands: + +write erase +erase startup-config +erase nvram: + +Once the startup-config file is erased, you can reload or power off/on the switch, and it will boot with the now-empty startup configuration. + +Note that Cisco IOS does not have a command that erases the contents of the running-config file. To clear out the running-config file, simply erase the startup-config file, and then reload the switch, and the running-config will be empty at the end of the process. + +NOTE Cisco uses the term reload to refer to what most PC operating systems call reboot-ing or restarting. In each case, it is a re-initialization of the software. The reload EXEC com-mand causes a switch to reload. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or on the book’s companion web-site. Refer to the “Your Study Plan” element section titled “Step 2: Build Your Study Habits Around the Chapter” for more details. Table 4-6 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 4-6 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Repeat DIKTA questions + +Review memory tables + +Review command tables + +Review Date(s) Resource Used Book, website +Book, website + +Book, PTP + +Book, website + +Book + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 4: Using the Command-Line Interface 103 + +Review All the Key Topics + +Table 4-7 Key Topics for Chapter 4 + +Key Topic Element +Figure 4-2 + +Figure 4-3 + +List + +Figure 4-7 + +Table 4-4 + +Figure 4-8 + +Table 4-5 + +Description Page Number +Three methods to access a switch CLI 87 + +Cabling options for a console connection 88 + +A Cisco switch’s default console port settings 90 + +Navigation between user, enable, and global config modes 97 + +A list of configuration mode prompts, the name of the 98 configuration mode, and the command used to reach each mode +Configuration mode context-setting commands 99 + +The names and purposes of the two configuration files in a 100 switch or router + + + + + + + + + +4 + + + +Key Terms You Should Know +command-line interface (CLI), Telnet, Secure Shell (SSH), enable mode, user mode, configu-ration mode, startup-config file, running-config file + +Command References +Tables 4-8 and 4-9 list configuration and verification commands used in this chapter, respec-tively. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right col-umn, and try to recall what the command does. + +Table 4-8 Chapter 4 Configuration Commands + +Command line console 0 + +login + +password pass-value + + +interface type port-number + +hostname name + +exit + +Mode and Purpose +Global command that changes the context to console configuration mode. +Line (console and vty) configuration mode. Tells IOS to prompt for a password (no username). +Line (console and vty) configuration mode. Sets the password required on that line for login if the login command (with no other parameters) is also configured. +Global command that changes the context to interface mode— for example, interface FastEthernet 0/1. +Global command that sets this switch’s hostname, which is also used as the first part of the switch’s command prompt. +Moves back to the next higher mode in configuration mode. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +104 CCNA 200-301 Official Cert Guide, Volume 1 + + +Command end + +Ctrl+Z + +Mode and Purpose +Exits configuration mode and goes back to enable mode from any of the configuration submodes. +This is not a command, but rather a two-key combination (pressing the Ctrl key and the letter Z) that together do the same thing as the end command. + + + +Table 4-9 Chapter 4 EXEC Command Reference + +Command no debug all +undebug all + +reload + +Purpose +Enable mode EXEC command to disable all currently enabled debugs. + + +Enable mode EXEC command that reboots the switch or router. + + +copy running-config Enable mode EXEC command that saves the active config, replacing startup-config the startup-config file used when the switch initializes. + +copy startup-config running-config + +Enable mode EXEC command that merges the startup-config file with the currently active config file in RAM. + +show running-config Lists the contents of the running-config file. + +write erase These enable mode EXEC commands erase the startup-config file. + +erase startup-config + + +erase nvram: + +quit + +show startup-config + +enable + +disable + +configure terminal + + +EXEC command that disconnects the user from the CLI session. + +Lists the contents of the startup-config (initial config) file. + +Moves the user from user mode to enable (privileged) mode and prompts for a password if one is configured. +Moves the user from enable mode to user mode. + +Enable mode command that moves the user into configuration mode. + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 5 + + +Analyzing Ethernet LAN Switching This chapter covers the following exam topics: +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.b L2 and L3 Switches + +1.13 Describe switching concepts + +1.13.a MAC learning and aging + +1.13.b Frame switching + +1.13.c Frame flooding + +1.13.d MAC address table + +2.0 Network Access +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree Protocol and identify basic operations + +When you buy a Cisco Catalyst Ethernet switch, the switch is ready to work. All you have to do is take it out of the box, power on the switch by connecting the power cable to the switch and a power outlet, and connect hosts to the switch using the correct unshielded +twisted-pair (UTP) cables. You do not have to configure anything else, or connect to the con-sole and login, or do anything: the switch just starts forwarding Ethernet frames. + +In Part II of this book, you will learn how to build, configure, and verify the operation of Ethernet LANs. In Chapter 4, “Using the Command-Line Interface,” you learned how to move around in the CLI, issue commands, and configure the switch. This chapter takes a short but important step in that journey by explaining the logic a switch uses when forward-ing Ethernet frames. + +This chapter breaks the content into two major sections. The first reviews and then further develops the concepts behind LAN switching, which were first introduced back in Chapter 2, “Fundamentals of Ethernet LANs.” The second section then uses IOS show commands to verify that Cisco switches actually learned the MAC addresses, built the MAC address table, and forwarded frames. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + +Table 5-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section LAN Switching Concepts +Verifying and Analyzing Ethernet Switching + +Questions 1–4 +5–6 + + + +1. Which of the following statements describes part of the process of how a switch decides to forward a frame destined for a known unicast MAC address? +a. It compares the unicast destination address to the bridging, or MAC address, table. b. It compares the unicast source address to the bridging, or MAC address, table. +c. It forwards the frame out all interfaces in the same VLAN except for the incoming interface. +d. It compares the destination IP address to the destination MAC address. +e. It compares the frame’s incoming interface to the source MAC entry in the MAC address table. + +2. Which of the following statements describes part of the process of how a LAN switch decides to forward a frame destined for a broadcast MAC address? +a. It compares the unicast destination address to the bridging, or MAC address, table. b. It compares the unicast source address to the bridging, or MAC address, table. +c. It forwards the frame out all interfaces in the same VLAN except for the incoming interface. +d. It compares the destination IP address to the destination MAC address. +e. It compares the frame’s incoming interface to the source MAC entry in the MAC address table. + +3. Which of the following statements best describes what a switch does with a frame destined for an unknown unicast address? +a. It forwards out all interfaces in the same VLAN except for the incoming interface. +b. It forwards the frame out the one interface identified by the matching entry in the MAC address table. +c. It compares the destination IP address to the destination MAC address. +d. It compares the frame’s incoming interface to the source MAC entry in the MAC address table. + +4. Which of the following comparisons does a switch make when deciding whether a new MAC address should be added to its MAC address table? +a. It compares the unicast destination address to the bridging, or MAC address, table. b. It compares the unicast source address to the bridging, or MAC address, table. +c. It compares the VLAN ID to the bridging, or MAC address, table. +d. It compares the destination IP address’s ARP cache entry to the bridging, or MAC address, table. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +108 CCNA 200-301 Official Cert Guide, Volume 1 + +5. A Cisco Catalyst switch has 24 10/100 ports, numbered 0/1 through 0/24. Ten PCs connect to the 10 lowest numbered ports, with those PCs working and sending data over the network. The other ports are not connected to any device. Which of the fol-lowing answers lists facts displayed by the show interfaces status command? +a. Port Ethernet 0/1 is in a connected state. +b. Port Fast Ethernet 0/11 is in a connected state. c. Port Fast Ethernet 0/5 is in a connected state. d. Port Ethernet 0/15 is in a notconnected state. +6. Consider the following output from a Cisco Catalyst switch: SW1# show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 02AA.AAAA.AAAA +1 02BB.BBBB.BBBB +1 02CC.CCCC.CCCC + +Type Ports +-------- ----- +DYNAMIC Gi0/1 +DYNAMIC Gi0/2 +DYNAMIC Gi0/3 + +Total Mac Addresses for this criterion: 3 + +Which of the following answers is true about this switch? +a. The output proves that port Gi0/2 connects directly to a device that uses address 02BB.BBBB.BBBB. +b. The switch has learned three MAC addresses since the switch powered on. +c. The three listed MAC addresses were learned based on the destination MAC address of frames forwarded by the switch. +d. 02CC.CCCC.CCCC was learned from the source MAC address of a frame that entered port Gi0/3. + +Foundation Topics + +LAN Switching Concepts +A modern Ethernet LAN connects user devices as well as servers into some switches, with the switches then connecting to each other, sometimes in a design like Figure 5-1. Part of the LAN, called a campus LAN, supports the end-user population as shown on the left of the figure. End-user devices connect to LAN switches, which in turn connect to other switches so that a path exists to the rest of the network. The campus LAN switches sit in wiring clos-ets close to the end users. On the right, the servers used to provide information to the users also connect to the LAN. Those servers and switches often sit in a closed room called a data center, with connections to the campus LAN to support traffic to/from the users. + +To forward traffic from a user device to a server and back, each switch performs the same kind of logic, independently from each other. The first half of this chapter examines the logic: how a switch chooses to forward an Ethernet frame, when the switch chooses to not forward the frame, and so on. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 109 + + + + + + + + + + + + + + + + +5 + + + + + +Campus LAN Data Center LAN + +Figure 5-1 Campus LAN and Data Center LAN, Conceptual Drawing + +Overview of Switching Logic +Ultimately, the role of a LAN switch is to forward Ethernet frames. LANs exist as a set of user devices, servers, and other devices that connect to switches, with the switches con-nected to each other. The LAN switch has one primary job: to forward frames to the correct destination (MAC) address. And to achieve that goal, switches use logic—logic based on the source and destination MAC address in each frame’s Ethernet header. + +LAN switches receive Ethernet frames and then make a switching decision: either forward the frame out some other ports or ignore the frame. To accomplish this primary mission, switches perform three actions: +1. Deciding when to forward a frame or when to filter (not forward) a frame, based on the destination MAC address +2. Preparing to forward frames by learning MAC addresses by examining the source MAC address of each frame received by the switch +3. Preparing to forward only one copy of the frame to the destination by creating a (Layer 2) loop-free environment with other switches by using Spanning Tree Protocol (STP) + +The first action is the switch’s primary job, whereas the other two items are overhead functions. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +110 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE Throughout this book’s discussion of LAN switches, the terms switch port and switch interface are synonymous. + +Although Chapter 2’s section titled “Ethernet Data-Link Protocols” already discussed the frame format, this discussion of Ethernet switching is pretty important, so reviewing the Ethernet frame at this point might be helpful. Figure 5-2 shows one popular format for an Ethernet frame. Basically, a switch would take the frame shown in the figure, make a decision of where to forward the frame, and send the frame out that other interface. + +Header Trailer + +Preamble SFD Destination Source Type Data and Pad FCS 7 1 6 6 2 46–1500 4 + + +Figure 5-2 IEEE 802.3 Ethernet Frame (One Variation) + +Most of the upcoming discussions and figures about Ethernet switching focus on the use of the destination and source MAC address fields in the header. All Ethernet frames have both a destination and source MAC address. Both are 6-bytes long (represented as 12 hex digits in the book) and are a key part of the switching logic discussed in this section. Refer back to Chapter 2’s discussion of the header in detail for more info on the rest of the Ethernet frame. + +NOTE The companion website includes a video that explains the basics of Ethernet switching. + +Now on to the details of how Ethernet switching works! + +Forwarding Known Unicast Frames +To decide whether to forward a frame, a switch uses a dynamically built table that lists MAC addresses and outgoing interfaces. Switches compare the frame’s destination MAC address to this table to decide whether the switch should forward a frame or simply ignore it. For exam-ple, consider the simple network shown in Figure 5-3, with Fred sending a frame to Barney. + +In this figure, Fred sends a frame with destination address 0200.2222.2222 (Barney’s MAC address). The switch compares the destination MAC address (0200.2222.2222) to the MAC address table, matching the bold table entry. That matched table entry tells the switch to for-ward the frame out port F0/2, and only port F0/2. + + + + + + +Answers to the “Do I Know This Already?” quiz: 1 A 2 C 3 A 4 B 5 C 6 D + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 111 + + +NOTE A switch’s MAC address table is also called the switching table, or bridging table, or even the Content-Addressable Memory (CAM) table, in reference to the type of physi-cal memory used to store the table. + + + + + + + +Fred + +Dest 0200.2222.2222 + +1) Frame Came in F0/1, +2) Destined for 0200.2222.2222… 3) Forward Out F0/2 +4) Filter (Do Not Send) on F0/3, F0/4 + + +1 + + + + +Wilma 0200.3333.3333 + + +F0/1 F0/3 4 +F0/2 F0/4 5 + + +Barney 0200.2222.2222 + +3 +MAC Address Table +MAC Address Output +0200.1111.1111 F0/1 0200.2222.22222 F0/2 0200.3333.3333 F0/3 0200.4444.4444 F0/4 + + +Betty 0200.4444.4444 + + +Figure 5-3 Sample Switch Forwarding and Filtering Decision + +A switch’s MAC address table lists the location of each MAC relative to that one switch. In LANs with multiple switches, each switch makes an independent forwarding decision based on its own MAC address table. Together, they forward the frame so that it eventually arrives at the destination. + +For example, Figure 5-4 shows the first switching decision in a case in which Fred sends a frame to Wilma, with destination MAC 0200.3333.3333. The topology has changed versus the previous figure, this time with two switches, and Fred and Wilma connected to two different switches. Figure 5-3 shows the first switch’s logic, in reaction to Fred sending the original frame. Basically, the switch receives the frame in port F0/1, finds the destination MAC (0200.3333.3333) in the MAC address table, sees the outgoing port of G0/1, so SW1 forwards the frame out its G0/1 port. + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +112 CCNA 200-301 Official Cert Guide, Volume 1 + + +1) Frame Entered F0/1... +2) Destined for 0200.3333.3333… 3) MAC table entry lists G0/1… +4) Forward out G0/1 + + + +Fred 1 +Dest 0200.2222.2222 + +Wilma 0200.3333.3333 + + +F0/1 F0/3 +SW1 G0/1 G0/2 SW2 +F0/2 F0/4 + + +Barney 0200.2222.2222 + +Betty 0200.4444.4444 + + + +SW1 Address Table +MAC Address Output +0200.1111.1111 F0/1 0200.2222.2222 F0/2 0200.3333.3333 2 G0/1 3 0200.4444.4444 G0/1 + +SW2 Address Table +MAC Address Output +0200.1111.1111 G0/2 0200.2222.2222 G0/2 0200.3333.3333 F0/3 0200.4444.4444 F0/4 + + +Figure 5-4 Forwarding Decision with Two Switches: First Switch + +That same frame next arrives at switch SW2, entering SW2’s G0/2 interface. As shown in Figure 5-5, SW2 uses the same logic steps, but using SW2’s table. The MAC table lists the forwarding instructions for that switch only. In this case, switch SW2 forwards the frame out its F0/3 port, based on SW2’s MAC address table. + +1) Frame Entered G0/2... +2) Destined for 0200.3333.3333… 3) MAC table entry lists F0/3… +4) Forward out F0/3 + + + +Fred +Dest 0200.3333.3333 + +F0/1 + +Wilma 0200.3333.3333 +4 1 +F0/3 + +SW1 G0/1 G0/2 SW2 +F0/2 F0/4 + + +Barney 0200.2222.2222 + +Betty 0200.4444.4444 + + + +SW1 Address Table +MAC Address Output +0200.1111.1111 F0/1 0200.2222.2222 F0/2 0200.3333.3333 G0/1 0200.4444.4444 G0/1 + +SW2 Address Table +MAC Address Output +0200.1111.1111 G0/2 0200.2222.2222 G0/2 0200.3333.3333 2 F0/3 3 0200.4444.4444 F0/4 + + +Figure 5-5 Forwarding Decision with Two Switches: Second Switch + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 113 + + +NOTE The forwarding choice by a switch was formerly called a forward-versus-filter decision, because the switch also chooses to not forward (to filter) frames, not sending the frame out some ports. + +The examples so far use switches that happen to have a MAC table with all the MAC addresses listed. As a result, the destination MAC address in the frame is known to the switch. The frames are called known unicast frames, or simply known unicasts, because the destination address is a unicast address, and the destination is known. As shown in these examples, switches forward known unicast frames out one port: the port as listed in the MAC table entry for that MAC address. + + +Learning MAC Addresses +Thankfully, the networking staff does not have to type in all those MAC table entries. Instead, each switch does its second main function: to learn the MAC addresses and inter-faces to put into its address table. With a complete MAC address table, the switch can make accurate forwarding and filtering decisions as just discussed. + +Switches build the address table by listening to incoming frames and examining the source MAC address in the frame. If a frame enters the switch and the source MAC address is not in the MAC address table, the switch creates an entry in the table. That table entry lists the interface from which the frame arrived. Switch learning logic is that simple. + +Figure 5-6 depicts the same single-switch topology network as Figure 5-3, but before the switch has built any address table entries. The figure shows the first two frames sent in this network—first a frame from Fred, addressed to Barney, and then Barney’s response, +addressed to Fred. + + + + +5 + + +Address Table: Before Either Frame Is Sent Address: Output + +Fred 0200.1111.1111 +1 + + +Wilma 0200.3333.3333 + +(Empty) (Empty) + +1 +Address Table: After Frame 1 (Fred to Barney) + + + +F0/1 F0/3 + + +F0/2 F0/4 + +Address: Output 0200.1111.1111 F0/1 + +2 + +Address Table: After Frame 2 (Barney to Fred) + + +Barney 2 +0200.2222.2222 + + +Betty 0200.4444.4444 + +Address: Output +0200.1111.1111 F0/1 0200.2222.2222 F0/2 + + +Figure 5-6 Switch Learning: Empty Table and Adding Two Entries + +(Figure 5-6 depicts the MAC learning process only, and ignores the forwarding process and therefore ignores the destination MAC addresses.) + +Focus on the learning process and how the MAC table grows at each step as shown on the right side of the figure. The switch begins with an empty MAC table, as shown in the upper-right part of the figure. Then Fred sends his first frame (labeled “1”) to Barney, so the switch + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +114 CCNA 200-301 Official Cert Guide, Volume 1 + +adds an entry for 0200.1111.1111, Fred’s MAC address, associated with interface F0/1. Why F0/1? The frame sent by Fred entered the switch’s F0/1 port. SW1’s logic runs something like this: “The source is MAC 0200.1111.1111, the frame entered F0/1, so from my perspective, 0200.1111.1111 must be reachable out my port F0/1.” + +Continuing the example, when Barney replies in Step 2, the switch adds a second entry, this one for 0200.2222.2222, Barney’s MAC address, along with interface F0/2. Why F0/2? The frame Barney sent entered the switch’s F0/2 interface. Learning always occurs by looking at the source MAC address in the frame and adds the incoming interface as the associated port. + +Flooding Unknown Unicast and Broadcast Frames +Now again turn your attention to the forwarding process, using the topology in Figure 5-5. What do you suppose the switch does with Fred’s first frame, the one that occurred when there were no entries in the MAC address table? As it turns out, when there is no matching entry in the table, switches forward the frame out all interfaces (except the incoming inter-face) using a process called flooding. And the frame whose destination address is unknown to the switch is called an unknown unicast frame, or simply an unknown unicast. + +Switches flood unknown unicast frames. Flooding means that the switch forwards copies of the frame out all ports, except the port on which the frame was received. The idea is simple: if you do not know where to send it, send it everywhere, to deliver the frame. And, by the way, that device will likely then send a reply—and then the switch can learn that device’s MAC address and forward future frames out one port as a known unicast frame. + +Switches also flood LAN broadcast frames (frames destined to the Ethernet broadcast address of FFFF.FFFF.FFFF) because this process helps deliver a copy of the frame to all devices in the LAN. + +For example, Figure 5-7 shows the same first frame sent by Fred, when the switch’s MAC table is empty. At step 1, Fred sends the frame. At step 2, the switch sends a copy of the frame out all three of the other interfaces. + + +Fred +0200.1111.1111 1 + +F0/1 + + +F0/2 + + +Wilma 2 0200.3333.3333 + +F0/3 + + +F0/4 + + +Address Table: Before Frame Is Sent Address: Output +(Empty) (Empty) + + + +2 Barney +0200.2222.2222 + +2 +Betty 0200.4444.4444 + + +Figure 5-7 Switch Flooding: Unknown Unicast Arrives, Floods Out Other Ports + +Avoiding Loops Using Spanning Tree Protocol +The third primary feature of LAN switches is loop prevention, as implemented by Spanning Tree Protocol (STP). Without STP, any flooded frames would loop for an indefinite period of + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 115 + +time in Ethernet networks with physically redundant links. To prevent looping frames, STP blocks some ports from forwarding frames so that only one active path exists between any pair of LAN segments. + +The result of STP is good: frames do not loop infinitely, which makes the LAN usable. However, STP has negative features as well, including the fact that it takes some work to bal-ance traffic across the redundant alternate links. + +A simple example makes the need for STP more obvious. Remember, switches flood unknown unicast frames and broadcast frames. Figure 5-8 shows an unknown unicast frame, sent by Larry to Bob, which loops forever because the network has redundancy but no STP. Note that the figure shows one direction of the looping frame only, just to reduce clutter, but a copy of the frame would also loop the other direction. + +Archie + +Bob 5 + + +Larry +Powered Off! + +Frame Starts Here +Figure 5-8 Network with Redundant Links but Without STP: The Frame Loops Forever + +The flooding of this frame would result in the frame repeatedly rotating around the three switches, because none of the switches list Bob’s MAC address in their address tables—so each switch floods the frame. And while the flooding process is a good mechanism for for-warding unknown unicasts and broadcasts, the continual flooding of traffic frames as in the figure can completely congest the LAN to the point of making it unusable. + +A topology like Figure 5-8, with redundant links, is good, but we need to prevent the bad effect of those looping frames. To avoid Layer 2 loops, all switches need to use STP. STP causes each interface on a switch to settle into either a blocking state or a forwarding state. Blocking means that the interface cannot forward or receive data frames, while forwarding means that the interface can send and receive data frames. If a correct subset of the inter-faces is blocked, only a single currently active logical path exists between each pair of LANs. + +NOTE STP behaves identically for a transparent bridge and a switch. Therefore, the terms bridge, switch, and bridging device all are used interchangeably when discussing STP. + +Chapter 9 of this book, “Spanning Tree Protocol Concepts,” examines STP in depth, includ-ing how STP prevents loops. + +LAN Switching Summary +Switches use Layer 2 logic, examining the Ethernet data-link header to choose how to pro-cess frames. In particular, switches make decisions to forward and filter frames, learn MAC addresses, and use STP to avoid loops, as follows: + + +|||||||||||||||||||| +|||||||||||||||||||| + + +116 CCNA 200-301 Official Cert Guide, Volume 1 + +Step 1. Switches forward frames based on the destination MAC address: + +A. If the destination MAC address is a broadcast, multicast, or unknown desti-nation unicast (a unicast not listed in the MAC table), the switch floods the frame. +B. If the destination MAC address is a known unicast address (a unicast address found in the MAC table): + +i. If the outgoing interface listed in the MAC address table is different from the interface in which the frame was received, the switch forwards the frame out the outgoing interface. +ii. If the outgoing interface is the same as the interface in which the frame was received, the switch filters the frame, meaning that the switch sim-ply ignores the frame and does not forward it. +Step 2. Switches use the following logic to learn MAC address table entries: + +A. For each received frame, examine the source MAC address and note the interface from which the frame was received. + +B. If it is not already in the table, add the MAC address and interface it was learned on. + +Step 3. Switches use STP to prevent loops by causing some interfaces to block, mean-ing that they do not send or receive frames. + + +Verifying and Analyzing Ethernet Switching +A Cisco Catalyst switch comes from the factory ready to switch frames. All you have to do is connect the power cable, plug in the Ethernet cables, and the switch starts switching +incoming frames. Connect multiple switches together, and they are ready to forward frames between the switches as well. And the big reason behind this default behavior has to do with the default settings on the switches. + +Cisco Catalyst switches come ready to get busy switching frames because of settings like these: + +■ The interfaces are enabled by default, ready to start working once a cable is connected. ■ All interfaces are assigned to VLAN 1. +■ 10/100 and 10/100/1000 interfaces use autonegotiation by default. ■ The MAC learning, forwarding, flooding logic all works by default. ■ STP is enabled by default. + +This second section of the chapter examines how switches will work with these default set-tings, showing how to verify the Ethernet learning and forwarding process. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 117 + +Demonstrating MAC Learning +To see a switch’s MAC address table, use the show mac address-table command. With no additional parameters, this command lists all known MAC addresses in the MAC table, including some overhead static MAC addresses that you can ignore. To see all the +dynamically learned MAC addresses only, instead use the show mac address-table dynamic command. + +The examples in this chapter use almost no configuration, as if you just unboxed the switch when you first purchased it. For the examples, the switches have no configuration other than the hostname command to set a meaningful hostname. Note that to do this in lab, all I did was + +■ Use the erase startup-config EXEC command to erase the startup-config file +■ Use the delete vlan.dat EXEC command to delete the VLAN configuration details +■ Use the reload EXEC command to reload the switch (thereby using the empty startup- +config, with no VLAN information configured) 5 +■ Configure the hostname SW1 command to set the switch hostname + +Once done, the switch starts forwarding and learning MAC addresses, as demonstrated in Example 5-1. + +Example 5-1 show mac address-table dynamic for Figure 5-7 + +SW1# show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.1111.1111 +1 0200.2222.2222 +1 0200.3333.3333 +1 0200.4444.4444 + +Type Ports +-------- ----- +DYNAMIC Fa0/1 +DYNAMIC Fa0/2 +DYNAMIC Fa0/3 +DYNAMIC Fa0/4 + +Total Mac Addresses for this criterion: 4 +SW1# + + +First, focus on two columns of the table: the MAC Address and Ports columns of the table. The values should look familiar: they match the earlier single-switch example, as repeated here as Figure 5-9. Note the four MAC addresses listed, along with their matching ports, as shown in the figure. + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +118 CCNA 200-301 Official Cert Guide, Volume 1 + + +Fred 0200.1111.1111 + +F0/1 + + +F0/2 + + +Barney +0200.2222.2222 + + +Wilma 0200.3333.3333 + +F0/3 + + +F0/4 + + +Betty 0200.4444.4444 + + +Figure 5-9 Single Switch Topology Used in Verification Section + +Next, look at the Type field in the heading of the output table. The column tells us how the switch learned the MAC address as described earlier in this chapter; in this case, the switch learned all MAC addresses dynamically. You can also statically predefine MAC table entries using a couple of different features, including port security, and those would appear as Static in the Type column. + +Finally, the VLAN column of the output gives us a chance to briefly discuss how VLANs impact switching logic. LAN switches forward Ethernet frames inside a VLAN. What that means is if a frame enters via a port in VLAN 1, then the switch will forward or flood that frame out other ports in VLAN 1 only, and not out any ports that happen to be assigned to another VLAN. Chapter 8, “Implementing Ethernet Virtual LANs,” looks at all the details of how switches forward frames when using VLANs. + +Switch Interfaces +The first example assumes that you installed the switch and cabling correctly, and that the switch interfaces work. Once you do the installation and connect to the Console, you can easily check the status of those interfaces with the show interfaces status command, as shown in Example 5-2. + +Example 5-2 show interfaces status on Switch SW1 + +SW1# show interfaces status + + +Port Name +Fa0/1 +Fa0/2 +Fa0/3 +Fa0/4 +Fa0/5 +Fa0/6 +Fa0/7 +Fa0/8 +Fa0/9 +Fa0/10 +Fa0/11 + +Status Vlan +connected 1 +connected 1 +connected 1 +connected 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 + +Duplex Speed Type +a-full a-100 10/100BaseTX +a-full a-100 10/100BaseTX +a-full a-100 10/100BaseTX +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 119 + + +Fa0/12 notconnect 1 +Fa0/13 notconnect 1 +Fa0/14 notconnect 1 +Fa0/15 notconnect 1 +Fa0/16 notconnect 1 +Fa0/17 notconnect 1 +Fa0/18 notconnect 1 +Fa0/19 notconnect 1 +Fa0/20 notconnect 1 +Fa0/21 notconnect 1 +Fa0/22 notconnect 1 +Fa0/23 notconnect 1 +Fa0/24 notconnect 1 +Gi0/1 notconnect 1 +Gi0/2 notconnect 1 +SW1# + +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100/1000BaseTX +auto auto 10/100/1000BaseTX +5 + + + +Focus on the port column for a moment. As a reminder, Cisco Catalyst switches name their ports based on the fastest specification supported, so in this case, the switch has 24 interfac-es named FastEthernet, and two named GigabitEthernet. Many commands abbreviate those terms, this time as Fa for FastEthernet and Gi for GigabitEthernet. (The example happens to come from a Cisco Catalyst switch that has 24 10/100 ports and two 10/100/1000 ports.) + +The Status column, of course, tells us the status or state of the port. In this case, the lab switch had cables and devices connected to ports F0/1–F0/4 only, with no other cables con-nected. As a result, those first four ports have a state of connected, meaning that the ports have a cable and are functional. The notconnect state means that the port is not yet function-ing. It may mean that there is no cable installed, but other problems may exist as well. (The section “Analyzing Switch Interface Status and Statistics,” in Chapter 7, “Configuring and Verifying Switch Interfaces,” works through the details of what causes a switch interface to fail.) + +NOTE You can see the status for a single interface in a couple of ways. For instance, for F0/1, the command show interfaces f0/1 status lists the status in a single line of output as in Example 5-2. The show interfaces f0/1 command (without the status keyword) displays a detailed set of messages about the interface. + +The show interfaces command has a large number of options. One particular option, the counters option, lists statistics about incoming and outgoing frames on the interfaces. In particular, it lists the number of unicast, multicast, and broadcast frames (both the in and out directions), and a total byte count for those frames. Example 5-3 shows an example, again for interface F0/1. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +120 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 5-3 show interfaces f0/1 counters on Switch SW1 + +SW1# show interfaces f0/1 counters + + +Port InOctets +Fa0/1 1223303 + +Port OutOctets +Fa0/1 3235055 + +InUcastPkts +10264 + +OutUcastPkts +13886 + +InMcastPkts +107 + +OutMcastPkts +22940 + +InBcastPkts +18 + +OutBcastPkts +437 + + + +Finding Entries in the MAC Address Table +With a single switch and only four hosts connected to it, you can just read the details of the MAC address table and find the information you want to see. However, in real networks, with lots of interconnected hosts and switches, just reading the output to find one MAC address can be hard to do. You might have hundreds of entries—page after page of output— with each MAC address looking like a random string of hex characters. (The book uses easy-to-recognize MAC addresses to make it easier to learn.) + +Thankfully, Cisco IOS supplies several more options on the show mac address-table com-mand to make it easier to find individual entries. First, if you know the MAC address, you can search for it—just type in the MAC address at the end of the command, as shown in Example 5-4. All you have to do is include the address keyword, followed by the actual MAC address. If the address exists, the output lists the address. Note that the output lists the exact same information in the exact same format, but it lists only the line for the match-ing MAC address. + +Example 5-4 show mac address-table dynamic with the address Keyword + +SW1# show mac address-table dynamic address 0200.1111.1111 +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.1111.1111 + +Type Ports +-------- ----- +DYNAMIC Fa0/1 + +Total Mac Addresses for this criterion: 1 + + +While this information is useful, often the engineer troubleshooting a problem does not know the MAC addresses of the devices connected to the network. Instead, the engineer has a topology diagram, knowing which switch ports connect to other switches and which con-nect to endpoint devices. + +Sometimes you might be troubleshooting while looking at a network topology diagram and want to look at all the MAC addresses learned off a particular port. IOS supplies that option with the show mac address-table dynamic interface command. Example 5-5 shows one example, for switch SW1’s F0/1 interface. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 121 + +Example 5-5 show mac address-table dynamic with the interface Keyword + +SW1# show mac address-table dynamic interface fastEthernet 0/1 +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.1111.1111 + +Type Ports +-------- ----- +DYNAMIC Fa0/1 + +Total Mac Addresses for this criterion: 1 + + +Finally, you may also want to find the MAC address table entries for one VLAN. You guessed it—you can add the vlan parameter, followed by the VLAN number. Example 5-6 shows two such examples from the same switch SW1 from Figure 5-7—one for VLAN 1, where all four devices reside, and one for a nonexistent VLAN 2. +Example 5-6 The show mac address-table vlan Command 5 + +SW1# show mac address-table dynamic vlan 1 +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.1111.1111 +1 0200.2222.2222 +1 0200.3333.3333 +1 0200.4444.4444 + +Type Ports +-------- ----- +DYNAMIC Fa0/1 +DYNAMIC Fa0/2 +DYNAMIC Fa0/3 +DYNAMIC Fa0/4 + +Total Mac Addresses for this criterion: 4 +SW1# +SW1# show mac address-table dynamic vlan 2 +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +SW1# + +Type Ports +-------- ----- + + + +Managing the MAC Address Table (Aging, Clearing) +This chapter closes with a few comments about how switches manage their MAC address tables. Switches do learn MAC addresses, but those MAC addresses do not remain in the table indefinitely. The switch will remove the entries due to age, due to the table filling, and you can remove entries using a command. + +First, for aging out MAC table entries, switches remove entries that have not been used for a defined number of seconds (default of 300 seconds on many switches). To do that, switches + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +122 CCNA 200-301 Official Cert Guide, Volume 1 + +look at every incoming frame and every source MAC address, and do something related to learning. If it is a new MAC address, the switch adds the correct entry to the table, of course. However, if that entry already exists, the switch still does something: it resets the +inactivity timer back to 0 for that entry. Each entry’s timer counts upward over time to mea-sure how long the entry has been in the table. The switch times out (removes) any entries whose timer reaches the defined aging time. + +Example 5-7 shows the aging timer setting for the entire switch. The aging time can be con-figured to a different time, globally and per-VLAN using the mac address-table aging-time time-in-seconds [vlan vlan-number] global configuration command. The example shows a case with all defaults, with the global setting of 300 seconds, and no per-VLAN overrides. + +Example 5-7 The MAC Address Default Aging Timer Displayed + +SW1# show mac address-table aging-time +Global Aging Time: 300 +Vlan Aging Time +---- ---------- +SW1# + +SW1# show mac address-table count + +Mac Entries for Vlan 1: +--------------------------- +Dynamic Address Count : 4 +Static Address Count : 0 +Total Mac Addresses : 4 + +Total Mac Address Space Available: 7299 + + +Each switch also removes the oldest table entries, even if they are younger than the aging time setting, if the table fills. The MAC address table uses content-addressable memory (CAM), a physical memory that has great table lookup capabilities. However, the size of the table depends on the size of the CAM in a particular model of switch and based on some configurable settings in the switch. When a switch tries to add a new MAC table entry and finds the table full, the switch times out (removes) the oldest table entry to make space. For perspective, the end of Example 5-7 lists the size of a Cisco Catalyst switch’s MAC table at about 8000 entries—the same four existing entries from the earlier examples, with space for 7299 more. + +Finally, you can remove the dynamic entries from the MAC address table with the clear mac address-table dynamic command. Note that the show commands in this chapter can be executed from user and enable mode, but the clear command happens to be an enable mode command. The command also allows parameters to limit the types of entries cleared, as follows: + +■ By VLAN: clear mac address-table dynamic vlan vlan-number +■ By Interface: clear mac address-table dynamic interface interface-id +■ By MAC address: clear mac address-table dynamic address mac-address + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 123 + +MAC Address Tables with Multiple Switches +Finally, to complete the discussion, it helps to think about an example with multiple switch-es, just to emphasize how MAC learning, forwarding, and flooding happen independently on each LAN switch. + +Consider the topology in Figure 5-10, and pay close attention to the port numbers. The ports were purposefully chosen so that neither switch used any of the same ports for this example. That is, switch SW2 does have a port F0/1 and F0/2, but I did not plug any devices into those ports when making this example. Also note that all ports are in VLAN 1, and as with the other examples in this chapter, all default configuration is used other than the host-name on the switches. + + +Fred 0200.1111.1111 + +Wilma 0200.3333.3333 + + +F0/1 F0/3 5 SW1 G0/1 G0/2 SW2 +F0/2 F0/4 + + +Barney 0200.2222.2222 + +Betty 0200.4444.4444 + + +Figure 5-10 Two-Switch Topology Example + +Think about a case in which both switches learn all four MAC addresses. For instance, that would happen if the hosts on the left communicate with the hosts on the right. SW1’s MAC address table would list SW1’s own port numbers (F0/1, F0/2, and G0/1) because SW1 uses that information to decide where SW1 should forward frames. Similarly, SW2’s MAC table lists SW2’s port numbers (F0/3, F0/4, G0/2 in this example). Example 5-8 shows the MAC address tables on both switches for that scenario. + +Example 5-8 The MAC Address Table on Two Switches + +SW1# show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.1111.1111 +1 0200.2222.2222 +1 0200.3333.3333 +1 0200.4444.4444 + +Type Ports +-------- ----- +DYNAMIC Fa0/1 +DYNAMIC Fa0/2 +DYNAMIC Gi0/1 +DYNAMIC Gi0/1 + +Total Mac Addresses for this criterion: 4 + +! The next output is from switch SW2 +SW2# show mac address-table dynamic +1 0200.1111.1111 DYNAMIC Gi0/2 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +124 CCNA 200-301 Official Cert Guide, Volume 1 + + +1 0200.2222.2222 +1 0200.3333.3333 +1 0200.4444.4444 + +DYNAMIC Gi0/2 +DYNAMIC Fa0/3 +DYNAMIC Fa0/4 + +Total Mac Addresses for this criterion: 4 + + + +Chapter Review + +Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Table 5-2 outlines the key review ele-ments and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 5-2 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Repeat DIKTA questions + +Do labs + +Review command tables + +Review Date(s) Resource Used Book, website +Book, website + +Book, PTP + +Book, Sim Lite, blog + +Book + + + +Review All the Key Topics + +Table 5-3 Key Topics for Chapter 5 + +Key Topic Element +List + +Figure 5-3 + +Figure 5-5 + +Figure 5-6 + +List + +Example 5-1 + +Description Page Number +Three main functions of a LAN switch 109 + +Process to forward a known unicast frame 111 + +Process to forward a known unicast, second switch 112 + +Process to learn MAC addresses 113 + +Summary of switch forwarding logic 117 + +The show mac address-table dynamic command 117 + + + +Do Labs +The Sim Lite software is a version of Pearson’s full simulator learning product with a subset of the labs, included free with this book. The subset of labs mostly relate to this part of the book, so take the time to try some of the labs. + +As always, also check the author’s blog site pages for configuration exercises (Config Labs) at http://blog.certskills.com. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 5: Analyzing Ethernet LAN Switching 125 + +Key Terms You Should Know +broadcast frame, known unicast frame, Spanning Tree Protocol (STP), unknown unicast frame, MAC address table, forward, flood + +Command References +Table 5-4 lists the verification commands used in this chapter. As an easy review exercise, cover the left column, read the right, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table 5-4 Chapter 5 EXEC Command Reference + +Command +show mac address-table + +show mac address-table dynamic + +show mac address-table dynamic vlan vlan-id +show mac address-table dynamic address mac-address +show mac address-table dynamic interface interface-id +show mac address-table count + +show mac address-table aging-time +clear mac address-table dynamic + +show interfaces status + +Mode/Purpose/Description +Shows all MAC table entries of all types + +Shows all dynamically learned MAC table entries +Shows all dynamically learned MAC table entries in that 5 +VLAN + +Shows the dynamically learned MAC table entries with that MAC address +Shows all dynamically learned MAC table entries associated with that interface +Shows the number of entries in the MAC table and the total number of remaining empty slots in the MAC table +Shows the global and per-VLAN aging timeout for inactive MAC table entries +Empties the MAC table of all dynamic entries + +Lists one line per interface on the switch, with basic status and operating information for each + +clear mac address-table dynamic Clears (removes) dynamic MAC table entries: either all [vlan vlan-number] [interface (with no parameters), or a subset based on VLAN ID, interface-id] [address mac-address] interface ID, or a specific MAC address + + +Note that this chapter also includes reference to one configuration command, so it does not call for the use of a separate table. For review, the command is + +mac address-table aging-time time-in-seconds [vlan vlan-number] + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 6 + + +Configuring Basic Switch Management + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +4.0 IP Services +4.6 Configure and verify DHCP client and relay + +4.8 Configure network devices for remote access using SSH + +5.0 Security Fundamentals +5.3 Configure device access control using local passwords + +The work performed by a networking device can be divided into three broad categories. The first and most obvious, called the data plane, is the work a switch does to forward frames generated by the devices connected to the switch. In other words, the data plane is the main purpose of the switch. Second, the control plane refers to the configuration and processes that control and change the choices made by the switch’s data plane. The network engineer can control which interfaces are enabled and disabled, which ports run at which speeds, how Spanning Tree blocks some ports to prevent loops, and so on. + +The third category, the management plane, is the topic of this chapter. The management plane deals with managing the device itself, rather than controlling what the device is doing. In par-ticular, this chapter looks at the most basic management features that can be configured in +a Cisco switch. The first section of the chapter works through the configuration of different kinds of login security. The second section shows how to configure IPv4 settings on a switch so it can be remotely managed. The last (short) section then explains a few practical matters that can make your life in the lab a little easier. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Table 6-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Securing the Switch CLI +Enabling IP for Remote Access + +Miscellaneous Settings Useful in Lab + +Questions 1–3 +4–5 + +6 + + + +1. Imagine that you have configured the enable secret command, followed by the enable password command, from the console. You log out of the switch and log back in at the console. Which command defines the password that you had to enter to access privileged mode? +a. enable password b. enable secret +c. Neither +d. The password command, if it is configured + +2. An engineer wants to set up simple password protection with no usernames for some switches in a lab, for the purpose of keeping curious coworkers from logging in to the lab switches from their desktop PCs. Which of the following commands would be a useful part of that configuration? +a. A login vty mode subcommand +b. A password password console subcommand c. A login local vty subcommand +d. A transport input ssh vty subcommand + +3. An engineer had formerly configured a Cisco 2960 switch to allow Telnet access so that the switch expected a password of mypassword from the Telnet user. The engi-neer then changed the configuration to support Secure Shell. Which of the following commands could have been part of the new configuration? (Choose two answers.) +a. A username name secret password vty mode subcommand +b. A username name secret password global configuration command c. A login local vty mode subcommand +d. A transport input ssh global configuration command + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +128 CCNA 200-301 Official Cert Guide, Volume 1 + +4. An engineer’s desktop PC connects to a switch at the main site. A router at the main site connects to each branch office through a serial link, with one small router and switch at each branch. Which of the following commands must be configured on the branch office switches, in the listed configuration mode, to allow the engineer to tel-net to the branch office switches and supply only a password to login? (Choose three answers.) +a. The ip address command in interface configuration mode b. The ip address command in global configuration mode +c. The ip default-gateway command in VLAN configuration mode d. The ip default-gateway command in global configuration mode e. The password command in console line configuration mode +f. The password command in vty line configuration mode + +5. A Layer 2 switch configuration places all its physical ports into VLAN 2. The IP addressing plan shows that address 172.16.2.250 (with mask 255.255.255.0) is reserved for use by this new LAN switch and that 172.16.2.254 is already configured on the router connected to that same VLAN. The switch needs to support SSH connections into the switch from any subnet in the network. Which of the following commands are part of the required configuration in this case? (Choose two answers.) +a. The ip address 172.16.2.250 255.255.255.0 command in interface vlan 1 con-figuration mode. +b. The ip address 172.16.2.250 255.255.255.0 command in interface vlan 2 con-figuration mode. +c. The ip default-gateway 172.16.2.254 command in global configuration mode. +d. The switch cannot support SSH because all its ports connect to VLAN 2, and the IP address must be configured on interface VLAN 1. + +6. Which of the following line subcommands tells a switch to wait until a show com-mand’s output has completed before displaying log messages on the screen? +a. logging synchronous b. no ip domain-lookup c. exec-timeout 0 0 +d. history size 15 + + +Foundation Topics + +Securing the Switch CLI +By default, a Cisco Catalyst switch allows anyone to connect to the console port, access user mode, and then move on to enable and configuration modes without any kind of security. That default makes sense, given that if you can get to the console port of the switch, you already have control over the switch physically. However, everyone needs to operate switches remotely, and the first step in that process is to secure the switch so that only the appropri-ate users can access the switch command-line interface (CLI). + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 129 + +This first topic in the chapter examines how to configure login security for a Cisco Catalyst switch. Securing the CLI includes protecting access to enable mode, because from enable mode, an attacker could reload the switch or change the configuration. Protecting user mode is also important, because attackers can see the status of the switch, learn about the net-work, and find new ways to attack the network. + +Note that all remote access and management protocols require that the switch IP configura-tion be completed and working. A switch’s IPv4 configuration has nothing to do with how a Layer 2 switch forwards Ethernet frames (as discussed in Chapter 5, “Analyzing Ethernet +LAN Switching”). Instead, to support Telnet and Secure Shell (SSH) into a switch, the switch needs to be configured with an IP address. This chapter also shows how to configure a switch’s IPv4 settings in the upcoming section “Enabling IPv4 for Remote Access.” + +In particular, this section covers the following login security topics: + +■ Securing user mode and privileged mode with simple passwords ■ Securing user mode access with local usernames +■ Securing user mode access with external authentication servers +■ Securing remote access with Secure Shell (SSH) +6 +Securing User Mode and Privileged Mode with Simple Passwords By default, Cisco Catalyst switches allow full access from the console but no access via +Telnet or SSH. Using default settings, a console user can move into user mode and then privi-leged mode with no passwords required; however, default settings prevent remote users from accessing even user mode. +The defaults work great for a brand new switch, but in production, you will want to secure access through the console as well as enable remote login via Telnet and/or SSH so you can sit at your desk and log in to all the switches in the LAN. Keep in mind, however, that you should not open the switch for just anyone to log in and change the configuration, so some type of secure login should be used. + +Most people use a simple shared password for access to lab gear. This method uses a pass-word only—with no username—with one password for console users and a different pass-word for Telnet users. Console users must supply the console password, as configured in console line configuration mode. Telnet users must supply the Telnet password, also called the vty password, so called because the configuration sits in vty line configuration mode. Figure 6-1 summarizes these options for using shared passwords from the perspective of the user logging in to the switch. + +1 Console Password + + + +User Mode + +2 vty Password + +Enable Password +Enable Mode + + +Figure 6-1 Simple Password Security Concepts + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +130 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE This section refers to several passwords as shared passwords. Users share these pass-words in that all users must know and use that same password. In other words, each user does not have a unique username/password to use, but rather, all the appropriate staff knows and uses the same password. + +In addition, Cisco switches protect enable mode (also called privileged mode) with yet another shared password called the enable password. From the perspective of the network engineer connecting to the CLI of the switch, once in user mode, the user types the enable EXEC com-mand. This command prompts the user for this enable password; if the user types the correct password, IOS moves the user to enable mode. + +Example 6-1 shows an example of the user experience of logging in to a switch from the console when the shared console password and the shared enable password have both been set. Note that before this example began, the user started the terminal emulator, physically connected a laptop to the console cable, and then pressed the Return key to make the switch respond as shown at the top of the example. + +Example 6-1 Console Login and Movement to Enable Mode + +(User now presses enter now to start the process. This line of text does not appear.) + +User Access Verification + +Password: faith +Switch> enable +Password: love +Switch# + + +Note that the example shows the password text as if typed (faith and love), along with the enable command that moves the user from user mode to enable mode. In reality, the switch hides the passwords when typed, to prevent someone from reading over your shoulder to see the passwords. + +To configure the shared passwords for the console, Telnet, and for enable mode, you need to configure several commands. However, the parameters of the commands can be pretty intui-tive. Figure 6-2 shows the configuration of all three of these passwords. + +The configuration for these three passwords does not require a lot of work. First, the console and vty password configuration sets the password based on the context: console mode for the console (line con 0), and vty line configuration mode for the Telnet password (line vty 0 15). Then inside console mode and vty mode, respectively, the two commands in each mode are as follows: + +password password-value: Defines the actual password used on the console or vty +login: Tells IOS to enable the use of a simple shared password (with no username) on this line (console or vty), so that the switch asks the user for a password + + +Answers to the “Do I Know This Already?” quiz: 1 B 2 A 3 B, C 4 A, D, F 5 B, C 6 A + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 131 + + +Console + + +line console 0 login +password faith + +User Mode enable secret love (switch>) + + + + +Enable Mode (switch#) + + +line vty 0 15 login password hope +Telnet (vty) + +Figure 6-2 Simple Password Security Configuration + +The configured enable password, shown on the right side of the figure, applies to all users, no matter whether they connect to user mode via the console, Telnet, or otherwise. The command to configure the enable password is a global configuration command: enable +secret password-value. 6 + +NOTE Older IOS versions used the command enable password password-value to set the enable password, and that command still exists in IOS. However, the enable secret command is much more secure. In real networks, use enable secret. Chapter 5, “Securing Network Devices,” in the CCNA 200-301 Official Cert Guide, Volume 2, explains more about the security levels of various password mechanisms, including a comparison of the enable secret and enable password commands. + +To help you follow the process, and for easier study later, use the configuration checklist before the example. The configuration checklist collects the required and optional steps to configure a feature as described in this book. The configuration checklist for shared pass-words for the console, Telnet, and enable passwords is + +Config Checklist + +Step 1. Configure the enable password with the enable secret password-value command. + +Step 2. Configure the console password: + +A. Use the line con 0 command to enter console configuration mode. + +B. Use the password password-value subcommand to set the value of the console password. + +C. Use the login subcommand to enable console password security using a simple password. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +132 CCNA 200-301 Official Cert Guide, Volume 1 + +Step 3. Configure the Telnet (vty) password: + +A. Use the line vty 0 15 command to enter vty configuration mode for all 16 vty lines (numbered 0 through 15). + +B. Use the password password-value subcommand to set the value of the console password. + +C. Use the login subcommand to enable console password security using a simple password. + +Example 6-2 shows the configuration process as noted in the configuration checklist, along with setting the enable secret password. Note that the lines which begin with a ! are com-ment lines; they are there to guide you through the configuration. + +Example 6-2 Configuring Basic Passwords + +! Enter global configuration mode, set the enable password, and also +! set the hostname (just because it makes sense to do so) +! +Switch# configure terminal +Switch(config)# enable secret love +! +! At Step 2 in the checklist, enter console configuration mode, set the +! password value to "faith" and enable simple passwords for the console. +! The exit command moves the user back to global config mode. +! +Switch#(config)# line console 0 +Switch#(config-line)# password faith +Switch#(config-line)# login +Switch#(config-line)# exit +! +! The next few lines do basically the same configuration, except it is +! for the vty lines. Telnet users will use "hope" to login. +! +Switch#(config)# line vty 0 15 +Switch#(config-line)# password hope +Switch#(config-line)# login +Switch#(config-line)# end +Switch# + + +Example 6-3 shows the resulting configuration in the switch per the show running-config command. The gray lines highlight the new configuration. Note that many unrelated lines of output have been deleted from the output to keep focused on the password configuration. + +Example 6-3 Resulting Running-Config File (Subset) Per Example 6-2 Configuration + +Switch# show running-config +! +Building configuration... + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 133 + +Current configuration: 1333 bytes +! +version 12.2 +! +enable secret 5 $1$OwtI$A58c2XgqWyDNeDnv51mNR. +! +interface FastEthernet0/1 +! +interface FastEthernet0/2 +! +! Several lines have been omitted here - in particular, lines for +! FastEthernet interfaces 0/3 through 0/23. +! +interface FastEthernet0/24 +! +interface GigabitEthernet0/1 +! +interface GigabitEthernet0/2 +! 6 line con 0 +password faith +login +! +line vty 0 4 +password hope +login +! +line vty 5 15 +password hope +login + + + +NOTE For historical reasons, the output of the show running-config command, in the last six lines of Example 6-3, separates the first five vty lines (0 through 4) from the rest (5 through 15). + + +Securing User Mode Access with Local Usernames and Passwords Cisco switches support two other login security methods that both use per-user username/ password pairs instead of a shared password with no username. One method, referred to as local usernames and passwords, configures the username/password pairs locally—that is, in the switch’s configuration. Switches support this local username/password option for the console, for Telnet, and even for SSH, but do not replace the enable password used to reach enable mode. +The configuration to migrate from using the simple shared passwords to instead using local usernames/passwords requires only some small configuration changes, as shown in Figure 6-3. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +134 CCNA 200-301 Official Cert Guide, Volume 1 + + + +Console + + + + +User Mode (switch>) + + + + +Telnet (vty) + +line console 0 login local password faith + + +username wendell secret odom username chris secret youdda + + + +line vty 0 15 login local password hope + + +Figure 6-3 Configuring Switches to Use Local Username Login Authentication + +Working through the configuration in the figure, first, the switch of course needs to know the list of username/password pairs. To create these, repeatedly use the username name secret password global configuration command. Then, to enable this different type of con-sole or Telnet security, simply enable this login security method with the login local line. Basically, this command means “use the local list of usernames for login.” You can also use the no password command (without even typing in the password) to clean up any remaining password subcommands from console or vty mode because these commands are not needed when using local usernames and passwords. + +The following checklist details the commands to configure local username login, mainly as a method for easier study and review: + +Config Checklist + +Step 1. Use the username name secret password global configuration command to add one or more username/password pairs on the local switch. + +Step 2. Configure the console to use locally configured username/password pairs: + +A. Use the line con 0 command to enter console configuration mode. + +B. Use the login local subcommand to enable the console to prompt for both username and password, checked versus the list of local usernames/pass- +words. + + +C. (Optional) Use the no password subcommand to remove any existing sim-ple shared passwords, just for good housekeeping of the configuration file. + +Step 3. Configure Telnet (vty) to use locally configured username/password pairs. + +A. Use the line vty 0 15 command to enter vty configuration mode for all 16 vty lines (numbered 0 through 15). + +B. Use the login local subcommand to enable the switch to prompt for both username and password for all inbound Telnet users, checked versus the list of local usernames/passwords. +C. (Optional) Use the no password subcommand to remove any existing sim-ple shared passwords, just for good housekeeping of the configuration file. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 135 + +When a Telnet user connects to the switch configured as shown in Figure 6-3, the user will be prompted first for a username and then for a password, as shown in Example 6-4. The username/password pair must be from the list of local usernames; otherwise, the login is rejected. + +Example 6-4 Telnet Login Process After Applying Configuration in Figure 6-3 + +SW2# telnet 10.9.9.19 +Trying 10.9.9.19 ... Open + + +User Access Verification + +Username: wendell +Password: +SW1> enable +Password: +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)#^Z 6 SW1# +*Mar 1 02:00:56.229: %SYS-5-CONFIG_I: Configured from console by wendell on vty0 (10.9.9.19) + + +NOTE Example 6-4 does not show the password value as having been typed because Cisco switches do not display the typed password for security reasons. + + +Securing User Mode Access with External Authentication Servers The end of Example 6-4 points out one of the many security improvements when requiring each user to log in with their own username. The end of the example shows the user enter-ing configuration mode (configure terminal) and then immediately leaving (end). Note that +when a user exits configuration mode, the switch generates a log message. If the user logged in with a username, the log message identifies that username; note the “wendell” in the log message. +However, using a username/password configured directly on the switch causes some admin-istrative headaches. For instance, every switch and router needs the configuration for all users who might need to log in to the devices. Then, when any changes need to happen, like an occasional change to the passwords for good security practices, the configuration of all devices must be changed. + +A better option would be to use tools like those used for many other IT login functions. Those tools allow for a central place to securely store all username/password pairs, with tools to make users change their passwords regularly, tools to revoke users when they leave their current jobs, and so on. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +136 CCNA 200-301 Official Cert Guide, Volume 1 + +Cisco switches allow exactly that option using an external server called an authentication, authorization, and accounting (AAA) server. These servers hold the usernames/passwords. Typically, these servers allow users to do self-service and forced maintenance to their pass-words. Many production networks use AAA servers for their switches and routers today. + +The underlying login process requires some additional work on the part of the switch for each user login, but once set up, the username/password administration is much less. When using a AAA server for authentication, the switch (or router) simply sends a message to the AAA server asking whether the username and password are allowed, and the AAA server replies. Figure 6-4 shows an example, with the user first supplying a username/password, the switch asking the AAA server, and the server replying to the switch stating that the user-name/password is valid. + +1 Login: wendell/odom 2 Login: wendell/odom + +A +SW1 S1 + +4 Command Prompt 3 Approved! AAA + +Telnet or SSH RADIUS or TACACS+ + +Figure 6-4 Basic Authentication Process with an External AAA Server + +While the figure shows the general idea, note that the information flows with a couple of different protocols. On the left, the connection between the user and the switch or +router uses Telnet or SSH. On the right, the switch and AAA server typically use either the RADIUS or TACACS+ protocol, both of which encrypt the passwords as they traverse the network. + +Securing Remote Access with Secure Shell +So far, this chapter has focused on the console and on Telnet, mostly ignoring SSH. Telnet has one serious disadvantage: all data in the Telnet session flows as clear text, including the password exchanges. So, anyone that can capture the messages between the user and the switch (in what is called a man-in-the-middle attack) can see the passwords. SSH encrypts all data transmitted between the SSH client and server, protecting the data and passwords. + +SSH can use the same local login authentication method as Telnet, with the locally con-figured username and password. (SSH cannot rely on authentication methods that do not include a username, like shared passwords.) So, the configuration to support local usernames for Telnet, as shown previously in Figure 6-3, also enables local username authentication for incoming SSH connections. + +Figure 6-5 shows one example configuration of what is required to support SSH. The figure repeats the local username configuration as shown earlier in Figure 6-3, as used for Telnet. Figure 6-5 shows three additional commands required to complete the configuration of SSH on the switch. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 137 + + + + + + +User Mode (sw1>) + + + + +SSH + +SSH-Specific Configuration + +hostname sw1 +ip domain-name example.com +! Next Command Uses FQDN “sw1.example.com” crypto key generate rsa + + +Local Username Configuration (Like Telnet) + +username wendell secret odom username chris secret youdda ! +line vty 0 15 login local + + +Figure 6-5 Adding SSH Configuration to Local Username Configuration + +IOS uses the three SSH-specific configuration commands in the figure to create the SSH encryption keys. The SSH server uses the fully qualified domain name (FQDN) of the switch +as input to create that key. The switch creates the FQDN from the hostname and domain +name of the switch. Figure 6-5 begins by setting both values (just in case they are not 6 +already configured). Then the third command, the crypto key generate rsa command, gener-ates the SSH encryption keys. + +The configuration in Figure 6-5 relies on two default settings that the figure therefore conve-niently ignored. IOS runs an SSH server by default. In addition, IOS allows SSH connections into the vty lines by default. + +Seeing the configuration happen in configuration mode, step by step, can be particularly helpful with SSH configuration. Note in particular that in this example, the crypto key com-mand prompts the user for the key modulus; you could also add the parameters modulus modulus-value to the end of the crypto key command to add this setting on the command. Example 6-5 shows the commands in Figure 6-5 being configured, with the encryption key as the final step. + +Example 6-5 SSH Configuration Process to Match Figure 6-5 + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +! +! Step 1 next. The hostname is already set, but it is repeated just +! to be obvious about the steps. +! +SW1(config)# hostname SW1 +SW1(config)# ip domain-name example.com +SW1(config)# crypto key generate rsa +The name for the keys will be: SW1.example.com +Choose the size of the key modulus in the range of 360 to 2048 for your +General Purpose Keys. Choosing a key modulus greater than 512 may take +a few minutes. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +138 CCNA 200-301 Official Cert Guide, Volume 1 + +How many bits in the modulus [512]: 1024 +% Generating 1024 bit RSA keys, keys will be non-exportable... +[OK] (elapsed time was 4 seconds) +SW1(config)# +! +! Optionally, set the SSH version to version 2 (only) - preferred +! +SW1(config)# ip ssh version 2 +! +! Next, configure the vty lines for local username support, just like +! with Telnet +! +SW1(config)# line vty 0 15 +SW1(config-line)# login local +SW1(config-line)# exit +! +! Define the local usernames, just like with Telnet +! +SW1(config)# username wendell password odom +SW1(config)# username chris password youdaman +SW1(config)# ^Z +SW1# + + +Earlier, I mentioned that one useful default was that the switch defaults to support both SSH and Telnet on the vty lines. However, because Telnet is a security risk, you could disable Telnet to enforce a tighter security policy. (For that matter, you can disable SSH support and allow Telnet on the vty lines as well.) + +To control which protocols a switch supports on its vty lines, use the transport input {all | none | telnet | ssh} vty subcommand in vty mode, with the following options: + +transport input all or transport input telnet ssh: Support both Telnet and SSH transport input none: Support neither +transport input telnet: Support only Telnet transport input ssh: Support only SSH +To complete this section about SSH, the following configuration checklist details the steps for one method to configure a Cisco switch to support SSH using local usernames. (SSH support in IOS can be configured in several ways; this checklist shows one simple way to configure it.) The process shown here ends with a comment to configure local username sup-port on vty lines, as was discussed earlier in the section titled “Securing User Mode Access with Local Usernames and Passwords.” + +Config Checklist + +Step 1. Configure the switch to generate a matched public and private key pair to use for encryption: + +A. If not already configured, use the hostname name in global configuration mode to configure a hostname for this switch. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 139 + +B. If not already configured, use the ip domain-name name in global configu-ration mode to configure a domain name for the switch, completing the switch’s FQDN. +C. Use the crypto key generate rsa command in global configuration mode (or the crypto key generate rsa modulus modulus-value command to avoid being prompted for the key modulus) to generate the keys. (Use at least a 768-bit key to support SSH version 2.) +Step 2. (Optional) Use the ip ssh version 2 command in global configuration mode to override the default of supporting both versions 1 and 2, so that only SSHv2 connections are allowed. +Step 3. (Optional) If not already configured with the setting you want, configure the vty lines to accept SSH and whether to also allow Telnet: + +A. Use the transport input ssh command in vty line configuration mode to allow SSH only. + +B. Use the transport input all command (default) or transport input telnet ssh +command in vty line configuration mode to allow both SSH and Telnet. 6 Step 4. Use various commands in vty line configuration mode to configure local user- +name login authentication as discussed earlier in this chapter. + + + +NOTE Cisco routers often default to transport input none, so you must add the transport input line subcommand to enable Telnet and/or SSH into a router. + +Two key commands give some information about the status of SSH on the switch. First, the show ip ssh command lists status information about the SSH server itself. The show ssh command then lists information about each SSH client currently connected into the switch. Example 6-6 shows samples of each, with user wendell currently connected to the switch. + +Example 6-6 Displaying SSH Status + +SW1# show ip ssh +SSH Enabled - version 2.0 +Authentication timeout: 120 secs; Authentication retries: 3 + +SW1# show ssh +Connection Version Mode Encryption Hmac State Username + +0 2.0 IN +0 2.0 OUT + +aes126-cbc +aes126-cbc + +hmac-sha1 +hmac-sha1 + +Session started +Session started + +wendell +wendell + +%No SSHv1 server connections running. + + +Enabling IPv4 for Remote Access +To allow Telnet or SSH access to the switch, and to allow other IP-based management proto-cols (for example, Simple Network Management Protocol, or SNMP) to function as intended, + + +|||||||||||||||||||| +|||||||||||||||||||| + + +140 CCNA 200-301 Official Cert Guide, Volume 1 + +the switch needs an IP address, as well as a few other related settings. The IP address has nothing to do with how switches forward Ethernet frames; it simply exists to support over-head management traffic. + +This next topic begins by explaining the IPv4 settings needed on a switch, followed by the configuration. Note that although switches can be configured with IPv6 addresses with commands similar to those shown in this chapter, this chapter focuses solely on IPv4. All ref-erences to IP in this chapter imply IPv4. + +Host and Switch IP Settings +A switch needs the same kind of IP settings as a PC with a single Ethernet interface. For per-spective, a PC has a CPU, with the operating system running on the CPU. It has an Ethernet network interface card (NIC). The OS configuration includes an IP address associated with the NIC, either configured or learned dynamically with DHCP. + +A switch uses the same ideas, except that the switch needs to use a virtual NIC inside the switch. Like a PC, a switch has a real CPU, running an OS (called IOS). The switch obviously has lots of Ethernet ports, but instead of assigning its management IP address to any of those ports, the switch then uses a NIC-like concept called a switched virtual interface (SVI), or more commonly, a VLAN interface, that acts like the switch’s own NIC. Then the settings on the switch look something like a host, with the switch configuration assigning IP settings, like an IP address, to this VLAN interface, as shown in Figure 6-6. + + +Host Concept Inside Switch + + +Other Real Hosts Outside Switch + + +VLAN 1 +Subnet 192.168.1.0 + + +Interface VLAN 1 + +interface vlan 1 +ip address 192.168.1.8 255.255.255.0 + + +(Shaded Area is Inside the Switch) + + +Figure 6-6 Switch Virtual Interface (SVI) Concept Inside a Switch + +By using interface VLAN 1 for the IP configuration, the switch can then send and receive frames on any of the ports in VLAN 1. In a Cisco switch, by default, all ports are assigned to VLAN 1. + +In most networks, switches configure many VLANs, so the network engineer has a choice of where to configure the IP address. That is, the management IP address does not have to be configured on the VLAN 1 interface (as configured with the interface vlan 1 command seen in Figure 6-6). + +A Layer 2 Cisco LAN switch needs only one IP address for management purposes. However, you can choose to use any VLAN to which the switch connects. The configuration then includes a VLAN interface for that VLAN number, with an appropriate IP address. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 141 + +For example, Figure 6-7 shows a Layer 2 switch with some physical ports in two different VLANs (VLANs 1 and 2). The figure also shows the subnets used on those VLANs. The net-work engineer could choose to use either + +■ Interface VLAN 1, with an IP address in subnet 192.168.1.0 ■ Interface VLAN 2, with an IP address in subnet 192.168.2.0 + + + + + +Interface VLAN 1 + +Interface VLAN 2 + + + + +VLAN 1 +Subnet 192.168.1.0 + +? +Which VLAN Should I Use for Management? + + +VLAN 2 +Subnet 192.168.2.0 + + +(Shaded Area is Inside the Switch) + +Figure 6-7 Choosing One VLAN on Which to Configure a Switch IP Address +Note that you should not try to use a VLAN interface for which there are no physical ports 6 assigned to the same VLAN. If you do, the VLAN interface will not reach an up/up state, +and the switch will not have the physical ability to communicate outside the switch. + + +NOTE Some Cisco switches can be configured to act as either a Layer 2 switch or a Layer 3 switch. When acting as a Layer 2 switch, a switch forwards Ethernet frames as discussed in depth in Chapter 5, “Analyzing Ethernet LAN Switching.” Alternatively, a switch can also act as a multilayer switch or Layer 3 switch, which means the switch can do both Layer +2 switching and Layer 3 IP routing of IP packets, using the Layer 3 logic normally used by routers. This chapter assumes all switches are Layer 2 switches. Chapter 17, “IP Routing in the LAN,” discusses Layer 3 switching in depth along with using multiple VLAN interfaces at the same time. + +Configuring the IP address (and mask) on one VLAN interface allows the switch to send and receive IP packets with other hosts in a subnet that exists on that VLAN; however, the switch cannot communicate outside the local subnet without another configuration setting called the default gateway. The reason a switch needs a default gateway setting is the same reason that hosts need the same setting—because of how hosts think when sending IP packets. Specifically: + +■ To send IP packets to hosts in the same subnet, send them directly +■ To send IP packets to hosts in a different subnet, send them to the local router; that is, the default gateway + +Figure 6-8 shows the ideas. In this case, the switch (on the right) will use IP address 192.168.1.200 as configured on interface VLAN 1. However, to communicate with host A, on the far left of the figure, the switch must use Router R1 (the default gateway) to forward + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +142 CCNA 200-301 Official Cert Guide, Volume 1 + +IP packets to host A. To make that work, the switch needs to configure a default gateway setting, pointing to Router R1’s IP address (192.168.1.1 in this case). Note that the switch and router both use the same mask, 255.255.255.0, which puts the addresses in the same subnet. + +VLAN 1 +Subnet 192.168.1.0 + + + + + +A + + +Other IPv4 Subnets + + + + +R1 192.168.1.1 (Default Gateway) + +Interface VLAN 1 +192.168.1.200 + + +(Box Shows Internal Switch Concepts) + + +Figure 6-8 The Need for a Default Gateway + +Configuring IPv4 on a Switch +A switch configures its IPv4 address and mask on this special NIC-like VLAN interface. The following steps list the commands used to configure IPv4 on a switch, assuming that the IP address is configured to be in VLAN 1, with Example 6-7 that follows showing an example configuration. + +Config Checklist + +Step 1. Use the interface vlan 1 command in global configuration mode to enter inter-face VLAN 1 configuration mode. + +Step 2. Use the ip address ip-address mask command in interface configuration mode to assign an IP address and mask. + +Step 3. Use the no shutdown command in interface configuration mode to enable the VLAN 1 interface if it is not already enabled. + +Step 4. Add the ip default-gateway ip-address command in global configuration mode to configure the default gateway. + +Step 5. (Optional) Add the ip name-server ip-address1 ip-address2 … command in global configuration mode to configure the switch to use Domain Name System +(DNS) to resolve names into their matching IP address. + + + +Example 6-7 Switch Static IP Address Configuration + +Emma# configure terminal +Emma(config)# interface vlan 1 +Emma(config-if)# ip address 192.168.1.200 255.255.255.0 +Emma(config-if)# no shutdown +00:25:07: %LINK-3-UPDOWN: Interface Vlan1, changed state to up +00:25:08: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed +state to up +Emma(config-if)# exit +Emma(config)# ip default-gateway 192.168.1.1 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 143 + +On a side note, this example shows a particularly important and common command: the [no] shutdown command. To administratively enable an interface on a switch, use the no shutdown interface subcommand; to disable an interface, use the shutdown interface +subcommand. This command can be used on the physical Ethernet interfaces that the switch uses to switch Ethernet messages in addition to the VLAN interface shown here in this example. + +Also, pause long enough to look at the messages that appear just below the no shutdown command in Example 6-7. Those messages are syslog messages generated by the switch stat-ing that the switch did indeed enable the interface. Switches (and routers) generate syslog messages in response to a variety of events, and by default, those messages appear at the console. Chapter 9, “Device Management Protocols,” in the CCNA 200-301 Official Cert Guide, Volume 2, discusses syslog messages in more detail. + + +Configuring a Switch to Learn Its IP Address with DHCP +The switch can also use Dynamic Host Configuration Protocol (DHCP) to dynamically learn its IPv4 settings. Basically, all you have to do is tell the switch to use DHCP on the interface and enable the interface. Assuming that DHCP works in this network, the switch will learn all its settings. The following list details the steps, again assuming the use of interface VLAN 1, +with Example 6-8 that follows showing an example: + + + + + + +6 + + + +Config Checklist + +Step 1. Enter VLAN 1 configuration mode using the interface vlan 1 global configura-tion command, and enable the interface using the no shutdown command as necessary. +Step 2. Assign an IP address and mask using the ip address dhcp interface subcommand. + + + +Example 6-8 Switch Dynamic IP Address Configuration with DHCP + +Emma# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Emma(config)# interface vlan 1 +Emma(config-if)# ip address dhcp +Emma(config-if)# no shutdown +Emma(config-if)# ^Z +Emma# +00:38:20: %LINK-3-UPDOWN: Interface Vlan1, changed state to up +00:38:21: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up + + +Verifying IPv4 on a Switch +The switch IPv4 configuration can be checked in several places. First, you can always look at the current configuration using the show running-config command. Second, you can look at the IP address and mask information using the show interfaces vlan x command, which shows detailed status information about the VLAN interface in VLAN x. Finally, if using DHCP, use the show dhcp lease command to see the (temporarily) leased IP address and other parameters. (Note that the switch does not store the DHCP-learned IP configuration in + + +|||||||||||||||||||| +|||||||||||||||||||| + + +144 CCNA 200-301 Official Cert Guide, Volume 1 + +the running-config file.) Example 6-9 shows sample output from these commands to match the configuration in Example 6-8. + +Example 6-9 Verifying DHCP-Learned Information on a Switch + +Emma# show dhcp lease +Temp IP addr: 192.168.1.101 for peer on Interface: Vlan1 +Temp sub net mask: 255.255.255.0 +DHCP Lease server: 192.168.1.1, state: 3 Bound +DHCP transaction id: 1966 +Lease: 86400 secs, Renewal: 43200 secs, Rebind: 75600 secs +Temp default-gateway addr: 192.168.1.1 +Next timer fires after: 11:59:45 +Retry count: 0 Client-ID: cisco-0019.e86a.6fc0-Vl1 +Hostname: Emma +Emma# show interfaces vlan 1 +Vlan1 is up, line protocol is up +Hardware is EtherSVI, address is 0019.e86a.6fc0 (bia 0019.e86a.6fc0) +Internet address is 192.168.1.101/24 +MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, +reliability 255/255, txload 1/255, rxload 1/255 +! lines omitted for brevity +Emma# show ip default-gateway +192.168.1.1 + + +The output of the show interfaces vlan 1 command lists two very important details related to switch IP addressing. First, this show command lists the interface status of the VLAN 1 interface—in this case, “up and up.” If the VLAN 1 interface is not up, the switch cannot use its IP address to send and receive management traffic. Notably, if you forget to issue the no shutdown command, the VLAN 1 interface remains in its default shutdown state and is listed as “administratively down” in the show command output. + +Second, note that the output lists the interface’s IP address on the third line. If you statically configure the IP address, as in Example 6-7, the IP address will always be listed; however, +if you use DHCP and DHCP fails, the show interfaces vlan x command will not list an IP address here. When DHCP works, you can see the IP address with the show interfaces vlan 1 command, but that output does not remind you whether the address is either statically configured or DHCP leased. So it does take a little extra effort to make sure you know whether the address is statically configured or DHCP-learned on the VLAN interface. + +Miscellaneous Settings Useful in the Lab +This last short section of the chapter touches on a couple of commands that can help you be a little more productive when practicing in a lab. + +History Buffer Commands +When you enter commands from the CLI, the switch saves the last several commands in the history buffer. Then, as mentioned in Chapter 4, “Using the Command-Line Interface,” you + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 145 + +can use the up-arrow key or press Ctrl+P to move back in the history buffer to retrieve a command you entered a few commands ago. This feature makes it very easy and fast to use a set of commands repeatedly. Table 6-2 lists some of the key commands related to the history buffer. + +Table 6-2 Commands Related to the History Buffer + +Command show history + +terminal history size x + +history size x + +Description +An EXEC command that lists the commands currently held in the history buffer. +From EXEC mode, this command allows a single user to set, just for this one login session, the size of his or her history buffer. +A configuration command that, from console or vty line configuration mode, sets the default number of commands saved in the history buffer for the users of the console or vty lines, respectively. + + + +The logging synchronous, exec-timeout, and no ip domain-lookup +Commands 6 +These next three configuration commands have little in common, other than the fact that they can be useful settings to reduce your frustration when using the console of a switch or router. + +The console automatically receives copies of all unsolicited syslog messages on a switch. The idea is that if the switch needs to tell the network administrator some important and possibly urgent information, the administrator might be at the console and might notice the message. + +Unfortunately, IOS (by default) displays these syslog messages on the console’s screen at any time—including right in the middle of a command you are entering, or in the middle of the output of a show command. Having a bunch of text show up unexpectedly can be a bit annoying. + +You could simply disable the feature that sends these messages to the console and then re-enable the feature later using the no logging console and logging console global configura-tion commands. For example, when working from the console, if you want to temporarily not be bothered by log messages, you can disable the display of these messages with the no logging console global configuration command, and then when finished, enable them again. + +However, IOS supplies a reasonable compromise, telling the switch to display syslog messages only at more convenient times, such as at the end of output from a show command. To do so, just configure the logging synchronous console line subcommand, which basically tells IOS to synchronize the syslog message display with the messages requested using show commands. + +Another way to improve the user experience at the console is to control timeouts of the login session from the console or when using Telnet or SSH. By default, the switch automati-cally disconnects console and vty (Telnet and SSH) users after 5 minutes of inactivity. The exec-timeout minutes seconds line subcommand enables you to set the length of that inac-tivity timer. In the lab (but not in production), you might want to use the special value of 0 minutes and 0 seconds meaning “never time out.” + + +|||||||||||||||||||| +|||||||||||||||||||| + + +146 CCNA 200-301 Official Cert Guide, Volume 1 + +Finally, IOS has an interesting combination of features that can make you wait for a minute or so when you mistype a command. First, IOS tries to use DNS name resolution on IP hostnames—a generally useful feature. If you mistype a command, however, IOS thinks you want to telnet to a host by that name. With all default settings in the switch, the switch tries to resolve the hostname, cannot find a DNS server, and takes about a minute to time out and give you control of the CLI again. + +To avoid this problem, configure the no ip domain-lookup global configuration command, which disables IOS’s attempt to resolve the hostname into an IP address. + +Example 6-10 collects all these commands into a single example, as a template for some good settings to add in a lab switch to make you more productive. + +Example 6-10 Commands Often Used in the Lab to Increase Productivity + +no ip domain-lookup +! +line console 0 +exec-timeout 0 0 +logging synchronous +history size 20 +! +line vty 0 15 +exec-timeout 0 0 +logging synchronous +history size 20 + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element section titled “Step 2: Build Your Study Habits Around the Chapter” for more details. Table 6-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 6-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Repeat DIKTA questions + +Review config checklists + +Do labs + +Review command tables + +Resource Used Book, website +Book, website + +Book, PTP + +Book, website + +Sim Lite, blog + +Book + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 147 + +Review All the Key Topics + +Table 6-4 Key Topics for Chapter 6 + +Key Topic Element +Example 6-2 + +Figure 6-5 + +Description Page Number +Example of configuring password login security (no usernames) 132 + +SSH configuration commands with related username login security 137 + + + +Key Terms You Should Know +Telnet, Secure Shell (SSH), local username, AAA, AAA server, enable mode, default gateway, VLAN interface, history buffer, DNS, name resolution, log message + +Do Labs +The Sim Lite software is a version of Pearson’s full simulator learning product with a subset of the labs, included with this book for free. The subset of labs mostly relate to this part. +Take the time to try some of the labs. As always, also check the author’s blog site pages for 6 configuration exercises (Config Labs) at https://blog.certskills.com. + +Command References +Tables 6-5, 6-6, 6-7, and 6-8 list configuration and verification commands used in this chap-ter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right col-umn, and try to recall what the command does. + +Table 6-5 Login Security Commands + +Command line console 0 +line vty 1st-vty last-vty + +login + +password pass-value + +login local + + + +username name secret pass-value + +Mode/Purpose/Description +Changes the context to console configuration mode. + +Changes the context to vty configuration mode for the range of vty lines listed in the command. +Console and vty configuration mode. Tells IOS to prompt for a password. +Console and vty configuration mode. Lists the password required if the login command (with no other parameters) is configured. +Console and vty configuration mode. Tells IOS to prompt for a username and password, to be checked against locally +configured username global configuration commands on this switch or router. +Global command. Defines one of possibly multiple usernames and associated passwords, used for user authentication. Used when the login local line configuration command has been used. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +148 CCNA 200-301 Official Cert Guide, Volume 1 + + +Command +crypto key generate rsa [modulus 360..2048] +transport input {telnet | ssh | all | none} + +Mode/Purpose/Description +Global command. Creates and stores (in a hidden location in flash memory) the keys required by SSH. +vty line configuration mode. Defines whether Telnet/SSH access is allowed into this switch. Both values can be configured on one command to allow both Telnet and SSH access (the default). + + + +Table 6-6 Switch IPv4 Configuration + +Command +interface vlan number + +ip address ip-address subnet-mask +ip address dhcp + +ip default-gateway address + +Mode/Purpose/Description +Changes the context to VLAN interface mode. For VLAN 1, allows the configuration of the switch’s IP address. +VLAN interface mode. Statically configures the switch’s IP address and mask. + +VLAN interface mode. Configures the switch as a DHCP client to discover its IPv4 address, mask, and default gateway. +Global command. Configures the switch’s default gateway IPv4 address. Not required if the switch uses DHCP. + +ip name-server server-ip-1 Global command. Configures the IPv4 addresses of DNS servers, server-ip-2 … so any commands when logged in to the switch will use the DNS +for name resolution. + + +Table 6-7 Other Switch Configuration + +Command hostname name + +enable secret pass-value + +history size length + +logging synchronous + + +[no] logging console + +exec-timeout minutes [seconds] + +Mode/Purpose/Description +Global command. Sets this switch’s hostname, which is also used as the first part of the switch’s command prompt. +Global command. Sets this switch’s password that is required for any user to reach enable mode. +Line config mode. Defines the number of commands held in the history buffer, for later recall, for users of those lines. +Console or vty mode. Tells IOS to send log messages to the user at natural break points between commands rather than in the middle of a line of output. +Global command that disables or enables the display of log messages to the console. +Console or vty mode. Sets the inactivity timeout, so that after the defined period of no action, IOS closes the current user login session. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 6: Configuring Basic Switch Management 149 + +Table 6-8 Chapter 6 EXEC Command Reference + +Command +show running-config + +show running-config | begin line vty + +show dhcp lease + + +show crypto key mypubkey rsa + + +show ip ssh + +show ssh + +show interfaces vlan number + +show ip default-gateway + +terminal history size x + +show history + +Purpose +Lists the currently used configuration. + +Pipes (sends) the command output to the begin command, which only lists output beginning with the first line that contains the text “line vty.” +Lists any information the switch acquires as a DHCP client. This includes IP address, subnet mask, and default gateway information. +Lists the public and shared key created for use with SSH using the crypto key generate rsa global configuration command. +Lists status information for the SSH server, including the SSH version. +Lists status information for current SSH connections into and out of the local switch. +Lists the interface status, the switch’s IPv4 address and 6 mask, and much more. +Lists the switch’s setting for its IPv4 default gateway. + +Changes the length of the history buffer for the current user only, only for the current login to the switch. +Lists the commands in the current history buffer. + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 7 + + +Configuring and Verifying Switch Interfaces + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.b L2 and L3 switches + +1.4 Describe switching concepts + +So far in this part, you have learned the skills to navigate the command-line interface (CLI) and use commands that configure and verify switch features. You learned about the primary purpose of a switch—forwarding Ethernet frames—and learned how to see that process +in action by looking at the switch MAC address table. After learning about the switch data plane in Chapter 5, “Analyzing Ethernet LAN Switching,” you learned a few management plane features in Chapter 6, “Configuring Basic Switch Management,” like how to configure the switch to support Telnet and Secure Shell (SSH) by configuring IP address and login security. + +This chapter focuses on switch interfaces in two major sections. The first section shows how you can configure and change the operation of switch interfaces: how to change the speed, duplex, or even disable the interface. The second half then focuses on how to use show com-mands on a switch to verify switch interface status and how to interpret the output to find some of the more common issues with switch interfaces. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 7-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Configuring Switch Interfaces +Analyzing Switch Interface Status and Statistics + +Questions 1–3 +4–6 + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Which of the following describes a way to disable IEEE standard autonegotiation on a 10/100 port on a Cisco switch? +a. Configure the negotiate disable interface subcommand b. Configure the no negotiate interface subcommand +c. Configure the speed 100 interface subcommand d. Configure the duplex half interface subcommand e. Configure the duplex full interface subcommand +f. Configure the speed 100 and duplex full interface subcommands + +2. In which of the following modes of the CLI could you configure the duplex setting for interface Fast Ethernet 0/5? +a. User mode b. Enable mode +c. Global configuration mode d. VLAN mode +e. Interface configuration mode + +3. A Cisco Catalyst switch connects with its Gigabit0/1 port to an end user’s PC. The end user, thinking the user is helping, manually sets the PC’s OS to use a speed of 1000 Mbps and to use full duplex, and disables the use of autonegotiation. The switch’s G0/1 port has default settings for speed and duplex. What speed and duplex settings will the switch decide to use? (Choose two answers.) +a. Full duplex b. Half duplex c. 10 Mbps +d. 1000 Mbps + +4. The output of the show interfaces status command on a 2960 switch shows inter-face Fa0/1 in a “disabled” state. Which of the following is true about interface Fa0/1? (Choose three answers.) +a. The interface is configured with the shutdown command. +b. The show interfaces fa0/1 command will list the interface with two status codes of administratively down and line protocol down. +c. The show interfaces fa0/1 command will list the interface with two status codes of up and down. +d. The interface cannot currently be used to forward frames. e. The interface can currently be used to forward frames. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +152 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Switch SW1 uses its Gigabit 0/1 interface to connect to switch SW2’s Gigabit 0/2 inter-face. SW2’s Gi0/2 interface is configured with the speed 1000 and duplex full com-mands. SW1 uses all defaults for interface configuration commands on its Gi0/1 interface. Which of the following are true about the link after it comes up? (Choose two answers.) +a. The link works at 1000 Mbps (1 Gbps). +b. SW1 attempts to run at 10 Mbps because SW2 has effectively disabled IEEE stan-dard autonegotiation. +c. The link runs at 1 Gbps, but SW1 uses half duplex and SW2 uses full duplex. d. Both switches use full duplex. +6. Switch SW1 connects via a cable to switch SW2’s G0/1 port. Which of the following conditions is the most likely to cause SW1’s late collision counter to continue to increment? +a. SW2’s G0/1 has been configured with a shutdown interface subcommand. +b. The two switches have been configured with different values on the speed inter-face subcommand. +c. A duplex mismatch exists with SW1 set to full duplex. d. A duplex mismatch exists with SW1 set to half duplex. + +Foundation Topics + +Configuring Switch Interfaces +IOS uses the term interface to refer to physical ports used to forward data to and from other devices. Each interface can be configured with several settings, each of which might differ from interface to interface. IOS uses interface subcommands to configure these settings. Each of these settings may be different from one interface to the next, so you would first identify the specific interface, and then configure the specific setting. + +This section begins with a discussion of three relatively basic per-interface settings: the port speed, duplex, and a text description. Following that, the text takes a short look at a pair +of the most common interface subcommands: the shutdown and no shutdown commands, which administratively disable and enable the interface, respectively. This section ends with a discussion about autonegotiation concepts, which in turn dictates what settings a switch chooses to use when using autonegotiation. + +Configuring Speed, Duplex, and Description +Switch interfaces that support multiple speeds (10/100 and 10/100/1000 interfaces), by default, will autonegotiate what speed to use. However, you can configure the speed and duplex settings with the duplex {auto | full | half} and speed {auto | 10 | 100 | 1000} inter-face subcommands. Simple enough. + +Most of the time, using autonegotiation makes good sense, so when you set the duplex and speed manually using these commands, you typically have a good reason to do so. For instance, maybe you want to set the speed to the fastest possible on links between switches just to avoid the chance that autonegotiation chooses a slower speed. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 153 + +The description text interface subcommand lets you add a text description to the interface. For instance, if you have good reason to configure the speed and duplex on a port, maybe add a description that says why you did. Example 7-1 shows how to configure duplex and speed, as well as the description command, which is simply a text description that can be configured by the administrator. + +Example 7-1 Configuring speed, duplex, and description on Switch Emma + +Emma# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Emma(config)# interface FastEthernet 0/1 +Emma(config-if)# duplex full +Emma(config-if)# speed 100 +Emma(config-if)# description Printer on 3rd floor, Preset to 100/full +Emma(config-if)# exit +Emma(config)# interface range FastEthernet 0/11 - 20 +Emma(config-if-range)# description end-users connect here +Emma(config-if-range)# ^Z +Emma# + + +First, focus on the mechanics of moving around in configuration mode again by looking closely at the command prompts. The various interface commands move the user from +global mode into interface configuration mode for a specific interface. For instance, the 7 example configures the duplex, speed, and description commands all just after the interface FastEthernet 0/1 command, which means that all three of those configuration settings apply +to interface Fa0/1, and not to the other interfaces. + +The show interfaces status command lists much of the detail configured in Example 7-1, even with only one line of output per interface. Example 7-2 shows an example, just after the configuration in Example 7-1 was added to the switch. + +Example 7-2 Displaying Interface Status + +Emma# show interfaces status + +Port Name +Fa0/1 Printer on 3rd floo +Fa0/2 +Fa0/3 +Fa0/4 +Fa0/5 +Fa0/6 +Fa0/7 +Fa0/8 +Fa0/9 +Fa0/10 +Fa0/11 end-users connect +Fa0/12 end-users connect +Fa0/13 end-users connect +Fa0/14 end-users connect + +Status Vlan +notconnect 1 +notconnect 1 +notconnect 1 +connected 1 +notconnect 1 +connected 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 + +Duplex Speed Type +full 100 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +154 CCNA 200-301 Official Cert Guide, Volume 1 + + +Fa0/15 end-users connect +Fa0/16 end-users connect +Fa0/17 end-users connect +Fa0/18 end-users connect +Fa0/19 end-users connect +Fa0/20 end-users connect +Fa0/21 +Fa0/22 +Fa0/23 +Fa0/24 +Gi0/1 +Gi0/2 + +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 + +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100/1000BaseTX +auto auto 10/100/1000BaseTX + + + +Working through the output in the example: + +FastEthernet 0/1 (Fa0/1): This output lists the first few characters of the configured description. It also lists the configured speed of 100 and duplex full per the speed and duplex commands in Example 7-1. However, it also states that Fa0/1 has a status of not-connect, meaning that the interface is not currently working. (That switch port did not have a cable connected when collecting this example, on purpose.) +FastEthernet 0/2 (Fa0/2): Example 7-1 did not configure this port at all. This port had all default configuration. Note that the “auto” text under the speed and duplex heading means that this port will attempt to autonegotiate both settings when the port comes up. However, this port also does not have a cable connected (again on purpose, for comparison). +FastEthernet 0/4 (Fa0/4): Like Fa0/2, this port has all default configuration but was cabled to another working device to give yet another contrasting example. This device completed the autonegotiation process, so instead of “auto” under the speed and duplex headings, the output lists the negotiated speed and duplex (a-full and a-100). Note that the text includes the a- to mean that the listed speed and duplex values were autonegotiated. + +Configuring Multiple Interfaces with the interface range Command The bottom of the configuration in Example 7-1 shows a way to shorten your configuration work when making the same setting on multiple consecutive interfaces. To do so, use the interface range command. In the example, the interface range FastEthernet 0/11 - 20 com-mand tells IOS that the next subcommand(s) apply to interfaces Fa0/11 through Fa0/20. You +can define a range as long as all interfaces are the same type and are numbered consecutively. + + +NOTE This book spells out all parameters fully to avoid confusion. However, most every-one abbreviates what they type in the CLI to the shortest unique abbreviation. For instance, the configuration commands int f0/1 and int ran f0/11 - 20 would also be acceptable. + +IOS does not actually put the interface range command into the configuration. Instead, it acts as if you had typed the subcommand under every single interface in the specified + +Answers to the “Do I Know This Already?” quiz: 1 F 2 E 3 A, D 4 A, B, D 5 A, D 6 D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 155 + +range. Example 7-3 shows an excerpt from the show running-config command, listing the configuration of interfaces F0/11–12 from the configuration in Example 7-1. The example shows the same description command on both interfaces; to save space, the example does not bother to show all 10 interfaces that have the same description text. + +Example 7-3 How IOS Expands the Subcommands Typed After interface range + +Emma# show running-config +! Lines omitted for brevity +interface FastEthernet0/11 +description end-users connect here +! +interface FastEthernet0/12 +description end-users connect here +! Lines omitted for brevity + + + +Administratively Controlling Interface State with shutdown +As you might imagine, network engineers need a way to bring down an interface without having to travel to the switch and remove a cable. In short, we need to be able to decide which ports should be enabled and which should be disabled. + +In an odd turn of phrase, Cisco uses two interface subcommands to configure the idea of administratively enabling and disabling an interface: the shutdown command (to disable) and the no shutdown command (to enable). While the no shutdown command might seem like an odd command to enable an interface at first, you will use this command a lot in the lab, and it will become second nature. (Most people, in fact, use the abbreviations shut and no shut.) + +Example 7-4 shows an example of disabling an interface using the shutdown interface sub-command. In this case, switch SW1 has a working interface F0/1. The user connects at the console and disables the interface. IOS generates a log message each time an interface fails or +recovers, and log messages appear at the console, as shown in the example. + + + + + + + +7 + + +Example 7-4 Administratively Disabling an Interface with shutdown + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# interface fastEthernet 0/1 +SW1(config-if)# shutdown +SW1(config-if)# +*Mar 2 03:02:19.701: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down +*Mar 2 03:02:20.708: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down + + +To bring the interface back up again, all you have to do is follow the same process but use the no shutdown command instead. + +Before leaving the simple but oddly named shutdown/no shutdown commands, take a look at two important show commands that list the status of a shutdown interface. The show + + +|||||||||||||||||||| +|||||||||||||||||||| + + +156 CCNA 200-301 Official Cert Guide, Volume 1 + +interfaces status command lists one line of output per interface, and when shut down, lists the interface status as “disabled.” That makes logical sense to most people. The show interfaces command (without the status keyword) lists many lines of output per interface, giving a much more detailed picture of interface status and statistics. With that command, the interface status comes in two parts, with one part using the phrase “administratively down,” matching the highlighted log message in Example 7-4. + +Example 7-5 shows an example of each of these commands. Note that both examples also use the F0/1 parameter (short for Fast Ethernet0/1), which limits the output to the messages about F0/1 only. Also note that F0/1 is still shut down at this point. + +Example 7-5 The Different Status Information About Shutdown in Two Different show Commands + +SW1# show interfaces f0/1 status + + +Port Name +Fa0/1 + +Status Vlan +disabled 1 + +Duplex Speed Type +auto auto 10/100BaseTX + + +SW1# show interfaces f0/1 +FastEthernet0/1 is administratively down, line protocol is down (disabled) +Hardware is Fast Ethernet, address is 1833.9d7b.0e81 (bia 1833.9d7b.0e81) +MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +Auto-duplex, Auto-speed, media type is 10/100BaseTX +input flow-control is off, output flow-control is unsupported +ARP type: ARPA, ARP Timeout 04:00:00 +Last input never, output 00:00:36, output hang never +Last clearing of "show interface" counters never +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo +Output queue: 0/40 (size/max) +5 minute input rate 0 bits/sec, 0 packets/sec +5 minute output rate 0 bits/sec, 0 packets/sec +164 packets input, 13267 bytes, 0 no buffer +Received 164 broadcasts (163 multicasts) +0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 watchdog, 163 multicast, 0 pause input +0 input packets with dribble condition detected +66700 packets output, 5012302 bytes, 0 underruns +0 output errors, 0 collisions, 1 interface resets +0 unknown protocol drops +0 babbles, 0 late collision, 0 deferred +0 lost carrier, 0 no carrier, 0 pause output +0 output buffer failures, 0 output buffers swapped out + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 157 + +Removing Configuration with the no Command +One purpose for the specific commands shown in Part II of the book is to teach you about that command. In some cases, the commands are not the end goal, and the text is attempting to teach you something about how the CLI works. This next short topic is more about the process than about the commands. + +With some IOS configuration commands (but not all), you can revert to the default set-ting by issuing a no version of the command. What does that mean? Let me give you a few examples: + +■ If you earlier had configured speed 100 on an interface, the no speed command on that same interface reverts to the default speed setting (which happens to be speed auto). +■ Same idea with the duplex command: an earlier configuration of duplex half or duplex full, followed by no duplex on the same interface, reverts the configuration back to the default of duplex auto. +■ If you had configured a description command with some text, to go back to the default state of having no description command at all for that interface, use the no description command. + +Example 7-6 shows the process. In this case, switch SW1’s F0/2 port has been configured with speed 100, duplex half, description link to 2901-2, and shutdown. You can see +evidence of all four settings in the command that begins the example. (This command lists +the running-config, but only the part for that one interface.) The example then shows the 7 +no versions of those commands and closes with a confirmation that all the commands have reverted to default. + +Example 7-6 Removing Various Configuration Settings Using the no Command + +SW1# show running-config interface f0/2 +Building configuration... + +Current configuration : 95 bytes +! +interface FastEthernet0/2 +description link to 2901-2 +shutdown +speed 100 +duplex half +end + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# interface fastethernet 0/2 +SW1(config-if)# no speed +SW1(config-if)# no duplex +SW1(config-if)# no description +SW1(config-if)# no shutdown + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +158 CCNA 200-301 Official Cert Guide, Volume 1 + +SW1(config-if)# ^Z +SW1# +SW1# show running-config interface f0/2 +Building configuration... +Current configuration : 33 bytes +! +interface FastEthernet0/2 +end +SW1# + + + +NOTE The show running-config and show startup-config commands typically do not dis-play default configuration settings, so the absence of commands listed under interface F0/2 at the end of the example means that those commands now use default values. + + +Autonegotiation +For any 10/100 or 10/100/1000 interfaces—that is, interfaces that can run at different speeds—Cisco Catalyst switches default to a setting of duplex auto and speed auto. As a result, those interfaces attempt to automatically determine the speed and duplex setting to use. Alternatively, you can configure most devices, switch interfaces included, to use a spe-cific speed and/or duplex. + +In practice, using autonegotiation is easy: just leave the speed and duplex at the default set-ting, and let the switch port negotiate what settings to use on each port. However, problems can occur due to unfortunate combinations of configuration. Therefore, this next topic walks through more detail about the concepts behind autonegotiation, so you know better how to interpret the meaning of the switch show commands and when to choose to use a particular configuration setting. + +Autonegotiation Under Working Conditions +Ethernet devices on the ends of a link must use the same standard; otherwise, they can-not correctly send data. For example, a NIC cannot use 100BASE-T, which uses a two-pair UTP cable with a 100-Mbps speed, while the switch port on the other end of the link uses +1000BASE-T. Even if you used a cable that works with Gigabit Ethernet, the link would not work with one end trying to send at 100 Mbps while the other tried to receive the data at 1000 Mbps. + +Upgrading to new and faster Ethernet standards becomes a problem because both ends have to use the same standard. For example, if you replace an old PC with a new one, the old one might have been using 100BASE-T while the new one uses 1000BASE-T. The switch port on the other end of the link needs to now use 1000BASE-T, so you upgrade the switch. If that switch had ports that would use only 1000BASE-T, you would need to upgrade all the other PCs connected to the switch. So, having both PC network interface cards (NIC) and switch ports that support multiple standards/speeds makes it much easier to migrate to the next better standard. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 159 + +The IEEE autonegotiation protocol helps makes it much easier to operate a LAN when NICs and switch ports support multiple speeds. IEEE autonegotiation (IEEE standard 802.3u) defines a protocol that lets the two UTP-based Ethernet nodes on a link negotiate so that they each choose to use the same speed and duplex settings. The protocol messages flow outside the normal Ethernet electrical frequencies as out-of-band signals over the UTP cable. Basically, each node states what it can do, and then each node picks the best options that both nodes support: the fastest speed and the best duplex setting, with full duplex being better than half duplex. + +NOTE Autonegotiation relies on the fact that the IEEE uses the same wiring pinouts for 10BASE-T and 100BASE-T, and that 1000BASE-T simply adds to those pinouts, adding two pairs. + +Many networks use autonegotiation every day, particularly between user devices and the access layer LAN switches, as shown in Figure 7-1. The company installed four-pair cabling of the right quality to support 1000BASE-T, to be ready to support Gigabit Ethernet. As a result, the wiring supports 10-Mbps, 100-Mbps, and 1000-Mbps Ethernet options. Both nodes on each link send autonegotiation messages to each other. The switch in this case has all 10/100/1000 ports, while the PC NICs support different options. + +Autonegotiation Enabled +10 10/100 10/100/1000 7 + +1 + + +Result: 10 Full + + +10/100/1000 + +2 + + +Result: 100 Full + + +10/100/1000 + +3 + + +Result: 1000 Full + + +10/100/1000 + + + + + +Autonegotiation Enabled, 10/100/1000 Ports + +Figure 7-1 IEEE Autonegotiation Results with Both Nodes Working Correctly + +The following list breaks down the logic, one PC at a time: + +PC1: The switch port claims it can go as fast as 1000 Mbps, but PC1’s NIC claims a top speed of 10 Mbps. Both the PC and the switch choose the fastest speed that each sup-ports (10 Mbps) and the best duplex that each supports (full). +PC2: PC2 claims a best speed of 100 Mbps, which means it can use 10BASE-T or 100BASE-T. The switch port and NIC negotiate to use the best speed of 100 Mbps and full duplex. +PC3: It uses a 10/100/1000 NIC, supporting all three speeds and standards, so both the NIC and switch port choose 1000 Mbps and full duplex. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +160 CCNA 200-301 Official Cert Guide, Volume 1 + +Autonegotiation Results When Only One Node Uses Autonegotiation +Figure 7-1 shows the IEEE autonegotiation results when both nodes use the process. However, most Ethernet devices can disable autonegotiation, so it is just as important to know what happens when a node tries to use autonegotiation but the node gets no response. + +Disabling autonegotiation is not always a bad idea. For instance, many network engineers disable autonegotiation on links between switches and simply configure the desired speed and duplex on both switches. However, mistakes can happen when one device on an Ethernet predefines speed and duplex (and disables autonegotiation), while the device on the other end attempts autonegotiation. In that case, the link might not work at all, or it might just work poorly. + +NOTE Configuring both the speed and duplex on a Cisco Catalyst switch interface dis-ables autonegotiation. + +IEEE autonegotiation defines some rules (defaults) that nodes should use as defaults when autonegotiation fails—that is, when a node tries to use autonegotiation but hears nothing from the device. The rules: + +■ Speed: Use your slowest supported speed (often 10 Mbps). +■ Duplex: If your speed = 10 or 100, use half duplex; otherwise, use full duplex. + +Cisco switches can make a better choice than that base IEEE speed default because Cisco switches can actually sense the speed used by other nodes, even without IEEE autonegotia-tion. As a result, Cisco switches use this slightly different logic to choose the speed when autonegotiation fails: + +■ Speed: Sense the speed (without using autonegotiation), but if that fails, use the IEEE default (slowest supported speed, often 10 Mbps). +■ Duplex: Use the IEEE defaults: If speed = 10 or 100, use half duplex; otherwise, use full duplex. + + +NOTE Ethernet interfaces using speeds faster than 1 Gbps always use full duplex. + +Figure 7-2 shows three examples in which three users change their NIC settings and disable autonegotiation, while the switch (with all 10/100/1000 ports) attempts autonegotiation. That is, the switch ports all default to speed auto and duplex auto. The top of the figure shows the configured settings on each PC NIC, with the choices made by the switch listed next to each switch port. + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 161 + +Manual Settings, Autonegotiation Disabled + +10/100 +1 + +Settings: 100 Full + + + +Result: F0/1 100 Half + +10/100/1000 +2 + +Settings: 1000 Full + + + +Result: F0/2 1000 Full + +10/100 +3 + +Settings: 10 Half + + + +Result: F0/3 10 Half + + + + +Autonegotiation Enabled, 10/100/1000 Ports + +Figure 7-2 IEEE Autonegotiation Results with Autonegotiation Disabled on One Side + +Reviewing each link, left to right: + +■ PC1: The switch receives no autonegotiation messages, so it senses the electrical signal to learn that PC1 is sending data at 100 Mbps. The switch uses the IEEE default duplex based on the 100 Mbps speed (half duplex). +■ PC2: The switch uses the same steps and logic as with the link to PC1, except that the 7 switch chooses to use full duplex because the speed is 1000 Mbps. +■ PC3: The user picks poorly, choosing the slower speed (10 Mbps) and the worse duplex setting (half). However, the Cisco switch senses the speed without using IEEE autonego-tiation and then uses the IEEE duplex default for 10-Mbps links (half duplex). + +PC1 shows a classic and unfortunately common end result: a duplex mismatch. The two nodes (PC1 and SW1’s port G0/1) both use 100 Mbps, so they can send data. However, PC1, using full duplex, does not attempt to use carrier sense multiple access with collision detec-tion (CSMA/CD) logic and sends frames at any time. Switch port F0/1, with half duplex, does use CSMA/CD. As a result, switch port F0/1 will believe collisions occur on the link, even if none physically occur. The switch port will stop transmitting, back off, resend frames, and so on. As a result, the link is up, but it performs poorly. The upcoming section titled “Interface Speed and Duplex Issues” will revisit this problem with a focus on how to recognize the symptoms of a duplex mismatch. + +Autonegotiation and LAN Hubs +LAN hubs also impact how autonegotiation works. Basically, hubs do not react to autonego-tiation messages, and they do not forward the messages. As a result, devices connected to a hub must use the IEEE rules for choosing default settings, which often results in the devices using 10 Mbps and half duplex. + +Figure 7-3 shows an example of a small Ethernet LAN that uses a 20-year-old 10BASE-T hub. In this LAN, all devices and switch ports are 10/100/1000 ports. The hub supports only 10BASE-T. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +162 CCNA 200-301 Official Cert Guide, Volume 1 + + +1 1000 Full + +2 1000 Full SW1 + + +Result: 10 Half +Hub 1 + +Result: 10 Half + + +Result: 10 Half + + +3 + + +4 + + +Figure 7-3 IEEE Autonegotiation with a LAN Hub + +Note that the devices on the right need to use half duplex because the hub requires the use of the CSMA/CD algorithm to avoid collisions. + +NOTE If you would like to learn more about collision domains and the impact of these older LAN hubs, look to the companion website for Appendix K, “Analyzing Ethernet LAN Designs,” to the section titled “Ethernet Collision Domains.” + + +Analyzing Switch Interface Status and Statistics +Now that you have seen some of the ways to configure switch interfaces, the rest of the chapter takes a closer look at how to verify the interfaces work correctly. This section also looks at those more unusual cases in which the interface is working but not working well, as revealed by different interface status codes and statistics. + +Interface Status Codes and Reasons for Nonworking States +Cisco switches actually use two different sets of interface status codes—one set of two codes (words) that use the same conventions as do router interface status codes, and another set with a single code (word). Both sets of status codes can determine whether an interface is working. + +The switch show interfaces and show interfaces description commands list the two-code status named the line status and protocol status. The line status generally refers to whether Layer 1 is working, with protocol status generally referring to whether Layer 2 is working. + +NOTE This book refers to these two status codes in shorthand by just listing the two codes with a slash between them, such as up/up. + +The single-code interface status corresponds to different combinations of the traditional two-code interface status codes and can be easily correlated to those codes. For example, the show interfaces status command lists a single-word state of connected state for working interfaces, with the same meaning as the two-word up/up state seen with the show +interfaces and show interfaces description commands. Table 7-2 lists the code combinations and some root causes that could have caused a particular interface status. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 163 + +Table 7-2 LAN Switch Interface Status Codes + +Line Status Protocol Status + +Interface Typical Root Cause Status + + + +administratively down down + +disabled The shutdown command is configured on the interface. + + + +down down + + +up down + +down down (err-disabled) +up up + +notconnect + + +notconnect + +err-disabled + +connected + +No cable; bad cable; wrong cable pinouts; speed mismatch; neighboring device is (a) powered off, (b) shutdown, or (c) error disabled. +Not expected on LAN switch physical interfaces. + +Port security has disabled the interface. + +The interface is working. + + + +Examining the notconnect state for a moment, note that this state has many causes that have been mentioned through this book. For example, using incorrect cabling pinouts, instead +of the correct pinouts explained in Chapter 2, “Fundamentals of Ethernet LANs,” causes a problem. However, one topic can be particularly difficult to troubleshoot—the possibility for both speed and duplex mismatches, as explained in the next section. + +As you can see in the table, having a bad cable is just one of many reasons for the down/down +state (or notconnect, per the show interfaces status command). Some examples of the root 7 causes of cabling problems include the following: + +■ The installation of any equipment that uses electricity, even non-IT equipment, can inter-fere with the transmission on the cabling and make the link fail. +■ The cable could be damaged, for example, if it lies under carpet. If the user’s chair keeps squashing the cable, eventually the electrical signal can degrade. +■ Although optical cables do not suffer from electromagnetic interference (EMI), someone can try to be helpful and move a fiber-optic cable out of the way—bending it too much. A bend into too tight a shape can prevent the cable from transmitting bits (called macro-bending). + +For the other interface states listed in Table 7-2, only the up/up (connected) state needs more discussion. An interface can be in a working state, and it might really be working—or it might be working in a degraded state. The next few topics discuss how to examine an up/up (connected) interface to find out whether it is working well or having problems. + +Interface Speed and Duplex Issues +To discuss some of the speed and duplex issues, first consider the output from the show interfaces status and show interfaces commands as demonstrated in Example 7-7. The first of these commands lists a one-line summary of the interface status, while the second com-mand gives many details—but surprisingly, the briefer show interfaces status command tells us more about autonegotiation. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +164 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 7-7 Displaying Speed and Duplex Settings on Switch Interfaces + +SW1# show interfaces status + + +Port Name +Fa0/1 +Fa0/2 +Fa0/3 +Fa0/4 +Fa0/5 +Fa0/6 +Fa0/7 +Fa0/8 +Fa0/9 +Fa0/10 +Fa0/11 +Fa0/12 +Fa0/13 +Fa0/14 + +Status Vlan +notconnect 1 +notconnect 1 +notconnect 1 +connected 1 +connected 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 +connected 1 +connected 1 +connected 1 +disabled 1 + +Duplex Speed Type +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +a-full a-100 10/100BaseTX +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +a-full 10 10/100BaseTX +half 100 10/100BaseTX +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX + +! Lines omitted for brevity + +SW1# show interfaces fa0/13 +FastEthernet0/13 is up, line protocol is up (connected) +Hardware is Fast Ethernet, address is 0019.e86a.6f8d (bia 0019.e86a.6f8d) +MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +Full-duplex, 100Mbps, media type is 10/100BaseTX +input flow-control is off, output flow-control is unsupported +ARP type: ARPA, ARP Timeout 04:00:00 +Last input 00:00:05, output 00:00:00, output hang never +Last clearing of "show interface" counters never +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo +Output queue: 0/40 (size/max) +5 minute input rate 0 bits/sec, 0 packets/sec +5 minute output rate 0 bits/sec, 0 packets/sec +85022 packets input, 10008976 bytes, 0 no buffer +Received 284 broadcasts (0 multicast) +0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 watchdog, 281 multicast, 0 pause input +0 input packets with dribble condition detected +95226 packets output, 10849674 bytes, 0 underruns +0 output errors, 0 collisions, 1 interface resets + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 165 + +0 unknown protocol drops +0 babbles, 0 late collision, 0 deferred +0 lost carrier, 0 no carrier, 0 PAUSE output +0 output buffer failures, 0 output buffers swapped out + +Although both commands in the example can be useful, only the show interfaces status command implies how the switch determined the speed and duplex settings. The command output lists autonegotiated settings with a prefix of a- and the manually set values without the a- prefix. + +For example, consider ports Fa0/12 and Fa0/13 in the output of the show interfaces status command. For Fa0/13, a-full means full duplex as autonegotiated, whereas half on Fa0/12 means half duplex but as manually configured. The example shades the command output that implies that the switch’s Fa0/12 interface’s speed and duplex were not found through autonegotiation, but Fa0/13 did use autonegotiation. + +In comparison, note that the show interfaces fa0/13 command (without the status option) simply lists the speed and duplex for interface Fast Ethernet 0/13, with nothing implying that the values were learned through autonegotiation. + +When the IEEE autonegotiation process works on both devices—that is, both are send-ing autonegotiation messages—both devices agree to the fastest speed and best duplex supported by both devices. However, when one device uses autonegotiation and the other +disables it, the first device must resort to default settings as detailed earlier in section 7 “Autonegotiation Results When Only One Node Uses Autonegotiation.” As a reminder, +those defaults are + +■ Speed: Sense the speed (without using autonegotiation), but if that fails, use the IEEE default (slowest supported speed, often 10 Mbps). +■ Duplex: Use the IEEE defaults: If speed = 10 or 100, use half duplex; otherwise, use full duplex. + +When a switch must use its defaults, it should get the speed correct, but it may choose the wrong duplex setting, creating a duplex mismatch. + +For example, in Figure 7-4, imagine that SW2’s Gi0/2 interface was configured with the speed 100 and duplex full commands (these settings are not recommended on a Gigabit-capable interface, by the way). On Cisco switches, configuring both the speed and duplex commands disables IEEE autonegotiation on that port. If SW1’s Gi0/1 interface tries to use autonegotiation, SW1 would also use a speed of 100 Mbps, but default to use half duplex. Example 7-8 shows the results of this specific case on SW1. + + + +PC1 Fa0/11 Gi0/1 +SW1 + + +Gi0/2 Fa0/10 Fa0/1 +SW2 R1 + + + +0200.1111.1111 Autonegotiation Fails + +Autonegotiation 0200.0101.0101 Is Disabled + +speed 100 duplex full + + +Figure 7-4 Conditions to Create a Duplex Mismatch Between SW1 and SW2 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +166 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 7-8 Confirming Duplex Mismatch on Switch SW1 + +SW1# show interfaces gi0/1 status + + +Port Name +Gi0/1 + +Status Vlan +connected trunk + +Duplex Speed Type +a-half a-100 10/100/1000BaseTX + + + +First, note that even though SW1 had to use an autonegotiation default, the show interfaces status command still shows the speed and duplex with the a- prefix. SW2’s port was manu-ally set to 100/Full, so SW1 sensed the speed and runs at 100 Mbps; however, the autonego-tiation rules then tell SW1 to use half duplex, as confirmed by the output in Example 7-8. + +The output does not identify the duplex mismatch in any way; in fact, finding a duplex mismatch can be much more difficult than finding a speed mismatch. For instance, if you purposefully set the speed on the link in Figure 7-4 to be 10 Mbps on one switch and 100 Mbps on the other, both switches would list the port in a down/down or notconnect state. However, in the case shown in Example 7-8, with a duplex mismatch, if the duplex settings do not match on the ends of an Ethernet segment, the switch interface will still be in a connected (up/up) or connected state. + +Not only does the show command give an appearance that the link has no issues, but the link will likely work poorly, with symptoms of intermittent problems. The reason is that the device using half duplex (SW1 in this case) uses carrier sense multiple access collision detect (CSMA/CD) logic, waiting to send when receiving a frame, believing collisions occur when they physically do not—and actually stopping sending a frame because the switch thinks a collision occurred. With enough traffic load, the interface could be in a connect state, but it’s extremely inefficient for passing traffic. + +To identify duplex mismatch problems, check the duplex setting on each end of the link to see if the values mismatch. You can also watch for incrementing collision and late collision counters, as explained in the next section. + +Common Layer 1 Problems on Working Interfaces +When the interface reaches the connect (up/up) state, the switch considers the interface to be working. The switch, of course, tries to use the interface, and at the same time, the switch keeps various interface counters. These interface counters can help identify problems that can occur even though the interface is in a connect state, like issues related to the duplex mismatch problem that was just described. This section explains some of the related con-cepts and a few of the most common problems. + +Whenever the physical transmission has problems, the receiving device might receive a frame whose bits have changed values. These frames do not pass the error detection logic as imple-mented in the FCS field in the Ethernet trailer, as covered in Chapter 2. The receiving device discards the frame and counts it as some kind of input error. Cisco switches list this error as a CRC error, as highlighted in Example 7-9. (Cyclic redundancy check [CRC] is a term related to how the frame check sequence [FCS] math detects an error.) + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 167 + +Example 7-9 Interface Counters for Layer 1 Problems + +SW1# show interfaces fa0/13 +! lines omitted for brevity +Received 284 broadcasts (0 multicast) +0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 watchdog, 281 multicast, 0 pause input +0 input packets with dribble condition detected +95226 packets output, 10849674 bytes, 0 underruns +0 output errors, 0 collisions, 1 interface resets +0 unknown protocol drops +0 babbles, 0 late collision, 0 deferred +0 lost carrier, 0 no carrier, 0 PAUSE output +0 output buffer failures, 0 output buffers swapped out + + +The number of input errors and the number of CRC errors are just a few of the counters in the output of the show interfaces command. The challenge is to decide which counters you need to think about, which ones show that a problem is happening, and which ones are nor-mal and of no concern. + +The example highlights several of the counters as examples so that you can start to under- +stand which ones point to problems and which ones are just counting normal events that are 7 not problems. The following list shows a short description of each highlighted counter, in the +order shown in the example: + +Runts: Frames that did not meet the minimum frame size requirement (64 bytes, including the 18-byte destination MAC, source MAC, type, and FCS). Can be caused by collisions. +Giants: Frames that exceed the maximum frame size requirement (1518 bytes, including the 18-byte destination MAC, source MAC, type, and FCS). +Input Errors: A total of many counters, including runts, giants, no buffer, CRC, frame, overrun, and ignored counts. +CRC: Received frames that did not pass the FCS math; can be caused by collisions. +Frame: Received frames that have an illegal format, for example, ending with a partial byte; can be caused by collisions. +Packets Output: Total number of packets (frames) forwarded out the interface. +Output Errors: Total number of packets (frames) that the switch port tried to transmit, but for which some problem occurred. +Collisions: Counter of all collisions that occur when the interface is transmitting a frame. +Late Collisions: The subset of all collisions that happen after the 64th byte of the frame has been transmitted. (In a properly working Ethernet LAN, collisions should occur within the first 64 bytes; late collisions today often point to a duplex mismatch.) +Note that many of these counters occur as part of the CSMA/CD process used when half duplex is enabled. Collisions occur as a normal part of the half-duplex logic imposed by CSMA/CD, so a switch interface with an increasing collisions counter might not even have a + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +168 CCNA 200-301 Official Cert Guide, Volume 1 + +problem. However, one problem, called late collisions, points to the classic duplex mismatch problem. + +If a LAN design follows cabling guidelines, all collisions should occur by the end of the 64th byte of any frame. When a switch has already sent 64 bytes of a frame, and the switch receives a frame on that same interface, the switch senses a collision. In this case, the colli-sion is a late collision, and the switch increments the late collision counter in addition to the usual CSMA/CD actions to send a jam signal, wait a random time, and try again. + +With a duplex mismatch, like the mismatch between SW1 and SW2 in Figure 7-4, the half-duplex interface will likely see the late collisions counter increment. Why? The half-duplex interface sends a frame (SW1), but the full-duplex neighbor (SW2) sends at any time, even after the 64th byte of the frame sent by the half-duplex switch. So, just keep repeating the show interfaces command, and if you see the late collisions counter incrementing on a half-duplex interface, you might have a duplex mismatch problem. + +A working interface (in an up/up state) can still suffer from issues related to the physical cabling as well. The cabling problems might not be bad enough to cause a complete failure, but the transmission failures result in some frames failing to pass successfully over the cable. For example, excessive interference on the cable can cause the various input error counters to keep growing larger, especially the CRC counter. In particular, if the CRC errors grow, but the collisions counters do not, the problem might simply be interference on the cable. (The switch counts each collided frame as one form of input error as well.) + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element section titled “Step 2: Build Your Study Habits Around the Chapter” for more details. Table 7-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 7-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review command tables + +Review memory tables + +Do labs + +Resource Used Book, website +Book, website + +Book, PTP + +Book + +Website + +Sim Lite, blog + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 7: Configuring and Verifying Switch Interfaces 169 + +Review All the Key Topics + +Table 7-4 Key Topics for Chapter 7 + +Key Topic Element +Example 7-1 + +Example 7-4 + +List + +Table 7-2 + +Example 7-7 + +List + +List + +Description Page Number +Example of configuring speed, duplex, and description 153 + +Example of disabling an interface using the shutdown command 155 + +Key decision rules for autonegotiation on Cisco switches when 160 the other device does not participate +Two types of interface state terms and their meanings 163 + +Example that shows how to find the speed and duplex settings, 164 as well as whether they were learned through autonegotiation +Defaults for IEEE autonegotiation 165 + +Explanations of different error statistics on switch interfaces 167 + + + +Key Terms You Should Know +port security, autonegotiation, full duplex, half duplex, 10/100, 10/100/1000 +Do Labs 7 The Sim Lite software is a version of Pearson’s full simulator learning product with a subset +of the labs, included free with this book. The subnet of labs mostly relate to this part. Take the time to try some of the labs. As always, also check the author’s blog site pages for con-figuration exercises (Config Labs) at https://blog.certskills.com. + +Command References +Tables 7-5 and 7-6 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table 7-5 Switch Interface Configuration + +Command +interface type port-number + + + +interface range type port-number - end-port-number + +Mode/Purpose/Description +Changes context to interface mode. The type is typically Fast Ethernet or Gigabit Ethernet. The possible port numbers vary depending on the model of switch—for example, Fa0/1, Fa0/2, and so on. +Changes the context to interface mode for a range of consecutively numbered interfaces. The subcommands that follow then apply to all interfaces in the range. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +170 CCNA 200-301 Official Cert Guide, Volume 1 + + +Command +shutdown | no shutdown + +speed {10 | 100 | 1000 | auto} + +duplex {auto | full | half} + +description text + + +no duplex + +no speed + +no description + +Mode/Purpose/Description +Interface mode. Disables or enables the interface, respectively. +Interface mode. Manually sets the speed to the listed speed or, with the auto setting, automatically negotiates the speed. +Interface mode. Manually sets the duplex to half or full, or to autonegotiate the duplex setting. +Interface mode. Lists any information text that the engineer wants to track for the interface, such as the expected device on the other end of the cable. +Reverts to the default setting for each interface subcommand of speed auto, duplex auto, and the absence of a description command. + + + +Table 7-6 Chapter 7 EXEC Command Reference + +Command +show running-config + +show running-config | interface type number +show mac address-table dynamic [interface type number] [vlan vlan-id] + +show mac address-table static [interface type number] + +show interfaces [type number] status + + + +show interfaces [type number] + +show interfaces description + +Purpose +Lists the currently used configuration + +Displays the running-configuration excerpt of the listed interface and its subcommands only + +Lists the dynamically learned entries in the switch’s address (forwarding) table, with subsets by interface and/or VLAN +Lists static MAC addresses and MAC addresses learned or defined with port security +Lists one output line per interface (or for only the listed interface if included), noting the description, operating state, and settings for duplex and speed on each interface +Lists detailed status and statistical information about all interfaces (or the listed interface only) +Displays one line of information per interface, with a two-item status (similar to the show interfaces command status), and includes any description that is configured on the interfaces + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part II Review + +Keep track of your part review progress with the checklist shown in Table P2-1. Details on each task follow the table. + +Table P2-1 Part II Part Review Checklist + +Activity 1st Date Completed 2nd Date Completed Repeat All DIKTA Questions +Answer Part Review Questions + +Review Key Topics + +Do Labs + +Review Appendix P on the Companion Website +Videos + + +Repeat All DIKTA Questions +For this task, answer the “Do I Know This Already?” questions again for the chapters in this part of the book, using the PCPT software. + +Answer Part Review Questions +For this task, answer the Part Review questions for this part of the book, using the PTP software. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Labs +Depending on your chosen lab tool, here are some suggestions for what to do in lab: + +Pearson Network Simulator: If you use the full Pearson ICND1 or CCNA simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) + +Blog: Config Labs: The author’s blog includes a series of configuration-focused labs that you can do on paper, each in 10–15 minutes. Review and perform the labs for this part of the book, as found at http://blog.certskills.com. Then navigate to the Hands-on Config labs. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Other: If using other lab tools, as a few suggestions: Make sure to experiment heavily with VLAN configuration and VLAN trunking configuration. Also, spend some time changing interface settings like speed and duplex on a link between two switches, to make sure that you understand which cases would result in a duplex mismatch. + +Review Appendix P on the Companion Website +The previous edition of the CCNA exam blueprint included the word “troubleshoot” as applied to Ethernet and VLANs, while the current CCNA exam blueprint does not. +Appendix P on the companion website contains a chapter from the previous edition of the book that focused on troubleshooting. That appendix, named “LAN Troubleshooting,” can be useful as a tool to review the topics in this part of the book. (Note that if you use this extra appendix, you can ignore the mentions of Port Security until you have reached that topic in the CCNA 200-301 Official Cert Guide, Volume 2.) + +Watch Videos +Chapters 4 and 5 each recommend a video that can be helpful to anyone who is just learn-ing about the Cisco CLI and basic switching concepts. If you have not watched those videos yet, take a moment to navigate to the companion website and watch the videos (listed under Chapters 4 and 5). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +Part II of this book introduces the basics of Ethernet LANs, both in concept and in how to implement the features. However, the two primary features discussed in Part III of this book—Virtual LANs (VLANs) and Spanning Tree Protocol (STP)—impact almost every-thing you have learned about Ethernet so far. VLANs allow a network engineer to create +separate Ethernet LANs through simple configuration choices. The ability to separate some switch ports into one VLAN and other switch ports into another VLAN gives network designers a powerful tool for creating networks. Once created, VLANs also have a huge impact on how a switch works, which then impacts how you verify and troubleshoot the operation of a campus LAN. + +STP—and the related and similar Rapid STP (RSTP)—acts to prevent frames from looping around a LAN. Without STP or RSTP, in LANs with redundant links, broadcasts and some other frames would be forwarded around and around the LAN, eventually clogging the LAN so much as to make it unusable. + +The current CCNA 200-301 exam blueprint includes exam topics for the configuration and verification of VLANs and related topics. However, the CCNA exam topics only men-tion RSTP concepts rather than configuration/verification. To that end, Part III opens with Chapter 8, which goes to the configuration/verification depth with VLAN topics, followed by Chapter 9, which introduces the concepts of STP and RSTP. + +Part III closes with Chapter 10, which includes some RSTP configuration, along with Layer 2 EtherChannel configuration. + +Other Resources + +As one additional suggestion for those who intend to move on to CCNP Enterprise, con-sider skimming or reading Appendix P, “LAN Troubleshooting,” found on the online com-panion website. This appendix, a copy of a chapter from the previous edition of the book, takes a troubleshooting approach to many of the topics found in Parts II and III of this book. Although Cisco completely removed the word troubleshoot from the CCNA exam blueprint in its current CCNA 200-301 version, the topics still remain relevant and can be a help for reviewing and refining what you learned in Parts II and III of this book. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part III + + +Implementing VLANs and STP + + + + +Chapter 8: Implementing Ethernet Virtual LANs + +Chapter 9: Spanning Tree Protocol Concepts + +Chapter 10: RSTP and EtherChannel Configuration + +Part III Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 8 + + +Implementing Ethernet Virtual LANs + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.13 Describe switching concepts + +1.13.a MAC learning and aging + +1.13.b Frame switching + +1.13.c Frame flooding + +1.13.d MAC address table + +2.0 Network Access +2.1 Configure and verify VLANs (normal range) spanning multiple switches + +2.1.a Access ports (data and voice) + +2.1.b Default VLAN + +2.1.c Connectivity + +2.2 Configure and verify interswitch connectivity + +2.2.a Trunk ports + +2.2.b 802.1Q + +2.2.c Native VLAN + +So far in this book, you have learned that Ethernet switches receive Ethernet frames, make decisions, and then forward (switch) those Ethernet frames. That core logic revolves around MAC addresses, the interface in which the frame arrives, and the interfaces out which the switch forwards the frame. + +While true, that logic omits any consideration of virtual LANs (VLANs). VLANs impact the switching logic for each frame because each VLAN acts as a subset of the switch ports in an Ethernet LAN. Switches believe each Ethernet frame to be received in an identifiable VLAN, forwarded based on MAC table entries for that VLAN, and forwarded out ports in that VLAN. This chapter explores those concepts and others related to VLANs. + +As for the organization of the chapter, the first major section of the chapter explains the core concepts. These concepts include how VLANs work on a single switch, how to use VLAN trunking to create VLANs that span across multiple switches, and how to forward traffic between VLANs using a router. The second major section shows how to configure VLANs and VLAN trunks: how to statically assign interfaces to a VLAN. The final major section discusses some issues that can arise when using VLANs and trunks and how to avoid those issues. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 8-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Virtual LAN Concepts +VLAN and VLAN Trunking Configuration and Verification + +Troubleshooting VLANs and VLAN Trunks + +Questions 1–3 +4–6 + +7–8 + + + +1. In a LAN, which of the following terms best equates to the term VLAN? a. Collision domain +b. Broadcast domain c. Subnet +d. Single switch e. Trunk +2. Imagine a switch with three configured VLANs. How many IP subnets are required, assuming that all hosts in all VLANs want to use TCP/IP? +a. 0 b. 1 c. 2 d. 3 +e. You cannot tell from the information provided. + +3. Switch SW1 sends a frame to switch SW2 using 802.1Q trunking. Which of the answers describes how SW1 changes or adds to the Ethernet frame before forwarding the frame to SW2? +a. Inserts a 4-byte header and does change the MAC addresses +b. Inserts a 4-byte header and does not change the MAC addresses +c. Encapsulates the original frame behind an entirely new Ethernet header d. None of the other answers are correct + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +178 CCNA 200-301 Official Cert Guide, Volume 1 + +4. Imagine that you are told that switch 1 is configured with the dynamic auto parameter for trunking on its Fa0/5 interface, which is connected to switch 2. You have to con-figure switch 2. Which of the following settings for trunking could allow trunking to work? (Choose two answers.) +a. on +b. dynamic auto +c. dynamic desirable d. access +e. None of the other answers are correct. + +5. A switch has just arrived from Cisco. The switch has never been configured with any VLANs, but VTP has been disabled. An engineer configures the vlan 22 and name Hannahs-VLAN commands and then exits configuration mode. Which of the follow-ing are true? (Choose two answers.) +a. VLAN 22 is listed in the output of the show vlan brief command. +b. VLAN 22 is listed in the output of the show running-config command. c. VLAN 22 is not created by this process. +d. VLAN 22 does not exist in that switch until at least one interface is assigned to that VLAN. + +6. Which of the following commands identify switch interfaces as being trunking inter-faces: interfaces that currently operate as VLAN trunks? (Choose two answers.) +a. show interfaces +b. show interfaces switchport c. show interfaces trunk +d. show trunks + +7. In a switch that disables VTP, an engineer configures the commands vlan 30 and shutdown vlan 30. Which answers should be true about this switch? (Choose two answers.) +a. The show vlan brief command should list VLAN 30. +b. The show running-config command should list VLAN 30. +c. The switch should forward frames that arrive in access ports in VLAN 30. +d. The switch should forward frames that arrive in trunk ports tagged with VLAN 30. + +8. The show interfaces g0/1 trunk command provides three lists of VLAN IDs. Which items would limit the VLANs that appear in the first of the three lists of VLANs? + +a. A shutdown vlan 30 global command +b. A switchport trunk allowed vlan interface subcommand c. An STP choice to block on G0/1 +d. A no vlan 30 global command + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 179 + +Foundation Topics + +Virtual LAN Concepts +Before understanding VLANs, you must first have a specific understanding of the definition of a LAN. For example, from one perspective, a LAN includes all the user devices, servers, switches, routers, cables, and wireless access points in one location. However, an alternative narrower definition of a LAN can help in understanding the concept of a virtual LAN: + +A LAN includes all devices in the same broadcast domain. +A broadcast domain includes the set of all LAN-connected devices, so that when any of the devices sends a broadcast frame, all the other devices get a copy of the frame. So, from one perspective, you can think of a LAN and a broadcast domain as being basically the same thing. + +Using only default settings, a switch considers all its interfaces to be in the same broadcast domain. That is, for one switch, when a broadcast frame entered one switch port, the switch forwards that broadcast frame out all other ports. With that logic, to create two different LAN broadcast domains, you had to buy two different Ethernet LAN switches, as shown in Figure 8-1. + + +Broadcast Domain 1 Dino + +Broadcast Wilma Domain 2 + + + +Fred SW1 Subnet 1 + + +SW2 Betty +Subnet 2 + + +Figure 8-1 Creating Two Broadcast Domains with Two Physical Switches and No VLANs 8 + +By using two VLANs, a single switch can accomplish the same goals of the design in Figure 8-1—to create two broadcast domains—with a single switch. With VLANs, a switch can configure some interfaces into one broadcast domain and some into another, creating mul-tiple broadcast domains. These individual broadcast domains created by the switch are called virtual LANs (VLAN). + +For example, in Figure 8-2, the single switch creates two VLANs, treating the ports in each VLAN as being completely separate. The switch would never forward a frame sent by Dino (in VLAN 1) over to either Wilma or Betty (in VLAN 2). + + +Broadcast +Domain 1 Dino (VLAN 1) +Fred SW1 Subnet 1 + +Broadcast +Wilma Domain 2 (VLAN 2) +Betty +Subnet 2 + + +Figure 8-2 Creating Two Broadcast Domains Using One Switch and VLANs + +Designing campus LANs to use more VLANs, each with a smaller number of devices, often helps improve the LAN in many ways. For example, a broadcast sent by one host in a VLAN will be received and processed by all the other hosts in the VLAN—but not by hosts in a different VLAN. Limiting the number of hosts that receive a single broadcast frame reduces the number of hosts that waste effort processing unneeded broadcasts. It also reduces + + +|||||||||||||||||||| +|||||||||||||||||||| + + +180 CCNA 200-301 Official Cert Guide, Volume 1 + +security risks because fewer hosts see frames sent by any one host. These are just a few reasons for separating hosts into different VLANs. The following list summarizes the most common reasons for choosing to create smaller broadcast domains (VLANs): + +■ To reduce CPU overhead on each device, improving host performance, by reducing the number of devices that receive each broadcast frame +■ To reduce security risks by reducing the number of hosts that receive copies of frames that the switches flood (broadcasts, multicasts, and unknown unicasts) +■ To improve security for hosts through the application of different security policies per VLAN +■ To create more flexible designs that group users by department, or by groups that work together, instead of by physical location +■ To solve problems more quickly, because the failure domain for many problems is the same set of devices as those in the same broadcast domain +■ To reduce the workload for the Spanning Tree Protocol (STP) by limiting a VLAN to a single access switch + +The rest of this chapter looks closely at the mechanics of how VLANs work across multiple Cisco switches, including the required configuration. To that end, the next section examines VLAN trunking, a feature required when installing a VLAN that exists on more than one LAN switch. + +Creating Multiswitch VLANs Using Trunking +Configuring VLANs on a single switch requires only a little effort: you simply configure each port to tell it the VLAN number to which the port belongs. With multiple switches, you have to consider additional concepts about how to forward traffic between the switches. + +When you are using VLANs in networks that have multiple interconnected switches, the switches need to use VLAN trunking on the links between the switches. VLAN trunking causes the switches to use a process called VLAN tagging, by which the sending switch adds another header to the frame before sending it over the trunk. This extra trunking header includes a VLAN identifier (VLAN ID) field so that the sending switch can associate the frame with a particular VLAN ID, and the receiving switch can then know in what VLAN each frame belongs. + +Figure 8-3 shows an example that demonstrates VLANs that exist on multiple switches, but it does not use trunking. First, the design uses two VLANs: VLAN 10 and VLAN 20. Each switch has two ports assigned to each VLAN, so each VLAN exists in both switches. To forward traffic in VLAN 10 between the two switches, the design includes a link between +switches, with that link fully inside VLAN 10. Likewise, to support VLAN 20 traffic between switches, the design uses a second link between switches, with that link inside VLAN 20. + +The design in Figure 8-3 functions perfectly. For example, PC11 (in VLAN 10) can send a frame to PC14. The frame flows into SW1, over the top link (the one that is in VLAN 10) and over to SW2. + +Answers to the “Do I Know This Already?” quiz: 1 B 2 D 3 B 4 A, C 5 A, B 6 B, C 7 A, B 8 B + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 181 + +VLAN 10 + +11 12 13 14 + + +Link is in VLAN 10 + +SW1 SW2 Link is in VLAN 20 + +21 22 23 24 + +VLAN 20 + +Figure 8-3 Multiswitch VLAN Without VLAN Trunking + +The design shown in Figure 8-3 works, but it simply does not scale very well. It requires one physical link between switches to support every VLAN. If a design needed 10 or 20 VLANs, you would need 10 or 20 links between switches, and you would use 10 or 20 switch ports (on each switch) for those links. + +VLAN Tagging Concepts +VLAN trunking creates one link between switches that supports as many VLANs as you need. As a VLAN trunk, the switches treat the link as if it were a part of all the VLANs. At the same time, the trunk keeps the VLAN traffic separate, so frames in VLAN 10 would not go to devices in VLAN 20, and vice versa, because each frame is identified by VLAN num-ber as it crosses the trunk. Figure 8-4 shows the idea, with a single physical link between the two switches. +VLAN 10 8 + + + + +SW1 20 10 20 10 20 SW2 + + + + +VLAN 20 + +Figure 8-4 Multiswitch VLAN with Trunking + +The use of trunking allows switches to forward frames from multiple VLANs over a single physical connection by adding a small header to the Ethernet frame. For example, Figure +8-5 shows PC11 sending a broadcast frame on interface Fa0/1 at Step 1. To flood the frame, switch SW1 needs to forward the broadcast frame to switch SW2. However, SW1 needs to let SW2 know that the frame is part of VLAN 10, so that after the frame is received, SW2 will flood the frame only into VLAN 10, and not into VLAN 20. So, as shown at Step 2, before sending the frame, SW1 adds a VLAN header to the original Ethernet frame, with the VLAN header listing a VLAN ID of 10 in this case. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +182 CCNA 200-301 Official Cert Guide, Volume 1 + +VLAN 10 VLAN 10 + +11 13 14 + +Ethernet 1 + +0/1 3 Ethernet 0/1 0/2 3 +G0/1 G0/2 +20 10 20 10 20 +SW1 SW2 VLAN 10 Ethernet +0/3 0/4 2 0/3 0/4 + + +21 22 23 24 + +VLAN 20 VLAN 20 + +Figure 8-5 VLAN Trunking Between Two Switches + +When SW2 receives the frame, it understands that the frame is in VLAN 10. SW2 then removes the VLAN header, forwarding the original frame out its interfaces in VLAN 10 (Step 3). + +For another example, consider the case when PC21 (in VLAN 20) sends a broadcast. SW1 sends the broadcast out port Fa0/4 (because that port is in VLAN 20) and out Gi0/1 (because it is a trunk, meaning that it supports multiple different VLANs). SW1 adds a +trunking header to the frame, listing a VLAN ID of 20. SW2 strips off the trunking header after determining that the frame is part of VLAN 20, so SW2 knows to forward the frame out only ports Fa0/3 and Fa0/4, because they are in VLAN 20, and not out ports Fa0/1 and Fa0/2, because they are in VLAN 10. + +The 802.1Q and ISL VLAN Trunking Protocols +Cisco has supported two different trunking protocols over the years: Inter-Switch Link (ISL) and IEEE 802.1Q. Cisco created the ISL years before 802.1Q, in part because the IEEE had not yet defined a VLAN trunking standard. Today, 802.1Q has become the more popular trunking protocol, with Cisco not even bothering to support ISL in many of its switch mod-els today. + +While both ISL and 802.1Q tag each frame with the VLAN ID, the details differ. 802.1Q inserts an extra 4-byte 802.1Q VLAN header into the original frame’s Ethernet header, as shown at the top of Figure 8-6. As for the fields in the 802.1Q header, only the 12-bit VLAN ID field inside the 802.1Q header matters for topics discussed in this book. This 12-bit field supports a theoretical maximum of 212 (4096) VLANs, but in practice it supports a maxi-mum of 4094. (Both 802.1Q and ISL use 12 bits to tag the VLAN ID, with two reserved values [0 and 4095].) + +Cisco switches break the range of VLAN IDs (1–4094) into two ranges: the normal range and the extended range. All switches can use normal-range VLANs with values from 1 to 1005. Only some switches can use extended-range VLANs with VLAN IDs from 1006 to 4094. The rules for which switches can use extended-range VLANs depend on the configuration +of the VLAN Trunking Protocol (VTP), which is discussed briefly in the section “VLAN Trunking Configuration,” later in this chapter. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 183 + +802.1Q + +Dest. Address Source Address Tag Type Data FCS + + + + +Type Priority Flag VLAN ID (12 Bits) + +Figure 8-6 802.1Q Trunking + +802.1Q also defines one special VLAN ID on each trunk as the native VLAN (defaulting to use VLAN 1). By definition, 802.1Q simply does not add an 802.1Q header to frames in the native VLAN. When the switch on the other side of the trunk receives a frame that does not have an 802.1Q header, the receiving switch knows that the frame is part of the native VLAN. Note that because of this behavior, both switches must agree on which VLAN is the native VLAN. + +The 802.1Q native VLAN provides some interesting functions, mainly to support connec-tions to devices that do not understand trunking. For example, a Cisco switch could be cabled to a switch that does not understand 802.1Q trunking. The Cisco switch could send frames in the native VLAN—meaning that the frame has no trunking header—so that the other switch would understand the frame. The native VLAN concept gives switches the capability of at least passing traffic in one VLAN (the native VLAN), which can allow some basic functions, like reachability to telnet into a switch. + +Forwarding Data Between VLANs +If you create a campus LAN that contains many VLANs, you typically still need all devices 8 +to be able to send data to all other devices. This next topic discusses some concepts about how to route data between those VLANs. + +The Need for Routing Between VLANs +LAN switches that forward data based on Layer 2 logic, as discussed so far in this book, often go by the name Layer 2 switch. For example, Chapter 5, “Analyzing Ethernet LAN Switching,” discussed how LAN switches receive Ethernet frames (a Layer 2 concept), look at the destination Ethernet MAC address (a Layer 2 address), and forward the Ethernet frame out some other interface. All those concepts are defined by Layer 2 protocols, hence the name Layer 2 switch. + +Layer 2 switches perform their logic per VLAN. For example, in Figure 8-7, the two PCs on the left sit in VLAN 10, in subnet 10. The two PCs on the right sit in a different VLAN +(20), with a different subnet (20). Note that the figure repeats earlier Figure 8-2, but with the switch broken into halves, to emphasize the point that Layer 2 switches will not forward data between two VLANs. + +As shown in the figure, when configured with some ports in VLAN 10 and others in VLAN 20, the switch acts like two separate switches in which it will forward traffic. In fact, one goal of VLANs is to separate traffic in one VLAN from another, preventing frames in one VLAN from leaking over to other VLANs. For example, when Dino (in VLAN 10) sends any Ethernet frame, if SW1 is a Layer 2 switch, that switch will not forward the frame to the PCs on the right in VLAN 20. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +184 CCNA 200-301 Official Cert Guide, Volume 1 + + +VLAN 10 Subnet 10 Dino + +Fred + +VLAN 20 Wilma Subnet 20 + +Betty + + +Figure 8-7 Layer 2 Switch Does Not Route Between the VLANs + +Routing Packets Between VLANs with a Router +When including VLANs in a campus LAN design, the devices in a VLAN need to be in the same subnet. Following the same design logic, devices in different VLANs need to be in dif-ferent subnets. + +To forward packets between VLANs, the network must use a device that acts as a router. You can use an actual router, as well as some other switches that can perform some functions like a router. These switches that also perform Layer 3 routing functions go by the name multilayer switch or Layer 3 switch. This section first discusses how to forward data between VLANs when using Layer 2 switches and ends with a brief discussion of how to use Layer 3 switches. + +For example, Figure 8-8 shows a router that can route packets between subnets 10 and 20. The figure shows the same Layer 2 switch as shown in Figure 8-7, with the same perspective of the switch being split into parts with two different VLANs, and with the same PCs in the same VLANs and subnets. Now Router R1 has one LAN physical interface connected to the switch and assigned to VLAN 10, and a second physical interface connected to the switch and assigned to VLAN 20. With an interface connected to each subnet, the Layer 2 switch can keep doing its job—forwarding frames inside a VLAN, while the router can do its job— routing IP packets between the subnets. + + +VLAN 10 Subnet 10 Dino + +Fred + +VLAN 20 Wilma Subnet 20 + +Betty + + + + + +F0/0 F0/1 + + +R1 + +Figure 8-8 Routing Between Two VLANs on Two Physical Interfaces + +The figure shows an IP packet being routed from Fred, which sits in one VLAN/subnet, to Betty, which sits in the other. The Layer 2 switch forwards two different Layer 2 Ethernet frames: one in VLAN 10, from Fred to R1’s F0/0 interface, and the other in VLAN 20, from R1’s F0/1 interface to Betty. From a Layer 3 perspective, Fred sends the IP packet to its default router (R1), and R1 routes the packet out another interface (F0/1) into another subnet where Betty resides. + +The design in Figure 8-8 works, but there are several different solutions for routing packets between VLANs. This chapter shows the option of using a separate physical router, with a + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 185 + +separate link per VLAN, because it can be the easiest of the options to understand and visu-alize. Chapter 17, “IP Routing in the LAN,” works through those other features for routing packets between VLANs. + +VLAN and VLAN Trunking Configuration and Verification +Cisco switches do not require any configuration to work. You can purchase Cisco switches, install devices with the correct cabling, turn on the switches, and they work. You would never need to configure the switch, and it would work fine, even if you interconnected switches, until you needed more than one VLAN. But if you want to use VLANs—and most enterprise networks do—you need to add some configuration. + +This chapter separates the VLAN configuration details into two major sections. The first sec-tion looks at how to configure static access interfaces: switch interfaces configured to be in one VLAN only, therefore not using VLAN trunking. The second part shows how to config-ure interfaces that do use VLAN trunking. + + +Creating VLANs and Assigning Access VLANs to an Interface +This section shows how to create a VLAN, give the VLAN a name, and assign interfaces to a VLAN. To focus on these basic details, this section shows examples using a single switch, so VLAN trunking is not needed. + +For a Cisco switch to forward frames in a particular VLAN, the switch must be configured to believe that the VLAN exists. In addition, the switch must have nontrunking interfaces (called access interfaces, or static access interfaces) assigned to the VLAN, and/or trunks +that support the VLAN. The configuration steps for access interfaces are as follows: + + + + + + + + +8 + + + +Config Checklist + +Step 1. To configure a new VLAN, follow these steps: + +A. From configuration mode, use the vlan vlan-id command in global configu-ration mode to create the VLAN and to move the user into VLAN configu-ration mode. +B. (Optional) Use the name name command in VLAN configuration mode to list a name for the VLAN. If not configured, the VLAN name is VLANZZZZ, where ZZZZ is the four-digit decimal VLAN ID. +Step 2. For each access interface, follow these steps: + +A. Use the interface type number command in global configuration mode to move into interface configuration mode for each desired interface. + +B. Use the switchport access vlan id-number command in interface configu-ration mode to specify the VLAN number associated with that interface. + +C. (Optional) Use the switchport mode access command in interface configu-ration mode to make this port always operate in access mode (that is, to not +trunk). + + +While the list might look a little daunting, the process on a single switch is actually pretty simple. For example, if you want to put the switch’s ports in three VLANs—11, 12, and + + +|||||||||||||||||||| +|||||||||||||||||||| + + +186 CCNA 200-301 Official Cert Guide, Volume 1 + +13—you first add three vlan commands: vlan 11, vlan 12, and vlan 13. Then, for each inter-face, add a switchport access vlan 11 (or 12 or 13) command to assign that interface to the proper VLAN. + +NOTE The term default VLAN (as shown in the exam topics) refers to the default setting on the switchport access vlan vlan-id command, and that default is VLAN ID 1. In other words, by default, each port is assigned to access VLAN 1. + + +VLAN Configuration Example 1: Full VLAN Configuration +Examples 8-1, 8-2, and 8-3 work through one scenario with VLAN configuration and verifi-cation. To begin, Example 8-1 begins by showing the VLANs in switch SW1 in Figure 8-9, with all default settings related to VLANs. + +VLAN 2 + + + +VLAN 1 Fa0/13 Fa0/14 VLAN 3 + +Fa0/12 Fa0/15 + +Fa0/11 SW1 Fa0/16 + +Figure 8-9 Network with One Switch and Three VLANs + +Example 8-1 Configuring VLANs and Assigning VLANs to Interfaces + +SW1# show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 +Fa0/5, Fa0/6, Fa0/7, Fa0/8 +Fa0/9, Fa0/10, Fa0/11, Fa0/12 +Fa0/13, Fa0/14, Fa0/15, Fa0/16 +Fa0/17, Fa0/18, Fa0/19, Fa0/20 +Fa0/21, Fa0/22, Fa0/23, Fa0/24 +Gi0/1, Gi0/2 + +1002 fddi-default +1003 token-ring-default +1004 fddinet-default +1005 trnet-default + +act/unsup +act/unsup +act/unsup +act/unsup + + + +The example begins with the show vlan brief command, confirming the default settings of five nondeletable VLANs, with all interfaces assigned to VLAN 1. VLAN 1 cannot be +deleted but can be used. VLANs 1002–1005 cannot be deleted and cannot be used as access VLANs today. In particular, note that this 2960 switch has 24 Fast Ethernet ports (Fa0/1– Fa0/24) and two Gigabit Ethernet ports (Gi0/1 and Gi0/2), all of which are listed as being in + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 187 + +VLAN 1 per that first command’s output, confirming that by default, Cisco switches assign all ports to VLAN 1. + +Next, Example 8-2 shows steps that mirror the VLAN configuration checklist, namely the configuration of VLAN 2, plus the assignment of VLAN 2 as the access VLAN on two ports: Fa0/13 and Fa0/14. + +Example 8-2 Configuring VLANs and Assigning VLANs to Interfaces + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# vlan 2 +SW1(config-vlan)# name Freds-vlan +SW1(config-vlan)# exit +SW1(config)# interface range fastethernet 0/13 - 14 +SW1(config-if)# switchport access vlan 2 +SW1(config-if)# switchport mode access +SW1(config-if)# end + +SW1# show vlan brief + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +2 Freds-vlan + +active Fa0/1, Fa0/2, Fa0/3, Fa0/4 +Fa0/5, Fa0/6, Fa0/7, Fa0/8 +Fa0/9, Fa0/10, Fa0/11, Fa0/12 +Fa0/15, Fa0/16, Fa0/17, Fa0/18 8 Fa0/19, Fa0/20, Fa0/21, Fa0/22 +Fa0/23, Fa0/24, Gi0/1, Gi0/2 +active Fa0/13, Fa0/14 + + + +1002 fddi-default +1003 token-ring-default +1004 fddinet-default +1005 trnet-default + +act/unsup +act/unsup +act/unsup +act/unsup + + + +Take a moment to compare the output of the show vlan brief commands in Example 8-2 (after adding the configuration) versus Example 8-1. Example 8-2 shows new information about VLAN 2, with ports Fa0/13 and Fa0/14 no longer being listed with VLAN 1, but now listed as assigned to VLAN 2. + +To complete this scenario, Example 8-3 shows a little more detail about the VLAN itself. First, the show running-config command lists both the vlan 2 and switchport access vlan 2 commands as configured in Example 8-2. Also, note that earlier Example 8-2 uses the interface range command, with one instance of the switchport access vlan 2 interface subcommand. However, Example 8-3 shows how the switch actually applied that command to both Fa0/13 and Fa0/14. Example 8-3 ends with the show vlan id 2 command, which confirms the operational status that ports Fa0/13 and Fa0/14 are assigned to VLAN 2. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +188 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 8-3 Configuring VLANs and Assigning VLANs to Interfaces + +SW1# show running-config +! Many lines omitted for brevity +! Early in the output: +vlan 2 +name Freds-vlan +! +! more lines omitted for brevity +interface FastEthernet0/13 +switchport access vlan 2 +switchport mode access +! +interface FastEthernet0/14 +switchport access vlan 2 +switchport mode access +! + +SW1# show vlan id 2 +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +2 Freds-vlan active Fa0/13, Fa0/14 + +VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 +---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ +2 enet 100010 1500 - - - - - 0 0 + +Remote SPAN VLAN +---------------- +Disabled + +Primary Secondary Type Ports +------- --------- ----------------- ------------------------------------------ + + +The example surrounding Figure 8-9 uses six switch ports, all of which need to operate as access ports. That is, each port should not use trunking but instead should be assigned to a single VLAN, as assigned by the switchport access vlan vlan-id command. For ports that should always act as access ports, add the optional interface subcommand switchport mode access. This command tells the switch to always be an access interface and disables +the protocol that negotiates trunking (Dynamic Trunking Protocol [DTP]) with the device on the other end of the link. (The upcoming section “VLAN Trunking Configuration” discusses more details about the commands that allow a port to negotiate whether it should use trunking.) + +NOTE The book includes a video that works through a different VLAN configuration example as well. You can find the video on the companion website. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 189 + +VLAN Configuration Example 2: Shorter VLAN Configuration +Example 8-2 shows how to configure a VLAN and add two ports to the VLAN as access ports. Example 8-4 does the same, this time with VLAN 3, and this time with a much briefer alternative configuration. The configuration completes the configuration of the design shown in Figure 8-9, by adding two ports to VLAN 3. + +Example 8-4 Shorter VLAN Configuration Example (VLAN 3) + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# interface range Fastethernet 0/15 - 16 +SW1(config-if-range)# switchport access vlan 3 +% Access VLAN does not exist. Creating vlan 3 +SW1(config-if-range)# ^Z + +SW1# show vlan brief + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +2 Freds-vlan +3 VLAN0003 + +active Fa0/1, Fa0/2, Fa0/3, Fa0/4 +Fa0/5, Fa0/6, Fa0/7, Fa0/8 +Fa0/9, Fa0/10, Fa0/11, Fa0/12 +Fa0/17, Fa0/18, Fa0/19, Fa0/20 +Fa0/21, Fa0/22, Fa0/23, Fa0/24 +Gi0/1, Gi0/2 +active Fa0/13, Fa0/14 8 active Fa0/15, Fa0/16 + + + +1002 fddi-default +1003 token-ring-default +1004 fddinet-default +1005 trnet-default + +act/unsup +act/unsup +act/unsup +act/unsup + + + +Example 8-2 shows how a switch can dynamically create a VLAN—the equivalent of the vlan vlan-id global config command—when the switchport access vlan interface subcom-mand refers to a currently unconfigured VLAN. This example begins with SW1 not knowing about VLAN 3. With the addition of the switchport access vlan 3 interface subcommand, the switch realized that VLAN 3 did not exist, and as noted in the shaded message in the example, the switch created VLAN 3, using a default name (VLAN0003). The engineer did not need to type the vlan 3 global command to create VLAN 3; the switch did that automat-ically. No other steps are required to create the VLAN. At the end of the process, VLAN 3 exists in the switch, and interfaces Fa0/15 and Fa0/16 are in VLAN 3, as noted in the shaded part of the show vlan brief command output. + +VLAN Trunking Protocol +Before showing more configuration examples, you also need to know something about a Cisco protocol and tool called the VLAN Trunking Protocol (VTP). VTP is a Cisco proprietary + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +190 CCNA 200-301 Official Cert Guide, Volume 1 + +tool on Cisco switches that advertises each VLAN configured in one switch (with the vlan number command) so that all the other switches in the campus learn about that VLAN. + +This book does not discuss VTP as an end to itself for a few different reasons. First, the cur-rent CCNA 200-301 exam blueprint ignores VTP, as do the CCNP Enterprise Core and CCNP Enterprise Advanced Routing blueprints. Additionally, many enterprises choose to disable VTP. + +Also, you can easily disable VTP so that it has no impact on your switches in the lab, which is exactly what I did when building all the examples in this book. + +However, VTP has some small impact on how every Cisco Catalyst switch works, even if you do not try to use VTP. This brief section introduces enough details of VTP so that you can see these small differences in VTP that cannot be avoided. + +First, all examples in this book (and in Volume 2) use switches that disable VTP in some way. Interestingly, for much of VTP’s decades of existence, most switches did not allow VTP to be disabled completely; on those switches, to effectively disable VTP, the engineer would set the switch to use VTP transparent mode (with the vtp mode transparent global command). Some switches now have an option to disable VTP completely with the vtp mode off global command. For the purposes of this book, configuring a switch with either transparent mode or off mode disables VTP. + +Note that both transparent and off modes prevent VTP from learning and advertising about VLAN configuration. Those modes allow a switch to configure all VLANs, including stan-dard- and extended-range VLANs. Additionally, switches using transparent or off modes list the vlan configuration commands in the running-config file. + +Finally, on a practical note, if you happen to do lab exercises with real switches or with sim-ulators, and you see unusual results with VLANs, check the VTP status with the show vtp status command. If your switch uses VTP server or client mode, you will find + +■ The server switches can configure VLANs in the standard range only (1–1005). ■ The client switches cannot configure VLANs. +■ Both servers and clients may be learning new VLANs from other switches and seeing their VLANs deleted by other switches because of VTP. +■ The show running-config command does not list any vlan commands; you must use other show commands to find out about the configured VLANs. + +If possible in the lab, switch to disable VTP and ignore VTP for your switch configuration practice until you decide to learn more about VTP for other purposes. + +NOTE Do not change VTP settings on any switch that also connects to the production network until you know how VTP works and you talk with experienced colleagues. Doing so can cause real harm to your LAN. For example, if the switch you configure connects to other switches, which in turn connect to switches used in the production LAN, you could accidentally change the VLAN configuration in other switches with serious impact to the operation of the network. You could delete VLANs and cause outages. Be careful and never experiment with VTP settings on a switch unless it and the other switches connected to it have absolutely no physical links connected to the production LAN. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 191 + +VLAN Trunking Configuration +Trunking configuration between two Cisco switches can be very simple if you just statically configure trunking. For example, most Cisco Catalyst switches today support only 802.1Q and not ISL. You could literally add one interface subcommand for the switch interface on each side of the link (switchport mode trunk), and you would create a VLAN trunk that supported all the VLANs known to each switch. + +However, trunking configuration on Cisco switches includes many more options, including several options for dynamically negotiating various trunking settings. The configuration can either predefine different settings or tell the switch to negotiate the settings, as follows: + +■ The type of trunking: IEEE 802.1Q, ISL, or negotiate which one to use, on switches that support both types of trunking. +■ The administrative mode: Whether to always trunk, always not trunk, or negotiate whether to trunk or not. + +First, consider the type of trunking. Cisco switches that support ISL and 802.1Q can negoti-ate which type to use, using the Dynamic Trunking Protocol (DTP). If both switches support both protocols, they use ISL; otherwise, they use the protocol that both support. Today, many Cisco switches do not support the older ISL trunking protocol. Switches that support both types of trunking use the switchport trunk encapsulation {dot1q | isl | negotiate} inter-face subcommand to either configure the type or allow DTP to negotiate the type. + +DTP can also negotiate whether the two devices on the link agree to trunk at all, as guided by the local switch port’s administrative mode. The administrative mode refers to the config-uration setting for whether trunking should be used. Each interface also has an operational +mode, which refers to what is currently happening on the interface and might have been 8 chosen by DTP’s negotiation with the other device. Cisco switches use the switchport mode +interface subcommand to define the administrative trunking mode, as listed in Table 8-2. + +Table 8-2 Trunking Administrative Mode Options with the switchport mode Command + +Command Option access +trunk + +dynamic desirable + +dynamic auto + +Description +Always act as an access (nontrunk) port + +Always act as a trunk port + +Initiates negotiation messages and responds to negotiation messages to dynamically choose whether to start using trunking +Passively waits to receive trunk negotiation messages, at which point the switch will respond and negotiate whether to use trunking + + +For example, consider the two switches shown in Figure 8-10. This figure expands the design shown earlier in Figure 8-9, with a trunk to a new switch (SW2) and with parts of VLANs 1 and 3 on ports attached to SW2. The two switches use a Gigabit Ethernet link for the trunk. In this case, the trunk does not dynamically form by default because both (2960) switches default to an administrative mode of dynamic auto, meaning that neither switch initiates the trunk negotiation process. When one switch is changed to use dynamic desirable mode, which does initiate the negotiation, the switches negotiate to use trunking, specifically 802.1Q because the 2960s support only 802.1Q. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +192 CCNA 200-301 Official Cert Guide, Volume 1 + +VLAN 2 + + + +VLAN 1 Fa0/13 Fa0/14 VLAN 3 + +Fa0/12 Fa0/15 + +Fa0/11 SW1 Fa0/16 Gi0/1 + +Trunk + +Gi0/2 +Fa0/22 Fa0/23 + +Fa0/21 SW2 Fa0/24 + +Figure 8-10 Network with Two Switches and Three VLANs + +Example 8-5 begins with SW1 configured as shown in Examples 8-2 and 8-4—that is, SW1 has two ports each assigned to VLANs 1, 2, and 3. However, both SW1 and SW2 currently have all default settings on the interfaces that connect the two switches. With the default setting of switchport mode dynamic auto, the two switches do not trunk. + +Example 8-5 Initial (Default) State: Not Trunking Between SW1 and SW2 + +SW1# show interfaces gigabit 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: static access +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: native +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Administrative private-vlan trunk native VLAN: none +Administrative private-vlan trunk Native VLAN tagging: enabled +Administrative private-vlan trunk encapsulation: dot1q + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 193 + +Administrative private-vlan trunk normal VLANs: none +Administrative private-vlan trunk private VLANs: none +Operational private-vlan: none +Trunking VLANs Enabled: ALL +Pruning VLANs Enabled: 2-1001 +Capture Mode Disabled +Capture VLANs Allowed: ALL + +Protected: false +Unknown unicast blocked: disabled +Unknown multicast blocked: disabled +Appliance trust: none + +! Note that the next command results in a single empty line of output. +SW1# show interfaces trunk +SW1# + + + +First, focus on the highlighted items from the output of the show interfaces switchport command at the beginning of Example 8-3. The output lists the default administrative mode setting of dynamic auto. Because SW2 also defaults to dynamic auto, the command lists SW1’s operational status as “access,” meaning that it is not trunking. (“Dynamic auto” tells both switches to sit there and wait on the other switch to start the negotiations.) The third shaded line points out the only supported type of trunking (802.1Q). (On a switch that sup-ports both ISL and 802.1Q, this value would by default list “negotiate,” to mean that the type of encapsulation is negotiated.) Finally, the operational trunking type is listed as “native,” which is a reference to the 802.1Q native VLAN. + +The end of the example shows the output of the show interfaces trunk command, but with no output. This command lists information about all interfaces that currently operationally trunk; that is, it lists interfaces that currently use VLAN trunking. With no interfaces listed, this command also confirms that the link between switches is not trunking. + +Next, consider Example 8-6, which shows the new configuration that enables trunking. In this case, SW1 is configured with the switchport mode dynamic desirable command, which asks the switch to both negotiate as well as to begin the negotiation process, rather than waiting on the other device. The example shows that as soon as the command is issued, log messages appear showing that the interface goes down and then back up again, which hap- +pens when the interface transitions from access mode to trunk mode. + + + + + + + + +8 + + +Example 8-6 SW1 Changes from Dynamic Auto to Dynamic Desirable + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# interface gigabit 0/1 +SW1(config-if)# switchport mode dynamic desirable +SW1(config-if)# ^Z +SW1# + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +194 CCNA 200-301 Official Cert Guide, Volume 1 + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up +SW1# show interfaces gigabit 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: dynamic desirable +Operational Mode: trunk +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: dot1q +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +! lines omitted for brevity + + +Example 8-6 repeats the show interfaces gi0/1 switchport command seen in Example 8-5, but after configuring VLAN trunking, so this time the output shows that SW1’s G0/1 inter-face now operates as a trunk. Note that the command still lists the administrative settings, which denote the configured values along with the operational settings, which list what the switch is currently doing. SW1 now claims to be in an operational mode of trunk, with an operational trunking encapsulation of dot1Q. + +Example 8-7 now repeats the same show interfaces trunk command that showed no output at all back in Example 8-5. Now that SW1 trunks on its G0/1 port, the output in Example 8-7 lists G0/1, confirming that G0/1 is now operationally trunking. The next section discusses the meaning of the output of this command. Also, note that the end of the example repeats the show vlan id 2 command; of note, it includes the trunk port G0/1 in the output because the trunk port can forward traffic in VLAN 2. + +Example 8-7 A Closer Look at SW1’s G0/1 Trunk Port + +SW1# show interfaces trunk + + +Port Mode +Gi0/1 desirable + +Encapsulation +802.1q + +Status +trunking + +Native vlan +1 + + +Port Vlans allowed on trunk +Gi0/1 1-4094 + +Port Vlans allowed and active in management domain +Gi0/1 1-3 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/1 1-3 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 195 + +SW1# show vlan id 2 +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +2 Freds-vlan active Fa0/13, Fa0/14, G0/1 + +VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 +---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ +2 enet 100010 1500 - - - - - 0 0 + +Remote SPAN VLAN +---------------- +Disabled + +Primary Secondary Type Ports +------- --------- ----------------- ------------------------------------------ + + +For the exams, you should be ready to interpret the output of the show interfaces switchport command, realize the administrative mode implied by the output, and know whether the link should operationally trunk based on those settings. Table 8-3 lists the combinations of the trunking administrative modes and the expected operational mode (trunk or access) resulting from the configured settings. The table lists the administrative mode used on one end of the link on the left, and the administrative mode on the switch on the other end of the link across the top of the table. + + +Table 8-3 Expected Trunking Operational Mode Based on the Configured Administrative Modes + + +8 + +Administrative Mode Access Dynamic Auto Trunk Dynamic Desirable access Access Access Do Not Use Access +1 + +dynamic auto + +trunk + +dynamic desirable + +Access Access + +Do Not Use Trunk +1 + +Access Trunk + +Trunk Trunk + +Trunk Trunk + +Trunk Trunk + + +1 When two switches configure a mode of “access” on one end and “trunk” on the other, problems occur. Avoid this combination. + +Finally, before leaving the discussion of configuring trunks, Cisco recommends disabling trunk negotiation on most ports for better security. The majority of switch ports on most switches will be used to connect to users and configured with the command switchport mode access—which also disables DTP. For ports without the switchport mode access command—for instance, ports statically configured to trunk with the switchport mode trunk command—DTP still operates, but you can disable DTP negotiations altogether using the switchport nonegotiate interface subcommand. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +196 CCNA 200-301 Official Cert Guide, Volume 1 + +Implementing Interfaces Connected to Phones +This next topic is strange, at least in the context of access links and trunk links. In the world of IP telephony, telephones use Ethernet ports to connect to an Ethernet network so they can use IP to send and receive voice traffic sent via IP packets. To make that work, the switch’s Ethernet port acts like an access port, but at the same time, the port acts like a trunk in some ways. This last topic of the chapter works through those main concepts. + +Data and Voice VLAN Concepts +Before IP telephony, a PC could sit on the same desk as a phone. The phone happened to use UTP cabling, with that phone connected to some voice device (often called a voice switch or a private branch exchange [PBX]). The PC, of course, connected using an unshielded +twisted-pair (UTP) cable to the usual LAN switch that sat in the wiring closet—sometimes in the same wiring closet as the voice switch. Figure 8-11 shows the idea. + +User’s Desk Closet + + + +Telephone UTP + + + +Ethernet UTP + +Voice Switch + + +Ethernet Switch + + +Figure 8-11 Before IP Telephony: PC and Phone, One Cable Each, Connect to Two Different Devices + +The term IP telephony refers to the branch of networking in which the telephones use IP packets to send and receive voice as represented by the bits in the data portion of the IP packet. The phones connect to the network like most other end-user devices, using either Ethernet or Wi-Fi. These new IP phones did not connect via cable directly to a voice switch, instead connecting to the IP network using an Ethernet cable and an Ethernet port built +in to the phone. The phones then communicated over the IP network with software that replaced the call setup and other functions of the PBX. (The current products from Cisco that perform this IP telephony control function are called Cisco Unified Communication Manager.) + +The migration from using the already-installed telephone cabling to these new IP phones that needed UTP cables that supported Ethernet caused some problems in some offices. In particular: + +■ The older non-IP phones used a category of UTP cabling that often did not support 100-Mbps or 1000-Mbps Ethernet. +■ Most offices had a single UTP cable running from the wiring closet to each desk, but now two devices (the PC and the new IP phone) both needed a cable from the desktop to the wiring closet. +■ Installing a new cable to every desk would be expensive, plus you would need more switch ports. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 197 + +To solve this problem, Cisco embedded small three-port switches into each phone. + +IP telephones have included a small LAN switch, on the underside of the phone, since the earliest IP telephone products. Figure 8-12 shows the basic cabling, with the wiring closet cable connecting to one physical port on the embedded switch, the PC connecting with a short patch cable to the other physical port, and the phone’s internal CPU connecting to an internal switch port. + + +User’s Desk + +PC Phone + +IP Ethernet UTP + +Wiring Closet + + + + +Ethernet Switch + +Patch Embedded Cable Switch + +Figure 8-12 Cabling with an IP Phone, a Single Cable, and an Integrated Switch + + +Sites that use IP telephony, which includes almost every company today, now have two devices off each access port. In addition, Cisco best practices for IP telephony design tell us to put the phones in one VLAN and the PCs in a different VLAN. To make that happen, the switch port acts a little like an access link (for the PC’s traffic), and a little like a trunk (for the phone’s traffic). The configuration defines two VLANs on that port, as follows: + +Data VLAN: Same idea and configuration as the access VLAN on an access port but defined as the VLAN on that link for forwarding the traffic for the device connected to the phone on the desk (typically the user’s PC). +Voice VLAN: The VLAN defined on the link for forwarding the phone’s traffic. Traffic in this VLAN is typically tagged with an 802.1Q header. +Figure 8-13 illustrates this design with two VLANs on access ports that support IP +telephones. + + + + + + + + +8 + + + + + + + + +Voice VLAN IP IP IP IP VLAN 11 + + + + +Data VLAN + + + +Figure 8-13 + + +VLAN 10 + + +A LAN Design, with Data in VLAN 10 and Phones in VLAN 11 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +198 CCNA 200-301 Official Cert Guide, Volume 1 + +Data and Voice VLAN Configuration and Verification +Configuring a switch port to support IP phones, once you know the planned voice and data VLAN IDs, requires just a few easy commands. Making sense of the show commands once it is configured, however, can be a challenge. The port acts like an access port in many ways. However, with most configuration options, the voice frames flow with an 802.1Q header, so that the link supports frames in both VLANs on the link. But that makes for some different show command output. + +Example 8-8 shows an example configuration. In this case, all four switch ports F0/1–F0/4 begin with default configuration. The configuration adds the new data and voice VLANs. The example then configures all four ports as access ports and defines the access VLAN, which is also called the data VLAN when discussing IP telephony. Finally, the configuration includes the switchport voice vlan 11 command, which defines the voice VLAN used on the port. The example matches Figure 8-13, using ports F0/1–F0/4. + +Example 8-8 Configuring the Voice and Data VLAN on Ports Connected to Phones + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# vlan 10 +SW1(config-vlan)# vlan 11 +SW1(config-vlan)# interface range FastEthernet0/1 - 4 +SW1(config-if)# switchport mode access +SW1(config-if)# switchport access vlan 10 +SW1(config-if)# switchport voice vlan 11 +SW1(config-if)#^Z +SW1# + + +NOTE CDP, which is discussed in the CCNA 200-301 Official Cert Guide, Volume 2, Chapter 9, “Device Management Protocols,” must be enabled on an interface for a voice access port to work with Cisco IP phones. Cisco switches and routers enable CDP by default, so its configuration is not shown here. + +The following list details the configuration steps for easier review and study: + + +Config Checklist + +Step 1. Use the vlan vlan-id command in global configuration mode to create the data and voice VLANs if they do not already exist on the switch. + +Step 2. Configure the data VLAN like an access VLAN, as usual: + +A. Use the interface type number command global configuration mode to move into interface configuration mode. + +B. Use the switchport access vlan id-number command in interface configu-ration mode to define the data VLAN. + +C. Use the switchport mode access command in interface configuration mode to make this port always operate in access mode (that is, to not trunk). + +Step 3. Use the switchport voice vlan id-number command in interface configuration mode to set the voice VLAN ID. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 199 + +Verifying the status of a switch port configured like Example 8-8 shows some different output compared to the pure access port and pure trunk port configurations seen earlier in this chapter. For example, the show interfaces switchport command shows details about the operation of an interface, including many details about access ports. Example 8-9 shows those details for port F0/4 after the configuration in Example 8-8 was added. + +Example 8-9 Verifying the Data VLAN (Access VLAN) and Voice VLAN + +SW1# show interfaces FastEthernet 0/4 switchport +Name: Fa0/4 +Switchport: Enabled +Administrative Mode: static access +Operational Mode: static access +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: native +Negotiation of Trunking: Off +Access Mode VLAN: 10 (VLAN0010) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: 11 (VLAN0011) +! The rest of the output is omitted for brevity + + + +Working through the first three highlighted lines in the output, all those details should look familiar for any access port. The switchport mode access configuration command statically configures the administrative mode to be an access port, so the port of course operates as an access port. Also, as shown in the third highlighted line, the switchport access vlan 10 con-figuration command defined the access mode VLAN as highlighted here. + +The fourth highlighted line shows the one small new piece of information: the voice VLAN ID, as set with the switchport voice vlan 11 command in this case. This small line of out-put is the only piece of information in the output that differs from the earlier access port examples in this chapter. + +These ports act more like access ports than trunk ports. In fact, the show interfaces type number switchport command boldly proclaims, “Operational Mode: static access.” +However, one other show command reveals just a little more about the underlying operation with 802.1Q tagging for the voice frames. + +As mentioned earlier, the show interfaces trunk command—that is, the command that does not include a specific interface in the middle of the command—lists the operational trunks on a switch. With IP telephony ports, the ports do not show up in the list of trunks either— providing evidence that these links are not treated as trunks. Example 8-10 shows just such an example. + +However, the show interfaces trunk command with the interface listed in the middle of the command, as is also shown in Example 8-10, does list some additional information. Note that in this case, the show interfaces F0/4 trunk command lists the status as not-trunking, but with VLANs 10 and 11 allowed on the trunk. (Normally, on an access port, only the access +VLAN is listed in the “VLANs allowed on the trunk” list in the output of this command.) + + + + +8 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +200 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 8-10 Allowed VLAN List and the List of Active VLANs + +SW1# show interfaces trunk +SW1# show interfaces F0/4 trunk + + +Port Mode +Fa0/4 off + +Encapsulation +802.1q + +Status +not-trunking + +Native vlan +1 + + +Port Vlans allowed on trunk +Fa0/4 10-11 + +Port Vlans allowed and active in management domain +Fa0/4 10-11 + +Port Vlans in spanning tree forwarding state and not pruned +Fa0/4 10-11 + + +Summary: IP Telephony Ports on Switches +It might seem as though this short topic about IP telephony and switch configuration includes a lot of small twists and turns and trivia, and it does. The most important items to remember are as follows: + +■ Configure these ports like a normal access port to begin: Configure it as a static access port and assign it an access VLAN. +■ Add one more command to define the voice VLAN (switchport voice vlan vlan-id). +■ Look for the mention of the voice VLAN ID, but no other new facts, in the output of the show interfaces type number switchport command. +■ Look for both the voice and data (access) VLAN IDs in the output of the show interfaces type number trunk command. +■ Do not expect to see the port listed in the list of operational trunks as listed by the show interfaces trunk command. + +Troubleshooting VLANs and VLAN Trunks +A switch’s data plane forwarding processes depend in part on VLANs and VLAN trunking. This final section of the chapter focuses on issues related to VLANs and VLAN trunks that could prevent LAN switching from working properly, focusing on a few items not yet dis-cussed in the chapter. In particular, this section examines these steps an engineer can take to avoid issues: +Step 1. Confirm that all VLANs are both defined and active. + +Step 2. Check the allowed VLAN lists on both ends of each trunk to ensure that all VLANs intended to be used are included. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 201 + +Step 3. Check for incorrect trunk configuration settings that result in one switch oper-ating as a trunk, with the neighboring switch not operating as a trunk. + +Step 4. Check the native VLAN settings on both ends of the trunk to ensure the set-tings match. + + +Access VLANs Undefined or Disabled +Switches do not forward frames for VLANs that are (a) not known because the VLAN is not configured or has not been learned with VTP or (b) the VLAN is known, but it is disabled (shut down). This next topic summarizes the best ways to confirm that a switch knows that a particular VLAN exists, and if it exists, determines the shutdown state of the VLAN. + +First, on the issue of whether a VLAN exists on a switch, a VLAN can be defined to a switch in two ways: using the vlan number global configuration command, or it can be learned from another switch using VTP. As mentioned earlier in this chapter, the examples in this book assume that you are not using VTP. If you discover that a VLAN does not exist on a switch, simply configure the VLAN as discussed earlier in the section, “Creating VLANs and Assigning Access VLANs to an Interface.” + +In addition to checking the configuration, you can check for the status of the VLAN (as well as whether it is known to the switch) using the show vlan command. No matter the VTP mode, this command will list all VLANs known to the switch, plus one of two VLAN state values, depending on the current state: either active or act/lshut. The second of these states means that the VLAN is shut down. Shutting down a VLAN disables the VLAN on that switch only, so the switch will not forward frames in that VLAN. +Switch IOS gives you two similar configuration methods with which to disable (shutdown) 8 and enable (no shutdown) a VLAN. Example 8-11 shows how, first by using the global +command [no] shutdown vlan number and then using the VLAN mode subcommand [no] shutdown. The example shows the global commands enabling and disabling VLANs 10 and 20, respectively, and using VLAN subcommands to enable and disable VLANs 30 and 40, respectively. + +Example 8-11 Enabling and Disabling VLANs on a Switch + +SW2# show vlan brief + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 +Fa0/5, Fa0/6, Fa0/7, Fa0/8 +Fa0/9, Fa0/10, Fa0/11, Fa0/12 +Fa0/14, Fa0/15, Fa0/16, Fa0/17 +Fa0/18, Fa0/19, Fa0/20, Fa0/21 +Fa0/22, Fa0/23, Fa0/24, Gi0/1 + +10 VLAN0010 +20 VLAN0020 +30 VLAN0030 + +act/lshut Fa0/13 +active +act/lshut + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +202 CCNA 200-301 Official Cert Guide, Volume 1 + +40 VLAN0040 active + +1002 fddi-default +1003 token-ring-default +1004 fddinet-default +1005 trnet-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +SW2# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW2(config)# no shutdown vlan 10 +SW2(config)# shutdown vlan 20 +SW2(config)# vlan 30 +SW2(config-vlan)# no shutdown +SW2(config-vlan)# vlan 40 +SW2(config-vlan)# shutdown +SW2(config-vlan)# + + + +NOTE The output of the show vlan brief command also lists a state of “act/unsup” for the reserved VLAN IDs 1002–1005, with “unsup” meaning “unsupported.” + + +Mismatched Trunking Operational States +Trunking can be configured correctly so that both switches use trunking. However, trunks can also be misconfigured, with a couple of different results: either both switches do not trunk, or one switch trunks and the other does not. Both results cause problems. + +The most common incorrect configuration—which results in both switches not trunking—is a configuration that uses the switchport mode dynamic auto command on both switches on the link. The word auto just makes us all want to think that the link would trunk automati-cally, but this command is both automatic and passive. As a result, both switches passively wait on the other device on the link to begin negotiations. Example 8-12 highlights those parts of the output from the show interfaces switchport command that confirm both the configured and operational states. Note that the output lists the operational mode as “static access” rather than “trunking.” + +Example 8-12 Operational Trunking State + +SW2# show interfaces gigabit0/2 switchport +Name: Gi0/2 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: static access +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: native +! lines omitted for brevity + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 203 + +A different incorrect trunking configuration has an even worse result: one switch trunks, sending tagged frames, while the neighboring switch does not trunk, so the neighboring switch discards any frames it receives that have a VLAN tag in the header. When this combi-nation of events happens, the interface works in that the status on each end will be up/up or connected. Traffic in the native VLAN will actually cross the link successfully because those frames have no VLAN tags (headers). However, traffic in all the rest of the VLANs will not cross the link. + +Figure 8-14 shows the incorrect configuration along with which side trunks and which does not. The side that trunks (SW1 in this case) enables trunking using the command switchport mode trunk but also disables Dynamic Trunking Protocol (DTP) negotiations using the switchport nonegotiate command. SW2’s configuration also helps create the problem, by using one of the two trunking options that relies on DTP. Because SW1 has disabled DTP, SW2’s DTP negotiations fail, and SW2 chooses to not trunk. + + +1 2 VLAN 10 Eth. Frame + +Frame has 802.1Q: Discard! + + + + +Gi0/1 +SW1 Trunk Mode: On + +Gi0/2 +Trunk Mode: Access SW2 + + + +switchport mode trunk switchport mode dynamic desirable switchport nonegotiate +Figure 8-14 Mismatched Trunking Operational States +The figure shows what happens when using this incorrect configuration. At Step 1, SW1 8 could (for example) forward a frame in VLAN 10. However, SW2 would view any frame that +arrives with an 802.1Q header as illegal because the frame has an 802.1Q header, and SW2 treats its G0/2 port as an access port. So, SW2 discards any 802.1Q frames received on that port. + +The trunking issues shown here can be easily avoided by checking the configuration and by checking the trunk’s operational state (mode) on both sides of the trunk. The best commands to check trunking-related facts are show interfaces trunk and show interfaces switchport. Just be aware that the switches do not prevent you from making these configuration mistakes. + +The Supported VLAN List on Trunks +A Cisco switch can forward traffic for all defined and active VLANs. However, a particular VLAN trunk may not forward traffic for a defined and active VLAN for a variety of other reasons. You should learn how to identify which VLANs a particular trunk port currently supports and the reasons why the switch might not be forwarding frames for a VLAN on that trunk port. + +The first category in this step can be easily done using the show interfaces interface-id trunk command, which only lists information about currently operational trunks. The best place to begin with this command is the last section of output, which lists the VLANs whose + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +204 CCNA 200-301 Official Cert Guide, Volume 1 + +traffic will be forwarded over the trunk. Any VLANs that make it to this final list of VLANs in the command output meet the following criteria: + +■ The VLAN has not been removed from the allowed VLAN list on the trunk (as config-ured with the switchport trunk allowed vlan interface subcommand). +■ The VLAN exists and is active on the local switch (as seen in the show vlan command). +■ The VLAN has not been VTP-pruned from the trunk. (Because this book attempts to ignore VTP as much as possible, this section assumes that VTP is not used and this fea-ture has no impact on any trunks.) The trunk is in an STP forwarding state in that VLAN (as also seen in the show spanning-tree vlan vlan-id command). + +The switchport trunk allowed vlan interface subcommand gives the network engineer a method to administratively limit the VLANs whose traffic uses a trunk. If the engineer wants all defined VLANs to be supported on a trunk, the engineer simply does not configure this command. If the engineer would like to limit the trunk to support a subset of the VLANs known to the switch, however, the engineer can add one or more switchport trunk allowed vlan interface subcommands. + +For instance, in a switch that has configured VLANs 1 through 100, but no others, by default the switch would allow traffic in all 100 VLANs. However, the trunk interface com-mand switchport trunk allowed vlan 1-60 would limit the trunk to forward traffic for VLANs 1 through 60, but not the rest of the VLANs. Example 8-13 shows a sample of the command output from the show interfaces trunk command, which confirms the first list of VLAN IDs now lists VLANs 1–60. Without the switchport trunk allowed vlan command, the first list would have included VLANs 1–4094. + +Example 8-13 Allowed VLAN List and List of Active VLANs + +SW1# show interfaces trunk + + +Port Mode +Gi0/1 desirable + +Encapsulation +802.1q + +Status +trunking + +Native vlan +1 + + +Port Vlans allowed on trunk +Gi0/1 1-60 + +Port Vlans allowed and active in management domain +Gi0/1 1-59 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/1 1-58 + + +The output of the show interfaces trunk command creates three separate lists of VLANs, each under a separate heading. These three lists show a progression of reasons why a VLAN is not forwarded over a trunk. Table 8-4 summarizes the headings that precede each list +and the reasons why a switch chooses to include or not include a VLAN in each list. For instance, in Example 8-13, VLAN 60 has been shut down, and VLAN 59 happens to be in + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 205 + +an STP blocking state. (Chapter 9, “Spanning Tree Protocol Concepts,” has more information about STP.) + +Table 8-4 VLAN Lists in the show interfaces trunk Command +List Heading Reasons Position +First VLANs allowed VLANs 1–4094, minus those removed by the switchport trunk allowed command + +Second VLANs allowed The first list, minus VLANs not defined to the local switch (that and active… is, there is not a vlan global configuration command or the switch +has not learned of the VLAN with VTP), and also minus those VLANs in shutdown mode + +Third VLANs in spanning tree… + +The second list, minus VLANs in an STP blocking state for that interface, and minus VLANs VTP pruned from that trunk + + + + +NOTE The companion website includes a video from the CCNA Exam Prep LiveLessons product, named “Troubleshooting VLANs Allowed on a Trunk #1,” which works through the three lists of VLANs in the output of the show interfaces interface-id trunk command in more detail. + + +Mismatched Native VLAN on a Trunk +Unfortunately, it is possible to set the native VLAN ID to different VLANs on either end of 8 the trunk, using the switchport trunk native vlan vlan-id command. If the native VLANs +differ according to the two neighboring switches, the switches will cause frames sent in the native VLAN to jump from one VLAN to the other. + +For example, if switch SW1 sends a frame using native VLAN 1 on an 802.1Q trunk, SW1 does not add a VLAN header, as is normal for the native VLAN. When switch SW2 receives the frame, noticing that no 802.1Q header exists, SW2 assumes that the frame is part of SW2’s configured native VLAN. If SW2 has been configured to think VLAN 2 is the native VLAN on that trunk, SW2 will try to forward the received frame into VLAN 2. (This effect of a frame being sent in one VLAN but then being believed to be in a different VLAN is called VLAN hopping.) + +Chapter Review + +Review this chapter’s material using either the tools in the book or the interactive tools for the same material found on the book’s companion website. Table 8-5 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +206 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 8-5 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Answer DIKTA questions + +Review config checklists + +Review command tables + +Review memory tables + +Do labs + +Watch video + +Review Date(s) Resource Used Book, website +Book, website + +Book, PTP + +Book, website + +Book + +Website + +Sim Lite, blog + +Website + + + +Review All the Key Topics + +Table 8-6 Key Topics for Chapter 8 + +Key Topic Element +Figure 8-2 + +List + +Figure 8-5 + +Figure 8-6 + +Table 8-2 + +Table 8-3 + +List + +List + +Table 8-4 + +Description Page Number +Basic VLAN concept 179 + +Reasons for using VLANs 180 + +Diagram of VLAN trunking 182 + +802.1Q header 183 + +Options of the switchport mode command 191 + +Expected trunking results based on the configuration of the 195 switchport mode command +Definitions of data VLAN and voice VLAN 197 + +Summary of data and voice VLAN concepts, configuration, and 200 verification +Analysis of the three VLAN lists in the output from the show 205 interfaces interface-id trunk command + + + +Key Terms You Should Know +802.1Q, trunk, trunking administrative mode, trunking operational mode, VLAN, VTP, VTP transparent mode, Layer 3 switch, access interface, trunk interface, data VLAN, voice VLAN, native VLAN, default VLAN, static access interface + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 8: Implementing Ethernet Virtual LANs 207 + +Do Labs +The Sim Lite software is a version of Pearson’s full simulator learning product with a sub-set of the labs, included free with this book. The Sim Lite with this book includes a couple of labs about VLANs. Also, check the author’s blog site pages for configuration exercises (Config Labs) at https://blog.certskills.com. + +Command References +Tables 8-7 and 8-8 list configuration and verification commands used in this chapter, respec-tively. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right col-umn, and try to recall what the command does. + +Table 8-7 Chapter 8 Configuration Command Reference + +Command vlan vlan-id + +name vlan-name + +[no] shutdown + +[no] shutdown vlan vlan-id + +vtp mode {server | client | transparent | off} +switchport mode {access | dynamic {auto | desirable} | trunk} + +switchport access vlan vlan-id + +switchport trunk encapsulation {dot1q | isl | negotiate} + +switchport trunk native vlan vlan-id +switchport nonegotiate + +switchport voice vlan vlan-id + + +switchport trunk allowed vlan {add | all | except | remove} vlan-list + +Description +Global config command that both creates the VLAN and puts the CLI into VLAN configuration mode +VLAN subcommand that names the VLAN + +VLAN mode subcommand that enables (no shutdown) or disables (shutdown) the VLAN +Global config command that has the same effect as the [no] shutdown VLAN mode subcommands +Global config command that defines the VTP mode +8 + +Interface subcommand that configures the trunking administrative mode on the interface +Interface subcommand that statically configures the interface into that one VLAN +Interface subcommand that defines which type of trunking to use, assuming that trunking is configured or negotiated +Interface subcommand that defines the native VLAN for a trunk port + +Interface subcommand that disables the negotiation of VLAN trunking +Interface subcommand that defines the voice VLAN on a port, meaning that the switch uses 802.1Q tagging for frames in this VLAN +Interface subcommand that defines the list of allowed VLANs + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +208 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 8-8 Chapter 8 EXEC Command Reference + +Command +show interfaces interface-id switchport + +show interfaces interface-id trunk + + +show vlan [brief | id vlan-id | name vlan-name | summary] + +show vlan [vlan] + +show vtp status + +Description +Lists information about any interface regarding administrative settings and operational state + +Lists information about all operational trunks (but no other interfaces), including the list of VLANs that can be forwarded over the trunk +Lists information about the VLAN + +Displays VLAN information + +Lists VTP configuration and status information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 9 + + +Spanning Tree Protocol Concepts This chapter covers the following exam topics: +2.0 Network Access +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) + +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree Protocol and identify basic operations + +2.5.a Root port, root bridge (primary/secondary), and other port names + +2.5.b Port states (forwarding/blocking) + +2.5.c PortFast benefits + +Spanning Tree Protocol (STP) allows Ethernet LANs to have the added benefits of installing redundant links in a LAN, while overcoming the known problems that occur when adding those extra links. Using redundant links in a LAN design allows the LAN to keep working even when some links fail or even when some entire switches fail. Proper LAN design should add enough redundancy so that no single point of failure crashes the LAN; STP allows the design to use redundancy without causing some other problems. + +Historically, the IEEE first standardized STP as part of the IEEE 802.1D standard back in 1990, with pre-standard versions working even before that time. Over time, the industry and IEEE improved STP, with the eventual replacement of STP with an improved protocol: Rapid Spanning Tree Protocol (RSTP). The IEEE first released RSTP as amendment 802.1w and, in 2004, integrated RSTP into the 802.1D standard. + +An argument could be made to ignore STP today and instead focus solely on RSTP. Most modern networks use RSTP instead of STP. The most recent models and IOS versions of Cisco switches default to use RSTP instead of STP. Plus, the CCNA 200-301 exam top-ics mention RSTP by name, but not STP. However, STP and RSTP share many of the same mechanisms, and RSTP’s improvements can be best understood in comparison to STP. For that reason, this chapter presents some details that apply only to STP, as a learning tool to help you understand RSTP. + +This chapter organizes the material into three sections. The first section presents some core concepts about how both STP and RSTP discover a tree made of nodes (switches) and links so that no loops exist in a network. The second section then takes a brief look at the area for which STP differs the most from RSTP: in how STP reacts to changes in the network. This chapter ends with a third major section that details RSTP, including how RSTP works much better that STP when reacting to changes. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + +of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 9-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section STP and RSTP Basics +Details Specific to STP (and Not RSTP) + +Rapid STP Concepts + +Questions 1–2 +3–4 + +5–7 + + +1. Which of the following port states are stable states used when STP has completed con-vergence? (Choose two answers.) +a. Blocking b. Forwarding c. Listening d. Learning +e. Discarding +2. Which of the following bridge IDs wins election as root, assuming that the switches with these bridge IDs are in the same network? +a. 32769:0200.1111.1111 b. 32769:0200.2222.2222 c. 4097:0200.1111.1111 d. 4097:0200.2222.2222 e. 40961:0200.1111.1111 +3. Which of the following are transitory port states used only during the process of STP convergence? (Choose two answers.) +a. Blocking b. Forwarding c. Listening d. Learning +e. Discarding + +4. Which of the following facts determines how often a nonroot bridge or switch sends an STP Hello BPDU message? +a. The Hello timer as configured on that switch. +b. The Hello timer as configured on the root switch. c. It is always every 2 seconds. +d. The switch reacts to BPDUs received from the root switch by sending another BPDU 2 seconds after receiving the root BPDU. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +212 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Which of the following RSTP port states have the same name and purpose as a port state in traditional STP? (Choose two answers.) +a. Blocking b. Forwarding c. Listening d. Learning +e. Discarding +6. RSTP adds features beyond STP that enable ports to be used for a role if another port on the same switch fails. Which of the following statements correctly describe a port role that is waiting to take over for another port role? (Choose two answers.) +a. An alternate port waits to become a root port. b. A backup port waits to become a root port. +c. An alternate port waits to become a designated port. d. A backup port waits to become a designated port. +7. What STP feature causes an interface to be placed in the forwarding state as soon as the interface is physically active? + +a. STP +b. EtherChannel c. Root Guard d. PortFast + +Foundation Topics + +STP and RSTP Basics +Without some mechanism like Spanning Tree Protocol (STP) or Rapid STP (RSTP), a LAN with redundant links would cause Ethernet frames to loop for an indefinite period of time. With STP or RSTP enabled, some switches block ports so that these ports do not forward frames. STP and RSTP intelligently choose which ports block, with two goals in mind: + +■ All devices in a VLAN can send frames to all other devices. In other words, STP or RSTP does not block too many ports, cutting off some parts of the LAN from other parts. +■ Frames have a short life and do not loop around the network indefinitely. + +STP and RSTP strike a balance, allowing frames to be delivered to each device, without caus-ing the problems that occur when frames loop through the network over and over again. + +NOTE This first major section of the chapter explains details of both STP and RSTP, so this section uses the term STP/RSTP to refer to these protocols together. Note that this term is just a convenient shorthand. Later in the chapter, the text will point out differences between STP and RSTP and begin using the terms STP and RSTP separately, referring to only the spe-cific protocol. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 213 + +STP/RSTP prevents looping frames by adding an additional check on each interface before a switch uses it to send or receive user traffic. That check: If the port is in STP/RSTP forward-ing state in that VLAN, use it as normal; if it is in STP/RSTP blocking state, however, block all user traffic and do not send or receive user traffic on that interface in that VLAN. + +Note that these STP/RSTP states do not change the other information you already know about switch interfaces. The interface’s state of connected/notconnect does not change. The interface’s operational state as either an access or trunk port does not change. STP/RSTP adds this additional state, with the blocking state basically disabling the interface. + +In many ways, those last two paragraphs sum up what STP/RSTP does. However, the details of how STP/RSTP does its work can take a fair amount of study and practice. This first major +section of the chapter begins by explaining the need for STP/RSTP and the basic ideas of what STP/RSTP does to solve the problem of looping frames. The majority of this section then looks at how STP/RSTP goes about choosing which switch ports to block to accomplish its goals. + +The Need for Spanning Tree +STP/RSTP prevents three common problems in Ethernet LANs. All three problems occur as a side effect of one fact: without STP/RSTP, some Ethernet frames would loop around the net-work for a long time (hours, days, literally forever if the LAN devices and links never failed). + +Just one looping frame causes what is called abroadcast storm. Broadcast storms happen when any kind of Ethernet frames—broadcast frames, multicast frames, or unknown-destination uni-cast frames—loop around a LAN indefinitely. Broadcast storms can saturate all the links with copies of that one single frame, crowding out good frames, as well as significantly impacting end-user device performance by making the PCs process too many broadcast frames. + +To help you understand how this occurs, Figure 9-1 shows a sample network in which Bob sends a broadcast frame. The dashed lines show how the switches forward the frame when + +STP/RSTP does not exist. + +Larry +Fa0/11 Gi0/1 SW1 +Gi0/2 + + +9 Archie +Gi0/2 Fa0/12 SW2 +Gi0/1 + + + + + + + + +Gi0/1 +Gi0/2 +SW3 Fa0/13 + +Bob 0200.3333.3333 +Figure 9-1 Broadcast Storm + + +|||||||||||||||||||| +|||||||||||||||||||| + + +214 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE Bob’s original broadcast would also be forwarded around the other direction, with SW3 sending a copy of the original frame out its Gi0/1 port. To reduce clutter, Figure 9-1 does not show that frame. + +Remember that LAN switch? That logic tells switches to flood broadcasts out all interfaces in the same VLAN except the interface in which the frame arrived. In Figure 9-1, that means SW3 forwards Bob’s frame to SW2, SW2 forwards the frame to SW1, SW1 forwards the frame back to SW3, and SW3 forwards it back to SW2 again. + +When broadcast storms happen, frames like the one in Figure 9-1 keep looping until some-thing changes—someone shuts down an interface, reloads a switch, or does something else to break the loop. Also note that the same event happens in the opposite direction. When Bob sends the original frame, SW3 also forwards a copy to SW1, SW1 forwards it to SW2, and so on. + +The storm also causes a much more subtle problem called MAC table instability. MAC table instability means that the switches’ MAC address tables keep changing because frames with the same source MAC arrive on different ports. To see why, follow this example, in which SW3 begins Figure 9-1 with a MAC table entry for Bob, at the bottom of the figure, associated with port Fa0/13: + +0200.3333.3333 Fa0/13 VLAN 1 +However, now think about the switch-learning process that occurs when the looping frame goes to SW2, then SW1, and then back into SW3’s Gi0/1 interface. SW3 thinks, “Hmm…the source MAC address is 0200.3333.3333, and it came in my Gi0/1 interface. Update my MAC table!” This results in the following entry on SW3, with interface Gi0/1 instead of Fa0/13: + +0200.3333.3333 Gi0/1 VLAN 1 +At this point, SW3 itself cannot correctly deliver frames to Bob’s MAC address. At that instant, if a frame arrives at SW3 destined for Bob—a different frame than the looping frame that causes the problems—SW3 incorrectly forwards the frame out Gi0/1 to SW1, creating even more congestion. + +The looping frames in a broadcast storm also cause a third problem: multiple copies of the frame arrive at the destination. Consider a case in which Bob sends a frame to Larry but none of the switches know Larry’s MAC address. Switches flood frames sent to unknown destination unicast MAC addresses. When Bob sends the frame destined for Larry’s MAC address, SW3 sends a copy to both SW1 and SW2. SW1 and SW2 also flood the frame, causing copies of the frame to loop. SW1 also sends a copy of each frame out Fa0/11 to Larry. As a result, Larry gets multiple copies of the frame, which may result in an application failure, if not more pervasive networking problems. + +Table 9-2 summarizes the main three classes of problems that occur when STP/RSTP is not used in a LAN that has redundancy. + + + +Answers to the “Do I Know This Already?” quiz: 1 A, B 2 C 3 C, D 4 B 5 B, D 6 A, D 7 D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 215 + + +Table 9-2 +Problem + +Three Classes of Problems Caused by Not Using STP in Redundant LANs +Description + + + +Broadcast storms + +MAC table instability + + +Multiple frame transmission + +The forwarding of a frame repeatedly on the same links, consuming significant parts of the links’ capacities +The continual updating of a switch’s MAC address table with incorrect entries, in reaction to looping frames, resulting in frames being sent to the wrong locations +A side effect of looping frames in which multiple copies of one frame are delivered to the intended host, confusing the host + + + +What Spanning Tree Does +STP/RSTP prevents loops by placing each switch port in either a forwarding state or a block-ing state. Interfaces in the forwarding state act as normal, forwarding and receiving frames. However, interfaces in a blocking state do not process any frames except STP/RSTP mes-sages (and some other overhead messages). Interfaces that block do not forward user frames, do not learn MAC addresses of received frames, and do not process received user frames. + +Figure 9-2 shows a simple STP/RSTP tree that solves the problem shown in Figure 9-1 by placing one port on SW3 in the blocking state. + + +Larry +Fa0/11 Gi0/1 SW1 + +Archie Gi0/2 Fa0/12 +SW2 + +3 Gi0/2 3 Gi0/1 4 4 + + +9 + +2 5 BLOCK + +Gi0/1 +Gi0/2 +SW3 Fa0/13 +1 +Bob 0200.3333.3333 +Figure 9-2 What STP/RSTP Does: Blocks a Port to Break the Loop + +Now when Bob sends a broadcast frame, the frame does not loop. As shown in the steps in + +the figure: + +Step 1. + +Step 2. + + + +Bob sends the frame to SW3. + +SW3 forwards the frame only to SW1, but not out Gi0/2 to SW2, because +SW3’s Gi0/2 interface is in a blocking state. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +216 CCNA 200-301 Official Cert Guide, Volume 1 + +Step 3. SW1 floods the frame out both Fa0/11 and Gi0/1. + +Step 4. SW2 floods the frame out Fa0/12 and Gi0/1. + +Step 5. SW3 physically receives the frame, but it ignores the frame received from SW2 because SW3’s Gi0/2 interface is in a blocking state. + + +With the STP/RSTP topology in Figure 9-2, the switches simply do not use the link between SW2 and SW3 for traffic in this VLAN, which is the minor negative side effect of STP. However, if either of the other two links fails, STP/RSTP converges so that SW3 forwards instead of blocks on its Gi0/2 interface. + +NOTE The term STP convergence refers to the process by which the switches collectively realize that something has changed in the LAN topology and determine whether they need to change which ports block and which ports forward. + +That completes the description of what STP/RSTP does, placing each port into either a for-warding or blocking state. The more interesting question, and the one that takes a lot more work to understand, is how and why STP/RSTP makes its choices. How does STP/RSTP manage to make switches block or forward on each interface? And how does it converge to change state from blocking to forwarding to take advantage of redundant links in response to network outages? The following pages answer these questions. + +How Spanning Tree Works +The STP/RSTP algorithm creates a spanning tree of interfaces that forward frames. The tree structure of forwarding interfaces creates a single path to and from each Ethernet link, just like you can trace a single path in a living, growing tree from the base of the tree to each leaf. + +NOTE STP was created before LAN switches even existed, using LAN bridges to connect LANs. Today, switches play the same role as bridges, implementing STP/RSTP. However, many STP/RSTP terms still refer to bridge. For the purposes of STP/RSTP and this chapter, consider the terms bridge and switch synonymous. + +The process used by STP, sometimes called the spanning-tree algorithm (STA), chooses the interfaces that should be placed into a forwarding state. For any interfaces not chosen to be in a forwarding state, STP/RSTP places the interfaces in blocking state. In other words, STP/RSTP simply picks which interfaces should forward, and any interfaces left over go to a blocking state. + +STP/RSTP uses three criteria to choose whether to put an interface in forwarding state: + +■ STP/RSTP elects a root switch. STP puts all working interfaces on the root switch in for-warding state. +■ Each nonroot switch considers one of its ports to have the least administrative cost between itself and the root switch. The cost is called that switch’s root cost. STP/RSTP + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 217 + +places its port that is part of the least root cost path, called that switch’s root port (RP), in forwarding state. +■ Many switches can attach to the same Ethernet segment, but due to the fact that links connect two devices, a link would have at most two switches. With two switches on a link, the switch with the lowest root cost, as compared with the other switches attached to the same link, is placed in forwarding state. That switch is the designated switch, and that switch’s interface, attached to that segment, is called the designated port (DP). + + +NOTE The real reason the root switches place all working interfaces in a forwarding state (at step 1 in the list) is that all its interfaces on the root switch will become DPs. However, it is easier to just remember that all the root switches’ working interfaces will forward frames. + +All other interfaces are placed in blocking state. Table 9-3 summarizes the reasons STP/RSTP places a port in forwarding or blocking state. + +Table 9-3 STP/RSTP: Reasons for Forwarding or Blocking + +Characterization of Port All the root switch’s ports + +Each nonroot switch’s root port +Each LAN’s designated port + + +All other working ports + +STP State Forwarding + +Forwarding + +Forwarding + + +Blocking + +Description +The root switch is always the designated switch on all connected segments. +The port through which the switch has the least cost to reach the root switch (lowest root cost). +The switch forwarding the Hello on to the segment, with the lowest root cost, is the designated switch for that segment. +The port is not used for forwarding user frames, nor are any frames received on these interfaces considered for forwarding. + + + + + + + + + + + + +9 + + + + +NOTE STP/RSTP only considers working interfaces (those in a connected state). Failed interfaces (for example, interfaces with no cable installed) or administratively shutdown interfaces are instead placed into an STP/RSTP disabled state. So, this section uses the term working ports to refer to interfaces that could forward frames if STP/RSTP placed the inter-face into a forwarding state. + + +NOTE STP and RSTP do differ slightly in the use of the names of some states like blocking and disabled, with RSTP using the status term discarding. However, those minor differences do not change the meaning of the discussions in this first section of the chapter. The upcom-ing section titled “Comparing STP and RSTP” discusses these differences, both important and minor. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +218 CCNA 200-301 Official Cert Guide, Volume 1 + +The STP Bridge ID and Hello BPDU +The STA begins with an election of one switch to be the root switch. To better understand this election process, you need to understand the STP/RSTP messages sent between switches as well as the concept and format of the identifier used to uniquely identify each switch. + +The STP/RSTP bridge ID (BID) is an 8-byte value unique to each switch. The bridge ID con-sists of a 2-byte priority field and a 6-byte system ID, with the system ID being based on a universal (burned-in) MAC address in each switch. Using a burned-in MAC address ensures that each switch’s bridge ID will be unique. + +STP/RSTP defines messages called bridge protocol data units (BPDU), also called configu-ration BPDUs, which switches use to exchange information with each other. The most com-mon BPDU, called a Hello BPDU, lists many details, including the sending switch’s BID. By listing its own unique BID, switches can tell which switch sent which Hello BPDU. Table 9-4 lists some of the key information in the Hello BPDU. + + +Table 9-4 +Field + +Fields in the STP Hello BPDU +Description + + + +Root bridge ID + +Sender’s bridge ID + +Sender’s root cost + +Timer values on the root switch + +The bridge ID of the switch the sender of this Hello currently believes to be the root switch +The bridge ID of the switch sending this Hello BPDU + +The STP/RSTP cost between this switch and the current root + +Includes the Hello timer, MaxAge timer, and forward delay timer + + + +For the time being, just keep the first three items from Table 9-4 in mind as the following sections work through the three steps in how STP/RSTP chooses the interfaces to place into a forwarding state. Next, the text examines the three main steps in the STP/RSTP process. + +Electing the Root Switch +Switches elect a root switch based on the BIDs in the BPDUs. The root switch is the switch with the lowest numeric value for the BID. Because the two-part BID starts with the priority value, essentially the switch with the lowest priority becomes the root. For example, if one switch has priority 4096, and another switch has priority 8192, the switch with priority 4096 wins, regardless of what MAC address was used to create the BID for each switch. + +If a tie occurs based on the priority portion of the BID, the switch with the lowest MAC address portion of the BID is the root. No other tiebreaker should be needed because switches use one of their own universal (burned-in) MAC addresses as the second part of their BIDs. So if the priorities tie, and one switch uses a MAC address of 0200.0000.0000 as part of the BID and the other uses 0811.1111.1111, the first switch (MAC 0200.0000.0000) becomes the root switch. + +STP/RSTP elects a root switch in a manner not unlike a political election. The process begins with all switches claiming to be the root by sending Hello BPDUs listing their own BID +as the root BID. If a switch hears a Hello that lists a better (lower) BID, that switch stops + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 219 + +advertising itself as root and starts forwarding the superior Hello. The Hello sent by the bet-ter switch lists the better switch’s BID as the root. It works like a political race in which a less-popular candidate gives up and leaves the race, throwing his support behind the more popular candidate. Eventually, everyone agrees which switch has the best (lowest) BID, and everyone supports the elected switch—which is where the political race analogy falls apart. + +NOTE A better Hello, meaning that the listed root’s BID is better (numerically lower), is called a superior Hello; a worse Hello, meaning that the listed root’s BID is not as good (numerically higher), is called an inferior Hello. + +Figure 9-3 shows the beginning of the root election process. In this case, SW1 has advertised itself as root, as have SW2 and SW3. However, SW2 now believes that SW1 is a better root, so SW2 is now forwarding the Hello originating at SW1. So, at this point, the figure shows SW1 is saying Hello, claiming to be root; SW2 agrees and is forwarding SW1’s Hello that lists SW1 as root; but SW3 is still claiming to be best, sending its own Hello BPDUs, listing SW3’s BID as the root. + +Root Cost: 0 +My BID: 32,769: 0200.0001.0001 Root BID: 32,769: 0200.0001.0001 + + +Gi0/1 Gi0/2 +SW1 SW2 +Gi0/2 Gi0/1 + +Root Cost: 0 +My BID: 32,769: 0200.0001.0001 Root BID:32,769: 0200.0001.0001 + + +Root Cost: 4 +My BID: 32,769: 0200.0002.0002 Root BID: 32,769: 0200.0001.0001 + +9 + +Root Cost: 0 +My BID: 32,769: 0200.0003.0003 +Root Cost: 0 +Root BID:32,769: 0200.0003.0003 Gi0/1 My BID: 32,769: 0200.0003.0003 Gi0/2 Root BID: 32,769: 0200.0003.0003 +SW3 + +Figure 9-3 Beginnings of the Root Election Process + +Two candidates still exist in Figure 9-3: SW1 and SW3. So, who wins? Well, from the BID, the lower-priority switch wins; if a tie occurs, the lower MAC address wins. As shown in the figure, SW1 has a lower BID (32769:0200.0001.0001) than SW3 (32769:0200.0003.0003), so SW1 wins, and SW3 now also believes that SW1 is the better switch. Figure 9-4 shows the resulting Hello messages sent by the switches. + +Summarizing, the root election happens through each switch claiming to be root, with the best switch being elected based on the numerically lowest BID. Breaking down the BID into its components, the comparisons can be made as + +■ The lowest priority +■ If that ties, the lowest switch MAC address + + +|||||||||||||||||||| +|||||||||||||||||||| + + +220 CCNA 200-301 Official Cert Guide, Volume 1 + +Root Cost: 0 +My BID: 32,769: 0200.0001.0001 Root BID: 32,769: 0200.0001.0001 +1 + +Gi0/1 Gi0/2 +SW1 SW2 +Gi0/2 Gi0/1 + +Root Cost: 0 +My BID: 32,769: 0200.0001.0001 Root BID: 32,769: 0200.0001.0001 +1 + + +Root Cost: 4 +My BID: 32,769: 0200.0002.0002 Root BID: 32,769: 0200.0001.0001 +2 + + +2 + +Gi0/1 RMoyoBtICDo: st3:25,769: 0200.0003.0003 +Gi0/2 Root BID: 32,769: 0200.0001.0001 SW3 +Figure 9-4 SW1 Wins the Election + +Choosing Each Switch’s Root Port +The second part of the STP/RSTP process occurs when each nonroot switch chooses its one and only root port. A switch’s RP is its interface through which it has the least STP/RSTP cost to reach the root switch (least root cost). + +The idea of a switch’s cost to reach the root switch can be easily seen for humans. Just look at a network diagram that shows the root switch, lists the STP/RSTP cost associated with each switch port, and identifies the nonroot switch in question. Switches use a different pro-cess than looking at a network diagram, of course, but using a diagram can make it easier to learn the idea. + +Figure 9-5 shows just such a figure, with the same three switches shown in the last several figures. SW1 has already won the election as root, and the figure considers the cost from SW3’s perspective. (Note that the figure uses some nondefault cost settings.) + +SW3 has two possible physical paths to send frames to the root switch: the direct path to the left and the indirect path to the right through switch SW2. The cost is the sum of the costs of all the switch ports the frame would exit if it flowed over that path. (The calcula-tion ignores the inbound ports.) As you can see, the cost over the direct path out SW3’s G0/1 port has a total cost of 5, and the other path has a total cost of 8. SW3 picks its G0/1 port as root port because it is the port that is part of the least-cost path to send frames to the root switch. + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 221 + +Root + +Cost 4 +SW1 Gi0/2 SW2 + + + + + + + + +Total +Cost = 5 Cost 5 + +Total +Cost 4 Cost = 8 + + +Gi0/1 Gi0/2 SW3 +Figure 9-5 How a Human Might Calculate STP/RSTP Cost from SW3 to the Root (SW1) + +Switches come to the same conclusion but using a different process. Instead, they add their local interface STP/RSTP cost to the root cost listed in each received Hello BPDU. The STP/RSTP port cost is simply an integer value assigned to each interface, per VLAN, for the purpose of providing an objective measurement that allows STP/RSTP to choose which inter-faces to add to the STP/RSTP topology. The switches also look at their neighbor’s root cost, as announced in Hello BPDUs received from each neighbor. + +Figure 9-6 shows an example of how switches calculate their best root cost and then choose their root port, using the same topology and STP/RSTP costs as shown in Figure 9-5. STP/RSTP on SW3 calculates its cost to reach the root over the two possible paths by adding the advertised cost (in Hello messages) to the interface costs listed in the figure. + + + +Hello +Root Cost = 0 + +Root + + +0 + 4 = 4 +Interface +Cost = 4 + +My Root Cost Out G0/2 is 4 + + +9 + + + + + +Hello +Root Cost = 0 + +SW1 Gi0/1 Gi0/2 + + + +Root Cost out G0/1 is 5 Root Cost out G0/2 is 8 + + +Gi0/2 SW2 Gi0/1 +Hello +Root Cost = 4 + + + +0 + 5 = 5 + +Interface Cost = 5 +Gi0/1 +SW3 + + +4 + 4 = 8 + +Interface Cost = 4 +Gi0/2 + + +Figure 9-6 How STP/RSTP Actually Calculates the Cost from SW3 to the Root + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +222 CCNA 200-301 Official Cert Guide, Volume 1 + +Focus on the process for a moment. The root switch sends Hellos, with a listed root cost of 0. The idea is that the root’s cost to reach itself is 0. + +Next, look on the left of the figure. SW3 takes the received cost (0) from the Hello sent by SW1 and adds the interface cost (5) of the interface on which that Hello was received. SW3 calculates that the cost to reach the root switch, out that port (G0/1), is 5. + +On the right side, SW2 has realized its best cost to reach the root is cost 4. So, when SW2 forwards the Hello toward SW3, SW2 lists a root cost 4. SW3’s STP/RSTP port cost on port G0/2 is 4, so SW3 determines a total cost to reach root out its G0/2 port of 8. + +As a result of the process depicted in Figure 9-6, SW3 chooses Gi0/1 as its RP because the cost to reach the root switch through that port (5) is lower than the other alternative (Gi0/2, cost 8). Similarly, SW2 chooses Gi0/2 as its RP, with a cost of 4 (SW1’s advertised cost of +0 plus SW2’s Gi0/2 interface cost of 4). Each switch places its root port into a forwarding state. + +Switches need a tiebreaker to use in case the best root cost ties for two or more paths. If a tie occurs, the switch applies these three tiebreakers to the paths that tie, in order, as follows: +1. Choose based on the lowest neighbor bridge ID. +2. Choose based on the lowest neighbor port priority. +3. Choose based on the lowest neighbor internal port number. + +Choosing the Designated Port on Each LAN Segment +STP/RSTP’s final step to choose the STP/RSTP topology is to choose the designated port on each LAN segment. The designated port (DP) on each LAN segment is the switch port that advertises the lowest-cost Hello onto a LAN segment. When a nonroot switch forwards a Hello, the nonroot switch sets the root cost field in the Hello to that switch’s cost to reach the root. In effect, the switch with the lower cost to reach the root, among all switches con-nected to a segment, becomes the DP on that segment. + +For example, earlier Figure 9-4 shows in bold text the parts of the Hello messages from both SW2 and SW3 that determine the choice of DP on that segment. Note that both SW2 and SW3 list their respective cost to reach the root switch (cost 4 on SW2 and cost 5 on SW3). SW2 lists the lower cost, so SW2’s Gi0/1 port is the designated port on that LAN segment. + +All DPs are placed into a forwarding state; so in this case, SW2’s Gi0/1 interface will be in a forwarding state. + +If the advertised costs tie, the switches break the tie by choosing the switch with the lower BID. In this case, SW2 would also have won, with a BID of 32769:0200.0002.0002 versus SW3’s 32769:0200.0003.0003. + +NOTE Two additional tiebreakers are needed in some cases, although these would be unlikely today. A single switch can connect two or more interfaces to the same collision domain by connecting to a hub. In that case, the one switch hears its own BPDUs. So, if a switch ties with itself, two additional tiebreakers are used: the lowest interface STP/RSTP pri-ority and, if that ties, the lowest internal interface number. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 223 + +The only interface that does not have a reason to be in a forwarding state on the three switches in the examples shown in Figures 9-3 through 9-6 is SW3’s Gi0/2 port. So, the STP/RSTP process is now complete. Table 9-5 outlines the state of each port and shows why it is in that state. + +Table 9-5 State of Each Interface +Switch State Reason Why the Interface Is in Forwarding State Interface +SW1, Gi0/1 Forwarding The interface is on the root switch, so it becomes the DP on that link. + +SW1, Gi0/2 Forwarding The interface is on the root switch, so it becomes the DP on that link. + +SW2, Gi0/2 Forwarding The root port of SW2. + +SW2, Gi0/1 Forwarding The designated port on the LAN segment to SW3. + +SW3, Gi0/1 Forwarding The root port of SW3. + +SW3, Gi0/2 Blocking Not the root port and not the designated port. + + +Note that the examples in this section focus on the links between the switches, but switch ports connected to endpoint devices should become DPs and settle into a forwarding state. Working through the logic, each switch will forward BPDUs on each port as part of the process to determine the DP on that LAN. Endpoints should ignore those messages because they do not run STP/RSTP, so the switch will win and become DP on every access port. + +Configuring to Influence the STP Topology +STP/RSTP works by default on Cisco switches, so all the settings needed by a switch have a useful default. Switches have a default BID, based on a default priority value and adding a +universal MAC address that comes with the switch hardware. Additionally, switch interfaces +have default STP/RSTP costs based on the current operating speed of the switch interfaces. 9 + +Network engineers often want to change the STP/RSTP settings to then change the choices STP/RSTP makes in a given LAN. Two main tools available to the engineer are to configure the bridge ID and to change STP/RSTP port costs. + +First, to change the BID, the engineer can set the priority used by the switch, while continu-ing to use the universal MAC address as the final 48 bits of the BID. For instance, giving a switch the lowest priority value among all switches will cause that switch to win the root election. + +Port costs also have default values, per port, per VLAN. You can configure these port costs, which will in turn impact many switch’s calculations of the root cost. For instance, to favor one link, give the ports on that link a lower cost, or to avoid a link, give the ports a higher cost. + +Of course, it helps to know the default cost values so you can then choose alternative values as needed. Table 9-6 lists the default port costs suggested by IEEE. IOS on Cisco switches has long used the default settings as defined as far back as the 1998 version of the IEEE 802.1D standard. The latest IEEE standard to suggest RSTP default costs (as of the + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +224 CCNA 200-301 Official Cert Guide, Volume 1 + +publication of this book), the 2018 publication of the 802.1Q standard, suggests values that are more useful when using links faster than 10 Gbps. + +Table 9-6 Default Port Costs According to IEEE + +Ethernet Speed 10 Mbps +100 Mbps + +1 Gbps + +10 Gbps + +100 Gbps + +1 Tbps + +IEEE Cost: 1998 (and Before) 100 +19 + +4 + +2 + +N/A + +N/A + +IEEE Cost: 2004 (and After) 2,000,000 +200,000 + +20,000 + +2000 + +200 + +20 + + + +Of note in regards to these defaults, the cost defaults based on the operating speed of the link, not the maximum speed. That is, if a 10/100/1000 port runs at 10 Mbps for some rea-son, its default STP cost on a Cisco switch is 100, the default cost for an interface running at 10 Mbps. Also, if you prefer the defaults in the right-side column of Table 9-6, note that +Cisco Catalyst switches can be configured to use those values as defaults with a single global configuration command on each switch (spanning-tree pathcost method long). + +Details Specific to STP (and Not RSTP) +As promised in the introduction to this chapter, the first section showed features that apply to both STP and RSTP. This next heading acts as the turning point, with the next several pages being about STP only. The upcoming section titled “Rapid STP Concepts” then shows details specific to RSTP, in contrast to STP. + +Once the engineer has finished all STP configuration, the STP topology should settle into a stable state and not change, at least until the network topology changes. This section exam-ines the ongoing operation of STP while the network is stable, and then it covers how STP converges to a new topology when something changes. + +Note that almost all the differences between STP and RSTP revolve around the activities of waiting for and reacting to changes in the topology. STP performed well for the era and circumstances in which it was created. The “rapid” in RSTP refers to the improvements to how fast RSTP could react when changes occur—so understanding how STP reacts will be +useful to understand why RSTP reacts faster. These next few pages show the specifics of STP (and not RSTP) and how STP reacts to and manages convergence when changes happen in an Ethernet LAN. + +STP Activity When the Network Remains Stable +An STP root switch sends a new Hello BPDU every 2 seconds by default. Each nonroot switch forwards the Hello on all DPs, but only after changing items listed in the Hello. (As a result, the Hello flows once over every working link in the LAN.) + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 225 + +When forwarding the Hello BPDU, each switch sets the root cost to that local switch’s calcu-lated root cost. The switch also sets the “sender’s bridge ID” field to its own bridge ID. (The root’s bridge ID field is not changed.) + +Assuming a default Hello timer of 2 seconds on the root switch, each switch will forward the received (and changed) Hellos out all DPs so that all switches continue to receive Hellos every 2 seconds. The following steps summarize the steady-state operation when nothing is currently changing in the STP topology: +Step 1. The root creates and sends a Hello BPDU, with a root cost of 0, out all its work-ing interfaces (those in a forwarding state). + +Step 2. The nonroot switches receive the Hello on their root ports. After changing the Hello to list their own BID as the sender’s BID and listing that switch’s root cost, the switch forwards the Hello out all designated ports. +Step 3. Steps 1 and 2 repeat until something changes. + + +When a switch fails to receive a Hello, it knows a problem might be occurring in the net-work. Each switch relies on these periodically received Hellos from the root as a way to know that its path to the root is still working. When a switch ceases to receive the Hellos, or receives a Hello that lists different details, something has failed, so the switch reacts and starts the process of changing the spanning-tree topology. + +STP Timers That Manage STP Convergence +For various reasons, the STP convergence process requires the use of three timers, listed in Table 9-7. Note that all switches use the timers as dictated by the root switch, which the root lists in its periodic Hello BPDU messages. + + +Table 9-7 Timer + +Hello + +MaxAge + +Forward delay + +STP Timers +Default Value +2 seconds + +10 times Hello +15 seconds + + +Description 9 + +The time period between Hellos created by the root. + +How long any switch should wait, after ceasing to hear Hellos, before trying to change the STP topology. +Delay that affects the process that occurs when an interface changes from blocking state to forwarding state. A port stays in an interim listening state, and then an interim learning state, for the number of seconds defined by the forward delay timer. + + + +If a switch does not get an expected Hello BPDU within the Hello time, the switch continues as normal. However, if the Hellos do not show up again within MaxAge time, the switch reacts by taking steps to change the STP topology. With default settings, MaxAge is 20 sec-onds (10 times the default Hello timer of 2 seconds). So, a switch would go 20 seconds with-out hearing a Hello before reacting. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +226 CCNA 200-301 Official Cert Guide, Volume 1 + +After MaxAge expires, the switch essentially makes all its STP choices again, based on any Hellos it receives from other switches. It reevaluates which switch should be the root switch. If the local switch is not the root, it chooses its RP. And it determines whether it is DP on each of its other links. + +The best way to describe STP convergence is to show an example using the same familiar topology. Figure 9-7 shows the same familiar figure, with SW3’s Gi0/2 in a blocking state, but SW1’s Gi0/2 interface has just failed. + + + + + +Larry DP Root Fa0/11 +SW1 + +Hello +Root is SW1 I am SW1 Root Cost = 0 + +DP +Gi0/1 + + + + + +RP DP Archie +Gi0/2 Fa0/12 +SW2 + +Hello DP Gi0/2 DP Gi0/1 + +Root is SW1 I am SW1 Root Cost = 0 + + +Hello +Root is SW1 I am SW2 Root Cost = 4 + + + + +RP Gi0/1 +Gi0/2 Legend: +SW3 RP – Root Port + +DP Fa0/13 + + +Bob + +DP – Designated Port – Blocking Port +– Failing Link + + +Figure 9-7 Initial STP State Before SW1-SW3 Link Fails + +In the scenario shown in the figure, SW3 reacts to the change because SW3 fails to receive its expected Hellos on its Gi0/1 interface. However, SW2 does not need to react because SW2 continues to receive its periodic Hellos in its Gi0/2 interface. In this case, SW3 reacts either when MaxAge time passes without hearing the Hellos, or as soon as SW3 notices that interface Gi0/1 has failed. (If the interface fails, the switch can assume that the Hellos will not be arriving in that interface anymore.) + +Now that SW3 can act, it begins by reevaluating the choice of root switch. SW3 still receives the Hellos from SW2, as forwarded from the root (SW1). SW1 still has a lower BID than SW3; otherwise, SW1 would not have already been the root. So, SW3 decides that SW1 wins the root election and that SW3 is not the root. + +Next, SW3 reevaluates its choice of RP. At this point, SW3 is receiving Hellos on only one interface: Gi0/2. Whatever the calculated root cost, Gi0/2 becomes SW3’s new RP. (The cost would be 8, assuming the STP costs had no changes since Figures 9-5 and 9-6.) + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 227 + +SW3 then reevaluates its role as DP on any other interfaces. In this example, no real work needs to be done. SW3 was already DP on interface Fa0/13, and it continues to be the DP because no other switches connect to that port. + +Changing Interface States with STP +STP uses the idea of roles and states. Roles, like root port and designated port, relate to how STP analyzes the LAN topology. States, like forwarding and blocking, tell a switch whether to send or receive frames. When STP converges, a switch chooses new port roles, and the port roles determine the state (forwarding or blocking). + +Switches using STP can simply move immediately from forwarding to blocking state, but they must take extra time to transition from blocking state to forwarding state. For instance, when switch SW3 in Figure 9-7 formerly used port G0/1 as its RP (a role), that port was in +a forwarding state. After convergence, G0/1 might be neither an RP nor DP; the switch can immediately move that port to a blocking state. + +However, when a port that formerly blocked needs to transition to forwarding, the switch first puts the port through two intermediate interface states. These temporary STP states help prevent temporary loops: + +■ Listening: Like the blocking state, the interface does not forward frames. The switch removes old stale (unused) MAC table entries for which no frames are received from each MAC address during this period. These stale MAC table entries could be the cause of the temporary loops. +■ Learning: Interfaces in this state still do not forward frames, but the switch begins to learn the MAC addresses of frames received on the interface. + + +STP moves an interface from blocking to listening, then to learning, and then to forward-ing state. STP leaves the interface in each interim state for a time equal to the forward delay +timer, which defaults to 15 seconds. As a result, a convergence event that causes an interface to change from blocking to forwarding requires 30 seconds to transition from blocking to forwarding. In addition, a switch might have to wait MaxAge seconds (default 20 seconds) before even choosing to move an interface from blocking to forwarding state. + +For example, follow what happens with an initial STP topology as shown in Figures 9-3 through 9-6, with the SW1-to-SW3 link failing as shown in Figure 9-7. If SW1 simply quit sending Hello messages to SW3, but the link between the two did not fail, SW3 would wait MaxAge seconds before reacting (20 seconds is the default). SW3 would actually quickly choose its ports’ STP roles, but then wait 15 seconds each in listening and learning states on interface Gi0/2, resulting in a 50-second convergence delay. + +Table 9-8 summarizes spanning tree’s various interface states for easier review. + + + +9 + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +228 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 9-8 IEEE STP (Not RSTP) States + +State + +Blocking + +Listening + +Learning + +Forwarding + +Disabled + +Forwards Data Frames? +No + +No + +No + +Yes + +No + +Learns MACs Based on Received Frames? +No + +No + +Yes + +Yes + +No + +Transitory or Stable State? +Stable + +Transitory + +Transitory + +Stable + +Stable + + + +Rapid STP Concepts +The original STP worked well given the assumptions about networks and networking devices in that era. However, as with any computing or networking standard, as time passes, hard-ware and software capabilities improve, so new protocols emerge to take advantage of those new capabilities. For STP, one of the most significant improvements over time has been the introduction of Rapid Spanning Tree Protocol (RSTP), introduced as standard IEEE 802.1w. + +NOTE Just to make sure you are clear about the terminology: Throughout the rest of the chapter, STP refers to the original STP standard only, and use of the term RSTP does not include STP. + +Before getting into the details of RSTP, it helps to make sense of the standards numbers a bit. 802.1w was actually an amendment to the 802.1D standard. The IEEE first published 802.1D in 1990, and anew in 1998. After the 1998 version of 802.1D, the IEEE published the 802.1w amendment to 802.1D in 2001, which first standardized RSTP. + +Over the years, other meaningful changes happened in the standards as well, although those changes probably do not impact most networkers’ thinking when it comes to working with STP or RSTP. But to be complete, the IEEE replaced STP with RSTP in the revised 802.1D standard in 2004. In another move, in 2011 the IEEE moved all the RSTP details into a revised 802.1Q standard. As it stands today, RSTP actually sits in the 802.1Q standards document. + +As a result, when reading about RSTP, you will see documents, books, videos, and the like that refer to RSTP and include various references to 802.1w, 802.1D, and 802.1Q—and they might all be correct based on timing and context. At the same time, many people refer to RSTP as 802.1w because that was the first IEEE document to define it. However, for the purposes of this book, focus instead on the RSTP acronym rather than the IEEE standards numbers used with RSTP over its history. + +NOTE The IEEE sells its standards, but through the “Get IEEE 802” program, you can get free PDFs of the current 802 standards. To read about RSTP today, you will need to down-load the 802.1Q standard, and then look for the sections about RSTP. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 229 + +Now on to the details about RSTP in this chapter. As discussed throughout this chapter, RSTP and STP have many similarities, so this section next compares and contrasts the two. Following that, the rest of this section discusses the concepts unique to RSTP that are not found in STP—alternate root ports, different port states, backup ports, and the port roles used by RSTP. + +Comparing STP and RSTP +RSTP works just like STP in several ways, as discussed in the first major section of the chap-ter. To review: + +■ RSTP and STP elect the root switch using the same rules and tiebreakers. ■ RSTP and STP switches select their root ports with the same rules. +■ RSTP and STP elect designated ports on each LAN segment with the same rules and tiebreakers. +■ RSTP and STP place each port in either forwarding or blocking state, although RSTP calls the blocking state the discarding state. + +In fact, RSTP works so much like STP that they can both be used in the same network. RSTP and STP switches can be deployed in the same network, with RSTP features working in switches that support it and traditional STP features working in the switches that support only STP. + +With all these similarities, you might be wondering why the IEEE bothered to create RSTP in the first place. The overriding reason is convergence. STP takes a relatively long time to converge (50 seconds with the default settings when all the wait times must be followed). RSTP improves network convergence when topology changes occur, usually converging within a few seconds (or in slow conditions, in about 10 seconds). + +RSTP changes and adds to STP in ways that avoid waiting on STP timers, resulting in quick +transitions from forwarding to discarding (blocking) state and vice versa. Specifically, RSTP, 9 +compared to STP, defines more cases in which the switch can avoid waiting for a timer to expire, such as the following: + +■ RSTP adds a mechanism by which a switch can replace its root port, without any waiting to reach a forwarding state (in some conditions). +■ RSTP adds a new mechanism to replace a designated port, without any waiting to reach a forwarding state (in some conditions). +■ RSTP lowers waiting times for cases in which RSTP must wait for a timer. + +For instance, imagine a failure case in which a link remains up, but for some reason, a non-root switch stops hearing the Hello BPDUs it had been hearing in the past. STP requires a switch to wait for MaxAge seconds, which STP defines based on 10 times the Hello timer, or 20 seconds, by default. RSTP shortens this timer, defining MaxAge as three times the Hello timer. Additionally, RSTP can send messages to the neighboring switch to inquire whether a problem has occurred rather than wait for timers. + +The best way to get a sense for these mechanisms is to see how the RSTP alternate port and the backup port both work. RSTP uses the term alternate port to refer to a switch’s other + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +230 CCNA 200-301 Official Cert Guide, Volume 1 + +ports that could be used as the root port if the root port ever fails. The backup port concept provides a backup port on the local switch for a designated port. (Note that backup ports apply only to designs that use hubs, so they are unlikely to be useful today.) However, both are instructive about how RSTP works. Table 9-9 lists these RSTP port roles. + +Table 9-9 Port Roles in RSTP +Function Port Role + +Port that begins a nonroot switch’s best path to the root + +Port that replaces the root port when the root port fails + +Switch port designated to forward onto a collision domain + +Port that replaces a designated port when a designated port fails + +Port that is administratively disabled + +Root port + +Alternate port + +Designated port + +Backup port + +Disabled port + + + +RSTP differs from STP in a few other ways as well. For instance, with STP, the root switch creates a Hello with all other switches, updating and forwarding the Hello. With RSTP, each switch independently generates its own Hellos. Additionally, RSTP allows for queries between neighbors, rather than waiting on timers to expire, as a means to avoid waiting to learn information. These types of protocol changes help RSTP-based switches isolate what has changed in a network and react quickly to choose a net RSTP topology. + +The next few pages work through some of those overt RSTP features that differ from STP. + +RSTP and the Alternate (Root) Port Role +With STP, each nonroot switch places one port in the STP root port (RP) role. RSTP follows that same convention, with the same exact rules for choosing the RP. RSTP then takes anoth-er step beyond STP, naming other possible RPs, identifying them as alternate ports. + +To be an alternate port, both the RP and the alternate port must receive Hellos that identify the same root switch. For instance, in Figure 9-8, SW1 is the root. SW3 will receive Hello BPDUs on two ports: G0/1 and G0/2. Both Hellos list SW1’s bridge ID (BID) as the root switch, so whichever port is not the root port meets the criteria to be an alternate port. SW3 picks G0/1 as its root port in this case and then makes G0/2 an alternate port. + +An alternate port basically works like the second-best option for the root port. The alternate port can take over for the former root port, often very rapidly, without requiring a wait in other interim RSTP states. For instance, when the root port fails, or when Hellos stop arriv-ing on the original root port, the switch changes the former root port’s role and state: (a) the role from root port to a disabled port, and (b) the state from forwarding to discarding (the equivalent of STP’s blocking state). Then, without waiting on any timers, the switch changes roles and state for the alternate port: its role changes to be the root port, with a forwarding state. + +Notably, the new root port also does not need to spend time in other states, such as learning state, instead moving immediately to forwarding state. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 231 + +Root DP RP +Gi0/1 Gi0/2 +SW1 SW2 +DP Gi0/2 DP Gi0/1 + + + +Root is SW1 I am SW1 Root Cost = 0 + +Root is SW1 I am SW2 Root Cost = 4 + + + + + +RP Gi0/1 +ALT SW3 Gi0/2 + +Legend: +RP – Root Port ALT – Alternate Port +– Discarding State +– Failing Link + + +Figure 9-8 Example of SW3 Making G0/2 Become an Alternate Port + +Figure 9-9 shows an example of RSTP convergence. SW3’s root port before the failure shown in this figure is SW3’s G0/1, the link connected directly to SW1 (the root switch). Then SW3’s link to SW1 fails as shown in Step 1 of the figure. + +Root DP RP +Gi0/1 Gi0/2 +SW1 SW2 +DP Gi0/2 ALT DP Gi0/1 + +2 +1 RSTP + + + + + +Gi0/1 3 RP +SW3 Gi0/2 + + +4 +Immediate Change to Forwarding + +9 Legend: +RP – Root Port ALT – Alternate Port +– Discarding State +– Failing Link + + +Figure 9-9 Convergence Events with SW3 G0/1 Failure + +Following the steps in Figure 9-9: + +Step 1. The link between SW1 and SW3 fails, so SW3’s current root port (Gi0/1) fails. + +Step 2. SW3 and SW2 exchange RSTP messages to confirm that SW3 will now transi-tion its former alternate port (Gi0/2) to be the root port. This action causes SW2 to flush the required MAC table entries. +Step 3. SW3 transitions Gi0/1 to the disabled role and Gi0/2 to the root port role. + +Step 4. SW3 transitions Gi0/2 to a forwarding state immediately, without using learning state, because this is one case in which RSTP knows the transition will not cre-ate a loop. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +232 CCNA 200-301 Official Cert Guide, Volume 1 + +As soon as SW3 realizes its Gi0/1 interface has failed, the process shown in the figure takes very little time. None of the processes rely on timers, so as soon as the work can be done, the convergence completes. (This particular convergence example takes about 1 second in a lab.) + +RSTP States and Processes +The depth of the previous example does not point out all details of RSTP, of course; how-ever, the example does show enough details to discuss RSTP states and internal processes. + +Both STP and RSTP use port states, but with some differences. First, RSTP keeps both the learning and forwarding states as compared with STP, for the same purposes. However, +RSTP does not even define a listening state, finding it unnecessary. Finally, RSTP renames the blocking state to the discarding state and redefines its use slightly. + +RSTP uses the discarding state for what STP defines as two states: disabled state and blocking state. Blocking should be somewhat obvious by now: the interface can work physically, but STP/RSTP chooses to not forward traffic to avoid loops. STP’s disabled state simply meant that the interface was administratively disabled. RSTP just combines those into a single discarding state. Table 9-10 shows the list of STP and RSTP states for comparison purposes. + +Table 9-10 Port States Compared: STP and RSTP +Function STP State RSTP State + +Port is administratively disabled + +Stable state that ignores incoming data frames and is not used to forward data frames +Interim state without MAC learning and without forwarding + +Interim state with MAC learning and without forwarding + +Stable state that allows MAC learning and forwarding of data frames + +Disabled + +Blocking + +Listening + +Learning + +Forwarding + +Discarding + +Discarding + +Not used + +Learning + +Forwarding + + + +RSTP also changes some processes and message content (compared to STP) to speed conver-gence. For example, STP waits for a time (forward delay) in both listening and learning states. The reason for this delay in STP is that, at the same time, the switches have all been told +to time out their MAC table entries. When the topology changes, the existing MAC table entries may actually cause a loop. With STP, the switches all tell each other (with BPDU messages) that the topology has changed and to time out any MAC table entries using the forward delay timer. This removes the entries, which is good, but it causes the need to wait in both listening and learning state for forward delay time (default 15 seconds each). + +RSTP, to converge more quickly, avoids relying on timers. RSTP switches tell each other (using messages) that the topology has changed. Those messages also direct neighboring switches to flush the contents of their MAC tables in a way that removes all the potentially loop-causing entries, without a wait. As a result, RSTP creates more scenarios in which a for-merly discarding port can immediately transition to a forwarding state, without waiting, and without using the learning state, as shown in the example in Figure 9-9. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 233 + +RSTP and the Backup (Designated) Port Role +The RSTP backup port role acts as yet another new RSTP port role as compared to STP. As a reminder, the RSTP alternate port role creates a way for RSTP to quickly replace a switch’s root port. Similarly, the RSTP backup port role creates a way for RSTP to quickly replace a switch’s designated port on some LAN. + +The need for a backup port can be a bit confusing at first because the need for the backup port role only happens in designs that are a little unlikely today. The reason is that a design must use hubs, which then allows the possibility that one switch connects more than one port to the same collision domain. + +Figure 9-10 shows an example. SW3 and SW4 both connect to the same hub. SW4’s port F0/1 happens to win the election as designated port (DP). The other port on SW4 that con-nects to the same collision domain, F0/2, acts as a backup port. + + +SW1 SW2 + + + +SW3 SW4 + +F0/4 + + + + + +Figure 9-10 + +F0/1 F0/2 +DP Backup + + + +Hub +RSTP Backup Port Example + + + +With a backup port, if the current designated port fails, SW4 can start using the backup port with rapid convergence. For instance, if SW4’s F0/1 interface were to fail, SW4 could transition F0/2 to the designated port role, without any delay in moving from discarding +state to a forwarding state. + + +9 + + +RSTP Port Types +The final RSTP concept included here relates to some terms RSTP uses to refer to different types of ports and the links that connect to those ports. + +To begin, consider the basic image in Figure 9-11. It shows several links between two switch-es. RSTP considers these links to be point-to-point links and the ports connected to them to be point-to-point ports because the link connects exactly two devices (points). + +RSTP further classifies point-to-point ports into two categories. Point-to-point ports that connect two switches are not at the edge of the network and are simply called point-to-point ports. Ports that instead connect to a single endpoint device at the edge of the net-work, like a PC or server, are called point-to-point edge ports, or simply edge ports. In Figure 9-11, SW3’s switch port connected to a PC is an edge port. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +234 CCNA 200-301 Official Cert Guide, Volume 1 + + +Point-to-point Port + +Point-to-point Port + + +SW1 SW2 + + + +SW3 SW4 + +Point-to-point Shared Edge Port Port + +Hub + + + +Figure 9-11 RSTP Link Types + +Finally, RSTP defines the term shared to describe ports connected to a hub. The term shared comes from the fact that hubs create a shared Ethernet; hubs also force the attached switch port to use half-duplex logic. RSTP assumes that all half-duplex ports may be con-nected to hubs, treating ports that use half duplex as shared ports. RSTP converges more slowly on shared ports as compared to all point-to-point ports. + +Optional STP Features +To close out the chapter, the last few topics introduce a few optional features that make STP work even better or be more secure: EtherChannel, PortFast, and BPDU Guard. + +EtherChannel +One of the best ways to lower STP’s convergence time is to avoid convergence altogether. EtherChannel provides a way to prevent STP convergence from being needed when only a single port or cable failure occurs. + +EtherChannel combines multiple parallel segments of equal speed (up to eight) between the same pair of switches, bundled into an EtherChannel. The switches treat the EtherChannel as a single interface with regard to STP. As a result, if one of the links fails, but at least one of the links is up, STP convergence does not have to occur. For example, Figure 9-12 shows the familiar three-switch network, but now with two Gigabit Ethernet connections between each pair of switches. + +With each pair of Ethernet links configured as an EtherChannel, STP treats each EtherChannel as a single link. In other words, both links to the same switch must fail for a switch to need to cause STP convergence. Without EtherChannel, if you have multiple par-allel links between two switches, STP blocks all the links except one. With EtherChannel, all the parallel links can be up and working at the same time, while reducing the number of times STP must converge, which in turn makes the network more available. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 235 + +Larry Archie + +SW1 SW2 + + + + + + +SW3 + + +Bob + +Figure 9-12 Two-Segment EtherChannels Between Switches + +The current CCNA exam blueprint includes a topic for the configuration of both Layer 2 EtherChannels (as described here) as well as Layer 3 EtherChannels. Chapter 10, “RSTP and EtherChannel Configuration,” shows how to configure Layer 2 EtherChannels, while Chapter 17, “IP Routing in the LAN,” shows how to configure Layer 3 EtherChannels. Note that Layer 2 EtherChannels combine links that switches use as switch ports, with the switches using Layer 2 switching logic to forward and receive Ethernet frames over the EtherChannels. Layer 3 EtherChannels also combine links, but the switches use Layer 3 routing logic to for-ward packets over the EtherChannels. + +PortFast +PortFast allows a switch to immediately transition from blocking to forwarding, bypass-ing listening and learning states. However, the only ports on which you can safely enable PortFast are ports on which you know that no bridges, switches, or other STP-speaking +devices are connected. Otherwise, using PortFast risks creating loops, the very thing that the +listening and learning states are intended to avoid. 9 +PortFast is most appropriate for connections to end-user devices. If you turn on PortFast on ports connected to end-user devices, when an end-user PC boots, the switch port can move to an STP forwarding state and forward traffic as soon as the PC NIC is active. Without PortFast, each port must wait while the switch confirms that the port is a DP. With STP in particular (and not RSTP), the switch waits in the temporary listening and learning states before settling into the forwarding state. + +As you might guess from the fact that PortFast speeds convergence, RSTP includes PortFast. You might recall the mention of RSTP port types, particularly point-to-point edge port types, around Figure 9-11. RSTP, by design of the protocol, converges quickly on these point-to-point edge type ports by bypassing the learning state, which is the same idea Cisco originally introduced with PortFast. In practice, Cisco switches enable RSTP point-to-point edge ports by enabling PortFast on the port. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +236 CCNA 200-301 Official Cert Guide, Volume 1 + +BPDU Guard +STP and RSTP open up the LAN to several different types of possible security exposures. For example: + +■ An attacker could connect a switch to one of these ports, one with a low STP/RSTP pri-ority value, and become the root switch. The new STP/RSTP topology could have worse performance than the desired topology. +■ The attacker could plug into multiple ports, into multiple switches, become root, and actually forward much of the traffic in the LAN. Without the networking staff realizing it, the attacker could use a LAN analyzer to copy large numbers of data frames sent through the LAN. +■ Users could innocently harm the LAN when they buy and connect an inexpensive consumer LAN switch (one that does not use STP/RSTP). Such a switch, without any STP/RSTP function, would not choose to block any ports and could cause a loop. + +The Cisco BPDU Guard feature helps defeat these kinds of problems by disabling a port if any BPDUs are received on the port. So, this feature is particularly useful on ports that should be used only as an access port and never connected to another switch. + +In addition, the BPDU Guard feature helps prevent problems with PortFast. PortFast should be enabled only on access ports that connect to user devices, not to other LAN switches. Using BPDU Guard on these same ports makes sense because if another switch connects to such a port, the local switch can disable the port before a loop is created. + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 9-11 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 9-11 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Resource Used Book, website +Book, website + +Book, PTP + +Website + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 9: Spanning Tree Protocol Concepts 237 + +Review All the Key Topics + +Table 9-12 Key Topics for Chapter 9 + +Key Topic Element +Table 9-2 + +Table 9-3 + +Table 9-4 + +List + +Figure 9-6 + +Table 9-6 + +Step list + +Table 9-7 + +List + +Table 9-8 + +List + +List + +Table 9-9 + +Table 9-10 + +Description Page Number +Lists the three main problems that occur when not using STP 215 in a LAN with redundant links +Lists the reasons why a switch chooses to place an interface 217 into forwarding or blocking state +Lists the most important fields in Hello BPDU messages 218 + +Logic for the root switch election 219 + +Shows how switches calculate their root cost 221 + +Lists the original and current default STP port costs for 224 various interface speeds +A summary description of steady-state STP operations 225 + +STP timers 226 + +Definitions of what occurs in the listening and learning states 227 + +Summary of 802.1D states 228 + +Key similarities between 802.1D STP and 802.1w RSTP 229 + +Methods RSTP uses to reduce convergence time 229 + +List of 802.1w port roles 230 + +Comparisons of port states with 802.1D and 802.1w 232 + + +9 Key Terms You Should Know +blocking state, BPDU Guard, bridge ID, bridge protocol data unit (BPDU), designated port, EtherChannel, forward delay, forwarding state, Hello BPDU, learning state, listening state, MaxAge, PortFast, root port, root switch, root cost, Spanning Tree Protocol (STP), rapid STP (RSTP), alternate port, backup port, disabled port, discarding state + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 10 + + +RSTP and EtherChannel Configuration + +This chapter covers the following exam topics: + +2.0 Network Access +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) + +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree Protocol and identify basic operations + +2.5.a Root port, root bridge (primary/secondary), and other port names + +2.5.b Port states (forwarding/blocking) + +2.5.c PortFast benefits + +This chapter shows how to configure Rapid Spanning Tree Protocol (RSTP) and Layer 2 EtherChannels. The EtherChannel content, in the second major section of the chapter, follows a typical flow for most configuration/verification topics in a certification guide: it reviews concepts, shows configurations, and provides show commands that point out the configuration settings and operational state. The details include how to manually configure a channel, how to cause a switch to dynamically create a channel, and how EtherChannel load distribution works. + +The first section of the chapter explores RSTP implementation taking a different approach. Cisco mentions RSTP concepts, but not configuration/verification, in the CCNA exam top-ics. However, to get a real sense of RSTP concepts, especially some concepts specific to Cisco Catalyst switches, you need to work with RSTP configuration and verification. The first section of the chapter explores RSTP implementation, but as a means to the end of more fully understanding RSTP concepts. + +For those of you who, like me, probably would want to go ahead and practice configuring RSTP, do some show commands, and understand more fully, you do have some options: + +■ Read Appendix O, “Spanning Tree Protocol Implementation,” from this book’s compan-ion website. The appendix is a chapter from the previous edition of this book, with full details of configuration/verification of STP and RSTP. +■ Use the STP/RSTP config labs on my blog site (as regularly listed in the Chapter Review section of each chapter). + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Table 10-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Understanding RSTP Through Configuration + +Implementing EtherChannel + +Questions 1–3 +4–6 + + + +1. Which type value on the spanning-tree mode type global command enables the use of RSTP? +a. rapid-pvst b. pvst +c. rstp d. rpvst +2. Examine the following output from the show spanning-tree vlan 5 command, which describes a root switch in a LAN. Which answers accurately describe facts related to the root’s bridge ID? +SW1# show spanning-tree vlan 5 + +VLAN0005 +Spanning tree enabled protocol rstp + +Root ID Priority +Address +Cost +Port +Hello Time + +32773 +1833.9d7b.0e80 +15 +25 (GigabitEthernet0/1) +2 sec Max Age 20 sec Forward Delay 15 sec + + +a. The system ID extension value, in decimal, is 5. b. The root’s configured priority value is 32773. c. The root’s configured priority value is 32768. +d. The system ID extension value, in hexadecimal, is 1833.9d7b.0e80. + +3. With the Cisco RPVST+, which of the following action(s) does a switch take to iden-tify which VLAN is described by a BPDU? (Choose three answers.) +a. Adds a VLAN tag when forwarding a BPDU on trunks b. Adds the VLAN ID in an extra TLV in the BPDU +c. Lists the VLAN ID as the middle 12 bits of the System ID field of the BPDU d. Lists the VLAN ID in the System ID Extension field of the BPDU + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +240 CCNA 200-301 Official Cert Guide, Volume 1 + +4. An engineer configures a switch to put interfaces G0/1 and G0/2 into the same Layer 2 EtherChannel. Which of the following terms is used in the configuration commands? +a. EtherChannel b. PortChannel +c. Ethernet-Channel d. Channel-group +5. Which combinations of keywords on the channel-group interface subcommand on two neighboring switches will cause the switches to use LACP and attempt to add the link to the EtherChannel? (Choose two answers.) +a. desirable and active b. passive and active c. active and auto +d. active and active + +6. A Cisco Catalyst switch needs to send frames over a Layer 2 EtherChannel. Which answer best describes how the switch balances the traffic over the four active links in the channel? +a. Breaks each frame into fragments of approximately one-fourth of the original frame, sending one fragment over each link +b. Sends the entire frame over one link, alternating links in sequence for each succes-sive frame +c. Sends the entire frame over one link, choosing the link by applying some math to fields in each frame’s headers +d. Sends the entire frame over one link, using the link with the lowest percent utiliza-tion as the next link to use + +Foundation Topics + +Understanding RSTP Through Configuration +Cisco IOS switches today typically default to using RSTP rather than STP, with default set-tings so that RSTP works with no configuration. You can buy some Cisco switches and con-nect them with Ethernet cables in a redundant topology, and RSTP will ensure that frames do not loop. And even if some switches use RSTP and some use STP, the switches can interoperate and still build a working spanning tree—and you never even have to think about changing any settings! + +Although RSTP works without any configuration, most medium-size to large-size campus LANs benefit from some STP configuration. For instance, Figure 10-1 shows a typical LAN design model, with two distribution layer switches (D1 and D2). The design may have doz-ens of access layer switches that connect to end users; the figure shows just three access switches (A1, A2, and A3). For a variety of reasons, most network engineers make the distri-bution layer switches be the root. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 241 + +Best Choices to be Root + +Distribution D1 D2 Switches + + + +Access A1 A2 A3 Switches + + + +10/100/1000 10/100/1000 10/100/1000 +Figure 10-1 Typical Configuration Choice: Making Distribution Switch Be Root + + +NOTE Cisco uses the term access switch to refer to switches used to connect to endpoint devices. The term distribution switch refers to switches that do not connect to endpoints but rather connect to each access switch, providing a means to distribute frames through-out the LAN. If you want to read more about LAN design concepts and terms, refer to this book’s companion website for Appendix K, “Analyzing Ethernet LAN Designs.” + +As discussed in the introduction to this chapter, this first section of the chapter examines a variety of STP/RSTP configuration topics, but with a goal of revealing a few more details +about how STP and RSTP operate. Following this opening section about RSTP configuration, the next section examines how to configure Layer 2 EtherChannels, and how that impacts STP/RSTP. + + +The Need for Multiple Spanning Trees +The IEEE first standardized STP as the IEEE 802.1D standard, first published back in 1990. To put some perspective on that date, Cisco did not have a LAN switch product line at the time, and virtual LANs did not exist yet. Instead of multiple VLANs in a physical Ethernet LAN, the physical Ethernet LAN existed as one single broadcast domain, with one instance of STP. + +By the mid 1990s, VLANs had appeared on the scene, along with LAN switches. The emer-gence of VLANs posed a challenge for STP—the only type of STP available at the time— because STP defined a single common spanning tree (CST) topology for the entire LAN. The IEEE needed an option to create multiple spanning trees so that traffic could be balanced across the available links, as shown in Figure 10-2. With two different STP instances, SW3 +could block on a different interface in each VLAN, as shown in the figure. + + + + + +10 + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +242 CCNA 200-301 Official Cert Guide, Volume 1 + + +VLAN 1 STP Topology + +Root + +VLAN 2 STP Topology + +Root + + + +Gi0/1 Gi0/2 +SW1 SW2 + +Gi0/1 Gi0/2 +SW1 SW2 + +Gi0/2 Gi0/1 Gi0/2 Gi0/1 + + + +Gi0/1 Gi0/2 Gi0/1 Gi0/2 + + +SW3 + +Figure 10-2 + +SW3 + +Load Balancing with One Tree for VLAN 1 and Another for VLAN 2 + + +STP Modes and Standards +Because of the sequence of events over the history of the various STP family of protocols, vendors like Cisco needed to create their own proprietary features to create the per-VLAN spanning tree concept shown in Figure 10-2. That sequence resulted in the following: + +■ When STP was the only STP standard back in the 1990s with 802.1D, Cisco created the STP-based Per VLAN Spanning Tree Plus (PVST+) protocol, which creates one spanning tree instance per VLAN. +■ When the IEEE introduced RSTP (in 802.1D amendment 802.1w, in the year 2001), Cisco also created the Rapid PVST+ (RPVST+) protocol. RPVST+ provided more features than standardized RSTP, including one tree per VLAN. +■ The IEEE did not adopt Cisco’s PVST+ or RPVST+ into their standards to create multiple spanning trees. Instead, the IEEE created a different method: Multiple Spanning Tree Protocol (MSTP), originally defined in 802.1Q amendment 802.1s. + +Figure 10-3 shows the features as a timeline for perspective. + +RSTP STP & MST + + + +1990 2000 2010 + +PVST+ RPVST+ + +Figure 10-3 Timeline of Per-VLAN and Multiple STP Features + +Today, Cisco Catalyst switches give us three options to configure on the spanning-tree mode command, which tells the switch which type of STP to use. Note that the switches do not support STP or RSTP with the single tree (CST). They can use either the Cisco- +proprietary and STP-based PVST+, Cisco-proprietary and RSTP-based RPVST+, or the IEEE standard MSTP. Table 10-2 summarizes some of the facts about these standards and options, + +Answers to the “Do I Know This Already?” quiz: 1 A 2 A, C 3 A, B, D 4 D 5 B, D 6 C + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 243 + +along with the keywords used on the spanning-tree mode global configuration command. Example 10-1, which follows, shows the command options in global configuration mode. + +Table 10-2 STP Standards and Configuration Options + +Name + +STP + +PVST+ + +RSTP + +Rapid PVST+ + +MSTP + +Based on STP or RSTP? +STP + +STP + +RSTP + +RSTP + +RSTP + +# Trees + +1 (CST) + +1/VLAN + +1 (CST) + +1/VLAN + +1 or more* + +Original IEEE Standard +802.1D + +802.1D + +802.1w + +802.1w + +802.1s + +Config Parameter + +N/A + +pvst + +N/A + +rapid-pvst + +mst + + +* MSTP allows the definition of as many instances (multiple spanning tree instances, or MSTIs) as chosen by the network designer but does not require one per VLAN. + +Example 10-1 STP Status with Default STP Parameters on SW1 and SW2 + +SW1(config)# spanning-tree mode ? + +mst +pvst +rapid-pvst +SW1(config)# + +Multiple spanning tree mode +Per-Vlan spanning tree mode +Per-Vlan rapid spanning tree mode + + + +The Bridge ID and System ID Extension +To support the idea of multiple spanning trees, whether one per VLAN or simply multiple as created with MSTP, the protocols must consider the VLANs and VLAN trunking. (That’s one reason why RSTP and MSTP now exist as part of the 802.1Q standard, which defines VLANs and VLAN trunking.) To help make that work, the IEEE redefined the format of the original BID value to help make per-VLAN instances of STP/RSTP become a reality. +Originally, a switch’s BID was formed by combining the switch’s 2-byte priority and its 10 6-byte MAC address. The revised rules divide the original priority field into two separate +fields, as shown in Figure 10-4: a 4-bit priority field and a 12-bit subfield called the system ID extension (which represents the VLAN ID). + + +2 Bytes + +Priority (0 – 65,535) + +6 Bytes + +System ID (MAC Address) + + +Original Format Bridge ID + + + + + +Priority (Multiple of 4096) +4 Bits + + +System ID Extension (Typically Holds VLAN ID) + +12 Bits + + +System ID (MAC Address) + +6 Bytes + +System ID Extension (MAC Address Reduction) + +Figure 10-4 STP System ID Extension + + +|||||||||||||||||||| +|||||||||||||||||||| + + +244 CCNA 200-301 Official Cert Guide, Volume 1 + +Cisco switches let you configure the BID, but only the priority part. The switch fills in its universal (burned-in) MAC address as the system ID. It also plugs in the VLAN ID of a VLAN in the 12-bit system ID extension field; you cannot change that behavior either. The only part configurable by the network engineer is the 4-bit priority field. + +However, configuring the number to put in the priority field may be one of the strangest things to configure on a Cisco router or switch. As shown at the top of Figure 10-4, the priority field was originally a 16-bit number, which represented a decimal number from 0 to 65,535. Because of that history, the configuration command (spanning-tree vlan vlan-id +priority x) requires a decimal number between 0 and 65,535. But not just any number in that range will suffice; it must be a multiple of 4096, as emphasized in the help text shown in Example 10-2. + +Example 10-2 Help Shows Requirements for Using Increments of 4096 for Priority + +SW1(config)# spanning-tree vlan 1 priority ? +<0-61440> bridge priority in increments of 4096 +SW1(config)# + + +Table 10-3 lists all the configurable values for the STP/RSTP priority. However, do not worry about memorizing the values. Instead, the table lists the values to emphasize two points about the binary values: the first 4 bits in each value differ, but the last 12 bits remain as 12 binary zeros. + +Table 10-3 STP/RSTP Configurable Priority Values + +Decimal Value 16-bit Binary Equivalent 0 0000 0000 0000 0000 +4096 0001 0000 0000 0000 8192 0010 0000 0000 0000 12288 0011 0000 0000 0000 16384 0100 0000 0000 0000 20480 0101 0000 0000 0000 24576 0110 0000 0000 0000 +28672 0111 0000 0000 0000 + +Decimal Value 16-bit Binary Equivalent 32768 1000 0000 0000 0000 36864 1001 0000 0000 0000 40960 1010 0000 0000 0000 45056 1011 0000 0000 0000 49152 1100 0000 0000 0000 53248 1101 0000 0000 0000 57344 1110 0000 0000 0000 +61440 1111 0000 0000 0000 + + + +Note that while you can set the priority to any of the 16 decimal values in Table 10-3, Cisco provides a convenient means to create a primary and secondary root switch concept with-out configuring an actual number. In most LAN designs, only a small number of switches would be good candidates to ever be the root switch based on where the switches sit within the topology. Think of the preferred switch as the primary switch and the next-best option as the secondary switch. Then, to configure those two switches to be the two most likely switches to be the root switch, simply configure + +spanning-tree vlan x root primary (on the switch that should be primary) spanning-tree vlan x root secondary (on the switch that should be secondary) + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 245 + +These two commands cause the switch to make a choice of priority value but then store the chosen priority value in the spanning-tree vlan x priority value command. The command with root primary or root secondary does not appear in the configuration. When config-uring root primary, the switch looks at the priority of the current root switch and chooses either (a) 24,576 or (b) 4096 less than the current root’s priority (if the current root’s priority is 24,576 or less) to the configuration instead. When configuring, root secondary always results in that switch using a priority of 28,672, with the assumption that the value will be less than other switches that use the default of 32,768, and higher than any switch config-ured as root primary. + +How Switches Use the Priority and System ID Extension +Cisco Catalyst switches configure the priority value using a number that represents a 16-bit value; however, the system ID extension exists as the low-order 12 bits of that same number. This next topic works through connecting those ideas. + +When the switch builds its BID to use for RSTP in a VLAN, it must combine the configured priority with the VLAN ID of that VLAN. Interestingly, the configured priority results in a 16-bit priority that always ends with 12 binary 0s. That fact makes the process of combining values to create the BID a little simpler for the switch and possibly a little simpler for net-work engineers once you understand it all. + +First, consider the process shown in Figure 10-5. The top shows the configured prior- +ity value (decimal 32768), in 16-bit binary form, with a System ID Extension of 12 zeros. Moving down the figure, you see the binary version of a VLAN ID (decimal 9). At the last step, the switch replaces those last 12 bits of the System ID Extension with the value that matches the VLAN ID and uses that value as the first 16 bits of the BID. + +Priority System ID Extension Configured Priority 1000 0000 0000 0000 + +VLAN ID 9 0000 0000 1001 + +10 16-Bit Priority 1000 0000 0000 1001 + +Figure 10-5 Configured Priority (16-Bit) and System ID Extension (12-Bit) Added + +As it turns out, the process shown in Figure 10-5 is just the sum of the two numbers—both in binary and decimal. To see an example, refer to upcoming Example 10-3, which demon-strates the following details: + +■ The output shows details about VLAN 9. +■ The root switch has been configured with the spanning-tree vlan 9 priority 24576 command. +■ The local switch (the switch on which the command was gathered) has been configured with the spanning-tree vlan 9 priority 32768 command. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +246 CCNA 200-301 Official Cert Guide, Volume 1 + +■ Conveniently, the decimal equivalent of the two switches’ first 16 bits—the original 16-bit priority field—can be easily calculated in decimal. In this example: +■ Root Switch: 24,576 (priority) + 9 (VLAN ID) = 24585 ■ Local Switch: 32,768 (priority) + 9 (VLAN ID) = 32777 +The output in Example 10-3 matches this logic. The top highlight shows the priority of the root switch (24585), which is the sum of the root switch’s priority setting (configured as 24,576) plus 9 for the VLAN ID. The second highlight shows a value of 32,777, calculated as the local switch’s priority setting of 32,768 plus 9 for the VLAN ID. + +Example 10-3 Examining the 16-bit Priority as Interpreted in Cisco show Commands + +SW1# show spanning-tree vlan 9 + +VLAN0009 +Spanning tree enabled protocol rstp + +Root ID Priority +Address +Cost +Port + +24585 +1833.9d7b.0e80 +4 +25 (GigabitEthernet0/1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + + +Bridge ID Priority +Address + +32777 (priority 32768 sys-id-ext 9) +f47f.35cb.d780 + +! Output omitted for brevity + + +RSTP Methods to Support Multiple Spanning Trees +Although the history and configuration might make the BID priority idea seem a bit convo-luted, having an extra 12-bit field in the BID works well in practice because it can be used to identify the VLAN ID. VLAN IDs range from 1 to 4094, requiring 12 bits. + +For the purposes of discussion, focus on the standard RSTP and its Cisco-proprietary cousin RPVST+. Both use the RSTP mechanisms as discussed in Chapter 9, “Spanning Tree Protocol Concepts,” but RPVST+ uses the mechanisms for every VLAN, while standard RSTP does not. So how do their methods differ? + +■ RSTP creates one tree—the Common Spanning Tree (CST)—while RPVST+ creates one tree for each and every VLAN. +■ RSTP sends one set of RSTP messages (BPDUs) in the network, no matter the number of VLANs, while RPVST+ sends one set of messages per VLAN. +■ RSTP and RPVST+ use different destination MAC addresses: RSTP with multicast address 0180.C200.0000 (an address defined in the IEEE standard), and RPVST+ with multicast address 0100.0CCC.CCCD (an address chosen by Cisco). +■ When transmitting messages on VLAN trunks, RSTP sends the messages in the native VLAN with no VLAN header/tag. RPVST+ sends each VLAN’s messages inside that VLAN—for instance, BPDUs about VLAN 9 have an 802.1Q header that lists VLAN 9. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 247 + +■ RPVST+ adds an extra type-length value (TLV) to the BPDU that identifies the VLAN ID, while RSTP does not (because it does not need to, as RSTP ignores VLANs.) +■ Both view the 16-bit priority as having a 12-bit System ID Extension, with RSTP setting the value to 0000.0000.0000, meaning “no VLAN,” while RPVST+ uses the VLAN ID. + +In other words, standard RSTP behaves as if VLANs do not exist, while Cisco’s RPVST+ inte-grates VLAN information into the entire process. + +NOTE Some documents refer to the feature of sending BPDUs over trunks with VLAN tags matching the same VLAN as BPDU tunneling. + + +Other RSTP Configuration Options +This chapter does not attempt to work through all the configuration options available for RSTP. However, many of the configuration settings may be intuitive now that you know quite a bit about the protocol. This final topic in the first section of the chapter summarizes a few of the configuration concepts. As a reminder, for those interested in continuing on to CCNP Enterprise, you might be interested in reading more about RSTP configuration in the companion website’s Appendix O, “Spanning Tree Protocol Implementation.” + +■ Switch Priority: The global command spanning-tree vlan x priority y lets an engineer set the switch’s priority in that VLAN. +■ Primary and Secondary Root Switches: The global command spanning-tree vlan x root primary | secondary also lets you set the priority, but the switch decides on a value to make that switch likely to be the primary root switch (the root) or the secondary root switch (the switch that becomes root if the primary fails). +■ Port Costs: The interface subcommand spanning-tree [vlan x] cost y lets an engineer set the switch’s STP/RSTP cost on that port, either for all VLANs or for a specific VLAN on that port. Changing those costs then changes the root cost for some switches, which impacts the choice of root ports and designated ports. + + +That concludes this chapter’s examination of RSTP configuration—now on to Layer 2 +EtherChannel! + + +10 + + +Configuring Layer 2 EtherChannel +As introduced in Chapter 9, two neighboring switches can treat multiple parallel links between each other as a single logical link called an EtherChannel. Without EtherChannel, a switch treats each physical port as an independent port, applying MAC learning, forwarding, and STP logic per physical port. With EtherChannel, the switch applies all those same pro-cesses to a group of physical ports as one entity: the EtherChannel. Without EtherChannel, with parallel links between two switches, STP/RSTP would block all links except one, but with EtherChannel, the switch can use all the links, load balancing the traffic over the links. + +NOTE All references to EtherChannel in this chapter refer to Layer 2 EtherChannels, not to Layer 3 EtherChannels (as discussed in Chapter 17, “IP Routing in the LAN”). CCNA 200-301 exam topics include both Layer 2 and Layer 3 EtherChannels. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +248 CCNA 200-301 Official Cert Guide, Volume 1 + +EtherChannel may be one of the most challenging switch features to make work. First, the configuration has several options, so you have to remember the details of which options work together. Second, the switches also require a variety of other interface settings to match among all the links in the channel, so you have to know those settings as well. + +This section shows how to configure a Layer 2 EtherChannel, first through manual (static) configuration, and then by allowing dynamic protocols to create the channel. This section closes with some information about some common configuration issues that occur with Layer 2 EtherChannels. + +Configuring a Manual Layer 2 EtherChannel +To configure a Layer 2 EtherChannel so that all the ports always attempt to be part of the channel, simply add the correct channel-group configuration command to each physical interface, on each switch, all with the on keyword, and all with the same number. The on keyword tells the switches to place a physical interface into an EtherChannel, and the num-ber identifies the PortChannel interface number that the interface should be a part of. + +Before getting into the configuration and verification, however, you need to start using three terms as synonyms: EtherChannel, PortChannel, and Channel-group. Oddly, IOS uses the channel-group configuration command, but then to display its status, IOS uses the show etherchannel command. Then the output of this show command refers to neither an “EtherChannel” nor a “Channel-group,” instead using the term “PortChannel.” So, pay close attention to these three terms in the example. + +To configure an EtherChannel manually, follow these steps: + + + + + +Config Checklist + +Step 1. Add the channel-group number mode on command in interface configuration mode under each physical interface that should be in the channel to add it to the channel. +Step 2. Use the same number for all commands on the same switch, but the channel-group number on the neighboring switch can differ. + + + +Example 10-4 shows a simple example, with two links between switches SW1 and SW2, as shown in Figure 10-6. The configuration shows SW1’s two interfaces placed into channel-group 1, with two show commands to follow. + + +Channel-group 1 Fa0/14 + +Channel-group 2 Fa0/16 + +SW1 Fa0/15 Fa0/17 SW2 +Figure 10-6 Sample LAN Used in EtherChannel Example + +Example 10-4 Configuring and Monitoring EtherChannel + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# interface fa 0/14 +SW1(config-if)# channel-group 1 mode on +SW1(config)# interface fa 0/15 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 249 + +SW1(config-if)# channel-group 1 mode on +SW1(config-if)# ^Z + +SW1# show spanning-tree vlan 3 + +VLAN0003 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +28675 +0019.e859.5380 +12 +72 (Port-channel1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + + +Bridge ID Priority +Address + +28675 (priority 28672 sys-id-ext 3) +0019.e86a.6f80 + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- +Po1 Root FWD 12 128.64 P2p Peer(STP) + +SW1# show etherchannel 1 summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +N - not in use, no aggregation + +f - failed to allocate aggregator + +M - not in use, minimum links not met +m - not in use, port not aggregated due to minimum links not met 10 u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +A - formed by Auto LAG + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+----------------------------------------------- +1 Po1(SU) - Fa0/14(P) Fa0/15(P) + + +Take a few moments to look at the output in the two show commands in the example, as well. First, the show spanning-tree command lists Po1, short for PortChannel1, as + + +|||||||||||||||||||| +|||||||||||||||||||| + + +250 CCNA 200-301 Official Cert Guide, Volume 1 + +an interface. This interface exists because of the channel-group commands using the 1 parameter. STP no longer operates on physical interfaces Fa0/14 and Fa0/15, instead operating on the PortChannel1 interface, so only that interface is listed in the output. + +Next, note the output of the show etherchannel 1 summary command. It lists as a heading “Port-channel,” with Po1 below it. It also lists both Fa0/14 and Fa0/15 in the list of ports, with a (P) beside each. Per the legend, the P means that the ports are bundled in the port channel, which is a code that means these ports have passed all the configuration checks and are valid to be included in the channel. + +Configuring Dynamic EtherChannels +In addition to manual configuration, Cisco switches also support two different configuration options that then use a dynamic protocol to negotiate whether a particular link becomes part of an EtherChannel or not. Basically, the configuration enables a protocol for a particu-lar channel-group number. At that point, the switch can use the protocol to send messages to/from the neighboring switch and discover whether their configuration settings pass all checks. If a given physical link passes, the link is added to the EtherChannel and used; if +not, it is placed in a down state, and not used, until the configuration inconsistency can be resolved. + +Most Cisco Catalyst switches support the Cisco-proprietary Port Aggregation Protocol (PAgP) and the IEEE standard Link Aggregation Control Protocol (LACP), based on IEEE standard 802.3ad. Although differences exist between the two, to the depth discussed here, they both accomplish the same task: negotiate so that only links that pass the configuration checks are actually used in an EtherChannel. + +One difference of note is that LACP does support more links in a channel—16—as com-pared to PaGP’s maximum of 8. With LACP, only 8 can be active at one time, with the oth-ers waiting to be used should any of the other links fail. + +To configure either protocol, a switch uses the channel-group configuration commands on each switch, but with a keyword that either means “use this protocol and begin negotia-tions” or “use this protocol and wait for the other switch to begin negotiations.” As shown in Figure 10-7, the desirable and auto keywords enable PAgP, and the active and passive keywords enable LACP. With these options, at least one side has to begin the negotiations. In other words, with PAgP, at least one of the two sides must use desirable, and with LACP, at least one of the two sides must use active. + +Using PAgP +channel-group 1 mode desirable channel-group 2 mode {desirable | auto} + + +Begins G0/1 Negotiations SW1 G0/2 + +G0/2 + +G0/1 SW2 + + +channel-group 1 mode active channel-group 2 mode {active | passive} +Using LACP + +Figure 10-7 Correct EtherChannel Configuration Combinations + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 251 + + +NOTE Do not use the on parameter on one end, and either auto or desirable (or for LACP, active or passive) on the neighboring switch. The on option uses neither PAgP nor LACP, so a configuration that uses on, with PAgP or LACP options on the other end, would prevent the EtherChannel from working. + +For example, in the design shown in Figure 10-7, imagine both physical interfaces on both switches were configured with the channel-group 2 mode desirable interface subcommand. As a result, the two switches would negotiate and create an EtherChannel. Example 10-5 shows the verification of that configuration, with the command show etherchannel 1 +port-channel. This command confirms the protocol in use (PAgP, because the desirable keyword was configured), and the list of interfaces in the channel. + +Example 10-5 EtherChannel Verification: PAgP Desirable Mode + +SW1# show etherchannel 1 port-channel +Port-channels in the group: +--------------------------- + +Port-channel: Po1 +------------ +Age of the Port-channel = 0d:00h:04m:04s + +Logical slot/port +GC + += 16/1 += 0x00020001 + +Number of ports = 2 +HotStandBy port = null + + + +Port state +Protocol +Port security + += Port-channel Ag-Inuse += PAgP += Disabled + +Load share deferral = Disabled + +Ports in the Port-channel: + +Index Load Port EC state No of bits +------+------+------+------------------+----------- 10 +0 00 Gi0/1 Desirable-Sl 0 +0 00 Gi0/2 Desirable-Sl 0 + +Time since last port bundled: 0d:00h:03m:57s Gi0/2 + + +Physical Interface Configuration and EtherChannels +Even when thechannel-group commands have all been configured correctly, other configura-tion settings can prevent a switch from using a physical port in an EtherChannel—even physical ports manually configured to be part of the channel. The next topic examines those reasons. + +First, before using a physical port in an EtherChannel, the switch compares the new physical port’s configuration to the existing ports in the channel. That new physical interface’s settings must be the same as the existing ports’ settings; otherwise, the switch does not +add the new link to the list of approved and working interfaces in the channel. That is, the + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +252 CCNA 200-301 Official Cert Guide, Volume 1 + +physical interface remains configured as part of the PortChannel, but it is not used as part of the channel, often being placed into some nonworking state. + +The list of items the switch checks includes the following: + +■ Speed ■ Duplex +■ Operational access or trunking state (all must be access, or all must be trunks) ■ If an access port, the access VLAN +■ If a trunk port, the allowed VLAN list (per the switchport trunk allowed command) ■ If a trunk port, the native VLAN +■ STP interface settings + +In addition, switches check the settings on the neighboring switch. To do so, the switches either use PAgP or LACP (if already in use) or use Cisco Discovery Protocol (CDP) if using manual configuration. When checking neighbors, all settings except the STP settings must match. + +As an example, SW1 and SW2 again use two links in one EtherChannel from Figure 10-7. Before configuring the EtherChannel, SW1’s G0/2 was given a different RSTP port cost than G0/1. Example 10-6 picks up the story just after configuring the correct channel-group com-mands, when the switch is deciding whether to use G0/1 and G0/2 in this. + +Example 10-6 Local Interfaces Fail in EtherChannel Because of Mismatched STP Cost + +*Mar 1 23:18:56.132: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on +Po1, putting Gi0/1 in err-disable state +*Mar 1 23:18:56.132: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on +Po1, putting Gi0/2 in err-disable state +*Mar 1 23:18:56.132: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Po1, putting Po1 in err-disable state +*Mar 1 23:18:58.120: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down +*Mar 1 23:18:58.137: %LINK-3-UPDOWN: Interface Port-channel1, changed state to down +*Mar 1 23:18:58.137: %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to down + +SW1# show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +N - not in use, no aggregation + +f - failed to allocate aggregator + +M - not in use, minimum links not met +m - not in use, port not aggregated due to minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 253 + +d - default port + +A - formed by Auto LAG + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+----------------------------------------------- +1 Po1(SD) - Gi0/1(D) Gi0/2(D) + + +The messages at the top of the example specifically state what the switch does when determining whether the interface settings match. In this case, SW1 detects the different STP costs. SW1 does not use G0/1, does not use G0/2, and even places them into an err-disabled state. The switch also puts the PortChannel into err-disabled state. As a result, the PortChannel is not operational, and the physical interfaces are also not operational. + +To solve this problem, you must reconfigure the physical interfaces to use the same STP settings. In addition, the PortChannel and physical interfaces must be shutdown, and then no shutdown, to recover from the err-disabled state. (Note that when a switch applies +the shutdown and no shutdown commands to a PortChannel, it applies those same commands to the physical interfaces, as well; so, just do the shutdown/no shutdown on the PortChannel interface.) + +EtherChannel Load Distribution +When using Layer 2 EtherChannels, a switch’s MAC learning process associates MAC addresses with the PortChannel interfaces and not the underlying physical ports. Later, when a switch makes a forwarding decision to send a frame out a PortChannel interface, the switch must do more work: to decide out which specific physical port to use to forward the frame. IOS documentation refers to those rules as EtherChannel load distribution or load balanc-ing. Figure 10-8 shows the main idea. +Switch 10 + +1 + +2 + +Po1 3 + +4 + + + +Forwarding Logic + +EtherChannel Load Distribution Logic + + +Figure 10-8 Correct EtherChannel Configuration Combinations + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +254 CCNA 200-301 Official Cert Guide, Volume 1 + +Configuration Options for EtherChannel Load Distribution +EtherChannel load distribution makes the choice for each frame based on various numeric values found in the Layer 2, 3, and 4 headers. The process uses one configurable setting as input: the load distribution method as defined with the port-channel load-balance method global command. The process then performs some match against the fields identified by the configured method. + +Table 10-4 lists the most common methods. However, note that some switches may support only MAC-based methods, or only MAC- and IP-based methods, depending on the model and software version. + +Table 10-4 EtherChannel Load Distribution Methods + +Configuration Keyword src-mac +dst-mac + +src-dst-mac + +src-ip + +dst-ip + +src-dst-ip + +src-port + +dst-port + +src-dst-port + +Math Uses… Layer Source MAC address 2 +Destination MAC address 2 + +Both source and destination MAC 2 + +Source IP address 3 + +Destination IP address 3 + +Both source and destination IP 3 + +Source TCP or UDP port 4 + +Destination TCP or UDP port 4 + +Both source and destination TCP or UDP port 4 + + + +To appreciate why you might want to use different methods, you need to consider the results of how switches make their choice. (The discussion here focuses on the result, and not the logic, because the logic remains internal to the switch, and Cisco does not document how each switch model or IOS version works internally.) However, the various load distribution algorithms do share some common goals: + +■ To cause all messages in a single application flow to use the same link in the channel, rather than being sent over different links. Doing so means that the switch will not inad-vertently reorder the messages sent in that application flow by sending one message over a busy link that has a queue of waiting messages, while immediately sending the next message out an unused link. +■ To integrate the load distribution algorithm work into the hardware forwarding ASIC so that load distribution works just as quickly as the work to forward any other frame. +■ To use all the active links in the EtherChannel, adjusting to the addition and removal of active links over time. +■ Within the constraints of the other goals, balance the traffic across those active links. + +In short, the algorithms first intend to avoid message reordering, make use of the switch for-warding ASICs, and use all the active links. However, the algorithm does not attempt to send the exact same number of bits over each link over time. The algorithm does try to balance the traffic, but always within the constraints of the other goals. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 255 + +Whatever load distribution method you choose, the method identifies fields in the message headers. Any messages in the same application flow will then have the same values in the fields used by the load distribution algorithm and will always be forwarded over the same link. For example, when a user connects to a website, that web server may return thousands of packets to the client. Those thousands of packets should flow over the same link in the EtherChannel. + +For instance, with the load distribution method of src-mac (meaning source MAC address), all frames with the same MAC address flow over one link. Figure 10-9 shows the idea with pseudo MAC addresses, with the load distribution sending frames with source MAC 1 over link 1, source MAC 2 over link 2, and source MAC 3 over link 3. + + +SRC MAC 1 SRC MAC 1 SRC MAC 1 1 +SRC MAC 2 2 +SRC MAC 3 3 +4 + + +EtherChannel Load Distribution + +Figure 10-9 Distributing All Frames with Same Mac Out Same Interface + +Cisco provides a variety of load distribution options so that the engineer can examine the flows in the network with the idea of finding which fields have the most variety in their val-ues: source and destination MAC, or IP address, or transport layer port numbers. The more variety in the values in the fields, the better the balancing effects, and the lower the chance of sending disproportionate amounts of traffic over one link. + +NOTE The algorithm focuses on the low-order bits in the fields in the headers because the + +low-order bits typically differ the most in real networks, while the high-order bits do not differ much. By focusing on the lower-order bits, the algorithm achieves better balancing of +traffic over the links. + + + +10 + + + +The Effects of the EtherChannel Load Distribution Algorithm +Figure 10-10 details a new EtherChannel that will be used in two examples to show the effects of load distribution. The examples will focus on frames sent by switch SW1 in the figure, showing the use of the test etherchannel load-balance EXEC command. That com-mand asks the switch to consider some addresses or ports and answer the question: which link would you use when forwarding a message with those address/port values? + + +Channel-group 1 +G 1/0/21 - 24 + +Channel-group 1 +G 1/0/21 - 24 + + +SW1 SW2 + +Figure 10-10 Four-Link EtherChannel + + +|||||||||||||||||||| +|||||||||||||||||||| + + +256 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 10-7 shows how switch SW1 distributes traffic when using src-mac load distribu-tion. The example lists the output from three of the test etherchannel load-balance com-mands, but note that all three commands use the same source MAC address. As a result, the answer from each command references the same interface (G1/0/22 in this case). + +Example 10-7 Testing with Identical Source MACs When Using src-mac Balancing + +SW1# show etherchannel load-balance +EtherChannel Load-Balancing Configuration: +src-mac + +EtherChannel Load-Balancing Addresses Used Per-Protocol: +Non-IP: Source MAC address +IPv4: Source MAC address +IPv6: Source MAC address + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0001 0200.1111.1111 +Would select Gi1/0/22 of Po1 + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0001 0200.1111.1112 +Would select Gi1/0/22 of Po1 + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0001 0200.1111.1113 +Would select Gi1/0/22 of Po1 + + +Example 10-7 makes two important points: + +■ All three tests list the same outgoing physical interface because (1) the method uses only the source MAC address, and (2) all three tests use the same MAC addresses. +■ All three tests use a different destination MAC address, with different low-order bits, but that had no impact on the choice because the method—src-mac—does not consider the destination MAC address. + +In contrast on that first point, Example 10-8 repeats the test commands from Example 10-7. The switch still uses the src-mac balancing method, but now with different source MAC addresses in each test. Notice that the source MAC addresses used in the tests differ by just a few bit values in the low-order bits, so as a result, each test shows a different interface choice by SW1. + +Example 10-8 Testing with Source MACs with Low-Order Bit Differences + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0001 0200.1111.1111 +Would select Gi1/0/22 of Po1 + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0002 0200.1111.1111 +Would select Gi1/0/24 of Po1 + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0003 0200.1111.1111 +Would select Gi1/0/23 of Po1 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 257 + +Example 10-9 shows yet a third variation, this time changing the load distribution method to src-dst-mac, which means that the switch will consider both source and destination MAC. The example repeats the exact same test etherchannel commands as Example 10-7, with the exact same MAC addresses: the source MAC addresses remain the same in all three tests, but the destination MAC addresses differ in the low-order bits. With the chosen destination MAC values differing slightly, switch SW1 happens to choose three different interfaces. + +Example 10-9 Evidence of Source and Destination MAC Load Distribution + +SW1# config t +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# port-channel load-balance src-dst-mac +SW1(config)# ^Z +SW1# +SW1# show etherchannel load-balance +EtherChannel Load-Balancing Configuration: +src-dst-mac + +EtherChannel Load-Balancing Addresses Used Per-Protocol: +Non-IP: Source XOR Destination MAC address +IPv4: Source XOR Destination MAC address +IPv6: Source XOR Destination MAC address + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0001 0200.1111.1111 +Would select Gi1/0/22 of Po1 + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0001 0200.1111.1112 +Would select Gi1/0/24 of Po1 + +SW1# test etherchannel load-balance interface po1 mac 0200.0000.0001 0200.1111.1113 +Would select Gi1/0/23 of Po1 + +10 Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 10-5 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +258 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 10-5 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Answer DIKTA questions + +Review config checklists + +Review command tables + +Review memory tables + +Do labs + +Review Date(s) Resource Used Book, website +Book, website + +Book, PTP + +Book, website + +Book + +Website + +Blog + + + +Review All the Key Topics + + +Table 10-6 +Key Topic Element +Figure 10-1 + +Figure 10-2 + +Table 10-2 + +Figure 10-4 + +List + +List + +List + +Key Topics for Chapter 10 +Description Page Number +Typical design choice for which switches should be made to be root 241 + +Conceptual view of load-balancing benefits of PVST+ 242 + +STP Standards and Configuration Options 243 + +Shows the format of the system ID extension of the STP priority 243 field +Facts about RPVST+’s methods versus RSTP 246 + +Steps to manually configure an EtherChannel 248 + +Items a switch compares in a new physical port’s configuration to 252 the existing ports in the channel + + + +Key Terms You Should Know +Rapid PVST+, PVST+, system ID extension, PAgP, LACP, PortChannel, Channel-group, EtherChannel, EtherChannel Load Distribution, primary root, secondary root + +Command References +Tables 10-7 and 10-8 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 10: RSTP and EtherChannel Configuration 259 + + +Table 10-7 +Command + +Chapter 10 Configuration Command Reference +Description + + + +spanning-tree mode {pvst | rapid-pvst | mst} + +spanning-tree [vlan vlan-number] root primary + + + +spanning-tree [vlan vlan-number] root secondary + +spanning-tree vlan vlan-id priority priority + +spanning-tree [vlan vlan-number] cost cost + +spanning-tree [vlan vlan-number] port-priority priority + +Global configuration command to set the STP mode. + +Global configuration command that changes this switch to the root switch. The switch’s priority is changed to the lower of either 24,576 or 4096 less than the priority of the current root bridge when the command was issued. +Global configuration command that sets this switch’s STP base priority to 28,672. + +Global configuration command that changes the bridge priority of this switch for the specified VLAN. + +Interface subcommand that changes the STP cost to the configured value. + +Interface subcommand that changes the STP port priority in that VLAN (0 to 240, in increments of 16). + +channel-group channel-group- Interface subcommand that enables EtherChannel on number mode {auto | desirable | active the interface. +| passive | on} + + + +Table 10-8 +Command + + +Chapter 10 EXEC Command Reference +Description + + + +show spanning-tree + +show spanning-tree vlan vlan-id + +show etherchannel [channel-group-number] {brief | detail | port | port-channel | summary} + +Lists details about the state of STP on the switch, including the state of each port. +Lists STP information for the specified VLAN. + +Lists information about the state of EtherChannels on +this switch. 10 + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part III Review + +Keep track of your part review progress with the checklist shown in Table P3-1. Details on each task follow the table. + + +Table P3-1 +Activity + +Part III Part Review Checklist +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Do Labs + +Review Appendices + +Videos + + +Repeat All DIKTA Questions +For this task, answer the “Do I Know This Already?” questions again for the chapters in this part of the book, using the PCPT software. + +Answer Part Review Questions +For this task, answer the Part Review questions for this part of the book, using the PTP software. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Labs +Depending on your chosen lab tool, here are some suggestions for what to do in lab: + +Pearson Network Simulator: If you use the full Pearson ICND1 or CCNA simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) Note that the Sim Lite that comes with this book also has a couple of labs about VLANs. + +Blog: Config Labs: The author’s blog includes a series of configuration-focused labs that you can do on paper, each in 10–15 minutes. Review and perform the labs for this part of the book, as found at http://blog.certskills.com. Then navigate to the Hands-on Config labs. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Other: If using other lab tools, as a few suggestions: Make sure and experiment heavily with VLAN configuration and VLAN trunking configuration. + +Dig Deeper with Appendices on the Companion Website +The chapters in Part III of the book recommended the following appendices for extra read-ing. If you care to read further, consider: + +■ Appendix K, “Analyzing Ethernet LAN Designs”: A chapter from the previous edition that discusses design topologies and LAN design with two-tier and three-tier designs, including access and distribution switches. +■ Appendix O, “Spanning Tree Protocol Implementation”: A chapter that works through the configuration and verification commands for STP and RSTP. +■ Appendix P, “LAN Troubleshooting”: A chapter from the previous edition of the ICND2 Cert Guide. This chapter includes topics about VLANs, trunks, and STP and how to troubleshoot each. + +Watch Videos +Chapter 8 recommends two videos, one about VLANs and another about the VLAN allowed list on trunks. If you have not watched those videos yet, take a moment to scan back to Chapter 8 on the companion website and watch the videos. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +The book makes a big transition at this point. Part I gave you a broad introduction to net-working, and Parts II and III went into some detail about the dominant LAN technology today: Ethernet. Part IV transitions from Ethernet to the network layer details that sit above Ethernet and WAN technology, specifically IP Version 4 (IPv4). + +Thinking about the network layer requires engineers to shift how they think about address-ing. Ethernet allows the luxury of using universal MAC addresses, assigned by the manufac-turers, with no need to plan or configure addresses. Although the network engineer needs to understand MAC addresses, MAC already exists on each Ethernet NIC, and switches learn the Ethernet MAC addresses dynamically without even needing to be configured to do so. As a result, most people operating the network can ignore the specific MAC address values for most tasks. + +Conversely, IP addressing gives us flexibility and allows choice, but those features require planning, along with a much deeper understanding of the internal structure of the addresses. People operating the network must be more aware of the network layer addresses when doing many tasks. To better prepare you for these Layer 3 addressing details, this part breaks down the addressing details into four chapters, with an opportunity to learn more in preparation for the CCNP Enterprise certification. + +Part IV examines most of the basic details of IPv4 addressing and subnetting, mostly from the perspective of operating an IP network. Chapter 11 takes a grand tour of IPv4 address-ing as implemented inside a typical enterprise network. Chapters 12, 13, and 14 look at some of the specific questions people must ask themselves when operating an IPv4 network. + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part IV + + +IPv4 Addressing + + + + +Chapter 11: Perspectives on IPv4 Subnetting + +Chapter 12: Analyzing Classful IPv4 Networks + +Chapter 13: Analyzing Subnet Masks + +Chapter 14: Analyzing Existing Subnets + +Part IV Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 11 + + +Perspectives on IPv4 Subnetting This chapter covers the following exam topics: +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +1.7 Describe the need for private IPv4 addressing + +Most entry-level networking jobs require you to operate and troubleshoot a network using a preexisting IP addressing and subnetting plan. The CCNA exam assesses your readiness to use preexisting IP addressing and subnetting information to perform typical operations tasks, such as monitoring the network, reacting to possible problems, configuring addresses for new parts of the network, and troubleshooting those problems. + +However, you also need to understand how networks are designed and why. Anyone monitoring a network must continually ask the question, “Is the network working as designed?” If a prob-lem exists, you must consider questions such as “What happens when the network works nor-mally, and what is different right now?” Both questions require you to understand the intended design of the network, including details of the IP addressing and subnetting design. + +This chapter provides some perspectives and answers for the bigger issues in IPv4 address-ing. What addresses can be used so that they work properly? What addresses should be used? When told to use certain numbers, what does that tell you about the choices made by some other network engineer? How do these choices impact the practical job of configuring switches, routers, hosts, and operating the network on a daily basis? This chapter hopes to answer these questions while revealing details of how IPv4 addresses work. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 11-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Analyze Requirements +Make Design Choices + +Questions 1–3 +4–7 + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Host A is a PC, connected to switch SW1 and assigned to VLAN 1. Which of the fol-lowing are typically assigned an IP address in the same subnet as host A? (Choose two answers.) +a. The local router’s WAN interface b. The local router’s LAN interface +c. All other hosts attached to the same switch +d. Other hosts attached to the same switch and also in VLAN 1 + +2. Why does the formula for the number of hosts per subnet (2H – 2) require the subtrac-tion of two hosts? +a. To reserve two addresses for redundant default gateways (routers) b. To reserve the two addresses required for DHCP operation +c. To reserve addresses for the subnet ID and default gateway (router) d. To reserve addresses for the subnet broadcast address and subnet ID +3. A Class B network needs to be subnetted such that it supports 100 subnets and 100 hosts/subnet. Which of the following answers list a workable combination for the number of network, subnet, and host bits? (Choose two answers.) +a. Network = 16, subnet = 7, host = 7 b. Network = 16, subnet = 8, host = 8 c. Network = 16, subnet = 9, host = 7 d. Network = 8, subnet = 7, host = 17 +4. Which of the following are private IP networks? (Choose two answers.) a. 172.31.0.0 +b. 172.32.0.0 +c. 192.168.255.0 d. 192.1.168.0 +e. 11.0.0.0 + +5. Which of the following are public IP networks? (Choose three answers.) a. 9.0.0.0 +b. 172.30.0.0 +c. 192.168.255.0 d. 192.1.168.0 +e. 1.0.0.0 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +266 CCNA 200-301 Official Cert Guide, Volume 1 + +6. Before Class B network 172.16.0.0 is subnetted by a network engineer, what parts of the structure of the IP addresses in this network already exist, with a specific size? (Choose two answers.) +a. Network b. Subnet c. Host +d. Broadcast + +7. A network engineer spends time thinking about the entire Class B network 172.16.0.0 and how to subnet that network. He then chooses how to subnet this Class B net-work and creates an addressing and subnetting plan, on paper, showing his choices. If you compare his thoughts about this network before subnetting the network to his thoughts about this network after mentally subnetting the network, which of the fol-lowing occurred to the parts of the structure of addresses in this network? +a. The subnet part got smaller. b. The host part got smaller. +c. The network part got smaller. d. The host part was removed. +e. The network part was removed. + + +Foundation Topics + +Introduction to Subnetting +Say you just happened to be at the sandwich shop when it was selling the world’s longest sandwich. You’re pretty hungry, so you go for it. Now you have one sandwich, but because it’s over 2 kilometers long, you realize it’s a bit more than you need for lunch all by yourself. To make the sandwich more useful (and more portable), you chop the sandwich into meal-size pieces and give the pieces to other folks around you who are also ready for lunch. + +Huh? Well, subnetting, at least the main concept, is similar to this sandwich story. You start with one network, but it is just one large network. As a single large entity, it might not be useful, and it is probably far too large. To make it useful, you chop it into smaller pieces, called subnets, and assign those subnets to be used in different parts of the enterprise internetwork. + +This short first section of the chapter introduces IP subnetting. First, it shows the general ideas behind a completed subnet design that indeed chops (or subnets) one network into subnets. The rest of this section describes the many design steps that you would take to cre-ate just such a subnet design. By the end of this section, you should have the right context to then read through the subnetting design steps introduced throughout the rest of this chapter. + +NOTE All the chapters from this chapter up until Chapter 22, “Fundamentals of IP Version 6,” focus on IPv4 rather than IPv6. All references to IP refer to IPv4 unless otherwise stated. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 267 + +Subnetting Defined Through a Simple Example +An IP network—in other words, a Class A, B, or C network—is simply a set of consecutively numbered IP addresses that follows some preset rules. These Class A, B, and C rules define that for a given network, all the addresses in the network have the same value in some of the octets of the addresses. For example, Class B network 172.16.0.0 consists of all IP addresses that begin with 172.16: 172.16.0.0, 172.16.0.1, 172.16.0.2, and so on, through 172.16.255.255. Another example: Class A network 10.0.0.0 includes all addresses that begin with 10. + +An IP subnet is simply a subset of a Class A, B, or C network. In fact, the word subnet is a shortened version of the phrasesubdivided network. For example, one subnet of Class B network 172.16.0.0 could be the set of all IP addresses that begin with 172.16.1, and would include 172.16.1.0, 172.16.1.1, 172.16.1.2, and so on, up through 172.16.1.255. Another subnet of that same Class B network could be all addresses that begin with 172.16.2. + +To give you a general idea, Figure 11-1 shows some basic documentation from a completed subnet design that could be used when an engineer subnets Class B network 172.16.0.0. + +172.16.4.___ 172.16.2.___ + +R2 172.16.1.___ + +R1 + +EoMPLS + + + +172.16.5.___ + +Subnet Design: + +R3 +172.16.3.___ + +Class B 172.16.0.0 First 3 Octets are Equal + +Figure 11-1 Subnet Plan Document + +The design shows five subnets—one for each of the three LANs and one each for the two WAN links. The small text note shows the rationale used by the engineer for the subnets: +each subnet includes addresses that have the same value in the first three octets. For exam- 11 ple, for the LAN on the left, the number shows 172.16.1.__, meaning “all addresses that +begin with 172.16.1.” Also, note that the design, as shown, does not use all the addresses in Class B network 172.16.0.0, so the engineer has left plenty of room for growth. + +Operational View Versus Design View of Subnetting +Most IT jobs require you to work with subnetting from an operational view. That is, someone else, before you got the job, designed how IP addressing and subnetting would work for that particular enterprise network. You need to interpret what someone else has already chosen. + +To fully understand IP addressing and subnetting, you need to think about subnetting from both a design and operational perspective. For example, Figure 11-1 simply states that in all these subnets, the first three octets must be equal. Why was that convention chosen? What + + +|||||||||||||||||||| +|||||||||||||||||||| + + +268 CCNA 200-301 Official Cert Guide, Volume 1 + +alternatives exist? Would those alternatives be better for your internetwork today? All these questions relate more to subnetting design rather than to operation. + +To help you see both perspectives, this chapter focuses more on design issues by moving through the entire design process for the purpose of introducing the bigger picture of IP subnetting. The next three chapters each take one topic from this chapter and examine +it more closely but more from an operational perspective: how to use those ideas in real networks. + +The remaining three main sections of this chapter examine each of the steps listed in Figure 11-2, in sequence. + + +Analyze Needs +• # Subnets +• # Hosts/Subnet • 1 Size Subnet + +Design Subnets +• Choose Network • Choose 1 Mask • List All Subnets + +Plan Implementation +• Subnets Locations • Static IP +• DHCP Ranges + + +Figure 11-2 Subnet Planning, Design, and Implementation Tasks + +Analyze Subnetting and Addressing Needs +This section discusses the meaning of four basic questions that can be used to analyze the addressing and subnetting needs for any new or changing enterprise network: +1. Which hosts should be grouped together into a subnet? 2. How many subnets does this internetwork require? +3. How many host IP addresses does each subnet require? 4. Will we use a single subnet size for simplicity, or not? + +Rules About Which Hosts Are in Which Subnet +Every device that connects to an IP internetwork needs to have an IP address. These devices include computers used by end users, servers, mobile phones, laptops, IP phones, tablets, and networking devices like routers, switches, and firewalls. In short, any device that uses IP to send and receive packets needs an IP address. + +NOTE In a discussion of IP addressing, the term network has specific meaning: a Class A, B, or C IP network. To avoid confusion with that use of the term network, this book uses the terms internetwork and enterprise network when referring to a collection of hosts, routers, switches, and so on. + + + + + +Answers to the “Do I Know This Already?” quiz: 1 B, D 2 D 3 B, C 4 A, C 5 A, D, E 6 A, C 7 B + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 269 + +The IP addresses must be assigned according to some basic rules—and for good reasons. To make routing work efficiently, IP addressing rules group addresses into groups called sub-nets. The rules are as follows: + +■ Addresses in the same subnet are not separated by a router. +■ Addresses in different subnets are separated by at least one router. + +Figure 11-3 shows the general concept, with hosts A and B in one subnet and host C in another. In particular, note that hosts A and B are not separated from each other by any rout-ers. However, host C, separated from A and B by at least one router, must be in a different subnet. + + +One Subnet + +A + +A Third Subnet + +A Second Subnet + + + +R1 R2 C B + + +Figure 11-3 PC A and B in One Subnet and PC C in a Different Subnet + +The idea that hosts on the same link must be in the same subnet is much like the postal code concept. All mailing addresses in the same town use the same postal code (ZIP codes in the United States). Addresses in another town, whether relatively nearby or on the other side of the country, have a different postal code. The postal code gives the postal service a better ability to automatically sort the mail to deliver it to the right location. For the same general reasons, hosts on the same LAN are in the same subnet, and hosts in different LANs are in different subnets. + +Note that the point-to-point WAN link in the figure also needs a subnet. Figure 11-3 shows Router R1 connected to the LAN subnet on the left and to a WAN subnet on the right. Router R2 connects to that same WAN subnet. To do so, both R1 and R2 will have IP addresses on their WAN interfaces, and the addresses will be in the same subnet. (An +Ethernet WAN link has the same IP addressing needs, with each of the two routers having an IP address in the same subnet.) +The Ethernet LANs in Figure 11-3 also show a slightly different style of drawing, using 11 simple lines with no Ethernet switch. Drawings of Ethernet LANs when the details of the +LAN switches do not matter simply show each device connected to the same line, as shown in Figure 11-3. (This kind of drawing mimics the original Ethernet cabling before switches and hubs existed.) + +Finally, because the routers’ main job is to forward packets from one subnet to another, rout-ers typically connect to multiple subnets. For example, in this case, Router R1 connects to one LAN subnet on the left and one WAN subnet on the right. To do so, R1 will be config-ured with two different IP addresses, one per interface. These addresses will be in different subnets because the interfaces connect the router to different subnets. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +270 CCNA 200-301 Official Cert Guide, Volume 1 + +Determining the Number of Subnets +To determine the number of subnets required, the engineer must think about the internet-work as documented and count the locations that need a subnet. To do so, the engineer requires access to network diagrams, VLAN configuration details, and details about WAN links. For the types of links discussed in this book, you should plan for one subnet for every + +■ VLAN +■ Point-to-point serial link +■ Ethernet WAN (Ethernet Line Service) + + +NOTE Other WAN technologies outside the scope of the CCNA exam topics allow subnet-ting options other than one subnet per pair of routers on the WAN (as shown here). However, this book only uses point-to-point WAN technologies—serial links and Ethernet WAN links— that have one subnet for each point-to-point WAN connection between two routers. + +For example, imagine that the network planner has only Figure 11-4 on which to base the subnet design. + + +B1 + + + +Core B2 + + + +B3 + +Figure 11-4 Four-Site Internetwork with Small Central Site + +The number of subnets required cannot be fully predicted with only this figure. Certainly, three subnets will be needed for the WAN links, one per link. However, each LAN switch can be configured with a single VLAN or with multiple VLANs. You can be certain that you need at least one subnet for the LAN at each site, but you might need more. + +Next, consider the more detailed version of the same figure shown in Figure 11-5. In this case, the figure shows VLAN counts in addition to the same Layer 3 topology (the routers and the links connected to the routers). It also shows that the central site has many more switches, but the key fact on the left, regardless of how many switches exist, is that the central site has a total of 12 VLANs. Similarly, the figure lists each branch as having two VLANs. Along with the same three WAN subnets, this internetwork requires 21 subnets. + +Finally, in a real job, you would consider the needs today as well as how much growth you expect in the internetwork over time. Any subnetting plan should include a reasonable esti-mate of the number of subnets you need to meet future needs. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 271 + + + +2 VLANs + +B1 + + +12 VLANs 2 VLANs + +Core B2 + + +2 VLANs + +B3 + + +Legend: - Subnet + + + +Figure 11-5 Four-Site Internetwork with Larger Central Site + +Determining the Number of Hosts per Subnet +Determining the number of hosts per subnet requires knowing a few simple concepts and then doing a lot of research and questioning. Every device that connects to a subnet needs an IP address. For a totally new network, you can look at business plans—numbers of people +at the site, devices on order, and so on—to get some idea of the possible devices. When expanding an existing network to add new sites, you can use existing sites as a point of com-parison and then find out which sites will get bigger or smaller. And don’t forget to count the router interface IP address in each subnet and the switch IP address used to remotely manage the switch. + +Instead of gathering data for each and every site, planners often just use a few typical sites for planning purposes. For example, maybe you have some large sales offices and some small sales offices. You might dig in and learn a lot about only one large sales office and only one small sales office. Add that analysis to the fact that point-to-point links need a subnet with +just two addresses, plus any analysis of more one-of-a-kind subnets, and you have enough 11 information to plan the addressing and subnetting design. + +For example, in Figure 11-6, the engineer has built a diagram that shows the number of hosts per LAN subnet in the largest branch, B1. For the two other branches, the engineer did not bother to dig to find out the number of required hosts. As long as the number of required +IP addresses at sites B2 and B3 stays below the estimate of 50, based on larger site B1, the engineer can plan for 50 hosts in each branch LAN subnet and have plenty of addresses per subnet. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +272 CCNA 200-301 Official Cert Guide, Volume 1 + +Largest: 50 Hosts/Subnet + + +B1 + +Smaller + + +Core B2 + +Smaller + + +B3 + +Figure 11-6 Large Branch B1 with 50 Hosts/Subnet + +One Size Subnet Fits All—Or Not +The final choice in the initial planning step is to decide whether you will use a simpler design by using a one-size-subnet-fits-all philosophy. A subnet’s size, or length, is simply the num-ber of usable IP addresses in the subnet. A subnetting design can either use one size subnet or varied sizes of subnets, with pros and cons for each choice. + +Defining the Size of a Subnet +Before you finish this book, you will learn all the details of how to determine the size of the subnet. For now, you just need to know a few specific facts about the size of subnets. Chapter 12, “Analyzing Classful IPv4 Networks,” and Chapter 13, “Analyzing Subnet Masks,” give you a progressively deeper knowledge of the details. + +The engineer assigns each subnet a subnet mask, and that mask, among other things, defines the size of that subnet. The mask sets aside a number of host bits whose purpose is to num-ber different host IP addresses in that subnet. Because you can number 2x things with x bits, if the mask defines H host bits, the subnet contains 2H unique numeric values. + +However, the subnet’s size is not 2H. It’s 2H – 2 because two numbers in each subnet are reserved for other purposes. Each subnet reserves the numerically lowest value for the sub-net number and the numerically highest value as the subnet broadcast address. As a result, the number of usable IP addresses per subnet is 2H – 2. + +NOTE The terms subnet number, subnet ID, and subnet address all refer to the number that represents or identifies a subnet. + +Figure 11-7 shows the general concept behind the three-part structure of an IP address, focusing on the host part and the resulting subnet size. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 273 + +32 Bits + +Network Subnet Host + +H + +2H - 2 + +Figure 11-7 Subnet Size Concepts + +One Size Subnet Fits All +To choose to use a single-size subnet in an enterprise network, you must use the same mask for all subnets because the mask defines the size of the subnet. But which mask? + +One requirement to consider when choosing that one mask is this: that one mask must pro-vide enough host IP addresses to support the largest subnet. To do so, the number of host bits (H) defined by the mask must be large enough so that 2H – 2 is larger than (or equal to) the number of host IP addresses required in the largest subnet. + +For example, consider Figure 11-8. It shows the required number of hosts per LAN subnet. (The figure ignores the subnets on the WAN links, which require only two IP addresses each.) The branch LAN subnets require only 50 host addresses, but the main site LAN sub-net requires 200 host addresses. To accommodate the largest subnet, you need at least 8 host bits. Seven host bits would not be enough because 27 – 2 = 126. Eight host bits would be enough because 28 – 2 = 254, which is more than enough to support 200 hosts in a subnet. + +Need: 50 Addresses Each + +B1 254 Need: 200 Addresses + +254 Core B2 254 + + + + +B3 + +Figure 11-8 Network Using One Subnet Size + +254 +11 + + +What’s the big advantage when using a single-size subnet? Operational simplicity. In other words, keeping it simple. Everyone on the IT staff who has to work with networking can get used to working with one mask—and one mask only. Staff members will be able to answer all subnetting questions more easily because everyone gets used to doing subnetting math with that one mask. + +The big disadvantage for using a single-size subnet is that it wastes IP addresses. For exam-ple, in Figure 11-8, all the branch LAN subnets support 254 addresses, while the largest branch subnet needs only 50 addresses. The WAN subnets only need two IP addresses, but each supports 254 addresses, again wasting more IP addresses. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +274 CCNA 200-301 Official Cert Guide, Volume 1 + +The wasted IP addresses do not actually cause a problem in most cases, however. Most orga-nizations use private IP networks in their enterprise internetworks, and a single Class A or Class B private network can supply plenty of IP addresses, even with the waste. + +Multiple Subnet Sizes (Variable-Length Subnet Masks) +To create multiple sizes of subnets in one Class A, B, or C network, the engineer must create some subnets using one mask, some with another, and so on. Different masks mean different numbers of host bits, and a different number of hosts in some subnets based on the 2H – 2 formula. + +For example, consider the requirements listed earlier in Figure 11-8. It showed one LAN sub-net on the left that needs 200 host addresses, three branch subnets that need 50 addresses, and three WAN links that need two addresses. To meet those needs, but waste fewer IP addresses, three subnet masks could be used, creating subnets of three different sizes, as shown in Figure 11-9. + +Need: 50 Each + +2 B1 62 Need: 200 +2 +254 Core B2 62 2 + + +B3 62 + +Figure 11-9 Three Masks, Three Subnet Sizes + +The smaller subnets now waste fewer IP addresses compared to the design shown earlier in Figure 11-8. The subnets on the right that need 50 IP addresses have subnets with 6 host bits, for 26 – 2 = 62 available addresses per subnet. The WAN links use masks with 2 host bits, for 22 – 2 = 2 available addresses per subnet. + +However, some are still wasted because you cannot set the size of the subnet as some arbi-trary size. All subnets will be a size based on the 2H – 2 formula, with H being the number of host bits defined by the mask for each subnet. + +One Mask for All Subnets, or More Than One +For the most part, this book explains subnetting using designs that use a single mask, creat-ing a single subnet size for all subnets. Why? First, it makes the process of learning subnet-ting easier. Second, some types of analysis that you can do about a network—specifically, calculating the number of subnets in the classful network—only make sense when a single mask is used. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 275 + +However, you still need to be ready to work with designs that use more than one mask in different subnets of the same Class A, B, or C network. In fact, a design that does just that is said to be using variable-length subnet masks (VLSM). For example, the internetwork in Figure 11-10 shows 11 subnets, two with a mask of /30, and nine with a mask of /24. By +using more than one mask among all the subnets of one Class A network (10.0.0.0), the design uses VLSM. + + +10.2.1.0 /24 10.2.2.0 /24 10.2.3.0 /24 +10.2.4.0 /24 + + +Albuquerque +10.1.4.0 /30 10.1.6.0 /30 +S0/1 S0/0 S0/1 S0/0 Yosemite Seville + +10.1.1.0 /24 + +10.3.4.0 /24 10.3.5.0 /24 10.3.6.0 /24 +10.3.7.0 /24 + + +Figure 11-10 Internetwork with VLSM: Network 10.0.0.0, >1 Mask + +For the current CCNA 200-301 exam, using VLSM causes no issues, although it does cause problems with some older routing protocols. The only routing protocol included in the CCNA blueprint (OSPF) works the same regardless of whether the design uses VLSM. Just be aware of the term and what it means and that it should not impact the features included in the current CCNA exam. + +NOTE VLSM has been featured in the CCNA exam topics in the past. If you want to read a little more about VLSM, check out Appendix N, “Variable-Length Subnet Masks,” on the companion website for this book. + + +Make Design Choices +Now that you know how to analyze the IP addressing and subnetting needs, the next major step examines how to apply the rules of IP addressing and subnetting to those needs and make some choices. In other words, now that you know how many subnets you need and how many host addresses you need in the largest subnet, how do you create a useful subnet-ting design that meets those requirements? The short answer is that you need to do the three tasks shown on the right side of Figure 11-11. + + +Analyze Needs +# Subnets +# Hosts/Subnet 1 Size Subnet + +Design 11 Subnets +• Choose Network • Choose 1 Mask • List All Subnets + + +Figure 11-11 Input to the Design Phase, and Design Questions to Answer + +Choose a Classful Network +In the original design for what we know of today as the Internet, companies used registered public classful IP networks when implementing TCP/IP inside the company. By the + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +276 CCNA 200-301 Official Cert Guide, Volume 1 + +mid-1990s, an alternative became more popular: private IP networks. This section discusses the background behind these two choices because it impacts the choice of what IP network a company will then subnet and implement in its enterprise internetwork. + +Public IP Networks +The original design of the Internet required that any company that connected to the Internet had to use a registered public IP network. To do so, the company would complete some paperwork, describing the enterprise’s internetwork and the number of hosts existing, plus plans for growth. After submitting the paperwork, the company would receive an assignment of either a Class A, B, or C network. + +Public IP networks—and the administrative processes surrounding them—ensure that all the companies that connect to the Internet all use unique IP addresses. In particular, after a pub-lic IP network is assigned to a company, only that company should use the addresses in that network. That guarantee of uniqueness means that Internet routing can work well because there are no duplicate public IP addresses. + +For example, consider the example shown in Figure 11-12. Company 1 has been assigned public Class A network 1.0.0.0, and company 2 has been assigned public Class A network 2.0.0.0. Per the original intent for public addressing in the Internet, after these public network assignments have been made, no other companies can use addresses in Class A networks 1.0.0.0 or 2.0.0.0. + + + +Company 1 + + +Company 2 + +1.0.0.0 + +Internet + +2.0.0.0 + + +Figure 11-12 Two Companies with Unique Public IP Networks + +This original address assignment process ensured unique IP addresses across the entire plan-et. The idea is much like the fact that your telephone number should be unique in the uni-verse, your postal mailing address should also be unique, and your email address should also be unique. If someone calls you, your phone rings, but no one else’s phone rings. Similarly, if company 1 is assigned Class A network 1.0.0.0, and the engineers at Company 1 assign address 1.1.1.1 to a particular PC, that address should be unique in the universe. A packet sent through the Internet to destination 1.1.1.1 should only arrive at this one PC inside com-pany 1, instead of being delivered to some other host. + +Growth Exhausts the Public IP Address Space +By the early 1990s, the world was running out of public IP networks that could be assigned. During most of the 1990s, the number of hosts newly connected to the Internet was grow-ing at a double-digit pace per month. Companies kept following the rules, asking for public IP networks, and it was clear that the current address-assignment scheme could not continue without some changes. Simply put, the number of Class A, B, and C networks supported by the 32-bit address in IP version 4 (IPv4) was not enough to support one public classful net-work per organization, while also providing enough IP addresses in each company. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 277 + + +NOTE The universe has run out of public IPv4 addresses in a couple of significant ways. IANA, which assigns public IPv4 address blocks to the five Regional Internet Registries (RIR) around the globe, assigned the last of the IPv4 address spaces in early 2011. By 2015, ARIN, the RIR for North America, exhausted its supply of IPv4 addresses, so companies must return unused public IPv4 addresses to ARIN before they have more to assign to new companies. Try an online search for “ARIN depletion” to see pages about the current status of available IPv4 address space for just one RIR example. + +The Internet community worked hard during the 1990s to solve this problem, coming up with several solutions, including the following: + +■ A new version of IP (IPv6), with much larger addresses (128 bit) +■ Assigning a subset of a public IP network to each company, instead of an entire public IP network, to reduce waste, using a feature called “Classless Interdomain Routing” (CIDR) +■ Network Address Translation (NAT), which allows the use of private IP networks + +These three solutions matter to real networks today. However, to stay focused on the topic of subnet design, this chapter focuses on the third option, and in particular, the private IP networks that can be used by an enterprise when also using NAT. (Be aware that Chapter 10, “Network Address Translation” in CCNA 200-301 Official Cert Guide, Volume 2, gives more detail about the last two bullets in the list, while Part VII of this book discusses the first bullet item (IPv6) in more depth. + +Focusing on the third item in the bullet list, NAT allows multiple companies to use the exact same private IP network, using the same IP addresses as other companies while still connecting to the Internet. For example, Figure 11-13 shows the same two companies con-necting to the Internet as in Figure 11-12, but now with both using the same private Class A network 10.0.0.0. + + + +Company 1 + + +Company 2 + +10.0.0.0 NAT +Internet + +10.0.0.0 NAT + + +Figure 11-13 Reusing the Same Private Network 10.0.0.0 with NAT 11 + +Both companies use the same classful IP network (10.0.0.0). Both companies can implement their subnet design internal to their respective enterprise internetworks, without discussing their plans. The two companies can even use the exact same IP addresses inside network 10.0.0.0. And amazingly, at the same time, both companies can even communicate with each other through the Internet. + +The technology called Network Address Translation makes it possible for companies to reuse the same IP networks, as shown in Figure 11-13. NAT does this by translating the IP addresses inside the packets as they go from the enterprise to the Internet, using a small number of public IP addresses to support tens of thousands of private IP addresses. That one bit of information is not enough to understand how NAT works; however, to keep the focus + + +|||||||||||||||||||| +|||||||||||||||||||| + + +278 CCNA 200-301 Official Cert Guide, Volume 1 + +on subnetting, the book defers the discussion of how NAT works until CCNA 200-301 Official Cert Guide, Volume 2. For now, accept that most companies use NAT, and there-fore, they can use private IP networks for their internetworks. + +Private IP Networks +When using NAT—and almost every organization that connects to the Internet uses +NAT—the company can simply pick one or more of the private IP networks from the list of reserved private IP network numbers. RFC 1918 defines the list of available private IP net-works, which is summarized in Table 11-2. + +Table 11-2 RFC 1918 Private Address Space + +Class of Networks A +B + +C + +Private IP Networks 10.0.0.0 +172.16.0.0 through 172.31.0.0 + +192.168.0.0 through 192.168.255.0 + +Number of Networks 1 +16 + +256 + + + + +NOTE According to an informal survey I ran on my blog a few years back, about half of the respondents said that their networks use private Class A network 10.0.0.0, as opposed to other private networks or public networks. + +From the perspective of making IPv4 work for the entire world, private IP networks have helped preserve and extend IPv4 and its use in every enterprise and throughout the Internet. In particular, private networks have improved IPv4’s implementation worldwide by + +■ Avoiding Using Another Organization’s Public Address Range for Private Networks: Some organizations have a part of their networks that need zero Internet access. The hosts in that part of their network need IP addresses. RFC 1918 suggests that truly pri-vate networks—that is, networks with no need for Internet connectivity—use addresses from the RFC 1918 list of private networks. +■ Avoiding/Delaying IPv4 Address Exhaustion: To delay the day in which all public IPv4 addresses were assigned to organizations as public addresses, RFC 1918 calls for the use of NAT along with private networks for the addresses internal to an organization. +■ Reducing Internet Routers’ Routing Table Size: Using private networks also helps reduce the size of the IP routing tables in Internet routers. For instance, routers in the Internet do not need routes for the private IP networks used inside organizations (in fact, ISPs filter those routes). + +Choosing an IP Network During the Design Phase +Today, some organizations use private IP networks along with NAT, and some use public IP networks. Most new enterprise internetworks use private IP addresses throughout the +network, along with NAT, as part of the connection to the Internet. Those organizations that already have registered public IP networks—often obtained before the addresses started + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 279 + +running short in the early 1990s—can continue to use those public addresses throughout their enterprise networks. + +After the choice to use a private IP network has been made, just pick one that has enough IP addresses. You can have a small internetwork and still choose to use private Class A net- +work 10.0.0.0. It might seem wasteful to choose a Class A network that has over 16 million IP addresses, especially if you need only a few hundred. However, there’s no penalty or prob-lem with using a private network that is too large for your current or future needs. + +For the purposes of this book, most examples use private IP network numbers. For the design step to choose a network number, just choose a private Class A, B, or C network from the list of RFC 1918 private networks. + +Regardless, from a math and concept perspective, the methods to subnet a public IP network versus a private IP network are the same. + +Choose the Mask +If a design engineer followed the topics in this chapter so far, in order, he would know the following: + +■ The number of subnets required +■ The number of hosts/subnet required +■ That a choice was made to use only one mask for all subnets so that all subnets are the same size (same number of hosts/subnet) +■ The classful IP network number that will be subnetted + +This section completes the design process, at least the parts described in this chapter, by discussing how to choose that one mask to use for all subnets. First, this section examines default masks, used when a network is not subnetted, as a point of comparison. Next, the concept of borrowing host bits to create subnet bits is explored. Finally, this section ends with an example of how to create a subnet mask based on the analysis of the requirements. + +Classful IP Networks Before Subnetting +Before an engineer subnets a classful network, the network is a single group of addresses. In other words, the engineer has not yet subdivided the network into many smaller subsets +called subnets. 11 When thinking about an unsubnetted classful network, the addresses in a network have +only two parts: the network part and host part. Comparing any two addresses in the classful network: + +■ The addresses have the same value in the network part. ■ The addresses have different values in the host part. + +The actual sizes of the network and host part of the addresses in a network can be easily predicted, as shown in Figure 11-14. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +280 CCNA 200-301 Official Cert Guide, Volume 1 + + +A N=8 H=24 + + +B N=16 H=16 + + +C N=24 H=8 + +Figure 11-14 Format of Unsubnetted Class A, B, and C Networks + +In Figure 11-14, N and H represent the number of network and host bits, respectively. Class rules define the number of network octets (1, 2, or 3) for Classes A, B, and C, respectively; the figure shows these values as a number of bits. The number of host octets is 3, 2, or 1, respectively. + +Continuing the analysis of classful network before subnetting, the number of addresses in one classful IP network can be calculated with the same 2H – 2 formula previously dis-cussed. In particular, the size of an unsubnetted Class A, B, or C network is as follows: +■ Class A: 224 – 2 = 16,777,214 ■ Class B: 216 – 2 = 65,534 +■ Class C: 28 – 2 = 254 + +Borrowing Host Bits to Create Subnet Bits +To subnet a network, the designer thinks about the network and host parts, as shown in Figure 11-15, and then the engineer adds a third part in the middle: the subnet part. However, the designer cannot change the size of the network part or the size of the entire address (32 bits). To create a subnet part of the address structure, the engineer borrows bits from the host part. Figure 11-15 shows the general idea. + +A +A N=8 S=__ H=__ + +B +B N=16 S=__ H=__ + +C +C N=24 S=__ H=__ + +N + S + H = 32 + +Figure 11-15 Concept of Borrowing Host Bits + +Figure 11-15 shows a rectangle that represents the subnet mask. N, representing the number of network bits, remains locked at 8, 16, or 24, depending on the class. Conceptually, the designer moves a (dashed) dividing line into the host field, with subnet bits (S) between the + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 281 + +network and host parts, and the remaining host bits (H) on the right. The three parts must add up to 32 because IPv4 addresses consist of 32 bits. + +Choosing Enough Subnet and Host Bits +The design process requires a choice of where to place the dashed line shown in Figure 11-15. But what is the right choice? How many subnet and host bits should the designer +choose? The answers hinge on the requirements gathered in the early stages of the planning process: + +■ Number of subnets required ■ Number of hosts/subnet + +The bits in the subnet part create a way to uniquely number the different subnets that the design engineer wants to create. With 1 subnet bit, you can number 21 or 2 subnets. With 2 bits, 22 or 4 subnets, with 3 bits, 23 or 8 subnets, and so on. The number of subnet bits +must be large enough to uniquely number all the subnets, as determined during the planning process. + +At the same time, the remaining number of host bits must also be large enough to number the host IP addresses in the largest subnet. Remember, in this chapter, we assume the use of a single mask for all subnets. This single mask must support both the required number of subnets and the required number of hosts in the largest subnet. Figure 11-16 shows the concept. + + +Need X Subnets: 2S ≥ X? + +Need Y Hosts/Subnet: 2H-2 ≥ Y? + + + +N S H + +Figure 11-16 Borrowing Enough Subnet and Host Bits + +Figure 11-16 shows the idea of the designer choosing a number of subnet (S) and host (H) bits and then checking the math. 2S must be more than the number of required subnets, or the mask will not supply enough subnets in this IP network. Also, 2H – 2 must be more than +the required number of hosts/subnet. 11 + +NOTE The idea of calculating the number of subnets as 2S applies only in cases where a single mask is used for all subnets of a single classful network, as is being assumed in this chapter. + +To effectively design masks, or to interpret masks that were chosen by someone else, you need a good working memory of the powers of 2. Appendix A, “Numeric Reference Tables,” lists a table with powers of 2 up through 232 for your reference. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +282 CCNA 200-301 Official Cert Guide, Volume 1 + +Example Design: 172.16.0.0, 200 Subnets, 200 Hosts +To help make sense of the theoretical discussion so far, consider an example that focuses on the design choice for the subnet mask. In this case, the planning and design choices so far tell us the following: + +■ Use a single mask for all subnets. ■ Plan for 200 subnets. +■ Plan for 200 host IP addresses per subnet. ■ Use private Class B network 172.16.0.0. + +To choose the mask, the designer asks this question: + +How many subnet (S) bits do I need to number 200 subnets? +You can see that S = 7 is not large enough (27 = 128), but S = 8 is enough (28 = 256). So, you need at least 8 subnet bits. + +Next, the designer asks a similar question, based on the number of hosts per subnet: + +How many host (H) bits do I need to number 200 hosts per subnet? +The math is basically the same, but the formula subtracts 2 when counting the number of hosts/subnet. You can see that H = 7 is not large enough (27 – 2 = 126), but H = 8 is enough (28 – 2 = 254). + +Only one possible mask meets all the requirements in this case. First, the number of network bits (N) must be 16 because the design uses a Class B network. The requirements tell us that the mask needs at least 8 subnet bits and at least 8 host bits. The mask only has 32 bits in it; Figure 11-17 shows the resulting mask. + +B + +N = 16 S = 8 H = 8 + + + +256 2S Excess: 56 + + +Need: 200 + +2H - 2 254 Excess: 54 + + +Need: 200 + + + +Subnets Hosts/Subnet + +Figure 11-17 Example Mask Choice, N = 16, S = 8, H = 8 + +Masks and Mask Formats +Although engineers think about IP addresses in three parts when making design choices (network, subnet, and host), the subnet mask gives the engineer a way to communicate those design choices to all the devices in the subnet. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 283 + +The subnet mask is a 32-bit binary number with a number of binary 1s on the left and with binary 0s on the right. By definition, the number of binary 0s equals the number of host bits; in fact, that is exactly how the mask communicates the idea of the size of the host part of the addresses in a subnet. The beginning bits in the mask equal binary 1, with those bit posi-tions representing the combined network and subnet parts of the addresses in the subnet. + +Because the network part always comes first, then the subnet part, and then the host part, the subnet mask, in binary form, cannot have interleaved 1s and 0s. Each subnet mask has one unbroken string of binary 1s on the left, with the rest of the bits as binary 0s. + +After the engineer chooses the classful network and the number of subnet and host bits in a subnet, creating the binary subnet mask is easy. Just write down N 1s, S 1s, and then H 0s (assuming that N, S, and H represent the number of network, subnet, and host bits). Figure 11-18 shows the mask based on the previous example, which subnets a Class B network by creating 8 subnet bits, leaving 8 host bits. + +N = 16 S = 8 H = 8 + + +11111111 11111111 11111111 00000000 + +Figure 11-18 Creating the Subnet Mask—Binary—Class B Network + +In addition to the binary mask shown in Figure 11-18, masks can also be written in two other formats: the familiar dotted-decimal notation (DDN) seen in IP addresses and an even briefer prefix notation. Chapter 13, “Analyzing Subnet Masks,” discusses these formats and how to convert between the different formats. + +Build a List of All Subnets +Building a list of all subnets, the final task of the subnet design step, determines the actual subnets that can be used, based on all the earlier choices. The earlier design work deter-mined the Class A, B, or C network to use, and the (one) subnet mask to use that supplies enough subnets and enough host IP addresses per subnet. But what are those subnets? How do you identify or describe a subnet? This section answers these questions. + +A subnet consists of a group of consecutive numbers. Most of these numbers can be used as IP addresses by hosts. However, each subnet reserves the first and last numbers in the group, +and these two numbers cannot be used as IP addresses. In particular, each subnet contains 11 the following: + +■ Subnet number: Also called the subnet ID or subnet address, this number identifies the subnet. It is the numerically smallest number in the subnet. It cannot be used as an IP address by a host. +■ Subnet broadcast: Also called the subnet broadcast address or directed broadcast address, this is the last (numerically highest) number in the subnet. It also cannot be used as an IP address by a host. +■ IP addresses: All the numbers between the subnet ID and the subnet broadcast address can be used as a host IP address. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +284 CCNA 200-301 Official Cert Guide, Volume 1 + +For example, consider the earlier case in which the design results were as follows: + + +Network +Mask + +172.16.0.0 (Class B) +255.255.255.0 (for all subnets) + +With some math, the facts about each subnet that exists in this Class B network can be cal-culated. In this case, Table 11-3 shows the first 10 such subnets. It then skips many subnets and shows the last two (numerically largest) subnets. + +Table 11-3 First 10 Subnets, Plus the Last Few, from 172.16.0.0, 255.255.255.0 + +Subnet Number 172.16.0.0 +172.16.1.0 + +172.16.2.0 + +172.16.3.0 + +172.16.4.0 + +172.16.5.0 + +172.16.6.0 + +172.16.7.0 + +172.16.8.0 + +172.16.9.0 + +Skipping many… + +172.16.254.0 + +172.16.255.0 + +IP Addresses 172.16.0.1 – 172.16.0.254 +172.16.1.1 – 172.16.1.254 + +172.16.2.1 – 172.16.2.254 + +172.16.3.1 – 172.16.3.254 + +172.16.4.1 – 172.16.4.254 + +172.16.5.1 – 172.16.5.254 + +172.16.6.1 – 172.16.6.254 + +172.16.7.1 – 172.16.7.254 + +172.16.8.1 – 172.16.8.254 + +172.16.9.1 – 172.16.9.254 + + +172.16.254.1 – 172.16.254.254 + +172.16.255.1 – 172.16.255.254 + +Broadcast Address 172.16.0.255 +172.16.1.255 + +172.16.2.255 + +172.16.3.255 + +172.16.4.255 + +172.16.5.255 + +172.16.6.255 + +172.16.7.255 + +172.16.8.255 + +172.16.9.255 + + +172.16.254.255 + +172.16.255.255 + + + +After you have the network number and the mask, calculating the subnet IDs and other details for all subnets requires some math. In real life, most people use subnet calculators or subnet-planning tools. For the CCNA exam, you need to be ready to find this kind of information. + +If you want to dig a little deeper in preparation for CCNP Enterprise or other studies related to IP routing, consider using Appendix L, “Subnet Design,” on the book’s companion web-site, which shows you how to find all the subnets of a given network. + +Plan the Implementation +The next step, planning the implementation, is the last step before actually configuring the devices to create a subnet. The engineer first needs to choose where to use each subnet. For example, at a branch office in a particular city, which subnet from the subnet planning chart (Table 11-3) should be used for each VLAN at that site? Also, for any interfaces that +require static IP addresses, which addresses should be used in each case? Finally, what range of IP addresses from inside each subnet should be configured in the DHCP server, to be + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 285 + +dynamically leased to hosts for use as their IP address? Figure 11-19 summarizes the list of implementation planning tasks. + + +Analyze Needs +# Subnets +# Hosts/Subnet +1 Size Subnet + +Design Subnets +Choose Network Choose 1 Mask +List All Subnets + +Plan Implementation +• Subnets Locations • Static IP +• DHCP Ranges + + +Figure 11-19 Facts Supplied to the Plan Implementation Step + +Assigning Subnets to Different Locations +The job is simple: Look at your network diagram, identify each location that needs a subnet, and pick one from the table you made of all the possible subnets. Then, track it so that you know which ones you use where, using a spreadsheet or some other purpose-built subnet-planning tool. That’s it! Figure 11-20 shows a sample of a completed design using Table 11-3, which happens to match the initial design sample shown way back in Figure 11-1. + +172.16.2.0 /24 172.16.4.0 /24 + +R2 +172.16.1.0 /24 + + +R1 + + + + +172.16.5.0 /24 + +Subnet Design Choices: +Class B 172.16.0.0 /24 (255.255.255.0) + +R3 + +172.16.3.0 /24 + + +Figure 11-20 Example of Subnets Assigned to Different Locations 11 Although this design could have used any five subnets from Table 11-3, in real networks, +engineers usually give more thought to some strategy for assigning subnets. For example, you might assign all LAN subnets lower numbers and WAN subnets higher numbers. Or you might slice off large ranges of subnets for different divisions of the company. Or you might follow that same strategy but ignore organizational divisions in the company, paying more attention to geographies. + +For example, for a U.S.-based company with a smaller presence in both Europe and Asia, you might plan to reserve ranges of subnets based on continent. This kind of choice is par-ticularly useful when later trying to use a feature called route summarization. Figure 11-21 shows the general benefit of placing addressing in the network for easier route summariza-tion, using the same subnets from Table 11-3 again. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +286 CCNA 200-301 Official Cert Guide, Volume 1 + + +North America + +First Half of Network + +Subnets 172.16.0.0 -172.16.127.0 + + +Europe + + +Third Quarter of Network: + +Subnets 172.16.128.0 -172.16.191.0 + + +Asia + + +Last Quarter of Network: + +Subnets 172.16.192.0 -172.16.255.0 + + +Figure 11-21 Reserving 50 Percent of Subnets for North America and 25 Percent Each for Europe and Asia + +Choose Static and Dynamic Ranges per Subnet +Devices receive their IP address and mask assignment in one of two ways: dynamically by using Dynamic Host Configuration Protocol (DHCP) or statically through configuration. For DHCP to work, the network engineer must tell the DHCP server the subnets for which it must assign IP addresses. In addition, that configuration limits the DHCP server to only a subset of the addresses in the subnet. For static addresses, you simply configure the device to tell it what IP address and mask to use. + +To keep things as simple as possible, most shops use a strategy to separate the static IP addresses on one end of each subnet, and the DHCP-assigned dynamic addresses on the other. It does not really matter whether the static addresses sit on the low end of the range of addresses or the high end. + +For example, imagine that the engineer decides that, for the LAN subnets in Figure 11-20, the DHCP pool comes from the high end of the range, namely, addresses that end in .101 through .254. (The address that ends in .255 is, of course, reserved.) The engineer also assigns static addresses from the lower end, with addresses ending in .1 through .100. Figure 11-22 shows the idea. +172.16.2.___ + + + +172.16.1.___ + + +.11 .1 +R1 + +.1 .101 +R2 .102 + + +172.16.3.___ + +.1 .101 + + + +Notes: +Static: 1 - 100 + + +R3 .102 + +DHCP:101 - 254 + +Figure 11-22 Static from the Low End and DHCP from the High End + +Figure 11-22 shows all three routers with statically assigned IP addresses that end in .1. The only other static IP address in the figure is assigned to the server on the left, with address 172.16.1.11 (abbreviated simply as .11 in the figure). + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 11: Perspectives on IPv4 Subnetting 287 + +On the right, each LAN has two PCs that use DHCP to dynamically lease their IP addresses. DHCP servers often begin by leasing the addresses at the bottom of the range of addresses, so in each LAN, the hosts have leased addresses that end in .101 and .102, which are at the low end of the range chosen by design. + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 11-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 11-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Resource Used Book, website +Book, website + +Book, PTP + +Website + + + +Review All the Key Topics + +Table 11-5 +Key Topic Element +List + +List + +Figure 11-7 + +List + +List + +Key Topics for Chapter 11 +Description Page Number +Key facts about subnets 269 + +Rules about what places in a network topology need a subnet 270 + +Locations of the network, subnet, and host parts of an IPv4 address 273 + +Features that extended the life of IPv4 277 + +Motivations for using private IP networks 278 11 + +Figure 11-14 Formats of Class A, B, and C addresses when not subnetted 280 + +Figure 11-15 Formats of Class A, B, and C addresses when subnetted 280 + +Figure 11-16 General logic when choosing the size of the subnet and host parts 281 of addresses in a subnet +List Items that together define a subnet 283 + + +Key Terms You Should Know +subnet, network, classful IP network, variable-length subnet masks (VLSM), network part, subnet part, host part, public IP network, private IP network, subnet mask + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 12 + + +Analyzing Classful IPv4 Networks This chapter covers the following exam topics: +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +When operating a network, you often start investigating a problem based on an IP address and mask. Based on the IP address alone, you should be able to determine several facts about the Class A, B, or C network in which the IP address resides. + +This chapter lists the key facts about classful IP networks and explains how to discover these facts. Following that, this chapter lists some practice problems. Before moving to the next chapter, you should practice until you can consistently determine all these facts, quickly and confidently, based on an IP address. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 12-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Classful Network Concepts + +Questions +1–5 + + + +1. Which of the following are not valid Class A network IDs? (Choose two answers.) a. 1.0.0.0 +b. 130.0.0.0 c. 127.0.0.0 d. 9.0.0.0 +2. Which of the following are not valid Class B network IDs? a. 130.0.0.0 +b. 191.255.0.0 c. 128.0.0.0 +d. 150.255.0.0 +e. All are valid Class B network IDs. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +3. Which of the following are true about IP address 172.16.99.45’s IP network? (Choose two answers.) +a. The network ID is 172.0.0.0. +b. The network is a Class B network. +c. The default mask for the network is 255.255.255.0. +d. The number of host bits in the unsubnetted network is 16. + +4. Which of the following are true about IP address 192.168.6.7’s IP network? (Choose two answers.) +a. The network ID is 192.168.6.0. +b. The network is a Class B network. +c. The default mask for the network is 255.255.255.0. +d. The number of host bits in the unsubnetted network is 16. + +5. Which of the following is a network broadcast address? + +a. 10.1.255.255 b. 192.168.255.1 c. 224.1.1.255 +d. 172.30.255.255 + + +Foundation Topics + +Classful Network Concepts +Imagine that you have a job interview for your first IT job. As part of the interview, you’re given an IPv4 address and mask: 10.4.5.99, 255.255.255.0. What can you tell the interviewer about the classful network (in this case, the Class A network) in which the IP address resides? + +This section, the first of two major sections in this chapter, reviews the concepts of classful IP networks (in other words, Class A, B, and C networks). In particular, this chapter exam-ines how to begin with a single IP address and then determine the following facts: + +■ Class (A, B, or C) ■ Default mask +■ Number of network octets/bits ■ Number of host octets/bits +■ Number of host addresses in the network ■ Network ID +■ Network broadcast address +■ First and last usable address in the network + + +|||||||||||||||||||| +|||||||||||||||||||| + + +290 CCNA 200-301 Official Cert Guide, Volume 1 + +IPv4 Network Classes and Related Facts +IP version 4 (IPv4) defines five address classes. Three of the classes, Classes A, B, and C, consist of unicast IP addresses. Unicast addresses identify a single host or interface so that the address uniquely identifies the device. Class D addresses serve as multicast addresses, so that one packet sent to a Class D multicast IPv4 address can actually be delivered to mul-tiple hosts. Finally, Class E addresses were originally intended for experimentation but were changed to simply be reserved for future use. The class can be identified based on the value of the first octet of the address, as shown in Table 12-2. + +Table 12-2 IPv4 Address Classes Based on First Octet Values + +Class First Octet Values A 1–126 +B 128–191 + +C 192–223 + +D 224–239 + +E 240–255 + +Purpose +Unicast (large networks) + +Unicast (medium-sized networks) + +Unicast (small networks) + +Multicast + +Reserved (formerly experimental) + + + +After you identify the class of a unicast address as either A, B, or C, many other related facts can be derived just through memorization. Table 12-3 lists that information for reference and later study; each of these concepts is described in this chapter. + +Table 12-3 Key Facts for Classes A, B, and C + +Class A +First octet range 1–126 + +Class B +128–191 + +Class C +192–223 + + +Valid network numbers 1.0.0.0–126.0.0.0 128.0.0.0–191.255.0.0 192.0.0.0–223.255.255.0 + + +Total networks + +Hosts per network + +Octets (bits) in network part + +Octets (bits) in host part + +Default mask + +27 – 2 = 126 + +224 – 2 + +1 (8) + +3 (24) + +255.0.0.0 + +214 = 16,384 + +216 – 2 + +2 (16) + +2 (16) + +255.255.0.0 + +221 = 2,097,152 + +28 – 2 + +3 (24) + +1 (8) + +255.255.255.0 + + + +Note that the address ranges of all addresses that begin with 0 and all addresses that begin with 127 are reserved. Had they not been reserved since the creation of Class A networks, as listed in RFC 791 (published in 1981), then they might have been known as class A networks 0.0.0.0 and 127.0.0.0. Because they are reserved, however, the address space has 126 class A networks, and not 128. Also, note that there are no similar reserved ranges to begin/end the class B and C ranges. + + +Answers to the “Do I Know This Already?” quiz: 1 B, C 2 E 3 B, D 4 A, C 5 D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 12: Analyzing Classful IPv4 Networks 291 + +In addition to the reservation of what would be class A networks 0.0.0.0 and 127.0.0.0 for other purposes, other newer RFCs have also reserved small pieces of the Class A, B, and C address space. So, tables like Table 12-3, with the count of the numbers of Class A, B, and C networks, are a good place to get a sense of the size of the number; however, the number of reserved networks does change slightly over time (albeit slowly) based on these other reserved address ranges. + +NOTE If you are interested in seeing all the reserved IPv4 address ranges, just do an Internet search on “IANA IPv4 special-purpose address registry.” + + +The Number and Size of the Class A, B, and C Networks +Table 12-3 lists the range of Class A, B, and C network numbers; however, some key points can be lost just referencing a table of information. This section examines the Class A, B, and C network numbers, focusing on the more important points and the exceptions and unusual cases. + +First, the number of networks from each class significantly differs. Only 126 Class A networks exist: network 1.0.0.0, 2.0.0.0, 3.0.0.0, and so on, up through network 126.0.0.0. However, 16,384 Class B networks exist, with more than 2 million Class C networks. + +Next, note that the size of networks from each class also significantly differs. Each Class A network is relatively large—over 16 million host IP addresses per network—so they were originally intended to be used by the largest companies and organizations. Class B networks are smaller, with over 65,000 hosts per network. Finally, Class C networks, intended for small organizations, have 254 hosts in each network. Figure 12-1 summarizes those facts. + + +Class Networks + + +A + +126 + +Hosts/Network + + + + +16,777,214 + + + +B +16,384 65,534 + + +12 C + +2,097,152 254 + +Figure 12-1 Numbers and Sizes of Class A, B, and C Networks + +Address Formats +In some cases, an engineer might need to think about a Class A, B, or C network as if the network has not been subdivided through the subnetting process. In such a case, the + + +|||||||||||||||||||| +|||||||||||||||||||| + + +292 CCNA 200-301 Official Cert Guide, Volume 1 + +addresses in the classful network have a structure with two parts: the network part (some-times called the prefix) and the host part. Then, comparing any two IP addresses in one network, the following observations can be made: + +The addresses in the same network have the same values in the network part. The addresses in the same network have different values in the host part. +For example, in Class A network 10.0.0.0, by definition, the network part consists of the first octet. As a result, all addresses have an equal value in the network part, namely a 10 in the first octet. If you then compare any two addresses in the network, the addresses have a dif-ferent value in the last three octets (the host octets). For example, IP addresses 10.1.1.1 and 10.1.1.2 have the same value (10) in the network part, but different values in the host part. + +Figure 12-2 shows the format and sizes (in number of bits) of the network and host parts of IP addresses in Class A, B, and C networks, before any subnetting has been applied. + + +A Network (8) + +B Network (16) + +C Network (24) + + +Host (24) + + +Host (16) + + +Host (8) + + +Figure 12-2 Sizes (Bits) of the Network and Host Parts of Unsubnetted Classful Networks + +Default Masks +Although we humans can easily understand the concepts behind Figure 12-2, computers prefer numbers. To communicate those same ideas to computers, each network class has an associated default mask that defines the size of the network and host parts of an unsub-netted Class A, B, and C network. To do so, the mask lists binary 1s for the bits considered to be in the network part and binary 0s for the bits considered to be in the host part. + +For example, Class A network 10.0.0.0 has a network part of the first single octet (8 bits) and a host part of the last three octets (24 bits). As a result, the Class A default mask is 255.0.0.0, which in binary is + +11111111 00000000 00000000 00000000 +Figure 12-3 shows default masks for each network class, both in binary and dotted-decimal format. + +NOTE Decimal 255 converts to the binary value 11111111. Decimal 0, converted to 8-bit binary, is 00000000. See Appendix A, “Numeric Reference Tables,” for a conversion table. + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 12: Analyzing Classful IPv4 Networks 293 + + +Decimal 255 . 0 . 0 . 0 + +A Binary +Concept + +11111111 00000000 + +Network (8) + +00000000 00000000 + +Host (24) + + + +Decimal 255 . 255 . 0 . 0 +B Binary 11111111 11111111 00000000 00000000 Concept Network (16) Host (16) + + +Decimal 255 . 255 . 255 . 0 +C Binary 11111111 11111111 11111111 00000000 Concept Network (24) Host (8) + +Figure 12-3 Default Masks for Classes A, B, and C + +Number of Hosts per Network +Calculating the number of hosts per network requires some basic binary math. First, consid-er a case where you have a single binary digit. How many unique values are there? There are, of course, two values: 0 and 1. With 2 bits, you can make four combinations: 00, 01, 10, and 11. As it turns out, the total combination of unique values you can make with N bits is 2N. + +Host addresses—the IP addresses assigned to hosts—must be unique. The host bits exist for the purpose of giving each host a unique IP address by virtue of having a different value in the host part of the addresses. So, with H host bits, 2H unique combinations exist. +However, the number of hosts in a network is not 2H; instead, it is 2H – 2. Each network reserves two numbers that would have otherwise been useful as host addresses but have instead been reserved for special use: one for the network ID and one for the network broad-cast address. As a result, the formula to calculate the number of host addresses per Class A, B, or C network is +2H – 2 +where H is the number of host bits. + + +Deriving the Network ID and Related Numbers +Each classful network has four key numbers that describe the network. You can derive these four numbers if you start with just one IP address in the network. The numbers are as follows: + +■ Network number +■ First (numerically lowest) usable address ■ Last (numerically highest) usable address +■ Network broadcast address + + +12 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +294 CCNA 200-301 Official Cert Guide, Volume 1 + +First, consider both the network number and first usable IP address. The network number, also called the network ID or network address, identifies the network. By definition, the network number is the numerically lowest number in the network. However, to prevent any ambiguity, the people that made up IP addressing added the restriction that the network number cannot be assigned as an IP address. So, the lowest number in the network is the network ID. Then, the first (numerically lowest) host IP address is one larger than the net-work number. + +Next, consider the network broadcast address along with the last (numerically highest) usable IP address. The TCP/IP RFCs define a network broadcast address as a special address in each network. This broadcast address could be used as the destination address in a packet, and the routers would forward a copy of that one packet to all hosts in that classful network. Numerically, a network broadcast address is always the highest (last) number in the network. As a result, the highest (last) number usable as an IP address is the address that is one less than the network broadcast address. + +Simply put, if you can find the network number and network broadcast address, finding the first and last usable IP addresses in the network is easy. For the exam, you should be able to find all four values with ease; the process is as follows: +Step 1. Determine the class (A, B, or C) based on the first octet. + +Step 2. Mentally divide the network and host octets based on the class. + +Step 3. To find the network number, change the IP address’s host octets to 0. + +Step 4. To find the first address, add 1 to the fourth octet of the network ID. + +Step 5. To find the broadcast address, change the network ID’s host octets to 255. + +Step 6. To find the last address, subtract 1 from the fourth octet of the network broad-cast address. + + +The written process actually looks harder than it is. Figure 12-4 shows an example of the process, using Class A IP address 10.17.18.21, with the circled numbers matching the process. + +Class 1 A B C +Divide 2 + +Network Host + +10 . 17 . 18 . 21 + + +Make Host=0 3 + +Add 1 4 + + +10 . 0 . 0 . 0 +1 +10 . 0 . 0 . 1 + + + +Make Host=255 5 + +Subtract 1 6 + + +10 . 255 . 255 . 255 -1 +10 . 255 . 255 . 254 + + +Figure 12-4 Example of Deriving the Network ID and Other Values from 10.17.18.21 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 12: Analyzing Classful IPv4 Networks 295 + +Figure 12-4 shows the identification of the class as Class A (Step 1) and the number of net-work/host octets as 1 and 3, respectively. So, to find the network ID at Step 3, the figure copies only the first octet, setting the last three (host) octets to 0. At Step 4, just copy the network ID and add 1 to the fourth octet. Similarly, to find the broadcast address at Step 5, copy the network octets, but set the host octets to 255. Then, at Step 6, subtract 1 from the fourth octet to find the last (numerically highest) usable IP address. + +Just to show an alternative example, consider IP address 172.16.8.9. Figure 12-5 shows the process applied to this IP address. + + +Class 1 + +Divide 2 + +A B C + + +Network Host + + +172 . 16 . 8 . 9 + + +Make Host=0 3 + +Add 1 4 + + +172 . 16 . 0 . 0 +1 +172 . 16 . 0 . 1 + + + +Make Host=255 5 + +Subtract 1 6 + + +172 . 16 . 255 . 255 -1 +172 . 16 . 255 . 254 + + +Figure 12-5 Example Deriving the Network ID and Other Values from 172.16.8.9 + +Figure 12-5 shows the identification of the class as Class B (Step 1) and the number of net-work/host octets as 2 and 2, respectively. So, to find the network ID at Step 3, the figure copies only the first two octets, setting the last two (host) octets to 0. Similarly, Step 5 shows the same action, but with the last two (host) octets being set to 255. + +Unusual Network IDs and Network Broadcast Addresses +Some of the more unusual numbers in and around the range of Class A, B, and C network numbers can cause some confusion. This section lists some examples of numbers that make many people make the wrong assumptions about the meaning of the number. + +For Class A, the first odd fact is that the range of values in the first octet omits the numbers 0 and 127. As it turns out, what would be Class A network 0.0.0.0 was originally reserved +for some broadcasting requirements, so all addresses that begin with 0 in the first octet are reserved. What would be Class A network 127.0.0.0 is still reserved because of a special +address used in software testing, called the loopback address (127.0.0.1). 12 For Class B (and C), some of the network numbers can look odd, particularly if you fall into +a habit of thinking that 0s at the end means the number is a network ID, and 255s at the end means it’s a network broadcast address. First, Class B network numbers range from 128.0.0.0 to 191.255.0.0, for a total of 214 networks. However, even the very first (lowest number) Class B network number (128.0.0.0) looks a little like a Class A network number because it ends with three 0s. However, the first octet is 128, making it a Class B network with a two-octet network part (128.0). + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +296 CCNA 200-301 Official Cert Guide, Volume 1 + +For another Class B example, the high end of the Class B range also might look strange at first glance (191.255.0.0), but this is indeed the numerically highest of the valid Class B net-work numbers. This network’s broadcast address, 191.255.255.255, might look a little like a Class A broadcast address because of the three 255s at the end, but it is indeed the broad-cast address of a Class B network. + +Similarly to Class B networks, some of the valid Class C network numbers do look strange. For example, Class C network 192.0.0.0 looks a little like a Class A network because of the last three octets being 0, but because it is a Class C network, it consists of all addresses that begin with three octets equal to 192.0.0. Similarly, 223.255.255.0, another valid Class C net-work, consists of all addresses that begin with 223.255.255. + +Practice with Classful Networks +As with all areas of IP addressing and subnetting, you need to practice to be ready for the CCNA exam. You should practice some while reading this chapter to make sure that you understand the processes. At that point, you can use your notes and this book as a reference, with a goal of understanding the process. After that, keep practicing this and all the other subnetting processes. Before you take the exam, you should be able to always get the right answer, and with speed. Table 12-4 summarizes the key concepts and suggestions for this two-phase approach. + +Table 12-4 Keep-Reading and Take-Exam Goals for This Chapter’s Topics + + +Focus on… + +Tools Allowed + +Goal: Accuracy + +Goal: Speed + +After Reading This Chapter Learning how +All + +90% correct + +Any speed + +Before Taking the Exam Being correct and fast +Your brain and a notepad + +100% correct + +10 seconds + + + +Practice Deriving Key Facts Based on an IP Address +Practice finding the various facts that can be derived from an IP address, as discussed throughout this chapter. To do so, complete Table 12-5. + +Table 12-5 Practice Problems: Find the Network ID and Network Broadcast + +IP Address + +1 1.1.1.1 + +2 128.1.6.5 + +3 200.1.2.3 + +4 192.192.1.1 + +5 126.5.4.3 + +Class Network Host Network ID Octets Octets + +Network Broadcast Address + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 12: Analyzing Classful IPv4 Networks 297 + + +IP Address + +6 200.1.9.8 + +7 192.0.0.1 + +Class Network Host Network ID Octets Octets + +Network Broadcast Address + + +8 191.255.1.47 + +9 223.223.0.1 + + +The answers are listed in the section “Answers to Earlier Practice Problems,” later in this chapter. + +Practice Remembering the Details of Address Classes +Tables 12-2 and 12-3, shown earlier in this chapter, summarized some key information about IPv4 address classes. Tables 12-6 and 12-7 show sparse versions of these same tables. To practice recalling those key facts, particularly the range of values in the first octet that iden-tifies the address class, complete these tables. Then, refer to Tables 12-2 and 12-3 to check your answers. Repeat this process until you can recall all the information in the tables. + +Table 12-6 Sparse Study Table Version of Table 12-2 Class First Octet Values Purpose +A + +B + +C + +D + +E + + +Table 12-7 Sparse Study Table Version of Table 12-3 +Class A Class B Class C +First octet range + +Valid network numbers + +Total networks + +Hosts per network +Octets (bits) in network part 12 + +Octets (bits) in host part + +Default mask + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +298 CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 12-8 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 12-8 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Practice analyzing classful IPv4 networks + +Resource Used Book, website +Book, website + +Book, PTP + +Website + +Website, Appendix D + + + +Review All the Key Topics + + +Table 12-9 +Key Topic Elements +Table 12-2 + +Table 12-3 + +List + +Figure 12-3 + +Paragraph + +List + +Key Topics for Chapter 12 +Description Page Number +Address classes 290 + +Key facts about Class A, B, and C networks 290 + +Comparisons of network and host parts of addresses in the same 292 classful network +Default masks 293 + +Function to calculate the number of hosts per network 294 + +Steps to find information about a classful network 294 + + + +Key Terms You Should Know +network, classful IP network, network number, network ID, network address, network broad-cast address, network part, host part, default mask + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 12: Analyzing Classful IPv4 Networks 299 + +Additional Practice for This Chapter’s Processes +For additional practice with analyzing classful networks, you may do a set of practice prob-lems using your choice of tools: + +Application: Use the Analyzing Classful IPv4 Networks application on the companion website. +PDF: Alternatively, practice the same problems using companion website Appendix D, “Practice for Chapter 12: Analyzing Classful IPv4 Networks.” + +Answers to Earlier Practice Problems +Table 12-5, shown earlier, listed several practice problems. Table 12-10 lists the answers. + +Table 12-10 Practice Problems: Find the Network ID and Network Broadcast + +IP Address Class + +1 1.1.1.1 A + +2 128.1.6.5 B + +3 200.1.2.3 C + +4 192.192.1.1 C + +5 126.5.4.3 A + +6 200.1.9.8 C + +7 192.0.0.1 C + +8 191.255.1.47 B + +9 223.223.0.1 C + +Network Octets +1 + +2 + +3 + +3 + +1 + +3 + +3 + +2 + +3 + +Host Network ID Octets +3 1.0.0.0 + +2 128.1.0.0 + +1 200.1.2.0 + +1 192.192.1.0 + +3 126.0.0.0 + +1 200.1.9.0 + +1 192.0.0.0 + +2 191.255.0.0 + +1 223.223.0.0 + +Network Broadcast + +1.255.255.255 + +128.1.255.255 + +200.1.2.255 + +192.192.1.255 + +126.255.255.255 + +200.1.9.255 + +192.0.0.255 + +191.255.255.255 + +223.223.0.255 + + + +The class, number of network octets, and number of host octets all require you to look at the first octet of the IP address to determine the class. If a value is between 1 and 126, inclu-sive, the address is a Class A address, with one network and three host octets. If a value is between 128 and 191 inclusive, the address is a Class B address, with two network and two host octets. If a value is between 192 and 223, inclusive, it is a Class C address, with three network octets and one host octet. + +The last two columns can be found based on Table 12-3, specifically the number of network and host octets along with the IP address. To find the network ID, copy the IP address, but +change the host octets to 0. Similarly, to find the network broadcast address, copy the IP 12 address, but change the host octets to 255. +The last three problems can be confusing and were included on purpose so that you could see an example of these unusual cases, as follows. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +300 CCNA 200-301 Official Cert Guide, Volume 1 + +Answers to Practice Problem 7 (from Table 12-5) +Consider IP address 192.0.0.1. First, 192 is on the lower edge of the first octet range for Class C; as such, this address has three network and one host octet. To find the network ID, copy the address, but change the single host octet (the fourth octet) to 0, for a network ID of 192.0.0.0. It looks strange, but it is indeed the network ID. + +The network broadcast address choice for problem 7 can also look strange. To find the broadcast address, copy the IP address (192.0.0.1), but change the last octet (the only host octet) to 255, for a broadcast address of 192.0.0.255. In particular, if you decide that the broadcast should be 192.255.255.255, you might have fallen into the trap of logic, like “Change all 0s in the network ID to 255s,” which is not the correct logic. Instead, change all host octets in the IP address (or network ID) to 255s. + +Answers to Practice Problem 8 (from Table 12-5) +The first octet of problem 8 (191.255.1.47) sits on the upper edge of the Class B range for the first octet (128–191). As such, to find the network ID, change the last two octets (host octets) to 0, for a network ID of 191.255.0.0. This value sometimes gives people problems because they are used to thinking that 255 somehow means the number is a broadcast address. + +The broadcast address, found by changing the two host octets to 255, means that the broad-cast address is 191.255.255.255. It looks more like a broadcast address for a Class A network, but it is actually the broadcast address for Class B network 191.255.0.0. + +Answers to Practice Problem 9 (from Table 12-5) +Problem 9, with IP address 223.223.0.1, is near the high end of the Class C range. As a result, only the last (host) octet is changed to 0 to form the network ID 223.223.0.0. It looks a little like a Class B network number at first glance because it ends in two octets of 0. However, it is indeed a Class C network ID (based on the value in the first octet). + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 13 + + +Analyzing Subnet Masks This chapter covers the following exam topics: +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +The subnet mask used in one or many subnets in an IP internetwork says a lot about the intent of the subnet design. First, the mask divides addresses into two parts: prefix and host, with the host part defining the size of the subnet. Then, the class (A, B, or C) further divides the structure of addresses in a subnet, breaking the prefix part into the network and subnet parts. The subnet part defines the number of subnets that could exist inside one classful IP network, assuming that one mask is used throughout the classful network. + +The subnet mask holds the key to understanding several important subnetting design points. However, to analyze a subnet mask, you first need some basic math skills with masks. The math converts masks between the three different formats used to represent a mask: + +■ Binary +■ Dotted-decimal notation (DDN) +■ Prefix (also called classless interdomain routing [CIDR]) + +This chapter has two major sections. The first focuses on the mask formats and the math used to convert between the three formats. The second section explains how to take an IP address and its subnet mask and analyze those values. In particular, it shows how to deter-mine the three-part format of the IPv4 address and describes the facts about the subnetting design that are implied by the mask. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 13-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Subnet Mask Conversion +Defining the Format of IPv4 Addresses + +Questions 1–3 +4–7 + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Which of the following answers lists the prefix (CIDR) format equivalent of 255.255.254.0? +a. /19 b. /20 c. /23 d. /24 e. /25 +2. Which of the following answers lists the prefix (CIDR) format equivalent of 255.255.255.240? +a. /26 b. /28 c. /27 d. /30 e. /29 +3. Which of the following answers lists the dotted-decimal notation (DDN) equivalent of /30? +a. 255.255.255.192 b. 255.255.255.252 c. 255.255.255.240 d. 255.255.254.0 +e. 255.255.255.0 + +4. Working at the help desk, you receive a call and learn a user’s PC IP address and mask (10.55.66.77, mask 255.255.255.0). When thinking about this using classful logic, you determine the number of network (N), subnet (S), and host (H) bits. Which of the fol-lowing is true in this case? +a. N=12 b. S=12 c. H=8 d. S=8 e. N=24 + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +304 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Working at the help desk, you receive a call and learn a user’s PC IP address and mask (192.168.9.1/27). When thinking about this using classful logic, you determine the number of network (N), subnet (S), and host (H) bits. Which of the following is true in this case? +a. N=24 b. S=24 c. H=8 d. H=7 +6. Which of the following statements is true about classless IP addressing concepts? a. Uses a 128-bit IP address +b. Applies only for Class A and B networks +c. Separates IP addresses into network, subnet, and host parts d. Ignores Class A, B, and C network rules +7. Which of the following masks, when used as the only mask within a Class B network, would supply enough subnet bits to support 100 subnets? (Choose two.) + +a. /24 +b. 255.255.255.252 c. /20 +d. 255.255.252.0 + + +Foundation Topics + +Subnet Mask Conversion +This section describes how to convert between different formats for the subnet mask. You can then use these processes when you practice. If you already know how to convert from one format to the other, go ahead and move to the section “Practice Converting Subnet Masks,” later in this chapter. + +Three Mask Formats +Subnet masks can be written as 32-bit binary numbers, but not just any binary number. In particular, the binary subnet mask must follow these rules: + +■ The value must not interleave 1s and 0s. ■ If 1s exist, they are on the left. +■ If 0s exist, they are on the right. + +For example, the following values would be illegal. The first is illegal because the value inter-leaves 0s and 1s, and the second is illegal because it lists 0s on the left and 1s on the right: + +10101010 01010101 11110000 00001111 00000000 00000000 00000000 11111111 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 13: Analyzing Subnet Masks 305 + +The following two binary values meet the requirements, in that they have all 1s on the left, followed by all 0s, with no interleaving of 1s and 0s: + +11111111 00000000 00000000 00000000 11111111 11111111 11111111 00000000 + +Two alternative subnet mask formats exist so that we humans do not have to work with +32-bit binary numbers. One format, dotted-decimal notation (DDN), converts each set of 8 bits into the decimal equivalent. For example, the two previous binary masks would convert to the following DDN subnet masks because binary 11111111 converts to decimal 255, and binary 00000000 converts to decimal 0: + +255.0.0.0 255.255.255.0 +Although the DDN format has been around since the beginning of IPv4 addressing, the third mask format was added later, in the early 1990s: the prefix format. This format takes advan-tage of the rule that the subnet mask starts with some number of 1s, and then the rest of the digits are 0s. Prefix format lists a slash (/) followed by the number of binary 1s in the binary mask. Using the same two examples as earlier in this section, the prefix format equivalent masks are as follows: + +/8 /24 +Note that although the terms prefix or prefix mask can be used, the terms CIDR mask or slash mask can also be used. This newer prefix style mask was created around the same time as the classless interdomain routing (CIDR) specification back in the early 1990s, and the acronym CIDR grew to be used for anything related to CIDR, including prefix-style masks. In addition, the term slash mask is sometimes used because the value includes a slash +mark (/). + +You need to get comfortable working with masks in different formats. The rest of this sec-tion examines how to convert between the three formats. + +Converting Between Binary and Prefix Masks +Converting between binary and prefix masks should be relatively intuitive after you know that the prefix value is simply the number of binary 1s in the binary mask. For the sake of completeness, the processes to convert in each direction are + +Binary to prefix: Count the number of binary 1s in the binary mask, and write the total, in decimal, after a /. +Prefix to binary: Write P binary 1s, where P is the prefix value, followed by as many bina-ry 0s as required to create a 32-bit number. +Tables 13-2 and 13-3 show some examples. 13 + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +306 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 13-2 Example Conversions: Binary to Prefix + +Binary Mask + +11111111 11111111 11000000 00000000 + +11111111 11111111 11111111 11110000 + +11111111 11111000 00000000 00000000 + +Logic +Count 8 + 8 + 2 = 18 binary 1s + +Count 8 + 8 + 8 + 4 = 28 binary 1s + +Count 8 + 5 = 13 binary 1s + +Prefix Mask /18 +/28 + +/13 + + + +Table 13-3 Example Conversions: Prefix to Binary + +Prefix Mask /18 +/28 + +/13 + +Logic +Write 18 1s, then 14 0s, total 32 + +Write 28 1s, then 4 0s, total 32 + +Write 13 1s, then 19 0s, total 32 + +Binary Mask + +11111111 11111111 11000000 00000000 + +11111111 11111111 11111111 11110000 + +11111111 11111000 00000000 00000000 + + + +Converting Between Binary and DDN Masks +By definition, a dotted-decimal number (DDN) used with IPv4 addressing contains four dec-imal numbers, separated by dots. Each decimal number represents 8 bits. So, a single DDN shows four decimal numbers that together represent some 32-bit binary number. + +Conversion from a DDN mask to the binary equivalent is relatively simple to describe but can be laborious to perform. First, to do the conversion, the process is as follows: + +For each octet, perform a decimal-to-binary conversion. +However, depending on your comfort level with doing decimal-to-binary conversions, that process can be difficult or time-consuming. If you want to think about masks in binary for the exam, consider picking one of the following methods to do the conversion and practicing until you can do it quickly and accurately: + +■ Do the decimal-binary conversions, but practice your decimal-binary conversions to become faster. If you choose this path, consider the Cisco Binary Game, which you can find by searching its name at the Cisco Learning Network (CLN) (http:// learningnetwork.cisco.com). +■ Use the decimal-binary conversion chart in Appendix A, “Numeric Reference Tables.” This lets you find the answer more quickly now, but you cannot use the chart on exam day. +■ Memorize the nine possible decimal values that can be in a decimal mask, and practice using a reference table with those values. + +The third method, which is the method recommended in this book, takes advantage of the fact that any and every DDN mask octet must be one of only nine values. Why? Well, +remember how a binary mask cannot interleave 1s and 0s, and the 0s must be on the right? It turns out that only nine different 8-bit binary numbers conform to these rules. Table 13-4 lists the values, along with other relevant information. + +Answers to the “Do I Know This Already?” quiz: 1 C 2 B 3 B 4 C 5 A 6 D 7 A, B + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 13: Analyzing Subnet Masks 307 + +Table 13-4 Nine Possible Values in One Octet of a Subnet Mask + +Binary Mask Octet +00000000 + +10000000 + +11000000 + +11100000 + +11110000 + +11111000 + +11111100 + +11111110 + +11111111 + +Decimal Equivalent +0 + +128 + +192 + +224 + +240 + +248 + +252 + +254 + +255 + +Number of Binary 1s +0 + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 + + + +Many subnetting processes can be done with or without binary math. Some of those pro-cesses—mask conversion included—use the information in Table 13-4. You should plan to memorize the information in the table. I recommend making a copy of the table to keep handy while you practice. (You will likely memorize the contents of this table simply by practicing the conversion process enough to get both good and fast at the conversion.) + +Using the table, the conversion processes in each direction with binary and decimal masks are as follows: + +Binary to decimal: Organize the bits into four sets of eight. For each octet, find the binary value in the table and write down the corresponding decimal value. +Decimal to binary: For each octet, find the decimal value in the table and write down the corresponding 8-bit binary value. +Tables 13-5 and 13-6 show some examples. + +Table 13-5 Conversion Example: Binary to Decimal + +Binary Mask + +11111111 11111111 11000000 00000000 + + + + +11111111 11111111 11111111 11110000 + + +11111111 11111000 00000000 00000000 + +Logic +11111111maps to 255 + +11000000maps to 192 + +00000000maps to 0 + +11111111maps to 255 + +11110000maps to 240 + +11111111maps to 255 + +11111000maps to 248 + +00000000maps to 0 + +Decimal Mask 255.255.192.0 + + + +255.255.255.240 + + +255.248.0.0 13 + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +308 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 13-6 Conversion Examples: Decimal to Binary + +Decimal Mask 255.255.192.0 + + + +255.255.255.240 + + +255.248.0.0 + +Logic +255 maps to 11111111 + +192 maps to 11000000 + +0 maps to 00000000 + +255 maps to 11111111 + +240 maps to 11110000 + +255 maps to 11111111 + +248 maps to 11111000 + +0 maps to 00000000 + +Binary Mask + +11111111 11111111 11000000 00000000 + + + + +11111111 11111111 11111111 11110000 + + +11111111 11111000 00000000 00000000 + + + +Converting Between Prefix and DDN Masks +When you are learning, the best way to convert between the prefix and decimal formats is to first convert to binary. For example, to move from decimal to prefix, first convert decimal to binary and then from binary to prefix. + +For the exams, set a goal to master these conversions doing the math in your head. While learning, you will likely want to use paper. To train yourself to do all this without writing it down, instead of writing each octet of binary, just write the number of binary 1s in that octet. + +Figure 13-1 shows an example with a prefix-to-decimal conversion. The left side shows the conversion to binary as an interim step. For comparison, the right side shows the binary interim step in shorthand that just lists the number of binary 1s in each octet of the binary mask. + +/18 /18 + +11111111 11111111 11000000 00000000 8 + 8 + 2 + 0 + +255 . 255 . 192 . 0 255 . 255 . 192 . 0 + +Figure 13-1 Conversion from Prefix to Decimal: Full Binary Versus Shorthand + +Similarly, when converting from decimal to prefix, mentally convert to binary along the way, and as you improve, just think of the binary as the number of 1s in each octet. Figure 13-2 shows an example of such a conversion. + +255 . 248 . 0 . 0 255 . 248 . 0 . 0 + +11111111 11111000 00000000 00000000 8 + 5 + 0 + 0 + +/13 /13 + +Figure 13-2 Conversion from Decimal to Prefix: Full Binary Versus Shorthand + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 13: Analyzing Subnet Masks 309 + +Note that Appendix A has a table that lists all 33 legal subnet masks, with all three formats shown. + +Practice Converting Subnet Masks +Before moving to the second half of this chapter, and thinking about what these subnet masks mean, first do some practice. Practice the processes discussed in this chapter until you get the right answer most of the time. Later, before taking the exam, practice more until you master the topics in this chapter and can move pretty fast, as outlined in the right col-umn of Table 13-7. + +Table 13-7 Keep-Reading and Take-Exam Goals for This Chapter’s Topics + + +Focus On… + +Tools Allowed + +Goal: Accuracy + +Goal: Speed + +Before Moving to the Next Section Learning how +All + +90% correct + +Any speed + +Before Taking the Exam Being correct and fast +Your brain and a notepad + +100% correct + +10 seconds + + + +Table 13-8 lists eight practice problems. The table has three columns, one for each mask for-mat. Each row lists one mask, in one format. Your job is to find the mask’s value in the other two formats for each row. Table 13-12, located in the section “Answers to Earlier Practice Problems,” later in this chapter, lists the answers. + +Table 13-8 Practice Problems: Find the Mask Values in the Other Two Formats + +Prefix Binary Mask +11111111 11111111 11000000 00000000 + + +/25 + +/16 + + +11111111 11111111 11111100 00000000 + + +/27 + +Decimal + + +255.255.255.252 + + + + +255.0.0.0 + + +255.254.0.0 + + + +Identifying Subnet Design Choices Using Masks +Subnet masks have many purposes. In fact, if ten experienced network engineers were inde- 13 pendently asked, “What is the purpose of a subnet mask?” the engineers would likely give a +variety of true answers. The subnet mask plays several roles. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +310 CCNA 200-301 Official Cert Guide, Volume 1 + +This chapter focuses on one particular use of a subnet mask: defining the prefix part of the IP addresses in a subnet. The prefix part must be the same value for all addresses in a subnet. In fact, a single subnet can be defined as all IPv4 addresses that have the same value in the prefix part of their IPv4 addresses. + +While the previous paragraph might sound a bit formal, the idea is relatively basic, as shown in Figure 13-3. The figure shows a network diagram, focusing on two subnets: a subnet of all addresses that begin with 172.16.2 and another subnet made of all addresses that begin with 172.16.3. In this example, the prefix—the part that has the same value in all the addresses in the subnet—is the first three octets. + +Subnet 172.16.2.0/24 + +172.16.2.101 +172.16.1.0/24 172.16.4.0/24 R2 172.16.2.102 + + + +R1 + + +172.16.5.0/24 + +Subnet 172.16.3.0/24 + +172.16.3.101 + +R3 172.16.3.102 + + +Figure 13-3 Simple Subnet Design, with Mask /24 + +While people can sit around a conference table and talk about how a prefix is three octets long, computers communicate that same concept using a subnet mask. In this case, the sub-nets use a subnet mask of /24, which means that the prefix part of the addresses is 24 bits (3 octets) long. + +This section explains more about how to use a subnet mask to understand this concept of a prefix part of an IPv4 address, along with these other uses for a subnet mask. Note that this section discusses the first five items in the list. + +■ Defines the size of the prefix (combined network and subnet) part of the addresses in a subnet +■ Defines the size of the host part of the addresses in the subnet ■ Can be used to calculate the number of hosts in the subnet +■ Provides a means for the network designer to communicate the design details—the num-ber of subnet and host bits—to the devices in the network +■ Under certain assumptions, can be used to calculate the number of subnets in the entire classful network +■ Can be used in binary calculations of both the subnet ID and the subnet broadcast address + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 13: Analyzing Subnet Masks 311 + +Masks Divide the Subnet’s Addresses into Two Parts +The subnet mask subdivides the IP addresses in a subnet into two parts: the prefix, or sub-net part, and the host part. + +The prefix part identifies the addresses that reside in the same subnet because all IP address-es in the same subnet have the same value in the prefix part of their addresses. The idea is much like the postal code (ZIP codes in the United States) in mailing addresses. All mailing addresses in the same town have the same postal code. Likewise, all IP addresses in the same subnet have identical values in the prefix part of their addresses. + +The host part of an address identifies the host uniquely inside the subnet. If you compare any two IP addresses in the same subnet, their host parts will differ, even though the prefix parts of their addresses have the same value. To summarize these key comparisons: + +Prefix (subnet) part: Equal in all addresses in the same subnet. Host part: Different in all addresses in the same subnet. +For example, imagine a subnet that, in concept, includes all addresses whose first three octets are 10.1.1. So, the following list shows several addresses in this subnet: + +10.1.1.1 10.1.1.2 10.1.1.3 +In this list, the prefix or subnet part (the first three octets of 10.1.1) are equal. The host part (the last octet [in bold]) is different. So, the prefix or subnet part of the address identifies the group, and the host part identifies the specific member of the group. + +The subnet mask defines the dividing line between the prefix and the host part. To do so, the mask creates a conceptual line between the binary 1s in the binary mask and the binary 0s in the mask. In short, if a mask has P binary 1s, the prefix part is P bits long and the rest of the bits are host bits. Figure 13-4 shows the general concept. + + +Mask 1s + +Prefix (P) + +32 Bits + +Mask 0s + +Host (H) + + +Figure 13-4 Prefix (Subnet) and Host Parts Defined by Mask 1s and 0s + +The next figure, Figure 13-5, shows a specific example using mask 255.255.255.0. Mask 255.255.255.0 (/24) has 24 binary 1s, for a prefix length of 24 bits. + + +11111111 11111111 24 1s +P = 24 + +11111111 00000000 8 0s +H = 8 13 + +Figure 13-5 Mask 255.255.255.0: P=24, H=8 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +312 CCNA 200-301 Official Cert Guide, Volume 1 + +Masks and Class Divide Addresses into Three Parts +In addition to the two-part view of IPv4 addresses, you can also think about IPv4 addresses as having three parts. To do so, just apply Class A, B, and C rules to the address format to define the network part at the beginning of the address. This added logic divides the prefix into two parts: the network part and the subnet part. The class defines the length of the network part, with the subnet part simply being the rest of the prefix. Figure 13-6 shows the idea. + +Mask 1s Mask 0s + +Network Subnet Host + + +Size: 8, 16, 24 (A, B, C) + +Figure 13-6 Class Concepts Applied to Create Three Parts + +The combined network and subnet parts act like the prefix because all addresses in the same subnet must have identical values in the network and subnet parts. The size of the host part remains unchanged, whether viewing the addresses as having two parts or three parts. + +To be complete, Figure 13-7 shows the same example as in the previous section, with the subnet of “all addresses that begin with 10.1.1.” In that example, the subnet uses mask 255.255.255.0, and the addresses are all in Class A network 10.0.0.0. The class defines 8 net-work bits, and the mask defines 24 prefix bits, meaning that 24 – 8 = 16 subnet bits exist. The host part remains as 8 bits per the mask. + + +11111111 11111111 +24 1s + +11111111 00000000 +8 0s + + +N = 8 S = (24 - 8) = 16 H = 8 +Based on Class + +Figure 13-7 Subnet 10.1.1.0, Mask 255.255.255.0: N=8, S=16, H=8 + +Classless and Classful Addressing +The terms classless addressing and classful addressing refer to the two different ways to think about IPv4 addresses as described so far in this chapter. Classful addressing means that you think about Class A, B, and C rules, so the prefix is separated into the network and sub-net parts, as shown in Figures 13-6 and 13-7. Classless addressing means that you ignore the Class A, B, and C rules and treat the prefix part as one part, as shown in Figures 13-4 and +13-5. The following more formal definitions are listed for reference and study: + +Classless addressing: The concept that an IPv4 address has two parts—the prefix part plus the host part—as defined by the mask, with no consideration of the class (A, B, or C). +Classful addressing: The concept that an IPv4 address has three parts—network, subnet, and host—as defined by the mask and Class A, B, and C rules. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 13: Analyzing Subnet Masks 313 + + +NOTE Unfortunately, the networking world uses the terms classless and classful in a couple of different ways. In addition to the classless and classful addressing described here, each routing protocol can be categorized as either a classless routing protocol or a classful routing protocol. In another use, the terms classless routing and classful routing refer to some details of how Cisco routers forward (route) packets using the default route in some cases. As a result, these terms can be easily confused and misused. So, when you see the words classless and classful, be careful to note the context: addressing, routing, or routing protocols. + + +Calculations Based on the IPv4 Address Format +After you know how to break an address down using both classless and classful addressing rules, you can easily calculate a couple of important facts using some basic math formulas. + +First, for any subnet, after you know the number of host bits, you can calculate the number of host IP addresses in the subnet. Next, if you know the number of subnet bits (using class-ful addressing concepts) and you know that only one subnet mask is used throughout the network, you can also calculate the number of subnets in the network. The formulas just require that you know the powers of 2: +Hosts in the subnet: 2H – 2, where H is the number of host bits. +Subnets in the network: 2S, where S is the number of subnet bits. Only use this formula if only one mask is used throughout the network. + +NOTE The section “Choose the Mask” in Chapter 11, “Perspectives on IPv4 Subnetting,” details many concepts related to masks, including comments about this assumption of one mask throughout a single Class A, B, or C network. + +The sizes of the parts of IPv4 addresses can also be calculated. The math is basic, but the concepts are important. Keeping in mind that IPv4 addresses are 32 bits long, the two parts with classless addressing must add up to 32 (P + H = 32), and with classful addressing, the three parts must add up to 32 (N + S + H = 32). Figure 13-8 shows the relationships. + +32 /P +N S H + +Class: A: N = 8 +B: N = 16 C: N = 24 + +Figure 13-8 Relationship Between /P, N, S, and H 13 You often begin with an IP address and mask, both when answering questions on the CCNA +exam and when examining problems that occur in real networks. Based on the information in this chapter and earlier chapters, you should be able to find all the information in Figure 13-8 and then calculate the number of hosts/subnet and the number of subnets in the network. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +314 CCNA 200-301 Official Cert Guide, Volume 1 + +For reference, the following process spells out the steps: + +Step 1. Convert the mask to prefix format (/P) as needed. (See the earlier section “Practice Converting Subnet Masks” for review.) + +Step 2. Determine N based on the class. (See Chapter 12, “Analyzing Classful IPv4 Networks,” for review.) + +Step 3. Calculate S = P – N. + +Step 4. Calculate H = 32 – P. + +Step 5. Calculate hosts/subnet: 2H – 2. + +Step 6. Calculate number of subnets: 2S. + + +For example, consider the case of IP address 8.1.4.5 with mask 255.255.0.0 by following this + +process: + +Step 1. + +Step 2. + +Step 3. + +Step 4. + +Step 5. + +Step 6. + + + +255.255.0.0 = /16, so P=16. + +8.1.4.5 is in the range 1–126 in the first octet, so it is Class A; so N=8. + +S = P – N = 16 – 8 = 8. + +H = 32 – P = 32 – 16 = 16. + +216 – 2 = 65,534 hosts/subnet. + +28 = 256 subnets. + + + +Figure 13-9 shows a visual analysis of the same problem. + +11111111 11111111 00000000 00000000 16 1s 16 0s +N = 8 S = 16 - 8 H = 16 + +Figure 13-9 Visual Representation of Problem: 8.1.4.5, 255.255.0.0 + +For another example, consider address 200.1.1.1, mask 255.255.255.252 by following this + +process: + +Step 1. + +Step 2. + +Step 3. + +Step 4. + +Step 5. + +Step 6. + + + +255.255.255.252 = /30, so P=30. + +200.1.1.1 is in the range 192–223 in the first octet, so it is Class C; so N=24. + +S = P – N = 30 – 24 = 6. + +H = 32 – P = 32 – 30 = 2. + +22 – 2 = 2 hosts/subnet. + +26 = 64 subnets. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 13: Analyzing Subnet Masks 315 + +This example uses a popular mask for serial links because serial links only require two host addresses, and the mask supports only two host addresses. + +Practice Analyzing Subnet Masks +As with the other subnetting math in this book, using a two-phase approach may help. Take time now to practice until you feel as though you understand the process. Then, before the exam, make sure you master the math. Table 13-9 summarizes the key concepts and sugges-tions for this two-phase approach. + +Table 13-9 Keep-Reading and Take-Exam Goals for This Chapter’s Topics + + +Focus On… + +Tools Allowed + +Goal: Accuracy + +Goal: Speed + +Before Moving to the Next Chapter Learning how +All + +90% correct + +Any speed + +Before Taking the Exam Being correct and fast +Your brain and a notepad + +100% correct + +15 seconds + + + +On a piece of scratch paper, answer the following questions. In each case: + +■ Determine the structure of the addresses in each subnet based on the class and mask, using classful IP addressing concepts. In other words, find the size of the network, sub-net, and host parts of the addresses. +■ Calculate the number of hosts in the subnet. +■ Calculate the number of subnets in the network, assuming that the same mask is used throughout. + +1. 8.1.4.5, 255.255.254.0 +2. 130.4.102.1, 255.255.255.0 3. 199.1.1.100, 255.255.255.0 4. 130.4.102.1, 255.255.252.0 5. 199.1.1.100, 255.255.255.224 +The answers are listed in the section “Answers to Earlier Practice Problems,” later in this chapter. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 13-10 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second +column. + + + + + +13 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +316 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 13-10 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Practice analyzing subnet masks + +Review Date(s) Resource Used Book, website +Book, website + +Book, PTP + +Website + +Website, Appendix E + + + +Review All the Key Topics + + +Table 13-11 +Key Topic Element +List + +List + +Table 13-4 + +List + +List + +List + +Figure 13-4 + +Figure 13-6 + +List + +List + +Key Topics for Chapter 13 +Description Page Number +Rules for binary subnet mask values 304 + +Rules to convert between binary and prefix masks 305 + +Nine possible values in a decimal subnet mask 307 + +Rules to convert between binary and DDN masks 307 + +Some functions of a subnet mask 310 + +Comparisons of IP addresses in the same subnet 311 + +Two-part classless view of an IP address 311 + +Three-part classful view of an IP address 312 + +Definitions of classful addressing and classless addressing 312 + +Formal steps to analyze masks and calculate values 314 + + + +Key Terms You Should Know +binary mask, dotted-decimal notation (DDN), decimal mask, prefix mask, CIDR mask, class-ful addressing, classless addressing + +Additional Practice for This Chapter’s Processes +You can do more practice with the processes in this chapter with a pair of practice sets. One focuses on interpreting existing masks, while the other gives you practice with converting between mask formats. You may do each practice set using the following tools: + +Application: Use the “Analyzing Subnet Masks” and “Converting Masks” applications on the companion website, listed under the Chapter Review for this chapter. +PDF: Alternatively, practice the same problems found in both these apps using companion website Appendix E, “Practice for Chapter 13: Analyzing Subnet Masks.” + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 13: Analyzing Subnet Masks 317 + +Answers to Earlier Practice Problems +Table 13-8, shown earlier, listed several practice problems for converting subnet masks; Table 13-12 lists the answers. + +Table 13-12 Answers to Problems in Table 13-8 + +Prefix Binary Mask +/18 11111111 11111111 11000000 00000000 + +/30 11111111 11111111 11111111 11111100 + +/25 11111111 11111111 11111111 10000000 + +/16 11111111 11111111 00000000 00000000 + +/8 11111111 00000000 00000000 00000000 + +/22 11111111 11111111 11111100 00000000 + +/15 11111111 11111110 00000000 00000000 + +/27 11111111 11111111 11111111 11100000 + +Decimal 255.255.192.0 +255.255.255.252 + +255.255.255.128 + +255.255.0.0 + +255.0.0.0 + +255.255.252.0 + +255.254.0.0 + +255.255.255.224 + + + +Table 13-13 lists the answers to the practice problems from the earlier section “Practice Analyzing Subnet Masks.” + +Table 13-13 Answers to Problems from Earlier in the Chapter + +Problem /P 1 8.1.4.5 255.255.254.0 23 +2 130.4.102.1 255.255.255.0 24 + +3 199.1.1.100 255.255.255.0 24 + +4 130.4.102.1 255.255.252.0 22 + +5 199.1.1.100 255.255.255.224 27 + +Class N S H 2S 2H – 2 A 8 15 9 32,768 510 +B 16 8 8 256 254 + +C 24 0 8 N/A 254 + +B 16 6 10 64 1022 + +C 24 3 5 8 30 + + + +The following list reviews the problems: + + +1. For 8.1.4.5, the first octet (8) is in the 1–126 range, so it is a Class A address, with 8 network bits. Mask 255.255.254.0 converts to /23, so P – N = 15, for 15 subnet bits. H can be found by subtracting /P (23) from 32, for 9 host bits. +2. 130.4.102.1 is in the 128–191 range in the first octet, making it a Class B address, with N = 16 bits. 255.255.255.0 converts to /24, so the number of subnet bits is 24 – 16 = 8. With 24 prefix bits, the number of host bits is 32 – 24 = 8. +3. The third problem purposely shows a case where the mask does not create a subnet part of the address. The address, 199.1.1.100, has a first octet between 192 and 223, making it a Class C address with 24 network bits. The prefix version of the mask is +/24, so the number of subnet bits is 24 – 24 = 0. The number of host bits is 32 minus + + + + + + + + +13 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +318 CCNA 200-301 Official Cert Guide, Volume 1 + +the prefix length (24), for a total of 8 host bits. So in this case, the mask shows that the network engineer is using the default mask, which creates no subnet bits and no subnets. +4. With the same address as the second problem, 130.4.102.1 is a Class B address with N = 16 bits. This problem uses a different mask, 255.255.252.0, which converts to /22. This makes the number of subnet bits 22 – 16 = 6. With 22 prefix bits, the number of host bits is 32 – 22 = 10. +5. With the same address as the third problem, 199.1.1.100 is a Class C address with N = 24 bits. This problem uses a different mask, 255.255.255.224, which converts to /27. This makes the number of subnet bits 27 – 24 = 3. With 27 prefix bits, the number of host bits is 32 – 27 = 5. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 14 + + +Analyzing Existing Subnets This chapter covers the following exam topics: +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +Often, a networking task begins with the discovery of the IP address and mask used by some host. Then, to understand how the internetwork routes packets to that host, you must find key pieces of information about the subnet, specifically the following: + +■ Subnet ID +■ Subnet broadcast address +■ Subnet’s range of usable unicast IP addresses + +This chapter discusses the concepts and math to take a known IP address and mask, and then fully describe a subnet by finding the values in this list. These specific tasks might well be the most important IP skills in the entire IP addressing and subnetting topics in this book because these tasks might be the most commonly used tasks when operating and troubleshooting real networks. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. +Table 14-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Defining a Subnet +Analyzing Existing Subnets: Binary + +Analyzing Existing Subnets: Decimal + +Questions 1 +2 + +3–6 + + +1. When you think about an IP address using classful addressing rules, an address can have three parts: network, subnet, and host. If you examined all the addresses in one subnet, in binary, which of the following answers correctly states which of the three parts of the addresses will be equal among all addresses? (Choose the best answer.) +a. Network part only b. Subnet part only c. Host part only +d. Network and subnet parts e. Subnet and host parts + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +2. Which of the following statements are true regarding the binary subnet ID, subnet broadcast address, and host IP address values in any single subnet? (Choose two answers.) +a. The host part of the broadcast address is all binary 0s. b. The host part of the subnet ID is all binary 0s. +c. The host part of a usable IP address can have all binary 1s. +d. The host part of any usable IP address must not be all binary 0s. + +3. Which of the following is the resident subnet ID for IP address 10.7.99.133/24? a. 10.0.0.0 +b. 10.7.0.0 c. 10.7.99.0 +d. 10.7.99.128 +4. Which of the following is the resident subnet for IP address 192.168.44.97/30? a. 192.168.44.0 +b. 192.168.44.64 c. 192.168.44.96 d. 192.168.44.128 +5. Which of the following is the subnet broadcast address for the subnet in which IP address 172.31.77.201/27 resides? +a. 172.31.201.255 b. 172.31.255.255 c. 172.31.77.223 d. 172.31.77.207 +6. A fellow engineer tells you to configure the DHCP server to lease the last 100 usable IP addresses in subnet 10.1.4.0/23. Which of the following IP addresses could be leased as a result of your new configuration? +a. 10.1.4.156 b. 10.1.4.254 c. 10.1.5.200 d. 10.1.7.200 +e. 10.1.255.200 + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +322 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Defining a Subnet +An IP subnet is a subset of a classful network, created by choice of some network engineer. However, that engineer cannot pick just any arbitrary subset of addresses; instead, the engi-neer must follow certain rules, such as the following: + +■ The subnet contains a set of consecutive numbers. +■ The subnet holds 2H numbers, where H is the number of host bits defined by the subnet mask. +■ Two special numbers in the range cannot be used as IP addresses: +■ The first (lowest) number acts as an identifier for the subnet (subnet ID). ■ The last (highest) number acts as a subnet broadcast address. +■ The remaining addresses, whose values sit between the subnet ID and subnet broadcast address, are used as unicast IP addresses. + +This section reviews and expands the basic concepts of the subnet ID, subnet broadcast address, and range of addresses in a subnet. + +An Example with Network 172.16.0.0 and Four Subnets +Imagine that you work at the customer support center, where you receive all initial calls from users who have problems with their computer. You coach the user through finding her IP address and mask: 172.16.150.41, mask 255.255.192.0. One of the first and most common tasks you will do based on that information is to find the subnet ID of the subnet in which that address resides. (In fact, this subnet ID is sometimes called the resident subnet because the IP address exists in or resides in that subnet.) + +Before getting into the math, examine the mask (255.255.192.0) and classful network (172.16.0.0) for a moment. From the mask, based on what you learned in Chapter 13, “Analyzing Subnet Masks,” you can find the structure of the addresses in the subnet, includ-ing the number of host and subnet bits. That analysis tells you that two subnet bits exist, meaning that there should be four (22) subnets. Figure 14-1 shows the idea. + +/P = N + S = /18 + +N = 16 S = 2 H = 14 +Hosts = 214 - 2 + +Subnets = 22 + +Figure 14-1 Address Structure: Class B Network, /18 Mask + + + +Answers to the “Do I Know This Already?” quiz: 1 D 2 B, D 3 C 4 C 5 C 6 C + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 14: Analyzing Existing Subnets + + +NOTE This chapter, like the others in this part of the book, assumes that one mask is used throughout an entire classful network. + +323 + + + +14 + + +Because each subnet uses a single mask, all subnets of this single IP network must be the same size, because all subnets have the same structure. In this example, all four subnets will have the structure shown in the figure, so all four subnets will have 214 – 2 host addresses. + +Next, consider the big picture of what happens with this example subnet design: the one Class B network now has four subnets of equal size. Conceptually, if you represent the entire Class B network as a number line, each subnet consumes one-fourth of the number line, as shown in Figure 14-2. Each subnet has a subnet ID—the numerically lowest number in the subnet—so it sits on the left of the subnet. And each subnet has a subnet broadcast address—the numerically highest number in the subnet—so it sits on the right side of the subnet. + + +Subnet 1 Subnet 2 Subnet 3 Subnet 4 + + + + +172.16.150.41 + +Legend: +Network ID Subnet ID +Subnet Broadcast Address + +Figure 14-2 Network 172.16.0.0, Divided into Four Equal Subnets + +The rest of this chapter focuses on how to take one IP address and mask and discover the details about that one subnet in which the address resides. In other words, you see how to find the resident subnet of an IP address. Again, using IP address 172.16.150.41 and mask 255.255.192.0 as an example, Figure 14-3 shows the resident subnet, along with the subnet ID and subnet broadcast address that bracket the subnet. + +172.16.128.0 172.16.191.255 + +Subnet 1 Subnet 2 Subnet 4 + +Legend: 172.16.150.41 +Subnet ID +Subnet Broadcast Address + +Figure 14-3 Resident Subnet for 172.16.150.41, 255.255.192.0 + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +324 CCNA 200-301 Official Cert Guide, Volume 1 + +Subnet ID Concepts +A subnet ID is simply a number used to succinctly represent a subnet. When listed along with its matching subnet mask, the subnet ID identifies the subnet and can be used to derive the subnet broadcast address and range of addresses in the subnet. Rather than having to write down all these details about a subnet, you simply need to write down the subnet ID and mask, and you have enough information to fully describe the subnet. + +The subnet ID appears in many places, but it is seen most often in IP routing tables. For example, when an engineer configures a router with its IP address and mask, the router calcu-lates the subnet ID and puts a route into its routing table for that subnet. The router typically then advertises the subnet ID/mask combination to neighboring routers with some IP routing protocol. Eventually, all the routers in an enterprise learn about the subnet—again using the subnet ID and subnet mask combination—and display it in their routing tables. (You can dis-play the contents of a router’s IP routing table using the show ip route command.) + +Unfortunately, the terminology related to subnets can sometimes cause problems. First, the terms subnet ID, subnet number, and subnet address are synonyms. In addition, people sometimes simply say subnet when referring to both the idea of a subnet and the number that is used as the subnet ID. When talking about routing, people sometimes use the term prefix instead of subnet. The term prefix refers to the same idea as subnet; it just uses terminology from the classless addressing way to describe IP addresses, as discussed in Chapter 13’s section “Classless and Classful Addressing.” + +The biggest terminology confusion arises between the terms network and subnet. In the real world, people often use these terms synonymously, and that is perfectly reasonable in some cases. In other cases, the specific meaning of these terms, and their differences, matter to what is being discussed. + +For example, people often might say, “What is the network ID?” when they really want to know the subnet ID. In another case, they might want to know the Class A, B, or C net-work ID. So, when one engineer asks something like, “What’s the net ID for 172.16.150.41 slash 18?” use the context to figure out whether he wants the literal classful network ID (172.16.0.0, in this case) or the literal subnet ID (172.16.128.0, in this case). + +For the exams, be ready to notice when the terms subnet and network are used, and then use the context to figure out the specific meaning of the term in that case. + +Table 14-2 summarizes the key facts about the subnet ID, along with the possible synonyms, for easier review and study. + + +Table 14-2 +Definition + + +Summary of Subnet ID Key Facts +Number that represents the subnet + + + +Numeric Value + +Literal Synonyms + +Common-Use Synonyms + +Typically Seen In… + +First (smallest) number in the subnet + +Subnet number, subnet address, prefix, resident subnet + +Network, network ID, network number, network address + +Routing tables, documentation + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 14: Analyzing Existing Subnets 325 + +Subnet Broadcast Address +The subnet broadcast address has two main roles: to be used as a destination IP address for 14 the purpose of sending packets to all hosts in the subnet, and as a means to find the high end +of the range of addresses in a subnet. + +The original purpose for the subnet broadcast address was to give hosts a way to send one packet to all hosts in a subnet and to do so efficiently. For example, a host in subnet A could send a packet with a destination address of subnet B’s subnet broadcast address. The routers would forward this one packet just like a packet sent to a host in subnet B. After the packet arrives at the router connected to subnet B, that last router would then forward the packet +to all hosts in subnet B, typically by encapsulating the packet in a data-link layer broadcast frame. As a result, all hosts in host B’s subnet would receive a copy of the packet. + +The subnet broadcast address also helps you find the range of addresses in a subnet because the broadcast address is the last (highest) number in a subnet’s range of addresses. To find the low end of the range, calculate the subnet ID; to find the high end of the range, calculate the subnet broadcast address. + +Table 14-3 summarizes the key facts about the subnet broadcast address, along with the pos-sible synonyms, for easier review and study. + + +Table 14-3 +Definition + + +Summary of Subnet Broadcast Address Key Facts +A reserved number in each subnet that, when used as the destination address of a packet, causes the device to forward the packet to all hosts in that subnet + + + +Numeric Value + +Literal Synonyms + +Broader-Use Synonyms + +Typically Seen In… + +Last (highest) number in the subnet + +Directed broadcast address + +Network broadcast + +In calculations of the range of addresses in a subnet + + + +Range of Usable Addresses +The engineers implementing an IP internetwork need to know the range of unicast IP addresses in each subnet. Before you can plan which addresses to use as statically assigned IP addresses, which to configure to be leased by the DHCP server, and which to reserve for later use, you need to know the range of usable addresses. + +To find the range of usable IP addresses in a subnet, first find the subnet ID and the subnet broadcast address. Then, just add 1 to the fourth octet of the subnet ID to get the first (low-est) usable address, and subtract 1 from the fourth octet of the subnet broadcast address to get the last (highest) usable address in the subnet. + +For example, Figure 14-3 showed subnet ID 172.16.128.0, mask /18. The first usable address is simply one more than the subnet ID (in this case, 172.16.128.1). That same figure showed a subnet broadcast address of 172.16.191.255, so the last usable address is one less, or 172.16.191.254. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +326 CCNA 200-301 Official Cert Guide, Volume 1 + +Now that this section has described the concepts behind the numbers that collectively define a subnet, the rest of this chapter focuses on the math used to find these values. + +Analyzing Existing Subnets: Binary +What does it mean to “analyze a subnet”? For this book, it means that you should be able to start with an IP address and mask and then define key facts about the subnet in which that address resides. Specifically, that means discovering the subnet ID, subnet broadcast address, and range of addresses. The analysis can also include the calculation of the number +of addresses in the subnet as discussed in Chapter 13, but this chapter does not review those concepts. + +Many methods exist to calculate the details about a subnet based on the address/mask. This section begins by discussing some calculations that use binary math, with the next section showing alternatives that use only decimal math. Although many people prefer the decimal method for going fast on the exams, the binary calculations ultimately give you a better understanding of IPv4 addressing. In particular, if you plan to move on to attain Cisco cer-tifications beyond CCNA, you should take the time to understand the binary methods dis-cussed in this section, even if you use the decimal methods for the exams. + +Finding the Subnet ID: Binary +The two following statements summarize the logic behind the binary value of any subnet ID: + +All numbers in the subnet (subnet ID, subnet broadcast address, and all usable IP address-es) have the same value in the prefix part of the numbers. +The subnet ID is the lowest numeric value in the subnet, so its host part, in binary, is all 0s. +To find the subnet ID in binary, you take the IP address in binary and change all host bits to binary 0. To do so, you need to convert the IP address to binary. You also need to identify the prefix and host bits, which can be easily done by converting the mask (as needed) to pre-fix format. (Note that Appendix A, “Numeric Reference Tables,” includes a decimal-binary conversion table.) Figure 14-4 shows the idea, using the same address/mask as in the earlier examples in this chapter: 172.16.150.41, mask /18. + + + +/18 + +172.16.150.41 + +1 +PPPPPPPP +2 +10101100 + + +PPPPPPPP + +00010000 + + +PP HHHHHH + +10 010110 + + +HHHHHHHH + +00101001 + +3 Prefix: Copy 4 Host: Set to 0 + +ID 10101100 00010000 _________ 00000000 +________ +________ +10 000000 +________ + + +Legend: + +ID Subnet ID + +Figure 14-4 Binary Concept: Convert the IP Address to the Subnet ID + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 14: Analyzing Existing Subnets + +Starting at the top of Figure 14-4, the format of the IP address is represented with 18 prefix (P) and 14 host (H) bits in the mask (Step 1). The second row (Step 2) shows the binary version of the IP address, converted from the dotted-decimal notation (DDN) value +172.16.150.41. (If you have not yet used the conversion table in Appendix A, it might be use-ful to double-check the conversion of all four octets based on the table.) + +The next two steps show the action to copy the IP address’s prefix bits (Step 3) and give the host bits a value of binary 0 (Step 4). This resulting number is the subnet ID (in binary). + +The last step, not shown in Figure 14-4, is to convert the subnet ID from binary to decimal. This book shows that conversion as a separate step, in Figure 14-5, mainly because many people make a mistake at this step in the process. When converting a 32-bit number (like an IP address or IP subnet ID) back to an IPv4 DDN, you must follow this rule: + +Convert 8 bits at a time from binary to decimal, regardless of the line between the prefix +and host parts of the number. + +327 + + + +14 + + + +PPPPPPPP + +10101100 + +PPPPPPPP + +00010000 + +PP HHHHHH + +10 010110 + +HHHHHHHH + +00101001 + + + +ID 10101100 00010000 _________ 00000000 +________ +________ +10 000000 +________ + +5 5 5 5 ID 172 . 16 . 128 . 0 + +Figure 14-5 Converting the Subnet ID from Binary to DDN + +Figure 14-5 shows this final step. Note that the third octet (the third set of 8 bits) has 2 bits in the prefix and 6 bits in the host part of the number, but the conversion occurs for all 8 bits. + +NOTE You can do the numeric conversions in Figures 14-4 and 14-5 by relying on the conversion table in Appendix A. To convert from DDN to binary, for each octet, find the decimal value in the table and then write down the 8-bit binary equivalent. To convert from binary back to DDN, for each octet of 8 bits, find the matching binary entry in the table and write down the corresponding decimal value. For example, 172 converts to binary 10101100, and 00010000 converts to decimal 16. + + +Finding the Subnet Broadcast Address: Binary +Finding the subnet broadcast address uses a similar process. To find the subnet broadcast address, use the same binary process used to find the subnet ID, but instead of setting all the host bits to the lowest value (all binary 0s), set the host part to the highest value (all binary 1s). Figure 14-6 shows the concept. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| +________ +10 111111 + + +328 CCNA 200-301 Official Cert Guide, Volume 1 + + + +/18 + +172.16.150.41 + +1 +PPPPPPPP 2 +10101100 + + +PPPPPPPP + +00010000 + + +PP HHHHHH + +10 010110 + + +HHHHHHHH + +00101001 + + +3 Prefix: Copy 4 Host: Set to 1 + +10101100 + +5 + + +00010000 +________ + +5 + +_________ + +5 + + +11111111 +________ + +5 + +172 . 16 . 191 . 255 + +Legend: + +Broadcast Address + +Figure 14-6 Finding a Subnet Broadcast Address: Binary + +The process in Figure 14-6 demonstrates the same first three steps shown in Figure 14-4. Specifically, it shows the identification of the prefix and host bits (Step 1), the results of convert-ing the IP address 172.16.150.41 to binary (Step 2), and the copying of the prefix bits (first 18 bits, in this case). The difference occurs in the host bits on the right, changing all host bits (the last 14, in this case) to the largest possible value (all binary 1s). The final step converts the 32-bit subnet broadcast address to DDN format. Also, remember that with any conversion from DDN to binary or vice versa, the process always converts using 8 bits at a time. In particular, in this case, the entire third octet of binary 10111111 is converted back to decimal 191. + +Binary Practice Problems +Figures 14-4 and 14-5 demonstrate a process to find the subnet ID using binary math. The following process summarizes those steps in written form for easier reference and practice: +Step 1. Convert the mask to prefix format to find the length of the prefix (/P) and the length of the host part (32 – P). + +Step 2. Convert the IP address to its 32-bit binary equivalent. + +Step 3. Copy the prefix bits of the IP address. + +Step 4. Write down 0s for the host bits. + +Step 5. Convert the resulting 32-bit number, 8 bits at a time, back to decimal. + + +The process to find the subnet broadcast address is exactly the same, except in Step 4, you set the bits to 1s, as shown in Figure 14-6. + +Take a few moments and run through the following five practice problems on scratch paper. In each case, find both the subnet ID and subnet broadcast address. Also, record the prefix style mask: +1. 8.1.4.5, 255.255.0.0 +2. 130.4.102.1, 255.255.255.0 3. 199.1.1.100, 255.255.255.0 + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 14: Analyzing Existing Subnets 329 + +4. 130.4.102.1, 255.255.252.0 +5. 199.1.1.100, 255.255.255.224 14 +Tables 14-4 through 14-8 show the results for the five different examples. The tables show the host bits in bold, and they include the binary version of the address and mask and the binary version of the subnet ID and subnet broadcast address. + +Table 14-4 Subnet Analysis for Subnet with Address 8.1.4.5, Mask 255.255.0.0 + +Prefix Length + +Address + +Subnet ID + +Broadcast Address + +/16 + +8.1.4.5 + +8.1.0.0 + +8.1.255.255 + + +11111111 11111111 00000000 00000000 + +00001000 00000001 00000100 00000101 + +00001000 00000001 00000000 00000000 + +00001000 00000001 11111111 11111111 + + + +Table 14-5 Subnet Analysis for Subnet with Address 130.4.102.1, Mask 255.255.255.0 + +Prefix Length + +Address + +Subnet ID + +Broadcast Address + +/24 + +130.4.102.1 + +130.4.102.0 + +130.4.102.255 + + +11111111 11111111 11111111 00000000 + +10000010 00000100 01100110 00000001 + +10000010 00000100 01100110 00000000 + +10000010 00000100 01100110 11111111 + + + +Table 14-6 Subnet Analysis for Subnet with Address 199.1.1.100, Mask 255.255.255.0 + +Prefix Length + +Address + +Subnet ID + +Broadcast Address + +/24 + +199.1.1.100 + +199.1.1.0 + +199.1.1.255 + + +11111111 11111111 11111111 00000000 + +11000111 00000001 00000001 01100100 + +11000111 00000001 00000001 00000000 + +11000111 00000001 00000001 11111111 + + + +Table 14-7 Subnet Analysis for Subnet with Address 130.4.102.1, Mask 255.255.252.0 + +Prefix Length + +Address + +Subnet ID + +Broadcast Address + +/22 + +130.4.102.1 + +130.4.100.0 + +130.4.103.255 + + +11111111 11111111 11111100 00000000 + +10000010 00000100 01100110 00000001 + +10000010 00000100 01100100 00000000 + +10000010 00000100 01100111 11111111 + + + +Table 14-8 Subnet Analysis for Subnet with Address 199.1.1.100, Mask 255.255.255.224 + +Prefix Length + +Address + +Subnet ID + +Broadcast Address + +/27 + +199.1.1.100 + +199.1.1.96 + +199.1.1.127 + + +11111111 11111111 11111111 11100000 + +11000111 00000001 00000001 01100100 + +11000111 00000001 00000001 01100000 + +11000111 00000001 00000001 01111111 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +330 CCNA 200-301 Official Cert Guide, Volume 1 + +Shortcut for the Binary Process +The binary process described in this section so far requires that all four octets be converted to binary and then back to decimal. However, you can easily predict the results in at least three of the four octets, based on the DDN mask. You can then avoid the binary math in all but one octet and reduce the number of binary conversions you need to do. + +First, consider an octet, and that octet only, whose DDN mask value is 255. The mask value of 255 converts to binary 11111111, which means that all 8 bits are prefix bits. Thinking through the steps in the process, at Step 2, you convert the address to some number. At Step 3, you copy the number. At Step 4, you convert the same 8-bit number back to decimal. All you did in those three steps, in this one octet, is convert from decimal to binary and convert the same number back to the same decimal value! + +In short, the subnet ID (and subnet broadcast address) are equal to the IP address in octets for which the mask is 255. + +For example, the resident subnet ID for 172.16.150.41, mask 255.255.192.0 is 172.16.128.0. The first two mask octets are 255. Rather than think about the binary math, you could just start by copying the address’s value in those two octets: 172.16. + +Another shortcut exists for octets whose DDN mask value is decimal 0, or binary 00000000. With a decimal mask value of 0, the math always results in a decimal 0 for the subnet ID, +no matter the beginning value in the IP address. Specifically, just look at Steps 4 and 5 in this case: At Step 4, you would write down 8 binary 0s, and at Step 5, you would convert 00000000 back to decimal 0. + +The following revised process steps take these two shortcuts into account. However, when the mask is neither 0 nor 255, the process requires the same conversions. At most, you have to do only one octet of the conversions. To find the subnet ID, apply the logic in these steps for each of the four octets: +Step 1. If the mask = 255, copy the decimal IP address for that octet. + +Step 2. If the mask = 0, write down a decimal 0 for that octet. + +Step 3. If the mask is neither 0 nor 255 in this octet, use the same binary logic as shown in the section “Finding the Subnet ID: Binary,” earlier in this chapter. + + +Figure 14-7 shows an example of this process, again using 172.16.150.41, 255.255.192.0. + +To find the subnet broadcast address, you can use a decimal shortcut similar to the one used to find the subnet ID: for DDN mask octets equal to decimal 0, set the decimal subnet broadcast address value to 255 instead of 0, as noted in the following list: +Step 1. If the mask = 255, copy the decimal IP address for that octet. + +Step 2. If the mask = 0, write down a decimal 255 for that octet. + +Step 3. If the mask is neither 0 nor 255 in this octet, use the same binary logic as shown in the section “Finding the Subnet Broadcast Address: Binary,” earlier in this chapter. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 14: Analyzing Existing Subnets 331 + + +0-255 255 . 255 . 192 . 0 14 Action Copy Copy Binary Zero +IP 172 . 16 . 150 . 41 + + +ID 172 . 16 . ____ . 0 + + +Legend: + +0-255 DDN Mask IP IP Address ID Subnet ID + +Figure 14-7 Binary Shortcut Example + +Brief Note About Boolean Math +So far, this chapter has described how humans can use binary math to find the subnet ID and subnet broadcast address. However, computers typically use an entirely different binary process to find the same values, using a branch of mathematics called Boolean algebra. Computers already store the IP address and mask in binary form, so they do not have to do any conversions to and from decimal. Then, certain Boolean operations allow the computers to calculate the subnet ID and subnet broadcast address with just a few CPU instructions. + +You do not need to know Boolean math to have a good understanding of IP subnetting. However, in case you are interested, computers use the following Boolean logic to find the subnet ID and subnet broadcast address, respectively: + +Perform a Boolean AND of the IP address and mask. This process converts all host bits to binary 0. +Invert the mask, and then perform a Boolean OR of the IP address and inverted subnet mask. This process converts all host bits to binary 1s. + +Finding the Range of Addresses +Finding the range of usable addresses in a subnet, after you know the subnet ID and subnet broadcast address, requires only simple addition and subtraction. To find the first (lowest) usable IP address in the subnet, simply add 1 to the fourth octet of the subnet ID. To find the last (highest) usable IP address, simply subtract 1 from the fourth octet of the subnet broadcast address. + +Analyzing Existing Subnets: Decimal +Analyzing existing subnets using the binary process works well. However, some of the math takes time for most people, particularly the decimal-binary conversions. And you need to do the math quickly for the Cisco CCNA exam. For the exam, you really should be able to take an IP address and mask, and calculate the subnet ID and range of usable addresses within about 15 seconds. When using binary methods, most people require a lot of practice to be able to find these answers, even when using the abbreviated binary process. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +332 CCNA 200-301 Official Cert Guide, Volume 1 + +This section discusses how to find the subnet ID and subnet broadcast address using only decimal math. Most people can find the answers more quickly using this process, at least after a little practice, as compared with the binary process. However, the decimal process does not tell you anything about the meaning behind the math. So, if you have not read the earlier section “Analyzing Existing Subnets: Binary,” it is worthwhile to read it for the sake of understanding subnetting. This section focuses on getting the right answer using a method that, after you have practiced, should be faster. + +Analysis with Easy Masks +With three easy subnet masks in particular, finding the subnet ID and subnet broadcast address requires only easy logic and literally no math. Three easy masks exist: + +255.0.0.0 255.255.0.0 255.255.255.0 +These easy masks have only 255 and 0 in decimal. In comparison, difficult masks have one octet that has neither a 255 nor a 0 in the mask, which makes the logic more challenging. + +NOTE The terms easy mask and difficult mask are terms created for use in this book to describe the masks and the level of difficulty when working with each. + +When the problem uses an easy mask, you can quickly find the subnet ID based on the IP address and mask in DDN format. Just use the following process for each of the four octets to find the subnet ID: +Step 1. If the mask octet = 255, copy the decimal IP address. + +Step 2. If the mask octet = 0, write a decimal 0. + + +A similar simple process exists to find the subnet broadcast address, as follows: + +Step 1. If the mask octet = 255, copy the decimal IP address. + +Step 2. If the mask octet = 0, write a decimal 255. + + +Before moving to the next section, take some time to fill in the blanks in Table 14-9. Check your answers against Table 14-15 in the section “Answers to Earlier Practice Problems,” later in this chapter. Complete the table by listing the subnet ID and subnet broadcast address. + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 14: Analyzing Existing Subnets 333 + +Table 14-9 Practice Problems: Find Subnet ID and Broadcast Address, Easy Masks + +IP Address 1 10.77.55.3 +2 172.30.99.4 + +3 192.168.6.54 + +4 10.77.3.14 + +5 172.22.55.77 + +6 1.99.53.76 + +Mask Subnet ID Broadcast Address 14 255.255.255.0 +255.255.255.0 + +255.255.255.0 + +255.255.0.0 + +255.255.0.0 + +255.0.0.0 + + + +Predictability in the Interesting Octet +Although three masks are easier to work with (255.0.0.0, 255.255.0.0, and 255.255.255.0), the rest make the decimal math a little more difficult, so we call these masks difficult masks. With difficult masks, one octet is neither a 0 nor a 255. The math in the other three octets is easy and boring, so this book calls the one octet with the more difficult math the interesting octet. + +If you take some time to think about different problems and focus on the interesting octet, you will begin to see a pattern. This section takes you through that examination so that you can learn how to predict the pattern, in decimal, and find the subnet ID. + +First, the subnet ID value has a predictable decimal value because of the assumption that a single subnet mask is used for all subnets of a single classful network. The chapters in this part of the book assume that, for a given classful network, the design engineer chooses to use a single subnet mask for all subnets. (See the section “One Size Subnet Fits All—Or Not” in Chapter 11, “Perspectives on IPv4 Subnetting,” for more details.) + +To see that predictability, consider some planning information written down by a network engineer, as shown in Figure 14-8. The figure shows four different masks the engineer is con-sidering using in an IPv4 network, along with Class B network 172.16.0.0. The figure shows the third-octet values for the subnet IDs that would be created when using mask 255.255.128.0, 255.255.192.0, 255.255.224.0, and 255.255.240.0, from top to bottom in the figure. + +Subnets of 172.16.0.0: 172.16.___.0 + +255.255.128.0 0 128 2 Subnets + +255.255.192.0 0 64 128 192 4 Subnets + +255.255.224.0 0 32 64 96 128 160 192 224 8 Subnets + +255.255.240.0 0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 16 Subnets + +Figure 14-8 Numeric Patterns in the Interesting Octet + + +|||||||||||||||||||| +|||||||||||||||||||| + + +334 CCNA 200-301 Official Cert Guide, Volume 1 + +First, to explain the figure further, look at the top row of the figure. If the engineer uses 255.255.128.0 as the mask, the mask creates two subnets, with subnet IDs 172.16.0.0 and 172.16.128.0. If the engineer uses mask 255.255.192.0, the mask creates four subnets, with subnet IDs 172.16.0.0, 172.16.64.0, 172.16.128.0, and 172.16.192.0. + +If you take the time to look at the figure, the patterns become obvious. In this case: + + +Mask: 255.255.128.0 Mask: 255.255.192.0 Mask: 255.255.224.0 +Mask: 255.255.240.0 + +Pattern: Multiples of 128 Pattern: Multiples of 64 Pattern: Multiples of 32 +Pattern: Multiples of 16 + +To find the subnet ID, you just need a way to figure out what the pattern is. If you start with an IP address and mask, just find the subnet ID closest to the IP address, without going over, as discussed in the next section. + +Finding the Subnet ID: Difficult Masks +The following written process lists all the steps to find the subnet ID, using only decimal math. This process adds to the earlier process used with easy masks. For each octet: +Step 1. If the mask octet = 255, copy the decimal IP address. + +Step 2. If the mask octet = 0, write a decimal 0. + +Step 3. If the mask is neither, refer to this octet as the interesting octet: + +A. Calculate the magic number as 256 – mask. + +B. Set the subnet ID’s value to the multiple of the magic number that is closest to the IP address without going over. + +The process uses two new terms created for this book: magic number and interesting octet. The term interesting octet refers to the octet identified at Step 3 in the process; in other words, it is the octet with the mask that is neither 255 nor 0. Step 3A then uses the term magic number, which is derived from the DDN mask. Conceptually, the magic number is the number you add to one subnet ID to get the next subnet ID in order, as shown in Figure 14-8. Numerically, it can be found by subtracting the DDN mask’s value, in the interesting octet, from 256, as mentioned in Step 3A. + +The best way to learn this process is to see it happen. In fact, if you can, stop reading now, use the companion website for this book, and watch the videos about finding the subnet ID with a difficult mask. These videos demonstrate this process. You can also use the examples on the next few pages that show the process being used on paper. Then follow the practice opportunities outlined in the section “Practice Analyzing Existing Subnets,” later in this chapter. + +Resident Subnet Example 1 +For example, consider the requirement to find the resident subnet for IP address 130.4.102.1, mask 255.255.240.0. The process does not require you to think about prefix bits versus host bits, convert the mask, think about the mask in binary, or convert the IP address to and from + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 14: Analyzing Existing Subnets + +binary. Instead, for each of the four octets, choose an action based on the value in the mask. Figure 14-9 shows the results; the circled numbers in the figure refer to the step numbers in +the written process to find the subnet ID, as listed in the previous few pages. + +335 + + + +14 + + +1 1 3 2 256 –240 +0-255 255 . 255 . 240 . 0 16 Action Copy Copy Magic Zero +IP 130 . 4 . 102 . 1 + + +ID 130 . 4 . 96 . 0 + + +Multiples: +0 16 32 48 64 80 96 112 128 + +Figure 14-9 Find the Subnet ID: 130.4.102.1, 255.255.240.0 + +First, examine the three uninteresting octets (1, 2, and 4, in this example). The process keys on the mask, and the first two octets have a mask value of 255, so simply copy the IP address to the place where you intend to write down the subnet ID. The fourth octet has a mask value of 0, so write down a 0 for the fourth octet of the subnet ID. + +The most challenging logic occurs in the interesting octet, which is the third octet in this example, because of the mask value 240 in that octet. For this octet, Step 3A asks you to cal-culate the magic number as 256 – mask. That means you take the mask’s value in the interest-ing octet (240, in this case) and subtract it from 256: 256 – 240 = 16. The subnet ID’s value in this octet must be a multiple of decimal 16, in this case. + +Step 3B then asks you to find the multiples of the magic number (16, in this case) and choose the one closest to the IP address without going over. Specifically, that means that you should mentally calculate the multiples of the magic number, starting at 0. (Do not forget to start +at 0!) Count, starting at 0: 0, 16, 32, 48, 64, 80, 96, 112, and so on. Then, find the multiple closest to the IP address value in this octet (102, in this case), without going over 102. So, as shown in Figure 14-9, you make the third octet’s value 96 to complete the subnet ID of 130.4.96.0. + +Resident Subnet Example 2 +Consider another example: 192.168.5.77, mask 255.255.255.224. Figure 14-10 shows the results. + +The three uninteresting octets (1, 2, and 3, in this case) require only a little thought. For each octet, each with a mask value of 255, just copy the IP address. + +For the interesting octet, at Step 3A, the magic number is 256 – 224 = 32. The multiples of the magic number are 0, 32, 64, 96, and so on. Because the IP address value in the fourth octet is 77, in this case, the multiple must be the number closest to 77 without going over; therefore, the subnet ID ends with 64, for a value of 192.168.5.64. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +336 CCNA 200-301 Official Cert Guide, Volume 1 + +1 1 1 3 +256 0-255 255 . 255 . 255 . 224 –224 +Action Copy Copy Copy Magic 32 + +IP 192 . 168 . 5 . 77 + + +ID 192 . 168 . 5 . 64 + + +Multiples: +0 32 64 96 128 160 192 224 + +Figure 14-10 Resident Subnet for 192.168.5.77, 255.255.255.224 + +Resident Subnet Practice Problems +Before moving to the next section, take some time to fill in the blanks in Table 14-10. Check your answers against Table 14-16 in the section “Answers to Earlier Practice Problems,” later in this chapter. Complete the table by listing the subnet ID in each case. The text following Table 14-16 also lists explanations for each problem. + +Table 14-10 Practice Problems: Find Subnet ID, Difficult Masks + +Problem 1 +2 + +3 + +4 + +5 + +6 + +IP Address 10.77.55.3 +172.30.99.4 + +192.168.6.54 + +10.77.3.14 + +172.22.55.77 + +1.99.53.76 + +Mask Subnet ID 255.248.0.0 +255.255.192.0 + +255.255.255.252 + +255.255.128.0 + +255.255.254.0 + +255.255.255.248 + + + +Finding the Subnet Broadcast Address: Difficult Masks +To find a subnet’s broadcast address, a similar process can be used. For simplicity, this pro-cess begins with the subnet ID, rather than the IP address. If you happen to start with an IP address instead, use the processes in this chapter to first find the subnet ID, and then use the following process to find the subnet broadcast address for that same subnet. For each octet: +Step 1. If the mask octet = 255, copy the subnet ID. + +Step 2. If the mask octet = 0, write 255. + +Step 3. If the mask is neither, identify this octet as the interesting octet: + +A. Calculate the magic number as 256 – mask. + +B. Take the subnet ID’s value, add the magic number, and subtract 1 (ID + magic – 1). + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 14: Analyzing Existing Subnets + +As with the similar process used to find the subnet ID, you have several options for how to best learn and internalize the process. If you can, stop reading now, use the companion web-site for this book, and watch the videos listed for this chapter. Also, look at the examples in this section, which show the process being used on paper. Then, follow the practice opportu- +nities outlined in the section “Additional Practice for This Chapter’s Processes.” + +337 + + + +14 + + +Subnet Broadcast Example 1 +The first example continues the first example from the section “Finding the Subnet ID: Difficult Masks,” earlier in this chapter, as demonstrated in Figure 14-9. That example started with the IP address/mask of 130.4.102.1, 255.255.240.0, and showed how to find subnet ID 130.4.96.0. Figure 14-11 now begins with that subnet ID and the same mask. + +1 1 3 2 256 –240 +0-255 255 . 255 . 240 . 0 16 + +ID 130 . 4 . 96 . 0 + + +Action Copy + +130 + +Copy +Magic 255 –1 +. 4 . 111 . 255 + + + +Figure 14-11 Find the Subnet Broadcast: 130.4.96.0, 255.255.240.0 + +First, examine the three uninteresting octets (1, 2, and 4). The process keys on the mask, and the first two octets have a mask value of 255, so simply copy the subnet ID to the place where you intend to write down the subnet broadcast address. The fourth octet has a mask value of 0, so write down a 255 for the fourth octet. + +The logic related to the interesting octet occurs in the third octet in this example because of the mask value 240. First, Step 3A asks you to calculate the magic number, as 256 – mask. (If you had already calculated the subnet ID using the decimal process in this book, you should already know the magic number.) At Step 3B, you take the subnet ID’s value (96), add the magic number (16), and subtract 1, for a total of 111. That makes the subnet broadcast address 130.4.111.255. + +Subnet Broadcast Example 2 +Again, this example continues an earlier example, from the section “Resident Subnet Example 2,” as demonstrated in Figure 14-10. That example started with the IP address/mask of 192.168.5.77, mask 255.255.255.224 and showed how to find subnet ID 192.168.5.64. Figure 14-12 now begins with that subnet ID and the same mask. + +First, examine the three uninteresting octets (1, 2, and 3). The process keys on the mask, and the first three octets have a mask value of 255, so simply copy the subnet ID to the place where you intend to write down the subnet broadcast address. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +338 CCNA 200-301 Official Cert Guide, Volume 1 + +1 1 1 3 + + +0-255 255 . 255 . + +ID 192 . 168 . + +256 255 . 224 –224 +32 5 . 64 + + +Action Copy Copy Copy +Magic –1 +192 . 168 . 5 . 95 + + +Figure 14-12 Find the Subnet Broadcast: 192.168.5.64, 255.255.255.224 + +The interesting logic occurs in the interesting octet, the fourth octet in this example, because of the mask value 224. First, Step 3A asks you to calculate the magic number, as 256 – mask. (If you had already calculated the subnet ID, it is the same magic number because the same mask is used.) At Step 3B, you take the subnet ID’s value (64), add magic (32), and subtract 1, for a total of 95. That makes the subnet broadcast address 192.168.5.95. + +Subnet Broadcast Address Practice Problems +Before moving to the next section, take some time to do several practice problems on a scratch piece of paper. Go back to Table 14-10, which lists IP addresses and masks, and prac-tice by finding the subnet broadcast address for all the problems in that table. Then check your answers against Table 14-17 in the section “Answers to Earlier Practice Problems,” later in this chapter. + +Practice Analyzing Existing Subnets +As with the other subnetting math in this book, using a two-phase approach may help. Take time now to practice until you feel like you understand the process. Then, before the exam, make sure you master the math. Table 14-11 summarizes the key concepts and suggestions for this two-phase approach. + +Table 14-11 Keep-Reading and Take-Exam Goals for This Chapter’s Topics + + +Focus On… + +Tools Allowed + +Goal: Accuracy + +Goal: Speed + +Before Moving to the Next Chapter Learning how +All + +90% correct + +Any speed + +Before Taking the Exam Being correct and fast +Your brain and a notepad + +100% correct + +20–30 seconds + + + +A Choice: Memorize or Calculate +As described in this chapter, the decimal processes to find the subnet ID and subnet broad-cast address do require some calculation, including the calculation of the magic number (256 – mask). The processes also use a DDN mask, so if an exam question gives you a prefix-style mask, you need to convert to DDN format before using the process in this book. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 14: Analyzing Existing Subnets + +Over the years, some people have told me they prefer to memorize a table to find the magic number. These tables could list the magic number for different DDN masks and prefix masks, so you avoid converting from the prefix mask to DDN. Table 14-12 shows an example of +such a table. Feel free to ignore this table, use it, or make your own. + +339 + + + +14 + + +Table 14-12 Reference Table: DDN Mask Values, Binary Equivalent, Magic Numbers, and Prefixes + +Prefix, interesting octet 2 + +Prefix, interesting octet 3 + +Prefix, interesting octet 4 + +Magic number + +DDN mask in the interesting octet + +/9 /10 /11 /12 /13 /14 /15 /16 + +/17 /18 /19 /20 /21 /22 /23 /24 + +/25 /26 /27 /28 /29 /30 + +128 64 32 16 8 4 2 1 + +128 192 224 240 248 252 254 255 + + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 14-13 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 14-13 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Practice mask analysis + +Practice analyzing existing subnets + +Resource Used Book, website +Book, website + +Book, PTP + +Website + +Website, Appendix F + +Website, Appendix F + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +340 CCNA 200-301 Official Cert Guide, Volume 1 + +Review All the Key Topics + +Table 14-14 Key Topics for Chapter 14 +Key Topic Description Page Element Number + +List + +Table 14-2 + +Table 14-3 + +List + +List + +Definition of a subnet’s key numbers 322 + +Key facts about the subnet ID 324 + +Key facts about the subnet broadcast address 325 + +Steps to use binary math to find the subnet ID 328 + +General steps to use binary and decimal math to find the subnet ID 330 + + +List Steps to use decimal and binary math to find the subnet broadcast address 330 + +List Steps to use only decimal math to find the subnet ID 334 + +List Steps to use only decimal math to find the subnet broadcast address 336 + + +Key Terms You Should Know +resident subnet, subnet ID, subnet number, subnet address, subnet broadcast address + +Additional Practice for This Chapter’s Processes +You can do more practice with the processes in this chapter with a pair of practice sets. Both give you practice at analyzing existing subnets. You may do each practice set using the fol-lowing tools: + +Application: Use the “Analyzing Existing Subnets” exercises 1 and 2 on the companion website, listed under the Chapter Review for this chapter. +PDF: Alternatively, practice the same problems found in these apps using companion web-site Appendix F, “Practice for Chapter 14: Analyzing Existing Subnets.” + +Answers to Earlier Practice Problems +This chapter includes practice problems spread around different locations in the chapter. The answers are located in Tables 14-15, 14-16, and 14-17. + +Table 14-15 Answers to Problems in Table 14-9 + +IP Address 1 10.77.55.3 +2 172.30.99.4 + +3 192.168.6.54 + +4 10.77.3.14 + +5 172.22.55.77 + +6 1.99.53.76 + +Mask 255.255.255.0 +255.255.255.0 + +255.255.255.0 + +255.255.0.0 + +255.255.0.0 + +255.0.0.0 + +Subnet ID 10.77.55.0 +172.30.99.0 + +192.168.6.0 + +10.77.0.0 + +172.22.0.0 + +1.0.0.0 + +Broadcast Address 10.77.55.255 +172.30.99.255 + +192.168.6.255 + +10.77.255.255 + +172.22.255.255 + +1.255.255.255 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 14: Analyzing Existing Subnets 341 + +Table 14-16 Answers to Problems in Table 14-10 + +IP Address 1 10.77.55.3 +2 172.30.99.4 + +3 192.168.6.54 + +4 10.77.3.14 + +5 172.22.55.77 + +6 1.99.53.76 + +Mask 255.248.0.0 +255.255.192.0 + +255.255.255.252 + +255.255.128.0 + +255.255.254.0 + +255.255.255.248 + +Subnet ID 14 10.72.0.0 +172.30.64.0 + +192.168.6.52 + +10.77.0.0 + +172.22.54.0 + +1.99.53.72 + + + +The following list explains the answers for Table 14-16: + +1. The second octet is the interesting octet, with magic number 256 – 248 = 8. The mul-tiples of 8 include 0, 8, 16, 24, …, 64, 72, and 80. 72 is closest to the IP address value in that same octet (77) without going over, making the subnet ID 10.72.0.0. +2. The third octet is the interesting octet, with magic number 256 – 192 = 64. The multi-ples of 64 include 0, 64, 128, and 192. 64 is closest to the IP address value in that same octet (99) without going over, making the subnet ID 172.30.64.0. +3. The fourth octet is the interesting octet, with magic number 256 – 252 = 4. The mul-tiples of 4 include 0, 4, 8, 12, 16, …, 48, 52, and 56. 52 is the closest to the IP address value in that same octet (54) without going over, making the subnet ID 192.168.6.52. +4. The third octet is the interesting octet, with magic number 256 – 128 = 128. Only two multiples exist that matter: 0 and 128. 0 is the closest to the IP address value in that same octet (3) without going over, making the subnet ID 10.77.0.0. +5. The third octet is the interesting octet, with magic number 256 – 254 = 2. The mul-tiples of 2 include 0, 2, 4, 6, 8, and so on—essentially all even numbers. 54 is closest to the IP address value in that same octet (55) without going over, making the subnet ID 172.22.54.0. +6. The fourth octet is the interesting octet, with magic number 256 – 248 = 8. The mul-tiples of 8 include 0, 8, 16, 24, …, 64, 72, and 80. 72 is closest to the IP address value in that same octet (76) without going over, making the subnet ID 1.99.53.72. + +Table 14-17 Answers to Problems in the Section “Subnet Broadcast Address Practice Problems” + +Subnet ID 1 10.72.0.0 +2 172.30.64.0 + +3 192.168.6.52 + +4 10.77.0.0 + +5 172.22.54.0 + +6 1.99.53.72 + +Mask 255.248.0.0 +255.255.192.0 + +255.255.255.252 + +255.255.128.0 + +255.255.254.0 + +255.255.255.248 + +Broadcast Address 10.79.255.255 +172.30.127.255 + +192.168.6.55 + +10.77.127.255 + +172.22.55.255 + +1.99.53.79 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +342 CCNA 200-301 Official Cert Guide, Volume 1 + +The following list explains the answers for Table 14-17: + +1. The second octet is the interesting octet. Completing the three easy octets means that the broadcast address in the interesting octet will be 10.___.255.255. With magic num-ber 256 – 248 = 8, the second octet will be 72 (from the subnet ID), plus 8, minus 1, or 79. +2. The third octet is the interesting octet. Completing the three easy octets means that the broadcast address in the interesting octet will be 172.30.___.255. With magic num-ber 256 – 192 = 64, the interesting octet will be 64 (from the subnet ID), plus 64 (the magic number), minus 1, for 127. +3. The fourth octet is the interesting octet. Completing the three easy octets means that the broadcast address in the interesting octet will be 192.168.6.___. With magic num-ber 256 – 252 = 4, the interesting octet will be 52 (the subnet ID value), plus 4 (the magic number), minus 1, or 55. +4. The third octet is the interesting octet. Completing the three easy octets means that the broadcast address will be 10.77.___.255. With magic number 256 – 128 = 128, the interesting octet will be 0 (the subnet ID value), plus 128 (the magic number), minus 1, or 127. +5. The third octet is the interesting octet. Completing the three easy octets means that the broadcast address will be 172.22.___.255. With magic number 256 – 254 = 2, the broadcast address in the interesting octet will be 54 (the subnet ID value), plus 2 (the magic number), minus 1, or 55. +6. The fourth octet is the interesting octet. Completing the three easy octets means that the broadcast address will be 1.99.53.___. With magic number 256 – 248 = 8, the broadcast address in the interesting octet will be 72 (the subnet ID value), plus 8 (the magic number), minus 1, or 79. + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part IV Review + +Keep track of your part review progress with the checklist in Table P4-1. Details on each task follow the table. + + +Table P4-1 + +Activity + +Part IV Part Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Subnetting Exercises in Appendices on Companion Website +Videos on Companion Website + +Subnetting Exercises on Author’s Blog + +Subnetting Exercises in IP Subnetting Practice Question Kit +Subnetting Labs in Pearson Network Simulator + + +Repeat All DIKTA Questions +For this task, use the PCPT software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PCPT to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Watch Videos +Chapter 14 recommends several videos as listed on this book’s companion website. These videos help you understand how to use the process in the book to find facts about subnets, like the range of usable addresses in the subnet. + +Subnetting Exercises +Chapters 12, 13, and 14 list some subnetting exercises, along with time and accuracy goals. Now is a good time to work on those goals. Some options include the following: + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Practice from this book’s appendices or web applications: The Chapter Review sections of Chapters 12, 13, and 14 mention addressing and subnetting exercises included with this book. Find all the related applications in the Part IV Review section of the compan-ion website: + +Appendix D, “Practice for Chapter 12: Analyzing Classful IPv4 Networks” + +Appendix E, “Practice for Chapter 13: Analyzing Subnet Masks” + +Appendix F, “Practice for Chapter 14: Analyzing Existing Subnets” + +Pearson Network Simulator: The full Pearson ICND1 or CCNA simulator has subnet-ting math exercises that you can do by using CLI commands. Look for the labs with “IP Address Rejection” and “Subnet ID Calculation” in their names. + +Author’s blog: I’ve written a few dozen subnetting exercises on the blog over the years. Just look at the Questions menu item at the top of the page, and you will see a variety of IPv4 addressing and subnetting question types. Start at http://blog.certskills.com. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +Parts V and VI work together to reveal the details of how to implement IPv4 routing in Cisco routers. To that end, Part V focuses on the most common features for Cisco routers, including IP address configuration, connected routes, and static routes. Part VI then goes into some detail about the one IP routing protocol discussed in this book: OSPF Version 2 (OSPFv2). + +Part V follows a progression of topics. First, Chapter 15 examines the fundamentals of rout-ers—the physical components, how to access the router command-line interface (CLI), and the configuration process. Chapter 15 makes a close comparison of the switch CLI and its basic administrative commands so that you have to learn only new commands that apply to routers but not to switches. + +Chapter 16 then moves on to discuss how to configure routers to route IPv4 packets in the most basic designs. Those designs require a simple IP address/mask configuration on each interface, with the addition of a static route command—a command that directly configures a route into the IP routing table—for each destination subnet. + +By the end of Chapter 16, you should have a solid understanding of how to enable IP addressing and routing in a Cisco router, so Chapter 17 continues the progression into more challenging but more realistic configurations related to routing between subnets in a LAN environment. Most LANs use many VLANs, with one subnet per VLAN. Cisco routers and switches can be configured to route packets between those subnets, with more than a few twists in the configuration. + +Finally, Part V closes with a chapter about troubleshooting IPv4 routing. The chapter fea-tures the ping and traceroute commands, two commands that can help you discover not only whether a routing problem exists but also where the problem exists. Chapters 15, 16, and 17 show how to confirm whether a route has been added to one router’s routing table, while the commands discussed in Chapter 18 teach you how to test the end-to-end routes from sending host to receiving host. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part V + + +IPv4 Routing + + + + +Chapter 15: Operating Cisco Routers + +Chapter 16: Configuring IPv4 Addressing and Static Routes + +Chapter 17: IP Routing in the LAN + +Chapter 18: Troubleshooting IPv4 Routing + +Part V Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 15 + + +Operating Cisco Routers This chapter covers the following exam topics: +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.a Routers + +1.2 Describe characteristics of network topology architectures + +1.2.e Small office/home office (SOHO) + +1.6 Configure and verify IPv4 addressing and subnetting + +Getting an IPv4 network up and working requires some basic steps: installing routers, install-ing cables, and ordering WAN services. The installation also requires some router configu-ration because routers often use defaults so that the router does not route IP packets until configuration has been added. You will need to configure IPv4 addresses, enable interfaces, and add IP routes—either through static configuration or by enabling some dynamic routing protocol. This chapter focuses on the first steps to creating a small working network: how to install an enterprise-class Cisco router and configure interfaces and IP addresses. + +This chapter breaks the topics into two major headings. The first discusses the physical installation of an enterprise-class Cisco router. The second section looks at the command-line interface (CLI) on a Cisco router, which has the same look and feel as the Cisco switch CLI. This section first lists the similarities between a switch and router CLI and then introduces the configuration required to make the router start forwarding IP packets on its interfaces. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 15-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Installing Cisco Routers +Enabling IPv4 Support on Cisco Routers + +Questions 1 +2–6 + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Which of the following installation steps are more likely required on a Cisco router, but not typically required on a Cisco switch? (Choose two answers.) +a. Connect Ethernet cables b. Connect serial cables +c. Connect to the console port d. Connect the power cable +e. Turn the on/off switch to “on” + +2. Which of the following commands might you see associated with a router CLI, but not with a switch CLI? +a. The show mac address-table command b. The show ip route command +c. The show running-config command d. The show interfaces status command +3. Which answers list a task that could be helpful in making a router interface G0/0 ready to route packets? (Choose two answers.) +a. Configuring the ip address address mask command in G0/0 configuration mode +b. Configuring the ip address address and ip mask mask commands in G0/0 con-figuration mode +c. Configuring the no shutdown command in G0/0 configuration mode d. Setting the interface description in G0/0 configuration mode +4. The output of the show ip interface brief command on R1 lists interface status codes of “down” and “down” for interface GigabitEthernet 0/0. The interface connects to a LAN switch with a UTP straight-through cable. Which of the following could be true? +a. The shutdown command is currently configured for router interface G0/0. +b. The shutdown command is currently configured for the switch interface on the other end of the cable. +c. The router was never configured with an ip address command on the interface. d. The router was configured with the no ip address command. +5. Which of the following commands do not list the IP address and mask of at least one interface? (Choose two answers.) +a. show running-config +b. show protocols type number c. show ip interface brief +d. show interfaces e. show version + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +350 CCNA 200-301 Official Cert Guide, Volume 1 + +6. Which of the following is different on the Cisco switch CLI for a Layer 2 switch as compared with the Cisco router CLI? + +a. The commands used to configure simple password checking for the console b. The number of IP addresses configured +c. The configuration of the device’s hostname d. The configuration of an interface description + +Foundation Topics + +Installing Cisco Routers +Routers collectively provide the main feature of the network layer—the capability to for-ward packets end to end through a network. As introduced in Chapter 3, “Fundamentals of WANs and IP Routing,” routers forward packets by connecting to various physical network links, like Ethernet LAN, Ethernet WAN, and serial WAN links, then using Layer 3 routing logic to choose where to forward each packet. As a reminder, Chapter 2, “Fundamentals of Ethernet LANs,” covered the details of making those physical connections to Ethernet net-works, while Chapter 3 covered the basics of cabling with WAN links. + +This section examines some of the details of router installation and cabling, first from the enterprise perspective and then from the perspective of connecting a typical small office/ home office (SOHO) to an ISP using high-speed Internet. + +Installing Enterprise Routers +A typical enterprise network has a few centralized sites as well as lots of smaller remote sites. To support devices at each site (the computers, IP phones, printers, and other devices), the network includes at least one LAN switch at each site. In addition, each site has a router, which connects to the LAN switch and to some WAN link. The WAN link provides connec-tivity from each remote site, back to the central site, and to other sites through the connec-tion to the central site. + +Figures 15-1 and 15-2 show a couple of different kinds of network diagrams that might be used to represent an enterprise network. The style of Figure 15-1 supports discussions about Layer 3 topics, showing the subnet IDs, masks, and interface IP addresses in shorthand. The figure also keeps the physical and data-link details to a minimum with these conventions: + +Ethernet LAN: Simple straight lines with one or more LAN switches implied but not shown. +Ethernet WAN: Shown as a straight line, often with a cloud over it, with some kind of Ethernet interface identifier shown by the router (in this case, G0/1/0 and G0/0/0, which refers to GigabitEthernet interfaces). +Serial WAN: A line with a crooked part in the middle (a “lightning bolt”) represents a typi-cal point-to-point serial link as introduced in Chapter 3. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 15: Operating Cisco Routers 351 + + + + + +Subnet 172.16.1.0/24 + + +G0/0 .1 + + +Subnet 172.16.4.0/24 + + + +S0/0/0 .1 +R1 .1 G0/1/0 + + + +Subnet 172.16.5.0/24 + + + + +S0/0/1 R2 .2 + + + + + +.3 +G0/0/0 +R3 + +Subnet 172.16.2.0/24 + +G0/0 .2 + + +15 + + + +Subnet 172.16.3.0/24 + +G0/0 .3 + + +Figure 15-1 Generic Enterprise Network Diagram + +In comparison, Figure 15-2 shows more detail about the physical cabling with less detail about the IP subnets and addresses. First, if the diagram needs to show physical details in the LAN, the diagram could show the LAN switches and related devices to the outside of the figure. The router Ethernet interfaces have an RJ-45 connector; just connect the appropriate UTP cable to both the router and the nearby LAN switch. + +Central Site Branch Office + +Serial Cable IP + + + + +R1 + +UTP Cables +4 +5 +6 + + +CSU/ DSU + + +External CSU/DSU + +Leased Line +R2 + +Internal CSU/DSU + + + +UTP Cables +1 2 3 + + + +S1 S2 Servers + +Figure 15-2 More Detailed Cabling Diagram for the Same Enterprise Network + +Next, consider the hardware on the ends of the serial link, in particular where the channel service unit/data service unit (CSU/DSU) hardware resides on each end of the serial link. In a real serial link that runs through a service provider, the link terminates at a CSU/DSU. The +CSU/DSU can either sit outside the router as a separate device (as shown on the left at router R1) or integrated into the router’s serial interface hardware (as shown on the right). + +As for cabling, the service provider will run the cable into the enterprise’s wiring closet and often put an RJ-48 connector (same size as an RJ-45 connector) on the end of the cable. That cable should connect to the CSU/DSU. With an internal CSU/DSU (as with router R1 in Figure 15-2), the router serial port has an RJ-48 port to which the serial cable should + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +352 CCNA 200-301 Official Cert Guide, Volume 1 + +connect. With an external CSU/DSU, the CSU/DSU must be connected to the router’s serial card via a short serial cable. + +Cisco Integrated Services Routers +Product vendors, including Cisco, typically provide several different types of router hard-ware. Today, routers often do much more work than simply routing packets; in fact, they serve as a device or platform from which to provide many network services. Cisco even brands its enterprise routers not just as routers, but as “integrated services routers,” empha-sizing the multipurpose nature of the products. + +As an example, consider the networking functions needed at a typical branch office. A typi-cal enterprise branch office needs a router for WAN/LAN connectivity, and a LAN switch to provide a high-performance local network and connectivity into the router and WAN. Many +branches also need voice-over-IP (VoIP) services to support IP phones, and several security ser-vices as well. Plus, it is hard to imagine a site with users that does not have Wi-Fi access today. So, rather than require multiple separate devices at one site, as shown in Figure 15-2, Cisco offers single devices that act as both router and switch and provide other functions as well. + +For the sake of learning and understanding the different functions, this book focuses on using a separate switch and separate router, which provides a much cleaner path for learning the basics. + +Figure 15-3 shows a photo of the Cisco 4321 ISR, with some of the more important fea-tures highlighted. The top part of the figure shows a full view of the back of the router. This model comes with two built-in Gigabit Ethernet interfaces and two modular slots that allow you to add small cards called Network Interface Modules (NIMs). The bottom of the figure shows one example NIM (a NIM that provides two serial interfaces). The router has other items as well, including both an RJ-45 and USB console port. + +On/Off Aux Gi0/1 + + +2 NIM Slots + + + + + + + +USB RS-45 +Console +Gi0/0 +(RJ-45 or SFP) + + + +2-Port Serial NIM +Figure 15-3 Photos of a Model 4321 Cisco Integrated Services Router (ISR) + +Answers to the “Do I Know This Already?” quiz: 1 B, E 2 B 3 A, C 4 C 5 C, E 6 B + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 15: Operating Cisco Routers 353 + +The figure shows an important feature for using routers to connect to both Ethernet LANs and Ethernet WAN services. Look closely at Figure 15-3’s Gigabit interfaces. Gi0/1 refers to interface GigabitEthernet0/1 and is an RJ-45 port that supports UTP cabling only. However, interface Gi0/0 (short for GigabitEthernet0/0) has some interesting features: + +■ The router has two ports for one interface (Gi0/0). 15 ■ You can use one or the other at any point in time, but not both. +■ One physical port is an RJ-45 port that supports copper cabling (implying that it is used to connect to a LAN). +■ The other Gi0/0 physical port is a Small Form Pluggable (SFP) port that would support vari-ous fiber Ethernet standards, allowing the port to be used for Ethernet WAN purposes. + +Cisco commonly makes one or more of the Ethernet ports on its Enterprise class routers support SFPs so that the engineer can choose an SFP that supports the type of Ethernet cabling provided by the Ethernet WAN service provider. + +NOTE When building a lab network to study for CCNA or CCNP, because your devices will be in the same place, you can create Ethernet WAN links by using the RJ-45 ports and a UTP cable without the need to purchase an SFP for each router. + +Physical Installation +Armed with the cabling details in images like Figure 15-2 and the router hardware details in photos like Figure 15-3, you can physically install a router. To install a router, follow these steps: +Step 1. For any Ethernet LAN interface, connect the RJ-45 connector of an appropriate copper Ethernet cable between the RJ-45 Ethernet port on the router and one of the LAN switch ports. +Step 2. For any serial WAN ports: + +A. If using an external CSU/DSU, connect the router’s serial interface to the CSU/DSU and the CSU/DSU to the line from the telco. + +B. If using an internal CSU/DSU, connect the router’s serial interface to the line from the telco. + +Step 3. For any Ethernet WAN ports: + +A. When ordering the Ethernet WAN service, confirm the required Ethernet standard and SFP type required to connect to the link, and order the SFPs. + +B. Install the SFPs into the routers, and connect the Ethernet cable for the Ethernet WAN link to the SFP on each end of the link. + +Step 4. Connect the router’s console port to a PC (as discussed in Chapter 4, “Using the Command-Line Interface”), as needed, to configure the router. +Step 5. Connect a power cable from a power outlet to the power port on the router. + +Step 6. Power on the router. + +Note that Cisco enterprise routers typically have an on/off switch, while switches do not. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +354 CCNA 200-301 Official Cert Guide, Volume 1 + +Installing SOHO Routers +The terms enterprise router and small office/home office (SOHO) router act as a pair of contrasting categories for routers, both in terms of how vendors like Cisco provide to the market, and how enterprises use and configure those devices. The term enterprise router typically refers to a router that a company would use in a permanent business location, while a SOHO router would reside at an employee’s home or at a small permanent site with just a few people. However, as you might guess, the line between a router acting as an enterprise router and a SOHO router is blurry, so use these terms as general categories. + +Even with that general comparison, SOHO routers typically have two features that an enter-prise router would be less likely to have: + +■ SOHO routers almost always use the Internet and virtual private network (VPN) technol-ogy for their WAN connections to send data back and forth to the rest of the Enterprise. +■ SOHO routers almost always use a multifunction device that does routing, LAN switch-ing, VPN, wireless, and maybe other features. + +For instance, at an enterprise business location, the building may contain enterprise routers, separate Ethernet switches, and separate wireless access points (AP), all connected together. At a permanent business site with four employees and 10 total devices in the network, one SOHO router could provide all those same features in one device. + +For instance, Figure 15-4 shows a typical SOHO site. The three icons that represent a router, switch, and access point actually all exist inside one box; the figure just shows them sepa-rately to emphasize the fact that the one SOHO router provides several functions. On the left, the SOHO router provides wired and wireless LAN servers, and on the right, it provides WAN access through a cable Internet connection. + +SOHO Router Internal Functions + +Access Point + + +UTP + + +UTP Switch UTP + + +CATV Cable +R1 UTP +Router Cable Modem + + + +ISP/Internet + + +Figure 15-4 Devices in a SOHO Network with High-Speed CATV Internet + +Figure 15-4 does not reflect the physical reality of a SOHO router, so Figure 15-5 shows one cabling example. The figure shows user devices on the left, connecting to the router via wireless or via Ethernet UTP cabling. On the right in this case, the router uses an external +cable modem to connect to the coaxial cable provided by the ISP. Then the router must use a normal UTP Ethernet port to connect a short Ethernet cable between the SOHO router and the cable modem. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 15: Operating Cisco Routers 355 + +SOHO + + + + + + +UTP R1 UTP + + +CATV Cable (Coaxial) + +ISP/Internet 15 + + +Figure 15-5 SOHO Network, Using Cable Internet and an Integrated Device + +Enabling IPv4 Support on Cisco Router Interfaces Routers support a relatively large number of features, with a large number of configuration +and EXEC commands to support those features. You will learn about many of these features throughout the rest of this book. + +NOTE For perspective, the Cisco router documentation includes a command reference, with an index to every single router command. A quick informal count of a recent IOS ver-sion listed around 5000 CLI commands. + +This second section of the chapter focuses on commands related to router interfaces. To make routers work—that is, to route IPv4 packets—the interfaces must be configured. This section introduces the most common commands that configure interfaces, make them work, and give the interfaces IP addresses and masks. + +Accessing the Router CLI +Accessing a router’s command-line interface (CLI) works much like a switch. In fact, it works so much like accessing a Cisco switch CLI that this book relies on Chapter 4 instead of repeating the same details here. If the details from Chapter 4 are not fresh in your memory, +it might be worthwhile to spend a few minutes briefly reviewing that chapter as well as Chapter 7, “Configuring and Verifying Switch Interfaces,” before reading further. + +Cisco switches and routers share many of the same CLI navigation features and many of the same configuration commands for management features. The following list mentions the highlights: + +■ User and Enable (privileged) mode +■ Entering and exiting configuration mode, using the configure terminal, end, and exit commands and the Ctrl+Z key sequence +■ Configuration of console, Telnet (vty), and enable secret passwords +■ Configuration of Secure Shell (SSH) encryption keys and username/password login credentials +■ Configuration of the hostname and interface description +■ Configuration of Ethernet interfaces that can negotiate speed using the speed and duplex commands + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +356 CCNA 200-301 Official Cert Guide, Volume 1 + +■ Configuration of an interface to be administratively disabled (shutdown) and administra-tively enabled (no shutdown) +■ Navigation through different configuration mode contexts using commands like line console 0 and interface type number +■ CLI help, command editing, and command recall features +■ The meaning and use of the startup-config (in NVRAM), running-config (in RAM), and external servers (like TFTP), along with how to use the copy command to copy the con-figuration files and IOS images + +At first glance, this list seems to cover most everything you have read so far in this book about the switch CLI. However, a couple of topics do work differently with the router CLI as compared to the switch CLI, as follows: + +■ The configuration of IP addresses differs in some ways, with switches using a VLAN interface and routers using an IP address configured on each working interface. +■ Many Cisco router models have an auxiliary (Aux) port, intended to be connected to an external modem and phone line to allow remote users to dial in to the router, and access the CLI, by making a phone call. Cisco switches do not have auxiliary ports. +■ Router IOS defaults to disallow both Telnet and SSH into the router because of the typi-cal router default setting of transport input none in vty configuration mode. (Cisco Catalyst LAN switches typically default to allow both Telnet and SSH.) Chapter 6, “Configuring Basic Switch Management,” already discussed the various options on this command to enable Telnet (transport input telnet), SSH (transport input ssh), or both (transport input all or transport input telnet ssh). + +The router CLI also differs from a switch CLI just because switches and routers do different things. For example: + +■ Cisco Layer 2 switches support the show mac address-table command, while Cisco rout-ers do not. +■ Cisco routers support the show ip route command, while Cisco Layer 2 switches do not. +■ Cisco Layer 2 switches use the show interfaces status command to list one line of output per interface (and routers do not), while routers use the show ip interface brief command to list similar information (but switches do not). + +Note also that some Cisco devices perform both Layer 2 switching and Layer 3 routing, and those devices support both router and switch commands. Chapter 17, “IP Routing in the LAN,” discusses one such device, a Layer 3 switch, in more detail. + +Router Interfaces +One minor difference between Cisco switches and routers is that routers support a much wider variety of interfaces. Today, LAN switches support Ethernet LAN interfaces of vari-ous speeds. Routers support a variety of other types of interfaces, including serial interfaces, cable TV, DSL, 3G/4G wireless, and others not mentioned in this book. + +Most Cisco routers have at least one Ethernet interface of some type. Many of those Ethernet interfaces support multiple speeds and use autonegotiation, so for consistency, the + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 15: Operating Cisco Routers 357 + +router IOS refers to these interfaces based on the fastest speed. For example, a 10-Mbps-only Ethernet interface would be configured with the interface ethernet number configura-tion command, a 10/100 interface with the interface fastethernet number command, and a 10/100/1000 interface with the interface gigabitethernet number command. However, when +discussing these interfaces all together, engineers would simply call them ethernet inter- +faces, regardless of the maximum speed. 15 + +Some Cisco routers have serial interfaces. As you might recall from Chapter 3, Cisco routers use serial interfaces to connect to a serial link. Each point-to-point serial link can then use High-Level Data Link Control (HDLC, the default) or Point-to-Point Protocol (PPP). + +Routers refer to interfaces in many commands, first by the type of interface (Ethernet, Fast Ethernet, Gigabit Ethernet, Serial, and so on) and then with a unique number of that router. Depending on the router model, the interface numbers might be a single number, two num-bers separated by a slash, or three numbers separated by slashes. For example, all three of the following configuration commands are correct on at least one model of Cisco router: + +interface ethernet 0 interface fastethernet 0/1 interface gigabitethernet 0/0 +interface gigabitethernet 0/1/0 interface serial 1/0/1 + +Two of the most common commands to display the interfaces, and their status, are the show ip interface brief and show interfaces commands. The first of these commands dis-plays a list with one line per interface, with some basic information, including the interface IP address and interface status. The second command lists the interfaces, but with a large amount of information per interface. Example 15-1 shows a sample of each command. The output comes from a 2900-series ISR router, used in many examples in this book; note that +it has both a Gi0/0 interface and a Gi0/1/0 interface, showing a case with both two-digit and three-digit interface identifiers. + +Example 15-1 Listing the Interfaces in a Router + +R1# show ip interface brief +Interface IP-Address OK? Method Status Protocol +Embedded-Service-Engine0/0 unassigned YES NVRAM administratively down down +GigabitEthernet0/0 172.16.1.1 YES NVRAM up up +GigabitEthernet0/1 unassigned YES NVRAM administratively down down +Serial0/0/0 172.16.4.1 YES manual up up +Serial0/0/1 unassigned YES unset administratively down down +GigabitEthernet0/1/0 172.16.5.1 YES NVRAM up up + +R1# show interfaces gigabitEthernet 0/1/0 +GigabitEthernet0/1/0 is up, line protocol is up +Hardware is EHWIC-1GE-SFP-CU, address is 0201.a010.0001 (bia 30f7.0d29.8570) +Description: Link in lab to R3's G0/0/0 +Internet address is 172.16.5.1/24 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +358 CCNA 200-301 Official Cert Guide, Volume 1 + +MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +Full Duplex, 1Gbps, media type is RJ45 +output flow-control is XON, input flow-control is XON +ARP type: ARPA, ARP Timeout 04:00:00 +Last input 00:00:29, output 00:00:08, output hang never +Last clearing of "show interface" counters never +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo +Output queue: 0/40 (size/max) +5 minute input rate 0 bits/sec, 0 packets/sec +5 minute output rate 0 bits/sec, 0 packets/sec +12 packets input, 4251 bytes, 0 no buffer +Received 12 broadcasts (0 IP multicasts) +0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 watchdog, 0 multicast, 0 pause input +55 packets output, 8098 bytes, 0 underruns +0 output errors, 0 collisions, 0 interface resets +0 unknown protocol drops +0 babbles, 0 late collision, 0 deferred +0 lost carrier, 0 no carrier, 0 pause output +0 output buffer failures, 0 output buffers swapped out + + + +NOTE Commands that refer to router interfaces can be significantly shortened by truncating the words. For example, sh int gi0/0 or sh int g0/0 can be used instead of show interfaces gigabitethernet 0/0. In fact, many network engineers, when looking over someone’s shoulder, would say something like “just do a show int G-i-oh-oh command” in this case, rather than speaking the long version of the command. + +Also, note that the show interfaces command lists a text interface description on about the third line, if configured. In this case, interface G0/1/0 had been previously configured with the description Link in lab to R3’s G0/0/0 command in interface configuration mode for interface G0/1/0. The description interface subcommand provides an easy way to keep small notes about what router interfaces connect to which neighboring devices, with the show interfaces command listing that information. + +Interface Status Codes +Each interface has two interface status codes. To be usable, the two interface status codes must be in an “up” state. The first status code refers essentially to whether Layer 1 is work-ing, and the second status code mainly (but not always) refers to whether the data-link layer protocol is working. Table 15-2 summarizes these two status codes. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 15: Operating Cisco Routers 359 + +Table 15-2 Interface Status Codes and Their Meanings + +Name +Line status +Protocol status + +Location +First status code +Second status code + +General Meaning +Refers to the Layer 1 status. (For example, is the cable installed, is it the right/wrong cable, is the device on the other end powered on?) +Refers generally to the Layer 2 status. It is always down if the line 15 status is down. If the line status is up, a protocol status of down is +usually caused by a mismatched data-link layer configuration. + + + +Several combinations of interface status codes exist, as summarized in Table 15-3. The table lists the status codes in order, from being disabled on purpose by the configuration to a fully working state. + +Table 15-3 Typical Combinations of Interface Status Codes + +Line Status + +Administratively down +Down + + + + + +Up + + + +Up + +Protocol Status +Down + +Down + + + + + +Down + + + +Up + +Typical Reasons + +The interface has a shutdown command configured on it. + +The interface is not shutdown, but the physical layer has a problem. For example, no cable has been attached to the +interface, or with Ethernet, the switch interface on the other end of the cable is shut down, or the switch is powered +off, or the devices on the ends of the cable use a different transmission speed. +Almost always refers to data-link layer problems, most often configuration problems. For example, serial links have this combination when one router was configured to use PPP and the other defaults to use HDLC. +Layer 1 and Layer 2 of this interface are functioning. + + + +For some examples, look back at Example 15-1’s show ip interface brief command, to the three interfaces in the following list. The interfaces in this list each have a different combina-tion of interface status codes; the list details the specific reasons for this status code in the lab used to create this example for the book. + +G0/0: The interface is down/down, in this case because no cable was connected to the interface. +G0/1: The interface is administratively down/down, because the configuration includes the shutdown command under the G0/1 interface. +S0/0/0: The interface is up/up because a serial cable is installed, is connected to another router in a lab, and is working. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +360 CCNA 200-301 Official Cert Guide, Volume 1 + +Router Interface IP Addresses +Cisco enterprise routers require at least some configuration beyond the default configuration before they will do their primary job: routing IP packets. The following facts tell us that to make a router ready to route IPv4 packets on an interface, you need to enable the interface and assign it an IPv4 address: + +■ Most Cisco router interfaces default to a disabled (shutdown) state and should be enabled with the no shutdown interface subcommand. +■ Cisco routers do not route IP packets in or out an interface until an IP address and mask have been configured; by default, no interfaces have an IP address and mask. +■ Cisco routers attempt to route IP packets for any interfaces that are in an up/up state and that have an IP address/mask assigned. + +To configure the address and mask, simply use the ip address address mask interface sub-command. Figure 15-6 shows a simple IPv4 network with IPv4 addresses on Router R1, with Example 15-2 showing the matching configuration. + +172.16.2.___ + + + +172.16.1.___ +172.16.4.1 + +.1 .101 +R2 .102 + + +.11 .1 S0/0/0 +G0/0 R1 G0/1 172.16.3.___ + + +172.16.5.1 +.1 +R3 + + +.101 + +.102 + + +Figure 15-6 IPv4 Addresses Used in Example 15-2 + +Example 15-2 Configuring IP Addresses on Cisco Routers + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1config)# interface G0/0 +R1(config-if)# ip address 172.16.1.1 255.255.255.0 +R1(config-if)# no shutdown +R1(config-if)# interface S0/0/0 +R1(config-if)# ip address 172.16.4.1 255.255.255.0 +R1(config-if)# no shutdown +R1(config-if)# interface G0/1/0 +R1(config-if)# ip address 172.16.5.1 255.255.255.0 +R1(config-if)# no shutdown +R1(config-if)# ^Z +R1# + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 15: Operating Cisco Routers 361 + +Example 15-3 shows the output of the show protocols command. This command confirms the state of each of the three R1 interfaces in Figure 15-6 and the IP address and mask con-figured on those same interfaces. + +Example 15-3 Verifying IP Addresses on Cisco Routers +R1# show protocols 15 Global values: +Internet Protocol routing is enabled +Embedded-Service-Engine0/0 is administratively down, line protocol is down +GigabitEthernet0/0 is up, line protocol is up +Internet address is 172.16.1.1/24 +GigabitEthernet0/1 is administratively down, line protocol is down +Serial0/0/0 is up, line protocol is up +Internet address is 172.16.4.1/24 +Serial0/0/1 is administratively down, line protocol is down +GigabitEthernet0/1/0 is up, line protocol is up +Internet address is 172.16.1.1/24 + + +One of the first actions to take when verifying whether a router is working is to find the interfaces, check the interface status, and check to see whether the correct IP addresses and masks are used. Examples 15-1 and 15-3 showed samples of the key show commands, while Table 15-4 summarizes those commands and the types of information they display. + +Table 15-4 Key Commands to List Router Interface Status + +Command + +show ip interface brief + +show protocols [type number] + +show interfaces [type number] + +Lines of Output per Interface +1 + +1 or 2 + +Many + +IP Configuration Listed +Address + +Address/mask + +Address/mask + +Interface Status Listed? +Yes + +Yes + +Yes + + + + +Bandwidth and Clock Rate on Serial Interfaces +Cisco has included serial WAN topics in the CCNA exam topic list since its inception in 1998 until the CCNA 200-301 release in the year 2019. Because the CCNA 200-301 exam is the first to not mention serial technologies at all, this book includes some examples that show serial links. The exam might show them with the expectation that you at least under-stand basics, such as the fact that two routers can send data over a serial link if the router interfaces on both ends are up/up and the routers have IP addresses in the same subnet. + +However, some of you will want to make serial links work in a lab because you have some serial interface cards in your lab. If so, take the time to look at a few pages in the section titled “Bandwidth and Clock Rate on Serial Interfaces,” in Appendix J, “Topics from Previous Editions,” which shows how to cable and configure a WAN serial link in the lab. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +362 CCNA 200-301 Official Cert Guide, Volume 1 + +Router Auxiliary Port +Both routers and switches have a console port to allow administrative access, but most Cisco routers have an extra physical port called an auxiliary (Aux) port. The Aux port typically serves as a means to make a phone call to connect into the router to issue commands from the CLI. + +The Aux port works like the console port, except that the Aux port is typically connected through a cable to an external analog modem, which in turn connects to a phone line. Then, the engineer uses a PC, terminal emulator, and modem to call the remote router. After being connected, the engineer can use the terminal emulator to access the router CLI, starting in user mode as usual. + +Aux ports can be configured beginning with the line aux 0 command to reach aux line configuration mode. From there, all the commands for the console line, covered mostly in Chapter 6, can be used. For example, the login and password password subcommands on the aux line could be used to set up simple password checking when a user dials in. + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 15-5 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 15-5 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review command tables + +Review memory tables + +Do labs + +Watch video + +Resource Used Book, website +Book, website + +Book, PTP + +Book + +Website + +Blog + +Website + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 15: Operating Cisco Routers 363 + +Review All the Key Topics + + +Table 15-6 Key Topic +List + +List + +List + +Table 15-2 + +Table 15-3 + +Table 15-4 + +Key Topics for Chapter 15 Description +Steps required to install a router + +Similarities between a router CLI and a switch CLI + +Items covered for switches in Chapters 4 and 6 that differ in some way on routers +Router interface status codes and their meanings + +Combinations of the two interface status codes and the likely reasons for each combination +Commands useful to display interface IPv4 addresses, masks, and interface status + + +Page Number +353 15 355 +356 + +359 + +359 + +361 + + + +Key Terms You Should Know +enterprise router, SOHO router, Integrated Services Router (ISR) + +Command References +Tables 15-7 and 15-8 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + +Table 15-7 +Command + + +Chapter 15 Configuration Command Reference +Description + + + +interface type number + +ip address address mask + +[no] shutdown + +duplex {full | half | auto} + + +speed {10 | 100 | 1000} + + +description text + +Global command that moves the user into configuration mode of the named interface. +Interface subcommand that sets the router’s IPv4 address and mask. +Interface subcommand that enables (no shutdown) or disables (shutdown) the interface. +Interface command that sets the duplex, or sets the use of IEEE autonegotiation, for router LAN interfaces that support multiple speeds. +Interface command for router Gigabit (10/100/1000) interfaces that sets the speed at which the router interface sends and receives data. +An interface subcommand with which you can type a string of text to document information about that particular interface. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +364 CCNA 200-301 Official Cert Guide, Volume 1 + + +Table 15-8 +Command + +Chapter 15 EXEC Command Reference +Purpose + + + +show interfaces [type number] + +show ip interface brief + + + +show protocols [type number] + +Lists a large set of informational messages about each interface, or about the one specifically listed interface. +Lists a single line of information about each interface, including the IP address, line and protocol status, and the method with which the address was configured (manual or Dynamic Host Configuration Protocol [DHCP]). +Lists information about the listed interface (or all interfaces if the interface is omitted), including the IP address, mask, and line/protocol status. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 16 + + +Configuring IPv4 Addresses and Static Routes + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +3.0 IP Connectivity +3.1 Interpret the components of routing table + +3.1.a Routing protocol code + +3.1.b Prefix + +3.1.c Network mask + +3.1.d Next hop + +3.1.e Administrative distance + +3.1.f Metric + +3.1.g Gateway of last resort + +3.2 Determine how a router makes a forwarding decision by default + +3.2.a Longest match + +3.2.b Administrative distance + +3.3 Configure and verify IPv4 and IPv6 static routing + +3.3.a Default route + +3.3.b Network route + +3.3.c Host route + +3.3.d Floating static + +Routers route IPv4 packets. That simple statement actually carries a lot of hidden meaning. For routers to route packets, routers follow a routing process. That routing process relies on information called IP routes. Each IP route lists a destination—an IP network, IP subnet, or some other group of IP addresses. Each route also lists instructions that tell the router where to forward packets sent to addresses in that IP network or subnet. For routers to do a good job of routing packets, routers need to have a detailed, accurate list of IP routes. + +Routers use three methods to add IPv4 routes to their IPv4 routing tables. Routers first learn connected routes, which are routes for subnets attached to a router interface. Routers can + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +also use static routes, which are routes created through a configuration command (ip route) that tells the router what route to put in the IPv4 routing table. And routers can use a routing protocol, in which routers tell each other about all their known routes, so that all routers can learn and build routes to all networks and subnets. + +This chapter examines IP routing in depth with the most straightforward routes that can be added to a router’s routing table. The router starts with a detailed look at the IP packet +routing (forwarding process)—a process that relies on each router having useful IP routes in their routing tables. The second section then examines connected routes, which are routes to subnets that exist on the interfaces connected to the local router. The third section then examines static routes, which are routes the network engineer configures directly. The chap-ter ends with a section that looks more specifically at the IP routing process in a router, how it matches packets to the routing table, and how to interpret all the details in the output of the show ip route command. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 16-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section IP Routing +Configuring Connected Routes + +Configuring Static Routes + +IP Forwarding with the Longest Prefix Match + +Questions 1 +2 + +3–5 + +6 + + + +1. Router R1 lists a route in its routing table. Which of the following answers list a fact from a route that the router uses when matching the packet’s destination address? (Choose two answers.) +a. Mask +b. Next-hop router c. Subnet ID +d. Outgoing interface + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +368 CCNA 200-301 Official Cert Guide, Volume 1 + +2. After configuring a working router interface with IP address/mask 10.1.1.100/26, which of the following routes would you expect to see in the output of the show ip route command? (Choose two answers.) +a. A connected route for subnet 10.1.1.64 255.255.255.192 b. A connected route for subnet 10.1.1.0 255.255.255.0 +c. A local route for host 10.1.1.100 255.255.255.192 d. A local route for host 10.1.1.100 255.255.255.255 e. A local route for host 10.1.1.64 255.255.255.255 +3. An engineer configures a static IPv4 route on Router R1. Which of the following pieces of information should not be listed as a parameter in the configuration command that creates this static IPv4 route? +a. The destination subnet’s subnet ID b. The next-hop router’s IP address +c. The next-hop router’s neighboring interface d. The subnet mask +4. Which of the following commands correctly configures a static route? a. ip route 10.1.3.0 255.255.255.0 10.1.130.253 +b. ip route 10.1.3.0 serial 0 +c. ip route 10.1.3.0 /24 10.1.130.253 d. ip route 10.1.3.0 /24 serial 0 +5. A network engineer configures the ip route 10.1.1.0 255.255.255.0 s0/0/0 command on a router and then issues a show ip route command from enable mode. No routes for subnet 10.1.1.0/24 appear in the output. Which of the following could be true? +a. The ip route command has incorrect syntax and was rejected in config mode. b. Interface s0/0/0 is down. +c. The router has no up/up interfaces in Class A network 10.0.0.0. d. The ip route command is missing a next-hop router IP address. +6. A router lists the following partial output from the show ip route command. Out which interface will the router route packets destined to IP address 10.1.15.122? + +10.0.0.0/8 is variably subnetted, 8 subnets, 5 masks +O 10.1.15.100/32 [110/50] via 172.16.25.2, 00:00:04, GigabitEthernet0/0/0 +O 10.1.15.64/26 [110/100] via 172.16.25.129, 00:00:09, GigabitEthernet0/1/0 +O 10.1.14.0/23 [110/65] via 172.16.24.2, 00:00:04, GigabitEthernet0/2/0 +O 10.1.15.96/27 [110/65] via 172.16.24.129, 00:00:09, GigabitEthernet0/3/0 +O 0.0.0.0/0 [110/129] via 172.16.25.129, 00:00:09, GigabitEthernet0/0/0 + +a. G0/0/0 b. G0/1/0 c. G0/2/0 d. G0/3/0 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 369 + +Foundation Topics + +IP Routing +IP routing—the process of forwarding IP packets—delivers packets across entire TCP/IP net-works, from the device that originally builds the IP packet to the device that is supposed to receive the packet. In other words, IP routing delivers IP packets from the sending host to the destination host. +The complete end-to-end routing process relies on network layer logic on hosts and on rout- 16 ers. The sending host uses Layer 3 concepts to create an IP packet, forwarding the IP packet +to the host’s default gateway (default router). The process requires Layer 3 logic on the routers as well, by which the routers compare the destination address in the packet to their routing tables, to decide where to forward the IP packet next. + +The routing process also relies on data-link and physical details at each link. IP routing relies on serial WAN links, Ethernet WAN links, Ethernet LANs, wireless LANs, and many other networks that implement data-link and physical layer standards. These lower-layer devices and protocols move the IP packets around the TCP/IP network by encapsulating and transmitting the packets inside data-link layer frames. + +The previous two paragraphs summarize the key concepts about IP routing as introduced back in Chapter 3, “Fundamentals of WANs and IP Routing.” Next, this section reviews IP routing, while taking the discussion another step or two deeper, taking advantage of the additional depth of knowledge discussed in all the earlier chapters in this book. + +IPv4 Routing Process Reference +Because you already saw the basics back in Chapter 3, this section collects the routing process into steps for reference. The steps use many specific Ethernet LAN terms discussed in Parts II and III of this book and some IP addressing terms discussed in Part IV. The upcoming descriptions and example then discuss these summaries of routing logic to make sure that each step is clear. + +The routing process starts with the host that creates the IP packet. First, the host asks the question: Is the destination IP address of this new packet in my local subnet? The host uses its own IP address/mask to determine the range of addresses in the local subnet. Based on its own opinion of the range of addresses in the local subnet, a LAN-based host acts as follows: +Step 1. If the destination is local, send directly: + +A. Find the destination host’s MAC address. Use the already-known Address Reso-lution Protocol (ARP) table entry, or use ARP messages to learn the information. + +B. Encapsulate the IP packet in a data-link frame, with the destination data-link address of the destination host. + +Step 2. If the destination is not local, send to the default gateway: + +A. Find the default gateway’s MAC address. Use the already-known Address Reso-lution Protocol (ARP) table entry, or use ARP messages to learn the information. + +B. Encapsulate the IP packet in a data-link frame, with the destination data-link address of the default gateway. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +370 CCNA 200-301 Official Cert Guide, Volume 1 + +Figure 16-1 summarizes these same concepts. In the figure, host A sends a local packet directly to host D. However, for packets to host B, on the other side of a router and therefore in a different subnet, host A sends the packet to its default router (R1). (As a reminder, the terms default gateway and default router are synonyms.) + + + +Remote +R1 + +A +SW1 + + +Rest of +IPv4 B Network + + +Local D + + +Figure 16-1 Host Routing Logic Summary + +Routers have a little more routing work to do as compared with hosts. While the host logic began with an IP packet sitting in memory, a router has some work to do before getting to that point. With the following five-step summary of a router’s routing logic, the router takes the first two steps just to receive the frame and extract the IP packet, before thinking about the packet’s destination address at Step 3. The steps are as follows: +1. For each received data-link frame, choose whether or not to process the frame. Process it if +A. The frame has no errors (per the data-link trailer Frame Check Sequence [FCS] field). +B. The frame’s destination data-link address is the router’s address (or an appropriate multicast or broadcast address). +2. If choosing to process the frame at Step 1, de-encapsulate the packet from inside the data-link frame. +3. Make a routing decision. To do so, compare the packet’s destination IP address to the routing table and find the route that matches the destination address. This route identi-fies the outgoing interface of the router and possibly the next-hop router. +4. Encapsulate the packet into a data-link frame appropriate for the outgoing interface. When forwarding out LAN interfaces, use ARP as needed to find the next device’s MAC address. +5. Transmit the frame out the outgoing interface, as listed in the matched IP route. + +This routing process summary lists many details, but sometimes you can think about the routing process in simpler terms. For example, leaving out some details, this paraphrase of the step list details the same big concepts: + +The router receives a frame, removes the packet from inside the frame, decides where to forward the packet, puts the packet into another frame, and sends the frame. + + +Answers to the “Do I Know This Already?” quiz: 1 A, C 2 A, D 3 C 4 A 5 B 6 D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 371 + +To give you a little more perspective on these steps, Figure 16-2 breaks down the same five-step routing process as a diagram. The figure shows a packet arriving from the left, entering a router Ethernet interface, with an IP destination of host C. The figure shows the packet arriv-ing, encapsulated inside an Ethernet frame (both header and trailer). + + +Routing Table 3 + +2 4 16 IP Packet w/ Data + + +1 + +Eth IP Packet w/ Data Eth + + +5 +HDLC IP Packet w/ Data HDLC + + + +Ethernet + + +Router R1 + +FCS (Ethernet Trailer) HDLC To C (IP Header To C +To R1 (Ethernet Header) To R2 + + +Figure 16-2 Router Routing Logic Summary + +Router R1 processes the frame and packet as shown with the numbers in the figure, match-ing the same five-step process described just before the figure, as follows: +1. Router R1 notes that the received Ethernet frame passes the FCS check and that the destination Ethernet MAC address is R1’s MAC address, so R1 processes the frame. +2. R1 de-encapsulates the IP packet from inside the Ethernet frame’s header and trailer. 3. R1 compares the IP packet’s destination IP address to R1’s IP routing table. +4. R1 encapsulates the IP packet inside a new data-link frame, in this case, inside a High-Level Data Link Control (HDLC) header and trailer. +5. R1 transmits the IP packet, inside the new HDLC frame, out the serial link on the right. + + +NOTE This chapter uses several figures that show an IP packet encapsulated inside a data-link layer frame. These figures often show both the data-link header as well as the data-link trailer, with the IP packet in the middle. The IP packets all include the IP header, plus any encapsulated data. + + +An Example of IP Routing +The next several pages walk you through an example that discusses each routing step, in order, through multiple devices. The example uses a case in which host A (172.16.1.9) sends a packet to host B (172.16.2.9), with host routing logic and the five steps showing how R1 forwards the packet. + +Figure 16-3 shows a typical IP addressing diagram for an IPv4 network with typical address abbreviations. The diagram can get a little too messy if it lists the full IP address for every router interface. When possible, these diagrams usually list the subnet and then the last octet or two of the individual IP addresses—just enough so that you know the IP address but with + + +|||||||||||||||||||| +|||||||||||||||||||| + + +372 CCNA 200-301 Official Cert Guide, Volume 1 + +less clutter. For example, host A uses IP address 172.16.1.9, taking from subnet 172.16.1.0/24 (in which all addresses begin 172.16.1) and the .9 beside the host A icon. As another exam-ple, R1 uses address 172.16.1.1 on its LAN interface, 172.16.4.1 on one serial interface, and 172.16.5.1 on an Ethernet WAN interface. +Subnet 172.16.2.0/24 + + +Subnet 172.16.4.0/24 + +Subnet 172.16.1.0/24 + +G0/0 +S0/0/1 R2 .2 .2 + + +B .9 + + + +.9 A G0/0 .1 + +S0/0/0 .1 +R1 .1 +G0/1/0 +Subnet 172.16.3.0/24 + + + +.3 +G0/0/0 Subnet 172.16.5.0/24 + + +G0/0 R3 .3 + + +C .9 + + +Figure 16-3 IPv4 Network Used to Show Five-Step Routing Example + +Now on to the example, with host A (172.16.1.9) sending a packet to host B (172.16.2.9). + +Host Forwards the IP Packet to the Default Router (Gateway) +In this example, host A uses some application that sends data to host B (172.16.2.9). After host A has the IP packet sitting in memory, host A’s logic reduces to the following: + +■ My IP address/mask is 172.16.1.9/24, so my local subnet contains numbers 172.16.1.0– 172.16.1.255 (including the subnet ID and subnet broadcast address). +■ The destination address is 172.16.2.9, which is clearly not in my local subnet. ■ Send the packet to my default gateway, which is set to 172.16.1.1. +■ To send the packet, encapsulate it in an Ethernet frame. Make the destination MAC address be R1’s G0/0 MAC address (host A’s default gateway). + +Figure 16-4 pulls these concepts together, showing the destination IP address and destina-tion MAC address in the frame and packet sent by host A in this case. Note that the figure uses a common drawing convention in networking, showing an Ethernet as a few lines, hid-ing all the detail of the Layer 2 switches. + +Eth IP Packet Eth + + + +ARP Table +172.16.1.1 + + +0200.0101.0101 A + +IP=172.16.1.9/24 GW=172.16.1.1 + +To: 172.16.2.9 +To: 0200.0101.0101 + + + +G0/0 +172.16.1.1 R1 0200.0101.0101 + + +Figure 16-4 Host A Sends Packet to Host B + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 16: Configuring IPv4 Addresses and Static Routes + +Routing Step 1: Decide Whether to Process the Incoming Frame +Routers receive many frames in an interface, particularly LAN interfaces. However, a router can and should ignore some of those frames. So, the first step in the routing process begins with a decision of whether a router should process the frame or silently discard (ignore) the frame. + +First, the router does a simple but important check (Step 1A in the process summary) so that the router ignores all frames that had bit errors during transmission. The router uses the data-link trailer’s FCS field to check the frame, and if errors occurred in transmission, the router discards the frame. (The router makes no attempt at error recovery; that is, the router does not ask the sender to retransmit the data.) + +The router also checks the destination data-link address (Step 1B in the summary) to decide whether the frame is intended for the router. For example, frames sent to the router’s unicast MAC address for that interface are clearly sent to that router. However, a router can actually receive a frame sent to some other unicast MAC address, and routers should ignore these frames. + +For example, routers will receive some unicast frames sent to other devices in the VLAN just because of how LAN switches work. Think back to how LAN switches forward unknown unicast frames—frames for which the switch does not list the destination MAC address in the MAC address table. The LAN switch floods those frames. The result? Routers sometimes receive frames destined for some other device, with some other device’s MAC address listed as the destination MAC address. Routers should ignore those frames. + +In this example, host A sends a frame destined for R1’s MAC address. So, after the frame is received, and after R1 confirms with the FCS that no errors occurred, R1 confirms that the frame is destined for R1’s MAC address (0200.0101.0101 in this case). All checks have been passed, so R1 will process the frame, as shown in Figure 16-5. (Note that the large rectangle +in the figure represents the internals of Router R1.) + +373 + + + + + + + + + +16 + + + + +G0/0 +172.16.1.1 0200.0101.0101 + + + +Eth IP Packet Eth + +0200.0101.0101 +Is this my G0/0 MAC? + +FCS: Is this +frame unchanged? + + +S0/0/0 + + +S0/0/1 + +Router R1 + +Figure 16-5 Routing Step 1, on Router R1: Checking FCS and Destination MAC + +Routing Step 2: De-encapsulation of the IP Packet +After the router knows that it ought to process the received frame (per Step 1), the next step is relatively simple: de-encapsulating the packet. In router memory, the router no longer needs the original frame’s data-link header and trailer, so the router removes and discards them, leaving the IP packet, as shown in Figure 16-6. Note that the destination IP address remains unchanged (172.16.2.9). + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +374 CCNA 200-301 Official Cert Guide, Volume 1 + + + +IP Packet +G0/0 +I + + +Etthh IIPP PackeEt th + +S0/0/0 + +To: 172.16.2.9 + +Eth S0/0/1 + +Router R1 + +Figure 16-6 Routing Step 2 on Router R1: De-encapsulating the Packet + +Routing Step 3: Choosing Where to Forward the Packet +While routing Step 2 required little thought, Step 3 requires the most thought of all the steps. At this point, the router needs to make a choice about where to forward the packet next. That process uses the router’s IP routing table, with some matching logic to compare the packet’s destination address with the table. + +First, an IP routing table lists multiple routes. Each individual route contains several facts, which in turn can be grouped as shown in Figure 16-7. Part of each route is used to match the destination address of the packet, while the rest of the route lists forwarding instruc-tions: where to send the packet next. + + +IPv4 Routing Table S0/0/0 + +Subnet Mask Next Router Out Interface + + +G0/0 IPIP Packet + +172.16.2.9 + +172.16.1.0 /24 172.16.2.0 /24 172.16.3.0 /24 172.16.4.0 /24 172.16.5.0 /24 +Matching + + +None G0/0 172.16.4.2 S0/0/0 172.16.5.3 G0/1/0 None S0/0/0 None G0/1/0 +Forwarding S0/0/1 + + +Router R1 + +Figure 16-7 Routing Step 3 on Router R1: Matching the Routing Table + +Focus on the entire routing table for a moment, and notice the fact that it lists five routes. Earlier, Figure 16-3 showed the entire example network, with five subnets, so R1 has a route for each of the five subnets. + +Next, look at the part of the five routes that Router R1 will use to match packets. To fully define each subnet, each route lists both the subnet ID and the subnet mask. When matching the IP packet’s destination with the routing table, the router looks at the packet’s destination IP address (172.16.2.9) and compares it to the range of addresses defined by each subnet. Specifically, the router looks at the subnet and mask information; with a little math, the router can figure out in which of these subnets 172.16.2.9 resides (the route for subnet 172.16.2.0/24). + +Finally, look to the right side of the figure, to the forwarding instructions for these five routes. After the router matches a specific route, the router uses the forwarding information in the route to tell the router where to send the packet next. In this case, the router matched the route for subnet 172.16.2.0/24, so R1 will forward the packet out its own interface S0/0/0, to Router R2 next, listed with its next-hop router IP address of 172.16.4.2. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 375 + + +NOTE Routes for remote subnets typically list both an outgoing interface and next-hop router IP address. Routes for subnets that connect directly to the router list only the outgo-ing interface because packets to these destinations do not need to be sent to another router. + + +Routing Step 4: Encapsulating the Packet in a New Frame +At this point, the router knows how it will forward the packet. However, routers cannot for- +ward a packet without first wrapping a data-link header and trailer around it (encapsulation). 16 Encapsulating packets for serial links does not require a lot of thought, but the current +CCNA 200-301 exam does not require a lot from us. Point-to-point serial WAN links use either HDLC (the default) or PPP as the data-link protocol. However, we can ignore any data-link logic, even ignoring data-link addressing, because serial links have only two devices on the link: the sender and the then-obvious receiver; the data-link addressing does not matter. In this example, R1 forwards the packet out S0/0/0, after encapsulating the packet inside an HDLC frame, as shown in Figure 16-8. + +IP PIaPcket S0/0/0 + +G0/0 To: 172.16.2.9 +HDLC H IP Packet HDLC S0/0/1 +DLC IP +Router R1 + +Figure 16-8 Routing Step 4 on Router R1: Encapsulating the Packet + +Note that with some other types of data links, the router has a little more work to do at this routing step. For example, sometimes a router forwards packets out an Ethernet interface. To encapsulate the IP packet, the router would need to build an Ethernet header, and that Ethernet header’s destination MAC address would need to list the correct value. + +For example, consider a packet sent by that same PC A (172.16.1.19) in Figure 16-3 but with a destination of PC C (172.16.3.9). When R1 processes the packet, R1 matches a route that tells R1 to forward the packet out R1’s G0/1/0 Ethernet interface to 172.16.5.3 (R3) next. R1 needs to put R3’s MAC address in the header, and to do that, R1 uses its IP ARP table infor-mation, as shown in Figure 16-9. If R1 did not have an ARP table entry for 172.16.5.3, R1 would first have to use ARP to learn the matching MAC address. + +Subnet 172.16.1.0/24 Subnet 172.16.5.0/24 Subnet 172.16.3.0/24 + + +.9 A G0/0 G0/1/0 .1 R1 .1 + + +G0/0/0 G0/0 .3 R3 .3 + + +C .9 + + +ARP Table Eth IP Packet Eth +172.16.5.3 0200.0303.9999 To: 172.16.3.9 +To: 0200.0303.9999 + +Figure 16-9 Routing Step 4 on Router R1 with a LAN Outgoing Interface + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +376 CCNA 200-301 Official Cert Guide, Volume 1 + +Routing Step 5: Transmitting the Frame +After the framehas been prepared, the router simply needs to transmit the frame. The router might have to wait, particularly if other frames are already waiting their turn to exit the interface. + +Configuring IP Addresses and Connected Routes +Cisco routers enable IPv4 routing globally, by default. Then, to make the router be ready to route packets on a particular interface, the interface must be configured with an IP address and the interface must be configured such that it comes up, reaching a “line status up, line protocol up” state. Only at that point can routers route IP packets in and out a particular interface. + +After a router can route IP packets out one or more interfaces, the router needs some routes. Routers can add routes to their routing tables through three methods: + +Connected routes: Added because of the configuration of the ip address interface sub-command on the local router +Static routes: Added because of the configuration of the ip route global command on the local router +Routing protocols: Added as a function by configuration on all routers, resulting in a pro-cess by which routers dynamically tell each other about the network so that they all learn routes +This second of three sections discusses several variations on how to configure connected routes, while the next major section discusses static routes. + +Connected Routes and the ip address Command +A Cisco router automatically adds a route to its routing table for the subnet connected to each interface, assuming that the following two facts are true: + +■ The interface is in a working state. In other words, the interface status in the show interfaces command lists a line status of up and a protocol status of up. +■ The interface has an IP address assigned through the ip address interface subcommand. + +The concept of connected routes is relatively basic. The router, of course, needs to know the subnet number connected to each of its interfaces, so the router can route packets to that subnet. The router does the math, taking the interface IP address and mask and calculating the subnet ID. However, the router only needs that route when the interface is up and work-ing, so the router includes a connected route in the routing table only when the interface is working. + +Example 16-1 shows the connected routes on Router R1 in Figure 16-10. The first part of the example shows the configuration of IP addresses on all three of R1’s interfaces. The end of the example lists the output from the show ip route command, which lists these routes with a c as the route code, meaning connected. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 377 + +Subnet 172.16.2.0/24 + + +Subnet 172.16.4.0/24 + +Subnet 172.16.1.0/24 + +G0/0 +S0/0/1 R2 .2 .2 + + +B .9 + + + +.9 A G0/0 .1 + +S0/0/0 .1 +R1 .1 +G0/1/0 +Subnet 172.16.3.0/24 + + + + +16 + + + +.3 +G0/0/0 Subnet 172.16.5.0/24 + + +G0/0 R3 .3 + + +C .9 + + +Figure 16-10 Sample Network to Show Connected Routes + +Example 16-1 Connected and Local Routes on Router R1 + +! Excerpt from show running-config follows... +! +interface GigabitEthernet0/0 +ip address 172.16.1.1 255.255.255.0 +! +interface Serial0/0/0 +ip address 172.16.4.1 255.255.255.0 +! +interface GigabitEthernet0/1/0 +ip address 172.16.5.1 255.255.255.0 + +R1# show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP +a - application route ++ - replicated route, % - next hop override, p - overrides from PfR + +Gateway of last resort is not set + +172.16.0.0/16 is variably subnetted, 6 subnets, 2 masks +C 172.16.1.0/24 is directly connected, GigabitEthernet0/0 +L 172.16.1.1/32 is directly connected, GigabitEthernet0/0 +C 172.16.4.0/24 is directly connected, Serial0/0/0 +L 172.16.4.1/32 is directly connected, Serial0/0/0 +C 172.16.5.0/24 is directly connected, GigabitEthernet0/1/0 +L 172.16.5.1/32 is directly connected, GigabitEthernet0/1/0 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +378 CCNA 200-301 Official Cert Guide, Volume 1 + +Take a moment to look closely at each of the three highlighted routes in the output of show ip route. Each lists a C in the first column, and each has text that says “directly connected”; both identify the route as connected to the router. The early part of each route lists the matching parameters (subnet ID and mask), as shown in the earlier example in Figure 16-7. The end of each of these routes lists the outgoing interface. + +Note that the router also automatically produces a different kind of route, called a local route. The local routes define a route for the one specific IP address configured on the rout-er interface. Each local route has a /32 prefix length, defining a host route, which defines a route just for that one IP address. For example, the last local route, for 172.16.5.1/32, defines a route that matches only the IP address of 172.16.5.1. Routers use these local routes that list their own local IP addresses to more efficiently forward packets sent to the router itself. + +For the CCNA 200-301 exam, note that this example of the show ip route command reveals a few of the specific subitems within exam topic 3.1, with later examples revealing even more details. This section shows details related to the following terms from the exam topics: + +■ Routing Protocol Code: The legend at the top of the show ip route output (about nine lines) lists all the routing protocol codes (exam topic 3.1.a). This book references the codes for connected routes (C), local (L), static (S), and OSPF (O). +■ Prefix: The word prefix (exam topic 3.1.b) is just another name for subnet ID. +■ Mask: Each route lists a prefix (subnet ID) and network mask (exam topic 3.1.c) in prefix format, for example, /24. + +The ARP Table on a Cisco Router +After a router has added these connected routes, the router can route IPv4 packets between those subnets. To do so, the router makes use of its IP ARP table. + +The IPv4 ARP table lists the IPv4 address and matching MAC address of hosts connected to the same subnet as the router. When forwarding a packet to a host on the same subnet, the router encapsulates the packet, with a destination MAC address as found in the ARP table. If the router wants to forward a packet to an IP address on the same subnet as the router but does not find an ARP table entry for that IP address, the router will use ARP messages to learn that device’s MAC address. + +Example 16-2 shows R1’s ARP table based on the previous example. The output lists R1’s own IP address of 172.16.1.1, with an age of -, meaning that this entry does not time out. Dynamically learned ARP table entries have an upward counter, like the 35-minute value for the ARP table entry for IP address 172.16.1.9. By default, IOS will time out (remove) an ARP table entry after 240 minutes in which the entry is not used. (IOS resets the timer to 0 when an ARP table entry is used.) Note that to experiment in the lab, you might want to empty all dynamic entries (or a single entry for one IP address) using the clear ip arp [ip-address] EXEC command. + +Example 16-2 Displaying a Router’s IP ARP Table + +R2# show ip arp +Protocol Address Age (min) Hardware Addr Type Interface + +Internet +Internet + +172.16.1.1 +172.16.1.9 + +- 0200.2222.2222 ARPA +35 0200.3333.3333 ARPA + +GigabitEthernet0/0 +GigabitEthernet0/0 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 379 + +Thinking about how Router R1 forwards a packet to host A (172.16.1.9), over that final sub-net, R1 does the following: +1. R1 looks in its ARP table for an entry for 172.16.1.9. +2. R1 encapsulates the IP packet in an Ethernet frame, adding destination 0200.3333.3333 to the Ethernet header (as taken from the ARP table). +3. R1 transmits the frame out interface G0/0. + +Configuring Static Routes 16 All routers add connected routes, as discussed in the previous section. Then, most networks +use dynamic routing protocols to cause each router to learn the rest of the routes in an internetwork. Networks use static routes—routes added to a routing table through direct configuration—much less often than dynamic routing. However, static routes can be useful at times, and they happen to be useful learning tools as well. This next major section in the chapter discusses static routes. + +NOTE The CCNA 200-301 exam topic 3.2 breaks IPv4 (and IPv6) static routes into four subtopics: network routes, host routes, floating static routes, and default routes. This section explains all four types as noted in the upcoming headings. + + +Static Network Routes +IOS allows the definition of individual static routes using the ip route global configuration command. Every ip route command defines a destination that can be matched, usually with a subnet ID and mask. The command also lists the forwarding instructions, typically listing either the outgoing interface or the next-hop router’s IP address. IOS then takes that informa-tion and adds that route to the IP routing table. + +The static route is considered a network route when the destination listed in the ip route command defines a subnet, or an entire Class A, B, or C network. In contrast, a default route matches all destination IP addresses, while a host route matches a single IP address (that is, an address of one host.) + +As an example of a network route, Figure 16-11 shows a subset of the figure used through-out this chapter so far, with some unrelated details removed. The figure shows only the details related to a static network route on R1, for destination subnet 172.16.2.0/24, which sits on the far right. To create that static network route on R1, R1 will configure the subnet ID and mask, and either R1’s outgoing interface (S0/0/0) or R2 as the next-hop router IP address (172.16.4.2). +For Packets Destined to this Subnet + + + + +.9 1 + +Send out Here or… + +.1 +G0/0 R1 S0/0/0 + +Send to There + +172.16.4.2 +R2 + + +.2 +G0/0 + + + +2 .9 + + + +172.16.1.0/24 +Figure 16-11 + +172.16.4.0/24 172.16.2.0/24 +Static Route Configuration Concept + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +380 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 16-3 shows the configuration of a couple of sample static routes. In particular, it shows routes on Router R1 in Figure 16-12, for the two subnets on the right side of the figure. + +Subnet 172.16.2.0/24 + + +Subnet 172.16.4.0/24 + +Subnet 172.16.1.0/24 + +G0/0 +S0/0/1 R2 .2 .2 + + +B .9 + + + +.9 A G0/0 .1 + +S0/0/0 .1 +R1 .1 +G0/1/0 +Subnet 172.16.3.0/24 + + + +.3 +G0/0/0 Subnet 172.16.5.0/24 + + +G0/0 R3 .3 + + +C .9 + + +Figure 16-12 Sample Network Used in Static Route Configuration Examples + +Example 16-3 Static Routes Added to R1 + +ip route 172.16.2.0 255.255.255.0 S0/0/0 +ip route 172.16.3.0 255.255.255.0 172.16.5.3 + +The two example ip route commands show the two different styles of forwarding instruc-tions. The first command shows subnet 172.16.2.0, mask 255.255.255.0, which sits on a LAN near Router R2. That same first command lists R1’s S0/0/0 interface as the outgoing interface. This route basically states: To send packets to the subnet off Router R2, send them out my own local S0/0/0 interface (which happens to connect to R2). + +The second route has the same kind of logic, except for using different forwarding instruc-tions. Instead of referencing R1’s outgoing interface, it instead lists the neighboring router’s IP address on the WAN link as the next-hop router. This route basically says this: To send pack-ets to the subnet off Router R3, send them to R3—specifically, R3’s WAN IP address next. + +The routes created by these two ip route commands actually look a little different in the IP routing table compared to each other. Both are static routes. However, the route that used the outgoing interface configuration is also noted as a connected route; this is just a quirk of the output of the show ip route command. + +Example 16-4 lists these two routes using the show ip route static command. This command lists the details of static routes only, but it also lists a few statistics about all IPv4 routes. For example, the example shows two lines, for the two static routes configured in Example 16-4, but statistics state that this router has routes for eight subnets. +Example 16-4 Static Routes Added to R1 + +R1# show ip route static +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP ! lines omitted for brevity + +Gateway of last resort is not set + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 381 + +172.16.0.0/16 is variably subnetted, 8 subnets, 2 masks S 172.16.2.0/24 is directly connected, Serial0/0/0 +S 172.16.3.0/24 [1/0] via 172.16.5.3 + + +IOS adds and removes these static routes dynamically over time, based on whether the out-going interface is working or not. For example, in this case, if R1’s S0/0/0 interface fails, R1 removes the static route to 172.16.2.0/24 from the IPv4 routing table. Later, when the inter-face comes up again, IOS adds the route back to the routing table. +Note that most sites use a dynamic routing protocol to learn all the routes to remote subnets 16 rather than using static routes. However, when not using a dynamic routing protocol, the +engineer would need to configure static routes to each subnet on each router. For example, if the routers had only the configuration shown in the examples so far, PC A (from Figure 16-12) would not be able to receive packets back from PC B because Router R2 does not have a route for PC A’s subnet. R2 would need static routes for other subnets, as would R3. +Finally, note that static routes that will send packets out an Ethernet interface—LAN or WAN—should use the next-hop IP address option on the ip address command, as shown in Example 16-4. Routers expect their Ethernet interfaces to be able to reach any number of other IP addresses in the connected subnet. Referencing the next-hop router identifies the specific device in the connected subnet, while referencing the local router’s outgoing inter-face does not identify the specific neighboring router. + +Static Host Routes +Earlier, this chapter defined a host route as a route to a single host address. To configure such a static route, the ip route command uses an IP address plus a mask of 255.255.255.255 so that the matching logic matches just that one address. + +An engineer might use host routes to direct packets sent to one host over one path, with all other traffic to that host’s subnet over some other path. For instance, you could define these two static routes for subnet 10.1.1.0/24 and host 10.1.1.9, with two different next-hop addresses, as follows: + +ip route 10.1.1.0 255.255.255.0 10.2.2.2 ip route 10.1.1.9 255.255.255.255 10.9.9.9 + +Note that these two routes overlap: a packet sent to 10.1.1.9 that arrives at the router would match both routes. When that happens, routers use the most specific route (that is, the route with the longest prefix length). So, a packet sent to 10.1.1.9 would be forwarded to next-hop router 10.9.9.9, and packets sent to other destinations in subnet 10.1.1.0/24 would be sent to next-hop router 10.2.2.2. + +Note that the section “IP Forwarding with the Longest Prefix Match” later in this chapter gets into this topic in more detail. + +Floating Static Routes +Next, consider the case in which a static route competes with other static routes or routes learned by a routing protocol. That is, the ip route command defines a route to a subnet, but the router also knows of other static or dynamically learned routes to reach that same + + +|||||||||||||||||||| +|||||||||||||||||||| + + +382 CCNA 200-301 Official Cert Guide, Volume 1 + +subnet. In these cases, the router must first decide which routing source has the better administrative distance, with lower being better, and then use the route learned from the better source. + +To see how that works, consider the example illustrated in Figure 16-13, which shows a dif-ferent design than in the previous examples, this time with a branch office with two WAN links: one very fast Gigabit Ethernet link and one rather slow (but cheap) T1. In this design, the network uses Open Shortest Path First Version 2 (OSPFv2) over the primary link, learn-ing a route for subnet 172.16.2.0/24. R1 also defines a static route over the backup link to that exact same subnet, so R1 must choose whether to use the static route or the OSPF-learned route. + +Primary Link (OSPF) + +R2 +G0/0 EoMPLS + + +Subnet 172.16.2.0/24 + + + + +R1 +S0/0/1 + +Backup Link (T1; Static) R3 + +Core of the Enterprise Network + + +Figure 16-13 Using a Floating Static Route to Key Subnet 172.16.2.0/24 + +By default, IOS considers static routes better than OSPF-learned routes. By default, IOS gives static routes an administrative distance of 1 and OSPF routes an administrative distance of 110. Using these defaults in Figure 16-13, R1 would use the T1 to reach subnet 172.16.2.0/24 in this case, which is not the intended design. Instead, the engineer prefers to use the OSPF-learned routes over the much-faster primary link and use the static route over the backup link only as needed when the primary link fails. + +To instead prefer the OSPF routes, the configuration would need to change the administra-tive distance settings and use what many networkers call a floating static route. A floating static route floats or moves into and out of the IP routing table depending on whether the better (lower) administrative distance route learned by the routing protocol happens to exist currently. Basically, the router ignores the static route during times when the better routing protocol route is known. + +To implement a floating static route, you need to use a parameter on the ip route command that sets the administrative distance for just that route, making the value larger than the default administrative distance of the routing protocol. For example, the ip route 172.16.2.0 255.255.255.0 172.16.5.3 130 command on R1 would do exactly that—setting the static route’s administrative distance to 130. As long as the primary link stays up, and OSPF on R1 learns a route for 172.16.2.0/24, with a default administrative distance of 110, R1 ignores the static route. + +Finally, note that while the show ip route command lists the administrative distance of most routes, as the first of two numbers inside two brackets, the show ip route subnet command plainly lists the administrative distance. Example 16-5 shows a sample, matching this most recent example. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 383 + +Example 16-5 Displaying the Administrative Distance of the Static Route + +R1# show ip route static +! Legend omitted for brevity +172.16.0.0/16 is variably subnetted, 6 subnets, 2 masks +S 172.16.2.0/24 is directly connected, Serial0/0/1 + +R1# show ip route 172.16.2.0 +Routing entry for 172.16.2.0/24 +Known via "static", distance 130, metric 0 (connected) 16 Routing Descriptor Blocks: +* directly connected, via Serial0/0/1 +Route metric is 0, traffic share count is 1 + + +Static Default Routes +When a router tries to route a packet, the router might not match the packet’s destination IP address with any route. When that happens, the router normally just discards the packet. + +Routers can be configured so that they use either a statically configured or dynamically learned default route. The default route matches all packets, so that if a packet does not match any other more specific route in the routing table, the router can at least forward the packet based on the default route. + +One classic example in which companies might use static default routes in their enterprise TCP/IP networks is when the company has many remote sites, each with a single, relatively slow WAN connection. Each remote site has only one possible physical route to use to send packets to the rest of the network. So, rather than use a routing protocol, which sends mes-sages over the WAN and uses precious WAN bandwidth, each remote router might use a default route that sends all traffic to the central site, as shown in Figure 16-14. + +Send All Non-local Packets to Core + +S0/0/1 +B1 + +. Core . +. +. + + +B1000 + +Figure 16-14 Example Use of Static Default Routes at 1000 Low-Speed Remote Sites + +IOS allows the configuration of a static default route by using special values for the subnet and mask fields in the ip route command: 0.0.0.0 and 0.0.0.0. For example, the command +ip route 0.0.0.0 0.0.0.0 S0/0/1creates a static default route on Router B1—a route that matches all IP packets—and sends those packets out interface S0/0/1. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +384 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 16-6 shows an example of a static default route, using Router R2 from Figure +16-13. Earlier, that figure, along with Example 16-5, showed R1 with static routes to the two subnets on the right side of the figure. Example 16-6 completes the configuration of static IP routes by configuring R2, on the right side of Figure 16-13, with a static default route to route packets back to the routers on the left side of the figure. + +Example 16-6 Adding a Static Default Route on R2 (Figure 16-13) + +R2# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)# ip route 0.0.0.0 0.0.0.0 s0/0/1 +R2(config)# ^Z +R2# show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 0.0.0.0 to network 0.0.0.0 + +S* 0.0.0.0/0 is directly connected, Serial0/0/1 +172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks +C 172.16.2.0/24 is directly connected, GigabitEthernet0/0 +L 172.16.2.2/32 is directly connected, GigabitEthernet0/0 +C 172.16.4.0/24 is directly connected, Serial0/0/1 +L 172.16.4.2/32 is directly connected, Serial0/0/1 + + +The output of the show ip route command lists a few new and interesting facts. First, it lists the route with a code of S, meaning static, but also with a *, meaning it is a candidate default route. A router can learn about more than one default route, and the router then has to choose which one to use; the * means that it is at least a candidate to become the default route. Just above, the “Gateway of Last Resort” refers to the chosen default route, which in this case is the just-configured static route with outgoing interface S0/0/1. + +Troubleshooting Static Routes +These final few pages about IPv4 static routes examine some issues that can occur with stat-ic routes, both reviewing some reasons mentioned over the last few pages, while adding more detail. This topic breaks static route troubleshooting into three perspectives: + +■ The route is in the routing table but is incorrect. ■ The route is not in the routing table. +■ The route is in the routing table and is correct, but the packets do not arrive at the desti-nation host. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 16: Configuring IPv4 Addresses and Static Routes + +Troubleshooting Incorrect Static Routes That Appear in the IP Routing Table +This first troubleshooting item can be obvious, but it is worth pausing to think about. A static route is only as good as the input typed into the ip route command. IOS checks the syntax, and as mentioned earlier, makes a few other checks that this section reviews in the next heading. But once those checks are passed, IOS puts the route into the IP routing table, even if the route had poorly chosen parameters. + +For instance, the route might use a subnet and mask that implies a different range of address-es than the addresses in the destination subnet. Or, for a router sitting in the middle of a diagram, the next-hop address might be a router to the left, while the destination subnet is to the right. Or the next-hop address could be an IP address in a connected subnet, but it might be a typo and be an address of a PC or even a currently unused IP address. + +When you see an exam question that has static routes, and you see them in the output of show ip route, remember to check on these items: + +■ Is there a subnetting math error in the subnet ID and mask? +■ Is the next-hop IP address correct and referencing an IP address on a neighboring router? ■ Does the next-hop IP address identify the correct router? +■ Is the outgoing interface correct, and referencing an interface on the local router (that is, +the same router where the static route is configured)? + +385 + + + + + + + + + +16 + + +The Static Route Does Not Appear in the IP Routing Table +After configuring an ip route command, IOS might or might not add the route to the IP routing table. IOS also considers the following before adding the route to its routing table: + +■ For ip route commands that list an outgoing interface, that interface must be in an up/up state. +■ For ip route commands that list a next-hop IP address, the local router must have a route to reach that next-hop address. + +For example, earlier in Example 16-3, R1’s command ip route 172.16.3.0 255.255.255.0 172.16.5.3 defines a static route. Before adding the route to the IP routing table, R1 looks for an existing IP route to reach 172.16.5.3. In that case, R1 will find a connected route for sub-net 172.16.5.0/24 as long as its Ethernet WAN link is up. As a result, R1 adds the static route to subnet 172.16.3.0/24. Later, if R1’s G0/1/0 were to fail, R1 would remove its connected route to 172.16.5.0/24 from the IP routing table—an action that would also then cause R1 to remove its static route to 172.16.3.0/24. + +You can configure a static route so that IOS ignores these basic checks, always putting the +IP route in the routing table. To do so, just use the permanent keyword on the ip route com-mand. For example, by adding the permanent keyword to the end of the two commands as demonstrated in Example 16-7, R1 would now add these routes, regardless of whether the two WAN links were up. + +Example 16-7 Permanently Adding Static Routes to the IP Routing Table (Router R1) + +ip route 172.16.2.0 255.255.255.0 S0/0/0 permanent +ip route 172.16.3.0 255.255.255.0 172.16.5.3 permanent + + +|||||||||||||||||||| +|||||||||||||||||||| + + +386 CCNA 200-301 Official Cert Guide, Volume 1 + +Note that although the permanent keyword lets the router keep the route in the routing table without checking the outgoing interface or route to the next-hop address, it does not magically fix a broken route. For example, if the outgoing interface fails, the route will remain in the routing table, but the router cannot forward packets because the outgoing interface is down. + +The Correct Static Route Appears but Works Poorly +This last section is a place to make two points—one mainstream and one point to review a bit of trivia. + +First, on the mainstream point, the static route can be perfect, but the packets from one host to the next still might not arrive because of other problems. An incorrect static route is just one of many items to check when you’re troubleshooting problems like “host A cannot connect to server B.” The root cause may be the static route, or it may be something else. Chapter 18, “Troubleshooting IPv4 Routing,” goes into some depth about troubleshooting these types of problems. + +On the more specific point, be wary of any ip route command with the permanent key-word. IOS puts these routes in the routing table with no checks for accuracy. You should check whether the outgoing interface is down and/or whether the router has a route to reach the next-hop address. + +IP Forwarding with the Longest Prefix Match +A router’s IP routing process requires that the router compare the destination IP address of each packet with the existing contents of that router’s IP routing table. Often, only one route matches a particular destination address. When only one route matches the packet’s destina-tion, the action is obvious: forward the packet based on the details listed in that route. + +In some cases, a particular destination address matches more than one of the router’s routes. For instance, one route might list subnet 10.1.0.0/16, another 10.1.1.0/25, and another 10.1.1.1/32. All would match packets sent to IP address 10.1.1.1. Many legitimate router fea-tures can cause these multiple routes to appear in a router’s routing table, including + +■ Static routes +■ Route autosummarization +■ Manual route summarization + +This fourth of four major sections of this chapter explains how a router makes its routing decisions when a packet matches multiple routes. When more than one route matches a packet’s destination address, the router uses the “best” route, defined as follows: + +When a particular destination IP address matches more than one route in a router’s IPv4 routing table, the router uses the most specific route—in other words, the route with the longest prefix length mask. + +Using show ip route to Find the Best Route +We humans have a couple of ways to figure out what choice a router makes for choosing the best route. One way uses the show ip route command, plus some subnetting math, to decide + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 387 + +the route the router will choose. To let you see how to use this option, Example 16-8 shows a series of overlapping routes, all created with OSPF, so the output lists only OSPF-learned routes. + +Example 16-8 show ip route Command with Overlapping Routes + +R1# show ip route ospf +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 16 E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 172.16.25.129 to network 0.0.0.0 + +172.16.0.0/16 is variably subnetted, 9 subnets, 5 masks +O 172.16.1.1/32 [110/50] via 172.16.25.2, 00:00:04, GigabitEthernet0/0/0 +O 172.16.1.0/24 [110/100] via 172.16.25.129, 00:00:09, GigabitEthernet0/1/0 +O 172.16.0.0/22 [110/65] via 172.16.24.2, 00:00:04, GigabitEthernet0/2/0 +O 172.16.0.0/16 [110/65] via 172.16.24.129, 00:00:09, GigabitEthernet0/3/0 +O 0.0.0.0/0 [110/129] via 172.16.25.129, 00:00:09, GigabitEthernet0/0/0 + + +To predict which of its routes a router will match, two pieces of information are required: the destination IP address of the packet and the contents of the router’s routing table. The sub-net ID and mask listed for a route define the range of addresses matched by that route. With a little subnetting math, a network engineer can find the range of addresses matched by each route. For instance, Table 16-2 lists the five subnets listed in Example 16-8 and the address ranges implied by each. + +Table 16-2 Analysis of Address Ranges for the Subnets in Example 16-8 + +Subnet/Prefix 172.16.1.1/32 +172.16.1.0/24 + +172.16.0.0/22 + +172.16.0.0/16 + +0.0.0.0/0 + +Address Range +172.16.1.1 (just this one address) + +172.16.1.0 – 172.16.1.255 + +172.16.0.0 – 172.16.3.255 + +172.16.0.0 – 172.16.255.255 + +0.0.0.0 – 255.255.255.255 (all addresses) + + + + +NOTE The route listed as 0.0.0.0/0 is the default route. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +388 CCNA 200-301 Official Cert Guide, Volume 1 + +As you can see from these ranges, several of the routes’ address ranges overlap. When matching more than one route, the route with the longer prefix length is used. That is, a route with /16 is better than a route with /10; a route with a /25 prefix is better than a route with a /20 prefix; and so on. + +For example, a packet sent to 172.16.1.1 actually matches all five routes listed in the routing table in Example 16-8. The various prefix lengths range from /0 to /32. The longest pre- +fix (largest /P value, meaning the best and most specific route) is /32. So, a packet sent to 172.16.1.1 uses the route to 172.16.1.1/32, and not the other routes. + +The following list gives some examples of destination IP addresses. For each address, the list describes the routes from Table 16-2 that the router would match, and which specific route the router would use. + +172.16.1.1: Matches all five routes; the longest prefix is /32, the route to 172.16.1.1/32. 172.16.1.2: Matches the last four routes; the longest prefix is /24, the route to 172.16.1.0/24. 172.16.2.3: Matches the last three routes; the longest prefix is /22, the route to 172.16.0.0/22. 172.16.4.3: Matches the last two routes; the longest prefix is /16, the route to 172.16.0.0/16. +Using show ip route address to Find the Best Route +A second way to identify the route a router will use, one that does not require any subnet-ting math, is the show ip route address command. The last parameter on this command is the IP address of an assumed IP packet. The router replies by listing the route it would use to route a packet sent to that address. + +For example, Example 16-9 lists the output of the show ip route 172.16.4.3 command on the same router used in Example 24-4. The first line of (highlighted) output lists the +matched route: the route to 172.16.0.0/16. The rest of the output lists the details of that par-ticular route, like the outgoing interface of GigabitEthernet0/1/0 and the next-hop router of 172.16.25.129. + +Example 16-9 show ip route Command with Overlapping Routes + +R1# show ip route 172.16.4.3 +Routing entry for 172.16.0.0/16 +Known via "ospf 1", distance 110, metric 65, type intra area +Last update from 10.2.2.5 on GigabitEthernet0/2/0, 14:22:06 ago +Routing Descriptor Blocks: +* 172.16.25.129, from 172.16.25.129, 14:22:05 ago, via GigabitEthernet0/1/0 +Route metric is 65, traffic share count is 1 + + +Certainly, if you have an option, just using a command to check what the router actually chooses is a much quicker option than doing the subnetting math. + +Interpreting the IP Routing Table +The show ip route command plays a huge role in verifying and troubleshooting IP routing and addressing. This final topic of the chapter pulls the concepts together in one place for easier reference and study. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 389 + +Figure 16-15 shows the output of a sample show ip route command. The figure numbers various parts of the command output for easier reference, with Table 16-3 describing the output noted by each number. + +1 2 3 + + +10.0.0.0/8 is variably subnetted, 13 subnets, 5 masks +C 10.1.3.0/26 is directly connected, GigabitEthernet0/1 L 10.1.3.3/32 is directly connected, GigabitEthernet0/1 +O 10.1.4.64/26 [110/65] via 10.2.2.10, 14:31:52, Serial0/1/0 O 10.2.2.0/30 [110/128] via 10.2.2.5, 14:31:52, Serial0/0/1 + + + + +16 + +4 5 6 7 8 9 10 11 + +Figure 16-15 show ip route Command Output Reference + +Table 16-3 Descriptions of the show ip route Command Output +Item Idea Value in Description the Figure +1 Classful network 10.0.0.0/8 The routing table is organized by classful network. This line is the heading line for classful network 10.0.0.0; it lists the default mask for Class A networks (/8). + +2 Number of subnets + + +3 Number of masks +4 Legend code + +13 subnets + + + +5 masks + +C, L, O + +The number of routes for subnets of the classful network known to this router, from all sources, including local routes—the /32 routes that match each router interface IP address. +The number of different masks used in all routes known to this router inside this classful network. +A short code that identifies the source of the routing information. O is for OSPF, D for EIGRP, C for Connected, S for static, and L for local. (See Example 16-8 for a sample of the legend.) + +5 Prefix (Subnet ID) 10.2.2.0 The subnet number of this particular route. + + +6 Prefix length (Mask) +7 Administrative distance + + +8 Metric + +9 Next-hop router + +10 Timer + +11 Outgoing interface + +/30 + +110 + + + +128 + +10.2.2.5 + +14:31:52 + +Serial0/0/1 + +The prefix mask used with this subnet. + +If a router learns routes for the listed subnet from more than one source of routing information, the router +uses the source with the lowest administrative distance (AD). +The metric for this route. + +For packets matching this route, the IP address of the next router to which the packet should be forwarded. +For OSPF and EIGRP routes, this is the time since the route was first learned. +For packets matching this route, the interface out which the packet should be forwarded. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +390 CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 16-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 16-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review command tables + +Do labs + +Resource Used Book, website +Book, website + +Book, PTP + +Book + +Blog + + + +Review All the Key Topics + + +Table 16-5 +Key Topic Element +List + +List + +Figure 16-2 + +Key Topics for Chapter 16 +Description Page Number +Steps taken by a host when forwarding IP packets 369 + +Steps taken by a router when forwarding IP packets 370 + +Diagram of five routing steps taken by a router 371 + + +Figure 16-7 Breakdown of IP routing table with matching and forwarding details 374 + + +List + +List + +Figure 16-11 + +List + +List + +Paragraph + +Table 16-3 + +Three common sources from which routers build IP routes 376 + +Rules regarding when a router creates a connected route 376 + +Static route configuration concept 379 + +Troubleshooting checklist for routes that do appear in the IP 385 routing table +Troubleshooting checklist for static routes that do not appear in the 385 IP routing table +A description of how a router makes a longest prefix decision to 386 match the routing table +List of items found in a Cisco router IP routing table 389 + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 16: Configuring IPv4 Addresses and Static Routes 391 + +Key Terms You Should Know +ARP table, routing table, next-hop router, outgoing interface, connected route, static route, default route, host route, floating static route, network route, administrative distance + +Command References +Tables 16-6 and 16-7 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall +the command without looking. Then repeat the exercise, covering the right column, and try 16 to recall what the command does. + + +Table 16-6 +Command + +Chapter 16 Configuration Command Reference +Description + + + +ip address ip-address mask + +interface type number.subint + +[no] ip routing + + +ip route prefix mask {ip-address | interface-type interface-number} [distance] [permanent] + +Interface subcommand that assigns the interface’s IP address +Global command to create a subinterface and to enter configuration mode for that subinterface +Global command that enables (ip routing) or disables (no ip routing) the routing of IPv4 packets on a router or Layer 3 switch +Global configuration command that creates a static route + + + + +Table 16-7 +Command + +Chapter 16 EXEC Command Reference +Description + + + +show ip route + +show ip route [connected | static | ospf] + +show ip route ip-address + +show arp, show ip arp + +clear ip arp [ip-address] + +Lists the router’s entire routing table + +Lists a subset of the IP routing table + +Lists detailed information about the route that a router matches for the listed IP address +Lists the router’s IPv4 ARP table + +Removes all dynamically learned ARP table entries, or if the command lists an IP address, removes the entry for that IP address only + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 17 + + +IP Routing in the LAN This chapter covers the following exam topics: +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +2.0 Network Access +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) + +The preceding two chapters showed how to configure an IP address and mask on a router interface, making the router ready to route packets to/from the subnet implied by that address/mask combination. While true and useful, all the examples so far ignored the LAN switches and the possibility of VLANs. In fact, the examples so far show the simplest pos-sible cases: the attached switches as Layer 2 switches, using only one VLAN, with the router configured with one ip address command on its physical interface. This chapter takes a detailed look at how to configure routers so that they route packets to/from the subnets that exist on each and every VLAN. + +Because Layer 2 switches do not forward Layer 2 frames between VLANs, a network must use routers to route IP packets between subnets to allow those devices in different VLANs/ subnets to communicate. To review, Ethernet defines the concept of a VLAN, while IP defines the concept of an IP subnet, so a VLAN is not equivalent to a subnet. However, the set of devices in one VLAN are typically also in one subnet. By the same reasoning, devices in two different VLANs are normally in two different subnets. For two devices in different VLANs to communicate with each other, routers must connect to the subnets that exist on each VLAN, and then the routers forward IP packets between the devices in those subnets. + +This chapter discusses the configuration and verification steps related to three methods of routing between VLANs with three major sections: + +■ VLAN Routing with Router 802.1Q Trunks: The first section discusses how to config-ure a router to use VLAN trunking as connected to a Layer 2 switch. The router does the routing, with the switch creating the VLANs. The link between the router and switch use trunking so that the router has an interface connected to each VLAN/subnet. This feature is known as routing over a VLAN trunk and also known as router-on-a-stick (ROAS). +■ VLAN Routing with Layer 3 Switch SVIs: The second section discusses using a LAN switch that supports both Layer 2 switching and Layer 3 routing (called a Layer 3 switch or multilayer switch). To route, the Layer 3 switch configuration uses interfaces called switched virtual interfaces (SVI), which are also called VLAN interfaces. +■ VLAN Routing with Layer 3 Switch Routed Ports: The third major section of the chap-ter discusses an alternative to SVIs called routed ports, in which the physical switch ports are made to act like interfaces on a router. This third section also introduces the concept of an EtherChannel as used as a routed port in a feature called Layer 3 EtherChannel. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 17-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +VLAN Routing with Router 802.1Q Trunks + +VLAN Routing with Layer 3 Switch SVIs + +VLAN Routing with Layer 3 Switch Routed Ports + +Questions 1, 2 +3, 4 + +5, 6 + + + +1. Router 1 has a Fast Ethernet interface 0/0 with IP address 10.1.1.1. The interface is con-nected to a switch. This connection is then migrated to use 802.1Q trunking. Which of the following commands could be part of a valid configuration for Router 1’s Fa0/0 interface? (Choose two answers.) +a. interface fastethernet 0/0.4 b. dot1q enable +c. dot1q enable 4 d. trunking enable +e. trunking enable 4 +f. encapsulation dot1q 4 + +2. Router R1 has a router-on-a-stick (ROAS) configuration with two subinterfaces of interface G0/1: G0/1.1 and G0/1.2. Physical interface G0/1 is currently in a down/down state. The network engineer then configures a shutdown command when in interface configuration mode for G0/1.1 and a no shutdown command when in interface con-figuration mode for G0/1.2. Which answers are correct about the interface state for the subinterfaces? (Choose two answers.) +a. G0/1.1 will be in a down/down state. b. G0/1.2 will be in a down/down state. +c. G0/1.1 will be in an administratively down state. d. G0/1.2 will be in an up/up state. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +394 CCNA 200-301 Official Cert Guide, Volume 1 + +3. A Layer 3 switch has been configured to route IP packets between VLANs 1, 2, and 3 using SVIs, which connect to subnets 172.20.1.0/25, 172.20.2.0/25, and 172.20.3.0/25, respectively. The engineer issues a show ip route connected command on the Layer 3 switch, listing the connected routes. Which of the following answers lists a piece of information that should be in at least one of the routes? +a. Interface Gigabit Ethernet 0/0.3 b. Next-hop router 172.20.2.1 +c. Interface VLAN 2 d. Mask 255.255.255.0 +4. An engineer has successfully configured a Layer 3 switch with SVIs for VLANs 2 and 3. Hosts in the subnets using VLANs 2 and 3 can ping each other with the Layer 3 switch routing the packets. The next week, the network engineer receives a call that those same users can no longer ping each other. If the problem is with the Layer 3 switching function, which of the following could have caused the problem? (Choose two answers.) +a. Six (or more) out of 10 working VLAN 2 access ports failing due to physical problems +b. A shutdown command issued from interface VLAN 4 configuration mode c. VTP on the switch removing VLAN 3 from the switch’s VLAN list +d. A shutdown command issued from VLAN 2 configuration mode + +5. A LAN design uses a Layer 3 EtherChannel between two switches SW1 and SW2, with port-channel interface 1 used on both switches. SW1 uses ports G0/1, G0/2, and G0/3 in the channel. Which of the following are true about SW1’s configuration to make the channel be able to route IPv4 packets correctly? (Choose two answers.) +a. The ip address command must be on the port-channel 1 interface. +b. The ip address command must be on interface G0/1 (lowest numbered port). +c. The port-channel 1 interface must be configured with the no switchport command. +d. Interface G0/1 must be configured with the routedport command. + +6. A LAN design uses a Layer 3 EtherChannel between two switches SW1 and SW2, with port-channel interface 1 used on both switches. SW1 uses ports G0/1 and G0/2 in the channel. However, only interface G0/1 is bundled into the channel and working. Think about the configuration settings on port G0/2 that could have existed before adding G0/2 to the EtherChannel. Which answers identify a setting that could prevent IOS from adding G0/2 to the Layer 3 EtherChannel? (Choose two answers.) +a. A different STP cost (spanning-tree cost value) b. A different speed (speed value) +c. A default setting for switchport (switchport) +d. A different access VLAN (switchport access vlan vlan-id) + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 395 + +Foundation Topics + +VLAN Routing with Router 802.1Q Trunks +Almost all enterprise networks use VLANs. To route IP packets in and out of those VLANs, some devices (either routers or Layer 3 switches) need to have an IP address in each subnet and have a connected route to each of those subnets. Then the IP addresses on those routers or Layer 3 switches can serve as the default gateways in those subnets. + +This chapter breaks down the LAN routing options into four categories: + +■ Use a router, with one router LAN interface and cable connected to the switch for each +and every VLAN (typically not used) 17 ■ Use a router, with a VLAN trunk connecting to a LAN switch (known as router-on-a- +stick, or ROAS) +■ Use a Layer 3 switch with switched virtual interfaces (SVI) +■ Use a Layer 3 switch with routed interfaces (which may or may not be Layer 3 EtherChannels) + +Of the items in the list, the first option works, but to be practical, it requires far too many interfaces. It is mentioned here only to make the list complete. + +As for the other three options, this chapter discusses each in turn as the main focus of one of the three major sections in this chapter. Each feature is used in real networks today, with the choice to use one or the other driven by the design and needs for a particular part of the network. Figure 17-1 shows cases in which these options could be used. + +VLAN Trunking + +2 VLANs Layer 3 +Switches B1 SW1 +12 VLANs +2 VLANs D A Core B2 SW2 + +C B 2 VLANs B3 SW3 + +Figure 17-1 Layer 3 Switching at the Central Site + +Figure 17-1 shows two switches, labeled A and B, which could act as Layer 3 switches—both with SVIs and routed interfaces. The figure shows a central site campus LAN on the left, with 12 VLANs. Switches A and B act as Layer 3 switches, combining the functions of a router and a switch, routing between all 12 subnets/VLANs, as well as routing to/from the Core router. Those Layer 3 switches could use SVIs, routed interfaces, or both. + +Figure 17-1 also shows a classic case for using a router with a VLAN trunk. Sites like the remote sites on the right side of the figure may have a WAN-connected router and a LAN + + +|||||||||||||||||||| +|||||||||||||||||||| + + +396 CCNA 200-301 Official Cert Guide, Volume 1 + +switch. These sites might use ROAS to take advantage of the router’s ability to route over an 802.1Q trunk. + +Note that Figure 17-1 just shows an example. The engineer could use Layer 3 switching at each site or routers with VLAN trunking at each site. + +Configuring ROAS +This next topic discusses how routers route packets to subnets associated with VLANs con-nected to a router 802.1Q trunk. That long description can be a bit of a chore to repeat each time someone wants to discuss this feature, so over time, the networking world has instead settled on a shorter and more interesting name for this feature: router-on-a-stick (ROAS). + +ROAS uses router VLAN trunking configuration to give the router a logical router inter-face connected to each VLAN. Because the router then has an interface connected to each +VLAN, the router can also be configured with an IP address in the subnet that exists on each VLAN. + +Routers use subinterfaces as the means to have an interface connected to a VLAN. The router needs to have an IP address/mask associated with each VLAN on the trunk. However, the router has only one physical interface for the link connected to the trunk. Cisco solves this problem by creating multiple virtual router interfaces, one associated with each VLAN on that trunk (at least for each VLAN that you want the trunk to support). Cisco calls these virtual interfaces subinterfaces. The configuration can then include an ip address command for each subinterface. + +Figure 17-2 shows the concept with Router B1, one of the branch routers from Figure 17-1. Because this router needs to route between only two VLANs, the figure also shows two sub-interfaces, named G0/0.10 and G0/0.20, which create a new place in the configuration where the per-VLAN configuration settings can be made. The router treats frames tagged with VLAN 10 as if they came in or out of G0/0.10 and frames tagged with VLAN 20 as if they came in or out G0/0.20. + +10.1.10.1/24 VLAN 10 + +Interface G0/0.10 + +B1 20 10 20 10 20 SW1 Interface G0/0.20 + +10.1.20.1/24 VLAN 20 +Figure 17-2 Subinterfaces on Router B1 + +In addition, note that most Cisco routers do not attempt to negotiate trunking, so both the router and switch need to manually configure trunking. This chapter discusses the router side of that trunking configuration; the matching switch interface would need to be config-ured with the switchport mode trunk command. + +Answers to the “Do I Know This Already?” quiz: 1 A, F 2 B, C 3 C 4 C, D 5 A, C 6 B, C + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 397 + +Example 17-1 shows a full example of the 802.1Q trunking configuration required on Router B1 in Figure 17-2. More generally, these steps detail how to configure 802.1Q trunking on a + + + +Config Checklist + +router: + +Step 1. + + +Step 2. + + +Step 3. + + + +Use the interface type number.subint command in global configuration mode to create a unique subinterface for each VLAN that needs to be routed. + +Use the encapsulation dot1q vlan_id command in subinterface configuration mode to enable 802.1Q and associate one specific VLAN with the subinterface. + +Use the ip address address mask command in subinterface configuration mode +to configure IP settings (address and mask). + + +Example 17-1 Router Configuration for the 802.1Q Encapsulation Shown in Figure 17-2 17 + +B1# show running-config +! Only pertinent lines shown +interface gigabitethernet 0/0 +! No IP address up here! No encapsulation up here! +! +interface gigabitethernet 0/0.10 +encapsulation dot1q 10 +ip address 10.1.10.1 255.255.255.0 +! +interface gigabitethernet 0/0.20 +encapsulation dot1q 20 +ip address 10.1.20.1 255.255.255.0 + + +First, look at the subinterface numbers. The subinterface number begins with the period, like .10 and .20 in this case. These numbers can be any number from 1 up through a very large number (over 4 billion). The number just needs to be unique among all subinterfaces associ-ated with this one physical interface. In fact, the subinterface number does not even have +to match the associated VLAN ID. (The encapsulation command, and not the subinterface number, defines the VLAN ID associated with the subinterface.) + +NOTE Although not required, most sites do choose to make the subinterface number match the VLAN ID, as shown in Example 17-1, just to avoid confusion. + +Each subinterface configuration lists two subcommands. One command (encapsulation) enables trunking and defines the VLAN whose frames are considered to be coming in and out of the subinterface. The ip address command works the same way it does on any other interface. Note that if the physical Ethernet interface reaches an up/up state, the subinterface should as well, which would then let the router add the connected routes shown at the bot-tom of the example. + +Now that the router has a working interface, with IPv4 addresses configured, the router can route IPv4 packets on these subinterfaces. That is, the router treats these subinterfaces like + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +398 CCNA 200-301 Official Cert Guide, Volume 1 + +any physical interface in terms of adding connected routes, matching those routes, and for-warding packets to/from those connected subnets. + +The configuration and use of the native VLAN on the trunk require a little extra thought. The native VLAN can be configured on a subinterface, or on the physical interface, or ignored as in Example 17-1. Each 802.1Q trunk has one native VLAN, and if the router needs to route pack-ets for a subnet that exists in the native VLAN, then the router needs some configuration to support that subnet. The two options to define a router interface for the native VLAN are + +■ Configure the ip address command on the physical interface, but without an encapsulation command; the router considers this physical interface to be using the native VLAN. +■ Configure the ip address command on a subinterface and use the encapsulation dot1q vlan-id native subcommand to tell the router both the VLAN ID and the fact that it is the native VLAN. + +Example 17-2 shows both native VLAN configuration options with a small change to the same configuration in Example 17-1. In this case, VLAN 10 becomes the native VLAN. The top part of the example shows the option to configure the router physical interface to use native VLAN 10. The second half of the example shows how to configure that same native VLAN on a subinterface. In both cases, the switch configuration also needs to be changed to make VLAN 10 the native VLAN. + +Example 17-2 Router Configuration Using Native VLAN 10 on Router B1 + +! First option: put the native VLAN IP address on the physical interface +interface gigabitethernet 0/0 +ip address 10.1.10.1 255.255.255.0 +! +interface gigabitethernet 0/0.20 +encapsulation dot1q 20 +ip address 10.1.20.1 255.255.255.0 + +! Second option: like Example 17-1, but add the native keyword +interface gigabitethernet 0/0.10 +encapsulation dot1q 10 native +ip address 10.1.10.1 255.255.255.0 +! +interface gigabitethernet 0/0.20 +encapsulation dot1q 20 +ip address 10.1.20.1 255.255.255.0 + + +Verifying ROAS +Beyond using the show running-config command, ROAS configuration on a router can be best verified with two commands: show ip route [connected] and show vlans. As with any router interface, as long as the interface is in an up/up state and has an IPv4 address con-figured, IOS will put a connected (and local) route in the IPv4 routing table. So, a first and obvious check would be to see if all the expected connected routes exist. Example 17-3 lists the connected routes per the configuration shown in Example 17-1. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 399 + +Example 17-3 Connected Routes Based on Example 17-1 Configuration + +B1# show ip route connected +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +! Legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.10.0/24 is directly connected, GigabitEthernet0/0.10 +L 10.1.10.1/32 is directly connected, GigabitEthernet0/0.10 +C 10.1.20.0/24 is directly connected, GigabitEthernet0/0.20 +L 10.1.20.1/32 is directly connected, GigabitEthernet0/0.20 + +As for interface and subinterface state, note that the ROAS subinterface state does depend 17 to some degree on the physical interface state. In particular, the subinterface state cannot +be better than the state of the matching physical interface. For instance, on Router B1 in the examples so far, physical interface G0/0 is in an up/up state, and the subinterfaces are in an up/up state. But if you unplugged the cable from that port, the physical port would fail to a down/down state, and the subinterfaces would also fail to a down/down state. Example 17-4 shows another example, with the physical interface being shut down, with the subinterfaces then automatically changed to an administratively down state as a result. + +Example 17-4 Subinterface State Tied to Physical Interface State + +B1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +B1(config)# interface g0/0 +B1(config-if)# shutdown +B1(config-if)# ^Z +B1# show ip interface brief | include 0/0 + +GigabitEthernet0/0 +GigabitEthernet0/0.10 +GigabitEthernet0/0.20 + +unassigned +10.1.10.1 +10.1.20.1 + +YES manual administratively down down +YES manual administratively down down +YES manual administratively down down + + + +Additionally, the subinterface state can also be enabled and disabled independently from the physical interface, using the no shutdown and shutdown commands in subinterface configu-ration mode. + +Another useful ROAS verification command, show vlans, spells out which router trunk inter-faces use which VLANs, which VLAN is the native VLAN, plus some packet statistics. The fact that the packet counters are increasing can be useful when verifying whether traffic is happening or not. Example 17-5 shows a sample, based on the Router B1 configuration in Example 17-2 (bottom half), in which native VLAN 10 is configured on subinterface G0/0.10. Note that the output identifies VLAN 1 associated with the physical interface, VLAN 10 +as the native VLAN associated with G0/0.10, and VLAN 20 associated with G0/0.20. It also lists the IP addresses assigned to each interface/subinterface. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +400 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 17-5 Sample show vlans Command to Match Sample Router Trunking Configuration + +R1# show vlans +Virtual LAN ID: 1 (IEEE 802.1Q Encapsulation) + +vLAN Trunk Interface: GigabitEthernet0/0 + + +Protocols Configured: Address: +Other + +Received: +0 + +Transmitted: +83 + + +69 packets, 20914 bytes input +147 packets, 11841 bytes output + +Virtual LAN ID: 10 (IEEE 802.1Q Encapsulation) + +vLAN Trunk Interface: GigabitEthernet0/0.10 + +This is configured as native Vlan for the following interface(s) : +GigabitEthernet0/0 Native-vlan Tx-type: Untagged + + +Protocols Configured: +IP +Other + +Address: +10.1.10.1 + +Received: +2 +0 + +Transmitted: +3 +1 + + +3 packets, 722 bytes input +4 packets, 264 bytes output + +Virtual LAN ID: 20 (IEEE 802.1Q Encapsulation) + +vLAN Trunk Interface: GigabitEthernet0/0.20 + + +Protocols Configured: +IP +Other + +Address: +10.1.20.1 + +Received: +0 +0 + +Transmitted: +134 +1 + + +0 packets, 0 bytes input +135 packets, 10498 bytes output + +Troubleshooting ROAS +The biggest challenge when troubleshooting ROAS has to do with the fact that if you mis-configure only the router or misconfigure only the switch, the other device on the trunk has no way to know that the other side is misconfigured. That is, if you check the show ip route and show vlans commands on a router, and the output looks like it matches the intended configuration, and the connected routes for the correct subinterfaces show up, routing may still fail because of problems on the attached switch. So, troubleshooting ROAS often begins with checking the configuration on both the router and switch because there is no status output on either device that tells you where the problem might be. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 401 + +First, to check ROAS on the router, you need to start with the intended configuration and ask questions about the configuration: +1. Is each non-native VLAN configured on the router with an encapsulation dot1q vlan-id command on a subinterface? +2. Do those same VLANs exist on the trunk on the neighboring switch (show interfaces trunk), and are they in the allowed list, not VTP pruned, and not STP blocked? +3. Does each router ROAS subinterface have an IP address/mask configured per the planned configuration? +4. If using the native VLAN, is it configured correctly on the router either on a subinter-face (with an encapsulation dot1q vlan-id native command) or implied on the physical +interface? 17 5. Is the same native VLAN configured on the neighboring switch’s trunk in comparison +to the native VLAN configured on the router? +6. Are the router physical or ROAS subinterfaces configured with a shutdown command? + +For some of these steps, you need to be ready to investigate possible VLAN trunking issues on the LAN switch. The reason is that on many Cisco routers, router interfaces do not nego-tiate trunking. As a result, ROAS relies on static trunk configuration on both the router and switch. If the switch has any problems with VLANs or the VLAN trunking configuration on its side of the trunk, the router has no way to realize that the problem exists. + +For example, imagine you configured ROAS on a router just like in Example 17-1 or Example 17-2. However, the switch on the other end of the link had no matching configuration. For instance, maybe the switch did not even define VLANs 10 and 20. Maybe the switch did not configure trunking on the port connected to the router. Even with blatant misconfiguration or missing configuration on the switch, the router still shows up/up ROAS interfaces and subinterfaces, IP routes in the output of show ip route, and meaningful configuration infor-mation in the output of the show vlans command. + +VLAN Routing with Layer 3 Switch SVIs +Using a router with ROAS to route packets makes sense in some cases, particularly at small remote sites. In sites with a larger LAN, network designers choose to use Layer 3 switches for most inter-VLAN routing. + +A Layer 3 switch (also called a multilayer switch) is one device, but it executes logic at two layers: Layer 2 LAN switching and Layer 3 IP routing. The Layer 2 switch function forwards frames inside each VLAN, but it will not forward frames between VLANs. The Layer 3 for-warding (routing) logic forwards IP packets between VLANs. + +Layer 3 switches typically support two configuration options to enable IPv4 routing inside the switch, specifically to enable IPv4 on switch interfaces. This section explains one option, an option that uses switched virtual interfaces (SVI). The final major section of the chapter deals with the other option for configuring IPv4 addresses on Layer 3 switches: routed interfaces. + +Configuring Routing Using Switch SVIs +The configuration of a Layer 3 switch mostly looks like the Layer 2 switching configura-tion shown back in Parts II and III of this book, with a small bit of configuration added for + + +|||||||||||||||||||| +|||||||||||||||||||| + + +402 CCNA 200-301 Official Cert Guide, Volume 1 + +the Layer 3 functions. The Layer 3 switching function needs a virtual interface connected to each VLAN internal to the switch. These VLAN interfaces act like router interfaces, with an IP address and mask. The Layer 3 switch has an IP routing table, with connected routes off each of these VLAN interfaces. (These interfaces are also referred to as switched virtual interfaces [SVI].) + +To show the concept of Layer 3 switching with SVIs, the following example uses the same branch office with two VLANs shown in the earlier examples, but now the design will use Layer 3 switching in the LAN switch. Figure 17-3 shows the design changes and configura-tion concept for the Layer 3 switch function with a router icon inside the switch, to empha-size that the switch routes the packets. + + + + +VLAN 30 + + +B1 G0/0 10.1.30.2 + +The Middle Box Represents the Layer 3 Switch, with Internal Logic Visible + +interface vlan 10 interface vlan 30 10.1.10.1/24 +G0/1 10.1.30.1/24 + +interface vlan 20 10.1.20.1/24 + + +VLAN 10 +F0/1 + +F0/2 + +F0/3 + +F0/4 +VLAN 20 + +Figure 17-3 Routing on VLAN Interfaces in a Layer 3 Switch + +Note that the figure represents the internals of the Layer 3 switch within the box in the middle of the figure. The branch still has two user VLANs (10 and 20), so the Layer 3 switch needs one VLAN interface for each VLAN. The figure shows a router icon inside the gray box to represent the Layer 3 switching function, with two VLAN interfaces on the right side of that icon. In addition, the traffic still needs to get to router B1 (a physical router) to access the WAN, so the switch uses a third VLAN (VLAN 30 in this case) for the link to Router +B1. The physical link between the Layer 3 switch and router B1 would not be a trunk, but instead be an access link. + +The following steps show how to configure Layer 3 switching using SVIs. Note that on some switches, like the 2960 and 2960-XR switches used for the examples in this book, the ability to route IPv4 packets must be enabled first, with a reload of the switch required to enable the feature. The steps that occur after the reload would apply to all models of Cisco switches that are capable of doing Layer 3 switching. + +Config Checklist + +Step 1. Enable IP routing on the switch, as needed: + +A. Use the sdm prefer lanbase-routing command (or similar) in global config-uration mode to change the switch forwarding ASIC settings to make space for IPv4 routes at the next reload of the switch. +B. Use the reload EXEC command in enable mode to reload (reboot) the switch to pick up the new sdm prefer command setting. + +C. Once reloaded, use the ip routing command in global configuration mode to enable the IPv4 routing function in IOS software and to enable key com- +mands like show ip route. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 403 + +Step 2. Configure each SVI interface, one per VLAN for which routing should be done by this Layer 3 switch: + +A. Use the interface vlan vlan_id command in global configuration mode to create a VLAN interface and to give the switch’s routing logic a Layer 3 interface connected into the VLAN of the same number. +B. Use the ip address address mask command in VLAN interface configura-tion mode to configure an IP address and mask on the VLAN interface, enabling IPv4 routing on that VLAN interface. +C. (As needed) Use the no shutdown command in interface configuration mode to enable the VLAN interface (if it is currently in a shutdown state). +Example 17-6 shows the configuration to match Figure 17-3. In this case, switch SW1 has 17 already used the sdm prefer global command to change to a setting that supports IPv4 rout- +ing, and the switch has been reloaded. The example shows the related configuration on all three VLAN interfaces. + +Example 17-6 VLAN Interface Configuration for Layer 3 Switching + +ip routing +! +interface vlan 10 +ip address 10.1.10.1 255.255.255.0 +! +interface vlan 20 +ip address 10.1.20.1 255.255.255.0 +! +interface vlan 30 +ip address 10.1.30.1 255.255.255.0 + + +Verifying Routing with SVIs +With the VLAN configuration shown in the previous section, the switch is ready to route packets between the VLANs as shown in Figure 17-3. To support the routing of packets, the switch adds connected IP routes as shown in Example 17-7; note that each route is listed as being connected to a different VLAN interface. + +Example 17-7 Connected Routes on a Layer 3 Switch + +SW1# show ip route +! legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +C 10.1.10.0/24 is directly connected, Vlan10 +L 10.1.10.1/32 is directly connected, Vlan10 +C 10.1.20.0/24 is directly connected, Vlan20 +L 10.1.20.1/32 is directly connected, Vlan20 +C 10.1.30.0/24 is directly connected, Vlan30 +L 10.1.30.1/32 is directly connected, Vlan30 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +404 CCNA 200-301 Official Cert Guide, Volume 1 + +The switch would also need additional routes to the rest of the network (not shown in the figures in this chapter). The Layer 3 switch could use static routes or a routing protocol, depending on the capabilities of the switch. For instance, if you then enabled OSPF on the Layer 3 switch, the configuration and verification would work the same as it does on a rout-er, as discussed in Chapter 20, “Implementing OSPF.” The routes that IOS adds to the Layer 3 switch’s IP routing table would list the VLAN interfaces as outgoing interfaces. + +NOTE Some models of Cisco enterprise switches, based on model, IOS version, and IOS feature set, support different capabilities for IP routing and routing protocols, so for real net-works, check the capabilities of the switch model by browsing at Cisco.com. In particular, check the Cisco Feature Navigator (CFN) tool at http://www.cisco.com/go/cfn. + + +Troubleshooting Routing with SVIs +There are two big topics to investigate when troubleshooting routing over LANs with SVIs. First, you have to make sure the switch has been enabled to support IP routing. Second, the VLAN associated with each VLAN interface must be known and active on the local switch; otherwise, the VLAN interfaces do not come up. + +First, about enabling IP routing, note that some models of Cisco switches default to enable Layer 3 switching, and some do not. So, to make sure your switch supports Layer 3 routing, look to those first few configuration commands listed in the configuration checklist found in the earlier section “Configuring Routing Using Switch SVIs.” Those commands are +sdm prefer (followed by a reload) and then ip routing (after the reload). + +The sdm prefer command changes how the switch forwarding chips allocate memory for different forwarding tables, and changes to those tables require a reload of the switch. By default, many access switches that support Layer 3 switching still have an SDM default that does not allocate space for an IP routing table. Once changed and reloaded, the ip routing command then enables IPv4 routing in IOS software. Both are necessary before some Cisco switches will act as a Layer 3 switch. + +Example 17-8 shows some symptoms on a router for which Layer 3 switching had not yet been enabled by the sdm prefer command. As you can see, both the show ip route EXEC command and the ip routing config command are rejected because they do not exist to IOS until the sdm prefer command has been used (followed by a reload of the switch). + +Example 17-8 Evidence That a Switch Has Not Yet Enabled IPv4 Routing + +SW1# show ip route +^ +% Invalid input detected at '^' marker. + +SW3# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW3(config)# ip routing +^ +% Invalid input detected at '^' marker. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 405 + +The second big area to investigate when troubleshooting SVIs relates to the SVI state, a state that ties to the state of the associated VLANs. Each VLAN interface has a matching VLAN of the same number, and the VLAN interface’s state is tied to the state of the VLAN in cer-tain ways. In particular, for a VLAN interface to be in an up/up state: +Step 1. The VLAN must be defined on the local switch (either explicitly or learned with VTP). +Step 2. The switch must have at least one up/up interface using the VLAN, either/both: + +A. An up/up access interface assigned to that VLAN + +B. A trunk interface for which the VLAN is in the allowed list, is STP forward- +ing, and is not VTP pruned 17 Step 3. The VLAN (not the VLAN interface) must be administratively enabled (that is, +not shutdown). + +Step 4. The VLAN interface (not the VLAN) must be administratively enabled (that is, not shutdown). + + +When working through the steps in the list, keep in mind that the VLAN and the VLAN interface are related but separate ideas, and the configuration items are separate in the CLI. The VLAN interface is a switch’s Layer 3 interface connected to the VLAN. If you want to route packets for the subnets on VLANs 11, 12, and 13, the matching VLAN interfaces must be numbered 11, 12, and 13. And both the VLANs and the VLAN interfaces can be disabled and enabled with the shutdown and no shutdown commands (as mentioned in Steps 3 and 4 in the previous list), so you have to check for both. + +Example 17-9 shows three scenarios, each of which leads to one of the VLAN interfaces in the previous configuration example (Figure 17-3, Example 17-6) to fail. At the beginning of the example, all three VLAN interfaces are up/up. VLANs 10, 20, and 30 each have at least one access interface up and working. The example works through three scenarios: + +■ Scenario 1: The last access interface in VLAN 10 is shut down (F0/1), so IOS shuts down the VLAN 10 interface. +■ Scenario 2: VLAN 20 (not VLAN interface 20, but VLAN 20) is deleted, which results in IOS then bringing down (not shutting down) the VLAN 20 interface. +■ Scenario 3: VLAN 30 (not VLAN interface 30, but VLAN 30) is shut down, which results in IOS then bringing down (not shutting down) the VLAN 30 interface. + +Example 17-9 Three Examples That Cause VLAN Interfaces to Fail + +SW1# show interfaces status +! Only ports related to the example are shown + +Port Name +Fa0/1 +Fa0/2 +Fa0/3 +Fa0/4 + +Status Vlan +connected 10 +notconnect 10 +connected 20 +connected 20 + +Duplex Speed Type +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +a-full a-100 10/100BaseTX +a-full a-100 10/100BaseTX + +Gi0/1 connected 30 a-full a-1000 10/100/1000BaseTX + + +|||||||||||||||||||| +|||||||||||||||||||| + + +406 CCNA 200-301 Official Cert Guide, Volume 1 + +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. + +! Case 1: Interface F0/1, the last up/up access interface in VLAN 10, is shutdown +SW1(config)# interface fastEthernet 0/1 +SW1(config-if)# shutdown +SW1(config-if)# +*Apr 2 19:54:08.784: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to down +SW1(config-if)# +*Apr 2 19:54:10.772: %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down +*Apr 2 19:54:11.779: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down + +! Case 2: VLAN 20 is deleted +SW1(config)# no vlan 20 +SW1(config)# +*Apr 2 19:54:39.688: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to down + +! Case 3: VLAN 30, the VLAN from the switch to the router, is shutdown +SW1(config)# vlan 30 +SW1(config-vlan)# shutdown +SW1(config-vlan)# exit +SW1(config)# +*Apr 2 19:55:25.204: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to down + +! Final status of all three VLAN interfaces are below +SW1# show ip interface brief | include Vlan +Vlan1 unassigned YES manual administratively down down + +Vlan10 10.1.10.1 +Vlan20 10.1.20.1 +Vlan30 10.1.30.1 + +YES manual up down +YES manual up down +YES manual up down + + + +Note that the example ends with the three VLAN interfaces in an up/down state per the show ip interface brief command. + +VLAN Routing with Layer 3 Switch Routed Ports +When Layer 3 switches use SVIs, the physical interfaces on the switches act like they always have: as Layer 2 interfaces. That is, the physical interfaces receive Ethernet frames. The switch learns the source MAC address of the frame, and the switch forwards the frame based on the destination MAC address. To perform routing, any Ethernet frames destined for any of the SVI interface MAC addresses trigger the processing of the Layer 2 switching logic, resulting in normal routing actions like stripping data-link headers, making a routing deci-sion, and so on. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 407 + +Alternately, the Layer 3 switch configuration can make a physical port act like a router interface instead of a switch interface. To do so, the switch configuration makes that port a routed port. On a routed port, the switch does not perform Layer 2 switching logic on that frame. Instead, frames arriving in a routed port trigger the Layer 3 routing logic, including +1. Stripping off the incoming frame’s Ethernet data-link header/trailer +2. Making a Layer 3 forwarding decision by comparing the destination IP address to the IP routing table +3. Adding a new Ethernet data-link header/trailer to the packet 4. Forwarding the packet, encapsulated in a new frame +This third major section of the chapter examines routed interfaces as configured on Cisco +Layer 3 switches, but with a particular goal in mind: to also discuss Layer 3 EtherChannels. 17 The exam topics do not mention routed interfaces specifically, but the exam topics do men- +tion L3 EtherChannels, meaning Layer 3 EtherChannels. + +You might recall that Chapter 10, “RSTP and EtherChannel Configuration,” discussed Layer 2 EtherChannels. Like Layer 2 EtherChannels, Layer 3 EtherChannels also treat multiple links as one link. Unlike Layer 2 EtherChannels, however, Layer 3 EtherChannels treat the chan- +nel as a routed port instead of switched port. So this section first looks at routed ports on Cisco Layer 3 switches and then discusses Layer 3 EtherChannels. + +Implementing Routed Interfaces on Switches +When a Layer 3 switch needs a Layer 3 interface connected to a subnet, and only one physi-cal interface connects to that subnet, the network engineer can choose to use a routed port instead of an SVI. Conversely, when the Layer 3 switch needs a Layer 3 interface connected to a subnet, and many physical interfaces on the switch connect to that subnet, an SVI needs to be used. (SVIs forward traffic internally into the VLAN, so that then the Layer 2 logic can forward the frame out any of the ports in the VLAN. Routed ports cannot.) + +To see why, consider the design in Figure 17-4, which repeats the same design from Figure 17-3 (used in the SVI examples). In that design, the gray rectangle on the right represents the switch and its internals. On the right of the switch, at least two access ports sit in both VLAN 10 and VLAN 20. However, that figure shows a single link from the switch to Router +B1. The switch could configure the port as an access port in a separate VLAN, as shown with VLAN 30 in Examples 17-6 and 17-7. However, with only one switch port needed, the switch could configure that link as a routed port, as shown in the figure. + + +Routed Interface + + +Not a VLAN! + +The Rectangle Represents +the Layer 3 Switch VLAN 10 +interface vlan 10 F0/1 10.1.10.1/24 F0/2 + + + +B1 G0/0 10.1.30.2 + + +interface G0/1 10.1.30.1/24 + + +interface vlan 20 F0/3 10.1.20.1/24 F0/4 +VLAN 20 + + +Figure 17-4 Routing on a Routed Interface on a Switch + + +|||||||||||||||||||| +|||||||||||||||||||| + + +408 CCNA 200-301 Official Cert Guide, Volume 1 + +Enabling a switch interface to be a routed interface instead of a switched interface is simple: just use the no switchport subcommand on the physical interface. Cisco switches capable of being a Layer 3 switch use a default of the switchport command to each switch physical interface. Think about the word switchport for a moment. With that term, Cisco tells the switch to treat the port like it is a port on a switch—that is, a Layer 2 port on a switch. To make the port stop acting like a switch port and instead act like a router port, use the +no switchport command on the interface. + +Once the port is acting as a routed port, think of it like a router interface. That is, configure the IP address on the physical port, as implied in Figure 17-4. Example 17-10 shows a com-pleted configuration for the interfaces configured on the switch in Figure 17-4. Note that the design uses the exact same IP subnets as the example that showed SVI configuration +in Example 17-6, but now, the port connected to subnet 10.1.30.0 has been converted to a routed port. All you have to do is add the no switchport command to the physical interface and configure the IP address on the physical interface. + +Example 17-10 Configuring Interface G0/1 on Switch SW1 as a Routed Port + +ip routing +! +interface vlan 10 +ip address 10.1.10.1 255.255.255.0 +! +interface vlan 20 +ip address 10.1.20.1 255.255.255.0 +! +interface gigabitethernet 0/1 +no switchport +ip address 10.1.30.1 255.255.255.0 + + +Once configured, the routed interface will show up differently in command output in the switch. In particular, for an interface configured as a routed port with an IP address, like interface GigabitEthernet0/1 in the previous example: + +show interfaces: Similar to the same command on a router, the output will display the IP address of the interface. (Conversely, for switch ports, this command does not list an IP address.) +show interfaces status: Under the “VLAN” heading, instead of listing the access VLAN or the word trunk, the output lists the word routed, meaning that it is a routed port. +show ip route: Lists the routed port as an outgoing interface in routes. +show interfaces type number switchport: If a routed port, the output is short and con-firms that the port is not a switch port. (If the port is a Layer 2 port, this command lists many configuration and status details.) +Example 17-11 shows samples of all four of these commands as taken from the switch as configured in Example 17-10. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 409 + +Example 17-11 Verification Commands for Routed Ports on Switches + +SW11# show interfaces g0/1 +GigabitEthernet0/1 is up, line protocol is up (connected) +Hardware is Gigabit Ethernet, address is bcc4.938b.e541 (bia bcc4.938b.e541) +Internet address is 10.1.30.1/24 +! lines omitted for brevity + +SW1# show interfaces status +! Only ports related to the example are shown; the command lists physical only + +Port Name +Fa0/1 +Fa0/2 +Fa0/3 +Fa0/4 + +Status Vlan +connected 10 +notconnect 10 +connected 20 +connected 20 + +Duplex Speed Type +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX 17 a-full a-100 10/100BaseTX +a-full a-100 10/100BaseTX + +Gi0/1 connected routed a-full a-1000 10/100/1000BaseTX + +SW1# show ip route +! legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +C 10.1.10.0/24 is directly connected, Vlan10 +L 10.1.10.1/32 is directly connected, Vlan10 +C 10.1.20.0/24 is directly connected, Vlan20 +L 10.1.20.1/32 is directly connected, Vlan20 +C 10.1.30.0/24 is directly connected, GigabitEthernet0/1 +L 10.1.30.1/32 is directly connected, GigabitEthernet0/1 + +SW1# show interfaces g0/1 switchport +Name: Gi0/1 +Switchport: Disabled + + +So, with two options—SVI and routed ports—where should you use each? + +For any topologies with a point-to-point link between two devices that do routing, a routed interface works well. +Figure 17-5 shows an example of where to use SVIs and where to use routed ports in a typi-cal core/distribution/access design. In this design, the core (Core1, Core2) and distribution (D11 through D14) switches perform Layer 3 switching. All the ports that are links directly between the Layer 3 switches can be routed interfaces. For VLANs for which many interfac-es (access and trunk) connect to the VLAN, SVIs make sense because the SVIs can send and receive traffic out multiple ports on the same switch. In this design, all the ports on Core1 and Core2 will be routed ports, while the four distribution switches will use some routed ports and some SVIs. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +410 CCNA 200-301 Official Cert Guide, Volume 1 + + +Layer 2 Access: SVIs + +A11 + + +Routed Interfaces +Point-to-Point, Layer 3 Distribution & Core + +Layer 2 Access: SVIs + +A21 + + +D11 Core1 D21 +A12 A22 + + +A13 A23 D12 Core2 D22 + + +A14 + +Figure 17-5 + +A24 + +Using Routed Interfaces for Core and Distribution Layer 3 Links + + +Implementing Layer 3 EtherChannels +So far, this section has stated that routed interfaces can be used with a single point-to-point link between pairs of Layer 3 switches, or between a Layer 3 switch and a router. However, in most designs, the network engineers use at least two links between each pair of distribu-tion and core switches, as shown in Figure 17-6. + + +Layer 2 Access: SVIs + +A11 + + +Routed Interfaces +Point-to-Point, Layer 3 Distribution & Core + +Layer 2 Access: SVIs + +A21 + + +D11 Core1 D21 +A12 A22 + + +A13 A23 D12 Core2 D22 + +A14 A24 + +Figure 17-6 Two Links Between Each Distribution and Core Switch + +While each individual port in the distribution and core could be treated as a separate routed port, it is better to combine each pair of parallel links into a Layer 3 EtherChannel. Without using EtherChannel, you can still make each port on each switch in the center of the fig- +ure be a routed port. It works. However, once you enable a routing protocol but don’t use EtherChannels, each Layer 3 switch will now learn two IP routes with the same neighboring switch as the next hop—one route over one link, another route over the other link. + +Using a Layer 3 EtherChannel makes more sense with multiple parallel links between two switches. By doing so, each pair of links acts as one Layer 3 link. So, each pair of switches has one routing protocol neighbor relationship with the neighbor, and not two. Each switch learns one route per destination per pair of links, and not two. IOS then balances the traffic, often with better balancing than the balancing that occurs with the use of multiple IP routes to the same subnet. Overall, the Layer 3 EtherChannel approach works much better than leaving each link as a separate routed port and using Layer 3 balancing. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 411 + +Compared to what you have already learned, configuring a Layer 3 EtherChannel takes only a little more work. Chapter 10 already showed you how to configure an EtherChannel. This chapter has already shown how to make a port a Layer 3 routed port. Next, you have to combine the two ideas by combining both the EtherChannel and routed port configuration. The following checklist shows the steps, assuming a static definition. + +Config Checklist + +Step 1. Configure the physical interfaces as follows, in interface configuration mode: + +A. Add the channel-group number mode on command to add it to the chan-nel. Use the same number for all physical interfaces on the same switch, but the number used (the channel-group number) can differ on the two neigh-boring switches. +B. Add the no switchport command to make each physical port a routed port. 17 Step 2. Configure the PortChannel interface: +A. Use the interface port-channel number command to move to port-channel configuration mode for the same channel number configured on the physi-cal interfaces. +B. Add the no switchport command to make sure that the port-channel inter-face acts as a routed port. (IOS may have already added this command.) + +C. Use the ip address address mask command to configure the address and mask. + + + +NOTE Cisco uses the term EtherChannel in concepts discussed in this section and then uses the term PortChannel, with command keyword port-channel, when verifying and con-figuring EtherChannels. For the purposes of understanding the technology, you may treat these terms as synonyms. However, it helps to pay close attention to the use of the terms PortChannel and EtherChannel as you work through the examples in this section because IOS uses both. + +Example 17-12 shows an example of the configuration for a Layer 3 EtherChannel for switch SW1 in Figure 17-7. The EtherChannel defines port-channel interface 12 and uses subnet 10.1.12.0/24. + + +interface port-channel 12 +ip address 10.1.12.1 255.255.255.0 no switchport + +interface port-channel 12 +ip address 10.1.12.2 255.255.255.0 no switchport + + + +Fa0/22 + +Po12 +G1/0/13 + +Po12 +G1/0/13 + + +Fa0/23 + +Fa0/21 SW1 G1/0/14 G1/0/14 SW2 Fa0/24 + + +VLAN 2 Subnet 10.1.12.0/24 Subnet 10.1.2.0/24 + +VLAN 3 Subnet 10.1.3.0/24 + +Figure 17-7 Design Used in EtherChannel Configuration Examples + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +412 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 17-12 Layer 3 EtherChannel Configuration on Switch SW1 + +interface GigabitEthernet1/0/13 +no switchport +no ip address +channel-group 12 mode on +! +interface GigabitEthernet1/0/14 +no switchport +no ip address +channel-group 12 mode on +! +interface Port-channel12 +no switchport +ip address 10.1.12.1 255.255.255.0 + + +Of particular importance, note that although the physical interfaces and PortChannel interface are all routed ports, the IP address should be placed on the PortChannel interface only. In fact, when the no switchport command is configured on an interface, IOS adds the no ip address command to the interface. Then configure the IP address on the PortChannel interface only. + +Once configured, the PortChannel interface appears in several commands, as shown in Example 17-13. The commands that list IP addresses and routes refer to the PortChannel interface. Also, note that the show interfaces status command lists the fact that the physical ports and the port-channel 12 interface are all routed ports. + +Example 17-13 Verification Commands Listing Interface Port-Channel 12 from Switch SW1 + +SW1# show interfaces port-channel 12 +Port-channel12 is up, line protocol is up (connected) +Hardware is EtherChannel, address is bcc4.938b.e543 (bia bcc4.938b.e543) +Internet address is 10.1.12.1/24 +! lines omitted for brevity + +SW1# show interfaces status +! Only ports related to the example are shown. +Port Name Status Vlan Duplex Speed Type + +Gi1/0/13 +Gi1/0/14 +Po12 + +connected routed +connected routed +connected routed + +a-full a-1000 10/100/1000BaseTX +a-full a-1000 10/100/1000BaseTX +a-full a-1000 + + +SW1# show ip route +! legend omitted for brevity +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.2.0/24 is directly connected, Vlan2 +L 10.1.2.1/32 is directly connected, Vlan2 +C 10.1.12.0/24 is directly connected, Port-channel12 +L 10.1.12.1/32 is directly connected, Port-channel12 + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 413 + +For a final bit of verification, you can examine the EtherChannel directly with the show etherchannel summary command as listed in Example 17-14. Note in particular that it lists a flag legend for characters that identify key operational states, such as whether a port is +bundled (included) in the PortChannel (P) and whether it is acting as a routed (R) or switched (S) port. + +Example 17-14 Verifying the EtherChannel + +SW1# show etherchannel 12 summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + + +17 + + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+----------------------------------------------- +12 Po12(RU) - Gi1/0/13(P) Gi1/0/14(P) + + +Troubleshooting Layer 3 EtherChannels +When you are troubleshooting a Layer 3 EtherChannel, there are two main areas to consider. First, you need to look at the configuration of the channel-group command, which enables an interface for an EtherChannel. Second, you should check a list of settings that must match on the interfaces for a Layer 3 EtherChannel to work correctly. + +As for the channel-group interface subcommand, this command can enable EtherChannel statically or dynamically. If dynamic, this command’s keywords imply either Port Aggregation Protocol (PaGP) or Link Aggregation Control Protocol (LACP) as the pro-tocol to negotiate between the neighboring switches whether they put the link into the EtherChannel. + +If all this sounds vaguely familiar, it is the exact same configuration covered way back in the Chapter 10 section “Configuring Dynamic EtherChannels.” The configuration of the channel-group subcommand is exactly the same, with the same requirements, whether configuring Layer 2 or Layer 3 EtherChannels. So, it might be a good time to review those EtherChannel configuration details from Chapter 10. However, regardless of when you review and master those commands, note that the configuration of the EtherChannel (with the channel-group subcommand) is the same, whether Layer 2 or Layer 3. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +414 CCNA 200-301 Official Cert Guide, Volume 1 + +Additionally, you must do more than just configure the channel-group command correctly for all the physical ports to be bundled into the EtherChannel. Layer 2 EtherChannels have a longer list of requirements, but Layer 3 EtherChannels also require a few consistency checks between the ports before they can be added to the EtherChannel. The following is the list of requirements for Layer 3 EtherChannels: + +no switchport: The PortChannel interface must be configured with the no switchport command, and so must the physical interfaces. If a physical interface is not also configured with the no switchport command, it will not become operational in the EtherChannel. +Speed: The physical ports in the channel must use the same speed. duplex: The physical ports in the channel must use the same duplex. + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 17-2 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 17-2 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Repeat DIKTA questions + +Review config checklists + +Review command tables + +Do labs + +Watch video + +Resource Used Book, website +Book, website + +Book, PTP + +Book, website + +Book + +Blog + +Website + + + +Review All the Key Topics + + +Table 17-3 +Key Topic Element +Figure 17-2 + +List + +List + +Figure 17-3 + +Key Topics for Chapter 17 +Description Page Number +Concept of VLAN subinterfaces on a router 396 + +Two alternative methods to configure the native VLAN in a ROAS 398 configuration +Troubleshooting suggestions for ROAS configuration 401 + +Layer 3 switching with SVIs concept and configuration 402 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 17: IP Routing in the LAN 415 + + +Key Topic Element +List + +Figure 17-4 + +List + +Figure 17-7 + +List + +Description Page Number +Troubleshooting suggestions for correct operation of a Layer 3 405 switch that uses SVIs +Layer 3 switching with routed ports concept and configuration 407 + +show commands that list Layer 3 routed ports in their output 408 + +Layer 3 EtherChannel concept and configuration 411 + +List of configuration settings that must be consistent before IOS 414 will bundle a link with an existing Layer 3 EtherChannel + +17 + + +Key Terms You Should Know +router-on-a-stick (ROAS), switched virtual interface (SVI), VLAN interface, Layer 3 EtherChannel (L3 EtherChannel), routed port, Layer 3 switch, multilayer switch, subinterfaces + +Command References +Tables 17-4 and 17-5 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + +Table 17-4 +Command + +Chapter 17 Configuration Command Reference +Description + + + +interface type number.subint + +encapsulation dot1q vlan-id [native] + +[no] ip routing + + +interface vlan vlan-id + + +sdm prefer lanbase-routing + +[no] switchport + +Router global command to create a subinterface and to enter configuration mode for that subinterface +Router subinterface subcommand that tells the router to use 802.1Q trunking, for a particular VLAN, and with the native keyword, to not encapsulate in a trunking header +Global command that enables (ip routing) or disables (no ip routing) the routing of IPv4 packets on a router or Layer 3 switch +A switch global command on a Layer 3 switch to create a VLAN interface and to enter configuration mode for that VLAN interface +Command on some Cisco switches that reallocates forwarding chip memory to allow for an IPv4 routing table +Layer 3 switch subcommand that makes the port act as a Layer 2 port (switchport) or Layer 3 routed port (no switchport) + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +416 CCNA 200-301 Official Cert Guide, Volume 1 + +Command Description +interface port-channel channel- A switch command to enter PortChannel configuration number mode and also to create the PortChannel if not already +created + +channel-group channel-number Interface subcommand that enables EtherChannel on the mode {auto | desirable | active | interface +passive | on} + + + + +Table 17-5 +Command + +Chapter 17 EXEC Command Reference +Description + + + +show ip route + +show ip route [connected] + +show vlans + +show interfaces [interface type number] + +show interfaces [interface type number] status + +show interfaces interface-id switchport + + +show interfaces vlan number + +show etherchannel [channel-group-number] summary + +Lists the router’s entire routing table + +Lists a subset of the IP routing table + +Lists VLAN configuration and statistics for VLAN trunks configured on routers +Lists detailed status and statistical information, including IP address and mask, about all interfaces (or the listed interface only) +Among other facts, for switch ports, lists the access VLAN or the fact that the interface is a trunk; or, for routed ports, lists “routed” +For switch ports, lists information about any interface regarding administrative settings and operational state; for routed ports, the output simply confirms the port is a routed (not switched) port +Lists the interface status, the switch’s IPv4 address and mask, and much more +Lists information about the state of EtherChannels on this switch, including whether the channel is a Layer 2 or Layer 3 EtherChannel + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 18 + + +Troubleshooting IPv4 Routing This chapter covers the following exam topics: +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +3.0 IP Connectivity +3.3 Configure and verify IPv4 and IPv6 static routing + +3.3.a Default route + +3.3.b Network route + +3.3.c Host route + +3.3.d Floating static + +The first three chapters in this part of the book took you from a starting point of under-standing IP addressing and subnetting to the details of implementing IP addressing, routing between connected subnets, and configuring static routes. All those steps include the idea of configuring a command and seeing a route show up in the IP routing table on that same router. + +This chapter turns our attention to routing from end-to-end across an entire enterprise net-work. How do you troubleshoot an IPv4 network? How do you verify correct operation, identify root causes, and fix those for various IP routing features? How do you do that in the presence of an IP addressing and subnetting plan, requiring you to apply all that subnet-ting math from Part IV of this book and the basic address/mask and static route configura-tion from the other chapters here in Part V? This chapter answers some of those questions. + +In particular, this chapter focuses on two tools and how to use them: ping and traceroute. Both tools test the IPv4 data plane; that is, the ability of each networking device to route or forward IPv4 packets. This chapter devotes a major section each to ping and traceroute. The chapter then ends with a short discussion of two other router tools that can also be useful for troubleshooting: Telnet and Secure Shell (SSH). + +“Do I Know This Already?” Quiz +I put DIKTA quizzes in most of the chapters as a tool to help you decide how to approach reading a chapter. However, this chapter does not have a DIKTA quiz because I think you should read it regardless of your prior knowledge. As with all chapters in this book, this chapter introduces new concepts, but it also acts as a tool to review and deepen your under-standing of IP routing. I hope you enjoy the perspectives on using ping and traceroute in this chapter. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Foundation Topics + +Problem Isolation Using the ping Command +Someone sends you an email or text, or a phone message, asking you to look into a user’s network problem. You Secure Shell (SSH) to a router and issue a ping command that works. What does that result rule out as a possible reason for the problem? What does it rule in as still being a possible root cause? + +Then you issue another ping to another address, and this time the ping fails. Again, what does the failure of that ping command tell you? What parts of IPv4 routing may still be a problem, and what parts do you now know are not a problem? + +The ping command gives us one of the most common network troubleshooting tools. When the ping command succeeds, it confirms many individual parts of how IP routing works, rul-ing out some possible causes of the current problem. When a ping command fails, it often helps narrow down where in the internetwork the root cause of the problem may be happen-ing, further isolating the problem. + +This section begins with a brief explanation of how ping works. It then moves on to some suggestions and analysis of how to use the ping command to isolate problems by removing some items from consideration. + +Ping Command Basics +The ping command tests connectivity by sending packets to an IP address, expecting the device at that address to send packets back. The command sends packets that mean “if you receive this packet, and it is addressed to you, send a reply back.” Each time the ping com-mand sends one of these packets and receives the message sent back by the other host, the ping command knows a packet made it from the source host to the destination and back. + +More formally, the ping command uses the Internet Control Message Protocol (ICMP), spe-cifically the ICMP echo request and ICMP echo reply messages. ICMP defines many other messages as well, but these two messages were made specifically for connectivity testing by commands like ping. As a protocol, ICMP does not rely on TCP or UDP, and it does not use any application layer protocol. It functions as part of Layer 3, as a control protocol to assist IP by helping manage the IP network functions. + +Figure 18-1 shows the ICMP messages, with IP headers, in an example. In this case, the user at host A opens a command prompt and issues the ping 172.16.2.101 command, test-ing connectivity to host B. The command sends one echo request and waits (Step 1); host B receives the messages and sends back an echo reply (Step 2). + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +420 CCNA 200-301 Official Cert Guide, Volume 1 + + +172.16.1.51 +A +SW1 R1 + +172.16.2.101 +B +R2 SW2 + + +1 IP ICMP +Echo Request IP ICMP 2 Echo Reply +Figure 18-1 Concept Behind ping 172.16.2.101 on Host A + +The ping command is supported on many different devices and many common operating systems. The command has many options: the name or IP address of the destination, how many times the command should send an echo request, how long the command should wait (timeout) for an echo reply, how big to make the packets, and many other options. Example 18-1 shows a sample from host A, with the same command that matches the concept in Figure 18-1: a ping 172.16.2.101 command on host A. + +Example 18-1 Sample Output from Host A’s ping 172.16.2.101 Command + +Wendell-Odoms-iMac:~ wendellodom$ ping 172.16.2.101 +PING 172.16.2.101 (172.16.2.101): 56 data bytes +64 bytes from 172.16.2.101: icmp_seq=0 ttl=64 time=1.112 ms +64 bytes from 172.16.2.101: icmp_seq=1 ttl=64 time=0.673 ms +64 bytes from 172.16.2.101: icmp_seq=2 ttl=64 time=0.631 ms +64 bytes from 172.16.2.101: icmp_seq=3 ttl=64 time=0.674 ms +64 bytes from 172.16.2.101: icmp_seq=4 ttl=64 time=0.642 ms +64 bytes from 172.16.2.101: icmp_seq=5 ttl=64 time=0.656 ms +^C +--- 172.16.2.101 ping statistics --- +6 packets transmitted, 6 packets received, 0.0% packet loss +round-trip min/avg/max/stddev = 0.631/0.731/1.112/0.171 ms + + +Strategies and Results When Testing with the ping Command +Often, the person handling initial calls from users about problems (often called a customer support rep, or CSR) cannot issue ping commands from the user’s device. In some cases, talking users through typing the right commands and making the right clicks on their machines can be a problem. Or, the user just might not be available. As an alternative, using different ping commands from different routers can help isolate the problem. + +The problem with using ping commands from routers, instead of from the host that has the problem, is that no single router ping command can exactly replicate a ping command done from the user’s device. However, each different ping command can help isolate a problem further. The rest of this section of ping commands discusses troubleshooting IPv4 routing by using various ping commands from the command-line interface (CLI) of a router. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 18: Troubleshooting IPv4 Routing 421 + +Testing Longer Routes from Near the Source of the Problem +Most problems begin with some idea like “host X cannot communicate with host Y.” A great first troubleshooting step is to issue a ping command from X for host Y’s IP address. However, assuming the engineer does not have access to host X, the engineer can instead issue the ping from the router nearest X, typically the router acting as host X’s default gateway. + +For instance, in Figure 18-1, imagine that the user of host A had called IT support with a problem related to sending packets to host B. A ping 172.16.2.101 command on host A would be a great first troubleshooting step, but the CSR cannot access host A or get in touch with the user of host A. So, the CSR telnets to Router R1 and pings host B from there, as shown in Example 18-2. + +Example 18-2 Router R2 Pings Host B (Two Commands) + +R1# ping 172.16.2.101 +Type escape sequence to abort. 18 Sending 5, 100-byte ICMP Echos to 172.16.2.101, timeout is 2 seconds: +.!!!! +Success rate is 80 percent (4/5), round-trip min/avg/max = 1/2/4 ms +R1# ping 172.16.2.101 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 172.16.2.101, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms + + +First, take a moment to review the output of the first IOS ping command. By default, the Cisco IOS ping command sends five echo messages, with a timeout of 2 seconds. If the com-mand does not receive an echo reply within 2 seconds, the command considers that message to be a failure, and the command lists a period. If a successful reply is received within 2 sec-onds, the command displays an exclamation point. So, in this first command, the first echo reply timed out, whereas the other four received a matching echo reply within 2 seconds. + +As a quick aside, the example shows a common and normal behavior with ping commands: the first ping command shows one failure to start, but then the rest of the messages work. This usually happens because some device in the end-to-end route is missing an ARP table entry. + +Now think about troubleshooting and what a working ping command tells us about the cur-rent behavior of this internetwork. First, focus on the big picture for a moment: + +■ R1 can send ICMP echo request messages to host B (172.16.2.101). +■ R1 sends these messages from its outgoing interface’s IP address (by default), 172.16.4.1 in this case. +■ Host B can send ICMP echo reply messages to R1’s 172.16.4.1 IP address (hosts send echo reply messages to the IP address from which the echo request was received). + +Figure 18-2 shows the packet flow. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +422 CCNA 200-301 Official Cert Guide, Volume 1 + +172.16.1.0/24 172.16.4.1 172.16.2.0/24 + + +A G0/0/0 SW1 R1 + + +R2 .2 SW2 B +.101 + + +Echo Request +Echo Reply + +Figure 18-2 Standard ping 172.6.2.101 Command Using the Source Interface IP Address + +Next, think about IPv4 routing. In the forward direction, R1 must have a route that matches host B’s address (172.16.2.101); this route will be either a static route or one learned with a routing protocol. R2 also needs a route for host B’s address, in this case a connected route to B’s subnet (172.16.2.0/24), as shown in the top arrow lines in Figure 18-3. +Static or Dynamic + +172.16.1.0/24 Connected 172.16.2.0/24 + + +A +SW1 R1 172.16.4.1 + +R2 .2 SW2 B + + + +.51 +Connected + +172.16.2.101 + +Default Router + + +Figure 18-3 Layer 3 Routes Needed for R1’s Ping 172.16.2.101 to Work + +The arrow lines on the bottom of Figure 18-3 show the routes needed to forward the ICMP echo reply message back to Router R1’s 172.16.4.1 interface. First, host B must have a valid default router setting because 172.16.4.1 sits in a different subnet than host B. R2 must also have a route that matches destination 172.16.4.1 (in this case, likely to be a connected route). + +The working ping commands in Example 18-2 also require the data-link and physical layer details to be working. The WAN link must be working: The router interfaces must be up/up, which typically indicates that the link can pass data. On the LAN, R2’s LAN interface must be in an up/up state. In addition, everything discussed about Ethernet LANs must be working because the ping confirmed that the packets went all the way from R1 to host B and back. In particular + +■ The switch interfaces in use are in a connected (up/up) state. +■ Port security (discussed in the CCNA 200-301 Official Cert Guide, Volume 2) does not filter frames sent by R2 or host B. +■ STP has placed the right ports into a forwarding state. + +The ping 172.16.2.101 command in Example 18-2 also confirms that IP access control lists (ACL) did not filter the ICMP messages. One ACL contains a set of matching rules and actions: some matched packets are filtered (discarded), while others can continue on their path as normal. ACLs can examine packets as they enter or exit a router interface, so Figure 18-4 shows the various locations on routers R1 and R2 where an ACL could have filtered (discarded) the ICMP messages. (Note that an outbound ACL on router R1 would not filter packets created on R1, so there is no rightward-facing arrow over R1.) + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 18: Troubleshooting IPv4 Routing 423 + + +In Out + +A +SW1 R1 R2 .51 In Out In + + +B SW2 +172.16.2.101 + + +Figure 18-4 Locations Where IP ACLs Could Have Filtered the Ping Messages + +Finally, the working ping 172.16.2.101 command on R1 can also be used to reasonably predict that ARP worked and that switch SW2 learned MAC addresses for its MAC address table. R2 and host B need to know each other’s MAC addresses so that they can encapsulate the IP packet inside an Ethernet frame, which means both must have a matching ARP table entry. The switch learns the MAC address used by R2 and by host B when it sends the ARP messages or when it sends the frames that hold the IP packets. Figure 18-5 shows the type of information expected in those tables. + + +R2 ARP Table +IP Address MAC Address + +Host B ARP Table 18 IP Address MAC Address + +172.16.2.101 0200.2222.2222 172.16.2.2 0200.0202.0202 + + +0200.0202.0202 +R2 172.16.2.2 F0/10 + +0200.2222.2222 B +F0/2 172.16.2.101 + + +SW2 Address Table +MAC Address Output +0200.2222.2222 F0/2 0200.0202.0202 F0/10 + +Figure 18-5 Router and Host ARP Tables, with the Switch MAC Address Table + +As you can see from the last few pages, a strategy of using a ping command from near the source of the problem can rule out a lot of possible root causes of any problems between two hosts—assuming the ping command succeeds. However, this ping command does not act exactly like the same ping command on the actual host. To overcome some of what is missing in the ping command from a nearby router, the next several examples show some strategies for testing other parts of the path between the two hosts that might have a current problem. + +Using Extended Ping to Test the Reverse Route +Pinging from the default router, as discussed in the past few pages, misses an opportunity to test IP routes more fully. In particular, it does not test the reverse route back toward the original host. + +For instance, referring to the internetwork in Figure 18-2 again, note that the reverse routes do not point to an address in host A’s subnet. When R1 processes the ping 172.16.2.101 command, R1 has to pick a source IP address to use for the echo request, and routers choose the IP address of the outgoing interface. The echo request from R1 to host B flows with source IP address 172.16.4.1 (R1’s G0/0/0 IP address). The echo reply flows back to that same address (172.16.4.1). + + +|||||||||||||||||||| +|||||||||||||||||||| + + +424 CCNA 200-301 Official Cert Guide, Volume 1 + +A standard ping often does not test the reverse route that you need to test. In this case, the standard ping 172.16.2.101 command on R1 does not test whether the routers can route back to subnet 172.16.1.0/24, instead testing their routes for subnet172.16.4.0. A better ping test would test the route back to host A’s subnet; an extended ping from R1 can cause that test to happen. Extended ping allows R1’s ping command to use R1’s LAN IP address from within subnet 172.16.1.0/24. Then, the echo reply messages would flow to host A’s subnet, as shown in Figure 18-6. + +172.16.1.1 +172.16.1.0/24 172.16.2.0/24 + + +A G0/0 G0/0/0 SW1 R1 +.51 + + +B R2 .2 SW2 +.101 + + +Echo Request + +Echo Reply + +Figure 18-6 Extended Ping Command Tests the Route to 172.16.1.51 (Host A) + +The extended ping command does allow the user to type all the parameters on a potentially long command, but it also allows users to simply issue the ping command, press Enter, with IOS then asking the user to answer questions to complete the command, as shown +in Example 18-3. The example shows the ping command on R1 that matches the logic in Figure 18-6. This same command could have been issued from the command line as ping 172.16.2.101 source 172.16.1.1. + +Example 18-3 Testing the Reverse Route Using the Extended Ping + +R1# ping +Protocol [ip]: +Target IP address: 172.16.2.101 +Repeat count [5]: +Datagram size [100]: +Timeout in seconds [2]: +Extended commands [n]: y +Source address or interface: 172.16.1.1 +Type of service [0]: +Set DF bit in IP header? [no]: +Validate reply data? [no]: +Data pattern [0xABCD]: +Loose, Strict, Record, Timestamp, Verbose[none]: +Sweep range of sizes [n]: +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 172.16.2.101, timeout is 2 seconds: +Packet sent with a source address of 172.16.1.1 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 18: Troubleshooting IPv4 Routing + +This particular extended ping command tests the same routes for the echo request going to the right, but it forces a better test of routes pointing back to the left for the ICMP echo reply. For that direction, R2 needs a route that matches address 172.16.1.1, which is likely to be a route for subnet 172.16.1.0/24—the same subnet in which host A resides. + +From a troubleshooting perspective, using both standard and extended ping commands can be useful. However, neither can exactly mimic a ping command created on the host itself because the routers cannot send packets with the host’s IP address. For instance, the extend-ed ping in Example 18-3 uses source IP address 172.16.1.1, which is not host A’s IP address. As a result, neither the standard or extended ping commands in these two examples so far in this chapter can test for some kinds of problems, such as the following: + +■ IP ACLs that discard packets based on host A’s IP address but allow packets that match the router’s IP address +■ LAN switch port security that filters A’s frames (based on A’s MAC address) +■ IP routes on routers that happen to match host A’s 172.16.1.51 address, with different routes that match R1’s 172.16.1.1 address +■ Problems with host A’s default router setting + +425 + + + + + + + + + + + + + + + + +18 + + + +NOTE IP ACLs and LAN switch port security are covered in CCNA 200-301 Official Cert Guide, Volume 2. For now, know that IP ACLs can filter packets on routers, focusing on the Layer 3 and 4 headers. Port security can be enabled on Layer 2 switches to filter based on source MAC addresses. + + +Testing LAN Neighbors with Standard Ping +Testing using a ping of another device on the LAN can quickly confirm whether the LAN can pass packets and frames. Specifically, a working ping rules out many possible root causes of a problem. For instance, Figure 18-7 shows the ICMP messages that occur if R1 issues the command ping 172.16.1.51, pinging host A, which sits on the same VLAN as R1. + +Destination 172.16.1.1… Same Subnet! + +ping 172.16.1.51 + +A .51 .1 +R1 R2 + +Echo Request +Echo Reply +172.16.1.0 /24 + +Figure 18-7 Standard ping Command Confirms That the LAN Works + +If the ping works, it confirms the following, which rules out some potential issues: + +■ The host with address 172.16.1.51 replied. +■ The LAN can pass unicast frames from R1 to host 172.16.1.51 and vice versa. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +426 CCNA 200-301 Official Cert Guide, Volume 1 + +■ You can reasonably assume that the switches learned the MAC addresses of the router and the host, adding those to the MAC address tables. +■ Host A and Router R1 completed the ARP process and list each other in their respective Address Resolution Protocol (ARP) tables. + +The failure of a ping, even with two devices on the same subnet, can point to a variety of problems, like those mentioned in this list. For instance, if the ping 172.16.1.51 on R1 fails (Figure 18-7), that result points to this list of potential root causes: + +■ IP addressing problem: Host A could be statically configured with the wrong IP address. +■ DHCP problems: If you are using Dynamic Host Configuration Protocol (DHCP), many problems could exist. Chapter 7, “Implementing DHCP” in CCNA 200-301 Official Cert Guide, Volume 2, discusses those possibilities in some depth. +■ VLAN trunking problems: The router could be configured for 802.1Q trunking, when the switch is not (or vice versa). +■ LAN problems: A wide variety of issues could exist with the Layer 2 switches, preventing any frames from flowing between host A and the router. + +So, whether the ping works or fails, simply pinging a LAN host from a router can help fur-ther isolate the problem. + +Testing LAN Neighbors with Extended Ping +A standard ping of a LAN host from a router does not test that host’s default router setting. However, an extended ping can test the host’s default router setting. Both tests can be useful, especially for problem isolation, because + +■ If a standard ping of a local LAN host works… +■ But an extended ping of the same LAN host fails… +■ The problem likely relates somehow to the host’s default router setting. + +First, to understand why the standard and extended ping results have different effects, con-sider first the standard ping 172.16.1.51 command on R1, as shown previously in Figure 18-7. As a standard ping command, R1 used its LAN interface IP address (172.16.1.1) as the +source of the ICMP Echo. So, when the host (A) sent back its ICMP echo reply, host A con-sidered the destination of 172.16.1.1 as being on the same subnet. Host A’s ICMP echo reply message, sent back to 172.16.1.1, would work even if host A did not have a default router setting at all! + +In comparison, Figure 18-8 shows the difference when using an extended ping on Router R1. An extended ping from local Router R1, using R1’s S0/0/0 IP address of 172.16.4.1 as the source of the ICMP echo request, means that host A’s ICMP echo reply will flow to an address in another subnet, which makes host A use its default router setting. + +The comparison between the previous two figures shows one of the most classic mistakes when troubleshooting networks. Sometimes, the temptation is to connect to a router and ping the host on the attached LAN, and it works. So, the engineer moves on, thinking that the network layer issues between the router and host work fine, when the problem still exists with the host’s default router setting. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 18: Troubleshooting IPv4 Routing 427 + +2 Destination 172.16.4.1… Another Subnet! + +172.16.1.0 /24 ping 172.16.1.51 + +A .51 172.16.1.1 + +1 Echo Request + + +172.16.4.1 +R1 R2 +172.16.4.0 /24 + +3 Echo Reply + +Figure 18-8 Extended ping Command Does Test Host A’s Default Router Setting + + +Testing WAN Neighbors with Standard Ping +As with a standard ping test across a LAN, a standard ping test between routers over a serial or Ethernet WAN link tests whether the link can pass IPv4 packets. With a properly designed IPv4 addressing plan, two routers on the same serial or Ethernet WAN link should have IP addresses in the same subnet. A ping from one router to the IP address of the other router confirms that an IP packet can be sent over the link and back, as shown in the ping +172.16.4.2 command on R1 in Figure 18-9. + + + + + +18 + + +ping 172.16.4.2 + + +A 172.16.4.1 172.16.4.2 +SW1 R1 R2 +.51 + + +B +SW2 +172.16.2.101 + + +Echo Request +Echo Reply + +Figure 18-9 Pinging Across a WAN Link + +A successful ping of the IP address on the other end of an Ethernet WAN link that sits between two routers confirms several specific facts, such as the following: + +■ Both routers’ WAN interfaces are in an up/up state. ■ The Layer 1 and 2 features of the link work. +■ The routers believe that the neighboring router’s IP address is in the same subnet. ■ Inbound ACLs on both routers do not filter the incoming packets, respectively. +■ The remote router is configured with the expected IP address (172.16.4.2 in this case). + +Testing by pinging the other neighboring router does not test many other features. However, although the test is limited in scope, it does let you rule out WAN links as having a Layer 1 or 2 problem, and it rules out some basic Layer 3 addressing problems. + +Using Ping with Names and with IP Addresses +All the ping examples so far in this chapter show a ping of an IP address. However, the ping command can use hostnames, and pinging a hostname allows the network engineer to fur-ther test whether the Domain Name System (DNS) process works. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +428 CCNA 200-301 Official Cert Guide, Volume 1 + +First, most every TCP/IP application today uses hostnames rather than IP addresses to iden-tify the other device. No one opens a web browser and types in 72.163.4.185. Instead, they type in a web address, like www.cisco.com, which includes the hostname www.cisco.com. Then, before a host can send data to a specific IP address, the host must first ask a DNS server to resolve that hostname into the matching IP address. + +For example, in the small internetwork used for several examples in this chapter, a ping B command on host A tests A’s DNS settings, as shown in Figure 18-10. When host A sees the use of a hostname (B), it first looks in its local DNS name cache to find out whether it has already resolved the name B. If not, host A first asks the DNS to supply (resolve) the name into its matching IP address (Step 1 in the figure). Only then does host A send a packet to 172.16.2.101, host B’s IP address (Step 2). + +DNS + + + + +1 A + +2 + +Figure 18-10 + + +R3 B + +R1 R2 + +DNS Name Resolution by Host A + + +When troubleshooting, testing from the host by pinging using a hostname can be very help-ful. The command, of course, tests the host’s own DNS client settings. For instance, a classic comparison is to first ping the destination host using the hostname, which requires a DNS request. Then, repeat the same test, but use the destination host’s IP address instead of its name, which does not require the DNS request. If the ping of the hostname fails but the ping of the IP address works, the problem usually has something to do with DNS. + +Problem Isolation Using the traceroute Command +Like ping, the traceroute command helps network engineers isolate problems. Here is a com-parison of the two: + +■ Both send messages in the network to test connectivity. ■ Both rely on other devices to send back a reply. +■ Both have wide support on many different operating systems. +■ Both can use a hostname or an IP address to identify the destination. +■ On routers, both have a standard and extended version, allowing better testing of the reverse route. + +The biggest differences relate to the more detailed results in the output of the traceroute command and the extra time and effort it takes traceroute to build that output. This second major section examines how traceroute works; plus it provides some suggestions on how to use this more detailed information to more quickly isolate IP routing problems. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 18: Troubleshooting IPv4 Routing + +traceroute Basics +Imagine some network engineer or CSR starts to troubleshoot some problem. The engineer pings from the user’s host, pings from a nearby router, and after a few commands, convinces herself that the host can indeed send and receive IP packets. The problem might not be solved yet, but the problem does not appear to be a network problem. + +Now imagine the next problem comes along, and this time the ping command fails. It appears that some problem does exist in the IP network. Where is the problem? Where should the engineer look more closely? Although the ping command can prove helpful in isolating the source of the problem, the traceroute command may be a better option. The traceroute command systematically helps pinpoint routing problems by showing how far a packet goes through an IP network before being discarded. + +The traceroute command identifies the routers in the path from source host to destination host. Specifically, it lists the next-hop IP address of each router that would be in each of the individual routes. For instance, a traceroute 172.16.2.101 command on host A in Figure 18-11 would identify an IP address on Router R1, another on Router R2, and then host B, as shown in +the figure. Example 18-4, which follows, lists the output of the command, taken from host A. + +429 + + + + + + + + + + + + + + + + +18 + + +172.16.1.1 172.16.4.2 172.16.2.101 + +A +B +R1 R2 +traceroute 172.16.2.101 + +Figure 18-11 IP Addresses Identified by a Successful traceroute 172.16.2.101 Command + +Example 18-4 Output from traceroute 172.16.2.101 on Host A + +Wendell-Odoms-iMac:~ wendellodom$ traceroute 172.16.2.101 +traceroute to 172.16.2.101, 64 hops max, 52 byte packets +1 172.16.1.1 (172.16.1.1) 0.870 ms 0.520 ms 0.496 ms +2 172.16.4.2 (172.16.4.2) 8.263 ms 7.518 ms 9.319 ms +3 172.16.2.101 (172.16.2.101) 16.770 ms 9.819 ms 9.830 ms + + +How the traceroute Command Works +The traceroute command gathers information by generating packets that trigger error mes-sages from routers; these messages identify the routers, letting the traceroute command +list the routers’ IP addresses in the output of the command. That error message is the ICMP Time-to-Live Exceeded (TTL Exceeded) message, originally meant to notify hosts when a packet had been looping around a network. + +Ignoring traceroute for a moment and instead focusing on IP routing, IPv4 routers defeat routing loops in part by discarding looping IP packets. To do so, the IPv4 header holds a field called Time To Live (TTL). The original host that creates the packet sets an initial TTL value. Then each router that forwards the packet decrements the TTL value by 1. When a router decrements the TTL to 0, the router perceives the packet is looping, and the router dis-cards the packet. The router also notifies the host that sent the discarded packet by sending an ICMP TTL Exceeded message. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +430 CCNA 200-301 Official Cert Guide, Volume 1 + +Now back to traceroute. Traceroute sends messages with low TTL values to make the routers send back a TTL Exceeded message. Specifically, a traceroute command begins by sending several packets (usually three), each with the header TTL field equal to 1. When that packet arrives at the next router—host A’s default Router R1 in the example of Figure 18-12—the router decrements TTL to 0 and discards the packet. The router then sends host A the TTL Exceeded message, which identifies the router’s IP address to the traceroute command. + +A 172.16.1.1 +R1 + +1 IP TTL=1 + + +TTL Exceeded + + +2 TTL – 1 = 0 + +3 + +Source 172.16.1.1 + +Figure 18-12 How traceroute Identifies the First Router in the Route + +The traceroute command sends several TTL=1 packets, checking them to see whether the TTL Exceeded messages flow from the same router, based on the source IP address of the TTL Exceeded message. Assuming the messages come from the same router, the traceroute command lists that IP address as the next line of output on the command. + +To find all the routers in the path, and finally confirm that packets flow all the way to the destination host, the traceroute command sends a small set of packets with TTL=1, then a small set with TTL=2, then 3, 4, and so on, until the destination host replies. Figure 18-13 shows the packet from the second set with TTL=2. In this case, one router (R1) actually for-wards the packet, while another router (R2) happens to decrement the TTL to 0, causing a TTL Exceeded message to be sent back to host A. + + + +A 172.16.1.1 +R1 + + +172.16.4.2 G0/0/1 +R2 + +172.16.2.101 +B + + +1 IP TTL=2 2 IP TTL=1 3 TTL – 1 = 0 + +TTL Exceeded 4 + +Source 172.16.4.2 + +Figure 18-13 TTL=2 Message Sent by traceroute + +The figure shows these four steps: + +1. The traceroute command sends a packet from the second set with TTL=2. +2. Router R1 processes the packet and decrements TTL to 1. R1 forwards the packet. 3. Router R2 processes the packet and decrements TTL to 0. R2 discards the packet. +4. R2 notifies the sending host of the discarded packet by sending a TTL Exceeded ICMP message. The source IP address of that message is 172.16.4.2. + +Finally, the choice of source IP address to use on the time-exceeded message returned by routers has a big impact on the output of the traceroute command. Most routers use simpler + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 18: Troubleshooting IPv4 Routing 431 + +logic that also makes command output like traceroute more consistent and meaningful. That logic: choose the TTL Exceeded message’s source IP address based on the source interface of the original message that was discarded due to TTL. In the example in Figure 18-13, the original message at Step 2 arrived on R2’s G0/0/1 interface, so at Step 3, R2 uses G0/0/1’s +IP address as the source IP address of the TTL Exceeded message, and as the interface out which to send the message. + +Standard and Extended traceroute +The standard and extended options for the traceroute command give you many of the same options as the ping command. For instance, Example 18-5 lists the output of a standard traceroute command on Router R1. Like the standard ping command, a standard tracer-oute command chooses an IP address based on the outgoing interface for the packet sent by the command. So, in this example, the packets sent by R1 come from source IP address 172.16.4.1, R1’s G0/0/0 IP address. +Example 18-5 Standard traceroute Command on R1 18 + +R1# traceroute 172.16.2.101 +Type escape sequence to abort. +Tracing the route to 172.16.2.101 +VRF info: (vrf in name/id, vrf out name/id) +1 172.16.4.2 0 msec 0 msec 0 msec +2 172.16.2.101 0 msec 0 msec * + + +The extended traceroute command, as shown in Example 18-6, follows the same basic command structure as the extended ping command. The user can type all the parameters on one command line, but it is much easier to just type traceroute, press Enter, and let IOS prompt for all the parameters, including the source IP address of the packets (172.16.1.1 in this example). + +Example 18-6 Extended traceroute Command on R1 + +R1# traceroute +Protocol [ip]: +Target IP address: 172.16.2.101 +Source address: 172.16.1.1 +Numeric display [n]: +Timeout in seconds [3]: +Probe count [3]: +Minimum Time to Live [1]: +Maximum Time to Live [30]: +Port Number [33434]: +Loose, Strict, Record, Timestamp, Verbose[none]: +Type escape sequence to abort. +Tracing the route to 172.16.2.101 +VRF info: (vrf in name/id, vrf out name/id) +1 172.16.4.2 0 msec 0 msec 0 msec +2 172.16.2.101 0 msec 0 msec * + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +432 CCNA 200-301 Official Cert Guide, Volume 1 + +Both the ping and traceroute commands exist on most operating systems, including Cisco IOS. However, some operating systems use a slightly different syntax for traceroute. +For example, most Windows operating systems support tracert and pathping, and not traceroute. Linux and OS X support the traceroute command. + +NOTE Host OS traceroute commands usually create ICMP echo requests. The Cisco IOS traceroute command instead creates IP packets with a UDP header. This bit of information may seem trivial at this point. However, note that an ACL may actually filter the traffic from a host’s traceroute messages but not the router traceroute command, or vice versa. + + +Telnet and SSH +The ping and traceroute commands do give networkers two great tools to begin isolating the cause of an IP routing problem. However, these two commands tell us nothing about the operation state inside the various network devices. Once you begin to get an idea of the +kinds of problems and the possible locations of the problems using ping and traceroute, the next step is to look at the status of various router and switch features. One way to do that is to use Telnet or Secure Shell (SSH) to log in to the devices. + +Common Reasons to Use the IOS Telnet and SSH Client +Normally, a network engineer would log in to the remote device using a Telnet or SSH client on a PC, tablet, or any other user device. In fact, often, the same software package does both Telnet and SSH. However, in some cases, you may want to take advantage of the Telnet and SSH client built in to IOS on the routers and switches to Telnet/SSH from one Cisco device to the next. + +To understand why, consider the example shown in Figure 18-14. The figure shows arrowed lines to three separate IP addresses on three separate Cisco routers. PC1 has attempted to Telnet to each address from a different tab in PC1’s Telnet/SSH client. However, R2 happens to have an error in its routing protocol configuration, so R1, R2, and R3 fail to learn any routes from each other. As a result, PC1’s Telnet attempt to both 10.1.2.2 (R2) and 10.1.3.3 (R3) fails. + + + + + +PC1 .1 .1 +G0/2 R1 G0/1 + +.2 .2 +G0/2 R2 G0/1 + +.3 +G0/2 R3 G0/1 + + +10.1.1.0/24 10.1.2.0/24 10.1.3.0/24 + +Figure 18-14 Telnet Works from PC1 to R1 but Not to R2 or R3 + +In some cases, like this one, a Telnet or SSH login from the network engineer’s device can fail, while you could still find a way to log in using the telnet and ssh commands to use the Telnet and SSH clients on the routers or switches. With this particular scenario, all the indi-vidual data links work; the problem is with the routing protocol exchanging routes. PC1 can + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 18: Troubleshooting IPv4 Routing 433 + +ping R1’s 10.1.1.1 IP address, R1 can ping R2’s 10.1.2.2 address, and R2 can ping R3’s 10.1.3.3 address. Because each link works, and each router can send and receive packets with its neighbor on the shared data link, you could Telnet/SSH to each successive device. + +Figure 18-15 shows the idea. On the left, PC1 begins with either a Telnet/SSH or a console connection into Router R1, as shown on the left. Then the user issues the telnet 10.1.2.2 command from R1 to Telnet to R2. Once logged in to R2, the user can issue commands on R2. Then from R2, the user could issue the telnet 10.1.3.3 command to Telnet to R3, from which the user could issue commands on R3. + +R1> telnet 10.1.2.2 R2> telnet 10.1.3.3 + + +PC1 .1 .1 .2 .2 .3 +R1 Subnet 10.1.2.0/24 R2 Subnet 10.1.3.0/24 R3 + +Figure 18-15 Successive Telnet Connections: PC1 to R1, R1 to R2, and R2 to R3 18 + +The Telnet connections shown in Figure 18-15 work because each Telnet in this case uses source and destination addresses in the same subnet. For example, R1’s telnet 10.1.2.2 com-mand uses 10.1.2.2 as the destination, of course. R1 uses the outgoing interface IP address used to send packets to 10.1.2.2, 10.1.2.1 in this case. Because each of these telnet commands connects to an IP address in a connected subnet, the routing protocol could be completely misconfigured, and you could still Telnet/SSH to each successive device to troubleshoot and fix the problem. + +Network engineers also use the IOS Telnet and SSH client just for preference. For instance, if you need to log in to several Cisco devices, you could open several windows and tabs on your PC, and log in from your PC (assuming the network was not having problems). Or, you could log in from your PC to some nearby Cisco router or switch, and from there Telnet or SSH to other Cisco devices. + +IOS Telnet and SSH Examples +Using the IOS Telnet client via the telnet host command is pretty simple. Just use the IP address or hostname to identify the host to which you want to connect, and press Enter. Example 18-7 shows an example based on Figure 18-15, with R1 using Telnet to connect to 10.1.2.2 (R2). + +Example 18-7 Telnet from R1 to R2 to View Interface Status on R2 + +R1# telnet 10.1.2.2 +Trying 10.1.2.2 ... Open + +User Access Verification + +Username: wendell +Password: +R2> +R2> show ip interface brief + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +434 CCNA 200-301 Official Cert Guide, Volume 1 + +Interface IP-Address OK? Method Status Protocol +GigabitEthernet0/0 unassigned YES unset administratively down down + +GigabitEthernet0/1 +GigabitEthernet0/2 + +10.1.3.2 +10.1.2.2 + +YES manual up up +YES manual up up + +GigabitEthernet0/3 unassigned YES unset administratively down down + + +Take the time to pay close attention to the command prompts. The example begins with the user logged in to Router R1, with the R1# command prompt. After issuing the telnet 10.1.2.2 command, R2 asks the user for both a username and password because Router R2 uses local username authentication, which requires those credentials. The show ip interfaces brief command at the end of the output shows Router R2’s interfaces and IP addresses again per Example 18-7 and Figure 18-15. + +The ssh -l username host command in Example 18-8 follows the same basic ideas as the telnet host command, but with an SSH client. The -l flag means that the next parameter is the login username. In this case, the user begins logged in to Router R1 and then uses the ssh -l wendell 10.1.2.2 command to SSH to Router R2. R2 expects a username/password of wendell/odom, with wendell supplied in the command and odom supplied when R2 prompts the user. + +Example 18-8 SSH Client from R1 to R2 to View Interface Status on R2 + +R1# ssh -l wendell 10.1.2.2 + +Password: + +R2> +Interface IP-Address OK? Method Status Protocol +GigabitEthernet0/0 unassigned YES unset administratively down down + +GigabitEthernet0/1 +GigabitEthernet0/2 + +10.1.3.2 +10.1.2.2 + +YES manual up up +YES manual up up + +GigabitEthernet0/3 unassigned YES unset administratively down down + + +When you have finished using the other router, you can log out from your Telnet or SSH connection using the exit or quit command. + +Finally, note that IOS supports a mechanism to use hotkeys to move between multiple Telnet or SSH sessions from the CLI. Basically, starting at one router, you could telnet or SSH to a router, do some commands, and instead of using the exit command to end your connection, you could keep the connection open while still moving back to the command prompt of the original router. For instance, if starting at Router R1, you could Telnet to R2, R3, and R4, sus-pending but not exiting those Telnet connections. Then you could easily move between the sessions to issue new commands with a few keystrokes. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 18: Troubleshooting IPv4 Routing 435 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 18-1 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 18-1 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Watch video + +Review Date(s) Resource Used Book, website +Book, website + +Website 18 + + + +Review All the Key Topics + + +Table 18-2 +Key Topic Element +Figure 18-5 + +Figure 18-6 + +Figure 18-7 + +List + +List + +List + +Key Topics for Chapter 18 +Description Page Number +ARP tables on Layer 3 hosts, with MAC address tables on Layer 2 423 switch +How extended ping in IOS performs a better test of the reverse 424 route +Why a standard ping over a LAN does not exercise a host’s default 425 router logic +Network layer problems that could cause a ping to fail between a 426 router and host on the same LAN subnet +Testing a host’s default router setting using extended ping 426 + +Comparisons between the ping and traceroute commands 428 + + + + +Key Terms You Should Know +ping, traceroute, ICMP echo request, ICMP echo reply, extended ping, forward route, reverse route, DNS + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part V Review + +Keep track of your part review progress with the checklist in Table P5-1. Details on each task follow the table. + + +Table P5-1 + +Activity + +Part V Part Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Do Labs + +Review Videos + + +Repeat All DIKTA Questions +For this task, answer the “Do I Know This Already?” questions again for the chapters in this part of the book, using the PTP software. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Labs +Depending on your chosen lab tool, here are some suggestions for what to do in lab: + +Pearson Network Simulator: If you use the full Pearson ICND1 or CCNA simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) + +Blog Config Labs: The author’s blog includes a series of configuration-focused labs that you can do on paper, each in 10–15 minutes. Review and perform the labs for this part of the book, as found at http://blog.certskills.com. Then navigate to the Hands-on Config labs. + +Other: If using other lab tools, here are a few suggestions: Make sure to experiment heav-ily with IPv4 addressing, static routing, and Layer 3 switching. In each case, test all your routes using ping and traceroute. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Watch Videos +Chapters 15, 17, and 18 each list a video to be found on the companion website, on topics ranging from how to use the router CLI, how to configure ROAS, and how to troubleshoot using Extended ping. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +Part IV began the story in this book about IP Version 4 (IPv4) addressing. Part V continued that story with how to implement addressing in Cisco routers, along with a variety of meth-ods to route packets between local interfaces. But those topics delayed the discussion of one of the most important topics in TCP/IP, namely IP routing protocols. + +Routers use IP routing protocols to learn about the subnets in an internetwork, choose the current best routes to reach each subnet, and to add those routes to each router’s IP routing table. Cisco chose to include one and only one IP routing protocol in the CCNA 200-301 exam: the Open Shortest Path First (OSPF) routing protocol. This entire part focuses on OSPF as an example of how routing protocols work. + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part VI + + +OSPF + + + + +Chapter 19: Understanding OSPF Concepts + +Chapter 20: Implementing OSPF + +Chapter 21: OSPF Network Types and Neighbors + +Part VI Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 19 + + +Understanding OSPF Concepts This chapter covers the following exam topics: +3.0 IP Connectivity +3.2 Determine how a router makes a forwarding decision by default + +3.2.b Administrative distance + +3.2.c Routing protocol metric + +3.4 Configure and verify single area OSPFv2 + +3.4.a Neighbor adjacencies + +3.4.b Point-to-point + +3.4.c Broadcast (DR/BR selection) + +3.4.d Router ID + +This chapter takes a long look at Open Shortest Path First Version 2 (OSPFv2) concepts. OSPF runs on each router, sending and receiving OSPF messages with neighboring (nearby) routers. These messages give OSPF the means to exchange data about the network and to learn and add IP Version 4 (IPv4) routes to the IPv4 routing table on each router. + +Most enterprises over the last 25 years have used either OSPF or the Enhanced Interior Gateway Routing Protocol (EIGRP) for their primary IPv4 routing protocol. For perspective, both OSPF and EIGRP have been part of CCNA throughout most of its 20+ year history. For the CCNA 200-301 exam blueprint, Cisco has included OSPFv2 as the only IPv4 routing protocol. (Note that Cisco does include EIGRP in the CCNP Enterprise certification.) + +This chapter breaks the content into three major sections. The first section sets the context about routing protocols in general, defining interior and exterior routing protocols and basic routing protocol features and terms. The second major section presents the nuts and bolts of how OSPFv2 works, using OSPF neighbor relationships, database exchange, and then route calculation. The third section wraps up the discussion by looking at OSPF areas and LSAs. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Table 19-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Comparing Dynamic Routing Protocol Features + +OSPF Concepts and Operation + +OSPF Areas and LSAs + +Questions 1–3 +4, 5 + +6 + + + +1. Which of the following routing protocols is considered to use link-state logic? a. RIPv1 +b. RIPv2 c. EIGRP d. OSPF +2. Which of the following routing protocols use a metric that is, by default, at least par-tially affected by link bandwidth? (Choose two answers.) +a. RIPv1 b. RIPv2 c. EIGRP d. OSPF +3. Which of the following interior routing protocols support VLSM? (Choose three answers.) +a. RIPv1 b. RIPv2 c. EIGRP d. OSPF +4. Two routers using OSPFv2 have become neighbors and exchanged all LSAs. As a result, Router R1 now lists some OSPF-learned routes in its routing table. Which of the following best describes how R1 uses those recently learned LSAs to choose which IP routes to add to its IP routing table? +a. Each LSA lists a route to be copied to the routing table. +b. Some LSAs list a route that can be copied to the routing table. c. Run some SPF math against the LSAs to calculate the routes. +d. R1 does not use the LSAs at all when choosing what routes to add. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +442 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Which of the following OSPF neighbor states is expected when the exchange of topol-ogy information is complete between two OSPF neighbors? +a. 2-way b. Full +c. Up/up d. Final +6. A company has a small/medium-sized network with 15 routers and 40 subnets and uses OSPFv2. Which of the following is considered an advantage of using a single-area design as opposed to a multiarea design? +a. It reduces the processing overhead on most routers. +b. Status changes to one link may not require SPF to run on all other routers. c. It allows for simpler planning and operations. +d. It allows for route summarization, reducing the size of IP routing tables. + + +Foundation Topics + +Comparing Dynamic Routing Protocol Features +Routers add IP routes to their routing tables using three methods: connected routes, static routes, and routes learned by using dynamic routing protocols. Before we get too far into the discussion, however, it is important to define a few related terms and clear up any mis-conceptions about the terms routing protocol, routed protocol, and routable protocol. The concepts behind these terms are not that difficult, but because the terms are so similar, and because many documents pay poor attention to when each of these terms is used, they can be a bit confusing. These terms are generally defined as follows: + +■ Routing protocol: A set of messages, rules, and algorithms used by routers for the overall purpose of learning routes. This process includes the exchange and analysis of routing information. Each router chooses the best route to each subnet (path selection) and final-ly places those best routes in its IP routing table. Examples include RIP, EIGRP, OSPF, and BGP. +■ Routed protocol and routable protocol: Both terms refer to a protocol that defines a packet structure and logical addressing, allowing routers to forward or route the packets. Routers forward packets defined by routed and routable protocols. Examples include IP Version 4 (IPv4) and IP Version 6 (IPv6). + + +NOTE The term path selection sometimes refers to part of the job of a routing protocol, in which the routing protocol chooses the best route. + +Even though routing protocols (such as OSPF) are different from routed protocols (such as IP), they do work together very closely. The routing process forwards IP packets, but if a router does not have any routes in its IP routing table that match a packet’s destination address, the router discards the packet. Routers need routing protocols so that the routers + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 443 + +can learn all the possible routes and add them to the routing table so that the routing process can forward (route) routable protocols such as IP. + +Routing Protocol Functions +Cisco IOS software supports several IP routing protocols, performing the same general functions: +1. Learn routing information about IP subnets from neighboring routers. 2. Advertise routing information about IP subnets to neighboring routers. +3. If more than one possible route exists to reach one subnet, pick the best route based on a metric. +4. If the network topology changes—for example, a link fails—react by advertising that some routes have failed and pick a new currently best route. (This process is called convergence.) + +NOTE A neighboring router connects to the same link as another router, such as the same WAN link or the same Ethernet LAN. +19 Figure 19-1 shows an example of three of the four functions in the list. Router R1, in the +lower left of the figure, must make a decision about the best route to reach the subnet con-nected off router R2, on the bottom right of the figure. Following the steps in the figure: +Step 1. R2 advertises a route to the lower right subnet—172.16.3.0/24—to both router R1 and R3. + +Step 2. After R3 learns about the route to 172.16.3.0/24 from R2, R3 advertises that route to R1. + +Step 3. R1 must make a decision about the two routes it learned about for reaching subnet 172.16.3.0/24—one with metric 1 from R2 and one with metric 2 from R3. R1 chooses the lower metric route through R2 (function 3). + + +The other routing protocol function, convergence, occurs when the topology changes—that is, when either a router or link fails or comes back up again. When something changes, the best routes available in the network can change. Convergence simply refers to the process by which all the routers collectively realize something has changed, advertise the information about the changes to all the other routers, and all the routers then choose the currently best routes for each subnet. The ability to converge quickly, without causing loops, is one of the most important considerations when choosing which IP routing protocol to use. + +In Figure 19-1, convergence might occur if the link between R1 and R2 failed. In that case, R1 should stop using its old route for subnet 172.16.3.0/24 (directly through R2) and begin sending packets to R3. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +444 CCNA 200-301 Official Cert Guide, Volume 1 + + +G0/0 + + + +I have a route to 172.16.3.0/24, metric 2. + +3 2 + +R3 + +G0/0/0 G0/1/0 + + +1 +I have a route to 172.16.3.0/24, metric 1. + + + +I’ll use the route out G0/0/0, because it has the lower metric. +G0/1/0 + + + +G0/0/0 172.16.6.252 + + + +G0/0 G0/0/0 R1 + +G0/1/0 G0/1 172.16.2.252 R2 + + + +172.16.1.0/24 + +R1 IP Routing Table +Subnet Out Int. Next-Hop Metric 172.16.3.0 G0/0/0 172.16.2.252 1 + +1 172.16.3.0/24 + +I have a route to 172.16.3.0/24, metric 1. + + +Figure 19-1 Three of the Four Basic Functions of Routing Protocols + +Interior and Exterior Routing Protocols +IP routing protocols fall into one of two major categories: interior gateway protocols (IGP) or exterior gateway protocols (EGP). The definitions of each are as follows: + +■ IGP: A routing protocol that was designed and intended for use inside a single autono-mous system (AS) +■ EGP: A routing protocol that was designed and intended for use between different auton-omous systems + + +NOTE The terms IGP and EGP include the word gateway because routers used to be called gateways. + +These definitions use another new term: autonomous system (AS). An AS is a network under the administrative control of a single organization. For example, a network created and paid for by a single company is probably a single AS, and a network created by a single school system is probably a single AS. Other examples include large divisions of a state or national government, where different government agencies might be able to build their own networks. Each ISP is also typically a single different AS. + +Some routing protocols work best inside a single AS by design, so these routing protocols are called IGPs. Conversely, routing protocols designed to exchange routes between routers + + +Answers to the “Do I Know This Already?” quiz: 1 D 2 C, D 3 B, C, D 4 C 5 B 6 C + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 445 + +in different autonomous systems are called EGPs. Today, Border Gateway Protocol (BGP) is the only EGP used. + +Each AS can be assigned a number called (unsurprisingly) an AS number (ASN). Like public IP addresses, the Internet Assigned Numbers Authority (IANA, www.iana.org) controls +the worldwide rights to assigning ASNs. It delegates that authority to other organizations around the world, typically to the same organizations that assign public IP addresses. +For example, in North America, the American Registry for Internet Numbers (ARIN, www.arin.net) assigns public IP address ranges and ASNs. + +Figure 19-2 shows a small view of the worldwide Internet. The figure shows two enterprises and three ISPs using IGPs (OSPF and EIGRP) inside their own networks and with BGP being used between the ASNs. + +ASN 500 + +ASN 100 + + + + +Enterprise 1 Subnets of Network 9.0.0.0 +EIGRP + +ASN 200 + +BGP ISP3 OSPF + + +Enterprise 5 Subnets of Network 199.190.1.0 +OSPF + +BGP + + +19 + + + +ASN 400 BGP +ASN 300 +BGP ISP4 ISP2 EIGRP +EIGRP + + +BGP + + + +Figure 19-2 Comparing Locations for Using IGPs and EGPs + +Comparing IGPs +Organizations have several options when choosing an IGP for their enterprise network, but most companies today use either OSPF or EIGRP. This book discusses OSPFv2, with the CCNP Enterprise certification adding EIGRP. Before getting into detail on these two proto-cols, the next section first discusses some of the main goals of every IGP, comparing OSPF, EIGRP, plus a few other IPv4 routing protocols. + +IGP Routing Protocol Algorithms +A routing protocol’s underlying algorithm determines how the routing protocol does its job. The term routing protocol algorithm simply refers to the logic and processes used by different routing protocols to solve the problem of learning all routes, choosing the best + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +446 CCNA 200-301 Official Cert Guide, Volume 1 + +route to each subnet, and converging in reaction to changes in the internetwork. Three main branches of routing protocol algorithms exist for IGP routing protocols: + +■ Distance vector (sometimes called Bellman-Ford after its creators) ■ Advanced distance vector (sometimes called “balanced hybrid”) +■ Link-state + +Historically speaking, distance vector protocols were invented first, mainly in the early 1980s. Routing Information Protocol (RIP) was the first popularly used IP distance vector protocol, with the Cisco-proprietary Interior Gateway Routing Protocol (IGRP) being intro-duced a little later. + +By the early 1990s, distance vector protocols’ somewhat slow convergence and potential for routing loops drove the development of new alternative routing protocols that used new algorithms. Link-state protocols—in particular, Open Shortest Path First (OSPF) and +Integrated Intermediate System to Intermediate System (IS-IS)—solved the main issues. They also came with a price: they required extra CPU and memory on routers, with more planning required from the network engineers. + +NOTE All references to OSPF in this chapter refer to OSPFv2 unless otherwise stated. + +Around the same time as the introduction of OSPF, Cisco created a proprietary routing proto-col called Enhanced Interior Gateway Routing Protocol (EIGRP), which used some features of the earlier IGRP protocol. EIGRP solved the same problems as did link-state routing protocols, but EIGRP required less planning when implementing the network. As time went on, EIGRP was classified as a unique type of routing protocol. However, it used more distance vector features than link-state, so it is more commonly classified as an advanced distance vector protocol. + +Metrics +Routing protocols choose the best route to reach a subnet by choosing the route with the lowest metric. For example, RIP uses a counter of the number of routers (hops) between a router and the destination subnet, as shown in the example of Figure 19-1. OSPF totals +the cost associated with each interface in the end-to-end route, with the cost based on link bandwidth. Table 19-2 lists the most common IP routing protocols and some details about the metric in each case. +Table 19-2 IP IGP Metrics + +IGP Metric RIPv2 Hop count + +OSPF Cost + +EIGRP Calculation based on bandwidth and delay + +Description +The number of routers (hops) between a router and the destination subnet +The sum of all interface cost settings for all links in a route, with the cost defaulting to be based on interface bandwidth +Calculated based on the route’s slowest link and the cumulative delay associated with each interface in the route + + + +A brief comparison of the metric used by the older RIP versus the metric used by OSPF shows some insight into why OSPF and EIGRP surpassed RIP. Figure 19-3 shows an example + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 447 + +in which Router B has two possible routes to subnet 10.1.1.0 on the left side of the network: a shorter route over a very slow serial link at 1544 Kbps, or a longer route over two Gigabit Ethernet WAN links. + + +RIP + +Subnet 10.1.1.0 + +OSPF + +Subnet 10.1.1.0 + + + + +S0/0/1 +A Bandwidth 1544 B G0/0 + +S0/0/1 +A Bandwidth 1544 B +G0/0 + + + +Bandwidth 1,000,000 + +Bandwidth 1,000,000 + +Bandwidth 1,000,000 + + +Bandwidth 1,000,000 + + +C C + +Figure 19-3 RIP and OSPF Metrics Compared + + +The left side of the figure shows the results of RIP in this network. Using hop count, Router B learns of a one-hop route directly to Router A through B’s S0/0/1 interface. B also learns of a two-hop route through Router C, through B’s G0/0 interface. Router B chooses the lower hop count route, which happens to go over the slow-speed serial link. + +The right side of the figure shows the better choice made by OSPF based on its better metric. To cause OSPF to make the right choice, the engineer could use default settings based on the correct interface bandwidth to match the actual link speeds, thereby allowing OSPF to choose the faster route. (The bandwidth interface subcommand does not change the actual physical +speed of the interface. It just tells IOS what speed to assume the interface is using.) + + +19 + + +Other IGP Comparisons +Routing protocols can be compared based on many features, some of which matter to the current CCNA exam, whereas some do not. Table 19-3 introduces a few more points and lists the comparison points mentioned in this book for easier study, with a few supporting com-ments following the table. + +Table 19-3 +Feature + +Interior IP Routing Protocols Compared +RIPv2 EIGRP OSPF + + + +Classless/sends mask in updates/supports VLSM Yes + +Algorithm (DV, advanced DV, LS) DV + +Supports manual summarization Yes + +Cisco-proprietary No + +Routing updates are sent to a multicast IP address Yes + +Convergence Slow + +Yes Yes + +Advanced DV LS + +Yes Yes + +Yes No +1 + +Yes Yes + +Fast Fast + + +1 Although Cisco created EIGRP and has kept it as a proprietary protocol for many years, Cisco chose to publish EIGRP as an informational RFC in 2013. This allows other vendors to implement EIGRP, while Cisco retains the rights to the protocol. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +448 CCNA 200-301 Official Cert Guide, Volume 1 + +Regarding the top row of the table, routing protocols can be considered to be a classless routing protocol or a classful routing protocol. Classless routing protocols support variable-length subnet masks (VLSM) as well as manual route summarization by sending routing protocol messages that include the subnet masks in the message. The older RIPv1 and IGRP routing protocols—both classful routing protocols—do not. + +Also, note that the older routing protocols (RIPv1, IGRP) sent routing protocol messages as IP broadcast addresses, while the newer routing protocols in the table all use IP multicast destina-tion addresses. The use of multicasts makes the protocol more efficient and causes less over-head and fewer issues with the devices in the subnet that are not running the routing protocol. + +Administrative Distance +Many companies and organizations use a single routing protocol. However, in some cases, a company needs to use multiple routing protocols. For example, if two companies connect their networks so that they can exchange information, they need to exchange some routing information. If one company uses OSPF and the other uses EIGRP on at least one router, +both OSPF and EIGRP must be used. Then that router can take routes learned by OSPF and advertise them into EIGRP, and vice versa, through a process called route redistribution. + +Depending on the network topology, the two routing protocols might learn routes to the same subnets. When a single routing protocol learns multiple routes to the same subnet, the metric tells it which route is best. However, when two different routing protocols learn routes to the same subnet, because each routing protocol’s metric is based on different information, IOS cannot compare the metrics. For example, OSPF might learn a route to subnet 10.1.1.0 with metric 101, and EIGRP might learn a route to 10.1.1.0 with metric 2,195,416, but the EIGRP-learned route might be the better route—or it might not. There is simply no basis for comparison between the two metrics. + +When IOS must choose between routes learned using different routing protocols, IOS uses a concept called administrative distance. Administrative distance is a number that denotes how believable an entire routing protocol is on a single router. The lower the number, the better, or more believable, the routing protocol. For example, RIP has a default administra-tive distance of 120, OSPF uses a default of 110, and EIGRP defaults to 90. When using OSPF and EIGRP, the router will believe the EIGRP route instead of the OSPF route (at least by default). The administrative distance values are configured on a single router and are not exchanged with other routers. Table 19-4 lists the various sources of routing information, along with the default administrative distances. + +Table 19-4 Default Administrative Distances + +Route Type Connected +Static + +BGP (external routes [eBGP]) + +EIGRP (internal routes) + +IGRP + +OSPF + +Administrative Distance 0 +1 + +20 + +90 + +100 + +110 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 449 + + +Route Type IS-IS +RIP + +EIGRP (external routes) + +BGP (internal routes [iBGP]) + +DHCP default route + +Unusable + +Administrative Distance 115 +120 + +170 + +200 + +254 + +255 + + + + +NOTE The show ip route command lists each route’s administrative distance as the first of the two numbers inside the brackets. The second number in brackets is the metric. + +The table shows the default administrative distance values, but IOS can be configured to change the administrative distance of a particular routing protocol, a particular route, +or even a static route. For example, the command ip route 10.1.3.0 255.255.255.0 19 +10.1.130.253 defines a static route with a default administrative distance of 1, but the com-mand ip route 10.1.3.0 255.255.255.0 10.1.130.253 210 defines the same static route with an administrative distance of 210. So, you can actually create a static route that is only +used when the routing protocol does not find a route, just by giving the static route a higher administrative distance. + +OSPF Concepts and Operation +Routing protocols basically exchange information so routers can learn routes. The routers learn information about subnets, routes to those subnets, and metric information about how good each route is compared to others. The routing protocol can then choose the currently best route to each subnet, building the IP routing table. + +Link-state protocols like OSPF take a little different approach to the particulars of what information they exchange and what the routers do with that information once learned. This next (second) major section narrows the focus to only link-state protocols, specifically OSPFv2. + +This section begins with an overview of what OSPF does by exchanging data about the net-work in data structures called link-state advertisements (LSA). Then the discussion backs up a bit to provide more details about each of three fundamental parts of how OSPF oper-ates: how OSPF routers use neighbor relationships, how routers exchange LSAs with neigh-bors, and then how routers calculate the best routes once they learn all the LSAs. + +OSPF Overview +Link-state protocols build IP routes with a couple of major steps. First, the routers together build a lot of information about the network: routers, links, IP addresses, status information, and so on. Then the routers flood the information, so all routers know the same information. At that point, each router can calculate routes to all subnets, but from each router’s own perspective. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +450 CCNA 200-301 Official Cert Guide, Volume 1 + +Topology Information and LSAs +Routers using link-state routing protocols need to collectively advertise practically every detail about the internetwork to all the other routers. At the end of the process of flooding the information to all routers, every router in the internetwork has the exact same informa-tion about the internetwork. Flooding a lot of detailed information to every router sounds like a lot of work, and relative to distance vector routing protocols, it is. + +Open Shortest Path First (OSPF), the most popular link-state IP routing protocol, organizes topology information using LSAs and the link-state database (LSDB). Figure 19-4 represents the ideas. Each LSA is a data structure with some specific information about the network topology; the LSDB is simply the collection of all the LSAs known to a router. + +Link State Database (LSDB) + +LSA LSA +LSA LSA + + +LSA + +Figure 19-4 + +LSA + + +LSA and LSDB Relationship + + +Figure 19-5 shows the general idea of the flooding process, with R8 creating and flooding its router LSA. The router LSA for Router R8 describes the router itself, including the existence of subnet 172.16.3.0/24, as seen on the right side of the figure. (Note that Figure 19-5 actu-ally shows only a subset of the information in R8’s router LSA.) + +R8 LSA R8 LSA + +R2 R3 R4 +R8 LSA R8 LSA + + + +R8 LSA R8 LSA R8 LSA + +R1 R5 R6 R8 + +R8 LSA R8 LSA + +172.16.3.0/24 + +Fa0/0 +172.16.3.1/24 Cost 10 + + +R8 Router LSA – Partial Contents +Router ID: 8.8.8.8 +R7 Int. IP Address: 172.16.3.1/24 +State: UP Cost: 10 + +Figure 19-5 Flooding LSAs Using a Link-State Routing Protocol + +Figure 19-5 shows the rather basic flooding process, with R8 sending the original LSA for itself, and the other routers flooding the LSA by forwarding it until every router has a copy. The flooding process causes every router to learn the contents of the LSA while preventing + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 451 + +the LSA from being flooded around in circles. Basically, before sending an LSA to yet anoth-er neighbor, routers communicate, asking “Do you already have this LSA?,” and then sending the LSA to the next neighbor only if the neighbor has not yet learned about the LSA. + +Once flooded, routers do occasionally reflood each LSA. Routers reflood an LSA when some information changes (for example, when a link goes up or comes down). They also reflood each LSA based on each LSA’s separate aging timer (default 30 minutes). + +Applying Dijkstra SPF Math to Find the Best Routes +The link-state flooding process results in every router having an identical copy of the LSDB in memory, but the flooding process alone does not cause a router to learn what routes to add to the IP routing table. Although incredibly detailed and useful, the information in the LSDB does not explicitly state each router’s best route to reach a destination. + +To build routes, link-state routers have to do some math. Thankfully, you and I do not have to know the math! However, all link-state protocols use a type of math algorithm, called the Dijkstra Shortest Path First (SPF) algorithm, to process the LSDB. That algorithm analyzes (with math) the LSDB and builds the routes that the local router should add to the IP rout- +ing table—routes that list a subnet number and mask, an outgoing interface, and a next-hop +router IP address. 19 + +Now that you have the big ideas down, the next several topics walk through the three main phases of how OSPF routers accomplish the work of exchanging LSAs and calculating routes. Those three phases are + +Becoming neighbors: A relationship between two routers that connect to the same data link, created so that the neighboring routers have a means to exchange their LSDBs. +Exchanging databases: The process of sending LSAs to neighbors so that all routers learn the same LSAs. +Adding the best routes: The process of each router independently running SPF, on their local copy of the LSDB, calculating the best routes, and adding those to the IPv4 routing table. + +Becoming OSPF Neighbors +Of everything you learn about OSPF in this chapter, OSPF neighbor concepts have the most to do with how you will configure and troubleshoot OSPF in Cisco routers. You configure OSPF to cause routers to run OSPF and become neighbors with other routers. Once that happens, OSPF does the rest of the work to exchange LSAs and calculate routers in the background, with no additional configuration required. This section discusses the fundamen-tal concepts of OSPF neighbors. + +The Basics of OSPF Neighbors +OSPF neighbors are routers that both use OSPF and both sit on the same data link. Two routers can become OSPF neighbors if connected to the same VLAN, or same serial link, or same Ethernet WAN link. + +Two routers need to do more than simply exist on the same link to become OSPF neighbors; they must send OSPF messages and agree to become OSPF neighbors. To do so, the routers + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +452 CCNA 200-301 Official Cert Guide, Volume 1 + +send OSPF Hello messages, introducing themselves to the potential neighbor. Assuming the two potential neighbors have compatible OSPF parameters, the two form an OSPF neighbor relationship, and would be displayed in the output of the show ip ospf neighbor command. + +The OSPF neighbor relationship also lets OSPF know when a neighbor might not be a good option for routing packets right now. Imagine R1 and R2 form a neighbor relationship, learn LSAs, and calculate routes that send packets through the other router. Months later, R1 notices that the neighbor relationship with R2 fails. That failed neighbor connection to R2 makes R1 react: R1 refloods LSAs impacted by the failed link, and R1 runs SPF to recalculate its own routes. + +Finally, the OSPF neighbor model allows new routers to be dynamically discovered. That means new routers can be added to a network without requiring every router to be reconfig-ured. Instead, OSPF routers listen for OSPF Hello messages from new routers and react to those messages, attempting to become neighbors and exchange LSDBs. + +Meeting Neighbors and Learning Their Router ID +The OSPF Hello process, by which new neighbor relationships are formed, works somewhat like when you move to a new house and meet your various neighbors. When you see each other outside, you might walk over, say hello, and learn each other’s name. After talking a bit, you form a first impression, particularly as to whether you think you’ll enjoy chatting with this neighbor occasionally, or whether you can just wave and not take the time to talk the next time you see him outside. + +Similarly, with OSPF, the process starts with messages called OSPF Hello messages. The Hellos in turn list each router’s router ID (RID), which serves as each router’s unique name or identifier for OSPF. Finally, OSPF does several checks of the information in the Hello mes-sages to ensure that the two routers should become neighbors. + +OSPF RIDs are 32-bit numbers. As a result, most command output lists these as dotted-dec-imal numbers (DDN). By default, IOS chooses one of the router’s interface IPv4 addresses to use as its OSPF RID. However, the OSPF RID can be directly configured, as covered in the section “Configuring the OSPF Router ID” in Chapter 20, “Implementing OSPF.” + +As soon as a router has chosen its OSPF RID and some interfaces come up, the router is ready to meet its OSPF neighbors. OSPF routers can become neighbors if they are connect-ed to the same subnet. To discover other OSPF-speaking routers, a router sends multicast OSPF Hello packets to each interface and hopes to receive OSPF Hello packets from other routers connected to those interfaces. Figure 19-6 outlines the basic concept. + + +R1 R2 + +Hello Hello + + +Hello Interval + +Hello Interval + + +Hello Hello + +Figure 19-6 OSPF Hello Packets + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 453 + +Routers R1 and R2 both send Hello messages onto the link. They continue to send Hellos at a regular interval based on their Hello timer settings. The Hello messages themselves have the following features: + +■ The Hello message follows the IP packet header, with IP protocol type 89. +■ Hello packets are sent to multicast IP address 224.0.0.5, a multicast IP address intended for all OSPF-speaking routers. +■ OSPF routers listen for packets sent to IP multicast address 224.0.0.5, in part hoping to receive Hello packets and learn about new neighbors. + +Taking a closer look, Figure 19-7 shows several of the neighbor states used by the early for-mation of an OSPF neighbor relationship. The figure shows the Hello messages in the center and the resulting neighbor states on the left and right edges of the figure. Each router keeps an OSPF state variable for how it views the neighbor. + +RID 1.1.1.1 RID 2.2.2.2 + +R1 R2 +1 (R1 to R2 Link comes up…) +19 2 Hello, Seen [null], My RID 1.1.1.1 + +Hello, Seen [1.1.1.1], My RID 2.2.2.2 3 Init + +2-Way 4 Hello, Seen [1.1.1.1, 2.2.2.2], My RID 1.1.1.1 +2-Way +Figure 19-7 Early Neighbor States + +Following the steps in the figure, the scenario begins with the link down, so the routers have no knowledge of each other as OSPF neighbors. As a result, they have no state (status) infor-mation about each other as neighbors, and they would not list each other in the output of the show ip ospf neighbor command. At Step 2, R1 sends the first Hello, so R2 learns of the existence of R1 as an OSPF router. At that point, R2 lists R1 as a neighbor, with an interim beginning state of init. + +The process continues at Step 3, with R2 sending back a Hello. This message tells R1 that R2 exists, and it allows R1 to move through the init state and quickly to a 2-way state. At Step 4, R2 receives the next Hello from R1, and R2 can also move to a 2-way state. + +The 2-way state is a particularly important OSPF state. At that point, the following major facts are true: + +■ The router received a Hello from the neighbor, with that router’s own RID listed as being seen by the neighbor. +■ The router has checked all the parameters in the Hello received from the neighbor, with no problems. The router is willing to become an OSPF neighbor. +■ If both routers reach a 2-way state with each other, it means that both routers meet all OSPF configuration requirements to become neighbors. Effectively, at that point, they are neighbors and ready to exchange their LSDB with each other. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +454 CCNA 200-301 Official Cert Guide, Volume 1 + +Exchanging the LSDB Between Neighbors +One purpose of forming OSPF neighbor relationships is to allow the two neighbors to exchange their databases. This next topic works through some of the details of OSPF data-base exchange. + +Fully Exchanging LSAs with Neighbors +The OSPF neighbor state 2-way means that the router is available to exchange its LSDB with the neighbor. In other words, it is ready to begin a 2-way exchange of the LSDB. So, once two routers on a link reach the 2-way state, they can immediately move on to the process of database exchange. + +The database exchange process can be quite involved, with several OSPF messages and sev-eral interim neighbor states. This chapter is more concerned with a few of the messages and the final state when database exchange has completed: the full state. + +After two routers decide toexchange databases, they do not simply send the contents of the entire database. First, they tell each other a list of LSAs in their respective databases—not all the details of the LSAs, just a list. (Think of these lists as checklists.) Then each router can check which LSAs it already has and then ask the other router for only the LSAs that are not known yet. + +For instance, R1 might send R2 a checklist that lists 10 LSAs (using an OSPF Database Description, or DD, packet). R2 then checks its LSDB and finds six of those 10 LSAs. So, R2 asks R1 (using a Link-State Request packet) to send the four additional LSAs. + +Thankfully, most OSPFv2 work does not require detailed knowledge of these specific pro-tocol steps. However, a few of the terms are used quite a bit and should be remembered. In particular, the OSPF messages that actually send the LSAs between neighbors are called Link-State Update (LSU) packets. That is, the LSU packet holds data structures called link-state advertisements (LSA). The LSAs are not packets, but rather data structures that sit inside the LSDB and describe the topology. + +Figure 19-8 pulls some of these terms and processes together, with a general example. The story picks up the example shown in Figure 19-7, with Figure 19-8 showing an example of the database exchange process between Routers R1 and R2. The center shows the protocol messages, and the outer items show the neighbor states at different points in the process. Focus on two items in particular: + +■ The routers exchange the LSAs inside LSU packets. +■ When finished, the routers reach a full state, meaning they have fully exchanged the con-tents of their LSDBs. + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 455 + + +RID 1.1.1.1 + +R1 + +ExStart Database Description + +RID 2.2.2.2 + +R2 + + +Database Description Exchange + + +Loading + + + + +Full + +LSU, with Several LSAs + +LSU, with Several LSAs +. . +. + + +Loading + + + + +Full + + +Figure 19-8 Database Exchange Example, Ending in a Full State + + +Maintaining Neighbors and the LSDB +Once two neighbors reach a full state, they have done all the initial work to exchange OSPF information between them. However, neighbors still have to do some small ongoing tasks to maintain the neighbor relationship. + +First, routers monitor each neighbor relationship using Hello messages and two related tim-ers: the Hello Interval and the Dead Interval. Routers send Hellos every Hello Interval to each neighbor. Each router expects to receive a Hello from each neighbor based on the Hello Interval, so if a neighbor is silent for the length of the Dead Interval (by default, four times as long as the Hello Interval), the loss of Hellos means that the neighbor has failed. + +Next, routers must react when the topology changes as well, and neighbors play a key role in that process. When something changes, one or more routers change one or more LSAs. Then the routers must flood the changed LSAs to each neighbor so that the neighbor can change its LSDB. + +For example, imagine a LAN switch loses power, so a router’s G0/0 interface fails from up/up to down/down. That router updates an LSA that shows the router’s G0/0 as being down. That router then sends the LSA to its neighbors, and that neighbor in turn sends it to its neigh-bors, until all routers again have an identical copy of the LSDB. Each router’s LSDB now reflects the fact that the original router’s G0/0 interface failed, so each router will then use SPF to recalculate any routes affected by the failed interface. + +A third maintenance task done by neighbors is to reflood each LSA occasionally, even when the network is completely stable. By default, each router that creates an LSA also has the responsibility to reflood the LSA every 30 minutes (the default), even if no changes occur. (Note that each LSA has a separate timer, based on when the LSA was created, so there is no +single big event where the network is overloaded with flooding LSAs.) + + + +19 + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +456 CCNA 200-301 Official Cert Guide, Volume 1 + +The following list summarizes these three maintenance tasks for easier review: + +■ Maintain neighbor state by sending Hello messages based on the Hello Interval and listen-ing for Hellos before the Dead Interval expires +■ Flood any changed LSAs to each neighbor +■ Reflood unchanged LSAs as their lifetime expires (default 30 minutes) + +Using Designated Routers on Ethernet Links +OSPF behaves differently on some types of interfaces based on a per-interface setting called the OSPF network type. On Ethernet links, OSPF defaults to use a network type of broad-cast, which causes OSPF to elect one of the routers on the same subnet to act as the desig-nated router (DR). The DR plays a key role in how the database exchange process works, with different rules than with point-to-point links. + +To see how, consider the example that begins with Figure 19-9. The figure shows five OSPFv2 routers on the same Ethernet VLAN. These five OSPF routers elect one router to act as the DR and one router to be a backup DR (BDR). The figure shows A and B as DR and BDR, for no other reason than the Ethernet must have one of each. + +DR A C E + + +BDR B D +Figure 19-9 Routers A and B Elected as DR and BDR + +The database exchange process on an Ethernet link does not happen between every pair of routers on the same VLAN/subnet. Instead, it happens between the DR and each of the other routers, with the DR making sure that all the other routers get a copy of each LSA. In other words, the database exchange happens over the flows shown in Figure 19-10. + +Designated Router + +A +Database Exchange Flows + + +B C D E +Figure 19-10 Database Exchange to and from the DR on an Ethernet + +OSPF uses the BDR concept because the DR is so important to the database exchange pro-cess. The BDR watches the status of the DR and takes over for the DR if it fails. (When the DR fails, the BDR takes over, and then a new BDR is elected.) + +The use of a DR/BDR, along with the use of multicast IP addresses, makes the exchange of OSPF LSDBs more efficient on networks that allow more than two routers on the same link. The DR can send a packet to all OSPF routers in the subnet by using multicast IP address 224.0.0.5. IANA reserves this address as the “All SPF Routers” multicast address just for this + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 457 + +purpose. For instance, in Figure 19-10, the DR can send one set of messages to all the OSPF routers rather than sending one message to each router. + +Similarly, any OSPF router needing to send a message to the DR and also to the BDR (so it remains ready to take over for the DR) can send those messages to the “All SPF DRs” mul-ticast address 224.0.0.6. So, instead of having to send one set of messages to the DR and another set to the BDR, an OSPF router can send one set of messages, making the exchange more efficient. + +At this point, you might be getting a little tired of some of the theory, but finally, the theory actually shows something that you may see in show commands on a router. Because the DR and BDR both do full database exchange with all the other OSPF routers in the LAN, they reach a full state with all neighbors. However, routers that are neither a DR nor a BDR— called DROthers by OSPF—never reach a full state because they do not exchange LSDBs directly with each other. As a result, the show ip ospf neighbor command on these DROther routers lists some neighbors in a 2-way state, remaining in that state under normal operation. + +For instance, with OSPF working normally on the Ethernet LAN in Figure 19-10, a show ip ospf neighbor command on router C (which is a DROther router) would show the following: + +■ Two neighbors (A and B, the DR and BDR, respectively) with a full state (called fully 19 adjacent neighbors) + +■ Two neighbors (D and E, which are DROthers) with a 2-way state (called neighbors) + +OSPF requires some terms to describe all neighbors versus the subset of all neighbors that reach the full state. First, all OSPF routers on the same link that reach the 2-way state—that is, they send Hello messages and the parameters match—are called neighbors. The subset of neighbors for which the neighbor relationship continues on and reaches the full state are called adjacent neighbors. Additionally, OSPFv2 RFC 2328 emphasizes the connection between the full state and the term adjacent neighbor by using the synonyms of fully adjacent and fully adjacent neighbor. Finally, while the terms so far refer to the neighbor, two other terms refer to the relationship: neighbor relationship refers to any OSPF neigh-bor relationship, while the term adjacency refers to neighbor relationships that reach a full state. Table 19-5 details the terms. + +Table 19-5 Stable OSPF Neighbor States and Their Meanings + +Neighbor State 2-way +Full + +Term for Neighbor Neighbor +Adjacent Neighbor + +Fully Adjacent Neighbor + +Term for Relationship Neighbor Relationship +Adjacency + + + + +Calculating the Best Routes with SPF +OSPF LSAs contain useful information, but they do not contain the specific information that a router needs to add to its IPv4 routing table. In other words, a router cannot just copy information from the LSDB into a route in the IPv4 routing table. The LSAs individually are more like pieces of a jigsaw puzzle. So, to know what routes to add to the routing table, each + + +|||||||||||||||||||| +|||||||||||||||||||| + + +458 CCNA 200-301 Official Cert Guide, Volume 1 + +router must do some SPF math to choose the best routes from that router’s perspective. The router then adds each route to its routing table: a route with a subnet number and mask, an outgoing interface, and a next-hop router IP address. + +Although engineers do not need to know the details of how SPF does the math, they do need to know how to predict which routes SPF will choose as the best route. The SPF algo-rithm calculates all the routes for a subnet—that is, all possible routes from the router to the destination subnet. If more than one route exists, the router compares the metrics, picking the best (lowest) metric route to add to the routing table. Although the SPF math can be complex, engineers with a network diagram, router status information, and simple addition can calculate the metric for each route, predicting what SPF will choose. + +Once SPF has identified a route, OSPF calculates the metric for a route as follows: + +The sum of the OSPF interface costs for all outgoing interfaces in the route. +Figure 19-11 shows an example with three possible routes from R1 to Subnet X (172.16.3.0/24) at the bottom of the figure. + + +Cost 10 R1 Cost 30 +Cost 20 + +R2 +Cost 60 +R5 Cost 30 + +R7 R3 +Cost 180 Cost 20 + + + + + + +Legend: +Possible Route + +R6 Cost 40 +R4 Cost 5 + +R8 +Cost 10 + +Subnet X (172.16.3.0/24) + +Figure 19-11 SPF Tree to Find R1’s Route to 172.16.3.0/24 + + +NOTE OSPF considers the costs of the outgoing interfaces (only) in each route. It does not add the cost for incoming interfaces in the route. + +Table 19-6 lists the three routes shown in Figure 19-11, with their cumulative costs, showing that R1’s best route to 172.16.3.0/24 starts by going through R5. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 459 + +Table 19-6 Comparing R1’s Three Alternatives for the Route to 172.16.3.0/24 + +Route +R1–R7–R8 + +R1–R5–R6–R8 + +R1–R2–R3–R4–R8 + +Location in Figure 19-11 Left +Middle + +Right + +Cumulative Cost 10 + 180 + 10 = 200 +20 + 30 + 40 + 10 = 100 + +30 + 60 + 20 + 5 + 10 = 125 + + + +As a result of the SPF algorithm’s analysis of the LSDB, R1 adds a route to subnet 172.16.3.0/24 to its routing table, with the next-hop router of R5. + +In real OSPF networks, an engineer can do the same process by knowing the OSPF cost for each interface. Armed with a network diagram, the engineer can examine all routes, add the costs, and predict the metric for each route. + + +OSPF Areas and LSAs +OSPF can be used in some networks with very little thought about design issues. You just turn on OSPF in all the routers, put all interfaces into the same area (usually area 0), and it works! Figure 19-12 shows one such network example, with 11 routers and all interfaces in area 0. + +Area 0 (Backbone) + + + + +19 + + + +D3 SW1 SW2 + + +D1 D2 + + + + + +B1 B2 B3 B4 B11 B12 B13 B14 + + +Figure 19-12 Single-Area OSPF + +Larger OSPFv2 networks suffer with a single-area design. For instance, now imagine an enterprise network with 900 routers, rather than only 11, and several thousand subnets. As it turns out, the CPU time to run the SPF algorithm on all that topology data just takes time. As a result, OSPFv2 convergence time—the time required to react to changes in the net-work—can be slow. The routers might run low on RAM as well. Additional problems with a single area design include the following: + +■ A larger topology database requires more memory on each router. +■ The SPF algorithm requires processing power that grows exponentially compared to the size of the topology database. +■ A single interface status change anywhere in the internetwork (up to down, or down to up) forces every router to run SPF again! + + +|||||||||||||||||||| +|||||||||||||||||||| + + +460 CCNA 200-301 Official Cert Guide, Volume 1 + +The solution is to take the one large LSDB and break it into several smaller LSDBs by using OSPF areas. With areas, each link is placed into one area. SPF does its complicated math on the topology inside the area, and that area’s topology only. For instance, an internetwork with 1000 routers and 2000 subnets, broken in 100 areas, would average 10 routers and 20 subnets per area. The SPF calculation on a router would have to only process topology about 10 routers and 20 links, rather than 1000 routers and 2000 links. + +So, how large does a network have to be before OSPF needs to use areas? Well, there is no set answer because the behavior of the SPF process depends largely on CPU processing speed, the amount of RAM, the size of the LSDB, and so on. Generally, networks larger than a few dozen routers benefit from areas, and some documents over the years have listed 50 routers as the dividing line at which a network really should use multiple OSPF areas. + +The next few pages look at how OSPF area design works, with more reasons as to why areas help make larger OSPF networks work better. + +OSPF Areas +OSPF area design follows a couple of basic rules. To apply the rules, start with a clean draw-ing of the internetwork, with routers, and all interfaces. Then choose the area for each router interface, as follows: + +■ Put all interfaces connected to the same subnet inside the same area. ■ An area should be contiguous. +■ Some routers may be internal to an area, with all interfaces assigned to that single area. +■ Some routers may be Area Border Routers (ABR) because some interfaces connect to the backbone area, and some connect to nonbackbone areas. +■ All nonbackbone areas must have a path to reach the backbone area (area 0) by having at least one ABR connected to both the backbone area and the nonbackbone area. + +Figure 19-13 shows one example. An engineer started with a network diagram that showed all 11 routers and their links. On the left, the engineer put four WAN links and the LANs connected to branch routers B1 through B4 into area 1. Similarly, he placed the links to branches B11 through B14 and their LANs in area 2. Both areas need a connection to the backbone area, area 0, so he put the LAN interfaces of D1 and D2 into area 0, along with D3, creating the backbone area. + +The figure also shows a few important OSPF area design terms. Table 19-7 summarizes the meaning of these terms, plus some other related terms, but pay closest attention to the terms from the figure. + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 461 + +Area 0 (Backbone) + + +D3 SW1 SW2 Backbone +Router Area Border Router (ABR) +D1 D2 + + + + + +B1 B2 B3 B4 B11 B12 B13 B14 + +10.1.11.0 10.1.12.0 10.1.13.0 10.1.14.0 + +Internal Routers +Area 1 + +Internal Routers +Area 2 + +Figure 19-13 Three-Area OSPF with D1 and D2 as ABRs + + +Table 19-7 +Term + +OSPF Design Terminology 19 +Description + + + +Area Border Router (ABR) +Backbone router + +Internal router + +Area + +Backbone area + +Intra-area route + +Interarea route + +An OSPF router with interfaces connected to the backbone area and to at least one other area +A router connected to the backbone area (includes ABRs) + +A router in one area (not the backbone area) + +A set of routers and links that shares the same detailed LSDB information, but not with routers in other areas, for better efficiency +A special OSPF area to which all other areas must connect—area 0 + +A route to a subnet inside the same area as the router + +A route to a subnet in an area of which the router is not a part + + + + +How Areas Reduce SPF Calculation Time +Figure 19-13 shows a sample area design and some terminology related to areas, but it does not show the power and benefit of the areas. To understand how areas reduce the work SPF has to do, you need to understand what changes about the LSDB inside an area, as a result of the area design. + +SPF spends most of its processing time working through all the topology details, namely routers and the links that connect routers. Areas reduce SPF’s workload because, for a given area, the LSDB lists only routers and links inside that area, as shown on the left side of Figure 19-14. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +462 CCNA 200-301 Official Cert Guide, Volume 1 + + +Area 1 LSDB + + +ABR D1 + + + + + +B1 B2 B3 B4 + + + +10.1.11.0 + +10.1.12.0 + +10.1.13.0 + +10.1.14.0 + +Subnets in Other Areas: Requires Little SPF + + + +Detailed Topology Data (Routers and Links): Requires Heavy SPF +Figure 19-14 Smaller Area 1 LSDB Concept + +While the LSDB has less topology information, it still has to have information about all subnets in all areas, so that each router can create IPv4 routes for all subnets. So, with an area design, OSPFv2 uses very brief summary information about the subnets in other areas. These summary LSAs do not include topology information about the other areas; however, each summary LSA does list a subnet ID and mask of a subnet in some other area. Summary LSAs do not require much SPF processing at all. Instead, these subnets all appear like sub-nets connected to the ABR (in Figure 19-14, ABR D1). + +Using multiple areas improves OSPF operations in many ways for larger networks. The fol-lowing list summarizes some of the key points arguing for the use of multiple areas in larger OSPF networks: + +■ Routers require fewer CPU cycles to process the smaller per-area LSDB with the SPF algorithm, reducing CPU overhead and improving convergence time. +■ The smaller per-area LSDB requires less memory. +■ Changes in the network (for example, links failing and recovering) require SPF calcula-tions only on routers in the area where the link changed state, reducing the number of routers that must rerun SPF. +■ Less information must be advertised between areas, reducing the bandwidth required to send LSAs. + +(OSPFv2) Link-State Advertisements +Many people tend to get a little intimidated by OSPF LSAs when first learning about them. Commands that list a summary of the LSDB’s contents, like the show ip ospf database com-mand, actually list a lot of information. Commands that list the details of the LSDB can list overwhelming amounts of information, and those details appear to be in some kind of code, using lots of numbers. It can seem like a bit of a mess. + +However, if you examine LSAs while thinking about OSPF areas and area design, some of the most common LSA types will make a lot more sense. For instance, think about the LSDB + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 463 + +in one area. The topology in one area includes routers and the links between the routers. As it turns out, OSPF defines the first two types of LSAs to define those exact details, as follows: + +■ One router LSA for each router in the area +■ One network LSA for each network that has a DR plus one neighbor of the DR + +Next, think about the subnets in the other areas. The ABR creates summary information about each subnet in one area to advertise into other areas—basically just the subnet IDs and masks—as a third type of LSA: + +■ One summary LSA for each subnet ID that exists in a different area + +The next few pages discuss these three LSA types in a little more detail; Table 19-8 lists some information about all three for easier reference and study. + +Table 19-8 The Three OSPFv2 LSA Types Seen with a Multiarea OSPF Design + +LSA LSA Name Type +Router 1 + +Network 2 + +Summary 3 + +Primary Purpose + +Describe a router + +Describe a network that has a DR +Describe a subnet in another area + +Contents of LSA + +RID, interfaces, IP address/mask, 19 current interface state (status) + +DR and BDR IP addresses, subnet ID, mask +Subnet ID, mask, RID of ABR that advertises the LSA + + + + +Router LSAs Build Most of the Intra-Area Topology +OSPF needs very detailed topology information inside each area. The routers inside area X need to know all the details about the topology inside area X. And the mechanism to give routers all these details is for the routers to create and flood router (Type 1) and network (Type 2) LSAs about the routers and links in the area. + +Router LSAs, also known as Type 1 LSAs, describe the router in detail. Each lists a router’s RID, its interfaces, its IPv4 addresses and masks, its interface state, and notes about what neighbors the router knows about via each of its interfaces. + +To see a specific instance, first review Figure 19-15. It lists internetwork topology, with sub-nets listed. Because it’s a small internetwork, the engineer chose a single-area design, with all interfaces in backbone area 0. + +With the single-area design planned for this small internetwork, the LSDB will contain four router LSAs. Each router creates a router LSA for itself, with its own RID as the LSA identi-fier. The LSA lists that router’s own interfaces, IP address/mask, with pointers to neighbors. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| +S0/0/0 + + +464 CCNA 200-301 Official Cert Guide, Volume 1 + +Area 0 +10.1.23.0/24 + +G0/0 R2 +G0/1/0 +10.1.12.0/24 +10.1.1.0/24 +G0/0/0 +10.1.13.0/24 + + +G0/0 +R1 G0/1/0 + + +G0/0/0 G0/0 +R3 + + + + +G0/1 R4 +10.1.14.0/24 +S0/0/1 + +10.1.4.0/24 + +Figure 19-15 Enterprise Network with Seven IPv4 Subnets + +Once all four routers have copies of all four router LSAs, SPF can mathematically analyze the LSAs to create a model. The model looks a lot like the concept drawing in Figure 19-16. Note that the drawing shows each router with an obvious RID value. Each router has point-ers that represent each of its interfaces, and because the LSAs identify neighbors, SPF can figure out which interfaces connect to which other routers. + +2.2.2.2 +R2 Type 1 + + + +1.1.1.1 +R1 Type 1 + + + + + + +Figure 19-16 + +3.3.3.3 +R3 Type 1 + + +4.4.4.4 +R4 Type 1 + +Type 1 LSAs, Assuming a Single-Area Design + + +Network LSAs Complete the Intra-Area Topology +Whereas router LSAs define most of the intra-area topology, network LSAs define the rest. As it turns out, when OSPF elects a DR on some subnet and that DR has at least one neigh-bor, OSPF treats that subnet as another node in its mathematical model of the network. To represent that network, the DR creates and floods a network (Type 2) LSA for that network (subnet). + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 19: Understanding OSPF Concepts 465 + +For instance, back in Figure 19-15, one Ethernet LAN and two Ethernet WANs exist. The Ethernet LAN between R2 and R3 will elect a DR, and the two routers will become neigh-bors; so, whichever router is the DR will create a network LSA. Similarly, R1 and R2 connect with an Ethernet WAN, so the DR on that link will create a network LSA. Likewise, the DR on the Ethernet WAN link between R1 and R3 will also create a network LSA. + +Figure 19-17 shows the completed version of the intra-area LSAs in area 0 with this design. Note that the router LSAs actually point to the network LSAs when they exist, which lets the SPF processes connect the pieces together. + + + + + + + +1.1.1.1 +R1 Type 1 + + + + +Type 2 + + +Type 2 + +2.2.2.2 +R2 Type 1 + +Type 3.3.3.3 2 +R3 Type 1 +19 + +4.4.4.4 +R4 Type 1 + + +Figure 19-17 Type 1 and Type 2 LSAs in Area 0, Assuming a Single-Area Design + +Finally, note that in this single-area design example no summary (Type 3) LSAs exist at all. These LSAs represent subnets in other areas, and there are no other areas. Given that the CCNA 200-301 exam topics refer specifically to single-area OSPF designs, this section stops at showing the details of the intra-area LSAs (Types 1 and 2). + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 19-9 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +466 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 19-9 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Resource Used: Book, website +Book, website + +Book, PTP + +Website + + + + +Review All the Key Topics + + +Table 19-10 +Key Topic Element +List + +List + +List + +Table 19-2 + +List + +Table 19-5 + +Item + +Figure 19-11 + +List + +Figure 19-13 + +Table 19-7 + +Key Topics for Chapter 19 +Description Page Number +Functions of IP routing protocols 443 + +Definitions of IGP and EGP 444 + +Types of IGP routing protocols 446 + +IGP metrics 446 + +Key facts about the OSPF 2-way state 453 + +Key OSPF neighbor states 457 + +Definition of how OSPF calculates the cost for a route 458 + +Example of calculating the cost for multiple competing routes 458 + +OSPF area design rules 460 + +Sample OSPF multiarea design with terminology 461 + +OSPF design terms and definitions 461 + + + + +Key Terms You Should Know +convergence, Shortest Path First (SPF) algorithm, distance vector, Interior Gateway Protocol (IGP), link-state, link-state advertisement (LSA), link-state database (LSDB), metric, 2-way state, full state, Area Border Router (ABR), designated router (DR), backup designated router (BDR), fully adjacent, Hello Interval, Dead Interval, link-state update, neighbor, router ID (RID), topology database, internal router, backbone area + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 20 + + +Implementing OSPF This chapter covers the following exam topics: +3.0 IP Connectivity +3.2 Determine how a router makes a forwarding decision by default + +3.2.b Administrative distance + +3.2.c Routing protocol metric + +3.4 Configure and verify single area OSPFv2 + +3.4.a Neighbor adjacencies + +3.4.b Point-to-point + +3.4.c Broadcast (DR/BR selection) + +3.4.d Router ID + +OSPFv2 requires only a few configuration commands if you rely on default settings. To use OSPF, all you need to do is enable OSPF on each interface you intend to use in the network, and OSPF uses messages to discover neighbors and learn routes through those neighbors. However, the complexity of OSPFv2 results in a large number of show commands, many of which reveal those default settings. So while you can make OSPFv2 work in a lab with all default settings, to become comfortable working with it, you need to know the most com-mon optional features as well. This chapter begins that process. + +The first major section of this chapter focuses on traditional OSPFv2 configuration using the network command, along with the large variety of associated show commands. This section teaches you how to make OSPFv2 operate with default settings and convince yourself that it really is working through use of those show commands. + +The second major section shows an alternative configuration option called OSPF interface mode, in contrast with the traditional OSPF configuration shown in the first section of the chapter. This mode uses the ip ospf process-id area area-number configuration command instead of the network command. + +The final section then moves on to discuss a variety of optional but popular configuration topics. The features include topics such as how to use passive interfaces, how to change OSPF costs (which influences the routes OSPF chooses), and how to create a default route advertised by OSPF. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 20-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Implementing Single-Area OSPFv2 +OSPFv2 Interface Configuration + +Additional OSPFv2 Features + +Questions 1–3 +4 + +5, 6 + + + +1. Which of the following network commands, following the command router ospf 1, tells this router to start using OSPF on interfaces whose IP addresses are 10.1.1.1, 10.1.100.1, and 10.1.120.1? +a. network 10.0.0.0 255.0.0.0 area 0 +b. network 10.0.0.0 0.255.255.255 area 0 c. network 10.0.0.1 0.0.0.255 area 0 +d. network 10.0.0.1 0.0.255.255 area 0 + +2. Which of the following network commands, following the command router ospf 1, tells this router to start using OSPF on interfaces whose IP addresses are 10.1.1.1, 10.1.100.1, and 10.1.120.1? +a. network 10.1.0.0 0.0.255.255 area 0 b. network 10.0.0.0 0.255.255.0 area 0 c. network 10.1.1.0 0.x.1x.0 area 0 +d. network 10.1.1.0 255.0.0.0 area 0 e. network 10.0.0.0 255.0.0.0 area 0 +3. Which of the following commands list the OSPF neighbors off interface serial 0/0? (Choose two answers.) +a. show ip ospf neighbor +b. show ip ospf interface brief c. show ip neighbor +d. show ip interface +e. show ip ospf neighbor serial 0/0 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +470 CCNA 200-301 Official Cert Guide, Volume 1 + +4. An engineer migrates from a more traditional OSPFv2 configuration that uses net-work commands in OSPF configuration mode to instead use OSPFv2 interface con-figuration. Which of the following commands configures the area number assigned to an interface in this new configuration? +a. The area command in interface configuration mode +b. The ip ospf command in interface configuration mode +c. The router ospf command in interface configuration mode d. The network command in interface configuration mode +5. Which of the following configuration settings on a router does not influence which IPv4 route a router chooses to add to its IPv4 routing table when using OSPFv2? +a. auto-cost reference-bandwidth b. delay +c. bandwidth d. ip ospf cost +6. OSPF interface configuration uses the ip ospf process-id area area-number configu-ration command. In which modes do you configure the following settings when using this command? +a. The router ID is configured explicitly in router mode. b. The router ID is configured explicitly in interface mode. +c. An interface’s area number is configured in router mode. d. An interface’s area number is configured in interface mode. + +Foundation Topics + +Implementing Single-Area OSPFv2 +After an OSPF design has been chosen—a task that can be complex in larger IP internet-works—the configuration can be as simple as enabling OSPF on each router interface and placing that interface in the correct OSPF area. This first major section of the chapter focus-es on the required configuration using the traditional OSPFv2 network command along with one optional configuration setting: how to set the OSPF router-id. Additionally, this section works through how to show the various lists and tables that confirm how OSPF is working. + +For reference and study, the following list outlines the configuration steps covered in this first major section of the chapter: + +Config Checklist + +Step 1. Use the router ospf process-id global command to enter OSPF configuration mode for a particular OSPF process. + +Step 2. (Optional) Configure the OSPF router ID by doing the following: + +A. Use the router-id id-value router subcommand to define the router ID, or + +B. Use the interface loopback number global command, along with an ip address address mask command, to configure an IP address on a loopback +interface (chooses the highest IP address of all working loopbacks), or + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 471 + +C. Rely on an interface IP address (chooses the highest IP address of all work-ing nonloopbacks). + +Step 3. Use one or more network ip-address wildcard-mask area area-id router subcommands to enable OSPFv2 on any interfaces matched by the configured address and mask, enabling OSPF on the interface for the listed area. + + +Figure 20-1 shows the relationship between the OSPF configuration commands, with the idea that the configuration creates a routing process in one part of the configuration, and then indirectly enables OSPF on each interface. The configuration does not name the inter-faces on which OSPF is enabled, instead requiring IOS to apply some logic by comparing the OSPF network command to the interface ip address commands. The upcoming example discusses more about this logic. + + +Configuration OSPF Mode: +router ospf 1 router-id 1.1.1.1 + +network 10.0.0.0 0.255.255.255 area 0 + + + +Define Process ID +Set Router ID (Optional) (Indirectly) Enable OSPF Process on the Interface + +Define Area Number + +Interface Mode: Indirect! 20 +interface S0/0/0 +ip address 10.1.1.1 255.255.255.0 + +Figure 20-1 Organization of OSPFv2 Configuration with the network Command + +OSPF Single-Area Configuration +Figure 20-2 shows a sample network that will be used for most examples throughout this chapter. All links reside in area 0, making the area design a single-area design, with four rout-ers. You can think of Router R1 as a router at a central site, with WAN links to each remote site, and using router-on-a-stick (ROAS) to connect to two LAN subnets on the left. Routers R2 and R3 might be at one large remote site that needs two WAN links and two routers for WAN redundancy, with both routers connected to the LAN at that remote site. Router R4 might be a typical smaller remote site with a single router needed for that site. + +NOTE The interface numbering on Router R1, with interfaces G0/0 and G0/0/0, may seem a bit strange. However, real routers, like the Cisco 2901 used in the example, use this number-ing. That model includes a built-in Gi0/0 and Gi0/1 port. Additionally, if you add one-port Gigabit WAN Interface Cards (WICs), the router numbers them G0/0/0, G0/1/0, and so on. This is just one example of how router hardware may use two-digit interface numbering, or three-digit, or both. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +472 CCNA 200-301 Official Cert Guide, Volume 1 + +Area 0 + +10.1.23.2 /24 G0/0 +G0/1/0 +G0/0/0 +10.1.12.2 /2410.1.12.1 /24 +R2 + + + +10.1.1.1 /24 +G0/0.1 + +G0/0.2 R1 10.1.2.1 /24 + + +G0/1/0 10.1.13.1 /24 +10.1.14.4 /24 +G0/2/0 G0/0/0 +10.1.14.1 /24 + + +G0/0/0 10.1.13.3 /24 R3 + + + +R4 + +10.1.23.3 /24 G0/0 + + + +10.1.4.4 /24 G0/1 + + + +Figure 20-2 Sample Network for OSPF Single-Area Configuration + +Example 20-1 shows the IPv4 addressing configuration on Router R1, before getting into the OSPF detail. Note that R1 enables 802.1Q trunking (ROAS) on its G0/0 interface and assigns an IP address to each subinterface. + +Example 20-1 IPv4 Address Configuration on R1 (Including VLAN Trunking) + +interface GigabitEthernet0/0.1 +encapsulation dot1q 1 native +ip address 10.1.1.1 255.255.255.0 +! +interface GigabitEthernet0/0.2 +encapsulation dot1q 2 +ip address 10.1.2.1 255.255.255.0 +! +interface GigabitEthernet0/0/0 +ip address 10.1.12.1 255.255.255.0 +! +interface GigabitEthernet0/1/0 +ip address 10.1.13.1 255.255.255.0 +! +interface GigabitEthernet0/2/0 +ip address 10.1.14.1 255.255.255.0 + + +The OSPF configuration begins with the router ospf process-id global command, which puts the user in OSPF configuration mode, and sets the OSPF process-id value. The process-id number just needs to be unique on the local router, allowing the router to support multiple OSPF processes in a single router by using different process IDs. (The + + +Answers to the “Do I Know This Already?” quiz: 1 B 2 A 3 A, E 4 B 5 B 6 A, D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 473 + +router command uses the process-id to distinguish between the processes.) The process-id does not have to match on each router, and it can be any integer between 1 and 65,535. + +Second, the configuration needs one or more network commands in OSPF mode. These commands tell the router to find its local interfaces that match the first two parameters on the network command. Then, for each matched interface, the router enables OSPF on those interfaces, discovers neighbors, creates neighbor relationships, and assigns the interface to the area listed in the network command. (Note that the area can be configured as either an integer or a dotted-decimal number, but this book makes a habit of configuring the area number as an integer. The integer area numbers range from 0 through 4,294,967,295.) + +Example 20-2 shows an example configuration on router R2 from Figure 20-2. The router ospf 1 command enables OSPF process 1, and the single network command enables OSPF on all interfaces shown in the figure. + +Example 20-2 OSPF Single-Area Configuration on R2 Using One network Command + +router ospf 1 +network 10.0.0.0 0.255.255.255 area 0 + + +For the specific network command in Example 20-2, any matched interfaces are assigned to area 0. However, the first two parameters—the ip_address and wildcard_mask parameter values of 10.0.0.0 and 0.255.255.255—need some explaining. In this case, the command +matches both interfaces shown for Router R2; the next topic explains why. 20 + +Wildcard Matching with the network Command +The key to understanding the traditional OSPFv2 configuration shown in this first example is to understand the OSPF network command. The OSPF network command compares the first parameter in the command to each interface IP address on the local router, trying to +find a match. However, rather than comparing the entire number in the network command to the entire IPv4 address on the interface, the router can compare a subset of the octets, based on the wildcard mask, as follows: + +Wildcard 0.0.0.0:Compare all four octets. In other words, the numbers must exactly match. +Wildcard 0.0.0.255: Compare the first three octets only. Ignore the last octet when com-paring the numbers. +Wildcard 0.0.255.255: Compare the first two octets only. Ignore the last two octets when comparing the numbers. +Wildcard 0.255.255.255: Compare the first octet only. Ignore the last three octets when comparing the numbers. +Wildcard 255.255.255.255: Compare nothing; this wildcard mask means that all address-es will match the network command. +Basically, a wildcard mask value of decimal 0 in an octet tells IOS to compare to see if the numbers match, and a value of 255 tells IOS to ignore that octet when comparing the numbers. + +The network command provides many flexible options because of the wildcard mask. For example, in Router R1, many network commands could be used, with some matching all interfaces, and some matching a subset of interfaces. Table 20-2 shows a sampling of options, with notes. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +474 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 20-2 Example OSPF network Commands on R3, with Expected Results + +Command + +network 10.1.0.0 0.0.255.255 + + + + + + +network 10.0.0.0 0.255.255.255 + + + + + + +network 0.0.0.0 255.255.255.255 + + + + + + +network 10.1.13.0 0.0.0.255 + +network 10.1.13.1 0.0.0.0 + +Logic in Command + +Match addresses that begin with 10.1 + + + + + + +Match addresses that begin with 10 + + + + + + +Match all addresses + + + + + + +Match addresses that begin with 10.1.13 + +Match one address: 10.1.13.1 + +Matched Interfaces +G0/0.1 + +G0/0.2 + +G0/0/0 + +G0/1/0 + +G0/2/0 + +G0/0.1 + +G0/0.2 + +G0/0/0 + +G0/1/0 + +G0/2/0 + +G0/0.1 + +G0/0.2 + +G0/0/0 + +G0/1/0 + +G0/2/0 + +G0/1/0 + +G0/1/0 + + + +The wildcard mask gives the local router its rules for matching its own interfaces. To show examples of the different options, Example 20-3 shows the configuration on routers R2, R3, and R4, each using different wildcard masks. Note that all three routers (R2, R3, and R4) enable OSPF on all the interfaces shown in Figure 20-2. + +Example 20-3 OSPF Configuration on Routers R2, R3, and R4 + +! R2 configuration next - one network command enables OSPF on both interfaces +interface GigabitEthernet0/0 +ip address 10.1.23.2 255.255.255.0 +! +interface GigabitEthernet0/1/0 +ip address 10.1.12.2 255.255.255.0 +! +router ospf 1 +network 10.0.0.0 0.255.255.255 area 0 + +! R3 configuration next - One network command per interface +interface GigabitEthernet0/0 +ip address 10.1.23.3 255.255.255.0 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 475 + +! +interface GigabitEthernet0/0/0 +ip address 10.1.13.3 255.255.255.0 +! +router ospf 1 +network 10.1.13.3 0.0.0.0 area 0 +network 10.1.23.3 0.0.0.0 area 0 + + +! R4 configuration next - One network command per interface with wildcard 0.0.0.255 +interface GigabitEthernet0/1 +ip address 10.1.4.4 255.255.255.0 +! +interface GigabitEthernet0/0/0 +ip address 10.1.14.4 255.255.255.0 +! +router ospf 1 +network 10.1.14.0 0.0.0.255 area 0 +network 10.1.4.0 0.0.0.255 area 0 + + +Finally, note that OSPF uses the same wildcard mask logic as defined by Cisco IOS access +control lists. The section titled “Finding the Right Wildcard Mask to Match a Subnet” sec- +tion in Chapter 2 of the CCNA 200-301 Official Cert Guide, Volume 2, provides more 20 +detail about wildcard masks. + + +NOTE IOS will change a network command if it does not follow a particular rule: by con-vention, if the wildcard mask octet is 255, the matching address octet should be configured as a 0. Interestingly, IOS will actually accept a network command that breaks this rule, but then IOS will change that octet of the address to a 0 before putting it into the running con-figuration file. For example, IOS will change a typed command that begins with network 1.2.3.4 0.0.255.255 to network 1.2.0.0 0.0.255.255. + + +Verifying OSPF Operation +As mentioned in Chapter 19, “Understanding OSPF Concepts,” OSPF routers use a three-step process to eventually add OSPF-learned routes to the IP routing table. First, they create neighbor relationships. Then they build and flood LSAs between those neighbors so each router in the same area has a copy of the same LSDB. Finally, each router independently computes its own IP routes using the SPF algorithm and adds them to its routing table. This next topic works through how to display the results of each of those steps, which lets you confirm whether OSPF has worked correctly or not. + +The show ip ospf neighbor, show ip ospf database, and show ip route commands display information to match each of these three steps, respectively. Figure 20-3 summarizes the commands you can use (and others) when verifying OSPF. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +476 CCNA 200-301 Official Cert Guide, Volume 1 + +Many engineers begin OSPF verification by looking at the output of the show ip ospf neighbor command. For instance, Example 20-4 shows a sample from Router R1, which should have one neighbor relationship each with routers R2, R3, and R4. Example 20-4 shows all three. + + +Config +network and +ip ospf Commands + +show running-config show ip protocols + + + + + +Discover with Hello + + +Flood LSAs + + +Enabled Interfaces + + +Neighbors + + +LSDB + +show ip ospf interface +show ip ospf interface type number show ip ospf interface brief + + +show ip ospf neighbor +show ip ospf neighbor type number + + +show ip ospf database + + + +SPF Calculation + +RIB + +Admin Distance + +Routes + + + +show ip ospf rib + +show ip route show ip route ospf +show ip route subnet mask +show ip route | section subnet + + +Figure 20-3 OSPF Verification Commands + +Example 20-4 OSPF Neighbors on Router R1 from Figure 20-2 + +R1# show ip ospf neighbor + +Neighbor ID +2.2.2.2 +3.3.3.3 +4.4.4.4 + +Pri State +1 FULL/DR +1 FULL/DR +1 FULL/BDR + +Dead Time +00:00:37 +00:00:37 +00:00:34 + +Address +10.1.12.2 +10.1.13.3 +10.1.14.4 + +Interface +GigabitEthernet0/0/0 +GigabitEthernet0/1/0 +GigabitEthernet0/2/0 + + + +The detail in the output mentions several important facts, and for most people, working right to left works best in this case. For example, look at the headings: + +Interface: This is the local router’s interface connected to the neighbor. For example, the first neighbor in the list is reachable through R1’s G0/0/0 interface. +Address: This is the neighbor’s IP address on that link. Again, for this first neighbor, which is R1, uses IP address 10.1.13.1. +State: While many possible states exist, for the details discussed in this chapter, FULL is the correct and fully working state in this case. +Neighbor ID: This is the router ID of the neighbor. +Once OSPF convergence has completed, a router should list each neighbor. On links that use a designated router (DR), the state will also list the role of the neighboring router after the / (DR, BDR, or DROTHER. As a result, the normal working states will be: + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 477 + +FULL/ -: The neighbor state is full, with the “-“ instead of letters meaning that the link does not use a DR/BDR. +FULL/DR: The neighbor state is full, and the neighbor is the DR. +FULL/BDR: The neighbor state is full, and the neighbor is the backup DR (BDR). +FULL/DROTHER: The neighbor state is full, and the neighbor is neither the DR nor BDR. (It also implies that the local router is a DR or BDR because the state is FULL.) +2WAY/DROTHER: The neighbor state is 2-way, and the neighbor is neither the DR nor BDR—that is, a DROther router. (It also implies that the local router is also a DROther router because otherwise the state would reach a full state.) +Once a router’s OSPF process forms a working neighbor relationship, the routers exchange the contents of their LSDBs, either directly or through the DR on the subnet. Example 20-5 shows the contents of the LSDB on Router R1. Interestingly, with a single-area design, all the routers will have the same LSDB contents once all neighbors are up and all LSAs have been exchanged. So, the show ip ospf database command in Example 20-5 should list the same exact information, no matter on which of the four routers it is issued. + +Example 20-5 OSPF Database on Router R1 from Figure 20-2 + +R1# show ip ospf database + +OSPF Router with ID (1.1.1.1) (Process ID 1) +20 Router Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum Link count + +1.1.1.1 +2.2.2.2 +3.3.3.3 +4.4.4.4 + +1.1.1.1 +2.2.2.2 +3.3.3.3 +4.4.4.4 + +431 0x8000008F 0x00DCCA 5 +1167 0x8000007F 0x009DA1 2 +441 0x80000005 0x002FB1 1 +530 0x80000004 0x007F39 2 + + +Net Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum + +10.1.12.2 +10.1.13.3 +10.1.14.1 +10.1.23.3 + +2.2.2.2 +3.3.3.3 +1.1.1.1 +3.3.3.3 + +1167 0x8000007C 0x00BBD5 +453 0x80000001 0x00A161 +745 0x8000007B 0x004449 +8 0x80000001 0x00658F + + + +For the purposes of this book, do not be concerned about the specifics in the output of this command. However, for perspective, note that the LSDB should list one “Router Link State” (Type 1 Router LSA) for each of the routers in the same area, so with the design based on Figure 20-2, the output lists four Type 1 LSAs. Also, with all default settings in this design, the routers will create a total of four Type 2 Network LSAs as shown, one each for the sub-nets that have a DR and contain at least two routers in that subnet. + +Next, Example 20-6 shows R4’s IPv4 routing table with the show ip route command. As configured, with all links working, the design in Figure 20-2 includes seven subnets. R4 has + + +|||||||||||||||||||| +|||||||||||||||||||| + + +478 CCNA 200-301 Official Cert Guide, Volume 1 + +connected routes to two of those subnets and should learn OSPF routes to the other five subnets. + +Example 20-6 IPv4 Routes Added by OSPF on Router R1 from Figure 20-2 + +R4# show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +! Additional legend lines omitted for brevity + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks +O 10.1.1.0/24 [110/2] via 10.1.14.1, 00:27:24, GigabitEthernet0/0/0 +O 10.1.2.0/24 [110/2] via 10.1.14.1, 00:27:24, GigabitEthernet0/0/0 +C 10.1.4.0/24 is directly connected, Vlan4 +L 10.1.4.4/32 is directly connected, Vlan4 +O 10.1.12.0/24 [110/2] via 10.1.14.1, 00:27:24, GigabitEthernet0/0/0 +O 10.1.13.0/24 [110/2] via 10.1.14.1, 00:25:15, GigabitEthernet0/0/0 +C 10.1.14.0/24 is directly connected, GigabitEthernet0/0/0 +L 10.1.14.4/32 is directly connected, GigabitEthernet0/0/0 +O 10.1.23.0/24 [110/3] via 10.1.14.1, 00:27:24, GigabitEthernet0/0/0 + + +Any time you want to check OSPF on a router in a small design like the ones in the book, you can count all the subnets, then count the subnets connected to the local router, and know that OSPF should learn routes to the rest of the subnets. Then just use the show ip route command and add up how many connected and OSPF routes exist as a quick check of whether all the routes have been learned or not. + +In this case, router R4 has two connected subnets, but seven subnets exist per the figure, so router R4 should learn five OSPF routes. Next look for the code of “O” on the left, which identifies a route as being learned by OSPF. The output lists five such IP routes: two for the LAN subnets off Router R1, one for the LAN subnets connected to both R2 and R3, and one each for the WAN subnets from R1 to R2 and R1 to R3. + +Next, take a look at the first route (to subnet 10.1.1.0/24). It lists the subnet ID and mask, identifying the subnet. It also lists two numbers in brackets. The first, 110, is the administra-tive distance of the route. All the OSPF routes in this example use the default of 110 (see Chapter 19’s Table 19-4 for the list of administrative distance values). The second number, 2, is the OSPF metric for this route. The route also lists the forwarding instructions: the next-hop IP address (10.1.14.1) and R4’s outgoing interface (G0/0/0). + +Verifying OSPF Configuration +Once you can configure OSPF with confidence, you will likely verify OSPF focusing on OSPF neighbors and the IP routing table as just discussed. However, if OSPF does not work + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 479 + +immediately, you may need to circle back and check the configuration. To do so, you can use these steps: + +■ If you have enable mode access, use the show running-config command to examine the configuration. +■ If you have only user mode access, use the show ip protocols command to re-create the OSPF configuration. +■ Use the show ip ospf interface [brief] command to determine whether the router enabled OSPF on the correct interfaces or not based on the configuration. + + +NOTE The exam’s Sim and Simlet questions can restrict access to enable mode, so knowing how to extract the configuration from show commands other than show running-config can be particularly helpful for any configuration topic. + +The best way to verify the configuration begins with the show running-config command, of course. However, the show ip protocols command repeats the details of the OSPFv2 config-uration and does not require enable mode access. To see how, consider Example 20-7, which lists the output of the show ip protocols command on router R3. + +Example 20-7 Router R3 Configuration and the show ip protocols Command + + +! First, a reminder of R3's configuration per Example 20-3: +router ospf 1 +network 10.1.13.3 0.0.0.0 area 0 +network 10.1.23.3 0.0.0.0 area 0 +! +! The output from router R3: +R3# show ip protocols +*** IP Routing is NSF aware *** + + +20 + + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 3.3.3.3 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.13.3 0.0.0.0 area 0 +10.1.23.3 0.0.0.0 area 0 +Routing Information Sources: + +Gateway +1.1.1.1 +4.4.4.4 +2.2.2.2 + +Distance +110 +110 +110 + +Last Update +02:05:26 +02:05:26 +01:51:16 + +Distance: (default is 110) + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +480 CCNA 200-301 Official Cert Guide, Volume 1 + +The highlighted output emphasizes some of the configuration. The first highlighted line repeats the parameters on the router ospf 1 global configuration command. (The second highlighted item points out each router’s router ID, which will be discussed in the next sec-tion.) The third set of highlighted lines begins with a heading of “Routing for Networks:” followed by two lines that closely resemble the parameters on the configured network com-mands. In fact, closely compare those last two highlighted lines with the network configura-tion commands at the top of the example, and you will see that they mirror each other, but the show command just leaves out the word network. For instance: + +Configuration: network 10.1.13.3 0.0.0.0 area 0 Show Command: 10.1.13.3 0.0.0.0 area 0 +IOS interprets the network commands to choose interfaces on which to run OSPF, so it could be that IOS chooses a different set of interfaces than you predicted. To check the list of interfaces chosen by IOS, use the show ip ospf interface brief command, which lists all interfaces that have been enabled for OSPF processing. Verifying the interfaces can be a use-ful step if you have issues with OSPF neighbors because OSPF must first be enabled on an interface before a router will attempt to discover neighbors on that interface. Example 20-8 shows a sample from Router R1. + +Example 20-8 Router R1 show ip ospf interface brief Command + +R1# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/0/0 1 0 +Gi0/1/0 1 0 +Gi0/2/0 1 0 +Gi0/0.2 1 0 +Gi0/0.1 1 0 + +10.1.12.1/24 +10.1.13.1/24 +10.1.14.1/24 +10.1.2.1/24 +10.1.1.1/24 + +1 BDR 1/1 +1 BDR 1/1 +1 DR 1/1 +1 DR 0/0 +1 DR 0/0 + + + +First, consider the show ip ospf interface brief command shown here. It lists one line per interface, with the list showing all the interfaces on which OSPF has been enabled. Each item in the list identifies the OSPF process ID (per the router ospf process-id command), the area, the interface IP address, and the number of neighbors found via each interface. + +More generally, note that the show ip ospf interface command with the brief keyword at the end lists a single line of output per interface, but the show ip ospf interface command (without the brief keyword) displays about 20 lines of output per interface, with much more information about various OSPF per-interface settings. + +Configuring the OSPF Router ID +While OSPF has many other optional features, most enterprise networks that use OSPF choose to configure each router’s OSPF router ID. OSPF-speaking routers must have a router ID (RID) for proper operation. By default, routers will choose an interface IP address to use as the RID. However, many network engineers prefer to choose each router’s router ID, so com-mand output from commands like show ip ospf neighbor lists more recognizable router IDs. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 481 + +To choose its RID, a Cisco router uses the following process when the router reloads and brings up the OSPF process. Note that the router stops looking for a router ID to use once one of the steps identifies a value to use. +1. If the router-id rid OSPF subcommand is configured, this value is used as the RID. +2. If any loopback interfaces have an IP address configured, and the interface has an interface status of up, the router picks the highest numeric IP address among these loopback interfaces. +3. The router picks the highest numeric IP address from all other interfaces whose inter-face status code (first status code) is up. (In other words, an interface in up/down state will be included by OSPF when choosing its router ID.) + + +The first and third criteria should make some sense right away: the RID is either configured or is taken from a working interface’s IP address. However, this book has not yet explained the concept of a loopback interface, as mentioned in Step 2. + +A loopback interface is a virtual interface that can be configured with the interface loopback interface-number command, where interface-number is an integer. Loopback interfaces are always in an “up and up” state unless administratively placed in a shutdown state. For example, a simple configuration of the command interface loopback 0, followed by ip address 2.2.2.2 255.255.255.0, would create a loopback interface and assign it an IP address. Because loopback interfaces do not rely on any hardware, these interfaces can be up/up whenever IOS is running, making them good interfaces on which to base an OSPF RID. + +Example 20-9 shows the configuration that existed in Routers R1 and R2 before the creation of the show command output earlier in this chapter. R1 set its router ID using the direct +method, while R2 used a loopback IP address. + + + + + + + + + + + +20 + + +Example 20-9 OSPF Router ID Configuration Examples + +! R1 Configuration first +router ospf 1 +router-id 1.1.1.1 +network 10.1.0.0 0.0.255.255 area 0 + + +! R2 Configuration next +! +interface Loopback2 +ip address 2.2.2.2 255.255.255.255 + + +Each router chooses its OSPF RID when OSPF is initialized, which happens when the router boots or when a CLI user stops and restarts the OSPF process (with the clear ip ospf +process command). So, if OSPF comes up, and later the configuration changes in a way that would impact the OSPF RID, OSPF does not change the RID immediately. Instead, IOS waits until the next time the OSPF process is restarted. + +Example 20-10 shows the output of the show ip ospf command on R1, which identifies the OSPF RID used by R1. + + + +|||||||||||||||||||| +|||||||||||||||||||| +G0/2/0 +10.1.14.1 /24 + + +482 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 20-10 Confirming the Current OSPF Router ID + +R1# show ip ospf +Routing Process "ospf 1" with ID 1.1.1.1 +! lines omitted for brevity + + +Implementing Multiarea OSPF +Even though the current CCNA 200-301 exam blueprint mentions single-area OSPF and does not mention multiarea OSPF, you only need to learn one more idea to know how to configure multiarea OSPF. So, this chapter takes a brief page to show how. + +For example, consider a multiarea OSPF design as shown in Figure 20-4. It uses the same routers and IP addresses as shown earlier in Figure 20-2, on which all the examples in this chapter have been based so far. However, the design shows three areas instead of the single-area design shown in Figure 20-2. + + +Area 23 + + +Area 0 R2 +G0/1/0 +10.1.12.2 /24 +G0/0/0 +10.1.12.1 /24 + + +10.1.23.2 /24 G0/0 + + + +10.1.1.1 /24 +G0/0.1 + +G0/0.2 10.1.2.1 /24 + + +G0/1/0 +R1 10.1.13.1 /24 + + + + + +Area 4 + + +G0/0/0 10.1.13.3 /24 R3 + + + +R4 +10.1.14.4 /24 +G0/0/0 + +10.1.23.3 /24 G0/0 + + + +10.1.4.4 /24 G0/1 + + +Figure 20-4 Area Design for an Example Multiarea OSPF Configuration + +Configuring the routers in a multiarea design is almost like configuring OSPFv2 for a single area. To configure multiarea OSPF, all you need is a valid OSPF area design (for instance, like Figure 20-4) and a configuration that places each router interface into the correct area per that design. For example, both of R4’s interfaces connect to links in area 4, making R4 an internal router, so any network commands on router R4 will list area 4. + +Example 20-11 shows a sample configuration for Router R1. To make the configuration clear, it uses network commands with a wildcard mask of 0.0.0.0, meaning each network command matches a single interface. Each interface will be placed into either area 0, 23, or 4 to match the figure. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 483 + +Example 20-11 OSPF Configuration on R1, Placing Interfaces into Different Areas + +router ospf 1 +network 10.1.1.1 0.0.0.0 area 0 +network 10.1.2.1 0.0.0.0 area 0 +network 10.1.12.1 0.0.0.0 area 23 +network 10.1.13.1 0.0.0.0 area 23 +network 10.1.14.1 0.0.0.0 area 4 + + +Using OSPFv2 Interface Subcommands +From the earliest days of OSPFv2 support in Cisco routers, the configuration used the OSPF network command as discussed in this chapter. However, that configuration style can be confusing, and it does require some interpretation of the network commands and interface IP addresses to decide on which interfaces IOS will enable OSPF. As a result, Cisco added another option for OSPFv2 configuration called OSPF interface configuration. + +The newer interface-style OSPF configuration still enables OSPF on interfaces, but it does so directly with the ip ospf interface subcommand instead of using the network command in router configuration mode. Basically, instead of matching interfaces with indirect logic using network commands, you directly enable OSPFv2 on interfaces by configuring an interface subcommand on each interface. +20 OSPF Interface Configuration Example +To show how OSPF interface configuration works, this example basically repeats the example shown earlier in the book using the traditional OSPFv2 configuration with network commands. So, before looking at the OSPFv2 interface configuration, take a moment to +look back to review traditional OSPFv2 configuration with Figure 20-2 and Examples 20-2 and 20-3. + +After reviewing the traditional configuration, consider this checklist, which details how to convert from the old-style configuration in Examples 20-2 and 20-3 to use interface configuration: + +Config Checklist + +Step 1. Use the no network network-id area area-id subcommands in OSPF configu-ration mode to remove the network commands. + +Step 2. Add one ip ospf process-id area area-id command in interface configuration mode under each interface on which OSPF should operate, with the correct +OSPF process (process-id) and the correct OSPF area number. + + + +Figure 20-5 repeats the design for both the original examples in this chapter and for this upcoming interface configuration example. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +484 CCNA 200-301 Official Cert Guide, Volume 1 + +Area 0 + +10.1.23.2 /24 G0/0 +G0/1/0 +G0/0/0 +10.1.12.2 /2410.1.12.1 /24 +R2 + + + +10.1.1.1 /24 +G0/0.1 + +G0/0.2 R1 10.1.2.1 /24 + + +G0/1/0 10.1.13.1 /24 +10.1.14.4 /24 +G0/2/0 G0/0/0 +10.1.14.1 /24 + + +G0/0/0 10.1.13.3 /24 R3 + + + +R4 + +10.1.23.3 /24 G0/0 + + + +10.1.4.4 /24 G0/1 + + + +Figure 20-5 Area Design Used in the Upcoming OSPF Interface Config Example + +Example 20-2 shows a single network command: network 10.0.0.0 0.255.255.255 area 0. Example 20-12 follows the steps in the migration checklist, beginning with the removal of the previous configuration using the no network 10.0.0.0 0.255.255.255 area 0 command. The example then shows the addition of the ip ospf 1 area 0 command on each of the five interfaces on Router R1, enabling OSPF process 1 on the interface and placing each interface into area 0. + +Example 20-12 OSPF Single-Area Configuration on R1 Using One network Command + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# router ospf 1 +R1(config-router)# no network 10.0.0.0 0.255.255.255 area 0 +R1(config-router)# +*Apr 8 19:35:24.994: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0/0 from FULL to DOWN, Neighbor Down: Interface down or detached +*Apr 8 19:35:24.994: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/1/0 from FULL to DOWN, Neighbor Down: Interface down or detached +*Apr 8 19:35:24.994: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on GigabitEthernet0/2/0 from FULL to DOWN, Neighbor Down: Interface down or detached +R1(config-router)# interface g0/0.1 +R1(config-subif)# ip ospf 1 area 0 +R1(config-subif)# interface g0/0.2 +R1(config-subif)# ip ospf 1 area 0 +R1(config-subif)# interface g0/0/0 +R1(config-if)# ip ospf 1 area 0 +R1(config-if)# +*Apr 8 19:35:52.970: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0/0 from LOADING to FULL, Loading Done +R1(config-if)# interface g0/1/0 +R1(config-if)# ip ospf 1 area 0 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 485 + +R1(config-if)# +*Apr 8 19:36:13.362: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/1/0 from LOADING to FULL, Loading Done +R1(config-if)# interface g0/2/0 +R1(config-if)# ip ospf 1 area 0 +R1(config-if)# +*Apr 8 19:37:05.398: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on GigabitEthernet0/2/0 from LOADING to FULL, Loading Done +R1(config-if)# + + +When reading the example, read from top to bottom, and also consider the details about the failed and recovered neighbor relationships shown in the log messages. Removing the network command disabled OSPF on all interfaces on Router R1, causing all three neighbor relationships to fail. The example then shows the addition of the ip ospf 1 area 0 command +on the two LAN subinterfaces, which enables OSPF. Then the example shows the same com-mand added to each of the WAN links in succession, and in each case, the OSPF neighbor available over that WAN link comes up (as noted in the log messages.) + + +Verifying OSPF Interface Configuration +OSPF operates the same way whether you use the new style or old style of configuration. The OSPF area design works the same, neighbor relationships form the same way, routers negotiate to become the DR and BDR the same way, and so on. However, you can see a few small differences in show command output when using the newer OSPFv2 configuration if you look closely. + +The show ip protocols command relists most of the routing protocol configuration, so it does list some different details if you use interface configuration versus the network com-mand. With the newer-style configuration, the output lists the phrase “Interfaces Configured Explicitly,” with the list of interfaces configured with the new ip ospf process-id area +area-id commands, as highlighted in Example 20-13. The example first shows the relevant parts of the show ip protocols command when using interface configuration on Router R1, +and then lists the same portions of the command from when R1 used network commands. + + + + + +20 + + +Example 20-13 Differences in show ip protocols Output: Old- and New-Style OSPFv2 Configuration + +! First, with the new interface configuration +R1# show ip protocols +! … beginning lines omitted for brevity +Routing for Networks: +Routing on Interfaces Configured Explicitly (Area 0): +GigabitEthernet0/2/0 +GigabitEthernet0/1/0 +GigabitEthernet0/0/0 +GigabitEthernet0/0.2 +GigabitEthernet0/0.1 +Routing Information Sources: +Gateway Distance Last Update + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +486 CCNA 200-301 Official Cert Guide, Volume 1 + + +4.4.4.4 +2.2.2.2 +3.3.3.3 + +110 00:09:30 +110 00:10:49 +110 05:20:07 + +Distance: (default is 110) + +! For comparison, the old results with the use of the OSPF network command +R1# show ip protocols +! … beginning lines omitted for brevity +Routing for Networks: +10.1.0.0 0.0.255.255 area 0 +! … ending line omitted for brevity + + +Another small piece of different output exists in the show ip ospf interface [interface] com-mand. The command lists details about OSPF settings for the interface(s) on which OSPF is enabled. The output also makes a subtle reference to whether that interface was enabled for OSPF with the old or new configuration style. Example 20-14 also begins with output based on interface configuration on Router R1, followed by the output that would exist if R1 still used the old-style network command. + +Example 20-14 Differences in show ip ospf interface Output with OSPFv2 Interface Configuration + +! First, with the new interface configuration +R1# show ip ospf interface g0/0/0 +GigabitEthernet0/0/0 is up, line protocol is up +Internet Address 10.1.12.1/24, Area 0, Attached via Interface Enable +! Lines omitted for brevity + +! For comparison, the old results with the use of the OSPF network command +R1# show ip ospf interface g0/0/0 +GigabitEthernet0/0/0 is up, line protocol is up +Internet Address 10.1.12.1/24, Area 0, Attached via Network Statement +! … ending line omitted for brevity + + +Other than these small differences in a few show commands, the rest of the commands show nothing different depending on the style of configuration. For instance, the show ip ospf interface brief command does not change depending on the configuration style, nor do the show ip ospf database, show ip ospf neighbor, or show ip route commands. + +Additional OSPFv2 Features +This final major section of the chapter discusses some very popular but optional OSPFv2 configuration features, as listed here in their order of appearance: + +■ Passive interfaces ■ Default routes +■ Metrics +■ Load balancing + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 487 + +OSPF Passive Interfaces +Once OSPF has been enabled on an interface, the router tries to discover neighboring OSPF routers and form a neighbor relationship. To do so, the router sends OSPF Hello messages on a regular time interval (called the Hello Interval). The router also listens for incoming Hello messages from potential neighbors. + +Sometimes, a router does not need to form neighbor relationships with neighbors on an interface. Often, no other routers exist on a particular link, so the router has no need to keep sending those repetitive OSPF Hello messages. In such cases, an engineer can make the inter-face passive, which means + +■ OSPF continues to advertise about the subnet that is connected to the interface. ■ OSPF no longer sends OSPF Hellos on the interface. +■ OSPF no longer processes any received Hellos on the interface. + +The result of enabling OSPF on an interface but then making it passive is that OSPF still advertises about the connected subnet, but OSPF also does not form neighbor relationships over the interface. + +To configure an interface as passive, two options exist. First, you can add the following com-mand to the configuration of the OSPF process, in router configuration mode: + +passive-interface type number +Alternately, the configuration can change the default setting so that all interfaces are passive 20 +by default and then add a no passive-interface command for all interfaces that need to not be passive: + +passive-interface default +no passive-interface type number +For example, in the sample internetwork in Figure 20-2 (and in Figure 20-5), Router R1, on the left side of the figure, has a LAN interface configured for VLAN trunking. The only router connected to both VLANs is Router R1, so R1 will never discover an OSPF neighbor on these subnets. Example 20-15 shows two alternative configurations to make the two LAN subinterfaces passive to OSPF. + +Example 20-15 Configuring Passive Interfaces on R1 from Figure 20-5 + +! First, make each subinterface passive directly +router ospf 1 +passive-interface GigabitEthernet0/0.1 +passive-interface GigabitEthernet0/0.2 + +! Or, change the default to passive, and make the other interfaces not be passive +router ospf 1 +passive-interface default +no passive-interface GigabitEthernet0/0/0 +no passive-interface GigabitEthernet0/1/0 +no passive-interface GigabitEthernet0/2/0 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +488 CCNA 200-301 Official Cert Guide, Volume 1 + +In real internetworks, the choice of configuration style reduces to which option requires the least number of commands. For example, a router with 20 interfaces, 18 of which are passive to OSPF, has far fewer configuration commands when using the passive-interface default command to change the default to passive. If only two of those 20 interfaces need to be pas-sive, use the default setting, in which all interfaces are not passive, to keep the configuration shorter. + +Interestingly, OSPF makes it a bit of a challenge to use show commands to find whether or not an interface is passive. The show running-config command lists the configuration direct-ly, but if you cannot get into enable mode to use this command, note these two facts: + +The show ip ospf interface brief command lists all interfaces on which OSPF is enabled, including passive interfaces. +The show ip ospf interface command lists a single line that mentions that the interface is passive. +Example 20-16 shows these two commands on Router R1, based on the configuration shown in the top of Example 20-15. Note that subinterfaces G0/0.1 and G0/0.2 both show up in the output of show ip ospf interface brief. + +Example 20-16 Displaying Passive Interfaces + +R1# show ip ospf interface brief + +Interface +GigabitEthernet0/0 +GigabitEthernet0/0.1 +GigabitEthernet0/0.2 + +IP-Address +unassigned +10.1.1.1 +10.1.2.1 + +OK? Method Status +YES manual up +YES manual up +YES manual up + +Protocol +up +up +up + +GigabitEthernet0/1 unassigned YES manual administratively down down + +GigabitEthernet0/0/0 +GigabitEthernet0/1/0 +GigabitEthernet0/2/0 + +10.1.12.1 +10.1.13.1 +10.1.14.1 + +YES manual up up +YES manual up up +YES manual up up + + +R1# show ip ospf interface g0/0.1 +GigabitEthernet0/0.1 is up, line protocol is up +Internet Address 10.1.1.1/24, Area 0, Attached via Network Statement +Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 1.1.1.1, Interface address 10.1.1.1 +No backup designated router on this network +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +No Hellos (Passive interface) +! Lines omitted for brevity + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 489 + +OSPF Default Routes +Chapter 16, “Configuring IPv4 Addressing and Static Routes,” showed some of the uses and benefits of default routes, with examples of static default routes. For those exact same rea-sons, networks can use OSPF to advertise default routes. + +The most classic case for using a routing protocol to advertise a default route has to do with an enterprise’s connection to the Internet. As a strategy, the enterprise engineer uses these design goals: + +■ All routers learn specific (nondefault) routes for subnets inside the company; a default route is not needed when forwarding packets to these destinations. +■ One router connects to the Internet, and it has a default route that points toward the Internet. +■ All routers should dynamically learn a default route, used for all traffic going to the Internet, so that all packets destined to locations in the Internet go to the one router con-nected to the Internet. + +Figure 20-6 shows the idea of how OSPF advertises the default route, with the specific OSPF configuration. In this case, a company connects to an ISP with its Router R1. That router has a static default route (destination 0.0.0.0, mask 0.0.0.0) with a next-hop address of the ISP router. Then the use of the OSPF default-information originate command (Step 2) +makes the router advertise a default route using OSPF to the remote routers (B1 and B2). +20 OSPFv2 Advertises Default + +2 default-information originate + + +G0/1/0 B1 + + + +B2 G0/0/0 + + +G0/0/0 + +G0/1/0 R1 + + +192.0.2.1 + +G0/3/0 Internet ISP1 +1 +ip route 0.0.0.0 0.0.0.0 192.0.2.1 + + +2 default-information originate + +OSPFv2 Advertises Default + +Figure 20-6 Using OSPF to Create and Flood a Default Route + +Figure 20-7 shows the default routes that result from OSPF’s advertisements in Figure 20-6. On the far left, the branch routers all have OSPF-learned default routes, pointing to R1. +R1 itself also needs a default route, pointing to the ISP router, so that R1 can forward all Internet-bound traffic to the ISP. + +Finally, this feature gives the engineer control over when the router originates this default route. First, R1 needs a default route, either defined as a static default route, learned from the ISP with DHCP or learned from the ISP with a routing protocol like eBGP. The OSPF sub-command default-information originate then tells OSPF on R1 to advertise a default route when its own default route is working and to advertise the default route as down when its own default route fails. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +490 CCNA 200-301 Official Cert Guide, Volume 1 + +Default + + +B1 G0/1/0 + +G0/0/0 + +B2 + + +10.1.12.1 + + +10.1.13.1 + +Default + +G0/3/0 +R1 + + + +192.0.2.1 Internet ISP1 + +Default + +Figure 20-7 Default Routes Resulting from the default-information originate Command + + +NOTE Interestingly, the default-information originate always router subcommand tells the router to always advertise the default route, no matter whether the router’s default route is working or not. + +Example 20-17 shows details of the default route on both R1 and branch router B1 from Figure 20-7. R1 then creates a static default route with the ISP router’s IP address of 192.0.2.1 as the next-hop address, as highlighted in the output of the show ip route static command output. + +Example 20-17 Default Routes on Routers R1 and B1 + +! The next command is from Router R1. Note the static code for the default route +R1# show ip route static +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +! Rest of the legend omitted for brevity + +Gateway of last resort is 192.0.2.1 to network 0.0.0.0 + +S* 0.0.0.0/0 [254/0] via 192.0.2.1 + +! The next command is from router B01; notice the External route code for the default +B1# show ip route ospf +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +! Rest of the legend omitted for brevity + +Gateway of last resort is 10.1.12.1 to network 0.0.0.0 + +O*E2 0.0.0.0/0 [110/1] via 10.1.12.1, 00:20:51, GigabitEthernet0/1/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +O 10.1.3.0/24 [110/3] via 10.1.12.1, 00:20:51, GigabitEthernet0/1/0 +O 10.1.13.0/24 [110/2] via 10.1.12.1, 00:20:51, GigabitEthernet0/1/0 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 491 + +Keeping the focus on the command on Router R1, note that R1 indeed has a default route— that is, a route to 0.0.0.0/0. The “Gateway of last resort,” which refers to the default route cur-rently used by the router, points to next-hop IP address 192.0.2.1, which is the ISP router’s IP address. (Refer to Figure 20-7 for the particulars.) + +Next look to the bottom half of the example and router B1’s OSPF-learned default route. B1 lists a route for 0.0.0.0/0 as well. The next-hop router in this case is 10.1.12.1, which is Router R1’s IP address on the WAN link. The code on the far left is O*E2, meaning an OSPF-learned route, which is a default route, and is specifically an external OSPF route. Finally, B1’s gate-way of last resort setting uses that one OSPF-learned default route, with next-hop router 10.1.12.1. + +OSPF Metrics (Cost) +The section “Calculating the Best Routes with SPF” in Chapter 19 discussed how SPF calcu-lates the metric for each route, choosing the route with the best metric for each destination subnet. OSPF routers can influence that choice by changing the OSPF interface cost on any and all interfaces. + +Cisco routers allow three different ways to change the OSPF interface cost: + +■ Directly, using the interface subcommand ip ospf cost x. +■ Using the default calculation per interface, and changing the interface bandwidth setting, +which changes the calculated value. 20 ■ Using the default calculation per interface, and changing the OSPF reference bandwidth +setting, which changes the calculated value. + +Setting the Cost Directly +Setting the cost directly requires a simple configuration command, as shown in Example 20-18. The example sets the cost of two interfaces on Router R1. (This example uses the Figure 20-2 design, as configured in Examples 20-2 and 20-3.) The show ip ospf interface +brief command that follows details the cost of each interface. Note that the show command confirms the cost settings. + +Example 20-18 Confirming OSPF Interface Costs + +R1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface g0/0/0 +R1(config-if)# ip ospf cost 4 +R1(config-if)# interface g0/1/0 +R1(config-if)# ip ospf cost 5 +R1(config-if)# ^Z +R1# +R1# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/0.2 1 0 +Gi0/0.1 1 0 + +10.1.2.1/24 1 DR 0/0 +10.1.1.1/24 1 DR 0/0 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +492 CCNA 200-301 Official Cert Guide, Volume 1 + + +Gi0/0/0 1 0 +Gi0/1/0 1 0 +Gi0/2/0 1 0 + +10.1.12.1/24 +10.1.13.1/24 +10.1.14.1/24 + +4 DR 1/1 +5 BDR 1/1 +1 DR 1/1 + + + +The output also shows a cost value of 1 for the other Gigabit interfaces, which is the default OSPF cost for any interface faster than 100 Mbps. The next topic discusses how IOS deter-mines the default cost values. + +Setting the Cost Based on Interface and Reference Bandwidth +Routers use a per-interface bandwidth setting to describe the speed of the interface. Note that the interface bandwidth setting does not influence the actual transmission speed. Instead, the interface bandwidth acts as a configurable setting to represent the speed of the interface, with the option to configure the bandwidth to match the actual transmis-sion speed…or not. To support this logic, IOS sets a default interface bandwidth value that +matches the physical transmission speed when possible, but also allows the configuration of the interface bandwidth using bandwidth speed interface subcommand. + +OSPF (as well as other IOS features) uses the interface bandwidth to make decisions, with OSPF using the interface bandwidth in its calculation of the default OSPF cost for each interface. IOS uses the following formula to choose an interface’s OSPF cost if the cost for cases in which the ip ospf cost command is not configured on the interface. IOS puts the interface’s bandwidth in the denominator and an OSPF setting called the reference band-width in the numerator: + +Reference_bandwidth / Interface_bandwidth +Note that while you can change both the interface bandwidth and reference bandwidth via configuration, because several IOS features make use of the bandwidth setting, you should avoid changing the interface bandwidth as a means to influence the default OSPF cost. + +That being said, many enterprises do use default cost settings while influencing the default by changing the OSPF reference bandwidth while leaving the interface bandwidth as an accurate representation of link speed. Cisco chose the IOS default reference bandwidth set-ting decades ago in an era with much slower links. As a result, any interface with an interface bandwidth of 100 Mbps or faster ties with a calculated OSPF cost of 1 when using the default reference bandwidth. So, when relying on the default OSPF cost calculation, it helps to configure the reference bandwidth to another value. + +To see the issue, consider Table 20-3, which lists several types of interfaces, the default inter-face bandwidth on those interfaces, and the OSPF cost calculated with the default OSPF reference bandwidth of 100 MBps (that is, 100,000 Kbps). (OSPF rounds up for these calcu-lations, resulting in a lowest possible OSPF interface cost of 1.) + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 493 + +Table 20-3 Faster Interfaces with Equal OSPF Costs + +Interface + +Serial + +Ethernet + +Fast Ethernet + +Gigabit Ethernet + +10 Gigabit Ethernet + +100 Gigabit Ethernet + +Interface Default Bandwidth (Kbps) +1544 Kbps + +10,000 Kbps + +100,000 Kbps + +1,000,000 Kbps + +10,000,000 Kbps + +100,000,000 Kbps + +Formula (Kbps) + +100,000 / 1544 + +100,000 / 10,000 + +100,000/100,000 + +100,000/1,000,000 + +100,000/10,000,000 + +100,000/100,000,000 + +OSPF Cost + +64 + +10 + +1 + +1 + +1 + +1 + + + +As you can see from the table, with a default reference bandwidth, all interfaces from Fast Ethernet’s 100 Mbps and faster tie with their default OSPF cost. As a result, OSPF would treat a 100-Mbps link as having the same cost as a 10- or 100-Gbps link, which is probably not the right basis for choosing routes. + +You can still use OSPF’s default cost calculation (and many do) just by changing the refer-ence bandwidth with the auto-cost reference-bandwidth speed OSPF mode subcommand. This command sets a value in a unit of megabits per second (Mbps). Set the reference band-width value to a value at least as much as the fastest link speed in the network, but preferably +higher, in anticipation of adding even faster links in the future. 20 +For instance, in an enterprise whose fastest links are 10 Gbps (10,000 Mbps), you could set all routers to use auto-cost reference-bandwidth 10000, meaning 10,000 Mbps or 10 Gbps. In that case, by default, a 10-Gbps link would have an OSPF cost of 1, while a 1-Gbps link would have a cost of 10, and a 100-MBps link a cost of 100. + +Better still, in that same enterprise, use a reference bandwidth of a faster speed than the fastest interface in the network, to allow room for higher speeds. For instance, in that same enterprise, whose fastest link is 10 Gbps, set the reference bandwidth to 40 Gbps or even 100 Gbps to be ready for future upgrades to use 40-Gbps links, or even 100-Gbps links. (For example, use the auto-cost reference-bandwidth 100000 command, meaning 100,000 +Mbps or 100 Gbps.) That causes 100-Gbps links to have an OSPF cost of 1, 40-Gbps links to have a cost of 4, 10-Gbps links to have a cost of 10, and 1-Gbps links to have a cost of 100. + +NOTE Cisco recommends making the OSPF reference bandwidth setting the same on all OSPF routers in an enterprise network. + +For convenient study, the following list summarizes the rules for how a router sets its OSPF interface costs: +1. Set the cost explicitly, using the ip ospf cost x interface subcommand, to a value between 1 and 65,535, inclusive. +2. Although it should be avoided, change the interface bandwidth with the bandwidth speed command, with speed being a number in kilobits per second (Kbps). +3. Change the reference bandwidth, using router OSPF subcommand auto-cost reference-bandwidth ref-bw, with a unit of megabits per second (Mbps). + + +|||||||||||||||||||| +|||||||||||||||||||| + + +494 CCNA 200-301 Official Cert Guide, Volume 1 + +OSPF Load Balancing +When a router uses SPF to calculate the metric for each of several routes to reach one sub-net, one route may have the lowest metric, so OSPF puts that route in the routing table. However, when the metrics tie for multiple routes to the same subnet, the router can put multiple equal-cost routes in the routing table (the default is four different routes) based on the setting of the maximum-paths number router subcommand. For example, if an internet-work has six possible paths between some parts of the network, and the engineer wants all routes to be used, the routers can be configured with the maximum-paths 6 subcommand under router ospf. + +The more challenging concept relates to how the routers use those multiple routes. A router could load balance the packets on a per-packet basis. For example, if the router has three equal-cost OSPF routes for the same subnet in the routing table, the router could send the one packet over the first route, the next packet over the second route, the next packet over the third route, and then start over with the first route for the next packet. Note that per-packet load balancing is generally a poor choice because it causes the most overhead work on the router. Alternatively, using the default (and better) method, the load balancing could be on a per-destination IP address basis. + +Note that the default setting of maximum-paths varies by router platform. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 20-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 20-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review Config Checklists + +Review command tables + +Do labs + +Resource Used: Book, website +Book, website + +Book, PTP + +Book, website + +Book + +Blog + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 495 + +Review All the Key Topics + + +Table 20-5 +Key Topic Element +Figure 20-1 + +List + +Figure 20-3 + +Key Topics for Chapter 20 +Description Page Number +Organization of OSPFv2 configuration with the network 471 command +Example OSPF wildcard masks and their meaning 473 + +OSPF verification commands 476 + + + +Example 20-4 + +List + +List + +Example 20-14 + +List + +Figure 20-6 + +List + +Example of the show ip ospf neighbor command 476 + +Neighbor states and their meanings 477 + +Rules for setting the router ID 481 + +Differences in show ip ospf interface output with OSPF 486 interface configuration +Actions IOS takes when an OSPF interface is passive 487 + +Actions taken by the OSPF default-information originate 489 command +Rules for setting OSPF interface cost 493 20 + + + +Key Terms You Should Know +reference bandwidth, interface bandwidth, maximum paths + +Command References +Tables 20-6 and 20-7 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + +Table 20-6 +Command + +Chapter 20 Configuration Command Reference +Description + + + +router ospf process-id + +network ip-address wildcard-mask area area-id + +ip ospf process-id area area-number + +Router subcommand that enters OSPF configuration mode for the listed process. +Router subcommand that enables OSPF on interfaces matching the address/wildcard combination and sets the OSPF area. +Interface subcommand to enable OSPF on the interface and to assign the interface to a specific OSPF area. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +496 CCNA 200-301 Official Cert Guide, Volume 1 + + +Command +ip ospf cost interface-cost + +bandwidth bandwidth + +auto-cost reference-bandwidth number + +router-id id + +interface loopback number + +maximum-paths number-of-paths + +passive-interface type number + +passive-interface default + +no passive-interface type number +default-information originate [always] + +Description +Interface subcommand that sets the OSPF cost associated with the interface. +Interface subcommand that directly sets the interface bandwidth (Kbps). +Router subcommand that tells OSPF the numerator in the Reference_bandwidth / Interface_bandwidth formula used to calculate the OSPF cost based on the interface bandwidth. +OSPF command that statically sets the router ID. + +Global command to create a loopback interface and to navigate to interface configuration mode for that interface. +Router subcommand that defines the maximum number of equal-cost routes that can be added to the routing table. + +Router subcommand that makes the interface passive to OSPF, meaning that the OSPF process will not form neighbor relationships with neighbors reachable on that interface. +OSPF subcommand that changes the OSPF default for interfaces to be passive instead of active (not passive). +OSPF subcommand that tells OSPF to be active (not passive) on that interface or subinterface. + +OSPF subcommand to tell OSPF to create and advertise an OSPF default route, as long as the router has some default route (or to always advertise a default, if the always option is configured). + + + + +Table 20-7 +Command + + +Chapter 20 EXEC Command Reference +Description + + + +show ip ospf + + +show ip ospf interface brief + + +show ip ospf interface [type number] + +show ip protocols + +Lists information about the OSPF process running on the router, including the OSPF router ID, areas to which the router connects, and the number of interfaces in each area. +Lists the interfaces on which the OSPF protocol is enabled (based on the network commands), including passive interfaces. +Lists a long section of settings, status, and counters for OSPF operation on all interfaces, or on the listed interface, including the Hello and Dead Timers. +Shows routing protocol parameters and current timer values. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 20: Implementing OSPF 497 + + +Command +show ip ospf neighbor [type number] + + +show ip ospf neighbor neighbor-ID +show ip ospf database + + +show ip route + +show ip route ospf + +show ip route ip-address mask +clear ip ospf process + +Description +Lists brief output about neighbors, identified by neighbor router ID, including current state, with one line per neighbor; optionally, limits the output to neighbors on the listed interface. +Lists the same output as the show ip ospf neighbor detail command, but only for the listed neighbor (by neighbor RID). +Lists a summary of the LSAs in the database, with one line of output per LSA. It is organized by LSA type (first type 1, then type 2, and so on). +Lists all IPv4 routes. + +Lists routes in the routing table learned by OSPF. + +Shows a detailed description of the route for the listed subnet/mask. + +Resets the OSPF process, resetting all neighbor relationships and also causing the process to make a choice of OSPF RID. + + + + +20 + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 21 + + +OSPF Network Types and Neighbors + +This chapter covers the following exam topics: + +3.0 IP Connectivity +3.4 Configure and verify single area OSPFv2 + +3.4.a Neighbor adjacencies + +3.4.b Point-to-point + +3.4.c Broadcast (DR/BDR selection) + +3.4.d Router ID + +Chapter 20, “Implementing OSPF,” discussed the required and most common optional OSPF configuration settings, along with the many verification commands to show how OSPF works with those settings. This chapter continues with more OSPF implementation topics, both to round out the discussion of OSPF and to focus even more on the specific CCNA 200-301 exam topics. + +The first of two major sections of this chapter focuses on OSPF network types, specifi-cally types point-to-point and broadcast. The CCNA 200-301 exam topics mention those by name. Chapter 20 showed how OSPF operates on Ethernet interfaces when using their default network type (broadcast). This first section of the chapter discusses the meaning of OSPF network types, default settings, how to configure to use other settings, and how OSPF works differently with different settings. + +The second major section then focuses on neighbors and neighbor adjacencies as mentioned in yet another of the OSPF exam topics. OSPF routers cannot exchange LSAs with another router unless they first become neighbors. This second section discusses the various OSPF features that can prevent OSPF routers from becoming neighbors and how you can go about discovering if those bad conditions exist—even if you do not have access to the running configuration. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Table 21-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section OSPF Network Types +OSPF Neighbor Relationships + +Questions 1–3 +4–6 + + + +1. Routers R1 and R2, with router IDs 1.1.1.1 and 2.2.2.2, connect over an Ethernet WAN link. If using all default OSPF settings, if the WAN link initializes for both routers at the same time, which of the following answers are true? (Choose two answers.) +a. Router R1 will become the DR. +b. Router R1 will dynamically discover the existence of router R2. c. Router R2 will be neither the DR nor the BDR. +d. Router R1’s show ip ospf neighbor command will list R2 with a state of “FULL/DR.” + +2. Routers R1 and R2, with router IDs 1.1.1.1 and 2.2.2.2, connect over an Ethernet WAN link. The configuration uses all defaults, except giving R1 an interface priority of 11 and changing both routers to use OSPF network type point-to-point. If the WAN link initializes for both routers at the same time, which of the following answers are true? (Choose two answers.) +a. Router R1 will become the DR. +b. Router R1 will dynamically discover the existence of router R2. c. Router R2 will be neither the DR nor the BDR. +d. Router R2’s show ip ospf neighbor command will list R1 with a state of “FULL/DR.” + +3. Per the command output, with how many routers is router R9 full adjacent over its Gi0/0 interface? +R9# show ip ospf interface brief + +Interface +Gi0/0 + +PID Area +1 0 + +IP Address/Mask +10.1.1.1/24 + +Cost State Nbrs F/C +1 DROTH 2/5 + + +a. 7 b. 0 c. 5 d. 2 + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +500 CCNA 200-301 Official Cert Guide, Volume 1 + +4. An engineer connects routers R11 and R12 to the same Ethernet LAN and configures them to use OSPFv2. Which answers describe a combination of settings that would prevent the two routers from becoming OSPF neighbors? (Choose two answers.) +a. R11’s interface uses area 11 while R12’s interface uses area 12. +b. R11’s OSPF process uses process ID 11 while R12 uses process ID 12. +c. R11’s interface uses OSPF priority 11 while R12’s uses OSPF priority 12. d. R11’s interface uses an OSPF Hello timer value of 11 while R12’s uses 12. +5. An engineer connects routers R13 and R14 to the same Ethernet LAN and configures them to use OSPFv2. Which answers describe a combination of settings that would prevent the two routers from becoming OSPF neighbors? +a. Both routers’ interface IP addresses reside in the same subnet. b. Both routers’ OSPF process uses process ID 13. +c. Both routers’ OSPF process uses router ID 13.13.13.13. d. Both routers’ interfaces use an OSPF Dead interval of 40. +6. Router R15 has been a working part of a network that uses OSPFv2. An engineer then issues the shutdown command in OSPF configuration mode on R15. Which of the fol-lowing occurs? +a. R15 empties its IP routing table of all OSPF routes but keeps its LSDB intact. b. R15 empties its LSDB but keeps OSPF neighbor relationships active. +c. R15 keeps OSPF neighbors open but does not accept new OSPF neighbors. +d. R15 keeps all OSPF configuration but ceases all OSPF activities (routes, LSDB, neighbors). + +Foundation Topics + +OSPF Network Types +Two CCNA 200-301 exam topics might be completely misunderstood without taking a closer look at yet more default OSPF settings. In particular, the following exam topics refer to a specific per-interface OSPF setting called the network type—even listing the keywords used to configure the setting in the exam topics: + +3.4.b: point-to-point +3.4.c: broadcast (DR/BDR selection) +OSPF includes a small number of network types as a setting on each OSPF-enabled inter-face. The setting tells the router whether or not to dynamically discover OSPF neighbors (versus requiring the static configuration of the neighboring router’s IP address) and whether or not the router should attempt to use a designated router (DR) and backup DR (BDR) in the subnet. Of the two OSPF network types included in the CCNA exam topics, both cause routers to dynamically discover neighbors, but one calls for the use of a DR while the other does not. Table 21-2 summarizes the features of the two OSPF network types mentioned in the exam topics. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 501 + +Table 21-2 Two OSPF Network Types and Key Behaviors + +Network Type Keyword broadcast +point-to-point + +Dynamically Discovers Neighbors Yes +Yes + +Uses a DR/BDR Yes +No + + + +The rest of this first major section of the chapter explores each type. + +The OSPF Broadcast Network Type +OSPF defaults to use a broadcast network type on all types of Ethernet interfaces. Note that all the Ethernet interfaces in examples in Chapter 20 relied on that default setting. + +To see all the details of how the OSPF broadcast network type works, this chapter begins with a different design than the examples in Chapter 20, instead using a single area design that connects four routers to the same subnet, as shown in Figure 21-1. All links reside in area 0, making the design a single area design. + +RID 1.1.1.1 RID 3.3.3.3 + + +G0/1 10.1.11.1/24 R1 + + + +G0/1 10.1.22.2/24 R2 + +G0/0 10.1.1.1/24 + + + +G0/0 +10.1.1.2/24 + + +G0/0 10.1.1.3/24 + + + +G0/0 +10.1.1.4/24 + + +G0/1 +R3 10.1.33.3/24 + + + +G0/1 +R4 10.1.44.4/24 + + + + + + + +21 + +RID 2.2.2.2 RID 4.4.4.4 + +Figure 21-1 The Single Area Design Used in This Chapter + +To get a sense for how OSPF operates with the broadcast network type, imagine that all four routers use a straightforward OSPF interface configuration like the router R1 configuration shown in Example 21-1. Both GigabitEthernet interfaces on all four routers default to use network type broadcast. Note that the configuration on routers R2, R3, and R4 mirrors R1’s configuration except that they use router IDs 2.2.2.2, 3.3.3.3, and 4.4.4.4, respectively, and they use the IP addresses shown in the figure. + +Example 21-1 R1 OSPF Configuration to Match Figure 21-1 + +router ospf 1 +router-id 1.1.1.1 +! +interface gigabitEthernet0/0 +ip ospf 1 area 0 +! +interface gigabitEthernet0/1 +ip ospf 1 area 0 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +502 CCNA 200-301 Official Cert Guide, Volume 1 + +This simple design gives us a great backdrop from which to observe the results of the broad-cast network type on each router. Both interfaces (G0/0 and G0/1) on each router use the broadcast network type and perform the following actions: + +■ Attempt to discover neighbors by sending OSPF Hellos to the 224.0.0.5 multicast address (an address reserved for sending packets to all OSPF routers in the subnet) +■ Attempt to elect a DR and BDR on each subnet +■ On the interface with no other routers on the subnet (G0/1), become the DR +■ On the interface with three other routers on the subnet (G0/0), be either DR, BDR, or a DROther router +■ When sending OSPF messages to the DR or BDR, send the messages to the all-OSPF-DRs multicast address 224.0.0.6 + +Example 21-2 shows some of the results using the show ip ospf neighbor command. Note that R1 lists R2, R3, and R4 as neighbors (based on their 2.2.2.2, 3.3.3.3, and 4.4.4.4 router IDs), confirming that R1 dynamically discovered the other routers. Also, note that the output lists 4.4.4.4 as the DR and 3.3.3.3 as the BDR. + +Example 21-2 R1’s List of Neighbors + +R1# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 +3.3.3.3 +4.4.4.4 + +Pri State +1 2WAY/DROTHER +1 FULL/BDR +1 FULL/DR + +Dead Time +00:00:35 +00:00:33 +00:00:35 + +Address +10.1.1.2 +10.1.1.3 +10.1.1.4 + +Interface +GigabitEthernet0/0 +GigabitEthernet0/0 +GigabitEthernet0/0 + + + +Verifying Operations with Network Type Broadcast +As discussed in the section “Using Designated Routers on Ethernet Links” in Chapter 19, “Understanding OSPF Concepts,” all discovered routers on the link should become neighbors and at least reach the 2-way state. For all neighbor relationships that include the DR and/or BDR, the neighbor relationship should further reach the full state. That section defined the term fully adjacent as a special term that refers to neighbors that reach this full state. + +The design in Figure 21-1, with four routers on the same LAN, provides just enough routers so that one neighbor relationship will remain in a 2-way state and not reach the full state, as a perfectly normal way for OSPF to operate. Figure 21-2 shows the current conditions when the show commands in this chapter were gathered, with R4 as the DR, R3 as the BDR, and with R1 and R2 as DROther routers. + +Now consider router R1’s neighbors as listed in Example 21-2. R1 has three neighbors, all reachable out its G0/0 interface. However, R1’s show ip ospf neighbor command refers to the state of R1’s relationship with the neighbor: 2-way with router 2.2.2.2. Because both R1 and R2 currently serve as DROther routers—that is, they wait ready to become the BDR if either the DR or BDR fails—their neighbor relationship remains in a 2-way state. + +Answers to the “Do I Know This Already?” quiz: 1 B, D 2 B, C 3 D 4 A, D 5 C 6 D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 503 + +RID 1.1.1.1 RID 3.3.3.3 + + +G0/1 G0/0 +DR R1 DROther + + + +G0/1 DROther DR R2 G0/0 + + +G0/0 G0/1 BDR R3 DR + + + +DR G0/1 G0/0 R4 DR + +RID 2.2.2.2 RID 4.4.4.4 + +Figure 21-2 OSPF DR/BDR/DROther Roles in the Network + +Examining Example 21-2 one last time, R1, as a DROther router itself, has two neighbor relationships that reach a full state: R1’s neighbor adjacency with DR R4 and R1’s neighbor adjacency with BDR R3. But R1 has a total of three neighbors, all reachable off R1’s G0/0 interface. + +The idea that R1 has three neighbors off its G0/0 interface, with two being fully adjacent, is reflected on the far right of the output of the show ip ospf interface brief command output in Example 21-3. It shows “2/3,” meaning two neighbors in the full state off port G0/0, with three total neighbors on that interface. Also, note that this command’s “State” column differs from the show ip ospf neighbor commands, in that the show ip ospf interface brief com-mand lists the local router’s role on the interface (as shown in Figure 21-2), with R1’s G0/1 acting as DR and R1’s G0/0 acting as a DROther router. + +Example 21-3 Router R1 OSPF Interfaces: Local Role and Neighbor Counts 21 R1# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C +Gi0/1 1 0 10.1.11.1/24 1 DR 0/0 +Gi0/0 1 0 10.1.1.1/24 1 DROTH 2/3 + + +So far, this topic has described the effect of the OSPF broadcast network type by taking advantage of the default setting on Ethernet interfaces. To see the setting, use the show ip ospf interface command, as shown in Example 21-4. The first highlighted item identifies the network type. However, this command’s output restates many of the facts seen in both the show ip ospf neighbor and show ip ospf interface brief commands in Examples 21-2 and 21-3, so take the time to browse through all of Example 21-4 and focus on the additional highlights to see those familiar items. + +Example 21-4 Displaying OSPF Network Type Broadcast + +R1# show ip ospf interface g0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet Address 10.1.1.1/24, Area 0, Attached via Interface Enable +Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Enabled by interface config, including secondary ip addresses + + +|||||||||||||||||||| +|||||||||||||||||||| + + +504 CCNA 200-301 Official Cert Guide, Volume 1 + +Transmit Delay is 1 sec, State DROTHER, Priority 1 +Designated Router (ID) 4.4.4.4, Interface address 10.1.1.4 +Backup Designated router (ID) 3.3.3.3, Interface address 10.1.1.3 +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:00 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 1/1/1, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 0, maximum is 1 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 3, Adjacent neighbor count is 2 + +Adjacent with neighbor 3.3.3.3 +Adjacent with neighbor 4.4.4.4 +Suppress hello for 0 neighbor(s) + +(Backup Designated Router) +(Designated Router) + + + +Although you would not need to configure an Ethernet interface to use the broadcast net-work type, some older types of interfaces over the years have used different defaults and with the option to use the broadcast network type. In those cases, the ip ospf network broadcast interface subcommand would configure the setting. + +Configuring to Influence the DR/BDR Election +In some cases, you may want to influence the OSPF DR election. However, before deciding that makes sense in every case, note that OSPF DR/BDR election rules will not result in a specific router always being the DR, and another always being the BDR, assuming that each is up and working. In short, here are the rules once a DR and BDR have been elected: + +■ If the DR fails, the BDR becomes the DR, and a new BDR is elected. +■ When a better router enters the subnet, no preemption of the existing DR or BDR occurs. + +As a result of these rules, while you can configure a router to be the best (highest prior-ity) router to become the DR in an election, doing so only increases that router’s statistical +chances of being the DR at a given point in time. If the router fails, other routers will become DR and BDR, and the best router will not be DR again until the current DR and BDR fail. + +NOTE If you have begun to think about STP elections, note that the rules are similar, but with two key differences. STP uses a lowest-is-best approach and allows new switches to pre-empt the existing root switch to become the root. OSPF uses a highest-is-best approach and does not preempt the DR as just noted. + +In some cases, you may want to influence the DR/BDR election with two configurable set-tings, listed here in order of precedence: + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 505 + +■ The highest OSPF interface priority: The highest value wins during an election, with val-ues ranging from 0 to 255. +■ The highest OSPF Router ID: If the priority ties, the election chooses the router with the highest OSPF RID. + +For example, imagine all four routers in the design shown in Figure 21-1 trying to elect the DR and BDR at the same time—for instance, after a power hit in which all four routers power off and back on again. They all participate in the election. They all tie with default priority values of 1 (see Example 21-4 for R1’s priority in the show ip ospf interface command out-put.) In this case, R4, with the numerically highest RID of 4.4.4.4, wins the election, and R3, with the next highest RID of 3.3.3.3, becomes the BDR. + +To influence the election, you could set the various RIDs with your preferred router with the highest RID value. However, many networks choose OSPF router IDs to help identify the router easily. Instead, using the OSPF priority setting makes better sense. For instance, if an engineer preferred that R1 be the DR, the engineer could add the configuration in Example 21-5 to set R1’s interface priority to 99. + +Example 21-5 Influencing DR/BDR Election Using OSPF Priority + +R1# configure terminal +Configuring from terminal, memory, or network [terminal]? +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface g0/0 +R1(config-if)# ip ospf priority 99 +R1(config-if)# ^Z +R1# 21 R1# show ip ospf interface g0/0 | include Priority +Transmit Delay is 1 sec, State DROTHER, Priority 99 + +R1# show ip ospf neighbor + +Neighbor ID +2.2.2.2 +3.3.3.3 +4.4.4.4 + +Pri State +1 2WAY/DROTHER +1 FULL/BDR +1 FULL/DR + +Dead Time +00:00:36 +00:00:30 +00:00:37 + +Address +10.1.1.2 +10.1.1.3 +10.1.1.4 + +Interface +GigabitEthernet0/0 +GigabitEthernet0/0 +GigabitEthernet0/0 + + +R1# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C +Gi0/1 1 0 10.1.11.1/24 1 DR 0/0 +Gi0/0 1 0 10.1.1.1/24 1 DROTH 2/3 + + +The configuration shows R1’s interface priority value now as 99, and the show ip ospf interface G0/0 command that follows confirms the setting. However, the last two commands in the example seem to show that the DR and BDR have not changed at all—and that output is indeed correct. In the example, note that the show ip ospf neighbor command still lists R4’s state as DR, meaning R4 still acts as the DR, while the show ip ospf interface brief command lists R1’s State (role) as DROTH. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +506 CCNA 200-301 Official Cert Guide, Volume 1 + +Just to complete the process, Example 21-6 shows the results after forcing a free election (by failing the LAN switch that sits between the four routers). As expected, R1 wins and becomes DR due to its higher priority, with the other three routers tying based on priority. R4 wins between R2, R3, and R4 due to its higher RID to become the BDR. + +Example 21-6 Results of a Completely New DR/BDR Election + +! Not shown: LAN fails, and then recovers, causing a new OSPF Election +R1# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 +3.3.3.3 +4.4.4.4 + +Pri State +1 FULL/DROTHER +1 FULL/DROTHER +1 FULL/BDR + +Dead Time +00:00:37 +00:00:38 +00:00:38 + +Address +10.1.1.2 +10.1.1.3 +10.1.1.4 + +Interface +GigabitEthernet0/0 +GigabitEthernet0/0 +GigabitEthernet0/0 + + +R1# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/1 1 0 +Gi0/0 1 0 + +10.1.11.1/24 1 DR 0/0 +10.1.1.1/24 1 DR 3/3 + + + +The OSPF Point-to-Point Network Type +The other OSPF network type mentioned in the CCNA 200-301 exam topics, point-to-point, works well for data links that by their nature have just two routers on the link. For example, consider the topology in Figure 21-3, which shows router R1 with three WAN links—two Ethernet WAN links and one serial link. + +Area 0 + +10.1.23.2 /24 G0/0 +G0/1/0 +G0/0/0 +10.1.12.2 /2410.1.12.1 /24 +R2 + + + +10.1.1.1 /24 +G0/0 +R1 + + +G0/1/0 10.1.13.1 /24 + + +G0/0/0 10.1.13.3 /24 R3 + +10.1.23.3 /24 G0/0 + + +10.1.4.4 /24 G0/1 +10.1.14.4 /2410.1.14.1 /24 +S0/0/0 +S0/0/1 +R4 + + +Figure 21-3 Sample OSPF Design with Serial and Ethernet WAN + +First, focus on the serial link itself. To review, the jagged line represents a physical link that can at most have two devices using the link, specifically R1 and R4 in this case. The link does not support the ability to add a third router to the link. As you might guess, the data-link protocols to control a link with at most two devices can work differently than Ethernet. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 507 + +For instance, the data-link protocols most often used on the link (HDLC and PPP) do not support data-link broadcasts. + +Next, consider the OSPF point-to-point network type: it exists for serial links and other links that use a point-to-point topology. These links often do not support data-link broadcasts. Additionally, with only two devices on the link, using a DR/BDR is not a help, and it actually adds a little extra convergence time. Using a network type of point-to-point tells the router to not use a DR/BDR on the link. + +While you may see some serial links in networks today, the CCNA and CCNP Enterprise exams make no specific mention of serial technology at this point. However, you will see other point-to-point links—like some Ethernet WAN links. + +To connect the thoughts, note that all the Ethernet WAN links used in this book happen to use a point-to-point Ethernet WAN service called an Ethernet Private Wire Service or simply an Ethernet Line (E-Line). For that service, the service provider will send Ethernet frames between two devices (routers) connected to the service, but only those two devices. In other words, an E-line is a point-to-point service in concept. So while the Ethernet data-link proto-col supports broadcast frames, only two devices can exist on the link, and there is no advan-tage to using a DR/BDR. As a result, many engineers prefer to instead use an OSPF point-to-point network type on Ethernet WAN links that in effect act as a point-to-point link. + +Example 21-7 shows the configuration of router R1’s G0/0/0 interface in Figure 21-3 to use OSPF network type point-to-point. R2, on the other end of the WAN link, would need the same configuration command on its matching interface. + +Example 21-7 OSPF Network Type Point-to-Point on an Ethernet WAN Interface on R1 +R1# configure terminal 21 Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface g0/0/0 +R1(config-if)# ip ospf network point-to-point +R1(config-if)# + +R1# show ip ospf interface g0/0/0 +GigabitEthernet0/0/0 is up, line protocol is up +Internet Address 10.1.12.1/24, Area 0, Attached via Interface Enable +Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 1 + +Topology-MTID Cost +0 4 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Enabled by interface config, including secondary ip addresses +Transmit Delay is 1 sec, State POINT_TO_POINT +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:01 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 1/3/3, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) + + +|||||||||||||||||||| +|||||||||||||||||||| + + +508 CCNA 200-301 Official Cert Guide, Volume 1 + +Last flood scan length is 1, maximum is 3 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 2.2.2.2 +Suppress hello for 0 neighbor(s) + + +Note the highlighted portions of the show command in Example 21-6. The first two high-lights note the network type. The final highlight with two lines notes that R1 has one neigh-bor on the interface, a neighbor with which it has become fully adjacent per the output. + +Example 21-8 closes this section with a confirmation of some of those facts with two more commands. Note that the show ip ospf neighbor command on R1 lists router R2 (RID 2.2.2.2) with a full state, but with no DR nor BDR designation, instead listing a -. The - acts as a remind-er that the link does not use a DR/BDR. The second command, show ip ospf interface brief, shows the state (the local router’s role) as P2P, which is short for point-to-point, with a counter of 1 for the number of fully adjacent neighbors and total number of neighbors. + +Example 21-8 OSPF Network Type Point-to-Point on an Ethernet WAN Interface on R1 + +R1# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 + +Pri State +0 FULL/ - + +Dead Time +00:00:39 + +Address +10.1.12.2 + +Interface +GigabitEthernet0/0/0 + +! lines omitted for brevity + +R1# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C +Gi0/0/0 1 0 10.1.12.1/24 4 P2P 1/1 +! lines omitted for brevity + + +When using Ethernet WAN links that behave as a point-to-point link, consider using OSPF network type point-to-point rather than using the default broadcast type. + +OSPF Neighbor Relationships +A router’s OSPF configuration enables OSPF on a set of interfaces. IOS then attempts to dis-cover other neighbors on those interfaces by sending and listening for OSPF Hello messages. However, once discovered, two routers may not become neighbors. They must have compat-ible values for several settings as listed in the Hellos exchanged between the two routers. This second major section of the chapter examines those reasons. + +OSPF Neighbor Requirements +After an OSPF router hears a Hello from a new neighbor, the routing protocol examines the information in the Hello and compares that information with the local router’s own settings. If the settings match, great. If not, the routers do not become neighbors. Because there is no formal term for all these items that a routing protocol considers, this book just calls them neighbor requirements. Table 21-3 lists the neighbor requirements for OSPF, with some comments about the various issues following the table. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 509 + +Table 21-3 Neighbor Requirements for OSPF + +Requirement + + +Interfaces must be in an up/up state. + +Required for OSPF + +Yes + +Neighbor Missing if Incorrect +Yes + + +Access control lists (ACL) must not filter routing protocol messages. Yes Yes + +Interfaces must be in the same subnet. Yes Yes + +They must pass routing protocol neighbor authentication (if Yes Yes configured). +Hello and hold/dead timers must match. Yes Yes + +Router IDs (RID) must be unique. Yes Yes + +They must be in the same area. Yes Yes + +OSPF process must not be shut down. Yes Yes + +Neighboring interfaces must use same MTU setting. Yes No + +Neighboring interfaces must use same OSPF network type. Yes No + + +First, consider the meaning of the two rightmost columns. The column labeled “Required for OSPF” means that the item must be working correctly for the neighbor relationship to work correctly. Note that all the items in this column list a “yes,” meaning that all must be correct for the neighbor relationship to work correctly. The last column heading states “Neighbor Missing if Incorrect.” For items listing a “yes” in this column, if that item is configured incor-rectly, the neighbor will not appear in lists of OSPF neighbors—for instance, with the show ip ospf neighbor command. + +Next, focus on the shaded items at the top of the table. The symptom that occurs if either of these is a problem is that the show ip ospf neighbor command would not list the other router. For instance, the first item states that the router interfaces must be up and working. If the router interface is not working, the router cannot send any OSPF messages and discover any OSPF neighbors on that interface. + +The middle section of the table (the unshaded rows) focuses on some OSPF settings. These items must be correct, but if not, they also result in the neighbor not being listed in the out-put of the show ip ospf neighbor command. + +As you can see, using the show ip ospf neighbor command can give you a good starting point to troubleshoot OSPF on the exam and in real life. If you see the neighbor you expect to see, great! If not, the table gives you a good list to use for items to investigate. + +Finally, the last section (shaded) lists a couple of OSPF settings that give a different symp-tom when incorrect. Again, those two items must be correct for OSPF neighbors to work. However, for these two items, when incorrect, a router can list the other router as a neighbor, but the neighbor relationship does not work properly in that the routers do not exchange LSAs as they should. + +For reference, Table 21-4 relists some of the requirements from Table 21-3, along with the +most useful commands with which to find the answers. + + + + + + +21 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +510 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 21-4 OSPF Neighbor Requirements and the Best show/debug Commands + +Requirement +Hello and dead timers must match. + +They must be in the same area. + +RIDs must be unique. + +They must pass any neighbor authentication. + +OSPF process must not be shut down. + +Best show Command show ip ospf interface +show ip ospf interface brief + +show ip ospf + +show ip ospf interface + +show ip ospf, show ip ospf interface + + +The rest of this section looks at some of the items from Table 21-3 in a little more detail. + + +NOTE One configuration choice that people sometimes think is an issue, but is not, is the process ID as defined by the router ospf process-id command. Neighboring routers can use the same process ID values, or different process ID values, with no impact on whether two routers become OSPF neighbors. + +Issues That Prevent Neighbor Adjacencies +The next few pages look at three of the topics from Table 21-3 for which, if a problem exists, the router does not become a neighbor (that is, the unshaded parts of the table.). To show the issues, this section uses the same topology shown earlier in Figure 21-1 but now with some incorrect configuration introduced. In other words, the configuration matches Example 21-1 that began this chapter, but with the following errors introduced: + +■ R2 has been configured with both LAN interfaces in area 1, whereas the other three rout-ers’ G0/0 interfaces are assigned to area 0. +■ R3 is using the same RID (1.1.1.1) as R1. +■ R4 has been configured with a Hello/dead timer of 5/20 on its G0/0 interface, instead of the 10/40 used (by default) on R1, R2, and R3. + +Figure 21-4 shows these same problems for reference. +RID 1.1.1.1 RID 1.1.1.1 (Should be 3.3.3.3) + + + +G0/1 +10.1.11.1/24 R1 + +G0/0 +10.1.1.1/24 + + +G0/0 10.1.1.3/24 R3 + + +G0/1 +10.1.33.3/24 + + +Incorrect Configuration: Area 1 + + +G0/1 +10.1.22.2/24 R2 + +G0/0 +10.1.1.2/24 + + +G0/0 10.1.1.4/24 R4 + + +G0/1 +10.1.44.4/24 + + +Intended Design: Area 0 Only Hello/Dead = 5/20 + +Figure 21-4 Summary of Problems That Prevent OSPF Neighbors on the Central LAN + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 511 + +Finding Area Mismatches +To create an area mismatch, the configuration on some router must place the interface into the wrong area per the design. As shown in Figure 21-4, router R2 was configured incor-rectly, placing both its interfaces into area 1 instead of area 0. Example 21-9 shows the con-figuration, which uses the correct syntax (and is therefore accepted by the router) but sets the wrong area number. + +Example 21-9 Setting Area 1 on R2’s Interfaces, When They Should Be in Area 0 + +router ospf 1 +router-id 2.2.2.2 +! +interface gigabitEthernet0/0 +ip ospf 1 area 1 +! +interface gigabitEthernet0/1 +ip ospf 1 area 1 + + +With an area mismatch error, the show ip ospf neighbor command will not list the neighbor. Because you see nothing in the OSPF neighbor table, to troubleshoot this problem, you need to find the area configuration on each interface on potentially neighboring routers. To do so: + +■ Check the output of show running-config to look for +■ ip ospf process-id area area-number interface subcommands +■ network commands in OSPF configuration mode +■ Use the show ip ospf interface [brief] command to list the area number 21 + +Finding Duplicate OSPF Router IDs +Next, Example 21-10 shows R1 and R3 both trying to use RID 1.1.1.1. Interestingly, both routers automatically generate a log message for the duplicate OSPF RID problem between R1 and R3; the end of Example 21-10 shows one such message. For the exams, just use the show ip ospf commands on both R3 and R1 to easily list the RID on each router, noting that they both use the same value. + +Example 21-10 Comparing OSPF Router IDs on R1 and R3 + +! Next, on R3: R3 lists the RID of 1.1.1.1 +! +R3# show ip ospf +Routing Process "ospf 1" with ID 1.1.1.1 +Start time: 00:00:37.136, Time elapsed: 02:20:37.200 +! lines omitted for brevity + + +! Back to R1: R1 also uses RID 1.1.1.1 +R1# show ip ospf +Routing Process "ospf 1" with ID 1.1.1.1 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +512 CCNA 200-301 Official Cert Guide, Volume 1 + +Start time: 00:01:51.864, Time elapsed: 12:13:50.904 +! lines omitted for brevity + +*May 29 00:01:25.679: %OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id +1.1.1.1 from 10.1.1.3 on interface GigabitEthernet0/0 + + +First, focus on the problem: the duplicate RIDs. The first line of the show ip ospf command on the two routers quickly shows the duplicate use of 1.1.1.1. To solve the problem, assuming R1 should use 1.1.1.1 and R3 should use another RID (maybe 3.3.3.3), change the RID on R3 and restart the OSPF process. To do so, use the router-id 3.3.3.3 OSPF subcommand and use the EXEC mode command clear ip ospf process. (OSPF will not begin using a new RID value until the process restarts, either via command or reload.) + +Finding OSPF Hello and Dead Timer Mismatches First, as a reminder from chapters past: +■ Hello interval/timer: The per-interface timer that tells a router how often to send OSPF Hello messages on an interface. +■ Dead interval/timer: The per-interface timer that tells the router how long to wait with-out having received a Hello from a neighbor before believing that neighbor has failed. (Defaults to four times the Hello timer.) + +Next, consider the problem created on R4, with the configuration of a different Hello timer and dead timer (5 and 20, respectively) as compared with the default settings on R1, R2, and R3 (10 and 40, respectively). A Hello or Dead interval mismatch prevents R4 from becoming neighbors with any of the other three OSPF routers. Routers list their Hello and Dead inter-val settings in their Hello messages and choose to not become neighbors if the values do not match. As a result, none of the routers become neighbors with router R4 in this case. + +Example 21-11 shows the easiest way to find the mismatch using the show ip ospf interface command on both R1 and R4. This command lists the Hello and dead timers for each inter-face, as highlighted in the example. Note that R1 uses 10 and 40 (Hello and dead), whereas R4 uses 5 and 20. + +Example 21-11 Finding Mismatched Hello/Dead Timers + +R1# show ip ospf interface G0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet Address 10.1.1.1/24, Area 0, Attached via Network Statement +Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 1.1.1.1, Interface address 10.1.1.1 +No backup designated router on this network + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 513 + +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +! lines omitted for brevity + +! Moving on to R4 next +! +R4# show ip ospf interface Gi0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet Address 10.1.1.4/24, Area 0, Attached via Network Statement +Process ID 4, Router ID 10.1.44.4, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 10.1.44.4, Interface address 10.1.1.4 +No backup designated router on this network +Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5 +! lines omitted for brevity + + +Shutting Down the OSPF Process +Similar to administratively disabling and enabling an interface, IOS also allows the OSPFv2 routing protocol process to be disabled and enabled with the shutdown and no shutdown router mode subcommands, respectively. When a routing protocol process is shut down, IOS does the following: + +■ Brings down all neighbor relationships and clears the OSPF neighbor table +■ Clears the LSDB 21 +■ Clears the IP routing table of any OSPF-learned routes + +At the same time, shutting down OSPF does retain some important details about OSPF, in particular: + +■ IOS retains all OSPF configuration. +■ IOS still lists all OSPF-enabled interfaces in the OSPF interface list (show ip ospf interface) but in a DOWN state. + +Basically, shutting down the OSPF routing protocol process gives the network engineer a way to stop using the routing protocol on that router without having to remove all the configuration. Once shut down, the show ip ospf interface [brief] command should still +list some output, as will the show ip ospf command, but the rest of the commands will list nothing. + +Example 21-12 shows an example on Router R5, as shown in Figure 21-5. R5 is a differ- +ent router than the one used in earlier examples, but it begins the example with two OSPF neighbors, R2 and R3, with router IDs 2.2.2.2 and 3.3.3.3. The example shows the OSPF process being shut down, the neighbors failing, and those two key OSPF show commands: show ip ospf neighbor and show ip ospf interface brief. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +514 CCNA 200-301 Official Cert Guide, Volume 1 + + + + +10.1.12.1 G0/1 + +R5 G0/2 10.1.13.1 + +RID 2.2.2.2 + +R2 + + +RID 3.3.3.3 + +R3 + + +Figure 21-5 Example Network to Demonstrate OSPF Process Shutdown + +Example 21-12 Shutting Down an OSPF Process, and the Resulting Neighbor States + +R5# show ip ospf neighbor + +Neighbor ID +2.2.2.2 +3.3.3.3 + +Pri State +1 FULL/DR +1 FULL/DR + +Dead Time +00:00:35 +00:00:33 + +Address +10.1.12.2 +10.1.13.3 + +Interface +GigabitEthernet0/1 +GigabitEthernet0/2 + +R5# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R5(config)# router ospf 1 +R5(config-router)# shutdown +R5(config-router)# ^Z +*Mar 23 12:43:30.634: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached +*Mar 23 12:43:30.635: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/2 from FULL to DOWN, Neighbor Down: Interface down or detached +R5# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/1 1 0 +Gi0/2 1 0 + +10.1.12.1/24 +10.1.13.1/24 + +1 DOWN 0/0 +1 DOWN 0/0 + + +R5# show ip ospf +Routing Process "ospf 1" with ID 5.5.5.5 +Start time: 5d23h, Time elapsed: 1d04h +Routing Process is shutdown +! lines omitted for brevity + +R5# show ip ospf neighbor +R5# +R5# show ip ospf database +OSPF Router with ID (3.3.3.3) (Process ID 1) +R5# + + +First, before the shutdown, the show ip ospf neighbor command lists two neighbors. After the shutdown, the same command lists no neighbors at all. Second, the show ip ospf interface brief command does list the interfaces on which OSPF is enabled, on the local router’s own IP addresses. However, it lists a state of DOWN, which is a reference to the local router’s state. Also, note that the show ip ospf command positively states that the + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 515 + +OSPF process is in a shutdown state, while the show ip ospf database command output lists only a heading line, with no LSAs. + +Issues That Allow Adjacencies but Prevent IP Routes +The last two issues to discuss in this section have a symptom in which the show ip ospf neighbor command does list a neighbor, but some other problem exists that prevents the eventual addition of OSPF routes to the routing table. The two issues: a mismatched MTU setting and a mismatched OSPF network type. + +Mismatched MTU Settings +The MTU size defines a per-interface setting used by the router for its Layer 3 forwarding logic, defining the largest network layer packet that the router will forward out each inter-face. For instance, the IPv4 MTU size of an interface defines the maximum size IPv4 packet that the router can forward out an interface. + +Routers often use a default MTU size of 1500 bytes, with the ability to set the value as well. The ip mtu size interface subcommand defines the IPv4 MTU setting, and the ipv6 mtu size command sets the equivalent for IPv6 packets. + +In an odd twist, two OSPFv2 routers can actually become OSPF neighbors, be listed in the output of the show ip ospf neighbor command, and reach 2-way state, even if they happen to use different IPv4 MTU settings on their interfaces. However, they fail to exchange their LSDBs. Eventually, after trying and failing to exchange their LSDBs, the neighbor relation-ship also fails. So also keep a watch for MTU mismatches, although they may be unusual and obscure, by looking at the running-config and by using the show interfaces command +(which lists the IP MTU). 21 + +Mismatched OSPF Network Types +Earlier in this chapter you read about the OSPF broadcast network type, which uses a DR/BDR, and the OSPF point-to-point network type, which does not. Interestingly, if you misconfigure network type settings such that one router uses broadcast, and the other uses point-to-point, the following occurs: + +■ The two routers become fully adjacent neighbors (that is, they reach a full state). ■ They exchange their LSDBs. +■ They do not add IP routes to the IP routing table. + +The reason for not adding the routes has to do with the details of LSAs and how the use of a DR (or not) changes those LSAs. Basically, the two routers expect different details in the +LSAs, and the SPF algorithm notices those differences and cannot trust the LSAs because of those differences. + +For instance, earlier in Example 21-7, the configuration showed router R1 using network type point-to-point on its G0/0/0 interface, with the expectation that router R2 would also use point-to-point on its matching G0/1/0 interface. Example 21-13 shows some of the results if the engineer neglected to configure R2, leaving it with the default setting of broadcast. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +516 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 21-13 Shutting Down an OSPF Process, and the Resulting Neighbor States + +*Apr 10 16:31:01.951: %OSPF-4-NET_TYPE_MISMATCH: Received Hello from 2.2.2.2 on GigabitEthernet0/0/0 indicating a potential network type mismatch +R1# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 +R1# + +Pri State +0 FULL/ - + +Dead Time +00:00:38 + +Address +10.1.12.2 + +Interface +GigabitEthernet0/0/0 + + +R2# show ip ospf neighbor + + +Neighbor ID +1.1.1.1 + +Pri State +1 FULL/BDR + +Dead Time +00:00:30 + +Address +10.1.12.1 + +Interface +GigabitEthernet0/1/0 + + + +As you can see, both routers list the other as an OSPF neighbor in the full state. However, R1, with network type point-to-point, does not list a DR or BDR role in the output, while R2 does, which is one clue for this type of problem. The other comes with noticing that the expected routes are not in the IP routing table. + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same mate-rial found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 21-5 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 21-5 Chapter Review Tracking + +Review Element Review key topics +Review command tables + +Review memory tables + +Watch video + +Review Date(s) Resource Used: Book, website +Book + +Website + +Website + + + +Review All the Key Topics + +Table 21-6 Key Topics for Chapter 21 + +Key Topic Element Table 21-2 +Example 21-3 + +List + +Example 21-8 + +Description +Two OSPF Network Types and Key Behaviors + +OSPF interfaces, local roles, and neighbor counts + +Rules for electing an OSPF DR/BDR + +Evidences of OSPF network type point-to-point + +Page Number 501 +503 + +505 + +508 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 21: OSPF Network Types and Neighbors 517 + + +Key Topic Element Table 21-3 +Table 21-4 + +List + +Description +Neighbor requirements for OSPF + +Useful commands to discover OSPF neighbor issues + +Symptoms of an OSPF network type mismatch + +Page Number 509 +510 + +515 + + + +Command References +Tables 21-7 and 21-8 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + +Table 21-7 +Command + + +Chapter 21 Configuration Command Reference +Description + + + +ip ospf hello-interval seconds + +ip ospf dead-interval number + +passive-interface type number + + +ip ospf priority value + +ip ospf network {broadcast | point-to-point} +[no] shutdown + +Interface subcommand that sets the interval for periodic Hellos + +Interface subcommand that sets the OSPF dead timer + +Router subcommand, for both OSPF and EIGRP, that tells the routing protocol to stop sending Hellos and stop trying to discover neighbors on that interface +Interface subcommand that sets the OSPF priority, used when electing a new DR or BDR +Interface subcommand used to set the OSPF network type 21 on the interface + +An OSPF configuration mode command to disable (shutdown) or enable (no shutdown) the OSPF process + + + +Table 21-8 +Command + +Chapter 21 show Command Reference +Description + + + +show ip protocols + + +show ip ospf interface brief + + +show ip ospf interface [type number] +show ip ospf neighbor + +show ip ospf + +show interfaces + +Shows routing protocol parameters and current timer values, including an effective copy of the routing protocols’ network commands and a list of passive interfaces +Lists the interfaces on which the OSPF protocol is enabled (based on the network commands), including passive interfaces +Lists detailed OSPF settings for all interfaces, or the listed interface, including Hello and dead timers and OSPF area + +Lists neighbors and current status with neighbors, per interface + +Lists a group of messages about the OSPF process itself, listing the OSPF Router ID in the first line +Lists a long set of messages, per interface, that lists configuration, state, and counter information + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part VI Review + +Keep track of your part review progress with the checklist in Table P6-1. Details about each task follow the table. + + +Table P6-1 + +Activity + +Part VI Part Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Do Labs + +Watch Videos + + +Repeat All DIKTA Questions +For this task, answer the “Do I Know This Already?” questions again for the chapters in this part of the book using the PTP software. See the section “How to View Only DIKTA Questions by Chapter or Part” in the Introduction to this book to learn how to make the PTP software show you DIKTA questions for this part only. + +Answer Part Review Questions +For this task, answer the Part Review questions for this part of the book using the PTP software. See the section “How to View Part Review Questions” in the Introduction to this book to learn how to make the PTP software show you Part Review questions for this part only. + +Review Key Topics +Review all Key Topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Do Labs +Depending on your chosen lab tool, here are some suggestions for what to do in lab: + +Pearson Network Simulator: If you use the full Pearson ICND1 or CCNA simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) + +Blog: Config Labs: The author’s blog includes a series of configuration-focused labs that you can do on paper, each in 10–15 minutes. Review and perform the labs for this part of the book, as found at http://blog.certskills.com. Then navigate to the Hands-on Config labs. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Other: If using other lab tools, here are a few suggestions: Make sure to experiment heav-ily with VLAN configuration and VLAN trunking configuration. + +Watch Videos +Chapter 21 recommends one video from the companion website about troubleshooting OSPF neighbors. Take a few minutes to watch the video if you haven’t done so already. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +So far, this book has mostly ignored IP version 6 (IPv6). This part reverses the trend, collect-ing all the specific IPv6 topics into four chapters. + +The chapters in Part VII walk you through the same topics discussed throughout this book for IPv4, often using IPv4 as a point of comparison. Certainly, many details differ when comparing IPv4 and IPv6. However, many core concepts about IP addressing, subnetting, routing, and routing protocols remain the same. The chapters in this part build on those foundational concepts, adding the specific details about how IPv6 forwards IPv6 packets from one host to another. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part VII + + +IP Version 6 + + + + +Chapter 22: Fundamentals of IP Version 6 + +Chapter 23: IPv6 Addressing and Subnetting + +Chapter 24: Implementing IPv6 Addressing on Routers + +Chapter 25: Implementing IPv6 Routing + +Part VII Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 22 + + +Fundamentals of IP Version 6 This chapter covers the following exam topics: +1.0 Network Fundamentals +1.8 Configure and verify IPv6 addressing and prefix + +IPv4 has been a solid and highly useful part of the growth of TCP/IP and the Internet. For most of the long history of the Internet, and for most corporate networks that use TCP/IP, IPv4 is the core protocol that defines addressing and routing. However, even though IPv4 has many great qualities, it does have some shortcomings, creating the need for a replacement protocol: IP version 6 (IPv6). + +IPv6 defines the same general functions as IPv4, but with different methods of implementing those functions. For example, both IPv4 and IPv6 define addressing, the concepts of subnet-ting larger groups of addresses into smaller groups, headers used to create an IPv4 or IPv6 packet, and the rules for routing those packets. At the same time, IPv6 handles the details differently; for example, using a 128-bit IPv6 address rather than the 32-bit IPv4 address. + +This chapter focuses on the core network layer functions of addressing and routing. The first section of this chapter looks at the big concepts, while the second section looks at the spe-cifics of how to write and type IPv6 addresses. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 22-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Introduction to IPv6 +IPv6 Addressing Formats and Conventions + +Questions 1–2 +3–6 + + + +1. Which of the following was a short-term solution to the IPv4 address exhaustion problem? +a. IP version 6 b. IP version 5 c. NAT/PAT +d. ARP + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +2. A router receives an Ethernet frame that holds an IPv6 packet. The router then makes a decision to route the packet out a serial link. Which of the following statements is true about how a router forwards an IPv6 packet? +a. The router discards the Ethernet data-link header and trailer of the received frame. +b. The router makes the forwarding decision based on the packet’s source IPv6 address. +c. The router keeps the Ethernet header, encapsulating the entire frame inside a new IPv6 packet before sending it over the serial link. +d. The router uses the IPv4 routing table when choosing where to forward the packet. + +3. Which of the following is the shortest valid abbreviation for FE80:0000:0000:0100: 0000:0000:0000:0123? +a. FE80::100::123 b. FE8::1::123 +c. FE80::100:0:0:0:123:4567 d. FE80:0:0:100::123 +4. Which of the following is the shortest valid abbreviation for 2000:0300:0040:0005: 6000:0700:0080:0009? +a. 2:3:4:5:6:7:8:9 +b. 2000:300:40:5:6000:700:80:9 c. 2000:300:4:5:6000:700:8:9 d. 2000:3:4:5:6:7:8:9 +5. Which of the following is the unabbreviated version of IPv6 address 2001:DB8::200:28? +a. 2001:0DB8:0000:0000:0000:0000:0200:0028 b. 2001:0DB8::0200:0028 +c. 2001:0DB8:0:0:0:0:0200:0028 +d. 2001:0DB8:0000:0000:0000:0000:200:0028 + +6. Which of the following is the prefix for address 2000:0000:0000:0005:6000:0700: 0080:0009, assuming a mask of /64? + +a. 2000::5::/64 +b. 2000::5:0:0:0:0/64 c. 2000:0:0:5::/64 +d. 2000:0:0:5:0:0:0:0/64 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +524 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Introduction to IPv6 +IP version 6 (IPv6) serves as the replacement protocol for IP version 4 (IPv4). + +Unfortunately, that one bold statement creates more questions than it answers. Why does IPv4 need to be replaced? If IPv4 needs to be replaced, when will that happen—and will it happen quickly? What exactly happens when a company or the Internet replaces IPv4 with IPv6? And the list goes on. + +While this introductory chapter cannot get into every detail of why IPv4 needs to eventually be replaced by IPv6, the clearest and most obvious reason for migrating TCP/IP networks +to use IPv6 is growth. IPv4 uses a 32-bit address, which totals to a few billion addresses. Interestingly, that seemingly large number of addresses is too small. IPv6 increases the address to 128 bits in length. For perspective, IPv6 supplies more than 10,000,000,000,000,000,000,000,000,000 times as many addresses as IPv4. + +The fact that IPv6 uses a different size address field, with some different addressing rules, means that many other protocols and functions change as well. For example, IPv4 routing—in other words, the packet-forwarding process—relies on an understanding of IPv4 addresses. To support IPv6 routing, routers must understand IPv6 addresses and routing. To dynamically learn routes for IPv6 subnets, routing protocols must support these different IPv6 addressing rules, including rules about how IPv6 creates subnets. As a result, the migration from IPv4 to IPv6 is much more than changing one protocol (IP), but it impacts many protocols. + +This first section of the chapter discusses some of the reasons for the change from IPv4 to IPv6, along with the protocols that must change as a result. + +The Historical Reasons for IPv6 +In the last 40+ years, the Internet has gone from its infancy to being a huge influence in the world. It first grew through research at universities, from the ARPANET beginnings of the Internet in the late 1960s into the 1970s. The Internet kept growing fast in the 1980s, with the Internet’s fast growth still primarily driven by research and the universities that joined in that research. By the early 1990s, the Internet began to transform to allow commerce, allowing people to sell services and products over the Internet, which drove yet another +steep spike upward in the growth of the Internet. Eventually, fixed Internet access (primarily through dial, digital subscriber line [DSL], and cable) became common, followed by the per-vasive use of the Internet from mobile devices like smartphones. Figure 22-1 shows some of these major milestones with general dates. + +The incredible growth of the Internet over a fairly long time created a big problem for public IPv4 addresses: the world was running out of addresses. For instance, in 2011, IANA allo-cated the final /8 address blocks (the same size as a Class A network), allocating one final +/8 block to each of the five Regional Internet Registries (RIR). At that point, RIRs could no + + + +Answers to the “Do I Know This Already?” quiz: 1 C 2 A 3 D 4 B 5 A 6 C + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 22: Fundamentals of IP Version 6 525 + +longer receive new allocations of public addresses from IANA to then turn around and assign smaller address blocks to companies or ISPs. + + + +ARPANET Begins + + +1970 + + +Universities, Research + + +1980 + + +Commerce (.com) + + +1990 + +Pervasive Fixed Internet + + +2000 + +Pervasive Mobile Internet + + +2010 2020 + + +Figure 22-1 Some Major Events in the Growth of the Internet + +At that point in 2011, each of the five RIRs still had public addresses to allocate or assign. However, that same year, APNIC (Asia Pacific) became the first RIR to exhaust its available IPv4 address allocation. In late 2015, ARIN (North America) announced that it had exhaust-ed its supply. When we were revising this chapter in 2019, IANA considered all RIRs except AFRINIC to have exhausted their supply of IPv4 addresses, with AFRINIC expected to run out of IPv4 address during the year 2019. + +These events are significant in that the day has finally come in which new companies can attempt to connect to the Internet, but they can no longer simply use IPv4, ignoring IPv6. Their only option will be IPv6 because IPv4 has no public addresses left. + +NOTE You can track ARIN’s progress through this interesting transition in the history of the Internet at its IPv4 address depletion site: http://teamarin.net/category/ipv4-depletion/. You can also see a summary report at http://ipv4.potaroo.net. + + +Even though the press has rightfully made a big deal about running out of IPv4 addresses, those who care about the Internet knew about this potential problem since the late 1980s. The problem, generally called the IPv4 address exhaustion problem, could literally have caused the huge growth of the Internet in the 1990s to have come to a screeching halt! Something had to be done. + +The IETF came up with several short-term solutions to make IPv4 addresses last longer, and one long-term solution: IPv6. However, several other tools like Network Address Translation (NAT) and classless interdomain routing (CIDR) helped extend IPv4’s life another couple of decades. IPv6 creates a more permanent and long-lasting solution, replacing IPv4, with a new IPv6 header and new IPv6 addresses. The address size supports a huge number of addresses, solving the address shortage problem for generations (we hope). Figure 22-2 shows some of the major address exhaustion timing. + +The rest of this first section examines IPv6, comparing it to IPv4, focusing on the common features of the two protocols. In particular, this section compares the protocols (including +addresses), routing, routing protocols, and miscellaneous other related topics. + + + +22 + + + +NOTE You might wonder why the next version of IP is not called IP version 5. There was an earlier effort to create a new version of IP, and it was numbered version 5. IPv5 did not progress to the standards stage. However, to prevent any issues, because version 5 had been used in some documents, the next effort to update IP was numbered as version 6. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +526 CCNA 200-301 Official Cert Guide, Volume 1 + + + +Short Term: NAT, CIDR + + +ARIN Allocates Final IPv4 Block + + + +IPv4 Concerns RFC of IPv4 +791 Address Exhaustion + +IPv6 NAT, CIDR, RFCs Defer Need +for IPv6 + + +IANA Allocates Final /8 Block + + +IPv6 Replaces IPv4 + + + +1980 1990 2000 2010 2015 ??? + +Figure 22-2 Timeline for IPv4 Address Exhaustion and Short-/Long-Term Solutions + +The IPv6 Protocols +The primary purpose of the core IPv6 protocol mirrors the same purpose of the IPv4 pro-tocol. That core IPv6 protocol, as defined in RFC 2460, defines a packet concept, addresses for those packets, and the role of hosts and routers. These rules allow the devices to forward packets sourced by hosts, through multiple routers, so that they arrive at the correct destina-tion host. (IPv4 defines those same concepts for IPv4 back in RFC 791.) + +However, because IPv6 impacts so many other functions in a TCP/IP network, many more RFCs must define details of IPv6. Some other RFCs define how to migrate from IPv4 to IPv6. Others define new versions of familiar protocols or replace old protocols with new ones. For example: + +Older OSPF Version 2 Upgraded to OSPF Version 3: The older Open Shortest Path First (OSPF) version 2 works for IPv4, but not for IPv6, so a newer version, OSPF version 3, was created to support IPv6. (Note: OSPFv3 was later upgraded to support advertising both IPv4 and IPv6 routes.) +ICMP Upgraded to ICMP Version 6: Internet Control Message Protocol (ICMP) worked well with IPv4 but needed to be changed to support IPv6. The new name is ICMPv6. +ARP Replaced by Neighbor Discovery Protocol: For IPv4, Address Resolution Protocol (ARP) discovers the MAC address used by neighbors. IPv6 replaces ARP with a more gen-eral Neighbor Discovery Protocol (NDP). + +NOTE If you go to any website that lists the RFCs, like http://www.rfc-editor.org, you can find almost 300 RFCs that have IPv6 in the title. + +Although the term IPv6, when used broadly, includes many protocols, the one specific pro-tocol called IPv6 defines the new 128-bit IPv6 address. Of course, writing these addresses in binary would be a problem—they probably would not even fit on the width of a piece of paper! IPv6 defines a shorter hexadecimal format, requiring at most 32 hexadecimal digits (one hex digit per 4 bits), with methods to abbreviate the hexadecimal addresses as well. + +For example, all of the following are IPv6 addresses, each with 32 or fewer hex digits: + +2345:1111:2222:3333:4444:5555:6666:AAAA 2000:1:2:3:4:5:6:A +FE80::1 + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 22: Fundamentals of IP Version 6 527 + +The upcoming section “IPv6 Addressing Formats and Conventions” discusses the specifics of how to represent IPv6 addresses, including how to legally abbreviate the hex address values. + +Like IPv4, IPv6 defines a header, with places to hold both the source and destination address fields. Compared to IPv4, the IPv6 header does make some other changes besides simply making the address fields larger. However, even though the IPv6 header is larger than an IPv4 header, the IPv6 header is actually simpler (on purpose), to reduce the work done each time a router must route an IPv6 packet. Figure 22-3 shows the required 40-byte part of the IPv6 header. + +4 Bytes + +Version Class Flow Label +Payload Length Next Header Hop Limit + +Source Address +(16 Bytes) 40 Bytes + + +Destination Address (16 Bytes) + + +Figure 22-3 IPv6 Header + + +IPv6 Routing +As with many functions of IPv6, IPv6 routing looks just like IPv4 routing from a general perspective, with the differences being clear only once you look at the specifics. Keeping the discussion general for now, IPv6 uses these ideas the same way as IPv4: + +■ To be able to build and send IPv6 packets out an interface, end-user devices need an IPv6 address on that interface. +■ End-user hosts need to know the IPv6 address of a default router, to which the host sends IPv6 packets if the host is in a different subnet. +■ IPv6 routers de-encapsulate and re-encapsulate each IPv6 packet when routing the packet. +■ IPv6 routers make routing decisions by comparing the IPv6 packet’s destination address to the router’s IPv6 routing table; the matched route lists directions of where to send the +IPv6 packet next. + + + + +22 + + + +NOTE You could take the preceding list and replace every instance of IPv6 with IPv4, and all the statements would be true of IPv4 as well. + +While the list shows some concepts that should be familiar from IPv4, the next few figures show the concepts with an example. First, Figure 22-4 shows a few settings on a host. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +528 CCNA 200-301 Official Cert Guide, Volume 1 + +The host (PC1) has an address of 2345::1. PC1 also knows its default gateway of 2345::2. (Both values are valid abbreviations for real IPv6 addresses.) To send an IPv6 packet to host PC2, on another IPv6 subnet, PC1 creates an IPv6 packet and sends it to R1, PC1’s default gateway. + +– Encapsulate IPv6 Packet – Send to Default Gateway +Subnet 2345:1:2:3::/64 + + +PC1 + + +Address = 2345::1 GW = 2345::2 + + +R1 + +2345::2 + +PC2 R2 + +2345:1:2:3::2 + + +Eth. IPv6 Packet Eth. + +Figure 22-4 IPv6 Host Building and Sending an IPv6 Packet + +The router (R1) has many small tasks to do when forwarding this IPv6 packet, but for now, focus on the work R1 does related to encapsulation. As seen in Step 1 of Figure 22-5, R1 receives the incoming data-link frame and extracts (de-encapsulates) the IPv6 packet from inside the frame, discarding the original data-link header and trailer. At Step 2, once R1 knows to forward the IPv6 packet to R2, R1 adds a correct outgoing data-link header and trailer to the IPv6 packet, encapsulating the IPv6 packet. + +1 2 + + +De-encapsulate IPv6 Packet + +Re-encapsulate +IPv6 Packet +Subnet 2345:1:2:3::/64 + + +PC1 PC2 R1 R2 +1 2 IPv6 Packet + + +Eth. IPv6 Packet Eth. HDLC IPv6 Packet HDLC + +Figure 22-5 IPv6 Router Performing Routine Encapsulation Tasks When Routing IPv6 + +When a router like R1 de-encapsulates the packet from the data-link frame, it must also decide what type of packet sits inside the frame. To do so, the router must look at a protocol type field in the data-link header, which identifies the type of packet inside the data-link frame. Today, most data-link frames carry either an IPv4 packet or an IPv6 packet. + +To route an IPv6 packet, a router must use its IPv6 routing table instead of the IPv4 rout-ing table. The router must look at the packet’s destination IPv6 address and compare that +address to the router’s current IPv6 routing table. The router uses the forwarding instructions in the matched IPv6 route to forward the IPv6 packet. Figure 22-6 shows the overall process. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 22: Fundamentals of IP Version 6 529 + +Subnet 2345:1:2:3::/64 + +PC1 S0/0/0 PC2 R1 R2 +IPv6 Packet +R1 IPv6 Routing Table +IPv6 Prefix Output Interface Next-Router + + +Destination IPv6 Address + +2345:1:2:3::/64 S0/0/0 R2 + +• +• + + +Figure 22-6 Comparing an IPv6 Packet to R1’s IPv6 Routing Table + +Note that again, the process works like IPv4, except that the IPv6 packet lists IPv6 address-es, and the IPv6 routing table lists routing information for IPv6 subnets (called prefixes). + +Finally, in most enterprise networks, the routers will route both IPv4 and IPv6 packets at the same time. That is, your company will not decide to adopt IPv6, and then late one week-end night turn off all IPv4 and enable IPv6 on every device. Instead, IPv6 allows for a slow +migration, during which some or all routers forward both IPv4 and IPv6 packets. (The migra-tion strategy of running both IPv4 and IPv6 is called dual stack.) All you have to do is con-figure the router to route IPv6 packets, in addition to the existing configuration for routing IPv4 packets. + + +IPv6 Routing Protocols +IPv6 routers need to learn routes for all the possible IPv6 prefixes (subnets). Just like with IPv4, IPv6 routers use routing protocols, with familiar names, and generally speaking, with familiar functions. + +None of the IPv4 routing protocols could be used to advertise IPv6 routes originally. They all required some kind of update to add messages, protocols, and rules to support IPv6. Over time, Routing Information Protocol (RIP), Open Shortest Path First (OSPF), Enhanced Interior Gateway Routing Protocol (EIGRP), and Border Gateway Protocol (BGP) were all updated to support IPv6. Table 22-2 lists the names of these routing protocols, with a few +comments. + + + + + + +22 + + +Table 22-2 IPv6 Routing Protocols + +Routing Protocol +RIPng (RIP next generation) + +OSPFv3 (OSPF version 3) +EIGRPv6 (EIGRP for IPv6) +MP BGP-4 (Multiprotocol BGP version 4) + +Defined By RFC + +RFC + +Cisco + +RFC + +Notes +The “next generation” is a reference to a TV series, Star Trek: the Next Generation. +The OSPF you have worked with for IPv4 is actually OSPF version 2, so the new version for IPv6 is OSPFv3. +Cisco owns the rights to the EIGRP protocol, but Cisco also now publishes EIGRP as an informational RFC. +BGP version 4 was created to be highly extendable; IPv6 support was added to BGP version 4 through one such enhancement, MP BGP-4. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +530 CCNA 200-301 Official Cert Guide, Volume 1 + +In addition, these routing protocols also follow the same interior gateway protocol (IGP) and exterior gateway protocol (EGP) conventions as their IPv4 cousins. RIPng, EIGRPv6, and OSPFv3 act as interior gateway protocols, advertising IPv6 routes inside an enterprise. + +As you can see from this introduction, IPv6 uses many of the same big ideas as IPv4. Both define headers with a source and destination address. Both define the routing of packets, with the routing process discarding old data-link headers and trailers when forwarding the packets. And routers use the same general process to make a routing decision, comparing the packet’s destination IP address to the routing table. + +The big differences between IPv4 and IPv6 revolve around the bigger IPv6 addresses. The next topic begins looking at the specifics of these IPv6 addresses. + +IPv6 Addressing Formats and Conventions +The CCNA exam requires some fundamental skills in working with IPv4 addresses. For example, you need to be able to interpret IPv4 addresses, like 172.21.73.14. You need to be able to work with prefix-style masks, like /25, and interpret what that means when used with a particular IPv4 address. And you need to be able to take an address and mask, like 172.21.73.14/25, and find the subnet ID. + +This second major section of this chapter discusses these same ideas for IPv6 addresses. In particular, this section looks at + +■ How to write and interpret unabbreviated 32-digit IPv6 addresses +■ How to abbreviate IPv6 addresses and how to interpret abbreviated addresses ■ How to interpret the IPv6 prefix length mask +■ How to find the IPv6 prefix (subnet ID), based on an address and prefix length mask + +The biggest challenge with these tasks lies in the sheer size of the numbers. Thankfully, the math to find the subnet ID—often a challenge for IPv4—is easier for IPv6, at least to the depth discussed in this book. + +Representing Full (Unabbreviated) IPv6 Addresses +IPv6 uses a convenient hexadecimal (hex) format for addresses. To make it more readable, IPv6 uses a format with eight sets of four hex digits, with each set of four digits separated by a colon. For example: +2340:1111:AAAA:0001:1234:5678:9ABC:1234 + + +NOTE For convenience, the author uses the term quartet for one set of four hex digits, with eight quartets in each IPv6 address. Note that the IPv6 RFCs do not use the term quartet. + +IPv6 addresses also have a binary format as well, but thankfully, most of the time you do not need to look at the binary version of the addresses. However, in those cases, converting from hex to binary is relatively easy. Just change each hex digit to the equivalent 4-bit value listed in Table 22-3. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 22: Fundamentals of IP Version 6 531 + +Table 22-3 Hexadecimal/Binary Conversion Chart + +Hex Binary 0 0000 +1 0001 + +2 0010 + +3 0011 + +4 0100 + +5 0101 + +6 0110 + +7 0111 + +Hex Binary 8 1000 +9 1001 + +A 1010 + +B 1011 + +C 1100 + +D 1101 + +E 1110 + +F 1111 + + + +Abbreviating and Expanding IPv6 Addresses +IPv6 also defines ways to abbreviate or shorten how you write or type an IPv6 address. Why? Although using a 32-digit hex number works much better than working with a 128-bit binary number, 32 hex digits are still a lot of digits to remember, recognize in command out-put, and type on a command line. The IPv6 address abbreviation rules let you shorten these numbers. + +Computers and routers typically use the shortest abbreviation, even if you type all 32 hex digits of the address. So even if you would prefer to use the longer unabbreviated version of the IPv6 address, you need to be ready to interpret the meaning of an abbreviated IPv6 address as listed by a router or host. This section first looks at abbreviating addresses and then at expanding addresses. + +Abbreviating IPv6 Addresses 22 Two basic rules let you, or any computer, shorten or abbreviate an IPv6 address: +1. Inside each quartet of four hex digits, remove the leading 0s (0s on the left side of the quartet) in the three positions on the left. (Note: at this step, a quartet of 0000 will leave a single 0.) +2. Find any string of two or more consecutive quartets of all hex 0s, and replace that set of quartets with a double colon (::). The :: means “two or more quartets of all 0s.” However, you can use :: only once in a single address because otherwise the exact IPv6 might not be clear. + +For example, consider the following IPv6 address. The bold digits represent digits in which the address could be abbreviated. +FE00:0000:0000:0001:0000:0000:0000:0056 + +Applying the first rule, you would look at all eight quartets independently. In each, remove all the leading 0s. Note that five of the quartets have four 0s, so for these, remove only three 0s, leaving the following value: +FE00:0:0:1:0:0:0:56 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +532 CCNA 200-301 Official Cert Guide, Volume 1 + +While this abbreviation is valid, the address can be abbreviated more, using the second rule. In this case, two instances exist where more than one quartet in a row has only a 0. Pick the longest such sequence, and replace it with ::, giving you the shortest legal abbreviation: +FE00:0:0:1::56 + +While FE00:0:0:1::56 is indeed the shortest abbreviation, this example happens to make it easier to see the two most common mistakes when abbreviating IPv6 addresses. First, never remove trailing 0s in a quartet (0s on the right side of the quartet). In this case, the first quar-tet of FE00 cannot be shortened at all because the two 0s trail. So, the following address, which begins now with only FE in the first quartet, is not a correct abbreviation of the origi-nal IPv6 address: +FE:0:0:1::56 + +The second common mistake is to replace all series of all 0 quartets with a double colon. For example, the following abbreviation would be incorrect for the original IPv6 address listed in this topic: +FE00::1::56 + +The reason this abbreviation is incorrect is that now you do not know how many quartets of all 0s to substitute into each :: to find the original unabbreviated address. + +Expanding Abbreviated IPv6 Addresses +To expand an IPv6 address back into its full unabbreviated 32-digit number, use two similar rules. The rules basically reverse the logic of the previous two rules: +1. In each quartet, add leading 0s as needed until the quartet has four hex digits. +2. If a double colon (::) exists, count the quartets currently shown; the total should be less than 8. Replace the :: with multiple quartets of 0000 so that eight total quartets exist. + +The best way to get comfortable with these addresses and abbreviations is to do some your-self. Table 22-4 lists some practice problems, with the full 32-digit IPv6 address on the left and the best abbreviation on the right. The table gives you either the expanded or abbrevi-ated address, and you need to supply the opposite value. The answers sit at the end of the chapter, in the section “Answers to Earlier Practice Problems.” + + +Table 22-4 +Full + + +IPv6 Address Abbreviation and Expansion Practice +Abbreviation + +2340:0000:0010:0100:1000:ABCD:0101:1010 + +30A0:ABCD:EF12:3456:ABC:B0B0:9999:9009 + +2222:3333:4444:5555:0000:0000:6060:0707 + +3210:: + +210F:0000:0000:0000:CCCC:0000:0000:000D + +34BA:B:B::20 + +FE80:0000:0000:0000:DEAD:BEFF:FEEF:CAFE + +FE80::FACE:BAFF:FEBE:CAFE + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 22: Fundamentals of IP Version 6 533 + +Representing the Prefix Length of an Address +IPv6 uses a mask concept, called the prefix length, similar to IPv4 subnet masks. Similar to the IPv4 prefix-style mask, the IPv6 prefix length is written as a /, followed by a decimal +number. The prefix length defines how many bits of the IPv6 address define the IPv6 prefix, which is basically the same concept as the IPv4 subnet ID. + +When writing an IPv6 address and prefix length in documentation, you can choose to leave a space before the /, or not, as shown in the next two examples. + +2222:1111:0:1:A:B:C:D/64 2222:1111:0:1:A:B:C:D /64 + +Finally, note that the prefix length is a number of bits, so with IPv6, the legal value range is from 0 through 128, inclusive. + +Calculating the IPv6 Prefix (Subnet ID) +With IPv4, you can take an IP address and the associated subnet mask, and calculate the subnet ID. With IPv6 subnetting, you can take an IPv6 address and the associated prefix length, and calculate the IPv6 equivalent of the subnet ID: an IPv6 prefix. + +Like with different IPv4 subnet masks, some IPv6 prefix lengths make for an easy math prob-lem to find the IPv6 prefix, while some prefix lengths make the math more difficult. This section looks at the easier cases, mainly because the size of the IPv6 address space lets us all choose to use IPv6 prefix lengths that make the math much easier. + +Finding the IPv6 Prefix +In IPv6, a prefix represents a group of IPv6 addresses. For now, this section focuses on the math, and only the math, for finding the number that represents that prefix. Chapter +23, “IPv6 Addressing and Subnetting,” then starts putting more meaning behind the actual +numbers. 22 + +Each IPv6 prefix, or subnet if you prefer, has a number that represents the group. Per the IPv6 RFCs, the number itself is also called the prefix, but many people just call it a subnet number or subnet ID, using the same terms as IPv4. + +As with IPv4, you can start with an IPv6 address and prefix length, and find the prefix, with the same general rules that you use in IPv4. If the prefix length is /P, use these rules: +1. Copy the first P bits. +2. Change the rest of the bits to 0. + +When using a prefix length that happens to be a multiple of 4, you do not have to think in terms of bits, but in terms of hex digits. A prefix length that is a multiple of 4 means that each hex digit is either copied or changed to hex 0. Just for completeness, if the prefix length is indeed a multiple of 4, the process becomes +1. Identify the number of hex digits in the prefix by dividing the prefix length (which is in bits) by 4. +2. Copy the hex digits determined to be in the prefix per the first step. 3. Change the rest of the hex digits to 0. + +|||||||||||||||||||| +|||||||||||||||||||| + + +534 CCNA 200-301 Official Cert Guide, Volume 1 + +Figure 22-7 shows an example, with a prefix length of 64. In this case, Step 1 looks at the /64 prefix length and calculates that the prefix has 16 hex digits. Step 2 copies the first 16 digits of the IPv6 address, while Step 3 records hex 0s for the rest of the digits. + + + +/64 +64 Bits 16 Digits + +1 +PPPP PPPP PPPP PPPP HHHH HHHH HHHH HHHH + +2001:0DB8:AAAA:0002:1234:5678:9ABC:EF01 + +2 Prefix: Copy 3 Host: Set to 0 + +ID 2001:0DB8:AAAA:0002:0000:0000:0000:0000 + + +Legend: + +ID Subnet ID + +Figure 22-7 Creating the IPv6 Prefix from an Address/Length + +After you find the IPv6 prefix, you should also be ready to abbreviate the IPv6 prefix using the same rules you use to abbreviate IPv6 addresses. However, you should pay extra atten-tion to the end of the prefix because it often has several octets of all 0 values. As a result, the abbreviation typically ends with two colons (::). + +For example, consider the following IPv6 address that is assigned to a host on a LAN: + +2000:1234:5678:9ABC:1234:5678:9ABC:1111/64 + +This example shows an IPv6 address that itself cannot be abbreviated. After you calculate the prefix for the subnet in which the address resides, by zeroing out the last 64 bits (16 dig-its) of the address, you find the following prefix value: +2000:1234:5678:9ABC:0000:0000:0000:0000/64 + +This value can be abbreviated, with four quartets of all 0s at the end, as follows: + +2000:1234:5678:9ABC::/64 + +To get better at the math, take some time to work through finding the prefix for several prac-tice problems, as listed in Table 22-5. The answers sit at the end of the chapter, in the section “Answers to Earlier Practice Problems.” + +Table 22-5 Finding the IPv6 Prefix from an Address/Length Value Address/Length Prefix +2340:0:10:100:1000:ABCD:101:1010/64 + +30A0:ABCD:EF12:3456:ABC:B0B0:9999:9009/64 + +2222:3333:4444:5555::6060:707/64 + +3210::ABCD:101:1010/64 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 22: Fundamentals of IP Version 6 535 + +Address/Length Prefix + +210F::CCCC:B0B0:9999:9009/64 + +34BA:B:B:0:5555:0:6060:707/64 + +3124::DEAD:CAFE:FF:FE00:1/64 + +2BCD::FACE:BEFF:FEBE:CAFE/64 + + +Working with More-Difficult IPv6 Prefix Lengths +Some prefix lengths make the math to find the prefix very easy, some mostly easy, and some require you to work in binary. If the prefix length is a multiple of 16, the process of copying part of the address copies entire quartets. If the prefix length is not a multiple of 16 but is a multiple of 4, at least the boundary sits at the edge of a hex digit, so you can avoid working in binary. + +Although the /64 prefix length is by far the most common prefix length, you should be ready to find the prefix when using a prefix length that is any multiple of 4. For example, consider the following IPv6 address and prefix length: +2000:1234:5678:9ABC:1234:5678:9ABC:1111/56 + +Because this example uses a /56 prefix length, the prefix includes the first 56 bits, or first 14 complete hex digits, of the address. The rest of the hex digits will be 0, resulting in the fol-lowing prefix: +2000:1234:5678:9A00:0000:0000:0000:0000/56 + +This value can be abbreviated, with four quartets of all 0s at the end, as follows: + +2000:1234:5678:9A00::/56 22 + +This example shows an easy place to make a mistake. Sometimes, people look at the /56 and think of that as the first 14 hex digits, which is correct. However, they then copy the first 14 hex digits and add a double colon, showing the following: +2000:1234:5678:9A::/56 + +This abbreviation is not correct because it removed the trailing “00” at the end of the fourth quartet. If you expanded the abbreviated value, it would begin with 2000:1234:5678:009A, not 2000:1234:5678:9A00. So, be careful when abbreviating when the boundary is not at the edge of a quartet. + +Once again, some extra practice can help. Table 22-6 uses examples that have a prefix length that is a multiple of 4, but is not on a quartet boundary, just to get some extra practice. The answers sit at the end of the chapter, in the section “Answers to Earlier Practice Problems.” + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +536 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 22-6 Finding the IPv6 Prefix from an Address/Length Value Address/Length Prefix +34BA:B:B:0:5555:0:6060:707/80 + +3124::DEAD:CAFE:FF:FE00:1/80 + +2BCD::FACE:BEFF:FEBE:CAFE/48 + +3FED:F:E0:D00:FACE:BAFF:FE00:0/48 + +210F:A:B:C:CCCC:B0B0:9999:9009/40 + +34BA:B:B:0:5555:0:6060:707/36 + +3124::DEAD:CAFE:FF:FE00:1/60 + +2BCD::FACE:1:BEFF:FEBE:CAFE/56 + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same mate-rial found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 22-7 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 22-7 Chapter Review Tracking + +Review Element Review key topics +Review key terms + +Repeat DIKTA questions + +Review command tables + +Review memory table + +Review Date(s) Resource Used Book, website +Book, website + +Book, PTP + +Book + +Book, website + + + +Review All the Key Topics + +Table 22-8 Key Topics for Chapter 22 + +Key Topic Element +List + +List + +List + +List + +Description Page Number +Similarities between IPv4 and IPv6 527 + +Rules for abbreviating IPv6 addresses 531 + +Rules for expanding an abbreviated IPv6 address 532 + +Process steps to find an IPv6 prefix, based on the IPv6 address and 533 prefix length + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 22: Fundamentals of IP Version 6 537 + +Key Terms You Should Know +IPv4 address exhaustion, IP version 6 (IPv6), OSPF version 3 (OSPFv3), EIGRP version 6 (EIGRPv6), prefix, prefix length, quartet + +Additional Practice for This Chapter’s Processes +For additional practice with IPv6 abbreviations, you may do the same set of practice prob-lems based on Appendix G, “Practice for Chapter 22: Fundamentals of IP Version 6.” You have two options to use: + +PDF: Navigate to the companion website and open the PDF for Appendix G. Application: Navigate to the companion website and use these applications: +“Practice Exercise: Abbreviating and Expanding Addresses” “Practice Exercise: Calculating the IPv6 Prefix” +“Practice Exercise: Calculating the IPv6 Prefix Round 2” + +Answers to Earlier Practice Problems +This chapter includes practice problems spread around different locations in the chapter. The answers are located in Tables 22-9, 22-10, and 22-11. + + +Table 22-9 +Full + +Answers to Questions in the Earlier Table 22-4 +Abbreviation + + + +2340:0000:0010:0100:1000:ABCD:0101:1010 + +30A0:ABCD:EF12:3456:0ABC:B0B0:9999:9009 + +2222:3333:4444:5555:0000:0000:6060:0707 + +3210:0000:0000:0000:0000:0000:0000:0000 + +210F:0000:0000:0000:CCCC:0000:0000:000D + +34BA:000B:000B:0000:0000:0000:0000:0020 + +FE80:0000:0000:0000:DEAD:BEFF:FEEF:CAFE + +FE80:0000:0000:0000:FACE:BAFF:FEBE:CAFE + +2340:0:10:100:1000:ABCD:101:1010 + +30A0:ABCD:EF12:3456:ABC:B0B0:9999:9009 + +2222:3333:4444:5555::6060:707 + +3210:: +210F::CCCC:0:0:D 22 34BA:B:B::20 +FE80::DEAD:BEFF:FEEF:CAFE + +FE80::FACE:BAFF:FEBE:CAFE + + + +Table 22-10 Answers to Questions in the Earlier Table 22-5 + +Address/Length 2340:0:10:100:1000:ABCD:101:1010/64 +30A0:ABCD:EF12:3456:ABC:B0B0:9999:9009/64 + +2222:3333:4444:5555::6060:707/64 + +3210::ABCD:101:1010/64 + +210F::CCCC:B0B0:9999:9009/64 + +34BA:B:B:0:5555:0:6060:707/64 + +3124::DEAD:CAFE:FF:FE00:1/64 + +2BCD::FACE:BEFF:FEBE:CAFE/64 + +Prefix 2340:0:10:100::/64 +30A0:ABCD:EF12:3456::/64 + +2222:3333:4444:5555::/64 + +3210::/64 + +210F::/64 + +34BA:B:B::/64 + +3124:0:0:DEAD::/64 + +2BCD::/64 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +538 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 22-11 Answers to Questions in the Earlier Table 22-6 + +Address/Length 34BA:B:B:0:5555:0:6060:707/80 +3124::DEAD:CAFE:FF:FE00:1/80 + +2BCD::FACE:BEFF:FEBE:CAFE/48 + +3FED:F:E0:D00:FACE:BAFF:FE00:0/48 + +210F:A:B:C:CCCC:B0B0:9999:9009/40 + +34BA:B:B:0:5555:0:6060:707/36 + +3124::DEAD:CAFE:FF:FE00:1/60 + +2BCD::FACE:1:BEFF:FEBE:CAFE/56 + +Prefix 34BA:B:B:0:5555::/80 +3124:0:0:DEAD:CAFE::/80 + +2BCD::/48 + +3FED:F:E0::/48 + +210F:A::/40 + +34BA:B::/36 + +3124:0:0:DEA0::/60 + +2BCD:0:0:FA00::/56 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 23 + + +IPv6 Addressing and Subnetting This chapter covers the following exam topics: +1.0 Network Fundamentals +1.8 Configure and verify IPv6 addressing and prefix + +1.9 Compare and contrast IPv6 address types + +1.9.a Global unicast + +1.9.b Unique local + +IPv4 organizes the address space in a couple of ways. First, IPv4 splits addresses by class, with Classes A, B, and C defining unicast IPv4 addresses. (The term unicast refers to the fact that each address is used by only one interface.) Then, within the Class A, B, and C address range, the Internet Assigned Numbers Authority (IANA) and the Internet Corporation +for Assigned Names and Numbers (ICANN) reserve most of the addresses as public IPv4 addresses, with a few reserved as private IPv4 addresses. + +IPv6 does not use any concept like the classful network concept used by IPv4. However, IANA does still reserve some IPv6 address ranges for specific purposes, even with some address ranges that serve as both public IPv6 addresses and private IPv6 addresses. IANA also attempts to take a practical approach to reserving ranges of the entire IPv6 address space for different purposes, using the wisdom gained from several decades of fast growth in the IPv4 Internet. + +This chapter has two major sections. The first examines global unicast addresses, which serve as public IPv6 addresses. The second major section looks at unique local addresses, which serve as private IPv6 addresses. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 23-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Global Unicast Addressing Concepts + +Unique Local Unicast Addresses + +Questions 1–4 +5 + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + +1. Which of the following IPv6 addresses appears to be a unique local unicast address, based on its first few hex digits? +a. 3123:1:3:5::1 +b. FE80::1234:56FF:FE78:9ABC c. FDAD::1 +d. FF00::5 + +2. Which of the following IPv6 addresses appears to be a global unicast address, based on its first few hex digits? +a. 3123:1:3:5::1 +b. FE80::1234:56FF:FE78:9ABC c. FDAD::1 +d. FF00::5 + +3. When subnetting an IPv6 address block, an engineer shows a drawing that breaks the address structure into three pieces. Comparing this concept to a three-part IPv4 address structure, which part of the IPv6 address structure is most like the IPv4 net-work part of the address? +a. Subnet +b. Interface ID c. Network +d. Global routing prefix e. Subnet router anycast +4. When subnetting an IPv6 address block, an engineer shows a drawing that breaks the address structure into three pieces. Assuming that all subnets use the same prefix length, which of the following answers lists the name of the field on the far right side of the address? +a. Subnet +b. Interface ID c. Network +d. Global routing prefix e. Subnet router anycast +5. For the IPv6 address FD00:1234:5678:9ABC:DEF1:2345:6789:ABCD, which part of the address is considered the global ID of the unique local address? + +a. None; this address has no global ID. b. 00:1234:5678:9ABC +c. DEF1:2345:6789:ABCD d. 00:1234:5678 +e. FD00 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +542 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Global Unicast Addressing Concepts +This first major section of the chapter focuses on one type of unicast IPv6 addresses: global unicast addresses. As it turns out, many of the general concepts and processes behind these global unicast IPv6 addresses follow the original intent for public IPv4 addresses. So, this section begins with a review of some IPv4 concepts, followed by the details of how a com-pany can use global unicast addresses. + +This first section also discusses IPv6 subnetting and the entire process of taking a block of global unicast addresses and creating subnets for one company. This process takes a globally unique global routing prefix, creates IPv6 subnets, and assigns IPv6 addresses from within each subnet, much like with IPv4. + +Public and Private IPv6 Addresses +In the history of IPv4 addressing, the world started out with a plan that gave every single host a globally unique public IPv4 address. However, as discussed in several places already, the IPv4 address space had too few addresses. So, in the 1990s, companies started using addresses from the private IPv4 address range, as defined in RFC 1918. These companies either simply did not connect to the Internet, or to connect to the Internet, they used Network Address Translation (NAT), sharing a few public globally unique IPv4 addresses for all host connections into the Internet. + +IPv6 allows two similar options of public and private unicast addressing, beginning with global unicast addresses as the public IPv6 address space. Similar to public IPv4 addresses, IPv6 global unicast addresses rely on an administrative process that assigns each company a unique IPv6 address block. Each company then subnets this IPv6 address block and only uses addresses from within that block. The result: that company uses addresses that are unique across the globe as well. + +The second IPv6 option uses unique local IPv6 addresses, which work more like the IPv4 private addresses. Companies that do not plan to connect to the Internet and companies that plan to use IPv6 NAT can use these private unique local addresses. The process also works similarly to IPv4: The engineer can read the details in an RFC, pick some numbers, and start assigning IPv6 addresses without having to register with IANA or any other authority. + +The following lists summarizes the comparisons between global unicast addresses and unique local addresses: + +Global unicast: Addresses that work like public IPv4 addresses. The organization that needs IPv6 addresses asks for a registered IPv6 address block, which is assigned as a global routing prefix. After that, only that organization uses the addresses inside that block of addresses—that is, the addresses that begin with the assigned prefix. +Unique local: Works somewhat like private IPv4 addresses, with the possibility that mul-tiple organizations use the exact same addresses, and with no requirement for registering with any numbering authority. + +Answers to the “Do I Know This Already?” quiz: 1 C 2 A 3 D 4 B 5 D + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 23: IPv6 Addressing and Subnetting 543 + +The rest of this first major section of the chapter examines global unicast addresses in more detail, while the second major section of the chapter examines unique local addresses. + +The IPv6 Global Routing Prefix +IPv6 global unicast addresses allow IPv6 to work more like the original design of the IPv4 Internet. Each organization asks for a block of IPv6 addresses, which no one else can use. That organization further subdivides the address block into smaller chunks, called subnets. Finally, to choose what IPv6 address to use for any host, the engineer chooses an address from the right subnet. + +That reserved block of IPv6 addresses—a set of addresses that only one company can use— is called a global routing prefix. Each organization that wants to connect to the Internet and use IPv6 global unicast addresses should ask for and receive a global routing prefix. Very generally, you can think of the global routing prefix like an IPv4 Class A, B, or C network number from the range of public IPv4 addresses. + +The term global routing prefix might not make you think of a block of IPv6 addresses at first. The term actually refers to the idea that Internet routers can have one route that refers to all the addresses inside the address block, without a need to have routes for smaller parts of that block. For example, Figure 23-1 shows three companies, with three different IPv6 global routing prefixes; the router on the right (R4) has one IPv6 route for each global rout-ing prefix. + + + +Company 1— 2001:DB8:1111::/48 + + + +Company 2— 2001:DB8:2222::/48 + + + +Company 3— 2001:DB8:3333::/48 + + +Destination Next-Router R1 2001:DB8:1111::/48 R1 +2001:DB8:2222::/48 R2 2001:DB8:3333::/48 R3 + + +R2 R4 + +The Internet 23 + +R3 + + +Figure 23-1 Three Global Routing Prefixes, with One Route per Prefix + +The global routing prefix sets those IPv6 addresses apart for use by that one company, just like a public IPv4 network or CIDR address block does in IPv4. All IPv6 addresses inside that company should begin with that global routing prefix, to avoid using other companies’ IPv6 addresses. No other companies should use IPv6 addresses with that same prefix. And thankfully, IPv6 has plenty of space to allow all companies to have a global routing prefix, with plenty of addresses. + +Both the IPv6 and IPv4 address assignment processes rely on the same organizations: IANA (along with ICANN), the Regional Internet Registries (RIR), and ISPs. For example, + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +544 CCNA 200-301 Official Cert Guide, Volume 1 + +an imaginary company, Company1, received the assignment of a global routing prefix. The prefix means “All addresses whose first 12 hex digits are 2001:0DB8:1111,” as represented by prefix 2001:0DB8:1111::/48. To receive that assignment, the process shown in Figure 23-2 happened. + + +3 + +Company 1 +2001:0DB8:1111 + + + + + +1 + + + +IANA + + +ARIN +(North America) +2001:… + + + +AfriNIC (Africa) +2ABC:… + +2 NA-ISP1 2001:0DB8 + + +NA-ISP2 +2001:BBBB + +Company 2 2001:0DB8:2222 + +Company 3 +2001:0DB8:3333 + + +Figure 23-2 Prefix Assignment with IANA, RIRs, and ISPs + +The event timeline in the figure uses a left-to-right flow; in other words, the event on the far left must happen first. Following the flow from left to right in the figure: +1. IANA allocates ARIN prefix 2001::/16: ARIN (the RIR for North America) asks IANA for the allocation of a large block of addresses. In this imaginary example, IANA gives ARIN a prefix of “all addresses that begin 2001,” or 2001::/16. +2. ARIN allocates NA-ISP1 prefix 2001:0DB8::/32: NA-ISP1, an imaginary ISP based in North America, asks ARIN for a new IPv6 prefix. ARIN takes a subset of its 2001::/16 prefix, specifically all addresses that begin with the 32 bits (8 hex digits) 2001:0DB8, and allocates it to the ISP. +3. NA-ISP1 assigns Company 1 2001:0DB8:1111::/48: Company 1 decides to start supporting IPv6, so it goes to its ISP, NA-ISP1, to ask for a block of global unicast addresses. NA-ISP1 assigns Company 1 a “small” piece of NA-ISP1’s address block, in this case the addresses that begin with the 48 bits (12 hex digits) of 2001:0DB8:1111 (2001:0DB8:1111::/48). + +NOTE If you do not plan to connect to the Internet using IPv6 for a while and just want to experiment, you do not need to ask for an IPv6 global routing prefix to be assigned. Just make up IPv6 addresses and configure your devices, or use unique local addresses as dis-cussed toward the end of this chapter. + + +Address Ranges for Global Unicast Addresses +Global unicast addresses make up the majority of the IPv6 address space. However, unlike IPv4, the rules for which IPv6 addresses fall into which category are purposefully more flex-ible than they were with IPv4 and the rules for IPv4 Classes A, B, C, D, and E. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 23: IPv6 Addressing and Subnetting 545 + +Originally, IANA reserved all IPv6 addresses that begin with hex 2 or 3 as global unicast addresses. (This address range can be written succinctly as prefix 2000::/3.) + +Later IANA made the global unicast address range wider, basically to include all IPv6 addresses not otherwise allocated for other purposes. For example, the unique local uni-cast addresses, discussed later in this chapter, all start with hex FD. So, while global unicast addresses would not include any addresses that begin with FD, any address ranges that are not specifically reserved, for now, are considered to be global unicast addresses. + +Finally, just because an amazingly enormous number of addresses sit within the global unicast address range, IANA does not assign prefixes from all over the address range. IPv4 has survived well for more than 30 years with an admittedly too-small address size because IANA has adopted good practices to conserve the IPv4 address space. By making smart and practical choices in assigning IPv6 addresses, the IPv6 address space could last much longer than IPv4. + +Table 23-2 lists the address prefixes discussed in this book and their purpose. + +Table 23-2 Some Types of IPv6 Addresses and Their First Hex Digit(s) + +Address Type Global unicast +Unique local + +Multicast + +Link local + +First Hex Digits +2 or 3 (originally); all not otherwise reserved (today) + +FD + +FF + +FE80 + + + +IPv6 Subnetting Using Global Unicast Addresses +After an enterprise has a block of reserved global unicast addresses—in other words, a global routing prefix—the company needs to subdivide that large address block into subnets. + +Subnetting IPv6 addresses works generally like IPv4, but with mostly simpler math (hoorah!). Because of the absolutely large number of addresses available, most everyone uses the easi- +est possible IPv6 prefix length: /64. Using /64 as the prefix length for all subnets makes the 23 IPv6 subnetting math just as easy as using a /24 mask for all IPv4 subnets. In addition, the +dynamic IPv6 address assignment process works better with a /64 prefix length as well; so in practice, and in this book, expect IPv6 designs to use a /64 prefix length. + +This section does walk you through the different parts of IPv6 subnetting, while mostly using examples that use a /64 prefix length. The discussion defines the rules about which addresses should be in the same subnet and which addresses need to be in different subnets. Plus this section looks at how to analyze the global routing prefix and associated prefix length to find all the IPv6 prefixes (subnet IDs) and the addresses in each subnet. + +NOTE If the IPv4 subnetting concepts are a little vague, you might want to reread Chapter 11, “Perspectives on IPv4 Subnetting,” which discusses the subnetting concepts for IPv4. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +546 CCNA 200-301 Official Cert Guide, Volume 1 + +Deciding Where IPv6 Subnets Are Needed +First, IPv6 and IPv4 both use the same concepts about where a subnet is needed: one for each VLAN and one for each point-to-point WAN connection (serial and Ethernet). Figure 23-3 shows an example of the idea, using the small enterprise internetwork of Company 1. Company 1 has two LANs, with a point-to-point serial link connecting the sites. It also has an Ethernet WAN link connected to an ISP. Using the same logic you would use for IPv4, Company 1 needs four IPv6 subnets. + + + +G0/0 +Subnet 1 + + +R1 G0/0/0 G0/1/0 R2 G0/1/0 Subnet 2 + +G0/0 +Subnet 3 + + +Subnet 4 +G0/0/0 + +ISP + +Figure 23-3 Locations for IPv6 Subnets + +The Mechanics of Subnetting IPv6 Global Unicast Addresses +To understand how to subnet your one large block of IPv6 addresses, you need to under-stand some of the theory and mechanisms IPv6 uses. To learn those details, it can help to compare IPv6 with some similar concepts from IPv4. + +With IPv4, without subnetting, an address has two parts: a network part and a host part. Class A, B, and C rules define the length of the network part, with the host part making up the rest of the 32-bit IPv4 address, as shown in Figure 23-4. + + +A N=8 H=24 + + +B N=16 H=16 + + +C N=24 H=8 +Figure 23-4 Classful View of Unsubnetted IPv4 Networks + +To subnet an IPv4 Class A, B, or C network, the network engineer for the enterprise makes some choices. Conceptually, the engineer creates a three-part view of the addresses, adding a subnet field in the center while shortening the host field. (Many people call this “borrow-ing host bits.”) The size of the network part stays locked per the Class A, B, and C rules, with the line between the subnet and host part being flexible, based on the choice of subnet mask. Figure 23-5 shows the idea for a subnetted Class B network. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 23: IPv6 Addressing and Subnetting 547 + +Set By Set by Local Class B Rules Engineer + + + +B +B N=16 S=__ H=__ + +N + S + H = 32 + +Figure 23-5 Classful View of Subnetted IPv4 Networks + +IPv6 uses a similar concept, with the details in Figure 23-6. The structure shows three major parts, beginning with the global routing prefix, which is the initial value that must be the same in all IPv6 addresses inside the enterprise. The address ends with the interface ID, which acts like the IPv4 host field. The subnet field sits between the two other fields, used as a way to number and identify subnets, much like the subnet field in IPv4 addresses. + + +Set By IANA, RIR, or ISP + +Set by Local Engineer + + + + + +P Bits S Bits + +Global Routing Prefix Subnet + +I Bits + +Interface ID + + +P + S + I = 128 + +Figure 23-6 Structure of Subnetted IPv6 Global Unicast Addresses + +First, just think about the general idea with IPv6, comparing Figure 23-6 to Figure 23-5. The IPv6 global routing prefix (the prefix/length assigned by the RIR or ISP) acts like the IPv4 network part of the address structure. The IPv6 subnet part acts like the IPv4 subnet part. +And the right side of the IPv6, formally called the interface ID (short for interface identi- +fier), acts like the IPv4 host field. 23 + +Now focus on the IPv6 global routing prefix and its prefix length. Unlike IPv4, IPv6 has no concept of address classes, so no preset rules determine the prefix length of the global rout-ing prefix. However, when a company applies to an ISP, RIR, or any other organization that can assign a global routing prefix, that assignment includes both the prefix and the prefix length. After a company receives a global routing prefix and that prefix length, the length of the prefix typically does not change over time and is basically locked. (Note that the prefix length of the global routing prefix is often between /32 and /48, or possibly as long as /56.) + +Next, look to the right side of Figure 23-6 to the interface ID field. For several reasons that become more obvious the more you learn about IPv6, this field is often 64 bits long. Does it have to be 64 bits long? No. However, using a 64-bit interface ID field works well in real net-works, and there are no reasons to avoid using a 64-bit interface ID field. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +548 CCNA 200-301 Official Cert Guide, Volume 1 + +Finally, look to the subnet field in the center of Figure 23-6. Similar to IPv4, this field cre-ates a place with which to number IPv6 subnets. The length of the subnet field is based on the other two facts: the length of the global routing prefix and the length of the interface ID. And with the commonly used 64-bit interface ID field, the subnet field is typically 64–P bits, with P being the length of the global routing prefix. + +Next, consider the structure of a specific global unicast IPv6 address, 2001:0DB8:1111:0001:0000:0000:0000:0001, as seen in Figure 23-7. In this case: + +■ The company was assigned prefix 2001:0DB8:1111, with prefix length /48. ■ The company uses the usual 64-bit interface ID. +■ The company has a subnet field of 16 bits, allowing for 216 IPv6 subnets. + + +48 Bits 16 Bits + +2001:0DB8:1111 0001 + +Global Routing Prefix Subnet + +Prefix ID Subnet ID + +64 Bits + +0000:0000:0000:0001 + +Host + +Figure 23-7 Address Structure for Company 1 Example + +The example in Figure 23-7, along with a little math, shows one reason why so many com-panies use a /64 prefix length for all subnets. With this structure, Company 1 can support 216 possible subnets (65,536). Few companies need that many subnets. Then, each subnet supports over 1018 addresses per subnet (264, minus some reserved values). So, for both sub-nets and hosts, the address structure supports far more than are needed. Plus, the /64 prefix length for all subnets makes the math simple because it cuts the 128-bit IPv6 address in half. + +Listing the IPv6 Subnet Identifier +Like with IPv4, IPv6 needs to identify each IPv6 subnet with some kind of a subnet identi-fier, or subnet ID. Figure 23-7 lists the informal names for this number (subnet ID) and the more formal name (prefix ID). Routers then list the IPv6 subnet ID in routing tables, along with the prefix length. + +Chapter 22, “Fundamentals of IP Version 6,” already discussed how to find the subnet ID, given an IPv6 address and prefix length. The math works the same way when working with global unicast addresses, as well as the unique local addresses discussed later in the chapter. Chapter 28, “Securing Wireless Networks,” has already discussed the math, but for com-pleteness, note that the subnet ID shown in Figure 23-7 would be +2001:DB8:1111:1::/64 + + +List All IPv6 Subnets +With IPv4, if you choose to use a single subnet mask for all subnets, you can sit and write down all the subnets of a Class A, B, or C network using that one subnet mask. With IPv6, + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 23: IPv6 Addressing and Subnetting 549 + +the same ideas apply. If you plan to use a single prefix length for all subnets, you can start with the global routing prefix and write down all the IPv6 subnet IDs as well. + +To find all the subnet IDs, you simply need to find all the unique values that will fit inside the subnet part of the IPv6 address, basically following these rules: + +■ All subnet IDs begin with the global routing prefix. +■ Use a different value in the subnet field to identify each different subnet. ■ All subnet IDs have all 0s in the interface ID. + +As an example, take the IPv6 design shown in Figure 23-7, and think about all the subnet IDs. First, all subnets will use the commonly used /64 prefix length. This company uses a global routing prefix of 2001:0DB8:1111::/48, which defines the first 12 hex digits of all the subnet IDs. To find all the possible IPv6 subnet IDs, think of all the combinations of unique values in the fourth quartet and then represent the last four quartets of all 0s with a :: sym-bol. Figure 23-8 shows the beginning of just such a list. + + +2001:0DB8:1111:0000:: 2001:0DB8:1111:0001:: 2001:0DB8:1111:0002:: +2001:0DB8:1111:0003:: 2001:0DB8:1111:0004:: 2001:0DB8:1111:0005:: +2001:0DB8:1111:0006:: 2001:0DB8:1111:0007:: + +2001:0DB8:1111:0008:: 2001:0DB8:1111:0009:: 2001:0DB8:1111:000A:: +2001:0DB8:1111:000B:: 2001:0DB8:1111:000C:: 2001:0DB8:1111:000D:: +2001:0DB8:1111:000E:: 2001:0DB8:1111:000F:: + +Global Routing Prefix Subnet Global Routing Prefix Subnet +Figure 23-8 First 16 Possible Subnets with a 16-bit Subnet Field in This Example + +The example allows for 65,536 subnets, so clearly the example will not list all the possible subnets. However, in that fourth quartet, all combinations of hex values would be allowed. + + +NOTE The IPv6 subnet ID, more formally called the subnet router anycast address, is reserved and should not be used as an IPv6 address for any host. + + +23 + + + +Assign Subnets to the Internetwork Topology +After an engineer lists all the possible subnet IDs (based on the subnet design), the next step is to choose which subnet ID to use for each link that needs an IPv6 subnet. Just like with IPv4, each VLAN, each serial link, each Ethernet WAN link, and many other data-link instances need an IPv6 subnet. + +Figure 23-9 shows an example using Company 1 again. The figure uses the four subnets from Figure 23-8 that have check marks beside them. The check marks are just a reminder to not use those four subnets in other locations. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +550 CCNA 200-301 Official Cert Guide, Volume 1 + + +Prefix 2001:DB8:1111:0001::/64 + +Prefix 2001:DB8:1111:0002::/64 + +Prefix 2001:DB8:1111:0003::/64 + + +G0/0 R1 G0/0/0 G0/1/0 R2 G0/0 G0/1/0 + + +G0/0/0 2001:DB8:1111:0004::/64 +Prefix + +ISP + +Figure 23-9 Subnets in Company 1, with Global Routing Prefix of 2001:0DB8:1111::/48 + +Assigning Addresses to Hosts in a Subnet +Now that the engineer has planned which IPv6 subnet will be used in each location, the individual IPv6 addressing can be planned and implemented. Each address must be unique, in that no other host interface uses the same IPv6 address. Also, the hosts cannot use the subnet ID itself. + +The process of assigning IPv6 addresses to interfaces works similarly to IPv4. Addresses can be configured statically, along with the prefix length, default router, and Domain Name +System (DNS) IPv6 addresses. Alternatively, hosts can learn these same settings dynamically, using either Dynamic Host Configuration Protocol (DHCP) or a built-in IPv6 mechanism called Stateless Address Autoconfiguration (SLAAC). + +For example, Figure 23-10 shows some static IP addresses that could be chosen for the router interfaces based on the subnet choices shown in Figure 23-9. In each case, the router interfaces use an interface ID that is a relatively low number, easily remembered. + + +2001:DB8:1111:1::1 +2001:DB8:1111:1::9 + +2001:DB8:1111:2::2 +2001:DB8:1111:2::1 + +2001:DB8:1111:3::9 +2001:DB8:1111:3::2 + + + +PC1 PC2 G0/0 R1 G0/0/0 G0/1/0 R2 G0/0 +G0/1/0 +2001:DB8:1111:4::1 2001:DB8:1111:4::3 +G0/0/0 + +ISP + +Figure 23-10 Example Static IPv6 Addresses Based on the Subnet Design of Figure 23-9 + +This chapter puts off the details of how to configure the IPv6 addresses until Chapter 24, “Implementing IPv6 Addressing on Routers.” + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 23: IPv6 Addressing and Subnetting 551 + +Unique Local Unicast Addresses +Unique local unicast addresses act as private IPv6 addresses. These addresses have many sim-ilarities with global unicast addresses, particularly in how to subnet. The biggest difference lies in the literal number (unique local addresses begin with hex FD) and with the administra-tive process: the unique local prefixes are not registered with any numbering authority and can be used by multiple organizations. + +Although the network engineer creates unique local addresses without any registration or assignment process, the addresses still need to follow some rules, as follows: + +■ Use FD as the first two hex digits. ■ Choose a unique 40-bit global ID. +■ Append the global ID to FD to create a 48-bit prefix, used as the prefix for all your addresses. +■ Use the next 16 bits as a subnet field. +■ Note that the structure leaves a convenient 64-bit interface ID field. + +Figure 23-11 shows the format of these unique local unicast addresses. + +8 Bits 40 Bits 16 Bits 64 Bits + +FD Global ID (Pseudo-Random) Subnet Interface ID + +Subnet ID +Figure 23-11 IPv6 Unique Local Unicast Address Format + + +NOTE Just to be completely exact, IANA actually reserves prefix FC00::/7, and not FD00::/8, for these addresses. FC00::/7 includes all addresses that begin with hex FC and FD. However, an RFC (4193) requires the eighth bit of these addresses to be set to 1, which means that in practice today, the unique local addresses all begin with their first two digits +as FD. +23 + +Subnetting with Unique Local IPv6 Addresses +Subnetting using unique local addresses works just like subnetting with global unicast addresses with a 48-bit global routing prefix. The only difference is that with global unicasts, you start by asking for a global routing prefix to be assigned to your company, and that global routing prefix might or might not have a /48 prefix length. With unique local, you cre-ate that prefix locally, and the prefix begins with /48, with the first 8 bits set and the next 40 bits randomly chosen. + +The process can be as simple as choosing a 40-bit value as your global ID. These 40 bits require 10 hex digits, so you can even avoid thinking in binary and just make up a +unique 10-hex-digit value and add hex FD to the front. For example, imagine you chose a 10-hex-digit value of hex 00 0001 0001, prepend a hex FD, making the entire prefix be FD00:0001:0001::/48, or FD00:1:1::/48 when abbreviated. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +552 CCNA 200-301 Official Cert Guide, Volume 1 + +To create subnets, just as you did in the earlier examples with a 48-bit global routing prefix, treat the entire fourth quartet as a subnet field, as shown in Figure 23-11. + +Figure 23-12 shows an example subnetting plan using unique local addresses. The example repeats the same topology shown earlier in Figure 23-9; that figure showed subnetting with a global unicast prefix. This example uses the exact same numbers for the fourth quartet’s sub-net field, simply replacing the 48-bit global unicast prefix with this new local unique prefix of FD00:1:1. + +Company 1 – Unique Local Prefix FD00:1:1::/48 + + +Prefix FD00:1:1:0001::/64 + +Prefix FD00:1:1:0002::/64 + +Prefix FD00:1:1:0003::/64 + + +G0/0 R1 G0/0/0 G0/1/0 R2 G0/0 G0/1/0 +Prefix +G0/0/0 FD00:1:1:0004::/64 + +ISP + +Figure 23-12 Subnetting Using Unique Local Addresses + +The Need for Globally Unique Local Addresses +The example in Figure 23-12 shows an easy-to-remember prefix of FD00:1:1::/48. Clearly, I made up the easy-to-remember global ID in this example. What global ID would you choose for your company? Would you pick a number that you could not abbreviate and make it shorter? If you had to pick the IPv6 prefix for your unique local addresses from the options in the following list, which would you pick for your company? +■ FDE9:81BE:A059::/48 ■ FDF0:E1D2:C3B4::/48 ■ FD00:1:1::/48 + +Given freedom to choose, most people would pick an easy-to-remember, short-to-type pre-fix, like FD00:1:1::/48. And in a lab or other small network used for testing, making up an easy-to-use number is reasonable. However, for use in real corporate networks, you should not just make up any global ID you like; you should try to follow the unique local address rules that strive to help make your addresses unique in the universe—even without register-ing a prefix with an ISP or RIR. + +RFC 4193 defines unique local addresses, and that RFC stresses the importance of choosing your global ID in a way to make it statistically unlikely to be used by other companies. What is the result of unique global IDs at every company? Making all these unique local addresses unique across the globe. So, if you do plan on using unique local addresses in a real network, plan on using the random number generator logic listed in RFC 4193 to create your prefix. + +One of the big reasons to attempt to use a unique prefix, rather than everyone using the same easy-to-remember prefixes, is to be ready for the day that your company merges with + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 23: IPv6 Addressing and Subnetting 553 + +or buys another company. Today, with IPv4, a high percentage of companies use private IPv4 network 10.0.0.0. When they merge their networks, the fact that both use network 10.0.0.0 makes the network merger more painful than if the companies had used different private IPv4 networks. With IPv6 unique local addresses, if both companies did the right thing and randomly chose a prefix, they will most likely be using completely different prefixes, mak-ing the merger much simpler. However, companies that take the seemingly easy way out +and choose an easy-to-remember prefix like FD00:1:1 greatly increase their risk of requiring extra effort when merging with another company that also chose to use that same prefix. + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same mate-rial found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 23-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 23-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory table + +Resource Used Book, website +Book, website + +Book, PTP + +Website + + + +Review All the Key Topics + + +Table 23-4 +Key Topic Element +List + +Table 23-2 + +Figure 23-6 + +List + +List + +Key Topics for Chapter 23 +Description Page +Number 23 Two types of IPv6 unicast addresses 542 + +Values of the initial hex digits of IPv6 addresses, and the address 545 type implied by each +Subnetting concepts for IPv6 global unicast addresses 547 + +Rules for how to find all IPv6 subnet IDs, given the global routing 548 prefix, and prefix length used for all subnets +Rules for building unique local unicast addresses 551 + + +Figure 23-11 Subnetting concepts for IPv6 unique local addresses 551 + + +Key Terms You Should Know +global unicast address, global routing prefix, unique local address, subnet ID (prefix ID), sub-net router anycast address + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 24 + + +Implementing IPv6 Addressing on Routers + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.9 Compare and contrast IPv6 address types + +1.9.a Global unicast + +1.9.b Unique local + +1.9.c Link local + +1.9.d Anycast + +1.9.e Multicast + +1.9.f Modified EUI 64 + +With IPv4 addressing, some devices, like servers and routers, typically use static predefined IPv4 addresses. End-user devices do not mind if their address changes from time to time, and they typically learn an IPv4 address dynamically using DHCP. IPv6 uses the same approach, with servers, routers, and other devices in the control of the IT group often using predefined IPv6 addresses, and with end-user devices using dynamically learned IPv6 addresses. + +This chapter focuses on IPv6 address configuration on routers. The chapter begins with the more obvious IPv6 addressing configuration, with features that mirror IPv4 features, show-ing how to configure interfaces with IPv6 addresses and view that configuration with show commands. The second half of the chapter introduces new IPv6 addressing concepts, show-ing some other addresses used by routers when doing different tasks. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 24-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Implementing Unicast IPv6 Addresses on Routers + +Special Addresses Used by Routers + +Questions 1–3 +4–5 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Router R1 has an interface named Gigabit Ethernet 0/1, whose MAC address has been set to 0200.0001.000A. Which of the following commands, added in R1’s Gigabit Ethernet 0/1 configuration mode, gives this router’s G0/1 interface a unicast IPv6 address of 2001:1:1:1:1:200:1:A, with a /64 prefix length? +a. ipv6 address 2001:1:1:1:1:200:1:A/64 +b. ipv6 address 2001:1:1:1:1:200:1:A/64 eui-64 c. ipv6 address 2001:1:1:1:1:200:1:A /64 eui-64 d. ipv6 address 2001:1:1:1:1:200:1:A /64 +e. None of the other answers are correct. + +2. Router R1 has an interface named Gigabit Ethernet 0/1, whose MAC address has been set to 5055.4444.3333. This interface has been configured with the ipv6 address 2000:1:1:1::/64 eui-64 subcommand. What unicast address will this interface use? +a. 2000:1:1:1:52FF:FE55:4444:3333 b. 2000:1:1:1:5255:44FF:FE44:3333 c. 2000:1:1:1:5255:4444:33FF:FE33 d. 2000:1:1:1:200:FF:FE00:0 +3. Router R1 currently supports IPv4, routing packets in and out all its interfaces. R1’s configuration needs to be migrated to support dual-stack operation, routing both IPv4 and IPv6. Which of the following tasks must be performed before the router can also support routing IPv6 packets? (Choose two answers.) +a. Enable IPv6 on each interface using an ipv6 address interface subcommand. b. Enable support for both versions with the ip versions 4 6 global command. +c. Additionally enable IPv6 routing using the ipv6 unicast-routing global command. d. Migrate to dual-stack routing using the ip routing dual-stack global command. +4. Router R1 has an interface named Gigabit Ethernet 0/1, whose MAC address has been set to 0200.0001.000A. The interface is then configured with the ipv6 address 2001:1:1:1:200:FF:FE01:B/64 interface subcommand; no other ipv6 address com-mands are configured on the interface. Which of the following answers lists the link-local address used on the interface? +a. FE80::FF:FE01:A b. FE80::FF:FE01:B +c. FE80::200:FF:FE01:A d. FE80::200:FF:FE01:B + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +556 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Which of the following multicast addresses is defined as the address for sending pack-ets to only the IPv6 routers on the local link? + +a. FF02::1 b. FF02::2 c. FF02::5 d. FF02::A + +Foundation Topics + +Implementing Unicast IPv6 Addresses on Routers Every company bases its enterprise network on one or more protocol models, or protocol stacks. In the earlier days of networking, enterprise networks used one or more protocol stacks from different vendors, as shown on the left of Figure 24-1. Over time, companies +added TCP/IP (based on IPv4) to the mix. Eventually, companies migrated fully to TCP/IP as the only protocol stack in use. + + + +IBM DEC + + + +VOetnhdeorr + + +IBM + + + +Other +Vendor + +DEC + +TCP/IP IPv4 +TCP/IP IPv4 + + +1980s 1990s 2000s +Figure 24-1 Migration of Enterprise Networks to Use TCP/IP Stack Only, IPv4 + +The emergence of IPv6 requires that IPv6 be implemented in end-user hosts, servers, routers, and other devices. However, corporations cannot just migrate all devices from IPv4 to IPv6 over one weekend. Instead, what will likely occur is some kind of long-term migration and coexistence, in which for a large number of years, most corporate networks again use mul-tiple protocol stacks—one based on IPv4 and one based on IPv6. + +Eventually, over time, we might all see the day when enterprise networks run only IPv6, without any IPv4 remaining, but that day might take awhile. Figure 24-2 shows the progres-sion, just to make the point, but who knows how long it will take? + +One way to add IPv6 support to an established IPv4-based enterprise internetwork is to implement a dual-stack strategy. To do so, the routers can be configured to route IPv6 pack-ets, with IPv6 addresses on their interfaces, with a similar model to how routers support IPv4. Then hosts can implement IPv6 when ready, running both IPv4 and IPv6 (dual stacks). The first major section of this chapter shows how to configure and verify unicast IPv6 addresses on routers. + + +Answers to the “Do I Know This Already?” quiz: 1 A 2 B 3 A, C 4 A 5 B + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 557 + + + + + +TCP/IP IPv4 + +TCP/IP IPv4 + +TCP/IP IPv6 + + +TCP/IP +TCP/IP IPv6 +IPv6 + + +2010s 2020s ??? 2030s ??? +Figure 24-2 Possible Path Through Dual-Stack (IPv4 and IPv6) over a Long Period + +Static Unicast Address Configuration +Cisco routers give us two options for static configuration of IPv6 addresses. In one case, you configure the full 128-bit address, while in the other, you configure a 64-bit prefix and let the router derive the second half of the address (the interface ID). The next few pages show how to configure both options and how the router chooses the second half of the IPv6 address. + +Configuring the Full 128-Bit Address +To statically configure the full 128-bit unicast address—either global unicast or unique local—the router needs an ipv6 address address/prefix-length interface subcommand on each interface. The address can be an abbreviated IPv6 address or the full 32-digit hex +address. The command includes the prefix length value, at the end, with no space between the address and prefix length. + +The configuration of the router interface IPv6 address really is that simple. Figure 24-3, along with Examples 24-1 and 24-2, shows a basic example. The figure shows the global uni-cast IPv6 address used by two different routers, on two interfaces each. As usual, all subnets use a /64 prefix length. + +2001:DB8:1111:4::2 +2001:DB8:1111:1::1 2001:DB8:1111:4::1 2001:DB8:1111:2::2 + +24 + +G0/0 R1 G0/0/0 G0/1/0 R2 G0/0 + +Subnet 2001:DB8:1111:1::/64 + +Subnet 2001:DB8:1111:4::/64 + +Subnet 2001:DB8:1111:2::/64 + + +Figure 24-3 Sample 128-bit IPv6 Addresses to Be Configured on Cisco Router Interfaces + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +558 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 24-1 Configuring Static IPv6 Addresses on R1 + +ipv6 unicast-routing +! +interface GigabitEthernet0/0 +ipv6 address 2001:DB8:1111:1::1/64 +! +interface GigabitEthernet0/0/0 +ipv6 address 2001:0db8:1111:0004:0000:0000:0000:0001/64 + + +Example 24-2 Configuring Static IPv6 Addresses on R2 + +ipv6 unicast-routing +! +interface GigabitEthernet0/0 +ipv6 address 2001:DB8:1111:2::2/64 +! +interface GigabitEthernet0/1/0 +ipv6 address 2001:db8:1111:4::2/64 + + + +NOTE The configuration on R1 in Example 24-1 uses both abbreviated and unabbreviated addresses, and both lowercase and uppercase hex digits, showing that all are allowed. Router show commands list the abbreviated value with uppercase hex digits. + + +Enabling IPv6 Routing +While the configurations shown in Examples 24-1 and 24-2 focus on the IPv6 address configuration, they also include an important but often overlooked step when configuring IPv6 on Cisco routers: IPv6 routing needs to be enabled. On Cisco routers, IPv4 routing +is enabled by default, but IPv6 routing is not enabled by default. The solution takes only a single command—ipv6 unicast-routing—which enables IPv6 routing on the router. + +A router must enable IPv6 globally (ipv6 unicast-routing) and enable IPv6 on the interface (ipv6 address) before the router will attempt to route IPv6 packets in and out an interface. If you omit the ipv6 unicast-routing command but configure interface IPv6 addresses, the router will not route any received IPv6 packets, but the router will act as an IPv6 host. If you include the ipv6 unicast-routing command but omit all the interface IPv6 addresses, the router will be ready to route IPv6 packets but have no interfaces that have IPv6 enabled, effectively disabling IPv6 routing. + +Verifying the IPv6 Address Configuration +IPv6 uses many show commands that mimic the syntax of IPv4 show commands. For example: + +■ The show ipv6 interface brief command gives you interface IPv6 address info, but not prefix length info, similar to the IPv4 show ip interface brief command. +■ The show ipv6 interface command gives the details of IPv6 interface settings, much like the show ip interface command does for IPv4. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 559 + +The one notable difference in the most common commands is that the show interfaces com-mand still lists the IPv4 address and mask but tells us nothing about IPv6. So, to see IPv6 interface addresses, use commands that begin with show ipv6. Example 24-3 lists a few samples from Router R1, with the explanations following. + +Example 24-3 Verifying Static IPv6 Addresses on Router R1 + +! The first interface is in subnet 1 +R1# show ipv6 interface GigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::1:AAFF:FE00:1 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:1111:1::1, subnet is 2001:DB8:1111:1::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:FF00:1 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND advertised reachable time is 0 (unspecified) +ND advertised retransmit interval is 0 (unspecified) +ND router advertisements are sent every 200 seconds +ND router advertisements live for 1800 seconds +ND advertised default router preference is Medium +Hosts use stateless autoconfig for addresses. + +R1# show ipv6 interface brief +GigabitEthernet0/0 [up/up] +FE80::1:AAFF:FE00:1 +2001:DB8:1111:1::1 + +GigabitEthernet0/1 +unassigned +GigabitEthernet0/0/0 + +[administratively down/down] 24 + +[up/up] + +FE80::32F7:DFF:FE29:8568 +2001:DB8:1111:4::1 +GigabitEthernet0/1/0 [administratively down/down] +unassigned + + +First, focus on the output of the two show ipv6 interface commands at the top of the example, which lists interface G0/0, showing output about that interface only. Note that the output lists the configured IPv6 address and prefix length, as well as the IPv6 subnet (2001:DB8:1111:1::/64), which the router calculated based on the IPv6 address. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +560 CCNA 200-301 Official Cert Guide, Volume 1 + +The end of the example lists the output of the show ipv6 interface brief command. Similar to the IPv4-focused show ip interface brief command, this command lists IPv6 addresses, but not the prefix length or prefixes. This command also lists all interfaces on the router, whether or not IPv6 is enabled on the interfaces. For example, in this case, the only two interfaces on R1 that have an IPv6 address are G0/0 and G0/0/0, as configured earlier in Example 24-1. + +Beyond the IPv6 addresses on the interfaces, the router also adds IPv6 connected routes to the IPv6 routing table off each interface. Just as with IPv4, the router keeps these connected routes in the IPv6 routing table only when the interface is in a working (up/up) state. But if the interface has an IPv6 unicast address configured, and the interface is working, the router adds the connected routes. Example 24-4 shows the connected IPv6 on Router R1 from Figure 24-3. + +Example 24-4 Displaying Connected IPv6 Routes on Router R1 + +R1# show ipv6 route connected +IPv6 Routing Table - default - 5 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP +H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea +IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO +ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect +RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid +lA - LISP away, a - Application +C 2001:DB8:1111:1::/64 [0/0] +via GigabitEthernet0/0, directly connected +C 2001:DB8:1111:4::/64 [0/0] +via GigabitEthernet0/0/0, directly connected + + +Generating a Unique Interface ID Using Modified EUI-64 +IPv6 follows the same general model as IPv4 regarding which types of devices typically use static, predefined addresses and which use dynamically learned address. For example, rout-ers inside an enterprise use static IPv4 addresses, while end-user devices typically learn their IPv4 address using DHCP. With IPv6, routers also typically use static IPv6 addresses, while user devices use DHCP or Stateless Address Auto Configuration (SLAAC) to dynamically learn their IPv6 address. + +Even though engineers typically choose to use stable and predictable IPv6 interface address-es, IOS supports two different methods to configure a stable address. One method uses the ipv6 address command to define the entire 128-bit address, as shown in Examples 24-1 and 24-2. The other method uses this same ipv6 address command, but the command config-ures only the 64-bit IPv6 prefix for the interface and lets the router automatically generate a unique interface ID. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 561 + +This second method uses rules called modified EUI-64 (extended unique identifier). Often, in the context of IPv6 addressing, people refer to modified EUI-64 as just EUI-64; there is no other term or concept about EUI-64 that you need to know for IPv6. The configuration that +uses EUI-64 includes a keyword to tell the router to use EUI-64 rules, along with the 64-bit pre-fix. The router then uses EUI-64 rules to create the interface ID part of the address, as follows: +1. Split the 6-byte (12-hex-digit) MAC address in two halves (6 hex digits each). +2. Insert FFFE in between the two, making the interface ID now have a total of 16 hex digits (64 bits). +3. Invert the seventh bit of the interface ID. + +Figure 24-4 shows the major pieces of how the address is formed. + +Defined by Configuration Calculated by Router Using EUI-64 + + +Subnet Prefix + +1st Half of MAC + + +FFFE + +2nd Half of MAC + + + +Invert 7th Bit, 1st Byte (Reading Left to Right) +Figure 24-4 IPv6 Address Format with Interface ID and EUI-64 + + +NOTE You can find a video about the EUI-64 process on the companion website, in the Chapter Review section for this chapter. + +Although this process might seem a bit convoluted, it works. Also, with a little practice, you can look at an IPv6 address and quickly notice the FFFE in the middle of the interface ID and then easily find the two halves of the corresponding interface’s MAC address. But you need to be ready to do the same math, in this case to predict the EUI-64 formatted IPv6 address on an interface. + +For example, if you ignore the final step of inverting the seventh bit, the rest of the steps just require that you move the pieces around. Figure 24-5 shows two examples, just so you see + +the process. + +Example 1 + +0013.1234.ABCD + + + +Process + +1 MAC + + + +Example 2 24 + +1612.3456.789A + + + +001312 34ABCD 2 Halves 161234 56789A + + +001312 FFFE 34ABCD 3 Insert FFFE 161234 FFFE 56789A + + +0013:12FF:FE34:ABCD 4 Interface ID 1612:34FF:FE56:789A (1 Step Left) +Figure 24-5 Two Examples of Most of the EUI-64 Interface ID Process + + +|||||||||||||||||||| +|||||||||||||||||||| + + +562 CCNA 200-301 Official Cert Guide, Volume 1 + +Both examples follow the same process. Each starts with the MAC address, breaking it into two halves (Step 2). The third step inserts FFFE in the middle, and the fourth step inserts a colon every four hex digits, keeping with IPv6 conventions. + +While the examples in Figure 24-5 show most of the steps, they omit the final step. The final step requires that you convert the first byte (first two hex digits) from hex to binary, invert the seventh of the 8 bits, and convert the bits back to hex. Inverting a bit means that if the bit is a 0, make it a 1; if it is a 1, make it a 0. Most of the time, with IPv6 addresses, the origi-nal bit will be 0 and will be inverted to a 1. + +For example, Figure 24-6 completes the two examples from Figure 24-5, focusing only on the first two hex digits. The examples show each pair of hex digits (Step 1) and the binary equivalent (Step 2). Step 3 shows a copy of those same 8 bits, except the seventh bit is invert-ed; the example on the left inverts from 0 to 1, and the example on the right inverts from 1 to 0. Finally, the bits are converted back to hex at Step 4. + + +Example 1 + +00 + + +0000 0000 + + +0000 0010 + + +02 + + +1 First 2 Hex Digits + + +2 Convert to Binary + + +3 Invert 7th Bit + + +4 Convert to Hex + +Example 2 +16 Hex + + +0001 0110 Binary + + +0001 0100 Binary + + +14 Hex + + +Figure 24-6 Inverting the Seventh Bit of an EUI-64 Interface ID Field + + +NOTE If you do not remember how to do hex-to-binary conversions, take a few moments to review the process. If you memorize the 16 hex values for digits 0 through F, with the cor-responding binary values, the conversion can be easy. If you do not have those handy in your +memory, take a few moments to look at Table A-2 in Appendix A, “Numeric Reference Tables.” + +For those of you who prefer the decimal shortcuts, with a little memorization you can do the bit-flip math without doing any hex-binary conversions. First, note that the process to invert the seventh bit, when working with a hexadecimal IPv6 address, flips the third of 4 bits in a single hex digit. With only 16 single hex digits, you could memorize what each hex digit becomes if its third bit is inverted, and you can easily memorize those values with a visual process. + +If you want to try to memorize the values, it helps to work through the following process a few times, so grab a piece of scratch paper. Then write the 16 single hex digits as shown on the left side of Figure 24-7. That is, write them in eight rows of two numbers each, with the spacing as directed in the figure. + +Next, start at the top of the lists and draw arrow lines between two numbers in the same column on the top left (0 and 2). Then move down the left-side column, connecting the next two digits (4 and 6) with an arrow line, then 8 and A, and then C and E. Repeat the process on the right, re-creating the right side of Figure 24-7. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 563 + +Step 1: Step 2: + + + + + + +A Little Space + +0 1 0 1 2 3 2 3 + +4 5 4 5 6 7 6 7 + +8 9 8 9 A B A B + +C D C D E F E F + + + +A Little Space +Figure 24-7 A Mnemonic Device to Help Memorize Bit Inversion Shortcut + +The figure you drew (and the right side of Figure 24-7) shows the hex digits which, when you invert their third bit, convert to the other. That is, 0 converts to 2; 2 converts to 0; 1 converts to 3; 3 converts to 1; 4 converts to 6; 6 converts to 4; and so on. So, on the exam, if you can remember the pattern to redraw Figure 24-7, you could avoid doing binary/hexadeci-mal conversion. Use whichever approach makes you more comfortable. + +As usual, the best way to get comfortable with forming these EUI-64 interface IDs is to cal-culate some yourself. Table 24-2 lists some practice problems, with an IPv6 64-bit prefix in the first column and the MAC address in the second column. Your job is to calculate the full (unabbreviated) IPv6 address using EUI-64 rules. The answers are at the end of the chapter, in the section “Answers to Earlier Practice Problems.” + + +Table 24-2 +Prefix + +IPv6 EUI-64 Address Creation Practice +MAC Address Unabbreviated IPv6 Address + + + +2001:DB8:1:1::/64 + +2001:DB8:1:1::/64 + +2001:DB8:1:1::/64 + +0013.ABAB.1001 + +AA13.ABAB.1001 + +000C.BEEF.CAFE + + +2001:DB8:1:1::/64 B80C.BEEF.CAFE +2001:DB8:FE:FE::/64 0C0C.ABAC.CABA 24 + +2001:DB8:FE:FE::/64 0A0C.ABAC.CABA + + +Configuring a router interface to use the EUI-64 format uses the ipv6 address address/ prefix-length eui-64 interface subcommand. The eui-64 keyword tells the router to find the interface MAC address and do the EUI-64 conversion math to find the interface ID. + +Example 24-5 shows a revised configuration on Router R1, as compared to the earlier Example 24-1. In this case, R1 uses EUI-64 formatting for its IPv6 addresses. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +564 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 24-5 Configuring R1’s IPv6 Interfaces Using EUI-64 + +ipv6 unicast-routing +! +! The ipv6 address command now lists a prefix, not the full address +interface GigabitEthernet0/0 +mac-address 0201.aa00.0001 +ipv6 address 2001:DB8:1111:1::/64 eui-64 +! +interface GigabitEthernet0/0/0 +ipv6 address 2001:DB8:1111:4::/64 eui-64 + +R1# show ipv6 interface brief +GigabitEthernet0/0 [up/up] +FE80::1:AAFF:FE00:1 +2001:DB8:1111:1:1:AAFF:FE00:1 + +GigabitEthernet0/1 +unassigned +GigabitEthernet0/0/0 + +[administratively down/down] + +[up/up] + +FE80::32F7:DFF:FE29:8568 +2001:DB8:1111:4:32F7:DFF:FE29:8568 +GigabitEthernet0/0/1 [administratively down/down] +unassigned + + +The example uses only Ethernet interfaces, all of which have a universal MAC address to use to create their EUI-64 interface IDs. However, in this case, the configuration includes the mac-address command under R1’s G0/0 interface, which causes IOS to use the configured MAC address instead of the universal (burned-in) MAC address. Interface G0/0/0 defaults to use its universal MAC address. Following that math: + +G0/0 – MAC 0201.AA00.0001– Interface ID 0001.AAFF.FE00.0001 G0/0 – MAC 30F7.0D29.8568– Interface ID 32F7.0DFF.FE29.8568 +Also, be aware that for interfaces that do not have a MAC address, like serial interfaces, the router uses the MAC of the lowest-numbered router interface that does have a MAC. + +NOTE When you use EUI-64, the address value in the ipv6 address command should be the prefix, not the full 128-bit IPv6 address. However, if you mistakenly type the full address and still use the eui-64 keyword, IOS accepts the command and converts the address to the matching prefix before putting the command into the running config file. For example, IOS converts ipv6 address 2000:1:1:1::1/64 eui-64 to ipv6 address 2000:1:1:1::/64 eui-64. + + +Dynamic Unicast Address Configuration +In most cases, network engineers will configure the IPv6 addresses of router interfaces so that the addresses do not change until the engineer changes the router configuration. +However, routers can be configured to use dynamically learned IPv6 addresses. These can be + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 565 + +useful for routers connecting to the Internet through some types of Internet access technolo-gies, like DSL and cable modems. + +Cisco routers support two ways for the router interface to dynamically learn an IPv6 address to use: + +■ Stateful DHCP +■ Stateless Address Autoconfiguration (SLAAC) + +Both methods use the familiar ipv6 address command. Of course, neither option configures the actual IPv6 address; instead, the commands configure a keyword that tells the router which method to use to learn its IPv6 address. Example 24-6 shows the configuration, with one interface using stateful DHCP and one using SLAAC. + +Example 24-6 Router Configuration to Learn IPv6 Addresses with DHCP and SLAAC + +! This interface uses DHCP to learn its IPv6 address +interface FastEthernet0/0 +ipv6 address dhcp +! +! This interface uses SLAAC to learn its IPv6 address +interface FastEthernet0/1 +ipv6 address autoconfig + + +Special Addresses Used by Routers +IPv6 configuration on a router begins with the simple steps discussed in the first part of this chapter. After you configure the ipv6 unicast-routing global configuration command, to enable the function of IPv6 routing, the addition of a unicast IPv6 address on an interface causes the router to do the following: + +■ Gives the interface a unicast IPv6 address +■ Enables the routing of IPv6 packets in/out that interface +■ Defines the IPv6 prefix (subnet) that exists off that interface +■ Tells the router to add a connected IPv6 route for that prefix, to the IPv6 routing table, when that interface is up/up +24 + +NOTE In fact, if you pause and look at the list again, the same ideas happen for IPv4 when you configure an IPv4 address on a router interface. + +While all the IPv6 features in this list work much like similar features in IPv4, IPv6 also has a number of additional functions not seen in IPv4. Often, these additional functions use other IPv6 addresses, many of which are multicast addresses. This second major section of the chapter examines the additional IPv6 addresses seen on routers, with a brief description of how they are used. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +566 CCNA 200-301 Official Cert Guide, Volume 1 + +Link-Local Addresses +IPv6 uses link-local addresses as a special kind of unicast IPv6 address. These addresses are not used for normal IPv6 packet flows that contain data for applications. Instead, these +addresses are used by some overhead protocols and for routing. This next topic first looks at how IPv6 uses link-local addresses and then how routers create link-local addresses. + +Link-Local Address Concepts +IPv6 defines rules so that packets sent to any link-local address should not be forwarded by any router to another subnet. As a result, several IPv6 protocols make use of link-local addresses when the protocol’s messages need to stay within the local LAN. For example, Neighbor Discovery Protocol (NDP), which replaces the functions of IPv4’s ARP, uses link-local addresses. + +Routers also use link-local addresses as the next-hop IP addresses in IPv6 routes, as shown in Figure 24-8. IPv6 hosts also use a default router (default gateway) concept, like IPv4, but instead of the router address being in the same subnet, hosts refer to the router’s link-local +address. The show ipv6 route command lists the link-local address of the neighboring router, rather than the global unicast or unique local unicast address. + + +Prefix +Gw=R1 Link Local Subnet 2 + +Next-Hop +R2 Link Local + + +Subnet 2 2001:DB8:1111:2::/64 + + +PC1 PC2 R1 R2 +1 2 + +Figure 24-8 IPv6 Using Link-Local Addresses as the Next-Hop Address + +Following are some key facts about link-local addresses: + +Unicast (not multicast): Link-local addresses represent a single host, and packets sent to a link-local address should be processed by only that one IPv6 host. +Forwarding scope is the local link only: Packets sent to a link-local address do not leave the local data link because routers do not forward packets with link-local destination addresses. +Automatically generated: Every IPv6 host interface (and router interface) can create its own link-local address automatically, solving some initialization problems for hosts before they learn a dynamically learned global unicast address. +Common uses: Link-local addresses are used for some overhead protocols that stay local to one subnet and as the next-hop address for IPv6 routes. + +Creating Link-Local Addresses on Routers +IPv6 hosts and routers can calculate their own link-local address, for each interface, using some basic rules. First, all link-local addresses start with the same prefix, as shown on the left side of Figure 24-9. By definition, the first 10 bits must match prefix FE80::/10, meaning + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 567 + +that the first three hex digits will be either FE8, FE9, FEA, or FEB. However, when following the RFC, the next 54 bits should be binary 0, so the link-local address should always start with FE80:0000:0000:0000 as the first four unabbreviated quartets. + + +64 Bits + +FE80 : 0000 : 0000 : 0000 + +64 Bits + +Interface ID: EUI-64 + + +Figure 24-9 Link-Local Address Format + +The second half of the link-local address, in practice, can be formed using EUI-64 rules, can be randomly generated, or even configured. Cisco routers use the EUI-64 format to create the interface ID (see the earlier section “Generating a Unique Interface ID Using Modified EUI-64”). As a result, a router’s complete link-local address should be unique because the MAC address that feeds into the EUI-64 process should be unique. + +Alternately, some OSs create their link-local addresses by randomly generating the interface ID. For example, Microsoft OSs use a somewhat random process to choose the interface ID and change it over time in an attempt to prevent some forms of attacks. + +IOS creates a link-local address for any interface that has configured at least one other uni-cast address using the ipv6 address command (global unicast or unique local). To see the link-local address, just use the usual commands that also list the unicast IPv6 address: show ipv6 interface and show ipv6 interface brief. Note that Example 24-7 shows an example from Router R1 just after it was configured as shown in Example 24-5 (with the eui-64 key-word on the ipv6 address commands). + +Example 24-7 Comparing Link-Local Addresses with EUI-Generated Unicast Addresses + +R1# show ipv6 interface brief +GigabitEthernet0/0 [up/up] +FE80::1:AAFF:FE00:1 +2001:DB8:1111:1:1:AAFF:FE00:1 + +GigabitEthernet0/1 +unassigned +GigabitEthernet0/0/0 + +[administratively down/down] + +[up/up] + +FE80::32F7:DFF:FE29:8568 +2001:DB8:1111:4:32F7:DFF:FE29:8568 +GigabitEthernet0/0/1 [administratively down/down] 24 unassigned + +First, examine the two pairs of highlighted entries in the example. For each of the two inter-faces that have a global unicast address (G0/0 and G0/0/0), the output lists the global unicast, which happens to begin with 2001 in this case. At the same time, the output also lists the link-local address for each interface, beginning with FE80. + +Next, focus on the two addresses listed under interface G0/0. If you look closely at the sec-ond half of the two addresses listed for interface G0/0, you will see that both addresses have the same interface ID value. The global unicast address was configured in this case with the + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +568 CCNA 200-301 Official Cert Guide, Volume 1 + +ipv6 address 2001:DB8:1111:1::/64 eui-64 command, so the router used EUI-64 logic to form both the global unicast address and the link-local address. The interface MAC address in this case is 0201.AA00.0001, so the router calculates an interface ID portion of both addresses as 0001:AAFF:FE00:0001 (unabbreviated). After abbreviation, Router R1’s link-local address on interface G0/0 becomes FE80::AAFF:FE00:1. + +IOS can either automatically create the link-local address, or it can be configured. IOS chooses the link-local address for the interface based on the following rules: + +■ If configured, the router uses the value in the ipv6 address address link-local interface subcommand. Note that the configured link-local address must be from the correct address range for link-local addresses; that is, an address from prefix FE80::/10. In other words, the address must begin with FE8, FE9, FEA, or FEB. +■ If not configured, the IOS calculates the link-local address using EUI-64 rules, as dis-cussed and demonstrated in and around Example 24-7. The calculation uses EUI-64 rules even if the interface unicast address does not use EUI-64. + +Routing IPv6 with Only Link-Local Addresses on an Interface +This chapter has shown four variations on the ipv6 address command so far. To review: + +ipv6 address address/prefix-length: Static configuration of a specific address +ipv6 address prefix/prefix-length eui-64: Static configuration of a specific prefix and prefix length, with the router calculating the interface ID using EUI-64 rules +ipv6 address dhcp: Dynamic learning on the address and prefix length using DHCP +ipv6 address autoconfig: Dynamic learning of the prefix and prefix length, with the router calculating the interface ID using EUI-64 rules (SLAAC) +This next short topic completes the list with the following command: + +ipv6 enable: Enables IPv6 processing and adds a link-local address, but adds no other uni-cast IPv6 addresses. +The purpose of the ipv6 enable command will not make sense until you realize that some links, particularly WAN links, do not need a global unicast address. Using the backdrop of Figure 24-10, think about the destination of packets sent by hosts like PC1 and PC2. When PC1 sends PC2 an IPv6 packet, the packet holds PC1’s and PC2’s IPv6 addresses and never contains the WAN link’s IPv6 addresses. PC1 and PC2 may need to know the routers’ LAN IPv6 addresses, to use as their default gateway, but the hosts do not need to know the rout-ers’ WAN interface addresses. + +ipv6 enable ipv6 enable + + +PC1 +R1 + +2001:DB8:1111:1::/64 Global Unicast Prefix + + +R2 + +Link Locals Only! + +PC2 + + +2001:DB8:1111:2::/64 Global Unicast Prefix + + +Figure 24-10 Typical Use of the ipv6 enable Command + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 569 + +Additionally, the routers do not need to have global unicast (or unique local) addresses on the WAN links for routing to work. IPv6 routing protocols use link-local addresses as the next-hop address when dynamically building IPv6 routes. Additionally, static routes, as discussed in Chapter 25, “Implementing IPv6 Routing,” can use link-local addresses for the next-hop address. + +In short, creating a WAN link with no global unicast (or unique local) addresses works. As a result, you would not even need to assign an IPv6 subnet to each WAN link. Then to config-ure the WAN interfaces, use the ipv6 enable command, enabling IPv6 and giving each inter-face a generated link-local IPv6 address. + +To use the command, just configure the ipv6 enable command on the interfaces on both ends of the WAN link. + +IPv6 Multicast Addresses +IPv6 uses multicast IPv6 addresses for several purposes. Like IPv4, IPv6 includes a range of multicast addresses that can be used by multicast applications, with many of the same +fundamental concepts as IPv4 multicasts. For instance, IANA defines the range FF30::/12 (all IPv6 addresses that begin with FF3) as the range of addresses to be used for some types of multicast applications. + +Additionally, different IPv6 RFCs reserve multicast addresses for specific purposes. For instance, OSPFv3 uses FF02::5 and FF02::6 as the all-OSPF-routers and all-DR-Routers multicast addresses, respectively, similar to how OSPFv2 uses IPv4 addresses 224.0.0.5 and 224.0.0.6 for the equivalent purposes. + +This next section focuses on IPv6 multicast addresses reserved for use with different proto-cols. The first, link-local multicast addresses, are multicast addresses useful for communicat-ing over a single link. The other type is a special overhead multicast address calculated for each host, called the solicited-node multicast address. + +Reserved Multicast Addresses +Stop for a moment and think about some of the control plane protocols discussed through-out this book so far. Some of those IPv4 control plane protocols used IPv4 broadcasts, meaning that the packet destination address was either 255.255.255.255 (the address for all hosts in the local LAN) or the subnet broadcast address (the address for all hosts in that spe- +cific subnet). Those broadcast packets were then sent as Ethernet broadcast frames, destined 24 to the Ethernet broadcast address of FFFF.FFFF.FFFF. + +While useful, the IPv4 approach of IPv4 broadcast and LAN broadcast requires every host in the VLAN to process the broadcast frame, even if only one other device needed to think about the message. Also, each host has to process the frame, then packet, read the type of message, and so on, before ignoring the task. For example, an IPv4 ARP Request—an IPv4 and LAN broadcast—requires a host to process the Ethernet, IP, and ARP details of the mes-sage before deciding whether to reply or not. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +570 CCNA 200-301 Official Cert Guide, Volume 1 + +IPv6, instead of using Layer 3 and Layer 2 broadcasts, instead uses Layer 3 multicast addresses, which in turn cause Ethernet frames to use Ethernet multicast addresses. As a result: + +■ All the hosts that should receive the message receive the message, which is necessary for the protocols to work. However… +■ …Hosts that do not need to process the message can make that choice with much less processing as compared to IPv4. + +For instance, OSPFv3 uses IPv6 multicast addresses FF02::5 and FF02::6. In a subnet, the OSPFv3 routers will listen for packets sent to those addresses. However, all the endpoint hosts do not use OSPFv3 and should ignore those OSPFv3 messages. If a host receives a packet with FF02::5 as the destination IPv6 address, the host can ignore the packet because the host knows it does not care about packets sent to that multicast address. That check takes much less time than the equivalent checks with IPv4. + +Table 24-3 lists the most common reserved IPv6 multicast addresses. + +Table 24-3 Key IPv6 Local-Scope Multicast Addresses + +Short Name + +All-nodes + +All-routers + +All-OSPF, All-OSPF-DR +RIPng Routers + +Multicast Address +FF02::1 + +FF02::2 + +FF02::5, FF02::6 +FF02::9 + +Meaning + +All-nodes (all interfaces that use IPv6 that are on the link) +All-routers (all IPv6 router interfaces on the link) +All OSPF routers and all OSPF-designated routers, respectively +All RIPng routers + +IPv4 Equivalent + +224.0.0.1 + +224.0.0.2 + +224.0.0.5, 224.0.0.6 + +224.0.0.9 + + +EIGRPv6 FF02::A All routers using EIGRP for IPv6 (EIGRPv6) 224.0.0.10 Routers +DHCP Relay FF02::1:2 All routers acting as a DHCPv6 relay agent None Agent + + + +NOTE An Internet search of “IPv6 Multicast Address Space Registry” will show the IANA page that lists all the reserved values and the RFC that defines the use of each address. + +Example 24-8 repeats the output of the show ipv6 interface command to show the mul-ticast addresses used by Router R1 on its G0/0 interface. In this case, the highlighted lines show the all-nodes address (FF02::1), all-routers (FF02::2), and two for OSPFv3 (FF02::5 and FF02::6). Note that the IPv6 multicast addresses that the router interface is listening for and processing are listed under the heading “Joined group address(es):” at the top of the high-lighted section of the output. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 571 + +Example 24-8 Verifying Static IPv6 Addresses on Router R1 + +R1# show ipv6 interface GigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::1 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:1111:1::1, subnet is 2001:DB8:1111:1::/64 [EUI] +Joined group address(es): +FF02::1 +FF02::2 +FF02::5 +FF02::6 +FF02::1:FF00:1 +! Lines omitted for brevity + + +Multicast Address Scopes +IPv6 RFC 4291 defines IPv6 addressing including the ideas of IPv6 address scope. Each scope defines a different set of rules about whether routers should or should not forward a packet, and how far routers should forward packets, based on those scopes. + +For instance, you read earlier in this chapter about the link-local address on an interface—a unicast IPv6 address—but with a link-local scope. The scope definition called “link-local” dictates that packets sent to a link-local unicast address should remain on the link and not be forwarded by any router. + +Most of the scope discussion in RFC 4291 applies to multicast addresses, using the term multicast scope. Per that RFC, the fourth digit of the multicast address identifies the scope, as noted in Table 24-4. + +Table 24-4 IPv6 Multicast Scope Terms +Scope First Scope Meaning Name Quartet Defined by… + +Interface- FF01 Local + +Link-Local FF02 + +Site-Local FF05 + +Derived by Device + +Derived by Device +Configuration on Routers + +Packet remains within the device. Useful for +internally sending packets to services running on +that same host. 24 + +Host that creates the packet can send it onto the link, but no routers forward the packet. +Intended to be more than Link-Local, so routers forward, but must be less than Organization-Local; generally meant to limit packets so they do not cross WAN links. + + + +Organization- FF08 Local + +Configuration on Routers + +Intended to be broad, probably for an entire company or organization. Must be broader than Site-Local. + +Global FF0E No Boundaries No boundaries. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +572 CCNA 200-301 Official Cert Guide, Volume 1 + +Breaking down the concepts a little further, packets sent to a multicast address with a link-local scope should stay on the local link, that is, the local subnet. Hosts know they can process a link-local packet if received, as do routers. However, routers know to not route the packet to other subnets because of the scope. Packets with an organization-local scope +should be routed inside the organization but not out to the Internet or over a link to another company. (Note that routers can predict the boundaries of some scopes, like link-local, but they need configuration to know the boundaries of other scopes, for instance, organization-local.) + +Comparing a few of the scopes in terms of where the packets can flow, the higher the value in the fourth hex digit, the further away from the sending host the scope allows the packet to be forwarded. Table 24-4 shows that progression top to bottom, while Figure 24-11 shows an example with three scopes: link-local, site-local, and organization-local. In the fig-ure, site-local messages do not cross the WAN, and organization-local messages do not leave the organization over the link to the Internet. + +Organization-local + + +Site-local + + +Link-local +1 +R1 R3 R4 + + + + +2 + + + +Figure 24-11 + +Internet + +R2 + + +IPv6 Multicast Scopes + + +Finally, the term link-local has a couple of common uses in IPv6 and can be confusing as a result. The following descriptions should clarify the different uses of the term: + +Link-local address: An IPv6 address that begins FE80. This serves as a unicast address for an interface to which devices apply a link-local scope. Devices often create their own link-local addresses using EUI-64 rules. A more complete term for comparison would be link-local unicast address. +Link-local multicast address: An IPv6 address that begins with FF02. This serves as a reserved multicast address to which devices apply a link-local scope. +Link-local scope: A reference to the scope itself, rather than an address. This scope defines that routers should not forward packets sent to an address in this scope. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 573 + +Solicited-Node Multicast Addresses +IPv6 Neighbor Discovery Protocol (NDP) replaces IPv4 ARP, as discussed in Chapter 25. NDP improves the MAC-discovery process by sending IPv6 multicast packets that can be processed by the correct host but discarded with less processing by the rest of the hosts in the subnet. The process uses the solicited-node multicast address associated with the unicast IPv6 address. + +Figure 24-12 shows how to determine the solicited node multicast address associated with a unicast address. Start with the predefined /104 prefix (26 hex digits) shown in Figure +24-12. In other words, all the solicited-node multicast addresses begin with the abbreviated FF02::1:FF. In the last 24 bits (6 hex digits), copy the last 6 hex digits of the unicast address into the solicited-node address. + + + +Defined by RFC + + +FF02 : 0000 : 0000 : 0000 : 0000 : 0001 : FF + +Last 6 Hex Digits of Unicast Address + + +_ _ : _ _ _ _ + + + + +Abbreviation: FF02::1:FF_ _ : _ _ _ _ +Figure 24-12 Solicited-Node Multicast Address Format + +Note that a host or router calculates a matching solicited node multicast address for every unicast address on an interface. Example 24-9 shows an example, in which the router interface has a unicast address of 2001:DB8:1111:1::1/64, and a link-local address +of FE80::AA:AAAA. As a result, the interface has two solicited node multicast addresses, shown at the end of the output. + +Example 24-9 Verifying Static IPv6 Addresses on Router R1 + +R1# show ipv6 interface GigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::AA:AAAA +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:1111:1::1, subnet is 2001:DB8:1111:1::/64 [TEN] 24 Joined group address(es): +FF02::1 +FF02::2 +FF02::5 +FF02::1:FF00:1 +FF02::1:FFAA:AAAA +! Lines omitted for brevity + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +574 CCNA 200-301 Official Cert Guide, Volume 1 + +Note that in this case, R1’s global unicast address ends with 00:0001 (unabbreviated), result-ing in an unabbreviated solicited node multicast address of FF02:0000:0000:0000:0000: 0001:FF00:00001. This value begins with the 26-hex-digit prefix shown in Figure 24-12, fol-lowed by 00:0001. The solicited node multicast address corresponding to link-local address FE80::AA:AAAA ends in AA:AAAA and is shown in the last line of the example. + +Miscellaneous IPv6 Addresses +Together, this chapter and the preceding chapter have introduced most of the IPv6 address-ing concepts included in this book. This short topic mentions a few remaining IPv6 address-ing ideas and summarizes the topics for easy study. + +First, all IPv6 hosts can use two additional special addresses: + +■ The unknown (unspecified) IPv6 address, ::, or all 0s +■ The loopback IPv6 address, ::1, or 127 binary 0s with a single 1 + +A host can use the unknown address (::) when its own IPv6 address is not yet known or when the host wonders if its own IPv6 address might have problems. For example, hosts use the unknown address during the early stages of dynamically discovering their IPv6 address. When a host does not yet know what IPv6 address to use, it can use the :: address as its source IPv6 address. + +The IPv6 loopback address gives each IPv6 host a way to test its own protocol stack. Just like the IPv4 127.0.0.1 loopback address, packets sent to ::1 do not leave the host but are instead simply delivered down the stack to IPv6 and back up the stack to the application on the local host. + +Anycast Addresses +Imagine that routers collectively need to implement some service. Rather than have one router supply that service, that service works best when implemented on several routers. But the hosts that use the service need to contact only the nearest such service, and the network wants to hide all these details from the hosts. Hosts can send just one packet to an IPv6 address, and the routers will forward the packet to the nearest router that supports that ser-vice by virtue of supporting that destination IPv6 address. + +IPv6 anycast addresses provide that exact function. The any part of the name refers to the fact that any instances of the service can be used. Figure 24-13 shows this big concept, with two major steps: +Step 1. Two routers configure the exact same IPv6 address, designated as an anycast address, to support some service. + +Step 2. In the future, when any router receives a packet for that anycast address, the other routers simply route the packet to the nearest router that supports the address. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 575 + +Identical Anycast Address Configured on Both Routers + +1 + +R1 R2 + +2 2 + + +R3 R4 R5 R6 R7 R8 +Figure 24-13 IPv6 Anycast Addresses + +To make this anycast process work, the routers implementing the anycast address must be configured and then advertise a route for the anycast address. The addresses do not come from a special reserved range of addresses; instead, they are from the unicast address range. Often, the address is configured with a /128 prefix so that the routers advertise a host route for that one anycast address. At that point, the routing protocol advertises the route just like any other IPv6 route; the other routers cannot tell the difference. + +Example 24-10 shows a sample configuration on a router. Note that the actual address (2001:1:1:2::99) looks like any other unicast address; the value can be chosen like any other IPv6 unicast addresses. However, note the different anycast keyword on the ipv6 address command, telling the local router that the address has a special purpose as an anycast address. Finally, note that the show ipv6 interface command does identify the address as an anycast address, but the show ipv6 interface brief command does not. + +Example 24-10 Configuring and Verifying IPv6 Anycast Addresses + + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface gigabitEthernet 0/0 +R1(config-if)# ipv6 address 2001:1:1:1::1/64 +R1(config-if)# ipv6 address 2001:1:1:2::99/128 anycast +R1(config-if)# ^Z +R1# +R1# show ipv6 interface g0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::11FF:FE11:1111 +No Virtual link-local address(es): +Global unicast address(es): +2001:1:1:1::1, subnet is 2001:1:1:1::/64 +2001:1:1:2::99, subnet is 2001:1:1:2::99/128 [ANY] +! Lines omitted for brevity +R1# show ipv6 interface brief g0/0 +GigabitEthernet0/0 [up/up] +FE80::11FF:FE11:1111 +2001:1:1:1::1 +2001:1:1:2::99 + + + + + + + + + +24 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +576 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE The subnet router anycast address is one special anycast address in each subnet. It is reserved for use by routers as a way to send a packet to any router on the subnet. The address’s value in each subnet is the same number as the subnet ID; that is, the address has the same prefix value as the other addresses and all binary 0s in the interface ID. + + +IPv6 Addressing Configuration Summary +This chapter completes the discussion of various IPv6 address types, while showing how to enable IPv6 on interfaces. Many implementations will use the ipv6 address command on each router LAN interface, and either that same command or the ipv6 enable command on the WAN interfaces. For exam prep, Table 24-5 summarizes the various commands and the automatically generated IPv6 addresses in one place for review and study. + +Table 24-5 Summary of IPv6 Address Types and the Commands That Create Them + +Type + +Global unicast + + +Unique Local + +Link local + + + +All hosts multicast + +All routers multicast + +Routing protocol multicasts +Solicited-node multicast + +Prefix/Address Notes +Many prefixes + + +FD00::/8 + +FE80::/10 + + + +FF02::1 + +FF02::2 + +Various + +FF02::1:FF /104 + +Enabled with What Interface Subcommand + +ipv6 address address/prefix-length + +ipv6 address prefix/prefix-length eui-64 + +ipv6 address prefix/prefix-length eui-64 + +ipv6 address address link-local + +Autogenerated by all ipv6 address commands + +Autogenerated by the ipv6 enable command + +Autogenerated by all ipv6 address commands + +Autogenerated by all ipv6 address commands + +Added to the interface when the corresponding routing protocol is enabled on the interface +Autogenerated by all ipv6 address commands + + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 24-6 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 577 + +Table 24-6 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review command tables + +Review memory tables + +Do labs + +Watch video + +Resource Used Book, website +Book, website + +Book, PTP + +Book + +Website + +Blog + +Website + + + +Review All the Key Topics + + +Table 24-7 +Key Topic Element +Figure 24-2 + +List + +Figure 24-4 + +Key Topics for Chapter 24 +Description Page Number +Conceptual drawing about the need for dual stacks for the 557 foreseeable future +Rules for creating an IPv6 address using EUI-64 rules 561 + +IPv6 EUI-64 Address Format and Rules 561 + + +Figure 24-5 Conceptual drawing of how to create an IPv6 address using EUI-64 561 rules + +Figure 24-6 + +List + +List + +Table 24-4 + +List + +Figure 24-12 + +List + +Table 24-5 + +Example of performing the bit inversion when using EUI-64 562 + +Functions IOS enables when an IPv6 is configured on a working 565 interface +Key facts about IPv6 link-local addresses 566 + +Link-local scope terms and meanings 571 + +Comparisons of the use of the term link-local 572 + +Conceptual drawing of how to make a solicited-node multicast 573 24 address + +Other special IPv6 addresses 574 + +IPv6 address summary with the commands that enable each 576 address type + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +578 CCNA 200-301 Official Cert Guide, Volume 1 + +Key Terms You Should Know +anycast address, dual stacks, EUI-64, link-local address, link-local scope, link-local multicast address, site-local scope, organization-local scope, interface-local scope, IPv6 address scope, solicited-node multicast address, all-nodes multicast address, all-routers multicast address, subnet-router anycast address + +Additional Practice for This Chapter’s Processes +For additional practice with IPv6 abbreviations, you may do the same set of practice prob-lems using your choice of tools: + +For additional practice with calculating IPv6 address using EUI-64 rules and finding the solicited-node multicast address based on a unicast address, use the exercises in Appendix H, “Practice for Chapter 24: Implementing IPv6 Addressing on Routers.” You have two options to use: + +PDF: Navigate to the companion website and open the PDF for Appendix H. +Application: Navigate to the companion website and open the application “Practice Exercise: EUI-64 and Solicited Node Multicast Problems” +Additionally, you can create your own problems using any real router or simulator: Get into the router CLI, into configuration mode, and configure the mac-address address and ipv6 address prefix/64 eui-64 command. Then predict the IPv6 unicast address, link-local address, and solicited-node multicast address; finally, check your predictions against the show ipv6 interface command. + +Command References +Tables 24-8 and 24-9 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + +Table 24-8 +Command + + +Chapter 24 Configuration Command Reference +Description + +ipv6 unicast-routing Global command that enables IPv6 routing on the router. + +ipv6 address ipv6-address/ Interface subcommand that manually configures either the prefix-length [eui-64] entire interface IP address or a /64 prefix with the router +building the EUI-64 format interface ID automatically. + +ipv6 address ipv6-address/ Interface subcommand that manually configures an address to prefix-length [anycast] be used as an anycast address. + + +ipv6 enable + +ipv6 address dhcp + +Command that enables IPv6 on an interface and generates a link-local address. +Interface subcommand that enables IPv6 on an interface, causes the router to use DHCP client processes to try to lease an IPv6 address, and creates a link-local address for the interface. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 24: Implementing IPv6 Addressing on Routers 579 + + +Table 24-9 +Command + +Chapter 24 EXEC Command Reference +Description + + + +show ipv6 route [connected] [local] + +show ipv6 interface [type number] +show ipv6 interface brief [type number] + +Lists IPv6 routes, or just the connected routes, or just the local routes. +Lists IPv6 settings on an interface, including link-local and other unicast IP addresses (or for the listed interface). + +Lists interface status and IPv6 addresses for each interface (or for the listed interface). + + + +Answers to Earlier Practice Problems +Table 24-2, earlier in this chapter, listed several practice problems in which you needed to calculate the IPv6 address based on EUI-64 rules. Table 24-10 lists the answers to those problems. + +Table 24-10 Answers to IPv6 EUI-64 Address Creation Practice + +Prefix 2001:DB8:1:1::/64 +2001:DB8:1:1::/64 + +2001:DB8:1:1::/64 + +2001:DB8:1:1::/64 + +2001:DB8:FE:FE::/64 + +2001:DB8:FE:FE::/64 + +MAC Address 0013.ABAB.1001 +AA13.ABAB.1001 + +000C.BEEF.CAFE + +B80C.BEEF.CAFE + +0C0C.ABAC.CABA + +0A0C.ABAC.CABA + +Unabbreviated IPv6 Address 2001:DB8:1:1:0213:ABFF:FEAB:1001 +2001:DB8:1:1:A813:ABFF:FEAB:1001 + +2001:DB8:1:1:020C:BEFF:FEEF:CAFE + +2001:DB8:1:1:BA0C:BEFF:FEEF:CAFE + +2001:DB8:FE:FE:0E0C:ABFF:FEAC:CABA + +2001:DB8:FE:FE:080C:ABFF:FEAC:CABA + + + + + + + + + + +24 + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 25 + + +Implementing IPv6 Routing 3.0 IP Connectivity +3.3 Configure and verify IPv4 and IPv6 static routing + +3.3.a Default route + +3.3.b Network route + +3.3.c Host route + +3.3.d Floating static + +This last chapter in Part VII of the book completes the materials about IPv6 by examining three major topics. The first section examines IPv6 connected and local routes, similar to IPv4, showing how a router adds both connected and local routes based on each interface IPv6 address. The second major section of this chapter then looks at how to configure static IPv6 routes by typing in commands, in this case using the ipv6 route command instead of IPv4’s ip route command. The final major section examines the Neighbor Discovery Protocol (NDP). + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 25-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Connected and Local IPv6 Routes +Static IPv6 Routes + +The Neighbor Discovery Protocol + +Questions 1–2 +3–6 + +7–8 + + + +Refer to the following figure for questions 1, 3, and 4. + + +S0/1/1 +G0/0 2000:1:2:56::5 +R5 FE80::FF:FE00:5 + +S0/1/0 2000:1:2:56::6 + +FE80::FF:FE00:6 + + +G0/1 +R6 +Subnet 2000:1:2:3:: /64 + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. A router has been configured with the ipv6 address 2000:1:2:3::1/64 command on its G0/1 interface as shown in the figure. The router creates a link-local address of FE80::FF:FE00:1 as well. The interface is working. Which of the following routes will the router add to its IPv6 routing table? (Choose two answers.) +a. A route for 2000:1:2:3::/64 +b. A route for FE80::FF:FE00:1/64 c. A route for 2000:1:2:3::1/128 +d. A route for FE80::FF:FE00:1/128 + +2. A router has been configured with the ipv6 address 3111:1:1:1::1/64 command on its G0/1 interface and ipv6 address 3222:2:2:2::1/64 on its G0/2 interface. Both interfaces are working. Which of the following routes would you expect to see in the output of the show ipv6 route connected command? (Choose two answers.) +a. A route for 3111:1:1:1::/64 b. A route for 3111:1:1:1::1/64 c. A route for 3222:2:2:2::/64 +d. A route for 3222:2:2:2::2/128 + +3. An engineer needs to add a static IPv6 route for prefix 2000:1:2:3::/64 to Router R5’s configuration, in the figure shown with question 1. Which of the following answers shows a valid static IPv6 route for that subnet, on Router R5? +a. ipv6 route 2000:1:2:3::/64 S0/1/1 b. ipv6 route 2000:1:2:3::/64 S0/1/0 c. ip route 2000:1:2:3::/64 S0/1/1 +d. ip route 2000:1:2:3::/64 S0/1/0 + +4. An engineer needs to add a static IPv6 route for prefix 2000:1:2:3::/64 to Router R5 in the figure shown with question 1. Which of the following answers shows a valid static IPv6 route for that subnet on Router R5? +a. ipv6 route 2000:1:2:3::/64 2000:1:2:56::5 b. ipv6 route 2000:1:2:3::/64 2000:1:2:56::6 +c. ipv6 route 2000:1:2:3::/64 FE80::FF:FE00:5 d. ipv6 route 2000:1:2:3::/64 FE80::FF:FE00:6 + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +582 CCNA 200-301 Official Cert Guide, Volume 1 + +5. An engineer types the command ipv6 route 2001:DB8:8:8::/64 2001:DB8:9:9::9 129 in configuration mode of Router R1 and presses Enter. Later, a show ipv6 route com-mand does not list any route for subnet 2001:DB8:8:8::/64. Which of the following could have caused the route to not be in the IPv6 routing table? +a. The command should be using a next-hop link-local address instead of a global unicast. +b. The command is missing an outgoing interface parameter, so IOS rejected the ipv6 route command. +c. The router has no routes that match 2001:DB8:9:9::9. +d. A route for 2001:DB8:8:8::/64 with administrative distance 110 already exists. +6. The command output shows two routes from the longer output of the show ipv6 route command. Which answers are true about the output? (Choose two answers.) +R1# show ipv6 route static +! Legend omitted for brevity +S 2001:DB8:2:2::/64 [1/0] +via 2001:DB8:4:4::4 +S ::/0 [1/0] +via Serial0/0/1, directly connected + +a. The route to ::/0 is added because of an ipv6 route global command. b. The administrative distance of the route to 2001:DB8:2:2::/64 is 1. +c. The route to ::/0 is added because of an ipv6 address interface subcommand. d. The route to 2001:DB8:2:2::/64 is added because of an IPv6 routing protocol. +7. PC1, PC2, and Router R1 all connect to the same VLAN and IPv6 subnet. PC1 wants to send its first IPv6 packet to PC2. What protocol or message will PC1 use to discov-er the MAC address to which PC1 should send the Ethernet frame that encapsulates this IPv6 packet? +a. ARP +b. NDP NS c. NDP RS d. SLAAC +8. Which of the following pieces of information does a router supply in an NDP Router Advertisement (RA) message? (Choose two answers.) + +a. Router IPv6 address +b. Host name of the router c. IPv6 prefix(es) on the link +d. IPv6 address of DHCP server + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 583 + +Foundation Topics + +Connected and Local IPv6 Routes +A Cisco router adds IPv6 routes to its IPv6 routing table for several reasons. Many of you could predict those reasons at this point in your reading, in part because the logic mirrors the logic routers use for IPv4. Specifically, a router adds IPv6 routes based on the following: + +■ The configuration of IPv6 addresses on working interfaces (connected and local routes) ■ The direct configuration of a static route (static routes) +■ The configuration of a routing protocol, like OSPFv3, on routers that share the same data link (dynamic routes) + +The first two sections of this chapter examine the first of these two topics, with discussions of IPv6 routing protocols now residing in the CCNP Enterprise exams. + +Rules for Connected and Local Routes +Routers add and remove connected routes and local routes, based on the interface configura-tion and the interface state. First, the router looks for any configured unicast addresses on any interfaces by looking for the ipv6 address command. Then, if the interface is working—if the interface has a “line status is up, protocol status is up” notice in the output of the show inter-faces command—the router adds both a connected and local route. + +NOTE Routers do not create connected or local IPv6 routes for link-local addresses. + +The connected and local routes themselves follow the same general logic as with IPv4. The connected route represents the subnet connected to the interface, whereas the local route is a host route for only the specific IPv6 address configured on the interface. + +As an example, consider a router, with a working interface, configured with the ipv6 address 2000:1:1:1::1/64 command. The router will calculate the subnet ID based on this address and prefix length, and it will place a connected route for that subnet (2000:1:1:1::/64) into the routing table. The router also takes the listed IPv6 address and creates a host route for that address, with a /128 prefix length. (With IPv4, host routes have a /32 prefix length, while IPv6 uses a /128 prefix length, meaning “exactly this one address.”) + +The following list summarizes the rules about how routers create routes based on the configu-ration of an interface IPv6 unicast address, for easier review and study: +1. Routers create IPv6 routes based on each unicast IPv6 address on an interface, as con- 25 figured with the ipv6 address command, as follows: +A. The router creates a route for the subnet (a connected route). +B. The router creates a host route (/128 prefix length) for the router IPv6 address (a local route). +2. Routers do not create routes based on the link-local addresses associated with the interface. +3. Routers remove the connected and local routes for an interface if the interface fails, and they re-add these routes when the interface is again in a working (up/up) state. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +584 CCNA 200-301 Official Cert Guide, Volume 1 + +Example of Connected IPv6 Routes +While the concept of connected and local IPv6 routes works much like IPv4 routes, seeing a few examples can certainly help. To show some sample routes, Figure 25-1 gives the details of one sample internetwork used in this chapter. The figure shows the IPv6 subnet IDs. The upcoming examples focus on the connected and local routes on Router R1. + + + + +Subnet 1 2001:DB8:1111:1:: /64 + +A + + +Subnet 4 2001:DB8:1111:4:: /64 + + + +S0/0/0 + + + + +S0/0/1 R2 ::2 + +Subnet 2 2001:DB8:1111:2:: /64 + +G0/0 +B +::2 :22 + + + +::11 G0/0 ::1 + +::1 R1 ::1 +G0/1/0 + + + +Subnet 5 2001:DB8:1111:5:: /64 + + + + +::3 + +G0/0/0 R3 + + + + + +G0/0 +C +::3 :33 + +Subnet 3 2001:DB8:1111:3:: /64 + +Figure 25-1 Sample Network Used to Show Connected and Local Routes + +To clarify the notes in Figure 25-1, note that the figure shows IPv6 prefixes (subnets), with a shorthand notation for the interface IPv6 addresses. The figure shows only the abbrevi-ated interface ID portion of each interface address near each interface. For example, R1’s G0/0 interface address would begin with subnet ID value 2001:DB8:1111:1, added to ::1, for 2001:DB8:1111:1::1. + +Now on to the example of connected routes. To begin, consider the configuration of Router R1 from Figure 25-1, as shown in Example 25-1. The excerpt from the show running-config command on R1 shows three interfaces, all of which are working. Also note that no static route or routing protocol configuration exists. + +Example 25-1 IPv6 Addressing Configuration on Router R1 + +ipv6 unicast-routing +! +interface GigabitEthernet0/0 +ipv6 address 2001:DB8:1111:1::1/64 +! +interface Serial0/0/0 +ipv6 address 2001:db8:1111:4::1/64 +! +interface GigabitEthernet0/1/0 +ipv6 address 2001:db8:1111:5::1/64 + + +Answers to the “Do I Know This Already?” quiz: 1 A, C 2 A, C 3 A 4 B 5 C 6 A, B 7 B 8 A, C + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 585 + +Based on Figure 25-1 and Example 25-1, R1 should have three connected IPv6 routes, as highlighted in Example 25-2. + +Example 25-2 Routes on Router R1 Before Adding Static Routes or Routing Protocols + +R1# show ipv6 route +IPv6 Routing Table - default - 7 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP +H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea +IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO +ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect +RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid +lA - LISP away, a - Application +C 2001:DB8:1111:1::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:1111:1::1/128 [0/0] +via GigabitEthernet0/0, receive +C 2001:DB8:1111:4::/64 [0/0] +via Serial0/0/0, directly connected +L 2001:DB8:1111:4::1/128 [0/0] +via GigabitEthernet0/0/0, receive +C 2001:DB8:1111:5::/64 [0/0] +via GigabitEthernet0/1/0, directly connected +L 2001:DB8:1111:5::1/128 [0/0] +via GigabitEthernet0/1/0, receive +L FF00::/8 [0/0] +via Null0, receive + + +All three highlighted routes show the same basic kinds of information, so for discus-sion, focus on the first pair of highlighted lines, which detail the connected route for subnet 2001:DB8:1111:1::/64. The first pair of highlighted lines state: The route is a +“directly connected” route; the interface ID is GigabitEthernet0/0; and the prefix/length is 2001:DB8:1111:1::/64. At the far left, the code letter “C” identifies the route as a connected route (per the legend above). Also note that the numbers in brackets mirror the same ideas as IPv4’s show ip route command: The first number represents the administrative distance, and +the second is the metric. 25 +Examples of Local IPv6 Routes +Continuing this same example, three local routes should exist on R1 for the same three inter-faces as the connected routes. Indeed, that is the case, with one extra local route for other purposes. Example 25-3 shows only the local routes, as listed by the show ipv6 route local command, with highlights of one particular local route for discussion. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +586 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 25-3 Local IPv6 Routes on Router R1 + +R1# show ipv6 route local +! Legend omitted for brevity + +L 2001:DB8:1111:1::1/128 [0/0] +via GigabitEthernet0/0, receive +L 2001:DB8:1111:4::1/128 [0/0] +via Serial0/0/0, receive +L 2001:DB8:1111:5::1/128 [0/0] +via GigabitEthernet0/1/0, receive +L FF00::/8 [0/0] +via Null0, receive + + +For the highlighted local route, look for a couple of quick facts. First, look back to R1’s con-figuration in Example 25-1, and note R1’s IPv6 address on its G0/0 interface. This local route lists the exact same address. Also note the /128 prefix length, meaning this route matches packets sent to that address (2001:DB8:1111:1::1), and only that address. + +NOTE While the show ipv6 route local command shows all local IPv6 routes, the show ipv6 route connected command shows all connected routes. + + +Static IPv6 Routes +While routers automatically add connected and local routes based on the interface configu-ration, static routes require direct configuration with the ipv6 route command. Simply put, someone configures the command, and the router places the details from the command into a route in the IPv6 routing table. + +The ipv6 route command follows the same general logic as does IPv4’s ip route command, as discussed in Chapter 16, “Configuring IPv4 Addressing and Static Routes.” For IPv4, the ip route command starts by listing the subnet ID and mask, so for IPv6, the ipv6 route com-mand begins with the prefix and prefix length. Then the respective commands list the direc-tions of how this router should forward packets toward that destination subnet or prefix by listing the outgoing interface or the address of the next-hop router. + +Figure 25-2 shows the concepts behind a single ipv6 route command, demonstrating the concepts behind a static route on Router R1 for the subnet on the right (subnet 2, or 2001:DB8:1111:2::/64). A static route on R1, for this subnet, will begin with ipv6 route +2001:DB8:1111:2::/64, followed by either the outgoing interface (S0/0/0) or the next-hop IPv6 address, or both. + +Now that you understand the big ideas with IPv6 static routes, the next few pages walk you through a series of examples. In particular, the examples look at configuring static routes with an outgoing interface, then with a next-hop global unicast address, and then with a next-hop link-local address. This section ends with a discussion of static IPv6 default routes. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 587 + +For Packets Destined to this Subnet + +Send out Here or… Send to There + + +A G0/0 S0/0/0 +:11 :1 R1 + +2001:DB8:1111:4::2 G0/0 B +S0/0/1 R2 :2 :22 + + + +Subnet 1 2001:DB8:1111:1:: /64 + +Subnet 4 2001:DB8:1111:4:: /64 + +Subnet 2 2001:DB8:1111:2:: /64 + +Figure 25-2 Logic Behind IPv6 Static Route Commands (IPv6 Route) + +Static Routes Using the Outgoing Interface +This first IPv6 static route example uses the outgoing interface option. As a reminder, for both IPv4 and IPv6 static routes, when the command references an interface, the interface is a local interface. That is, it is an interface on the router where the command is added. In this case, as shown in Figure 25-2, R1’s ipv6 route command would use interface S0/0/0, as shown in Example 25-4. + +Example 25-4 Static IPv6 Routes on Router R1 + +! Static route on router R1 +R1(config)# ipv6 route 2001:db8:1111:2::/64 S0/0/0 + + +While Example 25-4 shows the correct syntax of the route, if using static routes throughout this internetwork, more static routes are needed. For example, to support traffic between hosts A and B, R1 is now prepared. Host A will forward all its IPv6 packets to its default router (R1), and R1 can now route those packets out S0/0/0 to R2 next. However, Router R2 does not yet have a route back to host A’s subnet, subnet 1 (2001:DB8:1111:1::/64), so a com-plete solution requires more routes. + +Example 25-5 solves this problem by giving Router R2 a static route for subnet 1 (2001:DB8:1111:1::/64). After this route is added, hosts A and B should be able to ping each other. + +Example 25-5 Static IPv6 Routes on Router R2 + +! Static route on router R2 +R2(config)# ipv6 route 2001:db8:1111:1::/64 s0/0/1 + + +Many options exist for verifying the existence of the static route and testing whether hosts +can use the route. ping and traceroute can test connectivity. From the router command line, 25 the show ipv6 route command will list all the IPv6 routes. The shorter output of the show +ipv6 route static command, which lists only static routes, could also be used; Example 25-6 shows that output, with the legend omitted. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +588 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 25-6 Verification of Static Routes Only on R1 + +R1# show ipv6 route static +! Legend omitted for brevity +S 2001:DB8:1111:2::/64 [1/0] +via Serial0/0/0, directly connected + + +This command lists many facts about the one static route on R1. First, the code “S” in the left column does identify the route as a static route. (However, the later phrase “directly con-nected” might mislead you to think this is a connected route; trust the “S” code.) Note that the prefix (2001:DB8:1111:2::/64) matches the configuration (in Example 25-4), as does the outgoing interface (S0/0/0). + +While this command lists basic information about each static route, it does not state whether this route would be used when forwarding packets to a particular destination. For example, if host A sent an IPv6 packet to host B (2001:DB8:1111:2::22), would R1 use this static route? As it turns out, R1 would use that route, as confirmed by the show ipv6 route 2001:DB8:1111:2::22 command. This command asks the router to list the route that the +router would use when forwarding packets to that particular address. Example 25-7 shows an example. + +Example 25-7 Displaying the Route R1 Uses to Forward to Host B + +R1# show ipv6 route 2001:db8:1111:2::22 +Routing entry for 2001:DB8:1111:2::/64 +Known via "static", distance 1, metric 0 +Route count is 1/1, share count 0 +Routing paths: +directly connected via Serial0/0/0 +Last updated 00:01:29 ago + + +Static Routes Using Next-Hop IPv6 Address +The previous example used a serial WAN link on purpose. With a point-to-point WAN link, the ipv6 route command can use the outgoing interface style of configuration Static IPv6 routes that refer to a next-hop address have two options: the unicast address on the neigh-boring router (global unicast or unique local) or the link-local address of that same neighbor-ing router. Figure 25-3 spells out those two options with an updated version of Figure 25-2, this time showing Router R2’s global unicast as well as R2’s link-local address. + +For Packets Destined to this Subnet + +Send to Global Unicast + +A G0/0 2001:DB8:1111:4::1 2001:DB8:1111:4::2 G0/0 B :11 :1 R1 FE80::FF:FE00:1 FE80::FF:FE00:2 R2 :2 :22 + +Subnet 1 2001:DB8:1111:1:: /64 + +Subnet 2 +Send to Link-Local 2001:DB8:1111:2:: /64 + +Figure 25-3 Using Unicast or Link-Local as the Next-Hop Address for Static Routes + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 589 + +The next few pages walk you through examples, first with a global unicast as a next-hop and then with a link-local as a next-hop. + +Example Static Route with a Global Unicast Next-Hop Address +This example uses the internetwork shown in Figure 25-3, but with the earlier static routes removed. That is, both routers have only connected and local routes to begin the example. + +In Example 25-8, both R1 and R2 add static routes that refer to the neighbor’s global unicast address. R1 adds a route for subnet 2 (on the right), while R2 adds a route for subnet 1 (on the left). Note that the example shows routes in both directions so that the two hosts can send packets to each other. + +Example 25-8 Static IPv6 Routes Using Global Unicast Addresses + +! The first command is on router R1, listing R2's global unicast address +R1(config)# ipv6 route 2001:db8:1111:2::/64 2001:DB8:1111:4::2 + +! The next command is on router R2, listing R1's global unicast address +R2(config)# ipv6 route 2001:db8:1111:1::/64 2001:db8:1111:4::1 + + +The ipv6 route command itself is relatively straightforward. Focus on R1’s route, which matches the logic shown in Figure 25-3. The command lists subnet 2 (2001:DB8:1111:2::/64). It then lists R2’s global unicast address (ending in 4::2). + +The verification commands on R1, as shown in Example 25-9, list the usual information. Example 25-9 shows two commands, first listing R1’s only static route (the one configured in Example 25-8). The end of the example lists the show ipv6 route 2001:DB8:1111:2::22 command, which lists the route R1 uses when forwarding packets to Host B, proving that R1 uses this new static route when forwarding packets to that host. + +Example 25-9 Verification of Static Routes to a Next-Hop Global Unicast Address + +R1# show ipv6 route static +! Legend omitted for brevity +S 2001:DB8:1111:2::/64 [1/0] +via 2001:DB8:1111:4::2 + +R1# show ipv6 route 2001:db8:1111:2::22/64 +Routing entry for 2001:DB8:1111:2::/64 +Known via "static", distance 1, metric 0 +Backup from "ospf 1 [110]" +Route count is 1/1, share count 0 25 Routing paths: +2001:DB8:1111:4::2 +Last updated 00:07:43 ago + + +Example Static Route with a Link-Local Next-Hop Address +Static routes that refer to a neighbor’s link-local address work a little like both of the preced-ing two styles of static routes. First, the ipv6 route command refers to a next-hop address, + + +|||||||||||||||||||| +|||||||||||||||||||| + + +590 CCNA 200-301 Official Cert Guide, Volume 1 + +namely a link-local address. However, the command must also refer to the router’s local outgoing interface. Why both? The ipv6 route command cannot simply refer to a link-local next-hop address by itself because the link-local address does not, by itself, tell the local router which outgoing interface to use. + +Interestingly, when the ipv6 route command refers to a global unicast next-hop address, the router can deduce the outgoing interface. For example, the earlier example on R1, as shown in Example 25-8, shows R1 with a static IPv6 route with a next-hop IPv6 address of 2001:DB8:1111:4::2. R1 can look at its IPv6 routing table, see its connected route that includes this 2001:DB8:1111:4::2 address, and see a connected route off R1’s S0/0/0. As a +result, with a next-hop global unicast address, R1 can deduce the correct outgoing interface (R1’s S0/0/0). + +With a link-local next-hop address, a router cannot work through this same logic, so the outgoing interface must also be configured. Example 25-10 shows the configuration of static routes on R1 and R2, replacements for the two routes previously configured in Example 25-8. + +Example 25-10 Static IPv6 Routes Using Link-Local Neighbor Addresses + +! The first command is on router R1, listing R2's link-local address +R1(config)# ipv6 route 2001:db8:1111:2::/64 S0/0/0 FE80::FF:FE00:2 + +! The next command is on router R2, listing R1's link-local address +R2(config)# ipv6 route 2001:db8:1111:1::/64 S0/0/1 FE80::FF:FE00:1 + + +Example 25-11 verifies the configuration in Example 25-10 by repeating the show ipv6 route static and show ipv6 route 2001:DB8:1111:2::22 commands used in Example 25-9. Note that the output from both commands differs slightly in regard to the forwarding details. Because the new commands list both the next-hop address and outgoing interface, the show commands also list both the next-hop (link-local) address and the outgoing inter-face. If you refer back to Example 25-9, you will see only a next-hop address listed. + +Example 25-11 Verification of Static Routes to a Next-Hop Link-Local Address + +R1# show ipv6 route static +! Legend omitted for brevity + +S 2001:DB8:1111:2::/64 [1/0] +via FE80::FF:FE00:2, Serial0/0/0 + +R1# show ipv6 route 2001:db8:1111:2::22 +Routing entry for 2001:DB8:1111:2::/64 +Known via "static", distance 1, metric 0 +Backup from "ospf 1 [110]" +Route count is 1/1, share count 0 +Routing paths: +FE80::FF:FE00:2, Serial0/0/0 +Last updated 00:08:10 ago + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 591 + +Static Routes over Ethernet Links +You might have wondered why the chapter shows examples with a serial link, knowing that most networks use fewer and fewer serial links today. Using serial links in the examples avoids one complication when defining static routes that use Ethernet interfaces (LAN or WAN). The next example discusses the issues and shows configuration options for static routes when the outgoing interface is an Ethernet interface. + +To configure a static route that uses an Ethernet interface, the ipv6 route command’s for-warding parameters should always include a next-hop IPv6 address. IOS allows you to con-figure the ipv6 route command using only the outgoing-interface parameter, without listing a next-hop address. The router will accept the command; however, if that outgoing interface happens to be an Ethernet interface, the router cannot successfully forward IPv6 packets using the route. + +To configure the ipv6 route correctly when directing packets out an Ethernet interface, the configuration should use one of these styles: + +■ Refer to the next-hop global unicast address (or unique local address) only +■ Refer to both the outgoing interface and next-hop global unicast address (or unique local address) +■ Refer to both the outgoing interface and next-hop link-local address + +Example 25-12 shows a sample configuration from routers R1 and R3 in Figure 25-4. The top part of the figure shows the details for R1’s route to the subnet on the right side of the figure, with the details labeled with an “A.” The bottom half shows the details for R3’s route to the LAN subnet on the left of the figure, labeled with a “B.” + +A For Packets Destined to this Subnet + +A Send to Global Unicast + +A G0/0 G0/1/0 2001:DB8:1111:5::3 G0/0 C + +:11 :1 R1 2001:DB8:1111:5::1 G0/0/0 +Subnet 1 +2001:DB8:1111:1:: /64 B Send to Neighbor Unicast and Out G0/0/0 + + +R3 :3 :33 +Subnet 2 2001:DB8:1111:3:: /64 + + + +B For Packets Destined to this Subnet 25 Figure 25-4 Network Details for IPv6 Static Routes on an Ethernet Interface + +Example 25-12 Static IPv6 Routes with an Ethernet WAN Interface + +! The first command is on router R1, listing R3's global unicast address +R1(config)# ipv6 route 2001:db8:1111:3::/64 2001:db8:1111:5::3 + +! The next command is on router R2, listing R1's link-local address +R2(config)# ipv6 route 2001:db8:1111:1::/64 G0/0/0 2001:db8:1111:5::1 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +592 CCNA 200-301 Official Cert Guide, Volume 1 + +Static Default Routes +IPv6 supports a default route concept, similar to IPv4. The default route tells the router what to do with an IPv6 packet when the packet matches no other IPv6 route. The logic is pretty basic: + +■ With no default route, the router discards the IPv6 packet. +■ With a default route, the router forwards the IPv6 packet based on the default route. + +Default routes can be particularly useful in a couple of network design cases. For example, with an enterprise network design that uses a single router at each branch office, with one WAN link to each branch, the branch routers have only one possible path over which to forward packets. In a large network, when using a routing protocol, the branch router could learn thousands of routes—all of which point back toward the core of the network over that one WAN link. + +Branch routers could use default routes instead of a routing protocol. The branch router would forward all traffic to the core of the network. Figure 25-5 shows just such an example, with two sample branch routers on the right and a core site router on the left. + + +Default Route (::/0) + + +S0/0/0 G0/0 :1 +:1 Core :1 + + +:2 B1 +S0/0/1 + +Branch Offices + +G0/1/0 G0/0/0 :3 +Default Route (::/0) B2 + +Figure 25-5 Using Static Default Routes at Branches to Forward Back to the Core + +To configure a static default route, use the same rules already discussed in this section of the chapter, but use a specific value to note the route as a default route: ::/0. Taken literally, the double colon (::) is the IPv6 abbreviation for all 0s, and the /0 means the prefix length is 0. This idea mirrors the IPv4 convention to refer to the default route as 0.0.0.0/0. Otherwise, just configure the ipv6 route command as normal. + +Example 25-13 shows one such sample static default route on Router B1 from Figure 25-5. This example uses the outgoing interface option. + +Example 25-13 Static Default Route for Branch Router B1 + +!Forward out B1's S0/0/1 local interface... +B1(config)# ipv6 route ::/0 S0/0/1 + + +With IPv6, the router displays the default a little more cleanly than with IPv4. The show ipv6 route command simply includes the route in the output of the command, along with the other routes. Example 25-14 shows an example, with “::/0” listed to denote this route as the default route. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 593 + +Example 25-14 Router B1’s Static Default Route (Using Outgoing Interface) + +B1# show ipv6 route static +IPv6 Routing Table - default - 10 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, I1 - ISIS L1, I2 - ISIS L2 +IA - ISIS interarea, IS - ISIS summary, D - EIGRP, EX - EIGRP external +ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect +O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +S ::/0 [1/0] +via Serial0/0/1, directly connected + + +Static IPv6 Host Routes +Both IPv4 and IPv6 allow the definition of static host routes—that is, a route to a single host IP address. With IPv4, those routes use a /32 mask, which identifies a single IPv4 address in the ip route command; with IPv6, a /128 mask identifies that single host in the ipv6 route command. + +A host route follows the same rules as a route for any other IPv6 subnet. For instance, if you refer back to Figure 25-3, host B sits on the right side of the figure. Earlier examples showed R1’s static routes for the subnet in which host B resides—for example, the routes for Router R1 in Examples 25-8 and 25-10. To create a host route on R1, referring to host B’s specific IPv6 address, just change those commands to refer to host B’s entire IPv6 address (2001:DB8:1111:2::22), with prefix length /128. + +Example 25-15 shows two sample host routes on Router R1. Both define a host route to host B’s IPv6 address as seen in Figure 25-3. One route uses Router R2’s link-local address as the next-hop address, and one route uses R2’s global unicast address as the next-hop address. + +Example 25-15 Static Host IPv6 Routes on R1, for Host B + +! The first command lists host B's address, prefix length /128, +! with R2's link-local address as next-hop, with an outgoing interface. +R1(config)# ipv6 route 2001:db8:1111:2::22/128 S0/0/0 FE80::FF:FE00:2 +R1(config)# +! The next command also lists host B's address, prefix length /128, +! but with R2's global unicast address as next-hop, and no outgoing interface. +R1(config)# ipv6 route 2001:db8:1111:2::22/128 2001:DB8:1111:4::2 + +25 +Floating Static IPv6 Routes +Next, consider the case in which a static route competes with other static routes or routes learned by a routing protocol. For example, consider the topology shown in Figure 25-6, which shows a branch office with two WAN links: one very fast Gigabit Ethernet link and one rather slow (but cheap) T1. In this design, the network uses OSPFv3 to learn IPv6 routes over the primary link, learning a route for subnet 2001:DB8:1111:7::/64. R1 also defines a + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +594 CCNA 200-301 Official Cert Guide, Volume 1 + +static route over the backup link to that exact same subnet, so R1 must choose whether to use the static route or the OSPF-learned route. + + +Primary Link (OSPF) +R2 +G0/0 EoMPLS + + +Subnet 2001:DB8:1111:7::/64 + + + + +R1 +S0/0/1 + +2001:DB8:1111:9::3 R3 + +Core of the Enterprise Network + +Backup Link (T1; Static) + +Figure 25-6 Using a Floating Static Route to Key Subnet 2001:DB8:1111:7::/64 + +IOS considers static routes better than OSPF-learned routes by default due to administra-tive distance. IOS uses the same administrative distance concept and default values for IPv6 as it does for IPv4. As a result, a static IPv6 route over the lower path would be given an administrative distance of 1, and an OSPFv3-learned route over the top path would +be given an administrative distance of 110. R1 would use the lower path to reach subnet 2001:DB8:1111:7::/64 in this case, which is not the intended design. Instead, the engineer prefers to use the OSPF-learned routes over the much-faster primary link and use the static route over the backup link only as needed when the primary link fails. + +To instead prefer the OSPF routes, the configuration would need to change the administra-tive distance settings and use what many networkers call a floating static route. Like an IPv4 floating static route, an IPv6 floating static route floats or moves into and out of the IPv6 routing table depending on whether the better (lower) administrative distance route learned by the routing protocol happens to exist currently. Basically, the router ignores the static route during times when the better routing protocol route is known. + +To implement an IPv6 floating static route, just override the default administrative distance on the static route, making the value larger than the default administrative distance of the routing protocol. For example, the ipv6 route 2001:db8:1111:7::/64 2001:db8:1111:9::3 130 command on R1 would do exactly that, setting the static route’s administrative distance to 130. As long as the primary link (G0/0) stays up, and OSPFv3 on R1 learns a route for 2001:db8:1111:7::/64 with OSPF’s default administrative distance of 110, R1 ignores the static route whose administrative distance is explicitly configured as 130. + +Finally, note that both the show ipv6 route and show ipv6 route 2001:db8:1111:7::/64 commands list the administrative distance. Example 25-16 shows a sample matching this most recent example. Note that in this case, the static route is in use in the IPv6 routing table. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 595 + +Example 25-16 Displaying the Administrative Distance of the Static Route + +R1# show ipv6 route static +! Legend omitted for brevity +S 2001:db8:1111:7::/64 [130/0] +via 2001:db8:1111:9::3 + +R1# show ipv6 route 2001:db8:1111:7::/64 +Routing entry for 2001:db8:1111:7::/64 +Known via "static", distance 130, metric 0 +Route count is 1/1, share count 0 +Routing paths: +2001:db8:1111:9::3 +Last updated 00:00:58 ago + + +Table 25-2 lists some of the default administrative distance values used with IPv6. + +Table 25-2 IOS Defaults for Administrative Distance + +Route Source Connected routes +Static routes + +NDP + +EIGRP + +OSPF + +RIP + +Unknown or unbelievable + +Administrative Distance 0 +1 + +2 + +90 + +110 + +120 + +255 + + + + +Troubleshooting Static IPv6 Routes +IPv6 static routes have the same potential issues and mistakes as do static IPv4 routes, as discussed in Chapter 16. However, IPv6 static routes do have a few small differences. This last part of the static route content in the chapter looks at troubleshooting IPv6 static routes, reviewing many of the same troubleshooting rules applied to IPv4 static routes, while focus-ing on the details specific to IPv6. + +This topic breaks static route troubleshooting into two perspectives: cases in which the route +is in the routing table but is incorrect, and cases in which the route is not in the routing table. + + + + + + + + +25 + + +Troubleshooting Incorrect Static Routes That Appear in the IPv6 Routing Table +A static route is only as good as the input typed into the ipv6 route command. IOS checks the syntax of the command, of course. However, IOS cannot tell if you choose the incorrect outgoing interface, incorrect next-hop address, or incorrect prefix/prefix-length in a static route. If the parameters pass the syntax checks, IOS places the ipv6 route command into the + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +596 CCNA 200-301 Official Cert Guide, Volume 1 + +running-config file. Then, if no other problem exists (as discussed at the next heading), IOS puts the route into the IP routing table—even though the route may not work because of the poorly chosen parameters. + +For instance, an exam question might show a figure with Router R1 having an address of 2001:1:1:1::1 and neighboring Router R2 with an address of 2001:1:1:1::2. If R1 lists a static route with the command ipv6 route 3333::/64 2001:1:1:1::1, the command would be accepted by IOS with correct syntax, but it would not be effective as a route. Note that the command lists R1’s address as the next-hop address, and R1 cannot use its own IPv6 address as a next-hop address. IOS does not prevent the configuration of the command, however; it allows the command and adds the route to the IPv6 routing table, but the route cannot pos-sibly forward packets correctly. + +When you see an exam question that has static routes, and you see them in the output of show ipv6 route, remember that the routes may have incorrect parameters. Check for these types of mistakes: +Step 1. Prefix/Length: Does the ipv6 route command reference the correct subnet ID (prefix) and mask (prefix length)? + +Step 2. If using a next-hop IPv6 address that is a link-local address: + +A. Is the link-local address an address on the correct neighboring router? (It should be an address on another router on a shared link.) + +B. Does the ipv6 route command also refer to the correct outgoing interface on the local router? + +Step 3. If using a next-hop IPv6 address that is a global unicast or unique local address, is the address the correct unicast address of the neighboring router? + +Step 4. If referencing an outgoing interface, does the ipv6 route command reference the interface on the local router (that is, the same router where the static route is configured)? + + +This troubleshooting checklist works through the various cases in which IOS would accept the configuration of the static IPv6 route, but the route would not work because of the incorrect parameters in context. It helps to see a few examples. Figure 25-7 shows a sample network to use for the examples; all the examples focus on routes added to Router R1, for the subnet on the far right. + +2001:DB8:9:1::/64 2001:DB8:9:2::/64 2001:DB8:9:3::/64 + + +::9 A G0/1 G0/2 +::1 R1 ::1 + +G0/1 G0/2 B ::9 ::2 R2 ::2 +FE80::2 + + +Figure 25-7 Sample Topology for Incorrect IPv6 Route Examples + +Example 25-17 shows five ipv6 route commands. All have correct syntax, but all have one incorrect value; that is, the route will not work because of the types of problems in the + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 597 + +troubleshooting checklist. Look for the short comment at the end of each configuration command to see why each is incorrect. + +Example 25-17 ipv6 route Commands with Correct Syntax but Incorrect Ideas + + +ipv6 route 2001:DB8:9:33::/64 2001:DB8:9:2::2 +ipv6 route 2001:DB8:9:3::/64 G0/2 FE80::AAA9 +ipv6 route 2001:DB8:9:3::/64 FE80::2 +ipv6 route 2001:DB8:9:3::/64 2001:DB8:9:2::1 +ipv6 route 2001:DB8:9:3::/64 G0/1 FE80::2 + +! Step 1: Wrong prefix +! Step 2A: Wrong neighbor link local +! Step 2B: Missing outgoing interface +! Step 3: Wrong neighbor address +! Step 4: Wrong interface on R1 + + + +All these incorrect examples have correct syntax and would be added to R1’s IPv6 routing table if configured on R1. However, all have flaws. Working through the examples in order: + +Step 1. + +Step 2A. + + +Step 2B. + + + +Step 3. + + + + +Step 4. + + +The prefix (2001:DB8:9:33::) has a typo in the fourth quartet (33 instead of 3). + +The figure shows R2’s G0/1 with link-local address FE80::2, but the command uses FE80::AAA9. + +The command uses the correct link-local address on R2’s address on the com-mon link (FE80::2 per the figure), but it omits the outgoing interface of R1’s G0/2 interface. (See the next example for more detail.) + +The figure shows the subnet in the center as 2001:DB8:9:2::/64, with R1 using the ::1 address and R2 using ::2. For the fourth command, R1’s command should use R2’s address 2001:DB8:9:2::2, but it uses R1’s own 2001:DB8:9:2::1 address instead. + +As a command on R1, the outgoing interface references R1’s own interfaces. R1’s G0/1 is the interface on the left, whereas R1 should use its G0/2 interface on the +right when forwarding packets to subnet 2001:DB8:9:3::/64. + + + +The key takeaway for this section is to know that a route in the IPv6 routing table may be incorrect due to poor choices for the parameters. The parameters should always include the neighboring router’s IPv6 addresses, but the local router’s interface type/number, and in all cases, the correct prefix/length. The fact that a route is in the IPv6 routing table, particularly a static route, does not mean it is a correct route. + +Note that of the five example commands in Example 25-17, IOS would accept all of them except the third one. IOS can notice the case of omitting the outgoing interface if the next-hop address is a link-local address. Example 25-18 shows a sample of the error message from +IOS. 25 +Example 25-18 IOS Rejects the ipv6 route Command with Link-Local and No Outgoing Interface + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# ipv6 route 2001:DB8:9:3::/64 FE80::2 +% Interface has to be specified for a link-local nexthop + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +598 CCNA 200-301 Official Cert Guide, Volume 1 + +R1(config)# ^Z +R1# +R1# show running-config | include ipv6 route +R1# + + +The Static Route Does Not Appear in the IPv6 Routing Table +The preceding few pages focused on IPv6 static routes that show up in the IPv6 routing table but unfortunately have incorrect parameters. The next page looks at IPv6 routes that have correct parameters, but IOS does not place them into the IPv6 routing table. + +When you add an ipv6 route command to the configuration, and the syntax is correct, IOS considers that route to be added to the IPv6 routing table. IOS makes the following checks before adding the route; note that IOS uses this same kind of logic for IPv4 static routes: + +■ For ipv6 route commands that list an outgoing interface, that interface must be in an up/up state. +■ For ipv6 route commands that list a global unicast or unique local next-hop IP address (that is, not a link-local address), the local router must have a route to reach that next-hop address. +■ If another IPv6 route exists for that exact same prefix/prefix-length, the static route must have a better (lower) administrative distance. + +The Neighbor Discovery Protocol +Similar to ICMP for IPv4, IPv6 defines the ICMP protocol for IPv6 (ICMPv6). However, ICMPv6 reaches further than ICMPv4, pulling in functions done by other miscellaneous protocols in IPv4. For instance, with IPv4, ARP works as a separate protocol; with IPv6, the Neighbor Discovery Protocol (NDP), a part of ICMPv6, performs the same functions. + +As it turns out, routers play a key role in several NDP protocol functions, so this final major section of the chapter explains a few of the functions of the NDP protocol (RFC 4861). Some of those NDP functions are + +Neighbor MAC Discovery: An IPv6 LAN-based host will need to learn the MAC address of other hosts in the same subnet. NDP replaces IPv4’s ARP, providing messages that replace the ARP Request and Reply messages. +Router Discovery: Hosts learn the IPv6 addresses of the available IPv6 routers in the same subnet. +SLAAC: When using Stateless Address Auto Configuration (SLAAC), the host uses NDP messages to learn the subnet (prefix) used on the link plus the prefix length. +DAD: Before using an IPv6 address, hosts use NDP to perform a Duplicate Address Detection (DAD) process, to ensure no other host uses the same IPv6 address before attempting to use it. + +Discovering Neighbor Link Addresses with NDP NS and NA +NDP replaces IPv4 ARP using a pair of matched solicitation and advertisement messages: the Neighbor Solicitation (NS) and Neighbor Advertisement (NA) messages. Basically, the NS + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 599 + +acts like an IPv4 ARP request, asking the host with a particular unicast IPv6 address to send back a reply. The NA message acts like an IPv4 ARP Reply, listing that host’s MAC address. + +The process of sending the NS and NA messages follows the same general process with IPv4 ARP: the NS message asks for information, and the NA supplies the information, as summa-rized in this list: + +Neighbor Solicitation (NS): This message asks the host with a particular IPv6 address (the target address) to reply with an NA message that lists its MAC address. The NS message is sent to the solicited-node multicast address associated with the target address, so the mes-sage is processed only by hosts whose last six hex digits match the address that is being queried. +Neighbor Advertisement (NA): This message lists the sender’s IPv6 and MAC addresses. It can be sent in reply to an NS message, and if so, the packet is sent to the IPv6 unicast address of the host that sent the original NS message. A host can also send an unsolicited NA, announcing its IPv6 and MAC addresses, in which case the message is sent to the all-IPv6-hosts local-scope multicast address FF02::1. + +NOTE With NDP, the word neighbor refers to the fact that the devices will be on the same data link—for example, the same VLAN. + +Figure 25-8 shows an example of how a host (PC1) uses an NS message to learn the MAC address used by another host. The NS message lists a target IPv6 unicast address, with the implied question: “What is your link address?” The NA message, in this example sent back to the original host that asked the question, lists that link address. + + + +PC1 +2001:DB8:1111:1::11 /64 + +1 NS + +PC2 + +2001:DB8:1111:1::22 /64 MAC 0200:2222:2222 + +Reply if You Are 2001:DB8:1111:1::22 + +NA 2 +I am 2001:DB8:1111:1::22 I am MAC 0200:2222:2222 + +Figure 25-8 Example NDP NS/NA Process to Find the Neighbor’s Link Addresses + +At Step 1 of this particular example, PC1 sends the solicitation to find PC2’s MAC address. +PC1 first looks in its NDP neighbor table, the equivalent of the IPv4 ARP cache, and does 25 not find the MAC address for IPv6 address 2001:DB8:1111:1::22. So, at Step 1, PC1 sends the +NDP NS message to the matching solicited-node multicast address for 2001:DB8:1111:1::22 or FF02::1:FF00:22. Only IPv6 hosts whose address ends with 00:0022 will listen for this solicited-node multicast address. As a result, only a small subset of hosts on this link will process the received NDP NS message. + +At Step 2, PC2 reacts to the received NS message. PC2 sends back an NA message in reply, listing PC2’s MAC address. PC1 records PC2’s MAC address in PC1’s NDP neighbor table. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +600 CCNA 200-301 Official Cert Guide, Volume 1 + +Example 25-19 shows an example of the IPv6 neighbor table on Router R3, as seen originally back in Figure 25-1. In this case, R3 has learned the MAC addresses of Router R1’s WAN interface (G0/1/0)—both its global unicast address as well as the link-local address on that same interface. + +Example 25-19 IPv6 Neighbor Table on Router R3 + +R3# show ipv6 neighbors +IPv6 Address Age Link-layer Addr State Interface + +2001:DB8:1111:5::1 +FE80::1:A0FF:FE10:1 + +0 0201.a010.0001 +0 0201.a010.0001 + +REACH Gi0/0/0 +REACH Gi0/0/0 + + + + +NOTE To view a host’s NDP neighbor table, use these commands: (Windows) netsh interface ipv6 show neighbors; (Linux) ip -6 neighbor show; (Mac OS) ndp -an. + + +Discovering Routers with NDP RS and RA +IPv4 hosts use the concept of an IPv4 default gateway or default router. When the host needs to send a packet to some IPv4 subnet other than the local subnet, the host sends the IPv4 packet to the default router, expecting the router to be able to route the packet to the destination. Note that hosts either statically set the IP address of their default gateway or learn it from a server called a Dynamic Host Configuration Protocol (DHCP) server. + +IPv6 uses the same concept of a default gateway, but it improves the method for hosts to learn the identity of possible default gateways using NDP. NDP defines two messages that allow any host to discover all routers in the subnet: + +Router Solicitation (RS): This message is sent to the “all-IPv6-routers” local-scope multi-cast address of FF02::2 so that the message asks all routers, on the local link only, to iden-tify themselves. +Router Advertisement (RA): This message, sent by the router, lists many facts, including the link-local IPv6 address of the router. When sent in response to an RS message, it flows back to either the unicast address of the host that sent the RS or to the all-IPv6-hosts address FF02::1. Routers also send RA messages without being asked, sent to the all-IPv6-hosts local-scope multicast address of FF02::1. +For example, Figure 25-9 shows how host PC1 can learn R1’s link-local address. The process is indeed simple, with PC1 first asking and R1 replying. + + +PC1 + + +1 RS +All Routers—Identify Yourselves + + +FE80::213:19FF:FE7B:5004 (Link-Local) + + +R1 + + +RA 2 I Am: FE80::213:19FF:FE7B:5004 +Figure 25-9 Example NDP RS/RA Process to Find the Default Routers + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 601 + + +NOTE IPv6 allows multiple prefixes and multiple default routers to be listed in the RA message; Figure 25-9 just shows one of each for simplicity’s sake. + +IPv6 does not use broadcasts, but it does use multicasts. In this case, the RS message flows to the all-routers multicast address (FF02::2) so that all routers will receive the message. It has the same good effect as a broadcast with IPv4, without the negatives of a broadcast. In this case, only IPv6 routers will spend any CPU cycles processing the RS message, and IPv6 hosts will ignore the message. The RA message can flow either to the unicast IPv6 address of PC1 or to the all-nodes FF02::1 address. + +Note that while Figure 25-9 shows how a host can ask to learn about any routers, routers also periodically send unsolicited RA messages, even without an incoming RS. When routers send these periodic RA messages, they basically advertise details about IPv6 on the link. In this case, the RA messages flow to the FF02::1 all-nodes IPv6 multicast address. + +Using SLAAC with NDP RS and RA +Both IPv4 and IPv6 support the idea of dynamic address assignment for hosts via the Dynamic Host Configuration Protocol (DHCP). To find an address to use with DHCP, the DHCP client sends messages to a DHCP server, and the server assigns a currently unused address in the correct subnet for the endpoint host to use. The process relies on DHCP client functions in each device and a DHCP server configured and working in the network. + +IPv6 supports an alternative method for IPv6 hosts to dynamically choose an unused IPv6 address to use—a process that does not require a server like a DHCP server. The process goes by the name Stateless Address Autoconfiguration (SLAAC). SLAAC uses a simple three-step process that begins by learning the prefix/length as shown in the figure. The steps are as follows: +1. Learn the IPv6 prefix used on the link, from any router, using NDP RS/RA messages. +2. Build an address from the prefix plus an interface ID, chosen either by using EUI-64 rules or as a random value. +3. Before using the address, first use DAD to make sure that no other host is already using the same address. + +Figure 25-10 shows the structure of an IPv6 address created with SLACC using Steps 1 and 2 in the process, with the next topic detailing the third step (DAD). + + +1 Learned from Router (NDP RA) 2 + +Prefix + +Chosen by Host + +Interface ID 25 + + + + +EUI-64 or Random +Figure 25-10 Host IPv6 Address Formation Using SLAAC + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +602 CCNA 200-301 Official Cert Guide, Volume 1 + +Discovering Duplicate Addresses Using NDP NS and NA +IPv6 uses the Duplicate Address Detection (DAD) process before using a unicast address to make sure that no other node on that link is already using the address. Hosts use DAD +not only at the end of the SLAAC process, but also any time that a host interface initializes, no matter whether using SLAAC, DHCP, or static address configuration. When perform- +ing DAD, if another host already uses that address, the first host simply does not use the address until the problem is resolved. + +The term DAD refers to the function, but the function uses NDP NS and NA messages. Basically, a host sends an NS message for its own IPv6 address. No other host should be using that address, so no other host should send an NDP NA in reply. However, if another host already uses that address, that host will reply with an NA, identifying a duplicate use of the address. + +Figure 25-11 shows an example. PC1 initializes and does a DAD check, but PC2 happens to already be working and already be using the address. The figure shows the following steps: +1. PC1, before using address 2001:DB8:1111:1::11, must use DAD. +2. PC1 sends an NS message, listing the address PC1 now wants to use (2001:DB8:1111:1::11) as the target. +3. PC2 receives the NS, sees what PC2 already uses as its own address, and sends back an NA. +4. PC1, on receiving the NA message for its own IPv6 address, realizes a duplicate address exists. + + +1 + +Do DAD: Send NS for Myself + + +PC1 + +4 + +Got NA—Must be a Duplicate! + + +PC2 + + + +2001:DB8:1111:1::11 /64 + +2 NS + +2001:DB8:1111:1::11 /64 MAC 0200:2222:2222 + +Reply if You Are 2001:DB8:1111:1::11 + +NA 3 I am 2001:DB8:1111:1::11 +I am MAC 0200:2222:2222 +Figure 25-11 Example Duplicate Address Detection (DAD) with NDP NS/NA + +Hosts do the DAD check for each of their unicast addresses, link-local addresses included, both when the address is first used and each time the host’s interface comes up. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 603 + +NDP Summary +This chapter explains some of the more important functions performed by NDP. NDP does more than what is listed in this chapter, and the protocol allows for addition of other func-tions, so NDP might continue to grow over time. For now, use Table 25-3 as a study refer-ence for the four NDP features discussed here. + + +Table 25-3 +Function + +NDP Function Summary +Protocol Who Who Info Supplied Messages Discovers Info Supplies Info + + + +Router discovery + +RS and RA Any IPv6 host Any IPv6 Link-local IPv6 address of router router + + + +Prefix/length RS and RA Any IPv6 host discovery + +Any IPv6 router + +Prefix(es) and associated prefix lengths used on local link + + + +Neighbor discovery +Duplicate Address Detection + +NS and NA Any IPv6 host + +NS and NA Any IPv6 host + +Any IPv6 host +Any IPv6 host + +Link-layer address (for example, MAC address) used by a neighbor +Simple confirmation whether a unicast address is already in use + + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 25-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 25-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Answer DIKTA questions + +Review command tables + +Review memory tables + +Do labs + +Resource Used Book, website +Book, PTP + +Book + +Book, website 25 Blog + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +604 CCNA 200-301 Official Cert Guide, Volume 1 + +Review All the Key Topics + + +Table 25-5 +Key Topic Element +List + +List + +Figure 25-2 + +Checklist + +Checklist + +List + +List + +List + +Key Topics for Chapter 25 +Description Page Number +Methods by which a router can build IPv6 routes 583 + +Rules for IPv6 connected and local routes 583 + +IPv6 static route concepts 587 + +Items to check on ipv6 route command that cause problems with 596 IPv6 static routes +Items to check other than the ipv6 route command that cause 598 problems with IPv6 static routes +Four functions that use NDP messages 598 + +NDP NS and NA messages and meanings 599 + +NDP RS and RA messages and meanings 600 + + + +Figure 25-11 + +Table 25-3 + +Example DAD check 602 + +NDP Function summary table 603 + + + +Key Terms You Should Know +IPv6 host route, local route, IPv6 local route, IPv6 administrative distance, IPv6 multicast scope + +Command References +Tables 25-6 and 25-7 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + +Table 25-6 +Command + +Chapter 25 Configuration Command Reference +Description + + + +ipv6 route prefix/length next-hop-address + +ipv6 route prefix/length outgoing-interface + +ipv6 route prefix/length outgoing-interface next-hop-address + +Global command to define an IPv6 static route to a next-hop router IPv6 address. + +Global command to define an IPv6 static route, with packets forwarded out the local router interface listed in the command. +Global command to define an IPv6 static route, with both the next-hop address and local router outgoing interface listed. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 25: Implementing IPv6 Routing 605 + + +Command +ipv6 route ::/0 {[next-hop-address] [outgoing-interface]} + +ipv6 address autoconfig [default] + +Description +Global command to define a default IPv6 static route. + +Interface subcommand that tells the router to use SLAAC to find/build its own interface IPv6 address, and with the default parameter, to add a default route with a next hop of the router that responds with the RA message. + + + + +Table 25-7 +Command + +Chapter 25 EXEC Command Reference +Description + + + +show ipv6 route [connected | local | static] + +show ipv6 route address + + +show ipv6 neighbors + +Lists routes in the routing table. + +Displays detailed information about the route this router uses to forward packets to the IPv6 address listed in the command. +Lists the contents of the IPv6 neighbor table, which lists the MAC address associated with IPv6 addresses on common subnets. + + + + + + + + + + + + + + + + + + + +25 + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part VII Review + +Keep track of your part review progress with the checklist in Table P7-1. Details on each task follow the table. + + +Table P7-1 + +Activity + +Part VII Part Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Do Labs + +Watch Videos + + +Repeat All DIKTA Questions +For this task, use the PCPT software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or using the Key Topics application on the companion website. + +Do Labs +Depending on your chosen lab tool, here are some suggestions for what to do in lab: + +Pearson Network Simulator: If you use the full Pearson simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) + +Blog: Config Labs: The author’s blog includes a series of configuration-focused labs that you can do on paper, each in 10–15 minutes. Review and perform the labs for this part of the book, as found at http://blog.certskills.com. Then navigate to the Hands-on Config labs. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Other: If using other lab tools, here are a few suggestions: Configure IPv6 addresses on interfaces, and before using any show commands, predict the connected and local +routes that should be added to the IPv6 routing table, and predict the link-local (unicast) address and various multicast addresses you expect to see in the output of the show ipv6 interfaces command. + +Watch Videos +Chapter 24 mentions that the companion website’s section for Chapter 24 review includes a video about the EUI-64 address generation process, so consider using the video as a review. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + +This book began with an overview of the fundamentals of LANs, WANs, and IP routing. It then described Ethernet LANs (wired LANs) in some depth over the course of seven chap-ters. The book then meandered through many chapters exploring the many concepts of IPv4 and IPv6 addressing, routing, and how to implement those features in Cisco devices. + +This final part of Volume 1 turns our attention back to the LAN, not to wired Ethernet LANs, but to IEEE 802.11 wireless LANs—in other words, Wi-Fi. The four chapters in this part of the book lay down the foundations of how wireless LANs work and then show how to implement wireless LANs using Cisco devices. + +Building wireless LANs requires some thought because the endpoints that use the LAN do not sit in one place and connect via a known cable and known switch port. To explain +those details, Chapter 26 begins with the basics of how a wireless client can connect to the wireless network through a wireless access point (AP). After you learn the foundations in Chapter 26, Chapter 27 takes an architectural view of wireless LANs to discuss how you might build a wireless LAN for an enterprise, which requires much different thinking than, for instance, building a wireless LAN for your home. + +Chapter 28 completes the three concepts-focused wireless LAN chapters by working through the alphabet soup that is wireless LAN security. The fact that wireless LAN clients come and go means that the LAN may be under constant attack as an easy place for an attacker to gain access to the network, so wireless LANs must use effective security. Finally, Chapter 29 closes by showing how to configure an enterprise wireless LAN using Cisco APs and the Cisco Wireless LAN Controller (WLC) from the WLC’s graphical interface. + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part VIII + + +Wireless LANs + + + + +Chapter 26: Fundamentals of Wireless Networks + +Chapter 27: Analyzing Cisco Wireless Architectures + +Chapter 28: Securing Wireless Networks + +Chapter 29: Building a Wireless LAN + +Part VIII Review + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 26 + + +Fundamentals of Wireless Networks + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.d Access Points + +1.11 Describe wireless principles + +1.11.a Nonoverlapping Wi-Fi channels + +1.11.b SSID + +1.11.c RF + +Wireless communication usually involves a data exchange between two devices. A wire-less LAN goes even further; many devices can participate in sharing the medium for data exchanges. Wireless LANs must transmit a signal over radio frequencies (RF) to move data from one device to another. Transmitters and receivers can be fixed in consistent locations, or they can be mobile and free to move around. This chapter explains the topologies that can be used to control access to the wireless medium and provide data exchange between devices. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 26-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Comparing Wired and Wireless Networks + +Wireless LAN Topologies + +Other Wireless Topologies + +Wireless Bands and Channels + +Questions 1 +2–4 + +5–6 + +7–8 + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Wired Ethernet and Wi-Fi are based on which two IEEE standards, respectively? a. 802.1, 802.3 +b. 802.3, 802.1 c. 802.3, 802.11 d. 802.11, 802.3 +2. Devices using a wireless LAN must operate in which one of the following modes? a. Round-robin access +b. Half duplex c. Full duplex +d. None of these answers + +3. An access point is set up to offer wireless coverage in an office. Which one of the fol-lowing is the correct 802.11 term for the resulting standalone network? +a. BSA b. BSD c. BSS d. IBSS +4. Which one of the following is used to uniquely identify an AP and the basic service set it maintains with its associated wireless clients? +a. SSID b. BSSID +c. Ethernet MAC address d. Radio MAC address +5. Which one of the following can be used to provide wireless connectivity to a nonwire-less device? +a. Wireless repeater b. Workgroup bridge c. Transparent bridge d. Adaptive bridge +6. Which one of the following is not needed in a Cisco outdoor mesh network? a. A BSS function +b. Ethernet cabling to each AP c. A workgroup bridge +d. A backhaul network + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +612 CCNA 200-301 Official Cert Guide, Volume 1 + +7. Which of the following are frequency bands commonly used for Wi-Fi? a. 2.5 KHz +b. 2.5 MHz c. 5 MHz d. 2.5 GHz e. 5 GHz +8. Which of the following are considered to be nonoverlapping channels? + +a. Channels 1, 2, and 3 in the 2.4-GHz band b. Channels 1, 5, and 10 in the 2.4-GHz band c. Channels 1, 6, and 11 in the 2.4-GHz band d. Channels 40, 44, and 48 in the 5-GHz band + +Foundation Topics + +Comparing Wired and Wireless Networks +In a wired network, any two devices that need to communicate with each other must be connected by a wire. (That was obvious!) The “wire” might contain strands of metal or fiber-optic material that run continuously from one end to the other. Data that passes over the wire is bounded by the physical properties of the wire. In fact, the IEEE 802.3 set of stan-dards defines strict guidelines for the Ethernet wire itself, in addition to how devices may connect, send, and receive data over the wire. + +Wired connections have been engineered with tight constraints and have few variables that might prevent successful communication. Even the type and size of the wire strands, the number of twists the strands must make around each other over a distance, and the maxi-mum length of the wire must adhere to the standard. + +Therefore, a wired network is essentially a bounded medium; data must travel over whatever path the wire or cable takes between two devices. If the cable goes around a corner or lies in a coil, the electrical signals used to carry the data must also go around a corner or around a coil. Because only two devices may connect to a wire, only those two devices may send or transmit data. Even better: the two devices may transmit data to each other simultaneously because they each have a private, direct path to each other. + +Wired networks also have some shortcomings. When a device is connected by a wire, it can-not move around very easily or very far. Before a device can connect to a wired network, it must have a connector that is compatible with the one on the end of the wire. As devices get smaller and more mobile, it just is not practical to connect them to a wire. + +As its name implies, a wireless network removes the need to be tethered to a wire or cable. Convenience and mobility become paramount, enabling users to move around at will while staying connected to the network. A user can (and often does) bring along many different wireless devices that can all connect to the network easily and seamlessly. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 613 + +Wireless data must travel through free space, without the constraints and protection of a wire. In the free space environment, many variables can affect the data and its delivery. To minimize the variables, wireless engineering efforts must focus on two things: + +■ Wireless devices must adhere to a common standard (IEEE 802.11). +■ Wireless coverage must exist in the area where devices are expected to use it. + +As you study for the CCNA 200-301 exam, keep in mind that the exam is geared more toward a functional view of wireless technology. More detailed topics like RF characteristics, antenna performance, and so on are reserved for the Implementing Cisco Enterprise Network Core Technologies ENCOR 300-401 exam. + +Wireless LAN Topologies +Wireless communication takes place over free space through the use of radio frequency (RF) signals. The theory behind RF signals can be complex, and is described further in the “RF Overview” section in this chapter. For now, just assume that one device, the transmit-ter, sends RF signals to another device, the receiver. As Figure 26-1 shows, the transmitter can contact the receiver at any and all times, as long as both devices are tuned to the same frequency (or channel) and use the same scheme to carry the data between them. That all sounds simple, except that it is not really practical. + + +Transmitter + +Device A + +Receiver + +Device B + + +Figure 26-1 Unidirectional Communication + +To fully leverage wireless communication, data should travel in both directions, as shown in Figure 26-2. Sometimes Device A needs to send data to Device B, while Device B would like to take a turn to send at other times. + + +Transmitter + +Device A + +Receiver + +Receiver + +Device B + +Transmitter + +Figure 26-2 Bidirectional Communication + +Because the two devices are using the same channel, two phrases in the preceding sentence become vitally important: take a turn and send at other times. With wireless communica-tion, if multiple signals are received at the same time, they can interfere with each other. The likelihood of interference increases as the number of wireless devices grows. For example, Figure 26-3 shows four devices tuned to the same channel and what might happen if some or +all of them transmit at the same time. 26 Device A Device B Device C Device D + + + +Figure 26-3 Interference from Simultaneous Transmissions + + +|||||||||||||||||||| +|||||||||||||||||||| + + +614 CCNA 200-301 Official Cert Guide, Volume 1 + +All this talk about waiting turns and avoiding interference might remind you of a traditional (nonswitched) Ethernet LAN, where multiple hosts can connect to a shared media and share a common bandwidth. To use the media effectively, all the hosts must operate in half-duplex mode so that they try to avoid colliding with other transmissions already in progress. The side effect is that no host can transmit and receive at the same time on a shared medium. + +A wireless LAN is similar. Because multiple hosts can share the same channel, they also share the “airtime” or access to that channel at any given time. Therefore, to keep everything clean, only one device should transmit at any given time. To contend for use of the channel, devic-es based on the 802.11 standard have to determine whether the channel is clear and available before transmitting anything. + +NOTE IEEE 802.11 WLANs are always half duplex because transmissions between sta-tions use the same frequency or channel. Only one station can transmit at any time; other-wise, collisions occur. To achieve full-duplex mode, one station’s transmission would have to occur on one frequency while it receives over a different frequency—much like full-duplex Ethernet links work. Although this is certainly possible and practical, the 802.11 standard does not permit full-duplex operation. Some amendments to the standard do provide a means for multiple devices to transmit on the same channel at the same time, but this is beyond the scope of this book. + +At the most basic level, there is no inherent organization to a wireless medium or any inher-ent control over the number of devices that can transmit and receive frames. Any device that has a wireless network adapter can power up at any time and try to communicate. At a +minimum, a wireless network should have a way to make sure that every device using a chan-nel can support a common set of parameters. Beyond that, there should be a way to control which devices (and users) are allowed to use the wireless medium and the methods that are used to secure the wireless transmissions. + +Basic Service Set +The solution is to make every wireless service area a closed group of mobile devices that forms around a fixed device; before a device can participate, it must advertise its capabili-ties and then be granted permission to join. The 802.11 standard calls this a basic service set (BSS). At the heart of every BSS is a wireless access point (AP), as shown in Figure 26-4. The AP operates in infrastructure mode, which means it offers the services that are necessary to form the infrastructure of a wireless network. The AP also establishes its BSS over a single wireless channel. The AP and the members of the BSS must all use the same channel to com-municate properly. + +Because the operation of a BSS hinges on the AP, the BSS is bounded by the area where the AP’s signal is usable. This is known as the basic service area (BSA) or cell. In Figure 26-4, the cell is shown as a simple shaded circular area that centers around the AP itself. Cells can + + +Answers to the “Do I Know This Already?” quiz: 1 C 2 B 3 C 4 B 5 B 6 B 7 D, E 8 C, D + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 615 + +have other shapes too, depending on the antenna that is connected to the AP and on the physical surroundings that might affect the AP’s signals. + +The AP serves as a single point of contact for every device that wants to use the BSS. It advertises the existence of the BSS so that devices can find it and try to join. To do that, the AP uses a unique BSS identifier (BSSID) that is based on the AP’s own radio MAC address. + +NOTE Recall that wired Ethernet devices each have a unique MAC address to send frames from a source to a destination over a Layer 2 network. Wireless devices must also have unique MAC addresses to send wireless frames at Layer 2 over the air. + + +BSS SSID: “MyNetwork” + + + +BSSID: d4:20:6d:90:ad:20 + + + + + +AP + + + + + + + + + + +Figure 26-4 802.11 Basic Service Set + +In addition, the AP advertises the wireless network with a Service Set Identifier (SSID), which is a text string containing a logical name. Think of the BSSID as a machine-readable name tag that uniquely identifies the BSS ambassador (the AP), and the SSID as a nonunique, human-readable name tag that identifies the wireless service. + +Membership with the BSS is called an association. A wireless device must send an associa-tion request to the AP and the AP must either grant or deny the request. Once associated, +a device becomes a client, or an 802.11 station (STA), of the BSS. What then? As long as a +wireless client remains associated with a BSS, most communications to and from the client 26 +must pass through the AP, as indicated in Figure 26-5. By using the BSSID as a source or destination address, data frames can be relayed to or from the AP. + +You might be wondering why all client traffic has to traverse the AP at all. Why can two clients not simply transmit data frames directly to each other and bypass the middleman? If clients + + +|||||||||||||||||||| +|||||||||||||||||||| + + +616 CCNA 200-301 Official Cert Guide, Volume 1 + +are allowed to communicate directly, then the whole idea of organizing and managing a BSS is moot. By sending data through the AP first, the BSS remains stable and under control. + +NOTE Even though data frames are meant to pass through an AP, keep in mind that other devices in the same general area that are listening on the same channel can overhear the transmissions. After all, wireless frames are not contained within a wire that connects a device to an AP. Instead, the frames are freely available over the air to anyone that is within range to receive them. If the frames are unencrypted, then anyone may inspect their con-tents. Only the BSSID value contained within the frames indicates that the intended sender or recipient is the AP. + +BSS SSID: “MyNetwork” + + + +BSSID: d4:20:6d:90:ad:20 + + + + + + +AP + + + + + + + + + + +Figure 26-5 Traffic Flows Within a BSS + +Distribution System +Notice that a BSS involves a single AP and no explicit connection into a regular Ethernet net-work. In that setting, the AP and its associated clients make up a standalone network. But the AP’s role at the center of the BSS does not just stop with managing the BSS; sooner or later, wireless clients will need to communicate with other devices that are not members of the BSS. Fortunately, an AP can also uplink into an Ethernet network because it has both wire-less and wired capabilities. The 802.11 standard refers to the upstream wired Ethernet as the distribution system (DS) for the wireless BSS, as shown in Figure 26-6. + +You can think of an AP as a translational bridge, where frames from two dissimilar media (wireless and wired) are translated and then bridged at Layer 2. In simple terms, the AP is in charge of mapping a virtual local-area network (VLAN) to an SSID. In Figure 26-6, the AP + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 617 + +maps VLAN 10 to the wireless LAN using SSID “MyNetwork.” Clients associated with the “MyNetwork” SSID will appear to be connected to VLAN 10. + + + + + + + +DS + + + +VLAN 10 +SSID: “MyNetwork” + + +BSS BSSID: d4:20:6d:90:ad:20 + + + + +AP + + + + + + + + + +Figure 26-6 Distribution System Supporting a BSS + + +This concept can be extended so that multiple VLANs are mapped to multiple SSIDs. To do this, the AP must be connected to the switch by a trunk link that carries the VLANs. In Figure 26-7, VLANs 10, 20, and 30 are trunked to the AP over the DS. The AP uses the 802.1Q tag to map the VLAN numbers to the appropriate SSIDs. For example, VLAN 10 is mapped to SSID “MyNetwork,” VLAN 20 is mapped to SSID “YourNetwork,” and VLAN 30 to SSID “Guest.” + +In effect, when an AP uses multiple SSIDs, it is trunking VLANs over the air, and over the same channel, to wireless clients. The clients must use the appropriate SSID that has been mapped to the respective VLAN when the AP was configured. The AP then appears as mul-tiple logical APs—one per BSS—with a unique BSSID for each. With Cisco APs, this is usu-ally accomplished by incrementing the last digit of the radio’s MAC address for each SSID. + +Even though an AP can advertise and support multiple logical wireless networks, each of the SSIDs covers the same geographic area. The reason is that the AP uses the same transmitter, receiver, antennas, and channel for every SSID that it supports. Beware of one misconception +though: multiple SSIDs can give an illusion of scale. Even though wireless clients can be + + + + + + + + + + +26 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +618 CCNA 200-301 Official Cert Guide, Volume 1 + +distributed across many SSIDs, all of those clients must share the same AP’s hardware and must contend for airtime on the same channel. + + + + + + +DS + + + +802.1Q Trunk VLANs 10, 20, 30 + + + +SSID: “MyNetwork” + +SSID: “YourNetwork” + +SSID: “Guest” + + + +BSSID: d4:20:6d:90:ad:21 + +BSSID: d4:20:6d:90:ad:22 + +BSSID: d4:20:6d:90:ad:23 + +Figure 26-7 Supporting Multiple SSIDs on One AP + +Extended Service Set +Normally, one AP cannot cover the entire area where clients might be located. For example, you might need wireless coverage throughout an entire floor of a business, hotel, hospital, or other large building. To cover more area than a single AP’s cell can cover, you simply need to add more APs and spread them out geographically. + +When APs are placed at different geographic locations, they can all be interconnected by a switched infrastructure. The 802.11 standard calls this an extended service set (ESS), as shown in Figure 26-8. + +The idea is to make multiple APs cooperate so that the wireless service is consistent and seamless from the client’s perspective. Ideally, any SSIDs that are defined on one AP should be defined on all the APs in an ESS; otherwise, it would be very cumbersome and inconve-nient for a client to be reconfigured each time it moves into a different AP’s cell. + +Notice that each cell in Figure 26-8 has a unique BSSID, but both cells share one common SSID. Regardless of a client’s location within the ESS, the SSID will remain the same but the client can always distinguish one AP from another. + +In an ESS, a wireless client can associate with one AP while it is physically located near that AP. If the client later moves to a different location, it can associate with a different nearby AP automatically. Passing from one AP to another is called roaming. Keep in mind that each AP offers its own BSS on its own channel, to prevent interference between the APs. As a cli-ent device roams from one AP to another, it must scan the available channels to find a new AP (and BSS) to roam toward. In effect, the client is roaming from BSS to BSS, and from channel to channel. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 619 + + + + + + + + + + + + +ESS + + +BSS-1 + + +AP-1 + +BSSID: d4:20:6d:90:ad:20 + + + + + + + +SSID: “MyNetwork” + +VLAN 10 + + +BSS-2 + + +AP-2 +BSSID: e6:22:47:af:c3:70 + + + + + + + +SSID: “MyNetwork” + + + + +Figure 26-8 Scaling Wireless Coverage with an 802.11 Extended Service Set + + +Independent Basic Service Set +Usually a wireless network leverages APs for organization, control, and scalability. Sometimes that is not possible or convenient in an impromptu situation. For example, two people who want to exchange electronic documents at a meeting might not be able to find a BSS available or might want to avoid having to authenticate to a production network. In addition, many personal printers have the capability to print documents wirelessly, without relying on a regular BSS or AP. + +The 802.11 standard allows two or more wireless clients to communicate directly with each other, with no other means of network connectivity. This is known as an ad hoc wireless net-work, or an independent basic service set (IBSS), as shown in Figure 26-9. For this to work, one of the devices must take the lead and begin advertising a network name and the neces-sary radio parameters, much like an AP would do. Any other device can then join as needed. IBSSs are meant to be organized in an impromptu, distributed fashion; therefore, they do not +scale well beyond eight to ten devices. + + + + + + + + + + + + +26 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +620 CCNA 200-301 Official Cert Guide, Volume 1 + +IBSS + + + + + + + + +Figure 26-9 802.11 Independent Basic Service Set + +Other Wireless Topologies +Wireless APs can be configured to operate in noninfrastructure modes when a normal BSS cannot provide the functionality that is needed. The following sections cover the most com-mon modes. + +Repeater +Normally, each AP in a wireless network has a wired connection back to the DS or switched infrastructure. To extend wireless coverage beyond a normal AP’s cell footprint, additional APs and their wired connections can be added. In some scenarios, it is not possible to run +a wired connection to a new AP because the cable distance is too great to support Ethernet communication. + +In that case, you can add an additional AP that is configured for repeater mode. A wireless repeater takes the signal it receives and repeats or retransmits it in a new cell area around the repeater. The idea is to move the repeater out away from the AP so that it is still within range of both the AP and the distant client, as shown in Figure 26-10. + + +BSS + + + +AP Repeater + + + +Client B + + + + +Client A + +Figure 26-10 Extending the Range of an AP with a Wireless Repeater + +If the repeater has a single transmitter and receiver, it must operate on the same channel that the AP is using. That can create the possibility that the AP’s signal will be received and retransmitted by the repeater, only to be received again by the AP—halving the effective + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 621 + +throughput because the channel will be kept busy twice as long as before. As a remedy, some repeaters can use two transmitters and receivers to keep the original and repeated signals isolated on different channels. One transmitter and receiver pair is dedicated to signals in the AP’s cell, while the other pair is dedicated to signals in the repeater’s own cell. + +Workgroup Bridge +Suppose you have a device that supports a wired Ethernet link but is not capable of having a wireless connection. For example, some mobile medical devices might be designed with only a wired connection. While it is possible to plug the device into an Ethernet connection when needed, a wireless connection would be much more practical. You can use a workgroup bridge (WGB) to connect the device’s wired network adapter to a wireless network. + +Rather than providing a BSS for wireless service, a WGB becomes a wireless client of a BSS. In effect, the WGB acts as an external wireless network adapter for a device that has none. In Figure 26-11, an AP provides a BSS; Client A is a regular wireless client, while Client B is associated with the AP through a WGB. + +BSS + + + + + + +AP + +WGB + + + + +Client A Client B + + + +Figure 26-11 Nonwireless Device Connecting Through a Workgroup Bridge + +You might encounter two types of workgroup bridges: + +■ Universal workgroup bridge (uWGB): A single wired device can be bridged to a wireless network. +■ Workgroup bridge (WGB): A Cisco-proprietary implementation that allows multiple +wired devices to be bridged to a wireless network. 26 +Outdoor Bridge +An AP can be configured to act as a bridge to form a single wireless link from one LAN to another over a long distance. Outdoor bridged links are commonly used for connectivity between buildings or between cities. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +622 CCNA 200-301 Official Cert Guide, Volume 1 + +If the LANs at two locations need to be bridged, a point-to-point bridged link can be used. One AP configured in bridge mode is needed on each end of the wireless link. Special pur-pose antennas are normally used with the bridges to focus their signals in one direction— toward the antenna of the AP at the far end of the link. This maximizes the link distance, as shown in Figure 26-12. + +LAN A Bridge Bridge LAN B + + + + + + + +Figure 26-12 Point-to-Point Outdoor Bridge + +Sometimes the LANs at multiple sites need to be bridged together. A point-to-multipoint bridged link allows a central site to be bridged to several other sites. The central site bridge is connected to an omnidirectional antenna, such that its signal is transmitted equally in all directions so that it can reach the other sites simultaneously. The bridges at each of the other sites can be connected to a directional antenna aimed at the central site. Figure 26-13 shows the point-to-multipoint scenario. + + + + + + + + + + + + + + + + + +LAN A +Figure 26-13 + +Central LAN B +Point-to-Multipoint Outdoor Bridge + + +Mesh Network +To provide wireless coverage over a very large area, it is not always practical to run Ethernet cabling to every AP that would be needed. Instead, you could use multiple APs configured in mesh mode. In a mesh topology, wireless traffic is bridged from AP to AP, in a daisy-chain fashion, using another wireless channel. + +Mesh APs can leverage dual radios—one using a channel in one range of frequencies and one a different range. Each mesh AP usually maintains a BSS on one channel, with which + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 623 + +wireless clients can associate. Client traffic is then usually bridged from AP to AP over other channels as a backhaul network. At the edge of the mesh network, the backhaul traffic is bridged to the wired LAN infrastructure. Figure 26-14 shows a typical mesh network. With Cisco APs, you can build a mesh network indoors or outdoors. The mesh network runs its own dynamic routing protocol to work out the best path for backhaul traffic to take across the mesh APs. + + + + +LAN + + + + + + + +Figure 26-14 Typical Wireless Mesh Network + +RF Overview +To send data across a wired link, an electrical signal is applied at one end and carried to the other end. The wire itself is continuous and conductive, so the signal can propagate rather easily. A wireless link has no physical strands of anything to carry the signal along. + +How, then, can an electrical signal be sent across the air, or free space? Consider a simple analogy of two people standing far apart. One person wants to signal something to the other. They are connected by a long and somewhat loose rope; the rope represents free space. The sender at one end decides to lift his end of the rope high and hold it there so that the other end of the rope will also rise and notify the partner. After all, if the rope were a wire, he knows that he could apply a steady voltage at one end of the wire and it would appear at the other end. Figure 26-15 shows the end result; the rope falls back down after a tiny distance, and the receiver never notices a change. + +? + + + + + +Sender +Figure 26-15 + +Receiver +Failed Attempt to Pass a Message Down a Rope + +The sender tries a different strategy. He cannot push the rope, but when he begins to wave 26 it up and down in a steady, regular motion, a curious thing happens. A continuous wave +pattern appears along the entire length of the rope, as shown in Figure 26-16. In fact, the waves (each representing one up and down cycle of the sender’s arm) actually travel from the sender to the receiver. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +624 CCNA 200-301 Official Cert Guide, Volume 1 + + + + + + + + +Sender +Figure 26-16 + +Receiver +Sending a Continuous Wave Down a Rope + + +In free space, a similar principle occurs. The sender (a transmitter) can send an alternating current into a section of wire (an antenna), which sets up moving electric and magnetic fields that propagate out and away as traveling waves. The electric and magnetic fields travel along together and are always at right angles to each other, as shown in Figure 26-17. The signal must keep changing, or alternating, by cycling up and down, to keep the electric and mag-netic fields cycling and pushing ever outward. + +Electric Field + + + + + + +Magnetic Field +Figure 26-17 Traveling Electric and Magnetic Waves + +Electromagnetic waves do not travel in a straight line. Instead, they travel by expanding in all directions away from the antenna. To get a visual image, think of dropping a pebble into a pond when the surface is still. Where it drops in, the pebble sets the water’s surface into a +cyclic motion. The waves that result begin small and expand outward, only to be replaced by new waves. In free space, the electromagnetic waves expand outward in all three dimensions. + +Figure 26-18 shows a simple idealistic antenna that is a single point at the end of a wire. The waves produced expand outward in a spherical shape. The waves will eventually reach the receiver, in addition to many other locations in other directions. + + + + + + + + +Sender Receiver + + + + + +Figure 26-18 Wave Propagation with an Idealistic Antenna + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 625 + +At the receiving end of a wireless link, the process is reversed. As the electromagnetic waves reach the receiver’s antenna, they induce an electrical signal. If everything works right, the received signal will be a reasonable copy of the original transmitted signal. + +The electromagnetic waves involved in a wireless link can be measured and described in sev-eral ways. One fundamental property is the frequency of the wave, or the number of times the signal makes one complete up and down cycle in 1 second. Figure 26-19 shows how a cycle of a wave can be identified. A cycle can begin as the signal rises from the center line, falls through the center line, and rises again to meet the center line. A cycle can also be mea-sured from the center of one peak to the center of the next peak. No matter where you start measuring a cycle, the signal must make a complete sequence back to its starting position where it is ready to repeat the same cyclic pattern. + +Cycle Cycle + + + + + +1 Second +Frequency = 4 cycles/second = 4 Hertz +Figure 26-19 Cycles Within a Wave + +In Figure 26-19, suppose that 1 second has elapsed, as shown. During that 1 second, the sig-nal progressed through four complete cycles. Therefore, its frequency is 4 cycles/second or 4 hertz. A hertz (Hz) is the most commonly used frequency unit and is nothing other than one cycle per second. + +Frequency can vary over a very wide range. As frequency increases by orders of magnitude, the numbers can become quite large. To keep things simple, the frequency unit name can be modified to denote an increasing number of zeros, as listed in Table 26-2. + + +Table 26-2 Unit +Hertz + +Kilohertz + +Megahertz + +Gigahertz + +Frequency Unit Names Abbreviation +Hz + +kHz + +MHz + +GHz + + +Meaning +Cycles per second + +1000 Hz + +1,000,000 Hz + +1,000,000,000 Hz + + + + +Figure 26-20 shows a simple representation of the continuous frequency spectrum rang-ing from 0 Hz to 1022 (or 1 followed by 22 zeros) Hz. At the low end of the spectrum are +frequencies that are too low to be heard by the human ear, followed by audible sounds. The +highest range of frequencies contains light, followed by X, gamma, and cosmic rays. + + + +26 + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +626 CCNA 200-301 Official Cert Guide, Volume 1 + + +Frequency (Hz) +1021 1020 1019 1018 1017 1016 1015 1014 1013 1012 1011 1010 109 108 107 106 105 104 103 102 101 +0 + +Frequency Notation + + + + + + + + + + +100 GHz 10 GHz 1 GHz 100 MHz 10 MHz 1 MHz 100 kHz 10 kHz +1 kHz 100 Hz 10 Hz +0 Hz + + + +Cosmic Rays + + +Gamma Rays + +X-Rays + + +Ultraviolet Light + +Visible Light Infrared Light + + +Microwave and Radar + +Television and FM Radio Shortwave Radio +AM Radio +Low Frequency Radio + +Sound + + +Subsonic + + + + + + + + + + + + + + +5 GHz Wireless + + +2.4 GHz Wireless + + + +Radio Frequencies (RF) + + +Figure 26-20 Continuous Frequency Spectrum + +The frequency range from around 3 kHz to 300 GHz is commonly called radio frequency (RF). It includes many different types of radio communication, including low-frequency radio, AM radio, shortwave radio, television, FM radio, microwave, and radar. The micro-wave category also contains the two main frequency ranges that are used for wireless LAN communication: 2.4 and 5 GHz. + +Wireless Bands and Channels +Because a range of frequencies might be used for the same purpose, it is customary to refer to the range as a band of frequencies. For example, the range from 530 kHz to around 1710 kHz is used by AM radio stations; therefore, it is commonly called the AM band or the AM broadcast band. + +One of the two main frequency ranges used for wireless LAN communication lies between 2.400 and 2.4835 GHz. This is usually called the 2.4-GHz band, even though it does not encompass the entire range between 2.4 and 2.5 GHz. It is much more convenient to refer to the band name instead of the specific range of frequencies included. + +The other wireless LAN range is usually called the 5-GHz band because it lies between 5.150 and 5.825 GHz. The 5-GHz band actually contains the following four separate and dis-tinct bands: + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 627 + +5.150 to 5.250 GHz 5.250 to 5.350 GHz 5.470 to 5.725 GHz 5.725 to 5.825 GHz + +TIP You might have noticed that most of the 5-GHz bands are contiguous except for a gap between 5.350 and 5.470. At the time of this writing, this gap exists and cannot be used for wireless LANs. However, some governmental agencies have moved to reclaim the frequen-cies and repurpose them for wireless LANs. Efforts are also underway to add 5.825 through 5.925 GHz. + +It is interesting that the 5-GHz band can contain several smaller bands. Remember that the term band is simply a relative term that is used for convenience. Do not worry about memo-rizing the band names or exact frequency ranges; just be aware of the two main bands at 2.4 and 5 GHz. + +A frequency band contains a continuous range of frequencies. If two devices require a single frequency for a wireless link between them, which frequency can they use? Beyond that, how many unique frequencies can be used within a band? To keep everything orderly and compatible, bands are usually divided into a number of distinct channels. Each channel is known by a channel number and is assigned to a specific frequency. As long as the channels are defined by a national or international standards body, they can be used consistently in all locations. Figures 26-21 and 26-22 show the channel layout for the 2.4 and 5 GHz bands, respectively. + +Channel 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + + +GHz 2.412 2.417 2.422 2.427 2.432 2.437 2.442 2.447 2.452 2.457 2.462 2.467 2.472 2.484 +DSSS: 22 MHz OFDM: 20 MHz + +Figure 26-21 Channel Layout in the 2.4-GHz Band + +U-NII-1 U-NII-2 U-NII-2 Extended U-NII-3 +Channel +36 40 44 48 52 56 60 64 100104 108 112 116 120 124 128132 136 140 149 153157 161 + + + +GHz +5.180 5.240 5.260 5.320 5.500 5.700 5.745 5.825 + +20 +MHz 26 + + + +Figure 26-22 Channel Layout in the 5-GHz Band + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +628 CCNA 200-301 Official Cert Guide, Volume 1 + +You might assume that an AP can use any channel number without affecting any APs that use other channel numbers. In the 5-GHz band, this is the case because each channel is allo-cated a frequency range that does not encroach on or overlap the frequencies allocated for any other channel. In other words, the 5-GHz band consists of nonoverlapping channels. + +The same is not true of the 2.4-GHz band. Each of its channels is much too wide to avoid overlapping the next lower or upper channel number. In fact, each channel covers the fre-quency range that is allocated to more than four consecutive channels! Notice the width of the channel spacing in Figure 26-21 as compared to the width of one of the shaded signals centered on channels 1, 6, and 11. The only way to avoid any overlap between adjacent chan-nels is to configure APs to use only channels 1, 6, and 11. Even though there are 14 channels available to use, you should always strive for nonoverlapping channels in your network. + +APs and Wireless Standards +It might be obvious that wireless devices and APs should all be capable of operating on the same band. For example, a 5-GHz wireless phone can communicate only with an AP that offers Wi-Fi service on 5-GHz channels. In addition, the devices and APs must also share a compatibility with the parts of the 802.11 standard they support. + +As the IEEE 802.11 Wi-Fi standard evolves and develops, new amendments with new func-tionality get proposed. These amendments are known by “802.11” followed by a one- or two-letter suffix until they are accepted and rolled up into the next generation of the com-plete 802.11 standard. Even then, it is common to see the amendment suffixes still used to distinguish specific functions. + +You should be aware of several amendments that define important characteristics such as data rates, methods used to transmit and receive data, and so on. For the CCNA 200-301 exam, you should know which band each of the amendments listed in Table 26-3 uses. The ENCOR 300-401 exam goes further into the data rates and modulation and coding schemes used by each. + +Table 26-3 Basic Characteristics of Some IEEE 802.11 Amendments + +Amendment + +802.11-1997 + +802.11b + +802.11g + +802.11a + +802.11n + +802.11ac + +802.11ax + +2.4 5 Max Data GHz GHz Rate +Yes No 2 Mbps + +Yes No 11 Mbps + +Yes No 54 Mbps + +No Yes 54 Mbps + +Yes Yes 600 Mbps + +No Yes 6.93 Gbps + +Yes Yes 4x 802.11ac + +Notes + +The original 802.11 standard ratified in 1997 + +Introduced in 1999 + +Introduced in 2003 + +Introduced in 1999 + +HT (high throughput), introduced in 2009 + +VHT (very high throughput), introduced in 2013 + +High Efficiency Wireless, Wi-Fi6; expected late 2019; will operate on other bands too, as they become available + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 26: Fundamentals of Wireless Networks 629 + +The 802.11 amendments are not mutually exclusive. Wireless client devices and APs can be compatible with one or more amendments; however, a client and an AP can communicate only if they both support and agree to use the same amendment. When you look at the specifications for a wireless device, you may find supported amendments listed in a single string, separated by slashes. For example, a device that supports 802.11b/g will support both 802.11b and 802.11g. One that supports b/g/a/n/ac will support 802.11b, 802.11g, 802.11n, and 802.11ac. You should become familiar with Table 26-3 so that you can know which bands a device can use based on its 802.11 amendment support. + +If a device can operate on both bands, how does it decide which band to use? APs can usu-ally operate on both bands simultaneously to support any clients that might be present on each band. However, wireless clients typically associate with an AP on one band at a time, while scanning for potential APs on both bands. The band used to connect to an AP is cho-sen according to the operating system, wireless adapter driver, and other internal configura-tion. A wireless client can initiate an association with an AP on one band and then switch to the other band if the signal conditions are better there. + +NOTE Cisco APs have dual radios (sets of transmitters and receivers) to support BSSs on one 2.4-GHz channel and other BSSs on one 5-GHz channel simultaneously. Some models also have two 5-GHz radios that can be configured to operate BSSs on two different chan-nels at the same time, providing wireless coverage to higher densities of users that are locat-ed in the same vicinity. +You can configure a Cisco AP to operate on a specific channel number. As the number of APs grows, manual channel assignment can become a difficult task. Fortunately, Cisco wire-less architectures can automatically and dynamically assign each AP to an appropriate chan-nel. The architecture is covered in Chapter 27, “Analyzing Cisco Wireless Architectures,” while dynamic channel assignment is covered on the ENCOR 300-401 exam. + + +In open space, RF signals propagate or reach further on the 2.4-GHz band than on the 5-GHz band. They also tend to penetrate indoor walls and objects easier at 2.4 GHz than 5 GHz. However, the 2.4-GHz band is commonly more crowded with wireless devices. Remember that only three nonoverlapping channels are available, so the chances of other neighboring APs using the same channels is greater. In contrast, the 5-GHz band has many more channels available to use, making channels less crowded and experiencing less interference. + + +Chapter Review + +Review this chapter’s material using either the tools in the book or the interactive tools for the same material found on the book’s companion website. Table 26-4 outlines the key review elements and where you can find them. To better track your study progress, record +when you completed these activities in the second column. + + + + + + +26 + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +630 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 26-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Resource Used Book, website +Book, website + +Book, PTP + +Website + + + +Review All the Key Topics + +Table 26-5 Key Topics for Chapter 26 + +Key Topic Element Figure 26-4 +Figure 26-7 + +Figure 26-8 + +Paragraph + +Table 26-3 + +Description Basic service set +Multiple SSIDs + +Extended service set + +Nonoverlapping channels and bands + +Basic Characteristics of Some 802.11 Amendments + +Page Number 615 +618 + +619 + +628 + +628 + + + +Key Terms You Should Know +access point (AP), ad hoc network, Band, basic service set (BSS), Basic Service Set Identifier (BSSID), channel, cell, distribution system (DS), extended service set (ESS), independent basic service set (IBSS), infrastructure mode, mesh network, nonoverlapping channels, point-to-point bridge, repeater, roaming, Service Set Identifier (SSID), station (STA), workgroup bridge (WGB) + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 27 + + +Analyzing Cisco Wireless Architectures + +This chapter covers the following exam topics: + +2.0 Network Access +2.6 Compare Cisco Wireless Architectures and AP modes + +In Chapter 26, “Fundamentals of Wireless Networks,” you learned about how a single access point (AP) can provide a basic service set (BSS) for a cell area and how multiple APs can +be connected to form an extended service set (ESS) for a larger network. In this chapter, you learn more about different approaches or architectures that allow APs to be networked +together for an enterprise. You also learn how some architectures are more scalable than oth-ers and how to manage each type of wireless network architecture. + +As you work through this chapter, think about how each architecture can be applied to spe-cific environments—how easy it would be to manage, deploy, and troubleshoot the network, how the APs can be controlled, and how data would move through the network. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 27-1 ”Do I Know This Already?” Section-to-Question Mapping + +Foundation Topics Section Autonomous AP Architectures +Cloud-based AP Architecture + +Split-MAC Architectures + +Comparing Wireless LAN Controller Deployments + +Cisco AP Modes + +Questions 1 +2 + +3–5 + +6 + +7–8 + + + +1. Which one of the following terms best describes a Cisco wireless access point that operates in a standalone, independent manner? +a. Autonomous AP b. Independent AP c. Lightweight AP d. Embedded AP + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +2. The Cisco Meraki cloud-based APs are most accurately described by which one of the following statements? +a. Autonomous APs joined to a WLC b. Autonomous APs centrally managed c. Lightweight APs joined to a WLC d. Lightweight APs centrally managed +3. A lightweight access point is said to participate in which one of the following architectures? +a. Light-MAC b. Tunnel-MAC c. Split-MAC d. Big-MAC +4. How does a lightweight access point communicate with a wireless LAN controller? a. Through an IPsec tunnel +b. Through a CAPWAP tunnel c. Through a GRE tunnel +d. Directly over Layer 2 + +5. Which one of the following is not needed for a lightweight AP in default local mode to be able to support three SSIDs that are bound to three VLANs? +a. A trunk link carrying three VLANs +b. An access link bound to a single VLAN c. A WLC connected to three VLANs +d. A CAPWAP tunnel to a WLC + +6. Which one of the following WLC deployment models would be best for a large enter-prise with around 3000 lightweight APs? +a. Cisco Mobility Express b. Embedded +c. Unified +d. Cloud-based + +7. If a lightweight AP provides at least one BSS for wireless clients, which one of the fol-lowing modes does it use? +a. Local b. Normal +c. Monitor d. Client + + +|||||||||||||||||||| +|||||||||||||||||||| + + +634 CCNA 200-301 Official Cert Guide, Volume 1 + +8. Regarding lightweight AP modes, which one of the following is true? + +a. An AP can operate in multiple modes at the same time. b. An AP only has one possible mode of operation. +c. The Run mode is the default mode. +d. The SE-Connect mode is used for spectrum analysis. + +Foundation Topics + +Autonomous AP Architecture +An access point’s primary function is to bridge wireless data from the air to a normal wired network. An AP can accept “connections” from a number of wireless clients so that they become members of the LAN, as if the same clients were using wired connections. + +APs act as the central point of access (hence the AP name), controlling client access to the wireless LAN. An autonomous AP is self-contained; it is equipped with both wired and wireless hardware so that the wireless client associations can be terminated onto a wired connection locally at the AP. The APs and their data connections must be distributed across the coverage area and across the network. + +Autonomous APs offer one or more fully functional, standalone basic service sets (BSSs). They are also a natural extension of a switched network, connecting wireless service set identifiers (SSIDs) to wired virtual LANs (VLANs) at the access layer. Figure 27-1 shows the basic architecture; even though only four APs are shown across the bottom, a typical enter-prise network could consist of hundreds or thousands of APs. + + +Core Layer + + + + +Distribution Layer + +VLAN 10: 10.10.10.1/24 VLAN 100: 192.168.100.1/24 VLAN 200: 192.168.200.1/24 + +Trunk Link:VLANs 10, 100, 200 + + +Access Layer + + +Trunk Link:VLANs 10, 100, 200 + +Autonomous Management: 10.10.10.10 APs + + +SSIDs: wlan100 wlan200 + +Figure 27-1 Wireless Network Architecture with Autonomous APs + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 27: Analyzing Cisco Wireless Architectures + +What exactly does an autonomous AP need to become a part of the network? The wireless network in Figure 27-1 consists of two SSIDs: wlan100 and wlan200. These correspond to wired VLANs 100 and 200, respectively. As shown by the shaded links, the VLANs must be trunked from the distribution layer switch (where routing commonly takes place) to the access layer, where they are extended further over a trunk link to the AP. + +An autonomous AP offers a short and simple path for data to travel between the wireless and wired networks. Data has to travel only through the AP to reach the network on the other side. Two wireless users that are associated to the same autonomous AP can reach each other through the AP without having to pass up into the wired network. As you work through +the wireless architectures discussed in the rest of the chapter, notice the data path that is required for each. + +An autonomous AP must also be configured with a management IP address (10.10.10.10 in Figure 27-1) so that you can remotely manage it. After all, you will want to configure SSIDs, VLANs, and many RF parameters like the channel and transmit power to be used. The man-agement address is not normally part of any of the data VLANs, so a dedicated management VLAN (i.e., VLAN 10) must be added to the trunk links to reach the AP. Each AP must be configured and maintained individually unless you leverage a management platform such as Cisco Prime Infrastructure or Cisco DNA Center. + +Because the data and management VLANs may need to reach every autonomous AP, the network configuration and efficiency can become cumbersome as the network scales. For example, you will likely want to offer the same SSID on many APs so that wireless clients can associate with that SSID in most any location or while roaming between any two APs. You might also want to extend the corresponding VLAN (and IP subnet) to each and every AP so that clients do not have to request a new IP address for each new association. + +Because SSIDs and their VLANs must be extended at Layer 2, you should consider how they are extended throughout the switched network. The shaded links in Figure 27-2 show an example of a single VLAN’s extent in the data plane. Working top to bottom, follow VLAN 100 as it reaches through the network. VLAN 100 is routed within the distribution layer and must be carried over trunk links to the access layer switches and then to each autonomous AP. In effect, VLAN 100 must extend end to end across the whole infrastructure—some-thing that is usually considered to be a bad practice. + +That might sound straightforward until you have to add a new VLAN and configure every switch and AP in your network to carry and support it. Even worse, suppose your network has redundant links between each layer of switches. The Spanning Tree Protocol (STP) run-ning on each switch becomes a vital ingredient to prevent bridging loops from forming and corrupting the network. For these reasons, client roaming across autonomous APs is typi-cally limited to the Layer 2 domain, or the extent of a single VLAN. As the wireless network expands, the infrastructure becomes more difficult to configure correctly and becomes less +efficient. + +635 + + + +27 + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +636 CCNA 200-301 Official Cert Guide, Volume 1 + + +Core Layer + + + + +Distribution Layer + +VLAN 10: 10.10.10.1/24 VLAN 100: 192.168.100.1/24 VLAN 200: 192.168.200.1/24 + +Trunk Link:VLANs 10, 100, 200 + + +Access Layer + + +Trunk Link:VLANs 10, 100, 200 + +Autonomous Management: 10.10.10.10 APs + + + +SSIDs: wlan100 wlan200 + +SSIDs: wlan100 wlan200 + +SSIDs: wlan100 wlan200 + +SSIDs: wlan100 wlan200 + + +Figure 27-2 Extent of a Data VLAN in a Network of Autonomous APs + +Cloud-based AP Architecture +Recall that an autonomous AP needs quite a bit of configuration and management. To help manage more and more autonomous APs as the wireless network grows, you could place an AP management platform such as Cisco Prime Infrastructure in a central location within the enterprise. The management platform would need to be purchased, configured, and main-tained too. + +A simpler approach is a cloud-based AP architecture, where the AP management function is pushed out of the enterprise and into the Internet cloud. Cisco Meraki is cloud-based and offers centralized management of wireless, switched, and security networks built from +Meraki products. For example, through the cloud networking service, you can configure and manage APs, monitor wireless performance and activity, generate reports, and so on. + +Cisco Meraki APs can be deployed automatically, once you register with the Meraki cloud. Each AP will contact the cloud when it powers up and will self-configure. From that point on, you can manage the AP through the Meraki cloud dashboard. + +Figure 27-3 illustrates the basic cloud-based architecture. Notice that the network is arranged identically to that of the autonomous AP network. The reason is that the APs in a cloud-based network are all autonomous, too. The most visible difference is that all of the APs are managed, controlled, and monitored centrally from the cloud. + + +Answers to the “Do I Know This Already?” quiz: 1 A 2 B 3 C 4 B 5 A 6 C 7 A 8 D + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 27: Analyzing Cisco Wireless Architectures 637 + + + +Cisco Meraki 27 Cloud + + + +Core Layer + + + +Distribution Layer + + +Management + + + + +Trunk Link + + +Access Layer + + +Trunk Link + + +Cisco Meraki Data APs + + + + + +Figure 27-3 Cisco Meraki Cloud-Based Wireless Network Architecture + +From the cloud, you can push out code upgrades and configuration changes to the APs in the enterprise. The Cisco Meraki cloud also adds the intelligence needed to automatically instruct each AP on which channel and transmit power level to use. It can also collect infor-mation from all of the APs about things such as RF interference, rogue or unexpected wire-less devices that were overheard, and wireless usage statistics. + +Finally, there are a couple of things you should observe about the cloud-based architecture. The data path from the wireless network to the wired network is very short; the autonomous AP links the two networks. Data to and from wireless clients does not have to travel up into the cloud and back; the cloud is used to bring management functions into the data plane. + +Also, notice that the network in Figure 27-3 consists of two distinct paths—one for data traffic and another for management traffic, corresponding to the following two functions: + +■ A control plane: Traffic used to control, configure, manage, and monitor the AP itself ■ A data plane: End-user traffic passing through the AP + +This division will become important in the following sections as other types of architecture are discussed. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +638 CCNA 200-301 Official Cert Guide, Volume 1 + +Split-MAC Architectures +Because autonomous APs are…well, autonomous, managing their RF operation can be quite difficult. As a network administrator, you are in charge of selecting and configuring the channel used by each AP and detecting and dealing with any rogue APs that might be inter-fering. You must also manage things such as the transmit power level to make sure that the wireless coverage is sufficient, it does not overlap too much, and there aren’t any coverage holes—even when an AP’s radio fails. + +Managing wireless network security can also be difficult. Each autonomous AP handles its own security policies, with no central point of entry between the wireless and wired net-works. That means there is no convenient place to monitor traffic for things such as intrusion detection and prevention, quality of service, bandwidth policing, and so on. + +To overcome the limitations of distributed autonomous APs, many of the functions found within autonomous APs have to be shifted toward some central location. In Figure 27-4, most of the activities performed by an autonomous AP on the left are broken up into two groups—management functions on the top and real-time processes on the bottom. + + + +WLC + +Management Functions • RF Management +• Association and Roaming Management • Client Authentication +• Security Management • QoS + + + + + +Autonomous AP +CAPWAP + + + + + + +Real-Time Functions • RF Transmit/Receive • MAC Management +• Encryption +Lightweight AP +Figure 27-4 Autonomous Versus Lightweight Access Point + +The real-time processes involve sending and receiving 802.11 frames, beacons, and probe messages. 802.11 data encryption is also handled in real time, on a per-packet basis. The AP must interact with wireless clients on some low level, known as the Media Access Control (MAC) layer. These functions must stay with the AP hardware, closest to the clients. + +The management functions are not integral to handling frames over the RF channels, but are things that should be centrally administered. Therefore, those functions can be moved to a centrally located platform away from the AP. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 27: Analyzing Cisco Wireless Architectures + +When the functions of an autonomous AP are divided, the AP hardware is known as a light-weight access point, and performs only the real-time 802.11 operation. The lightweight AP gets its name because the code image and the local intelligence are stripped down, or light-weight, compared to the traditional autonomous AP. + +The management functions are usually performed on a wireless LAN controller (WLC), which controls many lightweight APs. This is shown in the bottom right portion of Figure 27-4. Notice that the AP is left with duties in Layers 1 and 2, where frames are moved into and out of the RF domain. The AP becomes totally dependent on the WLC for every other +WLAN function, such as authenticating users, managing security policies, and even selecting +RF channels and output power. + +639 + + + +27 + + + +NOTE Remember that a lightweight AP cannot normally operate on its own; it is very dependent on a WLC somewhere in the network. The only exception is the FlexConnect architecture, which is discussed later in this chapter. + +The lightweight AP-WLC division of labor is known as a split-MAC architecture, where the normal MAC operations are pulled apart into two distinct locations. This occurs for every AP in the network; each one must boot and bind itself to a WLC to support wireless clients. The WLC becomes the central hub that supports a number of APs scattered about in the network. + +How does a lightweight AP bind with a WLC to form a complete working access point? The two devices must use a tunneling protocol between them, to carry 802.11-related messages and also client data. Remember that the AP and WLC can be located on the same VLAN or IP subnet, but they do not have to be. Instead, they can be located on two entirely different IP subnets in two entirely different locations. + +The Control and Provisioning of Wireless Access Points (CAPWAP) tunneling protocol makes this all possible by encapsulating the data between the LAP and WLC within new IP packets. The tunneled data can then be switched or routed across the campus network. As Figure 27-5 shows, the CAPWAP relationship actually consists of two separate tunnels, as follows: + +■ CAPWAP control messages: Carries exchanges that are used to configure the AP and manage its operation. The control messages are authenticated and encrypted, so the AP is securely controlled by only the appropriate WLC, then transported over the control tunnel. +■ CAPWAP data: Used for packets traveling to and from wireless clients that are associated with the AP. Data packets are transported over the data tunnel but are not encrypted by default. When data encryption is enabled for an AP, packets are protected with Datagram Transport Layer Security (DTLS). + + +NOTE CAPWAP is defined in RFCs 5415, 5416, 5417, and 5418. CAPWAP is based on the Lightweight Access Point Protocol (LWAPP), which was a legacy Cisco proprietary solution. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +640 CCNA 200-301 Official Cert Guide, Volume 1 + +WLC + + + + + +CAPWAP Control – UDP 5246 + + +CAPWAP Data – UDP 5247 + + + + + + + + + +Lightweight AP +Figure 27-5 Linking a Lightweight AP and WLC with CAPWAP + +Every AP and WLC must also authenticate each other with digital certificates. An X.509 certificate is preinstalled in each device when it is purchased. By using certificates behind the scenes, every device is properly authenticated before becoming part of the wireless network. This process helps assure that no one can add an unauthorized AP to your network. + +The CAPWAP tunneling allows the AP and WLC to be separated geographically and logical-ly. It also breaks the dependence on Layer 2 connectivity between them. For example, Figure 27-6 uses shaded areas to show the extent of VLAN 100. Notice how VLAN 100 exists at the WLC and in the air as SSID 100, near the wireless clients—but not in between the AP and the WLC. Instead, traffic to and from clients associated with SSID 100 is transported across the network infrastructure encapsulated inside the CAPWAP data tunnel. The tunnel exists between the IP address of the WLC and the IP address of the AP, which allows all of the tunneled packets to be routed at Layer 3. + +Also, notice how the AP is known by only a single IP address: 10.10.10.10. Because the AP sits on the access layer where its CAPWAP tunnels terminate, it can use one IP address for both management and tunneling. No trunk link is needed because all of the VLANs it sup-ports are encapsulated and tunneled as Layer 3 IP packets, rather than individual Layer 2 VLANs. + +As the wireless network grows, the WLC simply builds more CAPWAP tunnels to reach more APs. Figure 27-7 depicts a network with four APs. Each AP has a control and a data tunnel back to the centralized WLC. SSID 100 can exist on every AP, and VLAN 100 can reach every AP through the network of tunnels. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| +CAPWAP +CAPWAP +CAPWAP +CAPWAP +CAPWAP + + +Chapter 27: Analyzing Cisco Wireless Architectures 641 + + + +VLAN 100 + + +WLC + +VLAN 200 +10.1.1.5 27 + + + + + + + + + + + + +Access Link + + + + +Lightweight AP + + +SSID 100 + + +10.10.10.10 + +SSID 200 + + +Figure 27-6 Extent of VLAN 100 in a Cisco Wireless Network + +VLAN 100 VLAN 200 + + +WLC + + + + + + + + + + + +Lightweight APs + + + + +SSID 100 +SSID 200 + + +SSID 100 +SSID 200 + + +SSID 100 +SSID 200 + +SSID 100 +SSID 200 + +Figure 27-7 Using CAPWAP Tunnels to Connect APs to One Central WLC + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +642 CCNA 200-301 Official Cert Guide, Volume 1 + +Once CAPWAP tunnels are built from a WLC to one or more lightweight APs, the WLC can begin offering a variety of additional functions. Think of all the puzzles and shortcomings that were discussed for the traditional autonomous WLAN architecture as you read over the following list of WLC activities: + +■ Dynamic channel assignment: The WLC can automatically choose and configure the RF channel used by each AP, based on other active access points in the area. +■ Transmit power optimization: The WLC can automatically set the transmit power of each AP based on the coverage area needed. +■ Self-healing wireless coverage: If an AP radio dies, the coverage hole can be “healed” by turning up the transmit power of surrounding APs automatically. +■ Flexible client roaming: Clients can roam between APs with very fast roaming times. +■ Dynamic client load balancing: If two or more APs are positioned to cover the same geo-graphic area, the WLC can associate clients with the least used AP. This distributes the client load across the APs. +■ RF monitoring: The WLC manages each AP so that it scans channels to monitor the RF usage. By listening to a channel, the WLC can remotely gather information about RF interference, noise, signals from neighboring APs, and signals from rogue APs or ad hoc clients. +■ Security management: The WLC can authenticate clients from a central service and can require wireless clients to obtain an IP address from a trusted DHCP server before allow-ing them to associate and access the WLAN. +■ Wireless intrusion protection system: Leveraging its central location, the WLC can monitor client data to detect and prevent malicious activity. + +Comparing Wireless LAN Controller Deployments Suppose you want to deploy a WLC to support multiple lightweight APs in your network. Where should you put the WLC? The split-MAC concept can be applied to several different network architectures. Each architecture places the WLC in a different location within the network—a choice that also affects how many WLCs might be needed to support the num-ber of APs required. +One approach is to locate the WLC in a central location so that you can maximize the num-ber of APs joined to it. This is usually called a unified or centralized WLC deployment, which tends to follow the concept that most of the resources users need to reach are located in a central location such as a data center or the Internet. Traffic to and from wireless users would travel over CAPWAP tunnels that reach into the center of the network, near the core, as shown in Figure 27-8. A centralized WLC also provides a convenient place to enforce security policies that affect all wireless users. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 27: Analyzing Cisco Wireless Architectures 643 + +Unified WLC + +Core Layer 27 + + + + +Distribution Layer + + + + +Access Layer + + + + +Lightweight APs + + + + + + + +Figure 27-8 WLC Location in a Unified Deployment + +Figure 27-8 shows four APs joined to a single WLC. Your network might have more APs— many, many more. A large enterprise network might have thousands of APs connected to its access layer. Scalability then becomes an important factor in the centralized design. Typical unified WLCs can support a maximum of 6000 APs. If you have more APs than the maxi-mum, you will need to add more WLCs to the design, each located centrally. + +A WLC can also be located in a central position in the network, inside a data center in a private cloud, as shown in Figure 27-9. This is known as a cloud-based WLC deployment, where the WLC exists as a virtual machine rather than a physical device. If the cloud com-puting platform already exists, then deploying a cloud-based WLC becomes straightforward. Such a controller can typically support up to 3000 APs. If your wireless network scales beyond that, then additional WLCs can be added as more virtual machines. + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +644 CCNA 200-301 Official Cert Guide, Volume 1 + +Data Center + +Cloud WLC + +Core Layer + + + + +Distribution Layer + + + + +Access Layer + + + + +Lightweight APs + + + + + + + +Figure 27-9 WLC Location in a Cloud-based Deployment + +For small campuses or distributed branch locations, where the number of APs is relatively small in each, the WLC can be co-located with a stack of switches, as shown in Figure 27-10. This is known as an embedded WLC deployment because the controller is embedded with-in the switching hardware. Typical Cisco embedded WLCs can support up to 200 APs. The APs do not necessarily have to be connected to the switches that host the WLC; APs con-nected to other switches in other locations can join the embedded WLC too. As the number of APs grows, additional WLCs can be added by embedding them in other switch stacks at the site. + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 27: Analyzing Cisco Wireless Architectures 645 + + +Core Layer 27 + + + + +Distribution Layer + + +Embedded WLC + + +Access Layer + + + + +Lightweight APs + + + + + + + +Figure 27-10 WLC Location in an Embedded Deployment + +Finally, in small-scale environments, such as small, midsize, or multisite branch locations, you might not want to invest in dedicated WLCs at all. In this case, the WLC function can be +co-located with an AP that is installed at the branch site. This is known as a Cisco Mobility Express WLC deployment, as shown in Figure 27-11. The AP that hosts the WLC forms a CAPWAP tunnel with the WLC, along with any other APs at the same location. A Mobility Express WLC can support up to 100 APs. + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +646 CCNA 200-301 Official Cert Guide, Volume 1 + + +Core Layer + + + + +Distribution Layer + + + + +Access Layer + + +Mobility Express WLC +Lightweight APs + + + + + + + +Figure 27-11 WLC Location in a Mobility Express Deployment + +See Table 27-2 for a summary of WLC deployment models, WLC locations, and a typical maximum number of APs and clients that each one supports. + +Table 27-2 Summary of WLC Deployment Models + +Deployment Model +Unified + +Cloud + +Embedded + +WLC Location (DC, Access, Central, AP) +Central + +DC + +Access + +APs Supported +6000 + +3000 + +200 + +Clients Supported +64,000 + +32,000 + +4000 + +Typical Use + +Large enterprise + +Private cloud + +Small campus + + +Mobility Express Other 100 2000 Branch location + +Autonomous N/A N/A N/A N/A + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 27: Analyzing Cisco Wireless Architectures 647 + +Cisco AP Modes +Many Cisco APs can operate in either autonomous or lightweight mode, depending on 27 which code image is loaded and run. From the WLC, you can also configure a lightweight +AP to operate in one of the following special-purpose modes: + +■ Local: The default lightweight mode that offers one or more functioning BSSs on a spe-cific channel. During times that it is not transmitting, the AP will scan the other channels to measure the level of noise, measure interference, discover rogue devices, and match against intrusion detection system (IDS) events. +■ Monitor: The AP does not transmit at all, but its receiver is enabled to act as a dedicated sensor. The AP checks for IDS events, detects rogue access points, and determines the position of stations through location-based services. +■ FlexConnect: An AP at a remote site can locally switch traffic between an SSID and a VLAN if its CAPWAP tunnel to the WLC is down and if it is configured to do so. +■ Sniffer: An AP dedicates its radios to receiving 802.11 traffic from other sources, much like a sniffer or packet capture device. The captured traffic is then forwarded to a PC run-ning network analyzer software such as Wildpackets OmniPeek or WireShark, where it can be analyzed further. +■ Rogue detector: An AP dedicates itself to detecting rogue devices by correlating MAC addresses heard on the wired network with those heard over the air. Rogue devices are those that appear on both networks. +■ Bridge: An AP becomes a dedicated bridge (point-to-point or point-to-multipoint) between two networks. Two APs in bridge mode can be used to link two locations sepa-rated by a distance. Multiple APs in bridge mode can form an indoor or outdoor mesh network. +■ Flex+Bridge: FlexConnect operation is enabled on a mesh AP. +■ SE-Connect: The AP dedicates its radios to spectrum analysis on all wireless channels. You can remotely connect a PC running software such as MetaGeek Chanalyzer or Cisco Spectrum Expert to the AP to collect and analyze the spectrum analysis data to discover sources of interference. + + +NOTE Remember that a lightweight AP is normally in local mode when it is providing BSSs and allowing client devices to associate to wireless LANs. When an AP is configured to operate in one of the other modes, local mode (and the BSSs) is disabled. + + +Chapter Review + +Review this chapter’s material using either the tools in the book or the interactive tools for the same material found on the book’s companion website. Table 27-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +648 CCNA 200-301 Official Cert Guide, Volume 1 + +Table 27-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Resource Used Book, website +Book, website + +Book, PTP + +Website + + + + +Review All the Key Topics +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 27-4 lists a reference of these key topics and the page numbers on which each is found. + +Table 27-4 Key Topics for Chapter 28 + +Key Topic Element + +Figure 27-1 + +Figure 27-3 + +Figure 27-4 + +Figure 27-5 + +Figure 27-8 + +Figure 27-9 + +Figure 27-10 + +Figure 27-11 + +List + +Description Page Number +Autonomous AP architecture 634 + +Cloud-based AP architecture 637 + +Split-MAC architecture 638 + +CAPWAP tunnels 640 + +Unified WLC deployment 643 + +Cloud-based WLC deployment 644 + +Embedded WLC deployment 645 + +Mobility Express WLC deployment 646 + +Cisco lightweight AP modes 647 + + + + +Key Terms You Should Know +autonomous AP, CAPWAP, centralized WLC deployment, cloud-based AP, cloud-based WLC deployment, embedded WLC deployment, lightweight AP, local mode, Media Access Control (MAC) layer, Mobility Express WLC deployment, split-MAC architecture, unified WLC deployment, wireless LAN controller (WLC) + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 28 + + +Securing Wireless Networks This chapter covers the following exam topics: +1.0 Network Fundamentals 1.11 Describe wireless principles +1.11.d Encryption + +5.0 Security Fundamentals +5.9 Describe wireless security protocols (WPA, WPA2, and WPA3) + +As you know by now, wireless networks are complex. Many technologies and protocols work behind the scenes to give end users a stable, yet mobile, connection to a wired network infra-structure. From the user’s perspective, a wireless connection should seem no different than a wired connection. A wired connection can give users a sense of security; data traveling over a wire is probably not going to be overheard by others. A wireless connection is inherently different; data traveling over the air can be overheard by anyone within range. + +Therefore, securing a wireless network becomes just as important as any other aspect. A comprehensive approach to wireless security focuses on the following areas: + +■ Identifying the endpoints of a wireless connection ■ Identifying the end user +■ Protecting the wireless data from eavesdroppers ■ Protecting the wireless data from tampering + +The identification process is performed through various authentication schemes. Protecting wireless data involves security functions like encryption and frame authentication. + +This chapter covers many of the methods you can use to secure a wireless network. Be warned: wireless security can be a confusing topic because it is filled with many acronyms. Some of the acronyms rhyme like words from a children’s book. In fact, this chapter is a story about WEP, PSK, TKIP, MIC, AES, EAP, EAP-FAST, EAP-TLS, LEAP, PEAP, WPA, WPA2, WPA3, CCMP, GCMP, and on and on it goes. When you finish with this chapter, though, you will come away with a clearer view of what these terms mean and how they all fit together. You might even be ready to configure a wireless LAN with effective security. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Table 28-1 “Do I Know This Already?” Section-to-Question Mapping + +Foundation Topics Section Anatomy of a Secure Connection +Wireless Client Authentication Methods + +Wireless Privacy and Integrity Methods + +WPA, WPA2, and WPA3 + +Questions 1–2 +3–4 + +5–6 + +7–8 + + + +1. Which of the following are necessary components of a secure wireless connection? (Choose all that apply.) +a. Encryption b. MIC +c. Authentication +d. All of these answers are correct. + +2. Which one of the following is used to protect the integrity of data in a wireless frame? a. WIPS +b. WEP c. MIC d. EAP +3. Which one of the following is a wireless encryption method that has been found to be vulnerable and is not recommended for use? +a. AES b. WPA c. EAP d. WEP +4. Which one of the following is used as the authentication framework when 802.1x is used on a WLAN? +a. Open authentication b. WEP +c. EAP d. WPA + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +652 CCNA 200-301 Official Cert Guide, Volume 1 + +5. Suppose you would like to select a method to protect the privacy and integrity of wireless data. Which one of the following methods should you avoid because it has been deprecated ? +a. TKIP b. CCMP c. GCMP d. EAP +6. Which one of the following is the data encryption and integrity method used by WPA2? a. WEP +b. TKIP c. CCMP d. WPA +7. The Wi-Fi Alliance offers which of the following certifications for wireless devices that correctly implement security standards? (Choose all that apply.) +a. WEP b. WPA2 c. 802.11 d. AES +8. A pre-shared key is used in which of the following wireless security configurations? (Choose all that apply.) +a. WPA2 personal mode b. WPA2 enterprise mode c. WPA3 personal mode d. WPA3 enterprise mode + +Foundation Topics + +Anatomy of a Secure Connection +In the previous chapters of this book, you learned about wireless clients forming associa-tions with wireless access points (APs) and passing data back and forth across the air. + +As long as all clients and APs conform to the 802.11 standard, they can all coexist—even on the same channel. Not every 802.11 device is friendly and trustworthy, however. Sometimes it is easy to forget that transmitted frames do not just go directly from the sender to the receiver, as in a wired or switched connection. Instead, they travel according to the transmit-ter’s antenna pattern, potentially reaching any receiver that is within range. + +Consider the scenario in Figure 28-1. The wireless client opens a session with some remote entity and shares a confidential password. Because two untrusted users are also located within range of the client’s signal, they may also learn the password by capturing frames that have been sent on the channel. The convenience of wireless communication also makes it easy for transmissions to be overheard and exploited by malicious users. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 28: Securing Wireless Networks 653 + +If data is sent through open space, how can it be secured so that it stays private and intact? The 802.11 standard offers a framework of wireless security mechanisms that can be used to add trust, privacy, and integrity to a wireless network. The following sections give an over-view of the wireless security framework. + +His password is 28 nihao123 + + + + +My password is nihao123 +Client nihao123 + + +AP + + +His password is nihao123 + + + +Figure 28-1 Wireless Transmissions Reaching Unintended Recipients + +Authentication +To use a wireless network, clients must first discover a basic service set (BSS) and then request permission to associate with it. Clients should be authenticated by some means before they can become functioning members of the wireless LAN. Why? + +Suppose that your wireless network connects to corporate resources where confidential information can be accessed. In that case, only devices known to be trusted and expected should be given access. Guest users, if they are permitted at all, should be allowed to join a different guest WLAN where they can access nonconfidential or public resources. Rogue cli-ents, which are not expected or welcomed, should not be permitted to associate at all. After all, they are not affiliated with the corporate network and are likely to be unknown devices that happen to be within range of your network. + +To control access, wireless networks can authenticate the client devices before they are allowed to associate. Potential clients must identify themselves by presenting some form of credentials to the APs. Figure 28-2 shows the basic client authentication process. + +Wireless authentication can take many forms. Some methods require only a static text string that is common across all trusted clients and APs. The text string is stored on the client device and presented directly to the AP when needed. What might happen if the device was stolen or lost? Most likely, any user who possessed the device could still authenticate to the network. Other more stringent authentication methods require interaction with a corporate user database. In those cases, the end user must enter a valid username and password— something that would not be known to a thief or an imposter. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +654 CCNA 200-301 Official Cert Guide, Volume 1 + + +Who are you? + +I am Joe User. + +Ok. + + + +AP + +Figure 28-2 Authenticating a Wireless Client +If you have ever joined a wireless network, you might have focused on authenticating your device or yourself, while implicitly trusting the nearest AP. For example, if you turn on your wireless device and find a wireless network that is available at your workplace, you probably join it without hesitating. The same is true for wireless networks in an airport, a hotel, a hot spot, or in your home—you expect the AP that is advertising the SSID to be owned and operated by the entity where you are located. But how can you be sure? +Normally, the only piece of information you have is the SSID being broadcast or advertised by an AP. If the SSID looks familiar, you will likely choose to join it. Perhaps your computer is configured to automatically connect to a known SSID so that it associates without your intervention. Either way, you might unwittingly join the same SSID even if it was being advertised by an imposter. +Some common attacks focus on a malicious user pretending to be an AP. The fake AP can send beacons, answer probes, and associate clients just like the real AP it is impersonating. Once a client associates with the fake AP, the attacker can easily intercept all communication to and from the client from its central position. A fake AP could also send spoofed manage-ment frames to disassociate or deauthenticate legitimate and active clients, just to disrupt normal network operation. +To prevent this type of man-in-the-middle attack, the client should authenticate the AP before the client itself is authenticated. Figure 28-3 shows a simple scenario. Even further, any management frames received by a client should be authenticated too, as proof that they were sent by a legitimate and expected AP. + + +Who are you? + + + +Ok. + + +I am AP-1. These are my +management frames. + + + + +AP-1 + +Figure 28-3 Authenticating a Wireless AP + +Answers to the “Do I Know This Already?” quiz: 1 D 2 C 3 D 4 C 5 A 6 C 7 B 8 A, C + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 28: Securing Wireless Networks + +Message Privacy +Suppose that the client in Figure 28-3 must authenticate before joining the wireless network. It might also authenticate the AP and its management frames after it associates but before +it is itself authenticated. The client’s relationship with the AP might become much more trusted, but data passing to and from the client is still available to eavesdroppers on the same channel. + +To protect data privacy on a wireless network, the data should be encrypted for its journey through free space. This is accomplished by encrypting the data payload in each wireless frame just prior to being transmitted, then decrypting it as it is received. The idea is to use an encryption method that the transmitter and receiver share, so the data can be encrypted and decrypted successfully. + +In wireless networks, each WLAN may support only one authentication and encryption scheme, so all clients must use the same encryption method when they associate. You might think that having one encryption method in common would allow every client to eavesdrop on every other client. That is not necessarily the case because the AP should securely nego-tiate a unique encryption key to use for each associated client. + +Ideally, the AP and a client are the only two devices that have the encryption keys in com-mon so that they can understand each other’s data. No other device should know about or be able to use the same keys to eavesdrop and decrypt the data. In Figure 28-4, the client’s confidential password information has been encrypted before being transmitted. The AP can decrypt it successfully before forwarding it onto the wired network, but other wireless +devices cannot. + +655 + + + + + + +28 + + +?? + + + +My password is nihao123 + +Client 328A29 nihao123 + + +AP + + + +?? + + + +Figure 28-4 Encrypting Wireless Data to Protect Data Privacy +The AP also maintains a “group key” that it uses when it needs to send encrypted data to all clients in its cell at one time. Each of the associated clients uses the same group key to decrypt the data. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +656 CCNA 200-301 Official Cert Guide, Volume 1 + +Message Integrity +Encrypting data obscures it from view while it is traveling over a public or untrusted net-work. The intended recipient should be able to decrypt the message and recover the original contents, but what if someone managed to alter the contents along the way? The recipient would have a very difficult time discovering that the original data had been modified. + +A message integrity check (MIC) is a security tool that can protect against data tampering. You can think of a MIC as a way for the sender to add a secret stamp inside the encrypted data frame. The stamp is based on the contents of the data bits to be transmitted. Once the recipient decrypts the frame, it can compare the secret stamp to its own idea of what the stamp should be, based on the data bits that were received. If the two stamps are identical, the recipient can safely assume that the data has not been tampered with. Figure 28-5 shows the MIC process. + +1. Original Data nihao123 6. Compare MICs f7 f7 + +2. Compute MIC nihao123 f7 5. Compute MIC f7 + + +3. Encrypt Data + MIC 4. Decrypt nihao123 f7 + +Client AP + +741fcb64901d + + +Figure 28-5 Checking Message Integrity over a Wireless Network + +Wireless Client Authentication Methods +You can use many different methods to authenticate wireless clients as they try to associate with the network. The methods have been introduced over time and have evolved as security weaknesses have been exposed and wireless hardware has advanced. This section covers the most common authentication methods you might encounter. + +Open Authentication +The original 802.11 standard offered only two choices to authenticate a client: open authen-tication and WEP. + +Open authentication is true to its name; it offers open access to a WLAN. The only require-ment is that a client must use an 802.11 authentication request before it attempts to associate with an AP. No other credentials are needed. + +When would you want to use open authentication? After all, it does not sound very secure because it is not. With no challenge, any 802.11 client may authenticate to access the net-work. That is, in fact, the whole purpose of open authentication—to validate that a client is a valid 802.11 device by authenticating the wireless hardware and the protocol. Authenticating the user’s identity is handled as a true security process through other means. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 28: Securing Wireless Networks 657 + +You have probably seen a WLAN with open authentication when you have visited a public location. If any client screening is used at all, it comes in the form of web authentication. A client can associate right away but must open a web browser to see and accept the terms for use and enter basic credentials. From that point, network access is opened up for the client. +Most client operating systems flag such networks to warn you that your wireless data will +not be secured in any way if you join. 28 + +WEP +As you might expect, open authentication offers nothing that can obscure or encrypt the data being sent between a client and an AP. As an alternative, the 802.11 standard has tradi-tionally defined Wired Equivalent Privacy (WEP) as a method to make a wireless link more like or equivalent to a wired connection. + +WEP uses the RC4 cipher algorithm to make every wireless data frame private and hidden from eavesdroppers. The same algorithm encrypts data at the sender and decrypts it at the receiver. The algorithm uses a string of bits as a key, commonly called a WEP key, to derive other encryption keys—one per wireless frame. As long as the sender and receiver have an identical key, one can decrypt what the other encrypts. + +WEP is known as a shared-key security method. The same key must be shared between the sender and receiver ahead of time, so that each can derive other mutually agreeable encryp-tion keys. In fact, every potential client and AP must share the same key ahead of time so that any client can associate with the AP. + +The WEP key can also be used as an optional authentication method as well as an encryp-tion tool. Unless a client can use the correct WEP key, it cannot associate with an AP. The AP tests the client’s knowledge of the WEP key by sending it a random challenge phrase. The client encrypts the challenge phrase with WEP and returns the result to the AP. The AP can compare the client’s encryption with its own to see whether the two WEP keys yield identical results. + +WEP keys can be either 40 or 104 bits long, represented by a string of 10 or 26 hex digits. As a rule of thumb, longer keys offer more unique bits for the algorithm, resulting in more robust encryption. Except in WEP’s case, that is. Because WEP was defined in the original 802.11 standard in 1999, every wireless adapter was built with encryption hardware specific to WEP. In 2001, a number of weaknesses were discovered and revealed, so work began +to find better wireless security methods. By 2004, the 802.11i amendment was ratified and WEP was officially deprecated. Both WEP encryption and WEP shared-key authentication are widely considered to be weak methods to secure a wireless LAN. + +802.1x/EAP +With only open authentication and WEP available in the original 802.11 standard, a more secure authentication method was needed. Client authentication generally involves some sort of challenge, a response, and then a decision to grant access. Behind the scenes, it can also involve an exchange of session or encryption keys, in addition to other parameters needed for client access. Each authentication method might have unique requirements as a unique way to pass information between the client and the AP. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +658 CCNA 200-301 Official Cert Guide, Volume 1 + +Rather than build additional authentication methods into the 802.11 standard, a more flex-ible and scalable authentication framework, the Extensible Authentication Protocol (EAP), was chosen. As its name implies, EAP is extensible and does not consist of any one authen-tication method. Instead, EAP defines a set of common functions that actual authentication methods can use to authenticate users. As you read through this section, notice how many authentication methods have EAP in their names. Each method is unique and different, but each one follows the EAP framework. + +EAP has another interesting quality: it can integrate with the IEEE 802.1x port-based access control standard. When 802.1x is enabled, it limits access to a network media until a client authenticates. This means that a wireless client might be able to associate with an AP but will not be able to pass data to any other part of the network until it successfully authenticates. + +With open and WEP authentication, wireless clients are authenticated locally at the AP without further intervention. The scenario changes with 802.1x; the client uses open authen-tication to associate with the AP, and then the actual client authentication process occurs at a dedicated authentication server. Figure 28-6 shows the three-party 802.1x arrangement that consists of the following entities: + +■ Supplicant: The client device that is requesting access +■ Authenticator: The network device that provides access to the network (usually a wireless LAN controller [WLC]) +■ Authentication server (AS): The device that takes user or client credentials and permits or denies network access based on a user database and policies (usually a RADIUS server) + +Authentication Supplicant Authenticator Server (AS) + + + +AP + +802.11 WLC Open Authentication + + +EAP-Based Authentication +Figure 28-6 802.1x Client Authentication Roles + +The wireless LAN controller becomes a middleman in the client authentication process, con-trolling user access with 802.1x and communicating with the authentication server using the EAP framework. + +The following sections provide an overview of several common EAP-based authentication methods. The goal here is to become aware of the many methods without trying to memo-rize them all. In fact, even when you configure user authentication on a wireless LAN, you will not have to select a specific method. Instead, you select 802.1x on the WLC so that it is ready to handle a variety of EAP methods. It is then up to the client and the authentica- +tion server to use a compatible method. You will learn more about configuring security on a wireless LAN in Chapter 29, “Building a Wireless LAN.” + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 28: Securing Wireless Networks + +LEAP +As an early attempt to address the weaknesses in WEP, Cisco developed a proprietary wire-less authentication method called Lightweight EAP (LEAP). To authenticate, the client must supply username and password credentials. Both the authentication server and the client exchange challenge messages that are then encrypted and returned. This provides mutual authentication; as long as the messages can be decrypted successfully, the client and the AS have essentially authenticated each other. + +At the time, WEP-based hardware was still widely used. Therefore, LEAP attempted to over-come WEP weaknesses by using dynamic WEP keys that changed frequently. Nevertheless, the method used to encrypt the challenge messages was found to be vulnerable, so LEAP has since been deprecated. Even though wireless clients and controllers still offer LEAP, you +should not use it. + +659 + + + + + + +28 + + +EAP-FAST +Cisco developed a more secure method called EAP Flexible Authentication by Secure Tunneling (EAP-FAST). Authentication credentials are protected by passing a protected access credential (PAC) between the AS and the supplicant. The PAC is a form of shared secret that is generated by the AS and used for mutual authentication. EAP-FAST is a sequence of three phases: + +■ Phase 0: The PAC is generated or provisioned and installed on the client. +■ Phase 1: After the supplicant and AS have authenticated each other, they negotiate a Transport Layer Security (TLS) tunnel. +■ Phase 2: The end user can then be authenticated through the TLS tunnel for additional security. + +Notice that two separate authentication processes occur in EAP-FAST—one between the AS and the supplicant and another with the end user. These occur in a nested fashion, as an outer authentication (outside the TLS tunnel) and an inner authentication (inside the TLS tunnel). + +Like other EAP-based methods, a RADIUS server is required. However, the RADIUS server must also operate as an EAP-FAST server to be able to generate PACs, one per user. + +PEAP +Like EAP-FAST, the Protected EAP (PEAP) method uses an inner and outer authentication; however, the AS presents a digital certificate to authenticate itself with the supplicant in the outer authentication. If the supplicant is satisfied with the identity of the AS, the two will build a TLS tunnel to be used for the inner client authentication and encryption key exchange. + +The digital certificate of the AS consists of data in a standard format that identifies the owner and is “signed” or validated by a third party. The third party is known as a certificate authority (CA) and is known and trusted by both the AS and the supplicants. The supplicant must also possess the CA certificate just so that it can validate the one it receives from the AS. The certificate is also used to pass a public key, in plain view, which can be used to help decrypt messages from the AS. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +660 CCNA 200-301 Official Cert Guide, Volume 1 + +Notice that only the AS has a certificate for PEAP. That means the supplicant can readily authenticate the AS. The client does not have or use a certificate of its own, so it must be authenticated within the TLS tunnel using one of the following two methods: + +■ MSCHAPv2: Microsoft Challenge Authentication Protocol version 2 +■ GTC: Generic Token Card; a hardware device that generates one-time passwords for the user or a manually generated password + +EAP-TLS +PEAP leverages a digital certificate on the AS as a robust method to authenticate the RADIUS server. It is easy to obtain and install a certificate on a single server, but the clients are left to identify themselves through other means. EAP Transport Layer Security (EAP-TLS) goes one step further by requiring certificates on the AS and on every client device. + +With EAP-TLS, the AS and the supplicant exchange certificates and can authenticate each other. A TLS tunnel is built afterward so that encryption key material can be securely exchanged. + +EAP-TLS is considered to be the most secure wireless authentication method available; however, implementing it can sometimes be complex. Along with the AS, each wireless cli-ent must obtain and install a certificate. Manually installing certificates on hundreds or thousands of clients can be impractical. Instead, you would need to implement a Public Key Infrastructure (PKI) that could supply certificates securely and efficiently and revoke them when a client or user should no longer have access to the network. This usually involves set-ting up your own CA or building a trust relationship with a third-party CA that can supply certificates to your clients. + +NOTE EAP-TLS is practical only if the wireless clients can accept and use digital certifi-cates. Many wireless devices, such as communicators, medical devices, and RFID tags, have an underlying operating system that cannot interface with a CA or use certificates. + + +Wireless Privacy and Integrity Methods +The original 802.11 standard supported only one method to secure wireless data from eaves-droppers: WEP. As you have learned in this chapter, WEP has been compromised, depre-cated, and can no longer be recommended. What other options are available to encrypt data and protect its integrity as it travels through free space? + +TKIP +During the time when WEP was embedded in wireless client and AP hardware, yet was known to be vulnerable, the Temporal Key Integrity Protocol (TKIP) was developed. + +TKIP adds the following security features using legacy hardware and the underlying WEP encryption: + +■ MIC: This efficient algorithm adds a hash value to each frame as a message integrity check to prevent tampering; commonly called “Michael” as an informal reference to MIC. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 28: Securing Wireless Networks + +■ Time stamp: A time stamp is added into the MIC to prevent replay attacks that attempt to reuse or replay frames that have already been sent. +■ Sender’s MAC address: The MIC also includes the sender’s MAC address as evidence of the frame source. +■ TKIP sequence counter: This feature provides a record of frames sent by a unique MAC address, to prevent frames from being replayed as an attack. +■ Key mixing algorithm: This algorithm computes a unique 128-bit WEP key for each frame. +■ Longer initialization vector (IV): The IV size is doubled from 24 to 48 bits, making it vir- +tually impossible to exhaust all WEP keys by brute-force calculation. + +661 + + + + + + +28 + + +TKIP became a reasonably secure stopgap security method, buying time until the 802.11i standard could be ratified. Some attacks have been created against TKIP, so it, too, should be avoided if a better method is available. In fact, TKIP was deprecated in the 802.11-2012 standard. + +CCMP +The Counter/CBC-MAC Protocol (CCMP) is considered to be more secure than TKIP. CCMP consists of two algorithms: + +■ AES counter mode encryption +■ Cipher Block Chaining Message Authentication Code (CBC-MAC) used as a message integrity check (MIC) + +The Advanced Encryption Standard (AES) is the current encryption algorithm adopted by U.S. National Institute of Standards and Technology (NIST) and the U.S. government, and widely used around the world. In other words, AES is open, publicly accessible, and repre-sents the most secure encryption method available today. + +Before CCMP can be used to secure a wireless network, the client devices and APs must support the AES counter mode and CBC-MAC in hardware. CCMP cannot be used on lega-cy devices that support only WEP or TKIP. How can you know if a device supports CCMP? Look for the WPA2 designation, which is described in the following section. + +GCMP +The Galois/Counter Mode Protocol (GCMP) is a robust authenticated encryption suite that is more secure and more efficient than CCMP. GCMP consists of two algorithms: + +■ AES counter mode encryption +■ Galois Message Authentication Code (GMAC) used as a message integrity check (MIC) + +GCMP is used in WPA3, which is described in the following section. + +WPA, WPA2, and WPA3 +This chapter covers a variety of authentication methods and encryption and message integrity algorithms. When it comes time to configure a WLAN with wireless security, + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +662 CCNA 200-301 Official Cert Guide, Volume 1 + +should you try to select some combination of schemes based on which one is best or which one is not deprecated? Which authentication methods are compatible with which encryption algorithms? + +The Wi-Fi Alliance (http://wi-fi.org), a nonprofit wireless industry association, has worked out straightforward ways to do that through its Wi-Fi Protected Access (WPA) industry certifications. To date, there are three different versions: WPA, WPA2, and WPA3. Wireless products are tested in authorized testing labs against stringent criteria that represent correct implementation of a standard. As long as the Wi-Fi Alliance has certified a wireless client device and an AP and its associated WLC for the same WPA version, they should be com-patible and offer the same security components. + +The Wi-Fi Alliance introduced its first generation WPA certification (known simply as WPA and not WPA1) while the IEEE 802.11i amendment for best practice security methods was still being developed. WPA was based on parts of 802.11i and included 802.1x authentica-tion, TKIP, and a method for dynamic encryption key management. + +Once 802.11i was ratified and published, the Wi-Fi Alliance included it in full in its WPA Version 2 (WPA2) certification. WPA2 is based around the superior AES CCMP algorithms, rather than the deprecated TKIP from WPA. It should be obvious that WPA2 was meant as a replacement for WPA. + +In 2018, the Wi-Fi Alliance introduced WPA Version 3 (WPA3) as a future replacement for WPA2, adding several important and superior security mechanisms. WPA3 leverages stronger encryption by AES with the Galois/Counter Mode Protocol (GCMP). It also uses Protected Management Frames (PMF) to secure important 802.11 management frames between APs and clients, to prevent malicious activity that might spoof or tamper with a BSS’s operation. + +Table 28-2 summarizes the basic differences between WPA, WPA2, and WPA3. Each suc-cessive version is meant to replace prior versions by offering better security features. You should avoid using WPA and use WPA2 instead—at least until WPA3 becomes widely avail-able on wireless client devices, APs, and WLCs. + +Table 28-2 Comparing WPA, WPA2, and WPA3 + +Authentication and Encryption Feature Support WPA Authentication with Pre-Shared Keys? Yes +Authentication with 802.1x? Yes + +Encryption and MIC with TKIP? Yes + +Encryption and MIC with AES and CCMP? Yes + +Encryption and MIC with AES and GCMP? No + +WPA2 WPA3* Yes Yes +Yes Yes + +No No + +Yes No + +No Yes + + +* WPA3 includes other features beyond WPA and WPA2, such as Simultaneous Authentication of Equals (SAE), Forward secrecy, and Protected management frames (PMF). + +Notice that all three WPA versions support two client authentication modes: a pre-shared key (PSK) or 802.1x, based on the scale of the deployment. These are also known as + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 28: Securing Wireless Networks 663 + +personal mode and enterprise mode, respectively. With personal mode, a key string must be shared or configured on every client and AP before the clients can connect to the wireless network. The pre-shared key is normally kept confidential so that unauthorized users have no knowledge of it. The key string is never sent over the air. Instead, clients and APs work +through a four-way handshake procedure that uses the pre-shared key string to construct +and exchange encryption key material that can be openly exchanged. Once that process is 28 +successful, the AP can authenticate the client and the two can secure data frames that are sent over the air. + +With WPA-Personal and WPA2-Personal modes, a malicious user can eavesdrop and capture the four-way handshake between a client and an AP. That user can then use a dictionary attack to automate guessing the pre-shared key. If he is successful, he can then decrypt the wireless data or even join the network posing as a legitimate user. + +WPA3-Personal avoids such an attack by strengthening the key exchange between clients and APs through a method known as Simultaneous Authentication of Equals (SAE). Rather than a client authenticating against a server or AP, the client and AP can initiate the authenti-cation process equally and even simultaneously. + +Even if a password or key is compromised, WPA3-Personal offers forward secrecy, which prevents attackers from being able to use a key to unencrypt data that has already been transmitted over the air. + +NOTE The Personal mode of any WPA version is usually easy to deploy in a small environ-ment or with clients that are embedded in certain devices because a simple text key string +is all that is needed to authenticate the clients. Be aware that every device using the WLAN must be configured with an identical pre-shared key. If you ever need to update or change the key, you must touch every device to do so. As well, the pre-shared key should remain a well kept secret; you should never divulge the pre-shared key to any unauthorized person. + +Notice from Table 28-2 that WPA, WPA2, and WPA3 also support 802.1x or enterprise authentication. This implies EAP-based authentication, but the WPA versions do not require any specific EAP method. Instead, the Wi-Fi Alliance certifies interoperability with well-known EAP methods like EAP-TLS, PEAP, EAP-TTLS, and EAP-SIM. Enterprise authentica-tion is more complex to deploy than personal mode because authentication servers must be set up and configured as a critical enterprise resource. + +NOTE The Wi-Fi Alliance has made wireless security configuration straightforward and consistent through its WPA, WPA2, and WPA3 certifications. Each version is meant to replace its predecessors because of improved security mechanisms. You should always select the highest WPA version that the clients and wireless infrastructure in your environment will support. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +664 CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter Review + +At this point in the chapter, you might still be a little overwhelmed with the number of acro-nyms and security terms to learn and keep straight in your mind. Spend some time reviewing Table 28-3, which lists all of the topics described in this chapter. The table is organized in a way that should help you remember how the acronyms and functions are grouped together. Remember that an effective wireless security strategy includes a method to authenticate clients and a method to provide data privacy and integrity. These two types of methods +are listed in the leftmost column. Work your way to the right to remember what types of authentication and privacy/integrity are available. The table also expands the name of each acronym as a memory tool. + +Also remember that WPA, WPA2, and WPA3 simplify wireless network configuration and compatibility because they limit which authentication and privacy/integrity methods can be used. + +Table 28-3 Review of Wireless Security Mechanisms and Options + +Security Type Mechanism +Authentication Open Methods +WEP + +Type Expansion + +Open Authentication +Wired Equivalent Privacy + +Credentials Used + +None, other than 802.11 protocol +Static WEP keys + + + +802.1x/EAP LEAP Lightweight EAP + +(Extensible +Authentication EAP-FAST EAP Flexible Protocol) Authentication by +Secure Tunneling + +Deprecated; uses dynamic WEP keys +Uses protected access credential (PAC) + + + + + + + + + +Privacy & TKIP Integrity Methods + +PEAP + +EAP-TLS + +Protected EAP + +EAP Transport Layer Security + +Temporal Key Integrity Protocol + +AS authenticated by digital certificate +Client and AS authenticated by digital certificate +N/A + +CCMP Counter/CBC-MAC N/A Protocol +GCMP Galois/Counter N/A Mode Protocol + + +You should also review this chapter’s material using either the tools in the book or the interactive tools for the same material found on the book’s companion website. Table 28-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 28: Securing Wireless Networks 665 + +Table 28-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Review memory tables + +Resource Used Book, website +Book, website +Book, PTP 28 + +Website + + + + +Review All the Key Topics +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 28-5 lists a reference of these key topics and the page numbers on which each is found. + +Table 28-5 Key Topics for Chapter 28 + +Key Topic Element List +Table 28-2 + +Table 28-3 + +Description 802.1x entities +WPA, WPA2, and WPA3 comparison + +Wireless security mechanism review + +Page Number 658 +662 + +664 + + + + +Key Terms You Should Know +802.1x, authentication server (AS), authenticator, certificate authority (CA), Counter/CBC-MAC Protocol (CCMP), EAP Flexible Authentication by Secure Tunneling (EAP-FAST), EAP Transport Layer Security (EAP-TLS), enterprise mode, Extensible Authentication Protocol (EAP), forward secrecy, Galois/Counter Mode Protocol (GCMP), Lightweight EAP (LEAP), message integrity check (MIC), open authentication, personal mode, protected access cre-dential (PAC), Protected EAP (PEAP), Protected Management Frame (PMF), Public Key Infrastructure (PKI), RADIUS server, Simultaneous Authentication of Equals (SAE), sup-plicant, Temporal Key Integrity Protocol (TKIP), Wired Equivalent Privacy (WEP), Wi-Fi Protected Access (WPA), WPA Version 2 (WPA2), WPA Version 3 (WPA3) + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +CHAPTER 29 + + +Building a Wireless LAN This chapter covers the following exam topics: +2.0 Network Access +2.7 Describe physical infrastructure connections of WLAN components (AP, WLC, access/trunk ports, and LAG) + +2.8 Describe AP and WLC management access connections (Telnet, SSH, HTTP, HTTPS, console, and TACACS+/RADIUS) + +2.9 Configure the components of a wireless LAN access for client connectivity using GUI only, such as WLAN creation, security settings, QoS profiles, and advanced WLAN settings +5.0 Security Fundamentals +5.10 Configure WLAN using WPA2 PSK using the GUI + +In Chapters 26 through 28, you learned about the fundamentals of wireless networks. As a CCNA, you will also need to know how to apply that knowledge toward building a function-ing network with APs and a WLC. + +In addition, based on the concepts you learned in Chapter 28, “Securing Wireless Networks,” you will be able to configure the WLAN to use WPA2-Personal. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 29-1 “Do I Know This Already?” Section-to-Question Mapping + +Foundation Topics Section Connecting a Cisco AP +Accessing a Cisco WLC + +Connecting a Cisco WLC + +Configuring a WLAN + +Questions 1–2 +3 + +4–5 + +6–8 + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +1. Suppose you need to connect a lightweight AP to a network. Which one of the fol-lowing link types would be necessary? +a. Access mode link b. Trunk mode link c. LAG mode link d. EtherChannel link +2. An autonomous AP will be configured to support three WLANs that correspond to three VLANs. The AP will connect to the network over which one of the following? +a. Access mode link b. Trunk mode link c. LAG mode link d. EtherChannel link +3. Suppose you would like to connect to a WLC to configure a new WLAN on it. Which one of the following is a valid method to use? +a. SSH +b. HTTPS c. HTTP +d. All of these answers are correct. +4. Which one of the following correctly describes the single logical link formed by bun-dling all of a controller’s distribution system ports together? +a. PHY b. DSP c. LAG d. GEC +5. Which one of the following controller interfaces maps a WLAN to a VLAN? a. Bridge interface +b. Virtual interface c. WLAN interface d. Dynamic interface +6. Which two of the following things are bound together when a new WLAN is created? a. VLAN +b. AP +c. Controller interface d. SSID + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +668 CCNA 200-301 Official Cert Guide, Volume 1 + +7. What is the maximum number of WLANs you can configure on a Cisco wireless controller? +a. 8 b. 16 c. 512 +d. 1024 + +8. Which of the following parameters are necessary when creating a new WLAN with the controller GUI? (Choose all that apply.) + +a. SSID +b. VLAN number c. Interface +d. BSSID +e. IP subnet + + +Foundation Topics + +Connecting a Cisco AP +A Cisco wireless network can consist of autonomous APs or lightweight APs that are cou-pled with one or more wireless LAN controllers. Both types of APs are covered in Chapter 27, “Analyzing Cisco Wireless Architectures,” from a functional perspective. You should also understand how to connect the wired side of each type of AP so that it can pass traffic between the appropriate VLANs and WLANs. + +Recall that an autonomous AP is a standalone device; nothing else is needed to forward Ethernet frames from a wired VLAN to a wireless LAN, and vice versa. In effect, the AP maps each VLAN to a WLAN and BSS. The autonomous AP has a single wired Ethernet interface, as shown in the left portion of Figure 29-1, which means that multiple VLANs must be brought to it over a trunk link. + +NOTE A switch port providing a wired connection to an AP must be configured to sup-port either access or trunk mode. In trunk mode, 802.1Q encapsulation tags each frame according to the VLAN number it came from. The wireless side of an AP inherently trunks 802.11 frames by marking them with the BSSID of the WLAN where they belong. + +A lightweight AP also has a single wired Ethernet interface; however, it must be paired with a WLC to be fully functional. Wired VLANs that terminate at the WLC can be mapped to WLANs that emerge at the AP. Even though multiple VLANs are being extended from the WLC to the AP, they are all carried over the CAPWAP tunnel between the two. That means the AP needs only an access link to connect to the network infrastructure and terminate its end of the tunnel, as shown in the right portion of Figure 29-1. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 669 + +WLC + + + + + + + +29 +CAPWAP + + +Switched LAN + + + +Trunk Link + + + +Autonomous AP + +Switched LAN + + + +Access Link + + + +Lightweight AP + + + + + + + + +Figure 29-1 Comparing Connections to Autonomous and Lightweight APs + +To configure and manage Cisco APs, you can connect a serial console cable from your PC to the console port on the AP. Once the AP is operational and has an IP address, you can also use Telnet or SSH to connect to its CLI over the wired network. Autonomous APs support browser-based management sessions via HTTP and HTTPS. You can manage lightweight APs from a browser session to the WLC. + +Accessing a Cisco WLC +To connect and configure a WLC, you will need to open a web browser to the WLC’s man-agement address with either HTTP or HTTPS. This can be done only after the WLC has an initial configuration and a management IP address assigned to its management interface. The web-based GUI provides an effective way to monitor, configure, and troubleshoot a wireless network. You can also connect to a WLC with an SSH session, where you can use its CLI to monitor, configure, and debug activity. + +Both the web-based GUI and the CLI require management users to log in. Users can be authenticated against an internal list of local usernames or against an authentication, authori-zation, and accounting (AAA) server, such as TACACS+ or RADIUS. + +When you first open a web browser to the management address, you will see the initial login screen. Click on the Login button, as shown in Figure 29-2; then enter your user credentials as you are prompted for them. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +670 CCNA 200-301 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + + + + + + + +Figure 29-2 Accessing a WLC with a Web Browser + + +NOTE The CCNA exam objectives focus on using the WLC GUI to configure a WLAN and a security suite. Therefore, the examples in this section assume that someone has already entered an initial configuration to give the WLC a working IP address for management. + +When you are successfully logged in, the WLC will display a monitoring dashboard similar to the one shown in Figure 29-3. You will not be able to make any configuration changes there, so you must click on the Advanced link in the upper-right corner. This will bring up the full WLC GUI, as shown in Figure 29-4. + +Notice the tabs across the top of the screen in Figure 29-4. You can select categories of functions from among Monitor, WLANs, Controller, Wireless, Security, and so on. As you select one of these categories, the vertical list of functions at the left side of the screen will change accordingly. You can expand the list entries if needed and select one to work on. The main screen area will display all of the relevant fields and options you can edit as you make configuration changes. You will get a feel for which tabs and list items you should use as you work through the remainder of the chapter. + + + + + +Answers to the “Do I Know This Already?” quiz: 1 A 2 B 3 D 4 C 5 D 6 C, D 7 C 8 A, C + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 671 + + + + + + + + + +29 + + + + + + + + + + + + + +Figure 29-3 + + + + + + + + + + + + + + + + +Figure 29-4 + + +Accessing the Advanced Configuration Interface + + + + + + + + + + + + + + + + +The Advanced WLC Configuration GUI + + +Connecting a Cisco WLC +Connecting a Cisco wireless LAN controller to the network is not quite as straightforward because it has several different types of connections. From your work with Cisco routers and switches, you probably know that the terms interface and port are usually interchange-able. For example, switches can come in 48-port models, and you apply configuration chang-es to the corresponding interfaces. Cisco wireless controllers differ a bit; ports and interfaces refer to different concepts. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +672 CCNA 200-301 Official Cert Guide, Volume 1 + +Controller ports are physical connections made to an external wired or switched network, whereas interfaces are logical connections made internally within the controller. The follow-ing sections explain each connection type in more detail. You will learn more about config-uring ports and interfaces in the “Configuring a WLAN” section later in the chapter. + +Using WLC Ports +You can connect several different types of controller ports to your network, as shown in Figure 29-5 and discussed in the following list: + +■ Service port: Used for out-of-band management, system recovery, and initial boot func-tions; always connects to a switch port in access mode +■ Distribution system port: Used for all normal AP and management traffic; usually con-nects to a switch port in 802.1Q trunk mode +■ Console port: Used for out-of-band management, system recovery, and initial boot func-tions; asynchronous connection to a terminal emulator (9600 baud, 8 data bits, 1 stop bit, by default) +■ Redundancy port: Used to connect to a peer controller for high availability (HA) operation + + + + + +AP + + + + + +Figure 29-5 + +CAPWAP +Distribution Switched Infrastructure Ports + +LAG + +Service Port + + +Cisco Wireless LAN Controller Ports + + + + +WLC + + + + +Console + + +Controllers can have a single service port that must be connected to a switched network. Usually, the service port is assigned to a management VLAN so that you can access the controller with SSH or a web browser to perform initial configuration or for maintenance. Notice that the service port supports only a single VLAN, so the corresponding switch port must be configured for access mode only. + +Controllers also have multiple distribution system ports that you must connect to the net-work. These ports carry most of the data coming to and going from the controller. For example, the CAPWAP tunnels (control and data) that extend to each of a controller’s APs pass across the distribution system ports. Client data also passes from wireless LANs to wired VLANs over the ports. In addition, any management traffic using a web browser, SSH, Simple Network Management Protocol (SNMP), Trivial File Transfer Protocol (TFTP), and so on, normally reaches the controller in-band through the ports. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 673 + + +NOTE You might be thinking that distribution system ports is an odd name for what appear to be regular data ports. Recall from the section titled “Wireless LAN Topologies” in Chapter 26, “Fundamentals of Wireless Networks,” that the wired network that connects APs together is called the distribution system (DS). With the split MAC architecture, the point where APs touch the DS is moved upstream to the WLC instead. + +Because the distribution system ports must carry data that is associated with many different +VLANs, VLAN tags and numbers become very important. For that reason, the distribution 29 system ports always operate in 802.1Q trunking mode. When you connect the ports to a +switch, you should also configure the switch ports for unconditional 802.1Q trunk mode. + +The distribution system ports can operate independently, each one transporting multiple VLANs to a unique group of internal controller interfaces. For resiliency, you can configure distribution system ports in redundant pairs. One port is primarily used; if it fails, a backup port is used instead. + +To get the most use out of each distribution system port, you can configure all of them to operate as a single logical group, much like an EtherChannel or port-channel on a switch. Controller distribution system ports can be configured as a link aggregation group (LAG) such that they are bundled together to act as one larger link. In Figure 29-5, the four dis-tribution system ports are configured as a LAG. With a LAG configuration, traffic can be load-balanced across the individual ports that make up the LAG. In addition, LAG offers resiliency; if one individual port fails, traffic will be redirected to the remaining working ports instead. + +NOTE Be aware that even though the LAG acts as a traditional EtherChannel, Cisco WLCs do not support any link aggregation negotiation protocol, like LACP or PaGP, at all. Therefore, you must configure the switch ports as an unconditional or always-on EtherChannel. + + +Using WLC Interfaces +Through its distribution system ports, a controller can connect to multiple VLANs on the switched network. Internally, the controller must somehow map those wired VLANs to equivalent logical wireless networks. For example, suppose that VLAN 10 is set aside for wireless users in the Engineering division of a company. That VLAN must be connected to a unique wireless LAN that exists on a controller and its associated APs. The wireless LAN must then be extended to every client that associates with the Service Set Identifier (SSID) “Engineering.” + +Cisco wireless controllers provide the necessary connectivity through internal logical inter-faces, which must be configured with an IP address, subnet mask, default gateway, and a Dynamic Host Configuration Protocol (DHCP) server. Each interface is then assigned to a physical port and a VLAN ID. You can think of an interface as a Layer 3 termination on a VLAN. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +674 CCNA 200-301 Official Cert Guide, Volume 1 + +Cisco controllers support the following interface types, also shown in Figure 29-6. + +■ Management interface: Used for normal management traffic, such as RADIUS user authentication, WLC-to-WLC communication, web-based and SSH sessions, SNMP, Network Time Protocol (NTP), syslog, and so on. The management interface is also used to terminate CAPWAP tunnels between the controller and its APs. +■ Redundancy management: The management IP address of a redundant WLC that is part of a high availability pair of controllers. The active WLC uses the management interface address, while the standby WLC uses the redundancy management address. +■ Virtual interface: IP address facing wireless clients when the controller is relaying client DHCP requests, performing client web authentication, and supporting client mobility. +■ Service port interface: Bound to the service port and used for out-of-band management. ■ Dynamic interface: Used to connect a VLAN to a WLAN. + +Switch +WLC AP + + + + +VLAN a + + +VLAN n + +Dynamic Interface + +Dynamic Interface + + +WLAN 1 SSID + + +WLAN n SSID + + + +VLAN x Management + +Redundancy Management + + +VLAN y Service Port + + +Figure 29-6 Cisco Wireless LAN Controller Interfaces + +The management interface faces the switched network, where management users and APs are located. Management traffic will usually consist of protocols like HTTPS, SSH, SNMP, NTP, TFTP, and so on. In addition, management interface traffic consists of CAPWAP packets that carry control and data tunnels to and from the APs. + +The virtual interface is used only for certain client-facing operations. For example, when a wireless client issues a request to obtain an IP address, the controller can relay the request on to an actual DHCP server that can provide the appropriate IP address. From the client’s perspective, the DHCP server appears to be the controller’s virtual interface address. Clients may see the virtual interface’s address, but that address is never used when the controller communicates with other devices on the switched network. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 675 + +Because the virtual interface is used only for some client management functions, you should configure it with a unique, nonroutable address. For example, you might use 10.1.1.1 because it is within a private address space defined in RFC 1918. + +NOTE Traditionally, many people have assigned IP address 1.1.1.1 to the virtual interface. + +Although it is a unique address, it is routable and already in use elsewhere on the Internet. A better practice is to use an IP address from the RFC 1918 private address space that is unused or reserved, such as 192.168.1.1. You could also use a reserved address from RFC +5737 (192.0.2.0/24) that is set aside for documentation purposes and is never used. + + + + +29 + + +The virtual interface address is also used to support client mobility. For that reason, every controller that exists in the same mobility group should be configured with a virtual address that is identical to the others. By using one common virtual address, all the controllers will appear to operate as a cluster as clients roam from controller to controller. + +Dynamic interfaces map WLANs to VLANs, making the logical connections between wireless and wired networks. You will configure one dynamic interface for each wireless LAN that is offered by the controller’s APs and then map the interface to the WLAN. Each dynamic interface must also be configured with its own IP address and can act as a DHCP relay for wireless clients. To filter traffic passing through a dynamic interface, you can con-figure an optional access list. + +Configuring a WLAN +A wireless LAN controller and an access point work in concert to provide network con-nectivity to wireless clients. From a wireless perspective, the AP advertises a Service Set Identifier (SSID) for the client to join. From a wired perspective, the controller connects to a virtual LAN (VLAN) through one of its dynamic interfaces. To complete the path between the SSID and the VLAN, as illustrated in Figure 29-7, you must first define a WLAN on the controller. + +NOTE Two of the CCNA exam objectives involve configuring a WLAN for client connec-tivity with WPA2 and a PSK using only the controller GUI. As you work through this sec-tion, you will find that it presents a complete WLAN example that is based on the topology shown in Figure 29-7 using the WPA2-Personal (PSK) security model. + + + +SSID engineering AP + +192.168.199.0/24 + +WLC Interface Engineering VLAN 100 +192.168.199.199/24 + + +CAPWAP + +WLAN VLAN + +Figure 29-7 Connecting Wired and Wireless Networks with a WLAN + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +676 CCNA 200-301 Official Cert Guide, Volume 1 + +The controller will bind the WLAN to one of its interfaces and then push the WLAN configu-ration out to all of its APs by default. From that point on, wireless clients will be able to learn about the new WLAN by receiving its beacons and will be able to probe and join the new BSS. + +Like VLANs, you can use WLANs to segregate wireless users and their traffic into logical networks. Users associated with one WLAN cannot cross over into another one unless their traffic is bridged or routed from one VLAN to another through the wired network infrastructure. + +Before you begin to create new WLANs, it is usually wise to plan your wireless network first. In a large enterprise, you might have to support a wide variety of wireless devices, user communities, security policies, and so on. You might be tempted to create a new WLAN for every occasion, just to keep groups of users isolated from each other or to support different +types of devices. Although that is an appealing strategy, you should be aware of two limitations: + +■ Cisco controllers support a maximum of 512 WLANs, but only 16 of them can be active-ly configured on an AP. +■ Advertising each WLAN to potential wireless clients uses up valuable airtime. + +Every AP must broadcast beacon management frames at regular intervals to advertise the existence of a BSS. Because each WLAN is bound to a BSS, each WLAN must be advertised with its own beacons. Beacons are normally sent 10 times per second, or once every 100 ms, at the lowest mandatory data rate. The more WLANs you have created, the more beacons you will need to announce them. + +Even further, the lower the mandatory data rate, the more time each beacon will take to be transmitted. The end result is this: if you create too many WLANs, a channel can be starved of any usable airtime. Clients will have a hard time transmitting their own data because the channel is overly busy with beacon transmissions coming from the AP. As a rule of thumb, always limit the number of WLANs to five or fewer; a maximum of three WLANs is best. + +By default, a controller has a limited initial configuration, so no WLANs are defined. Before you create a new WLAN, think about the following parameters it will need to have: + +■ SSID string +■ Controller interface and VLAN number ■ Type of wireless security needed + +As you work through this section, you will create the appropriate dynamic controller inter-face to support the new WLAN; then you will enter the necessary WLAN parameters. Each configuration step is performed using a web browser session that is connected to the WLC’s management IP address. + +Step 1. Configure a RADIUS Server +If your new WLAN will use a security scheme that requires a RADIUS server, such as WPA2-Enterprise or WPA3-Enterprise, you will need to define the server first. Select Security > AAA > RADIUS > Authentication to see a list of servers that have already been configured, as shown in Figure 29-8. If multiple servers are defined, the controller will try them in sequential order. Click New to create a new server. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 677 + +Next, enter the server’s IP address, shared secret key, and port number, as shown in Figure 29-9. Because the controller already had two other RADIUS servers configured, the server at 192.168.200.30 will be index number 3. Be sure to set the server status to Enabled so that the controller can begin using it. At the bottom of the page, you can select the type of user that will be authenticated with the server. Check Network User to authenticate wireless cli-ents or Management to authenticate wireless administrators that will access the controller’s management functions. Click Apply to complete the server configuration. + +29 + + + + + + + + + + + + + + + + + +Figure 29-8 + + + + + + + + + + + + + + + + + + + + + +Figure 29-9 + + +Displaying the List of RADIUS Authentication Servers + + + + + + + + + + + + + + + + + + + + + +Configuring a New RADIUS Server + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +678 CCNA 200-301 Official Cert Guide, Volume 1 + +Step 2. Create a Dynamic Interface +In the “Using WLC Interfaces” section of this chapter, you learned about the different types of controller interfaces. A dynamic interface is used to connect the controller to a VLAN +on the wired network. When you create a WLAN, you will bind the dynamic interface (and VLAN) to a wireless network. + +To create a new dynamic interface, navigate to Controller > Interfaces. You should see a list of all the controller interfaces that are currently configured. In Figure 29-10, two interfaces named “management” and “virtual” already exist. Click the New button to define a new interface. Enter a name for the interface and the VLAN number it will be bound to. In Figure 29-11, the interface named Engineering is mapped to wired VLAN 100. Click the Apply button. + + + + + + + + + + +Figure 29-10 + + + + + + + + + + +Figure 29-11 + + +Displaying a List of Dynamic Interfaces + + + + + + + + + + +Defining a Dynamic Interface Name and VLAN ID + + +Next, enter the IP address, subnet mask, and gateway address for the interface. You should also define primary and secondary DHCP server addresses that the controller will use when it relays DHCP requests from clients that are bound to the interface. Figure 29-12 shows how the interface named Engineering has been configured with IP address 192.168.100.10, subnet mask 255.255.255.0, gateway 192.168.100.1, and DHCP servers 192.168.1.17 and 192.168.1.18. Click the Apply button to complete the interface configuration and return to the list of interfaces. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 679 + + + + + + + + + +29 + + + + + + + + + + + + + + +Figure 29-12 Editing the Dynamic Interface Parameters + +Step 3. Create a New WLAN +You can display a list of the currently defined WLANs by selecting WLANs from the top menu bar. In Figure 29-13, the controller does not have any WLANs already defined. You can create a new WLAN by selecting Create New from the drop-down menu and then click-ing the Go button. + + + + + + + + + + +Figure 29-13 Displaying a List of WLANs + +Next, enter a descriptive name as the profile name and the SSID text string. In Figure 29-14, the profile name and SSID are identical, just to keep things straightforward. The ID number is used as an index into the list of WLANs that are defined on the controller. The ID number becomes useful when you use templates in Prime Infrastructure (PI) to configure WLANs on multiple controllers at the same time. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +680 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE WLAN templates are applied to specific WLAN ID numbers on controllers. The WLAN ID is only locally significant and is not passed between controllers. As a rule, you should keep the sequence of WLAN names and IDs consistent across multiple controllers so that any configuration templates you use in the future will be applied to the same WLANs on each controller. + + + + + + + + + +Figure 29-14 Creating a New WLAN + +Click the Apply button to create the new WLAN. The next page will allow you to edit four categories of parameters, corresponding to the tabs across the top as shown in Figure 29-15. By default, the General tab is selected. + + + + + + + + + + + + + + + + + +Figure 29-15 Configuring the General WLAN Parameters + +You can control whether the WLAN is enabled or disabled with the Status check box. Even though the General page shows a specific security policy for the WLAN (the default WPA2 with 802.1x), you can make changes in a later step through the Security tab. + +Under Radio Policy, select the type of radio that will offer the WLAN. By default, the WLAN will be offered on all radios that are joined with the controller. You can select a more specific policy with 802.11a only, 802.11a/g only, 802.11g only, or 802.11b/g only. For exam-ple, if you are creating a new WLAN for devices that have only a 2.4-GHz radio, it probably does not make sense to advertise the WLAN on both 2.4- and 5-GHz AP radios. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Chapter 29: Building a Wireless LAN + +Next, select which of the controller’s dynamic interfaces will be bound to the WLAN. By default, the management interface is selected. The drop-down list contains all the interface names that are available. In Figure 29-15, the new engineering WLAN will be bound to the Engineering interface. + +Finally, use the Broadcast SSID check box to select whether the APs should broadcast the SSID name in the beacons they transmit. Broadcasting SSIDs is usually more convenient for users because their devices can learn and display the SSID names automatically. In fact, most devices actually need the SSID in the beacons to understand that the AP is still available for that SSID. Hiding the SSID name, by not broadcasting it, does not really provide any worth-while security. Instead, it just prevents user devices from discovering an SSID and trying to +use it as a default network. + +681 + + + + + + + + + +29 + + +Configuring WLAN Security +Select the Security tab to configure the security settings. By default, the Layer 2 Security tab is selected. From the Layer 2 Security drop-down menu, select the appropriate security scheme to use. Table 29-2 lists the types that are available. + + +Table 29-2 Option +None + +Layer 2 WLAN Security Type Description +Open authentication + + + +WPA+WPA2 + +802.1x + +Static WEP + +Static WEP + 802.1x + +CKIP + +None + EAP Passthrough + +Wi-Fi protected access WPA or WPA2 + +EAP authentication with dynamic WEP + +WEP key security + +EAP authentication or static WEP + +Cisco Key Integrity Protocol + +Open authentication with remote EAP authentication + + + +As you select a security type, be sure to remember which choices are types that have been deprecated or proven to be weak, and avoid them if possible. Further down the screen, you can select which specific WPA, WPA2, and WPA3 methods to support on the WLAN. You can select more than one, if you need to support different types of wireless clients that require several security methods. + +In Figure 29-16, WPA+WPA2 has been selected from the pull-down menu; then only WPA2 and AES encryption have been selected. WPA and TKIP have been avoided because they are legacy, deprecated methods. Under the Authentication Key Management section, you can select the authentication methods the WLAN will use. Only PSK has been selected in the figure, so the WLAN will allow only WPA2-Personal with pre-shared key authentication. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +682 CCNA 200-301 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + + + + + + + +Figure 29-16 Configuring Layer 2 WLAN Security + +To use WPA2-Enterprise, the 802.1X option would be selected. In that case, 802.1x and EAP would be used to authenticate wireless clients against one or more RADIUS servers. The controller would use servers from the global list you have defined under Security > AAA > RADIUS > Authentication, as described in the “Step 1. Configure a RADIUS Server” sec-tion in this chapter. To specify which servers the WLAN should use, you would select the Security tab and then the AAA Servers tab in the WLAN edit screen. You can identify up +to six specific RADIUS servers in the WLAN configuration. Beside each server, select a spe-cific server IP address from the drop-down menu of globally defined servers. The servers are tried in sequential order until one of them responds. Although the example in this chapter uses WPA2-Personal, Figure 29-17 shows what a WLAN configured for WPA2-Enterprise might look like, with servers 1 through 3 being set to 192.168.200.28, 192.168.200.29, and 192.168.200.30, respectively. + +By default, a controller will contact a RADIUS server from its management interface. You can override this behavior by checking the box next to Radius Server Overwrite Interface so that the controller sources RADIUS requests from the dynamic interface that is associated with the WLAN. + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 683 + + + + + + + + + +29 + + + + + + + + + +Figure 29-17 Selecting RADIUS Servers for WLAN Authentication + +Configuring WLAN QoS +Select the QoS tab to configure quality of service settings for the WLAN, as shown in Figure 29-18. By default, the controller will consider all frames in the WLAN to be normal data, to be handled in a “best effort” manner. You can set the Quality of Service (QoS) drop-down menu to classify all frames in one of the following ways: + +■ Platinum (voice) ■ Gold (video) +■ Silver (best effort) +■ Bronze (background) + + + + + + + + + + + + + + +Figure 29-18 Configuring QoS Settings + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +684 CCNA 200-301 Official Cert Guide, Volume 1 + +You can also set the Wi-Fi Multimedia (WMM) policy, call admission control (CAC) poli-cies, and bandwidth parameters on the QoS page. You can learn more about QoS in the CCNA 200-301 Official Cert Guide, Volume 2, in Chapter 11, “Quality of Service.” + +Configuring Advanced WLAN Settings +Finally, you can select the Advanced tab to configure a variety of advanced WLAN settings. From the page shown in Figure 29-19, you can enable functions such as coverage hole detec-tion, peer-to-peer blocking, client exclusion, client load limits, and so on. + + + + + + + + + + + + + + + + + + +Figure 29-19 Configuring Advanced WLAN Settings + +Although most of the advanced settings are beyond the scope of the CCNA objectives, you should be aware of a few defaults that might affect your wireless clients. + +By default, client sessions with the WLAN are limited to 1800 seconds (30 minutes). Once that session time expires, a client will be required to reauthenticate. This setting is controlled by the Enable Session Timeout check box and the Timeout field. + +A controller maintains a set of security policies that are used to detect potentially malicious wireless clients. If a client exhibits a certain behavior, the controller can exclude it from the WLAN for a period of time. By default, all clients are subject to the policies configured under Security > Wireless Protection Policies > Client Exclusion Policies. These policies include excessive 802.11 association failures, 802.11 authentication failures, 802.1x authen-tication failures, web authentication failures, and IP address theft or reuse. Offending clients will be automatically excluded or blocked for 60 seconds, as a deterrent to attacks on the wireless network. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Chapter 29: Building a Wireless LAN 685 + + +NOTE Is 60 seconds really enough time to deter an attack coming from a wireless client? In the case of a brute-force attack, where passwords are guessed from a dictionary of pos-sibilities, 60 seconds is enough to disrupt and delay an attacker’s progress. What might have taken 2 minutes to find a matching password without an exclusion policy would take 15 years with one. + + + +Finalizing WLAN Configuration +When you are satisfied with the settings in each of the WLAN configuration tabs, click the Apply button in the upper-right corner of the WLAN Edit screen. The WLAN will be cre-ated and added to the controller configuration. In Figure 29-20, the Engineering WLAN has +been added as WLAN ID 1 and is enabled for use. + + +29 + + + + + + + + + +Figure 29-20 Displaying WLANs Configured on a Controller + +Be aware that, by default, a controller will not allow management traffic that is initiated from a WLAN. That means you (or anybody else) cannot access the controller GUI or CLI from +a wireless device that is associated to the WLAN. This is considered to be a good security practice because the controller is kept isolated from networks that might be easily acces-sible or where someone might eavesdrop on the management session traffic. Instead, you can access the controller through its wired interfaces. + +You can change the default behavior on a global basis (all WLANs) by selecting the Management tab and then selecting Mgmt Via Wireless, as shown in Figure 29-21. Check the box to allow management sessions from any WLAN that is configured on the controller. + + + + + + + + + + + + + + + +Figure 29-21 Configuring Management Access from Wireless Networks + + +|||||||||||||||||||| +|||||||||||||||||||| + + +686 CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter Review + +Review this chapter’s material using either the tools in the book or the interactive tools for the same material found on the book’s companion website. Table 29-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + +Table 29-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms + +Answer DIKTA questions + +Resource Used Book, website +Book, website + +Book, PTP + + + + +Review All the Key Topics +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 29-4 lists a reference of these key topics and the page numbers on which each is found. + +Table 29-4 Key Topics for Chapter 29 + +Key Topic Element Figure 29-1 +Figure 29-5 + +Figure 29-6 + +Figure 29-7 + +Table 29-2 + +Description +Physical connections to an AP + +Wireless LAN controller ports + +Wireless LAN controller interfaces + +Creating a WLAN + +Configuring WLAN security + +Page Number 669 +672 + +674 + +675 + +681 + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Part VIII Review + +Keep track of your part review progress with the checklist in Table P8-1. Details on each task follow the table. + + +Table P8-1 + +Activity + +Part VIII Part Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + + +Repeat All DIKTA Questions +For this task, use the PCPT software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or using the Key Topics application on the companion website. + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Part IX + + +Appendixes + + + + +Glossary + +Appendix A Numeric Reference Tables + +Appendix B Exam Updates + +Appendix C Answers to the “Do I Know This Already?” Quizzes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX A + + + + +Numeric Reference Tables + +This appendix provides several useful reference tables that list numbers used throughout this book. Specifically: + +Table A-1: A decimal-binary cross reference, useful when converting from decimal to binary and vice versa. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +694 CCNA 200-301 Official Cert Guide, Volume 1 + +Table A-1 Decimal-Binary Cross Reference, Decimal Values 0–255 + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + + + +0 00000000 32 + +1 00000001 33 + +2 00000010 34 + +3 00000011 35 + +4 00000100 36 + +5 00000101 37 + +6 00000110 38 + +7 00000111 39 + +8 00001000 40 + +9 00001001 41 + +10 00001010 42 + +11 00001011 43 + +12 00001100 44 + +13 00001101 45 + +14 00001110 46 + +15 00001111 47 + +16 00010000 48 + +17 00010001 49 + +18 00010010 50 + +19 00010011 51 + +20 00010100 52 + +21 00010101 53 + +22 00010110 54 + +23 00010111 55 + +24 00011000 56 + +25 00011001 57 + +26 00011010 58 + +27 00011011 59 + +28 00011100 60 + +29 00011101 61 + +30 00011110 62 + +31 00011111 63 + +00100000 64 + +00100001 65 + +00100010 66 + +00100011 67 + +00100100 68 + +00100101 69 + +00100110 70 + +00100111 71 + +00101000 72 + +00101001 73 + +00101010 74 + +00101011 75 + +00101100 76 + +00101101 77 + +00101110 78 + +00101111 79 + +00110000 80 + +00110001 81 + +00110010 82 + +00110011 83 + +00110100 84 + +00110101 85 + +00110110 86 + +00110111 87 + +00111000 88 + +00111001 89 + +00111010 90 + +00111011 91 + +00111100 92 + +00111101 93 + +00111110 94 + +00111111 95 + +01000000 96 + +01000001 97 + +01000010 98 + +01000011 99 + +01000100 100 + +01000101 101 + +01000110 102 + +01000111 103 + +01001000 104 + +01001001 105 + +01001010 106 + +01001011 107 + +01001100 108 + +01001101 109 + +01001110 110 + +01001111 111 + +01010000 112 + +01010001 113 + +01010010 114 + +01010011 115 + +01010100 116 + +01010101 117 + +01010110 118 + +01010111 119 + +01011000 120 + +01011001 121 + +01011010 122 + +01011011 123 + +01011100 124 + +01011101 125 + +01011110 126 + +01011111 127 + +01100000 + +01100001 + +01100010 + +01100011 + +01100100 + +01100101 + +01100110 + +01100111 + +01101000 + +01101001 + +01101010 + +01101011 + +01101100 + +01101101 + +01101110 + +01101111 + +01110000 + +01110001 + +01110010 + +01110011 + +01110100 + +01110101 + +01110110 + +01110111 + +01111000 + +01111001 + +01111010 + +01111011 + +01111100 + +01111101 + +01111110 + +01111111 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix A: Numeric Reference Tables 695 + + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + + + +128 10000000 160 + +129 10000001 161 + +130 10000010 162 + +131 10000011 163 + +132 10000100 164 + +133 10000101 165 + +134 10000110 166 + +135 10000111 167 + +136 10001000 168 + +137 10001001 169 + +138 10001010 170 + +139 10001011 171 + +140 10001100 172 + +141 10001101 173 + +142 10001110 174 + +143 10001111 175 + +144 10010000 176 + +145 10010001 177 + +146 10010010 178 + +147 10010011 179 + +148 10010100 180 + +149 10010101 181 + +150 10010110 182 + +151 10010111 183 + +152 10011000 184 + +153 10011001 185 + +154 10011010 186 + +155 10011011 187 + +156 10011100 188 + +157 10011101 189 + +158 10011110 190 + +159 10011111 191 + +10100000 192 + +10100001 193 + +10100010 194 + +10100011 195 + +10100100 196 + +10100101 197 + +10100110 198 + +10100111 199 + +10101000 200 + +10101001 201 + +10101010 202 + +10101011 203 + +10101100 204 + +10101101 205 + +10101110 206 + +10101111 207 + +10110000 208 + +10110001 209 + +10110010 210 + +10110011 211 + +10110100 212 + +10110101 213 + +10110110 214 + +10110111 215 + +10111000 216 + +10111001 217 + +10111010 218 + +10111011 219 + +10111100 220 + +10111101 221 + +10111110 222 + +10111111 223 + +11000000 224 + +11000001 225 + +11000010 226 + +11000011 227 + +11000100 228 + +11000101 229 + +11000110 230 + +11000111 231 + +11001000 232 + +11001001 233 + +11001010 234 + +11001011 235 + +11001100 236 + +11001101 237 + +11001110 238 + +11001111 239 + +11010000 240 + +11010001 241 + +11010010 242 + +11010011 243 + +11010100 244 + +11010101 245 + +11010110 246 + +11010111 247 + +11011000 248 + +11011001 249 + +11011010 250 + +11011011 251 + +11011100 252 + +11011101 253 + +11011110 254 + +11011111 255 + +11100000 + +11100001 + +11100010 + +11100011 + +11100100 + +11100101 + +11100110 + +11100111 + +11101000 +11101001 A + +11101010 + +11101011 + +11101100 + +11101101 + +11101110 + +11101111 + +11110000 + +11110001 + +11110010 + +11110011 + +11110100 + +11110101 + +11110110 + +11110111 + +11111000 + +11111001 + +11111010 + +11111011 + +11111100 + +11111101 + +11111110 + +11111111 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +696 CCNA 200-301 Official Cert Guide, Volume 1 + +Table A-2: A hexadecimal-binary cross reference, useful when converting from hex to binary and vice versa. + + +Table A-2 Hex +0 + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 + +9 + +A + +B + +C + +D + +E + +F + +Hex-Binary Cross Reference 4-Bit Binary +0000 + +0001 + +0010 + +0011 + +0100 + +0101 + +0110 + +0111 + +1000 + +1001 + +1010 + +1011 + +1100 + +1101 + +1110 + +1111 + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix A: Numeric Reference Tables 697 + +Table A-3: Powers of 2, from 21 through 232. + + +Table A-3 X +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 + +9 + +10 + +11 + +12 + +13 + +14 + +15 + +16 + +Powers of 2 2X +2 + +4 + +8 + +16 + +32 + +64 + +128 + +256 + +512 + +1024 + +2048 + +4096 + +8192 + +16,384 + +32,768 + +65,536 + + +X 2X 17 131,072 +18 262,144 + +19 524,288 + +20 1,048,576 + +21 2,097,152 + +22 4,194,304 + +23 8,388,608 + +24 16,777,216 +25 33,554,432 A + +26 67,108,864 + +27 134,217,728 + +28 268,435,456 + +29 536,870,912 + +30 1,073,741,824 + +31 2,147,483,648 + +32 4,294,967,296 + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +698 CCNA 200-301 Official Cert Guide, Volume 1 + +Table A-4: Table of all 33 possible subnet masks, in all three formats. + + +Table A-4 Decimal +0.0.0.0 + +All Subnet Masks Prefix +/0 + + +Binary +00000000 00000000 00000000 00000000 + + + +128.0.0.0 /1 192.0.0.0 /2 224.0.0.0 /3 240.0.0.0 /4 248.0.0.0 /5 252.0.0.0 /6 254.0.0.0 /7 255.0.0.0 /8 255.128.0.0 /9 255.192.0.0 /10 255.224.0.0 /11 255.240.0.0 /12 255.248.0.0 /13 255.252.0.0 /14 255.254.0.0 /15 255.255.0.0 /16 255.255.128.0 /17 255.255.192.0 /18 255.255.224.0 /19 255.255.240.0 /20 255.255.248.0 /21 255.255.252.0 /22 255.255.254.0 /23 255.255.255.0 /24 255.255.255.128 /25 255.255.255.192 /26 255.255.255.224 /27 255.255.255.240 /28 255.255.255.248 /29 255.255.255.252 /30 255.255.255.254 /31 +255.255.255.255 /32 + +10000000 00000000 00000000 00000000 11000000 00000000 00000000 00000000 11100000 00000000 00000000 00000000 11110000 00000000 00000000 00000000 11111000 00000000 00000000 00000000 11111100 00000000 00000000 00000000 11111110 00000000 00000000 00000000 11111111 00000000 00000000 00000000 11111111 10000000 00000000 00000000 11111111 11000000 00000000 00000000 11111111 11100000 00000000 00000000 11111111 11110000 00000000 00000000 11111111 11111000 00000000 00000000 11111111 11111100 00000000 00000000 11111111 11111110 00000000 00000000 11111111 11111111 00000000 00000000 11111111 11111111 10000000 00000000 11111111 11111111 11000000 00000000 11111111 11111111 11100000 00000000 11111111 11111111 11110000 00000000 11111111 11111111 11111000 00000000 11111111 11111111 11111100 00000000 11111111 11111111 11111110 00000000 11111111 11111111 11111111 00000000 11111111 11111111 11111111 10000000 11111111 11111111 11111111 11000000 11111111 11111111 11111111 11100000 11111111 11111111 11111111 11110000 11111111 11111111 11111111 11111000 11111111 11111111 11111111 11111100 11111111 11111111 11111111 11111110 +11111111 11111111 11111111 11111111 + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX B + + + + +CCNA 200-301, Volume 1 Exam Updates + +Over time, reader feedback allows Pearson to gauge which topics give our readers the most problems when taking the exams. To assist readers with those topics, the authors create new materials clarifying and expanding on those troublesome exam topics. As mentioned in the Introduction, the additional content about the exam is contained in a PDF on this book’s companion website, at http://www.ciscopress.com/title/9780135792735. + +This appendix provides you with updated information if Cisco makes minor modifications to the exam topics during the life of the 200-301 exam. In particular, this appendix does the following: + +■ Mentions technical items that might not have been mentioned elsewhere in the book ■ Covers new topics if Cisco adds new content to the exam over time +■ Provides a way to get up-to-the-minute current information about content for the exam + +Note that this appendix shows updated information related to the subset of CCNA 200-301 exam topics covered in this book. Refer also to the CCNA 200-301 Official Cert Guide, Volume 2, for more details about the rest of the exam topics and for an Appendix B similar to that of this book. + +Always Get the Latest at the Book’s Product Page +Many of you are reading the version of this appendix that was available when your book was printed or when you downloaded the e-book. However, given that the main purpose of this appendix is to be a living, changing document, it is important that you look for the latest version online at the book’s companion website. To do so, follow these steps: +Step 1. Browse to www.ciscopress.com/title/9780135792735. + +Step 2. Click the Updates tab. + +Step 3. If there is a new Appendix B document on the page, download the latest Appendix B document. + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +700 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE The downloaded document has a version number. Comparing the version of the print Appendix B (Version 1.0) with the latest downloadable version of this appendix, you should do the following: + +■ Same version: Ignore the PDF that you downloaded from the companion website. + +■ Website has a later version: Ignore this Appendix B in your book and read only the latest version that you downloaded from the companion website. + + +Technical Content +The current Version 1.0 of this appendix does not contain additional technical coverage. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX C + + + + +Answers to the “Do I Know This Already?” Quizzes + +Chapter 1 +1. D and F. Of the remaining answers, Ethernet defines both physical and data-link proto-cols, PPP is a data-link protocol, IP is a network layer protocol, and SMTP and HTTP are application layer protocols. +2. A and G. Of the remaining answers, IP is a network layer protocol, TCP and UDP are transport layer protocols, and SMTP and HTTP are application layer protocols. +3. B. Adjacent-layer interaction occurs on one computer, with two adjacent layers in the model. The higher layer requests services from the next lower layer, and the lower layer provides the services to the next higher layer. +4. B. Same-layer interaction occurs on multiple computers. The functions defined by that layer typically need to be accomplished by multiple computers—for example, the sender setting a sequence number for a segment and the receiver acknowledging receipt of that segment. A single layer defines that process, but the implementation of that layer on multiple devices is required to accomplish the function. +5. A. Encapsulation is defined as the process of adding a header in front of data supplied by a higher layer (and possibly adding a trailer as well). +6. D. By convention, the term frame refers to the part of a network message that includes the data-link header and trailer, with encapsulated data. The term packet omits the data-link header and trailer, leaving the network layer header with its encapsulated data. The term segment omits the network layer header, leaving the transport layer header and its encapsulated data. +7. B. The term frame refers to the data-link (that is, Layer 2) data structure created by a Layer 2 protocol. As a result, the matching OSI term for protocol data units (PDUs) mentions that same layer, that is, Layer 2 PDU, or L2PDU. + +Chapter 2 +1. A. The IEEE defines Ethernet LAN standards, with standard names that begin with 802.3, all of which happen to use cabling. The IEEE also defines wireless LAN stan-dards, with standard names that begin with 802.11, which are separate standards from Ethernet. +2. C. The number before the word BASE defines the speed, in megabits per second (Mbps). 1000 Mbps equals 1 gigabit per second (1 Gbps). The T in the suffix implies twisted-pair or UTP cabling, so 1000BASE-T is the UTP-based Gigabit Ethernet stan-dard name. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +702 CCNA 200-301 Official Cert Guide, Volume 1 + +3. B. Crossover cables cross the wire at one node’s transmit pin pair to the different pins used as the receive pins on the other device. For 10- and 100-Mbps Ethernet, the spe-cific crossover cable wiring connects the pair at pins 1 and 2 on each end of the cable to pins 3 and 6 on the other end of the cable, respectively. +4. B, D, and E. Routers, wireless access point Ethernet ports, and PC NICs all send using pins 1 and 2, whereas hubs and LAN switches transmit on pins 3 and 6. Straight-through cables connect devices that use opposite pin pairs for sending, because the cable does not need to cross the pairs. +5. B. Multimode fiber works with LED-based transmitters rather than laser-based trans-mitters. Two answers mention the type of transmitters, making one of those answers correct and one incorrect. +Two answers mention distance. The answer that mentions the longest distance possible is incorrect because single-mode cables, not multimode cables, provide the longest dis-tances. The other (correct) answer mentions the tradeoff of multimode being used for distances just longer than UTP’s 100 meter limit, while happening to use less expensive hardware than single mode. +6. B. NICs (and switch ports) use the carrier sense multiple access with collision detec-tion (CSMA/CD) algorithm to implement half-duplex logic. CSMA/CD attempts to avoid collisions, but it also notices when collisions do occur, with rules about how the Ethernet nodes should stop sending, wait, and try again later. +7. C. The 4-byte Ethernet FCS field, found in the Ethernet trailer, allows the receiving node to see what the sending node computed with a math formula that is a key part of the error-detection process. Note that Ethernet defines the process of detecting errors (error detection), but not error recovery. +8. B, C, and E. The pre-assigned universal MAC address, given to each Ethernet port when manufactured, breaks the address into two 3-byte halves. The first half is called the organizationally unique identifier (OUI), which the IEEE assigns to the company that builds the product as a unique hex number to be used only by that company. +9. C and D. Ethernet supports unicast addresses, which identify a single Ethernet node, and group addresses, which can be used to send one frame to multiple Ethernet nodes. The two types of group addresses are the broadcast address and multicast address. + +Chapter 3 +1. B. The standard HDLC header does not include a Type field, which identifies the type of packet encapsulated inside the HDLC frame. +2. B and D. The physical installation uses a model in which each router uses a physical Ethernet link to connect to some SP device in an SP facility called a point of presence (PoP). The Ethernet link does not span from each customer device to the other. From a data-link perspective, both routers use the same Ethernet standard header and trailer used on LANs; HDLC does not matter on these Ethernet WAN links. +3. A. PC1 will send an Ethernet frame to Router 1, with PC1’s MAC address as the source address and Router 1’s MAC address as the destination address. Router 1 will remove the encapsulated IP packet from that Ethernet frame, discarding the frame header and + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 703 + + +trailer. Router 1 will forward the IP packet by first encapsulating it inside an HDLC frame, but Router 1 will not encapsulate the Ethernet frame in the HDLC frame but rather the IP packet. Router 2 will de-encapsulate the IP packet from the HDLC frame and forward it onto the Ethernet LAN, adding a new Ethernet header and trailer, but this header will differ. It will list Router 2’s MAC address as the source address and PC2’s MAC address as the destination address. +4. C. Routers compare the packet’s destination IP address to the router’s IP routing table, making a match and using the forwarding instructions in the matched route to forward the IP packet. +5. C. IPv4 hosts generally use basic two-branch logic. To send an IP packet to another host on the same IP network or subnet that is on the same LAN, the sender sends the IP packet directly to that host. Otherwise, the sender sends the packet to its default router (also called the default gateway). +6. A and C. Routers do all the actions listed in all four answers; however, the routing protocol does the functions in the two listed answers. Independent of the routing pro-tocol, a router learns routes for IP subnets and IP networks directly connected to its interfaces. Routers also forward (route) IP packets, but that process is called IP routing, or IP forwarding, and is an independent process compared to the work of a routing protocol. +7. C. Address Resolution Protocol (ARP) does allow PC1 to learn information, but the information is not stored on a server. The ping command does let the user at PC1 learn whether packets can flow in the network, but it again does not use a server. With the Domain Name System (DNS), PC1 acts as a DNS client, relying on a DNS server to +respond with information about the IP addresses that match a given hostname. + + + + + + + + + + + + + + + + + + + + + + +C + + +Chapter 4 +1. A and B. The command in the question is an EXEC command that happens to require only user mode access. As such, you can use this command in both user mode and enable mode. Because it is an EXEC command, you cannot use the command (as shown in the question) in configuration mode. Note that you can put the word do in front of the EXEC command while in configuration mode (for example, do show mac address-table) to issue the command from inside any configuration mode. +2. B. The command referenced in the question, the reload command, is an EXEC com-mand that happens to require privileged mode, also known as enable mode. This com-mand is not available in user mode. Note that you can put the word do in front of the EXEC command while in configuration mode (for example, do reload) to issue the command from inside any configuration mode. +3. B. SSH provides a secure remote login option, encrypting all data flows, including password exchanges. Telnet sends all data (including passwords) as clear text. +4. A. Switches (and routers) keep the currently used configuration in RAM, using NVRAM to store the configuration file that is loaded when the switch (or router) next loads the IOS. +5. F. The startup-config file is in NVRAM, and the running-config file is in RAM. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +704 CCNA 200-301 Official Cert Guide, Volume 1 + +6. B and C. The exit command moves the user one config mode backward, toward global configuration mode, or if already in global configuration mode, it moves the user back to enable mode. From console mode, it moves the user back to global configuration mode. The end command and the Ctrl+Z key sequence both move the user back to enable mode regardless of the current configuration submode. + +Chapter 5 +1. A. A switch compares the destination MAC address to the MAC address table. If a matching entry is found, the switch forwards the frame out the appropriate interface. If no matching entry is found, the switch floods the frame. +2. C. A switch floods broadcast frames, multicast frames (if no multicast optimizations are enabled), and unknown unicast destination frames (frames whose destination MAC address is not in the MAC address table). +3. A. A switch floods broadcast frames, multicast frames (if no multicast optimizations are enabled), and unknown unicast destination frames (frames whose destination MAC address is not in the MAC address table). +4. B. Switches need to learn the location of each MAC address used in the LAN relative to that local switch. When a switch receives a frame, the source MAC identifies the sender. The interface in which the frame arrives identifies the local switch interface closest to that node in the LAN topology. +5. C. The show interfaces status command lists one line of output per interface. Cisco Catalyst switches name the type of interface based on the fastest speed of the inter-face, so 10/100 interfaces would be Fast Ethernet. With a working connection, ports from FastEthernet 0/1 through 0/10 would be listed in a connected state, while the rest would be listed in a notconnected state. +6. D. For the correct answer, each entry lists the learned MAC address. By definition, dynamically learned MAC addresses are learned by looking at the source MAC address of received frames. (That fact rules out one of the incorrect answers as well.) +The show mac address-table dynamic command lists the current list of MAC table entries, with three known entries at the point at which the command output was gath-ered. The counter in the last line of output lists the number of current entries, not the total number of learned MAC addresses since the last reboot. For instance, the switch could have learned other MAC addresses whose entries timed out from the MAC address table. +Finally, the answer that claims that port Gi0/2 connects directly to a device with a particular MAC address may or may not be true. That port could connect to another switch, and another, and so on, with one of those switches connecting to the device that uses the listed MAC address. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 705 + +Chapter 6 + +1. B. If both commands are configured, IOS accepts only the password as configured in the enable secret command. +2. A. To answer this question, it might be best to first think of the complete configura-tion and then find any answers that match the configuration. The commands, in vty line configuration mode, would be password password and login. Only one answer lists a vty subcommand that is one of these two commands. +Of note in the incorrect answers: +One answer mentions console subcommands. The console does not define what hap-pens when remote users log in; those details sit in the vty line configuration. +One answer mentions the login local command; this command means that the switch should use the local list of configured usernames/passwords. The question stated that the engineer wanted to use passwords only, with no usernames. +One answer mentions the transport input ssh command, which, by omitting the telnet keyword, disables Telnet. While that command can be useful, SSH does not work when using passwords only; SSH requires both a username and a password. So, by disabling Telnet (and allowing SSH only), the configuration would allow no one to remotely log in to the switch. +3. B and C. SSH requires the use of usernames in addition to a password. Using the user-name global command would be one way to define usernames (and matching pass-words) to support SSH. The vty lines would also need to be configured to require the use of usernames, with the login local vty subcommand being one such option. +The transport input ssh command could be part of a meaningful configuration, but it is not a global configuration command (as claimed in one wrong answer). Likewise, +one answer refers to the username command as a command in vty config mode, which is also the wrong mode. +4. A, D, and F. To allow access through Telnet, the switch must have password security enabled, at a minimum using the password vty line configuration subcommand. In addition, the switch needs an IP address (configured under one VLAN interface) and a default gateway when the switch needs to communicate with hosts in a different subnet. +5. B and C. To allow SSH or Telnet access, a switch must have a correct IP configuration. That includes the configuration of a correct IP address and mask on a VLAN interface. That VLAN interface then must have a path out of the switch via ports assigned to that VLAN. In this case, with all ports assigned to VLAN 2, the switch must use inter-face VLAN 2 (using the interface vlan 2 configuration command). +To meet the requirement to support login from hosts outside the local subnet, the switch must configure a correct default gateway setting with the ip default-gateway 172.16.2.254 global command in this case. +6. A. The logging synchronous line subcommand synchronizes the log message display with other command output so the log message does not interrupt a show command’s output. The no ip domain-lookup command is not a line subcommand. The other two incorrect answers are line subcommands but do not configure the function listed in the +question. + + + + + + + + + + + + + + + + + + + + + +C + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +706 CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter 7 +1. F. Cisco switches do not have a command to disable autonegotiation of speed and duplex. Instead, a switch port that has both speed and duplex configured disables autonegotiation. +2. E. Cisco switches can be configured for speed (with the speed command) and duplex (with the duplex command) in interface configuration mode. +3. A and D. The IEEE autonegotiation rules dictate that if a device attempts autone-gotiation but the other side does not participate, use the slowest speed it supports. However, Cisco switches override that logic, instead sampling the electrical signal to detect the speed used by the connected device, so the switch will operate at 1000 Mbps. The switch uses the IEEE default setting for duplex based on the speed, and the IEEE default for duplex when using 1000 Mbps is to use full duplex. So in this case, the switch will match both the speed and the duplex setting made on the PC. +4. A, B, and D. The disabled state in the show interfaces status command is the same as an “administratively down and down” state shown in the show interfaces command. The interface must be in a connected state (per the show interfaces status command) before the switch can send frames out the interface. +5. A and D. SW2 has effectively disabled IEEE standard autonegotiation by configuring both speed and duplex. However, Cisco switches can detect the speed used by the other device, even with autonegotiation turned off. Also, at 1 Gbps, the IEEE autone-gotiation standard says to use full duplex. If the duplex setting cannot be negotiated, both ends use 1 Gbps, full duplex. +6. D. For the two answers about a duplex mismatch, that condition does cause collisions, particularly late collisions, but only the side using CSMA/CD logic (the half-duplex side) has any concept of collisions. So, if switch SW1 was using half duplex, and switch SW2 using full duplex, SW1 would likely see late collisions and see that coun-ter increment over time. +If switch SW2 had shut down its interface, switch SW1’s interface would be in a down/down state, and none of the counters would increment. Also, if both switch ports had been configured with different speeds, again the ports would be in a down/down state, and none of the interface counters would increment. + +Chapter 8 +1. B. A VLAN is a set of devices in the same Layer 2 broadcast domain. A subnet often includes the exact same set of devices, but it is a Layer 3 concept. A collision domain refers to a set of Ethernet devices, but with different rules than VLAN rules for deter-mining which devices are in the same collision domain. +2. D. Although a subnet and a VLAN are not equivalent concepts, the devices in one VLAN are typically in the same IP subnet and vice versa. +3. B. 802.1Q defines a 4-byte header, inserted after the original frame’s destination and source MAC address fields. The insertion of this header does not change the original frame’s source or destination address. The header itself holds a 12-bit VLAN ID field, which identifies the VLAN associated with the frame. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 707 + +4. A and C. The dynamic auto setting means that the switch can negotiate trunking, but it can only respond to negotiation messages, and it cannot initiate the negotiation process. So, the other switch must be configured to trunk or to initiate the negotiation process (based on being configured with the dynamic desirable option). +5. A and B. The configured VTP setting of VTP transparent mode means that the switch can configure VLANs, so the VLAN is configured. In addition, the VLAN configura-tion details, including the VLAN name, show up as part of the running-config file. +6. B and C. The show interfaces switchport command lists both the administrative and operational status of each port. When a switch considers a port to be trunking, this command lists an operational trunking state of “trunk.” The show interfaces trunk command lists a set of interfaces—the interfaces that are currently operating as trunks. So, both of these commands identify interfaces that are operational trunks. +7. A and B. On switches that do not use VTP (by using VTP modes off or transparent), the switch lists all VLAN configuration in the configuration file (making one answer correct). Also, the show vlan brief command lists all defined VLANs, regardless of VTP mode and regardless of shutdown state. As a result, the two answers that mention commands are correct. +The two incorrect answers are incorrect because VLAN 30 has been shut down, which means the switch will not forward frames in that VLAN, regardless of whether they arrive on access or trunk ports. +8. B. The first list of VLAN IDs includes all VLANs (1–4094) except those overtly C +removed per the details in any switchport trunk allowed vlan interface subcommands on the trunk interface. If no such commands are configured, the first list in the output will include 1–4094. The two incorrect answers that mention VLAN 30 both list con-ditions that change the second of two lists of VLANs in the command output, while STP’s choice to block an interface would impact the third list. + +Chapter 9 +1. A and B. Listening and learning are transitory port states, used only when moving from the blocking to the forwarding state. Discarding is not an STP port state. +2. C. The smallest numeric bridge ID wins the election. +3. C and D. Listening and learning are transitory port states used only when moving from the blocking to the forwarding state. Discarding is not an STP port state. Forwarding and blocking are stable states. +4. B. Nonroot switches forward Hellos received from the root; the root sends these Hellos based on the root’s configured Hello timer. +5. B and D. RSTP uses port state forwarding, learning, and discarding. Forwarding and learning perform the same functions as the port states used by traditional STP. +6. A and D. With RSTP, an alternate port is an alternate to the root port when a switch’s root port fails. A backup port takes over for a designated port if the designated port fails. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +708 CCNA 200-301 Official Cert Guide, Volume 1 + +7. D. The PortFast feature allows STP to move a port from blocking to forwarding with-out going through the interim listening and learning states. STP allows this exception when the link is known to have no switch on the other end of the link, removing the risk of a switching loop. BPDU Guard is a common feature to use at the same time as PortFast because it watches for incoming bridge protocol data units (BPDU), which should not happen on an access port, and prevents the loops from a rogue switch by disabling the port. + +Chapter 10 +1. A. Of the four answers, only pvst and rapid-pvst are valid options on the command. Of those, the rapid-pvst option enables Rapid Per VLAN Spanning Tree (RPVST+), which uses RSTP. The pvst option enables Per VLAN Spanning Tree (PVST) which uses STP, not RSTP. The other two options, if attempted, would cause the command to be rejected because the option does not exist. +2. A and C. The system ID extension (or extended system ID) part of a bridge ID con-tains 12 bits and sits after the 4-bit priority field and before the 48-bit system ID. Switches use this field to store the VLAN ID when using STP or RSTP to build span-ning trees per VLAN. So of the two answers that mention the system ID extension, the one that lists the VLAN ID, in this case 5, is correct. +The output also lists a priority of 32773. However, that output lists the decimal equiv-alent of the 16-bit priority value. In reality, this decimal value is the sum of the config-ured decimal priority plus the VLAN ID: 32768 + 5 = 32773. So in this case, the root’s configured priority is 32,768. +3. A, B, and D. The Cisco Rapid Per VLAN Spanning Tree (RPVST+) creates one span-ning tree instance per VLAN. To do so, it sends BPDUs per-VLAN. Each switch identifies itself with a unique Bridge ID (BID) per VLAN, made unique per-VLAN by adding the VLAN ID to the system ID extension 12-bit field of the BID. RVPST also adds a new Type-Length Value (TLV) to the BPDU itself, which includes a place to list the VLAN ID. Finally, when transmitting the BPDUs over VLAN trunks, the switch uses a trunking header that lists the VLAN ID (a practice sometimes called tunnel- +ing in 802.1Q.) The receiving switch can check all three locations that list the VLAN ID to ensure that they all agree about what VLAN the BPDU is describing. Of the four answers, the three correct answers describe the three actual locations in which RPVST+ lists the VLAN ID. +4. D. IOS uses the channel-group configuration command to create an EtherChannel. Then the term etherchannel is used in the show etherchannel command, which displays the status of the channel. The output of this show command then names the channel a PortChannel. The only answer that is not used somewhere in IOS to describe this multilink channel is Ethernet-Channel. +5. B and D. The channel-group command will direct the switch to use LACP to dynami-cally negotiate to add a link to an EtherChannel when the command uses the active and passive keywords, respectively. The desirable and passive keywords direct the switch to use PaGP instead of LACP. Of the four answers, the two correct answers use two LACP values, while the two incorrect answers use at least one value that would cause the switch to use PaGP, making the answer incorrect. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 709 + +Of the two correct answers, both combinations result in the switches attempting to add the link to an EtherChannel using LACP as the negotiation protocol. If both +switches used the passive keyword, they would both sit and wait for the other switch to begin sending LACP messages and therefore never attempt to add the link to the channel. +6. C. EtherChannel load distribution, or load balancing, on Cisco Catalyst switches uses an algorithm. The algorithm examines some fields in the various headers, so messages that have the same values in those fields always flow over the same link in a particular EtherChannel. Note that it does not break the frames into smaller fragments nor use a round-robin approach that ignores the header values, and it does not examine link utili-zation when making the choice. + +Chapter 11 + +1. B and D. The general rule to determine whether two devices’ interfaces should be in the same subnet is whether the two interfaces are separated from each other by a rout-er. To provide a way for hosts in one VLAN to send data to hosts outside that VLAN, a local router must connect its LAN interface to the same VLAN as the hosts and have an address in the same subnet as the hosts. All the hosts in that same VLAN on the same switch would not be separated from each other by a router, so these hosts would also be in the same subnet. However, another PC, connected to the same switch but in a different VLAN, will require its packets to flow through a router to reach Host A, so Host A’s IP address would need to be in a different subnet compared to this new host. +2. D. By definition, two address values in every IPv4 subnet cannot be used as host IPv4 addresses: the first (lowest) numeric value in the subnet for the subnet ID and the last (highest) numeric value in the subnet for the subnet broadcast address. +3. B and C. At least 7 subnet bits are needed because 26 = 64, so 6 subnet bits could not number 100 different subnets. Seven subnet bits could because 27 = 128 >= 100. Similarly, 6 host bits is not enough because 26 – 2 = 62, but 7 host bits is enough because 27 − 2 = 126 >= 100. +The number of network, subnet, and host bits must total 32 bits, making one of the answers incorrect. The answer with 8 network bits cannot be correct because the question states that a Class B network is used, so the number of network bits must always be 16. The two correct answers have 16 network bits (required because the question states the use of a Class B network) and at least 7 subnet and host bits each. +4. A and C. The private IPv4 networks, defined by RFC 1918, are Class A network 10.0.0.0, the 16 Class B networks from 172.16.0.0 to 172.31.0.0, and the 256 Class C networks that begin with 192.168. +5. A, D, and E. The private IPv4 networks, defined by RFC 1918, are Class A network 10.0.0.0, the 16 Class B networks from 172.16.0.0 to 172.31.0.0, and the 256 Class C networks that begin with 192.168. The three correct answers are from the public IP network range, and none are reserved values. +6. A and C. An unsubnetted Class A, B, or C network has two parts: the network and host parts. + + + + + + + + + +C + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +710 CCNA 200-301 Official Cert Guide, Volume 1 + +7. B. An unsubnetted Class A, B, or C network has two parts: the network and host parts. To perform subnetting, the engineer creates a new subnet part by borrowing host bits, shrinking the number of host bits. The subnet part of the address structure exists only after the engineer chooses a nondefault mask. The network part remains a constant size. + +Chapter 12 +1. B and C. Class A networks have a first octet in the range of 1–126, inclusive, and their network IDs have a 0 in the last three octets. 130.0.0.0 is actually a Class B network (first octet range 128–191, inclusive). All addresses that begin with 127 are reserved, so 127.0.0.0 is not a Class A network. +2. E. All Class B networks begin with values between 128 and 191, inclusive, in their first octets. The network ID has any value in the 128–191 range in the first octet, and any value from 0 to 255 inclusive in the second octet, with decimal 0s in the final two octets. Two of the answers show a 255 in the second octet, which is acceptable. Two of the answers show a 0 in the second octet, which is also acceptable. +3. B and D. The first octet (172) is in the range of values for Class B addresses (128–191). As a result, the network ID can be formed by copying the first two octets (172.16) and writing 0s for the last two octets (172.16.0.0). The default mask for all Class B networks is 255.255.0.0, and the number of host bits in all unsubnetted Class B networks is 16. +4. A and C. The first octet (192) is in the range of values for Class C addresses (192–223). As a result, the network ID can be formed by copying the first three octets (192.168.6) and writing 0 for the last octet (192.168.6.0). The default mask for all Class C networks is 255.255.255.0, and the number of host bits in all unsubnetted Class C networks is 8. +5. D. To find the network broadcast address, first determine the class, and then determine the number of host octets. At that point, convert the host octets to 255 to create the network broadcast address. In this case, 10.1.255.255 is in a Class A network, with the last three octets as host octets, for a network broadcast address of 10.255.255.255. For 192.168.255.1, it is a Class C address, with the last octet as the host part, for a network broadcast address of 192.168.255.255. Address 224.1.1.255 is a Class D address, so it is not in any unicast IP network and the question does not apply. For 172.30.255.255, it is a Class B address, with the last two octets as host octets, so the network broadcast address is 172.30.255.255. + +Chapter 13 +1. C. If you think about the conversion one octet at a time, the first two octets each convert to 8 binary 1s. 254 converts to 8-bit binary 11111110, and decimal 0 converts to 8-bit binary 00000000. So, the total number of binary 1s (which defines the prefix length) is 8 + 8 + 7 + 0 = /23. +2. B. If you think about the conversion one octet at a time, the first three octets each convert to 8 binary 1s. 240 converts to 8-bit binary 11110000, so the total number of binary 1s (which defines the prefix length) is 8 + 8 + 8 + 4 = /28. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 711 + + +3. B. /30 is the equivalent of the mask that in binary has 30 binary 1s. To convert that to DDN format, write down all the binary 1s (30 in this case), followed by binary 0s for the remainder of the 32-bit mask. Then take 8 bits at a time and convert from binary to decimal (or memorize the nine possible DDN mask octet values and their binary equiv-alents). Using the /30 mask in this question, the binary mask is 11111111 11111111 11111111 11111100. Each of the first three octets is all binary 1s, so each converts to 255. The last octet, 11111100, converts to 252, for a DDN mask of 255.255.255.252. See Appendix A, “Numeric Reference Tables,” for a decimal/binary conversion table. +4. C. The size of the network part is always either 8, 16, or 24 bits, based on whether it is Class A, B, or C, respectively. As a Class A address, N=8. The mask 255.255.255.0, +converted to prefix format, is /24. The number of subnet bits is the difference between the prefix length (24) and N, so S=16 in this case. The size of the host part is a number that, when added to the prefix length (24), gives you 32, so H=8 in this case. +5. A. The size of the network part is always either 8, 16, or 24 bits, based on whether it is Class A, B, or C, respectively. As a Class C address, N=24. The number of subnet bits is the difference between the prefix length (27) and N, so S=3 in this case. The size of the host part is a number that, when added to the prefix length (27), gives you 32, so H=5 in this case. +6. D. Classless addressing rules define a two-part IP address structure: the prefix and the host part. This logic ignores Class A, B, and C rules, and can be applied to the 32-bit IPv4 addresses from any address class. By ignoring Class A, B, and C rules, classless addressing ignores any distinction as to the network part of an IPv4 address. +7. A and B. The masks in binary define a number of binary 1s, and the number of binary 1s defines the length of the prefix (network + subnet) part. With a Class B network, the network part is 16 bits. To support 100 subnets, the subnet part must be at least 7 bits long. Six subnet bits would supply only 26 = 64 subnets, while 7 subnet bits sup-ply 27 = 128 subnets. The /24 answer supplies 8 subnet bits, and the 255.255.255.252 +answer supplies 14 subnet bits. + + + + + + + + + + + + + + + + + + + + + + +C + + +Chapter 14 +1. D. When using classful IP addressing concepts as described in Chapter 13, “Analyzing Subnet Masks,” addresses have three parts: network, subnet, and host. For addresses in a single classful network, the network parts must be identical for the numbers to be in the same network. For addresses in the same subnet, both the network and sub-net parts must have identical values. The host part differs when comparing different addresses in the same subnet. +2. B and D. In any subnet, the subnet ID is the smallest number in the range, the subnet broadcast address is the largest number, and the usable IP addresses sit between them. All numbers in a subnet have identical binary values in the prefix part (classless view) and network + subnet part (classful view). To be the lowest number, the subnet ID must have the lowest possible binary value (all 0s) in the host part. To be the largest number, the broadcast address must have the highest possible binary value (all binary 1s) in the host part. The usable addresses do not include the subnet ID and subnet broadcast address, so the addresses in the range of usable IP addresses never have a value of all 0s or 1s in their host parts. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +712 CCNA 200-301 Official Cert Guide, Volume 1 + +3. C. The mask converts to 255.255.255.0. To find the subnet ID, for each octet of the mask that is 255, you can copy the IP address’s corresponding values. For mask octets of decimal 0, you can record a 0 in that octet of the subnet ID. As such, copy the 10.7.99 and write a 0 for the fourth octet, for a subnet ID of 10.7.99.0. +4. C. First, the resident subnet (the subnet ID of the subnet in which the address resides) must be numerically smaller than the IP address, which rules out one of the answers. The mask converts to 255.255.255.252. As such, you can copy the first three octets of the IP address because of their value of 255. For the fourth octet, the subnet ID value must be a multiple of 4, because 256 – 252 (mask) = 4. Those multiples include 96 and 100, and the right choice is the multiple closest to the IP address value in that octet (97) without going over. So, the correct subnet ID is 192.168.44.96. +5. C. The resident subnet ID in this case is 172.31.77.192. You can find the subnet broad-cast address based on the subnet ID and mask using several methods. Following the decimal process in the book, the mask converts to 255.255.255.224, making the inter-esting octet be octet 4, with magic number 256 – 224 = 32. For the three octets where the mask = 255, copy the subnet ID (172.31.77). For the interesting octet, take the subnet ID value (192), add magic (32), and subtract 1, for 223. That makes the subnet broadcast address 172.31.77.223. +6. C. To answer this question, you need to find the range of addresses in the subnet, which typically then means you need to calculate the subnet ID and subnet broadcast address. With a subnet ID/mask of 10.1.4.0/23, the mask converts to 255.255.254.0. To find the subnet broadcast address, following the decimal process described in this chapter, you can copy the subnet ID’s first two octets because the mask’s value is 255 in each octet. You write a 255 in the fourth octet because the mask has a 0 on the fourth octet. In octet 3, the interesting octet, add the magic number (2) to the subnet ID’s value (4), minus 1, for a value of 2 + 4 – 1 = 5. (The magic number in this case is calculated as 256 – 254 = 2.) That makes the broadcast address 10.1.5.255. The last usable address is 1 less: 10.1.5.254. The range that includes the last 100 addresses is 10.1.5.155 – 10.1.5.254. + +Chapter 15 +1. B and E. Cisco routers have an on/off switch, but Cisco switches generally do not. +2. B. Cisco routers that do not also have any Layer 2 switch features support commands needed for Layer 3 routing as well as commands in common between Layer 2 switch-ing and Layer 3 routing devices. In this case, the show interfaces status and show mac address-table commands happen to be commands supported on Layer 2 switches but not on routers. Both types of devices use the show running-config command. Of the answers, only the show ip interface brief command is unique to routers. +3. A and C. To route packets on an interface, the router interface configuration must include an IP address and mask. One correct command shows the correct single com-mand used to configure both values, while one incorrect command shows those set-tings as two separate commands. Also, to route packets, the interface must reach an “up/up” state; that is, the show interfaces and other commands list two status values, and both must be “up.” The no shutdown command enables the interface. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 713 + +4. C. If the first of the two status codes is “down,” it typically means that a Layer 1 prob-lem exists. In this case, the question states that the router connects to a switch with a UTP straight-through cable, which is the correct cable pinout. Of the two answers that mention the shutdown command, if the router interface were shut down, the first rout-er status code would be “administratively down,” so that answer is incorrect. However, if the neighboring device interface sits in a shutdown state, the router will sense no electrical signals over the cable, seeing that as a physical problem, and place the inter-face into a “down/down” state, making that answer correct. +Second, the two answers that mention interface IP addresses have no impact on the status codes of the show interfaces brief command. Both answers imply that the inter-face does not have an IP address configured. However, both the first and second status codes are not related to whether IP addresses have been configured or not, making both answers incorrect. +5. C and E. The show ip interface brief command lists all the interface IPv4 addresses but none of the masks. The show version command lists none of the IP addresses and none of the masks. The other three commands list both the address and mask. +6. B. A router has one IPv4 address for each interface in use, whereas a LAN switch has a single IPv4 address that is just used for accessing the switch. The rest of the answers +list configuration settings that use the same conventions on both routers and switches. + +Chapter 16 C 1. A and C. The route defines the group of addresses represented by the route using the +subnet ID and mask. The router can use those numbers to find the range of addresses that should be matched by this route. The other two answers list facts useful when for-warding packets that happen to match the route. +2. A and D. First, for the subnetting math, address 10.1.1.100, with mask /26, implies a subnet ID of 10.1.1.64. Also, mask /26 converts to a DDN mask of 255.255.255.192. For any working router interface, after adding the ip address command to configure an address and mask, the router adds a connected route for the subnet. In this case, that means the router adds a connected route for subnet 10.1.1.64 255.255.255.192. The router also adds a route called a local route, which is a route for the interface IP address with a 255.255.255.255 mask. In this case, that means the router adds a local route for address 10.1.1.100 with mask 255.255.255.255. +3. C. The ip route command can refer to the IP address of the next-hop router or to the local router’s interface. It also refers to the subnet ID and matching subnet mask, defin-ing the range of addresses matched by the route. +4. A. The correct syntax lists a subnet number, then a subnet mask in dotted-decimal form, and then either an outgoing interface or a next-hop IP address. +5. B. The ip route command can reference an outgoing interface or a next-hop IP address, and the command lists a next-hop IP address, which rules out one answer. The com-mand does use the correct syntax, ruling out another answer. There is no requirement for a router to have any particular interface IP addresses in relation to the configura-tion of an ip route command, ruling out yet another answer. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +714 CCNA 200-301 Official Cert Guide, Volume 1 + +The checks that IOS uses when looking at a new ip route command include whether the outgoing interface is up/up, whether the next-hop address is reachable, and, if there is a competing route from another source, whether the other route has a better admin-istrative distance. +6. D. Destination address 10.1.15.122 matches all the routes listed except the host route to 10.1.15.100/32. In that case, the router will choose the matching route that has the longest prefix length, that is, the prefix-style mask with the highest number. In this case, that route lists subnet 10.1.15.96 and mask /27, which lists interface G0/3/0 as the outgoing interface. + +Chapter 17 +1. A and F. Of all the commands listed, only the two correct answers are syntactically correct router configuration commands. The command to enable 802.1Q trunking is encapsulation dot1q vlan_id. +2. B and C. Subinterface G0/1.1 must be in an administratively down state due to the shutdown command being issued on that subinterface. For subinterface G0/1.2, its sta-tus cannot be administratively down because of the no shutdown command. G0/1.2’s state will then track to the state of the underlying physical interface. With a physical interface state of down/down, subinterface G0/1.2 will be in a down/down state in this case. +3. C. The configuration of the Layer 3 switch’s routing feature uses VLAN interfaces. The VLAN interface numbers must match the associated VLAN ID, so with VLANs 1, 2, and 3 in use, the switch will configure interface vlan 1, interface vlan 2 (which is the correct answer), and interface vlan 3. The matching connected routes, like all con-nected IP routes, will list the VLAN interfaces. +As for the incorrect answers, a list of connected routes will not list any next-hop IP addresses. Each route will list an outgoing interface; the outgoing interface will not be a physical interface, but rather a VLAN interface, because the question states that the configuration uses SVIs. Finally, all the listed subnets have a /25 mask, which is 255.255.255.128, so none of the routes will list a 255.255.255.0 mask. +4. C and D. First, for the correct answers, a Layer 3 switch will not route packets on a VLAN interface unless it is in an up/up state. A VLAN interface will only be up/up if the matching VLAN (with the same VLAN number) exists on the switch. If VTP +deletes the VLAN, then the VLAN interface moves to a down/down state, and routing in/out that interface stops. Also, disabling VLAN 2 with the shutdown command in VLAN configuration mode also causes the matching VLAN 2 interface to fail, which makes routing on interface VLAN 2 stop as well. +As for the incorrect answers, a Layer 3 switch needs only one access port or trunk port forwarding for a VLAN to enable routing for that VLAN, so nine of the ten access ports in VLAN 2 could fail, leaving one working port, and the switch would keep routing for VLAN 2. +A shutdown of VLAN 4 has no effect on routing for VLAN interfaces 2 and 3. Had that answer listed VLANs 2 or 3, it would definitely be a reason to make routing fail for that VLAN interface. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 715 + +5. A and C. With a Layer 3 EtherChannel, the physical ports and the port-channel inter-face must disable the behavior of acting like a switch port, and therefore act like a routed port, through the configuration of the no switchport interface subcommand. (The routedport command is not an IOS command.) Once created, the physical inter-faces should not have an IP address configured. The port-channel interface (the inter-face representing the EtherChannel) should be configured with the IP address. +6. B and C. With a Layer 3 EtherChannel, two configuration settings must be the same on all the physical ports, specifically the speed and duplex as set with the speed and duplex commands. Additionally, the physical ports and port-channel port must all have the no switchport command configured to make each act as a routed port. So, having a different speed setting, or being configured with switchport rather than no switchport, would prevent IOS from adding interface G0/2 to the Layer 3 EtherChannel. +As for the wrong answers, both have to do with Layer 2 configuration settings. Once Layer 2 operations have been disabled because of the no switchport command, those settings related to Layer 2 that could cause problems on Layer 2 EtherChannels do not then cause problems for the Layer 3 EtherChannel. So, Layer 2 settings about access VLANs, trunking allowed lists, and STP settings, which must match before an interface can be added to a Layer 2 EtherChannel, do not matter for a Layer 3 EtherChannel. + + +Chapter 19 +1. D. Both versions of RIP use distance vector logic, and EIGRP uses a different kind of +logic, characterized either as advanced distance vector or a balanced hybrid. + + +C + +2. C and D. Both versions of RIP use the same hop-count metric, neither of which is affected by link bandwidth. EIGRP’s metric, by default, is calculated based on band-width and delay. OSPF’s metric is a sum of outgoing interfaces costs, with those costs (by default) based on interface bandwidth. +3. B, C, and D. Of the listed routing protocols, only the old RIP Version 1 (RIP-1) proto-col does not support variable-length subnet masks (VLSM). +4. C. LSAs contain topology information that is useful in calculating routes, but the LSAs do not directly list the route that a router should add to its routing table. In this case, R1 would run a calculation called the Shortest Path First (SPF) algorithm, against the LSAs, to determine what IP routes to add to the IP routing table. +5. B. Neighboring OSPF routers that complete the database exchange are considered fully adjacent and rest in a full neighbor state. The up/up and final states are not OSPF states at all. The 2-way state is either an interim state or a stable state between some routers on the same VLAN. +6. C. The correct answer is the one advantage of using a single-area design. The three wrong answers are advantages of using a multiarea design, with all reasons being much more important with a larger internetwork. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +716 CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter 20 +1. B. The network 10.0.0.0 0.255.255.255 area 0 command works because it matches all interfaces whose first octet is 10. The rest of the commands match as follows: all address-es that end with 0.0.0 (wildcard mask 255.0.0.0); all addresses that begin with 10.0.0 (wild-card mask 0.0.0.255); and all addresses that begin with 10.0 (wildcard mask 0.0.255.255). +2. A. The network 10.1.0.0 0.0.255.255 area 0 command matches all IP addresses that begin with 10.1, enabling OSPF in area 0 on all interfaces. The answer with wildcard mask 0.255.255.0 is illegal because it represents more than one string of binary 0s separated by binary 1s. The answer with x’s is syntactically incorrect. The answer with wildcard mask 255.0.0.0 means “Match all addresses whose last three octets are 0.0.0,” so none of the three interfaces are matched. +3. A and E. Of the three wrong answers, two are real commands that simply do not list the OSPF neighbors. show ip ospf interface brief lists interfaces on which OSPF is enabled but does not list neighbors. show ip interface lists IPv4 details about interfaces, but none related to OSPF. One incorrect answer, show ip neighbor, is not a valid IOS command. +4. B. With OSPFv2 interface configuration mode, the configuration looks just like the traditional configuration, with a couple of exceptions. The network router subcom-mand is no longer required. Instead, each interface on which OSPF should be enabled is configured with an ip ospf process-id area area-id interface subcommand. This command refers to the OSPF routing process that should be enabled on the interface and specifies the OSPFv2 area. +5. B. SPF calculates the cost of a route as the sum of the OSPF interface costs for all outgo-ing interfaces in the route. The interface cost can be set directly (ip ospf cost), or IOS uses a default based on the reference bandwidth and the interface bandwidth. Of the list-ed answers, delay is the only setting that does not influence OSPFv2 metric calculations. +6. A and D. The configuration enables OSPF and identifies the area number to use with the interface using an interface subcommand in interface mode: the ip ospf process-id area area-number command. However, to explicitly configure the router ID, the configuration must use the router-id router-id-value command, which is a command issued in OSPF router mode. + +Chapter 21 +1. B and D. By default, IOS assigns Ethernet interfaces an OSPF network type of broad-cast, with an OSPF interface priority of 1. As a result, both routers attempt to discover the other routers on the link (which identifies one correct answer). +The broadcast network type means that the routers also attempt to elect a DR and BDR. With a tie-in priority, the routers choose the DR based on the highest router ID (RID) values, meaning that R2 will become the DR and R1 will become the BDR. These facts combine to show why the two incorrect answers are incorrect. The other correct answer is correct because the show ip ospf neighbor command lists the local router’s neighbor relationship state (FULL) and the role filled by that neighbor (DR), which would be the output shown on R1 when R2 is acting as DR. +2. B and C. First, the OSPF point-to-point network type causes the two routers to dynamically discover neighbors, making one answer correct. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 717 + + +Next, IOS assigns a default OSPF interface priority of 1, so R1’s configured priority of 11 would be better in a DR/BDR election. However, the point-to-point network type causes the router to not use a DR/BDR on the interface. As a result, the answer about R1 becoming the DR is incorrect (because no DR exists at all), and the answer listing a state of “FULL/DR” is incorrect for the same reason. However, the answer that claims that R2 will be neither DR nor BDR is true because no DR or BDR is elected. +3. D. The show ip ospf interface brief command lists a pair of counters under the head-ing “Nbrs F/C” on the far right of the output. The first of the two numbers represents the number of fully adjacent neighbors (2 in this case), and the second number repre-sents the total number of neighbors. +4. A and D. As worded, the correct answers list a scenario that would prevent the neighbor relationship. One correct answer mentions the use of two different OSPF areas on the potential OSPF neighbors; to become neighbors, the two routers must use the same area number. The other correct answer mentions the use of two different Hello timers, a mis-match that causes two routers to reject each other and to not become neighbors. +The two incorrect answers list scenarios that do not cause issues, making them incor-rect answers. One mentions mismatched OSPF process IDs; OSPF process IDs do not need to match for two routers to become neighbors. The other incorrect answer (that is, a scenario that does not cause a problem) mentions the use of two different priority values. The priority values give OSPF a means to prefer one router over the other when electing a DR/BDR, so the setting is intended to be set to different values on different routers and does not cause a problem. +5. C. As worded, the correct answers should be a scenario that would prevent the neigh-bor relationship. The answers all list values that are identical or similar on the two rout-ers. Of those, the use of an identical OSPF router ID (RID) on the two routers prevents them from becoming neighbors, making that one answer correct. +Of the incorrect answers, both routers must have the same Dead interval, so both using a Dead interval of 40 causes no issues. The two routers can use any OSPF pro-cess ID (the same or different value, it does not matter), making that answer incorrect. Finally, the two routers’ IP addresses must be in the same subnet, so again that sce-nario does not prevent R13 and R14 from becoming neighbors. +6. D. The OSPF shutdown command tells the OSPF process to stop operating. That pro-cess includes removing any OSPF-learned routes from the IP routing table, clearing the router’s LSDB, and closing existing OSPF neighbor relationships. In effect, it causes OSPF to stop working on the router, but it does retain the configuration so that a no shutdown command will cause the router to start using OSPF again with no changes +to the configuration. + + + + + + + + + + + + + + + + + + + + + + +C + + +Chapter 22 +1. C. NAT, specifically the PAT feature that allows many hosts to use private IPv4 addresses while being supported by a single public IPv4 address, was one short-term solution to the IPv4 address exhaustion problem. IP version 5 existed briefly as an experimental protocol and had nothing to do with IPv4 address exhaustion. IPv6 directly addresses the IPv4 address exhaustion problem, but it is a long-term solution. ARP has no impact on the number of IPv4 addresses used. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +718 CCNA 200-301 Official Cert Guide, Volume 1 + +2. A. Routers use the same process steps when routing IPv6 packets as they do when routing IPv4 packets. Routers route IPv6 packets based on the IPv6 addresses, listed inside the IPv6 header in the IPv6 packets, by comparing the destination IPv6 address to the router’s IPv6 routing table. As a result, the router discards the incoming frame’s data-link header and trailer, leaving an IPv6 packet. The router compares the destina-tion (not source) IPv6 address in the header to the router’s IPv6 (not IPv4) routing table and then forwards the packet based on the matched route. +3. D. If you are following the steps in the book, the first step removes up to three lead-ing 0s in each quartet, leaving FE80:0:0:100:0:0:0:123. This leaves two strings of consecutive all-0 quartets; by changing the longest string of all 0s to ::, the address is FE80:0:0:100::123. +4. B. This question has many quartets that make it easy to make a common mistake: removing trailing 0s in a quartet of hex digits. To abbreviate IPv6 addresses, only lead-ing 0s in a quartet should be removed. Many of the quartets have trailing 0s (0s on the right side of the quartet), so make sure to not remove those 0s. +5. A. The unabbreviated version of an IPv6 address must have 32 digits, and only one answer has 32 hex digits. In this case, the original number shows four quartets and a ::. So, the :: was replaced with four quartets of 0000, making the number have eight quar-tets. Then, for each quartet with fewer than four digits, leading 0s were added so that each quartet has four hex digits. +6. C. The /64 prefix length means that the last 64 bits, or last 16 digits, of the address should be changed to all 0s. That process leaves the unabbreviated prefix as 2000:0000:0000:0005:0000:0000:0000:0000. The last four quartets are all 0s, making that string of all 0s be the longest and best string of 0s to replace with ::. After removing the leading 0s in other quartets, the answer is 2000:0:0:5::/64. + +Chapter 23 +1. C. Unique local addresses begin with FD in the first two digits. +2. A. Global unicast addresses can begin with many different initial values, but most commonly begin with either a hex 2 or 3. +3. D. The global routing prefix is the address block, represented as a prefix value and pre-fix length, given to an organization by some numbering authority. All IPv6 addresses inside the company have the same value in these initial bits of their IPv6 addresses. Similarly, when a company uses a public IPv4 address block, all the addresses have the same value in the network part. +4. B. Subnetting a global unicast address block, using a single prefix length for all sub-nets, breaks the addresses into three parts. The parts are the global routing prefix, sub-net, and interface ID. +5. D. Unique local addresses begin with a 2-hex-digit prefix of FD, followed by the 10-hex-digit global ID. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 719 + +Chapter 24 +1. A. The one correct answer lists the exact same IPv6 address listed in the question, with a /64 prefix length and no spaces in the syntax of the answer. Another (incor-rect) answer is identical, except that it leaves a space between the address and prefix +length, which is incorrect syntax. The two answers that list the eui-64 parameter list an address and not a prefix; they should list a prefix to be correct, although neither would have resulted in the IPv6 address listed in the question. +2. B. With the eui-64 parameter, the router will calculate the interface ID portion of the IPv6 address based on its MAC address. Beginning with 5055.4444.3333, the router injects FF FE in the middle (5055.44FF.FE44.3333). Then the router inverts the seventh bit in the first byte. Mentally, this converts hex 50 to binary 01010000, changing bit +7 so that the string is 0101 0010 and converting back to hex 52. The final interface ID value is 5255:44FF:FE44:3333. The wrong answers simply list a different value. +3. A and C. Of the four answers, the two correct answers show the minimal required configuration to support IPv6 on a Cisco router: enabling IPv6 routing (ipv6 unicast-routing) and enabling IPv6 on each interface, typically by adding a unicast +address to each interface (ipv6 address…). The two incorrect answers list nonexistent commands. +4. A. With an ipv6 address command configured for a global unicast address, but with-out a link-local address configured with an ipv6 address command, the router calcu- +lates its link-local address on the interface based on its MAC address and EUI-64 rules. C The first half of the link-local address begins FE80:0000:0000:0000. The router then +calculates the second half of the link-local address value by taking the MAC address (0200.0001.000A), injecting FF FE in the middle (0200.00FF.FE01.000A), and flipping the seventh bit (0000.00FF.FE01.000A). +5. B. FF02::1 is used by all IPv6 hosts on the link, FF02::5 is used by all OSPFv3 routers, and FF02::A is used by all EIGRPv6 routers. FF02::2 is used to send packets to all IPv6 routers on a link. + +Chapter 25 +1. A and C. With an IPv6 address on a working interface, the router adds a connected route for the prefix (subnet) implied by the ipv6 address command. It also adds a local host route (with a /128 prefix length) based on the unicast address. The router does not add a route based on the link-local address. +2. A and C. The two correct answers show the correct subnet ID (prefix) and prefix length for the two connected subnets: 3111:1:1:1::/64 and 3222:2:2:2::/64. The answer with the /128 prefix length is shown in a local route, but those routes are not displayed by the show ipv6 route connected command. The other incorrect answer lists the entire IPv6 address with a /64 prefix length, and the entire address would not be dis-played as a prefix when using a /64 prefix. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +720 CCNA 200-301 Official Cert Guide, Volume 1 + +3. A. All four answers show examples of commands that use an outgoing interface. The two commands that begin with ip route define only IPv4 routes; the commands would be rejected because of the IPv6 prefixes listed in the commands. The two commands that begin with ipv6 route are syntactically correct, but the command should list the local router’s interface (an interface on the router on which the command is being con-figured). R5 needs to use its local S0/1/1 interface as the outgoing interface. +4. B. All four answers show examples of commands that use a next-hop router IPv6 address. Two of the answers list R5’s own IPv6 address (unicast or link-local), which is incorrect; the answer should be an address on the neighboring router, R6 in this case. For the two answers that list addresses on Router R6, the one that lists R6’s global uni-cast address is correct. The one that lists R6’s link-local address would also require R5’s outgoing interface, so the answer that lists FE80::FF:FE00:6 would be rejected as well. +5. C. IOS will add a new static route to the IPv6 routing table if, when using a next-hop global unicast address, the router has a working route to reach that next-hop address and there is no better (lower administrative distance) route for the exact same subnet. So, the correct answer identifies one reason why the route would not appear. The answer that mentions a better route with administrative distance of 110 is a valid rea-son for the static route to not appear, but the question states that no route for the sub-net appears in the routing table, so clearly that competing route does not exist. +The other two answers are incorrect about the ipv6 route command. This command can use a link-local next-hop address but does not have to do so. Also, when using a global unicast address as next-hop, the command does not also require an outgoing interface parameter. +6. A and B. The output shows two static routes, as noted with the “S” code on the far left. Both were added to the IPv6 routing table because of ipv6 route commands. Both have an administrative distance of 1, which is listed as the first number in brackets. +For the two incorrect answers, note that the ipv6 address interface subcommand does cause IOS to add connected IPv6 routes to the routing table, and the phrase “directly connected” with one route might make you think this is a connected route. However, the “S” in the far left identifies the source of the route. Likewise, the answer that mentions an IPv6 routing protocol is incorrect because both routes have a code of S, meaning static. +7. B. PC1 needs to discover PC2’s MAC address. Unlike IPv4, IPv6 does not use ARP, instead using NDP. Specifically, PC1 uses the NDP Neighbor Solicitation (NS) message to request that PC2 send back an NDP Neighbor Advertisement (NA). SLAAC relates to address assignment, and not to discovering a neighbor’s MAC address. +8. A and C. The NDP RA lists the router IPv6 address, the IPv6 prefixes known on the link, and the matching prefix lengths. When using DHCPv6, the host learns the IPv6 address of the DNS server through DHCPv6 messages. For MAC addresses of on-link neighbors, hosts use NDP NS and NA messages. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 721 + +Chapter 26 +1. C. The IEEE 802.3 standard defines Ethernet, while 802.11 defines Wi-Fi. +2. B. WLANs require half-duplex operation because all stations must contend for use of a channel to transmit frames. +3. C. An AP offers a basic service set (BSS). BSA is incorrect because it is a Basic Service Area, or the cell footprint of a BSS. BSD is incorrect because it does not pertain to wireless at all. IBSS is incorrect because it is an Independent BSS, or an ad hoc net-work, where an AP or BSS is not needed at all. +4. B. The AP at the heart of a BSS or cell identifies itself (and the BSS) with a Basic Service Set Identifier (BSSID). It also uses an SSID to identify the wireless network, but that is not unique to the AP or BSS. Finally, the radio MAC address is used as the basis for the BSSID value, but the value can be altered to form the BSSID for each SSID that the AP supports. +5. B. A workgroup bridge acts as a wireless client, but bridges traffic to and from a wired device connected to it. +6. B. In a mesh network, each mesh AP builds a standalone BSS. The APs relay client traf-fic to each other over wireless backhaul links, rather than wired Ethernet. Therefore, Ethernet cabling to each AP is not required. +7. D and E. Wi-Fi commonly uses the 2.5- and 5-GHz bands. +8. C and D. In the 2.4-GHz band, consecutively numbered channels are too wide to not C overlap. Only channels 1, 6, and 11 are spaced far enough apart to avoid overlapping +each other. In the 5-GHz band, all channels are considered to be nonoverlapping. + +Chapter 27 +1. A. An autonomous AP can operate independently without the need for a centralized wireless LAN controller. +2. B. The Cisco Meraki APs are autonomous APs that are managed through a centralized platform in the Meraki cloud. +3. C. On a lightweight AP, the MAC function is divided between the AP hardware and the WLC. Therefore, the architecture is known as split-MAC. +4. B. An LAP builds a CAPWAP tunnel with a WLC. +5. A. A trunk link carrying three VLANs is not needed at all. A lightweight AP in local mode needs only an access link with a single VLAN; everything else is carried over the CAPWAP tunnel to a WLC. The WLC will need to be connected to three VLANs so that it can work with the LAP to bind them to the three SSIDs. +6. C. A unified WLC deployment model is based around locating the WLC in a central location, to support a very large number of APs. +7. A. The local mode is the default mode, where the AP provides at least one functional BSS that wireless clients can join to connect to the network. Normal and client modes are not valid modes. Monitor mode is used to turn the AP into a dedicated wireless sensor. +8. D. The SE-Connect mode is used for spectrum analysis. “SE” denotes the Cisco Spectrum Expert software. Otherwise, an AP can operate in only one mode at a time. The local mode is the default mode. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +722 CCNA 200-301 Official Cert Guide, Volume 1 + +Chapter 28 +1. D. For effective security, you should leverage authentication, MIC, and encryption. +2. C. A message integrity check (MIC) is an effective way to protect against data tamper-ing. WIPS is not correct because it provides intrusion protection functions. WEP is not correct because it does not provide data integrity along with its weak encryption. EAP is not correct because it defines the framework for authentication. +3. D. WEP is known to have a number of weaknesses and has been compromised. Therefore, it has been officially deprecated and should not be used in a wireless net-work. AES is not a correct answer because it is the current recommended encryption method. WPA is not correct because it defines a suite of security methods. EAP is not correct because it defines a framework for authentication. +4. C. EAP works with 802.1x to authenticate a client and enable access for it. Open authentication and WEP cannot be correct because both define a specific authenti-cation method. WPA is not correct because it defines a suite of security methods in addition to authentication. +5. A. The TKIP method was deprecated when the 802.11 standard was updated in 2012. CCMP and GCMP are still valid methods. EAP is an authentication framework and is not related to data encryption and integrity. +6. C. WPA2 uses CCMP only. WEP has been deprecated and is not used in any of the WPA versions. TKIP has been deprecated but can be used in WPA only. WPA is not a correct answer because it is an earlier version of WPA2. +7. B. The Wi-Fi Alliance offers the WPA, WPA2, and WPA3 certifications for wireless security. WEP, AES, and 802.11 are not certifications designed and awarded by the Wi-Fi Alliance. +8. A and C. The personal mode for WPA, WPA2, and WPA3 is used to require a pre-shared key authentication. Enterprise mode uses 802.1x instead. + +Chapter 29 +1. A. A lightweight AP requires connectivity to only a single VLAN, so access mode is used. +2. B. An autonomous AP must connect to each of the VLANs it will extend to wireless LANs. Therefore, its link should be configured as a trunk. +3. D. You can use HTTP and HTTPS to access the GUI of a wireless LAN controller, as well as SSH to access its CLI. While HTTP is a valid management protocol on a WLC, it is usually disabled to make the WLC more secure. +4. C. Controllers use a link aggregation group (LAG) to bundle multiple ports together. +5. D. A dynamic interface makes a logical connection between a WLAN and a VLAN, all internal to the controller. +6. C and D. A WLAN binds an SSID to a controller interface so that the controller can link the wired and wireless networks. Although the WLAN ultimately reaches a wired VLAN, it does so only through a controller interface. It is the interface that is config-ured with a VLAN number. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix C: Answers to the “Do I Know This Already?” Quizzes 723 + +7. C. You can configure a maximum of 512 WLANs on a controller. However, a maxi-mum of only 16 of them can be configured on an AP. +8. A and C. The SSID and controller interface are the only parameters from the list that are necessary. The VLAN number is not because it is supplied when a controller inter-face is configured. + + + + + + + + + + + + + + + + +C + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + +GLOSSARY + + +NUMERIC +10/100 A short reference to an Ethernet NIC or switch port that supports speed of 10 Mbps and 100 Mbps. + +10/100/1000 A short reference to an Ethernet NIC or switch port that supports speeds of 10 Mbps, 100 Mbps, and 1000 Mbps (that is, 1 Gbps). + +10BASE-T The 10-Mbps baseband Ethernet specification using two pairs of twisted-pair cabling (Categories 3, 4, or 5): one pair transmits data and the other receives data. 10BASE-T, which is part of the IEEE 802.3 specification, has a distance limit of approximately 100 m (328 feet) per segment. +100BASE-T A name for the IEEE Fast Ethernet standard that uses two-pair copper cabling, a speed of 100 Mbps, and a maximum cable length of 100 meters. + +1000BASE-T A name for the IEEE Gigabit Ethernet standard that uses four-pair copper cabling, a speed of 1000 Mbps (1 Gbps), and a maximum cable length of 100 meters. + +2-way state In OSPF, a neighbor state that implies that the router has exchanged Hellos with the neighbor and that all required parameters match. + +802.11a The IEEE standard for wireless LANs using the U-NII spectrum, OFDM encoding, and speeds of up to 54 Mbps. + +802.11b The IEEE standard for wireless LANs using the ISM spectrum, DSSS encoding, and speeds of up to 11 Mbps. + +802.11g The IEEE standard for wireless LANs using the ISM spectrum, OFDM or DSSS encoding, and speeds of up to 54 Mbps. + +802.11n The IEEE standard for wireless LANs using the ISM spectrum, OFDM encoding, and multiple antennas for single-stream speeds up to 150 Mbps. + +802.1Q The IEEE standardized protocol for VLAN trunking, which also includes RSTP details. + +802.1x An IEEE standard that defines port-based access control for wired and wireless networks. + +A +AAA Authentication, authorization, and accounting. Authentication confirms the identity of the user or device. Authorization determines what the user or device is allowed to do. Accounting records information about access attempts, including inappropriate requests. +AAA server A server that holds security information and provides services related to user login, particularly authentication (is the user who he says he is?), authorization (once authenti-cated, what do we allow the user to do?), and accounting (tracking the user). + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +ABR See Area Border Router. + +access interface A LAN network design term that refers to a switch interface connected to end-user devices, configured so that it does not use VLAN trunking. + +access layer In a campus LAN design, the switches that connect directly to endpoint devic-es (servers, user devices), and also connect into the distribution layer switches. + +access link In Frame Relay, the physical serial link that connects a Frame Relay DTE device, usually a router, to a Frame Relay switch. The access link uses the same physical layer standards as do point-to-point leased lines. +access point (AP) A device that provides wireless service for clients within its coverage area or cell, with the AP connecting to both the wireless LAN and the wired Ethernet LAN. + +accounting In security, the recording of access attempts. See also AAA. + +ad hoc network See independent basic service set (IBSS). + +address block A set of consecutive IPv4 addresses. The term is most often used for a class-less prefix as defined by CIDR but can also refer to any subnet or IPv4 network. + +adjacent-layer interaction The general topic of how, on one computer, two adjacent layers in a networking architectural model work together, with the lower layer providing services to the higher layer. +administrative distance In Cisco routers, a means for one router to choose between mul-tiple routes to reach the same subnet when those routes were learned by different routing pro-tocols. The lower the administrative distance, the better the source of the routing information. +ADSL Asymmetric digital subscriber line. One of many DSL technologies, ADSL is designed to deliver more bandwidth downstream (from the central office to the customer site) than upstream. +all-nodes multicast address A specific IPv6 multicast address, FF02::1, with link-local scope, used to send packets to all devices on the link that support IPv6. + +all-routers multicast address A specific IPv6 multicast address, FF02::2, with link-local scope, used to send packets to all devices that act as IPv6 routers on the local link. + +alternate port With RSTP, a port role in which the port acts as an alternative to a switch’s root port, so that when the switch’s root port fails, the alternate port can immediately take over as the root port. +anycast address An address shared by two or more hosts that exist in different parts of the network, so that by design, the routers will forward packets to the nearest of the two servers, allowing clients to communicate with the nearest such server, not caring which particular server with which the client communicates. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +726 Area Border Router (ABR) + +Area Border Router (ABR) A router using OSPF in which the router has interfaces in mul-tiple OSPF areas. + +ARP Address Resolution Protocol. An Internet protocol used to map an IP address to a MAC address. Defined in RFC 826. + +ARP table A list of IP addresses of neighbors on the same VLAN, along with their MAC addresses, as kept in memory by hosts and routers. + +ARPANET The first packet-switched network, first created around 1970, which served as the predecessor to the Internet. + +ASBR Autonomous System Border Router. A router using OSPF in which the router learns routes via another source, usually another routing protocol, exchanging routes that are external to OSPF with the OSPF domain. +asymmetric A feature of many Internet access technologies, including DSL, cable, and modems, in which the downstream transmission rate is higher than the upstream transmission rate. +asynchronous The lack of an imposed time ordering on a bit stream. Practically, both sides agree to the same speed, but there is no check or adjustment of the rates if they are slightly different. However, because only 1 byte per transfer is sent, slight differences in clock speed are not an issue. +authentication In security, the verification of the identity of a person or a process. See also AAA. + +authentication server (AS) An 802.1x entity that authenticates users or clients based on their credentials, as matched against a user database. In a wireless network, a RADIUS server is an AS. +authenticator An 802.1x entity that exists as a network device that provides access to the network. In a wireless network, a WLC acts as an authenticator. + +authorization In security, the determination of the rights allowed for a particular user or device. See also AAA. + +autonegotiation An IEEE standard mechanism (802.3u) with which two nodes can exchange messages for the purpose of choosing to use the same Ethernet standards on both ends of the link, ensuring that the link functions and functions well. +autonomous AP A wireless AP operating in a standalone mode, such that it can provide a fully functional BSS and connect to the DS. + +autonomous system An internetwork in the administrative control of one organization, company, or governmental agency, inside which that organization typically runs an interior gateway protocol (IGP). +auxiliary port A physical connector on a router that is designed to be used to allow a remote terminal, or PC with a terminal emulator, to access a router using an analog modem. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +broadcast address 727 + +B +backbone area In OSPFv2 and OSPFv3, the special area in a multiarea design, with all non-backbone areas needing to connect to the backbone area, area 0. + +back-to-back link A serial link between two routers, created without CSU/DSUs, by con-necting a DTE cable to one router and a DCE cable to the other. Typically used in labs to build serial links without the expense of an actual leased line from the telco. +backup designated router An OSPF router connected to a multiaccess network that moni-tors the work of the designated router (DR) and takes over the work of the DR if the DR fails. + +backup port With RSTP, a port role in which the port acts as a backup to one of the switch’s ports acting as a designated port. If the switch’s designated port fails, the switch will use the backup port to immediately take over as the designated port. +band A contiguous range of frequencies. + +bandwidth A reference to the speed of a networking link. Its origins come from earlier com-munications technology in which the range, or width, of the frequency band dictated how fast communications could occur. +basic service set (BSS) Wireless service provided by one AP to one or more associated clients. + +basic service set identifier (BSSID) A unique MAC address that is used to identify the AP that is providing a BSS. + +binary mask An IPv4 subnet mask written as a 32-bit binary number. + +bitwise Boolean AND A Boolean AND between two numbers of the same length in which the first bit in each number is ANDed, and then the second bit in each number, and then the third, and so on. +blocking state In STP, a port state in which no received frames are processed and the switch forwards no frames out the interface, with the exception of STP messages. + +Boolean AND A math operation performed on a pair of one-digit binary numbers. The result is another one-digit binary number. 1 AND 1 yields 1; all other combinations yield a 0. + +BPDU Bridge protocol data unit. The generic name for Spanning Tree Protocol messages. + +BPDU Guard A Cisco switch feature that listens for incoming STP BPDU messages, disabling the interface if any are received. The goal is to prevent loops when a switch connects to a port expected to only have a host connected to it. +bridge ID (BID) An 8-byte identifier for bridges and switches used by STP and RSTP. It is composed of a 2-byte priority field followed by a 6-byte System ID field that is usually filled with a MAC address. +bridge protocol data unit See BPDU. + +broadcast address Generally, any address that represents all devices, and can be used to send one message to all devices. In Ethernet, the MAC address of all binary 1s, or FFFF.FFFF.FFFF in hex. For IPv4, see subnet broadcast address. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +728 broadcast domain + +broadcast domain A set of all devices that receive broadcast frames originating from any device within the set. Devices in the same VLAN are in the same broadcast domain. + +broadcast frame An Ethernet frame sent to destination address FFFF.FFFF.FFFF, meaning that the frame should be delivered to all hosts on that LAN. + +broadcast subnet When subnetting a Class A, B, or C network, the one subnet in each classful network for which all subnet bits have a value of binary 1. The subnet broadcast address in this subnet has the same numeric value as the classful network’s networkwide broad-cast address. + +C +cable Internet An Internet access technology that uses a cable TV (CATV) cable, normally used for video, to send and receive data. + +CAPWAP A standards-based tunneling protocol that defines communication between a light-weight AP and a wireless LAN controller. + +cell The area of wireless coverage provided by an AP; also known as the basic service area. + +centralized WLC deployment See unified WLC deployment. + +certificate authority (CA) A trusted entity that generates and signs digital certificates. + +channel An arbitrary index that points to a specific frequency within a band. + +Channel-group One term Cisco switches use to reference a bundle of links that are, in some respects, treated like a single link. Other similar terms include EtherChannel and PortChannel. + +CIDR Classless interdomain routing. An RFC-standard tool for global IP address range assign-ment. CIDR reduces the size of Internet routers’ IP routing tables, helping deal with the rapid growth of the Internet. The term classless refers to the fact that the summarized groups of networks represent a group of addresses that do not conform to IPv4 classful (Class A, B, and C) grouping rules. +CIDR mask Another term for a prefix mask, one that uses prefix or CIDR notation, in which the mask is represented by a slash (/) followed by a decimal number. + +CIDR notation See prefix notation. + +cladding In fiber-optic cabling, the second layer of the cable, surrounding the core of the cable, with the property of reflecting light back into the core. + +classful addressing A concept in IPv4 addressing that defines a subnetted IP address as having three parts: network, subnet, and host. + +classful IP network An IPv4 Class A, B, or C network; called a classful network because these networks are defined by the class rules for IPv4 addressing. + +classful routing protocol Does not transmit the mask information along with the subnet number and therefore must consider Class A, B, and C network boundaries and perform auto-summarization at those boundaries. Does not support VLSM. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +connected route 729 + +classless addressing A concept in IPv4 addressing that defines a subnetted IP address as having two parts: a prefix (or subnet) and a host. + +classless interdomain routing The name of an RFC that defines several important features related to public IPv4 addressing: a global address assignment strategy to keep the size of IPv4 routing tables smaller, and the ability to assign public IPv4 addresses in sizes based on any pre-fix length. +classless prefix A range of public IPv4 addresses as defined by CIDR. + +classless prefix length The mask (prefix length) used when defining a classless prefix. + +classless routing protocol An inherent characteristic of a routing protocol, specifically that the routing protocol does send subnet masks in its routing updates, thereby removing any need to make assumptions about the addresses in a particular subnet or network, making it able to support VLSM and manual route summarization. +CLI Command-line interface. An interface that enables the user to interact with the operating system by entering commands and optional arguments. + +clock rate The speed at which a serial link encodes bits on the transmission medium. + +clock source The device to which the other devices on the link adjust their speed when using synchronous links. + +clocking The process of supplying a signal over a cable, either on a separate pin on a serial cable or as part of the signal transitions in the transmitted signal so that the receiving device can keep synchronization with the sending device. +cloud-based AP A wireless AP operating much like an autonomous AP, but having manage-ment and control functions present in the Internet cloud. + +cloud-based WLC deployment A wireless network design that places a WLC centrally within a network topology, as a virtual machine in the private cloud portion of a data center. + +collapsed core design A campus LAN design in which the design does not use a separate set of core switches in addition to the distribution switches—in effect collapsing the core into the distribution switches. +collision domain A set of network interface cards (NIC) for which a frame sent by one NIC could result in a collision with a frame sent by any other NIC in the same collision domain. + +command-line interface See CLI. + +configuration mode A part of the Cisco IOS Software CLI in which the user can type configuration commands that are then added to the device’s currently used configuration file (running-config). +connected The single-item status code listed by a switch show interfaces status command, with this status referring to a working interface. + +connected route On a router, an IP route added to the routing table when the router inter-face is both up and has an IP address configured. The route is for the subnet that can be calcu-lated based on the configured IP address and mask. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +730 console port + +console port A physical socket on a router or switch to which a cable can be connected between a computer and the router/switch, for the purpose of allowing the computer to use a terminal emulator and use the CLI to configure, verify, and troubleshoot the router/switch. +contiguous network A network topology in which subnets of network X are not separated by subnets of any other classful network. + +convergence The time required for routing protocols to react to changes in the network, removing bad routes and adding new, better routes so that the current best routes are in all the routers’ routing tables. +core In fiber-optic cabling, the center cylinder of the cable, made of fiberglass, through which light passes. + +core design A campus LAN design that connects each access switch to distribution switches, and distribution switches into core switches, to provide a path between all LAN devices. + +Counter/CBC-MAC Protocol (CCMP) A wireless security scheme based on 802.11i that uses AES counter mode for encryption and CBC-MAC for data integrity + +crossover cable An Ethernet cable that swaps the pair used for transmission on one device to a pair used for receiving on the device on the opposite end of the cable. In 10BASE-T and 100BASE-TX networks, this cable swaps the pair at pins 1,2 to pins 3,6 on the other end of the cable, and the pair at pins 3,6 to pins 1,2 as well. +CSMA/CD Carrier sense multiple access with collision detection. A media-access mecha-nism in which devices ready to transmit data first check the channel for a carrier. If no carrier is sensed for a specific period of time, a device can transmit. If two devices transmit at once, a collision occurs and is detected by all colliding devices. This collision subsequently delays retransmissions from those devices for some random length of time. +CSU/DSU Channel service unit/data service unit. A device that understands the Layer 1 details of serial links installed by a telco and how to use a serial cable to communicate with networking equipment such as routers. + +D +data VLAN A VLAN used by typical data devices connected to an Ethernet, like PCs and servers. Used in comparison to a voice VLAN. + +Database Description An OSPF packet type that lists brief descriptions of the LSAs in the OSPF LSDB. + +DCE Data communications equipment. From a physical layer perspective, the device provid-ing the clocking on a WAN link, typically a CSU/DSU, is the DCE. From a packet-switching perspective, the service provider’s switch, to which a router might connect, is considered the DCE. +DDN See dotted-decimal notation. + +Dead Interval In OSPF, a timer used for each neighbor. A router considers the neighbor to have failed if no Hellos are received from that neighbor in the time defined by the timer. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +discontiguous network 731 + +decimal mask An IPv4 subnet mask written in dotted-decimal notation; for example, 255.255.255.0. + +de-encapsulation On a computer that receives data over a network, the process in which the device interprets the lower-layer headers and, when finished with each header, removes the header, revealing the next-higher-layer PDU. +default gateway/default router On an IP host, the IP address of some router to which the host sends packets when the packet’s destination address is on a subnet other than the local subnet. +default mask The mask used in a Class A, B, or C network that does not create any sub-nets; specifically, mask 255.0.0.0 for Class A networks, 255.255.0.0 for Class B networks, and 255.255.255.0 for Class C networks. +default route On a router, the route that is considered to match all packets that are not oth-erwise matched by some more specific route. + +default VLAN A reference to the default setting of 1 (meaning VLAN ID 1) on the switchport access vlan vlan-id interface subcommand on Cisco switches, meaning that by default, a port will be assigned to VLAN 1 if acting as an access port. +designated port In both STP and RSTP, a port role used to determine which of multiple interfaces on multiple switches, each connected to the same segment or collision domain, should forward frames to the segment. The switch advertising the lowest-cost Hello BPDU onto the segment becomes the DP. +designated router In OSPF, on a multiaccess network, the router that wins an election and is therefore responsible for managing a streamlined process for exchanging OSPF topology information between all routers attached to that network. +DHCP Dynamic Host Configuration Protocol. A protocol used by hosts to dynamically dis-cover and lease an IP address, and learn the correct subnet mask, default gateway, and DNS server IP addresses. +DHCP client Any device that uses DHCP protocols to ask to lease an IP address from a DHCP server, or to learn any IP settings from that server. + +Dijkstra Shortest Path First (SPF) algorithm The name of the algorithm used by link-state routing protocols to analyze the LSDB and find the least-cost routes from that router to each subnet. +directed broadcast address See subnet broadcast address. + +disabled port In STP, a port role for nonworking interfaces—in other words, interfaces that are not in a connect or up/up interface state. + +discarding state An RSTP interface state in which no received frames are processed and the switch forwards no frames out the interface, with the exception of RSTP messages. + +discontiguous network A network topology in which subnets of network X are separated by subnets of some other classful network. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +732 distance vector + +distance vector The logic behind the behavior of some interior routing protocols, such as RIP. Distance vector routing algorithms call for each router to send its entire routing table in each update, but only to its neighbors. Distance vector routing algorithms can be prone to routing loops but are computationally simpler than link-state routing algorithms. +distribution layer In a campus LAN design, the switches that connect to access layer switch-es as the most efficient means to provide connectivity from the access layer into the other parts of the LAN. +distribution system (DS) The wired Ethernet that connects to an AP and transports traffic between a wired and wireless network. + +DNS Domain Name System. An application layer protocol used throughout the Internet for translating hostnames into their associated IP addresses. + +DNS Reply In the Domain Name System (DNS), a message sent by a DNS server to a DNS client in response to a DNS Request, identifying the IP address assigned to a particular host-name or fully qualified domain name (FQDN). +DNS Request In the Domain Name System (DNS), a message sent by a DNS client to a DNS server, listing a hostname or fully qualified domain name (FQDN), asking the server to discover and reply with the IP address associated with that hostname or FQDN. +dotted-decimal notation (DDN) The format used for IP version 4 addresses, in which four decimal values are used, separated by periods (dots). + +DSL Digital subscriber line. Public network technology that delivers high bandwidth over conventional telco local-loop copper wiring at limited distances. Typically used as an Internet access technology, connecting a user to an ISP. +DSL modem A device that connects to a telephone line, using DSL standards, to transmit and receive data to/from a telco using DSL. + +DTE Data terminal equipment. From a Layer 1 perspective, the DTE synchronizes its clock based on the clock sent by the DCE. From a packet-switching perspective, the DTE is the device outside the service provider’s network, typically a router. +dual stack A mode of operation in which a host or router runs both IPv4 and IPv6. + +duplex mismatch On opposite ends of any Ethernet link, the condition in which one of the two devices uses full-duplex logic and the other uses half-duplex logic, resulting in unnecessary frame discards and retransmissions on the link. +duplicate address detection (DAD) A term used in IPv6 to refer to how hosts first check whether another host is using a unicast address before the first host uses that address. + +E +EAP Flexible Authentication by Secure Tunneling (EAP-FAST) A Cisco authentication method that is based on EAP and uses a PAC as a credential for outer authentication and a TLS tunnel for inner authentication + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +error recovery 733 + +EAP Transport Layer Security (EAP-TLS) An authentication method that uses digital cer-tificates on both the server and the supplicant for mutual authentication. A TLS tunnel is used during client authentication and key exchanges. +EIGRP Enhanced Interior Gateway Routing Protocol. An advanced version of IGRP devel-oped by Cisco. Provides superior convergence properties and operating efficiency and com-bines the advantages of link-state protocols with those of distance vector protocols. +EIGRP version 6 The version of the EIGRP routing protocol that supports IPv6, and not IPv4. + +electromagnetic interference (EMI) The name of the effect in which electricity passes through one cable as normal, inducing a magnetic field outside the conductor. That magnetic field, if it passes through another conductor, like a nearby cable, induces new electrical current in the second cable, interfering with the use of electricity to transmit data on the second cable. +embedded WLC deployment A wireless network design that places a WLC in the access layer, co-located with a LAN switch stack, near the APs it controls. + +enable mode A part of the Cisco IOS CLI in which the user can use the most powerful and potentially disruptive commands on a router or switch, including the ability to then reach con-figuration mode and reconfigure the router. +encapsulation The placement of data from a higher-layer protocol behind the header (and in some cases, between a header and trailer) of the next-lower-layer protocol. For example, an IP packet could be encapsulated in an Ethernet header and trailer before being sent over an Ethernet. +encryption Applying a specific algorithm to data to alter the appearance of the data, making it incomprehensible to those who are not authorized to see the information. + +enterprise mode 802.1x EAP-based authentication requirement for WPA, WPA2, and WPA3. + +enterprise router A term to describe the general role of a router as a router at a permanent site owned or leased by the enterprise, like an office building, manufacturing facility, branch office, or retail location. These sites typically have enough users to justify separate routers, switches, and wireless access points, and are more likely to justify private WAN services, in comparison to SOHO routers. +error detection The process of discovering whether a data-link level frame was changed dur-ing transmission. This process typically uses a Frame Check Sequence (FCS) field in the data-link trailer. +error disabled An interface state on LAN switches that can be the result of one of many security violations. + +error recovery The process of noticing when some transmitted data was not successfully received and resending the data until it is successfully received. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +734 EtherChannel + +EtherChannel A feature in which up to eight parallel Ethernet segments exist between the same two devices, each using the same speed. May be a Layer 2 EtherChannel, which acts like a single link for forwarding and Spanning Tree Protocol logic, or a Layer 3 EtherChannel, which acts like a single link for the switch’s Layer 3 routing logic. +EtherChannel Load Distribution The logic used by switches when forwarding messages over EtherChannels by which the switch chooses the specific physical link out which the switch will forward the frame. +Ethernet A series of LAN standards defined by the IEEE, originally invented by Xerox Corporation and developed jointly by Xerox, Intel, and Digital Equipment Corporation. + +Ethernet address A 48-bit (6-byte) binary number, usually written as a 12-digit hexadecimal number, used to identify Ethernet nodes in an Ethernet network. Ethernet frame headers list a destination and source address field, used by the Ethernet devices to deliver Ethernet frames to the correct destination. +Ethernet frame A term referring to an Ethernet data-link header and trailer, plus the data encapsulated between the header and trailer. + +Ethernet Line Service (E-Line) A specific carrier/metro Ethernet service defined by MEF (MEF.net) that provides a point-to-point topology between two customer devices, much as if the two devices were connected using an Ethernet crossover cable. +Ethernet link A generic term for any physical link between two Ethernet nodes, no matter what type of cabling is used. + +Ethernet over MPLS (EoMPLS) A term referring specifically to how a service provider can create an Ethernet WAN service using an MPLS network. More generally, a term referring to Ethernet WAN services. +Ethernet port A generic term for the opening on the side of any Ethernet node, typically in an Ethernet NIC or LAN switch, into which an Ethernet cable can be connected. + +EtherType Jargon that shortens the term Ethernet Type, which refers to the Type field in the Ethernet header. The Type field identifies the type of packet encapsulated inside an Ethernet frame. +EUI-64 Literally, a standard for an extended unique identifier that is 64 bits long. Specifically for IPv6, a set of rules for forming a 64-bit identifier, used as the interface ID in IPv6 addresses, by starting with a 48-bit MAC address, inserting FFFE (hex) in the middle, and inverting the seventh bit. +extended ping An IOS command in which the ping command accepts many other options besides just the destination IP address. + +extended service set (ESS) Multiple APs that are connected by a common switched infrastructure. + +Extensible Authentication Protocol (EAP) A standardized authentication framework that is used by a variety of authentication methods + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Frame Check Sequence 735 + +F +Fast Ethernet The common name for all the IEEE standards that send data at 100 megabits per second. + +fiber-optic cable A type of cabling that uses glass fiber as a medium through which to trans-mit light. + +filter Generally, a process or a device that screens network traffic for certain characteristics, such as source address, destination address, or protocol, and determines whether to forward or discard that traffic based on the established criteria. +firewall A device that forwards packets between the less secure and more secure parts of the network, applying rules that determine which packets are allowed to pass and which are not. + +flash memory A type of read/write permanent memory that retains its contents even with no power applied to the memory, and uses no moving parts, making the memory less likely to fail over time. +floating static route A static IP route that uses a higher administrative distance than other routes, typically routes learned by a routing protocol. As a result, the router will not use the static route if the routing protocol route has been learned, but then use the static route if the routing protocol fails to learn the route. +flood/flooding The result of the LAN switch forwarding process for broadcasts and unknown unicast frames. Switches forward these frames out all interfaces, except the interface in which the frame arrived. Switches also flood multicasts by default, although this behavior can be changed. +forward To send a frame received in one interface out another interface, toward its ultimate destination. + +forward delay An STP timer, defaulting to 15 seconds, used to dictate how long an interface stays in the listening state and the time spent in learning state. Also called the forward delay timer. +forward route From one host’s perspective, the route over which a packet travels from that host to some other host. + +forward secrecy A key exchange method used in WPA3 that prevents attackers from being able to use a discovered pre-shared key to unencrypt data that has already been transmitted over the air +forwarding state An STP and RSTP port state in which an interface operates unrestricted by STP. + +frame A term referring to a data-link header and trailer, plus the data encapsulated between the header and trailer. + +Frame Check Sequence A field in many data-link trailers used as part of the error-detection process. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +736 full duplex + +full duplex Generically, any communication in which two communicating devices can con-currently send and receive data. In Ethernet LANs, the allowance for both devices to send and receive at the same time, allowed when both devices disable their CSMA/CD logic. +full state In OSPF, a neighbor state that implies that the two routers have exchanged the complete (full) contents of their respective LSDBs. + +full update With IP routing protocols, the general concept that a routing protocol update lists all known routes. + +fully adjacent In OSPF, a characterization of the state of a neighbor in which the two neigh-bors have reached the full state. + +fully adjacent neighbor In OSPF, a neighbor with which the local router has also reached the OSPF full state, meaning that the two routers have exchanged their LSDBs directly with each other. + +G +Galois/Counter Mode Protocol (GCMP) A strong encryption method used in the WPA3 wireless security model. + +Gigabit Ethernet The common name for all the IEEE standards that send data at 1 gigabit per second. + +global routing prefix An IPv6 prefix that defines an IPv6 address block made up of global unicast addresses, assigned to one organization, so that the organization has a block of globally unique IPv6 addresses to use in its network. +global unicast address A type of unicast IPv6 address that has been allocated from a range of public globally unique IP addresses, as registered through IANA/ICANN, its member agen-cies, and other registries or ISPs. + +H +half duplex Generically, any communication in which only one device at a time can send data. In Ethernet LANs, the normal result of the CSMA/CD algorithm that enforces the rule that only one device should send at any point in time. +HDLC High-Level Data Link Control. A bit-oriented synchronous data-link layer protocol developed by the International Organization for Standardization (ISO). + +header In computer networking, a set of bytes placed in front of some other data, encapsu-lating that data, as defined by a particular protocol. + +Hello (Multiple definitions) 1) A protocol used by OSPF routers to discover, establish, and maintain neighbor relationships. 2) A protocol used by EIGRP routers to discover, establish, and maintain neighbor relationships. 3) In STP, refers to the name of the periodic message sourced by the root bridge in a spanning tree. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +ICMP echo reply 737 + +Hello BPDU The STP and RSTP message used for the majority of STP communications, list-ing the root’s bridge ID, the sending device’s bridge ID, and the sending device’s cost with which to reach the root. +Hello Interval With OSPF and EIGRP, an interface timer that dictates how often the router should send Hello messages. + +Hello timer In STP, the time interval at which the root switch should send Hello BPDUs. + +history buffer In a Cisco router or switch, the function by which IOS keeps a list of com-mands that the user has used in this login session, both in EXEC mode and configuration mode. The user can then recall these commands for easier repeating or making small edits and issuing similar commands. +hop count The metric used by the RIP routing protocol. Each router in an IP route is con-sidered a hop, so for example, if two other routers sit between a router and some subnet, that router would have a hop count of two for that route. +host Any device that uses an IP address. + +host address The IP address assigned to a network card on a computer. + +host part A term used to describe a part of an IPv4 address that is used to uniquely identify a host inside a subnet. The host part is identified by the bits of value 0 in the subnet mask. + +host route A route with a /32 mask, which by virtue of this mask represents a route to a single host IP address. + +hostname The alphanumeric name of an IP host. + +hub A LAN device that provides a centralized connection point for LAN cabling, repeating any received electrical signal out all other ports, thereby creating a logical bus. Hubs do not interpret the electrical signals as a frame of bits, so hubs are considered to be Layer 1 devices. + +I +IANA The Internet Assigned Numbers Authority (IANA). An organization that owns the rights to assign many operating numbers and facts about how the global Internet works, includ-ing public IPv4 and IPv6 addresses. See also ICANN. +ICANN The Internet Corporation for Assigned Names and Numbers. An organization appointed by IANA to oversee the distributed process of assigning public IPv4 and IPv6 addresses across the globe. +ICMP Internet Control Message Protocol. A TCP/IP network layer protocol that reports errors and provides other information relevant to IP packet processing. + +ICMP echo reply One type of ICMP message, created specifically to be used as the mes-sage sent by the ping command to test connectivity in a network. The ping command expects to receive these messages from other hosts, after the ping command first sends an ICMP echo request message to the host. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +738 ICMP echo request + +ICMP echo request One type of ICMP message, created specifically to be used as the message sent by the ping command to test connectivity in a network. The ping command sends these messages to other hosts, expecting the other host to reply with an ICMP echo reply message. +IEEE Institute of Electrical and Electronics Engineers. A professional organization that devel-ops communications and network standards, among other activities. + +IEEE 802.1 AD The IEEE standard for the functional equivalent of the Cisco-proprietary EtherChannel. + + +IEEE 802.11 + +IEEE 802.1Q + + +The IEEE base standard for wireless LANs. + +The IEEE standard VLAN trunking protocol. 802.1Q includes the concept of a + +native VLAN, for which no VLAN header is added, and a 4-byte VLAN header is inserted after the original frame’s Type/Length field. +IEEE 802.2 An IEEE LAN protocol that specifies an implementation of the LLC sublayer of the data-link layer. + +IEEE 802.3 A set of IEEE LAN protocols that specifies the many variations of what is known today as an Ethernet LAN. + +IEEE 802.3 AD The IEEE standard for the functional equivalent of the Cisco-proprietary EtherChannel. + +IETF The Internet Engineering Task Force. The IETF serves as the primary organization that works directly to create new TCP/IP standards. + +IGP See interior gateway protocol. + +inactivity timer For switch MAC address tables, a timer associated with each entry that counts time upward from 0 and is reset to 0 each time a switch receives a frame with the same MAC address. The entries with the largest timers can be removed to make space for additional MAC address table entries. +independent basic service set (IBSS) An impromptu wireless network formed between two or more devices without an AP or a BSS; also known as an ad hoc network. + +infrastructure mode The operating mode of an AP that is providing a BSS for wireless clients. + +Integrated Services Router (ISR) Cisco’s long-running term for several different model series of Enterprise-class routers, intended mostly for use as enterprise routers and some use as SOHO routers. ISR routers first serve as routers but, depending on the family or specific model, support all current types of WAN connections (private and Internet), LAN switching ports, Wireless APs, VPNs, and other integrated functions supported in a single device. +interface bandwidth In OSPF, the numerator in the calculation of an interface’s default OSPF cost metric, calculated as the interface bandwidth divided by the reference bandwidth. + +interface-local scope A concept in IPv6 for which packets sent to an address using this scope should not physically exit the interface, keeping the packet inside the sending host. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +IPv4 739 + +interior gateway protocol (IGP) A routing protocol designed to be used to exchange rout-ing information inside a single autonomous system. + +interior routing protocol A synonym of interior gateway protocol. See interior gateway protocol. + +Internal Border Gateway Protocol (iBGP) The use of BGP between two routers in the same ASN, with different rules compared to External BGP (eBGP). + +internal router In OSPF, a router with all interfaces in the same nonbackbone area. + +Internetwork Operating System The operating system (OS) of Cisco routers and switches, which provides the majority of a router’s or switch’s features, with the hardware providing the remaining features. +Inter-Switch Link (ISL) The Cisco-proprietary VLAN trunking protocol that predated 802.IQ by many years. ISL defines a 26-byte header that encapsulates the original Ethernet frame. +IOS See Internetwork Operating System. + +IP Internet Protocol. The network layer protocol in the TCP/IP stack, providing routing and logical addressing standards and services. + +IP address (IP version 4) In IP version 4 (IPv4), a 32-bit address assigned to hosts using TCP/IP. Each address consists of a network number, an optional subnetwork number, and a host number. The network and subnetwork numbers together are used for routing, and the host number is used to address an individual host within the network or subnetwork. +IP address (IP version 6) In IP version 6 (IPv6), a 128-bit address assigned to hosts using TCP/IP. Addresses use different formats, commonly using a routing prefix, subnet, and inter-face ID, corresponding to the IPv4 network, subnet, and host parts of an address. +IP network See classful IP network. + +IP packet An IP header, followed by the data encapsulated after the IP header, but specifi-cally not including any headers and trailers for layers below the network layer. + +IP routing table See routing table. + +IP subnet Subdivisions of a Class A, B, or C network, as configured by a network administrator. Subnets allow a single Class A, B, or C network to be used instead of multiple networks, and still allow for a large number of groups of IP addresses, as is required for efficient IP routing. +IP version 4 Literally, the version of the Internet Protocol defined in an old RFC 791, stan-dardized in 1980, and used as the basis of TCP/IP networks and the Internet for over 30 years. + +IP version 6 A newer version of the Internet Protocol defined in RFC 2460, as well as many other RFCs, whose creation was motivated by the need to avoid the IPv4 address exhaustion problem. +IPv4 See IP version 4. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +740 IPv4 address exhaustion + +IPv4 address exhaustion The process by which the public IPv4 addresses, available to cre-ate the Internet, were consumed through the 1980s until today, with the expectation that even-tually the world would run out of available IPv4 addresses. +IPv6 See IP version 6. + +IPv6 address scope The concept of how far an IPv6 packet should be forwarded by hosts and routers in an IPv6 network. Includes interface-local, link-local, site-local, and organization-local scopes. +IPv6 administrative distance In Cisco routers, a means for one router to choose between multiple IPv6 routes to reach the same subnet when those routes were learned by different routing protocols. The lower the administrative distance, the better the source of the routing information. +IPv6 host route A route with a /128 mask, which by virtue of this mask represents a route to a single host IPv6 address. + +IPv6 local route A route added to an IPv6 router’s routing table for the router’s interface IP address, with a /128 mask, which by virtue of this mask represents a route to only that router’s IPv4 address. +IPv6 multicast scope The idea of how far away from the sending host an IPv6 multicast packet should be forwarded, as based on the value in the 4th hex digit of the multicast address. + +IPv6 neighbor table The IPv6 equivalent of the ARP table. A table that lists IPv6 addresses of other hosts on the same link, along with their matching MAC addresses, as typically learned using Neighbor Discovery Protocol (NDP). +ISL Inter-Switch Link. A Cisco-proprietary protocol that maintains VLAN information as traffic flows between switches and routers. + +ISO International Organization for Standardization. An international organization that is responsible for a wide range of standards, including many standards relevant to networking. The ISO developed the OSI reference model, a popular networking reference model. + +K–L +keepalive A proprietary feature of Cisco routers in which the router sends messages on a periodic basis as a means of letting the neighboring router know that the first router is still alive and well. +known unicast frame An Ethernet frame whose destination MAC address is listed in a switch’s MAC address table, so the switch will forward the frame out the one port associated with that entry in the MAC address table. +L2PDU Layer 2 protocol data unit. Often called a frame. The data compiled by a Layer 2 protocol, including Layer 2 header, encapsulated high-layer data, and Layer 2 trailer. + +L3PDU Layer 3 protocol data unit. Often called a packet. The data compiled by a Layer 3 protocol, including Layer 3 headers and the encapsulated high-layer data, but not including lower-layer headers and trailers. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +link-local scope 741 + +L4PDU Layer 4 protocol data unit. Often called a segment. The data compiled by a Layer 4 protocol, including Layer 4 headers and encapsulated high-layer data, but not including lower-layer headers and trailers. +LACP Link Aggregation Control Protocol is a messaging protocol defined by the IEEE 802.3ad standard that enables two neighboring devices to realize that they have multiple par-allel links connecting to each other and then to decide which links can be combined into an EtherChannel. +Layer 2 EtherChannel (L2 EtherChannel) An EtherChannel that acts as a switched port (that is, not a routed port), and as such, is used by a switch’s Layer 2 forwarding logic. As a result, the Layer 2 switch lists the Layer 2 EtherChannel in switch MAC address tables, and when forwarding a frame based on one of these MAC table entries, the switch balances traffic across the various ports in the Layer 2 EtherChannel. +Layer 3 EtherChannel (L3 EtherChannel) An EtherChannel that acts as a routed port (that is, not a switched port), and as such, is used by a switch’s Layer 3 forwarding logic. As a result, the Layer 3 switch lists the Layer 3 EtherChannel in various routes in the switch’s IP routing table, with the switch balancing traffic across the various ports in the Layer 3 EtherChannel. +Layer 3 protocol A protocol that has characteristics like OSI Layer 3, which defines logical addressing and routing. IPv4 and IPv6 are Layer 3 protocols. + +Layer 3 switch See multilayer switch. + +learning The process used by switches for discovering MAC addresses, and their relative location, by looking at the source MAC address of all frames received by a bridge or switch. + +learning state In STP, a temporary port state in which the interface does not forward frames, but it can begin to learn MAC addresses from frames received on the interface. + +leased line A serial communications circuit between two points, provided by some service provider, typically a telephone company (telco). Because the telco does not sell a physical cable between the two endpoints, instead charging a monthly fee for the ability to send bits between the two sites, the service is considered to be a leased service. +lightweight AP A wireless AP that performs real-time 802.11 functions to interface with wireless clients, while relying on a wireless LAN controller to handle all management functions. + +Lightweight EAP (LEAP) A legacy Cisco proprietary wireless security method. + +link state A classification of the underlying algorithm used in some routing protocols. Link-state protocols build a detailed database that lists links (subnets) and their state (up, down), from which the best routes can then be calculated. +link-local address A unicast IPv6 address that begins FE80, used on each IPv6-enabled interface, used for sending packets within the attached link by applying a link-local scope. + +link-local multicast address A multicast IPv6 address that begins with FF02, with the fourth digit of 2 identifying the scope as link-local, to which devices apply a link-local scope. + +link-local scope With IPv6 multicasts, a term that refers to the parts (scope) of the network to which a multicast packet can flow, with link-local referring to the fact that the packet stays on the subnet in which it originated. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +742 link-state advertisement (LSA) + +link-state advertisement (LSA) In OSPF, the name of the data structure that resides inside the LSDB and describes in detail the various components in a network, including routers and links (subnets). +link-state database (LSDB) In OSPF, the data structure in RAM of a router that holds the various LSAs, with the collective LSAs representing the entire topology of the network. + +Link-State Request An OSPF packet used to ask a neighboring router to send a particular LSA. + +Link-State Update An OSPF packet used to send an LSA to a neighboring router. + +listening state A temporary STP port state that occurs immediately when a blocking inter-face must be moved to a forwarding state. The switch times out MAC table entries during this state. It also ignores frames received on the interface and doesn’t forward any frames out the interface. +LLC Logical Link Control. The higher of the two sublayers of the data-link layer defined by the IEEE. Synonymous with IEEE 802.2. + +local broadcast IP address IPv4 address 255.255.255.255. A packet sent to this address is sent as a data-link broadcast, but only flows to hosts in the subnet into which it was originally sent. Routers do not forward these packets. +local mode The default mode of a Cisco lightweight AP that offers one or more functioning BSSs on a specific channel. + +local route A route added to an IPv4 router’s routing table for the router’s interface IP address, with a /32 mask, which by virtue of this mask represents a route to only that router’s IPv4 address. +local username A username (with matching password), configured on a router or switch. It is considered local because it exists on the router or switch, and not on a remote server. + +logical address A generic reference to addresses as defined by Layer 3 protocols that do not have to be concerned with the physical details of the underlying physical media. Used mainly to contrast these addresses with data-link addresses, which are generically considered to be physical addresses because they differ based on the type of physical medium. +LSA See link-state advertisement. + +LSDB See link-state database. + +M +MAC Media Access Control. The lower of the two sublayers of the data-link layer defined by the IEEE. Synonymous with IEEE 802.3 for Ethernet LANs. + +MAC address A standardized data-link layer address that is required for every device that connects to a LAN. Ethernet MAC addresses are 6 bytes long and are controlled by the IEEE. Also known as a hardware address, a MAC layer address, and a physical address. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +multimode fiber 743 + +MAC address table A table of forwarding information held by a Layer 2 switch, built dynamically by listening to incoming frames and used by the switch to match frames to make decisions about where to forward the frame. +MaxAge In STP, a timer that states how long a switch should wait when it no longer receives Hellos from the root switch before acting to reconverge the STP topology. Also called the MaxAge timer. +maximum paths In Cisco IOS, a reference to the number of equal cost routes (paths) to reach a single subnet that IOS will add to the IP routing table at the same time. + +MD5 hash A specific mathematical algorithm intended for use in various security protocols. In the context of Cisco routers and switches, the devices store the MD5 hash of certain pass-words, rather than the passwords themselves, in an effort to make the device more secure. +media access control (MAC) layer A low-level function performed as part of Layer 2; in wireless networks, this function can be divided between a wireless LAN controller and a light-weight AP to form a split-MAC architecture. +mesh network A network of APs used to cover a large area without the need for wired Ethernet cabling; client traffic is bridged from AP to AP over a backhaul network. + +message integrity check (MIC) A cryptographic value computed from the contents of a data frame and used to detect tampering. + +message of the day One type of login banner that can be defined on a Cisco router or switch. + +metric A unit of measure used by routing protocol algorithms to determine the best route for traffic to use to reach a particular destination. + +Mobility Express WLC deployment A wireless network design that places a WLC co-located with a lightweight AP. + +Modified EUI-64 See EUI-64. + +multiarea In OSPFv2 and OSPFv3, a design that uses multiple areas. + +multicast IP address A class D IPv4 address. When used as a destination address in a pack-et, the routers collectively work to deliver copies of the one original packet to all hosts who have previously registered to receive packets sent to that particular multicast address. +multilayer switch A LAN switch that can also perform Layer 3 routing functions. The name comes from the fact that this device makes forwarding decisions based on logic from multiple OSI layers (Layers 2 and 3). +multimode fiber A type of fiber cable that works well with transmitters like LEDs that emit multiple angles of light into the core of the cable; to accommodate the multiple angles of inci-dent, the cable has a larger core in comparison to single-mode fiber cables. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +744 name resolution + +N +name resolution The process by which an IP host discovers the IP address associated with a hostname, often involving sending a DNS request to a DNS server, with the server supplying the IP address used by a host with the listed hostname. +name server A server connected to a network that resolves network names into network addresses. + +NAT Network Address Translation. A mechanism for reducing the need for globally unique IP addresses. NAT allows an organization with addresses that are not globally unique to connect to the Internet, by translating those addresses into public addresses in the globally routable address space. +native VLAN The one VLAN ID on any 802.1Q VLAN trunk for which the trunk forwards frames without an 802.1Q header. + +neighbor In routing protocols, another router with which a router decides to exchange rout-ing information. + +Neighbor Advertisement (NA) A message defined by the IPv6 Neighbor Discovery Protocol (NDP), used to declare to other neighbors a host’s MAC address. Sometimes sent in response to a previously received NDP Neighbor Solicitation (NS) message. +Neighbor Discovery Protocol (NDP) A protocol that is part of the IPv6 protocol suite, used to discover and exchange information about devices on the same subnet (neighbors). In particular, it replaces the IPv4 ARP protocol. +Neighbor Solicitation (NS) A message defined by the IPv6 Neighbor Discovery Protocol (NDP), used to ask a neighbor to reply with a Neighbor Advertisement, which lists the neigh-bor’s MAC address. +neighbor table For OSPF and EIGRP, a list of routers that have reached neighbor status. + +network A collection of computers, printers, routers, switches, and other devices that can communicate with each other over some transmission medium. + +network address See network number. + +network broadcast address In IPv4, a special address in each classful network that can be used to broadcast a packet to all hosts in that same classful network. Numerically, the address has the same value as the network number in the network part of the address and all 255s in the host octets; for example, 10.255.255.255 is the network broadcast address for classful net-work 10.0.0.0. +network ID A number that identifies an IPv4 network, using a number in dotted-decimal notation (like IP addresses); a number that represents any single Class A, B, or C IP network. + +network interface card (NIC) A computer card, sometimes an expansion card and some-times integrated into the motherboard of the computer, that provides the electronics and other functions to connect to a computer network. Today, most NICs are specifically Ethernet NICs, and most have an RJ-45 port, the most common type of Ethernet port. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +overlapping subnets 745 + +Network LSA In OSPF, a type of LSA that a designated router (DR) creates for the network (subnet) for which the DR is helping to distribute LSAs. + +network number A number that uses dotted-decimal notation like IP addresses, but the number itself represents all hosts in a single Class A, B, or C IP network. + +network part The portion of an IPv4 address that is either 1, 2, or 3 octets/bytes long, based on whether the address is in a Class A, B, or C network. + +network route A route for a classful network. + +networking model A generic term referring to any set of protocols and standards collected into a comprehensive grouping that, when followed by the devices in a network, allows all the devices to communicate. Examples include TCP/IP and OSI. +next-hop router In an IP route in a routing table, part of a routing table entry that refers to the next IP router (by IP address) that should receive packets that match the route. + +NIC See network interface card. + +nonoverlapping channels Successive channel numbers in a band that each have a frequency range that is narrow enough to not overlap the next channel above or below. + +NVRAM Nonvolatile RAM. A type of random-access memory (RAM) that retains its contents when a unit is powered off. + +O +open authentication An 802.11 authentication method that requires clients to associate with an AP without providing any credentials at all. + +Organization-local scope A concept in IPv6 for which packets sent to an address using this scope should be forwarded by routers inside the organization but not over any links connected to other organizations or over links connected to the Internet. +OSI Open System Interconnection reference model. A network architectural model devel-oped by the ISO. The model consists of seven layers, each of which specifies particular net-work functions, such as addressing, flow control, error control, encapsulation, and reliable message transfer. +OSPF Open Shortest Path First. A popular link-state IGP that uses a link-state database and the Shortest Path First (SPF) algorithm to calculate the best routes to reach each known subnet. + +OSPF version 2 The version of the OSPF routing protocol that supports IPv4, and not IPv6, and has been commonly used for over 20 years. + +OSPF version 3 The version of the OSPF routing protocol that originally supported only IPv6, and not IPv4, but now supports IPv4 through the use of address family configuration. + +outgoing interface In an IP route in a routing table, part of a routing table entry that refers to the local interface out which the local router should forward packets that match the route. + +overlapping subnets An (incorrect) IP subnet design condition in which one subnet’s range of addresses includes addresses in the range of another subnet. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +746 packet + +P +packet A logical grouping of bytes that includes the network layer header and encapsulated data, but specifically does not include any headers and trailers below the network layer. + +PagP Port Aggregation Protocol (PAgP) is a messaging protocol defined by Cisco that enables two neighboring devices to realize that they have multiple parallel links connecting to each other and then to decide which links can be combined into an EtherChannel. +partial mesh A network topology in which more than two devices could physically commu-nicate but, by choice, only a subset of the pairs of devices connected to the network is allowed to communicate directly. +passive interface With a routing protocol, a router interface for which the routing protocol is enabled on the interface, but for which the routing protocol does not send routing protocol messages out that interface. +patch cable An Ethernet cable, usually short, that connects from a device’s Ethernet port to a wall plate or switch. With wiring inside a building, electricians prewire from the wiring closet to each cubicle or other location, with a patch cable connecting the short distance from the wall plate to the user device. +PDU Protocol data unit. An OSI term to refer generically to a grouping of information by a particular layer of the OSI model. More specifically, an LxPDU would imply the data and headers as defined by Layer x. +periodic update With routing protocols, the concept that the routing protocol advertises routes in a routing update on a regular periodic basis. This is typical of distance vector routing protocols. +personal mode Pre-shared key authentication as applied to WPA, WPA2, and WPA3. + +ping An Internet Control Message Protocol (ICMP) echo message and its reply; ping often is used in IP networks to test the reachability of a network device. + +pinout The documentation and implementation of which wires inside a cable connect to each pin position in any connector. + +point-to-point bridge An AP configured to bridge a wired network to a companion bridge at the far end of a line-of-sight path. + +port In TCP and UDP, a number that is used to uniquely identify the application process that either sent (source port) or should receive (destination port) data. In LAN switching, another term for switch interface. +PortChannel One term Cisco switches use to reference a bundle of links that are, in some respects, treated like a single link. Other similar terms include EtherChannel and Channel-group. +PortFast A switch STP feature in which a port is placed in an STP forwarding state as soon as the interface comes up, bypassing the listening and learning states. This feature is meant for ports connected to end-user devices. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +public IP network 747 + +Prefix (prefix ID) In both IPv4 and IPv6, this term refers to the number that identifies a group of IPv4 or IPv6 addresses, respectively. Another term for subnet identifier. + +prefix length In IPv6, the number of bits in an IPv6 prefix. + +prefix mask A term to describe an IPv4 subnet mask when represented as a slash (/) fol-lowed by a decimal number. The decimal number is the number of binary 1s in the mask. + +prefix notation (IP version 4) A shorter way to write a subnet mask in which the number of binary 1s in the mask is simply written in decimal. For example, /24 denotes the subnet mask with 24 binary 1 bits in the subnet mask. The number of bits of value binary 1 in the mask is considered to be the prefix length. +primary root This term refers to the switch configured with the primary keyword on the spanning-tree vlan x root {primary | secondary} command. At time of configuration, this com-mand causes the switch to choose a new priority setting that makes the switch become the root switch in the network. +private addresses IP addresses in several Class A, B, and C networks that are set aside for use inside private organizations. These addresses, as defined in RFC 1918, are not routable through the Internet. +private IP network Any of the IPv4 Class A, B, or C networks as defined by RFC 1918, intended for use inside a company but not used as public IP networks. + +protected access credential (PAC) Special-purpose data that is used as an authentication credential in EAP-FAST. + +Protected EAP (PEAP) An authentication method that uses a certificate on the AS for outer authentication and a TLS tunnel for inner authentication. Clients can provide their credentials through either MS-CHAPv2 or GTC. +Protected Management Frame (PMF) A service provided by WPA3 that protects a set of 802.11 robust management and action frames, to prevent spoofing of AP functions. + +protocol data unit (PDU) A generic term referring to the header defined by some layer of a networking model, and the data encapsulated by the header (and possibly trailer) of that layer, but specifically not including any lower-layer headers and trailers. +Protocol Type field A field in a LAN header that identifies the type of header that follows the LAN header. Includes the DIX Ethernet Type field, the IEEE 802.2 DSAP field, and the SNAP protocol Type field. +public IP address An IP address that is part of a registered network number, as assigned by an Internet Assigned Numbers Authority (IANA) member agency, so that only the organization to which the address is registered is allowed to use the address. Routers in the Internet should have routes allowing them to forward packets to all the publicly registered IP addresses. +public IP network Any IPv4 Class A, B, or C network assigned for use by one organization only, so that the addresses in the network are unique across the Internet, allowing packets to be sent through the public Internet using the addresses. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +748 Public Key Infrastructure (PKI) + +Public Key Infrastructure (PKI) An enterprisewide system that generates and revokes digi-tal certificates for client authentication. + +PVST+ An STP option in Cisco switches that creates an STP instance per VLAN. Cisco proprietary. + +Q–R +quartet A term used in this book, but not in other references, to refer to a set of four hex digits in an IPv6 address. + +RADIUS server An authentication server used with 802.1x to authenticate wireless clients. + +RAM Random-access memory. A type of volatile memory that can be read and written by a microprocessor. + +Rapid PVST+ An STP option in Cisco switches that creates an RSTP instance per VLAN. Cisco proprietary. + +Rapid Spanning Tree Protocol (RSTP) Defined in IEEE 802.lw. Defines an improved ver-sion of STP that converges much more quickly and consistently than STP (802.Id). + +reference bandwidth In OSPF, a configurable value for the OSPF routing process, used by OSPF when calculating an interface’s default OSPF cost metric, calculated as the interface’s bandwidth divided by the reference bandwidth. +Regional Internet Registry An organization (five globally) that receives allocations of pub-lic IPv4 addresses from IANA and then manages that address space in their major geographic region, performing public address allocations to ISPs and assignments directly to companies that use the addresses. +repeater A device that repeats or retransmits signals it receives, effectively expanding the wireless coverage area. + +resident subnet Each IP subnet contains a number of unicast IP addresses; that subnet is the resident subnet for each of those addresses—that is, the subnet in which those addresses reside. +reverse route From one host’s perspective, for packets sent back to the host from another host, the route over which the packet travels. + +RFC Request For Comments. A document used as the primary means for communicat-ing information about the TCP/IP protocols. Some RFCs are designated by the Internet +Architecture Board (IAB) as Internet standards, and others are informational. RFCs are available online from numerous sources, including http://www.rfc-editor.org. +RIP Routing Information Protocol. An interior gateway protocol (IGP) that uses distance vec-tor logic and router hop count as the metric. RIP version 2 (RIPv2) replaced the older RIP ver-sion 1 (RIPv1), with RIPv2 providing more features, including support for VLSM. +RIR See Regional Internet Registry. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Router Solicitation (RS) 749 + +RJ-45 A popular type of cabling connector used for Ethernet cabling. It is similar to the +RJ-11 connector used for telephone wiring in homes in the United States. RJ-45 allows the con-nection of eight wires. +roaming The process a wireless client uses to move from one AP to another as it changes location. + +ROAS See Router-on-a-Stick. + +ROM Read-only memory. A type of nonvolatile memory that can be read but not written to by the microprocessor. + +ROMMON A shorter name for ROM Monitor, which is a low-level operating system that can be loaded into Cisco routers for several seldom-needed maintenance tasks, including password recovery and loading a new IOS when flash memory has been corrupted. +root bridge See root switch. + +root cost The STP cost from a nonroot switch to reach the root switch, as the sum of all STP costs for all ports out which a frame would exit to reach the root. + +root port In STP and RSTP, the one port on a nonroot switch in which the least-cost Hello is received. Switches put root ports in a forwarding state. + +root switch In STP and RSTP, the switch that wins the election by virtue of having the low-est bridge ID and, as a result, sends periodic Hello BPDUs (default, 2 seconds). + +routed port A port on a multilayer Cisco switch, configured with the no switchport com-mand, that tells the switch to treat the port as if it were a Layer 3 port, like a router interface. + +routed protocol A protocol that defines packets that can be routed by a router. Examples of routed protocols include IPv4 and IPv6. + +Router Advertisement (RA) A message defined by the IPv6 Neighbor Discovery Protocol (NDP), used by routers to announce their willingness to act as an IPv6 router on a link. These can be sent in response to a previously received NDP Router Solicitation (RS) message. +router ID (RID) In EIGRP and OSPF, a 32-bit number, written in dotted-decimal notation, that uniquely identifies each router. + +router LSA In OSPF, a type of LSA that a router creates to describe itself and the networks connected to it. + +Router-on-a-Stick (ROAS) Jargon to refer to the Cisco router feature of using VLAN trunking on an Ethernet interface, which then allows the router to route packets that happen +to enter the router on that trunk and then exit the router on that same trunk, just on a different VLAN. +Router Solicitation (RS) A message defined by the IPv6 Neighbor Discovery Protocol (NDP), used to ask any routers on the link to reply, identifying the router, plus other configu-ration settings (prefixes and prefix lengths). + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +750 routing protocol + +routing protocol A set of messages and processes with which routers can exchange infor-mation about routes to reach subnets in a particular network. Examples of routing protocols include Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), and Routing Information Protocol (RIP). +routing table A list of routes in a router, with each route listing the destination subnet and mask, the router interface out which to forward packets destined to that subnet, and as need-ed, the next-hop router’s IP address. +routing update A generic reference to any routing protocol’s messages in which it sends routing information to a neighbor. + +RSTP See Rapid Spanning Tree Protocol. + +running-config file In Cisco IOS switches and routers, the name of the file that resides in RAM, holding the device’s currently used configuration. + +S +same-layer interaction The communication between two networking devices for the pur-poses of the functions defined at a particular layer of a networking model, with that commu-nication happening by using a header defined by that layer of the model. The two devices set values in the header, send the header and encapsulated data, with the receiving devices inter-preting the header to decide what action to take. +secondary root This term refers to the switch configured with the secondary keyword on the spanning-tree vlan x root {primary | secondary} command. At time of configuration, this command causes the switch to set its base priority to 28,762. +Secure Shell (SSH) A TCP/IP application layer protocol that supports terminal emulation between a client and server, using dynamic key exchange and encryption to keep the commu-nications private. +segment In TCP, a term used to describe a TCP header and its encapsulated data (also called an L4PDU). Also in TCP, the process of accepting a large chunk of data from the application layer and breaking it into smaller pieces that fit into TCP segments. In Ethernet, a segment +is either a single Ethernet cable or a single collision domain (no matter how many cables are used). +serial cable A type of cable with many different styles of connectors used to connect a router to an external CSU/DSU on a leased-line installation. + +serial interface A type of interface on a router, used to connect to some types of WAN links, particularly leased lines and Frame Relay access links. + +service set identifier (SSID) A text string that is used to identify a wireless network. + +shared Ethernet An Ethernet that uses a hub, or even the original coaxial cabling, that results in the devices having to take turns sending data, sharing the available bandwidth. + +shortest path first (SPF) algorithm The name of the algorithm used by link-state routing protocols to analyze the LSDB and find the least-cost routes from that router to each subnet. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +stateless DHCPv6 751 + +Simultaneous Authentication of Equals (SAE) A strong authentication method used in WPA3 to authenticate wireless clients and APs and to prevent dictionary attacks for discover-ing pre-shared keys. +single-mode fiber A type of fiber cable that works well with transmitters like lasers that emit a single angle of light into the core of the cable, allowing for a smaller core in comparison to multimode fiber cables. +site-local scope A concept in IPv6 for which packets sent to an address using this scope should be forwarded by routers, but not forwarded over WAN links to other sites. + +SOHO router A term to describe the general role of a router that exists as part of the enter-prise network but resides at an employee’s home or at a smaller business site, possibly with a short-term lease compared to larger enterprise sites. These sites typically have few devices, so it makes sense to use one device that integrates routing, switches, wireless, and other features into a single device (the SOHO router) and are more likely to justify Internet access as the pri-mary WAN access method. +solicited-node multicast address A type of IPv6 multicast address, with link-local scope, used to send packets to all hosts in the subnet that share the same value in the last six hex dig-its of their unicast IPv6 addresses. Begins with FF02::1:FF00:0/104. +Spanning Tree Protocol (STP) A protocol defined by IEEE standard 802.ID. Allows switches and bridges to create a redundant LAN, with the protocol dynamically causing some ports to block traffic, so that the bridge/switch forwarding logic will not cause frames to loop indefinitely around the LAN. +split-MAC architecture A wireless AP strategy based around the idea that normal AP func-tions are split or divided between a wireless LAN controller and lightweight APs. + +SSH See Secure Shell. + +standard access list A list of IOS global configuration commands that can match only a packet’s source IP address, for the purpose of deciding which packets to discard and which to allow through the router. +star topology A network topology in which endpoints on a network are connected to a common central device by point-to-point links. + +startup-config file In Cisco IOS switches and routers, the name of the file that resides in NVRAM memory, holding the device’s configuration that will be loaded into RAM as the running-config file when the device is next reloaded or powered on. +stateful DHCPv6 A term used in IPv6 to contrast with stateless DHCP. Stateful DHCP keeps track of which clients have been assigned which IPv6 addresses (state information). + +stateless address autoconfiguration (SLAAC) A feature of IPv6 in which a host or router can be assigned an IPv6 unicast address without the need for a stateful DHCP server. + +stateless DHCPv6 A term used in IPv6 to contrast with stateful DHCP. Stateless DHCP servers don’t lease IPv6 addresses to clients. Instead, they supply other useful information, such as DNS server IP addresses, but with no need to track information about the clients (state information). + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +752 static access interface + +static access interface A LAN network design term, synonymous with the term access interface, but emphasizing that the port is assigned to one VLAN as a result of static configura-tion rather than through some dynamic process. +static route An IP route on a router created by the user configuring the details of the route on the local router. + +station (STA) An 802.11 client device that is associated with a BSS. + +STP Shielded twisted-pair. This type of cabling has a layer of shielded insulation to reduce electromagnetic interference (EMI). + +straight-through cable In Ethernet, a cable that connects the wire on pin 1 on one end of the cable to pin 1 on the other end of the cable, pin 2 on one end to pin 2 on the other end, and so on. +subinterface One of the virtual interfaces on a single physical interface. + +subnet Subdivisions of a Class A, B, or C network, as configured by a network administrator. Subnets allow a single Class A, B, or C network to be used instead of multiple networks, and still allow for a large number of groups of IP addresses, as is required for efficient IP routing. +subnet address See subnet number. + +subnet broadcast address A special address in each IPv4 subnet, specifically the largest numeric address in the subnet, designed so that packets sent to this address should be deliv-ered to all hosts in that subnet. + +subnet ID (IPv4) + +subnet ID (IPv6) + + +See subnet number. + +The number that represents the IPv6 subnet. Also known as the IPv6 pre- + +fix, or more formally as the subnet-router anycast address. + +subnet ID (prefix ID) See subnet number. + +subnet mask A 32-bit number that numerically describes the format of an IP address, by representing the combined network and subnet bits in the address with mask bit values of 1, and representing the host bits in the address with mask bit values of 0. +subnet number In IPv4, a dotted-decimal number that represents all addresses in a single subnet. Numerically, the smallest value in the range of numbers in a subnet, reserved so that it cannot be used as a unicast IP address by a host. +subnet part In a subnetted IPv4 address, interpreted with classful addressing rules, one of three parts of the structure of an IP address, with the subnet part uniquely identifying different subnets of a classful IP network. +subnet router anycast address A special anycast address in each IPv6 subnet, reserved for use by routers as a way to send a packet to any router on the subnet. The address’s value in each subnet is the same number as the subnet ID. +subnet zero An alternative term for zero subnet. See zero subnet. + +subnetting The process of subdividing a Class A, B, or C network into smaller groups called subnets. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Telnet 753 + +summary LSA In OSPFv2, a type of LSA, created by an Area Border Router (ABR), to describe a subnet in one area in the database of another area. + +supplicant An 802.1x entity that exists as software on a client device and serves to request network access. + +switch A network device that filters, forwards, and floods Ethernet frames based on the des-tination address of each frame. + +switched Ethernet An Ethernet that uses a switch, and particularly not a hub, so that the devices connected to one switch port do not have to contend to use the bandwidth available on another port. This term contrasts with shared Ethernet, in which the devices must share bandwidth, whereas switched Ethernet provides much more capacity, as the devices do not have to share the available bandwidth. +switched port A port on a multilayer Cisco switch or a Layer 2 switch, configured with the normal default interface setting of switchport, that tells the switch to treat the port as if it were a Layer 2 port, resulting in the switch performing switch MAC learning, Layer 2 forwarding, and STP on that interface. +switched virtual interface (SVI) Another term for any VLAN interface in a Cisco switch. See also VLAN interface. + +symmetric A feature of many Internet access technologies in which the downstream trans-mission rate is the same as the upstream transmission rate. + +synchronous The imposition of time ordering on a bit stream. Practically, a device will try to use the same speed as another device on the other end of a serial link. However, by examin-ing transitions between voltage states on the link, the device can notice slight variations in the speed on each end and can adjust its speed accordingly. +system ID extension The term for the formatting applied to the original 16-bit STP priority field to break it into a 4-bit priority field and a 12-bit VLAN ID field. + +T +T1 A line from the telco that allows transmission of data at 1.544 Mbps, with the ability to treat the line as 24 different 64-kbps DS0 channels (plus 8 kbps of overhead). + +TCP Transmission Control Protocol. A connection-oriented transport layer TCP/IP protocol that provides reliable data transmission. + +TCP/IP Transmission Control Protocol/Internet Protocol. A common name for the suite of protocols developed by the U.S. Department of Defense in the 1970s to support the construc-tion of worldwide internetworks. TCP and IP are the two best-known protocols in the suite. +telco A common abbreviation for telephone company. + +Telnet The standard terminal-emulation application layer protocol in the TCP/IP protocol stack. Telnet is used for remote terminal connection, enabling users to log in to remote systems and use resources as if they were connected to a local system. Telnet is defined in RFC 854. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +754 Temporal Key Integrity Protocol (TKIP) + +Temporal Key Integrity Protocol (TKIP) A wireless security scheme developed before 802.11i that provides a MIC for data integrity, a dynamic method for per-frame WEP encryp-tion keys, and a 48-bit initialization vector. The MIC also includes a time stamp and the send-er’s MAC address +three-tier design See core design. + +topology database The structured data that describes the network topology to a routing protocol. Link-state and balanced hybrid routing protocols use topology tables, from which they build the entries in the routing table. +trace Short for traceroute. A program available on many systems that traces the path that a packet takes to a destination. It is used mostly to troubleshoot routing problems between hosts. +traceroute A program available on many systems that traces the path that a packet takes to a destination. It is used mostly to debug routing problems between hosts. + +trailer In computer networking, a set of bytes placed behind some other data, encapsulating that data, as defined by a particular protocol. Typically, only data-link layer protocols define trailers. +transceiver A term formed from the words transmitter and receiver. The hardware used to both send (transmit) energy over some communications medium (e.g., wires in a cable), as well as to process received energy signals to interpret as a series of 1s and 0s. +transparent bridge The name of a networking device that was a precursor to modern LAN switches. Bridges forward frames between LAN segments based on the destination MAC address. Transparent bridging is so named because the presence of bridges is transparent to network end nodes. +trunk In campus LANs, an Ethernet segment over which the devices add a VLAN header that identifies the VLAN in which the frame exists. + +trunk interface A switch interface configured so that it operates using VLAN trunking (either 802.1Q or ISL). + +trunking Also called VLAN trunking. A method (using either the Cisco ISL protocol or the IEEE 802.1Q protocol) to support multiple VLANs, allowing traffic from those VLANs to cross a single link. +trunking administrative mode The configured trunking setting on a Cisco switch interface, as configured with the switchport mode command. + +trunking operational mode The current behavior of a Cisco switch interface for VLAN trunking. + +twisted-pair Transmission medium consisting of two insulated wires, with the wires twisted around each other in a spiral. An electrical circuit flows over the wire pair, with the current in opposite directions on each wire, which significantly reduces the interference between the two wires. +two-tier design See collapsed core design. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +virtual LAN (VLAN) 755 + +U +UDP User Datagram Protocol. Connectionless transport layer protocol in the TCP/IP pro-tocol stack. UDP is a simple protocol that exchanges datagrams without acknowledgments or guaranteed delivery. +unicast address Generally, any address in networking that represents a single device or interface, instead of a group of addresses (as would be represented by a multicast or broadcast address). +unicast IP address An IP address that represents a single interface. In IPv4, these addresses come from the Class A, B, and C ranges. + +unified WLC deployment A wireless network design that places a WLC centrally within a network topology. + +unique local address A type of IPv6 unicast address meant as a replacement for IPv4 pri-vate addresses. + +unknown unicast frame An Ethernet frame whose destination MAC address is not listed in a switch’s MAC address table, so the switch must flood the frame. + +up and up Jargon referring to the two interface states on a Cisco IOS router or switch (line status and protocol status), with the first “up” referring to the line status and the second “up” referring to the protocol status. An interface in this state should be able to pass data-link frames. +update timer The time interval that regulates how often a routing protocol sends its next periodic routing updates. Distance vector routing protocols send full routing updates every update interval. +user mode A mode of the user interface to a router or switch in which the user can type only nondisruptive EXEC commands, generally just to look at the current status, but not to change any operational settings. +UTP Unshielded twisted-pair. A type of cabling, standardized by the Telecommunications Industry Association (TIA), that holds twisted pairs of copper wires (typically four pair) and does not contain any shielding from outside interference. + +V +variable-length subnet mask (VLSM) The capability to specify a different subnet mask for the same Class A, B, or C network number on different subnets. VLSM can help optimize avail-able address space. +virtual LAN (VLAN) A group of devices, connected to one or more switches, with the devic-es grouped into a single broadcast domain through switch configuration. VLANs allow switch administrators to separate the devices connected to the switches into separate VLANs without requiring separate physical switches, gaining design advantages of separating the traffic without the expense of buying additional hardware. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +756 virtual private network (VPN) + +virtual private network (VPN) The process of securing communication between two devices whose packets pass over some public and unsecured network, typically the Internet. VPNs encrypt packets so that the communication is private, and authenticate the identity of the endpoints. +VLAN See virtual LAN. + +VLAN configuration database The name of the collective configuration of VLAN IDs and names on a Cisco switch. + +VLAN interface A configuration concept inside Cisco switches, used as an interface between IOS running on the switch and a VLAN supported inside the switch, so that the switch can assign an IP address and send IP packets into that VLAN. +VLAN Trunking Protocol (VTP) A Cisco-proprietary messaging protocol used between Cisco switches to communicate configuration information about the existence of VLANs, including the VLAN ID and VLAN name. +voice VLAN A VLAN defined for use by IP Phones, with the Cisco switch notifying the phone about the voice VLAN ID so that the phone can use 802.1Q frames to support traffic for the phone and the attached PC (which uses a data VLAN). +VoIP Voice over IP. The transport of voice traffic inside IP packets over an IP network. + +VTP See VLAN Trunking Protocol. + +VTP client mode One of three VTP operational modes for a switch with which switches learn about VLAN numbers and names from other switches, but which does not allow the switch to be directly configured with VLAN information. +VTP server mode One of three VTP operational modes. Switches in server mode can con-figure VLANs, tell other switches about the changes, and learn about VLAN changes from other switches. +VTP transparent mode One of three VTP operational modes. Switches in transparent mode can configure VLANs, but they do not tell other switches about the changes, and they do not learn about VLAN changes from other switches. + +W +WAN See wide-area network. + +web server Software, running on a computer, that stores web pages and sends those web pages to web clients (web browsers) that request the web pages. + +wide-area network (WAN) A part of a larger network that implements mostly OSI Layer 1 and 2 technology, connects sites that typically sit far apart, and uses a business model in which a consumer (individual or business) must lease the WAN from a service provider (often a telco). +Wi-Fi Alliance An organization formed by many companies in the wireless industry (an industry association) for the purpose of getting multivendor certified-compatible wireless products to market in a more timely fashion than would be possible by simply relying on stan-dardization processes. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +zero subnet 757 + +Wi-Fi Protected Access (WPA) The first version of a Wi-Fi Alliance standard that requires pre-shared key or 802.1x authentication, TKIP, and dynamic key management; based on parts of the 802.11i amendment before it was ratified. +wildcard mask The mask used in Cisco IOS ACL commands and OSPF and EIGRP network commands. + +window Represents the number of bytes that can be sent without receiving an acknowledgment. + +Wired Equivalent Privacy (WEP) An 802.11 authentication and encryption method that requires clients and APs to use a common WEP key. + +wired LAN A local-area network (LAN) that physically transmits bits using cables, often the wires inside cables. A term for local-area networks that use cables, emphasizing the fact that the LAN transmits data using wires (in cables) instead of wireless radio waves. See also wireless LAN. +wireless LAN A local-area network (LAN) that physically transmits bits using radio waves. The name “wireless” compares these LANs to more traditional “wired” LANs, which are LANs that use cables (which often have copper wires inside). +wireless LAN Controller (WLC) A device that cooperates with wireless lightweight access points (LWAP) to create a wireless LAN by performing some control functions for each LWAP and forwarding data between each LWAP and the wired LAN. +WLAN client A wireless device that wants to gain access to a wireless access point for the purpose of communicating with other wireless devices or other devices connected to the wired internetwork. +workgroup bridge (WGB) An AP that is configured to bridge between a wired device and a wireless network. The WGB acts as a wireless client. + +WPA Version 2 (WPA2) The second version of a Wi-Fi Alliance standard that requires pre-shared key or 802.1x authentication, TKIP or CCMP, and dynamic encryption key manage-ment; based on the complete 802.11i amendment after its ratification. +WPA Version 3 (WPA3) The third version of a Wi-Fi Alliance standard introduced in 2018 that requires pre-shared key or 802.1x authentication, GCMP, SAE, and forward secrecy. + +Z +zero subnet For every classful IPv4 network that is subnetted, the one subnet whose subnet number has all binary 0s in the subnet part of the number. In decimal, the zero subnet can be easily identified because it is the same number as the classful network number. + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + +Index + + + + +Symbols + +? command, 94-95 +:: (double colon), 531 + +Numbers + +2-way state (OSPF), 453-454, 457 2.4-GHz band, 626 +5-GHz band, 626 10BASE-T, 37, 42-45 10GBASE-T, 37 100BASE-T, 37, 42-45 802.11, 628-629 +BSS, 614-616 DS, 616-618 ESS, 618 IBSS, 619 WLAN, 614 +802.1D STP, 228, 232 802.1Q, 182 +802.1w RSTP, 228-232 802.1x, EAP integration, 658 1000BASE-LX, 37 +1000BASE-T, UTP cabling pinouts, 45-46 + +A + +AAA (Authentication, Authorization, and Accounting) servers, 136 +abbreviating IPv6 addresses, 531-532 + + +ABR (Area Border Routers), 460-461 access +CLI, 87-94, 128-139, 355-356 protected credentials, 659 WPA, 662-663 +WPA2, 662-663 WPA3, 662-663 +access interfaces, 185 access points. See AP access switches, 241 +ad hoc wireless networks. See IBSS addresses +BIA, 52 +broadcast addresses, 50-52 +calculating hosts and subnets in networks, 313-315 +classless versus classful addressing, 312-313 +Ethernet addresses, 50-52 exhaustion, 525 experimental, 290 +first usable, 293-294 group addresses, 51 host addresses, 293 +IPv4 addresses. See individual entry IPv6 addresses. See individual entry LAN addresses, 52 +last usable, 293-294 loopback address, 295 +MAC addresses, 50-52, 111-114, 117-124, 218 +multicast addresses, 50-52, 290 NAT, 277 +network broadcast addresses, 293-295 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + +network numbers, 293-295 NIC addresses, 52 +prefix part, 309-311 private addresses, 542 public addresses, 542 +range of subnet addresses, finding, 331 +sender MAC, 661 +subnet addresses, 272, 283, 324-327, 334-338 +unicast addresses, 50-52, 290, 322 universal addresses, 51 +adjacencies (OSPF neighbors), trouble-shooting, 510-516 +adjacent-layer interaction, 21-22 adjacent neighbors, 457 +administrative distance, 382-383, 448-449, 594-595 +administrative mode, trunking, 191 +administratively shutdown interfaces, 217 +AES (Advanced Encryption Standard), 661 +aging MAC address tables, 121-122 algorithms +AES, 661 CSMA/CD, 55 Dijkstra SPF, 451 +IGP routing protocol algorithm, 445 key mixing, 661 +RC4 cipher, 657 SPF, 457-459 STA, 216 +alternate ports, 229-232 +anycast addresses (IPv6), 574-576 AP (Access Points), 35, 614, 629 +authentication, 654 autonomous, 634-635, 638 Bridge mode, 647 +BSSID, 615 +cloud-based AP architectures, 636-637 + + +ESS, 618 fake, 654 +Flex+Bridge mode, 647 FlexConnect mode, 647 IBSS, 619 +LAP, 638-640 Local mode, 647 +management interface, 674 Monitor mode, 647 +multiple SSID, supporting, 617 noninfrastructure modes, 620-622 passing through, 615 +roaming, 618 +Rogue Detector mode, 647 SE Connect mode, 647 Sniffer mode, 647 +SSID, 615 VLAN, 668 WLAN, 668-669 +application layer (TCP/IP), 19-20 architectures +autonomous, 634-635, 638 centralized, 642-643 +cloud-based +AP, 636-637 +WLC deployments, 643 networking, 16 +split-MAC, 638-642 +area design (OSPF), 459-462 +ARIN (American Registry for Internet Numbers), 445 +ARP (Address Resolution Protocol), 72, 77, 378-379 +AS (Authentication Servers), 658 +AS (Autonomous Systems), 444-445 ASN (AS Numbers), 445 +assigning +IPv6 addresses to hosts, 550 +IPv6 subnets to internetwork topology, 549 +subnets to different locations, 285 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +760 authentication + + +authentication. See also security AP, 654 +AS, 658 clients, 653 EAP, 657-658 +EAP-FAST, 659 EAP-TLS, 660 +external authentication servers, 135-136 +LEAP, 659 +open authentication, 656 PEAP, 659 +web (WebAuth), 657 WEP, 657 +WLAN, 682 WLC, 642 WPA, 662-663 WPA2, 662-663 WPA3, 662-663 +authenticators, 658 +auto-cost reference-bandwidth command, 493, 496 +auto-mdix, 45 autonegotiation, 158-162 +autonomous AP (Access Points), 634-635, 638 +autonomous architectures, 634-635, 638 +autonomous systems. See AS auxiliary ports (routers), 362 + +B + +backbone areas, 460-461 backbone routers, 461 backup ports, 230, 233 bandwidth +frequencies, 626-627 reference, 492 +router serial interfaces, 361 + +bandwidth command, 492, 496 Basic Service Areas. See BSA Basic Service Sets. See BSS +BDR (Backup DR), 456-457, 504-506 +Bellman-Ford protocols. See distance vector protocols +Berners-Lee, Tim, 20 +BGP (Border Gateway Protocol), 445 BIA (Burned-In Addresses), 52 +BID (Bridge ID) STP, 218-219 +system ID extensions, 243-244 bidirectional communication, 613 +binary/hexadecimal conversion chart (IPv6), 531 +binary masks, 304-308 binary subnet analysis, 326 +binary practice problems, 328-329 Boolean math, 331 +finding +range of addresses, 331 subnet ID, 327 +shortcut for binary process, 330 blocking state, interfaces, 215-217 blueprint (networking), 16 +Boolean AND, 331 Boolean math, 331 Boolean OR, 331 +borrowing host bits to create subnet bits, 280-281 +BPDU (Bridge Protocol Data Units), 218, 225 +BPDU Guard, 236 BPDU tunneling, 247 bridge ID. See BID Bridge mode (AP), 647 bridges. See switches +bridging tables. See MAC address tables +broadcast addresses, 50-52, 325-327 + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +classful IP networks 761 + + +broadcast network type (OSPF), 500-506 +broadcast storms, 213-215 BSA (Basic Service Areas), 614 +BSS (Basic Service Sets), 614-618, 629 AP, 614 +associations, 615 BSSID, 615 +DS, 616-618 IBSS, 619 stations, 615 traffic flows, 615 +burned-in MAC addresses, 218 + +C + +CA (Certificate Authorities), 659 cables +CLI, cabling console connections, 88-90 +enterprise networks, 351 Ethernet, 35 +fiber-optic cabling, 38, 46-49 IP telephony, 197 +leased-line cabling, 62-63 +physical console connections, 88-90 pinouts +rollover pinouts, 89 +straight-through cable pinout, 42-45 +UTP, 37-46, 49 caches (ARP), 77 +CAM (Content-Addressable Memory) tables. See MAC address tables +candidate default routes, 384 +CAPWAP (Control and Provisioning of Wireless Access Points) tunneling protocol, 639-640 +carrier sense multiple access with col-lision detection (CSMA/CD), 55 +CCMP (Counter/CBC-MAC Protocol), 661 + +cells. See BSA +centralized architectures, 642-643 centralized controllers +dynamic interfaces, creating, 678 RADIUS servers, configuration, 676 WLAN security, 682 +certificate authorities. See CA +CFN (Cisco Feature Navigator), 404 +channel-group command, 248-249, 259 +EtherChannels, 416 +Layer 3 EtherChannels, trouble-shooting, 413 +channel-group number mode on command, 411 +channels, 627 +dynamic assignment, 642 nonoverlapping, 628 +CIDR (Classless Interdomain Routing), subnet masks, 305 +circuits. See leased-line WAN Cisco Binary Game, 306 Cisco Catalyst switches, 86 +Cisco integrated services routers, 352 cladding (fiber-optic cable), 47 +Class A networks, 290-295, 312 Class B networks, 290-293, 312 Class C networks, 290-295, 312 Class D networks, 290 +Class E networks, 290 +classful IP addresses, 312-313 classful IP networks, 289, 296-297 +address formats, 291-292 before subnetting, 279-280 +calculating hosts per network, 293 classes in, 290-291 +default masks, 292 network ID, 293-295 number of, 291 octet values, 290 +size of, 291 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +762 classful IP networks + + +subnet masks, 302 unusual addresses, 295 +classful networks, 276-279 +classful routing protocols, 447-448 classless addressing, 312-313 classless routing protocols, 447-448 +clear ip arp [ip-address] command, 378, 391 +clear ip ospf process command, 481, 497 +clear mac address-table dynamic command, 122, 125 +CLI (Command-Line Interface) accessing, 87-94 +cabling console connections, 88-90 Cisco Catalyst switches, 86 command edit and recall, 95 common command prompts, 98 configuration files, 99-102 configuration mode, 96-97 +configuration submodes and contexts, 97-99 +help, 94-95 overview, 84-86 +privileged EXEC mode, 91-93 router CLI, 355-356 +security, 128-139 +user EXEC mode, 91-93 clients +authentication, 653, 656-660 load balancing, 642 +roaming, 642 Telnet clients, 91 WLAN, 684 +CLN (Cisco Learning Network), 306 +clock rates, router serial interfaces, 361 +cloud-based architectures, 636-637, 643 +collisions, 167 + + +commands ?, 94-95 +auto-cost reference-bandwidth, 496 bandwidth, 496 +channel-group, 248-249, 259, 413, 416 channel-group number mode on, 411 clear ip arp [ip-address], 378, 391 +clear ip ospf process, 481, 497 +clear mac address-table dynamic, 122, 125 +com?, 94 command, 495 command ?, 94 +command parm?, 94 command parm, 94 command parm1 ?, 94 +configure terminal, 97, 101, 104, 132, 189, 355 +copy, 356 +copy running-config startup-config, 102-104 +copy startup-config running-config, 104 +crypto key, 137 +crypto key generate rsa, 137-139, 148 debug, 96 +default-information originate, 489, 496 +default-information originate always, 490 +delete vlan.dat, 117 description, 153, 170, 363 disable, 104 +duplex, 152-154, 165, 170, 355, 363 enable, 91, 104, 130 +enable password, 131 enable secret, 131, 148 enable secret love, 94 encapsulation, 397-398 encapsulation dot1q, 415 +encapsulation dot1q vlan_id, 397 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +commands 763 + + +encapsulation dot1q vlan-id, 401 end, 104, 355 +erase nvram, 104 +erase startup-config, 104, 117 exec-timeout, 145, 148 +exit, 98, 101-103, 355 history size, 145, 148 +hostname, 99-103, 117, 138, 148 hostname Fred, 97 +how interfaces status, 156 +interface, 97, 103, 169, 185, 198, 356, 363, 391, 415 +interface ethernet, 357 interface fastethernet, 357 interface gigabitethernet, 357 +interface loopback, 470, 481, 496 interface port-channel, 416 interface port-channel number, 411 interface range, 154, 169, 187 interface type number.subint, 397 interface vlan, 148, 415 +interface vlan 1, 142 interface vlan vlan_id, 403 ip -6 neighbor show, 600 +ip address, 142, 148, 360, 363, 381, 391-392, 397-398, 470 +ip address address mask, 397, 403, 411 ip address dhcp, 148 +ip default-gateway, 142, 148 ip domain-name, 139 +ip mtu, 515 +ip name-server, 142, 148 ip ospf, 495 +ip ospf cost, 492, 496 +ip ospf dead-interval, 517 ip ospf hello-interval, 517 ip ospf process-id, 511 +ip ospf process-id area area-id, 483-485 +ip route, 367, 376, 380-385, 391 +ip routing, 391, 402-404, 415 + +ip ssh version 2, 139 +ipv6 address, 557, 560, 564-568, 576-578, 583 +ipv6 address dhcp, 578 ipv6 address eui-64, 563 ipv6 address link-local, 568 +ipv6 enable, 568-569, 576-578 ipv6 route, 586-597, 604 +ipv6 unicast-routing, 558, 578 line aux 0, 362 +line con 0, 130-131 +line console 0, 97-98, 103, 147, 356 line vty, 132, 147 +logging console, 145, 148 logging synchronous, 145, 148 login, 94, 103, 130-132, 147 login local, 147 +mac-address, 564 maximum-paths, 494-496 name, 185, 207 +ndp -an, 600 +netsh interface ipv6 show neighbors, 600 +network, 473-475, 480-486, 511 no debug all, 104 +no description, 157, 170 no duplex, 157, 170 +no ip address, 412 +no ip domain-lookup, 146 no logging console, 145, 148 +no passive-interface, 487, 496 no password, 134 +no shutdown, 142, 155-157, 170, 207, 253, 356, 363, 399, 403-405 +[no] shutdown vlan number, 201 no speed, 157, 170 +no switchport, 408, 411-415 passive-interface, 487, 496, 517 passive-interface default, 488 password, 97, 103, 130-132, 147 +password faith, 94 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +764 commands + + +ping, 78, 419-429, 587 +port-channel load-balance method, 254 +quit, 104 +reload, 91-92, 102-104, 117, 402-404 router-id, 470, 496 +router ospf, 470, 495 router ospf 1, 472, 480 +router ospf process-id, 480, 510 sdm prefer, 402-404 +sdm prefer lanbase-routing, 402, 415 show, 95, 166, 361, 480, 508 +show crypto key mypubkey rsa, 149 show dhcp lease, 143-144, 149 show etherchannel, 248, 259, 416 show etherchannel 1 summary, 250 show etherchannel summary, 413 show history, 145, 149 +show interfaces, 119-120, 156, +162-164, 167-170, 357-358, 361, 364, 376, 408, 416, 515-517, 583 +show interfaces description, 162, 170 +show interfaces interface-id trunk, 203-205 +show interfaces status, 118, 125, 153, 162-165, 408, 412 +show interfaces switchport, 192-199, 202-203, 208 +show interfaces trunk, 193-194, 199-205, 208, 401 +show interfaces type number switchport, 199 +show interfaces type number trunk, 200 +show interfaces vlan, 143-144, 149, 416 +show ip arp, 391 +show ip default-gateway, 144, 149 +show ip interface brief, 357-361, 364, 406 +show ip ospf, 481, 496, 510-511, 517 +show ip ospf database, 450, 462, 475, 497 + +show ip ospf interface, 486-488, 496, 503-505, 510-513, 517 +show ip ospf interface [brief], 479-480, 511 +show ip ospf interface brief, 488, 491, 496, 503, 5.5, 508-510, 514, 517 +show ip ospf interface G0/0, 505 +show ip ospf neighbor, 452-453, 457, 475, 480, 497, 502, 505, 508-517 +show ip ospf neighbor interface brief, 513 +show ip protocols, 479, 485, 496, 517 +show ip route, 324, 356, 367, 376-391, 400-402, 408, 416, 449, 475-478, 497, 585 +show ip route address, 388 show ip route [connected], 398 show ip route EXEC, 404 show ip route ospf, 387, 497 show ip route static, 380, 490 show ip ssh, 139, 149 +show ipv6 interface, 558-559, 567, 570-573, 579 +show ipv6 interface brief, 558-560, 567, 575, 579 +show ipv6 route, 566, 579, 585-590, 605 +show ipv6 route connected, 560, 586 show ipv6 route local, 585-586 +show ipv6 route static, 587-590, 593, 595 +show mac address-table, 120, 125, 356 +show mac address-table aging-time, 122, 125 +show mac address-table count, 122, 125 +show mac address-table dynamic, 96, 117, 123-125, 170 +show mac address-table dynamic address, 125 +show mac address-table dynamic interface, 120-121, 125 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +connected routes 765 + + +show mac address-table dynamic vlan, 125 +show mac address-table static, 170 show mac address-table vlan, 121 show protocols, 361, 364 +show running-config, 93, 101, 104, 132-133, 143, 149, 155, 158, 170, 398, 479, 488, 511, 584 +show running-config | interface, 170 show spanning-tree, 249, 259 +show spanning-tree vlan, 259 +show spanning-tree vlan vlan-id, 204 show ssh, 139, 149 +show startup-config, 101, 104, 158 show vlan, 201, 208 +show vlan brief, 186-189, 202 show vlan id, 187 +show vlans, 398-401, 416 show vtp status, 190, 208 +shutdown, 143, 155, 170, 207, 253, 356, 359, 363, 399-401, 405 +shutdown command, 163 spanning-tree, 259 +spanning-tree mode, 242-243, 259 spanning-tree vlan, 244 +spanning-tree vlan x root primary, 244-245 +spanning-tree vlan x root secondary, 244-245 +speed, 98-99, 152-154, 165, 170, 355, 363 +switchport, 408, 415 +switchport access vlan, 185-189, 198-199, 207 +switchport mode, 191, 207 +switchport mode access, 185, 188, 198-199 +switchport mode dynamic auto, 202 +switchport mode dynamic desirable, 193 +switchport mode trunk, 191, 203, 396 +switchport nonegotiate, 195, 203, 207 + +switchport trunk allowed vlan, 204, 207 +switchport trunk encapsulation, 191, 207 +switchport trunk native vlan, 207 +switchport trunk native vlan vlan-id, 205 +switchport voice vlan, 198-199, 207 switchport voice vlan vlan-id, 200 terminal history size, 145, 149 +test etherchannel load-balance EXEC, 255 +traceroute, 428-432, 587 transport input, 138, 148, 356 transport input all, 139 transport input none, 139 transport input ssh, 139 transport input telnet ssh, 139 undebug all, 104 +username, 134 +username secret, 134, 147 vlan, 185, 198, 207 +vlan number, 201 vtp mode, 207 +vtp mode off, 190 +vtp mode transparent, 190 write erase, 104 +communication bidirectional, 613 passing through, 615 unidirectional, 613 +configuration BPDU. See Hello BPDU +configuration changes (STP topology, influencing), 223 +configuration files, 99-102 configuration mode (CLI), 96-97 +configure terminal command, 97, 101, 104, 132, 189, 355 +connected routes, 366, 376-378, 583-585 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +766 connectors + + +connectors pins, 40 RJ-45, 41 +console connections, cabling, 88-90 console passwords, 129 +console ports, 672 +context-setting commands, 97 +control plane (cloud-based AP archi-tectures), 637 +controllers +centralized, 676-678, 682 dynamic interfaces, 674-675 interfaces, 673, 681 management interfaces, 674 ports, 672-673 +redundancy management, 674 service port interfaces, 674 virtual interfaces, 674 VLANs, mapping, 673 +WLAN controller configuration, 685 WLC, 639-642 +convergence, 216, 443 +converting subnet mask formats, 305-309 +copy command, 356 +copy running-config startup-config command, 102-104 +copy startup-config running-config command, 104 +cores (fiber-optic cable), 47 costs (metrics) +EIGRP, 446 IGP, 446-447 OSPF, 491-493 ports, 247 +IEEE default, 223 STP, 221 +RIPv2, 446-447 +CRC (Cyclic Redundancy Checks), 167-168 +crossover cable pinouts, 44-45 + +crosstalk, 40 +crypto key command, 137 +crypto key generate rsa command, 137-139, 148 +CSMA/CD (Carrier Sense Multiple Access with Collision Detection), 55, 167 +CUCM (Cisco Unified Communication Manager), 196 +cycles, waves, 625 + +D + +DAD (Duplicate Address Detection), 598, 602 +data +decryption, 655 encapsulation +OSI terminology, 30 TCP/IP terminology, 27-28 +integrity, 656 privacy, 655 +privacy/integrity methods, 660-661 data centers, 108 +data link layer +Ethernet, 38-39, 49-50 TCP/IP, 25-26 +data-link protocols, leased-line WAN, 63-64 +data paths, autonomous wireless networks, 635 +data plane (cloud-based AP archi-tectures), 637 +Data VLAN (Virtual Local Area Networks), 197-199 +DDN (Dotted-Decimal Notation), 24, 305-309 +de-encapsulating IP packets, 373-374 Dead Interval timers, 455 +dead timers, troubleshooting, 512-513 debug command, 96 +decimal masks. See DDN + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +dynamic IP address configuration, DHCP 767 + + +decimal subnet analysis, 331 difficult masks, 334-338 easy masks, 332 +finding +subnet broadcast addresses, 336-338 +subnet IDs, 334-336 +predictability in interesting octets, 333-334 +reference table: DDN mask values and binary equivalent, 338-339 +decrypting data, 655 +default gateways, 70, 370-372 +default-information originate always command, 490 +default-information originate command, 489, 496 +default OSPF routes, 489-491 default routers, 70, 370-372 default routes, 379, 383-384 +default VLAN (Virtual Local Area Networks), 186 +delete vlan.dat command, 117 description command, 153, 170, 363 designated ports. See DP +DHCP (Dynamic Host Configuration Protocol), 143, 286 +diagrams (networking), 15, 26 difficult subnet masks, 334-338 +digital certificates, split-MAC archi-tectures, 640 +Dijkstra SPF algorithm, 451 directed broadcast addresses, 283 disable command, 104 +disabling autonegotiation, 160 DTP, 203 +ports, 230 +switch interfaces, 155-156 VLAN, troubleshooting, 201-202 WLAN, 680 +discarding state (RSTP), 229-230 + +discovering +duplicate addresses, 602 neighbor link addresses, 598-600 routers, 600-601 +distance vector protocols, 446 distributed architectures, 634-638 distribution switches, 241 distribution system ports, 672-673 distribution systems. See DS +DNS (Domain Name Systems), 76-77 documentation, subnet plans, 267 double colon (::), 531 +DP (Designated Ports), 217, 222-223, 230 +DR (Designated Routers) BDR, 456-457 +elections, configuration with broadcast network type (OSPF), 504-506 +DRAM (Dynamic Random-Access Memory), 99 +DROthers routers, 457 +DS (Distribution Systems), 616-618 DTP (Dynamic Trunking Protocol), 203 dual stacks, 529, 556 +duplex command, 152-154, 165, 170, 355, 363 +duplexes +configuration on switch interfaces, 152-154 +mismatches, 161 troubleshooting, 161-166 +Duplicate Address Detection. See DAD dynamic auto trunking, 191 +dynamic desirable trunking, 191 +dynamic EtherChannels, configuration, 250-251 +Dynamic Host Configuration Protocol (DHCP), 143, 286 +dynamic interfaces, 674-675, 678 +dynamic IP address configuration, DHCP, 143 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +768 dynamic ranges per subnet, choosing + + +dynamic ranges per subnet, choosing, 286-287 +dynamic unicast address configuration (IPv6), 564 + +E + +E-Line, 66 +EAP (Extensible Authentication Protocol), 657-660 +EAP-FAST (EAP Flexible Authenti-cation by Secure Tunneling), 659 +EAP-TLS (EAP Transport Layer Security), 660 +easy subnet masks, 332 +echo requests/replies (ICMP), 78, 419 edge ports, 233 +EGP (Exterior Gateway Protocol), 444 +EIGRP (Enhanced Interior Gateway Routing Protocol), 446 +EIGRPv6 (EIGRP for IPv6), 529 electric waves, traveling, 624 embedded WLC deployments, 644 enable command, 91, 104, 130 enable mode, 91-93 +enable passwords, 130-131 enable secret command, 131, 148 enable secret love command, 94 encapsulation +IPv4, 70 +OSI terminology, 30 TCP/IP terminology, 27-28 +encapsulation command, 397-398 encapsulation dot1q command, 415 +encapsulation dot1q vlan_id command, 397, 401 +encoding schemes, 39 encryption (data), 655 end command, 104, 355 +end-user perspectives on networking, 14-15 + +enterprise LAN (Local Area Networks), 36-37 +enterprise mode (WPA), 663 enterprise networks, 15, 268, 350-352 enterprise routers, 350-353 +EoMPLS (Ethernet over MPLS), 66 erase nvram command, 104 +erase startup-config command, 104, 117 +erasing switch configuration files, 102 errors +detection, FCS field, 53 TCP error recovery rates, 21 +ESS (Extended Service Sets), 618 EtherChannel, 234, 407 +configuration, 247-257 +dynamic EtherChannels, 250-251 Layer 3 EtherChannels, 392, 410-414 load distribution, 253-257 +manual Layer 2 EtherChannels, 248-250 +troubleshooting, 251-253 Ethernet, 26 +addresses, 52 cables, 35 +E-Line, 66 emulation, 66-68 EoMPLS, 66 GBIC, 42 +IPv6 static routes over Ethernet links, 591 +LAN. See also subnets enterprise LAN, 36-37 enterprise networks, 350 Ethernet addressing, 50-52 +Ethernet data link protocols, 38-50 +Ethernet frames, 38 +Ethernet physical layer standards, 37 +Ethernet ports, 40 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +frames 769 + + +Ethernet Type field, 52 FCS field, 53 +full-duplex logic, 53-56 half-duplex logic, 54-56 overview, 32-34 +SOHO LAN, 35 +switches, 35, 106-124, 152-162 troubleshooting, 162-168 +UTP cables, 37-46, 49 VLAN, 179-205 +links, 40 OSPF +Ethernet links, 456-457 Ethernet WAN, 506-508 +point-to-point, 56 shared media, 56 +switches, fiber-optic cables, 48 WAN +enterprise networks, 350 EoMPLS, 66 +Ethernet emulation, 66-68 overview, 65-66 +point-to-point network type (OSPF), 506-508 +Ethernet Alliance web page, 38 EtherType, 52 +EUI-64 (extended unique identifier), 560-564 +EXEC modes +privileged EXEC mode, 91-93 +simple password configuration, 130-133 +user EXEC mode, 91-93 +exec-timeout command, 145, 148 exit command, 98, 101-103, 355 expanding IPv6 addresses, 532 experimental addresses, 290 extended ping command, 423-426 +extended traceroute command, 431-432 +external authentication servers, 135-136 + +F + +failed interfaces, 217 fake AP, 654 +Fast Ethernet, 37 +FCS (Frame Check Sequence) field, 53 fiber-optic cables, 37-38, 46-49 finding +IPv6 prefixes, 533-536 +MAC address table entries, 120-121 mismatched Hello/dead timers, 512 range of subnet addresses, 331 routers best routes, 451 +subnet broadcast addresses, 327, 336-338 +subnet ID, 327, 334-336 +first octet values, classes by, 290 +first usable IP addresses, deriving, 293-294 +flash memory, 100 Flex+Bridge mode (APs), 647 FlexConnect mode (APs), 647 +floating static routes, 381-383, 593-595 +flooding, 114, 450 +Forward delay timers (STP), 225 forward secrecy, 663 +forward-versus-filter decisions, 113 forwarding, 115 +data. See routes/routing +IP packets, 68-75, 374-375 known unicast frames, 110-113 +forwarding state, interfaces, 215-217 frames, 26-28, 38 +broadcast storms, 213-215 CRC, 167 +flooding, 114 giants, 167 +IP routing, 373-376 looping frames, 213-215 +multiple frame transmissions, 214-215 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +770 frames + + +packet output errors, 167 runts, 167 +unknown unicast frames, 114 frequencies, 613, 625-627 full addresses (IPv6), 530 +full duplex logic, 53-56 +full VLAN configuration example, 186-188 +fully adjacent neighbors, 457, 502 + +G + +G0/0 status code, 359 G0/1 status code, 359 gateways (default), 370-372 +GBIC (Gigabit Ethernet Interface Con-verter), 42 +GCMP (Galois/Counter Mode Protocol), 661 +Get IEEE 802 program, 228 GET requests (HTTP), 20 GHz (Gigahertz), 625 giants, 167 +Gigabit Ethernet, 37 +global routing prefix (IPv6), 543-544 global unicast addresses, 542-550 global unicast next-hop addresses, 589 group addresses, 51 +groupings (IP address), 70 +GTC (Generic Token Cards), 660 + +H + +half-duplex logic, 54-56 +HDLC (High-Level Data Link Control), 63-64 +headers +Ethernet header fields, 50 +HDLC, 63 + +HTTP, 20 +IP headers, 73 +Hello BPDU, 218, 225 Hello Interval timers, 455 Hello messages, 219, 452 Hello timers, 225, 512-513 +hexadecimal/binary conversion chart (IPv6), 531 +history buffer commands, 144-145 history size command, 145, 148 hopping (VLAN), 205 +host addresses, calculating number per network, 293 +host bits, 272 +host forwarding logic (IPv4), 69 +host part (of IP addresses), 292, 302, 311 +host routes, 378-379 +IPv4 routing process, 370 static host routes, 381 +hostname command, 97-103, 117, 138, 148 +hostnames, 76, 427-428 hosts, 68 +analyzing subnet needs, 269-271 assigning addresses to, 550 calculating, 313-315 +host bits, 272 +IP settings, 24, 140-142 NDP, 598-603 +subnets, 268-271 +HTTP (Hypertext Transfer Protocol), 19-20 +hubs +autonegotiation, 161-162 LAN hubs, 54-56 +Hypertext Transfer Protocol (HTTP), 19-20 +Hz (Hertz), 625 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +interfaces 771 + + +I + +IANA (Internet Assigned Numbers Authority), 445, 540 +IBSS (Independent Basic Service Sets), 619. See also BSS +ICANN (Internet Corporation for Assigned Names and Numbers), 540 +ICMP (Internet Control Message Protocol), 78, 419 +ICMPv6 (Internet Control Message Protocol version 6), 526 +ID (identification) +ID numbers, WLAN, 680 interface ID, 547 +subnet ID, 272, 283, 324, 327, 330, 334-336, 548 +system ID extensions, 245-246 VLAN ID, 180 +IEEE (Institute of Electrical and Elec-tronic Engineers), 18 +802.1D Spanning-Tree states, 227 802.1D standard, 228 +802.1w amendment, 228 802.1x, EAP integration, 658 default port costs, 223 +Get IEEE 802 program, 228 +IGP (Interior Gateway Protocol), 444-448 +IGRP (Interior Gateway Routing Protocol), 446 +inferior Hello messages, 219 infrastructure mode, 614 input errors, 166-167 +integrated services routers (Cisco), 352 interarea routes, 461 +interesting octets, predictability in, 333-334 +interface command, 97, 103, 169, 185, 198, 356, 363, 391, 415 +interface ethernet command, 357 +interface fastethernet command, 357 + + +interface gigabitethernet command, 357 +interface ID, 547 +interface loopback command, 470, 481, 496 +interface port-channel command, 416 +interface port-channel number command, 411 +interface range command, 154, 169, 187 +interface type number.subint command, 397 +interface vlan command, 148, 415 interface vlan 1 command, 142 interface vlan vlan_id command, 403 interfaces, 87 +administratively shutdown, 217 blocking state, 215 +controllers, 673, 681 +dynamic interfaces, 674-675, 678 EtherChannels, adding, 251-253 failed interfaces, 217 +forwarding state, 215 Layer 1 problems, 166-168 learning state, 227 listening state, 227 +management interfaces, 674 OSPF +metrics, 493 +passive interfaces, 487-488 OSPFv2 configuration, 483-486 +physical interface configuration, 251-253 +ports, compared, 671 +routed interfaces, Layer 3 (multilayer) switches, 407-409 +routers, 356-357 bandwidth, 361 clock rates, 361 +IP addresses, 360-361 status codes, 358-359 +service port interfaces, 674 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +772 interfaces + + +speed and duplex issues, 163-166 states, 216-217, 227 +status codes, 162-163, 358-359 subcommands, 97 subinterfaces, 396-397 +SVI, 392, 401-406 +switch interface configuration, 152-162 +troubleshooting, 162-168 virtual interfaces, 674 VLAN interfaces, 402 WLC interfaces, 673-675 working interfaces, 217 +interference, simultaneous trans-missions, 613 +internal routers, 461 Internet Protocol. See IP internetworks, 72, 268 intra-area routes, 461 +intrusion protection, WLC, 642 IOS configuration, 96-102 +IP (Internet Protocol), 22. See also IPv4; IPv6 +addresses management, 635 +ping command, 427-428 subnets, 283-284 +forwarding +IP packets, 374-375 +longest prefix matches, 386-389 IGP metrics, 446-447 +routing, 366 +ARP tables, 378-379 +de-encapsulating IP packets, 373-374 +encapsulating IP packets in new frames, 375 +example of, 371-376 frames, 373-376 +host forwarding of IP packets to default routers (gateways), 372 + + +IP forwarding, 374-375, 386-389 IPv4 routing process, 369-371 troubleshooting, 419-434 +routing tables, 70-72, 388-389 telephony, 196-200 +ip -6 neighbor show command, 600 +ip address address mask command, 397, 403, 411 +ip address command, 142, 148, 360, 363, 381, 391-392, 398 +IP addresses on loopback interfaces, 470 +subinterfaces, 397 +ip address dhcp command, 148 ip address subcommand, 376 +ip_address parameter, network command, 473 +ip default-gateway command, 142, 148 ip domain-name command, 139 +ip mtu command, 515 +ip name-server command, 142, 148 ip ospf command, 495 +ip ospf cost command, 492, 496 +ip ospf dead-interval command, 517 ip ospf hello-interval command, 517 +ip ospf process-id area area-id command, 483-485 +ip ospf process-id command, 511 +ip route command, 367, 376, 379-385, 391, 402-404, 415 +ip ssh version 2 command, 139 +IPv4 (Internet Protocol Version 4). See also IP +address exhaustion, 525 ARP, 72, 77 +calculating hosts and subnets in network, 313-315 +classes in, 290-291 +classful IP networks, 289-297 +classless versus classful addressing, 312-313 +configuration on switch, 142-143 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +ipv6 enable command 773 + + +DNS, 76-77 +dynamic IP address configuration with DHCP, 143 +headers, 73 +hosts, 24, 140-142 networks, 70-73, 293-295 overview, 22-23, 68 private addresses, 542 public addresses, 542 router support +auxiliary ports, 362 CLI access, 355-356 interfaces, 356-361 +routing, 24-25, 369-371 logic, 68-72 protocols, 74-75 +subnets, 70, 73, 264-267, 322-339 hosts, 268-271 +multiple subnet sizes, 274 number of hosts, 271 number of subnets, 270 one-size subnets, 273 single-size subnets, 273 size of, 272-274 +subnet addresses, 272 subnet ID, 272 +subnet masks, 272, 275, 279-283, 302-312, 315 +subnet numbers, 272 switch settings, 140-142 testing connectivity, 78 troubleshooting tools +ping command, 419-429 SSH, 432-434 +Telnet, 432-434 +traceroute command, 428-432 unusual addresses within classes, 295 verifying on switch, 143-144 +VLSM, 275 + + +IPv6 (Internet Protocol Version 6). See also IP +abbreviating addresses, 531-532 address configuration summary, 576 +assigning subnets to internetwork topology, 549 +dual-stack strategies, 556 +dynamic unicast address configu-ration, 564 +expanding addresses, 532 global routing prefix, 543-544 +global unicast addresses, 542-550 +hexadecimal/binary conversion chart, 531 +history of, 524-525 interface ID, 547 +link-local addresses, 566-569 loopback addresses, 574 multicast addresses, 569-576 NDP, 573-574, 598-603 overview, 524 +prefix length, 533-536 protocols, 526-527 +representing full IPv6 addresses, 530 routing, 527-530, 583-598 +static unicast address configuration, 557-564 +subnets, 543 +global unicast addresses, 545-549 +router anycast addresses, 549 unique local addresses, 551-552 +unicast addresses, 556 +unique local addresses, 542, 551-553 unknown addresses, 574 +ipv6 address command, 557, 560, 564-568, 576-578, 583 +ipv6 address dhcp command, 578 ipv6 address eui-64 command, 563 ipv6 address link-local command, 568 +ipv6 enable command, 568-569, 576-578 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +774 ipv6 route command + + +ipv6 route command, 586-597, 604 ipv6 unicast-routing command, 558, 578 +IS-IS (Integrated Intermediate System to Intermediate System), 446 +ISL (Inter-Switch Link), 182 +ISO (International Organization for Standardization), 17 +IV (Initialization Vectors), 661 + +J - K + +keys +forward secrecy, 663 mixing algorithm, 661 PKIs, 660 +shared-key security, 657 TKIP, 660-661 +WEP, 657 +kHz (kilohertz), 625 kilohertz (kHz), 625 +known unicast frames, forwarding, 110-113 + +L + +LACP (Link Aggregation Control Protocol), 250 +LAG (link aggregation group), 673 +LAN (Local-Area Networks). See also subnets +addresses, 52 definition of, 179 +DP on each segment, choosing, 222-223 enterprise LAN, 36-37 +Ethernet LAN, 32-46, 49-56 enterprise networks, 350 LAN switching, 106-124 +switch interface configuration, 152-162 +troubleshooting, 162-168 +hubs, 54-56, 161-162 + +LAN switching, 106-124 neighbors, testing, 425-426 redundancy, 210, 214 +STP security exposures, 236 switching, 35 +analyzing, 116 flooding, 114 +interface configuration, 152-162 +MAC address table, 113-114, 117-124 +overview, 106-109 STP, 114-115 summary, 115-116 +switch forwarding and filtering decisions, 110-113 +switch interfaces, 118-120, 152-162 +switching logic, 109-110 verifying, 116 +VLAN +AP, 668 +configuration, 185-195, 198-199 Data VLAN, 197-199 +default VLAN, 186 disabled VLAN, 201-202 IP telephony, 196-200 native VLAN, 183, 205 overview, 179-180 routing, 183-184 +supported VLAN list on trunks, 203-205 +tagging, 181-182 troubleshooting, 201-205 trunking, 180-182, 189-195 undefined VLAN, 201-202 VLAN ID, 180 +Voice VLAN, 197-199 VTP, 189-190 +WLAN, 32 +802.11 WLAN, 614 +advanced settings, 684-685 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +LSDB (Link-State Database) 775 + + +AP, 668-669 BSS, 614-616 +client session timeouts, 684 configuration, 675-678, 681-685 controller configuration, 685 creating, 679-681 +creating too many, 676 defined, 675 displaying list of, 679 DS, 616-618 +ESS, 618 IBSS, 619 limiting, 676 +management access, 685 mesh networks, 622 outdoor bridges, 621-622 QoS, 683-684 +repeaters, 620-621 security, 681-684 topologies, 614-622 WGBs, 621 +WLCs, 669-675 +LAP (Lightweight Access Points), 639-642 +last usable IP addresses, deriving, 293-294 +late collisions, 167 +Layer 1 problems, troubleshooting, 166-168 +Layer 2 switches, 141, 183 Layer 3 EtherChannel, 392 +Layer 3 (multilayer) switches, 141, 184 routed ports, 406-414 +SVI, 401-406 +LEAP (Lightweight EAP), 659 learning state, interfaces, 227 +leased-line WAN (Wide Area Networks), 61-65 +lightweight AP (Access Points), 638 line aux 0 command, 362 +line con 0 command, 130-131 + +line console 0 command, 97-98, 103, 147, 356 +line vty command, 132, 147 +link-local addresses (IPv6), 566-569 link-local next-hop address, 589-590 link-state protocols, 446 +list of subnets building, 283-284 +IPv6 subnets, 548-549 listening state, interfaces, 227 load balancing +clients, 642 OSPF, 494 +load distribution, EtherChannel, 253-257 +Local mode (AP), 647 local routes, 378, 583-586 +local scope multicast addresses, 569-573 +logging console command, 145, 148 +logging synchronous command, 145, 148 +logical networks, user segregation, 676 +login command, 94, 103, 130-132, 147 +login local command, 147 loopback address, 295, 574 looping frames, 213-215 +loops, avoiding with STP, 114-115 +LSA (Link-State Advertisements), 449, 454 +flooding, 450 +LSDB relationship, 450 network LSA, 464 OSPF, 454-456, 459-464 router LSAs, 463 +LSDB (Link-State Database) area design, 461-462 +best routes, finding, 451 LSA relationship, 450 +OSPF/LSDB neighbor exchanges, 454-456 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +776 LSU (Link-State Update) packets + + +LSU (Link-State Update) packets, 454 +LWAPP (Lightweight Access Point Protocol), 639 + +M + +MAC address tables, 111 aging, 121-122 +clearing, 122 +finding entries in, 120-121 instability, 214-215 multiple switches, 123-124 overview, 113-114 showing, 117-118 +mac-address command, 564 MAC addresses, 50-52 +burned-in, 218 +sender MAC addresses, 661 source MAC addresses, 113 +split-MAC architectures, 638-642 macrobending, 163 +magic number, 334 +magnetic waves, traveling, 624 man-in-the-middle attacks, 654 +management access (WLAN), allowing, 685 +management interfaces (controllers), 674 +management IP addresses, autonomous AP, 635 +manual Layer 2 EtherChannels, 248-250 +mapping VLAN, 673 MaxAge timer (STP), 225 +maximum-paths command, 494-496 memory, 99-100 +Meraki, 636-637 mesh networks, 622 messages +Hello, 219 +Hello BPDU, 218, 225 + +inferior Hello, 219 integrity, 656, 660-661 OSPF Hello, 452 privacy, 655, 660-661 RSTP, 232 +sending, 623-624 superior Hello, 219 +metrics (costs) EIGRP, 446 IGP, 446-447 OSPF, 491-493 ports, 247 +IEEE default, 223 STP, 221 +RIPv2, 446-447 +MHz (Megahertz), 625 +MIC (Message Integrity Checks), 656, 660-661 +Mobility Express WLC deployments, 645 +models, networking OSI, 17, 28-30 TCP/IP, 16-29 +modified EUI-64 (Extended Unique Identifier-64), 560-564 +Monitor mode (AP), 647 +MP BGP-4 (Multiprotocol BGP version 4), 529 +MSCHAPv2 (Microsoft Challenge Authentication Protocol version 2), 660 +MSTP (Multiple Spanning Tree Protocol), 242-243 +MTU (Maximum Transmission Units), 50, 515 +multiarea OSPF (Open Shortest Path First), 482 +multicast addresses, 50-52, 290, 569-576 +multilayer switches, 141, 184, 401-414 +multimode fiber-optic cables, 47-49 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +NIM (Network Interface Modules) 777 + + +N + +NA (Neighbor Advertisement), 599 name command, 185, 207 +NAT (Network Address Translation), 277, 542 +native VLAN (Virtual Local-Area Networks), 183, 205, 398 +NDP (Neighbor Discovery Protocol), 526, 573-574, 598-603 +ndp -an command, 600 neighbors +adjacent neighbors, 457 +fully adjacent neighbors, 457, 502 link addresses, discovering, 598-600 NA, 599 +NS, 599 OSPF, 451 +broadcast network type, 502-506 LSA exchanges, 454-456 +LSDB exchanges, 454-456 requirements, 508-510 RID, 452 +states, 453, 457 +troubleshooting adjacencies, 510-516 +testing, 425-426 +netsh interface ipv6 show neighbors command, 600 +network command, 473-475, 480-486, 495, 511 +network ID. See network numbers network layer, 22-25 +ARP, 77 DNS, 76-77 +protocols, identifying with Ethernet Type field, 52 +routing +LAN/WAN, 70-72 logic, 68-70 +testing connectivity, 78 + + +network numbers, 293-295 network types (OSPF) +broadcast, 500-506 +point-to-point, 500-501, 506-508 +troubleshooting mismatched network types, 515-516 +networks architectures, 16 blueprint, 16 +broadcast addresses, 293-295 classful IP networks, 289-297 classful networks, 276-278 definition of, 268 +diagrams, 15, 26 +end-user perspectives, 14-15 enterprise networks, 15, 268, 350-352 internetworks, 268 +IP networks, 70-73, 292, 302, 312 logical networks, user segregation, 676 LSA, 464 +masks, 376 mesh, 622 NAT, 277 +networking model overview, 16 OSI, 17, 28-30 +overview, 12-14 +private IP networks, 277-278 public IP networks, 276-278 routes, 379 +SOHO networks, 15 subnets versus, 324 TCP/IP, 16-29 VLAN switches, 140 WAN, 60 +Ethernet WAN, 65-68 leased-line WAN, 61-65 +wireless networks, 628-629, 662-663 next-hop IPv6 addresses, 589-590 NIC addresses, 52 +NIM (Network Interface Modules), 352 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +778 no debug all command + + +no debug all command, 104 +no description command, 157, 170 no duplex command, 157, 170 +no ip address command, Layer 3 Ether-Channels, 412 +no ip domain-lookup command, 146 no logging console command, 145, 148 +no network network-id area area-id subcommands, 483 +no passive-interface command, 487, 496 +no password command, 134 +no shutdown command, 142, 155-157, 170, 207, 253, 356, 363, 399, +403-405 +[no] shutdown vlan number command, 201 +no speed command, 157, 170 +no switchport command, 408, 411-415 nonoverlapping channels, 628 +nonworking states, troubleshooting, 162-163 +NS (Neighbor Solicitation), 599 numbers +DDN, 24 +magic number, 334 SEQ, 21 +subnet numbers, 272, 283, 324, 327, 334-336 +NVRAM (nonvolatile RAM), 100 + +O + +one-size subnets, 273-274 open authentication, 656 +operational view of subnetting, 267-268 +optical transmitters (fiber-optic cable), 47 +OSI (Open Systems Interconnection), 17, 28-30 + +OSPF (Open Shortest Path First), 450 2-way state, 453-454, 457 +area design, 459-462 backbone areas, 460 +broadcast network type, 500-506 +calculating best routes with SPF, 457-459 +configuration, 472, 479-481 default routes, 489-491 Dijkstra SPF algorithm, 451 DR, 456-457 +Ethernet links, 456-457 Hello/dead timers, 512-513 Hello messages, 452 interfaces, 493 +load balancing, 494 LSAs, 450, 459-464 +metrics, 446-447, 491-493 mismatched network types, 515-516 MTU mismatched settings, 515 multiarea OSPF, 482 +neighbors, 451 +broadcast network type, 502-506 LSA exchanges, 454-456 +LSDB exchanges, 454-456 requirements, 508-510 RIDs, 452 +states, 453, 457 +troubleshooting adjacencies, 510-516 +passive interfaces, 487-488 +point-to-point network type, 500-501, 506-508 +process-id, 472 +processes, shutting down, 513-514 RID, 480-481, 511 +verifying +configuration, 479-480 +operation, 475-478 + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +ports 779 + + +OSPFv2 (OSPF version 2), 440, 463 interface configuration, 483-486 load balancing, 494 +metrics, 493 +single-area configuration, 470-475 OSPFv3 (OSPF version 3), 526, 529 outdoor bridges, 621-622 +outgoing interfaces, IPv6 static routes with, 587-588 + +P + +PAC (Protected Access Credentials), 659 +packets, 28 +data packets, routing VLAN, 184 IP packets +de-encapsulating, 373-374 encapsulating in new frames, 375 forwarding, 68-75, 374-375 +hot forwarding to default routers (gateways), 372 +output errors, 167 +PAgP (Port Aggregation Protocol), 250 passing through (communications), 615 +passive-interface command, 487, 496, 517 +passive-interface default command, 488 +password command, 97, 103, 130-132, 147 +password faith command, 94 passwords +CLI, 93-94, 130-135 console passwords, 129 enable passwords, 130 shared passwords, 130 Telnet passwords, 129 +path selection, 69, 442 +PBX (Private Branch Exchange), 196 +PDU (Protocol Data Units), 30 + +PEAP (Protected EAP), 659 permanent keywords, 385 personal mode (WPA), 663 +physical console connections, 88-90 +physical interfaces, configuration, 251-253 +physical layer (TCP/IP), 25-26 ping command, 78, 419-429, 587 pinouts (cables) +10BASE-T, 42-45 100BASE-T, 42-45 1000BASE-T, 45-46 rollover pinouts, 89 +pins (connectors), 40 +PKIs (Public Key Infrastructures), 660 +point-to-multipoint outdoor bridges, 622 +point-to-point (Ethernet), 56 point-to-point edge ports, 233 +point-to-point lines. See leased-line WAN +point-to-point network type (OSPF), 500-501, 506-508 +point-to-point outdoor bridges, 622 point-to-point ports, 233 +policies, WLAN client exclusion, 684 Port Aggregation Protocol. See PAgP +port-channel load-balance method command, 254 +PortChannels. See EtherChannel PortFast, 235 +ports, 87 +802.1w RSTP roles, 230 alternate, 229-232 backup, 230 +blocking, choosing, 212 console ports, 672 controllers, 672-673 costs, 247 +IEEE default, 223 +STP, 221 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +780 ports + + +disabled ports, 230 +distribution system ports, 672-673 DP, 217, 222-223, 230 +Ethernet ports, 40 interfaces, compared, 671 redundancy ports, 672 +RJ-45, 40 +routed ports, VLAN routing, 406-414 router auxiliary ports, 362 +RP, 217, 220, 230 RSTP +backup, 233 roles, 230 +service ports, 672-674 states, 232 +switch ports, 110 +switch roots, choosing, 220-221 USB ports, 89 +WLC ports, 672-673 +postal service forwarding, 22 +predictability in interesting octet, 333-334 +prefixes +IP addresses, 292, 302 defined, 309-310 +dividing into network and subnet parts, 312 +host part and, 311 length of, 533-536 +masks, 305-309 routing, 378 +primary root switches, 247 priority, switches, 245-246 privacy +CCMP, 661 data, 655 GCMP, 661 TKIP, 660-661 +private addresses (IPv4), 542 private branch exchange. See PBX +private IP networks, 277-278 + + +private lines. See leased-line WAN privileged EXEC mode, 91-93 +problem isolation, traceroute command, 429-431 +process-ids (OSPF), 472 proprietary routing protocols, 446 +protected access credentials. See PAC protocols +BGP, 445 BPDU, 218, 225 CAPWAP, 639 CCMP, 661 definition of, 16 +distance vector, 446 DTP, 203 +EAP, 657-658 EAP-FAST, 659 EAP-TLS, 660 GCMP, 661 IGRP, 446 LACP, 250 LEAP, 659 +link-state, 446 LWAPP, 639 MSTP, 242-243 NDP, 573-574 OSPF, 450 +2-way state, 453-454, 457 area design, 459-462 backbone areas, 460 +broadcast network type, 500-506 +calculating best routes with SPF, 457-459 +configuration, 472, 479-481 default routes, 489-491 Dijkstra SPF algorithm, 451 DR, 456-457 +Ethernet links, 456-457 Hello/dead timers, 512-513 Hello messages, 452 +interfaces, 493 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +protocols 781 + + +load balancing, 494 LSAs, 450, 459-464 +metrics, 446-447, 491-493 +mismatched network types, 515-516 +MTU mismatched settings, 515 multiarea OSPF, 482 neighbors, 451-457, 502-516 passive interfaces, 487-488 +point-to-point network type, 500-501, 506-508 +process-id, 472 +processes, shutting down, 513-514 +RID, 480-481, 511 +verifying operation, 475-478 OSPFv2, 440, 463 +interface configuration, 483-486 load balancing, 494 +metrics, 493 +single-area configuration, 470-475 +OSPFv3, 526, 529 PAgP, 250 +PEAP, 659 PVST+, 242-243 RIP, 446 +routable protocols, 442 routed protocols, 442 +routing protocols, 376-378, 442-449 RPVST+, 242-243, 246 +RSTP, 228, 242-243 alternate ports, 230-232 backup port role, 233 BID, 218 +BPDU, 218, 225 +configurable priority values, 244 configuration, 240 +discarding state, 229 +forwarding or blocking criteria, 216-217 + +LAN segment DP, 222-223 link types, 233 +looping frames, preventing, 213 +multiple spanning tree support, 246 +need for, 213-215 ports, 212, 230-233 processes, 232 purpose of, 215-217 root switches, 218, 247 STA, 216 +standards, 228 +steady-state operation, 225 STP, compared, 229-230 switches, 219-221, 247 topology influences, 223-225 +STA, 216 STP, 114-115 +802.1D standard, 228 BID, 218-219, 243-244 BPDU, 218, 225 +configurable priority values, 244 configuration, 240, 243-244 convergence, 216 EtherChannels, 234, 247-251 Forward delay timer, 225 +forwarding or blocking criteria, 216-217 +Hello timer, 225 +interface states, changing, 227 LAN redundancy, 210, 214 LAN segment DP, 222-223 looping frames, 213 +MaxAge timer, 225 modes, 242 multiple STP, 241 need for, 213-215 PortFast, 235 +ports, 212, 221, 232 purpose of, 215-217 +roles, 227 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +782 protocols + + +root switches, 218-219 RSTP, 229-230 security, 236 +STA, 216 standards, 242 states, 227 +steady-state operation, 225 +switch reactions to changes, 226-227 +switch RP, 220-221 +system ID extensions, 243-244 timers, 226-227 +topology influences, 223-225 TCP, 20-21 +TCP/IP +application layer, 19-20 compared to OSI, 29 +data encapsulation terminology, 27-28 +data-link layer, 25-26 history of, 16-17 HTTP, 19-20 +IPv4, 22-25, 68-78, 140-144 +network layer, 22-25, 68-72, 76-78 +overview, 18 physical layer, 25-26 RFC, 18 +transport layer, 20-22 TKIP, 660-661 +public addresses (IPv4), 542 public IP networks, 276-278 +Public Key Infrastructures. See PKIs +PVST+ (Per VLAN Spanning Tree), 242-243 + +Q - R + +QoS (Quality of Service), WLAN, 683-684 +quit command, 104 + +RA (Router Advertisement), 600 radio frequencies. See RF radios, selecting WLAN, 680 RADIUS servers +configuration, 676 +WLAN authentication, 682 +RAM (Random Access Memory), 99 +ranges for global unicast addresses, 544-545 +RC4 cipher algorithm, 657 receivers, communication, 613 redundancy +LAN, 210, 214 management, 674 ports, 672 +reference bandwidth, defined, 492 +registered private IP networks, 277-278 +registered public IP networks, 276-278 +reload command, 91-92, 102-104, 117, 402-404 +remote subnets, 375 repeaters, 620-621 replies +ARP replies, 77 HTTP, 20 +ICMP echo replies, 78 requests +ARP requests, 77 +ICMP echo requests, 78 +reserved multicast addresses, 569-571 resident subnets, 322 +reverse routes, testing, 423-425 +RF (Radio Frequencies), 613, 626, 642 RID (Router ID) +defined, 470 OSPF, 511 +neighbors, 452 +RID configuration, 480-481 +troubleshooting, 511 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +routers/routing 783 + + +RIP (Routing Information Protocol), 446 RIPng (RIP next generation), 529 +RIPv2 (Routing Information Protocol version 2), 446-447 +RIR (Regional Internet Registries), 524 RJ-45 connectors, 41 +RJ-45 ports, 40 roaming +AP, 618 clients, 642 +ROAS (Router-On-A-Stick), 392, 396-401 +Rogue Detector mode (AP), 647 roles +alternate ports, 230-232 ports, 230, 233 +RSTP port, 230 STP, 227 +rollover pinouts (cables), 89 ROM (Read-Only Memory), 100 root bridge ID, 218 +root costs, switches, 216 root ports. See RP +root switches, 217 electing, 218-219 +RSTP root switches, 247 timer values, 218 +routable protocols, 442 route redistribution, 448 +routed ports, VLAN routing, 406 EtherChannels, 410-414 +routed interfaces, 407-409 routed protocols, 442 +router-id command, 470, 496 router ospf command, 470, 495 router ospf 1 command, 472, 480 +router ospf process-id command, 480, 510 +routers/routing, 35 ABR, 460-461 +ARP tables, 378-379 + +auxiliary ports, 362 backbone, 461 +best routes, finding, 451 candidate default routes, 384 +Cisco integrated services routers, 352 classful versus classless, 313 +CLI, 355-356 +connected routes, 366, 376-378 default routers, 70, 370-372 default routes, 379, 383-384 discovering with NDP, 600-601 DR, 456-457 +DROthers, 457 +dynamic unicast address configu-ration, 564 +enterprise routers, 350-353 floating static routes, 381-383 flooding, 450 +host routes, 378-379 logic, 370 +static host routes, 381 installation, 350-354 interfaces, 356-361 internal routers, 461 +IP routing, 366, 369 +ARP tables, 378-379 +de-encapsulating IP packets, 373-374 +encapsulating IP packets in new frames, 375 +example of, 371-376 forwarding, 374-375, 386-389 +host forwarding of IP packets to default routers (gateways), 372 +IPv4 routing, 24-25, 68-75, 355-362, 369-371, 527 +IPv6 routing, 527-530, 558, 583-598 +processing incoming frames, 373 +tables, 388-389 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +784 routers/routing + + +transmitting frames, 376 troubleshooting, 419-434 +link-local address configuration, 566-569 +local routes, 378 logic +host routing, 370 IPv4 routing, 371 +LSA, 463 +network masks, 378 network routes, 379 OSPF interface costs, 493 overview, 348 +path selection, 69 prefixes, 378 protocol codes, 378 protocols, 376 +administrative distance, 448-449 algorithms, 445 +AS, 444 +classful versus classless, 313 classless/classful, 447-448 convergence, 443 +defined, 442 distance vector, 446 EGP, 444 +EIGRP, 446 functions, 443 IGP, 444-448 link-state, 446 +OSPF, 446-447, 450-464, 475-482, 487-491 +path selections, 442 proprietary, 446 RIPv2, 446-447 +route redistribution, 448 remote subnets, 375 +reverse routes, testing, 423-425 ROAS +configuration, 396-398 +subinterfaces, 399-401 + +troubleshooting, 400-401 verifying, 398-400 +SOHO routers, 354 +static unicast address configuration, 557-564 +static routes, 367, 376 configuration, 379-384 default routes, 379 +floating static routes, 381-383 host routes, 379-381 +static default routes, 383-384 static network routes, 379 troubleshooting, 385-386 +subnet router anycast addresses, 576 VLAN routing, 183-184, 395 +Layer 3 (multilayer) switch routed ports, 406-414 +Layer 3 (multilayer) switch SVI, 401-406 +ROAS, 396-401 WAN, 64-65 +RP (Root Ports), 217, 220-221, 230 +RPVST+ (Rapid Per VLAN Spanning Tree+), 242-243, 246 +RS (Router Solicitation), 600 +RSTP (Rapid Spanning Tree Protocol), 228, 242-243 +alternate ports, 230-232 backup port role, 233 BID, 218 +blocking criteria, 216-217 BPDU, 218, 225 +configurable priority values, 244 configuration, 240 +discarding state, 229 forwarding criteria, 216-217 LAN segment DP, 222-223 link types, 233 +looping frames, preventing, 213 multiple spanning tree support, 246 +need for, 213-215 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Shortest Path First algorithm 785 + + +ports, 233 blocking, 212 roles, 230 states, 232 +processes, 232 purpose of, 215-217 +root switches, 218, 247 STA, 216 +standards, 228 +steady-state operation, 225 STP, compared, 229-230 switches +electing, 219 priority, 247 +RP, choosing, 220-221 topology influences, 223-225 +running-config file, 100 runts, 167 + +S + +S0/0/0 status code, 359 same-layer interaction, 21-22 +scopes of multicast addresses, 571-572 +sdm prefer command, 402-404 +sdm prefer lanbase-routing command, 402, 415 +SE Connect mode (APs), 647 secondary root switches, 247 Secure Shell. See SSH +security. See also authentication attacks, 654 +CLI, 93-94, 128-139 data integrity, 656 data privacy, 655 decryption, 655 encryption, 655 fake AP, 654 +forward secrecy, 663 + +intrusion protection, 642 MIC, 656 +privacy/integrity methods, 660-661 shared-key, 657 +STP, 236 +transmissions reaching unintended recipients, 652 +WLAN, 681-684 +WLC authentication, 642 WPA, 662-663 +WPA2, 662-663 WPA3, 662-663 +self-healing coverage, 642 sender MAC addresses, 661 SEQ (Sequence Numbers), 21 sequence counters (TKIP), 661 sequence numbers (SEQ), 21 serial lines. See leased-line WAN +Serial WAN (Wide Area Networks), 350 +servers +AAA servers, 136 AS, 658 +external authentication servers, 135-136 RADIUS, 676, 682 +Telnet servers, 91 service ports, 672-674 +service set identifiers. See SSID session timeouts (WLAN), 684 +SFP (Small Form Pluggable), 42, 48 +SFP+ (Small Form Pluggable Plus), 42, 48 +shared-key security, 657 shared media (Ethernet), 56 shared passwords, 130 shared ports, 234 +shorter VLAN configuration example, 189 +Shortest Path First algorithm. See SPF algorithm + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +786 show arp command + + +show arp command, 391 +show command, 95, 166, 361, 480, 508 +show crypto key mypubkey rsa command, 149 +show dhcp lease command, 143-144, 149 +show etherchannel 1 summary command, 250 +show etherchannel command, 248, 259, 416 +show etherchannel summary command, 413 +show history command, 145, 149 +show interfaces command, 119-120, 156, 162-164, 167-170, 357-358, 361, 364, 376, 408, 416, 515-517, 583 +show interfaces description command, 162, 170 +show interfaces interface-id trunk command, 203-205 +show interfaces status command, 118, 125, 153, 156, 162-165 +Layer 3 EtherChannels, 412 routed ports, 408 +show interfaces switchport command, 192-195, 199, 202-203, 208 +show interfaces trunk command, +193-194, 199-200, 203-205, 208, 401 +show interfaces type number switchport command, 199 +show interfaces type number trunk command, 200 +show interfaces vlan command, 143-144, 149, 416 +show ip arp command, 391 +show ip default-gateway command, 144, 149 +show ip interface brief command, 357-361, 364, 406 + +show ip ospf command, 481 defined, 496, 517 duplicate OSPF RID, 511 +OSPF neighbors, troubleshooting, 510 +show ip ospf database command, 450, 462, 475, 497 +show ip ospf interface brief command, 479-480, 488, 491, 503-505, 508, 511, 514 +defined, 496, 517 +OSPF neighbors, troubleshooting, 510 +show ip ospf interface command, 488, 503-505, 513 +defined, 496, 517 +Hello/dead timer mismatches, 512 OSPF neighbors, troubleshooting, 510 OSPFv2 interface configuration, 486 +show ip ospf interface G0/0 command, 505 +show ip ospf neighbor command, +452-453, 457, 475, 480, 497, 502, 505, 508-511, 513-517 +show ip ospf neighbor interface brief command, 513 +show ip protocols command defined, 496, 517 +OSPFv2 interface configuration, 485 show ip route address command, 388 +show ip route command, 324, 356, 367, 376, 378-391, 400-402, 408, 475-478, 585 +administrative distance, 449 defined, 497 +routing tables, displaying, 416 +show ip route [connected] command, 398 +show ip route EXEC command, 404 +show ip route ospf command, 387, 497 +show ip route static command, 380, 490 +show ip ssh command, 139, 149 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +source MAC addresses 787 + + +show ipv6 interface brief command, 558-560, 567, 575, 579 +show ipv6 interface command, 558-559, 567, 570-573, 579 +show ipv6 route command, 566, 579, 585-590, 605 +show ipv6 route connected command, 560, 586 +show ipv6 route local command, 585-586 +show ipv6 route static command, 587-590, 593-595 +show mac address-table aging-time command, 122, 125 +show mac address-table command, 120, 125, 356 +show mac address-table count command, 122, 125 +show mac address-table dynamic address command, 125 +show mac address-table dynamic command, 96, 117, 123-125, 170 +show mac address-table dynamic interface command, 120-121, 125 +show mac address-table dynamic vlan command, 125 +show mac address-table static command, 170 +show mac address-table vlan command, 121 +show protocols command, 361, 364 +show running-config | interface command, 170 +show running-config command, 93, 101, 104, 132-133, 143, 149, 155, 158, 170, 398, 479, 488, 511, 584 +show spanning-tree command, 249, 259 +show spanning-tree vlan command, 259 +show spanning-tree vlan vlan-id command, 204 +show ssh command, 139, 149 + +show startup-config command, 101, 104, 158 +show vlan brief command, 186-189, 202 +show vlan command, 201, 208, 398-401, 416 +show vlan id command, 187 +show vtp status command, 190, 208 +shutdown command, 143, 155, 163, 170, 207, 253, 356, 359, 363, 399-401, 405 +signals +sending messages, 623 waves, 623-627 +single-area OSPF, 459 +single-area OSPFv2, 470-475 +single-mode fiber-optic cables, 47-49 single-size subnets, 273-274 +SLAAC (Stateless Address Auto Con-figuration), 560, 598, 601 +slash masks, 305 +small office/home office (SOHO) LANs, 35 +small office/home office (SOHO) networks, 15 +SNA (Systems Network Architecture), 16 +Sniffer mode (APs), 647 software configuration +common command prompts, 98 configuration files, 99-102 configuration mode, 96-97 +configuration submodes and contexts, 97-99 +SOHO (Small Offices/Home Offices) LAN, 35 +networks, 15 routers, 354 +solicited-node multicast addresses, 573-574 +source MAC addresses, 113 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +788 spanning-tree algorithm + + +spanning-tree algorithm. See STA spanning-tree commands, 259 +spanning-tree mode command, 242-243, 259 +Spanning Tree Protocol. See STP spanning-tree vlan command, 244 +spanning-tree vlan x root primary command, 244-245 +spanning-tree vlan x root secondary command, 244-245 +speed, switch interface configurations, 152-154 +speed command, 98-99, 152-154, 165, 170, 355, 363 +SPF (Shortest Path First) algorithm Dijkstra SPF, 451 +OSPF best routes, calculating, 457-459 split-MAC architectures, 638-643 +SSH (Secure Shell), 91, 136-139, 432-434 +SSID (Service Set Identifiers), 615 broadcasting, 681 +multiple on one AP, supporting, 617 STA (spanning-tree algorithm), 216 startup-config file, 100 +state change reactions (STP topology), 224-225 +Stateless Address Auto Configuration. See SLAAC +states discarding, 230 +interfaces, 215-217, 227 ports, 232 +STP, 227 +static default routes (IPv6), 592-593 static host routes (IPv6), 593 +static ranges per subnet, choosing, 286-287 +static routes, 367, 376 configuration, 379-384 +default routes, 379 + +floating static routes, 381-383, 593-595 +global unicast next-hop address, 589 host routes, 379-381 +link-local next-hop address, 589-590 outgoing interface, 587-588 +over Ethernet links, 591 overview, 586 +static default routes, 383-384, 592-593 static host routes, 593 +static network routes, 379 troubleshooting, 385-386, 595-598 +static unicast address configuration (IPv6) +configuration full 128-bit address, 557-558 +enabling IPv6 routing, 558 +generating unique interface ID with modified EUI-64, 560-564 +verifying, 558-560 status codes +routers, 358-359 troubleshooting, 162-163 +STP (Spanning Tree Protocol), 114-115, 210, 243 +802.1D standard, 228 BID, 218-219, 243-244 +blocking criteria, 212, 216-217 BPDU, 218, 225 +configurable priority values, 244 configuration, 240, 243-244 convergence, 216 EtherChannels, 234, 247-251 Forward delay timer, 225 forwarding criteria, 216-217 Hello timer, 225 +interface states, changing, 227 LAN +redundancy, 210, 214 +segment DPs, choosing, 222-223 + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +subnets 789 + + +looping frames, preventing, 213 MaxAge timer, 225 +modes, 242 multiple STP, 241 need for, 213-215 PortFast, 235 ports +blocking criteria, 212, 216-217 cost, 221 +states, 232 purpose of, 215-217 roles, 227 +root switches, electing, 218-219 RSTP, compared, 229-230 security, 236 +STA, 216 standards, 242 states, 227 +steady-state operation, 225 +switch reactions to changes, 226-227 switch RP, choosing, 220-221 system ID extensions, 243-244 timers, 226-227 +topology influences, 223-225 straight-through cable pinouts, 42-45 subcommands, 97 +auto-cost reference-bandwidth, 493 bandwidth, 492 +ip address, 376 +no network network-id area area-id, 483 +switchport trunk allowed vlan, 204 subdivided networks. See subnets subinterfaces, 396-401 +subnet masks, 272, 302. See also subnets +classful IP networks before subnetting, 279-280 +converting between formats, 305-309 +difficult masks, 334-338 + +easy masks, 332 formats for, 304-305 hosts +borrowing bits to create subnet bits, 280-281 +calculating in network, 313-315 choosing bits, 281 +mask formats, 282-283 prefix part, 309-312 sample design, 282 VLSM, 275 +subnet numbers, 272, 283, 334-336 subnets, 543. See also subnet masks +addresses, 272, 283, 324, 327, 334-336 +analyzing +subnet needs, 269, 271 +with decimal math, 332, 339 assigning to different locations, 285 binary math, 326 +Boolean math, 331 +finding range of addresses, 331 finding subnet IDs, 327 practice problems, 328-329 shortcut for binary process, 330 +Boolean math, 331 +broadcasts, 272, 283, 325-327, 336-338 +building list of, 283-284 calculating, 313-315 decimal math, 331 +difficult masks, 334-338 easy masks, 332 +finding subnet broadcast addresses, 336-338 +predictability in interesting octet, 333-334 +reference table: DDN mask values and binary equivalent, 339 +definition of, 267, 322 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +790 subnets + + +design choices, 276-284 design views, 267-268 +dynamic ranges, choosing, 286-287 examples of +networks with four subnets, 322-323 +simple example, 267 hosts, 268-271 +ID, 272, 283, 324, 330 +finding with binary math, 327 +finding with decimal math, 334-336 +IPv4, 548 IPv6, 548 +IP addresses, 283-284, 302, 312 IPv4, 70, 73, 545 +IPv6 +assigning to internetwork topology, 549 +interface ID, 547 listing, 548-549 +with global unicast addresses, 545-549 +with unique local addresses, 551-552 +multiple subnet sizes, 274 networks versus, 324 number of hosts, 271 number of subnets, 270 one-size subnets, 273 operational view, 267-268 overview, 266 +plan documents, 267 +planning implementations, 284-287 range of usable addresses, 325 remote subnets, 375 +resident subnets, 322 +router anycast addresses, 549, 576 simple example, 267 +single-size subnets, 273 +size of, 272-274 + +static ranges, choosing, 286-287 +subnet numbers, 272, 283, 324, 327, 334-336 +VLSM, 275 +superior Hello messages, 219 supplicants, 658 +SVI (Switched Virtual Interfaces), 392, 401-406 +switch ports, 110 switches +access switches, 241 alternate ports, 229 auto-mdix, 45 backup ports, 230 BID, 218, 243-244 BPDU, 218, 225 +Cisco Catalyst switches, 86 configuration files, 99-102 DHCP, 143 +distribution switches, 241 EtherChannels, 234 Ethernet switches, 48 filtering decisions, 110-113 +forwarding decisions, 110-113 history buffer commands, 144-145 interfaces, 87, 110, 118-120 +autonegotiation, 158-162 description, 152-154 duplex, 152-154, 163-166 +enabling/disabling interfaces, 155-156 +Layer 1 problems, 166-168 multiple interfaces, 154-155 overview, 152 +removing configuration, 157-158 speed, 152-154, 163-166 +status codes, 162-163 troubleshooting, 162-168 +IPv4, 140-144 +LAN segment DP, choosing, 222-223 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +tables 791 + + +LAN switches, 35 analyzing, 116 flooding, 114 +interface configuration, 152-162 +MAC address table, 113-114, 117-124 +overview, 106-109 STP, 114-115 summary, 115-116 +switch forwarding and filtering decisions, 110-113 +switch interfaces, 118-120, 152-162 +switching logic, 109-110 verifying, 116 +Layer 2 switches, 141, 183 +Layer 3 (multilayer) switches, 141, 184, 401-414 +links, 233 +MAC address tables, 111, 214-215 management +DHCP, 143 +history buffer commands, 144-145 +IPv4, 140-144 overview, 126 security, 128-139 +multilayer switches, 184 PortFast, 235 +ports, 87, 230-233 priority, 245-246 root costs, 216 +root switches, 217-219, 247 RP, choosing, 220-221 RSTP switch priority, 247 security, 128-139 +STP +reacting to changes, 226-227 topology influences, 223-225 +system ID extensions, 245-246 +unknown unicast frames, 114 + +VLAN configuration, 140 voice switches, 196 +switching tables. See MAC address tables +switchport access vlan command, 185-189, 198-199, 207 +switchport command Layer 3 switches, 415 routed ports, 408 +switchport mode access command, 185, 188, 198-199 +switchport mode command, 191, 207 +switchport mode dynamic auto command, 202 +switchport mode dynamic desirable command, 193 +switchport mode trunk command, 191, 203, 396 +switchport nonegotiate command, 195, 203, 207 +switchport trunk allowed vlan command, 204, 207 +switchport trunk encapsulation command, 191, 207 +switchport trunk native vlan command, 207 +switchport trunk native vlan vlan-id command, 205 +switchport voice vlan command, 198-199, 207 +switchport voice vlan vlan-id command, 200 +system ID extensions, 243-246 + +T + +T1. See leased-line WAN tables +ARP tables, 77, 378-379 +IP routing tables, 70-72, 388-389 +MAC address tables, 111-124, 214-215 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +792 tagging (VLAN) + + +tagging (VLAN), 181-182 +TCP (Transmission Control Protocol), 20-21 +TCP/IP (Transmission Control Protocol/Internet Protocol) +application layer, 19-20 +data encapsulation terminology, 27-28 data-link layer, 25-26 +history of, 16-17 HTTP, 19-20 +IPv4, 22-25, 68-78, 140-144 network layer, 22-25 +ARP, 77 DNS, 76-77 +routing, 68-72 +testing connectivity, 78 OSI, compared, 29 overview, 18 +physical layer, 25-26 RFC, 18 +transport layer, 20-22 Telnet, 90-91, 129, 432-434 +terminal history size command, 145, 149 +test etherchannel load-balance EXEC command, 255 +testing +IPv4 connectivity, 78 LAN neighbors, 425-426 reverse routes, 423-425 WAN neighbors, 427 +three-area OSPF (Open Shortest Path First), 460 +time stamps, 661 timers +Hello/dead mismatches, trouble-shooting, 512-513 +Hello messages, 455 STP, 226-227 +TKIP (Temporal Key Integrity Protocol), 660-661 + +topologies +AP noninfrastructure modes, 620-622 STP, 223-225 +WLAN, 614-622 +traceroute command, 428-432, 587 traffic flows, BSS, 615 +trailer fields (Ethernet), 50 transmissions +bidirectional communication, 613 interference, 613 +unidirectional communication, 613 unintended recipients, 652 +transmitters, communication, 613 transmitting +frames, IP routing, 376 optimizing transmit power, 642 +transport input all command, 139 +transport input command, 138, 148, 356 +transport input none command, 139 transport input ssh command, 139 +transport input telnet ssh command, 139 +transport layer (TCP/IP), 20-22 troubleshooting +EtherChannels, 251-253 Ethernet LAN, 166-168 Hello/dead timers, 512-513 interfaces, 162-168 +IP routing +ping command, 419-429 SSH, 432-434 +Telnet, 432-434 +traceroute command, 428-432 Layer 3 EtherChannels, 413-414 +Layer 3 (multilayer) switch SVI, 404-406 +native VLAN, 205 +neighbor adjacencies, 510-516 +OSPF + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +uWGB (Universal Workgroup Bridges) 793 + + +mismatched MTU settings, 515 +mismatched network types, 515-516 +neighbor adjacencies, 510-516 +shutting down processes, 513-514 +ping command, 419-429, 587 RID, 511 +ROAS, 400-401 SSH, 432-434 +static IPv6 routes, 595-598 static routes, 385-386 Telnet, 432-434 +traceroute command, 428-432, 587 VLAN, 201-205 +trunking 802.1Q, 182 +administrative mode, 191 configuration, 191-195 dynamic auto mode, 191 dynamic desirable mode, 191 ISL, 182 +overview, 180-181 type of, 191 VLAN +mismatched native VLAN, 205 +mismatched trunking operational states, 202-203 +supported VLAN list on trunks, 203-205 +tagging, 181-182 VTP, 189-190 +TTL (Time To Live), 429 +TTL Exceeded (Time-to-Live Exceeded), 429-431 +tunneling, CAPWAP, 639-640 +two-switch topology, 123-124 + +U + +UDP (User Datagram Protocol), 20 unabbreviated addresses (IPv6), 530 undebug all command, 104 +undefined VLAN, troubleshooting, 201-202 +unicast addresses, 50-52, 290, 322, 540, 556-564 +unidirectional communication, 613 +unified architectures. See centralized architectures +unique local addresses, 542, 551-553 universal addresses, 51 +unknown addresses (IPv6), 574 unknown unicast frames, 114 +URI (Universal Resource Identifiers), 20 +URL (Uniform Resource Locators), 20 USB ports, 89 +User Datagram Protocol (UDP), 20 user EXEC mode, 91-93 +user mode +external authentication servers, 135-136 +passwords, 130-135 usernames, 133-135, 147 +users, segregating into logical networks, 676 +UTP (Unshielded Twisted-Pair) cables, 37 +cabling pinouts, 42-49 overview, 39-40 +UTP Ethernet links, 40-41 +uWGB (Universal Workgroup Bridges), 621 + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +794 verifying + + +V + +verifying +Data VLAN, 198-199 +EtherChannel configuration before adding interfaces, 251-253 +Ethernet switching, 116 IPv4 on switch, 143-144 +Layer 3 (multilayer) switch SVI, 403-404 +OSPF +configuration, 479-480 operation, 475-478 +OSPFv2 interface configuration, 485-486 +ROAS, 398-400 +static unicast address configuration, 558-560 +Voice VLAN, 198-199 +virtual interfaces (controllers), 674 VLAN (Virtual Local Area Networks) +AP, 635, 668 +configuration, 185-195, 198-199 Data VLAN, 197-199 +default VLAN, 186 +disabled VLAN, troubleshooting, 201-202 +dynamic interface ID, 678 hopping, 205 +ID, 180 interfaces, 402 +IP telephony, 196-200 LAN trunking, 182 mapping, 673 +native VLAN, 183, 205, 398 overview, 179-180 +PVST+, 242-243 +routing, 183-184, 395-414 split-MAC architecture, 640 +supported VLAN list on trunks, 203-205 + + +switches, 140 tagging, 181-182 troubleshooting +disabled VLAN, 201-202 +supported VLAN list on trunks, 203-205 +trunking, 202-205 undefined VLAN, 201-202 +trunking, 180-182, 189-195 VLAN ID, 180 +Voice VLAN, 197-199 +vlan command, 185, 198, 207 vlan number command, 201 +VLSM (Variable Length Subnet Masks), 275 +voice switches, 196 +VTP (VLAN Trunking Protocol), 189-190 +vtp mode command, 207 vtp mode off command, 190 +vtp mode transparent command, 190 + +W - X - Y - Z + +WAN (Wide Area Networks), 32, 60 Ethernet WAN, 65-68 +enterprise networks, 350 +point-to-point network type (OSPF), 506-508 +leased-line WAN, 61-65 neighbors, testing, 427 +Serial WAN, enterprise networks, 350 waves +continuous pattern, 623 cycles, 625 electric/magnetic, 624 electromagnetic, 624 frequency, 625-627 +propagation with idealistic antenna, 624 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +write erase command 795 + + +WebAuth (Web Authentication), 657 WEP (Wired Equivalent Privacy), 657 WGB (Workgroup Bridges), 621 wildcard masks, 473-475 +wired LAN. See Ethernet, LAN wired networks, 612-613 wireless band frequencies, 627 wireless LAN, 32 +wireless networks +802.11 standard, 628-629 waves, 625 +wired networks, compared, 612-613 WPA, 662-663 +WPA2, 662-663 WPA3, 662-663 +WLAN (Wireless Local Area Networks) +802.11 WLAN, 614 advanced settings, 684-685 AP, 668-669 +BSS, 614-616 +client session timeouts, 684 configuration, 675 +advanced settings, 684-685 controller configuration, 685 dynamic interfaces, 678 QoS, 683-684 +RADIUS servers, 676 security, 681-682 +creating, 679-681 defined, 675 +DS, 616-618 +dynamic interfaces, creating, 678 ESS, 618 +IBSS, 619 limiting, 676 +listings of, displaying, 679 + +management access, allowing, 685 mesh networks, 622 +outdoor bridges, 621-622 QoS, 683-684 +RADIUS server, configuration, 676 repeaters, 620-621 +security, 681-684 +too many, creating, 676 topologies, 614-622 +user segregation into logical networks, 676 +WGB, 621 WLC, 669-675 +WLC (Wireless LAN Controllers) activities, 642 +centralized, 642-643 +cloud-based architectures, 643 dynamic interfaces, 674-675 embedded deployments, 644 interfaces, 673-675 +LAP, 639-640 +management interfaces, 674 +Mobility Express WLC deployments, 645 +ports, 672-673 +redundancy management, 674 service port interfaces, 674 virtual interfaces, 674 WLAN, 669-675 +working interfaces, defined, 217 +WPA (Wi-Fi Protected Access), 662-663 +WPA2 (Wi-Fi Protected Access version 2), 662-663 +WPA3 (Wi-Fi Protected Access version 3), 662-663 +write erase command, 104 + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + + +REGISTER YOUR PRODUCT at CiscoPress.com/register Access Additional Benefits and SAVE 35% on Your Next Purchase +• Download available product updates. +• Access bonus material when applicable. +• Receive exclusive offers on new editions and related products. (Just check the box to hear from us when setting up your account.) +• Get a coupon for 35% for your next purchase, valid for 30 days. +Your code will be available in your Cisco Press cart. (You will also find it in the Manage Codes section of your account page.) +Registration benefits vary by product. Benefits will be listed on your account page under Registered Products. + + +CiscoPress.com – Learning Solutions for Self-Paced Study, Enterprise, and the Classroom Cisco Press is the Cisco Systems authorized book publisher of Cisco networking technology, Cisco certification self-study, and Cisco Networking Academy Program materials. +At CiscoPress.com you can +• Shop our books, eBooks, software, and video training. +• Take advantage of our special offers and promotions (ciscopress.com/promotions). • Sign up for special offers and content newsletters (ciscopress.com/newsletters). +• Read free articles, exam profiles, and blogs by information technology experts. • Access thousands of free chapters and video lessons. +Connect with Cisco Press – Visit CiscoPress.com/community Learn about Cisco Press community events and programs. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX D + + + + +Practice for Chapter 12: Analyzing Classful IPv4 Networks + +Practice Problems +The practice problems in this appendix require that you determine a few basic facts about a network, given an IP address and an assumption that subnetting is not used in that network. To do so, refer to the processes described in Chapter 12 of CCNA 200-301 Official Cert Guide, Volume 1. + +NOTE You may also elect to do this same set of practice problems using the “Practice Exercise: Analyzing Classful IPv4 Networks” application on the companion website. + + +In particular, for the upcoming list of IP addresses, you should identify the following information: + +■ Class of the address +■ Number of octets in the network part of the address ■ Number of octets in the host part of the address +■ Network number +■ Network broadcast address + +Find all these facts for the following IP addresses: + +1. 10.55.44.3 2. 128.77.6.7 +3. 192.168.76.54 4. 190.190.190.190 5. 9.1.1.1 +6. 200.1.1.1 7. 201.1.77.5 8. 101.1.77.5 +9. 119.67.99.240 10. 219.240.66.98 + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Answers +The process to answer these problems is relatively basic, so this section reviews the overall process and then lists the answers to problems 1–10. + +The process starts by examining the first octet of the IP address: + +■ If the first octet of the IP address is a number between 1 and 126, inclusive, the address is a Class A address. +■ If the first octet of the IP address is a number between 128 and 191, inclusive, the address is a Class B address. +■ If the first octet of the IP address is a number between 192 and 223, inclusive, the address is a Class C address. + +When no subnetting is used: + +■ Class A addresses have one octet in the network part of the address and three octets in the host part. +■ Class B addresses have two octets each in the network and host part. +■ Class C addresses have three octets in the network part and one octet in the host part. + +After determining the class and the number of network octets, you can easily find the network number and network broadcast address. To find the network number, copy the network octets of the IP address and write down 0s for the host octets. To find the network broadcast address, copy the network octets of the IP address and write down 255s for the host octets. + +Table D-1 lists all ten problems and their respective answers. + +Table D-1 Answers to Problems + + +IP Address + + +10.55.44.3 128.77.6.7 192.168.76.54 190.190.190.190 9.1.1.1 +200.1.1.1 201.1.77.55 101.1.77.55 119.67.99.240 +219.240.66.98 + +Class Number of Number Network of Host Octets Octets +A 1 3 B 2 2 C 3 1 B 2 2 A 1 3 C 3 1 C 3 1 A 1 3 A 1 3 +C 3 1 + +Network Number + +10.0.0.0 128.77.0.0 192.168.76.0 190.190.0.0 9.0.0.0 200.1.1.0 201.1.77.0 101.0.0.0 119.0.0.0 +219.240.66.0 + +Network Broadcast Address +10.255.255.255 128.77.255.255 192.168.76.255 190.190.255.255 9.255.255.255 200.1.1.255 201.1.77.255 101.255.255.255 119.255.255.255 +219.240.66.255 + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX E + + + + +Practice for Chapter 13: Analyzing Subnet Masks + +This appendix begins with 23 mask conversion problems, followed by the matching answers and explanations. After that, the appendix lists 10 mask analysis problems, with the match-ing answers to follow. + +NOTE You may also perform this same set of practice problems using the “Analyzing Subnet Masks” and “Mask Conversion” applications on the companion website. + + +Mask Conversion Problems +The problems in this appendix require you to convert dotted-decimal subnet masks to pre-fix format and vice versa. To do so, feel free to use the processes described in Chapter 13 of CCNA 200-301 Official Cert Guide, Volume 1. + +Many people use the information in Table E-1 when converting masks. The table lists the nine dotted-decimal notation (DDN) mask values, the binary equivalent, and the number of binary 1s in the binary equivalent. + +Table E-1 Nine Possible Values in One Octet of a Subnet Mask + + +Binary Mask Octet +00000000 +10000000 +11000000 +11100000 +11110000 +11111000 +11111100 +11111110 +11111111 + +DDN Mask Octet +0 128 192 224 240 248 252 254 +255 + +Number of Binary 1s +0 1 2 3 4 5 6 7 +8 + + +Convert each DDN mask to prefix format and vice versa: + +1. 255.240.0.0 2. 255.255.192.0 +3. 255.255.255.224 4. 255.254.0.0. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +5. 255.255.248.0 6. /30 +7. /25 8. /11 9. /22 10. /24 +11. 255.0.0.0 12. /29 +13. /9 +14. 255.192.0.0 +15. 255.255.255.240 16. /26 +17. /13 +18. 255.255.254.0 19. 255.252.0.0 20. /20 +21. /16 +22. 255.255.224.0 23. 255.255.128.0 +Answers to Mask Conversion Problems Mask Conversion Problem 1: Answer +The answer is /12. + +The binary process for converting the mask from dotted-decimal format to prefix format is relatively simple. The only hard part is converting the dotted-decimal number to binary. For reference, the process is as follows: + +Step 1. Convert the dotted-decimal mask to binary. +Step 2. Count the number of binary 1s in the 32-bit binary mask; this is the value of the prefix notation mask. + +For problem 1, mask 255.240.0.0 converts to the following: + +11111111 11110000 00000000 00000000 + +You can see from the binary number that it contains 12 binary 1s, so the prefix format of the mask will be /12. + +You can find the same answer without converting decimal to binary if you have memorized the nine DDN mask values, and the corresponding number of binary 1s in each, as listed earlier in Table E-1. Follow these steps: + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix E: Practice for Chapter 13: Analyzing Subnet Masks 3 + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. Step 3. (2nd octet) Add 4 because the second mask octet of 240 includes four binary 1s. Step 4. The resulting prefix is /12. + +Mask Conversion Problem 2: Answer The answer is /18. + +For problem 2, mask 255.255.192.0 converts to the following: + +11111111 11111111 11000000 00000000 + +You can see from the binary number that it contains 18 binary 1s, so the prefix format of the mask will be /18. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 8 because the second mask octet of 255 includes eight bina-ry 1s. +Step 4. (3rd octet) Add 2 because the third mask octet of 192 includes two binary 1s. Step 5. The resulting prefix is /18. + +Mask Conversion Problem 3: Answer The answer is /27. +For problem 3, mask 255.255.255.224 converts to the following: E + +11111111 11111111 11111111 11100000 + +You can see from the binary number that it contains 27 binary 1s, so the prefix format of the mask will be /27. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 8 because the second mask octet of 255 includes eight binary 1s. +Step 4. (3rd octet) Add 8 because the third mask octet of 255 includes eight binary 1s. Step 5. (4th octet) Add 3 because the fourth mask octet of 224 includes three binary 1s. Step 6. The resulting prefix is /27. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +Mask Conversion Problem 4: Answer The answer is /15. + +For problem 4, mask 255.254.0.0 converts to the following: + +11111111 11111110 00000000 00000000 + +You can see from the binary number that it contains 15 binary 1s, so the prefix format of the mask will be /15. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 7 because the second mask octet of 254 includes seven binary 1s. +Step 4. The resulting prefix is /15. + + +Mask Conversion Problem 5: Answer The answer is /21. + +For problem 5, mask 255.255.248.0 converts to the following: + +11111111 11111111 11111000 00000000 + +You can see from the binary number that it contains 21 binary 1s, so the prefix format of the mask will be /21. +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 8 because the second mask octet of 255 includes eight binary 1s. +Step 4. (3rd octet) Add 5 because the third mask octet of 248 includes five binary 1s. Step 5. The resulting prefix is /21. + +Mask Conversion Problem 6: Answer The answer is 255.255.255.252. + +The binary process for converting the prefix version of the mask to dotted-decimal is straight-forward, but again requires some binary math. For reference, the process runs like this: + +Step 1. Write down x binary 1s, where x is the value listed in the prefix version of the mask. +Step 2. Write down binary 0s after the binary 1s until the combined 1s and 0s form a 32-bit number. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix E: Practice for Chapter 13: Analyzing Subnet Masks 5 + +Step 3. Convert this binary number, 8 bits at a time, to decimal, to create a dotted-decimal number; this value is the dotted-decimal version of the subnet mask. (Refer to Table E-1, which lists the binary and decimal equivalents.) + +For problem 6, with a prefix of /30, you start at Step 1 by writing down 30 binary 1s, as shown here: + +11111111 11111111 11111111 111111 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 11111111 11111100 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 7: Answer The answer is 255.255.255.128. + +For problem 7, with a prefix of /25, you start at Step 1 by writing down 25 binary 1s, as shown here: + +11111111 11111111 11111111 1 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 11111111 10000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 8: Answer +The answer is 255.224.0.0. E + +For problem 8, with a prefix of /11, you start at Step 1 by writing down 11 binary 1s, as shown here: + +11111111 111 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11100000 00000000 00000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 9: Answer The answer is 255.255.252.0. + +For problem 9, with a prefix of /22, you start at Step 1 by writing down 22 binary 1s, as shown here: + +11111111 11111111 111111 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 11111100 00000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 10: Answer The answer is 255.255.255.0. + +For problem 10, with a prefix of /24, you start at Step 1 by writing down 24 binary 1s, as shown here: + +11111111 11111111 11111111 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 11111111 00000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 11: Answer The answer is /8. + +For problem 11, mask 255.0.0.0 converts to the following: + +11111111 00000000 00000000 00000000 + +You can see from the binary number that it contains 8 binary 1s, so the prefix format of the mask will be /8. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 0 for the other octets because each mask octet of 0 includes zero binary 1s. +Step 4. The resulting prefix is /8. + + +Mask Conversion Problem 12: Answer The answer is 255.255.255.248. + +For problem 12, with a prefix of /29, you start at Step 1 by writing down 29 binary 1s, as shown here: + +11111111 11111111 11111111 11111 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 11111111 11111000 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix E: Practice for Chapter 13: Analyzing Subnet Masks 7 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 13: Answer The answer is 255.128.0.0. + +For problem 13, with a prefix of /9, you start at Step 1 by writing down 9 binary 1s, as shown here: + +11111111 1 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 10000000 00000000 00000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 14: Answer The answer is /10. + +For problem 14, mask 255.192.0.0 converts to the following: + +11111111 11000000 00000000 00000000 + +You can see from the binary number that it contains 10 binary 1s, so the prefix format of the mask will be /10. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 2 because the second mask octet of 192 includes two E binary 1s. +Step 4. The resulting prefix is /10. + + +Mask Conversion Problem 15: Answer The answer is /28. + +For problem 15, mask 255.255.255.240 converts to the following: + +11111111 11111111 11111111 11110000 + +You can see from the binary number that it contains 28 binary 1s, so the prefix format of the mask will be /28. +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Step 3. (2nd octet) Add 8 because the second mask octet of 255 includes eight binary 1s. +Step 4. (3rd octet) Add 8 because the third mask octet of 255 includes eight binary 1s. Step 5. (4th octet) Add 4 because the fourth mask octet of 240 includes four binary 1s. Step 6. The resulting prefix is /28. + +Mask Conversion Problem 16: Answer The answer is 255.255.255.192. + +For problem 16, with a prefix of /26, you start at Step 1 by writing down 26 binary 1s, as shown here: + +11111111 11111111 11111111 11 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 11111111 11000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 17: Answer The answer is 255.248.0.0. + +For problem 17, with a prefix of /13, you start at Step 1 by writing down 13 binary 1s, as shown here: + +11111111 11111 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111000 00000000 00000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 18: Answer The answer is /23. + +For problem 18, mask 255.255.254.0 converts to the following: + +11111111 11111111 11111110 00000000 + +You can see from the binary number that it contains 23 binary 1s, so the prefix format of the mask will be /23. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix E: Practice for Chapter 13: Analyzing Subnet Masks 9 + +Step 3. (2nd octet) Add 8 because the second mask octet of 255 includes eight binary 1s. +Step 4. (3rd octet) Add 7 because the third mask octet of 254 includes seven binary 1s. Step 5. The resulting prefix is /23. + +Mask Conversion Problem 19: Answer The answer is /14. + +For problem 19, mask 255.252.0.0 converts to the following: + +11111111 11111100 00000000 00000000 + +You can see from the binary number that it contains 14 binary 1s, so the prefix format of the mask will be /14. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. Step 3. (2nd octet) Add 6 because the second mask octet of 252 includes six binary 1s. Step 4. The resulting prefix is /14. + +Mask Conversion Problem 20: Answer The answer is 255.255.240.0. + +For problem 20, with a prefix of /20, you start at Step 1 by writing down 20 binary 1s, as shown here: +11111111 11111111 1111 E + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 11110000 00000000 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 21: Answer The answer is 255.255.0.0. + +For problem 21, with a prefix of /16, you start at Step 1 by writing down 16 binary 1s, as shown here: + +11111111 11111111 + +At Step 2, you add binary 0s until you have 32 total bits, as shown next: + +11111111 11111111 00000000 00000000 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +The only remaining work is to convert this 32-bit number to decimal, remembering that the conversion works with 8 bits at a time. + +Mask Conversion Problem 22: Answer The answer is /19. + +For problem 22, mask 255.255.224.0 converts to the following: + +11111111 11111111 11100000 00000000 + +You can see from the binary number that it contains 19 binary 1s, so the prefix format of the mask will be /19. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 8 because the second mask octet of 255 includes eight binary 1s. +Step 4. (3rd octet) Add 3 because the third mask octet of 224 includes three binary 1s. Step 5. The resulting prefix is /19. + +Mask Conversion Problem 23: Answer The answer is /17. + +For problem 23, mask 255.255.128.0 converts to the following: + +11111111 11111111 10000000 00000000 + +You can see from the binary number that it contains 17 binary 1s, so the prefix format of the mask will be /17. + +If you memorized the number of binary 1s represented by each DDN mask value, you can possibly work faster with the following logic: + +Step 1. Start with a prefix value of 0. +Step 2. (1st octet) Add 8 because the first mask octet of 255 includes eight binary 1s. +Step 3. (2nd octet) Add 8 because the second mask octet of 255 includes eight binary 1s. +Step 4. (3rd octet) Add 1 because the third mask octet of 128 includes one binary 1. Step 5. The resulting prefix is /17. + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix E: Practice for Chapter 13: Analyzing Subnet Masks 11 + +Mask Analysis Problems +This appendix lists problems that require you to analyze an existing IP address and mask to determine the number of network, subnet, and host bits. From that, you should calculate the number of subnets possible when using the listed mask in the class of network shown in the problem, as well as the number of possible host addresses in each subnet. + +To find this information, you can use the processes explained in Chapter 13 of +CCNA 200-301 Official Cert Guide, Volume 1. When doing the problems, Table E-1, earlier in this appendix, which lists all possible DDN mask values, can be useful. + +Each row of Table E-2 lists an IP address and mask. For each row, complete the table. Note that for the purposes of this exercise you can assume that the two special subnets in each network, the zero subnet and broadcast subnet, are allowed to be used. + +Table E-2 Mask Analysis Problems + + +Problem Number + +1 + +2 + +3 + +4 5 6 7 + +8 + +9 +10 + +Problem + + +10.66.5.99, 255.255.254.0 +172.16.203.42, 255.255.252.0 +192.168.55.55, 255.255.255.224 +10.22.55.87/30 172.30.40.166/26 192.168.203.18/29 +200.11.88.211, 255.255.255.240 +128.1.211.33, 255.255.255.128 +9.211.45.65/21 +223.224.225.226/25 + +Network Bits + +Subnet Host Bits Bits + +Number of Subnets in Network + +Number of Hosts per Subnet + + + + + + + + + + + +E + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +Answers to Mask Analysis Problems +Table E-3 includes the answers to problems 1–10. The paragraphs following the table pro-vide the explanations of each answer. + +Table E-3 Answers to Problems in This Appendix + + +Problem Problem Number + +Network Subnet Bits Bits + +Host Number of Bits Subnets in +Network + +Number of Hosts per Subnet + + + +1 10.66.5.99, 8 255.255.254.0 +2 172.16.203.42, 16 255.255.252.0 +3 192.168.55.55, 24 255.255.255.224 +4 10.22.55.87/30 8 5 172.30.40.166/26 16 6 192.168.203.18/29 24 +7 200.11.88.211, 24 255.255.255.240 +8 128.1.211.33, 16 255.255.255.128 +9 9.211.45.65/21 8 +10 223.224.225.226/25 24 + +15 9 215 = 32,768 + +6 10 26 = 64 + +3 5 23 = 8 + +22 2 222 = 4,194,304 10 6 210 = 1024 +5 3 25 = 32 4 4 24 = 16 + +9 7 29 = 512 + +13 11 213 = 8192 +1 7 21 = 2 + +29 – 2 = 510 + +210 – 2 = 1022 + +25 – 2 = 30 + +22 – 2 = 2 26 – 2 = 62 23 – 2 = 6 24 – 2 = 14 + +27 – 2 = 126 + +211 – 2 = 2046 +27 – 2 = 126 + + +Mask Analysis Problem 1: Answer +Address 10.66.5.99 is in Class A network 10.0.0.0, meaning that 8 network bits exist. Mask 255.255.254.0 converts to prefix /23, because the first 2 octets of value 255 represent 8 binary 1s, and the 254 in the third octet represents 7 binary 1s, for a total of 23 binary 1s. Therefore, the number of host bits is 32 – 23 = 9, leaving 15 subnet bits (32 – 8 network bits – 9 host bits = 15 subnet bits). The number of subnets in this Class A network, using mask 255.255.254.0, is 215 = 32,768. The number of hosts per subnet is 29 – 2 = 510. + +Mask Analysis Problem 2: Answer +Address 172.16.203.42, mask 255.255.252.0, is in Class B network 172.16.0.0, meaning that 16 network bits exist. Mask 255.255.252.0 converts to prefix /22, because the first 2 octets of value 255 represent 8 binary 1s, and the 252 in the third octet represents 6 binary 1s, for a total of 22 binary 1s. Therefore, the number of host bits is 32 – 22 = 10, leaving 6 subnet bits (32 – 16 network bits – 10 host bits = 6 subnet bits). The number of subnets in this Class B network, using mask 255.255.252.0, is 26 = 64. The number of hosts per subnet is 210 – 2 = 1022. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix E: Practice for Chapter 13: Analyzing Subnet Masks 13 + +Mask Analysis Problem 3: Answer +Address 192.168.55.55 is in Class C network 192.168.55.0, meaning that 24 network bits exist. Mask 255.255.255.224 converts to prefix /27, because the first 3 octets of value 255 represent 8 binary 1s, and the 224 in the fourth octet represents 3 binary 1s, for a total of 27 binary 1s. Therefore, the number of host bits is 32 – 27 = 5, leaving 3 subnet bits (32 +– 24 network bits – 5 host bits = 3 subnet bits). The number of subnets in this Class C net-work, using mask 255.255.255.224, is 23 = 8. The number of hosts per subnet is 25 – 2 = 30. + +Mask Analysis Problem 4: Answer +Address 10.22.55.87 is in Class A network 10.0.0.0, meaning that 8 network bits exist. The prefix format mask of /30 lets you calculate the number of host bits as 32 – prefix length (in this case, 32 – 30 = 2). This leaves 22 subnet bits (32 – 8 network bits – 2 host bits = 22 subnet bits). The number of subnets in this Class A network, using mask 255.255.255.252, is 222 = 4,194,304. The number of hosts per subnet is 22 – 2 = 2. (Note that this mask is popu-larly used on serial links, which need only two IP addresses in a subnet.) + +Mask Analysis Problem 5: Answer +Address 172.30.40.166 is in Class B network 172.30.0.0, meaning that 16 network bits exist. The prefix format mask of /26 lets you calculate the number of host bits as 32 – prefix length (in this case, 32 – 26 = 6). This leaves 10 subnet bits (32 – 16 network bits – 6 host bits = 10 subnet bits). The number of subnets in this Class B network, using mask /26, is +210 = 1024. The number of hosts per subnet is 26 – 2 = 62. + +Mask Analysis Problem 6: Answer +Address 192.168.203.18 is in Class C network 192.168.203.0, meaning that 24 network bits exist. The prefix format mask of /29 lets you calculate the number of host bits as 32 – pre-fix length (in this case, 32 – 29 = 3). This leaves 5 subnet bits, because 32 – 24 network bits – 3 host bits = 5 subnet bits. The number of subnets in this Class C network, using mask /29, is 25 = 32. The number of hosts per subnet is 23 – 2 = 6. +Mask Analysis Problem 7: Answer E Address 200.11.88.211 is in Class C network 200.11.88.0, meaning that 24 network bits +exist. Mask 255.255.255.240 converts to prefix /28, because the first three octets of value 255 represent 8 binary 1s, and the 240 in the fourth octet represents 4 binary 1s, for a total of 28 binary 1s. This leaves 4 subnet bits (32 – 24 network bits – 4 host bits = 4 subnet bits). The number of subnets in this Class C network, using mask /28, is 24 = 16. The number of hosts per subnet is 24 – 2 = 14. + +Mask Analysis Problem 8: Answer +Address 128.1.211.33, mask 255.255.255.128, is in Class B network 128.1.0.0, meaning that 16 network bits exist. Mask 255.255.255.128 converts to prefix /25, because the first 3 octets of value 255 represent 8 binary 1s, and the 128 in the fourth octet represents 1 binary 1, for a total of 25 binary 1s. Therefore, the number of host bits is 32 – 25 = 7, leav- +ing 9 subnet bits (32 – 16 network bits – 7 host bits = 9 subnet bits). The number of subnets in this Class B network, using mask 255.255.255.128, is 29 = 512. The number of hosts per subnet is 27 – 2 = 126. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +Mask Analysis Problem 9: Answer +Address 9.211.45.65 is in Class A network 10.0.0.0, meaning that 8 network bits exist. The prefix format mask of /21 lets you calculate the number of host bits as 32 – prefix length (in this case, 32 – 21 = 11). This leaves 13 subnet bits (32 – 8 network bits – 11 host bits += 13 subnet bits). The number of subnets in this Class A network, using mask /21, is 213 = 8192. The number of hosts per subnet is 211 – 2 = 2046. + +Mask Analysis Problem 10: Answer +Address 223.224.225.226 is in Class C network 223.224.225.0, meaning that 24 network bits exist. The prefix format mask of /25 lets you calculate the number of host bits as 32 – prefix length (in this case, 32 – 25 = 7). This leaves 1 subnet bit (32 – 24 network bits – 7 host bits = 1 subnet bit). The number of subnets in this Class C network, using mask /25, is 21 = 2. The number of hosts per subnet is 27 – 2 = 126. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX F + + + + +Practice for Chapter 14: Analyzing Existing Subnets + +Practice Problems +This appendix lists practice problems related to Chapter 14, “Analyzing Existing Subnets.” Each problem asks you to find a variety of information about the subnet in which an IP address resides. Each problem supplies an IP address and a subnet mask, from which you should find the following information: + +■ Subnet number +■ Subnet broadcast address +■ Range of valid IP addresses in this network + +To find these facts, you can use any of the processes explained in Chapter 14. + +In addition, these same problems can be used to review the concepts in Chapter 13, “Analyzing Subnet Masks.” To use these same problems for practice related to Chapter 13, simply find the following information for each of the problems: + +■ Size of the network part of the address ■ Size of the subnet part of the address ■ Size of the host part of the address +■ Number of hosts per subnet +■ Number of subnets in this network + +Feel free to either ignore or use the opportunity for more practice related to analyzing sub-net masks. +Solve for the following problems: + +1. 10.180.10.18, mask 255.192.0.0 2. 10.200.10.18, mask 255.224.0.0 3. 10.100.18.18, mask 255.240.0.0 4. 10.100.18.18, mask 255.248.0.0 5. 10.150.200.200, mask 255.252.0.0 6. 10.150.200.200, mask 255.254.0.0 7. 10.220.100.18, mask 255.255.0.0 +8. 10.220.100.18, mask 255.255.128.0 9. 172.31.100.100, mask 255.255.192.0 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +10. 172.31.100.100, mask 255.255.224.0 11. 172.31.200.10, mask 255.255.240.0 12. 172.31.200.10, mask 255.255.248.0 13. 172.31.50.50, mask 255.255.252.0 14. 172.31.50.50, mask 255.255.254.0 15. 172.31.140.14, mask 255.255.255.0 16. 172.31.140.14, mask 255.255.255.128 +17. 192.168.15.150, mask 255.255.255.192 18. 192.168.15.150, mask 255.255.255.224 19. 192.168.100.100, mask 255.255.255.240 20. 192.168.100.100, mask 255.255.255.248 21. 192.168.15.230, mask 255.255.255.252 22. 10.1.1.1, mask 255.248.0.0 +23. 172.16.1.200, mask 255.255.240.0 24. 172.16.0.200, mask 255.255.255.192 25. 10.1.1.1, mask 255.0.0.0 +Answers +This section includes the answers to the 25 problems listed in this appendix. The answer section for each problem explains how to use the process outlined in Chapter 14 to find the answers. Also, refer to Chapter 13 for details on how to find information about analyzing the subnet mask. + +Answer to Problem 1 +The answers begin with the analysis of the three parts of the address, the number of hosts per subnet, and the number of subnets of this network using the stated mask, as outlined in Table F-1. The binary math for subnet and broadcast address calculation follows. The answer finishes with the easier mental calculations for the range of IP addresses in the subnet. + +Table F-1 Question 1: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 10.180.10.18 255.192.0.0 8 +22 + +2 +22 = 4 +222 – 2 = 4,194,302 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 3 + +Table F-2 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-2 Question 1: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.180.10.18 + +255.192.0.0 + +10.128.0.0 + +10.191.255.255 + + +00001010 10110100 00001010 00010010 + +11111111 11000000 00000000 00000000 + +00001010 10000000 00000000 00000000 + + +00001010 10111111 11111111 11111111 + + +To get the first valid IP address, just add 1 to the subnet number; to get the last valid IP address, just subtract 1 from the broadcast address. In this case: + +10.128.0.1 through 10.191.255.254 10.128.0.0 + 1 = 10.128.0.1 10.191.255.255 – 1 = 10.191.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. The key parts of the process are as follows: + +■ The interesting octet is the octet for which the mask’s value is not a decimal 0 or 255. +■ The magic number is calculated as the value of the IP address’s interesting octet, sub-tracted from 256. +■ The subnet number can be found by copying the IP address octets to the left of the interesting octet, by writing down 0s for octets to the right of the interesting octet, and by finding the multiple of the magic number closest to, but not larger than, the IP address’s value in that same octet. +■ The broadcast address can be similarly found by copying the subnet number’s octets to the left of the interesting octet, by writing 255s for octets to the right of the interesting octet, and by taking the subnet number’s value in the interesting octet, adding the magic +number, and subtracting 1. + + + + + + + + + + + + +F + + +Table F-3 shows the work for this problem, with some explanation of the work following the table. Refer to Chapter 14 for the detailed processes. + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-3 Question 1: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask Address +Subnet Number +First Address +Last Address +Broadcast + +Octet 1 Octet 2 255 192 +10 180 10 128 + +10 128 + +10 191 + +10 191 + +Octet 3 Octet 4 0 0 +10 18 0 0 + +0 1 + +255 254 + +255 255 + +Comments + + + +Magic number = 256 – 192 = 64 + +Add 1 to last octet of subnet + +Subtract 1 from last octet of broadcast +128 + 64 – 1 = 191 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 128 is the multiple of 64 that is closest to 180 but not higher than 180. So, the second octet of the subnet number is 128. +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 128 + 64 – 1 = 191. + +Answer to Problem 2 +Table F-4 Question 2: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 10.200.10.18 255.224.0.0 8 +21 + +3 +23 = 8 +221 – 2 = 2,097,150 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-5 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 5 + +Table F-5 Question 2: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.200.10.18 255.224.0.0 10.192.0.0 + +10.223.255.255 + +00001010 11001000 00001010 00010010 +11111111 11100000 00000000 00000000 +00001010 11000000 00000000 00000000 + +00001010 11011111 11111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.192.0.1 through 10.223.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-6 shows the work for this problem, with some explanation of the work following the table. + +Table F-6 Question 2: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart +Octet 1 Octet 2 Octet 3 Octet 4 Comments + +Mask 255 Address 10 +Subnet 10 Number +First 10 Address +Last 10 Address +Broadcast 10 + +224 0 0 200 10 18 192 0 0 + +192 0 1 + +223 255 254 + +223 255 255 + + + +Magic number = 256 – 224 = 32 + +Add 1 to last octet of subnet + +Subtract 1 from last octet of broadcast +192 + 32 – 1 = 223 + + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 224 = 32 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 192 is the multiple of 32 that is closest to 200 but not higher than 200. So, the second octet of the subnet number is 192. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 192 + 32 – 1 = 223. + + +F + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Problem 3 +Table F-7 Question 3: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 10.100.18.18 255.240.0.0 8 +20 + +4 +24 = 16 +220 – 2 = 1,048,574 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-8 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-8 Question 3: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.100.18.18 255.240.0.0 10.96.0.0 + +10.111.255.255 + +00001010 01100100 00010010 00010010 +11111111 11110000 00000000 00000000 +00001010 01100000 00000000 00000000 + +00001010 01101111 11111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.96.0.1 through 10.111.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-9 shows the work for this problem, with some explanation of the work following the table. + +Table F-9 Question 3: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask +Address + +Octet 1 Octet 2 Octet 3 255 240 0 +10 100 18 + +Octet 4 Comments 0 — +18 — + +Subnet Number 10 96 0 0 Magic number = 256 – 240 = 16 + +First Address 10 Last Address 10 + +Broadcast 10 + +96 0 1 111 255 254 + +111 255 255 + +Add 1 to last octet of subnet +Subtract 1 from last octet of broadcast +96 + 16 – 1 = 111 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 7 + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 16 that is closest to 100 but not higher than 100. So, the second octet of the subnet number is 96. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 96 + 16 – 1 = 111. + +Answer to Problem 4 +Table F-10 Question 4: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example 10.100.18.18 +255.248.0.0 + +8 + +19 + +5 + +25 = 32 + +219 – 2 = 524,286 + +Rules to Remember — +— + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2number-of-subnet-bits + +2number-of-host-bits – 2 + + +Table F-11 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. +Table F-11 Question 4: Binary Calculation of Subnet and Broadcast Addresses F + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.100.18.18 255.248.0.0 10.96.0.0 +10.103.255.255 + +00001010 01100100 00010010 00010010 +11111111 11111000 00000000 00000000 +00001010 01100000 00000000 00000000 +00001010 01100111 11111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.96.0.1 through 10.103.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-12 shows the work for this problem, with some explanation of the work following the table. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-12 Question 4: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number +First Address +Last Address +Broadcast + +Octet 1 Octet 2 255 248 +10 100 10 96 + +10 96 + +10 103 + +10 103 + +Octet 3 Octet 4 0 0 +18 18 0 0 + +0 1 + +255 254 + +255 255 + +Comments — +— +Magic number = 256 – 248 = 8 + +Add 1 to last octet of subnet + +Subtract 1 from last octet of broadcast +96 + 8 – 1 = 103 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 8 that is closest to 100 but not higher than 100. So, the second octet of the subnet number is 96. +The second part of this process calculates the subnet broadcast address with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 96 + 8 – 1 = 103. + +Answer to Problem 5 +Table F-13 Question 5: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 10.150.200.200 255.252.0.0 +8 18 +6 +26 = 64 +218 – 2 = 262,142 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-14 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 9 + +Table F-14 Question 5: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.150.200.200 255.252.0.0 10.148.0.0 + +10.151.255.255 + +00001010 10010110 11001000 11001000 +11111111 11111100 00000000 00000000 +00001010 10010100 00000000 00000000 + +00001010 10010111 11111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.148.0.1 through 10.151.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-15 shows the work for this problem, with some explanation of the work following the table. + +Table F-15 Question 5: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Octet 1 Mask 255 Address 10 +Subnet 10 Number +First Address 10 Last Address 10 + +Broadcast 10 + +Octet 2 Octet 3 252 0 +150 200 148 0 + +148 0 151 255 + +151 255 + +Octet 4 Comments 0 — +200 — +0 Magic number = 256 – 252 = 4 + +1 Add 1 to last octet of subnet +254 Subtract 1 from last octet of broadcast +255 148 + 4 – 1 = 151 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. +The second octet is “interesting” in this case. The key part of the trick to get the right +answers is to calculate the magic number, which is 256 – 252 = 4 in this case (256 – mask’s F value in the interesting octet). The subnet number’s value in the interesting octet (inside the +box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 148 is the multiple of 4 that is closest to 150 but not higher than 150. So, the second octet of the subnet number is 148. + +The second part of this process calculates the subnet broadcast address with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 148 + 4 – 1 = 151. + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Problem 6 +Table F-16 Question 6: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 10.150.200.200 255.254.0.0 +8 17 +7 +27 = 128 +217 – 2 = 131,070 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-17 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-17 Question 6: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.150.200.200 255.254.0.0 10.150.0.0 + +10.151.255.255 + +00001010 10010110 11001000 11001000 +11111111 11111110 00000000 00000000 +00001010 10010110 00000000 00000000 + +00001010 10010111 11111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.150.0.1 through 10.151.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-18 shows the work for this problem, with some explanation of the work following the table. + +Table F-18 Question 6: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 255 254 +10 150 10 150 10 150 10 151 +10 151 + +Octet 3 Octet 4 0 0 +200 200 0 0 +0 1 255 254 +255 255 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 11 + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 254 = 2 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 150 is the multiple of 2 that is closest to 150 but not higher than 150. So, the second octet of the subnet number is 150. + +The second part of this process calculates the subnet broadcast address with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 150 + 2 – 1 = 151. + +Answer to Problem 7 +Table F-19 Question 7: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 10.220.100.18 255.255.0.0 +8 16 +8 +28 = 256 +216 – 2 = 65,534 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-20 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-20 Question 7: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.220.100.18 255.255.0.0 10.220.0.0 + +10.220.255.255 + +00001010 11011100 01100100 00010010 +11111111 11111111 00000000 00000000 +00001010 11011100 00000000 00000000 + +00001010 11011100 11111111 11111111 + + +F + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.220.0.1 through 10.220.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-21 shows the work for this problem. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-21 Question 7: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 255 255 +10 220 10 220 10 220 10 220 +10 220 + +Octet 3 Octet 4 0 0 +100 18 0 0 0 1 +255 254 +255 255 + + +This subnetting scheme uses an easy mask because all the octets are a 0 or a 255. No math tricks are needed. + +Answer to Problem 8 +Table F-22 Question 8: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 10.220.100.18 255.255.128.0 8 +15 + +9 +29 = 512 +215 – 2 = 32,766 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-23 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-23 Question 8: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) + + +10.220.100.18 255.255.128.0 +10.220.0.0 + +00001010 11011100 01100100 00010010 +11111111 11111111 10000000 00000000 +00001010 11011100 00000000 00000000 + +Change host to 1s 10.220.127.255 00001010 11011100 01111111 11111111 (broadcast address) + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 13 + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.220.0.1 through 10.220.127.254 + +Table F-24 shows the work for this problem, with some explanation of the work following the table. Refer to Chapter 14 for the detailed processes. + +Table F-24 Question 8: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask Address +Subnet Number First Address Last Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 128 0 +10 220 100 18 10 220 0 0 10 220 0 1 10 220 127 254 +10 220 127 255 + + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 128 = 128 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value +in the interesting octet. In this case, 0 is the multiple of 128 that is closest to 100 but not higher than 100. So, the third octet of the subnet number is 0. + +The second part of this process calculates the subnet broadcast address with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 0 + 128 – 1 = 127. + +This example tends to confuse people, because a mask with 128 in it gives you subnet numbers that just do not seem to look right. Table F-25 gives you the answers for the first several subnets, just to make sure that you are clear about the subnets when using this mask with a Class A network. + + + + + + + + + + + + + + +F + + +Table F-25 Question 8: First Four Subnets + + + +Subnet +First Address Last Address +Broadcast + +Zero Subnet 10.0.0.0 10.0.0.1 10.0.127.254 +10.0.127.255 + +2nd Subnet 10.0.128.0 10.0.128.1 10.0.255.254 +10.0.255.255 + +3rd Subnet 10.1.0.0 10.1.0.1 10.1.127.254 +10.1.127.255 + +4th Subnet 10.1.128.0 10.1.128.1 10.1.255.254 +10.1.255.255 + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Problem 9 +Table F-26 Question 9: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.100.100 255.255.192.0 16 +14 + +2 +22 = 4 +214 – 2 = 16,382 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-27 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-27 Question 9: Binary Calculation of Subnet and Broadcast Addresses + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.100.100 255.255.192.0 172.31.64.0 + +172.31.127.255 + +10101100 00011111 01100100 01100100 +11111111 11111111 11000000 00000000 +10101100 00011111 01000000 00000000 + +10101100 00011111 01111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.64.1 through 172.31.127.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-28 shows the work for this problem, with some explanation of the work following the table. + +Table F-28 Question 9: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 Mask 255 255 192 0 Address 172 31 100 100 Subnet Number 172 31 64 0 +First Valid Address 172 31 64 1 Last Valid Address 172 31 127 254 Broadcast 172 31 127 255 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 15 + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – mask’s value +in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 64 is the multiple of 64 that is closest to 100 but not higher than 100. So, the third octet of the subnet number is 64. + +The second part of this process calculates the subnet broadcast address with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 64 + 64 – 1 = 127. + +Answer to Problem 10 +Table F-29 Question 10: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.100.100 255.255.224.0 16 +13 +3 +23 = 8 +213 – 2 = 8190 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-30 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-30 Question 10: Binary Calculation of Subnet and Broadcast Addresses + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.100.100 255.255.224.0 172.31.96.0 +172.31.127.255 + +10101100 00011111 01100100 01100100 F 11111111 11111111 11100000 00000000 +10101100 00011111 01100000 00000000 +10101100 00011111 01111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.96.1 through 172.31.127.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-31 shows the work for this problem, with some explanation of the work following the table. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-31 Question 10: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Octet 1 Mask 255 Address 172 Subnet Number 172 First Valid Address 172 Last Valid Address 172 +Broadcast 172 + +Octet 2 Octet 3 Octet 4 255 224 0 +31 100 100 31 96 0 31 96 1 31 127 254 +31 127 255 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 224 = 32 in this case (256 – mask’s value +in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 32 that is closest to 100 but not higher than 100. So, the third octet of the subnet number is 96. + +The second part of this process calculates the subnet broadcast address, with the tricky parts, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interesting octet. In this case, it is 96 + 32 – 1 = 127. + +Answer to Problem 11 +Table F-32 Question 11: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.200.10 255.255.240.0 16 +12 +4 +24 = 16 +212 – 2 = 4094 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-33 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 17 + +Table F-33 Question 11: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.200.10 255.255.240.0 172.31.192.0 +172.31.207.255 + +10101100 00011111 11001000 00001010 +11111111 11111111 11110000 00000000 +10101100 00011111 11000000 00000000 +10101100 00011111 11001111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.192.1 through 172.31.207.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-34 shows the work for this problem, with some explanation of the work following the table. + +Table F-34 Question 11: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Octet 1 Mask 255 Address 172 Subnet Number 172 First Valid Address 172 Last Valid Address 172 +Broadcast 172 + +Octet 2 Octet 3 Octet 4 255 240 0 +31 200 10 31 192 0 31 192 1 31 207 254 +31 207 255 + + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value +in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 192 is the multiple of 16 that is closest to 200 but not higher than 200. So, the third octet of the subnet number is 192. + +The second part of this process calculates the subnet broadcast address with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 192 + 16 – 1 = 207. + + + + + + +F + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Problem 12 +Table F-35 Question 12: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.200.10 255.255.248.0 16 +11 +5 +25 = 32 +211 – 2 = 2046 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-36 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-36 Question 12: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.200.10 255.255.248.0 172.31.200.0 +172.31.207.255 + +10101100 00011111 11001000 00001010 +11111111 11111111 11111000 00000000 +10101100 00011111 11001000 00000000 +10101100 00011111 11001111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.200.1 through 172.31.207.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-37 shows the work for this problem, with some explanation of the work following the table. + +Table F-37 Question 12: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 248 0 +172 31 200 10 172 31 200 0 172 31 200 1 172 31 207 254 +172 31 207 255 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 19 + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) +is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 200 is the multiple of 8 that is closest to 200 but not higher than 200. So, the third octet of the subnet number is 200. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 200 + 8 – 1 = 207. + +Answer to Problem 13 +Table F-38 Question 13: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.50.50 255.255.252.0 16 +10 +6 +26 = 64 +210 – 2 = 1022 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-39 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-39 Question 13: Binary Calculation of Subnet and Broadcast Addresses + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.50.50 255.255.252.0 172.31.48.0 +172.31.51.255 + +10101100 00011111 00110010 00110010 F 11111111 11111111 11111100 00000000 +10101100 00011111 00110000 00000000 +10101100 00011111 00110011 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.48.1 through 172.31.51.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-40 shows the work for this problem, with some explanation of the work following the table. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +20 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-40 Question 13: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Octet 1 Mask 255 Address 172 Subnet Number 172 First Valid Address 172 Last Valid Address 172 +Broadcast 172 + +Octet 2 Octet 3 Octet 4 255 252 0 +31 50 50 31 48 0 31 48 1 31 51 254 +31 51 255 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is +to calculate the magic number, which is 256 – 252 = 4 in this case (256 – mask’s value in +the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 48 is the multiple of 4 that is closest to 50 but not higher than 50. So, the third octet of the subnet number is 48. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 48 + 4 – 1 = 51. + +Answer to Problem 14 +Table F-41 Question 14: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.50.50 255.255.254.0 16 +9 + +7 +27 = 128 +29 – 2 = 510 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-42 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 21 + +Table F-42 Question 14: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.50.50 255.255.254.0 172.31.50.0 +172.31.51.255 + +10101100 00011111 00110010 00110010 +11111111 11111111 11111110 00000000 +10101100 00011111 00110010 00000000 +10101100 00011111 00110011 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.50.1 through 172.31.51.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-43 shows the work for this problem, with some explanation of the work following the table. + +Table F-43 Question 14: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 254 0 +172 31 50 50 172 31 50 0 172 31 50 1 172 31 51 254 +172 31 51 255 + + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is +to calculate the magic number, which is 256 – 254 = 2 in this case (256 – mask’s value in +the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 50 is the multiple of 2 that is closest to 50 but not higher than 50. So, the third octet of the subnet number is 50. + +The second part of this process calculates the subnet broadcast address with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 50 + 2 – 1 = 51. + + + + + + +F + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +22 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Problem 15 +Table F-44 Question 15: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.140.14 255.255.255.0 16 +8 +8 +28 = 256 +28 – 2 = 254 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-45 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-45 Question 15: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.140.14 255.255.255.0 172.31.140.0 +172.31.140.255 + +10101100 00011111 10001100 00001110 +11111111 11111111 11111111 00000000 +10101100 00011111 10001100 00000000 +10101100 00011111 10001100 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.140.1 through 172.31.140.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-46 shows the work for this problem. + +Table F-46 Question 15: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 0 +172 31 140 14 172 31 140 0 172 31 140 1 172 31 140 254 +172 31 140 255 + + +This subnetting scheme uses an easy mask because all the octets are a 0 or a 255. No math tricks are needed. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 23 + +Answer to Problem 16 +Table F-47 Question 16: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.31.140.14 255.255.255.128 16 +7 +9 +29 = 512 +27 – 2 = 126 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-48 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-48 Question 16: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.31.140.14 255.255.255.128 172.31.140.0 + +172.31.140.127 + +10101100 00011111 10001100 00001110 +11111111 11111111 11111111 10000000 +10101100 00011111 10001100 00000000 + +10101100 00011111 10001100 01111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.140.1 through 172.31.140.126 + + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-49 shows the work for this problem, with some explanation of the work following the table. + +Table F-49 Question 16: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +F + + + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 128 +172 31 140 14 172 31 140 0 172 31 140 1 172 31 140 126 +172 31 140 127 + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +24 CCNA 200-301 Official Cert Guide, Volume 1 + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 128 = 128 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP +address’s value in the interesting octet. In this case, 0 is the multiple of 128 that is closest to 14 but not higher than 14. So, the fourth octet of the subnet number is 0. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 0 + 128 – 1 = 127. + +Answer to Problem 17 +Table F-50 Question 17: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 192.168.15.150 255.255.255.192 24 +6 + +2 +22 = 4 +26 – 2 = 62 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-51 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-51 Question 17: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +192.168.15.150 255.255.255.192 192.168.15.128 +192.168.15.191 + +11000000 10101000 00001111 10010110 +11111111 11111111 11111111 11000000 +11000000 10101000 00001111 10000000 +11000000 10101000 00001111 10111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.15.129 through 192.168.15.190 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-52 shows the work for this problem, with some explanation of the work following the table. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 25 + +Table F-52 Question 17: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 192 +192 168 15 150 192 168 15 128 192 168 15 129 192 168 15 190 +192 168 15 191 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right +answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 128 is the multiple of 64 that is closest to 150 but not higher than 150. So, the fourth octet of the subnet number is 128. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 128 + 64 – 1 = 191. + +Answer to Problem 18 +Table F-53 Question 18: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 192.168.15.150 255.255.255.224 24 +5 + +3 +23 = 8 +25 – 2 = 30 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + + + + + +F + + +Table F-54 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +26 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-54 Question 18: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +192.168.15.150 255.255.255.224 192.168.15.128 +192.168.15.159 + +11000000 10101000 00001111 10010110 +11111111 11111111 11111111 11100000 +11000000 10101000 00001111 10000000 +11000000 10101000 00001111 10011111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.15.129 through 192.168.15.158 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-55 shows the work for this problem, with some explanation of the work following the table. + +Table F-55 Question 18: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 224 +192 168 15 150 192 168 15 128 192 168 15 129 192 168 15 158 +192 168 15 159 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right +answers is to calculate the magic number, which is 256 – 224 = 32 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 128 is the multiple of 32 that is closest to 150 but not higher than 150. So, the fourth octet of the subnet number is 128. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 128 + 32 – 1 = 159. + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 27 + +Answer to Problem 19 +Table F-56 Question 19: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits Number of subnets +Number of hosts + +Example 192.168.100.100 255.255.255.240 24 +4 + +4 +24 = 16 +24 – 2 = 14 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-57 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-57 Question 19: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +192.168.100.100 255.255.255.240 192.168.100.96 + +192.168.100.111 + +11000000 10101000 01100100 01100100 +11111111 11111111 11111111 11110000 +11000000 10101000 01100100 01100000 + +11000000 10101000 01100100 01101111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.100.97 through 192.168.100.110 +Alternatively, you can use the processes that only use decimal math to find the subnet and F broadcast address. Table F-58 shows the work for this problem, with some explanation of +the work following the table. + +Table F-58 Question 19: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 240 +192 168 100 100 192 168 100 96 192 168 100 97 192 168 100 110 +192 168 100 111 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +28 CCNA 200-301 Official Cert Guide, Volume 1 + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right +answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 16 that is closest to 100 but not higher than 100. So, the fourth octet of the subnet number is 96. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 96 + 16 – 1 = 111. + +Answer to Problem 20 +Table F-59 Question 20: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 192.168.100.100 255.255.255.248 24 +3 +5 +25 = 32 +23 – 2 = 6 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-60 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-60 Question 20: Binary Calculation of Subnet and Broadcast Addresses + + +Address +Mask + + +192.168.100.100 +255.255.255.248 + +11000000 10101000 01100100 01100100 +11111111 11111111 11111111 11111000 + +AND result (subnet number) 192.168.100.96 11000000 10101000 01100100 01100000 +Change host to 1s 192.168.100.103 11000000 10101000 01100100 01100111 (broadcast address) + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.100.97 through 192.168.100.102 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-61 shows the work for this problem, with some explanation of the work following the table. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 29 + +Table F-61 Question 20: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 248 +192 168 100 100 192 168 100 96 192 168 100 97 192 168 100 102 +192 168 100 103 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right +answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 8 that is closest to 100 but not higher than 100. So, the fourth octet of the subnet number is 96. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 96 + 8 – 1 = 103. + +Answer to Problem 21 +Table F-62 Question 21: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 192.168.15.230 255.255.255.252 24 +2 +6 +26 = 64 +22 – 2 = 2 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask F +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-63 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +30 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-63 Question 21: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +192.168.15.230 255.255.255.252 192.168.15.228 + +192.168.15.231 + +11000000 10101000 00001111 11100110 +11111111 11111111 11111111 11111100 +11000000 10101000 00001111 11100100 + +11000000 10101000 00001111 11100111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.15.229 through 192.168.15.230 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-64 shows the work for this problem, with some explanation of the work following the table. + +Table F-64 Question 21: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 252 +192 168 15 230 192 168 15 228 192 168 15 229 192 168 15 230 +192 168 15 231 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right +answers is to calculate the magic number, which is 256 – 252 = 4 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 228 is the multiple of 4 that is closest to 230 but not higher than 230. So, the fourth octet of the subnet number is 228. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 228 + 4 – 1 = 231. + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 31 + +Answer to Problem 22 +Table F-65 Question 22: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 10.1.1.1 255.248.0.0 8 +19 +5 +25 = 32 +219 – 2 = 524,286 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-66 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-66 Question 22: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.1.1.1 255.248.0.0 10.0.0.0 +10.7.255.255 + +00001010 00000001 00000001 00000001 +11111111 11111000 00000000 00000000 +00001010 00000000 00000000 00000000 +00001010 00000111 11111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.0.0.1 through 10.7.255.254 + + +Take a closer look at the subnet part of the subnet address, as shown in bold here: +0000 1010 0000 0000 0000 0000 0000 0000. The subnet part of the address is all binary 0s, making this subnet a zero subnet. + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-67 shows the work for this problem, with some explanation of the work following the table. + + +F + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +32 CCNA 200-301 Official Cert Guide, Volume 1 + +Table F-67 Question 22: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 248 0 0 +10 1 1 1 10 0 0 0 10 0 0 1 10 7 255 254 +10 7 255 255 + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 0 is the multiple of 8 that is closest to 1 but not higher than 1. So, the second octet of the subnet number is 0. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 0 + 8 – 1 = 7. + +Answer to Problem 23 +Table F-68 Question 23: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.16.1.200 255.255.240.0 16 +12 +4 +24 = 16 +212 – 2 = 4094 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-69 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 33 + +Table F-69 Question 23: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +172.16.1.200 255.255.240.0 172.16.0.0 +172.16.15.255 + +10101100 00010000 00000001 11001000 +11111111 11111111 11110000 00000000 +10101100 00010000 00000000 00000000 +10101100 00010000 00001111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.16.0.1 through 172.16.15.254 + +Take a closer look at the subnet part of the subnet address, as shown in bold here: +1010 1100 0001 0000 0000 0000 0000 0000. The subnet part of the address is all binary 0s, making this subnet a zero subnet. + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-70 shows the work for this problem, with some explanation of the work following the table. + +Table F-70 Question 23: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 240 0 +172 16 1 200 172 16 0 0 172 16 0 1 172 16 15 254 +172 16 15 255 + + + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value +in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 0 is the multiple of 16 that is closest to 1 but not higher than 1. So, the third octet of the subnet number is 0. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 0 + 16 – 1 = 15. + + +F + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +34 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Problem 24 +Table F-71 Question 24: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits Number of subnet bits Number of subnets +Number of hosts + +Example 172.16.0.200 255.255.255.192 16 +6 +10 +210 = 1024 +26 – 2 = 62 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) 2number-of-subnet-bits +2number-of-host-bits – 2 + + +Table F-72 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-72 Question 24: Binary Calculation of Subnet and Broadcast Addresses + + +Address +Mask + + +172.16.0.200 +255.255.255.192 + +10101100 00010000 00000000 11001000 +11111111 11111111 11111111 11000000 + +AND result (subnet number) 172.16.0.192 10101100 00010000 00000000 11000000 +Change host to 1s 172.16.0.255 10101100 00010000 00000000 11111111 (broadcast address) + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.16.0.193 through 172.16.0.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-73 shows the work for this problem, with some explanation of the work following the table. + +Table F-73 Question 24: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + + + +Mask Address +Subnet Number First Valid Address Last Valid Address +Broadcast + +Octet 1 Octet 2 Octet 3 Octet 4 255 255 255 192 +172 16 0 200 172 16 0 192 172 16 0 193 172 16 0 254 +172 16 0 255 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix F: Practice for Chapter 14: Analyzing Existing Subnets 35 + +This subnetting scheme uses a difficult mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right +answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that is not higher than the original IP address’s value in the interesting octet. In this case, 192 is the multiple of 64 that is closest to 200 but not higher than 200. So, the fourth octet of the subnet number is 192. + +The second part of this process calculates the subnet broadcast address, with the tricky part, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That is the broadcast address’s value in the interest-ing octet. In this case, it is 192 + 64 – 1 = 255. + +You can easily forget that the subnet part of this address, when using this mask, actually covers all the third octet as well as 2 bits of the fourth octet. For example, the valid subnet numbers in order are listed here: + +172.16.0.0 (zero subnet) 172.16.0.64 172.16.0.128 172.16.0.192 172.16.1.0 +172.16.1.64 172.16.1.128 172.16.1.192 172.16.2.0 172.16.2.64 172.16.2.128 172.16.2.192 172.16.3.0 +172.16.3.64 F 172.16.3.128 +172.16.3.192 + +And so on. + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +36 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Problem 25 +Congratulations! You made it through the extra practice in this appendix! Here is an easy one to complete your review—one with no subnetting at all. + +Table F-74 Question 25: Size of Network, Subnet, Host, Number of Subnets, and Number of Hosts + + +Item Address Mask +Number of network bits Number of host bits + +Number of subnet bits +Number of subnets + +Example 10.1.1.1 255.0.0.0 8 +24 + +0 +0 + +Rules to Remember — +— +Always defined by Class A, B, C +Always defined as number of binary 0s in mask +32 – (network size + host size) +2number-of-subnet-bits + +Number of hosts 224 – 2 = 16,777,214 2number-of-host-bits – 2 + +Table F-75 contains the important binary calculations for finding the subnet number and subnet broadcast address. To calculate the subnet number, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table F-75 Question 25: Binary Calculation of Subnet and Broadcast Addresses + + +Address Mask +AND result (subnet number) +Change host to 1s (broadcast address) + + +10.1.1.1 255.0.0.0 10.0.0.0 +10.255.255.255 + +00001010 00000001 00000001 00000001 +11111111 00000000 00000000 00000000 +00001010 00000000 00000000 00000000 +00001010 11111111 11111111 11111111 + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.0.0.1 through 10.255.255.254 + +Alternatively, you can use the processes that only use decimal math to find the subnet and broadcast address. Table F-76 shows the work for this problem. + +Table F-76 Question 25: Subnet, Broadcast, and First and Last Addresses Calculated Using the Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 Mask 255 0 0 0 Address 10 1 1 1 Network Number 10 0 0 0 +First Valid Address 10 0 0 1 Last Valid Address 10 255 255 254 Broadcast 10 255 255 255 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX G + + + + +Practice for Chapter 22: Fundamentals of IP Version 6 + +This appendix provides extra practice problems for two topics discussed in Chapter 22, “Fundamentals of IP Version 6,” of the book. The first problems let you convert from a full 32-digit IPv6 address to its abbreviated form, or to do the reverse. The second set of prob-lems begins with IPv6 addresses and prefix lengths, asking you to determine the IPv6 prefix (subnet). + +Address Abbreviating and Expanding Problems +Chapter 22 discusses some reasons why you may need to be able to mentally convert from the full 32-digit IPv6 address to the abbreviated form, or vice versa. The practice problems in this section simply provide more opportunities to practice. + +Table G-1 lists some practice problems, with the full 32-digit IPv6 address on the left and the best abbreviation on the right. The table gives you either the expanded or abbrevi-ated address, and you need to supply the opposite value. The answers sit at the end of the appendix, in the section “Answers to Address Abbreviating and Expanding Problems.” + + +Table G-1 + +Full + +IPv6 Address Abbreviation and Expansion Practice + +Abbreviation + + + +1 2987:BA11:B011:B00A:1000:0001:F001:F003 2 +3 FD00:0001:0001:0001:0200:00FF:FE00:0001 4 +5 32CC:0000:0000:000D:210F:0000:0000:0000 6 +7 3A11:CA00:0000:0000:0000:00FF:FECC:000C 8 +9 2A2A:0000:0000:0000:0000:0000:0000:2A2A 10 +11 2001:0DB8:0000:0000:0001:0000:0002:0100 12 +13 3330:0000:0000:0100:0000:0002:0000:0003 14 +15 FD11:1000:0100:0010:0001:0000:1000:0100 +16 + + +3100::1010:D00D:D000:D00B:B00D + +FDDF:8080:880:1001:0:FF:FE01:507 + +2100:E:E0::E00 + +3799:9F9F:F000:0:FFFF::1 + +3194::1:0:0:101 + +2001:DB8::10:A000 + +FD00::1000:2000:0:1:20 + +2000::2 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Calculating the IPv6 Prefix Problems +Routers take the interface IPv6 address configuration and add a connected IPv6 route to the IPv6 routing table, for the IPv6 prefix (subnet) connected to that interface. This section provides some practice problems so that you can do the same math and predict the prefix value that the router will add to the routing table. + +Table G-2 lists practice problems that all use the same prefix length (/64), which is the most common prefix length you see. Table G-3 that follows lists additional practice problems, with prefix lengths other than /64. + +Table G-2 Finding the IPv6 Prefix When Using a /64 Prefix Length + +Address (Assume a /64 Prefix Length) Prefix (Subnet) 1 2987:BA11:B011:B00A:1000:0001:F001:F003 +2 3100:0000:0000:1010:D00D:D000:D00B:B00D 3 FD00:0001:0001:0001:0200:00FF:FE00:0001 +4 FDDF:8080:0880:1001:0000:00FF:FE01:0507 5 32CC:0000:0000:000D:210F:0000:0000:0000 6 2100:000E:00E0:0000:0000:0000:0000:0E00 7 3A11:CA00:0000:0000:0000:00FF:FECC:000C 8 3799:9F9F:F000:0000:FFFF:0000:0000:0001 +9 2A2A:0000:0000:0000:0000:0000:0000:2A2A 10 3194:0000:0000:0000:0001:0000:0000:0101 11 2001:0DB8:0000:0000:0001:0000:0002:0100 12 2001:0DB8:0000:0000:0000:0000:0010:A000 13 3330:0000:0000:0100:0000:0002:0000:0003 14 FD00:0000:0000:1000:2000:0000:0001:0020 15 FD11:1000:0100:0010:0001:0000:1000:0100 16 2000:0000:0000:0000:0000:0000:0000:0002 + +Table G-3 Finding the IPv6 Prefix Using a Prefix Length Other Than /64 + +Address Prefix (Subnet) 1 2987:BA11:B011:B00A:1000:0001:F001:F003 /60 +2 3100:0000:0000:1010:D00D:D000:D00B:B00D /56 3 FD00:0001:0001:0001:0200:00FF:FE00:0001 /52 +4 FDDF:8080:0880:1001:0000:00FF:FE01:0507 /48 5 32CC:0000:0000:000D:210F:0000:0000:0000 /44 6 2100:000E:00E0:0000:0000:0000:0000:0E00 /60 +7 3A11:CA00:0000:0000:0000:00FF:FECC:000C /56 8 3799:9F9F:F000:0000:FFFF:0000:0000:0001 /52 +9 2A2A:0000:0000:0000:0000:0000:0000:2A2A /48 10 3194:0000:0000:0000:0001:0000:0000:0101 /44 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix G: Practice for Chapter 22: Fundamentals of IP Version 6 3 + +Answers to Address Abbreviating and Expanding Problems Table G-4 lists the answers to the problems listed earlier in Table G-1. + +Table G-4 + +Full + +Answers: IPv6 Address Abbreviation and Expansion Practice + +Abbreviation + +1 2987:BA11:B011:B00A:1000:0001:F001:F003 2987:BA11:B011:B00A:1000:1:F001:F003 2 3100:0000:0000:1010:D00D:D000:D00B:B00D 3100::1010:D00D:D000:D00B:B00D + +3 FD00:0001:0001:0001:0200:00FF:FE00:0001 4 FDDF:8080:0880:1001:0000:00FF:FE01:0507 5 32CC:0000:0000:000D:210F:0000:0000:0000 6 2100:000E:00E0:0000:0000:0000:0000:0E00 7 3A11:CA00:0000:0000:0000:00FF:FECC:000C 8 3799:9F9F:F000:0000:FFFF:0000:0000:0001 +9 2A2A:0000:0000:0000:0000:0000:0000:2A2A 10 3194:0000:0000:0000:0001:0000:0000:0101 11 2001:0DB8:0000:0000:0001:0000:0002:0100 12 2001:0DB8:0000:0000:0000:0000:0010:A000 13 3330:0000:0000:0100:0000:0002:0000:0003 14 FD00:0000:0000:1000:2000:0000:0001:0020 15 FD11:1000:0100:0010:0001:0000:1000:0100 +16 2000:0000:0000:0000:0000:0000:0000:0002 + +FD00:1:1:1:200:FF:FE00:1 FDDF:8080:880:1001:0:FF:FE01:507 32CC:0:0:D:210F:: +2100:E:E0::E00 3A11:CA00::FF:FECC:C 3799:9F9F:F000:0:FFFF::1 2A2A::2A2A 3194::1:0:0:101 2001:DB8::1:0:2:100 2001:DB8::10:A000 3330::100:0:2:0:3 FD00::1000:2000:0:1:20 +FD11:1000:100:10:1:0:1000:100 +2000::2 + + +Answers to Calculating IPv6 Prefix Problems +Tables G-5 and G-6 list the answers to the problems listed earlier in Tables G-2 and G-3. +Table G-5 Answers: Finding the IPv6 Prefix, with a /64 Prefix Length + + +Address (Assume a /64 Prefix Length) +1 2987:BA11:B011:B00A:1000:0001:F001:F003 +2 3100:0000:0000:1010:D00D:D000:D00B:B00D 3 FD00:0001:0001:0001:0200:00FF:FE00:0001 +4 FDDF:8080:0880:1001:0000:00FF:FE01:0507 5 32CC:0000:0000:000D:210F:0000:0000:0000 6 2100:000E:00E0:0000:0000:0000:0000:0E00 7 3A11:CA00:0000:0000:0000:00FF:FECC:000C 8 3799:9F9F:F000:0000:FFFF:0000:0000:0001 +9 2A2A:0000:0000:0000:0000:0000:0000:2A2A 10 3194:0000:0000:0000:0001:0000:0000:0101 11 2001:0DB8:0000:0000:0001:0000:0002:0100 12 2001:0DB8:0000:0000:0000:0000:0010:A000 13 3330:0000:0000:0100:0000:0002:0000:0003 14 FD00:0000:0000:1000:2000:0000:0001:0020 15 FD11:1000:0100:0010:0001:0000:1000:0100 +16 2000:0000:0000:0000:0000:0000:0000:0002 + +Prefix (Subnet) 2987:BA11:B011:B00A::/64 3100:0:0:1010::/64 FD00:1:1:1::/64 FDDF:8080:880:1001::/64 +32CC:0:0:D::/64 +2100:E:E0::/64 G +3A11:CA00::/64 3799:9F9F:F000::/64 2A2A::/64 +3194::/64 2001:DB8::/64 2001:DB8::/64 3330:0:0:100::/64 FD00:0:0:1000::/64 FD11:1000:100:10::/64 +2000::/64 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +Table G-6 Answers: Finding the IPv6 Prefix, with Other Prefix Lengths + + +Address +1 2987:BA11:B011:B00A:1000:0001:F001:F003 /60 +2 3100:0000:0000:1010:D00D:D000:D00B:B00D /56 3 FD00:0001:0001:0001:0200:00FF:FE00:0001 /52 +4 FDDF:8080:0880:1001:0000:00FF:FE01:0507 /48 5 32CC:0000:0000:000D:210F:0000:0000:0000 /44 6 2100:000E:00E0:0000:0000:0000:0000:0E00 /60 +7 3A11:CA00:0000:0000:0000:00FF:FECC:000C /56 8 3799:9F9F:F000:0000:FFFF:0000:0000:0001 /52 +9 2A2A:0000:0000:0000:0000:0000:0000:2A2A /48 +10 3194:0000:0000:0000:0001:0000:0000:0101 /44 + +Prefix (Subnet) 2987:BA11:B011:B000::/60 3100:0:0:1000::/56 FD00:1:1::/52 FDDF:8080:880::/48 32CC::/44 +2100:E:E0::/60 3A11:CA00::/56 3799:9F9F:F000::/52 2A2A::/48 +3194::/44 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX H + + + + +Practice for Chapter 24: Implementing IPv6 Addressing on Routers + +This appendix provides practice problems for two types of addresses: unicast addresses formed with the EUI-64 feature and solicited node multicast addresses. With EUI-64, you take the 64-bit (16 hex digit) prefix and a MAC address, manipulate the MAC address into a 64-bit value, and use those 64 bits as the interface ID. Solicited node multicast addresses are formed from a standard 26 hex digit prefix, combined with the same last 6 hex digits as the unicast address. + +EUI-64 and Solicited Node Multicast Problems +Table H-1 lists some practice problems. Each problem lists a prefix and a MAC address. Then, in Table H-2, record your answers for the unicast IPv6 address, assuming that EUI-64 rules are used. Also in Table H-2, list the solicited node multicast address associated with your calculated unicast address. + +For each answer, use the best abbreviation, instead of a full 32-digit address. + +The answers sit at the end of the appendix, in Table H-3. + +Table H-1 IPv6 EUI-64 Unicast and Solicited Node Multicast Problems + + +Prefix +1 2987:BA11:B011:B00A::/64 2 3100:0000:0000:1010::/64 3 FD00:0001:0001:0001::/64 4 FDDF:8080:0880:1001::/64 5 32CC:0000:0000:000D::/64 6 2100:000E:00E0:0000::/64 7 3A11:CA00:0000:0000::/64 8 3799:9F9F:F000:0000::/64 9 2A2A:0000:0000:0000::/64 +10 3194:0000:0000:0000::/64 + +MAC Address 0000.1234.5678 1234.5678.9ABC 0400.AAAA.0001 0611.BABA.DADA 0000.0000.0001 0505.0505.0707 0A0A.B0B0.0C0C F00F.0005.0041 0200.0101.0101 +0C0C.000C.00CC + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Table H-2 Blank Answer Table for Problems in Table H-1 + +Unicast Address Using EUI-64 Solicited Node Multicast Address 1 +2 3 4 5 6 7 8 9 10 + +Answers to EUI-64 and Solicited Node Multicast +Problems +Table H-3 lists the answers to the problems listed earlier in Table H-1. + +Table H-3 Answers to Problems in Table H-1 + + +Unicast Address Using EUI-64 +1 2987:BA11:B011:B00A:200:12FF:FE34:5678 2 3100::1010:1034:56FF:FE78:9ABC +3 FD00:1:1:1:600:AAFF:FEAA:1 +4 FDDF:8080:880:1001:411:BAFF:FEBA:DADA 5 32CC::D:200:FF:FE00:1 +6 2100:E:E0:0:705:5FF:FE05:707 +7 3A11:CA00::80A:B0FF:FEB0:C0C +8 3799:9F9F:F000:0:F20F:FF:FE05:41 9 2A2A::1FF:FE01:101 +10 3194::E0C:FF:FE0C:CC + +Solicited Node Multicast Address FF02::01:FF34.5678 FF02::01:FF78.9ABC FF02::01:FFAA:1 FF02::01:FFBA:DADA FF02::01:FF00:1 +FF02::01:FF05:707 FF02::01:FFB0:C0C FF02::01:FF05:41 FF02::01:FF01:101 +FF02::01:FF0C:CC + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix I + +Study Planner + + + +Practice Test Reading Task + + + + +Element + + +Introduction + +Task + + +Read Introduction + +Goal Date First Date Completed + +Second Date Notes Completed +(Optional) + +Your Study Plan Read Your Study Plan + +1. Introduction to TCP/IP Networking Read Foundation Topics + +Review Key Topics using the 1. Introduction to TCP/IP Networking book or companion website +Define Key Terms using the 1. Introduction to TCP/IP Networking book or companion website + +Repeat DIKTA questions using 1. Introduction to TCP/IP Networking the book or PTP exam engine + + +Practice Test + + +2. Fundamentals of Ethernet LANs + + +2. Fundamentals of Ethernet LANs + +2. Fundamentals of Ethernet LANs + + +2. Fundamentals of Ethernet LANs + + +2. Fundamentals of Ethernet LANs + + +Practice Test + +3. Fundamentals of WANs and IP Routing + +3. Fundamentals of WANs and IP Routing + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website + + + +|||||||||||||||||||| +|||||||||||||||||||| + +3. Fundamentals of WANs and IP Routing + +3. Fundamentals of WANs and IP Routing + +3. Fundamentals of WANs and IP Routing + +Practice Test + + +Part I. Introduction to Networking + + +Practice Test + + + +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part I Review +Take practice test in study mode using Part Review exam in practice test software for this +part + + +4. Using the Command-Line Interface Read Foundation Topics + +Review Key Topics using the 4. Using the Command-Line Interface book or companion website +Define Key Terms using the 4. Using the Command-Line Interface book or companion website + +Repeat DIKTA questions using 4. Using the Command-Line Interface the book or PTP exam engine + +4. Using the Command-Line Interface Review the command tables +Complete all memory tables in +this chapter using the 4. Using the Command-Line Interface companion website + + +Practice Test + +Take practice test in study mode using Part Review exam in practice test software for this chapter + +5. Analyzing Ethernet LAN Switching Read Foundation Topics + +Review Key Topics using the 5. Analyzing Ethernet LAN Switching book or companion website +Define Key Terms using the 5. Analyzing Ethernet LAN Switching book or companion website + +Repeat DIKTA questions using 5. Analyzing Ethernet LAN Switching the book or PTP exam engine + +Do labs listed for this chapter 5. Analyzing Ethernet LAN Switching using the Sim Lite app + +5. Analyzing Ethernet LAN Switching Review the command tables + + +Practice Test + +6. Configuring Basic Switch Management + +Take practice test in study mode using Part Review exam in practice test software for this chapter +Read Foundation Topics + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +6. Configuring Basic Switch Management +6. Configuring Basic Switch Management + +6. Configuring Basic Switch Management + +6. Configuring Basic Switch Management + +6. Configuring Basic Switch Management +6. Configuring Basic Switch Management + +Practice Test + +7. Configuring and Verifying Switch Interfaces + +7. Configuring and Verifying Switch Interfaces +7. Configuring and Verifying Switch Interfaces + +7. Configuring and Verifying Switch Interfaces +7. Configuring and Verifying Switch Interfaces + +7. Configuring and Verifying Switch Interfaces + +7. Configuring and Verifying Switch Interfaces + +Practice Test + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete config checklists in this chapter using the companion website +Do labs listed for this chapter using the Sim Lite app +Review command tables for this chapter +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Review command tables for this chapter +Complete all memory tables in this chapter using the companion website +Do labs listed for this chapter using the Sim Lite app +Take practice test in study mode using DIKTA exam in practice test software for this chapter + +Complete all exercises in Part Part II. Implementing Ethernet LANs II Review + + +Practice Test + +8. Implementing Ethernet Virtual LANs + +8. Implementing Ethernet Virtual LANs +8. Implementing Ethernet Virtual LANs + +8. Implementing Ethernet Virtual LANs + +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8. Implementing Ethernet Virtual LANs +8. Implementing Ethernet Virtual LANs + +8. Implementing Ethernet Virtual LANs + +8. Implementing Ethernet Virtual LANs + +8. Implementing Ethernet Virtual LANs + +Practice Test + + +9. Spanning Tree Protocol Concepts + + +9. Spanning Tree Protocol Concepts + +9. Spanning Tree Protocol Concepts + + +9. Spanning Tree Protocol Concepts + + +9. Spanning Tree Protocol Concepts + + +Practice Test + +10. RSTP and EtherChannel Configuration + +10. RSTP and EtherChannel Configuration +10. RSTP and EtherChannel Configuration + +10. RSTP and EtherChannel Configuration + +10. RSTP and EtherChannel Configuration +10. RSTP and EtherChannel Configuration + +10. RSTP and EtherChannel Configuration + +10. RSTP and EtherChannel Configuration + + + +Complete config checklists in this chapter using the companion website +Review command tables for this chapter +Complete all memory tables in this chapter using the companion website +Do labs listed for this chapter using the Sim Lite app + +Watch video for this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete config checklists in this chapter using the companion website +Review command tables for this chapter +Complete all memory tables in this chapter using the companion website +Do labs listed for this chapter using the Sim Lite app + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Practice Test + +Part III. Implementing VLANs and STP + +Practice Test + + +11. Perspectives on IPv4 Subnetting + + +11. Perspectives on IPv4 Subnetting + +11. Perspectives on IPv4 Subnetting + + +11. Perspectives on IPv4 Subnetting + + +11. Perspectives on IPv4 Subnetting + + +Practice Test + +12. Analyzing Classful IPv4 Networks + +12. Analyzing Classful IPv4 Networks +12. Analyzing Classful IPv4 Networks + +12. Analyzing Classful IPv4 Networks + +12. Analyzing Classful IPv4 Networks + + +12. Analyzing Classful IPv4 Networks + +Practice Test + + +13. Analyzing Subnet Masks + + +13. Analyzing Subnet Masks + +13. Analyzing Subnet Masks + + +13. Analyzing Subnet Masks + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part III Review +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Practice analyzing classful IPv4 networks using Appendix D on the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + +13. Analyzing Subnet Masks + + +13. Analyzing Subnet Masks + + +Practice Test + + +14. Analyzing Existing Subnets + + +14. Analyzing Existing Subnets + +14. Analyzing Existing Subnets + + +14. Analyzing Existing Subnets + + +14. Analyzing Existing Subnets + + +14. Analyzing Existing Subnets + + +14. Analyzing Existing Subnets + + +Practice Test + + +Part IV. IPv4 Addressing + + +Practice Test + +15. Operating Cisco Routers + + +15. Operating Cisco Routers + +15. Operating Cisco Routers + + +15. Operating Cisco Routers + +15. Operating Cisco Routers + + +15. Operating Cisco Routers + + +15. Operating Cisco Routers + + +15. Operating Cisco Routers + +Complete all memory tables in this chapter using the companion website +Practice analyzing subnet masks using Appendix E on the companion website Take practice test in study mode using DIKTA exam in +practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Practice mask analysis using Appendix F on the companion website +Practice analyzing existing subnets using Appendix F on the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part IV Review +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Review command tables for this chapter +Complete all memory tables in this chapter using the companion website +Do labs listed for this chapter using the Sim Lite app + +Watch video for this chapter using the companion website + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Practice Test + +16. Configuring IPv4 Addresses and Static Routes + +16. Configuring IPv4 Addresses and Static Routes +16. Configuring IPv4 Addresses and Static Routes + +16. Configuring IPv4 Addresses and Static Routes +16. Configuring IPv4 Addresses and Static Routes + +16. Configuring IPv4 Addresses and Static Routes + +Practice Test + + +17. IP Routing in the LAN + + +17. IP Routing in the LAN + +17. IP Routing in the LAN + + +17. IP Routing in the LAN + + +17. IP Routing in the LAN + +17. IP Routing in the LAN + + +17. IP Routing in the LAN + + +17. IP Routing in the LAN + + +Practice Test + + +18. Troubleshooting IPv4 Routing + + +18. Troubleshooting IPv4 Routing + +18. Troubleshooting IPv4 Routing + + +18. Troubleshooting IPv4 Routing + + + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Review command tables for this chapter +Do labs listed for this chapter using the Sim Lite app +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete config checklists in this chapter using the companion website +Review command tables for this chapter +Do labs listed for this chapter using the Sim Lite app + +Watch video for this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Watch video for this chapter using the companion website + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +Practice Test + + +Part V. IPv4 Routing + + +Practice Test + + +19. Understanding OSPF Concepts + + +19. Understanding OSPF Concepts + +19. Understanding OSPF Concepts + + +19. Understanding OSPF Concepts + + +19. Understanding OSPF Concepts + + +Practice Test + + +20. Implementing OSPF + + +20. Implementing OSPF + +20. Implementing OSPF + + +20. Implementing OSPF + + +20. Implementing OSPF + +20. Implementing OSPF + + +20. Implementing OSPF + + +Practice Test + +21. OSPF Network Types and Neighbors + +21. OSPF Network Types and Neighbors + +21. OSPF Network Types and Neighbors + + + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part V Review +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete config checklists in this chapter using the companion website +Review command tables for this chapter +Do labs listed for this chapter using the Sim Lite app +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website + +Repeat DIKTA questions using the book or PTP exam engine + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +21. OSPF Network Types and Neighbors + +21. OSPF Network Types and Neighbors + +Practice Test + + +Part VI. OSPF + + +Practice Test + + +22. Fundamentals of IP Version 6 + + +22. Fundamentals of IP Version 6 + +22. Fundamentals of IP Version 6 + + +22. Fundamentals of IP Version 6 + +22. Fundamentals of IP Version 6 + + +22. Fundamentals of IP Version 6 + + +Practice Test + + +23. IPv6 Addressing and Subnetting + + +23. IPv6 Addressing and Subnetting + +23. IPv6 Addressing and Subnetting + + +23. IPv6 Addressing and Subnetting + + +23. IPv6 Addressing and Subnetting + + +Practice Test + +Complete all memory tables in this chapter using the companion website +Watch video for this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part VI Review +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Review command tables for this chapter +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in +practice test software for this + +chapter +24. Implementing IPv6 Addressing on +Routers Read Foundation Topics + +24. Implementing IPv6 Addressing on Review Key Topics using the +Routers book or companion website +24. Implementing IPv6 Addressing on Define Key Terms using the Routers book or companion website + + +|||||||||||||||||||| +|||||||||||||||||||| + +24. Implementing IPv6 Addressing on Repeat DIKTA questions using +Routers the book or PTP exam engine +24. Implementing IPv6 Addressing on Review command tables for Routers this chapter +Complete all memory tables in 24. Implementing IPv6 Addressing on this chapter using the +Routers companion website + +24. Implementing IPv6 Addressing on Do labs listed for this chapter +Routers using the Sim Lite app + +24. Implementing IPv6 Addressing on Watch video for this chapter +Routers using the companion website + + +Practice Test + + +25. Implementing IPv6 Routing + + +25. Implementing IPv6 Routing + +25. Implementing IPv6 Routing + + +25. Implementing IPv6 Routing + +25. Implementing IPv6 Routing + + +25. Implementing IPv6 Routing + + +25. Implementing IPv6 Routing + + +Practice Test + + +Part VII. IP Version 6 + + +Practice Test + +26. Fundamentals of Wireless Networks + +26. Fundamentals of Wireless Networks +26. Fundamentals of Wireless Networks + +26. Fundamentals of Wireless Networks + +26. Fundamentals of Wireless Networks + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Review command tables for this chapter +Complete all memory tables in this chapter using the companion website +Do labs listed for this chapter using the author's blog site +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part VII Review +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Practice Test + +27. Analyzing Cisco Wireless Architectures + +27. Analyzing Cisco Wireless Architectures +27. Analyzing Cisco Wireless Architectures + +27. Analyzing Cisco Wireless Architectures + +27. Analyzing Cisco Wireless Architectures + +Practice Test + +28. Securing Wireless Networks + + +28. Securing Wireless Networks + +28. Securing Wireless Networks + + +28. Securing Wireless Networks + + +28. Securing Wireless Networks + + +Practice Test + + +29. Building a Wireless LAN + + +29. Building a Wireless LAN + +29. Building a Wireless LAN + + +29. Building a Wireless LAN + + +Practice Test + + +Part VIII. Wireless LANs + + +Practice Test + + + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part VII Review +Take practice test in study mode using Part Review exam in practice test software for this +part + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + +Final Review + + + +Final Review + + + +Final Review + + +Final Review + + +Final Review + + + +Final Review + +Take practice test in study mode for all Book Questions in practice test software +Review all Key Topics in all chapters or in the Key Topics App using the companion website +Review all Key Terms in all chapters or using the Key Terms Flashcards on the companion website Complete all memory tables for all chapters using the companion website +Take practice test in practice exam mode using Exam Bank #1 questions for all chapters + +Take practice test in practice exam mode using Exam Bank #2 questions for all chapters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX J + + + + +Topics from Previous Editions + +Cisco changes the exams, renaming the exams on occasion, and changing the exam numbers every time it changes the exam with a new blueprint, even with a few name changes over the years. As a result, the current CCNA 200-301 exam serves as the eighth separate version of CCNA in its 20-plus year history. At every change to the exams, we create new editions of the books to match the new exam. + +We base the books’ contents on Cisco’s exam topics; that is, the book attempts to cover the topics Cisco lists as exam topics. However, the book authoring process does create some challenges, particularly with the balance of what to include in the books and what to leave out. + +For instance, when comparing a new exam to the old, I found Cisco had removed some topics—and I might want to keep the content in the book. There are a few reasons why. Sometimes I just expect that some readers will still want to read about that technology. Also, more than a few schools use these books as textbooks, and keeping some of the older-but-still-relevant topics can be a help. And keeping the old material available on each book’s companion website takes only a little extra work, so we do just that. + +Some of the older topics that I choose to keep on the companion website are small, so I col-lect them into this appendix. Other topics happen to have been an entire chapter in a previ-ous edition of the books, so we include those topics each as a separate appendix. Regardless, the material exists here in this appendix, and in the appendices that follow, for your use if you have a need. But do not feel like you have to read this appendix for the current exam. + +The topics in this appendix are as follows: + +■ IPv4 Address Types +■ Bandwidth and Clock Rate on Serial Interfaces +■ Using traceroute to Isolate the Problem to Two Routers ■ Troubleshooting Static IPv6 Routes +■ Default Routes with SLAAC on Router Interfaces + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE The content under the heading “IPv4 Address Types” was most recently published for the 100-105 Exam in 2016, in Chapter 20 of the Cisco CCNA ICND1 100-105 Official Cert Guide. + + +IPv4 Address Types +The IPv4 address space includes three major categories of addresses: unicast, broadcast, and multicast. For the current exam, Cisco lists one exam topic that asks you to compare and contrast these address types. To help you make those comparisons, this section explains multicast addressing, while pulling together the key ideas about unicast and broadcast IP addresses that have already been introduced, to pull the ideas together. + +You may be wondering why this topic about IPv4 address types sits at the end of a chapter about DHCP and IP networking on hosts. Honestly, I could have put this topic in several chapters. The main reason it is here is that you have already seen the IP broadcast addresses in action, including the 255.255.255.255 local broadcast as shown in this chapter. + +Review of Unicast (Class A, B, and C) IP Addresses +Unicast IP addresses are those Class A, B, and C IP addresses assigned to hosts, router inter-faces, and other networking devices. Because most discussions about IP addressing refer to unicast IP addresses, most of us just refer to them as IP addresses, and leave out the word unicast. + +Just to be complete and define the concept, unicast addresses identify one interface on one device to IP. Just like your postal address gives the post office an address to use to send let-ters to your one specific house or apartment, a unicast IP address gives the IP network an address to use to send packets to one specific host. However, with IP, instead of addressing the device, unicast addresses identify individual interfaces. For example: + +■ A router with four LAN interfaces, and two WAN interfaces, has six unicast addresses, each in a different subnet, one for each interface. +■ A PC with both an Ethernet network interface card (NIC) and a wireless NIC would have two unicast IPv4 addresses, one for each interface. + +IP Broadcast Addresses +Broadcast IPv4 addresses give IP a way to send one packet that the network delivers to mul-tiple hosts. IPv4 defines several types of broadcast addresses, with each type being used to reach a different set of hosts. These different broadcast IP addresses give different overhead protocols like DHCP the ability to efficiently reach all hosts in a specific part of the net-work. The following list reviews the three IP broadcast address types: + +Local broadcast address: 255.255.255.255. Used to send a packet on a local subnet, knowing that routers will not forward the packet as is. Also called a limited broadcast. +Subnet broadcast address: One reserved address for each subnet, namely the numerically highest number in the subnet, as discussed in Chapter 13, “Analyzing Subnet Masks.” A packet sent to a subnet broadcast address can be routed to the router connected to that + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix J: Topics from Previous Editions + +subnet, and then sent as a data-link broadcast to all hosts in that one subnet. Also called an all-hosts broadcast to emphasize that all hosts in a subnet are reached, and also called a directed broadcast. +Network broadcast address: One reserved address for each classful network, namely the numerically highest number in the network. Used to send one packet to all hosts in that one network. Also called an all-subnets broadcast, referring to the fact that the packet reaches all subnets in a network. +This chapter has already shown how a local broadcast works, sending the message over the same subnet in which it was first transmitted, but no further. However, the other two types are a little more interesting. + +Subnet and network broadcasts provide a way to send packets to all hosts in a subnet or net-work (respectively) while reducing waste. For instance, with a subnet broadcast, routers for-ward the packet just like any other IP packet going to that subnet. When that packet arrives at the router connected to that subnet, the last router then encapsulates the packet in a LAN +broadcast, so that all hosts receive a copy. Figure J-1 shows the idea. + +3 + + + +J + + +3 Broadcast! + +10.1.1.0/24 + + +To 10.1.1.255 + +2 + + +R2 +10.1.2.0/24 + + +1 1 10.1.3.0/24 + + +R1 +10.1.9.0/24 + +R3 +172.16.1.0/24 + +Figure J-1 Example of a Subnet Broadcast to 10.1.1.255 + +The figure shows two key points. R1 does not flood or broadcast the frame to all other rout-ers, instead routing it to the next router (R2 in this case) so that the packet reaches subnet 10.1.1.0/24. R2, connected to subnet 10.1.1.0/24, forwards the packet onto the LAN, but encapsulates the packet in an Ethernet broadcast frame, so that it reaches all hosts in the subnet. + +The figure shows the intended use of the subnet broadcast address; however, it presents a security issue today. Many attacks start with a ping to subnet broadcast addresses, hoping to get many hosts to reply. Cisco changed the IOS default many years ago to disable the forwarding of subnet broadcasts onto a connected subnet (that is, it disables Step 3 in Figure J-1). That default setting is based on the no ip directed-broadcast interface subcommand. + +A network broadcast packet (a packet with a network broadcast address as the destination) works in a similar way. To reach all subnets, however, the routers create copies of the packet and flood it so it reaches all subnets inside the classful network. On any LAN interfaces, the packet is forwarded in a LAN broadcast, just as shown in Step 3 of Figure J-1. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +IPv4 Multicast Addresses (Class D Addresses) +Multicast IP addresses and the related protocols help solve a similar problem as compared to broadcast addresses, but mainly for applications, and without the same security issues experienced by broadcast addresses. To see how it works, consider this example. A video application may be designed to show live video feeds. If 10 people at the same remote site in the same subnet want to watch the same video at the same time, the application could be +designed so that the application sent the same video data 10 times, once to each client in the same subnet. An application designed to use Class D multicast addresses could send 1 pack-et, which the routers would route across the WAN, and then deliver a copy to all 10 hosts in the destination subnet. + +When using multicast, all the hosts still use their individual unicast IP address for their normal traffic, while also using the same multicast IPv4 address for the multicast applica-tion. Any server or client that happens to use an application designed to take advantage of IP multicast then also uses the Class D multicast addresses that the application chooses to use. You can think of a Class D address more as a multicast group—in fact, it is often called that—because hosts join the group so that they can receive the packets sent by the multicast application. + +Class D addresses begin with a first octet of between 224 and 239, with some ranges reserved for various purposes. Much of the Class D address space is set aside for a company to deploy one of these multicast applications, and then pick an address from the Class D range, and configure it to be used by a multicast application. + +As an example, imagine the video application uses Class D address 226.1.1.1. Figure J-2 illustrates the process by which the application at the server on the left sends one multicast packet with destination address 226.1.1.1. Note that for this process to work, the hosts with * beside them registered with their local routers to notify the routers that the host wants to +receive packets destined to multicast address 226.1.1.1. When the action in this figure begins, the routers collectively know which subnets have hosts that want a copy of multicasts sent to 226.1.1.1, and which subnets do not. + + + +4 + + +To 226.1.1.1 R2 +4 2 +1 3 5 + +* 1 ** 23 * 4 + +R1 R3 5 10.1.9.0/24 + +6 R4 +Figure J-2 Example of a Multicast Packet Flow for Three Registered Hosts + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix J: Topics from Previous Editions 5 + +Following the steps in the figure: + +1. The server on the left generates and sends a multicast packet. J 2. Router R1 replicates the packet to send a copy to both R2… +3. …and to R3. R1 does not replicate and send a copy to R4, because there are no hosts near R4 listening for packets sent to 226.1.1.1. +4. R2 processes the multicast packet received from R1, and because of the earlier host registration process, R2 knows that at least one host off both its LAN interfaces are listening for packets sent to 226.1.1.1. R2 therefore forwards a copy of the packet out each of its LAN interfaces. +5. R3 receives the multicast packet from R1, and uses the same kind of logic as R2. However, R3 knows from the earlier host registration process that only one of its LAN interfaces connects to a subnet with hosts listening for packets sent to 226.1.1.1, so R3 forwards a copy of the packet out that one interface only. + +As you can see from this example, the server sent one packet and the routers replicated the packet so it reached all the correct locations in the network. + +As another comparison between unicast and multicast addresses, note that multicast addresses may be used as destination IP addresses only, whereas unicast addresses may be used as both the destination and source address. For instance, consider the packets in the example shown in Figure J-2. All those packets flow from one host, so the packet uses a uni-cast IP address of that host’s unicast IP address. + +Finally, to complete one more comparison between unicast IP addressing and multicast IP addressing, think about that last hop router in the example shown in Figure J-1. If a router such as R2 or R3 had forwarded a unicast IP packet, the router would look in its ARP cache to find the unicast IP address for the destination in that connected subnets, and the associ-ated unicast MAC address. That will not work when forwarding a multicast packet with a multicast (Class D) destination IP address. + +To encapsulate a multicast IP packet over an Ethernet LAN, IP multicast calculates the des-tination MAC address with a simple process. The process copies the last 23 bits of the IP address behind a reserved 25-bit prefix to form the 48-bit destination MAC address. The resulting MAC address, called a multicast MAC address, begins with hex 01005E. So, the multicast IP packet, encapsulated in the multicast Ethernet frame, is forwarded out the rout-er interface onto the LAN. At that point, the switches take one of the following approaches to forwarding the frame so that all hosts who want a copy of the frame get a copy: + +■ Flood the multicast frame as if it were a broadcast +■ Use other Ethernet multicast features that flood the frame only to those same devices that registered to receive a copy + +If you feel like these few pages probably left out some detail; indeed, several books have been written about IP multicast all to itself. The topic is indeed large. For this book’s pur-poses, know the main comparison points with unicast addressing. Multicast addressing gives applications that need to communicate the same data at the same time to multiple hosts a much more efficient way to do that. If the application is written to make use of IP multicast, + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +the application can consume much less traffic in the network, as compared to using unicast IP addresses and sending every host a copy of the packet. + +Comparing and Contrasting IP Address Types +The last few pages reviewed unicast and broadcast addresses, and explained the core con-cepts behind IP multicast addresses. Table J-1 summarizes the key comparison points men-tioned throughout this section for convenient study. + +Table J-1 Comparisons of Unicast, Broadcast, and Multicast IP Addresses + + +Primarily used for data sent by the most common user apps (web, email, chat, and so on) +Assigned to hosts with DHCP + +Uses Class A, B, and C addresses + +Primarily used by overhead protocols (DHCP, ARP) to send one message to more than one device +Used as destination IP address only + +Primarily used by applications that send the same data at the same time to multiple clients +Uses Class D addresses + +Unicast Yes + +Yes + +Yes + +No + +No + +No + +No + +Broadcast No + +No + +No + +Yes + +Yes + +No + +No + +Multicast No + +No + +No + +No + +Yes + +Yes + +Yes + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix J: Topics from Previous Editions + + +NOTE The content under the heading “Bandwidth and Clock Rate on Serial Interfaces” was most recently published for the 100-105 Exam in 2016, in Chapter 17 of the CCENT/CCNA +ICND1 100-105 Official Cert Guide. + +7 + + + +J + + + +Bandwidth and Clock Rate on Serial Interfaces +WAN serial links can run at a wide variety of speeds. To deal with the wide range of speeds, routers physically slave themselves to the speed as dictated by the CSU/DSU through a pro-cess called clocking. As a result, routers can use serial links without the need for additional configuration or autonegotiation to sense the serial link’s speed. The CSU/DSU knows the speed, the CSU/DSU sends clock pulses over the cable to the router, and the router reacts to the clocking signal. + +To build a serial link in a home lab, the routers can use serial interface cards that normally use an external CSU/DSU, and make a serial link, without requiring the expense of two CSU/DSUs. Figure J-3 shows the concept. To make it work, the link uses two serial cables— one a DTE cable and the other a DCE cable—which swap the transmit and receive pair on the cables. + +clock rate Command Goes Here + + + + +DTE Router 1 +Serial +Cable + +DCE +Router 2 Serial +Cable + + +Tx Tx Tx Tx +Rx Rx Rx Rx DTE Cable DCE Cable +Figure J-3 Serial Link in Lab + +Using the correct cabling works, as long as you add one command: the clock rate interface subcommand. This command tells that router the speed at which to transmit bits on a serial link like the one shown in Figure J-3. The clock rate command is not needed on real serial links, because the CSU/DSU provides the clocking. When you create a serial link in the lab using cables, without any real CSU/DSUs on the link, the router with the DCE cable must supply that clocking function, and the clock rate command tells the router to provide it. + +NOTE Newer router IOS versions automatically add a default clock rate 2000000 com-mand on serial interfaces that have a DCE cable connected to them. While helpful, this speed might be too high for some types of back-to-back serial cables, so consider using a lower speed in lab. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Example J-1 shows the configuration of the clock rate command. The end of the example verifies that this router can use the clock rate command with the show controllers com-mand. This command confirms that R1 has a V.35 DCE cable connected. + +Example J-1 Router R1 Configuration with the clock rate Command + +R1# show running-config +! lines omitted for brevity +interface Serial0/0/0 +ip address 172.16.4.1 255.255.255.0 +clock rate 2000000 +! +interface Serial0/0/1 +ip address 172.16.5.1 255.255.255.0 +clock rate 128000 + +! lines omitted for brevity + +R1# show controllers serial 0/0/1 +Interface Serial0 +Hardware is PowerQUICC MPC860 +DCE V.35, clock rate 128000 +idb at 0x8169BB20, driver data structure at 0x816A35E4 +! Lines omitted for brevity + + + +NOTE The clock rate command does not allow just any speed to be configured. However, the list of speeds does vary from router to router. + +Some people confuse the router bandwidth command with the clock rate command. The clock rate command sets the actual Layer 1 speed used on the link, if no CSU/DSU is used, as just described. Conversely, every router interface has a bandwidth setting, either by default or configured. The bandwidth of the interface is the documented speed of the inter-face, which does not have to match the actual Layer 1 speed used on the interface. + +That bandwidth setting does not impact how fast the interface transmits data. Instead, rout-ers use the interface bandwidth setting as both documentation and as input to some other processes. For instance, the Open Shortest Path First (OSPF) and Enhanced Interior Gateway Routing Protocol (EIGRP) routing protocols base their routing protocol metrics on the band-width by default. + +Example J-2 highlights the bandwidth setting on Router R1’s S0/0/1 interface, as configured in the previous example. In that previous example, the clock rate 128000 command sets the clock rate to 128 kbps, but it leaves the bandwidth command unset. As a result, IOS uses the default serial bandwidth setting of 1544, which means 1544 kbps—which is the speed of a T1 serial link. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix J: Topics from Previous Editions 9 + +Example J-2 Router Bandwidth Settings + +R1# show interfaces s0/0/1 J Serial0/0/1 is up, line protocol is up +Hardware is WIC MBRD Serial +Description: link to R3 +Internet address is 10.1.13.1/24 +MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation HDLC, loopback not set + + +The common mistake people make is to know about clock rate, but mistakenly think that the bandwidth setting is just another term for “clock rate.” It is not. Follow these rules to find these two interface settings: + +To see the clock rate, look for the clock rate interface subcommand in the configuration, or use the show controllers serial number command (as shown in Example J-1.) +To see the bandwidth setting on an interface, look for the bandwidth interface subcom-mand in the configuration, or use the show interfaces [type number] command (as shown in Example J-2). +Note that using default bandwidth settings on most router interfaces makes sense, with the exception of serial interfaces. IOS defaults to a bandwidth of 1544 (meaning 1544 kbps, or 1.544 Mbps) for serial interfaces, regardless of the speed dictated by the provider or by a clock rate command in the lab. Most engineers set the bandwidth to match the actual speed, for example, using the bandwidth 128 interface subcommand on a link running at 128 +kbps. On Ethernet 10/100 or 10/100/1000 interfaces, the router knows the speed used, and dynamically sets the Ethernet interface’s bandwidth to match. + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE The content under the heading “Using traceroute to Isolate the Problem to Two Routers” was most recently published for the 100-105 Exam in 2016, in Chapter 23 of the Cisco CCNA ICND1 100-105 Official Cert Guide. + + +Using traceroute to Isolate the Problem to Two Routers One of the best features of the traceroute command, as compared to ping, is that when it does not complete it gives an immediate clue as to where to look next. With ping, when the ping fails, the next step is usually to use more ping commands. With traceroute, it tells you what router to try to connect and look at the routes and in which direction. + +NOTE As a reminder, this book uses the term forward route for routes that send the pack-ets sent by the ping or traceroute command, and reverse route for the packets sent back. + +When a problem exists, a traceroute command results in a partial list of routers. Then the command either finishes with an incomplete list or it runs until the user must stop the com-mand. In either case, the output does not list all routers in the end-to-end route, because of the underlying problem. + +NOTE In addition, the traceroute command may not finish even though the network has no problems. Routers and firewalls may filter the messages sent by the traceroute command, or the TTL Exceeded messages, which would prevent the display of portions or all or part of the path. + +The last router listed in the output of a traceroute command’s output tells us where to look next to isolate the problem, as follows: + +■ Connect to the CLI of the last router listed, to look at forward route issues. +■ Connect to the CLI of the next router that should have been listed, to look for reverse route issues. + +To see why, consider an example based on the internetwork in Figure J-4. In this case, R1 uses an extended traceroute to host 5.5.5.5, with source IP address 1.1.1.1. This command’s output lists router 2.2.2.2, then 3.3.3.3, and then the command cannot complete. + +TTL = 1 + +Confirms my Route to 5.5.5.5 + + +1.1.1.1 +R1 + + +2.2.2.2 +R2 + + +3.3.3.3 +R3 + +5.5.5.5 4.4.4.4 +R4 + + +Confirms my Route to 1.1.1.1 +TTL Exceeded + +Figure J-4 Messages That Cause the traceroute Command to List 2.2.2.2 + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix J: Topics from Previous Editions 11 + +First, Figure J-4 focuses on the first line of output: the line that lists first-hop router 2.2.2.2. + +The figure shows the TTL=1 message at the top and the TTL Exceeded message back on the J bottom. This first pair of messages in the figure must have worked, because without them, +the traceroute command on R1 cannot have learned about a router with address 2.2.2.2. The first (top) message required R1 to have a route for 5.5.5.5, which sent the packets to R2 next. The TTL Exceeded message required that R2 have a route that matched address 1.1.1.1, to send the packets back to R1’s LAN IP address. + +Next, Figure J-5 focuses on the messages that allow the second line of output on R1’s sample traceroute command: the line that correctly lists 3.3.3.3 as the next router in the route. + +TTL = 2 + +Confirms my Route to 5.5.5.5 + + +1.1.1.1 +R1 + + +2.2.2.2 +R2 + + +3.3.3.3 +R3 + +5.5.5.5 4.4.4.4 +R4 + + +Confirms my Route to 1.1.1.1 +TTL Exceeded + +Figure J-5 Messages That Cause the traceroute Command to List 3.3.3.3 + +Following the same logic, the traceroute output lists 3.3.3.3 because the messages in Figure J-5 must have worked. For these messages to flow, the routes listed in Figure J-4 must exist, plus new routes listed in 18-15. Specifically, the TTL=2 packet at the top requires R2 to have a route for 5.5.5.5, which sends the packets to R3 next. The TTL Exceeded message requires that R3 have a route that matches address 1.1.1.1, to send the packets back toward R1’s LAN IP address. + +In this example, the traceroute 5.5.5.5 command does not list any routers beyond 2.2.2.2 and 3.3.3.3 However, based on the figures, it is clear that 4.4.4.4 should be the next IP address listed. To help isolate the problem further, why might the next messages—the message with TTL=3 and the response—fail? + +Figure J-6 points out the routing issues that can cause this command to not be able to list 4.4.4.4 as the next router. First, R3 must have a forward route matching destination 5.5.5.5 and forwarding the packet to Router R4. The return message requires a reverse route match-ing destination 1.1.1.1 and forwarding the packet back to Router R3. + +In conclusion, for this example, if a routing problem prevents the traceroute command from working, the problem exists in one of two places: the forward route to 5.5.5.5 on Router R3, or the reverse route to 1.1.1.1 on R4. + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +TTL = 3 + +Use Working Route to 5.5.5.5 Problem with Route to 5.5.5.5? +5.5.5.5 + +1.1.1.1 +R1 + +2.2.2.2 +R2 + +3.3.3.3 +R3 + +4.4.4.4 +R4 + + +Use Working Route to 1.1.1.1 Problem with Route to 1.1.1.1? +TTL Exceeded + +Figure J-6 Issues That Could Prevent traceroute from Listing 4.4.4.4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix J: Topics from Previous Editions + + +NOTE The content under the heading “Troubleshooting Static IPv6 Routes” was most recently published in Chapter 32 of the Cisco CCNA ICND1 100-105 Official Cert Guide. + +13 + + + +J + + + +Troubleshooting Static IPv6 Routes +This last part of the chapter looks at troubleshooting IPv6 static routes, reviewing many of the same troubleshooting rules applied to IPv4 static routes, while focusing on the details specific to IPv6. + +This topic breaks static route troubleshooting into two perspectives: the route is in the rout-ing table but is incorrect and cases in which the route is not in the routing table. + +Troubleshooting Incorrect Static Routes That Appear in the IPv6 Routing Table +A static route is only as good as the input typed into the ipv6 route command. IOS checks the syntax of the command, of course. However, IOS cannot tell if you choose the incorrect outgoing interface, incorrect next-hop address, or incorrect prefix/prefix-length in a static route. If the parameters pass the syntax checks, IOS places the ipv6 route command into the running-config file. Then, if no other problem exists (as discussed at the next heading), IOS puts the route into the IP routing table—even though the route may not work because of the poorly chosen parameters. + +For instance, an exam question might show a figure with Router R1 having an address of 2001:1:1:1::1 and neighboring Router R2 with an address of 2001:1:1:1::2. If R1 lists a static route with the command ipv6 route 3333::/64 2001:1:1:1::1, the command would be accept-ed by IOS with correct syntax, but it would not be effective as a route. R1 cannot use its own IPv6 address as a next-hop address. IOS does not prevent the configuration of the com-mand, however; it allows the command and adds the route to the IPv6 routing table, but the route cannot possibly forward packets correctly. + +When you see an exam question that has static routes, and you see them in the output of show ipv6 route, remember that the routes may have incorrect parameters. Check for these types of mistakes: +Step 1. Prefix/Length: Does the ipv6 route command reference the correct subnet ID (prefix) and mask (prefix length)? + +Step 2. If using a next-hop IPv6 address that is a link-local address: + +A. Is the link-local address an address on the correct neighboring router? (It should be an address on another router on a shared link.) + +B. Does the ipv6 route command also refer to the correct outgoing interface on the local router? + +Step 3. If using a next-hop IPv6 address that is a global unicast or unique local address, is the address the correct unicast address of the neighboring router? + +Step 4. If referencing an outgoing interface, does the ipv6 route command reference the interface on the local router (that is, the same router where the static route is configured)? + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +This troubleshooting checklist works through the various cases in which IOS would accept the configuration of the static IPv6 route, but the route would not work because of the incorrect parameters in context. It helps to see a few examples. Figure J-7 shows a sample network to use for the examples; all the examples focus on routes added to Router R1, for the subnet on the far right. + +2001:DB8:9:1::/64 2001:DB8:9:2::/64 2001:DB8:9:3::/64 + + +::9 A G0/1 G0/2 +::1 R1 ::1 + +G0/1 G0/2 B ::9 ::2 R2 ::2 +FE80::2 + + +Figure J-7 Sample Topology for Incorrect IPv6 Route Examples + +Example J-3 shows five ipv6 route commands. All have correct syntax, but all have one incorrect value; that is, the route will not work because of the types of problems in the troubleshooting checklist. Look for the short comment at the end of each configuration command to see why each is incorrect. + +Example J-3 ipv6 route Commands with Correct Syntax but Incorrect Ideas + +ipv6 route 2001:DB8:9:33::/64 2001:DB8:9:2::2 ! Step 1: Wrong prefix +ipv6 route 2001:DB8:9:3::/64 G0/2 FE80::AAA9 ! Step 2A: Wrong neighbor link local +ipv6 route 2001:DB8:9:3::/64 FE80::2 ! Step 2B: Missing outgoing interface +ipv6 route 2001:DB8:9:3::/64 2001:DB8:9:2::1 ! Step 3: Wrong neighbor address +ipv6 route 2001:DB8:9:3::/64 G0/1 FE80::2 ! Step 4: Wrong interface on R1 + + +All these incorrect examples have correct syntax and would be added to R1’s IPv6 routing table if configured on R1. However, all have flaws. Working through the examples in order: + +Step 1. + +Step 2A. + + +Step 2B. + + + +Step 3. + + + + +Step 4. + + +The prefix (2001:DB8:9:33::) has a typo in the fourth quartet (33 instead of 3). + +The figure shows R2’s G0/1 with link-local address FE80::2, but the command uses FE80::AAA9. + +The command uses the correct link-local address on R2’s address on the com-mon link (FE80::2 per the figure), but it omits the outgoing interface of R1’s G0/2 interface. (See the next example for more detail.) + +The figure shows the subnet in the center as 2001:DB8:9:2::/64, with R1 using the ::1 address and R2 using ::2. For the fourth command, R1’s command should use R2’s address 2001:DB8:9:2::2, but it uses R1’s own 2001:DB8:9:2::1 address instead. + +As a command on R1, the outgoing interface references R1’s own interfaces. R1’s G0/1 is the interface on the left, whereas R1 should use its G0/2 interface on the +right when forwarding packets to subnet 2001:DB8:9:3::/64. + + + +The key takeaway for this section is to know that a route in the IPv6 routing table may be incorrect due to poor choices for the parameters. The parameters should always include the + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix J: Topics from Previous Editions + +neighboring router’s IPv6 addresses, but the local router’s interface type/number, and in all cases, the correct prefix/length. The fact that a route is in the IPv6 routing table, particularly a static route, does not mean it is a correct route. + +Note that of the five example commands in Example J-3, IOS would accept all of them except the third one. IOS can notice the case of omitting the outgoing interface if the next-hop address is a link-local address. Example J-4 shows a sample of the error message from +IOS. + +15 + + + +J + + +Example J-4 IOS Rejects the ipv6 route Command with Link-Local and No Outgoing Interface + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# ipv6 route 2001:DB8:9:3::/64 FE80::2 +% Interface has to be specified for a link-local nexthop +R1(config)# ^Z +R1# +R1# show running-config | include ipv6 route +R1# + + +The Static Route Does Not Appear in the IPv6 Routing Table +The preceding few pages focused on IPv6 static routes that show up in the IPv6 routing table but unfortunately have incorrect parameters. The next page looks at IPv6 routes that have correct parameters, but IOS does not place them into the IPv6 routing table. + +When you add an ipv6 route command to the configuration, and the syntax is correct, IOS considers that route to be added to the IPv6 routing table. IOS makes the following checks before adding the route; note that IOS uses this same kind of logic for IPv4 static routes: + +■ For ipv6 route commands that list an outgoing interface, that interface must be in an up/up state. +■ For ipv6 route commands that list a global unicast or unique local next-hop IP address (that is, not a link-local address), the local router must have a route to reach that next-hop address. +■ If another IPv6 route exists for that exact same prefix/prefix-length, the static route must have a better (lower) administrative distance. + +For example, Router R1, again from Figure J-7, has been configured with IPv6 address-es. Example J-5 shows the addition of an ipv6 route command for remote subnet +2001:DB8:9:3::/64, but with incorrect next-hop address 2001:DB8:9:3::2. That address is on R2, but it is the address on the far side of R2, on R2’s G0/2 interface. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +Example J-5 No Route for Next-Hop IPv6 Address in Static Route + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# ipv6 route 2001:DB8:9:3::/64 2001:DB8:9:3::2 +R1(config)# ^Z +R1# show ipv6 route +IPv6 Routing Table - default - 5 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP +H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea +IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO +ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect +RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid +a - Application +C 2001:DB8:9:1::/64 [0/0] +via GigabitEthernet0/1, directly connected +L 2001:DB8:9:1::1/128 [0/0] +via GigabitEthernet0/1, receive +C 2001:DB8:9:2::/64 [0/0] +via GigabitEthernet0/2, directly connected +L 2001:DB8:9:2::1/128 [0/0] +via GigabitEthernet0/2, receive +L FF00::/8 [0/0] +via Null0, receive + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix J: Topics from Previous Editions + + +NOTE The content under the heading “Default Routes with SLAAC on Router Interfaces” was most recently published in Chapter 32 of the Cisco CCNA ICND1 100-105 Official +Cert Guide. + +17 + + + +J + + + +Default Routes with SLAAC on Router Interfaces Routers can use DHCP on their own interface and learn their IP address, mask, and even a +default IPv4 route. In particular, that process can be useful on a router that connects to the Internet. The enterprise router uses DHCP as a client, learning its own IPv4 address with DHCP and adding a default route pointing to the ISP’s router as the next-hop IPv4 address. +Routers can accomplish the same goals with IPv6, just with a few different protocols and methods. As with IPv4, the IPv6 enterprise router can dynamically learn its IPv6 address and dynamically create a default IPv6 route to the ISP’s router. This section shows the details, with the enterprise router using SLAAC to learn its address and the information needed to create a default route. + +First, the enterprise router that connects to the ISP, like Router R1 in Figure J-8, requires the configuration of the interface subcommand ipv6 address autoconfig default. This command tells the router that, on that interface, use SLAAC to build its own IPv6 address. R1 would act like any host that uses SLAAC, as shown in Step 2 of the figure, and send an NDP RS message over the link. As noted at Step 3, the ISP router would send back an RA message, announcing router ISP1’s IPv6 address and the IPv6 prefix used on the link. + +1 ipv6 address autoconfig default + +2 2001:DB8:1:12::1/64 B01 NDP RS +Internet R1 ISP1 +3 Router is 2001:DB8:1:12::1 B02 Prefix is 2002:DB8:1:12::/64 + +NDP RA +Figure J-8 Enterprise Router Using SLAAC to Build IPv6 Address and Default IPv6 Route + +When R1 receives the NDP RA message, it does the following: + +Interface address: Builds its own interface IPv6 address using the SLAAC process, based on the prefix in the RA. +Local /128 Route: Adds a local (/128) IPv6 route for the address, as it would for any inter-face IPv6 address. +Connected Route for Prefix: Adds a connected (/64) route for the prefix learned in the NDP RA message. +Default route: R1 adds a default route, to destination ::/0, with the next-hop address of ISP’s link-local address, as learned in the RA sent by router ISP1. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +Note that the router can be configured to add this default route or not. As shown in the figure, the router builds a default route. Using the ipv6 address autoconfig subcommand without the default keyword causes the router to build its address with SLAAC but not add a default route. + +Example J-6 shows the three IPv6 routes on Router R1 just mentioned in the list. In particu-lar, note the codes for the connected route and the default route; both codes begin with ND, meaning the route was learned with NDP. In particular, as highlighted in the legend part of the output, ND refers to an NDP-learned default route, and NDp refers to an NDP-learned prefix (as listed in the NDP RA message in Figure J-9 in this case). Note also that these same two routes have an administrative distance of 2, which is the default administrative distance of IPv6 routes learned with NDP. + +Example J-6 Learning an Address and Default Static Route with DHCP + +R1# show ipv6 route +IPv6 Routing Table - default - 4 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP +H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea +IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO +ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect +O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, la - LISP alt +lr - LISP site-registrations, ld - LISP dyn-eid, a - Application +ND ::/0 [2/0] +via FE80::22FF:FE22:2222, Serial0/0/0 +NDp 2001:DB8:1:12::/64 [2/0] +via Serial0/0/0, directly connected +L 2001:DB8:1:12:32F7:DFF:FE29:8560/128 [0/0] +via Serial0/0/0, receive +! lines omitted for brevity + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX K + + + + +Analyzing Ethernet LAN Designs + + + +NOTE This appendix contains an entire chapter that was published as a chapter in one of the past editions of this book or a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more. However, note that the content in this appendix has not been edited since it was published in the earlier edition, so references to exams and exam topics, and to other chapters, will be outdated. +This appendix was previously published as Chapter 10 of the book CCENT/CCNA ICND1 100-105 Official Cert Guide, published in 2016. + + + +Ethernet defines what happens on each Ethernet link, but the more interesting and more detailed work happens on the devices connected to those links: the network interface cards (NIC) inside devices and the LAN switches. This chapter takes the Ethernet LAN basics introduced in Chapter 2, “Fundamentals of Ethernet LANs,” and dives deeply into many aspects of a modern Ethernet LAN, while focusing on the primary device used to create these LANs: LAN switches. + +This chapter breaks down the discussion of Ethernet and LAN switching into two sections. The first major section looks at the logic used by LAN switches when forwarding Ethernet frames, along with the related terminology. The second section considers design and imple-mentation issues, as if you were building a new Ethernet LAN in a building or campus. This second section considers design issues, including using switches for different purposes, when to choose different types of Ethernet links, and how to take advantage of Ethernet autonegotiation. + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Analyzing Collision Domains and Broadcast Domains Ethernet devices, and the logic they use, have a big impact on why engineers design modern LANs in a certain way. Some of the terms used to describe key design features come from far back in the history of Ethernet, and because of their age, the meaning of each term +may or may not be so obvious to someone learning Ethernet today. This first section of the chapter looks at two of these older terms in particular: collision domain and broadcast +domain. And to understand these terms and apply them to modern Ethernet LANs, this sec-tion needs to work back through the history of Ethernet a bit, to put some perspective on the meaning behind these terms. + +Ethernet Collision Domains +The term collision domain comes from the far back history of Ethernet LANs. To be hon-est, sometimes people new to Ethernet can get a little confused about what this term really means in the context of a modern Ethernet LAN, in part because modern Ethernet LANs, done properly, can completely prevent collisions. So to fully understand collision domains, we must first start with a bit of Ethernet history. This next section of the chapter looks at a few of the historical Ethernet devices, for the purpose of defining a collision domain, and then closing with some comments about how the term applies in a modern Ethernet LAN that uses switches. + +10BASE-T with Hub +10BASE-T, introduced in 1990, significantly changed the design of Ethernet LANs, more like the designs seen today. 10BASE-T introduced the cabling model similar to today’s Ethernet LANs, with each device connecting to a centralized device using an unshielded twisted-pair (UTP) cable. However, 10BASE-T did not originally use LAN switches; instead, the early 10BASE-T networks used a device called an Ethernet hub. (The technology required to build even a basic LAN switch was not yet available at that time.) + +Although both a hub and a switch use the same cabling star topology, an Ethernet hub does not forward traffic like a switch. Ethernet hubs use physical layer processing to forward data. A hub does not interpret the incoming electrical signal as an Ethernet frame, look at the source and destination MAC address, and so on. Basically, a hub acts like a repeater, just with lots of ports. When a repeater receives an incoming electrical signal, it immediately forwards a regenerated signal out all the other ports except the incoming port. Physically, the hub just sends out a cleaner version of the same incoming electrical signal, as shown in Figure K-1, with Larry’s signal being repeated out the two ports on the right. + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 3 + + +Larry 1 2 Archie + +Bob Hub 2 +Figure K-1 10BASE-T (with a Hub): The Hub Repeats Out All Other Ports K + +Because of the physical layer operation used by the hub, the devices attached to the net-work must use carrier sense multiple access with collision detection (CSMA/CD) to take turns (as introduced at the end of Chapter 2). Note that the hub itself does not use CSMA/ CD logic; the hub always receives an electrical signal and starts repeating a (regenerated) sig-nal out all other ports, with no thought of CSMA/CD. So, although a hub’s logic works well to make sure all devices get a copy of the original frame, that same logic causes frames to collide. Figure K-2 demonstrates that effect, when the two devices on the right side of the figure send a frame at the same time, and the hub physically transmits both electrical signals out the port to the left (toward Larry). + + + +Larry 2 + +Collision! +Hub 1 + +Archie 1A + +1B +Bob + + +Figure K-2 Hub Operation Causing a Collision + +Because a hub makes no attempt to prevent collisions, the devices connected to it all sit within the same collision domain. A collision domain is the set of NICs and device ports for which if they sent a frame at the same time, the frames would collide. In Figures K-1 and K-2, all three PCs are in the same collision domain, as well as the hub. Summarizing the key points about hubs: + +■ The hub acts a multiport repeater, blindly regenerating and repeating any incoming elec-trical signal out all other ports, even ignoring CSMA/CD rules. +■ When two or more devices send at the same time, the hub’s actions cause an electrical collision, making both signals corrupt. +■ The connected devices must take turns by using carrier sense multiple access with colli-sion detection (CSMA/CD) logic, so the devices share the bandwidth. +■ Hubs create a physical star topology. + +Ethernet Transparent Bridges +From a design perspective, the introduction of 10BASE-T was a great improvement over the earlier types of Ethernet. It reduced cabling costs and cable installation costs, and improved the availability percentages of the network. But sitting here today, thinking of a LAN in which all devices basically have to wait their turn may seem like a performance issue, and it was. If Ethernet could be improved to allow multiple devices to send at the same time with-out causing a collision, Ethernet performance could be improved. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +The first method to allow multiple devices to send at the same time was Ethernet transpar-ent bridges. Ethernet transparent bridges, or simply bridges, made these improvements: + +■ Bridges sat between hubs and divided the network into multiple collision domains. +■ Bridges increase the capacity of the entire Ethernet, because each collision domain is basically a separate instance of CSMA/CD, so each collision domain can have one sender at a time. + +Figure K-3 shows the effect of building a LAN with two hubs, each separated by a bridge. The resulting two collision domains each support at most 10 Mbps of traffic each, com-pared to at most 10 Mbps if a single hub were used. + + +1 Collision Domain, Sharing 10 Mbps + +Fred + + +Barney +Hub + +1 Collision Domain, Sharing 10 Mbps + +Wilma + + +Betty +Bridge Hub + + + +Figure K-3 Bridge Creates Two Collision Domains and Two Shared Ethernets + +Bridges create multiple collision domains as a side effect of their forwarding logic. A bridge makes forwarding decisions just like a modern LAN switch; in fact, bridges were the prede-cessors of the modern LAN switch. Like switches, bridges hold Ethernet frames in memory, waiting to send out the outgoing interface based on CSMA/CD rules. In other cases, the bridge does not even need to forward the frame. For instance, if Fred sends a frame destined to Barney’s MAC address, then the bridge would never forward frames from the left to the right. + +Ethernet Switches and Collision Domains +LAN switches perform the same basic core functions as bridges but at much faster speeds and with many enhanced features. Like bridges, switches segment a LAN into separate col-lision domains, each with its own capacity. And if the network does not have a hub, each single link in a modern LAN is considered its own collision domain, even if no collisions can actually occur in that case. + +For example, Figure K-4 shows a simple LAN with a switch and four PCs. The switch cre-ates four collision domains, with the ability to send at 100 Mbps in this case on each of the four links. And with no hubs, each link can run at full duplex, doubling the capacity of each link. + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 5 + +Fred Four Possible Collision Domains Wilma + + +100 Mbps F0/1 Full Duplex + +100 Mbps + +F0/3 100 Mbps Full Duplex + +100 Mbps K + + + +Full Duplex F0/2 Barney + +F0/4 Full Duplex +Betty + + +Figure K-4 Switch Creates Four Collision Domains and Four Ethernet Segments + +Now take a step back for a moment and think about some facts about modern Ethernet LANs. Today, you build Ethernet LANs with Ethernet switches, not with Ethernet hubs or bridges. The switches connect to each other. And every single link is a separate colli-sion domain. + +As strange as it sounds, each of those collision domains in a modern LAN may also never have a collision. Any link that uses full duplex—that is, both devices on the link use full duplex—does not have collisions. In fact, running with full duplex is basically this idea: No collisions can occur between a switch and a single device, so we can turn off CSMA/CD by running full duplex. + +NOTE The routers in a network design also create separate collision domains, because frames entering or exiting one router LAN interface do not collide with frames on another of the router’s LAN interfaces. + +The Impact of Collisions on LAN Design +So, what is the useful takeaway from this discussion about collision domains? A long time ago, collisions were normal in Ethernet, so analyzing an Ethernet design to determine where the collision domains were was useful. On the other end of the spectrum, a modern campus LAN that uses only switches (and no hubs or transparent bridges), and full duplex on all links, has no collisions at all. So does the collision domain term still matter today? And do we need to think about collisions even still today? + +In a word, the term collision domain still matters, and collisions still matter, in that network engineers need to be ready to understand and troubleshoot exceptions. Whenever a port that could use full duplex (therefore avoiding collisions) happens to use half duplex—by incorrect configuration, by the result of autonegotiation, or any other reason—collisions can now occur. In those cases, engineers need to be able identify the collision domain. + +Summarizing the key points about collision domains: + +■ LAN switches place each separate interface into a separate collision domain. +■ LAN bridges, which use the same logic as switches, placed each interface into a separate collision domain. +■ Routers place each LAN interface into a separate collision domain. (The term collision domain does not apply to WAN interfaces.) +■ LAN hubs do not place each interface into a separate collision domain. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +■ A modern LAN, with all LAN switches and routers, with full duplex on each link, would not have collisions at all. +■ In a modern LAN with all switches and routers, even though full duplex removes colli-sions, think of each Ethernet link as a separate collision domain when the need to trou-bleshoot arises. + +Figure K-5 shows an example with a design that includes hubs, bridges, switches, and routers—a design that you would not use today, but it makes a good backdrop to remind us about which devices create separate collision domains. + +1 2 Five Collision Domains 3 4 + + + + +Hub Bridge Hub Router Switch + +Figure K-5 Example of a Hub Not Creating Multiple Collision Domains, While Others Do + +Ethernet Broadcast Domains +Take any Ethernet LAN, and pick any device. Then think of that device sending an Ethernet broadcast. An Ethernet broadcast domain is the set of devices to which that broadcast is delivered. + +To begin, think about a modern LAN for a moment, and where a broadcast frame flows. Imagine that all the switches still used the switch default to put each interface into VLAN 1. As a result, a broadcast sent by any one device would be flooded to all devices connected to all switches (except for the device that sent the original frame). For instance, in Figure +K-6, under the assumption that all ports are still assigned to VLAN 1, a broadcast would flow to all the devices shown in the figure. + + +D1 D1 + + + + +A1 A2 ..... A39 A40 One VLAN! + + +10/100/1000 10/100/1000 10/100/1000 10/100/1000 + +Figure K-6 A Single Large Broadcast Domain + +Of all the common networking devices discussed in this book, only a router does not for-ward a LAN broadcast. Hubs of course forward broadcasts, because hubs do not even think about the electrical signal as an Ethernet frame. Bridges and switches use the same forward-ing logic, flooding LAN broadcasts. Routers, as a side effect of their routing logic, do not forward Ethernet broadcast frames, so they separate a network into separate broadcast domains. Figure K-7 collects those thoughts into a single example. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 7 + +Two Broadcast Domains +1 2 3 4 + + + +K Hub Bridge Hub Router Switch + +Figure K-7 Broadcast Domains Separated by a Router + +By definition, broadcasts sent by a device in one broadcast domain are not forwarded to devices in another broadcast domain. In this example, there are two broadcast domains. The router does not forward a LAN broadcast sent by a PC on the left to the network segment on the right. + +Virtual LANs +Routers create multiple broadcast domains mostly as a side effect of how IP routing works. While a network designer might set about to use more router interfaces for the purpose of making a larger number of smaller broadcast domains, that plan quickly consumes router interfaces. But a better tool exists, one that is integrated into LAN switches and consumes no additional ports: virtual LANs (VLAN). + +By far, VLANs give the network designer the best tool for designing the right number of broadcast domains, of the right size, with the right devices in each. To appreciate how VLANs do that, you must first think about one specific definition of what a LAN is: + +A LAN consists of all devices in the same broadcast domain. + +With VLANs, a switch configuration places each port into a specific VLAN. The switches create multiple broadcast domains by putting some interfaces into one VLAN and other interfaces into other VLANs. The switch forwarding logic does not forward frames from a port in one VLAN out a port into another VLAN—so the switch separates the LAN into +separate broadcast domains. Instead, routers must forward packets between the VLANs by using routing logic. So, instead of all ports on a switch forming a single broadcast domain, the switch separates them into many, based on configuration. + +For perspective, think about how you would create two different broadcast domains with switches if the switches had no concept of VLANs. Without any knowledge of VLANs, +a switch would receive a frame on one port and flood it out all the rest of its ports. Therefore, to make two broadcast domains, two switches would be used—one for each broadcast domain, as shown in Figure K-8. + +Dino Wilma + +Fred SW1 SW2 Betty + +Left Broadcast Domain Right Broadcast Domain + +Figure K-8 Sample Network with Two Broadcast Domains and No VLANs + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Alternatively, with a switch that understands VLANs, you can create multiple broadcast domains using a single switch. All you do is put some ports in one VLAN and some in the other. (The Cisco Catalyst switch interface subcommand to do so is switchport access vlan 2, for instance, to place a port into VLAN 2.) Figure K-9 shows the same two broad-cast domains as in Figure K-8, now implemented as two different VLANs on a single switch. + +VLAN 1 VLAN 2 + +Dino Wilma + +Fred SW1 Betty + +Left Broadcast Domain Right Broadcast Domain + +Figure K-9 Sample Network with Two VLANs Using One Switch + +This section briefly introduces the concept of VLANs, but Chapter 11, “Implementing Ethernet Virtual LANs,” discusses VLANs in more depth, including the details of how to configure VLANs in campus LANs. + +The Impact of Broadcast Domains on LAN Design +Modern LAN designs try to avoid collisions, because collisions make performance worse. There is no benefit to keeping collisions in the network. However, a LAN design cannot remove broadcasts, because broadcast frames play an important role in many protocols. So when thinking about broadcast domains, the choices are more about tradeoffs rather than designing to remove broadcasts. + +For just one perspective, just think about the size of a broadcast domain—that is, the num-ber of devices in the same broadcast domain. A small number of large broadcast domains can lead to poor performance for the devices in that broadcast domain. However, moving in the opposite direction, to making a large number of broadcast domains each with just a few devices, leads to other problems. + +Consider the idea of a too-large broadcast domain for a moment. When a host receives a broadcast, the host must process the received frame. All hosts need to send some broad-casts to function properly, so when a broadcast arrives, the NIC must interrupt the com-puter’s CPU to give the incoming message to the CPU. The CPU must spend time think-ing about the received broadcast frame. (For example, IP Address Resolution Protocol [ARP] messages are LAN broadcasts, as mentioned in Chapter 4, “Fundamentals of IPv4 +Addressing and Routing.”) So, broadcasts happen, which is good, but broadcasts do require all the hosts to spend time processing each broadcast frame. The more devices in the same broadcast domain, the more unnecessary interruptions of each device’s CPU. + +This section of the book does not try to give a sweeping review of all VLAN design trad-eoffs. Instead, you can see that the size of a VLAN should be considered, but many other factors come in to play as well. How big are the VLANs? How are the devices grouped? Do VLANs span across all switches or just a few? Is there any apparent consistency to the VLAN design, or is it somewhat haphazard? Answering these questions helps reveal what the designer was thinking, as well as what the realities of operating a network may have required. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 9 + + +NOTE If you would like more detail about Cisco recommendations about what to put in what VLAN, which impacts the size of VLANs, read the most recent Cisco document, “Campus LAN validated design” by searching on that phrase at Cisco.com. + +Summarizing the main points about broadcast domains: K +■ Broadcasts exists, so be ready to analyze a design to define each broadcast domain, that is, each set of devices whose broadcasts reach the other devices in that domain. +■ VLANs by definition are broadcast domains created though configuration. +■ Routers, because they do not forward LAN broadcasts, create separate broadcast domains off their separate Ethernet interfaces. + +Analyzing Campus LAN Topologies +The term campus LAN refers to the LAN created to support the devices in a building or in multiple buildings in somewhat close proximity to one another. For example, a company might lease office space in several buildings in the same office park. The network engineers can then build a campus LAN that includes switches in each building, plus Ethernet links between the switches in the buildings, to create a larger campus LAN. + +When planning and designing a campus LAN, the engineers must consider the types of Ethernet available and the cabling lengths supported by each type. The engineers also need to choose the speeds required for each Ethernet segment. In addition, some thought needs to be given to the idea that some switches should be used to connect directly to end-user devices, whereas other switches might need to simply connect to a large number of these end-user switches. Finally, most projects require that the engineer consider the type of equipment that is already installed and whether an increase in speed on some segments is worth the cost of buying new equipment. + +This second of three major sections of the chapter discusses the topology of a campus LAN design. Network designers do not just plug in devices to any port and connect switches to each other in an arbitrary way, like you might do with a few devices on the same table in a lab. Instead, there are known better ways to design the topology of a campus LAN, and this section introduces some of the key points and terms. The last major section of the chapter then looks at how to choose which Ethernet standard to use for each link in that campus LAN design, and why you might choose one versus another. + +Two-Tier Campus Design (Collapsed Core) +To sift through all the requirements for a campus LAN, and then have a reasonable conver-sation about it with peers, most Cisco-oriented LAN designs use some common terminol-ogy to refer to the design. For this book’s purposes, you should be aware of some of the key campus LAN design terminology. + +The Two-Tier Campus Design +Figure K-10 shows a typical design of a large campus LAN, with the terminology included in the figure. This LAN has around 1000 PCs connected to switches that support around 25 ports each. Explanations of the terminology follow the figure. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +To WAN + + +R1 + +2 x 10 GbE +D1 +Uplinks GigE + + +R2 + +2 Distribution Distribution D1 Switches +Layer + +GigE + + + + + +A1 A2 ..... A39 A40 + +40 Access Access Switches Layer + + + +10/100/1000 10/100/1000 10/100/1000 10/100/1000 ≈ 1000 PCs + +Figure K-10 Campus LAN with Design Terminology Listed + +Cisco uses three terms to describe the role of each switch in a campus design: access, dis-tribution, and core. The roles differ based on whether the switch forwards traffic from user devices and the rest of the LAN (access), or whether the switch forwards traffic between other LAN switches (distribution and core). + +Access switches connect directly to end users, providing user device access to the LAN. Access switches normally send traffic to and from the end-user devices to which they are connected and sit at the edge of the LAN. + +Distribution switches provide a path through which the access switches can forward traffic to each other. By design, each of the access switches connects to at least one distribution switch, typically to two distribution switches for redundancy. The distribution switches provide the service of forwarding traffic to other parts of the LAN. Note that most designs use at least two uplinks to two different distribution switches (as shown in Figure K-10) for redundancy. + +The figure shows a two-tier design, with the tiers being the access tier (or layer) and the dis-tribution tier (or layer). A two-tier design solves two major design needs: + +■ Provides a place to connect end-user devices (the access layer, with access switches) +■ Connects the switches with a reasonable number of cables and switch ports by connect-ing all 40 access switches to two distribution switches + +Topology Terminology Seen Within a Two-Tier Design +The exam topics happen to list a couple of terms about LAN and WAN topology and design, so this is a good place to pause to discuss those terms for a moment. + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix K: Analyzing Ethernet LAN Designs + +First, consider these more formal definitions of four topology terms: + +Star: A design in which one central device connects to several others, so that if you drew the links out in all directions, the design would look like a star with light shining in all directions. +Full mesh: For any set of network nodes, a design that connects a link between each pair of nodes. +Partial mesh: For any set of network nodes, a design that connects a link between some pairs of nodes, but not all. In other words, a mesh that is not a full mesh. +Hybrid: A design that combines topology design concepts into a larger (typically more complex) design. + +11 + + + + + + +K + + +Armed with those formal definitions, note that the two-tier design is indeed a hybrid design that uses both a star topology at the access layer and a partial mesh at the distribution layer. To see why, consider Figure K-11. It redraws a typical access layer switch, but instead of putting the PCs all below the switch, it spreads them around the switch. Then on the right, a similar version of the same drawing shows why the term star might be used—the topology looks a little like a child’s drawing of a star. + + + + + + + + + + + + +Figure K-11 The Star Topology Design Concept in Networking + +The distribution layer creates a partial mesh. If you view the access and distribution switch-es as nodes in a design, some nodes have a link between them, and some do not. Just refer to Figure K-10 and note that, by design, none of the access layer switches connect to each other. + +Finally, a design could use a full mesh. However, for a variety of reasons beyond the scope of the design discussion here, a campus design typically does not need to use the number of links and ports required by a full mesh design. However, just to make the point, first con-sider how many links and switch ports would be required for a single link between nodes in a full mesh, with six nodes, as shown in Figure K-12. + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + + + +D1 D2 + + + + + +D6 D3 + + + + + +D5 D4 + +Figure K-12 Using a Full Mesh at the Distribution Layer, 6 Switches, 15 Links + +Even with only six switches, a full mesh would consume 15 links (and 30 switch ports—two per link). + +Now think about a full mesh at the distribution layer for a design like Figure K-10, with 40 access switches and two distribution switches. Rather than drawing it and counting it, the number of links is calculated with this old math formula from high school: N(N – 1) / 2, or in this case, 42 * 41 / 2 = 861 links, and 1722 switch ports consumed among all switches. + +For comparison’s sake, the partial mesh design of Figure K-10, with a pair of links from each access switch to each distribution switch, requires only 160 links and a total of 320 ports among all switches. + +Three-Tier Campus Design (Core) +The two-tier design of Figure K-10, with a partial mesh of links at the distribution layer, happens to be the most common campus LAN design. It also goes by two common names: a two-tier design (for obvious reasons), and a collapsed core (for less obvious reasons). The term collapsed core refers to the fact that the two-tier design does not have a third tier, the core tier. This next topic examines a three-tier design that does have a core, for perspective. + +Imagine your campus has just two or three buildings. Each building has a two-tier design inside the building, with a pair of distribution switches in each building and access switches spread around the building as needed. How would you connect the LANs in each build-ing? Well, with just a few buildings, it makes sense to simply cable the distribution switches together, as shown in Figure K-13. + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 13 + +Building 1 Building 2 + +A11 A21 + + +D11 D21 +A12 A22 + + +A13 A23 D12 D22 + + +K + + +A14 A24 + + + +D31 D32 + + + +A31 A32 A33 A34 + +Building 3 + +Figure K-13 Two-Tier Building Design, No Core, Three Buildings + +The design in Figure K-13 works well, and many companies use this design. Sometimes the center of the network uses a full mesh, sometimes a partial mesh, depending on the avail-ability of cables between the buildings. + +However, a design with a third tier (a core tier) saves on switch ports and on cables in larger designs. And note that with the links between buildings, the cables run outside, are often more expensive to install, are almost always fiber cabling with more expensive switch ports, so conserving the number of cables used between buildings can help reduce costs. + +A three-tier core design, unsurprisingly at this point, adds a few more switches (core switch-es), which provide one function: to connect the distribution switches. Figure K-14 shows the migration of the Figure K-13 collapsed core (that is, a design without a core) to a three-tier core design. + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +Building 1 Building 2 + + +A11 A21 + +D11 Core1 D21 +A12 A22 + + +A13 A23 D12 Core2 D22 + +A14 A24 + + + +D31 D32 + + + +A31 A32 A33 A34 + +Building 3 + +Figure K-14 Three-Tier Building Design (Core Design), Three Buildings + +NOTE The core switches sit in the middle of the figure. In the physical world, they often sit in the same room as one of the distribution switches, rather than in some purpose-built room in the middle of the office park. The figure focuses more on the topology rather than the physical location. + +By using a core design, with a partial mesh of links in the core, you still provide connectivity to all parts of the LAN, and to the routers that send packets over the WAN, just with fewer links between buildings. + +The following list summarizes the terms that describe the roles of campus switches: + +■ Access: Provides a connection point (access) for end-user devices. Does not forward frames between two other access switches under normal circumstances. +■ Distribution: Provides an aggregation point for access switches, providing connectivity to the rest of the devices in the LAN, forwarding frames between switches, but not con-necting directly to end-user devices. +■ Core: Aggregates distribution switches in very large campus LANs, providing very high forwarding rates for the larger volume of traffic due to the size of the network. + +Topology Design Terminology +The ICND1 and CCNA exam topics specifically mention several network design terms related to topology. This next topic summarizes those key terms to connect the terms to the matching ideas. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 15 + +First, consider Figure K-15, which shows a few of the terms. First, on the left, drawings often show access switches with a series of cables, parallel to each other. However, an access switch and its access links is often called a star topology. Why? Look at the redrawn access switch in the center of the figure, with the cables radiating out from the center. It does not look like a real star, but it looks a little like a child’s drawing of a star, hence the term star topology. +K + +D1 D2 + + +SW1 SW1 + +A1 A2 + + +Access Switch + +Figure K-15 + +Access Switch: Star Uplinks: Partial Mesh + +LAN Design Terminology + + +The right side of the figure repeats a typical two-tier design, focusing on the mesh of links between the access and distribution switches. Any group of nodes that connect with more links than a star topology is typically called a mesh. In this case, the mesh is a partial mesh, because not all nodes have a direct link between each other. A design that connects all nodes with a link would be a full mesh. +Real networks make use of these topology ideas, but often a network combines the ideas together. For instance, the right side of Figure K-14 combines the star topology of the access layer with the partial mesh of the distribution layer. So you might hear these designs that combine concepts called a hybrid design. + +Analyzing LAN Physical Standard Choices +When you look at the design of a network designed by someone else, you can look at all the different types of cabling used, the different types of switch ports, and the Ethernet standards used in each case. Then ask yourself: Why did they choose a particular type +of Ethernet link for each link in the network? Asking that question, and investigating the answer, starts to reveal much about building the physical campus LAN. +The IEEE has done an amazing job developing Ethernet standards that give network design-ers many options. Two themes in particular have helped Ethernet grow over the long term: +■ The IEEE has developed many additional 802.3 standards for different types of cabling, different cable lengths, and for faster speeds. +■ All the physical standards rely on the same consistent data-link details, with the same standard frame formats. That means that one Ethernet LAN can use many types of physi-cal links to meet distance, budget, and cabling needs. +For example, think about the access layer of the generic design drawings, but now think about cabling and Ethernet standards. In practice, access layer switches sit in a locked wiring closet somewhere on the same floor as the end user devices. Electricians have installed unshielded twisted-pair (UTP) cabling used at the access layer, running from that wiring closet to each wall plate at each office, cubicle, or any place where an Ethernet device might need to connect to the LAN. The type and quality of the cabling installed + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +between the wiring closet and each Ethernet outlet dictate what Ethernet standards can be supported. Certainly, whoever designed the LAN at the time the cabling was installed thought about what type of cabling was needed to support the types of Ethernet physical standards that were going to be used in that LAN. + +Ethernet Standards +Over time, the IEEE has continued to develop and release new Ethernet standards, for new faster speeds and to support new and different cabling types and cable lengths. Figure K-16 shows some insight into Ethernet speed improvements over the years. The early standards up through the early 1990s ran at 10 Mbps, with steadily improving cabling and topologies. Then, with the introduction of Fast Ethernet (100 Mbps) in 1995, the IEEE began ramping up the speeds steadily over the next few decades, continuing even until today. + + +Thicknet (DIX) + +10M + +Thinnet (IEEE) + +10M + +Ethernet 10Base-T + +10M + +Fast Ethernet + +100M + +Gigabit 10 Ethernet Gig E + +1G 10G + +40 100 Gig E Gig E + +40G 100G + + +1980 1985 1990 1995 2000 2005 2010 + +Figure K-16 Ethernet Standards Timeline + +NOTE Often, the IEEE first introduces support for the next higher speed using some forms of fiber optic cabling, and later, sometimes many years later, the IEEE completes the work to develop standards to support the same speed on UTP cabling. Figure K-16 shows the earliest standards for each speed, no matter what cabling. + +When the IEEE introduces support for a new type of cabling, or a faster speed, they create a new standard as part of 802.3. These new standards have a few letters behind the name. So, when speaking of the standards, sometimes you might refer to the standard name (with letters). For instance, the IEEE standardized Gigabit Ethernet support using inexpensive UTP cabling in standard 802.3ab. However, more often, engineers refer to that same stan-dard as 1000BASE-T or simply Gigabit Ethernet. Table K-1 lists some of the IEEE 802.3 physical layer standards and related names for perspective. + +Table K-1 IEEE Physical Layer Standards + + +Original IEEE Standard +802.3i 802.3u 802.3z 802.3ab 802.3ae 802.3an 802.3ba +802.3ba + +Shorthand Name +10BASE-T 100BASE-T 1000BASE-X 1000BASE-T 10GBASE-X 10GBASE-T 40GBASE-X +100GBASE-X + +Informal Names + +Ethernet +Fast Ethernet +Gigabit Ethernet, GigE Gigabit Ethernet, GigE 10 GigE +10 GigE 40 GigE +100 GigE + +Speed + +10 Mbps 100 Mbps +1000 Mbps (1 Gbps) 1000 Mbps (1 Gbps) 10 Gbps +10 Gbps 40 Gbps +100 Gbps + +Typical Cabling +UTP UTP Fiber UTP Fiber UTP Fiber +Fiber + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 17 + +Choosing the Right Ethernet Standard for Each Link +When designing an Ethernet LAN, you can and should think about the topology, with an access layer, a distribution layer, and possibly a core layer. But thinking about the topology does not tell you which specific standards to follow for each link. Ultimately, you need to +pick which Ethernet standard to use for each link, based on the following kinds of facts +about each physical standard: K + +■ The speed +■ The maximum distance allowed between devices when using that standard/cabling ■ The cost of the cabling and switch hardware +■ The availability of that type of cabling already installed at your facilities + +Consider the three most common types of Ethernet today (10BASE-T, 100BASE-T, and 1000BASE-T). They all have the same 100-meter UTP cable length restriction. They all use UTP cabling. However, not all UTP cabling meets the same quality standard, and as it turns out, the faster the Ethernet standard, the higher the required cable quality category needed to support that standard. As a result, some buildings might have better cabling that supports speeds up through Gigabit Ethernet, whereas some buildings may support only Fast Ethernet. + +The Telecommunications Industry Association (TIA; tiaonline.org) defines Ethernet cabling quality standards. Each Ethernet UTP standard lists a TIA cabling quality (called a category) as the minimum category that the standard supports. For example, 10BASE-T allows for Category 3 (CAT3) cabling or better. 100BASE-T requires higher-quality CAT5 cabling, and 1000BASE-T requires even higher-quality CAT5e cabling. (The TIA standards follow a gen-eral “higher number is better cabling” in their numbering.) For instance, if an older facility had only CAT5 cabling installed between the wiring closets and each cubicle, the engineers would have to consider upgrading the cabling to fully support Gigabit Ethernet. Table K-2 lists the more common types of Ethernet and their cable types and length limitations. +Table K-2 Ethernet Types, Media, and Segment Lengths (Per IEEE) + + +Ethernet Type 10BASE-T 100BASE-T 1000BASE-T 10GBASE-T 10GBASE-T1 1000BASE-SX 1000BASE-LX +1000BASE-LX + +Media +TIA CAT3 or better, 2 pairs +TIA CAT5 UTP or better, 2 pairs TIA CAT5e UTP or better, 4 pairs TIA CAT6a UTP or better, 4 pairs TIA CAT6 UTP or better, 4 pairs Multimode fiber +Multimode fiber +9-micron single-mode fiber + +Maximum Segment Length 100 m (328 feet) +100 m (328 feet) 100 m (328 feet) 100 m (328 feet) +38–55 m (127–180 feet) 550 m (1800 feet) +550 m (1800 feet) +5 km (3.1 miles) + +1 The option for 10GBASE-T with slightly less quality CAT6 cabling, but at shorter distances, is an attempt to support 10Gig Ethernet for some installations with CAT6 installed cabling. + +Ethernet defines standards for using fiber optic cables as well. Fiber optic cables include ultrathin strands of glass through which light can pass. To send bits, the switches can alter-nate between sending brighter and dimmer light to encode 0s and 1s on the cable. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +Generally comparing optical cabling versus UTP cabling Ethernet standards, two obvious points stand out. Optical standards allow much longer cabling, while generally costing more for the cable and the switch hardware components. Optical cables experience much less inter-ference from outside sources compared to copper cables, which allows for longer distances. + +When considering optical Ethernet links, many standards exist, but with two general catego-ries. Comparing the two, the cheaper options generally support distances into the hundreds of meters, using less expensive light-emitting diodes (LED) to transmit data. Other optical standards support much longer distances into multiple kilometers, using more expensive cabling and using lasers to transmit the data. The trade-off is basic: For a given link, how long does the cable need to run, what standards support that distance, and which is the least expensive to meet that need? + +In reality, most engineers remember only the general facts from tables like Table K-2: 100 meters for UTP, about 500 meters for multimode fiber, and about 5000 meters for some single mode fiber Ethernet standards. When it is time to get serious about designing the details of each link, the engineer must get into the details, calculating the length of each cable based on its path through the building, and so on. + +Wireless LANs Combined with Wired Ethernet +Modern campus LANs include a large variety of wireless devices that connect to the access layer of the LAN. As it turns out, Cisco organizes wireless LANs into a separate certification track—CCNA, CCNP, and CCIE Wireless—so the CCNA R&S track has traditionally had only a little wireless LAN coverage. The current version of the exams are no different, with this one exam CCNA R&S topic mentioning wireless LANs: + +Describe the impact of infrastructure components in an enterprise network: Access points and wireless controllers + +Do not let that small mention of wireless technology make you think that wireless is less important than Ethernet. In fact, there may be more wireless devices than wired at the access layer of today’s enterprise networks. Both are important; Cisco just happens to keep the educational material for wireless in a separate certification track. + +This last topic in the chapter examines that one exam topic that mentions two wireless terms. + +Home Office Wireless LANs +First, the IEEE defines both Ethernet LANs and Wireless LANs. In case it was not obvi-ous yet, all Ethernet standards use cables—that is, Ethernet defines wired LANs. The IEEE 802.11 working group defines Wireless LANs, also called Wi-Fi per a trademarked term from the Wi-Fi Alliance (wi-fi.org), a consortium that helps to encourage wireless LAN development in the marketplace. + +Most of you have used Wi-Fi, and may use it daily. Some of you may have set it up at home, with a basic setup as shown in Figure K-17. In a home, you probably used a single consumer device called a wireless router. One side of the device connects to the Internet, while the other side connects to the devices in the home. In the home, the devices can connect either with Wi-Fi or with a wired Ethernet cable. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix K: Analyzing Ethernet LAN Designs 19 + +SOHO + + + + + + +UTP R1 + + +CATV Cable + +ISP/Internet K + + + +Figure K-17 A Typical Home Wired and Wireless LAN + +While the figure shows the hardware as a single router icon, internally, that one wireless router acts like three separate devices you would find in an enterprise campus: + +■ An Ethernet switch, for the wired Ethernet connections +■ A wireless access point (AP), to communicate with the wireless devices and forward the frames to/from the wired network +■ A router, to route IP packets to/from the LAN and WAN (Internet) interfaces + +Figure K-18 repeats the previous figure, breaking out the internal components as if they were separate physical devices, just to make the point that a single consumer wireless router acts like several different devices. + +SOHO + + + + + + + +UTP UTP R1 + +CATV Cable +UTP Cable Modem + + +ISP/Internet + + + +Figure K-18 A Representation of the Functions Inside a Consumer Wireless Routing Product + +In a small office/home office (SOHO) wireless LAN, the wireless AP acts autonomously, doing all the work required to create and control the wireless LAN (WLAN). (In most enter-prise WLANs, the AP does not act autonomously.) In other words, the autonomous AP communicates with the various wireless devices using 802.11 protocols and radio waves. It uses Ethernet protocols on the wired side. It converts between the differences in header formats between 802.11 and 802.3 frames before forwarding to/from 802.3 Ethernet and 802.11 wireless frames. + +Beyond those basic forwarding actions, the autonomous AP must perform a variety of con-trol and management functions. The AP authenticates new devices, defines the name of the WLAN (called a service set ID, or SSID), and other details. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +20 CCNA 200-301 Official Cert Guide, Volume 1 + +Enterprise Wireless LANs and Wireless LAN Controllers +If you connect to your WLAN at home from your tablet, phone, or laptop, and then walk down the street with that same device, you expect to lose your Wi-Fi connection at some point. You do not expect to somehow automatically connect to a neighbor’s Wi-Fi net-work, particularly if they did the right thing and set up security functions on their AP to prevent others from accessing their home Wi-Fi network. The neighborhood does not cre-ate one WLAN supported by the devices in all the houses and apartments; instead, it has lots of little autonomous WLANs. + +However, in an enterprise, the opposite needs to happen. We want people to be able to roam around the building and office campus and keep connected to the Wi-Fi network. This requires many APs, which work together rather than autonomously to create one wire-less LAN. + +First, think about the number of APs an enterprise might need. Each AP can cover only a certain amount of space, depending on a large number of conditions and the wireless stan-dard. (The size varies, but the distances sit in the 100 to 200 feet range.) At the same time, you might have the opposite problem; you may just need lots of APs in a small space, just to add capacity to the WLAN. Much of the time spent designing WLANs revolves around deciding how many APs to place in each space, and of what types, to handle the traffic. + +NOTE If you have not paid attention before, start looking around the ceilings of any new buildings you enter, even retail stores, and look for their wireless APs. + +Each AP must then connect to the wired LAN, because most of the destinations that wire-less users need to communicate with sit in the wired part of the network. In fact, the APs typically sit close to where users sit, for obvious reasons, so the APs connect to the same access switches as the end users, as shown in Figure K-19. + + +D1 D2 + + + + + +A1 A2 A3 A4 + + + + + + + + + + +1 + +Figure K-19 + +2 + +Campus LAN, Multiple Lightweight APs, with Roaming + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix K: Analyzing Ethernet LAN Designs + +Now imagine that is you at the bottom of the figure. Your smartphone has Wi-Fi enabled, so that when you walk into work, your phone automatically connects to the company WLAN. You roam around all day, going to meetings, lunch, and so on. All day long you stay connect-ed to the company WLAN, but your phone connects to and uses many different APs. + +Supporting roaming and other enterprise WLAN features by using autonomous APs can be difficult at best. You could imagine that if you had a dozen APs per floor, you might have hundreds of APs in a campus—all of which need to know about that one WLAN. + +The solution: remove all the control and management features from the APs, and put them in one centralized place, called a Wireless Controller, or Wireless LAN Controller (WLC). The APs no longer act autonomously, but instead act as lightweight APs (LWAPs), just for-warding data between the wireless LAN and the WLC. All the logic to deal with roaming, defining WLANs (SSIDs), authentication, and so on happens in the centralized WLC rather than on each AP. Summarizing: + +Wireless LAN controller: Controls and manages all AP functions (for example, roaming, defining WLANs, authentication) +Lightweight AP (LWAP): Forwards data between the wired and wireless LAN, and specifically forwarding data through the WLC using a protocol like Control And Provisioning of Wireless Access Points (CAPWAP) + +21 + + + + + + +K + + +With the WLC and LWAP design, the combined LWAPs and WLC can create one big wireless network, rather than creating a multitude of disjointed wireless networks. The key to making it all work is that all wireless traffic flows through the WLC, as shown in Figure K-20. (The LWAPs commonly use a protocol called CAPWAP, by the way.) + + + +2 + +D1 D2 WLC + + + + +A1 A2 A3 A4 + + + +1 + +Figure K-20 Campus LAN, Multiple Lightweight APs, with Roaming + +By forwarding all the traffic through the WLC, the WLC can make the right decisions across the enterprise. For example, you might create a marketing WLAN, an engineer-ing WLAN, and so on, and all the APs know about and support those multiple different +WLANs. Users that connect to the engineering WLAN should use the same authentication rules regardless of which AP they use—and the WLC makes that possible. Or consider + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +22 CCNA 200-301 Official Cert Guide, Volume 1 + +roaming for a moment. If at one instant a packet arrives for your phone, and you are associ-ated with AP1, and when the next packet arrives over the wired network you are now con-nected to AP4, how could that packet be delivered through the network? Well, it always goes to the WLC, and because the WLC keeps in contact with the APs and knows that your phone just roamed to another AP, the WLC knows where to forward the packet. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX L + + + + +Subnet Design + + + +NOTE This appendix contains an entire chapter that was published as a chapter in one of the past editions of this book or a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more. However, note that the content in this appendix has not been edited since it was published in the earlier edition, so references to exams and exam topics, and to other chapters, will be outdated. +This appendix was previously published as Chapter 21 of the book CCENT/CCNA ICND1 100-105 Official Cert Guide, published in 2016. + + + +So far in this book, most of the discussion about IPv4 used examples with the addresses and masks already given. This book has shown many examples already, but the examples so far do not ask you to pick the IP address or pick the mask. Instead, as discussed back in Chapter 11, “Perspectives on IPv4 Subnetting,” this book so far has assumed that someone else designed the IP addressing and subnetting plan, and this book shows how to implement it. + +This chapter turns that model around. It goes back to the progression of building and imple-menting IPv4, as discussed in Chapter 11, as shown in Figure L-1. This chapter picks up the story right after some network engineer has chosen a Class A, B, or C network to use for the enterprise’s IPv4 network. And then this chapter discusses the design choices related to picking one subnet mask to use for all subnets (the first major section) and what subnet IDs that choice creates (the second major section). + + +Analyze Needs +• # Subnets +• # Hosts/Subnet • 1 Size Subnet + +Design Subnets +• Choose Network • Choose 1 Mask • List All Subnets + +Plan Implementation +• Subnets Locations • Static IP +• DHCP Ranges + + +Figure L-1 Subnet Design and Implementation Process from Chapter 11 + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Choosing the Mask(s) to Meet Requirements +This first major section examines how to find all the masks that meet the stated require-ments for the number of subnets and the number of hosts per subnet. To that end, the text assumes that the designer has already determined these requirements and has chosen the network number to be subnetted. The designer has also made the choice to use a single sub-net mask value throughout the classful network. + +Armed with the information in this chapter, you can answer questions such as the following, a question that matters both for real engineering jobs and the Cisco exams: + +You are using Class B network 172.16.0.0. You need 200 subnets and 200 hosts/subnet. Which of the following subnet mask(s) meet the requirements? (This question is then fol-lowed by several answers that list different subnet masks.) + +To begin, this section reviews the concepts in Chapter 13’s section “Choose the Mask.” That section introduced the main concepts about how an engineer, when designing subnet con-ventions, must choose the mask based on the requirements. + +After reviewing the related concepts from Chapter 13, this section examines this topic in more depth. In particular, this chapter looks at three general cases: + +■ No masks meet the requirements. +■ One and only one mask meets the requirements. ■ Multiple masks meet the requirements. + +For this last case, the text discusses how to determine all masks that meet the requirements and the trade-offs related to choosing which one mask to use. + +Review: Choosing the Minimum Number of Subnet and Host Bits The network designer must examine the requirements for the number of subnets and number of hosts/subnet, and then choose a mask. As discussed in detail in Chapter 15, +“Analyzing Subnet Masks,” a classful view of IP addresses defines the three-part structure of an IP address: network, subnet, and host. The network designer must choose the mask so that the number of subnet and host bits (S and H, respectively, in Figure L-2) meet the requirements. + + +Need X Subnets: 2S ≥ X? + +Need Y Hosts/Subnet: 2H-2 ≥ Y? + + + +N S H + +Figure L-2 Choosing the Number of Subnet and Host Bits + +Basically, the designer must choose S subnet bits so that the number of subnets that can be uniquely numbered with S bits (2S) is at least as large as the required number of subnets. The + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 3 + +designer applies similar logic to the number of host bits H, while noting that the formula is 2H – 2, because of the two reserved numbers in each subnet. So, keeping the powers of 2 handy, as shown in Table L-1, will be useful when working through these problems. + +Table L-1 Powers of 2 Reference for Designing Masks + + +Number 2X of Bits +1 2 2 4 3 8 +4 16 + +Number 2X of Bits +5 32 6 64 7 128 +8 256 + +Number 2X of Bits +9 512 10 1024 11 2048 +12 4096 + +Number 2X of Bits +13 8192 +14 16,384 L +15 32,768 +16 65,536 + + +More formally, the process must determine the minimum values for both S and H that meet the requirements. The following list summarizes the initial steps to choose the mask: +Step 1. Determine the number of network bits (N) based on the class. +Step 2. Determine the smallest value of S, so that 2S => X, where X represents the required number of subnets. +Step 3. Determine the smallest value of H, so that 2H – 2 => Y, where Y represents the required number of hosts/subnet. + +The next three sections examine how to use these initial steps to choose a subnet mask. + +No Masks Meet Requirements +After you determine the required number of subnet and host bits, those bits might not fit into a 32-bit IPv4 subnet mask. Remember, the mask always has a total of 32 bits, with binary 1s in the network and subnet parts and binary 0s in the host part. For the exam, a +question might provide a set of requirements that simply cannot be met with 32 total bits. + +For example, consider the following sample exam question: + +A network engineer is planning a subnet design. The engineer plans to use Class B net-work 172.16.0.0. The network has a need for 300 subnets and 280 hosts per subnet. Which of the following masks could the engineer choose? + +The three-step process shown in the previous section shows that these requirements mean that a total of 34 bits will be needed, so no mask meets the requirements. First, as a Class B network, 16 network bits exist, with 16 host bits from which to create the subnet part and to leave enough host bits to number the hosts in each subnet. For the number of subnet bits, S=8 does not work, because 28 = 256 < 300. However, S=9 works, because 29 = 512 => 300. Similarly, because 28 – 2 = 254, which is less than 300, 8 host bits are not enough but 9 host bits (29 – 2 = 510) are just enough. + +These requirements do not leave enough space to number all the hosts and subnet, because the network, subnet, and host parts add up to more than 32: + +N=16, because as a Class B network, 16 network bits exist. +The minimum S=9, because S=8 provides too few subnets (28 = 256 < 300) but S=9 pro-vides 29 = 512 subnets. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +The minimum H=9, because H=8 provides too few hosts (28 – 2 = 254 < 280) but H=9 provides 29 – 2 = 510 hosts/subnet. + +Figure L-3 shows the resulting format for the IP addresses in this subnet, after the engi-neer has allocated 9 subnet bits on paper. Only 7 host bits remain, but the engineer needs 9 host bits. + + + +Minimum: S = 9 + +Minimum: H = 9 +Only 7 Left! + + + +N = 16 S = 9 H = 7 + +Figure L-3 Too Few Bits for the Host Part, Given the Requirements + +One Mask Meets Requirements +The process discussed in this chapter in part focuses on finding the smallest number of sub-net bits and the smallest number of host bits to meet the requirements. If the engineer tries to use these minimum values, and the combined network, subnet, and host parts add up to exactly 32 bits, exactly one mask meets the requirements. + +For example, consider a revised version of the example in the previous section, with smaller numbers of subnet and hosts, as follows: + +A network engineer is planning a subnet design. The engineer plans to use Class B net-work 172.16.0.0. The network has a need for 200 subnets and 180 hosts per subnet. Which of the following masks could the engineer choose? + +The three-step process to determine the numbers of network, minimum subnet, and mini-mum host bits results in a need for 16, 8, and 8 bits, respectively. As before, with a Class B network, 16 network bits exist. With a need for only 200 subnets, S=8 does work, because 28 = 256 => 200; 7 subnet bits would not supply enough subnets (27 = 128). Similarly, because 28 – 2 = 254 => 180, 8 host bits meet the requirements; 7 host bits (for 126 total hosts/subnet) would not be enough. + +Figure L-4 shows the resulting format for the IP addresses in this subnet. + + +Minimum: S = 8 + +Minimum: H = 8 + + + +/P = N + S = /24 + +N = 16 S = 8 H = 8 + +32 Bits + +Figure L-4 One Mask That Meets Requirements + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 5 + +Figure L-4 shows the mask conceptually. To find the actual mask value, simply record the mask in prefix format (/P), where P = N + S or, in this case, /24. + +Multiple Masks Meet Requirements +Depending on the requirements and choice of network, several masks might meet the require-ments for the numbers of subnets and hosts/subnet. In these cases, you need to find all the masks that could be used. Then, you have a choice, but what should you consider when choosing one mask among all those that meet your requirements? This section shows how to +find all the masks, as well as the facts to consider when choosing one mask from the list. L Finding All the Masks: Concepts +To help you better understand how to find all the subnet masks in binary, this section uses two major steps. In the first major step, you build the 32-bit binary subnet mask on paper. You write down binary 1s for the network bits, binary 1s for the subnet bits, and binary 0s for the host bits, just as always. However, you will use the minimum values for S and H. And when you write down these bits, you will not have 32 bits yet! + +For example, consider the following problem, similar to the earlier examples in this chapter but with some changes in the requirements: + +A network engineer is planning a subnet design. The engineer plans to use Class B net-work 172.16.0.0. The network has a need for 50 subnets and 180 hosts per subnet. Which of the following masks could the engineer choose? + +This example is similar to an earlier example, except that only 50 subnets are needed in this case. Again, the engineer is using private IP network 172.16.0.0, meaning 16 network bits. The design requires only 6 subnet bits in this case, because 26 = 64 => 50, and with only 5 subnet bits, 25 = 32 < 50. The design then requires a minimum of 8 host bits. + +One way to discuss the concepts and find all the masks that meet these requirements is to write down the bits in the subnet mask: binary 1s for the network and subnet parts and +binary 0s for the host part. However, think of the 32-bit mask as 32-bit positions, and when writing the binary 0s, write them on the far right. Figure L-5 shows the general idea. + + +Minimum: S = 6 + +Minimum: H = 8 + + + +11111111 11111111 111111__ 00000000 Network Subnet Host + +Figure L-5 Incomplete Mask with N=16, S=6, and H=8 + +Figure L-5 shows 30 bits of the mask, but the mask must have 32 bits. The 2 remaining bits might become subnet bits, being set to binary 1. Alternatively, these 2 bits could be made host bits, being set to binary 0. The engineer simply needs to choose based on whether he would like more subnet bits, to number more subnets, or more host bits, to number more hosts/subnet. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +Regardless of the requirements, when choosing any IPv4 subnet mask, you must always fol-low this rule: + +A subnet mask begins with all binary 1s, followed by all binary 0s, with no interleaving of 1s and 0s. + +With the example shown in Figure L-5, with 2 open bits, one value (binary 01) breaks this rule. However, the other three combinations of 2 bits (00, 10, and 11) do not break the rule. As a result, three masks meet the requirements in this example, as shown in Figure L-6. + + +S = 6 + +11111111 11111111 111111 + +H = 8 + +00000000 + + + +/22 11111111 /23 11111111 +/24 11111111 + + +11111111 11111111 +11111111 + + +11111100 11111110 +11111111 + + +00000000 00000000 +00000000 + + +S=6 H=10 S=7 H=9 +S=8 H=8 + + + +Legend: minimum value + +Figure L-6 Three Masks That Meet the Requirements + +In the three masks, the first has the least number of subnet bits among the three masks, but therefore has the most number of host bits. So, the first mask maximizes the number of hosts/subnet. The last mask uses the minimum value for the number of host bits, therefore using the most number of subnet bits allowed while still meeting the requirements. As a result, the last mask maximizes the number of subnets allowed. + +Finding All the Masks: Math +Although the concepts related to the example shown in Figures L-5 and L-6 are important, you can find the range of masks that meets the requirements more easily just using some simple math. The process to find the masks just requires a few steps, after you know N and the minimum values of S and H. The process finds the value of /P when using the least num-ber of subnet bits, and when using the least number of host bits, as follows: +Step 1. Calculate the shortest prefix mask (/P) based on the minimum value of S, where P = N + S. +Step 2. Calculate the longest prefix mask (/P) based on the minimum value of H, where P = 32 – H. +Step 3. The range of valid masks includes all /P values between the two values calcu-lated in the previous steps. + +For example, in the example shown in Figure L-6, N = 16, the minimum S = 6, and the minimum H = 8. The first step identifies the shortest prefix mask (the /P with the smallest value of P) of /22 by adding N and S (16 + 6). The second step identifies the longest prefix mask that meets the requirements by subtracting the smallest possible value for H (8, in this + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 7 + +case) from 32, for a mask of /24. The third step reminds us that the range is from /22 to /24, meaning that /23 is also an option. + +Choosing the Best Mask +When multiple possible masks meet the stated requirements, the engineer has a choice of masks. That, of course, begs some questions: Which mask should you choose? Why would one mask be better than the other? The reasons can be summarized into three main options: + +To maximize the number of hosts/subnet: To make this choice, use the shortest prefix +mask (that is, the mask with the smallest /P value), because this mask has the largest host L +part. +To maximize the number of subnets: To make this choice, use the longest prefix mask (that is, the mask with the largest /P value), because this mask has the largest subnet part. +To increase both the numbers of supported subnets and hosts: To make this choice, choose a mask in the middle of the range, which gives you both more subnet bits and more host bits. + +For example, in Figure L-6, the range of masks that meet the requirements is /22 – /24. The shortest mask, /22, has the least subnet bits but the largest number of host bits (10) of the three answers, maximizing the number of hosts/subnet. The longest mask, /24, maximizes the number of subnet bits (8), maximizing the number of subnets, at least among the options that meet the original requirements. The mask in the middle, /23, provides some growth in both subnets and hosts/subnet. + +The Formal Process +Although this chapter has explained various steps in finding a subnet mask to meet the design requirements, it has not yet collected these concepts into a list for the entire process. The following list collects all these steps into one place for reference. Note that this list does not introduce any new concepts compared to the rest of this chapter; it just puts all the ideas in one place. +Step 1. Find the number of network bits (N) per class rules. +Step 2. Calculate the minimum number of subnet bits (S) so that 2S => the number of required subnets. +Step 3. Calculate the minimum number of host bits (H) so that 2H – 2 => the number of required hosts/subnet. +Step 4. If N + S + H > 32, no mask meets the need. +Step 5. If N + S + H = 32, one mask meets the need. Calculate the mask as /P, where P = N + S. +Step 6. If N + S + H < 32, multiple masks meet the need: + +A. Calculate mask /P based on the minimum value of S, where P = N + S. This mask maximizes the number of hosts/subnet. +B. Calculate mask /P based on the minimum value of H, where P = 32 – H. This mask maximizes the number of possible subnets. +C. Note that the complete range of masks includes all prefix lengths between the two values calculated in Steps 6A and 6B. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Practice Choosing Subnet Masks +Take the usual two-phase approach to learning new subnetting math and processes. Take the time now to practice to make sure you understand the fundamentals, using the book and notes as needed. Then, sometime before taking the exam, practice until you can reach the goals in the right column of Table L-2. + +Table L-2 Keep-Reading and Take-Exam Goals for Choosing a Subnet Mask + + +Time Frame Focus On Tools Allowed +Goal: Accuracy +Goal: Speed + +Before Moving to the Next Chapter Learning how +All +90% correct +Any speed + +Before Taking the Exam Being correct and fast Your brain and a notepad 100% correct +15 seconds + + +Practice Problems for Choosing a Subnet Mask +The following list shows three separate problems, each with a classful network number and a required number of subnets and hosts/subnet. For each problem, determine the minimum number of subnet and host bits that meet the requirements. If more than one mask exists, note which mask maximizes the number of hosts/subnet and which maximizes the number of subnets. If only one mask meets the requirements, simply list that mask. List the masks in prefix format: + +1. Network 10.0.0.0, need 1500 subnets, need 300 hosts/subnet 2. Network 172.25.0.0, need 130 subnets, need 127 hosts/subnet 3. Network 192.168.83.0, need 8 subnets, need 8 hosts/subnet +Table L-7, found in the later section “Answers to Earlier Practice Problems,” lists the answers. + +Finding All Subnet IDs +After the person designing the IP subnetting plan has chosen the one mask to use through-out the Class A, B, or C network, he will soon need to start assigning specific subnet IDs for use in specific VLANs, serial links, and other places in the internetwork that need a subnet. But what are those subnet IDs? As it turns out, after the network ID and one subnet mask for all subnets have been chosen, finding all the subnet IDs just requires doing a little math. This second major section of this chapter focuses on that math, which focuses on a single question: + +Given a single Class A, B, or C network, and the single subnet mask to use for all subnets, what are all the subnet IDs? + +When learning how to answer this question, you can think about the problem in either binary or decimal. This chapter approaches the problem using decimal. Although the pro-cess itself requires only simple math, the process requires practice before most people can confidently answer this question. + +The decimal process begins by identifying the first, or numerically lowest, subnet ID. After that, the process identifies a pattern in all subnet IDs for a given subnet mask so that you can find each successive subnet ID through simple addition. This section examines the key ideas behind this process first; then you are given a formal definition of the process. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 9 + + +NOTE Some videos included on the companion website describe the same fundamental processes to find all subnet IDs. You can view those videos before or after reading this sec-tion, or even instead of reading this section, as long as you learn how to independently find all subnet IDs. The process step numbering in the videos might not match the steps shown in this edition of the book. + +First Subnet ID: The Zero Subnet +The first step in finding all subnet IDs of one network is incredibly simple: Copy the net- L work ID. That is, take the Class A, B, or C network ID—in other words, the classful network +ID—and write it down as the first subnet ID. No matter what Class A, B, or C network you use, and no matter what subnet mask you use, the first (numerically lowest) subnet ID is equal to the network ID. + +For example, if you begin with classful network 172.20.0.0, no matter what the mask is, the first subnet ID is 172.20.0.0. + +This first subnet ID in each network goes by two special names: either subnet zero or the zero subnet. The origin of these names is related to the fact that a network’s zero subnet, when viewed in binary, has a subnet part of all binary 0s. In decimal, the zero subnet can be easily identified, because the zero subnet always has the exact same numeric value as the network ID itself. + +In the past, engineers avoided using zero subnets because of the ambiguity with one number that could represent the entire classful network or it could represent one subnet inside the classful network. To help control that, IOS has a global command that can be set one of two ways: + +ip subnet-zero, which allows the configuration of addresses in the zero subnet. +no ip subnet-zero, which prevents the configuration of addresses in the zero subnet. + +Although most sites use the default setting to allow zero subnets, you can use the no ip subnet-zero command to prevent configuring addresses that are part of a zero subnet. Example L-1 shows how a router rejects an ip address command after changing to use +no ip subnet-zero. Note that the error message does not mention the zero subnet, instead simply stating “bad mask.” +Example L-1 Effects of [no] ip subnet-zero on a Local Router + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# no ip subnet-zero +R1(config)# interface g0/1 +R1(config-if)# ip address 10.0.0.1 255.255.255.0 +Bad mask /24 for address 10.0.0.1 + +Note that the no ip subnet-zero command affects the local router’s ip address commands, as well as the local router’s ip route commands (which define static routes). However, it does not affect the local router’s routes as learned with a routing protocol. + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +Finding the Pattern Using the Magic Number +Subnet IDs follow a predictable pattern, at least when using our assumption of a single sub-net mask for all subnets of a network. The pattern uses the magic number, as discussed in Chapter 14, “Analyzing Existing Subnets.” To review, the magic number is 256, minus the mask’s decimal value, in a particular octet that this book refers to as the interesting octet. + +Figure L-7 shows four examples of these patterns with four different masks. For example, just look at the top of the figure to start. It lists mask 255.255.128.0 on the left. The third octet is the interesting octet, with a mask value other than 0 or 255 in that octet. The left side shows a magic number calculated as 256 – 128 = 128. So, the pattern of subnet IDs is shown in the highlighted number line; that is, the subnet IDs when using this mask will have either a 0 or 128 in the third octet. For example, if using network 172.16.0.0, the subnet IDs would be 172.16.0.0 and 172.16.128.0. + + +255.255.128.0 256-128 = 128 + + +0 128 + + + + +255.255.192.0 256-192 = 64 + + +0 64 128 192 + + + + +255.255.224.0 256-224 = 32 + + +0 32 64 96 128 160 192 224 + + + + +255.255.240.0 256-240 = 16 + + +0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 + + + +Figure L-7 Patterns with Magic Numbers for Masks /17 – /20 + +Now focus on the second row, with another example, with mask 255.255.192.0. This row shows a magic number of 64 (256 – 192 = 64), so the subnet IDs will use a value of 0, 64, 128, or 192 (multiples of 64) in the third octet. For example, if used with net-work 172.16.0.0, the subnet IDs would be 172.16.0.0, 172.16.64.0, 172.16.128.0, and 172.16.192.0. + +Looking at the third row/example, the mask is 255.255.224.0, with a magic number of 256 – 224 = 32. So, as shown in the center of the figure, the subnet ID values will be multiples of 32. For example, if used with network 172.16.0.0 again, this mask would tell us that the subnet IDs are 172.16.0.0, 172.16.32.0, 172.16.64.0, 172.16.96.0, and so on. + +Finally, for the bottom example, mask 255.255.240.0 makes the magic number, in the third octet, be 16. So, all the subnet IDs will be a multiple of 16 in the third octet, with those val-ues shown in the middle of the figure. + +A Formal Process with Less Than 8 Subnet Bits +Although it can be easy to see the patterns in Figure L-7, it might not be as obvious exactly how to apply those concepts to find all the subnet IDs in every case. This section outlines a specific process to find all the subnet IDs. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 11 + +To simplify the explanations, this section assumes that less than 8 subnet bits exist. Later, the section “Finding All Subnets with More Than 8 Subnet Bits,” describes the full process that can be used in all cases. + +First, to organize your thoughts, you might want to organize the data into a table like Table L-3. This book refers to this chart as the list-all-subnets chart. + + +Table L-3 + +Octet +Mask + +Generic List-All-Subnets Chart + +1 2 3 4 L + +Magic Number +Network Number/Zero Subnet Next Subnet +Next Subnet Next Subnet Broadcast Subnet +Out of Range—Used by Process + +A formal process to find all subnet IDs, given a network and a single subnet mask, is as + +follows: + +Step 1. Step 2. + + +Step 3. + +Step 4. + +Step 5. + + + + + +Step 6. + + +Write down the subnet mask, in decimal, in the first empty row of the table. +Identify the interesting octet, which is the one octet of the mask with a value other than 255 or 0. Draw a rectangle around the column of the interesting octet. +Calculate and write down the magic number by subtracting the subnet mask’s interesting octet from 256. +Write down the classful network number, which is the same number as the zero subnet, in the next empty row of the list-all-subnets chart. +To find each successive subnet number: +A. For the three uninteresting octets, copy the previous subnet number’s values. +B. For the interesting octet, add the magic number to the previous subnet number’s interesting octet. +When the sum calculated in Step 5B reaches 256, stop the process. The number with the 256 in it is out of range, and the previous subnet number is the broad- +cast subnet. + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +Although the written process is long, with practice, most people can find the answers much more quickly with this decimal-based process than by using binary math. As usual, most people learn this process best by seeing it in action, exercising it, and then practicing it. To that end, review the two following examples and watch any videos that came with this book that show additional examples. + +Example 1: Network 172.16.0.0, Mask 255.255.240.0 +To begin this example, focus on the first four of the six steps, when subnetting network 172.16.0.0 using mask 255.255.240.0. Figure L-8 shows the results of these first four steps: +Step 1. Record mask 255.255.240.0, which was given as part of the problem statement. (Figure L-8 also shows the network ID, 172.16.0.0, for easy reference.) +Step 2. The mask’s third octet is neither 0 nor 255, which makes the third octet interesting. +Step 3. Because the mask’s value in the third octet is 240, the magic number = 256 – 240 = 16. +Step 4. Because the network ID is 172.16.0.0, the first subnet ID, the zero subnet, is also 172.16.0.0. + +Problem Statement +1 255 . 255 . 240 . 0 + +172 . 16 . 0 . 0 + +4 3 256 - 240 = 16 + +Zero 172 . 16 . 0 . 0 + + + +2 + +List of Subnet IDs + +Figure L-8 Results of First Four Steps: 172.16.0.0, 255.255.240.0. + +These first four steps discover the first subnet (the zero subnet) and get you ready to do the remaining steps by identifying the interesting octet and the magic number. Step 5 in the +process tells you to copy the three boring octets and add the magic number (16, in this case) in the interesting octet (octet 3, in this case). Keep repeating this step until the interesting octet value equals 256 (per Step 6). When the total is 256, you have listed all the subnet IDs, and the line with 256 on it is not a correct subnet ID. Figure L-9 shows the results of the Step 5 actions. + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 13 + + +5A 5A 5B 5A + +Copy Copy Add Copy + + +Zero 172 . 16 . + +ID 172 . 16 . + +ID 172 . 16 . + +ID 172 . 16 . + +ID 172 . 16 . + +ID 172 . 16 . + +0 . 0 ++16 +16 . 0 +16 +32 . 0 ++16 L 48 . 0 ++16 +64 . 0 + ++24106 . 0 + +6 256 + +Figure L-9 List of Subnet IDs: 172.16.0.0, 255.255.240.0 + +NOTE In any list of all the subnet IDs of a network, the numerically highest subnet ID is called the broadcast subnet. Decades ago, engineers avoided using the broadcast subnet. However, using the broadcast subnet causes no problems. The term broadcast subnet has its origins in the fact that if you determine the subnet broadcast address inside the broadcast subnet, it has the same numeric value as the network-wide broadcast address. + + +NOTE People sometimes confuse the terms broadcast subnet and subnet broadcast address. The broadcast subnet is one subnet, namely the numerically highest subnet; only one such subnet exists per network. The term subnet broadcast address refers to the one number in each and every subnet that is the numerically highest number in that subnet. + +Example 2: Network 192.168.1.0, Mask 255.255.255.224 +With a Class C network and a mask of 255.255.255.224, this example makes the fourth octet the interesting octet. However, the process works the same, with the same logic, just with the interesting logic applied in a different octet. As with the previous example, the fol-lowing list outlines the first four steps, with Figure L-10 showing the results of the first four steps: +Step 1. Record mask 255.255.255.224, which was given as part of the problem state-ment, and optionally record the network number (192.168.1.0). +Step 2. The mask’s fourth octet is neither 0 nor 255, which makes the fourth octet interesting. +Step 3. Because the mask’s value in the fourth octet is 224, the magic number = 256 – 224 = 32. +Step 4. Because the network ID is 192.168.1.0, the first subnet ID, the zero subnet, is also 192.168.1.0. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +Problem Statement +1 255 . 255 . 255 . 224 + +192 . 168 . 1 . 0 + +4 3 256 - 224 = 32 + +Zero 192 . 168 . 1 . 0 + + + +2 + +List of Subnet IDs + +Figure L-10 Results of First Four Steps: 192.168.1.0, 255.255.255.224 + +From this point, Step 5 in the process tells you to copy the values in the first three octets and then add the magic number (32, in this case) in the interesting octet (octet 4, in this case). Keep doing so until the interesting octet value equals 256 (per Step 6). When the total is 256, you have listed all the subnet IDs, and the line with 256 on it is not a correct subnet ID. Figure L-11 shows the results of these steps. + + +5A 5A + +Copy Copy + +5A 5B + +Copy Add + + +Zero 192 . 168 . 1 . 0 +32 +ID 192 . 168 . 1 . 32 +32 +ID 192 . 168 . 1 . 64 +32 +ID 192 . 168 . 1 . 96 +32 +ID 192 . 168 . 1 . 128 + + +ID 192 . 168 . 1 . 224 ++32 6 256 + +Figure L-11 List of Subnet IDs: 192.168.1.0, 255.255.255.224 + +Finding All Subnets with Exactly 8 Subnet Bits +The formal process in the earlier section “A Formal Process with Less Than 8 Subnet Bits” identified the interesting octet as the octet whose mask value is neither a 255 nor a 0. If the mask defines exactly 8 subnet bits, you must use a different logic to identify the interesting octet; otherwise, the same process can be used. In fact, the actual subnet IDs can be a little more intuitive. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 15 + +Only two cases exist with exactly 8 subnet bits: + +A Class A network with mask 255.255.0.0; the entire second octet contains subnet bits. A Class B network with mask 255.255.255.0; the entire third octet contains subnet bits. + +In each case, use the same process as with less than 8 subnet bits, but identify the interesting octet as the one octet that contains subnet bits. Also, because the mask’s value is 255, the magic number will be 256 – 255 = 1, so the subnet IDs are each 1 larger than the previous subnet ID. +For example, for 172.16.0.0, mask 255.255.255.0, the third octet is the interesting octet L and the magic number is 256 – 255 = 1. You start with the zero subnet, equal in value to +network number 172.16.0.0, and then add 1 in the third octet. For example, the first four subnets are as follows: +172.16.0.0 (zero subnet) 172.16.1.0 +172.16.2.0 172.16.3.0 + +Finding All Subnets with More Than 8 Subnet Bits +Earlier, the section “A Formal Process with Less Than 8 Subnet Bits” assumed less than 8 subnet bits for the purpose of simplifying the discussions while you learn. In real life, you need to be able to find all subnet IDs with any valid mask, so you cannot assume less than 8 subnet bits. + +The examples that have at least 9 subnet bits have a minimum of 512 subnet IDs, so writing down such a list would take a lot of time. To conserve space, the examples will use short-hand rather than list hundreds or thousands of subnet IDs. + +The process with less than 8 subnet bits told you to count in increments of the magic num-ber in one octet. With more than 8 subnet bits, the new expanded process must tell you how to count in multiple octets. So, this section breaks down two general cases: (a) when +9–16 subnet bits exist, which means that the subnet field exists in only two octets, and (b) cases with 17 or more subnet bits, which means that the subnet field exists in three octets. + +Process with 9–16 Subnet Bits +To understand the process, you need to know a few terms that the process will use. Figure L-12 shows the details, with an example that uses Class B network 130.4.0.0 and mask 255.255.255.192. The lower part of the figure details the structure of the addresses per the mask: a network part of two octets because it is a Class B address, a 10-bit subnet part per the mask (/26), and 6 host bits. + + +Network Octets +0-255 255 + +Just-Left Octet + +255 255 + +Interesting Octet + +192 + + +/26 N = 16 S = 10 H = 6 + +Figure L-12 Fundamental Concepts and Terms for the >8 Subnet Bit Process + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +In this case, subnet bits exist in two octets: octets 3 and 4. For the purposes of the process, the rightmost of these octets is the interesting octet, and the octet just to the left is the clev-erly named just-left octet. + +The updated process, which makes adjustments for cases in which the subnet field is longer than 1 octet, tells you to count in increments of the magic number in the interesting octet, but count by 1s in the just-left octet. Formally: +Step 1. Calculate subnet IDs using the 8-subnet-bits-or-less process. However, when the total adds up to 256, move to the next step; consider the subnet IDs listed so far as a subnet block. +Step 2. Copy the previous subnet block, but add 1 to the just-left octet in all subnet IDs in the new block. +Step 3. Repeat Step 2 until you create the block with a just-left octet of 255, but go no further. + +To be honest, the formal concept can cause you problems until you work through some examples, so even if the process remains a bit unclear in your mind, you should work through the following examples instead of rereading the formal process. + +First, consider an example based on Figure L-12, with network 130.4.0.0 and mask 255.255.255.192. Figure L-12 already showed the structure, and Figure L-13 shows the sub-net ID block created at Step 1. + +Just-Left Interesting + +130. 4. 0. 0 +Subnet 130. 4. 0. 64 Block 130. 4. 0. 128 +130. 4. 0. 192 + +Figure L-13 Step 1: Listing the First Subnet ID Block + +The logic at Step 1, to create this subnet ID block of four subnet IDs, follows the same magic number process seen before. The first subnet ID, 130.4.0.0, is the zero subnet. The next three subnet IDs are each 64 bigger, because the magic number, in this case, is 256 – 192 = 64. + +Steps 2 and 3 from the formal process tell you how to create 256 subnet blocks, and by doing so, you will list all 1024 subnet IDs. To do so, create 256 total subnet blocks: one with a 0 in the just-left octet, one with a 1 in the just-left octet, and another with a 2 in the just-left octet, up through 255. The process continues through the step at which you create the subnet block with 255 in the just-left octet (third octet, in this case). Figure L-14 shows the idea, with the addition of the first few subnet blocks. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 17 + +Just- Just- Just-Left Left Left + + +130. 4. 0. 0 130. 4. 0. 64 130. 4. 0.128 130. 4. 0.192 + +130. 4. 1. 0 130. 4. 1. 64 130. 4. 1.128 130. 4. 1.192 + +130. 4. 2. 0 130. 4. 2. 64 130. 4. 2.128 130. 4. 2.192 + + +Figure L-14 Step 2: Replicating the Subnet Block with +1 in the Just-Left Octet + +This example, with 10 total subnet bits, creates 256 blocks of four subnets each, for a total of L 1024 subnets. This math matches the usual method of counting subnets, because 210 = 1024. + +Process with 17 or More Subnet Bits +To create a subnet design that allows 17 or more subnet bits to exist, the design must use a Class A network. In addition, the subnet part will consist of the entire second and third +octets, plus part of the fourth octet. That means a lot of subnet IDs: at least 217 (or 131,072) subnets. Figure L-15 shows an example of just such a structure, with a Class A network and a /26 mask. + + +Network Subnet Octet Octets +0-255 255 255 + +Interesting Octet +255 192 + + +/26 N = 8 S = 18 H = 6 + +Figure L-15 Address Structure with 18 Subnet Bits + +To find all the subnet IDs in this example, you use the same general process as with 9–16 subnet bits, but with many more subnet blocks to create. In effect, you have to create a subnet block for all combinations of values (0–255, inclusive) in both the second and third octet. Figure L-16 shows the general idea. Note that with only 2 subnet bits in the fourth octet in this example, the subnet blocks will have four subnets each. + + +10. 0. 0. 0 10. 0. 0. 64 10. 0. 0.128 10. 0. 0.192 + + +10. 1. 0. 0 10. 1. 0. 64 10. 1. 0.128 10. 1. 0.192 + +10. 0. 1. 0 10. 0. 1. 64 10. 0. 1.128 10. 0. 1.192 + + +10. 1. 1. 0 10. 1. 1. 64 10. 1. 1.128 10. 1. 1.192 + +10. 0.255. 0 10. 0.255. 64 10. 0.255.128 10. 0.255.192 + + +10. 1.255. 0 10. 1.255. 64 10. 1.255.128 10. 1.255.192 + + + + + +10.255. 0. 0 10.255. 0. 64 10.255. 0.128 10.255. 0.192 + +10.255. 1. 0 10.255. 1. 64 10.255. 1.128 10.255. 1.192 + +10.255.255. 0 10.255.255. 64 10.255.255.128 10.255.255.192 + + +Figure L-16 256 Times 256 Subnet Blocks of Four Subnets + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +Practice Finding All Subnet IDs +Before moving to the next chapter, practice until you get the right answer most of the time—but use any tools you want and take all the time you need. Then, you can move on with your reading. Before taking the exam, practice until you reach the goals in the right column of Table L-4, which summarizes the key concepts and suggestions for this two-phase approach. + +Table L-4 Keep-Reading and Take-Exam Goals for This Chapter’s Topics + + +Time Frame Focus On Tools Allowed +Goal: Accuracy +Goal: Speed + +Before Moving to the Next Chapter Learning how +All +90% correct +Any speed + +Before Taking the Exam Being correct and fast Your brain and a notepad 100% correct +45 seconds + + +Practice Problems for Finding All Subnet IDs +The following list shows three separate problems, each with a classful network number and prefix-style mask. Find all subnet IDs for each problem: + +1. 192.168.9.0/27 2. 172.30.0.0/20 3. 10.0.0.0/17 +The section “Answers to Earlier Practice Problems,” later in this chapter, lists the answers. + + +Answers to Earlier Practice Problems + +Answers to Practice Choosing Subnet Masks +The earlier section “Practice Choosing Subnet Masks” listed three practice problems. The answers are listed here so that the answers are nearby but not visible from the list of prob-lems. Table L-5 lists the answers, with notes related to each problem following the table. + +Table L-5 Practice Problems: Find the Masks That Meet Requirements + + +Problem Class + + +1 A 2 B +3 C + +Minimum Subnet Bits + +11 8 +3 + +Minimum Host Bits + +9 8 +4 + +Prefix Range + +/19 – /23 /24 +/27 – /28 + +Prefix to Maximize Subnets +/23 — +/28 + +Prefix to Maximize Hosts +/19 — +/27 + + +1. N=8, because the problem lists Class A network 10.0.0.0. With a need for 1500 sub-nets, 10 subnet bits supply only 1024 subnets (per Table L-1), but 11 subnet bits (S) would provide 2048 subnets—more than the required 1500. Similarly, the smallest number of host bits would be 9, because 28 – 2 = 254, and the design requires 300 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 19 + +hosts/subnet. The shortest prefix mask would then be /19, found by adding N (8) and the smallest usable number of subnet bits S (11). Similarly, with a minimum H value of 9, the longest prefix mask, maximizing the number of subnets, is 32 – H = /23. +2. N=16, because the problem lists Class B network 172.25.0.0. With a need for 130 subnets, 7 subnet bits supply only 128 subnets (per Table L-1), but 8 subnet bits (S) would provide 256 subnets—more than the required 130. Similarly, the smallest num-ber of host bits would be 8, because 27 – 2 = 126—close to the required 127, but not quite enough, making H = 8 the smallest number of host bits that meets requirements. +Note that the network, minimum subnet bits, and minimum host bits add up to 32, so L +only one mask meets the requirements, namely /24, found by adding the number of network bits (16) to the minimum number of subnet bits (8). +3. N=24, because the problem lists Class C network 192.168.83.0. With a need for eight subnets, 3 subnet bits supply enough, but just barely. The smallest number of host bits would be 4, because 23 – 2 = 6, and the design requires 8 hosts/subnet. The short-est prefix mask would then be /27, found by adding N (24) and the smallest usable number of subnet bits S (3). Similarly, with a minimum H value of 4, the longest prefix mask, maximizing the number of subnets, is 32 – H = /28. + +Answers to Practice Finding All Subnet IDs +The earlier section “Practice Finding All Subnet IDs” listed three practice problems. The answers are listed here so that they are not visible from the same page as the list of problems. + +Answer, Practice Problem 1 +Problem 1 lists network 192.168.9.0, mask /27. The mask converts to DDN mask 255.255.255.224. When used with a Class C network, which has 24 network bits, only 3 subnet bits exist, and they all sit in the fourth octet. So, this problem is a case of less than 8 subnet bits, with the fourth octet as the interesting octet. + +To get started listing subnets, first write down the zero subnet and then start adding the magic number in the interesting octet. The zero subnet equals the network ID (192.168.9.0, in this case). The magic number, calculated as 256 – 224 = 32, should be added to the previ-ous subnet ID’s interesting octet. Table L-6 lists the results. + +Table L-6 List-All-Subnets Chart: 192.168.9.0/27 + +Octet 1 2 3 4 Mask 255 255 255 224 +Magic Number — — — 32 + +Classful Network/Subnet Zero 192 168 9 0 + +First Nonzero Subnet 192 168 9 32 + +Next Subnet 192 168 9 64 + +Next Subnet 192 168 9 96 + +Next Subnet 192 168 9 128 + +Next Subnet 192 168 9 160 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +20 CCNA 200-301 Official Cert Guide, Volume 1 + + + +Octet +Next Subnet + +Broadcast Subnet + +Invalid—Used by Process + +1 2 3 4 192 168 9 192 +192 168 9 224 + +192 168 9 256 + + +Answer, Practice Problem 2 +Problem 2 lists network 172.30.0.0, mask /20. The mask converts to DDN mask 255.255.240.0. When used with a Class B network, which has 16 network bits, only 4 subnet bits exist, and they all sit in the third octet. So, this problem is a case of less than 8 subnet bits, with the third octet as the interesting octet. + +To get started listing subnets, first write down the zero subnet and then start adding the magic number in the interesting octet. The zero subnet equals the network ID (or 172.30.0.0, in this case). The magic number, calculated as 256 – 240 = 16, should be added to the previous subnet ID’s interesting octet. Table L-7 lists the results. + +Table L-7 List-All-Subnets Chart: 172.30.0.0/20 + + +Octet 1 2 Mask 255 255 Magic Number — — Classful Network/Subnet Zero 172 30 First Nonzero Subnet 172 30 Next Subnet 172 30 Next Subnet 172 30 Next Subnet 172 30 Broadcast Subnet 172 30 +Invalid—Used by Process 172 30 + +3 4 240 0 16 — 0 0 16 0 32 0 Skipping… 0 224 0 240 0 +256 0 + + +Answer, Practice Problem 3 +Problem 3 lists network 10.0.0.0, mask /17. The mask converts to DDN mask 255.255.128.0. When used with a Class A network, which has 8 network bits, 9 subnet bits exist. Using the terms unique to this chapter, octet 3 is the interesting octet, with only 1 subnet bit in that octet, and octet 2 is the just-left octet, with 8 subnet bits. + +In this case, begin by finding the first subnet block. The magic number is 256 – 128 = 128. The first subnet (zero subnet) equals the network ID. So, the first subnet ID block includes the following: + +10.0.0.0 10.0.128.0 + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix L: Subnet Design 21 + +Then, you create a subnet block for all 256 possible values in the just-left octet, or octet 2 in this case. The following list shows the first three subnet ID blocks, plus the last subnet ID block, rather than listing page upon page of subnet IDs: + +10.0.0.0 (zero subnet) 10.0.128.0 +10.1.0.0 10.1.128.0 +10.2.0.0 L 10.2.128.0 +… 10.255.0.0 +10.255.128.0 (broadcast subnet) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX M + + + + +Practice for Appendix L: Subnet Design + + +NOTE This appendix contains an entire chapter that was published as a chapter in one of the past editions of this book or a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more. However, note that the content in this appendix has not been edited since it was published in the earlier edi-tion, so references to exams and exam topics, and to other chapters, will be outdated. This appendix was previously published as Appendix G of the book CCENT/CCNA ICND1 100-105 Official Cert Guide, published in 2016. + +This appendix exists as two halves to match the two major sections of the chapter. The first half lists mask design problems, and then the answers to those problems. The second half lists problems where you need to find the subnet ID, but with less than 8 subnet bits and with more than 8 subnet bits. + +To solve these problems, use the processes explained in Appendix L of CCNA 200-301 Official Cert Guide, Volume 1, the current edition of this book you are reading. + +Mask Design Practice Problems +This section lists problems with a short set of requirements regarding how a particular class-ful network should be subnetted. The requirements include the classful network, the num-ber of subnets the design must support, and the number of hosts in each subnet. For each problem, supply the following information: + +■ The minimum number of subnet and host bits needed in the mask to support the design requirements +■ The dotted-decimal format mask(s) that meet the requirements +■ The mask you would choose if the problem said to maximize the number of subnets +■ The mask you would choose if the problem said to maximize the number of hosts per subnet + +Also note that you should assume that the two special subnets in each network—the zero subnet and broadcast subnet—are allowed to be used for these questions. + +When doing the problems, the information in Table M-1 can be helpful. Note that Appendix A, “Numeric Reference Tables,” in the printed book, also includes this table. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Table M-1 Powers of 2 + + +Number 2X Number of Bits of Bits +1 2 5 2 4 6 3 8 7 +4 16 8 + +2X Number of Bits +32 9 64 10 128 11 +256 12 + +2X Number 2X of Bits +512 13 8192 1024 14 16,384 2048 15 32,768 +4096 16 65,536 + + +Find the key facts for these sets of requirements: + +1. Network 10.0.0.0, need 50 subnets, need 200 hosts/subnet +2. Network 172.32.0.0, need 125 subnets, need 125 hosts/subnet 3. Network 192.168.44.0, need 15 subnets, need 6 hosts/subnet 4. Network 10.0.0.0, need 300 subnets, need 500 hosts/subnet 5. Network 172.32.0.0, need 500 subnets, need 15 hosts/subnet 6. Network 172.16.0.0, need 2000 subnets, need 2 hosts/subnet +Mask Design Answers +This section includes the answers to the six problems listed in this appendix. The answer section for each problem explains how to use the process outlined in Appendix L, “Subnet Design,” to find the answers. + +Answer to Mask Design Problem 1 +Problem 1 shows a Class A network, with 8 network bits, with a minimum of 6 subnet bits and 8 host bits to meet the required number of subnets and hosts/subnet. The following masks all meet the requirements in this problem, with the masks that maximize the number of hosts/subnet and the number of subnets noted: + +■ 255.252.0.0 (maximizes the number of hosts per subnet) ■ 255.254.0.0 +■ 255.255.0.0 +■ 255.255.128.0 ■ 255.255.192.0 ■ 255.255.224.0 ■ 255.255.240.0 ■ 255.255.248.0 ■ 255.255.252.0 ■ 255.255.254.0 +■ 255.255.255.0 (maximizes the number of subnets) + +As for the process to find the answers, the following list explains the details: + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix M: Practice for Appendix L: Subnet Design 3 + + +NOTE The following explanation uses step numbers that match the process listed in Appendix L, but only the steps from that process that apply to this problem. As a result, the step numbers in the explanation are not sequential. + + +Step 1. Step 2. + + +Step 3. + + +Step 6A. + + + +Step 6B. + +Step 6C. + + +The question lists Class A network 10.0.0.0, so there are 8 network bits. +The question states that 50 subnets are needed. A mask with 5 subnet bits sup-plies only 25 (32) subnets, but a mask with 6 subnet bits supplies 26 (64) sub-nets. So, the mask needs at least 6 subnet bits. +The question states that 200 hosts are needed per subnet. A mask with 7 host bits supplies only 27 – 2 (126) hosts per subnet, but a mask with 8 host bits +supplies 28 – 2 (254) hosts per subnet. So, the mask needs at least 8 host bits. M With N=8, a minimum S=6, and a minimum H=8, multiple masks exist. The first +mask, with the minimum number of subnet bits, is /14, found by adding N (8) to the minimum value of S (6). This mask maximizes the number of host bits and therefore maximizes the number of hosts/subnet. +The minimum value of H, the number of host bits, is 8. So, the mask with the fewest H bits, maximizing the number of subnets, is 32 – H = 32 – 8 = /24. +All masks between /14 and /24 also meet the requirements. + + + +Answer to Mask Design Problem 2 +Problem 2 shows a Class B network, with 16 network bits, with a minimum of 7 subnet bits and 7 host bits to meet the required number of subnets and hosts/subnet. The following masks all meet the requirements in this problem, with the masks that maximize the number of hosts/subnet and the number of subnets noted: + +■ 255.255.254.0 (maximizes the number of hosts/subnet) ■ 255.255.255.0 +■ 255.255.255.128 (maximizes the number of subnets) + +As for the process to find the answers, the following list explains the details: + + +Step 1. Step 2. + + +Step 3. + + +Step 6A. + + +The question lists Class B network 172.32.0.0, so there are 16 network bits. +The question states that 125 subnets are needed. A mask with 6 subnet bits supplies only 26 (64) subnets, but a mask with 7 subnet bits supplies 27 (128) subnets. So, the mask needs at least 7 subnet bits. +The question states that 125 hosts are needed per subnet. A mask with 6 host bits supplies only 26 – 2 (62) hosts per subnet, but a mask with 7 host bits sup-plies 27 – 2 (126) hosts per subnet. So, the mask needs at least 7 host bits. +With N=16, a minimum S=7, and a minimum H=7, multiple masks exist. The first mask, with the minimum number of subnet bits, is /23, found by adding N (16) to the minimum value of S (7). This mask maximizes the number of host +bits and therefore maximizes the number of hosts/subnet. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + + +Step 6B. + +Step 6C. + + +The minimum value of H, the number of host bits, is 7. So, the mask with the fewest H bits, maximizing the number of subnets, is 32 – H = 32 – 7 = /25. +All masks between /23 and /25 also meet the requirements (/23, /24, and /25). + + + +Answer to Mask Design Problem 3 +Problem 3 shows a Class C network, with 24 network bits, with a minimum of 4 subnet bits and 3 host bits to meet the required number of subnets and hosts/subnet. The following masks all meet the requirements in this problem, with the masks that maximize the number of hosts/subnet and the number of subnets noted: + +■ 255.255.255.240 (maximizes the number of hosts/subnet) ■ 255.255.255.248 (maximizes the number of subnets) +As for the process to find the answers, the following list explains the details: + + +Step 1. Step 2. + + +Step 3. + + +Step 6A. + + + +Step 6B. + +Step 6C. + + +The question lists Class C network 192.168.44.0, so there are 24 network bits. +The question states that 15 subnets are needed. A mask with 3 subnet bits sup-plies only 23 (8) subnets, but a mask with 4 subnet bits supplies 24 (16) subnets. So, the mask needs at least 4 subnet bits. +The question states that 6 hosts are needed per subnet. A mask with 2 host bits supplies only 22 – 2 (2) hosts per subnet, but a mask with 3 host bits supplies 23 – 2 (6) hosts per subnet. So, the mask needs at least 3 host bits. +With N=24, a minimum S=4, and a minimum H=3, multiple masks exist. The first mask, with the minimum number of subnet bits, is /28, found by adding N (24) to the minimum value of S (4). This mask maximizes the number of host bits and therefore maximizes the number of hosts/subnet. +The minimum value of H, the number of host bits, is 3. So, the mask with the fewest H bits, maximizing the number of subnets, is 32 – H = 32 – 3 = /29. +Only masks /28 and /29 meet the requirements. + + + +Answer to Mask Design Problem 4 +Problem 4 shows a Class A network, with 8 network bits, with a minimum of 9 subnet bits and 9 host bits to meet the required number of subnets and hosts/subnet. The following masks all meet the requirements in this problem, with the masks that maximize the number of hosts/subnet and the number of subnets noted: + +■ 255.255.128.0 (maximizes the number of hosts/subnet) ■ 255.255.192.0 +■ 255.255.224.0 ■ 255.255.240.0 ■ 255.255.248.0 ■ 255.255.252.0 +■ 255.255.254.0 (maximizes the number of subnets) + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix M: Practice for Appendix L: Subnet Design 5 + +As for the process to find the answers, the following list explains the details: + + +Step 1. Step 2. + + +Step 3. + + +Step 6A. + + + +Step 6B. + +Step 6C. + + +The question lists Class A network 10.0.0.0, so there are 8 network bits. +The question states that 300 subnets are needed. A mask with 8 subnet bits supplies only 28 (256) subnets, but a mask with 9 subnet bits supplies 29 (512) subnets. So, the mask needs at least 9 subnet bits. +The question states that 500 hosts are needed per subnet. A mask with 8 host bits supplies only 28 – 2 (254) hosts per subnet, but a mask with 9 host bits supplies 29 – 2 (510) hosts per subnet. So, the mask needs at least 9 host bits. +With N=8, a minimum S=9, and a minimum H=9, multiple masks exist. The first mask, with the minimum number of subnet bits, is /17, found by adding N (8) to the minimum value of S (9). This mask maximizes the number of host bits and therefore maximizes the number of hosts/subnet. +The minimum value of H, the number of host bits, is 9. So, the mask with the fewest H bits, maximizing the number of subnets, is 32 – H = 32 – 9 = /23. +All masks between /17 and /23 also meet the requirements (/17, /18, /19, /20, +/21, /22, /23). + + + + + + + + + + + +M + + + +Answer to Mask Design Problem 5 +Problem 5 shows a Class B network, with 16 network bits, with a minimum of 9 subnet bits and 5 host bits to meet the required number of subnets and hosts/subnet. The following masks all meet the requirements in this problem, with the masks that maximize the number of hosts/subnet and the number of subnets noted: + +■ 255.255.255.128 (maximizes the number of hosts/subnet) ■ 255.255.255.192 +■ 255.255.255.224 (maximizes the number of subnets) + +As for the process to find the answers, the following list explains the details: + + +Step 1. Step 2. + + +Step 3. + + +Step 6A. + + + +Step 6B. + +Step 6C. + + +The question lists Class B network 172.32.0.0, so there are 16 network bits. +The question states that 500 subnets are needed. A mask with 8 subnet bits supplies only 28 (256) subnets, but a mask with 9 subnet bits supplies 29 (512) subnets. So, the mask needs at least 9 subnet bits. +The question states that 15 hosts are needed per subnet. A mask with 4 host bits supplies only 24 – 2 (14) hosts per subnet, but a mask with 5 host bits sup-plies 25 – 2 (30) hosts per subnet. So, the mask needs at least 5 host bits. +With N=16, a minimum S=9, and a minimum H=5, multiple masks exist. The first mask, with the minimum number of subnet bits, is /25, found by adding N (16) to the minimum value of S (9). This mask maximizes the number of host bits and therefore maximizes the number of hosts/subnet. +The minimum value of H, the number of host bits, is 5. So, the mask with the fewest H bits, maximizing the number of subnets, is 32 – H = 32 – 5 = /27. +All masks between /25 and /27 also meet the requirements (/25, /26, /27). + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +Answer to Mask Design Problem 6 +Problem 6 shows a Class B network, with 16 network bits, with a minimum of 11 subnet bits and 2 host bits to meet the required number of subnets and hosts/subnet. The following masks all meet the requirements in this problem, with the masks that maximize the number of hosts/subnet and the number of subnets noted: + +■ 255.255.255.224 (maximizes the number of hosts/subnet) ■ 255.255.255.240 +■ 255.255.255.248 +■ 255.255.255.252 (maximizes the number of subnets) + +As for the process to find the answers, the following list explains the details: + + +Step 1. Step 2. + + +Step 3. + +Step 6A. + + + +Step 6B. + +Step 6C. + + +The question lists Class B network 172.16.0.0, so there are 16 network bits. +The question states that 2000 subnets are needed. A mask with 10 subnet bits supplies only 210 (1024) subnets, but a mask with 11 subnet bits supplies 211 (2048) subnets. So, the mask needs at least 11 subnet bits. +The question states that 2 hosts are needed per subnet. A mask with 2 host bits supplies 22 – 2 (2) hosts per subnet. So, the mask needs at least 2 host bits. +With N=16, a minimum S=11, and a minimum H=2, multiple masks exist. The first mask, with the minimum number of subnet bits, is /27, found by adding N (16) to the minimum value of S (11). This mask maximizes the number of host bits and therefore maximizes the number of hosts/subnet. +The minimum value of H, the number of host bits, is 2. So, the mask with the fewest H bits, maximizing the number of subnets, is 32 – H = 32 – 2 = /30. +All masks between /27 and /30 also meet the requirements (/27, /28, /29, /30). + + + +Practice Finding All Subnet IDs +The remainder of this appendix lists two sets of problems. Both problem sets list an IP net-work and mask; your job is to list all the subnet IDs for each network/mask combination. The first problem set includes problems that happen to have 8 or fewer subnet bits, and the second problem set includes problems that happen to have more than 8 subnet bits. In par-ticular, for each problem, find the following: + +■ All subnet numbers +■ The subnet that is the zero subnet +■ The subnet that is the broadcast subnet + +To find this information, you can use the processes explained in Appendix L. + +Find Subnet IDs, Problem Set 1: 8 or Fewer Subnet Bits +The problems, which consist of a classful network and static-length mask, are as follows: + +1. 172.32.0.0/22 2. 200.1.2.0/28 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix M: Practice for Appendix L: Subnet Design 7 + +3. 10.0.0.0/15 4. 172.20.0.0/24 +Find Subnet IDs, Problem Set 2: More Than 8 Subnet Bits +The problems, which consist of a classful network and static-length mask, are as follows: + +1. 172.32.0.0/25 2. 10.0.0.0/21 +Answers to Find Subnet IDs, Problem Set 1 +This section includes the answers to the four problems listed in Problem Set 1. + +Problem Set 1, Answer 1: 172.32.0.0/22 M +The answer is as follows: + +■ 172.32.0.0 (zero subnet) ■ 172.32.4.0 +■ 172.32.8.0 ■ 172.32.12.0 ■ 172.32.16.0 ■ 172.32.20.0 ■ 172.32.24.0 +(Skipping many subnets; each new subnet is the same as the previous subnet, after adding 4 to the third octet.) +■ 172.32.248.0 +■ 172.32.252.0 (broadcast subnet) + +The process to find all subnets depends on three key pieces of information: + +■ The mask has fewer than 8 subnet bits (6 bits), because the network is a Class B network (16 network bits), and the mask has 22 binary 1s in it—implying 10 host bits and leaving 6 subnet bits. +■ The mask in dotted-decimal format is 255.255.252.0. The interesting octet is the third octet because the subnet bits are all in the third octet. +■ Each successive subnet number is 4 higher than the previous subnet number, in the inter-esting octet, because the magic number is 256 – 252 = 4. + +As a result, in this case, all the subnets begin with 172.32, have a multiple of 4 in the third octet, and end in 0. + +Table M-2 shows the results of the various steps of the process, as outlined in Appendix L. + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Table M-2 8 or Fewer Subnet Bits, Question 1: Answer Table + + + +Subnet Mask (Step 1) Magic Number (Step 3) +Zero Subnet Number (Step 4) Next Subnet (Step 5) +Next Subnet (Step 5) Next Subnet (Step 5) Next Subnet (Step 5) +(You might need many more such rows.) Next Subnet +Next Subnet (Step 5) Broadcast Subnet (Step 6) +Out of Range—Stop Process (Step 6) + +Octet 1 Octet 2 255 255 + +172 32 172 32 172 32 172 32 172 32 172 32 172 32 172 32 +172 32 + +Octet 3 Octet 4 252 0 +256 – 252 = 4 +0 0 4 0 8 0 12 0 16 0 X 0 244 0 248 0 252 0 +256 + + +Problem Set 1, Answer 2: 200.1.2.0/28 The answer is as follows: + +■ 200.1.2.0 (zero subnet) ■ 200.1.2.16 +■ 200.1.2.32 ■ 200.1.2.48 ■ 200.1.2.64 ■ 200.1.2.80 +(Skipping many subnets; each new subnet is the same as the previous subnet, after adding 16 to the fourth octet.) +■ 200.1.2.224 +■ 200.1.2.240 (broadcast subnet) + +The process to find all subnets depends on three key pieces of information, as follows: + +■ The mask has fewer than 8 subnet bits (4 bits), because the network is a Class C network (24 network bits), and the mask has 28 binary 1s in it, which implies 4 host bits and leaves 4 subnet bits. +■ The mask in dotted-decimal format is 255.255.255.240. The interesting octet is the fourth octet, because all the subnet bits are in the fourth octet. +■ Each successive subnet number is 16 higher than the previous subnet number, in the interesting octet, because the magic number is 256 – 240 = 16. + +As a result, in this case, all the subnets begin with 200.1.2 and have a multiple of 16 in the fourth octet. + +Table M-3 shows the results of the various steps of the process, as outlined in Appendix L. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix M: Practice for Appendix L: Subnet Design 9 + +Table M-3 Problem Set 1, Question 2: Answer Table + + +Octet 1 Subnet Mask (Step 1) 255 Magic Number (Step 3) +Zero Subnet Number (Step 4) 200 Next Subnet (Step 5) 200 Next Subnet (Step 5) 200 Next Subnet (Step 5) 200 +(You might need many more such 200 rows.) (Step 5) +Next Subnet (Step 5) 200 Broadcast Subnet (Step 6) 200 +Out of Range—Stop Process (Step 6) + +Octet 2 Octet 3 255 255 + +1 2 1 2 1 2 1 2 1 2 + +1 2 +1 2 + +Octet 4 240 +256 – 240 = 16 0 +16 32 48 X +224 M 240 +256 + + +Problem Set 1, Answer 3: 10.0.0.0/15 The answer is as follows: + +■ 10.0.0.0 (zero subnet) ■ 10.2.0.0 +■ 10.4.0.0 ■ 10.6.0.0 +(Skipping many subnets; each new subnet is the same as the previous subnet, after adding 2 to the second octet.) +■ 10.252.0.0 +■ 10.254.0.0 (broadcast subnet) + +The process to find all subnets depends on three key pieces of information: + +■ The mask has fewer than 8 subnet bits (7 subnet bits), because the network is a Class A network (8 network bits), and the mask has 15 binary 1s in it, which implies 17 host bits and leaves 7 subnet bits. +■ The mask in dotted-decimal format is 255.254.0.0. The interesting octet is the second octet, because all the subnet bits exist in the second octet. +■ Each successive subnet number is 2 higher than the previous subnet number, in the inter-esting octet, because the magic number is 256 – 254 = 2. + +As a result, in this case, all the subnets begin with 10, have a multiple of 2 in the second octet, and end in 0.0. + +Table M-4 shows the results of the various steps of the process, as outlined in Appendix L. + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +Table M-4 Problem Set 1, Question 3: Answer Table + + +Octet 1 Subnet Mask (Step 1) 255 Magic Number (Step 3) +Zero Subnet Number (Step 4) 10 Next Subnet (Step 5) 10 Next Subnet (Step 5) 10 Next Subnet (Step 5) 10 +(You might need many more such rows.) 10 (Step 5) +Next Subnet (Step 5) 10 Broadcast Subnet (Step 6) 10 +Out of Range—Stop Process (Step 6) + +Octet 2 Octet 3 Octet 4 254 0 0 +256 – 254 = 2 +0 0 0 2 0 0 4 0 0 6 0 0 X 0 0 + +252 0 0 254 0 0 +256 + + + +Problem Set 1, Answer 4: 172.20.0.0/24 +This problem has an 8-bit subnet field, meaning that 28, or 256, possible subnets exist. The following list shows some of the subnets, which should be enough to see the trends in how to find all subnet numbers: + +■ 172.20.0.0 (zero subnet) ■ 172.20.1.0 +■ 172.20.2.0 ■ 172.20.3.0 ■ 172.20.4.0 +(Skipping many subnets; each new subnet is the same as the previous subnet, after adding 1 to the third octet.) +■ 172.20.252.0 ■ 172.20.253.0 ■ 172.20.254.0 +■ 172.20.255.0 (broadcast subnet) + +The process to find all subnets depends on three key pieces of information: + +■ The mask has exactly 8 subnet bits, specifically all bits in the third octet, making the third octet the interesting octet. +■ The magic number is 256 – 255 = 1, because the mask’s value in the interesting (third) octet is 255. +■ Beginning with the network number of 172.20.0.0, which is the same value as the zero subnet, just add the magic number (1) in the interesting octet. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix M: Practice for Appendix L: Subnet Design 11 + +Essentially, you just count by 1 in the third octet until you reach the highest legal number (255). The first subnet, 172.20.0.0, is the zero subnet, and the last subnet, 172.20.255.0, is the broadcast subnet. + +Answers to Find Subnet IDs, Problem Set 2 Problem Set 2, Answer 1: 172.32.0.0/25 +This problem has a 9-bit subnet field, meaning that 29, or 512, possible subnets exist. The following list shows some of the subnets, which should be enough to see the trends in how to find all subnet numbers: +■ 172.32.0.0 (zero subnet) +■ 172.32.0.128 +■ 172.32.1.0 M +■ 172.32.1.128 ■ 172.32.2.0 +■ 172.32.2.128 ■ 172.32.3.0 +■ 172.32.3.128 +(Skipping many subnets; the subnets occur in blocks of two, with either 0 or 128 in the fourth octet, with each successive block being one greater in the third octet.) +■ 172.32.254.0 +■ 172.32.254.128 ■ 172.32.255.0 +■ 172.32.255.128 (broadcast subnet) + +The process to find all subnets depends on three key pieces of information, as follows: + +■ The mask has more than 8 subnet bits (9 bits), because the network is a Class B network (16 network bits), and the mask has 25 binary 1s in it, which implies 7 host bits and leaves 9 subnet bits. +■ Using the terminology in Appendix L, octet 4 is the interesting octet, where the count-ing occurs based on the magic number. Octet 3 is the “just left” octet, in which the pro-cess counts by 1, from 0 to 255. +■ The magic number, which will be used to calculate each successive subnet number, is 256 – 128 = 128. + +To calculate the first subnet block, use the same six-step process as used in the simpler problems that have 8 or fewer subnet bits. In this case, with only 1 subnet bit in octet 4, only two subnets exist in each subnet block. Table M-5 shows the steps as compared to the six-step process to find the subnets in a subnet block. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +Table M-5 Creating the First Subnet Block + +Octet 1 Octet 2 Octet 3 Octet 4 + +Subnet Mask (Step 1) 255 255 Magic Number (Step 3) +Zero Subnet Number (Step 4) 172 32 Next Subnet (Step 5) 172 32 +Step 6 Needs to Be Used Here (Sum of 172 32 256 in the 4th Octet) + +255 128 +256 – 128 = 128 0 0 +0 128 +0 256 + + +The table represents the logic, but to make sure that the answer is clear, the first subnet block includes the following: + +172.32.0.0 172.32.0.128 +The next major task—to create subnet blocks for all possible values in the “just left” octet— completes the process. Essentially, create 256 blocks like the previous list. The first has a value of 0, in the “just left” octet; the next has a value of 1; the next, a value of 2; and so on, through a block that begins with 172.30.255. Figure M-1 shows the concept. + +Just Just Just Left Left Left + + +172. 30. 0. 0 172. 30. 0.128 + +172. 30. 1. 0 172. 30. 1.128 + +172. 30. 2. 0 172. 30. 2.128 + + +Figure M-1 Creating Subnet Blocks by Adding 1 in the “Just Left” Octet + +Problem Set 2, Answer 2: 10.0.0.0/21 +This problem has a 13-bit subnet field, meaning that 213, or 8192, possible subnets exist. The following list shows some of the subnets, which should be enough to see the trends in how to find all subnet numbers: + +■ 10.0.0.0 (zero subnet) ■ 10.0.8.0 +■ 10.0.16.0 ■ 10.0.24.0 +(Skipping several subnets) ■ 10.0.248.0 +■ 10.1.0.0 ■ 10.1.8.0 ■ 10.1.16.0 +(Skipping several subnets) ■ 10.1.248.0 + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix M: Practice for Appendix L: Subnet Design 13 + +■ 10.2.0.0 ■ 10.2.8.0 ■ 10.2.16.0 +(Skipping several subnets) ■ 10.255.232.0 +■ 10.255.240.0 +■ 10.255.248.0 (broadcast subnet) + +The process to find all subnets depends on three key pieces of information, as follows: + +■ The mask has more than 8 subnet bits (13 bits), because the network is a Class A net- +work (8 network bits), and the mask has 21 binary 1s in it, which implies 11 host bits and M leaves 13 subnet bits. +■ Using the terminology in Appendix L, octet 3 is the interesting octet, where the counting occurs based on the magic number. Octet 2 is the “just left” octet, in which the process counts by 1, from 0 to 255. +■ The magic number, which will be used to calculate each successive subnet number, is 256 – 248 = 8. + +To calculate the first subnet block, use the same six-step process as used in the simpler problems that have 8 or fewer subnet bits. In this case, with 5 subnet bits in octet 3, 32 subnets exist in each subnet block. Table M-6 shows the steps as compared to the six-step process to find the subnets in a subnet block. + +Table M-6 Creating the First Subnet Block + +Octet 1 Octet 2 Octet 3 Octet 4 + +Subnet Mask (Step 1) 255 255 Magic Number (Step 3) +Zero Subnet Number (Step 4) 10 0 Next Subnet (Step 5) 10 0 (Skipping several subnets) 10 0 Next Subnet (Step 5) 10 0 +Step 6 Needs to Be Used Here (Sum of 256 10 0 in the 3rd Octet) + +248 0 256 – 248 = 8 +0 0 8 0 X 0 248 0 +256 0 + + +The table represents the logic, but to make sure that the answer is clear, the first subnet block includes the following: + +10.0.0.0 10.0.8.0 10.0.16.0 10.0.24.0 10.0.32.0 10.0.40.0 + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +10.0.48.0 10.0.56.0 10.0.64.0 And so on… 10.0.248.0 +The next major task—to create subnet blocks for all possible values in the “just left” octet— completes the process. Essentially, create 256 blocks like the previous list. The first has a value of 0, in the “just left” octet; the next has a value of 1; the next, a value of 2; and so on, through a block that begins with 10.255. Figure M-2 shows the concept. + +Just Just Just Left Left Left + + +10. 0. 0.0 10. 0. 8.0 10. 0. 16.0 10. 0. 24.0 +10. 0. 32.0 10. 0. 40.0 10. 0. ...0 10. 0.248.0 + +10. 1. 0.0 10. 1. 8.0 10. 1. 16.0 10. 1. 24.0 +10. 1. 32.0 10. 1. 40.0 10. 1. ...0 10. 1.248.0 + +10. 2. 0.0 10. 2. 8.0 10. 2. 16.0 10. 2. 24.0 +10. 2. 32.0 10. 2. 40.0 10. 2. ...0 10. 2.248.0 + + +Figure M-2 Creating Subnet Blocks by Adding 1 in the “Just Left” Octet + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX N + + + + +Variable-Length Subnet Masks + + + +NOTE This appendix contains an entire chapter that was published as a chapter in one of the past editions of this book or a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more. However, note that the content in this appendix has not been edited since it was published in the earlier edition, so references to exams and exam topics, and to other chapters, will be outdated. +This appendix was previously published as Chapter 22 of the book CCENT/CCNA ICND1 100-105 Official Cert Guide, published in 2016. + + + +IPv4 addressing and subnetting use a lot of terms, a lot of small math steps, and a lot of concepts that fit together. While learning those concepts, it helps to keep things as simple as possible. One way this book has kept the discussion simpler so far was to show examples that use one mask only inside a single Class A, B, or C network. + +This chapter removes that restriction by introducing variable-length subnet masks (VLSM). VLSM simply means that the subnet design uses more than one mask in the same classful network. VLSM has some advantages and disadvantages, but when learning, the main chal-lenge is that a subnetting design that uses VLSM requires more math, and it requires that you think about some other issues as well. This chapter walks you through the concepts, the issues, and the math. + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +VLSM Concepts and Configuration +VLSM occurs when an internetwork uses more than one mask for different subnets of a single Class A, B, or C network. Figure N-1 shows an example of VLSM used in Class A network 10.0.0.0. + + +10.2.1.0 /24 10.2.2.0 /24 10.2.3.0 /24 10.2.4.0 /24 + + +Figure N-1 + + +Albuquerque +10.1.4.0 /30 10.1.6.0 /30 +S0/1 S0/0 S0/1 S0/0 Yosemite Seville + +10.1.1.0 /24 + +VLSM in Network 10.0.0.0: Masks /24 and /30 + +10.3.4.0 /24 10.3.5.0 /24 10.3.6.0 /24 +10.3.7.0 /24 + + +Figure N-1 shows a typical choice of using a /30 prefix (mask 255.255.255.252) on point-to-point serial links, with mask /24 (255.255.255.0) on the LAN subnets. All subnets are of Class A network 10.0.0.0, with two masks being used, therefore meeting the definition of VLSM. + +Oddly enough, a common mistake occurs when people think that VLSM means “using more than one mask in some internetwork” rather than “using more than one mask in a single classful network.” For example, if in one internetwork diagram, all subnets of network 10.0.0.0 use a 255.255.240.0 mask, and all subnets of network 11.0.0.0 use a 255.255.255.0 mask, the design uses two different masks. However, Class A network 10.0.0.0 uses only one mask, and Class A network 11.0.0.0 uses only one mask. In that case, the design does not use VLSM. + +VLSM provides many benefits for real networks, mainly related to how you allocate and use your IP address space. Because a mask defines the size of the subnet (the number +of host addresses in the subnet), VLSM allows engineers to better match the need for addresses with the size of the subnet. For example, for subnets that need fewer addresses, the engineer uses a mask with fewer host bits, so the subnet has fewer host IP addresses. This flexibility reduces the number of wasted IP addresses in each subnet. By wasting fewer addresses, more space remains to allocate more subnets. + +VLSM can be helpful for both public and private IP addresses, but the benefits are more dramatic with public networks. With public networks, the address savings help engineers avoid having to obtain another registered IP network number from regional IP address assignment authorities. With private networks, as defined in RFC 1918, running out of addresses is not as big a negative, because you can always grab another private network from RFC 1918 if you run out. + +Classless and Classful Routing Protocols +Before you can deploy a VLSM design, you must first use a routing protocol that supports VLSM. To support VLSM, the routing protocol must advertise the mask along with each subnet. Without mask information, the router receiving the update would be confused. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix N: Variable-Length Subnet Masks 3 + +For example, if a router learned a route for 10.1.8.0, but with no mask information, what does that mean? Is that subnet 10.1.8.0/24? 10.1.8.0/23? 10.1.8.0/30? The dotted-decimal number 10.1.8.0 happens to be a valid subnet number with a variety of masks, and because multiple masks can be used with VLSM, the router has no good way to make an educated guess. To effectively support VLSM, the routing protocol needs to advertise the correct mask along with each subnet so that the receiving router knows the exact subnet that is being advertised. + +By definition, classless routing protocols advertise the mask with each advertised route, and classful routing protocols do not. The classless routing protocols, as noted in Table N-1, are the newer, more advanced routing protocols. Not only do these more advanced classless routing protocols support VLSM, but they also support manual route summariza-tion, which allows a routing protocol to advertise one route for a larger subnet instead of multiple routes for smaller subnets. + +Table N-1 Classless and Classful Interior IP Routing Protocols + +Routing Protocol +RIPv1 RIPv2 EIGRP +OSPF + + +Is It Classless? +No Yes Yes +Yes + + +Sends Mask in Updates? +No Yes Yes +Yes + + +Supports VLSM? +No Yes Yes +Yes + +Supports Manual Route N Summarization? +No Yes Yes +Yes + + +Beyond VLSM itself, the routing protocols do not have to be configured to support VLSM or to be classless. There is no command to enable or disable the fact that classless routing protocols include the mask with each route. The only configuration choice you must make is to use a classless routing protocol. + +VLSM Configuration and Verification +Cisco routers do not configure VLSM, enable or disable it, or need any configuration to use it. From a configuration perspective, VLSM is simply a side effect of using the ip +address interface subcommand. Routers collectively configure VLSM by virtue of having IP addresses in the same classful network but with different masks. + +For example, Example N-1 shows two of the interfaces from router Yosemite from Figure N-1. The example shows the IP address assignments on two interfaces, one with a /24 mask and one with a /30 mask, both with IP addresses in Class A network 10.0.0.0. +Example N-1 Configuring Two Interfaces on Yosemite, Resulting in VLSM + +Yosemite# configure terminal +Yosemite(config)# interface Fa0/0 +Yosemite(config-if)# ip address 10.2.1.1 255.255.255.0 +Yosemite(config-if)# interface S0/1 +Yosemite(config-if)# ip address 10.1.4.1 255.255.255.252 + +The use of VLSM can also be detected by a detailed look at the output of the show ip route command. This command lists routes in groups, by classful network, so that you see all the subnets of a single Class A, B, or C network all in a row. Just look down the list, and + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +look to see, if any, how many different masks are listed. For example, Example N-2 lists the routing table on Albuquerque from Figure N-1; Albuquerque uses masks /24 and /30 inside network 10.0.0.0, as noted in the highlighted line in the example. +Example N-2 Albuquerque Routing Table with VLSM + +Albuquerque# show ip route +! Legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 14 subnets, 3 masks +D 10.2.1.0/24 [90/2172416] via 10.1.4.1, 00:00:34, Serial0/0 +D 10.2.2.0/24 [90/2172416] via 10.1.4.1, 00:00:34, Serial0/0 +D 10.2.3.0/24 [90/2172416] via 10.1.4.1, 00:00:34, Serial0/0 +D 10.2.4.0/24 [90/2172416] via 10.1.4.1, 00:00:34, Serial0/0 +D 10.3.4.0/24 [90/2172416] via 10.1.6.2, 00:00:56, Serial0/1 +D 10.3.5.0/24 [90/2172416] via 10.1.6.2, 00:00:56, Serial0/1 +D 10.3.6.0/24 [90/2172416] via 10.1.6.2, 00:00:56, Serial0/1 +D 10.3.7.0/24 [90/2172416] via 10.1.6.2, 00:00:56, Serial0/1 +C 10.1.1.0/24 is directly connected, FastEthernet0/0 +L 10.1.1.1/32 is directly connected, FastEthernet0/0 +C 10.1.6.0/30 is directly connected, Serial0/1 +L 10.1.6.1/32 is directly connected, Serial0/1 +C 10.1.4.0/30 is directly connected, Serial0/0 +L 10.1.4.1/32 is directly connected, Serial0/0 + + +NOTE For the purposes of understanding whether a design uses VLSM, ignore the /32 “local” routes that a router automatically creates for its own interface IP addresses. + +So ends the discussion of VLSM as an end to itself. This chapter is devoted to VLSM, but it took a mere three to four pages to fully describe it. Why the entire VLSM chapter? Well, to work with VLSM, to find problems with it, to add subnets to an existing design, and to design using VLSM from scratch—in other words, to apply VLSM to real networks—takes skill and practice. To do these same tasks on the exam requires skill and practice. The rest of this chapter examines the skills to apply VLSM and provides some practice for these two key areas: + +■ Finding VLSM overlaps +■ Adding new VLSM subnets without overlaps + +Finding VLSM Overlaps +Regardless of whether a design uses VLSM, the subnets used in any IP internetwork design should not overlap their address ranges. When subnets in different locations overlap their addresses, a router’s routing table entries overlap. As a result, hosts in different locations can be assigned the same IP address. Routers clearly cannot route packets correctly in these cases. In short, a design that uses overlapping subnets is considered to be an incorrect design and should not be used. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix N: Variable-Length Subnet Masks 5 + +This section begins with a short discussion about VLSM design, to drive home the ideas behind VLSM overlaps. It then gets into an operational and troubleshooting approach to the topic, by looking at existing designs and trying to find any existing overlaps. + +Designing Subnetting Plans with VLSM +When creating a subnetting plan using VLSM, you have to be much more careful in choos-ing what subnets to use. First, whatever masks you use in a VLSM design, each subnet ID must be a valid subnet ID given the mask that you use for that subnet. + +For example, consider a subnet plan for Class B network 172.16.0.0. To create a subnet with a /24 mask, the subnet ID must be a subnet ID that you could choose if you subnetted the whole Class B network with that same mask. Appendix L, “Subnet Design,” discusses how +to find those subnets in depth, but with a Class B network and a /24 mask, the possible sub-net IDs should be easy to calculate by now: 172.16.0.0 (the zero subnet), then 172.16.1.0, 172.16.2.0, 172.16.3.0, 172.16.4.0, and so on, up through 172.16.255.0. + +NOTE Subnet IDs must always follow this important binary rule as noted back in Chapter N 14, “Analyzing Existing Subnets”: In binary, each subnet ID has a host field of all binary 0s. +If you use the math and processes to find all subnet IDs per Appendix L, all those subnet IDs happen to have binary 0s in the host fields. + +Now expand your thinking about subnet IDs to a VLSM design. To begin, you would decide that you need some subnets with one mask, other subnets with another mask, and so on, to meet the requirements for different sizes of different subnets. For instance, imagine you start with a brand-new VLSM design, with Class B network 172.16.0.0. You plan to have some subnets with /22 masks, some with /23, and some with /24. You might develop then a planning diagram, or at least draw the ideas, with something like Figure N-2. + + +List of /22 Subnets 172.16.0.0 /22 + + + +172.16.4.0 /22 + + + +. +. +. + + +List of /23 Subnets 172.16.0.0 /23 + +172.16.2.0 /23 + +172.16.4.0 /23 + +172.16.6.0 /23 + +. +. +. + +List of /24 Subnets 172.16.0.0 /24 172.16.1.0 /24 172.16.2.0 /24 172.16.3.0 /24 172.16.4.0 /24 172.16.5.0 /24 172.16.6.0 /24 172.16.7.0 /24 + +. +. +. + + +Figure N-2 Possible Subnet IDs of Network 172.16.0.0, with /22, /23, and /24 Masks + +The drawing shows the first few subnet IDs available with each mask, but you cannot use all subnets from all three lists in a design. As soon as you choose to use one subnet from any column, you remove some subnets from the other lists because subnets cannot over-lap. Overlapping subnets are subnets whose range of addresses include some of the same addresses. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +As an example, Figure N-3 shows the same list of the first few possible /22, /23, and /24 subnets of Class B network 172.16.0.0. However, it shows a check mark beside two subnets that have been allocated for use; that is, on paper, the person making the subnetting plan has decided to use these two subnets somewhere in the network. The subnets with a dark gray shading and an X in them can no longer be used because they have some overlapping addresses with the subnets that have check marks (172.16.3.0/24 and 172.16.4.0/22). + + +List of /22 Subnets 172.16.0.0 /22 + + + +172.16.4.0 /22 + + + +. +. +. + + +List of /23 Subnets 172.16.0.0 /23 + +172.16.2.0 /23 + +172.16.4.0 /23 + +172.16.6.0 /23 + +. +. +. + +List of /24 Subnets 172.16.0.0 /24 172.16.1.0 /24 172.16.2.0 /24 172.16.3.0 /24 172.16.4.0 /24 172.16.5.0 /24 172.16.6.0 /24 172.16.7.0 /24 + +. +. +. + + +Figure N-3 Selecting Two Subnets Disallows Other Subnets in Different Columns + +Just to complete the example, first look at subnet 172.16.4.0 on the lower left. That subnet includes addresses from the subnet ID of 172.16.4.0 through the subnet broadcast address of 172.16.7.255. As you can see just by looking at the subnet IDs to the right, all the sub-nets referenced with the arrowed lines are within that same range of addresses. + +Now look to the upper right of the figure, to subnet 172.16.3.0/24. The subnet has a range of 172.16.3.0–172.16.3.255 including the subnet ID and subnet broadcast address. That sub-net overlaps with the two subnets referenced to the left. For instance, subnet 172.16.0.0/22 includes the range from 172.16.0.0–172.16.3.255. But because there is some overlap, once the design has allocated the 172.16.3.0/24 subnet, the 172.16.2.0/23 and 172.16.0.0/22 sub-nets could not be used without causing problems, because: + +A subnetting design, whether using VLSM or not, should not allow subnets whose address ranges overlap. If overlapping subnets are implemented, routing problems occur and some hosts simply cannot communicate outside their subnets. + +These address overlaps are easier to see when not using VLSM. When not using VLSM, overlapped subnets have identical subnet IDs, so to find overlaps, you just have to look at the subnet IDs. With VLSM, overlapped subnets may not have the same subnet ID, as +was the case in this most recent example with the subnets across the top of Figure N-3. To find these overlaps, you have to look at the entire range of addresses in each subnet, from subnet ID to subnet broadcast address, and compare the range to the other subnets in the design. + +An Example of Finding a VLSM Overlap +For example, imagine that a practice question for the CCENT exam shows Figure N-4. It uses a single Class B network (172.16.0.0), with VLSM, because it uses three different masks: /23, /24, and /30. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix N: Variable-Length Subnet Masks 7 + + + + + +Address Range? +172.16.2.1 /23 Fa0/0 + + +Address Range? + +172.16.9.1 /30 S0/0/1 + +R1 +S0/1/0 +172.16.9.5 /30 + + + +S0/0/1 172.16.9.2 /30 + + +172.16.9.6 /30 S0/0/1 + +172.16.4.1 /23 + +R2 Fa0/0 Address Range? + + +Address Range? +Fa0/0 + + + +R3 Address Range? + + +172.16.5.1 /24 + + +Figure N-4 VLSM Design with Possible Overlap + + +Now imagine that the exam question shows you the figure, and either directly or indirectly asks whether overlapping subnets exist. This type of question might simply tell you that some hosts cannot ping each other, or it might not even mention that the root cause could be that some of the subnets overlap. To answer such a question, you could follow this sim-ple but possibly laborious process: + + + + +N + +Step 1. Calculate the subnet ID and subnet broadcast address of each subnet, which gives you the range of addresses in that subnet. +Step 2. List the subnet IDs in numerical order (along with their subnet broadcast addresses). +Step 3. Scan the list from top to bottom, comparing each pair of adjacent entries, to see whether their range of addresses overlaps. + +For example, Table N-2 completes the first two steps based on Figure N-4, listing the sub-net IDs and subnet broadcast addresses, in numerical order based on the subnet IDs. + +Table N-2 Subnet IDs and Broadcast Addresses, in Numerical Order, from Figure N-4 + + +Subnet R1 LAN R2 LAN R3 LAN +R1-R2 serial +R1-R3 serial + +Subnet Number 172.16.2.0 172.16.4.0 172.16.5.0 172.16.9.0 +172.16.9.4 + +Broadcast Address 172.16.3.255 172.16.5.255 172.16.5.255 172.16.9.3 +172.16.9.7 + + +The VLSM design is invalid in this case because of the overlap between R2’s LAN subnet and R3’s LAN subnet. As for the process, Step 3 states the somewhat obvious step of com-paring the address ranges to see whether any overlaps occur. Note that, in this case, none of the subnet numbers are identical, but two entries (highlighted) do overlap. The design is invalid because of the overlap, and one of these two subnets would need to be changed. + +As far as the three-step process works, note that if two adjacent entries in the list overlap, compare three entries at the next step. The two subnets already marked as overlapped can overlap with the next subnet in the list. For example, the three subnets in the following list overlap in that the first subnet overlaps with the second and third subnets in the list. If you + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +followed the process shown here, you would have first noticed the overlap between the first two subnets in the list, so you would then also need to check the next subnet in the list to find out if it overlapped. + +10.1.0.0/16 (subnet ID 10.1.0.0, broadcast 10.1.255.255) 10.1.200.0/24 (subnet ID 10.1.200.0, broadcast 10.1.200.255) 10.1.250.0/24 (subnet ID 10.1.250.0, broadcast 10.1.250.255) + +Practice Finding VLSM Overlaps +As typical of anything to with applying IP addressing and subnetting, practice helps. To that end, Table N-3 lists three practice problems. Just start with the five IP addresses listed in a single column, and then follow the three-step process outlined in the previous section to find any VLSM overlaps. The answers can be found near the end of this chapter, in the sec-tion “Answers to Earlier Practice Problems.” + +Table N-3 VLSM Overlap Practice Problems + + +Problem 1 10.1.34.9/22 10.1.29.101/23 10.1.23.254/22 10.1.17.1/21 +10.1.1.1/20 + +Problem 2 172.16.126.151/22 172.16.122.57/27 172.16.122.33/30 172.16.122.1/30 +172.16.128.151/20 + +Problem 3 192.168.1.253/30 192.168.1.113/28 192.168.1.245/29 192.168.1.125/30 +192.168.1.122/30 + + +Adding a New Subnet to an Existing VLSM Design +The task described in this section happens frequently in real networks: choosing new sub-nets to add to an existing design. In real life, you can use IP Address Management (IPAM) tools that help you choose a new subnet so that you do not cause an overlap. However, for the CCNA exam, you need to be ready to do the mental process and math of choosing a subnet that does not create an overlapped VLSM subnet condition. In other words, you need to pick a new subnet and not make a mistake! + +For example, consider the internetwork shown earlier in Figure N-2, with classful network 172.16.0.0. An exam question might suggest that a new subnet, with a /23 prefix length, needs to be added to the design. The question might also say, “Pick the numerically lowest subnet number that can be used for the new subnet.” In other words, if both 172.16.4.0 and 172.16.6.0 would work, use 172.16.4.0. + +So, you really have a couple of tasks: To find all the subnet IDs that could be used, rule out the ones that would cause an overlap, and then check to see whether the question guides you to pick either the numerically lowest (or highest) subnet ID. This list outlines the spe- + +cific steps: + +Step 1. + +Step 2. + + +Pick the subnet mask (prefix length) for the new subnet, based on the design requirements (if not already listed as part of the question). +Calculate all possible subnet numbers of the classful network using the mask from Step 1, along with the subnet broadcast addresses. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix N: Variable-Length Subnet Masks 9 + +Step 3. Make a list of existing subnet IDs and matching subnet broadcast addresses. +Step 4. Compare the existing subnets to the candidate new subnets to rule out overlap-ping new subnets. +Step 5. Choose the new subnet ID from the remaining subnets identified at Step 4, paying attention to whether the question asks for the numerically lowest or numerically highest subnet ID. + +An Example of Adding a New VLSM Subnet +For example, Figure N-5 shows an existing internetwork that uses VLSM. (The figure uses the same IP addresses as shown in Figure N-4, but with R3’s LAN IP address changed to fix the VLSM overlap shown in Figure N-4.) In this case, you need to add a new subnet to sup-port 300 hosts. Imagine that the question tells you to use the smallest subnet (least number of hosts) to meet that requirement. You use some math and logic you learned earlier in your study to choose mask /23, which gives you 9 host bits, for 29 – 2 = 510 hosts in the subnet. + + + + +172.16.2.1 /23 Fa0/0 + + + +172.16.9.1 /30 S0/0/1 + +R1 +S0/1/0 +172.16.9.5 /30 + + + + +S0/0/1 172.16.9.2 /30 + + +172.16.9.6 /30 S0/0/1 + +172.16.4.1 /23 N R2 Fa0/0 + + + + +Fa0/0 +R3 172.16.5.1 /24 + + +Figure N-5 Internetwork to Which You Need to Add a /23 Subnet, Network 172.16.0.0 + +At this point, just follow the steps listed before Figure N-5. For Step 1, you have already been given the mask (/23). For Step 2, you need to list all the subnet numbers and broadcast addresses of 172.16.0.0, assuming the /23 mask. You will not use all these subnets, but you need the list for comparison to the existing subnets. Table N-4 shows the results, at least for the first five possible /23 subnets. + +Table N-4 First Five Possible /23 Subnets + + +Subnet First (zero) Second Third Fourth +Fifth + +Subnet Number 172.16.0.0 172.16.2.0 172.16.4.0 172.16.6.0 +172.16.8.0 + +Subnet Broadcast Address 172.16.1.255 +172.16.3.255 172.16.5.255 172.16.7.255 +172.16.9.255 + + +Next, at Step 3, list the existing subnet numbers and broadcast addresses, as shown earlier in Figure N-5. To do so, do the usual math to take an IP address/mask to then find the sub-net ID and subnet broadcast address. Table N-5 summarizes that information, including the locations, subnet numbers, and subnet broadcast addresses. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +Table N-5 Existing Subnet IDs and Broadcast Addresses from Figure N-5 + + +Subnet R1 LAN R2 LAN R3 LAN +R1-R2 serial +R1-R3 serial + +Subnet Number 172.16.2.0 172.16.4.0 172.16.6.0 172.16.9.0 +172.16.9.4 + +Subnet Broadcast Address 172.16.3.255 +172.16.5.255 172.16.6.255 172.16.9.3 +172.16.9.7 + + +At this point, you have all the information you need to look for the overlap at Step 4. Simply compare the range of numbers for the subnets in the previous two tables. Which of the possible new /23 subnets (Table N-4) overlap with the existing subnets (Table N-5)? In this case, the second through fifth subnets in Table N-4 overlap, so rule those out as candi-dates to be used. (Table N-4 denotes those subnets with gray highlights.) + +Step 5 has more to do with the exam than with real network design, but it is still worth list-ing as a separate step. Multiple-choice questions sometimes need to force you into a single answer, and asking for the numerically lowest or highest subnet does that. This particular example asks for the numerically lowest subnet number, which in this case is 172.16.0.0/23. + +NOTE The answer, 172.16.0.0/23, happens to be a zero subnet. For the exam, the zero subnet should be avoided if (a) the question implies the use of classful routing protocols or (b) the routers are configured with the no ip subnet-zero global configuration command. Otherwise, assume that the zero subnet can be used. + + + +Answers to Earlier Practice Problems + +Answers to Practice Finding VLSM Overlaps +This section lists the answers to the three practice problems in the section “Practice Finding VLSM Overlaps,” as listed earlier in Table N-3. Note that the tables that list details of the answer reordered the subnets as part of the process. + +In Problem 1, the second and third subnet IDs listed in Table N-6 happen to overlap. The second subnet’s range completely includes the range of addresses in the third subnet. + +Table N-6 VLSM Overlap Problem 1 Answers (Overlaps Highlighted) + + +Reference 1 +2 3 4 +5 + +Original Address and Mask 10.1.1.1/20 +10.1.17.1/21 10.1.23.254/22 10.1.29.101/23 +10.1.34.9/22 + +Subnet ID 10.1.0.0 10.1.16.0 10.1.20.0 10.1.28.0 +10.1.32.0 + +Broadcast Address 10.1.15.255 10.1.23.255 10.1.23.255 10.1.29.255 +10.1.35.255 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix N: Variable-Length Subnet Masks 11 + +In Problem 2, again the second and third subnet IDs (listed in Table N-7) happen to overlap, and again, the second subnet’s range completely includes the range of addresses in the third subnet. Also, the second and third subnet IDs are the same value, so the overlap is more obvious. + +Table N-7 VLSM Overlap Problem 2 Answers (Overlaps Highlighted) + + +Reference +1 + +Original Address and Mask +172.16.122.1/30 + +Subnet ID +172.16.122.0 + +Broadcast Address +172.16.122.3 + + + +2 172.16.122.57/27 +3 172.16.122.33/30 + +172.16.122.32 172.16.122.63 +172.16.122.32 172.16.122.35 + + + +4 172.16.126.151/22 +5 172.16.128.151/20 + +172.16.124.0 +172.16.128.0 + +172.16.127.255 +172.16.143.255 + + +In Problem 3, three subnets overlap. Subnet 1’s range completely includes the range of +addresses in the second and third subnets, as shown in Table N-8. Note that the second and N third subnets do not overlap with each other, so for the process in this book to find all the +overlaps, after you find that the first two subnets overlap, you should compare the next entry in the table (3) with both of the two known-to-overlap entries (1 and 2). + +Table N-8 VLSM Overlap Problem 3 Answers (Overlaps Highlighted) + + +Reference 1 +2 +3 + +Original Address and Mask 192.168.1.113/28 192.168.1.122/30 +192.168.1.125/30 + +Subnet ID 192.168.1.112 192.168.1.120 +192.168.1.124 + +Broadcast Address 192.168.1.127 192.168.1.123 +192.168.1.127 + + + +4 192.168.1.245/29 +5 192.168.1.253/30 + +192.168.1.240 192.168.1.247 +192.168.1.252 192.168.1.255 + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX O + + + + +Spanning Tree Protocol Implementation + + +NOTE This appendix contains an entire chapter that was published as a chapter in one of the past editions of this book or a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more. However, note that the content in this appendix has not been edited since it was published in the earlier edition, so references to exams and exam topics, and to other chapters, will be outdated. +This appendix was previously published as Chapter 3 of the book CCNA ICND2 200-105 Official Cert Guide, published in 2016. + +Cisco IOS–based LAN switches enable Spanning Tree Protocol (STP) by default on all interfaces in every VLAN. However, network engineers who work with medium-size to large-size Ethernet LANs usually want to configure at least some STP settings. First and foremost, Cisco IOS switches traditionally default to use STP rather than Rapid STP (RSTP), and the simple upgrade to RSTP improves convergence. For most LANs with more than a few switches, the network engineer will likely want to influence the choices made by STP, whether using traditional STP or RSTP—choices such as which switch becomes root, with predictability about which switch ports will block/discard when all ports are physically working. The configuration can also be set so that when links or switches fail, the engineer can predict the STP topology in those cases, as well. + +This chapter discusses configuration and verification of STP. The first major section weaves a story of how to change different settings, per VLAN, with the show commands that reveal the current STP status affected by each configuration command. Those settings impact both STP and RSTP, but the examples use switches that use traditional 802.1D STP rather than RSTP. The second major section shows how to configure the optional STP fea-tures PortFast, BPDU Guard, and EtherChannel (specifically Layer 2 EtherChannel). The final major section of this chapter looks at the simple (one command) configuration to enable RSTP, and the differences and similarities in show command output that occur when using RSTP versus STP. + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Implementing STP +Cisco IOS switches usually use STP (IEEE 802.1D) by default rather than RSTP, and with effective default settings. You can buy some Cisco switches and connect them with +Ethernet cables in a redundant topology, and STP will ensure that frames do not loop. And you never even have to think about changing any settings! + +Although STP works without any configuration, most medium-size to large-size campus LANs benefit from some STP configuration. With all defaults, the switches choose the root based on the lowest burned-in MAC address on the switches because they all default to use the same STP priority. As a better option, configure the switches so that the root is predict-able. + +For instance, Figure O-1 shows a typical LAN design model, with two distribution layer switches (D1 and D2). The design may have dozens of access layer switches that connect to end users; the figure shows just three access switches (A1, A2, and A3). For a variety of rea-sons, most network engineers make the distribution layer switches be the root. For instance, the configuration could make D1 be the root by having a lower priority, with D2 config-ured with the next lower priority, so it becomes root if D1 fails. + +Best Choices to be Root + +Distribution D1 D2 Switches + + + +Access A1 A2 A3 Switches + + + +10/100/1000 10/100/1000 10/100/1000 + +Figure O-1 Typical Configuration Choice: Making Distribution Switch Be Root +This first section of the chapter examines a variety of topics that somehow relate to STP configuration. It begins with a look at STP configuration options, as a way to link the con-cepts of Chapter 2 to the configuration choices in this chapter. Following that, this section introduces some show commands for the purpose of verifying the default STP settings before changing any configuration. + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix O: Spanning Tree Protocol Implementation + +Setting the STP Mode +The IEEE first standardized STP as the IEEE 802.1D standard, first published back in 1990. To put some perspective on that date, Cisco sold no LAN switches at the time, and virtual LANs did not exist yet. Instead of multiple VLANs in a LAN, there was just one broadcast domain, and one instance of STP. However, the addition of VLANs and the introduction of LAN switches into the market have created a need to add to and extend STP. + +Today, Cisco IOS–based LAN switches allow you to use one of three STP configuration modes that reflect that history. The first two sections of this chapter use the mode called Per-VLAN Spanning Tree Plus (PVST+, or sometimes PVSTP), a Cisco-proprietary improve-ment of 802.1D STP. The per-VLAN part of the name gives away the main feature: PVST+ creates a different STP topology per VLAN, whereas 802.1D actually did not. PVST+ also introduced PortFast. Cisco switches often use PVST+ as the default STP mode per a default global command of spanning-tree mode pvst. + +Over time, Cisco added RSTP support as well, with two STP modes that happen to use RSTP. One mode basically takes PVST+ and upgrades it to use RSTP logic as well, with a mode called Rapid PVST+, enabled with the global command spanning-tree mode +rapid-pvst. Cisco IOS–based switches support a third mode, called Multiple Spanning Tree (MST) (or Multiple Instance of Spanning Tree), enabled with the spanning-tree mode mst command. + +3 + + + + + + + + + + + + + + + + + + + +O + + +Connecting STP Concepts to STP Configuration Options +STP uses two types of numbers for most of its decisions: the BID and STP port costs. Focusing on those two types of numbers, consider this summary of what STP does behind the scenes: + +■ Uses the BID to elect the root switch, electing the switch with the numerically lowest BID +■ Uses the total STP cost in each path to the root, when each nonroot switch chooses its own root port (RP) +■ Uses each switch’s root cost, which is in turn based on STP port costs, when switches decide which switch port becomes the designated port (DP) on each LAN segment + +Unsurprisingly, Cisco switches let you configure part of a switch’s BID and the STP port cost, which in turn influences the choices each switch makes with STP. + +Per-VLAN Configuration Settings +Beyond supporting the configuration of the BID and STP port costs, Cisco switches support configuring both settings per VLAN. By default, Cisco switches use IEEE 802.1D, not RSTP (802.1w), with a Cisco-proprietary feature called Per-VLAN Spanning Tree Plus (PVST+). PVST+ (often abbreviated as simply PVST today) creates a different instance of STP for each VLAN. So, before looking at the tunable STP parameters, you need to have a basic understanding of PVST+, because the configuration settings can differ for each instance of STP. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +PVST+ gives engineers a load-balancing tool with STP. By changing some STP configura-tion parameters differently for different VLANs, the engineer could cause switches to pick different RPs and DPs in different VLANs. As a result, some traffic in some VLANs can be forwarded over one trunk, and traffic for other VLANs can be forwarded over a different trunk. + +Figure O-2 shows the basic idea, with SW3 forwarding odd-numbered VLAN traffic over the left trunk (Gi0/1) and even-numbered VLANs over the right trunk (Gi0/2). + + +VLAN 1 STP Topology + +Root + +VLAN 2 STP Topology + +Root + + + +Gi0/1 Gi0/2 +SW1 SW2 + +Gi0/1 Gi0/2 +SW1 SW2 + + + +Gi0/2 + + + +Gi0/1 + +SW3 + +Figure O-2 + +Gi0/1 Gi0/2 Gi0/1 + + + +Gi0/2 Gi0/1 Gi0/2 + +SW3 + +Load Balancing with PVST+ + +The next few pages look specifically at how to change the BID and STP port cost settings, per VLAN, when using the default PVST+ mode. + +The Bridge ID and System ID Extension +Originally, a switch’s BID was formed by combining the switch’s 2-byte priority and its +6-byte MAC address. Later, the IEEE changed the rules, splitting the original priority field into two separate fields, as shown in Figure O-3: a 4-bit priority field and a 12-bit subfield called the system ID extension (which represents the VLAN ID). + + +2 Bytes + +Priority (0 – 65,535) + +6 Bytes + +System ID (MAC Address) + + +Original Format Bridge ID + + + + + +Priority (Multiple of 4096) +4 Bits + +Figure O-3 + + +System ID Extension (Typically Holds VLAN ID) + +12 Bits + +STP System ID Extension + + +System ID (MAC Address) + +6 Bytes + +System ID Extension (MAC Address Reduction) + +Cisco switches let you configure the BID, but only the priority part. The switch fills in its universal (burned-in) MAC address as the system ID. It also plugs in the VLAN ID of a VLAN in the 12-bit system ID extension field. The only part configurable by the network engineer is the 4-bit priority field. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix O: Spanning Tree Protocol Implementation + +Configuring the number to put in the priority field, however, is one of the strangest things to configure on a Cisco router or switch. As shown at the top of Figure O-3, the priority field was originally a 16-bit number, which represented a decimal number from 0 to 65,535. Because of that history, the current configuration command (spanning-tree vlan vlan-id priority x) requires a decimal number between 0 and 65,535. But not just any number in that range will suffice—it must be a multiple of 4096: 0, 4096, 8192, 12288, and so on, up through 61,440. + +The switch still sets the first 4 bits of the BID based on the configured value. As it turns out, of the 16 allowed multiples of 4096, from 0 through 61,440, each has a different binary value in their first 4 bits: 0000, 0001, 0010, and so on, up through 1111. The switch sets the true 4-bit priority based on the first 4 bits of the configured value. + +Although the history and configuration might make the BID priority idea seem a bit convo-luted, having an extra 12-bit field in the BID works well in practice because it can be used to identify the VLAN ID. VLAN IDs range from 1 to 4094, requiring 12 bits. Cisco switches place the VLAN ID into the system ID extension field, so each switch has a unique BID per VLAN. + +For example, a switch configured with VLANs 1 through 4, with a default base priority of 32,768, has a default STP priority of 32,769 in VLAN 1, 32,770 in VLAN 2, 32,771 in +VLAN 3, and so on. So, you can view the 16-bit priority as a base priority (as configured in the spanning-tree vlan vlan-id priority x command) plus the VLAN ID. + +5 + + + + + + + + + + + + + + + + + + + +O + + +NOTE Cisco switches must use the system ID extension version of the bridge ID; it cannot be disabled. + + +Per-VLAN Port Costs +Each switch interface defaults its per-VLAN STP cost based on IEEE recommendations. On interfaces that support multiple speeds, Cisco switches base the cost on the current actual speed. So, if an interface negotiates to use a lower speed, the default STP cost reflects that lower speed. If the interface negotiates to use a different speed, the switch dynamically changes the STP port cost as well. + +Alternatively, you can configure a switch’s STP port cost with the spanning-tree [vlan vlan-id] cost cost interface subcommand. You see this command most often on trunks because setting the cost on trunks has an impact on the switch’s root cost, whereas setting STP costs on access ports does not. + +For the command itself, it can include the VLAN ID, or not. The command only needs a vlan parameter on trunk ports to set the cost per VLAN. On a trunk, if the command +omits the VLAN parameter, it sets the STP cost for all VLANs whose cost is not set by a spanning-tree vlan x cost command for that VLAN. + +STP Configuration Option Summary +Table O-1 summarizes the default settings for both the BID and the port costs and lists the optional configuration commands covered in this chapter. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +Table O-1 STP Defaults and Configuration Options + +Setting BID priority + +Interface cost + + + + + +PortFast +BPDU Guard + +Default Base: 32,768 + +100 for 10 Mbps + +19 for 100 Mbps + +4 for 1 Gbps + +2 for 10 Gbps Not enabled +Not enabled + +Command(s) to Change Default +spanning-tree vlan vlan-id root {primary | secondary} + +spanning-tree vlan vlan-id priority priority spanning-tree vlan vlan-id cost cost + + + + +spanning-tree portfast +spanning-tree bpduguard enable + + +Next, the configuration section shows how to examine the operation of STP in a simple net-work, along with how to change these optional settings. + +Verifying STP Operation +Before taking a look at how to change the configuration, first consider a few STP verifica-tion commands. Looking at these commands first will help reinforce the default STP set-tings. In particular, the examples in this section use the network shown in Figure O-4. + + +Larry DP Fa0/11 + + +DP +Gi0/1 +SW1 +Gi0/2 DP + +RP DP Archie +Gi0/2 Fa0/12 +SW2 Gi0/1 +DP + + + + + + + + +RP Gi0/1 +Gi0/2 +SW3 +DP Fa0/13 + +Bob + + + +Legend: +RP – Root Port +DP – Designated Port +– Blocking Port + + +Figure O-4 Sample LAN for STP Configuration and Verification Examples +Example O-1 begins the discussion with a useful command for STP: the show spanning-tree vlan 10 command. This command identifies the root switch and lists +settings on the local switch. Example O-1 lists the output of this command on both SW1 and SW2, as explained following the example. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 7 + +Example O-1 STP Status with Default STP Parameters on SW1 and SW2 SW1# show spanning-tree vlan 10 + +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +32778 +1833.9d7b.0e80 + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address 1833.9d7b.0e80 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- + +Fa0/11 Desg FWD 19 +Gi0/1 Desg FWD 4 +Gi0/2 Desg FWD 4 + +128.11 P2p Edge +128.25 P2p O +128.26 P2p + +SW2# show spanning-tree vlan 10 + +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +32778 +1833.9d7b.0e80 +4 +26 (GigabitEthernet0/2) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address 1833.9d7b.1380 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- + +Fa0/12 Desg FWD 19 +Gi0/1 Desg FWD 4 +Gi0/2 Root FWD 4 + +128.12 P2p +128.25 P2p +128.26 P2p + + + +Example O-1 begins with the output of the show spanning-tree vlan 10 command on SW1. This command first lists three major groups of messages: one group of messages about the root switch, followed by another group about the local switch, and ending with interface role and status information. In this case, SW1 lists its own BID as the root, with + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +even a specific statement that “This bridge is the root,” confirming that SW1 is now the root of the VLAN 10 STP topology. + +Next, compare the highlighted lines of the same command on SW2 in the lower half of the example. SW2 lists SW1’s BID details as the root; in other words, SW2 agrees that SW1 has won the root election. SW2 does not list the phrase “This bridge is the root.” SW2 then lists its own (different) BID details in the lines after the details about the root’s BID. + +The output also confirms a few default values. First, each switch lists the priority part of the BID as a separate number: 32778. This value comes from the default priority of 32768, plus VLAN 10, for a total of 32778. The output also shows the interface cost for some Fast Ethernet and Gigabit Ethernet interfaces, defaulting to 19 and 4, respectively. + +Finally, the bottom of the output from the show spanning-tree command lists each interface in the VLAN, including trunks, with the STP port role and port state listed. For instance, on switch SW1, the output lists three interfaces, with a role of Desg for designated port (DP) and a state of FWD for forwarding. SW2 lists three interfaces, two DPs, and one root port, so all three are in an FWD or forwarding state. + +Example O-1 shows a lot of good STP information, but two other commands, shown in Example O-2, work better for listing BID information in a shorter form. The first, show spanning-tree root, lists the root’s BID for each VLAN. This command also lists other details, like the local switch’s root cost and root port. The other command, show spanning-tree vlan 10 bridge, breaks out the BID into its component parts. In this example, it shows SW2’s priority as the default of 32768, the VLAN ID of 10, and the MAC address. +Example O-2 Listing Root Switch and Local Switch BIDs on Switch SW2 SW2# show spanning-tree root + +Root Hello Max Fwd +Vlan Root ID Cost Time Age Dly Root Port +---------------- -------------------- --------- ----- --- --- ------------ + +VLAN0001 +VLAN0010 +VLAN0020 +VLAN0030 +VLAN0040 + +32769 1833.9d5d.c900 +32778 1833.9d7b.0e80 +32788 1833.9d7b.0e80 +32798 1833.9d7b.0e80 +32808 1833.9d7b.0e80 + +23 2 20 15 Gi0/1 +4 2 20 15 Gi0/2 +4 2 20 15 Gi0/2 +4 2 20 15 Gi0/2 +4 2 20 15 Gi0/2 + + +SW2# show spanning-tree vlan 10 bridge + +Hello Max Fwd +Vlan Bridge ID Time Age Dly Protocol +---------------- --------------------------------- ----- --- --- -------- +VLAN0010 32778 (32768, 10) 1833.9d7b.1380 2 20 15 ieee + + +Note that both the commands in Example O-2 have a VLAN option: show spanning-tree [vlan x] root and show spanning-tree [vlan x] bridge. Without the VLAN listed, each command lists one line per VLAN; with the VLAN, the output lists the same information, but just for that one VLAN. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 9 + +Configuring STP Port Costs +Changing the STP port costs requires a simple interface subcommand: spanning-tree [vlan x] cost x. To show how it works, consider the following example, which changes what hap-pens in the network shown in Figure O-4. + +Back in Figure O-4, with default settings, SW1 became root, and SW3 blocked on its G0/2 interface. A brief scan of the figure, based on the default STP cost of 4 for Gigabit inter-faces, shows that SW3 should have found a cost 4 path and a cost 8 path to reach the root, + +as shown in Figure O-5. + +Root + +SW1 + + + + +Cost 4 +Gi0/2 SW2 + + + + + + + + + +Total +Cost = 4 Cost 4 + +O +Total +Cost 4 Cost = 8 + + +Gi0/1 Gi0/2 SW3 +Figure O-5 Analysis of SW3’s Current Root Cost of 4 with Defaults +To show the effects of changing the port cost, the next example shows a change to SW3’s configuration, setting its G0/1 port cost higher so that the better path to the root goes out SW3’s G0/2 port instead. Example O-3 also shows several other interesting effects. +Example O-3 Manipulating STP Port Cost and Watching the Transition to Forwarding State +SW3# debug spanning-tree events +Spanning Tree event debugging is on +SW3# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW3(config)# interface gigabitethernet0/1 +SW3(config-if)# spanning-tree vlan 10 cost 30 +SW3(config-if)# ^Z +SW3# +*Mar 11 06:28:00.860: STP: VLAN0010 new root port Gi0/2, cost 8 +*Mar 11 06:28:00.860: STP: VLAN0010 Gi0/2 -> listening +*Mar 11 06:28:00.860: STP: VLAN0010 sent Topology Change Notice on Gi0/2 +*Mar 11 06:28:00.860: STP[10]: Generating TC trap for port GigabitEthernet0/1 +*Mar 11 06:28:00.860: STP: VLAN0010 Gi0/1 -> blocking +*Mar 11 06:28:15.867: STP: VLAN0010 Gi0/2 -> learning +*Mar 11 06:28:30.874: STP[10]: Generating TC trap for port GigabitEthernet0/2 +*Mar 11 06:28:30.874: STP: VLAN0010 sent Topology Change Notice on Gi0/2 +*Mar 11 06:28:30.874: STP: VLAN0010 Gi0/2 -> forwarding + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +This example starts with the debug spanning-tree events command on SW3. This command tells the switch to issue debug log messages whenever STP performs changes to an interface’s role or state. These messages show up in the example as a result of the configuration. + +Next, the example shows the configuration to change SW3’s port cost, in VLAN 10, to 30, with the spanning-tree vlan 10 cost 30 interface subcommand. Based on the figure, the root cost through SW3’s G0/1 will now be 30 instead of 4. As a result, SW3’s best cost to reach the root is cost 8, with SW3’s G0/2 as its root port. + +The debug messages tell us what STP on SW3 is thinking behind the scenes, with time-stamps. Note that the first five debug messages, displayed immediately after the user exited configuration mode in this case, all happen at the same time (down to the same millisec-ond). Notably, G0/1, which had been forwarding, immediately moves to a blocking state. Interface G0/2, which had been blocking, does not go to a forwarding state, instead moving to a listening state (at least, according to this message). + +Now look for the debug message that lists G0/2 transitioning to learning state, and then the next one that shows it finally reaching forwarding state. How long between the messages? In each case, the message’s timestamps show that 15 seconds passed. In this experiment, the switches used a default setting of forward delay (15 seconds). So, these debug messages confirm the steps that STP takes to transition an interface from blocking to forwarding state. + +If you did not happen to enable a debug when configuring the cost, using show commands later can confirm the same choice by SW3, to now use its G0/2 port as its RP. Example O-4 shows the new STP port cost setting on SW3, along with the new root port and root cost, using the show spanning-tree vlan 10 command. Note that G0/2 is now listed as the root port. The top of the output lists SW3’s root cost as 8, matching the analysis shown in Figure O-5. +Example O-4 New STP Status and Settings on SW3 SW3# show spanning-tree vlan 10 + +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +32778 +1833.9d7b.0e80 +8 +26 (GigabitEthernet0/2) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address f47f.35cb.d780 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- + +Fa0/23 Desg FWD 19 +Gi0/1 Altn BLK 30 +Gi0/2 Root FWD 4 + +128.23 P2p +128.25 P2p +128.26 P2p + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + +Appendix O: Spanning Tree Protocol Implementation + +Configuring Priority to Influence the Root Election +The other big STP configuration option is to influence the root election by changing the priority of a switch. The priority can be set explicitly with the spanning-tree vlan vlan-id priority value global configuration command, which sets the base priority of the switch. (This is the command that requires a parameter of a multiple of 4096.) + +However, Cisco gives us a better configuration option than configuring a specific priority value. In most designs, the network engineers pick two switches to be root: one to be root if all switches are up, and another to take over if the first switch fails. Switch IOS supports this idea with the spanning-tree vlan vlan-id root primary and spanning-tree vlan vlan-id root secondary commands. + +The spanning-tree vlan vlan-id root primary command tells the switch to set its priority low enough to become root right now. The switch looks at the current root in that VLAN, and at the root’s priority. Then the local switch chooses a priority value that causes the local switch to take over as root. + +Remembering that Cisco switches use a default base priority of 32,768, this command chooses the base priority as follows: + +■ If the current root has a base priority higher than 24,576, the local switch uses a base pri-ority of 24,576. +■ If the current root’s base priority is 24,576 or lower, the local switch sets its base priority +to the highest multiple of 4096 that still results in the local switch becoming root. + +11 + + + + + + + + + + + + + + + + + + + +O + + +For the switch intended to take over as the root if the first switch fails, use the spanning-tree vlan vlan-id root secondary command. This command is much like the +spanning-tree vlan vlan-id root primary command, but with a priority value worse than the primary switch but better than all the other switches. This command sets the switch’s base priority to 28,672 regardless of the current root’s current priority value. + +For example, in Figures O-4 and O-5, SW1 was the root switch, and as shown in various commands, all three switches defaulted to use a base priority of 32,768. Example O-5 shows a configuration that makes SW2 the primary root, and SW1 the secondary, just to show the role move from one to the other. These commands result in SW2 having a base priority of 24,576, and SW1 having a base priority of 28,672. +Example O-5 Making SW2 Become Root Primary, and SW1 Root Secondary + +! First, on SW2: +SW2# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW2(config)# spanning-tree vlan 10 root primary +SW2(config)# ^Z +! Next, SW1 is configured to back-up SW1 +SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# spanning-tree vlan 10 root secondary +SW1(config)# ^Z +SW1# + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +! The next command shows the local switch's BID (SW1) +SW1# show spanning-tree vlan 10 bridge + +Hello Max Fwd +Vlan Bridge ID Time Age Dly Protocol +---------------- --------------------------------- ----- --- --- -------- +VLAN0010 28682 (28672, 10) 1833.9d7b.0e80 2 20 15 ieee + +! The next command shows the root's BID (SW2) +SW1# show spanning-tree vlan 10 root + +Root Hello Max Fwd +Vlan Root ID Cost Time Age Dly Root Port +---------------- -------------------- --------- ----- --- --- ------------ +VLAN0010 24586 1833.9d7b.1380 4 2 20 15 Gi0/1 + + +The output of the two show commands clearly points out the resulting priority values on each switch. First, the show spanning-tree bridge command lists the local switch’s BID information, while the show spanning-tree root command lists the root’s BID, plus the local switch’s root cost and root port (assuming it is not the root switch). So, SW1 lists its own BID, with priority 28,682 (base 28,672, with VLAN 10) with the show spanning-tree bridge command. Still on SW1, the output lists the root’s priority as 24,586 in VLAN 10, implied as base 24,576 plus 10 for VLAN 10, with the show spanning-tree root com-mand. + +Note that alternatively you could have configured the priority settings specifically. SW1 could have used the spanning-tree vlan 10 priority 28672 command, with SW2 using the spanning-tree vlan 10 priority 24576 command. In this particular case, both options would result in the same STP operation. + +Implementing Optional STP Features +This just-completed first major section of the chapter showed examples that used PVST+ only, assuming a default global command of spanning-tree mode pvst. At the same time, all the configuration commands shown in that first section, commands that influence STP operation, would influence both traditional STP and RSTP operation. + +This section, the second of three major sections in this chapter, now moves on to discuss some useful but optional features that make both STP and RSTP work even better. + +Configuring PortFast and BPDU Guard +You can easily configure the PortFast and BPDU Guard features on any interface, but with two different configuration options. One option works best when you want to enable these features only on a few ports, and the other works best when you want to enable these fea-tures on most every access port. + +First, to enable the features on just one port at a time, use the spanning-tree portfast and the spanning-tree bpduguard enable interface subcommands. Example O-6 shows an + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 13 + +example of the process, with SW3’s F0/4 interface enabling both features. (Also, note the long warning message IOS lists when enabling PortFast; using PortFast on a port connected to other switches can indeed cause serious problems.) +Example O-6 Enabling PortFast and BPDU Guard on One Interface SW3# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW3(config)# interface fastEthernet 0/4 +SW3(config-if)# spanning-tree portfast +%Warning: portfast should only be enabled on ports connected to a single +host. Connecting hubs, concentrators, switches, bridges, etc... to this +interface when portfast is enabled, can cause temporary bridging loops. +Use with CAUTION + +%Portfast has been configured on FastEthernet0/4 but will only +have effect when the interface is in a non-trunking mode. + +SW3(config-if)# spanning-tree bpduguard ? + +disable +enable + +Disable BPDU guard for this interface +Enable BPDU guard for this interface + + +O + + +SW3(config-if)# spanning-tree bpduguard enable +SW3(config-if)# ^Z +SW3# + + +Example O-7 shows some brief information about the interface configuration of both PortFast and BPDU Guard. Of course, the show running-config command (not shown) would confirm the configuration commands from Example O-6. The show spanning-tree interface fastethernet0/4 portfast command in Example O-7 lists the PortFast status of the interface; note that the status value of enabled is displayed only if PortFast is configured and the interface is up. The show spanning-tree interface detail command then shows a line near the end of the output that states that PortFast and BPDU Guard are enabled. Note that this command would not list those two highlighted lines of output if these two features were not enabled. +Example O-7 Verifying PortFast and BPDU Guard Configuration SW3# show spanning-tree interface fastethernet0/4 portfast +VLAN0104 enabled + +SW11# show spanning-tree interface F0/4 detail +Port 4 (FastEthernet0/4) of VLAN0001 is designated forwarding +Port path cost 19, Port priority 128, Port Identifier 128.4. +Designated root has priority 32769, address bcc4.938b.a180 +Designated bridge has priority 32769, address bcc4.938b.e500 +Designated port id is 128.4, designated path cost 19 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +The port is in the portfast mode +Link type is point-to-point by default +Bpdu guard is enabled +BPDU: sent 1721, received 0 + + +PortFast and BPDU Guard are disabled by default on all interfaces, and to use them, each interface requires interface subcommands like those in Example O-6. Alternately, for both features, you can enable the feature globally. Then, for interfaces for which the feature should be disabled, you can use another interface subcommand to disable the feature. + +The ability to change the global default for these features reduces the number of interface subcommands required. For instance, on an access layer switch with 48 access ports and two uplinks, you probably want to enable both PortFast and BPDU Guard on all 48 access ports. Rather than requiring the interface subcommands on all 48 of those ports, enable the fea-tures globally, and then disable them on the uplink ports. + +Table O-2 summarizes the commands to enable and disable both PortFast and BPDU Guard, both globally and per interface. For instance, the global command spanning-tree portfast default changes the default so that all interfaces use PortFast, unless a port also has the spanning-tree portfast disable interface subcommand configured. + +Table O-2 Enabling and Disabling PortFast and BPDU Guard, Globally and Per Interface + +Action +Disable PortFast + +Enable PortFast Disable BPDU Guard + +Enable BPDU Guard + +Globally +no spanning-tree portfast default + +spanning-tree portfast default +no spanning-tree portfast bpduguard default +spanning-tree portfast bpduguard default + +One Interface +spanning-tree portfast disable +spanning-tree portfast +spanning-tree bpduguard disable +spanning-tree bpduguard enable + + +Example O-8 shows another new command, show spanning-tree summary. This com-mand shows the current global settings for several STP parameters, including the PortFast and BPDU Guard features. This output was gathered on a switch that had enabled both PortFast and BPDU Guard globally. +Example O-8 Displaying Status of Global Settings for PortFast and BPDU Guard SW1# show spanning-tree summary +Switch is in pvst mode +Root bridge for: none +EtherChannel misconfig guard is enabled + +Extended system ID +Portfast Default +PortFast BPDU Guard Default + +is enabled +is enabled +is enabled + +Portfast BPDU Filter Default is disabled + +Loopguard Default +UplinkFast +BackboneFast + +is disabled +is disabled +is disabled + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 15 + +Configured Pathcost method used is short + +Name Blocking Listening Learning Forwarding STP Active +---------------------- -------- --------- -------- ---------- ---------- +VLAN0001 3 0 0 2 5 +---------------------- -------- --------- -------- ---------- ---------- +1 vlan 3 0 0 2 5 + + +Configuring EtherChannel +Two neighboring switches can treat multiple parallel links between each other as a single logical link called an EtherChannel. STP operates on the EtherChannel, instead of +the individual physical links, so that STP either forwards or blocks on the entire logical EtherChannel for a given VLAN. As a result, a switch in a forwarding state can then load balance traffic over all the physical links in the EtherChannel. Without EtherChannel, only one of the parallel links between two switches would be allowed to forward traffic, with the rest of the links blocked by STP. + +NOTE All references to EtherChannel in this Chapter refer to Layer 2 EtherChannels, and O not to Layer 3 EtherChannels. + +EtherChannel may be one of the most challenging switch features to make work. First, the configuration has several options, so you have to remember the details of which options work together. Second, the switches also require a variety of other interface settings to match among all the links in the channel, so you have to know those settings as well. + +This section focuses on the correct EtherChannel configuration. + +Configuring a Manual EtherChannel +The simplest way to configure an EtherChannel is to add the correct channel-group con-figuration command to each physical interface, on each switch, all with the on keyword. The on keyword tells the switches to place a physical interface into an EtherChannel. + +Before getting into the configuration and verification, however, you need to start using three terms as synonyms: EtherChannel, PortChannel, and Channel-group. Oddly, IOS uses the channel-group configuration command, but then to display its status, IOS uses the show etherchannel command. Then, the output of this show command refers to neither an “EtherChannel” nor a “Channel-group,” instead using the term “PortChannel.” So, pay close attention to these three terms in the example. + +To configure an EtherChannel manually, follow these steps: + +Step 1. Add the channel-group number mode on command in interface configuration mode under each physical interface that should be in the channel to add it to the channel. +Step 2. Use the same number for all commands on the same switch, but the channel-group number on the neighboring switch can differ. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +Example O-9 shows a simple example, with two links between switches SW1 and SW2, as shown in Figure O-6. The configuration shows SW1’s two interfaces placed into channel-group 1, with two show commands to follow. + + +Channel-group 1 Fa0/14 + +Channel-group 2 Fa0/16 + +SW1 Fa0/15 Fa0/17 SW2 + +Figure O-6 Sample LAN Used in EtherChannel Example + +Example O-9 Configuring and Monitoring EtherChannel SW1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# interface fa 0/14 +SW1(config-if)# channel-group 1 mode on +SW1(config)# interface fa 0/15 +SW1(config-if)# channel-group 1 mode on +SW1(config-if)# ^Z + +SW1# show spanning-tree vlan 3 + +VLAN0003 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +28675 +0019.e859.5380 +12 +72 (Port-channel1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 28675 (priority 28672 sys-id-ext 3) +Address 0019.e86a.6f80 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type +---------------- ---- --- --------- -------- -------------------------------- +Po1 Root FWD 12 128.64 P2p Peer(STP) + +SW1# show etherchannel 1 summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 17 + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+----------------------------------------------- +1 Po1(SU) - Fa0/14(P) Fa0/15(P) + + +Take a few moments to look at the output in the two show commands in the example, as well. First, the show spanning-tree command lists Po1, short for PortChannel1, as an inter-face. This interface exists because of the channel-group commands using the 1 parameter. STP no longer operates on physical interfaces F0/14 and F0/15, instead operating on the PortChannel1 interface, so only that interface is listed in the output. +Next, note the output of the show etherchannel 1 summary command. It lists as a head- O ing “Port-channel,” with Po1 below it. It also lists both F0/14 and F0/15 in the list of ports, +with a (P) beside each. Per the legend, the P means that the ports are bundled in the port channel, which is a code that means these ports have passed all the configuration checks and are valid to be included in the channel. + +NOTE Cisco uses the term EtherChannel to refer to the concepts discussed in this sec-tion. To refer to the item configured in the switch, Cisco instead uses the term port chan-nel, with the command keyword port-channel. For the purposes of understanding the technology, you may treat these terms as synonyms. However, it helps to pay close atten-tion to the use of the terms port channel and EtherChannel as you work through the examples in this section, because IOS uses both. + + +Configuring Dynamic EtherChannels +Cisco switches support two different protocols that allow the switches to negotiate whether a particular link becomes part of an EtherChannel or not. Basically, the configuration enables the protocol for a particular channel-group number. At that point, the switch can use the protocol to send messages to/from the neighboring switch and discover whether their configuration settings pass all checks. If a given physical link passes, the link is added to the EtherChannel and used; if not, it is placed in a down state, and not used, until the configuration inconsistency can be resolved. + +Cisco switches support the Cisco-proprietary Port Aggregation Protocol (PAgP) and the IEEE standard Link Aggregation Control Protocol (LACP), based on IEEE standard 802.3ad. Although differences exist between the two, to the depth discussed here, they both accom-plish the same task: negotiate so that only links that pass the configuration checks are actu-ally used in an EtherChannel. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +To configure either protocol, a switch uses the channel-group configuration commands on each switch, but with a keyword that either means “use this protocol and begin negotia-tions” or “use this protocol and wait for the other switch to begin negotiations.” As shown in Figure O-7, the desirable and auto keywords enable PAgP, and the active and passive keywords enable LACP. With these options, at least one side has to begin the negotia-tions. In other words, with PAgP, at least one of the two sides must use desirable, and with LACP, at least one of the two sides must use active. + +Using PAgP +channel-group 1 mode desirable channel-group 2 mode {desirable | auto} + + +Begins G0/1 Negotiations SW1 G0/2 + +G0/2 + +G0/1 SW2 + + +channel-group 1 mode active channel-group 2 mode {active | passive} +Using LACP + +Figure O-7 Correct EtherChannel Configuration Combinations + +NOTE Do not use the on parameter on one end, and either auto or desirable (or for LACP, active or passive) on the neighboring switch. The on option uses neither PAgP nor LACP, so a configuration that uses on, with PAgP or LACP options on the other end, would prevent the EtherChannel from working. + +For example, in the design shown in Figure O-7, imagine both physical interfaces on both switches were configured with the channel-group 2 mode desirable interface subcom-mand. As a result, the two switches would negotiate and create an EtherChannel. Example O-10 shows the verification of that configuration, with the command show etherchannel 2 port-channel. This command confirms the protocol in use (PAgP, because the desirable keyword was configured), and the list of interfaces in the channel. +Example O-10 EtherChannel Verification: PAgP Desirable Mode SW1# show etherchannel 2 port-channel +Port-channels in the group: +--------------------------- + +Port-channel: Po2 +------------ + +Age of the Port-channel = 0d:00h:04m:04s + +Logical slot/port +GC + += 16/1 += 0x00020001 + +Number of ports = 2 +HotStandBy port = null + +Port state = Port-channel Ag-Inuse +Protocol = PAgP +Port security = Disabled + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 19 + +Ports in the Port-channel: + +Index Load Port EC state No of bits +------+------+------+------------------+----------- + +0 00 Gi0/1 +0 00 Gi0/2 + +Desirable-Sl 0 +Desirable-Sl 0 + + +Time since last port bundled: 0d:00h:03m:57s Gi0/2 + + + +Implementing RSTP +All you have to do to migrate from STP to RSTP is to configure the spanning-tree mode rapid-pvst global command on all the switches. However, for exam preparation, it helps to work through the various show commands, particularly to prepare for Simlet questions. Those questions can ask you to interpret show command output without allowing you to look at the configuration, and the output of show commands when using STP versus RSTP is very similar. + +This third and final major section of this chapter focuses on pointing out the similarities and differences between STP and RSTP as seen in Catalyst switch configuration and verification commands. This section explains the configuration and verification of RSTP, with emphasis on how to identify RSTP features. + + + + + + + + + +O + + +Identifying the STP Mode on a Catalyst Switch +Cisco Catalyst switches operate in some STP mode as defined by the spanning-tree mode global configuration command. Based on this command’s setting, the switch is using either 802.1D STP or 802.1w RSTP, as noted in Table O-3. + +Table O-3 Cisco Catalyst STP Configuration Modes + +Parameter on spanning-tree mode Command + +Uses Protocol Listed Description STP or in Command +RSTP? Output + + + +pvst +rapid-pvst + +mst + +STP ieee RSTP rstp + +RSTP mst + +Default; Per-VLAN Spanning Tree instance +Like PVST, but uses RSTP rules instead of STP for each STP instance +Creates multiple RSTP instances but does not require one instance per each VLAN + + +To determine whether a Cisco Catalyst switch uses RSTP, you can look for two types of information. First, you can look at the configuration, as noted in the left column of Table O-3. Also, some show commands list the STP protocol as a reference to the configuration of the spanning-tree mode global configuration command. A protocol of rstp or mst refers to one of the modes that uses RSTP, and a protocol of ieee refers to the mode that happens to use STP. + +Before looking at an example of the output, review the topology in Figure O-8. The remain-ing RSTP examples in this chapter use this topology. In the RSTP examples in this chapter, SW1 will become root, and SW3 will block on one port (G0/2), as shown. + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +20 CCNA 200-301 Official Cert Guide, Volume 1 + + + + +Larry DP Fa0/11 + +Root +DP +Gi0/1 +SW1 +Gi0/2 DP + + +RP DP Archie +Gi0/2 Fa0/12 +SW2 Gi0/1 +DP + + + + + + + + +RP Gi0/1 +Gi0/2 +SW3 +DP Fa0/13 + +Bob + + + +Legend: +RP – Root Port +DP – Designated Port +– Blocking Port + + +Figure O-8 Network Topology for STP and RSTP Examples +The first example focuses on VLAN 10, with all switches using 802.1D STP and the default setting of spanning-tree mode pvst. This setting creates an instance of STP per VLAN (which is the per-VLAN part of the name) and uses 802.1D STP. Each switch places the port connected to the PC into VLAN 10 and enables both PortFast and BPDU Guard. Example O-11 shows a sample configuration from switch SW3, with identical interface subcom-mands configured on SW1’s F0/11 and SW2’s F0/12 ports, respectively. +Example O-11 Sample Configuration from Switch SW3 SW3# show running-config interface Fastethernet 0/13 + +Building configuration... + +Current configuration : 117 bytes +! +interface FastEthernet0/13 +switchport access vlan 10 +spanning-tree portfast +spanning-tree bpduguard enable +end + + +At this point, the three switches use 802.1D STP because all use the default PVST mode. Example O-12 shows the evidence of STP’s work, with only subtle and indirect clues that STP happens to be in use. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 21 + +Example O-12 Output That Confirms the Use of 802.1D STP on Switch SW3 SW3# show spanning-tree vlan 10 + +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +32778 +1833.9d7b.0e80 +4 +25 (GigabitEthernet0/1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address f47f.35cb.d780 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- +Fa0/13 Desg FWD 19 128.13 P2p Edge O + +Gi0/1 Root FWD 4 +Gi0/2 Altn BLK 4 + +128.25 P2p +128.26 P2p + + + +SW3# show spanning-tree vlan 10 bridge + + +Hello Max +Vlan Bridge ID Time Age + +Fwd +Dly Protocol + +---------------- --------------------------------- ----- --- --- -------- +VLAN0010 32778 (32768, 10) f47f.35cb.d780 2 20 15 ieee + + +The highlighted parts of the example note the references to the STP protocol as ieee, which implies that STP is in use. The term ieee is a reference to the original IEEE 802.1D STP standard. + +To migrate this small network to use RSTP, configure the spanning-tree mode rapid-pvst command. This continues the use of per-VLAN spanning-tree instances, but it applies RSTP logic to each STP instance. Example O-13 shows the output of the same two commands from Example O-12 after configuring the spanning-tree mode rapid-pvst command on all three switches. +Example O-13 Output That Confirms the Use of 802.1w RSTP on Switch SW3 SW3# show spanning-tree vlan 10 + +VLAN0010 +Spanning tree enabled protocol rstp + +Root ID Priority +Address + +32778 +1833.9d7b.0e80 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +22 CCNA 200-301 Official Cert Guide, Volume 1 + +Cost 4 +Port 25 (GigabitEthernet0/1) +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address f47f.35cb.d780 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- + +Fa0/13 Desg FWD 19 +Gi0/1 Root FWD 4 +Gi0/2 Altn BLK 4 + +128.13 P2p Edge +128.25 P2p +128.26 P2p + + + +SW3# show spanning-tree vlan 10 bridge + + +Hello Max +Vlan Bridge ID Time Age + +Fwd +Dly Protocol + +---------------- --------------------------------- ----- --- --- -------- +VLAN0010 32778 (32768, 10) f47f.35cb.d780 2 20 15 rstp + + +Pay close attention to the differences between the 802.1D STP output in Example O-12 and the 802.1w RSTP output in Example O-13. Literally, the only difference is rstp instead of ieee in one place in the output of each of the two commands listed. In this case, rstp refers to the configuration of the spanning-tree mode rapid-pvst global config command, which implied the use of RSTP. + +RSTP Port Roles +RSTP adds two port roles to STP: the alternate port and the backup port. Example O-14 repeats an excerpt from the show spanning-tree vlan 10 command on switch SW3 to show an example of the alternate port role. SW3 (as shown earlier in Figure O-8) is not the root switch, with G0/1 as its root port and G0/2 as an alternate port. +Example O-14 Output Confirming SW3’s Root Port and Alternate Port Roles SW3# show spanning-tree vlan 10 +! Lines omitted for brevity +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- + +Fa0/13 Desg FWD 19 +Gi0/1 Root FWD 4 +Gi0/2 Altn BLK 4 + +128.13 P2p Edge +128.25 P2p +128.26 P2p + + + +The good news is that the output clearly lists which port is the root port (Gi0/1) and which port is the alternate root port (Gi0/2). The only trick is to know that Altn is a shortened ver-sion of the word alternate. + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 23 + +Pay close attention to this short description of an oddity about the STP and RSTP output on Catalyst switches! Cisco Catalyst switches often show the alternate and backup ports in output even when using STP and not RSTP. The alternate and backup port concepts are RSTP concepts. The switches only converge faster using these concepts when using RSTP. +But show command output, when using STP and not RSTP, happens to identify what would be the alternate and backup ports if RSTP were used. + +Why might you care about such trivia? Seeing output that lists an RSTP alternate port does not confirm that the switch is using RSTP. So, do not make that assumption on the exam. To confirm that a switch uses RSTP, you must look at the configuration of the spanning-tree mode command, or look for the protocol as summarized back in Table O-3. + +For instance, just compare the output of Example O-12 and Example O-14. Example O-12 shows output for this same SW3, with the same parameters, except that all switches used PVST mode, meaning all the switches used STP. Example O-12’s output (based on STP) lists SW3’s G0/2 as Altn, meaning alternate, even though the alternate port concept is not an STP concept, but an RSTP concept. + + +RSTP Port States +RSTP added one new port state compared to STP, discarding, using it as a replacement for the STP port states of disabled and blocking. You might think that after you configure a switch to use RSTP rather than STP, instead of seeing ports in a blocking state, you would now see the discarding state. However, the Cisco Catalyst switch output basically ignores the new term discarding, continuing to use the old term blocking instead. + +For example, scan back to the most recent RSTP example (Example O-14), to the line for SW3’s port G0/2. Then look for the column with heading STS, which refers to the status or state. The output shows G0/2 is listed as BLK, or blocking. In theory, because SW3 uses RSTP, the port state ought to be discarding, but the switch IOS continues to use the older notation of BLK for blocking. + +Just as one more bit of evidence, the command show spanning-tree vlan 10 interface gigabitethernet0/2 state lists the STP or RSTP port state with the state fully spelled out. Example O-15 shows this command, taken from SW3, for interface G0/2. Note the fully spelled-out blocking term instead of the RSTP term discarding. + + + +O + +Example O-15 SW3, an RSTP Switch, Continues to Use the Old Blocking Term SW3# show spanning-tree vlan 10 interface gigabitEthernet 0/2 state +VLAN0010 blocking + + +RSTP Port Types +Cisco Catalyst switches determine the RSTP port type based on two port settings: the cur-rent duplex (full or half) and whether the PortFast feature is enabled. First, full duplex tells the switch to use port type point-to-point, with half duplex telling the switch to use port type shared. Enabling PortFast tells the switch to treat the port as an edge port. Table O-4 summarizes the combinations. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +24 CCNA 200-301 Official Cert Guide, Volume 1 + + +Table O-4 +Type + +RSTP Port Types +Current Duplex Status Is Spanning-Tree PortFast Configured? + +Point-to-point Full No Point-to-point edge Full Yes Shared Half No Shared edge1 Half Yes +1 Cisco recommends against using this combination, to avoid causing loops. + +You can easily find the RSTP port types in the output of several commands, including the same show spanning-tree command in Example O-16. Example O-16 lists output from switch SW2, with a hub added off SW2’s F0/18 port (not shown in Figure O-8). The hub was added so that the output in Example O-16 lists a shared port (noted as Shr) to go along with the point-to-point ports (noted as P2p). +Example O-16 RSTP Port Types SW2# show spanning-tree vlan 10 + +VLAN0010 +Spanning tree enabled protocol rstp + +Root ID Priority +Address +Cost +Port + +32778 +1833.9d7b.0e80 +4 +26 (GigabitEthernet0/2) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address 1833.9d7b.1380 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- + +Fa0/12 Desg FWD 19 +Fa0/18 Desg FWD 19 +Gi0/1 Desg FWD 4 +Gi0/2 Root FWD 4 + +128.12 P2p Edge +128.18 Shr +128.25 P2p +128.26 P2p + + + +For exam prep, again note an odd fact about the highlighted output in Example O-16: The port type details appear in the output when using both STP and RSTP. For example, refer to Example O-12 again, which shows output from SW3 when using STP (when configured for PVST mode). The Type column also identifies point-to-point and edge interfaces. + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix O: Spanning Tree Protocol Implementation 25 + +Command References +Tables O-5 and O-6 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table O-5 Appendix O Configuration Command Reference + +Command +spanning-tree mode {pvst | rapid-pvst | mst} +spanning-tree [vlan vlan-number] root primary + + + +spanning-tree [vlan vlan-number] root secondary + +Description +Global configuration command to set the STP mode. +Global configuration command that changes this switch to the root switch. The switch’s priority is changed to the lower of either 24,576 or 4096 less than the priority of the current root bridge when the command was issued. +Global configuration command that sets this switch’s STP base priority to 28,672. + + + +spanning-tree [vlan vlan-id] {priority Global configuration command that changes the priority} bridge priority of this switch for the specified +VLAN. + + +O + + + +spanning-tree [vlan vlan-number] cost cost +spanning-tree [vlan vlan-number] port-priority priority + +channel-group channel-group-number mode {auto | desirable | active | passive | on} +spanning-tree portfast + +spanning-tree bpduguard enable + +spanning-tree portfast default + + +spanning-tree portfast bpduguard default + +no spanning-tree portfast default + +no spanning-tree portfast bpduguard default +spanning-tree portfast disable + +spanning-tree bpduguard disable + +Interface subcommand that changes the STP cost to the configured value. +Interface subcommand that changes the STP port priority in that VLAN (0 to 240, in increments of 16). +Interface subcommand that enables EtherChannel on the interface. + +Interface subcommand that enables PortFast on the interface. +Interface subcommand that enables BPDU Guard on an interface. +Global command that changes the switch default for PortFast on access interfaces from disabled to enabled. +Global command that changes the switch default for BPDU Guard on access interfaces from disabled to enabled. +Global command that changes the global setting for PortFast to disabled. +Global command that changes the global setting for BPDU Guard to disabled. +Interface subcommand that disables PortFast on the interface. +Interface subcommand that disables BPDU Guard on an interface. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +26 CCNA 200-301 Official Cert Guide, Volume 1 + +Table O-6 Appendix O EXEC Command Reference + +Command +show spanning-tree + +show spanning-tree interface interface-id +show spanning-tree vlan vlan-id +show spanning-tree [vlan vlan-id] root + +show spanning-tree [vlan vlan-id] bridge +show spanning-tree summary + + + +debug spanning-tree events + +show spanning-tree interface type number portfast +show etherchannel [channel-group-number] {brief | detail | port | port-channel | summary} + +Description +Lists details about the state of STP on the switch, including the state of each port. +Lists STP information only for the specified port. +Lists STP information for the specified VLAN. +Lists information about each VLAN’s root or for just the specified VLAN. +Lists STP information about the local switch for each VLAN or for just the specified VLAN. +Lists global STP settings for a switch, including the default PortFast and BPDU Guard settings, and the VLANs for which this switch is the root switch. +Causes the switch to provide informational messages about changes in the STP topology. +Lists a one-line status message about PortFast on the listed interface. +Lists information about the state of EtherChannels on this switch. + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX P + + + + +LAN Troubleshooting + + +NOTE This appendix contains an entire chapter that was published as a chapter in one of the past editions of this book or a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more. However, note that the content in this appendix has not been edited since it was published in the earlier edition, so references to exams and exam topics, and to other chapters, will be outdated. This appendix was previously published as Chapter 4 of the book CCNA Routing and Switching ICND2 200-105 Official Cert Guide, published in 2016. + +This chapter discusses the LAN topics discussed in depth in the first three chapters, plus a few prerequisite topics, from a troubleshooting perspective. + +Troubleshooting for any networking topic requires a slightly different mindset as com-pared to thinking about configuration and verification. When thinking about configuration and verification, it helps to think about basic designs, learn how to configure the feature correctly, and learn how to verify the correct configuration is indeed working correctly. However, to learn how to troubleshoot, you need to think about symptoms when the design is incorrect, or if the configuration does not match the good design. What symptoms occur when you make one type of mistake or another? This chapter looks at the common types of mistakes, and works through how to look at the status with show commands to find those mistakes. + +This chapter breaks the material into four major sections. The first section tackles the largest topic, STP troubleshooting. STP is not likely to fail as a protocol; instead, STP may not be operating as designed, so the task is to find how STP is currently working and discover how to then make the configuration implement the correct design. The second major section then moves on to Layer 2 EtherChannels, which have a variety of small potential problems that can prevent the dynamic formation of an EtherChannel. + +The third major section of the chapter focuses on the data plane forwarding of Ethernet frames on LAN switches, in light of VLANs, trunks, STP, and EtherChannels. That same sec-tion reviews the Layer 2 forwarding logic of a switch in light of these features. The fourth and final major section then examines VLAN and trunking issues, and how those issues impact switch forwarding. + +Note that a few of the subtopics listed within the exam topics at the beginning of this chap-ter are not discussed in this chapter. This chapter does not discuss VTP beyond its basic features or Layer 3 EtherChannels. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Troubleshooting STP +STP questions tend to intimidate many test takers. STP uses many rules, with tiebreakers in case one rule ends with a tie. Without much experience with STP, people tend to distrust their own answers. Also, even those of us with networking jobs already probably do not troubleshoot STP very often, because STP works well. Often, troubleshooting STP is not about STP failing to do its job but rather about STP working differently than designed, with a different root switch, or different root ports (RP), and so on. Seldom does STP trouble-shooting begin with a case in which STP has failed to prevent a loop. + +This section reviews the rules for STP, while emphasizing some important troubleshooting points. In particular, this section takes a closer look at the tiebreakers that STP uses to make decisions. It also makes some practical suggestions about how to go about answering exam questions such as “which switch is the root switch?” + +Determining the Root Switch +Determining the STP root switch is easy if you know all the switches’ BIDs: Just pick the lowest value. If the question lists the priority and MAC address separately, as is common in some show command output, pick the switch with the lowest priority, or in the case of a tie, pick the lower MAC address value. + +And just to be extra clear, STP does not have nor need a tiebreaker for electing the root switch. The BID uses a switch universal MAC address as the last 48 bits of the BID. These MAC addresses are unique in the universe, so there should never be identical BIDs or the need for a tiebreaker. + +For the exam, a question that asks about the root switch might not be so simple as listing a bunch of BIDs and asking you which one is “best.” A more likely question is a simulator (sim) question in which you have to do any show commands you like or a multiple choice +question that lists the output from only one or two commands. Then you have to apply the STP algorithm to figure out the rest. + +When faced with an exam question using a simulator, or just the output in an exhibit, use a simple strategy of ruling out switches, as follows: + +Step 1. Begin with a list or diagram of switches, and consider all as possible root switches. +Step 2. Rule out any switches that have an RP (show spanning-tree, show spanning-tree root), because root switches do not have an RP. +Step 3. Always try show spanning-tree, because it identifies the local switch as root directly: “This switch is the root” on the fifth line of output. +Step 4. Always try show spanning-tree root, because it identifies the local switch as root indirectly: The RP column is empty if the local switch is the root. +Step 5. When using a sim, rather than try switches randomly, chase the RPs. For exam-ple, if starting with SW1, and SW1’s G0/1 is an RP, next try the switch on the other end of SW1’s G0/1 port. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 3 + +Step 6. When using a sim, use show spanning-tree vlan x on a few switches and record the root switch, RP, and designated port (DP). This strategy can quickly show you most STP facts. + +The one step in this list that most people ignore is the idea of ruling out switches that have an RP. Root switches do not have an RP, so any switch with an RP can be ruled out as not being the root switch for that VLAN. Example P-1 shows two commands on switch SW2 in some LAN that confirms that SW2 has an RP and is therefore not the root switch. +Example P-1 Ruling Out Switches as Root Based on Having a Root Port SW2# show spanning-tree vlan 20 root + +Root Hello Max Fwd +Vlan Root ID Cost Time Age Dly Root Port +---------------- -------------------- --------- ----- --- --- ------------ +VLAN0020 32788 1833.9d7b.0e80 4 2 20 15 Gi0/2 + +SW2# show spanning-tree vlan 20 + +VLAN0020 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +32788 +1833.9d7b.0e80 +4 +26 (GigabitEthernet0/2) + + +P + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32788 (priority 32768 sys-id-ext 20) +Address 1833.9d7b.1380 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 15 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- + +Gi0/1 Desg FWD 4 +Gi0/2 Root FWD 4 + +128.25 P2p +128.26 P2p + + + +Both commands identify SW2’s G0/2 port as its RP, so if you follow the suggestions, the next switch to try in a sim question would be the switch on the other end of SW2’s G0/2 interface. + +Determining the Root Port on Nonroot Switches +Determining the RP of a switch when show command output is available is relatively easy. As shown recently in Example P-1, both show spanning-tree and show spanning-tree root list the root port of the local switch, assuming it is not the root switch. The challenge comes more when an exam question makes you think through how the switches choose the RP based on the root cost of each path to the root switch, with some tiebreakers as necessary. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +As a review, each nonroot switch has one, and only one, RP for a VLAN. To choose its RP, a switch listens for incoming Hello bridge protocol data units (BPDU). For each received Hello, the switch adds the cost listed in the hello BPDU to the cost of the incoming inter-face (the interface on which the Hello was received). That total is the root cost over that path. The lowest root cost wins, and the local switch uses its local port that is part of the least root cost path as its root port. + +Most humans can analyze what STP chooses by using a network diagram and a slightly dif-ferent algorithm. Instead of thinking about Hello messages and so on, approach the ques-tion as this: the sum of all outgoing port costs between the nonroot switch and the root. Repeating a familiar example, with a twist, Figure P-1 shows the calculation of the root cost. Note that SW3’s Gi0/1 port has yet again had its cost configured to a different value. + + +Root + +SW1 + +SW1 Bridge ID 32769:0200.0001.0001 + + +Cost 4 +Gi0/2 SW2 +SW2 Bridge ID 32769:0200.0002.0002 + + + + + + + +Total +Cost = 8 Cost 8 + +Total +Cost 4 Cost = 8 + + +Gi0/1 Gi0/2 SW3 +Figure P-1 SW3’s Root Cost Calculation Ends in a Tie + +STP Tiebreakers When Choosing the Root Port +Figure P-1 shows the easier process of adding the STP costs of the outgoing interfaces over each from SW3, a nonroot, to SW1, the root. It also shows a tie (on purpose), to talk about the tiebreakers. + +When a switch chooses its root port, the first choice is to choose the local port that is part of the least root cost path. When those costs tie, the switch picks the port connected to the neighbor with the lowest BID. This tiebreaker usually breaks the tie, but not always. So, for completeness, the three tiebreakers are, in the order a switch uses them, as follows: + +1. Choose based on the lowest neighbor bridge ID. +2. Choose based on the lowest neighbor port priority. +3. Choose based on the lowest neighbor internal port number. + +(Note that the switch only considers the root paths that tie when thinking about these tie-breakers.) + +For example, Figure P-1 shows that SW3 is not root and that its two paths to reach the root tie with their root costs of 8. The first tiebreaker is the lowest neighbor’s BID. SW1’s BID value is lower than SW2’s, so SW3 chooses its G0/1 interface as its RP in this case. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 5 + +The last two RP tiebreakers come into play only when two switches connect to each other with multiple links, as shown in Figure P-2. In that case, a switch receives Hellos on more than one port from the same neighboring switch, so the BIDs tie. + +Cost 19 Priority 112 Root Fa0/14 Fa0/16 + +SW1 Bridge ID SW1 Fa0/15 32769:0211.1111.1111 Cost 19 + + +Fa0/17 Priority 128 + +SW2 SW2 Bridge ID 32769:0200.0002.0002 + +Figure P-2 Topology Required for the Last Two Tiebreakers for Root Port +In this particular example, SW2 becomes root, and SW1 needs to choose its RP. SW1’s port costs tie, at 19 each, so SW1’s root cost over each path will tie at 19. SW2 sends Hellos over each link to SW1, so SW1 cannot break the tie based on SW1’s neighbor BID because both list SW2’s BID. So, SW1 has to turn to the other two tiebreakers. + +NOTE In real life, most engineers would put these two links into an EtherChannel. + + +The next tiebreaker is a configurable option: the neighboring switch’s port priority on each neighboring switch interface. Cisco switch ports default to a setting of 128, with a range of values from 0 through 255, with lower being better (as usual). In this example, the network engineer has set SW2’s F0/16 interface with the spanning-tree vlan 10 port-priority 112 command. SW1 learns that the neighbor has a port priority of 112 on the top link and 128 on the bottom, so SW1 uses its top (F0/14) interface as the root port. + +If the port priority ties, which it often does due to the default values, STP relies on an inter-nal port numbering on the neighbor. Cisco switches assign an internal integer to identify each interface on the switch. The nonroot looks for the neighbor’s lowest internal port num-ber (as listed in the Hello messages) and chooses its RP based on the lower number. + +Cisco switches use an obvious numbering, with Fa0/1 having the lowest number, then Fa0/2, then Fa0/3, and so on. So, in Figure P-2, SW2’s Fa0/16 would have a lower internal port number than Fa0/17; SW1 would learn those numbers in the Hello; and SW1 would use its Fa0/14 port as its RP. + + + + + +P + + +Suggestions for Attacking Root Port Problems on the Exam +Exam questions that make you think about the RP can be easy if you know where to look and the output of a few key commands is available. However, the more conceptual the question, the more you have to calculate the root cost over each path, correlate that to dif-ferent show commands, and put the ideas together. The following list makes a few sugges-tions about how to approach STP problems on the exam: + +1. If available, look at the show spanning-tree and show spanning-tree root commands. Both commands list the root port and the root cost (see Example P-1). +2. The show spanning-tree command lists cost in two places: the root cost at the top, in the section about the root switch; and the interface cost, at the bottom, in the per-interface section. Be careful, though; the cost at the bottom is the interface cost, not the root cost! + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +3. For problems where you have to calculate a switch’s root cost: + +a. Memorize the default cost values: 100 for 10 Mbps, 19 for 100 Mbps, 4 for 1 Gbps, and 2 for 10 Gbps. +b. Look for any evidence of the spanning-tree cost configuration command on an interface, because it overrides the default cost. Do not assume default costs are used. +c. When you know a default cost is used, if you can, check the current actual speed as well. Cisco switches choose STP cost defaults based on the current speed, not the maximum speed. + +Determining the Designated Port on Each LAN Segment +Each LAN segment has a single switch that acts as the designated port (DP) on that segment. On segments that connect a switch to a device that does not even use STP—for example, segments connecting a switch to a PC or a router—the switch always wins, because it is the only device sending a Hello onto the link. However, links with two switches require a little more work to discover which should be the DP. By definition: + +Step 1. For switches connected to the same LAN segment, the switch with the low-est cost to reach the root, as advertised in the Hello they send onto the link, becomes the DP on that link. +Step 2. In case of a tie, among the switches that tied on cost, the switch with the low-est BID becomes the DP. + +For example, consider Figure P-3. This figure notes the root, RPs, and DPs and each switch’s least cost to reach the root over its respective RP. + +Root + + + + + +BID: 28,682:0200.2222.2222 Root Cost: 20 RP +Fa0/1 + + +Fa0/2 DP + + +Interface Cost = 20 + +SW1 +Fa0/4 DP + + +Fa0/3 +DP BID: 32,778:0200.3333.3333 +Root Cost: 19 RP +Fa0/1 + +DP + + + +SW2 Fa0/3 +Fa0/4 + +Fa0/2 SW3 +Fa0/4 +DP + + + +RP Fa0/2 Fa0/1 DP + +SW4 + +Figure P-3 Picking the DPs + + +Fa0/3 + +BID: 32,778:0200.4444.4444 Root Cost: 19 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 7 + +Focus on the segments that connect the nonroot switches for a moment: + +SW2–SW4 segment: SW4 wins because of its root cost of 19, compared to SW2’s root cost of 20. +SW2–SW3 segment: SW3 wins because of its root cost of 19, compared to SW2’s root cost of 20. +SW3–SW4 segment: SW3 and SW4 tie on root cost, both with root cost 19. SW3 wins due to its better (lower) BID value. + +Interestingly, SW2 loses and does not become DP on the links to SW3 and SW4 even though SW2 has the better (lower) BID value. The DP tiebreaker does use the lowest BID, but the first DP criteria is the lowest root cost, and SW2’s root cost happens to be higher than SW3’s and SW4’s. + +NOTE A single switch can connect two or more interfaces to the same collision domain, and compete to become DP, if hubs are used. In such cases, two different switch ports on the same switch tie, the DP choice uses the same two final tiebreakers as used with the RP selection: the lowest interface STP priority, and if that ties, the lowest internal interface number. + + +Suggestions for Attacking Designated Port Problems on the Exam +As with exam questions asking about the RP, exam questions that make you think about the P DP can be easy if you know where to look and the output of a few key commands is avail- +able. However, the more conceptual the question, the more you have to think about the cri-teria for choosing the DP: first the root cost of the competing switches, and then the better BID if they tie based on root cost. + +The following list gives some tips to keep in mind when digging into a given DP issue. Some of this list repeats the suggestions for finding the RP, but to be complete, this list includes each idea as well. + +1. If available, look at the show spanning-tree commands, at the list of interfaces at the end of the output. Then, look for the Role column, and look for Desg, to identify any DPs. +2. Identify the root cost of a switch directly by using the show spanning-tree command. But be careful! This command lists the cost in two places, and only the mention at the top, in the section about the root, lists the root cost. +3. For problems where you have to calculate a switch’s root cost, do the following: + +a. Memorize the default cost values: 100 for 10 Mbps, 19 for 100 Mbps, 4 for 1 Gbps, and 2 for 10 Gbps. +b. Look for any evidence of the spanning-tree cost configuration command on an interface, because it overrides the default cost. Do not assume default costs are used. +c. When you know a default cost is used, if you can, check the current actual speed as well. Cisco switches choose STP cost defaults based on the current speed, not the maximum speed. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +STP Convergence +STP puts each RP and DP into a forwarding state, and ports that are neither RP nor DP into a blocking state. Those states may remain as is for days, weeks, or months. But at some point, some switch or link will fail, a link may change speeds (changing the STP cost), or the STP configuration may change. Any of these events can cause switches to repeat their STP algorithm, which may in turn change their own RP and any ports that are DPs. + +When STP converges based on some change, not all the ports have to change their state. For instance, a port that was forwarding, if it still needs to forward, just keeps on forwarding. Ports that were blocking that still need to block keep on blocking. But when a port needs to change state, something has to happen, based on the following rules: + +■ For interfaces that stay in the same STP state, nothing needs to change. +■ For interfaces that need to move from a forwarding state to a blocking state, the switch immediately changes the state to blocking. +■ For interfaces that need to move from a blocking state to a forwarding state, the switch first moves the interface to listening state, then learning state, each for the time specified by the forward delay timer (default 15 seconds). Only then is the interface placed into forwarding state. + +Because the transition from blocking to forwarding does require some extra steps, you should be ready to respond to conceptual questions about the transition. + +Troubleshooting Layer 2 EtherChannel +EtherChannels can prove particularly challenging to troubleshoot for a couple of reasons. First, you have to be careful to match the correct configuration, and there are many more incorrect configuration combinations than there are correct combinations. Second, many interface settings must match on the physical links, both on the local switch and on the neighboring switch, before a switch will add the physical link to the channel. This second major section in the chapter works through both sets of issues. + +Incorrect Options on the channel-group Command +The rules for the small set of working configuration options on the channel-group com-mand can be summarized as follows, for a single EtherChannel: + +1. On the local switch, all the channel-group commands for all the physical interfaces must use the same channel-group number. +2. The channel-group number can be different on the neighboring switches. +3. If using the on keyword, you must use it on the corresponding interfaces of both switches. +4. If you use the desirable keyword on one switch, the switch uses PAgP; the other switch must use either desirable or auto. +5. If you use the active keyword on one switch, the switch uses LACP; the other switch must use either active or passive. +These rules summarize the correct configuration options, but the options actually leave many more incorrect choices. The following list shows some incorrect configurations that the switches allow, even though they would result in the EtherChannel not working. The list + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 9 + +compares the configuration on one switch to another based on the physical interface con-figuration. Each lists the reasons why the configuration is incorrect. + +■ Configuring the on keyword on one switch, and desirable, auto, active, or passive on the other switch. The on keyword does not enable PAgP, and does not enable LACP, and the other options rely on PAgP or LACP. +■ Configuring the auto keyword on both switches. Both use PAgP, but both wait on the other switch to begin negotiations. +■ Configuring the passive keyword on both switches. Both use LACP, but both wait on the other switch to begin negotiations. +■ Configuring the active keyword on one switch and either desirable or auto on the other switch. The active keyword uses LACP, whereas the other keywords use PAgP. +■ Configuring the desirable keyword on one switch and either active or passive on the other switch. The desirable keyword uses PAgP, whereas the other keywords use LACP. + +Example P-2 shows an example that matches the last item in the list. In this case, SW1’s two ports (F0/14 and F0/15) have been configured with the desirable keyword, and SW2’s matching F0/16 and F0/17 have been configured with the active keyword. The example lists some telling status information about the failure, with notes following the example. +Example P-2 Incorrect Configuration Using Mismatched PortChannel Protocols +SW1# show etherchannel summary +Flags: D - down P - bundled in port-channel P I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+----------------------------------------------- +1 Po1(SD) PAgP Fa0/14(I) Fa0/15(I) + +SW1# show interfaces status | include Po|14|15 + +Port Name +Fa0/14 +Fa0/15 + +Status Vlan +connected 301 +connected 301 + +Duplex Speed Type +a-full a-100 10/100BaseTX +a-full a-100 10/100BaseTX + +Po1 notconnect unassigned auto auto + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +Start at the top, in the legend of the show etherchannel summary command. The D code letter means that the channel itself is down, with S meaning that the channel is a Layer 2 EtherChannel. Code I means that the physical interface is working independently from the PortChannel (described as “stand-alone”). Then, the bottom of that command’s output high-lights PortChannel 1 (Po1) as Layer 2 EtherChannel in a down state (SD), with F0/14 and F0/15 as stand-alone interfaces (I). + +Interestingly, because the problem is a configuration mistake, the two physical interfaces still operate independently, as if the PortChannel did not exist. The last command in the example shows that while the PortChannel 1 interface is down, the two physical interfaces are in a connected state. + +NOTE As a suggestion for attacking EtherChannel problems on the exam, rather than memorizing all the incorrect configuration options, concentrate on the list of correct con-figuration options. Then look for any differences between a given question’s configuration as compared to the known correct configurations and work from there. + + +Configuration Checks Before Adding Interfaces to EtherChannels Even when the channel-group commands have all been configured correctly, other con- +figuration settings can cause problems as well. This last topic examines those configuration settings and their impact. +First, a local switch checks each new physical interface that is configured to be part of an EtherChannel, comparing each new link to the existing links. That new physical interface’s settings must be the same as the existing links’ settings; otherwise, the switch does not add the new link to the list of approved and working interfaces in the channel. That is, the physi-cal interface remains configured as part of the PortChannel, but it is not used as part of the channel, often being placed into some nonworking state. + +The list of items the switch checks includes the following: + +■ Speed ■ Duplex +■ Operational access or trunking state (all must be access, or all must be trunks) ■ If an access port, the access VLAN +■ If a trunk port, the allowed VLAN list (per the switchport trunk allowed command) ■ If a trunk port, the native VLAN +■ STP interface settings + +In addition, switches check the settings on the neighboring switch. To do so, the switches either use PAgP or LACP (if already in use), or use Cisco Discovery Protocol (CDP) if using manual configuration. The neighbor must match on all parameters in this list except the STP settings. + +As an example, SW1 and SW2 again use two links in one EtherChannel. Before configuring the EtherChannel, SW1’s F0/15 was given a different STP port cost than F0/14. Example +P-3 picks up the story just after configuring the correct channel-group commands, when the switch is deciding whether to use F0/14 and F0/15 in this EtherChannel. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 11 + +Example P-3 Local Interfaces Fail in EtherChannel Because of Mismatched STP Cost *Mar 1 23:18:56.132: %PM-P-ERR_DISABLE: channel-misconfig (STP) error detected on +Po1, putting Fa0/14 in err-disable state +*Mar 1 23:18:56.132: %PM-P-ERR_DISABLE: channel-misconfig (STP) error detected on +Po1, putting Fa0/15 in err-disable state +*Mar 1 23:18:56.132: %PM-P-ERR_DISABLE: channel-misconfig (STP) error detected on Po1, putting Po1 in err-disable state +*Mar 1 23:18:58.120: %LINK-3-UPDOWN: Interface FastEthernet0/14, changed state to down +*Mar 1 23:18:58.137: %LINK-3-UPDOWN: Interface Port-channel1, changed state to down +*Mar 1 23:18:58.137: %LINK-3-UPDOWN: Interface FastEthernet0/15, changed state to down + +SW1# show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated P d - default port + + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+----------------------------------------------- +1 Po1(SD) - Fa0/14(D) Fa0/15(D) + +The messages at the top of the example specifically state what the switch does when determining whether the interface settings match. In this case, SW1 detects the different STP costs. SW1 does not use F0/14, does not use F0/15, and even places them into an err-disabled state. The switch also puts the PortChannel into err-disabled state. As a result, the PortChannel is not operational, and the physical interfaces are also not operational. + +To solve this problem, you must reconfigure the physical interfaces to use the same STP settings. In addition, the PortChannel and physical interfaces must be shutdown, and then no shutdown, to recover from the err-disabled state. (Note that when a switch applies +the shutdown and no shutdown commands to a PortChannel, it applies those same com-mands to the physical interfaces, as well; so, just do the shutdown/no shutdown on the PortChannel interface.) +Analyzing the Switch Data Plane Forwarding +STP and EtherChannel both have an impact on what a switch’s forwarding logic can use. STP limits which interfaces the data plane even considers using by placing some ports in a + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +blocking state (STP) or discarding state (RSTP), which in turn tells the data plane to simply not use that port. EtherChannel gives the data plane new ports to use in the switch’s MAC address table—EtherChannels—while telling the data plane to not use the underlying physical interfaces in an EtherChannel in the MAC table. + +This (short) third major section of the chapter explores the impact of STP and EtherChannel on data plane logic and a switch’s MAC address table. + +Predicting STP Impact on MAC Tables +Consider the small LAN shown in Figure P-4. The LAN has only three switches, with redun-dancy, just big enough to make the point for this next example. The LAN supports two VLANs, 1 and 2, and the engineer has configured STP such that SW3 blocks on a different port in each of the two VLANs. As a result, VLAN 1 traffic would flow from SW3 to SW1 next, and in VLAN 2, traffic would flow from SW3 to SW2 next instead. + + +VLAN 1 STP Topology +Root + +VLAN 2 STP Topology +Root + + + +Gi0/1 Gi0/2 +SW1 SW2 + + +Gi0/1 Gi0/2 +SW1 SW2 + +Gi0/2 Gi0/1 Gi0/2 Gi0/1 + + + +Gi0/1 Gi0/2 + +SW3 Gi0/3 + + +Gi0/1 + +A 0200.AAAA.AAAA SW3 + + +Gi0/2 + +Gi0/3 B 0200.BBBB.BBBB + + +Figure P-4 Two Different STP Topologies for Same Physical LAN, Two Different VLANs +Looking at diagrams like those in Figure P-4 makes the forwarding path obvious. Although the figure shows the traffic path, that path is determined by switch MAC learning, which is then impacted by the ports on which STP has set a blocking or discarding state. + +For example, consider VLAN 1’s STP topology in Figure P-4. Remember, STP blocks on a port on one switch, not on both ends of the link. So, in the case of VLAN 1, SW3’s G0/2 port blocks, but SW2’s G0/1 does not. Even so, by blocking on a port on one end of the link, that act effectively stops any MAC learning from happening by either device on the link. That is, SW3 learns no MAC addresses on its G0/2 port, and SW2 learns no MAC addresses on its G0/1 port, for these reasons: + +■ SW2 learns no MAC addresses on G0/1: On the blocking (SW3) end of the SW3–SW2 trunk, SW3 will not send frames out that link to SW2, so SW2 will never receive frames from which to learn MAC addresses on SW2’s G0/1. +■ SW3 learns no MAC addresses on G0/2: On the not blocking (SW2) end of the +SW3–SW2 trunk, SW2 will flood frames out that port. SW3 receives those frames, but because SW3 blocks, SW3 ignores those received frames and does not learn their MAC addresses. + +Given that discussion, can you predict the MAC table entries on each of the three switches for the MAC addresses of servers A and B in Figure P-4? On switch SW2, the entry for + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 13 + +server A, in VLAN 1, should refer to SW2’s G0/2 port, pointing to SW1 next, matching the figure. But SW2’s entry for server B, in VLAN 2, references SW2’s G0/1 port, again match-ing the figure. Example P-4 shows the MAC tables on SW1 and SW2 as a confirmation. +Example P-4 Examining SW1 and SW2 Dynamic MAC Address Table Entries SW1# show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.AAAA.AAAA +2 0200.BBBB.BBBB + +Type Ports +-------- ----- +DYNAMIC Gi0/2 +DYNAMIC Gi0/1 + +SW2# show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.AAAA.AAAA +2 0200.BBBB.BBBB + +Type Ports +-------- ----- +DYNAMIC Gi0/2 +DYNAMIC Gi0/1 + + +Predicting EtherChannel Impact on MAC Tables P Most designs use multiple links between switches, with those links configured to be part of +an EtherChannel. What does that do to the MAC forwarding logic? In short, the switch uses the PortChannel interfaces, and not the physical interfaces bundled into the EtherChannel, in the MAC address table. Specifically: +MAC learning: Frames received in a physical interface that is part of a PortChannel are considered to arrive on the PortChannel interface. So, MAC learning adds the PortChannel interface rather than the physical interface to the MAC address table. +MAC forwarding: The forwarding process will find a PortChannel port as an outgoing interface when matching the MAC address table. Then the switch must take the addition-al step to choose the outgoing physical interface, based on the load-balancing preferences configured for that PortChannel. + +For example, consider Figure P-5, which updates previous Figure P-4 with two-link PortChannels between each pair of switches. With VLAN 1 blocking again on switch SW3, but this time on SW3’s PortChannel3 interface, what MAC table entries would you expect to see in each switch? Similarly, what MAC table entries would you expect to see for VLAN 2, with SW3 blocking on its PortChannel2 interface? + +The logic of which entries exist on which ports mirrors the logic with the earlier example surrounding Figure P-4. In this case, the interfaces just happen to be PortChannel interfaces. Example P-5 shows the same command from the same two switches as Example P-4: show mac address-table dynamic from both SW1 and SW2. (Note that to save length, the MAC table output shows only the entries for the two servers in Figure P-5.) + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + + + +VLAN 1 STP Topology +Root + +VLAN 2 STP Topology +Root + + +Po1 Po1 Po1 Po1 +SW1 SW2 SW1 SW2 +Po2 Po3 Po2 Po3 + + +Po2 Po3 Po2 Po3 + +SW3 Gi0/3 A 0200.AAAA.AAAA SW3 B 0200.BBBB.BBBB + +Figure P-5 VLAN Topology with PortChannels Between Switches Example P-5 SW1 and SW2 MAC Tables with PortChannel Ports Listed SW1# show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.AAAA.AAAA +2 0200.BBBB.BBBB + +Type Ports +-------- ----- +DYNAMIC Po2 +DYNAMIC Po1 + +SW2# show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.AAAA.AAAA +2 0200.BBBB.BBBB + +Type Ports +-------- ----- +DYNAMIC Po1 +DYNAMIC Po3 + + +Switches use one of many load-balancing options to then choose the physical interface to use after matching MAC table entries like those shown in Example P-5. By default, +Cisco Layer 2 switches often default to use a balancing method based on the source MAC address. In particular, the switch looks at the low-order bits of the source MAC address (which are on the far right of the MAC address in written form). This approach increases the chances that the balancing will be spread somewhat evenly based on the source MAC addresses in use. + +Choosing the VLAN of Incoming Frames +To wrap up the analysis of switch data plane forwarding, this section mostly reviews top-ics already discussed, but it serves to emphasize some important points. The topic is simply +this: How does a switch know which VLAN a frame is a part of as the frame enters a switch? You have seen all the information needed to answer this question already, but take the time to review. + +First, some interfaces trunk, and in those cases, the frame arrives with a VLAN ID listed in the incoming trunking header. In other cases, the frame does not arrive with a trunking + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 15 + +header, and the switch must look at local configuration. But because the switch will match both the destination MAC address and the frame VLAN ID when matching the MAC address table, knowing how the switch determines the VLAN ID is important. + +The following list reviews and summarizes the key points of how a switch determines the VLAN ID to associate with an incoming frame: + +Step 1. If the port is an access port, associate the frame with the configured access VLAN (switchport access vlan vlan_id). +Step 2. If the port is a voice port, or has both an IP Phone and PC (or other data device) connected to the phone: +A. Associate the frames from the data device with the configured access VLAN (as configured with the switchport access vlan vlan_id com-mand). +B. Associate the frames from the phone with the VLAN ID in the 802.1Q header (as configured with the switchport voice vlan vlan_id com-mand). +Step 3. If the port is a trunk, determine the frame’s tagged VLAN, or if there is no tag, use that incoming interface’s native VLAN ID (switchport trunk native vlan_id). + + +Troubleshooting VLANs and VLAN Trunks P A switch’s data plane forwarding processes depend in part on VLANs and VLAN trunk- +ing. Before a switch can forward frames in a particular VLAN, the switch must know about a VLAN and the VLAN must be active. And before a switch can forward a frame over a VLAN trunk, the trunk must currently allow that VLAN to pass over the trunk. +This final major section in this chapter focuses on VLAN and VLAN trunking issues, specifi-cally issues that impact the frame switching process. The issues are as follows: + +Step 1. Identify all access interfaces and their assigned access VLANs and reassign into the correct VLANs if incorrect. +Step 2. Determine whether the VLANs both exist (either configured or learned with the VLAN Trunking Protocol [VTP]) and are active on each switch. If not, con-figure and activate the VLANs to resolve problems as needed. +Step 3. Check the allowed VLAN lists, on the switches on both ends of the trunk, and ensure that the lists of allowed VLANs are the same. +Step 4. Check for incorrect configuration settings that result in one switch operating as a trunk, with the neighboring switch not operating as a trunk. +Step 5. Check the allowed VLANs on each trunk, to make sure that the trunk has not administratively removed a VLAN from being supported on a trunk. + + +Access VLAN Configuration Incorrect +To ensure that each access interface has been assigned to the correct VLAN, engineers simply need to determine which switch interfaces are access interfaces instead of trunk + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +interfaces, determine the assigned access VLANs on each interface, and compare the infor-mation to the documentation. The show commands listed in Table P-1 can be particularly helpful in this process. + +Table P-1 Commands That Can Find Access Ports and VLANs + +EXEC Command + +show vlan brief + +show vlan +show vlan id num + +show interfaces type number switchport + +show mac address-table + +Description + +Lists each VLAN and all interfaces assigned to that VLAN (but does not include operational trunks) + +Lists both access and trunk ports in the VLAN + +Identifies the interface’s access VLAN and voice VLAN, plus the configured and operational mode (access or trunk) + +Lists MAC table entries, including the associated VLAN + + +If possible, start this step with the show vlan and show vlan brief commands, because they list all the known VLANs and the access interfaces assigned to each VLAN. Be aware, however, that these two commands do not list operational trunks. The output does list all other interfaces (those not currently trunking), no matter whether the interface is in a work-ing or nonworking state. + +If the show vlan and show interface switchport commands are not available in a par-ticular exam question, the show mac address-table command can also help identify the access VLAN. This command lists the MAC address table, with each entry including a MAC address, interface, and VLAN ID. If the exam question implies that a switch interface con-nects to a single device, you should only see one MAC table entry that lists that particular access interface; the VLAN ID listed for that same entry identifies the access VLAN. (You cannot make such assumptions for trunking interfaces.) + +After you determine the access interfaces and associated VLANs, if the interface is assigned to the wrong VLAN, use the switchport access vlan vlan-id interface subcommand to assign the correct VLAN ID. + +Access VLANs Undefined or Disabled +Switches do not forward frames for VLANs that are (a) not known because the VLAN is not configured or has not been learned with VTP or (b) the VLAN is known, but it is disabled (shut down). This section summarizes the best ways to confirm that a switch knows that a particular VLAN exists, and if it exists, determines the shutdown state of the VLAN. + +First, on the issue of whether a VLAN exists on a switch, a VLAN can be defined to a switch in two ways: using the vlan number global configuration command, or it can be learned from another switch using VTP. For this discussion, consider that the only way for a switch to know about a VLAN is to have a vlan command configured on the local switch. + +Next, the show vlan command always lists all VLANs known to the switch, but the show running-config command does not. Switches configured as VTP servers and clients do not list the vlan commands in the running-config file nor the startup-config file; on these + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 17 + +switches, you must use the show vlan command. Switches configured to use VTP transpar-ent mode, or that disable VTP, list the vlan configuration commands in the configuration files. (Use the show vtp status command to learn the current VTP mode of a switch.) + +After you determine that a VLAN does not exist on a switch, the problem might be that the VLAN simply needs to be configured. + +Even for existing VLANs, you must also verify whether the VLAN is active. The show vlan command should list one of two VLAN state values, depending on the current state: either active or act/lshut. The second of these states means that the VLAN is shut down. +Shutting down a VLAN disables the VLAN on that switch only, so that the switch will not forward frames in that VLAN. + +Switch IOS gives you two similar configuration methods with which to disable (shutdown) and enable (no shutdown) a VLAN. Example P-6 shows how, first by using the global com-mand [no] shutdown vlan number and then using the VLAN mode subcommand [no] shutdown. The example shows the global commands enabling and disabling VLANs 10 and 20, respectively, and using VLAN subcommands to enable and disable VLANs 30 and 40 (respectively). +Example P-6 Enabling and Disabling VLANs on a Switch SW2# show vlan brief + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- P 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 +Fa0/5, Fa0/6, Fa0/7, Fa0/8 +Fa0/9, Fa0/10, Fa0/11, Fa0/12 +Fa0/14, Fa0/15, Fa0/16, Fa0/17 +Fa0/18, Fa0/19, Fa0/20, Fa0/21 +Fa0/22, Fa0/23, Fa0/24, Gi0/1 + +10 VLAN0010 +20 VLAN0020 +30 VLAN0030 +40 VLAN0040 + +act/lshut Fa0/13 +active +act/lshut +active + +SW2# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +SW2(config)# no shutdown vlan 10 +SW2(config)# shutdown vlan 20 +SW2(config)# vlan 30 +SW2(config-vlan)# no shutdown +SW2(config-vlan)# vlan 40 +SW2(config-vlan)# shutdown +SW2(config-vlan)# + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +Mismatched Trunking Operational States +Trunking can be configured correctly so that both switches forward frames for the same set of VLANs. However, trunks can also be misconfigured, with a couple of different results. In some cases, both switches conclude that their interfaces do not trunk. In other cases, one switch believes that its interface is correctly trunking, while the other switch does not. + +The most common incorrect configuration—which results in both switches not trunking—is a configuration that uses the switchport mode dynamic auto command on both switches on the link. The word “auto” just makes us all want to think that the link would trunk auto-matically, but this command is both automatic and passive. As a result, both switches pas-sively wait on the other device on the link to begin negotiations. + +With this particular incorrect configuration, the show interfaces switchport command on both switches confirms both the administrative state (auto) and the fact that both switches operate as “static access” ports. Example P-7 highlights those parts of the output from this command. +Example P-7 Operational Trunking State SW2# show interfaces gigabit0/2 switchport +Name: Gi0/2 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: static access +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: native +! lines omitted for brevity + + +A different incorrect trunking configuration results in one switch with an operational state of “trunk,” while the other switch has an operational state of “static access.” When this com-bination of events happens, the interface works a little. The status on each end will be up/up or connected. Traffic in the native VLAN will actually cross the link successfully. However, traffic in all the rest of the VLANs will not cross the link. + +Figure P-6 shows the incorrect configuration along with which side trunks and which does not. The side that trunks (SW1 in this case) enables trunking always, using the command switchport mode trunk. However, this command does not disable Dynamic Trunking Protocol (DTP) negotiations. To cause this particular problem, SW1 also disables DTP nego-tiation using the switchport nonegotiate command. SW2’s configuration also helps create the problem, by using a trunking option that relies on DTP. Because SW1 has disabled DTP, SW2’s DTP negotiations fail, and SW2 does not trunk. + +In this case, SW1 treats its G0/1 interface as a trunk, and SW2 treats its G0/2 interface as an access port (not a trunk). As shown in the figure at Step 1, SW1 could (for example) forward a frame in VLAN 10. However, SW2 would view any frame that arrives with an 802.1Q header as illegal, because SW2 treats its G0/2 port as an access port. So, SW2 discards any 802.1Q frames received on that port. + +To deal with the possibility of this problem, always check the trunk’s operational state on both sides of the trunk. The best commands to check trunking-related facts are show interfaces trunk and show interfaces switchport. + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 19 + + + +1 2 VLAN 10 Eth. Frame + +Frame has 802.1Q: Discard! + + + + +Gi0/1 +SW1 Trunk Mode: On + +Gi0/2 +Trunk Mode: Access SW2 + + + +switchport mode trunk switchport mode dynamic desirable switchport nonegotiate + +Figure P-6 Mismatched Trunking Operational States + +NOTE Frankly, in real life, just avoid this kind of configuration. However, the switches do not prevent you from making these types of mistakes, so you need to be ready. + + +Mismatched Supported VLAN List on Trunks +VLAN trunks on Cisco switches can forward traffic for all defined and active VLANs. However, a particular trunk may not forward traffic for a defined and active VLAN for a variety of other reasons. You should know how to identify which VLANs a particular trunk port currently supports, and the reasons why the switch might not be forwarding frames for +a VLAN on that trunk port. +The first category in this step can be easily done using the show interfaces trunk com- P mand, which only lists information about currently operational trunks. The best place to +begin with this command is the last section of output, which lists the VLANs whose traffic will be forwarded over the trunk. Any VLANs that make it to this final list of VLANs in the command output meet the following criteria: + +■ The VLAN exists and is active on the local switch (as seen in the show vlan command). +■ The VLAN has not been removed from the allowed VLAN list on the trunk (as config-ured with the switchport trunk allowed vlan interface subcommand). +■ The VLAN has not been VTP-pruned from the trunk. (You can ignore this feature for the purposes of this book; it is mentioned here only because the show command men-tions it.) +■ The trunk is in an STP forwarding state in that VLAN (as also seen in the show spanning-tree vlan vlan-id command). + +Example P-8 shows a sample of the command output from the show interfaces trunk command, with the final section of the command output shaded. In this case, the trunk only forwards traffic in VLANs 1 and 4. + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +20 CCNA 200-301 Official Cert Guide, Volume 1 + +Example P-8 Allowed VLAN List and List of Active VLANs SW1# show interfaces trunk + + +Port Mode +Gi0/1 desirable + +Encapsulation +802.1q + +Status +trunking + +Native vlan +1 + + +Port Vlans allowed on trunk +Gi0/1 1-2,P-4094 + +Port Vlans allowed and active in management domain +Gi0/1 1,4 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/1 1,4 + +The absence of a VLAN in this last part of the command’s output does not necessarily mean that a problem has occurred. In fact, a VLAN might be legitimately excluded from a trunk for any of the reasons in the list just before Example P-8. However, for a given exam ques-tion, it can be useful to know why traffic for a VLAN will not be forwarded over a trunk, and the details inside the output identify the specific reasons. + +The output of the show interfaces trunk command creates three separate lists of VLANs, each under a separate heading. These three lists show a progression of reasons why a VLAN is not forwarded over a trunk. Table P-2 summarizes the headings that precede each list and the reasons why a switch chooses to include or not include a VLAN in each list. + +Table P-2 VLAN Lists in the show interfaces trunk Command +List Heading Reasons Position +First VLANs allowed VLANs 1–4094, minus those removed by the switchport trunk allowed command + +Second VLANs allowed The first list, minus VLANs not defined to the local switch (that and active… is, there is not a vlan global configuration command or the +switch has not learned of the VLAN with VTP), and also minus those VLANs in shutdown mode + +Third VLANs in spanning tree… + +The second list, minus VLANs in an STP blocking state for that interface, and minus VLANs VTP pruned from that trunk + + + +Mismatched Native VLAN on a Trunk +Closing with a brief mention of one other trunking topic, you should also check a trunk’s native VLAN configuration at this step. Unfortunately, it is possible to set the native VLAN ID to different VLANs on either end of the trunk, using the switchport trunk native vlan vlan-id command. If the native VLANs differ according to the two neighboring switches, the switches will accidentally cause frames to leave one VLAN and enter another. + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix P: LAN Troubleshooting 21 + +For example, if switch SW1 sends a frame using native VLAN 1 on an 802.1Q trunk, SW1 does not add a VLAN header, as is normal for the native VLAN. When switch SW2 receives the frame, noticing that no 802.1Q header exists, SW2 assumes that the frame is part of SW2’s configured native VLAN. If SW2 has been configured to think VLAN 2 is the native VLAN on that trunk, SW2 will try to forward the received frame into VLAN 2. + + + + + + + + + + + + + + + + + +P + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + + + + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX Q + + + + +Troubleshooting IPv4 Routing Protocols + + +AUTHOR NOTE This appendix contains an entire chapter that was published as a chapter in one of the past editions of this book or a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more. However, note that the content in this appendix has not been edited since it was published in the earlier edition, so references to exams and exam topics, and to other chapters, will be out-dated. This appendix was previously published as Chapter 11 of the book CCNA Routing and Switching ICND2 200-105 Official Cert Guide, published in 2016. + +To troubleshoot a possible IPv4 routing protocol problem, first focus on interfaces, and then on neighbors. The routing protocol configuration identifies the interfaces on which the router should use the routing protocol. After identifying those interfaces, a network engi-neer can look at the neighbors each router finds on each interface, searching for neighbors that should exist but do not. + +This chapter focuses on issues related to these two main branches of logic: on which inter-faces should a router enable the routing protocol, and which neighbor relationships should each router create. This chapter’s troubleshooting discussions emphasize how to find incor-rect configuration problems by using only show and debug commands. + +This chapter first briefly introduces a few broad concepts related to troubleshooting prob-lems with routing protocols. The next major section examines problems related to which interfaces on which a router enables the routing protocol, with the final major section focusing of routing protocol neighbor relationships. Note that the entire chapter moves back and forth between discussing both Enhanced Interior Gateway Routing Protocol (EIGRP) and Open Shortest Path First Version 2 (OSPFv2). + + + + + + + + + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Foundation Topics + +Perspectives on Troubleshooting Routing Protocol Problems +Because a routing protocol’s job is to fill a router’s routing table with the currently best routes, it makes sense that troubleshooting potential problems with routing protocols could begin with the IP routing table. Given basic information about an internetwork, including the routers, their IP addresses and masks, and the routing protocol, you could calculate +the subnet numbers that should be in the router’s routing table and list the likely next-hop routers for each route. For example, Figure Q-1 shows an internetwork with six subnets. Router R1’s routing table should list all six subnets, with three connected routes, two routes learned from R2 (172.16.4.0/24 and 172.16.5.0/24), and one route learned from R3 (172.16.6.0/24). + +172.16.4.1/24 + + +172.16.9.2/30 + +172.16.2.1/24 172.16.9.1/30 + + +R2 +172.16.5.1/24 + + +R1 +172.16.9.5/30 + + + +172.16.9.6/30 + + +Figure Q-1 Internetwork with Six Subnets + + +R3 +172.16.6.1/24 + +So, one possible troubleshooting process is to analyze the internetwork, look at the routing table, and look for missing routes. If one or more expected routes are missing, the next step would be to determine whether that router has learned any routes from the expected next-hop (neighbor) router. The next steps to isolate the problem differ greatly if a router is hav-ing problems forming a neighbor relationship with another router, versus having a working neighbor relationship but not being able to learn all routes. + +For example, suppose that R1 in Figure Q-1 has learned a route for subnet 172.16.4.0/24 in Figure Q-1 but not for subnet 172.16.5.0/24. In this case, it is clear that R1 has a working neighbor relationship with R2. In these cases, the root cause of this problem might still be related to the routing protocol, or it might not. For example, the problem may be that R2’s lower LAN interface is down. However, if R1 did not have a route for both 172.16.4.0/24 and 172.16.5.0/24, R1’s neighbor relationship with R2 could be the problem. + +Troubleshooting routing protocol problems in real internetworks can be very complex— much more complex than even the most difficult CCNA R&S exam questions. Defining a generic troubleshooting process with which to attack both simple and complex routing +protocol problems would require a lot of space and be counterproductive for preparing for + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 3 + +the CCNA exam. This chapter instead offers a straightforward process for attacking rout-ing protocol problems—specifically, problems similar to the depth and complexity of the CCNA exam. + +If an exam question appears to be related to a problem with a routing protocol, you can quickly identify some common configuration errors with the following process—even if the question does not list the configuration. The process has three main tasks: + +Step 1. Examine the internetwork design to determine on which interfaces the routing protocol should be enabled and which routers are expected to become neighbors. +Step 2. Verify whether the routing protocol is enabled on each interface (as per Step 1). If it isn’t, determine the root cause and fix the problem. +Step 3. Verify that each router has formed all expected neighbor relationships. If it hasn’t, find the root cause and fix the problem. + +For instance, as noted with asterisks in Figure Q-2, each router should enable the routing protocol on each of the interfaces shown in the figure. Also, routing protocol neighbor rela-tionships should form between R1 and R2, and R1 and R3, but not between R2 and R3. + + + + + + + +172.16.2.1/24 + +* + +Neighbor * 172.16.4.1/24 172.16.9.2/30 R2 +172.16.5.1/24 172.16.9.1/30 +* +* +* +R1 +* +172.16.9.5/30 + + + + + + + +Q + + +172.16.9.6/30 R3 * +* +Neighbor 172.16.6.1/24 + +Figure Q-2 Routing Protocol Interfaces and Neighbor Relationships +While the concepts outlined in Figure Q-2 should be somewhat obvious by now, this chapter discusses how some of the most common configuration mistakes can impact the interfaces used by a routing protocol and whether a routing protocol creates neighbor relationships. + +Interfaces Enabled with a Routing Protocol +This section examines the second major troubleshooting step outlined in the previous sec-tion of the chapter: how to verify the interfaces on which the routing protocol has been enabled. Both EIGRP and OSPF configuration enable the routing protocol on an interface by using the network router subcommand. For any interfaces matched by the network commands, the routing protocol tries the following two actions: + +■ Attempt to find potential neighbors on the subnet connected to the interface ■ Advertise the subnet connected to that interface + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +At the same time, the passive-interface router subcommand can be configured so that the router does not attempt to find neighbors on the interface (the first action just listed), but still advertises the connected subnet (the second action). + +Three show commands are all that is needed to know exactly which interfaces have been enabled with EIGRP and which interfaces are passive. In particular, the show ip eigrp interfaces command lists all EIGRP-enabled interfaces that are not passive interfaces. The show ip protocols command essentially lists the contents of the configured network com-mands for each routing protocol and a separate list of the passive interfaces. Comparing these two commands identifies all EIGRP-enabled interfaces and those that are passive. + +For OSPF, the command works slightly differently, with the show ip ospf interface brief command listing all OSPF-enabled interfaces (including passive interfaces). Using this com-mand, along with the list of passive interfaces listed by the show ip protocols command, again identifies all fully enabled OSPF interfaces as well as all passive interfaces. + +Table Q-1 summarizes the commands that identify the interfaces on which OSPFv2 and EIGRP are enabled for easier reference. + +Table Q-1 Key Commands to Find Routing Protocol-Enabled Interfaces + +Command + +show ip eigrp interfaces + +show ip ospf interface brief + + +show ip protocols + +Key Information + +Lists the interfaces on which EIGRP is enabled (based on the network commands), excluding passive interfaces. +Lists the interfaces on which the OSPFv2 is enabled (based on the network router subcommands or ip ospf interface subcommands), including passive interfaces. +Lists the contents of the network configuration commands for each routing process, and lists enabled but passive interfaces. + +Lists Passive Interfaces? +No + + +Yes + + + +Yes + + + +NOTE All the commands in Table Q-1 list the interfaces regardless of interface status, in effect telling you the results of the network and passive-interface configuration com-mands. + +So, for the major troubleshooting step covered in this section, the task is to use the com-mands in Table Q-1 and analyze the output. First, an EIGRP example will be shown, fol-lowed by an OSPF example. + +EIGRP Interface Troubleshooting +This section shows a few examples of the commands in the context of Figure Q-3, which is used in all the examples in this chapter. + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 5 + + + +G0/1 10.1.11.1/24 R1 + + + +G0/1 +10.1.22.2/24 R2 + +G0/0 10.1.1.1/24 + + + +G0/0 +10.1.1.2/24 + + +G0/0 10.1.1.3/24 + + + +G0/0 +10.1.1.4/24 + + +G0/1 +R3 10.1.33.3/24 + + + +G0/1 +R4 10.1.44.4/24 + + +Figure Q-3 Internetwork for EIGRP/OSPF Troubleshooting Examples This example includes four routers, with the following scenario in this case: +■ R1 and R2 are configured correctly on both LAN interfaces. +■ R3 is mistakenly not enabled with EIGRP on its G0/1 interface. +■ R4 meant to use a passive-interface G0/1 command because no other routers are off R4’s G0/1 LAN. However, R4 has instead configured a passive-interface G0/0 command. + +This example begins by showing the working details between Routers R1 and R2, and then moves on to discuss the issues related to R3 and R4. + +Examining Working EIGRP Interfaces +Examples Q-1 and Q-2 list configuration and show commands for R1 and R2, respectively. Each lists the related configuration, the show ip eigrp interfaces and show ip protocols +command, and the EIGRP-learned routes on each router. +Example Q-1 EIGRP Interfaces Problem: R1 Commands Q R1# show running-config +! only pertinent lines shown +router eigrp 99 +network 10.0.0.0 +! +R1# show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(99) + + +Interface +Gi0/0 +Gi0/1 + +Xmit Queue +Peers Un/Reliable +2 0/0 +0 0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 2 +0/0 0 + +Pacing Time +Un/Reliable +0/0 +0/0 + +Multicast +Flow Timer +50 +0 + +Pending +Routes +0 +0 + + +R1# show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 99" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + +EIGRP-IPv4 Protocol for AS(99) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 1.1.1.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Routing Information Sources: + +Gateway +10.1.1.2 +10.1.1.3 + +Distance +90 +90 + +Last Update +09:55:51 +00:02:00 + +Distance: internal 90 external 170 + +R1# show ip route eigrp +! Legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks +D 10.1.22.0/24 [90/30720] via 10.1.1.2, 00:00:40, GigabitEthernet0/0 + + +Example Q-2 EIGRP Interfaces Problem: R2 Commands R2# show running-config +! only pertinent lines shown +router eigrp 99 +network 10.1.0.0 0.0.255.255 + +R2# show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(99) + + +Interface +Gi0/0 +Gi0/1 + +Xmit Queue +Peers Un/Reliable +2 0/0 +0 0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 1 +0/0 0 + +Pacing Time +Un/Reliable +0/1 +0/0 + +Multicast +Flow Timer +50 +0 + +Pending +Routes +0 +0 + + +R2# show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 99" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 7 + +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(99) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 2.2.2.2 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.0.0/16 +Routing Information Sources: + +Gateway +10.1.1.3 +10.1.1.1 + +Distance +90 +90 + +Last Update +00:02:30 +09:56:20 + +Distance: internal 90 external 170 + +R2# show ip route eigrp +! Legend omitted for brevity +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks Q D 10.1.11.0/24 [90/30720] via 10.1.1.1, 00:03:25, GigabitEthernet0/0 + +The show ip eigrp interfaces command output on both R1 and R2 shows how both R1 and R2 have configured EIGRP using process ID 99, and that EIGRP has been enabled on both G0/0 and G0/1 on both these routers. This command lists only interfaces on which EIGRP has been enabled, excluding passive interfaces. + +The highlighted parts of the show ip protocols command output on each router are particular-ly interesting. These sections show the parameters of the configured network commands. The show ip protocols command lists a separate line under the header “Routing for Networks,” one for each configured network command. Example Q-1’s output suggests R1 has a network 10.0.0.0 configuration command (as shown at the beginning of the example), and Example +Q-2’s “10.1.0.0/16” suggests R2 has a network 10.1.0.0 0.0.255.255 command. + +Examining the Problems with EIGRP Interfaces +The next few pages now look at the problems caused by the configuration on Routers R3 and R4. + +First, Example Q-2 gives brief insight into the current problem caused by R3. The end of R2’s show ip protocols command (Example Q-2) lists two routing information sources: 10.1.1.1 (R1) and 10.1.1.3 (R3). However, R2 has learned only one EIGRP route (10.1.11.0/24), as shown in the show ip route eigrp command output. When working properly, R2 should learn three EIGRP routes—one for each of the other LAN subnets shown in Figure Q-3. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + +Example Q-3 shows the root cause on R3. First, R3’s show ip eigrp interfaces command lists G0/0, but not G0/1, so a problem might exist with how EIGRP has been configured on G0/1. The configuration at the top of the example lists the root cause: an incorrect network command, which does not enable EIGRP on R3’s G0/1 interface. +Example Q-3 EIGRP Problems on R3 R3# show running-config +! lines omitted for brevity +router eigrp 99 +network 10.1.1.3 0.0.0.0 +network 10.1.13.3 0.0.0.0 +auto-summary + +R3# show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(99) + + +Interface +Gi0/0 + +Xmit Queue +Peers Un/Reliable +2 0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 1 + +Pacing Time +Un/Reliable +0/1 + +Multicast +Flow Timer +50 + +Pending +Routes +0 + + +R3# show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 99" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(99) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 3.3.3.3 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.1.3/32 +10.1.13.3/32 +Routing Information Sources: + +Gateway +10.1.1.2 +10.1.1.1 + +Distance +90 +90 + +Last Update +00:05:14 +00:05:14 + +Distance: internal 90 external 170 + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 9 + +The root cause of R3’s problem is that R3 has a network 10.1.13.3 0.0.0.0 configura-tion command, which does not match R3’s 10.1.33.3 G0/1 IP address. If the configuration was not available in the exam question, the show ip protocols command could be used to +essentially see the same configuration details. In this case, the show ip protocols command on R3 lists the text “10.1.13.3/32” as a reference to the contents of the incorrect network command’s parameters, with “/32” translating to a wildcard mask of 32 binary 0s, or decimal 0.0.0.0. + +R3’s incorrect configuration means that two actions do not happen on R3’s G0/1 interface. First, R3 does not try to find neighbors on its G0/1 interface, which is not a big deal in this case. However, R3 also does not advertise subnet 10.1.33.0/24, the connected subnet off R3’s G0/1 interface. + +Moving on to R4’s problem, Example Q-4 shows why R1 and R2 do not learn R4’s 10.1.44.0/24 subnet. In this case, on R4, the engineer could have correctly used a passive-interface gigabitethernet0/1 router subcommand because no other routers should exist off R4’s G0/1 interface. However, the engineer mistakenly made R4’s G0/0 interface passive. +Example Q-4 EIGRP Problems on R4 R4# show running-config +! lines omitted for brevity +router eigrp 99 +passive-interface GigabitEthernet0/0 +network 10.0.0.0 +auto-summary + +R4# show ip eigrp interfaces Q EIGRP-IPv4 Interfaces for AS(99) + + +Interface +Gi0/1 + +Xmit Queue +Peers Un/Reliable +0 0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 0 + +Pacing Time +Un/Reliable +0/1 + +Multicast +Flow Timer +0 + +Pending +Routes +0 + + +R4# show ip protocols | begin Routing for Networks +Routing for Networks: +10.0.0.0 +Passive Interface(s): +GigabitEthernet0/0 +Routing Information Sources: +Gateway Distance Last Update +Distance: internal 90 external 170 + + + +NOTE The last command on the example, show ip protocols | begin Routing for Networks, lists the command output, but starting with the line with the literal case-sensitive string Routing for Networks. You can use this feature with any output from a command when you prefer to view only later lines of the command’s output. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + +To find this mistake without the configuration, Example Q-4 lists two useful commands. R4’s show ip eigrp interfaces command omits the (G0/0) passive interface, which means that R4 will not attempt to find EIGRP neighbors off that interface. Also, the highlighted part of R4’s show ip protocols command output lists G0/0 as a passive interface, which again means that R4 does not even attempt to become neighbors with others off its G0/0 interface. + +OSPF Interface Troubleshooting +OSPF has the same basic requirements as EIGRP for interfaces, with a few exceptions. First, EIGRP routers need to use the same autonomous system number (ASN) as their neighbor-ing routers, as configured in the router eigrp asn global configuration command. OSPF routers can use any process ID on the router ospf process-id command, with no need to match their neighbors. Second, OSPF requires that the interfaces connected to the same subnet be assigned to the same OSPF area, whereas EIGRP has no concept of areas. + +Example Q-5 shows a mostly working OSPF internetwork, again based on Figure Q-3. The problem in this case relates to the area design, as shown in Figure Q-4, the revised version of Figure Q-3. All subnets should be placed into area 0. However, the engineer made a configuration mistake on R2, putting both its interfaces into area 1. As a result, R2’s G0/0 interface breaks the OSPF design rule of being in the same subnet as R1, R3, and R4, but not being in the same OSPF area. + +Intended Design: Area 0 Only + + +G0/1 +10.1.11.1/24 R1 + + +G0/0 +10.1.1.1/24 + + +G0/0 10.1.1.3/24 R3 + +G0/1 +10.1.33.3/24 + + + +Incorrect Configuration: Area 1 + + +G0/1 +10.1.22.2/24 R2 + + +G0/0 +10.1.1.2/24 + + +G0/0 10.1.1.4/24 R4 + +G0/1 +10.1.44.4/24 + + +Figure Q-4 Intended Area Design Using Only Area 0, with R2 Breaking the Design +Example Q-5 begins to break down the problem by looking at the status of OSPF on the router interfaces of R1 and R2, using the show ip ospf interface brief command. +Example Q-5 show ip interface brief on R1 and R2 R1> show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C +Gi0/1 1 0 10.1.11.1/24 1 DR 0/0 +Gi0/0 1 0 10.1.1.1/24 1 DROTH 2/2 +! The following command is from R2 +R2> show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/1 2 1 +Gi0/0 2 1 + +10.1.22.2/24 +10.1.1.2/24 + +1 WAIT 0/0 +1 WAIT 0/0 + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 11 + +From a general perspective, the show ip ospf interface brief command lists output similar to the show ip eigrp interface command, with one line for each enabled interface. The show ip ospf interface command, not shown in the example, lists detailed OSPF informa-tion for each interface. + +Specific to this problem, the output in Example Q-5 shows that R1 and R2 both have OSPF enabled on both LAN interfaces. However, this command also lists the area number for each interface, with R2 having both LAN interfaces in area 1. Also, these commands repeat the IP address and mask of the interfaces, so together, you can see that R1’s 10.1.1.1/24 address is in the same subnet as R2’s 10.1.1.2/24 address, putting these two routers in the same subnet but in different OSPF areas. + +Example Q-6 shows another way to look at the problem, with the show ip protocols com-mands on both R1 and R2. Because this command lists the OSPF network commands in shorthand form, it can point toward a possible configuration error, even if the configuration is not available. +Example Q-6 Finding OSPF Configuration Errors with show ip protocols R1 and R2 R1> show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 1.1.1.1 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: Q +10.0.0.0 0.255.255.255 area 0 +Routing Information Sources: + +Gateway +2.2.2.2 +3.3.3.3 +10.1.44.4 + +Distance +110 +110 +110 + +Last Update +00:14:32 +00:14:32 +00:14:42 + +Distance: (default is 110) + +R1> show ip route ospf +! Legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +O 10.1.33.0/24 [110/2] via 10.1.1.3, 00:15:32, GigabitEthernet0/0 +O 10.1.44.0/24 [110/2] via 10.1.1.4, 00:15:42, GigabitEthernet0/0 +! Now moving to Router R2 + +R2> show ip protocols +*** IP Routing is NSF aware *** + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + +Routing Protocol is "ospf 2" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 2.2.2.2 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.0.0.0 0.255.255.255 area 1 +Routing Information Sources: +Gateway Distance Last Update +Distance: (default is 110) + +R2> +Nov 15 12:16:39.377: %OSPF-4-ERRRCV: Received invalid packet: mismatched area +ID, from backbone area must be virtual-link but not found from 10.1.1.1, +GigabitEthernet0/0 + + +Interestingly, a closer look at R2’s show ip protocols command output, particularly the highlighted portion, points out the configuration error. As usual, the section with the head-ing “Routing for Networks:” points to a shorthand version of the configuration. In this case, the highlighted phrase “10.0.0.0 0.255.255.255 area 1” is actually the exact syntax of the one network command on Router R2, minus the word network, or network 10.0.0.0 0.255.255.255 area 1. Because Figure Q-4 shows the design should put all interfaces in area 0, reconfiguring this command to instead be network 10.0.0.0 0.255.255.255 area 0 would solve this particular problem. + +The end of the example also shows an unsolicited log message generated by Router R2, notifying the console user that this router has received a Hello from a router in a different area. + +As you check the interfaces, you could also check several other details. It makes sense to go ahead and check the interface IP addresses, masks, and interface status values by using the show interfaces and show ip interface brief commands. In particular, it is helpful to note which interfaces are up/up, because a router will send no packets (including routing proto-col packets) out interfaces that are not in an up/up state. + +Neighbor Relationships +This final major section of the chapter examines the large number of facts that each router must check with each potential neighbor before the two routers become neighbors. + +At a very basic level, routing protocols can easily create neighbor relationships using a Hello protocol. First, the routing protocol must be enabled on an interface. In addition, the inter-face may not be configured as a passive interface, because that stops the routing protocol from sending the Hello messages. + +Beyond this basic process, the routing protocols actually check several other parameters to find out whether the routers should become neighbors. Both OSPF and EIGRP use Hello messages, and these messages each list information used to perform some basic verification + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 13 + +checks. For example, as just shown in earlier Example Q-5, an OSPF router should not become neighbors with another router in another area because all routers on a common subnet should be in the same OSPF area by design. + +After an EIGRP or OSPF router hears a Hello from a new neighbor, the routing protocol examines the information in the Hello, and compares that information with the local rout-er’s own settings. If the settings match, great. If not, the routers do not become neighbors. Because there is no formal term for all these items that a routing protocol considers, this book just calls them neighbor requirements. + +Table Q-2 lists the neighbor requirements for both EIGRP and OSPF. Following the table, the next few pages examine some of these settings for both EIGRP and OSPF, again using examples based on Figure Q-3. + +NOTE Even though it is important to study and remember the items in this table, when reading this chapter the first time, just keep reading. When later reviewing the chapter or part, make sure you remember the details in the table. + +Table Q-2 Neighbor Requirements for EIGRP and OSPF + +Requirement +Interfaces must be in an up/up state. Interfaces must be in the same subnet. +Access control lists (ACL) must not filter routing protocol messages. Must pass routing protocol neighbor authentication (if configured). Must use the same ASN/PID on the router configuration command. Hello and hold/dead timers must match. +Router IDs (RID) must be unique. K-values must match. +Must be in the same area. + +EIGRP OSPF Yes Yes Yes Yes Yes Yes Yes Yes +Yes No Q +No Yes No1 Yes Yes N/A +N/A Yes + + +1 Having duplicate EIGRP RIDs does not prevent routers from becoming neighbors, but it can cause prob-lems when external EIGRP routes are added to the routing table. + +Unlike most of the neighbor requirements listed in Table Q-2, the first three requirements have very little to do with the routing protocols themselves. The two routers must be able to send packets to each other over the physical network to which they are both connected. To do that, the router interfaces must be up/up, and they must be in the same subnet. In addition, the routers must not be using an ACL that filters the routing protocol traffic. + +For instance, OSPF sends many messages to the well-known multicast IP addresses 224.0.0.5 and 224.0.0.6, whereas EIGRP uses 224.0.0.10. An ACL command like access-list 101 deny ip any host 224.0.0.10, in an inbound ACL on a router interface, would filter incoming EIGRP packets. Or, an ACL command like access-list 102 deny ospf any any could filter all OSPF traffic. Even more difficult to notice is an ACL that has lots of permit commands that match different TCP and UDP port numbers, but does not match the rout-ing protocol explicitly, so the routing protocol packets match the implicit deny any at the end of the ACL. So, take extra care to watch for ACLs, especially when it seems like all the routing protocol configuration looks good. + + +|||||||||||||||||||| +|||||||||||||||||||| + + +14 CCNA 200-301 Official Cert Guide, Volume 1 + +In practice, before examining the rest of the details of why two routers do not become neighbors, confirm that the two routers can ping each other on the local subnet. If the ping fails, investigate all the Layer 1, 2, and 3 issues that could prevent the ping from working (such as an interface not being up/up). + +Now, on to the specific discussions about EIGRP and OSPF. Because the details differ slightly between the two routing protocols, this section first examines EIGRP, followed by OSPF. + +NOTE This section assumes that the routing protocol has actually been enabled on each required interface, as covered earlier in this chapter in the “Interfaces Enabled with a Routing Protocol” section. + + +EIGRP Neighbor Verification Checks +Any two EIGRP routers that connect to the same data link, and whose interfaces have been enabled for EIGRP and are not passive, will at least consider becoming neighbors. To quick-ly and definitively know which potential neighbors have passed all the neighbor require-ments for EIGRP, just look at the output of the show ip eigrp neighbors command. This command lists only neighbors that have passed all the neighbor verification checks. + +Example Q-7 shows an example of the show ip eigrp neighbors command, with the four routers from Figure Q-3 again. In this case, all the routers have been configured correctly, so each has a neighbor relationship with the other three routers on the same LAN subnet. +Example Q-7 R1 show ip eigrp neighbors Command with All Problems Fixed R1# show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(99) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num + +1 10.1.1.3 Gi0/0 +2 10.1.1.4 Gi0/0 +0 10.1.1.2 Gi0/0 + +13 00:00:20 1 100 0 31 +13 00:00:43 80 480 0 10 +13 00:13:52 1 100 0 20 + + + +If the show ip eigrp neighbors command does not list one or more expected neighbors, the first problem isolation step should be to find out if the two routers can ping each oth-er’s IP addresses on the same subnet. If that works, start looking at the list of neighbor veri-fication checks, as relisted for EIGRP here in Table Q-3. Table Q-3 summarizes the EIGRP neighbor requirements, while noting the best commands with which to determine which requirement is the root cause of the problem. + +Table Q-3 EIGRP Neighbor Requirements and the Best show/debug Commands + +Requirement +Must be in the same subnet. +Must use the same ASN on the router configuration command. +Must pass EIGRP neighbor authentication. +K-values must match. + +Best Commands to Isolate the Problem show interfaces, show ip interface +show ip eigrp interfaces, show ip protocols + +debug eigrp packets +show ip protocols + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 15 + +Of the four rows of requirements listed in Table Q-3, the first two have already been dis-cussed in this chapter, and do not need further discussion. + +For EIGRP authentication (the third item in the table), EIGRP supports the capability for routers to trust routers as EIGRP neighbors only if the routers share the same security key (password); if that check fails, the neighbor relationship fails. By default, routers do not attempt EIGRP authentication, which allows the routers to form EIGRP neighbor relation-ships. If one router uses authentication, and the other does not, they will not become neighbors. If both use authentication, they must use the same authentication key to become neighbors. + +The last item in the table, EIGRP K-values, refers to the EIGRP metric components and the metric calculation. These K-values are variables that basically enable or disable the use of the different components in the EIGRP composite metric. Cisco recommends leaving these values at their default settings, using only bandwidth and delay in the metric calculation. The K-value settings must match before two routers will become neighbors; you can check the K-values on both routers with the show ip protocols command. + +EIGRP Neighbor Troubleshooting Example +Example Q-8 shows three problems that can cause EIGRP routers to fail to become neigh-bors. This example uses the usual design for this chapter, as repeated in Figure Q-5. The figure shows the same routers, and same interfaces, but with the following problems: + +■ R2 has been configured with IP address 10.1.2.2/24 in a different subnet than R1, R3, and R4. +■ R3 has been configured to use ASN 199 with the router eigrp 199 command instead of +ASN 99, as used on the other three routers. Q +■ R4 has been configured to use message digest 5 (MD5) authentication, whereas the other routers use no authentication. + +R1 can actually detect two of the problems using local commands and messages, as shown in Example Q-8. R1 generates an unsolicited log message for the mismatched subnet prob-lem, and a debug command on R1 can reveal the authentication failure. The example shows some running commentary inside the example. + +Wrong ASN (199) + + +G0/1 10.1.11.1/24 R1 + + + +G0/1 +10.1.22.2/24 R2 + + +G0/0 10.1.1.1/24 + + + +G0/0 +10.1.2.2/24 + + +G0/0 10.1.1.3/24 R3 + + + + +G0/0 10.1.1.4/24 R4 + +G0/1 10.1.33.3/24 + + + +G0/1 +10.1.44.4/24 + + +Wrong Subnet Uses Authentication (Others Do Not) + +Figure Q-5 Summary of Problems That Prevent EIGRP Neighbors on the Central LAN + + +|||||||||||||||||||| +|||||||||||||||||||| + + +16 CCNA 200-301 Official Cert Guide, Volume 1 + +Example Q-8 Common Problems Preventing the Formation of EIGRP Neighbors (R1) ! First, R1 has no neighbor relationships yet. R1 uses ASN (process) 99. +R1# show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(99) + +R1# +! Next, R1 generates a log message, which shows up at the console, stating +! that the router with IP address 10.1.2.2 is not on the same subnet as R1. +! +*Nov 15 16:19:14.740: %DUAL-6-NBRINFO: EIGRP-IPv4 99: Neighbor 10.1.2.2 +(GigabitEthernet0/0) is blocked: not on common subnet (10.1.1.1/24) + +! Next, R1 enables a debug that shows messages for each packet received from R4, +! which uses the wrong password (authentication key string) +! +R1# debug eigrp packets +EIGRP Packets debugging is on +(UPDATE, REQUEST, QUERY, REPLY, HELLO, IPXSAP, PROBE, ACK, STUB, SIAQUERY, +SIAREPLY) +R1# + +*Nov 15 16:20:30.865: EIGRP: Gi0/0: ignored packet from 10.1.1.4, opcode = 5 (authentication off or key-chain missing) + +Example Q-8 shows some evidence of the mismatched subnet with R2, and the invalid authentication problem with R4. Even without knowing the details, it is easy to imagine that if one router’s EIGRP process uses authentication with a defined password, and the other does not, that authentication will fail. The result? Neighbor relationships do not form. + +Example Q-8 shows details about two of the problems, but not any details about the incor-rect ASN configured on R3. Example Q-9 shows those details by listing excerpts from two show commands on R3, both of which identify the ASN configured on that router. By using these same commands on all the routers, you could note that R1, R2, and R4 use ASN 99, whereas R3 uses 199, as shown in Example Q-9. +Example Q-9 Displaying the Incorrect ASN (199) on R3 R3# show ip protocols +Routing Protocol is "eigrp 199" +! +! The first line of output from show ip eigrp interfaces lists ASN 199 +! +R3# show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(199) + + +Interface +Gi0/0 +Gi0/1 + +Xmit Queue Mean +Peers Un/Reliable SRTT +0 0/0 0 +0 0/0 0 + +Pacing Time +Un/Reliable +0/1 +0/1 + +Multicast +Flow Timer +0 +0 + +Pending +Routes +0 +0 + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 17 + +OSPF Neighbor Troubleshooting +Similar to EIGRP, a router’s show ip ospf neighbor command lists all the neighboring routers that have met all the requirements to become an OSPF neighbor as listed in Table Q-2. So, the first step in troubleshooting OSPF neighbors is to look at the list of neighbors. + +Example Q-10 lists the output of a show ip ospf neighbor command on Router R2, from Figure Q-4. All four routers sit on the same LAN subnet, in area 0, with correct configura-tions, so all four routers form a valid OSPF neighbor relationship. +Example Q-10 Normal Working show ip ospf neighbors Command on Router R2 R2# show ip ospf neighbor + + +Neighbor ID +1.1.1.1 +3.3.3.3 +4.4.4.4 + +Pri State +1 FULL/BDR +1 2WAY/DROTHER +1 FULL/DR + +Dead Time +00:00:37 +00:00:37 +00:00:31 + +Address +10.1.1.1 +10.1.1.3 +10.1.1.4 + +Interface +GigabitEthernet0/0 +GigabitEthernet0/0 +GigabitEthernet0/0 + + + +First, note that the neighbor IDs, listed in the first column, identify neighbors by their rout-er ID (RID). For this example network, all four routers use an easily guessed RID. Further to the right, the Address column lists the interface IP address used by that neighbor on the common subnet. + +A brief review of OSPF neighbor states can help you understand a few of the subtleties of the output in the example. A router’s listed status for each of its OSPF neighbors—the +neighbor’s state—should settle into either a 2-way or full state under normal operation. For neighbors that do not need to directly exchange their databases, typically two non-designat- +ed router (DR) routers on a LAN, the routers should settle into a 2-way neighbor state. In Q most cases, two neighboring routers need to directly exchange their full link-state databases +(LSDB) with each other. As soon as that process has been completed, the two routers settle into a full neighbor state. + +In Example Q-10, Router R4 is the DR, and R1 is the backup DR (BDR), so R2 and R3 (as non-DRs) do not need to directly exchange routes. Therefore, R2’s neighbor state for R3 (RID 3.3.3.3) in Example Q-10 is listed as 2-way. + +NOTE Notably, OSPF neighbors do not have to use the same process ID on the router ospf process-id command to become neighbors. In Example Q-10, all four routers use dif-ferent PIDs. + +If the show ip ospf neighbor command does not list one or more expected neighbors, you should confirm, even before moving on to look at OSPF neighbor requirements, that the two routers can ping each other on the local subnet. But if the two neighboring routers can ping each other, and the two routers still do not become OSPF neighbors, the next step is to examine each of the OSPF neighbor requirements. Table Q-4 summarizes the require-ments, listing the most useful commands with which to find the answers. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +18 CCNA 200-301 Official Cert Guide, Volume 1 + +Table Q-4 OSPF Neighbor Requirements and the Best show/debug Commands + +Requirement +Must be in the same subnet. + +Best show Command +show interfaces + +Best debug Command +debug ip ospf hello + +Hello and dead timers must match. show ip ospf interface debug ip ospf hello + +Must be in the same area. RIDs must be unique. + +Must pass any neighbor authentication. + + +show ip ospf interface brief show ip ospf + +show ip ospf interface + + +debug ip ospf adj +(N/A; log messages identify this problem) +debug ip ospf adj + + +This topic looks at a couple of OSPF neighbor problems using the usual four-router net-work from Figure Q-4, with all interfaces in area 0. However, the following problems have been introduced into the design: + +■ R2 has been configured with both LAN interfaces in area 1, whereas the other three routers’ G0/0 interfaces are assigned to area 0. +■ R3 is using the same RID (1.1.1.1) as R1. +■ R4 has been configured with a Hello/dead timer of 5/20 on its G0/0 interface, instead of the 10/40 used (by default) on R1, R2, and R3. + +Figure Q-6 shows these same problems for reference. + +RID 1.1.1.1 RID 1.1.1.1 (Should be 3.3.3.3) + + + +G0/1 +10.1.11.1/24 R1 + +G0/0 +10.1.1.1/24 + + +G0/0 10.1.1.3/24 R3 + + +G0/1 +10.1.33.3/24 + + +Incorrect Configuration: Area 1 + + +G0/1 +10.1.22.2/24 R2 + +G0/0 +10.1.1.2/24 + + +G0/0 10.1.1.4/24 R4 + + +G0/1 +10.1.44.4/24 + + +Intended Design: Area 0 Only Hello/Dead = 5/20 + +Figure Q-6 Summary of Problems That Prevent OSPF Neighbors on the Central LAN + +Finding Area Mismatches +Earlier in this chapter, the “OSPF Interface Troubleshooting” section showed how to use the show ip ospf interface command to list the area numbers and find OSPF area mismatches. This next topic shows how to see that same issue using the debug ip ospf adj command, as shown in Example Q-11. This command lists messages related to OSPF neighbor adjacency events, and shows messages that identify the area mismatch (with R2). + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 19 + +Example Q-11 Finding Mismatched Area Problem with R1 debug R1# debug ip ospf adj +OSPF adjacency events debugging is on +R1# +*Nov 15 13:42:02.288: OSPF-1 ADJ Gi0/0: Rcv pkt from 10.1.1.2, area 0.0.0.0, mismatched area 0.0.0.1 in the header +R1# +R1# undebug all +All possible debugging has been turned off + + +As noted in Table Q-4, the debug ip ospf adj command helps troubleshoot mismatched OSPF area problems. The first part of the highlighted message in the example lists short-hand about a received packet (“Rcv pkt”) from 10.1.1.2, which is R2’s IP address. The rest of the message mentions R1’s area (0.0.0.0), and the area claimed by the other router (0.0.0.1). (Note that the message lists the 32-bit area number as a dotted-decimal number.) + +This particular example focuses on the symptom (that a neighbor relationship does not start), and the debug messages that identify the problem (mismatched areas). However, find-ing the configuration error may take some work, because the problem could be more com-plex than just having the wrong area number configured on a command. + +One harder-to-notice configuration error happens when the configuration has multiple network commands, with different area numbers, that all happen to match one interface’s IP address. IOS stores the OSPF network commands to the configuration in the same order they are configured (which is the same order listed in the output of show running-config). IOS processes the commands in sequence, so that the first network command that matches +a particular interface is used to set the OSPF area number. Q +For instance, imagine a router with interface G0/1 configured with IP address 1.1.1.1. The OSPF configuration lists the following two network commands, in that order. Both would match the interface IP address of 1.1.1.1, so IOS uses the first command, which lists area 1. IOS would not use the second command, even though it uses a wildcard mask that is more specific. + +■ network 1.0.0.0 0.255.255.255 area 1 ■ network 1.1.1.1 0.0.0.0 area 0 +Another tricky configuration error that can result in an area mismatch occurs when config-uring both the network OSPF subcommand and the ip ospf interface subcommand on the same router. IOS supports using both on the same router at the same time. However, IOS does not prevent a case in which a network command attempts to enable OSPF in one area, and the ip ospf interface subcommand attempts to enable OSPF in a different area. When that happens, IOS uses the area number defined in the ip ospf interface subcommand. + +For instance, with the two network commands just listed, if the ip ospf 1 area 5 com-mand was configured on that router’s interface, that interface would be in area 5; IOS would prefer that setting over any OSPF network command. + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +20 CCNA 200-301 Official Cert Guide, Volume 1 + + +NOTE Using both network router subcommands and ip ospf interface subcommands allows an easier migration from the older to newer style OSPF configuration. However, most enterprises today would use either network commands or ip ospf commands in one router. + + +Finding Duplicate OSPF Router IDs +Next, Example Q-12 shows R1 and R3 both trying to use RID 1.1.1.1. Interestingly, both routers automatically generate a log message for the duplicate OSPF RID problem between R1 and R3; the end of Example Q-12 shows one such message. For the exams, just use the show ip ospf commands on both R3 and R1 to easily list the RID on each router, noting that they both use the same value. +Example Q-12 Comparing OSPF Router IDs on R1 and R3 ! Next, on R3: R3 lists the RID of 1.1.1.1 +! +R3# show ip ospf +Routing Process "ospf 3" with ID 1.1.1.1 +Start time: 00:00:37.136, Time elapsed: 02:20:37.200 +! lines omitted for brevity + +! Back to R1: R1 also uses RID 1.1.1.1 + +R1# show ip ospf +Routing Process "ospf 1" with ID 1.1.1.1 +Start time: 00:01:51.864, Time elapsed: 12:13:50.904 +Supports only single TOS(TOS0) routes +Supports opaque LSA +Supports Link-local Signaling (LLS) +Supports area transit capability +Supports NSSA (compatible with RFC 3101) +Event-log enabled, Maximum number of events: 1000, Mode: cyclic +Router is not originating router-LSAs with maximum metric +Initial SPF schedule delay 5000 msecs +Minimum hold time between two consecutive SPFs 10000 msecs +Maximum wait time between two consecutive SPFs 10000 msecs +Incremental-SPF disabled +Minimum LSA interval 5 secs +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +Interface flood pacing timer 33 msecs +Retransmission pacing timer 66 msecs +Number of external LSA 0. Checksum Sum 0x000000 +Number of opaque AS LSA 0. Checksum Sum 0x000000 +Number of DCbitless external and opaque AS LSA 0 +Number of DoNotAge external and opaque AS LSA 0 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 21 + +Number of areas transit capable is 0 +External flood list length 0 +IETF NSF helper support enabled +Cisco NSF helper support enabled +Reference bandwidth unit is 100 mbps +Area BACKBONE(0) (Inactive) +Number of interfaces in this area is 3 +Area has no authentication +SPF algorithm last executed 00:52:42.956 ago +SPF algorithm executed 9 times +Area ranges are +Number of LSA 1. Checksum Sum 0x00C728 +Number of opaque link LSA 0. Checksum Sum 0x000000 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 + +*May 29 00:01:25.679: %OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id +1.1.1.1 from 10.1.1.3 on interface GigabitEthernet0/0 + + + +First, focus on the problem: the duplicate RIDs. The first line of the show ip ospf com-mand on the two routers quickly shows the duplicate use of 1.1.1.1. To solve the problem, assuming R1 should use 1.1.1.1 and R3 should use another RID (maybe 3.3.3.3), change the RID on R3, and restart the OSPF process. To do so, use the router-id 3.3.3.3 OSPF sub-command and use the EXEC mode command clear ip ospf process. + +Also, take a moment to read over the log message generated on each router when a dupli-cate RID exists. + +Finally, note that the show ip ospf commands in Example Q-12 also show a common false positive for a root cause of OSPF neighbor problems. OSPF PIDs—the number of the router ospf command—do not have to match. Note that in Example Q-12 that same first line of output shows that R3 uses the router ospf 3 command, per the phrase “Process ospf 3,” whereas R1 uses the router ospf 1 command, as noted with the phrase “Process ospf 1.” These mismatched numbers are not a problem. + + + + +Q + + +Finding OSPF Hello and Dead Timer Mismatches +Finally, consider the problem created on R4, with the configuration of a different Hello timer and dead timer as compared with the default settings on R1, R2, and R3. Whereas EIGRP allows neighbors to use a different Hello timer, OSPF does not, so this mismatch prevents R4 from becoming neighbors with any of the other three OSPF routers. + +Example Q-13 shows the easiest way to find the mismatch, using the show ip ospf interface command on both R1 and R4. This command lists the Hello and dead timers for each interface, as highlighted in the example. Note that R1 uses 10 and 40 (Hello and dead), whereas R4 uses 5 and 20. + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +22 CCNA 200-301 Official Cert Guide, Volume 1 + +Example Q-13 Finding Mismatched Hello/Dead Timers R1# show ip ospf interface G0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet Address 10.1.1.1/24, Area 0, Attached via Network Statement +Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 1.1.1.1, Interface address 10.1.1.1 +No backup designated router on this network +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +! lines omitted for brevity +! Moving on to R4 next +! +R4# show ip ospf interface Gi0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet Address 10.1.1.4/24, Area 0, Attached via Network Statement +Process ID 4, Router ID 10.1.44.4, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 10.1.44.4, Interface address 10.1.1.4 +No backup designated router on this network +Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5 +! lines omitted for brevity + + +The debug ip ospf hello command can also uncover this problem because it lists a message for each Hello that reveals the Hello/dead timer mismatch, as shown in Example Q-14. +Example Q-14 Finding Mismatched Hello/Dead Timers with debug R1# debug ip ospf hello +OSPF hello events debugging is on +R1# +*Nov 15 14:05:10.616: OSPF-1 HELLO Gi0/0: Rcv hello from 10.1.44.4 area 0 10.1.1.4 +*Nov 15 14:05:10.616: OSPF-1 HELLO Gi0/0: Mismatched hello parameters from 10.1.1.4 +*Nov 15 14:05:10.616: OSPF-1 HELLO Gi0/0: Dead R 20 C 40, Hello R 5 C 10 Mask R 255.255.255.0 C 255.255.255.0 + +Although debug messages can be a little difficult to understand, a few comments make the meaning of these messages much clearer. The highlighted message uses a C to mean “config-ured value”—in other words, the value on the local router, or R1 in this case. The R in the message means “received value,” or the value listed in the received Hello. In this case + +■ “Dead R 20 C 40” means that R1 received a Hello with a dead timer set to 20, while R1’s configured value is set to 40. + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 23 + +■ “Hello R 5 C 10” means that R1 received a Hello with the Hello timer set to 5, while R1’s configured value is set to 10. + +Note that any IP subnet mismatch problems could also be found with this same debug, based on the received and configured subnet masks. + +Other OSPF Issues +This last short discussion in this chapter looks at these two additional topics: shutting down the routing protocol process and the interface maximum transmission unit (MTU) size. + + +Shutting Down the OSPF Process +Cisco uses the IOS shutdown command in several contexts. You can use the shutdown command in interface configuration mode to disable the interface so that it no longer sends and receives packets. Cisco IOS switches allow the shutdown command in VLAN configu-ration mode, causing the switch to stop forwarding frames in that VLAN. In both cases, the shutdown command does not remove any configuration; it simply causes IOS to stop a par-ticular function. Then, the no shutdown command in the same command mode re-enables that function. + +IOS allows both the OSPFv2 and EIGRP routing protocol processes to be disabled and enabled with the shutdown and no shutdown commands, respectively, in routing protocol configuration mode. When a routing protocol process is shut down, IOS + +■ Brings down any existing neighbor relationships ■ Does not form new neighbor relationships +■ Quits sending Hello messages +■ Does not remove routing protocol configuration + + + + + + + + + + + + + + + + +Q + + +Basically, shutting down the routing protocol process gives the network engineer a way to stop using the routing protocol on that router, without having to remove all the configura-tion. + +From a troubleshooting perspective, on the exam, what would you expect to see if a small design was configured perfectly, except that one router’s OSPF process was shut down? First, the router with the shutdown routing protocol process would not have any OSPF neighbors, and other routers would not list that router as a neighbor. But because the OSPF shutdown subcommand does not remove any configuration, the show ip ospf interfaces command still shows evidence that OSPF is configured on the interfaces. + +Example Q-15 shows an example on Router R5, as shown in Figure Q-7. R5 is a differ- +ent router than the one used in earlier examples, but it begins the example with two OSPF neighbors, R2 and R3, with router IDs 2.2.2.2 and 3.3.3.3. The example shows the OSPF process being shut down, the neighbors failing, and those two key OSPF show commands: show ip ospf neighbor and show ip ospf interface brief. + + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +24 CCNA 200-301 Official Cert Guide, Volume 1 + + + + + +10.1.12.1 G0/1 + +R5 G0/2 10.1.13.1 + +RID 2.2.2.2 + +R2 + + +RID 3.3.3.3 + +R3 + + +Figure Q-7 Example Network to Demonstrate OSPF Process Shutdown + +Example Q-15 Shutting Down an OSPF Process, and the Resulting Neighbor States R5# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 +3.3.3.3 + +Pri State +1 FULL/DR +1 FULL/DR + +Dead Time +00:00:35 +00:00:33 + +Address +10.1.12.2 +10.1.13.3 + +Interface +GigabitEthernet0/1 +GigabitEthernet0/2 + +R5# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R5(config)# router ospf 1 +R5(config-router)# shutdown +R5(config-router)# ^Z +R5# +*Mar 23 12:43:30.634: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached +*Mar 23 12:43:30.635: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/2 from FULL to DOWN, Neighbor Down: Interface down or detached +R5# +R5# show ip ospf neighbor +R5# +R5# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/1 1 0 +Gi0/2 1 0 + +10.1.12.1/24 +10.1.13.1/24 + +1 DOWN 0/0 +1 DOWN 0/0 + + + +The two show commands point out a couple of particularly important facts. First, before the shutdown, the show ip ospf neighbor command lists two neighbors. After the shutdown, the same command lists no neighbors at all. Second, the show ip ospf interface brief command does list the interfaces on which OSPF is enabled, on the local router’s own IP addresses. However, it lists a state of DOWN, which is a reference to the neighbor’s state. + +Mismatched MTU Settings +The MTU size defines a per-interface setting used by the router for its Layer 3 forwarding logic, defining the largest network layer packet that the router will forward out each inter-face. For instance, the IPv4 MTU size of an interface defines the maximum size IPv4 packet that the router can forward out an interface. + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix Q: Troubleshooting IPv4 Routing Protocols 25 + +Routers often use a default MTU size of 1500 bytes, with the ability to set the value as well. The ip mtu size interface subcommand defines the IPv4 MTU setting, and the ipv6 mtu size command sets the equivalent for IPv6 packets. + +In an odd twist, two OSPFv2 routers can actually become OSPF neighbors, and reach 2-way state, even if they happen to use different IPv4 MTU settings on their interfaces. However, they fail to exchange their LSDBs. Eventually, after trying and failing to exchange their LSDBs, the neighbor relationship also fails. + +The concepts behind what happens with an MTU mismatch work the same with both OSPFv2 and OSPFv3. + +Command References +Tables Q-5, Q-6, and Q-7 list configuration, verification, and debug commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table Q-5 Appendix Q Configuration Command Reference + +Command +ip hello-interval eigrp as-number timer-value +ip hold-time eigrp as-number seconds +ip ospf hello-interval seconds + +ip ospf dead-interval number +passive-interface type number + +Description +Interface subcommand that sets the EIGRP Hello interval for that EIGRP process +Interface subcommand that sets the EIGRP hold time for the interface +Interface subcommand that sets the interval for periodic Hellos +Interface subcommand that sets the OSPF dead timer +Router subcommand, for both OSPF and EIGRP that tells the routing protocol to stop sending Hellos and stop trying to discover neighbors on that interface + + + + + + + + +Q + + +Table Q-6 Appendix Q show Command Reference + +Command +show ip protocols + + +show ip eigrp interfaces + +show ip route eigrp show ip eigrp neighbors +show ip ospf interface brief + +show ip ospf interface [type number] +show ip route ospf + +Description +Shows routing protocol parameters and current timer values, including an effective copy of the routing protocols’ network commands and a list of passive interfaces +Lists the interfaces on which EIGRP has been enabled for each EIGRP process, except passive interfaces +Lists only EIGRP-learned routes from the routing table Lists EIGRP neighbors and status +Lists the interfaces on which the OSPF protocol is enabled (based on the network commands), including passive interfaces +Lists detailed OSPF settings for all interfaces, or the listed interface, including Hello and dead timers and OSPF area +Lists routes in the routing table learned by OSPF + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +26 CCNA 200-301 Official Cert Guide, Volume 1 + + +Command +show ip ospf neighbor + +show ip ospf + +show interfaces + +show interfaces description + +Description +Lists neighbors and current status with neighbors, per interface +Lists a group of messages about the OSPF process itself, listing the OSPF Router ID in the first line +Lists a long set of messages, per interface, that lists configuration, state, and counter information +Lists one line of output per interface with brief status information + + +Table Q-7 Appendix Q debug Command Reference + +Command +debug eigrp packets + +debug ip ospf adj + +debug ip ospf events + +debug ip ospf packet debug ip ospf hello +undebug all + +Description +Lists log messages for EIGRP packets that flow in and out of the router +Issues log messages for adjacency events, meaning events related to routers becoming neighbors +Issues log messages for each action taken by OSPF, including the receipt of messages +Issues log messages describing the contents of all OSPF packets Issues log messages describing Hellos and Hello failures +EXEC command used to disable all current debugs + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +APPENDIX R + + + + +Exam Topics Cross Reference + +This appendix lists the exam topics associated with the CCNA 200-301 exam. Cisco lists the exam topics on its website. Even though changes to the exam topics are rare, you should always review those exam topics for any updates; check www.cisco.com/go/certifications and navigate to the correct exam. + +Cisco organizes each list of exam topics by domains, which are major topic areas. Cisco states the percentage of the exam that should come from each domain, so you get some idea of the areas of importance. Traditionally, the score report you receive after taking the exam shows your percentage score in each domain. + +This appendix includes two separate types of indices to exam topics: + +■ CCNA 200-301 Exam Topic Order: This section lists the CCNA 200-301 exam topics in the same order Cisco lists them on its website, with a list of associated book chapters. This first list shows a cross reference from each exam topic to the chapters that include at least some material about each topic. +■ Book Chapter Order Versus CCNA 200-301 Exam Topics: This lists the same CCNA 200-301 exam topics but indexed by chapter instead of exam topic. This section lists the chapters in this book, along with the exam topics that the chapter includes. This section basically relists the kind of information found on the first page of each chapter, just in condensed form in one place. + +CCNA 200-301 Exam Topic Order +The CCNA 200-301 exam includes six major topic areas (domains), each with a percentage listed. Table R-1 lists the domains and their percentages. + +Table R-1 CCNA 200-301 Exam Topic Domains +Domain Percentage +Domain 1: Network Fundamentals 20% + +Domain 2: Network Access 20% + +Domain 3: IP Connectivity 25% + +Domain 4: IP Services 10% + +Domain 5: Security Fundamentals 15% + +Domain 6: Automation and Programmability 10% + + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +2 CCNA 200-301 Official Cert Guide, Volume 1 + +Tables R-2 through R-7 list the exam topics within each of the six domains. Note that the CCNA 200-301 Official Cert Guide, Volume 2, covers some of the exam topics. These tables show where this book explains exam topics. Exam topics with no chapter listed are covered in Volume 2 only. + +Table R-2 CCNA 200-301 Domain 1 Exam Topics (Network Fundamentals) + +Exam Topic +1.1 Explain the role of network components + +1.1.a Routers + +1.1.b L2 and L3 switches + +1.1.c Next-generation firewalls and IPS + +1.1.d Access points + +1.1.e Controllers (Cisco DNA Center and WLC) + +1.1.f Endpoints + +1.1.g Servers + +1.2 Describe characteristics of network topology architectures + +1.2.a 2 tier + +1.2.b 3 tier + +1.2.c Spine-leaf + +1.2.d WAN + +1.2.e Small office/home office (SOHO) + +1.2.f On-premises and cloud + +1.3 Compare physical interface and cabling types + +1.3.a Single-mode fiber, multimode fiber, copper + +1.3.b Connections (Ethernet shared media and point-to-point) + +1.3.c Concepts of PoE + +1.4 Identify interface and cable issues (collisions, errors, mismatch duplex, and/or speed) +1.5 Compare TCP to UDP + +1.6 Configure and verify IPv4 addressing and subnetting + + +1.7 Describe the need for private IPv4 addressing + +1.8 Configure and verify IPv6 addressing and prefix + +1.9 Compare IPv6 address types + +Chapter(s) 2, 3, 5, 7, 26 +3, 15 + +2, 5, 7 + + +26 + +29 + + + +2, 3 + + + + + +3 + +2, 15 + + +1, 2 + +1, 2 + +1, 2 + + +7 + + + +6, 11, 12, 13, 14, 15, 17, 18, 22 +11, 16 + +23, 24 + +23, 24 + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix R: Exam Topics Cross Reference 3 + + +Exam Topic +1.9.a Global unicast + +1.9.b Unique local + +1.9.c Link local + +1.9.d Anycast + +1.9.e Multicast + +1.9.f Modified EUI 64 + +1.10 Verify IP parameters for Client OS (Windows, Mac OS, Linux) + +1.11 Describe wireless principles + +1.11.a Nonoverlapping Wi-Fi channels + +1.11.b SSID + +1.11.c RF + +1.11.d Encryption + +1.12 Explain virtualization fundamentals (virtual machines) + +1.13 Describe switching concepts + +1.13.a MAC learning and aging + +1.13.b Frame switching + +1.13.c Frame flooding + +1.13.d MAC address table + +Chapter(s) 23, 24 +23, 24 + +24 + +24 + +24 + +24 + + +26 + +26 + +26 + +26 + +28 + + +5, 8 + +5, 8 + +5, 8 + +5, 8 + +5, 8 + + +Table R-3 CCNA 200-301 Domain 2 Exam Topics (Network Access) R + +Exam Topic +2.1 Configure and verify VLANs (normal range) spanning multiple switches + +2.1.a Access ports (data and voice) + +2.1.b Default VLAN + +2.1.c Connectivity + +2.2 Configure and verify interswitch connectivity + +2.2.a Trunk ports + +2.2.b 802.1Q + +2.2.c Native VLAN + +2.3 Configure and verify Layer 2 discovery protocols (Cisco Discovery Protocol and LLDP) +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) + +Chapter(s) 8 +8 + +8 + +8 + +8 + +8 + +8 + +8 + + + +8, 9, 10, 17 + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +4 CCNA 200-301 Official Cert Guide, Volume 1 + +Exam Topic Chapter(s) +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree 5, 9, 10 Protocol and identify basic operations +2.5.a Root port, root bridge (primary/secondary), and other port names 9, 10 + +2.5.b Port states (forwarding/blocking) 9, 10 + +2.5.c PortFast benefits 9, 10 + +2.6 Compare Cisco Wireless Architectures and AP modes 27 + +2.7 Describe physical infrastructure connections of WLAN components (AP, 29 WLC, access/trunk ports, and LAG) +2.8 Describe AP and WLC management access connections (Telnet, SSH, 29 HTTP, HTTPS, console, and TACACS+/RADIUS) +2.9 Configure the components of a wireless LAN access for client 29 connectivity using GUI only such as WLAN creation, security settings, QoS profiles, and advanced WLAN settings + + +Table R-4 CCNA 200-301 Domain 3 Exam Topics (IP Connectivity) + + +Exam Topic +3.1 Interpret the components of routing table + +3.1.a Routing protocol code + +3.1.b Prefix + +3.1.c Network mask + +3.1.d Next hop + +3.1.e Administrative distance + +3.1.f Metric + +3.1.g Gateway of last resort + +3.2 Determine how a router makes a forwarding decision by default + +3.2.a Longest match + +3.2.b Administrative distance + +3.2.c Routing protocol metric + +3.3 Configure and verify IPv4 and IPv6 static routing + +3.3.a Default route + +3.3.b Network route + +3.3.c Host route + +3.3.d Floating static + +Chapter(s) 16 +16 + +16 + +16 + +16 + +16 + +16 + +16 + +16 + +16 + +16, 19, 20 + +19, 20 + +16, 18, 25 + +16, 18, 25 + +16, 18, 25 + +16, 18, 25 + +16, 18, 25 + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix R: Exam Topics Cross Reference 5 + + +Exam Topic +3.4 Configure and verify single area OSPFv2 + +3.4.a Neighbor adjacencies + +3.4.b Point-to-point + +3.4.c Broadcast (DR/BDR selection) + +3.4.d Router ID + +3.5 Describe the purpose of first hop redundancy protocol + +Chapter(s) 19, 20, 21 +19, 20, 21 + +19, 20, 21 + +19, 20, 21 + +19, 20, 21 + + + +Table R-5 CCNA 200-301 Domain 4 Exam Topics (IP Services) + + +Exam Topics +4.1 Configure and verify inside source NAT using static and pools + +4.2 Configure and verify NTP operating in a client and server mode + +4.3 Explain the role of DHCP and DNS within the network + +4.4 Explain the function of SNMP in network operations + +4.5 Describe the use of syslog features including facilities and levels + +4.6 Configure and verify DHCP client and relay + +4.7 Explain the forwarding per-hop behavior (PHB) for QoS such as classification, marking, queuing, congestion, policing, shaping +4.8 Configure network devices for remote access using SSH + +4.9 Describe the capabilities and function of TFTP/FTP in the network + +Chapter(s) + + + + + + + +6 + + + +6 + + +R + + +Table R-6 CCNA 200-301 Domain 5 Exam Topics (Security Fundamentals) + + +Exam Topics +5.1 Define key security concepts (threats, vulnerabilities, exploits, and mitigation techniques) +5.2 Describe security program elements (user awareness, training, and physical access control) +5.3 Configure device access control using local passwords + +5.4 Describe security password policies elements, such as management, complexity, and password alternatives (multifactor authentication, certificates, and biometrics) +5.5 Describe remote access and site-to-site VPNs + +5.6 Configure and verify access control lists + +Chapter(s) + + + + + +6 + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +6 CCNA 200-301 Official Cert Guide, Volume 1 + + +Exam Topics +5.7 Configure Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) +5.8 Differentiate authentication, authorization, and accounting concepts + +5.9 Describe wireless security protocols (WPA, WPA2, and WPA3) + +5.10 Configure WLAN using WPA2 PSK using the GUI + +Chapter(s) + + + + +28 + +29 + + + +Table R-7 CCNA 200-301 Domain 6 Exam Topics (Programmability and Automation) + +Exam Topics Chapter(s) 6.1 Explain how automation impacts network management +6.2 Compare traditional networks with controller-based networking + +6.3 Describe controller-based and software defined architectures (overlay, underlay, and fabric) + +6.3.a Separation of control plane and data plane + +6.3.b North-bound and south-bound APIs + +6.4 Compare traditional campus device management with Cisco DNA Center enabled device management +6.5 Describe characteristics of REST-based APIs (CRUD, HTTP verbs, and data encoding) +6.6 Recognize the capabilities of configuration management mechanisms Puppet, Chef, and Ansible +6.7 Interpret JSON encoded data + + +Book Chapter Order Versus CCNA 200-301 Exam Topics +Cisco organizes its exam topics based on the outcome of your learning experience, which is typically not a reasonable order for building the content of a book or course. This section lists the book chapters in sequence, with the exam topics covered in each chapter. + +Book Chapter Exam Topics Covered Part I: Introduction to Networking + +Chapter 1: Introduction to TCP/IP Networking + + +1.0 Network Fundamentals +1.3 Compare physical interface and cabling types 1.3.a Single-mode fiber, multimode fiber, copper +1.3.b Connections (Ethernet shared media and point-to-point) + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix R: Exam Topics Cross Reference 7 + + +Book Chapter +Chapter 2: Fundamentals of Ethernet LANs + + + + + + + + +Chapter 3: Fundamentals of WANs and IP Routing + +Exam Topics Covered +1.0 Network Fundamentals +1.1 Explain the role and function of network components 1.1.b L2 and L3 switches +1.2 Describe characteristics of network topology architectures 1.2.e Small office/home office (SOHO) +1.3 Compare physical interface and cabling types 1.3.a Single-mode fiber, multimode fiber, copper +1.3.b Connections (Ethernet shared media and point-to-point) + +1.0 Network Fundamentals +1.1 Explain the role and function of network components 1.1.a Routers +1.2 Describe characteristics of network topology architectures +1.2.d WAN + + +Part II: Implementing Ethernet LANs + + +Chapter 4: Using the Command-Line Interface +Chapter 5: Analyzing Ethernet LAN Switching + + +None + +1.0 Network Fundamentals +1.1 Explain the role and function of network components 1.1.b L2 and L3 switches +1.13 Describe switching concepts 1.13.a MAC learning and aging +1.13.b Frame switching R 1.13.c Frame flooding +1.13.d MAC address table 2.0 Network Access +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree Protocol and identify basic operations + +Chapter 6: Configuring 1.0 Network Fundamentals +Basic Switch Management 1.6 Configure and verify IPv4 addressing and subnetting +4.0 IP Services +4.6 Configure and verify DHCP client and relay +4.8 Configure network devices for remote access using SSH 5.0 Security Fundamentals +5.3 Configure device access control using local passwords + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +8 CCNA 200-301 Official Cert Guide, Volume 1 + + +Book Chapter +Chapter 7: Configuring and Verifying Switch Interfaces + +Exam Topics Covered +1.0 Network Fundamentals +1.1 Explain the role and function of network components 1.1.b L2 and L3 switches +1.4 Describe switching concepts + + +Part III: Implementing VLANs and STP + + +Chapter 8: Implementing Ethernet Virtual LANs + + + + + + + + + + + + + + + + + + +Chapter 9: Spanning Tree Protocol Concepts + + + + + + + + +Chapter 10: RSTP and EtherChannel Configuration + + +1.0 Network Fundamentals +1.13 Describe switching concepts 1.13.a MAC learning and aging 1.13.b Frame switching +1.13.c Frame flooding 1.13.d MAC address table +2.0 Network Access +2.1 Configure and verify VLANs (normal range) spanning multiple switches +2.1.a Access ports (data and voice) 2.1.b Default VLAN +2.1.c Connectivity +2.2 Configure and verify interswitch connectivity 2.2.a Trunk ports +2.2.b 802.1Q +2.2.c Native VLAN + +2.0 Network Access +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree Protocol and identify basic operations +2.5.a Root port, root bridge (primary/secondary), and other port names +2.5.b Port states (forwarding/blocking) 2.5.c PortFast benefits +2.0 Network Access +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree Protocol and identify basic operations +2.5.a Root port, root bridge (primary/secondary), and other port names +2.5.b Port states (forwarding/blocking) +2.5.c PortFast benefits + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix R: Exam Topics Cross Reference 9 + + +Book Chapter +Part IV: IPv4 Addressing + +Chapter 11: Perspectives on IPv4 Subnetting + + +Chapter 12: Analyzing Classful IPv4 Networks + +Chapter 13: Analyzing Subnet Masks + +Chapter 14: Analyzing Existing Subnets + +Part V: IPv4 Routing + +Chapter 15: Operating Cisco Routers + + + + + + +Chapter 16: Configuring IPv4 Addressing and Static Routes + +Exam Topics Covered + + +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting 1.7 Describe the need for private IPv4 addressing +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting + + +1.0 Network Fundamentals +1.1 Explain the role and function of network components 1.1.a Routers +1.2 Describe characteristics of network topology architectures 1.2.e Small office/home office (SOHO) +1.6 Configure and verify IPv4 addressing and subnetting + +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting 3.0 IP Connectivity +3.1 Interpret the components of routing table 3.1.a Routing protocol code +3.1.b Prefix +3.1.c Network mask 3.1.d Next hop +3.1.e Administrative distance 3.1.f Metric +3.1.g Gateway of last resort +3.2 Determine how a router makes a forwarding decision by default 3.2.a Longest match +3.2.b Administrative distance +3.3 Configure and verify IPv4 and IPv6 static routing 3.3.a Default route +3.3.b Network route 3.3.c Host route +3.3.d Floating static + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +R + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +10 CCNA 200-301 Official Cert Guide, Volume 1 + + +Book Chapter +Chapter 17: IP Routing in the LAN + + + +Chapter 18: Troubleshooting IPv4 Routing + + + + + + + +Part VI: OSPF +Chapter 19: Understanding OSPF Concepts + +Exam Topics Covered +1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting 2.0 Network Access +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) 1.0 Network Fundamentals +1.6 Configure and verify IPv4 addressing and subnetting 3.0 IP Connectivity +3.3 Configure and verify IPv4 and IPv6 static routing 3.3.a Default route +3.3.b Network route 3.3.c Host route 3.3.d Floating static + +3.0 IP Connectivity +3.2 Determine how a router makes a forwarding decision by default 3.2.b Administrative distance +3.2.c Routing protocol metric +3.4 Configure and verify single area OSPFv2 3.4.a Neighbor adjacencies +3.4.b Point-to-point +3.4.c Broadcast (DR/BR selection) +3.4.d (Router ID) + +Chapter 20: Implementing 3.0 IP Connectivity +OSPF 3.2 Determine how a router makes a forwarding decision by default + + + + + + + + + + +Chapter 21: OSPF Network Types and Neighbors + +3.2.b Administrative distance 3.2.c Routing protocol metric +3.4 Configure and verify single area OSPFv2 3.4.a Neighbor adjacencies +3.4.b Point-to-point +3.4.c Broadcast (DR/BR selection) 3.4.d (Router ID) +3.0 IP Connectivity +3.4 Configure and verify single area OSPFv2 3.4.a Neighbor adjacencies +3.4.b Point-to-point +3.4.c Broadcast (DR/BR selection) +3.4.d (Router ID) + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + +Appendix R: Exam Topics Cross Reference 11 + +Book Chapter Exam Topics Covered Part VII: IP Version 6 +Chapter 22: Fundamentals 1.0 Network Fundamentals +of IP Version 6 1.8 Configure and verify IPv6 addressing and prefix + + +Chapter 23: IPv6 Addressing and Subnetting + + +1.0 Network Fundamentals +1.8 Configure and verify IPv6 addressing and prefix 1.9 Compare and contrast IPv6 address types +1.9.a Global unicast +1.9.b Unique local + + +Chapter 24: Implementing 1.0 Network Fundamentals +IPv6 Addressing on 1.8 Configure and verify IPv6 addressing and prefix +Routers +1.9 Compare and contrast IPv6 address types 1.9.a Global unicast +1.9.b Unique local 1.9.c Link local 1.9.d Anycast 1.9.e Multicast +1.9.f Modified EUI 64 + +Chapter 25: Implementing 3.0 IP Connectivity +IPv6 Routing 3.3 Configure and verify IPv4 and IPv6 static routing +3.3.a Default route +3.3.b Network route +3.3.c Host route R +3.3.d Floating static + +Part VIII: Wireless LANs + +Chapter 26: Fundamentals 1.0 Network Fundamentals +of Wireless Networks 1.1 Explain the role and function of network components + + + + + + + +Chapter 27: Analyzing Cisco Wireless Architectures + +1.1.d Access Points +1.11 Describe wireless principles +1.11.a Nonoverlapping Wi-Fi Channels 1.11.b SSID +1.11.c RF + +2.0 Network Access +2.6 Compare Cisco Wireless Architectures and AP modes + + + + + + +|||||||||||||||||||| +|||||||||||||||||||| + + +12 CCNA 200-301 Official Cert Guide, Volume 1 + + +Book Chapter +Chapter 28: Securing Wireless Networks + + + + + +Chapter 29: Building a Wireless LAN + +Exam Topics Covered +1.0 Network Fundamentals +1.11 Describe wireless principles 1.11.d Encryption +5.0 Security Fundamentals +5.9 Describe wireless security protocols (WPA, WPA2, and WPA3) +2.0 Network Access +2.7 Describe physical infrastructure connections of WLAN components (AP, WLC, access/trunk ports, and LAG) +2.8 Describe AP and WLC management access connections (Telnet, SSH, HTTP, HTTPS, console, and TACACS+/RADIUS) +2.9 Configure the components of a wireless LAN access for client connectivity using GUI only such as WLAN creation, security settings, QoS profiles, and advanced WLAN settings +5.0 Security Fundamentals +5.10 Configure WLAN using WPA2 PSK using the GUI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +|||||||||||||||||||| Technet24 +|||||||||||||||||||| + + + + + + + + +Where are the companion content files? + + +Thank you for purchasing this Premium Edition version of +CCNA 200-301 Official Cert Guide, Volume 1 + + + + +This product comes with companion content. You have access to these files +by following the steps below: + + +Please note that many of our companion content files can be very +large, especially image and video files. + + + +1. Go to ciscopress.com/account +and log in. + + +If you are unable to locate the files for this +title by following the steps at left, please + + + +2. Click on the “Access Bonus Content” link in the Registered Products section of your account page for this product, to be taken to the page where your +downloadable content is available. + + +visit ciscopress.com/support +and select the chat, phone, or web ticket options to get help from a tech support +representative. + + + + + + + +The Professional and Personal Technology Brands of Pearson + + + + + + +|||||||||||||||||||| diff --git a/2. CCNA 200-301 Official Cert Guide, Volume 2 conv.txt b/2. CCNA 200-301 Official Cert Guide, Volume 2 conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..84a8be959a2f6bdf60be29a43a221804b516f8e1 --- /dev/null +++ b/2. CCNA 200-301 Official Cert Guide, Volume 2 conv.txt @@ -0,0 +1,27234 @@ + + +CCNA 200-301, Volume 2 Official Cert Guide + + +In addition to the wealth of updated content, this new edition includes a series of free hands-on exercises to help you master several real-world configuration activities. These exercises can be performed on the CCNA 200-301 Network Simulator Lite, Volume 2 software included for free on the companion website that accompanies this book. This software, which simulates the experience of working on actual Cisco routers and switches, contains the following 13 free lab exercises, covering ACL topics in Part I: +1. ACL I +2. ACL II +3. ACL III +4. ACL IV +5. ACL V +6. ACL VI +7. ACL Analysis I +8. Named ACL I +9. Named ACL II +10. Named ACL III +11. Standard ACL Configuration Scenario +12. Extended ACL I Configuration Scenario +13. Extended ACL II Configuration Scenario + +If you are interested in exploring more hands-on labs and practice configuration and trouble-shooting with more router and switch commands, go to www.pearsonitcertification.com/ networksimulator for demos and to review the latest products for sale. + + +CCNA 200-301 Network Simulator Lite, Volume 2 system requirements: + +Windows system requirements (minimum): +• Windows 10 (32/64-bit), Windows 8.1 (32/64-bit), or Windows 7 (32/64-bit) +• 1 gigahertz (GHz) or faster 32-bit (x86) or 64-bit (x64) processor +• 1 GB RAM (32-bit) or 2 GB RAM (64-bit) +• 16 GB available hard disk space (32-bit) or 20 GB (64-bit) +• DirectX 9 graphics device with WDDM 1.0 or higher driver +• Adobe Acrobat Reader version 8 and above + +Mac system requirements (minimum): • macOS 10.15, 10.14, 10.13, 10.12, or 10.11 • Intel core Duo 1.83 GHz +• 512 MB RAM (1 GB recommended) • 1.5 GB hard disk space +• 32-bit color depth at 1024 x 768 resolution +• Adobe Acrobat Reader version 8 and above + + + +CCNA +200-301 + + +Official Cert +Volume 2 + +Guide, + + +WENDELL ODOM, CCIE No. 1624 Emeritus + + + + + + + + + + + + + + + + + + + + + + + + + +Cisco Press +ii CCNA 200-301 Official Cert Guide, Volume 2 + +CCNA 200-301 Official Cert Guide, +Volume 2 Wendell Odom +Copyright © 2020 Pearson Education, Inc. + +Published by: Cisco Press + +All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval sys-tem, without written permission from the publisher, except for the inclusion of brief quotations in a review. +ScoutAutomatedPrintCode + +Library of Congress Control Number: 2019949625 + +ISBN-13: 978-1-58714-713-5 ISBN-10: 1-58714-713-0 + +Warning and Disclaimer +This book is designed to provide information about the Cisco CCNA 200-301 exam. Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. + +The information is provided on an “as is” basis. The authors, Cisco Press, and Cisco Systems, Inc. shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accom-pany it. + +The opinions expressed in this book belong to the author and are not necessarily those of Cisco Systems, Inc. + + +Trademark Acknowledgments +All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Cisco Press or Cisco Systems, Inc., cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. + +Microsoft and/or its respective suppliers make no representations about the suitability of the information contained in the documents and related graphics published as part of the services for any purpose. All such documents and related graphics are provided “as is” without warranty of any kind. Microsoft and/ or its respective suppliers hereby disclaim all warranties and conditions with regard to this information, including all warranties and conditions of merchantability, whether express, implied or statutory, fitness for a particular purpose, title and non-infringement. In no event shall Microsoft and/or its respective suppliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of information available from the services. + +The documents and related graphics contained herein could include technical inaccuracies or typographi-cal errors. Changes are periodically added to the information herein. Microsoft and/or its respective sup-pliers may make improvements and/or changes in the product(s) and/or the program(s) described herein at any time. Partial screenshots may be viewed in full within the software version specified. + +Microsoft® and Windows® are registered trademarks of the Microsoft Corporation in the U.S.A. and other countries. Screenshots and icons reprinted with permission from the Microsoft Corporation. This book is not sponsored or endorsed by or affiliated with the Microsoft Corporation. +iii + +Special Sales +For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@pearsoned.com or (800) 382-3419. + +For government sales inquiries, please contact governmentsales@pearsoned.com. + +For questions about sales outside the U.S., please contact intlcs@pearson.com. + + +Feedback Information +At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community. + +Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve the quality of this book, or otherwise alter it to better suit your needs, you can contact us through email at feedback@ciscopress.com. Please make sure to include the book title and ISBN in your message. + + +We greatly appreciate your assistance. + +Editor-in-Chief: Mark Taub + +Business Operation Manager, Cisco Press: Ronald Fligge + +Director, ITP Product Management: Brett Bartow + +Managing Editor: Sandra Schroeder + +Development Editor: Christopher Cleveland + +Senior Project Editor: Tonya Simpson + +Copy Editor: Chuck Hutchinson + + +Technical Editor: Elan Beer + +Editorial Assistant: Cindy Teeters + +Cover Designer: Chuti Prasertsith + +Composition: Tricia Bronkella + +Indexer: Ken Johnson + +Proofreader: Debbie Williams +iv CCNA 200-301 Official Cert Guide, Volume 2 + +About the Author + +Wendell Odom, CCIE No. 1624 Emeritus, has been in the networking industry since 1981. He has worked as a network engineer, consultant, systems engineer, instructor, and course developer; he currently works writing and creating certification study tools. This book is his 29th edition of some product for Pearson, and he is the author of all editions of the CCNA Cert Guides about Routing and Switching from Cisco Press. He has written books about topics from networking basics, certification guides throughout the years +for CCENT, CCNA R&S, CCNA DC, CCNP ROUTE, CCNP QoS, and CCIE R&S. He maintains study tools, links to his blogs, and other resources at www.certskills.com. +v + +About the Contributing Author + +David Hucaby, CCIE No. 4594, CWNE No. 292, is a network engineer for University of Kentucky Healthcare. He has been authoring Cisco Press titles for 20 years, with a focus on wireless and LAN switching topics. David has bachelor of science and master of sci-ence degrees in electrical engineering. He lives in Kentucky with his wife, Marci, and two daughters. + +About the Technical Reviewer + +Elan Beer, CCIE No. 1837, is a senior consultant and Cisco instructor specializing in data center architecture and multiprotocol network design. For the past 27 years, Elan has designed networks and trained thousands of industry experts in data center archi-tecture, routing, and switching. Elan has been instrumental in large-scale professional service efforts designing and troubleshooting internetworks, performing data center and network audits, and assisting clients with their short- and long-term design objectives. Elan has a global perspective of network architectures via his international clientele. Elan has used his expertise to design and troubleshoot data centers and internetworks in Malaysia, North America, Europe, Australia, Africa, China, and the Middle East. Most recently, Elan has been focused on data center design, configuration, and troubleshoot-ing as well as service provider technologies. In 1993, Elan was among the first to obtain the Cisco Certified System Instructor (CCSI) certification, and in 1996, he was among the first to attain the Cisco System highest technical certification, the Cisco Certified Internetworking Expert. Since then, Elan has been involved in numerous large-scale data center and telecommunications networking projects worldwide. +vi CCNA 200-301 Official Cert Guide, Volume 2 + +Acknowledgments +Brett Bartow continues to be the backbone of the Cisco Press brand, guiding the entire author team through the big transition in 2019–2020 with all the changes Cisco introduced to its certifications. Simply the best! Thanks for all you do, Brett! + +Dave Hucaby teamed up again to write this book, contributing one chapter here to go along with his four chapters in the CCNA Volume 1 book. It’s such a joy to review his work and see such polished material from the first draft. It’s been a joy to work with such a consummate professional—thanks, Dave! + +Chris Cleveland developed the book—again—and made it much better—again—and did it with more juggling than ever before, I think. Five months, roughly 50 technology chapters and another 50 other book elements, and countless online elements, all done with apparent ease. Kudos to Chris, yet again! + +I so look forward to reading Elan Beer’s tech edits of the chapters. That may seem strange to hear, but Elan has truly amazing technical editing skills. His insights range from the details of technology, to the mind of the new learner, to wording and clarity, to holes in networking logic as compared to the word-ing, to tiny typos that impact the meaning. Thanks again Elan for improving the chapters so much! + +Tonya Simpson managed this book, along with the CCNA Volume 1 book, all in that same compressed timeframe again. As usual, on both projects, Tonya has kept the production processes rolling along and getting through the idiosyncrasies of the content. Thanks for shepherding the book through the wild again, Tonya! + +As always, thanks to the production team that works with Tonya. From fixing all my grammar and passive-voice sentences to pulling the design and layout together, they do it all; thanks for putting it all together and making it look easy. And Tonya got to juggle two books of mine at the same time (again)— thanks for managing the whole production process again. + +Mike Tanamachi, illustrator and mind reader, did a great job on the figures again. Mike came through again with some beautiful finished products. Thanks again, Mike. + +I could not have made the timeline for this book without Chris Burns of Certskills Professional. Chris owns much of the PTP question support and administration process, works on the labs we put on my blog, and then catches anything I need to toss over my shoulder so I can focus on the books. Chris, you are the man! + +A special thank you to you readers who write in with suggestions and possible errors, and especially those of you who post online at the Cisco Learning Network and at my blog (https://blog.certskills.com). Without question, the comments I receive directly and overhear by participating at CLN made this edi-tion a better book. + +Thanks to my wonderful wife, Kris, who helps make this sometimes challenging work lifestyle a breeze. I love walking this journey with you, doll. Thanks to my daughter Hannah, who actually helped a bit with the book this summer before heading off to college (go Jackets!). And thanks to Jesus Christ, Lord of everything in my life. +vii + +Contents at a Glance + +Introduction xxvii + +Part I IP Access Control Lists 3 + +Chapter 1 Introduction to TCP/IP Transport and Applications 4 + +Chapter 2 Basic IPv4 Access Control Lists 24 + +Chapter 3 Advanced IPv4 Access Control Lists 44 + +Part I Review 64 + +Part II Security Services 67 Chapter 4 Security Architectures 68 +Chapter 5 Securing Network Devices 86 + +Chapter 6 Implementing Switch Port Security 106 + +Chapter 7 Implementing DHCP 122 + +Chapter 8 DHCP Snooping and ARP Inspection 144 + +Part II Review 168 + +Part III IP Services 171 + +Chapter 9 Device Management Protocols 172 + +Chapter 10 Network Address Translation 202 + +Chapter 11 Quality of Service (QoS) 226 + +Chapter 12 Miscellaneous IP Services 254 + +Part III Review 284 + +Part IV Network Architecture 287 Chapter 13 LAN Architecture 288 +Chapter 14 WAN Architecture 302 + +Chapter 15 Cloud Architecture 328 + +Part IV Review 352 + +Part V Network Automation 355 + +Chapter 16 Introduction to Controller-Based Networking 356 + +Chapter 17 Cisco Software-Defined Access (SDA) 382 +viii CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter 18 Understanding REST and JSON 406 + +Chapter 19 Understanding Ansible, Puppet, and Chef 428 + +Part V Review 444 + +Part VI Final Review 447 Chapter 20 Final Review 448 +Part VII Appendixes 467 Appendix A Numeric Reference Tables 469 +Appendix B CCNA 200-301, Volume 2 Exam Updates 476 + +Appendix C Answers to the “Do I Know This Already?” Quizzes 478 + +Glossary 494 + +Index 530 + +Online Appendixes + + +Appendix D + +Appendix E + +Appendix F + +Appendix G + +Topics from Previous Editions + +Practice for Chapter 2: Basic IPv4 Access Control Lists + +Previous Edition ICND1 Chapter 35: Managing IOS Files + +Exam Topics Cross-Reference +ix + +Reader Services +To access additional content for this book, simply register your product. To start the registration process, go to www.ciscopress.com/register and log in or create an account*. Enter the product ISBN 9781587147135 and click Submit. After the process is complete, you will find any available bonus con-tent under Registered Products. + +*Be sure to check the box that you would like to hear from us to receive exclusive discounts on future editions of this product. +x CCNA 200-301 Official Cert Guide, Volume 2 + +Icons Used in This Book + + + + + +Access Point + + + + + +Router + + + + +Cable (Various) + + + + + +SDN Controller + +PC + + + + + +Switch + + + + +Serial Line + + + + + +vSwitch + +Laptop + + + + + +Layer 3 Switch + + + + +Virtual Circuit + + + + + +IPS + +Server + + + + +Hub + + + + + +Ethernet WAN + + + + + +ASA + + +IP Phone + + + + +Bridge + + + + + +Wireless + + + + + +Firewall + + + + + + +Network Cloud Cable Modem DSLAM + +Command Syntax Conventions +The conventions used to present command syntax in this book are the same conventions used in the IOS Command Reference. The Command Reference describes these conventions as follows: + +■ Boldface indicates commands and keywords that are entered literally as shown. In actual configuration examples and output (not general command syntax), boldface indicates commands that are manually input by the user (such as a show command). + +■ Italic indicates arguments for which you supply actual values. + +■ Vertical bars (|) separate alternative, mutually exclusive elements. + +■ Square brackets ([ ]) indicate an optional element. + +■ Braces ({ }) indicate a required choice. + +■ Braces within brackets ([{ }]) indicate a required choice within an optional ele-ment. +xi + +Contents + + +Introduction xxvii + +Part I IP Access Control Lists 3 + +Chapter 1 Introduction to TCP/IP Transport and Applications 4 + +“Do I Know This Already?” Quiz 4 +Foundation Topics 6 +TCP/IP Layer 4 Protocols: TCP and UDP 6 +Transmission Control Protocol 7 +Multiplexing Using TCP Port Numbers 7 +Popular TCP/IP Applications 10 +Connection Establishment and Termination 12 +Error Recovery and Reliability 13 +Flow Control Using Windowing 15 +User Datagram Protocol 16 +TCP/IP Applications 16 +Uniform Resource Identifiers 17 +Finding the Web Server Using DNS 18 +Transferring Files with HTTP 20 +How the Receiving Host Identifies the Correct Receiving Application 21 +Chapter Review 22 + +Chapter 2 Basic IPv4 Access Control Lists 24 + +“Do I Know This Already?” Quiz 24 +Foundation Topics 26 +IPv4 Access Control List Basics 26 +ACL Location and Direction 26 +Matching Packets 27 +Taking Action When a Match Occurs 28 +Types of IP ACLs 28 +xii CCNA 200-301 Official Cert Guide, Volume 2 + +Standard Numbered IPv4 ACLs 29 +List Logic with IP ACLs 29 +Matching Logic and Command Syntax 31 +Matching the Exact IP Address 31 +Matching a Subset of the Address with Wildcards 31 +Binary Wildcard Masks 33 +Finding the Right Wildcard Mask to Match a Subnet 33 +Matching Any/All Addresses 34 +Implementing Standard IP ACLs 34 +Standard Numbered ACL Example 1 35 +Standard Numbered ACL Example 2 36 +Troubleshooting and Verification Tips 38 +Practice Applying Standard IP ACLs 39 +Practice Building access-list Commands 39 +Reverse Engineering from ACL to Address Range 40 +Chapter Review 41 + +Chapter 3 Advanced IPv4 Access Control Lists 44 + +“Do I Know This Already?” Quiz 44 +Foundation Topics 46 +Extended Numbered IP Access Control Lists 46 +Matching the Protocol, Source IP, and Destination IP 46 +Matching TCP and UDP Port Numbers 48 +Extended IP ACL Configuration 51 +Extended IP Access Lists: Example 1 51 +Extended IP Access Lists: Example 2 53 +Practice Building access-list Commands 54 +Named ACLs and ACL Editing 54 +Named IP Access Lists 54 +Editing ACLs Using Sequence Numbers 56 +Numbered ACL Configuration Versus Named ACL Configuration 58 +ACL Implementation Considerations 59 +Additional Reading on ACLs 60 +Chapter Review 61 + +Part I Review 64 +xiii + +Part II Security Services 67 + +Chapter 4 Security Architectures 68 + +“Do I Know This Already?” Quiz 68 +Foundation Topics 70 +Security Terminology 70 +Common Security Threats 72 +Attacks That Spoof Addresses 72 +Denial-of-Service Attacks 73 +Reflection and Amplification Attacks 75 +Man-in-the-Middle Attacks 76 +Address Spoofing Attack Summary 77 +Reconnaissance Attacks 77 +Buffer Overflow Attacks 78 +Malware 78 +Human Vulnerabilities 79 +Password Vulnerabilities 80 +Password Alternatives 80 +Controlling and Monitoring User Access 82 +Developing a Security Program to Educate Users 83 +Chapter Review 84 + +Chapter 5 Securing Network Devices 86 + +“Do I Know This Already?” Quiz 86 +Foundation Topics 88 +Securing IOS Passwords 88 +Encrypting Older IOS Passwords with service password-encryp-tion 89 +Encoding the Enable Passwords with Hashes 90 +Interactions Between Enable Password and Enable Secret 90 +Making the Enable Secret Truly Secret with a Hash 91 +Improved Hashes for Cisco’s Enable Secret 92 +Encoding the Passwords for Local Usernames 94 +Controlling Password Attacks with ACLs 95 +xiv CCNA 200-301 Official Cert Guide, Volume 2 + +Firewalls and Intrusion Prevention Systems 95 +Traditional Firewalls 96 +Security Zones 97 +Intrusion Prevention Systems (IPS) 99 +Cisco Next-Generation Firewalls 100 +Cisco Next-Generation IPS 102 +Chapter Review 103 + +Chapter 6 Implementing Switch Port Security 106 + +“Do I Know This Already?” Quiz 106 +Foundation Topics 108 +Port Security Concepts and Configuration 108 +Configuring Port Security 109 +Verifying Port Security 112 +Port Security MAC Addresses 113 +Port Security Violation Modes 114 +Port Security Shutdown Mode 115 +Port Security Protect and Restrict Modes 117 +Chapter Review 119 + +Chapter 7 Implementing DHCP 122 + +“Do I Know This Already?” Quiz 122 +Foundation Topics 124 +Dynamic Host Configuration Protocol 124 +DHCP Concepts 125 +Supporting DHCP for Remote Subnets with DHCP Relay 126 +Information Stored at the DHCP Server 128 +Configuring DHCP Features on Routers and Switches 129 +Configuring DHCP Relay 130 +Configuring a Switch as DHCP Client 130 +Configuring a Router as DHCP Client 132 +Identifying Host IPv4 Settings 133 +Host Settings for IPv4 133 +Host IP Settings on Windows 134 +xv + +Host IP Settings on macOS 136 +Host IP Settings on Linux 138 +Chapter Review 140 + +Chapter 8 DHCP Snooping and ARP Inspection 144 + +“Do I Know This Already?” Quiz 144 +Foundation Topics 146 +DHCP Snooping 146 +DHCP Snooping Concepts 146 +A Sample Attack: A Spurious DHCP Server 147 +DHCP Snooping Logic 148 +Filtering DISCOVER Messages Based on MAC Address 150 +Filtering Messages that Release IP Addresses 150 +DHCP Snooping Configuration 152 +Configuring DHCP Snooping on a Layer 2 Switch 152 +Limiting DHCP Message Rates 154 +DHCP Snooping Configuration Summary 155 +Dynamic ARP Inspection 156 +DAI Concepts 156 +Review of Normal IP ARP 156 +Gratuitous ARP as an Attack Vector 157 +Dynamic ARP Inspection Logic 158 +Dynamic ARP Inspection Configuration 160 +Configuring ARP Inspection on a Layer 2 Switch 160 +Limiting DAI Message Rates 163 +Configuring Optional DAI Message Checks 164 +IP ARP Inspection Configuration Summary 165 +Chapter Review 166 + +Part II Review 168 +xvi CCNA 200-301 Official Cert Guide, Volume 2 + +Part III IP Services 171 + +Chapter 9 Device Management Protocols 172 + +“Do I Know This Already?” Quiz 172 +Foundation Topics 174 +System Message Logging (Syslog) 174 +Sending Messages in Real Time to Current Users 174 +Storing Log Messages for Later Review 175 +Log Message Format 176 +Log Message Severity Levels 177 +Configuring and Verifying System Logging 178 +The debug Command and Log Messages 180 +Network Time Protocol (NTP) 181 +Setting the Time and Timezone 182 +Basic NTP Configuration 183 +NTP Reference Clock and Stratum 185 +Redundant NTP Configuration 186 +NTP Using a Loopback Interface for Better Availability 188 +Analyzing Topology Using CDP and LLDP 190 +Examining Information Learned by CDP 190 +Configuring and Verifying CDP 193 +Examining Information Learned by LLDP 194 +Configuring and Verifying LLDP 197 +Chapter Review 199 + +Chapter 10 Network Address Translation 202 + +“Do I Know This Already?” Quiz 202 +Foundation Topics 204 +Perspectives on IPv4 Address Scalability 204 +CIDR 205 +Private Addressing 206 +Network Address Translation Concepts 207 +Static NAT 208 +Dynamic NAT 210 +Overloading NAT with Port Address Translation 211 +xvii + +NAT Configuration and Troubleshooting 213 +Static NAT Configuration 213 +Dynamic NAT Configuration 215 +Dynamic NAT Verification 217 +NAT Overload (PAT) Configuration 219 +NAT Troubleshooting 222 +Chapter Review 223 + +Chapter 11 Quality of Service (QoS) 226 + +“Do I Know This Already?” Quiz 226 +Foundation Topics 228 +Introduction to QoS 228 +QoS: Managing Bandwidth, Delay, Jitter, and Loss 228 +Types of Traffic 229 +Data Applications 229 +Voice and Video Applications 230 +QoS as Mentioned in This Book 232 +QoS on Switches and Routers 233 +Classification and Marking 233 +Classification Basics 233 +Matching (Classification) Basics 234 +Classification on Routers with ACLs and NBAR 235 +Marking IP DSCP and Ethernet CoS 236 +Marking the IP Header 237 +Marking the Ethernet 802.1Q Header 237 +Other Marking Fields 238 +Defining Trust Boundaries 238 +DiffServ Suggested Marking Values 239 +Expedited Forwarding (EF) 240 +Assured Forwarding (AF) 240 +Class Selector (CS) 241 +Guidelines for DSCP Marking Values 241 +xviii CCNA 200-301 Official Cert Guide, Volume 2 + +Queuing 242 +Round-Robin Scheduling (Prioritization) 243 +Low Latency Queuing 243 +A Prioritization Strategy for Data, Voice, and Video 245 +Shaping and Policing 245 +Policing 246 +Where to Use Policing 246 +Shaping 248 +Setting a Good Shaping Time Interval for Voice and Video 249 +Congestion Avoidance 250 +TCP Windowing Basics 250 +Congestion Avoidance Tools 251 +Chapter Review 252 + +Chapter 12 Miscellaneous IP Services 254 + +“Do I Know This Already?” Quiz 254 +Foundation Topics 256 +First Hop Redundancy Protocol 256 +The Need for Redundancy in Networks 257 +The Need for a First Hop Redundancy Protocol 259 +The Three Solutions for First-Hop Redundancy 260 +HSRP Concepts 261 +HSRP Failover 261 +HSRP Load Balancing 262 +Simple Network Management Protocol 263 +SNMP Variable Reading and Writing: SNMP Get and Set 264 +SNMP Notifications: Traps and Informs 265 +The Management Information Base 266 +Securing SNMP 267 +FTP and TFTP 268 +Managing Cisco IOS Images with FTP/TFTP 268 +The IOS File System 268 +Upgrading IOS Images 270 +Copying a New IOS Image to a Local IOS File System Using TFTP 271 +xix + +Verifying IOS Code Integrity with MD5 273 +Copying Images with FTP 273 +The FTP and TFTP Protocols 275 +FTP Protocol Basics 275 +FTP Active and Passive Modes 276 +FTP over TLS (FTP Secure) 278 +TFTP Protocol Basics 279 +Chapter Review 280 + +Part III Review 284 + +Part IV Network Architecture 287 + +Chapter 13 LAN Architecture 288 + +“Do I Know This Already?” Quiz 288 +Foundation Topics 290 +Analyzing Campus LAN Topologies 290 +Two-Tier Campus Design (Collapsed Core) 290 +The Two-Tier Campus Design 290 +Topology Terminology Seen Within a Two-Tier Design 291 +Three-Tier Campus Design (Core) 293 +Topology Design Terminology 295 +Small Office/Home Office 295 +Power over Ethernet (PoE) 297 +PoE Basics 297 +PoE Operation 298 +PoE and LAN Design 299 +Chapter Review 300 + +Chapter 14 WAN Architecture 302 +“Do I Know This Already?” Quiz 302 Foundation Topics 304 +Metro Ethernet 304 +Metro Ethernet Physical Design and Topology 305 Ethernet WAN Services and Topologies 306 +Ethernet Line Service (Point-to-Point) 307 Ethernet LAN Service (Full Mesh) 308 Ethernet Tree Service (Hub and Spoke) 309 +xx CCNA 200-301 Official Cert Guide, Volume 2 + +Layer 3 Design Using Metro Ethernet 309 +Layer 3 Design with E-Line Service 309 +Layer 3 Design with E-LAN Service 311 +Multiprotocol Label Switching (MPLS) 311 +MPLS VPN Physical Design and Topology 313 +MPLS and Quality of Service 314 +Layer 3 with MPLS VPN 315 +Internet VPNs 317 +Internet Access 317 +Digital Subscriber Line 318 +Cable Internet 319 +Wireless WAN (3G, 4G, LTE, 5G) 320 +Fiber (Ethernet) Internet Access 321 +Internet VPN Fundamentals 321 +Site-to-Site VPNs with IPsec 322 +Remote Access VPNs with TLS 324 +VPN Comparisons 326 +Chapter Review 326 + +Chapter 15 Cloud Architecture 328 + +“Do I Know This Already?” Quiz 328 +Foundation Topics 330 +Server Virtualization 330 +Cisco Server Hardware 330 +Server Virtualization Basics 331 +Networking with Virtual Switches on a Virtualized Host 333 +The Physical Data Center Network 334 +Workflow with a Virtualized Data Center 335 +Cloud Computing Services 336 +Private Cloud (On-Premise) 337 +Public Cloud 338 +xxi + +Cloud and the “As a Service” Model 339 +Infrastructure as a Service 339 +Software as a Service 341 +(Development) Platform as a Service 341 +WAN Traffic Paths to Reach Cloud Services 342 +Enterprise WAN Connections to Public Cloud 342 +Accessing Public Cloud Services Using the Internet 342 +Pros and Cons with Connecting to Public Cloud with Internet 343 +Private WAN and Internet VPN Access to Public Cloud 344 +Pros and Cons of Connecting to Cloud with Private WANs 345 +Intercloud Exchanges 346 +Summarizing the Pros and Cons of Public Cloud WAN Options 346 +A Scenario: Branch Offices and the Public Cloud 347 +Migrating Traffic Flows When Migrating to Email SaaS 347 +Branch Offices with Internet and Private WAN 349 +Chapter Review 350 + +Part IV Review 352 + +Part V Network Automation 355 + +Chapter 16 Introduction to Controller-Based Networking 356 + +“Do I Know This Already?” Quiz 357 +Foundation Topics 358 +SDN and Controller-Based Networks 358 +The Data, Control, and Management Planes 358 +The Data Plane 359 +The Control Plane 360 +The Management Plane 361 +Cisco Switch Data Plane Internals 361 +Controllers and Software-Defined Architecture 362 +Controllers and Centralized Control 363 +The Southbound Interface 364 +The Northbound Interface 365 +xxii CCNA 200-301 Official Cert Guide, Volume 2 + +Software Defined Architecture Summary 367 +Examples of Network Programmability and SDN 367 +OpenDaylight and OpenFlow 367 +The OpenDaylight Controller 368 +The Cisco Open SDN Controller (OSC) 369 +Cisco Application Centric Infrastructure (ACI) 369 +ACI Physical Design: Spine and Leaf 370 +ACI Operating Model with Intent-Based Networking 371 +Cisco APIC Enterprise Module 373 +APIC-EM Basics 373 +APIC-EM Replacement 374 +Summary of the SDN Examples 375 +Comparing Traditional Versus Controller-Based Networks 375 +How Automation Impacts Network Management 376 +Comparing Traditional Networks with Controller-Based Networks 378 +Chapter Review 379 + +Chapter 17 Cisco Software-Defined Access (SDA) 382 + +“Do I Know This Already?” Quiz 383 +Foundation Topics 384 +SDA Fabric, Underlay, and Overlay 384 +The SDA Underlay 386 +Using Existing Gear for the SDA Underlay 386 +Using New Gear for the SDA Underlay 387 +The SDA Overlay 390 +VXLAN Tunnels in the Overlay (Data Plane) 390 +LISP for Overlay Discovery and Location (Control Plane) 392 +DNA Center and SDA Operation 395 +Cisco DNA Center 395 +Cisco DNA Center and Scalable Groups 396 +Issues with Traditional IP-Based Security 397 +SDA Security Based on User Groups 398 +xxiii + +DNA Center as a Network Management Platform 400 +DNA Center Similarities to Traditional Management 401 +DNA Center Differences with Traditional Management 402 +Chapter Review 403 + +Chapter 18 Understanding REST and JSON 406 + +“Do I Know This Already?” Quiz 406 +Foundation Topics 408 +REST-Based APIs 408 +REST-Based (RESTful) APIs 408 +Client/Server Architecture 409 +Stateless Operation 410 +Cacheable (or Not) 410 +Background: Data and Variables 410 +Simple Variables 410 +List and Dictionary Variables 411 +REST APIs and HTTP 413 +Software CRUD Actions and HTTP Verbs 413 +Using URIs with HTTP to Specify the Resource 414 +Example of REST API Call to DNA Center 417 +Data Serialization and JSON 418 +The Need for a Data Model with APIs 419 +Data Serialization Languages 421 +JSON 421 +XML 421 +YAML 422 +Summary of Data Serialization 423 +Interpreting JSON 423 +Interpreting JSON Key:Value Pairs 423 +Interpreting JSON Objects and Arrays 424 +Minified and Beautified JSON 426 +Chapter Review 427 +xxiv CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter 19 Understanding Ansible, Puppet, and Chef 428 + +“Do I Know This Already?” Quiz 428 +Foundation Topics 430 +Device Configuration Challenges and Solutions 430 +Configuration Drift 430 +Centralized Configuration Files and Version Control 431 +Configuration Monitoring and Enforcement 433 +Configuration Provisioning 434 +Configuration Templates and Variables 435 +Files That Control Configuration Automation 437 +Ansible, Puppet, and Chef Basics 438 +Ansible 438 +Puppet 440 +Chef 441 +Summary of Configuration Management Tools 442 +Chapter Review 442 + +Part V Review 444 + + +Part VI + +Chapter 20 + +Final Review 447 + +Final Review 448 + + +Advice About the Exam Event 448 +Exam Event: Learn About Question Types 448 +Exam Event: Think About Your Time Budget 450 +Exam Event: A Sample Time-Check Method 451 +Exam Event: One Week Away 451 +Exam Event: 24 Hours Before the Exam 452 +Exam Event: The Last 30 Minutes 452 +Exam Event: Reserve the Hour After the Exam 453 +Exam Review 454 +Exam Review: Take Practice Exams 454 +Using the Practice CCNA Exams 455 +Exam Review: Advice on How to Answer Exam Questions 456 +Exam Review: Additional Exams with the Premium Edition 457 +xxv + +Exam Review: Find Knowledge Gaps 458 +Exam Review: Practice Hands-On CLI Skills 460 +CCNA Exam Topics with CLI Skill Requirements 460 +Exam Review: Self-Assessment Pitfalls 462 +Exam Review: Adjustments for Your Second Attempt 463 +Exam Review: Other Study Tasks 464 +Final Thoughts 464 + +Part VII Appendixes 467 + +Appendix A Numeric Reference Tables 469 + +Appendix B CCNA 200-301, Volume 2 Exam Updates 476 + +Appendix C Answers to the “Do I Know This Already?” Quizzes 478 + +Glossary 494 + +Index 530 + +Online Appendixes + +Appendix D Topics from Previous Editions + + +Appendix E + +Appendix F + +Practice for Chapter 2: Basic IPv4 Access Control Lists + +Previous Edition ICND1 Chapter 35: Managing IOS Files + + +Appendix G Exam Topics Cross-Reference + +Appendix H Study Planner + + + + + + + + +This page intentionally left blank +xxvii + +Introduction + +About Cisco Certifications and CCNA +Congratulations! If you’re reading far enough to look at this book’s Introduction, you’ve probably already decided to go for your Cisco certification, and the CCNA certification is the one place to begin that journey. If you want to succeed as a technical person in the networking industry at all, you need to know Cisco. Cisco has a ridiculously high market share in the router and switch marketplace, with more than 80 percent market share in some markets. In many geographies and markets around the world, networking equals Cisco. If you want to be taken seriously as a network engineer, Cisco certification makes perfect sense. + +NOTE This book discusses part of the content Cisco includes in the CCNA 200-301 exam, with the CCNA 200-301 Official Cert Guide, Volume 1, covering the rest. You will need both the Volume 1 and Volume 2 books to have all the content necessary for the exam. + +The first few pages of this Introduction explain the core features of the Cisco Career Certification program, of which the Cisco Certified Network Associate (CCNA) serves as the foundation for all the other certifications in the program. This section begins with a comparison of the old to the new certifications due to some huge program changes in 2019. It then gives the key features of CCNA, how to get it, and what’s on the exam. + +The Big Changes to Cisco Certifications in 2019 +Cisco announced sweeping changes to its career certification program around mid-year 2019. Because so many of you will have read and heard about the old versions of the CCNA certification, this Introduction begins with a few comparisons between the old and new CCNA as well as some of the other Cisco career certifications. + +First, consider the Cisco career certifications before 2019, as shown in Figure I-1. At that time, Cisco offered 10 separate CCNA certifications in different technology tracks. Cisco also had eight Professional-level (CCNP, or Cisco Certified Network Professional) certifications. +xxviii CCNA 200-301 Official Cert Guide, Volume 2 + + + +Collaboration Data Center Routing & Wireless Security Switching +CCIE + +Service Provider + + + + +Collaboration Data Center Routing & Wireless Switching + +Security Service Cloud Provider + +CCNP + + + +Collaboration Data Center Routing & Wireless Security Switching +CCNA + +Service Cloud Provider + + +Cyber Industrial Ops + + +Figure I-1 Old Cisco Certification Silo Concepts + +Why so many? Cisco began with one track—Routing and Switching—back in 1998. Over time, Cisco identified more and more technology areas that had grown to have enough content to justify another set of CCNA and CCNP certifications on those topics, so Cisco added more tracks. Many of those also grew to support expert-level topics with CCIE (Cisco Certified Internetwork Expert). + +In 2019, Cisco consolidated the tracks and moved the topics around quite a bit, as shown in Figure I-2. + +Collaboration Data Center Enterprise Security Service Provider + +CCIE + + +Collaboration Data Center Enterprise Security Service Provider + +CCNP + + + +CCNA + +Figure I-2 New Cisco Certification Tracks and Structure + +All the tracks now begin with the content in the one remaining CCNA certification. For CCNP, you now have a choice of five technology areas for your next steps, as shown in Figure I-2. (Note that Cisco replaced “Routing and Switching” with “Enterprise.”) +xxix + +Cisco made the following changes with the 2019 announcements: + +CCENT: Retired the only entry-level certification (CCENT, or Cisco Certified Entry Network Technician), with no replacement. +CCNA: Retired all the CCNA certifications except what was then known as “CCNA Routing and Switching,” which became simply “CCNA.” +CCNP: Consolidated the professional-level (CCNP) certifications to five tracks, includ-ing merging CCNP Routing and Switching and CCNP Wireless into CCNP Enterprise. +CCIE: Achieved better alignment with CCNP tracks through the consolidations. +Cisco needed to move many of the individual exam topics from one exam to another because of the number of changes. For instance, Cisco announced the retirement of all the associate certifications—nine CCNA certifications plus the CCDA (Design Associate) certification—but those technologies didn’t disappear! Cisco just moved the topics around +to different exams in different certifications. (Note that Cisco later announced that CCNA Cyber Ops would remain, and not be retired, with details to be announced.) + +Consider wireless LANs as an example. The 2019 announcements retired both CCNA Wireless and CCNP Wireless as certifications. Some of the old CCNA Wireless topics landed in the new CCNA, whereas others landed in the two CCNP Enterprise exams about wireless LANs. + +For those of you who want to learn more about the transition, check out my blog (https://blog.certskills.com) and look for posts in the News category from around June 2019. Now on to the details about CCNA as it exists starting in 2019! + +How to Get Your CCNA Certification +As you saw in Figure I-2, all career certification paths now begin with CCNA. So how do you get it? Today, you have one and only one option to achieve CCNA certification: + +Take and pass one exam: the Cisco 200-301 CCNA exam. +To take the 200-301 exam, or any Cisco exam, you will use the services of Pearson VUE (vue.com). The process works something like this: +1. Establish a login at https://home.pearsonvue.com/ (or use your existing login). + +2. Register for, schedule a time and place, and pay for the Cisco 200-301 exam, all from the VUE website. + +3. Take the exam at the VUE testing center. + +4. You will receive a notice of your score, and whether you passed, before you leave the testing center. + +Types of Questions on the CCNA 200-301 Exam +The Cisco CCNA and CCNP exams all follow the same general format, with these types of questions: + +■ Multiple-choice, single-answer + +■ Multiple-choice, multiple-answer +xxx CCNA 200-301 Official Cert Guide, Volume 2 + +■ Testlet (one scenario with multiple multiple-choice questions) + +■ Drag-and-drop + +■ Simulated lab (sim) + +■ Simlet + +Although the first four types of questions in the list should be somewhat familiar to you from other tests in school, the last two are more common to IT tests and Cisco exams +in particular. Both use a network simulator to ask questions so that you control and use simulated Cisco devices. In particular: + +Sim questions: You see a network topology and lab scenario, and can access the devic-es. Your job is to fix a problem with the configuration. +Simlet questions: This style combines sim and testlet question formats. As with a sim question, you see a network topology and lab scenario, and can access the devices. However, as with a testlet, you also see multiple multiple-choice questions. Instead of changing or fixing the configuration, you answer questions about the current state of the network. +These two question styles with the simulator give Cisco the ability to test your configu-ration skills with sim questions, and your verification and troubleshooting skills with simlet questions. + +Before taking the test, learn the exam user interface by watching some videos Cisco pro-vides about the interface. To find the videos, just go to www.cisco.com and search for “Cisco Certification Exam Tutorial Videos.” + +CCNA 200-301 Exam Content, Per Cisco +Ever since I was in grade school, whenever a teacher announced that we were having a test soon, someone would always ask, “What’s on the test?” We all want to know, and we all want to study what matters and avoid studying what doesn’t matter. + +Cisco tells the world the topics on each of its exams. Cisco wants the public to know the variety of topics and get an idea about the kinds of knowledge and skills required for each topic for every Cisco certification exam. To find the details, go to www.cisco.com/ go/certifications, look for the CCNA page, and navigate until you see the exam topics. + +This book also lists those same exam topics in several places. From one perspective, every chapter sets about to explain a small set of exam topics, so each chapter begins with the list of exam topics covered in that chapter. However, you might want to also see the exam topics in one place, so Appendix G, “Exam Topics Cross-Reference,” lists all the exam topics. You may want to download Appendix G in PDF form and keep it handy. The appendix lists the exam topics with two different cross-references: + +■ A list of exam topics and the chapter(s) that covers each topic + +■ A list of chapters and the exam topics covered in each chapter +xxxi + +Exam Topic Verbs and Depth +Reading and understanding the exam topics, especially deciding the depth of skills required for each exam topic, require some thought. Each exam topic mentions the name of some technology, but it also lists a verb that implies the depth to which you must master the topic. The primary exam topics each list one or more verbs that describe the skill level required. For example, consider the following exam topic: + +Configure and verify IPv4 addressing and subnetting +Note that this one exam topic has two verbs (configure and verify). Per this exam topic, you should be able to not only configure IPv4 addresses and subnets, but you also should understand them well enough to verify that the configuration works. In contrast, the following exam topic asks you to describe a technology but does not ask you to configure it: + +Describe the purpose of first hop redundancy protocol +The describe verb tells you to be ready to describe whatever a “first hop redundancy protocol” is. That exam topic also implies that you do not then need to be ready to con-figure or verify any first hop redundancy protocols (HSRP, VRRP, and GLBP). + +Finally, note that the configure and verify exam topics imply that you should be able to describe and explain and otherwise master the concepts so that you understand what you have configured. The earlier “Configure and verify IPv4 addressing and subnetting” does not mean that you should know how to type commands but have no clue as to what you configured. You must first master the conceptual exam topic verbs. The pro-gression runs something like this: + +Describe, Identify, Explain, Compare/Contrast, Configure, Verify, Troubleshoot +For instance, an exam topic that lists “compare and contrast” means that you should be able to describe, identify, and explain the technology. Also, an exam topic with “config-ure and verify” tells you to also be ready to describe, explain, and compare/contrast. + +The Context Surrounding the Exam Topics +Take a moment to navigate to www.cisco.com/go/certifications and find the list of exam topics for the CCNA 200-301 exam. Did your eyes go straight to the list of exam top-ics? Or did you take the time to read the paragraphs above the exam topics first? + +That list of exam topics for the CCNA 200-301 exam includes a little over 50 primary exam topics and about 50 more secondary exam topics. The primary topics have those verbs as just discussed, which tell you something about the depth of skill required. The secondary topics list only the names of more technologies to know. +xxxii CCNA 200-301 Official Cert Guide, Volume 2 + +However, the top of the web page that lists the exam topics also lists some important information that tells us some important facts about the exam topics. In particular, that leading text, found at the beginning of Cisco exam topic pages of most every exam, tells us these important points: + +■ The guidelines may change over time. + +■ The exam topics are general guidelines about what may be on the exam. + +■ The actual exam may include “other related topics.” + +Interpreting these three facts in order, I would not expect to see a change to the pub-lished list of exam topics for the exam. I’ve been writing the Cisco Press CCNA Cert Guides since Cisco announced CCNA back in 1998, and I’ve never seen Cisco change the official exam topics in the middle of an exam—not even to fix typos. But the intro-ductory words say that they might change the exam topics, so it’s worth checking. + +As for the second item in the preceding list, even before you know what the acronyms mean, you can see that the exam topics give you a general but not detailed idea about each topic. The exam topics do not attempt to clarify every nook and cranny or to list every command and parameter; however, this book serves as a great tool in that it acts as a much more detailed interpretation of the exam topics. We examine every exam topic, and if we think a concept or command is possibly within an exam topic, we put it into the book. So, the exam topics give us general guidance, and these books give us much more detailed guidance. + +The third item in the list uses literal wording that runs something like this: “However, other related topics may also appear on any specific delivery of the exam.” That one statement can be a bit jarring to test takers, but what does it really mean? Unpacking the statement, it says that such questions may appear on any one exam but may not; in other words, they don’t set about to ask every test taker some questions that include concepts not mentioned in the exam topics. Second, the phrase “…other related topics…” empha-sizes that any such questions would be related to some exam topic, rather than being far afield—a fact that helps us in how we respond to this particular program policy. + +For instance, the CCNA 200-301 exam includes configuring and verifying the OSPF routing protocol, but it does not mention the EIGRP routing protocol. I personally would be unsurprised to see an OSPF question that required a term or fact not specifi-cally mentioned in the exam topics, but not one that’s some feature that (in my opinion) ventures far away from the OSPF features in the exam topics. Also, I would not expect to see a question about how to configure and verify EIGRP. + +And just as one final side point, note that Cisco does on occasion ask a test taker some unscored questions, and those may appear to be in this vein of questions from outside topics. When you sit down to take the exam, the small print mentions that you may see unscored questions and you won’t know which ones are unscored. (These questions give Cisco a way to test possible new questions.) Yet some of these might be ones that fall into the “other related topics” category but then not affect your score. +xxxiii + +You should prepare a little differently for any Cisco exam, in comparison to, say, an exam back in school, in light of Cisco’s “other related questions” policy: + +■ Do not approach an exam topic with an “I’ll learn the core concepts and ignore the edges” approach. + +■ Instead, approach each exam topic with a “pick up all the points I can” approach by mastering each exam topic, both in breadth and in depth. + +■ Go beyond each exam topic when practicing configuration and verification by taking a little extra time to look for additional show commands and configuration options, and make sure you understand as much of the show command output that you can. + +By mastering the known topics, and looking for places to go a little deeper, you will hopefully pick up the most points you can from questions about the exam topics. Then the extra practice you do with commands may happen to help you learn beyond the exam topics in a way that can help you pick up other points as well. + +CCNA 200-301 Exam Content, Per This Book +When we created the Official Cert Guide content for the CCNA 200-301 exam, we considered a few options for how to package the content, and we landed on releasing a two-book set. Figure I-3 shows the setup of the content, with roughly 60 percent of the content in Volume 1 and the rest in Volume 2. + + + +Fundamentals Ethernet LANs IPv4 Routing IPv6 Routing Wireless LANs + +Vol. 1 - 60% + + +Security +IP Services Automation Architecture +Vol. 2 - 40% + +Figure I-3 Two Books for CCNA 200-301 + +The two books together cover all the exam topics in the CCNA 200-301 exam. Each chapter in each book develops the concepts and commands related to an exam topic, with clear and detailed explanations, frequent figures, and many examples that build your understanding of how Cisco networks work. + +As for choosing what content to put into the books, note that we begin and finish with Cisco’s exam topics, but with an eye toward predicting as many of the “other related topics” as we can. We start with the list of exam topics and apply a fair amount of expe-rience, discussion, and other secret sauce to come up with an interpretation of what specific concepts and commands are worthy of being in the books or not. At the end +of the writing process, the books should cover all the published exam topics, with addi-tional depth and breadth that I choose based on the analysis of the exam. As we have done from the very first edition of the CCNA Official Cert Guide, we intend to cover each and every topic in depth. But as you would expect, we cannot predict every single fact on the exam given the nature of the exam policies, but we do our best to cover all known topics. +xxxiv CCNA 200-301 Official Cert Guide, Volume 2 + +Book Features +This book includes many study features beyond the core explanations and examples in each chapter. This section acts as a reference to the various features in the book. + +Chapter Features and How to Use Each Chapter +Each chapter of this book is a self-contained short course about one small topic area, organized for reading and study, as follows: + +“Do I Know This Already?” quizzes: Each chapter begins with a pre-chapter quiz. Foundation Topics: This is the heading for the core content section of the chapter. +Chapter Review: This section includes a list of study tasks useful to help you remem-ber concepts, connect ideas, and practice skills-based content in the chapter. +Figure I-4 shows how each chapter uses these three key elements. You start with the DIKTA quiz. You can use the score to determine whether you already know a lot, or not so much, and determine how to approach reading the Foundation Topics (that is, the technology content in the chapter). When finished, use the Chapter Review tasks to start working on mastering your memory of the facts and skills with configuration, verifica-tion, and troubleshooting. + +DIKTA Quiz Foundation Topics Chapter Review + + +High Score Take Quiz +Low Score + + +(Skim) Foundation Topics +(Read) Foundation Topics + + +1) In-Chapter, or... +2) Companion Website + + +Figure I-4 Three Primary Tasks for a First Pass Through Each Chapter + +In addition to these three main chapter features, each “Chapter Review” section uses a variety of other book features, including the following: + +■ Review Key Topics: Inside the “Foundation Topics” section, the Key Topic icon appears next to the most important items, for the purpose of later review and mas-tery. While all content matters, some is, of course, more important to learn, or needs more review to master, so these items are noted as key topics. The Chapter Review lists the key topics in a table. Scan the chapter for these items to review them. Or review the key topics interactively using the companion website. + +■ Complete Tables from Memory: Instead of just rereading an important table of information, you will find some tables have been turned into memory tables, an interactive exercise found on the companion website. Memory tables repeat the table but with parts of the table removed. You can then fill in the table to exercise your memory and click to check your work. + +■ Key Terms You Should Know: You do not need to be able to write a formal defini-tion of all terms from scratch; however, you do need to understand each term well enough to understand exam questions and answers. The Chapter Review lists the key terminology from the chapter. Make sure you have a good understanding of each term and use the Glossary to cross-check your own mental definitions. You can also review key terms with the “Key Terms Flashcards” app on the companion website. +xxxv + +■ Labs: Many exam topics use verbs such as configure and verify; all these refer to skills you should practice at the user interface (CLI) of a router or switch. The +Chapter and Part Reviews refer you to these other tools. The upcoming section titled “About Building Hands-On Skills” discusses your options. + +■ Command References: Some book chapters cover a large number of router and switch commands. The Chapter Review includes reference tables for the commands used in that chapter, along with an explanation. Use these tables for reference, but also use them for study. Just cover one column of the table and see how much you can remember and complete mentally. + +■ Review DIKTA Questions: Although you have already seen the DIKTA questions from the chapters, re-answering those questions can prove a useful way to review facts. The Part Review suggests that you repeat the DIKTA questions but using the Pearson Test Prep (PTP) exam. + +Part Features and How to Use the Part Review +The book organizes the chapters into parts for the purpose of helping you study for the exam. Each part groups a small number of related chapters together. Then the study +process (described just before Chapter 1) suggests that you pause after each part to do a review of all chapters in the part. Figure I-5 lists the titles of the eight parts and the chap-ters in those parts (by chapter number) for this book. + +5 Network Automation (16-19) + +4 Network Architecture (13-15) + +3 IP Services (9-12) + + +1 IP Access Control Lists (1-3) + +2 Security Services (4-8) + + +Figure I-5 The Book Parts (by Title), and Chapter Numbers in Each Part + +The Part Review that ends each part acts as a tool to help you with spaced review ses-sions. Spaced reviews—that is, reviewing content several times over the course of your study—help improve retention. The Part Review activities include many of the same kinds of activities seen in the Chapter Review. Avoid skipping the Part Review, and take the time to do the review; it will help you in the long run. + +The Companion Website for Online Content Review +We created an electronic version of every Chapter and Part Review task that could be improved though an interactive version of the tool. For instance, you can take a “Do I Know This Already?” quiz by reading the pages of the book, but you can also use our testing software. As another example, when you want to review the key topics from a chapter, you can find all those in electronic form as well. +xxxvi CCNA 200-301 Official Cert Guide, Volume 2 + +All the electronic review elements, as well as other electronic components of the book, exist on this book’s companion website. The companion website gives you a big advan-tage: you can do most of your Chapter and Part Review work from anywhere using the interactive tools on the site. The advantages include + +■ Easier to use: Instead of having to print out copies of the appendixes and do the work on paper, you can use these new apps, which provide you with an easy-to-use, interactive experience that you can easily run over and over. + +■ Convenient: When you have a spare 5–10 minutes, go to the book’s website and review content from one of your recently finished chapters. + +■ Untethered from the book: You can access your review activities from anywhere— no need to have the book with you. + +■ Good for tactile learners: Sometimes looking at a static page after reading a chapter lets your mind wander. Tactile learners might do better by at least typing answers into an app, or clicking inside an app to navigate, to help keep you focused on the activity. + +The interactive Chapter Review elements should improve your chances of passing as well. Our in-depth reader surveys over the years show that those who do the Chapter and Part Reviews learn more. Those who use the interactive versions of the review ele-ments also tend to do more of the Chapter and Part Review work. So take advantage of the tools and maybe you will be more successful as well. Table I-1 summarizes these interactive applications and the traditional book features that cover the same content. + +Table I-1 Book Features with Both Traditional and App Options + + +Feature Key Topic +Config Checklist + +Key Terms + +Traditional +Table with list; flip pages to find + +Just one of many types of key topics + +Listed in each “Chapter Review” section, with the Glossary in the back of the book + +App +Key Topics Table app + +Config Checklist app + +Glossary Flash Cards app + + + +The companion website also includes links to download, navigate, or stream for these types of content: + +■ Pearson Sim Lite Desktop App + +■ Pearson Test Prep (PTP) Desktop App + +■ Pearson Test Prep (PTP) Web App + +■ Videos as mentioned in book chapters +xxxvii + +How to Access the Companion Website +To access the companion website, which gives you access to the electronic content with this book, start by establishing a login at www.ciscopress.com and register your book. To do so, simply go to www.ciscopress.com/register and enter the ISBN of the print book: 9781587147135. After you have registered your book, go to your account page and click the Registered Products tab. From there, click the Access Bonus Content link to get access to the book’s companion website. + +Note that if you buy the Premium Edition eBook and Practice Test version of this book from Cisco Press, your book will automatically be registered on your account page. Simply go to your account page, click the Registered Products tab, and select Access Bonus Content to access the book’s companion website. + +How to Access the Pearson Test Prep (PTP) App +You have two options for installing and using the Pearson Test Prep application: a web app and a desktop app. + +To use the Pearson Test Prep application, start by finding the registration code that comes with the book. You can find the code in these ways: + +■ Print book: Look in the cardboard sleeve in the back of the book for a piece of paper with your book’s unique PTP code. + +■ Premium Edition: If you purchase the Premium Edition eBook and Practice Test directly from the Cisco Press website, the code will be populated on your account page after purchase. Just log in at www.ciscopress.com, click account to see details of your account, and click the digital purchases tab. + +■ Amazon Kindle: For those who purchase a Kindle edition from Amazon, the access code will be supplied directly from Amazon. + +■ Other bookseller e-books: Note that if you purchase an e-book version from any other source, the practice test is not included because other vendors to date have not chosen to vend the required unique access code. + + +NOTE Do not lose the activation code because it is the only means with which you can access the QA content with the book. + +Once you have the access code, to find instructions about both the PTP web app and the desktop app, follow these steps: +Step 1. Open this book’s companion website, as was shown earlier in this Introduction under the heading “How to Access the Companion Website.” + +Step 2. Click the Practice Exams button. + +Step 3. Follow the instructions listed there both for installing the desktop app and for using the web app. +xxxviii CCNA 200-301 Official Cert Guide, Volume 2 + +Note that if you want to use the web app only at this point, just navigate to www.pearsontestprep.com, establish a free login if you do not already have one, and register this book’s practice tests using the registration code you just found. The process should take only a couple of minutes. + +NOTE Amazon e-book (Kindle) customers: It is easy to miss Amazon’s email that lists your PTP access code. Soon after you purchase the Kindle e-book, Amazon should send an email. However, the email uses very generic text and makes no specific mention of PTP or practice exams. To find your code, read every email from Amazon after you purchase the book. Also, do the usual checks (such as checking your spam folder) for ensuring your email arrives. + + +NOTE Other e-book customers: As of the time of publication, only the publisher and Amazon supply PTP access codes when you purchase their e-book editions of this book. + + +Feature Reference +The following list provides an easy reference to get the basic idea behind each book feature: + +■ Practice exam: The book gives you the rights to the Pearson Test Prep (PTP) testing software, available as a web app and desktop app. Use the access code on a piece +of cardboard in the sleeve in the back of the book, and use the companion website to download the desktop app or navigate to the web app (or just go to www.pearsontestprep.com). + +■ E-book: Pearson offers an e-book version of this book that includes extra practice tests. If interested, look for the special offer on a coupon card inserted in the sleeve in the back of the book. This offer enables you to purchase the CCNA 200-301 Official Cert Guide, Volume 2, Premium Edition eBook and Practice Test at a 70 percent discount off the list price. The product includes three versions of the e-book: PDF (for reading on your computer), EPUB (for reading on your tablet, mobile device, or Nook or other e-reader), and Mobi (the native Kindle version). It also includes additional practice test questions and enhanced practice test features. + +■ Mentoring videos: The companion website also includes a number of videos about other topics as mentioned in individual chapters. + +■ CCNA 200-301 Network Simulator Lite: This lite version of the best-selling CCNA Network Simulator from Pearson provides you with a means, right now, to experi-ence the Cisco command-line interface (CLI). No need to go buy real gear or buy a full simulator to start learning the CLI. Just install it from the companion website. + +■ CCNA Simulator: If you are looking for more hands-on practice, you might want to consider purchasing the CCNA Network Simulator. You can purchase a copy of this software from Pearson at http://pearsonitcertification.com/networksimulator or other +xxxix + +retail outlets. To help you with your studies, Pearson has created a mapping guide that maps each of the labs in the simulator to the specific sections in each volume of the CCNA Cert Guide. You can get this mapping guide free on the Extras tab on the book product page: www.ciscopress.com/title/9781587147135. + +■ PearsonITCertification.com: The website www.pearsonitcertification.com is a great resource for all things IT-certification related. Check out the great CCNA articles, videos, blogs, and other certification preparation tools from the industry’s best authors and trainers. + +■ Author’s website and blogs: The author maintains a website that hosts tools and links useful when studying for CCNA. In particular, the site has a large number of free lab exercises about CCNA content, additional sample questions, and other exercises. Additionally, the site indexes all content so you can study based on the book chap-ters and parts. To find it, navigate to https://blog.certskills.com. + +Book Organization, Chapters, and Appendixes +The CCNA 200-301 Official Cert Guide, Volume 1, contains 29 chapters, while this book has 19 core chapters. Each chapter covers a subset of the topics on the CCNA exam. The book organizes its chapters into parts of three to five chapters as follows: + +■ Part I: IP Access Control Lists + +■ Chapter 1, “Introduction to TCP/IP Transport and Applications,” completes most of the detailed discussion of the upper two layers of the TCP/IP model (transport and application), focusing on TCP and applications. +■ Chapter 2, “Basic IPv4 Access Control Lists,” examines how standard IP ACLs can filter packets based on the source IP address so that a router will not forward the packet. +■ Chapter 3, “Advanced IPv4 Access Control Lists,” examines both named and numbered ACLs, and both standard and extended IP ACLs. +■ Part II: Security Services + +■ Chapter 4, “Security Architectures,” discusses a wide range of fundamental con-cepts in network security. +■ Chapter 5, “Securing Network Devices,” shows how to use the router and switch CLI and introduces the concepts behind firewalls and intrusion prevention systems (IPSs). +■ Chapter 6, “Implementing Switch Port Security,” explains the concepts as well as how to configure and verify switch port security, a switch feature that does basic MAC-based monitoring of the devices that send data into a switch. +■ Chapter 7, “Implementing DHCP,” discusses how hosts can be configured with their IPv4 settings and how they can learn those settings with DHCP. +■ Chapter 8, “DHCP Snooping and ARP Inspection,” shows how to implement two related switch security features, with one focusing on reacting to suspicious DHCP messages and the other reacting to suspicious ARP messages. +xl CCNA 200-301 Official Cert Guide, Volume 2 + +■ Part III: IP Services + +■ Chapter 9, “Device Management Protocols,” discusses the concepts and configu-ration of some common network management tools: syslog, NTP, CDP, and LLDP. +■ Chapter 10, “Network Address Translation,” works through the complete concept, confi guration, verification, and troubleshooting sequence for the router NAT fea-ture, including how it helps conserve public IPv4 addresses. +■ Chapter 11, “Quality of Service (QoS),” discusses a wide variety of concepts all related to the broad topic of QoS. +■ Chapter 12, “Miscellaneous IP Services,” discusses several topics for which the exam requires conceptual knowledge but no configuration knowledge, including FHRPs (including HSRP), SNMP, TFTP, and FTP. +■ Part IV: Network Architecture + +■ Chapter 13, “LAN Architecture,” examines various ways to design Ethernet LANs, discussing the pros and cons, and explains common design terminology, including Power over Ethernet (PoE). +■ Chapter 14, “WAN Architecture,” discusses the concepts behind three WAN alter-natives: Metro Ethernet, MPLS VPNs, and Internet VPNs. +■ Chapter 15, “Cloud Architecture,” explains the basic concepts and then generally discusses the impact that cloud computing has on a typical enterprise network, including the foundational concepts of server virtualization. +■ Part V: Network Automation + +■ Chapter 16, “Introduction to Controller-Based Networking,” discusses many concepts and terms related to how Software-Defined Networking (SDN) and net-work programmability are impacting typical enterprise networks. +■ Chapter 17, “Cisco Software-Defined Access (SDA),” discusses Cisco’s Software-Defined Networking (SDN) offering for the enterprise, including the DNA Center controller. +■ Chapter 18, “Understanding REST and JSON,” explains the foundational concepts of REST APIs, data structures, and how JSON can be useful for exchanging data using APIs. +■ Chapter 19, “Understanding Ansible, Puppet, and Chef,” discusses the need for confi guration management software and introduces the basics of each of these three configuration management tools. +■ Part VI: Final Review + +■ Chapter 20, “Final Review,” suggests a plan for final preparation after you have finished the core parts of the book, in particular explaining the many study options available in the book. +■ Part VII: Appendixes + +■ Appendix A, “Numeric Reference Tables,” lists several tables of numeric informa-tion, including a binary-to-decimal conversion table and a list of powers of 2. +xli + +■ Appendix B, “CCNA 200-301 Volume 2 Exam Updates,” is a place for the author to add book content mid-edition. Always check online for the latest PDF version of this appendix; the appendix lists download instructions. +■ Appendix C, “Answers to the ‘Do I Know This Already?’ Quizzes,” includes the explanations to all the “Do I Know This Already” quizzes. +■ The Glossary contains definitions for many of the terms used in the book, including the terms listed in the “Key Terms You Should Know” sections at the conclusion of the chapters. +■ Online Appendixes + +■ Appendix D, “Topics from Previous Editions +■ Appendix E, “Practice for Chapter 2: Basic IPv4 Access Control Lists” ■ Appendix F, “Previous Edition ICND1 Chapter 35: Managing IOS Files” +■ Appendix G, “Exam Topics Cross-Reference,” provides some tables to help you find where each exam objective is covered in the book. +■ Appendix H, “Study Planner,” is a spreadsheet with major study milestones, where you can track your progress through your study. + +About Building Hands-On Skills +You need skills in using Cisco routers and switches, specifically the Cisco command-line interface (CLI). The Cisco CLI is a text-based command-and-response user interface: you type a command, and the device (a router or switch) displays messages in response. To answer sim and simlet questions on the exams, you need to know a lot of commands, and you need to be able to navigate to the right place in the CLI to use those commands. + +This next section walks through the options of what is included in the book, with a brief description of lab options outside the book. + +Config Lab Exercises +Some router and switch features require multiple configuration commands. Part of the skill you need to learn is to remember which configuration commands work together, which ones are required, and which ones are optional. So, the challenge level goes beyond just picking the right parameters on one command. You have to choose which commands to use, in which combination, typically on multiple devices. And getting good at that kind of task requires practice. + +Each Config Lab lists details about a straightforward lab exercise for which you should create a small set of configuration commands for a few devices. Each lab presents a sample lab topology, with some requirements, and you have to decide what to configure on each device. The answer then shows a sample configuration. Your job is to create the configuration and then check your answer versus the supplied answer. + +Config Lab content resides outside the book at the author’s blog site (https://blog.certskills.com). You can navigate to the Config Lab in a couple of ways from the site, or just go directly to https://blog.certskills.com/category/hands-on/ config-lab/ to reach a list of all Config Labs. Figure I-6 shows the logo that you will see with each Config Lab. +xlii CCNA 200-301 Official Cert Guide, Volume 2 + + + + + + + +Figure I-6 Config Lab Logo in the Author’s Blogs + +These Config Labs have several benefits, including the following: + +Untethered and responsive: Do them from anywhere, from any web browser, from your phone or tablet, untethered from the book. +Designed for idle moments: Each lab is designed as a 5- to 10-minute exercise if all you are doing is typing in a text editor or writing your answer on paper. +Two outcomes, both good: Practice getting better and faster with basic configuration, or if you get lost, you have discovered a topic that you can now go back and reread +to complete your knowledge. Either way, you are a step closer to being ready for the exam! +Blog format: The format allows easy adds and changes by me and easy comments by you. +Self-assessment: As part of final review, you should be able to do all the Config Labs, without help, and with confidence. +Note that the blog organizes these Config Lab posts by book chapter, so you can easily use these at both Chapter Review and Part Review. + +A Quick Start with Pearson Network Simulator Lite +The decision of how to get hands-on skills can be a little scary at first. The good news: You have a free and simple first step to experience the CLI: install and use the Pearson Network Simulator Lite (or NetSim Lite) that comes with this book. + +This book comes with a lite version of the best-selling CCNA Network Simulator from Pearson, which provides you with a means, right now, to experience the Cisco CLI. No need to go buy real gear or buy a full simulator to start learning the CLI. Just install it from the companion website. + +The CCNA 200-301 Network Simulator Lite Volume 2 software contains 13 labs cover-ing ACL topics from Part I in the book. So, make sure to use the NetSim Lite to learn the basics of the CLI to get a good start. + +Of course, one reason that you get access to the NetSim Lite is that the publisher hopes you will buy the full product. However, even if you do not use the full product, you can still learn from the labs that come with NetSim Lite while deciding about what options to pursue. +xliii + +The Pearson Network Simulator +The Config Labs and the Pearson Network Simulator Lite both fill specific needs, and they both come with the book. However, you need more than those two tools. + +The single best option for lab work to do along with this book is the paid version of the Pearson Network Simulator. This simulator product simulates Cisco routers and switches so that you can learn for CCNA certification. But more importantly, it focuses on learn-ing for the exam by providing a large number of useful lab exercises. Reader surveys tell us that those people who use the Simulator along with the book love the learning pro-cess and rave about how the book and Simulator work well together. + +Of course, you need to make a decision for yourself and consider all the options. Thankfully, you can get a great idea of how the full Simulator product works by using the Pearson Network Simulator Lite product included with the book. Both have the same base code, same user interface, and same types of labs. Try the Lite version to decide if you want to buy the full product. + +Note that the Simulator and the books work on a different release schedule. For a time in 2020, the Simulator will be the one created for the previous versions of the exams (ICND1 100-101, ICND2 200-101, and CCNA 200-120). Interestingly, Cisco did not add a large number of new topics that require CLI skills to the CCNA 200-301 exam as compared with its predecessor, so the old Simulator covers most of the CCNA 200-301 CLI topics. So, during the interim before the products based on the 200-301 exam come out, the old Simulator products should be quite useful. + +On a practical note, when you want to do labs when reading a chapter or doing Part Review, the Simulator organizes the labs to match the book. Just look for the Sort by Chapter tab in the Simulator’s user interface. However, during the months in 2020 for which the Simulator is the older edition listing the older exams in the title, you will need to refer to a PDF that lists those labs versus this book’s organization. You can find that PDF on the book product page under the Downloads tab here: www.ciscopress.com/ title/9781587147135. + +More Lab Options +If you decide against using the full Pearson Network Simulator, you still need hands-on experience. You should plan to use some lab environment to practice as much CLI as possible. + +First, you can use real Cisco routers and switches. You can buy them, new or used, or borrow them at work. You can rent them for a fee. If you have the right mix of gear, you could even do the Config Lab exercises from my blog on that gear or try to re-create examples from the book. + +Cisco also makes a simulator that works very well as a learning tool: Cisco Packet Tracer. Cisco now makes Packet Tracer available for free. However, unlike the Pearson Network Simulator, it does not include lab exercises that direct you as to how to go about learn-ing each topic. If interested in more information about Packet Tracer, check out my series about using Packet Tracer at my blog (https://blog.certskills.com); just search for “Packet Tracer.” +xliv CCNA 200-301 Official Cert Guide, Volume 2 + +Cisco offers a virtualization product that lets you run router and switch operating system (OS) images in a virtual environment. This tool, the Virtual Internet Routing Lab (VIRL), lets you create a lab topology, start the topology, and connect to real router and switch OS images. Check out http://virl.cisco.com for more information. + +You can even rent virtual Cisco router and switch lab pods from Cisco, in an offering called Cisco Learning Labs (https://learningnetworkstore.cisco.com/cisco-learning-labs). + +This book does not tell you what option to use, but you should plan on getting some hands-on practice somehow. The important thing to know is that most people need to practice using the Cisco CLI to be ready to pass these exams. + +For More Information +If you have any comments about the book, submit them via www.ciscopress.com. Just go to the website, select Contact Us, and type your message. + +Cisco might make changes that affect the CCNA certification from time to time. You should always check www.cisco.com/go/ccna for the latest details. + +The CCNA 200-301 Official Cert Guide, Volume 2, helps you attain CCNA certifica-tion. This is the CCNA certification book from the only Cisco-authorized publisher. We at Cisco Press believe that this book certainly can help you achieve CCNA certification, but the real work is up to you! I trust that your time will be well spent. +Figure Credits + +Figure 7-9, screenshot of network connection details © Microsoft, 2019 + +Figure 7-10, screenshot(s) reprinted with permission from Apple, Inc. + +Figure 7-11, screenshot of Linux © The Linux Foundation + +Figure 12-16, screenshot of CS Blogfigs 2018 © FileZila + +Figure 13-9, electric outlet © Mike McDonald/Shutterstock + +Figure 15-10, screenshot of Set Up VM with Different CPU/RAM/OS © 2019, Amazon Web Services, Inc + +Figure 16-13, illustration of man icon © AlexHliv/Shutterstock + +Figure 17-1, illustration of man icon © AlexHliv/Shutterstock + +Figure 17-11, illustration of man icon © AlexHliv/Shutterstock + +Figure 18-9, screenshot of REST GET Request © 2019 Postman, Inc. + +Figure 20-1, screenshot of PTP Grading © 2019 Pearson Education + +Figure 20-2, screenshot of PTP Grading © 2019 Pearson Education + +Figure D-1, ribbon set © petrnutil/123RF + + + + + + + + + + + + + +The CCNA Official Cert Guide, Volume 2 includes the topics that help you build an enter-prise network so all devices can communicate with all other devices. Parts I and II of this book focus on how to secure that enterprise network so that only the appropriate devices and users can communicate. + +Part I focuses on IP Version 4 (IPv4) access control lists (ACLs). ACLs are IPv4 packet filters that can be programmed to look at IPv4 packet headers, make choices, and either allow a packet through or discard the packet. Because you can implement IPv4 ACLs on any router, a network engineer has a large number of options of where to use ACLs, without adding additional hardware or software, making ACLs a very flexible and useful tool. + +Chapter 1 begins this part with an introduction to the TCP/IP transport layer protocols TCP and UDP, along with an introduction to several TCP/IP applications. This chapter provides the necessary background to understand the ACL chapters and to better prepare you for upcoming discussions of additional security topics in Part II and IP services topics in Part III. + +Chapters 2 and 3 get into details about ACLs. Chapter 2 discusses ACL basics, avoiding some of the detail to ensure that you master several key concepts. Chapter 3 then looks at the much wider array of ACL features to make you ready to take advantage of the power of ACLs and to be ready to better manage those ACLs. +Part I + + +IP Access Control Lists + + + + +Chapter 1: Introduction to TCP/IP Transport and Applications + +Chapter 2: Basic IPv4 Access Control Lists + +Chapter 3: Advanced IPv4 Access Control Lists + +Part I Review +CHAPTER 1 + + + +Introduction to TCP/IP Transport and Applications + +This chapter covers the following exam topics: + +1.0 Network Fundamentals 1.5 Compare TCP to UDP +4.0 IP Services +4.3 Explain the role of DHCP and DNS in the network + + +The CCNA exam focuses mostly on functions at the lower layers of TCP/IP, which define how IP networks can send IP packets from host to host using LANs and WANs. This chap-ter explains the basics of a few topics that receive less attention on the exams: the TCP/IP transport layer and the TCP/IP application layer. The functions of these higher layers play a big role in real TCP/IP networks. Additionally, many of the security topics in Parts I and II of this book, and some of the IP services topics in Part III, require you to know the basics of how the transport and application layers of TCP/IP work. This chapter serves as that introduction. +This chapter begins by examining the functions of two transport layer protocols: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). The second major section of the chapter examines the TCP/IP application layer, including some discussion of how Domain Name System (DNS) name resolution works. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 1-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +TCP/IP Layer 4 Protocols: TCP and UDP +TCP/IP Applications + +Questions 1–4 +5–6 + + + + +1. Which of the following header fields identify which TCP/IP application gets data received by the computer? (Choose two answers.) +a. Ethernet Type +b. SNAP Protocol Type c. IP Protocol +d. TCP Port Number e. UDP Port Number +2. Which of the following are typical functions of TCP? (Choose four answers.) a. Flow control (windowing) +b. Error recovery +c. Multiplexing using port numbers d. Routing +e. Encryption +f. Ordered data transfer + +3. Which of the following functions is performed by both TCP and UDP? a. Windowing +b. Error recovery +c. Multiplexing using port numbers d. Routing +e. Encryption +f. Ordered data transfer + +4. What do you call data that includes the Layer 4 protocol header, and data given to Layer 4 by the upper layers, not including any headers and trailers from Layers 1 to 3? (Choose two answers.) +a. L3PDU b. Chunk c. Segment d. Packet e. Frame +f. L4PDU + +5. In the URI http://blog.certskills.com/config-labs, which part identifies the web server? a. http +b. blog.certskills.com c. certskills.com +d. http://blog.certskills.com +e. The file name.html includes the hostname. +6 CCNA 200-301 Official Cert Guide, Volume 2 + +6. Fred opens a web browser and connects to the www.certskills.com website. Which of the following are typically true about what happens between Fred’s web browser and the web server? (Choose two answers.) +a. Messages flowing toward the server use UDP destination port 80. b. Messages flowing from the server typically use RTP. +c. Messages flowing to the client typically use a source TCP port number of 80. d. Messages flowing to the server typically use TCP. + + +Foundation Topics + +TCP/IP Layer 4 Protocols: TCP and UDP +The OSI transport layer (Layer 4) defines several functions, the most important of which are error recovery and flow control. Likewise, the TCP/IP transport layer protocols also imple-ment these same types of features. Note that both the OSI model and the TCP/IP model call this layer the transport layer. But as usual, when referring to the TCP/IP model, the layer name and number are based on OSI, so any TCP/IP transport layer protocols are con-sidered Layer 4 protocols. + +The key difference between TCP and UDP is that TCP provides a wide variety of services to applications, whereas UDP does not. For example, routers discard packets for many rea-sons, including bit errors, congestion, and instances in which no correct routes are known. As you have read already, most data-link protocols notice errors (a process called error detection) but then discard frames that have errors. TCP provides retransmission (error recovery) and helps to avoid congestion (flow control), whereas UDP does not. As a result, many application protocols choose to use TCP. + +However, do not let UDP’s lack of services make you think that UDP is worse than TCP. By providing fewer services, UDP needs fewer bytes in its header compared to TCP, resulting in fewer bytes of overhead in the network. UDP software does not slow down data transfer in cases where TCP can purposefully slow down. Also, some applications, notably today Voice over IP (VoIP) and video over IP, do not need error recovery, so they use UDP. So, UDP also has an important place in TCP/IP networks today. + +Table 1-2 lists the main features supported by TCP/UDP. Note that only the first item listed in the table is supported by UDP, whereas all items in the table are supported by TCP. + + +Table 1-2 +Function + +TCP/IP Transport Layer Features +Description + + + +Multiplexing using ports + + +Error recovery (reliability) + +Flow control using windowing + +Function that allows receiving hosts to choose the correct application for which the data is destined, based on the port number +Process of numbering and acknowledging data with Sequence and Acknowledgment header fields +Process that uses window sizes to protect buffer space and routing devices from being overloaded with traffic +Chapter 1: Introduction to TCP/IP Transport and Applications 7 + + +Function +Connection establishment and termination +Ordered data transfer and data segmentation + +Description +Process used to initialize port numbers and Sequence and 1 Acknowledgment fields +Continuous stream of bytes from an upper-layer process that is “segmented” for transmission and delivered to upper-layer +processes at the receiving device, with the bytes in the same order + + +Next, this section describes the features of TCP, followed by a brief comparison to UDP. + +Transmission Control Protocol +Each TCP/IP application typically chooses to use either TCP or UDP based on the applica-tion’s requirements. For example, TCP provides error recovery, but to do so, it consumes more bandwidth and uses more processing cycles. UDP does not perform error recovery, but it takes less bandwidth and uses fewer processing cycles. Regardless of which of these two TCP/IP transport layer protocols the application chooses to use, you should understand the basics of how each of these transport layer protocols works. + +TCP, as defined in Request For Comments (RFC) 793, accomplishes the functions listed in Table 1-2 through mechanisms at the endpoint computers. TCP relies on IP for end-to-end delivery of the data, including routing issues. In other words, TCP performs only part of the functions necessary to deliver the data between applications. Also, the role that it plays is directed toward providing services for the applications that sit at the endpoint computers. Regardless of whether two computers are on the same Ethernet, or are separated by the entire Internet, TCP performs its functions the same way. + +Figure 1-1 shows the fields in the TCP header. Although you don’t need to memorize the names of the fields or their locations, the rest of this section refers to several of the fields, so the entire header is included here for reference . + +4 Bytes + +Source Port Destination Port + +Sequence Number + +Acknowledgement Number + +Offset Reserved Flag Bits Window + +Checksum Urgent + +Figure 1-1 TCP Header Fields + +The message created by TCP that begins with the TCP header, followed by any applica-tion data, is called a TCP segment. Alternatively, the more generic term Layer 4 PDU, or L4PDU, can also be used. + +Multiplexing Using TCP Port Numbers +TCP and UDP both use a concept called multiplexing. Therefore, this section begins with an explanation of multiplexing with TCP and UDP. Afterward, the unique features of TCP are explored. +8 CCNA 200-301 Official Cert Guide, Volume 2 + +Multiplexing by TCP and UDP involves the process of how a computer thinks when receiv-ing data. The computer might be running many applications, such as a web browser, an email package, or an Internet VoIP application (for example, Skype). TCP and UDP multi-plexing tells the receiving computer to which application to give the received data. + +Some examples will help make the need for multiplexing obvious. The sample network consists of two PCs, labeled Hannah and George. Hannah uses an application that she wrote to send advertisements that appear on George’s screen. The application sends a new ad to George every 10 seconds. Hannah uses a second application, a wire-transfer application, to send George some money. Finally, Hannah uses a web browser to access the web server that runs on George’s PC. The ad application and wire-transfer application are imaginary, just for this example. The web application works just like it would in real life. + +Figure 1-2 shows the sample network, with George running three applications: + +■ A UDP-based advertisement application ■ A TCP-based wire-transfer application ■ A TCP web server application + + + +Hannah George +Web Server Ad Application +Wire Application + +I received three packets from the same source MAC and IP. Which of my applications gets the data in each? + + + +Eth IP UDP + +Eth IP TCP + +Eth IP TCP + +Ad Data Eth + +Wire Transfer Data Eth + +Web Page Data Eth + +Figure 1-2 Hannah Sending Packets to George, with Three Applications + +George needs to know which application to give the data to, but all three packets are from the same Ethernet and IP address. You might think that George could look at whether the packet contains a UDP or TCP header, but as you see in the figure, two applications (wire transfer and web) are using TCP. +TCP and UDP solve this problem by using a port number field in the TCP or UDP header, respectively. Each of Hannah’s TCP and UDP segments uses a different destination port number so that George knows which application to give the data to. Figure 1-3 shows an example. + +Multiplexing relies on a concept called a socket. A socket consists of three things: + +■ An IP address +■ A transport protocol ■ A port number + +Answers to the “Do I Know This Already?” quiz: 1 D, E 2 A, B, C, F 3 C 4 C, F 5 B 6 C, D +Chapter 1: Introduction to TCP/IP Transport and Applications 9 + + +Hannah George +Port 80 Web Server Port 800 Ad Server +Port 9876 Wire Application + +,·OOORRNLQWKH UDP or TCP +Destination port to identify the application! + + +1 + + +Eth IP UDP Ad Data Eth + +Destination Port 800 + +Eth IP TCP Wire Transfer Data Eth + +Destination Port 9876 + +Eth IP TCP Web Page Data Eth + +Destination Port 80 +Figure 1-3 Hannah Sending Packets to George, with Three Applications Using Port Numbers to Multiplex + +So, for a web server application on George, the socket would be (10.1.1.2, TCP, port 80) because, by default, web servers use the well-known port 80. When Hannah’s web browser connects to the web server, Hannah uses a socket as well—possibly one like this: (10.1.1.1, TCP, 49160). Why 49160? Well, Hannah just needs a port number that is unique on Hannah, so Hannah sees that port 49160. + +The Internet Assigned Numbers Authority (IANA), the same organization that manages IP address allocation worldwide, subdivides the port number ranges into three main ranges. The first two ranges reserve numbers that IANA can then allocate to specific application protocols through an application and review process, with the third category reserving ports to be dynamically allocated as used for clients, as with the port 49160 example in the previ-ous paragraph. The names and ranges of port numbers (as detailed in RFC 6335) are +■ Well Known (System) Ports: Numbers from 0 to 1023, assigned by IANA, with a stricter review process to assign new ports than user ports. +■ User (Registered) Ports: Numbers from 1024 to 49151, assigned by IANA with a less strict process to assign new ports compared to well-known ports. +■ Ephemeral (Dynamic, Private) Ports: Numbers from 49152 to 65535, not assigned and intended to be dynamically allocated and used temporarily for a client application while the app is running. + +Figure 1-4 shows an example that uses three ephemeral ports on the user device on the left, with the server on the right using two well-known ports and one user port. The computers use three applications at the same time; hence, three socket connections are open. Because a socket on a single computer should be unique, a connection between two sockets should identify a unique connection between two computers. This uniqueness means that you can use multiple applications at the same time, talking to applications running on the same or different computers. Multiplexing, based on sockets, ensures that the data is delivered to the correct applications. +10 CCNA 200-301 Official Cert Guide, Volume 2 + + +User + + +Ad Wire Web Application Application Browser Port 49159 Port 49153 Port 49152 + +Server + + +Ad Wire Web Application Application Server +Port 800 Port 9876 Port 80 + + + +UDP TCP UDP TCP + +IP Address 10.1.1.1 IP Address 10.1.1.2 + + +(10.1.1.1, TCP, 49152) (10.1.1.2, TCP, 80) + +(10.1.1.1, TCP, 49153) (10.1.1.2, TCP, 9876) + +(10.1.1.1, UDP, 49159) (10.1.1.2, UDP, 800) Figure 1-4 Connections Between Sockets +Port numbers are a vital part of the socket concept. Servers use well-known ports (or user ports), whereas clients use dynamic ports. Applications that provide a service, such as FTP, Telnet, and web servers, open a socket using a well-known port and listen for connection requests. Because these connection requests from clients are required to include both the source and destination port numbers, the port numbers used by the servers must be known beforehand. Therefore, each service uses a specific well-known port number or user port number. Both well-known and user ports are listed at www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt. +On client machines, where the requests originate, any locally unused port number can be allocated. The result is that each client on the same host uses a different port number, but a server uses the same port number for all connections. For example, 100 web browsers on the same host computer could each connect to a web server, but the web server with 100 clients connected to it would have only one socket and, therefore, only one port number (port 80, in this case). The server can tell which packets are sent from which of the 100 cli-ents by looking at the source port of received TCP segments. The server can send data to the correct web client (browser) by sending data to that same port number listed as a desti- +nation port. The combination of source and destination sockets allows all participating hosts to distinguish between the data’s source and destination. Although the example explains the concept using 100 TCP connections, the same port-numbering concept applies to UDP ses-sions in the same way. + +NOTE You can find all RFCs online at www.rfc-editor.org/rfc/rfcxxxx.txt, where xxxx is the number of the RFC. If you do not know the number of the RFC, you can try searching by topic at www.rfc-editor.org. + +Popular TCP/IP Applications +Throughout your preparation for the CCNA exam, you will come across a variety of TCP/IP applications. You should at least be aware of some of the applications that can be used to help manage and control a network. +Chapter 1: Introduction to TCP/IP Transport and Applications + +The World Wide Web (WWW) application exists through web browsers accessing the content available on web servers. Although it is often thought of as an end-user application, you can actually use WWW to manage a router or switch. You enable a web server function in the router or switch and use a browser to access the router or switch. + +The Domain Name System (DNS) allows users to use names to refer to computers, with DNS being used to find the corresponding IP addresses. DNS also uses a client/server model, with DNS servers being controlled by networking personnel and DNS client func-tions being part of most any device that uses TCP/IP today. The client simply asks the DNS server to supply the IP address that corresponds to a given name. + +Simple Network Management Protocol (SNMP) is an application layer protocol used spe-cifically for network device management. For example, Cisco supplies a large variety of net-work management products, many of them in the Cisco Prime network management soft-ware product family. They can be used to query, compile, store, and display information about a network’s operation. To query the network devices, Cisco Prime software mainly uses SNMP protocols. + +Traditionally, to move files to and from a router or switch, Cisco used Trivial File Transfer Protocol (TFTP). TFTP defines a protocol for basic file transfer—hence the word trivial. Alternatively, routers and switches can use File Transfer Protocol (FTP), which is a much more functional protocol, to transfer files. Both work well for moving files into and out of Cisco devices. FTP allows many more features, making it a good choice for the general +end-user population. TFTP client and server applications are very simple, making them good tools as embedded parts of networking devices. + +Some of these applications use TCP, and some use UDP. For example, Simple Mail Transfer Protocol (SMTP) and Post Office Protocol version 3 (POP3), both used for transferring mail, require guaranteed delivery, so they use TCP. + +Regardless of which transport layer protocol is used, applications use a well-known port number so that clients know which port to attempt to connect to. Table 1-3 lists several popular applications and their well-known port numbers. + +11 + + + +1 + + +Table 1-3 Popular Applications and Their Well-Known Port Numbers + +Port Number 20 +21 22 23 25 53 67 68 69 80 +110 + +Protocol TCP +TCP TCP TCP TCP +UDP, TCP1 UDP +UDP UDP TCP +TCP + +Application FTP data FTP control SSH +Telnet SMTP DNS +DHCP Server DHCP Client TFTP +HTTP (WWW) +POP3 +12 CCNA 200-301 Official Cert Guide, Volume 2 + + +Port Number 161 +443 +514 + +Protocol UDP TCP +UDP + +Application SNMP +SSL +Syslog + + +1 DNS uses both UDP and TCP in different instances. It uses port 53 for both TCP and UDP. + +Connection Establishment and Termination +TCP connection establishment occurs before any of the other TCP features can begin their work. Connection establishment refers to the process of initializing Sequence and +Acknowledgment fields and agreeing on the port numbers used. Figure 1-5 shows an exam-ple of connection establishment flow. + +Web Browser Web Server +SYN, DPORT=80, SPORT=49155 + + + +Port 49155 + +Figure 1-5 + +SYN, ACK, DPORT=49155, SPORT=80 + +ACK, DPORT=80, SPORT=49155 + +TCP Connection Establishment + + +Port 80 + + +This three-way connection establishment flow (also called a three-way handshake) must complete before data transfer can begin. The connection exists between the two sockets, although the TCP header has no single socket field. Of the three parts of a socket, the IP addresses are implied based on the source and destination IP addresses in the IP header. TCP is implied because a TCP header is in use, as specified by the protocol field value in the IP header. Therefore, the only parts of the socket that need to be encoded in the TCP header are the port numbers. + +TCP signals connection establishment using 2 bits inside the flag fields of the TCP header. Called the SYN and ACK flags, these bits have a particularly interesting meaning. SYN means “synchronize the sequence numbers,” which is one necessary component in initializa-tion for TCP. + +Figure 1-6 shows TCP connection termination. This four-way termination sequence is straightforward and uses an additional flag, called the FIN bit. (FIN is short for “finished,” as you might guess.) One interesting note: Before the device on the right sends the third TCP segment in the sequence, it notifies the application that the connection is coming down. It then waits on an acknowledgment from the application before sending the third segment in the figure. Just in case the application takes some time to reply, the PC on +the right sends the second flow in the figure, acknowledging that the other PC wants to take down the connection. Otherwise, the PC on the left might resend the first segment repeatedly. +Chapter 1: Introduction to TCP/IP Transport and Applications 13 +ACK +ACK +ACK, FIN +ACK, FIN + + + + + + +PC + + + + +Figure 1-6 + +1 + +PC + + + + +TCP Connection Termination + + +TCP establishes and terminates connections between the endpoints, whereas UDP does not. Many protocols operate under these same concepts, so the terms connection-oriented and connectionless are used to refer to the general idea of each. More formally, these terms can be defined as follows: + +■ Connection-oriented protocol: A protocol that requires an exchange of messages before data transfer begins, or that has a required pre-established correlation between two endpoints. +■ Connectionless protocol: A protocol that does not require an exchange of messages and that does not require a pre-established correlation between two endpoints. + +Error Recovery and Reliability +TCP provides for reliable data transfer, which is also called reliability or error recovery, depending on what document you read. To accomplish reliability, TCP numbers data bytes using the Sequence and Acknowledgment fields in the TCP header. TCP achieves reliability in both directions, using the Sequence Number field of one direction combined with the Acknowledgment field in the opposite direction. + +Figure 1-7 shows an example of how the TCP Sequence and Acknowledgment fields allow the PC to send 3000 bytes of data to the server, with the server acknowledging receipt of the data. The TCP segments in the figure occur in order, from top to bottom. For simplic-ity’s sake, all messages happen to have 1000 bytes of data in the data portion of the TCP segment. The first Sequence number is a nice round number (1000), again for simplicity’s sake. The top of the figure shows three segments, with each sequence number being 1000 more than the previous, identifying the first of the 1000 bytes in the message. (That is, in this example, the first segment holds bytes 1000–1999; the second holds bytes 2000–2999; and the third holds bytes 3000–3999.) + +Web Browser Web Server 1000 Bytes of Data, Sequence = 1000 + +1000 Bytes of Data, Sequence = 2000 + +1000 Bytes of Data, Sequence = 3000 + +1 +No Data, Acknowledgment = 4000 + +Got All 3000 Bytes. Send ACK + + +Figure 1-7 TCP Acknowledgment Without Errors + +The fourth TCP segment in the figure—the only one flowing back from the server to the web browser—acknowledges the receipt of all three segments. How? The acknowledgment +14 CCNA 200-301 Official Cert Guide, Volume 2 + +value of 4000 means “I received all data with sequence numbers up through one less than 4000, so I am ready to receive your byte 4000 next.” (Note that this convention of acknowl-edging by listing the next expected byte, rather than the number of the last byte received, is called forward acknowledgment.) + +This first example does not recover from any errors, however; it simply shows the basics of how the sending host uses the sequence number field to identify the data, with the receiv-ing host using forward acknowledgments to acknowledge the data. The more interesting discussion revolves around how to use these same tools to do error recovery. TCP uses the Sequence and Acknowledgment fields so that the receiving host can notice lost data, ask the sending host to resend, and then acknowledge that the re-sent data arrived. + +Many variations exist for how TCP does error recovery. Figure 1-8 shows just one such example, with similar details compared to the previous figure. The web browser again sends three TCP segments, again 1000 bytes each, again with easy-to-remember sequence num-bers. However, in this example, the second TCP segment fails to cross the network. + +Web Browser Web Server 1000 Bytes of Data, Sequence = 1000 + +1000 Bytes of Data, Sequence = 2000 + + + + + + +He Lost Segment with +SEQ = 2000. 2 +Resend it! + +1000 Bytes of Data, Sequence = 3000 + + +No Data, Acknowledgment = 2000 + + +1000 Bytes of Data, Sequence = 2000 + + +I Received 1000 – 1999. +1 I Received 3000 – 3999. Ask for 2000 Next! + + + + + +No Data, Acknowledgment = 4000 + +Figure 1-8 TCP Acknowledgment with Errors + +3 I Received 2000 – 2999. +Already Have 3000 – 3999. Ask for 4000 Next! + + +The figure points out three sets of ideas behind how the two hosts think. First, on the right, the server realizes that it did not receive all the data. The two received TCP segments con-tain bytes numbered 1000–1999 and 3000–3999. Clearly, the server did not receive the bytes numbered in between. The server then decides to acknowledge all the data up to the lost data—that is, to send back a segment with the Acknowledgment field equal to 2000. + +The receipt of an acknowledgment that does not acknowledge all the data sent so far tells the sending host to resend the data. The PC on the left may wait a few moments to make sure no other acknowledgments arrive (using a timer called the retransmission timer), but will soon decide that the server means “I really do need 2000 next—resend it.” The PC on the left does so, as shown in the fifth of the six TCP segments in the figure. +Finally, note that the server can acknowledge not only the re-sent data, but any earlier data that had been received correctly. In this case, the server received the re-sent second TCP seg-ment (the data with sequence numbers 2000–2999), but the server had already received the third TCP segment (the data numbered 3000–3999). The server’s next Acknowledgment field acknowledges the data in both those segments, with an Acknowledgment field of 4000. +Chapter 1: Introduction to TCP/IP Transport and Applications + +Flow Control Using Windowing +TCP implements flow control by using a window concept that is applied to the amount of data that can be outstanding and awaiting acknowledgment at any one point in time. The window concept lets the receiving host tell the sender how much data it can receive right now, giving the receiving host a way to make the sending host slow down or speed up. The receiver can slide the window size up and down—called a sliding window or dynamic win-dow—to change how much data the sending host can send. + +The sliding window mechanism makes much more sense with an example. The example, shown in Figure 1-9, uses the same basic rules as the examples in the previous few figures. In this case, none of the TCP segments have errors, and the discussion begins one TCP seg-ment earlier than in the previous two figures. + +15 + + + +1 + + +Web Browser Web Server +ACK=1000 Window=3000 + + +I Received a New Window: 3000 + + + +I Must Wait for an ACK + + +1 +SEQ=1000 + +SEQ=2000 +SEQ=3000 + +2 3 + +ACK=4000 + + + + + + +Send an ACK = 4000 Grant a New Window: 4000 + +I got an ACK! 4 Window=4000 I also got a Larger +Window: 4000 +Figure 1-9 TCP Windowing + +Begin with the first segment, sent by the server to the PC. The Acknowledgment field should be familiar by now: it tells the PC that the server expects a segment with sequence number 1000 next. The new field, the window field, is set to 3000. Because the segment flows to the PC, this value tells the PC that the PC can send no more than 3000 bytes over this connection before receiving an acknowledgment. So, as shown on the left, the PC real-izes it can send only 3000 bytes, and it stops sending, waiting on an acknowledgment, after sending three 1000-byte TCP segments. + +Continuing the example, the server not only acknowledges receiving the data (without any loss), but the server decides to slide the window size a little higher. Note that second message flowing right to left in the figure, this time with a window of 4000. Once the PC receives this TCP segment, the PC realizes it can send another 4000 bytes (a slightly larger window than the previous value). + +Note that while the last few figures show examples for the purpose of explaining how the mechanisms work, the examples might give you the impression that TCP makes the hosts sit there and wait for acknowledgments a lot. TCP does not want to make the sending host have to wait to send data. For instance, if an acknowledgment is received before the win-dow is exhausted, a new window begins, and the sender continues sending data until the +16 CCNA 200-301 Official Cert Guide, Volume 2 + +current window is exhausted. Often times, in a network that has few problems, few lost segments, and little congestion, the TCP windows stay relatively large with hosts seldom waiting to send. + +User Datagram Protocol +UDP provides a service for applications to exchange messages. Unlike TCP, UDP is connec-tionless and provides no reliability, no windowing, no reordering of the received data, and no segmentation of large chunks of data into the right size for transmission. However, UDP provides some functions of TCP, such as data transfer and multiplexing using port numbers, and it does so with fewer bytes of overhead and less processing required than TCP. + +UDP data transfer differs from TCP data transfer in that no reordering or recovery is accomplished. Applications that use UDP are tolerant of the lost data, or they have some application mechanism to recover lost data. For example, VoIP uses UDP because if a voice packet is lost, by the time the loss could be noticed and the packet retransmitted, too much delay would have occurred, and the voice would be unintelligible. Also, DNS requests use UDP because the user will retry an operation if the DNS resolution fails. As another exam-ple, the Network File System (NFS), a remote file system application, performs recovery with application layer code, so UDP features are acceptable to NFS. + +Figure 1-10 shows the UDP header format. Most importantly, note that the header includes source and destination port fields, for the same purpose as TCP. However, the UDP has only 8 bytes, in comparison to the 20-byte TCP header shown in Figure 1-1. UDP needs a shorter header than TCP simply because UDP has less work to do. + + + + +Source Port + +Length + +4 Bytes + +Destination Port + +Checksum + + +Figure 1-10 UDP Header + +TCP/IP Applications +The whole goal of building an enterprise network, or connecting a small home or office net-work to the Internet, is to use applications such as web browsing, text messaging, email, file downloads, voice, and video. This section examines one particular application—web brows-ing using Hypertext Transfer Protocol (HTTP). + +The World Wide Web (WWW) consists of all the Internet-connected web servers in the world, plus all Internet-connected hosts with web browsers. Web servers, which consist of web server software running on a computer, store information (in the form of web pages) that might be useful to different people. A web browser, which is software installed on an end user’s computer, provides the means to connect to a web server and display the web pages stored on the web server. + +NOTE Although most people use the term web browser, or simply browser, web brows-ers are also called web clients, because they obtain a service from a web server. + +For this process to work, several specific application layer functions must occur. The user must somehow identify the server, the specific web page, and the protocol used to get +Chapter 1: Introduction to TCP/IP Transport and Applications + +the data from the server. The client must find the server’s IP address, based on the server’s name, typically using DNS. The client must request the web page, which actually consists of multiple separate files, and the server must send the files to the web browser. Finally, for electronic commerce (e-commerce) applications, the transfer of data, particularly sensitive financial data, needs to be secure. The following sections address each of these functions. + +Uniform Resource Identifiers +For a browser to display a web page, the browser must identify the server that has the web page, plus other information that identifies the particular web page. Most web servers have many web pages. For example, if you use a web browser to browse www.cisco.com and you click around that web page, you’ll see another web page. Click again, and you’ll see another web page. In each case, the clicking action identifies the server’s IP address as well as the specific web page, with the details mostly hidden from you. (These clickable items on a web page, which in turn bring you to another web page, are called links.) + +The browser user can identify a web page when you click something on a web page or when you enter a Uniform Resource Identifier (URI) in the browser’s address area. Both options— clicking a link and typing a URI—refer to a URI, because when you click a link on a web page, that link actually refers to a URI. + +17 + + + +1 + + +NOTE Most browsers support some way to view the hidden URI referenced by a link. In several browsers, hover the mouse pointer over a link, right-click, and select Properties. +The pop-up window should display the URI to which the browser would be directed if you clicked that link. + +In common speech, many people use the terms web address or the similar related terms Universal Resource Locator (or Uniform Resource Locator [URL]) instead of URI, but URI is indeed the correct formal term. In fact, URL had been more commonly used than URI for more than a few years. However, the IETF (the group that defines TCP/IP), along with the W3C consortium (W3.org, a consortium that develops web standards) has made a concerted effort to standardize the use of URI as the general term. See RFC 7595 for some commen-tary to that effect. + +From a practical perspective, the URIs used to connect to a web server include three key components, as noted in Figure 1-11. The figure shows the formal names of the URI fields. More importantly to this discussion, note that the text before the :// identifies the protocol used to connect to the server, the text between the // and / identifies the server by name, and the text after the / identifies the web page. + +Formal: URI Scheme Authority Path + + +http://www.certskills.com/blog + + +Example: Web Protocol Server’s Name Web Page Figure 1-11 Structure of a URI Used to Retrieve a Web Page +18 CCNA 200-301 Official Cert Guide, Volume 2 + +In this case, the protocol is Hypertext Transfer Protocol (HTTP), the hostname is www.certskills.com, and the name of the web page is blog. + +Finding the Web Server Using DNS +A host can use DNS to discover the IP address that corresponds to a particular hostname. URIs typically list the name of the server—a name that can be used to dynamically learn the IP address used by that same server. The web browser cannot send an IP packet to a destina-tion name, but it can send a packet to a destination IP address. So, before the browser can send a packet to the web server, the browser typically needs to resolve the name inside the URI to that name’s corresponding IP address. + +To pull together several concepts, Figure 1-12 shows the DNS process as initiated by a web browser, as well as some other related information. From a basic perspective, the user enters the URI (in this case, http://www.cisco.com/go/learningnetwork), resolves the www.cisco.com name into the correct IP address, and starts sending packets to the web server. + +1 The human typed this URI: http://www.cisco.com/go/learningnetwork + + +DNS Server 192.31.7.1 2 + + +Name Resolution Request +IP Header UDP Header DNS Request + + + +Source 64.100.1.1 Dest. 192.31.7.1 + +Source 49161 What is IP address Dest. Port 53 of www.cisco.com? + + + + +Name Resolution Reply +3 IP Header UDP Header DNS Request + +Client 64.100.1.1 + + + +Source 192.31.7.1 Dest. 64.100.1.1 + +Source 53 Dest. 49161 + +IP address is 198.133.219.25 + + + + + + +4 + +TCP Connection Setup +IP Header TCP Header + + + +Source 64.100.1.1 Dest. 198.133.219.25 + +www.cisco.com Web Server 198.133.219.25 + +Source 49172 Dest. Port 80, SYN + +Figure 1-12 DNS Resolution and Requesting a Web Page + +The steps shown in the figure are as follows: + +1. The user enters the URI, http://www.cisco.com/go/learningnetwork, into the brows-er’s address area. +2. The client sends a DNS request to the DNS server. Typically, the client learns the DNS server’s IP address through DHCP. Note that the DNS request uses a UDP head-er, with a destination port of the DNS well-known port of 53. (See Table 1-3, earlier in this chapter, for a list of popular well-known ports.) +3. The DNS server sends a reply, listing IP address 198.133.219.25 as www.cisco.com’s IP address. Note also that the reply shows a destination IP address of 64.100.1.1, the +Chapter 1: Introduction to TCP/IP Transport and Applications + +client’s IP address. It also shows a UDP header, with source port 53; the source port is 53 because the data is sourced, or sent, by the DNS server. +4. The client begins the process of establishing a new TCP connection to the web server. Note that the destination IP address is the just-learned IP address of the web server. The packet includes a TCP header, because HTTP uses TCP. Also note that the desti-nation TCP port is 80, the well-known port for HTTP. Finally, the SYN bit is shown, as a reminder that the TCP connection establishment process begins with a TCP seg-ment with the SYN bit turned on (binary 1). + +The example in Figure 1-12 shows what happens when the client host does not know the IP address associated with the hostname but the enterprise does know the address. However, hosts can cache the results of DNS requests so that for a time the client does not need to ask the DNS to resolve the name. Also, the DNS server can cache the results of previous DNS requests; for instance, the enterprise DNS server in Figure 1-12 would not normally have configured information about hostnames in domains outside that enterprise, so that example relied on the DNS having cached the address associated with hostname www.cisco.com. + +When the local DNS does not know the address associated with a hostname, it needs to ask for help. Figure 1-13 shows an example with the same client as in Figure 1-12. In this case, the enterprise DNS acts as a recursive DNS server, sending repeated DNS messages in an effort to identify the authoritative DNS server. + +19 + + + +1 + + +2 + +Root DNS + + + + + +.com TLD 3 DNS + +Enterprise +DNS 1 + + +5 + + + + + +Authoritative cisco.com DNS + +Figure 1-13 + +4 + + + +Recursive DNS Lookup + + +The steps shown in the figure are as follows: + +1. The client sends a DNS request for www.cisco.com to the DNS server it knows, which is the enterprise DNS server. +2. The (recursive) enterprise DNS server does not know the answer yet, but it does not reject the client’s DNS request. Instead, it follows a repetitive (recursive) process (shown as steps 2, 3, and 4), beginning with the DNS request sent to a root DNS server. The root does not supply the address either, but it supplies the IP address of another DNS server, one responsible for the .com top-level domain. +20 CCNA 200-301 Official Cert Guide, Volume 2 + +3. The recursive enterprise DNS sends the next DNS request to the DNS server learned at the previous step—this time the TLD DNS server for the .com domain. This DNS also does not know the address, but it knows the DNS server that should be the authorita-tive DNS server for domain cisco.com, so it supplies that DNS server’s address. +4. The enterprise DNS sends another DNS request, to the DNS server whose address was learned in the previous step, again asking for resolution of the name www.cisco.com. This DNS server, the authoritative server for cisco.com, supplies the address. +5. The enterprise DNS server returns a DNS reply back to the client, supplying the IP address requested at step 1. + +Transferring Files with HTTP +After a web client (browser) has created a TCP connection to a web server, the client can begin requesting the web page from the server. Most often, the protocol used to transfer the web page is HTTP. The HTTP application layer protocol, defined in RFC 7230, defines how files can be transferred between two computers. HTTP was specifically created for the purpose of transferring files between web servers and web clients. + +HTTP defines several commands and responses, with the most frequently used being the HTTP GET request. To get a file from a web server, the client sends an HTTP GET request to the server, listing the filename. If the server decides to send the file, the server sends an HTTP GET response, with a return code of 200 (meaning OK), along with the file’s contents. + +NOTE Many return codes exist for HTTP requests. For example, when the server does not have the requested file, it issues a return code of 404, which means “file not found.” Most web browsers do not show the specific numeric HTTP return codes, instead displaying a response such as “page not found” in reaction to receiving a return code of 404. + +Web pages typically consist of multiple files, called objects. Most web pages contain text as well as several graphical images, animated advertisements, and possibly voice or video. Each of these components is stored as a different object (file) on the web server. To get them all, the web browser gets the first file. This file can (and typically does) include references to other URIs, so the browser then also requests the other objects. Figure 1-14 shows the gen-eral idea, with the browser getting the first file and then two others. + + + +HTTP GET (/go/ccna) +www.cisco.com + +User Typed: http://www.cisco.com/go/ccna + + + +HTTP OK data: /go/ccna + +HTTP GET /graphics/logo1.gif + +HTTP OK data: logo1.gif + +Web Browser (Client) + + +HTTP GET /graphics/ad1.gif + +HTTP OK data: ad1.gif + +Figure 1-14 Multiple HTTP GET Requests/Responses +Chapter 1: Introduction to TCP/IP Transport and Applications + +In this case, after the web browser gets the first file—the one called “/go/ccna” in the URI—the browser reads and interprets that file. Besides containing parts of the web page, +the file refers to two other files, so the browser issues two additional HTTP GET requests. Note that, even though it isn’t shown in the figure, all these commands flow over one (or possibly more) TCP connection between the client and the server. This means that TCP would provide error recovery, ensuring that the data was delivered. + +How the Receiving Host Identifies the Correct Receiving Application This chapter closes with a discussion of the process by which a host, when receiving any message over any network, can decide which of its many application programs should pro-cess the received data. + +As an example, consider host A shown on the left side of Figure 1-15. The host happens to have three different web browser windows open, each using a unique TCP port. Host A +also has an email client and a chat window open, both of which use TCP. Both the email and chat applications use a unique TCP port number on host A as shown in the figure. + +21 + + + +1 + + + + +A +Eth. IP + +Web Server + +TCP HTTP + (Dest Port) Data + + + +Browser: Browser: Browser: Email: Chat: + +TCP port 49124 TCP port 49125 TCP port 49126 TCP port 49127 TCP port 49128 + +Figure 1-15 Dilemma: How Host A Chooses the App That Should Receive This Data + +This chapter has shown several examples of how transport layer protocols use the destina-tion port number field in the TCP or UDP header to identify the receiving application. For instance, if the destination TCP port value in Figure 1-15 is 49124, host A will know that the data is meant for the first of the three web browser windows. + +Before a receiving host can even examine the TCP or UDP header, and find the destination port field, it must first process the outer headers in the message. If the incoming message is an Ethernet frame that encapsulates an IPv4 packet, the headers look like the details in Figure 1-16. + +0x0800 6 49124 Web Server + + + +Ethernet (Type) + +IPv4 (Protocol) + +TCP (Dest Port) + +HTTP and Data + +Figure 1-16 Three Key Fields with Which to Identify the Next Header + +The receiving host needs to look at multiple fields, one per header, to identify the next header or field in the received message. For instance, host A uses an Ethernet NIC to con-nect to the network, so the received message is an Ethernet frame. The Ethernet Type field identifies the type of header that follows the Ethernet header—in this case, with a value of hex 0800, an IPv4 header. +22 CCNA 200-301 Official Cert Guide, Volume 2 + +The IPv4 header has a similar field called the IP Protocol field. The IPv4 Protocol field has a standard list of values that identify the next header, with decimal 6 used for TCP and deci-mal 17 used for UDP. In this case, the value of 6 identifies the TCP header that follows the IPv4 header. Once the receiving host realizes a TCP header exists, it can process the destina-tion port field to determine which local application process should receive the data. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 1-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 1-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Repeat DIKTA questions +Review memory tables + +Resource Used Book, website Book, website Book, PTP +Book, website + + +Review All the Key Topics Table 1-5 Key Topics for Chapter 1 + +Key Topic Element Table 1-2 +Table 1-3 +Figure 1-5 + +Description +Functions of TCP and UDP +Well-known TCP and UDP port numbers +Example of TCP connection establishment + +Page Number 6 +11 +12 + +List Definitions of connection-oriented and connectionless 13 + +Figure 1-12 +Figure 1-16 + +DNS name resolution 18 +Header fields that identify the next header 21 + + +Key Terms You Should Know +connection establishment, error detection, error recovery, flow control, forward acknowl-edgment, HTTP, ordered data transfer, port, segment, sliding windows, URI, web server, DNS server, recursive DNS server + + + + + + + + +This page intentionally left blank +CHAPTER 2 + + + +Basic IPv4 Access Control Lists This chapter covers the following exam topics: +5.0 Security Fundamentals +5.6 Configure and verify access control lists + + +IPv4 access control lists (ACL) give network engineers the ability to program a filter into a router. Each router, on each interface, for both the inbound and outbound direction, can enable a different ACL with different rules. Each ACL’s rules tell the router which packets to discard and which to allow through. + +This chapter discusses the basics of IPv4 ACLs, and in particular, one type of IP ACL: stan-dard numbered IP ACLs. Standard numbered ACLs use simple logic, matching on the source IP address field only, and use a configuration style that references the ACL using a number. This chapter sets out to help you learn this simpler type of ACL first. The next chapter, titled, “Advanced IPv4 Access Control Lists,” completes the discussion by describing other types of IP ACLs. The other types of ACLs use features that build on the concepts you learn in this chapter, but with more complexity and additional configuration options. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 2-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section IP Access Control List Basics Standard Numbered IPv4 ACLs +Practice Applying Standard IP ACLs + +Questions 1 +2–5 +6 + + +1. Barney is a host with IP address 10.1.1.1 in subnet 10.1.1.0/24. Which of the fol-lowing are things that a standard IP ACL could be configured to do? (Choose two answers.) +a. Match the exact source IP address. +b. Match IP addresses 10.1.1.1 through 10.1.1.4 with one access-list command without matching other IP addresses. +c. Match all IP addresses in Barney’s subnet with one access-list command without matching other IP addresses. +d. Match only the packet’s destination IP address. + + + + +2. Which of the following answers list a valid number that can be used with standard numbered IP ACLs? (Choose two answers.) +a. 1987 b. 2187 c. 187 d. 87 +3. Which of the following wildcard masks is most useful for matching all IP packets in subnet 10.1.128.0, mask 255.255.255.0? +a. 0.0.0.0 b. 0.0.0.31 c. 0.0.0.240 d. 0.0.0.255 e. 0.0.15.0 +f. 0.0.248.255 + +4. Which of the following wildcard masks is most useful for matching all IP packets in subnet 10.1.128.0, mask 255.255.240.0? +a. 0.0.0.0 b. 0.0.0.31 c. 0.0.0.240 d. 0.0.0.255 +e. 0.0.15.255 f. 0.0.248.255 +5. ACL 1 has three statements, in the following order, with address and wildcard mask values as follows: 1.0.0.0 0.255.255.255, 1.1.0.0 0.0.255.255, and 1.1.1.0 0.0.0.255. If a router tried to match a packet sourced from IP address 1.1.1.1 using this ACL, which ACL statement does a router consider the packet to have matched? +a. First +b. Second c. Third +d. Implied deny at the end of the ACL + +6. Which of the following access-list commands matches all packets sent from hosts in subnet 172.16.4.0/23? + +a. access-list 1 permit 172.16.0.5 0.0.255.0 b. access-list 1 permit 172.16.4.0 0.0.1.255 c. access-list 1 permit 172.16.5.0 +d. access-list 1 permit 172.16.5.0 0.0.0.127 +26 CCNA 200-301 Official Cert Guide, Volume 2 + +Foundation Topics + +IPv4 Access Control List Basics +IPv4 access control lists (IP ACL) give network engineers a way to identify different types of packets. To do so, the ACL configuration lists values that the router can see in the IP, TCP, UDP, and other headers. For example, an ACL can match packets whose source +IP address is 1.1.1.1, or packets whose destination IP address is some address in subnet 10.1.1.0/24, or packets with a destination port of TCP port 23 (Telnet). + +IPv4 ACLs perform many functions in Cisco routers, with the most common use as a packet filter. Engineers can enable ACLs on a router so that the ACL sits in the forwarding path of packets as they pass through the router. After it is enabled, the router considers whether each IP packet will either be discarded or allowed to continue as if the ACL did not exist. +However, ACLs can be used for many other IOS features as well. As an example, ACLs can be used to match packets for applying Quality of Service (QoS) features. QoS allows a rout-er to give some packets better service, and other packets worse service. For example, pack-ets that hold digitized voice need to have very low delay, so ACLs can match voice packets, with QoS logic in turn forwarding voice packets more quickly than data packets. + +This first section introduces IP ACLs as used for packet filtering, focusing on these aspects of ACLs: the locations and direction in which to enable ACLs, matching packets by examin-ing headers, and taking action after a packet has been matched . + +ACL Location and Direction +Cisco routers can apply ACL logic to packets at the point at which the IP packets enter an interface, or the point at which they exit an interface. In other words, the ACL becomes associated with an interface and for a direction of packet flow (either in or out). That is, the ACL can be applied inbound to the router, before the router makes its forwarding (routing) decision, or outbound, after the router makes its forwarding decision and has determined the exit interface to use. + +The arrows in Figure 2-1 show the locations at which you could filter packets flowing left to right in the topology. For example, imagine that you wanted to allow packets sent by host A to server S1, but to discard packets sent by host B to server S1. Each arrowed line represents a location and direction at which a router could apply an ACL, filtering the pack-ets sent by host B. + +The four arrowed lines in the figure point out the location and direction for the router interfaces used to forward the packet from host B to server S1. In this particular example, those interfaces and direction are inbound on R1’s F0/0 interface, outbound on R1’s S0/0/0 interface, inbound on R2’s S0/0/1 interface, and outbound on R2’s F0/0 interface. If, for example, you enabled an ACL on R2’s F0/1 interface, in either direction, that ACL could not possibly filter the packet sent from host B to server S1, because R2’s F0/1 interface is not part of the route from B to S1. + + + +Answers to the “Do I Know This Already?” quiz: 1 A, C 2 A, D 3 D 4 E 5 A 6 B +Chapter 2: Basic IPv4 Access Control Lists 27 + + +A +S1 + + +F0/0 +B + + +R1 S0/0/0 S0/0/1 R2 F0/0 +F0/1 2 + + + + +S2 + +Figure 2-1 Locations to Filter Packets from Hosts A and B Going Toward Server S1 + +In short, to filter a packet, you must enable an ACL on an interface that processes the pack-et, in the same direction the packet flows through that interface. + +When enabled, the router then processes every inbound or outbound IP packet using that ACL. For example, if enabled on R1 for packets inbound on interface F0/0, R1 would com-pare every inbound IP packet on F0/0 to the ACL to decide that packet’s fate: to continue unchanged or to be discarded . + +Matching Packets +When you think about the location and direction for an ACL, you must already be thinking about what packets you plan to filter (discard), and which ones you want to allow through. To tell the router those same ideas, you must configure the router with an IP ACL that matches packets. Matching packets refers to how to configure the ACL commands to look at each packet, listing how to identify which packets should be discarded and which should be allowed through. + +Each IP ACL consists of one or more configuration commands, with each command listing details about values to look for inside a packet’s headers. Generally, an ACL command uses logic like “look for these values in the packet header, and if found, discard the packet.” (The action could instead be to allow the packet, rather than discard.) Specifically, the ACL looks for header fields you should already know well, including the source and destination IP addresses, plus TCP and UDP port numbers. + +For example, consider an example with Figure 2-2, in which you want to allow packets from host A to server S1, but to discard packets from host B going to that same server. The hosts all now have IP addresses, and the figure shows pseudocode for an ACL on R2. Figure 2-2 also shows the chosen location to enable the ACL: inbound on R2’s S0/0/1 interface. + +Figure 2-2 shows a two-line ACL in a rectangle at the bottom, with simple matching logic: both statements just look to match the source IP address in the packet. When enabled, R2 looks at every inbound IP packet on that interface and compares each packet to those two ACL commands. Packets sent by host A (source IP address 10.1.1.1) are allowed through, and those sourced by host B (source IP address 10.1.1.2) are discarded . +28 CCNA 200-301 Official Cert Guide, Volume 2 + +S_IP = 10.1.1.1 + +10.1.1.1 + +A +S1 + + +F0/0 B + +R1 S0/0/0 S0/0/1 R2 F0/0 + + + +10.1.1.2 + +S_IP = 10.1.1.2 + + +1) If S_IP = 10.1.1.1, Allow 2) If S_IP = 10.1.1.2, Discard + + +Figure 2-2 Pseudocode to Demonstrate ACL Command-Matching Logic + +Taking Action When a Match Occurs +When using IP ACLs to filter packets, only one of two actions can be chosen. The configu-ration commands use the keywords deny and permit, and they mean (respectively) to dis-card the packet or to allow it to keep going as if the ACL did not exist. + +This book focuses on using ACLs to filter packets, but IOS uses ACLs for many more fea-tures. Those features typically use the same matching logic. However, in other cases, the deny or permit keywords imply some other action. + +Types of IP ACLs +Cisco IOS has supported IP ACLs since the early days of Cisco routers. Beginning with the original standard numbered IP ACLs in the early days of IOS, which could enable the logic shown earlier around Figure 2-2, Cisco has added many ACL features, including the following: + +■ Standard numbered ACLs (1–99) +■ Extended numbered ACLs (100–199) +■ Additional ACL numbers (1300–1999 standard, 2000–2699 extended) ■ Named ACLs +■ Improved editing with sequence numbers + +This chapter focuses solely on standard numbered IP ACLs, while the next chapter discusses the other three primary categories of IP ACLs. Briefly, IP ACLs will be either numbered or named in that the configuration identifies the ACL either using a number or a name. ACLs will also be either standard or extended, with extended ACLs having much more robust abilities in matching packets. Figure 2-3 summarizes the big ideas related to categories of IP ACLs. +Chapter 2: Basic IPv4 Access Control Lists 29 + + + +Standard Numbered + + +Standard Named + +Standard: Matching +- Source IP + + + +2 + + +Extended Numbered + + + +Numbered: +- ID with Number +- Global Commands + + +Extended Named + + + +Named: +- ID with Name +- Subcommands + +Extended: Matching - Source & Dest. IP +- Source & Dest. Port +- Others + + +Figure 2-3 Comparisons of IP ACL Types + +Standard Numbered IPv4 ACLs +The title of this section serves as a great introduction, if you can decode what Cisco means by each specific word. This section is about a type of Cisco filter (ACL) that matches only the source IP address of the packet (standard), is configured to identify the ACL using numbers rather than names (numbered), and looks at IPv4 packets. + +This section examines the particulars of standard numbered IP ACLs. First, it examines the idea that one ACL is a list and what logic that list uses. Following that, the text closely looks at how to match the source IP address field in the packet header, including the syntax of the commands. This section ends with a complete look at the configuration and verification commands to implement standard ACLs. + +List Logic with IP ACLs +A single ACL is both a single entity and, at the same time, a list of one or more configura-tion commands. As a single entity, the configuration enables the entire ACL on an interface, in a specific direction, as shown earlier in Figure 2-1. As a list of commands, each command has different matching logic that the router must apply to each packet when filtering using that ACL. + +When doing ACL processing, the router processes the packet, compared to the ACL, as follows: + +ACLs use first-match logic. Once a packet matches one line in the ACL, the router takes the action listed in that line of the ACL and stops looking further in the ACL. + +To see exactly what that means, consider the example built around Figure 2-4. The figure shows an example ACL 1 with three lines of pseudocode. This example applies ACL 1 on R2’s S0/0/1 interface, inbound (the same location as in earlier Figure 2-2). +30 CCNA 200-301 Official Cert Guide, Volume 2 + + +10.1.1.1 +A + + +B + +10.1.1.2 + + + + +F0/0 R1 S0/0/0 F0/1 + +C + +10.3.3.3 + + + +S1 S0/0/1 R2 F0/0 + +ACL 1 Pseudocode +If Source = 10.1.1.1 Permit If Source = 10.1.1.x Deny If Source = 10.x.x.x Permit + +Figure 2-4 Backdrop for Discussion of List Process with IP ACLs + +Consider the first-match ACL logic for a packet sent by host A to server S1. The source IP address will be 10.1.1.1, and it will be routed so that it enters R2’s S0/0/1 interface, driving R2’s ACL 1 logic. R2 compares this packet to the ACL, matching the first item in the list with a permit action. So this packet should be allowed through, as shown in Figure 2-5, on the left. + + +Host A +S_IP = 10.1.1.1 + +If Source = 10.1.1.1 Permit If Source = 10.1.1.x Deny +If Source = 10.x.x.x Permit + +Host B +S_IP = 10.1.1.2 + +If Source = 10.1.1.1 Permit If Source = 10.1.1.x Deny +If Source = 10.x.x.x Permit + +Host C +S_IP = 10.3.3.3 + +If Source = 10.1.1.1 Permit If Source = 10.1.1.x Deny +If Source = 10.x.x.x Permit + + +Legend: + +S_IP Source IP Address Examined and matched Examined and not matched +Figure 2-5 ACL Items Compared for Packets from Hosts A, B, and C in Figure 2-4 + +Next, consider a packet sent by host B, source IP address 10.1.1.2. When the packet enters R2’s S0/0/1 interface, R2 compares the packet to ACL 1’s first statement and does not make a match (10.1.1.1 is not equal to 10.1.1.2). R2 then moves to the second statement, which requires some clarification. The ACL pseudocode, back in Figure 2-4, shows 10.1.1.x, which is meant to be shorthand that any value can exist in the last octet. Comparing only the first three octets, R2 decides that this latest packet does have a source IP address that begins with the first three octets 10.1.1, so R2 considers that to be a match on the second state-ment. R2 takes the listed action (deny), discarding the packet. R2 also stops ACL processing on the packet, ignoring the third line in the ACL. + +Finally, consider a packet sent by host C, again to server S1. The packet has source IP address 10.3.3.3, so when it enters R2’s S0/0/1 interface and drives ACL processing on R2, R2 looks at the first command in ACL 1. R2 does not match the first ACL command +(10.1.1.1 in the command is not equal to the packet’s 10.3.3.3). R2 looks at the second com-mand, compares the first three octets (10.1.1) to the packet source IP address (10.3.3), and still finds no match. R2 then looks at the third command. In this case, the wildcard means ignore the last three octets and just compare the first octet (10), so the packet matches. R2 then takes the listed action (permit), allowing the packet to keep going. +Chapter 2: Basic IPv4 Access Control Lists + +This sequence of processing an ACL as a list happens for any type of IOS ACL: IP, other protocols, standard or extended, named or numbered. + +Finally, if a packet does not match any of the items in the ACL, the packet is discarded. The reason is that every IP ACL has a deny all statement implied at the end of the ACL. It does not exist in the configuration, but if a router keeps searching the list, and no match is made by the end of the list, IOS considers the packet to have matched an entry that has a deny action. + +Matching Logic and Command Syntax +Standard numbered IP ACLs use the following global command: + +access-list {1-99 | 1300-1999} {permit | deny} matching-parameters + +31 + + + + + + +2 + + +Each standard numbered ACL has one or more access-list commands with the same num-ber, any number from the ranges shown in the preceding line of syntax. (One number is no better than the other.) IOS refers to each line in an ACL as an Access Control Entry (ACE), but many engineers just call them ACL statements. +Besides the ACL number, each access-list command also lists the action (permit or deny), plus the matching logic. The rest of this section examines how to configure the matching parameters, which, for standard ACLs, means that you can only match the source IP address or portions of the source IP address using something called an ACL wildcard mask. + +Matching the Exact IP Address +To match a specific source IP address, the entire IP address, all you have to do is type that IP address at the end of the command. For example, the previous example uses pseudocode for “permit if source = 10.1.1.1.” The following command configures that logic with correct syntax using ACL number 1: + +access-list 1 permit 10.1.1.1 + +Matching the exact full IP address is that simple. + +In earlier IOS versions, the syntax included a host keyword. Instead of simply typing the full IP address, you first typed the host keyword and then the IP address. Note that in later IOS versions, if you use the host keyword, IOS accepts the command but then removes the keyword. + +access-list 1 permit host 10.1.1.1 + +Matching a Subset of the Address with Wildcards +Often, the business goals you want to implement with an ACL do not match a single partic-ular IP address, but rather a range of IP addresses. Maybe you want to match all IP address-es in a subnet. Maybe you want to match all IP addresses in a range of subnets. Regardless, you want to check for more than one IP address in a range of addresses. + +IOS allows standard ACLs to match a range of addresses using a tool called a wildcard mask. Note that this is not a subnet mask. The wildcard mask (which this book abbreviates as WC mask) gives the engineer a way to tell IOS to ignore parts of the address when mak-ing comparisons, essentially treating those parts as wildcards, as if they already matched. +32 CCNA 200-301 Official Cert Guide, Volume 2 + +You can think about WC masks in decimal and in binary, and both have their uses. To begin, think about WC masks in decimal, using these rules: + +Decimal 0: The router must compare this octet as normal. +Decimal 255: The router ignores this octet, considering it to already match. + +Keeping these two rules in mind, consider Figure 2-6, which demonstrates this logic using three different but popular WC masks: one that tells the router to ignore the last octet, one that tells the router to ignore the last two octets, and one that tells the router to ignore the last three octets. + + +10 . 1 . 2 . 0 10 . 1 . 2 . 1 + +10 . 1 . 0 . 0 10 . 1 . 4 . 5 + +10 . 0 . 0 . 0 10 . 2 . 3 . 4 + + + +0 . 0 . 0 .255 0 . 0 .255 .255 0 .255 .255 .255 + +255 = Ignore +Figure 2-6 Logic for WC Masks 0.0.0.255, 0.0.255.255, and 0.255.255.255 + +All three examples in the boxes of Figure 2-6 show two numbers that are clearly different. The WC mask causes IOS to compare only some of the octets, while ignoring other octets. All three examples result in a match, because each wildcard mask tells IOS to ignore some octets. The example on the left shows WC mask 0.0.0.255, which tells the router to treat the last octet as a wildcard, essentially ignoring that octet for the comparison. Similarly, the middle example shows WC mask 0.0.255.255, which tells the router to ignore the two +octets on the right. The rightmost case shows WC mask 0.255.255.255, telling the router to ignore the last three octets when comparing values. + +To see the WC mask in action, think back to the earlier example related to Figure 2-4 and Figure 2-5. The pseudocode ACL in those two figures used logic that can be created using a WC mask. As a reminder, the logic in the pseudocode ACL in those two figures included the following: + +Line 1: Match and permit all packets with a source address of exactly 10.1.1.1. +Line 2: Match and deny all packets with source addresses with first three octets 10.1.1. Line 3: Match and permit all addresses with first single octet 10. + +Figure 2-7 shows the updated version of Figure 2-4, but with the completed, correct syntax, including the WC masks. In particular, note the use of WC mask 0.0.0.255 in the second command, telling R2 to ignore the last octet of the number 10.1.1.0, and the WC mask 0.255.255.255 in the third command, telling R2 to ignore the last three octets in the value 10.0.0.0. + +Finally, note that when using a WC mask, the access-list command’s loosely defined source parameter should be a 0 in any octets where the WC mask is a 255. IOS will specify a source address to be 0 for the parts that will be ignored, even if nonzero values were configured. +Chapter 2: Basic IPv4 Access Control Lists 33 + + +10.1.1.1 +A + +B F0/0 R1 F0/1 +10.1.1.2 + + + +S0/0/1 +S0/0/0 R2 F0/0 + +ACL 1 + + + +S1 + + +2 + + + +C + +10.3.3.3 + +access-list 1 permit 10.1.1.1 +access-list 1 deny 10.1.1.0 0.0.0.255 access-list 1 permit 10.0.0.0 0.255.255.255 + +Figure 2-7 Syntactically Correct ACL Replaces Pseudocode from Figure 2-4 + +Binary Wildcard Masks +Wildcard masks, as dotted-decimal number (DDN) values, actually represent a 32-bit binary number. As a 32-bit number, the WC mask actually directs the router’s logic bit by bit. In short, a WC mask bit of 0 means the comparison should be done as normal, but a binary 1 means that the bit is a wildcard and can be ignored when comparing the numbers. + +Thankfully, for the purposes of CCNA study, and for most real-world applications, you can ignore the binary WC mask. Why? Well, we generally want to match a range of addresses that can be easily identified by a subnet number and mask, whether it be a real subnet, or +a summary route that groups subnets together. If you can describe the range of addresses with a subnet number and mask, you can find the numbers to use in your ACL with some simple decimal math, as discussed next. + +NOTE If you really want to know the binary mask logic, take the two DDN numbers the ACL will compare (one from the access-list command and the other from the packet header) and convert both to binary. Then, also convert the WC mask to binary. Compare the first two binary numbers bit by bit, but also ignore any bits for which the WC mask +happens to list a binary 1, because that tells you to ignore the bit. If all the bits you checked are equal, it’s a match! + +Finding the Right Wildcard Mask to Match a Subnet +In many cases, an ACL needs to match all hosts in a particular subnet. To match a subnet with an ACL, you can use the following shortcut: + +■ Use the subnet number as the source value in the access-list command. +■ Use a wildcard mask found by subtracting the subnet mask from 255.255.255.255. + +For example, for subnet 172.16.8.0 255.255.252.0, use the subnet number (172.16.8.0) as the address parameter, and then do the following math to find the wildcard mask: + +255.255.255.255 – 255.255.252.0 0. 0. 3.255 + +Continuing this example, a completed command for this same subnet would be as follows: + +access-list 1 permit 172.16.8.0 0.0.3.255 +34 CCNA 200-301 Official Cert Guide, Volume 2 + +The section “Practice Applying Standard IP ACLs” gives you a chance to practice matching subnets when configuring ACLs. + +Matching Any/All Addresses +In some cases, you will want one ACL command to match any and all packets that reach that point in the ACL. First, you have to know the (simple) way to match all packets using the any keyword. More importantly, you need to think about when to match any and all packets. + +First, to match any and all packets with an ACL command, just use the any keyword for the address. For example, to permit all packets: + +access-list 1 permit any + +So, when and where should you use such a command? Remember, all Cisco IP ACLs end with an implicit deny any concept at the end of each ACL. That is, if a router compares a packet to the ACL, and the packet matches none of the configured statements, the router discards the packet. Want to override that default behavior? Configure a permit any at the end of the ACL. + +You might also want to explicitly configure a command to deny all traffic (for example, access-list 1 deny any) at the end of an ACL. Why, when the same logic already sits at the end of the ACL anyway? Well, the ACL show commands list counters for the number of packets matched by each command in the ACL, but there is no counter for that implicit deny any concept at the end of the ACL. So, if you want to see counters for how many packets are matched by the deny any logic at the end of the ACL, configure an explicit deny any. + +Implementing Standard IP ACLs +This chapter has already introduced all the configuration steps in bits and pieces. This sec-tion summarizes those pieces as a configuration process. The process also refers to the access-list command, whose generic syntax is repeated here for reference: + +access-list access-list-number {deny | permit} source [source-wildcard] + +Step 1. Plan the location (router and interface) and direction (in or out) on that interface: +A. Standard ACLs should be placed near to the destination of the packets so that they do not unintentionally discard packets that should not be discarded. +B. Because standard ACLs can only match a packet’s source IP address, iden-tify the source IP addresses of packets as they go in the direction that the ACL is examining. +Step 2. Configure one or more access-list global configuration commands to create the ACL, keeping the following in mind: +A. The list is searched sequentially, using first-match logic. +B. The default action, if a packet does not match any of the access-list com-mands, is to deny (discard) the packet. +Step 3. Enable the ACL on the chosen router interface, in the correct direction, using the ip access-group number {in | out} interface subcommand. + +The rest of this section shows a couple of examples. +Chapter 2: Basic IPv4 Access Control Lists 35 + +Standard Numbered ACL Example 1 +The first example shows the configuration for the same requirements demonstrated with Figure 2-4 and Figure 2-5. Restated, the requirements for this ACL are as follows: + +1. Enable the ACL inbound on R2’s S0/0/1 interface. +2. Permit packets coming from host A. 2 3. Deny packets coming from other hosts in host A’s subnet. +4. Permit packets coming from any other address in Class A network 10.0.0.0. +5. The original example made no comment about what to do by default, so simply deny all other traffic. + +Example 2-1 shows a completed correct configuration, starting with the configuration pro-cess, followed by output from the show running-config command. +Example 2-1 Standard Numbered ACL Example 1 Configuration + +R2# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)# access-list 1 permit 10.1.1.1 +R2(config)# access-list 1 deny 10.1.1.0 0.0.0.255 +R2(config)# access-list 1 permit 10.0.0.0 0.255.255.255 +R2(config)# interface S0/0/1 +R2(config-if)# ip access-group 1 in +R2(config-if)# ^Z +R2# show running-config +! Lines omitted for brevity + +access-list 1 permit 10.1.1.1 +access-list 1 deny 10.1.1.0 0.0.0.255 +access-list 1 permit 10.0.0.0 0.255.255.255 + +First, pay close attention to the configuration process at the top of the example. Note that the access-list command does not change the command prompt from the global configura-tion mode prompt, because the access-list command is a global configuration command. Then, compare that to the output of the show running-config command: the details are identical compared to the commands that were added in configuration mode. Finally, make sure to note the ip access-group 1 in command, under R2’s S0/0/1 interface, which enables the ACL logic (both location and direction). + +Example 2-2 lists some output from Router R2 that shows information about this ACL. The show ip access-lists command lists details about IPv4 ACLs only, while the show access-lists command lists details about IPv4 ACLs plus any other types of ACLs that are currently configured; for example, IPv6 ACLs. +Example 2-2 ACL show Commands on R2 + +R2# show ip access-lists +Standard IP access list 1 +10 permit 10.1.1.1 (107 matches) +20 deny 10.1.1.0, wildcard bits 0.0.0.255 (4 matches) +36 CCNA 200-301 Official Cert Guide, Volume 2 + +30 permit 10.0.0.0, wildcard bits 0.255.255.255 (10 matches) +R2# show access-lists +Standard IP access list 1 +10 permit 10.1.1.1 (107 matches) +20 deny 10.1.1.0, wildcard bits 0.0.0.255 (4 matches) +30 permit 10.0.0.0, wildcard bits 0.255.255.255 (10 matches) +R2# show ip interface s0/0/1 +Serial0/0/1 is up, line protocol is up +Internet address is 10.1.2.2/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.9 +Outgoing access list is not set +Inbound access list is 1 +! Lines omitted for brevity + +The output of these commands shows two items of note. The first line of output in this case notes the type (standard) and the number. If more than one ACL existed, you would see multiple stanzas of output, one per ACL, each with a heading line like this one. Next, these commands list packet counts for the number of packets that the router has matched with each command. For example, 107 packets so far have matched the first line in the ACL. + +Finally, the end of the example lists the show ip interface command output. This command lists, among many other items, the number or name of any IP ACL enabled on the interface per the ip access-group interface subcommand. + +Standard Numbered ACL Example 2 +For the second example, use Figure 2-8, and imagine your boss gives you some require-ments hurriedly in the hall. At first, he tells you he wants to filter packets going from the servers on the right toward the clients on the left. Then, he says he wants you to allow access for hosts A, B, and other hosts in their same subnet to server S1, but deny access to that server to the hosts in host C’s subnet. Then, he tells you that, additionally, hosts in +host A’s subnet should be denied access to server S2, but hosts in host C’s subnet should be allowed access to server S2—all by filtering packets going right to left only. He then tells you to put the ACL inbound on R2’s F0/0 interface. + + +10.1.1.1/24 + +A + +F0/0 B + +10.1.1.2/24 + + + + +S0/0/0 +R1 +F0/1 + +C +10.3.3.3 + +10.2.2.1 + +S1 S0/0/1 R2 F0/0 + +S2 + +10.2.2.2 + + +Figure 2-8 Standard Numbered ACL Example 2 +Chapter 2: Basic IPv4 Access Control Lists 37 + +If you cull through all the boss’s comments, the requirements might be reduced to the following: + +1. Enable the ACL inbound on R2’s F0/0 interface. +2. Permit packets from server S1 going to hosts in A’s subnet. +3. Deny packets from server S1 going to hosts in C’s subnet. 2 4. Permit packets from server S2 going to hosts in C’s subnet. +5. Deny packets from server S2 going to hosts in A’s subnet. +6. (There was no comment about what to do by default; use the implied deny all default.) + +As it turns out, you cannot do everything your boss asked with a standard ACL. For example, consider the obvious command for requirement number 2: access-list 2 permit 10.2.2.1. That permits all traffic whose source IP is 10.2.2.1 (server S1). The very next requirement asks you to filter (deny) packets sourced from that same IP address! Even if you added another command that checked for source IP address 10.2.2.1, the router would never get to it, because routers use first-match logic when searching the ACL. You cannot check both the destination and source IP address, because standard ACLs cannot check the destination IP address. + +To solve this problem, you should get a new boss! No, seriously, you have to rethink the problem and change the rules. In real life, you would probably use an extended ACL instead, which lets you check both the source and destination IP address. +For the sake of practicing another standard ACL, imagine your boss lets you change the requirements. First, you will use two outbound ACLs, both on Router R1. Each ACL will permit traffic from a single server to be forwarded onto that connected LAN, with the fol-lowing modified requirements: + +1. Using an outbound ACL on R1’s F0/0 interface, permit packets from server S1, and deny all other packets. +2. Using an outbound ACL on R1’s F0/1 interface, permit packets from server S2, and deny all other packets. + +Example 2-3 shows the configuration that completes these requirements. + +Example 2-3 Alternative Configuration in Router R1 + +access-list 2 remark This ACL permits server S1 traffic to host A's subnet +access-list 2 permit 10.2.2.1 +! +access-list 3 remark This ACL permits server S2 traffic to host C's subnet +access-list 3 permit 10.2.2.2 +! +interface F0/0 +ip access-group 2 out +! +interface F0/1 +ip access-group 3 out +38 CCNA 200-301 Official Cert Guide, Volume 2 + +As highlighted in the example, the solution with ACL number 2 permits all traffic from server S1, with that logic enabled for packets exiting R1’s F0/0 interface. All other traffic will be discarded because of the implied deny all at the end of the ACL. In addition, ACL 3 permits traffic from server S2, which is then permitted to exit R1’s F0/1 interface. Also, note that the solution shows the use of the access-list remark parameter, which allows you to leave text documentation that stays with the ACL. + +NOTE When routers apply an ACL to filter packets in the outbound direction, as shown in Example 2-3, the router checks packets that it routes against the ACL. However, a router does not filter packets that the router itself creates with an outbound ACL. Examples +of those packets include routing protocol messages and packets sent by the ping and traceroute commands on that router. + +Troubleshooting and Verification Tips +Troubleshooting IPv4 ACLs requires some attention to detail. In particular, you have to be ready to look at the address and wildcard mask and confidently predict the addresses +matched by those two combined parameters. The upcoming practice problems a little later in this chapter can help prepare you for that part of the work. But a few other tips can help you verify and troubleshoot ACL problems on the exams as well. + +First, you can tell if the router is matching packets or not with a couple of tools. Example 2-2 already showed that IOS keeps statistics about the packets matched by each line of an ACL. In addition, if you add the log keyword to the end of an access-list command, IOS then issues log messages with occasional statistics about matches of that particular line of the ACL. Both the statistics and the log messages can be helpful in deciding which line in the ACL is being matched by a packet. +For example, Example 2-4 shows an updated version of ACL 2 from Example 2-3, this time with the log keyword added. The bottom of the example then shows a typical log message, this one showing the resulting match based on a packet with source IP address 10.2.2.1 (as matched with the ACL), to destination address 10.1.1.1. +Example 2-4 Creating Log Messages for ACL Statistics + +R1# show running-config +! lines removed for brevity +access-list 2 remark This ACL permits server S1 traffic to host A's subnet +access-list 2 permit 10.2.2.1 log +! +interface F0/0 +ip access-group 2 out + +R1# +Feb 4 18:30:24.082: %SEC-6-IPACCESSLOGNP: list 2 permitted 0 10.2.2.1 -> 10.1.1.1, 1 packet + +When you troubleshoot an ACL for the first time, before getting into the details of the matching logic, take the time to think about both the interface on which the ACL is enabled and the direction of packet flow. Sometimes, the matching logic is perfect—but the ACL +Chapter 2: Basic IPv4 Access Control Lists + +has been enabled on the wrong interface, or for the wrong direction, to match the packets as configured for the ACL. + +For example, Figure 2-9 repeats the same ACL shown earlier in Figure 2-7. The first line of that ACL matches the specific host address 10.1.1.1. If that ACL exists on Router R2, plac-ing that ACL as an inbound ACL on R2’s S0/0/1 interface can work, because packets sent by host 10.1.1.1—on the left side of the figure—can enter R2’s S0/0/1 interface. However, if R2 enables ACL 1 on its F0/0 interface, for inbound packets, the ACL will never match a packet with source IP address 10.1.1.1, because packets sent by host 10.1.1.1 will never +enter that interface. Packets sent by 10.1.1.1 will exit R2’s F0/0 interface, but never enter it, just because of the network topology. + +39 + + + + + + +2 + + +ACL 1 +access-list 1 permit 10.1.1.1 +access-list 1 deny 10.1.1.0 0.0.0.255 10.1.1.1 access-list 1 permit 10.0.0.0 0.255.255.255 + +A + +F0/0 B + + + +R1 S0/0/0 +F0/1 + + +S0/0/1 F0/0 +S1 R2 + + + +10.1.1.2 C 10.3.3.3 + + +Can Match 10.1.1.1 + + +Cannot Match 10.1.1.1 + +Figure 2-9 Example of Checking the Interface and Direction for an ACL + +Practice Applying Standard IP ACLs +Some CCNA topics, like ACLs, simply require more drills and practice than others. ACLs require you to think of parameters to match ranges of numbers, and that of course requires some use of math and some use of processes. + +This section provides some practice problems and tips, from two perspectives. First, this section asks you to build one-line standard ACLs to match some packets. Second, this sec-tion asks you to interpret existing ACL commands to describe what packets the ACL will match. Both skills are useful for the exams. + +Practice Building access-list Commands +In this section, practice getting comfortable with the syntax of the access-list command, particularly with choosing the correct matching logic. These skills will be helpful when read-ing about extended and named ACLs in the next chapter. + +First, the following list summarizes some important tips to consider when choosing match-ing parameters to any access-list command: + +■ To match a specific address, just list the address. +■ To match any and all addresses, use the any keyword. +■ To match based only on the first one, two, or three octets of an address, use the 0.255.255.255, 0.0.255.255, and 0.0.0.255 WC masks, respectively. Also, make the source (address) parameter have 0s in the wildcard octets (those octets with 255 in the wildcard mask). +40 CCNA 200-301 Official Cert Guide, Volume 2 + +■ To match a subnet, use the subnet ID as the source, and find the WC mask by subtract-ing the DDN subnet mask from 255.255.255.255. + +Table 2-2 lists the criteria for several practice problems. Your job: Create a one-line stan-dard ACL that matches the packets. The answers are listed in the section “Answers to Earlier Practice Problems,” later in this chapter. + + +Table 2-2 Problem +1 2 3 4 5 6 7 8 9 +10 + +Building One-Line Standard ACLs: Practice Criteria +Packets from 172.16.5.4 +Packets from hosts with 192.168.6 as the first three octets Packets from hosts with 192.168 as the first two octets Packets from any host +Packets from subnet 10.1.200.0/21 Packets from subnet 10.1.200.0/27 Packets from subnet 172.20.112.0/23 Packets from subnet 172.20.112.0/26 Packets from subnet 192.168.9.64/28 +Packets from subnet 192.168.9.64/30 + + +Reverse Engineering from ACL to Address Range +In some cases, you may not be creating your own ACL. Instead, you may need to interpret some existing access-list commands. To answer these types of questions on the exams, you need to determine the range of IP addresses matched by a particular address/wildcard mask combination in each ACL statement. + +Under certain assumptions that are reasonable for CCNA certifications, calculating the range of addresses matched by an ACL can be relatively simple. Basically, the range of addresses begins with the address configured in the ACL command. The range of addresses ends with the sum of the address field and the wildcard mask. That’s it. + +For example, with the command access-list 1 permit 172.16.200.0 0.0.7.255, the low end of the range is simply 172.16.200.0, taken directly from the command itself. Then, to find the high end of the range, just add this number to the WC mask, as follows: + +172.16.200.0 ++ 0. 0. 7.255 172.16.207.255 + +For this last bit of practice, look at the existing access-list commands in Table 2-3. In each case, make a notation about the exact IP address, or range of IP addresses, matched by the command. + + +Table 2-3 Problem +1 2 +3 + +Finding IP Addresses/Ranges Matching by Existing ACLs Commands for Which to Predict the Source Address Range +access-list 1 permit 10.7.6.5 +access-list 2 permit 192.168.4.0 0.0.0.127 +access-list 3 permit 192.168.6.0 0.0.0.31 +Chapter 2: Basic IPv4 Access Control Lists 41 + + +Problem 4 +5 6 7 +8 + +Commands for Which to Predict the Source Address Range access-list 4 permit 172.30.96.0 0.0.3.255 +access-list 5 permit 172.30.96.0 0.0.0.63 +access-list 6 permit 10.1.192.0 0.0.0.31 +access-list 7 permit 10.1.192.0 0.0.1.255 2 +access-list 8 permit 10.1.192.0 0.0.63.255 + + +Interestingly, IOS lets the CLI user type an access-list command in configuration mode, and IOS will potentially change the address parameter before placing the command into the running-config file. This process of just finding the range of addresses matched by the access-list command expects that the access-list command came from the router, so that any such changes were complete. + +The change IOS can make with an access-list command is to convert to 0 any octet of an address for which the wildcard mask’s octet is 255. For example, with a wildcard mask of 0.0.255.255, IOS ignores the last two octets. IOS expects the address field to end with two 0s. If not, IOS still accepts the access-list command, but IOS changes the last two octets of the address to 0s. Example 2-5 shows an example, where the configuration shows address 10.1.1.1, but wildcard mask 0.0.255.255. +Example 2-5 IOS Changing the Address Field in an access-list Command + +R2# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)# access-list 21 permit 10.1.1.1 0.0.255.255 +R2(config)# ^Z +R2# +R2# show ip access-lists +Standard IP access list 21 +10 permit 10.1.0.0, wildcard bits 0.0.255.255 + +The math to find the range of addresses relies on the fact that either the command is fully correct or that IOS has already set these address octets to 0, as shown in the example. + +NOTE The most useful WC masks, in binary, do not interleave 0s and 1s. This book assumes the use of only these types of WC masks. However, Cisco IOS allows WC masks that interleave 0s and 1s, but using these WC masks breaks the simple method of calculating the range of addresses. As you progress through to CCIE studies, be ready to dig deeper to learn how to determine what an ACL matches. + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same mate-rial found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 2-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. +42 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 2-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Repeat DIKTA questions +Review command tables + +Resource Used Book, website Book, website Book, PTP +Book + + +Review All the Key Topics Table 2-5 Key Topics for Chapter 2 + +Key Topic Element +Paragraph Figure 2-3 Paragraph List +List List +List + +Description Page Number +Summary of the general rule of the location and direction for an ACL 27 Summary of four main categories of IPv4 ACLs in Cisco IOS 29 Summary of first-match logic used by all ACLs 29 Wildcard mask logic for decimal 0 and 255 32 Wildcard mask logic to match a subnet 33 Steps to plan and implement a standard IP ACL 34 +Tips for creating matching logic for the source address field in the 39 access-list command + + +Key Terms You Should Know standard access list, wildcard mask + +Additional Practice for This Chapter’s Processes +For additional practice with analyzing subnets, you may do the same set of practice problems using your choice of tools: + +Application: Use the two ACL practice exercise applications listed on the companion website. +PDF: Alternatively, practice the same problems found in these apps using online Appendix E, “Practice for Chapter 2: Basic IPv4 Access Control Lists.” + +Command References +Tables 2-6 and 2-7 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table 2-6 Chapter 2 Configuration Command Reference + +Command +access-list access-list-number {deny | permit} source [source-wildcard] [log] + +Description +Global command for standard numbered access lists. Use a number between 1 and 99 or 1300 and 1999, inclusive. +Chapter 2: Basic IPv4 Access Control Lists 43 + +Command Description +access-list access-list-number remark text Command that defines a remark to help you remember what the ACL is supposed to do. +ip access-group number {in | out} Interface subcommand to enable access lists. +Table 2-7 Chapter 2 EXEC Command Reference 2 + +Command +show ip interface [type number] + +show access-lists [access-list-number | access-list-name] +show ip access-lists [access-list-number | access-list-name] + +Description +Includes a reference to the access lists enabled on the interface +Shows details of configured access lists for all protocols +Shows IP access lists + + +Answers to Earlier Practice Problems +Table 2-8 lists the answers to the problems listed earlier in Table 2-2. + + +Table 2-8 Problem +1 2 3 4 5 6 7 8 9 +10 + +Building One-Line Standard ACLs: Answers Answers +access-list 1 permit 172.16.5.4 +access-list 2 permit 192.168.6.0 0.0.0.255 access-list 3 permit 192.168.0.0 0.0.255.255 access-list 4 permit any +access-list 5 permit 10.1.200.0 0.0.7.255 access-list 6 permit 10.1.200.0 0.0.0.31 access-list 7 permit 172.20.112.0 0.0.1.255 access-list 8 permit 172.20.112.0 0.0.0.63 access-list 9 permit 192.168.9.64 0.0.0.15 +access-list 10 permit 192.168.9.64 0.0.0.3 + + +Table 2-9 lists the answers to the problems listed earlier in Table 2-3. + + +Table 2-9 Problem +1 2 3 4 5 6 7 +8 + +Address Ranges for Problems in Table 2-3: Answers Address Range +One address: 10.7.6.5 192.168.4.0 – 192.168.4.127 192.168.6.0 – 192.168.6.31 172.30.96.0 – 172.30.99.255 172.30.96.0 – 172.30.96.63 10.1.192.0 – 10.1.192.31 10.1.192.0 – 10.1.193.255 +10.1.192.0 – 10.1.255.255 +CHAPTER 3 + + + +Advanced IPv4 Access Control Lists + +This chapter covers the following exam topics: + +5.0 Security Fundamentals +5.6 Configure and verify access control lists + + +IPv4 ACLs are either standard or extended ACLs, with standard ACLs matching only the source IP address, and extended matching a variety of packet header fields. At the same time, IP ACLs are either numbered or named. Figure 3-1 shows the categories and the main features of each as introduced in the previous chapter. + + + +Standard Numbered + + + + +Extended Numbered + + + +Numbered: +- ID with Number +- Global Commands + + +Standard Named + + + + +Extended Named + + + +Named: +- ID with Name +- Subcommands + +Standard: Matching - Source IP + + + + +Extended: Matching - Source & Dest. IP +- Source & Dest. Port +- Others + + +Figure 3-1 Comparisons of IP ACL Types + +This chapter discusses the other three categories of ACLs beyond standard numbered IP ACLs and ends with a few miscellaneous features to secure Cisco routers and switches. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 3-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Extended IP Access Control Lists +Named ACLs and ACL Editing + +Questions 1–3 +4–6 + + +1. Which of the following fields cannot be compared based on an extended IP ACL? (Choose two answers.) +a. Protocol +b. Source IP address +c. Destination IP address d. TOS byte +e. URL +f. Filename for FTP transfers + +2. Which of the following access-list commands permit packets going from host 10.1.1.1 to all web servers whose IP addresses begin with 172.16.5? (Choose two answers.) +a. access-list 101 permit tcp host 10.1.1.1 172.16.5.0 0.0.0.255 eq www b. access-list 1951 permit ip host 10.1.1.1 172.16.5.0 0.0.0.255 eq www c. access-list 2523 permit ip host 10.1.1.1 eq www 172.16.5.0 0.0.0.255 d. access-list 2523 permit tcp host 10.1.1.1 eq www 172.16.5.0 0.0.0.255 e. access-list 2523 permit tcp host 10.1.1.1 172.16.5.0 0.0.0.255 eq www +3. Which of the following access-list commands permits packets going to any web cli-ent from all web servers whose IP addresses begin with 172.16.5? +a. access-list 101 permit tcp host 10.1.1.1 172.16.5.0 0.0.0.255 eq www b. access-list 1951 permit ip host 10.1.1.1 172.16.5.0 0.0.0.255 eq www c. access-list 2523 permit tcp any eq www 172.16.5.0 0.0.0.255 +d. access-list 2523 permit tcp 172.16.5.0 0.0.0.255 eq www 172.16.5.0 0.0.0.255 e. access-list 2523 permit tcp 172.16.5.0 0.0.0.255 eq www any +4. In a router running a recent IOS version (at least version 15.0), an engineer needs to delete the second line in ACL 101, which currently has four commands configured. Which of the following options could be used? (Choose two answers.) +a. Delete the entire ACL and reconfigure the three ACL statements that should remain in the ACL. +b. Delete one line from the ACL using the no access-list… global command. +c. Delete one line from the ACL by entering ACL configuration mode for the ACL and then deleting only the second line based on its sequence number. +d. Delete the last three lines from the ACL from global configuration mode, and then add the last two statements back into the ACL. +46 CCNA 200-301 Official Cert Guide, Volume 2 + +5. Refer to the following command output, which details an ACL enabled on port G0/0 for the inbound direction. Which answers list a configuration mode and command that would result in the deletion of the line that matches subnet 172.16.1.0/24? (Choose two answers.) +show ip access-lists dikta-list +Standard IP access list dikta-list +10 permit 172.16.1.0, wildcard bits 0.0.0.255 +20 permit 172.16.2.0, wildcard bits 0.0.0.255 +30 permit 172.16.3.0, wildcard bits 0.0.0.255 + +a. In global config mode: no 10 +b. In interface G0/0 config mode: no 10 c. In ACL dikta-list config mode: no 10 +d. In ACL dikta-list config mode: no permit 172.16.1.0 0.0.0.255 e. In global config mode: no permit 172.16.1.0 0.0.0.255 +6. An engineer configures an ACL but forgets to save the configuration. At that point, which of the following commands display the configuration of an IPv4 ACL, includ-ing line numbers? (Choose two answers.) +a. show running-config b. show startup-config c. show ip access-lists d. show access-lists + + +Foundation Topics + +Extended Numbered IP Access Control Lists +Extended IP access lists have many similarities compared to the standard numbered IP ACLs discussed in the previous chapter. Just like standard IP ACLs, you enable extended access lists on interfaces for packets either entering or exiting the interface. IOS searches the list sequen-tially. Extended ACLs also use first-match logic, because the router stops the search through the list as soon as the first statement is matched, taking the action defined in the first-matched statement. All these features are also true of standard numbered access lists (and named ACLs). + +Extended ACLs differ from standard ACLs mostly because of the larger variety of packet header fields that can be used to match a packet. One extended ACE (ACL statement) can examine multiple parts of the packet headers, requiring that all the parameters be matched correctly to match that one ACE. That powerful matching logic makes extended access lists both more useful and more complex than standard IP ACLs . + +Matching the Protocol, Source IP, and Destination IP +Like standard numbered IP ACLs, extended numbered IP ACLs also use the access-list global command. The syntax is identical, at least up through the permit or deny keyword. At that point, the command lists matching parameters, and those differ, of course. In par-ticular, the extended ACL access-list command requires three matching parameters: the IP protocol type, the source IP address, and the destination IP address. +Chapter 3: Advanced IPv4 Access Control Lists 47 +Header + +The IP header’s Protocol field identifies the header that follows the IP header. Figure 3-2 shows the location of the IP Protocol field, the concept of it pointing to the type of header that follows, along with some details of the IP header for reference. + +IP Header Next Header + +9 1 2 4 4 Variable + +Miscellaneous Protocol Header Source IP Destination Fields Type Checksum Address IP Address +Identifies Next Header + +TCP, UDP Options ICMP, +EIGRP, IGMP,… +3 + + +Figure 3-2 IP Header, with Focus on Required Fields in Extended IP ACLs + +IOS requires that you configure parameters for the three highlighted parts of Figure 3-2. For the protocol type, you simply use a keyword, such as tcp, udp, or icmp, matching IP packets that happen to have a TCP, UDP, or ICMP header, respectively, following the IP header. Or you can use the keyword ip, which means “all IPv4 packets.” You also must con-figure some values for the source and destination IP address fields that follow; these fields use the same syntax and options for matching the IP addresses as discussed in Chapter 2, “Basic IPv4 Access Control Lists.” Figure 3-3 shows the syntax. + +Keyword Address & Wildcard + +access-list 101 permit protocol source_IP dest_IP + + +100 - 199 2000 - 2699 + +ip tcp udp icmp +others... + + +Matching Options + + +Figure 3-3 Extended ACL Syntax, with Required Fields + +NOTE When matching IP addresses in the source and destination fields, there is one difference with standard ACLs: When matching a specific IP address, the extended ACL requires the use of the host keyword. You cannot simply list the IP address alone. + +Table 3-2 lists several sample access-list commands that use only the required matching parameters. Feel free to cover the right side and use the table for an exercise, or just review the explanations to get an idea for the logic in some sample commands. + +Table 3-2 Extended access-list Commands and Logic Explanations + +access-list Statement +access-list 101 deny tcp any any +access-list 101 deny udp any any + +What It Matches +Any IP packet that has a TCP header +Any IP packet that has a UDP header + +access-list 101 deny icmp any any Any IP packet that has an ICMP header +access-list 101 deny ip host 1.1.1.1 All IP packets from host 1.1.1.1 going to host 2.2.2.2, host 2.2.2.2 regardless of the header after the IP header + +access-list 101 deny udp 1.1.1.0 0.0.0.255 any + +All IP packets that have a UDP header following the IP header, from subnet 1.1.1.0/24, and going to any destination +48 CCNA 200-301 Official Cert Guide, Volume 2 + +The last entry in Table 3-2 helps make an important point about how IOS processes extended ACLs: + +In an extended ACL access-list command, all the matching parameters must match the packet for the packet to match the command. + +For example, in that last example from Table 3-2, the command checks for UDP, a source IP address from subnet 1.1.1.0/24, and any destination IP address. If a packet with source IP address 1.1.1.1 were examined, it would match the source IP address check, but if it had a TCP header instead of UDP, it would not match this access-list command. All parameters must match. + +Matching TCP and UDP Port Numbers +Extended ACLs can also examine parts of the TCP and UDP headers, particularly the source and destination port number fields. The port numbers identify the application that sends or receives the data. + +The most useful ports to check are the well-known ports used by servers. For example, web servers use well-known port 80 by default. Figure 3-4 shows the location of the port num-bers in the TCP header, following the IP header. + +IP Header TCP Header +9 1 2 4 4 Variable 2 2 16+ +Miscellaneous Protocol Header Source IP Destination IP Source Dest. Rest Fields 6 (TCP) Checksum Address Address Port Port TCP +Options +Header +of +6 = TCP + +Figure 3-4 IP Header, Followed by a TCP Header and Port Number Fields + +When an extended ACL command includes either the tcp or udp keyword, that command can optionally reference the source and/or destination port. To make these comparisons, the syntax uses keywords for equal, not equal, less than, greater than, and for a range of port numbers. In addition, the command can use either the literal decimal port numbers or more convenient keywords for some well-known application ports. Figure 3-5 shows the positions of the source and destination port fields in the access-list command and these + +port number keywords. + + +access-list 101 permit protocol +tcp udp + + + +source_IP source_port +eq __ ne __ lt __ gt __ +range __ + + +Matching dest_IP dest_port +eq __ ne __ lt __ gt __ +range __ + + +Legend: eq: = lt: < ne: ≠ gt: > range: x to y +Figure 3-5 Extended ACL Syntax with TCP and UDP Port Numbers Enabled + + +Answers to the “Do I Know This Already?” quiz: 1 E, F 2 A, E 3 E 4 A, C 5 C, D 6 C, D +Chapter 3: Advanced IPv4 Access Control Lists 49 + +For example, consider the simple network shown in Figure 3-6. The FTP server sits on the right, with the client on the left. The figure shows the syntax of an ACL that matches the following: + +■ Packets that include a TCP header ■ Packets sent from the client subnet ■ Packets sent to the server subnet +■ Packets with TCP destination port 21 (FTP server control port) + + +Source 172.16.1.1 Destination 172.16.3.1 + +172.16.1.0/24 + +3 Source Port > 1023 Destination Port 21 + +172.16.3.0/24 + + + +IN OUT PC1 +Fa0/0 R1 S0/0 + + +IN OUT +S0/1 R2 Fa0/0 + +172.16.3.1 + + + +Port 21 + +access-list 101 permit tcp 172.16.1.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 21 + +Source IP Destination IP Destination Port Figure 3-6 Filtering Packets Based on Destination Port +To fully appreciate the matching of the destination port with the eq 21 parameters, con-sider packets moving from left to right, from PC1 to the server. Assuming the server uses well-known port 21 (FTP control port), the packet’s TCP header has a destination port value of 21. The ACL syntax includes the eq 21 parameters after the destination IP address. The position after the destination address parameters is important: that position identifies the fact that the eq 21 parameters should be compared to the packet’s destination port. As a result, the ACL statement shown in Figure 3-6 would match this packet and the destination port of 21 if used in any of the four locations implied by the four dashed arrowed lines in the figure. + +Conversely, Figure 3-7 shows the reverse flow, with a packet sent by the server back toward PC1. In this case, the packet’s TCP header has a source port of 21, so the ACL must check the source port value of 21, and the ACL must be located on different interfaces. In this case, the eq 21 parameters follow the source address field but come before the destination address field. + + +Source 172.16.3.1 Destination 172.16.1.1 + +172.16.1.0/24 + +Source Port 21 Destination Port > 1023 + +172.16.3.0/24 + + + +OUT IN +PC1 +Fa0/0 R1 S0/0 + + +OUT IN +S0/1 R2 Fa0/0 + +172.16.3.1 + + +Port 21 + +access-list 101 permit tcp 172.16.3.0 0.0.0.255 eq 21 172.16.1.0 0.0.0.255 + +Source Address Destination Address Source Port +Figure 3-7 Filtering Packets Based on Source Port +50 CCNA 200-301 Official Cert Guide, Volume 2 + +When examining ACLs that match port numbers, first consider the location and direction in which the ACL will be applied. That direction determines whether the packet is being sent to the server or from the server. At that point, you can decide whether you need to check the source or destination port in the packet. For reference, Table 3-3 lists many of the pop-ular port numbers and their transport layer protocols and applications. Note that the syntax of the access-list commands accepts both the port numbers and a shorthand version of the application name. + +Table 3-3 Popular Applications and Their Well-Known Port Numbers + +Port Number(s) 20 +21 22 23 25 53 67 68 69 80 110 161 443 514 +16,384–32,767 + +Protocol TCP +TCP TCP TCP TCP +UDP, TCP UDP UDP UDP +TCP TCP UDP TCP UDP +UDP + +Application FTP data FTP control SSH +Telnet SMTP DNS +DHCP Server DHCP Client TFTP +HTTP (WWW) POP3 +SNMP SSL Syslog +RTP (voice, video) + +access-list Command Keyword ftp-data +ftp — telnet smtp +domain bootps bootpc tftp www pop3 snmp — +— +— + + +Table 3-4 lists several sample access-list commands that match based on port numbers. Cover the right side of the table, and try to characterize the packets matched by each com-mand. Then check the right side of the table to see if you agree with the assessment. + +Table 3-4 Extended access-list Command Examples and Logic Explanations + +access-list Statement +access-list 101 deny tcp any gt 49151 host 10.1.1.1 eq 23 + + +access-list 101 deny tcp any host 10.1.1.1 eq 23 +access-list 101 deny tcp any host 10.1.1.1 eq telnet +access-list 101 deny udp 1.0.0.0 0.255.255.255 lt 1023 any + +What It Matches +Packets with a TCP header, any source IP address, with a source port greater than (gt) 49151, a destination IP +address of exactly 10.1.1.1, and a destination port equal to (eq) 23. +The same as the preceding example, but any source port matches, because that parameter is omitted in this case. +The same as the preceding example. The telnet keyword is used instead of port 23. +A packet with a source in network 1.0.0.0/8, using UDP with a source port less than (lt) 1023, with any destination IP address. +Chapter 3: Advanced IPv4 Access Control Lists 51 + +Extended IP ACL Configuration +Because extended ACLs can match so many different fields in the various headers in an IP pack-et, the command syntax cannot be easily summarized in a single generic command. However, the two commands in Table 3-5 summarize the syntax options as covered in this book. + +Table 3-5 Extended IP Access List Configuration Commands + +Command +access-list access-list-number {deny | permit} protocol source source-wildcard destination destination-wildcard [log | log-input] + +Configuration Mode and Description +Global command for extended numbered +access lists. Use a number between 100 3 and 199 or 2000 and 2699, inclusive. + +access-list access-list-number {deny | permit} {tcp A version of the access-list command +| udp} source source-wildcard [operator [port]] with parameters specific to TCP and/or destination destination-wildcard [operator UDP. +[port]] [established] [log] + +The configuration process for extended ACLs mostly matches the same process used for standard ACLs. You must choose the location and direction in which to enable the ACL, particularly the direction, so that you can characterize whether certain addresses and ports will be either the source or destination. Configure the ACL using access-list commands, and when complete, then enable the ACL using the same ip access-group command used with standard ACLs. All these steps mirror what you do with standard ACLs; however, when con-figuring, keep the following differences in mind: + +■ Place extended ACLs as close as possible to the source of the packets that will be fil-tered. Filtering close to the source of the packets saves some bandwidth. +■ Remember that all fields in one access-list command must match a packet for the packet to be considered to match that access-list statement. +■ Use numbers of 100–199 and 2000–2699 on the access-list commands; no one number is inherently better than another. + +Extended IP Access Lists: Example 1 +This example focuses on understanding basic syntax. In this case, the ACL denies Bob access to all FTP servers on R1’s Ethernet, and it denies Larry access to Server1’s web server. Figure 3-8 shows the network topology; Example 3-1 shows the configuration on R1. +Server1 Larry + + +SW2 + +172.16.1.100 +Server2 SW1 E0 + +S0 R2 S0 S1 + +R1 +S1 S1 + + +E0 SW12 172.16.2.10 + +Bob + + + +SW3 + +172.16.1.102 + +S0 R3 SW13 +172.16.3.10 +E0 + +Jimmy Jerry + + + +172.16.3.8 172.16.3.9 Figure 3-8 Network Diagram for Extended Access List Example 1 +52 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 3-1 R1’s Extended Access List: Example 1 + +interface Serial0 +ip address 172.16.12.1 255.255.255.0 +ip access-group 101 in +! +interface Serial1 +ip address 172.16.13.1 255.255.255.0 +ip access-group 101 in +! +access-list 101 remark Stop Bob to FTP servers, and Larry to Server1 web +access-list 101 deny tcp host 172.16.3.10 172.16.1.0 0.0.0.255 eq ftp +access-list 101 deny tcp host 172.16.2.10 host 172.16.1.100 eq www +access-list 101 permit ip any any + +The first ACL statement prevents Bob’s access to FTP servers in subnet 172.16.1.0. The second statement prevents Larry’s access to web services on Server1. The final statement permits all other traffic. + +If we focus on the syntax for a moment, we can see several new items to review. First, the access-list number for extended access lists falls in the range of 100 to 199 or 2000 to 2699. Following the permit or deny action, the protocol parameter defines whether you want to check for all IP packets or specific headers, such as TCP or UDP headers. When you check for TCP or UDP port numbers, you must specify the TCP or UDP protocol. Both FTP and the web use TCP. + +This example uses the eq parameter, meaning “equals,” to check the destination port num-bers for FTP control (keyword ftp) and HTTP traffic (keyword www). You can use the numeric values—or, for the more popular options, a more obvious text version is valid. (If you were to type eq 80, the config would show eq www.) +This example enables the ACL in two places on R1: inbound on each serial interface. These locations achieve the goal of the ACL. However, that initial placement was made to make the point that Cisco suggests that you locate them as close as possible to the source of the packet. Therefore, Example 3-2 achieves the same goal as Example 3-1 of stopping Bob’s access to FTP servers at the main site, and it does so with an ACL on R3. +Example 3-2 R3’s Extended Access List Stopping Bob from Reaching FTP Servers Near R1 + +interface Ethernet0 +ip address 172.16.3.1 255.255.255.0 +ip access-group 103 in + +access-list 103 remark deny Bob to FTP servers in subnet 172.16.1.0/24 +access-list 103 deny tcp host 172.16.3.10 172.16.1.0 0.0.0.255 eq ftp +access-list 103 permit ip any any + +The new configuration on R3 meets the goals to filter Bob’s traffic, while also meeting the overarching design goal of keeping the ACL close to the source of the packets. ACL 103 on R3 looks a lot like ACL 101 on R1 from Example 3-1, but this time, the ACL does not +Chapter 3: Advanced IPv4 Access Control Lists 53 + +bother to check for the criteria to match Larry’s traffic, because Larry’s traffic will never enter R3’s Ethernet 0 interface. ACL 103 filters Bob’s FTP traffic to destinations in subnet 172.16.1.0/24, with all other traffic entering R3’s E0 interface making it into the network. + +Extended IP Access Lists: Example 2 +Example 3-3, based on the network shown in Figure 3-9, shows another example of how to use extended IP access lists. This example uses the following criteria: + +■ Sam is not allowed access to the subnet of Bugs or Daffy. +■ Hosts on the Seville Ethernet are not allowed access to hosts on the Yosemite Ethernet. 3 ■ All other combinations are allowed. + + +Bugs 10.1.1.1 + +Daffy 10.1.1.2 + + + +Subnet 10.1.1.0 + +E0 +Albuquerque + + +s0 +Subnet 10.1.128.0 + +s1 +Subnet 10.1.130.0 + + +Yosemite s0 Subnet 10.1.129.0 s0 Seville + +s1 +E0 + + +s1 E0 + +Subnet 10.1.2.0 Subnet 10.1.3.0 + + + + +Sam 10.1.2.1 + +Emma 10.1.2.2 + +Elmer 10.1.3.1 + +Red 10.1.3.2 + +Figure 3-9 Network Diagram for Extended Access List Example 2 + +Example 3-3 Yosemite Configuration for Extended Access List Example 2 + +interface ethernet 0 +ip access-group 110 in +! +access-list 110 deny ip host 10.1.2.1 10.1.1.0 0.0.0.255 +access-list 110 deny ip 10.1.2.0 0.0.0.255 10.1.3.0 0.0.0.255 +access-list 110 permit ip any any + +This configuration solves the problem with few statements while keeping to the Cisco design guideline of placing extended ACLs as close as possible to the source of the traffic. The ACL filters packets that enter Yosemite’s E0 interface, which is the first router interface that packets sent by Sam enter. If the route between Yosemite and the other subnets chang-es over time, the ACL still applies. Also, the filtering mandated by the second requirement +54 CCNA 200-301 Official Cert Guide, Volume 2 + +(to disallow Seville’s LAN hosts from accessing Yosemite’s) is met by the second access-list statement. Stopping packet flow from Yosemite’s LAN subnet to Seville’s LAN subnet stops effective communication between the two subnets. Alternatively, the opposite logic could have been configured at Seville. + +Practice Building access-list Commands +Table 3-6 supplies a practice exercise to help you get comfortable with the syntax of the extended access-list command, particularly with choosing the correct matching logic. Your job: create a one-line extended ACL that matches the packets. The answers are in the sec-tion “Answers to Earlier Practice Problems,” later in this chapter. Note that if the criteria mention a particular application protocol, for example, “web client,” that means to specifi-cally match for that application protocol. + +Table 3-6 Building One-Line Extended ACLs: Practice + +Problem 1 +2 + +3 + +4 + +5 + +6 + +7 + +8 + +Criteria +From web client 10.1.1.1, sent to a web server in subnet 10.1.2.0/24. +From Telnet client 172.16.4.3/25, sent to a Telnet server in subnet 172.16.3.0/25. Match all hosts in the client’s subnet as well. +ICMP messages from the subnet in which 192.168.7.200/26 resides to all hosts in the subnet where 192.168.7.14/29 resides. +From web server 10.2.3.4/23’s subnet to clients in the same subnet as host 10.4.5.6/22. +From Telnet server 172.20.1.0/24’s subnet, sent to any host in the same subnet as host 172.20.44.1/23. +From web client 192.168.99.99/28, sent to a web server in subnet 192.168.176.0/28. Match all hosts in the client’s subnet as well. +ICMP messages from the subnet in which 10.55.66.77/25 resides to all hosts in the subnet where 10.66.55.44/26 resides. +Any and every IPv4 packet. + + +Named ACLs and ACL Editing +Now that you have a good understanding of the core concepts in IOS IP ACLs, this section examines a few enhancements to IOS support for ACLs: named ACLs and ACL editing with sequence numbers. Although both features are useful and important, neither adds any func-tion as to what a router can and cannot filter. Instead, named ACLs and ACL sequence num-bers make it easier to remember ACL names and edit existing ACLs when an ACL needs to change. + +Named IP Access Lists +Named IP ACLs have many similarities with numbered IP ACLs. They can be used for filter-ing packets, plus for many other purposes. They can match the same fields as well: standard numbered ACLs can match the same fields as a standard named ACL, and extended num-bered ACLs can match the same fields as an extended named ACL. + +Of course, there are differences between named and numbered ACLs. Named ACLs origi-nally had three big differences compared to numbered ACLs: +Chapter 3: Advanced IPv4 Access Control Lists 55 + +■ Using names instead of numbers to identify the ACL, making it easier to remember the reason for the ACL +■ Using ACL subcommands, not global commands, to define the action and matching parameters +■ Using ACL editing features that allow the CLI user to delete individual lines from the ACL and insert new lines + + +You can easily learn named ACL configuration by just converting numbered ACLs to use the equivalent named ACL configuration. Figure 3-10 shows just such a conversion, using a simple three-line standard ACL number 1. To create the three permit subcommands for the named ACL, you literally copy parts of the three numbered ACL commands, beginning with the permit keyword. + + +3 + + + +Numbered ACL + +access-list 1 permit 1.1.1.1 access-list 1 permit 2.2.2.2 +access-list 1 permit 3.3.3.3 + +Named ACL +ip access-list standard name +permit 1.1.1.1 permit 2.2.2.2 +permit 3.3.3.3 + + +Figure 3-10 Named ACL Versus Numbered ACL Configuration + +The only truly new part of the named ACL configuration is the ip access-list global con-figuration command. This command defines whether an ACL is a standard or extended ACL and defines the name. It also moves the user to ACL configuration mode, as shown in upcoming Example 3-4. Once in ACL configuration mode, you configure permit, deny, and remark commands that mirror the syntax of numbered ACL access-list commands. If you’re configuring a standard named ACL, these commands match the syntax of standard numbered ACLs; if you’re configuring extended named ACLs, they match the syntax of extended numbered ACLs. + +Example 3-4 shows the configuration of a named extended ACL. Pay particular attention to the configuration mode prompts, which show ACL configuration mode. +Example 3-4 Named Access List Configuration + +Router# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)# ip access-list extended barney +Router(config-ext-nacl)# permit tcp host 10.1.1.2 eq www any +Router(config-ext-nacl)# deny udp host 10.1.1.1 10.1.2.0 0.0.0.255 +Router(config-ext-nacl)# deny ip 10.1.3.0 0.0.0.255 10.1.2.0 0.0.0.255 +Router(config-ext-nacl)# deny ip 10.1.2.0 0.0.0.255 10.2.3.0 0.0.0.255 +Router(config-ext-nacl)# permit ip any any +Router(config-ext-nacl)# interface serial1 +Router(config-if)# ip access-group barney out +Router(config-if)# ^Z +Router# show running-config +Building configuration... +56 CCNA 200-301 Official Cert Guide, Volume 2 + +Current configuration: + +! lines omitted for brevity + +interface serial 1 +ip access-group barney out +! +ip access-list extended barney +permit tcp host 10.1.1.2 eq www any +deny udp host 10.1.1.1 10.1.2.0 0.0.0.255 +deny ip 10.1.3.0 0.0.0.255 10.1.2.0 0.0.0.255 +deny ip 10.1.2.0 0.0.0.255 10.2.3.0 0.0.0.255 +permit ip any any + +Example 3-4 begins with the creation of an ACL named barney. The ip access-list extended barney command creates the ACL, naming it barney and placing the user in ACL configura-tion mode. This command also tells the IOS that barney is an extended ACL. Next, five dif-ferent permit and deny statements define the matching logic and action to be taken upon +a match. The show running-config command output lists the named ACL configuration before the single entry is deleted. + +Named ACLs allow the user to delete and add new lines to the ACL from within ACL con-figuration mode. Example 3-5 shows how, with the no deny ip… command deleting a single entry from the ACL. Notice that the output of the show access-list command at the end of the example still lists the ACL, with four permit and deny commands instead of five. +Example 3-5 Removing One Command from a Named ACL + +Router# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)# ip access-list extended barney +Router(config-ext-nacl)# no deny ip 10.1.2.0 0.0.0.255 10.2.3.0 0.0.0.255 +Router(config-ext-nacl)# ^Z +Router# show access-list + +Extended IP access list barney +10 permit tcp host 10.1.1.2 eq www any +20 deny udp host 10.1.1.1 10.1.2.0 0.0.0.255 +30 deny ip 10.1.3.0 0.0.0.255 10.1.2.0 0.0.0.255 +50 permit ip any any + +Editing ACLs Using Sequence Numbers +Numbered ACLs have existed in IOS since the early days of Cisco routers and IOS; how-ever, for many years, through many IOS versions, the ability to edit a numbered IP ACL was poor. For example, to simply delete a line from the ACL, the user had to delete the entire ACL and then reconfigure it. + +The ACL editing feature uses an ACL sequence number that is added to each ACL permit or deny statement, with the numbers representing the sequence of statements in the ACL. +Chapter 3: Advanced IPv4 Access Control Lists + +ACL sequence numbers provide the following features for both numbered and named ACLs: + +New configuration style for numbered: Numbered ACLs use a configuration style like named ACLs, as well as the traditional style, for the same ACL; the new style is required to perform advanced ACL editing. +Deleting single lines: An individual ACL permit or deny statement can be deleted with a no sequence-number subcommand. +Inserting new lines: Newly added permit and deny commands can be configured with a sequence number before the deny or permit command, dictating the location of the statement within the ACL. +Automatic sequence numbering: IOS adds sequence numbers to commands as you con-figure them, even if you do not include the sequence numbers. + +57 + + + + + + + + + +3 + + +To take advantage of the ability to delete and insert lines in an ACL, both numbered and named ACLs must use the same overall configuration style and commands used for named ACLs. The only difference in syntax is whether a name or number is used. Example 3-6 shows the configuration of a standard numbered IP ACL, using this alternative configura-tion style. The example shows the power of the ACL sequence number for editing. In this example, the following occurs: +Step 1. Numbered ACL 24 is configured using this new-style configuration, with three permit commands. +Step 2. The show ip access-lists command shows the three permit commands with sequence numbers 10, 20, and 30. +Step 3. The engineer deletes only the second permit command using the no 20 ACL subcommand, which simply refers to sequence number 20. +Step 4. The show ip access-lists command confirms that the ACL now has only two lines (sequence numbers 10 and 30). +Step 5. The engineer adds a new deny command to the beginning of the ACL, using the 5 deny 10.1.1.1 ACL subcommand. +Step 6. The show ip access-lists command again confirms the changes, this time listing three commands, sequence numbers 5, 10, and 30. + + +NOTE For this example, note that the user does not leave configuration mode, instead using the do command to tell IOS to issue the show ip access-lists EXEC command from configuration mode. + +Example 3-6 Editing ACLs Using Sequence Numbers + +! Step 1: The 3-line Standard Numbered IP ACL is configured. +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# ip access-list standard 24 +R1(config-std-nacl)# permit 10.1.1.0 0.0.0.255 +R1(config-std-nacl)# permit 10.1.2.0 0.0.0.255 +58 CCNA 200-301 Official Cert Guide, Volume 2 + +R1(config-std-nacl)# permit 10.1.3.0 0.0.0.255 + +! Step 2: Displaying the ACL's contents, without leaving configuration mode. +R1(config-std-nacl)# do show ip access-lists 24 +Standard IP access list 24 +10 permit 10.1.1.0, wildcard bits 0.0.0.255 +20 permit 10.1.2.0, wildcard bits 0.0.0.255 +30 permit 10.1.3.0, wildcard bits 0.0.0.255 + +! Step 3: Still in ACL 24 configuration mode, the line with sequence number 20 is deleted. +R1(config-std-nacl)# no 20 + +! Step 4: Displaying the ACL's contents again, without leaving configuration mode. +! Note that line number 20 is no longer listed. +R1(config-std-nacl)#do show ip access-lists 24 +Standard IP access list 24 +10 permit 10.1.1.0, wildcard bits 0.0.0.255 +30 permit 10.1.3.0, wildcard bits 0.0.0.255 + +! Step 5: Inserting a new first line in the ACL. +R1(config-std-nacl)# 5 deny 10.1.1.1 + +! Step 6: Displaying the ACL's contents one last time, with the new statement +!(sequence number 5) listed first. +R1(config-std-nacl)# do show ip access-lists 24 +Standard IP access list 24 +5 deny 10.1.1.1 +10 permit 10.1.1.0, wildcard bits 0.0.0.255 +30 permit 10.1.3.0, wildcard bits 0.0.0.255 + +Note that although Example 3-6 uses a numbered ACL, named ACLs use the same process to edit (add and remove) entries. + +Numbered ACL Configuration Versus Named ACL Configuration +As a brief aside about numbered ACLs, note that IOS actually allows two ways to config-ure numbered ACLs in the more recent versions of IOS. First, IOS supports the traditional method, using the access-list global commands shown earlier in Examples 3-1, 3-2, and 3-3. IOS also supports the numbered ACL configuration with commands just like named ACLs, as shown in Example 3-6. + +Oddly, IOS always stores numbered ACLs with the original style of configuration, as global access-list commands, no matter which method is used to configure the ACL. Example 3-7 demonstrates these facts, picking up where Example 3-6 ended, with the following addi-tional steps: +Step 7. The engineer lists the configuration (show running-config), which lists the old-style configuration commands—even though the ACL was created with the new-style commands. +Chapter 3: Advanced IPv4 Access Control Lists 59 + + +Step 8. + +Step 9. + + +Step 10. + + +The engineer adds a new statement to the end of the ACL using the old-style access-list 24 permit 10.1.4.0 0.0.0.255 global configuration command. +The show ip access-lists command confirms that the old-style access-list com-mand from the previous step followed the rule of being added only to the end of the ACL. +The engineer displays the configuration to confirm that the parts of ACL 24 configured with both new-style commands and old-style commands are all + +listed in the same old-style ACL (show running-config). +3 Example 3-7 Adding to and Displaying a Numbered ACL Configuration + +! Step 7: A configuration snippet for ACL 24. +R1# show running-config +! The only lines shown are the lines from ACL 24 +access-list 24 deny 10.1.1.1 +access-list 24 permit 10.1.1.0 0.0.0.255 +access-list 24 permit 10.1.3.0 0.0.0.255 + +! Step 8: Adding a new access-list 24 global command +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# access-list 24 permit 10.1.4.0 0.0.0.255 +R1(config)# ^Z + +! Step 9: Displaying the ACL's contents again, with sequence numbers. Note that even +! the new statement has been automatically assigned a sequence number. +R1# show ip access-lists 24 +Standard IP access list 24 +5 deny 10.1.1.1 +10 permit 10.1.1.0, wildcard bits 0.0.0.255 +30 permit 10.1.3.0, wildcard bits 0.0.0.255 +40 permit 10.1.4.0, wildcard bits 0.0.0.255 + +! Step 10: The numbered ACL config remains in old-style configuration commands. +R1# show running-config +! The only lines shown are the lines from ACL 24 +access-list 24 deny 10.1.1.1 +access-list 24 permit 10.1.1.0 0.0.0.255 +access-list 24 permit 10.1.3.0 0.0.0.255 +access-list 24 permit 10.1.4.0 0.0.0.255 + +ACL Implementation Considerations +ACLs can be a great tool to enhance the security of a network, but engineers should think about some broader issues before simply configuring an ACL to fix a problem. To help, Cisco makes the following general recommendations in the courses on which the CCNA exam is based: +60 CCNA 200-301 Official Cert Guide, Volume 2 + +■ Place extended ACLs as close as possible to the source of the packet. This strategy allows ACLs to discard the packets early. +■ Place standard ACLs as close as possible to the destination of the packet. This strategy avoids the mistake with standard ACLs (which match the source IPv4 address only) of unintentionally discarding packets that did not need to be discarded. +■ Place more specific statements early in the ACL. +■ Disable an ACL from its interface (using the no ip access-group interface subcommand) before making changes to the ACL. + +The first point deals with the concept of where to locate your ACLs. If you intend to filter a packet, filtering closer to the packet’s source means that the packet takes up less band-width in the network, which seems to be more efficient—and it is. Therefore, Cisco sug-gests locating extended ACLs as close to the source as possible. + +However, the second point seems to contradict the first point, at least for standard ACLs, to locate them close to the destination. Why? Well, because standard ACLs look only at the source IP address, they tend to filter more than you want filtered when placed close to the source. For example, imagine that Fred and Barney are separated by four routers. If you filter Barney’s traffic sent to Fred on the first router, Barney can’t reach any hosts near the other three routers. So, the Cisco courses make a blanket recommendation to locate stan-dard ACLs closer to the destination to avoid filtering traffic you do not mean to filter. + +For the third item in the list, by placing more specific matching parameters early in each list, you are less likely to make mistakes in the ACL. For example, imagine that the ACL first listed a command that permitted traffic going to 10.1.1.0/24, and the second command denied traffic going to host 10.1.1.1. Packets sent to host 10.1.1.1 would match the first command, and never match the more specific second command. Note that later IOS ver-sions prevent this mistake during configuration in some cases. + +Finally, Cisco recommends that you disable the ACLs on the interfaces before you change the statements in the list. By doing so, you avoid issues with the ACL during an interim state. First, if you delete an entire ACL and leave the IP ACL enabled on an interface with the ip access-group command, IOS does not filter any packets (that was not always the case in far earlier IOS versions)! As soon as you add one ACL command to that enabled ACL, however, IOS starts filtering packets based on that ACL. Those interim ACL configurations could cause problems. + +For example, suppose you have ACL 101 enabled on S0/0/0 for output packets. You delete list 101 so that all packets are allowed through. Then you enter a single access-list 101 command. As soon as you press Enter, the list exists, and the router filters all packets exit-ing S0/0/0 based on the one-line list. If you want to enter a long ACL, you might temporari-ly filter packets you don’t want to filter! Therefore, the better way is to disable the list from the interface, make the changes to the list, and then reenable it on the interface. + +Additional Reading on ACLs +Cisco has long included IP ACLs in the CCNA exam. Preceding the current CCNA 200-301 exam, the CCNA R&S 200-125 exam included IP ACL troubleshooting. If you would like to learn more about ACLs, particularly about troubleshooting ACLs, as well as some unexpected behavior with ACLs and router-generated packets, refer to the section titled “Troubleshooting with IPv4 ACLs,” in Appendix D, “Topics from Previous Editions.” +Chapter 3: Advanced IPv4 Access Control Lists 61 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 3-7 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. +Table 3-7 Chapter Review Tracking 3 + +Review Element Review Date(s) Review key topics +Review key terms Repeat DIKTA questions Review memory tables +Review command tables + +Resource Used Book, website Book, website Book, PTP Book, website +Book + + +Review All the Key Topics Table 3-8 Key Topics for Chapter 3 + +Key Topic Element +Figure 3-3 + +Paragraph + +Figure 3-4 Figure 3-5 + +Figure 3-7 List +List + +List +List + +Description Page Number +Syntax and notes about the three required matching fields in the 47 extended ACL access-list command +Summary of extended ACL logic that all parameters must match 48 in a single access-list statement for a match to occur +Drawing of the IP header followed by a TCP header 48 +Syntax and notes about matching TCP and UDP ports with 48 extended ACL access-list commands +Logic and syntax to match TCP source ports 49 Guidelines for using extended numbered IP ACLs 51 +Differences between named and numbered ACLs when named 55 ACLs introduced +Features enabled by ACL sequence numbers 57 +ACL implementation recommendations 60 + + +Key Terms You Should Know extended access list, named access list + +Command References +Tables 3-9 and 3-10 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. +62 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 3-9 Chapter 3 ACL Configuration Command Reference + +Command +access-list access-list-number {deny | permit} protocol source source-wildcard destination destination-wildcard [log] +access-list access-list-number {deny | permit} tcp source source-wildcard +[operator [port]] destination destination-wildcard [operator [port]] [log] +access-list access-list-number remark text + +ip access-group {number | name [in | out]} access-class number | name [in | out] + +ip access-list {standard | extended} name + + +{deny | permit} source [source wildcard] [log] + +{deny | permit} protocol source source-wildcard destination destination-wildcard [log] +{deny | permit} tcp source source-wildcard [operator [port]] destination destination-wildcard [operator [port]] [log] +remark text + +Description +Global command for extended numbered access lists. Use a number between 100 and 199 or 2000 and 2699, inclusive. +A version of the access-list command with TCP-specific parameters. + + +Command that defines a remark to help you remember what the ACL is supposed to do. +Interface subcommand to enable access lists. +Line subcommand to enable either standard or extended access lists on vty lines. +Global command to configure a named standard or extended ACL and enter ACL configuration mode. +ACL mode subcommand to configure the matching details and action for a standard named ACL. +ACL mode subcommand to configure the matching details and action for an extended named ACL. +ACL mode subcommand to configure the matching details and action for a named ACL that matches TCP segments. +ACL mode subcommand to configure a description of a named ACL. + + + +Table 3-10 +Command + +Chapter 3 EXEC Command Reference +Description + + + +show ip interface [type number] + +show access-lists [access-list-number | access-list-name] +show ip access-lists [access-list-number | access-list-name] + +Includes a reference to the access lists enabled on the interface +Shows details of configured access lists for all protocols +Shows IP access lists + + +Answers to Earlier Practice Problems +Table 3-11 lists the answers to the practice problems listed in Table 3-6. Note that for any question that references a client, you might have chosen to match port numbers greater than 49151, matching all dynamic ports. The answers in this table mostly ignore that option, but just to show one sample, the answer to the first problem lists one with a reference to client ports greater than 49151 and one without. The remaining answers simply omit this part of the logic. +Chapter 3: Advanced IPv4 Access Control Lists 63 + +Table 3-11 Building One-Line Extended ACLs: Answers Criteria +1 access-list 101 permit tcp host 10.1.1.1 10.1.2.0 0.0.0.255 eq www or +access-list 101 permit tcp host 10.1.1.1 gt 49151 10.1.2.0 0.0.0.255 eq www 2 access-list 102 permit tcp 172.16.4.0 0.0.0.127 172.16.3.0 0.0.0.127 eq telnet +3 access-list 103 permit icmp 192.168.7.192 0.0.0.63 192.168.7.8 0.0.0.7 +4 access-list 104 permit tcp 10.2.2.0 0.0.1.255 eq www 10.4.4.0 0.0.3.255 3 +5 access-list 105 permit tcp 172.20.1.0 0.0.0.255 eq 23 172.20.44.0 0.0.1.255 +6 access-list 106 permit tcp 192.168.99.96 0.0.0.15 192.168.176.0 0.0.0.15 eq www 7 access-list 107 permit icmp 10.55.66.0 0.0.0.127 10.66.55.0 0.0.0.63 +8 access-list 108 permit ip any any +Part I Review + +Keep track of your part review progress with the checklist in Table P1-1. Details about each task follow the table. + + +Table P1-1 + +Activity + +Part I Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Do Labs + + +Repeat All DIKTA Questions +For this task, use the PTP software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Do Labs +Depending on your chosen lab tool, here are some suggestions for what to do in the lab: + +Pearson Network Simulator: If you use the full Pearson CCNA simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) +Config Labs: In your idle moments, review and repeat any of the Config Labs for this book part in the author’s blog; navigate to blog.certskills.com/config-labs for instructions on how to navigate to the labs. +Other: If you are using other lab tools, here are a few suggestions: when building ACL labs, you can test with Telnet (port 23), SSH (port 22), ping (ICMP), and traceroute (UDP) traffic as generated from an extra router. So, do not just configure the ACL; make an ACL that can match these types of traffic, denying some and permitting others, and then test. + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + +With the introduction of the new CCNA certification in early 2020, Cisco expanded the number of security topics in comparison to the old CCNA Routing and Switching certifica-tion. Part II includes the majority of the new security topics added to the new CCNA 200-301 certification as well as a few of the classic topics found in previous CCNA R&S exams. + +Chapter 4 kicks off Part II with a wide description of security threats, vulnerabilities, and exploits. This introductory chapter sets the stage to help you think more like a security engineer. + +Chapters 5, 6, and 8 then focus on a wide range of short security topics. Those topics include Chapter 5’s discussion of how to protect router and switch logins and passwords, along with an introduction to the functions and roles of firewalls or intrusion protection systems (IPSs). Chapters 6 and 8 then get into three separate security features built into Cisco switches: port security (Chapter 6), DHCP Snooping (Chapter 8), and Dynamic ARP Inspection (DAI). All three security features require a switch to examine frames as they enter the switch interface. This information enables port security, DHCP Snooping, and DAI to decide whether to allow the message to continue on its way. + +Chapter 7 discusses the Dynamic Host Configuration Protocol (DHCP) as an end to itself. While this topic is actually an IP Service and would be a great fit for Part III (IP Services), the topics in Chapter 8 require that you know DHCP, so Chapter 7 sets that stage. +Part II + + +Security Services + + + + +Chapter 4: Security Architectures + +Chapter 5: Securing Network Devices + +Chapter 6: Implementing Switch Port Security + +Chapter 7: Implementing DHCP + +Chapter 8: DHCP Snooping and ARP Inspection + +Part II Review +CHAPTER 4 + + + +Security Architectures This chapter covers the following exam topics: +5.0 Security Fundamentals +5.1 Define key security concepts (threats, vulnerabilities, exploits, and mitigation techniques) + +5.2 Describe security program elements (user awareness, training, and physical access control) + +5.4 Describe security password policies elements, such as management, complexity, and password alternatives (multifactor authentication, certificates, and biometrics) + +5.8 Differentiate authentication, authorization, and accounting concepts + + +As you have learned about various networking technologies, your attention has probably been focused on using network devices to build functional networks. After all, networks should let data flow freely so that all connected users have a good experience, right? The unfortunate fact is that not all connected users can be trusted to obey the rules and be good network citizens. In this chapter, you will learn about many aspects of an enterprise network that can be exploited, as well as some ways you can protect them. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 4-1 “Do I Know This Already?” Section-to-Question Mapping + +Foundation Topics Section Security Terminology Common Security Threats +Controlling and Monitoring User Access +Developing a Security Program to Educate Users + +Questions 1–2 +3–7 8 +9 + + +1. Which one of the following terms means anything that can be considered to be a weakness that can compromise security? +a. Exploit +b. Vulnerability c. Attack +d. Threat + + + + +2. An actual potential to exploit a vulnerability is known as which one of the following terms? +a. Vulnerability b. Attack +c. Exploit d. Threat +3. In a spoofing attack, which of the following parameters are commonly spoofed? (Choose two answers.) +a. MAC address +b. Source IP address +c. Destination IP address d. ARP address +4. Suppose an attacker sends a series of packets toward a destination IP address with the TCP SYN flag set but sends no other packet types. Which of the following attacks is likely taking place? +a. Spoofing attack b. Reflection attack +c. Reconnaissance attack d. Denial-of-service attack +e. None of the choices are correct. + +5. In a reflection attack, the source IP address in the attack packets is spoofed so that it contains which one of the following entities? +a. The address of the attacker b. The address of the reflector c. The address of the victim d. The address of the router +6. During a successful man-in-the-middle attack, which two of the following actions is an attacker most likely to perform? +a. Eavesdrop on traffic passing between hosts b. Induce a buffer overflow on multiple hosts c. Modify data passing between hosts +d. Use ping sweeps and port scans to discover the network +70 CCNA 200-301 Official Cert Guide, Volume 2 + +7. Which one of the following is the goal of a brute-force attack? a. Try every possible TCP port until a service answers +b. Try every possible combination of keyboard characters to guess a user’s password +c Initiate a denial-of-service operation on every possible host in a subnet d. Spoof every possible IP address in an organization +8. Which one of the following is an example of a AAA server? a. DHCP +b. DNS c. SNMP d. ISE +9. Physical access control is important for which one of the following reasons? + +a. It prevents unauthorized people from sitting at a corporate user’s desk and using their computer. +b. It prevents users from getting angry and damaging computer equipment. c. It prevents unauthorized access to network closets. +d. It prevents fires from destroying data centers. + + +Foundation Topics + +Security Terminology +In a perfect world, you might build a network that supports every user in an enterprise, with the assumption that every user is known, every user is approved to access everything on the network, and every user will use the available resources exactly according to some corpo-rate guidelines. The network shown in Figure 4-1 might represent such a scenario. Even this ideal, closed system is not completely secure because a user might decide to misbehave in order to pester a coworker or to view information on the corporate server that should be restricted or confidential. +Enterprise + + + +Network Servers + + +Users + + + + + + +Figure 4-1 An Example of an Enterprise Closed System +Chapter 4: Security Architectures 71 + +Now consider that almost no enterprise uses such a limited, closed environment. After all, the enterprise will probably want to somehow connect itself to the public Internet and perhaps to some corporate partners. It will also probably want to allow its workers to be mobile and carry laptops, tablets, and smartphones in and out of the corporate boundaries for convenience. The enterprise might want to provide network access to guests who visit. If the enterprise offers wireless connectivity to its employees (and guests), it might also unknowingly offer its wireless access to people who are within range of the signals. And the list goes on and on. As the network and its connectivity expand, as Figure 4-2 shows, the enterprise will have more difficulty maintaining the safe, closed boundary around itself. + + +Enterprise +4 + + +Network Servers + + +Users + + + + + + + + + +Internet + + +Business Partners + +Figure 4-2 An Example Enterprise Extends Beyond Its Own Boundary + +To begin securing a network, you first need to understand what might go wrong with it. Think of an enterprise network as a simple box-shaped facility, as shown in part A of Figure 4-3. When all of the walls, floor, and ceiling are made of a very strong material and are very thick, the contents inside the box will likely remain safe from harm or theft. The owner, however, might have a hard time getting in and out of the box. + + +A + + + + + + +Figure 4-3 + +B + + + + + +Vulnerability +Security Terminology Illustrated + +C D + + + + + +Exploit Threat +72 CCNA 200-301 Official Cert Guide, Volume 2 + +Suppose a door is introduced for convenience, as shown in part B of Figure 4-3. The owner can now come and go, but so might anyone else. Even if the door is locked, someone might find a way to get the door open and access the treasures inside. Because no door is impen-etrable, the door becomes a vulnerability. In terms of security, a vulnerability is anything that can be considered to be a weakness that can compromise the security of something else, such as the integrity of data or how a system performs. + +Just because a vulnerability exists, nothing is necessarily in jeopardy. In the locked door example, nobody but the trusted owner can open the door unless some sort of tool other than the key is used. Such a tool can be used to exploit a vulnerability. In fact, the tool itself is called an exploit, as shown by the pry bar in part C of Figure 4-3. An exploit is not very effective if it is used against anything other than the targeted weakness or vulnerability. + +Technically, an exploit such as the pry bar is not very effective at all by itself. Someone must pick it up and use it against the vulnerability. In part D of Figure 4-3, a malicious user possesses the pry bar and intends to use it to open the locked door. Now there is an actual potential to break in, destroy, steal, or otherwise modify something without permission. This is known as a threat. + +In the IT world of networks, systems, workstations, and applications, there are many, many different vulnerabilities and exploits that can be leveraged by malicious users to become threats to an organization and its data. The remainder of this chapter provides an overview of many of them, along with some techniques you can leverage to counteract or prevent the malicious activity. Such measures are known as mitigation techniques. You might be think-ing of some ways the Figure 4-3 building owner could mitigate the threats he faces. Perhaps he could add stronger, more secure locks to the door, a more robust door frame to with-stand prying forces, or an alarm system to detect an intrusion and alert the authorities. + +Common Security Threats +Because modern enterprise networks are usually made up of many parts that all work together, securing them can become a very complex task. As with the simple box analogy, you cannot effectively try to secure it until you have identified many of the vulnerabilities, assessed the many exploits that exist, and realized where the threats might come from. Only then can the appropriate countermeasures and mitigations be put in place. + +You should also consider some important attributes of enterprise resources that should be protected and preserved. As you work through the many threats that are discussed in this chapter, think about the vulnerability and exploit that makes the threat possible. Notice how many different parts of the enterprise network exhibit vulnerabilities and how the threats are crafted to take advantage of the weaknesses. + +Attacks That Spoof Addresses +When systems behave normally, parameters and services can be trusted and used effec-tively. For example, when a machine sends an IP packet, everyone expects the source IP address to be the machine’s own IP address. The source MAC address in the Ethernet frame + + + +Answers to the “Do I Know This Already?” quiz: 1 B 2 D 3 A, B 4 D 5 C 6 A, C 7 B 8 D 9 C +Chapter 4: Security Architectures 73 + +is expected to be the sender’s own MAC address. Even services like DHCP and DNS should follow suit; if a machine sends a DHCP or DNS request, it expects any DHCP or DNS reply to come from a legitimate, trusted server. + +Spoofing attacks focus on one vulnerability; addresses and services tend to be implicitly trusted. Attacks usually take place by replacing expected values with spoofed or fake val-ues. Address spoofing attacks can be simple and straightforward, where one address value is substituted for another. + +For example, an attacker can send packets with a spoofed source IP address instead of its own, as shown in Figure 4-4. When the target receives the packets, it will send return traf-fic to the spoofed address, rather than the attacker’s actual address. If the spoofed address exists, then an unsuspecting host with that address will receive the packet. If the address +does not exist, the packet will be forwarded and then dropped further out in the network. 4 + + + +Attacker + + + + +198.51.100.77 + + + +IP Packet +Src: 198.51.100.254 Dest: 192.0.2.10 + +Target (Corporate Server) + + + +192.0.2.10 + + + +IP Packet Reply Src: 192.0.2.10 +Dest: 198.51.100.254 + + + +Figure 4-4 A Sample Spoofing Attack + +An attacker can send spoofed MAC addresses too, to add false information to the forward-ing tables used by Layer 2 switches or ARP tables used by other hosts and routers. DHCP requests with spoofed MAC addresses can also be sent to a legitimate DHCP server, filling its address lease table and leaving no free IP addresses for normal use. + +Note that Chapter 6, “Implementing Switch Port Security,” discusses a tool that can be used to help mitigate MAC address spoofing. In Chapter 8, “DHCP Snooping and ARP Inspection,” you can learn more about Dynamic ARP Inspection (DAI) and how to use it to mitigate IP address spoofing using ARP. + +Denial-of-Service Attacks +In the normal operation of a business application, clients open connections to corporate servers to exchange information. This might occur in the form of web-based sessions that are open to internal users as well as external users on the public Internet. The process is simple: users open a web browser to the corporate site, which then opens a TCP connec-tion with the corporate web server; then some transaction can take place. If all the users are well behaved and conduct legitimate transactions, the corporate servers are (hopefully) not stressed and many clients can do business normally. +74 CCNA 200-301 Official Cert Guide, Volume 2 + +Now suppose a malicious user finds a way to open an abnormal connection to the same corporate server. The TCP connection begins with the malicious user sending a SYN flag to the server, but the source IP address is replaced with a fake address. The server adds the TCP connection to its table of client connections and replies to the fake address with a +SYN-ACK. Because the fake address is not involved in the TCP connection, there is no ACK reply to complete the TCP three-way handshake. The incomplete connection stays in the server’s table until it eventually times out and is removed. During this time, the attacker can try to open many, many more abnormal connections at such a rate that the server’s connec-tion table fills. At that point, the server is no longer able to maintain TCP connections with legitimate users, so their business transactions all halt. Figure 4-5 illustrates this process. + + + +Attacker +TCP SYN +Src: 198.51.100.254 Dest: 192.0.2.10 + + + +TCP SYN +Src: 198.51.100.254 Dest: 192.0.2.10 + +Target (Corporate Server) + +TCP SYN +Src: 198.51.100.254 Dest: 192.0.2.10 + + + + +198.51.100.77 + + + + +TCP SYN-ACK Src: 192.0.2.10 +Dest: 198.51.100.254 + + + + +TCP SYN-ACK Src: 192.0.2.10 +Dest: 198.51.100.254 + +192.0.2.10 +TCP SYN-ACK Src: 192.0.2.10 +Dest: 198.51.100.254 + + + +?? + + + + +Client + + + + + + + + + + +Figure 4-5 A Sample Denial-of-Service Attack + + +TCP Connections 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 198.51.100.254 **FULL!** + + +When an attacker is able to deplete a system resource, services and systems become unavail-able or crash. This is called a denial-of-service (DoS) attack because it denies service to legitimate users or operations. DoS attacks can involve something as simple as ICMP echo (ping) packets, a flood of UDP packets, and TCP connections, such as the TCP SYN flood attack previously described. Such attacks can be successful provided a system has a vulner-ability with the protocol or type of traffic that is exploited. +Chapter 4: Security Architectures 75 + +Attackers can carry the DoS idea even further by enlisting many other systems to partici-pate. To do this, the attacker sets up a master control computer somewhere on the Internet. Next, many computers must first be infected with malicious code or malware by leverag-ing vulnerabilities present in those machines. Each machine then silently becomes a “bot,” appearing to operate normally, while awaiting commands from the master control. When the time comes for an attack to begin, the master control sends a command to every bot and tells it to initiate a denial-of-service attack against a single target host. This is called a distributed denial-of-service (DDoS) attack because the attack is distributed across a large number of bots, all flooding or attacking the same target. + +Reflection and Amplification Attacks +Recall that in a spoofing attack, the attacker sends packets with a spoofed source address to +a target. The goal is to force the target to deal with the spoofed traffic and send return traf- 4 +fic toward a nonexistent source. The attacker does not care where the return traffic goes or that it cannot be delivered successfully. + +In a somewhat related attack, the attacker again sends packets with a spoofed source address toward a live host. However, the host is not the intended target; the goal is to get the host to reflect the exchange toward the spoofed address that is the target. This is known as a reflection attack as illustrated in Figure 4-6, and the host reflecting the traffic toward the target is called the reflector. The attacker might also send the spoofed packets to mul-tiple reflectors, causing the target to receive multiple copies of the unexpected traffic. + + + +Attacker + + + + +198.51.100.77 + + + + +Target + + + +IP Packet +Src: 198.51.100.254 Dest: 192.0.2.10 + + + + +IP Packet Reply Src: 192.0.2.10 +Dest: 198.51.100.254 + +Reflector (Corporate Server) + + + +192.0.2.10 + + + + + +198.51.100.254 +Figure 4-6 A Sample Reflection Attack + +The impact of a reflection attack might seem limited because a single target host is the vic-tim, and the amount of traffic being reflected to the target is in proportion to the packets sent by the attacker. If an attacker is able to send a small amount of traffic to a reflector and leverage a protocol or service to generate a large volume of traffic toward a target, then an amplification attack has occurred. In effect, such an attack amplifies the attacker’s efforts to disrupt the target. Another result is that large amounts of network bandwidth can be consumed forwarding the amplified traffic toward the target, especially if many reflectors are involved. Some mechanisms of DNS and NTP have been exploited in the past to set new records for enormous bandwidth consumption during an amplification attack. +76 CCNA 200-301 Official Cert Guide, Volume 2 + +Man-in-the-Middle Attacks +Many types of attacks are meant to disrupt or directly compromise targeted systems, often with noticeable results. Sometimes an attacker might want to eavesdrop on data that passes from one machine to another, avoiding detection. A man-in-the-middle attack does just that, by allowing the attacker to quietly wedge itself into the communication path as an intermediary between two target systems. + +One type of man-in-the-middle attack exploits the ARP table that each host maintains to communicate with other hosts on its local network segment. Normally, if one host needs to send data to another, it looks for the destination host in its ARP table. If an entry is found, the Ethernet frame can be sent directly to the destination MAC address; otherwise, the sender must broadcast an ARP request containing the destination’s IP address and wait for the destination to answer with an ARP reply and its own MAC address. + +Figure 4-7 illustrates a successful man-in-the-middle attack. + + +Client + + + + +198.51.100.254 0000.1111.1111 + + +1 + +ARP Request Who has 198.51.100.10? + + + +3 + +ARP Reply 192.168.100.10 is 0000.AAAA.AAAA + + + + + + +2 +ARP Request Who has 198.51.100.10? + + +2 +ARP Request Who has 198.51.100.10? + + +Server + + + +198.51.100.10 0000.2222.2222 + + + + + +Attacker 198.51.100.99 0000.AAAA.AAAA +Figure 4-7 A Man-in-the-Middle Attack Begins + +In step 1, a client broadcasts an ARP request to find out what MAC address is used by the host with IP address 198.51.100.10. In step 2, the ARP request is flooded to all hosts in the broadcast domain. This allows the attacker to overhear the ARP request and prepare to exploit the information learned. The legitimate owner of 198.51.100.10 may indeed +respond with its own ARP reply and real MAC address, as expected. However, in step 3, the attacker simply waits a brief time and then sends a spoofed ARP reply containing its own MAC address, rather than that of the actual destination. The goal is for the attacker to send the last ARP reply so that any listening host will update its ARP table with the most recent information. + +This process effectively poisons the ARP table entry in any system receiving the spoofed ARP reply. From that point on, a poisoned system will blindly forward traffic to the attacker’s MAC address, which now masquerades as the destination. The attacker is able to know the real destination’s MAC address because he received an earlier ARP reply from the +Chapter 4: Security Architectures 77 + +destination host. Figure 4-8 depicts the end result. The attacker can repeat this process by poisoning the ARP entries on multiple hosts and then relaying traffic between them without easy detection. + + +Client + + + + +198.51.100.254 0000.1111.1111 + + + + + + + + +Data +Dst: 198.51.100.10 0000.AAAA.AAAA + + + + + + + + +Modified Data Dst: 198.51.100.10 +0000.2222.2222 + + +Server + + + +198.51.100.10 0000.2222.2222 + +4 + + + + + + +Attacker 198.51.100.99 0000.AAAA.AAAA +Figure 4-8 A Man-in-the-Middle Attack Succeeds + +Once an attacker has inserted herself between two hosts, she can passively eavesdrop on and inspect all traffic passing between them. The attacker might also take an active role and modify the data passing through. + +Address Spoofing Attack Summary +As you work through the various types of address spoofing attacks, remember that the attacker’s goal is to disguise his identity and fool other systems in a malicious way. Use Table 4-2 to review the concepts and characteristics of each attack type. + +Table 4-2 Summary of Address Spoofing Attacks + +Goal + +Exhaust a system service or resource; crash the target system +Trick an unwitting accomplice host to send traffic to target +Eavesdrop on traffic +Modify traffic passing through + +DoS/DDoS + +Yes + +No + +No +No + +Reflection + +No + +Yes + +No +No + +Amplification + +No + +Yes + +No +No + +Man-in-the-Middle +No + +No + +Yes +Yes + + +Reconnaissance Attacks +When an attacker intends to launch an attack on a target, that attacker might want to iden-tify some vulnerabilities so the attack can be focused and more effective. A reconnaissance attack can be used to discover more details about the target and its systems prior to an actual attack. +78 CCNA 200-301 Official Cert Guide, Volume 2 + +During a reconnaissance attack, the attacker can use some common tools to uncover public details like who owns a domain and what IP address ranges are used there. For example, the nslookup command exists in many operating systems and can perform a DNS lookup to resolve an IP address from a fully qualified domain name. If an attacker knows the domain name of a business, nslookup can reveal the owner of the domain and the IP address space registered to it. The whois and dig commands are complementary tools that can query DNS information to reveal detailed information about domain owners, contact information, mail servers, authoritative name servers, and so on. + +Then the attacker can progress to using ping sweeps to send pings to each IP address in the target range. Hosts that answer the ping sweep then become live targets. Port scanning tools can then sweep through a range of UDP and TCP ports to see if a target host answers on any port numbers. Any replies indicate that a corresponding service is running on the target host. + +Keep in mind that a reconnaissance attack is not a true attack because nothing is exploited as a result. It is used for gathering information about target systems and services so that vul-nerabilities can be discovered and exploited using other types of attacks. + +Buffer Overflow Attacks +Operating systems and applications normally read and write data using buffers and tem-porary memory space. Buffers are also important when one system communicates with another, as IP packets and Ethernet frames come and go. As long as the memory space is maintained properly and data is placed within the correct buffer boundaries, everything should work as expected. + +However, some systems and applications have vulnerabilities that can allow buffers to over-flow. This means some incoming data might be stored in unexpected memory locations if +a buffer is allowed to fill beyond its limit. An attacker can exploit this condition by send-ing data that is larger than expected. If a vulnerability exists, the target system might store that data, overflowing its buffer into another area of memory, eventually crashing a service or the entire system. The attacker might also be able to specially craft the large message +by inserting malicious code in it. If the target system stores that data as a result of a buffer overflow, then it can potentially run the malicious code without realizing. + +Malware +Some types of security threats can come in the form of malicious software or malware. For example, a trojan horse is malicious software that is hidden and packaged inside other soft-ware that looks normal and legitimate. If a well-meaning user decides to install it, the trojan horse software is silently installed too. Then the malware can run attacks of its own on the local system or against other systems. Trojan horse malware can spread from one computer to another only through user interaction such as opening email attachments, downloading software from the Internet, and inserting a USB drive into a computer. + +In contrast, viruses are malware that can propagate between systems more readily. To spread, virus software must inject itself into another application, then rely on users to trans-port the infected application software to other victims. + +One other type of malware is able to propagate to and infect other systems on its own. An attacker develops worm software and deposits it on a system. From that point on, the worm replicates itself and spreads to other systems through their vulnerabilities, then replicates and spreads again and again. +Chapter 4: Security Architectures 79 + +To summarize, Table 4-3 lists the key ideas behind each type of malware described in this section. + +Table 4-3 Summary of Malware Types + +Characteristic +Packaged inside other software Self-injected into other software +Propagates automatically + +Trojan Horse Virus Worm Yes No No No Yes No +No No Yes + + +Human Vulnerabilities +Many types of attack must take advantage of a vulnerability in an operating system, service, +or other types of application software. In other words, an attacker or the malware involved 4 must find a weakness in the target computer system. There are still many other attacks that +can succeed by exploiting weaknesses in the humans that use computer systems. + +One rather straightforward attack is called social engineering, where human trust and social behaviors can become security vulnerabilities. For example, an attacker might pose as an IT staff member and attempt to contact actual end users through phone calls, emails, and social media. The end goal might be to convince the users to reveal their credentials or set their passwords to a “temporary” value due to some fictitious IT maintenance that will take place, allowing the attacker to gain easy access to secure systems. Attackers might also be physi-cally present and secretly observe users as they enter their credentials. + +Phishing is a technique that attackers use to lure victims into visiting malicious websites. The idea is to either disguise the invitation as something legitimate, frighten victims into fol-lowing a link, or otherwise deceive users into browsing content that convinces them to enter their confidential information. + +Phishing comes in many forms. Spear phishing targets a group of similar users who might work for the same company, shop at the same stores, and so on, who all receive the same convincing email with a link to a malicious site. Whaling is similar but targets high-profile individuals in corporations, governments, and organizations. Phishing can also occur over traditional communications, such as voice calls (vishing) and SMS text messages (smishing). + +Pharming also attempts to send victims to a malicious website, but it takes a more dras-tic approach. Rather than enticing victims to follow a disguised link, pharming involves compromising the services that direct users toward a well-known or trusted website. For instance, an attacker can compromise a DNS service or edit local hosts files to change the entry for a legitimate site. When a victim tries to visit the site using its actual link, the altered name resolution returns the address of a malicious site instead. + +In a watering hole attack, an attacker determines which users frequently visit a site; then that site is compromised and malware is deposited there. The malware infects only the tar-get users who visit the site, while leaving other users unscathed. + +You can refer to Table 4-4 to review the key ideas behind each type of human vulnerability that is commonly exploited. +80 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 4-4 Summary of Human Security Vulnerabilities + +Attack Type Social engineering Phishing +Spear phishing Whaling Vishing Smishing Pharming +Watering hole + +Goal +Exploits human trust and social behavior +Disguises a malicious invitation as something legitimate Targets group of similar users +Targets high-profile individuals Uses voice calls +Uses SMS text messages +Uses legitimate services to send users to a compromised site +Targets specific victims who visit a compromised site + + +Password Vulnerabilities +Most systems in an enterprise network use some form of authentication to grant or deny user access. When users access a system, a username and password are usually involved. It might be fairly easy to guess someone’s username based on that person’s real name. If the user’s password is set to some default value or to a word or text string that is easy to guess, an attacker might easily gain access to the system too. + +Think like an attacker for a moment and see if you can make some guesses about passwords you might try if you wanted to log in to a random system. Perhaps you thought of pass-words like password, password123, 123456, and so on. Perhaps you could try username admin and password admin. + +An attacker can launch an online attack by actually entering each password guess as the system prompts for user credentials. In contrast, an offline attack occurs when the attacker is able to retrieve the encrypted or hashed passwords ahead of time, then goes offline to an external computer and uses software there to repeatedly attempt to recover the actual password. +Attackers can also use software to perform dictionary attacks to discover a user’s password. The software will automatically attempt to log in with passwords taken from a dictionary or word list. It might have to go through thousands or millions of attempts before discover-ing the real password. In addition, the software can perform a brute-force attack by try- +ing every possible combination of letter, number, and symbol strings. Brute-force attacks require very powerful computing resources and a large amount of time. + +To mitigate password attacks, an enterprise should implement password policies for all users. Such a policy might include guidelines that require a long password string made up of a combination of upper- and lowercase characters along with numbers and some special characters. The goal is to require all passwords to be complex strings that are difficult to guess or reveal by a password attack. As well, password management should require all +passwords to be changed periodically so that even lengthy brute-force attacks would not be able to recover a password before it is changed again. + +Password Alternatives +A simple password string is the single factor that a user must enter to be authenticated. Because a password should be remembered and not written down anywhere, you might +Chapter 4: Security Architectures 81 + +think of your password as “something you know.” Hopefully nobody else knows it too; otherwise, they could use it to impersonate you when authenticating. + +An enterprise might also consider using alternative credentials that bring more complexity and more security. Multifactor credentials require users to provide values or factors that come from different sources, reducing the chance that an attacker might possess all of the factors. An old saying describes two-factor credentials as “something you have” (a dynamic changing cryptographic key or a text message containing a time-limited code) and “some-thing you know” (a password). + +A digital certificate can serve as one alternative factor because it serves as a trusted form of identification, adheres to a standardized format, and contains encrypted information. If an enterprise supports certificate use, then a user must request and be granted a unique cer- +tificate to use for specific purposes. For example, certificates used for authenticating users 4 must be approved for authentication. In order to be trusted, certificates must be granted +and digitally signed by a trusted certificate authority (CA). As long as the services used by the enterprise know and trust the CA, then individual certificates signed by that CA can be trusted as well. +Digital certificates are also time sensitive, as each is approved for a specific time range. Once a certificate expires, any attempts to authenticate with it will be rejected. The user who possesses the certificate can request a new one prior to the expiration date or at any time afterward. Certificates can also be revoked, if the business decides to revoke privileges from a user, if the user separates from the business, and so on. Even if the user still pos-sesses a revoked certificate, he will be refused access when he tries to authenticate with it. + +Because digital certificates exist as files on a computer or device, you might think they can be freely copied and used to identify people other than the original owners. Each digital certificate must also carry proof of possession to show that it was truly granted to the user who presents it during authentication. This proof is built into the encrypted certificate content, as a result of combining public keys that the user’s machine and the authentication server can publicly share, along with private keys that each party keeps private and secret. As long as the authentication server can verify that the certificate was created using the cor-rect public and private keys, then the certificate must be possessed by the expected owner. If not, then authentication will be rejected to keep an imposter out. + +Biometric credentials carry the scheme even further by providing a factor that represents “something you are.” The idea is to use some physical attribute from a user’s body to uniquely identify that person. Physical attributes are usually unique to each individual’s body structure and cannot be easily stolen or duplicated. For example, a user’s fingerprint can be scanned and used as an authentication factor. Other examples include face recogni-tion, palm prints, voice recognition, iris recognition, and retinal scans. As you might expect, some methods can be trusted more than others. Sometimes facial recognition systems can be fooled when presented with photographs or masks of trusted individuals. Injuries and the aging process can also alter biometric patterns such as fingerprints, facial shapes, and iris patterns. To help mitigate potential weaknesses, multiple biometric credentials can be col-lected and used to authenticate users as well. +To summarize, Table 4-5 lists the key ideas used in each alternative to password authentication. +82 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 4-5 Summary of Password Authentication and Alternatives +Characteristic Password Only Two-Factor Digital Certificates Biometric +Something you know Yes Yes +Something you have Yes Yes +Something you are Yes + +Controlling and Monitoring User Access +You can manage user activity to and through systems with authentication, authorization, and accounting (AAA, also pronounced “triple-A”) mechanisms. AAA uses standardized methods to challenge users for their credentials before access is allowed or authorized. Accounting protocols also can record user activity on enterprise systems. AAA is commonly used to control and monitor access to network devices like routers, switches, firewalls, and so on. + +In a nutshell, you can think of AAA in the following manner: + +■ Authentication: Who is the user? +■ Authorization: What is the user allowed to do? ■ Accounting: What did the user do? + +As an example, a network administrator can have several methods to manage users who might try to log in to a switch to perform some operation. At the most basic level, you could authenticate users with simple passwords that are configured on the switch console and VTY lines. Authorization could be equally simple: when users successfully log in, they are authorized for EXEC level privileges. By entering the correct enable secret password, users could be authorized for a higher privilege level. + +Under the simple scenario, if a user knows the correct password, he can connect to the switch. But who is that user? You might never know who actually logged in and changed +the configuration or rebooted the switch! Instead, you could configure individual usernames and passwords on the switch. That would solve the user anonymity problem, but your net-work might consist of many administrative users and many switches, requiring quite a bit of username configuration and maintenance. + +A more scalable solution is to leverage AAA functions that are centralized, standardized, resilient, and flexible. For example, a centralized authentication server can contain a data-base of all possible users and their passwords, as well as policies to authorize user activities. As users come and go, their accounts can be easily updated in one place. All switches and routers would query the AAA server to get up-to-date information about a user. For greater security, AAA servers can also support multifactor user credentials and more. Cisco imple-ments AAA services in its Identity Services Engine (ISE) platform. + +AAA servers usually support the following two protocols to communicate with enterprise resources: + +■ TACACS+: A Cisco proprietary protocol that separates each of the AAA functions. Communication is secure and encrypted over TCP port 49. +■ RADIUS: A standards-based protocol that combines authentication and authorization into a single resource. Communication uses UDP ports 1812 and 1813 (accounting) but is not completely encrypted. +Chapter 4: Security Architectures 83 + +Both TACACS+ and RADIUS are arranged as a client/server model, where an authenticat-ing device acts as a client talking to a AAA server. Figure 4-9 shows a simplified view of the process, where a user is attempting to connect to a switch for management purposes. In the AAA client role, the switch is often called Network Access Device (NAD) or Network Access Server (NAS). When a user tries to connect to the switch, the switch challenges the user for credentials, then passes the credentials along to the AAA server. In simple terms, if the user passes authentication, the AAA server returns an “accept” message to the switch. If the AAA server requires additional credentials, as in multifactor authentication, it returns a +“challenge” message to the switch. Otherwise, a “reject” message is returned, denying access to the user. + +User Switch AAA Server 4 + + + +1. Who are you? + + +2. I am John Smith. + +5. OK, connect. + +3. Is he John Smith? + +4. Yes, accept him. + + +Figure 4-9 A Simplified View of AAA + +Developing a Security Program to Educate Users +One effective approach an enterprise can take to improve information security is to educate its user community through a corporate security program. Most users may not have an IT background, so they might not recognize vulnerabilities or realize the consequences of their own actions. For example, if corporate users receive an email message that contains a mes-sage concerning a legal warrant for their arrest or a threat to expose some supposed illegal behavior, they might be tempted to follow a link to a malicious site. Such an action might infect a user’s computer and then open a back door or introduce malware or a worm that could then impact the business operations. + +An effective security program should have the following basic elements: + +■ User awareness: All users should be made aware of the need for data confidentiality to protect corporate information, as well as their own credentials and personal information. They should also be made aware of potential threats, schemes to mislead, and proper procedures to report security incidents. Users should also be instructed to follow strict guidelines regarding data loss. For example, users should not include sensitive informa-tion in emails or attachments, should not keep or transmit that information from a smart-phone, or store it on cloud services or removable storage drives. +■ User training: All users should be required to participate in periodic formal training so that they become familiar with all corporate security policies. (This also implies that the enterprise should develop and publish formal security policies for its employees, users, and business partners to follow.) +84 CCNA 200-301 Official Cert Guide, Volume 2 + +■ Physical access control: Infrastructure locations , such as network closets and data centers, should remain securely locked. Badge access to sensitive locations is a scalable solution, offering an audit trail of identities and timestamps when access is granted. Administrators can control access on a granular basis and quickly remove access when an employee is dismissed. + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 4-6 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 4-6 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions +Review memory tables + +Resource Used Book, website Book, website Book, PTP +Website + + +Review All the Key Topics Table 4-7 Key Topics for Chapter 4 + +Key Topic Element Figure 4-3 +Section Table 4-3 Table 4-4 Paragraph List +List + +Description Security terminology +Common Security Threats Types of malware +Human security vulnerabilities Password vulnerabilities +AAA functions +User education + +Page Number 71 +72 79 80 80 82 +83 + + +Key Terms You Should Know +AAA, amplification attack, brute-force attack, buffer overflow attack, denial-of-service (DoS) attack, dictionary attack, distributed denial-of-service (DDoS) attack, exploit, mal-ware, man-in-the-middle attack, mitigation technique, multifactor authentication, password guessing, pharming, phishing, reconnaissance attack, reflection attack, social engineering, spear phishing, spoofing attack, threat, trojan horse, virus, vulnerability, watering hole attack, whaling, worm + + + + + + + + +This page intentionally left blank +CHAPTER 5 + + + +Securing Network Devices This chapter covers the following exam topics: +1.0 Network Fundamentals +1.1 Explain the Role of Network Components + +1.1.c Next-generation Firewalls and IPS + +4.0 IP Services +4.8 Configure network devices for remote access using SSH + +5.0 Security Fundamentals +5.3 Configure device access control using local passwords + + +All devices in the network—endpoints, servers, and infrastructure devices like routers and switches—include some methods for the devices to legitimately communicate using the network. To protect those devices, the security plan will include a wide variety of tools and mitigation techniques, with the chapters in Part II of this book discussing a large variety of those tools and techniques. + +This chapter focuses on two particular security needs in an enterprise network. First, access to the CLI of the network devices needs to be protected. The network engineering team needs to be able to access the devices remotely, so the devices need to allow remote SSH (and possibly Telnet) access. The first half of this chapter discusses how to configure pass-words to keep them safe and how to filter login attempts at the devices themselves. +The second half of the chapter turns to two different security functions most often imple-mented with purpose-built appliances: firewalls and IPSs. These devices together moni- +tor traffic in transit to determine if the traffic is legitimate or if it might be part of some exploit. If considered to be part of an exploit, or if contrary to the rules defined by the devices, they can discard the messages, stopping any attack before it gets started. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 5-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Securing IOS Passwords +Firewalls and Intrusion Prevention Systems + +Questions 1–4 +5, 6 + + + + +1. Imagine that you have configured the enable secret command, followed by the enable password command, from the console. You log out of the switch and log back in at the console. Which command defines the password that you had to enter to access privileged mode? +a. enable password b. enable secret +c. Neither +d. The password command, if it’s configured + +2. Some IOS commands store passwords as clear text, but you can then encrypt the passwords with the service password-encryption global command. By comparison, other commands store a computed hash of the password instead of storing the pass-word. Comparing the two options, which one answer is the most accurate about why one method is better than the other? +a. Using hashes is preferred because encrypted IOS passwords can be easily decrypted. b. Using hashes is preferred because of the large CPU effort required for encryption. c. Using encryption is preferred because it provides stronger password protection. d. Using encryption is preferred because of the large CPU effort required for hashes. +3. A network engineer issues a show running-config command and sees only one line of output that mentions the enable secret command, as follows: +enable secret 5 $1$ZGMA$e8cmvkz4UjiJhVp7.maLE1 + +Which of the following is true about users of this router? +a. A user must type $1$ZGMA$e8cmvkz4UjiJhVp7.maLE1 to reach enable mode. +b. The router will hash the clear-text password that the user types to compare to the hashed password. +c. A no service password-encryption configuration command would decrypt this password. +d. The router will decrypt the password in the configuration to compare to the clear-text password typed by the user. + +4. A single-line ACL has been added to a router configuration using the command ip access-list 1 permit 172.16.4.0 0.0.1.255. The configuration also includes the +access-class 1 in command in VTY configuration mode. Which answer accurately describes how the router uses ACL 1? +a. Hosts in subnet 172.16.4.0/23 alone can telnet into the router. +b. CLI users cannot telnet from the router to hosts in subnet 172.16.4.0/23 alone. +c. Hosts in subnet 172.16.4.0/23 alone can log in but cannot reach enable mode of the router. +d. The router will only forward packets with source addresses in subnet 172.16.4.0/23. +88 CCNA 200-301 Official Cert Guide, Volume 2 + +5. A next-generation firewall sits at the edge of a company’s connection to the Internet. It has been configured to prevent Telnet clients residing in the Internet from accessing Telnet servers inside the company. Which of the following might a next-generation firewall use that a traditional firewall would not? +a. Match message destination well-known port 23 b. Match message application data +c. Match message IP protocol 23 +d. Match message source TCP ports greater than 49152 + +6. Which actions show a behavior typically supported by a Cisco next-generation IPS (NGIPS) beyond the capabilities of a traditional IPS? (Choose two answers) + +a. Gather and use host-based information for context +b. Comparisons between messages and a database of exploit signatures c. Logging events for later review by the security team +d. Filter URIs using reputation scores + + +Foundation Topics + +Securing IOS Passwords +The ultimate way to protect passwords in Cisco IOS devices is to not store passwords in IOS devices. That is, for any functions that can use an external authentication, authorization, and accounting (AAA) server, use it. However, it is common to store some passwords in a router or switch configuration, and this first section of the chapter discusses some of the ways to protect those passwords. + +As a brief review, Figure 5-1 summarizes some typical login security configuration on a router or switch. On the lower left, you see Telnet support configured, with the use of a password only (no username required). On the right, the configuration adds support for login with both username and password, supporting both Telnet and SSH users. The upper left shows the one command required to define an enable password in a secure manner. + + +Enable +enable secret myenablepw + + + +Telnet +line vty 0 15 +transport input telnet login +password mytelnetpw + + +Enable Mode (sw1#) + + +User Mode (sw1>) + + + +SSH and Telnet +username wendell secret odom ! +hostname sw1 +ip domain-name example.com crypto key generate rsa + +line vty 0 15 transport input all login local + + +Figure 5-1 Sample Login Security Configuration +Chapter 5: Securing Network Devices 89 + + +NOTE The configuration on the far right of the figure supports both SSH and Telnet, but consider allowing SSH only by instead using the transport input ssh command. The Telnet protocol sends all data unencrypted, so any attacker who copies the message with a Telnet login will have a copy of the password. + +The rest of this first section discusses how to make these passwords secure. In particular, this section looks at ways to avoid keeping clear-text passwords in the configuration and storing the passwords in ways that make it difficult for attackers to learn the password . + +Encrypting Older IOS Passwords with service password-encryption Some older-style IOS passwords create a security exposure because the passwords exist in the configuration file as clear text. These clear-text passwords might be seen in printed versions of the configuration files, in a backup copy of the configuration file stored on a server, or as displayed on a network engineer’s display. +Cisco attempted to solve this clear-text problem by adding a command to encrypt those 5 passwords: the service password-encryption global configuration command. This command +encrypts passwords that are normally held as clear text, specifically the passwords for these commands: + +password password (console or vty mode) username name password password(global) enable password password (global) + +To see how it works, Example 5-1 shows how the service password-encryption command encrypts the clear-text console password. The example uses the show running-config | section line con 0 command both before and after the encryption; this command lists only the section of the configuration about the console. +Example 5-1 Encryption and the service password-encryption Command + +Switch3# show running-config | section line con 0 +line con 0 +password cisco +login + +Switch3# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Switch3(config)# service password-encryption +Switch3(config)# ^Z + +Switch3# show running-config | section line con 0 +line con 0 +password 7 070C285F4D06 +login + +A close examination of the before and after show running-config command output reveals both the obvious effect and a new concept. The encryption process now hides the original +90 CCNA 200-301 Official Cert Guide, Volume 2 + +clear-text password. Also, IOS needs a way to signal that the value in the password com-mand lists an encrypted password rather than the clear text. IOS adds the encryption or encoding type of “7” to the command, which specifically refers to passwords encrypted with the service password-encryption command. (IOS considers the clear-text passwords to be type 0; some commands list the 0, and some do not.) + +While the service password-encryption global command encrypts passwords, the no service password-encryption global command does not immediately decrypt the passwords back to their clear-text state. Instead, the process works as shown in Figure 5-2. Basically, after you enter the no service password-encryption command, the passwords remain encrypted until you change a password. + + +1 service password-encryption + +2 no service password-encryption + +3 +Change Password + + + +mypass $Tm&x@3 + +Clear Encrypted + +$Tm&x@3 mypass + +Encrypted Clear + +Figure 5-2 Encryption Is Immediate; Decryption Awaits Next Password Change + +Unfortunately, the service password-encryption command does not protect the passwords very well. Armed with the encrypted value, you can search the Internet and find sites with tools to decrypt these passwords. In fact, you can take the encrypted password from this example, plug it into one of these sites, and it decrypts to “cisco.” So, the service password-encryption command will slow down the curious, but it will not stop a knowledgeable attacker. + +Encoding the Enable Passwords with Hashes +In the earliest days of IOS, Cisco used the enable password password global command to define the password that users had to use to reach enable mode (after using the enable +EXEC command). However, as just noted, the enable password password command stored the password as clear text, and the service password-encryption command encrypted the password in a way that was easily decrypted. + +Cisco solved the problem of only weak ways to store the password of the enable password password global command by making a more secure replacement: the enable secret password global command. However, both these commands exist in IOS even today. The next few pages look at these two commands from a couple of angles, including interactions between these two commands, why the enable secret command is more secure, along with a note about some advancements in how IOS secures the enable secret password. + +Interactions Between Enable Password and Enable Secret +First, for real life: use the enable secret password global command, and ignore the enable password password global command. That has been true for around 20 years. + +However, to be complete, Cisco has never removed the much weaker enable password command from IOS. So, on a single switch (or router), you can configure one or the other, + + + +Answers to the “Do I Know This Already?” quiz: 1 B 2 A 3 B 4 A 5 B 6 A, D +Chapter 5: Securing Network Devices 91 + +both, or neither. What, then, does the switch expect us to type as the password to reach enable mode? It boils down to these rules: + +Both commands configured: Users must use the password in the enable secret password command (and ignore the enable password password command). +Only one command configured: Use the password in that one command. +Neither command configured (default): Console users move directly to enable mode without a password prompt; Telnet and SSH users are rejected with no option to supply an enable password. + + +Making the Enable Secret Truly Secret with a Hash +The Cisco enable secret command protects the password value by never even storing the clear-text password in the configuration. However, that one sentence may cause you a bit of confusion: If the router or switch does not remember the clear-text password, how can the switch know that the user typed the right password after using the enable command? This section works through a few basics to show you how and appreciate why the password’s value is secret. + +First, by default, IOS uses a hash function called Message Digest 5 (MD5) to store an alter-native value in the configuration, rather than the clear-text password. Think of MD5 as a rather complex mathematical formula. In addition, this formula is chosen so that even if you know the exact result of the formula—that is, the result after feeding the clear-text pass-word through the formula as input—it is computationally difficult to compute the original clear-text password. Figure 5-3 shows the main ideas: + + + + + + +5 + + + + + +Clear Text + + + +Figure 5-3 + +MD5 Hash: F(Clear Text) = Secret +Computationally Simple! Secret + +Computationally Difficult! F’(Secret) = ClearText +One-Way Nature of MD5 Hash to Create Secret + + +NOTE “Computationally difficult” is almost a code phrase, meaning that the designers of the function hope that no one is willing to take the time to compute the original clear text. + +So, if the original clear-text password cannot be re-created, how can a switch or router use it to compare to the clear-text password typed by the user? The answer depends on another fact about these security hashes like MD5: each clear-text input results in a unique result from the math formula. + +The enable secret fred command generates an MD5 hash. If a user types fred when trying to enter enable mode, IOS will run MD5 against that value and get the same MD5 hash as is listed in the enable secret command, so IOS allows the user to access enable mode. If the +user typed any other value besides fred, IOS would compute a different MD5 hash than the value stored with the enable secret command, and IOS would reject that user’s attempt to reach enable mode. +92 CCNA 200-301 Official Cert Guide, Volume 2 + +Knowing that fact, the switch can make a comparison when a user types a password after using the enable EXEC command as follows: +Step 1. IOS computes the MD5 hash of the password in the enable secret command and stores the hash of the password in the configuration. +Step 2. When the user types the enable command to reach enable mode, a password that needs to be checked against that configuration command, IOS hashes the clear-text password as typed by the user. +Step 3. IOS compares the two hashed values: if they are the same, the user-typed pass-word must be the same as the configured password. + +As a result, IOS can store the hash of the password but never store the clear-text password; however, it can still determine whether the user typed the same password. +Switches and routers already use the logic described here, but you can see the evidence by looking at the switch configuration. Example 5-2 shows the creation of the enable secret command, with a few related details. This example shows the stored (hashed) value as revealed in the show running-configuration command output. That output also shows that IOS changed the enable secret fred command to list the encryption type 5 (which means the listed password is actually an MD5 hash of the clear-text password). The gobbledygook long text string is the hash, preventing others from reading the password. +Example 5-2 Cisco IOS Encoding Password “cisco” as Type 5 (MD5) + +Switch3(config)# enable secret fred +Switch3(config)# ^Z +Switch3# show running-config | include enable secret + +enable secret 5 $1$ZGMA$e8cmvkz4UjiJhVp7.maLE1 + +Switch3# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Switch3(config)# no enable secret +Switch3(config)# ^Z + +The end of the example also shows an important side point about deleting the enable secret password: after you are in enable mode, you can delete the enable secret password using the no enable secret command, without even having to enter the password value. You can also overwrite the old password by just repeating the enable secret command. But you can-not view the original clear-text password. + +NOTE Example 5-2 shows another shortcut illustrating how to work through long show command output, this time using the pipe to the include command. The | include enable secret part of the command processes the output from show running-config to include only the lines with the case-sensitive text “enable secret.” + +Improved Hashes for Cisco’s Enable Secret +The use of any hash function to encode passwords relies on several key features of the par-ticular hash function. In particular, every possible input value must result in a single hashed +Chapter 5: Securing Network Devices 93 + +value, so that when users type a password, only one password value matches each hashed value. Also, the hash algorithm must result in computationally difficult math (in other words, a pain in the neck) to compute the clear-text password based on the hashed value to discourage attackers. + +The MD5 hash algorithm has been around 30 years. Over those years, computers have got-ten much faster, and researchers have found creative ways to attack the MD5 algorithm, making MD5 less challenging to crack. That is, someone who saw your running configura-tion would have an easier time re-creating your clear-text secret passwords than in the early years of MD5. + +These facts are not meant to say that MD5 is bad, but like many cryptographic functions before MD5, progress has been made, and new functions were needed. To provide more recent options that would create a much greater challenge to attackers, Cisco added two additional hashes in the 2010s, as noted in Figure 5-4. + + +Type 9 Scrypt + + +5 + + + +Type 0 Type 7 Type 5 Clear Encrypted MD5 + +Type 4 Type 8 PBKDF2 PBKDF2 + + +1990 1995 2010 2015 Figure 5-4 Timeline of Encryptions/Hashes of Cisco IOS Passwords +IOS now supports two alternative algorithm types in the more recent router and switch IOS images. Both use an SHA-256 hash instead of MD5, but with two newer options, each of which has some differences in the particulars of how each algorithm uses SHA-256. Table +5-2 shows the configuration of all three algorithm types on the enable secret command. + +Table 5-2 Commands and Encoding Types for the enable secret Command + +Command Type enable [algorithm-type md5] secret password 5 enable algorithm-type sha256 secret password 8 +enable algorithm-type scrypt secret password 9 + +Algorithm MD5 +SHA-256 +SHA-256 + + +Example 5-3 shows the enable secret command being changed from MD5 to the scrypt algorithm. Of note, the example shows that only one enable secret command should exist between those three commands in Table 5-2. Basically, if you configure another enable secret command with a different algorithm type, that command replaces any existing enable secret command. +Example 5-3 Cisco IOS Encoding Password “mypass1” as Type 9 (SHA-256) + +R1# show running-config | include enable +enable secret 5 $1$ZSYj$725dBZmLUJ0nx8gFPTtTv0 +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# enable algorithm-type scrypt secret mypass1 +R1(config)# ^Z +94 CCNA 200-301 Official Cert Guide, Volume 2 + +R1# +R1# show running-config | include enable +enable secret 9 $9$II/EeKiRW91uxE$fwYuOE5EHoii16AWv2wSywkLJ/KNeGj8uK/24B0TVU6 +R1# + +Following the process shown in the example, the first command confirms that the current enable secret command uses encoding type 5, meaning it uses MD5. Second, the user con-figures the password using algorithm type scrypt. The last command confirms that only one enable secret command exists in the configuration, now with encoding type 9. + +Encoding the Passwords for Local Usernames +Cisco added the enable secret command back in the 1990s to overcome the problems with the enable password command. The username password and username secret commands have a similar history. Originally, IOS supported the username user password password command—a command that had those same issues of being a clear-text password or a poor-ly encrypted value (with the service password-encryption feature). Many years later, Cisco added the username user secret password global command, which encoded the password as an MD5 hash, with Cisco adding support for the newer SHA-256 hashes later. + +Today, the username secret command is preferred over the username password command; however, IOS does not use the same logic for the username command as it does for allow-ing both the enable secret plus enable password commands to exist in the same configura-tion. IOS allows +■ Only one username command for a given username—either a username name password password command or a username name secret password command +■ A mix of commands (username password and username secret) in the same router or switch (for different usernames) + +You should use the username secret command instead of the username password com-mand when possible. However, note that some IOS features require that the router knows a clear-text password via the username command (for instance, when performing some com-mon authentication methods for serial links called PAP and CHAP). In those cases, you still need to use the username password command. + +As mentioned, the more recent IOS versions on both switches and routers use the additional encoding options beyond MD5, just as supported with the enable secret command. +Table 5-3 shows the syntax of those three options in the username command, with the MD5 option shown as an option because it is the default used with the username secret command. + +Table 5-3 Commands and Encoding Types for the username secret Command + +Command Type username name [algorithm-type md5] secret password 5 username name algorithm-type sha256 secret password 8 +username name algorithm-type scrypt secret password 9 + +Algorithm MD5 +SHA-256 +SHA-256 +Chapter 5: Securing Network Devices 95 + +Controlling Password Attacks with ACLs +Attackers can repeatedly try to log in to your network devices to gain access, but IOS has a feature that uses ACLs to prevent the attacker from even seeing a password prompt. When an external user connects to a router or switch using Telnet or SSH, IOS uses a vty line to represent that user connection. IOS can apply an ACL to the vty lines, filtering the addresses that can telnet or SSH into the router or switch. If filtered, the user never sees a login prompt. + +For example, imagine that all the network engineering staff’s devices connect into subnet 10.1.1.0/24. The security policy states that only the network engineering staff should be allowed to telnet or SSH into any of the Cisco routers in a network. In such a case, the configuration shown in Example 5-4 could be used on each router to deny access from IP addresses not in that subnet. +Example 5-4 vty Access Control Using the access-class Command + +line vty 0 4 +login 5 +password cisco +access-class 3 in +! +! Next command is a global command that matches IPv4 packets with +! a source address that begins with 10.1.1. +access-list 3 permit 10.1.1.0 0.0.0.255 + +The access-class command refers to the matching logic in access-list 3. The keyword in refers to Telnet and SSH connections into this router—in other words, people telnetting into this router. As configured, ACL 3 checks the source IP address of packets for incoming Telnet connections. + +IOS also supports using ACLs to filter outbound Telnet and SSH connections. For example, consider a user who first uses Telnet or SSH to connect to the CLI and now sits in user or enable mode. With an outbound vty filter, IOS will apply ACL logic if the user tries the tel-net or ssh commands to connect out of the local device to another device. + +To configure an outbound VTY ACL, use the access-class acl out command in VTY con-figuration mode. Once configured, the router filters any attempts made by current vty users to use the telnet and ssh commands to initiate new connections to other devices. +Of the two options—to protect inbound and outbound connections—protecting inbound connections is by far the more important and more common. However, to be complete, outbound VTY ACLs have a surprisingly odd feature in how they use the ACL. When the out keyword is used, the standard IP ACL listed in the access-class command actually looks at the destination IP address, and not the source. That is, it filters based on the device to which the telnet or ssh command is trying to connect. + +Firewalls and Intrusion Prevention Systems +The next topic examines the roles of a couple of different kinds of networking devices: firewalls and intrusion prevention systems (IPSs). Both devices work to secure networks but with slightly different goals and approaches. +96 CCNA 200-301 Official Cert Guide, Volume 2 + +This second major section of the chapter takes a look at each. This section first discusses the core traditional features of both firewalls and IPSs. The section closes with a description of the newer features in the current generation of these products, called next-generation prod-ucts, which improves the functions of each. + +Traditional Firewalls +Traditionally, a firewall sits in the forwarding path of all packets so that the firewall can then choose which packets to discard and which to allow through. By doing so, the firewall protects the network from different kinds of issues by allowing only the intended types +of traffic to flow in and out of the network. In fact, in its most basic form, firewalls do the same kinds of work that routers do with ACLs, but firewalls can perform that packet-filter-ing function with many more options, as well as perform other security tasks. + +Figure 5-5 shows a typical network design for a site that uses a physical firewall. The figure shows a firewall, like the Cisco Adaptive Security Appliance (ASA) firewall, connected to a Cisco router, which in turn connects to the Internet. All enterprise traffic going to or from the Internet would be sent through the firewall. The firewall would consider its rules and make a choice for each packet, whether the packet should be allowed through. + + +Internet + +Firewall + + + + + +Figure 5-5 Firewall as Positioned in the Packet Forwarding Path + +Although firewalls have some router-like features (such as packet forwarding and packet filtering), they provide much more advanced security features than a traditional router. For example, most firewalls can use the following kinds of logic to make the choice of whether to discard or allow a packet: + +■ Like router IP ACLs, match the source and destination IP addresses +■ Like router IP ACLs, identify applications by matching their static well-known TCP and UDP ports +■ Watch application-layer flows to know what additional TCP and UDP ports are used by a particular flow, and filter based on those ports +■ Match the text in the URI of an HTTP request—that is, look at and compare the con-tents of what is often called the web address—and match patterns to decide whether to allow or deny the download of the web page identified by that URI +■ Keep state information by storing information about each packet, and make decisions about filtering future packets based on the historical state information (called stateful inspection, or being a stateful firewall) + +The stateful firewall feature provides the means to prevent a variety of attacks and is one of the more obvious differences between the ACL processing of a router versus security +Chapter 5: Securing Network Devices + +filtering by a firewall. Routers must spend as little time as possible processing each packet so that the packets experience little delay passing through the router. The router cannot take the time to gather information about a packet, and then for future packets, consider some saved state information about earlier packets when making a filtering decision. Because they focus on network security, firewalls do save some information about packets and can consider that information for future filtering decisions. + +As an example of the benefits of using a stateful firewall, consider a simple denial of service (DoS) attack. An attacker can make this type of attack against a web server by using tools that create (or start to create) a large volume of TCP connections to the server. The firewall might allow TCP connections to that server normally, but imagine that the server might typically receive 10 new TCP connections per second under normal conditions and 100 per second at the busiest times. A DoS attack might attempt thousands or more TCP connec-tions per second, driving up CPU and RAM use on the server and eventually overloading the server to the point that it cannot serve legitimate users. + +A stateful firewall could be tracking the number of TCP connections per second—that is, recording state information based on earlier packets—including the number of TCP connec-tion requests from each client IP address to each server address. The stateful firewall could notice a large number of TCP connections, check its state information, and then notice that the number of requests is very large from a small number of clients to that particular server, which is typical of some kinds of DoS attacks. The stateful firewall could then start filter-ing those packets, helping the web server survive the attack, whereas a stateless firewall or a router ACL would not have had the historical state information to realize that a DoS attack was occurring. + +Security Zones +Firewalls not only filter packets, they also pay close attention to which host initiates com-munications. That concept is most obvious with TCP as the transport layer protocol, where the client initiates the TCP connection by sending a TCP segment that sets the SYN bit only (as seen in Figure 1-5 in Chapter 1, “Introduction to TCP/IP Transport and Applications”). + +Firewalls use logic that considers which host initiated a TCP connection by watching these initial TCP segments. To see the importance of who initiates the connections, think about a typical enterprise network with a connection to the Internet, as shown in Figure 5-6. The company has users inside the company who open web browsers, initiating connections to web servers across the Internet. However, by having a working Internet connection, that same company opens up the possibility that an attacker might try to create a TCP connec- +tion to the company’s internal web servers used for payroll processing. Of course, the com-pany does not want random Internet users or attackers to be able to connect to their payroll server. + +Firewalls use the concept of security zones (also called a zone for short) when defining which hosts can initiate new connections. The firewall has rules, and those rules define which host can initiate connections from one zone to another zone. Also, by using zones, a firewall can place multiple interfaces into the same zone, in cases for which multiple inter-faces should have the same security rules applied. Figure 5-7 depicts the idea with the inside part of the enterprise considered to be in a separate zone compared to the interfaces con-nected toward the Internet. + +97 + + + + + + + + + + + + + + + + +5 +98 CCNA 200-301 Official Cert Guide, Volume 2 + + +Payroll Server +No! + + +User + + + + +Internet SW +Firewall + + + +User Figure 5-6 + +Zone Inside + +Yes! +Web Server Allowing Outbound Connections and Preventing Inbound Connections + +Zone Outside + + +SW1 R1 Internet + +SW2 Firewall R2 +Rule: Inside Can Initiate to Outside for Ports… Figure 5-7 Using Security Zones with Firewalls +The most basic firewall rule when using two zones like Figure 5-7 reduces to this logic: + +Allow hosts from zone inside to initiate connections to hosts in zone outside, for a pre-defined set of safe well-known ports (like HTTP port 80, for instance). + +Note that with this one simple rule, the correct traffic is allowed while filtering the unwant-ed traffic by default. Firewalls typically disallow all traffic unless a rule specifically allows the packet. So, with this simple rule to allow inside users to initiate connections to the out-side zone, and that alone, the firewall also prevents outside users from initiating connections to inside hosts. + +Most companies have an inside and outside zone, as well as a special zone called the demili-tarized zone (DMZ). Although the DMZ name comes from the real world, it has been used in IT for decades to refer to a firewall security zone used to place servers that need to be available for use by users in the public Internet. For example, Figure 5-8 shows a typical Internet edge design, with the addition of a couple of web servers in its DMZ connected through the firewall. The firewall then needs another rule that enables users in the zone outside—that is, users in the Internet—to initiate connections to those web servers in the DMZ. By separating those web servers into the DMZ, away from the rest of the enterprise, the enterprise can prevent Internet users from attempting to connect to the internal devices in the inside zone, preventing many types of attacks. +Chapter 5: Securing Network Devices 99 + +Zone Inside Zone Outside + +Initiate + + + +Internet + + + +Public Web Servers +www.example.com + +Initiate + + +Zone DMZ + + +Figure 5-8 Using a DMZ for Enterprise Servers That Need to Be Accessible from the Internet + +Intrusion Prevention Systems (IPS) 5 Traditionally, a firewall works with a set of user-configured rules about where packets +should be allowed to flow in a network. The firewall needs to sit in the path of the packets so it can filter the packets, redirect them for collection and later analysis, or let them con-tinue toward their destination. + +A traditional intrusion prevention system (IPS) can sit in the path packets take through the network, and it can filter packets, but it makes its decisions with different logic. The IPS first downloads a database of exploit signatures. Each signature defines different header field values found in sequences of packets used by different exploits. Then the IPS can examine packets, compare them to the known exploit signatures, and notice when packets may be part of a known exploit. Once identified, the IPS can log the event, discard packets, or even redirect the packets to another security application for further examination. + +A traditional IPS differs from firewalls in that instead of an engineer at the company defin-ing rules for that company based on applications (by port number) and zones, the IPS applies the logic based on signatures supplied mostly by the IPS vendor. Those signatures look for these kinds of attacks: + +■ DoS ■ DDoS +■ Worms ■ Viruses + +To accomplish its mission, the IPS needs to download and keep updating its signature database. Security experts work to create the signatures. The IPS must then download the exploit signature database and keep downloading updates over time, as shown in Figure 5-9. +100 CCNA 200-301 Official Cert Guide, Volume 2 + + + +Signatures + + + + + + + +Internet + + + +IPS +Figure 5-9 + +Firewall +IPS and Signature Database + + +For example, think about what happens when an entirely new computer virus has been cre-ated. Host-based security products, like antivirus software, should be installed on the com-puters inside the company. These tools use a similar model as the IPS, keeping an updated database of virus signatures. The signatures might look for patterns in how a computer virus could be stored inside files on the computer, or in files sent to the computer via email or web browsers. But there will be some time lag between the day when the virus has been discovered (called zero-day attacks) and when researchers have developed a virus signature, changed their database, and allowed time for all the hosts to update their antivirus software. The hosts are at risk during this time lag. + +The IPS provides a complimentary service to prevent viruses. Researchers will look for ways an IPS could recognize the same virus while in flight through the network with new IPS sig-natures—for instance, looking for packets with a particular port and a particular hex string in the application payload. Once developed, the IPS devices in the network need to be updated with the new signature database, protecting against that virus. Both the host-based and IPS-based protections play an important role, but the fact that one IPS protects sections of a network means that the IPS can sometimes more quickly react to new threats to protect hosts. + +Cisco Next-Generation Firewalls +The CCNA 200-301 exam topics mention the terms firewall and IPS but prefaced with the term next-generation. Around the mid 2010s, Cisco and some of their competitors started using the term next generation when discussing their security products to emphasize some of the newer features. In short, a next-generation firewall (NGFW) and a next-generation IPS (NGIPS) are the now-current firewall and IPS products from Cisco. + +However, the use of the term next generation goes far beyond just a marketing label: the term emphasizes some major shifts and improvements over the years. The security industry sees endless cycles of new attacks followed by new solutions, with some solutions requir-ing new product features or even new products. Some of the changes that have required new security features include the proliferation of mobile devices—devices that leave the enterprise, connect to the Internet, and return to the Enterprise—creating a whole new level of risk. Also, no single security function or appliance (firewall, IPS, antimalware) can hope to stop some threats, so the next-generation tools must be able to work better together to +Chapter 5: Securing Network Devices + +provide solutions. In short, the next-generation products have real useful features not found in their predecessor products. + +As for Cisco products, for many years Cisco branded its firewalls as the Cisco Adaptive Security Appliance (ASA). Around 2013, Cisco acquired Sourcefire, a security product com-pany. Many of the next-generation firewall (and IPS) features come from software acquired through that acquisition. As of 2019 (when this chapter was written), all of Cisco’s currently sold firewalls have names that evoke memories of the Sourcefire acquisition, with most of the firewall product line being called Cisco Firepower firewalls (www.cisco.com/go/firewalls). + +An NGFW still does the traditional functions of a firewall, of course, like stateful filtering by comparing fields in the IP, TCP, and UDP headers, and using security zones when defin-ing firewall rules. To provide some insight into some of the newer next-generation features, consider the challenge of matching packets with ports: + +1. Each IP-based application should use a well-known port. +2. Attackers know that firewalls will filter most well-known ports from sessions initiated from the outside zone to the inside zone (see Figure 5-8). +3. Attackers use port scanning to find any port that a company’s firewall will allow through right now. +4. Attackers attempt to use a protocol of their choosing (for example, HTTP) but with the nonstandard port found through port scanning as a way to attempt to connect to hosts inside the enterprise. + +The sequence lists a summary of some of the steps attackers need to take but does not list every single task. However, even to this depth, you can see how attackers can find a way to send packets past the corporate firewall. + +The solution? A next-generation firewall that looks at the application layer data to identify the application instead of relying on the TCP and UDP port numbers used. Cisco performs their deep packet inspection using a feature called Application Visibility and Control (AVC). Cisco AVC can identify many applications based on the data sent (application layer headers plus application data structures far past the TCP and UDP headers). When used with a Cisco NGFW, instead of matching port numbers, the firewall matches the applica-tion, defeating attacks like the one just described. +The following list mentions a few of the features of an NGFW. Note that while NGFW is a useful term, the line between a traditional firewall and a next-generation firewall can be a bit blurry, as the terms describe products that have gone through repeated changes over long periods of time. This list does summarize a few of the key points, however: + +■ Traditional firewall: An NGFW performs traditional firewall features, like stateful fire-wall filtering, NAT/PAT, and VPN termination. +■ Application Visibility and Control (AVC): This feature looks deep into the application layer data to identify the application. For instance, it can identify the application based on the data, rather than port number, to defend against attacks that use random port numbers. +■ Advanced Malware Protection: NGFW platforms run multiple security services, not just as a platform to run a separate service, but for better integration of functions. A network-based antimalware function can run on the firewall itself, blocking file transfers that would install malware, and saving copies of files for later analysis. + +101 + + + + + + + + + + + + + + + + +5 +102 CCNA 200-301 Official Cert Guide, Volume 2 + +■ URL Filtering: This feature examines the URLs in each web request, categorizes the URLs, and either filters or rate limits the traffic based on rules. The Cisco Talos security group monitors and creates reputation scores for each domain known in the Internet, with URL filtering being able to use those scores in its decision to categorize, filter, or rate limit. +■ NGIPS: The Cisco NGFW products can also run their NGIPS feature along with the firewall. + +Note that for any of the services that benefit from being in the same path that packets tra-verse, like a firewall, it makes sense that over time those functions could migrate to run on the same product. So, when the design needs both a firewall and IPS at the same location in the network, these NGFW products can run the NGIPS feature as shown in the combined device in Figure 5-10. + + + +Talos + + + + + + + +Internet + + +NGIPS & NGFW +Figure 5-10 Next-Generation Firewall with Next-Generation IPS Module + +Cisco Next-Generation IPS +The Cisco next-generation IPS (NGIPS) products have followed a similar path as the Cisco NGFW products. Cisco first added NGIPS features primarily through its Sourcefire acquisi-tion, with the now-current (in 2019) Cisco IPS products also using the Firepower name. In fact, as a product line, the hardware NGFW and NGIPS products are the same products, with the ability to run both the NGFW and NGIPS. + +As with the NGFW, the NGIPS adds features to a traditional IPS. For instance, one of the biggest issues with a traditional IPS comes with the volume of security events logged by the IPS. For instance: + +1. An IPS compares the signature database, which lists all known exploits, to all messages. 2. It generates events, often far more than the security staff can read. +3. The staff must mentally filter events to find the proverbial needle in the haystack, possible only through hard work, vast experience, and a willingness to dig. + +An NGIPS helps with this issue in a couple of ways. First, an NGIPS examines the context by gathering data from all the hosts and the users of those hosts. The NGIPS will know the OS, software revision levels, what apps are running, open ports, the transport protocols and port numbers in use, and so on. Armed with that data, the NGIPS can make much more intelligent choices about what events to log. +Chapter 5: Securing Network Devices 103 + +For instance, consider an NGIPS placed into a network to protect a campus LAN where end users connect, but no data center exists in that part of the network. Also, all PCs happen +to be running Windows, and possibly the same version, by corporate policy. The signature database includes signatures for exploits of Linux hosts, Macs, Windows version nonexis-tent in that part of the network, and exploits that apply to server applications that are not running on those hosts. After gathering those facts, an NGIPS can suggest de-emphasizing checks for exploits that do not apply to those endpoints, spending more time and focus on events that could occur, greatly reducing the number of events logged. + +The following list mentions a few of the Cisco NGIPS features: + +■ Traditional IPS: An NGIPS performs traditional IPS features, like using exploit signatures to compare packet flows, creating a log of events, and possibly discarding and/or redi-recting packets. +■ Application Visibility and Control (AVC): As with NGFWs, an NGIPS has the ability to look deep into the application layer data to identify the application. +■ Contextual Awareness: NGFW platforms gather data from hosts—OS, software ver- 5 sion/level, patches applied, applications running, open ports, applications currently send- +ing data, and so on. Those facts inform the NGIPS as to the often more limited vulner-abilities in a portion of the network so that the NGIPS can focus on actual vulnerabilities while greatly reducing the number of logged events. +■ Reputation-Based Filtering: The Cisco Talos security intelligence group researches secu-rity threats daily, building the data used by the Cisco security portfolio. Part of that data identifies known bad actors, based on IP address, domain, name, or even specific URL, with a reputation score for each. A Cisco NGIPS can perform reputation-based filtering, taking the scores into account. +■ Event Impact Level: Security personnel need to assess the logged events, so an NGIPS provides an assessment based on impact levels, with characterizations as to the impact if an event is indeed some kind of attack. + +If you want to learn a little more about these topics for your own interest, let me refer you to a couple of resources. First, check out articles and blog posts from the Cisco Talos Intelligence Group (www.talosintelligence.com). The Cisco Talos organization researches security issues around the globe across the entire spectrum of security prod-ucts. Additionally, one Cisco Press book has some great information about both next-generation firewalls and IPSs, written at a level appropriate as a next step. If you want to +read more, check out this book with the long name: Integrated Security Technologies and Solutions, Volume I: Cisco Security Solutions for Advanced Threat Protection with Next Generation Firewall, Intrusion Prevention, AMP, and Content Security (or just use its ISBN, 9781587147067), with one chapter each on NGFW and NGIPS. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 5-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. +104 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 5-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Repeat DIKTA questions Do labs +Review command tables + +Resource Used Book, website Book, website Book, PTP +Blog +Book + + +Review All the Key Topics Table 5-5 Key Topics for Chapter 5 + +Key Topic Element +List + +List + +List + +List Figure 5-6 Figure 5-8 List +List + +Description Page Number +Commands whose passwords are encrypted by service password- 89 encryption +Rules for when IOS uses the password set with the enable 91 password versus enable secret commands +Logic by which IOS can use the enable secret hash when a user 92 types a clear-text password to reach enable mode +Rule for combinations of the username command 94 Typical client filtering by firewall at Internet edge 98 Firewall security zones with DMZ 99 Features of next-generation firewalls 101 +Features of next-generation IPSs 103 + + +Key Terms You Should Know +enable secret, local username, MD5 hash, username secret, firewall, IPS, next-generation firewall (NGFW), next-generation IPS (NGIPS), Application Visibility and Control + +Do Labs +The Sim Lite software is a version of Pearson’s full simulator learning product with a subset of the labs, included free with this book. The Sim Lite with this book includes a couple of labs about various password-related topics. Also, check the author’s blog site pages for con-figuration exercises (Config Labs) at https://blog.certskills.com/config-labs. + +Command References +Tables 5-6 and 5-7 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. +Chapter 5: Securing Network Devices 105 + +Table 5-6 Chapter 5 Configuration Commands + +Command line console 0 + +line vty 1st-vty last-vty + +login + +password pass-value + +login local + + +username name [algorithm-type md5 | sha256 | scrypt] secret pass-value +username name password pass-value +crypto key generate rsa [modulus 512 | 768 | 1024] +transport input {telnet | ssh | all | none} +[no] service password-encryption + +enable password pass-value + +enable [algorithm-type md5 | sha256 | scrypt] secret +pass-value +no enable secret + +no enable password +access-class number | name in + +Mode/Purpose/Description +Command that changes the context to console configuration mode. +Command that changes the context to vty configuration mode for the range of vty lines listed in the command. +Console and vty configuration mode. Tells IOS to prompt for a password. +Console and vty configuration mode. Lists the password required if the login command is configured. +Console and vty configuration mode. Tells IOS to prompt for a username and password, to be checked against locally configured username global configuration commands. +Global command. Defines one of possibly multiple usernames +and associated passwords, stored as a hashed value (default 5 +MD5), with other hash options as well. +Global command. Defines a username and password, stored in clear text in the configuration by default. +Global command. Creates and stores (in a hidden location in flash memory) the keys required by SSH. +vty line configuration mode. Defines whether Telnet and/or SSH access is allowed into this switch. +Global command that encrypts all clear-text passwords in the running-config. The no version of the command disables the encryption of passwords when the password is set. +Global command to create the enable password, stored as a clear text instead of a hashed value. +Global command to create the enable password, stored as a hashed value instead of clear text, with the hash defined by the algorithm type. +Global command to delete the enable secret or enable password commands, respectively. + +A vty mode command that enables inbound ACL checks against Telnet and SSH clients connecting to the router. + + +Table 5-7 Chapter 5 EXEC Command Reference + +Command +show running-config | section vty + +show running-config | section con + +show running-config | include enable + +Purpose +Lists the vty lines and subcommands from the configuration. +Lists the console and subcommands from the configuration. +Lists all lines in the configuration with the word enable. +CHAPTER 6 + + + +Implementing Switch Port Security This chapter covers the following exam topics: +5.0 Security Fundamentals +5.7 Configure Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) + + +In modern networks, security must be implemented in depth. The security architecture should use firewalls and intrusion prevention systems (IPS) at strategic locations, and hosts should use antivirus and antimalware tools. Routers, which already need to exist throughout the enterprise at the edge between local-area networks and wide-area networks, can be con-figured with IP access control lists to filter packets related to different IP address ranges in that enterprise. + +LAN switches have a unique opportunity as a security enforcement point, particularly LAN switches connected to endpoint devices. Attackers often launch attacks from the endpoints connected to an enterprise LAN switch. The attacker might gain physical access to the end-point or first infect the device to then launch an attack. Additionally, a mobile device can become infected while outside the company network and then later connect to the com-pany network, with the attack launching at that point. + +Engineers should assume that attacks might be launched from end-user devices connected directly to access ports on the enterprise’s LAN switches, so Cisco switches include a num-ber of useful tools to help prevent several types of attacks. This chapter discusses one such tool: port security. Chapter 8, “DHCP Snooping and ARP Inspection,” discusses two other switch security tools that take advantage of the switch’s access layer role, with Chapter 7, “Implementing DHCP,” providing the background details needed to understand the tools in Chapter 8. + +This short chapter takes a straightforward approach to the port security feature. The first section discusses the concepts, configuration, and verification, using the primary port secu-rity operational mode: shutdown mode. The second section then discusses some of the intricacies of the three operational modes: shutdown, verify, and restrict. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 6-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Port Security Concepts and Configuration +Port Security Violation Modes + +Questions 1–3 +4, 5 + + +1. Which of the following is required when configuring port security with sticky learning? +a. Setting the maximum number of allowed MAC addresses on the interface with the switchport port-security maximum interface subcommand. +b. Enabling port security with the switchport port-security interface subcommand. +c. Defining the specific allowed MAC addresses using the switchport port-security mac-address interface subcommand. +d. All the other answers list required commands. + +2. A Cisco Catalyst switch connects to what should be individual user PCs. Each port has the same port security configuration, configured as follows: +interface range gigabitethernet 0/1 - 24 +switchport mode access +switchport port-security +switchport port-security mac-address sticky + +Which of the following answers describe the result of the port security configuration created with these commands? (Choose two answers.) +a. Prevents unknown devices with unknown MAC addresses from sending data through the switch ports. +b. If a user connects a switch to the cable, prevents multiple devices from sending data through the port. +c. Will allow any one device to connect to each port and will save that device’s MAC address into the startup-config. +d. Will allow any one device to connect to each port but will not save that device’s MAC address into the startup-config. + +3. Which of the following commands list the MAC address table entries for MAC addresses configured by port security? (Choose two answers.) +a. show mac address-table dynamic b. show mac address-table +c. show mac address-table static +d. show mac address-table port-security +108 CCNA 200-301 Official Cert Guide, Volume 2 + +4. The show port-security interface f0/1 command lists a port status of secure-down. Which one of the following answers must be true about this interface at this time? +a. The show interface status command lists the interface status as connected. b. The show interface status command lists the interface status as err-disabled. +c. The show port-security interface command could list a mode of shutdown or restrict, but not protect. +d. The show port-security interface command could list a violation counter value of 10. + +5. A switch’s port Gi0/1 has been correctly enabled with port security. The configura-tion sets the violation mode to restrict. A frame that violates the port security policy enters the interface, followed by a frame that does not. Which of the following answers correctly describe what happens in this scenario? (Choose two answers.) +a. The switch puts the interface into an err-disabled state when the first frame arrives. +b. The switch generates syslog messages about the violating traffic for the first frame. +c. The switch increments the violation counter for Gi0/1 by 1. d. The switch discards both the first and second frame. + + +Foundation Topics + +Port Security Concepts and Configuration +If the network engineer knows what devices should be cabled and connected to particular interfaces on a switch, the engineer can use port security to restrict that interface so that only the expected devices can use it. This reduces exposure to attacks in which the attacker connects a laptop to some unused switch port. When that inappropriate device attempts to send frames to the switch interface, the switch can take different actions, ranging from sim-ply issuing informational messages to effectively shutting down the interface. + +Port security identifies devices based on the source MAC address of Ethernet frames that the devices send. For example, in Figure 6-1, PC1 sends a frame, with PC1’s MAC address as the source address. SW1’s F0/1 interface can be configured with port security, and if so, SW1 would examine PC1’s MAC address and decide whether PC1 was allowed to send frames into port F0/1. + +1 F0/1 +Frame SW1 +G0/1 Source = PC1 MAC +G0/2 2 F0/2 +SW2 Frame + +Source = PC2 MAC +Figure 6-1 Source MAC Addresses in Frames as They Enter a Switch +Chapter 6: Implementing Switch Port Security 109 + +Port security also has no restrictions on whether the frame came from a local device or was forwarded through other switches. For example, switch SW1 could use port security on its G0/1 interface, checking the source MAC address of the frame from PC2, when forwarded up to SW1 from SW2. + +Port security has several flexible options, but all operate with the same core concepts. First, switches enable port security per port, with different settings available per port. Each port has a maximum number of allowed MAC addresses, meaning that for all frames entering that port, only that number of different source MAC addresses can be used before port security thinks a violation has occurred. When a frame with a new source MAC address arrives, pushing the number of MAC addresses past the allowed maximum, a port security violation occurs. At that point, the switch takes action—by default, discarding all future incoming traffic on that port. + +The following list summarizes these ideas common to all variations of port security: + +■ It examines frames received on the interface to determine if a violation has occurred. +■ It defines a maximum number of unique source MAC addresses allowed for all frames coming in the interface. +■ It keeps a list and counter of all unique source MAC addresses on the interface. +■ It monitors newly learned MAC addresses, considering those MAC addresses to cause a 6 +violation if the newly learned MAC address would push the total number of MAC table entries for the interface past the configured maximum allowed MAC addresses for that port. +■ It takes action to discard frames from the violating MAC addresses, plus other actions depending on the configured violation mode. + +Those rules define the basics, but port security allows other options as well, including options like these: +■ Define a maximum of three MAC addresses, defining all three specific MAC addresses. +■ Define a maximum of three MAC addresses but allow those addresses to be dynamically learned, allowing the first three MAC addresses learned. +■ Define a maximum of three MAC addresses, predefining one specific MAC address, and allowing two more to be dynamically learned. + +You might like the idea of predefining the MAC addresses for port security, but finding the MAC address of each device can be a bother. Port security provides a useful compro-mise using a feature called sticky secure MAC addresses. With this feature, port security learns the MAC addresses off each port so that you do not have to preconfigure the values. It also adds the learned MAC addresses to the port security configuration (in the running- +config file). This feature helps reduce the big effort of finding out the MAC address of each device. + +As you can see, port security has a lot of detailed options. The next few sections walk you through these options to pull the ideas together. + +Configuring Port Security +Port security configuration involves several steps. First, port security works on both access ports and trunk ports, but it requires you to statically configure the port as a trunk or an +110 CCNA 200-301 Official Cert Guide, Volume 2 + +access port, rather than let the switch dynamically decide whether to use trunking. The following configuration checklist details how to enable port security, set the maximum allowed MAC addresses per port, and configure the actual MAC addresses: +Step 1. Use the switchport mode access or the switchport mode trunk interface sub-commands, respectively, to make the switch interface either a static access or trunk interface. +Step 2. Use the switchport port-security interface subcommand to enable port secu-rity on the interface. +Step 3. (Optional) Use the switchport port-security maximum number interface sub-command to override the default maximum number of allowed MAC address-es associated with the interface (1). +Step 4. (Optional) Use the switchport port-security violation {protect | restrict | shutdown} interface subcommand to override the default action to take upon a security violation (shutdown). +Step 5. (Optional) Use the switchport port-security mac-address mac-address inter-face subcommand to predefine any allowed source MAC addresses for this interface. Use the command multiple times to define more than one MAC address. +Step 6. (Optional) Use the switchport port-security mac-address sticky interface subcommand to tell the switch to “sticky learn” dynamically learned MAC addresses. + +To demonstrate how to configure this variety of the settings, Figure 6-2 and Example 6-1 show four examples of port security. Three ports operate as access ports, while port F0/4, connected to another switch, operates as a trunk. + + +Static Fa0/1 + +Sticky Fa0/2 + +Dynamic Fa0/3 + +Maximum 8 +Fa0/4 + + +Server 1 0200.1111.1111 + +Server 2 0200.2222.2222 + +Company Comptroller + + +SW2 + + +Figure 6-2 Port Security Configuration Example + + + + + + +Answers to the “Do I Know This Already?” quiz: 1 B 2 B, D 3 B, C 4 B 5 B, C +Chapter 6: Implementing Switch Port Security 111 + +Example 6-1 Variations on Port Security Configuration + +SW1# show running-config +(Lines omitted for brevity) + + +interface FastEthernet0/1 +switchport mode access +switchport port-security +switchport port-security mac-address 0200.1111.1111 +! +interface FastEthernet0/2 +switchport mode access +switchport port-security +switchport port-security mac-address sticky +! +interface FastEthernet0/3 +switchport mode access +switchport port-security +! +interface FastEthernet0/4 +switchport mode trunk +switchport port-security +switchport port-security maximum 8 + + + + + + + + + + + + + + + +6 + + +First, scan the configuration for all four interfaces in Example 6-1, focusing on the first two interface subcommands in each case. Note that the first three interfaces in the example use the same first two interface subcommands, matching the first two configuration steps noted before Figure 6-2. The switchport port-security command enables port security, with all defaults, with the switchport mode access command meeting the requirement to configure the port as either an access or trunk port. The final port, F0/4, has a similar configuration, except that it has been configured as a trunk rather than as an access port. +Next, scan all four interfaces again, and note that the configuration differs on each inter-face after those first two interface subcommands. Each interface simply shows a different example for perspective. + +The first interface, FastEthernet 0/1, adds one optional port security subcommand: switchport port-security mac-address 0200.1111.1111, which defines a specific source MAC address. With the default maximum source address setting of 1, only frames with source MAC 0200.1111.1111 will be allowed in this port. When a frame with a source other than 0200.1111.1111 enters F0/1, the switch would normally perform MAC address learning and want to add the new source MAC address to the MAC address table. Port security will see that action as learning one too many MAC addresses on the port, taking the default violation action to disable the interface. + +As a second example, FastEthernet 0/2 uses the same logic as FastEthernet 0/1, except that it uses the sticky learning feature. For port F0/2, the configuration of the switchport +port-security mac-address sticky command tells the switch to dynamically learn source MAC addresses and add port-security commands to the running-config. Example 6-2 shows the running-config file that lists the sticky-learned MAC address in this case. +112 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 6-2 Configuration Added by the Port Security Sticky Feature + +SW1# show running-config interface f0/2 +Building configuration... +Current configuration : 188 bytes +! +interface FastEthernet0/2 +switchport mode access +switchport port-security +switchport port-security mac-address sticky +switchport port-security mac-address sticky 0200.2222.2222 + +Port security does not save the configuration of the sticky addresses, so use the copy running-config startup-config command if desired. + +The other two interfaces in Example 6-1 do not predefine MAC addresses, nor do they sticky-learn the MAC addresses. The only difference between these two interfaces’ port security configuration is that FastEthernet 0/4 supports eight MAC addresses because it connects to another switch and should receive frames with multiple source MAC addresses. Interface F0/3 uses the default maximum of one MAC address. + +NOTE Switches can also use port security on voice ports and EtherChannels. For voice ports, make sure to configure the maximum MAC address to at least two (one for the phone, or for a PC connected to the phone). On EtherChannels, the port security configu-ration should be placed on the port-channel interface, rather than the individual physical interfaces in the channel. + +Verifying Port Security +The show port-security interface command provides the most insight to how port security operates, as shown in Example 6-3. This command lists the configuration settings for port security on an interface; plus it lists several important facts about the current operation of port security, including information about any security violations. The two commands in the example show interfaces F0/1 and F0/2, based on Example 6-1’s configuration. +Example 6-3 Using Port Security to Define Correct MAC Addresses of Particular Interfaces + +SW1# show port-security interface fastEthernet 0/1 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-shutdown +: Shutdown +: 0 mins +: Absolute + +SecureStatic Address Aging : Disabled + +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan + +: 1 +: 1 +: 1 +: 0 +: 0013.197b.5004:1 +Chapter 6: Implementing Switch Port Security 113 + +Security Violation Count : 1 + +SW1# show port-security interface fastEthernet 0/2 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-up +: Shutdown +: 0 mins +: Absolute + +SecureStatic Address Aging : Disabled + +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: 1 +: 1 +: 1 +: 1 +: 0200.2222.2222:1 +: 0 + + + +The two commands in Example 6-3 confirm that a security violation has occurred on FastEthernet 0/1, but no violations have occurred on FastEthernet 0/2. The show port- security interface fastethernet 0/1 command shows that the interface is in a +secure-shutdown state, which means that the interface has been disabled because of port security. In this case, another device connected to port F0/1, sending a frame with a source MAC address other than 0200.1111.1111, is causing a violation. However, port Fa0/2, which used sticky learning, simply learned the MAC address used by Server 2. + +Port Security MAC Addresses +To complete this chapter, take a moment to think about Layer 2 switching, along with all those examples of output from the show mac address-table dynamic EXEC command. + +Once a switch port has been configured with port security, the switch no longer considers MAC addresses associated with that port as being dynamic entries as listed with the show mac address-table dynamic EXEC command. Even if the MAC addresses are dynamically learned, once port security has been enabled, you need to use one of these options to see the MAC table entries associated with ports using port security: + +■ show mac address-table secure: Lists MAC addresses associated with ports that use port security +■ show mac address-table static: Lists MAC addresses associated with ports that use port security, as well as any other statically defined MAC addresses + + + +6 + + +Example 6-4 proves the point. It shows two commands about interface F0/2 from the port security example shown in Figure 6-2 and Example 6-1. In that example, port security was configured on F0/2 with sticky learning, so from a literal sense, the switch learned a MAC address off that port (0200.2222.2222). However, the show mac address-table dynamic command does not list the address and port because IOS considers that MAC table entry to be a static entry. The show mac address-table secure command does list the address and port. +114 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 6-4 Using the secure Keyword to See MAC Table Entries When Using Port Security + +SW1# show mac address-table secure interface F0/2 +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.2222.2222 + +Type Ports +-------- ----- +STATIC Fa0/2 + +Total Mac Addresses for this criterion: 1 + +SW1# show mac address-table dynamic interface f0/2 +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +SW1# + +Type Ports +-------- ----- + + +Port Security Violation Modes +The first half of the chapter discussed many details of port security, but it mostly ignored one major feature: the port security violation mode. The violation mode defines how port security should react when a violation occurs. + +First, to review, what is a port security violation? Any received frame that breaks the port security rules on an interface. For example: + +■ For an interface that allows any two MAC addresses, a violation occurs when the total of preconfigured and learned MAC addresses on the interface exceeds the configured maximum of two. +■ For an interface that predefines all the specific MAC addresses allowed on the interface, a violation occurs when the switch receives a frame whose source MAC is not one of those configured addresses. + +With port security, each switch port can be configured to use one of three violation modes that defines the actions to take when a violation occurs. All three options cause the switch to discard the offending frame (a frame whose source MAC address would push the num-ber of learned MAC addresses over the limit). However, the modes vary in how many other steps they take. For instance, some modes include the action of the switch generating syslog messages and SNMP Trap messages, while some define the action to disable the interface. Table 6-2 lists the three modes, their actions, along with the keywords that enable each mode on the switchport port-security violation {protect | restrict | shutdown} interface subcommand. +Chapter 6: Implementing Switch Port Security 115 + +Table 6-2 Actions When Port Security Violation Occurs + +Option on the switchport port-security violation Command +Discards offending traffic Sends log and SNMP messages +Disables the interface by putting it in an err-disabled state, discarding all traffic + +Protect + +Yes No +No + +Restrict + +Yes Yes +No + +Shutdown + +Yes Yes +Yes + + +Because IOS reacts so differently with shutdown mode as compared to restrict and protect modes, the next few pages explain the differences—first for shutdown mode, then for the other two modes. + +Port Security Shutdown Mode +When the (default) shutdown violation mode is used and a port security violation occurs on a port, port security stops all frame forwarding on the interface, both in and out of the port. In effect, it acts as if port security has shut down the port; however, it does not literally configure the port with the shutdown interface subcommand. Instead, port security uses the err-disabled feature. Cisco switches use the err-disabled state for a wide range of purposes, +but when using port security shutdown mode and a violation occurs, the following happens: 6 ■ The switch interface state (per show interfaces and show interfaces status) changes to +an err-disabled state. +■ The switch interface port security state (per show port-security) changes to a secure-down state. +■ The switch stops sending and receiving frames on the interface. + +Once port security has placed a port in err-disabled state, by default the port remains in an err-disabled state until someone takes action. To recover from an err-disabled state, the interface must be shut down with the shutdown command and then enabled with the no shutdown command. Alternately, the switch can be configured to automatically recover from the err-disabled state, when caused by port security, with these commands: + +■ errdisable recovery cause psecure-violation: A global command to enable automatic recovery for interfaces in an err-disabled state caused by port security +■ errdisable recovery interval seconds: A global command to set the time to wait before recovering the interface + +To take a closer look at shutdown mode, start by checking the configuration state of the switch. You can check the port security configuration on any interface with the show +port-security interface type number command, as seen back in Example 6-2, but the show port-security command (as listed in Example 6-5) shows briefer output, with one line per enabled interface. +116 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 6-5 Confirming the Port Security Violation Mode + +SW1# show port-security + +Secure Port MaxSecureAddr +(Count) + +CurrentAddr +(Count) + +SecurityViolation Security Action +(Count) + +--------------------------------------------------------------------------- +Fa0/13 1 1 1 Shutdown +--------------------------------------------------------------------------- +Total Addresses in System (excluding one mac per port) : 0 +Max Addresses limit in System (excluding one mac per port) : 8192 + +Note that for these next examples, a switch has configured port security on port Fa0/13 only. In this case, the switch appears to be configured to support one MAC address, has already reached that total, and has a security violation action of “shutdown.” + +Next, Example 6-6 shows the results after a port security violation has already occurred on port F0/13. The first command confirms the err-disabled state (per the show interfaces status command) and the secure-shutdown state (per the show port-security command). +Example 6-6 Port Security Status in Shutdown Mode After a Violation + +! The next lines show the log message generated when the violation occurred. +Jul 31 18:00:22.810: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address d48c.b57d.8200 on port FastEthernet0/13 + +! The next command shows the err-disabled state, implying a security violation. +SW1# show interfaces Fa0/13 status + + +Port Name +Fa0/13 +! + +Status Vlan +err-disabled 1 + +Duplex Speed +auto auto + +Type +10/100BaseTX + +! The next command's output has shading for several of the most important facts. +SW1# show port-security interface Fa0/13 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type +SecureStatic Address Aging +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: Enabled +: Secure-shutdown +: Shutdown +: 0 mins +: Absolute +: Disabled +: 1 +: 1 +: 1 +: 0 +: 0200.3333.3333:2 +: 1 + + +The output of the show port-security interface command lists the current port-security status (secure-shutdown) as well as the configured mode (shutdown). The last line of output lists the number of violations that caused the interface to fail to an err-disabled state, while +Chapter 6: Implementing Switch Port Security 117 + +the second-to-last line identifies the MAC address and VLAN of the device that caused the violation. + +Figure 6-3 summarizes these behaviors, assuming the same scenario shown in the example. + +F0/13: Status: Err-disabled + +Secure-Down + + +Counter: 1 + +Syslog: 10 Msgs + +Last MAC: MAC1 + +10X + + +Source: MAC1 + + +show port-security interface +Figure 6-3 Summary of Actions: Port Security Violation Mode Shutdown + +Note that the violations counter notes the number of times the interface has been moved to the err-disabled (secure-shutdown) state. For instance, the first time it fails, the counter +increments to 1; while err-disabled, many frames can arrive, but the counter remains at +1. Later, after an engineer has recovered the interface from the err-disabled state with a 6 +shutdown/no shutdown, another violation that causes the interface to fail to an err-disabled state will cause the counter to increment to 2. + +Port Security Protect and Restrict Modes +The restrict and protect violation modes take a much different approach to securing ports. These modes still discard offending traffic, but the interface remains in a connected (up/ up) state and in a port security state of secure-up. As a result, the port continues to forward good traffic but discards offending traffic. + +Having a port in a seemingly good state that also discards traffic can be a challenge when troubleshooting. Basically, you have to know about the feature and then know how to tell when port security is discarding some traffic on a port even though the interface status looks good. + +With protect mode, the only action the switch takes for a frame that violates the port secu-rity rules is to discard the frame. The switch does not change the port to an err-disabled state, does not generate messages, and does not even increment the violations counter. + +Example 6-7 shows a sample with protect mode after several violations have occurred. Note that the show command confirms the mode (protect) as configured in the top part of the example, with a port security state of secure-up—a state that will not change in protect mode. Also, note that the counter at the bottom shows 0, even though several violations have occurred, because protect mode does not count the violating frames. +Example 6-7 Port Security Using Protect Mode + +SW1# show running-config +! Lines omitted for brevity +interface FastEthernet0/13 +switchport mode access +switchport port-security +118 CCNA 200-301 Official Cert Guide, Volume 2 + +switchport port-security mac-address 0200.1111.1111 +switchport port-security violation protect +! Lines omitted for brevity + +SW1# show port-security interface Fa0/13 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type +SecureStatic Address Aging +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: Enabled +: Secure-up +: Protect +: 0 mins +: Absolute +: Disabled +: 1 +: 1 +: 1 +: 0 +: 0000.0000.0000:0 +: 0 + + + +NOTE The small particulars of the violation counters and last source address might be slightly different with some older switch models and IOS versions. Note that this edition’s testing is based on 2960XR switches running IOS 15.2.(6)E2. + +While shutdown mode disables the interface, and protect mode does nothing more than discard the offending traffic, restrict mode provides a compromise between the other two modes. If Example 6-7 had used the restrict violation mode instead of protect, the port status would have also remained in a secure-up state; however, IOS would show some indi-cation of port security activity, such as an accurate incrementing violation counter, as well as syslog messages. Example 6-8 shows an example of the violation counter and ends with an example port security syslog message. In this case, 97 incoming frames so far violated the rules, with the most recent frame having a source MAC address of 0200.3333.3333 in VLAN 1. +Example 6-8 Port Security Using Violation Mode Restrict + +SW1# show port-security interface fa0/13 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type +SecureStatic Address Aging +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: Enabled +: Secure-up +: Restrict +: 0 mins +: Absolute +: Disabled +: 1 +: 1 +: 1 +: 0 +: 0200.3333.3333:1 +: 97 +Chapter 6: Implementing Switch Port Security 119 + +! +! The following log message also points to a port security issue. +! +01:46:58: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by +MAC address 0200.3333.3333 on port FastEthernet0/13. + +Figure 6-4 summarizes the key points about the restrict mode for port security. In this case, the figure matches the same scenario as the example again, with 97 total violating frames arriving so far, with the most recent being from source MAC address MAC3. + +F0/13: Status: Connected + +Secure-Up + + +Counter: +97 + +Syslog: 97 Msgs + +Last MAC: MAC3 + +show port-security interface + +97X + + +Source: MAC3 + + +6 + +Figure 6-4 Summary of Actions: Port Security Violation Mode Restrict + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 6-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 6-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions Review command tables Review memory tables Review config checklists Do labs +Watch Video + +Resource Used Book, website Book, website Book, PTP +Book +Book, website Book, website Sim Lite, blog +Website +120 CCNA 200-301 Official Cert Guide, Volume 2 + +Review All the Key Topics Table 6-4 Key Topics for Chapter 6 + +Key Topic Element +List List +Example 6-1 Table 6-2 +List + +Description Page Number +Summary of port security concepts 109 Port security configuration checklist 110 Port security configuration samples 111 Port security actions and the results of each action 115 +Switch actions when a port security violation occurs 115 + + +Key Terms You Should Know +port security, violation mode, error disabled (err-disable) + +Do Labs +The Sim Lite software is a version of Pearson’s full simulator learning product with a subset of the labs, included free with this book. The Sim Lite with this book includes a couple of labs about port security. Also, check the author’s blog site pages for configuration exercises (Config Labs) at https://blog.certskills.com/config-labs. + +Command References +Tables 6-5 and 6-6 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table 6-5 Chapter 6 Configuration Command Reference + +Command +switchport mode {access | trunk} + + +switchport port-security mac-address mac-address + +switchport port-security mac-address sticky + + +switchport port-security maximum value + + +switchport port-security violation {protect | restrict | shutdown} + +Mode/Purpose/Description +Interface configuration mode command that tells the switch to always be an access port, or always be a trunk port +Interface configuration mode command that statically adds a specific MAC address as an allowed MAC address on the interface +Interface subcommand that tells the switch to learn MAC addresses on the interface and add them to the configuration for the interface as secure MAC addresses +Interface subcommand that sets the maximum number of static secure MAC addresses that can be assigned to a single interface +Interface subcommand that tells the switch what to do if an inappropriate MAC address tries to access the network through a secure switch port +Chapter 6: Implementing Switch Port Security 121 + + +Command +errdisable recovery cause psecure-violation + +errdisable recovery interval seconds + + + +shutdown + +no shutdown + +Mode/Purpose/Description +Global command that enables the automatic recovery from err-disabled state for ports that reach that state due to port security violations +Global command that sets the delay, in seconds, before a switch attempts to recover an interface in err-disabled mode, regardless of the reason for that interface being in that state +Interface subcommands that administratively disable and enable an interface, respectively + + +Table 6-6 Chapter 6 EXEC Command Reference + +Command +show running-config +show running-config | interface type number + + +show mac address-table dynamic [interface type number] +show mac address-table secure [interface type number] +show mac address-table static [interface type number] + +show interfaces [interface type number] status + + + + +show port-security interface type number + + +show port-security + +Purpose +Lists the currently used configuration +Displays the running-configuration excerpt of the listed interface and its subcommands only +Lists the dynamically learned entries in the 6 switch’s address (forwarding) table +Lists MAC addresses defined or learned on ports configured with port security +Lists static MAC addresses and MAC addresses learned or defined with port security +Lists one output line per interface (or for only the listed interface if included), noting the description, operating state, +and settings for duplex and speed on each interface +Lists an interface’s port security configuration settings and security operational status +Lists one line per interface that summarizes the port security settings for any interface on which it is enabled +CHAPTER 7 + + + +Implementing DHCP This chapter covers the following exam topics: +1.0 Network Fundamentals +1.10 Identify IP parameters for Client OS (Windows, Mac OS, Linux) + +4.0 IP Services +4.3 Explain the role of DHCP and DNS within the network + +4.6 Configure and verify DHCP client and relay + + +In the world of TCP/IP, the word host refers to any device with an IP address: your phone, your tablet, a PC, a server, a router, a switch—any device that uses IP to provide a service or just needs an IP address to be managed. The term host includes some less-obvious devices +as well: the electronic advertising video screen at the mall, your electrical power meter that uses the same technology as mobile phones to submit your electrical usage information for billing, your new car. + +No matter the type of host, any host that uses IPv4 needs four IPv4 settings to work properly: + +■ IP address +■ Subnet mask +■ Default routers +■ DNS server IP addresses + +This chapter discusses these basic IP settings on hosts. The chapter begins by discussing how a host can dynamically learn these four settings using the Dynamic Host Configuration Protocol (DHCP). The second half of this chapter then shows how to find the settings on hosts and the key facts to look for when displaying the settings. + +Just a note about the overall flow of the chapters: This chapter does not discuss security topics, although it sits inside Part II, “Security Services.” I located this DHCP-focused chap-ter here because Chapter 8, “DHCP Snooping and ARP Inspection,” relies heavily on knowl-edge of DHCP. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 7-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Dynamic Host Configuration Protocol +Identifying Host IPv4 Settings + +Questions 1–4 +5, 6 + + +1. A PC connects to a LAN and uses DHCP to lease an IP address for the first time. Of the usual four DHCP messages that flow between the PC and the DHCP server, which ones do the client send? (Choose two answers.) +a. Acknowledgment b. Discover +c. Offer d. Request +2. Which of the following kinds of information are part of a DHCP server configura-tion? (Choose two answers.) +a. Ranges of IP addresses in subnets that the server should lease b. Ranges of IP addresses to not lease per subnet +c. DNS server hostnames +d. The default router IP and MAC address in each subnet + +3. Which answers list a criterion for choosing which router interfaces need to be config-ured as a DHCP relay agent? (Choose two answers.) +a. If the subnet off the interface does not include a DHCP server b. If the subnet off the interface does include a DHCP server +c. If the subnet off the interface contains DHCP clients +d. If the router interface already has an ip address dhcp command + +4. A router connects to an Internet Service Provider (ISP) using its G0/0/0 interface, with the ip address dhcp command configured. What does the router do with the DHCP-learned default gateway information? +a. The router ignores the default gateway value learned from the DHCP server. b. The router uses the default gateway just like a host, ignoring its routing table. +c. The router forwards received packets based on its routing table but uses its default gateway setting to forward packets it generates itself. +d. The router adds a default route based on the default gateway to its IP routing table. +124 CCNA 200-301 Official Cert Guide, Volume 2 + +5. In the following excerpt from a command on a Mac, which of the following parts of the output represent information learned from a DHCP server? (Choose two answers.) +Macprompt$ ifconfig en0 +En1: flags=8863 mtu 1500 +options=10b +ether 00:6d:e7:b1:9a:11 +inet 172.16.4.2 netmask 0xffffff00 broadcast 172.16.4.255 + +a. 00:6d:e7:b1:9a:11 b. 172.16.4.2 +c. 0xffffff00 d. 172.16.4.255 +6. Which of the following commands on a Windows OS should list both the IP address and DNS servers as learned with DHCP? + +a. ifconfig b. ipconfig +c. ifconfig /all d. ipconfig /all + + +Foundation Topics + +Dynamic Host Configuration Protocol +Dynamic Host Configuration Protocol (DHCP) provides one of the most commonly used services in a TCP/IP network. The vast majority of hosts in a TCP/IP network are user devic-es, and the vast majority of user devices learn their IPv4 settings using DHCP. + +Using DHCP has several advantages over the other option of manually configuring IPv4 set-tings. The configuration of host IP settings sits in a DHCP server, with each client learning these settings using DHCP messages. As a result, the host IP configuration is controlled by the IT staff, rather than on local configuration on each host, resulting in fewer user errors. DHCP allows both the permanent assignment of host addresses, but more commonly, DHCP assigns a temporary lease of IP addresses. With these leases, the DHCP server can reclaim IP addresses when a device is removed from the network, making better use of the available addresses. +DHCP also enables mobility. For example, every time a user moves to a new location with a tablet computer—to a coffee shop, a client location, or back at the office—the user’s device can connect to another wireless LAN, use DHCP to lease a new IP address in that LAN, and begin working on the new network. Without DHCP, the user would have to ask for information about the local network and configure settings manually, with more than a few users making mistakes. + +Although DHCP works automatically for user hosts, it does require some preparation from the network, with some configuration on routers. In some enterprise networks, that router +Chapter 7: Implementing DHCP 125 + +configuration can be a single command on many of the router’s LAN interfaces ( ip helper-address server-ip), which identifies the DHCP server by its IP address. In other cases, the router acts as the DHCP server. Regardless, the routers have some role to play. + +This first major section of the chapter takes a tour of DHCP, including concepts and the router configuration to enable the routers to work well with a separate DHCP server. + +DHCP Concepts +Sit back for a moment and think about the role of DHCP for a host computer. The host acts as a DHCP client. As a DHCP client, the host begins with no IPv4 settings—no IPv4 address, no mask, no default router, and no DNS server IP addresses. But a DHCP client does have knowledge of the DHCP protocol, so the client can use that protocol to +(a) discover a DHCP server and (b) request to lease an IPv4 address. + +DHCP uses the following four messages between the client and server. (Also, as a way to help remember the messages, note that the first letters spell DORA): + +Discover: Sent by the DHCP client to find a willing DHCP server +Offer: Sent by a DHCP server to offer to lease to that client a specific IP address (and inform the client of its other parameters) +Request: Sent by the DHCP client to ask the server to lease the IPv4 address listed in the Offer message +Acknowledgment: Sent by the DHCP server to assign the address and to list the mask, +default router, and DNS server IP addresses 7 + +DHCP clients, however, have a somewhat unique problem: they do not have an IP address yet, but they need to send these DHCP messages inside IP packets. To make that work, DHCP messages make use of two special IPv4 addresses that allow a host that has no IP address to still be able to send and receive messages on the local subnet : + +0.0.0.0: An address reserved for use as a source IPv4 address for hosts that do not yet have an IP address. +255.255.255.255: The local broadcast IP address. Packets sent to this destination address are broadcast on the local data link, but routers do not forward them. + +To see how these addresses work, Figure 7-1 shows an example of the IP addresses used between a host (A) and a DHCP server on the same LAN. Host A, a client, sends a Discover message, with source IP address of 0.0.0.0 because host A does not have an IP address to use yet. Host A sends the packet to destination 255.255.255.255, which is sent in a LAN broadcast frame, reaching all hosts in the subnet. The client hopes that there is a DHCP server on the local subnet. Why? Packets sent to 255.255.255.255 only go to hosts in the local subnet; router R1 will not forward this packet . + +NOTE Figure 7-1 shows one example of the addresses that can be used in a DHCP request. This example shows details assuming the DHCP client chooses to use a DHCP option called the broadcast flag; all examples in this book assume the broadcast flag is used. +126 CCNA 200-301 Official Cert Guide, Volume 2 + + + +A +R1 R2 + + +B + + + +1 Discover + +To 255.255.255.255 From 0.0.0.0 + +Offer + + +DHCP Server 172.16.1.11 + +2 + + +To 255.255.255.255 From 172.16.1.11 +Figure 7-1 DHCP Discover and Offer + +Now look at the Offer message sent back by the DHCP server. The server sets the destina-tion IP address to 255.255.255.255 again. Why? Host A still does not have an IP address, so the server cannot send a packet directly to host A. So, the server sends the packet to “all local hosts in the subnet” address (255.255.255.255). (The packet is also encapsulated in an Ethernet broadcast frame.) + +Note that all hosts in the subnet receive the Offer message. However, the original Discover message lists a number called the client ID, which includes the host’s MAC address, that identifies the original host (host A in this case). As a result, host A knows that the Offer message is meant for host A. The rest of the hosts will receive the Offer message, but notice that the message lists another device’s DHCP client ID, so the rest of the hosts ignore the Offer message. + +Supporting DHCP for Remote Subnets with DHCP Relay +Network engineers have a major design choice to make with DHCP: Do they put a DHCP server in every LAN subnet or locate a DHCP server in a central site? The question is legiti-mate. Cisco routers can act as the DHCP server, so a distributed design could use the router at each site as the DHCP server. With a DHCP server in every subnet, as shown in Figure +7-1, the protocol flows stay local to each LAN. + +However, a centralized DHCP server approach has advantages as well. In fact, some Cisco design documents suggest a centralized design as a best practice, in part because it allows for centralized control and configuration of all the IPv4 addresses assigned throughout the enterprise. +With a centralized DHCP server, those DHCP messages that flowed only on the local subnet in Figure 7-1 somehow need to flow over the IP network to the centralized DHCP server and back. To make that work, the routers connected to the remote LAN subnets need an interface subcommand: the ip helper-address server-ip command. + +The ip helper-address server-ip subcommand tells the router to do the following for the messages coming in an interface, from a DHCP client: + + + + +Answers to the “Do I Know This Already?” quiz: 1 B, D 2 A, B 3 A, C 4 D 5 B, C 6 D +Chapter 7: Implementing DHCP 127 + +1. Watch for incoming DHCP messages, with destination IP address 255.255.255.255. 2. Change that packet’s source IP address to the router’s incoming interface IP address. +3. Change that packet’s destination IP address to the address of the DHCP server (as con-figured in the ip helper-address command). +4. Route the packet to the DHCP server. + +This command gets around the “do not route packets sent to 255.255.255.255” rule by changing the destination IP address. Once the destination has been set to match the DHCP server’s IP address, the network can route the packet to the server. + +NOTE This feature, by which a router relays DHCP messages by changing the IP addresses in the packet header, is called DHCP relay. + +Figure 7-2 shows an example of the process. Host A sits on the left, as a DHCP client. The DHCP server (172.16.2.11) sits on the right. R1 has an ip helper-address 172.16.2.11 com-mand configured, under its G0/0 interface. At step 1, router R1 notices the incoming DHCP packet destined for 255.255.255.255. Step 2 shows the results of changing both the source and destination IP address, with R1 routing the packet. + +ip helper-address 172.16.2.11 + + + +A + + +1 Discover + +B +172.16.1.1 7 G0/0 R1 R2 +2 Discover S1 + + + +To 255.255.255.255 From 0.0.0.0 +Figure 7-2 IP Helper Address Effect + + +To 172.16.2.11 From 172.16.1.1 + +DHCP Server 172.16.2.11 + + +The router uses a similar process for the return DHCP messages from the server. First, for the return packet from the DHCP server, the server simply reverses the source and destina-tion IP address of the packet received from the router (relay agent). For example, in Figure 7-2, the Discover message lists source IP address 172.16.1.1, so the server sends the Offer message back to destination IP address 172.16.1.1. + +When a router receives a DHCP message, addressed to one of the router’s own IP addresses, the router realizes the packet might be part of the DHCP relay feature. When that happens, the DHCP relay agent (router R1) needs to change the destination IP address, so that the real DHCP client (host A), which does not have an IP address yet, can receive and process the packet. + +Figure 7-3 shows one example of how these addresses work, when R1 receives the DHCP Offer message sent to R1’s own 172.16.1.1 address. R1 changes the packet’s destination to 255.255.255.255 and forwards it out G0/0, because the packet was destined to G0/0’s 172.16.1.1 IP address. As a result, all hosts in that LAN (including the DHCP client A) will receive the message. + +Many enterprise networks use a centralized DHCP server, so the normal router configura-tion includes an ip helper-address command on every LAN interface/subinterface. With that standard configuration, user hosts off any router LAN interface can always reach the DHCP server and lease an IP address. +128 CCNA 200-301 Official Cert Guide, Volume 2 + + +A B 172.16.1.1 +G0/0 R1 R2 + +offer 2 + +To 255.255.255.255 From 172.16.2.11 + + +offer 1 + +To 172.16.1.1 From 172.16.2.11 + +S1 + +DHCP Server 172.16.2.11 + +Figure 7-3 IP Helper Address for the Offer Message Returned from the DHCP Server + +Information Stored at the DHCP Server +A DHCP server might sound like some large piece of hardware, sitting in a big locked room with lots of air conditioning to keep the hardware cool. However, like most servers, the server is actually software, running on some server OS. The DHCP server could be a piece of software downloaded for free and installed on an old PC. However, because the server needs to be available all the time, to support new DHCP clients, most companies install the software on a very stable and highly available data center, with high availability features. The DHCP service is still created by software, however. + +To be ready to answer DHCP clients and to supply them with an IPv4 address and other information, the DHCP server (software) needs configuration. DHCP servers typically organize these IPv4 settings per subnet, because the information the server tells the client is usually the same for all hosts in the same subnet, but slightly different for hosts in different subnets. For example, IP addressing rules tell us that all hosts on the same subnet should use the same mask but hosts in different subnets would have a different default gateway setting. + +The following list shows the types of settings the DHCP server needs to know to support DHCP clients: + +Subnet ID and mask: The DHCP server can use this information to know all addresses in the subnet. (The DHCP server knows to not lease the subnet ID or subnet broadcast address.) +Reserved (excluded) addresses: The server needs to know which addresses in the sub-net to not lease. This list allows the engineer to reserve addresses to be used as static IP addresses. For example, most router and switch IP addresses, server addresses, and addresses of most anything other than user devices use a statically assigned IP address. +Most of the time, engineers use the same convention for all subnets, either reserving the lowest IP addresses in all subnets or reserving the highest IP addresses in all subnets. +Default router(s): This is the IP address of the router on that subnet. DNS IP address(es): This is a list of DNS server IP addresses. + +Figure 7-4 shows the concept behind the preconfiguration on a DHCP server for two LAN-based subnets, 172.16.1.0/24 and 172.16.2.0/24. The DHCP server sits on the right. For each subnet, the server defines all the items in the list. In this case, the configuration reserves the lowest IP addresses in the subnet to be used as static addresses. + +The configuration can list other parameters as well. For example, it can set the time limit for leasing an IP address. The server leases an address for a time (usually a number of days), and then the client can ask to renew the lease. If the client does not renew, the server can reclaim the IP address and put it back in the pool of available IP addresses. The server con-figuration sets the maximum time for the lease. +Chapter 7: Implementing DHCP 129 + + + +Subnet = 172.16.1.0/24 Static Reserve: .1 – .50 Router = .1 +DNS = 172.16.1.12 + +Subnet = 172.16.2.0/24 Static Reserve: .1 – .100 Router = .1 +DNS = 172.16.1.12 + + + + +A .9 +.1 .1 +.12 R1 R2 B + +DNS +172.16.1.0/24 172.16.2.0/24 Figure 7-4 Preconfiguration on a DHCP Server +DHCP uses three allocation modes, based on small differences in the configuration at the DHCP server. Dynamic allocation refers to the DHCP mechanisms and configuration described throughout this chapter. Another method, automatic allocation, sets the DHCP lease time to infinite. As a result, once the server chooses an address from the pool and assigns the IP address to a client, the IP address remains with that same client indefinitely. A third mode, static allocation, preconfigures the specific IP address for a client based on +the client’s MAC address. That specific client is the only client that then uses the IP address. +(Note that this chapter shows examples and configuration for dynamic allocation only.) 7 +Additionally, the DHCP server can be configured to supply some other useful configuration settings. For instance, a server can supply the IP address of a Trivial File Transfer Protocol (TFTP) server. TFTP servers provide a basic means of storing files that can then be trans-ferred to a client host. As it turns out, Cisco IP phones rely on TFTP to retrieve several configuration files when the phone initializes. DHCP plays a key role by supplying the IP address of the TFTP server that the phones should use. + +Configuring DHCP Features on Routers and Switches +Cisco routers and switches support a variety of features. Routers can be configured to act as a DHCP server with just a few straightforward commands—a feature useful in the lab and in some limited cases. More commonly, the enterprise uses a centralized DHCP server (that does not run on a router) but with the router DHCP relay feature on most every router interface. Finally, Cisco routers and switches can also act as DHCP clients, learning their IP addresses from a DHCP server. + +This section discusses the DHCP configuration topics mentioned for the current exam top-ics. Those include the router DHCP relay feature and the configuration to enable DHCP cli-ent services on both switches and routers. + +NOTE The CCNA 200-301 exam blueprint does not mention the DHCP server function, but many people like to use the IOS DHCP server in the lab for testing with DHCP. If you are interested in how to configure a DHCP server on a router, refer to Appendix D, “Topics from Previous Editions.” +130 CCNA 200-301 Official Cert Guide, Volume 2 + +Configuring DHCP Relay +Configuring DHCP relay requires a simple decision and a single straightforward configura-tion command. First, you must identify the interfaces that need the feature. The DHCP relay feature must be configured for any router interface that connects to a subnet where + +■ DHCP clients exist in the subnet +■ DHCP servers do not exist in the subnet + +Once such interfaces have been identified, the configuration requires the ip helper-address interface subcommand on each of those interfaces. For instance, with earlier Figure 7-3, R1’s G0/0 interface needs to be configured with the ip helper-address 172.16.2.11 inter-face subcommand. Once enabled on an interface, the IOS DHCP relay agent makes changes in the incoming DHCP messages’ addresses as described earlier in the chapter. Without the DHCP relay agent, the DHCP request never arrives at the server. + +To verify the relay agent, you can use the show running-config command and look for the single configuration command or use the show ip interface g0/0 command as shown in Example 7-1. The highlighted line confirms the configured setting. Note that if there were no ip helper-address commands configured on the interface, the text would instead read “Helper address is not set.” +Example 7-1 Listing the Current Helper Address Setting with show ip interface + +R1# show ip interface g0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet address is 172.16.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is 172.16.2.11 +! Lines omitted for brevity (about 20 lineSc + +Configuring a Switch as DHCP Client +A switch can act as a DHCP client to lease its IP address. In most cases, you will want to instead use a static IP address so that the staff can more easily identify the switch’s address for remote management. However, as an example of how a DHCP client can work, this next topic shows how to configure and verify DHCP client operations on a switch. + +NOTE Chapter 6, “Configuring Basic Switch Management,” in CCNA 200-301 Official Cert Guide, Volume 1, also shows this same example of how to configure a switch to be +a DHCP client. This chapter repeats the example here so you can see all the related DHCP configuration details in a single place in this volume. + +To configure a switch to use DHCP to lease an address, configure a switch’s IP address as normal, but with the ip address dhcp interface subcommand. Example 7-2 shows a sample. +Chapter 7: Implementing DHCP 131 + +Example 7-2 Switch Dynamic IP Address Configuration with DHCP + +Emma# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Emma(config)# interface vlan 1 +Emma(config-if)# ip address dhcp +Emma(config-if)# no shutdown +Emma(config-if)# ^Z +Emma# +00:38:20: %LINK-3-UPDOWN: Interface Vlan1, changed state to up +00:38:21: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up + +To verify that DHCP worked, start with the traditional way to check IP addresses on switch VLAN interfaces: the show interfaces vlan x command as demonstrated in Example 7-3. First, check the interface state, because the switch does not attempt DHCP until the VLAN interface reaches an up/up state. Notably, if you forget to issue the no shutdown command, the VLAN 1 interface will remain in a shutdown state and listed as “administratively down” in the show command output. +Example 7-3 Verifying DHCP-Learned IP Address on a Switch + + +Emma# show interfaces vlan 1 +Vlan1 is up, line protocol is up +Hardware is EtherSVI, address is 0019.e86a.6fc0 (bia 0019.e86a.6fc0) +Internet address is 192.168.1.101/24 +MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, +reliability 255/255, txload 1/255, rxload 1/255 +! lines omitted for brevity + + + +7 + + +The second half of Example 7-3 shows the show interfaces vlan x command output, which lists the interface’s IP address on the third line. If you statically configure the IP address, the IP address will always be listed; however, when using DHCP, this line only exists if DHCP succeeded. Also, note that when present, the output does not state whether the address was statically configured or learned with DHCP. The output lists 192.168.1.101 as the address, but with no information to identify whether the IP address is a static or DHCP-learned IP address. +To see more details specific to DHCP, instead use the show dhcp lease command to see the (temporarily) leased IP address and other parameters. (Note that the switch does not store the DHCP-learned IP configuration in the running-config file.) Example 7-4 shows sample output. Note also that the switch learns its default-gateway setting using DHCP as well. +Example 7-4 Verifying DHCP-Learned Information on a Switch + +Emma# show dhcp lease +Temp IP addr: 192.168.1.101 for peer on Interface: Vlan1 +Temp sub net mask: 255.255.255.0 +DHCP Lease server: 192.168.1.1, state: 3 Bound +DHCP transaction id: 1966 +Lease: 86400 secs, Renewal: 43200 secs, Rebind: 75600 secs +Temp default-gateway addr: 192.168.1.1 +132 CCNA 200-301 Official Cert Guide, Volume 2 + +Next timer fires after: 11:59:45 +Retry count: 0 Client-ID: cisco-0019.e86a.6fc0-Vl1 +Hostname: Emma + +Emma# show ip default-gateway +192.168.1.1 + +Configuring a Router as DHCP Client +Just as with switches, you can configure router interfaces to lease an IP address using DHCP rather than using a static IP address, although those cases will be rare. In most every case it makes more sense to statically configure router interface IP addresses with the address list-ed in the ip address address mask interface subcommand. However, configuring a router to lease an address using DHCP makes sense in some cases with a router connected to the Internet; in fact, most every home-based router does just that. + +A router with a link to the Internet can learn its IP address and mask with DHCP and also learn the neighboring ISP router’s address as the default gateway. Figure 7-5 shows an exam-ple, with three routers on the left at one enterprise site. Router R1 uses DHCP to learn its IP address (192.0.2.2) from the ISP router over a connection to the Internet. + +2 +DHCP-learned: 192.0.2.1 B01 0.0.0.0 /0, Next-hop 192.0.2.1 + + +R1 + +B02 + +Gi0/1 Internet 1 ISP1 + +Use Address 192.0.2.2 Use Gateway 192.0.2.1 + +DHCP + +Figure 7-5 Enterprise Router Building and Advertising Default Routes with DHCP Client + +The DHCP process supplies a default gateway IP address to router R1, but routers do not normally use a default gateway setting; only hosts use a default gateway setting. However, the router takes advantage of that information by turning that default gateway IP address into the basis for a default route. For instance, in Figure 7-5, router R1 dynamically adds a default route to its routing table with the default gateway IP address from the DHCP mes-sage—which is the ISP router’s IP address—as the next-hop address. At that point, R1 has a good route to use to forward packets into the Internet. + +Additionally, router R1 can distribute that default route to the rest of the routers using an interior routing protocol like OSPF. See the section titled “OSPF Default Routes” in Chapter 20 of the CCNA 200-301 Official Cert Guide, Volume 1, for more information. + +Example 7-5 shows the configuration on router R1 to match Figure 7-5. Note that it begins with R1 configuring its G0/1 interface to use DHCP to learn the IP address to use on the interface, using the ip address dhcp command. +Chapter 7: Implementing DHCP 133 + +Example 7-5 Learning an Address and Default Static Route with DHCP + +R1# configure terminal +R1(config)# interface gigabitethernet0/1 +R1(config-if)# ip address dhcp +R1(config-if)# end +R1# +R1# show ip route static +! Legend omitted +Gateway of last resort is 192.0.2.1 to network 0.0.0.0 + +S* 0.0.0.0/0 [254/0] via 192.0.2.1 + + +The end of the example shows the default route added to R1’s routing table as a result of learning a default gateway address of 192.0.2.1 from DHCP. Oddly, IOS displays this route as a static route (destination 0.0.0.0/0), although the route is learned dynamically based +on the DHCP-learned default gateway. To recognize this route as a DHCP-learned default route, look to the administrative distance value of 254. IOS uses a default administrative distance of 1 for static routes configured with the ip route configuration command but a default of 254 for default routes added because of DHCP. + +Identifying Host IPv4 Settings +Whether learned using DHCP or not, every host that uses IP version 4 needs to have some settings to work correctly. This second major division of the chapter examines those settings and shows examples of those settings on Windows, Linux, and macOS. + +Host Settings for IPv4 +To work correctly, an IPv4 host needs to know these values: + +■ DNS server IP addresses +■ Default gateway (router) IP address ■ Device’s own IP address +■ Device’s own subnet mask + + + + + + + + + + +7 + + +To review the basics, the host must know the IP address of one or more DNS servers to send the servers’ name resolution requests. For enterprises, the servers may reside in the enterprise, as shown in Figure 7-6. The host on the left (sometimes called an endpoint) typi-cally knows the addresses of at least two DNS servers for redundancy. If the first DNS fails to respond, the endpoint can then attempt name resolution with the next DNS server. + + +DNS1 Address +DNS +DNS2 +A G0/0 Address +R1 + +Enterprise Network Figure 7-6 Host A Needs to Know the IP Address of the DNS Servers +134 CCNA 200-301 Official Cert Guide, Volume 2 + +Each endpoint needs to know the IP address of a router that resides in the same subnet. The endpoint uses that router as its default router or default gateway, as shown in Figure 7-7. From a host logic perspective, the host can then forward packets destined for addresses outside the subnet to the default router, with that router then forwarding the packet based on its routing table. + + + +A G0/0 +R1 +Default Router Address Enterprise Network +Figure 7-7 Host Default Router Setting Should Equal Router Interface Address + +Of course, each device needs its own IP address and subnet mask. Equally as important, note that the host and the default router need to agree as to the addresses inside the subnet. The host will use the address and mask to do the math to determine which addresses are in the same subnet and which are in other subnets. For routing to work correctly, the default router’s interface address and mask should result in the same definition of the subnet with the same addresses, as shown in Figure 7-8. + + +A G0/0 +R1 + +Address Mask + + +Math + + + +Subnet ID & Address Range + +Address +Mask Enterprise Network + + +Math + +Figure 7-8 The Need for Subnet Agreement Between Host and Default Router + +The rest of this section shows examples of the display of these settings in the graphical user interface (GUI) and command-line interface (CLI) of three different host operating systems. + +Host IP Settings on Windows +Most every OS in the world—certainly the more common OSs people work with every day—have a fairly easy-to-reach settings window that lists most if not all the IPv4 set-tings in one place. For example, Figure 7-9 shows the Network configuration screen from a Windows 10 host from the network area of the Windows Control Panel. This particular example shows the big four settings: address, mask, router, and DNS. + +However, beyond the GUI, most OSs have a variety of networking commands available from a command line. With all Windows versions, the ipconfig and ipconfig /all commands supply the most direct help, as shown in Example 7-6. As you can see, both list the address, mask, and default gateway, with the ipconfig /all command also listing the DNS server settings. +Chapter 7: Implementing DHCP 135 + + + + + + + + + + + + + + + + + + + + + + +Figure 7-9 IP Address, Mask, and Default Router Settings on Windows +Example 7-6 ipconfig and ipconfig /all (Windows) 7 + +C:\DOCUME1\OWNER> ipconfig + +Windows IP Configuration + + +Ethernet adapter Ethernet3: + +Connection-specific DNS Suffix . : +IPv4 Address. . . . . . . . . . . : 192.168.1.172 +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Default Gateway . . . . . . . . . : 192.168.1.1 + +C:\DOCUME1\OWNER> ipconfig /all +! Lines omitted for brevity +Ethernet adapter Ethernet 3: + +Connection-specific DNS Suffix . : +Description . . . . . . . . . . . : ASIX AX88179 USB 3.0 to Gigabit Ethernet Adapter +Physical Address. . . . . . . . . : 00-05-1B-A3-5D-D0 +DHCP Enabled. . . . . . . . . . . : Yes +Autoconfiguration Enabled . . . . : Yes +IPv4 Address. . . . . . . . . . . : 192.168.1.172(Preferred) +136 CCNA 200-301 Official Cert Guide, Volume 2 + +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Lease Obtained. . . . . . . . . . : Friday, August 2, 2019 12:55:50 PM +Lease Expires . . . . . . . . . . : Saturday, August 3, 2019 1:01:45 AM +Default Gateway . . . . . . . . . : 192.168.1.1 +DHCP Server . . . . . . . . . . . : 192.168.1.1 +DNS Servers . . . . . . . . . . . : 208.67.222.222 +208.67.220.220 +NetBIOS over Tcpip. . . . . . . . : Enabled + +Another common command on most user host OSs is the netstat -rn command. This command lists the host’s IP routing table. Of interest, the top of the table lists a route based on the default gateway, with the destination subnet and mask listed as 0.0.0.0 and 0.0.0.0. The top of the output also lists several other routes related to having a working interface, like a route to the subnet connected to the interface. Example 7-7 lists an excerpt from the netstat -rn command from the same Windows host, with the default route and the route +to the local subnet (192.168.1.0) listed. Note that a gateway of “on-link” means that the PC thinks the destination is on the local subnet (link). +Example 7-7 netstat -rn Command (Windows) + +C:\DOCUME1\OWNER> netstat -rn + +IPv4 Route Table +=========================================================================== +Active Routes: +Network Destination Netmask Gateway Interface Metric + +0.0.0.0 +127.0.0.0 +127.0.0.1 +127.255.255.255 +169.254.0.0 +169.254.244.178 +169.254.255.255 +192.168.1.0 +192.168.1.172 +192.168.1.255 + +0.0.0.0 +255.0.0.0 +255.255.255.255 +255.255.255.255 +255.255.0.0 +255.255.255.255 +255.255.255.255 +255.255.255.0 +255.255.255.255 +255.255.255.255 + +192.168.1.1 +On-link +On-link +On-link +On-link +On-link +On-link +On-link +On-link +On-link + +192.168.1.172 25 +127.0.0.1 331 +127.0.0.1 331 +127.0.0.1 331 +169.254.244.178 291 +169.254.244.178 291 +169.254.244.178 291 +192.168.1.172 281 +192.168.1.172 281 +192.168.1.172 281 + +! Lines omitted for brevity + +Host IP Settings on macOS +Although the particulars vary, like Windows, macOS has both a graphical interface to see network settings and a variety of network commands. This section shows examples of each, beginning with Figure 7-10. It shows the network settings in macOS for an Ethernet inter-face, with the address, mask, default router, and DNS server addresses. Also note the setting states that the interface is using DHCP. +Chapter 7: Implementing DHCP 137 + + + + + + + + + + + + + + + + + + + + + + +Figure 7-10 IP Address, Mask, and Default Router Settings on macOS 7 +macOS and Linux both support the ifconfig command to list information similar to the Windows ipconfig /all command. (Note that ifconfig does not have an /all option.) Of note, the ifconfig command does not list the default gateway or DNS servers, so Example 7-8 includes two other macOS commands that supply those details. +Example 7-8 ifconfig, networksetup -getinfo, and networksetup -getdnsservers (macOS) + +Wendell-Odoms-iMac:~ wendellodom$ ifconfig en0 +en0: flags=8863 mtu 1500 +options=10b +ether 0c:4d:e9:a9:9c:41 +inet 192.168.1.102 netmask 0xffffff00 broadcast 192.168.1.255 +! IPv6 details omitted for brevity +media: autoselect (1000baseT ) +status: active + +Wendell-Odoms-iMac:~ wendellodom$ networksetup -getinfo Ethernet +DHCP Configuration +IP address: 192.168.1.102 +Subnet mask: 255.255.255.0 +Router: 192.168.1.1 +Client ID: +IPv6: Automatic +138 CCNA 200-301 Official Cert Guide, Volume 2 + +IPv6 IP address: none +IPv6 Router: none +Ethernet Address: 0c:4d:e9:a9:9c:41 + +Wendell-Odoms-iMac:~ wendellodom$ networksetup -getdnsservers Ethernet +8.8.8.4 +8.8.8.8 + +Like Windows, macOS adds a default route to its host routing table based on the default gateway, as well as a route to the local subnet calculated based on the IP address and mask learned with DHCP. And like Windows, macOS uses the netstat -rn command to list those routes—but with several differences in the output. Of note in the macOS sample shown in Example 7-9, the output represents the default route using the word default rather than the paired numbers 0.0.0.0 and 0.0.0.0 for the destination subnet and mask. +Example 7-9 netstat -rn Command (macOS) + +C:\DOCUME1\OWNER> netstat -rn +Routing tables + + +Internet: +Destination +default +127 +127.0.0.1 + + +Gateway Flags +192.168.1.1 UGSc +127.0.0.1 UCS +127.0.0.1 UH + + +Refs Use +92 0 +0 0 +4 1950 + + +Netif Expire +en0 +lo0 +lo0 + + + +169.254 +169.254.210.104 +192.168.1 +192.168.1.1/32 +192.168.1.1 +192.168.1.102/32 + +link#5 +0:5:1b:a3:5d:d0 +link#5 +link#5 +60:e3:27:fb:70:97 +link#5 + +UCS +UHLSW +UCS +UCS +UHLWIir +UCS + +2 0 en0 ! +0 0 en0 ! +9 0 en0 ! +1 0 en0 ! +12 2502 en0 1140 +0 0 en0 ! + +! lines omitted for brevity + +Host IP Settings on Linux +On Linux, the graphical windows to display network settings differ for many reasons. First, the Linux world includes a large number of different Linux versions or distributions. Additionally, Linux separates the OS from the desktop (the graphical interface) so that a +user of one Linux distribution can choose between different desktop interfaces. As a result, you will see different GUI screens to display the Linux network settings. + +For perspective, this section shows a few examples from the MATE desktop included in the Ubuntu MATE Linux distribution (www.ubuntu-mate.org). First, the image in Figure +7-11 shows details for a wireless LAN adapter and includes the IPv4 address, mask, default router, and primary DNS IP address. +Chapter 7: Implementing DHCP 139 + + + + + + + + + + + + + + + + + + + + + + +Figure 7-11 IP Address, Mask, and Default Router Settings on Linux 7 From the command line, Linux hosts will often support a large set of commands. However, +an older set of commands, referenced together as net-tools, has been deprecated in Linux, to the point that some Linux distributions do not include net-tools. (You can easily add net-tools to most Linux distributions.) The net-tools library includes ifconfig and netstat -rn. To replace those tools, Linux uses the iproute library, which includes a set of replacement com-mands and functions, many performed with the ip command and some parameters. + +NOTE Check out this link for a broader comparison of the commands: https://access.red-hat.com/sites/default/files/attachments/rh_ip_command_cheatsheet_1214_jcs_print.pdf. + +Example 7-10 shows a sample of the ifconfig command for the same interface detailed in Figure 7-11. Note that it lists the Ethernet MAC and IPv4 addresses, along with the subnet mask, similar to the macOS version of the command. However, on Linux, it also shows some interface counters. +Example 7-10 ifconfig and ip address Commands (Linux) + +chris@LL ~ $ ifconfig wlan0 +wlan0 Link encap:Ethernet HWaddr 30:3a:64:0d:73:43 +inet addr:192.168.1.223 Bcast:192.168.1.255 Mask:255.255.255.0 +inet6 addr: fe80::e5b8:f355:636a:b2a4/64 Scope:Link +UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 +RX packets:2041153 errors:0 dropped:0 overruns:0 frame:0 +TX packets:712814 errors:0 dropped:0 overruns:0 carrier:0 +collisions:0 txqueuelen:1000 +140 CCNA 200-301 Official Cert Guide, Volume 2 + +RX bytes:2677874115 (2.6 GB) TX bytes:134076542 (134.0 MB) + +chris@LL ~ $ ip address +3: wlan0: mtu 1500 qdisc mq state UP group default qlen 1000 +link/ether 30:3a:64:0d:73:43 brd ff:ff:ff:ff:ff:ff +inet 192.168.1.223/24 brd 192.168.1.255 scope global wlan0 +valid_lft forever preferred_lft forever +inet6 fe80::e5b8:f355:636a:b2a4/64 scope link +valid_lft forever preferred_lft forever + +The bottom of the example shows the command from the iproute package that replaces ifconfig, namely the ip address. Note that it shows the same basic addressing information, just with the subnet mask shown in prefix notation rather than in dotted decimal. + +Linux has long supported the netstat -rn command as well, as part of the net-tools package, with a sample shown in Example 7-11. The output lists a default route, but with a style that shows the destination as 0.0.0.0. As usual, the default route points to the default gateway as learned with DHCP: 192.168.1.1. It also lists a route to the local subnet (192.168.1.0 as highlighted toward the bottom of the output). +Example 7-11 netstat -rn and ip route Commands (Linux) + +chris@LL ~ $ netstat -rn +Kernel IP routing table + +Destination +0.0.0.0 +169.254.0.0 +192.168.1.0 + +Gateway +192.168.1.1 +0.0.0.0 +0.0.0.0 + +Genmask Flags +0.0.0.0 UG +255.255.0.0 U +255.255.255.0 U + +MSS Window +0 0 +0 0 +0 0 + +irtt Iface +0 wlan0 +0 wlan0 +0 wlan0 + + +chris@LL ~ $ ip route +default via 192.168.1.1 dev wlan0 proto static metric 600 +169.254.0.0/16 dev wlan0 scope link metric 1000 +192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.223 metric 600 +chris@LL ~ $ + +The bottom of the example shows the command meant to replace netstat -rn: ip route. Note that it also shows a default route that references the default router, along with a route for the local subnet. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 7-2 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. +Chapter 7: Implementing DHCP 141 + +Table 7-2 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Repeat DIKTA questions +Review command tables + +Resource Used Book, website Book, website Book, PTP +Book + + +Review All the Key Topics Table 7-3 Key Topics for Chapter 7 + +Key Topic Element +List List +Figure 7-2 + +List + +Example 7-4 + +List Example 7-6 +Example 7-8 + +Description Page Number +Definitions of special IPv4 addresses 0.0.0.0 and 255.255.255.255 125 Four logic steps created by the ip helper-address command 127 +What the ip helper-address command changes in a DHCP Discover 127 message +The two facts that must be true about a subnet for a router to need 130 to be a DHCP relay agent for that subnet +Switch commands that confirm the details of DHCP client 131 operations based on the ip address dhcp interface subcommand +The IPv4 settings expected on an end-user host 133 7 Output from a Windows ipconfig /all command 135 +Output from a macOS ifconfig command plus two networksetup 137 commands + + +Key Terms You Should Know +DHCP client, DHCP server, DHCP relay agent, default gateway, DNS server + +Command References +Tables 7-4, 7-5, and 7-6 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table 7-4 Chapter 7 Configuration Command Reference + +Command +ip helper-address IP-address + + +ip address dhcp + +Description +An interface subcommand that tells the router to notice local subnet broadcasts (to 255.255.255.255) that use UDP, and change the source and destination IP address, enabling DHCP servers to sit on a remote subnet +An interface subcommand that tells the router or switch to use DHCP to attempt to lease a DHCP address from a DHCP server +142 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 7-5 Chapter 7 EXEC Command Reference + +Command +show arp, show ip arp show dhcp lease + +show ip default-gateway + +Description +Command that lists the router’s IPv4 ARP table +Switch command that lists information about addresses leased because of the configuration of the ip address dhcp command +Switch command that lists the switch’s default gateway setting, no matter whether learned by DHCP or statically configured + + +Table 7-6 Chapter 7 Generic Host Networking Command Reference + +Command ipconfig /all ifconfig +networksetup -getinfo interface +networksetup +-getdnsservers interface +netstat -rn + +arp -a +ip address + +ip route + +Description +(Windows) Lists IP address, mask, gateway, and DNS servers (Mac, Linux) Lists IP address and mask for an interface (Mac) Lists IP settings including default router + +(Mac) Lists DNS servers used + +(Windows, Mac, Linux) Lists the host’s routing table, including a default route that uses the DHCP-learned default gateway +(Windows, Mac, Linux) Lists the host’s ARP table +(Linux) Lists IP address and mask information for interfaces; the Linux replacement for ifconfig +(Linux) Lists routes, including the default route and a route to the local subnet; the Linux replacement for netstat -rn + + + + + + + + +This page intentionally left blank +CHAPTER 8 + + + +DHCP Snooping and ARP Inspection + +This chapter covers the following exam topics: + +5.0 Security Fundamentals +5.7 Configure Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) + + +To understand the kinds of risks that exist in modern networks, you have to first understand the rules. Then you have to think about how an attacker might take advantage of those rules in different ways. Some attacks might cause harm as part of a denial-of-service (DoS) attack, while a reconnaissance attack may gather more data to prepare for some other attack. For every protocol and function you learn in networking, there are possible methods to take advantage of those features to give an attacker an advantage. + +This chapter discusses two switch features that help prevent some types of attacks that can result in the attacker getting copies of packets sent to/from a legitimate host. One of these features, DHCP Snooping, notices DHCP messages that fall outside the normal use of DHCP—messages that may be part of an attack—and discards those messages. It also +watches the DHCP messages that flow through a LAN switch, building a table that lists the details of legitimate DHCP flows, so that other switch features can know what legitimate DHCP leases exist for devices connected to the switch. +The second such feature, Dynamic ARP Inspection (DAI), also helps prevent packets being redirected to an attacking host. Some ARP attacks try to convince hosts to send packets to the attacker’s device instead of the true destination. The switch watches ARP messages as they flow through the switch. The switch checks incoming ARP messages, checking those against normal ARP operation as well as checking the details against other data sources, including the DHCP Snooping binding table. When the ARP message does not match the known information about the legitimate addresses in the network, the switch filters the ARP message. + +This chapter examines DHCP Snooping concepts and configuration in the first major sec-tion and DAI in the second. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 8-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section DHCP Snooping +Dynamic ARP Inspection + +Questions 1–4 +5–7 + + +1. An engineer hears about DHCP Snooping and decides to implement it. Which of the following are the devices on which DHCP Snooping could be implemented? (Choose two answers.) +a. Layer 2 switches b. Routers +c. Multilayer switches d. End-user hosts +2. Layer 2 switch SW2 connects a Layer 2 switch (SW1), a router (R1), a DHCP server (S1), and three PCs (PC1, PC2, and PC3). All PCs are DHCP clients. Which of the fol-lowing are the most likely DHCP Snooping trust state configurations on SW2 for the ports connected to the listed devices? (Choose two answers.) +a. The port connected to the router is untrusted. b. The port connected to switch SW1 is trusted. c. The port connected to PC1 is untrusted. +d. The port connected to PC3 is trusted. + +3. Switch SW1 needs to be configured to use DHCP Snooping in VLAN 5 and only VLAN 5. Which commands must be included, assuming at least one switch port in VLAN 5 must be an untrusted port? (Choose two answers.) +a. no ip dhcp snooping trust b. ip dhcp snooping untrust c. ip dhcp snooping +d. ip dhcp snooping vlan 5 + +4. On a multilayer switch, a switch needs to be configured to perform DHCP Snooping on some Layer 2 ports in VLAN 3. Which command may or may not be needed depending on whether the switch also acts as a DHCP relay agent? +a. no ip dhcp snooping information option b. ip dhcp snooping limit rate 5 +c. errdisable recovery cause dhcp-rate-limit d. ip dhcp snooping vlan 3 +146 CCNA 200-301 Official Cert Guide, Volume 2 + +5. Switch SW1 has been configured to use Dynamic ARP Inspection with DHCP Snooping in VLAN 5. An ARP request arrives on port G0/1. Which answer describes two items DAI always compares regardless of the configuration? +a. The message’s ARP origin hardware address and the message’s Ethernet header source MAC address +b. The message’s ARP origin hardware address and the DHCP Snooping binding table +c. The message’s ARP target IP address and the DHCP Snooping binding table d. The message’s ARP target IP address and the switch’s ARP table +6. Switch SW1 needs to be configured to use Dynamic ARP Inspection along with DHCP Snooping in VLAN 6 and only VLAN 6. Which commands must be included, assuming at least one switch port in VLAN 6 must be a trusted port? (Choose two answers.) +a. no ip arp inspection untrust b. ip arp inspection trust +c. ip arp inspection +d. ip arp inspection vlan 6 + +7. A Layer 2 switch needs to be configured to use Dynamic ARP Inspection along with DHCP Snooping. Which command would make DAI monitor ARP message rates on an interface at an average rate of 4 received ARP messages per second? (Choose two answers.) +a. ip arp inspection limit rate 4 burst interval 2 b. ip arp inspection limit rate 10 burst interval 2 c. ip arp inspection limit rate 16 burst interval 4 d. ip arp inspection limit rate 4 + + +Foundation Topics + +DHCP Snooping +DHCP servers play a vital role in most every network today, with almost every user end-point using DHCP to learn its IP address, mask, default gateway, and DNS server IP address-es. Chapter 7, “Implementing DHCP,” shows how DHCP should work under normal circum-stances. This section now examines how attackers might use DHCP for their own ends and how two specific tools—DHCP Snooping and Dynamic ARP Inspection (DAI)—help defeat those attacks. + +This section begins with an examination of the need for DHCP Snooping concepts includ-ing the types of attacks it can try to prevent, followed by details of how to configure DHCP Snooping. + +DHCP Snooping Concepts +DHCP Snooping on a switch acts like a firewall or an ACL in many ways. It analyzes incom-ing messages on the specified subset of ports in a VLAN. DHCP Snooping never filters +Chapter 8: DHCP Snooping and ARP Inspection 147 + +non-DHCP messages, but it may choose to filter DHCP messages, applying logic to make a choice—allow the incoming DHCP message or discard the message. + +While DHCP itself provides a Layer 3 service, DHCP Snooping operates on LAN switches and is commonly used on Layer 2 LAN switches and enabled on Layer 2 ports. The reason to put DHCP Snooping on the switch is that the function needs to be performed between a typical end-user device—the type of device that acts as a DHCP client—and DHCP servers or DHCP relay agents. + +Figure 8-1 shows a sample network that provides a good backdrop to discuss DHCP Snooping. First, all devices connect to Layer 2 switch SW2, with all ports as Layer 2 switch-ports, all in the same VLAN. The typical DHCP clients sit on the right of the figure. The left shows other devices that could be the path through which to reach a DHCP server. + +Trusted Untrusted + +SW2 + + + +R1 SW2 + +DHCP Server + +Figure 8-1 DHCP Snooping Basics: Client Ports Are Untrusted + + +DHCP Snooping works first on all ports in a VLAN, but with each port being trusted or untrusted by DHCP Snooping. To understand why, consider this summary of the general rules used by DHCP Snooping. Note that the rules differentiate between messages normally sent by servers (like DHCPOFFER and DHCPACK) versus those normally sent by DHCP clients: + +■ DHCP messages received on an untrusted port, for messages normally sent by a server, will always be discarded. +■ DHCP messages received on an untrusted port, as normally sent by a DHCP client, may be filtered if they appear to be part of an attack. +■ DHCP messages received on a trusted port will be forwarded; trusted ports do not filter (discard) any DHCP messages. + + +8 + + +A Sample Attack: A Spurious DHCP Server +To give you some perspective, Figure 8-2 shows a legitimate user’s PC on the far right and the legitimate DHCP server on the far left. However, an attacker has connected his laptop to the LAN and started his DHCP attack by acting like a DHCP server. Following the steps in the figure, assume PC1 is attempting to lease an IP address while the attacker is making his attack: + +1. PC1 sends a LAN broadcast with PC1’s first DHCP message (DHCPDISCOVER). +2. The attacker’s PC—acting as a spurious DHCP server—replies to the DHCPDISCOVER with a DHCPOFFER. +148 CCNA 200-301 Official Cert Guide, Volume 2 + + + + +R1 R2 10.1.1.1 + + +SW2 +DHCP +1 +10.1.1.2 + +PC1 + + +2 10.1.1.11 GW=10.1.1.2 + + + + + +Trusted DHCP Server + + +Spurious DHCP Server + +Figure 8-2 DHCP Attack Supplies Good IP Address but Wrong Default Gateway + +In this example, the DHCP server created and used by the attacker actually leases a useful IP address to PC1, in the correct subnet, with the correct mask. Why? The attacker wants PC1 to function, but with one twist. Notice the default gateway assigned to PC1: 10.1.1.2, which is the attacker’s PC address, rather than 10.1.1.1, which is router R1’s address. Now PC1 thinks it has all it needs to connect to the network, and it does—but now all the pack-ets sent by PC1 to what it thinks is its default router flow first through the attacker’s PC, creating a man-in-the-middle attack, as shown in Figure 8-3. + + + + +R1 R2 10.1.1.1 +2 + + +SW2 +1 + +10.1.1.2 + +PC2 + +PC1 + + +10.1.1.11 GW=10.1.1.2 + + + +Attacker: Man-in-the-Middle +Figure 8-3 Unfortunate Result: DHCP Attack Leads to Man-in-the-Middle + +Note that the legitimate DHCP also returns a DHCPOFFER message to host PC1, but most hosts use the first received DHCPOFFER, and the attacker will likely be first in this scenario. + +The two steps in the figure show data flow once DHCP has completed. For any traffic destined to leave the subnet, PC1 sends its packets to its default gateway, 10.1.1.2, which happens to be the attacker. The attacker forwards the packets to R1. The PC1 user can con-nect to any and all applications just like normal, but now the attacker can keep a copy of anything sent by PC1. + +DHCP Snooping Logic +The preceding example shows just one attack in which the attacker acts like a DHCP server (spurious DHCP server). DHCP Snooping defeats such attacks by making most ports + + +Answers to the “Do I Know This Already?” quiz: 1 A, C 2 B, C 3 C, D 4 A 5 B 6 B, D 7 C, D +Chapter 8: DHCP Snooping and ARP Inspection 149 + +untrusted, which by definition would filter the DHCP server messages that arrive on the untrusted ports. For instance, in Figures 8-2 and 8-3, making the port connected to the attacker, a DHCP Snooping untrusted port defeats the attack. + +To appreciate the broader set of DHCP Snooping rules and logic, it helps to have a handy reference of some of the more common DHCP messages and processes. For a quick review, the normal message flow includes this sequence: DISCOVER, OFFER, REQUEST, ACK (DORA). In particular: + +■ Clients send DISCOVER and REQUEST. ■ Servers send OFFER and ACK. + +Additionally, DHCP clients also use the DHCP RELEASE and DHCP DECLINE messages. When a client has a working lease for an address but no longer wants to use the address, the DHCP client can tell the DHCP server it no longer needs the address, releasing it back to the DHCP server, with the DHCP RELEASE message. Similarly, a client can send a DHCP DECLINE message to turn down the use of an IP address during the normal DORA flow on messages. + +Now to the logic for DHCP Snooping untrusted ports. Figure 8-4 summarizes the ideas, with two switch ports. On the left, the switch port connects to a DHCP server, so it should be trusted; otherwise DHCP would not work, because the switch would filter all DHCP messages sent by the DHCP server. On the right, PC1 connects to an untrusted port with a DHCP client. + + +Trusted + +G1/0/2 +DHCP SW2 + +Untrusted + +G1/0/3 PC1 8 DHCP + + + +DHCP All Messages: Approved! DHCP Server Messages: Rejected! DHCP Client Messages: +A) Check DISCOVER MAC Addresses B) Check RELEASE/DECLINE +Figure 8-4 Summary of Rules for DHCP Snooping + +The following list summarizes the DHCP Snooping rules: + +1. Examine all incoming DHCP messages. +2. If normally sent by servers, discard the message. 3. If normally sent by clients, filter as follows: +a. For DISCOVER and REQUEST messages, check for MAC address consistency between the Ethernet frame and the DHCP message. +b. For RELEASE or DECLINE messages, check the incoming interface plus IP address versus the DHCP Snooping binding table. +4. For messages not filtered that result in a DHCP lease, build a new entry to the DHCP Snooping binding table. + +The next few pages complete the discussion of concepts by explaining a little more about steps 3 and 4 in the list. +150 CCNA 200-301 Official Cert Guide, Volume 2 + +Filtering DISCOVER Messages Based on MAC Address +DHCP Snooping does one straightforward check for the most common client-sent mes-sages: DISCOVER and REQUEST. First, note that DHCP messages define the chaddr (client hardware address) field to identify the client. Hosts on LANs include the device’s MAC address as part of chaddr. As usual, Ethernet hosts encapsulate the DHCP messages inside Ethernet frames, and those frames of course include a source MAC address—an address that should be the same MAC address used in the DHCP chaddr field. DHCP Snooping does a simple check to make sure those values match. + +Figure 8-5 shows how an attacker could attempt to overload the DHCP server and lease all the addresses in the subnet. The attacker’s PC uses pseudo MAC address A, so all three DISCOVER messages in the figure show a source Ethernet address of “A.” However, each +message (in the DHCP data) identifies a different MAC address in the chaddr value (shown as MAC1, MAC2, and MAC3 in the figure for brevity), so from a DHCP perspective, each message appears to be a different DHCP request. The attacker can attempt to lease every IP address in the subnet so that no other hosts could obtain a lease. + + + + +SW2 +1 DHCP +Server + +2 + + + + + +Ethernet +... S_MAC=A + +Ethernet +... S_MAC=A + + + + + +DISCOVER CHADDR = MAC1 + +DISCOVER CHADDR = MAC2 + +Attacker + +PC + + + +3 Ethernet +... S_MAC=A + + +DISCOVER CHADDR = MAC3 + +Figure 8-5 DHCP Snooping Checks chaddr and Ethernet Source MAC + +The core feature of DHCP Snooping defeats this type of attack on untrusted ports. It checks the Ethernet header source MAC address and compares that address to the MAC address in the DHCP header, and if the values do not match, DHCP Snooping discards the message. + +Filtering Messages that Release IP Addresses +Before looking at the next bit of logic, you need to first understand the DHCP Snooping binding table. + +DHCP Snooping builds the DHCP Snooping binding table for all the DHCP flows it sees that it allows to complete. That is, for any working legitimate DHCP flows, it keeps a list of some of the important facts. Then DHCP Snooping, and other features like Dynamic ARP Inspection, can use the table to make decisions. + +As an example, consider Figure 8-6, which repeats the same topology as Figure 8-4, now with one entry in its DHCP Snooping binding table. +Chapter 8: DHCP Snooping and ARP Inspection 151 + + +Trusted + +G1/0/2 +SW2 + +Untrusted + +G1/0/3 PC1 + + + +DHCP + +SW2 DHCP Snooping Binding Table + + +MAC: 0200.1111.1111 IP: 172.16.2.101 + + + +MAC +0200.1111.1111 + +IP +172.16.2.101 + +VLAN Interface +11 G1/0/3 + +Figure 8-6 Legitimate DHCP Client with DHCP Binding Entry Built by DHCP Snooping + +In this simple network, the DHCP client on the right leases IP address 172.16.2.101 from the DHCP server on the left. The switch’s DHCP Snooping feature combines the informa-tion from the DHCP messages, with information about the port (interface G1/0/3, assigned to VLAN 11 by the switch), and puts that in the DHCP Snooping binding table. + +DHCP Snooping then applies additional filtering logic that uses the DHCP Snooping bind-ing table: it checks client-sent messages like RELEASE and DECLINE that would cause the DHCP server to be allowed to release an address. For instance, a legitimate user might lease address 172.16.2.101, and at some point release the address back to the server; however, before the client has finished with its lease, an attacker could send DHCP RELEASE mes-sage to release that address back into the pool. The attacker could then immediately try to lease that address, hoping the DHCP server assigns that same 172.16.2.101 address to the attacker. + +Figure 8-7 shows an example. PC1 already has a DHCP address (172.16.2.101), with SW2 +listing an entry in the DHCP Snooping binding table. The figure shows the action by which 8 the attacker off port G1/0/5 attempts to release PC1’s address. DHCP Snooping compares +the incoming message, incoming interface, and matching table entry: + +1. The incoming message is a DHCP RELEASE message in port G1/0/5 listing address 172.16.2.101. +2. The DHCP Snooping binding table lists 172.16.2.101 as being originally leased via messages arriving on port G1/0/3. +3. DHCP Snooping discards the DHCP RELEASE message. + + +G1/0/3 PC1 Normal + + +SW2 G1/0/5 DHCP +Server + +DHCP Snooping Binding Table + + +PC2 + + + +RELEASE ADDR=172.16.2.101 + + +Attacker + +1 + +172.16.2.101 G1/0/3 + + +Figure 8-7 DHCP Snooping Defeats a DHCP RELEASE from Another Port +152 CCNA 200-301 Official Cert Guide, Volume 2 + +DHCP Snooping Configuration +DHCP Snooping requires several configuration steps to make it work. First, you need to use a pair of associated global commands: one to enable DHCP Snooping and another to list the VLANs on which to use DHCP Snooping. Both must be included for DHCP Snooping to operate. + +Second, while not literally required, you will often need to configure a few ports as trusted ports. Most switches that use DHCP Snooping for a VLAN have some trusted ports and some untrusted ports, and with a default of untrusted, you need to configure the trusted ports. + +This section begins with an example that shows how to configure a typical Layer 2 switch to use DHCP Snooping, with required commands as just described, and with other optional commands. + +Configuring DHCP Snooping on a Layer 2 Switch +The upcoming examples all rely on the topology illustrated in Figure 8-8, with Layer 2 switch SW2 as the switch on which to enable DHCP Snooping. The DHCP server sits on the other side of the WAN, on the left of the figure. As a result, SW2’s port connected to router R2 (a DHCP relay agent) needs to be trusted. On the right, two sample PCs can use the default untrusted setting. + +DHCP +Relay Agent G1/0/3 PC1 + + +R1 R2 + + +DHCP Server + +G1/0/2 +SW2 + +Trusted + + +G1/0/4 PC2 + +Untrusted + + +Figure 8-8 Sample Network Used in DHCP Snooping Configuration Examples + +Switch SW2 places all the ports in the figure in VLAN 11, so to enable DHCP Snooping in VLAN 11, SW2 requires two commands, as shown near the top of Example 8-1: ip dhcp snooping and ip dhcp snooping vlan 11. Then, to change the logic on port G1/0/2 (con-nected to the router) to be trusted, the configuration includes the ip dhcp snooping trust interface subcommand. +Example 8-1 DHCP Snooping Configuration to Match Figure 8-8 + +ip dhcp snooping +ip dhcp snooping vlan 11 +no ip dhcp snooping information option +! +interface GigabitEthernet1/0/2 +ip dhcp snooping trust + +Note that the no ip dhcp snooping information option command in Example 8-1 will be explained in a better context just after Example 8-2 but is listed in Example 8-1 to make the example complete. +Chapter 8: DHCP Snooping and ARP Inspection 153 + +With this configuration, the switch follows the logic steps detailed in the earlier section titled “DHCP Snooping Logic.” To see some support for that claim, look at Example 8-2, which shows the output from the show ip dhcp snooping command on switch SW2. +Example 8-2 SW2 DHCP Snooping Status + +SW2# show ip dhcp snooping +Switch DHCP snooping is enabled +Switch DHCP gleaning is disabled +DHCP snooping is configured on following VLANs: +11 +DHCP snooping is operational on following VLANs: +11 +Smartlog is configured on following VLANs: +none +Smartlog is operational on following VLANs: +none +DHCP snooping is configured on the following L3 Interfaces: + +Insertion of option 82 is disabled +circuit-id default format: vlan-mod-port +remote-id: bcc4.938b.a180 (MAC) +Option 82 on untrusted port is not allowed +Verification of hwaddr field is enabled +Verification of giaddr field is enabled +DHCP snooping trust/rate is configured on the following Interfaces: + + +Interface +----------------------- +GigabitEthernet1/0/2 +Custom circuit-ids: + + +Trusted +------- +yes + + +Allow option +------------ +yes + +8 Rate limit (pps) +---------------- +unlimited + + +The highlighted lines in the example point out a few of the key configuration settings. Starting at the top, the first two confirm the configuration of the ip dhcp snooping and ip dhcp snooping vlan 11 commands, respectively. Also, the highlighted lines at the bottom of the output show a section that lists trusted ports—in this case, only port G1/0/2. +Also, you might have noticed that highlighted line in the middle that states Insertion of option 82 is disabled. That line confirms the addition of the no ip dhcp information option command to the configuration back in Example 8-1. To understand why the example includes this command, consider these facts about DHCP relay agents: + +■ DHCP relay agents add new fields to DHCP requests—defined as option 82 DHCP header fields (in RFC 3046). +■ DHCP Snooping uses default settings that work well if the switch acts as a Layer 3 switch and as a DHCP relay agent, meaning that the switch should insert the DHCP option +82 fields into DHCP messages. In effect, the switch defaults to use ip dhcp snooping information option. +154 CCNA 200-301 Official Cert Guide, Volume 2 + +■ When the switch does not also act as a DHCP relay agent, the default setting stops DHCP from working for end users. The switch sets fields in the DHCP messages as if it were a DHCP relay agent, but the changes to those messages cause most DHCP servers (and most DHCP relay agents) to ignore the received DHCP messages. +■ The conclusion: To make DHCP Snooping work on a switch that is not also a DHCP relay agent, disable the option 82 feature using the no ip dhcp snooping information option global command. + +That concludes the DHCP Snooping configuration that is both required and that you will most often need to make the feature work. The rest of this section discusses a few optional DHCP Snooping features. + +Limiting DHCP Message Rates +Knowing that DHCP Snooping prevents their attacks, what might attackers do in response? Devise new attacks, including attacking DHCP Snooping itself. + +One way to attack DHCP Snooping takes advantage of the fact that it uses the general-purpose CPU in a switch. Knowing that, attackers can devise attacks to generate large volumes of DHCP messages in an attempt to overload the DHCP Snooping feature and the switch CPU itself. The goal can be as a simple denial-of-service attack or a combination of attacks that might cause DHCP Snooping to fail to examine every message, allowing other DHCP attacks to then work. + +To help prevent this kind of attack, DHCP Snooping includes an optional feature that tracks the number of incoming DHCP messages. If the number of incoming DHCP mes-sages exceeds that limit over a one-second period, DHCP Snooping treats the event as an attack and moves the port to an err-disabled state. Also, the feature can be enabled both on trusted and untrusted interfaces. + +Although rate limiting DHCP messages can help, placing the port in an err-disabled state can itself create issues. As a reminder, once in the err-disabled state, the switch will not send or receive frames for the interface. However, the err-disabled state might be too severe an action because the default recovery action for an err-disabled state requires the configura-tion of a shutdown and then a no shutdown subcommand on the interface. + +To help strike a better balance, you can enable DHCP Snooping rate limiting and then also configure the switch to automatically recover from the port’s err-disabled state, without the need for a shutdown and then no shutdown command. +Example 8-3 shows how to enable DHCP Snooping rate limits and err-disabled recovery. First, look at the lower half of the configuration, to the interfaces, to see the straightfor-ward setting of the per-interface limits using the ip dhcp snooping rate limit number inter-face subcommands. The top of the configuration uses two global commands to tell IOS to recover from an err-disabled state if it is caused by DHCP Snooping, and to use a nonde-fault number of seconds to wait before recovering the interface. Note that the configura-tion in Example 8-3 would rely on the core configuration for DHCP Snooping as shown in Example 8-1. +Chapter 8: DHCP Snooping and ARP Inspection 155 + +Example 8-3 Configuring DHCP Snooping Message Rate Limits + +errdisable recovery cause dhcp-rate-limit +errdisable recovery interval 30 +! +interface GigabitEthernet1/0/2 +ip dhcp snooping limit rate 10 +! +interface GigabitEthernet1/0/3 +ip dhcp snooping limit rate 2 + +A repeat of the show ip dhcp snooping command now shows the rate limits near the end of the output, as noted in Example 8-4. +Example 8-4 Confirming DHCP Snooping Rate Limits + +SW2# show ip dhcp snooping +! Lines omitted for brevity + + +Interface +----------------------- +GigabitEthernet1/0/2 +Custom circuit-ids: +GigabitEthernet1/0/3 +Custom circuit-ids: + +Trusted +------- +yes + +no + +Allow option +------------ +yes + +no + +Rate limit (pps) +---------------- +10 + +2 + + + +DHCP Snooping Configuration Summary +The following configuration checklist summarizes the commands included in this section about how to configure DHCP Snooping. + + +8 + + + + + + +Config Checklist + +Step 1. Configure this pair of commands (both required): +A. Use the ip dhcp snooping global command to enable DHCP Snooping on the switch. +B. Use the ip dhcp snooping vlan vlan-list global command to identify the VLANs on which to use DHCP Snooping. +Step 2. (Optional): Use the no ip dhcp snooping information option global com-mand on Layer 2 switches to disable the insertion of DHCP Option 82 data into DHCP messages, specifically on switches that do not act as a DHCP relay agent. +Step 3. Configure the ip dhcp snooping trust interface subcommand to override the default setting of not trusted. +Step 4. (Optional): Configure DHCP Snooping rate limits and err-disabled recovery: +Step A. (Optional): Configure the ip dhcp snooping limit rate number inter-face subcommand to set a limit of DHCP messages per second. +Step B. (Optional): Configure the no ip dhcp snooping limit rate number interface subcommand to remove an existing limit and reset the interface to use the default of no rate limit. +156 CCNA 200-301 Official Cert Guide, Volume 2 + +Step C. (Optional): Configure the errdisable recovery cause dhcp-rate-limit global command to enable the feature of automatic recovery from err-disabled mode, assuming the switch placed the port in err-dis-abled state because of exceeding DHCP Snooping rate limits. +Step D. (Optional): Configure the errdisable recovery interval seconds glob-al commands to set the time to wait before recovering from an inter-face err-disabled state (regardless of the cause of the err-disabled state). + +Dynamic ARP Inspection +The Dynamic ARP Inspection (DAI) feature on a switch examines incoming ARP messages on untrusted ports to filter those it believes to be part of an attack. DAI’s core feature com-pares incoming ARP messages with two sources of data: the DHCP Snooping binding table and any configured ARP ACLs. If the incoming ARP message does not match the tables in the switch, the switch discards the ARP message. + +This section follows the same sequence as with the DHCP Snooping section, first examining the concepts behind DAI and ARP attacks, and then showing how to configure DAI with both required and optional features. + +DAI Concepts +To understand the attacks DAI can prevent, you need to be ready to compare normal ARP operations with the abnormal use of ARP used in some types of attacks. This section uses that same flow, first reviewing a few important ARP details, and then showing how an attacker can just send an ARP reply—called a gratuitous ARP—triggering hosts to add incorrect ARP entries to their ARP tables. + +Review of Normal IP ARP +If all you care about is how ARP works normally, with no concern about attacks, you can think of ARP to the depth shown in Figure 8-9. The figure shows a typical sequence. Host PC1 needs to send an IP packet to its default router (R2), so PC1 first sends an ARP request message in an attempt to learn the MAC address associated with R2’s 172.16.2.2 address. Router R2 sends back an ARP reply, listing R2’s MAC address (note the figure shows pseu-do MAC addresses to save space). + + + + + +172.16.2.2 MAC 2 + + +R2 + + + +2 +ARP Reply + +1 +ARP Request + +172.16.2.101 MAC 1 + +PC 1 SW2 + + + +ARP +IP MAC 172.16.2.101 MAC 1 3 + +ARP +IP MAC +3 172.16.2.2 MAC 2 + +Figure 8-9 Legitimate ARP Tables After PC1 DHCP and ARP with Router R2 +Chapter 8: DHCP Snooping and ARP Inspection 157 + +The ARP tables at bottom of the figure imply an important fact: both hosts learn the other host’s MAC address with this two-message flow. Not only does PC1 learn R2’s MAC address based on the ARP reply (message 2), but router R2 learns PC1’s IP and MAC address because of the ARP request (message 1). To see why, take a look at the more detailed view of those messages as shown in Figure 8-10. + + +172.16.2.2 MAC 2 + + +R2 + + + +G1/0/2 G1/0/3 +SW2 + +172.16.2.101 MAC 1 + +PC 1 + +Ethernet ARP + +1 6RXUFH0$& Origin IP MAC 1 172.16.2.101 + + +Origin HW MAC 1 + + + +Dest. MAC %·FDVW + +Target IP 172.16.2.2 + +Target HW ??? + +Ethernet ARP ARP Request + +6RXUFH0$& MAC 2 + + +Origin IP 172.16.2.2 + +Origin HW 2 MAC 2 + + + +Dest. MAC MAC 1 + +Target IP 172.16.2.101 + +Target HW MAC 1 + +ARP Reply +Figure 8-10 A Detailed Look at ARP Request and Reply + +The ARP messages define origin IP and hardware (MAC) address fields as well as target +IP and hardware address fields. The origin should list the sending device’s IP address and +MAC, no matter whether the message is an ARP reply or ARP request. For instance, mes- 8 +sage 1 in the figure, sent by PC1, lists PC1’s IP and MAC addresses in the origin fields, which is why router R2 could learn that information. PC2 likewise learns of R2’s MAC address per the origin address fields in the ARP reply. + +Gratuitous ARP as an Attack Vector +Normally, a host uses ARP when it knows the IP address of another host and wants to learn that host’s MAC address. However, for legitimate reasons, a host might also want to inform all the hosts in the subnet about its MAC address. That might be useful when a host changes its MAC address, for instance. So, ARP supports the idea of a gratuitous ARP message with these features: + +■ It is an ARP reply. +■ It is sent without having first received an ARP request. +■ It is sent to an Ethernet destination broadcast address so that all hosts in the subnet receive the message. + +For instance, if a host’s MAC address is MAC A, and it changes to MAC B, to cause all the other hosts to update their ARP tables, the host could send a gratuitous ARP that lists an origin MAC of MAC B. + +Attackers can take advantage of gratuitous ARPs because they let the sending host make other hosts change their ARP tables. Figure 8-11 shows just such an example initiated by PC A +158 CCNA 200-301 Official Cert Guide, Volume 2 + +(an attacker) with a gratuitous ARP. However, this ARP lists PC1’s IP address but a different device’s MAC address (PC A) at step 1, causing the router to update its ARP table (step 2). + + + +172.16.2.11 MAC 2 + + +R2 + +R2 ARP Table +IP MAC 172.16.2.101 MAC 1 2 +MAC A + +172.16.2.101 MAC 1 + +G1/0/3 PC 1 SW2 +G1/0/5 PC A + + +1 MAC A + +ARP Reply +IP = 172.16.2.101 MAC = MAC A +Figure 8-11 Nefarious Use of ARP Reply Causes Incorrect ARP Data on R2 + +At this point, when R2 forwards IP packets to PC1’s IP address (172.16.2.101), R2 will encapsulate them in an Ethernet frame with PC A as the destination rather than with PC1’s MAC address. At first, this might seem to stop PC1 from working, but instead it could be part of a man-in-the-middle attack so that PC A can copy every message. Figure 8-12 shows the idea of what happens at this point: + +1. PC1 sends messages to some server on the left side of router R2. +2. The server replies to PC1’s IP address, but R2 forwards that packet to PC A’s MAC address, rather than to PC1. +3. PC A copies the packet for later processing. +4. PC A forwards the packet inside a new frame to PC1 so that PC1 still works. + + + +172.16.2.11 MAC 2 + +1 To MAC 2 172.16.2.101 MAC 1 + + +PC 1 R2 2 SW2 + +4 + +To MAC A ARP Table +IP MAC 172.16.2.101 MAC 1 2 +MAC A + + +PC A To MAC 1 + +MAC A +3 Man-in-the-Middle + +Figure 8-12 Man-in-the-Middle Attack Resulting from Gratuitous ARP + +Dynamic ARP Inspection Logic +DAI has a variety of features that can prevent these kinds of ARP attacks. To understand how, consider the sequence of a typical client host with regards to both DHCP and ARP. When a host does not have an IP address yet—that is, before the DHCP process +Chapter 8: DHCP Snooping and ARP Inspection 159 + +completes—it does not need to use ARP. Once the host leases an IP address and learns its subnet mask, it needs ARP to learn the MAC addresses of other hosts or the default router in the subnet, so it sends some ARP messages. In short, DHCP happens first, then ARP. + +DAI takes an approach for untrusted interfaces that confirms an ARP’s correctness based on DHCP Snooping’s data about the earlier DHCP messages. The correct normal DHCP messages list the IP address leased to a host as well as that host’s MAC address. The DHCP Snooping feature also records those facts into the switch’s DHCP Snooping binding table. + +For any DAI untrusted ports, DAI compares the ARP message’s origin IP and origin MAC address fields to the DHCP Snooping binding table. If found in the table, DAI allows the ARP through, but if not, DAI discards the ARP. For instance, Figure 8-13 shows step 1 in which the attacker at PC A attempts the gratuitous ARP shown earlier in Figure 8-11. At step 2, DAI makes a comparison to the DHCP Snooping binding table, not finding a match with MAC A along with IP address 172.16.2.101, so DAI would discard the message. + + +172.16.2.11 MAC 2 +G1/0/3 +R2 SW2 + + +172.16.2.101 MAC 1 + +PC 1 + + + +G1/0/5 DHCP Snooping Binding Table +MAC IP Int. MAC 1 172.16.2.101 G1/0/3 + +2 + + + +No Match + + + +PC A + + +MAC A +1 +origin = 172.16.2.101 origin = MAC A + + + + + + + + +8 + +Figure 8-13 DAI Filtering ARP Based on DHCP Snooping Binding Table + +DAI works with the idea of trusted and untrusted ports with the same general rules as DHCP Snooping. Access ports connected to end-user devices are often untrusted by both DHCP Snooping and DAI. Ports connected to other switches, routers, the DHCP server— anything other than links to end-user devices—should be trusted by DAI. + +Note that although DAI can use the DHCP Snooping table as shown here, it can also use similar statically configured data that lists correct pairs of IP and MAC addresses via a tool called ARP ACLs. Using ARP ACLs with DAI becomes useful for ports connected to devic-es that use static IP addresses rather than DHCP. Note that DAI looks for both the DCHP Snooping binding data and ARP ACLs. + +Beyond that core feature, note that DAI can optionally perform other checks as well. For instance, the Ethernet header that encapsulates the ARP should have addresses that match the ARP origin and target MAC addresses. Figure 8-14 shows an example of the comparison of the Ethernet source MAC address and the ARP message origin hardware field. +160 CCNA 200-301 Official Cert Guide, Volume 2 + +Source MAC to ARP Origin Check + + + +Source MAC MAC 2 + +Origin IP 172.16.2.2 + +Origin HW MAC 2 + + + +Dest. MAC MAC 1 + +Target IP 172.16.2.101 + +Target HW MAC 1 + + + +Ethernet Header +Figure 8-14 + +ARP Message +DAI Filtering Checks for Source MAC Addresses + + +DAI can be enabled to make the comparisons shown in the figure, discarding these messages: + +■ Messages with an Ethernet header source MAC address that is not equal to the ARP ori-gin hardware (MAC) address +■ ARP reply messages with an Ethernet header destination MAC address that is not equal to the ARP target hardware (MAC) address +■ Messages with unexpected IP addresses in the two ARP IP address fields + +Finally, like DHCP Snooping, DAI does its work in the switch CPU rather than in the switch ASIC, meaning that DAI itself can be more susceptible to DoS attacks. The attacker could generate large numbers of ARP messages, driving up CPU usage in the switch. DAI can avoid these problems through rate limiting the number of ARP messages on a port over time. + +Dynamic ARP Inspection Configuration +Configuring DAI requires just a few commands, with the usual larger variety of optional configuration settings. This section examines DAI configuration, first with mostly default settings and with reliance on DHCP Snooping. It then shows a few of the optional features, like rate limits, automatic recovery from err-disabled state, and how to enable additional checks of incoming ARP messages. + +Configuring ARP Inspection on a Layer 2 Switch +Before configuring DAI, you need to think about the feature and make a few decisions based on your goals, topology, and device roles. The decisions include the following: + +■ Choose whether to rely on DHCP Snooping, ARP ACLs, or both. +■ If using DHCP Snooping, configure it and make the correct ports trusted for DHCP Snooping. +■ Choose the VLAN(s) on which to enable DAI. +■ Make DAI trusted (rather than the default setting of untrusted) on select ports in those VLANs, typically for the same ports you trusted for DHCP Snooping. + +All the configuration examples in this section use the same sample network used in the DHCP Snooping configuration topics, repeated here as Figure 8-15. Just as with DHCP Snooping, switch SW2 on the right should be configured to trust the port connected to the router (G1/0/2), but not trust the two ports connected to the PCs. +Chapter 8: DHCP Snooping and ARP Inspection 161 + +DHCP +Relay Agent G1/0/3 PC1 + + +R1 R2 + + +DHCP Server + +G1/0/2 +SW2 + +Trusted + + +G1/0/4 PC2 + +Untrusted + + +Figure 8-15 Sample Network Used in ARP Inspection Configuration Examples + +Example 8-5 shows the required configuration to enable DAI on switch SW2 in Figure +8-15—a configuration that follows a similar progression compared to DHCP Snooping. All ports in the figure connect to VLAN 11, so to enable DAI in VLAN 11, just add the ip arp inspection vlan 11 global command. Then, to change the logic on port G1/0/2 (connected to the router) to be trusted by DAI, add the ip arp inspection trust interface subcommand. +Example 8-5 IP ARP Inspection Configuration to Match Figure 8-15 + +ip arp inspection vlan 11 +! +interface GigabitEthernet1/0/2 +ip arp inspection trust + +Example 8-5 configures DAI, but it omits both DHCP Snooping and ARP ACLs. (If you were to configure a switch only with commands shown in Example 8-5, the switch would filter all ARPs entering all untrusted ports in VLAN 11.) Example 8-6 shows a complete and working DAI configuration that adds the DHCP Snooping configuration to match the +DAI configuration in Example 8-5. Note that Example 8-6 combines Example 8-1’s earlier 8 DHCP Snooping configuration for this same topology to the DAI configuration just shown +in Example 8-5, with highlights for the DAI-specific configuration lines. + +Example 8-6 IP DHCP Snooping Configuration Added to Support DAI + +ip arp inspection vlan 11 +ip dhcp snooping +ip dhcp snooping vlan 11 +no ip dhcp snooping information option +! +interface GigabitEthernet1/0/2 +ip dhcp snooping trust +ip arp inspection trust + +Remember, DHCP occurs first with DHCP clients, and then they send ARP messages. With the configuration in Example 8-6, the switch builds its DHCP Snooping binding table by analyzing incoming DHCP messages. Next, any incoming ARP messages on DAI untrusted ports must have matching information in that binding table. + +Example 8-7 confirms the key facts about correct DAI operation in this sample network based on the configuration in Example 8-6. The show ip arp inspection command gives both configuration settings along with status variables and counters. For instance, the +162 CCNA 200-301 Official Cert Guide, Volume 2 + +highlighted lines show the total ARP messages received on untrusted ports in that VLAN and the number of dropped ARP messages (currently 0). +Example 8-7 SW2 IP ARP Inspection Status + +SW2# show ip arp inspection + +Source Mac Validation : Disabled +Destination Mac Validation : Disabled +IP Address Validation : Disabled + + +Vlan Configuration +---- ------------- +11 Enabled + +Operation +--------- +Active + +ACL Match +--------- + +Static ACL +---------- + + + +Vlan ACL Logging +---- ----------- +11 Deny + +DHCP Logging +------------ +Deny + +Probe Logging +------------- +Off + + + +Vlan Forwarded +---- --------- +11 59 + +Vlan DHCP Permits +---- ------------ +11 7 + +Dropped +------- +0 + +ACL Permits +----------- +0 + +DHCP Drops +---------- +0 + +Probe Permits +------------- +49 + +ACL Drops +--------- +0 + +Source MAC Failures +------------------- +0 + + + +Vlan Dest MAC Failures +---- ----------------- + +Vlan Dest MAC Failures +---- ----------------- +11 0 + +IP Validation Failures +---------------------- + +IP Validation Failures +---------------------- +0 + +Invalid Protocol Data +--------------------- + +Invalid Protocol Data +--------------------- +0 + +SW2# show ip dhcp snooping binding + +MacAddress +----------------- + +IpAddress +------------- + +Lease(sec) Type VLAN +---------- ------------- ---- + +Interface +-------------------- + + + +02:00:11:11:11:11 +02:00:22:22:22:22 + +172.16.2.101 86110 +172.16.2.102 86399 + +dhcp-snooping +dhcp-snooping + +11 GigabitEthernet1/0/3 +11 GigabitEthernet1/0/4 + +Total number of bindings: 2 + +The end of Example 8-7 shows an example of the show ip dhcp snooping binding com-mand on switch SW2. Note that the first two columns list a MAC and IP address as learned from the DHCP messages. Then, imagine an ARP message arrives from PC1, a message that should list PC1’s 0200.1111.1111 MAC address and 172.16.2.101 as the origin MAC and IP address, respectively. Per this output, the switch would find that matching data and allow the ARP message. + +Example 8-8 shows some detail of what happens when switch SW2 receives an invalid ARP message on port G1/0/4 in Figure 8-15. In this case, to create the invalid ARP message, +Chapter 8: DHCP Snooping and ARP Inspection 163 + +PC2 in the figure was configured with a static IP address of 172.16.2.101 (which is PC1’s DHCP-leased IP address). The highlights in the log message at the top of the example show PC2’s claimed origin MAC and origin IP addresses in the ARP message. If you refer back to the bottom of Example 8-7, you can see that this origin MAC/IP pair does not exist in the DHCP Snooping binding table, so DAI rejects the ARP message. +Example 8-8 Sample Results from an ARP Attack + +Jul 25 14:28:20.763: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi1/0/4, vlan 11.([0200.2222.2222/172.16.2.101/0000.0000.0000/172.16.2.1/09:28:20 EST Thu Jul 25 2019]) + +SW2# show ip arp inspection statistics + + +Vlan Forwarded +---- --------- +11 59 + +Vlan DHCP Permits +---- ------------ +11 7 + +Dropped +------- +17 + +ACL Permits +----------- +0 + +DHCP Drops +---------- +17 + +Probe Permits +------------- +49 + +ACL Drops +--------- +0 + +Source MAC Failures +------------------- +0 + + + +Vlan Dest MAC Failures +---- ----------------- +11 0 + +IP Validation Failures +---------------------- +0 + +Invalid Protocol Data +--------------------- +0 + + + +The statistics from the show ip arp inspection command also confirms that the switch has dropped some ARP messages. The highlighted lines in the middle of the table show 17 total dropped ARP messages in VLAN 11. That same highlighted line confirms that it dropped all 17 because of the DHCP Snooping binding table (“DHCP Drops”), with zero dropped due to an ARP ACL (“ACL Drops”). + +Limiting DAI Message Rates +Like DHCP Snooping, DAI can also be the focus of a DoS attack with the attacker generat-ing a large number of ARP messages. Like DHCP Snooping, DAI supports the configura-tion of rate limits to help prevent those attacks, with a reaction to place the port in an err-disabled state, and with the ability to configure automatic recovery from that err-disabled state. + +The DHCP Snooping and DAI rate limits do have some small differences in operation, defaults, and in configuration, as follows: + +■ DAI defaults to use rate limits for all interfaces (trusted and untrusted), with DHCP Snooping defaulting to not use rate limits. +■ DAI allows the configuration of a burst interval (a number of seconds), so that the rate limit can have logic like “x ARP messages over y seconds” (DHCP Snooping does not define a burst setting). + + +8 + + +It helps to look at DAI and DHCP Snooping rate limit configuration together to make com-parisons, so Example 8-9 shows both. The example repeats the exact same DHCP Snooping +164 CCNA 200-301 Official Cert Guide, Volume 2 + +commands in earlier Example 8-3 but adds the DAI configuration (highlighted). The con-figuration in Example 8-7 could be added to the configuration shown in Example 8-6 for a complete DHCP Snooping and DAI configuration. +Example 8-9 Configuring ARP Inspection Message Rate Limits + +errdisable recovery cause dhcp-rate-limit +errdisable recovery cause arp-inspection +errdisable recovery interval 30 +! +interface GigabitEthernet1/0/2 +ip dhcp snooping limit rate 10 +ip arp inspection limit rate 8 +! +interface GigabitEthernet1/0/3 +ip dhcp snooping limit rate 2 +ip arp inspection limit rate 8 burst interval 4 + +Example 8-10 lists output that confirms the configuration settings. For instance, Example 8-9 configures port G1/0/2 with a rate of 8 messages for each (default) burst of 1 second; the output in Example 8-10 for interface G1/0/2 also lists a rate of 8 and burst interval of +1. Similarly, Example 8-9 configures port G1/0/3 with a rate of 8 over a burst of 4 seconds, with Example 8-10 confirming those same values for port G1/0/3. Note that the other two interfaces in Example 8-10 show the default settings of a rate of 15 messages over a one-second burst. +Example 8-10 Confirming ARP Inspection Rate Limits + +SW2# show ip arp inspection interfaces + +Interface +--------------- +Gi1/0/1 +Gi1/0/2 +Gi1/0/3 +Gi1/0/4 + +Trust State +----------- +Untrusted +Trusted +Untrusted +Untrusted + +Rate (pps) +---------- +15 +8 +8 +15 + +Burst Interval +-------------- +1 +1 +4 +1 + +! Lines omitted for brevity + +Configuring Optional DAI Message Checks +As mentioned in the section titled “Dynamic ARP Inspection Logic,” DAI always checks the ARP message’s origin MAC and origin IP address fields versus some table in the switch, but it can also perform other checks. Those checks require more CPU, but they also help pre-vent other types of attacks. + +Example 8-11 shows how to configure those three additional checks. Note that you can configure one, two, or all three of the options: just configure the ip arp inspection validate command again with all the options you want in one command, and it replaces the previ-ous global configuration command. The example shows the three options, with the src-mac (source mac) option configured. +Chapter 8: DHCP Snooping and ARP Inspection 165 + +Example 8-11 Confirming ARP Inspection Rate Limits + +SW2# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. + +SW2(config)# ip arp inspection validate ? + +dst-mac +ip +src-mac + +Validate destination MAC address +Validate IP addresses +Validate source MAC address + + +SW2(config)# ip arp inspection validate src-mac +SW2(config)# ^Z +SW2# +SW2# show ip arp inspection + +Source Mac Validation : Enabled +Destination Mac Validation : Disabled +IP Address Validation : Disabled + +IP ARP Inspection Configuration Summary +The following configuration checklist summarizes the commands included in this section about how to configure Dynamic IP ARP Inspection: + + + + +Config Checklist + +Step 1. Use the ip arp inspection vlan vlan-list global command to enable Dynamic ARP Inspection (DAI) on the switch for the specified VLANs. +Step 2. Separate from the DAI configuration, also configure DHCP Snooping and/or ARP ACLs for use by DAI. +Step 3. Configure the ip arp inspection trust interface subcommand to override the default setting of not trusted. +Step 4. (Optional): Configure DAI rate limits and err-disabled recovery: +Step A. (Optional): Configure the ip arp inspection limit rate number [burst interval seconds] interface subcommand to set a limit of ARP mes-sages per second, or ARP messages for each configured interval. +Step B. (Optional): Configure the ip arp inspection limit rate none interface subcommand to disable rate limits. +Step C. (Optional): Configure the errdisable recovery cause arp-inspection global command to enable the feature of automatic recovery from err-disabled mode, assuming the switch placed the port in err-dis-abled state because of exceeding DAI rate limits. +Step D. (Optional): Configure the errdisable recovery interval seconds glob-al commands to set the time to wait before recovering from an inter-face err-disabled state (regardless of the cause of the err-disabled state). +Step 5. (Optional): Configure the ip arp inspection validate {[dst-mac] [src-mac] [ip]} global command to add DAI validation steps . + + + + +8 +166 CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 8-2 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 8-2 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions +Review config checklists + +Resource Used Book, website Book, website Book, PTP +Book, website + + +Review All the Key Topics Table 8-3 Key Topics for Chapter 8 + +Key Topic Element +Figure 8-4 List Figure 8-6 +Example 8-1 List +Figure 8-10 List +Figure 8-13 Example 8-6 + +List + +Description Page Number +DHCP filtering actions on trusted and untrusted ports 149 DHCP Snooping logic 149 DHCP Snooping binding table concept 151 DHCP Snooping configuration 152 DHCP Snooping configuration checklist 155 Detail inside ARP messages with origin and target 157 Gratuitous ARP details 157 Core Dynamic ARP Inspection logic 159 +Dynamic ARP Inspection configuration with associated 161 DHCP Snooping configuration +Dynamic ARP Inspection checklist 165 + + +Key Terms You Should Know +DHCP Snooping, trusted port, untrusted port, DHCP Snooping binding table, Dynamic ARP Inspection, (ARP) origin IP address, (ARP) origin hardware address, ARP reply, gratuitous ARP + +Command References +Tables 8-4 and 8-5 list the configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. +Chapter 8: DHCP Snooping and ARP Inspection 167 + +Table 8-4 Chapter 8 Configuration Command Reference + +Command +ip dhcp snooping + +ip dhcp snooping vlan vlan-list + +[no] ip dhcp snooping information option + +[no] ip dhcp snooping trust + +ip dhcp snooping limit rate number + + +err-disable recovery cause dhcp-rate-limit + +err-disable recovery interval seconds + +err-disable recovery cause arp-inspection + +Mode/Purpose/Description +Global command that enables DHCP Snooping if combined with enabling it on one or more VLANs +Global command that lists VLANs on which to enable DHCP Snooping, assuming the ip dhcp snooping command is also configured +Command that enables (or disables with no option) the feature of inserting DHCP option 82 parameters by the switch when also using DHCP Snooping +Interface subcommand that sets the DHCP Snooping trust state for an interface (default no, or untrusted) +Interface subcommand that sets a limit to the number of incoming DHCP messages processed on an interface, per second, before DHCP Snooping discards all other incoming DHCP messages in that same second +Global command that enables the switch to automatically recover an err-disabled interface if set to that state because of exceeding a DHCP rate limit setting +Global command that sets the number of seconds IOS waits before recovering any err-disabled interfaces which, per various configuration settings, should be recovered automatically +Global command that enables the switch to automatically recover an err-disabled interface if set to that state because of +an ARP Inspection violation 8 + +Table 8-5 Chapter 8 EXEC Command Reference + +Command +show ip dhcp snooping + +show ip dhcp snooping statistics + +show ip dhcp snooping binding + +show ip arp inspection + + +show ip arp inspection statistics + +Purpose +Lists a large variety of DHCP Snooping configuration settings +Lists counters regarding DHCP Snooping behavior on the switch +Displays the contents of the dynamically created DHCP Snooping binding table +Lists both configuration settings for Dynamic ARP Inspection (DAI) as well as counters for ARP messages processed and filtered +Lists the subset of the show ip arp inspection command output that includes counters +Part II Review + +Keep track of your part review progress with the checklist shown in Table P2-1. Details on each task follow the table. + + +Table P2-1 + +Activity + +Part II Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Do Labs + +Review Videos + + +Repeat All DIKTA Questions +For this task, use the PTP software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Use Per-Chapter Interactive Review Elements +Using the companion website, browse through the interactive review elements, such as memory tables and key term flashcards, to review the content from each chapter. + +Labs +Depending on your chosen lab tool, here are some suggestions for what to do in the lab: + +Pearson Network Simulator: If you use the full Pearson CCNA simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) +Blog Config Labs: The author’s blog (https://blog.certskills.com) includes a series of configuration-focused labs that you can do on paper, each in 10–15 minutes. Review and perform the labs for this part of the book by using the menus to navigate to the per- +chapter content and then finding all config labs related to that chapter. (You can see more detailed instructions at https://blog.certskills.com/config-labs.) +Other: If using other lab tools, here are a few suggestions: make sure to experiment with the variety of configuration topics in this part, including router and switch passwords, switch port security, Dynamic ARP Inspection, and DHCP Snooping. + +Watch Videos +Two chapters in this part mention videos included as extra material related to those chap-ters. Check out the reference in Chapter 4 to a video about using RADIUS protocol, as well as Chapter 6’s reference to a video about troubleshooting switch port security. + + + + + + + + + + + + + +Part III shifts to a variety of topics that can be found in most every network. None are required for a network to work, but many happen to be useful services. Most happen to use IP or support the IP network in some way, so Part III groups the topics together as IP Services. + +Part III begins and ends with chapters that examine a series of smaller topics. First, Chapter 9 examines several IP services for which the CCNA exam requires you to develop configu-ration and verification skills. Those services include logging and syslog, the Network Time Protocol (NTP), as well as two related services: CDP and LLDP. + +Chapter 12, at the end of Part III, closes with another series of smaller topics—although the CCNA 200-301 exam topics require only conceptual knowledge, not configuration skills for these topics. This chapter includes First Hop Redundancy Protocols (FHRPs), Simple Network Management Protocol (SNMP), and two related protocols: TFTP and FTP. + +The two middle chapters in Part III also focus on IP-based services, beginning with Chapter 10’s examination of Network Address Translation (NAT). Almost every network uses NAT with IPv4, although in many cases, the firewall implements NAT. This chapter shows how to configure and verify NAT in a Cisco router. + +Chapter 11 at first may give the appearance of a large chapter about one topic—Quality of Service—and it does focus on QoS; however, QoS by nature includes a wide variety of +individual QoS tools. This chapter walks you through the basic concepts of the primary QoS features. +Part III + + +IP Services + + + + +Chapter 9: Device Management Protocols + +Chapter 10: Network Address Translation + +Chapter 11: Quality of Service (QoS) + +Chapter 12: Miscellaneous IP Services + +Part III Review +CHAPTER 9 + + + +Device Management Protocols This chapter covers the following exam topics: +2.0 Network Access +2.3 Configure and verify Layer 2 discovery protocols (Cisco Discovery Protocol and LLDP) + +4.0 IP Services +4.2 Configure and verify NTP operating in a client and server mode + +4.5 Describe the use of syslog features including facilities and levels + + +This chapter begins Part III with a discussion of the concepts, configuration, and verifica-tion of three functions found on Cisco routers and switches. These functions focus more on managing the network devices themselves than on managing the network that devices create. + +The first major section of this chapter focuses on log messages and syslog. Most computing devices have a need to notify the administrator of any significant issue; generally, across the world of computing, messages of this type are called log messages. Cisco devices generate log messages as well. The first section shows how a Cisco device handles those messages and how you can configure routers and switches to ignore the messages or save them in different ways. + +Next, different router and switch functions benefit from synchronizing their time-of-day clocks. Like most every computing device, routers and switches have an internal clock func-tion to keep time. Network Time Protocol (NTP) provides a means for devices to synchro-nize their time, as discussed in the second section. + +The final major section focuses on two protocols that do the same kinds of work: Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP). Both provide a means for network devices to learn about neighboring devices, without requiring that IPv4 or IPv6 be working at the time. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 9-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section System Message Logging (Syslog) Network Time Protocol (NTP) +Analyzing Topology Using CDP and LLDP + +Questions 1–2 +3–4 +5–6 + + + + +1. What level of logging to the console is the default for a Cisco device? a. Informational +b. Errors +c. Warnings d. Debugging +2. What command limits the messages sent to a syslog server to levels 4 through 0? a. logging trap 0-4 +b. logging trap 0,1,2,3,4 c. logging trap 4 +d. logging trap through 4 + +3. Which of the following is accurate about the NTP client function on a Cisco router? a. The client synchronizes its time-of-day clock based on the NTP server. +b. It counts CPU cycles of the local router CPU to more accurately keep time. c. The client synchronizes its serial line clock rate based on the NTP server. +d. The client must be connected to the same subnet as an NTP server. + +4. The only NTP configuration on router R1 is the ntp server 10.1.1.1 command. Which answers describe how NTP works on the router? +a. As an NTP server only b. As an NTP client only +c. As an NTP server only after the NTP client synchronizes with NTP server 10.1.1.1 +d. As an NTP server regardless of whether the NTP client synchronizes with NTP server 10.1.1.1 + +5. Imagine that a switch connects through an Ethernet cable to a router, and the router’s host name is Hannah. Which of the following commands could tell you informa- +tion about the IOS version on Hannah without establishing a Telnet connection to Hannah? (Choose two answers.) +a. show neighbors Hannah b. show cdp +c. show cdp neighbors +d. show cdp neighbors Hannah e. show cdp entry Hannah +f. show cdp neighbors detail +174 CCNA 200-301 Official Cert Guide, Volume 2 + +6. A switch is cabled to a router whose host name is Hannah. Which of the following LLDP commands could identify Hannah’s model of hardware? (Choose two answers.) + +a. show neighbors +b. show neighbors Hannah c. show lldp +d. show lldp interface e. show lldp neighbors +f. show lldp entry Hannah + + +Foundation Topics + +System Message Logging (Syslog) +It is amazing just how helpful Cisco devices try to be to their administrators. When major (and even not-so-major) events take place, these Cisco devices attempt to notify administra-tors with detailed system messages. As you learn in this section, these messages vary from the very mundane to those that are incredibly important. Thankfully, administrators have +a large variety of options for storing these messages and being alerted to those that could have the largest impact on the network infrastructure. + +When an event happens that the device’s OS thinks is interesting, how does the OS notify us humans? Cisco IOS can send the messages to anyone currently logged in to the device. It can also store the message so that a user can later look at the messages. The next few pages examine both topics. + +NOTE The CCNA 200-301 exam topics list one exam topic about logging and syslog: “Describe the use of syslog features including facilities and levels.” This exam topic does not require you to understand the related configuration. However, the configuration reveals many of the core concepts, so this section includes the configuration details as a means to help you understand how logging and syslog work. + +Sending Messages in Real Time to Current Users +Cisco IOS running on a device at least tries to allow current users to see log messages when they happen. Not every router or switch may have users connected, but if some user is logged in, the router or switch benefits by making the network engineer aware of any issues. + +By default, IOS shows log messages to console users for all severity levels of messages. That default happens because of the default logging console global configuration command. In fact, if you have been using a console port throughout your time reading this book, you likely have already noticed many syslog messages, like messages about interfaces coming up or going down. +Chapter 9: Device Management Protocols 175 + +For other users (that is, Telnet and SSH users), the device requires a two-step process before the user sees the messages. First, IOS has another global configuration setting— logging monitor—that tells IOS to enable the sending of log messages to all logged users. However, that default configuration is not enough to allow the user to see the log messages. The user must also issue the terminal monitor EXEC command during the login session, which tells IOS that this terminal session would like to receive log messages. + +Figure 9-1 summarizes these key points about how IOS on a Cisco router or switch process-es log messages for currently connected users. In the figure, user A sits at the console and always receives log messages. On the right, the fact that user B sees messages (because user B issued the terminal monitor command after login), and user C does not, shows that each user can control whether or not she receives log messages. + +Router +logging console IOS logging monitor + +Console + +IP + +A terminal monitor B C (No Messages) + +Figure 9-1 IOS Processing for Log Messages to Current Users + + +Storing Log Messages for Later Review +With logging to the console and to terminals, an event happens, IOS sends the messages to the console and terminal sessions, and then IOS can discard the message. However, clearly, it would be useful to keep a copy of the log messages for later review, so IOS provides two primary means to keep a copy. + +IOS can store copies of the log messages in RAM by virtue of the logging buffered global configuration command. Then any user can come back later and see the old log messages by using the show logging EXEC command. +As a second option—an option used frequently in production networks—all devices store their log messages centrally to a syslog server. RFC 5424 defines the syslog protocol, which provides the means by which a device like a switch or router can use a UDP protocol to send messages to a syslog server for storage. All devices can send their log messages to the server. Later, a user can connect to the server (typically with a graphical user interface) and browse the log messages from various devices. To configure a router or switch to send log messages to a syslog server, add the logging host {address | hostname} global command, referencing the IP address or host name of the syslog server. + +Figure 9-2 shows the ideas behind the buffered logging and syslog logging. + + + + + + + +9 +176 CCNA 200-301 Official Cert Guide, Volume 2 + +Router + +logging buffered logging 172.16.3.9 172.16.3.9 + +1 1 IOS + + +Syslog Server + + + + + + +2 + +show logging + + +2 +Web Interface + + +Figure 9-2 IOS Storing Log Messages for Later View: Buffered and Syslog Server + +Log Message Format +IOS defines the format of log messages. The message begins with some data fields about the message, followed by some text more easily read by humans. For example, take a close look at this sample message: + +*Dec 18 17:10:15.079: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down + +Notice that by default on this particular device, we see the following: + +A timestamp: *Dec 18 17:10:15.079 +The facility on the router that generated the message: %LINEPROTO The severity level: 5 +A mnemonic for the message: UPDOWN +The description of the message: Line protocol on Interface FastEthernet0/0, changed state to down + +IOS dictates most of the contents of the messages, but you can at least toggle on and off the use of the timestamp (which is included by default) and a log message sequence number (which is not enabled by default). Example 9-1 reverses those defaults by turning off time-stamps and turning on sequence numbers. +Example 9-1 Disabling Timestamps and Enabling Sequence Numbers in Log Messages + +R1(config)# no service timestamps +R1(config)# service sequence-numbers +R1(config)# end +R1# +000011: %SYS-5-CONFIG_I: Configured from console by console + +To see the change in format, look at the log message at the end of the example. As usual, when you exit configuration mode, the device issues yet another log message. Comparing + + +Answers to the “Do I Know This Already?” quiz: 1 D 2 C 3 A 4 C 5 E, F 6 E, F +Chapter 9: Device Management Protocols 177 + +this message to the previous example, you can see it now no longer lists the time of day but does list a sequence number. + +Log Message Severity Levels +Log messages may just tell you about some mundane event, or they may tell you of some critical event. To help you make sense of the importance of each message, IOS assigns each message a severity level (as noted in the same messages in the preceding page or so). Figure 9-3 shows the severity levels: the lower the number, the more severe the event that caused the message. (Note that the values on the left and center are used in IOS commands.) + + +Keyword +Emergency Alert + +Critical Error Warning + +Notification Informational + +Debug + +Numeral +0 1 + +2 3 4 + +5 6 + +7 + +Description +System unusable Immediate action required + +Critical Event (Highest of 3) Error Event (Middle of 3) Warning Event (Lowest of 3) + +Normal, More Important Normal, Less Important + +Requested by User Debug + + +Severe + + +Impactful + + +Normal + +Debug + + +Figure 9-3 Syslog Message Severity Levels by Keyword and Numeral + + +Figure 9-3 breaks the eight severity levels into four sections just to make a little more sense of the meaning. The two top levels in the figure are the most severe. Messages from this level mean a serious and immediate issue exists. The next three levels, called Critical, Error, and Warning, also tell about events that impact the device, but they are not as immediate and severe. For instance, one common log message about an interface failing to a physically down state shows as a severity level 3 message. + +Continuing down the figure, IOS uses the next two levels (5 and 6) for messages that are more about notifying the user rather than identifying errors. Finally, the last level in the fig-ure is used for messages requested by the debug command, as shown in an example later in this chapter. + +Table 9-2 summarizes the configuration commands used to enable logging and to set the severity level for each type. When the severity level is set, IOS will send messages of that severity level and more severe ones (lower severity numbers) to the service identified in the command. For example, the command logging console 4 causes IOS to send severity level 0–4 messages to the console. Also, note that the command to disable each service is the no version of the command, with no in front of the command ( no logging console, no logging monitor, and so on). + + + + + + + + +9 + + +Table 9-2 How to Configure Logging Message Levels for Each Log Service + +Service Console Monitor Buffered +Syslog + +To Enable Logging logging console logging monitor logging buffered +logging host address | hostname + +To Set Message Levels +logging console level-name | level-number logging monitor level-name | level-number logging buffered level-name | level-number +logging trap level-name | level-number +178 CCNA 200-301 Official Cert Guide, Volume 2 + +Configuring and Verifying System Logging +With the information in Table 9-2, configuring syslog in a Cisco IOS router or switch should be relatively straightforward. Example 9-2 shows a sample, based on Figure 9-4. The figure shows a syslog server at IP address 172.16.3.9. Both switches and both routers will use the same configuration shown in Example 9-2, although the example shows the configu-ration process on a single device, router R1. + + +172.16.1.0/24 + +SW1 + + +172.16.1.1 +G0/1 + + +172.16.2.1 +R1 G0/2 + + +172.16.2.2 +R2 + +172.16.3.0/24 + +SW2 + + + + + + +172.16.3.9 Figure 9-4 Sample Network Used in Logging Examples +Example 9-2 Syslog Configuration on R1 + +logging console 7 +logging monitor debug +logging buffered 4 +logging host 172.16.3.9 +logging trap warning + +First, note that the example configures the same message level at the console and for termi-nal monitoring (level 7, or debug), and the same level for both buffered and logging to the syslog server (level 4, or warning). The levels may be set using the numeric severity level or the name as shown earlier in Figure 9-3. + +The show logging command confirms those same configuration settings and also lists the log messages per the logging buffered configuration. Example 9-3 shows a sample, with the configuration settings to match Example 9-2 highlighted in gray. +Example 9-3 Viewing the Configured Log Settings per the Earlier Example + +R1# show logging +Syslog logging: enabled (0 messages dropped, 3 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled) + +No Active Message Discriminator. + +No Inactive Message Discriminator. + +Console logging: level debugging, 45 messages logged, xml disabled, +filtering disabled +Monitor logging: level debugging, 0 messages logged, xml disabled, +filtering disabled +Buffer logging: level warnings, 0 messages logged, xml disabled, +filtering disabled +Chapter 9: Device Management Protocols 179 + +Exception Logging: size (8192 bytes) +Count and timestamp logging messages: disabled +Persistent logging: disabled + +No active filter modules. + +Trap logging: level warnings, 0 message lines logged +Logging to 172.16.3.9 (udp port 514, audit disabled, +link up), +0 message lines logged, +0 message lines rate-limited, +0 message lines dropped-by-MD, +xml disabled, sequence number disabled +filtering disabled +Logging Source-Interface: VRF Name: + +Log Buffer (8192 bytes): + +You might notice by now that knowing the names of all eight log message levels can be handy if you want to understand the output of the commands. Most of the show com-mands list the log message levels by name, not by number. As you can see in the gray high-lights in this example, two levels list “debug,” and two list “warning,” even though some of the configuration commands referred to those levels by number. + +Also, you cannot know this from the output, but in Example 9-3, router R1 has no buffered log messages. (Note the counter value of 0 for buffered logging messages.) If any log messages had been buffered, the actual log messages would be listed at the end of the command. In this case, I had just booted the router, and no messages had been buffered yet. (You could also clear out the old messages from the log with the clear logging EXEC +command.) 9 +The next example shows the difference between the current severity levels. This example shows the user disabling interface G0/1 on R1 with the shutdown command and then re-enabling it with the no shutdown command. If you look closely at the highlighted messages, you will see several severity 5 messages and one severity 3 message. The logging buffered +4 global configuration command on R1 (see Example 9-2) means that R1 will not buffer the severity level 5 log messages, but it will buffer the severity level 3 message. Example 9-4 ends by showing that log message at the end of the output of the show logging command. +Example 9-4 Seeing Severity 3 and 5 Messages at the Console, and Severity 3 Only in the Buffer + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface g0/1 +R1(config-if)# shutdown +R1(config-if)# +*Oct 21 20:07:07.244: %LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to administratively down +*Oct 21 20:07:08.244: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther- +180 CCNA 200-301 Official Cert Guide, Volume 2 + +net0/1, changed state to down +R1(config-if)# no shutdown +R1(config-if)# +*Oct 21 20:07:24.312: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up +*Oct 21 20:07:25.312: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther-net0/1, changed state to up +R1(config-if)# ^Z +R1# +*Oct 21 20:07:36.546: %SYS-5-CONFIG_I: Configured from console by console +R1# show logging +! Skipping about 20 lines, the same lines in Example 9-3, until the last few lines + +Log Buffer (8192 bytes): + +*Oct 21 20:07:24.312: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to up + +The debug Command and Log Messages +Of the eight log message severity levels, one level, debug level (7), has a special purpose: for messages generated as a result of a user logged in to the router or switch who issues a debug command. + +The debug EXEC command gives the network engineer a way to ask IOS to monitor for certain internal events, with that monitoring process continuing over time, so that IOS can issue log messages when those events occur. The engineer can log in, issue the debug com-mand, and move on to other work. The user can even log out of the device, and the debug remains enabled. IOS continues to monitor the request in that debug command and gener-ate log messages about any related events. The debug remains active until some user issues the no debug command with the same parameters, disabling the debug. + +NOTE While the debug command is just one command, it has a huge number of options, much like the show command may be one command, but it also has many, many options. + +The best way to see how the debug command works, and how it uses log messages, is to see an example. Example 9-5 shows a sample debug of OSPF Hello messages for router R1 in Figure 9-4. The router (R1) enables OSPF on two interfaces and has established one OSPF neighbor relationship with router R2 (RID 2.2.2.2). The debug output shows one log mes-sage for the sent Hello on each of the four OSPF-enabled interfaces, as well as log messages for received Hello messages from each of the three OSPF neighbors. +Example 9-5 Using debug ip ospf hello from R1’s Console + +R1# debug ip ospf hello +OSPF hello debugging is on +R1# +*Aug 10 13:38:19.863: OSPF-1 HELLO Gi0/1: Send hello to 224.0.0.5 area 0 from 172.16.1.1 +*Aug 10 13:38:21.199: OSPF-1 HELLO Gi0/2: Rcv hello from 2.2.2.2 area 0 172.16.2.2 +Chapter 9: Device Management Protocols 181 + +*Aug 10 13:38:22.843: OSPF-1 HELLO Gi0/2: Send hello to 224.0.0.5 area 0 from 172.16.2.1 +R1# + +The console user sees the log messages created on behalf of that debug command after the debug command completes. Per the earlier configuration in Example 9-2, R1’s logging console 7 command tells us that the console user will receive severity levels 0–7, which includes level 7 debug messages. Note that with the current settings, these debug messages would not be in the local log message buffer (because of the level in the logging buffered +warning command), nor would they be sent to the syslog server (because of the level in the logging trap 4 command). + +Note that the console user automatically sees the log messages as shown in Example 9-4. However, as noted in the text describing Figure 9-1, a user who connects to R1 would need to also issue the terminal monitor command to see those debug messages. For instance, anyone logged in with SSH at the time Example 9-4’s output was gathered would not have seen the output, even with the logging monitor debug command configured on router R1, without first issuing a terminal monitor command. + +Note that all enabled debug options use router CPU, which can cause problems for the router. You can monitor CPU use with the show process cpu command, but you should use caution when using debug commands carefully on production devices. Also, note the more CLI users that receive debug messages, the more CPU that is consumed. So, some installations choose to not include debug-level log messages for console and terminal logging, requiring users to look at the logging buffer or syslog for those messages, just to reduce router CPU load. +Network Time Protocol (NTP) +Each networking device has some concept of a date and a time-of-day clock. For instance, the log messages discussed in the first major section of this chapter had a timestamp with the date and time of day listed. Now imagine looking at all the log messages from all routers +and switches stored at a syslog server. All those messages have a date and timestamp, but +how do you make sure the timestamps are consistent? How do you make sure that all devic- 9 +es synchronize their time-of-day clocks so that you can make sense of all the log messages at the syslog server? How could you make sense of the messages for an event that impacted devices in three different time zones? + +For example, consider the messages on two routers, R1 and R2, as shown in Example 9-6. Routers R1 and R2 do not synchronize their clocks. A problem keeps happening on the seri-al link between the two routers. A network engineer looks at all the log messages as stored on the syslog server. However, when the engineer sees some messages from R1, at 13:38:39 (around 1:40 p.m.), he does not think to look for messages from R2 that have a timestamp of around 9:45 a.m. +Example 9-6 Log Messages from Routers R1 and R2, Compared + +*Oct 19 13:38:37.568: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0/0 from FULL to DOWN, Neighbor Down: Interface down or detached +*Oct 19 13:38:40.568: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to down +! These messages happened on router R2 +Oct 19 09:44:09.027: %LINK-3-UPDOWN: Interface Serial0/0/1, changed state to down +Oct 19 09:44:09.027: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Serial0/0/1 from FULL to DOWN, Neighbor Down: Interface down or detached +182 CCNA 200-301 Official Cert Guide, Volume 2 + +In reality, the messages in both parts of Example 9-6 happened within 0.5 seconds of each other because I issued a shutdown command on one of the routers. However, the two rout-ers’ time-of-day clocks were not synchronized, which makes the messages on the two rout-ers look unrelated. With synchronized clocks, the two routers would have listed practically identical timestamps of almost the exact same time when these messages occurred, making it much easier to read and correlate messages. + +Routers, switches, other networking devices, and pretty much every device known in the IT world has a time-of-day clock. For a variety of reasons, it makes sense to synchronize those clocks so that all devices have the same time of day, other than differences in time zone. The Network Time Protocol (NTP) provides the means to do just that. + +NTP gives any device a way to synchronize their time-of-day clocks. NTP provides protocol messages that devices use to learn the timestamp of other devices. Devices send timestamps to each other with NTP messages, continually exchanging messages, with one device chang-ing its clock to match the other, eventually synchronizing the clocks. As a result, actions that benefit from synchronized timing, like the timestamps on log messages, work much better. + +This section works through a progression of topics that leads to the more common types of NTP configurations seen in real networks. The section begins with basic settings, like the timezone and initial configured time on a router or switch, followed by basic NTP configu-ration. The text then examines some NTP internals regarding how NTP defines the sources of time data (reference clocks) and how good each time source is (stratum). The section +closes with more configuration that explains typical enterprise configurations, with multiple ntp commands for redundancy and the use of loopback interfaces for high availability. + +Setting the Time and Timezone +NTP’s job is to synchronize clocks, but NTP works best if you set the device clock to a reasonably close time before enabling the NTP client function with the ntp server +command. For instance, my wristwatch says 8:52 p.m. right now. Before starting NTP on a new router or switch so that it synchronizes with another device, I should set the time to 8:52 p.m., set the correct date and timezone, and even tell the device to adjust for daylight savings time—and then enable NTP. Setting the time correctly gives NTP a good start toward synchronizing. + +Example 9-7 shows how to set the date, time, timezone, and daylight savings time. Oddly, it uses two configuration commands (for the timezone and daylight savings time) and one EXEC command to set the date and time on the router. +Example 9-7 Setting the Date/Time with clock set, Plus Timezone/DST + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# clock timezone EST -5 +R1(config)# clock summer-time EDT recurring +R1(config)# ^Z +R1# +R1# clock set 20:52:49 21 October 2015 +*Oct 21 20:52:49.000: %SYS-6-CLOCKUPDATE: System clock has been updated from 00:36:38 UTC Thu Oct 22 2015 to 20:52:49 UTC Wed Oct 21 2015, configured from console by +Chapter 9: Device Management Protocols 183 + +console. +R1# show clock +20:52:55.051 EDT Wed Oct 21 2015 + + +Focus on the two configuration commands first. You should set the first two commands before setting the time of day with the clock set EXEC command because the two configu-ration commands impact the time that is set. In the first command, the clock timezone part defines the command and a keyword. The next parameter, “EST” in this case, is any value you choose, but choose the name of the timezone of the device. This value shows up in show commands, so although you make up the value, the value needs to be meaningful to all. I chose EST, the acronym for US Eastern Standard Time. The “-5” parameter means that this device is 5 hours behind Universal Time Coordinated (UTC) . + +The clock summer-time part of the second command defines what to do, again with the “EDT” being a field in which you could have used any value. However, you should use a meaningful value. This is the value shown with the time in show commands when daylight savings time is in effect, so I chose EDT because it is the acronym for daylight savings time in that same EST time zone. Finally, the recurring keyword tells the router to spring for-ward an hour and fall back an hour automatically over the years. + +The clock set EXEC command then sets the time, day of the month, month, and year. However, note that IOS interprets the time as typed in the command in the context of the time zone and daylight savings time. In the example, the clock set command lists a time of 20:52:49 (the command uses a time syntax with a 24-hour format, not with a 12-hour for-mat plus a.m./p.m.). As a result of that time plus the two earlier configuration commands, the show clock command (issued seconds later) lists that time, but also notes the time as EDT, rather than UTC time. + +Basic NTP Configuration +With NTP, servers supply information about the time of day to clients, and clients react by adjusting their clocks to match. The process requires repeated small adjustments over time to maintain that synchronization. The configuration itself can be simple, or it can be exten-sive once you add security configuration and redundancy. + +Cisco supplies two ntp configuration commands that dictate how NTP works on a router or switch, as follows: + +■ ntp master {stratum-level}: NTP server mode—the device acts only as an NTP server, and not as an NTP client. The device gets its time information from the internal clock on the device. +■ ntp server {address | hostname}: NTP client/server mode—the device acts as both client and server. First, it acts as an NTP client, to synchronize time with a server. Once syn-chronized, the device can then act as an NTP server, to supply time to other NTP clients. + + + + + + + + + + + + + + + + + + + + + + + + + +9 + + +For an example showing the basic configuration syntax and show commands, consider Figure 9-5. With this simple configuration: + +■ R3 acts as an NTP server only. +■ R2 acts in client/server mode—first as an NTP client to synchronize time with NTP serv-er R3, then as a server to supply time to NTP client R1. +184 CCNA 200-301 Official Cert Guide, Volume 2 + +■ R1 acts in client/server mode—first as an NTP client to synchronize time with NTP server R2. (R1 will be willing to act as a server, but no devices happen to reference R1 as an NTP server in this example.) + +ntp server 172.16.2.2 ntp server 172.16.3.3 ntp master + + +172.16.2.2 +G0/1 R1 G0/2 G0/1 R2 G0/2 + +172.16.3.3 +G0/1 R3 G0/2 + + + +NTP Client / Server + +Stratum 4 + +NTP Client / Server + +Stratum 3 + +NTP Server + +Stratum 2 + +Figure 9-5 R1 as NTP Client, R2 as Client/Server, R3 as Server + +As you can see, NTP requires little configuration to make it work with a single configura-tion command on each device. Example 9-8 collects the configuration from the devices shown in the figure for easy reference. +Example 9-8 NTP Client/Server Configuration + +! Configuration on R1: +ntp server 172.16.2.2 +! Configuration on R2: +ntp server 172.16.3.3 +! Configuration on R3: +ntp master 2 + +Example 9-9 lists the output from the show ntp status command on R1, with the first line of output including a few important status items. First, it lists a status of synchronized, which confirms the NTP client has completed the process of changing its time to match the server’s time. Any router acting as an NTP client will list “unsynchronized” in that first line until the NTP synchronization process completes with at least one server. It also confirms the IP address of the server—this device’s reference clock—with the IP address configured in Example 9-8 (172.16.2.2). +Example 9-9 Verifying NTP Client Status on R1 + +R1# show ntp status +Clock is synchronized, stratum 4, reference is 172.16.2.2 +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**21 +ntp uptime is 1553800 (1/100 of seconds), resolution is 4000 +reference time is DA5E7147.56CADEA7 (19:54:31.339 EST Thu Feb 4 2016) +clock offset is 0.0986 msec, root delay is 2.46 msec +root dispersion is 22.19 msec, peer dispersion is 5.33 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000000009 s/s +system poll interval is 64, last update was 530 sec ago. + +Next, look at the show ntp associations command output from both R1 and R2 as shown in Example 9-10. This command lists all the NTP servers that the local device can attempt to use, with status information about the association between the local device (client) and +Chapter 9: Device Management Protocols 185 + +the various NTP servers. Beginning with R1, note that it has one association (that is, relation-ship with an NTP server), based on the one ntp server 172.16.2.2 configuration command on R1. The * means that R1 has successfully contacted the server. You will see similar data from the same command output taken from router R2. +Example 9-10 Verifying NTP Client Status on R1 and R2 + +R1# show ntp associations +! This output is taken from router R1, acting in client/server mode +address ref clock st when poll reach delay offset disp +*~172.16.2.2 172.16.3.3 3 50 64 377 1.223 0.090 4.469 +* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured +R2# show ntp associations +! This output is taken from router R2, acting in client/server mode +address ref clock st when poll reach delay offset disp +*~172.16.3.3 127.127.1.1 2 49 64 377 1.220 -7.758 3.695 +* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured + + +NTP Reference Clock and Stratum +NTP servers must learn the time from some device. For devices acting in NTP client/server mode, the device uses the NTP client function to learn the time. However, devices that act solely as an NTP server get their time from either internal device hardware or from some external clock using mechanisms other than NTP. + +For instance, when configured with the ntp master command, a Cisco router/switch uses its internal device hardware to determine the time. All computers, networking devices includ-ed, need some means to keep time for a myriad of reasons, so they include both hardware components and software processes to keep time even over periods in which the device loses power. +Additionally, NTP servers and clients use a number to show the perceived accuracy of their reference clock data based on stratum level. The lower the stratum level, the more accurate the reference clock is considered to be. An NTP server that uses its internal hardware or external reference clock sets its own stratum level. Then, an NTP client adds 1 to the stra-tum level it learns from its NTP server, so that the stratum level increases the more hops away from the original clock source. + +For instance, back in Figure 9-5, you can see the NTP primary server (R3) with a stratum of 2. R2, which references R3, adds 1 so it has a stratum of 3. R1 uses R2 as its NTP server, so R1 adds 1 to have a stratum of 4. These increasing stratum levels allow devices to refer to several NTP servers and then use time information from the best NTP server, best being the server with the lowest stratum level. + +Routers and switches use the default stratum level of 8 for their internal reference clock based on the default setting of 8 for the stratum level in the ntp master [stratum-level] command. The command allows you to set a value from 1 through 15; in Example 9-8, the ntp master 2 command set router R3’s stratum level to 2. + + + + + + + + + + + + +9 +186 CCNA 200-301 Official Cert Guide, Volume 2 + + +NOTE NTP considers 15 to be the highest useful stratum level, so any devices that calcu-late their stratum as 16 consider the time data unusable and do not trust the time. So, avoid setting higher stratum values on the ntp master command. + +To see the evidence, refer back to Example 9-10, which shows two commands based on the same configuration in Example 9-8 and Figure 9-5. The output highlights details about ref-erence clocks and stratum levels, as follows: + +R1: Per the configured ntp server 172.16.2.2 command, the show command lists the same address (which is router R2’s address). The ref clock (reference clock) and st (stra-tum) fields represent R2’s reference clock as 172.16.3.3—in other words, R2’s NTP server, which is R3 in this case. The st field value of 3 shows R2’s stratum. +R2: Per the configured ntp server 172.16.3.3 command, the show command lists 172,16,3,3, which is an address on router R3. The output notes R3’s ref clock as 127.127.1.1—an indication that the server (R3) gets its clock internally. It lists R3’s st (stratum) value of 2—consistent with the configured ntp master 2 command on R3 (per Example 9-8). + +On the NTP primary server itself (R3 in this case), the output has more markers indicating the use of the internal clock. Example 9-11 shows output from R3, with a reference clock of the 127.127.1.1 loopback address, used to refer to the fact that this router gets its clock data internally. Also, in the show ntp associations command output at the bottom, note that same address, along with a reference clock value of “.LOCL.” In effect, R3, per the ntp master configuration command, has an association with its internal clock. +Example 9-11 Examining NTP Server, Reference Clock, and Stratum Data + +R3# show ntp status +Clock is synchronized, stratum 2, reference is 127.127.1.1 +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**20 +ntp uptime is 595300 (1/100 of seconds), resolution is 4000 +reference time is E0F9174C.87277EBB (16:13:32.527 daylight Sat Aug 10 2019) +clock offset is 0.0000 msec, root delay is 0.00 msec +root dispersion is 0.33 msec, peer dispersion is 0.23 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000000000 s/s +system poll interval is 16, last update was 8 sec ago. + +R3# show ntp associations +address ref clock st when poll reach delay offset disp +*~127.127.1.1 .LOCL. 1 15 16 377 0.000 0.000 0.232 +* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured + +Redundant NTP Configuration +Instead of using a networking device as the reference clock for the enterprise, you can instead reference better time sources in the Internet or purchase a purpose-built NTP server that has better clocking hardware. For instance, an enterprise could use NTP to reference NTP servers that use an atomic clock as their reference source, like the NTP primary serv-ers in Figure 9-6, which happen to be run by the US National Institute of Standards and Technology (NIST) (see tf.nist.gov). +Chapter 9: Device Management Protocols 187 + + +S1 + +Stratum 1 + +S2 +NTP Primary Servers (NIST) + + + + +Internet + + + + + + +Stratum 2 R1 NTP Client/Server R2 + + + + +Stratum 3 R101 R102 ... R198 R199 +Figure 9-6 Stratum Levels When Using an Internet-based Stratum 1 NTP Server + +NOTE While the common terms NTP server mode and NTP client/server mode are use-ful, the NTP RFCs (1305 and 5905) also use two other specific terms for similar ideas: NTP primary server and NTP secondary server. An NTP primary server acts only as a server, with a reference clock external to the device, and has a stratum level of 1, like the two NTP primary servers shown in Figure 9-6. NTP secondary servers are servers that use client/server mode as described throughout this section, relying on synchronization with some other +NTP server. 9 + +For good design, the enterprise NTP configuration ought to refer to at least two external NTP servers for redundancy. Additionally, just a few enterprise devices should refer to those external NTP servers and then act as both NTP client and server. The majority of the devices in the enterprise, like those shown at the bottom of the figure, would act as NTP clients. Example 9-12 shows the configuration on router R1 and R2 in the figure to accom-plish this design. +Example 9-12 NTP Configuration on R1, R2 per Figure 9-6 + +ntp server time-a-b-nist.gov +ntp server time-a-g.nist.gov + +In addition to referencing redundant NTP primary servers, some routers in the enterprise need to be ready to supply clock data if those NTP primary servers become unreachable. An exposure exists with the configuration in Example 9-12 because if router R1 and R2 no longer hear NTP messages from the NTP servers in the Internet they will lose their only ref-erence clock. After losing their reference clock, R1 and R2 could no longer be useful NTP servers to the rest of the enterprise. +188 CCNA 200-301 Official Cert Guide, Volume 2 + +To overcome this potential issue, the routers can also be configured with the ntp master command, resulting in this logic: + +1. Establish an association with the NTP servers per the ntp server command. +2. Establish an association with your internal clock using the ntp master stratum command. +3. Set the stratum level of the internal clock (per the ntp master {stratum-level} command) to a higher (worse) stratum level than the Internet-based NTP servers. +4. Synchronize with the best (lowest) known time source, which will be one of the Internet NTP servers in this scenario + +The logic has a few steps, but the configuration itself is simple, as shown in Example 9-13. Compared to Example 9-12, just add the ntp master command. The NTP servers used in this example have a stratum level of 1, so the use of the ntp master 7 command, with a much higher stratum, will cause routers R1 and R2 to use one of the NIST NTP servers when available and use the internal clock source only when connectivity to the NIST servers is lost. +Example 9-13 NTP Configuration on R1 and R2 to Protect Against Internet Failures + +ntp server time-a-b-nist.gov +ntp server time-a-g.nist.gov +ntp master 7 + +NTP Using a Loopback Interface for Better Availability +An NTP server will accept NTP messages arriving to any of its IPv4 addresses by default. However, the clients reference a specific IP address on the NTP server. That creates an avail-ability issue. + +For instance, consider the topology in Figure 9-7, with router R4 on the right acting as NTP server and the other routers acting as clients. R4 has three IP addresses that the clients could put in their ntp server address commands. Now consider what happens when one interface on R4 fails, but only one. No matter which of the three interfaces fails, that IP address on that interface cannot be used to send and receive packets. In that case, for any NTP clients that had referred to that specific IP address + +■ There would likely still be a route to reach R4 itself. +■ The NTP client would not be able to send packets to the configured address because that interface is down. + + +R2 1 3 +R1 2 R4 NTP server +R3 +Figure 9-7 The Availability Issue of Referencing an NTP Server’s Physical Interface IP Address +Chapter 9: Device Management Protocols 189 + +What is needed is a way to send a packet to R4, a way that is not tied to the state of any one interface. That is, as long as there is some path to send packets to R4 itself, allow NTP to keep working. The goal is to avoid the case in which a single interface failure on router R4 also causes NTP to fail. + +Cisco uses the router loopback interface to meet that exact need. Loopback interfaces are virtual interfaces internal to Cisco IOS, created via the command interface loopback number, where the number is an integer. Once configured, that loopback interface exists inside that router and is not tied to any physical interface. A loopback interface can be +assigned an IP address, routing protocols can advertise about the subnet, and you can ping/ traceroute to that address. It acts like other physical interfaces in many ways, but once configured, it remains in an up/up state as long as + +■ The router remains up. +■ You do not issue a shutdown command on that loopback interface. + + +NOTE This discussion is not about the special IPv4 loopback address 127.0.0.1. The loop-back interface discussed in this section is a different concept altogether. + +Example 9-14 shows the small configuration change that adds the loopback interface to the NTP configuration, which is based on Figure 9-5. In this case, the Example 9-14 configu-ration slightly changes the configuration shown earlier in Example 9-8. R1, still acting as client, now points to R2’s new loopback interface IP address of 172.16.9.9. R2 now has con-figuration for a new loopback interface (loopback 0). R2 also has a command that tells it to use that loopback 0 interface’s IP address as the source address when sending NTP packets. +Example 9-14 NTP Client/Server Configuration on R1 and R2 Using a Loopback Interface + +! Configuration on R1, a client +ntp server 172.16.9.9 9 ! Configuration on R2 for its server function +interface loopback 0 +ip address 172.16.9.9 255.255.255.0 +! +ntp master 4 +ntp source loopback 0 +! Verification on router R2 +R2# show interfaces loopback 0 +Loopback0 is up, line protocol is up +Hardware is Loopback +Internet address is 172.16.9.9/24 +! lines omitted for brevity + +Loopback interfaces have a wide range of uses across IOS features. They are mentioned here with NTP because NTP is a feature that can benefit from using loopback interfaces. (As a reminder, OSPF happens to use loopback interfaces with OSPF configuration for a completely different purpose.) +190 CCNA 200-301 Official Cert Guide, Volume 2 + +Analyzing Topology Using CDP and LLDP +The first two major sections of this chapter showed two features—syslog and NTP—that work the same way on both routers and switches. This final section shows yet another fea-ture common to both routers and switches, with two similar protocols: the Cisco Discovery Protocol (CDP) and the Link Layer Discovery Protocol (LLDP). This section focuses on CDP, followed by LLDP. + +Examining Information Learned by CDP +CDP discovers basic information about neighboring routers and switches without needing to know the passwords for the neighboring devices. To discover information, routers and switches send CDP messages out each of their interfaces. The messages essentially announce information about the device that sent the CDP message. Devices that support CDP learn information about others by listening for the advertisements sent by other devices. + +CDP discovers several useful details from the neighboring Cisco devices: + +■ Device identifier: Typically the host name +■ Address list: Network and data-link addresses +■ Port identifier: The interface on the remote router or switch on the other end of the link that sent the CDP advertisement +■ Capabilities list: Information on what type of device it is (for example, a router or a switch) +■ Platform: The model and OS level running on the device + +CDP plays two general roles: to provide information to the devices to support some func-tion and to provide information to the network engineers that manage the devices. For example, Cisco IP Phones use CDP to learn the data and voice VLAN IDs as configured on the access switch. For that second role, CDP has show commands that list information about neighboring devices, as well as information about how CDP is working. Table 9-3 describes the three show commands that list the most important CDP information. + +Table 9-3 show cdp Commands That List Information About Neighbors + +Command +show cdp neighbors [type number] +show cdp neighbors detail +show cdp entry name + +Description +Lists one summary line of information about each neighbor or just the neighbor found on a specific interface if an interface was listed +Lists one large set (approximately 15 lines) of information, one set for every neighbor +Lists the same information as the show cdp neighbors detail command, but only for the named neighbor (case sensitive) + + +NOTE Cisco routers and switches support the same CDP commands, with the same param-eters and same types of output. + +The next example shows the power of the information in CDP commands. The example uses the network shown in Figure 9-8, with Example 9-15 listing the output of several show cdp commands. +Chapter 9: Device Management Protocols 191 + +Cisco 2960XR Switches (WS-2960XR-24TS-I) + + + +SW1 Gi1/0/1 + +Fred 0200.1111.1111 + +Gi1/0/24 + + +Gi1/0/2 + +Barney 0200.2222.2222 + +Gi1/0/21 +SW2 Gi1/0/2 + +Gi0/0/1 0200.5555.5555 + + +R1 Cisco ISR1K Router Figure 9-8 Small Network Used in CDP Examples +Example 9-15 show cdp neighbors Command Examples: SW2 + +SW2# show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + +Device ID Local Intrfce Holdtme Capability Platform Port ID +SW1 Gig 1/0/21 155 S I WS-C2960X Gig 1/0/24 +R1 Gig 1/0/2 131 R S I C1111-8P Gig 0/0/1 + +Total cdp entries displayed : 2 + +The show cdp neighbors command lists one line per neighbor. (Look for the Device ID col-umn and the list that includes SW1 and R1.) Each of those two lines lists the most important topology information about each neighbor: the neighbor’s host name (Device ID), the local device’s interface, and the neighboring device’s interface (under the Port heading). + +Pay close attention to the local device’s interface and the neighboring device’s interface, 9 comparing the example to the figure. For example, SW2’s show cdp neighbors command +lists an entry for SW1, with SW2’s local interface of Gi0/2 and SW1’s interface of Gi0/1 under the heading “Port ID .” + +This command also lists the platform, identifying the specific model of the neighboring router or switch. So, even using this basic information, you could either construct a figure like Figure 9-8 or confirm that the details in the figure are correct. + +Figure 9-8 and Example 9-15 provide a good backdrop as to why devices learn about direct neighbors with CDP, but not other neighbors. First, CDP defines encapsulation that uses the data-link header, but no IP header. To ensure all devices receive a CDP message, the Ethernet header uses a multicast destination MAC address (0100.0CCC.CCCC). However, when any device that supports CDP receives a CP message, the device processes the mes-sage and then discards it, rather than forwarding it. So, for instance, when router R1 sends +a CDP message to Ethernet multicast address 0100.0CCC.CCCC, switch SW2 receives it, processes it, but does not forward it to switch SW1—so SW1 will not list router R1 as a CDP neighbor. + +Next, consider the show cdp neighbors detail command as shown in Example 9-16, again taken from switch SW2. This command lists more detail, as you might have guessed. The +192 CCNA 200-301 Official Cert Guide, Volume 2 + +detail lists the full name of the switch model (WS-2960XR-24TS-I) and the IP address con-figured on the neighboring device. You have to look closely, but the example has one long group of messages for each of the two neighbors; the example includes one comment line with gray highlight to help you find the dividing point between groups of messages. +Example 9-16 show cdp neighbors detail Command on SW2 + +SW2# show cdp neighbors detail +------------------------- +Device ID: SW1 +Entry address(es): +IP address: 1.1.1.1 +Platform: cisco WS-C2960XR-24TS-I, Capabilities: Switch IGMP +Interface: GigabitEthernet1/0/21, Port ID (outgoing port): GigabitEthernet1/0/24 +Holdtime : 144 sec + +Version : +Cisco IOS Software, C2960X Software (C2960X-UNIVERSALK9-M), Version 15.2(6)E2, RELEASE SOFTWARE (fc4) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2018 by Cisco Systems, Inc. +Compiled Thu 13-Sep-18 03:43 by prod_rel_team + +advertisement version: 2 +Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFF FFF01022501000000000000BCC4938BA180FF0000 +VTP Management Domain: 'fred' +Native VLAN: 1 +Duplex: full +Management address(es): +IP address: 1.1.1.1 + +------------------------- +Device ID: R1 +Entry address(es): +IP address: 10.12.25.5 +Platform: cisco C1111-8P, Capabilities: Router Switch IGMP +Interface: GigabitEthernet1/0/2, Port ID (outgoing port): GigabitEthernet0/0/1 +Holdtime : 151 sec + +Version : +Cisco IOS Software [Fuji], ISR Software (ARMV8EB_LINUX_IOSD-UNIVERSALK9_IAS-M), Ver-sion 16.8.1, RELEASE SOFTWARE (fc3) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2018 by Cisco Systems, Inc. +Compiled Tue 27-Mar-18 10:56 by mcpre + +advertisement version: 2 +Chapter 9: Device Management Protocols 193 + +VTP Management Domain: '' +Duplex: full +Management address(es): +IP address: 10.12.25.5 + +Total cdp entries displayed : 2 + + +NOTE The show cdp entry name command lists the exact same details shown in the out-put of the show cdp neighbors detail command, but for only the one neighbor listed in the command. + +As you can see, you can sit on one device and discover a lot of information about a neigh-boring device—a fact that actually creates a security exposure. Cisco recommends that CDP be disabled on any interface that might not have a need for CDP. For switches, any switch port connected to another switch, a router, or to an IP phone should use CDP. + +Finally, note that CDP shows information about directly connected neighbors. For instance, show cdp neighbors on SW1 would list an entry for SW2 in this case, but not R1, because R1 is not directly connected to SW1. + +Configuring and Verifying CDP +Most of the work you do with CDP relates to what CDP can tell you with show commands. However, it is an IOS feature, so you can configure CDP and use some show commands to examine the status of CDP itself. + +IOS typically enables CDP globally and on each interface by default. You can then disable CDP per interface with the no cdp enable interface subcommand and later re-enable it with the cdp enable interface subcommand. To disable and re-enable CDP globally on the device, use the no cdp run and cdp run global commands, respectively. +To examine the status of CDP itself, use the commands in Table 9-4. 9 + +Table 9-4 Commands Used to Verify CDP Operations + +Command show cdp + +show cdp interface [type number] + +show cdp traffic + +Description +States whether CDP is enabled globally and lists the default update and holdtime timers +States whether CDP is enabled on each interface, or a single interface if the interface is listed, and states update and holdtime timers on those interfaces +Lists global statistics for the number of CDP advertisements sent and received + + +Example 9-17 lists sample output from each of the commands in Table 9-4, based on switch SW2 in Figure 9-8. +194 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 9-17 show cdp Commands That Show CDP Status + +SW2# show cdp +Global CDP information: +Sending CDP packets every 60 seconds +Sending a holdtime value of 180 seconds +Sending CDPv2 advertisements is enabled + +SW2# show cdp interface GigabitEthernet1/0/2 +GigabitEthernet1/0/2 is up, line protocol is up +Encapsulation ARPA +Sending CDP packets every 60 seconds +Holdtime is 180 seconds + +SW2# show cdp traffic +CDP counters : +Total packets output: 304, Input: 305 +Hdr syntax: 0, Chksum error: 0, Encaps failed: 0 +No memory: 0, Invalid packet: 0, +CDP version 1 advertisements output: 0, Input: 0 +CDP version 2 advertisements output: 304, Input: 305 + +The first two commands in the example list two related settings about how CDP works: the send time and the hold time. CDP sends messages every 60 seconds by default, with a hold time of 180 seconds. The hold time tells the device how long to wait after no longer +hearing from a device before removing those details from the CDP tables. You can override the defaults with the cdp timer seconds and cdp holdtime seconds global commands, respectively. + +Examining Information Learned by LLDP +Cisco created the Cisco-proprietary CDP before any standard existed for a similar protocol. CDP has many benefits. As a Layer 2 protocol, sitting on top of Ethernet, it does not rely on a working Layer 3 protocol. It provides device information that can be useful in a variety of ways. Cisco had a need but did not see a standard that met the need, so Cisco made up a protocol, as has been the case many times over history with many companies and protocols. + +Link Layer Discovery Protocol (LLDP), defined in IEEE standard 802.1AB, provides a stan-dardized protocol that provides the same general features as CDP. LLDP has similar con-figuration and practically identical show commands as compared with CDP. + +The LLDP examples all use the same topology used in the CDP examples per Figure 9-8 (the same figure used in the CDP examples). Example 9-18 lists switch SW2’s LLDP neigh-bors as learned after LLDP was enabled on all devices and ports in that figure. The example highlights the items that match the similar output from the show cdp neighbors command listed at the end of the example, also from switch SW2. +Chapter 9: Device Management Protocols 195 + +Example 9-18 show lldp neighbors on SW2 with Similarities to CDP Highlighted + +SW2# show lldp neighbors +Capability codes: +(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device +(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other + + +Device ID +R1 +SW1 + +Local Intf +Gi1/0/2 +Gi1/0/21 + +Hold-time +120 +120 + +Capability +R +B + +Port ID +Gi0/0/1 +Gi1/0/24 + + +Total entries displayed: 2 + +SW2# show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + +Device ID Local Intrfce Holdtme Capability Platform Port ID +SW1 Gig 1/0/21 155 S I WS-C2960X Gig 1/0/24 +R1 Gig 1/0/2 131 R S I C1111-8P Gig 0/0/1 +Total entries displayed: 2 + +The most important take-away from the output is the consistency between CDP and LLDP in how they refer to the interfaces. Both the show cdp neighbors and show lldp neighbors commands have “local intf” (interface) and “port ID” columns. These columns refer to the local device’s interface and the neighboring device’s interface, respectively. + +However, the LLDP output in the example does differ from CDP in a few important ways: +■ LLDP uses B as the capability code for switching, referring to bridge, a term for the 9 device type that existed before switches that performed the same basic functions. +■ LLDP does not identify IGMP as a capability, while CDP does (I). +■ CDP lists the neighbor’s platform, a code that defines the device type, while LLDP does not. +■ LLDP lists capabilities with different conventions (see upcoming Example 9-19). + +The first three items in the list are relatively straightforward, but that last item in the list requires a closer look with more detail. Interestingly, CDP lists all the capabilities of the neighbor in the show cdp neighbors command output, no matter whether the device cur-rently enables all those features. LLDP instead lists the enables (configured) capabilities, rather than all supported capabilities, in the output from show lldp neighbors command. + +LLDP makes the difference in a neighbor’s total capabilities and configured capabilities with the show lldp neighbors detail and show lldp entry hostname commands. These commands provide identical detailed output, with the first command providing detail for all neighbors, and the second providing detail for the single listed neighbor. Example 9-19 shows the detail for neighbor R1. +196 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 9-19 show lldp entry r2 Command on SW2 + +SW2# show lldp entry R1 + +Capability codes: +(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device +(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other +------------------------------------------------ +Local Intf: Gi1/0/2 +Chassis id: 70ea.1a9a.d300 +Port id: Gi0/0/1 +Port Description: GigabitEthernet0/0/1 +System Name: R1 + +System Description: +Cisco IOS Software [Fuji], ISR Software (ARMV8EB_LINUX_IOSD-UNIVERSALK9_IAS-M), Version 16.8.1, RELEASE SOFTWARE (fc3) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2018 by Cisco Systems, Inc. +Compiled Tue 27-Mar-18 10:56 by mcpre +Time remaining: 100 seconds +System Capabilities: B,R +Enabled Capabilities: R +Management Addresses: +IP: 10.12.25.5 +Auto Negotiation - not supported +Physical media capabilities - not advertised +Media Attachment Unit type - not advertised +Vlan ID: - not advertised + + +Total entries displayed: 1 + +First, regarding the device capabilities, note that the LLDP command output lists two lines about the neighbor’s capabilities: + +System Capabilities: What the device can do +Enabled Capabilities: What the device does now with its current configuration + +For instance, in Example 9-19, the neighboring R1 claims the ability to perform routing and switching (codes R and B) but also claims to currently be using only its routing capability, as noted in the “enabled capabilities” line. +Also, take a moment to look at the output for the similarities to CDP. For instance, this output lists detail for neighbor, R1, which uses its local port G0/0/1, with a host name of R1. The output also notes the IOS name and version, from which an experienced person can infer the model number, but there is no explicit mention of the model. +Chapter 9: Device Management Protocols 197 + + +NOTE LLDP uses the same messaging concepts as CDP, encapsulating messages directly in data-link headers. Devices do not forward LLDP messages so that LLDP learns only +of directly connected neighbors. LLDP does use a different multicast MAC address (0180. C200.000E). + +Configuring and Verifying LLDP +LLDP uses a similar configuration model as CDP, but with a few key differences. First, Cisco devices default to disable LLDP. Additionally, LLDP separates the sending and receiv-ing of LLDP messages as separate functions. For instance, LLDP support processing receives LLDP messages on an interface so that the switch or router learns about the neighboring device while not transmitting LLDP messages to the neighboring device. To support that model, the commands include options to toggle on|off the transmission of LLDP messages separately from the processing of received messages. + +The three LLDP configuration commands are as follows: + +■ [no] lldp run: A global configuration command that sets the default mode of LLDP operation for any interface that does not have more specific LLDP subcommands (lldp transmit, lldp receive). The lldp run global command enables LLDP in both directions on those interfaces, while no lldp run disables LLDP. +■ [no] lldp transmit: An interface subcommand that defines the operation of LLDP on the interface regardless of the global [no] lldp run command. The lldp transmit interface subcommand causes the device to transmit LLDP messages, while no lldp transmit causes it to not transmit LLDP messages. +■ [no] lldp receive: An interface subcommand that defines the operation of LLDP on the interface regardless of the global [no] lldp run command. The lldp receive interface sub-command causes the device to process received LLDP messages, while no lldp receive causes it to not process received LLDP messages. +For example, consider a switch that has no LLDP configuration commands at all. Example 9 9-20 adds a configuration that first enables LLDP for all interfaces (in both directions) with +the lldp run global command. It then shows how to disable LLDP in both directions on Gi1/0/17 and how to disable LLDP in one direction on Gi1/0/18. +Example 9-20 Enabling LLDP on All Ports, Disabling on a Few Ports + +lldp run +! +interface gigabitEthernet1/0/17 +no lldp transmit +no lldp receive +! +interface gigabitEthernet1/0/18 +no lldp receive + +Example 9-21 adds another example that again begins with a switch with all default settings. In this case, the configuration does not enable LLDP for all interfaces with the lldp run command, meaning that all interfaces default to not transmit and not receive LLDP +198 CCNA 200-301 Official Cert Guide, Volume 2 + +messages. The example does show how to then enable LLDP for both directions on one interface and in one direction for a second interface. +Example 9-21 Enabling LLDP on Limited Ports, Leaving Disabled on Most + +interface gigabitEthernet1/0/19 +lldp transmit +lldp receive +! +interface gigabitEthernet1/0/20 +lldp receive + +Finally, checking LLDP status uses the exact same commands as CDP as listed in Table 9-4, other than the fact that you use the lldp keyword instead of cdp. For instance, show lldp interface lists the interfaces on which LLDP is enabled. Example 9-22 shows some examples from switch SW2 based on earlier Figure 9-8 (the same figure used in the CDP examples), with LLDP enabled in both directions on all interfaces with the cdp run global command. +Example 9-22 show lldp Commands That Show LLDP Status + +SW2# show lldp +Global LLDP Information: +Status: ACTIVE +LLDP advertisements are sent every 30 seconds +LLDP hold time advertised is 120 seconds +LLDP interface reinitialisation delay is 2 seconds + +SW2# show lldp interface g1/0/2 + +GigabitEthernet1/0/2: +Tx: enabled +Rx: enabled +Tx state: IDLE +Rx state: WAIT FOR FRAME + +SW2# show lldp traffic + +LLDP traffic statistics: +Total frames out: 259 +Total entries aged: 0 +Total frames in: 257 +Total frames received in error: 0 +Total frames discarded: 0 +Total TLVs discarded: 0 +Total TLVs unrecognized: 0 + +Also, note that like CDP, LLDP uses a send timer and hold timer for the same purposes as CDP. The example shows the default settings of 30 seconds for the send timer and 120 sec-onds for the hold timer. You can override the defaults with the lldp timer seconds and lldp holdtime seconds global commands, respectively. +Chapter 9: Device Management Protocols 199 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 9-5 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 9-5 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions Review memory tables Do labs +Review command references + +Resource Used Book, website Book, website Book, PTP Book, app +Blog +Book + + +Review All the Key Topics Table 9-6 Key Topics for Chapter 9 + +Key Topic Element +Figure 9-1 Figure 9-2 Figure 9-3 Table 9-2 List +List List +List + +Description Page Number +Logging to console and terminal 175 Logging to syslog and buffer 176 Log message levels 177 +Logging configuration commands 177 +The ntp master and ntp server commands 183 9 +Sequence for NTP client to choose a reference clock 188 Key facts about loopback interfaces 189 +Information gathered by CDP 190 + +Table 9-3 Three CDP show commands that list information about neighbors 190 List Differences between LLDP and CDP 195 List LLDP configuration commands and logic 197 + +Key Terms You Should Know +log message, syslog server, Network Time Protocol (NTP), NTP client, NTP client/server mode, NTP server, NTP synchronization, CDP, LLDP + +Command References +Tables 9-7 and 9-8 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. +200 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 9-7 Configuration Command Reference + +Command +[no] logging console + +[no] logging monitor + + +[no] logging buffered + +logging [host] ip-address | hostname +logging console level-name | level-number +logging monitor level-name | level-number +logging buffered level-name | level-number +logging trap level-name | level-number +[no] service sequence-numbers + +clock timezone name +–number +clock summertime name recurring +ntp server address | hostname + +ntp master stratum-level + +ntp source name/number + + +interface loopback number + + +[no] cdp run + +[no] cdp enable + +cdp timer seconds + +cdp holdtime seconds + +Description +Global command that enables (or disables with the no option) logging to the console device. +Global command that enables (or disables with the no option) logging to users connected to the device with SSH or Telnet. +Global command that enables (or disables with the no option) logging to an internal buffer. +Global command that enables logging to a syslog server. + +Global command that sets the log message level for console log messages. +Global command that sets the log message level for log messages sent to SSH and Telnet users. +Global command that sets the log message level for buffered log messages displayed later by the show logging command. +Global command that sets the log message level for messages sent to syslog servers. +Global command to enable or disable (with the no option) the use of sequence numbers in log messages. +Global command that names a timezone and defines the +/– offset versus UTC. +Global command that names a daylight savings time for a timezone and tells IOS to adjust the clock automatically. +Global command that configures the device as an NTP client by referring to the address or name of an NTP server. +Global command that configures the device as an NTP server and assigns its local clock stratum level. +Global command that tells NTP to use the listed interface (by name/number) for the source IP address for NTP messages. +Global command that, at first use, creates a loopback interface. At all uses, it also moves the user into interface configuration mode for that interface. +Global command that enables and disables (with the no option) CDP for the entire switch or router. +Interface subcommand to enable and disable (with the no option) CDP for a particular interface. +Global command that changes the CDP send timer (the frequency at which CDP sends messages). +Global command that changes how long CDP waits since the last received message from a neighbor before believing the neighbor has failed, removing the neighbor’s information from the CDP table. +Chapter 9: Device Management Protocols 201 + + +Command [no] lldp run + +[no] lldp transmit + +[no] lldp receive + + +lldp timer seconds + +lldp holdtime seconds + +Description +Global command to enable and disable (with the no option) LLDP for the entire switch or router. +Interface subcommand to enable and disable (with the no option) the transmission of LLDP messages on the interface. +Interface subcommand to enable and disable (with the no option) the processing of received LLDP messages on the interface. +Global command that changes the LLDP send timer (the frequency at which LLDP sends messages). +Global command that changes how long LLDP waits since the last received message from a neighbor before believing the neighbor has failed, removing the neighbor’s information from the LLDP table. + + +Table 9-8 Chapter 9 EXEC Command Reference + +Command show logging + +terminal monitor + +terminal no monitor + + +[no] debug {various} + +show clock +show ntp associations + +show ntp status +show interfaces loopback number +show cdp | lldp neighbors [type number] +show cdp | lldp neighbors detail +show cdp | lldp entry name + +show cdp | lldp + +show cdp | lldp interface [type number] +show cdp | lldp traffic + +Description +Lists the current logging configuration and lists buffered log messages at the end +For a user (SSH or Telnet) session, toggles on (terminal monitor) or off (terminal no monitor) the receipt of log messages, for that one session, if logging monitor is also configured +EXEC command to enable or disable (with the no option) one of a multitude of debug options +Lists the time-of-day and the date per the local device +Shows all NTP clients and servers with which the local device +is attempting to synchronize with NTP 9 Shows current NTP client status in detail +Shows the current status of the listed loopback interface + +Lists one summary line of information about each neighbor; optionally, lists neighbors off the listed interface +Lists one large set of information (approximately 15 lines) for every neighbor +Displays the same information as show cdp|lldp neighbors detail but only for the named neighbor +States whether CDP or LLDP is enabled globally and lists the default update and holdtime timers +States whether CDP or LDP is enabled on each interface or a single interface if the interface is listed +Displays global statistics for the number of CDP or LDP advertisements sent and received +CHAPTER 10 + + + +Network Address Translation This chapter covers the following exam topics: +4.0 IP Services +4.1 Configure and verify inside source NAT using static and pools + + +This chapter examines a very popular and very important part of both enterprise and small office/home office (SOHO) networks: Network Address Translation , or NAT. NAT helped solve a big problem with IPv4: the IPv4 address space would have been completely con-sumed by the mid-1990s. After it was consumed, the Internet could not continue to grow, which would have significantly slowed the development of the Internet. + +This chapter breaks the topics into three major sections. The first section explains the chal-lenges to the IPv4 address space caused by the Internet revolution of the 1990s. The second section explains the basic concept behind NAT, how several variations of NAT work, and how the Port Address Translation (PAT) option conserves the IPv4 address space. The final section shows how to configure NAT from the Cisco IOS Software command-line interface (CLI) and how to troubleshoot NAT. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 10-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Perspectives on IPv4 Address Scalability Network Address Translation Concepts +NAT Configuration and Troubleshooting + +Questions 1–2 +3–4 +5–7 + + +1. Which of the following summarized subnets represent routes that could have been created for CIDR’s goal to reduce the size of Internet routing tables? +a. 10.0.0.0 255.255.255.0 b. 10.1.0.0 255.255.0.0 +c. 200.1.1.0 255.255.255.0 d. 200.1.0.0 255.255.0.0 + + + + +2. Which of the following are not private addresses according to RFC 1918? (Choose two answers.) +a. 172.31.1.1 b. 172.33.1.1 c. 10.255.1.1 d. 10.1.255.1 e. 191.168.1.1 +3. With static NAT, performing translation for inside addresses only, what causes NAT table entries to be created? +a. The first packet from the inside network to the outside network b. The first packet from the outside network to the inside network c. Configuration using the ip nat inside source command +d. Configuration using the ip nat outside source command + +4. With dynamic NAT, performing translation for inside addresses only, what causes NAT table entries to be created? +a. The first packet from the inside network to the outside network b. The first packet from the outside network to the inside network c. Configuration using the ip nat inside source command +d. Configuration using the ip nat outside source command + +5. NAT has been configured to translate source addresses of packets for the inside part of the network, but only for some hosts as identified by an access control list. Which of the following commands indirectly identifies the hosts? +a. ip nat inside source list 1 pool barney +b. ip nat pool barney 200.1.1.1 200.1.1.254 netmask 255.255.255.0 c. ip nat inside +d. ip nat inside 200.1.1.1 200.1.1.2 +204 CCNA 200-301 Official Cert Guide, Volume 2 + +6. Examine the following configuration commands: interface Ethernet0/0 +ip address 10.1.1.1 255.255.255.0 +ip nat inside +interface Serial0/0 +ip address 200.1.1.249 255.255.255.252 +ip nat inside source list 1 interface Serial0/0 +access-list 1 permit 10.1.1.0 0.0.0.255 + +If the configuration is intended to enable source NAT overload, which of the follow-ing commands could be useful to complete the configuration? (Choose two answers.) +a. The ip nat outside command b. The ip nat pat command +c. The overload keyword +d. The ip nat pool command + +7. Examine the following show command output on a router configured for dynamic NAT: +-- Inside Source +access-list 1 pool fred refcount 2288 +pool fred: netmask 255.255.255.240 +start 200.1.1.1 end 200.1.1.7 +type generic, total addresses 7, allocated 7 (100%), misses 965 + +Users are complaining about not being able to reach the Internet. Which of the fol-lowing is the most likely cause? +a. The problem is not related to NAT, based on the information in the command output. +b. The NAT pool does not have enough entries to satisfy all requests. c. Standard ACL 1 cannot be used; an extended ACL must be used. +d. The command output does not supply enough information to identify the problem. + + +Foundation Topics + +Perspectives on IPv4 Address Scalability +The original design for the Internet required every organization to ask for, and receive, one or more registered classful IPv4 network numbers. The people administering the program ensured that none of the IP networks were reused. As long as every organization used only IP addresses inside its own registered network numbers, IP addresses would never be dupli-cated, and IP routing could work well. + +Connecting to the Internet using only a registered network number, or several registered network numbers, worked well for a while. In the early to mid-1990s, it became apparent that the Internet was growing so fast that all IP network numbers would be assigned by the mid-1990s! Concern arose that the available networks would be completely assigned, and some organizations would not be able to connect to the Internet. +Chapter 10: Network Address Translation 205 + +The main long-term solution to the IPv4 address scalability problem was to increase the size of the IP address. This one fact was the most compelling reason for the advent of IP version 6 (IPv6). (Version 5 was defined much earlier but was never deployed, so the next attempt was labeled as version 6.) IPv6 uses a 128-bit address, instead of the 32-bit address in IPv4. With the same or improved process of assigning unique address ranges to every organiza-tion connected to the Internet, IPv6 can easily support every organization and individual on the planet, with the number of IPv6 addresses theoretically reaching above 1038. + +Many short-term solutions to the addressing problem were suggested, but three stan-dards worked together to solve the problem. Two of the standards work closely together: Network Address Translation (NAT) and private addressing. These features together allow many organizations to use the same unregistered IPv4 network numbers internally—and still communicate well with the Internet. The third standard, classless interdomain routing (CIDR), allows ISPs to reduce the wasting of IPv4 addresses by assigning a company a sub-set of a network number rather than the entire network. CIDR also can allow Internet ser- +vice providers (ISP) to summarize routes such that multiple Class A, B, or C networks match a single route, which helps reduce the size of Internet routing tables. + +NOTE These tools have worked well. Estimates in the early 1990s predicted that the world would run out of IPv4 addresses by the mid-1990s, but IANA did not exhaust the IPv4 address space until February 2011, and ARIN (the RIR for North America) did not exhaust its supply of public IPv4 addresses until September 2015. + + +CIDR +CIDR is a global address assignment convention that defines how the Internet Assigned Numbers Authority (IANA), its member agencies, and ISPs should assign the globally unique IPv4 address space to individual organizations. + +CIDR, defined in RFC 4632, has two main goals. First, CIDR defines a way to assign public IP addresses, worldwide, to allow route aggregation or route summarization. These route summaries greatly reduce the size of routing tables in Internet routers. + +Figure 10-1 shows a typical case of CIDR route aggregation and how CIDR could be used to replace more than 65,000 routes with one route. First, imagine that ISP 1 owns Class +C networks 198.0.0.0 through 198.255.255.0—not by accident, but by purposeful and thoughtful design to make this route aggregation example possible. In other words, IANA allocated all addresses that begin with 198 to one of the five Regional Internet Registries (RIR), and that RIR assigned this entire range to one big ISP in that part of the world. + + + + + + + + + + +10 + + + +ISP2 To 198._._._ + +Customer A 198.8.3.0 /24 + + + + +ISP3 To 198._._._ + +ISP1 198.0.0.0 -198.255.255.0 + + +Customer B 198.4.2.0 /24 198.4.3.0 /24 + + + +ISP4 + +Figure 10-1 + + +To 198._._._ + +Typical Use of CIDR + +Customer C 198.1.0.0 /24 +206 CCNA 200-301 Official Cert Guide, Volume 2 + +The assignment of all addresses that begin with 198 to one ISP lets other ISPs use one route—a route for 198.0.0.0/8—to match all those addresses, forwarding packets for those addresses to ISP1. Figure 10-1 shows the ISPs on the left each with one route to +198.0.0.0/8—in other words, a route to all hosts whose IP address begins with 198. This one summary route will match packets sent to all addresses in the 65,536 Class C IP networks that begin with 198. + +The second major CIDR feature allows RIRs and ISPs to reduce waste by assigning a subset of a classful network to a single customer. For example, imagine that ISP1’s customer A needs only 10 IP addresses and that customer C needs 25 IP addresses. ISP1 does something like this: + +■ Assign customer A CIDR block 198.8.3.16/28, with 14 assignable addresses (198.8.3.17 to 198.8.3.30). +■ Assign customer B CIDR block 198.8.3.32/27, with 30 assignable addresses (198.8.3.33 to 198.8.3.62). + +These CIDR blocks act very much like a public IP network; in particular, they give each company a consecutive set of public IPv4 addresses to use. The public address assignment process has much less waste than before as well. In fact, most public address assignments for the last 20 years have been a CIDR block rather than an entire class A, B, or C network. + +Private Addressing +Some computers might never be connected to the Internet. These computers’ IP addresses could be duplicates of registered IP addresses in the Internet. When designing the IP addressing convention for such a network, an organization could pick and use any network number(s) it wanted, and all would be well. For example, you can buy a few routers, con-nect them in your office, and configure IP addresses in network 1.0.0.0, and it would work. The IP addresses 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, everything will be fine. + +When building a private network that will have no Internet connectivity, you can use IP network numbers called private internets , as defined in RFC 1918, “Address Allocation for Private Internets.” This RFC defines a set of networks that will never be assigned to any organization as a registered network number. Instead of using someone else’s registered network numbers, you can use numbers in a range that are not used by anyone else in the public Internet. Table 10-2 shows the private address space defined by RFC 1918 . + +Table 10-2 RFC 1918 Private Address Space + +Range of IP Addresses + +10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 +192.168.0.0 to 192.168.255.255 + +Network(s) + +10.0.0.0 +172.16.0.0 – 172.31.0.0 +192.168.0.0 – 192.168.255.0 + +Class of Networks +A B +C + +Number of Networks +1 16 +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. + +Answers to the “Do I Know This Already?” quiz: 1 D 2 B, E 3 C 4 A 5 A 6 A, C 7 B +Chapter 10: Network Address Translation 207 + +Table 10-3 summarizes these important features that have helped extend the life of IPv4 by decades. + +Table 10-3 Three Important Functions That Extended the Life of IPv4 + +Feature RFC(s) CIDR* 4632 + + + +NAT* 3022 + +Private 1918 Networks + +Main Benefits +Assign more-specific public IPv4 address blocks to companies than Class A, B, and C networks. + +Aggregate routes to public IPv4 addresses based on worldwide address allocation plan. +Enable approximately 65,000 TCP/UDP sessions to be supported by a single public IPv4 address. +Enable the use of NAT for enterprise Internet connections, with private addresses used inside the enterprise. + + +*CIDR and NAT may be better known for their original RFCs (1518, 1519 for CIDR; 1631 for NAT). + +Network Address Translation Concepts +NAT, defined in RFC 3022, allows a host that does not have a valid, registered, globally unique IP address to communicate with other hosts through the Internet. The hosts might be using private addresses or addresses assigned to another organization. In either case, NAT allows these addresses that are not Internet ready to continue to be used and still allows communication with hosts across the Internet. + +NAT achieves its goal by using a valid registered IP address to represent the private address to the rest of the Internet. The NAT function changes the private IP addresses to publicly registered IP addresses inside each IP packet, as shown in Figure 10-2 . + +Client NAT www.cisco.com + +Private Internet + +10.1.1.1 +Source +10.1.1.1 + + +Destination +170.1.1.1 ........ + + +Source +200.1.1.1 + + +Destination +170.1.1.1 + + +170.1.1.1 + +........ 10 + +NAT Changes + +Source Destination Source Destination +170.1.1.1 10.1.1.1 ........ 170.1.1.1 200.1.1.1 ........ + + +Figure 10-2 NAT IP Address Swapping: Private Addressing + +Notice that the router, performing NAT, changes the packet’s source IP address when the packet leaves the private organization. The router performing NAT also changes the des-tination address in each packet that is forwarded back into the private network. (Network 200.1.1.0 is a registered network in Figure 10-2.) The NAT feature, configured in the router labeled NAT, performs the translation. +208 CCNA 200-301 Official Cert Guide, Volume 2 + +This book discusses source NAT, which is the type of NAT that allows enterprises to use private addresses and still communicate with hosts in the Internet. Within source NAT, Cisco IOS supports several different ways to configure NAT. The next few pages cover the concepts behind several of these variations. + +Static NAT +Static NAT works just like the example shown in Figure 10-2, but with the IP addresses statically mapped to each other. To help you understand the implications of static NAT and to explain several key terms, Figure 10-3 shows a similar example with more information. + + +10.1.1.1 + + +10.1.1.2 + + + +SA = 10.1.1.1 + + + +NAT + + + + + +Static NAT Table + + +Internet + + + + +SA = 200.1.1.1 + +Server + + + +170.1.1.1 + + + +Private Address +10.1.1.1 10.1.1.2 + +Public Address +200.1.1.1 200.1.1.2 + + +Legend +SA: Source Address + +Figure 10-3 Static NAT Showing Inside Local and Global Addresses + +First, the concepts: The company’s ISP has assigned it registered network 200.1.1.0. Therefore, the NAT router must make the private IP addresses look like they are in network 200.1.1.0. To do so, the NAT router changes the source IP addresses in the packets going from left to right in the figure. + +In this example, the NAT router changes the source address (SA in the figure) of 10.1.1.1 to 200.1.1.1. With static NAT, the NAT router simply configures a one-to-one mapping between the private address and the registered address that is used on its behalf. The NAT router has statically configured a mapping between private address 10.1.1.1 and public, reg-istered address 200.1.1.1. + +Supporting a second IP host with static NAT requires a second static one-to-one mapping using a second IP address in the public address range. For example, to support 10.1.1.2, the router statically maps 10.1.1.2 to 200.1.1.2. Because the enterprise has a single registered Class C network, it can support at most 254 private IP addresses with NAT, with the usual two reserved numbers (the network number and network broadcast address). + +The terminology used with NAT, particularly with configuration, can be a little confus-ing. Notice in Figure 10-3 that the NAT table lists the private IP addresses as “private” and the public, registered addresses from network 200.1.1.0 as “public.” Cisco uses the term inside local for the private IP addresses in this example and inside global for the public IP addresses. +Chapter 10: Network Address Translation 209 + +Using NAT terminology, the enterprise network that uses private addresses, and therefore needs NAT, is the “inside” part of the network. The Internet side of the NAT function is the “outside” part of the network. A host that needs NAT (such as 10.1.1.1 in the example) +has the IP address it uses inside the network, and it needs an IP address to represent it in the outside network. So, because the host essentially needs two different addresses to represent it, you need two terms. Cisco calls the private IP address used in the inside network the inside local address and the address used to represent the host to the rest of the Internet the inside global address. Figure 10-4 repeats the same example, with some of the terminol-ogy shown. + +Inside Outside +10.1.1.1 Server +Internet NAT +10.1.1.2 170.1.1.1 + + +SA = 10.1.1.1 + +Inside Local +10.1.1.1 10.1.1.2 + +SA = 200.1.1.1 + +Inside Global +200.1.1.1 200.1.1.2 + + + + +Legend +SA: Source Address + +Figure 10-4 Static NAT Terminology + + +Source NAT changes only the IP address of inside hosts. Therefore, the current NAT table shown in Figure 10-4 shows the inside local and corresponding inside global registered addresses. The term inside local refers to the address used for the host inside the enterprise, the address used locally versus globally, which means in the enterprise instead of the global Internet. Conversely, the term inside global still refers to an address used for the host inside the enterprise, but it is the global address used while the packet flows through the Internet. + +Note that the NAT feature called destination NAT, not covered in this book, uses similar terms outside local and outside global. However, with source NAT, one of the terms, out-side global, is used. This term refers to the host that resides outside the enterprise. Because source NAT does not change that address, the term outside global applies at all times. + +Table 10-4 summarizes these four similar terms and refers to the IPv4 addresses used as samples in the last three figures as examples. + + + + + + + + + + +10 +210 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 10-4 NAT Addressing Terms + +Term + +Inside local + + + + + +Inside global + + + + + +Outside global + + + +Outside local + +Values in Figures +10.1.1.1 + + + + + + +200.1.1.1 + + + + + + +170.1.1.1 + + + + +— + +Meaning + +Inside: Refers to the permanent location of the host, from the enterprise’s perspective: it is inside the enterprise. +Local: Means not global; that is, local. It is the address used for that host while the packet flows in the local enterprise rather than the global Internet. +Alternative: Think of it as inside private, because this address is typically a private address. +Inside: Refers to the permanent location of the host, from the enterprise’s perspective. +Global: Means global as in the global Internet. It is the address used for that host while the packet flows in the Internet. +Alternative: Think of it as inside public, because the address is typically a public IPv4 address. +With source NAT, the one address used by the host that resides outside the enterprise, which NAT does not change, so there is no need for a contrasting term. +Alternative: Think of it as outside public, because the address is typically a public IPv4 address. +This term is not used with source NAT. With destination NAT, the address would represent a host that resides outside the enterprise, but the address used to represent that host as packets pass through the local enterprise. + + +Dynamic NAT +Dynamic NAT has some similarities and differences compared to static NAT. Like static NAT, the NAT router creates a one-to-one mapping between an inside local and inside global address, and changes the IP addresses in packets as they exit and enter the inside network. However, the mapping of an inside local address to an inside global address happens dynamically. + +Dynamic NAT sets up a pool of possible inside global addresses and defines matching crite-ria to determine which inside local IP addresses should be translated with NAT. For exam-ple, in Figure 10-5, a pool of five inside global IP addresses has been established: 200.1.1.1 through 200.1.1.5. NAT has also been configured to translate any inside local addresses that start with 10.1.1. +Chapter 10: Network Address Translation 211 + +1 SA = 10.1.1.1 4 SA = 200.1.1.1 + +Inside Outside +10.1.1.1 Server +NAT Internet NAT +10.1.1.2 170.1.1.1 + + + + +Criteria for NAT: 10.1.1.__ +2 + +NAT Table Before First Packet Inside Local Inside Global + + +NAT Table After First Packet 3 Inside Local Inside Global 10.1.1.1 200.1.1.1 + + + +NAT Pool: 200.1.1.1 200.1.1.2 200.1.1.3 200.1.1.4 200.1.1.5 + +Figure 10-5 Dynamic NAT + +The numbers 1, 2, 3, and 4 in the figure refer to the following sequence of events: + +1. Host 10.1.1.1 sends its first packet to the server at 170.1.1.1. +2. As the packet enters the NAT router, the router applies some matching logic to decide whether the packet should have NAT applied. Because the logic has been con-figured to match source IP addresses that begin with 10.1.1, the router adds an entry in the NAT table for 10.1.1.1 as an inside local address. +3. The NAT router needs to allocate an IP address from the pool of valid inside global addresses. It picks the first one available (200.1.1.1, in this case) and adds it to the NAT table to complete the entry. +4. The NAT router translates the source IP address and forwards the packet. + +The dynamic entry stays in the table as long as traffic flows occasionally. You can config-ure a timeout value that defines how long the router should wait, having not translated any packets with that address, before removing the dynamic entry. You can also manually clear +the dynamic entries from the table using the clear ip nat translation * command. 10 +NAT can be configured with more IP addresses in the inside local address list than in the inside global address pool. The router allocates addresses from the pool until all are allo-cated. If a new packet arrives from yet another inside host, and it needs a NAT entry, but all the pooled IP addresses are in use, the router simply discards the packet. The user must try again until a NAT entry times out, at which point the NAT function works for the next host that sends a packet. Essentially, the inside global pool of addresses needs to be as large as the maximum number of concurrent hosts that need to use the Internet at the same time— unless you use PAT, as is explained in the next section. + +Overloading NAT with Port Address Translation +Some networks need to have most, if not all, IP hosts reach the Internet. If that network uses private IP addresses, the NAT router needs a very large set of registered IP addresses. With static NAT, for each private IP host that needs Internet access, you need a publicly registered IP address, completely defeating the goal of reducing the number of public IPv4 +212 CCNA 200-301 Official Cert Guide, Volume 2 + +addresses needed for that organization. Dynamic NAT lessens the problem to some degree, because every single host in an internetwork should seldom need to communicate with the Internet at the same time. However, if a large percentage of the IP hosts in a network will need Internet access throughout that company’s normal business hours, NAT still requires a large number of registered IP addresses, again failing to reduce IPv4 address consumption. + +The NAT Overload feature, also called Port Address Translation (PAT), solves this problem. Overloading allows NAT to scale to support many clients with only a few public IP addresses. + +The key to understanding how overloading works is to recall how hosts use TCP and User Datagram Protocol (UDP) ports. To see why, first consider the idea of three separate TCP connections to a web server, from three different hosts, as shown in Figure 10-6. + + +10.1.1.1 + + +10.1.1.2 + + +10.1.1.3 + + +10.1.1.1, Port 49724 + +10.1.1.2, Port 49724 + +10.1.1.3, Port 49733 + + +170.1.1.1, Port 80 + +170.1.1.1, Port 80 + +170.1.1.1, Port 80 + + +Server + + + +170.1.1.1 + + +Figure 10-6 Three TCP Connections from Three PCs + +Next, compare those three TCP connections in Figure 10-6 to three similar TCP connec-tions, now with all three TCP connections from one client, as shown in Figure 10-7. The server does realize a difference because the server sees the IP address and TCP port number used by the clients in both figures. However, the server really does not care whether the TCP connections come from different hosts or the same host; the server just sends and receives data over each connection. + + + + +200.1.1.2 + + +Figure 10-7 + +200.1.1.2, Port 49724 + +200.1.1.2, Port 49725 + +200.1.1.2, Port 49726 + +Three TCP Connections from One PC + + +170.1.1.1, Port 80 + +170.1.1.1, Port 80 + +170.1.1.1, Port 80 + + +Server + + + +170.1.1.1 + + +NAT takes advantage of the fact that, from a transport layer perspective, the server doesn’t care whether it has one connection each to three different hosts or three connections to +a single host IP address. NAT overload (PAT) translates not only the address, but the port number when necessary, making what looks like many TCP or UDP flows from different hosts look like the same number of flows from one host. Figure 10-8 outlines the logic. +Chapter 10: Network Address Translation 213 + + +10.1.1.1 +10.1.1.1, Port 49724 + +10.1.1.2 +10.1.1.2, Port 49724 + + +200.1.1.2, Port 49724 + + +200.1.1.2, Port 49725 +NAT + + +170.1.1.1, Port 80 + +Server +170.1.1.1, Port 80 + + + +10.1.1.3 +10.1.1.3, Port 49733 + + +Inside Local 10.1.1.1: 49724 10.1.1.2: 49724 +10.1.1.3: 49733 + + +200.1.1.2, Port 49726 + + +Inside Global 200.1.1.2: 49724 200.1.1.2: 49725 +200.1.1.2: 49726 + + +170.1.1.1 +170.1.1.1, Port 80 + +Dynamic NAT Table, With Overloading Figure 10-8 NAT Overload (PAT) +When PAT creates the dynamic mapping, it selects not only an inside global IP address but also a unique port number to use with that address. The NAT router keeps a NAT table entry for every unique combination of inside local IP address and port, with translation +to the inside global address and a unique port number associated with the inside global address. And because the port number field has 16 bits, NAT overload can use more than 65,000 port numbers, allowing it to scale well without needing many registered IP address-es—in many cases, needing only one inside global IP address. +Of the three types of NAT covered in this chapter so far, PAT is by far the most popular option. Static NAT and Dynamic NAT both require a one-to-one mapping from the inside local to the inside global address. PAT significantly reduces the number of required regis-tered IP addresses compared to these other NAT alternatives. + +NAT Configuration and Troubleshooting +The following sections describe how to configure the three most common variations of +NAT: static NAT, dynamic NAT, and PAT, along with the show and debug commands used +to troubleshoot NAT. 10 + +Static NAT Configuration +Static NAT configuration requires only a few configuration steps. Each static mapping between a local (private) address and a global (public) address must be configured. In addi-tion, because NAT may be used on a subset of interfaces, the router must be told on which interfaces it should use NAT. Those same interface subcommands tell NAT whether the interface is inside or outside. The specific steps are as follows: + +Config Checklist + +Step 1. Use the ip nat inside command in interface configuration mode to configure interfaces to be in the inside part of the NAT design. +Step 2. Use the ip nat outside command in interface configuration mode to configure interfaces to be in the outside part of the NAT design. +Step 3. Use the ip nat inside source static inside-local inside-global command in global configuration mode to configure the static mappings. +214 CCNA 200-301 Official Cert Guide, Volume 2 + +Figure 10-9 shows the familiar network used in the description of static NAT earlier in this chapter, which is also used for the first several configuration examples. In Figure 10-9, you can see that Certskills has obtained Class C network 200.1.1.0 as a registered network num-ber. That entire network, with mask 255.255.255.0, is configured on the serial link between Certskills and the Internet. With a point-to-point serial link, only two of the 254 valid IP addresses in that network are consumed, leaving 252 addresses. + + +Certskills +10.1.1.1 + +200.1.1.251 +200.1.1.252 +Server + + +G0/0 NAT S0/0/0 R1 Internet R2 +170.1.1.1 + + +10.1.1.2 +Inside Static NAT Configuration + + +Outside + + + +Inside Local 10.1.1.1 10.1.1.2 + +Inside Global 200.1.1.1 200.1.1.2 + +Figure 10-9 Sample Network for NAT Examples, with Public Class C 200.1.1.0/24 + +When planning a NAT configuration, you must find some IP addresses to use as inside global IP addresses. Because these addresses must be part of some registered IP address range, it is common to use the extra addresses in the subnet connecting the enterprise to the Internet—for example, the extra 252 IP addresses in network 200.1.1.0 in this case. The router can also be configured with a loopback interface and assigned an IP address that is part of a globally unique range of registered IP addresses. + +Example 10-1 lists the NAT configuration, using 200.1.1.1 and 200.1.1.2 for the two static NAT mappings. +Example 10-1 Static NAT Configuration + +NAT# show running-config +! +! Lines omitted for brevity +! +interface GigabitEthernet0/0 +ip address 10.1.1.3 255.255.255.0 +ip nat inside +! +interface Serial0/0/0 +ip address 200.1.1.251 255.255.255.0 +ip nat outside +! +ip nat inside source static 10.1.1.2 200.1.1.2 +ip nat inside source static 10.1.1.1 200.1.1.1 + +NAT# show ip nat translations +Pro Inside global Inside local Outside local Outside global +Chapter 10: Network Address Translation 215 + + +--- 200.1.1.1 +--- 200.1.1.2 + +10.1.1.1 --- --- +10.1.1.2 --- --- + + +NAT# show ip nat statistics +Total active translations: 2 (2 static, 0 dynamic; 0 extended) +Outside interfaces: +Serial0/0/0 +Inside interfaces: +GigabitEthernet0/0 +Hits: 100 Misses: 0 +Expired translations: 0 +Dynamic mappings: + + +The static mappings are created using the ip nat inside source static command. The inside keyword means that NAT translates addresses for hosts on the inside part of the network. The source keyword means that NAT translates the source IP address of packets coming into its inside interfaces. The static keyword means that the parameters define a static entry, which should never be removed from the NAT table because of timeout. Because the design calls for two hosts—10.1.1.1 and 10.1.1.2—to have Internet access, two ip nat inside com-mands are needed. + +After creating the static NAT entries, the router needs to know which interfaces are “inside” and which are “outside.” The ip nat inside and ip nat outside interface subcommands iden-tify each interface appropriately. +A couple of show commands list the most important information about NAT. The show ip nat translations command lists the two static NAT entries created in the configuration. The show ip nat statistics command lists statistics, listing things such as the number of currently active translation table entries. The statistics also include the number of hits, which incre-ments for every packet for which NAT must translate addresses. + +Dynamic NAT Configuration +As you might imagine, dynamic NAT configuration differs in some ways from static NAT, but it has some similarities as well. Dynamic NAT still requires that each interface be iden-tified as either an inside or outside interface, and of course static mapping is no longer required. Dynamic NAT uses an access control list (ACL) to identify which inside local (pri-vate) IP addresses need to have their addresses translated, and it defines a pool of registered public IP addresses to allocate. The specific steps are as follows: + + + + + + + + + + + + + + + + + + + +10 + + + +Config Checklist + +Step 1. Use the ip nat inside command in interface configuration mode to configure interfaces to be in the inside part of the NAT design (just like with static NAT). +Step 2. Use the ip nat outside command in interface configuration mode to config-ure interfaces to be in the outside part of the NAT design (just like with static NAT). +Step 3. Configure an ACL that matches the packets entering inside interfaces for which NAT should be performed. +Step 4. Use the ip nat pool name first-address last-address netmask subnet-mask command in global configuration mode to configure the pool of public regis-tered IP addresses. +216 CCNA 200-301 Official Cert Guide, Volume 2 + +Step 5. Use the ip nat inside source list acl-number pool pool-name command in global configuration mode to enable dynamic NAT. Note the command refer-ences the ACL (step 3) and pool (step 4) per previous steps. + +The next example shows a sample dynamic NAT configuration using the same network topology as the previous example (see Figure 10-9). In this case, the same two inside local addresses—10.1.1.1 and 10.1.1.2—need translation. However, unlike the previous static NAT example, the configuration in Example 10-2 places the public IP addresses (200.1.1.1 and 200.1.1.2) into a pool of dynamically assignable inside global addresses. +Example 10-2 Dynamic NAT Configuration + +NAT# show running-config +! +! Lines omitted for brevity +! +interface GigabitEthernet0/0 +ip address 10.1.1.3 255.255.255.0 +ip nat inside +! +interface Serial0/0/0 +ip address 200.1.1.251 255.255.255.0 +ip nat outside +! +ip nat pool fred 200.1.1.1 200.1.1.2 netmask 255.255.255.252 +ip nat inside source list 1 pool fred +! +access-list 1 permit 10.1.1.2 +access-list 1 permit 10.1.1.1 + +Dynamic NAT configures the pool of public (global) addresses with the ip nat pool com-mand listing the first and last numbers in an inclusive range of inside global addresses. For example, if the pool needed 10 addresses, the command might have listed 200.1.1.1 and 200.1.1.10, which means that NAT can use 200.1.1.1 through 200.1.1.10. + +Dynamic NAT also performs a verification check on the ip nat pool command with the required netmask parameter. If the address range would not be in the same subnet, assum-ing the configured netmask was used on the addresses in the configured range, then IOS will reject the ip nat pool command. For example, as configured with the low end of 200.1.1.1, high end of 200.1.1.2, and a mask of 255.255.255.252, IOS would use the follow-ing checks, to ensure that both calculations put 200.1.1.1 and 200.1.1.2 in the same subnet: +■ 200.1.1.1 with mask 255.255.255.252 implies subnet 200.1.1.0, broadcast address 200.1.1.3. ■ 200.1.1.2 with mask 255.255.255.252 implies subnet 200.1.1.0, broadcast address 200.1.1.3. + +If the command had instead showed low and high end values of 200.1.1.1 and 200.1.1.6, again with mask 255.255.255.252, IOS would reject the command. IOS would do the math spelled out in the following list, realizing that the numbers were in different subnets: + +■ 200.1.1.1 with mask 255.255.255.252 implies subnet 200.1.1.0, broadcast address 200.1.1.3. ■ 200.1.1.6 with mask 255.255.255.252 implies subnet 200.1.1.4, broadcast address 200.1.1.7. +Chapter 10: Network Address Translation 217 + +One other big difference between the dynamic NAT and static NAT configuration in Example 10-1 has to do with two options in the ip nat inside source command. The dynamic NAT version of this command refers to the name of the NAT pool it wants to use for inside global addresses—in this case, fred. It also refers to an IP ACL, which defines the matching logic for inside local IP addresses. So, the logic for the ip nat inside source list 1 pool fred command in this example is as follows: + +Create NAT table entries that map between hosts matched by ACL 1, for packets enter-ing any inside interface, allocating an inside global address from the pool called fred. + +Dynamic NAT Verification +Examples 10-3 and 10-4 show the evidence that dynamic NAT begins with no NAT table entries, but the router reacts after user traffic correctly drives the NAT function. +Example 10-3 shows the output of the show ip nat translations and show ip nat statistics commands before any users generate traffic that makes NAT do some work. The show ip nat translations command, which lists the NAT table entries, lists a blank line; the show ip nat statistics command, which shows how many times NAT has created a NAT table entry, shows 0 active translations. +Example 10-3 Dynamic NAT Verifications Before Generating Traffic + +! The next command lists one empty line because no entries have been dynamically +! created yet. +NAT# show ip nat translations + + +NAT# show ip nat statistics +Total active translations: 0 (0 static, 0 dynamic; 0 extended) +Peak translations: 8, occurred 00:02:44 ago +Outside interfaces: +Serial0/0/0 +Inside interfaces: +GigabitEthernet0/0 +Hits: 0 Misses: 0 +CEF Translated packets: 0, CEF Punted packets: 0 +Expired translations: 0 +Dynamic mappings: +-- Inside Source +[id 1] access-list 1 pool fred refcount 0 +pool fred: netmask 255.255.255.252 +start 200.1.1.1 end 200.1.1.2 +type generic, total addresses 2, allocated 0 (0%), misses 0 + + + + + + + + + + +10 + + +Total doors: 0 +Appl doors: 0 +Normal doors: 0 +Queued Packets: 0 + +The show ip nat statistics command at the end of the example lists some particularly interesting troubleshooting information with two different counters labeled “misses,” as +218 CCNA 200-301 Official Cert Guide, Volume 2 + +highlighted in the example. The first occurrence of this counter counts the number of times a new packet comes along, needing a NAT entry, and not finding one. At that point, dynamic NAT reacts and builds an entry. The second misses counter toward the end of the command output lists the number of misses in the pool. This counter increments only when dynamic NAT tries to allocate a new NAT table entry and finds no available addresses, +so the packet cannot be translated—probably resulting in an end user not getting to the application. + +Next, Example 10-4 updates the output of both commands after the user of the host at 10.1.1.1 telnets to host 170.1.1.1. +Example 10-4 Dynamic NAT Verifications After Generating Traffic + +NAT# show ip nat translations + +Pro Inside global +--- 200.1.1.1 + +Inside local +10.1.1.1 + +Outside local +--- + +Outside global +--- + + +NAT# show ip nat statistics +Total active translations: 1 (0 static, 1 dynamic; 0 extended) +Peak translations: 11, occurred 00:04:32 ago +Outside interfaces: +Serial0/0/0 +Inside interfaces: +GigabitEthernet0/0 +Hits: 69 Misses: 1 +Expired translations: 0 +Dynamic mappings: +-- Inside Source +access-list 1 pool fred refcount 1 +[eml fred: netmask 255.255.255.252 +start 200.1.1.1 end 200.1.1.2 +type generic, total addresses 2, allocated 1 (50%), misses 0 + +The example begins with host 10.1.1.1 telnetting to 170.1.1.1 (not shown), with the NAT router creating a NAT entry. The NAT table shows a single entry, mapping 10.1.1.1 to 200.1.1.1. And, the first line in the output of the show ip nat statistics command lists a counter for 1 active translation, as shown in the NAT table at the top of the example. + +Take an extra moment to consider the highlighted line, where the show ip nat statistics command lists 1 miss and 69 hits. The first miss counter, now at 1, means that one packet arrived that needed NAT, but there was no NAT table entry. NAT reacted and added a NAT table entry, so the hit counter of 69 means that the next 69 packets used the newly added NAT table entry. The second misses counter, still at 0, did not increment because the NAT pool had enough available inside global IP addresses to use to allocate the new NAT table entry. Also note that the last line lists statistics on the number of pool members allocated (1) and the percentage of the pool currently in use (50%). + +The dynamic NAT table entries time out after a period of inactivity, putting those inside global addresses back in the pool for future use. Example 10-5 shows a sequence in which two different hosts make use of inside global address 200.1.1.1. Host 10.1.1.1 uses inside global address 200.1.1.1 at the beginning of the example. Then, instead of just waiting on +Chapter 10: Network Address Translation 219 + +the NAT entry to time out, the example clears the NAT table entry with the clear ip nat translation * command. At that point, the user at 10.1.1.2 telnets to 170.1.1.1, and the new NAT table entry appears, using the same 200.1.1.1 inside global address. +Example 10-5 Example of Reuse of a Dynamic Inside Global IP Address + +! Host 10.1.1.1 currently uses inside global 200.1.1.1 +NAT# show ip nat translations + +Pro Inside global +--- 200.1.1.1 + +Inside local +10.1.1.1 + +Outside local +--- + +Outside global +--- + +NAT# clear ip nat translation * + +! +! telnet from 10.1.1.2 to 170.1.1.1 happened next; not shown +! +! Now host 10.1.1.2 uses inside global 200.1.1.1 + +NAT# show ip nat translations + +Pro Inside global +--- 200.1.1.1 +! + +Inside local +10.1.1.2 + +Outside local +--- + +Outside global +--- + +! Telnet from 10.1.1.1 to 170.1.1.1 happened next; not shown +! +NAT# debug ip nat +IP NAT debugging is on + +Oct 20 19:23:03.263: NAT*: s=10.1.1.1->200.1.1.2, d=170.1.1.1 [348] +Oct 20 19:23:03.267: NAT*: s=170.1.1.1, d=200.1.1.2->10.1.1.1 [348] +Oct 20 19:23:03.464: NAT*: s=10.1.1.1->200.1.1.2, d=170.1.1.1 [349] +Oct 20 19:23:03.568: NAT*: s=170.1.1.1, d=200.1.1.2->10.1.1.1 [349] + +Finally, at the end of Example 10-5, you see that host 10.1.1.1 has telnetted to another +host in the Internet, plus the output from the debug ip nat command. This debug command +causes the router to issue a message every time a packet has its address translated for NAT. 10 You generate the output results by entering a few lines from the Telnet connection from +10.1.1.1 to 170.1.1.1. The debug output tells you that host 10.1.1.1 now uses inside global address 200.1.1.2 for this new connection. + +NAT Overload (PAT) Configuration +The static and dynamic NAT configurations matter, but the NAT overload (PAT) configura-tion in this section matters more. This is the feature that saves public IPv4 addresses and prolonged IPv4’s life. + +NAT overload, as mentioned earlier, allows NAT to support many inside local IP addresses with only one or a few inside global IP addresses. By essentially translating the private IP address and port number to a single inside global address, but with a unique port number, NAT can support many (more than 65,000) private hosts with only a single public, global address. +220 CCNA 200-301 Official Cert Guide, Volume 2 + +Two variations of PAT configuration exist in IOS. If PAT uses a pool of inside global addresses, the configuration looks exactly like dynamic NAT, except the ip nat inside source list global command has an overload keyword added to the end. If PAT just needs to use one inside global IP address, the router can use one of its interface IP addresses. Because NAT can support over 65,000 concurrent flows with a single inside global address, a single public IP address can support an entire organization’s NAT needs. + +The following statement details the configuration difference between NAT overload and 1:1 NAT when using a NAT pool: + +Use the same steps for configuring dynamic NAT, as outlined in the previous section, but include the overload keyword at the end of the ip nat inside source list global command. +The following checklist details the configuration when using an interface IP address as the sole inside global IP address: + +Config Checklist + +Step 1. As with dynamic and static NAT, configure the ip nat inside interface subcom-mand to identify inside interfaces. +Step 2. As with dynamic and static NAT, configure the ip nat outside interface sub-command to identify outside interfaces. +Step 3. As with dynamic NAT, configure an ACL that matches the packets entering inside interfaces. +Step 4. Configure the ip nat inside source list acl-number interface type/number overload global configuration command, referring to the ACL created in step 3 +and to the interface whose IP address will be used for translations. + + +Example 10-2 demonstrated a dynamic NAT configuration. To convert it to a PAT configu-ration, you would use the ip nat inside source list 1 pool fred overload command instead, simply adding the overload keyword. + +The next example shows PAT configuration using a single interface IP address. Figure +10-10 shows the same familiar network, with a few changes. In this case, the ISP has given Certskills a subset of network 200.1.1.0: CIDR subnet 200.1.1.248/30. In other words, this subnet has two usable addresses: 200.1.1.249 and 200.1.1.250. These addresses are used on either end of the serial link between Certskills and its ISP. The NAT feature on the Certskills router translates all NAT addresses to its serial IP address, 200.1.1.249. + + +Certskills +10.1.1.1 + +200.1.1.249 +200.1.1.250 +Server + + +G0/0 NAT S0/0/0 R1 Internet R2 +170.1.1.1 + + +10.1.1.2 +Inside + + +Outside NAT Table (Overload) +Inside Local Inside Global 10.1.1.1: 49712 200.1.1.249: 49712 10.1.1.2: 49713 200.1.1.249: 49713 10.1.1.2: 49913 200.1.1.249: 49913 + +Figure 10-10 NAT Overload and PAT +Chapter 10: Network Address Translation 221 + +In Example 10-6, which shows the NAT overload configuration, NAT translates using inside global address 200.1.1.249 only, so the NAT pool is not required. In the example, host 10.1.1.2 creates two Telnet connections, and host 10.1.1.1 creates one Telnet connection, causing three dynamic NAT entries, each using inside global address 200.1.1.249, but each with a unique port number. +Example 10-6 NAT Overload Configuration + +NAT# show running-config +! +! Lines Omitted for Brevity +! +interface GigabitEthernet0/0 +ip address 10.1.1.3 255.255.255.0 +ip nat inside +! +interface Serial0/0/0 +ip address 200.1.1.249 255.255.255.252 +ip nat outside +! +ip nat inside source list 1 interface Serial0/0/0 overload +! +access-list 1 permit 10.1.1.2 +access-list 1 permit 10.1.1.1 +! + +NAT# show ip nat translations + +Pro Inside global +tcp 200.1.1.249:49712 +tcp 200.1.1.249:49713 +tcp 200.1.1.249:49913 + +Inside local +10.1.1.1:49712 +10.1.1.2:49713 +10.1.1.2:49913 + +Outside local +170.1.1.1:23 +170.1.1.1:23 +170.1.1.1:23 + +Outside global +170.1.1.1:23 +170.1.1.1:23 +170.1.1.1:23 + + + +NAT# show ip nat statistics +Total active translations: 3 (0 static, 3 dynamic; 3 extended) +Peak translations: 12, occurred 00:01:11 ago +Outside interfaces: +Serial0/0/0 +Inside interfaces: +GigabitEthernet0/0 +Hits: 103 Misses: 3 +Expired translations: 0 +Dynamic mappings: +-- Inside Source +access-list 1 interface Serial0/0/0 refcount 3 + + +10 + + +The ip nat inside source list 1 interface serial 0/0/0 overload command has several parameters, but if you understand the dynamic NAT configuration, the new parameters shouldn’t be too hard to grasp. The list 1 parameter means the same thing as it does for +222 CCNA 200-301 Official Cert Guide, Volume 2 + +dynamic NAT: inside local IP addresses matching ACL 1 have their addresses translated. The interface serial 0/0/0 parameter means that the only inside global IP address available is the IP address of the NAT router’s interface serial 0/0/0. Finally, the overload parameter means that overload is enabled. Without this parameter, the router does not perform overload, just dynamic NAT. + +As you can see in the output of the show ip nat translations command, three translations have been added to the NAT table. Before this command, host 10.1.1.1 creates one Telnet connection to 170.1.1.1, and host 10.1.1.2 creates two Telnet connections. The router cre-ates one NAT table entry for each unique combination of inside local IP address and port. + +NAT Troubleshooting +The majority of NAT troubleshooting issues relate to getting the configuration correct. Source NAT has several configuration options—static, dynamic, PAT—with several config-uration commands for each. You should work hard at building skills with the configuration so that you can quickly recognize configuration mistakes. The following troubleshooting checklist summarizes the most common source NAT issues, most of which relate to incor-rect configuration. + +■ Reversed inside and outside: Ensure that the configuration includes the ip nat inside and ip nat outside interface subcommands and that the commands are not reversed (the ip nat inside command on outside interfaces, and vice versa). With source NAT, only the inside interface triggers IOS to add new translations, so designating the correct inside interfaces is particularly important. +■ Static NAT: Check the ip nat inside source static command to ensure it lists the inside local address first and the inside global IP address second. +■ Dynamic NAT (ACL): Ensure that the ACL configured to match packets sent by the inside hosts match that host’s packets before any NAT translation has occurred. For example, if an inside local address of 10.1.1.1 should be translated to 200.1.1.1, ensure that the ACL matches source address 10.1.1.1, not 200.1.1.1. +■ Dynamic NAT (pool): For dynamic NAT without PAT, ensure that the pool has enough IP addresses. When not using PAT, each inside host consumes one IP address from the pool. A large or growing value in the second misses counter in the show ip nat statistics command output can indicate this problem. Also, compare the configured pool to the list of addresses in the NAT translation table (show ip nat translations). Finally, if the pool is small, the problem may be that the configuration intended to use PAT and is missing the overload keyword (see the next item). +■ PAT: It is easy to forget to add the overload option on the end of the ip nat inside source list command. PAT configuration is identical to a valid dynamic NAT configura-tion except that PAT requires the overload keyword. Without it, dynamic NAT works, but the pool of addresses is typically consumed very quickly. The NAT router will not translate nor forward traffic for hosts if there is not an available pool IP address for their traffic, so some hosts experience an outage. +■ ACL: As mentioned in Chapter 3, “Advanced IPv4 Access Control Lists,” you can always add a check for ACLs that cause a problem. Perhaps NAT has been configured correctly, but an ACL exists on one of the interfaces, discarding the packets. Note that the order of operations inside the router matters in this case. For packets entering an interface, IOS processes ACLs before NAT. For packets exiting an interface, IOS processes any out-bound ACL after translating the addresses with NAT . +Chapter 10: Network Address Translation 223 + +■ User traffic required: NAT reacts to user traffic. If you configure NAT in a lab, NAT does not act to create translations (show ip nat translations) until some user traffic enters the NAT router on an inside interface, triggering NAT to do a translation. The NAT configuration can be perfect, but if no inbound traffic occurs that matches the NAT configuration, NAT does nothing. +■ IPv4 routing: IPv4 routing could prevent packets from arriving on either side of the NAT router. Note that the routing must work for the destination IP addresses used in the packets. + +With source NAT, the user sits at some user device like a PC. She attempts to connect to some server, using that server’s DNS name. After DNS resolution, the client (the inside host) sends an IP packet with a destination address of the server. For instance, as shown in Figure 10-11, PC1 sends an IP packet with destination IP address 170.1.1.1, some server in the Internet. PC1 is an inside host, the server is an outside host, and 170.1.1.1 is the outside global address. (Note that these addresses match the previous example, which referenced Figure 10-10.) + +Certskills 200.1.1.249 +Server + + + +G0/0 10.1.1.1 +Inside + +NAT S0/0/0 R1 Internet R2 +170.1.1.1 +Outside + +1 To: 170.1.1.1 2 Unchanged - To: 170.1.1.1 + +To: 10.1.1.1 4 To: 200.1.1.249 3 + +Figure 10-11 Destination Address Changes on Outside to Inside (Only) with Source NAT + +Note that with source NAT in what should be a familiar design, the destination IP address of the packet does not change during the entire trip. So, troubleshooting of IPv4 routing toward the outside network will be based on the same IP address throughout. + +Now look at steps 3 and 4 in the figure, which reminds you that the return packet will first +flow to the NAT inside global address (200.1.1.249 in this case) as shown at step 3. Then 10 +NAT converts the destination address to 10.1.1.1 in this case. So, to troubleshoot packets flowing right to left in this case, you have to troubleshoot based on two different destina-tion IP addresses. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 10-5 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. +224 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 10-5 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Repeat DIKTA questions Review memory tables Review command tables +Do labs + +Resource Used Book, website Book, website Book, PTP Book, website Book +Blog + + +Review All the Key Topics + +Table 10-6 +Key Topic Element +Table 10-2 Figure 10-2 + +Figure 10-4 Table 10-4 +Figure 10-8 + +Key Topics for Chapter 10 +Description Page Number +List of private IP network numbers 206 +Main concept of NAT translating private IP addresses into 207 publicly unique global addresses +Typical NAT network diagram with key NAT terms listed 209 List of four key NAT terms and their meanings 210 +Concepts behind address conservation achieved by NAT overload 213 (PAT) + +Paragraph Summary of differences between dynamic NAT configuration and 220 PAT using a pool + +Key Terms You Should Know +CIDR, inside global, inside local, NAT overload, outside global, Port Address Translation, private IP network, source NAT + +Command References +Tables 10-7 and 10-8 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. +Chapter 10: Network Address Translation 225 + + +Table 10-7 +Command + +Chapter 10 Configuration Command Reference +Description + + + +ip nat {inside | outside} + + +ip nat inside source {list {access-list-number | access-list-name}} {interface type number | pool pool-name} [overload] + +ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length} +ip nat inside source inside-local inside-global + +Interface subcommand to enable NAT and identify whether the interface is in the inside or outside of the network +Global command that enables NAT globally, referencing the ACL that defines which source addresses to NAT, and the interface or pool from which to find global addresses +Global command to define a pool of NAT addresses +Global command that lists the inside and outside address (or, an outside interface whose IP address should be used) to be paired and added to the NAT translation table + + + +Table 10-8 +Command + +Chapter 10 EXEC Command Reference +Description + + + +show ip nat statistics + +show ip nat translations [verbose] +clear ip nat translation {* | [inside global-ip local-ip] [outside local-ip global-ip]} +clear ip nat translation protocol inside global-ip global-port local-ip local-port [outside local-ip global-ip] +debug ip nat + +Lists counters for packets and NAT table entries, as well as basic configuration information +Displays the NAT table +Clears all or some of the dynamic entries in the NAT table, depending on which parameters are used +Clears some of the dynamic entries in the NAT table, depending on which parameters are used + +Issues a log message describing each packet whose IP address is translated with NAT + + + +10 +CHAPTER 11 + + + +Quality of Service (QoS) This chapter covers the following exam topics: +4.0 IP Services +4.7 Explain the forwarding per-hop behavior (PHB) for QoS such as classification, mark-ing, queuing, congestion, policing, shaping + + +Quality of Service (QoS) refers to tools that network devices can use to manage several related characteristics of what happens to a packet while it flows through a network. Specifically, these tools manage the bandwidth made available to that type of packet, the delay the packet experiences, the jitter (variation in delay) between successive packets in the same flow, and the percentage of packet loss for packets of each class. These tools balance the trade-offs of which types of traffic receive network resources and when, giving more preference to some traffic and less preference to others. + +QoS tools define actions a device can apply to a message between the time it enters the device until it exits the device. QoS defines these actions as per-hop behaviors (PHBs), which is a formal term to refer to actions other than storing and forwarding a message. These actions can delay the message, discard it, or even change header fields. The device can choose different PHBs for different kinds of messages, improving the QoS behavior for some messages, while worsening the QoS behavior for others. + +This chapter works through the QoS tools listed in the single QoS exam topic: “Explain the forwarding per-hop behavior (PHB) for QoS such as classification, marking, queuing, con-gestion, policing, shaping.” Each topic emphasizes the problems each tool solves and how each tool manages bandwidth, delay, jitter, and loss. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 11-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Introduction to QoS Classification and Marking Queuing +Shaping and Policing +Congestion Avoidance + +Questions 1 +2, 3 4 +5 +6 + + + + +1. Which of the following attributes do QoS tools manage? (Choose three answers.) a. Bandwidth +b. Delay c. Load d. MTU e. Loss +2. Which of the following QoS marking fields could remain with a packet while being sent through four different routers, over different LAN and WAN links? (Choose two answers.) +a. CoS b. IPP +c. DSCP +d. MPLS EXP + +3. Which of the following are available methods of classifying packets in DiffServ on Cisco routers? (Choose three answers.) +a. Matching the IP DSCP field +b. Matching the 802.1p CoS field +c. Matching fields with an extended IP ACL d. Matching the SNMP Location variable +4. Which of the following behaviors are applied to a low latency queue in a Cisco router or switch? (Choose two answers.) +a. Shaping b. Policing +c. Priority scheduling +d. Round-robin scheduling + +5. Think about a policing function that is currently working, and also think about a shaping function that is also currently working. That is, the current bit rate of traffic exceeds the respective policing and shaping rates. Which statements are true about these features? (Choose two answers.) +a. The policer may or may not be discarding packets. b. The policer is definitely discarding packets. +c. The shaper may or may not be queuing packets to slow down the sending rate. d. The shaper is definitely queuing packets to slow down the sending rate. +228 CCNA 200-301 Official Cert Guide, Volume 2 + +6. A queuing system has three queues serviced with round-robin scheduling and one low latency queue that holds all voice traffic. Round-robin queue 1 holds predominantly UDP traffic, while round-robin queues 2 and 3 hold predominantly TCP traffic. +The packets in each queue happen to have a variety of DSCP markings per the QoS design. In which queues would it make sense to use a congestion avoidance (drop management) tool? (Choose two answers.) +a. The LLQ b. Queue 1 c. Queue 2 d. Queue 3 + + +Foundation Topics + +Introduction to QoS +Routers typically sit at the WAN edge, with both WAN interfaces and LAN interfaces. Those LAN interfaces typically run at much faster speeds, while the WAN interfaces run at slower speeds. While that slower WAN interface is busy sending the packets waiting in the router, hundreds or even thousands more IP packets could arrive in the LAN interfaces, all needing to be forwarded out that same WAN interface. What should the router do? Send them all, in the same order in which they arrived? Prioritize the packets, to send some ear-lier than others, preferring one type of traffic over another? Discard some of the packets when the number of packets waiting to exit the router gets too large? + +That first paragraph described some of the many classic Quality of Service (QoS) questions in networking. QoS refers to the tools that networking devices use to apply some different treatment to packets in the network as they pass through the device. For instance, the WAN edge router would queue packets waiting for the WAN interface to be available. The router could also use a queue scheduling algorithm to determine which packets should be sent next, using some other order than the arrival order—giving some packets better service and some worse service. + +QoS: Managing Bandwidth, Delay, Jitter, and Loss +Cisco offers a wide range of QoS tools on both routers and switches. All these tools give you the means to manage four characteristics of network traffic: + +■ Bandwidth ■ Delay +■ Jitter ■ Loss + +Bandwidth refers to the speed of a link, in bits per second (bps). But while we think of bandwidth as speed, it helps to also think of bandwidth as the capacity of the link, in terms of how many bits can be sent over the link per second. The networking device’s QoS tools determine what packet is sent over the link next, so the networking device is in control of which messages get access to the bandwidth next and how much of that bandwidth (capac-ity) each type of traffic gets over time. +Chapter 11: Quality of Service (QoS) 229 + +For example, consider that typical WAN edge router that has hundreds of packets waiting to exit the WAN link. An engineer might configure a queuing tool to reserve 10 percent of the bandwidth for voice traffic, 50 percent for mission-critical data applications, and leave the rest of the bandwidth for all other types of traffic. The queuing tool could then use those settings to make the choice about which packets to send next. + +Delay can be described as one-way delay or round-trip delay. One-way delay refers to the time between sending one packet and that same packet arriving at the destination host. +Round-trip delay counts the one-way delay plus the time for the receiver of the first packet to send back a packet—in other words, the time it takes to send one packet between two hosts and receive one back. Many different individual actions impact delay; this chapter will discuss a few of those, including queuing and shaping delay. + +Jitter refers to the variation in one-way delay between consecutive packets sent by the same application. For example, imagine an application sends a few hundred packets to one particular host. The first packet’s one-way delay is 300 milliseconds (300 ms, or .3 seconds). The next packet’s one-way delay is 300 ms; so is the third’s; and so on. In that case, there is no jitter. However, if instead the first packet has a one-way delay of 300 ms, the next has a +one-way delay of 310 ms, and the next has 325 ms, then there is some variation in the delay; 10 ms between packets 1 and 2, and another 15 ms between packets 2 and 3. That differ-ence is called jitter. + +Finally, loss refers to the number of lost messages, usually as a percentage of packets sent. The comparison is simple: if the sender for some application sends 100 packets, and only 98 arrive at the destination, that particular application flow experienced 2 percent loss. Loss can be caused by many factors, but often, people think of loss as something caused by faulty cabling or poor WAN services. That is one cause. However, more loss happens +because of the normal operation of the networking devices, in which the devices’ queues get too full, so the device has nowhere to put new packets, and it discards the packet. Several QoS tools manage queuing systems to help control and avoid loss. + +Types of Traffic +With QoS, a network engineer sets about to prefer one type of traffic over another in regard to bandwidth, delay, jitter, and loss. Sometimes, that choice relates to the specific business. For example, if all the mission-critical applications sit on servers in three known subnets, then the QoS plan could be set up to match packets going to/from that subnet and give that traffic better treatment compared to other traffic. However, in other cases, the +choice of how to apply QoS tools relates to the nature of different kinds of applications. +Some applications have different QoS needs than others. This next topic compares the basic 11 +differences in QoS needs based on the type of traffic. + +Data Applications +First, consider a basic web application, with a user at a PC or tablet. The user types in a URI to request a web page. That request may require a single packet going to the web server, but it may result in hundreds or thousands of packets coming back to the web client, as shown in Figure 11-1. +230 CCNA 200-301 Official Cert Guide, Volume 2 + + +HTTP GET Web Server + + + +. . +. +500 Packets +Figure 11-1 Concept of Disproportionate Packet/Byte Volumes with HTTP Traffic + +NOTE If you wonder how one web page might require thousands of packets, consider this math: with a 1500-byte IP maximum transmission unit (MTU), the data part of a TCP segment could be at most 1460 bytes (1500 bytes minus 20 bytes each for the IP and TCP header). In this example, 1000 such packets total to 1,460,000 bytes, or about 1.5 MB. It is easy to imagine a web page with just a few graphics that totals more than 1.5 MB in size. + +So, what is the impact of bandwidth, delay, jitter, and loss on an interactive web-based application? First, the packets require a certain amount of bandwidth capacity. As for delay, each of those packets from the server to the client takes some amount of one-way delay, with some jitter as well. Of the 500 packets shown in Figure 11-1, if some are lost (transmis-sion errors, discarded by devices, or other reasons), then the server’s TCP logic will retrans-mit, but parts of the web page may not show up right away. + +While QoS tools focus on managing bandwidth, delay, jitter, and loss, the user mainly cares about the quality of the overall experience. For instance, with a web application, how long after clicking do you see something useful in your web browser? So, as a user, you care about the Quality of Experience (QoE), which is a term referring to users’ perception of their use of the application on the network. QoS tools directly impact bandwidth, delay, jit-ter, and loss, which then should have some overall good effect to influence the users’ QoE. And you can use QoS tools to create a better QoE for more important traffic; for instance, you might give certain business-critical applications better QoS treatment, which improves QoE for users of those apps. + +In contrast, a noninteractive data application (historically called batch traffic)—for instance, data backup or file transfers—has different QoS requirements than interactive data applica-tions. Batch applications typically send more data than interactive applications, but because no one is sitting there waiting to see something pop on the screen, the delay and jitter do not matter much. Much more important for these applications is meeting the need to com-plete the larger task (transferring files) within a larger time window. QoS tools can be used to provide enough bandwidth to meet the capacity needs of these applications and manage loss to reduce the number of retransmissions. + +Voice and Video Applications +Voice and video applications each have a similar breakdown of interactive and noninterac-tive flows. To make the main points about both voice and video, this section looks more deeply at voice traffic. + + +Answers to the “Do I Know This Already?” quiz: 1 A, B, E 2 B, C 3 A, B, C 4 B, C 5 A, D 6 C, D +Chapter 11: Quality of Service (QoS) 231 + +Before looking at voice, though, first think about the use of the term flow in networking. A flow is all the data moving from one application to another over the network, with one flow for each direction. For example, if you open a website and connect to a web server, the web page content that moves from the server to the client is one flow. Listen to some music with a music app on your phone, and that creates a flow from your app to the music app’s server and a flow from the server back to your phone. From a voice perspective, a phone call between two IP phones would create a flow for each direction. For video, it could be the traffic from one video surveillance camera collected by security software. + +Now on to voice, specifically Voice over IP (VoIP). VoIP defines the means to take the sound made at one telephone and send it inside IP packets over an IP network, playing the sound back on the other telephone. Figure 11-2 shows the general idea. The steps in the figure include +Step 1. The phone user makes a phone call and begins speaking. +Step 2. A chip called a codec processes (digitizes) the sound to create a binary code (160 bytes with the G.711 codec, for example) for a certain time period (usu-ally 20 ms). +Step 3. The phone places the data into an IP packet. +Step 4. The phone sends the packet to the destination IP phone. + + +IP Phone Internals + +1 +CODEC + + +2 +Voice Bytes + + +3 +IP UDP RTP Voice Bytes 4 + +Figure 11-2 Creating VoIP Packets with an IP Phone and a G.711 Codec + +If you work through the math a bit, this single call, with the G.711 codec, requires about 80 Kbps of bandwidth (ignoring the data-link header and trailer overhead). Counting the head-ers and VoIP payload as shown in the figure, each of the IP packets has 200 bytes. Each holds 20 ms of digitized voice, so the phone sends 50 packets per second. These 50 packets at 200 bytes each equal 10,000 bytes per second, or 80,000 bits per second, which is 80 Kbps. Other voice codecs require even less bandwidth, with the commonly used G.729 tak- +ing about 24 Kbps (again ignoring data-link overhead). 11 At first, it may look like VoIP calls require little in regard to QoS. For bandwidth, a single +voice call or flow requires only a little bandwidth in comparison to many data applications. However, interactive voice does require a much better level of quality for delay, jitter, and loss. + +For instance, think about making a phone call with high one-way delay. You finish speaking and pause for the other person to respond. And he does not, so you speak again—and hear the other person’s voice overlaid on your own. The problem: too much delay. Or, consider calls for which the sound breaks up. The problem? It could have been packet loss, or it could have been jitter. +232 CCNA 200-301 Official Cert Guide, Volume 2 + +You can achieve good-quality voice traffic over an IP network, but you must implement QoS to do so. QoS tools set about to give different types of traffic the QoS behavior they need. Cisco’s Enterprise QoS Solution Reference Network Design Guide, which itself quotes other sources in addition to relying on Cisco’s long experience in implementing QoS, suggests the following guidelines for interactive voice: + +■ Delay (one-way): 150 ms or less ■ Jitter: 30 ms or less +■ Loss: 1% or less + +In comparison, interactive voice requires more attention than interactive data applications for QoS features. Data applications generally tolerate more delay, jitter, and loss than voice (and video). A single voice call does generally take less bandwidth than a typical data appli-cation, but that bandwidth requirement is consistent. Data applications tend to be bursty, with data bursts in reaction to the user doing something with the application. + +Video has a much more varied set of QoS requirements. Generally, think of video like voice, but with a much higher bandwidth requirement than voice (per flow) and similar requirements for low delay, jitter, and loss. As for bandwidth, video can use a variety of codecs that impact the amount of data sent, but many other technical features impact the amount of bandwidth required for a single video flow. (For instance, a sporting event with lots of movement on screen takes more bandwidth than a news anchor reading the news in front of a solid background with little movement.) This time quoting from End-to-End QoS Network Design, Second Edition (Cisco Press, 2013), some requirements for video include + +■ Bandwidth: 384 Kbps to 20+ Mbps ■ Delay (one-way): 200–400 ms +■ Jitter: 30–50 ms ■ Loss: 0.1%–1% + +NOTE End-to-End QoS Network Design is written by some of the same people who cre-ated the Cisco Enterprise QoS Solution Reference Network Design Guide (available at Cisco.com). If you are looking for a book to dig into more depth on QoS, this book is an excellent reference for Cisco QoS. + +QoS as Mentioned in This Book +QoS tools change the QoS characteristics of certain flows in the network. The rest of the chapter focuses on the specific tools mentioned in the lone CCNA 200-301 exam topic about QoS, presented in the following major sections: + +■ “Classification and Marking” is about the marking of packets and the definition of trust boundaries. +■ “Queuing” describes the scheduling of packets to give one type of packet priority over another. +■ “Shaping and Policing” explains these two tools together because they are often used on opposite ends of a link. +■ “Congestion Avoidance” addresses how to manage the packet loss that occurs when net-work devices get too busy. +Chapter 11: Quality of Service (QoS) + +QoS on Switches and Routers +Before moving on to several sections of the chapter about specific QoS tools, let me make a point about the terms packet and frame as used in this chapter. + +The QoS tools discussed in this chapter can be used on both switches and routers. There are some differences in the features and differences in implementation, due to the differences of internal architecture between routers and switches. However, to the depth discussed here, the descriptions apply equally to both LAN switches and IP routers. + +This chapter uses the word packet in a general way, to refer to any message being processed by a networking device, just for convenience. Normally, the term packet refers to the IP header and encapsulated headers and data, but without the data-link header and trailer. The term frame refers to the data-link header/trailer with its encapsulated headers and data. For this chapter, those differences do not matter to the discussion, but at the same time, the discussion often shows a message that sometimes is literally a packet (without the data-link header/trailer) and sometimes a frame. + +Throughout the chapter, the text uses packet for all messages, because the fact of whether or not the message happens to have a data-link header/trailer at that point is immaterial to the basic discussion of features. + +Additionally, note that all the examples in the chapter refer to routers, just to be consistent. + +Classification and Marking +The first QoS tool discussed in this chapter, classification and marking, or simply marking, refers to a type of QoS tool that classifies packets based on their header contents, and then marks the message by changing some bits in specific header fields. This section looks first at the role of classification across all QoS tools, and then it examines the marking feature. + +Classification Basics +QoS tools sit in the path that packets take when being forwarded through a router or switch, much like the positioning of ACLs. Like ACLs, QoS tools are enabled on an inter-face. Also like ACLs, QoS tools are enabled for a direction: packets entering the interface (before the forwarding decision) or for messages exiting the interface (after the forwarding decision). + +The term classification refers to the process of matching the fields in a message to make a choice to take some QoS action. So, again comparing QoS tools to ACLs, ACLs perform +classification and filtering; that is, ACLs match (classify) packet headers. ACLs can have the purpose (action) of choosing which packets to discard. QoS tools perform classification (matching of header fields) to decide which packets to take certain QoS actions against. Those actions include the other types of QoS tools discussed in this chapter, such as queu-ing, shaping, policing, and so on. + +For example, consider the internal processing done by a router as shown in Figure 11-3. In this case, an output queuing tool has been enabled on an interface. Routers use queuing +tools to place some packets in one output queue, other packets in another, and so on, when the outgoing interface happens to be busy. Then, when the outgoing interface becomes available to send another message, the queuing tool’s scheduler algorithm can pick the next message from any one of the queues, prioritizing traffic based on the rules configured by the network engineer. + +233 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +11 +234 CCNA 200-301 Official Cert Guide, Volume 2 + + +Router Internals + +Forward Classify + + +R1 + + +Queue +Scheduling (Prioritization) Transmit + + + +Figure 11-3 Big Idea: Classification for Queuing in a Router + +The figure shows the internals of a router and what happens to the packet during part of that internal processing, moving left to right inside the router, as follows: +Step 1. The router makes a forwarding (routing) decision. +Step 2. The output queuing tool uses classification logic to determine which packets go into which output queue. +Step 3. The router holds the packets in the output queue waiting for the outgoing interface to be available to send the next message. +Step 4. The queuing tool’s scheduling logic chooses the next packet, effectively priori-tizing one packet over another. + +While the example shows a queuing tool, note that the queuing tool requires the ability to classify messages by comparing the messages to the configuration, much like ACLs. + +Matching (Classification) Basics +Now think about classification from an enterprise-wide perspective, which helps us appreci-ate the need for marking. Every QoS tool can examine various headers to make compari-sons to classify packets. However, you might apply QoS tools on most every device in the network, sometimes at both ingress and egress on most of the interfaces. Using complex matching of many header fields in every device and on most interfaces requires lots of configuration. The work to match packets can even degrade device performance of some devices. So, while you could have every device use complex packet matching, doing so is a poor strategy. + +A better strategy, one recommended both by Cisco and by RFCs, suggests doing complex matching early in the life of a packet and then marking the packet. Marking means that the QoS tool changes one or more header fields, setting a value in the header. Several header fields have been designed for the purpose of marking the packets for QoS processing. Then, devices that process the packet later in its life can use much simpler classification logic. + +Figure 11-4 shows an example, with a PC on the left sending an IP packet to some host off the right side of the figure (not shown). Switch SW1, the first networking device to forward the packet, does some complex comparisons and marks the packet’s Differentiated Services Code Point (DSCP) field, a 6-bit field in the IP header meant for QoS marking. The next three devices that process this message—SW2, R1, and R2—then use simpler matching to classify the packet by comparing the packet’s DSCP value, placing packets with one DSCP value in class 1, and packets with another DSCP value in class 2. +Chapter 11: Quality of Service (QoS) 235 + +More Complex Matching Less Complex Matching + + + +Mark DSCP at Ingress + +DSCP=X? DSCP=Y? + +CLASS 1. CLASS 2. + + + +* +SW1 SW2 R1 + + +WAN R2 … + + + + +Figure 11-4 Systematic Classification and Marking for the Enterprise + +Classification on Routers with ACLs and NBAR +Now that you know the basics of what classification and marking do together, this section takes the discussion a little deeper with a closer look at classification on routers, which is followed by a closer look at the marking function. + +First, QoS classification sounds a lot like what ACLs do, and it should. In fact, many QoS tools support the ability to simply refer to an IP ACL, with this kind of logic: + +For any packet matched by the ACL with a permit action, consider that packet a match for QoS, so do a particular QoS action. + +As a reminder, Figure 11-5 shows the IP and TCP header. All these fields are matchable for QoS classification. + +IP Header TCP Header +9 1 2 4 4 Variable 2 2 16+ +Miscellaneous Protocol Header Source IP Destination IP Source Dest. Rest Fields 6 (TCP) Checksum Address Address Port Port TCP +Options +Header +of +6 = TCP + +Figure 11-5 Classification with Five Fields Used by Extended ACLs + + +Now think about the enterprise’s QoS plan for a moment. That plan should list details such as which types of traffic should be classified as being in the same class for queuing purposes, for shaping, and for any other QoS tool. That plan should detail the fields in the header that can be matched. For instance, if all the IP phones sit in subnets within the +range of addresses 10.3.0.0/16, then the QoS plan should state that. Then the network engi-neer could configure an extended ACL to match all packets to/from IP addresses inside 10.3.0.0/16 and apply appropriate QoS actions to that voice traffic. + +However, not every classification can be easily made by matching with an ACL. In more challenging cases, Cisco Network Based Application Recognition (NBAR) can be used. NBAR is basically in its second major version, called NBAR2, or next-generation NBAR. In short, NBAR2 matches packets for classification in a large variety of ways that are very use-ful for QoS. + +NBAR2 looks far beyond what an ACL can examine in a message. Many applications cannot be identified based on well-known port alone. NBAR solves those problems. + + + + + +11 +236 CCNA 200-301 Official Cert Guide, Volume 2 + +Cisco also organizes what NBAR can match in ways that make it easy to separate the traffic into different classes. For instance, the Cisco WebEx application provides audio and video conferencing on the web. In a QoS plan, you might want to classify WebEx differently than other video traffic and classify it differently than voice calls between IP phones. That is, you might classify WebEx traffic and give it a unique DSCP marking. NBAR provides easy built-in matching ability for WebEx, plus more than 1000 different subcategories of applications. + +Just to drive the point home with NBAR, Example 11-1 lists four lines of help output for one of many NBAR configuration commands. I chose a variety of items that might be more memorable. With the use of the keywords on the left in the correct configuration command, you could match the following: entertainment video from Amazon, video from Cisco’s video surveillance camera products, voice from Cisco IP Phones, and video from sports channel ESPN. (NBAR refers to this idea of defining the characteristics of different applications as application signatures.) +Example 11-1 Example of the Many NBAR2 Matchable Applications + +R1#(config)# class-map matchingexample +R1(config-cmap)# match protocol attribute category voice-and-video ? +! output heavily edited for length + +amazon-instant-video +cisco-ip-camera +cisco-phone +espn-video +facetime +! Output snipped. + +VOD service by Amazon +Cisco video surveillance camera +Cisco IP Phones and PC-based Unified Communicators +ESPN related websites and mobile applications video +Facetime video calling software + + +To wrap up the discussion of NBAR for classification, compare the first two highlighted entries in the output. Without NBAR, it would be difficult to classify an entertainment video from Amazon versus the video from a security camera, but those two highlighted entries show how you easily have classified that traffic differently. The third highlighted item shows how to match traffic for Cisco IP Phones (and PC-based equivalents), again mak-ing for an easier match of packets of a particular type. + +Marking IP DSCP and Ethernet CoS +The QoS plan for an enterprise centers on creating classes of traffic that should receive certain types of QoS treatment. That plan would note how to classify packets into each classification and the values that should be marked on the packets, basically labeling each packet with a number to associate it with that class. For example, that plan might state the following: + +■ Classify all voice payload traffic that is used for business purposes as IP DSCP EF and CoS 5. +■ Classify all video conferencing and other interactive video for business purposes as IP DSCP AF41 and CoS 4. +■ Classify all business-critical data application traffic as IP DSCP AF21 and CoS 2. + +This next topic takes a closer look at the specific fields that can be marked, defining the DSCP and CoS marking fields. +Chapter 11: Quality of Service (QoS) 237 + +Marking the IP Header +Marking a QoS field in the IP header works well with QoS because the IP header exists for the entire trip from the source host to the destination host. When a host sends data, the host sends a data-link frame that encapsulates an IP packet. Each router that forwards the IP packet discards the old data-link header and adds a new header. Because the routers do not discard and reinsert IP headers, marking fields in the IP header stay with the data from the first place it is marked until it reaches the destination host. + +IPv4 defines a Type of Service (ToS) byte in the IPv4 header, as shown in Figure 11-6. The original RFC defined a 3-bit IP Precedence (IPP) field for QoS marking. That field gave us eight separate values—binary 000, 001, 010, and so on, through 111—which when convert-ed to decimal are decimals 0 through 7. + +RFC 791 + +IPP Unused Old Use + + + +Type of Service + +IP Header + +(Rest of IP Header...) + + + + +DSCP + +RFC 2474 + + +ECN Current Use + +RFC 3168 + +Figure 11-6 IP Precedence and Differentiated Services Code Point Fields + +NOTE Those last 5 bits of the ToS byte per RFC 791 were mostly defined for some pur-pose but were not used in practice to any significant extent. + +While a great idea, IPP gave us only eight different values to mark, so later RFCs redefined the ToS byte with the DSCP field. DSCP increased the number of marking bits to 6 bits, allowing for 64 unique values that can be marked. The DiffServ RFCs, which became RFCs back in the late 1990s, have become accepted as the most common method to use when doing QoS, and using the DSCP field for marking has become quite common. + +IPv6 has a similar field to mark as well. The 6-bit field also goes by the name DSCP, with +the byte in the IPv6 header being called the IPv6 Traffic Class byte. Otherwise, think of 11 IPv4 and IPv6 being equivalent in terms of marking. + +IPP and DSCP fields can be referenced by their decimal values as well as some convenient text names. The later section titled “DiffServ Suggested Marking Values” details some of the names. + +Marking the Ethernet 802.1Q Header +Another useful marking field exists in the 802.1Q header, in a field originally defined by the IEEE 802.1p standard. This field sits in the third byte of the 4-byte 802.1Q header, as a 3-bit field, supplying eight possible values to mark (see Figure 11-7). It goes by two differ-ent names: Class of Service, or CoS, and Priority Code Point, or PCP. +238 CCNA 200-301 Official Cert Guide, Volume 2 + +Ethernet Frame + +Ethernet 802.1 Q Type Data Trailer + + +Class of Service (CoS) (3 Bits) Priority Code Point (PCP) +Figure 11-7 Class of Service Field in 802.1Q/p Header + +The figure uses two slightly different shades of gray (in print) for the Ethernet header and trailer fields versus the 802.1Q header, as a reminder: the 802.1Q header is not included in all Ethernet frames. The 802.1Q header only exists when 802.1Q trunking is used on a +link. As a result, QoS tools can make use of the CoS field only for QoS features enabled on interfaces that use trunking, as shown in Figure 11-8. + + + +Trunk Trunk SW1 SW2 + +R1 WAN R2 … + + + + +Can Use CoS Figure 11-8 Useful Life of CoS Marking +For instance, if the PC on the left were to send data to a server somewhere off the figure to the right, the DSCP field would exist for that entire trip. However, the CoS field would +exist over the two trunks only and would be useful mainly on the four interfaces noted with the arrow lines. + +Other Marking Fields +Other marking fields also exist in other headers. Table 11-2 lists those fields for reference. + +Table 11-2 Marking Fields + +Field Name DSCP +IPP CoS TID +EXP + +Header(s) IPv4, IPv6 IPv4, IPv6 802.1Q 802.11 +MPLS Label + +Length (bits) 6 +3 3 3 +3 + +Where Used +End-to-end packet End-to-end packet Over VLAN trunk Over Wi-Fi +Over MPLS WAN + + +Defining Trust Boundaries +The end-user device can mark the DSCP field—and even the CoS field if trunking is used on the link. Would you, as the network engineer, trust those settings and let your network-ing devices trust and react to those markings for their various QoS actions? + +Most of us would not, because anything the end user controls might be used inappropriate-ly at times. For instance, a PC user could know enough about DiffServ and DSCPs to know that most voice traffic is marked with a DSCP called Expedited Forwarding (EF), which has a decimal value of 46. Voice traffic gets great QoS treatment, so PC users could mark all their traffic as DSCP 46, hoping to get great QoS treatment. +Chapter 11: Quality of Service (QoS) 239 + +The people creating a QoS plan for an enterprise have to choose where to place the trust boundary for the network. The trust boundary refers to the point in the path of a packet flowing through the network at which the networking devices can trust the current QoS markings. That boundary typically sits in a device under the control of the IT staff. + +For instance, a typical trust boundary could be set in the middle of the first ingress switch in the network, as shown in Figure 11-9. The markings on the message as sent by the PC can-not be trusted. However, because SW1 performed classification and marking as the packets entered the switch, the markings can be trusted at that point. + +Set DSCP and CoS Inbound + +Untrusted +SW1 SW2 R1 WAN R2 … + +Trust Boundary +Figure 11-9 Trusting Devices—PC + +Interestingly, when the access layer includes an IP Phone, the phone is typically the trust boundary, instead of the access layer switch. IP Phones can set the CoS and DSCP fields of the messages created by the phone, as well as those forwarded from the PC through the phone. The specific marking values are actually configured on the attached access switch. Figure 11-10 shows the typical trust boundary in this case, with notation of what the phone’s marking logic usually is: mark all of the PC’s traffic with a particular DSCP and/or CoS, and the phone’s traffic with different values. + +Set PC DSCP and CoS Set Phone DSCP and CoS + + +IP SW1 SW2 R1 WAN R2 … + +Trust Boundary +Figure 11-10 Trusting Devices—IP Phone + + +DiffServ Suggested Marking Values +Everything in this chapter follows the DiffServ architecture as defined originally by RFC 2475, plus many other DiffServ RFCs. In particular, DiffServ goes beyond theory in several areas, including making suggestions about the specific DSCP values to use when marking IP packets. By suggesting specific markings for specific types of traffic, DiffServ hoped to create a consistent use of DSCP values in all networks. By doing so, product vendors could provide good default settings for their QoS features, QoS could work better between an enterprise and service provider, and many other benefits could be realized. + +The next two topics outline three sets of DSCP values as used in DiffServ. + + +11 +240 CCNA 200-301 Official Cert Guide, Volume 2 + +Expedited Forwarding (EF) +DiffServ defines the Expedited Forwarding (EF) DSCP value—a single value—as suggested for use for packets that need low latency (delay), low jitter, and low loss. The Expedited Forwarding RFC (RFC 3246) defines the specific DSCP value (decimal 46) and an equiva-lent text name (Expedited Forwarding). QoS configuration commands allow the use of the decimal value or text name, but one purpose of having a text acronym to use is to make the value more memorable, so many QoS configurations refer to the text names. + +Most often QoS plans use EF to mark voice payload packets. With voice calls, some pack-ets carry voice payload, and other packets carry call signaling messages. Call signaling mes-sages set up (create) the voice call between two devices, and they do not require low delay, jitter, and loss. Voice payload packets carry the digitized voice, as shown back in Figure +11-2, and these packets do need better QoS. By default, Cisco IP Phones mark voice pay-load with EF, and mark voice signaling packets sent by the phone with another value called CS3. + +Assured Forwarding (AF) +The Assured Forwarding (AF) DiffServ RFC (2597) defines a set of 12 DSCP values meant to be used in concert with each other. First, it defines the concept of four separate queues in a queuing system. Additionally, it defines three levels of drop priority within each queue for use with congestion avoidance tools. With four queues, and three drop priority classes per queue, you need 12 different DSCP markings, one for each combination of queue and drop priority. (Queuing and congestion avoidance mechanisms are discussed later in this chapter.) + +Assured Forwarding defines the specific AF DSCP text names and equivalent decimal values as listed in Figure 11-11. The text names follow a format of AFXY, with X referring to the queue (1 through 4) and Y referring to the drop priority (1 through 3). + +Best Drop Worst Drop + + +Best Queue AF41 (34) + +AF42 AF43 (36) (38) + + +AF31 AF32 AF33 (26) (28) (30) + +AF21 AF22 AF23 (18) (20) (22) + + + +Worst Queue + +AF11 AF12 AF13 (10) (12) (14) + +Figure 11-11 Differentiated Services Assured Forwarding Values and Meaning + +For example, if you marked packets with all 12 values, those with AF11, AF12, and AF13 would all go into one queue; those with AF21, AF22, and AF23 would go into another queue; and so on. Inside the queue with all the AF2y traffic, you would treat the AF21, AF22, and AF23 each differently in regard to drop actions (congestion avoidance), with AF21 getting the preferred treatment and AF23 the worst treatment. +Chapter 11: Quality of Service (QoS) 241 + +Class Selector (CS) +Originally, the ToS byte was defined with a 3-bit IP Precedence (IPP) field. When DiffServ redefined the ToS byte, it made sense to create eight DSCP values for backward compatibil-ity with IPP values. The Class Selector (CS) DSCP values are those settings. + +Figure 11-12 shows the main idea along with the eight CS values, both in name and in deci-mal value. Basically, the DSCP values have the same first 3 bits as the IPP field, and with binary 0s for the last 3 bits, as shown on the left side of the figure. CSx represents the text names, where x is the matching IPP value (0 through 7). + + + +IPP + + + + +DSCP CSx 0 0 0 + +Decimal IPP CS DSCP +0 CS0 0 1 CS1 8 2 CS2 16 3 CS3 24 4 CS4 32 5 CS5 40 6 CS6 48 7 CS7 56 + +Figure 11-12 Class Selector + +This section on classification and marking has provided a solid foundation for understand-ing the tools explored in the next three major sections of this chapter: queuing, shaping/ policing, and congestion avoidance. + +Guidelines for DSCP Marking Values +Even with this introduction to the various DSCP marking values, you could imagine that an enterprise needs to follow a convention for how to use the markings. With so many differ-ent values, having different uses of different DSCP values by different devices in the same enterprise would make deploying QoS quite difficult at best. + +Among its many efforts to standardize QoS, Cisco helped to develop RFC 4954, an RFC that defines several conventions for how to use the DSCP field. The RFC provides alterna-tive plans with different levels of detail. Each plan defines a type of traffic and the DSCP value to use when marking data. Without getting into the depth of any one plan, the plans all specify some variation for how all devices should mark data as follows: +■ DSCP EF: Voice payload +■ AF4x: Interactive video (for example, videoconferencing) 11 +■ AF3x: Streaming video +■ AF2x: High priority (low latency) data ■ CS0: Standard data + +Cisco not only worked to develop the RFC standards but also uses those standards. Cisco uses default marking conventions based on the marking data in RFC 4594, with some small exceptions. If you want to read more about these QoS marking plans, refer to a couple of sources. First, look for the Cisco QoS Design Guides at Cisco.com. Also refer to RFC 4594. +242 CCNA 200-301 Official Cert Guide, Volume 2 + +Queuing +All networking devices use queues. Network devices receive messages, make a forwarding decision, and then send the message—but sometimes the outgoing interface is busy. So, the device keeps the outgoing message in a queue, waiting for the outgoing interface to be available—simple enough. + +The term queuing refers to the QoS toolset for managing the queues that hold packets while they wait their turn to exit an interface (and in other cases in which a router holds packets waiting for some resource). But queuing refers to more than one idea, so you have to look inside devices to think about how they work. For instance, consider Figure 11-13, which shows the internals of a router. The router, of course, makes a forwarding decision, and it needs to be ready to queue packets for transmission once the outgoing interface is available. At the same time, the router may take a variety of other actions as well—ingress ACL, ingress NAT (on the inside interface), egress ACLs after the forwarding decision is made, and so on. + +Router Internals + + +Forwarding +Receive ingress services + + +egress services + +Output Queue +Transmit + + + + +Figure 11-13 Output Queuing in a Router: Last Output Action Before Transmission + +The figure shows output queuing in which the device holds messages until the output inter-face is available. The queuing system may use a single output queue, with a first-in, first-out (FIFO) scheduler. (In other words, it’s like ordering lunch at the sandwich shop that has a single ordering line.) + +Next, think a little more deeply about the queuing system. Most networking devices can have a queuing system with multiple queues. To use multiple queues, the queuing system needs a classifier function to choose which packets are placed into which queue. (The clas-sifier can react to previously marked values or do a more extensive match.) The queuing system needs a scheduler as well, to decide which message to take next when the interface becomes available, as shown in Figure 11-14. + +Classifier Queues Scheduler + +Transmit + + + +Figure 11-14 Queuing Components + +Of all these components of the queuing system, the scheduler can be the most interesting part because it can perform prioritization. Prioritization refers to the concept of giving pri-ority to one queue over another in some way. +Chapter 11: Quality of Service (QoS) 243 + +Round-Robin Scheduling (Prioritization) +One scheduling algorithm used by Cisco routers and switches uses round-robin logic. In its most basic form, round robin cycles through the queues in order, taking turns with each queue. In each cycle, the scheduler either takes one message or takes a number of bytes from each queue by taking enough messages to total that number of bytes. Take some mes-sages from queue 1, move on and take some from queue 2, then take some from queue 3, and so on, starting back at queue 1 after finishing a complete pass through the queues. + +Round-robin scheduling also includes the concept of weighting (generally called weighted round robin). Basically, the scheduler takes a different number of packets (or bytes) from each queue, giving more preference to one queue over another. + +For example, routers use a popular tool called Class-Based Weighted Fair Queuing (CBWFQ) to guarantee a minimum amount of bandwidth to each class. That is, each class receives at least the amount of bandwidth configured during times of congestion, but maybe more. Internally, CBWFQ uses a weighted round-robin scheduling algorithm, while letting the network engineer define the weightings as a percentage of link bandwidth. Figure 11-15 shows an example in which the three queues in the system have been given 20, 30, and 50 percent of the bandwidth each, respectively. + + + +Classifier Queues + +Q1 +Q2 + +Q3 + + +Scheduler + +20% +30% Transmit + +50% +Round Robin + + +Figure 11-15 CBWFQ Round-Robin Scheduling + + +With the queuing system shown in the figure, if the outgoing link is congested, the sched-uler guarantees the percentage bandwidth shown in the figure to each queue. That is, queue 1 gets 20 percent of the link even during busy times. + +Low Latency Queuing +Earlier in the chapter, the section titled “Voice and Video Applications” discussed the reasons why voice and video, particularly interactive voice and video like phone calls and videoconferencing, need low latency (low delay), low jitter, and low loss. Unfortunately, a round-robin scheduler does not provide low enough delay, jitter, or loss. The solution: add Low Latency Queuing (LLQ) to the scheduler. + +First, for a quick review, Table 11-3 lists the QoS requirements for a voice call. The numbers come from the Enterprise QoS Solution Reference Network Design Guide, referenced earlier in the chapter. The amount of bandwidth required per call varies based on the codec used by the call. However, the delay, jitter, and loss requirements remain the same for all voice calls. (Interactive video has similar requirements for delay, jitter, and loss.) + + + + + + + + +11 + + +Table 11-3 QoS Requirements for a VoIP Call per Cisco Voice Design Guide + +Bandwidth/call +30–320 Kbps + +One-way Delay (max) +150 ms + +Jitter (max) +30 ms + +Loss (max) +<1% +244 CCNA 200-301 Official Cert Guide, Volume 2 + +A round-robin queuing system adds too much delay for these voice and video packets. To see why, imagine a voice packet arrives and is routed to be sent out some interface with the queuing system shown in Figure 11-16. However, that next voice packet arrives just as the round-robin scheduler moves on to service the queue labeled “data 1.” Even though the voice queue has been given 50 percent of the link bandwidth, the scheduler does not send +that voice message until it sends some messages from the other three queues—adding delay and jitter. + + + +Classifier Queues +voice data 1 data 2 +default + +Scheduler +50% +10% Transmit 15% +25% +Round Robin + + +Figure 11-16 Round Robin Not Good for Voice Delay (Latency) and Jitter + +The solution, LLQ, tells the scheduler to treat one or more queues as special priority queues. The LLQ scheduler always takes the next message from one of these special prior-ity queues. Problem solved: very little delay for packets in that queue, resulting in very little jitter as well. Plus the queue never has time to fill up, so there are no drops due to the queue filling up. Figure 11-17 shows the addition of the LLQ logic for the voice queue. + + +Classifier Scheduler +voice LLQ—Always Next +data 1 +data 2 Transmit +default +Round Robin + +Figure 11-17 LLQ Always Schedules Voice Packet Next + +Using LLQ, or a priority queue, provides the needed low delay, jitter, and loss for the traf-fic in that queue. However, think about those other queues. Do you see the problem? What happens if the speed of the interface is X bits per second, but more than X bits per second come into the voice queue? The scheduler never services the other queues (called queue starvation). + +As you might guess, there is a solution: limit the amount of traffic placed into the priority queue, using a feature called policing. The next section talks about policers in more detail, but for now, think of it as a cap on the bandwidth used by the priority queue. For instance, you could reserve 20 percent of the link’s bandwidth for the voice queue and make it a pri-ority queue. However, in this case, instead of 20 percent being the minimum bandwidth, it is the maximum for that queue. If more than 20 percent of the link’s worth of bits shows up in that queue, the router will discard the excess. + +Limiting the amount of bandwidth in the priority queue protects the other queues, but it causes yet another problem. Voice and video need low loss, and with LLQ, we put the voice +Chapter 11: Quality of Service (QoS) + +and video into a priority queue that will discard the excess messages beyond the bandwidth limit. The solution? Find a way to limit the amount of voice and video that the network routes out this link, so that the policer never discards any of the traffic. There are QoS tools to help you do just that, called Call Admission Control (CAC) tools. However, CAC tools did not get a mention in the exam topics, so this chapter leaves those tools at a brief mention. + +A Prioritization Strategy for Data, Voice, and Video +This section about queuing introduces several connected ideas, so before leaving the discus-sion of queuing, think about this strategy for how most enterprises approach queuing in their QoS plans: + +1. Use a round-robin queuing method like CBWFQ for data classes and for noninterac-tive voice and video. +2. If faced with too little bandwidth compared to the typical amount of traffic, give data classes that support business-critical applications much more guaranteed bandwidth than is given to less important data classes. +3. Use a priority queue with LLQ scheduling for interactive voice and video, to achieve low delay, jitter, and loss. +4. Put voice in a separate queue from video so that the policing function applies sepa-rately to each. +5. Define enough bandwidth for each priority queue so that the built-in policer should not discard any messages from the priority queues. +6. Use Call Admission Control (CAC) tools to avoid adding too much voice or video to the network, which would trigger the policer function. + +Shaping and Policing +This section introduces two related QoS tools—shaping and policing. These tools have a more specialized use and are not found in as many locations in a typical enterprise. These tools are most often used at the WAN edge in an enterprise network design. + +Both policing and shaping monitor the bit rate of the combined messages that flow through a device. Once enabled, the policer or shaper notes each packet that passes and measures the number of bits per second over time. Both attempt to keep the bit rate at or below the configured speed, but by using two different actions: policers discard packets, and shapers hold packets in queues to delay the packets. + +Shapers and policers monitor the traffic rate (the bits per second that move through the shaper or policer) versus a configured shaping rate or policing rate, respectively. The basic question that both ask is listed below, with the actions based on the answers: + +1. Does this next packet push the measured rate past the configured shaping rate or policing rate? +2. If no: + +245 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +11 + +a. Let the packet keep moving through the normal path and do nothing extra to the packet. +3. If yes: +a. If shaping, delay the message by queuing it. +b. If policing, either discard the message or mark it differently. +246 CCNA 200-301 Official Cert Guide, Volume 2 + +This section first explains policing, which discards or re-marks messages that exceed the policing rate, followed by shaping, which slows down messages that exceed the shaping rate. + +Policing +Focus on the traffic rate versus the configured policing rate for a moment, and the policing action of discarding messages. Those concepts sit at the core of what the policing function does. + +Traffic arrives at networking devices at a varying rate, with valleys and spikes. That is, if you graph the bit rate of the collective bits that enter or exit any interface, the graph would look something like the one on the left side of Figure 11-18. The policer would measure that rate and make a similar measurement. Still on the left side of the figure, the horizontal dashed line represents the policing rate, which is the rate configured for the policer. So, the policer has some awareness of the measured bit rate over time, which can be compared to the con-figured rate. + + +Incoming Measured Traffic Rate + + + +Policing Rate + +Outgoing Measured Traffic Rate +Burst + + +T=0 T=1 T=0 T=1 Figure 11-18 Effect of a Policer and Shaper on an Offered Traffic Load +The right side of the figure shows a graph of what happens to the traffic when a policer dis-cards any messages that would have otherwise pushed the rate over the configured policing rate. In effect, the policer chops off the top of the graph at the policing rate. + +The graph on the right also shows one example of a policer allowing a burst of traffic. Policers allow for a burst beyond the policing rate for a short time, after a period of low activity. So, that one peak that exceeds the policing rate on the graph on the right side allows for the nature of bursty data applications. + +Where to Use Policing +Now that you understand the basics of policing, take a moment to ponder. Policers moni-tor messages, measure a rate, and discard some messages. How does that help a network in regard to QoS? At first glance, it seems to hurt the network, discarding messages, many of which the transport or application layer will have to resend. How does that improve band-width, delay, jitter, or loss? + +Policing makes sense only in certain cases, and as a general tool, it can be best used at the edge between two networks. For instance, consider a typical point-to-point metro Ethernet WAN connection between two enterprise routers, R1 and R2. Usually, the enterprise net-work engineers just view the WAN as a cloud, with Ethernet interfaces on the routers, as shown at the top of Figure 11-19. +Chapter 11: Quality of Service (QoS) 247 + + +R1 G0/1 G0/2 R2 + + + +200 Mbps CIR + + +R1 G0/1 SW + +Police to 200 Mbps + +SW G0/2 R2 + +Police to 200 Mbps + +Figure 11-19 Ethernet WAN: Link Speed Versus CIR + +Now think about the contract for this MetroE connection, as shown at the bottom of Figure 11-19. In this case, this connection uses Gigabit Ethernet for the access links, and a 200-Mbps committed information rate (CIR). That is, the SP providing the WAN service agrees to allow the enterprise to send 200 Mbps of traffic in each direction. However, remember that the enterprise routers transmit the data at the speed of the access link, or 1 Gbps in this case. + +Think like the SP for a moment, and think about supporting tens of thousands of Gigabit Ethernet links into your WAN service, all with 200-Mbps CIRs. What would happen if you just let all those customers send data that, over time, averaged close to 1000 Mbps +(1 Gbps)? That is, if all customers kept sending data far beyond their contracted CIR, that much traffic could cause congestion in the WAN service. Also, those customers might choose to pay for a lower CIR, knowing that the SP would send the data anyway. And customers who were well behaved and did not send more data than their CIR might suffer from the congestion just as much as the customers who send far too much data. + +Figure 11-19 also notes the solution to the problem: The SP can police incoming packets, setting the policing rate to match the CIR that the customer chooses for that link. By doing so, the SP protects all customers from the negative effects of the customers who send too much traffic. Customers receive what they paid for. And the SP can provide reports of actu-al traffic rates, so the enterprise knows when to buy a faster CIR for each link. + +Policers can discard excess traffic, but they can also re-mark packets. Think again about what an SP does with an ingress policer, as shown in Figure 11-19: they are discarding their customers’ messages. So, the SP might want to make a compromise that works better for its customers, while still protecting the SP’s network. The SP could mark the messages with a +new marking value, with this strategy: 11 +1. Re-mark packets that exceed the policing rate, but let them into the SP’s network. +2. If other SP network devices are experiencing congestion when they process the pack-et, the different marking means that device can discard the packet. However… +3. …if no other SP network devices are experiencing congestion when forwarding that re-marked packet, it gets through the SP network anyway. + +With this strategy, the SP can treat their customers a little better by discarding less traffic, while still protecting the SP’s network during times of stress. +248 CCNA 200-301 Official Cert Guide, Volume 2 + +Summarizing the key features of policing: + +■ It measures the traffic rate over time for comparison to the configured policing rate. ■ It allows for a burst of data after a period of inactivity. +■ It is enabled on an interface, in either direction, but typically at ingress. +■ It can discard excess messages but can also re-mark the message so that it is a candidate for more aggressive discard later in its journey. + +Shaping +You have a 1-Gbps link from a router into a SP, but a 200-Mbps CIR for traffic to another site, as seen in Figure 11-19. The SP has told you that it always discards incoming traffic that exceeds the CIR. The solution? Use a shaper to slow down the traffic—in this case to a 200-Mbps shaping rate. + +That scenario—shaping before sending data to an SP that is policing—is one of the typical uses of a shaper. Shapers can be useful in other cases as well, but generally speaking, shapers make sense when a device can send at a certain speed, but there is a benefit to slowing down the rate. + +The shaper slows messages down by queuing the messages. The shaper then services the shaping queues, but not based on when the physical interface is available. Instead, the shaper schedules messages from the shaping queues based on the shaping rate, as shown in Figure 11-20. Following the left-to-right flow in the figure, for a router, the packet is routed out an interface; the shaper queues packets so that the sending rate through the shaper does not exceed the shaping rate; and then output queuing works as normal, if needed. + + +Router Internals + +Shaper + +Forwarding LLQ + +R1 +CBWFQ + + + + +At Shape Rate + + + + +Output Queuing + +Transmit + + + + +Figure 11-20 Shaping Queues: Scheduling with LLQ and CBWFQ + +Note that in some cases, the output queuing function has little to do. For instance, in the earlier example shown in Figure 11-19, the SP is policing incoming messages at 200 Mbps. If the router (R1, for instance) were to shape all traffic exiting toward the SP to 200 Mbps as well, with that 1-Gbps interface, the output queue would seldom if ever be congested. + +Because shapers create queues where messages wait, you should apply a queuing tool to those queues. It is perfectly normal to apply the round-robin and priority queuing features of CBWFQ and LLQ, respectively, to the shaping queues, as noted in the figure. +Chapter 11: Quality of Service (QoS) 249 + +Setting a Good Shaping Time Interval for Voice and Video +Once again, a QoS tool has attempted to solve one QoS problem but introduces another. The unfortunate side effect of a shaper is that it slows down packets, which then creates more delay and probably more jitter. The delay occurs in part because of the message sim-ply waiting in a queue, but partly because of the mechanisms used by a shaper. Thankfully, you can (and should) configure a shaper’s setting that changes the internal operation of the shaper, which then reduces the delay and jitter caused to voice and video traffic. + +A shaper’s time interval refers to its internal logic and how a shaper averages, over time, sending at a particular rate. A shaper basically sends as fast as it can and then waits; sends and waits; sends and waits. For instance, the policing and shaping example in this section suggests shaping at 200 Mbps on a router that has a 1000-Mbps (1-Gbps) outgoing interface. In that case, the shaper would result in the interface sending data 20 percent of the time and being silent 80 percent of the time. + +Figure 11-21 shows a graph of the shaping time interval concept, assuming a time interval of 1 second. To average 200 million bits per second, the shaper would allow 200 million bits to exit its shaping queues and exit the interface each second. Because the interface trans-mits bits at 1 Gbps, it takes just .2 seconds, or 200 ms, to send all 200 million bits. Then the shaper must wait for the rest of the time interval, another 800 ms, before beginning the next time interval. + + +Send: 1 Gbps 200 ms +200 Million Bits Sent + + + + +Wait: 800 ms + +Send: 200 ms + +200 Million Bits Sent + + + + +Wait: 800 ms + + +T= 0 T= 1 sec T= 2 sec 1 Second Time Interval +Figure 11-21 One Second (1000 ms) Shaping Time Interval, Shaping at 20 Percent of Line Rate + +Now think about a voice or video packet that needs very low delay and jitter—and unfortu-nately, it arrives just as the shaper finishes sending data for a time interval. Even if that voice or video packet is in a priority shaping queue, the packet will wait 800 ms before the shaper +schedules the next packet—far too long compared to the 150-ms one-way delay goal for voice. 11 +The solution to this problem: configure a short time interval. For example, consider the fol-lowing time intervals (abbreviated Tc), and their effects, for this same example (1-Gbps link, shaping to 200 Mbps), but with shorter and shorter time intervals: + +Tc = 1 second (1000 ms): Send at 1 Gbps for 200 ms, rest for 800 ms Tc = .1 second (100 ms): Send at 1 Gbps for 20 ms, rest for 80 ms +Tc = .01 second (10 ms): Send at 1 Gbps for 2 ms, rest for 8 ms + +When shaping, use a short time interval. By recommendation, use a 10-ms time interval to support voice and video. With that setting, a voice or video packet should wait no more than 10 ms while waiting for the next shaping time interval, at which point the priority queue scheduling should take all the voice and video messages next. +250 CCNA 200-301 Official Cert Guide, Volume 2 + +Summarizing the key features of shapers: + +■ Shapers measure the traffic rate over time for comparison to the configured shaping rate. ■ Shapers allow for bursting after a period of inactivity. +■ Shapers are enabled on an interface for egress (outgoing packets). +■ Shapers slow down packets by queuing them and over time releasing them from the queue at the shaping rate. +■ Shapers use queuing tools to create and schedule the shaping queues, which is very important for the same reasons discussed for output queuing. + +Congestion Avoidance +The QoS feature called congestion avoidance attempts to reduce overall packet loss by pre-emptively discarding some packets used in TCP connections. To see how it works, you first need to look at how TCP works in regard to windowing and then look at how congestion avoidance features work. + +TCP Windowing Basics +TCP uses a flow control mechanism called windowing. Each TCP receiver grants a window to the sender. The window, which is a number, defines the number of bytes the sender can send over the TCP connection before receiving a TCP acknowledgment for at least some of those bytes. More exactly, the window size is the number of unacknowledged bytes that the sender can send before the sender must simply stop and wait. + +The TCP window mechanism gives the receiver control of the sender’s rate of sending data. Each new segment sent by the receiver back to the sender grants a new window, which can be smaller or larger than the previous window. By raising and lowering the window, the receiver can make the sender wait more or wait less. + +NOTE Each TCP connection has two senders and two receivers; that is, each host sends and receives data. For this discussion, focus on one direction, with one host as the sender and the other as the receiver. If calling one host the “sender” and one the “receiver,” note that the receiver then acknowledges data in TCP segments sent back to the sender by the receiver. + +By choice, when all is well, the receiver keeps increasing the granted window, doubling it every time the receiver acknowledges data. Eventually, the window grows to the point that the sender never has to stop sending: the sender keeps receiving TCP acknowledgments before sending all the data in the previous window. Each new acknowledgment (as listed in a TCP segment and TCP header) grants a new window to the sender. + +Also by choice, when a TCP receiver senses the loss of a TCP segment, he shrinks the win-dow with the next window size listed in the next TCP segment the receiver sends back to the sender. For each TCP segment lost, the window can shrink by one-half, with multiple segment losses causing the window to shrink by half multiple times, slowing down the sender’s rate significantly. + +Now think about router queues for a moment. Without a congestion avoidance tool, an event called a tail drop causes the most drops in a network. Figure 11-22 shows the idea, +Chapter 11: Quality of Service (QoS) 251 + +showing the same queuing system, but in three separate conditions—little congestion, medium congestion, and much congestion. On the left, with little congestion, the output queues on an interface have not yet filled. In the middle, the queues have started to fill, with one queue being totally full. Any new packets that arrive for that queue right now will be dropped because there is no room at the tail of the queue (tail drop). + +1 Little Congestion 2 Medium Congestion 3 Much Congestion + + + + + + +Tail Drop Tail Drop + + +Figure 11-22 Tail Drop Concepts with Three Different Scenarios + + +The worse the congestion in the queues, the more likely tail drop will occur, as shown with the most congested case on the right side of the figure. The more congestion, the bigger the negative impact on traffic—both in terms of loss and in terms of increasing delay in TCP connections. + +Congestion Avoidance Tools +Congestion avoidance tools attempt to avoid the congestion, primarily through using TCP’s own windowing mechanisms. These tools discard some TCP segments before the queues fill, hoping that enough TCP connections will slow down, reducing congestion, and avoid-ing a much worse problem: the effects of many more packets being dropped due to tail drop. The strategy is simple: discard some now in hopes that the device discards far fewer in the long term. + +Congestion avoidance tools monitor the average queue depth over time, triggering more severe actions the deeper the queue, as shown in Figure 11-23. The height of the box rep-resents the queue depth, or the number of packets in the queue. When the queue depth is low, below the minimum threshold values, the congestion avoidance tool does nothing. +When the queue depth is between the minimum and maximum thresholds, the congestion avoidance tool discards a percentage of the packets—usually a small percentage, like 5, 10, or 20 percent. If the queue depth passes the maximum threshold, the tool drops all packets, in an action called full drop. +Of course, like all the QoS tools mentioned in this chapter, congestion avoidance tools can classify messages to treat some packets better than others. In the same queue, packets with one marking might be dropped more aggressively, and those with better DSCP markings dropped less aggressively. + + + + + + + + + + + + + + + + + + + +11 +252 CCNA 200-301 Official Cert Guide, Volume 2 + +Queue Full + +Full Drops + +Maximum Threshold + + +% Drops + + +Minimum Threshold + +No Drops + +Queue Empty +Figure 11-23 Mechanisms of Congestion Avoidance + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 11-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 11-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions Review memory tables +Watch video + +Resource Used Book, website Book, website Book, PTP Book, website +website + + +Review All the Key Topics Table 11-5 Key Topics for Chapter 11 + +Key Topic Element List +List List +Figure 11-6 Figure 11-7 Figure 11-10 Figure 11-14 +Figure 11-17 + +Description +Four QoS characteristics Voice call QoS requirements Video QoS requirements +IP Precedence and IP DSCP marking fields 802.1Q CoS marking field +Trust boundary with IP Phones Queuing components +LLQ scheduling logic with a priority queue + +Page Number 228 +232 232 237 238 239 242 +244 +Chapter 11: Quality of Service (QoS) 253 + + +Key Topic Element List + +List List +List + +Description +A strategy for using queuing (congestion management) to prioritize traffic +Logic steps for shapers and policers Key features of policers +Key features of shapers + +Page Number 245 + +245 248 +250 + + +Key Terms You Should Know +per-hop behavior (PHB), marking, classification, Quality of Service (QoS), IP Precedence (IPP), Differentiated Services Code Point (DSCP), Class of Service (CoS), bandwidth, delay, jitter, loss, queuing, priority queue, round robin, policing, shaping, Differentiated Services (DiffServ), policing rate, shaping rate + + + + + + + + + + + + + + + + + + + + + + +11 +CHAPTER 12 + + + +Miscellaneous IP Services This chapter covers the following exam topics: +3.0 IP Connectivity +3.5 Describe the purpose of First Hop Redundancy Protocol + +4.0 Infrastructure Services +4.4 Explain the function of SNMP in network operations + +4.9 Describe the capabilities and function of TFTP/FTP in the network + + +When reading this chapter, think of it as three separate small topics rather than one large topic. The content just happens to include a few IP-based services that have little to do with each other, but the length of coverage of each topic is too short to justify a separate chap-ter. The result: Chapter 12, “Miscellaneous IP Services.” So when reading, feel free to treat each of the three major headings as a separate study event. + +First Hop Redundancy Protocols (FHRPs), which provides redundancy for the function of the default router in any subnet, begins the chapter. The term FHRP refers to a class of solutions, with three options, and with the examples showing the most popular option, Hot Standby Router Protocol (HSRP). + +Simple Network Management Protocol (SNMP) follows in the second major section. As per the associated exam topic, this section focuses on SNMP concepts rather than configura-tion, including how managed devices—SNMP agents—can be interrogated by network management systems—SNMP clients—to find the current status of each device. + +File Transfer Protocol (FTP) and Trivial File Transfer Protocol (TFTP) star in the third major section. The first branch of this section focuses on a few practical uses of TFTP and FTP, specifically how to use these protocols on Cisco routers to upgrade the IOS. Armed with that practical knowledge, you then look at the protocol details of both FTP and TFTP in the rest of the section. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 12-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section First Hop Redundancy Protocol +Simple Network Management Protocol +FTP and TFTP + +Questions 1–3 +4, 5 +6, 7 + + +1. R1 and R2 attach to the same Ethernet VLAN, with subnet 10.1.19.0/25, with addresses 10.1.19.1 and 10.1.19.2, respectively, configured with the ip address inter-face subcommand. Host A refers to 10.1.19.1 as its default router, and host B refers to 10.1.19.2 as its default router. The routers do not use an FHRP. Which of the fol-lowing is a problem for this LAN? +a. The design breaks IPv4 addressing rules because two routers cannot connect to the same LAN subnet. +b. If one router fails, neither host can send packets off-subnet. +c. If one router fails, both hosts will use the one remaining router as a default router. +d. If one router fails, the host that uses that router as a default router cannot send packets off-subnet. + +2. R1 and R2 attach to the same Ethernet VLAN, with subnet 10.1.19.0/25, with addresses 10.1.19.1 and 10.1.19.2, respectively, configured with the ip address inter-face subcommand. The routers use an FHRP. Host A and host B attach to the same LAN and have correct default router settings per the FHRP configuration. Which of the following statements is true for this LAN? +a. The design breaks IPv4 addressing rules because two routers cannot connect to the same LAN subnet. +b. If one router fails, neither host can send packets off-subnet. +c. If one router fails, both hosts will use the one remaining router as a default router. +d. If one router fails, only one of the two hosts will still be able to send packets off-subnet. + +3. R1 and R2 attach to the same Ethernet VLAN, with subnet 10.1.19.0/25, with addresses 10.1.19.1 and 10.1.19.2, respectively, configured with the ip address inter-face subcommand. The routers use HSRP. The network engineer prefers to have R1 be the default router when both R1 and R2 are up. Which of the following is the likely default router setting for hosts in this subnet? +a. 10.1.19.1 b. 10.1.19.2 +c. Another IP address in subnet 10.1.19.0/25 other than 10.1.19.1 and 10.1.19.2 d. A host name that the FHRP mini-DNS will initially point to 10.1.19.1 +256 CCNA 200-301 Official Cert Guide, Volume 2 + +4. A Network Management Station (NMS) is using SNMP to manage some Cisco rout-ers and switches with SNMPv2c. Which of the following answers most accurately describes how the SNMP agent on a router authenticates any SNMP Get requests received from the NMS? +a. Using a username and hashed version of a password +b. Using either the read-write or read-only community string c. Using only the read-write community string +d. Using only the read-only community string + +5. Which of the following SNMP messages are typically sent by an SNMP agent? a. Trap +b. Get Request c. Inform +d. Set Request + +6. An FTP client connects to an FTP server using active mode and retrieves a copy of a file from the server. Which of the answers describes a TCP connection initiated by the FTP client? +a. The FTP control connection b. The FTP data connection +c. The FTP TLS connection +d. None of the other answers are correct. + +7. Which of the following functions are supported by FTP but not by TFTP? (Choose two answers.) + +a. Transferring files from client to server +b. Changing the current directory on the server c. Transferring files from server to client +d. Listing directory contents of a server’s directory + + +Foundation Topics + +First Hop Redundancy Protocol +When networks use a design that includes redundant routers, switches, LAN links, and WAN links, in some cases other protocols are required to take advantage of that redundan-cy and to prevent problems caused by it. + +For instance, imagine a WAN with many remote branch offices. If each remote branch has two WAN links connecting it to the rest of the network, those routers can use an IP routing protocol to pick the best routes. The routing protocol learns routes over both WAN links, adding the best route into the routing table. When the better WAN link fails, the routing protocol adds the alternate route to the IP routing table, taking advantage of the redundant link. +Chapter 12: Miscellaneous IP Services 257 + +As another example, consider a LAN with redundant links and switches. Those LANs have problems unless the switches use Spanning Tree Protocol (STP) or Rapid STP (RSTP). STP/RSTP prevents the problems created by frames that loop through those extra redun-dant paths in the LAN. + +This section examines yet another type of protocol that helps when a network uses some redundancy, this time with redundant default routers. When two or more routers connect to the same LAN subnet, all those routers could be used as the default router for the hosts in the subnet. However, to make the best use of the redundant default routers, another pro-tocol is needed. The term First Hop Redundancy Protocol (FHRP) refers to the category of protocols that can be used so that the hosts take advantage of redundant routers in a subnet. + +This first major section of the chapter discusses the major concepts behind how different FHRPs work. This section begins by discussing a network’s need for redundancy in general and the need for redundant default routers. It then shows how the three available FHRP options can each solve the problems that occur when using redundant default routers. + +The Need for Redundancy in Networks +Networks need redundant links to improve the availability of those networks. Eventually, something in a network will fail. A router power supply might fail, or a cable might break, or a switch might lose power. And those WAN links, shown as simple lines in most drawings in this book, are actually the most complicated physical parts of the network, with many individual parts that can fail as well. + +Depending on the design of the network, the failure of a single component might mean an outage that affects at least some part of the user population. Network engineers refer to any one component that, if it fails, brings down that part of the network as a single point of failure. For instance, in Figure 12-1, the LANs appear to have some redundancy, whereas the WAN does not. If most of the traffic flows between sites, many single points of failure exist, as shown in the figure. + +VLAN 10 Single Points of Failure Subnet 10.1.1.0/24 + +SW3 SW1 .9 R1 R3 +Default GW=.9 + + +SW4 SW2 + +Figure 12-1 R1 and the One WAN Link as Single Points of Failure 12 The figure notes several components as a single point of failure. If any one of the noted +parts of the network fails, packets cannot flow from the left side of the network to the right. + +Generally speaking, to improve availability, the network engineer first looks at a design and finds the single points of failure. Then the engineer chooses where to add to the network so +258 CCNA 200-301 Official Cert Guide, Volume 2 + +that one (or more) single point of failure now has redundant options, increasing availability. In particular, the engineer + +■ Adds redundant devices and links +■ Implements any necessary functions that take advantage of the redundant device or link + +For instance, of all the single points of failure in Figure 12-1, the most expensive over the long term would likely be the WAN link because of the ongoing monthly charge. However, statistically, the WAN links are the most likely component to fail. So, a reasonable upgrade from the network in Figure 12-1 would be to add a WAN link and possibly even connect to another router on the right side of the network, as shown in Figure 12-2. + +VLAN 10 Single Points of Failure Subnet 10.1.1.0/24 + +SW3 SW1 .9 R1 R3 +Default GW=.9 + + +SW4 SW2 R4 Remote Main Site +Figure 12-2 Higher Availability but with R1 Still as a Single Point of Failure +Many real enterprise networks follow designs like Figure 12-2, with one router at each remote site, two WAN links connecting back to the main site, and redundant routers at the main site (on the right side of the figure). Compared to Figure 12-1, the design in Figure 12-2 has fewer single points of failure. Of the remaining single points of failure, a risk +remains, but it is a calculated risk. For many outages, a reload of the router solves the prob-lem, and the outage is short. But the risk still exists that the switch or router hardware fails completely and requires time to deliver a replacement device on-site before that site can work again. + +For enterprises that can justify more expense, the next step in higher availability for that remote site is to protect against those catastrophic router and switch failures. In this par-ticular design, adding one router on the left side of the network in Figure 12-2 removes all the single points of failure that had been noted earlier. Figure 12-3 shows the design with a second router, which connects to a different LAN switch so that SW1 is also no longer a single point of failure. + +NOTE Medium to large enterprise networks work hard at striking a balance of high-avail-ability features versus the available budget dollars. Cisco.com has many design documents that discuss trade-offs in high-availability design. If interested in learning more, search Cisco.com for “high availability campus network design.” + + + +Answers to the “Do I Know This Already?” quiz: 1 D 2 C 3 C 4 B 5 A, C 6 A 7 B, D +Chapter 12: Miscellaneous IP Services 259 + +VLAN 10 +Subnet 10.1.1.0/24 + + + +SW3 +Default GW=.9 + + +SW4 + +G0/0 +SW1 .9 R1 R3 + + + +G0/1 +SW2 .129 R2 R4 + +Figure 12-3 Removing All Single Points of Failure from the Network Design + +The Need for a First Hop Redundancy Protocol +Of the designs shown so far in this chapter, only Figure 12-3’s design has two routers to support the LAN on the left side of the figure, specifically the same VLAN and subnet. While having the redundant routers on the same subnet helps, the network needs to use an FHRP when these redundant routers exist. + +To see the need and benefit of using an FHRP, first think about how these redundant rout-ers could be used as default routers by the hosts in VLAN 10/subnet 10.1.1.0/24, as shown in Figure 12-4. The host logic will remain unchanged, so each host has a single default rout-er setting. So, some design options for default router settings include the following: + +■ All hosts in the subnet use R1 (10.1.1.9) as their default router, and they statically recon-figure their default router setting to R2’s 10.1.1.129 if R1 fails. +■ All hosts in the subnet use R2 (10.1.1.129) as their default router, and they statically reconfigure their default router setting to R1’s 10.1.1.9 if R2 fails. +■ Half the hosts use R1, and half use R2, as their default router, and if either router fails, that half of the users statically reconfigure their default router setting. + +To make sure the concept is clear, Figure 12-4 shows this third option, with half the hosts using R1 and the other half using R2. The figure removes all the LAN switches just to unclutter the figure. Hosts A and B use R1 as their default router, and hosts C and D use R2 as their default router. + +VLAN10, Subnet 10.1.1.0/24 + + +GW=.9 A + +GW=.9 B + +GW=.129 C + +GW=.129 D + +G0/0 +.9 R1 R3 + + +12 + + +G0/1 +.129 R2 R4 + + +Figure 12-4 Balancing Traffic by Assigning Different Default Routers to Different Clients +260 CCNA 200-301 Official Cert Guide, Volume 2 + +All of these options have a problem: the users have to take action. They have to know an outage occurred. They have to know how to reconfigure their default router setting. And they have to know when to change it back to the original setting. + +FHRPs make this design work better. The two routers appear to be a single default router. The users never have to do anything: their default router setting remains the same, and their ARP table even remains the same. + +To allow the hosts to remain unchanged, the routers have to do some more work, as defined by one of the FHRP protocols. Generically, each FHRP makes the following happen: + +1. All hosts act like they always have, with one default router setting that never has to change. +2. The default routers share a virtual IP address in the subnet, defined by the FHRP. 3. Hosts use the FHRP virtual IP address as their default router address. +4. The routers exchange FHRP protocol messages so that both agree as to which router does what work at any point in time. +5. When a router fails or has some other problem, the routers use the FHRP to choose which router takes over responsibilities from the failed router. + +The Three Solutions for First-Hop Redundancy +The term First Hop Redundancy Protocol does not name any one protocol. Instead, it names a family of protocols that fill the same role. For a given network, like the left side of Figure 12-4, the engineer would pick one of the protocols from the FHRP family. + +NOTE First Hop is a reference to the default router being the first router, or first router hop, through which a packet must pass. + +Table 12-2 lists the three FHRP protocols in chronological order, based on when these were first used. Cisco first introduced the proprietary Hot Standby Router Protocol (HSRP), and it worked well for many of its customers. Later, the IETF developed an RFC for a similar protocol, Virtual Router Redundancy Protocol (VRRP). Finally, Cisco developed a more robust option, Gateway Load Balancing Protocol (GLBP). + +Table 12-2 Three FHRP Options + +Acronym + +HSRP VRRP + +GLBP + +Full Name + +Hot Standby Router Protocol +Virtual Router Redundancy Protocol +Gateway Load Balancing Protocol + +Origin + +Cisco RFC 5798 + +Cisco + +Redundancy Approach +active/standby active/standby + +active/active + +Load Balancing Per… +subnet subnet + +host + + +This chapter focuses on HSRP and does not discuss VRRP and GLBP other than this brief mention. HSRP, the first of the three FHRP protocols to enter the market, remains a popu-lar option in many networks. The current CCNA 200-301 exam requires you to know the functions of an FHRP, so the example of HSRP meets that need, with the next few pages walking through the concepts of how HSRP works. (Note that Appendix D, “Topics from +Chapter 12: Miscellaneous IP Services 261 + +Previous Editions,” contains a section with more depth about GLBP, copied from an earlier edition of the book, as well as a section on HSRP configuration if you are interested in reading more that goes beyond the current exam’s topics.) + +HSRP Concepts +HSRP operates with an active/standby model (also more generally called active/passive). HSRP allows two (or more) routers to cooperate, all being willing to act as the default router. However, at any one time, only one router actively supports the end-user traffic. The packets sent by hosts to their default router flow to that one active router. Then the +other routers, with an HSRP standby state, sit there patiently waiting to take over should the active HSRP router have a problem. + +The HSRP active router implements a virtual IP address and matching virtual MAC address. This virtual IP address exists as part of the HSRP configuration, which is an additional con-figuration item compared to the usual ip address interface subcommand. This virtual IP address is in the same subnet as the interface IP address, but it is a different IP address. The router then automatically creates the virtual MAC address. All the cooperating HSRP rout-ers know these virtual addresses, but only the HSRP active router uses these addresses at any one point in time. + +Hosts refer to the virtual IP address as their default router address, instead of any one router’s interface IP address. For instance, in Figure 12-5, R1 and R2 use HSRP. The HSRP virtual IP address is 10.1.1.1, with the virtual MAC address referenced as VMAC1 for sim-plicity’s sake. + +Subnet 10.1.1.0/24 HSRP Active + +GW=.1 A .1 +VMAC1 R1 R3 + +GW=.1 B +HSRP GW=.1 C + +GW=.1 D +R2 R4 +HSRP Standby + +Host ARP Table +IP MAC +10.1.1.1 VMAC1 +Figure 12-5 All Traffic Goes to .1 (R1, Which Is Active); R2 Is Standby 12 + +HSRP Failover +HSRP on each router has some work to do to make the network function as shown in Figure 12-5. The two routers need HSRP configuration, including the virtual IP address. The two routers send HSRP messages to each other to negotiate and decide which router should currently be active and which should be standby. Then the two routers continue to send messages to each other so that the standby router knows when the active router fails so that it can take over as the new active router. +262 CCNA 200-301 Official Cert Guide, Volume 2 + +Figure 12-6 shows the result when R1, the HSRP active router in Figure 12-5, fails. R1 quits using the virtual IP and MAC address, while R2, the new active router, starts using these addresses. The hosts do not need to change their default router settings at all, with traffic now flowing to R2 instead of R1. + +No Change + + +GW=.1 A + +GW=.1 B + +GW=.1 C + +GW=.1 D + +.1 +.9 R1 R3 VMAC1 + + + +VMAC1 .1 +.129 R2 R4 + +HSRP Active + +Host ARP Table + +IP MAC 10.1.1.1 VMAC1 + + +No Change + +Figure 12-6 Packets Sent Through R2 (New Active) Once It Takes Over for Failed R1 + +When the failover happens, some changes do happen, but none of those changes happen on the hosts. The host keeps the same default router setting, set to the virtual IP address (10.1.1.1 in this case). The host’s ARP table does not have to change either, with the HSRP virtual MAC being listed as the MAC address of the virtual router. + +When the failover occurs, changes happen on both the routers and the LAN switches. Clearly, the new active router has to be ready to receive packets (encapsulated inside frames) using the virtual IP and MAC addresses. However, the LAN switches, hidden in the last few figures, formerly sent frames destined for VMAC1 to router R1. Now the switches must know to send the frames to the new active router, R2. +To make the switches change their MAC address table entries for VMAC1, R2 sends an Ethernet frame with VMAC1 as the source MAC address. The switches, as normal, learn the source MAC address (VMAC1), but with new ports that point toward R2. The frame is also a LAN broadcast, so all the switches learn a MAC table entry for VMAC1 that leads toward R2. (By the way, this Ethernet frame holds an ARP Reply message, called a gratuitous ARP, because the router sends it without first receiving an ARP Request.) + +HSRP Load Balancing +The active/standby model of HSRP means that in one subnet all hosts send their off-subnet packets through only one router. In other words, the routers do not share the workload, with one router handling all the packets. For instance, back in Figure 12-5, R1 was the active router, so all hosts in the subnet sent their packets through R1, and none of the hosts in the subnet sent their packets through R2. + +HSRP does support load balancing by preferring different routers to be the active router in different subnets. Most sites that require a second router for redundancy are also big +Chapter 12: Miscellaneous IP Services 263 + +enough to use several VLANs and subnets at the site. The two routers will likely connect to all the VLANs, acting as the default router in each VLAN. HSRP then can be configured to prefer one router as active in one VLAN and another router as active in another VLAN, balancing the traffic. Or you can configure multiple instances of HSRP in the same subnet +(called multiple HSRP groups), preferring one router to be active in one group and the other router to be preferred as active in another. + +For instance, Figure 12-7 shows a redesigned LAN, now with two hosts in VLAN 1 and two hosts in VLAN 2. Both R1 and R2 connect to the LAN, and both use a VLAN trunking and router-on-a-stick (ROAS) configuration. Both routers use HSRP in each of the two sub-nets, supporting each other. However, on purpose, R1 has been configured so that it wins the negotiation to become HSRP active in VLAN 1, and R2 has been configured to win in VLAN 2. + + +VLAN 1 +Subnet 10.1.1.0/24 + +A GW= +10.1.1.1 B SW3 + + +Active Subnet 1 Standby Subnet 2 + +10.1.1.1 +SW1 R1 + + +HSRP + +C GW= +10.1.2.1 D SW4 SW2 10.1.2.1 R2 + +VLAN 2 +Subnet 10.1.2.0/24 + +Active Subnet 2 Standby Subnet 1 + +Figure 12-7 Load Balancing with HSRP by Using Different Active Routers per Subnet + + +Note that by having each router act as the HSRP active router in some subnets, the design makes use of both routers and both WAN links. + +FHRPs are needed on any device that acts as a default router, which of course includes both traditional routers and Layer 3 switches. HSRP can be configured on routers and Layer 3 switches on interfaces that have IP addresses configured. However, in most cases, HSRP is used on interfaces to subnets that have hosts that need to use a default router. Those inter-faces include router physical interfaces, router trunk subinterfaces, and Layer 3 switched virtual interfaces (SVI). + +Simple Network Management Protocol +In 1988, RFC 1065, “Structure and Identification of Management Information for TCP/IP-based Internets,” was published. The idea behind this document was the fact that +information about devices on a TCP/IP-based network—configuration settings, status infor-mation, counters, and so on—could be broken down into a database of variables. Those vari-ables could then be collected by management software to monitor and manage the IP-based network. After all, the elements of any IP-based machines would have commonalities. For example, a PC, a network printer, and a router would all have commonalities such as interfac-es, IP addresses, and buffers. Why not create a standardized database of these variables and a simple system for monitoring and managing them? This idea was brilliant, caught on, and became what we know today as Simple Network Management Protocol (SNMP). + + + + + + + + + + + + + +12 +264 CCNA 200-301 Official Cert Guide, Volume 2 + +This second of three major sections of the chapter now turns our attention to SNMP by looking at the major concepts along with the two common versions used today: SNMPv2c and SNMPv3. + +SNMP is an application layer protocol that provides a message format for communication between what are termed managers and agents. An SNMP manager is a network manage-ment application running on a PC or server, with that host typically being called a Network Management Station (NMS). Many SNMP agents exist in the network, one per device that is managed. The SNMP agent is software running inside each device (router, switch, and so on), with knowledge of all the variables on that device that describe the device’s configura-tion, status, and counters. The SNMP manager uses SNMP protocols to communicate with each SNMP agent. + +Each agent keeps a database of variables that make up the parameters, status, and counters for the operations of the device. This database, called the Management Information Base (MIB), has some core elements in common across most networking devices. It also has a large number of variables unique to that type of device—for instance, router MIBs will include variables not needed on switch MIBs, and vice versa. (For perspective, I did a quick check on a router when writing this section and found a little over 7000 MIB variables on a router.) + +Figure 12-8 connects a few of these ideas and terms together. First, many companies sell SNMP management products—for example, the Cisco Prime series of management prod-ucts (www.cisco.com/go/prime) use SNMP (and other protocols) to manage networks. IOS on routers and switches include an SNMP agent, with built-in MIB, that can be enabled with the configuration shown later in this chapter. + +The MIB + + + + + +The SNMP Manager (i.e. Cisco Prime) + +The Cisco Router and SNMP Agent Software + +Figure 12-8 Elements of Simple Network Management Protocol + +SNMP Variable Reading and Writing: SNMP Get and Set +The NMS typically polls the SNMP agent on each device. The NMS can notify the human user in front of the PC or send emails, texts, and so on to notify the network operations staff of any issues identified by the data found by polling the devices. You can even reconfigure the device through these SNMP variables in the MIB if you permit this level of control. + +Specifically, the NMS uses the SNMP Get, GetNext, and GetBulk messages (together ref-erenced simply as Get messages) to ask for information from an agent. The NMS sends an SNMP Set message to write variables on the SNMP agent as a means to change the configu-ration of the device. These messages come in pairs, with, for instance, a Get Request asking the agent for the contents of a variable, and the Get Response supplying that information. Figure 12-9 shows an example of a typical flow, with the NMS using an SNMP Get to ask for the MIB variable that describes the status of a particular router interface. +Chapter 12: Miscellaneous IP Services 265 + + +I want to check the MIB variable to find out if Gi0/0 is UP/UP + + +1 SNMP Get Request + +2 SNMP Get Response + +The MIB + + + +Gi0/0 Router 1 + +Figure 12-9 SNMP Get Request and Get Response Message Flow + +SNMP permits much flexibility in how you monitor variables in the MIB. Most commonly, a network administrator gathers and stores statistics over time using the NMS. The NMS, with the stored data, can then analyze various statistical facts such as averages, minimums, and maximums. To be proactive, administrators can set thresholds for certain key variables, telling the NMS to send a notification (email, text, and so on) when a threshold is passed. + +SNMP Notifications: Traps and Informs +In addition to asking for information with Get commands and setting variables on agents with the Set command, SNMP agents can initiate communications to the NMS. These mes-sages, generally called notifications, use two specific SNMP messages: Trap and Inform. SNMP agents send a Trap or Inform SNMP message to the NMS to list the state of certain MIB variables when those variables reach a certain state. + +As an example of a Trap, suppose that Router 1’s G0/0 interface fails, as shown at step 1 of Figure 12-10. With Traps configured, the router would send an SNMP Trap message to the NMS, with that Trap message noting the down state of the G0/0 interface. Then, the NMS software can send a text message to the network support staff, pop up a window on the NMS screen, change the color of the correct router icon to red on the graphical interface, and so on. + + +Send text, Turn Red, Etc. + +3 + +My Gi0/0 Interface Failed! Take a Look! +The MIB + +SNMP Trap 2 + + +Gi0/0 Router 1 1 +Figure 12-10 SNMP Trap Notification Process +SNMP Traps and Inform messages have the exact same purpose but differ in the protocol 12 mechanisms. SNMP Traps, available since the first version of SNMP from the late 1980s +(SNMP Version 1, or SNMPv1), use a fire-and-forget process. The SNMP agent sends the Trap to the IP address of the NMS, with UDP as the transport protocol as with all SNMP messages, and with no application layer error recovery. If the Trap arrives, great; if it is lost in transit, it is lost. + +Inform messages are like Trap messages but with reliability added. Added to the protocol with SNMP Version 2 (SNMPv2), Informs still use UDP but add application layer reliability. +266 CCNA 200-301 Official Cert Guide, Volume 2 + +The NMS must acknowledge receipt of the Inform with an SNMP Response message, or the SNMP agent will time out and resend the Inform. + +Note that Traps and Informs both have a useful role today, and Traps are still frequently used. Both inform the NMS. Traps use less overhead on the agent, while Informs improve reliability of the messages but require a little more overhead effort. + +The Management Information Base +Every SNMP agent has its own Management Information Base. The MIB defines variables whose values are set and updated by the agent. The MIB variables on the devices in the net-work enable the management software to monitor/control the network device. + +More formally, the MIB defines each variable as an object ID (OID). On most devices, the MIB then organizes the OIDs based in part on RFC standards, and in part with vendor-proprietary variables. The MIB organizes all the variables into a hierarchy of OIDs, usu-ally shown as a tree. Each node in the tree can be described based on the tree structure sequence, either by name or by number. Figure 12-11 shows a small part of the tree struc-ture of an MIB that happens to be part of the Cisco-proprietary part of the MIB. + +iso (1). + +org (3). + +dod (6). + +internet (1). + +private (4). + +enterprises (1). + +cisco (9). + + + +local variables (2). + +interface group (2). + +1.3.6.1.4.1.9.2.2 + +cisco mgmt (9). + +cisco flash group (10). + +1.3.6.1.4.1.9.9.10 + +Figure 12-11 Management Information Base (MIB) + +Working directly with an MIB, with long variable names and numbers, can be a bit of a challenge, so NMS software typically hides the complexity of the MIB variable number-ing and names. However, to get a sense for the variable names, Figure 12-11 shows the tree structure for two variables, with the variable names being the long string of numbers shown at the bottom of the figure. Working with those numbers and the tree structure can be difficult at best. As a result, most people manage their networks using an NMS such +as Cisco Prime. For perspective, you could use an SNMP manager and type MIB variable 1.3.6.1.4.1.9.2.1.58.0 and click a button to get that variable, to see the current CPU usage percentage from a Cisco router. However, most users of an NMS would much prefer to +Chapter 12: Miscellaneous IP Services 267 + +ignore those details and have a simple graphical interface to ask for the same information, never having to know that 1.3.6.1.4.9.2.1.58.0 represents the router CPU utilization MIB variable. + +Securing SNMP +SNMP supports a few security mechanisms, depending in part on the particular version. This section works through the options. + +First, one strong method to secure SNMP is to use ACLs to limit SNMP messages to those from known servers only. SNMP agents on Cisco routers and switches support SNMP mes-sages that flow in both IPv4 and IPv6 packets. The SNMP agent can configure an IPv4 ACL to filter incoming SNMP messages that arrive in IPv4 packets and an IPv6 ACL to filter SNMP messages that arrive in IPv6 packets. + +Using an IPv4 and IPv6 ACL to secure an agent makes good sense. The only hosts that should be sending SNMP messages to the SNMP agent in a router or switch are the NMS hosts. Those NMS hosts seldom move and their IP addresses should be well known to the networking staff. It makes good sense to configure an ACL that permits packets sourced from the IP addresses of all NMS hosts, but no others. + +As for the SNMP protocol messages, all versions of SNMP support a basic clear-text pass-word mechanism, although none of those versions refer to the mechanism as using a pass-word. SNMP Version 3 (SNMPv3) adds more modern security as well. + +SNMPv1 defined clear-text passwords called SNMP communities. Basically, both the SNMP agent and the SNMP manager need prior knowledge of the same SNMP community value (called a community string). The SNMP Get messages and the Set message include the appropriate community string value, in clear text. If the NMS sends a Get or Set with the correct community string, as configured on the SNMP agent, the agent processes the message. + +SNMPv1 defines both a read-only community and a read-write community. The read-only (RO) community allows Get messages, and the read-write (RW) community allows both reads and writes (Gets and Sets). Figure 12-12 shows the concepts. At steps 1 and 2, the agent is configured with particular RO and RW community strings, and the NMS configures the matching values. At step 3, the SNMP Get can flow with either community, but at Step 4, the Set Request must use the RW community. + +NMS +3 Get (Pass1 or Pass2 Works) + + +4 Set (Pass2 Only Works) + + +2 R1 RO Pass1 R1 RW Pass2 + + +R1 + +12 +1 R1 RO Pass1 R1 RW Pass2 + +Figure 12-12 RO and RW Communities with the Get and Set Commands + +SNMPv2, and the related Community-based SNMP Version 2 (SNMPv2c), added a wrinkle in naming but basically kept the same community security feature as SNMPv1 once the standards process completed. The original specifications for SNMPv2 did not include SNMPv1 communities; however, the marketplace still wanted communities, so an additional +268 CCNA 200-301 Official Cert Guide, Volume 2 + +RFC added the SNMPv1 communities mechanism back to SNMPv2. This updated RFC, “Community-based SNMPv2,” came to be known simply as SNMPv2c. Vendors (including Cisco) implemented SNMPv2c; however, security was still relatively weak. + +SNMPv3 arrived with much celebration among network administrators. Finally, security had arrived with the powerful network management protocol. SNMPv3 does away with commu-nities and replaces them with the following features: + +■ Message integrity: This mechanism, applied to all SNMPv3 messages, confirms whether or not each message has been changed during transit. +■ Authentication: This optional feature adds authentication with both a username and password, with the password never sent as clear text. Instead, it uses a hashing method like many other modern authentication processes. +■ Encryption (privacy): This optional feature encrypts the contents of SNMPv3 messages so that attackers who intercept the messages cannot read their contents. + +NOTE The CCNA 200-301 exam blueprint lists SNMP in one exam topic, with that exam topic reduced to “explain SNMP,” with no requirement for configuration or verification skills. However, the previous version of the CCNA R&S certification did include SNMP configura-tion. Refer to Appendix D if interested in learning about SNMP configuration and verification. + +FTP and TFTP +This final of three major sections of the chapter focuses on two topics: File Transfer Protocol (FTP) and Trivial File Transfer Protocol (TFTP). Both exist as TCP/IP protocols defined in RFCs. Both use a client and server model, in which the client connects to a server and then the client can copy files to the server or from the server. Both exist as a myriad of implementations of both client and server code, from command-line clients to apps with graphical interfaces, using the respective FTP or TFTP protocols behind the scenes. + +This section discusses FTP and TFTP with two branches. The first section takes a practical view of the most common use of TFTP and FTP by network engineers while on the job: the job of updating IOS images. The process can make use of TFTP and FTP, so this section provides the basics. The second branch of this final major section then moves on to talk about FTP and TFTP in a much broader sense, with details about each protocol, their capa-bilities, and what capabilities each provides to any user. + +Managing Cisco IOS Images with FTP/TFTP +IOS exists as a file—a single file—that the router then loads into RAM to use as its oper-ating system. To better understand the process, you must understand a few more details about how IOS works. In particular, you need to understand the IO file system (IFS), which defines how IOS stores files (including the IOS file). The IOS image upgrade process occurs by copying new IOS files into the router and then booting the router with that new IOS. + +The IOS File System +Every OS creates file systems to store files. A computer needs some type of permanent storage, but it needs more than just a place to store bytes. The OS organizes the storage into a file system, which includes directories, structure, and filenames, with the associated rules. By using a file system, the OS can keep data organized so the user and the applications can find the data later. +Chapter 12: Miscellaneous IP Services 269 + +Every OS defines its own file system conventions. Windows OSs, for instance, use a left-leaning slash (\) in directory structures, like \Desktop\Applications. Linux and macOS use a right-leaning slash, for example, /Desktop. Each OS refers to physical disks slightly differ-ently as well, and IOS is no different. + +As for the physical storage, Cisco routers typically use flash memory, with no hard disk drive. Flash memory is rewriteable, permanent storage, which is ideal for storing files that need to be retained when the router loses power. Cisco purposefully uses flash memory rather than hard disk drives in its products because there are no moving parts in flash mem-ory, so there is a smaller chance of failure as compared with disk drives. Some routers have flash memory on the motherboard. Others have flash memory slots that allow easy removal and replacement of the flash card, but with the intent that the card remain in the device most of the time. Also, many devices have USB slots that support USB flash drives. + +For each physical memory device in the router, IOS creates a simple IOS file system and gives that device a name. Example 12-1 lists the surprisingly long list of IOS file systems. Note that entries of type disk and usbflash are the physical storage devices in that router. In this case, the router has one of two of the 2901’s compact flash slots populated with a 256-MB flash card and one of the two USB flash slots populated with an 8-GB USB flash drive. Look at the size column and prefixes column in the output to find these devices, based on their types as disk and usbflash. +Example 12-1 Cisco IOS File Systems on a Router + +R2# show file systems +File Systems: + + +Size(b) +- +- +- +- +- +* 256487424 +- +262136 +- +- +- +- +- +- +- +- +- +- +- +7794737152 + +Free(b) +- +- +- +- + +49238016 +- +253220 +- +- +- +- +- +- +- +- +- +- +- +7483719680 + +Type +opaque +opaque +opaque +opaque +network +disk +disk +nvram +opaque +opaque +opaque +network +network +network +network +network +opaque +network +opaque +usbflash + +Flags Prefixes +rw archive: +rw system: +rw tmpsys: +rw null: +rw tftp: +rw flash0: flash:# +rw flash1: +rw nvram: +wo syslog: +rw xmodem: +rw ymodem: +rw rcp: +rw pram: +rw http: 12 rw ftp: +rw scp: +ro tar: +rw https: +ro cns: +rw usbflash0: + +74503236 bytes copied in 187.876 secs (396555 bytes/sec) +270 CCNA 200-301 Official Cert Guide, Volume 2 + +The example lists 20 different IOS file systems in this case, but the router does not have 20 different physical storage devices. Instead, IOS uses these file systems for other purposes as well, with these types: + +■ Opaque: To represent logical internal file systems for the convenience of internal func-tions and commands +■ Network: To represent external file systems found on different types of servers for the convenience of reference in different IOS commands +■ Disk: For flash +■ Usbflash: For USB flash +■ NVRAM: A special type for NVRAM memory, the default location of the startup-config file + +Many IOS commands refer to files in an IFS, but only some commands refer directly to the files by their formal names. The formal names use the prefix as seen in the far right column of Example 12-1. For instance, the command more flash0:/wotemp/fred would display the contents of file fred in directory /wotemp in the first flash memory slot in the router. (The more command itself displays the contents of a file.) However, many commands use a key-word that indirectly refers to a formal filename, to reduce typing. For example: + +■ show running-config command: Refers to file system:running-config ■ show startup-config command: Refers to file nvram:startup-config ■ show flash command: Refers to default flash IFS (usually flash0:) + +Upgrading IOS Images +One of the first steps to upgrade a router’s IOS to a new version is to obtain the new IOS image and put it in the right location. Typically, Cisco routers have their IOS in one of the local physical file systems, most often in permanent flash. The only requirement is that the IOS be in some reachable file system—even if the file sits on an external server and the device loads the OS over the network. However, the best practice is to store each device’s IOS file in flash that will remain with the device permanently. + +Figure 12-13 illustrates the process to upgrade an IOS image into flash memory, using the following steps: +Step 1. Obtain the IOS image from Cisco, usually by downloading the IOS image from Cisco.com using HTTP or FTP. +Step 2. Place the IOS image someplace that the router can reach. Locations include TFTP or FTP servers in the network or a USB flash drive that is then inserted into the router. +Step 3. Issue the copy command from the router, copying the file into the flash mem-ory that usually remains with the router on a permanent basis. (Routers usually cannot boot from the IOS image in a USB flash drive.) + +www.cisco.com TFTP Server Router 1 2 3 copy tftp flash + +Internet +Figure 12-13 Copying an IOS Image as Part of the Cisco IOS Software Upgrade Process +Chapter 12: Miscellaneous IP Services 271 + +Copying a New IOS Image to a Local IOS File System Using TFTP +Example 12-2 provides an example of step 3 from Figure 12-13, copying the IOS image into flash memory. In this case, router R2, a 2901, copies an IOS image from a TFTP server at IP address 2.2.2.1. +Example 12-2 copy tftp flash Command Copies the IOS Image to Flash Memory + +R2# copy tftp flash +Address or name of remote host []? 2.2.2.1 +Source filename []? c2900-universalk9-mz.SPA.152-4.M1.bin +Destination filename [c2900-universalk9-mz.SPA.152-4.M1.bin ]? +Accessing tftp://2.2.2.1/c2900-universalk9-mz.SPA.152-4.M1.bin ... +Loading c2900-universalk9-mz.SPA.152-4.M1.bin from 2.2.2.1 (via GigabitEthernet0/1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +[OK - 97794040 bytes] + +97794040 bytes copied in 187.876 secs (396555 bytes/sec) +R2# + +The copy command does a simple task—copy a file—but the command also has several small items to check. It needs a few pieces of information from the user, so the command prompts the user for that information by showing the user some text and waiting for the user’s input. The bold items in the example show the user’s input. The router then has +to check to make sure the copy will work. The command works through these kinds of questions: + +1. What is the IP address or host name of the TFTP server? 2. What is the name of the file? +3. Ask the server to learn the size of the file, and then check the local router’s flash to ask whether enough space is available for this file in flash memory. +4. Does the server actually have a file by that name? +5. Do you want the router to erase any old files in flash? + +The router prompts you for answers to some of these questions, as necessary. For each question, you should either type an answer or press Enter if the default answer (shown in square brackets at the end of the question) is acceptable. Afterward, the router erases flash memory if directed, copies the file, and then verifies that the checksum for the file shows that no errors occurred in transmission. +12 +NOTE Most people use the IOS filenames that Cisco supplies because these names embed information about the IOS image, like the version. Also, if you want to use the same desti-nation filename as the source, avoid the mistake of typing “y” or “yes” to confirm the selec-tion; instead, you would be setting the destination filename to “y” or “yes.” Simply press Enter to confirm the selection listed in brackets. +272 CCNA 200-301 Official Cert Guide, Volume 2 + +You can view the contents of the flash file system to see the IOS file that was just copied by using a couple of commands. The show flash command shows the files in the default flash file system (flash0:), as seen at the top of Example 12-3. Below it, the more general dir flash0: command lists the contents of that same file system, with similar information. (You can use the dir command to display the contents of any local IFS.) +Example 12-3 Command Copies the IOS Image to Flash Memory + +R4# show flash +-#- --length-- -----date/time------ path + +1 104193476 Jul 21 2015 13:38:06 +00:00 +3 3000320 Jul 10 2012 00:05:44 +00:00 +4 1038 Jul 10 2012 00:05:52 +00:00 +5 122880 Jul 10 2012 00:06:02 +00:00 +6 1697952 Jul 10 2012 00:06:16 +00:00 +7 415956 Jul 10 2012 00:06:28 +00:00 +8 1153 Aug 16 2012 18:20:56 +00:00 +9 97794040 Oct 10 2014 21:06:38 +00:00 + +c2900-universalk9-mz.SPA.154-3.M3.bin +cpexpress.tar +home.shtml +home.tar +securedesktop-ios-3.1.1.45-k9.pkg +sslclient-win-1.1.4.176.pkg +wo-lic-1 +c2900-universalk9-mz.SPA.152-4.M1.bin + + +49238016 bytes available (207249408 bytes used) + +R4# dir flash0: +Directory of flash0:/ + +1 -rw- 104193476 Jul 21 2015 13:38:06 +00:00 c2900-universalk9-mz.SPA.154-3. M3.bin + +3 -rw- 3000320 +4 -rw- 1038 + +Jul 10 2012 00:05:44 +00:00 +Jul 10 2012 00:05:52 +00:00 + +cpexpress.tar +home.shtml + + + +5 -rw- 122880 +6 -rw- 1697952 pkg +7 -rw- 415956 +8 -rw- 1153 +9 -rw- 97794040 +M1.bin + +Jul 10 2012 00:06:02 +00:00 +Jul 10 2012 00:06:16 +00:00 + +Jul 10 2012 00:06:28 +00:00 +Aug 16 2012 18:20:56 +00:00 +Oct 10 2014 21:06:38 +00:00 + +home.tar +securedesktop-ios-3.1.1.45-k9. + +sslclient-win-1.1.4.176.pkg +wo-lic-1 +c2900-universalk9-mz.SPA.152-4. + + +256487424 bytes total (49238016 bytes free) + +Pay close attention to the memory usage per file and for the IFS as shown in the example. The output lists the size in bytes for each file. Note that the IOS file is about 104 MB. Note that the size of the IOS file matches the size shown earlier in the TFTP transfer in Example 12-2. The end of each of the commands then lists the amount of space available for new files to be added to flash (one lists it as “bytes available”; the other as “bytes free”). However, that same ending line of each command shows slightly different information about usage: show flash lists the bytes used, whereas the dir command lists the total bytes +(bytes used plus bytes free). Play around with the numbers in this example to make sure you know which command lists which particular total. +Chapter 12: Miscellaneous IP Services 273 + +Verifying IOS Code Integrity with MD5 +You download the IOS from Cisco, copy it to your router, and run it. Is it really the code from Cisco? Or did some nefarious attacker somehow get you to download a fake IOS that has a virus? + +Cisco provides a means to check the integrity of the IOS file to prevent this type of prob-lem. Figure 12-14 shows the basic mechanics of the process. First, when Cisco builds a new IOS image, it calculates and publishes an MD5 hash value for that specific IOS file. That is, Cisco uses as input the IOS file itself, runs the MD5 math algorithm against that file, pro-ducing a hex code. Cisco places that code at the download site for all to see. Then, you run that same MD5 math on your router against the IOS file on the router, using the IOS verify command. That command will list the MD5 hash as recalculated on your router. If both MD5 hashes are equal, the file has not changed. + +www.cisco.com + + + + + + + +Compare verify /md5 + + +Download: MD5: xxxxxxx… + + +Figure 12-14 MD5 Verification of IOS Images—Concepts + +The verify /md5 command generates the MD5 hash on your router, as shown in Example 12-4. Note that you can include the hash value computed by Cisco as the last parameter (as shown in the example), or leave it off. If you include it, IOS will tell you if the locally +computed value matches what you copied into the command. If you leave it out, the verify command lists the locally computed MD5 hash, and you have to do the picky character-by-character check of the values yourself. +Example 12-4 Verifying Flash Memory Contents with the show flash Command + +R2# verify /md5 flash0:c2900-universalk9-mz.SPA.154-3.M3.bin a79e325e6c498b70829d4d b0afba5041 +..................................................................................... +..................................................................................... +…..MD5 of flash0:c2900-universalk9-mz.SPA.154-3.M3.bin Done! +Verified (flash0:c2900-universalk9-mz.SPA.154-3.M3.bin) = a79e325e6c498b70829d4d +b0afba5041 12 + +Copying Images with FTP +The networking world has many options for file transfer, several of which IOS supports for the transfer of files into and out of the IOS file systems that reside on the router. TFTP and FTP have been supported for the longest time, with more recent support added for proto-cols like Secure Copy Protocol (SCP), which uses the SSH File Transfer Protocol (SFTP). Table 12-3 lists some of the names of file transfer protocols that you might come across when working with routers. +274 CCNA 200-301 Official Cert Guide, Volume 2 + + +Table 12-3 Method +TFTP FTP +SCP + +Common Methods to Copy Files Outside a Router Method (Full Name) +Trivial File Transfer Protocol File Transfer Protocol +Secure Copy Protocol + + +Encrypted? No +No +Yes + + +To copy files with FTP, you follow the same kind of process you use with TFTP (see Example 12-5). You can follow the interactive prompts after using an EXEC command like copy ftp flash. However, the copy command allows you to use a URI for the source and/ or destination, which lets you put most or all of the information in the command line itself. Each URI refers to the formal name of a file in the IFS. +Example 12-5 Installing a New IOS with FTP + +R1# copy ftp://wendell:odom@192.168.1.170/c2900-universalk9-mz.SPA.155-2.T1.bin flash +Destination filename [c2900-universalk9-mz.SPA.155-2.T1.bin]? +Accessing ftp://192.168.1.170/c2900-universalk9-mz.SPA.155-2.T1.bin... +Loading c2900-universalk9-mz.SPA.155-2.T1.bin !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +[OK - 107410736/4096 bytes] + +107410736 bytes copied in 119.604 secs (898053 bytes/sec) + +First, take a close look at the long URI in the command that begins with “ftp.” The “ftp” part identifies the protocol, of course. After the //, the text references the username (wen-dell) and password (odom), as well as the FTP server’s IP address. After the single / comes the filename on the server. + +Although the command is long, it has only two parameters, with the long first parameter and the short keyword flash as the second parameter. The copy command lists the source location as the first parameter and the destination as the second. The destination in this case, flash, is a keyword that refers to the default flash, typically flash0:, but it does not identify a specific filename. As a result, IOS prompts the user for a specific destination filename, with a default (in brackets) to keep the source filename. In this case, the user just pressed Enter to accept the default. To avoid being prompted at all, the command could have listed flash:c2900-universalk9-mz.SPA.155-2.T1.bin as that second parameter, fully defining the destination file. + +Finally, with another twist, you can configure the FTP username and password on the router so that you do not have to include them in the copy command. For instance, the global configuration commands ip ftp username wendell and ip ftp password odom would have configured those values. Then the copy command would have begun with copy ftp://192.168.1.170/..., omitting the username:password in the command, without needing to then prompt the user for the username and password. + +That completes the examples of showing how to copy IOS files into a router using TFTP and FTP. The exam topics happen to mention TFTP and FTP, but not the IOS upgrade +Chapter 12: Miscellaneous IP Services 275 + +process, so the text now turns away from the IOS upgrade process to focus more on TFTP and FTP. However, there are a few more steps to complete to upgrade IOS, such as con-figuring the boot system command and reloading the router. If you want to read about the rest of the IOS upgrade process or other related tasks like managing configuration files and performing password recovery, refer to this book’s Appendix F, “Previous Edition ICND1 Chapter 35: Managing IOS Files.” + +However, to complete the IOS upgrade process, you need to finish a few more required steps. + +The FTP and TFTP Protocols +The IOS copy command, when using the tftp or ftp keyword, makes the command act as a client. The client connects to a TFTP or FTP server and then attempts to transfer the file. In the examples from the IOS, that copy command copied the file from the server into the cli-ent device (a router). + +The rest of this section examines what happens behind the scenes in that process, with a closer look at both FTP and TFTP as protocols and tools. + +FTP Protocol Basics +FTP has long been a core Internet protocol, serving as the primary file transfer protocol for several decades. RFC 959, which standardizes FTP, dates back to 1985. FTP uses TCP as its transport protocol, relying on TCP to provide an error-free in-order deliver of data so that the FTP application knows that each file transfer creates an exact copy of the file with no omissions. FTP uses well-known TCP port 21 and in some cases also well-known port 20. + +As for normal operation, FTP uses a client/server model for file transfer, as shown in the example in Figure 12-15. The figure shows the major steps but not every message. For instance, step 1 shows host A creating a TCP connection to the server (which takes the usual three TCP messages). Step 2 represents the exchange that allows the server to authenticate the client. Step 3 shows the idea that, once authenticated, the client and server can send FTP commands over the connection to tell the other device what to do. + + +FTP Client +1 +A 2 + +3 + +FTP Server TCP 3-Way Handshake +FTP Authentication + +FTP Commands + + +Figure 12-15 Major Concepts with FTP Clients and Servers + +The commands that flow over this initial TCP connection—called the FTP control connec- +tion—define the kinds of functions supported by FTP. Those commands allow the client to 12 +navigate around the directory structures of the server, list files, and then transfer files from the server (FTP GET) or to the server (FTP PUT). Following is a summary of some of the FTP actions: +276 CCNA 200-301 Official Cert Guide, Volume 2 + +■ Navigate directories: List the current directory, change the current directory to a new direc-tory, go back to the home directory, all on both the server and client side of the connection. +■ Add/remove directories: Create new directories and remove existing directories on both the client and server. +■ List files: List files on both the client and server. +■ File transfer: Get (client gets a copy of the file from the server), Put (client takes a file that exists on the client and puts a copy of the FTP server). + +While many OSs support command-line FTP clients, which require you to learn the various FTP commands and use those from the command line, most users instead use an FTP client app that issues the FTP commands behind the scenes. Clients typically display files on the local system as well as the server with a user interface similar to a typical file browser on a desktop OS (for instance, Windows Explorer, macOS Finder). Figure 12-16 shows a sample user interface from the Filezilla FTP client (Filezilla-project.org). + +Local Files Server Files + + + + + + + + + +Figure 12-16 FTP Client Example with Filezilla + +The client application in Figure 12-16 lists the client computer’s local file system on the left and the FTP server’s file system on the right. The user can click on the right to change direc-tories, much like using any app that browses a file system, with FTP performing the com-mands behind the scenes. The user can also drag and drop files from the left to the right to put a file on the server, or vice versa to get a file from the server. +The FTP server can be a server application installed and managed by others, or you can install or enable an FTP server for your own use. For instance, a network engineer might install an FTP server application on her laptop for use in upgrading IOS files, while the IT staff may keep an FTP server available 24/7 for all employees of the company to use. A sim-ple Internet search can show a variety of FTP server applications that run on the common desktop OSs. Additionally, both Windows 10 and macOS come with an FTP or FTPS (FTP Secure) server option built into the OS; all you have to do is enable it. (The Linux distribu-tions all have FTP servers available via simple downloads.) + +Once installed, the server can be configured with a variety of settings. For instance, the serv-er needs to specify which users can access the server, so it can use the same login credentials allowed for the host where it resides or specify other credentials. It can specify the directo-ries that each user can access, and whether the user has read-only or read-write access. + +FTP Active and Passive Modes +FTP can operate in either active or passive mode. The choice of mode may impact whether the TCP client can or cannot connect to the server and perform normal functions. The user +Chapter 12: Miscellaneous IP Services 277 + +at the FTP client can choose which mode to use, so this section works through the underly-ing details to explain why FTP passive mode may be the more likely option to work. + +First, note that FTP uses two types of TCP connections: + +■ Control Connection: Used to exchange FTP commands +■ Data Connection: Used for sending and receiving data, both for file transfers and for output to display to a user + +Given the two roles, when a client connects to an FTP server, the client first creates the FTP control connection as shown in Figure 12-17. The server listens for new control connections on its well-known port 21; the client allocates any new dynamic port (49222 in this case) and creates a TCP connection to the server. + +FTP Client FTP Server +A 49222 TCP SYN 21 TCP SYN, ACK + + +192.168.1.102 +Figure 12-17 + +TCP ACK 192.168.1.11 + +FTP Client Creates an FTP Control Connection + + +After creating the TCP connection, the user authenticates to the FTP server and takes some actions. Some of those actions require only the control connection, but eventually the user will take an action (like getting a file) that requires a data connection. When that happens, to create the FTP data connection, the client will either use active mode or passive mode, as shown in the next two examples. + +Figure 12-18 shows an example of what happens in active mode. Following the steps in the figure: + +1. The FTP client allocates a currently unused dynamic port and starts listening on that port. +2. The client identifies that port (and its IP address) to the FTP server by sending an FTP PORT command to the server. +3. The server, because it also operates in active mode, expects the PORT command; the server reacts and initiates the FTP data connection to the client’s address (192.168.1.102) and port (49333). + +192.168.1.102 FTP Server + +A 49222 TCP Control 21 +12 49333 1 + +2 FTP PORT 192.168.1.102, 49333 + +TCP SYN for FTP Data 3 49160 +Figure 12-18 FTP Active Mode Process to Create the Data Connection +278 CCNA 200-301 Official Cert Guide, Volume 2 + +Active mode works well with both the FTP client and server sitting inside the same enter-prise network. When within the same network, typically no NAT function and no firewall sits between the two. However, if the FTP client sits in an enterprise network, and the FTP server resides somewhere in the Internet, an active mode connection typically fails. Most firewalls do not allow Internet-based hosts to initiate TCP connections to hosts inside the enterprise without a specific firewall rule allowing connections to a known port, and in this case, the FTP client allocates any available port number. For instance, in Figure 12-18, the TCP connection (step 3) would be discarded by a firewall. + +NOTE FTP reserves two well-known ports: port 21 for control connections and port 20 for data connections. However, due to changes to FTP over the years, FTP often uses other TCP ports for the TCP data connection, as seen in the examples in this chapter. + +Passive mode helps solve the firewall restrictions by having the FTP client initiate the FTP data connection to the server. However, passive mode does not simply cause the FTP client to connect to a well-known port on the server; it requires more exchanges of port numbers to use between the server and client, as shown in Figure 12-19, with these steps: + +1. The FTP client changes to use FTP passive mode, notifying the server using the FTP PASV command. +2. The server chooses a port to listen on for the upcoming new TCP connection, in this case TCP port 49444. +3. The FTP notifies the FTP client of its IP address and chosen port with the FTP PORT command. +4. The FTP client opens the TCP data connection to the IP address and port learned at the previous step. +192.168.1.11 192.168.1.102 FTP Server + +A 49222 TCP Control 21 1 FTP PASV 2 +49444 + +FTP PORT 192.168.1.11, 49444 3 + + +4 49160 + + +TCP SYN for FTP Data Connection + +Figure 12-19 FTP Passive Mode Process to Create the Data Connection + +FTP over TLS (FTP Secure) +FTP, defined in RFC 959 back in 1985, has some shortcomings with security. As originally defined, it does include the ability to use usernames and passwords for authentication and authorization; however, the username/password flows as clear text. Additionally, all data transfers flow as clear text. + +Over the years, several RFCs defined security improvements for FTP. Those new features include using digital certificates for authentication as well as using Transport Layer Security (TLS) to encrypt all data (including usernames/passwords). Fast forward to today and many +Chapter 12: Miscellaneous IP Services 279 + +of those features converge into what most FTP clients and servers support as FTP over TLS or as FTP Secure (FTPS). + +With FTPS, the client and server still use FTP commands and still use both a control and data connection. However, FTPS encrypts both the control and data connections with TLS, including the exchange of the usernames and passwords. FTPS includes a few variations, including the FTPS explicit mode process shown in Figure 12-20: + +1. The client creates the FTP control TCP connection to server well-known port 21. +2. The client initiates the use of TLS in the control connection with the FTP AUTH command. +3. When the user takes an action that requires an FTP data connection, the client creates an FTP data TCP connection to server well-known port 21. +4. The client initiates the use of TLS in the data connection with the FTP AUTH command. + +192.168.1.11 192.168.1.102 1 FTP Server +A 49222 TCP Control 21 2 FTP AUTH (Starts TLS) +3 +49299 TCP Data 21 +4 FTP AUTH (Starts TLS) + +Figure 12-20 FTPS Explicit Mode Control and Data Connection Establishment + +In contrast, the implicit mode process begins with a required TLS connection, with no need for an FTP AUTH command, using well-known ports 990 (for the control connection) and 989 (for the data connection). + +NOTE SSH File Transfer Protocol (SFTP) is a different protocol than FTPS. SFTP uses SSH to encrypt file transfers over an SSH connection. However, the acronym SFTP does not refer to a secure version of FTP. + + +TFTP Protocol Basics +FTP has a role as a general file transfer tool for any user, with a good number of FTP client application options available. TFTP plays a much smaller role as a tool for the average user, but it does play a more useful role for IT support staff. + +For the basics, Trivial File Transfer Protocol uses UDP well-known port 69. Because it uses UDP, TFTP adds a feature to check each file for transmission errors by using a checksum process on each file after the transfer completes. + +The word trivial in the name refers to its relatively small number of features, meant to be an advantage by making the tool lightweight. For instance, it supports far fewer commands than FTP (fewer functions), meaning that the code requires less space to install, which can be useful for devices with limited memory. TFTP can Get and Put files, but it includes no commands to change directories, create/remove directories, or even to list files on the + + + + + + +12 +280 CCNA 200-301 Official Cert Guide, Volume 2 + +server. TFTP does not support even simple clear-text authentication. In effect, if a TFTP server is running, it should accept requests from any TFTP client. + +Ideally, TFTP has its best use as a temporary tool for quick file transfers in a controlled environment, particularly when the data itself does not have to be secure. For instance, imagine this scenario: + +1. A network engineer keeps all router and switch IOS images in a folder. +2. The engineer enables a TFTP server on her laptop as needed; otherwise, the TFTP server remains disabled. +3. The engineer connects her laptop to a LAN and enables the TFTP server long enough to transfer IOS images into or out of a few devices. +4. If the engineer forgets to disable TFTP, the only risk is that someone may copy an IOS image—an image that is already available from Cisco.com to any customer. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 12-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 12-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions +Review Command Tables + +Resource Used Book, website Book, website Book, PTP +Book + + +Review All the Key Topics + +Table 12-5 +Key Topic Element +List +Table 12-2 Figure 12-5 Figure 12-6 +Figure 12-9 + +Key Topics for Chapter 12 Description + +Common characteristics of all FHRPs Comparisons of HSRP, VRRP, GLBP HSRP concepts +HSRP failover results +The SNMP Get Request and Get Response message flow + + +Page Number + +260 260 261 262 +265 + + + +Figure 12-10 +Figure 12-12 + +SNMP notification with SNMP Trap messages 265 +The use of SNMP RO and RW communities with SNMP Get 267 and Set +Chapter 12: Miscellaneous IP Services 281 + + +Key Topic Element +List +Figure 12-13 + +Description + +SNMP security benefits +Process of upgrading IOS using TFTP + +Page Number + +268 +270 + +Example 12-2 Example of using TFTP to load new IOS 271 Example 12-5 Example of using FTP to load new IOS 274 + +List List +Figure 12-17 Figure 12-19 +Paragraph + +FTP functions 276 FTP data and control connections 277 FTP Control connection establishment 277 FTP data connection establishment in passive mode 278 +Description of limited functions of TFTP 279 + + +Key Terms You Should Know +First Hop Redundancy Protocol (FHRP), Hot Standby Router Protocol (HSRP), Virtual Router Redundancy Protocol (VRRP), Gateway Load Balancing Protocol (GLBP), virtual IP address, virtual MAC address, HSRP active, HSRP standby, Simple Network Management Protocol (SNMP), SNMP community, read-only community, read-write community, noti-fication community, SNMP Get, SNMP Set, SNMP Trap, SNMP Inform, Management Information Base (MIB), SNMPv2c, SNMPv3, Network Management System (NMS), SNMP manager, SNMP agent, IOS image, flash memory, IOS file system, code integrity, TFTP, FTP, FTP control connection, FTP data connection, FTP over TLS + +Command References +Tables 12-6 and 12-7 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + + +Table 12-6 +Command + +Chapter 12 Configuration Command Reference +Description + + + +boot system flash [flash-fs:] [filename] +boot system {tftp | ftp} filename [ip-address] + +ip ftp username name + + +ip ftp password pass + +Global command that identifies the location of an IOS image in flash memory +Global command that identifies an external server, protocol, and filename to use to load an IOS from an external server +Global command to define the username used when referencing the ftp: IOS file system but not supplying a username +Global command to define the password used when referencing the ftp: IOS file system but not supplying a password + + + + + + + +12 +282 CCNA 200-301 Official Cert Guide, Volume 2 + + +Table 12-7 +Command + +Chapter 12 EXEC Command Reference +Description + + + +copy from-location to-location + +show flash + +dir filesystem: + +dir filesystem:directory +verify /md5 filesystem:name [MD5-hash] + +Enable mode EXEC command that copies files from one file location to another. Locations include the startup-config and running-config files, files on TFTP and RPC servers, and flash memory. +Lists the names and size of the files in flash memory, and notes the amount of flash memory consumed and available. +Lists the files in the referenced file system or file system directory. + + + +Performs an MD5 hash of the referenced file and displays the results. If listed, the command compares the MD5 hash in the command with the results of performing MD5 on the local file. + + + + + + + + +This page intentionally left blank +Part III Review + +Keep track of your part review progress with the checklist shown in Table P3-1. Details on each task follow the table. + + +Table P3-1 + +Activity + +Part III Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + +Do Labs + +Review Videos + + +Repeat All DIKTA Questions +For this task, use the PTP software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + +Use Per-Chapter Interactive Review Elements +Using the companion website, browse through the interactive review elements, such as memory tables and key term flashcards, to review the content from each chapter. + +Labs +Depending on your chosen lab tool, here are some suggestions for what to do in the lab: + +Pearson Network Simulator: If you use the full Pearson CCNA simulator, focus more on the configuration scenario and troubleshooting scenario labs associated with the topics in this part of the book. These types of labs include a larger set of topics and work well as Part Review activities. (See the Introduction for some details about how to find which labs are about topics in this part of the book.) +Blog Config Labs: The author’s blog (https://blog.certskills.com) includes a series of configuration-focused labs that you can do on paper, each in 10–15 minutes. Review and perform the labs for this part of the book by using the menus to navigate to the per- +chapter content and then finding all config labs related to that chapter. (You can see more detailed instructions at https://blog.certskills.com/config-labs.) +Other: If using other lab tools, here are a few suggestions: All the exam topics in Part III that include the word configure exist in Chapters 9 and 10, so focus on those chapters. Those chapters touch on CDP/LLDP, NTP, syslog, and NAT/PAT. + +Watch Videos +Part III’s Chapter 11 includes a mention of a video about QoS Classification and Marking. You can find a link to view that video in the section for videos in the companion website for this book. + + + + + + + + + + + + + +Part IV turns the attention away from the concept-configure-verify approach needed for many of the topics seen earlier in this book and in CCNA 200-301 Official Cert Guide, Volume 1. Instead, this part collects topics that will be presented more from an architecture and design perspective. In fact, the CCNA 200-301 exam organizes six exam topics with this same approach, all listed under exam topic 1.2 “Describe characteristics of network topol-ogy architectures.” The chapters in this part examine most of those topics. + +First, Chapter 13 revisits LAN switching, which was covered to some depth in Volume 1. This chapter discusses campus LAN design concepts and terminology, like the 2 tier +and 3 tier terms listed in the exam topics. This chapter also discusses how to supply power over that LAN infrastructure using Power over Ethernet (PoE), as well as the term +small office/home office (SOHO). + +CCNA 200-301 mentions WAN as an end to itself in one exam topic within the context of topology and architecture. Chapter 14 takes that thread and presents three major WAN architectures, going beyond the concepts you need to know to support the simple WAN +cases used in the examples throughout both books so far. Those topics include MPLS VPN WANs, Ethernet WANs, and Internet VPNs. + +Chapter 15 completes the architecture-focused chapters with a discussion of cloud architec-tures. This chapter begins by defining basic concepts and terms related to data centers and cloud and closes with design discussions that show packet flows in a public cloud environ-ment. +Part IV + + +Network Architecture + + + + +Chapter 13: LAN Architecture + +Chapter 14: WAN Architecture + +Chapter 15: Cloud Architecture + +Part IV Review +CHAPTER 13 + + + +LAN Architecture + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.2 Describe characteristics of network topology architectures + +1.2.a 2 tier + +1.2.b 3 tier + +1.2.e Small office/home office (SOHO) + +1.3 Compare physical interface and cabling types + +1.3.c Concepts of PoE + + +By now you have learned a lot about Ethernet and Ethernet switches. You have learned how individual links work, with cabling and duplex settings as well as framing. You know how addresses work and how switches forward frames based on those addresses. You have seen how switches deal with redundancy, using STP/RSTP and collecting links into EtherChannels. And here in Volume 2, you have learned about a variety of security fea- +tures available for switches, including Dynamic ARP Inspection, DHCP Snooping, and ARP Inspection. + +What the earlier discussions of individual features do not do to any great extent is discuss architecture and design. You now know how switches work, but why would you connect switches in one topology versus another? If you could connect switches in two different topologies, why would you prefer one over the other? This chapter examines a few such design questions, specifically the topic areas mentioned in the CCNA 200-301 exam topics. (Note that the CCNA 200-301 exam does not include a comprehensive look at LAN design issues, but one of the current CCNP Enterprise exams does.) + +This chapter covers three specific topics that have design-related considerations. The first section looks at the topology of a wired Ethernet LAN and the design terms two tier and three tier, which describe how many switch layers exist between the endpoints and the devices that lead out of the campus to some other site. Following that, the second section examines small office/home office (SOHO) LANs and how they differ from enterprise LANs. The final section introduces the concepts behind Power over Ethernet (PoE), along with the reasons why LAN design activities need to consider PoE. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 13-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Analyzing Campus LAN Topologies Small Office/Home Office +Power over Ethernet + +Questions 1–3 +4 +5–6 + + +1. In a two-tier campus LAN design, which of the following are typically true of the topology design? (Choose two answers.) +a. The design uses a full mesh of links between access and distribution switches. +b. The design uses a partial mesh of links between access and distribution switches. c. The design uses a partial mesh of links between the distribution and core switches. d. The end-user and server devices connect directly to access layer switches. +2. In a three-tier campus LAN design, which of the following are typically true of the topology design? (Choose two answers.) +a. The design uses a partial mesh of links between access and distribution switches. b. The design uses a full mesh of links between access and distribution switches. +c. The design uses a partial mesh of links between the distribution and core switches. d. The end-user and server devices connect directly to distribution layer switches. +3. Which one answer gives the strongest match between one part of a typical three-tier design with the idea behind the listed generic topology design term? +a. The access layer looks like a partial mesh. b. The distribution layer looks like a full mesh. +c. The distribution layer looks like a hybrid design. d. The access layer looks like a star design. +4. Which answers list criteria typical of a SOHO network? (Choose two answers.) a. The AP functions using standalone mode. +b. The AP functions using a split-MAC architecture using a WLC. +c. A single networking device implements the router, switch, AP, and firewall functions. +d. A separate networking device implements each function (router, switch, AP, and firewall). + +5. Which answer describes how a LAN switch dynamically chooses the initial power level to apply to a UTP cable with PoE? +a. Autonegotiation b. CDP +c. LLDP +d. Preconfigured values +290 CCNA 200-301 Official Cert Guide, Volume 2 + +6. Which of the following refer to standards that deliver power over all four pairs in a UTP cable? (Choose two answers.) + +a. PoE b. UPoE c. PoE+ +d. UPoE+ + + +Foundation Topics + +Analyzing Campus LAN Topologies +The term campus LAN refers to the LAN created to support the devices in a building or in multiple buildings in somewhat close proximity to one another. For example, a company might lease office space in several buildings in the same office park. The network engineers can then build a campus LAN that includes switches in each building, plus Ethernet links between the switches in the buildings, to create a larger campus LAN. + +When planning and designing a campus LAN, the engineers must consider the types of Ethernet available and the cabling lengths supported by each type. The engineers also need to choose the speeds required for each Ethernet segment. In addition, some thought needs to be given to the idea that some switches should be used to connect directly to end-user devices, whereas other switches might need to simply connect to a large number of these end-user switches. Finally, most projects require that the engineer consider the type of equipment that is already installed and whether an increase in speed on some segments is worth the cost of buying new equipment. + +This first of three major sections of the chapter discusses the topology of a campus LAN design. Network designers do not just plug in devices to any port and connect switches to each other in an arbitrary way, like you might do with a few devices on the same table in a lab. Instead, there are known better ways to design the topology of a campus LAN, and this section introduces some of the key points and terms + +Two-Tier Campus Design (Collapsed Core) +To sift through all the requirements for a campus LAN, and then have a reasonable conver-sation about it with peers, most Cisco-oriented LAN designs use some common terminol-ogy to refer to the design. For this book’s purposes, you should be aware of some of the key campus LAN design terminology. + +The Two-Tier Campus Design +Figure 13-1 shows a typical design of a large campus LAN, with the terminology included in the figure. This LAN has around 1000 PCs connected to switches that support around 25 ports each. Explanations of the terminology follow the figure. + +Cisco uses three terms to describe the role of each switch in a campus design: access, dis-tribution, and core. The roles differ based on whether the switch forwards traffic from user devices and the rest of the LAN (access), or whether the switch forwards traffic between other LAN switches (distribution and core). +Chapter 13: LAN Architecture 291 + +To WAN + + +R1 + +2 x 10 GbE +D1 +Uplinks GigE + + +R2 + +2 Distribution Distribution D1 Switches +Layer + +GigE + + + + + +A1 A2 ..... A39 A40 + +40 Access Access Switches Layer + + + +10/100/1000 10/100/1000 10/100/1000 10/100/1000 1000 PCs +Figure 13-1 Campus LAN with Design Terminology Listed + +Access switches connect directly to end users, providing user device access to the LAN. Access switches normally send traffic to and from the end-user devices to which they are connected and sit at the edge of the LAN. + +Distribution switches provide a path through which the access switches can forward traffic to each other. By design, each of the access switches connects to at least one distribution switch, typically to two distribution switches for redundancy. The distribution switches provide the service of forwarding traffic to other parts of the LAN. Note that most designs use at least two uplinks to two different distribution switches (as shown in Figure 13-1) for redundancy. +The figure shows a two-tier design, with the tiers being the access tier (or layer) and the dis-tribution tier (or layer). A two-tier design solves two major design needs: + +■ Provides a place to connect end-user devices (the access layer, with access switches) +■ Connects the switches with a reasonable number of cables and switch ports by connect-ing all 40 access switches to two distribution switches + +NOTE The terms two-tier and 2-tier are synonyms, as are the terms three-tier and 3-tier. Cisco happens to use the versions of these terms with numerals in the exam topics. + +Topology Terminology Seen Within a Two-Tier Design +The networking world uses several common terms about LAN and WAN topology and design including these: + +Star: A design in which one central device connects to several others, so that if you drew the links out in all directions, the design would look like a star with light shining in all directions. +Full mesh: For any set of network nodes, a design that connects a link between each pair 13 of nodes. +Partial mesh: For any set of network nodes, a design that connects a link between some pairs of nodes, but not all. In other words, a mesh that is not a full mesh. +Hybrid: A design that combines topology design concepts into a larger (typically more complex) design. +292 CCNA 200-301 Official Cert Guide, Volume 2 + +Armed with those formal definitions, note that the two-tier design is indeed a hybrid design that uses both a star topology at the access layer and a partial mesh at the distribution layer. To see why, consider Figure 13-2. It redraws a typical access layer switch, but instead of putting the PCs all below the switch, it spreads them around the switch. Then on the right, a similar version of the same drawing shows why the term star might be used—the topology looks a little like a child’s drawing of a star. + + + + + + + + + + + +Figure 13-2 The Star Topology Design Concept in Networking + +The distribution layer creates a partial mesh. If you view the access and distribution switches as nodes in a design, some nodes have a link between them, and some do not. Just refer to Figure 13-1 and note that, by design, none of the access layer switches connect to each other. + +Finally, a design could use a full mesh. However, for a variety of reasons beyond the scope of the design discussion here, a campus design typically does not need to use the number of links and ports required by a full mesh design. However, just to make the point, first con-sider how many links and switch ports would be required for a single link between nodes in a full mesh, with six nodes, as shown in Figure 13-3. + + +D1 D2 + + + + + +D6 D3 + + + + + +D5 D4 +Figure 13-3 Using a Full Mesh at the Distribution Layer, 6 Switches, 15 Links + + + +Answers to the “Do I Know This Already?” quiz: 1 B, D 2 A, C 3 D 4 A, C 5 A 6 B, D +Chapter 13: LAN Architecture 293 + +Even with only six switches, a full mesh would consume 15 links (and 30 switch ports—two per link). + +Now think about a full mesh at the distribution layer for a design like Figure 13-1, with 40 access switches and two distribution switches. Rather than drawing it and counting it, the number of links is calculated with this old math formula from high school: N(N – 1) / 2, or in this case, 42 * 41 / 2 = 861 links, and 1722 switch ports consumed among all switches. + +For comparison’s sake, the partial mesh design of Figure 13-1, with a pair of links from each access switch to each distribution switch, requires only 160 links and a total of 320 ports among all switches. + +Three-Tier Campus Design (Core) +The two-tier design of Figure 13-1, with a partial mesh of links at the distribution layer, happens to be the most common campus LAN design. It also goes by two common names: a two-tier design (for obvious reasons) and a collapsed core (for less obvious reasons). The term collapsed core refers to the fact that the two-tier design does not have a third tier, the core tier. This next topic examines a three-tier design that does have a core, for perspective. + +Imagine your campus has just two or three buildings. Each building has a two-tier design inside the building, with a pair of distribution switches in each building and access switches spread around the building as needed. How would you connect the LANs in each build-ing? Well, with just a few buildings, it makes sense to simply cable the distribution switches together, as shown in Figure 13-4. + +Building 1 Building 2 + +A11 A21 + +D11 D21 +A12 A22 + + +A13 A23 D12 D22 + +A14 A24 + + + +D31 D32 + + + +A31 A32 A33 A34 +Building 3 13 +Figure 13-4 Two-Tier Building Design, No Core, Three Buildings +294 CCNA 200-301 Official Cert Guide, Volume 2 + +The design in Figure 13-4 works well, and many companies use this design. Sometimes the center of the network uses a full mesh, sometimes a partial mesh, depending on the avail-ability of cables between the buildings. + +However, a design with a third tier (a core tier) saves on switch ports and on cables in larger designs. And note that with the links between buildings, the cables run outside, are often more expensive to install, and are almost always fiber cabling with more expensive switch ports, so conserving the number of cables used between buildings can help reduce costs. + +A three-tier core design, unsurprisingly at this point, adds a few more switches (core switch-es), which provide one function: to connect the distribution switches. Figure 13-5 shows the migration of the Figure 13-4 collapsed core (that is, a design without a core) to a three-tier core design. + +Building 1 Building 2 + + +A11 A21 + +D11 Core1 D21 +A12 A22 + + +A13 A23 D12 Core2 D22 + +A14 A24 + + + +D31 D32 + + + +A31 A32 A33 A34 + +Building 3 +Figure 13-5 Three-Tier Building Design (Core Design), Three Buildings + +NOTE The core switches sit in the middle of the figure. In the physical world, they often sit in the same room as one of the distribution switches, rather than in some purpose-built room in the middle of the office park. The figure focuses more on the topology rather than the physical location. + +By using a core design, with a partial mesh of links in the core, you still provide connectivity to all parts of the LAN and to the routers that send packets over the WAN, just with fewer links between buildings. +Chapter 13: LAN Architecture 295 + +The following list summarizes the terms that describe the roles of campus switches: + +■ Access: Provides a connection point (access) for end-user devices. Does not forward frames between two other access switches under normal circumstances. +■ Distribution: Provides an aggregation point for access switches, providing connectivity to the rest of the devices in the LAN, forwarding frames between switches, but not con-necting directly to end-user devices. +■ Core: Aggregates distribution switches in very large campus LANs, providing very high forwarding rates for the larger volume of traffic due to the size of the network. + +Topology Design Terminology +To close the discussion of Enterprise LAN topology, the next topic applies some of the generic topology terms to a typical two-tier design. + +Consider Figure 13-6, which shows a few of the terms. First, on the left, drawings often show access switches with a series of cables, parallel to each other. However, the combina-tions of an access switch and its access links is often called a star topology. Why? Look at the redrawn access switch in the center of the figure, with the cables radiating out from the center. It does not look like a real star, but it looks a little like a child’s drawing of a star, hence the term star topology. + + +D1 D2 + + +SW1 SW1 + +A1 A2 + + +Access Switch +Figure 13-6 + +Access Switch: Star Uplinks: Partial Mesh +LAN Design Terminology + + +The right side of the figure repeats a typical two-tier design, focusing on the mesh of links between the access and distribution switches. Any group of nodes that connect with more links than a star topology is typically called a mesh. In this case, the mesh is a partial mesh, because not all nodes have a direct link between each other. A design that connects all nodes with a link would be a full mesh. + +Real networks make use of these topology ideas, but often a network combines the ideas together. For instance, the right side of Figure 13-6 combines the star topology of the access layer with the partial mesh of the distribution layer. So you might hear these designs that combine concepts called a hybrid design. + +Small Office/Home Office +Now that you know more about design choices and terms for an enterprise LAN, this 13 +next section examines one particular type of smaller LAN: the small office/home office (SOHO) LAN. SOHO refers to designs and implementations that have such a small volume of requirements—few switch ports, few APs, few routers and WAN links—that the design differs significantly. The term itself refers to the two most common cases: a user who works +296 CCNA 200-301 Official Cert Guide, Volume 2 + +from home or a small office with a small number of workers and devices. This next short topic points out a few of the highlights that make a SOHO network different from an enter-prise network. + +First, as a reminder, the IEEE defines both Ethernet LANs and wireless LANs (WLANs). In case it was not obvious yet, all Ethernet standards use cables—that is, Ethernet defines +wired LANs. The IEEE 802.11 working group defines wireless LANs, also called Wi-Fi per a trademarked term from the Wi-Fi Alliance (www.wi-fi.org), a consortium that helps encour-age wireless LAN development in the marketplace. + +Most of you have used Wi-Fi, and may use it daily. Some of you may have set it up at home, with a basic setup as shown in Figure 13-7. In a home, you probably used a single consumer device called a wireless router. One side of the device connects to the Internet, while the other side connects to the devices in the home. In the home, the devices can con-nect either with Wi-Fi or with a wired Ethernet cable. + +SOHO + + + + + + +UTP R1 + +CATV Cable + + +ISP/Internet + + +Figure 13-7 A Typical Home Wired and Wireless LAN + +While the figure shows the hardware as a single router icon, internally, that one wireless router acts like separate devices you would find in an enterprise campus: + +■ An Ethernet switch, for the wired Ethernet connections +■ A wireless access point (AP), to communicate with the wireless devices and forward the frames to/from the wired network +■ A router, to route IP packets to/from the LAN and WAN (Internet) interfaces +■ A firewall, which often defaults to allow only clients to connect to servers in the Internet, but not vice versa + +Figure 13-8 repeats the previous figure, breaking out the internal components as if they were separate physical devices, just to make the point that a single consumer wireless router acts like several different devices. + +SOHO + + + + + + + +UTP R1 UTP UTP + + + +UTP Cable Modem + +CATV +Cable ISP/ Internet + +Figure 13-8 A Representation of the Functions Inside a Consumer Wireless Routing Product +Chapter 13: LAN Architecture 297 + +In a SOHO wireless LAN, the wireless AP acts autonomously, rather than with a WLC, doing all the work required to create and control the WLAN. In other words, the autono-mous AP communicates with the various wireless devices using 802.11 protocols and radio waves. It uses Ethernet protocols on the wired side. It converts between the differences +in header formats between 802.11 and 802.3 frames before forwarding to/from 802.3 Ethernet and 802.11 wireless frames. But it does not encapsulate frames in CAPWAP, because the AP will not send the frames to a WLC. + +For the Internet connection, the router (combo) device connects with any available Internet access technology, including cable Internet, DSL, 4G/5G wireless, or fiber Ethernet. Note that Chapter 14, “WAN Architecture,” introduces those technologies. + +Power over Ethernet (PoE) +Just walk around any building and you see electrical power outlets everywhere. When finishing the interior of a building, electricians run electrical cables and install electrical outlets to any and every location that might need power. They also run power cables so that devices such as light fixtures can be wired to power as well. And when network engi-neers thought about electrical power, they thought in terms of making sure the electricians had run enough power to the wiring closets and other locations to power the networking devices. + +Power over Ethernet (PoE) changes that thinking so that the responsibility to provide electrical power to some devices can fall to the network engineering team. Some classes of device types have been built to be able to receive their power over the Ethernet cable, rather than using a separate power cord. To make that work, the LAN switch connected to +the cable must supply that power over the cable. By using PoE, companies can gain several advantages, including reduced cost by requiring fewer cable runs and better power manage-ment capabilities as compared with using a traditional electrical power cable run and power outlet. This final section of the chapter examines PoE. + +PoE Basics +The family of standards that supply power goes by the general name Power over Ethernet (PoE). With PoE, some device, typically a LAN switch, acts as the Power Sourcing Equipment (PSE)—that is, the device that supplies DC power over the Ethernet UTP cable (as shown in Figure 13-9). A device that has the capability to be powered over the Ethernet cable, rather than by some other power connector on the device, is called the Powered Device (PD). + + +Powered Devices (PDs) + + + + + +Figure 13-9 + + +Power Sourcing Equipment (PSE) + +Ethernet Cables (DC Power) + + +Power over Ethernet Terminology + +Power Supply + + + +AC Power Cable +AC Power +Outlet 13 +298 CCNA 200-301 Official Cert Guide, Volume 2 + +PoE has a great advantage for devices installed to locations that often do not have a pre-installed power cable or power output. For instance, wireless design places APs in a wide range across the ceiling of a floor (or story) in a building. Also, IP video cameras might be placed in the ceiling corners inside or at various outside locations. Instead of running new power and new network cables to support each device, a single Ethernet cable run can sup-ply power to the device while allowing normal Ethernet communications over the same cable and same wire pairs. + +PoE also helps in some less obvious practical ways because it supplies DC power over the Ethernet cable, so the device does not need an AC/DC converter. For instance, devices like laptops and IP phones use a power cord that includes a power brick—an AC-to-DC converter—which converts the AC power from the power outlet to the DC power needed by the device. PoE supplies DC current over the Ethernet cable. So, for an IP Phone, for instance, no more power cable and no more power brick cluttering the desk or taking up a power outlet. + +PoE Operation +PoE must have a means to avoid harming the devices on the end of the circuit. Every elec-trical device can be harmed by receiving too much current into the device, which is why electricians install circuit breakers and why we use surge protectors. Applying power over an Ethernet cable could have the same effect, harming the device on the other end, if the device does not support PoE. So PoE must (and does) have processes in place to determine if PoE is needed, and for how much power, before applying any potentially harmful power levels to the circuit. + +PoE, standardized by the IEEE, extends the same IEEE autonegotiation mechanisms. In fact, the mechanisms need to work before the PD has booted, because the PD needs power before it can boot and initialize. By using these IEEE autonegotiation messages and watch-ing for the return signal levels, PoE can determine whether the device on the end of the cable requires power (that is, it is a PD) and how much power to supply. This list details the major steps: +Step 1. Do not supply power on a PoE-capable port unless negotiation identifies that the device needs power. +Step 2. Use Ethernet autonegotiation techniques, sending low power signals and moni-toring the return signal, to determine the PoE power class, which determines how much power to supply to the device. +Step 3. If the device is identified as a PD, supply the power per the power class, which allows the device to boot. +Step 4. Monitor for changes to the power class, both with autonegotiation and listen-ing for CDP and LLDP messages from the PD. +Step 5. If a new power class is identified, adjust the power level per that class. + +The negotiation processes result in the PDs signaling how many watts of power they would like to receive from the PSE. Depending on the specific PoE standard, the PSE will then supply the power, either over two pairs or four pairs, as noted in Table 13-2. +Chapter 13: LAN Architecture 299 + +Table 13-2 Power over Ethernet Standards + +Name +Cisco Inline Power PoE +PoE+ UPoE +UpoE+ + +Standard Cisco 802.3af 802.3at 802.3bt +802.3bt + +Watts at PSE 7 +15 30 60 +100 + +Powered Wire Pairs 2 +2 2 4 +4 + + +Cisco has been developing products to use some form of PoE since around 2000. Cisco has often developed prestandard power capabilities, like its original Cisco Inline Power (ILP) feature. Over time, the IEEE has produced standards similar to Cisco’s power features, with Cisco supporting the standard version once completed. However, for the most part, the Cisco literature refers to the more common names in the first column of the table. + +PoE and LAN Design +Most of the LAN switch features discussed in this book (and in CCNA 200-301 Official Cert Guide, Volume 1) exist as software features. Once you learn about a software feature, in some cases all you have to do is configure the feature and start using it. (In some cases, you might need to research and license the feature first.) Regardless, adding the feature takes little or no prior planning. + +PoE does require some planning and engineering effort when designing a LAN, both when planning for the cable plant (both Ethernet and electrical), as well as when planning for new networking hardware. Planning with PoE in mind prepares the network to supply power to network devices, rather than reacting and missing opportunities to save money and time. + +The following list includes some of the key points to consider when planning a LAN design that includes PoE: + +■ Powered Devices: Determine the types of devices and specific models, along with their power requirements. +■ Power Requirements: Plan the numbers of different types of PDs to connect into each wiring closet to build a power budget. That power budget can then be processed to determine the amount of PoE power to make available through each switch. +■ Switch Ports: Some switches support PoE standards on all ports, some on no ports, some on a subset of ports. Research the various switch models so that you purchase enough PoE-capable ports for the switches planned for each wiring closet. +■ Switch Power Supplies: Without PoE, when purchasing a switch, you choose a power supply so that it delivers enough power to power the switch itself. With PoE, the switch acts as a distributor of electrical power, so the switch power supply must deliver many more watts than it needs to run the switch itself. You will need to create a power bud-get per switch, based on the number of connected PDs, and purchase power supplies to +match those requirements. +■ PoE Standards versus Actual: Consider the number of PoE switch ports needed, the 13 +standards they support, the standards supported by the PDs, and how much power they consume. For instance, a PD and a switch port may both support PoE+, which supports up to 30 watts supplied by the PSE. However, that powered device may need at most 9 watts to operate, so your power budget needs to reserve less power than the maximum for those devices. +300 CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 13-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 13-3 Chapter Review Tracking + +Review Element Review Date(s) + +Review key topics Review key terms Answer DIKTA questions +Review memory tables + +Resource Used + +Book, app Book, app Book, PTP +Book, app + + +Review All the Key Topics + +Table 13-4 +Key Topic Element +Figure 13-1 Figure 13-2 Figure 13-4 Figure 13-5 List +List +Figure 13-9 +List + +Key Topics for Chapter 13 +Description Page Number +Campus LAN design terms 291 Star topology 292 A two-tier (collapsed core) LAN topology 293 A three-tier (core) LAN topology 294 Definitions for LAN core, distribution, and access layers 295 Components in an integrated SOHO network device 296 PoE roles and terms 297 +Typical steps to discover power requirements with PoE 298 + + +Key Terms You Should Know +star topology, full mesh, partial mesh, collapsed core design, core design, access layer, dis-tribution layer, core layer, SOHO, powered device (PD), power sourcing equipment (PSE), PoE, UPoE + + + + + + + + +This page intentionally left blank +CHAPTER 14 + + + +WAN Architecture + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.2 Describe the characteristics of network topology architecture + +1.2.d WAN + +5.0 Security Fundamentals +5.5 Describe remote access and site-to-site VPNs + + +The CCNA 200-301 exam topics include only brief mentions of WAN topics. Because of that sparse attention to WANs, the CCNA 200-301 Official Cert Guide, Volume 1, intro-duced just enough detail about two types of WAN links—point-to-point serial and point-to-point Ethernet WAN links—so that you could understand IP routing, which is a major focus in CCNA. + +This chapter now turns our attention to WAN topics for a deeper look at three branches of WAN technology. As usual for this book’s discussion of WAN services, the service is viewed mostly from the perspective of the enterprise, as the customer of some WAN ser-vice provider (SP). That means the discussion focuses on what the enterprise receives from the service, rather than how the service provider implements the service inside its network. (Note that Cisco’s Service Provider certification track explores the details of how an SP implements its network.) + +This chapter begins with a discussion of Metro Ethernet, a technology that defines how to use Ethernet links between a customer site and the SP. The second section then examines MPLS VPNs, even though MPLS VPNs came before Metro Ethernet historically. The chap-ter introduces Metro Ethernet first because the many similarities between using Ethernet in the LAN and using Ethernet in the WAN make this topic easier to learn. + +The chapter closes with a third section about how to use the Internet as a private WAN service by using virtual private network (VPN) technology. The Internet does not inher-ently provide a private service in that any attacker who gets a copy of your packets as they pass through the Internet can read the contents. VPN servers secure the data sent over the Internet, effectively creating a private WAN service over the public Internet. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 14-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Metro Ethernet +Multiprotocol Label Switching (MPLS) +Internet VPNs + +Questions 1–3 +4–6 +7 + + +1. Which of the following topology terms most closely describe the topology created by a Metro Ethernet Tree (E-Tree) service? (Choose two answers.) +a. Full mesh b. Partial mesh +c. Hub and spoke d. Point-to-point +2. Which of the following is the most likely technology used for an access link to a Metro Ethernet service? +a. 100BASE-LX10 +b. High-speed TDM (for example, T3, E3) c. MPLS +d. 100BASE-T + +3. An enterprise uses a Metro Ethernet WAN with an Ethernet LAN (E-LAN) service, with the company headquarters plus 10 remote sites connected to the service. The enterprise uses OSPF at all sites, with one router connected to the service from each site. Which of the following are true about the Layer 3 details most likely used with this service and design? (Choose two answers.) +a. The WAN uses one IP subnet. +b. The WAN uses 10 or more IP subnets. +c. A remote site router would have one OSPF neighbor. d. A remote site router would have 10 OSPF neighbors. +4. An enterprise uses an MPLS Layer 3 VPN with the company headquarters connected plus 10 remote sites connected to the service. The enterprise uses OSPF at all sites, with one router connected to the service from each site. Which of the following are true about the Layer 3 details most likely used with this service and design? (Choose two answers.) +a. The WAN uses one IP subnet. +b. The WAN uses 10 or more IP subnets. +c. A remote site router would have one OSPF neighbor. +d. A remote site router would have 10 or more OSPF neighbors. +304 CCNA 200-301 Official Cert Guide, Volume 2 + +5. Which of the following answers is most accurate about access link options for an MPLS network? +a. Uses only TDM (T1, T3, E1, E3, etc.) b. Uses only Ethernet +c. Uses only DSL and cable +d. Uses a wide variety of Layer 1 and Layer 2 networking technologies + +6. An enterprise connects 20 sites into an MPLS VPN WAN. The enterprise uses OSPF for IPv4 routes at all sites. Consider the OSPF area design options and the PE-CE links. Which of the following answers is most accurate about OSPF areas and the +PE-CE links? +a. The PE-CE link may or may not be chosen to be in backbone area 0. b. The PE-CE link must not be in the backbone area 0. +c. The PE-CE link must be in the backbone area 0. d. The PE-CE link will not be in any OSPF area. +7. A colleague mentions using a remote access VPN. Which of the following protocols or technologies would you expect your colleague to have used? + +a. TLS b. IPsec c. GRE d. FTPS + + +Foundation Topics + +Metro Ethernet +Metro Ethernet (MetroE) includes a variety of WAN services with some common features. Each MetroE service uses Ethernet physical links to connect the customer’s device to the service provider’s device. Second, the service is a Layer 2 service in that the WAN provider forwards Ethernet frames from one customer device to another. + +To begin the conversation with a basic view, Metro Ethernet acts much as if the WAN ser-vice were created by one Ethernet switch, as shown in Figure 14-1. The figure shows four sites in the same company, each with a router. Each router is connected to the WAN ser-vice with an Ethernet link of some kind; those Ethernet links typically use one of the fiber Ethernet standards due to the distances involved. From the customer’s perspective (that is, from the perspective of the enterprise that is the customer of the WAN SP), the WAN ser-vice acts like a LAN switch in that it forwards Ethernet frames. + +NOTE Throughout this chapter, the word customer refers to the customer of the service provider—that is, the enterprise that is purchasing the WAN service. +Chapter 14: WAN Architecture 305 + + +Metro Ethernet WAN Service + +R1 +Customer Router + + +14 R3 +Customer Router + + + + +SW1 +Customer Router Layer 2 +R2 + + +Customer Router + +R4 + + +Figure 14-1 Metro Ethernet Concept as a Large Ethernet Switch + +Although the main concept makes a Metro Ethernet service act like a big LAN switch, there are many options, and you should understand the basics of each. Additionally, many cus-tomers connect to a Metro Ethernet service with either routers or Layer 3 switches, which brings up some Layer 3 issues with IP addressing and routing protocols. This section closes with a discussion of the Layer 3 issues. + +Metro Ethernet Physical Design and Topology +From an enterprise perspective, to use a Metro Ethernet service, each site needs to connect to the service with (at least) one Ethernet link. There is no need to connect each enter- +prise router to each other enterprise router directly with a physical link. For instance, in Figure 14-1 in the previous section, each of the four enterprise routers connects to the SP’s MetroE service with one physical Ethernet link, rather than connecting directly to the other enterprise routers. + +From the SP perspective, the SP needs to build a network to create the Metro Ethernet service. To keep costs lower the SP puts a device (typically an Ethernet switch) physically near to as many customer sites as possible, in an SP facility called a point of presence (PoP). Those SP switches need to be near enough to many customer locations so that some Ethernet standard supports the distance from the SP’s PoP to each customer site. Figure 14-2 collects some of these terms and ideas together. + + +User + + +UNI + +R1 Ethernet Access Link + +Network + + + + +SP Network -Details Hidden + + +Ethernet Access Link +UNI R2 + + +AcEctehsesrnLeintk +UNI R3 + + +Located in SP Point of Presence (PoP) + +Distances Set +by Ethernet Standards +Figure 14-2 Ethernet Access Links into a Metro Ethernet Service +306 CCNA 200-301 Official Cert Guide, Volume 2 + +Working through the details in the figure, the physical link between the customer and the SP is called an access link or, when using Ethernet specifically, an Ethernet access link. Everything that happens on that link falls within the definition of the user network inter-face, or UNI. Breaking down the term UNI, the word network refers to the SP’s network, while the SP’s customer (the enterprise) is known as the user of the network. + +Focusing on the center of Figure 14-2, the SP’s network remains hidden to a great extent. The SP promises to deliver Ethernet frames across the WAN. To do that, the access links connect to an Ethernet switch. As you can imagine, the switch will look at the Ethernet header’s MAC address fields and at 802.1Q trunking headers for VLAN tags, but the details inside the network remain hidden. + +The UNI references a variety of standards, including the fact that any IEEE Ethernet stan-dard can be used for the access link. Table 14-2 lists some of the standards you might expect to see used as Ethernet access links, given their support of longer distances than the standards that use UTP cabling. + +Table 14-2 IEEE Ethernet Standards Useful for Metro Ethernet Access + +Name 100BASE-LX10 1000BASE-LX +1000BASE-LX10 1000BASE-ZX 10GBASE-LR +10GBASE-ER + +Speed 100 Mbps 1 Gbps +1 Gbps 1 Gbps 10 Gbps +10 Gbps + +Distance 10 Km +5 Km 10 Km 100 Km 10 Km +40 Km + + +Ethernet WAN Services and Topologies +Beyond adding a physical Ethernet connection from each site into the SP’s Metro Ethernet WAN service, the enterprise must choose between several possible variations of MetroE services. Those variations use different topologies that meet different customer needs. + +MEF (www.mef.net) defines the standards for Metro Ethernet, including the specifications for different kinds of MetroE services. Table 14-3 lists three service types described in this chap-ter and their topologies. The next few pages after the table go into more depth about each. + +Table 14-3 Three MEF Service Types and Their Topologies +MEF Service MEF Short Topology Terms Description Name Name + +Ethernet Line E-Line Service + +Ethernet E-LAN LAN Service + +Point-to-point + + +Full mesh + +Two customer premise equipment (CPE) devices can exchange Ethernet frames, similar in concept to a leased line. +This service acts like a LAN, in that all devices can send frames to all other devices. + + + +Ethernet Tree E-Tree Service + +Hub and spoke; A central site can communicate to a defined partial mesh; set of remote sites, but the remote sites point-to-multipoint cannot communicate directly. + + +Answers to the “Do I Know This Already?” quiz: 1 B, C 2 A 3 A, D 4 B, C 5 D 6 A 7 A +Chapter 14: WAN Architecture + + +NOTE You might see the term Virtual Private Wire Service (VPWS) used for what MEF defines as E-Line service, and Virtual Private LAN Service (VPLS) used for what MEF defines as E-LAN service. You might also see the term Ethernet over MPLS (EoMPLS). All these terms refer to cases in which the SP uses MPLS internally to create what the customer sees as an Ethernet WAN service. + +307 + + + +14 + + +Ethernet Line Service (Point-to-Point) +The Ethernet Line Service, or E-Line, is the simplest of the Metro Ethernet services. The customer connects two sites with access links. Then the MetroE service allows the two cus-tomer devices to send Ethernet frames to each other. Figure 14-3 shows an example, with routers as the CPE devices. + +Metro Ethernet + + +R1 Ethernet Virtual Circuit (EVC) R2 + +Figure 14-3 Point-to-Point Topology in Metro Ethernet E-Line Service Between Routers + +As with all MetroE services, the promise made by the service is to deliver Ethernet frames across the service, as if the two customer routers had a rather long crossover cable connect-ed between them. In fact, the E-Line service is the same Ethernet WAN service you have already seen in many examples throughout this book and CCNA 200-301 Official Cert Guide, Volume 1. For instance, in this case: + +■ The routers would use physical Ethernet interfaces. +■ The routers would configure IP addresses in the same subnet as each other. ■ Their routing protocols would become neighbors and exchange routes. + +The MetroE specifications define the concept of an Ethernet Virtual Connection, or EVC, to define which user (customer) devices can communicate with which. By definition, an +E-Line service (as shown in Figure 14-4) creates a point-to-point EVC, meaning that the ser-vice allows two endpoints to communicate. + + +R2 + + +R1 R3 + + +One 10 Gbps +Access Link R4 Three Different E-Lines +Figure 14-4 Using Multiple E-Lines, One for Each Remote Site + +It may be that an enterprise wants to implement a network exactly as shown in Figure 14-3, with two sites and two routers, with MetroE WAN connectivity using an E-Line service. Other variations exist, even other variations using an E-Line. +308 CCNA 200-301 Official Cert Guide, Volume 2 + +For example, think of a common enterprise WAN topology with a central site and 100 remote sites. As shown so far, with an E-Line service, the central site router would need 100 physical Ethernet interfaces to connect to those 100 remote sites. That could be expensive. As an alternative, the enterprise could use the design partially shown in Figure 14-4 (just three remote sites shown). In this case: + +■ The central site router uses a single 10-Gbps access link. +■ The central site connects to 100 E-Lines (only three shown). +■ All the E-Lines send and receive frames over the same access link. + +Note that this chapter does not get into the configuration details for WAN services. However, designs like Figure 14-4, with multiple E-Line services on a single access link, use 802.1Q trunking, with a different VLAN ID for each E-Line service. As a result, the router configuration can use a typical router configuration with trunking and subinterfaces. + +Before moving on to the next MetroE service, note that the customer could use switches instead of routers to connect to the WAN. Historically, enterprise engineers place routers at the edge of a WAN, in part because that device connected to both the WAN and the LAN, and the LAN and WAN used different types of physical interfaces and different data-link protocols. As a result of how routing works, routers served as the perfect device to sit at the edge between LAN and WAN (called the WAN edge). With MetroE, the LAN and WAN are both Ethernet, so an Ethernet switch becomes an option. + +Ethernet LAN Service (Full Mesh) +Imagine an enterprise needs to connect several sites to a WAN, and the goal is to allow every site to send frames directly to every other site. You could do that with E-Lines, but you would need possibly lots of E-Lines. For instance, to connect three sites with E-Lines so that each site could send frames directly to each other, you only need three E-Lines. But with four, five, and six sites, you would need 6, 10, and 15 E-Lines, respectively. Get up to 20 sites for which all could send frames directly to each other, and you would need 190 +E-Lines. (The formula is N(N – 1) / 2.) + +The people who created MetroE anticipated the need for designs that allow a full mesh— that is, for each pair of nodes in the service to send frames to each other directly. In fact, allowing all devices to send directly to every other device sounds a lot like an Ethernet LAN, so the MetroE service is called an Ethernet LAN service, or E-LAN. + +One E-LAN service allows all devices connected to that service to send Ethernet frames directly to every other device, just as if the Ethernet WAN service were one big Ethernet switch. Figure 14-5 shows a representation of a single E-LAN EVC. In this case, the one EVC connects to four customer sites, creating one E-LAN. Routers R1, R2, R3, and R4 can all send frames directly to each other. They would also all be in the same Layer 3 subnet on the WAN. + +An E-LAN service connects the sites in a full mesh. The term full mesh refers to a design that, for a set of devices, creates a direct communication path for each pair. In contrast, a partial mesh refers to a design in which only some of the pairs can communicate directly. The Ethernet Tree service (E-Tree), as discussed in the next topic, creates a partial mesh design. +Chapter 14: WAN Architecture 309 + + + +R1 R2 14 + + + + + +R4 R3 + +Figure 14-5 MetroE Ethernet LAN Service—Any-to-Any Forwarding over the Service + +Ethernet Tree Service (Hub and Spoke) +The Ethernet Tree service (E-Tree) creates a WAN topology in which the central site device can send Ethernet frames directly to each remote (leaf) site, but the remote (leaf) sites can send only to the central site. Figure 14-6 shows the topology, again with a single EVC. In this case, router R1 is the root site, and can send to all three remote sites. Routers R2, R3, and R4 can send only to R1. + +E-Tree Leaves + +E-Tree Root R2 + + +R1 R3 + + +R4 + +Figure 14-6 E-Tree Service Creates a Hub-and-Spoke Topology + +With an E-Tree, the central site serves as the root of a tree and each remote site as one of the leaves. The topology goes by many names: partial mesh, hub and spoke, and point-to-multipoint. Regardless of the term you use, an E-Tree service creates a service that works well for designs with a central site plus many remote sites. + +Layer 3 Design Using Metro Ethernet +Now that you know the basics of the E-Line (point-to-point), E-LAN (full mesh), and E-Tree (point-to-multipoint, hub and spoke) services, this next topic reviews some Layer 3 design details when using E-Line and E-Tree services. That is, if the enterprise uses routers or Layer 3 switches as its WAN edge devices, how should the engineer plan for IP addresses and sub-nets? What is the impact on routing protocols? This section answers those questions. + +Note that this section uses routers as the enterprise’s devices, but the concepts apply to Layer 3 switches as well. + +Layer 3 Design with E-Line Service +Every E-Line uses a point-to-point topology. As a result, the two routers on the ends of an E-Line need to be in the same subnet. Similarly, when an enterprise uses multiple E-Lines, each should be in a different subnet. As an example, consider Figure 14-7, which shows two E-Lines, both of which connect to router R1 on the left. +310 CCNA 200-301 Official Cert Guide, Volume 2 + + + +R2 + + +R1 R3 +Two E-Lines (Point-to-Point) +Figure 14-7 Routing Protocol Neighbor Relationships over Metro Ethernet E-Line + +Focusing on the E-Lines and ignoring the access links for the most part, think of each +E-Line as a subnet. Each router needs an IP address in each subnet, and the subnets need to be unique. All the addresses come from the enterprise’s IP address space. Figure 14-8 shows an example of the addresses, subnets, and three OSPF-learned routes in the routing table +of R3. + + + + + + +10.1.1.0/24 +.1 + +R1 .1 + + +Subnet 10.1.12.0 /24 + + + +Subnet 10.1.13.0 /24 + + +Next-Hop for Routes + + + + +.2 + +G0/1.13 + +.3 + + +R3 Routing Table + +10.1.2.0/24 + + +R2 + + +G0/2 R3 + +10.1.3.0/24 + + + +Code Subnet +O 10.1.1.0/24 +O 10.1.2.0/24 + +Interface G0/1.13 +G0/1.13 + +Next-hop 10.1.13.1 +10.1.13.1 + +O 10.1.12.0/24 G0/1.13 10.1.13.1 C 10.1.3.0/24 G0/2 N/A +C 10.1.13.0/24 G0/1.13 N/A +Figure 14-8 Layer 3 Forwarding Between Remote Sites—Through Central Site + +Examine the IP routing table in the lower right of the figure, first focusing on the route to subnet 10.1.1.0/24, which is the LAN subnet off router R1. R3’s route points to a next-hop router IP address that is R1’s IP address on the Ethernet WAN, specifically the address on the other side of the E-Line that connects R1 and R3. This route should not be a surprise: for R3 to send packets to a subnet connected to R1, R3 sends the packets to R1. Also, it happens to use a subinterface (G0/1.13), which means that the design is using 802.1Q trunk-ing on the link. +Next, look at R3’s route for subnet 10.1.2.0/24, which supports the fact that R3 cannot send packets directly to R2 with the current WAN design. R3 does not have an E-Line that allows R3 to send frames directly to R2. R3 will not become routing protocol neigh-bors with R2 either. So, R3 will learn its route for subnet 10.1.2.0/24 from R1, with R1’s +10.1.13.1 address as the next-hop address. As a result, when forwarding packets, R3 will for-ward packets to R1, which will then forward them over the other E-Line to R2. +Chapter 14: WAN Architecture + +Layer 3 Design with E-LAN Service +If you connected four routers to one LAN switch, all in the same VLAN, what would you expect for the IP addresses on those routers? And if all four routers used the same routing protocol, which would become neighbors? Typically, with four routers connected to the same switch, on the same VLAN, using the same routing protocol, normally all four routers would have IP addresses in the same subnet, and all would become neighbors. + +On an E-LAN service, the same IP addressing design is used, with the same kinds of rout-ing protocol neighbor relationships. Figure 14-9 shows an example that includes subnets and addresses, plus one route as an example. Note that the four routers connected to the E-LAN service in the center all have addresses in subnet 10.1.99.0/24. + +311 + + + +14 + + +10.1.1.0/24 .1 Subnet 10.1.99.0 /24 .2 10.1.2.0/24 + + +R1 R2 + + + + + +G0/1.99 +R4 R3 + +10.1.4.0/24 .4 MetroE E-LAN Service .3 10.1.3.0/24 + +R3 Routing Table (OSPF Routes Only) + +Subnet 10.1.2.0/24 10.1.1.0/24 +10.1.4.0/24 + +Interface G0/1.99 G0/1.99 +G0/1.99 + +Next-hop 10.1.99.2 10.1.99.1 +10.1.99.4 + +Figure 14-9 Layer 3 Forwarding Between Sites with E-LAN Service + +Look at R3’s routing table in the figure, the route from R3 to R2’s LAN subnet (10.1.2.0/24). In this case, R3’s next-hop address is the WAN address on R2 (10.1.99.2), and R3 will send packets (encapsulated in Ethernet frames) directly to R2. Note also that the other two routes in the routing table list the next-hop addresses of R1 (10.1.99.1) and R4 (10.1.99.4). + +The details in this first section of the chapter should provide plenty of perspective on how enterprise routers use Ethernet WANs for connectivity. However, if you want a little more detail, the section titled “Ethernet Virtual Circuit Bandwidth Profiles” in Appendix D, “Topics from Previous Editions,” discusses the logic behind how Ethernet WANs use physi-cal links at one speed while supporting services that run at a variety of slower speeds. + +Multiprotocol Label Switching (MPLS) +From your CCNA preparation so far, you already understand a lot about the Layer 3 rout-ing, as represented by the packet flowing left to right in Figure 14-10. Each router makes a +separate forwarding decision to forward the packet, as shown as steps 1, 2, and 3 in the figure. Each router makes a comparison between the packet’s destination IP address and that router’s IP routing table; the matching IP routing table entry tells the router where to forward the packet next. To learn those routes, the routers typically run some routing protocol. +312 CCNA 200-301 Official Cert Guide, Volume 2 + +1 2 3 +10.1.1.0/24 IP IP IP 10.1.2.0/24 + +R1 R2 + + + + + +R4 R3 + +10.1.4.0/24 10.1.3.0/24 Figure 14-10 Basic IP Routing of IP Packets +MPLS creates a WAN service that routes IP packets between customer sites. The enterprise deploys routers and switches as usual. The SP then creates its own IP network, spanning a large geographic area. The customer can then connect to the MPLS network, with a link from each site, with the SP routing IP packets from one customer site to the other. For instance, in Figure 14-10, the middle four routers could represent the SP’s MPLS network, with the numbered routers on the edges being routers owned by one company. + +However, an SP cannot just build a large IP network and connect all its customers to that same IP network because of some issues that arise to support multiple customers at the same time. For instance, many customers will use the same private IP network (for instance, network 10.0.0.0), so the SP’s IP network would learn large numbers of routes to overlap-ping subnets. + +To overcome this and other issues, the SP builds its IP network to also use Multiprotocol Label Switching (MPLS), in particular MPLS VPNs. MPLS VPNs allow the SP to build one large MPLS network, which also creates a private IP-based WAN for each of its custom-ers. With MPLS VPNs, the SP can separate the routes learned from one customer from the +routes learned for the next customer; consequently, the SP can support each customer while preventing packets from leaking from one customer to the next. + +To give you a little insight as to why MPLS is not just an IP network with routers, internally, the devices in an MPLS network use label switching—hence, the name MPLS. The routers on the edge of the MPLS network add and remove an MPLS header to packets as they enter and exit the MPLS network. The devices inside the MPLS network then use the label field inside that MPLS header when forwarding data across the MPLS network. The choices of the labels to use, along with other related logic, allow the MPLS VPN to create separate VPNs to keep different customers’ traffic separate. + +NOTE While MPLS VPNs provide a Layer 3 service to customers, MPLS itself is some-times called a Layer 2.5 protocol because it adds the MPLS header between the data-link header (Layer 2) and the IP header (Layer 3). + +As usual, the discussion of WAN services in this book ignores as much of the SP’s network as possible. For instance, you do not need to know how MPLS labels work. However, because MPLS VPNs create a Layer 3 service, the customer must be more aware of what +Chapter 14: WAN Architecture + +the SP does than with other WAN servers, so you need to know a few facts about how an MPLS network approaches some Layer 3 functions. In particular, the SP’s MPLS VPN network + +■ Will use a routing protocol to build routing protocol neighbor relationships with cus-tomer routers +■ Will learn customer subnets/routes with those routing protocols +■ Will advertise a customer’s routes with a routing protocol so that all routers that custom-er connects to the MPLS VPN can learn all routes as advertised through the MPLS VPN network +■ Will make decisions about MPLS VPN forwarding, including what MPLS labels to add and remove, based on the customer’s IP address space and customer IP routes + +313 + + + +14 + + +As an aside, MPLS VPNs create a private network by keeping customer data separate, but not by encrypting the data. Some VPN services encrypt the data, expecting that attack-ers might be able to receive copies of the packets. With MPLS, even though the packets for two customers may pass through the same devices and links inside the MPLS network, MPLS logic can keep the packets separate for each customer. +This second of two major sections of the chapter works through the basics of MPLS, specif-ically MPLS VPNs. This section first looks at the design, topology, and terminology related to building the customer-facing parts of an MPLS network. It then looks at the impact and issues created by the fact that the MPLS network provides a Layer 3 service. + +MPLS VPN Physical Design and Topology +MetroE provides a Layer 2 service by forwarding Layer 2 Ethernet frames. To do that, the SP often uses Ethernet switches at the edge of its network. Those switches are configured to do more than what you learn about Ethernet LAN switches for CCNA, but a LAN switch’s most fundamental job is to forward an Ethernet frame, so it makes sense for MetroE to use an Ethernet switch at the edge of the SP’s MetroE network. + +MPLS provides a Layer 3 service in that it promises to forward Layer 3 packets (IPv4 and IPv6). To support that service, MPLS SPs typically use routers at the edge of the MPLS net-works because routers provide the function of forwarding Layer 3 packets. + +As usual, each WAN technology has its own set of terms and acronyms, so Figure 14-11 shows two important MPLS terms in context: customer edge (CE) and provider edge (PE). Because MPLS requires so much discussion about the devices on the edge of the customer and SP network, MPLS uses specific terms for each. The customer edge device is typically a router, and it sits at a customer site—that is, at a site in the company that is buying the MPLS service. The provider edge devices sit at the edge of the SP’s network, on the other end of the access link. + +Next, to appreciate what MPLS does, think back to how routers use their different kinds of physical interfaces and different kinds of data-link protocols. When routing a packet, rout-ers discard an incoming data-link frame’s data-link header and trailer and then build a new data-link header/trailer. That action allows the incoming packet to arrive inside a frame of one data-link protocol and leave out an interface with another data-link protocol. +314 CCNA 200-301 Official Cert Guide, Volume 2 + + +10.1.1.0/24 Customer Edge + +Customer 10.1.2.0/24 Edge + + +R1 R2 + +MPLS: Hidden Details + + +R4 R3 + + +10.1.4.0/24 + +Figure 14-11 + +10.1.3.0/24 +Provider Edge +MPLS Layer 3 Design, with PE and CE Routers + + +With MPLS, the fact that the devices are routers, discarding and adding new data-link head-ers, means that MPLS networks support a variety of access links. The fact that MPLS acts as a Layer 3 service, discarding incoming data-link headers, means that any data-link protocol could in theory be used on MPLS access links. In reality, MPLS does support many types of access links, as shown in Figure 14-12. + +Access Links +10.1.1.0/24 10.1.2.0/24 + +Serial +CE1 (TDM) PE1 PE3 4G/5G CE2 + + + + +Metro Ethernet + +CE4 + +MPLS: Hidden Details +CATV + +PE2 PE4 CE3 + + + +10.1.4.0/24 + +Figure 14-12 + +10.1.3.0/24 Access Links +Popular MPLS Access Link Technologies + + +The variety of access links available for MPLS networks makes MPLS a great option for building large enterprise networks. For sites that are near MetroE services, especially for sites that need at least 10 Mbps of bandwidth, using MetroE as an access link makes great sense. Then, for sites that are more remote, the carrier may not offer MetroE services to that area, but many carriers can install a serial link to remote sites. Or, common Internet access technologies, like cable and wireless 4G/5G services, can also be used to access an MPLS network. + +MPLS and Quality of Service +MPLS stands apart from other WAN services as the first WAN service for which the SP provided effective Quality of Service (QoS) features. You should be able to get a general idea of an MPLS QoS benefit with the following basic example. +Chapter 14: WAN Architecture + +IP networks can and often do forward voice traffic in IP packets, called Voice over IP (VoIP). If a WAN service does not provide QoS, that means that the WAN service does not treat one packet any differently than any other packet. With QoS, the SP’s network can treat packets differently, giving some packets (like VoIP) better treatment. For a voice call to sound good, each voice packet must have low loss (that is, few packets are discarded); low one-way delay through the network; and low variation in delay (called jitter). Without QoS, a voice call over an IP network will not sound good. + +With a QoS-capable WAN, the customer can mark VoIP packets so that the MPLS network can recognize VoIP packets and treat them better, resulting in better voice call quality. But to make it work correctly, the customer and MPLS provider need to cooperate. + +For instance, for VoIP packets traveling left to right in Figure 14-13, router CE1 could be configured with QoS marking tools. Marking tools could recognize VoIP packets and place a specific value in the IP header of VoIP packets (a value called DSCP EF, per the figure). The MPLS WAN provider would then configure its QoS tools to react for packets that have that marking, typically sending that packet as soon as possible. The result: low delay, low jit-ter, low loss, and a better call quality. + +315 + + + +14 + + + +Before Sending, Mark VolP as DSCP EF + +1 + +Forward DSCP EF Now for Low: Delay, Jitter, Loss + +2 3 + + +CE1 PE1 MPLS PE2 CE2 + +Figure 14-13 MPLS VPN QoS Marking and Reaction in the MPLS WAN + +Summarizing the ideas so far, MPLS supports a variety of access links. An enterprise would select the type and speed of access link for each site based on the capacity (bandwidth) required for each site. Beyond that basic connectivity, the enterprise will want to work with the SP to define other features of the service. The customer and SP will need to work through the details of some Layer 3 design choices (as discussed in more depth in the next +section). The customer will also likely want to ask for QoS services from the MPLS provider and define those details. + +Layer 3 with MPLS VPN +Because MetroE provides a Layer 2 service, the SP has no need to understand anything about the customer’s Layer 3 design. The SP knows nothing about the customer’s IP addressing plan and has no need to participate with routing protocols. + +MPLS VPNs take the complete opposite approach. As a Layer 3 service, MPLS must be aware of the customer IP addressing. The SP will even use routing protocols and advertise those customer routes across the WAN. This section takes a closer look at what that means. + +First, keep the primary goals in mind. The customer pays good money for a WAN service to deliver data between sites, with certain levels of availability and quality (for instance, low delay, jitter, and loss for VoIP). But to support that base function of allowing packet deliv-ery from each WAN site to the other, the CE routers need to exchange routes with the PE routers in the MPLS network. Additionally, all the CE routers need to learn routes from the other CE routers—a process that relies on the PE routers. +316 CCNA 200-301 Official Cert Guide, Volume 2 + +First, the CE routers and the PE router on the ends of the same access link need to exchange routes, as shown in Figure 14-14. The figure shows the CE-PE routing protocol neighbor relationships (as lines with circles on the ends). In this case, the customer chose to use OSPF. However, MPLS allows for many familiar routing protocols on the edge of the MPLS network: RIPv2, EIGRP, OSPF, and even eBGP. + + + + + +10.1.1.0/24 +OSPF + +10.1.2.0/24 +OSPF + +PE2 CE2 +10.1.3.0/24 +OSPF + + + +CE1 PE1 PE3 + + +OSPF + +CE3 + +10.1.4.0/24 + +CE4 + + +Figure 14-14 Routing Protocol Neighbor Relationships with MPLS Customer Edge Routers + +Additionally, all the CE routers need to learn routes from the other CE routers. However, a CE router does not form routing protocol neighbor relationships directly with the other CE routers, as noted in Figure 14-14. Summarizing what does and does not happen: + +■ A CE router does become neighbors with the PE router on the other end of the access link. +■ A CE router does not become neighbors with other CE routers. +■ The MPLS network does advertise the customer’s routes between the various PE routers so that the CE routers can learn all customer routes through their PE-CE routing proto-col neighbor relationship. + +To advertise the customer routes between the PE routers, the PE routers use another routing protocol along with a process called route redistribution. Route redistribution happens inside one router, taking routes from one routing protocol process and injecting them into another. MPLS does route redistribution in the PE routers between the routing protocol used by the customer and a variation of BGP called Multiprotocol BGP (MPBGP). (Redistribution is needed when the PE-CE routing protocol is not BGP.) Figure 14-15 shows the idea. + +Redistribution Redistribution + + +OSPF MPBGP OSPF + +CE1 PE1 PE3 CE3 + +Figure 14-15 MPLS VPN Using Redistribution with MPBGP at PE Router + +Just as a quick aside about MPBGP, MPLS VPNs use MPBGP (as opposed to other routing protocols) because MPBGP can advertise routes from multiple customers while keeping the +Chapter 14: WAN Architecture + +routes logically separated. For instance, continuing the example in Figure 14-15, router PE1 might sit in one PoP but connect to dozens of different customers. Likewise, router PE3 might connect to many of those same customers. MPBGP can advertise routes for all those customers and mark which routes are from which customers so that only the correct routes are advertised to each CE router for different customers. + +At the end of the process, for all single enterprises, all the routers can learn routes to all the subnets reachable over the MPLS VPN WAN. WAN routes on the CE routers refer to the neighboring PE router as the next-hop router. Each CE router becomes a routing protocol neighbor with the SP’s PE router on the other end of the access link. Plus, MPLS provides the flexibility to use whatever type of physical access link makes sense for the location at each site, while still connecting to the same MPLS network. + +Internet VPNs +To build the Internet, Internet service providers (ISP) need links to other ISPs as well as links to the ISPs’ customers. The Internet core connects ISPs to each other using a variety of high-speed technologies. Additionally, Internet access links connect an ISP to each customer, again with a wide variety of technologies. The combination of ISP networks and customer networks that connect to the ISPs together create the worldwide Internet. + +For these customer access links, the technologies need to be inexpensive so that a typi- +cal consumer can afford to pay for the service. But businesses can use many of these same technologies to connect to the Internet. Some WAN technologies happen to work particu-larly well as Internet access technologies. For example, several use the same telephone line installed into most homes by the phone company so that the ISPs do not have to install additional cabling. Some use the TV cabling, whereas others use wireless. + +While consumers typically connect to the Internet to reach destinations on the Internet, businesses can also use the Internet as a WAN service. First, the enterprise can connect each business site to the Internet. Then, using virtual private network (VPN) technology, the enterprise can create an Internet VPN. An Internet VPN can keep the enterprise’s packet private through encryption and other means, even while sending the data over the Internet. + +This final major section of the chapter discusses some of the basics of Internet access links. The section then details how an enterprise can communicate securely over the Internet, making the public Internet act like a private network, by creating an Internet VPN. + +Internet Access +Private WAN technology may be used to access an ISP’s network, including the Ethernet WAN and MPLS technologies discussed earlier in this chapter. Figure 14-16 shows a few of these, just as a visual reminder of these options. + +In addition to the traditional services shown in the figure, enterprises can also use Internet access technologies more commonly used by consumers, including DSL, cable, 4G/5G, and fiber Ethernet. The chapter includes this information about Internet access technologies to provide useful background information before getting into Internet VPN topics. + +317 + + + +14 +318 CCNA 200-301 Official Cert Guide, Volume 2 + + +Customer Sites +TDM (T3, E3) + +ISP Routers + + + + + + +MPLS VPN + + +Metro Ethernet + +Internet +- Delivers IP Packets - Public! + + + +Figure 14-16 Three Examples of Internet Access Links for Companies + +Digital Subscriber Line +In the consumer Internet access space, one big speed breakthrough happened with the intro-duction of the digital subscriber line (DSL). It represented a big technological breakthrough in terms of raw speed in comparison to some older technologies, such as analog modems. These faster speeds available through DSL also changed how people could use the Internet because many of today’s common applications would be unusable with the earlier Internet access technologies (analog modems and Integrated Services Digital Network, or ISDN). +Telephone companies (telcos) greatly influenced the creation of DSL. As a technology, DSL gave telcos a way to offer much faster Internet access speeds. As a business opportunity, DSL gave telcos a way to offer a valuable high-speed Internet service to many of their exist-ing telephone customers, over the same physical phone line already installed, which created a great way for telcos to make money. + +Figure 14-17 shows some of the details of how DSL works on a home phone line. The phone can do what it has always done: plug into a phone jack and send analog signals. For the data, a DSL modem connects to a spare phone outlet. The DSL modem sends and +receives the data, as digital signals, at higher frequencies, over the same local loop, even at the same time as a telephone call. (Note that the physical installation often uses frequency filters that are not shown in the figure or discussed here.) + +Because DSL sends analog (voice) and digital (data) signals on the same line, the telco has +to somehow split those signals on the telco side of the connection. To do so, the local loop must be connected to a DSL access multiplexer (DSLAM) located in the nearby telco cen-tral office (CO). The DSLAM splits out the digital data over to the router on the lower right in Figure 14-17, which completes the connection to the Internet. The DSLAM also splits out the analog voice signals over to the voice switch on the upper right. +Chapter 14: WAN Architecture 319 + + +PSTN +14 + +Voice Switch + + +Ethernet Cable Phone Cable +Telephone DSLAM Line +DSL Modem + +Home Telco CO +Internet + +Figure 14-17 Wiring and Devices for a Home DSL Link + +Cable Internet +DSL uses the local link (telephone line) from the local telco. Cable Internet instead uses the cabling from what has become the primary competitor to the telco in most markets: the cable company. + +Cable Internet creates an Internet access service that, when viewed generally rather than spe-cifically, has many similarities to DSL. Like DSL, cable Internet takes full advantage of exist-ing cabling, using the existing cable TV (CATV) cable to send data. Like DSL, cable Internet uses asymmetric speeds, sending data faster downstream than upstream, which works well for most consumer locations. And cable Internet still allows the normal service on the cable (cable TV), at the same time as the Internet access service is working. + +Cable Internet also uses the same general idea for in-home cabling as DSL, just using CATV cabling instead of telephone cabling. The left side of Figure 14-18 shows a TV connected to the CATV cabling, just as it would normally connect. At another cable outlet, a cable modem connects to the same cable. The Internet service flows over one frequency, like yet another TV channel, just reserved for Internet service. + +Cable Co + +Ethernet Cable CATV Cable + + +Cable Modem + +Home + +Internet + +Figure 14-18 Wiring and Devices for a Home Cable Internet Link +320 CCNA 200-301 Official Cert Guide, Volume 2 + +Similar to DSL, on the CATV company side of the connection (on the right side of the fig-ure), the CATV company must split out the data and video traffic. Data flows to the lower right, through a router, to the Internet. The video comes in from video dishes for distribu-tion out to the TVs in people’s homes. + +Wireless WAN (3G, 4G, LTE, 5G) +Many of you reading this book have a mobile phone that has Internet access. That is, you can check your email, surf the Web, download apps, and watch videos. Many of us today rely on our mobile phones, and the Internet access built in to those phones, for most of our tweets and the like. This section touches on the big concepts behind the Internet access technology connecting those mobile phones. + +Mobile phones use radio waves to communicate through a nearby mobile phone tower. The phone has a small radio antenna, and the provider has a much larger antenna sitting at the top of a tower somewhere within miles of you and your phone. Phones, tablet computers, laptops, and even routers (with the correct interface cards) can communicate through to the Internet using this technology, as represented in Figure 14-19. + + + + + +Mobile Provider as ISP + + +Internet + + + + +Figure 14-19 Wireless Internet Access Using 3G/4G/5G Technology + +The mobile phone radio towers also have cabling and equipment, including routers. The mobile provider builds its own IP network, much like an ISP builds out an IP network. The customer IP packets pass through the IP router at the tower into the mobile provider’s IP network and then out to the Internet. + +The market for mobile phones and wireless Internet access for other devices is both large and competitive. As a result, the mobile providers spend a lot of money advertising their services, with lots of names for one service or the other. Frankly, it can be difficult to tell what all the marketing jargon means, but a few terms tend to be used throughout the industry: + +Wireless Internet: This general term refers to Internet services from a mobile phone or from any device that uses the same technology. +3G/4G Wireless: Short for third generation and fourth generation, these terms refer to the major changes over time to the mobile phone companies’ wireless networks. +LTE: Long-Term Evolution is a newer and faster technology considered to be part of fourth generation (4G) technology. +5G Wireless: This is the fifth major generation of wireless phone technology. + +The takeaway from all this jargon is this: when you hear about wireless Internet services with a mobile phone tower in the picture—whether the device is a phone, tablet, or PC—it +Chapter 14: WAN Architecture 321 + +is probably a 3G, 4G, or LTE wireless Internet connection, with newer services offering 5G +capabilities by 2020 and beyond. 14 Enterprises can use this same wireless technology to connect to the Internet. For instance, a +network engineer can install a 4G wireless card in a router. ISPs team with wireless operators to create contracts for wireless and Internet service. + +Fiber (Ethernet) Internet Access +The consumer-focused Internet access technologies discussed in this section use a couple of different physical media. DSL uses the copper wiring installed between the telco CO and the home. Cable uses the copper CATV cabling installed from the cable company to the home. And, of course, wireless WAN technologies do not use cables for Internet access. + +The cabling used by DSL and cable Internet uses copper wires, but, comparing different types of physical media, fiber-optic cabling generally supports faster speeds for longer dis-tances. That is, just comparing physical layer technologies across the breadth of networking, fiber-optic cabling supports longer links, and those links often run at equivalent or faster speeds. + +Some ISPs now offer Internet access that goes by the name fiber Internet, or simply fiber. To make that work, some local company that owns the rights to install cabling underground in a local area (often a telephone company) installs new fiber-optic cabling. Once the cable plant is in place (a process that often takes years as well as a large budget), the fiber ISP then connects customers to the Internet using the fiber-optic cabling. Often, the fiber uses Ethernet protocols over the fiber. The end result: high-speed Internet to the home, often using Ethernet technology. + +Internet VPN Fundamentals +Private WANs have some wonderful security features. In particular, the customers who send data through the WAN have good reason to believe that no attackers saw the data in transit or even changed the data to cause some harm. The private WAN service provider promises to send one customer’s data to other sites owned by that customer, but not to sites owned by other customers, and vice versa. + +VPNs try to provide the same secure features as a private WAN while sending data over a network that is open to other parties (such as the Internet). Compared to a private WAN, the Internet does not provide for a secure environment that protects the privacy of an enter-prise’s data. Internet VPNs can provide important security features, such as the following: + +■ Confidentiality (privacy): Preventing anyone in the middle of the Internet (man in the middle) from being able to read the data +■ Authentication: Verifying that the sender of the VPN packet is a legitimate device and not a device used by an attacker +■ Data integrity: Verifying that the packet was not changed as the packet transited the Internet +■ Anti-replay: Preventing a man in the middle from copying and later replaying the pack-ets sent by a legitimate user, for the purpose of appearing to be a legitimate user + +To accomplish these goals, two devices near the edge of the Internet create a VPN, some-times called a VPN tunnel. These devices add headers to the original packet, with these +322 CCNA 200-301 Official Cert Guide, Volume 2 + +headers including fields that allow the VPN devices to make the traffic secure. The VPN devices also encrypt the original IP packet, meaning that the original packet’s contents are undecipherable to anyone who happens to see a copy of the packet as it traverses the Internet. + +Figure 14-20 shows the general idea of what typically occurs with a VPN tunnel. The figure shows a VPN created between a branch office router and a Cisco firewall. In this case, the VPN is called a site-to-site VPN because it connects two sites of a company. + + +S1 +10.1.1.1 + + +Source = 10.2.2.2 Destination = 10.1.1.1 + + +Source = 64.100.9.9 Destination = 128.107.1.1 + + + +Source = 10.2.2.2 Destination = 10.1.1.1 + + + +IP Packet +5 4 + + +New IP Hdr VPN Header Encrypted +3 2 + + +IP Packet +1 + + +128.107.1.1 64.100.9.9 + +FW1 +Internet Enterprise +Central Site + + +PC1 10.2.2.2 + +Branch Office + +Figure 14-20 VPN Tunnel Concepts for a Site-to-Site Intranet VPN + +The figure shows the following steps, which explain the overall flow: + +1. Host PC1 (10.2.2.2) on the right sends a packet to the web server (10.1.1.1), just as it would without a VPN. +2. The router encrypts the packet, adds some VPN headers, adds another IP header (with public IP addresses), and forwards the packet. +3. An attacker in the Internet copies the packet (called a man-in-the-middle attack). However, the attacker cannot change the packet without being noticed and cannot read the contents of the original packet. +4. Firewall FW1 receives the packet, confirms the authenticity of the sender, confirms that the packet has not been changed, and then decrypts the original packet. +5. Server S1 receives the unencrypted packet. + +The benefits of using an Internet-based VPN as shown in Figure 14-20 are many. The cost of a high-speed Internet access connection as discussed in the last few pages is usually much less than that of many private WAN options. The Internet is seemingly everywhere, making this kind of solution available worldwide. And by using VPN technology and protocols, the communications are secure. + +NOTE The term tunnel refers to any protocol’s packet that is sent by encapsulating the packet inside another packet. The term VPN tunnel may or may not imply that the tunnel also uses encryption. + +Site-to-Site VPNs with IPsec +A site-to-site VPN provides VPN services for the devices at two sites with a single VPN tunnel. For instance, if each site has dozens of devices that need to communicate between +Chapter 14: WAN Architecture + +sites, the various devices do not have to act to create the VPN. Instead, the network engi-neers configure devices such as routers and firewalls (as shown in Figure 14-20) to create one VPN tunnel. The tunnel endpoints create the tunnel and leave it up and operating all the time, so that when any device at either site decides to send data, the VPN is available. All the devices at each site can communicate using the VPN, receiving all the benefits of the VPN, without requiring each device to create a VPN for themselves. + +IPsec defines one popular set of rules for creating secure VPNs. IPsec is an architecture or framework for security services for IP networks. The name itself is not an acronym, but rather a name derived from the title of the RFC that defines it (RFC 4301, “Security Architecture for the Internet Protocol”), more generally called IP Security, or IPsec. + +IPsec defines how two devices, both of which connect to the Internet, can achieve the main goals of a VPN as listed at the beginning of this section: confidentiality, authentication, data integrity, and anti-replay. IPsec does not define just one way to implement a VPN, instead allowing several different protocol options for each VPN feature. One of IPsec’s strengths is that its role as an architecture allows it to be added to and changed over time as improve-ments to individual security functions are made. + +The idea of IPsec encryption might sound intimidating, but if you ignore the math—and thankfully, you can—IPsec encryption is not too difficult to understand. IPsec encryption uses a pair of encryption algorithms, which are essentially math formulas, to meet a couple of requirements. First, the two math formulas are a matched set: + +■ One to hide (encrypt) the data +■ Another to re-create (decrypt) the original data based on the encrypted data + +323 + + + +14 + + +Besides those somewhat obvious functions, the two math formulas were chosen so that if an attacker intercepted the encrypted text but did not have the secret password (called an encryption key), decrypting that one packet would be difficult. In addition, the formulas are also chosen so that if an attacker did happen to decrypt one packet, that information would not give the attacker any advantages in decrypting the other packets. + +The process for encrypting data for an IPsec VPN works generally as shown in Figure 14-21. Note that the encryption key is also known as the session key, shared key, or shared session key. + +Receiving Host Sending Host + + +Original +IP Packet + +IPOrPigaicnkaelt Session Key + + +1 +Session Key +F(IP Packet, Session-key) = Encrypted Data + + +4 + +F’ (Encrypted-data, Session-key) = Clear-text Data + + +2 + +IP Header VPN Header Encrypted Data + + +3 + +Figure 14-21 Basic IPsec Encryption Process +324 CCNA 200-301 Official Cert Guide, Volume 2 +GRE Tunnel w/ IPsec + +The four steps highlighted in the figure are as follows: + +1. The sending VPN device (like the remote office router in Figure 14-21) feeds the original packet and the session key into the encryption formula, calculating the encrypted data. +2. The sending device encapsulates the encrypted data into a packet, which includes the new IP header and VPN header. +3. The sending device sends this new packet to the destination VPN device (FW1 back in Figure 14-21). +4. The receiving VPN device runs the corresponding decryption formula, using the encrypted data and session key—the same key value as was used on the sending VPN device—to decrypt the data. + +While Figure 14-21 shows the basic encryption process, Figure 14-22 shows a broader view of IPsec VPNs in an enterprise. First, devices use some related VPN technology like Generic Routing Encapsulation (GRE) to create the concept of a tunnel (a virtual link between the routers), with three such tunnels shown in the figure. Without IPsec, each GRE tunnel could be used to forward unencrypted traffic over the Internet. IPsec adds the security features +GRE Tunnel w/ IPsec +to the data that flows over the tunnel. (Note that the figure shows IPsec and GRE, but IPsec teams with other VPN technologies as well.) + + + +R2 + + + +GRE Tunnel w/ IPsec + +R1 R3 +. +. +. . + + +R4 + +Any Internet Access Technology +Figure 14-22 Site-to-Site VPN Tunnels with GRE and IPsec + +Remote Access VPNs with TLS +A site-to-site VPN exists to support multiple devices at each site and is typically created by devices supported by the IT staff. In contrast, individual devices can dynamically initi- +ate their own VPN connections in cases where a permanent site-to-site VPN does not exist. For instance, a user can walk into a coffee shop and connect to the free Wi-Fi, but that coffee shop does not have a site-to-site VPN to the user’s enterprise network. Instead, the user’s device creates a secure remote access VPN connection back to the enterprise network before sending any data to hosts in the enterprise. +Chapter 14: WAN Architecture 325 + +While IPsec and GRE (or other) tunnels work well for site-to-site VPNs, remote access +VPNs often use the Transport Layer Security (TLS) protocol to create a secure VPN session. 14 TLS has many uses today, but most commonly, TLS provides the security features of HTTP +Secure (HTTPS). Today’s web browsers support HTTPS (with TLS) as a way to dynamically create a secure connection from the web browser to a web server, supporting safe online access to financial transactions. To do so, the browser creates a TCP connection to server well-known port 443 (default) and then initializes a TLS session. TLS encrypts data sent between the browser and the server and authenticating the user. Then, the HTTP messages flow over the TLS VPN connection. + +NOTE In years past, Secure Sockets Layer (SSL) played the same role as TLS. SSL has been deprecated (see RFC 7568) and has been replaced by TLS. + +The built-in TLS functions of a web browser create one secure web browsing session, but each session secures only the data sent in that session. This same TLS technology can be used to create a client VPN that secures all packets from the device to a site by using a Cisco VPN client. The Cisco AnyConnect Secure Mobility Client (or AnyConnect Client for short) is software that sits on a user’s PC and uses TLS to create one end of a VPN remote-access tunnel. As a result, all the packets sent to the other end of the tunnel are encrypted, not just those sent over a single HTTP connection in a web browser. + +Figure 14-23 compares the option to create a VPN remote access VPN session from a com-puter to a site versus for a single HTTPS session. The figure shows a VPN tunnel for PC using the AnyConnect Client to create a client VPN. The AnyConnect Client creates a TLS tunnel to the firewall that has been installed to expect VPN clients to connect to it. The tunnel encrypts all traffic so that PC A can use any application available at the enterprise network on the right. + + +Cisco AnyConnect Secure Mobility Client + + +Internet Firewall + + + +A + +B + +Web Browser +Figure 14-23 + + +TLS (For All Traffic to the Enterprise) S1 + +HTTPS (TLS) (For a Single Web Browser Session) +S2 + +Remote Access VPN Options (TLS) + + +Note that while the figure shows a firewall used at the main enterprise site, many types of devices can be used on the server side of a TLS connection as well. + +The bottom of Figure 14-23 shows a client VPN that supports a web application for a single web browser tab. The experience is much like when you connect to any other secure website today: the session uses TLS, so all traffic sent to and from that web browser tab is encrypted with TLS. Note that PC B does not use the AnyConnect Client; the user simply opens a web browser to browse to server S2. +326 CCNA 200-301 Official Cert Guide, Volume 2 + +VPN Comparisons +The CCNA 200-301 exam topics mention the terms site-to-site VPN and remote access VPN. To close the section, Table 14-4 lists several key comparison points between the two technologies for easier review and comparison. + +Table 14-4 Comparisons of Site-to-Site and Remote Access VPNs +Remote Access Site-to-Site + +Typical security protocol +Devices supported by one VPN (one or many) +Typical use: on-demand or permanent + +TLS One +On-demand + +IPsec Many +Permanent + + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 14-5 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 14-5 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions +Review memory tables + +Resource Used: Book, website Book, website Book, PTP +Book, website + + +Review All the Key Topics + +Table 14-6 +Key Topic Element +Figure 14-2 Table 14-3 Figure 14-5 Figure 14-6 +List + +Key Topics for Chapter 14 +Description Page Number +Metro Ethernet terminology in context 305 MetroE service types per MEF 306 MetroE Ethernet LAN (E-LAN) service concept 309 MetroE Ethernet Tree (E-Tree) service concept 309 +Ideas about customer Layer 3 addressing and what an MPLS VPN 313 provider needs to know + + + +Figure 14-11 List +Figure 14-22 Figure 14-23 +Table 14-4 + +MPLS terminology in context 314 Ideas about routing protocol neighbor relationships with MPLS VPN 316 Concepts of site-to-site VPNs with IPsec and GRE 324 Concepts of remote access VPNS with TLS 325 +Comparisons between site-to-site and remote access VPNs 326 +Chapter 14: WAN Architecture 327 + +Key Terms You Should Know +point-to-point, hub and spoke, partial mesh, full mesh, Ethernet WAN, Metro Ethernet, 14 service provider (SP), point of presence (PoP), access link, E-Line, E-LAN, E-Tree, +Multiprotocol Label Switching (MPLS), MPLS VPN, customer edge (CE), provider edge (PE), Multiprotocol BGP (MPBGP), IPsec, shared key, TLS, remote access VPN, site-to-site VPN, Cisco AnyConnect Secure Mobility Client +CHAPTER 15 + + + +Cloud Architecture This chapter covers the following exam topics: +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.g Servers + +1.2 Describe the characteristics of network topology architectures + +1.2.f On-premises and cloud + +1.12 Explain virtualization fundamentals (virtual machines) + + +Cloud computing is an approach to offering IT services to customers. However, cloud com-puting is not a product, or a set of products, a protocol, or any single thing. So, while there are accepted descriptions and definitions of cloud computing today, it takes a broad knowl-edge of IT beyond networking to know whether a particular IT service is or is not worthy of being called a cloud computing service. + +Cloud computing, or cloud, is an approach as to how to offer services to customers. For an IT service to be considered to be cloud computing, it should have these characteristics: It can be requested on-demand; it can dynamically scale (that is, it is elastic); it uses a pool of resources; it has a variety of network access options; and it can be measured and billed back to the user based on the amount used. Cloud computing relies on data centers that can be automated. For instance, to service requests, a cloud computing system will create virtual server instances—virtual machines (VMs)—and configure the settings on each VM to pro-vide the requested service. + +This chapter gives you a general idea of the cloud services and network architecture. To do that, this chapter begins with a discussion of server virtualization basics. The next section then discusses the big ideas in cloud computing, with the final section discussing the impact of public clouds on packet flows in enterprise networks. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 15-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section Server Virtualization +Cloud Computing Concepts +WAN Traffic Paths to Reach Cloud Services + +Questions 1, 2 +3, 4 +5, 6 + + +1. Three virtual machines run on one physical server. Which of the following server resources are commonly virtualized so each VM can use the required amount of that resource? (Choose three answers.) +a. NIC b. RAM c. Power +d. Hypervisor + +e. CPU + +2. Eight virtual machines run on one physical server; the server has two physical Ethernet NICs. Which answer describes a method that allows all eight VMs to communicate? +a. The VMs must share two IP addresses and coordinate to avoid using duplicate TCP or UDP ports. +b. The hypervisor acts as an IP router using the NICs as routed IP interfaces. c. Each VM uses a virtual NIC that is mapped to a physical NIC. +d. Each VM uses a virtual NIC that logically connects to a virtual switch. + +3. Which of the following cloud services is most likely to be used for software development? +a. IaaS b. PaaS c. SaaS +d. SLBaaS + +4. Which of the following cloud services is most likely to be purchased and then used to later install your own software applications? +a. IaaS b. PaaS c. SaaS +d. SLBaaS +330 CCNA 200-301 Official Cert Guide, Volume 2 + +5. An enterprise plans to start using a public cloud service and is considering different WAN options. The answers list four options under consideration. Which one option has the most issues if the company chooses one cloud provider but then later wants to change to use a different cloud provider instead? +a. Using private WAN connections directly to the cloud provider b. Using an Internet connection without VPN +c. Using an intercloud exchange +d. Using an Internet connection with VPN + +6. An enterprise plans to start using a public cloud service and is considering different WAN options. The answers list four options under consideration. Which options provide good security by keeping the data private while also providing good QoS ser-vices? (Choose two answers.) +a. Using private WAN connections directly to the cloud provider b. Using an Internet connection without VPN +c. Using an intercloud exchange +d. Using an Internet connection with VPN + + +Foundation Topics + +Server Virtualization +When you think of a server, what comes to mind? Is it a desktop computer with a fast CPU? A desktop computer with lots of RAM? Is it hardware that would not sit upright on the floor but could be easily bolted into a rack in a data center? When you think of a +server, do you not even think of hardware, but of the server operating system (OS), running somewhere as a virtual machine (VM)? + +All those answers are accurate from one perspective or another, but in most every other discussion within the scope of the CCNA certification, we ignore those details. From the perspective of most CCNA discussions, a server is a place to run applications, with users connecting to those applications over the network. The book then represents the server with an icon that looks like a desktop computer (that is the standard Cisco icon for a server). This next topic breaks down some different perspectives on what it means to be a server and prepares us to then discuss cloud computing. + +Cisco Server Hardware +Think about the form factor of servers for a moment—that is, the shape and size of the physical server. If you were to build a server of your own, what would it look like? How big, how wide, how tall, and so on? Even if you have never seen a device characterized as a server, consider these key facts: + +No KVM: For most servers, there is no permanent user who sits near the server; all the users and administrators connect to the server over the network. As a result, there is no need for a permanent keyboard, video display, or mouse (collectively referred to as KVM). +Chapter 15: Cloud Architecture 331 + +Racks of servers in a data center: In the early years of servers, a server was any computer with relatively fast CPU, large amounts of RAM, and so on. Today, companies put many servers into one room—a data center—and one goal is to not waste space. So, making servers with a form factor that fits in a standard rack makes for more efficient use of the available space—especially when you do not expect people to be sitting in front of each +server. 15 + +As an example, Figure 15-1 shows a photo of server hardware from Cisco. While you might think of Cisco as a networking company, around 2010, Cisco expanded its product line into the server market, with the Cisco Unified Computing System (UCS) product line. The photo shows a product from the UCS B-Series (Blade series) that uses a rack-mountable chassis, with slots for server blades. The product shown in the figure can be mounted in a rack— note the holes on the sides—with eight server blades (four on each side) mounted horizon-tally. It also has four power supplies at the bottom of the chassis. + + + + + + + + + + + + +Figure 15-1 Cisco UCS Servers: B-Series (Blade) + +No matter the form factor, server hardware today supplies some capacity of CPU chips, RAM, storage, and network interface cards (NIC). But you also have to think differently about the OS that runs on the server because of a tool called server virtualization. + +Server Virtualization Basics +Think of a server—the hardware—as one computer. It can be one of the blades in Figure 15-1, a powerful computer you can buy at the local computer store…whatever. +Traditionally, when you think of one server, that one server runs one OS. Inside, the hard-ware includes a CPU, some RAM, some kind of permanent storage (like disk drives), and one or more NICs. And that one OS can use all the hardware inside the server and then run one or more applications. Figure 15-2 shows those main ideas. + + +App1 App2 App3 App4 + +Operating System + +Storage CPU RAM Network + + + +Figure 15-2 Physical Server Model: Physical Hardware, One OS, and Applications +332 CCNA 200-301 Official Cert Guide, Volume 2 + +With the physical server model shown in Figure 15-2, each physical server runs one OS, and that OS uses all the hardware in that one server. That was true of servers in the days before server virtualization. + +Today, most companies instead create a virtualized data center. That means the company purchases server hardware, installs it in racks, and then treats all the CPU, RAM, and so on as capacity in the data center. Then, each OS instance is decoupled from the hardware and is therefore virtual (in contrast to physical). Each piece of hardware that we would formerly have thought of as a server runs multiple instances of an OS at the same time, with each vir-tual OS instance called a virtual machine, or VM. + +A single physical host (server) often has more processing power than you need for one OS. Thinking about processors for a moment, modern server CPUs have multiple cores (proces-sors) in a single CPU chip. Each core may also be able to run multiple threads with a feature called multithreading. So, when you read about a particular Intel processor with 8 cores and multithreading (typically two threads per core), that one CPU chip can execute 16 dif-ferent programs concurrently. The hypervisor (introduced shortly) can then treat each avail-able thread as a virtual CPU (vCPU) and give each VM a number of vCPUs, with 16 avail-able in this example. + +A VM—that is, an OS instance that is decoupled from the server hardware—still must execute on hardware. Each VM has configuration as to the minimum number of vCPUs it needs, minimum RAM, and so on. The virtualization system then starts each VM on some physical server so that enough physical server hardware capacity exists to support all the VMs running on that host. So, at any one point in time, each VM is running on a physi-cal server, using a subset of the CPU, RAM, storage, and NICs on that server. Figure 15-3 shows a graphic of that concept, with four separate VMs running on one physical server. + +Virtual Machine Virtual Machine Virtual Machine Virtual Machine + +App App App + +OS + +App App App + +OS + +App App App + +OS + +App App App + +OS + + +Hypervisor + +Storage CPU RAM Network + + + +Figure 15-3 Four VMs Running on One Host; Hypervisor Manages the Hardware + +To make server virtualization work, each physical server (called a host in the server virtual-ization world) uses a hypervisor. The hypervisor manages and allocates the host hardware (CPU, RAM, etc.) to each VM based on the settings for the VM. Each VM runs as if it is running on a self-contained physical server, with a specific number of virtual CPUs and NICs and a set amount of RAM and storage. For instance, if one VM happens to be config-ured to use four CPUs, with 8 GB of RAM, the hypervisor allocates the specific parts of the CPU and RAM that the VM actually uses. + + +Answers to the “Do I Know This Already?” quiz: 1 A, B, E 2 D 3 B 4 A 5 A 6 A, C +Chapter 15: Cloud Architecture 333 + +To connect the marketplace to the big ideas discussed thus far, the following list includes a few of the vendors and product family names associated with virtualized data centers: + +■ VMware vCenter ■ Microsoft HyperV +■ Citrix XenServer 15 ■ Red Hat KVM + +Beyond the hypervisor, companies like those in the list (and others) sell complete virtualiza-tion systems. These systems allow virtualization engineers to dynamically create VMs, start them, move them (manually and automatically) to different servers, and stop them. For instance, when hardware maintenance needs to be performed, the virtualization engineer can move the VMs to another host (often while running) so that the maintenance can be done. + +Networking with Virtual Switches on a Virtualized Host +Server virtualization tools provide a wide variety of options for how to connect VMs to networks. This book does not attempt to discuss them all, but it can help to get some of the basics down before thinking more about cloud computing. + +First, what does a physical server include for networking functions? Typically it has one or more NICs, maybe as slow as 1 Gbps, often 10 Gbps today, and maybe as fast as 40 Gbps. + +Next, think about the VMs. Normally, an OS has one NIC, maybe more. To make the OS work as normal, each VM has (at least) one NIC, but for a VM, it is a virtual NIC. (For instance, in VMware’s virtualization systems, the VM’s virtual NIC goes by the name vNIC.) + +Finally, the server must combine the ideas of the physical NICs with the vNICs used by the VMs into some kind of a network. Most often, each server uses some kind of an internal Ethernet switch concept, often called (you guessed it) a virtual switch, or vSwitch. Figure 15-4 shows an example, with four VMs, each with one vNIC. The physical server has two physical NICs. The vNICs and physical NICs connect internally to a virtual switch. + + +Virtual Machine +App + +Virtual Machine +App + +Virtual Machine +App + +Virtual Machine +App + + + +OS OS OS +vNIC vNIC vNIC + +OS Server vNIC Hardware +(Host) + + + +Virtual Switch + + +Physical NIC1 Physical NIC2 + +Trunks +Physical SW1 Switch +Figure 15-4 Basic Networking in a Virtualized Host with a Virtual Switch +334 CCNA 200-301 Official Cert Guide, Volume 2 + +Interestingly, the vSwitch can be supplied by the hypervisor vendor or by Cisco. For instance, Cisco offers the Nexus 1000VE virtual switch (which replaces the older and popu-lar Nexus 1000V virtual switch). The Nexus 1000VE runs the NX-OS operating system found in some of the Cisco Nexus data center switch product line. Additionally, Cisco offers the Cisco ACI Virtual Edge, another virtual switch, this one following Cisco ACI net-working as detailed in Chapter 16, “Introduction to Controller-Based Networking.” + +The vSwitch shown in Figure 15-4 uses the same networking features you now know from your CCNA studies; in fact, one big motivation to use a vSwitch from Cisco is to use the same networking features, with the same configuration, as in the rest of the network. In particular: + +■ Ports connected to VMs: The vSwitch can configure a port so that the VM will be in its own VLAN, or share the same VLAN with other VMs, or even use VLAN trunking to the VM itself. +■ Ports connected to physical NICs: The vSwitch uses the physical NICs in the server hardware so that the switch is adjacent to the external physical LAN switch. The vSwitch can (and likely does) use VLAN trunking. +■ Automated configuration: The configuration can be easily done from within the same virtualization software that controls the VMs. That programmability allows the virtualiza-tion software to move VMs between hosts (servers) and reprogram the vSwitches so that the VM has the same networking capabilities no matter where the VM is running. + +The Physical Data Center Network +To pull these ideas together, next consider what happens with the physical network in a vir-tualized data center. Each host—that is, the physical host—needs a physical connection to the network. Looking again at Figure 15-4, that host, with two physical NICs, needs to con-nect those two physical NICs to a LAN switch in the data center. + +Figure 15-5 shows the traditional cabling for a data center LAN. Each taller rectangle rep-resents one rack inside a data center, with the tiny squares representing NIC ports, and the lines representing cables. + + + +ToR ToR ToR EoR + +ToR ToR ToR EoR + +Server Server Server + +Server Server Server + +Server Server Server + +Server Server Server + +Server Server Server + +Server Server Server + +Figure 15-5 Traditional Data Center Top-of-Rack and End-of-Row Physical Switch Topology +Chapter 15: Cloud Architecture 335 + +Often, each host is cabled to two different switches in the top of the rack—called Top of Rack (ToR) switches—to provide redundant paths into the LAN. Each ToR switch acts as an access layer switch from a design perspective. Each ToR switch is then cabled to an End +of Row (EoR) switch, which acts as a distribution switch and also connects to the rest of the network. +The design in Figure 15-5 uses a traditional data center cabling plan. Some data center tech- 15 nologies call for different topologies, in particular, Cisco Application Centric Infrastructure +(ACI). ACI places the server and switch hardware into racks, but cables the switches with a different topology—a topology required for proper operation of the ACI fabric. Chapter 16 introduces ACI concepts. + +Workflow with a Virtualized Data Center +So far, the first part of this chapter has described background information important to the upcoming discussions of cloud computing. Server virtualization has been a great improve-ment to the operations of many data centers, but virtualization alone does not create a cloud computing environment. Continuing the discussion of these fundamental technolo-gies before discussing cloud computing, consider this example of a workflow through a virtualized (not cloud-based) data center. + +Some of the IT staff, call them server or virtualization engineers or administrators, order and install new hosts (servers). They gather requirements, plan for the required capacity, shop for hardware, order it, and install the hardware. They play the role of long-time server administrators and engineers, but now they work with the virtualization tools as well. + +For the virtualization parts of the effort, the virtualization engineers also install and custom-ize the virtualization tools. Beyond the hypervisor on each host, many other useful tools help manage and control a virtualized data center. For instance, one tool might give the engineers a view of the data center as a whole, with all VMs running there, with the idea that one data center is just a lot of capacity to run VMs. Over time, the server/virtualization engineers add new physical servers to the data center and configure the virtualization sys-tems to make use of the new physical servers and make sure it all works. + +So far in this scenario, the work has been in preparation for providing services to some internal customer—a development team member, the operations staff, and so on. Now, a customer is requesting a “server.” In truth, the customer wants a VM (or many), with certain requirements: a specific number of vCPUs, a specific amount of RAM, and so on. The cus-tomer makes a request to the virtualization/server engineer to set up the VMs, as shown in Figure 15-6. + +Data Center + + +1 Change +Requests + +Clicks GUI +2 +Script API + + +Add, 3 Move, Delete VMs + + + +Customers: Developers, Operators + + +Server/ Virtualization Engineers + +Virtualization +Software Racks of Servers, Switches, SAN + +Figure 15-6 Traditional Workflow: Customer (Human) Asks Virtualization (Human) for Service +336 CCNA 200-301 Official Cert Guide, Volume 2 + +The figure emphasizes what happens after the customer makes a request, which flows some-thing like this: +Step 1. The customer of the IT group, such as a developer or a member of the opera-tions staff, wants some service, like a set of new VMs. +Step 2. The virtualization/server engineer reacts to the request from the customer. The server/virtualization engineer clicks away at the user interface, or if the number of VMs is large, she often runs a program called a script to more efficiently create the VMs. +Step 3. Regardless of whether the virtualization engineer clicked or used scripts, the virtualization software could then create a number of new VMs and start those on some hosts inside the data center. + +The process shown in Figure 15-6 works great. However, that approach to providing ser-vices breaks some of the basic criteria of a cloud service. For instance, cloud computing requires self-service. For the workflow to be considered to be a cloud service, the process at step 2 should not require a human to service that request, but instead the request should be filled automatically. Want some new VMs in a cloud world? Click a user interface to ask for some new VMs, go get a cup of coffee, and your VMs will be set up and started, to your specification, in minutes. + +Summarizing some of the key points about a virtualized data center made so far, which enable cloud computing: + +■ The OS is decoupled from the hardware on which it runs, so that the OS, as a VM, can run on any server in a data center that has enough resources to run the VM. +■ The virtualization software can automatically start and move the VM between servers in the data center. +■ Data center networking includes virtual switches and virtual NICs within each host (server). +■ Data center networking can be programmed by the virtualization software, allowing new VMs to be configured, started, moved as needed, and stopped, with the networking details configured automatically. + +Cloud Computing Services +Cloud computing is an approach to offering IT services. Cloud computing makes use of products such as the virtualization products but also uses products built specifically to enable cloud features. However, cloud computing is not just a set of products to be imple-mented; instead, it is a way of offering IT services. So, understanding what cloud computing is—and is not—takes a little work; this next topic introduces the basics. + +From the just-completed discussions about virtualization, you already know one characteris-tic of a cloud service: it must allow self-service provisioning by the consumer of the service. That is, the consumer or customer of the service must be able to request the service and receive that service without the delay of waiting for a human to have time to work on it, consider the request, do the work, and so on. + +To get a broader sense of what it means for a service to be a cloud service, examine this list of five criteria for a cloud computing service. The list is derived from the definition of +Chapter 15: Cloud Architecture + +cloud computing as put forth by the US National Institute of Standards and Technology (NIST): + +On-demand self-service: The IT consumer chooses when to start and stop using the ser-vice, without any direct interaction with the provider of the service. +Broad network access: The service must be available from many types of devices and over many types of networks (including the Internet). +Resource pooling: The provider creates a pool of resources (rather than dedicating spe-cific servers for use only by certain consumers) and dynamically allocates resources from that pool for each new request from a consumer. +Rapid elasticity: To the consumer, the resource pool appears to be unlimited (that is, it expands quickly, so it is called elastic), and the requests for new service are filled quickly. +Measured service: The provider can measure the usage and report that usage to the con-sumer, both for transparency and for billing. + +337 + + + + + + +15 + + +Keep this list of five criteria in mind while you work through the rest of the chapter. Later parts of the chapter will refer back to the list. +To further develop this definition, the next few pages look at two branches of the cloud universe—private cloud and public cloud—also with the goal of further explaining some of the points from the NIST definition. + +Private Cloud (On-Premise) +Look back to the workflow example in Figure 15-6 with a virtualized data center. Now think about the five NIST criteria for cloud computing. If you break down the list versus +the example around Figure 15-6, it seems like the workflow may meet at least some of these five NIST cloud criteria, and it does. In particular, as described so far in this chapter, a vir-tualized data center pools resources so they can be dynamically allocated. You could argue that a virtualized data center is elastic, in that the resource pool expands. However, the process may not be rapid because the workflow requires human checks, balances, and time before provisioning new services. + +Private cloud creates a service, inside a company, to internal customers, that meets the five criteria from the NIST list. To create a private cloud, an enterprise often expands its IT tools (like virtualization tools), changes internal workflow processes, adds additional tools, and +so on. + +NOTE The world of cloud computing has long used the terms private cloud and public cloud. In more recent years, you may also find references that instead use a different pair of terms for the same ideas, with on-premise meaning private cloud, and cloud meaning pub-lic cloud. Note that the one CCNA 200-301 exam topic that mentions cloud happens to use the newer pair of terms. + +As some examples, consider what happens when an application developer at a company needs VMs to use when developing an application. With private cloud, the developer can request those VMs and those VMs automatically start and are available within minutes, with most of the time lag being the time to boot the VMs. If the developer wants many more VMs, he can assume that the private cloud will have enough capacity, and new requests are +338 CCNA 200-301 Official Cert Guide, Volume 2 + +still serviced rapidly. And all parties should know that the IT group can measure the usage of the services for internal billing. + +Focus on the self-service aspect of cloud for a moment. To make that happen, many cloud computing services use a cloud services catalog. That catalog exists for the user as a web application that lists anything that can be requested via the company’s cloud infrastructure. Before using a private cloud, developers and operators who needed new services (like new VMs) sent a change request asking the virtualization team to add VMs (see Figure 15-6). With private cloud, the (internal) consumers of IT services—developers, operators, and the like—can click to choose from the cloud services catalog. And if the request is for a new set of VMs, the VMs appear and are ready for use in minutes, without human interaction for that step, as seen at step 2 of Figure 15-7. + + +Cloud Services Catalog +Developer + +Virtualization Software + + +Data Center + + + +Clicks GUI GUI 2 Script API API + + +Add, Move, 3 Delete + + +Operator + +1 Configures Cloud +Team +Figure 15-7 Basic Private Cloud Workflow to Create One VM + +To make this process work, the cloud team has to add some tools and processes to its vir-tualized data center. For instance, it installs software to create the cloud services catalog, both with a user interface and with code that interfaces to the APIs of the virtualization systems. That services catalog software can react to consumer requests, using APIs into the virtualization software, to add, move, and create VMs, for instance. Also, the cloud team— composed of server, virtualization, network, and storage engineers—focuses on building the resource pool, testing and adding new services to the catalog, handling exceptions, and watching the reports (per the measured service requirement) to know when to add capacity to keep the resource pool ready to handle all requests. +Notably, with the cloud model, the cloud team no longer spends time handling individual requests for adding 10 VMs here, 50 there, with change requests from different groups. + +Summarizing, with private cloud, you change your methods and tools to offer some of the same services. Private cloud is “private” in that one company owns the tools that create the cloud and employs the people who use the services. Even inside one company, using a cloud computing approach can improve the operational speed of deploying IT services. + +Public Cloud +With a private cloud, the cloud provider and the cloud consumer are part of the same com-pany. With public cloud, the reverse is true: a public cloud provider offers services, selling those services to consumers in other companies. In fact, if you think of Internet service pro-viders and WAN service providers selling Internet and WAN services to many enterprises, the same general idea works here with public cloud providers selling their services to many enterprises. +Chapter 15: Cloud Architecture 339 + +The workflow in public cloud happens somewhat like private cloud when you start from the point of a consumer asking for some service (like a new VM). As shown on the right of Figure 15-8, at step 1, the consumer asks for the new service from the service catalog +web page. At step 2, the virtualization tools react to the request to create the service. Once started, the services are available, but running in a data center that resides somewhere else in +the world, and certainly not at the enterprise’s data center (step 3). 15 + +Enterprise (Consumer) Public Cloud Provider +Dev, Ops 1 Service Catalog Virtualization 2 + +Internet +VM VM 3 VM +VM + +Data Center + +Figure 15-8 Public Cloud Provider in the Internet + +Of course, the consumer is in a different network than the cloud provider with cloud com-puting, which brings up the issue of how to connect to a cloud provider. Cloud providers support multiple network options. They each connect to the Internet so that apps and users inside the consumer’s network can communicate with the apps that the consumer runs in the cloud provider’s network. However, one of the five NIST criteria for cloud comput- +ing is broad network access, so cloud providers offer different networking options as well, including virtual private network (VPN) and private wide-area network (WAN) connections between consumers and the cloud. + +Cloud and the “As a Service” Model +So what do you get with cloud computing? So far, this chapter has just shown a VM as a service. With cloud computing, there are a variety of services, and three stand out as the most common seen in the market today. + +First, a quick word about some upcoming terminology. The cloud computing world works on a services model. Instead of buying (consuming) hardware, buying or licensing software, installing it yourself, and so on, the consumer receives some service from the provider. But that idea, receiving a service, is more abstract than the idea of buying a server and installing a particular software package. So with cloud computing, instead of keeping the discussion so generic, the industry uses a variety of terms that end in “as a Service.” And each “-aaS” term has a different meaning. +This next topic explains those three most common cloud services: Infrastructure as a Service, Software as a Service, and Platform as a Service. + +Infrastructure as a Service +Infrastructure as a Service (IaaS) may be the easiest of the cloud computing services to understand for most people. For perspective, think about any time you have shopped for a computer. You thought about the OS to run (the latest Microsoft OS, or Linux, or macOS if shopping for a Mac). You compared prices based on the CPU and its speed, how much RAM the computer had, the size of the disk drive, and so on. +340 CCNA 200-301 Official Cert Guide, Volume 2 + +IaaS offers a similar idea, but the consumer receives the use of a VM. You specify the amount of hardware performance/capacity to allocate to the VM (number of virtual CPUs, amount of RAM, and so on), as shown in Figure 15-9. You can even pick an OS to use. Once selected, the cloud provider starts the VM, which boots the chosen OS. + +NOTE In the virtualization and cloud world, starting a VM is often called spinning up a VM or instantiating a VM. + + + + +2 Customer Installs Apps Later + +Operating System (Optional) + + +1 +User Picks + + +Storage CPU RAM Network 1 +User Picks + + +Figure 15-9 IaaS Concept + +The provider also gives the consumer details about the VM so the consumer can connect to the OS’s user interface, install more software, and customize settings. For example, imag-ine that the consumer wants to run a particular application on the server. If that customer wanted to use Microsoft Exchange as an email server, she would then need to connect to the VM and install Exchange. + +Figure 15-10 shows a web page from Amazon Web Services (AWS), a public cloud pro-vider, from which you could create a VM as part of its IaaS service. The screenshot shows that the user selected a small VM called “micro.” If you look closely at the text, you may be able to read the heading and numbers to see that this particular VM has one vCPU and 1 GB of RAM. + + + + + + + + + + + + + +Figure 15-10 AWS Screenshot—Set Up VM with Different CPU/RAM/OS +Chapter 15: Cloud Architecture 341 + +Software as a Service +With Software as a Service (SaaS), the consumer receives a service with working software. The cloud provider may use VMs, possibly many VMs, to create the service, but those are hidden from the consumer. The cloud provider licenses, installs, and supports whatever +software is required. The cloud provider then monitors performance of the application. +However, the consumer chooses to use the application, signs up for the service, and starts 15 +using the application—no further installation work required. Figure 15-11 shows these main concepts. + + + +Application + +Operating System (Optional) + +Storage CPU RAM Network + +1 +User Picks + +2 OS, +Hardware Hidden + + + +Figure 15-11 SaaS Concept + +Many of you have probably used or at least heard of many public SaaS offerings. File storage services like Apple iCloud, Google Drive, Dropbox, and Box are all SaaS offerings. Most online email offerings can be considered SaaS services today. As another example, Microsoft offers its Exchange email server software as a service, so you can have private email services but offered as a service, along with all the other features included with Exchange—without having to license, install, and maintain the Exchange software on some VMs. + +(Development) Platform as a Service +Platform as a Service (PaaS) is a development platform, prebuilt as a service. A PaaS service is like IaaS in some ways. Both supply the consumer with one or more VMs, with a configu-rable amount of CPU, RAM, and other resources. + +The key difference between PaaS and IaaS is that PaaS includes many more software tools beyond the basic OS. Those tools are useful to a software developer during the software development process. Once the development process is complete, and the application has been rolled out in production, those tools are not needed on the servers running the appli-cation. So the development tools are particular to the work done when developing. +A PaaS offering includes a set of development tools, and each PaaS offering has a differ-ent combination of tools. PaaS VMs often include an integrated development environment +(IDE), which is a set of related tools that enables the developer to write and test code easily. PaaS VMs include continuous integration tools that allow the developer to update code and have that code automatically tested and integrated into a larger software project. Examples include Google’s App Engine PaaS offering (https://cloud.google.com/appengine), the Eclipse integrated development environment (see www.eclipse.org), and the Jenkins continu-ous integration and automation tool (see https://jenkins.io). + +The primary reasons to choose one PaaS service over another, or to choose a PaaS solution instead of IaaS, is the mix of development tools. If you do not have experience as a devel-oper, it can be difficult to tell whether one PaaS service might be better. You can still make +342 CCNA 200-301 Official Cert Guide, Volume 2 + +some choices about sizing the PaaS VMs, similar to IaaS tools when setting up some PaaS services, as shown in Figure 15-12, but the developer tools included are the key to a PaaS service. + + +Development Environment and Tools (Platform) + +Operating System + +Primary Factor + + +Storage CPU RAM Network + + + +Figure 15-12 PaaS Concept + +WAN Traffic Paths to Reach Cloud Services +This final major section of the chapter focuses on WAN options for public cloud, and the pros and cons of each. This section ignores private cloud for the most part, because using a private cloud—which is internal to an enterprise—has much less of an impact on +an enterprise WAN compared to public cloud. With public cloud, the cloud services exist on the other side of some WAN connection as compared to the consumer of the services, so network engineers must think about how to best build a WAN when using public cloud services. + +Enterprise WAN Connections to Public Cloud +Using the Internet to communicate between the enterprise and a public cloud provider is easy and convenient. However, it also has some negatives. This first section describes the basics and points out the issues, which then leads to some of the reasons why using other WAN connections may be preferred. + +Accessing Public Cloud Services Using the Internet +Imagine an enterprise that operates its network without cloud. All the applications it uses to run its business run on servers in a data center inside the enterprise. The OS instances where those applications run can be hosted directly on physical servers or on VMs in a virtualized data center, but all the servers exist somewhere inside the enterprise. +Now imagine that the IT staff starts moving some of those applications out to a public cloud service. How do the users of the application (inside the enterprise) get to the user interface of the application (which runs at the public cloud provider’s data center)? The Internet, of course. Both the enterprise and the cloud provider connect to the Internet, so using the Internet is the easy and convenient choice. + +Now consider a common workflow to move an internal application to now run on the pub-lic cloud, for the purpose of making a couple of important points. First, Figure 15-13 shows the example. The cloud provider’s services catalog can be reached by enterprise personnel, over the Internet, as shown at step 1. After choosing the desired services—for instance, some VMs for an IaaS service—the cloud provider (step 2) instantiates the VMs. Then, not shown as a step in the figure, the VMs are customized to now run the app that was formerly running inside the enterprise’s data center. +Chapter 15: Cloud Architecture 343 + +Enterprise Public Cloud Provider + +Dev, Ops 1 Web Portal + +Internet + + +Virtualization +2 + + + + +Users 3 VM + +VM 4 VM + +15 VM +VM + +Data Center + +Figure 15-13 Accessing a Public Cloud Service Using the Internet + +At this point, the new app is running in the cloud, and those services will require network bandwidth. In particular, step 3 shows users communicating with the applications, just as would happen with any other application. Additionally, most apps send much more data than just the data between the application and the end user. For instance, you might move an app to the public cloud, but you might keep authentication services on an internal server because those are used by a large number of applications—some internal and some hosted in the public cloud. So at step 4, any application communication between VMs hosted in the cloud to/from VMs hosted inside the enterprise also needs to take place. + +Pros and Cons with Connecting to Public Cloud with Internet +Using the Internet to connect from the enterprise to the public cloud has several advantages. The most obvious advantage is that all companies and cloud providers already have Internet connections, so getting started using public cloud services is easy. Using the Internet works particularly well with SaaS services and a distributed workforce. For instance, maybe your sales division uses a SaaS customer contact app. Often, salespeople do not sit inside the enterprise network most of the work day. They likely connect to the Internet and use a VPN to connect to the enterprise. For apps hosted on the public cloud, with this user base, it makes perfect sense to use the Internet. + +While that was just one example, the following list summarizes some good reasons to use the Internet as the WAN connection to a public cloud service: + +Agility: An enterprise can get started using public cloud without having to wait to order a private WAN connection to the cloud provider because cloud providers support Internet connectivity. +Migration: An enterprise can switch its workload from one cloud provider to another more easily because cloud providers all connect to the Internet. +Distributed users: The enterprise’s users are distributed and connect to the Internet with their devices (as in the sales SaaS app example). + +Using the Internet as the WAN connectivity to a public cloud is both a blessing and a curse in some ways. Using the Internet can help you get started with public cloud and to get working quickly, but it also means that you do not have to do any planning before +deploying a public cloud service. With a little planning, a network engineer can see some of the negatives of using the Internet—the same negatives when using the Internet for other +344 CCNA 200-301 Official Cert Guide, Volume 2 + +purposes—which then might make you want to use alternative WAN connections. Those negatives for using the Internet for public cloud access are + +Security: The Internet is less secure than private WAN connections in that a “man in the middle” can attempt to read the contents of data that passes to/from the public cloud. +Capacity: Moving an internal application to the public cloud increases network traffic, so the question of whether the enterprise’s Internet links can handle the additional load needs to be considered. +Quality of Service (QoS): The Internet does not provide QoS, whereas private WANs can. Using the Internet may result in a worse user experience than desired because of higher delay (latency), jitter, and packet loss. +No WAN SLA: ISPs typically will not provide a service-level agreement (SLA) for WAN performance and availability to all destinations of a network. WAN service providers are much more likely to offer performance and availability SLAs. + +This list of concerns does not mean that an enterprise cannot use the Internet to access its public cloud services. It does mean that it should consider the pros and cons of each WAN option. + +Private WAN and Internet VPN Access to Public Cloud +The NIST definition for cloud computing lists broad network access as one of the five main criteria. In the case of public cloud, that often means supporting a variety of WAN connec-tions, including the most common enterprise WAN technologies. Basically, an enterprise can connect to a public cloud provider with WAN technologies discussed in this book. For the sake of discussion, Figure 15-14 breaks it down into two broad categories. + +Enterprise Public Cloud Provider + +Private WAN + + +VPN Tunnel + +Internet + +Figure 15-14 Using Private WAN to a Public Cloud: Security, QoS, Capacity, Reporting + +To create a VPN tunnel between the enterprise and the cloud provider, you can use the same VPN features discussed earlier in Chapter 14, “WAN Architecture.” The cloud pro-vider can offer a VPN service—that is, the cloud side of the VPN tunnel is implemented by the cloud provider—and the enterprise configures the matching VPN service on one of its own routers. Or the enterprise can use its own router inside the cloud provider’s network— a virtual router, running as a VM—and configure VPN services on that router. In fact, Cisco makes the Cloud Services Router (CSR) to do exactly that: to be a router, but a router that runs as a VM in a cloud service, controlled by the cloud consumer, to do various functions that routers do, including terminating VPNs. (Also, by running a virtual router as a VM and managing the configuration internally, the enterprise might save some of the cost of using a similar service offered by the cloud provider.) +Chapter 15: Cloud Architecture 345 + +To make a private Multiprotocol Label Switching (MPLS) VPN or Ethernet WAN connec-tion, the enterprise needs to work with the cloud provider and the WAN provider. Because cloud providers connect to many customers with private WAN connections, they often have published set instructions to follow. In the most basic form, with MPLS, the enterprise and the cloud provider connect to the same MPLS provider, with the MPLS provider con- +necting the enterprise and cloud sites. The same basic process happens with Ethernet WAN 15 services, with one or more Ethernet Virtual Connections (EVCs) created between the public +WAN and the enterprise. + +NOTE Often, the server/virtualization engineers will dictate whether the WAN connection needs to support Layer 2 or Layer 3 connectivity, depending on other factors. + +Private WAN connections also require some physical planning. Each of the larger public cloud providers has a number of large data centers spread around the planet and with pre-built connection points into the major WAN services to aid the creation of private WAN connections to customers. An enterprise might then look at the cloud provider’s documen-tation and work with that provider to choose the best place to install the private WAN connection. (Those larger public cloud companies include Amazon Web Services, Google Compute Cloud, Microsoft Azure, and Rackspace, if you would like to look at their web-sites for information about their locations.) + +Pros and Cons of Connecting to Cloud with Private WANs +Private WANs overcome some of the issues of using the Internet without VPN, so working through those issues, consider some of the different WAN options. + +First, considering the issue of security, all the private options, including adding a VPN to the existing Internet connection, improve security significantly. An Internet VPN would encrypt the data to keep it private. Private WAN connections with MPLS and Ethernet have traditionally been considered secure without encryption, but companies are sometimes encrypting data sent over private WAN connections as well to make the network more secure. +Regarding QoS, using an Internet VPN solution still fails to provide QoS because the Internet does not provide QoS. WAN services like MPLS VPN and Ethernet WANs can. As discussed in Chapter 11, “Quality of Service (QoS),” WAN providers will look at the QoS markings for frames/packets sent by the customer and apply QoS tools to the traffic as it passes through the service provider’s network. + +Finally, as for the capacity issue, the concern of planning network capacity exists no matter what type of WAN is used. Any plan to migrate an app away from an internal data center to instead be hosted as a public cloud provider requires extra thought and planning. + +Several negatives exist for using a private WAN, as you might expect. Installing the new pri-vate WAN connections takes time, delaying when a company gets started in cloud comput-ing. Private WANs typically cost more than using the Internet. If using a WAN connection to one cloud provider (instead of using the Internet), then migrating to a new cloud provider can require another round of private WAN installation, again delaying work projects. Using the Internet (with or without VPN) would make that migration much easier, but as shown in the next section, a strong compromise solution exists as well. +346 CCNA 200-301 Official Cert Guide, Volume 2 + +Intercloud Exchanges +Public cloud computing also introduces a whole new level of competition because a cloud consumer can move his workload from one cloud provider to another. Moving the work-load takes some effort, for a variety of reasons beyond the scope of this book. (Suffice it to say that most cloud providers differ in the detail of how they implement services.) But enterprises can and do migrate their workload from one cloud provider to another, choos-ing a new company for a variety of reasons, including looking for a less expensive cloud provider. + +Now focus on the networking connections again. The main negative with using a private WAN for the cloud is that it adds another barrier to migrating to a new public cloud pro-vider. One solution adds easier migration to the use of a private WAN through a cloud ser-vice called an intercloud exchange (or simply an intercloud). + +Generically, the term intercloud exchange has come to be known as a company that creates a private network as a service. First, an intercloud exchange connects to multiple cloud pro-viders on one side. On the other side, the intercloud connects to cloud consumers. Figure 15-15 shows the idea. + + +Intercloud Exchange + +Enterprise + + + +Private WAN + +Public Cloud 1 + + +R1 + + +Private +WAN Public Cloud 2 + +Private +WAN R1 + +Figure 15-15 Permanent Private WAN Connection to an Intercloud Exchange + +Once connected, the cloud consumer can be configured to communicate with one pub-lic cloud provider today, to specific cloud provider sites. Later, if the consumer wants to +migrate to use another cloud provider, the consumer keeps the same private WAN links to the intercloud exchange and asks the provider to reconfigure to set up new private WAN connections to the new cloud provider. + +As for pros and cons, with an intercloud exchange, you get the same benefits as when con-necting with a private WAN connection to a public cloud, but with the additional pro of easier migration to a new cloud provider. The main con is that using an intercloud exchange introduces another company into the mix. + +Summarizing the Pros and Cons of Public Cloud WAN Options +Table 15-2 summarizes some of these key pros and cons for the public WAN options for cloud computing, for study and reference. +Chapter 15: Cloud Architecture 347 + +Table 15-2 Comparison of Public Cloud WAN Options + + + +Makes data private Supports QoS +Requires capacity planning +Eases migration to a new provider +Speeds initial installation + +Internet + +No No Yes Yes + +Yes + +Internet VPN +Yes No Yes Yes + +Yes + +MPLS Ethernet VPN WAN +Yes Yes Yes Yes Yes Yes No No + +No No + +Intercloud Exchange +Yes +Yes 15 Yes +Yes + +No + + +A Scenario: Branch Offices and the Public Cloud +So far in this major section about WAN design with public cloud, the enterprise has been shown as one entity, but most enterprise WANs have many sites. Those distributed enter-prise sites impact some parts of WAN design for public cloud. The next discussion of WAN design issues with public cloud works through a scenario that shows an enterprise with a typical central site and branch office. + +The example used in this section is a common one: the movement away from internal email servers, supported directly by the IT staff, to email delivered as a SaaS offering. Focus on the impact of the enterprise’s remote sites like branch offices. + +Migrating Traffic Flows When Migrating to Email SaaS +First, think of the traffic flow inside an enterprise before SaaS, when the company buys servers, licenses email server software, installs the hardware and software in an internal data center, and so on. The company may have hundreds or thousands of remote sites, like the branch office shown in Figure 15-16. To check email, an employee at the branch office sends packets back and forth with the email server at the central site, as shown. + +Central Site Public Cloud Email Servers + +Internet + + +Email Traffic + + +Private WAN + + + + + +Branch Office +Figure 15-16 Traffic Flow: Private WAN, Enterprise Implements Email Services +348 CCNA 200-301 Official Cert Guide, Volume 2 + +The company then looks at the many different costs for email in this old model versus the new SaaS model. For instance, Microsoft Exchange is a very popular software package to build those enterprise email servers. Microsoft, a major player in the public cloud space with its Microsoft Azure service, offers Exchange as a SaaS service. (During the writing +of this book, this particular service could be found as part of Office 365 or as “Exchange Online.”) So the enterprise considers the options and chooses to migrate an email SaaS offering. + +Once migrated, the email servers run in the cloud, but as a SaaS service. The enterprise IT staff, who are the customers of the SaaS service, do not have to manage the servers. Just to circle back to some big ideas, with a SaaS service, the consumer does not worry about installing VMs, sizing them, installing Exchange or some other email server software, and +so on. The consumer receives email service in this case. The company does have to do some migration work to move existing email, contacts, and so on, but once completed, all users now communicate with email servers that run in the cloud as a SaaS service. + +Now think about that enterprise branch office user, and the traffic flows shown in Figure 15-17, when a branch user sends or receives an email. For instance, think of an email with a large attachment, just to make the impact more dramatic. If the enterprise design connects branches to the central sites only, this is the net effect on WAN traffic: + +■ No reduction in private WAN traffic at all occurs because all the branch office email traffic flows to/from the central site. +■ One hundred percent of the email traffic (even internal emails) that flows to/from branches now also flows over the Internet connection, consuming the bandwidth of the enterprise’s Internet links. + +Central Site Public Cloud +Email Servers + +Internet + + +Email Traffic + + +Private WAN + + + + + +Branch Office +Figure 15-17 Traffic Flow: Private WAN, Enterprise Implements Email Services + +Just to make the point, imagine two users at the same branch office. They can see each other across the room. One wants to share a file with the other, but the most convenient way they know to share a file is to email the file as an attachment. So one of them sends an email to the other, attaching the 20-MB file to the email. Before using SaaS, with an email +Chapter 15: Cloud Architecture 349 + +server at the central site, that email and file would flow over the private WAN, to the email server, and then back to the second user’s email client. With this new design, that email with the 20-MB attachment would flow over the private WAN, then over the Internet to the email server, and then back again over the Internet and over the private WAN when the sec-ond user downloads her email. +Branch Offices with Internet and Private WAN 15 For enterprises that place their Internet connections primarily at the central sites, this pub- +lic cloud model can cause problems like the one just described. One way to deal with this particular challenge is to plan the right capacity for the Internet links; another is to plan capacity for some private WAN connections to the public cloud. Another option exists as well: redesign the enterprise WAN to a small degree, and consider placing direct Internet connections at the branch offices. Then all Internet traffic, including the email traffic to the new SaaS service, could be sent directly, and not consume the private WAN bandwidth or the central site Internet link bandwidth, as shown in Figure 15-18. + +Central Site Public Cloud +Email Servers + +Internet + + +Email Traffic + + +Private WAN + + +Email Traffic + + +Branch Office +Figure 15-18 Connecting Branches Directly to the Internet for Public Cloud Traffic + +The design in Figure 15-18 has several advantages. The traffic flows much more directly. It does not waste the WAN bandwidth for the central site. And broadband Internet connec-tions are relatively inexpensive today compared to private WAN connections. + +However, when the per-branch Internet connections are added for the first time, the new Internet links create security concerns. One of the reasons an enterprise might use only a few Internet links, located at a central site, is to focus the security efforts at those links. Using an Internet connection at each branch changes that approach. But many enterprises not only use the Internet at each site but also rely on it as their only WAN connection, as shown with Internet VPNs back in Chapter 14. +350 CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 15-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 15-3 Chapter Review Tracking + +Review Element Review key topics Review key terms Answer DIKTA questions +Review memory tables + +Review Date(s) Resource Used Book, website Book, website Book, PTP +Book, website + + +Review All the Key Topics + +Table 15-4 +Key Topic Element +Figure 15-3 + +Figure 15-4 List + +Figure 15-9 + +Key Topics for Chapter 15 +Description Page Number +Organization of applications, on a VM, on an OS, with a 332 hypervisor allocating and managing the host hardware +Virtual switch concept 333 +Definition of cloud computing (paraphrased) based on the NIST 337 standard +Organization and concepts for an IaaS service 340 + + + +Figure 15-11 Figure 15-12 List +Table 15-2 + +Organization and concepts for a SaaS service 341 Organization and concepts for a PaaS service 342 Cons for using the Internet to access public WAN services 344 +Summary of pros and cons with different public cloud WAN 347 access options + + +Key Terms You Should Know +Unified Computing System (UCS), virtual machine, virtual CPU (vCPU), hypervisor, Host (context: DC), virtual NIC (vNIC), virtual switch (vSwitch), on-demand self-service, resource pooling, rapid elasticity, cloud services catalog, public cloud, private cloud, Infrastructure as a Service (IaaS), Platform as a Service (PaaS), Software as a Service (SaaS) + + + + + + + + +This page intentionally left blank +Part IV Review + +Keep track of your part review progress with the checklist shown in Table P4-1. Details on each task follow the table. + + +Table P4-1 + +Activity + +Part IV Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + + +Repeat All DIKTA Questions +For this task, use the PTP software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + +Part V of this book includes most of the network automation topics from the CCNA blue-print; however, the part includes as much discussion of how Cisco and others have changed the way networks work to enable better automation as it discusses tools and processes to automate networks. + +Chapters 16 and 17 examine a wide range of products and architectures that also enable better operations and automation. Chapter 16 discusses how controllers can separate out part of the work formerly done by networking devices. The chapter shows the advantages of these new controller-based models and details a few examples. Chapter 17 then goes on to give more detail about Cisco Software-Defined Access (SDA), a controller-based net-working approach to building enterprise campus networks. + +Chapters 18 and 19 discuss a few more specific details about network automation. Controllers typically include REST APIs and often return data to automation programs in the form of formatted data like JSON. Chapter 18 introduces these concepts. Chapter 19 then moves on to discuss IT automation tools, specifically Ansible, Puppet, and Chef, with focus on how to use these tools for network automation. +Part V + + +Network Automation + + + + +Chapter 16: Introduction to Controller-Based Networking + +Chapter 17: Cisco Software-Defined Access (SDA) + +Chapter 18: Understanding REST and JSON + +Chapter 19: Understanding Ansible, Puppet, and Chef + +Part V Review +CHAPTER 16 + + + +Introduction to Controller-Based Networking + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.f Endpoints + +1.1.g Servers + +1.2 Describe characteristics of network topology architectures + +1.2.c Spine-leaf + +6.0 Automation and Programmability +6.1 Explain how automation impacts network management + +6.2 Compare traditional networks with controller-based networking + +6.3 Describe controller-based and software defined architectures (overlay, underlay, and fabric) + +6.3.a Separation of control plane and data plane + +6.3.b Northbound and southbound APIs + + +The CCNA certification focuses on the traditional model for operating and controlling net-works, a model that has existed for decades. You understand protocols that the devices use, along with the commands that can customize how those protocols operate. Then you plan and implement distributed configuration to the devices, device by device, to implement the network. + +The 2010s have seen the introduction of a new network operational model: Software Defined Networking (SDN). SDN makes use of a controller that centralizes some network functions. The controller also creates many new capabilities to operate networks differ-ently; in particular, controllers enable programs to automatically configure and operate net-works through power application programming interfaces (APIs). + +With traditional networking, the network engineer configured the various devices and changes requiring a long timeframe to plan and implement changes. With controller-based networking and SDN, network engineers and operators can implement changes more quick-ly, with better consistency, and often with better operational practices. + +This chapter introduces the concepts of network programmability and SDN. Note that +the topic area is large, with this chapter providing enough detail for you to understand the basics and to be ready for the other three chapters in this part. + + + + +The first major section of this chapter introduces the basic concepts of data and control planes, along with controllers and the related architecture. The second section then shows separate product examples of network programmability using controllers, all of which use different methods to implement networking features. The last section takes a little more exam-specific approach to these topics, comparing the benefits of traditional networking with the benefits of controller-based networking. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 16-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +SDN and Controller-Based Networks +Examples of Network Programmability and SDN +Comparing Traditional and Controller-Based Networks + +Questions 1–3 +4–5 +6 + + +1. A Layer 2 switch examines a frame’s destination MAC address and chooses to for-ward that frame out port G0/1 only. That action occurs as part of which plane of the switch? +a. Data plane +b. Management plane c. Control plane +d. Table plane + +2. A router uses OSPF to learn routes and adds those to the IPv4 routing table. That action occurs as part of which plane of the switch? +a. Data plane +b. Management plane c. Control plane +d. Table plane + +3. A network uses an SDN architecture with switches and a centralized controller. Which of the following terms describes a function or functions expected to be found on the switches but not on the controller? +a. A northbound interface b. A southbound interface c. Data plane functions +d. Control plane functions +358 CCNA 200-301 Official Cert Guide, Volume 2 + +4. Which of the following controllers (if any) uses a mostly centralized control plane model? +a. OpenDaylight Controller +b. Cisco Application Policy Infrastructure Controller (APIC) c. Cisco APIC Enterprise Module (APIC-EM) +d. None of these controllers uses a mostly centralized control plane. + +5. To which types of nodes should an ACI leaf switch connect in a typical single-site design? (Choose two answers.) +a. All of the other leaf switches b. A subset of the spine switches c. All of the spine switches +d. Some of the endpoints e. None of the endpoints +6. Which answers list an advantage of controller-based networks versus traditional net-works? (Choose two answers.) + +a. The ability to configure the features for the network rather than per device b. The ability to have forwarding tables at each device +c. Programmatic APIs available per device d. More consistent device configuration + + +Foundation Topics + +SDN and Controller-Based Networks +Networking devices forward data in the form of messages, typically data-link frames like Ethernet frames. You have learned about how switches and routers do that forwarding for the entire length of preparing for the CCNA exam. + +Network programmability and Software Defined Networking (SDN) take those ideas, ana-lyze the pieces, find ways to improve them for today’s needs, and reassemble those ideas into a new way of making networks work. At the end of that rearrangement, the devices in the network still forward messages, but the how and why have changed. + +This first major section explains the most central concepts of SDN and network program-mability. It starts by breaking down some of the components of what exists in traditional networking devices. Then this section explains how some centralized controller software, called a controller, creates an architecture for easier programmatic control of a network. + +The Data, Control, and Management Planes +Stop and think about what networking devices do. What does a router do? What does a switch do? +Chapter 16: Introduction to Controller-Based Networking 359 + +Many ideas should come to mind. For instance, routers and switches physically connect to each other with cables, and with wireless, to create networks. They forward messages: switch-es forward Ethernet frames, and routers forward packets. They use many different protocols to learn useful information such as routing protocols for learning network layer routes. + +Everything that networking devices do can be categorized as being in a particular plane. This section takes those familiar facts about how networking devices work and describes the three planes most often used to describe how network programmability works: the data plane, the control plane, and the management plane. +The Data Plane 16 The term data plane refers to the tasks that a networking device does to forward a message. +In other words, anything to do with receiving data, processing it, and forwarding that same data—whether you call the data a frame, a packet, or, more generically, a message—is part of the data plane. +For example, think about how routers forward IP packets, as shown in Figure 16-1. If you focus on the Layer 3 logic for a moment, the host sends the packet (step 1) to its default router, R1. R1 does some processing on the received packet, makes a forwarding (routing) decision, and forwards the packet (step 2). Routers R3 and R4 also receive, process, and for-ward the packet (steps 3 and 4). + +1 +R1 R2 R3 SW1 +1 2 3 4 + + +Figure 16-1 Data Plane Processing on Routers: Basics + +Now broaden your thinking for a moment and try to think of everything a router or switch might do when receiving, processing, and forwarding a message. Of course, the forwarding decision is part of the logic; in fact, the data plane is often called the forwarding plane. But think beyond matching the destination address to a table. For perspective, the following list details some of the more common actions that a networking device does that fit into the data plane: + +■ De-encapsulating and re-encapsulating a packet in a data-link frame (routers, Layer 3 switches) +■ Adding or removing an 802.1Q trunking header (routers and switches) +■ Matching an Ethernet frame’s destination Media Access Control (MAC) address to the MAC address table (Layer 2 switches) +■ Matching an IP packet’s destination IP address to the IP routing table (routers, Layer 3 switches) +■ Encrypting the data and adding a new IP header (for virtual private network [VPN] processing) +■ Changing the source or destination IP address (for Network Address Translation [NAT] processing) +■ Discarding a message due to a filter (access control lists [ACLs], port security) + +All the items in the list make up the data plane, because the data plane includes all actions done per message. +360 CCNA 200-301 Official Cert Guide, Volume 2 + +The Control Plane +Next, take a moment to ponder the kinds of information that the data plane needs to know beforehand so that it can work properly. For instance, routers need IP routes in a routing table before the data plane can forward packets. Layer 2 switches need entries in a MAC address table before they can forward Ethernet frames out the one best port to reach the destination. Switches must use Spanning Tree Protocol (STP) to limit which interfaces can be used for forwarding so that the data plane works well and does not loop frames forever. + +From one perspective, the information supplied to the data plane controls what the data plane does. For instance, a router needs a route that matches a packet’s destination address for the router to know how to route (forward) the packet. When a router’s data plane tries to match the routing table and finds no matching route, the router discards the packet. And what controls the contents of the routing table? Various control plane processes. + +The term control plane refers to any action that controls the data plane. Most of these actions have to do with creating the tables used by the data plane, tables like the IP routing table, an IP Address Resolution Protocol (ARP) table, a switch MAC address table, and so on. By adding to, removing, and changing entries to the tables used by the data plane, the control plane processes control what the data plane does. You already know about many control plane protocols—for instance, all the IP routing protocols. + +Traditional networks use both a distributed data plane and a distributed control plane. In other words, each device has a data plane and a control plane, and the network distributes those functions into each individual device, as shown in the example in Figure 16-2. + +R1 R2 R3 + + +Control Plane + +OSPF Control Plane + +OSPF Control Plane + + + + +packet + +Data Plane + + +packet + +Data Plane + + +packet + +Data Plane + + +packet + + +Figure 16-2 Control and Data Planes of Routers—Conceptual + +In the figure, Open Shortest Path First (OSPF), the control plane protocol, runs on each router (that is, it is distributed among all the routers). OSPF on each router then adds to, removes from, and changes the IP routing table on each router. Once populated with use-ful routes, the data plane’s IP routing table on each router can forward incoming packets, as shown from left to right across the bottom of the figure. The following list includes many of the more common control plane protocols: + +■ Routing protocols (OSPF, Enhanced Interior Gateway Routing Protocol [EIGRP], Routing Information Protocol [RIP], Border Gateway Protocol [BGP]) +■ IPv4 ARP +■ IPv6 Neighbor Discovery Protocol (NDP) ■ Switch MAC learning +■ STP + +Answers to the “Do I Know This Already?” quiz: 1 A 2 C 3 C 4 A 5 C, D 6 A, D +Chapter 16: Introduction to Controller-Based Networking + +Without the protocols and activities of the control plane, the data plane of traditional net-working devices would not function well. Routers would be mostly useless without routes learned by a routing protocol. Without learning MAC table entries, a switch could still for-ward unicasts by flooding them, but doing that for all frames would create much more load on the local-area network (LAN) compared to normal switch operations. So the data plane must rely on the control plane to provide useful information. + +The Management Plane +The control plane performs overhead tasks that directly impact the behavior of the data plane. The management plane performs overhead work as well, but that work does not directly impact the data plane. Instead, the management plane includes protocols that allow network engineers to manage the devices. + +Telnet and Secure Shell (SSH) are two of the most obvious management plane protocols. To emphasize the difference with control plane protocols, think about two routers: one config-ured to allow Telnet and SSH into the router and one that does not. Both could still be run-ning a routing protocol and routing packets, whether or not they support Telnet and SSH. + +Figure 16-3 extends the example shown in Figure 16-2 by now showing the management plane, with several management plane protocols. + +361 + + + + + + + + + +16 + + +Telnet, SSH, SNMP, Syslog + + + +Management Plane + +Control Plane + +Data Plane + + +OSPF + +IPv4 Packets + +Management Plane + +Control Plane + +Data Plane + + +Figure 16-3 Management Plane for Configuration of Control and Data Plane + +Cisco Switch Data Plane Internals +To better understand SDN and network programmability, it helps to think about the inter-nals of switches. This next topic does just that. + +From the very first days of devices called LAN switches, switches had to use special- +ized hardware to forward frames, because of the large number of frames per second (fps) required. To get a sense for the volume of frames a switch must be able to forward, consid-er the minimum frame size of an Ethernet frame, the number of ports on a switch, and the speeds of the ports; even low-end switches need to be able to forward millions of frames per second. For example, if a switch manufacturer wanted to figure out how fast its data plane needed to be in a new access layer switch with 24 ports, it might work through this bit of math: + +■ The switch has 24 ports. ■ Each port runs at 1 Gbps. +■ For this analysis, assume frames 125 bytes in length (to make the math easier, because each frame is 1000 bits long). +■ With a 1000-bit-long frame and a speed of 1,000,000,000 bits/second, a port can send 1,000,000 frames per second (fps). +362 CCNA 200-301 Official Cert Guide, Volume 2 + +■ Use full duplex on all ports, so the switch can expect to receive on all 24 ports at the same time. +■ Result: Each port would be receiving 1,000,000 fps, for 24 million fps total, so the switch data plane would need to be ready to process 24 million fps. + +Although 24 million fps may seem like a lot, the goal here is not to put an absolute number on how fast the data plane of a switch needs to be for any given era of switching technology. Instead, from their first introduction into the marketplace in the mid-1990s, +LAN switches needed a faster data plane than a generalized CPU could process in software. As a result, hardware switches have always had specialized hardware to perform data plane processing. + +First, the switching logic occurs not in the CPU with software, but in an application-specif-ic integrated circuit (ASIC). An ASIC is a chip built for specific purposes, such as for mes-sage processing in a networking device. + +Second, the ASIC needs to perform table lookup in the MAC address table, so for fast table lookup, the switch uses a specialized type of memory to store the equivalent of the MAC address table: ternary content-addressable memory (TCAM). TCAM memory does not require the ASIC to execute loops through an algorithm to search the table. Instead, the ASIC can feed the fields to be matched, like a MAC address value, into the TCAM, and the TCAM returns the matching table entry, without a need to run a search algorithm. + +Note that a switch still has a general-purpose CPU and RAM as well, as shown in Figure +16-4. IOS runs in the CPU and uses RAM. Most of the control and management plane func-tions run in IOS. The data plane function (and the control plane function of MAC learning) happens in the ASIC. + +CPU RAM (IOS) (Various) + + +ASIC TCAM Logic Table Lookup + +Switch Data Plane +Figure 16-4 Key Internal Processing Points in a Typical Switch + +Note that some routers also use hardware for data plane functions, for the same kinds of reasons that switches use hardware. (For instance, check out the Cisco Quantum Flow +Processor for interesting reading about hardware data plane forwarding in Cisco routers.) The ideas of a hardware data plane in routers are similar to those in switches: use a purpose-built ASIC for the forwarding logic, and TCAM to store the required tables for fast table lookup. + +Controllers and Software-Defined Architecture +New approaches to networking emerged in the 2010s, approaches that change where some of the control plane functions occur. Many of those approaches move parts of the control plane work into software that runs as a centralized application called a controller. This next topic looks at controller concepts, and the interfaces to the devices that sit below the con-troller and to any programs that use the controller. +Chapter 16: Introduction to Controller-Based Networking 363 + + +NOTE The term Software Defined Networking (SDN) became common in the 2010s to refer to the types of controller-based networks described in the next few pages. More often today you might see terms like software-defined architecture or controller-based networking. + +Controllers and Centralized Control +Most traditional control plane processes use a distributed architecture. For example, each +router runs its own OSPF routing protocol process. To do their work, those distributed con- 16 trol plane processes use messages to communicate with each other, like OSPF protocol mes- +sages between routers. As a result, traditional networks are said to use a distributed control plane. +The people who created today’s control plane concepts, like STP, OSPF, EIGRP, and so on, could have chosen to use a centralized control plane. That is, they could have put the logic in one place, running on one device, or on a server. Then the centralized software could have used protocol messages to learn information from the devices, but with all the processing of the information at a centralized location. But they instead chose a distributed architecture. + +There are pros and cons to using distributed and centralized architectures to do any func-tion in a network. Many control plane functions have a long history of working well with a distributed architecture. However, a centralized application can be easier to write than a distributed application, because the centralized application has all the data gathered into one place. And this emerging world of software-defined architectures often uses a central-ized architecture, with a centralized control plane, with its foundations in a service called a controller. + +A controller, or SDN controller, centralizes the control of the networking devices. The degree of control, and the type of control, varies widely. For instance, the controller can perform all control plane functions, replacing the devices’ distributed control plane. +Alternately, the controller can simply be aware of the ongoing work of the distributed data, control, and management planes on the devices, without changing how those operate. And the list goes on, with many variations. + +To better understand the idea of a controller, consider one specific case as shown in Figure 16-5, in which one SDN controller centralizes all important control plane functions. First, the controller sits anywhere in the network that has IP reachability to the devices in the network. Each of the network devices still has a data plane; however, note that none of the devices has a control plane. In the variation of SDN as shown in Figure 16-5, the controller directly programs the data plane entries into each device’s tables. The networking devices do not populate their forwarding tables with traditional distributed control plane processes. + +NOTE Figure 16-5 shows the model used by one of the original SDN implementations that uses an industry standard called OpenFlow. + +Figure 16-5 shows one model for network programmability and SDN, but not all. The figure does give us a great backdrop to discuss a few more important basic concepts; in particular, the idea of a southbound interface (SBI) and northbound interface (NBI). +364 CCNA 200-301 Official Cert Guide, Volume 2 + + +Controller +Southbound Interface (SBI) + + + +Control Plane + + +Control Plane + + +Control Plane + + +packet Data Plane packet Data Plane packet Data Plane packet + +Network Device Network Device Network Device Figure 16-5 Centralized Control Plane and a Distributed Data Plane +The Southbound Interface +In a controller-based network architecture, the controller needs to communicate to the net-working devices. In most network drawings and architecture drawings, those network devic-es typically sit below the controller, as shown in Figure 16-5. There is an interface between the controller and those devices, and given its location at the bottom part of drawings, the interface came to be known as the southbound interface, or SBI, as labeled in Figure 16-5. + +NOTE In the context of this chapter’s discussion of SDN, the word interface (including in the names of SBI, NBI, and API) refers to software interfaces unless otherwise noted. + +Several different options exist for the SBI. The overall goal is network programmability, so the interface moves away from being only a protocol. An SBI often includes a protocol, so that the controller and devices can communicate, but it often includes an application programming interface (API). An API is a method for one application (program) to exchange data with another application. Rearranging the words to describe the idea, an API is an interface to an application program. Programs process data, so an API lets two programs exchange data. While a protocol exists as a document, often from a standards body, an API often exists as usable code—functions, variables, and data structures—that can be used by one program to communicate and copy structured data between the programs across a network. + +So, back to the term SBI: it is an interface between a program (the controller) and a program (on the networking device) that lets the two programs communicate, with one goal being to allow the controller to program the data plane forwarding tables of the networking device. + +Unsurprisingly, in a network architecture meant to enable network programmability, the capabilities of the SBIs and their APIs tell us a lot about what that particular architecture can and cannot do. For instance, some controllers might support one or a few SBIs, for a specific purpose, while others might support many more SBIs, allowing a choice of SBIs to use. The comparisons of SBIs go far beyond this chapter, but it does help to think about a few; the second major section gives three sample architectures that happen to show three separate SBIs, specifically: +■ OpenFlow (from the ONF; www.opennetworking.org) ■ OpFlex (from Cisco; used with ACI) +Chapter 16: Introduction to Controller-Based Networking 365 + +■ CLI (Telnet/SSH) and SNMP (used with Cisco APIC-EM) +■ CLI (Telnet/SSH) and SNMP, and NETCONF (used with Cisco Software-Defined Access) + + +The Northbound Interface +Think about the programming required at the controller related to the example in Figure 16-5. The figure focuses on the fact that the controller can add entries to the networking device’s forwarding tables; however, how does the controller know what to add? How does it choose? What kind of information would your program need to gather before it could attempt to add something like MAC table entries or IP routes to a network? You might think of these: + +■ A list of all the devices in the network ■ The capabilities of each devices +■ The interfaces/ports on each device ■ The current state of each port +■ The topology—which devices connect to which, over which interfaces +■ Device configuration—IP addresses, VLANs, and so on as configured on the devices + + + + + + +16 + + +A controller does much of the work needed for the control plane in a centralized control model. It gathers all sorts of useful information about the network, like the items in the pre-vious list. The controller itself can create a centralized repository of all this useful informa-tion about the network. + +A controller’s northbound interface (NBI) opens the controller so its data and functions can be used by other programs, enabling network programmability, with much quicker develop-ment. Programs can pull information from the controller, using the controller’s APIs. The NBIs also enable programs to use the controller’s capabilities to program flows into the devices using the controller’s SBIs. + +To see where the NBI resides, first think about the controller itself. The controller is soft-ware, running on some server, which can be a VM or a physical server. An application can run on the same server as the controller and use an NBI, which is an API, so that two pro-grams can communicate. +Figure 16-6 shows just such an example. The big box in the figure represents the system where the controller software resides. This particular controller happens to be written in Java and has a Java-based native API. Anyone—the same vendor as the controller vendor, another company, or even you—can write an app that runs on this same operating system that uses the controller’s Java API. By using that API to exchange data with the controller, the application can learn information about the network. The application can also program flows in the network—that is, ask the controller to add the specific match/action logic (flows) into the forwarding tables of the networking devices. + +NOTE The northbound interface (NBI) gets its name from its normal location as shown above the controller—that is, in what would be north on a map. +366 CCNA 200-301 Official Cert Guide, Volume 2 + +Inside the Controller + +App (Java) +API Information Flows +Call + +Java +API 1 2 + +API +Controller Core + +Figure 16-6 Java API: Java Applications Communicates with Controller + +Before leaving the topic of NBIs, let me close with a brief explanation of a REST API as used for a controller. REST (Representational State Transfer) describes a type of API that allows applications to sit on different hosts, using HTTP messages to transfer data over the API. When you see SDN figures like Figure 16-6, with the application running on the same system as the controller, the API does not need to send messages over a network because both programs run on the same system. But when the application runs on a different system somewhere else in the network other than running on the controller, the API needs a way to send the data back and forth over an IP network, and RESTful APIs meet that need. + +Figure 16-7 shows the big ideas with a REST API. The application runs on a host at the top of the figure. In this case, at step 1, it sends an HTTP GET request to a particular URI. The HTTP GET is like any other HTTP GET, even like those used to retrieve web pages. However, the URI is not for a web page, but rather identifies an object on the controller, +typically a data structure that the application needs to learn and then process. For example, the URI might identify an object that is the list of physical interfaces on a specific device along with the status of each. + + +APP + + +1 + +HTTP GET URI + + +3 Variables + +2 + +HTTP GET Response: JSON data + + + +Controller API + + +Figure 16-7 Process Example of a GET Using a REST API + +At step 2, the controller sends back an HTTP GET response message with the object. Most REST APIs will ask for and receive structured data. That is, instead of receiving data that is a web page, like a web browser would receive, the response holds variable names and their values, in a format that can be easily used by a program. The common formats for data used +Chapter 16: Introduction to Controller-Based Networking 367 + +for network programmability are JavaScript Object Notation (JSON) and eXtensible Markup Language (XML), shown as step 3. + +Software Defined Architecture Summary +SDN and network programmability introduce a new way to build networks. The networking devices still exist and still forward data, but the control plane functions and locations can change dramatically. The centralized controller acts as the focal point, so that at least some of the control plane functions move from a distributed model to a centralized model. + +However, the world of network programmability and SDN includes a wide array of options 16 and solutions. Some options pull most control plane functions into the controller, whereas +others pull only some of those functions into the controller. The next section takes a look at three different options, each of which takes a different approach to network programma-bility and the degree of centralized control. + +Examples of Network Programmability and SDN +This second of three major sections of the chapter introduces three different SDN and net-work programmability solutions available from Cisco. Others exist as well. These three were chosen because they give a wide range of comparison points: + +■ OpenDaylight Controller +■ Cisco Application Centric Infrastructure (ACI) ■ Cisco APIC Enterprise Module (APIC-EM) + +OpenDaylight and OpenFlow +One common form of SDN comes from the Open Networking Foundation (ONF) and is billed as Open SDN. The ONF (www.opennetworking.org) acts as a consortium of users (operators) and vendors to help establish SDN in the marketplace. Part of that work defines protocols, SBIs, NBIs, and anything that helps people implement their vision of SDN. + +The ONF model of SDN features OpenFlow. OpenFlow defines the concept of a control-ler along with an IP-based SBI between the controller and the network devices. Just as important, OpenFlow defines a standard idea of what a switch’s capabilities are, based on the ASICs and TCAMs commonly used in switches today. (That standardized idea of what a switch does is called a switch abstraction.) An OpenFlow switch can act as a Layer 2 switch, a Layer 3 switch, or in different ways and with great flexibility beyond the traditional model of a Layer 2/3 switch. + +The Open SDN model centralizes most control plane functions, with control of the network done by the controller plus any applications that use the controller’s NBIs. In fact, earlier Figure 16-5, which showed the network devices without a control plane, represents this mostly centralized OpenFlow model of SDN. + +In the OpenFlow model, applications may use any APIs (NBIs) supported on the controller platform to dictate what kinds of forwarding table entries are placed into the devices; how-ever, it calls for OpenFlow as the SBI protocol. Additionally, the networking devices need to be switches that support OpenFlow. + +Because the ONF’s Open SDN model has this common thread of a controller with an OpenFlow SBI, the controller plays a big role in the network. The next few pages provide a brief background about two such controllers. +368 CCNA 200-301 Official Cert Guide, Volume 2 + +The OpenDaylight Controller +First, if you were to look back at the history of OpenFlow, you could find information on dozens of different SDN controllers that support the OpenFlow SDN model. Some were more research oriented, during the years in which SDN was being developed and was more of an experimental idea. As time passed, more and more vendors began building their own controllers. And those controllers often had many similar features, because they were trying to accomplish many of the same goals. As you might expect, some consolidation eventually needed to happen. + +The OpenDaylight open-source SDN controller is one of the more successful SDN control-ler platforms to emerge from the consolidation process over the 2010s. OpenDaylight took many of the same open-source principles used with Linux, with the idea that if enough vendors worked together on a common open-source controller, then all would benefit. All those vendors could then use the open-source controller as the basis for their own products, with each vendor focusing on the product differentiation part of the effort, rather than the fundamental features. The result was that back in the mid-2010s, the OpenDaylight SDN controller (www.opendaylight.org) was born. OpenDaylight (ODL) began as a separate proj-ect but now exists as a project managed by the Linux Foundation. + +Figure 16-8 shows a generalized version of the ODL architecture. In particular, note the variety of SBIs listed in the lower part of the controller box: OpenFlow, NetConf, PCEP, BGP-LS, and OVSDB; many more exist. The ODL project has enough participants so that it includes a large variety of options, including multiple SBIs, not just OpenFlow. + +Your App + +Controller + + +REST API NBI + +Your Java App + +Java API + +Built-in App + +Java API + +Built-in App + +Java API + + + + +Core + + +SBI + + + + + + + +Figure 16-8 + + +Core Features + + +OpenFlow, NetConf, PCEP, BGP-LS, OVSDB + + + + + + + +Architecture of NBI, Controller Internals, and SBI to Network Devices + + +ODL has many features, with many SBIs, and many core features. A vendor can then take ODL, use the parts that make sense for that vendor, add to it, and create a commercial ODL controller. +Chapter 16: Introduction to Controller-Based Networking 369 + +The Cisco Open SDN Controller (OSC) +At one point back in the 2010s, Cisco offered a commercial version of the OpenDaylight controller called the Cisco Open SDN Controller (OSC). That controller followed the intended model for the ODL project: Cisco and others contributed labor and money to the ODL open-source project; once a new release was completed, Cisco took that release and built new versions of their product. + +Cisco no longer produces and sells the Cisco OSC, but I decided to keep a short section +about OSC here in this chapter for a couple of reasons. First, if you do any of your own +research, you will find mention of Cisco OSC; however, well before this chapter was written 16 +in 2019, Cisco had made a strong strategic move toward different approaches to SDN using intent-based networking (IBN). That move took Cisco away from OpenFlow-based SDN. But because you might see references to Cisco OSC online, or in the previous edition of this book, I wanted to point out this transition in Cisco’s direction. +This book describes two Cisco offerings that use an IBN approach to SDN. The next topic in this chapter examines one of those: Application Centric Infrastructure (ACI), Cisco’s data center SDN product. Chapter 17, “Cisco Software-Defined Access,” discusses yet another Cisco SDN option that uses intent-based networking: Software-Defined Access (SDA). + +Cisco Application Centric Infrastructure (ACI) +Interestingly, many SDN offerings began with research that discarded many of the old networking paradigms in an attempt to create something new and better. For instance, OpenFlow came to be from the Stanford University Clean Slate research project that had researchers reimagining (among other things) device architectures. Cisco took a similar research path, but Cisco’s work happened to arise from different groups, each focused on different parts of the network: data center, campus, and WAN. That research resulted in Cisco’s current SDN offerings of ACI in the data center, Software-Defined Access (SDA) in the enterprise campus, and Software-Defined WAN (SD-WAN) in the enterprise WAN. + +When reimagining networking for the data center, the designers of SCI focused on the applications that run in a data center and what they need. As a result, they built networking concepts around application architectures. Cisco made the network infrastructure become application centric, hence the name of the Cisco data center SDN solution: Application Centric Infrastructure, or ACI. + +For example, Cisco looked at the data center world beyond networking and saw lots of automation and control. As discussed in Chapter 15, “Cloud Architecture,” virtualization software routinely starts, moves, and stops VMs. Additionally, cloud software enables self-service for customers so they can enable and disable highly elastic services as implemented with VMs and containers in a data center. From a networking perspective, some of those VMs need to communicate, but some do not. And those VMs can move based on the needs of the virtualization and cloud systems. + +ACI set about to create data center networking with the flexibility and automation built into the operational model. Old data center networking models with a lot of per-physical-interface configuration on switches and routers were just poor models for the rapid pace of change and automated nature of modern data centers. This section looks at some of the detail of ACI to give you a sense of how ACI creates a powerful and flexible network to +370 CCNA 200-301 Official Cert Guide, Volume 2 + +support a modern data center in which VMs and containers are created, run, move, and are stopped dynamically as a matter of routine. + +ACI Physical Design: Spine and Leaf +The Cisco ACI uses a specific physical switch topology called spine and leaf. While the other parts of a network might need to allow for many different physical topologies, the data center could be made standard and consistent. But what particular standard and consis-tent topology? Cisco decided on the spine and leaf design, also called a Clos network after one of its creators. + +With ACI, the physical network has a number of spine switches and a number of leaf switches, as shown in Figure 16-9. The figure shows the links between switches, which can be single links or multiple parallel links. Of note in this design (assuming a single-site design): + +■ Each leaf switch must connect to every spine switch. ■ Each spine switch must connect to every leaf switch. ■ Leaf switches cannot connect to each other. +■ Spine switches cannot connect to each other. ■ Endpoints connect only to the leaf switches. + + +Spine Spine + + + + + + + +Leaf Leaf + +Spine + + + + + + + +Leaf Leaf + + + +Figure 16-9 Spine-Leaf Network Design + +Endpoints connect only to leaf switches and never to spine switches. To emphasize the point, Figure 16-10 shows a more detailed version of Figure 16-9, this time with endpoints connected to the leaf switches. None of the endpoints connect to the spine switches; they connect only to the leaf switches. The endpoints can be connections to devices outside the data center, like the router on the left. By volume, most of the endpoints will be either +physical servers running a native OS or servers running virtualization software with numbers of VMs and containers as shown in the center of the figure. + +Also, note that the figure shows a typical design with multiple leaf switches connecting to a single hardware endpoint like a Cisco Unified Computing System (UCS) server. Depending on the design requirements, each UCS might connect to at least two leaf switches, both for redundancy and for greater capacity to support the VMs and containers running on the UCS hardware. (In fact, in a small design with UCS or similar server hardware, every UCS might connect to every leaf switch.) +Chapter 16: Introduction to Controller-Based Networking 371 + +Spine Spine Spine + + + + + + + +Leaf Leaf Leaf Leaf 16 + + + + + + + +Physical Server + +UCS + +vSwitch +VM VM VM APIC + +Figure 16-10 Endpoints Found on the Leaf Switches Only + +ACI Operating Model with Intent-Based Networking +The model that Cisco defines for ACI uses a concept of endpoints and policies. The endpoints are the VMs, containers, or even traditional servers with the OS running directly on the hardware. ACI then uses several constructs as implemented via the Application Policy Infrastructure Controller (APIC), the software that serves as the centralized controller for ACI. + +This section hopes to give you some insight into ACI, rather than touch on every feature. To do that, consider the application architecture of a typical enterprise web app for a moment. Most casual observers think of a web application as one entity, but one web app often exists as three separate servers: + +■ Web server: Users from outside the data center connect to a web server, which sends web page content to the user. +■ App (Application) server: Because most web pages contain dynamic content, the app server does the processing to build the next web page for that particular user based on the user’s profile and latest actions and input. +■ DB (Database) server: Many of the app server’s actions require data; the DB server retrieves and stores the data as requested by the app server. + +To accommodate those ideas, ACI uses an intent-based networking (IBN) model. With that model, the engineer, or some automation program, defines the policies and intent for which endpoints should be allowed to communicate and which should not. Then the controller determines what that means for this network at this moment in time, depending on where the endpoints are right now. +For instance, when starting the VMs for this app, the virtualization software would create (via the APIC) several endpoint groups (EPGs) as shown in Figure 16-11. The controller must also be told the access policies, which define which EPGs should be able to communicate +372 CCNA 200-301 Official Cert Guide, Volume 2 + +(and which should not), as implied in the figure with arrowed lines. For example, the routers that connect to the network external to the data center should be able to send packets to all web servers, but not to the app servers or DB servers. + + +Web 1 App1 DB 1 +R1 Policy Policy Policy +Web 2 App 2 DB 2 + +R2 Web 3 DB 3 + + +EPG External + +EPG EPG EPG Web Application DB + +Figure 16-11 Endpoint Groups (EPGs) and Policies + +Note that at no point did the previous paragraph talk about which physical switch interfaces should be assigned to which VLAN, or which ports are in an EtherChannel; the discussion moves to an application-centric view of what happens in the network. Once all the end-points, policies, and related details are defined, the controller can then direct the network as to what needs to be in the forwarding tables to make it all happen—and to more easily react when the VMs start, stop, or move. + +To make it all work, ACI uses a centralized controller called the Application Policy Infrastructure Controller (APIC), as shown in Figure 16-12. The name defines the function in this case: it is the controller that creates application policies for the data center infrastruc-ture. The APIC takes the intent (EPGs, policies, and so on), which completely changes the operational model away from configuring VLANs, trunks, EtherChannels, ACLs, and so on. + + +The APIC + + + +OpFlex + + + + +Control Plane + + +Control Plane + + +Control Plane + + +packet Data Plane packet Data Plane packet Data Plane packet + +Network Device Network Device Network Device +Figure 16-12 Architectural View of ACI with APIC Pushing Intent to Switch Control Plane + +The APIC, of course, has a convenient GUI, but the power comes in software control—that is, network programmability. The same virtualization software, or cloud or automation software, even scripts written by the network engineer, can define the endpoint groups, +Chapter 16: Introduction to Controller-Based Networking 373 + +policies, and so on to the APIC. But all these players access the ACI system by interfacing to the APIC as depicted in Figure 16-13; the network engineer no longer needs to connect to each individual switch and configure CLI commands. + + +Virtualization Software + +Cloud Software + +Automation Software + +GUI + + + + + +APIC Controller + +OpFlex + + + +ACI DC with Nexus 9000 Switches + +16 + + + + + +Scripts + +Some Control Plane in Switches + + +Figure 16-13 Controlling the ACI Data Center Network Using the APIC + +For more information on Cisco ACI, go to www.cisco.com/go/aci. + +Cisco APIC Enterprise Module +The next example of a Cisco SDN solution in this section, called APIC Enterprise Module (APIC-EM), solves a different problem. When Cisco began to reimagine networking in +the enterprise, they saw a huge barrier: the installed base of their own products in most of their customer’s networks. Any enterprise SDN solution that used new SBIs—SBIs that only some of the existing devices and software levels supported—would create a huge barrier to adoption. + +APIC-EM Basics +Cisco came up with a couple of approaches, with one of those being APIC-EM, which Cisco released to the public around 2015. + +APIC-EM assumes the use of the same traditional switches and routers with their familiar distributed data and control planes. Cisco rejected the idea that its initial enterprise-wide SDN (network programmability) solution could begin by requiring customers to replace all hardware. Instead, Cisco looked for ways to add the benefits of network programmability with a centralized controller while keeping the same traditional switches and routers in place. That approach could certainly change over time (and it has), but Cisco APIC-EM does just that: offer enterprise SDN using the same switches and routers already installed in networks. + +NOTE Even though APIC-EM uses the same APIC acronym used for the controller with the Cisco ACI offering, the details of how it works differ significantly. + +What advantages can a controller-based architecture bring if the devices in the network have no new features? In short, adding a centralized controller does nothing in comparison with old network management offerings. Adding a centralized controller with powerful +374 CCNA 200-301 Official Cert Guide, Volume 2 + +northbound APIs opens many possibilities for customers/operators, while also creating a world in which Cisco and its partners can bring new and interesting management applica-tions to market. It includes these applications, as depicted in Figure 16-14: + +■ Topology map: The application discovers and displays the topology of the network. +■ Path Trace: The user supplies a source and destination device, and the application shows the path through the network, along with details about the forwarding decision at each step. +■ Plug and Play: This application provides Day 0 installation support so that you can unbox a new device and make it IP reachable through automation in the controller. +■ Easy QoS: With a few simple decisions at the controller, you can configure complex QoS features at each device. + + +Your App + + + +Controller +NBI REST API Topology Path Plug n Visualization Trace Play + + +Easy Apps from Cisco QoS + + + +Core Core Features + + +SBI CLI (Telnet, SSH), SNMP + + +Any Topology Many Device Models + +Figure 16-14 APIC-EM Controller Model + +APIC-EM does not directly program the data or control planes, but it does interact with the management plane via Telnet, SSH, and/or SNMP; consequently, it can indirectly impact the data and control planes. The APIC-EM controller does not program flows into tables or ask the control plane in the devices to change how it operates. But it can interrogate and learn the configuration state and operational state of each device, and it can reconfigure each device, therefore changing how the distributed control and data plane operates. + +APIC-EM Replacement +Cisco announced the current CCNA exam (200-301) in 2019, and around the same time Cisco announced the end of marketing for the APIC-EM product. That timing left us with a decision to make about whether to include APIC-EM in this book, and if so, to what extent. I decided to keep this small section about APIC-EM for several reasons, one reason being to give you these few closing comments about the product. + +First, during the early 2020s—the years that CCNA 200-301 will likely still be the current exam—you will still see many references to APIC-EM. Cisco DevNet will likely still have many useful labs that reference and use APIC-EM, at least for a few years. Furthermore, +Chapter 16: Introduction to Controller-Based Networking 375 + +APIC-EM gives us a great tool to see how a controller can be used, even if the networking devices do not change their normal operation. So I think it’s worth the few pages to intro-duces APIC-EM as done in this section. + +Second, many of the functions of APIC-EM have become core features of the Cisco DNA Center (DNAC) product, which is discussed in some detail in Chapter 17. The list of appli-cations just above this chapter’s Figure 16-14 also exist as part of DNAC, for instance. So, do not look for APIC-EM version 2, but rather look for opportunities to use DNAC. + +Summary of the SDN Examples 16 The three sample SDN architectures in this section of the book were chosen to provide a +wide variety for the sake of learning. However, they differ to some degree in how much of the control plane work is centralized. Table 16-2 lists those and other comparison points taken from this section, for easy review and study. + +Table 16-2 Points of Comparison: OpenFlow, ACI, and APIC Enterprise + +Criteria +Changes how the device control plane works versus traditional networking +Creates a centralized point from which humans and automation control the network +Degree to which the architecture centralizes the control plane +SBIs used +Controllers mentioned in this chapter +Organization that is the primary definer/owner + +OpenFlow Yes + +Yes + +Mostly + +OpenFlow OpenDaylight +ONF + +ACI Yes + +Yes + +Partially + +OpFlex APIC +Cisco + +APIC Enterprise No + +Yes + +None + +CLI, SNMP APIC-EM +Cisco + + +If you want to learn more about the Cisco solutions, consider using both Cisco DevNet (the Cisco Developer Network) and dCloud (Demo cloud). Cisco provides its DevNet site +(https://developer.cisco.com) for anyone interested in network programming, and the Demo Cloud site (https://dcloud.cisco.com) for anyone to experience or demo Cisco products. At the time this book went to press, DevNet had many APIC-EM labs, while both sites had a variety of ACI-based labs. + +Comparing Traditional Versus Controller-Based +Networks +Before finishing the chapter, this final topic turns directly toward the CCNA 200-301 exam. Three of the CCNA 200-301 exam topics in domain 6.0, “Automation and Programmability,” ask us to compare some aspect of traditional networks versus new networking using control-lers and automation. Those exam topics include + +6.1: Explain how automation impacts network management +6.2: Compare traditional networks with controller-based networking +6.4: Compare traditional campus device management with Cisco DNA Center enabled device management + +First, the wording in all three exam topics can be reduced to “compare and contrast.” Two use the word compare. The other uses a longer phrase “explain how automation impacts…,” +376 CCNA 200-301 Official Cert Guide, Volume 2 + +which asks us to compare what was before to what happens now that automation has been added to the network. + +Two exam topics (6.1 and 6.4) center on network management, so what might Cisco mean by “network management” in these exam topics? You could break that down into two aspects of network management: configuration management and operational management. + +Configuration management refers to any feature that changes device configuration, with automated configuration management doing so with software (program) control. For instance, Cisco’s ACI uses the APIC controller. You do not configure the devices directly, but the APIC pushes configuration down to the ACI switches that it builds based on its interpretation of the policies configured by the engineer. With ACI, the configuration management occurs as a part of the overall system. Other configuration management tools can be more focused on automating traditional configuration processes, with tools like NETCONF/RESTCONF, Ansible, Puppet, and Chef, as discussed in Chapter 18, “Understanding REST and JSON,” and Chapter 19, “Understanding Ansible, Puppet, and Chef.” +Operational network management includes monitoring, gathering operational data, report-ing, and alerting humans to possible issues. For instance, the APIC-EM and DNA Center both have an app that checks the IOS images on Cisco devices to make sure only approved versions are used and that no changes have occurred to the images in comparison to the images created by Cisco. + +The other exam topic (6.2) described in this section focuses on controller-based networking instead of network management. That exam topic includes any SDN network as character-ized by the use of a controller. Today people might use that term or these other synonyms to describe some of the newer networking options that happen to use controllers: + +■ Software Defined Networking ■ Software Defined Architecture ■ Programmable Networks +■ Controller-Based Networks + +Table 16-3 summarizes the chapters that have content related to these three exam topics. + +Table 16-3 Exam Topics and Most Relevant Chapters + +Exam Exam Topic Text Topic +6.1 Explain how automation impacts network management +6.2 Compare traditional networks with controller-based networking +6.4 Compare traditional campus device management with Cisco DNA Center–enabled device management + +Most Relevant Chapter(s) +16–19 16, 17 +17 + + +How Automation Impacts Network Management +This chapter introduces many of the features that enable automation in SDNs, but so far it has not made any overt statements about how automation impacts network management. This next topic works through a couple of examples that show the power of automation as enabled through controller-based networks. +Chapter 16: Introduction to Controller-Based Networking 377 + +First, centralized controllers formalize and define data models for the configuration and operational data about networks. We humans might be comfortable with visually scanning the output of show commands to find the tidbit of information we need. Programs need to be able to identify the specific fact. To build a controller-based network with APIs, all the data about the network needs to be defined in a data model so programs can use that data via API calls. Before using controllers, automation scripts often had to begin by process- +ing the text output of a show command, but with controllers and the data models behind the APIs, the data can be readily available to any automation script or vendor application +through a northbound API. 16 For instance, Example 16-1 shows some output from a command on a switch. With a north- +bound API on a controller, and the data model it supplies, an automation program could issue this command and begin by parsing this text. The goal: find the configuration setting on the switchport mode command and the current trunking state. +Example 16-1 Small Output from a Switch Command + +SW1# show interfaces gigabit 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: static access +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: native +Negotiation of Trunking: On + +Example 16-2 shows a simple example of the starting point for a program using a control-ler’s northbound API. Instead of asking for the text from a show command, the API call will result in the program having a series of variables set. In this case, there are variables for that same interface that list the trunk configuration setting and the trunk operational state. +Example 16-2 Python Dictionary with Variables Set to Needed Values + +>>> interface1 +{'trunk-config': 'dynamic auto', 'trunk-status': 'static access'} +>>> + +Using a controller-based model not only supplies APIs that give us the exact same data a human could see in show commands, but often they also supply much more useful informa-tion. A controller collects data from the entire network, so the controller can be written so that it analyzes and presents more useful data via the API. As a result, software that uses the APIs—whether automation written by local engineers or applications written by vendors— can be written more quickly and can often create features that would have been much more difficult without a controller. + +For instance, both APIC-EM and its successor DNA Center provide a path trace feature. The applications show the path of a packet from source to destination, with the forwarding logic used at each node. +378 CCNA 200-301 Official Cert Guide, Volume 2 + +Now imagine writing that application with either of these two approaches. + +■ One API call that returns a list of all devices and their running configuration, with other API calls to collect each device’s MAC address tables and/or their IP routing tables. Then you have to process that data to find the end-to-end path. +■ One API call to which you pass the source and destination IP addresses and TCP/UDP ports, and the API returns variables that describe the end-to-end path, including device hostnames and interfaces. The variables spell out the path the packet takes through the network. + +The second option does most of the work, while the first option leaves most of the work to you and your program. But that second option becomes possible because of the centralized controller. The controller has the data if it at least collects configuration and forwarding table information. Going beyond that, these Cisco controllers analyze the data to provide much more useful data. The power of these kinds of APIs is amazing, and this is just one example. + +The following list summarizes a few of the comparison points for this particular exam topic: + +■ Northbound APIs and their underlying data models make it much easier to automate functions versus traditional networks. +■ The robust data created by controllers makes it possible to automate functions that were not easily automated without controllers. +■ The new reimagined software defined networks that use new operational models simpli-fy operations, with automation resulting in more consistent configuration and less errors. +■ Centralized collection of operational data at controllers allows the application of mod-ern data analytics to networking operational data, providing actionable insights that were likely not noticeable with the former model. +■ Time required to complete projects is reduced. +■ New operational models use external inputs, like considering time-of-day, day-of-week, and network load. + +Comparing Traditional Networks with Controller-Based Networks +As for exam topic 6.2, this entire chapter begins to show the advantages created by using controller-based networks. However, this chapter only begins to describe the possibilities. By centralizing some of the functions in the network and providing robust APIs, control-lers enable a large number of new operational models. Those models include the three most likely to be seen from Cisco in an enterprise: Software-Defined Access (SDA), Software-Defined WAN (SD-WAN), and Application Centric Infrastructure (ACI). (Chapter 17 intro-duces SDA.) + +This changes the operating paradigm in many cases, with the controller determining many device-specific details: + +■ The network engineer does not need to think about every command on every device. ■ The controller configures the devices with consistent and streamlined settings. +■ The result: faster and more consistent changes with fewer issues. +Chapter 16: Introduction to Controller-Based Networking 379 + +As another example, just consider the ACI example from earlier in the chapter. Instead of configuring each port with an access VLAN, or making it a trunk, adding routing protocol configuration, and possibly updating IP ACLs, all you had to do was create some end-point groups (EPGs) and policies. In that case, the orchestration software that started the VMs could automatically create the EPGs and policies. The new paradigm of intent-based networking was enabled through the controller-based architecture. Then the automation features enabled by the controller’s northbound APIs allowed third-party applications to automatically configure the network to support the necessary changes. +Some of the advantages include the following: 16 +■ Uses new and improved operational models that allow the configuration of the network rather than per-device configuration +■ Enables automation through northbound APIs that provide robust methods and model-driven data +■ Configures the network devices through southbound APIs, resulting in more consistent device configuration, fewer errors, and less time spent troubleshooting the network +■ Enables a DevOps approach to networks + +Chapter 17 goes into some depth comparing traditional networking with controller-based networks with descriptions of Cisco Software-Defined Access (SDA). Look throughout that chapter for some of the reasons and motivations for SDA and the features enabled by using the DNA Center controller. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 16-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 16-4 Chapter Review Tracking + +Review Element Review key topics Review key terms Answer DIKTA questions Review memory tables +Watch video + +Review Date(s) Resource Used Book, website Book, website Book, PTP Book, website +Website +380 CCNA 200-301 Official Cert Guide, Volume 2 + +Review All the Key Topics + +Table 16-5 +Key Topic Element +List List +Figure 16-4 Figure 16-5 + +Paragraph Figure 16-7 +List + +Key Topics for Chapter 16 +Description Page Number +Sample actions of the networking device data plane 359 Sample actions of the networking device control plane 360 Switch internals with ASIC and TCAM 362 +Basic SDN architecture, with the centralized controller 364 programming device data planes directly +Description of the role and purpose of the NBI 365 REST API basic concepts 366 +Spine-leaf topology requirements 370 + + + +Figure 16-10 Figure 16-13 Table 16-2 + +List +List + +Spine-leaf design 371 Controlling the ACI data center network using APIC 373 +Comparisons of Open SDN, Cisco ACI, and Cisco APIC 375 Enterprise options +Comparisons of how automation improves network management 378 +Comparisons of how controller-based networking works versus 379 traditional networking + + +Key Terms You Should Know +application programming interface (API), Application Policy Infrastructure Controller (APIC), APIC Enterprise Module (APIC-EM), Application Centric Infrastructure (ACI), northbound API, southbound API, control plane, data plane, management plane, appli-cation-specific integrated circuit (ASIC), ternary content-addressable memory (TCAM), OpenFlow, Software Defined Networking (SDN), distributed control plane, centralized control plane, northbound interface (NBI), southbound interface (SBI), controller-based net-working, intent-based networking (IBN), spine, leaf + + + + + + + + +This page intentionally left blank +CHAPTER 17 + + + +Cisco Software-Defined Access (SDA) + +This chapter covers the following exam topics: + +1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.e Controllers (Cisco DNA Center and WLC) + +6.0 Automation and Programmability +6.1 Explain how automation impacts network management + +6.2 Compare traditional networks with controller-based networking + +6.3 Describe controller-based and software defined architectures (overlay, underlay, and fabric) + +6.3.a Separation of control plane and data plane + +6.3.b Northbound and southbound APIs + +6.4 Compare traditional campus device management with Cisco DNA Center enabled device management + + +Cisco Software-Defined Access (SDA) uses a software defined networking approach to build a converged wired and wireless campus LAN. The word access in the name refers to the endpoint devices that access the network, while software-defined refers to many of the usual software-defined architectural features discussed in Chapter 16, “Introduction to Controller-Based Networking.” Those features include a centralized controller—DNA Center—with southbound and northbound protocols. It also includes a completely differ- +ent operational model inside SDA, with a network fabric composed of an underlay network and an overlay network. + +SDA fills the position as Cisco’s campus offering within Cisco Digital Network Architecture (DNA). Cisco DNA defines the entire architecture for the new world of software defined networks, digitization, and Cisco’s reimagining of how networks should be operated in the future. This chapter introduces SDA, which exists as one implementation of Cisco DNA. + +The discussion of SDA and DNA provides a great backdrop to discuss a few other topics from the CCNA blueprint: the DNA Center controller and network management. SDA uses the DNA Center controller to configure and operate SDA. However, DNA Center also acts as a complete network management platform. To understand DNA Center, you also need to understand traditional network management as well as the new management models using controllers. + + + + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 17-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +SDA Fabric, Underlay, and Overlay DNA Center and SDA Operation +DNA Center as a Network Management Platform + +Questions 1–3 +4, 5 +6 + + +1. In Cisco Software-Defined Access (SDA), which term refers to the devices and cabling, along with configuration that allows the network device nodes enough IP connectivity to send IP packets to each other? +a. Fabric b. Overlay +c. Underlay d. VXLAN +2. In Cisco Software-Defined Access (SDA), which term refers to the functions that deliver endpoint packets across the network using tunnels between the ingress and egress fabric nodes? +a. Fabric b. Overlay +c. Underlay d. VXLAN +3. In Software-Defined Access (SDA), which of the answers are part of the overlay data plane? +a. LISP b. GRE c. OSPF +d. VXLAN +4. Which answers best describe options of how to implement security with scalable groups using DNA Center and SDA? (Choose two answers.) +a. A human user from the DNA Center GUI +b. An automation application using NETCONF +c. A human user using the CLI of an SDA fabric edge node d. An automation application using REST +384 CCNA 200-301 Official Cert Guide, Volume 2 + +5. Which of the following protocols or tools could be used as part of the Cisco DNA Center southbound interface? (Choose three answers.) +a. Ansible b. SSH +c. NETCONF d. SNMP +e. Puppet + +6. Which of the following are network management features performed by both tra-ditional network management software as well as by DNA Center? (Choose two answers.) +a. Network device discovery +b. Software-Defined Access configuration +c. End-to-end path discovery with ACL analysis +d. Device installation (day 0), configuration (day 1), and monitoring (day n) operations + + +Foundation Topics + +SDA Fabric, Underlay, and Overlay +Cisco Software-Defined Access (SDA) creates an entirely new way to build campus LANs as compared with the traditional methods of networking discussed in most chapters of this book. In the mid 2010s, Cisco set about to reimagine campus networking, with SDA as the result. + +SDA uses the software-defined architectural model introduced in Chapter 16, with a controller and various APIs. It still uses a physical network with switches and routers, cables, and various endpoints. At the center sits the Digital Network Architecture (DNA) Center controller, as shown in Figure 17-1, with human users making use of a graphical user interface (GUI) and automation using APIs. In short, DNA Center is the controller for SDA networks. + +Architecturally, the southbound side of the controller contains the fabric, underlay, and overlay. By design in SDN implementations, most of the interesting new capabilities occur on the northbound side, which are examined in the second half of this chapter. This first half of the chapter examines the details south of the controller—namely, the fabric, under-lay network, and overlay network. +Overlay: The mechanisms to create VXLAN tunnels between SDA switches, which are then used to transport traffic from one fabric endpoint to another over the fabric. +Underlay: The network of devices and connections (cables and wireless) to provide IP connectivity to all nodes in the fabric, with a goal to support the dynamic discovery of all SDA devices and endpoints as a part of the process to create overlay VXLAN tunnels. +Fabric: The combination of overlay and underlay, which together provide all features to deliver data across the network with the desired features and attributes. +Chapter 17: Cisco Software-Defined Access (SDA) 385 + + + + +Script GUI Script GUI +API +Cisco or Vendor App + + +API Controller API + +SBI +17 + + + + + + + + + +Figure 17-1 SDA Architectural Model with DNA Center + +In less formal terms, the underlay exists as multilayer switches and their links, with IP con-nectivity—but for a special purpose. The underlay supports some new concepts with a tun-neling method called VXLAN. Traffic sent by the endpoint devices flows through VXLAN tunnels in the overlay—a completely different process than traditional LAN switching and IP routing. + +For instance, think about the idea of sending packets from hosts on the left of a network, over SDA, to hosts on the right. For instance, imagine a packet enters on the left side of the physical network at the bottom of Figure 17-2 and eventually exits the campus out switch SW2 on the far right. This underlay network looks like a more traditional network drawing, with several devices and links. + +The overlay drawing at the top of the figure shows only two switches—called fabric edge nodes, because they happen to be at the edges of the SDA fabric—with a tunnel labeled VXLAN connecting the two. Both concepts (underlay and overlay) together create the SDA fabric. + +The next few pages explain both the underlay and overlay in a little more depth. +386 CCNA 200-301 Official Cert Guide, Volume 2 + +Overlay +SW1 SW2 + +VXLAN + + + + + + + +SW1 SW2 + + + + + + + +Underlay Figure 17-2 Fabric, Underlay, and Overlay Concepts +The SDA Underlay +With SDA, the underlay exists to provide connectivity between the nodes in the SDA envi-ronment for the purpose of supporting VXLAN tunnels in the overlay network. To do that, the underlay includes the switches, routers, cables, and wireless links used to create the physical network. It also includes the configuration and operation of the underlay so it can support the work of the overlay network. + +Using Existing Gear for the SDA Underlay +To build an SDA underlay network , companies have two basic choices. They can use their existing campus network and add new configuration to create an underlay network, while still supporting their existing production traffic with traditional routing and switching. Alternately, the company can purchase some new switches and build the SDA network without concern for harming existing traffic, and migrate endpoints to the new SDA net-work over time. + +To build SDA into an existing network, it helps to think for a moment about some typi-cal campus network designs. The larger campus site may use either a two-tier or three-tier design as discussed in Chapter 13, “LAN Architecture.” It has a cluster of wireless LAN controllers (WLCs) to support a number of lightweight APs (LWAPs). Engineers have con-figured VLANs, VLAN trunks, IP routing, IP routing protocols, ACLs, and so on. And the LAN connects to WAN routers. + + +Answers to the “Do I Know This Already?” quiz: 1 C 2 B 3 D 4 A, D 5 B, C, D 6 A, D +Chapter 17: Cisco Software-Defined Access (SDA) 387 + +SDA can be added into an existing campus LAN, but doing so has some risks and restric-tions. First and foremost, you have to be careful not to disrupt the current network while adding the new SDA features to the network. The issues include + +■ Because of the possibility of harming the existing production configuration, DNA Center should not be used to configure the underlay if the devices are currently used in production. (DNA Center will be used to configure the underlay with deployments that use all new hardware.) +■ The existing hardware must be from the SDA compatibility list, with different models supported depending on their different SDA roles (see a link at www.cisco.com/go/sda). +■ The device software levels must meet the requirements, based on their roles, as detailed in that same compatibility list. +17 +For instance, imagine an enterprise happened to have an existing campus network that uses SDA-compatible hardware. That company might need to update the IOS versions in a few cases. Additionally, the engineers would need to configure the underlay part of the SDA devices manually rather than with DNA Center because Cisco assumes that the existing network already supports production traffic, so they want the customer directly involved in making those changes. +The SDA underlay configuration requires you to think about and choose the different SDA roles filled by each device before you can decide which devices to use and which minimum software levels each requires. If you look for the hardware compatibility list linked from www.cisco.com/go/sda, you will see different lists of supported hardware and software depending on the roles. These roles include +Fabric edge node: A switch that connects to endpoint devices (similar to traditional access switches) +Fabric border node: A switch that connects to devices outside SDA’s control, for exam-ple, switches that connect to the WAN routers or to an ACI data center +Fabric control node: A switch that performs special control plane functions for the underlay (LISP), requiring more CPU and memory + +For example, when I was writing this chapter back in 2019, Cisco’s compatibility list includ-ed many Catalyst 9300, 9400, and 9500 switches, but also some smaller Catalyst 3850 and 3650 switches, as fabric edge nodes. However, the Catalyst 2960X or 2960XR products did not make the list as fabric edge nodes. For fabric control nodes, the list included more higher-end Catalyst switch models (which typically have more CPU and RAM), plus several +router models (routers typically have much more RAM for control plane protocol storage— for instance, for routing protocols). +The beginning of an SDA project will require you to look at the existing hardware and soft-ware to begin to decide whether the existing campus might be a good candidate to build the fabric with existing gear or to upgrade hardware when building the new campus LAN. + +Using New Gear for the SDA Underlay +When buying new hardware for the SDA fabric—that is, a greenfield design—you remove many of the challenges that exist when deploying SDA on existing gear. You can simply order compatible hardware and software. Once it arrives, DNA Center can then configure all the underlay features automatically. +388 CCNA 200-301 Official Cert Guide, Volume 2 + +At the same time, the usual campus LAN design decisions still need to be made. Enterprises use SDA as a better way to build and operate a campus network, but SDA is still a campus network. It needs to provide access and connectivity to all types of user devices. When planning a greenfield SDA design, plan to use SDA-compatible hardware, but also think about these traditional LAN design points: + +■ The number of ports needed in switches in each wiring closet ■ The port speeds required +■ The benefit of a switch stack in each wiring closet +■ The cable length and types of cabling already installed ■ The need for power (PoE/PoE+) +■ The power available in each new switch versus the PoE power requirements ■ Link capacity (speed and number of links) for links between switches + +As far as the topology, traditional campus design does tell us how to connect devices, but SDA does not have to follow those traditional rules. To review, traditional campus LAN Layer 2 design (as discussed back in Chapter 13) tells us to connect each access switch to two different distribution layer switches, but not to other access layer switches, as shown in Figure 17-3. The access layer switch acts as a Layer 2 switch, with a VLAN limited to those three switches. + + + + +Distribution Layer +(Layer 3 Switches) + +HSRP 10.1.1.1 HSRP 10.1.1.1 L2 + +Root + + +RSTP + + +L2 L2 + +BLOCK + +Access +Layer SW3 (Layer 2 Switches) + +GW = 10.1.1.1 + +Figure 17-3 Traditional Access Layer Design: Three Switches in STP Triangle + +Take a moment to reflect about the traditional features shown in the figure. The distribu-tion layer switches—Layer 3 switches—act as the default gateway used by hosts and often implement HSRP for better availability. The design uses more than one uplink from the access to distribution layer switches, with Layer 2 EtherChannels, to allow balancing in addition to redundancy. And STP/RSTP manages the small amount of Layer 2 redundancy in the campus, preventing loops by blocking on some ports. + +In comparison, a greenfield SDA fabric uses a routed access layer design. Routed access layer designs have been around long before SDA, but SDA makes good use of the design, +Chapter 17: Cisco Software-Defined Access (SDA) + +and it works very well for the underlay with its goal to support VXLAN tunnels in the over-lay network. A routed access layer design simply means that all the LAN switches are Layer 3 switches, with routing enabled, so all the links between switches operate as Layer 3 links. + +With a greenfield SDA deployment—that is, all new gear that you can allow to be config-ured by DNA Center—DNA Center will configure the devices’ underlay configuration to use a routed access layer. Because DNA Center knows it can configure the switches without concern of harming a production network, it chooses the best underlay configuration to support SDA. That best configuration happens to use a design called a routed access layer design, which has these features: + +■ All switches act as Layer 3 switches. +■ The switches use the IS-IS routing protocol. +■ All links between switches (single links, EtherChannels) are routed Layer 3 links (not Layer 2 links). +■ As a result, STP/RSTP is not needed, with the routing protocol instead choosing which links to use based on the IP routing tables. +■ The equivalent of a traditional access layer switch—an SDA edge node—acts as the default gateway for the endpoint devices, rather than distribution switches. +■ As a result, HSRP (or any FHRP) is no longer needed. + +389 + + + + + + + + + + + + + +17 + + +Figure 17-4 repeats the same physical design as in Figure 17-3 but shows the different fea-tures with the routed access design as configured using DNA Center. + + + + +Distribution Layer +(Layer 3 Switches) + +HSRP 10.1.1.1 +SW1 L3 + + +RSTP +IS-IS + +HSRP 10.1.1.1 SW2 + + +L3 L3 + + + +Access Layer +(Layer 3 Switches) + +SW3 + +IP 10.1.1.1 + + + + +GW = 10.1.1.1 + +Figure 17-4 SDA Fabric Layer 3 Access Benefits + +NOTE DNA Center configures the underlay with consistent settings for each instance of DNA across an enterprise. This convention simplifies operation as an enterprise completes a migration to SDA. +390 CCNA 200-301 Official Cert Guide, Volume 2 + +The SDA Overlay +When you first think of the SDA overlay , think of this kind of sequence. First, an endpoint sends a frame that will be delivered across the SDA network. The first SDA node to receive the frame encapsulates the frame in a new message—using a tunneling specification called VXLAN—and forwards the frame into the fabric. Once the ingress node has encapsu- +lated the original frame in VXLAN, the other SDA nodes forward the frame based on the VXLAN tunnel details. The last SDA node removes the VXLAN details, leaving the original frame, and forwards the original frame on toward the destination endpoint. + +While the summary of some of SDA’s overlay work in the previous paragraph may sound like a lot of work, all that work happens in each switch’s ASIC. So, while it is more complex to understand, there is no performance penalty for the switches to perform the extra work. + +When Cisco set about to create SDA, they saw an opportunity. Making use of VXLAN tun-nels opened up the possibilities for a number of new networking features that did not exist without VXLAN. This next topic begins with a closer look at the VXLAN tunnels in the overlay, followed by a discussion of how SDA uses LISP for endpoint discovery and loca-tion needed to create the VXLAN tunnels. + +VXLAN Tunnels in the Overlay (Data Plane) +SDA has many additional needs beyond the simple message delivery—needs that let it provide improved functions. To that end, SDA does not only route IP packets or switch Ethernet frames. Instead, it encapsulates incoming data link frames in a tunneling technol-ogy for delivery across the SDA network, with these goals in mind: +■ The VXLAN tunneling (the encapsulation and de-encapsulation) must be performed by the ASIC on each switch so that there is no performance penalty. (That is one reason for the SDA hardware compatibility list: the switches must have ASICs that can perform the work.) +■ The VXLAN encapsulation must supply header fields that SDA needs for its features, so the tunneling protocol should be flexible and extensible, while still being supported by the switch ASICs. +■ The tunneling encapsulation needs to encapsulate the entire data link frame instead of encapsulating the IP packet. That allows SDA to support Layer 2 forwarding features as well as Layer 3 forwarding features. + +To achieve those goals, when creating SDA, Cisco chose the Virtual Extensible LAN (VXLAN) protocol to create the tunnels used by SDA. When an SDA endpoint (for exam-ple, an end-user computer) sends a data link frame into an SDA edge node, the ingress edge node encapsulates the frame and sends it across a VXLAN tunnel to the egress edge node, as shown in Figure 17-5. + +To support the VXLAN encapsulation, the underlay uses a separate IP address space as compared with the rest of the enterprise, including the endpoint devices that send data over the SDA network. The overlay tunnels use addresses from the enterprise address space. For instance, imagine an enterprise used these address spaces: + +■ 10.0.0.0/8: Entire enterprise ■ 172.16.0.0/16: SDA underlay +Chapter 17: Cisco Software-Defined Access (SDA) 391 + +Ingress Fabric Edge Node Egress Fabric Edge Node + +SW1 10.1.1.1 + +SW2 +10.1.2.2 + + + + +LAN Frame + + +IP UDP VXLAN LAN Frame +Figure 17-5 Fundamentals of VXLAN Encapsulation in SDA + + +To make that work, first the underlay would be built using the 172.16.0.0/16 IPv4 address space, with all links using addresses from that address space. As an example, Figure 17-6 shows a small SDA design, with four switches, each with one underlay IP address shown (from the 172.16.0.0/16 address space). + + +17 + + +172.16.3.3 SW3 + + + +172.16.1.1 SW1 + +172.16.2.2 SW2 + + + +172.16.4.4 SW4 + + + +Figure 17-6 SDA Underlay Using 172.16.0.0 + +The overlay tunnel creates a path between two fabric edge nodes in the overlay IP address space—that is, in the same address space used by all the endpoints in the enterprise. Figure 17-7 emphasizes that point by showing the endpoints (PCs) on the left and right, with IP addresses in network 10.0.0.0/8, with the VXLAN overlay tunnel shown with addresses also from 10.0.0.0/8. + + +10.1.1.1 +SW1 10.3.3.1 +VXLAN Tunnel + +10.1.2.2 10.3.3.2 SW2 + + +Subnets of Enterprise (Overlay) +Figure 17-7 VXLAN Tunnel and Endpoints with IPv4 Addresses in the Same IPv4 Space +392 CCNA 200-301 Official Cert Guide, Volume 2 + +LISP for Overlay Discovery and Location (Control Plane) +Ignore SDA for a moment, and think about traditional Layer 2 switching and Layer 3 rout-ing. How do their control planes work? In other words, how do these devices discover the possible destinations in the network, store those destinations, so that the data plane has all the data it needs when making a forwarding decision? To summarize: + +■ Traditional Layer 2 switches learn possible destinations by examining the source MAC addresses of incoming frames, storing those MAC addresses as possible future destina-tions in the switch’s MAC address table. When new frames arrive, the Layer 2 switch data plane then attempts to match the Ethernet frame’s destination MAC address to an entry in its MAC address table. +■ Traditional Layer 3 routers learn destination IP subnets using routing protocols, storing routes to reach each subnet in their routing tables. When new packets arrive, the Layer 3 data plane attempts to match the IP packet’s destination IP address to some entry in the IP routing table. + +Nodes in the SDA network do not do these same control plane actions to support endpoint traffic. Just to provide a glimpse into the process for the purposes of CCNA, consider this sequence, which describes one scenario: +■ Fabric edge nodes—SDA nodes that connect to the edge of the SDA fabric—learn the location of possible endpoints using traditional means, based on their MAC address, individual IP address, and by subnet, identifying each endpoint with an endpoint identi-fier (EID). +■ The fabric edge nodes register the fact that the node can reach a given endpoint (EID) into a database called the LISP map server. +■ The LISP map server keeps the list of endpoint identifiers (EIDs) and matching routing locators (RLOCs) (which identify the fabric edge node that can reach the EID). +■ In the future, when the fabric data plane needs to forward a message, it will look for and find the destination in the LISP map server’s database. + +For instance, switches SW3 and SW4 in Figure 17-8 each just learned about different sub-nets external to the SDA fabric. As noted at step 1 in the figure, switch SW3 sent a mes-sage to the LISP map server, registering the information about subnet 10.1.3.0/24 (an EID), with its RLOC setting to identify itself as the node that can reach that subnet. Step 2 shows an equivalent registration process, this time for SW4, with EID 10.1.4.0/24, and with R4’s RLOC of 172.16.4.4. Note that the table at the bottom of the figure represents that data held by the LISP map server. +Chapter 17: Cisco Software-Defined Access (SDA) 393 + + +RLOC 172.16.3.3 SW1 SW3 + + +1 + +EID 10.1.3.0/24 + + + + + +RLOC 172.16.4.4 + +SW4 +2 LISP +Map Server + + +EID 10.1.4.0/24 +17 + + + + +EID + +1 10.1.3.0/24 + +2 10.1.4.0/24 + +RLOC + +172.16.3.3 + +172.16.4.4 + + +Figure 17-8 Edge Nodes Register IPv4 Prefixes (Endpoint IDs) with LISP Map Server + +When new incoming frames arrive, the ingress tunnel router (ITR)—the SDA node that receives the new frame from outside the SDA fabric—needs some help from the control plane. To where should the ITR forward this frame? And because SDA always forwards frames in the fabric over some VXLAN tunnel, what tunnel should the ITR use when for-warding the frame? For the first frame sent to a destination, the ITR has to follow a process like the following steps. The steps begin at step 3, as a continuation of Figure 17-8, with the action referenced in Figure 17-9: + +3. An Ethernet frame to a new destination arrives at ingress edge node SW1 (upper left), and the switch does not know where to forward the frame. +4. The ingress node sends a message to the LISP map server asking if the LISP server knows how to reach IP address 10.1.3.1. +5. The LISP map server looks in its database and finds the entry it built back at step 1 in the previous figure, listing SW3’s RLOC of 172.16.3.3. +6. The LISP map server contacts SW3—the node listed as the RLOC—to confirm that the entry is correct. +7. SW3 completes the process of informing the ingress node (SW1) that 10.1.3.1 can be reached through SW3. +394 CCNA 200-301 Official Cert Guide, Volume 2 + +Dest. = 10.1.3.1 + +3 +RLOC 172.16.3.3 SW1 SW3 +7 EID 10.1.3.0/24 + + +4 + + + +6 + +LISP Map Server + +EID RLOC + +RLOC 172.16.4.4 SW4 +EID +10.1.4.0/24 + + + +5 10.1.3.0/24 + +10.1.4.0/24 + + +172.16.3.3 + +172.16.4.4 + + +Figure 17-9 Ingress Tunnel Router SW1 Discovers Egress Tunnel Router SW3 Using LISP + +To complete the story, now that ingress node SW1 knows that it can forward packets sent to endpoint 10.1.3.1 to the edge node with RLOC 172.16.3.3 (that is, SW3), SW1 encap-sulates the original Ethernet frame as shown in Figure 17-9, with the original destination IP address of 10.1.3.1. It adds the IP, UDP, and VXLAN headers shown so it can deliver the message over the SDA network, with that outer IP header listing a destination IP address of the RLOC IP address, so that the message will arrive through the SDA fabric at SW3, as shown in Figure 17-10. + +At this point, you should have a basic understanding of how the SDA fabric works. The underlay includes all the switches and links, along with IP connectivity, as a basis for for-warding data across the fabric. The overlay adds a different level of logic, with endpoint traffic flowing through VXLAN tunnels. This chapter has not mentioned any reasons that SDA might want to use these tunnels, but you will see one example by the end of the chap-ter. Suffice it to say that with the flexible VXLAN tunnels, SDA can encode header fields that let SDA create new networking features, all without suffering a performance penalty, as all the VXLAN processing happens in an ASIC. + +This chapter next focuses on DNA Center and its role in managing and controlling SDA fabrics. +Chapter 17: Cisco Software-Defined Access (SDA) 395 + + +Dest. = 172.16.3.3 Dest. = 10.1.3.1 + + + +IP UDP VXLAN Original SW1 + + +RLOC 172.16.3.3 SW3 + +10.1.3.0/24 + + + + + + + + + + +LISP Map Server + + +EID RLOC + +RLOC 172.16.4.4 +SW4 17 +10.1.4.0/24 + + + +1 10.1.3.0/24 + +2 10.1.4.0/24 + + +172.16.3.3 + +172.16.4.4 + + +Figure 17-10 Ingress Tunnel Router (ITR) SW1 Forwards Based on LISP Mapping to SW3 + +DNA Center and SDA Operation +Cisco DNA Center (www.cisco.com/go/dnacenter) has two notable roles: + +■ As the controller in a network that uses Cisco SDA +■ As a network management platform for traditional (non-SDA) network devices, with an expectation that one day DNA Center may become Cisco’s primary enterprise network management platform + +The first role as SDA network controller gets most of the attention and is the topic of dis-cussion in this second of the three major sections of this chapter. SDA and DNA Center go together, work closely together, and any serious use of SDA requires the use of DNA Center. At the same time, DNA Center can manage traditional network devices; the final major section of the chapter works through some comparisons. + +Cisco DNA Center +Cisco DNA Center exists as a software application that Cisco delivers pre-installed on a Cisco DNA Center appliance. The software follows the same general controller architecture concepts as described in Chapter 16. Figure 17-11 shows the general ideas. +396 CCNA 200-301 Official Cert Guide, Volume 2 + + + + +Script GUI Script GUI + +REST API +Cisco or Vendor App + + +REST API DNA Center REST API + + +Telnet/SSH SNMP + +NETCONF RESTCONF + + + + + + + + + + + +Figure 17-11 Cisco DNA Center with Northbound and Southbound Interfaces + +Cisco DNA Center includes a robust northbound REST API along with a series of south-bound APIs. For most of us, the northbound API matters most, because as the user of SDA networks, you interact with SDA using Cisco DNA Center’s northbound REST API or the GUI interface. (Chapter 18, “Understanding REST and JSON,” discusses the concepts behind REST APIs in more detail.) + +Cisco DNA Center supports several southbound APIs so that the controller can communi-cate with the devices it manages. You can think of these as two categories: + +■ Protocols to support traditional networking devices/software versions: Telnet, SSH, SNMP +■ Protocols to support more recent networking devices/software versions: NETCONF, RESTCONF + +Cisco DNA Center needs the older protocols to be able to support the vast array of older Cisco devices and OS versions. Over time, Cisco has been adding support for NETCONF and RESTCONF to their more current hardware and software. + +Cisco DNA Center and Scalable Groups +SDA creates many interesting new and powerful features beyond how traditional campus networks work. Cisco DNA Center not only enables an easier way to configure and oper-ate those features, but it also completely changes the operational model. While the scope of CCNA does not allow us enough space to explore all of the features of SDA and DNA Center, this next topic looks at one feature as an example: scalable groups. +Chapter 17: Cisco Software-Defined Access (SDA) 397 + +Issues with Traditional IP-Based Security +Imagine the life of one traditional IP ACL in an enterprise. Some requirements occurred, and an engineer built the first version of an ACL with three Access Control Entries (ACEs)—that is, access-list commands—with a permit any at the end of the list. Months later, the engineer added two more lines to the ACL, so the ACL has the number of ACEs +shown in Figure 17-12. The figure notes the lines added for requests one and two with the circled numbers in the figure. + + +ACE 1 + +ACE 2 1 + +ACE 3 + +ACE 4 +2 ACE 5 + +Permit + + +(First Request) + +17 (Two Months Later) + + +Figure 17-12 Lines (ACEs) in an ACL after Two Changes + +Now think about that same ACL after four more requirements caused changes to the ACL, as noted in Figure 17-13. Some of the movement includes + +■ The ACEs for requirement two are now at the bottom of the ACL. +■ Some ACEs, like ACE 5, apply to more than one of the implemented requirements. +■ Some requirements, like requirement number five, required ACEs that overlap with mul-tiple other requirements. + +ACE 1 + +ACE 2 1 + +ACE 3 + +ACE 4 +6 3 ACE 5 +5 ACE 6 + +ACE 7 + +ACE 8 4 + +ACE 9 + +ACE 10 + +ACE 11 2 ACE 12 + +(Permit) + +Figure 17-13 Lines (ACEs) in an ACL after Six Changes + +Now imagine your next job is to add more ACEs for the next requirement (7). However, your boss also told you to reduce the length of the ACL, removing the ACEs from that one change made last August—you remember it, right? Such tasks are problematic at best. +398 CCNA 200-301 Official Cert Guide, Volume 2 + +With the scenario in Figure 17-13, no engineer could tell from looking at the ACL whether any lines in the ACL could be safely removed. You never know if an ACE was useful for one requirement or for many. If a requirement was removed, and you were even told which old project caused the original requirement so that you could look at your notes, you would not know if removing the ACEs would harm other requirements. Most of the time, ACL management suffers with these kinds of issues: + +■ ACEs cannot be removed from ACLs because of the risk of causing failures to the logic for some other past requirement. +■ New changes become more and more challenging due to the length of the ACLs. +■ Troubleshooting ACLs as a system—determining whether a packet would be delivered from end-to-end—becomes an even greater challenge. + +SDA Security Based on User Groups +Imagine you could instead enforce security without even thinking about IP address ranges and ACLs. SDA does just that, with simple configuration, and the capability to add and remove the security policies at will. + +First, for the big ideas. Imagine that over time, using SDA, six different security require-ments occurred. For each project, the engineer would define the policy with DNA Center, either with the GUI or with the API. Then, as needed, DNA Center would configure the devices in the fabric to enforce the security, as shown in Figure 17-14. + +Policy 1 Policy 2 Policy 3 + +Policy 4 Policy 5 Policy 6 + + + +DNA–C + + + + +SDA Fabric + + + + + +Figure 17-14 DNA-C IP Security Policies (Northbound) to Simplify Operations + +NOTE The model in Figure 17-14 helps demonstrate the concept of intent-based network-ing (IBN). The engineer configures the intent or outcome desired from the network—in this case, a set of security policies. The controller communicates with the devices in the net-work, with the devices determining exactly what configuration and behavior are necessary to achieve those intended policies. +Chapter 17: Cisco Software-Defined Access (SDA) 399 + +The SDA policy model solves the configuration and operational challenges with traditional ACLs. In fact, all those real issues with managing IP ACLs on each device are no longer issues with SDA’s group-based security model. For instance: + +■ The engineer can consider each new security requirement separately, without analysis of an existing (possibly lengthy) ACL. +■ Each new requirement can be considered without searching for all the ACLs in the likely paths between endpoints and analyzing each and every ACL. +■ DNA Center (and related software) keeps the policies separate, with space to keep notes about the reason for the policy. +■ Each policy can be removed without fear of impacting the logic of the other policies. + +SDA and Cisco DNA achieve this particular feature by tying security to groups of users, 17 called scalable groups, with each group assigned a scalable group tag (SGT). Then the engi- +neer configures a grid that identifies which SGTs can send packets to which other SGTs. For instance, the grid might include SGTs for an employee group, the Internet (for the Enterprise’s WAN routers that lead to the Internet), partner employees, and guests, with a grid like the one shown in Table 17-2. + +Table 17-2 Access Table for SDA Scalable Group Access +Dest. Employee Internet Partner Guest Source + +Employee N/A Internet Permit Partner Permit +Guest Deny + +Permit Permit Deny N/A Permit Permit Permit N/A Deny +Permit Deny N/A + + +To link this security feature back to packet forwarding, consider when a new endpoint tries to send its first packet to a new destination. The ingress SDA node starts a process by send-ing messages to DNA Center. DNA Center then works with security tools in the network, like Cisco’s Identity Services Engine (ISE), to identify the users and then match them to their respective SGTs. DNA Center then checks the logic similar to Table 17-2. If DNA Center sees a permit action between the source/destination pair of SGTs, DNA Center directs the edge nodes to create the VXLAN tunnel, as shown in Figure 17-15. If the security poli- +cies state that the two SGTs should not be allowed to communicate, DNA Center does not direct the fabric to create the tunnel, and the packets do not flow. + + +SW1 SW1 10.1.1.1 + + +SW2 +10.1.2.2 + + + + + +Source Dest. Source Dest. +IP UDP SGT SGT VNID VNID Original Eth + +VXLAN +Figure 17-15 VXLAN Header with Source and Destination SGTs and VNIDs Revealed +400 CCNA 200-301 Official Cert Guide, Volume 2 + + +NOTE The figure gives a brief insight into why SDA goes to the trouble of using VXLAN encapsulation for its data plane, rather than performing traditional Layer 2 switching or Layer 3 routing. The VXLAN header has great flexibility—in this case, used to define both a source and destination SGT, matching SDA’s desired logic of allowing a subset of source/ destination SGTs in the SDA fabric. + +The operational model with scalable groups greatly simplifies security configuration and ongoing maintenance of the security policy, while focusing on the real goal: controlling access based on user. From a controller perspective, the fact that Cisco DNA Center acts as much more than a management platform, and instead as a controller of the activities in the network, makes for a much more powerful set of features and capabilities. + +DNA Center as a Network Management Platform CCNA Exam topic 6.4 asks you to compare traditional network management with DNA Center: + +Compare traditional campus device management with Cisco DNA Center enabled device management +Note that the exam topic does not identify which traditional management product. In fact, Cisco tends to shy away from product details in most of its career certifications. So, to think through this exam topic, you need to think in general about network management products. But it also helps to think about specific products—but temper that by focusing on the more prominent features and major functions. + +This section uses Cisco Prime Infrastructure (PI) (www.cisco.com/go/primeinfrastructure) as an example of a traditional enterprise network management product. For many years, Cisco Prime Infrastructure has been Cisco’s primary network management product for the enter-prise. It includes the following features: + +■ Single-pane-of-glass: Provides one GUI from which to launch all PI functions and features +■ Discovery, inventory, and topology: Discovers network devices, builds an inventory, and arranges them in a topology map +■ Entire enterprise: Provides support for traditional enterprise LAN, WAN, and data cen-ter management functions +■ Methods and protocols: Uses SNMP, SSH, and Telnet, as well as CDP and LLDP, to dis-cover and learn information about the devices in the network +■ Lifecycle management: Supports different tasks to install a new device (day 0), config-ure it to be working in production (day 1), and perform ongoing monitoring and make changes (day n) +■ Application visibility: Simplifies QoS configuration deployment to each device +■ Converged wired and wireless: Enables you to manage both the wired and wireless LAN from the same management platform +Chapter 17: Cisco Software-Defined Access (SDA) 401 + +■ Software Image Management (SWIM): Manages software images on network devices and automates updates +■ Plug-and-Play: Performs initial installation tasks for new network devices after you phys-ically install the new device, connect a network cable, and power on + + +PI itself runs as an application on a server platform with GUI access via a web browser. The PI server can be purchased from Cisco as a software package to be installed and run on your servers, or as a physical appliance. + +The next few pages now compare and contrast DNA Center to traditional management tools like PI. + +DNA Center Similarities to Traditional Management +If you read the user’s guide for DNA Center and look through all the features, you will find all the features just listed here as traditional management features. For instance, both can discover network devices and create a network topology map. Human operators (rather than automated processes) often start with the topology map, expecting notices (flashing lights, red colors) to denote issues in the network. + +As an example, Figure 17-16 shows a topology map from DNA Center. Both PI and DNA Center can perform a discover process to find all the devices in the network and then build topology maps to show the devices. (Interestingly, DNA Center can work with PI, using the data discovered by PI rather than performing the discovery work again.) + + + + + + + + +17 + + + + + + + + + + + + + + + + + + + + +Figure 17-16 DNA Center Topology Map + +The GUI mechanisms are relatively intuitive, with the ability to click into additional or less detail. Figure 17-17 shows a little more detail after hovering over and clicking on one of the nodes in the topology from Figure 17-16, typical actions and results in many management products. +402 CCNA 200-301 Official Cert Guide, Volume 2 + + + + + + + + + + + + + + + + + + + +Figure 17-17 Hover and Click Details About One Cisco 9300 Switch from DNA Center + +I encourage you to take some time to use and watch some videos about Cisco DNA Center. The “Chapter Review” section for this chapter on the companion website lists some links for good videos. Also, start at https://developer.cisco.com and look for Cisco DNA Center sandbox labs to find a place to experiment with Cisco DNA Center. + +DNA Center Differences with Traditional Management +In a broad sense, there are several fundamental differences between Cisco DNA Center and traditional network management platforms like Cisco PI. The largest difference: Cisco DNA Center supports SDA, whereas other management apps do not. At the same time, given its long history, as of the time this chapter was written, Cisco PI still had some traditional man-agement features not found in Cisco DNA Center. So think of PI as comprehensive to tra-ditional device management, with Cisco DNA Center having many of those features, while focusing on future features like SDA support. + +NOTE Cisco hopes to continue to update Cisco DNA Center’s traditional network man-agement features to be equivalent compared to Cisco PI, to the point at which DNA Center could replace PI. + +In terms of intent and strategy, Cisco focuses their development of Cisco DNA Center features toward simplifying the work done by enterprises, with resulting reduced costs and much faster deployment of changes. Cisco DNA Center features help make initial instal-lation easier, simplify the work to implement features that traditionally have challenging configuration, and use tools to help you notice issues more quickly. Some of the features unique to Cisco DNA Center include +■ EasyQoS: Deploys QoS, one of the most complicated features to configure manually, with just a few simple choices from Cisco DNA Center +■ Encrypted traffic analysis: Enables Cisco DNA to use algorithms to recognize security threats even in encrypted traffic +Chapter 17: Cisco Software-Defined Access (SDA) 403 + +■ Device 360 and Client 360: Gives a comprehensive (360-degree) view of the health of the device +■ Network time travel: Shows past client performance in a timeline for comparison to cur-rent behavior +■ Path trace: Discovers the actual path packets would take from source to destination based on current forwarding tables + +Just to expound on one feature as an example, Cisco DNA Center’s Path Trace feature goes far beyond a traditional management application. A typical network management app might show a map of the network and let you click through to find the configuration on each device, including ACLs. The path trace feature goes much further. The DNA user (from the +GUI or the API) specifies a source and destination host and optionally transport protocol +and ports. Then the path trace feature shows a map of the path through the network and 17 +shows which ACLs are in the path, and whether they would permit or deny the packet. + +All of Cisco Digital Network Architecture sets about to help customers reach some big goals: reduced costs, reduced risks, better security and compliance, faster deployment of services through automation and simplified processes, and the list goes on. Cisco DNA Center plays an important role, with all the functions available through its robust north-bound API, and with its intent-based networking approach for SDA. Cisco DNA Center represents the future of network management for Cisco enterprises. + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 17-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. + +Table 17-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms +Answer DIKTA questions + +Resource Used Book, website Book, website +Book, PTP +404 CCNA 200-301 Official Cert Guide, Volume 2 + +Review All the Key Topics + +Table 17-4 +Key Topic Element +List +Figure 17-2 List +List List +Figure 17-5 +Figure 17-8 + +Key Topics for Chapter 17 +Description Page Number +Definitions for overlay, underlay, and fabric 384 SDA overlay and underlay 386 SDA fabric edge, fabric border, and fabric control node roles 387 Attributes of the SDA underlay 389 SDA VXLAN tunneling benefits 390 VXLAN encapsulation process with SDA 391 +Registering SDA endpoint IDs (EIDs) with the map server 393 + + + +Figure 17-14 + +List + +List + +DNA Center shown controlling the fabric to implement group- 398 based security +DNA Center features that go beyond traditional network 400 management +Features unique to DNA Center 402 + + +Key Terms You Should Know +Software-Defined Access, overlay, underlay, fabric, DNA Center, fabric edge node, VXLAN, LISP, scalable group tag (SGT), Cisco Prime Infrastructure (PI) + + + + + + + + +This page intentionally left blank +CHAPTER 18 + + + +Understanding REST and JSON This chapter covers the following exam topics: +6.0 Automation and Programmability +6.5 Describe characteristics of REST-based APIs (CRUD, HTTP verbs, and data encoding) + +6.7 Interpret JSON encoded data + + +To automate and program networks, some automation software does several tasks. The soft-ware analyzes data in the form of variables, makes decisions based on that analysis, and then may take action to change the configuration of network devices or report facts about the state of the network. + +The different automation functions reside on different devices: the network engineer’s device, a server, a controller, and the various network devices themselves. For these related automation processes to work well, all these software components need useful well-defined conventions to allow easy communication between software components. + +This chapter focuses on two conventions that allow automation software to communicate. The first major section discusses application programming interfaces (APIs), specifically APIs that follow a style called REpresentational State Transfer (REST). APIs of any kind create a way for software applications to communicate, while RESTful APIs (APIs that use REST conventions) follow a particular set of software rules. Many APIs used in network automation today use REST-based APIs. + +The second half of the chapter focuses on the conventions and standards for the data variables exchanged over APIs, with a focus on one: JavaScript Object Notation (JSON). If REST provides one standard method of how two automation programs should communicate over a network, JSON then defines how to communicate the variables used by a program: the variable names, their values, and the data structures of those variables. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + +Table 18-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section REST-based APIs +Data Models and JSON + +Questions 1–3 +4–6 + + + + +1. Which of the following are required attributes of a REST-based API? (Choose two answers.) +a. Uses HTTP +b. Objects noted as to whether they can be cached c. Classful operation +d. Client/server architecture + +2. Which answers list a matching software development CRUD action to an HTTP verb that performs that action? (Choose two answers.) +a. CRUD create and HTTP PATCH b. CRUD update and HTTP PATCH c. CRUD delete and HTTP PUT +d. CRUD read and HTTP GET + +3. Examine the following URI that works with a Cisco DNA Controller: https://dnac.example.com/dna/intent/api/v1/network-device?managementIPAddress=10.10.22.74 +Which part of the URI, per the API documentation, is considered to identify the resource but not any parameters? +a. https:// +b. dnac.example.com +c. dna/intent/api/v1/network-device d. managementIPAddress=10.10.22.74 +4. Which of the following data serialization and data modeling languages would be most likely to be used in a response from a REST-based server API used for networking applications? (Choose two answers.) +a. JSON b. YAML +c. JavaScript d. XML +5. Which answers correctly describe the format of the JSON text below? (Choose two answers.) +{ "myvariable":[1,2,3] } +a. One JSON object that has one key:value pair b. One JSON object that has three key:value pairs +c. A JSON object whose value is a second JSON object d. A JSON object whose value is a JSON array +408 CCNA 200-301 Official Cert Guide, Volume 2 + +6. Which answers refer to JSON values rather than JSON keys as found in the sample JSON data? (Choose two answers.) + +{ +"response": { +"type": "Cisco Catalyst 9300 Switch", +"family": "Switches and Hubs", +"role": "ACCESS", +"managementIpAddress": "10.10.22.66" +} +} + +a. “response” b. “type” +c. “ACCESS” +d. The entire gray area + + +Foundation Topics + +REST-Based APIs +Applications use application programming interfaces (APIs) to communicate. To do so, one program can learn the variables and data structures used by another program, making logic choices based on those values, changing the values of those variables, creating new variables, and deleting variables. APIs allow programs running on different computers to work cooperatively, exchanging data to achieve some goal. + +In an API software world, some applications create an API, with many other applications using (consuming) the API. Software developers add APIs to their software so other applica-tion software can make use of the first application’s features. + +When writing an application, the developer will write some code, but often the developer may do a lot of work by looking for APIs that can provide the data and functions, reducing the amount of new code that must be written. As a result, much of modern software devel-opment centers on understanding and learning new APIs, along with the available libraries (prebuilt software that can be used to accomplish tasks rather than writing the equivalent from scratch). + +Several types of APIs exist, each with a different set of conventions to meet a different set of needs. The CCNA blueprint mentions one type of API—REpresentational State Transfer (REST)—because of its popularity as a type of API in networking automation applications. This first major section of the chapter takes a closer look at REST-based APIs. + +REST-Based (RESTful) APIs +REST APIs follow a set of foundational rules about what makes a REST API and what does not. First, from a literal perspective, REST APIs include the six attributes defined a few decades +Chapter 18: Understanding REST and JSON 409 + +back by its creator, Roy Fielding. (You can find a good summary at https://restfulapi.net). Those six attributes are + +■ Client/server architecture ■ Stateless operation +■ Clear statement of cacheable/uncacheable ■ Uniform interface +■ Layered +■ Code-on-demand + +The first three of these attributes get at the heart of how a REST API works. You can more easily see those first three features at work with networking REST APIs, so the next few paragraphs give a little more explanation about those first three points. + +Client/Server Architecture +Like many applications, REST applications use a client/server architectural model. First, an 18 application developer creates a REST API, and that application, when executing, acts as a +REST server. Any other application can make a REST API call (the REST client) by execut-ing some code that causes a request to flow from the client to the server. For instance, in Figure 18-1 + +1. The REST client on the left executes a REST API call, which generates a message sent to the REST server. +2. The REST server on the right has API code that considers the request and decides how to reply. +3. The REST server sends back the reply message with the appropriate data variables in the reply message. + +Verb URI + + +1 IP TCP HTTP + +IP TCP HTTP 3 + + +Return Data +Code 2 +API +Call +API + + +REST REST Client Server +Figure 18-1 Client/Server Operation with REST +410 CCNA 200-301 Official Cert Guide, Volume 2 + + +NOTE Figure 18-1 shows the use of HTTP. While many REST APIs use HTTP, the use of HTTP is not a requirement for an API to be considered RESTful. + +Stateless Operation +The stateless attribute of REST APIs means that REST does not record and use information about one API exchange for the purpose of how subsequent API exchanges are processed. In other words, each API request and reply does not use any other past history considered when processing the request. + +For comparison, the TCP protocol uses a stateful approach, whereas UDP uses stateless operation. A TCP connection requires the endpoints to initialize variables on each end, with those variables updating over time, and with those variables being used for subsequent TCP messages. For instance, TCP uses sequence numbers and acknowledgment numbers to man-age the flow of data in a TCP connection. + +Cacheable (or Not) +To appreciate what is meant by cacheable, consider what happens when you browse a web-site. When your browser loads a new web page, the page itself contains a variety of objects (text, images, videos, audio). Some objects seldom change, so it would be better to down-load the object once and not download it again; in that case, the server marks that object +as cacheable. For instance, a logo or other image shown on many pages of a website would almost never change and would likely be cacheable. However, the product list returned in your most recent search of the website would not be cacheable because the server would want to update and supply a new list each time you request the page. + +REST APIs require that any resource requested via an API call have a clear method by which to mark the resource as cacheable or not. The goals remain the same: improve performance by retrieving resources less often (cacheable). Note that cacheable resources are marked with a timeframe so that the client knows when to ask for a new copy of the resource again. + +Background: Data and Variables +To appreciate a few of the upcoming topics, it helps to have a basic idea about how pro-gramming languages use variables. Anyone who has done even a small amount of program-ming should have enough background, but for those who have not written programs before, this next topic gives you enough background about data and variables inside programs to understand the next topic. + +If you have some programming experience and already know about simple variables, list variables, and dictionary variables, then feel free to skip ahead to the section “REST APIs and HTTP.” + +Simple Variables +Applications all process data with the same general actions, starting with some kind of input. The program needs data to process, so the input process reads files, sends database queries to a database server, or makes API calls to retrieve data from another application’s API. The goal: gather the data that the program needs to process to do its work. + + +Answers to the “Do I Know This Already?” quiz: 1 B, D 2 B, D 3 C 4 A, D 5 A, D 6 C, D +Chapter 18: Understanding REST and JSON 411 + +Programs then process data by making comparisons, making decisions, creating new vari-ables, and performing mathematical formulas to analyze the data. All that logic uses vari-ables. For instance, a program might process data with the following logic: + +If the router’s G0/0 interface has a configuration setting of switchport mode dynamic auto, then gather more data to ensure that interface currently operates as a trunk rather than as an access port. +In programming, a variable is a name or label that has an assigned value. To get a general sense for programming variables, you can think of variables much like variables from algebra equations back in school. Example 18-1 shows some samples of variables of different types in a Python program (the Python language is the most popular language today for writing network automation applications). This program begins with a comment (the top three lines with triple single quotes) and then creates four variables, assigning them to different values, and prints a line of output: “The product is -12.” +Example 18-1 Simple Python Program That Shows a Product +''' 18 Sample program to multiply two numbers and display the result +''' +x = 3 +y = -4 +z = 1.247 +heading = "The product is " +print(heading,x*y) + +The variables in Example 18-1 can be called simple variables because each variable name has a single value associated with it. Simple variables have one variable name and one associ-ated value, so they have a simple structure. + +The values of simple variables can have a variety of formats, as shown in Example 18-1. The example includes variables that contain +■ Unsigned integers (x) ■ Signed integers (y) +■ Floating-point numbers (z) ■ Text (heading) + +List and Dictionary Variables +While simple variables have many great uses, programs need variables with more complex data structures. In programming, a data structure defines a related set of variables and val-ues. For instance, Python uses list variables so that one variable name is assigned a value that is a list of values rather than a single value. You could imagine that a network automation program might want to have lists, such as a list of devices being managed, a list of interfaces on a device, or list of configuration settings on an interface. + +First, consider the variable named list1 in Example 18-2; note that the lines that begin with a # are comment lines. +412 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 18-2 Sample List and Dictionary Variables in Python + +# Variable list1 is a list in Python (called an array in Java) +list1 = ["g0/0", "g0/1", "g0/2"] + +# Variable dict1 is a dictionary (called an associative array in Java) +dict1 = {"config_speed":'auto', "config_duplex":"auto", "config_ip":"10.1.1.1"} + +Even if you have never seen Python code before, you can guess at some of the meaning of the list1 variable. The code assigns variable list1 to a value that itself is a list of three text strings. Note that the list could include text, unsigned integers, signed integers, and so on. + +Figure 18-2 shows the data structure behind variable list1 in Example 18-2. The variable is assigned to the list, with the list having three list elements. + +elements + +list1 g0/0 + +g0/1 + +g0/2 + +Figure 18-2 The List Data Structure in Python + +Python supports a similar data structure called a dictionary. If you think of the contents of a dictionary for the English language, that dictionary lists a series of paired items: a term and a matching definition. With programming languages like Python, the dictionary data +structure lists paired items as well: keys (like terms) and values (like definitions). Figure 18-3 shows the structure of that dictionary value matching the dict1 variable at the bottom of Example 18-2. Note that each key and its value is called a key:value pair. + +Key:Value Pairs + +dict1 config_speed auto + +config_duplex auto + +config_ip 10.1.1.1 + +Figure 18-3 Dictionary Data Structures in Python + +Data structures can get more complex. Additionally, the data structures can be nested. For instance, a single variable’s value could be a list, with each list element being a dictionary, with the values in some key:value pairs being other lists, and so on. For now, be aware of the fact that programs use simple variables but also use list and dictionary variables to make it easier to perform different kinds of logic. +Chapter 18: Understanding REST and JSON 413 + +REST APIs and HTTP +APIs exist to allow two programs to exchange data. Some APIs may be designed as an interface between programs running on the same computer, so the communication between programs happens within a single operating system. Many APIs need to be available to pro-grams that run on other computers, so the API must define the type of networking proto-cols supported by the API—and many REST-based APIs use the HTTP protocol. + +The creators of REST-based APIs often choose HTTP because HTTP’s logic matches some of the concepts defined more generally for REST APIs. HTTP uses the same principles as REST: it operates with a client/server model; it uses a stateless operational model; and it includes headers that clearly mark objects as cacheable or not cacheable. It also includes verbs—words that dictate the desired action for a pair HTTP Request and Reply—which matches how applications like to work. + +This section breaks down the fundamentals of some programming terminology, how that matches HTTP verbs, and how REST APIs make use of Uniform Resource Identifiers (URIs) +to specify the data desired from a RESTful API call. 18 +Software CRUD Actions and HTTP Verbs +The software industry uses a memorable acronym—CRUD—for the four primary actions performed by an application. Those actions are +Create: Allows the client to create some new instances of variables and data structures at the server and initialize their values as kept at the server +Read: Allows the client to retrieve (read) the current value of variables that exist at the server, storing a copy of the variables, structures, and values at the client +Update: Allows the client to change (update) the value of variables that exist at the server Delete: Allows the client to delete from the server different instances of data variables + +For instance, if using the northbound REST API of a DNA controller, as discussed in Chapter 17, “Cisco Software-Defined Access (SDA),” you might want to create something new, like a new security policy. From a programming perspective, the security policy exists as a related set of configuration settings on the DNA controller, internally represented by variables. To do that, a REST client application would use a create action, using the DNA Center RESTful API, that created variables on the DNA Controller via the DNA Center REST API. The concept of creating new configuration at the controller is performed via the API using a create action per the CRUD generic acronym. + +Other examples of CRUD actions include a check of the status of that new configuration (a read action), an update to change some specific setting in the new configuration (an update action), or an action to remove the security policy definition completely (a delete action). + +HTTP uses verbs that mirror CRUD actions. HTTP defines the concept of an HTTP request and reply, with the client sending a request and with the server answering back with a reply. Each request/reply lists an action verb in the HTTP request header, which defines the HTTP action. The HTTP messages also include a URI, which identifies the resource being manipu-lated for this request. As always, the HTTP message is carried in IP and TCP, with headers and data, as represented in Figure 18-4. +414 CCNA 200-301 Official Cert Guide, Volume 2 + +HTTP + +IP TCP Request Header Other Headers Data + + +Verb URI Some API Parameters +Figure 18-4 HTTP Verb and URI in an HTTP Request Header + +To get some perspective about HTTP, ignore REST for a moment. Whenever you open a web browser and click a link, your browser generates an HTTP GET request message similar to Figure 18-4 in structure. The message includes an HTTP header with the GET verb and the URI. The resources returned in the reply are the components of a web page, like text files, image files, and video files. + +HTTP works well with REST in part because HTTP has verbs that match the common pro-gram actions in the CRUD paradigm. Table 18-2 lists the HTTP verbs and CRUD terms for easy reference and study. + + +Table 18-2 +Action + +Comparing CRUD Actions to REST Verbs +CRUD Term REST (HTTP) Verb + + + +Create new data structures and variables Create Read (retrieve) variable names, structures, and values Read Update or replace values of some variable Update +Delete some variables and data structures Delete + +POST GET +PATCH, PUT +DELETE + + + +NOTE While Table 18-2 lists HTTP POST as a create action and HTTP PATCH and PUT as CRUD update actions , all three of these HTTP verbs might be used both for create and for update actions in some cases. + +Using URIs with HTTP to Specify the Resource +In addition to using HTTP verbs to perform the CRUD functions for an application, REST uses URIs to identify what resource the HTTP request acts on. For REST APIs, the resource can be any one of the many resources defined by the API. Each resource contains a set of related variables, defined by the API and identified by a URI. + +For instance, imagine a user creates a REST-based API. When she does so, she creates a set of resources that she wants to make available via the API, and she also assigns a unique URI to each resource. In other words, the API creator creates a URI and a matching set of vari-ables, and defines the actions that can be performed against those variables (read, update, and so on). +The API creator also creates API documentation that lists the resources and the URI that identifies each resource, among other details. The programmer for a REST client applica-tion can read the API documentation, build a REST API request, and ask for the specific resource, as shown in the example in Figure 18-5. +Chapter 18: Understanding REST and JSON 415 + + + + + + +HTTP GET URI = URI3 + +URI 1 Resource (Variables) + +URI 2 Resource (Variables) + +URI 3 Resource (Variables) +. . . . +. +. + +URI N Resource (Variables) + + +REST Server Figure 18-5 One URI for Each API Resource—Conceptual View + +Figure 18-5 shows the URIs as generic values; however, today’s network engineers need to be able to read API documentation, see URIs in that documentation, and understand the meaning of each part of the URI. Figure 18-6 shows a URI specific to the Cisco DNA Center northbound REST API as an example of some of the components of the URI. + + +18 + + +Hostname/Address + +HTTPS://dnac.example.com/dna/intent/api/v1/network-device + + +Protocol +Figure 18-6 + +Path (Resource) +URI Structure for REST GET Request + + +The figure shows these important values and concepts: + +HTTPS: The letters before the :// identify the protocol used—in this case, HTTP Secure (which uses HTTP with SSL encryption). +Hostname or IP Address: This value sits between the // and first /, and identifies the host; if using a hostname, the REST client must perform name resolution to learn the IP address of the REST server. +Path (Resource): This value sits after the first / and finishes either at the end of the URI or before any additional fields (like a parameter query field). HTTP calls this field the path, but for use with REST, the field uniquely identifies the resource as defined by the API. + +To drive home the connection between the API, URI, and resource part of the API, it can be helpful to just do a general tour of the API documentation for any REST-based API. For instance, when Cisco created DNA Center, it created the REST-based northbound interface and chose one URI as shown in Figure 18-6. Figure 18-7 shows a copy of the doc page +for that particular resource for comparison. Go to https://developer.cisco.com and search for “Cisco DNA Center API documentation.” Continue to search for yourself to see more examples of the resources defined by the Cisco DNA Center API. +416 CCNA 200-301 Official Cert Guide, Volume 2 + + + + + + + + + + + + + + + + + + + + + + + + +Figure 18-7 DNA Center API Doc Page for the Network Device (List) Resource + +Many of the HTTP request messages need to pass information to the REST server beyond the API. Some of that data can be passed in header fields—for instance, REST APIs use HTTP header fields to encode much of the authentication information for REST calls. Additionally, parameters related to a REST call can be passed as parameters as part of the URI itself. + +For instance, the URI in Figure 18-6 asks the Cisco DNA Center for a list of all known devices, with Cisco DNA Center returning a dictionary of values for each device. You might instead want that dictionary of values for only a single device. The Cisco DNA Center API allows for just that by tacking on the following to the end of the URI shown in Figure 18-6. + +?managementIPAddress=10.10.22.66&macAddress=f8:7b:20:67:62:80 + +Figure 18-8 summarizes the major components of the URIs commonly used with a REST API, with the resource and parameter parts of the URI identifying specifically what the API should supply to the REST client. + +Hostname/Address + +HTTPS://dnac.example.com/dna/intent/api/v1/network-device?parm1=10.1.1.1... + +Protocol Path (Resource) Query (Parameters) Figure 18-8 Example Components of a URI Used in a REST API Call +Chapter 18: Understanding REST and JSON + +Example of REST API Call to DNA Center +To pull some of the REST API concepts together, the next few pages work through a few sample API calls using a software application called an API development environment tool. + +For a bit of development perspective, when working to automate some part of your net-work operation tasks, you would eventually use a program that made API calls. However, early in the process of developing an application, you might first focus on the data available from the API and ignore all the programming details at first. API development environments let you focus on the API calls. Later, that same tool can typically generate correct code that you can copy into your program to make the API calls. + +The examples in this section use an app named Postman. Postman can be downloaded for free (www.postman.co) and used as shown in this section. Note that Cisco DevNet makes extensive use of Postman in its many labs and examples. + +The first example shows a screenshot of a part of the Postman app after it sends a REST client GET request to a DNA Center REST API (see Figure 18-9). In particular, look for the following: + +■ The URI, near the top, lists a hostname of sandboxdnac2.cisco.com, which is an always-on DNA Center instance supplied by Cisco’s DevNet site (which you can use). +■ The resource part of the URI shows the same resource listed earlier in Figure 18-6, asking for a list of devices. +■ The bottom center of the window shows the data returned by the DNA Center REST HTTP GET response. +■ At the middle right, it lists the GET response’s status code of 200, meaning “OK.” + +417 + + + + + + + + + + + + + + + + +18 + + + + + + + + + + + + + + + + + + + + + +Figure 18-9 URI Structure for REST GET Request +418 CCNA 200-301 Official Cert Guide, Volume 2 + +Take a moment to look through the data at the bottom of the Postman window in Figure 18-9. The text follows a data modeling format called JavaScript Object Notation (JSON), which is one of the main topics for the remainder of the chapter. However, armed with just a knowledge of routers, you can find a few facts that look familiar. To help you see the text, Example 18-3 shows an edited (shortened to reduce the length) view of some of the JSON output in that window, just so you can see the format and some of the data returned in this single API call. +Example 18-3 JSON Output from a REST API Call + +{ +"response": { +"type": "Cisco Catalyst 9300 Switch", +"family": "Switches and Hubs", +"role": "ACCESS", +"macAddress": "f8:7b:20:67:62:80", +"hostname": "cat_9k_1", +"serialNumber": "FCW2136L0AK", +"softwareVersion": "16.6.1", +"upTime": "17 days, 22:51:04.26", +"interfaceCount": "41", +"lineCardCount": "2", +"managementIpAddress": "10.10.22.66", +"series": "Cisco Catalyst 9300 Series Switches", +"softwareType": "IOS-XE" +} +} + +API development tools like Postman help you work out the particulars of each API call, save the details, and share with other engineers and developers. Eventually, you will be ready to make the API call from a program. With a simple click from the Postman UI, Postman supplies the code to copy/paste into your program so that it returns all the output shown in the center/bottom of the window back as a variable to your program. + +By now, you have a good foundational knowledge of the mechanics of REST APIs. By learning some skills, and using the API documentation for any REST API, you could now experiment with and try to make REST API calls. For many of those, the data will return to you as text, often in JSON format, so the second half of the chapter examines the meaning of that text. + +Data Serialization and JSON +In your journey to become a modern network engineer with network automation skills, you will learn to understand several data serialization languages. Each data serialization language provides methods of using text to describe variables, with a goal of being able to send that text over a network or to store that text in a file. Data serialization languages give us a way to represent variables with text rather than in the internal representation used by any par-ticular programming language. +Chapter 18: Understanding REST and JSON 419 + +Each data serialization language enables API servers to return data so that the API client can replicate the same variable names as well as data structures as found on the API server. To describe the data structures, the data serialization languages include special characters and conventions that communicate ideas about list variables, dictionary variables, and other more complex data structures. + +This second major section of the chapter examines the concept of a data serialization lan-guage, with a focus on the one data modeling language as mentioned in the current CCNA blueprint: JavaScript Object Notation (JSON). + +The Need for a Data Model with APIs +This section shows some ideas of how to move variables in a program on a server to a client program. First, Figure 18-10 and surrounding text show a nonworking example as a way to identify some of the challenges with copying variable values from one device to another. Then Figure 18-11 and its related text show how to use a data serialization language to solve the problems shown around Figure 18-10. +18 2 + + + + + + + + +API + + +3 + + +Variables: Internal + + +REST Client (Python) + + +1 + + +Variables: Internal + + +REST Server (JAVA) + +Figure 18-10 Broken Concept: Exchanging Internal Representations of Variables + +First, for the nonworking example, consider the flow and numbered steps in Figure 18-10. A REST client sits on the left. The REST client asks for a resource, and the server needs to reply. In REST, a resource is a set of variables as defined by the API, so the REST server needs to return a set of variables to the REST client on the left. The steps in the figure run as follows: + +1. The REST server (a JAVA application) takes a copy of the stored variables in RAM (step 1) in response to the REST request. +2. The REST API code creates the REST reply and sends it over the network, placing an exact replica of what the REST server had in RAM to represent the variables in that resource. +420 CCNA 200-301 Official Cert Guide, Volume 2 + +3. The REST client (a Python application) receives the REST reply message, storing the exact same bits and bytes into its RAM, in an attempt to have a copy of the variables, data, and data structures on the server. + +The process shown in Figure 18-10 does not work (and is not attempted) because the REST client programs may not store variables in the same ways. First, programs written in differ-ent languages use different conventions to store their variables internally because there is no standard for internal variable storage across languages. In fact, programs written in the same language but with different versions of that language may not store all their variables with the same internal conventions. + +To overcome these issues, applications need a standard method to represent variables for transmission and storage of those variables outside the program. Data serialization lan-guages provide that function. + +Figure 18-11 shows the correct process flow in comparison to Figure 18-10 with the data serialization process included: + +1. The server collects the internally represented data and gives it to the API code. +2. The API converts the internal representation to a data model representing those vari-ables (with JSON shown in the figure). +3. The server sends the data model in JSON format via messages across the network. +4. The REST client takes the received data and converts the JSON-formatted data into variables in the native format of the client application. + +3 + + + + +JSON String + +4 + + +JSON Converter + + + +Variables: Internal + + +REST Client + +JSON String + +2 + + +API + +1 + + +Variables: Internal + + +REST Server + +Figure 18-11 Correct Concept: Exchanging Internal Representations of Variables + +At the end of the process, the REST client application now has equivalent variables to the ones it requested from the server in the API call. Note that the final step—to convert from the data serialization language to the native format—can be as little as a single line of code! +Chapter 18: Understanding REST and JSON 421 + +Finally, note that while data serialization languages like JSON enable applications to exchange variables over a network, applications can also store data in JSON format. + +Data Serialization Languages +You will hear about and eventually use several data serialization and data modeling lan-guages the more you learn about network automation. While the current CCNA blueprint mentions only JSON, learning a few facts about some of the alternatives can be helpful to add a little context to your new knowledge of JSON. These different data serialization lan-guages exist to meet different needs that have arisen over the years. This next short section highlights four such languages. + +NOTE The terms data serialization language and data modeling language should be con-sidered equivalent for the purposes of this section. + + +JSON +JavaScript Object Notation attempts to strike a balance between human and machine read-ability. Armed with a few JSON rules, most humans can read JSON data, move past simply guessing at what it means, and confidently interpret the data structures defined by the JSON data. At the same time, JSON data makes it easy for programs to convert JSON text into variables, making it very useful for data exchange between applications using APIs. + +You can find the details of JSON in IETF RFC 8259 and in a number of sites found with Internet searches, including www.json.org. + +XML +Back in the 1990s, when web browsers and the World Wide Web (WWW) were first cre-ated, web pages primarily used Hypertext Markup Language (HTML) to define web pages. As a markup language, HTML defined how to add the text or a web page to a file and then add “markup”—additional text to denote formatting details for the text that should be displayed. For instance, the markup included codes for headings, font types, sizes, colors, hyperlinks, and so on. + +The eXtensible Markup Language (XML) came later to make some improvements for ear-lier markup languages. In particular, over time web pages became more and more dynamic, and to make the pages dynamic, the files needed to store variables whose values could be changed and replaced over time by the web server. To define variables to be substituted into a web page, the world needed a markup language that could define data variables. XML defines a markup language that has many features to define variables, values, and data structures. + +Over time, XML has grown beyond its original use as a markup language. XML’s features also make it a useful general data serialization language, and it is used as such today. + +Comparing XML to JSON, both attempt to be human readable, but with XML being a little more challenging to read for the average person. For instance, like HTML, XML uses begin-ning and ending tags for each variable, as seen in Example 18-4. In the highlighted line in the example, the and tags denote a variable name, with the value sitting between the tags. + + +18 +422 CCNA 200-301 Official Cert Guide, Volume 2 + +Example 18-4 JSON Output from a REST API Call + + + + +Switches and Hubs +cat_9k_1 +41 +2 +f8:7b:20:67:62:80 +10.10.22.66 +ACCESS +FCW2136L0AK +Cisco Catalyst 9300 Series Switches +IOS-XE +16.6.1 +Cisco Catalyst 9300 Switch +17 days, 22:51:04.26 + + + +YAML +YAML Ain’t Markup Language (YAML) has a clever recursive name, but the name does tell us something. YAML does not attempt to define markup details (while XML does). Instead, YAML focuses on the data model (structure) details. YAML also strives to be clean and simple: of the data serialization/modeling languages listed here, YAML is easily the easiest to read for anyone new to data models. + +Ansible, one of the topics in Chapter 19, “Understanding Ansible, Puppet, and Chef,” makes extensive use of YAML files. Example 18-5 shows a brief sample. And to make the point about readability, even if you have no idea what Ansible does, you can guess at some of the functions just reading the file. (Note that YAML denotes variables in double curly brackets: {{ }}.) +Example 18-5 YML File Used by Ansible + +--- +# This comment line is a place to document this Playbook +- name: Get IOS Facts +hosts: mylab +vars: +cli: +host: "{{ ansible_host }}" +username: "{{ username }}" +password: "{{ password }}" + +tasks: +- ios_facts: +gather_subset: all +provider: "{{ cli }}" +Chapter 18: Understanding REST and JSON 423 + +Summary of Data Serialization +As an easy reference, Table 18-3 summarizes the data serialization languages mentioned in this section, along with some key facts. + +Table 18-3 Comparing Data Modeling Languages +Acronym Name Origin/Definition Central Purpose Common Use + +JSON JavaScript Object Notation + +JavaScript (JS) language; RFC 8259 + +General data REST APIs modeling and +serialization + + + +XML eXtensible World Wide Web Data-focused text Markup Language Consortium (W3C.org) markup that allows +data modeling + +REST APIs, Web pages + + + +YAML YAML Ain’t YAML.org Markup Language + +General data Ansible modeling + + +Interpreting JSON 18 Cisco includes one exam topic in the current CCNA 200-301 blueprint that mentions JSON: + +6.7 Interpret JSON encoded data +You can think of that skill and task with two major branches. First, even ignoring the syntax and special characters, anyone who knows the topic can probably make intelligent guesses about the meaning of many of the key:value pairs. For example, without knowing anything about JSON syntax, you could probably determine from your prior knowledge of Cisco routers and switches that the JSON in Example 18-6 lists two devices (maybe their host-names) and a list of interfaces on each device. +Example 18-6 Simple JSON That Lists a Router’s Interfaces + +{ +"R1": ["GigabitEthernet0/0", "GigabitEthernet0/1", "GigabitEthernet0/2/0"], +"R2": ["GigabitEthernet1/0", "GigabitEthernet1/1", "GigabitEthernet0/3/0"] +} + +Honestly, you probably already know everything needed to do this kind of intelligent guessing. However, to perform the second type of task, where you analyze the JSON data to find the data structures, including objects, lists, and key:value pairs, you need to know a bit more about JSON syntax. This final topic in the chapter gives you the basic rules, with some advice on how to break down JSON data. + +Interpreting JSON Key:Value Pairs +First, consider these rules about key:value pairs in JSON, which you can think of as indi-vidual variable names and their values: + +■ Key:Value Pair: Each and every colon identifies one key:value pair, with the key before the colon and the value after the colon. +■ Key: Text, inside double quotes, before the colon, used as the name that references a value. +424 CCNA 200-301 Official Cert Guide, Volume 2 + +■ Value: The item after the colon that represents the value of the key, which can be ■ Text: Listed in double quotes. +■ Numeric: Listed without quotes. +■ Array: A special value (more details later). ■ Object: A special value (more details later) +■ Multiple Pairs: When listing multiple key:value pairs, separate the pairs with a comma at the end of each pair (except the last pair). + +To work through some of these rules, consider Example 18-7’s JSON data, focusing on the three key:value pairs. The text after the example will analyze the example. +Example 18-7 One JSON Object (Dictionary) with Three Key:Value Pairs + +{ +"1stbest": "Messi", +"2ndbest": "Ronaldo", +"3rdbest": "Pele" +} + +As an approach, just find each colon, and look for the quoted string just before each colon. Those are the keys (“1stbest”, “2ndbest”, and “3rdbest”.) Then look to the right of each colon to find their matching values. You can know all three values are text values because JSON lists the values within double quotes. + +As for other special characters, note the commas and the curly brackets. The first two key:value pairs end with a comma, meaning that another key:value pair should follow. The curly brackets that begin and end the JSON data denote a single JSON object (one pair of curly brackets, so one object). JSON files, and JSON data exchanged over an API, exist first as a JSON object, with an opening (left) and closing (right) curly bracket as shown. + +Interpreting JSON Objects and Arrays +To communicate data structures beyond a key:value pair with a simple value, JSON uses JSON objects and JSON arrays. Objects can be somewhat flexible, but in most uses, they act like a dictionary. Arrays list a series of values. + +NOTE Python, the most common language to use for network automation, converts JSON objects to Python dictionaries, and JSON arrays to Python lists. For general conversation, many people refer to the JSON structures as dictionaries and lists rather than as objects and arrays. + +To begin, consider this set of rules about how to interpret the syntax for JSON objects and arrays: +■ { } - Object: A series of key:value pairs enclosed in a matched pair of curly brackets, with an opening left curly bracket and its matching right curly bracket. +■ [ ] - Array: A series of values (not key:value pairs) enclosed in a matched pair of square brackets, with an opening left square bracket and its matching right square bracket. +Chapter 18: Understanding REST and JSON 425 + +■ Key:value pairs inside objects: All key:value pairs inside an object conform to the earlier rules for key:value pairs. +■ Values inside arrays: All values conform to the earlier rules for formatting values (for example, double quotes around text, no quotes around numbers). + +Example 18-8 shows a single array in JSON format. Notice the JSON data begins with a [ and then lists three text values (the values could have been a mix of values). It then ends with a ]. +Example 18-8 A JSON Snippet Showing a Single JSON Array (List) + +[ +"Messi", +"Ronaldo", +"Dybala" +] + +While Example 18-8 shows only the array itself, JSON arrays can be used as a value in any 18 key:value pair. Figure 18-12 does just that, shown in a graphic to allow easier highlighting of +the arrays and object. The JSON text in the figure includes two arrays (lists) as values (each found just after a colon, indicating they are values). + +JSON Object with Two Key:Value Pairs + + + +{ +"favorite_players": [ "Messi", "Ronaldo", "Dybala" +], "favorite_teams": [ +"Barcelona", "Juventus", "Dortmund" +] } + + +JSON Array “favorite_players” with 3 Values + + +JSON Array “favorite_teams” with 3 Values + +Figure 18-12 Accurate/Complete JSON Data with One Object, Two Keys, Two JSON List Values + +Now think about the entire structure of the JSON data in Figure 18-12. It has a matched pair of curly brackets to begin and end the text, encapsulating one object. That object con-tains two colons, so there are two key:value pairs inside the object. When you think about the broader structure, as depicted in Figure 18-13, this JSON file has one JSON object, itself with two key:value pairs. (Note that Figure 18-13 does NOT show correct JSON syntax for the lists; it instead is intended to make sure you see the structure of the one object and its two key:value pairs.) +426 CCNA 200-301 Official Cert Guide, Volume 2 + +JSON Object + +{ +"favorite_players": [...], + +"favorite_teams": [...] } + + +Key:Value + +Key:Value + + +Figure 18-13 Structural Representation of Figure 18-13’s Primary Object and Two Key:Value Pairs + +To drive home the idea of how to find JSON objects, consider the example shown in Figure 18-14. This figure shows correct JSON syntax. It has the following: + +■ There is one object for the entire set because it begins and ends with curly braces. ■ The outer object has two keys (Wendells_favorites and interface_config). +■ The value of each key:value pair is another object (each with curly braces and three key:value pairs). + +JSON Object with Two Key:Value Pairs + + + +{ +"Wendells_favorites": { "player": "Messi", "team": "Barcelona", "league": "La Liga" +}, "interface_config": { +"ip_address": "10.1.1.1", "ip_mask": "255.255.255.0", "speed": 1000 +} } + + +Key:Value Pair “Wendells_favorites” Value: An Object + + +Key:Value Pair “interface_config” Value: An Object + +Figure 18-14 A JSON Object, with Two Key:Value Pairs, Each Value Another Object + +The JSON example in Figure 18-14 shows how JSON can nest objects and arrays; that is, JSON puts one object or array inside another. Much of the JSON output you will see as you learn more and more about network automation will include JSON data with nested arrays and objects. + +Minified and Beautified JSON +So far, all the JSON examples show lots of empty space. JSON allows for whitespace, or not, depending on your needs. For humans, reading JSON can be a lot easier with the text orga-nized with space and aligned. For instance, having the matched opening and closing brackets sit at the same left-offset makes it much easier to find which brackets go with which. + +When stored in a file or sent in a network, JSON does not use whitespace. For instance, ear-lier in this section, Example 18-7 showed one JSON object with three key:value pairs, with +Chapter 18: Understanding REST and JSON 427 + +whitespace, taking five lines. However, stored in a file, or sent over a network, the JSON would look like the following: + +{"1stbest": "Messi", "2ndbest": "Ronaldo", "3rdbest": "Pele"} + +Most of the tools you might use when working with JSON will let you toggle from a pretty format (good for humans) to a raw format (good for computers). You might see the pretty version literally called pretty, or beautified, or spaced, while the version with no extra whitespace might be called minified or raw. + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same mate-rial found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 18-4 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the second column. + + + + + + +18 + + +Table 18-4 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Answer DIKTA questions Review memory tables +Practice Editing JSON + +Resource Used Book, website Book, website Book, PTP Website +Website + + +Review All the Key Topics + +Table 18-5 +Key Topic Element +List List +Table 18-2 +Figure 18-8 + +Key Topics for Chapter 18 +Description Page Number +Attributes of REST APIs 409 The meaning of the CRUD acronym 413 A comparison of CRUD actions and HTTP verbs 414 +Components of a URI 416 + + + +Figure 18-11 Table 18-3 List +List + +The process of sending JSON data over a REST API 420 A comparison of JSON, XML, and YAML 423 JSON rules related to key:value pairs 423 +JSON rules for arrays and objects 424 + + +Key Terms You Should Know +REpresentational State Transfer (REST), REST API, stateless, cacheable, CRUD, list variable, dictionary variable, URI path (resource), URI query (parameters), key:value pair, data serial-ization language, JSON (JavaScript Object Notation), XML (eXtensible Markup Language), YAML (YAML Ain’t Markup Language), JSON object, JSON array +CHAPTER 19 + + + +Understanding Ansible, Puppet, and Chef + +This chapter covers the following exam topics: + +6.0 Automation and Programmability +6.6 Recognize the capabilities of configuration mechanisms Puppet, Chef, and Ansible + + +By now, you have seen how to use the IOS CLI to configure routers and switches. To configure using the CLI, you get into configuration mode, issue configuration commands (which change the running-config file), and eventually leave configuration mode. If you decide to keep those changes, you save the configuration to the startup-config file using the copy running-config startup-config command . Next time the router or switch boots, the device loads the startup-config file into RAM as the running-config. Simple enough. + +This chapter discusses tools for configuration management that replaces that per-device configuration process. To even imagine what these tools do first requires you to make a leap of imagination to the everyday world of a network engineer at a medium to large +enterprise. In a real working network, managing the configuration of the many networking devices creates challenges. Those challenges can be addressed using that same old “use con-figuration mode on each device” process, plus with hard work, attention to detail, and good operational practices. However, that manual per-device process becomes more and more difficult for a variety of reasons, so at some point, enterprises turn to automated configura-tion management tools to provide better results. + +The first section of this chapter takes a generalized look at the issues of configuration man-agement at scale along with some of the solutions to those problems. The second major section then details each of three configuration management tools—Ansible, Puppet, and Chef—to define some of the features and terms used with each. By the end of the chapter, you should be able to see some of the reasons why these automated configuration manage-ment tools have a role in modern networks and enough context to understand as you pick one to investigate for further reading. + +“Do I Know This Already?” Quiz +Take the quiz (either here or use the PTP software) if you want to use the score to help you decide how much time to spend on this chapter. The letter answers are listed at the bottom of the page following the quiz. Appendix C, found both at the end of the book as well as on the companion website, includes both the answers and explanations. You can also find both answers and explanations in the PTP testing software. + + + + +Table 19-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + +Foundation Topics Section +Device Configuration Challenges and Solutions +Ansible, Puppet, and Chef Basics + +Questions 1–3 +4, 5 + + +1. Which answer best describes the meaning of the term configuration drift? +a. Changes to a single device’s configuration over time versus that single device’s original configuration +b. Larger and larger sections of unnecessary configuration in a device +c. Changes to a single device’s configuration over time versus other devices that have the same role +d. Differences in device configuration versus a centralized backup copy + +2. An enterprise moves away from manual configuration methods, making changes by editing centralized configuration files. Which answers list an issue solved by using a version control system with those centralized files? (Choose two answers.) +a. The ability to find which engineer changed the central configuration file on a date/time +b. The ability to find the details of what changed in the configuration file over time c. The ability to use a template with per-device variables to create configurations d. The ability to recognize configuration drift in a device and notify the staff +3. Configuration monitoring (also called configuration enforcement) by a configuration management tool generally solves which problem? +a. Tracking the identity of individuals who changed files, along with which files they changed +b. Listing differences between a former and current configuration +c. Testing a configuration change to determine whether it will be rejected or not when implemented +d. Finding instances of configuration drift + +4. Which of the following configuration management tools uses a push model to config-ure network devices? +a. Ansible b. Puppet c. Chef +d. None use a push model +430 CCNA 200-301 Official Cert Guide, Volume 2 + +5. Which of the following answers list a correct combination of configuration manage-ment tool and the term used for one of its primary configuration files? (Choose two answers.) +a. Ansible manifest b. Puppet manifest c. Chef recipe +d. Ansible recipe + + +Foundation Topics + +Device Configuration Challenges and Solutions +Think about any production network. What defines the exact intended configuration of each device in a production network? Is it the running-config as it exists right now or the startup-config before any recent changes were made or the startup-config from last month? Could one engineer change the device configuration so that it drifts away from that ideal, with the rest of the staff not knowing? What process, if any, might discover the configura-tion drift? And even with changes agreed upon by all, how do you know who changed the configuration, when, and specifically what changed? + +Traditionally, CCNA teaches us how to configure one device using the configure terminal command to reach configuration mode, which changes the running-config file, and how to save that running-config file to the startup-config file. That manual process provides no means to answer any of the legitimate questions posed in the first paragraph; however, for many enterprises, those questions (and others) need answers, both consistent and accurate. + +Not every company reaches the size to want to do something more with configuration management. Companies with one network engineer might do well enough managing device configurations, especially if the network device configurations do not change often. However, as a company moves to multiple network engineers and grows the numbers of devices and types of devices, with higher rates of configuration change, manual configura-tion management has problems. + +This section begins by discussing a few of these kinds of configuration management issues so that you begin to understand why enterprises need more than good people and good practices to deal with device configuration. The rest of the section then details some of the features you can find in automated configuration management tools. + +Configuration Drift +Consider the story of an enterprise of a size to need two network engineers, Alice and Bob. They both have experience and work well together. But the network configurations have grown beyond what any one person can know from memory, and with two network engi-neers, they may remember different details or even disagree on occasion. + +One night at 1 a.m., Bob gets a call about an issue. He gets into the network from his lap-top and resolves the problem with a small configuration change to branch office router BR22. Alice, the senior engineer, gets a different 4 a.m. call about another issue and makes a change to branch office router BR33. +Chapter 19: Understanding Ansible, Puppet, and Chef 431 + +The next day gets busy, and neither Alice nor Bob mentions the changes they made. They both follow procedures and document the changes in their change management system, which lists the details of every change. But they both get busy, the topic never comes up, and neither mentions the changes to each for months. + +The story shows how configuration drift can occur—an effect in which the configuration drifts away from the intended configuration over time. Alice and Bob probably agree to what a standard branch office router configuration ought to look like, but they both made an exception to that configuration to fix a problem, causing configuration drift. Figure 19-1 shows the basic idea, with those two branch routers now with slightly different configura-tions than the other branch routers. + + +BR22 Unique + + +5RXWHUV· running-config + + + + + +Figure 19-1 + + +BR33 Unique + +19 +Other Branches Consistent + +Configuration Drift in Branch Routers BR22 and BR33 + + +Configuration drift becomes a much bigger problem if using only traditional manual con-figuration tools. For instance: + +■ The on-device manual configuration process does not track change history: which lines changed, what changed on each line, what old configuration was removed, who changed the configuration, when each change was made. +■ External systems used by good systems management processes, like trouble ticketing and change management software, may record details. However, those sit outside the con-figuration and require analysis to figure out what changed. They also rely on humans to follow the operational processes consistently and correctly; otherwise, an engineer can-not find the entire history of changes to a configuration. +■ Referring to historical data in change management systems works poorly if a device has gone through multiple configuration changes over a period of time. + +Centralized Configuration Files and Version Control +The manual per-device configuration model makes great sense for one person managing one device. With that model, the one network engineer can use the on-device startup-config as the intended ideal configuration. If a change is needed, the engineer gets into configuration mode and updates the running-config until happy with the change. Then the engineer saves a copy to startup-config as the now-current ideal config for the device. + +The per-device manual configuration model does not work as well for larger networks, with hundreds or even thousands of network devices, with multiple network engineers. For instance, if the team thinks of the startup-config of each device as the ideal configuration, if one team member changes the configuration (like Alice and Bob each did in the earlier +432 CCNA 200-301 Official Cert Guide, Volume 2 + +story), no records exist about the change. The config file does not show what changed, when it changed, or who changed it, and the process does not notify the entire team about the change. + +As a first step toward better configuration management, many medium to large enterprises store configurations in a central location. At first, storing files centrally may be a simple effort to keep backup copies of each device’s configuration. They would, of course, place the files in a shared folder accessible to the entire network team, as shown in Figure 19-2. + + +BR21 BR21.txt + +BR22.txt Alice + +BR22 BR23.txt +. Bob . +. BR23 +Chris + +Folder +Figure 19-2 Copying Device Configurations to a Central Location + +Which configuration file is the single source of truth in this model? The configuration files still exist on each device, but now they also exist on a centralized server, and engineers could change the on-device configuration as well as the text files on the server. For instance, if the copy of BR21’s configuration on the device differs from the file on the centralized server, which should be considered as correct, ideal, the truth about what the team intends for this device? + +In practice, companies take both approaches. In some cases, companies continue to use the on-device configuration files as the source of truth, with the centralized configuration +files treated as backup copies in case the device fails and must be replaced. However, other enterprises make the transition to treat the files on the server as the single source of truth about each device’s configuration. When using the centralized file as the source of truth, the engineers can take advantage of many configuration management tools and actually manage the configurations more easily and with more accuracy. +For example, configuration management tools use version control software to track the changes to centralized configuration files, noting who changes a file, what lines and specific characters changed, when the change occurred, and so on. The tools also allow you to com-pare the differences between versions of the files over time, as shown in Figure 19-3. + + + + + + +Answers to the “Do I Know This Already?” quiz: 1 C 2 A, B 3 D 4 A 5 B, C +Chapter 19: Understanding Ansible, Puppet, and Chef 433 + + + + + + + + + + + +Lines with Removals + +Lines with Additions + +Figure 19-3 Showing File Differences in GitHub + + +The figure shows a sample of a comparison between two versions of a configuration file. The upper two highlighted lines, with the minus signs, show the lines that were changed, while the two lower highlighted lines, with the plus signs, show the new versions of each line. + +Version control software solves many of the problems with the lack of change tracking within the devices themselves. Figure 19-3 shows output from a popular software-as-a-service site called GitHub (www.github.com). GitHub offers free and paid accounts, and it uses open-source software (Git) to perform the version control functions. + +Configuration Monitoring and Enforcement +With a version control system and a convention of storing the configuration files in a central location, a network team can do a much better job of tracking changes and answer-ing the who, what, and when of knowing what changed in every device’s configuration. However, using that model then introduces other challenges—challenges that can be best solved by also using an automated configuration management tool. + +With this new model, engineers should make changes by editing the associated configuration files in the centralized repository. The configuration management tool can then be directed to copy or apply the configuration to the device, as shown in Figure 19-4. After that process completes, the central config file and the device’s running-config (and startup-config) should be identical. + + + +19 + + +Edits 1 + + +BR21 + +BR21 +2 Apply Ideal 3 +copy run start +Figure 19-4 Pushing Centralized Configuration to a Remote Device +434 CCNA 200-301 Official Cert Guide, Volume 2 + +Using the model shown in Figure 19-4 still has dangers. For instance, the network engineers should make changes by using the configuration management tools, but they still have the ability to log in to each device and make manual changes on each device. So, while the +idea of using a configuration management tool with a centralized repository of config files sounds appealing, eventually someone will change the devices directly. Former correct con-figuration changes might be overwritten, and made incorrect, by future changes. In other words, eventually, some configuration drift can occur. + +Configuration management tools can monitor device configurations to discover when the device configuration differs from the intended ideal configuration, and then either recon-figure the device or notify the network engineering staff to make the change. This feature might be called configuration monitoring or configuration enforcement, particularly if the tool automatically changes the device configuration. + +Figure 19-5 shows the general idea behind configuration monitoring. The automated config-uration management software asks for a copy of the device’s running-config file, as shown in steps 1 and 2. At step 3, the config management software compares the ideal config file with the just-arrived running-config file to check whether they have any differences (config-uration drift). Per the configuration of the tool, it either fixes the configuration or notifies the staff about the configuration drift. + + + + + +running-config + +1 show run + +2 + + +Running-config (copy) + + +Router BR21 3 compare + + +BR21 Ideal + +Config Management Figure 19-5 Configuration Monitoring +Configuration Provisioning +Configuration provisioning refers to how to provision or deploy changes to the configura-tion once made by changing files in the configuration management system. As one of the primary functions of a configuration management tool, you would likely see features like these: + +■ The core function to implement configuration changes in one device after someone has edited the device’s centralized configuration file +■ The ability to choose which subset of devices to configure: all devices, types with a given attribute (such as those of a particular role), or just one device, based on attributes and logic +Chapter 19: Understanding Ansible, Puppet, and Chef 435 + +■ The ability to determine if each change was accepted or rejected, and to use logic to react differently in each case depending on the result +■ For each change, the ability to revert to the original configuration if even one configura-tion command is rejected on a device +■ The ability to validate the change now (without actually making the change) to determine whether the change will work or not when attempted +■ The ability to check the configuration after the process completes to confirm that the configuration management tool’s intended configuration does match the device’s configuration +■ The ability to use logic to choose whether to save the running-config to startup-config or not +■ The ability to represent configuration files as templates and variables so that devices with similar roles can use the same template but with different values +■ The ability to store the logic steps in a file, scheduled to execute, so that the changes can be implemented by the automation tool without the engineer being present + + +The list could go further, but these features outline some of the major features included in all of the configuration management tools discussed in this chapter. Most of the items in the list revolve around editing the central configuration file for a device. However, the tools have many more features, so you have more work to do to plan and implement how they work. The next few pages focus on giving a few more details about the last two items in the list. + +Configuration Templates and Variables +Think about the roles filled by networking devices in an enterprise. Focusing on routers for a moment, routers often connect to both the WAN and one or more LANs. You might have a small number of larger routers connected to the WAN at large sites, with enough power to handle larger packet rates. Smaller sites, like branch offices, might have small routers, maybe with a single WAN interface and a single LAN interface; however, you might have a large number of those small branch routers in the network. + +For any set of devices in the same role, the configurations are likely similar. For instance, a set of branch office routers might all have the exact same configuration for some IP ser-vices, like NTP or SNMP. If using OSPF interface configuration, routers in the same OSPF area and with identical interface IDs could have identical OSPF configuration. + +For instance, Example 19-1 shows a configuration excerpt from a branch router, with the unique parts of the configuration highlighted. All the unhighlighted portions could be the same on all the other branch office routers of the same model (with the same interface num-bers). An enterprise might have dozens or hundreds of branch routers with nearly identical configuration. + + + +19 + +Example 19-1 Router BR1 Configuration, with Unique Values Highlighted + +hostname BR1 +! +interface GigabitEthernet0/0 +ip address 10.1.1.1 255.255.255.0 +ip ospf 1 area 11 +436 CCNA 200-301 Official Cert Guide, Volume 2 + +! +interface GigabitEthernet0/1 +! +interface GigabitEthernet0/1/0 +ip address 10.1.12.1 255.255.255.0 +ip ospf 1 area 11 +! +router ospf 1 +router-id 1.1.1.1 + +Configuration management tools can separate the components of a configuration into the parts in common to all devices in that role (the template) versus the parts unique to any one device (the variables). Engineers can then edit the standard template file for a device role as a separate file than each device’s variable file. The configuration management tool can then process the template and variables to create the ideal configuration file for each device, as shown in Figure 19-6, which shows the configuration files being built for branch routers BR21, BR22, and BR23. + + +1 +BR21 BR21 +Ideal Variables + + +2 +BR22 BR22 +Ideal Variables + + +3 +BR23 BR23 +Ideal Variables + +1 + + + +2 +Template: +Branch Router + + +3 + + +Figure 19-6 Concept: Configuration Templates and Variables + +To give a little more insight, Example 19-2 shows a template file that could be used by Ansible for the configuration shown in Example 19-1. Each tool specifies what language to use for each type of file, with Ansible using the Jinja2 language for templates. The template mimics the configuration in Example 19-1, except for placing variable names inside sets of double curly brackets. +Example 19-2 Jinja2 Template with Variables Based on Example 19-1 + +hostname {{hostname}} +! +interface GigabitEthernet0/0 +ip address {{address1}} {{mask1}} +ip ospf {{OSPF_PID}} area {{area}} +! +interface GigabitEthernet0/1 +! +interface GigabitEthernet0/1/0 +Chapter 19: Understanding Ansible, Puppet, and Chef 437 + +ip address {{address2}} {{mask2}} +ip ospf {{OSPF_PID}} area {{area}} +! +router ospf {{OSPF_PID}} +router-id {{RID}} + +To supply the values for a device, Ansible calls for defining variable files using YAML, as shown in Example 19-3. The file shows the syntax for defining the variables shown in the complete configuration in Example 19-1, but now defined as variables. +Example 19-3 YAML Variables File Based on Example 19-2 + +--- +hostname: BR1 + +address1: 10.1.1.1 +mask1: 255.255.255.0 +address2: 10.1.12.1 +mask2: 255.255.255.0 +RID: 1.1.1.1 +area: '11' +OSPF_PID: '1' + + + + + + +19 + + +The configuration management system processes a template plus all related variables to pro-duce the intended configuration for a device. For instance, the engineer would create and edit one template file that looks like Example 19-2 and then create and edit one variable file like Example 19-3 for each branch office router. Ansible would process the files to create complete configuration files like the text shown in Example 19-1. + +It might seem like extra work to separate configurations into a template and variables, but using templates has some big advantages. In particular: + +■ Templates increase the focus on having a standard configuration for each device role, helping to avoid snowflakes (uniquely configured devices). +■ New devices with an existing role can be deployed easily by simply copying an existing per-device variable file and changing the values. +■ Templates allow for easier troubleshooting because troubleshooting issues with one stan-dard template should find and fix issues with all devices that use the same template. +■ Tracking the file versions for the template versus the variables files allows for easier troubleshooting as well. Issues with a device can be investigated to find changes in the device’s settings separately from the standard configuration template. + +Files That Control Configuration Automation +Configuration management tools also provide different methods to define logic and pro-cesses that tell the tool what changes to make, to which devices, and when. For instance, an engineer could direct a tool to make changes during a weekend change window. That same logic could specify a subset of the devices. It could also detail steps to verify the change before and after the change is attempted, and how to notify the engineers if an issue occurs. +Interestingly, you can do a lot of the logic without knowing how to program. Each tool uses a language of some kind that engineers use to define the action steps, often a language +438 CCNA 200-301 Official Cert Guide, Volume 2 + +defined by that company (a domain-specific language). But they make the languages to be straightforward, and they are generally mush easier to learn than programming languages. Configuration management tools also enable you to extend the action steps beyond what can be done in the toolset by using a general programming language. Figure 19-7 summa-rizes the files you could see in any of the configuration management tools. + + +Subset +R1 Hosts + + + +R2 Actions + +Program + +SW1 + + +Templates + + + + +SW2 + + +Figure 19-7 + +Variables + +Config Management +Important Files Used by Configuration Management Tools + + +Ansible, Puppet, and Chef Basics +This chapter focuses on one exam topic that asks about the capabilities of three configura-tion management tools: Ansible, Puppet, and Chef. The first major section of the chapter describes the capabilities of all three (and other) configuration management tools. This sec-ond major section examines a few of the features of each tool, focusing on terminology and major capabilities. + +Ansible, Puppet, and Chef are software packages. You can purchase each tool, with varia-tions on which package. However, they all also have different free options that allow you to download and learn about the tools, although you might need to run a Linux guest because some of the tools do not run in a Windows OS. + +As for the names, most people use the words Ansible, Puppet, and Chef to refer to the companies as well as their primary configuration management products. All three emerged as part of the transition from hardware-based servers to virtualized servers, which greatly increased the number of servers and created the need for software automation to create, configure, and remove VMs . All three produce one or more configuration management software products that have become synonymous with their companies in many ways. (This chapter follows that convention, for the most part ignoring exact product names, and refer-ring to products and software simply as Ansible, Puppet, and Chef.) +Next, on to some details about each. + +Ansible +To use Ansible (www.ansible.com), you need to install Ansible on some computer: Mac, Linux, or a Linux VM on a Windows host. You can use the free open-source version or use the paid Ansible Tower server version. +Chapter 19: Understanding Ansible, Puppet, and Chef 439 + +Once it is installed, you create several text files, such as the following: + +■ Playbooks: These files provide actions and logic about what Ansible should do. +■ Inventory: These files provide device hostnames along with information about each device, like device roles, so Ansible can perform functions for subsets of the inventory +■ Templates: Using Jinja2 language, the templates represent a device’s configuration but with variables (see Example 19-2). +■ Variables: Using YAML, a file can list variables that Ansible will substitute into tem-plates (see Example 19-3). + + +As far as how Ansible works for managing network devices, it uses an agentless archi-tecture. That means Ansible does not rely on any code (agent) running on the network device. Instead, Ansible relies on features typical in network devices, namely SSH and/or NETCONF, to make changes and extract information. When using SSH, the Ansible control node actually makes changes to the device like any other SSH user would do, but doing the work with Ansible code, rather than with a human. + +Ansible can be described as using a push model (per Figure 19-8) rather than a pull model (like Puppet and Chef). After installing Ansible, an engineer needs to create and edit all the various Ansible files, including an Ansible playbook. Then the engineer runs the playbook, which tells Ansible to perform the steps. Those steps can include configuring one or more devices per the various files (step 3), with the control node seen as pushing the configura-tion to the device. + + + + + + + + + +19 + + +1 Build files + + +Subset +Inventory Playbook + + +SSH +3 +R1 Push Config + + +2 Run +Playbook Templates + + + + +Variables + + +Ansible Control Node Figure 19-8 Ansible Push Model +As with all the tools, Ansible can do both configuration provisioning (configuring devices after changes are made in the files) and configuration monitoring (checking to find out whether the device config matches the ideal configuration on the control node). However, Ansible’s architecture more naturally fits with configuration provisioning, as seen in the figure. To do configuration monitoring, Ansible uses logic modules that detect and list con-figuration differences, after which the playbook defines what action to take (reconfigure or notify). +440 CCNA 200-301 Official Cert Guide, Volume 2 + +Puppet +To use Puppet (www.puppet.com), like Ansible, begin by installing Puppet on a Linux host. You can install it on your own Linux host, but for production purposes, you will normally install it on a Linux server called a Puppet master. As with Ansible, you can use a free open-source version with paid versions available. You can get started learning Puppet without a separate server for learning and testing. + +Once installed, Puppet also uses several important text files with different components, such as the following: + +■ Manifest: This is a human-readable text file on the Puppet master, using a language defined by Puppet, used to define the desired configuration state of a device. +■ Resource, Class, Module: These terms refer to components of the manifest, with the largest component (module) being composed of smaller classes, which are in turn com-posed of resources. +■ Templates: Using a Puppet domain-specific language, these files allow Puppet to generate manifests (and modules, classes, and resources) by substituting variables into the template. + +One way to think about the differences between Ansible’s versus Puppet’s approach is that Ansible’s playbooks use an imperative language, whereas Puppet uses a declarative language. For instance, with Ansible, the playbook will list tasks and choices based on those results, like “Configure all branch routers in these locations, and if errors occur for any device, +do these extra tasks for that device.” Puppet manifests instead declare the end state that a device should have: “This branch router should have the configuration in this file by the end of the process.” The manifest, built by the engineer, defines the end state, and Puppet has the job to cause the device to have that configuration, without being told the specific set of steps to take. +Puppet typically uses an agent-based architecture for network device support. Some net-work devices enable Puppet support via an on-device agent—think of it as another fea-ture configurable on the device. However, not every Cisco OS supports Puppet agents, so Puppet solves that problem using a proxy agent running on some external host (called agentless operation). The external agent then uses SSH to communicate with the network device, as shown in Figure 19-9. + +Internal Agent + +API Manifest +R1 + + +SSH API +R2 +External +Agent Puppet Master +Figure 19-9 Agent-based and Agentless Operation for Puppet +Chapter 19: Understanding Ansible, Puppet, and Chef 441 + + +NOTE Per Puppet’s website, Puppet supports both an agent-based and agentless architec-ture, with the agentless architecture being the case of using an agent external to the network device, as shown in the lower part of Figure 19-9. + +Armed with a manifest that declares something like “This device should have this configu-ration state,” Puppet uses a pull model to make that configuration appear in the device, as shown in Figure 19-10. Once installed, these steps occur: +Step 1. The engineer creates and edits all the files on the Puppet server. +Step 2. The engineer configures and enables the on-device agent or a proxy agent for each device. +Step 3. The agent pulls manifest details from the server, which tells the agent what its configuration should be. +Step 4. If the agent device’s configuration should be updated, the Puppet agent per-forms additional pulls to get all required detail, with the agent updating the device configuration. + +1 Build files 19 + + + +2 Manifest Start +Agent 3 Pull Details + +R1 Templates 4 Pull Config + + +Variables + + +Puppet Master Figure 19-10 Pull Model with Puppet +Chef +Chef (www.chef.io), as with Ansible and Puppet, exists as software packages you install and run. Chef (the company) offers several products, with Chef Automate being the product that most people refer to simply as Chef. As with Puppet, in production you probably run Chef as a server (called server-client mode), with multiple Chef workstations used by the engineering staff to build Chef files that are stored on the Chef server. However, you can also run Chef in standalone mode (called Chef Zero), which is helpful when you’re just get-ting started and learning in the lab. +442 CCNA 200-301 Official Cert Guide, Volume 2 + +Once Chef is installed, you create several text files with different components, like the following: + +■ Resource: The configuration objects whose state is managed by Chef; for instance, a set of configuration commands for a network device—analogous to the ingredients in a recipe in a cookbook +■ Recipe: The Chef logic applied to resources to determine when, how, and whether to act against the resources—analogous to a recipe in a cookbook +■ Cookbooks: A set of recipes about the same kinds of work, grouped together for easier management and sharing +■ Runlist: An ordered list of recipes that should be run against a given device + +Chef uses an architecture similar to Puppet. For network devices, each managed device (called a Chef node or Chef client) runs an agent. The agent performs configuration moni-toring in that the client pulls recipes and resources from the Chef server and then adjusts its configuration to stay in sync with the details in those recipes and runlists. Note however that Chef requires on-device Chef client code, and many Cisco devices do not support a +Chef client, so you will likely see more use of Ansible and Puppet for Cisco device configu-ration management. + +Summary of Configuration Management Tools +All three of the configuration management tools listed here have a good base of users and different strengths. As for their use for managing network device configuration, Ansible appears to have the most interest, then Puppet, and then Chef. Ansible’s agentless architec-ture and the use of SSH provides support for a wide range of Cisco devices. Puppet’s agent-less model also creates wide support for Cisco devices. + +Table 19-2 summarizes a few of the most common ideas about each of the three automated configuration management tools. Note that the column for Puppet assumes an on-device agent. + +Table 19-2 + +Action + + +Comparing Ansible, Puppet, and Chef + +Ansible Puppet Chef + + + +Term for the file that lists actions Protocol to network device +Uses agent or agentless model +Push or pull model + +Playbook +SSH, NETCONF Agentless +Push + +Manifest HTTP (REST) Agent* +Pull + +Recipe, Runlist HTTP (REST) Agent +Pull + + +* Puppet can use an in-device agent or an external proxy agent for network devices. + + + +Chapter Review + +One key to doing well on the exams is to perform repetitive spaced review sessions. Review this chapter’s material using either the tools in the book or interactive tools for the same material found on the book’s companion website. Refer to the “Your Study Plan” element for more details. Table 19-3 outlines the key review elements and where you can find them. To better track your study progress, record when you completed these activities in the sec-ond column. +Chapter 19: Understanding Ansible, Puppet, and Chef 443 + +Table 19-3 Chapter Review Tracking + +Review Element Review Date(s) Review key topics +Review key terms Repeat DIKTA questions Review memory table +Do DevNet Labs + +Resource Used Book, website Book, website Book, PTP Book, website +DevNet + + +Review All the Key Topics + +Table 19-4 +Key Topic Element +List +Figure 19-3 + +Figure 19-5 +List + +Key Topics for Chapter 19 +Description Page Number +Issues that arise from configuration drift 431 +Sample of showing router configuration file differences with 433 GitHub +Basic configuration monitoring concepts. 434 +Primary functions of a configuration management tool 434 19 + + + +Example 19-2 List +Figure 19-8 Figure 19-10 +Table 19-2 + +Sample Jinja2 Ansible template 436 Advantages of using configuration templates 437 Ansible’s push model and other features 439 Puppet’s pull model and other features 441 +Summary of configuration management features and terms 442 + + +Key Terms You Should Know +configuration monitoring, configuration provisioning, configuration drift, configuration management tool, Git, Ansible, Puppet, Chef, configuration template, push model, pull model, agent-based architecture, agentless architecture, Ansible playbook, Puppet manifest, Chef recipe + +Do DevNet Labs +Cisco’s DevNet site (https://developer.cisco.com)—a free site—includes lab environments and exercises. You can learn a lot about configuration management and Ansible in particular with a few of the lab tracks on the DevNet site (at the time this book was published). Refer to the “Chapter Review” section of the companion website for links to some good labs, or just go to https://developer.cisco.com and search for learning labs about Ansible. +Part V Review + +Keep track of your part review progress with the checklist shown in Table P5-1. Details on each task follow the table. + + +Table P5-1 + +Activity + +Part V Review Checklist + +1st Date Completed 2nd Date Completed + +Repeat All DIKTA Questions + +Answer Part Review Questions + +Review Key Topics + + +Repeat All DIKTA Questions +For this task, use the PTP software to answer the “Do I Know This Already?” questions again for the chapters in this part of the book. + +Answer Part Review Questions +For this task, use PTP to answer the Part Review questions for this part of the book. + +Review Key Topics +Review all key topics in all chapters in this part, either by browsing the chapters or by using the Key Topics application on the companion website. + + + + + + + + +This page intentionally left blank +Part VI + + +Final Review + + + + +Chapter 20: Final Review +CHAPTER 20 + + + +Final Review + +Congratulations! You made it through the book, and now it’s time to finish getting ready for the exam. This chapter helps you get ready to take and pass the exam in two ways. +First, this chapter focuses on the exam event. Now you need to think about what happens during the exam and what you need to do in these last few weeks before taking the exam. At this point, everything you do should be focused on getting ready to pass so that you can finish up this hefty task. + +The second section of this chapter focuses on final content review. You should not just complete the previous chapter, which is the 48th technology chapter in the combined CCNA 200-301 Official Cert Guide, Volume 1 and 2 books. Instead, you need to review, refine, deepen, and assess your skills. This second section of this chapter gives advice and suggestions on how to approach your final weeks of study before you take the CCNA 200-301 exam. + +Advice About the Exam Event +Now that you have finished the bulk of this book, you could just register for your Cisco CCNA exam, show up, and take the exam. However, if you spend a little time thinking about the exam event itself, learning more about the user interface of the real Cisco exams and the environment at the Pearson VUE testing centers, you will be better prepared, par-ticularly if this is your first Cisco exam. + +This first of two major sections in this chapter gives some advice about the Cisco exams and the exam event itself, specifically about + +■ Question types +■ Your time budget +■ A sample time-check method ■ The final week +■ The 24 hours before the exam +■ The final 30 minutes before the exam ■ The hour after the exam + +Exam Event: Learn About Question Types +In the weeks leading up to your exam, you should think more about the different types of exam questions and have a plan for how to approach those questions. One of the best ways to learn about the exam questions is to use some videos from the former Cisco Certification Exam Tutorial. + +As for the backstory, Cisco formerly published a tool (the Cisco Certification Exam Tutorial) that gave anyone the ability to experience the Cisco exam user interface via an + + + + +interactive flash application. Cisco has updated the real exam interface; plus, Cisco removed the exam tutorial web pages with no equivalent replacement. + +However, Cisco did make videos of the exam tutorial, with someone talking through the various question types. Cisco lists the videos in a post at the Cisco Learning Network (https://learningnetwork.cisco.com), so you can start by looking for those videos as follows: + +■ Go to the CLN (https://learningnetwork.cisco.com) and search for the post 34312. +■ Use this direct link to the same page: https://learningnetwork.cisco.com/docs/DOC-34312?dtid=osscdc000283. +■ Use https://blog.certskills.com/final-review, which links to a blog post of mine that lists the above link (as well as other links useful for final review). + +While watching any of the videos about the exam tutorial, pay close attention to some important behaviors. For instance, for multichoice questions, the user interface + +■ Identifies single-answer questions with circles beside the answers versus multiple-answer questions showing squares before the answers. +■ Prevents you from choosing too many answers. +■ Supplies a popup window to tell you if you have selected too few answers if you try to move to the next question, so you can stop and go back and answer with the correct number of answers. +■ Does not penalize you for guessing. You should always supply the number of answers that the question asks for. There is no penalty for guessing. + +Note that because there is no penalty for guessing, you should always answer every ques-tion and answer with the exact number of correct answers. +For drag-and-drop questions, the user interface lets you change your mind while you are still working on the question. The draggable items begin in one location, and you drag and drop them to answer. You can just drag them back to where they were to begin the question. + +For simulation questions: + +■ Pay close attention to the navigation to get to the command-line interface (CLI) on one of the routers. To do so, you have to click the PC icon for a PC connected to the router console; the console cable appears as a dashed line, whereas network cables are solid lines. (You should definitely look for this interaction in the exam tutorial videos.) +■ Make sure that you look at the scroll areas at the top, at the side, and in the terminal emulator window. These scrollbars let you view the entire question and scenario. +■ Make sure that you can toggle between the topology window and the terminal emula-tor window by clicking Show topology and Hide topology. The question window can be pretty crowded for sim questions, so the user interface gives you the means to toggle between seeing different parts of the question. +450 CCNA 200-301 Official Cert Guide, Volume 2 + +Both simlet and testlet questions give you one scenario with a group of related multichoice questions. However, the behavior with this small group (usually three or four) of multiple-choice questions differs from the flow of the more common standalone multiple-choice questions. In particular: + +■ You can move between the multiple-choice questions in a single simlet or testlet. You can answer one multiple-choice question, move to the second and answer it, and then move back to the first question, confirming that inside a testlet you can move around between questions. +■ You can make a big mistake by not answering all questions or by not supplying enough answers, and the user interface does not prevent you from making that mistake. + +On that second point, consider this scenario with a simlet question. You see the simlet ques-tion, answer the first three multichoice questions, but forget to look at the fourth multi-choice question. If you click Next, you will see a generic popup window that Cisco uses as a prompt to ask whether you want to move on. However, it does not tell you that you did not answer a question at all, and it does not tell you if you answered with too few answers on a multi-answer question. So be very careful when clicking Next when answering simlet and testlet questions. + +Exam Event: Think About Your Time Budget +On exam day, you need to keep an eye on your speed. Going too slowly hurts you because you might not have time to answer all the questions. Going too fast can be hurtful if you are rushing because you are fearful about running out of time. So, you need to be able to somehow know whether you are moving quickly enough to answer all the questions, while not rushing. + +The exam user interface shows some useful information, namely a countdown timer and a question counter. The question counter shows a question number for the question you are answering, and it shows the total number of questions on your exam. + +Unfortunately, some questions require lots more time than others, and for this and other reasons, time estimating can be a challenge. + +First, before you show up to take the exam, you know only a range of the number of ques-tions for the exam; for example, the Cisco website might list the CCNA exam as having from 50 to 60 questions (the Cisco website did not list a number of questions at the time this chapter was published). You will not know how many questions are on your exam until the exam begins, when you go through the screens that lead up to the point where you click Start Exam, which starts your timed exam. + +Next, some questions (call them time burners) clearly take a lot more time to answer: + +Normal-time questions: Multiple-choice and drag-and-drop, approximately one minute each +Time burners: Sims, simlets, and testlets, approximately six to eight minutes each + +Finally, even though testlet and simlet questions contain several multiple-choice questions, the exam software counts each testlet and simlet question as one question in the question counter. For example, if a testlet question has four embedded multiple-choice questions, in the exam software’s question counter, that counts as one question. So when you start +Chapter 20: Final Review 451 + +the exam, you might see that you will have 50 questions, but you don’t know how many of those are time burners. + +NOTE Cisco does not tell us why one person taking the exam might get 50 questions while someone else taking the same exam might get 60 questions, but it seems reasonable to think that the person with 50 questions might have a few more of the time burners, making the two exams equivalent. + +You need a plan for how you will check your time, a plan that does not distract you from the exam. You can ponder the facts listed here and come up with your own plan. If you want a little more guidance, the next topic shows one way to check your time that uses some simple math so that it does not take much time away from the test. + +Exam Event: A Sample Time-Check Method +As a suggestion, you can use the following math to do your time-check in a way that weights the time based on those time-burner questions. You do not have to use this meth-od. But this math uses only addition of whole numbers, to keep it simple. It gives you a pretty close time estimate, in my opinion. + +The concept is simple . Just do a simple calculation that estimates the time you should have used so far. Here’s the math: + +Number of questions answered so far + 7 per time burner answered so far +20 Then you check the timer to figure out how much time you have spent: + +■ You have used exactly that much time or a little more time: Your timing is perfect. ■ You have used less time: You are ahead of schedule. +■ You have used noticeably more time: You are behind schedule. + +For example, if you have already finished 17 questions, two of which were time burn- +ers, your time estimate is l7 + 7 + 7 = 31 minutes. If your actual time is also 31 minutes, or maybe 32 or 33 minutes, you are right on schedule. If you have spent less than 31 minutes, you are ahead of schedule. + +So, the math is pretty easy: questions answered, plus 7 per time burner, is the guesstimate of how long you should have taken so far if you are right on time. + +NOTE This math is an estimate; I make no guarantees that the math will be an accurate predictor on every exam. + +Exam Event: One Week Away +I have listed a variety of tips in the next few pages, broken down by timing versus the big exam event. First, this section discusses some items to consider when your exam is about a week away: + +■ Get some earplugs: Testing centers often have some, but if you do not want to chance it, come prepared with your own. (They will not let you bring your own noise-canceling headphones into the room if they follow the rules disallowing any user electronic +452 CCNA 200-301 Official Cert Guide, Volume 2 + +devices in the room, so think low-tech disposable earplugs, or even bring a cotton ball.) The testing center is typically one room within a building of a company that does something else as well, often a training center, and almost certainly you will share the room with other test takers coming and going. So, there are people talking in nearby rooms and other office noises. Earplugs can help. +■ Create an exam-event note-taking plan: Some people like to spend the first minute of the exam writing down some notes for reference, before actually starting the exam. For example, maybe you want to write down the table of magic numbers for finding IPv4 subnet IDs. If you plan to do that, practice making those notes between now and exam day. Before each practice exam, transcribe those lists, just like you expect to do at the real exam. +■ Plan your travel to the testing center: Leave enough time in your schedule so that you will not be rushing to make it just in time. +■ Practice your favorite relaxation techniques for a few minutes before each practice exam: That way you can enter the exa m event and be more relaxed and have more success. + +Exam Event: 24 Hours Before the Exam +After you wake up on the big day, what should you be doing and thinking? Certainly, the better prepared you are, the better chances you have on the exam. But these small tips can help you do your best on exam day: + +■ Rest the night before the exam rather than staying up late to study. Clarity of thought is more important than one extra fact, especially because the exam requires so much ana-lyzing and thinking rather than just remembering facts. +■ Bring as few extra items with you as possible when leaving for the exam center. You may bring personal effects into the building and testing company’s space, but not into the actual room in which you take the exam. So, save a little stress and bring as little extra stuff with you as possible. If you have a safe place to leave briefcases, purses, electron-ics, and so on, leave them there. However, the testing center should have a place to store your things as well. Simply put, the less you bring, the less you have to worry about stor-ing. (For example, I have been asked to remove even my analog wristwatch on more than one occasion.) +■ Plan time in your schedule for the day to not rush to get there and not rush when leaving either. +■ Do not drink a 64-ounce caffeinated drink on the trip to the testing center. After the exam starts, the exam timer will not stop while you go to the restroom. +■ Use any relaxation techniques that you have practiced to help get your mind focused while you wait for the exam . + +Exam Event: The Last 30 Minutes +It’s almost time! Here are a few tips for those last moments. + +■ Ask the testing center personnel for earplugs if you did not bring any—even if you can-not imagine using them. You never know whether using them might help. +■ Ask for extra pens and laminated note sheets. The exam center will give you a laminated sheet and dry erase pen to take notes. (Test center personnel typically do not let you +Chapter 20: Final Review 453 + +bring paper and ink pen into the room, even if supplied by the testing center.) I always ask for a second pen as well. +■ Test your pens and sheets before going into the room to take the exam. Better to get a replacement pen before the clock starts. +■ Grab a few tissues from the box in the room, for two reasons. One, to avoid having to get up in the middle of the exam if you need to sneeze. Two, if you need to erase your laminated sheet, doing that with a tissue rather than your hand helps prevent the oil from your hand making the pen stop working well. +■ Find a restroom to use before going into the testing center, or just ask where one is, to avoid needing to go during the approximately two-hour exam event. Note that the exam timer does not stop if you need to go to the restroom during the exam, and you first have to find the exam center contact before just heading to the restroom, so it can cost you a few minutes. + +Exam Event: Reserve the Hour After the Exam +Some people pass these exams on the first attempt, and some do not. The exams are not easy. If you fail to pass the exam that day, you will likely be disappointed. And that is understandable. But it is not a reason to give up. In fact, I added this short topic to give you a big advantage in case you do fail. + +The most important study hour for your next exam attempt is the hour just after your failed attempt. +Before you take the exam, prepare for how you will react if you do not pass. That is, pre- 20 pare your schedule to give yourself an hour, or at least a half an hour, immediately after the +exam attempt, in case you fail. Follow these suggestions to be ready for taking notes: + +■ Bring pen and paper, preferably a notebook you can write in if you have to write stand-ing up or sitting somewhere inconvenient. +■ Make sure you know where pen and paper are so that you can take notes immediately after the exam. Keep these items in your backpack if using the train or bus, or on your car seat. +■ Install an audio recording app on your phone, and be prepared to start talking into your app when you leave the testing center. +■ Before the exam, scout the testing center, and plan the place where you will sit and take your notes, preferably somewhere quiet. + +Then, once you complete the exam, if you do not pass on this attempt, use the following process when taking notes: + +■ Write down anything in particular that you can recall from any question. +■ Write down details of questions you know you got right as well, because doing so may help trigger a memory of another question. +■ Draw the figures that you can remember. +■ Most importantly, write down any tidbit that might have confused you: terms, configura-tion commands, show commands, scenarios, topology drawings, anything. +■ Take at least three passes at remembering. That is, you will hit a wall where you do not remember more. So, start on your way back to the next place, and then find a place to pause and take more notes. And do it again. +454 CCNA 200-301 Official Cert Guide, Volume 2 + +■ When you have sucked your memory dry, take one more pass while thinking of the major topics in the book, to see if that triggers any other memory of a question. + +Once you have collected your notes, you cannot share the information with anyone because doing so would break the Cisco nondisclosure agreement (NDA). Cisco considers cheating a serious offense and strongly forbids sharing this kind of information publicly. But you can use your information to study for your next attempt. Remember, anything you can do to determine what you do not know is valuable when studying for your next attempt. See the section “Exam Review: Study Suggestions for Your Second Attempt” in this chapter for the rest of the story. + +Exam Review +At this point, you should have read the other chapters in both the CCNA 200-301 Official Cert Guide, Volumes 1 and 2, and completed the Chapter Review and Part Review tasks. Now you need to do the final study and review activities before taking the exam, as detailed in this section. + +This section suggests some new activities and repeats some activities that have been previ-ously mentioned. However, whether the activities are new or old to you, they all focus on filling in your knowledge gaps, finishing off your skills, and completing the study process. While repeating some tasks you did at Chapter Review and Part Review can help, you need to be ready to take an exam, so the Exam Review asks you to spend a lot of time answering exam questions. + +The Exam Review walks you through suggestions for several types of tasks and gives you some tracking tables for each activity. The main categories are + +■ Taking practice exams +■ Finding what you do not know well yet (knowledge gaps) ■ Configuring and verifying functions from the CLI +■ Repeating the Chapter Review and Part Review task s + +Exam Review: Take Practice Exams +One day soon, you need to pass a real Cisco exam at a Pearson VUE testing center. So, it’s time to practice the real event as much as possible. + +A practice exam using the Pearson IT Certification Practice Test (PTP) exam software lets you experience many of the same issues as when taking a real Cisco exam. When you select practice exam mode, the PTP software (both desktop and web) gives you a number of ques-tions, with a countdown timer shown in the window. When using this PTP mode, after you answer a question, you cannot go back to it (yes, that’s true on Cisco exams). If you run out of time, the questions you did not answer count as incorrect. +The process of taking the timed practice exams helps you prepare in three key ways: + +■ To practice the exam event itself, including time pressure, the need to read carefully, and the need to concentrate for long periods +■ To build your analysis and critical thinking skills when examining the network scenario built in to many questions +■ To discover the gaps in your networking knowledge so that you can study those topics before the real exam +Chapter 20: Final Review 455 + +As much as possible, treat the practice exam events as if you were taking the real Cisco exam at a VUE testing center. The following list gives some advice on how to make your practice exam more meaningful, rather than just one more thing to do before exam day rolls around: + +■ Set aside two hours for taking a 90-minute timed practice exam. +■ Make a list of what you expect to do for the 10 minutes before the real exam event. Then visualize yourself doing those things. Before taking each practice exam, practice those final 10 minutes before your exam timer starts. (The earlier section “Exam Event: The Last 30 Minutes” lists some suggestions about what to do in those last 10 minutes.) +■ You cannot bring anything with you into the VUE exam room, so remove all notes and help materials from your work area before taking a practice exam. You can use blank paper, a pen, and your brain only. Do not use calculators, notes, web browsers, or any other app on your computer. +■ Real life can get in the way, but if at all possible, ask anyone around you to leave you alone for the time you will practice. If you must do your practice exam in a distracting environment, wear headphones or earplugs to reduce distractions. +■ Do not guess, hoping to improve your score. Answer only when you have confidence in the answer. Then, if you get the question wrong, you can go back and think more about the question in a later study session. + +Using the Practice CCNA Exams +The PTP questions you can access as part of this book include exam banks labeled as 20 +follows: + +■ CCNA Volume 2 Exam 1 ■ CCNA Volume 2 Exam 2 +■ CCNA 200-301 Full Exam 1 ■ CCNA 200-301 Full Exam 2 + +The exams whose names begin “CCNA Volume 2” have questions from this Volume 2 book only, but no questions from Volume 1. The exams titled “CCNA 200-301” (without Volume 2 in the name) include questions from the entire breadth of CCNA topics, including topics covered in both the Volume 1 and Volume 2 books. + +You should do your final review with the CCNA 200-301 exams. Just select those exams and deselect the others. Then you simply need to choose the Practice Exam option in the upper right and start the exam. + +You should plan to take between one and three practice exams with the supplied CCNA exam databases. Even people who are already well prepared should do at least one practice exam, just to experience the time pressure and the need for prolonged concentration. + +Table 20-1 gives you a checklist to record your different practice exam events. Note that recording both the date and the score is helpful for some other work you will do, so note both. Also, in the Time Notes section, if you finish on time, note how much extra time you had; if you run out of time, note how many questions you did not have time to answer. +456 CCNA 200-301 Official Cert Guide, Volume 2 + +Table 20-1 CCNA Practice Exam Checklist +Exam Date Score Time Notes +CCNA + +CCNA + +CCNA + + +Exam Review: Advice on How to Answer Exam Questions +Our everyday habits have changed how we all read and think in front of a screen. Unfortunately, those same habits often hurt our scores when taking computer-based exams . + +For example, open a web browser. Yes, take a break and open a web browser on any device. Do a quick search on a fun topic. Then, before you click a link, get ready to think about what you just did. Where did your eyes go for the first 5 to 10 seconds after you opened that web page. Now, click a link and look at the page. Where did your eyes go? + +Interestingly, web browsers and the content in web pages have trained us all to scan. Web page designers actually design content expecting certain scan patterns from viewers. +Regardless of the pattern, when reading a web page, almost no one reads sequentially, and no one reads entire sentences. People scan for the interesting graphics and the big words, and then scan the space around those noticeable items. +Other parts of our electronic culture have also changed how the average person reads. For example, many of you grew up using texting and social media, sifting through hundreds or thousands of messages—but each message barely fills an entire sentence. Also, we find +ourselves responding to texts, tweets, and emails and later realizing we did not really under-stand what the other person meant. + +If you use those same habits when taking the exam, you will probably make some mistakes because you missed a key fact in the question, answer, or exhibits. It helps to start at the beginning and read all the words—a process that is amazingly unnatural for many people today. + +NOTE I have talked to many college professors, in multiple disciplines, and Cisco Networking Academy instructors, and they consistently tell me that the number-one test-taking issue today is that people do not read the questions well enough to understand the details. + +When you are taking the practice exams and answering individual questions, consider these two strategies. First, before the practice exam, think about your own personal strategy for how you will read a question. Make your approach to multiple-choice questions in particu-lar be a conscious decision on your part. Second, if you want some suggestions on how to read an exam question, use the following strategy: +Step 1. Read the question itself, thoroughly, from start to finish. Step 2. Scan any exhibit or figure. +Chapter 20: Final Review 457 + +Step 3. Scan the answers to look for the types of information. (Numeric? Terms? Single words? Phrases?) +Step 4. Reread the question thoroughly, from start to finish, to make sure that you understand it. +Step 5. Read each answer thoroughly, while referring to the figure/exhibit as needed. After reading each answer, before reading the next answer: +A. If correct, select as correct. +B. If for sure incorrect, mentally rule it out. +C. If unsure, mentally note it as a possible correct answer. + +NOTE Cisco exams will tell you the number of correct answers. The exam software also helps you finish the question with the right number of answers noted. For example, for standalone multichoice questions , the software prevents you from selecting too many or too few answers. And you should guess the answer when unsure on the actual exam; there is no penalty for guessing. + +Use the practice exams as a place to practice your approach to reading. Every time you click to the next question, try to read the question following your approach. If you are feeling time pressure, that is the perfect time to keep practicing your approach, to reduce and elim-inate questions you miss because of scanning the question instead of reading thoroughly. + +Exam Review: Additional Exams with the Premium Edition 20 Many people add other practice exams and questions other than those that come with this +book. Frankly, using other practice exams in addition to the questions that come with this book can be a good idea, for many reasons. The other exam questions can use different terms in different ways, emphasize different topics, and show different scenarios that make you rethink some topics. +Note that Cisco Press does sell products that include additional test questions. The CCNA 200-301 Official Cert Guide, Volume 2, Premium Edition eBook and Practice Test prod-uct is basically the publisher’s eBook version of this book. It includes a soft copy of the book in formats you can read on your computer and on the most common book readers and tablets. The product includes all the electronic content you would normally get with the print book, including all the question databases mentioned in this chapter. Additionally, this product includes two more CCNA exam databases (plus two more CCNA Volume 2 exam databases as well). + +NOTE In addition to providing the extra questions, the Premium Editions have links to every test question, including those in the print book, to the specific section of the book for further reference. This is a great learning tool if you need more detail than what you find in the question explanations. You can purchase the eBooks and additional practice exams at 70 percent off the list price using the coupon on the back of the activation code card in the cardboard sleeve, making the Premium Editions the best and most cost-efficient way to get more practice questions. +458 CCNA 200-301 Official Cert Guide, Volume 2 + +Exam Review: Find Knowledge Gaps +One of the hardest things when doing your final exam preparation is to discover gaps in your knowledge and skills. In other words, what topics and skills do you need to know that you do not know? Or what topics do you think you know, but you misunderstand about some important fact? Finding gaps in your knowledge at this late stage requires more than just your gut feeling about your strengths and weaknesses. + +This next task uses a feature of PTP to help you find those gaps. The PTP software tracks each practice exam you take, remembering your answer for every question and whether you got it wrong. You can view the results and move back and forth between seeing the ques-tion and seeing the results page. To find gaps in your knowledge, follow these steps: +Step 1. Pick and review one of your practice exams. +Step 2. Review each incorrect question until you are satisfied that you understand the question. +Step 3. When finished with your review for a question, mark the question. Step 4. Review all incorrect questions from your exam until all are marked. Step 5. Move on to the next practice exam. + +Figure 20-1 shows a sample Question Review page, in which all the questions were answered incorrectly. The results list a Correct column, with no check mark, meaning that the answer was incorrect. + + + + + + + + + + + + + + + + + + + + + +Figure 20-1 PTP Grading Results Page + +To perform the process of reviewing questions and marking them as complete, you can move between this Question Review page and the individual questions. Just double-click a question to move back to that question. From the question, you can click Grade Exam to +Chapter 20: Final Review 459 + +move back to the grading results and to the Question Review page shown in Figure 20-1. The question window also shows the place to mark the question, in the upper left, as shown in Figure 20-2. + + + + + + + + + + + + + + + + + + + +20 + +Figure 20-2 Reviewing a Question, with the Mark Feature in the Upper Left + +If you want to come back later to look through the questions you missed from an earlier exam, start at the PTP home screen. From there, instead of clicking the Start button to start a new exam, click the View Grade History button to see your earlier exam attempts and work through any missed questions. + +Track your progress through your gap review in Table 20-2. PTP lists your previous practice exams by date and score, so it helps to note those values in the table for comparison to the PTP menu. + +Table 20-2 Tracking Checklist for Gap Review of Practice Exams + +Original Practice Exam Original Exam Score Date + +Date Gap Review Was Completed +460 CCNA 200-301 Official Cert Guide, Volume 2 + +Exam Review: Practice Hands-On CLI Skills +To do well on sim and simlet questions, you need to be comfortable with many Cisco rout-er and switch commands, and how to use them from a Cisco CLI. As described in the intro-duction to this book, sim questions require you to decide what configuration commands need to be configured to fix a problem or to complete a working configuration. Simlet questions require you to answer multiple-choice questions by first using the CLI to issue show commands to look at the status of routers and switches in a small network. + +To be ready for the exam, you need to know the following kinds of information: + +CLI navigation: Basic CLI mechanics of moving into and out of user, enable, and configu-ration modes +Individual configuration: The meaning of the parameters of each configuration command +Feature configuration: The set of configuration commands, both required and optional, for each feature +Verification of configuration: The show commands that directly identify the configura-tion settings +Verification of status: The show commands that list current status values and the abil-ity to decide incorrect configuration or other problem causes of less-than-optimal status values + +To help remember and review all this knowledge and skill, you can do the tasks listed in the next several pages. + +CCNA Exam Topics with CLI Skill Requirements +Wondering about all the topics in CCNA 200-301 that specifically include configuration or verification skills? You can just scan the CCNA 200-301 exam topics. However, Table 20-3 and Table 20-4 summarize the topics for which you could consider practicing your CLI skills. The tables organize the topics into the same order used in the CCNA 200-301 Official Cert Guides, Volume 1 and 2, with chapter references. + + +Table 20-3 Topic + +Switch IPv4 + +Topics with Configuration Skills in CCNA Volume 1 Volume 1 Chapter + +6 + + +Date You Finished Lab Review + +Verifying LAN switching 5 Switch IPv4 6 Switch passwords 6 Switch interfaces 7 VLANs 8 VLAN trunking 8 STP and RSTP 10 Layer 2 EtherChannel 10 Router interfaces 15 Router IPv4 addresses and static routes 16 +Chapter 20: Final Review 461 + + +Topic + +Router on a Stick +Layer 3 switching with SVIs +Layer 3 switching with routed interfaces and L3 EtherChannels +OSPF fundamentals OSPF network types +IPv6 addressing on routers +IPv6 static routes + +Volume 1 Chapter + +17 17 17 + +20 21 24 +25 + +Date You Finished Lab Review + + +Table 20-4 Topics with Configuration Skills in CCNA Volume 2 + +Topic +Standard ACLs Extended ACLs +Telnet and SSH Access ACLs Port Security +DHCP client and DHCP relay DHCP snooping +Dynamic ARP Inspection Syslog, NTP, CDP, and LLDP +NAT, PAT + +Volume 2 Chapter Date You Finished Lab Review +2 3 5 6 7 8 8 9 +10 + + + + + + + + + +20 + + +You should research and choose your favorite methods and tools to get hands-on practice for CCNA. Those options include several that focus on giving you a specific activity to do. The options include the Pearson Network Simulator, Config Labs (on my blog), and Packet Tracer labs (on my blog). + +First, one great way to practice is to use the Pearson Network Simulator (the sim) at www.pearsonitcertification.com/networksimulator. Pearson builds the sim to focus on lab exercises that help you learn and expand your skills with the topics in the CCNA exam. The sim also organizes the lab content so you can follow along with the books. You can get a sense for what the labs are like in the sim by going to the companion website for this book and downloading the Sim Lite, which uses the same core software but with a more limited number of labs compared to the full product. +Second, review the Config Checklist apps available from the book’s companion website. For any configuration topics that require more than a few commands, the book collects the configuration commands into config checklists so that you can review and study in the days leading up to the exam. Take advantage of those checklists to review and remember all the required and optional configuration commands. + +Finally, my blog site (https://blog.certskills.com) has informal lab exercises designed so that you can do the labs without any real gear or simulator. Config Labs list straightforward +462 CCNA 200-301 Official Cert Guide, Volume 2 + +configuration requirements. Your job: configure per the requirements, writing the configuration on paper or just typing into a text document. To learn more, go to + +https://blog.certskills.com/config-labs https://blog.certskills.com/packet-tracer-labs + +Exam Review: Self-Assessment Pitfalls +When you take a practice exam with PTP, PTP gives you a score, on a scale from 300 to 1000. Why? Cisco gives a score of between 300 and 1000 as well. But the similarities end there. + +With PTP, the score is a basic percentage but expressed as a number from 0 to 1000. For example, answer 80 percent correct, and the score is 800; get 90 percent correct, and the score is 900. If you start a practice exam and click through it without answering a single question, you get a 0. + +However, Cisco does not score exams in the same way. The following is what we do know about Cisco exam scoring: + +■ Cisco uses a scoring scale from 300 to 1000. +■ Cisco tells us that it gives partial credit but provides no further details. + +So, what does an 800 or a 900 mean on the actual Cisco exams? Many people think those scores mean 80 percent or 90 percent, but we don’t know. Cisco doesn’t reveal the details of scoring to us. It doesn’t reveal the details of partial credit. It seems reasonable to expect a sim question to be worth more points than a multiple-choice, single-answer question, but we do not know. + +The reason I mention all these facts to you is this: + +Do not rely too much on your PTP practice exam scores to assess whether you are ready to pass. Those scores are a general indicator, in that if you make a 700 one time and a 900 a week later, you are probably now better prepared. But that 900 on your PTP practice exam does not mean you will likely make a 900 on the actual exam—because we do not know how Cisco scores the exam. + +So, what can you use as a way to assess whether you are ready to pass? Unfortunately, the answer requires some extra effort, and the answer will not be some nice, convenient number that looks like an exam score. But you can self-assess your skills as follows: + +1. When you do take an exam with PTP, you should understand the terms used in the questions and answers. +2. You should be able to look at the list of key topics from each chapter and explain a sentence or two about each topic to a friend. +3. You should be able to do subnetting math confidently with 100 percent accuracy at this point. +4. You should be able to do all the Config Labs, or labs of similar challenge level, and get them right consistently. +5. For chapters with show commands, you should understand the fields highlighted in gray in the examples spread throughout the book, and when looking at those +Chapter 20: Final Review + +examples, you should know which values show configuration settings and which show status information. +6. For the key topics that list various troubleshooting root causes, when you review those lists, you should remember and understand the concept behind each item in the list without needing to look further at the chapter. + +Exam Review: Adjustments for Your Second Attempt +None of us wants to take and fail any exam, but some of you will. And even if you pass the CCNA exam on your first try, if you keep going with Cisco certifications, you will probably fail some exams along the way. I mention failing an exam not to focus on the negative, but to help prepare you for how to pass the next attempt after failing an earlier attempt. This section collects some of the advice I have given to readers over the years who have con-tacted me after a failed attempt, asking for help about what to do next. + +The single most important bit of advice is to change your mindset about Cisco exams. Cisco exams are not like high school or college exams where your failing grade matters. Instead, +a Cisco exam is more like an event on the road to completing an impressive major accom-plishment, one that most people have to try a few times to achieve. + +For instance, achieving a Cisco certification is more like training to run a marathon in under four hours. The first time running a marathon, you may not even finish, or you may finish at 4:15 rather than under 4:00. But finishing a marathon in 4:15 means that you have prepared and are getting pretty close to your goal. Or maybe it is more like training to complete an obstacle course (for any American Ninja Warrior fans out there). Maybe you got past the first three obstacles today, but you couldn’t climb over the 14-foot high warped wall. That just means you need to practice on that wall a little more. + +So change your mindset. You’re a marathon runner looking to improve your time or a Ninja Warrior looking to complete the obstacle course. And you are getting better skills every time you study, which helps you compete in the market. + +With that attitude and analogy in mind, the rest of this section lists specific study steps that can help. +First, study the notes you took about your failed attempt. (See the earlier section “Exam Event: Reserve the Hour After the Exam.”) Do not share that information with others, but use it to study. Before you take the exam again, you should be able to answer every actual exam question you can remember from the last attempt. Even if you never see the exact same question again, you will still get a good return for your effort. + +Second, spend more time on activities that uncover your weaknesses. When doing that, you have to slow down and be more self-aware. For instance, answer practice questions in study mode, and do not guess. Do not click on to the next question, but pause and ask yourself if you are really sure about both the wrong and correct answers. If unsure, fantastic! You just discovered a topic for which to go back and dig in to learn it more deeply. Or when you do a lab, you may refer to your notes without thinking, so now think about it when you turn to your notes because that tells you where you are unsure. That might be a reminder that you have not mastered those commands yet. + +Third, think about your time spent on the exam. Did you run out of time? Go too fast? Too slow? If too slow, were you slow on subnetting, or sims, or something else? Then make a + +463 + + + + + + + + + + + + + + + + + + + + + + + +20 +464 CCNA 200-301 Official Cert Guide, Volume 2 + +written plan as to how you will approach time on the next attempt and how you will track time use. And if you ran out of time, practice for the things that slowed you down. + +Exam Review: Other Study Tasks +If you got to this point and still feel the need to prepare some more, this last topic gives you three suggestions. + +First, the Chapter Review and Part Review sections give you some useful study tasks. + +Second, use more exam questions from other sources. You can always get more questions in the Cisco Press Premium Edition eBook and Practice Test products, which include an eBook copy of this book plus additional questions in additional PTP exam banks. However, you can search the Internet for questions from many sources and review those questions as well. + +NOTE Some vendors claim to sell practice exams that contain the literal exam questions from the official exam. These exams, called “brain dumps,” are against the Cisco testing policies. Cisco strongly discourages using any such tools for study. + +Finally, join in the discussions on the Cisco Learning Network. Try to answer questions asked by other learners; the process of answering makes you think much harder about the topic. When someone posts an answer with which you disagree, think about why and talk about it online. This is a great way to both learn more and build confidence. + +Final Thoughts +You have studied quite a bit, worked hard, and sacrificed time and money to be ready for the exam. I hope your exam goes well, that you pass, and that you pass because you really know your stuff and will do well in your IT and networking career. + +I encourage you to celebrate when you pass and ask advice when you do not. The Cisco Learning Network is a great place to make posts to celebrate and to ask advice for the next time around. I personally would love to hear about your progress through Twitter (@wendellodom) or my Facebook page (www.facebook.com/wendellodom). I wish you well, and congratulations for working through the entire book! + + + + + + + + +This page intentionally left blank +Part VII + + +Appendixes + + + + +Appendix A: Numeric Reference Tables + +Appendix B: CCNA 200-301 Volume 2 Exam Updates + +Appendix C: Answers to the “Do I Know This Already?” Quizzes + +Glossary + + + + + + + + +This page intentionally left blank +APPENDIX A + + + + +Numeric Reference Tables + +This appendix provides several useful reference tables that list numbers used throughout this book. Specifically: + +Table A-1: A decimal-binary cross reference, useful when converting from decimal to binary and vice versa. +470 CCNA 200-301 Official Cert Guide, Volume 2 + +Table A-1 Decimal-Binary Cross Reference, Decimal Values 0–255 + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + + + +0 00000000 32 + +1 00000001 33 + +2 00000010 34 + +3 00000011 35 + +4 00000100 36 + +5 00000101 37 + +6 00000110 38 + +7 00000111 39 + +8 00001000 40 + +9 00001001 41 + +10 00001010 42 + +11 00001011 43 + +12 00001100 44 + +13 00001101 45 + +14 00001110 46 + +15 00001111 47 + +16 00010000 48 + +17 00010001 49 + +18 00010010 50 + +19 00010011 51 + +20 00010100 52 + +21 00010101 53 + +22 00010110 54 + +23 00010111 55 + +24 00011000 56 + +25 00011001 57 + +26 00011010 58 + +27 00011011 59 + +28 00011100 60 + +29 00011101 61 + +30 00011110 62 + +31 00011111 63 + +00100000 64 + +00100001 65 + +00100010 66 + +00100011 67 + +00100100 68 + +00100101 69 + +00100110 70 + +00100111 71 + +00101000 72 + +00101001 73 + +00101010 74 + +00101011 75 + +00101100 76 + +00101101 77 + +00101110 78 + +00101111 79 + +00110000 80 + +00110001 81 + +00110010 82 + +00110011 83 + +00110100 84 + +00110101 85 + +00110110 86 + +00110111 87 + +00111000 88 + +00111001 89 + +00111010 90 + +00111011 91 + +00111100 92 + +00111101 93 + +00111110 94 + +00111111 95 + +01000000 96 + +01000001 97 + +01000010 98 + +01000011 99 + +01000100 100 + +01000101 101 + +01000110 102 + +01000111 103 + +01001000 104 + +01001001 105 + +01001010 106 + +01001011 107 + +01001100 108 + +01001101 109 + +01001110 110 + +01001111 111 + +01010000 112 + +01010001 113 + +01010010 114 + +01010011 115 + +01010100 116 + +01010101 117 + +01010110 118 + +01010111 119 + +01011000 120 + +01011001 121 + +01011010 122 + +01011011 123 + +01011100 124 + +01011101 125 + +01011110 126 + +01011111 127 + +01100000 + +01100001 + +01100010 + +01100011 + +01100100 + +01100101 + +01100110 + +01100111 + +01101000 + +01101001 + +01101010 + +01101011 + +01101100 + +01101101 + +01101110 + +01101111 + +01110000 + +01110001 + +01110010 + +01110011 + +01110100 + +01110101 + +01110110 + +01110111 + +01111000 + +01111001 + +01111010 + +01111011 + +01111100 + +01111101 + +01111110 + +01111111 +Appendix A: Numeric Reference Tables 471 + + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + +Decimal Binary Value Value + + + +128 10000000 160 + +129 10000001 161 + +130 10000010 162 + +131 10000011 163 + +132 10000100 164 + +133 10000101 165 + +134 10000110 166 + +135 10000111 167 + +136 10001000 168 + +137 10001001 169 + +138 10001010 170 + +139 10001011 171 + +140 10001100 172 + +141 10001101 173 + +142 10001110 174 + +143 10001111 175 + +144 10010000 176 + +145 10010001 177 + +146 10010010 178 + +147 10010011 179 + +148 10010100 180 + +149 10010101 181 + +150 10010110 182 + +151 10010111 183 + +152 10011000 184 + +153 10011001 185 + +154 10011010 186 + +155 10011011 187 + +156 10011100 188 + +157 10011101 189 + +158 10011110 190 + +159 10011111 191 + +10100000 192 + +10100001 193 + +10100010 194 + +10100011 195 + +10100100 196 + +10100101 197 + +10100110 198 + +10100111 199 + +10101000 200 + +10101001 201 + +10101010 202 + +10101011 203 + +10101100 204 + +10101101 205 + +10101110 206 + +10101111 207 + +10110000 208 + +10110001 209 + +10110010 210 + +10110011 211 + +10110100 212 + +10110101 213 + +10110110 214 + +10110111 215 + +10111000 216 + +10111001 217 + +10111010 218 + +10111011 219 + +10111100 220 + +10111101 221 + +10111110 222 + +10111111 223 + +11000000 224 + +11000001 225 + +11000010 226 + +11000011 227 + +11000100 228 + +11000101 229 + +11000110 230 + +11000111 231 + +11001000 232 + +11001001 233 + +11001010 234 + +11001011 235 + +11001100 236 + +11001101 237 + +11001110 238 + +11001111 239 + +11010000 240 + +11010001 241 + +11010010 242 + +11010011 243 + +11010100 244 + +11010101 245 + +11010110 246 + +11010111 247 + +11011000 248 + +11011001 249 + +11011010 250 + +11011011 251 + +11011100 252 + +11011101 253 + +11011110 254 + +11011111 255 + +11100000 + +11100001 + +11100010 + +11100011 + +11100100 + +11100101 + +11100110 + +11100111 + +11101000 +11101001 A + +11101010 + +11101011 + +11101100 + +11101101 + +11101110 + +11101111 + +11110000 + +11110001 + +11110010 + +11110011 + +11110100 + +11110101 + +11110110 + +11110111 + +11111000 + +11111001 + +11111010 + +11111011 + +11111100 + +11111101 + +11111110 + +11111111 +472 CCNA 200-301 Official Cert Guide, Volume 2 + +Table A-2: A hexadecimal-binary cross reference, useful when converting from hex to binary and vice versa. + + +Table A-2 Hex +0 + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 + +9 + +A + +B + +C + +D + +E + +F + +Hex-Binary Cross Reference 4-Bit Binary +0000 + +0001 + +0010 + +0011 + +0100 + +0101 + +0110 + +0111 + +1000 + +1001 + +1010 + +1011 + +1100 + +1101 + +1110 + +1111 +Appendix A: Numeric Reference Tables 473 + +Table A-3: Powers of 2, from 21 through 232. + + +Table A-3 X +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 + +9 + +10 + +11 + +12 + +13 + +14 + +15 + +16 + +Powers of 2 2X +2 + +4 + +8 + +16 + +32 + +64 + +128 + +256 + +512 + +1024 + +2048 + +4096 + +8192 + +16,384 + +32,768 + +65,536 + + +X 2X 17 131,072 +18 262,144 + +19 524,288 + +20 1,048,576 + +21 2,097,152 + +22 4,194,304 + +23 8,388,608 + +24 16,777,216 +25 33,554,432 A + +26 67,108,864 + +27 134,217,728 + +28 268,435,456 + +29 536,870,912 + +30 1,073,741,824 + +31 2,147,483,648 + +32 4,294,967,296 +474 CCNA 200-301 Official Cert Guide, Volume 2 + +Table A-4: Table of all 33 possible subnet masks, in all three formats. + + +Table A-4 Decimal +0.0.0.0 + +All Subnet Masks Prefix +/0 + + +Binary +00000000 00000000 00000000 00000000 + + + +128.0.0.0 /1 192.0.0.0 /2 224.0.0.0 /3 240.0.0.0 /4 248.0.0.0 /5 252.0.0.0 /6 254.0.0.0 /7 255.0.0.0 /8 255.128.0.0 /9 255.192.0.0 /10 255.224.0.0 /11 255.240.0.0 /12 255.248.0.0 /13 255.252.0.0 /14 255.254.0.0 /15 255.255.0.0 /16 255.255.128.0 /17 255.255.192.0 /18 255.255.224.0 /19 255.255.240.0 /20 255.255.248.0 /21 255.255.252.0 /22 255.255.254.0 /23 255.255.255.0 /24 255.255.255.128 /25 255.255.255.192 /26 255.255.255.224 /27 255.255.255.240 /28 255.255.255.248 /29 255.255.255.252 /30 255.255.255.254 /31 +255.255.255.255 /32 + +10000000 00000000 00000000 00000000 11000000 00000000 00000000 00000000 11100000 00000000 00000000 00000000 11110000 00000000 00000000 00000000 11111000 00000000 00000000 00000000 11111100 00000000 00000000 00000000 11111110 00000000 00000000 00000000 11111111 00000000 00000000 00000000 11111111 10000000 00000000 00000000 11111111 11000000 00000000 00000000 11111111 11100000 00000000 00000000 11111111 11110000 00000000 00000000 11111111 11111000 00000000 00000000 11111111 11111100 00000000 00000000 11111111 11111110 00000000 00000000 11111111 11111111 00000000 00000000 11111111 11111111 10000000 00000000 11111111 11111111 11000000 00000000 11111111 11111111 11100000 00000000 11111111 11111111 11110000 00000000 11111111 11111111 11111000 00000000 11111111 11111111 11111100 00000000 11111111 11111111 11111110 00000000 11111111 11111111 11111111 00000000 11111111 11111111 11111111 10000000 11111111 11111111 11111111 11000000 11111111 11111111 11111111 11100000 11111111 11111111 11111111 11110000 11111111 11111111 11111111 11111000 11111111 11111111 11111111 11111100 11111111 11111111 11111111 11111110 +11111111 11111111 11111111 11111111 + + + + + + + + +This page intentionally left blank +APPENDIX B + + +CCNA 200-301, Volume 2 Exam Updates + +Over time, reader feedback allows Pearson to gauge which topics give our readers the most problems when taking the exams. To assist readers with those topics, the authors create new materials clarifying and expanding on those troublesome exam topics. As mentioned in the Introduction, the additional content about the exam is contained in a PDF on this book’s companion website, at www.ciscopress.com/title/9781587147135. +This appendix provides you with updated information if Cisco makes minor modifications to the exam topics during the life of the 200-301 exam. In particular, this appendix does the following: + +■ Mentions technical items that might not have been mentioned elsewhere in the book ■ Covers new topics if Cisco adds new content to the exam over time +■ Provides a way to get up-to-the-minute current information about content for the exam + +Note that this appendix shows updated information related to the subset of CCNA 200-301 exam topics covered in this book. Refer also to the CCNA 200-301 Official Cert Guide, Volume 1, for more details about the rest of the exam topics and for an Appendix B similar to that of this book. + +Always Get the Latest at the Book’s Product Page Many of you are reading the version of this appendix that was available when your book +was printed or when you downloaded the e-book. However, given that the main purpose of this appendix is to be a living, changing document, it is important that you look for the lat-est version online at the book’s companion website. To do so, follow these steps: +Step 1. Browse to www.ciscopress.com/title/9781587147135. Step 2. Click the Updates tab. +Step 3. If there is a new Appendix B document on the page, download the latest Appendix B document. + + +NOTE The downloaded document has a version number. Comparing the version of the print Appendix B (Version 1.0) with the latest downloadable version of this appendix, you should do the following: +■ Same version: Ignore the PDF that you downloaded from the companion website. + +■ Website has a later version: Ignore this Appendix B in your book and read only the lat-est version that you downloaded from the companion website. + +Technical Content +The current Version 1.0 of this appendix does not contain additional technical coverage. + + + + + + + + +This page intentionally left blank +APPENDIX C + + +Answers to the “Do I Know This Already?” Quizzes + +Chapter 1 +1. D and E. Many headers include a field that identifies the next header that follows inside a message. Ethernet uses the Ethernet Type field, and the IP header uses the Protocol field. The TCP and UDP headers identify the application that should receive the data that follows the TCP or UDP header by using the port number field in the TCP and UDP headers, respectively. +2. A, B, C, and F. IP, not TCP, defines routing. Many other protocols define encryption, but TCP does not. The correct answers simply list various TCP features. +3. C. TCP, not UDP, performs windowing, error recovery, and ordered data transfer. Neither performs routing or encryption. +4. C and F. The terms packet and L3PDU refer to the header plus data encapsulated by Layer 3. Frame and L2PDU refer to the header (and trailer), plus the data encapsulated by Layer 2. Segment and L4PDU refer to the header and data encapsulated by the transport layer protocol. +5. B. Note that the hostname is all the text between the // and the /. The text before the // identifies the application layer protocol, and the text after the / represents the name of the web page. +6. C and D. Web traffic uses TCP as the transport protocol, with HTTP as the application protocol. As a result, the web server typically uses well-known TCP port 80, which +is the well-known port for HTTP traffic. Messages flowing to the web server would have a destination TCP port of 80, and messages flowing from the server would have a source TCP port of 80. + +Chapter 2 +1. A and C. Standard ACLs check the source IP address. The address range 10.1.1.1– 10.1.1.4 can be matched by an ACL, but it requires multiple access-list commands. Matching all hosts in Barney’s subnet can be accomplished with the access-list 1 permit 10.1.1.0 0.0.0.255 command. +2. A and D. The range of valid ACL numbers for standard numbered IP ACLs is 1–99 and 1300–1999, inclusive. +3. D. 0.0.0.255 matches all packets that have the same first three octets. This is useful when you want to match a subnet in which the subnet part comprises the first three octets, as in this case. +4. E. 0.0.15.255 matches all packets with the same first 20 bits. This is useful when you want to match a subnet in which the subnet part comprises the first 20 bits, as in this case. + + + + +5. A. The router always searches the ACL statements in order, and stops trying to match ACL statements after a statement is matched. In other words, it uses first-match logic. A packet with source IP address 1.1.1.1 would match any of the three explicitly config-ured commands described in the question. As a result, the first statement will be used. +6. B. One wrong answer, with wildcard mask 0.0.255.0, matches all packets that begin with 172.16, with a 5 in the last octet. One wrong answer matches only specific IP address 172.16.5.0. One wrong answer uses a wildcard mask of 0.0.0.128, which has only one wildcard bit (in binary), and happens to only match addresses 172.16.5.0 and 172.16.5.128. The correct answer matches the range of addresses 172.16.4.0– 172.16.5.255. + +Chapter 3 +1. E and F. Extended ACLs can look at the Layer 3 (IP) and Layer 4 (TCP, UDP) headers and a few others, but not any application layer information. Named extended ACLs can look for the same fields as numbered extended ACLs. +2. A and E. The correct range of ACL numbers for extended IP access lists is 100 to 199 and 2000 to 2699. The answers that list the eq www parameter after 10.1.1.1 match the source port number, and the packets are going toward the web server, not away from it. +3. E. Because the packet is going toward any web client, you need to check for the web server’s port number as a source port. The client IP address range is not specified in the question, but the servers are, so the source address beginning with 172.16.5 is the correct answer. +4. A and C. Before IOS 12.3, numbered ACLs must be removed and then reconfigured to remove a line from the ACL. As of IOS 12.3, you can also use ACL configuration mode and sequence numbers to delete one ACL line at a time. +5. C and D. In the command output, line number 10 references a permit command that matches addresses in subnet 172.16.1.0/24. The question stem identifies the subnet, so it indirectly asks about line 10 of the ACL. Any specific Access Control Entry (ACE) in ACL can be deleted in ACL config mode. Two methods can be used: the short no line-number, where line-number is the ACE’s line number, or by issuing a no version of the permit or deny command, as shown in one of the correct answers. The three incorrect answers show correct commands but incorrect modes in which to use the commands. +6. C and D. The show ip access-lists and show access-lists commands both display +the configuration of IPv4 access lists, including ACL line numbers. Neither the show running-config nor show startup-config commands list the ACL line numbers; in this case, the startup-config file would not contain the ACL configuration at all. +480 CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter 4 +1. B. A vulnerability is a weakness that can be exploited. Attack is not correct because it is a threat that is taking place. +2 D. When a vulnerability can be exploited, a threat is possible. +3. A and B. Attackers usually spoof the source IP address in packets they send in order to disguise themselves and make the actual IP address owner into a victim of the attack. MAC addresses can also be spoofed in ARP replies to confuse other hosts and rout-ers on the local network. Destination IP addresses are not normally spoofed because packets used in the attack would go to unknown or nonexistent hosts. Finally, ARP address is not correct because it is not a legitimate term. +4. D. A denial-of-service attack is likely occurring because the attacker is trying to exhaust the target’s TCP connection table with embryonic or incomplete TCP connections. +5. C. In a reflection attack, the goal is to force one host (the reflector) to reflect the pack-ets toward a victim. Therefore, the spoofed source address contains the address of the victim and not the reflector. +6. A and C. Once an attacker is in position in a man-in-the-middle attack, traffic between hosts can be passively inspected and actively modified. This type of attack does not lend itself to inducing buffer overflows or using sweeps and scans. +7. B. In a brute-force attack, an attacker’s software tries every combination of letters, numbers, and special characters to eventually find a string that matches a user’s password. +8. D. The Cisco ISE platform provides the AAA services needed for authentication, authorization, and accounting. DHCP does not perform AAA but leases IP addresses to hosts instead. DNS resolves hostnames to IP addresses. SNMP is used for network management functions. +9. C. Physical access control is a necessary element of a security program that keeps sen-sitive locations like data centers and network closets locked and inaccessible, except to authorized personnel. + +Chapter 5 +1. B. If both commands are configured, IOS accepts only the password as configured in the enable secret command +2. A. The service password-encryption command encrypts passwords on a router or switch that would otherwise be shown in clear text. While a great idea in concept, the algorithm can be easily broken using websites found in the Internet. Cisco long ago provided replacements for commands that store passwords as clear text, instead using hashes—commands like enable secret and username secret. These commands are preferred in part because they avoid the issues of clear-text passwords and easily decrypted passwords. +3. B. The enable secret command stores an MD5 hash of the password. It is unaffected by the service password-encryption command. The router does not unhash the value back to the clear-text password. Instead, when the user types her clear-text password, +Appendix C: Answers to the “Do I Know This Already?” Quizzes 481 + +the router also hashes that password and compares that hashed value with the hashed value as listed in the configuration. +4. A. The ip access-class 1 in command enables ACL 1 for processing inbound Telnet and SSH connections into that router, based on the source IP address of those incom-ing packets. It has no impact on Telnet or SSH attempts from the router to some other host. It has no impact on a user later reaching enable mode. It also has nothing to do with filtering packets that would otherwise be routed through the router. Note that the ACL matches all packets whose source IP address is in subnet 172.16.4.0/23, which includes the range of numbers from 172.16.4.0 to 172.16.5.255. +5. B. Traditional and next-generation firewalls can check TCP and UDP port numbers, but next-generation firewalls are generally characterized as being able to also check appli-cation data beyond the Transport layer header. An NGFW would look into the appli-cation data, identifying messages that contain data structures used by Telnet, instead of matching with port numbers. This matching can catch attacks that seek to use port numbers that the firewall allows while using those ports to send data from applications that do not normally use those ports. +For the other answers, a traditional firewall would likely match based on destination port 23, which is the well-known port for Telnet. IP protocol number has nothing to do with Telnet. +6. A and D. Both traditional and next-generation IPSs (NGIPSs) use a signature database, with each signature listing details of what fields would be in a series of messages to identify those messages as part of some exploit. They both also generate events for review by the security team. +NGIPS devices add features that go beyond using a signature database, including gathering contextual information from hosts, like the OS used, currently running apps, open ports, and so on, so that the NGIPS does not have to log events if the hosts could not possibly be affected. Additionally, an NGIPS can use a list of reputation scores about IP addresses, domain names, and URIs of known bad actors, filtering traffic for sources that have a configured poor reputation level. + +Chapter 6 C 1. B. The setting for the maximum number of MAC addresses has a default of 1, so the +switchport port-security maximum command does not have to be configured. With sticky learning, you do not need to predefine the specific MAC addresses either. However, you must enable port security, which requires the switchport port-security interface subcommand. +2. B and D. First, about the sticky parameter…this command causes the switch to learn the source MAC and to add it to a switchport port-security mac-address address interface subcommand. However, port security adds that command to the running-config file; the network engineer must also issue a copy running-config startup-config EXEC command to save that configuration. +About the other correct answer, users can connect a switch to the end of the cable, with multiple devices connected to that switch. That happens in real networks when users decide they need more ports at their desk. However, the default setting of +482 CCNA 200-301 Official Cert Guide, Volume 2 + +switchport port-security maximum 1 means that a frame from the second unique source MAC address would cause a violation, and with the default violation action, to err-disable the port. +For the other incorrect answer, the configuration does not prevent unknown MAC addresses from accessing the port because the configuration does not predefine any MAC address. +3. B and C. IOS adds MAC addresses configured by the port security feature as static MAC addresses, so they do not show up in the output of the show mac address-table dynamic command. show mac address-table port-security is not a valid command. +4. B. The question states that the port security status is secure-shutdown. This state is used only by the shutdown port security mode, and when used, it means that the interface has been placed into an err-disabled state. Those facts explain why the cor-rect answer is correct and two of the incorrect answers are incorrect. +The incorrect answer that mentions the violation counter is incorrect because in shut-down mode, the counter no longer increments once the interface is placed into secure-shutdown mode, and it resets to 0 once the interface is reset with the shutdown and then no shutdown commands. +5. B and C. First, about the two incorrect answers: In restrict mode, the arrival of a frame that violates the port security policy does not cause the switch to put the interface into err-disabled state. It does cause the switch to discard any frames that violate the policy, but it leaves the interface up and does not discard frames that do not violate the security policy, like the second frame that arrives. +Regarding the two correct answers, a port in port security restrict does cause the switch to issue log messages for a violating frame, send SNMP traps about that same event (if SNMP is configured), and increment the counter of violating frames. + +Chapter 7 +1. B and D. The client sends a Discover message, with the server returning an Offer mes-sage. The client then sends a Request, with the server sending back the IP address in the Acknowledgment message. +2. A and B. The two correct answers list the two primary facts that impact which IP addresses the server will lease to clients. For the incorrect answer about DNS servers, the DHCP server does supply the IP address of the DNS servers, but not the host-names of the DNS servers. Also, the DHCP server supplies the IP address (but not the MAC address) of the default gateway in each subnet. +3. A and C. A router needs to act as a DHCP relay agent if DHCP clients exist on the connected subnet and there is no DHCP server in that subnet. If a DHCP exists in the subnet, the router does not need to forward DHCP messages to a remote DHCP +server (which is the function of a DHCP relay agent). The answer that mentions the ip address dhcp command makes the router interface act as a DHCP client and has noth-ing to do with DHCP relay agent. +4. D. The ip address dhcp command tells the router to obtain its address using DHCP. The router learns all the same information that a normal DHCP client would learn. The router uses the address listed as the default gateway to build a default route, using the +Appendix C: Answers to the “Do I Know This Already?” Quizzes 483 + +default gateway IP address as the next-hop address. The router continues to work like a router always does, forwarding packets based on its IP routing table. +5. B and C. The output shows the MAC address, IP address, subnet mask (in hex format), and the subnet broadcast address. Of those, the DHCP server supplies the information in the two correct answers. The two incorrect answers mention the MAC address (not supplied by DHCP, but known to the device’s NIC) and the subnet broadcast address (calculated by the host). +6. D. Windows supports both ipconfig and ipconfig /all commands, but the ipconfig command does not mention the DNS servers. Note that the ifconfig command works on Linux and macOS, and the ifconfig /all command is an invalid command. + +Chapter 8 + +1. A and C. DHCP Snooping must be implemented on a device that performs Layer 2 switching. The DHCP Snooping function needs to examine DHCP messages that flow between devices within the same broadcast domain (VLAN). Layer 2 switches, as well as multilayer switches, perform that function. Because a router performs only Layer +3 forwarding (that is, routing) and does not forward messages between devices in the same VLAN, a router does not provide a good platform to implement DHCP Snooping (and is not even a feature of Cisco IOS on routers). End-user devices would be a poor choice as a platform for DHCP Snooping because they would not receive all the DHCP messages, nor would they be able to prevent frames from flowing should an attack occur. +2. B and C. Switch ports connected to IT-controlled devices from which DHCP server messages may be received should be trusted by the DHCP Snooping function. Those devices include IT-controlled DHCP servers and IT-controlled routers and switches. All devices that are expected to be DHCP client devices (like PCs) are then treated as untrusted, because DHCP Snooping cannot know beforehand from which ports a +DHCP-based attack will be launched. In this case, the ports connected to all three PCs will be treated as untrusted by DHCP Snooping. +3. C and D. Because of a default setting of untrusted, the switch does not need any con-figuration commands to cause a port to be untrusted. Of the two (incorrect) answers that related to the trust state, no ip dhcp snooping trust, in interface config mode, would revert from a trust configuration state to an untrusted state. The other answer, ip dhcp snooping untrusted, is not a valid command. +The two correct answers list a pair of configuration commands that both must be included to enable DHCP Snooping (ip dhcp snooping) and to specify the VLAN list on which DHCP Snooping should operate (ip dhcp snooping vlan 5). +4. A. All the answers list commands with correct syntax that are useful for DHCP Snooping; however, the correct answer, no ip dhcp snooping information, disables DHCP Snooping’s feature of adding DHCP Option 82 fields to DHCP messages. This setting is useful if the switch does not act as a DHCP relay agent. The opposite setting (without the no to begin the command) works when the multilayer switch acts as a +DHCP relay agent. + + + + + + + + + + + + + + + + + + + + +C +484 CCNA 200-301 Official Cert Guide, Volume 2 + +5. B. DAI always uses a core function that examines incoming ARP messages, specifi-cally the ARP message origin hardware and origin IP address fields, versus tables of data in the switch about correct pairs of MAC and IP addresses. DAI on a switch can use DHCP Snooping’s binding table as the table of data with valid MAC/IP address pairs or use the logic in configured ARP ACLs. The question stem states that DAI uses DHCP Snooping, so the correct answer notes that the switch will compare the ARP message’s origin hardware address to the switch’s DHCP Snooping binding table. +One incorrect answer mentions a comparison of the message’s ARP origin MAC (hard-ware) address with the message’s Ethernet source MAC address. DAI can perform that check, but that feature can be configured to be enabled or disabled, so DAI would +not always perform this comparison. The other incorrect answers list logic never per-formed by DAI. +6. B and D. Because of a default setting of untrusted, the switch must be configured so DAI trusts that one port. To add that configuration, the switch needs the ip arp +inspection trust command in interface config mode. The similar (incorrect) answer of no ip arp inspection untrust is not a valid command. +To enable DAI for operation on a VLAN, the configuration needs one command: the ip arp inspection vlan 6 command. This command both enables DAI and does so specifically for VLAN 6 alone. The answer ip arp inspection shows a command that would be rejected by the switch as needing more parameters. +7. C and D. With DAI, you can set a limit on the number of received ARP messages with a default burst interval of 1 second, or you can configure the burst interval. Once con-figured, DAI allows the configured number of ARP messages over the burst interval number of seconds. With the two correct answers, one shows 16 ARP messages, with a 4-second interval, for an average of 4 per second. The other correct answer shows +a limit of 4, with the default burst interval of 1 second, for an average of 4. The two incorrect answers result in averages of 2 per second and 5 per second. + +Chapter 9 +1. D. By default, all message levels are logged to the console on a Cisco device. To do so, IOS uses logging level 7 (debugging), which causes IOS to send severity level 7, and levels below 7, to the console. All the incorrect answers list levels below level 7. +2. C. The logging trap 4 command limits those messages sent to a syslog server (configured with the logging host ip-address command) to levels 4 and below, thus 0 through 4. +3. A. NTP uses protocol messages between clients and servers so that the clients can adjust their time-of-day clock to match the server. NTP is totally unrelated to serial line clocking. It also does not count CPU cycles, instead relying on messages from the NTP server. Also, the client defines the IP address of the server and does not have to be in the same subnet. +4. C. The ntp server 10.1.1.1 command tells the router to be both an NTP server and cli-ent. However, the router first acts as an NTP client to synchronize its time with NTP server 10.1.1.1. Once synchronized, R1 knows the time to supply and can act as an NTP server. +Appendix C: Answers to the “Do I Know This Already?” Quizzes 485 + +5. E and F. CDP discovers information about neighbors. show cdp gives you several options that display more or less information, depending on the parameters used. +6. E and F. The show lldp neighbors command lists one line of output per neighbor. However, it does list the platform information of the neighbor, which typically includes the hardware model number. The show lldp entry Hannah command lists a group of messages about the neighboring router, including more detail about the hard-ware model and the IOS version. + +Chapter 10 +1. D. CIDR’s original intent was to allow the summarization of multiple Class A, B, and C networks to reduce the size of Internet routing tables. Of the answers, only 200.1.0.0 255.255.0.0 summarizes multiple networks. +2. B and E. RFC 1918 identifies private network numbers. It includes Class A net-work 10.0.0.0, Class B networks 172.16.0.0 through 172.31.0.0, and Class C networks 192.168.0.0 through 192.168.255.0. +3. C. With static NAT, the entries are statically configured. Because the question men-tions translation for inside addresses, the inside keyword is needed in the command. +4. A. With dynamic NAT, the entries are created as a result of the first packet flow from the inside network. +5. A. The list 1 parameter references an IP ACL, which matches packets, identifying the inside local addresses. +6. A and C. The configuration is missing the overload keyword in the ip nat inside source command and in the ip nat outside interface subcommand on the serial interface. +7. B. The last line mentions that the pool has seven addresses, with all seven allocated, with the misses counter close to 1000—meaning that close to 1000 new flows were rejected because of insufficient space in the NAT pool + +Chapter 11 +1. A, B, and E. QoS tools manage bandwidth, delay, jitter, and loss. C 2. B and C. The Class of Service (CoS) field exists in the 802.1Q header, so it would be +used only on trunks, and it would be stripped of the incoming data-link header by any router in the path. The MPLS EXP bits exist as the packet crosses the MPLS network only. The other two fields, IP Precedence (IPP) and Differentiated Services Code Point (DSCP), exist in the IP header and would flow from source host to destination host. +3. A, B, and C. In general, matching a packet with DiffServ relies on a comparison to something inside the message itself. The 802.1p CoS field exists in the data-link header on VLAN trunks; the IP DSCP field exists in the IP header; and extended ACLs check fields in message headers. The SNMP Location variable does not flow inside individual packets but is a value that can be requested from a device. +4. B and C. Low Latency Queuing (LLQ) applies priority queue scheduling, always taking the next packet from the LLQ if a packet is in that queue. To prevent queue starvation of the other queues, IOS also applies policing to the LLQ. However, applying shaping +486 CCNA 200-301 Official Cert Guide, Volume 2 + +to an LLQ slows the traffic, which makes no sense with the presence of a policing function already. +5. A and D. Policers monitor the bit rate and take action if the bit rate exceeds the policing rate. However, the action can be to discard some packets, or to re-mark some packets, or even to do nothing to the packets, simply measuring the rate for later reporting. For shaping, when a shaper is enabled because the traffic has exceeded the shaping rate, the shaper always queues packets and slows the traffic. There is no option to re-mark the packets or to bypass the shaping function. +6. C and D. Drop management relies on the behavior of TCP, in that TCP connections slow down sending packets due to the TCP congestion window calculation. Voice traf-fic uses UDP, and the question states that queue 1 uses UDP. So, queues 2 and 3 are reasonable candidates for using a congestion management tool. + +Chapter 12 +1. D. With this design but no FHRP, host A can send packets off-subnet as long as con-nectivity exists from host A to R1. Similarly, host B can send packets off-subnet as long as host B has connectivity to router R2. Both routers can attach to the same LAN subnet and basically ignore each other in relation to their roles as default router because they do not use an FHRP option. When either router fails, the hosts using that router as default router have no means by which to fail over. +2. C. The use of an FHRP in this design purposefully allows either router to fail and still support off-subnet traffic from all hosts in the subnet. Both routers can attach to the same LAN subnet per IPv4 addressing rules. +3. C. HSRP uses a virtual IP address. The virtual IP address comes from the same subnet as the routers’ LAN interfaces but is a different IP address than the router addresses configured with the ip address interface subcommand. As a result, the hosts will +not point to 10.1.19.1 or 10.1.19.2 in this design. The other wrong answer lists an idea of using the Domain Name System (DNS) to direct hosts to the right default router; although this idea exists in some other forms of network load balancing, it is not a part of any of the three FHRP protocols. +4. B. SNMPv1 and SNMPv2c use community strings to authenticate Get and Set mes-sages from an NMS. The agent defines a read-only community and can define a read-write community as well. Get requests, which read information, will be accepted if the NMS sends either the read-only or the read-write community with those requests. +5. A and C. SNMP agents reside on a device being managed. When an event happens about which the device wants to inform the SNMP manager, the agent sends either an SNMP Trap or SNMP Inform to the SNMP manager. The SNMP manager normally sends an SNMP Get Request message to an agent to retrieve MIB variables or an SNMP Set Request to change an MIB variable on the agent. +6. A. FTP uses both a control connection and a data connection. The FTP client initiates the control connection. However, in active mode, the FTP server initiates the data connection. Also, note that FTP does not use TLS, while FTP Secure (FTPS) does +use TLS. +Appendix C: Answers to the “Do I Know This Already?” Quizzes 487 + +7. B and D. TFTP supports fewer functions than FTP as a protocol. For instance, the cli-ent cannot change the current directory on the server, add directories, remove directo-ries, or list the files in the directory. Both TFTP and FTP support the ability to transfer files in either direction. + +Chapter 13 +1. B and D. The access layer switches play the role of connecting to the endpoint devices, whether they are end-user devices or servers. Then, from the access to the distribution layer, each access layer connects to two distribution switches typically, but with no direct connections between access layer switches, creating a mesh (but a partial mesh). A two-tier design, also called a collapsed core, does not use core switches at all. +2. A and C. The access layer switches, not the distribution layer switches, play the role of connecting to the endpoint devices, whether they are end-user devices or serv- +ers. Then, from the access to the distribution layer, each access layer connects to two distribution switches typically, but with no direct connections between access layer switches, creating a mesh (but a partial mesh). A three-tier design, also called a core design, does use core switches, with a partial mesh of links between the distribution and core switches. Basically, each distribution switch connects to multiple core switch-es but often does not connect directly to other distribution switches. +3. D. The access layer uses access switches, which connect to endpoint devices. A single access switch with its endpoint devices looks like a star topology. The distribution layer creates a partial mesh of links between the distribution switches and access switches, so it is neither a full mesh nor a hybrid. +4. A and C. With a SOHO LAN, one integrated device typically supplies all the neces-sary functions, including routing, switching, wireless access point (AP), and firewall. The AP uses standalone mode, without a wireless LAN controller (WLC), and without a need to encapsulate frames in CAPWAP. +5. A. First, the switch does not supply power based on a configured value to avoid the unfortunate case of supplying power over the cable to a device that does not support the circuitry to receive the power, because doing so will likely harm the electronics on +the connected device. C If configured to use PoE, the switch begins with IEEE autonegotiation messages while +sensing the load on the circuit, which indicates whether the device desires to receive power, and indicates the power class desired (which dictates the amount of power to initially deliver). Note that once the attached device (called the powered device, or PD) boots, the PD can request additional power using CDP and/or LLDP. +6. B and D. Universal Power over Ethernet (UPoE) and the enhanced UPoE Plus (UPoE+) supply power over all four pairs of the cable. Note that 1000BASE-T and faster UTP-based Ethernet standards often require four pair, whereas earlier/slower standards did not, and UPoE/UPoE+ take advantage of the existence of four pairs to supply power over all four pairs. Power over Ethernet (PoE) and PoE+ use two pairs for power and therefore work with Ethernet standards like 10BASE-T and 100BASE-T that use two pairs only. +488 CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter 14 +1. B and C. A Metro Ethernet E-Tree service uses a rooted point-to-multipoint Ethernet Virtual Connection (EVC), which means that one site connected to the service (the root) can communicate directly with each of the remote (leaf) sites. However, the leaf sites cannot send frames directly to each other; they can only send frames to the +root site. Topology design like this that allows some but not all pairs of devices in the group to communicate is called a partial mesh, or hub and spoke, or in some cases a multipoint or point-to-multipoint topology. +Of the incorrect answers, the full mesh term refers to topology designs in which each pair in the group can send data directly to each other, which is typical of a MetroE +E-LAN service. The term point-to-point refers to topologies with only two nodes in the design, and they can send directly to each other, typical of a MetroE E-Line service. +2. A. Metro Ethernet uses Ethernet access links of various types. Time-division multi-plexing (TDM) links such as serial links, even higher-speed links like T3 and E3, do not use Ethernet protocols, and are less likely to be used. MPLS is a WAN technology that creates a Layer 3 service. +Two answers refer to Ethernet standards usable as the physical access link for a Metro Ethernet service. However, 100BASE-T supports cable lengths of only 100 meters, so it is less likely to be used as a Metro Ethernet access link in comparison to 100BASE-LX10, which supports lengths of 10 km. +3. A and D. An E-LAN service is one in which the Metro Ethernet service acts as if the WAN were a single Ethernet switch so that each device can communicate directly to every other device. As a result, the routers sit in the same subnet. With one headquar-ters router and 10 remote sites, each router will have 10 OSPF neighbors. +4. B and C. A Layer 3 MPLS VPN creates an IP service with a different subnet on each access link. With one headquarters router and 10 remote sites, 11 access links exist, so 11 subnets are used. +As for the OSPF neighbor relationships, each enterprise router has a neighbor relation-ship with the MPLS provider edge (PE) router, but not with any of the other enterprise (customer edge) routers. So each remote site router would have only one OSPF neigh-bor relationship. +5. D. Architecturally, MPLS allows for a wide variety of access technologies. Those include TDM (that is, serial links), Frame Relay, ATM, Metro Ethernet, and traditional Internet access technologies such as DSL and cable. +6. A. The PE-CE link is the link between the customer edge (CE) router and the MPLS provider’s provider edge (PE) router. When using OSPF, that link will be configured to be in some area. OSPF design allows for that link to be in the backbone area, or not, through the use of the OSPF super backbone, which exists between all the PE routers. +7. A. The term remote access VPN, or client VPN, typically refers to a VPN for which one endpoint is a user device, such as a phone, tablet, or PC. In those cases, TLS is the more likely protocol to use. TLS is included in browsers, and is commonly used to connect securely to websites. GRE along with IPsec is more likely to be used to create a site-to-site VPN connection. FTPS refers to FTP Secure, which uses TLS to secure FTP sessions. +Appendix C: Answers to the “Do I Know This Already?” Quizzes 489 + +Chapter 15 + +1. A, B, and E. The hypervisor will virtualize RAM, CPU, NICs, and storage for each VM. The hypervisor itself is not virtualized, but rather does the work to virtualize other resources. Also, as virtual machines, the VMs do not use power, so the power is not virtualized. +2. D. Hypervisors create a virtual equivalent of Ethernet switching and cabling between the VMs and the physical NICs. The VMs use a virtual NIC (vNIC). The hypervisor uses a virtual switch (vswitch), which includes the concept of a link between a vswitch port and each VM’s vNIC. The vswitch also connects to both physical NICs. The switch can then be configured to create VLANs and trunks as needed. +3. B. Platform as a Service (PaaS) supplies one or more virtual machines (VMs) that have a working operating system (OS) as well as a predefined set of software development tools. +As for the wrong answers, Software as a Service (SaaS) supplies a predefined software application, but typically with no ability to then later install your own applications. Infrastructure as a Service (IaaS) supplies one or more working VMs, optionally with an OS installed, so it could be used for software development, but the developer would have to install a variety of development tools, making IaaS less useful than a PaaS service. Finally, Server Load Balancing as a Service (SLBaaS) can be offered as a cloud service, but it is not a general service in which customers get access to VMs on which they can then install their own applications. +4. A. Infrastructure as a Service (IaaS) supplies one or more working virtual machines (VMs), optionally with an OS installed, as a place where you can then customize the systems by installing your own applications. +Software as a Service (SaaS) supplies a predefined software application, but typically with no ability to then later install your own applications. Platform as a Service (PaaS) could be used to install your own application, because PaaS does supply one or more VMs, but it is most likely used as a software development environment, a service designed specifically to be used for development, with VMs that include various tools that are useful for software development. Finally, Server Load Balancing as a Service (SLBaaS) can be offered as a cloud service, but it is not a general service in which cus-tomers get access to VMs on which they can then install their own applications. +5. A. Both options that use the Internet allow for easier migration because public cloud providers typically provide easy access over the Internet. An intercloud exchange is a purpose-built WAN service that connects to enterprises as well as most public cloud providers, with the advantage of making the cloud migration process easier. The one correct answer—the worst option in terms of being prepared for migrating to a new cloud provider—is to use a private WAN connection to one cloud provider. While use-ful in other ways, migrating when using this strategy would require installing a new private WAN connection to the new cloud provider. +6. A and C. Private WAN options use technologies like Ethernet WAN and MPLS, both of which keep data private by their nature and which include QoS services. An inter- +cloud exchange is a purpose-built WAN service that connects to enterprises as well as + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +C +490 CCNA 200-301 Official Cert Guide, Volume 2 + +most public cloud providers, using the same kinds of private WAN technology with those same benefits. +For the two incorrect answers, both use the Internet, so both cannot provide QoS ser-vices. The Internet VPN option does encrypt the data to keep it private. + +Chapter 16 +1. A. The data plane includes all networking device actions related to the receipt, pro-cessing, and forwarding of each message, as in the case described in the question. The term table plane is not used in networking. The management plane and control plane are not concerned with the per-message forwarding actions. +2. C. The control plane includes all networking device actions that create the informa-tion used by the data plane when processing messages. The control plane includes functions like IP routing protocols and Spanning Tree Protocol (STP). +The term table plane is not used in networking. The management plane and data plane are not concerned with collecting the information that the data plane then uses. +3. C. Although many variations of SDN architectures exist, they typically use a central-ized controller. That controller may centralize some or even all control plane functions in the controller. However, the data plane function of receiving messages, matching them based on header fields, taking actions (like making a forwarding decision), and forwarding the message still happens on the network elements (switches) and not on the controller. +For the incorrect answers, the control plane functions may all happen on the control-ler, or some may happen on the controller, and some on the switches. The northbound and southbound interfaces are API interfaces on the controller, not on the switches. +4. A. The OpenDaylight Controller uses an Open SDN model with an OpenFlow south-bound interface as defined by the Open Networking Foundation (ONF). The ONF SDN model centralizes most control plane functions. The APIC model for data centers partially centralizes control plane functions. The APIC-EM controller (as of time of publication) makes no changes to the control plane of routers and switches, leaving those to run with a completely distributed control plane. +5. C and D. ACI uses a spine-leaf topology. With a single-site topology, leaf switches must connect to all spine switches, and leaf switches must not connect to other leaf switches. Additionally, a leaf switch connects to some endpoints, with the endpoints being spread across the ports on all the leaf switches. (In some designs, two or more leaf switches connect to the same endpoints for redundancy and more capacity.) +6. A and D. Controller-based networks use a controller that communicates with each net-work device using a southbound interface (an API and protocol). By gathering network information into one central device, the controller can then allow for different opera-tional models. The models often let the operator think in terms of enabling features in the network, rather than thinking about the particulars of each device and command on each device. The controller then configures the specific commands, resulting in more consistent device configuration. +Appendix C: Answers to the “Do I Know This Already?” Quizzes 491 + +For the incorrect answers, both the old and new models use forwarding tables on each device. Also, controllers do not add to or remove from the programmatic interfaces on each device, some of which existed before controllers, but rather supply useful and powerful northbound APIs. + +Chapter 17 +1. C. The SDA underlay consists of the network devices and connections, along with configuration that allows IP connectivity between the SDA nodes, for the purpose of supporting overlay VXLAN tunnels. The fabric includes both the underlay and overlay, while VXLAN refers to the protocol used to create the tunnels used by the overlay. +2. B. The overlay includes the control plane and data plane features to locate the end-points, decide to which fabric node a VXLAN tunnel should connect, direct the frames into the tunnel, and perform VXLAN tunnel encapsulation and de-encapsula-tion. The SDA underlay exists as network devices, links, and a separate IP network to provide connectivity between nodes to support the VXLAN tunnels. +The fabric includes both the underlay and overlay, while VXLAN refers to the protocol used to create the tunnels used by the overlay. +3. D. The SDA overlay creates VXLAN tunnels between SDA edge nodes. Edge nodes then create a data plane by forwarding frames sent by endpoints over the VXLAN tun-nels. LISP plays a role in the overlay as the control plane, which learns the identifiers of each endpoint, matching the endpoint to the fabric node that can teach the endpoint, so that the overlay knows where to create VXLAN tunnels. +For the other incorrect answers, note that while GRE is a tunneling protocol, SDA uses VXLAN for tunneling, and not GRE. Finally, OSPF acts as a control plane routing pro-tocol, rather than a data plane protocol for SDA. +4. A and D. As with any SDA feature, the configuration model is to configure the feature using DNA Center, with DNA Center using southbound APIs to communicate the intent to the devices. The methods to configure the feature using DNA Center include using the GUI or using the northbound REST-based API. +Of the incorrect answers, you would not normally configure any of the SDA devices +directly. Also, while DNA Center can use NETCONF as a southbound protocol to C +communicate with the SDA fabric nodes, it does not use NETCONF as a northbound API for configuration of features. +5. B, C, and D. Cisco DNA Center manages traditional network devices with traditional protocols like Telnet, SSH, and SNMP. DNA Center can also use NETCONF and RESTCONF if supported by the device. Note that while useful tools, Ansible and Puppet are not used by DNA Center. +6. A and D. Traditional network management platforms can do a large number of functions related to managing traditional networks and network devices, includ-ing the items listed in the two correct answers. However, when using Cisco’s Prime +Infrastructure as a traditional network management platform for comparison, it does not support SDA configuration, nor does it find the end-to-end path between two endpoints and analyze the ACLs in the path. Note that the two incorrect answers refer-ence features available in DNA Center. +492 CCNA 200-301 Official Cert Guide, Volume 2 + +Chapter 18 +1. B and D. The six primary required features of REST-based APIs include three features mentioned in the answers: a client/server architecture, stateless operation, notation +of whether each object is cacheable. Two items from these three REST attributes are the correct answers. Of the incorrect answers, classful operation is the opposite of the REST-based API feature of classless operation. For the other incorrect answer, although many REST-based APIs happen to use HTTP, REST APIs do not have to use HTTP. +2. B and D. In the CRUD software development acronym, the matching terms (create, read, update, delete) match one or more HTTP verbs. While the HTTP verbs can some-times be used for multiple CRUD actions, the following are the general rules: create performed by HTTP POST; read by HTTP GET; update by HTTP PATCH, PUT (and sometimes POST); delete by HTTP DELETE. +3. C. The URI for a REST API call uses a format of protocol://hostname/ resource?parameters. The API documentation details the resource part of the URI, as well as any optional parameters. For instance, in this case, the resource section is /dna/ intent/api/v1/network-device. Additionally, the API documentation for this resource details optional parameters in the query field as listed after the ? in the URI. +4. A and D. Of the four answers, two happen to be most commonly used to format and serialize data returned from a REST API: JSON and XML. For the incorrect answers, JavaScript is a programming language that first defined JSON as a data serialization language. YAML is a data serialization/modeling language and can be found most often in configuration management tools like Ansible. +5. A and D. JSON defines variables as key:value pairs, with the key on the left of the colon (:) and always enclosed in double quotation marks, with the value on the right. The value can be a simple value or an object or array with additional complexity. The number of objects is defined by the number of matched curly brackets ({ and }), so this example shows a single JSON object. +The one JSON object shown here includes one key and one :, so it has a single key:value pair (making one answer correct). The value in that key:value pair itself is a JSON array (a list in Python) that lists numbers 1, 2, and 3. The fact that the list is enclosed in square brackets defines it as a JSON array. +6. C and D. To interpret this JSON data, first look for the innermost pairing of either curly brackets { }, which denote one object, or square brackets [ ], which denote one array. In this case, the gray highlighted area is one JSON object, enclosed with { } and no other brackets of either type inside. That makes the gray area one object, which itself holds key:value pairs. +Inside that one object, four key:value pairs exist, with the key before each colon and the value after each colon. That means “type” is a key, and “ACCESS” is one of the values. +If you look at the other pair of curly brackets that begin and end the JSON data, that pair defines an object. That object has a key of “response” (making one answer incor-rect). The “response” key then has a value equal to the entire inner object (the gray highlighted part), confirming one of the correct answers. +Appendix C: Answers to the “Do I Know This Already?” Quizzes 493 + +Chapter 19 +1. C. Devices with the same role in an enterprise should have a very similar configuration. When engineers make unique changes on individual devices—different changes from those made in the majority of devices with that same role—those devices’ configura-tions become different than the intended ideal configuration for every device with that role. This effect is known as configuration drift. Configuration management tools can monitor a device’s configuration versus a file that shows the intended ideal configura-tion for devices in that role, noting when the device configuration drifts away from that ideal configuration. +2. A and B. The version control system, applied to the centralized text files that contain the device configurations, automatically tracks changes. That means the system can see which user edited the file, when, and exactly what change was made, with the abil-ity to make comparisons between different versions of the files. +The two incorrect answers list very useful features of a configuration management tool, but those answers list features typically found in the configuration management tool itself rather than in the version control tool. +3. D. Configuration monitoring (a generic description) refers to a process of checking the device’s actual configuration versus the configuration management system’s intended configuration for the device. If the actual configuration has moved away from the intended configuration—that is, if configuration drift has occurred—configuration monitoring can either reconfigure the device or notify the engineering staff. +For the other answers, two refer to features of the associated version control software typically used along with the configuration management tool. Version control soft-ware will track the identity of each user who changes files and track the differences in files over time. The other incorrect answer is a useful feature of many configuration management tools, in which the tool verifies that the configuration will be accepted when attempted (or not). However, that useful feature is not part of what is called con-figuration monitoring. +4. A. Ansible uses a push model, in which the Ansible control node decides when to +configure a device based on the instructions in a playbook. Puppet and Chef use pull +models, in which an agent asks for information from a server, with the agent then mak- C +ing the decision of whether it needs to pull configuration data to itself and reconfigure itself. +5. B and C. Of the terms manifest and recipe, both refer to files that define the actions to take and/or the end state desired when taking action in one of the configuration management tools. These files go by the names Ansible playbook, Puppet manifest, and Chef recipe. +GLOSSARY + + +NUMERICS +3G/4G Internet An Internet access technology that uses wireless radio signals to communi-cate through mobile phone towers, most often used by mobile phones, tablets, and some other mobile devices. +802.1 Q The IEEE standardized protocol for VLAN trunking. + +A +AAA Authentication, authorization, and accounting. Authentication confirms the identity of the user or device. Authorization determines what the user or device is allowed to do. Accounting records information about access attempts, including inappropriate requests. +AAA server See authentication, authorization, and accounting (AAA) server. + +Access Control Entry (ACE) One line in an access control list (ACL). + +access interface A LAN network design term that refers to a switch interface connected to end-user devices, configured so that it does not use VLAN trunking. + +access layer In a campus LAN design, the switches that connect directly to endpoint devic-es (servers, user devices), and also connect into the distribution layer switches. + +access link In Frame Relay, the physical serial link that connects a Frame Relay DTE device, usually a router, to a Frame Relay switch. The access link uses the same physical layer stan-dards as do point-to-point leased lines. +access link (WAN) A physical link between a service provider and its customer that provides access to the SP’s network from that customer site. + +access rate The speed at which bits are sent over an access link. + +accounting In security, the recording of access attempts. See also AAA. + +ACI See Application Centric Infrastructure (ACI). + +ACL Access control list. A list configured on a router to control packet flow through the router, such as to prevent packets with a certain IP address from leaving a particular interface on the router. +Active Directory A popular set of identity and directory services from Microsoft, used in part to authenticate users. + +administrative distance In Cisco routers, a means for one router to choose between multiple routes to reach the same subnet when those routes are learned by different routing protocols. The lower the administrative distance, the more preferred the source of the routing information. +agent Generally, an additional software process or component running in a computing device for some specific purpose; a small and specific software service. + + + + +agent-based architecture With configuration management tools, an architecture that uses a software agent inside the device being managed as part of the functions to manage the configuration. +agentless architecture With configuration management tools, an architecture that does not need a software agent inside the device being managed as part of the functions to manage the configuration, instead using other mainstream methods like SSH and NETCONF. +amplification attack A reflection attack that leverages a service on the reflector to generate and reflect huge volumes of reply traffic to the victim. + +analog modem See modem. + +Ansible A popular configuration management application, which can be used with or with-out a server, using a push model to move configurations into devices, with strong capabilities to manage network device configurations. +Ansible inventory Device host names along with information about each device, like device roles, so Ansible can perform functions for subsets of the inventory. + + +Ansible playbook + +Ansible template + + +Files with actions and logic about what Ansible should do. + +A text file, written in Jinja2 language, that lists configuration but with vari- + +able names substituted for values, so that Ansible can create standard configurations for mul-tiple devices from the same template. +anti-replay Preventing a man in the middle from copying and later replaying the packets sent by a legitimate user, for the purpose of appearing to be a legitimate user. + +antivirus Software that monitors files transferred by any means, for example, web or email, to look for content that can be used to place a virus into a computer. + +APIC See Application Policy Infrastructure Controller. + +APIC-EM See Application Policy Infrastructure Controller—Enterprise Module. + +Application Centric Infrastructure (ACI) Cisco’s data center SDN solution, the concepts of defining policies that the APIC controller then pushes to the switches in the network using the OpFlex protocol, with the partially distributed control plane in each switch building the forwarding table entries to support the policies learned from the controller. It also supports a GUI, a CLI, and APIs. +Application Policy Infrastructure Controller—Enterprise Module (APIC-EM) The software that plays the role of controller in an enterprise network of Cisco devices, in its first version as of the publication of this book, which leaves the distributed routing and switching control plane as is, instead acting as a management and automation platform. It provides robust APIs for network automation and uses CLI (Telnet and SSH) plus SNMP southbound to con-trol the existing routers and switches in an enterprise network. +496 Application Policy Infrastructure Controller (APIC) + +Application Policy Infrastructure Controller (APIC) The software that plays the role of controller, controlling the flows that the switches create to define where frames are forwarded, in a Cisco data center that uses the Application Centric Infrastructure (ACI) approach, switch-es, and software. +application programming interface (API) A software mechanism that enables software components to communicate with each other. + +application signature With Network Based Application Recognition (NBAR), the defini-tion of a combination of matchable fields that Cisco has identified as being characteristic of a specific application, so that NBAR can be configured by the customer to match an application, while IOS then defines the particulars of that matching. +Application Visibility and Control (AVC) A firewall device with advanced features, includ-ing the ability to run many related security features in the same firewall device (IPS, malware detection, VPN termination), along with deep packet inspection with Application Visibility and Control (AVC) and the ability to perform URL filtering versus data collected about the reliabil-ity and risk associated with every domain name. +application-specific integrated circuit (ASIC) An integrated circuit (computer chip) designed for a specific purpose or application, often used to implement the functions of a net-working device rather than running a software process as part of the device’s OS that runs on a general-purpose processor. +AR See access rate. + +ARP Address Resolution Protocol. An Internet protocol used to map an IP address to a MAC address. Defined in RFC 826. + +ARP ACL A configuration feature on Cisco LAN switches that define MAC and IP address pairs that can be used directly for filtering, as well as to be referenced by the Dynamic ARP Inspection feature. +ARP reply An ARP message used to supply information about the sending (origin) host’s hardware (Ethernet) and IP addresses as listed in the origin hardware and origin IP address fields. Typically sent in reaction to receipt of an ARP request message. +ARP request An ARP message used to request information from another host located on the same data link, typically listing a known target IP address but an all-zero target hardware address, to ask the host with that target IP address to identify its hardware address in an ARP reply message. +ARP table A list of IP addresses of neighbors on the same VLAN, along with their MAC addresses, as kept in memory by hosts and routers. + +ASAv A Cisco ASA firewall software image that runs as a virtual machine rather than on Cisco hardware, intended to be used as a consumer-controlled firewall in a cloud service or in other virtualized environments. +ASIC See application-specific integrated circuit. +buffer overflow attack 497 + +Assured Forwarding (AF) The name of a grid of 12 DSCP values and a matching grid of per-hop behavior as defined by DiffServ. AF defines four queuing classes and three packet drop priorities within each queuing class. The text names of the 12 DSCP values follow a for-mat of AFXY, where X is the queuing class, and Y is the drop priority. +authentication In security, the verification of the identity of a person or a process. See also AAA. + +authentication, authorization, and accounting (AAA) server A server that holds security information and provides services related to user login, particularly authentication (is the user who he says he is), authorization (once authenticated, what do we allow the user to do), and accounting (tracking the user). +Authoritative DNS server The DNS server with the record that lists the address that corre-sponds to a domain name (the A Record) for that domain. + +authorization In security, the determination of the rights allowed for a particular user or device. See also AAA. + +autonomous system (AS) An internetwork that is managed by one organization. + +autonomous system number (ASN) A number used by BGP to identify a routing domain, often a single enterprise or organization. As used with EIGRP, a number that identifies the routing processes on routers that are willing to exchange EIGRP routing information with each other. +AutoQoS In Cisco switches and routers, an IOS feature that configures a variety of QoS fea-tures with useful settings as defined by the Cisco reference design guide documents. + +B +bandwidth The speed at which bits can be sent and received over a link. + +bandwidth profile In Metro Ethernet, a contractual definition of the amount of traffic that the customer can send into the service and receive out of the service. Includes a concept called the committed information rate (CIR), which defines the minimum amount of bandwidth (bits per second) the SP will deliver with the service. +Brownfield A term that refers to the choice to add new configuration to hardware and soft-ware that are already in use, rather that adding new hardware and software specifically for a new project. +brute-force attack An attack where a malicious user runs software that tries every possible combination of letters, numbers, and special characters to guess a user’s password. Attacks of this scale are usually run offline, where more computing resources and time are available. +buffer overflow attack An attack meant to exploit a vulnerability in processing inbound traffic such that the target system’s buffers overflow; the target system can end up crashing or inadvertently running malicious code injected by the attacker. +498 cable Internet + +C +cable Internet An Internet access technology that uses a cable TV (CATV) cable, normally used for video, to send and receive data. + +cacheable For resources that might be repeatedly requested over time, an attribute that means that the requesting host can keep in storage (cache) a copy of the resource for a speci-fied amount of time. +candidate config With configuration management tools like Ansible, Puppet, and Chef, an updated configuration for a device as it exists in the management tool before the tool has moved the configuration into the device. +carrier Ethernet Per MEF documents, the term for what was formerly called Metro Ethernet, generally referring to any WAN service that uses Ethernet links as the access link between the customer and the service provider. +CDP Cisco Discovery Protocol. A media- and protocol-independent device-discovery pro-tocol that runs on most Cisco-manufactured equipment, including routers, access servers, and switches. Using CDP, a device can advertise its existence to other devices and receive informa-tion about other devices on the same LAN or on the remote side of a WAN. +CDP neighbor A device on the other end of some communications cable that is advertising CDP updates. + +central office (CO) A term used by telcos to refer to a building that holds switching equip-ment, into which the telco’s cable plant runs so that the telco has cabling from each home and business into that building. +centralized control plane An approach to architecting network protocols and products that places the control plane functions into a centralized function rather than distributing the func-tion across the networking devices. +Chef A popular configuration management application, which uses a server and a pull model with in-device agents. + +Chef client Any device whose configuration is being managed by Chef. + +Chef Cookbook A set of recipes about the same kinds of work, grouped together for easier management and sharing. + +Chef Recipe The Chef logic applied to resources to determine when, how, and whether to act against the resources—analogous to a recipe in a cookbook. + +Chef Runlist An ordered list of recipes that should be run against a given device. + +Chef server The Chef software that collects all the configuration files and other files used by Chef from different Chef users and then communicates with Chef clients (devices) so that the Chef clients can synchronize their configurations. +CIDR Classless interdomain routing. An RFC-standard tool for global IP address range assign-ment. CIDR reduces the size of Internet routers’ IP routing tables, helping deal with the rapid growth of the Internet. The term classless refers to the fact that the summarized groups of networks represent a group of addresses that do not conform to IPv4 classful (Class A, B, and C) grouping rules. +cloud services catalog 499 + +Cisco Access Control Server (ACS) A legacy Cisco product that acts as a AAA server. + +Cisco AnyConnect Secure Mobility Client Cisco software product used as client software on user devices to create a client VPN. Commonly referred to as the Cisco VPN client. + +Cisco Open SDN Controller (OSC) A former commercial SDN controller from Cisco that is based on the OpenDaylight controller. + +Cisco Prime Graphical user interface (GUI) software that utilizes SNMP and can be used to manage your Cisco network devices. The term Cisco Prime is an umbrella term that encom-passes many different individual software products. + +Cisco Prime Infrastructure (PI) ment application. + +Cisco Talos Intelligence Group + + +The name of Cisco’s long-time enterprise network manage- + + +A part of the Cisco Systems company that works to per- + +form security research on an ongoing basis, in part to supply up-to-date data, like virus signa-tures, that Cisco security products can frequently download. +Cisco VPN client See Cisco AnyConnect Secure Mobility Client. + +Class of Service (CoS) The informal term for the 3-bit field in the 802.IQ header intended for marking and classifying Ethernet frames for the purposes of applying QoS actions. Another term for Priority Code Point (PCP). +Class Selector (CS) The name of eight DSCP values that all end with binary 000, for the purpose of having eight identifiable DSCP values whose first 3 bits match the eight values used for the older IP Precedence field. Originally used for backward compatibility with IP Precedence, but today the values are often used as just more values to use for packet marking. +classification The process of examining various fields in networking messages in an effort to identify which messages fit into certain predetermined groups (classes). + +classless addressing A concept in IPv4 addressing that defines a subnetted IP address as having two parts: a prefix (or subnet) and a host. + +client VPN A VPN for which one endpoint is a user device, like a phone, tablet, or PC. Also called a remote access VPN. + +clock rate The speed at which a serial link encodes bits on the transmission medium. + +clock source On serial links, the device to which the other devices on the link adjust their speed when using synchronous links. With NTP, the external device or NTP server on which a device bases its time. +clocking The process of supplying a signal over a cable, either on a separate pin on a serial cable or as part of the signal transitions in the transmitted signal, so that the receiving device can keep synchronization with the sending device. +Clos network A term for network topology that represents an ideal for a switch fabric and named after Charles Clos, who formalized the definition. Also called a spine-leaf network. + +cloud services catalog A listing of the services available in a cloud computing service. +500 Cloud Services Router (CSR) + +Cloud Services Router (CSR) A Cisco router software image that runs as a virtual machine rather than on Cisco hardware, intended to be used as a consumer-controlled router in a cloud service or in other virtualized environments. +code integrity A software security term that refers to how likely that the software (code) being used is the software supplied by the vendor, unchanged, with no viruses or other changes made to the software. +collapsed core design A campus LAN design in which the design does not use a separate set of core switches in addition to the distribution switches—in effect collapsing the core into the distribution switches. +confidentiality (privacy) Preventing anyone in the middle of the Internet (a.k.a. man in the middle) from being able to read the data. + +configuration drift A phenomenon that begins with the idea that devices with similar roles can and should have a similar standard configuration, so when one device’s configuration is changed to be different, its configuration is considered to have moved away (drifted) from the standard configuration for a device in that role. + +configuration enforcement + +configuration management + + +Another term for configuration monitoring. + +A component of network management focused on creating, + +changing, removing, and monitoring device configuration. + +configuration management tool A class of application that manages data about the config-uration of servers, network devices, and other computing nodes, providing consistent means of describing the configurations, moving the configurations into the devices, noticing unintended changes to the configurations, and troubleshooting by easily identifying changes to the con-figuration files over time. +configuration monitoring With configuration management tools like Ansible, Puppet, and Chef, a process of comparing over time a device’s on-device configuration (running-config) versus the text file showing the ideal device configuration listed in the tool’s centralized con-figuration repository. If different, the process can either change the device’s configuration or report the issue. +configuration provisioning With configuration management tools like Ansible, Puppet, and Chef, the process of configuring a device to match the configuration as held in the configura-tion management tool. +configuration template With configuration management tools like Ansible, Puppet, and Chef, a file with variables, for the purpose of having the tool substitute different variable val-ues to create the configuration for a device. +congestion window With TCP, a calculation each TCP receiver does that limits the window it grants to the receiver by shrinking the window in response to the loss of TCP segments. + +connection establishment The process by which a connection-oriented protocol cre- +ates a connection. With TCP, a connection is established by a three-way transmission of TCP segments. +declarative policy model 501 + +control plane Functions in networking devices and controllers that directly control how devices perform data plane forwarding, but excluding the data plane processes that work to forward each message in the network. +controller-based networking A style of building computer networks that use a control-ler that centralizes some features and provides application programming interfaces (APIs) that +allow for software interactions between applications and the controller (northbound APIs) and between the controller and the network devices (southbound APIs). +core In computer architecture, an individual processing unit that can execute instructions of a CPU; modern server processors typically have multiple cores, each capable of concurrent execution of instructions. +core design A campus LAN design that connects each access switch to distribution switches, and distribution switches into core switches, to provide a path between all LAN devices. + +core layer In a campus LAN design, the switches that connect the distribution layer switch-es, and to each other, to provide connectivity between the various distribution layer switches. + +CRUD In software development, an acronym that refers to the four most common actions taken by a program: Create, Read, Update, and Delete. + +customer edge (CE) A term used by service providers, both generally and also specifically in MPLS VPN networks, to refer to the customer device that connects to the SP’s network and therefore sits at the edge of the SP’s network. +customer premises equipment (CPE) A telco term that refers to equipment on site at the telco customer site (the enterprise’s site) that connects to the WAN service provided by the telco. + +D +data integrity Verifying that the packet was not changed as the packet transited the Internet. + +data model A set of variables and their structures, like lists and dictionaries. + +data modeling language Another term for data serialization language. + +data plane Functions in networking devices that are part of the process of receiving a mes-sage, processing the message, and forwarding the message. + +data serialization language A language that includes syntax and rules that provides a means to describes the variables inside applications in a text format, for the purpose of sending that text between applications over a network or storing the data models in a file. +data structure Another term for data model. + +declarative policy model A term that describes the approach in an intent-based network (IBN) in which the engineer chooses settings that describe the intended network behavior (the declared policy) but does not command the network with specific configuration commands for each protocol (as would be the case with an imperative policy model). +502 decrypt/decryption + +decrypt/decryption The ability to receive encrypted data and process it to derive the origi-nal unencrypted data. +default gateway/default router On an IP host, the IP address of some router to which the host sends packets when the packet’s destination address is on a subnet. + +delay In QoS, the amount of time it takes for a message to cross a network. Delay can refer to one-way delay (the time required for the message to be sent from the source host to the destination host) or two-way delay (the delay from the source to the destination host and then back again). +demilitarized zone (DMZ) In an Internet edge design at an enterprise, one or more subnets set aside as a place to locate servers that should allow users in the Internet to initiate connec-tions to those servers. The devices in the DMZ typically sit behind a firewall. +denial-of-service (DoS) attack An attack that tries to deplete a system resource so that systems and services crash or become unavailable. + +deny An action taken with an ACL that implies that the packet is discarded. + +DevNet Cisco’s community and resource site for software developers, open to all, with many great learning resources; https://developer.cisco.com. + +DHCP Dynamic Host Configuration Protocol. A protocol used by hosts to dynamically dis-cover and lease an IP address, and learn the correct subnet mask, default gateway, and DNS server IP addresses. +DHCP attack Any attack that takes advantage of DHCP protocol messages. + +DHCP binding table A table built by the DHCP snooping feature on a switch when it sees messages about a new DHCP lease, with the table holding information about legitimate suc-cessful DHCP leases, including the device’s IP address, MAC address, switch port, and VLAN. +DHCP chaddr Client hardware address. The original DHCP header field used to identify the DHCP clients; typically includes the client MAC address. + +DHCP client Any device that uses DHCP protocols to ask to lease an IP address from a DHCP server or to learn any IP settings from that server. + +DHCP client identifier A DHCP header field used to identify a DHCP client, used as a more flexible alternative to the DHCP chaddr field. + +DHCP giaddr Gateway IP address. In DHCP, a header field used to identify a router on a subnet, typically an IP address on the DHCP relay agent, so that the DHCP server knows an address to which to send messages in reply to the client. +DHCP option 82 Optional DHCP header fields, as defined in RFC 3046, that provide useful features of use to a device that acts as a DHCP relay agent. The fields allow better relay agent operation and also help prevent various types of DHCP-based attacks. +DHCP relay agent The name of the router IOS feature that forwards DHCP messages from client to servers by changing the destination IP address from 255.255.255.255 to the IP address of the DHCP server. +DNA Center 503 + +DHCP server Software that waits for DHCP clients to request to lease IP addresses, with the server assigning a lease of an IP address as well as listing other important IP settings for the client. +DHCP Snooping A switch security feature in which the switch examines incoming DHCP messages and chooses to filter messages that are abnormal and therefore might be part of a DHCP attack. +DHCP Snooping binding table When using DHCP Snooping, a table that the switch dynamically builds by analyzing the DHCP messages that flow through the switch. DHCP Snooping can use the table for part of its filtering logic, with other features, such as Dynamic ARP Inspection and IP Source Guard also using the table. +dictionary attack An attack where a malicious user runs software that attempts to guess a user’s password by trying words from a dictionary or word list. + +dictionary variable In applications, a single variable whose value is a list of other variables with values, known as key:value pairs. + +Differentiated Services (DiffServ) An approach to QoS, originally defined in RFC 2475, that uses a model of applying QoS per classification, with planning of which applications and other traffic types are assigned to each class, with each class given different QoS per-hop behaviors at each networking device in the path. +Differentiated Services Code Point (DSCP) A field existing as the first 6 bits of the ToS byte, as defined by RFC 2474, which redefined the original IP RFC’s definition for the IP header ToS byte. The field is used to mark a value in the header for the purpose of performing later QoS actions on the packet. +Digital Subscriber Line (DSL) A public network technology that delivers high bandwidth over conventional telco local-loop copper wiring at limited distances. Typically used as an Internet access technology, connecting a user to an ISP. +distributed control plane An approach to architecting network protocols and products that places some control plane functions into each networking device rather than centralizing the control plane functions in one or a few devices. An example is the use of routing protocols on each router which then work together so that each router learns Layer 3 routes. +distributed denial-of-service (DDoS) attack A DoS attack that is distributed across many hosts under centralized control of an attacker, all targeting the same victim. + +distribution layer In a campus LAN design, the switches that connect to access layer switch-es as the most efficient means to provide connectivity from the access layer into the other parts of the LAN. +DNA Digital Network Architecture—Cisco’s software-oriented approach to networking and intent-based networking products and services. + +DNA Center Cisco software, delivered by Cisco on a server appliance, that acts as a network management application as well as a being the control for Cisco’s software-defined access (SDA) offering. +504 DNS + +DNS Domain Name System. An application layer protocol used throughout the Internet for translating host names into their associated IP addresses. + +DNS reply In the Domain Name System (DNS), a message sent by a DNS server to a DNS cli-ent in response to a DNS request, identifying the IP address assigned to a particular hostname or fully qualified domain name (FQDN). +DNS request In the Domain Name System (DNS), a message sent by a DNS client to a DNS server, listing a hostname or fully qualified domain name (FQDN), asking the server to discover and reply with the IP address associated with that host name or FQDN. +DNS server An application acting as a server for the purpose of providing name resolution services per the Domain Name System (DNS) protocol and worldwide system. + +domain-specific language A generic term that refers to an attribute of different languages within computing, for languages created for a specific purpose (domain) rather than a general-purpose language like Python or JavaScript. +DSL Digital subscriber line. Public network technology that delivers high bandwidth over conventional telco local-loop copper wiring at limited distances. Usually used as an Internet access technology connecting a user to an ISP. +DSL modem A device that connects to a telephone line and uses DSL standards to transmit and receive data to/from a telco using DSL. + +Dynamic ARP Inspection (DAI) A security feature in which a LAN switch filters a subset of incoming ARP messages on untrusted ports, based on a comparison of ARP, Ethernet, and IP header fields to data gathered in the IP DHCP Snooping binding table and found in any config-ured ARP ACLs. + +E +egress tunnel router (ETR) With LISP, a node at the end of a tunnel that receives an encap-sulated message and then de-encapsulates the message. + +E-LAN A specific carrier/Metro Ethernet service defined by MEF (MEF.net) that provides a service much like a LAN, with two or more customer sites connected to one E-LAN service in a full mesh so that each device in the E-LAN can send Ethernet frames directly to every other device. +E-Line A specific carrier/metro Ethernet service defined by MEF (MEF.net) that provides a point-to-point topology between two customer devices, much as if the two devices were con-nected using an Ethernet crossover cable. +enable mode A part of the Cisco IOS CLI in which the user can use the most powerful and potentially disruptive commands on a router or switch, including the ability to then reach con-figuration mode and reconfigure the router. +enable password A reference to the password configured on the enable password pass-value command, which defines the password required to reach enable (privileged) mode if the enable secret pass-value command does not exist. +E-Tree 505 + +enable secret A reference to the password configured on the enable secret pass-value command, which defines the password required to reach enable (privileged) mode. + +encrypt/encryption The ability to take data and send the data in a form that is not readable by someone who intercepts this data. + +encryption key A secret value used as input to the math formulas used by an encryption process. + +End of Row (EoR) switch In a traditional data center design with servers in multiple racks and the racks in multiple rows, a switch placed in a rack at the end of the row, intended to be cabled to all the Top of Rack (ToR) switches in the same row, to act as a distribution layer switch for the switches in that row. +endpoint group In ACI, a set (group) of VMs, containers, physical servers, or other end-points in an ACI data center that should receive the same policy treatment. + +Endpoint ID (EID) With LISP, a number that identifies the endpoint. + +err-disable recovery Cisco switches can place ports in a nonworking state called “err-disabled” in reaction to a variety of events, and by default, to leave the port in the nonwork-ing err-disabled state until the engineer takes action to recover from the issue. The err-disable recovery configuration feature includes settings to direct the switch to automatically revert away from the err-disabled state, back to a working state, after a period of time. +error detection The process of discovering whether a data-link level frame was changed dur-ing transmission. This process typically uses a Frame Check Sequence (FCS) field in the data-link trailer. +error disabled (err-disable) An interface state on LAN switches that can be the result of one of many security violations. + +error recovery The process of noticing when some transmitted data was not successfully received and resending the data until it is successfully received. + +Ethernet access link A WAN access link (a physical link between a service provider and its customer) that happens to use Ethernet. + + +Ethernet LAN Service + +Ethernet Line Service + +Ethernet Tree Service + + +Another term for E-LAN; see also E-LAN. + +Another term for E-Line; see also E-Line. + +Another term for E-Tree; see also E-Tree. + + +Ethernet Virtual Connection (EVC) A concept in carrier/Metro Ethernet that defines which customer devices can send frames to each other over the Ethernet WAN service; includes +E-Line, E-LAN, and E-Tree EVCs. + +Ethernet WAN A general and informal term for any WAN service that uses Ethernet links as the access link between the customer and the service provider. + +E-Tree A specific carrier/metro Ethernet service defined by MEF (MEF.net) that provides a rooted multipoint service, in which the root site can send frames directly to all leaves, but the leaf sites can send only to the root site. +506 Expedited Forwarding (EF) + +Expedited Forwarding (EF) The name of a particular DSCP value, as well as the term for one per-hop behavior as defined by DiffServ. The value, decimal 46, is marked for packets to which the networking devices should apply certain per-hop behaviors, like priority queuing. +exploit A means of taking advantage of a vulnerability to compromise something. + +extended access list A list of IOS access-list global configuration commands that can match multiple parts of an IP packet, including the source and destination IP address and TCP/ UDP ports, for the purpose of deciding which packets to discard and which to allow through the router. + +F +fabric In SDA, the combination of overlay and underlay that together provide all features to deliver data across the network with the desired features and attributes. + +fabric border node In SDA, a switch that connects to devices outside SDA’s control—for example, switches that connect to the WAN routers or to an ACI data center. + +fabric control node In SDA, a switch that performs special functions for the underlay (LISP), requiring more CPU and memory. + +fabric edge node In SDA, a switch that connects to endpoint devices. + +fiber Internet A general term for any Internet access technology that happens to use fiber-optic cabling. It often uses Ethernet protocols on the fiber link. + +filter Generally, a process or a device that screens network traffic for certain characteristics, such as source address, destination address, or protocol. This process determines whether to forward or discard that traffic based on the established criteria. +firewall A device that forwards packets between the less secure and more secure parts of the network, applying rules that determine which packets are allowed to pass and which are not. + +First Hop Redundancy Protocol (FHRP) A class of protocols that includes HSRP, VRRP, and GLBP, which allows multiple redundant routers on the same subnet to act as a single default router (first-hop router). +flash memory A type of read/write permanent memory that retains its contents even with no power applied to the memory, and uses no moving parts, making the memory less likely to fail over time. +flow control The process of regulating the amount of data sent by a sending computer toward a receiving computer. Several flow control mechanisms exist, including TCP flow con-trol, which uses windowing. +forward acknowledgment A process used by protocols that do error recovery, in which the number that acknowledges data lists the next data that should be sent, not the last data that was successfully received. +Git 507 + +forwarding plane A synonym for data plane. See also data plane. + +FTP File Transfer Protocol. An application protocol, part of the TCP/IP protocol stack, used to transfer files between network nodes. FTP is defined in RFC 959. + +FTP active mode One of two modes of operation for FTP connections (the other being pas-sive mode) that dictates how the FTP data mode connection is established. In active mode, the FTP client listens on a port, it identifies that port to the server, and the server initiates the TCP connection. +FTP client An application that can connect to an FTP server for the purpose of transferring copies of files to and from the server. + +FTP control connection A TCP connection initiated by an FTP client to an FTP server for the purpose of sending FTP commands that direct the activities of the connection. + +FTP data connection A TCP connection created by an FTP client and server for the pur-pose of transferring data. + +FTP over TLS An FTP standard defined by RFC 4217, also known as FTP Secure (FTPS), which adds a variety of security features to the somewhat insecure original FTP standard (RFC 957), including the addition of the encryption of all data as well as username/password infor-mation using Transport Layer Security (TLS). +FTP passive mode One of two modes of operation for FTP connections (the other being active mode) that dictates how the FTP data mode connection is established. In passive mode, the FTP client declares the use of passive mode, causing the server to choose and identify a new listening port, with the client establishing a TCP connection to that port. +FTP server An application that runs and waits for FTP clients to connect to it over TCP port 21 to support the client’s commands to transfer copies of files to and from the server. + +FTPS FTP Secure. Common term for FTP over TLS. + +full mesh From a topology perspective, any topology that has two or more devices, with each device being able to send frames to every other device. + +G +Gateway Load Balancing Protocol (GLBP) A Cisco-proprietary protocol that allows two (or more) routers to share the duties of being the default router on a subnet, with an active/ active model, with all routers actively forwarding off-subnet traffic for some hosts in the subnet. +Generic Routing Encapsulation (GRE) A protocol, defined in RFC 2784, that defines the headers used when creating a site-to-site VPN tunnel. The protocol defines the use of a normal IP header, called the Delivery Header, and a GRE header that the endpoints use to create and manage traffic over the GRE tunnel. +Git An open-source version control application, widely popular for version control in soft-ware development and for other uses, like managing network device configurations. +508 GitHub + +GitHub A software-as-a-service application that implements Git. + +gratuitous ARP An ARP Reply not sent as a reaction to an ARP request message, but rather as a general announcement informing other hosts of the values of the sending (origin) host’s addresses. +GRE tunnel A site-to-site VPN idea, in which the endpoints act as if a point-to-point link (the tunnel) exists between the sites, while actually encapsulating packets using GRE standards. + +greenfield A term that refers to the installation of new equipment for a project rather than adding configuration to existing in-use hardware and software. + +H +host (context: DC) In a virtualized server environment, the term used to refer to one physi-cal server that is running a hypervisor to create multiple virtual machines. + +Hot Standby Router Protocol (HSRP) A Cisco-proprietary protocol that allows two (or more) routers to share the duties of being the default router on a subnet, with an active/stand-by model, with one router acting as the default router and the other sitting by waiting to take over that role if the first router fails. +HSRP active A Hot Standby Router Protocol (HSRP) state in which the router actively sup-ports the forwarding of off-subnet packets for hosts in that subnet. + +HSRP standby A Hot Standby Router Protocol (HSRP) state in which the router does not currently support the forwarding of off-subnet packets for hosts in that subnet, instead waiting for the currently active router to fail before taking over that role. +HTML Hypertext Markup Language. A simple document-formatting language that uses tags to indicate how a given part of a document should be interpreted by a viewing application, such as a web browser. +HTTP Hypertext Transfer Protocol. The protocol used by web browsers and web servers to transfer files, such as text and graphic files. + +HTTP verb The action defined in an HTTP request message. + +hub and spoke From a topology perspective, any topology that has a device that can send messages to all other devices (the hub), with one or more spoke devices that can send messages only to the hub. Also called point-to-multipoint. +hyperthreading The name of Intel’s multithreading technology. + +hypervisor Software that runs on server hardware to create the foundations of a virtualized server environment primarily by allocating server hardware components like CPU core/threads, RAM, disk, and network to the VMs running on the server. +internetwork operating system (IOS) 509 + +I +IANA The Internet Assigned Numbers Authority. An organization that owns the rights to assign many operating numbers and facts about how the global Internet works, including public IPv4 and IPv6 addresses. See also ICANN. +ICANN The Internet Corporation for Assigned Names and Numbers. An organization appointed by IANA to oversee the distributed process of assigning public IPv4 and IPv6 addresses across the globe. +imperative policy model A term that describes the approach in traditional networks in which the engineer chooses configuration settings for each control and data plane protocol (the imperative commands) that dictate specifically how the devices act. This model acts in contrast to the newer declarative policy model and intent-based networking (IBN). +Infrastructure as a Service (laaS) A cloud service in which the service consists of a virtual machine that has defined computing resources (CPUs, RAM, disk, and network) and may or may not be provided with an installed OS. +ingress tunnel router (ITR) With LISP, the node that receives an unencapsulated message and encapsulates the message. + +inside global For packets sent to and from a host that resides inside the trusted part of a network that uses NAT, a term referring to the IP address used in the headers of those packets when those packets traverse the global (public) Internet. +inside local For packets sent to and from a host that resides inside the trusted part of a net-work that uses NAT, a term referring to the IP address used in the headers of those packets when those packets traverse the enterprise (private) part of the network. +integrity In data transfers, means that the network administrator can determine that the information has not been tampered with in transit. + +intent-based networking (IBN) An approach to networking in which the system gives the operator the means to express business intent, with the networking system then determining what should be done by the network, activating the appropriate configuration, and monitoring (assuring) the results. +intercloud exchange A WAN service that provides connectivity between public cloud pro-viders and their customers so that customers can install and keep the WAN connections, even when migrating from one cloud provider to another. +Internet access technology Any technology that an ISP offers that allows its customers to send and receive data to/from the ISP, including serial links, Frame Relay, MPLS, Metro Ethernet, DSL, cable, and fiber Internet. +Internet edge The part of the topology of the Internet that sits between an ISP and the ISP’s customer. + +Internet service provider A company or organization that provides Internet services to cus-tomers; the company may have a heritage as a telco, WAN service provider, or cable company. + +internetwork operating system (IOS) See IOS. +510 intrusion detection system (IDS) + +intrusion detection system (IDS) A security function that examines more complex traf-fic patterns against a list of both known attack signatures and general characteristics of how attacks can be carried out, rating each perceived threat and reporting the threats. +intrusion prevention system (IPS) A security function that examines more complex traf-fic patterns against a list of both known attack signatures and general characteristics of how attacks can be carried out, rating each perceived threat, and reacting to prevent the more sig-nificant threats. See also IPS. +IOS Cisco operating system software that provides the majority of a router’s or switch’s fea-tures, with the hardware providing the remaining features. + +IOS feature set A set of related features that can be enabled on a router to enable certain functionality. For example, the Security feature set would enable the ability to have the router act as a firewall in the network. +IOS File System (IFS) A file system created by a Cisco device that uses IOS. + +IOS image A file that contains the IOS. + +IP Precedence (IPP) In the original definition of the IP header’s Type of Service (ToS) byte, the first 3 bits of the ToS byte, used for marking IP packets for the purpose of applying QoS actions. +IPS See intrusion prevention system. + +IPsec The term referring to the IP Security protocols, which is an architecture for provid-ing encryption and authentication services, usually when creating VPN services through an IP network. +ISDN Integrated Services Digital Network. A communication protocol offered by telephone companies that permits telephone networks to carry data, voice, and video. + +Iterative DNS server A DNS server that will answer DNS requests directly but will not take on the extra work to recursively send other DNS messages to find the answer. + +J +JavaScript A programming language popular for building dynamic web pages, commonly used to run scripts on a web client. + +Jinja2 A text-based language used to define templates, with text plus variables; used by Ansible for templates. + +jitter The variation in delay experienced by successive packets in a single application flow. + +JSON (JavaScript Object Notation) A popular data serialization language, originally used with the JavaScript programming language, and popular for use with REST APIs. + +JSON array A part of a set of JSON text that begins and ends with a matched set of square brackets that contain a list of values. +JSON object A part of a set of JSON text that begins and ends with a matched set of curly brackets that contain a set of key:value pairs. +low latency queue 511 + +K–L +key:value pair In software, one variable name (key) and its value, separated by a colon in some languages and data serialization languages. + +keyboard, video, mouse (KVM) Three components of a typical desktop computer that are typically not included in a modern server because the server is installed and managed remotely. + +KVM (Red Hat) Kernel-Based Virtual Machine (KVM), a server virtualization/hypervisor product from the Red Hat company. + +leaf In an ACI network design, a switch that connects to spine switches and to endpoints, but not to other leaf switches, so that the leaf can forward frames from an endpoint to a spine, which then delivers the frame to some other leaf switch. +library In software, a collection of programs packaged so that it can be posted as available in a software repository, found by others, and installed as one entity, as a means to make it easier to share code. +LISP Locator/ID Separation Protocol. A protocol, defined in RFC 6830, that separates the concepts and numbers used to identify an endpoint (the endpoint identifier) versus identifying the location of the endpoint (routing locator). +LISP mapping database With LISP, the table that contains mapped pairs of endpoint iden-tifiers and routing locators. + +LISP Routing Locator (RLOC) With LISP, a value that identifies the location of an end-point, typically the address of the egress device. + +list variable In applications, a single variable whose value is a list of values, rather than a simple value. + +LLDP Link Layer Discovery Protocol. An IEEE standard protocol (IEEE 802.1AB) that defines messages, encapsulated directly in Ethernet frames so they do not rely on a work-ing IPv4 or IPv6 network, for the purpose of giving devices a means of announcing basic +device information to other devices on the LAN. It is a standardized protocol similar to Cisco Discovery Protocol (CDP). +local loop A line from the premises of a telephone subscriber to the telephone company CO. + +local username A username (with matching password), configured on a router or switch. It is considered local because it exists on the router or switch, and not on a remote server. + +log message A message generated by any computer, but including Cisco routers and switch-es, for which the device OS wants to notify the owner or administrator of the device about some event. +loss A reference to packets in a network that are sent but do not reach the destination host. + +low latency queue In Cisco queuing systems, a queue from which the queue scheduling algorithm always takes packets next if the queue holds any packets. This scheduling choice means that packets in this queue spend little time in the queue, achieving low delay (latency) as well as low jitter. +512 Low Latency Queuing (LLQ) + +Low Latency Queuing (LLQ) The name of a queuing system that can be enabled on Cisco routers and switches by which messages sensitive to latency and jitter are placed in a queue that is always serviced first, resulting in low latency and jitter for those messages. +LTE Literally, Long Term Evolution, but this term is used as a word itself to represent the type of wireless 4G technology that allows faster speeds than the original 4G specifications. + +M +malware Malicious software. + +Management Information Base (MIB) The data structures defined by SNMP to define a hierarchy (tree) structure with variables at the leaves of the tree, so that SNMP messages can reference the variables. +management plane Functions in networking devices and controllers that control the devic-es themselves but that do not impact the forwarding behavior of the devices like control plane protocols do. +man-in-the-middle attack An attack where an attacker manages to position a machine on the network such that it is able to intercept traffic passing between target hosts. + +marking The process of changing one of a small set of fields in various network protocol headers, including the IP header’s DSCP field, for the purpose of later classifying a message based on that marked value. +markup language A language that provides conventions to tag text to identify the type of text, which allows application of different treatments to different types of text. + +match/action logic The basic logic done by a networking element: to receive incoming mes-sages, to match fields in the message, to then use logic based on those matches to take action against the message, and to then forward the message. +MD5 hash A specific mathematical algorithm intended for use in various security protocols. In the context of Cisco routers and switches, the devices store the MD5 hash of certain pass-words, rather than the passwords themselves, in an effort to make the device more secure. +Metro Ethernet The original term used for WAN service that used Ethernet links as the access link between the customer and the service provider. + +MIB See Management Information Base. + +MIB view A concept in SNMPv3 that identifies a subset of an SNMP agent’s MIB for the purpose of limiting access to some parts of the MIB to certain SNMP managers. + +mitigation technique A method to counteract or prevent threats and malicious activity. + +modem Modulator-demodulator. A device that converts between digital and analog signals so that a computer may send data to another computer using analog telephone lines. At the source, a modem converts digital signals to a form suitable for transmission over analog com-munication facilities. At the destination, the analog signals are returned to their digital form. +NAT overload 513 + +MPLS See Multiprotocol Label Switching. + +MPLS experimental bits A 3-bit field in the MPLS label used for QoS marking. + +MPLS VPN A WAN service that uses MPLS technology, with many customers connecting to the same MPLS network, but with the VPN features keeping each customer’s traffic separate from others. +MTU Maximum transmission unit. The maximum packet size, in bytes, that a particular inter-face can handle. + +multifactor authentication A technique that uses more than one type of credential to authenticate users. + +multipoint A topology with more than two devices in it (in contrast to a point-to-point topology, which has exactly two devices). Without any further context, the term multipoint does not define whether all devices in the topology can send messages directly to each other (full mesh) or not (partial mesh). +Multiprotocol BGP (MPBGP) A particular set of BGP extensions that allows BGP to support multiple address families, which when used to create an MPLS VPN service gives the SP the method to advertise the IPv4 routes of many customers while keeping those route advertise-ments logically separated. +Multiprotocol Label Switching (MPLS) A WAN technology used to create an IP-based service for customers, with the service provider’s internal network performing forwarding based on an MPLS label rather than the destination IP address. +multithreading In computer architecture, a process of maximizing the use of a processor core by sharing an individual core among multiple programs, taking advantage of the typical idle times for the core while it waits on various other tasks like memory reads and writes. + +N +name resolution The process by which an IP host discovers the IP address associated with a host name, often involving sending a DNS request to a DNS server, with the server supplying the IP address used by a host with the listed host name. +name server A server connected to a network that resolves network names into network addresses. + +named access list An ACL that identifies the various statements in the ACL based on a name rather than a number. + +NAT Network Address Translation. A mechanism for reducing the need for globally unique IP addresses. NAT allows an organization with addresses that are not globally unique to connect to the Internet, by translating those addresses into public addresses in the globally routable address space. +NAT overload Another term for Port Address Translation (PAT). One of several methods of configuring NAT, in this case translating TCP and UDP flows based on port numbers in addi-tion to using one or only a few inside global addresses. +514 National Institute of Standards and Technology (NIST) + +National Institute of Standards and Technology (NIST) A U.S. federal agency that devel-ops national standards, including standards for cloud computing. + +NBI See northbound API. + +Nest In JSON, the concept that values can contain objects and arrays so that each object can contain other objects and arrays in a myriad of combinations. + +Network Based Application Recognition (NBAR) A Cisco router feature that looks at message details beyond the Layer 2, 3, and 4 headers to identify over 1000 different classifica-tions of packets from different applications. +Network Management System (NMS) Software that manages the network, often using SNMP and other protocols. + +Network Time Protocol (NTP) A protocol used to synchronize time-of-day clocks so that multiple devices use the same time of day, which allows log messages to be more easily matched based on their timestamps. +Next-generation firewall (NGFW) A firewall device with advanced features, including the ability to run many related security features in the same firewall device (IPS, malware detec-tion, VPN termination), along with deep packet inspection with Application Visibility and Control (AVC) and the ability to perform URL filtering versus data collected about the reliabil-ity and risk associated with every domain name. +Next-generation IPS (NGIPS) An IPS device with advanced features, including the capa-bility to go beyond a comparison to known attack signatures to also look at contextual data, including the vulnerabilities in the current network, the capability to monitor for new zero-day threats, with frequent updates of signatures from the Cisco Talos security research group. +Nexus 1000v A Cisco Nexus data center switch that runs as a software-only virtual switch inside one host (one hardware server), to provide switching features to the virtual machines running on that host. +NMS Network Management Station. The device that runs network management software to manage network devices. SNMP is often the network management protocol used between the NMS and the managed device. +northbound API In the area of SDN, a reference to the APIs that a controller supports that gives outside programs access to the services of the controller; for instance, to supply infor-mation about the network or to program flows into the network. Also called a northbound interface. +northbound interface Another term for northbound API. See also northbound API. +notification community An SNMP community (a value that acts as a password), defined on an SNMP manager, which then must be supplied by any SNMP agent that that sends the man-ager any unsolicited SNMP notifications (like SNMP Trap and Notify requests). +NTP client Any device that attempts to use the Network Time Protocol (NTP) to synchro-nize its time by adjusting the local device’s time based on NTP messages received from a server. +OpenFlow 515 + +NTP client/server mode A mode of operation with the Network Time Protocol (NTP) in which the device acts as both an NTP client, synchronizing its time with some servers, and as an NTP server, supplying time information to clients. +NTP primary server A term defined in NTP RFCs 1305 and 5905 to refer to devices that act as NTP servers alone, with a stratum 1 external clock source. + +NTP secondary server A term defined in NTP RFCs 1305 and 5905 to refer to devices that act as NTP clients and servers, synchronizing as a client to some NTP server, and then acting as an NTP server for other NTP clients. +NTP server Any device that uses Network Time Protocol (NTP) to help synchronize time-of-day clocks for other devices by telling other devices its current time. + +NTP synchronization The process with the Network Time Protocol (NTP) by which differ-ent devices send messages, exchanging the devices’ current time-of-day clock information and other data, so that some devices adjust their clocks to the point that the time-of-day clocks list the same time (often accurate to at least the same second). +NVRAM Nonvolatile RAM. A type of random-access memory (RAM) that retains its contents when a unit is powered off. + +O +ODL See OpenDaylight. + +OID Object identifier. Used to uniquely describe an MIB variable in the SNMP database. This is a numeric string that identifies the variable uniquely and also describes where the variable exists in the MIB tree structure. +on-demand self-service One of the five key attributes of a cloud computing service as defined by NIST, referring to the fact that the consumer of the server can request the service, with the service being created without any significant delay and without waiting on human intervention. +one-way delay The elapsed time from sending the first bit of data at the sending device until the last bit of that data is received on the destination device. + +ONF See Open Networking Foundation. + +on-premises An alternate term for private cloud. See also private cloud. + +Open Networking Foundation A consortium of SDN users and vendors who work together to foster the adoption of open SDN in the marketplace. + +OpenDaylight An open-source SDN controller, created by an open-source effort of the OpenDaylight project under the Linux foundation, built with the intent to have a common SDN controller code base from which vendors could then take the code and add further fea-tures and support to create SDN controller products. +OpenFlow The open standard for Software-Defined Networking (SDN) as defined by the Open Networking Foundation (ONF), which defines the OpenFlow protocol as well as the concept of an abstracted OpenFlow virtual switch. +516 operational management + +operational management A component of network management focused on extracting data about the network from the network devices, analyzing that data, and providing the data to operations staff. +OpFlex The southbound protocol used by the Cisco ACI controller and the switches it controls. + +ordered data transfer A networking function, included in TCP, in which the protocol defines how the sending host should number the data transmitted, defines how the receiving device should attempt to reorder the data if it arrives out of order, and specifies to discard the data if it cannot be delivered in order. +origin hardware address In both an ARP request and reply message, the field intended to be used to list the sender (origin) device’s hardware address, typically an Ethernet LAN address. + +origin IP address In both an ARP request and reply message, the field intended to be used to list the sender (origin) device’s IP address. + +outside global With source NAT, the one address used by the host that resides outside the enterprise, which NAT does not change, so there is no need for a contrasting term. + +overlay In SDA, the combination of VXLAN tunnels between fabric edge nodes as a data plane for forwarding frames, plus LISP for the control plane for the discovery and registration of endpoint identifiers. + +P +partial mesh A network topology in which more than two devices could physically commu-nicate, but by choice, only a subset of the pairs of devices connected to the network is allowed to communicate directly. +password guessing An attack where a malicious user simply makes repeated attempts to guess a user’s password. + +per-hop behavior (PHB) The general term used to describe the set of QoS actions a device can apply to a message from the time it enters a networking device until the device forwards the message. PHBs include classification, marking, queuing, shaping, policing, and congestion avoidance. +permit An action taken with an ACL that implies that the packet is allowed to proceed through the router and be forwarded. + +pharming An attack that compromises name services to silently redirect users toward a mali-cious site. +phishing An attack technique that sends specially crafted emails to victims in the hope that the users will follow links to malicious websites. + +Platform as a Service (PaaS) A cloud service intended for software developers as a devel-opment platform, with a variety of tools useful to developers already installed so that develop-ers can focus on developing software rather than on creating a good development environment. +power class 517 + +PoE Power over Ethernet. Both a generalized term for any of the standards that supply power over an Ethernet link, as well as a specific PoE standard as defined in the IEEE 802.3af amendment to the 802.3 standard. +point of presence (PoP) A term used for a service provider’s (SP) perspective to refer to a service provider’s installation that is purposefully located relatively near to customers, with sev-eral spread around major cities, so that the distance from each customer site to one of the SP’s PoPs is short. +point-to-multipoint See hub and spoke. + +point-to-point From a topology perspective, any topology that has two and only two devic-es that can send messages directly to each other. + +policing A QoS tool that monitors the bit rate of the messages passing some point in the processing of a networking device, so that if the bit rate exceeds the policing rate for a period of time, the policer can discard excess packets to lower the rate. +policing rate The bit rate at which a policer compares the bit rate of packets passing through a policing function, for the purpose of taking a different action against packets that conform (are under) to the rate versus those that exceed (go over) the rate. +policy model In both ACI and other intent-based networks (IBNs), the operational conven-tions (model) that combine policies of what the network will provide to grouped sets of net-work endpoints (endpoint groups) to create a contract for what the network will provide. +port (Multiple definitions) (1) In TCP and UDP, a number that is used to uniquely identify the application process that either sent (source port) or should receive (destination port) data. (2) In LAN switching, another term for switch interface. +Port Address Translation (PAT) A NAT feature in which one inside global IP address sup-ports over 65,000 concurrent TCP and UDP connections. + +port number A field in a TCP or UDP header that identifies the application that either sent (source port) or should receive (destination port) the data inside the data segment. + +port security A Cisco switch feature in which the switch watches Ethernet frames that come in an interface (a port), tracks the source MAC addresses of all such frames, and takes a secu-rity action if the number of different such MAC addresses is exceeded. +port-scanner Jargon that refers to a security vulnerability during the time between the day in which the vulnerability was discovered, until the vendor or open-source group responsible for that software can develop a fix and make it public. +power budget With PoE, data and calculations about the amount of power expected to be used by the various powered devices (PDs), the numbers of devices expected to connect to each switch, versus the amount of power available to PoE based on the capacity of the power supplies in the switches. +power class In various PoE standards, a designation that can be sensed/identified via differ-ent discovery processes, with the class defining the maximum amount of power the powered device (PD) would like to receive over the Ethernet link. +518 Power over Ethernet (PoE) + +Power over Ethernet (PoE) Both a generalized term for any of the standards that supply power over an Ethernet link and a specific PoE standard as defined in the IEEE 802.3af amend-ment to the 802.3 standard. +Power over Ethernet Plus (PoE+) A specific PoE standard as defined in the IEEE 802.3at amendment to the 802.3 standard, which uses two wire pairs to supply power with a maximum of 30 watts as supplied by the PSE. +power sourcing equipment (PSE) With any Power over Ethernet standard, a term that refers to the device supplying the power over the cable, which is then used by the powered device (PD) on the other end of the cable. +powered device (PD) With any Power over Ethernet standard, a term that refers to the device that receives or draws its power over the Ethernet cable, with the power being supplied by the power sourcing equipment (PSE) on the other end of the cable. +Priority Code Point (PCP) The formal term for the 3-bit field in the 802.IQ header intend-ed for marking and classifying Ethernet frames for the purposes of applying QoS actions. Another term for Class of Service (CoS). +priority queue In Cisco queuing systems, another term for a low latency queue (LLQ). + +private cloud A cloud computing service in which a company provides its own IT services to internal customers inside the same company but by following the practices defined as cloud computing. +private IP network Any of the IPv4 Class A, B, or C networks as defined by RFC 1918, intended for use inside a company but not used as public IP networks. + +private key A secret value used in public/private key encryption systems. Either encrypts a value that can then be decrypted using the matching public key, or decrypts a value that was previously encrypted with the matching public key. +programmable network A computer network which provides programmatic interfaces that allow automation applications to change and interrogate the configuration of network devices. + +provider edge (PE) A term used by service providers, both generally and also specifically in MPLS VPN networks, to refer to the SP device in a point of presence (PoP) that connects to the customer’s network and therefore sits at the edge of the SP’s network. +public cloud A cloud computing service in which the cloud provider is a different company than the cloud consumer. + +public key A publicly available value used in public/private key encryption systems. Either encrypts a value that can then be decrypted using the matching private key, or decrypts a value that was previously encrypted with the matching private key. +pull model With configuration management tools, a practice by which an agent representing the device requests configuration data from the centralized configuration management tool, in effect pulling the configuration to the device. +Puppet A popular configuration management application, which can be used with or without a server, using a pull model in which agents request details and pull configuration into devices, with the capability to manage network device configurations. +read-write community 519 + +Puppet manifest A human-readable text file on the Puppet master, using a language defined by Puppet, used to define the desired configuration state of a device. + +Puppet master Another term for Puppet server. See also Puppet server. + +Puppet server The Puppet software that collects all the configuration files and other files used by Puppet from different Chef users and then communicates with Puppet agents (devices) so that the agents can synchronize their configurations. +Push model With configuration management tools, a practice by which the centralized con-figuration management tool software initiates the movement of configuration from that node to the device that will be configured, in effect pushing the configuration to the device. +Python A programming language popular as a first language to learn and also popular for network automation tasks. + +Python dictionary A Python variable like a JSON dictionary, containing a set of key:value pairs. + +Python list A Python variable like a JSON array, containing a list of values. + +Q–R +Quality of Experience (QoE) The users’ perception of the quality of their experience in using applications in the network. + +Quality of Service (QoS) The performance of a message, or the messages sent by an appli-cation, in regard to the bandwidth, delay, jitter, or loss characteristics experienced by the message(s). +queuing The process by which networking devices hold packets in memory while waiting on some constrained resource; for example, when waiting for the outgoing interface to become available when too many packets arrive in a short period of time. +RADIUS A security protocol often used for user authentication, including being used as part of the IEEE 802.lx messages between an 802.lx authenticator (typically a LAN switch) and a AAA server. +RAM Random-access memory. A type of volatile memory that can be read and written by a microprocessor. + +rapid elasticity One of the five key attributes of a cloud computing service as defined by NIST, referring to the fact that the cloud service reacts to requests for new services quickly, and it expands (is elastic) to the point of appearing to be a limitless resource. +read-only community An SNMP community (a value that acts as a password), defined on an SNMP agent, which then must be supplied by any SNMP manager that sends the agent any messages asking to learn the value of a variable (like SNMP Get and GetNext requests). +read-write community An SNMP community (a value that acts as a password), defined on an SNMP agent, which then must be supplied by any SNMP manager that sends the agent any messages asking to set the value of a variable (like SNMP Set requests). +520 reconnaissance attack + +reconnaissance attack An attack crafted to discover as much information about a target organization as possible; the attack can involve domain discovery, ping sweeps, port scans, and so on. +recursive DNS server A DNS server that, when asked for information it does not have, per-forms a repetitive (recursive) process to ask other DNS servers in sequence, hoping to find the DNS server that knows the information. +reflection attack An attack that uses spoofed source addresses so that a destination machine will reflect return traffic to the attack’s target; the destination machine is known as the reflector. +remote access VPN A VPN for which one endpoint is a user device, such as a phone, tab-let, or PC, typically created dynamically, and often using TLS. Also called a client VPN. + +Representational State Transfer (REST) A type of API that allows two programs that reside on separate computers to communicate, with a set of six primary API attributes as defined early in this century by its creator, Roy Fielding. The attributes include client/server architecture, stateless operation, cachability, uniform interfaces, layered, and code-on-demand. +resource pooling One of the five key attributes of a cloud computing service as defined by NIST, referring to the fact that the cloud provider treats its resources as a large group (pool) of resources that its cloud management systems then allocate dynamically based on self-service requests by its customers. +REST See Representational State Transfer. + +REST API Any API that uses the rules of Representational State Transfer (REST). + +RESTful API A turn of phrase that means that the API uses REST rules. + +RFC Request For Comments. A document used as the primary means for communicat-ing information about the TCP/IP protocols. Some RFCs are designated by the Internet +Architecture Board (IAB) as Internet standards, and others are informational. RFCs are available online from numerous sources, including www.rfc-editor.org. +root DNS server A small number of DNS servers worldwide that provide name resolution for the root zone of DNS, providing information about servers that know details about top-level domains (TLDs) such as .com, .org, .edu, and so on. +round robin A queue scheduling algorithm in which the scheduling algorithm services one queue, then the next, then the next, and so on, working through the queues in sequence. + +Round Trip Time (RTT) The time it takes a message to go from the original sender to the receiver, plus the time for the response to that message to be sent back. + +round-trip delay The elapsed time from sending the first bit of data at the sending device until the last bit of that data is received on the destination device, plus the time waiting for the destination device to form a reply, plus the elapsed time for that reply message to arrive back to the original sender. +route redistribution A method by which two routing protocol processes running in the same device can exchange routing information, thereby causing a route learned by one routing protocol to then be advertised by another. +shaping rate 521 + +routed access layer A design choice in which all the switches, including the access layer switches that connect directly to endpoint devices, all use Layer 3 switching so that they route packets. +Router on a Stick (ROAS) Jargon to refer to the Cisco router feature of using VLAN trunk-ing on an Ethernet interface, which then allows the router to route packets that happen to enter the router on that trunk and then exit the router on that same trunk, just on a different VLAN. + +S +SBI See Southbound API. + +scalable group In SDA, the concept of a set of related users that should have the equivalent security access. + +scalable group tag (SGT) In SDA, a value assigned to the users in the same security group. + +Secure Shell (SSH) A TCP/IP application layer protocol that supports terminal emulation between a client and server, using dynamic key exchange and encryption to keep the commu-nications private. +Secure Sockets Layer (SSL) A deprecated security protocol that was formerly used to secure networks and was commonly integrated into web browsers to provide encryption and authentication services between the browser and a website. +segment (Multiple definitions) (1) In TCP, a term used to describe a TCP header and its encapsulated data (also called an L4PDU). (2) Also in TCP, the set of bytes formed when TCP breaks a large chunk of data given to it by the application layer into smaller pieces that fit into TCP segments. (3) In Ethernet, either a single Ethernet cable or a single collision domain (no matter how many cables are used). +service provider (SP) A company that provides a service to multiple customers. Used most often to refer to providers of private WAN services and Internet services. See also Internet service provider. +session key With encryption, a secret value that is known to both parties in a communica-tion, used for a period of time, which the endpoints use when encrypting and decrypting data. + +SFTP SSH File Transfer Protocol. A file transfer protocol that assumes a secure channel, such as an encrypted SSH connection, which then provides the means to transfer files over the secure channel. +shaping A QoS tool that monitors the bit rate of the messages exiting networking devices, so that if the bit rate exceeds the shaping rate for a period of time, the shaper can queue the packets, effectively slowing down the sending rate to match the shaping rate. +shaping rate The bit rate at which a shaper compares the bit rate of packets passing through the shaping function, so that when the rate is exceeded, the shaper enables the queuing of packets, resulting in slowing the bit rate of the collective packets that pass through the shaper, so the rate of bits getting through the shaper does not exceed the shaping rate. +522 shared key + +shared key A reference to a security key whose value is known (shared) by both the sender and receiver. + +shared port With 802.lw RSTP, a port type that is determined by the fact that the port uses half duplex, which could then imply a shared LAN as created by a LAN hub. + +Simple Network Management Protocol (SNMP) An Internet standard protocol for man-aging devices on IP networks. It is used mostly in network management systems to monitor network-attached devices for conditions that warrant administrative attention. +simple variable In applications, a variable that has a single value of a simple type, such as text and integer or floating-point numbers. + +single point of failure In a network, a single device or link that, if it fails, causes an outage for a given population of users. + +site-to-site VPN The mechanism that allows all devices at two different sites to communi-cate securely over some unsecure network like the Internet, by having one device at each site perform encryption/decryption and forwarding for all the packets sent between the sites. +sliding windows For protocols such as TCP that allow the receiving device to dictate the amount of data the sender can send before receiving an acknowledgment—a concept called a window—a reference to the fact that the mechanism to grant future windows is typically just a number that grows upward slowly after each acknowledgment, sliding upward. +SNMP See Simple Network Management Protocol. + +SNMP agent Software that resides on the managed device and processes the SNMP mes-sages sent by the Network Management Station (NMS). + +SNMP community A simple password mechanism in SNMP in which either the SNMP agent or manager defines a community string (password), and the other device must send that same password value in SNMP messages, or the messages are ignored. See also read-only commu-nity, read-write community, and notification community. +SNMP Get Message used by SNMP to read from variables in the MIB. + +SNMP Inform An unsolicited SNMP message like a Trap message, except that the protocol requires that the Inform message needs to be acknowledged by the SNMP manager. +SNMP manager Typically a Network Management System (NMS), with this term specifi-cally referring to the use of SNMP and the typical role of the manager, which retrieves status information with SNMP Get requests, sets variables with the SNMP Set requests, and receives unsolicited notifications from SNMP agents by listening for SNMP Trap and Notify messages. +SNMP Set SNMP message to set the value in variables of the MIB. These messages are the key to an administrator configuring the managed device using SNMP. + +SNMP Trap An unsolicited SNMP message generated by the managed device, and sent to the SNMP manager, to give information to the manager about some event or because a mea-surement threshold has been passed. +SNMPv2c A variation of the second version of SNMP. SNMP Version 2 did not originally support communities; the term SNMPv2c refers to SNMP version 2 with support added for SNMP communities (which were part of SNMPvl). +spoofing attack 523 + +SNMPv3 The third version of SNMP, with the notable addition of several security features as compared to SNMPv2c, specifically message integrity, authentication, and encryption. + +social engineering Attacks that leverage human trust and social behaviors to divulge sensi-tive information. + +Software as a Service (SaaS) A cloud service in which the service consists of access to working software, without the need to be concerned about the details of installing and main-taining the software or the servers on which it runs. +Software-Defined Access Cisco’s intent-based networking (IBN) offering for enterprise networks. + +software-defined architecture In computer networking, any architecture that provides mechanisms for automated software control of the network components, typically using a con-troller. Any architecture that leads to a Software-Defined Network (SDN). +Software-Defined Networking (SDN) A branch of networking that emerged in the market-place in the 2010s characterized by the use of a centralized software controller that takes over varying amounts of the control plane processing formerly done inside networking devices, with the controller directing the networking elements as to what forwarding table entries to put into their forwarding tables. +SOHO A classification of a business site with a relatively small number of devices, sometimes in an employee office in their home. + +Source NAT The type of Network Address Translation (NAT) used most commonly in net-works (as compared to destination NAT), in which the source IP address of packets entering an inside interface is translated. +southbound API In the area of SDN, a reference to the APIs used between a controller and the network elements for the purpose of learning information from the elements and for +programming (controlling) the forwarding behavior of the elements. Also called a southbound interface. +southbound interface Another term for southbound API. See also southbound API. +spear phishing Phishing that targets a group of users who share a common interest or connection. + +spine In an ACI network design for a single site, a switch that connects to leaf switches only, for the purpose of receiving frames from one leaf switch and then forwarding the frame to some other leaf switch. +spine-leaf network A single-site network topology in which endpoints connect to leaf switches, leaf switches connect to all spine switches (but not to other leaf switches), and spine switches connect to all leaf switches (but not to other spine switches). The resulting topology results in predictable switching paths with three switches between any two endpoints that con-nect to different leaf switches. +spoofing attack A type of attack in which parameters such as IP and MAC addresses are spoofed with fake values to disguise the sender. +524 spurious DHCP server + +spurious DHCP server A DHCP server that is used by an attacker for attacks that take advantage of DHCP protocol messages. + +SSL See Secure Sockets Layer. + +standard access list A list of IOS global configuration commands that can match only a packet’s source IP address for the purpose of deciding which packets to discard and which to allow through the router. +star topology A network topology in which endpoints on a network are connected to a common central device by point-to-point links. + +stateful A protocol or process that requires information stored from previous transactions to perform the current transaction. + +stateless A protocol or process that does not use information stored from previous transac-tions to perform the current transaction. + +subinterface One of the virtual interfaces on a single physical interface. + +switch abstraction The fundamental idea of what a switch does, in generalized form, so that standards protocols and APIs can be defined that then program a standard switch abstrac-tion; a key part of the OpenFlow standard. +syslog A server that takes system messages from network devices and stores them in a data-base. The syslog server also provides reporting capabilities on these system messages. Some syslog servers can even respond to select system messages with certain actions such as emailing and paging. +syslog server A server application that collects syslog messages from many devices over the network and provides a user interface so that IT administrators can view the log messages to troubleshoot problems. + +T +T1 A line from the telco that allows transmission of data at 1.544 Mbps, with the capability to treat the line as 24 different 64-Kbps DSO channels (plus 8 Kbps of overhead). + +T3 A line from the telco that allows transmission of data at 44.736 Mbps, with the capability to treat the line as 28 different 1.544-Mbps DS1 (Tl) channels, plus overhead. + +TACACS+ A security protocol often used for user authentication as well as authorization and accounting, often used to authenticate users who log in to Cisco routers and switches. + +tail drop Packet drops that occur when a queue fills, another message arrives that needs to be placed into the queue, and the networking device tries to add the new message to the tail of the queue but finds no room in the queue, resulting in a dropped packet. +target hardware address In both an ARP request and reply message, the field intended +to be used to list the destination (target) device’s hardware address, typically an Ethernet LAN address. This field is left as all binary 0s for typical ARP request messages. +top-level domain (TLD) 525 + +target IP address In both an ARP request and reply message, the field intended to be used to list the destination (target) device’s IP address. + +TCAM See ternary content-addressable memory. + +TCP Transmission Control Protocol. A connection-oriented transport layer TCP/IP protocol that provides reliable data transmission. + +TCP window The mechanism in a TCP connection used by each host to manage how much data the receiver allows the sender to send to the receiver. + +TCP/IP Transmission Control Protocol/Internet Protocol. A common name for the suite of protocols developed by the U.S. Department of Defense in the 1970s to support the construc-tion of worldwide internetworks. TCP and IP are the two best-known protocols in the suite. +telco A common abbreviation for telephone company. + +ternary content-addressable memory (TCAM) A type of physical memory, either in a separate integrated circuit or built into an ASIC, that can store tables and then be searched against a key, such that the search time happens quickly and does not increase as the size of the table increases. TCAMs are used extensively in higher-performance networking devices as the means to store and search forwarding tables in Ethernet switches and higher-performance routers. +TFTP Trivial File Transfer Protocol. An application protocol that allows files to be trans-ferred from one computer to another over a network, but with only a few features, making the software require little storage space. +TFTP client An application that can connect to a TFTP server for the purpose of transferring copies of files to and from the server. + +TFTP server An application that runs and waits for TFTP clients to connect to it over UDP port 69 to support the client’s commands to transfer copies of files to and from the server. + +threat An actual potential to use an exploit to take advantage of a vulnerability. + +three-tier design See core design. + +time interval (shaper) Part of the internal logic used by a traffic shaping function, which defines a short time period in which the shaper sends packets until a number of bytes are sent, and then the shaper stops sending for the rest of the time interval, with a goal of averaging a defined bit rate of sending data. +TLD DNS server A DNS server with the role of identifying the IP address of the authorita-tive DNS server for a domain that resides within its top-level domain. + +Top of Rack (ToR) switch In a traditional data center design with servers in multiple racks and the racks in multiple rows, a switch placed in the top of the rack for the purpose of pro-viding physical connectivity to the servers (hosts) in that rack. +top-level domain (TLD) With DNS name services, the top-level domain is the most signifi-cant (rightmost) of the period-separated values in a DNS host name—for example, the .com within host name www.example.com. +526 Transport Layer Security (TLS) + +Transport Layer Security (TLS) A security standard that replaced the older Secure Sockets Layer (SSL) protocol, providing functions such as authentication, confidentiality, and message integrity over reliable in-order data streams like TCP. +trojan horse Malware that is hidden and packaged inside other legitimate software. + +trust boundary When thinking about a message as it flows from the source device to the destination device, the trust boundary is the first device the message reaches for which the QoS markings in the message’s various headers can be trusted as having an accurate value, allowing the device to apply the correct QoS actions to the message based on the marking. +trusted port With both the DHCP snooping and Dynamic ARP Inspection (DAI) switch features, the concept and configuration setting that tells the switch to allow all incoming mes-sages of that respective type, rather than to consider the incoming messages (DHCP and ARP, respectively) for filtering. +tunnel interface A virtual interface in a Cisco router used to configure a variety of features, including Generic Routing Encapsulation (GRE), which encapsulates IP packets into other IP packets for the purpose of creating VPNs. +two-tier design See collapsed core design. + +Type of Service (ToS) In the original definition of the IP header, a byte reserved for the purpose of QoS functions, including holding the IP Precedence field. The ToS byte was later repurposed to hold the DSCP field. + +U +UDP User Datagram Protocol. Connectionless transport layer protocol in the TCP/IP pro-tocol stack. UDP is a simple protocol that exchanges datagrams without acknowledgments or guaranteed delivery. +uncacheable For resources that might be repeatedly requested over time, an attribute that means that the requesting host should not use its local copy of the resource, but instead ask for a new copy every time the resource is required. +underlay In SDA, the network devices and links that create basic IP connectivity to support the creation of VXLAN tunnels for the overlay. + +Unified Computing System (UCS) The Cisco brand name for its server hardware products. + +Universal Power over Ethernet (UPoE) A specific PoE standard as defined in the IEEE 802.3bt amendment to the 802.3 standard, which uses four wire pairs to supply power with a maximum of 60 watts as supplied by the PSE. +Universal Power over Ethernet Plus (UPoE+) A specific PoE standard as defined in the IEEE 802.3bt amendment to the 802.3 standard, which uses four wire pairs to supply power with a maximum of 100 watts as supplied by the PSE. +untrusted port With both the DHCP snooping and Dynamic ARP Inspection (DAI) switch features, the concept and configuration setting that tells the switch to analyze each incoming message of that respective type (DHCP and ARP) and apply some rules to decide whether to discard the message. +virtual MAC address (vMAC) 527 + +UPoE Universal Power over Ethernet. A specific PoE standard as defined in IEEE 802.3bt amendment to the 802.3 standard, which uses four wire pairs to supply power with a maximum of 60 watts as supplied by the PSE. +URI Uniform Resource Identifier. The formal and correct term for the formatted text used to refer to objects in an IP network. This text is commonly called a URL or a web address. For example, http://www.certskills.com/blog is a URI that identifies the protocol (HTTP), host name (www.certskills.com), and web page (blog). +URI parameters See URI query (parameters). + +URI path (resource) In a URI, the part that follows the first /, up to the query field (which begins with a ?), which identifies the resource in the context of a server. + +URI query (parameters) In a URI, the part that follows the first ?, which provides a place to list variable names and values as parameters. + +URI resource See URI path (resource). + +URL Uniform Resource Locator. The widely popular terms for the formatted text used to refer to objects in an IP network. For example, http://www.certskills.com/blog is a URL that identifies the protocol (HTTP), host name (www.certskills.com), and web page (blog). +user network interface (UNI) A term used in a variety of WAN standards, including car-rier/Metro Ethernet, that defines the standards for how a customer device communicates with a service provider’s device over an access link. +username secret A reference to the password configured on the username name secret pass-value command, which defines a username and an encoded password, used to build a local username/password list on the router or switch. + +V +variable In applications, a method to assign a name to a value so that the application can refer to the value, change it, compare it to other values, apply logic, and perform other actions typical of software applications. +version control software Applications that monitor files for changes, tracking each spe-cific change, the user, the date/time, with tools so that users can compare versions of each file through its history to see the differences. +violation mode In port security, a configuration setting that defines the specific set of actions to take on a port when a port security violation occurs. The modes are shutdown, restrict, and protect. +virtual CPU (vCPU) In a virtualized server environment, a CPU (processor) core or thread allocated to a virtual machine (VM) by the hypervisor. + +virtual IP address For any FHRP protocol, an IP address that the FHRP shares between multiple routers so that they appear as a single default router to hosts on that subnet. + +virtual MAC address (vMAC) For any FHRP protocol, a MAC address that the FHRP uses to receive frames from hosts. +528 virtual machine + +virtual machine An instance of an operating system, running on server hardware that uses a hypervisor to allocate a subset of the server hardware (CPU, RAM, disk, and network) to that VM. +virtual network function (VNF) Any function done within a network (for example, router, switch, firewall) that is implemented not as a physical device but as an OS running in a virtual-ized system (for instance, a VM). +virtual network identifier (VNID) In SDA and VXLAN, the identifier for a separate rout-ing and switching instance. All devices in the same VNID are considered to be allowed to send data to each other unless prevented from doing so by other security mechanisms. +virtual NIC (vNIC) In a virtualized server environment, a network interface card (NIC) used by a virtual machine, which then connects to some virtual switch (vSwitch) running on that same host, which in turn connects to a physical NIC on the host. +virtual private network (VPN) A set of security protocols that, when implemented by two devices on either side of an unsecure network such as the Internet, can allow the devices to send data securely. VPNs provide privacy, device authentication, anti-replay services, and data integrity services. +Virtual Router Redundancy Protocol (VRRP) A TCP/IP RFC protocol that allows two (or more) routers to share the duties of being the default router on a subnet, with an active/ standby model, with one router acting as the default router and the other sitting by waiting to take over that role if the first router fails. +virtual switch (vSwitch) A software-only virtual switch inside one host (one hardware serv-er), to provide switching features to the virtual machines running on that host. + +virus Malware that injects itself into other applications and then propagates through user intervention. + +VPN See virtual private network. + +VPN client Software that resides on a PC, often a laptop, so that the host can implement the protocols required to be an endpoint of a VPN. + +vulnerability A weakness that can be used to compromise security. + +VXLAN Virtual Extensible LAN. A flexible encapsulation protocol used for creating tunnels (overlays). + +W +WAN edge The device (typically a router) at enterprise sites that connects to private WAN links, therefore sitting at the edge of the WAN. + +WAN link Another term for leased line. + +WAN service provider A company that provides private WAN services to customers; the company may have a heritage as a telco or cable company. +zero-day vulnerability 529 + +watering hole attack An attack where a site frequently visited by a group of users is com-promised; when the target users visit the site, they will be infected with malware, but other users will not. +web server Software, running on a computer, that stores web pages and sends those web pages to web clients (web browsers) that request the web pages. + +well-known port A TCP or UDP port number reserved for use by a particular application. The use of well-known ports allows a client to send a TCP or UDP segment to a server, to the correct destination port for that application. +whaling A phishing technique that targets high-profile individuals to follow links to mali-cious sites. + +wildcard mask The mask used in Cisco IOS ACL commands and OSPF and EIGRP network commands. + +window Represents the number of bytes that can be sent without receiving an acknowledgment. + +worm Malware that propagates from one system to another, infecting as it goes, all autonomously. + +write community See read-write community. + +X–Y–Z +XML (eXtensible Markup Language) A markup language that helps enable dynamic web pages; also useful as a data serialization language. + +YAML (YAML Ain’t Markup Language) A data serialization language that can be easily read by humans; used by Ansible. + +zero-day vulnerability Jargon that refers to a security vulnerability during the time between the day in which the vulnerability was discovered, until the vendor or open-source group responsible for that software can develop a fix and make it public. + + +Index + + + + + +Numbers + +2-tier campus design, 291-293 3G wireless, 320 +3-tier campus design, 293-295 4G wireless, 320-321 +5G wireless, 320 +802.1Q headers, 237-238 802.11 headers, 238 + +A + +AAA (Authentication, Authori-zation, Accounting), 82-83 +aaS (as a Service), 339 access +Internet, 317-321 +public cloud services, 342-346 security +physical access control, 84 user access, 82-83 +user awareness/training, 83 access-class command, 62, 95, 105 access links +MetroE, 306 +MPLS, 314 + + +access-list 101 command, 60 +access-list command, 33-35, 42, 46-50, 54, 62, 397 +any keyword, 34 +building ACLs with, 39-40 deny keyword, 34 +examples and logic explanations, 50 +extended numbered ACL configu-ration commands, 51 +log keyword, 38 +permit keyword, 31, 34 +reverse engineering from ACL to address range, 40-41 +tcp keyword, 48 upd keyword, 48 +access switches, 291, 295 accounting (AAA), 82-83 +ACE (Access Control Entries), 397-398 +ACI (Application Centric Infra-structure), 369, 373 +IBN, 371 +leaf switches, 370 spine switches, 370 +ACK flags, 12 + + +ACLs (Access Control Lists), 397-398 +ARP ACL, 159 classification, 235 +comparison of ACL types, 28 +controlling Telnet and SSH access with, 95 +deny all statements, 31 +extended numbered ACLs, 46-54 +implementation considerations, 59-60 +location and direction, 26-27 matching packets, 27 +named ACLs, 54-58 numbered ACLs, 58-59 overview, 26 +QoS tools, compared, 233 SDA, 399 +SNMP security, 267 +standard numbered ACLs, 29-41 troubleshooting, 222 +active mode (FTP), 276 addresses. See also ACLs +any/all IP addresses, matching, 34 CIDR, 205-206 +inside global, 209 inside local, 209 IP addresses +commands, 139-140 destination IP addresses, 95 +DNS IP addresses, 128 + + +origin IP addresses, 157-159, 163-164 +RELEASE messages, filtering based on IP addresses, 151 +IPv4, 204 +CIDR, 205-206 +dynamic IP address configu-ration with DHCP, 131 +host settings, 133-140 matching addresses, 31-34 NAT, 202, 207-223 private addressing, 206 QoS marking, 237 routing, 26, 223 scalability, 204-205 +IPv6, QoS marking, 237 MAC addresses, 109, 113 NAT, 202, 207-222 private addressing, 206 scalability, 204-205 spoofing attacks, 72 +amplification attacks, 75 DDoS attacks, 75 +DoS attacks, 73-74 +Man-in-the-Middle attacks, 76-77 +reflection attacks, 75 AF (Assured Forwarding), 240 AF DiffServ RFC (2597), 240 AF DSCP value marking, 240 agents, SNMP, 264-267 +allocation, DHCP, 129 +532 Amazon Web Services (AWS) + + + +Amazon Web Services (AWS), 340 amplification attacks, 75 +Ansible, 422, 438-439, 442 answering exam questions, 456-457 anti-replay (Internet VPNs), 321 any/all IP addresses, matching, 34 any keyword, 34 +AnyConnect Secure Mobility Client, 325 +APIs (Application Programming Interfaces), 364 +DNA Center, 415 JSON +arrays, 424-426 beautified JSON, 426 +data serialization, 418-423 key:value pairs, 423-426 minified JSON, 426 objects, 424-426 +REST APIs, 418, 422-423 REST, 366 +REST APIs, 408 +cacheable resources, 410 +client/server architecture, 409, 419-420 +data structures, 411-412 dictionary variables, 411-412 DNA Center calls, 417-418 HTTP, 413-416 +JSON, 422-423 key:value pairs, 412 +list variables, 411-412 + + +simple variables, 410-411 stateless operation, 410 +RESTful, 366 +XML, data serialization, 421-423 YAML, data serialization, 422-423 +APIC (Application Policy Infra-structure Controller), 372 +APIC-EM (Application Policy Infra-structure Controller-Enterprise Module), 373-374 +app (application) servers, 371 +Application Centric Infrastructure. See ACI +Application Programming Interfaces. See APIs +application signatures, 236 +Application-Specific Integrated Circuit (ASIC), 362 +architectures, SDN, 367-369, 373-375 +arp -a command, 142 +ARP ACL (Address Resolution Protocol Access Control Lists), 159 +ARP messages DAI, 156 +filtering MAC addresses, 159 logic of, 158 +gratuitous ARP as an attack vector, 157-158 +origin hardware addresses, 159-160 +arrays (JSON), 424-426 +as a Service (-aaS), 339 +branch offices public cloud example 533 + + + +ASA (Adaptive Security Appliance) firewall, 96 +ASIC (Application-Specific Inte-grated Circuit), 362 +Assured Forwarding (AF), 240 attacks (security) +amplification attacks, 75 +ARP messages (gratuitous), 157-158 +brute-force attacks, 80 buffer overflow attacks, 78 DDoS attacks, 75 +DHCP-based attacks, 147 dictionary attacks, 80 DoS attacks, 73-74 malware, 78-79 +Man-in-the-Middle attacks, 76-77 password guessing, 80 +pharming attacks, 79 phishing attacks, 79 reconnaissance attacks, 77-78 reflection attacks, 75 smishing attacks, 79 +social engineering attacks, 79 spear phishing attacks, 79 spoofing attacks, 72-77 Trojan horses, 78 +viruses, 78 +vishing attacks, 79 watering hole attacks, 79 whaling attacks, 79 +worms, 78 + + +AUTH command, 279 authentication (AAA), 82-83 +Internet VPNs, 321 SNMPv3, 268 +authorization (AAA), 82-83 automatic allocation, 129 automation +configuration automation files, 437 +network management, 376-378 +AVC (Application Visibility and Control) +NGFW, 101 NGIPS, 103 +AWS (Amazon Web Services), 340 + + +B + +bandwidth, managing, 228 batch traffic, 230 beautified JSON, 426 binary wildcard masks, 33 +binding tables (DHCP snooping), 150 +biometric credentials (security), 81 blocks (CIDR), 206 +boot system command, 281 +branch offices public cloud example +email services traffic flow, 347-349 +Internet connections, 349 +private WAN connections, 349 +534 broadcast flags + + + +broadcast flags, 125 browsing web +HTTP, 16-17, 20-21 URIs, 17-18 +URLs, 17 +brute-force attacks, 80 budgeting time (exams), 450-451 buffer overflow attacks, 78 + +C + +cable Internet, 319-320 +CAC (Call Admission Control) tools, 245 +cacheable resources (REST API), 410 +campus LANs overview, 290 +three-tier campus design, 293-295 topology design terminology, 295 two-tier campus design, 290-293 +CBWFQ (Class-Based Weighted Fair Queuing), 243 +CDP (Cisco Discovery Protocol) configuration, 193-194 +discovering information about neighbors, 190-193 +verification, 193-194 cdp enable command, 200 cdp run command, 200 CE (Customer Edge), 313 +centralized configuration files, 432 +centralized control planes, 363 + +certificates (digital), security, 81 +chapter reviews (exam preparation), 464 +checklists (practice exams), 455, 459 +Chef, 438, 441-442 +CIDR (Classless Interdomain Routing), 205-206 +CIR (Committed Information Rate), 247 +Cisco Discovery Protocol. See CDP +Cisco Learning Network, exam preparation, 464 +Cisco Prime management products website, 264 +Class-Based Weighted Fair Queuing (CBWFQ), 243 +Class of Service (CoS) field (802.1Q header), 237 +Class Selector (CS), 241 classification, QoS, 233-236 +clear ip nat translation command, 211, 219, 225 +clear logging command, 179 +clear-text passwords, SNMP, 267 +CLI (Command-Line Interface), practicing with (exam prepa-ration), 460-461 +clients +NTP, 183-186 VPNs, 325 +clock set command, 182-183 +clock summer-time command, 183, 200 +commands 535 + + + +clock timezone command, 183, 200 cloud computing, 328, 336 +“as a service” model, 339-342 cloud services catalogs, 338 CSRs, 344 +IaaS, 339-340 PaaS, 341-342 private, 337-338 +public, 337-339, 342-349 SaaS, 341 +services, 336-337 +cloud services catalogs, 338 +Cloud Services Routers (CSRs), 344 codecs, 231 +collapsed core design, 290-293 commands +access-class, 62, 95, 105 +access-list, 31-35, 38-51, 54, 62, 397 +access-list 101, 60 arp -a, 142 AUTH, 279 +boot system, 281 cdp enable, 200 cdp run, 200 +clear ip nat translation, 211, 219, 225 +clear logging, 179 clock set, 182-183 +clock summer-time, 183, 200 clock timezone, 183, 200 configure, 430 +copy, 270-271, 274-275, 282 + +copy ftp flash, 274 +copy running-config startup-config, 112, 428 +copy tftp flash, 271 +crypto key generate rsa, 105 debug, 177, 180-181, 201 debug ip nat, 219, 225 debug ip rip, 180 +deny, 55-57, 62 dig, 78 +dir, 272, 282 +enable password, 90, 105 enable secret, 90-94 ifconfig, 134, 137-142 Interface loopback, 200 +ip access-group, 36, 43, 51, 60-62 ip access-list, 55, 62 +ip access-list extended, 56 ip address, 139-140 +ip address dhcp, 132 +ip arp inspection validate, 164 +ip dhcp snooping information option, 153 +ip ftp password, 281 ip ftp username, 281 +ip helper-address, 125-127, 141 ip nat, 225 +ip nat inside, 213, 215, 220-222 ip nat inside source, 217, 225 +ip nat inside source list, 220-222 ip nat inside source list pool, 216 +ip nat inside source static, 213-215, 222 +536 commands + + + +ip nat outside, 213-215, 220-222 ip nat pool, 216, 225 +ip nat pool netmask, 215 ip route configuration, 133 ipconfig, 134, 142 +line console, 105 line vty, 105 +lldp holdtime, 198 lldp receive, 201 lldp run, 197, 201 lldp timer, 198 lldp transmit, 201 logging, 200 +logging buffered, 175, 179, 200 logging buffered warning, 181 logging console, 174, 200 logging host, 175 +logging monitor, 175, 200 logging monitor debug, 181 logging trap, 200 +logging trap 4, 181 login, 105 +login local, 105 more, 270 +netstat -rn, 136-142 no cdp enable, 193 no enable secret, 105 +no ip access-group, 60 +no ip dhcp snooping information option, 152-153 +no logging console, 177 +no logging monitor, 177 + +no service password-encryption, 90 +no shutdown, 115, 121, 179 nslookup, 78 +ntp master, 183-185, 188, 200 ntp server, 183, 188, 200 +ntp source, 200 password, 90, 105 PASV, 278 permit, 55-57, 62 PORT, 277-278 port-security, 111 remark, 55, 62 +service password-encryption, 89-90, 105 +service sequence-numbers, 200 show access-lists, 35, 43, 56, 62 show arp, 142 +show cdp, 193-194, 197-198, 201 show cdp entry, 190, 193 +show cdp interface, 193-194 show cdp neighbors, 190-195 +show cdp neighbors detail, 190-193 +show cdp traffic, 193-194 show clock, 201 +show dhcp lease, 131 show flash, 270-272, 282 show interfaces, 115, 121 +show interfaces loopback, 201 show interfaces status, 115-116 show interfaces switchport, 377 +show interfaces vlan, 131 +Committed Information Rate (CIR) 537 + + + +show ip access-list, 43, 57, 59 show ip access-lists, 35, 59, 62 show ip arp, 142 +show ip arp inspection, 161-163 show ip default-gateway, 132 show ip dhcp conflict, 142 +show ip dhcp snooping, 153-155 +show ip dhcp snooping binding, 162 +show ip interface, 36, 43, 130 +show ip nat statistics, 215-222, 225 +show ip nat translations, 214-225 show lldp, 201 +show lldp entry, 196 show lldp interface, 198 show lldp neighbors, 195 +show logging, 175-178, 201 +show mac address-table dynamic, 113-114, 121, 167 +show mac address-table secure, 113-114, 121 +show mac address-table static, 113, 121 +show ntp associations, 184-186, 201 +show ntp status, 184, 201 +show port-security, 115-116, 121 +show port-security interface, 112-121 +show process cpu, 181 +show running-config, 35, 56-59, 105, 121, 167, 270 + +show running-config | interface, 121, 167 +show running-config command, 35, 89 +show startup-config, 270 shutdown, 115, 121, 179, 182 ssh, 95 +switchport mode, 120, 167, 377 switchport mode access, 110-111 switchport mode trunk, 110 switchport port-security, 110-111 +switchport port-security mac-address, 110-111, 120 +switchport port-security mac-address sticky, 110-111, 120, 167 +switchport port-security maximum, 110, 120 +switchport port-security violation, 110, 114, 120 +telnet, 95 +terminal monitor, 175, 181, 201 terminal no monitor, 201 transport input, 105 +transport input ssh command, 89 username, 105 +username password, 94 username secret, 94 verify, 273, 282 +verify /md5, 273, 282 whois, 78 +Committed Information Rate (CIR), 247 +538 communities (SNMP) + + + +communities (SNMP), 267 +Community-based SNMP Version 2 (SNMPv2c), 267 +community strings (SNMP), 267 confidentiality, Internet VPNs, 321 configuration +ACLs, 34-38 +Ansible, 438-439, 442 automation files, 437 CDP, 193-194 +centralized configuration files, 432 +Chef, 438, 441-442 DAI, 160-165 DHCP, 131 +relays, 130 snooping, 152-156 +drift, 430-431 +extended numbered ACLs, 51-54 IPv4, 131 +LLDP, 197-198 management, 428-430 monitoring, 433 named ACLs, 55-56 NAT, 214-222 +NTP +client/server, 183-184 +redundant configuration, 186-188 +numbered ACLs, 58-59 +per-device configuration model, 431 +provisioning, 434-435 + +Puppet, 438-442 +routers as DHCP clients, 132-133 switches +as DHCP clients, 130-132 interfaces, 108-113 +Syslog, 178-180 templates, 435-437 variables, 435-437 VMs, 334 +configure command, 430 congestion +avoidance, 250-251 management +LLQ, 243-245 multiple queues, 242 prioritization, 242 +round robin scheduling, 243 strategy, 245 +connectionless protocols, 13 connections +connection-oriented protocols, 13 +establishment and termination (TCP), 12-13 +public cloud access, 342-346 public cloud branch offices, 349 +contextual awareness, NGIPS, 103 control connection (FTP), 277 +control plane (networking devices), 360-363 +controllers +centralized control, 363 +defined, 362 +decimal wildcard masks 539 + + + +networks, 375-379 NBIs, 365-366 +OpenDaylight SDN controller, 368 +OSC, 369 SBIs, 364 +copy command, 270-271, 274-275, 282 +copy ftp flash command, 274 +copy running-config startup-config command, 112, 428 +copy tftp flash command, 271 copying IOS images, 271-274 core design, 293-295 +CoS (Class of Service) field (802.1Q header), 237-238 +CRUD actions (software), 413-414 +crypto key generate rsa command, 105 +CS (Class Selector), 241 +CS DSCP values, marking, 241 CSRs (Cloud Services Routers), 344 customer edge (CE), 313 + +D + +DAI (Dynamic ARP Inspection), 156 +configuring, 160-165 layer 2 switches, 160-163 logic of, 158 +MAC addresses, filtering, 159 + +message checks, 164-165 message rate limits, 163-164 +data application traffic, 229-230 data centers (virtual) +networking, 333 +physical networks, 334-335 vendors, 333 +workflow, 335-336 +data connection (FTP), 277 +data integrity, Internet VPNs, 321 +data plane (networking devices), 359-361 +data serialization JSON, 418-422 +arrays, 424-426 beautified JSON, 426 key:value pairs, 423-426 minified JSON, 426 objects, 424-426 +XML, 421-423 YAML, 422-423 +data structures, 411-412 databases +MIB, 264-267 +signature databases and IPS, 99 DB (Database) servers, 371 +DDoS (Distributed Denial-of-Service) attacks, 75 +debug command, 177-181, 201 debug ip nat command, 219, 225 debug ip rip command, 180 +decimal wildcard masks, 31-32 +540 default routers, verification + + + +default routers, verification, 136-140 +delay, managing, 229 +deleting single points of failure, 258-259 +demilitarized zones (DMZ), 98 denial of service (DoS) attacks, 97 deny all statements, 31 +deny command, 55-57, 62 deny keyword, 28, 34 destination IP +addresses, 95 matching, 46-48 +destination port numbers, 8-9 devices +hardening +controlling Telnet and SSH access with ACLs, 95 +firewalls, 96-97 management protocols +CDP, 190-194 LLDP, 194-198 NTP, 181-189 Syslog, 174-181 +networking, 359-363 +per-device configuration model, 431 +security +device hardening, 95-97 IOS passwords, 88-94 +DHCP (Dynamic Host Configu-ration Protocol), 122 +advantages of, 124 +automatic allocation, 129 + +broadcast flags, 125 +DHCP Relay, 126-127, 130 dynamic allocation, 129 +information stored at DHCP server, 128 +overview, 124-126 relays +configuring, 130 supporting, 126-127 troubleshooting, 130 +routers, 128, 132-133 rules of, 149 +servers, 128 snooping, 146 +binding tables, 150 configuring, 152-156 DHCP-based attacks, 147 +DHCP message rate limits, 154-156 +DISCOVER messages, 150 layer 2 switches, 152-154 logic of, 148-149 RELEASE messages, 151 +static allocation, 129 +switches, configuring as DHCP clients, 130-132 +troubleshooting, 130 dictionary attacks, 80 +dictionary variables, REST APIs, 411-412 +Differentiated Services Code Point (DSCP), 234 +Eclipse IDE 541 + + + +DiffServ DSCP marking values AF, 240 +CS, 241 EF, 240 +dig command, 78 +digital certificates (security), 81 digital subscriber lines (DSLs), 318 dir command, 272, 282 +direction (ACLs), 26-27 +DISCOVER messages, filtering based on MAC addresses, 150 +disk file systems, 270 distributed control planes, 363 distribution switches, 291, 295 DMZ (Demilitarized Zones), 98 DNA Center, 384, 389, 395 +APIs, 415 +IP security, 397-398 +network management, 400-401 Path Trace feature, 403 +PI, 400-401 +REST API calls, 417-418 scalable groups, 396 SDA +SGT, 399 +user group security, 398-399 SGT, 399 +topology map, 401-403 traditional management +differences with, 402-403 similarities to, 401 +VXLAN tunnels, 399 + +DNS (Domain Name System), 11 DNS IP addresses, 128 +DNS IP servers, 128 recursive DNS lookups, 19 web servers, finding, 18-20 +DoS (Denial-of-Service) attacks, 73-74, 97 +DSCP (Differentiated Services Code Point), 234 +DSCP fields (QoS marking), 238 marking values, 240-241 +DSLs (Digital Subscriber Lines), 318 +DSLAMs (DSL access multiplexers), 318 +dynamic allocation, 129 +dynamic (ephemeral, private) ports, 9 +Dynamic Host Configuration Protocol. See DHCP +dynamic IP address configuration, 131 +dynamic NAT (Network Address Translation) +configuration, 215-217 overview, 210-211 troubleshooting, 222 verification, 217-219 +dynamic windows, 15-16 + + +E + +earplugs (exam preparation), 451 +Eclipse IDE, 341 +542 editing named ACLs + + + +editing named ACLs, 56-58 +EF (Expedited Forwarding), 238 EF DSCP value marking, 240 +EF RFC (RFC 3246), 240 +EID (Endpoint Identifiers), 392 +E-LAN (Ethernet LAN) service, 308, 311 +elasticity, cloud computing, 337 +E-Line (Ethernet Line) service, 307-310 +email, public cloud branch office traffic flow, 347-349 +enable password command, 90, 105 enable secret command, 90-94 +encoding IOS passwords with hashes, 90-94 +encryption +IOS passwords, 89-90 IPsec, 323-324 +keys, 323 SNMPv3, 268 +End-to-End QoS Network Design, Second Edition (Cisco Press), 232 +endpoints, EPGs, 371 +Enterprise QoS Solution Reference Network Design Guide, 232 +enterprises, classification matching, 234 +EPGs (Endpoint Groups), 371 +ephemeral (dynamic, private) ports, 9 +eq 21 parameters, 49 +err-disabled state, 115 + +err-disabling recovery, trouble-shooting, 117 +error detection, 6 +error recovery, 6, 13-14 Ethernet +802.1Q headers, 237-238 802.11 headers, 238 access links, 306 +IEEE standards, 306 PoE, 297-299 +Ethernet LAN (E-LAN) service, 308 Ethernet LANs +campus LANs, 290-295 physical standards, 296-297 port security, 108-113 troubleshooting, 115-119 +Ethernet Line (E-Line) service, 307-310 +Ethernet Tree (E-Tree) service, 309 +Ethernet Virtual Connection (EVC), 307 +Ethernet WANs, public cloud con-nections, 345 +E-Tree (Ethernet LAN) service, 309 +EVC (Ethernet Virtual Connection), 307 +exact IP addresses, matching, 31 exams +chapter reviews, 464 failing, 463 +NDAs, 454 +post exam process, 453 +failover, HSRP 543 + + + +practice exams, 454 checklists, 455, 459 PTP questions, 455 PTP software, 458-459 +preparing for +24 hours before the exam, 452 +30 minutes before the exam, 452-453 +earplugs, 451 +one week away preparation, 451-452 +taking notes, 452 travel time, 452 +questions +answering, 456-457 +multichoice questions, 449-450, 457 +Premium Edition questions, 457 +PTP questions, 455 simlet questions, 450 simulation questions, 449 testlet questions, 450 +reviewing for exams +answering questions, 456-457 chapter reviews, 464 +Cisco Learning Network, 464 CLI practice, 460-461 knowledge gaps, 458-459 +practice exams, 454-455, 458-459 +Premium Edition questions, 457 + + +second attempts at passing, 463 +self-assessments, 462-463 VUE testing center, 455 +time +budgeting, 450-451 time-check method, 451 +video tutorials, 449 +excluded (reserved) addresses, DHCP servers, 128 +Expedited Forwarding (EF), 238 exploits (security), 72 +extended numbered IPv4 ACLs configuration, 51-54 +matching protocol, source IP, and destination IP, 46-48 +matching TCP and UDP port numbers, 48-50 +overview, 46 + + +F + +fabric border node (SDA underlays), 387 +fabric control node (SDA underlays), 387 +fabric edge node (SDA underlays), 387 +fabric SDA, 384 failing exams, 463 +failover, HSRP, 261-262 +544 FHRPs (First Hop Redundancy Protocols) + + + +FHRPs (First Hop Redundancy Pro-tocols), 254, 257 +features, 260 HSRP, 261-263 need for, 259-260 options, 260 +fiber Internet, 321 +FIFO (First-In, First-Out), 242 file system, 268-270 +File Transfer Protocol. See FTP files +automation configuration variables, 437 +centralized configuration files, 432 +managing +IOS file system, 268-270 +upgrading IOS images, 270-274 +transferring, 20-21 filtering +DISCOVER messages based on MAC addresses, 150 +MAC addresses, DAI, 159 +RELEASE messages based on IP addresses, 151 +reputation-based filtering, NGIPS, 103 +FIN bits, 12 finding +web servers with DNS, 18-20 +wildcard masks, 33-34 + +firewalls +locations, 96-97 NGFW, 100-101 security zones, 97 stateful firewalls, 96 +flash memory, 269 flow +control, TCP, 15-16 networking, 231 +public cloud traffic, 347-349 forward acknowledgment, 14 forwarding plane. See data plane frames, defined, 233 +FTP (File Transfer Protocol), 275 active mode, 276 +control connection, 277 +copying IOS images with, 273-274 data connection, 277 +passive mode, 276 +FTPS (File Transfer Protocol Secure), 279 +full drops, 251 +full mesh topology, 291, 295, 308 + + +G + +Get messages +agent information, 264 RO/RW communities, 267 +GET requests, 20 GitHub, 433 +Google App Engine PaaS, 341 +interfaces 545 + + + +H + +hardware +Cisco server, 330-331 +origin hardware addresses, 159-160 +hashes +coding passwords with, 90 enable secret command, 92-94 MD5 hash algorithm, 93 +headers +802.1Q, 237-238 802.11, 238 +IP, 237-238 MPLS Label, 238 +hiding passwords for local usernames, 94 +history, SNMP, 263 +home office wireless LANs, 296-297 +hosts +IPv4 settings, 133-140 server virtualization, 332 +HSRP (Hot Standby Router Protocol) +active/passive model, 261 failover, 261-262 +load balancing, 262-263 +HTTP (Hypertext Transfer Protocol) overview, 16-17, 20-21 +REST APIs, 413-416 +software CRUD actions, 413-414 +URIs, 17-18, 414-416 + + +hub and spoke topology (MetroE), 309 +human vulnerabilities (security), 79-80 +hybrid topology, 291, 295 hypervisors, 332 + +I + +IaaS (Infrastructure as a Service), 339-340 +IANA (Internet Assigned Numbers Authority), 205 +IBN (Intent-Based Networking), 371, 398 +IEEE, Ethernet standards, 306 ifconfig command, 134, 137-142 images (IOS), 270-274 +Inform messages, 265-266 +Infrastructure as a Service (IaaS), 339-340 +inside global addresses, 208-210 inside local addresses, 208-210 instantiating VMs, 340 +interactive data application traffic, 230 +interactive voice traffic, 232 intercloud exchanges, 346 Interface loopback command, 200 interfaces +application programming. See APIs +LAN, 228 +NBIs, 365-366 +546 interfaces + + + +port security, 108-118 SBIs, 364 +WANs, 228 +internal processing (switches), 361-362 +Internet +access, 317-321 +cable Internet, 319-320 DSL, 318 +fiber Internet, 321 ISPs, 317 +public cloud accessing, 342-344 +computing branch office con-nections, 349 +VPNs, 317, 321-326 as WAN service, 317 +wireless WANs, 320-321 +Internet Assigned Numbers Authority (IANA), 205 +IOS (iPhone Operating System) file management, 268-274 passwords, 88-94 +ip access-group command, 36, 43, 51, 60-62 +ip access-list command, 55, 62 +ip access-list extended command, 56 +IP ACLs (Access Control Lists). See ACLs +ip address dhcp command, 132 IP addresses +commands, 139-140 +destination IP addresses, 95 + +DNS IP addresses, 128 IPv4. See also ACLs +CIDR, 205-206 +dynamic IP address configu-ration with DHCP, 131 +host settings, 133-140 matching addresses, 31-34 NAT, 202, 207-223 private addressing, 206 QoS marking, 237 routing, 26, 223 scalability, 204-205 +IPv6, QoS marking, 237 +origin IP addresses, 157-159, 163-164 +RELEASE messages, filtering based on IP addresses, 151 +IP ARP (Internet Protocol Address Control Protocol), 156-157 +ip arp inspection validate command, 164 +ip dhcp snooping information option command, 153 +ip ftp password command, 281 ip ftp username command, 281 +IP headers, QoS marking, 237-238 +ip helper-address command, 125-127, 141 +ip nat command, 225 +ip nat inside command, 213-215, 220-222 +ip nat inside source command, 217, 225 +ip nat inside source list command, 220-222 +keywords 547 + + + +ip nat inside source list pool command, 216 +ip nat inside source static command, 213-215, 222 +ip nat outside command, 213-215, 220-222 +ip nat pool command, 216, 225 +ip nat pool netmask command, 215 +IPP (IP Precedence) fields (QoS marking), 238, 241 +ip route configuration command, 133 +ipconfig command, 134, 142 +IPS (Intrusion Prevention Systems), 99 +NGIPS, 100-103 signature databases, 99 +IPsec +DNA Center, 397-398 encryption, 323-324 +site-to-site VPNs, 322-326 +IPv4 (Internet Protocol Version 4) addresses. See also ACLs +CIDR, 205-206 +dynamic IP address configuration with DHCP, 131 +host settings, 133-140 matching addresses, 31-34 NAT, 202, 207-223 private addressing, 206 QoS marking, 237 routing, 26, 223 +scalability, 204-205 + +IPv6 (Internet Protocol Version 6), QoS marking, 237 +ISPs (Internet Service Providers), 317 + + +J + +Jenkins continuous integration and automation tool, 341 +jitter, 229 +JSON (JavaScript Object Notation) arrays, 424-426 +beautified JSON, 426 data serialization, 418-423 key:value pairs, 423-426 minified JSON, 426 objects, 424-426 +REST APIs, 418, 422-423 + + +K + +key:value pairs JSON, 423-426 REST APIs, 412 +keys (encryption), 323 keywords +any, 34 deny, 28, 34 log, 38 +permit, 28, 34 tcp, 48 +udp, 48 +548 knowledge gaps (exam preparation) + + + +knowledge gaps (exam preparation), 458-459 +KVM (Keyboard, Video display, or Mouse), 330 + + +L + +L4PDU (Layer 4 Protocol Data Units), 7 +LANs (Local-Area Networks) Ethernet LANs, 290-295 interfaces, 228 +physical standards, 296-297 PoE, 297-299 +port security, 108-117 SDA, 387 +switching, port security, 108-118 wireless LANs, 296-297 +layer 2 switches DAI, 160-163 +DHCP snooping, 152-154 Layer 3 design, MPLS, 313-317 Layer 3 MetroE design +E-LAN service, 311 +E-Line service, 309-310 leaf switches, ACI, 370 line console command, 105 line vty command, 105 +Link Layer Discovery Protocol (LLDP), 194-198 +links, 17, 306, 314 +Linux, host IPv4 settings, 138-140 + +LISP (LISt Processor), overlays (SDA), 392-393 +list logic (IP ACLs), 29-31 +list variables, REST APIs, 411-412 +LLDP (Link Layer Discovery Protocol), 194-198 +lldp holdtime command, 198 lldp receive command, 201 lldp run command, 197, 201 lldp timer command, 198 lldp transmit command, 201 +LLQ (Low Latency Queuing), 243-245 +load balancing, HSRP, 262-263 +local usernames, hiding passwords for, 94 +location (ACLs), 26-27 log keyword, 38 +logging, Syslog, 174-181 +logging buffered command, 175-179, 200 +logging buffered warning command, 181 +logging command, 200 +logging console command, 174, 200 logging host command, 175 +logging monitor command, 175, 200 +logging monitor debug command, 181 +logging trap command, 200 logging trap 4 command, 181 login command, 105 +login local command, 105 +Long-Term Evolution (LTE), 320 +messages 549 + + + +loopback interfaces, NTP, 188-189 loss, managing, 229 +Low Latency Queuing (LLQ), 243-245 +LTE (Long-Term Evolution), 320 + + +M + +MAC addresses filtering +DAI, 159 +DISCOVER messages, 150 port security, 113 +sticky secure MAC addresses, 109 macOS, host IPv4 settings, 136-138 malware, 79 +NGFW and, 101 Trojan horses, 78 viruses, 78 worms, 78 +Man-in-the-Middle attacks, 76-77 +Management Information Base. See MIB +management plane (networking devices), 361 +managers, SNMP, 264 managing +bandwidth, 228 delay, 229 jitter, 229 +loss, 229 + +marking, 236 +with classification, 234 defined, 234 +DiffServ DSCP values, 240-241 DSCP marking values, 241 Ethernet 802.1Q headers, 237-238 Ethernet 802.11 headers, 238 +IP headers, 237-238 MPLS Label headers, 238 trust boundaries, 238-239 +matching packets, 27 matching parameters +extended numbered ACLs, 46-50 standard numbered ACLs, 31-34 +MD5 hash algorithm, 93 MD5 verification, 273 +measuring cloud computing services, 337 +MEF (Metro Ethernet Forum), 306 memory +flash memory, 269 TCAM, 362 +messages +checks, DAI, 164-165 Get, 264, 267 Inform, 265-266 +integrity, SNMPv3, 268 log messages, 175-177 rate limits +DAI, 163-164 +DHCP snooping, 154-156 +sending to users, 174-175 +550 messages + + + +Set, 264, 267 SNMP, 265 Trap, 265-266 +MetroE, 304 access links, 306 +IEEE Ethernet standards, 306 Layer 3 design, 309-311 MEF, 306 +physical design, 305-306 services, 306-311 topologies, 307-309 +MIB (Management Information Base), 264, 267 +OIDs, 266 variables +monitoring, 265 numbering/names, 266 +minified JSON, 426 monitoring +configuration, 433 MIB variables, 265 +more command, 270 +MPBGP (Multiprotocol BGP), 316 +MPLS (Multi-Protocol Label Switching), 311-312 +access links, 314 +Label headers, QoS marking, 238 Layer 3 design, 313 +MPLS VPNs, 315-317 +public cloud connections, 345 QoS, 314-315 +multichoice questions (exams), 449-450, 457 + + +multifactor credentials (security), 81 +multiple queues (queuing systems), 242 +multiplexing, 7-10 multithreading, 332 + +N + +named ACLs configuration, 55-56 editing, 56-58 overview, 54-55 +names, MIB variables, 266 +NAT (Network Address Trans-lation), 202 +dynamic NAT, 210-211, 215-219 overview, 207-208 +PAT, 211-213, 219-222 source NAT, 208 +static NAT, 208-210, 214-215, 222 +troubleshooting, 222-223 NAT Overload. See PAT +National Institute of Standards and Technology (NIST), 336 +NBAR (Network Based Application Recognition), 235-236 +NBIs (Northbound Interfaces), 365-366 +NDAs (Nondisclosure Agreements), 454 +netstat -rn command, 136-142 +note taking (exam preparation) 551 + + + +Network Management Station (NMS), 264 +networks +automation and network man-agement, 376-378 +broad access, 337 +controllers, 362-366, 375-379 devices +control plane, 360-361 data plane, 359 management plane, 361 +switch internal processing, 361-362 +DNA Center, 400-401 file systems, 270 flow, 231 management +automation, 376-378 DNA Center, 400-401 +physical data center, 334-335 programmability +ACI, 369, 373 comparisons, 375 +redundancy needs, 257-259 SNMP, 254 +traditional versus controller-based networks, 375-379 +traffic +bandwidth, 228 characteristics, 228 delay, 229 +jitter, 229 + + +loss, 229 types, 229-232 +virtual networks, 333-334 VMs, 334 +Network Time Protocol. See NTP Nexus 1000v vSwitch, 334 +NGFW (Next-Generation Firewalls), 100-101 +NGIPS (Next-Generation Intrusion Prevention Systems), 100-103 +NICs (Network Interface Cards) ports, 334 +vNICs, 333 +NIST (National Institute of Standards and Technology), 336 +NMS (Network Management Station), SNMP, 264-266 +no cdp enable command, 193 +no enable password command, 105 no enable secret command, 105 +no ip access-group command, 60 +no ip dhcp snooping information option command, 152-153 +no logging console command, 177 no logging monitor command, 177 +no service password-encryption command, 90 +no shutdown command, 115, 121, 179 +noninteractive data application traffic, 230 +Northbound Interfaces (NBIs), 365-366 +note taking (exam preparation), 452 +552 notifications, SNMP + + + +notifications, SNMP, 265-266 nslookup command, 78 +NTP (Network Time Protocol) +client/server configuration, 183-184 +loopback interfaces, 188-189 overview, 181-182 +primary servers, 187 +redundant configuration, 186-188 reference clocks, 184-186 secondary servers, 187 +setting time and timezone, 182-183 +stratum, 185-186 +ntp master command, 183-185, 188, 200 +ntp server command, 183, 188, 200 ntp source command, 200 numbered ACLs, 58-59 +numbers +MIB variables, 266 port numbers, 9-10 +sequence numbers, 56-58 +NVRAM (Non-Volatile Random Access Memory) file systems, 270 + + +O + +objects, 20 +objects (JSON), 424-426 ODL (OpenDaylight), 368 +OIDs (object IDs), 266 + +on-demand self-service (cloud com-puting), 337 +on-premise. See private cloud com-puting +one-way delay, 229 +ONF (Open Networking Foun-dation), 367 +opaque file systems, 270 Open SDN, 367 OpenFlow, 364, 367 OpFlex, 364 +origin hardware addresses, 159-160 +origin IP addresses, 157-159, 163-164 +OSC (Open SDN Controllers), 369 outside global addresses, 209-210 outside local addresses, 209-210 overlays (SDA), 384 +LISP, 392-393 +VXLAN tunnels, 390-391, 394 +overloading NAT, 211-213, 219-222 + + +P + +PaaS (Platform as a Service), 341-342 +packets +classification, 233-236 congestion +avoidance, 250-251 +management, 242-245 +PoP (Post Office Protocol) 553 + + + +defined, 233 marking, 234-241 matching, 27 policing, 245-248 router queuing, 233 +shaping, 245, 248-250 +PAR (Positive Acknowledgment and Retransmission), 16 +partial mesh topology, 291, 295, 308 +passive mode (FTP), 276 password command, 90, 105 passwords +alternatives to, 81 brute-force attacks, 80 clear-text, 267 dictionary attacks, 80 guessing, 80 +security, 88-94 vulnerabilities (security), 80 +PASV command, 278 +PAT (Port Address Translation) configuration, 219-222 overview, 211-213 troubleshooting, 222 +Path Trace feature (DNA Center), 403 +PCP (Priority Code Point) field (802.1Q header), 237 +PD (Powered Devices), 298-299 PE (Provider Edge), 313 +per-device configuration model, 431 +permit command, 55-57, 62 + + +permit keyword, 28, 34 pharming attacks, 79 +PHB (Per-Hop Behaviors), 226 phishing attacks, 79 +physical access control (security), 84 +physical data center networks, 334-335 +physical design, MetroE, 305-306 physical NICs, ports, 334 physical server model, 331 +physical standards, Ethernet LANs, 296-297 +PI (Prime Infrastructure), 400-401 +planes, networking devices, 359-361 +Platform as a Service (PaaS), 341-342 +PoE (Power over Ethernet), 297-299 +Point-to-Point topology (MetroE), 307-308 +policing (QoS), 245 +discarding excess traffic, 247 edge between networks, 246-247 features, 248 +rates, 246 +traffic rate versus configured policing rate, 246 +pooling resources, cloud computing, 337 +PoP (Post Office Protocol) MetroE, 305 +POP3, 11 +554 Port Address Translation (PAT) + + + +Port Address Translation (PAT) configuration, 219-222 overview, 211-213 +PORT command, 277-278 port-security command, 111 ports +NICs, 334 numbers +destination port numbers, 8 dynamic ports, 9 +ephemeral ports, 9 matching, 48-50 private ports, 9 registered ports, 9 system ports, 9-11 user ports, 9 +well known ports, 9-11 security, 108-111 +err-disabled state, 115 MAC addresses, 113 protect mode, 117-119 restrict mode, 117-119 shutdown mode, 115-117 verifying, 112-113 violation modes, 114-119 +trusted ports, 147 untrusted ports, 147 VMs, 334 +Post Office Protocol. See POP practice exams, 454 +checklists, 455, 459 +PTP questions, 455 + +preparing for exams +24 hours before the exam, 452 +30 minutes before the exam, 452-453 +earplugs, 451 +one week away preparations, 451-452 +post exam process, 453 taking notes, 452 +travel time, 452 +prioritization, congestion man-agement, 242 +Priority Code Point (PCP) field (802.1Q header), 237 +priority queues, 244 private addressing, 206 +private cloud computing, 337-338 +private (dynamic, ephemeral) ports, 9 +private Internets, 206 private WANs +MetroE, 304-311 MPLS, 311-317 +public cloud, accessing, 344-346 +public cloud branch office con-nections, 349 +programmability (network) ACI, 369, 373 comparisons, 375 +protect mode (port security), 117-119 +protocols 555 + + + +protocols CDP +configuration, 193-194 +discovering information about neighbors, 190-193 +verification, 193-194 control plane, 360-363 DHCP, 122 +advantages of, 124 automatic allocation, 129 broadcast flags, 125 +DHCP Relay, 126-127, 130 dynamic allocation, 129 +information stored at DHCP server, 128 +overview, 124-126 relays, 126-127, 130 routers, 128, 132-133 rules of, 149 +servers, 128 +snooping, 146-156. See also snooping attacks +static allocation, 129 +switches, configuring as DHCP clients, 130-132 +troubleshooting, 130 FHRP, 254, 257 +features, 260 HSRP, 261-263 need for, 259-260 options, 260 +FTP, 275 +active mode, 276 +control connection, 277 + + +copying IOS images with, 273-274 +data connection, 277 passive mode, 276 +FTPS, 279 HSRP +active/passive model, 261 failover, 261-262 +load balancing, 262-263 HTTP +overview, 16-17, 20-21 REST APIs, 413-416 +software CRUD actions, 413-414 +URIs, 17-18, 414-416 management plane, 361 matching, 46-48 +MPBGP, 316 SFTP, 279 SNMP, 11, 254 +agents, 264 +clear-text passwords, 267 communities, 267 community strings, 267 Get messages, 264, 267 history, 263 +Inform messages, 265-266 managers, 264 +MIB, 266-267 +MIB variables, monitoring, 265 +notifications, 265-266 +RO communities, 267 +556 protocols + + + +RW communities, 267 security, 267-268 securityACLs, 267 +Set messages, 264, 267 Trap messages, 265-266 +SNMPv1, security, 267 SNMPv2, security, 267 SNMPv2c, 267 SNMPv3, 268 +TCP +compared to UDP, 6 +connection establishment and termination, 12-13 +error recovery and reliability, 13-14 +flow control, 15-16 multiplexing, 7-10 overview, 7 +popular applications, 10-11 port numbers, 8-10, 48-50 segments, 7 +sockets, 8 +supported features, 6-7 windowing, 250-251 +TCP/IP +IPv4, 131 +networks, RFC 1065, 263 TCP, 6-16 +UDP, 6-7, 16 +web browsing, 16-22 +TFTP, 11, 129, 274, 279-280 + +UDP +overview, 16 +port numbers, 48-50 supported features, 6-7 +provider edge (PE), 313 +provisioning (configuration), 434-435 +PSE (Power Sourcing Equipment), 298-299 +PTP questions (exam preparation), 455 +PTP software (practice exams), 458-459 +public cloud computing, 337-339 accessing with Internet, 342-344 +accessing with private WANs, 344-346 +accessing with VPNs, 344 branch offices example, 347-349 intercloud exchanges, 346 +Puppet, 438-442 + + +Q + +QoE (Quality of Experience), 230 QoS (Quality of Service), 232 +bandwidth, 228 classification, 233-236 +congestion avoidance, 250-251 congestion management, 242-245 defined, 226 +delay, 229 +jitter, 229 +REST (Representation State Transfer) 557 + + + +loss, 229 marking, 234-241 MPLS, 314-315 +needs based on traffic types, 229-232 +PHB, 226 policing, 245-248 shaping, 245-250 +switches/routers, 233 tools, 233 +VoIP, 231-232 questions (exams) +answering, 456-457 +multichoice questions, 449-450, 457 +Premium Edition questions, 457 PTP questions, 455 +simlet questions, 450 simulation questions, 449 testlet questions, 450 +queuing +congestion management, 242-245 priority queues, 244 +queue starvation, 244 queuing routers, 233 + +R + +RADIUS, 82 +rapid elasticity (cloud computing), 337 +read-only (RO) communities (SNMP), 267 + + +read-write (RW) communities (SNMP), 267 +reconnaissance attacks, 77-78 recovery (err-disabling), 117 recursive DNS lookups, 19 +redistributing routes, MPLS VPNs, 316 +redundancy FHRP, 259-261 +network needs for, 257-259 NTP configuration, 186-188 single points of failure, 257-259 +reference clocks, 184-186 reflection attacks, 75 registered (user) ports, 9 +RELEASE messages, filtering based on IP addresses, 151 +reliability, TCP, 13-14 remark command, 55, 62 +remote-access VPNs, 324-326 +Representational State Transfer (REST), 366 +reputation-based filtering, NGIPS, 103 +requests (HTTP GET), 20 +requirements, cloud computing services, 336 +reserved (excluded) addresses, DHCP servers, 128 +resource pooling, cloud computing, 337 +REST (Representation State Transfer), 366 +558 REST APIs + + + +REST APIs, 408 +cacheable resources, 410 +client/server architecture, 409, 419-420 +data structures, 411-412 DNA Center calls, 417-418 HTTP +software CRUD actions, 413-414 +URIs, 414-416 JSON, 422-423 key:value pairs, 412 stateless operation, 410 variables +dictionary variables, 411-412 list variables, 411-412 +simple variables, 410-411 RESTful APIs, 366 +restrict mode (port security), 117-119 +reverse engineering from ACL to address range, 40-41 +reviewing for exams +answering questions, 456-457 chapter reviews, 464 +Cisco Learning Network, 464 CLI practice, 460-461 knowledge gaps, 458-459 practice exams, 454 +checklists, 455, 459 PTP questions, 455 +PTP software, 458-459 + +Premium Edition questions, 457 second attempts at passing, 463 self-assessments, 462-463 +VUE testing center, 455 RFC 1065, 263 +RFC 4301 Security Architecture for the Internet Protocol, 323 +RO (read-only) communities (SNMP), 267 +round robin scheduling (queuing), 243 +round-trip delay, 229 +routed access layer design, SDA, 388 +routers +classification, 235-236 CSRs, 344 +configuring as DHCP clients, 132-133 +data plane processing, 359 default routers, 128, 136-140 HSRP, 261-263 +QoS, 233 +queuing, 233, 242-245 redundant, 260. See also FHRP wireless routers, 296 +routes +routing. See also ACLs IPv4 routing, 223 redistribution, 316 +RW (read-write) communities (SNMP), 267 +security 559 + + + +S + +SaaS (Software as a Service), 341 SBIs (Southbound Interfaces), 364 scalability, IPv4 addresses, 204-205 +SDA (Software-Defined Access), 382 +DNA Center, 384, 389, 395 IP security, 397-398 +network management, 400-401 +Path Trace feature, 403 PI, 400-401 +scalable groups, 396 +SDA user group security, 398-399 +SGT, 399 +topology map, 401-403 +traditional management and, 401-403 +fabric, 384 LANs, 387 overlays, 384 +LISP, 392-393 VXLAN, 390-391, 394 +routed access layer design, 388 underlays, 384-386 +fabric border node, 387 fabric control node, 387 fabric edge node, 387 new gear, 388 +VXLAN, 385 + + +user group security, 398-399 VXLAN tunnels, 394, 399 +SDN (Software Defined Net-working), 356-358, 363 +ACI, 369, 373 architecture, 367 +automation and network man-agement, 376-378 +comparisons, 375 control plane, 360-361 controllers, 363-369 data plane, 359-361 management plane, 361 ODL, 368 +Open SDN, 367 OpenFlow, 367 OSC, 369 switches, 361 +Secure Shell. See SSH +Secure Sockets Layer. See SSL security, 70 +AAA, 82-83 amplification attacks, 75 +ARP messages (gratuitous), 157-158 +authentication, 268, 321 biometric credentials, 81 brute-force attacks, 80 buffer overflow attacks, 78 DAI, 156 +configuring, 160-165 filtering MAC addresses, 159 +layer 2 switches, 160-163 +560 security + + + +logic of, 158 +message checks, 164-165 message rate limits, 163-164 +DDoS attacks, 75 device hardening, 95-97 +DHCP-based attacks, 147 DHCP snooping, 146 +binding tables, 150 configuring, 152-156 DHCP-based attacks, 147 +DHCP message rate limits, 154-156 +filtering DISCOVER messages based on MAC addresses, 150 +filtering RELEASE messages based on IP addresses, 151 +layer 2 switches, 152-154 logic of, 148-149 +rules of, 149 dictionary attacks, 80 digital certificates, 81 DoS attacks, 73-74 encryption, 268 exploits, 72 +Internet VPNs, 321 IOS passwords, 88-94 IPsec +DNA Center, 397-398 encryption, 323-324 +malware, 78-79 +Man-in-the-Middle attacks, 76-77 +multifactor credentials, 81 + +passwords, 80-81 pharming attacks, 79 phishing attacks, 79 physical access control, 84 ports +err-disabled state, 115 protect mode, 117-119 restrict mode, 117-119 security, 108-119 shutdown mode, 115-117 violation modes, 114-119 +reconnaissance attacks, 77-78 reflection attacks, 75 smishing attacks, 79 +SNMP, 267-268 +snooping attack. See DHCP, snooping +social engineering attacks, 79 spear phishing attacks, 79 spoofing attacks, 72-77 threats, 72 +Trojan horses, 78 user access, 82-83 +user awareness/training, 83-84 viruses, 78 +vishing attacks, 79 vulnerabilities, 72 +human vulnerabilities, 79-80 password vulnerabilities, 80 +watering hole attacks, 79 whaling attacks, 79 +worms, 78 +show cdp neighbors detail command 561 + + + +security zones (firewalls), 97-98 segments (TCP), 7 +self-assessments (exam preparation), 462-463 +sending messages to users, 174-175 +sequence numbers, editing ACLs, 56-58 +serialization (data) JSON, 418-422 +arrays, 424-426 beautified JSON, 426 key:value pairs, 423-426 minified JSON, 426 objects, 424-426 +XML, 421-423 YAML, 422-423 +servers +app servers, 371 +Cisco hardware, 330-331 DB servers, 371 +defined, 330 NTP, 183-186 +physical server model, 331 UCS servers, 370 virtualization, 332-336 web servers, 16, 371 +service password-encryption command, 89-90, 105 +Service Providers (SPs), 302 +service sequence-numbers command, 200 + +services +cloud computing, 336-342 GitHub, 433 +Internet as WAN, 317 MetroE, 306-311 public cloud, 342-349 +session keys, 323 Set messages +RO/RW communities, 267 writing variables on agents, 264 +severity levels (log messages), 177 +SFTP (SSH File Transfer Protocol), 279 +SGT (Scalable Group Tags), 399 shaping (QoS), 245 +features, 250 +slowing messages, 248 time intervals, 249 +shaping rate, 248 shared keys, 323 +shared session keys, 323 +show access-lists command, 35, 43, 56, 62 +show arp command, 142 +show cdp command, 193-194, 197-198, 201 +show cdp entry command, 190, 193 +show cdp interface command, 193-194 +show cdp neighbors command, 190-191, 194-195 +show cdp neighbors detail command, 190-193 +562 show cdp traffic command + + + +show cdp traffic command, 193-194 +show clock command, 201 show dhcp lease command, 131 +show flash command, 270-272, 282 show interfaces command, 115, 121 +show interfaces loopback command, 201 +show interfaces status command, 115-116 +show interfaces switchport command, 377 +show interfaces vlan command, 131 +show ip access-lists command, 35, 43, 57-59, 62 +show ip arp command, 142 +show ip arp inspection command, 161-163 +show ip default-gateway command, 132 +show ip dhcp conflict command, 142 +show ip dhcp snooping binding command, 162 +show ip dhcp snooping command, 153-155 +show ip interface command, 36, 43, 130 +show ip nat statistics command, 215-222, 225 +show ip nat translations command, 214-225 +show lldp command, 201 +show lldp entry command, 196 +show lldp interface command, 198 + +show lldp neighbors command, 195 +show logging command, 175, 178, 201 +show mac address-table dynamic command, 113-114, 121, 167 +show mac address-table secure command, 113-114, 121 +show mac address-table static command, 113, 121 +show ntp associations command, 184-186, 201 +show ntp status command, 184, 201 +show port-security command, 115-116, 121 +show port-security interface command, 112-121 +show process cpu command, 181 +show running-config | interface command, 121, 167 +show running-config command, 35, 56-59, 89, 105, 121, 167, 270 +show startup-config command, 270 +shutdown command, 115, 121, 179, 182 +shutdown mode (port security), 115-117 +signature databases and IPS, 99 signatures, applications, 236 simlet questions (exams), 450 +simple variables, REST APIs, 410-411 +simulation questions (exams), 449 single points of failure, 257-259 +site-to-site VPNs, 322-326 +spoofing attacks 563 + + + +sliding windows, 15-16 smishing attacks, 79 +SMTP (Simple Mail Transfer Protocol), 11 +SNMP (Simple Network Man-agement Protocol), 11, 254 +agents, 264 +clear-text passwords, 267 communities, 267 community strings, 267 Get messages, 264, 267 history, 263 +Inform messages, 265-266 managers, 264 +MIB, 265-267 notifications, 265-266 RO communities, 267 RW communities, 267 security, 267-268 +Set messages, 264, 267 Trap messages, 265-266 +SNMPv1, security, 267 SNMPv2, security, 267 +SNMPv2c (Community-based SNMP Version 2), 267 +SNMPv3, 268 +snooping attacks (DHCP) binding tables, 150 configuring, 152-156 DHCP-based attacks, 147 +DHCP message rate limits, 154-156 +DISCOVER messages, 150 + +layer 2 switches, 152-154 logic of, 148-149 RELEASE messages, 151 +social engineering attacks, 79 sockets, 8 +software +CRUD actions, 413-414 +PTP software (practice exams), 458-459 +Software as a Service (SaaS), 341 +Software Defined Networking (SDN), 356-358 +control plane, 360-361 controllers, 363 +data plane, 359-361 management plane, 361 switches, 361 +SOHO (Small Office/Home Office), LANs, 296-297 +source IP matching, 46-48 +source NAT (Network Address Translation), 208 +Southbound Interfaces (SBIs), 364 SPs (Service Providers), 302 +spear phishing attacks, 79 +speeds, LAN/WAN interfaces, 228 spine switches, ACI, 370 +spinning up VMs, 340 spoofing attacks, 72 +amplification attacks, 75 DDoS attacks, 75 +DoS attacks, 73-74 +564 spoofing attacks + + + +Man-in-the-Middle attacks, 76-77 reflection attacks, 75 +SSH (Secure Shell) +controlling access with ACLs, 95 management plane, 361 +ssh command, 95 +SSL (Secure Sockets Layer), 325 standard numbered IPv4 ACLs +access-list command, 39-40 command syntax, 31 configuration examples, 34-38 list logic, 29-31 +matching +any/all addresses, 34 exact IP address, 31 subset of address, 31-32 +overview, 29 +reverse engineering from ACL to address range, 40-41 +troubleshooting, 38-39 verification, 38-39 wildcard masks, 31-34 +standards, Ethernet LANs, 296-297 star topology, 291, 295 +stateful firewalls, 96 stateful inspection, 96 static allocation, 129 +static NAT (Network Address Trans-lation) +configuration, 214-215 +inside global addresses, 208-210 +inside local addresses, 208-210 + +outside global addresses, 209-210 outside local addresses, 209-210 overview, 208-210 troubleshooting, 222 +sticky secure MAC addresses, 109 storing log messages, 175-176 stratum, NTP, 185-186 +subnet ID, DHCP servers, 128 subnet masks, DNCP servers, 128 +subnets, DHCP Relay, 126-127, 130 +subset of IP address, matching, 31-32 +switches +access switches, 291, 295 DHCP, 130-132 +distribution switches, 291, 295 +interface configuration, port security, 108-113 +internal processing, 361-362 IPv4, 131 +layer 2 switches DAI, 160-163 +DHCP snooping, 152-154 leaf switches, ACI, 370 management, 131 +port security, 108-118 QoS, 233 +SDN, 361 +spine switches, ACI, 370 ToR, 335 +vSwitches, 333 +templates (configuration) 565 + + + +switchport mode access command, 110-111 +switchport mode command, 120, 167, 377 +switchport mode trunk command, 110 +switchport port-security command, 110-111 +switchport port-security mac-address command, 110-111, 120 +switchport port-security mac-address sticky command, 110-111, 120, 167 +switchport port-security maximum command, 110, 120 +switchport port-security violation command, 110, 114, 120 +SYN flags, 12 Syslog +configuration, 178-180 debug command, 180-181 log message format, 176-177 +log message severity levels, 177 +sending messages to users, 174-175 +storing log messages for review, 175-176 +verification, 178-180 +system (well known) ports, 9-11 + + +T + +TACACS+, 82 +tail drops, 250 + +TCAM (Ternary Content-Addressable Memory), 362 +tcp keyword, 48 +TCP (Transmission Control Protocol) +compared to UDP, 6 +connection establishment and ter-mination, 12-13 +error recovery and reliability, 13-14 +flow control, 15-16 multiplexing, 7-10 overview, 7 +popular applications, 10-11 port numbers, 8-10, 48-50 segments, 7 +sockets, 8 +supported features, 6-7 windowing, 250-251 +TCP/IP (Transmission Control Protocol/Internet Protocol) +IPv4, 131 +networks, RFC 1065, 263 TCP, 6-16 +UDP, 6-7, 16 +web browsing, 16-22 +telcos (telephone companies), 318 Telnet +controlling access with ACLs, 95 management plane, 361 +telnet command, 95 +templates (configuration), 435-437 +566 terminal monitor command + + + +terminal monitor command, 175, 181, 201 +terminal no monitor command, 201 +Ternary Content-Addressable Memory (TCAM), 362 +testlet questions (exams), 450 +TFTP (Trivial File Transfer Protocol), 11, 129, 274, 279-280 +threads, multithreading, 332 threats (security), 72 +three-tier campus design, 293-295 TID fields (QoS marking), 238 time +exams +budgeting, 450-451 time-check method, 451 +intervals (QoS shaping), 249 setting, 182-183 +timezone, setting, 182-183 tools, QoS, 233-251 +Top of Rack (ToR) switches, 335 topologies +campus LANs, 290-295 +DNA Center topology map, 401-403 +full mesh, 291, 295, 308 hub and spoke, 309 hybrid, 291, 295 MetroE, 306-309 +partial mesh, 291, 295, 308 star, 291, 295 +ToR (Top of Rack) switches, 335 + +ToS (Type of Service) field (IPv4), 237 +traffic +bandwidth, 228 characteristics, 228 congestion +avoidance, 250-251 management, 242-245 +delay, 229 jitter, 229 loss, 229 +policing, 245-248 +public cloud branch office email services, 347-349 +shaping, 245, 248-250 types, 229-232 +voice, 315 +Traffic Class field (IPv6), 237 transferring files, 20-21 +Transmission Control Protocol. See TCP +transport input command, 105 transport input ssh command, 89 transport layer (TCP/IP) +TCP, 6-16 UDP, 6-7, 16 +Trap messages, 265-266 +travel time (exam preparation), 452 +Trivial File Transfer Protocol (TFTP), 11, 129, 274, 279-280 +Trojan horses, 78 +users 567 + + + +troubleshooting ACL, 222 DHCP, 130 +dynamic NAT, 222 NAT, 222-223 PAL, 222 +port security, 115-119 +standard numbered ACLs, 38-39 static NAT, 222 +trust boundaries (QoS marking), 238-239 +trusted ports, DHCP messages, 147 tunnels (VPN), 321-322 +tutorials (exams), 449 +two-tier campus design, 290-293 +Type of Service (ToS) field (IPv4), 237 + + +U + +UCS (Unified Computing System), 331, 370 +UDP (User Datagram Protocol) overview, 16 +port numbers, 48-50 supported features, 6-7 +underlays (SDA), 384-388 +UNI (User Network Interface), 306 +Unified Computing System. See UCS +Uniform Resource Identifiers. See URIs + + +Uniform Resource Locators. See URLs +untrusted ports, DHCP messages, 147 +upd keyword, 48 +upgrading IOS images, 270-274 +UPoE (Universal Power over Ethernet), 299 +URIs (Uniform Resource Iden-tifiers), 17-18, 414-416 +URLs (Uniform Resource Locators), 17, 102 +U.S. National Institute of Standards and Technology. See NIST +usbflash, 269-270 +User Datagram Protocol. See UDP user network interface. See UNI user (registered) ports, 9 usernames +hiding passwords for, 94 username command, 105 username password command, 94 username secret command, 94 +users +access security, 82-83 awareness/training, 83-84 groups, SDA security, 398-399 +sending messages to, 174-175 +568 variables + + + +V + +variables +configuration variables, 435-437 dictionary variables, 411-412 list variables, 411-412 +MIB, 265-266 +REST APIs, 410-412 simple variables, 410-411 +vCPU (virtual CPU), 332 verification +CDP, 193-194 +host IPv4 settings, 134-140 NAT, 215-219 +standard numbered ACLs, 38-39 Syslog, 178-180 +verify command, 273, 282 verify /md5 command, 273, 282 verifying +IOS code integrity, 273 port security, 112-113 +video exam tutorials, 449 video traffic +QoS requirements, 232 shaping time intervals, 249 +violation modes (port security), 114-119 +virtual CPU (vCPU), 332 virtual NICs. See vNICS +Virtual Private LAN Service. See VPLS + + +Virtual Private Wire Service. See VPWS +virtual switches. See vSwitches virtualization +data centers, 333-336 networks, 333-334 servers, 332-334 +virtual machines. See VMs viruses, 78 +vishing attacks, 79 +VMs (Virtual Machines), 332-333 ACI, 371 +configuration (automated), 334 IaaS, 340 +networking, 334 PaaS, 341-342 ports, 334 +SaaS, 341 spinning up, 340 +vNICs (virtual NICs), 333 +voice application traffic, 231-232 Voice over IP. See VoIP +voice traffic +shaping time intervals, 249 VoIP, 315 +VoIP (Voice over IP), 231-232, 315 +VPLS (Virtual Private LAN Service), 307 +VPNs (Virtual Private Networks) +AnyConnect Secure Mobility Client, 325 +client, 325 +Internet, 317, 321-322 +workflow, virtualized data center 569 + + + +public cloud, accessing, 344 remote-access VPNs, 324-326 site-to-site, 322-326 +tunnels, 321-322 +VPWS (Virtual Private Wire Service), 307 +vSwitches, 333 +VUE testing center, 455 vulnerabilities (security), 72 +human vulnerabilities, 79-80 password vulnerabilities, 80 +VXLAN tunnels, 385, 390-391, 394, 399 + + +W + +WANs (Wide-Area Networks) Ethernet, 345 +interfaces, 228 Internet access, 317 +Internet as WAN service, 317 MetroE, 304-311 +MPLS, 311-317 private, 344-346, 349 +public cloud connections, 342-346 +SPs, 302 wireless, 320-321 +watering hole attacks, 79 +WC masks, 31-34, 41 + + +web browsers, 16 HTTP, 16-21 +identifying receiving application, 21-22 +URIs, 17-18 URLs, 17 +web clients, 16 web pages, 16 +web servers, 16-20, 371 websites +Cisco ACI, 373 +Cisco Prime management products, 264 +Eclipse IDE, 341 +Google App Engine PaaS, 341 +Jenkins continuous integration and automation tool, 341 +MEF, 306 +OpenDaylight SDN controller, 368 +OpenFlow, 364 weighting, 243 +well known (system) ports, 9-11 whaling attacks, 79 +whois command, 78 wildcard masks, 31-34, 41 windowing, 15-16 wireless routers, 296 wireless WANs, 320-321 +WLANs (Wireless LANs), 296-297 +workflow, virtualized data center, 335-336 +570 worms + + +worms, 78 +WWW (World Wide Web), 11 + + +X + +XML (Extensible Markup Language), data serialization, 421-423 + + +Y - Z + +YAML (YAML Ain’t Markup Language), data serialization, 422-423 + + + + + + + + +This page intentionally left blank +Exclusive Offer – 40% OFF + +Cisco Press Video Training + + + +ciscopress.com/video +Use coupon code CPVIDEO40 during checkout. + + + +Video Instruction from Technology Experts + + + + + + + + + + +Advance Your Skills + +Get started with fundamentals, become an expert, or get certified. + +Train Anywhere + +Train anywhere, at your own pace, on any device. + +Learn + +Learn from trusted author trainers published by Cisco Press. + + + + + +Try Our Popular Video Training for FREE! ciscopress.com/video + +Explore hundreds of FREE video lessons from our growing library of Complete Video Courses, LiveLessons, networking talks, and workshops. + + + + +ciscopress.com/video + + + + + + + + + + + + +REGISTER YOUR PRODUCT at CiscoPress.com/register Access Additional Benefits and SAVE 35% on Your Next Purchase +• Download available product updates. +• Access bonus material when applicable. +• Receive exclusive offers on new editions and related products. (Just check the box to hear from us when setting up your account.) +• Get a coupon for 35% for your next purchase, valid for 30 days. +Your code will be available in your Cisco Press cart. (You will also find it in the Manage Codes section of your account page.) +Registration benefits vary by product. Benefits will be listed on your account page under Registered Products. + + +CiscoPress.com – Learning Solutions for Self-Paced Study, Enterprise, and the Classroom Cisco Press is the Cisco Systems authorized book publisher of Cisco networking technology, Cisco certification self-study, and Cisco Networking Academy Program materials. +At CiscoPress.com you can +• Shop our books, eBooks, software, and video training. +• Take advantage of our special offers and promotions (ciscopress.com/promotions). • Sign up for special offers and content newsletters (ciscopress.com/newsletters). +• Read free articles, exam profiles, and blogs by information technology experts. • Access thousands of free chapters and video lessons. +Connect with Cisco Press – Visit CiscoPress.com/community Learn about Cisco Press community events and programs. +APPENDIX D + + + +Topics from Previous Editions + +Cisco changes the exams, renaming the exams on occasion, and changing the exam numbers every time it changes the exam with a new blueprint, even with a few name changes over the years. As a result, the current CCNA 200-301 exam serves as the eighth separate version of CCNA in its 20-plus year history. At every change to the exams, we create new editions of the books to match the new exam. +We base the books’ contents on Cisco’s exam topics; that is, the book attempts to cover the topics Cisco lists as exam topics. However, the book authoring process does create some challenges, particularly with the balance of what to include in the books and what to leave out. + +For instance, when comparing a new exam to the old, I found Cisco had removed some topics—and I might want to keep the content in the book. There are a few reasons why. Sometimes I just expect that some readers will still want to read about that technology. Also, more than a few schools use these books as textbooks, and keeping some of the older-but-still-relevant topics can be a help. And keeping the old material available on each book’s companion website takes only a little extra work, so we do just that. + +Some of the older topics that I choose to keep on the companion website are small, so I collect them into this appendix. Other topics happen to have been an entire chapter in a previous edition of the books, so we include those topics each as a separate appendix. +Regardless, the material exists here in this appendix, and in the appendixes that follow, for your use if you have a need. But do not feel like you have to read this appendix for the cur-rent exam. + +The topics in this appendix are as follows: + +■ Cisco Device Hardening ■ Implementing DHCP +■ Troubleshooting with IPv4 ACLs ■ Implementing HSRP +■ Global Load Balancing Protocol (GLBP) +■ Implementing Simple Network Management Protocol ■ Analyzing LAN Physical Standard Choices +■ Metro Ethernet Virtual Circuits ■ MPLS VPNs and OSPF + + + + + +NOTE The content under the heading “Cisco Device Hardening” was most recently pub-lished for the 100-105 Exam in 2016, in Chapter 34 of the Cisco CCNA ICND1 100-105 Official Cert Guide. + +Cisco Device Hardening +The term device hardening refers to making it more difficult for attackers to gain access to the device or to cause problems for the device. This section does not attempt to mention all such details, but it does touch on a few items. (Note that the CCNA Security certification gets into much more detail about router and switch device security.) + +In particular, this second major section of the chapter begins by showing how to set some login banner message text for users. The next two topics look at how to secure items unused in the device—unused switch ports on switches and unused software services in both routers and switches. + +Configuring Login Banners +Cisco switches and routers can display a variety of banners to a new user when logging in to the switch or router. A banner is simply some text that appears on the screen for the user. You can configure a router or switch to display multiple banners, some before login and some after. + +IOS supports three banners based on the first keyword in the banner command. Table D-1 lists the three most popular banners and their typical use. + + +Table D-1 +Banner + +Banners and Their Typical Use +Typical Use + + + +Message of the Day (MOTD) +Login + +Exec + +Used for temporary messages that can change from time to time, such as “Router1 down for maintenance at midnight.” +Because it is always shown before the user logs in, this message is often used to show warning messages, like “Unauthorized Access Prohibited.” +Because this banner always appears after login, it typically lists device information that outsiders should not see but that internal staff might want to know, for example, the exact location of the device. + + +In what may seem like trivia, the banners actually appear in different places based on a cou-ple of conditions. Figure D-1 summarizes when the user sees each of these banners, reading from top to bottom. Console and Telnet users see the banners in the order shown on the left, and SSH users see the banners in the order on the right. +4 CCNA 200-301 Official Cert Guide, Volume 2 +E +x +e +c +E +x +e +c +M +O +T +D + + +Console, Telnet + + + +Login + +SSH + +Login + +(User Login) + + +(User Login) +M +O +T +D + + + +Terminal Window Terminal Window + +Figure D-1 Banner Sequence Compared: Console/Telnet Versus SSH (Blue Ribbon Set © petrnutil/123RF) + +NOTE If using SSH, and the switch or router uses only SSHv1, the login banner is not shown to the SSH user. + +The banner global configuration command can be used to configure all three types of these banners. In each case, the type of banner is listed as the first parameter, with motd being the default option. The first nonblank character after the banner type is called a beginning delimiter character. When a delimiter character is used, the banner text can span several lines, with the CLI user pressing Enter at the end of each line. The CLI knows that the ban-ner has been configured as soon as the user enters the same delimiter character again. +Example D-1 shows the configuration process for all three types of banners from Table D-1, followed by a sample user login session from the console that shows the banners in +use. The first configured banner in the example, the MOTD banner, omits the banner type in the banner command as a reminder that motd is the default banner type. The first two banner commands use a # as the delimiter character. The third banner command uses a Z as the delimiter, just to show that any character can be used. Also, the last banner command shows multiple lines of banner text. +Example D-1 Banner Configuration + +! Below, the three banners are created in configuration mode. Note that any +! delimiter can be used, as long as the character is not part of the message +! text. + +SW1(config)# banner # +Enter TEXT message. End with the character '#'. +(MOTD) Switch down for maintenance at 11PM Today # +SW1(config)# banner login # +Enter TEXT message. End with the character '#'. +(Login) Unauthorized Access Prohibited!!!! +# +SW1(config)# banner exec Z +Enter TEXT message. End with the character 'Z'. +(Exec) Company picnic at the park on Saturday. +Appendix D: Topics from Previous Editions 5 + +Don't tell outsiders! +Z +SW1(config)# end + +! Below, the user of this router quits the console connection, and logs +! back in, seeing the motd and login banners, then the password prompt, +! and then the exec banner. + +SW1# quit + +SW1 con0 is now available + +Press RETURN to get started. + +(MOTD) Switch down for maintenance at 11PM Today +(Login) Unauthorized Access Prohibited!!!! + +User Access Verification + +Username: fred +Password: +(Exec) Company picnic at the park on Saturday. +Don't tell outsiders! +SW1> + +Securing Unused Switch Interfaces +The default settings on Cisco switches work great if you want to buy a switch, unbox it, plug it in, and have it immediately work without any other effort. Those same defaults have an unfortunate side effect for security, however. With all default configuration, an attacker might use unused interfaces to gain access to the LAN. So, Cisco makes some general rec-ommendations to override the default interface settings to make the unused ports more secure, as follows: + +■ Administratively disable the interface using the shutdown interface subcommand. +■ Prevent VLAN trunking by making the port a nontrunking interface using the switchport +mode access interface subcommand. D +■ Assign the port to an unused VLAN using the switchport access vlan number interface subcommand. +■ Set the native VLAN so that it is not VLAN 1 but instead is an unused VLAN, using the switchport trunk native vlan vlan-id interface subcommand. + +Frankly, if you just shut down the interface, the security exposure goes away, but the other tasks prevent any immediate problems if someone else comes around and enables the inter-face by configuring a no shutdown command. +6 CCNA 200-301 Official Cert Guide, Volume 2 + + +NOTE The contents under the headings “DHCP Server Configuration on Routers,” “IOS DHCP Server Verification,” and “Troubleshooting DHCP Services” were most recently pub-lished for the 100-105 Exam in 2016, in Chapter 20 of the Cisco CCNA ICND1 100-105 Official Cert Guide. + +Implementing DHCP +This section includes DHCP implementation topics from an earlier edition of the book. + +DHCP Server Configuration on Routers +A quick Google search on “DHCP server products” reveals that many companies offer DHCP server software. Cisco routers (and some Cisco switches) can also act as a DHCP server with just a little added configuration. + +Configuring a Cisco router to act as a DHCP server uses a new configuration concept, one per subnet, called a DHCP pool. All the per-subnet settings go into a per-subnet DHCP pool. The only DHCP command that sits outside the pool is the command that defines the list of addresses excluded from being leased by DHCP. The Cisco IOS DHCP server con-figuration steps are as follows: +Step 1. Use the ip dhcp excluded-address first last command in global configuration mode to list addresses that should be excluded (that is, not leased by DHCP). +Step 2. Use the ip dhcp pool name command in global configuration mode to both create a DHCP pool for a subnet and to navigate into DHCP pool configura-tion mode. Then also: +A. Use the network subnet-ID mask or network subnet-ID prefix-length command in DHCP pool configuration mode to define the subnet for this pool. +B. Use the default-router address1 address2… command in DHCP pool con-figuration mode to define default router IP address(es) in that subnet. +C. Use the dns-server address1 address2… command in DHCP pool configu-ration mode to define the list of DNS server IP addresses used by hosts in this subnet. +D. Use the lease days hours minutes command in DHCP pool configuration mode to define the length of the lease, in days, hours, and minutes +E. Use the domain-name name command in DHCP pool configuration mode to define the DNS domain name. +F. Use the next-server ip-address command in DHCP pool configuration mode to define the TFTP server IP address used by any hosts (like phones) that need a TFTP server. +Of course, an example can help, particularly with so many configuration commands required. Figure D-2 shows the organization of the configuration, while sticking to pseudo-code rather than the specific configuration commands. (Upcoming Example D-2 shows a matching configuration.) Note that for each of the two LAN subnets, there is a global com-mand to exclude addresses, and then a group of settings for each of two different DHCP pools. +Appendix D: Topics from Previous Editions 7 + + + +Global +Exclude: 172.16.1.1–172.16.1.50 +Pool subnet-left +Subnet= 172.16.1.0/24 Router= .1 +DNS= 172.16.1.12 +Lease Time= 0 Days 23 Hours 59 Minutes Domain= example.com + +Global +Exclude: 172.16.2.1–172.16.2.100 +Pool subnet-right +Subnet= 172.16.2.0/24 Router= .1 +DNS= 172.16.1.12 +Lease Time= 1 Days 2 Hours 3 Minutes + + + +A .9 .8 B .1 .1 + +.12 + +DNS +172.16.1.0/24 + + +R1 R2 DHCP DHCP Relay Server +Agent + + +.5 + +UCM Server + +172.16.2.0/24 + +Figure D-2 DHCP Server Configuration Pseudocode + +Example D-2 R2 as a DHCP Server Per the Concepts in Figure D-2 + +ip dhcp excluded-address 172.16.1.1 172.16.1.50 +ip dhcp excluded-address 172.16.2.1 172.16.2.100 +! +ip dhcp pool subnet-left +network 172.16.1.0 255.255.255.0 +dns-server 172.16.1.12 +default-router 172.16.1.1 +lease 0 23 59 +domain-name example.com +next-server 172.16.2.5 +! +ip dhcp pool subnet-right +network 172.16.2.0 /24 +dns-server 172.16.1.12 +default-router 172.16.2.1 +lease 1 2 3 +next-server 172.16.2.5 D + +Focus on subnet 172.16.1.0/24 for a moment: the subnet configured as pool subnet-left. The subnet ID and mask match the subnet ID chosen for that subnet. Then, the global ip dhcp excluded-address command, just above, reserves 172.16.1.1 through 172.16.1.50, so that this DHCP server will not lease these addresses. The server will automatically exclude the subnet ID (172.16.1.0) as well, so this DHCP server will begin leasing IP addresses start-ing with the .51 address. + +Now look at the details for subnet-right. It uses a DHCP pool network command with a prefix style mask. It defines the same DNS server, as does the pool for the other subnet, but a different default router setting, because, of course, the default router in each subnet +8 CCNA 200-301 Official Cert Guide, Volume 2 + +is different. This pool includes a lease time of 1:02:03 (1 day, 2 hours, and 3 minutes) just as an example. + +Also note that both subnets list a TFTP server IP address of the Unified Communications Manager (UCM) server with the next-server command. In most cases, you would find this setting in the pools for subnets in which phones reside. + +Finally, note that configuring a router as a DHCP server does not remove the need for the ip helper-address command. If DHCP clients still exist on LANs that do not have a DHCP server, then the routers connected to those LANs still need the ip helper-address command. For example, in Figure D-2, R1 would still need the ip helper-address command on its LAN interface. R2 would not need the command on its LAN interface, because R2 could service those requests, rather than needing to forward the DHCP messages to some other server. + +IOS DHCP Server Verification +The IOS DHCP server function has several different show commands. These three com-mands list most of the details: + +show ip dhcp binding: Lists state information about each IP address currently leased to a client +show ip dhcp pool [poolname]: Lists the configured range of IP addresses, plus statistics for the number of currently leased addresses and the high-water mark for leases from each pool +show ip dhcp server statistics: Lists DHCP server statistics + +Example D-3 shows sample output from two of these commands, based on the configura-tion from Figure D-2 and Example D-2. In this case, the DHCP server leased one IP address from each of the pools, one for host A, and one for host B, as shown in the highlighted por-tions of the output. +Example D-3 Verifying Current Operation of a Router-Based DHCP Server + +R2# show ip dhcp binding +Bindings from all pools not associated with VRF: + +IP address + + +172.16.1.51 + + + +172.16.2.101 + +Client-ID/ +Hardware address/ +User name +0063.6973.636f.2d30. +3230.302e.3131.3131. +2e31.3131.312d.4661. +302f.30 +0063.6973.636f.2d30. +3230.302e.3232.3232. +2e32.3232.322d.4769. +302f.30 + +Lease expiration + + +Oct 12 2012 02:56 AM + + + +Oct 12 2012 04:59 AM + +Type + + +Automatic + + + +Automatic + +R2# show ip dhcp pool subnet-right +Pool subnet-right : +Utilization mark (high/low) : 100 / 0 +Subnet size (first/next) : 0 / 0 +Total addresses : 254 +Appendix D: Topics from Previous Editions 9 + +Leased addresses : 1 +Pending event : none +1 subnet is currently in the pool : +Current index IP address range Leased addresses +172.16.2.102 172.16.2.1 - 172.16.2.254 1 + +Note that the output in Example D-3 does not happen to list the excluded addresses, but it does show the effects. The addresses assigned to the clients end with .51 (host A, subnet 172.16.1.0) and .101 (host B, subnet 172.16.2.0), proving that the server did exclude the addresses as shown in the configuration in Example D-2. The server avoided the .1 through .50 addresses in subnet 172.16.1.0, and the .1 through .100 addresses in subnet 172.16.2.0. + +NOTE The DHCP server keeps status (state) information about each DHCP client that leases an address. Specifically, it remembers the DHCP client ID, and the IP address leased to the client. As a result, an IPv4 DHCP server can be considered to be a stateful DHCP server. + +Troubleshooting DHCP Services +To be prepared for the CCNA simlet questions, you have to be ready to predict what symp-toms would occur when the network was misconfigured in particular ways. This next sec-tion takes a similar approach, pointing out the most typical issues that could be introduced through incorrect or missing configuration, and then discussing what symptoms should hap-pen and how to recognize those problems. + +This section begins with a typical look at configuration mistakes and the symptoms that occur with those mistakes. In particular, this section looks at problems with the relay agent’s helper address as well as the IOS DHCP server configuration. This section then looks at +non-DHCP problems related to that data plane, breaking the problem into issues between the client and relay agent, and between the relay agent and DHCP server. The final section takes a short look at how a DHCP server prevents duplicate IP addresses between hosts that use static IP addresses and those that use DHCP. + +DHCP Relay Agent Configuration Mistakes and Symptoms +One configuration mistake that prevents DHCP client from leasing an IP address is the mis-configuration or the omission of the ip helper-address interface subcommand on the router acting as the DHCP relay agent. The relay agent takes the incoming DHCP message, changes +the destination address of the packet to be the address on the ip helper-address address D command, and forwards the packet to that address. If the command is missing, the router +does not attempt to forward the DHCP messages at all; if it is incorrect, the relay agent for-wards the DHCP packets, but they never arrive at the actual DHCP server. +The main problem symptom in this case is the failure of a DHCP client to lease an address. If you can identify a client that has a problem, and you know what VLAN or subnet in which that host resides, you can then work to identify any routers connected to that subnet, to find and correct the ip helper-address subcommands. +Beyond that step, this list summarizes a few other related points. + +■ The DHCP relay agent feature is needed on interfaces only if the DHCP server is on a different subnet; it is not needed if the DHCP server is on the same subnet as the client. +10 CCNA 200-301 Official Cert Guide, Volume 2 + +■ On routers with VLAN trunks (with a router-on-a-stick [ROAS] subinterface configura-tion), the subinterfaces also need an ip helper-address command (assuming they meet the first criteria in this list). +■ If an exam question does not allow you to look at the configuration, use the show ip interface [type number] command to view the ip helper-address setting on an interface. + +About that last point, Example D-4 shows an example of the show ip interface g0/0 command. In this case, the interface has been configured with the ip helper-address 172.16.2.11 command; the show command output basically restates that fact. Note that if there were no ip helper-address configured on the interface, the text would instead read “Helper address is not set.” +Example D-4 Listing the Current Helper Address Setting with show ip interface + +R1# show ip interface g0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet address is 182.16.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is 172.16.2.11 +! Lines omitted for brevity (about 20 lines) + +IOS DHCP Server Configuration Mistakes and Symptoms +When using an IOS DHCP server, from a troubleshooting perspective, break issues into two broad categories: those that prevent DHCP clients from leasing an address, and those that allow the lease but provide incorrect settings to the client. + +First, the primary configuration mistake that causes a failure in the DHCP lease process is the misconfiguration of the network command. The problem revolves around these key facts: + +■ The packet from the relay agent to the DHCP server uses the relay agent’s interface IP address as the source IP address in the forwarded DHCP message. +■ The DHCP server compares that source IP address in the received DHCP packet to the network commands in its DHCP pools to find the right pool. +■ Each network subnet mask command implies a range of addresses, just like any other IP network or subnet shown with a subnet mask. +■ If the source IP address of the packet is not in the range of addresses implied by any network command in all the pools, the DHCP server has no pool to use for that request. The DHCP server does not know how to respond, so it does not reply at all. + +As an example of that failure, consider the configuration shown in Figure D-3. The left side shows the configuration on R1, a DHCP relay agent that has two interfaces configured with the ip helper-address 172.16.2.11 command. The DHCP server configuration on the right lists two pools, intended as one pool for each subnet off Router R1. However, the network 172.16.3.0 /25 command implies an address range of 172.16.3.0 to 172.16.3.127, and the relay agent’s interface address of 172.16.3.254 is not within that range of numbers. The solution would be to correct the DHCP server’s network command to use a /24 mask. +Appendix D: Topics from Previous Editions 11 + + + + +Remote Router (R1) +interface G0/1 +ip address 172.16.1.1 255.255.255.0 ip helper-address 172.16.2.11 + +interface G0/1.1 +ip address 172.16.3.254 255.255.255.0 ip helper-address 172.16.2.11 +encapsulation dot1q 2 + + + +Match + + + +No Match! + +DHCP Server (R2) +ip dhcp pool top network 172.16.1.0/24 + + +ip dhcp pool bottom network 172.16.3.0/25 + + + +172.16.3.0 - 172.16.3.127 + + +172.16.1.0/24 DHCP Server + + +SW1 172.16.3.0/24 + + +G0/1 R1 R2 G0/1 + +Figure D-3 An Example Misconfiguration of a DHCP Pool network Command + +NOTE The ip helper-address configuration on the left is correct. The figure uses a ROAS configuration here just to reinforce the comment in the earlier section that ROAS subinter-faces also need an ip helper-address subcommand. + + +While you ultimately need to find this kind of problem and fix the configuration, on the exam you need to be ready to discover the root cause based on symptoms and show commands as well. So, when troubleshooting DHCP issues, and the client fails to lease an address, look at the IOS DHCP server’s network commands. Calculate the range of IP +addresses as if that command were defining a subnet. Then compare that range of addresses by the network command in each pool to the interface addresses on the DHCP relay agent routers. Every relay agent interface (that is, every interface with an ip helper-address com-mand configured) should be included in a pool defined at the IOS DHCP server. + +The DHCP server can also be misconfigured in a way that allows the lease of an address, but then causes other problems. If the lease process works, but the rest of the parameters given to the client are incorrect or missing, the client could operate, but operate poorly. This list summarizes the kinds of mistakes and the resulting symptoms: + +■ With the DNS server IP addresses incorrectly configured on the server (or omitted), hosts would fail to resolve hostnames into their associated IP addresses. +■ With the default gateway IP address incorrectly configured on the server (or omitted), hosts could not communicate outside the local subnet. +■ With the TFTP server IP address incorrectly configured (or omitted), an IP phone would fail to correctly load its configuration. + + + + + + + + + + + + + + +D + + +IP Connectivity from DHCP Relay Agent to DHCP Server +For the DHCP process to work with a centralized server, IP broadcast packets must flow between the client and relay agent, and IP unicast packets must flow between the relay agent and the DHCP server. Any problem that prevents the flow of these packets also pre-vents DHCP from working. +12 CCNA 200-301 Official Cert Guide, Volume 2 + +For perspective, consider the topology in Figure D-4, which again shows the relay agent on the left and the DHCP server on the right. The server uses IP address 172.16.2.11, and the relay agent uses interface address 172.16.1.1. Any failure that prevents the flow of IP pack-ets between those two IP addresses would prevent host A from leasing an IP address. + +172.16.1.0/24 172.16.1.1 172.16.2.0/24 + + +A G0/1 S0/0/0 SW1 R1 +.51 + + +R2 .2 SW2 +.11 + + + +Source: 172.16.1.1 Dest.: 172.16.2.11 + +Source: 172.16.2.11 Dest.: 172.16.1.1 Figure D-4 Addresses Used Between Relay Agent and Server +Remember that the IP addresses used on the packets between the relay agent and server, and know that you may need to troubleshoot IP routing to ensure those packets can be delivered. + +LAN Connectivity Between the DHCP Client and Relay Agent +You might encounter a network environment where DHCP messages on the same LAN as the DHCP client all show a destination IP address of 255.255.255.255. What does that really mean? When a packet uses this 255.255.255.255 address: + +■ The address is called the local broadcast address. +■ Packets sent to this address are not forwarded as-is by routers. +■ On a LAN, the sender of an IP local broadcast packet encapsulates these IP packets in an Ethernet frame with an Ethernet broadcast destination address (FFFF.FFFF.FFFF), so the LAN broadcasts the frame. + +As a result of the logic in these steps, the broadcast DHCP messages can easily flow between the client and router, as long as the LAN works. + +Summary of DHCP Troubleshooting +In summary, as a study tool, the following list summarizes the key troubleshooting ideas from this section on troubleshooting DHCP: +Step 1. If using a centralized DHCP server, at least one router on each remote subnet that has DHCP clients must act as DHCP relay agent, and have a correctly con-figured ip helper-address address subcommand on the interface connected to that subnet. +Step 2. If using a centralized IOS DHCP server, make sure the DHCP pools’ network commands match the entire network’s list of router interfaces that have an ip helper-address command pointing to this DHCP server. +Step 3. Troubleshoot for any IP connectivity issues between the DHCP relay agent and the DHCP server, using the relay agent interface IP address and the server IP address as the source and destination of the packets. +Step 4. Troubleshoot for any LAN issues between the DHCP client and the DHCP relay agent. +Appendix D: Topics from Previous Editions + +Also, as one final note about DHCP in the real world, DHCP might seem dangerous at this point, with all the focus on potential problems in this section, combined with the impor-tance of DHCP and its use by most end user devices. However, DHCP has some great avail-ability features. First, most DHCP servers set their lease times for at least a few days, often a week, or maybe longer. Combined with that, the DHCP protocol has several processes through which the client reconfirms the existing lease with the server, and re-leases the same IP address in advance of the expiration of the lease. Clients do not simply wait until the moment the lease would expire to then contact the DHCP server, hoping it is available. So the network can have outages, and DHCP clients that have already leased an address can continue to work without any problem. + +Detecting Conflicts with Offered Versus Used Addresses +Beyond troubleshooting the types of problems that would prevent DHCP from working, the IOS DHCP server tries to prevent another type of problem: assigning IP addresses with DHCP when another host tries to statically configure that same IP address. Although the DHCP server configuration clearly lists the addresses in the pool, plus those to be excluded from the pool, hosts can still statically configure addresses from the range inside the DHCP pool. In other words, no protocols prevent a host from statically configuring and using an IP address from within the range of addresses used by the DHCP server. + +Knowing that some host might have statically configured an address from within the range of addresses in the DHCP pool, both DHCP servers and clients try to detect such problems, called conflicts, before the client uses a newly leased address. + +DHCP servers detect conflicts by using pings. Before offering a new IP address to a client, the DHCP server first pings the address. If the server receives a response to the ping, some other host must already be using the address, which lets the server know a conflict exists. The server notes that particular address as being in conflict, and the server does not offer the address, moving on to the next address in the pool. + +The DHCP client can also detect conflicts, but instead of using ping, it uses ARP. In the cli-ent case, when the DHCP client receives from the DHCP server an offer to use a particular IP address, the client sends an Address Resolution Protocol (ARP) request for that address. If another host replies, the DHCP client has found a conflict. +Example D-5 lists output from the router-based DHCP server on R2, after host B detected a conflict using ARP. Behind the scenes, host B used DHCP to request a lease, with the process working normally until host B used ARP and found some other device already used 172.16.2.102. At that point, host B then sent a DHCP message back to the server, rejecting +the use of address 172.16.2.102. The example shows the router’s log message related to host B’s discovery of the conflict, and a show command that lists all conflicted addresses. + +13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +D + +Example D-5 Displaying Information About DHCP Conflicts in IOS + +*Oct 16 19:28:59.220: %DHCPD-4-DECLINE_CONFLICT: DHCP address conflict: +client 0063.6973.636f.2d30.3230.302e.3034.3034.2e30.3430.342d.4769.302f.30 +declined 172.16.2.102. +R2# show ip dhcp conflict + +IP address +172.16.2.102 + +Detection method +Gratuitous ARP + +Detection time VRF +Oct 16 2012 07:28 PM +14 CCNA 200-301 Official Cert Guide, Volume 2 + +The show ip dhcp conflict command lists the method through which the server added each address to the conflict list: either gratuitous ARP, as detected by the client, or ping, as detected by the server. The server avoids offering these conflicted addresses to any future clients, until the engineer uses the clear ip dhcp conflict command to clear the list. + +NOTE The content under the heading “Troubleshooting with IPv4 ACLs” was most recent-ly published for the 200-105 Exam in 2016, in Chapter 17 of the Cisco CCNA ICND2 200-105 Official Cert Guide. + +Troubleshooting with IPv4 ACLs +The use of IPv4 ACLs makes troubleshooting IPv4 routing more difficult. Any data plane troubleshooting process can include a catchall phrase to include checking for ACLs. A network can have all hosts working, DHCP settings correct, all LANs working, all router interfaces working, and all routers having learned all routes to all subnets—and ACLs can still filter packets. Although ACLs provide that important service of filtering some packets, ACLs can make the troubleshooting process that much more difficult. + +This third of the three major sections of this chapter focuses on troubleshooting in the pres-ence of IPv4 ACLs. It breaks the discussion into two parts. The first part gives advice about common problems you might see on the exam, and how to find those with show commands and some analysis. The second part then looks at how ACLs impact the ping command. + +Analyzing ACL Behavior in a Network +ACLs cause some of the biggest challenges when troubleshooting problems in real networking jobs. The packets created by commands like ping and traceroute do not exactly match the fields in packets created by end users. The ACLs sometimes filter the ping and traceroute traffic, making the network engineer think some other kind of problems exists when no problems exist at all. Or, the problem with the end-user traffic really is caused by the ACL, but the ping and traceroute traffic works fine, because the ACL matches the +end-user traffic with a deny action but matches the ping and traceroute traffic with a permit action. + +As a result, much of ACL troubleshooting requires thinking about ACL configuration versus the packets that flow in a network, rather than using a couple of IOS commands that iden-tify the root cause of the problem. The show commands that help are those that give you the configuration of the ACL, and on what interfaces the ACL is enabled. You can also see statistics about which ACL statements have been matched. And using pings and traceroutes can help—as long as you remember that ACLs may apply different actions to those packets versus the end-user traffic. +The following phrases the ACL troubleshooting steps into a list for easier study. The list also expands on the idea of analyzing each ACL in step 3. None of the ideas in the list are new compared to this chapter and the previous chapter, but it acts more as a summary of the common issues: +Step 1. Determine on which interfaces ACLs are enabled, and in which direction (show running-config, show ip interfaces). +Step 2. Find the configuration of each ACL (show access-lists, show ip access-lists, show running-config). +Appendix D: Topics from Previous Editions 15 + +Step 3. Analyze the ACLs to predict which packets should match the ACL, focusing on the following points: +A. Misordered ACLs: Look for misordered ACL statements. IOS uses first-match logic when searching an ACL. +B. Reversed source/destination addresses: Analyze the router interface, the direction in which the ACL is enabled, compared to the location of the IP address ranges matched by the ACL statements. Make sure the source IP address field could match packets with that source IP address, rather than the destination, and vice versa for the destination IP address field. +C. Reversed source/destination ports: For extended ACLs that reference UDP or TCP port numbers, continue to analyze the location and direction of the ACL versus the hosts, focusing on which host acts as the server using a well-known port. Ensure that the ACL statement matches the correct source or destination port depending on whether the server sent or will receive the packet. +D. Syntax: Remember that extended ACL commands must use the tcp and udp keywords if the command needs to check the port numbers. +E. Syntax: Note that ICMP packets do not use UDP or TCP; ICMP is consid-ered to be another protocol matchable with the icmp keyword (instead of tcp or udp). +F. Explicit deny any: Instead of using the implicit deny any at the end of each ACL, use an explicit configuration command to deny all traffic at the end of the ACL so that the show command counters increment when that action is taken. +G. Dangerous inbound ACLs: Watch for inbound ACLs, especially those with deny all logic at the end of the ACL. These ACLs may discard incoming overhead protocols, like routing protocol messages. +H. Standard ACL location: Standard ACLs enabled close to the source of matched addresses can discard the packets as intended, but also discard packets that should be allowed through. Always pay close attention to the requirements of the ACL in these cases. +The first two steps are important for simlet questions in case you are not allowed to look at the configuration; you can use other show commands to determine all the relevant ACL +configuration. The next few pages show some of the related commands and how they can +uncover some of the issues described in the just-completed ACL troubleshooting checklist. D + +ACL Troubleshooting Commands +If you suspect ACLs are causing a problem, the first problem-isolation step is to find the location and direction of the ACLs. The fastest way to do this is to look at the output of the show running-config command and to look for ip access-group commands under each interface. However, in some cases, enable mode access may not be allowed, and show com-mands are required. Instead, use the show ip interfaces command to find which ACLs are enabled on which interfaces, as shown in Example D-6. +16 CCNA 200-301 Official Cert Guide, Volume 2 + +Example D-6 Sample show ip interface Command + +R1> show ip interface s0/0/1 +Serial0/0/1 is up, line protocol is up +Internet address is 10.1.2.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.9 +Outgoing access list is not set +Inbound access list is 102 +! roughly 26 more lines omitted for brevity + +Note that the command output lists whether an ACL is enabled, in both directions, and which ACL it is. The example shows an abbreviated version of the show ip interface S0/0/1 command, which lists messages for just this one interface. The show ip interface command would list the same messages for every interface in the router. + +Step 2 of the ACL troubleshooting checklist then says that the contents of the ACL must be found. Again, the quickest way to look at the ACL is to use the show running-config command. If it’s not available, the show access-lists and show ip access-lists commands list the same details shown in the configuration. These commands also list a useful counter that lists the number of packets that have matched each line in the ACL. Example D-7 shows an example. +Example D-7 show ip access-lists Command Example + +R1# show ip access-lists +Extended IP access list 102 +10 permit ip 10.1.2.0 0.0.0.255 10.1.4.0 0.0.1.255 (15 matches) + +The counter can be very useful for troubleshooting. If you can generate traffic that you think should match a particular line in an ACL, then you should see the matches increment on that counter. If you keep generating traffic that should match, but that line’s counter never goes up, then those packets do not match that line in that ACL. Those packets could be matching an earlier line in the same ACL, or might not even be reaching that router (for any reason). + +After the locations, directions, and configuration details of the various ACLs have been discovered in steps 1 and 2, the hard part begins—analyzing what the ACL really does. For example, one of the most common tasks you will do is to look at the address fields and decide the range of addresses matched by that field. Remember, for an ACL that sits in a router configuration, you can easily find the address range. The low end of the range is the address (the first number), and the high end of the range is the sum of the address and wild-card mask. For instance, with ACL 102 in Example D-7, which is obviously configured in some router, the ranges are as follows: + +Source 10.1.2.0, wildcard 0.0.0.255: Matches from 10.1.2.0 through 10.1.2.255 Destination 10.1.4.0, wildcard 0.0.1.255: Matches from 10.1.4.0 through 10.1.5.255 +Appendix D: Topics from Previous Editions 17 + +The next few pages work through some analysis of a few of the items from step 3 in the troubleshooting checklist. + +Example Issue: Reversed Source/Destination IP Addresses +IOS cannot recognize a case in which you attempt to match the wrong addresses in the source or destination address field. So, be ready to analyze the enabled ACLs and their direction versus the location of different subnets in the network. Then ask yourself about the packets that drive that ACL: what could the source and destination addresses of those packets be? And does the ACL match the correct address ranges, or not? + +For example, consider Figure D-5, a figure that will be used in several troubleshooting examples in this chapter. The requirements for the next ACL follow the figure. + + +10.1.1.0/24 +10.2.2.0/30 + +10.3.3.0/25 +A + + + + +.9 + +G0/1 G0/2 +.1 R1 .1 + +G0/1 G0/2 +.2 R2 .2 + + +B + + + +10.4.4.0/23 +Figure D-5 Example Network Used in IPv4 ACL Troubleshooting Examples + +For this next ACL, the requirements ask that you allow and prevent various flows, as follows: + +■ Allow hosts in subnet 10.3.3.0/25 and subnet 10.1.1.0/24 to communicate +■ Prevent hosts in subnet 10.4.4.0/23 and subnet 10.1.1.0/24 from communicating ■ Allow all other communications between hosts in network 10.0.0.0 +■ Prevent all other communications + +Example D-8 shows the ACL used in this case on R2. At first glance, it meets all those requirements straight down the list. +Example D-8 Troubleshooting Example 2 per Step 3B: Source and Destination Mismatch + + +R2# show ip access-lists +Standard IP access list Step3B +10 permit 10.3.3.0 0.0.0.127 +20 deny 10.4.4.0 0.0.1.255 +30 permit 10.0.0.0 0.255.255.255 (12 matches) +R2# +R2# show ip interface G0/1 | include Inbound +Inbound access list is Step3B + + +D + + +The problem in this case is that the ACL has been enabled on R2’s G0/1 interface, inbound. Per the figure, packets coming from a source address in subnets 10.3.3.0/25 and 10.4.4.0/23 should be forwarded out R2’s G0/1 interface, rather than coming in that interface. So, do not let the matching logic in the ACL that perfectly mirrors the requirements fool you; make sure and check the location of the ACL, direction, and the location of the IP addresses. +18 CCNA 200-301 Official Cert Guide, Volume 2 + +Note that step 3C suggests a similar issue regarding matching well-known ports with TCP and UDP. The earlier section in this chapter titled “Matching TCP and UDP Port Numbers” has already discussed those ideas in plenty of detail. Just make sure to check where the server sits versus the location and direction of the ACL. + +Steps 3D and 3E: Common Syntax Mistakes +Steps 3D and 3E describe a couple of common syntax mistakes. First, to match a TCP port in an ACL statement, you must use a tcp protocol keyword instead of ip or any other value. Otherwise, IOS rejects the command as having incorrect syntax. Same issue with trying to match UDP ports: a udp protocol keyword is required. + +To match ICMP, IOS includes an icmp protocol keyword to use instead of tcp or udp. In fact, the main conceptual mistake is to think of ICMP as an application protocol that uses either UDP or TCP; it uses neither. To match all ICMP messages, for instance, use the per-mit icmp any any command in an extended named ACL. + +Example Issue: Inbound ACL Filters Routing Protocol Packets +A router bypasses outbound ACL logic for packets the router itself generates. That might sound like common sense, but it is important to stop and think about that fact in context. A router can have an outgoing ACL, and that ACL can and will discard packets that the router receives in one interface and then tries to forward out some other interface. But if the rout-er creates the packet, for instance, for a routing protocol message, the router bypasses the outbound ACL logic for that packet. + +However, a router does not bypass inbound ACL logic. If an ACL has an inbound ACL enabled, and a packet arrives in that interface, the router checks the ACL. Any and all IPv4 packets are considered by the ACL—including important overhead packets like routing pro-tocol updates. +For example, consider a seemingly good ACL on a router, like the step 3G ACL in Example D-9. That ACL lists a couple of permit commands, and has an implicit deny any at the end of the list. At first, it looks like any other reasonable ACL. +Example D-9 Troubleshooting Example 2 per Step 3G: Filtering RIP by Accident + +R1# show ip access-lists +Standard IP access list Step3G +10 permit host 10.4.4.1 +20 permit 10.3.3.0 0.0.0.127 (12 matches) +! using the implicit deny to match everything else +R1# +! On router R1: +R1# show ip interface G0/2 | include Inbound +Inbound access list is Step3G + +Now look at the location and direction (inbound on R1, on R1’s G0/2) and consider that location versus the topology Figure D-5 for a moment. None of those permit statements match the RIP updates sent by R2, sent out R2’s G0/1 interface toward R1. RIP messages use UDP (well-known port 520), and R2’s G0/1 interface is 10.2.2.2 per the figure. R1 would match incoming RIP messages with the implicit deny all at the end of the list. The symptoms in this case, assuming only that one ACL exists, would be that R1 would not learn routes from R2, but R2 could still learn RIP routes from R1. +Appendix D: Topics from Previous Editions 19 + +Of the three routing protocols discussed in the ICND1 and ICND2 books, RIPv2 uses UDP as a transport, while OSPF and EIGRP do not even use a transport protocol. As a result, to match RIPv2 packets with an ACL, you need the udp keyword and you need to match well-known port 520. OSPF and EIGRP can be matched with special keywords as noted in Table D-2. The table also list the addresses used by each protocol. + +Table D-2 Key Fields for Matching Routing Protocol Messages + +Protocol RIPv2 OSPF +EIGRP + +Source IP Address Source interface Source interface +Source interface + +Destination IP Addresses 224.0.0.9 +224.0.0.5, 224.0.0.6 +224.0.0.10 + +ACL Protocol Keyword udp (port 520) +ospf +eigrp + + +Example D-10 shows a sample ACL with three lines, one to match each routing protocol, just to show the syntax. Note that in this case, the ACL matches the address fields with the any keyword. You could include lines like these in any inbound ACL to ensure that routing protocol packets would be permitted. +Example D-10 Example ACL that Matches all RIPv2, OSPF, and EIGRP with a Permit + +R1# show ip access-lists +ip access-list extended RoutingProtocolExample +10 permit udp any any eq 520 +20 permit ospf any any +30 permit eigrp any any +remark a complete ACL would also need more statements here +R1# + + +ACL Interactions with Router-Generated Packets +Routers bypass outbound ACL logic for packets generated by that same router. This logic helps avoid cases in which a router discards its own overhead traffic. This logic applies to packets that a router creates for overhead processes like routing protocols, as well as for commands, like ping and traceroute. This section adds a few perspectives about how ACLs impact troubleshooting, and how this exception to outbound ACL logic applies, particularly commands used from the router CLI. + +Local ACLs and a Ping from a Router +For the first scenario, think about a ping command issued by a router. The command gener-ates packets, and the router sends those packets (holding the ICMP echo request messages) out one of the router interfaces, and typically some ICMP echo reply messages are received back. As it turns out, not all ACLs will attempt to filter those packets. + +As a backdrop to discuss what happens, Figure D-6 illustrates a simple network topology with two routers connected to a serial link. Note that in this figure four IP ACLs exist, named A, B, C, and D, as noted by the thick arrows in the drawing. That is, ACL A is an out-bound ACL on R1’s S0/0/0, ACL B is an inbound ACL on R2’s S0/0/1, and so on. + + + + + + + + + + +D +20 CCNA 200-301 Official Cert Guide, Volume 2 + +H1 A BA + + + +G0/1 H2 + +R1 S0/0/0 S0/0/1 R2 G0/2 SW1 S1 + + +D C +Figure D-6 Sample Network with IP ACLs in Four Locations + +As an example, consider a ping command issued from R1’s CLI (after a user connects to R1’s CLI using SSH). The ping command pings server S1’s IP address. The IPv4 packets with the ICMP messages flow from R1 to S1 and back again. Which of those four ACLs could possibly filter the ICMP Echo Request toward S1, and the ICMP Echo Reply back toward R1? + +Routers bypass their own outbound ACLs for packets generated by the router, as shown in Figure D-7. Even though ACL A exists as an outgoing ACL on Router R1, R1 bypasses its own outgoing ACL logic of ACL A for the ICMP Echo Requests generated by R1. + +ping S1 - +H1 ignore ACL A A BA + + + +G0/1 H2 + +R1 S0/0/0 S0/0/1 R2 G0/2 SW1 S1 + + +D C +Figure D-7 R1 Ignores Outgoing ACL for Packets Created by Its Own ping Command + +Router Self-Ping of a Serial Interface IPv4 Address +The previous example uses a router’s ping command when pinging a host. However, net-work engineers often need to ping router IP addresses, including using a self-ping. The term self-ping refers to a ping of a device’s own IPv4 address. And for point-to-point serial links, a self-ping actually sends packets over the serial link, which causes some interesting effects with ACLs. + +When a user issues a self-ping for that local router’s serial IP address, the router actually sends the ICMP echo request out the link to the other router. The neighboring router then receives the packet and routes the packet with the ICMP echo request back to the original router. Figure D-8 shows an example of a self-ping (ping 172.16.4.1) of Router R1’s own IP address on a point-to-point serial link, with the ICMP echo request out the link to Router R2. At step 2, R2 treats it like any other packet not destined for one of R2’s own IPv4 addresses: R2 routes the packet. Where? Right back to Router R1, as shown in the figure. + +Now think about those four ACLs in the earlier figures compared to Figure D-8. R1 gener-ates the ICMP echo request, so R1 bypasses outbound ACL A. ACLs B, C, and D could filter the packet. Note that the packet sent by R2 back to R1 is not generated by R2 in this case; R2 is just routing R1’s original packet back to R1. +Appendix D: Topics from Previous Editions 21 + + +ping 172.16.4.1 1 Send Out S0/0/0 + + +Echo Request + + +Echo Request + + + +Destination 172.16.4.1 2 Route Out S0/0/1 + + + + + +R1 + + +172.16.4.1 S0/0/0 + + +172.16.4.2 S0/0/1 + +R2 G0/2 SW1 S1 + +Figure D-8 The First Steps in a Self-Ping on R1, for R1’s S0/0/0 IP Address + +A self-ping of a serial interface actually tests many parts of a point-to-point serial link, as follows: + +■ The link must work at Layers 1, 2, and 3. Specifically, both routers must have a working (up/up) serial interface, with correct IPv4 addresses configured. +■ ACLs B, C, and D must permit the ICMP echo request and reply packets. + +So, when troubleshooting, if you choose to use self-pings and they fail, but the serial inter-faces are in an up/up state, do not forget to check to see whether the ACLs have filtered the Internet Control Management Protocol (ICMP) traffic. + +Router Self-Ping of an Ethernet Interface IPv4 Address +A self-ping of a router’s own Ethernet interface IP address works a little like a self-ping of a router’s serial IP address, but with a couple of twists: + +■ Like with serial interface, the local router interface must be working (in an up/up state); otherwise, the ping fails. +■ Unlike serial interfaces, the router does not forward the ICMP messages physically out the interface, so security features on neighboring switches (like port security) or routers (like ACLs) cannot possibly filter the messages used by the ping command. +■ Like serial interfaces, an incoming IP ACL on the local router does process the router self-ping of an Ethernet-based IP address. + + +Figure D-9 walks through an example. In this case, R2 issues a ping 172.16.2.2 command to ping its own G0/2 IP address. Just like with a self-ping on serial links, R2 creates the ICMP echo request. However, R2 basically processes the ping down its own TCP/IP stack and back up again, with the ICMP echo never leaving the router’s Ethernet interface. R2 does check the Ethernet interface status, showing a failure if the interface is not up/up. R2 does not apply outbound ACL logic to the packet, because R2 created the packet, but R2 will apply inbound ACL logic to the packet, as if the packet had been physically received on the interface. + + + + +D +22 CCNA 200-301 Official Cert Guide, Volume 2 + +ping 172.16.2.2 -Check G0/2 Status Check Incoming ACL + + + +R2 G0/2 SW1 S1 172.16.2.2 + +F +Figure D-9 Self-Ping of a Router’s Ethernet Address + +NOTE The content under the heading “Implementing HSRP” was most recently published for the 200-105 Exam in 2016, in Chapter 20 of the Cisco CCNA ICND2 200-105 Official Cert Guide. + +Implementing HSRP +The goal of this section is to show enough of the operation of each tool to reinforce your understanding of configuring the basic functions of HSRP. + +Configuring and Verifying Basic HSRP +HSRP configuration requires only one command on the two (or more) routers that want to share default router responsibilities with HSRP: the standby group ip virtual-ip interface subcommand. The first value defines the HSRP group number, which must match on both routers. The group number lets one router support multiple HSRP groups at a time on the same interface, and it allows the routers to identify each other based on the group. The command also configures the virtual IP address shared by the routers in the same group; the virtual IP address is the address the hosts in the VLAN use as their default gateway. + +Example D-11 shows a configuration example where both routers use group 1, with virtual IP address 10.1.1.1, with the standby 1 ip 10.1.1.1 interface subcommand. +Example D-11 HSRP Configuration on R1 and R2, Sharing IP Address 10.1.1.1 + +R1# show running-config +! Lines omitted for brevity +interface GigabitEthernet0/0 +ip address 10.1.1.9 255.255.255.0 +standby version 2 +standby 1 ip 10.1.1.1 +standby 1 priority 110 +standby 1 name HSRP-group-for-book +! The following configuration, on R2, is identical except for the HSRP priority and +! the interface IP address +R2# show running-config +! Lines omitted for brevity +interface GigabitEthernet0/0 +ip address 10.1.1.129 255.255.255.0 +Appendix D: Topics from Previous Editions 23 + +standby version 2 +standby 1 ip 10.1.1.1 +standby 1 name HSRP-group-for-book + +The configuration shows other optional parameters, as well. For instance, R1 has a priority of 110 in this group, and R2 defaults to 100. With HSRP, if the two routers are brought up at the same time, the router with the higher priority wins the election to become the active router. The configuration also shows a name that can be assigned to the group (when using show commands) and a choice to use HSRP Version 2. (This chapter provides more details on these settings in the coming pages.) + +Once configured, the two routers negotiate the HSRP settings and choose which router will currently be active and which will be standby. With the configuration as shown, R1 will win the election and become active because of its higher (better) priority. Both routers reach the same conclusion, as confirmed with the output of the show standby brief command on both R1 and R2 in Example D-12. +Example D-12 HSRP Status on R1 and R2 with show standby brief + +! First, the group status as seen from R1 +R1# show standby brief +P indicates configured to preempt. +| +Interface Grp Pri P State Active Standby Virtual IP +Gi0/0 1 110 Active local 10.1.1.129 10.1.1.1 +! The output here on R2 shows that R2 agrees with R1. +R2# show standby brief +P indicates configured to preempt. +| +Interface Grp Pri P State Active Standby Virtual IP +Gi0/0 1 100 Standby 10.1.1.9 local 10.1.1.1 + +The show standby brief command packs a lot of detail in the output, so take your time and work through the highlighted fields. First, look at the Grp column for each command. This lists the HSRP group number, so when looking at output from multiple routers, you need to look at the lines with the same group number to make sure the data relates to that one HSRP group. In this case, both routers have only one group number (1), so it is easy to find the information. +Each line of output lists the local router’s view of the HSRP status for that group. In particu- D lar, based on the headings, the show standby brief command identifies the following: + +Interface: The local router’s interface on which the HSRP group is configured Grp: The HSRP group number +Pri: The local router’s HSRP priority +State: The local router’s current HSRP state +Active: The interface IP address of the currently active HSRP router (or “local” if the local router is HSRP active) +Standby: The interface IP address of the currently standby HSRP router (or “local” if the local router is HSRP standby) +Virtual IP: The virtual IP address defined by this router for this group +24 CCNA 200-301 Official Cert Guide, Volume 2 + +For instance, following the highlighted text in Example D-12, R2 believes that its own cur-rent state is standby, that the router with interface address 10.1.1.9 is active (which happens to be Router R1), with a confirmation that the “local” router (R2, on which this command was issued) is the standby router. + +In comparison, the show standby command (without the brief keyword) lists a more detailed description of the current state, while repeating many of the facts from the show standby brief command. Example D-13 shows an example of the new information with the show standby command, listing several counters and timers about the HSRP protocol itself, plus the virtual MAC address 0000.0c9f.f001. +Example D-13 HSRP Status on R1 and R2 with show standby + +R1# show standby +GigabitEthernet0/0 - Group 1 (version 2) +State is Active +6 state changes, last state change 00:12:53 +Virtual IP address is 10.1.1.1 +Active virtual MAC address is 0000.0c9f.f001 +Local virtual MAC address is 0000.0c9f.f001 (v2 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 1.696 secs +Preemption disabled +Active router is local +Standby router is 10.1.1.129, priority 100 (expires in 8.096 sec) +Priority 110 (configured 110) +Group name is "HSRP-group-for-book" (cfgd) +! The output here on R2 shows that R2 agrees with R1. +R2# show standby +GigabitEthernet0/0 - Group 1 (version 2) +State is Standby +4 state changes, last state change 00:12:05 +Virtual IP address is 10.1.1.1 +Active virtual MAC address is 0000.0c9f.f001 +Local virtual MAC address is 0000.0c9f.f001 (v2 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 0.352 secs +Preemption disabled +Active router is 10.1.1.9, priority 110 (expires in 9.136 sec) +MAC address is 0200.0101.0101 +Standby router is local +Priority 100 (default 100) +Group name is "HSRP-group-for-book" (cfgd) + +HSRP Active Role with Priority and Preemption +HSRP defines some rules to determine which router acts as the active HSRP router and which acts as standby. Those rules also define details about when a standby router should +Appendix D: Topics from Previous Editions 25 + +take over as active. The following list summarizes the rules; following the list, this section takes a closer look at those rules and the related configuration settings. + +First, the HSRP rules. When a router (call it the local router) has an HSRP-enabled interface, and that interface comes up, the router sends HSRP messages to negotiate whether it should be active or standby. When it sends those messages, if it… +Step 1. …discovers no other HSRP routers in the subnet, the local router becomes the active router. +Step 2. …discovers an existing HSRP router, and both are currently negotiating to decide which should become the HSRP active router, the routers negotiate, with the router with the highest HSRP priority becoming the HSRP active router. +Step 3. …discovers an existing HSRP router in the subnet, and that router is already acting as the active router: +A. If configured with no preemption (the default; no standby preempt), the local router becomes a standby router, even if it has a better (higher) prior-ity. +B. If configured with preemption (standby preempt), the local router checks its priority versus the active router; if the local router priority is better (higher), the local router takes over (preempts) the existing active router to become the new active HSRP router. +Steps 1 and 2 in the list are pretty obvious, but steps 3A and 3B could use a little closer look. For instance, the examples so far in this chapter show R1’s G0/0 with a priority of 110 versus R2’s G0/0 with priority 100. The show commands in Example D-13 show that R1 is currently the HSRP active router. That same example also lists a line for both R1 and R2 that confirms “preemption disabled,” which is the default. + +To show a test of step 3A logic, Example D-14 shows a process by which R1’s G0/0 inter-face is disabled and then enabled again, but after giving Router R2 long enough to take over and become active. That is, R1 comes up but R2 is already HSRP active for group 1. The bottom of the example lists output from the show standby brief command from R2, con-firming that R2 becomes HSRP active and R1 becomes standby (10.1.1.9), proving that R1 does not preempt R2 in this case. +Example D-14 Showing How No Preemption Keeps R1 as Standby After R1 Recovers + + +! First, R1's G0/0 is disabled and enabled; the ending log message shows a standby +! state. +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface gigabitEthernet 0/0 +R1(config-if)# shutdown +*Mar 8 18:10:29.242: %HSRP-5-STATECHANGE: GigabitEthernet0/0 Grp 1 state Active -> Init +*Mar 8 18:10:31.205: %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down +*Mar 8 18:10:32.205: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther +net0/0, changed state to down + + +D +26 CCNA 200-301 Official Cert Guide, Volume 2 + +R1(config-if)# +R1(config-if)# no shutdown +R1(config-if)# ^Z +R1# +*Mar 8 18:11:08.355: %HSRP-5-STATECHANGE: GigabitEthernet0/0 Grp 1 state Speak -> Standby +! Now from R2, note R2 is active, and 10.1.1.9 (R1) is standby +R2# show standby brief +P indicates configured to preempt. +| +Interface Grp Pri P State Active Standby Virtual IP +Gi0/1 1 100 Active local 10.1.1.9 10.1.1.1 + +If R1 had been configured with preemption for that previous scenario, R1 would have taken over from R2 when R1’s interface came back up. Example D-15 shows exactly that. Before the output in Example D-15 was gathered, the network had been put back to the same beginning state as at the beginning of Example D-14, with R1 active and R2 as standby. Within Example D-15, R1’s interface is shut down, then configured with preemption using the standby 1 preempt command, enabling preemption. Then, after enabling the interface again, R1 takes over as HSRP active, as shown at the bottom of the example’s show standby brief command from R2. That output now shows the local router’s state as Standby, and the active as 10.1.1.9 (R1). +Example D-15 Showing How Preemption Causes R1 to Take Over As Active upon Recovery + +! First, R1's G0/0 is disabled and enabled; the ending log message shows a standby ! state. +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface gigabitEthernet 0/0 +R1(config-if)# shutdown +*Mar 8 18:10:29.242: %HSRP-5-STATECHANGE: GigabitEthernet0/0 Grp 1 state Active -> Init +*Mar 8 18:10:31.205: %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down +*Mar 8 18:10:32.205: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther net0/0, changed state to down +R1(config-if)# standby 1 preempt +R1(config-if)# no shutdown +R1(config-if)# ^Z +R1# +*Mar 8 18:19:14.355: %HSRP-5-STATECHANGE: GigabitEthernet0/0 Grp 1 state Listen -> Active +! Now from R2, note it is active, and 10.1.1.9 (R1) is standby + +*Mar 8 18:18:55.948: %HSRP-5-STATECHANGE: GigabitEthernet0/0 Grp 1 state Standby -> Active +*Mar 8 18:19:14.528: %HSRP-5-STATECHANGE: GigabitEthernet0/0 Grp 1 state Active -> Speak +Appendix D: Topics from Previous Editions 27 + +*Mar 8 18:19:26.298: %HSRP-5-STATECHANGE: GigabitEthernet0/0 Grp 1 state Speak -> Standby + +R2# show standby brief +P indicates configured to preempt. +| +Interface Grp Pri P State Active Standby Virtual IP +Gi0/0 1 100 Standby 10.1.1.9 local 10.1.1.1 + +Note that it is the preemption setting on the router that is taking over (preempting) that determines if preemption happens. For instance, in this case, R1 came up when R2 was active; R1 was set to preempt; so R1 preempted R2. + +HSRP Versions +Cisco IOS on routers and Layer 3 switches supports two versions of HSRP: versions 1 and 2. The versions have enough differences, like multicast IP addresses used and message formats, so that routers in the same HSRP group must use the same version. If two routers config-ured to be in the same HSRP group mistakenly configure to use different versions, they will not understand each other and ignore each other for the purposes of HSRP. + +To configure the version, each interface/subinterface uses the standby version {1 | 2} inter-face subcommand. Note that the HSRP group number is not included in the command, because it sets the version for all HSRP messages sent out that interface/subinterface. + +There are some good reasons to want to use the more recent HSRP version 2 (HSRPv2). For example, HSRPv1 existed before IPv6 became popular. Cisco enhanced HSRP to version 2 in part to make IPv6 support possible. Today, to use HSRP with IPv6 requires HSRPv2. + +As another example of a benefit of HSRPv2, HSRP uses a Hello message, similar in concept to routing protocols, so that HSRP group members can realize when the active router is no longer reachable. HSRPv2 allows for shorter Hello timer configuration (as low as a small number of milliseconds), while HSRPv1 typically had a minimum of 1 second. So, HSRPv2 can be configured to react more quickly to failures with a lower Hello timer. + +Beyond IPv6 support and shorter Hello timer options, other differences for version 2 ver-sus version 1 include a different virtual MAC address base value and a different multicast IP address used as the destination for all messages. Table D-3 lists the differences between HSRPv1 and HSRPv2. + +Table D-3 HSRPv1 Versus HSRPv2 +Feature + +D + +Version 1 Version 2 + + + +IPv6 support +Smallest unit for Hello timer +Range of group numbers + +No Yes +Second Millisecond +0..255 0..4095 + +MAC address used (xx or xxx is the hex group number) 0000.0C07.ACxx 0000.0C9F.Fxxx + +IPv4 multicast address used +Does protocol use a unique identifier for each router? + +224.0.0.2 +No + +224.0.0.102 +Yes +28 CCNA 200-301 Official Cert Guide, Volume 2 + +Of the details in the table, make sure to look at the MAC addresses for both versions 1 and 2. Cisco reserves the prefixes of 0000.0C07.AC for HSRPv1 and 0000.0C9F.F for HSRPv2. HSRPv1, with 256 possible HSRP groups per interface, then uses the last two hex digits to identify the HSRP group. For example, an HSRP group 1 using version 1 would use a virtual MAC address that ends in hex 01. Similarly, because HSRPv2 supports 4096 groups per interface, the MAC address reserves three hex digits to identify the group. An HSRP group 1 using version 2 would use a virtual MAC address that ends in hex 001. + +NOTE The content under the heading “Gateway Load Balancing Protocol (GLBP)” was most recently published for the 200-105 Exam in 2016, in Appendix K of the Cisco CCNA ICND2 200-105 Official Cert Guide. + +Gateway Load Balancing Protocol (GLBP) +This section first discusses GLBP concepts, followed by GLBP configuration. + +GLBP Concepts +Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP), which were introduced before Gateway Load Balancing Protocol (GLBP), balanced the packet load per subnet. However, because traffic loads vary unpredictably from subnet to subnet, Cisco wanted a First Hop Redundancy Protocol (FHRP) option with better load-balancing options than just the per-subnet load balancing of HSRP and VRRP. To meet that need, Cisco introduced GLBP. + +GLBP balances the packet load per host by using an active/active model in each subnet. Each GLBP router in a subnet receives off-subnet packets from some of the hosts in the subnet. Each host still remains unaware of the FHRP, allowing the hosts to configure the same default gateway/router setting and for the hosts to make no changes when a router fails. + +GLBP creates a world that at first glance looks like HSRP, but with a few twists that let GLBP balance the traffic. Like HSRP, all the routers configure a virtual IP address, which is the IP address used by hosts as their default router. Like with HSRP, hosts use a default +router setting that points to the virtual IP address, and that setting does not need to change. GLBP differs from HSRP with regard to the MAC addresses it uses and the Address Resolution Protocol (ARP) process, because GLBP actually uses ARP Reply messages to bal-ance traffic from different hosts through different routers. + +With GLBP, one router acts in a special role called the active virtual gateway (AVG). The AVG replies to all ARP requests for the virtual IP address. Each router has a unique virtual MAC address, so that the AVG can reply to some ARP Requests with one virtual MAC, and some with the other. As a result, some hosts in the subnet send frames to the Ethernet MAC address of one of the routers, with other hosts sending their frames to the MAC address of the second router. + +As an example, Figure D-10 shows the process by which a GLBP balances traffic for host A based on the ARP Reply sent by the AVG (R1). The two routers support virtual IP address 10.1.1.1, with the hosts using that address as their default router setting. +Appendix D: Topics from Previous Editions 29 + + +10.1.1.0/24 + +1 + + +A 2 + +3 + + + +ARP: 10.1.1.1? + + +ARP: VMAC1 + + +Data + + + +AVG .1 +VMAC1 R1 + + +GLBP Table +Role Router +AVG R1 Forwarder R1 Forwarder R2 + + + +Address +10.1.1.1 VMAC1 VMAC2 + + +To VMAC1 +VMAC2 +.1 R2 + +Figure D-10 GLBP Directs Host A by Sending Back ARP Reply with R1’s VMAC1 + +The figure shows three messages, top to bottom, with the following action: + +1. Host A has no ARP table entry for its default router, 10.1.1.1, so host A sends an ARP Request to learn 10.1.1.1’s MAC address. +2. The GLBP AVG, R1 in this case, sends back an ARP Reply. The AVG chooses to include its own virtual MAC address in the ARP Reply, VMAC1. +3. Future IP packets sent by host A are encapsulated in Ethernet frames, destined to VMAC1, so that they arrive at R1. + +From now on, host A sends off-subnet packets to R1 due to host A’s ARP table entry for its default gateway (10.1.1.1). Host A’s ARP table entry for 10.1.1.1 now refers to a MAC address on R1 (VMAC1), so packets host A sends off-subnet flow through R1. +To balance the load, the AVG answers each new ARP Request with the MAC addresses of alternating routers. Figure D-11 continues the load-balancing effect with the ARP Request for 10.1.1.1 coming from host B. The router acting as AVG (R1) still sends the ARP Reply, but this time with R2’s virtual MAC (VMAC2). + + + +1 +ARP: 10.1.1.1? + +B 2 ARP: VMAC2 + +3 +Data + + +AVG .1 + +VMAC1 R1 + +GLBP Table +Role Router +AVG R1 Forwarder R1 Forwarder R2 + + +Address +10.1.1.1 VMAC1 VMAC2 +D + + +To VMAC2 +VMAC2 +.1 R2 + +Figure D-11 GLBP Directs Host B by Sending Back ARP Reply with R2’s VMAC2 +30 CCNA 200-301 Official Cert Guide, Volume 2 + +Here are the steps in the figure: + +1. Host B sends an ARP Request to learn 10.1.1.1’s MAC address. +2. The GLBP AVG (R1) sends back an ARP Reply, listing VMAC2, R2’s virtual MAC address. +3. For future packets sent off-subnet, host B encapsulates the packets in Ethernet frames, destined to VMAC2, so that they arrive at R2. + +The process shown in Figures D-10 and D-11 balances the traffic, per host, but the routers must also be ready to take over for the other router if it fails. GLBP refers to each router as a forwarder. When all is well, each router acts as forwarder for its own virtual MAC +address, but it listens to GLBP messages to make sure the other forwarders are still working. If another forwarder fails, the still-working forwarder takes over the failed forwarder’s vir-tual MAC address role and continues to forward traffic. + +Configuring and Verifying GLBP +GLBP configuration mimics HSRP configuration to a great degree. + +Example D-16 shows a GLBP configuration with both routers using GLBP group 1, with vir-tual IP address 10.1.1.1, with the glbp 1 ip 10.1.1.1 interface subcommand. +Example D-16 GLBP Configuration on R1 and R2, Sharing IP Address 10.1.1.1 + +! First, the configuration on R1 +R1# show running-config +! Lines omitted for brevity +interface GigabitEthernet0/0 +ip address 10.1.1.9 255.255.255.0 +glbp 1 ip 10.1.1.1 +glbp 1 priority 110 +glbp 1 name GLBP-group-for-book +! The following configuration, on R2, is identical except for +! the interface IP address, and the GLBP priority +R2# show running-config +! Lines omitted for brevity +interface GigabitEthernet0/0 +ip address 10.1.1.129 255.255.255.0 +glbp 1 ip 10.1.1.1 +glbp 1 name GLBP-group-for-book + +Once configured, the two routers negotiate as to which will be the AVG. As with HSRP, if both come up at the same time, R1 will win, with a priority set to 110 with the glbp 1 +priority 110 command versus R2’s default priority of 100. However, if either router comes up before the other, that router goes ahead and takes on the AVG role. + +Sifting through the GLBP show command output takes a little more work than with HSRP, in particular because of the added detail in how GLBP works. First, consider the show glbp brief command on Router R1, as shown in Example D-17. (Note that many show glbp com-mands have the same options as equivalent HSRP show standby commands.) +Appendix D: Topics from Previous Editions 31 + +Example D-17 GLBP Status on R1 with show glbp brief + +R1# show glbp brief + +Interface +Gi0/0 + +Grp Fwd Pri State +1 - 110 Active + +Address +10.1.1.1 + +Active router +local + +Standby router +10.1.1.129 + + + +Gi0/0 1 1 +Gi0/0 1 2 + +- Listen +- Active + +0007.b400.0101 +0007.b400.0102 + +10.1.1.129 - +local + + +Before looking at the right side of the output, first consider the context for a moment. This example lists a heading line and three rows of data. These data rows are identified by the Grp and Fwd headings, short for Group and Forwarder. With only one GLBP group config-ured, R1 lists lines only for group 1. More important, each row defines details about a dif-ferent part of what GLBP does, as follows: +Fwd is -: This line refers to none of the forwarders, and instead describes the AVG. Fwd is 1: This line describes GLBP forwarder (router) 1. +Fwd is 2: This line describes GLBP forwarder (router) 2. + + +The output usually lists the line about the AVG first, as noted with a dash in the Forwarder column. Now look at the highlighted portions on the right of Example D-17. This line will list the virtual IP address and identify the active AVG and the standby AVG. This particular command, from Router R1, lists R1 itself (“local”) as the active router. So, R1 is the current AVG. + +Each of the next two lines lists status information about one of the forwarder roles; that is, a router that uses a virtual MAC address, receives frames sent to that address, and routes the packets encapsulated in those frames. To that end, the Address column lists MAC addresses, specifically the virtual MAC addresses used by GLBP, and not the interface MAC addresses. + +Each forwarder row also identifies the router that currently uses the listed virtual MAC in the Active Router column. In Example D-17, 0007.b400.0101 is used by the router with interface IP address 10.1.1.129 (which happens to be R2). 0007.b400.0102 is supported by the local router (the router on which the show command was issued), which is R1. + +The brief output of the show glbp brief command lists many details, but it takes some effort to learn how to sift through it all. For more perspective on the output, Example D-18 lists this same show glbp brief command, this time on R2. Note that the Fwd column again identifies the first line of output as being about the AVG, with the next two lines about the two forwarders. + + + + + + + + + + + + + + + + + + + +D + +Example D-18 GLBP Status on R2 with show glbp brief + +R2# show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 1 - 100 Standby 10.1.1.1 10.1.1.9 local + +Gi0/0 1 1 - Active +Gi0/0 1 2 - Listen + +0007.b400.0101 +0007.b400.0102 + +local - +10.1.1.9 - + + +The State column in the output in Examples D-17 and D-18 can pull the GLBP concepts together. First, to define the meaning of the state values, the following short list defines +32 CCNA 200-301 Official Cert Guide, Volume 2 + +the states expected for the first line of output, about the AVG, and then about each GLBP forwarder: + +AVG: One router should be the active AVG, with the other acting as standby, ready to take over the AVG role if the AVG fails. +Each forwarder: One router should be active, while the other should be listening, ready to take over that virtual MAC address if that forwarder fails. + +Table D-4 collects the values of the State column from Examples D-17 and D-18 for easier reference side by side. Note that, indeed, each line has either an active/standby pair (for the AVG) or an active/listen pair (for the forwarder function). + +Table D-4 Comparing Local State in show glbp brief Commands + +Row Is About… AVG +Forwarder 1 +Forwarder 2 + +Fwd Column Value - +1 +2 + +R1 State Active Listen +Active + +R2 State Standby Active +Listen + + +Finally, the show glbp command lists a more detailed view of the current GLBP status. Example D-19 shows a sample from Router R1. Note that the first half of the output has similar information compared to HSRP’s show standby command, plus it lists the IP and MAC addresses of the routers in the GLBP group. Then, the end of the output lists a group of messages per GLBP forwarder. +Example D-19 GLBP Status on R1 with show glbp + +R1# show glbp +GigabitEthernet0/0 - Group 1 +State is Active +2 state changes, last state change 00:20:59 +Virtual IP address is 10.1.1.1 +Hello time 3 sec, hold time 10 sec +Next hello sent in 2.112 secs +Redirect time 600 sec, forwarder timeout 14400 sec +Preemption disabled +Active is local +Standby is 10.1.1.129, priority 100 (expires in 8.256 sec) +Priority 110 (configured) +Weighting 100 (default 100), thresholds: lower 1, upper 100 +Load balancing: round-robin +IP redundancy name is "GLBP-group-for-book" +Group members: +0200.0101.0101 (10.1.1.9) local +0200.0202.0202 (10.1.1.129) +There are 2 forwarders (1 active) +Forwarder 1 +State is Listen +2 state changes, last state change 00:20:34 +Appendix D: Topics from Previous Editions 33 + +MAC address is 0007.b400.0101 (learnt) +Owner ID is 0200.0202.0202 +Redirection enabled, 598.272 sec remaining (maximum 600 sec) +Time to live: 14398.272 sec (maximum 14400 sec) +Preemption enabled, min delay 30 sec +Active is 10.1.1.129 (primary), weighting 100 (expires in 8.352 sec) +Client selection count: 1 +Forwarder 2 +State is Active +1 state change, last state change 00:24:25 +MAC address is 0007.b400.0102 (default) +Owner ID is 0200.0101.0101 +Redirection enabled +Preemption enabled, min delay 30 sec +Active is local, weighting 100 +Client selection count: 1 + + +NOTE The content under the heading “Implementing Simple Network Management Protocol” was most recently published for the 200-105 Exam in 2016, in Chapter 26 of the Cisco CCNA ICND2 200-105 Official Cert Guide. + +Implementing Simple Network Management Protocol This section includes details of how to implement SNMPv2c and SNMPv3. + +Implementing SNMP Version 2c +The exam topics mention SNMPv2c and SNMPv3 by name. As it turns out, SNMPv1 and SNMPv2c configuration is very similar, because both use communities. SNMPv3 varies quite a bit, mainly to implement the better SNMPv3 security features. This next section shows how to configure and verify SNMPv2c. + +Configuring SNMPv2c Support for Get and Set +SNMP configuration in Cisco IOS routers and switches works a little differently than many other IOS features. First, the SNMP configuration exists in a series of global commands; there is no SNMP agent configuration mode in which to collect subcommands. Secondly, +no single command enables the SNMP agent. Instead, IOS typically defaults for the SNMP D agent to be disabled. Then, the first time an snmp-server global command is configured, +IOS enables the SNMP agent. + +NOTE To disable the SNMP agent, you must remove all the snmp-server commands. You can do this with a single no snmp-server command (with no parameters). + +With that backdrop, a typical SNMPv2c configuration requires only one or two settings. To be useful, the agent needs at least a read-only (RO) community string. The agent will not reply to SNMPv2c Get messages without at least the RO community string configured. The network engineer may also want the agent to have a read-write (RW) community string, to support Set messages. +34 CCNA 200-301 Official Cert Guide, Volume 2 + + +NOTE When configuring an RW community, use some caution: configuring an RW com-munity means that you have defined a clear-text password that can be used to configure many settings on the router or switch. + +The following checklist details the commands used to configure SNMPv2c on a Cisco rout-er or switch. This list shows the method to configure the RO and RW communities, plus a few optional but common settings (location and contact information). +Step 1. Use the snmp-server community communitystring RO [ipv6 acl-name] [acl-name] command in global configuration mode to enable the SNMP +agent (if not already started), set the read-only community string, and restrict incoming SNMP messages based on the optional referenced IPv4 or IPv6 ACL. +Step 2. (Optional) Use the snmp-server community communitystring RW [ipv6 acl-name] [acl-name] command in global configuration mode to enable the +SNMP agent (if not already started), set the read-write community string, and restrict incoming SNMP messages based on the optional referenced IPv4 or IPv6 ACL. +Step 3. (Optional) If referenced by an snmp-server community command, configure an IPv4 or IPv6 ACL, with the same name or number referenced by the +snmp-server community command, with the ACL permitting by matching the source IPv4 or IPv6 address of the allowed SNMP management hosts. +Step 4. (Optional) Use the snmp-server location text-describing-location command in global configuration mode to document the location of the device. +Step 5. (Optional) Use the snmp-server contact contact-name command in global con-figuration mode to document the person to contact if problems occur. + + +NOTE In the SNMP model, the SNMP agent acts as a server, with the NMS (SNMP Manager) acting as an SNMP client by requesting information with Get messages. The IOS snmp-server command happens to emphasize the idea that the SNMP agent on a router or switch acts as the SNMP server. + +Example D-20 shows a sample configuration based on Figure D-12. The examples in this section come from Router R1, although the exact same SNMP configuration syntax could be used in the LAN switches or in R2. (The configuration of the location information would likely differ for each device, however.) Note that the configuration creates an IPv4 ACL that permits traffic with source IP address 10.1.3.3, which is the address of the NMS shown in the figure. It then defines read-only and read-write communities, along with the location and contact name for the router. + +NMS 10.1.3.3 + +SW1 G0/0 R1 G0/1 SW2 G0/0 R2 G0/1 SW3 +NMS 10.1.3.4 + +Figure D-12 Sample Network for SNMP Examples, with NMS at 10.1.3.3 +Appendix D: Topics from Previous Editions 35 + +Example D-20 Configuring SNMP Version 2c on Router R1 to Support Get and Set + +ip access-list standard ACL_PROTECTSNMP +permit host 10.1.3.3 +! +snmp-server community secretROpw RO ACL_PROTECTSNMP +snmp-server community secretRWpw RW ACL_PROTECTSNMP +snmp-server location Atlanta +snmp-server contact Tyler B + +To begin managing Router R1 (or any of the other devices that use the same community strings), the SNMP manager at address 10.1.3.3 now needs to configure the community strings listed in Example D-20. + +Configuring SNMPv2c Support for Trap and Inform +For an SNMPv2c agent in a router or switch to be able to send unsolicited notifications to an SNMP manager (that is, to send Trap and Inform messages), the device needs to be con-figured with the snmp-server host command. This command references the NMS to which the Traps or Informs should be sent, along with the SNMP version. + +Beyond telling the SNMP agent the hostname or address of the NMS, the agent typically needs to know the notification community string used by the NMS. Think of the RO and RW community strings as protecting the SNMP agent from the messages originated by an NMS (Get or Set Requests), so the agent requires the NMS to supply the correct RO or RW community string. For Traps and Informs, the NMS can protect itself from the Trap and Inform messages originated by SNMP agents by requiring those agents to include the notification community with those messages. The agent can configure this value on the snmp-server host command as well. + +The following list details the command to enable the sending of SNMPv2c Trap or Inform messages to an NMS: +Step 1. Use the snmp-server host {hostname | ip-address} [informs] version 2c notification-community command in global configuration mode to configure the SNMP agent to send either SNMPv2c Traps (default) or Informs to the listed host. Use this command once for each host to which this device should send Traps. +Step 2. Use the snmp-server enable traps command in global configuration mode to +enable the sending of all supported types of Trap and Inform messages. D + +Example D-21 shows a sample configuration. In most cases, you would send either Traps or Informs to a particular NMS, but not both. So, for this example, the configuration shows how to configure to send Traps to one host (10.1.3.3), and Informs to another host +(10.1.3.4). Note that this configuration is added to Router R1 from Figure D-12, but it could have been added to Router R2 or to any of the LAN switches as well. +Example D-21 Configuring SNMP Version 2c on Router R1 to Support Sending Traps + +snmp-server host 10.1.3.3 version 2c secretTRAPpw +snmp-server host 10.1.3.4 informs version 2c secretTRAPpw +snmp-server enable traps +36 CCNA 200-301 Official Cert Guide, Volume 2 + +Verifying SNMPv2c Operation +Example D-22 displays some of the status information based on the configuration seen in the previous two examples. The variations on the show snmp command highlight several configuration settings. For example, the show snmp community command repeats the community string values, with reference to any attached IPv4 or IPv6 ACLs. The show snmp host command lists the IP address or hostname of the NMS referenced by each +snmp-server host configuration command. + +Example D-22 Confirming SNMPv2c Configuration Settings on Router R1 + +R1# show snmp community + +Community name: secretROpw +Community Index: secretROpw +Community SecurityName: secretROpw +storage-type: nonvolatile active access-list: ACL_PROTECTSNMP + +Community name: secretRWpw +Community Index: secretRWpw +Community SecurityName: secretRWpw +storage-type: nonvolatile active access-list: ACL_PROTECTSNMP + +Community name: secretTRAPpw +Community Index: secretTRAPpw +Community SecurityName: secretTRAPpw +storage-type: nonvolatile active + +R1# show snmp location +Atlanta + +R1# show snmp contact +Tyler B + +R1# show snmp host +Notification host: 10.1.3.4 udp-port: 162 type: inform +user: secretTRAPpw security model: v2c + +Notification host: 10.1.3.3 udp-port: 162 type: trap +user: secretTRAPpw security model: v2c + +The show snmp command takes the opposite approach from the commands in Example +D-22, focusing almost completely on status and counter information, rather than repeating configuration settings. This command lists dozens of lines of detailed information, so the sample in Example D-23 shows just enough of the output to give you a sense of the kinds of information found there, with comments following the example. +Appendix D: Topics from Previous Editions 37 + +Example D-23 Finding SNMPv2c Message Load on Router R1 + +R1# show snmp +Chassis: FTX162883H0 +Contact: Tyler B +Location: Atlanta +7735 SNMP packets input +0 Bad SNMP version errors +9 Unknown community name +0 Illegal operation for community name supplied +2 Encoding errors +51949 Number of requested variables +2 Number of altered variables +3740 Get-request PDUs +3954 Get-next PDUs +7 Set-request PDUs +0 Input queue packet drops (Maximum queue size 1000) +7850 SNMP packets output +0 Too big errors (Maximum packet size 1500) +0 No such name errors +0 Bad values errors +0 General errors +7263 Response PDUs +126 Trap PDUs +! Lines omitted for brevity + +The output in Example D-23 was taken from Router R1 as shown in the earlier examples, after doing some testing from the NMS at address 10.1.3.3. The highlighted items point out the number of SNMP packets received (input) and sent (output), as well as the number of requested MIB variables—that is, the number of variables requested in different SNMP Get requests. (Note that SNMP also supports the GetNext and GetBulk commands, so a single NMS user click can cause the NMS to Get many variables from an agent; thus, it is not unusual for the requested variables counter to get very large.) The output also shows that seven Set requests were received, resulting in two changes to variables. The fact that two Set requests changed variables is a good fact to know if you are wondering if someone has +reconfigured something on the device using SNMP. D Implementing SNMP Version 3 +SNMPv3 configuration on Cisco routers and switches has some commands in common with SNMPv2c configuration, and some completely different commands. The configuration to support sending Traps and Informs, using the snmp-server host and snmp-server enable traps commands, works almost identically, with a few small differences. However, SNMPv3 replaces all references to communities, and as a result does not use the snmp-server community command at all. Instead, it uses the snmp-server group and snmp-server user commands to configure the security features available to SNMPv3. + +SNMPv3 has many more configuration options, and it is easy to get confused by the details. So, to get started, first look at a short SNMPv3 configuration example, as shown in Example +38 CCNA 200-301 Official Cert Guide, Volume 2 + +D-24. The example highlights the values you would have to choose, but the values are either text fields (names and passwords) or the IP address of the NMS. This configuration could be used to replace the SNMPv2c configuration and use username/password authentication. The requirements met in the example are + +■ Use SNMPv3 authentication (basically replacing SNMPv2 communities). +■ Use username Youdda and authentication password madeuppassword (in your network, you would choose your own values). +■ Do not use SNMPv3 privacy (that is, message encryption). ■ Allow both read (Get) and write (Set) access. +■ Send Traps to an NMS (10.1.3.3), authenticating with the same username. + +Example D-24 Configuring SNMPv3 on R1—Authentication Only + +R1(config)# snmp-server group BookGroup v3 auth write v1default +R1(config)# snmp-server user Youdda BookGroup v3 auth md5 madeuppassword +R1(config)# snmp-server host 10.1.3.3 version 3 auth Youdda + +Given the list of requirements, you could probably just read the configuration in Example D-24, compare that to the list of requirements preceding the example, and correctly guess what most of the command parameters mean. However, we need to get into more detail to work through these commands and their options so that you understand the entire configu-ration, which is exactly what the next few pages do. + +SNMPv3 Groups +SNMPv3 authentication uses a username/password combination. When Cisco created its SNMPv3 implementation in IOS, it realized that it might be useful to have groups of users that use some of the same security settings. So, rather than have each snmp-server user command (the command that defines a user) define every single security parameter, Cisco put some of the security configuration settings into the snmp-server group command. This command holds SNMPv3 security settings that are often the same between a group of +SNMPv3 users; each snmp-server user command then refers to one SNMP group. This next topic explores those security parameters defined on the snmp-server group command. + +Figure D-13 shows the entire snmp-server group command. The required parameters on +the left include a name that the network engineer can make up; it only needs to match other commands on the local router. For SNMPv3 configuration, the v3 keyword would always be used. The text following this figure then details the rest of the parameters in the figure. + + +Neither Auth nor Priv + +Auth but no Priv + +Auth and Priv + + + +snmp-server group name v3 noauth | auth | priv write viewname access [ipv6] aclname + + + +You Choose Optional: Required for Set + +Optional: Filter SNMP Managers + +Figure D-13 SNMPv3 Groups—Configuration Command Parameters +Appendix D: Topics from Previous Editions 39 + +The next parameter in the command configures this group of users to use one of three SNMPv3 security levels. As you can see from the summary in Table D-5, all three security levels provide message integrity for their messages, which confirms that the message has not been changed in transit. The auth option adds authentication to message integrity, using a username and password, with IOS storing the password with a hash and never sending the password as clear text. The last increase in security level, configured by using the priv secu-rity level, causes the SNMP manager and agent to encrypt the entire SNMP packet for all SNMP messages sent, in addition to performing message integrity and authentication. + +Table D-5 SNMPv3 Security Levels Keywords and Their Meanings + +Command Keyword +noauth auth +priv + +Keyword in Messages +noAuthNoPriv authNoPriv +authPriv + +Checks Message Integrity? +Yes Yes +Yes + +Performs Authentication? +No Yes +Yes + +Encrypts Messages? +No No +Yes + + +Continuing to look at the snmp-server group command in Figure D-13, notice that it ends with an optional ACL to filter packets. This same idea is used in SNMPv2c to reference an IPv4 or IPv6 ACL to filter incoming messages coming from the SNMP manager. + +So far, the discussion has ignored one part of the snmp-server group command: the idea of SNMPv3 MIB views. MIB views define a subset of the MIB. IOS supplies a series of MIB views for us, and you can define your own MIB views if you like. However, this book dis-cusses only one predefined MIB view that goes by the name v1default, which is a MIB view that includes all the useful parts of the MIB. Instead of focusing on the depths of how you might create different views of a router or switch MIB that has literally thousands of vari-ables, focus on how the snmp-server group command uses that one MIB view that includes the majority of the MIB. + +By default, each SNMPv3 group, as defined with the snmp-server group command, has a read MIB view of v1default, and no write view. As a result, the SNMP agent will process received SNMPv3 Get requests, but not process received SNMPv3 Set requests. That com-plete lack of a write MIB view basically results in read-only behavior for the SNMP agent, as shown at the top of Figure D-14. + +Read-Only (Default) + +Read View: V1Default + + + +View: V1Default MIB + +Write View: (None) +D + +X +View: V1Default + + + + +Read View: V1Default Write View: V1Default Read/Write: Configure write v1default +Figure D-14 SNMPv3 Views Creating Read-Only and Read-Write Effect +40 CCNA 200-301 Official Cert Guide, Volume 2 + +The bottom of the figure shows the concept behind configuring an SNMP group with the write v1default parameters, causing the group to use the same write view of the MIB that is used for reading the MIB. By including write v1default in the snmp-server group com-mand, you migrate from a default operation of allowing only Gets to now also allowing Sets. + +To pull these ideas together, Example D-25 shows four similar SNMPv3 groups, which could later be referenced by snmp-server user commands. Two commands use the parame-ters write v1default, and two do not, so two groups create read-write (Get and Set) support, and two groups create read-only (Get only) support. Also, note that two groups refer to an IPv4 ACL by name (SNMPACL), and two do not. The ends of the lines in the example list comments about each command. +Example D-25 SNMPv3 Groups—Comparisons with Write Views and ACL Security + +ip access-list standard SNMPACL +permit host 10.1.3.3 +! +snmp-server group Group1 v3 noauth ! No writes, no ACL +snmp-server group Group2 v3 noauth write v1default ! Allows writes, no ACL +snmp-server group Group3 v3 noauth access SNMPACL ! No writes, uses ACL +snmp-server group Group4 v3 noauth write v1default access SNMPACL ! Allows writes, uses ACL + +Note that while all four examples use an authentication type of noauth, groups could be defined that use the auth and priv types as well. Configuring groups with any one of the security levels does not change the meaning and use of the write and access keywords and their parameters. The security level simply needs to match the security level configured +on the snmp-server user commands that refer to the group by name, as seen in the next section. + +SNMPv3 Users, Passwords, and Encryption Keys +The snmp-server user command configures other security parameters for the SNMP agent. In particular, it configures + +■ The username +■ The authentication password and the authentication hash algorithm (MD5 or SHA) ■ The encryption key and the encryption algorithm (DES, 3DES, AES) +■ A reference to an snmp-server group command by name, which holds more security configuration + +The snmp-server user command still has plenty of moving parts, even with some of the security configuration sitting in the snmp-server group command. Figure D-15 connects these configuration concepts together, showing both commands in one place. Some expla-nation follows the figure. + +The snmp-server user command creates the username itself. The network engineer can make up a name. The next two parameters must match the chosen snmp-server group com-mand associated with this user, by matching the group name and the v3 keyword (meaning SNMPv3). Any mistakes here will result in this SNMP user not being associated with the SNMP group. +Appendix D: Topics from Previous Editions 41 + +snmp-server group group v3 noauth | auth | priv write viewname access [ipv6] aclname + + +Match Only Both + + + +snmp-server user user group v3 auth md5 password +sha password + +priv DES keyvalue 3DES keyvalue +AES keylength keyvalue + +Figure D-15 SNMPv3 Users and Groups: Configured + +You must pay particular attention to the security type in the associated snmp-server group command, because it dictates what parameters must be configured toward the end of the snmp-server user command. As noted in Figure D-15 with the arrowed lines, the use of the auth keyword in the snmp-server group command requires that you configure authen-tication parameters for the user in the snmp-server user command: the password and the choice of authentication hash algorithms. If using the priv keyword in the snmp-server group command, the snmp-server user command must define both authentication and pri-vacy parameters as shown in the figure. + +NOTE IOS allows you to misconfigure the snmp-server user command so that it omits the auth or priv keyword, even when the referenced snmp-server group command uses the auth or priv parameter. However, that misconfiguration causes the SNMP agent to not be able to communicate with the SNMP manager. For instance, if the snmp-server user com-mand omits the auth keyword and associated parameters, but the snmp-server group com-mand uses the auth keyword, IOS accepts the configuration commands, but authentication fails when the agent and NMS try to communicate. + +Example D-26 shows a series of snmp-server group and matching snmp-server user com-mands, one after the other, so you can more easily see the parameters. Note that the snmp-server group commands do not include the optional parameters to enable writes (write v1default) or to use an ACL, just to reduce clutter. +Example D-26 SNMPv3 Configuration Samples: Groups and Users + +! The group uses noauth, so the user Youdda1 has no auth nor priv keyword +snmp-server group BookGroup1 v3 noauth +snmp-server user Youdda1 BookGroup1 v3 +D +! The next group uses auth, so the next two users use the auth keyword, but not priv +snmp-server group BookGroup2 v3 auth +snmp-server user Youdda2 BookGroup2 v3 auth md5 AuthPass2 +snmp-server user Youdda3 BookGroup2 v3 auth sha AuthPass3 + +! The next group uses priv, so the next users use both the auth and priv keywords. +snmp-server group BookGroup3 v3 priv +snmp-server user Youdda4 BookGroup3 v3 auth md5 AuthPass3 priv des PrivPass4 +snmp-server user Youdda5 BookGroup3 v3 auth md5 AuthPass3 priv 3des PrivPass5 +snmp-server user Youdda6 BookGroup3 v3 auth sha AuthPass4 priv aes 128 PrivPass6 +42 CCNA 200-301 Official Cert Guide, Volume 2 + +Note that the example also shows samples of several authentication and encryption options, as listed in Figure D-15. + +Verifying SNMPv3 +Verifying SNMPv3 operation begins with confirming the details of the SNMPv3 configura-tion. You can of course find these with the show running-config command, but two com-mands in particular repeat the configuration settings. Example D-27 shows the output from one of those commands, show snmp user, taken from Router R1 after adding the configu-ration listed in Example D-26. +Example D-27 Verifying SNMPv3 Configuration Settings + +R3# show snmp user +User name: Youdda1 +Engine ID: 800000090300D48CB57D8200 +storage-type: nonvolatile active +Authentication Protocol: None +Privacy Protocol: None +Group-name: BookGroup1 + +User name: Youdda2 +Engine ID: 800000090300D48CB57D8200 +storage-type: nonvolatile active +Authentication Protocol: MD5 +Privacy Protocol: None +Group-name: BookGroup2 + +! Skipping Youdda3, Youdda4, and Youdda5 for brevity + +User name: Youdda6 +Engine ID: 800000090300D48CB57D8200 +storage-type: nonvolatile active +Authentication Protocol: SHA +Privacy Protocol: AES128 +Group-name: BookGroup3 + +In particular, work through the highlighted output for users Youdda1, Youdda2, and Youdda6, as compared to the configuration in Example D-26. All the highlighted entries basically repeat the settings from the configuration. + +Example D-28 lists output from the show snmp group command, which also confirms con-figuration settings from Example D-26. The most challenging thing to find in this output is what is missing, rather than what is there. Note that this command does not list the SNMP usernames that happen to refer to this group. Also, for groups that do not use an ACL, there is no obvious text that states that no ACL is used. Make sure to compare the output for BookGroup1, which uses an ACL, and the output for BookGroup2, which does not use an ACL. +Appendix D: Topics from Previous Editions 43 + +Example D-28 Verifying SNMPv3 Using show snmp group + + +R3# show snmp group +groupname: BookGroup1 +contextname: +readview : v1default +notifyview: + + +security model:v3 noauth +storage-type: nonvolatile + + + + +row status: active + +groupname: BookGroup2 + +access-list: ACL_PROTECTSNMP + +security model:v3 auth + + + +contextname: +readview : v1default +notifyview: +row status: active +! Lines omitted for brevity + +storage-type: nonvolatile +writeview: + + +Implementing SNMPv3 Notifications (Traps and Informs) +SNMP agents can use SNMPv3 to send unsolicited notifications—Trap and Inform mes-sages—to SNMP managers. SNMPv2c uses communities, in this case using the SNMPv2c notification community concept. SNMPv3 uses the same security levels just discussed, but as applied to SNMPv3 notifications. + +To configure an SNMPv3 agent to send notifications, you add the security level and the username to the snmp-server host command. That configuration links to the same kinds of snmp-server user commands discussed earlier in this section, which in turn link to an snmp-server group command. Figure D-16 shows how the commands connect to each other. + +snmp-server group groupname v3 noauth | auth | priv write viewname access [ipv6] aclname + + +2 3 + + + +snmp-server user username + + +1 + +groupname v3 auth md5 password +sha password + +priv DES keyvalue 3DES keyvalue +AES {128|192|256} keyvalue + +D + + + +snmp-server host address version 3 noauth | auth | priv username +Figure D-16 Connecting SNMPv3 Notification Configuration with User and Group + +NOTE IOS allows you to configure commands that refer to the correct username and group name, but with different security levels, with no error messages. However, communi-cation with the NMS then fails. + +Example D-29 shows a few samples of configuration notifications that use SNMPv3. The samples rely on the SNMPv3 usernames and groups as defined in Example D-26. Feel free +44 CCNA 200-301 Official Cert Guide, Volume 2 + +to refer back to that example, and check to make sure that each snmp-server host com-mand in Example D-29 refers to the correct SNMP security level used by each linked snmp-server group command. +Example D-29 Verifying SNMPv3 Configuration Settings + +! The group uses noauth, so the user Youdda1 has no auth nor priv keyword + +snmp-server enable traps +snmp-server host 10.1.3.3 version 3 noauth Youdda1 +snmp-server host 10.1.3.4 informs version 3 auth Youdda2 +snmp-server host 10.1.3.5 version 3 priv Youdda4 + + +! Traps w/ noauth +! Informs w/ auth +! Traps w/ priv + + +As always, the show snmp command lists the counters that show how many messages flow, including the number of Trap and Inform messages sent by the SNMP agent. To verify the configuration of SNMPv3 notification to NMS hosts, use the show snmp host command. Example D-30 shows the results after configuring Example D-29; note that almost all the fields in Example D-30 repeat the configuration parameters from Example D-29. +Example D-30 Verifying SNMPv3 Configuration Settings + + +R3# show snmp host +Notification host: 10.1.3.4 +user: Youdda2 security model: + +Notification host: 10.1.3.3 +user: Youdda1 security model: + +Notification host: 10.1.3.5 +user: Youdda4 security model: + + +udp-port: 162 +v3 auth + +udp-port: 162 +v3 noauth + +udp-port: 162 +v3 priv + + +type: inform + + +type: trap + + +type: trap + + +Summarizing SNMPv3 Configuration +SNMPv3 configuration has many parameters to choose from in several commands. As a result, putting the commands into a configuration checklist earlier in this section did not work as well for learning, so the text instead spelled out the pieces little by little. Now that you have seen how to configure the individual pieces, this configuration checklist summa-rizes all the different SNMPv3 configuration options discussed in this chapter, for easier + +review. + +Step 1. + + + + + + +Step 2. + + +Use the snmp-server group groupname v3 {noauth | auth | priv} [write v1de-fault] [access [ipv6] acl-name] command in global configuration mode to enable the SNMP agent (if not already started), create a named SNMPv3 group of security settings, set the security level, optionally override the default write view with the same view as defaulted for use as the read MIB view (v1default), and optionally restrict incoming SNMP messages based on the optional refer-enced IPv4 or IPv6 ACL. +To configure users whose referenced SNMPv3 group has a security level of noauth, use the snmp-server user username groupname v3 command in global configuration mode, making sure to reference an SNMPv3 group with security level of noauth configured. +Appendix D: Topics from Previous Editions 45 + + +Step 3. To configure users whose referenced SNMPv3 group use the security level of auth: +A. Use the snmp-server user username groupname v3 auth md5 password command in global configuration mode to configure the user and authen-tication password, and to choose to use MD5 as the authentication hash algorithm. +B. Alternatively, use the snmp-server user username groupname v3 auth sha password command in global configuration mode to configure the user and authentication password, and to choose to use SHA as the authentica-tion hash algorithm. +Step 4. To configure users that use the security level of priv, you will add parameters to the end of the snmp-server user command syntax as configured in step 3, as follows: +A. Add the priv des encryption-key parameters in global configuration mode to the end of the snmp-server user command, to enable the use of DES as the encryption algorithm and to set the encryption key. +B. Add the priv 3des encryption-key parameters in global configuration mode to the end of the snmp-server user command, to enable the use of triple DES (3DES) as the encryption algorithm and to set the encryption key. +C. Add the priv aes {128 | 192 | 256} encryption-key parameters in global configuration mode to the end of the snmp-server user command, to enable the use of AES as the encryption algorithm, to set the length of the encryption key in bits, and to set the seed for the encryption key. +Step 5. Enable the SNMP agent to send notification messages (Traps and/or Informs) to an NMS as follows: +A. Use the snmp-server host {hostname | ip-address} [informs | traps] version 3 {noauth | auth | priv} username command in global configuration mode to configure the SNMP agent to send SNMPv3 Traps to the listed host, using the listed username. Use this command once for each host to which this device should send Traps. Include the informs keyword to send Informs; the traps keyword is the default setting. Use the same security level setting as the link SNMPv3 group. +B. Use the snmp-server enable traps command in global configuration mode to enable the sending of all supported notifications to all hosts defined in snmp-server host commands. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +D + +Note that if you review this checklist and get lost, make sure to review and study this sec-tion again. SNMPv3 configuration uses a lot of different parameters on three different com-mands, so it is easy to get lost. The checklist is best used for review once you have a good understanding of the commands. + +NOTE The content under the heading “Analyzing LAN Physical Standard Choices” was most recently published for the 100-105 Exam in 2016, in Chapter 10 of the Cisco CCENT/CCNA ICND1 100-105 Official Cert Guide. +46 CCNA 200-301 Official Cert Guide, Volume 2 + +Analyzing LAN Physical Standard Choices +When you look at the design of a network designed by someone else, you can look at all the different types of cabling used, the different types of switch ports, and the Ethernet standards used in each case. Then ask yourself: Why did they choose a particular type +of Ethernet link for each link in the network? Asking that question, and investigating the answer, starts to reveal much about building the physical campus LAN. + +The IEEE has done an amazing job developing Ethernet standards that give network design-ers many options. Two themes in particular have helped Ethernet grow over the long term: + +■ The IEEE has developed many additional 802.3 standards for different types of cabling, different cable lengths, and for faster speeds. +■ All the physical standards rely on the same consistent data-link details, with the same standard frame formats. That means that one Ethernet LAN can use many types of physi-cal links to meet distance, budget, and cabling needs. + +For example, think about the access layer of the generic design drawings, but now think about cabling and Ethernet standards. In practice, access layer switches sit in a locked wir-ing closet somewhere on the same floor as the end user devices. Electricians have installed unshielded twisted-pair (UTP) cabling used at the access layer, running from that wiring closet to each wall plate at each office, cubicle, or any place where an Ethernet device might need to connect to the LAN. The type and quality of the cabling installed between the wiring closet and each Ethernet outlet dictate what Ethernet standards can be sup-ported. Certainly, whoever designed the LAN at the time the cabling was installed thought about what type of cabling was needed to support the types of Ethernet physical standards that were going to be used in that LAN. + +Ethernet Standards +Over time, the IEEE has continued to develop and release new Ethernet standards, for new faster speeds and to support new and different cabling types and cable lengths. Figure D-17 shows some insight into Ethernet speed improvements over the years. The early standards up through the early 1990s ran at 10 Mbps, with steadily improving cabling and topologies. Then, with the introduction of Fast Ethernet (100 Mbps) in 1995, the IEEE began ramping up the speeds steadily over the next few decades, continuing even until today. + + +Thicknet (DIX) + +10M + +Thinnet (IEEE) + +10M + +Ethernet 10Base-T + +10M + +Fast Ethernet + +100M + +Gigabit 10 Ethernet Gig E + +1G 10G + +40 100 Gig E Gig E + +40G 100G + + +1980 1985 1990 1995 2000 2005 2010 +Figure D-17 Ethernet Standards Timeline + +NOTE Often, the IEEE first introduces support for the next higher speed using some forms of fiber optic cabling, and later, sometimes many years later, the IEEE completes the work to develop standards to support the same speed on UTP cabling. Figure D-17 shows the earliest standards for each speed, no matter what cabling. +Appendix D: Topics from Previous Editions 47 + +When the IEEE introduces support for a new type of cabling, or a faster speed, they create a new standard as part of 802.3. These new standards have a few letters behind the name. So, when speaking of the standards, sometimes you might refer to the standard name (with letters). For instance, the IEEE standardized Gigabit Ethernet support using inexpensive UTP cabling in standard 802.3ab. However, more often, engineers refer to that same stan-dard as 1000BASE-T or simply Gigabit Ethernet. Table D-6 lists some of the IEEE 802.3 physical layer standards and related names for perspective. + +Table D-6 IEEE Physical Layer Standards + +Original IEEE Standard +802.3i 802.3u 802.3z 802.3ab 802.3ae 802.3an 802.3ba +802.3ba + +Shorthand Name +10BASE-T 100BASE-T 1000BASE-X 1000BASE-T 10GBASE-X 10GBASE-T 40GBASE-X +100GBASE-X + +Informal Names + +Ethernet +Fast Ethernet +Gigabit Ethernet, GigE Gigabit Ethernet, GigE 10 GigE +10 GigE 40 GigE +100 GigE + +Speed + +10 Mbps 100 Mbps +1000 Mbps (1 Gbps) 1000 Mbps (1 Gbps) 10 Gbps +10 Gbps 40 Gbps +100 Gbps + +Typical Cabling +UTP UTP Fiber UTP Fiber UTP Fiber +Fiber + + +Choosing the Right Ethernet Standard for Each Link +When designing an Ethernet LAN, you can and should think about the topology, with an access layer, a distribution layer, and possibly a core layer. But thinking about the topology does not tell you which specific standards to follow for each link. Ultimately, you need to pick which Ethernet standard to use for each link, based on the following kinds of facts about each physical standard: + +■ The speed +■ The maximum distance allowed between devices when using that standard/cabling ■ The cost of the cabling and switch hardware +■ The availability of that type of cabling already installed at your facilities + + +Consider the three most common types of Ethernet today (10BASE-T, 100BASE-T, and 1000BASE-T). They all have the same 100-meter UTP cable length restriction. They all use UTP cabling. However, not all UTP cabling meets the same quality standard, and as it turns out, the faster the Ethernet standard, the higher the required cable quality category needed to support that standard. As a result, some buildings might have better cabling that sup-ports speeds up through Gigabit Ethernet, whereas some buildings may support only Fast Ethernet. + +The Telecommunications Industry Association (TIA; tiaonline.org) defines Ethernet cabling quality standards. Each Ethernet UTP standard lists a TIA cabling quality (called a category) as the minimum category that the standard supports. For example, 10BASE-T allows for Category 3 (CAT3) cabling or better. 100BASE-T requires higher-quality CAT5 cabling, and 1000BASE-T requires even higher-quality CAT5e cabling. (The TIA standards follow a gen-eral “higher number is better cabling” in their numbering.) For instance, if an older facility had only CAT5 cabling installed between the wiring closets and each cubicle, the engineers + + + +D +48 CCNA 200-301 Official Cert Guide, Volume 2 + +would have to consider upgrading the cabling to fully support Gigabit Ethernet. Table D-7 lists the more common types of Ethernet and their cable types and length limitations. + +Table D-7 Ethernet Types, Media, and Segment Lengths (Per IEEE) + +Ethernet Type 10BASE-T 100BASE-T 1000BASE-T 10GBASE-T 10GBASE-T1 1000BASE-SX 1000BASE-LX +1000BASE-LX + +Media +TIA CAT3 or better, 2 pairs +TIA CAT5 UTP or better, 2 pairs TIA CAT5e UTP or better, 4 pairs TIA CAT6a UTP or better, 4 pairs TIA CAT6 UTP or better, 4 pairs Multimode fiber +Multimode fiber +9-micron single-mode fiber + +Maximum Segment Length 100 m (328 feet) +100 m (328 feet) 100 m (328 feet) 100 m (328 feet) +38–55 m (127–180 feet) 550 m (1800 feet) +550 m (1800 feet) +5 km (3.1 miles) + + +1 The option for 10GBASE-T with slightly less quality CAT6 cabling, but at shorter distances, is an attempt to support 10Gig Ethernet for some installations with CAT6 installed cabling. + +Ethernet defines standards for using fiber optic cables as well. Fiber optic cables include ultrathin strands of glass through which light can pass. To send bits, the switches can alter-nate between sending brighter and dimmer light to encode 0s and 1s on the cable. + +Generally comparing optical cabling versus UTP cabling Ethernet standards, two obvious points stand out. Optical standards allow much longer cabling, while generally costing more for the cable and the switch hardware components. Optical cables experience much less interference from outside sources compared to copper cables, which allows for longer distances. + +When considering optical Ethernet links, many standards exist, but with two general catego-ries. Comparing the two, the cheaper options generally support distances into the hundreds of meters, using less expensive light-emitting diodes (LED) to transmit data. Other optical standards support much longer distances into multiple kilometers, using more expensive cabling and using lasers to transmit the data. The trade-off is basic: For a given link, how long does the cable need to run, what standards support that distance, and which is the least expensive to meet that need? + +In reality, most engineers remember only the general facts from tables like Table 10-3: 100 meters for UTP, about 500 meters for multimode fiber, and about 5000 meters for some single mode fiber Ethernet standards. When it is time to get serious about designing the details of each link, the engineer must get into the details, calculating the length of each cable based on its path through the building, and so on. + +NOTE The content under the heading “Metro Ethernet” was most recently published for the 200-105 Exam in 2016, in Chapter 14 of the Cisco CCNA ICND2 200-105 Official Cert Guide. +Appendix D: Topics from Previous Editions 49 + +Metro Ethernet +This section discusses virtual circuits in Ethernet WANs. + +Ethernet Virtual Circuit Bandwidth Profiles +Before leaving MetroE to move on to MPLS, it helps to consider some ideas about data usage over the WAN links and a whole topic area related to EVC Bandwidth Profiles (BWP). + +First, ignoring MetroE for a moment, anyone who has shopped for mobile phone data plans in the 2010s has already thought about data usage with carrier networks. With mobile phones, many carriers offer some kind of tiered pricing: the more data you want to send and receive, the more money you spend per month. Why do they charge more based on usage? The SP spends a lot of capital and a lot of ongoing operational expense to build and operate its network. It seems fair to charge those who use less of the network a little less money, and those who use more a little more money. Simple enough. + +Most private WAN services use the same kind of usage-based pricing, and this last MetroE topic discusses some of the terminology and concepts. + +The first big idea is this: The access links transmit bits at a set predefined speed based on Ethernet standards. Each Ethernet access link on a MetroE WAN uses a specific Ethernet standard that runs at a specific speed. Those speeds are 10 Mbps, 100 Mbps, 1000 Mbps (that is, 1 Gbps), 10 Gbps, and so on. And while the IEEE has begun adding some new speeds for Ethernet standards, speeds that are not a multiple of 10 versus the next slower speed, the point is this: If a site’s MetroE access link is using an Ethernet standard that is a 100-Mbps standard, then the bits are transmitted at 100 Mbps. + +At the same time, the MetroE SP wants to be able to charge customers based on usage, and to be a little more flexible than pricing based on the speed of the access links. These final few pages of the MetroE topics in this chapter show how a MetroE SP can charge for speeds other than the access link speeds. + +Charging for the Data (Bandwidth) Used +Think through this scenario. A potential customer looks at a MetroE provider’s pricing. This customer wants an E-Line service between two sites only. They know that they need at least 100 Mbps of capacity (that is, bandwidth) between the sites. But because the service has +the word “Ethernet” in it, the potential customer thinks the service is either 10 Mbps, 100 Mbps, 1 Gbps, and so on. So they look up pricing for an E-Line service at those prices, and +think: D +■ 100 Mbps: Reasonably good price, but we need more capacity +■ 1000 Mbps: More than we want to spend, it’s enough capacity, but probably too much + +As it turns out, what this customer really wants is 200 Mbps between the two sites. However, there is no Ethernet standard that runs at 200 Mbps, so there is no way to use access links that run at 200 Mbps. But there is a solution: an E-Line service, with a Bandwidth Profile that defines a 200-Mbps committed information rate (CIR) over the +point-to-point EVC between the customer’s two routers. Figure D-18 shows the ideas and terms. +50 CCNA 200-301 Official Cert Guide, Volume 2 + + +200 Mbps CIR EVC + +R1 G0/1 SW SW G0/2 R2 + + +1 Gbps Access Link 1 Gbps Access Link Figure D-18 Example: 200-Mbps CIR Supported by 1-Gbps Access Links +The big ideas are simple, although the methods to control the data are new. The SP, per the contract with the customer, agrees to not only forward Ethernet frames between the two +E-Line sites, but commits to a CIR of 200 Mbps. That is, the carrier commits to pass 200 Mbps worth of Ethernet frames over time. + +When a customer asks for a new E-Line with a 200-Mbps CIR, they could send lots more data than 200 Mbps. Remember, the literal transmission rate would be 1 Gbps in this exam-ple, because the access links are 1-Gbps links. But over time, if all the customers that asked for a 200-Mbps CIR E-Line sent lots more than 200 Mbps worth of data, the SP’s network could become too congested. The SP builds its network to support the traffic it has com-mitted to send, plus some extra for expected overuse, and some extra for growth. But it is too expensive to build a network that allows customers that ask for and pay for 200 Mbps to send at 1 Gbps all the time. + +Controlling Overages with Policing and Shaping +To make the idea of fast access links with a slower CIR on the EVCs work, and work well, both the SP and the customer have to cooperate. The tools are two Quality of Service (QoS) tools called policing and shaping. + +Historically, in some similar WAN services (like Frame Relay), the SP would actually let you send more data than your CIR, but MetroE networks typically use policing to discard the excess. A policer can watch incoming frames and identify the frames associated with each EVC. It counts the bytes in each frame, and determines a bit rate over time. When the customer has sent more bits than the CIR, the SP discards enough of the currently arriving frames to keep the rate down to the CIR. Figure D-19 shows the location of policing in the same example shown in Figure D-18. + + +Police to 200 Mbps; Discard Frames! + +Police to 200 Mbps; Discard Frames! +200 Mbps CIR + + +R1 G0/1 SW SW G0/2 R2 + +Figure D-19 SP Polices Incoming Traffic to Discard Excess Beyond CIR + +Recapping this scenario, the customer decides to ask the MetroE SP for an E-Line. The customer’s routers use a 1-Gbps access link that allows the E-Line to support a 200-Mbps CIR. To protect the SP’s network, the SP now uses ingress policing to monitor the bits/sec-ond received over each end of the E-Line’s point-to-point EVC. And the SP discards some incoming frames when the rate gets too high. + +Having the SP discard a few frames is actually not that harmful if QoS is implemented cor-rectly, but with MetroE, if the SP is policing as shown in Figure D-19, the customer needs +Appendix D: Topics from Previous Editions 51 + +to use the other QoS tool: shaping. Shaping, as implemented on the customer routers, lets the routers slow down. Shaping tells the routers, on the MetroE access link, to send some frames, and then wait; then send more, then wait; and to do that repeatedly. Shaping can be configured for that same rate as the CIR (200 Mbps in this case), so that the SP does not have to discard any traffic. + +Summarizing some of these key points: + +■ MetroE uses the concept of an Ethernet Virtual Connection (EVC), tying a committed number of bits/second called the committed information rate (CIR) to the EVC. +■ The access links need to be fast enough to handle the combined CIRs for all EVCs that cross the link. +■ For each EVC, the SP commits to forward the bits/second defined as the CIR for that EVC. +■ To protect its network from being overrun with too much traffic, the SP can use polic-ing, monitoring the incoming traffic rate on each EVC and discarding traffic that goes beyond the CIR. +■ To prevent too much of its traffic from being discarded by the SP, the customer slows down its rate of sending over the EVC to match that same CIR, using shaping on the cus-tomer router. + +NOTE The content under the heading “MPLS VPNs” was most recently published for the 200-105 Exam in 2016, in Chapter 14 of the Cisco CCNA ICND2 200-105 Official Cert Guide. + + +MPLS VPNs +This section discusses an OSPF design issue that exists when using MPLS VPNs. + +OSPF Area Design with MPLS VPN +Now that you know the basics about what happens with routing protocols at the edge of an MPLS network, take a step back and ponder OSPF area design. For all the other WAN +services discussed in the book, the WAN service is just one more data link, so the WAN sits inside one area. With MPLS, the MPLS service acts like a bunch of routers. If you use OSPF as the PE-CE routing protocol, some choices must be made about OSPF areas, and about which WAN links are in which area, and where the backbone area can and should be. + +MPLS allows for a couple of variations on OSPF area design, but they all use an idea that was added to OSPF for MPLS VPNs, an idea that has come to be known informally as the OSPF super backbone. The idea is an elegant solution that meets OSPF needs and the requirement that the MPLS PEs, when using OSPF, must be in some OSPF area: +■ The MPLS PEs form a backbone area by the name of a super backbone. +■ Each PE-CE link can be any area—a non-backbone area or the backbone area. + + + + + + + + + + + +D + + +Although the super backbone supports some functions and logic beyond the scope of this book, for the purposes of getting a basic understanding of OSPF’s use with MPLS, you can think of the super backbone as simply the majority of an enterprise’s OSPF backbone area, +52 CCNA 200-301 Official Cert Guide, Volume 2 + +but with the option to make the backbone area larger. The CE routers at a customer site may not be part of the backbone area, or may be, at the choice of the customer network engineers. + +For example, for a nice clean design, each of the four customer sites in Figure D-20 uses a different area. The PE-CE links are part of those individual areas. The OSPF backbone area still exists, and each area connects to the backbone area, but the backbone exists in the MPLS PE routers only. + +Area 0 +Area 1 (Super Backbone) Area 2 + + + +CE1 PE PE CE2 + + + + + +CE4 PE PE CE3 + + + +Area 4 +Figure D-20 Site + +Area 3 +MPLS Design with (Super Backbone) Area 0, Non-Backbone Area for Each + + +The area design in Figure D-20 provides a clean OSPF area design. However, if migrating from some other type of WAN service, with an existing OSPF design, the network engi-neers may prefer to keep parts of an existing OSPF design, which means some sites may still need to include the backbone area. In fact, multiple WAN sites can be configured to be in the backbone area, and still function correctly. Figure D-21 shows one such example. + +Area 0 Area 0 +R1 (Super Backbone) Area 2 + + +R2 CE1 PE PE CE2 + +R3 Area 1 + + + +CE4 PE PE CE3 + + +Area 0 Area 3 Figure D-21 Using Area 0 on CE-PE Link, or for Entire Site +Appendix D: Topics from Previous Editions 53 + +In effect, the super backbone combines with the two other parts of the network configured as area 0 for one contiguous backbone area. Notice on the left side of Figure D-21 the +two sites with area 0 noted. Normally, if both customer sites implement area 0, but there were links from some other area between them, the design would break OSPF design rules. However, the OSPF backbone (area 0) links on the left, plus the OSPF super backbone area 0 created by MPLS, act together in regard to OSPF design. + +Next, focus on the site at the upper left. That site represents what might have existed before migrating to an MPLS design, with Router R1’s links in area 0, and the links con-nected to Routers R2 and R3 in area 1. The enterprise network engineer may have decided to leave the OSPF area design alone when connecting to the MPLS network. To support those backbone area links off Router R1, the engineer put the CE1-PE1 link into area 0. As a result, the combined customer area 0 instances and the super backbone area 0 creates one contiguous backbone area. + + + + + + + + + + + + + + + + + + + + + + +D +APPENDIX E + + + +Practice for Chapter 2: Basic IPv4 Access Control Lists + +Practice Problems +This appendix includes two sets of practice problems. The first question set lists require-ments for a single-line access control list (ACL), with your task being to create a standard numbered ACL that meets the requirements. The second question set shows an existing access-list command, with your job being to determine the range of IP addresses matched by the ACL. + +Note that you can find additional practice on the author’s blog, which is linked from the author’s website, www.certskills.com. + +Practice Building access-list Commands +Table E-1 lists the criteria for several practice problems. Your job: Create a one-line stan-dard ACL that matches the packets. The answers are listed later in this appendix. + + +Table E-1 Problem +1 2 3 4 5 6 7 8 9 10 11 12 13 14 +15 + +Building One-Line Standard ACLs: Practice Criteria +Packets from 10.1.1.1 +Packets from hosts with 10.1.1 as the first 3 octets Packets from hosts with 10.1 as the first 2 octets Packets from any host +Packets from subnet 192.168.3.128/29 Packets from subnet 192.168.3.192/28 Packets from subnet 192.168.3.64/27 Packets from subnet 172.20.192.192/26 Packets from subnet 172.20.200.0/22 Packets from subnet 172.20.203.0/25 Packet from subnet 192.168.99.0/30 Packet from subnet 192.168.99.0/28 Packet from subnet 172.28.28.0/23 Packet from subnet 172.28.28.0/22 +Packet from subnet 172.28.28.0/24 + + + + +Reverse Engineering from ACL to Address Range +For this second question set, look at the existing access-list commands in Table E-2. In each case, make a notation about the exact IP address, or range of IP addresses, matched by the command. + + +Table E-2 Problem +1 2 3 4 5 6 7 8 9 10 11 12 13 14 +15 + +Finding IP Addresses/Ranges Matching by Existing ACLs +Commands for Which to Predict the Source Address Range +access-list 1 permit 192168.4.5 +. +access-list 2 permit 192.168.4.128 0.0.0.3 access-list 3 permit 192.168.4.128 0.0.0.127 access-list 4 permit 172.25.96.0 0.0.0.255 access-list 5 permit 192.168.4.128 0.0.0.31 access-list 6 permit 192.168.4.128 0.0.0.7 access-list 7 permit 172.25.96.0 0.0.7.255 access-list 8 permit 172.25.96.0 0.0.0.63 access-list 9 permit 10.10.16.0 0.0.7.255 access-list 10 permit 10.10.16.0 0.0.0.127 access-list 11 permit 192.168.17.112 0.0.0.7 access-list 12 permit 192.168.17.112 0.0.0.15 access-list 13 permit 172.19.200.0 0.0.0.63 access-list 14 permit 172.19.200.0 0.0.1.255 +access-list 15 permit 10.1.0.0 0.0.255.255 + + + +NOTE You can only rely on the method of adding these numbers together (as shown in Chapter 2, “Basic IPv4 Access Control Lists”) if you know that the access-list command comes from the router and specifically is not what someone simply wrote on a piece of paper. In this case, you can assume that the statements in Table E-2 came from a router. +4 CCNA 200-301 Official Cert Guide, Volume 2 + +Answers to Earlier Practice Problems +This section contains the answers to the two sets of practice problems. + +Answers: Practice Building access-list Commands Table E-3 lists the answers to the problems listed in Table E-1. + + +Table E-3 Problem +1 2 3 4 5 6 7 8 9 10 11 12 13 14 +15 + +Building One-Line Standard ACLs: Answers Answer +access-list 1 permit 101.1.1 +. +access-list 2 permit 10.1.1.0 0.0.0.255 access-list 3 permit 10.1.0.0 0.0.255.255 access-list 4 permit any +access-list 5 permit 192.168.3.128 0.0.0.7 access-list 6 permit 192.168.3.192 0.0.0.15 access-list 7 permit 192.168.3.64 0.0.0.31 access-list 8 permit 172.20.192.192 0.0.0.63 access-list 9 permit 172.20.200.0 0.0.3.255 access-list 10 permit 172.20.203.0 0.0.0.127 access-list 11 permit 192.168.99.0 0.0.0.3 access-list 12 permit 192.168.99.0 0.0.0.15 access-list 13 permit 172.28.28.0 0.0.1.255 access-list 14 permit 172.28.28.0 0.0.3.255 +access-list 15 permit 172.28.28.0 0.0.0.255 + + +Answers: Reverse Engineering from ACL to Address Range Table E-4 lists the answers to the problems listed in Table E-2. + + +Table E-4 Problem +1 2 3 4 5 6 7 8 9 10 +11 + +Address Ranges for Problems in Table E-2: Answers Address Range +One address: 192.168.4.5 192168.4.128 – 192.168.4.131 192.168.4.128 – 192.168.4.255 172.25.96.0 – 172.25.96.255 192.168.4.128 – 192.168.4.159 192.168.4.128 – 192.168.4.135 172.25.96.0 – 172.25.103.255 172.25.96.0 – 172.25.96.63 10.10.16.0 – 10.10.23.255 10.10.16.0 – 10.10.16.127 +. +192.168.17.112 – 192.168.17.119 +Appendix E: Practice for Chapter 2: Basic IPv4 Access Control Lists 5 +. + + +Problem 12 +13 14 +15 + +Address Range 192.168.17.112 – 192.168.17.127 17219.200.0 – 172.19.200.63 172.19.200.0 – 172.19.201.255 +10.1.0.0 – 10.1.255.255 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +E +APPENDIX F + + +Previous Edition ICND1 Chapter 35: Managing IOS Files + + +NOTE This appendix contains an entire chapter that was published in one of the past editions of a related book. The author includes this appendix with the current edition as extra reading for anyone interested in learning more; however, note that the content in this appendix has not been edited since it was published in the earlier edition, so references to exams and exam topics, and to other chapters, will be outdated. This appendix was previ-ously published as Chapter 35 of the book CCENT/CCNA ICND1 100-105 Official Cert Guide, published in 2016. + +Cisco has a wide and complex product catalog. The CCENT and CCNA R&S exams focus on two major branches of the product line: routers that run Cisco IOS software as the oper-ating system (OS) and Catalyst LAN switches that also run IOS. While the IOS for each type of device has some differences, just because routers and switches perform different functions, IOS that runs on these switches and routers has many similarities. Within the exams, Cisco attempts to be generic in that the exam does not ask you to make distinctions between different models of routers and switches. + +This chapter looks at some topics that again apply to IOS that runs in both Cisco routers and Cisco Catalyst switches. In particular, this chapter looks at the IOS itself: the file sys-tems where the IOS stores files, how to upgrade IOS, and what happens when you reboot the router or switch to upgrade the IOS. This chapter also looks at how to manage con-figuration files beyond simply keeping them inside router or switch memory in the startup-config file. This chapter also includes a brief discussion about how to recover if you lose the password for a router or switch. + +Note that this chapter focuses on features on Cisco routers. However, many of the same features work either exactly the same, or in a very similar way, on Cisco Catalyst switches. + +Foundation Topics + +Managing Cisco IOS Images and Upgrades +IOS exists as a file—a single file—that the router then loads into RAM to use as its operat-ing system (OS). This first major section of the chapter works through the story of how to upgrade to a new version of IOS. + +This first section has one primary purpose but many secondary purposes. Primarily, this sec-tion shows how to upgrade IOS on a router. As a secondary goal, this section works through + + + +a variety of small IOS features that engineers use during that upgrade process—features not covered in any detail until this point in the book. This section explains these topics, in order: +1. The IOS File System 2. Upgrading IOS Images +3. The Cisco IOS Boot Sequence + +The IOS File System +Every OS creates file systems to store files. A computer needs some type of permanent storage, but it needs more than just a place to store bytes. The OS organizes the storage into a file system, which includes directories, structure, and filenames, with the associated rules. By using a file system, the OS can keep data organized so the user and the applications can find the data later. +Every OS defines its own file system conventions. Windows OSs, for instance, use a left-leaning slash (\) in directory structures, like \Desktop\Applications. Linux and OS X use a right-leaning slash, for example, /Desktop. Each OS refers to physical disks slightly differ-ently as well, and IOS is no different. +As for the physical storage, Cisco routers typically use flash memory, with no hard disk drive. Flash memory is rewriteable, permanent storage, which is ideal for storing files that need to be retained when the router loses power. Cisco purposefully uses flash memory rather than hard disk drives in its products because there are no moving parts in flash mem-ory, so there is a smaller chance of failure as compared with disk drives. Some routers have flash memory on the motherboard. Others have flash memory slots that allow easy removal and replacement of the flash card, but with the intent that the card remain in the device most of the time. Also, many devices have USB slots that support USB flash drives. +For each physical memory device in the router, IOS creates a simple IOS file system (IFS) and gives that device a name. Example F-1 lists the surprisingly long list of IOS file systems. Note that the entries of type disk and usbflash are the physical storage devices in that router. In this case, the router has one of two of the 2901’s compact flash slots populated with a 256 MB flash card, and one of the two USB flash slots populated with an 8 GB USB flash drive. Look at the size column and prefixes column in the output to find these devices, based on their types as disk and usbflash. +Example F-1 Cisco IOS File Systems on a Router + +R2# show file systems +File Systems: + + +Size(b) +- +- +- +- +- +* 256487424 + +Free(b) +- +- +- +- +- +49238016 + +Type Flags +opaque rw +opaque rw +opaque rw +opaque rw +network rw +disk rw + +Prefixes +archive: +system: +tmpsys: +null: +tftp: +flash0: flash:# +4 CCNA 200-301 Official Cert Guide, Volume 2 + + +- +262136 +- +- +- +- +- +- +- +- +- +- +- +7794737152 + +- +253220 +- +- +- +- +- +- +- +- +- +- +- +7483719680 + +disk +nvram +opaque +opaque +opaque +network +network +network +network +network +opaque +network +opaque +usbflash + +rw flash1: +rw nvram: +wo syslog: +rw xmodem: +rw ymodem: +rw rcp: +rw pram: +rw http: +rw ftp: +rw scp: +ro tar: +rw https: +ro cns: +rw usbflash0: + +74503236 bytes copied in 187.876 secs (396555 bytes/sec) + + +The example lists 20 different IOS file systems in this case, but the router does not have 20 different physical storage devices. Instead, IOS uses these file systems for other purposes as well, with these types: +■ Opaque: To represent logical internal file systems for the convenience of internal functions and commands +■ Network: To represent external file systems found on different types of servers for the convenience of reference in different IOS commands +■ Disk: For flash +■ Usbflash: For USB flash +■ NVRAM: A special type for NVRAM memory, the default location of the startup-config file + +Many IOS commands refer to files in an IFS, but only some commands refer directly to the files by their formal names. The formal names use the prefix as seen in the far right column of Example F-1. For instance, the command more flash0:/wotemp/fred would display the contents of file fred in directory /wotemp in the first flash memory slot in the router. (The more command itself displays the contents of a file.) However, many commands use a key-word that indirectly refers to a formal filename, to reduce typing. For example: + +■ show running-config command: Refers to file system:running-config ■ show startup-config command: Refers to file nvram:startup-config ■ show flash command: Refers to default flash IFS (usually flash0:) + +Upgrading IOS Images +One of the first steps to upgrade a router’s IOS to a new version is to obtain the new IOS image and put it in the right location. Typically, Cisco routers have their IOS in one of the local physical file systems, most often in permanent flash. The only requirement is that the IOS be in some reachable file system—even if the file sits on an external server and the device loads the OS over the network. However, the best practice is to store each device’s IOS file in flash that will remain with the device permanently. +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files 5 + +Figure F-1 illustrates the process to upgrade an IOS image into flash memory, using the fol- +lowing steps: F Step 1. Obtain the IOS image from Cisco, usually by downloading the IOS image from +cisco.com using HTTP or FTP. +Step 2. Place the IOS image someplace that the router can reach. Locations include TFTP or FTP servers in the network or a USB flash drive that is then inserted into the router. +Step 3. Issue the copy command from the router, copying the file into the flash mem-ory that usually remains with the router on a permanent basis. (Routers usually cannot boot from the IOS image in a USB flash drive.) + +www.cisco.com TFTP Server Router 1 2 3 copy tftp flash + +Internet + +Figure F-1 Copying IOS Image as Part of the Cisco IOS Software Upgrade Process + +Copying a New IOS Image to a Local IOS File System Using TFTP +Example F-2 provides an example of Step 3 from the figure, copying the IOS image into flash memory. In this case, Router R2, a 2901, copies an IOS image from a TFTP server at IP address 2.2.2.1. +Example F-2 copy tftp flash Command Copies the IOS Image to Flash Memory + +R2# copy tftp flash +Address or name of remote host []? 2.2.2.1 +Source filename []? c2900-universalk9-mz.SPA.152-4.M1.bin +Destination filename [c2900-universalk9-mz.SPA.152-4.M1.bin ]? +Accessing tftp://2.2.2.1/c2900-universalk9-mz.SPA.152-4.M1.bin ... +Loading c2900-universalk9-mz.SPA.152-4.M1.bin from 2.2.2.1 (via GigabitEthernet0/1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +[OK - 97794040 bytes] + +97794040 bytes copied in 187.876 secs (396555 bytes/sec) +R2# + + +The copy command does a simple task—copy a file—but the command also has several small items to check. It needs a few pieces of information from the user, so the command prompts the user for that information by showing the user some text and waiting for the user’s input. The bold items in the example show the user’s input. The router then has to check to make sure the copy will work. The command works through these kinds of questions: + +1. What is the IP address or host name of the TFTP server? 2. What is the name of the file? +6 CCNA 200-301 Official Cert Guide, Volume 2 + +3. Ask the server to learn the size of the file, and then check the local router’s flash to ask whether enough space is available for this file in flash memory. +4. Does the server actually have a file by that name? +5. Do you want the router to erase any old files in flash? + +The router prompts you for answers to some of these questions, as necessary. For each question, you should either type an answer or press Enter if the default answer (shown in square brackets at the end of the question) is acceptable. Afterward, the router erases flash memory if directed, copies the file, and then verifies that the checksum for the file shows that no errors occurred in transmission. + +NOTE Most people use the IOS filenames that Cisco supplies because these names embed information about the IOS image, like the version. Also, if you want to use the same desti-nation filename as the source, avoid the mistake of typing “y” or “yes” to confirm the selec-tion; instead, you would be setting the destination filename to “y” or “yes.” Simply press Enter to confirm the selection listed in brackets. + +You can view the contents of the flash file system to see the IOS file that was just copied by using a couple of commands. The show flash command shows the files in the default flash file system (flash0:), as seen at the top of Example F-3. Below it, the more general dir flash0: command lists the contents of that same file system, with similar information. (You can use the dir command to display the contents of any local IFS.) +Example F-3 Command Copies the IOS Image to Flash Memory + +R4# show flash +-#- --length-- -----date/time------ path +1 104193476 Jul 21 2015 13:38:06 +00:00 c2900-universalk9-mz.SPA.154-3.M3.bin 3 3000320 Jul 10 2012 00:05:44 +00:00 cpexpress.tar +4 1038 Jul 10 2012 00:05:52 +00:00 home.shtml 5 122880 Jul 10 2012 00:06:02 +00:00 home.tar +6 1697952 Jul 10 2012 00:06:16 +00:00 securedesktop-ios-3.1.1.45-k9.pkg 7 415956 Jul 10 2012 00:06:28 +00:00 sslclient-win-1.1.4.176.pkg +8 1153 Aug 16 2012 18:20:56 +00:00 wo-lic-1 +9 97794040 Oct 10 2014 21:06:38 +00:00 c2900-universalk9-mz.SPA.152-4.M1.bin + +49238016 bytes available (207249408 bytes used) + +R4# dir flash0: Directory of flash0:/ + + +1 -rw- 104193476 + +3 -rw- 3000320 4 -rw- 1038 5 -rw- 122880 6 -rw- 1697952 + +7 -rw- 415956 +8 -rw- 1153 + +Jul 21 2015 13:38:06 +00:00 + +Jul 10 2012 00:05:44 +00:00 Jul 10 2012 00:05:52 +00:00 Jul 10 2012 00:06:02 +00:00 Jul 10 2012 00:06:16 +00:00 + +Jul 10 2012 00:06:28 +00:00 +Aug 16 2012 18:20:56 +00:00 + +c2900-universalk9-mz.SPA.154-3. M3.bin +cpexpress.tar home.shtml home.tar +securedesktop-ios-3.1.1.45-k9. pkg +sslclient-win-1.1.4.176.pkg +wo-lic-1 +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files 7 + +9 -rw- 97794040 Oct 10 2014 21:06:38 +00:00 c2900-universalk9-mz.SPA.152-4. M1.bin +F +256487424 bytes total (49238016 bytes free) + +Pay close attention to the memory usage per file and for the IFS as shown in the example. The output lists the size in bytes for each file. Note that the IOS file is about 104 MB. Note that the size of the IOS file matches the size shown earlier in the TFTP transfer in Example F-2. The end of each of the commands then lists the amount of space available for new files to be added to flash (one lists it as “bytes available”; the other as “bytes free”). However, that same ending line of each command shows slightly different information about usage: show flash lists the bytes used, whereas the dir command lists the total bytes (bytes used plus bytes free). Play around with the numbers in this example to make sure you know which command lists which particular total. + +Verifying IOS Code Integrity with MD5 +You download the IOS from Cisco, copy it to your router, and run it. Is it really the code from Cisco? Or did some nefarious attacker somehow get you to download a fake IOS that has a virus? +Cisco provides a means to check the integrity of the IOS file to prevent this type of prob-lem. Figure F-2 shows the basic mechanics of the process. First, when Cisco builds a new IOS image, it calculates and publishes an MD5 hash value for that specific IOS file. That is, Cisco uses as input the IOS file itself, runs the MD5 math algorithm against that file, pro-ducing a hex code. Cisco places that code at the download site for all to see. Then, you run that same MD5 math on your router against the IOS file on the router, using the IOS verify command. That command will list the MD5 hash as recalculated on your router. If both MD5 hashes are equal, the file has not changed. + +www.cisco.com + + + + + + + +Compare verify /md5 + + +Download: MD5: xxxxxxx… + + +Figure F-2 MD5 Verification of IOS Images—Concepts + +The verify /md5 command generates the MD5 hash on your router, as shown in Example F-4. Note that you can include the hash value computed by Cisco as the last parameter (as shown in the example), or leave it off. If you include it, IOS will tell you if the locally +computed value matches what you copied into the command. If you leave it out, the verify command lists the locally computed MD5 hash, and you have to do the picky character-by-character check of the values yourself. +8 CCNA 200-301 Official Cert Guide, Volume 2 + +Example F-4 Verifying Flash Memory Contents with the show flash Command + +R2# verify /md5 flash0:c2900-universalk9-mz.SPA.154-3.M3.bin a79e325e6c498b70829d4d b0afba5041 +...................................................................................... +...................................................................................... +…..MD5 of flash0:c2900-universalk9-mz.SPA.154-3.M3.bin Done! +Verified (flash0:c2900-universalk9-mz.SPA.154-3.M3.bin) = a79e325e6c498b70829d4d b0afba5041 + +Copying Images with FTP +The networking world has many options for file transfer, several of which IOS supports for the transfer of files into and out of the IOS file systems that reside on the router. TFTP and FTP have been supported for the longest time, with more recent support added for proto-cols like SCP. Table F-1 lists some of the names of file transfer protocols that you might come across when working with routers. + +Table F-1 Common Methods to Copy Files Outside a Router + + +Method Method (Full Name) +TFTP Trivial File Transfer Protocol FTP File Transfer Protocol +SCP Secure Copy Protocol + +Router’s Role Client +Client +Server + +Encrypted? No +No +Yes + + +To copy files with FTP, you follow the same kind of process you use with TFTP (see Example F-5). You can follow the interactive prompts after using an EXEC command like copy ftp flash. However, the copy command allows you to use a URI for the source and/ or destination, which lets you put most or all of the information in the command line itself. Each URI refers to the formal name of a file in the IFS. +Example F-5 Installing a New IOS with FTP + +R1# copy ftp://wendell:odom@192.168.1.170/c2900-universalk9-mz.SPA.155-2.T1.bin flash +Destination filename [c2900-universalk9-mz.SPA.155-2.T1.bin]? +Accessing ftp://192.168.1.170/c2900-universalk9-mz.SPA.155-2.T1.bin... +Loading c2900-universalk9-mz.SPA.155-2.T1.bin !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +[OK - 107410736/4096 bytes] + +107410736 bytes copied in 119.604 secs (898053 bytes/sec) + + +First, take a close look at the long URI in the command that begins with “ftp”. The “ftp” part identifies the protocol, of course. After the //, the text references the username (wendell) and password (odom), as well as the FTP server’s IP address. After the single / comes the filename on the server. + +Although the command is long, it has only two parameters, with the long first parameter and the short keyword flash as the second parameter. The copy command lists the source +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files + +location as the first parameter and the destination as the second. The destination in this case, flash, is a keyword that refers to the default flash, typically flash0:, but it does not identify a specific filename. As a result, IOS prompts the user for a specific destination filename, with a default (in brackets) to keep the source filename. In this case, the user just pressed Enter to accept the default. To avoid being prompted at all, the command could have listed flash:c2900-universalk9-mz.SPA.155-2.T1.bin as that second parameter, fully defining the destination file. + +Finally, with another twist, you can configure the FTP username and password on the router so that you do not have to include them in the copy command. For instance, the global configuration commands ip ftp username wendell and ip ftp password odom would have configured those values. Then the copy command would have begun with copy ftp://192.168.1.170/..., omitting the username:password in the command, without needing to then prompt the user for the username and password. + +Copying Images with SCP +SSH Copy Protocol (SCP) provides a secure way to transfer files, but with a small twist as compared to other methods mentioned in this chapter: the router acts as the server, and you do not use the copy command on the router. Instead, you configure the router to act as an SCP server and then use an SCP client command or application on a desktop computer to transfer the files. +SCP uses SSH for two key parts of the work to securely transfer files: to authenticate the user and to encrypt all data transfer. SSH already does those tasks anyway, so SCP, defined after SSH was well established, simply relies on SSH to do those tasks. SCP then defines a method to transfer files. + +To make SCP work on a router, the router first needs configuration to support SSH login as normal, as discussed in detail back in Chapter 8, “Configuring Basic Switch Management.” Then you just need to change one command plus add another, as follows: + +■ Give the SSH user direct access to privileged mode by adding parameters to the username command, for example, username fred privilege-level 15 password barney. +■ Enable the SCP server with the ip scp server enable global command. + +9 + + + +F + + + +NOTE While this book does not go into details about IOS privilege levels, enable mode is considered to be privilege level 15. The username privilege 15 command means that the user would be granted enable mode access at login, without first being placed into user mode. + +Then to use SCP to transfer files, the network engineer must use an SCP client on some com-puter that has network connectivity to the router. You can search the web for SCP clients, many of which are integrated as part of SSH clients. However, for the purpose of transfer-ring files with Cisco devices, a command-line SCP client may actually be the best choice. + +Example F-6 shows an SCP file copy with a router, using the Mac OS X built-in scp com-mand. The command again copies an IOS file from the computer to the router, like the ear-lier examples. Note that it uses the full URI of the destination, with the username (wendell), router IP address (192.168.1.9), and IOS filename. The command then prompts the user for the password and begins transferring the file. +10 CCNA 200-301 Official Cert Guide, Volume 2 + +Example F-6 SCP Client IOS Copy from a Mac to a Router + +WO-iMac:Desktop wendellodom$ scp c2900-universalk9-mz.SPA.155-2.T1.bin +wendell@192.168.1.9:flash0:c2900-universalk9-mz.SPA.155-2.T1.bin +Password: +c2900-universalk9-mz.SPA.155-2.T1.bin 100% 102MB 322.8KB/s 05:25 + +Once you copy the IOS file into a local IOS file system on the router, you must reload the router to start using the new IOS. The next topic looks at the entire IOS boot process, including how to make a router start using the new version of IOS. + +The Cisco IOS Software Boot Sequence +Cisco routers perform the same types of tasks that a typical computer performs when you power it on or reboot (reload) it. However, most end-user computers have a single instance of the OS installed, so the computer does not have to choose which OS to load. In contrast, a router can have multiple IOS images available both in flash memory and on external serv-ers, so the router needs a process to pick which IOS image to load into RAM and use. This section examines the entire boot process, with extra emphasis on the options that impact a router’s choice of what IOS image to load. + +NOTE Routers can load IOS or a special-purpose OS called ROMMON. ROMMON is used for special purposes like password recovery. ROMMON can be used to send and receive IP packets to load a new IOS, but it does not route packets. A third very old special-purpose OS, called RXBOOT, is no longer included in this book because it applies only to very old router models. + +When a router first powers on, it follows these four steps: + +Step 1. The router performs a power-on self-test (POST) process to discover the hard-ware components and verify that all components work properly. +Step 2. The router copies a bootstrap program from ROM into RAM and runs the bootstrap program. +Step 3. The bootstrap program decides which IOS image (or the ROMMON OS) to load into RAM, and then the bootstrap program loads the OS. After loading the chosen OS image, the bootstrap program hands over control of the router hardware to the newly loaded OS. +Step 4. If the bootstrap program happened to load IOS, once IOS is running, it finds the startup-config file and loads it into RAM as the running-config. + +All routers attempt all four steps each time the router is powered on or reloaded. The first two steps do not have any options to choose; either both of these steps succeed or the initialization fails. If it fails, you might need to call the Cisco Technical Assistance Center (TAC) for support. However, Steps 3 and 4 have several configurable options that tell the router what to do next, as noted in Figure F-3. +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files 11 + + + +Flash +Step 3 Or Network + + +NVRAM +Step 4 Network Or Or +Console + +RAM + +IOS F + + + +Running Config + + + +Figure F-3 Loading IOS and Initial Configuration + +As you can see, the router has options at both Steps 3 and 4 in the figure. However, at Step 4, routers almost always load the configuration from NVRAM (the startup-config file), when it exists. There is no real advantage to storing the initial configuration anywhere else except NVRAM, so this chapter does not look further into the options of Step 4. But there are reasonable motivations for keeping IOS images in flash and on servers in the network, so the rest of this section examines Step 3 in more detail. + +The Configuration Register +A router’s configuration register has an impact on a router’s choice of which OS to load. + +Routers use a configuration register to find some configuration settings at boot time, before the router has loaded IOS and read the startup-config file. The 16 bits (4 hex digits) in the configuration register set a variety of different parameters. For example, the console runs at a speed of 9600 bps by default, but that console speed is based on the default settings of a couple of bits in the configuration register. By changing specific bits in the configuration register, the next time the router boots, you can change the speed of the console line. + +You can set the configuration register value with the config-register global configuration command. Engineers set the configuration register to different values for many reasons, but the most common are to help tell the router what IOS image to load, as explained in the next few pages, and in the password recovery process. For example, the global configura-tion command config-register 0x2100 sets the value to hexadecimal 2100, which causes the router to load the ROMMON OS rather than IOS the next time the router is reloaded. + +Interestingly, Cisco routers automatically save the new configuration register value when you press Enter at the end of the config-register command; you do not need to use the copy running-config startup-config command after changing the configuration register. However, the configuration register’s new value has no effect until the next time the router is reloaded. + +NOTE On most Cisco routers, the default configuration register setting is hexadecimal 2102, which leaves the console speed at 9600 bps and tells the router to load an IOS image. + +How a Router Chooses Which OS to Load +A router chooses the OS to load based on two factors: + +■ The last hex digit in the configuration register (called the boot field) +■ Any boot system global configuration commands in the startup-config file +12 CCNA 200-301 Official Cert Guide, Volume 2 + +The boot field, the fourth hex digit in the configuration register, tells the router the initial instructions about what OS to try to load. The router looks at the boot field’s value when the router is powered on or when reloaded. The boot field’s value then tells the router how to proceed with choosing which OS to load. + +NOTE Cisco represents hexadecimal values by preceding the hex digits with 0x; for example, 0xA would mean a single hex digit A. + +The process to choose which OS to load on modern Cisco routers happens as follows: + +1. If boot field = 0, use the ROMMON OS. +2. If boot field = 1, load the first IOS file found in flash memory. 3. If boot field = 2-F: +A. Try each boot system command in the startup-config file, in order, until one works. +B. If none of the boot system commands work, load the first IOS file found in flash memory. +4. If all other attempts fail, load ROMMON, from which you can perform further steps to recover by copying a new IOS image into flash. + +NOTE The actual step numbers are not important; the list is just numbered for easier reference. + +The first two steps are pretty straightforward, but Step 3 then tells the router to look to the second major method to tell the router which IOS to load: the boot system global configu-ration command. This command can be configured multiple times on one router, with each new boot system command being added to the end of a list of boot system commands. Each command can point to different files in flash memory, and filenames and IP addresses of servers, telling the router where to look for an IOS image to load. The router tries to load the IOS images in the order of the configured boot system commands. + +Both Step 2 and Step 3B refer to a concept of the “first” IOS file, a concept that needs a little more explanation. Routers number the files stored in flash memory, with each new file usually getting a higher and higher number. When a router tries Step 2 or Step 3B from the preceding list, the router looks in flash memory, starting with file number 1, and then file number 2, and so on, until it finds the lowest numbered file that happens to be an IOS image. The router then loads that file. + +Interestingly, most routers end up using Step 3B to find their IOS image. From the fac-tory, Cisco routers do not have any boot system commands configured; in fact, they do not have any configuration in the startup-config file at all. Cisco loads flash memory with a single IOS when it builds and tests the router, and the configuration register value is set to 0x2102, meaning a boot field of 0x2. With all these settings, the process tries Step 3 (because boot = 2), finds no boot system commands (because the startup-config is empty), and then looks for the first file in flash memory at Step 3B . +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files 13 + + +NOTE Routers do not search all flash file systems for an IOS image. The details vary +depending on the router model, but routers consider one flash file system to be the default F +IOS file system to look for IOS images. + +Figure F-4 summarizes the key concepts behind how a router chooses the OS to load. + + +ROM RAM + +Bootstrap +and BOOT = 0 +ROMMON +IP Network TFTP Flash + +1st IOS file 2nd IOS file • +• +Last IOS file + +BOOT = 1 + + + +BOOT = 2..F +NVRAM (Startup-config) +boot system (1) + + + +Repeat until success + +boot system (2) • +• +Last boot system command + + + +Figure F-4 Choices for Choosing the OS at Boot Time: Modern Cisco Router + +The boot system commands need to refer to the exact file that the router should load. Table F-2 shows several examples of the commands. + +Table F-2 Sample boot system Commands + + +Boot System Command boot system flash +boot system flash filename + +boot system tftp filename 10.1.1.1 + +Result +The first file from system flash memory is loaded. +IOS with the name filename is loaded from system flash memory. +IOS with the name filename is loaded from the TFTP server at address 10.1.1.1. + + +Finally, remember the process of upgrading the IOS? The whole point of the boot system commands and boot field of the configuration register is to control which IOS loads. Once a new IOS has been copied into flash memory on the router, the upgrade process has a few more steps. Add a boot system command to refer to the correct new file, save the configuration, and reload the router. The router will now go through the boot sequence discussed in this section, load the new IOS image, and the IOS upgrade is complete. For instance, Example F-2 showed a router copying an IOS image into flash; that router would then also need a boot system flash:c2900-universalk9-mz.SPA.152-4.M1.bin command saved into the startup-config. +14 CCNA 200-301 Official Cert Guide, Volume 2 + +Verifying the IOS Image Using the show version Command +Once it is upgraded, you should verify the new IOS has loaded using the show version com-mand. This command lists not only the version of software but also the source from which the router found the IOS image and the time since it loaded the IOS. As a result, the show version command actually identifies some key facts about the results of the previous boot process. + +The show version command lists many other facts as well, as shown in Example F-7. The example shows output from Router R2, which has been configured with the boot system flash:c2900-universalk9-mz.SPA.152-4.M1.bin command and been reloaded, migrating to use the new Version 15.2(4) IOS. + +To help point out some of the many important facts in this command, the example shows many highlighted items. The following list describes each of the items in the output in the same order as they are shown in the example, top to bottom: + +1. The IOS version +2. The uptime (the length of time that has passed since the last reload) +3. The reason for the last reload of IOS (reload command, power off/on, software failure) +4. The time of the last loading of IOS (if the router’s clock has been set) 5. The source from which the router loaded the current IOS +6. The amount of RAM memory +7. The number and types of interfaces 8. The amount of NVRAM memory 9. The amount of flash memory +10. The configuration register’s current and future setting (if different) + +Example F-7 show version Command Output + +R2# show version +Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.2(4)M1, RELEASE SOFTWARE (fc1) +Technical Support: http://www.cisco.com/techsupport +Copyright 1986-2012 by Cisco Systems, Inc. +Compiled Thu 26-Jul-12 20:54 by prod_rel_team + +ROM: System Bootstrap, Version 15.0(1r)M15, RELEASE SOFTWARE (fc1) + +R2 uptime is 44 minutes +System returned to ROM by reload at 19:44:01 UTC Tue Feb 12 2013 +System restarted at 19:45:53 UTC Tue Feb 12 2013 +System image file is "flash:c2900-universalk9-mz.SPA.152-4.M1.bin" +Last reload type: Normal Reload +Last reload reason: Reload Command + +This product contains cryptographic features and is subject to United +States and local country laws governing import, export, transfer and +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files 15 + +! Rest of legal disclaimer omitted + +Cisco CISCO2901/K9 (revision 1.0) with 483328K/40960K bytes of memory. F Processor board ID FTX1628837T +2 Gigabit Ethernet interfaces +4 Serial(sync/async) interfaces +1 terminal line +DRAM configuration is 64 bits wide with parity enabled. +255K bytes of non-volatile configuration memory. +3425968K bytes of USB Flash usbflash1 (Read/Write) +250880K bytes of ATA System CompactFlash 0 (Read/Write) + + +License Info: + +License UDI: + +------------------------------------------------- +Device# PID SN +------------------------------------------------- +*0 CISCO2901/K9 FTX1628837T + + +Technology Package License Information for Module:'c2900' +----------------------------------------------------------------- +Technology Technology-package Technology-package +Current Type Next reboot +------------------------------------------------------------------ + +ipbase +security +uc +data + +ipbasek9 +None +None +None + +Permanent +None +None +None + +ipbasek9 +None +None +None + + +Configuration register is 0x2102 + +Password Recovery +Suppose that you are sitting at your desk and you try to Secure Shell (SSH) or Telnet to a router. However, you cannot log in. Or, you can get into user mode but not into enable mode because you forgot the enable secret password. You want to recover, or at least reset the passwords, so you can get into the router and change the configuration. What can you do? + +Cisco provides a way to reset the passwords on a router when sitting beside the router. With access to the router console and the ability to power the router off and back on, any-one can reset all the passwords on the router to new values. + +The details differ from router model to router model. However, if you go to www.cisco.com and search for “password recovery,” within the first few hits you should see a master password +16 CCNA 200-301 Official Cert Guide, Volume 2 + +recovery page. This page lists instructions on how to perform password recovery (actually password reset) for almost any model of Cisco product. + +NOTE Cisco generally refers to the topic in this section as password recovery, but you do not actually recover and learn the password that you forgot. Instead, you change the pass-word to a new value. + +The General Ideas Behind Cisco Password Recovery/Reset +Although the details differ from model to model, all the password recovery procedures fol-low the same general principles. First, the end goal of the process is to make the router boot IOS while ignoring the startup-config file. Of course, this startup configuration holds all the passwords. Once the router boots while ignoring the initial configuration, the router has no passwords at all, so you can log in at the console with no password restrictions and recon-figure all the passwords. + +One config-register bit holds the key: the ignore configuration bit. (The bit is the second bit in the third nibble, reading left to right.) When set to binary 1, the router will ignore the startup-config file the next time the router is loaded. To set that value, the default configu-ration register value of 0x2102 can be changed to 0x2142. + +Unfortunately, under normal circumstances, you need to remember the enable password to reach the mode to configure the configuration register’s value. When you need to do password recovery, you clearly do not know the passwords, so how can you change the configuration register? The solution is to use ROMMON mode. + +ROMMON enables you to set the configuration register. ROMMON contains a small and different set of CLI commands as compared to IOS, with the commands varying from +router model to router model. However, each router’s ROMMON software supports some command, usually the confreg command, that lets you set the configuration register. For instance, the ROMMON command confreg 0x2142 would set the correct bit to tell the router to ignore the startup-config file at reload. + +So, how do you get the router to boot in ROMMON mode? Older routers require you to press the break key at the console during boot of the router. Some newer routers happen to have all removable flash memory—on those, just remove the flash (so there is no IOS avail-able), and turn the router off and back on, and the router has no IOS to load—so it loads ROMMON. (Put the flash back in once ROMMON loads.) +In summary, the big ideas behind password recovery are as follows: + +Step 1. Boot ROMMON, either by breaking into the boot process from the console or by first removing all the flash memory. +Step 2. Set the configuration register to ignore the startup-config file (for example, confreg 0x2142). +Step 3. Boot the router with an IOS. The router boots with no configuration. Now you can reach enable mode from the console without needing any passwords. +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files + +A Specific Password Reset Example +Example F-8 shows a sample password recovery/reset process on a 2901 router. The example begins with Router R1 powered on and the user connected at the console. These 2901 routers use compact flash slots for the primary flash memory; in this example, I removed the flash memory and rebooted the router so that the normal boot process caused ROMMON to load. Look at the highlighted steps in the example for the specific action that resets the password. + +17 + + + +F + +Example F-8 A Password Recovery/Reset Example + +! 1) User walks to the router and powers off the router + +! 2) User removes all flash memory + +! 3) User turns router back on again + +System Bootstrap, Version 15.0(1r)M15, RELEASE SOFTWARE (fc1) +Technical Support: http://www.cisco.com/techsupport +Copyright 2011 by cisco Systems, Inc. + +! 4) Several lines of messages omitted: ROMMON is initializing + +Readonly ROMMON initialized + +rommon 1> confreg 0x2142 + +You must reset or power cycle for new config to take effect +rommon 2 > +! 5) Just above, user sets the config register to ignore the startup-config. + +! 6) User powers off router and then safely plugs the flash back in. + +! 7) User powers on router, so that the router now boots IOS. + +System Bootstrap, Version 15.0(1r)M15, RELEASE SOFTWARE (fc1) +Technical Support: http://www.cisco.com/techsupport +Copyright 2011 by cisco Systems, Inc. + +! Lots of IOS initialization messages omitted; watch for these next messages + + +--- System Configuration Dialog --- + +Would you like to enter the initial configuration dialog? [yes/no]: no +18 CCNA 200-301 Official Cert Guide, Volume 2 + + +Press RETURN to get started! + +! 8) Just above, IOS asked the user if they wanted to do the initial config dialogue. +! That happens when a router boots with no startup config. That confirms the router +! booted and ignored startup-config. The user answered no, to avoid using setup. + +! 9) Below, the console user logs in with no passwords required to reach enable mode. + +Router> +Router>enable +Router# + +! 10) Next, user copies the starting config to make the router do its normal job +Router# copy startup-config running-config +Destination filename [running-config]? +3297 bytes copied in 0.492 secs (6701 bytes/sec) + +! 11) User changes the forgotten enable secret password, and sets config register back +! to the default setting of 0x2102 +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# enable secret cisco +R1(config)# config-reg 0x2102 +R1(config)# ^Z +R1# + +! 12) User saves his changes to the password +R1# copy running-config startup-config +Destination filename [startup-config]? +3297 bytes copied in 0.492 secs (6701 bytes/sec) +R1# + + +Note that those last few steps are pretty important. Remember, this process makes the router boot with no initial configuration, so it is clearly disruptive to the normal working state of the router, even beyond the time required to work through the process. The copy startup-config running-config command makes up for the fact that the router ignored the startup-config file when it booted IOS. Also, to be ready for the next time the router reloads, put the configuration register value back to its normal permanent value, usually hex 2102. + +NOTE When using this process, at the end, take the time to check the interface state of the router interfaces. The copy running-config startup-config command could result in some of the interfaces remaining in a shutdown state, depending on the current state of the cabling and the state of the connected devices. So, make sure to check and enable any inter-faces with the no shutdown interface subcommand. +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files 19 + +Managing Configuration Files +Cisco routers and switches happen to use two different configuration files: a startup-config F file to save the configuration to use each time the device boots, and the running-config +file that holds the currently used configuration for current use inside RAM. By now, you should be used to changing the running-config file using configuration mode and saving the running-config using the copy running-config startup-config command. +This last of three major sections of the chapter takes the discussion of configuration files much further. It begins with a look at the traditional methods to copy configuration files outside the router or switch. It then examines more recent options to archive and restore the configuration. This section ends with a brief example of the setup process by which the router can build an initial configuration file. + +Copying and Erasing Configuration Files +A good operational plan includes regular backup of the configuration files. The startup and running-config files reside in the router only, and that poses a risk. If the router configura-tion is never backed up to an external site and the router fails, then even after you replace the router hardware, you may have difficulty piecing a correct router configuration together based on old project notes. + +The IOS copy command gives you a way to make a copy of the configuration, and has been around for a long time. This command lets you use any of the IFS references to network protocols, including TFTP, FTP, and SCP. + +You can also just copy files to and from removable USB flash memory in the router. The USB slots on most recent models of Cisco routers allow you to insert and remove the USB flash drives with IOS running. For instance, a Cisco 2901 router has two USB flash drive slots (usbflash0: and usbflash1:). As demonstrated in Example F-9, an engineer could easily copy the running-config file to flash. +Example F-9 Copying a File to USB Flash + +R1# copy running-config usbflash1:temp-copy-of-config +Destination filename [temp-copy-of-config]? +3159 bytes copied in 0.944 secs (3346 bytes/sec) + +R1# dir usbflash1: +Directory of usbflash1:/ + +! lines listing other files omitted for brevity. +74 -rw- 3159 Feb 12 2013 22:17:00 +00:00 temp-copy-of-config + +7783804928 bytes total (7685111808 bytes free) +R1# + +While useful in a lab, using USB flash to back up configuration files does not work well with thousands of devices spread around many sites. More than likely, you would back up the files to a more centralized server over the network. The next topic looks at the overall backup and restore plan for systematically backing up configurations. +20 CCNA 200-301 Official Cert Guide, Volume 2 + +Traditional Configuration Backup and Restore with the copy Command +One primary motivation of copying the configuration to an external server is to then later restore the configuration if a problem occurs. Like any backup and restore process, the configuration restore process is just as important as backing up the configuration. However, the IOS copy command, which has been in IOS for a long time, has an odd behavior when copying files to the running config file to restore the configuration. That odd behavior impacts how to restore the configuration rather than how to back up the configuration. + +The copy command does not replace the running-config file when copying a configuration into RAM. Effectively, any copy into the running-config file works just as if you entered the commands in the “from” configuration file while in configuration mode. In some cases, adding the new commands does actually replace the old command; for instance, the ip address interface subcommand would simply replace the old value. However, with other commands, the command would not replace the old configuration but add to it instead (for instance, with IP access-list commands), creating a different configuration. + +To drive the point home with a few examples, Figure F-5 shows the cases that result in a replacement of the configuration versus an addition to the configuration. The figure shows commands to copy to and from a TFTP server. Note that the two commands with an aster-isk beside them are the ones that effectively add the configuration. + + + +copy tftp running-config +* +TFTP RAM +copy running-config tftp + +copy running-config startup-config +NVRAM +copy startup-config running-config +* + + + +copy tftp startup-config + +copy startup-config tftp + +Figure F-5 Copy into RAM (running-config) Adds Configuration Instead of Replacing + +Because of the effect of copying configurations into the running-config file, the restore process basically avoids using the copy command to copy a backup configuration file into running-config. The complete process, using the copy command, to both back up and restore configurations, works like this: +Step 1. To back up: Copy the running-config file to some external server; for instance, copy running-config tftp. +Step 2. To restore: +A. Copy the backup configuration into the startup-configuration file using the copy command, which replaces the startup-config file; for instance, copy tftp startup-config. +B. Issue the reload command, which reloads, or reboots, the router. That pro-cess erases all running config in RAM and then copies the startup-config into RAM as part of the reload process. +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files + +Alternatives for Configuration Backup and Restore +Cisco has improved the backup and restore process over the years beyond the basic capa-bilities of the IOS copy command. Two improvements stand out as compared to the use of the copy command: + +■ Create backup configurations, called archives, based on the use of the archive EXEC command. Archives can be created by command, based on a configured timer, or auto-matically created each time someone saves the configuration. +■ Perform a restore of the archived configuration to the running-config file without requir-ing a reload by using the configure replace command. + +21 + + + +F + + +The archival process revolves around an IOS file system called the archive. The router just needs to know where to store these configuration files. The router also needs to know whether or not to save the configuration archives automatically. Those rules define the archive—when to automatically save the configuration and where to save them. Example F-10 shows a sample archive configuration, in which the router defines an FTP server at address 192.168.1.170 as the place to store the configurations, with username wendell and password odom. It also defines automatic backup every 1,440 minutes (that is, daily) and stores a copy of the configuration every time the configuration is saved (per the write-memory subcommand). +Example F-10 Creating a Configuration Archive + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# archive +R1(config-archive)# path ftp://wendell:odom@192.168.1.170/ +R1(config-archive)# time-period 1440 +R1(config-archive)# write-memory +R1(config-archive)# ^Z +R1# + + +NOTE IOS originally used the write memory EXEC command to save the configuration; that command was replaced by the copy running-config startup-config command. The archive feature’s write-memory command appears to refer to this old EXEC command. + +The configuration in the example makes a great improvement over using the copy com-mand. First, it improves backups by backing up the configuration automatically. It also improves the restore process because of the configure replace command. Basically, the configure replace command allows you to copy a configuration archive into the running-config file, so it completely replaces the running-config without requiring a reload of the router. Basically, the router analyzes all the configuration, does a series of comparisons, and determines what sequence of configuration commands would be required to change the configuration correctly—all without reloading the router. + +To show the process, Example F-11 shows a sequence in which a router does not have an ACL (141) at the time the archive is made. Then the user changes the configuration to add an ACL 141. Next, the configure restore command is used to restore the earlier archived +22 CCNA 200-301 Official Cert Guide, Volume 2 + +configuration (which doesn’t have ACL 141). Because the restore should replace the running-config file, the running-config should no longer have ACL 141 at the end of the process. The example also shows the hostname being changed as a more obvious confirmation that the configure replace command changed the configuration. +Example F-11 Replacing the Running-config with the configure replace Command + +R1# archive config +Writing -Oct-24-09-46-43.165-2 +R1# show archive +The maximum archive configurations allowed is 10. +The next archive file will be named ftp://wendell:odom@192.168.1.170/--3 + +Archive # +1 +2 +3 + +Name +ftp://wendell:odom@192.168.1.170/-Oct-24-09-21-38.865-0 +ftp://wendell:odom@192.168.1.170/-Oct-24-09-22-22.561-1 +ftp://wendell:odom@192.168.1.170/-Oct-24-09-46-43.165-2 <- Most Recent + + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# hostname ridiculousname +ridiculousname(config)# access-list 141 permit ip host 2.2.2.2 host 3.3.3.3 +ridiculousname(config)# ^Z +ridiculousname# +*Oct 24 09:47:57.189: %SYS-5-CONFIG_I: Configured from console by console + +ridiculousname# configure replace ftp://wendell:odom@192.168.1.170/ -Oct-24-09-46-43.165-2 +This will apply all necessary additions and deletions +to replace the current running configuration with the +contents of the specified configuration file, which is +assumed to be a complete configuration, not a partial +configuration. Enter Y if you are sure you want to proceed. ? [no]: y +Loading -Oct-24-09-46-43.165-2 ! +[OK - 6498/4096 bytes] + +Loading -Oct-24-09-46-43.165-2 ! +Total number of passes: 1 +Rollback Done + +R1# show access-list 141 +R1# + + +Note that by the end of the example, the hostname has reverted back to the original name (R1) and ACL 141 is no longer configured, as expected. +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files + +Erasing Configuration Files +IOS supports three different commands to erase the startup-config file in NVRAM. The write erase and erase startup-config commands are older, whereas the erase nvram: com-mand is the more recent, and recommended, command. + +Note that Cisco IOS does not have a command that erases the contents of the running-config file. To clear out the running-config file, simply erase the startup-config file; then reload the router so that the router loads an empty startup-config file into the running-config. + +Initial Configuration (Setup Mode) +Cisco IOS software supports two primary methods of giving a router or switch an initial basic configuration: configuration mode and setup mode. Setup mode leads a switch admin-istrator through a basic configuration by using questions that prompt the administrator. Because configuration mode is required for most configuration tasks, most networking personnel quickly get comfortable with configuration mode and do not use setup at all. However, new users sometimes like to use setup mode, particularly until they become more familiar with the CLI configuration mode. + +Just so you know how to get to setup mode, an engineer can get into setup mode in two ways. Figure F-6 shows one of the methods that occurs during the boot process: If the rout-er boots, with no initial configuration, the router asks if the user wants to enter the “initial configuration dialogue,” also known simply as setup mode. You can also enter setup mode by using the setup command from privileged mode. + +23 + + + +F + + + + + +User Powers on Router + + +Is NVRAM Empty? + +No Router Copies Startup-config to Running-config + + + +Yes + + + +Do You Want to Enter Setup Mode? + + +No Complete IOS Initialization + + + +Yes + +User Answers Questions in Setup Mode + + +Router Moves Configuration into Startup-config and Running-config + + + +Figure F-6 Logic and Decisions for Entering Setup Mode After Reload + +NOTE Example F-8, earlier in this chapter, showed the password recovery process. That process caused a router to boot while ignoring the initial configuration, causing the router to ask the user the question shown in Figure F-6. +24 CCNA 200-301 Official Cert Guide, Volume 2 + +Command References +Tables F-3 and F-4 list configuration and verification commands used in this chapter. As an easy review exercise, cover the left column in a table, read the right column, and try to recall the command without looking. Then repeat the exercise, covering the right column, and try to recall what the command does. + +Table F-3 Appendix F Configuration Commands + + +Command +config-register value + +boot system {file-uri | filename} + +boot system flash [flash-fs:] [filename] +boot system {tftp | ftp} filename [ip-address] + +archive +write-memory + + +time-period minutes + +path uri + +ip ftp username name + + +ip ftp password pass + + +username name privilege-level 15 secret pass + +Mode and Purpose +Global command that sets the hexadecimal value of the configuration register. +Global command that identifies an externally located IOS image using a URI. +Global command that identifies the location of an IOS image in flash memory. +Global command that identifies an external server, protocol, and filename to use to load an IOS from an external server. +Global command that moves the user into archive mode. +Archive mode command to tell the router to archive the configuration each time the configuration is saved to startup-config. +Archive mode command to define the time between the automatic creation of a new configuration archive. +Archive mode command that defines where to store configurations. +Global command to define the username used when referencing the ftp: IOS file system but not supplying a username. +Global command to define the password used when referencing the ftp: IOS file system but not supplying a password. +Global command to define a username useful to SCP with a privilege level that enables SCP file transfers. + + +Table F-4 Appendix F EXEC Command Reference + + +Command +reload + +Purpose +Enable mode EXEC command that reboots the switch or router. + +copy from-location to-location Enable mode EXEC command that copies files from one file location to another. Locations include the startup-config and running-config files, files on TFTP and RPC servers, and flash memory. +Appendix F: Previous Edition ICND1 Chapter 35: Managing IOS Files 25 + + +Command +copy running-config startup-config + +copy startup-config running-config +show running-config write erase +erase startup-config + +erase nvram: setup + + +show flash + +dir filesystem: + +dir filesystem:directory +verify /md5 filesystem:name [MD5-hash] + +archive config +configure replace filesystem:name + +Purpose +Enable mode EXEC command that saves the active config, F replacing the startup-config file used when the switch +initializes. +Enable mode EXEC command that merges the startup-config file with the currently active config file in RAM. +Lists the contents of the running-config file. +Each one of the three enable mode EXEC commands erases the startup-config file. + + +Enable mode EXEC command that places the user in setup mode, in which Cisco IOS asks the user for input on simple switch configurations. +Lists the names and size of the files in flash memory, as well as noting the amount of flash memory consumed and available. +Lists the files in the referenced file system, or file system directory. + +Performs an MD5 hash of the referenced file and displays the results. If listed, the command compares the MD5 hash in the command with the results of performing MD5 on the local file. +Creates a copy of the running-config file in the archive. +Copies the referenced file into running-config, replacing the running-config, without reloading the router. +APPENDIX G + + +Exam Topics Cross-Reference + +This appendix lists the exam topics associated with the CCNA 200-301 exam. Cisco lists the exam topics on its website. Even though changes to the exam topics are rare, you should always review those exam topics for any updates; check www.cisco.com/go/certifications and navigate to the correct exam. +Cisco organizes each list of exam topics by domains, which are major topic areas. Cisco states the percentage of the exam that should come from each domain, so you get some idea of the areas of importance. Traditionally, the score report you receive after taking the exam shows your percentage score in each domain. + +This appendix includes two separate types of indices to exam topics: + +■ CCNA 200-301 Exam Topic Order: This section lists the CCNA 200-301 exam topics in the same order Cisco lists them on its website, with a list of associated book chapters. This first list shows a cross-reference from each exam topic to the chapters that include at least some material about each topic. +■ Book Chapter Order Versus CCNA 200-301 Exam Topics: This lists the same CCNA 200-301 exam topics but indexed by chapter instead of exam topic. This section lists the chapters in this book, along with the exam topics that the chapter includes. This section basically relists the kind of information found on the first page of each chapter, just in condensed form in one place. + +CCNA 200-301 Exam Topic Order +The CCNA 200-301 exam includes six major topic areas (domains), each with a percentage listed. Table G-1 lists the domains and their percentages. + +Table G-1 CCNA 200-301 Exam Topic Domains +Domain Percentage +Domain 1: Network Fundamentals 20% Domain 2: Network Access 20% Domain 3: IP Connectivity 25% Domain 4: IP Services 10% Domain 5: Security Fundamentals 15% Domain 6: Automation and Programmability 10% +Tables G-2 through G-7 list the exam topics within each of the six domains. Note that the CCNA 200-301 Official Cert Guide, Volume 1, covers some of the exam topics, while this book covers the rest. These tables show the chapters in each book that cover each exam topic. + + + + +Table G-2 CCNA 200-301 Domain 1 Exam Topics (Network Fundamentals) + +Exam Topic Vol 1 Chapter(s) Vol 2 Chapter(s) + +1.1 Explain the Role and function of Network Components +1.1.a Routers +1.1.b L2 and L3 Switches +1.1.c Next-generation firewalls and IPS 1.1.d Access points +1.1.e Controllers (Cisco DNA Center and WLC) 1.1.f Endpoints +1.1.g Servers +1.2 Describe characteristics of network topology architectures +1.2.a 2 tier 1.2.b 3 tier 1.2.c Spine-leaf 1.2.d WAN +1.2.e Small office/home office (SOHO) 1.2.f On-premises and cloud +1.3 Compare physical interface and cabling types 1.3.a Single-mode fiber, multimode fiber, copper +1.3.b Connections (Ethernet shared media and point-to-point) +1.3.c Concepts of PoE +1.4 Identify interface and cable issues (collisions, errors, mismatch duplex, and/or speed) +1.5 Compare TCP to UDP +1.6 Configure and verify IPv4 addressing and subnetting +1.7 Describe the need for private IPv4 addressing 1.8 Configure and verify IPv6 addressing and prefix 1.9 Compare IPv6 address types +1.9.a Global unicast 1.9.b Unique local 1.9.c Link local 1.9.d Anycast +1.9.e Multicast +1.9.f Modified EUI 64 + +2, 3, 5, 7, 26 + +3, 15 2, 5, 7 + +26 29 + + +2, 3 + + + + + +3 +2, 15 + +1, 2 1, 2 1, 2 + + +7 + + +6, 11, 12, 13, 14, 15, 17, 22 +11, 16 23, 24 23, 24 23, 24 23, 24 24 +24 24 +24 + +5, 16, 17 + + + + +5 + +17 16 16 +13, 14, 15, 16 + +13 13 16 14 13 15 13 + + + +13 + + +1 +4 CCNA 200-301 Official Cert Guide, Volume 2 + + +Exam Topic +1.10 Identify IP parameters for Client OS (Windows, Mac OS, Linux) +111 Describe wireless principles +. +1.11.a Nonoverlapping Wi-Fi channels 1.11.b SSID +111.c RF +1.11.d Encryption +1.12 Explain virtualization fundamentals (virtual machines) +1.13 Describe switching concepts 1.13.a MAC learning and aging 1.13.b Frame switching +1.13.c Frame flooding +1.13.d MAC address table + +Vol 1 Chapter(s) Vol 2 Chapter(s) 7 + +26 26 26 26 28 +15 + +5, 8 5, 8 5, 8 5, 8 +5, 8 + + +Table G-3 CCNA 200-301 Domain 2 Exam Topics (Network Access) + + +Exam Topic +2.1 Configure and verify VLANs (normal range) spanning multiple switches +2.1.a Access ports (data and voice) 2.1.b Default VLAN +2.1.c Connectivity +2.2 Configure and verify interswitch connectivity 2.2.a Trunk ports +2.2.b 802.1Q +2.2.c Native VLAN +2.3 Configure and verify Layer 2 discovery protocols (Cisco Discovery Protocol and LLDP) +2.4 Configure and verify (Layer 2/Layer 3) EtherChannel (LACP) +2.5 Describe the need for and basic operations of Rapid PVST+ Spanning Tree Protocol and identify basic operations + +Vol 1 Chapter(s) 8 + +8 8 8 8 8 8 8 + + +8, 9, 10, 17 + +5, 9, 10 + +Vol 2 Chapter(s) + + + + + + + + + + + +9 + +2.5.a Root port, root bridge (primary/secondary), 9, 10 and other port names +2.5.b Port states (forwarding/blocking) 9, 10 2.5.c PortFast benefits 9, 10 +2.6 Compare Cisco Wireless Architectures and AP 27 modes +Appendix G: Exam Topics Cross-Reference 5 + + +Exam Topic +2.7 Describe physical infrastructure connections of WLAN components (AP, WLC, access/trunk ports, and LAG) +2.8 Describe AP and WLC management access connections (Telnet, SSH, HTTP, HTTPS, console, and TACACS+/RADIUS) +2.9 Configure the components of a wireless LAN access for client connectivity using GUI only such as WLAN creation, security settings, QoS profiles, and advanced WLAN settings + +Vol 1 Chapter(s) Vol 2 Chapter(s) +29 G + + +29 + + +29 + + +Table G-4 CCNA 200-301 Domain 3 Exam Topics (IP Connectivity) + + +Exam Topic +3.1 Interpret the components of routing table 3. .a Routing protocol code +1 +3.1.b Prefix +3.1.c Network mask 3.1.d Next hop +3.1.e Administrative distance 3.1.f Metric +3.1.g Gateway of last resort +3.2 Determine how a router makes a forwarding decision by default +3.2.a Longest match +3.2.b Administrative distance 3.2.c Routing protocol metric +3.3 Configure and verify IPv4 and IPv6 static routing +3.3.a Default route 3.3.b Network route 3.3.c Host route 3.3.d Floating static +3.4 Configure and verify single area OSPFv2 3.4.a Neighbor adjacencies +3.4.b Point-to-point +3.4.c Broadcast (DR/BDR selection) 3.4.d Router ID +3.5 Describe the purpose of First Hop Redundancy Protocol + +Vol 1 Chapter(s) Vol 2 Chapter(s) 16 +16 16 16 16 16 16 16 16 + +16 +16, 19, 20 19, 20 +16, 18, 25 + +16, 18, 25 16, 18, 25 16, 18, 25 16, 18, 25 19, 20, 21 19, 20, 21 19, 20, 21 19, 20, 21 19, 20, 21 +12 +6 CCNA 200-301 Official Cert Guide, Volume 2 + +Table G-5 CCNA 200-301 Domain 4 Exam Topics (IP Services) + + +Exam Topics +4.1 Configure and verify inside source NAT using static and pools +4.2 Configure and verify NTP operating in a client and server mode +4.3 Explain the role of DHCP and DNS within the network +4.4 Explain the function of SNMP in network operations +4.5 Describe the use of syslog features including facilities and levels + +Vol 1 Chapter(s) Vol 2 Chapter(s) 10 + +9 + +1, 7 + +12 + +9 + +4.6 Configure and verify DHCP client and relay 6 7 +4.7 Explain the per-hop behavior (PHB) for QoS 11 such as classification, marking, queuing, congestion, +policing, shaping +4.8 Configure network devices for remote access 6 5 using SSH +4.9 Describe the capabilities and function of TFTP/ 12 FTP in the network + +Table G-6 CCNA 200-301 Domain 5 Exam Topics (Security Fundamentals) + + +Exam Topics +5.1 Define key security concepts (threats, vulnerabilities, exploits, and mitigation techniques) +5.2 Describe security program elements (user awareness, training, and physical access control) + +Vol 1 Chapter(s) Vol 2 Chapter(s) 4 + +4 + +5.3 Configure device access control using local 6 5 passwords +5.4 Describe security password policies elements, 4 such as management, complexity, and password +alternatives (multifactor authentication, certificates, and biometrics) +5.5 Describe remote access and site-to-site VPNs 14 5.6 Configure and verify access control lists 2, 3 +5.7 Configure Layer 2 security features (DHCP 6, 8 snooping, dynamic ARP inspection, and port +security) +5.8 Differentiate authentication, authorization, and 4 accounting concepts +5.9 Describe wireless security protocols (WPA, 28 WPA2, and WPA3) +5.10 Configure WLAN using WPA2 PSK using the 29 GUI +Appendix G: Exam Topics Cross-Reference 7 + +Table G-7 CCNA 200-301 Domain 6 Exam Topics (Automation and Programmability) + + +Exam Topics +6.1 Explain how automation impacts network management +6.2 Compare traditional networks with controller-based networking +6.3 Describe controller-based and software-defined architectures (overlay, underlay, and fabric) +6.3.a Separation of control plane and data plane 6.3.b Northbound and southbound APIs +6.4 Compare traditional campus device management with Cisco DNA Center enabled device management +6.5 Describe characteristics of REST-based APIs (CRUD, HTTP verbs, and data encoding) +6.6 Recognize the capabilities of configuration management mechanisms Puppet, Chef, and Ansible +6.7 Interpret JSON encoded data + +Vol 1 Chapter(s) Vol 2 Chapter(s) G 16 + +16 + +16, 17 + +16, 17 16, 17 17 + +18 + +19 + +18 + + +Book Chapters, with Exam Topics Covered in Each +Cisco organizes its exam topics based on the outcome of your learning experience, which is typically not a reasonable order for building the content of a book or course. This section lists this book’s chapters in sequence, with the exam topics covered in each chapter. +Book Chapter Exam Topics Covered Part I: IP Access Control Lists +Chapter 1: Introduction 1.0 Network Fundamentals to TCP/IP Transport and 1.5 Compare TCP to UDP +Applications + + + + +Chapter 2: Basic IPv4 Access Control Lists + +Chapter 3: Advanced IPv4 Access Control Lists + +4.0 IP Services + +4.3 Explain the role of DHCP and DNS in the network 5.0 Security Fundamentals +5.6 Configure and verify access control lists 5.0 Security Fundamentals +5.6 Configure and verify access control lists +8 CCNA 200-301 Official Cert Guide, Volume 2 + +Book Chapter Exam Topics Covered Part II: Security Services + +Chapter 4: Security Architectures + + + + + + + + + +Chapter 5: Securing Network Devices + + + + + + + + +Chapter 6: Implementing Switch Port Security + +5.0 Security Fundamentals +5.1 Define key security concepts (threats, vulnerabilities, exploits, and mitigation techniques) + +5.2 Describe security program elements (user awareness, training, and physical access control) + +5.4 Describe security password policies elements, such as management, complexity, and password alternatives (multifactor authentication, certificates, and biometrics) + +5.8 Differentiate authentication, authorization, and accounting concepts +1.0 Network Fundamentals + +1.1 Explain the Role of Network Components + +1.1.c Next-generation firewalls and IPS + +4.0 IP Services + +4.8 Configure network devices for remote access using SSH + +5.0 Security Fundamentals + +5.3 Configure device access control using local passwords 5.0 Security Fundamentals +5.7 Configure Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) + +Chapter 7: Implementing 1.0 Network Fundamentals +DHCP 1.10 Identify IP parameters for Client OS (Windows, Mac OS, Linux) + + + + + + +Chapter 8: DHCP Snooping and ARP Inspection + +4.0 IP Services + +4.3 Explain the role of DHCP and DNS within the network + +4.6 Configure and verify DHCP client and relay 5.0 Security Fundamentals +5.7 Configure Layer 2 security features (DHCP snooping, dynamic ARP inspection, and port security) +Appendix G: Exam Topics Cross-Reference 9 + + +Book Chapter +Part III: IP Services +Chapter 9: Device Management Protocols + + + + + + + + +Chapter 10: Network Address Translation + +Chapter 11: Quality of Service (QoS) + + +Chapter 12: Miscellaneous IP Services + +Exam Topics Covered +G 2.0 Network Access +2.3 Configure and verify Layer 2 discovery protocols (Cisco Discovery Protocol and LLDP) + +4.0 IP Services + +4.2 Configure and verify NTP operating in a client and server mode + +4.5 Describe the use of syslog features including facilities and levels +4.0 IP Services + +4.7 Configure and verify inside source NAT using static and pools 4.0 IP Services +4.7 Explain the forwarding per-hop behavior (PHB) for QoS such as classification, marking, queuing, congestion, policing, shaping +3.0 IP Connectivity + +3.5 Describe the purpose of First Hop Redundancy Protocol + +4.0 Infrastructure Services + +4.4 Explain the function of SNMP in network operations + +4.9 Describe the capabilities and function of TFTP/FTP in the network + +Part IV: Network Architecture + +Chapter 13: LAN Architecture + + + + + + + + +Chapter 14: WAN Architecture + + +1.0 Network Fundamentals + +1.2 Describe characteristics of network topology architectures + +1.2.a 2 tier + +1.2.b 3 tier + +1.2.e Small office/home office (SOHO) + +1.3 Compare physical interface and cabling types + +1.3.c Concepts of PoE 1.0 Network Fundamentals +1.2 Describe the characteristics of network topology architecture + +1.2.d WAN + +5.0 Security Fundamentals + +5.5 Describe remote access and site-to-site VPNs +10 CCNA 200-301 Official Cert Guide, Volume 2 + + +Book Chapter +Chapter 15: Cloud Architecture + +Exam Topics Covered +1.0 Network Fundamentals + +1.2 Describe the characteristics of network topology architectures + +1.2.f On-premises and cloud + +1.12 Explain virtualization fundamentals (virtual machines) + +Part V: Network Automation + +Chapter 16: Introduction to Controller-Based Networking + + + + + + +Chapter 17: Cisco Software-Defined Access + + + + + + + + + +Chapter 18: Understanding REST and JSON + + +Chapter 19: Ansible, Puppet, and Chef + + +6.0 Automation and Programmability + +6.1 Explain how automation impacts network management + +6.2 Compare traditional networks with controller-based networking + +6.3 Describe controller-based and software-defined architectures (overlay, underlay, and fabric) + +6.3.a Separation of control plane and data plane + +6.3.b Northbound and southbound APIs 1.0 Network Fundamentals +1.1 Explain the role and function of network components + +1.1.e Controllers (Cisco DNA Center and WLC) + +6.0 Automation and Programmability + +6.1 Explain how automation impacts network management + +6.2 Compare traditional networks with controller-based networking + +6.3 Describe controller-based and software-defined architectures (overlay, underlay, and fabric) +6.0 Automation and Programmability + +6.5 Describe characteristics of REST-based APIs (CRUD, HTTP verbs, and data encoding) + +6.7 Interpret JSON encoded data +6.0 Automation and Programmability + +6.6 Recognize the capabilities of configuration mechanisms Puppet, Chef, and Ansible + + + + + + + + +This page intentionally left blank +Appendix H Study Planner + + + +Practice Test Reading Task + + + + +Element + + +Introduction +1. Introduction to TCP/IP Transport +and Applications + +Task + + +Read Introduction + +Read Foundation Topics + +Goal Date First Date Completed + +Second Date Notes Completed (Optional) + + + +1. Introduction to TCP/IP Transport and Applications +1. Introduction to TCP/IP Transport and Applications +1. Introduction to TCP/IP Transport and Applications +1. Introduction to TCP/IP Transport and Applications + +Practice Test + + +2. Basic IPv4 Access Control Lists + +2. Basic IPv4 Access Control Lists + +2. Basic IPv4 Access Control Lists + +2. Basic IPv4 Access Control Lists + +2. Basic IPv4 Access Control Lists + + +2. Basic IPv4 Access Control Lists + +2. Basic IPv4 Access Control Lists + +Practice Test + +3. Advanced IPv4 Access Control Lists +3. Advanced IPv4 Access Control Lists +3. Advanced IPv4 Access Control +Lists + + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Practice configuring IPv4 access lists using Appendix E on the companion website +Review command tables for this chapter + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or +companion website +3. Advanced IPv4 Access Control Lists +3. Advanced IPv4 Access Control Lists +3. Advanced IPv4 Access Control Lists +3. Advanced IPv4 Access Control Lists + +Practice Test + +Part I. IP Access Control Lists + +Practice Test + +4. Security Architectures + +4. Security Architectures + +4. Security Architectures + +4. Security Architectures + +4. Security Architectures + +4. Security Architectures + +Practice Test + +5. Securing Network Devices + +5. Securing Network Devices + +5. Securing Network Devices + +5. Securing Network Devices + +5. Securing Network Devices + +Practice Test + +6. Implementing Switch Port Security +6. Implementing Switch Port Security +6. Implementing Switch Port Security +6. Implementing Switch Port Security +6. Implementing Switch Port Security +6. Implementing Switch Port Security +6. Implementing Switch Port Security +6. Implementing Switch Port +Security + + +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Watch video for this chapter using the companion website +Review command tables for this chapter + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part I Review +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Watch video for this chapter using the companion website +Take practice test in study mode using Part Review exam in practice test software for this chapter +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Review command tables for this chapter + +Take practice test in study mode using Part Review exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete config checklists in this chapter using the companion website +Complete all memory tables in this chapter using the companion website +Watch video for this chapter using the companion website +Review command tables for this chapter + +Practice Test + +7. Implementing DHCP + +7. Implementing DHCP + +7. Implementing DHCP + +7. Implementing DHCP + +7. Implementing DHCP + +Practice Test + +8. Implementing DHCP Snooping and ARP Inspection +8. Implementing DHCP Snooping and ARP Inspection +8. Implementing DHCP Snooping and ARP Inspection +8. Implementing DHCP Snooping and ARP Inspection +8. Implementing DHCP Snooping and ARP Inspection +8. Implementing DHCP Snooping and ARP Inspection + +Practice Test + + +Part II. Security Services + +Practice Test + +9. Device Management Protocols + +9. Device Management Protocols + +9. Device Management Protocols + +9. Device Management Protocols + +9. Device Management Protocols + +9. Device Management Protocols + +Practice Test + +10. Network Address Translation + +10. Network Address Translation + +10. Network Address Translation + +10. Network Address Translation + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Review command tables for this chapter + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete config checklists in this chapter using the companion website +Review command tables for this chapter + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part II Review + +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Review command tables for this chapter + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine + +10. Network Address Translation + +10. Network Address Translation + +10. Network Address Translation + +Practice Test + +11. Quality of Service (QoS) + +11. Quality of Service (QoS) + +11. Quality of Service (QoS) + +11. Quality of Service (QoS) + +11. Quality of Service (QoS) + +11. Quality of Service (QoS) + +Practice Test + +12. Miscellaneous IP Services + +12. Miscellaneous IP Services + +12. Miscellaneous IP Services + +12. Miscellaneous IP Services + +12. Miscellaneous IP Services + +Practice Test + + +Part III. IP Services + +Practice Test + +13. LAN Architecture + +13. LAN Architecture + +13. LAN Architecture + +13. LAN Architecture + +13. LAN Architecture + +Practice Test + +14. WAN Architecture + +14. WAN Architecture + +14. WAN Architecture + +Complete config checklists in this chapter using the companion website +Review command tables for this chapter + +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Watch video for this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part III Review + +Take practice test in study mode using Part Review exam in practice test software for this part +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website + +14. WAN Architecture + +14. WAN Architecture + +Practice Test + +15. Cloud Architecture + +15. Cloud Architecture + +15. Cloud Architecture + +15. Cloud Architecture + +15. Cloud Architecture + +Practice Test + + +Part IV. Network Architecture + +Practice Test + +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part IV Review + +Take practice test in study mode using Part Review exam in practice test software for + +this part +16. Introduction to Controller-Based +Networking Read Foundation Topics +16. Introduction to Controller-Based Review Key Topics using the book or Networking companion website +16. Introduction to Controller-Based Define Key Terms using the book or Networking companion website +16. Introduction to Controller-Based Repeat DIKTA questions using the book Networking or PTP exam engine +16. Introduction to Controller-Based Complete all memory tables in this chapter Networking using the companion website +16. Introduction to Controller-Based Watch video for this chapter using the Networking companion website + + +Practice Test + +17. Cisco Software-Defined Access (SDA) +17. Cisco Software-Defined Access (SDA) +17. Cisco Software-Defined Access (SDA) +17. Cisco Software-Defined Access (SDA) + +Practice Test + + +18. Understanding REST and JSON + +18. Understanding REST and JSON + +18. Understanding REST and JSON + +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or +companion website + +18. Understanding REST and JSON + +18. Understanding REST and JSON + +Practice Test + +19. Understanding Ansible, Puppet, and Chef +19. Understanding Ansible, Puppet, and Chef +19. Understanding Ansible, Puppet, and Chef +19. Understanding Ansible, Puppet, and Chef +19. Understanding Ansible, Puppet, and Chef + +Practice Test + + +Part V. Network Automation + +Practice Test + + +Final Review + + +Final Review + + +Final Review + +Final Review + +Final Review + + +Final Review + +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Read Foundation Topics + +Review Key Topics using the book or companion website +Define Key Terms using the book or companion website +Repeat DIKTA questions using the book or PTP exam engine +Complete all memory tables in this chapter using the companion website +Take practice test in study mode using DIKTA exam in practice test software for this chapter +Complete all exercises in Part V Review + +Take practice test in study mode using Part Review exam in practice test software for this part +Take practice test in study mode for all Book Questions in practice test software +Review all Key Topics in all chapters or in the Key Topics App using the companion website +Review all Key Terms in all chapters or using the Key Terms Flashcards on the companion website +Complete all memory tables for all chapters using the companion website Take practice test in practice exam mode using Exam Bank #1 questions for all chapters +Take practice test in practice exam mode using Exam Bank #2 questions for all +chapters + + + + +CCNA 200-301, Volume 2 Official Cert Guide Companion Website + + +Access interactive study tools on this book’s companion website, including practice test software, video training, memory table and config checklist review exercises, Key Term flash card application, study planner, and more! + + +To access the companion website, simply follow these steps: + + +1. Go to www.ciscopress.com/register. +2. Enter the print book ISBN: 9781587147135. +3. Answer the security question to validate your purchase. 4. Go to your account page. +5. Click on the Registered Products tab. +6. Under the book listing, click on the Access Bonus Content link. + + +If you have any issues accessing the companion website, you can contact our support team by going to http://pearsonitp.echelp.org. + + + + +Where are the companion content files? + + +Thank you for purchasing this Premium Edition version of +CCNA 200-301 Official Cert Guide, Volume 2 + + + + +This product comes with companion content. You have access to these files by following the steps below: + +1. Go to ciscopress.com/account and log in. + +2. Click on the “Access Bonus Content” link in the Registered Products section of your account page for this product, to be taken to the page where your +downloadable content is available. + +Please note that many of our companion content files can be very large, especially image and video files. + +If you are unable to locate the files for this +title by following the steps at left, please visit ciscopress.com/support +and select the chat, phone, or web ticket options to get help from a tech support +representative cip + + + + + + + +The Professional and Personal Technology Brands of Pearson diff --git a/C++ - The Complete Reference conv.txt b/C++ - The Complete Reference conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..924ecacaf6e35eb6576600bbd0f3ea653a112753 --- /dev/null +++ b/C++ - The Complete Reference conv.txt @@ -0,0 +1,31438 @@ + + + + + + + + + + + +C++: The Complete Reference +Third Edition + + + + + + +About the Author… +Herb Schildt is the leading authority on C and +C++ and a best-selling author whose books have sold more than 1.5 million copies. His acclaimed C and C++books include Teach Yourself C, C++ from the Ground Up, Teach Yourself C++, C++: The Complete Reference, Borland C++: The Complete Reference, and C++ Programmer's Reference to name a few. + + + + + + +C++: The Complete Reference +Third Edition + + + + + + + + +Herbert Schildt + + + + + + + + + + + +Osborne McGraw-Hill +Berkeley New York St. Louis San Francisco Auckland Bogotá Hamburg London Madrid +Mexico City Milan Montreal New Delhi Panama City Paris São Paulo Singapore Sydney +Tokyo Toronto + + + + + + + +McGraw-Hill bc +a +Copyright © 1998 by McGraw-Hill Companies. All rights reserved. Manufactured in the United States of America. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. + +0-07-213293-0 + +The material in this eBook also appears in the print version of this title: 0-07-882476-1 + + + +All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. +McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate train-ing programs. For more information, please contact George Hoare, Special Sales, at george_hoare@mcgraw-hill.com or (212) 904-4069. + +TERMS OF USE +This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. +THE WORK IS PROVIDED “AS IS”. McGRAW-HILLAND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, spe-cial, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise. + +DOI: 10.1036/0072132930 + + + +Contents at a Glance + + + +Part I The Foundation of C++: The C Subset + +1 An Overview of C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4 Arrays and Null-Terminated Strings . . . . . . . . . . . . . . . . 89 5 Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 6 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 7 Structures, Unions, Enumerations, and User- +Defined Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 8 C-Style Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 9 File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 +10 The Preprocessor and Comments . . . . . . . . . . . . . . . . . . . 237 + + +Part II C++ + +11 An Overview of C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 12 Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 13 Arrays, Pointers, References and the Dynamic +Allocation Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 14 Function Overloading, Copy Constructors, +and Default Arguments . . . . . . . . . . . . . . . . . . . . . . . . 361 15 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 + + + + + + +v +vi C + + : T h e C o m p l e t e R e f e r e n c e + + + +16 17 18 19 20 21 22 23 + +24 + + +Part III + +25 26 27 28 29 30 31 + + +Part IV + +32 33 34 35 36 37 38 + + +Part V + +39 40 + +Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 Virtual Functions and Polymorphism . . . . . . . . . . . . . . 445 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 C++ I/O System Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 C++ File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 Run-Time Type ID and the Casting Operators . . . . . . . . 569 Namespaces, Conversion Functions,and Other +Advanced Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593 Introducing the Standard Template Library . . . . . . . . . . 625 + + +The Standard Function Library + +The C-Based I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . 695 The String and Character Functions . . . . . . . . . . . . . . . . . 719 The Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . 733 Time, Date, and Localization Functions . . . . . . . . . . . . . . 743 The Dynamic Allocation Functions . . . . . . . . . . . . . . . . . . 753 Utility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757 The Wide-Character Functions . . . . . . . . . . . . . . . . . . . . . 771 + + +The Standard C++ Class Library + +The Standard C++ I/O Classes . . . . . . . . . . . . . . . . . . . . . 783 The STL Container Classes . . . . . . . . . . . . . . . . . . . . . . . . . 807 The STL Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835 STL Iterators, Allocators, and Function Objects . . . . . . . 857 The String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877 The Numeric Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893 Exception Handling and Miscellaneous Classes . . . . . . . 921 + + +Applying C++ + +Integrating New Classes: A Custom String Class . . . . . . 931 An Object-Oriented Expression Parser . . . . . . . . . . . . . . . 959 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995 + + + + + + + + + +Contents + + + + + + +Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix + + +Part I +The Foundation of C++: The C Subset + +1 An Overview of C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 The Origins of C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 C Is a Middle-Level Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 C Is a Structured Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 C Is a Programmer's Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 The Form of a C Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 The Library and Linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Separate Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Understanding the .C and .CPP File Extensions . . . . . . . . . . . . . . . . 12 + +2 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 The Five Basic Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 + + + + + + +vii +viii C + + : T h e C o m p l e t e R e f e r e n c e + + +Modifying the Basic Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Identifier Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Where Variables Are Declared . . . . . . . . . . . . . . . . . . . . . . . 17 +Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Formal Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 +Access Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 const . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 volatile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 +Storage Class Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 extern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 static Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 register Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 +Variable Initializations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Hexadecimal and Octal Constants . . . . . . . . . . . . . . . . . . . . 32 +String Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Backslash Character Constants . . . . . . . . . . . . . . . . . . . . . . . 33 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 The Assignment Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 +Type Conversion in Assignments . . . . . . . . . . . . . . . . . . . . . 35 Multiple Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Increment and Decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Relational and Logical Operators . . . . . . . . . . . . . . . . . . . . . 39 Bitwise Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 The ? Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 The & and * Pointer Operators . . . . . . . . . . . . . . . . . . . . . . . 47 The Compile-Time Operator sizeof . . . . . . . . . . . . . . . . . . . 49 The Comma Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 The Dot (.) and Arrow (−>) Operators . . . . . . . . . . . . . . . . . 51 The [ ] and ( ) Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Precedence Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 +Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Order of Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Type Conversion in Expressions . . . . . . . . . . . . . . . . . . . . . . 53 +Casts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Spacing and Parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Shorthand Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 + +3 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 True and False in C and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 +C o n t e n t s ix + + +Selection Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Nested ifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 The if-else-if Ladder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 The ? Alternative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 The Conditional Expression . . . . . . . . . . . . . . . . . . . . . . . . . . 66 switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Nested switch Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 +Iteration Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 The for Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 for Loop Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 The Infinite Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 for Loops with No Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 The while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 The do-while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 +Declaring Variables within Selection and Iteration Statements . . . 81 Jump Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 The return Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 +The goto Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 The break Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 The exit( ) Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 The continue Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 +Expression Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Block Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 + +4 Arrays and Null-Terminated Strings . . . . . . . . . . . . . . . 89 Single-Dimension Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Generating a Pointer to an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Passing Single-Dimension Arrays to Functions . . . . . . . . . . . . . . . . 92 Null-Terminated Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Two-Dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Arrays of Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Indexing Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Array Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Unsized Array Initializations . . . . . . . . . . . . . . . . . . . . . . . . . 106 +A Tic-Tac-Toe Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 + +5 Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 What Are Pointers? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Pointer Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 The Pointer Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Pointer Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 +x C + + : T h e C o m p l e t e R e f e r e n c e + + +Pointer Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Pointer Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Pointer Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 +Pointers and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Arrays of Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Multiple Indirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Initializing Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Pointers to Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 C's Dynamic Allocation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Problems with Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 + +6 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 The General Form of a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Scope Rules of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Function Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 +Call by Value, Call by Reference . . . . . . . . . . . . . . . . . . . . . . 139 Creating a Call by Reference . . . . . . . . . . . . . . . . . . . . . . . . . 140 Calling Functions with Arrays . . . . . . . . . . . . . . . . . . . . . . . 142 +argc and argv—Arguments to main( ) . . . . . . . . . . . . . . . . . . . . . . . . 144 The return Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Returning from a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Returning Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Returning Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Functions of Type void . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 +What Does main( ) Return? . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Function Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Standard Library Function Prototypes . . . . . . . . . . . . . . . . . 157 Declaring Variable-Length Parameter Lists . . . . . . . . . . . . . . . . . . . . 158 Old-Style Versus Modern Function Parameter Declarations . . . . . 158 Implementation Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Parameters and General-Purpose Functions . . . . . . . . . . . . 159 Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 + +7 Structures, Unions, Enumerations, and User- +Defined Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Accessing Structure Members . . . . . . . . . . . . . . . . . . . . . . . . 165 Structure Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 +Arrays of Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Passing Structures to Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Passing Structure Members to Functions . . . . . . . . . . . . . . . 167 Passing Entire Structures to Functions . . . . . . . . . . . . . . . . . 167 +C o n t e n t s xi + + +Structure Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Declaring a Structure Pointer . . . . . . . . . . . . . . . . . . . . . . . . . 170 Using Structure Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 +Arrays and Structures Within Structures . . . . . . . . . . . . . . . . . . . . . . 173 Bit-Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 Using sizeof to Ensure Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 typedef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 + +8 C-Style Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 An Important Application Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Reading and Writing Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 +A Problem with getchar( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Alternatives to getchar( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Reading and Writing Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 Formatted Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 printf( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Printing Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Printing Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Displaying an Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 +The %n Specifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Format Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 The Minimum Field Width Specifier . . . . . . . . . . . . . . . . . . 199 The Precision Specifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Justifying Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Handling Other Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . 202 The * and # Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 +scanf( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Format Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Inputting Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Inputting Unsigned Integers . . . . . . . . . . . . . . . . . . . . . . . . . 205 Reading Individual Characters Using scanf( ) . . . . . . . . . . 205 Reading Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Inputting an Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 The %n Specifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Using a Scanset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Discarding Unwanted White Space . . . . . . . . . . . . . . . . . . . 207 Non-White-Space Characters in the Control String . . . . . . 208 You Must Pass scanf( ) Addresses . . . . . . . . . . . . . . . . . . . . . 208 Format Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 +Suppressing Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 +xii C + + : T h e C o m p l e t e R e f e r e n c e + + +9 File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 C Versus C++ File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Streams and Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 +Text Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Binary Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 +Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 File System Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 The File Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Opening a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Closing a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Writing a Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Reading a Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 +Using fopen( ), getc( ), putc( ), and fclose( ) . . . . . . . . . . . . . 218 Using feof( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Working with Strings: fputs( ) and fgets( ) . . . . . . . . . . . . . 222 rewind( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 ferror( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Erasing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Flushing a Stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 +fread( ) and fwrite( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Using fread( ) and fwrite( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 +fseek( ) and Random-Access I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 fprintf( ) and fscanf( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 The Standard Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 The Console I/O Connection . . . . . . . . . . . . . . . . . . . . . . . . . 234 +Using freopen( ) to Redirect the Standard Streams . . . . . . . . . . . . . 235 + +10 The Preprocessor and Comments . . . . . . . . . . . . . . . . . . 237 The Preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 #define . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Defining Function-like Macros . . . . . . . . . . . . . . . . . . . . . . . 240 +#error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 #include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Conditional Compilation Directives . . . . . . . . . . . . . . . . . . . . . . . . . . 242 #if, #else, #elif, and #endif . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 +#ifdef and #ifndef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 #undef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Using defined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 #line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 #pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 The # and ## Preprocessor Operators . . . . . . . . . . . . . . . . . . . . . . . . . 248 Predefined Macro Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 +C o n t e n t s xiii + + +C-Style Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 + +Part II C++ + +11 An Overview of C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 The Origins of C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 What Is Object-Oriented Programming? . . . . . . . . . . . . . . . . . . . . . . 257 +Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 +Some C++ Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 A Sample C++ Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 A Closer Look at the I/O Operators . . . . . . . . . . . . . . . . . . . 263 Declaring Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 No Default to int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 The bool Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 +Old-Style vs. Modern C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 The New C++ Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 Working with an Old Compiler . . . . . . . . . . . . . . . . . . . . . . 270 Introducing C++ Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Function Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Constructors and Destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 The C++ Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 The General Form of a C++ Program . . . . . . . . . . . . . . . . . . . . . . . . . 288 + +12 Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Structures and Classes Are Related . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Unions and Classes Are Related . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 Anonymous Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 +Friend Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Friend Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Inline Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 Defining Inline Functions Within a Class . . . . . . . . . . . . . . 306 Parameterized Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Constructors with One Parameter: A Special Case . . . . . . 309 +Static Class Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 Static Data Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 +xiv C + + : T h e C o m p l e t e R e f e r e n c e + + +Static Member Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 When Constructors and Destructors Are Executed . . . . . . . . . . . . . 317 The Scope Resolution Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 Nested Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 Local Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 Passing Objects to Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 Returning Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 Object Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 + +13 Arrays, Pointers, References, and the Dynamic Allocation Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 +Arrays of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 Creating Initialized vs. Uninitialized Arrays . . . . . . . . . . . 330 Pointers to Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Type Checking C++ Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 The this Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 Pointers to Derived Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 Pointers to Class Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Reference Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Passing References to Objects . . . . . . . . . . . . . . . . . . . . . . . . 345 Returning References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Independent References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 References to Derived Types . . . . . . . . . . . . . . . . . . . . . . . . . 348 Restrictions to References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 +A Matter of Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 C++'s Dynamic Allocation Operators . . . . . . . . . . . . . . . . . . . . . . . . . 349 Initializing Allocated Memory . . . . . . . . . . . . . . . . . . . . . . . 351 Allocating Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 Allocating Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 +The nothrow Alternative . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 The Placement Forms of new and delete . . . . . . . . . . . . . . . . . . . . . . 359 + +14 Function Overloading, Copy Constructors, and Default Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 +Function Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 Overloading Constructor Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 364 Overloading a Constructor to Gain Flexibility . . . . . . . . . . 364 Allowing Both Initialized and Uninitialized Objects . . . . . 366 +Copy Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 Finding the Address of an Overloaded Function . . . . . . . . . . . . . . . 372 The overload Anachronism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 +C o n t e n t s xv + + +Default Function Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 Default Arguments vs. Overloading . . . . . . . . . . . . . . . . . . 378 Using Default Arguments Correctly . . . . . . . . . . . . . . . . . . . 380 +Function Overloading and Ambiguity . . . . . . . . . . . . . . . . . . . . . . . . 380 + +15 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Creating a Member Operator Function . . . . . . . . . . . . . . . . . . . . . . . 386 +Creating Prefix and Postfix Forms of the +Increment and Decrement Operators . . . . . . . . . . . . . . . 391 Overloading the Shorthand Operators . . . . . . . . . . . . . . . . . 392 Operator Overloading Restrictions . . . . . . . . . . . . . . . . . . . . 392 Operator Overloading Using a Friend Function . . . . . . . . . . . . . . . . 393 Using a Friend to Overload ++ or – – . . . . . . . . . . . . . . . . . . 395 +Friend Operator Functions Add Flexibility . . . . . . . . . . . . . 398 Overloading new and delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 Overloading new and delete for Arrays . . . . . . . . . . . . . . . 405 Overloading the nothrow Version of new and delete . . . . 408 Overloading Some Special Operators . . . . . . . . . . . . . . . . . . . . . . . . . 409 Overloading [ ] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 Overloading ( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 Overloading –> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Overloading the Comma Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 + +16 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 Base-Class Access Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 Inheritance and protected Members . . . . . . . . . . . . . . . . . . . . . . . . . . 422 Protected Base-Class Inheritance . . . . . . . . . . . . . . . . . . . . . 426 +Inheriting Multiple Base Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 Constructors, Destructors, and Inheritance . . . . . . . . . . . . . . . . . . . . 428 +When Constructor and Destructor +Functions Are Executed . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 Passing Parameters to Base-Class Constructors . . . . . . . . . 432 +Granting Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Virtual Base Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 + +17 Virtual Functions and Polymorphism . . . . . . . . . . . . . . . 445 Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 +Calling a Virtual Function Through a Base Class +Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 The Virtual Attribute Is Inherited . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Virtual Functions Are Hierarchical . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Pure Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 +Abstract Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 +xvi C + + : T h e C o m p l e t e R e f e r e n c e + + +Using Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 Early vs. Late Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 + +18 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Generic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 +A Function with Two Generic Types . . . . . . . . . . . . . . . . . . 465 Explicitly Overloading a Generic Function . . . . . . . . . . . . . 465 Overloading a Function Template . . . . . . . . . . . . . . . . . . . . 468 Using Standard Parameters with Template Functions . . . 468 Generic Function Restrictions . . . . . . . . . . . . . . . . . . . . . . . . 469 +Applying Generic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 A Generic Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 Compacting an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 Generic Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 An Example with Two Generic Data Types . . . . . . . . . . . . 478 Applying Template Classes: A Generic Array Class . . . . . 479 +Using Non-Type Arguments with Generic Classes . . . . . . 481 Using Default Arguments with Template Classes . . . . . . . 483 Explicit Class Specializations . . . . . . . . . . . . . . . . . . . . . . . . . 485 +The typename and export Keywords . . . . . . . . . . . . . . . . . . . . . . . . . 486 The Power of Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 + +19 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 Exception Handling Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Catching Class Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 +Using Multiple catch Statements . . . . . . . . . . . . . . . . . . . . . . 497 Handling Derived-Class Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Exception Handling Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 Catching All Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 Restricting Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 Rethrowing an Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 Understanding terminate( ) and unexpected( ) . . . . . . . . . . . . . . . . . 505 Setting the Terminate and Unexpected Handlers . . . . . . . . 506 +The uncaught_exception( ) Function . . . . . . . . . . . . . . . . . . . . . . . . . 507 The exception and bad_exception Classes . . . . . . . . . . . . . . . . . . . . . 508 Applying Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508 + +20 The C++ I/O System Basics . . . . . . . . . . . . . . . . . . . . . . . 511 Old vs. Modern C++ I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512 C++ Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 The C++ Stream Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 +C++'s Predefined Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . 514 Formatted I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 +C o n t e n t s xvii + + +Formatting Using the ios Members . . . . . . . . . . . . . . . . . . . . 515 Setting the Format Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 Clearing Format Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 An Overloaded Form of setf( ) . . . . . . . . . . . . . . . . . . . . . . . . 518 Examining the Formatting Flags . . . . . . . . . . . . . . . . . . . . . . 520 Setting All Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 Using width( ), precision( ), and fill( ) . . . . . . . . . . . . . . . . . 522 Using Manipulators to Format I/O . . . . . . . . . . . . . . . . . . . 524 +Overloading << and >> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Creating Your Own Inserters . . . . . . . . . . . . . . . . . . . . . . . . . 528 Creating Your Own Extractors . . . . . . . . . . . . . . . . . . . . . . . 534 Creating Your Own Manipulator Functions . . . . . . . . . . . . . . . . . . . 537 + +21 C++ File I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 and the File Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 Opening and Closing a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 Reading and Writing Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 Unformatted and Binary I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 Characters vs. Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 +put( ) and get( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 read( ) and write( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 +More get( ) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 getline( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 Detecting EOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 The ignore( ) Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 peek( ) and putback( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 flush( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 Random Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559 Obtaining the Current File Position . . . . . . . . . . . . . . . . . . . 563 +I/O Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563 Customized I/O and Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 + +22 Run-Time Type ID and the Casting Operators . . . . . . . 569 Run-Time Type Identification (RTTI) . . . . . . . . . . . . . . . . . . . . . . . . . 570 +A Simple Application of Run-Time Type ID . . . . . . . . . . . . 576 typeid Can Be Applied to Template Classes . . . . . . . . . . . . 578 +The Casting Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 dynamic_cast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Replacing typeid with dynamic_cast . . . . . . . . . . . . . . . . . . 584 +Using dynamic_cast with Template Classes . . . . . . . . . . . . 586 const_cast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 static_cast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 reinterpret_cast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 +xviii C + + : T h e C o m p l e t e R e f e r e n c e + + +23 Namespaces, Conversion Functions, +and Other Advanced Topics . . . . . . . . . . . . . . . . . . . . . 593 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 Namespace Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 +using . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598 Unnamed Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 Some Namespace Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 +The std Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 Creating Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 const Member Functions and mutable . . . . . . . . . . . . . . . . . . . . . . . . 609 Volatile Member Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 Explicit Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 Using the asm Keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 Linkage Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614 Array-Based I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615 The Array-Based Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 Creating an Array-Based Output Stream . . . . . . . . . . . . . . . 616 +Using an Array as Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 Input/Output Array-Based Streams . . . . . . . . . . . . . . . . . . 620 +Using Dynamic Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 Using Binary I/O with Array-Based Streams . . . . . . . . . . . . . . . . . . 622 Summarizing the Differences +Between C and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 + +24 Introducing the Standard Template Library . . . . . . . . . 625 An Overview of the STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 +Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627 Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627 Other STL Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 +The Container Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 General Theory of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 Accessing a Vector Through an Iterator . . . . . . . . . . . . . . . . 635 Inserting and Deleting Elements in a Vector . . . . . . . . . . . . 637 +Storing Class Objects in a Vector . . . . . . . . . . . . . . . . . . . . . . 639 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641 +Understanding end( ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645 push_front( ) vs push_back( ) . . . . . . . . . . . . . . . . . . . . . . . . 647 Sort a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648 Merging One List with Another . . . . . . . . . . . . . . . . . . . . . . 649 Storing Class Objects in a List . . . . . . . . . . . . . . . . . . . . . . . . 651 +Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654 +C o n t e n t s xix + + +Storing Class Objects In a Map . . . . . . . . . . . . . . . . . . . . . . . 658 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660 Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 660 Removing and Replacing Elements . . . . . . . . . . . . . . . . . . . 666 Reversing a Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 Transforming a Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 +Using Function Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 Unary and Binary Function Objects . . . . . . . . . . . . . . . . . . . 671 Using the Built-in Function Objects . . . . . . . . . . . . . . . . . . . 671 Creating a Function Object . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 Using Binders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 +The string Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679 Some string Member Functions . . . . . . . . . . . . . . . . . . . . . . . 683 Strings Are Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 Putting Strings into Other Containers . . . . . . . . . . . . . . . . . 690 +Final Thoughts on the STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 + +Part III +The Standard Function Library + +25 The C-Based I/O Functions . . . . . . . . . . . . . . . . . . . . . . . 695 clearerr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696 fclose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 feof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 ferror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 fflush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 fgetc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 fgetpos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 fgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 fopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 fprintf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 fputc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 fputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 fread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 freopen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 fscanf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 fseek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 fsetpos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 ftell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 fwrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 getc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 getchar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 gets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 +xx C + + : T h e C o m p l e t e R e f e r e n c e + + +perror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 printf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 putc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 putchar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 puts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 rewind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 scanf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 setbuf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 setvbuf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 sprintf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 sscanf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 tmpfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 tmpnam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 ungetc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 vprintf, vfprintf, and vsprintf . . . . . . . . . . . . . . . . . . . . . . . . 718 + +26 The String and Character Functions . . . . . . . . . . . . . . . . 719 isalnum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720 isalpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720 iscntrl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721 isdigit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721 isgraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721 islower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721 isprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722 ispunct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722 isspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722 isupper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 isxdigit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 memchr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 memcmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 memcpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 memmove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 memset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 strcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 strchr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 strcmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 strcoll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 strcpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 strcspn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 strerror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 strlen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 +C o n t e n t s xxi + + +strncat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 strncmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 strncpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 strpbrk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 strrchr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 strspn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730 strstr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730 strtok . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730 strxfrm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 tolower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 toupper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 + +27 The Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . 733 acos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 asin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 atan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 atan2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 ceil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 cos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 cosh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 exp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 fabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 fmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 frexp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 ldexp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738 log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738 log10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738 modf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 pow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 sin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 sinh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740 sqrt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740 tan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740 tanh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741 + +28 Time, Date, and Localization Functions . . . . . . . . . . . . . 743 asctime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744 clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 ctime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 difftime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 gmtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 localeconv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 +xxii C + + : T h e C o m p l e t e R e f e r e n c e + + +localtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 mktime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 setlocale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 strftime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750 + +29 The Dynamic Allocation Functions . . . . . . . . . . . . . . . . . 753 calloc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754 free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754 malloc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755 realloc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755 + +30 Utility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757 abort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758 abs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758 assert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759 atexit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759 atof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759 atoi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760 atol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760 bsearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760 div . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761 exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762 getenv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762 labs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762 ldiv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763 longjmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763 mblen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763 mbstowcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764 mbtowc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764 qsort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764 raise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765 rand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766 setjmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766 signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766 srand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767 strtod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767 strtol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768 strtoul . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768 system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769 va_arg, va_start, and va_end . . . . . . . . . . . . . . . . . . . . . . . . . 769 wcstombs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770 wctomb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770 +C o n t e n t s xxiii + + +31 The Wide-Character Functions . . . . . . . . . . . . . . . . . . . . . 771 The Wide-Character Classification Functions . . . . . . . . . . . . . . . . . . 772 The Wide-Character I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 775 The Wide-Character String Functions . . . . . . . . . . . . . . . . . . . . . . . . 775 Wide-Character String Conversion Functions . . . . . . . . . . . . . . . . . . 775 Wide-Character Array Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 Multibyte/Wide-Character Conversion Functions . . . . . . . . . . . . . 779 + +Part IV +The Standard C++ Class Library + +32 The Standard C++ I/O Classes . . . . . . . . . . . . . . . . . . . . 783 The I/O Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784 The I/O Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786 The Format Flags and I/O Manipulators . . . . . . . . . . . . . . . . . . . . . . 787 Several Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789 +The streamsize and streamoff Types . . . . . . . . . . . . . . . . . . 789 The streampos and wstreampos Types . . . . . . . . . . . . . . . . 789 The pos_type and off_type Types . . . . . . . . . . . . . . . . . . . . . 789 The openmode Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789 The iostate Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790 The seekdir type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790 The failure Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790 +Overload << and >> Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790 The General-Purpose I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . . 791 bad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 +clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 eof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 fail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793 flush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793 fstream, ifstream, and ofstream . . . . . . . . . . . . . . . . . . . . . . . 793 gcount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794 get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794 getline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 good . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796 ignore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796 open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796 peek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798 +xxiv C + + : T h e C o m p l e t e R e f e r e n c e + + +put . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798 putback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798 rdstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798 read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799 readsome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799 seekg and seekp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800 setf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801 setstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801 str . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802 stringstream, istringstream, ostringstream . . . . . . . . . . . . . 802 sync_with_stdio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803 tellg and tellp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804 unsetf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804 width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805 + +33 The STL Container Classes . . . . . . . . . . . . . . . . . . . . . . . . 807 The Container Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808 +bitset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810 deque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812 list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815 map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818 multimap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820 multiset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823 queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825 priority_queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826 set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827 stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 830 + +34 The STL Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835 adjacent_find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836 binary_search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836 copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 copy_backward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 count_if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838 equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838 equal_range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838 fill and fill_n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 find_end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 find_first_of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 +C o n t e n t s xxv + + +find_if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840 for_each . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840 generate and generate_n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840 includes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841 inplace_merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841 iter_swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841 lexicographical_compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842 lower_bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842 make_heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842 max . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843 max_element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843 merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843 min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844 min_element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844 mismatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844 next_permutation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845 nth_element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845 partial_sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845 partial_sort_copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846 partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846 pop_heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846 prev_permutation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847 push_heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847 random_shuffle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847 remove, remove_if, remove_copy, and remove_copy_if . . 848 replace, replace_copy, replace_if, and replace_copy_if . . . 848 reverse and reverse_copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849 rotate and rotate_copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849 search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850 search_n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850 set_difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850 set_intersection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 851 set_symmetric_difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 851 set_union . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 852 sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 852 sort_heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 852 stable_partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853 stable_sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853 swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853 swap_ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854 transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854 unique and unique_copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854 upper_bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855 +xxvi C + + : T h e C o m p l e t e R e f e r e n c e + + +35 STL Iterators, Allocators, and Function Objects . . . . . . 857 Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858 +The Basic Iterator Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858 The Low-Level Iterator Classes . . . . . . . . . . . . . . . . . . . . . . . 859 The Predefined Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860 Two Iterator Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 868 +Function Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 868 Function Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869 Binders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870 Negators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871 Adaptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 872 Allocators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875 + +36 The String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877 The basic_string Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878 The char_traits Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890 + +37 The Numeric Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893 The complex Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894 The valarray Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898 +The slice and gslice Classes . . . . . . . . . . . . . . . . . . . . . . . . . . 913 The Helper Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916 +The Numeric Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916 accumulate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916 adjacent_difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917 inner_product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918 partial_sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 919 + +38 Exception Handling and Miscellaneous Classes . . . . . . 921 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 922 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 922 + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923 auto_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 924 The pair Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926 Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927 Other Classes of Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927 + +Part V Applying C++ + +39 Integrating New Classes: A Custom String Class . . . . . 931 The StrType Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 932 +C o n t e n t s xxvii + + +The Constructor and Destructor Functions . . . . . . . . . . . . . . . . . . . . 934 I/O on Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 935 The Assignment Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937 Concatenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938 Substring Subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941 The Relational Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943 Miscellaneous String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 944 The Entire StrType Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945 Using the StrType Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954 Creating and Integrating New Types in General . . . . . . . . . . . . . . . 957 A Challenge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957 + +40 An Object-Oriented Expression Parser . . . . . . . . . . . . . . 959 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960 Parsing Expressions: The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 961 Parsing an Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962 The Parser Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964 Dissecting an Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965 A Simple Expression Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967 +Understanding the Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . 973 Adding Variables to the Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974 Syntax Checking in a Recursive-Descent Parser . . . . . . . . . . . . . . . . 984 Building a Generic Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 985 Some Things to Try . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 + +Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995 + + + + + + + + + +This page intentionally left blank. + + + + + + + + + +Preface + + + + + +This is the third edition of C++: The Complete Reference. In the years that have transpired since the second edition, C++ has undergone many changes. Perhaps the most important is that it is now a standardized language. In November of 1997, the ANSI/ISO committee charged with the task of standardizing C++, passed out of committee an International Standard for C++. This event marked the end of a very long, and at times contentious, process. As a member of the ANSI/ISO C++ committee, I watched the progress of the emerging standard, following each debate and argument. Near the end, there was a world-wide, daily dialogue, conducted via e-mail, in which the pros and cons of this or that issue were put forth, and finally resolved. While the process was longer and more exhausting than anyone at first envisioned, the result was worth the trouble. We now have a standard for what is, without question, the most important programming language in the world. +During standardization, several new features were added to C++. Some are relatively small. Others, like the STL (Standard Template Library) have ramifications that will affect the course of programming for years to come. The net effect of the additions was that the scope and range of the language were greatly expanded. For example, because of the addition of the numerics library, C++ can be more conveniently used for numeric processing. Of course, the information contained in this edition + + + + + + + + +xxix +xxx C + + : T h e C o m p l e t e R e f e r e n c e + + +reflects the International Standard for C++ defined by the ANSI/ISO committee, including its new features. + + +What's New in the Third Edition +The third edition of C++: The Complete Reference is greatly expanded beyond its predecessor. In fact, the length of the book has nearly doubled! The main reason for this is that the third edition now includes comprehensive coverage of both the standard function library and the standard class library. Neither of these were sufficiently well defined when the second edition was being prepared to warrant inclusion. With the standardization of C++ being complete, these topics can finally be added. +Aside from these major additions, the third edition also includes a substantial amount of new material scattered throughout the book. Most is the result of features that have been added to C++ since the previous edition was prepared. New or expanded coverage includes the following topics: the Standard Template Library, run-time type ID (RTTI), the new casting operators, new features of templates, namespaces, new-style headers, and the modern-style I/O system. Also, some fundamental changes to the way new and delete are implemented are described and several new keywords are discussed. +Frankly, if you have not taken a close look at C++ for the past few years, you will be surprised at how much it has grown and how many new features have been added. It's not the same old C++ that you learned years ago. + + +What's Inside +This books covers in detail all aspects of the C++ language, including its foundation: C. The book is divided into these five parts: + + The C Subset — The foundation of C++ The C++ language + The Standard Function Library The Standard Class Library + Sample C++ applications + +Part One provides a comprehensive discussion of the C subset of C++. As most readers will know, C is the foundation upon which C++ was built. It is the C subset that defines the bedrock features of C++, including such things as for loops and if statements. It also defines the essential nature of C++'s block structure, pointers, and functions. Since many readers are already familiar with and proficient in C, discussing the C subset separately in Part One prevents the knowledgeable C programmer from having to "wade through" reams of information he or she already knows. Instead, the +P r e f a c e xxxi + + +experienced C programmer can simply turn to the sections of this book that cover the C++-specific features. +Part Two discusses in detail the extensions and enhancements to C added by C++. These include its object-oriented features such as classes, constructors, destructors, and templates. Thus, Part Two covers those constructs that "make C++, C++." +Part Three describes the standard function library and Part Four examines the standard class library, including the STL (Standard Template Library). Part Five shows two practical examples of applying C++ and object-oriented programming. + + +A Book for All Programmers +This C++ reference is designed for all C++ programmers, regardless of their experience level. It does assume, however, a reader able to create at least a simple program. If you are just learning C++, this book will make an excellent companion to any C++ tutorial and serve as a source of answers to your specific questions. Experienced C++ pros will find the coverage of the many new features added by the International Standard especially useful. + + +If You're Using Windows +If your computer uses Windows, then you have chosen the right language. C++ is completely at home with Windows programming. However, none of the programs in this book are Windows programs. Instead, they are console-based programs. The +reason for this is easy to understand: Windows programs are, by their nature, large and complex. The overhead required to create even a minimal Windows skeletal program is 50 to 70 lines of code. To write Windows programs that demonstrate the features of C++ would require hundreds of lines of code each. Put simply, Windows is not an appropriate environment in which to discuss the features of a programming language. However, you can still use a Windows-based compiler to compile the programs in this book because the compiler will automatically create a console session in which to execute your program. + + +Don't Forget: Code On The Web +Remember, the source code for all of the programs in this book is available +free-of-charge on the Web at http://www.osborne.com. Downloading this code prevents you from having to type in the examples. +xxxii C + + : T h e C o m p l e t e R e f e r e n c e + + +For Further Study +C++: The Complete Reference is your gateway into the "Herb Schildt" series of programming books. Here is a partial list of Schildt's other books. +If you want to learn more about C++, then you will find these books especially helpful. + +C++ From the Ground Up Teach Yourself C++ Expert C++ + +If you want to learn more about C, the foundation of C++, we recommend + +Teach Yourself C +C: The Complete Reference +The Annotated ANSI C Standard + +If you will be developing programs for the Web, you will want to read + +Java: The Complete Reference + +co-authored by Herbert Schildt and Patrick Naughton. +Finally, if you want to program for Windows, we recommend + +Windows 98 Programming From the Ground Up Windows NT 4 From the Ground Up +MFC Programming From the Ground Up + + +When you need solid answers, fast, turn to Herbert Schildt, the recognized authority on programming. +Part I The Foundation of C++: The C Subset + + + + + + + + + +his book divides the description of the C++ language into two parts. Part One discusses the C-like features of C++. +T +This is commonly referred to as the C subset of C++. Part Two describes those features specific to C++. Together, they describe the entire C++ language. +As you may know, C++ was built upon the foundation of C. In fact, C++ includes the entire C language, and (with minor exceptions) all C programs are also C++ programs. When C++ was invented, the C language was used as the starting point. To C were added several new features and extensions designed to + + +1 +2 C + + : T h e C o m p l e t e R e f e r e n c e + + +support object-oriented programming (OOP). However, the C-like aspects of C++ were never abandoned, and the ANSI/ISO C standard is a base document for the International Standard for C++. Thus, an understanding of C++ implies an understanding of C. +In a book such as this Complete Reference, dividing the C++ language into two pieces—the C foundation and the C++-specific features—achieves three major benefits: + +1. The dividing line between C and C++ is clearly delineated. +2. Readers already familiar with C can easily find the C++-specific information. +3. It provides a convenient place in which to discuss those features of C++ that relate mostly to the C subset. + +Understanding the dividing line between C and C++ is important because both are widely used languages and it is very likely that you will be called upon to write or maintain both C and C++ code. When working on C code, you need to know where C ends and C++ begins. Many C++ programmers will, from time to time, be required to write code that is limited to the "C subset." This will be especially true for embedded systems programming and the maintenance of existing applications. Knowing the difference between C and C++ is simply part of being a top-notch professional C++ programmer. +A clear understanding of C is also valuable when converting C code into C++. To do this in a professional manner, a solid knowledge of C is required. For example, without a thorough understanding of the C I/O system, it is not possible to efficiently convert an I/O-intensive C program into C++. +Many readers already know C. Covering the C-like features of C++ in their own section makes it easier for the experienced C programmer to quickly and easily find information about C++ without having to wade through reams of information that he or she already knows. Of course, throughout Part One, any minor differences between C and C++ are noted. Also, separating the C foundation from the more advanced, object-oriented features of C++ makes it possible to tightly focus on those advanced features because all of the basics will have already been discussed. +Although C++ contains the entire C language, not all of the features provided by the C language are commonly used when writing "C++-style" programs. For example, the C I/O system is still available to the C++ programmer even though C++ defines its own, object-oriented version. The preprocessor is another example. The preprocessor is very important to C, but less so to C++. Discussing several of the "C-only" features in Part One prevents them from cluttering up the remainder of the book. + + +Remember + + + +Note + +The C subset described in Part One constitutes the core of C++ and the foundation uponwhichC++'sobject-orientedfeaturesarebuilt.Allthefeaturesdescribedhere are part of C++ and available for your use. + +Part One of this book is adapted from my book C: The Complete Reference (Osborne/McGraw-Hill). If you are particularly interested in C, you will find this book helpful. + +C++ + + + + +Chapter 1 An Overview of C + + + + + + + + + + + + + + +3 +4 C + + : T h e C o m p l e t e R e f e r e n c e + + +o understand C++ is to understand the forces that drove its creation, the ideas that shaped it, and the legacy it inherits. Thus, the story of C++ begins with C. This chapter presents an overview of the C programming language, its origins, its +T +uses, and its underlying philosophy. Since C++ is built upon C, this chapter provides an important historical perspective on the roots of C++. Much of what makes C++ what it is had its genesis in the C language. + + +The Origins of C +C was invented and first implemented by Dennis Ritchie on a DEC PDP-11 that used the Unix operating system. C is the result of a development process that started with an older language called BCPL. BCPL was developed by Martin Richards, and it influenced a language called B, which was invented by Ken Thompson. B led to the development of C in the 1970s. +For many years, the de facto standard for C was the version supplied with the Unix version 5 operating system. It was first described in The C Programming Language by Brian Kernighan and Dennis Ritchie (Englewood Cliffs, N.J.: Prentice-Hall, 1978). In the summer of 1983 a committee was established to create an ANSI (American National Standards Institute) standard that would define the C language once and for all. The standardization process took six years (much longer than anyone reasonably expected). The ANSI C standard was finally adopted in December 1989, with the first copies becoming available in early 1990. The standard was also adopted by ISO (International Standards Organization) and is now referred to as the ANSI/ISO C standard. For simplicity, this book will use the term Standard C when referring to the ANSI/ISO C standard. Today, all mainstream C/C++ compilers comply with Standard C. Standard C is the foundation upon which C++ is built. + + +C Is a Middle-Level Language +C is often called a middle-level computer language. This does not mean that C is less powerful, harder to use, or less developed than a high-level language such as BASIC or Pascal, nor does it imply that C has the cumbersome nature of assembly language +(and its associated troubles). Rather, C is thought of as a middle-level language because it combines the best elements of high-level languages with the control and flexibilityof assembly language. Table 1-1 shows how C fits into the spectrum of computer languages. +As a middle-level language, C allows the manipulation of bits, bytes, and addresses—the basic elements with which the computer functions. Despite this fact C code is also very portable. Portability means that it is easy to adapt software written +for one type of computer or operating system to another. For example, if you can easily convert a program written for DOS so that it runs under Windows, that program is portable. +C h a p t e r 1 : A n O v e r v i e w o f C 5 + + + + +Highest level + + + + + + + + + +Middle level + + + + + + +Lowest level + +Ada + +Modula-2 Pascal COBOL FORTRAN BASIC + +Java + +C++ C +FORTH + + +Macro-assembler + +Assembler + + + +Table 1-1. C's Place in the World of Programming Languages + + + +All high-level programming languages support the concept of data types. A data type defines a set of values that a variable can store along with a set of operations that can be performed on that variable. Common data types are integer, character, and real. Although C has five basic built-in data types, it is not a strongly typed language, as are Pascal and Ada. C permits almost all type conversions. For example, you may freely intermix character and integer types in an expression. +Unlike a high-level language, C performs almost no run-time error checking. For example, no check is performed to ensure that array boundaries are not overrun. These types of checks are the responsibility of the programmer. +In the same vein, C does not demand strict type compatibility between a parameter and an argument. As you may know from your other programming experience, a +high-level computer language will typically require that the type of an argument be (more or less) exactly the same type as the parameter that will receive the argument. However, such is not the case for C. Instead, C allows an argument to be of any type as long as it can be reasonably converted into the type of the parameter. Further, C provides all of the automatic conversions to accomplish this. +6 C + + : T h e C o m p l e t e R e f e r e n c e + + +C is special in that it allows the direct manipulation of bits, bytes, words, and pointers. This makes it well suited for system-level programming, where these operations are common. +Another important aspect of C is that it has only 32 keywords (27 from the Kernighan and Ritchie de facto standard, and five added by the ANSI standardization committee), which are the commands that make up the C language. High-level languages typically have several times more keywords. As a comparison, consider that most versions of BASIC have well over 100 keywords! + + +C Is a Structured Language +In your previous programming experience, you may have heard the term block-structured applied to a computer language. Although the term block-structured language does not strictly apply to C, C is commonly referred to simply as a structured language. It has many similarities to other structured languages, such as ALGOL, Pascal, and Modula-2. + + +Note + +ThereasonthatC(andC++)isnot,technically,ablock-structuredlanguageisthat block-structured languages permit procedures or functions to be declared inside other procedures or functions. Since C does not allow the creation of functions within functions, it cannot formally be called block-structured. + + +The distinguishing feature of a structured language is compartmentalization of code and data. This is the ability of a language to section off and hide from the rest of the program all information and instructions necessary to perform a specific task. One way that you achieve compartmentalization is by using subroutines that employ local (temporary) variables. By using local variables, you can write subroutines so that the events that occur within them cause no side effects in other parts of the program. This capability makes it very easy for programs to share sections of code. If you develop compartmentalized functions, you only need to know what a function does, not how it does it. Remember, excessive use of global variables (variables known throughout the entire program) may allow bugs to creep into a program by allowing unwanted side effects. (Anyone who has programmed in standard BASIC is well aware of this problem.) + + +Note + +The concept of compartmentalization is greatly expanded by C++. Specifically, in C++, one part of your program may tightly control which other parts of your program are allowed access. + + +A structured language allows you a variety of programming possibilities. It directly supports several loop constructs, such as while, do-while, and for. In a structured language, the use of goto is either prohibited or discouraged and is not the common form of program control (as is the case in standard BASIC and traditional +C h a p t e r 1 : A n O v e r v i e w o f C 7 + + +FORTRAN, for example). A structured language allows you to place statements anywhere on a line and does not require a strict field concept (as some older FORTRANs do). +Here are some examples of structured and nonstructured languages: + + +Nonstructured + +FORTRAN BASIC +COBOL + +Structured + +Pascal Ada Java C++ C +Modula-2 + + +Structured languages tend to be modern. In fact, a mark of an old computer language is that it is nonstructured. Today, few programmers would consider using a nonstructured language for serious, new programs. + + +Note + +New versions of many older languages have attempted to add structured elements. BASIC is an example. However, the shortcomings of these languages can never be fully mitigated because they were not designed with structured features from the beginning. + + +C's main structural component is the function—C's stand-alone subroutine. In C, functions are the building blocks in which all program activity occurs. They let you define and code separately the separate tasks in a program, thus allowing your programs to be modular. After you have created a function, you can rely on it to work properly in various situations without creating side effects in other parts of the program. Being able to create stand-alone functions is extremely critical in larger projects where one programmer's code must not accidentally affect another's. +Another way to structure and compartmentalize code in C is through the use of code blocks. A code block is a logically connected group of program statements that is treated as a unit. In C, you create a code block by placing a sequence of statements between opening and closing curly braces. In this example, + + + + +if (x < 10) { +printf("Too low, try again.\n"); scanf("%d", &x); +} +8 C + + : T h e C o m p l e t e R e f e r e n c e + + +the two statements after the if and between the curly braces are both executed if x is less than 10. These two statements together with the braces represent a code block. They are a logical unit: One of the statements cannot execute without the other executing also. Code blocks allow many algorithms to be implemented with clarity, elegance, and efficiency. Moreover, they help the programmer better conceptualize the true nature of the algorithm being implemented. + + +C Is a Programmer's Language +Surprisingly, not all computer programming languages are for programmers. Consider the classic examples of nonprogrammer languages, COBOL and BASIC. COBOL was designed not to better the programmer's lot, nor to improve the reliability of the code produced, nor even to improve the speed with which code can be written. Rather, COBOL was designed, in part, to enable nonprogrammers to read and presumably (however unlikely) to understand the program. BASIC was created essentially to allow nonprogrammers to program a computer to solve relatively simple problems. +In contrast, C was created, influenced, and field-tested by working programmers. The end result is that C gives the programmer what the programmer wants: few restrictions, few complaints, block structures, stand-alone functions, and a compact set of keywords. By using C, you can nearly achieve the efficiency of assembly code combined with the structure of ALGOL or Modula-2. It's no wonder that C and C++ are easily the most popular languages among topflight professional programmers. +The fact that you can often use C in place of assembly language is a major factor in its popularity among programmers. Assembly language uses a symbolic representation of the actual binary code that the computer executes directly. Each assembly-language operation maps into a single task for the computer to perform. Although assembly language gives programmers the potential to accomplish tasks with maximum flexibility and efficiency, it is notoriously difficult to work with when developing and debugging a program. Furthermore, since assembly language is unstructured, the final program tends to be spaghetti code—a tangled mess of jumps, calls, and indexes. This lack of structure makes assembly-language programs difficult to read, enhance, and maintain. Perhaps more important, assembly-language routines are not portable between machines with different central processing units (CPUs). +Initially,C was used for systems programming. A systems program forms a portion of the operating system of the computer or its support utilities. For example, the following are usually called systems programs: + + Operating systems + + Interpreters + + Editors +C h a p t e r 1 : A n O v e r v i e w o f C 9 + + + Compilers + + File utilities + + Performance enhancers + + Real-time executives + +As C grew in popularity, many programmers began to use it to program all tasks because of its portability and efficiency—and because they liked it! At the time of its creation, C was a much longed-for, dramatic improvement in programming languages. Of course, C++ has carried on this tradition. +With the advent of C++, some thought that C as a distinct language would die out. Such has not been the case. First, not all programs require the application of the object-oriented programming features provided by C++. For example, applications such as embedded systems are still typically programmed in C. Second, much of the world still runs on C code, and those programs will continue to be enhanced and maintained. While C's greatest legacy is as the foundation for C++, it will continue to be a vibrant, widely used language for many years to come. + + +The Form of a C Program +Table 1-2 lists the 32 keywords that, combined with the formal C syntax, form the C programming language. Of these, 27 were defined by the original version of C. These five were added by the ANSI C committee: enum, const, signed, void, and volatile. All are, of course, part of the C++ language. + + + + +auto double break else case enum char extern const float continue for default goto +do if + +int long register return short signed sizeof +static + +struct switch typedef union unsigned void volatile +while + + +Table 1-2. The 32 Keywords Defined by Standard C +10 C + + : T h e C o m p l e t e R e f e r e n c e + + +In addition, many compilers have added several keywords that better exploit their operating environment. For example, several compilers include keywords to manage the memory organization of the 8086 family of processors, to support inter-language programming, and to access interrupts. Here is a list of some commonly used extended keywords: + + +asm _cs _ss cdecl +interrupt near + +_ds _es far huge +pascal + + +Your compiler may also support other extensions that help it take better advantage of its specific environment. +All C (and C++) keywords are lowercase. Also, uppercase and lowercase are different: else is a keyword; ELSE is not. You may not use a keyword for any other purpose in a program—that is, you may not use it as a variable or function name. +All C programs consist of one or more functions. The only function that must be present is called main() , which is the first function called when program execution begins. In well-written C code, main() contains what is, in essence, an outline of what the program does. The outline is composed of function calls. Although main() is not a keyword, treat it as if it were. For example, don't try to use main() as the name of a variable because you will probably confuse the compiler. +The general form of a C program is illustrated in Figure 1-1, where f1() through fN() represent user-defined functions. + + +The Library and Linking +Technically speaking, you can create a useful, functional C or C++ program that consists solely of the statements that you actually created. However, this is quite rare because neither C nor C++ provides any keywords that perform such things as input/output (I/O) operations, high-level mathematical computations, or character handling. As a result, most programs include calls to various functions contained in the standard library. +All C++ compilers come with a standard library of functions that perform most commonly needed tasks. Standard C++ specifies a minimal set of functions that will be supported by all compilers. However, your compiler will probably contain many other functions. For example, the standard library does not define any graphics functions, but your compiler will probably include some. +The C++ standard library can be divided into two halves: the standard function library and the class library. The standard function library is inherited from the C language. C++ supports the entire function library defined by Standard C. Thus, all of the standard C functions are available for use in C++ programs that you write. +C h a p t e r 1 : A n O v e r v i e w o f C 11 + + + + +global declarations + +return-type main(parameter list) { +statement sequence } +return-type f1(parameter list) { +statement sequence } +return-type f2(parameter list) { +statement sequence } +. + +. . +return-type fN(parameter list) { +statement sequence +} + + + +Figure 1-1. The general form of a C program. + + +In addition to the standard function library, C++ also defines its own class library. The class library provides object-oriented routines that your programs may use. It also defines the Standard Template Library (STL), which offers off-the-shelf solutions to a variety of programming problems. However, both the class library and the STL are discussed later in this book. In Part One, only the standard function library is used, since it is the only one that is also defined by C. +The implementors of your compiler have already written most of the general-purpose functions that you will use. When you call a function that is not part of your program, the compiler "remembers" its name. Later, the linker combines the code you +12 C + + : T h e C o m p l e t e R e f e r e n c e + + +wrote with the object code already found in the standard library. This process is called linking. Some compilers have their own linker, while others use the standard linker supplied by the operating system. +The functions in the library are in relocatable format. This means that the memory addresses for the various machine-code instructions have not been absolutely defined—only offset information has been kept. When your program links with the functions in the standard library, these memory offsets are used to create the actual addresses used. There are several technical manuals and books that explain this process in more detail. However, you do not need any further explanation of the relocation process to program in C++. +Many of the functions that you will need as you write programs are in the standard library. They act as building blocks that you combine. If you write a function that you will use again and again, you can place it into a library, too. + + +Separate Compilation +Most short programs are completely contained within one source file. However, as a program's length grows, so does its compile time (and long compile times make for short tempers). Hence, C/C++ allows a program to be contained in many files and lets you compile each file separately. Once you have compiled all files, they are linked, along with any library routines, to form the complete object code. The advantage of separate compilation is that if you change the code of one file, you do not need to recompile the entire program. On all but the simplest projects, this saves a substantial amount of time. The user documentation to your C/C++ compiler will contain instructions for compiling multifile programs. + + +Understanding the .C and .CPP File Extensions The programs in Part One of this book are, of course, valid C++ programs and can be compiled using any modern C++ compiler. They are also valid C programs and can be compiled using a C compiler. Thus, if you are called upon to write C programs, the ones shown in Part One qualify as examples. Traditionally, C programs use the file extension .C, and C++ programs use the extension .CPP. A C++ compiler uses the file extension to determine what type of program it is compiling. This is important because the compiler assumes that any program using the .C extension is a C program and that any file using .CPP is a C++ program. Unless explicitly noted otherwise, you may use either extension for the programs in Part One. However, the programs in the rest of this book will require .CPP. +One last point: Although C is a subset of C++, there are a few minor differences between the two languages, and in a few cases, you may need to compile a C program as a C program (using the .C extension). Any instances of this will be noted. + +C++ + + + + +Chapter 2 Expressions + + + + + + + + + + + + + + +13 +14 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter examines the most fundamental element of the C (as well as the C++) language: the expression. As you will see, expressions in C/C++ are substantially more general and more powerful than in most other computer languages. +T +Expressions are formed from these atomic elements: data and operators. Data may be represented either by variables or by constants. Like most other computer languages, C/C++ supports a number of different types of data. It also provides a wide variety of operators. + + +The Five Basic Data Types +There are five atomic data types in C: character, integer, floating-point, double floating-point, and valueless (char, int, float, double, and void, respectively). As you +will see, all other data types in C are based upon one of these types. The size and range of these data types may vary between processor types and compilers. However, in all cases a character is 1 byte. The size of an integer is usually the same as the word length of the execution environment of the program. For most 16-bit environments, such as DOS or Windows 3.1, an integer is 16 bits. For most 32-bit environments, such as Windows NT, an integer is 32 bits. However, you cannot make assumptions about +the size of an integer if you want your programs to be portable to the widest range of environments. It is important to understand that both C and C++ only stipulate +the minimal range of each data type, not its size in bytes. + + +Note + +To the five basic data types defined by C, C++ adds two more: bool and wchar_t. These are discussed in Part Two. + + +The exact format of floating-point values will depend upon how they are implemented. Integers will generally correspond to the natural size of a word on the host computer. Values of type char are generally used to hold values defined by the ASCII character set. Values outside that range may be handled differently by different compilers. +The range of float and double will depend upon the method used to represent the floating-point numbers. Whatever the method, the range is quite large. Standard C specifies that the minimum range for a floating-point value is 1E−37 to 1E+37. The minimum number of digits of precision for each floating-point type is shown in Table 2-1. + + +Note + +StandardC++doesnotspecifyaminimumsizeorrangeforthebasictypes.Instead, it simply states that they must meet certain requirements. For example, Standard C++ states that an int will “have the natural size suggested by the architecture of the execution environment." In all cases, this will meet or exceed +the minimum ranges specified by Standard C. Each C++ compiler specifies the size and range of the basic types in the header . +C h a p t e r 2 : E x p r e s s i o n s 15 + + + + +Type + +char unsigned char signed char int +unsigned int signed int short int +unsigned short int signed short int long int + +signed long int unsigned long int float +double +long double + +Typical Size in Bits + +8 8 8 +16 or 32 16 or 32 16 or 32 16 +16 16 32 + +32 32 32 64 +80 + +Minimal Range + +−127 to 127 0 to 255 −127 to 127 +−32,767 to 32,767 0 to 65,535 +same as int −32,767 to 32,767 0 to 65,535 +same as short int +−2,147,483,647 to 2,147,483,647 +same as long int 0 to 4,294,967,295 +Six digits of precision Ten digits of precision +Ten digits of precision + + +Table 2-1. All Data Types Defined by the ANSI/ISO C Standard + + +The type void either explicitly declares a function as returning no value or creates generic pointers. Both of these uses are discussed in subsequent chapters. + + +Modifying the Basic Types +Except for type void, the basic data types may have various modifiers preceding them. You use a modifier to alter the meaning of the base type to fit various situations more precisely. The list of modifiers is shown here: + +signed unsigned long short +16 C + + : T h e C o m p l e t e R e f e r e n c e + + +You can apply the modifiers signed, short, long, and unsigned to integer base types. You can apply unsigned and signed to characters. You may also apply long to double. Table 2-1 shows all valid data type combinations, along with their minimal ranges and approximate bit widths. (These values also apply to a typical C++ implementation.) Remember, the table shows the minimum range that these types will have as specified by Standard C/C++, not their typical range. For example, on computers that use two's complement arithmetic (which is nearly all), an integer will have a range of at least 32,767 to –32,768. +The use of signed on integers is allowed, but redundant because the default integer declaration assumes a signed number. The most important use of signed is to modify char in implementations in which char is unsigned by default. +The difference between signed and unsigned integers is in the way that the high-order bit of the integer is interpreted. If you specify a signed integer, the compiler generates code that assumes that the high-order bit of an integer is to be used as a sign flag. If the sign flag is 0, the number is positive; if it is 1, the number is negative. +In general, negative numbers are represented using the two's complement approach, which reverses all bits in the number (except the sign flag), adds 1 to this number, and sets the sign flag to 1. +Signed integers are important for a great many algorithms, but they only have half the absolute magnitude of their unsigned relatives. For example, here is 32,767: + +0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + +If the high-order bit were set to 1, the number would be interpreted as −1. However, if you declare this to be an unsigned int, the number becomes 65,535 when the high-order bit is set to 1. + + +Identifier Names +In C/C++, the names of variables, functions, labels, and various other user-defined objects are called identifiers. These identifiers can vary from one to several characters. The first character must be a letter or an underscore, and subsequent characters must be either letters, digits, or underscores. Here are some correct and incorrect identifier names: + + +Correct + +Count test23 +high_balance + +Incorrect + +1count hi!there +high...balance +C h a p t e r 2 : E x p r e s s i o n s 17 + + +In C, identifiers may be of any length. However, not all characters will necessarily be significant. If the identifier will be involved in an external link process, then at least the first six characters will be significant. These identifiers, called external names, include function names and global variables that are shared between files. If the identifier is not used in an external link process, then at least the first 31 characters will be significant. This type of identifier is called an internal name and includes the names of local variables, for example. In C++, there is no limit to the length of an identifier, and at least the first 1,024 characters are significant. This difference may +be important if you are converting a program from C to C++. +In an identifier, upper- and lowercase are treated as distinct. Hence, count, Count, and COUNT are three separate identifiers. +An identifier cannot be the same as a C or C++ keyword, and should not have the same name as functions that are in the C or C++ library. + + +Variables +As you probably know, a variable is a named location in memory that is used to hold a value that may be modified by the program. All variables must be declared before they can be used. The general form of a declaration is + +type variable_list; + +Here, type must be a valid data type plus any modifiers, and variable_list may consist of one or more identifier names separated by commas. Here are some declarations: + + +int i,j,l; short int si; +unsigned int ui; +double balance, profit, loss; + +Remember, in C/C++ the name of a variable has nothing to do with its type. + +Where Variables Are Declared +Variables will be declared in three basic places: inside functions, in the definition of function parameters, and outside of all functions. These are local variables, formal parameters, and global variables. + +Local Variables +Variables that are declared inside a function are called local variables. In some C/C++ literature, these variables are referred to as automatic variables. This book uses the more +18 C + + : T h e C o m p l e t e R e f e r e n c e + + +common term, local variable. Local variables may be referenced only by statements that are inside the block in which the variables are declared. In other words, local variables are not known outside their own code block. Remember, a block of code begins with an opening curly brace and terminates with a closing curly brace. +Local variables exist only while the block of code in which they are declared is executing. That is, a local variable is created upon entry into its block and destroyed upon exit. +The most common code block in which local variables are declared is the function. For example, consider the following two functions: + + +void func1(void) { +int x; + +x = 10; } + +void func2(void) { +int x; + +x = -199; } + +The integer variable x is declared twice, once in func1() and once in func2() . The x in func1() has no bearing on or relationship to the x in func2() . This is because each x is only known to the code within the same block as the variable declaration. +The C language contains the keyword auto, which you can use to declare local variables. However, since all nonglobal variables are, by default, assumed to be auto, this keyword is virtually never used. Hence, the examples in this book will not use it. (It has been said that auto was included in C to provide for source-level compatibility with its predecessor B. Further, auto is supported in C++ to provide compatibility with C.) +For reasons of convenience and tradition, most programmers declare all the variables used by a function immediately after the function's opening curly brace +and before any other statements. However, you may declare local variables within any code block. The block defined by a function is simply a special case. For example, + +void f(void) { +int t; +C h a p t e r 2 : E x p r e s s i o n s 19 + + + +scanf("%d%*c", &t); + + +if(t==1) { +char s[80]; + + +/* this is created only upon +entry into this block */ + +printf("Enter name:"); gets(s); +/* do something ... */ } +} + + +Here, the local variable s is created upon entry into the if code block and destroyed upon exit. Furthermore, s is known only within the if block and may not be referenced elsewhere—even in other parts of the function that contains it. +One advantage of declaring a local variable within a conditional block is that memory for the variable will only be allocated if needed. This is because local variables do not come into existence until the block in which they are declared is entered. You might need to worry about this when producing code for dedicated controllers (like a garage door opener that responds to a digital security code) in which RAM is in short supply, for example. +Declaring variables within the block of code that uses them also helps prevent unwanted side effects. Since the variable does not exist outside the block in which it is declared, it cannot be accidentally altered. +There is an important difference between C and C++ as to where you can declare local variables. In C, you must declare all local variables at the start of the block in which they are defined, prior to any "action" statements. For example, the following function is in error if compiled by a C compiler. + + +/* This function is in error if compiled as a C program, but perfectly acceptable if compiled as a C++ program. +*/ +void f(void) { +int i; + +i = 10; + +int j; /* this line will cause an error */ +20 C + + : T h e C o m p l e t e R e f e r e n c e + + + +j = 20; } + +However, in C++, this function is perfectly valid because you can define local variables at any point in your program. (The topic of C++ variable declaration is discussed in depth in Part Two.) +Because local variables are created and destroyed with each entry and exit from the block in which they are declared, their content is lost once the block is left. This is especially important to remember when calling a function. When a function is called, its local variables are created, and upon its return they are destroyed. This means that local variables cannot retain their values between calls. (However, you can direct the compiler to retain their values by using the static modifier.) +Unless otherwise specified, local variables are stored on the stack. The fact that the stack is a dynamic and changing region of memory explains why local variables cannot, in general, hold their values between function calls. +You can initialize a local variable to some known value. This value will be assigned to the variable each time the block of code in which it is declared is entered. For example, thefollowing programprints thenumber 10 ten times: + +#include + +void f(void); + +int main(void) { +int i; + +for(i=0; i<10; i++) f(); + +return 0; } + +void f(void) { +int j = 10; + +printf("%d ", j); + +j++; /* this line has no lasting effect */ } +C h a p t e r 2 : E x p r e s s i o n s 21 + + +Formal Parameters +If a function is to use arguments, it must declare variables that will accept the values +of the arguments. These variables are called the formal parameters of the function. They behave like any other local variables inside the function. As shown in the following program fragment, their declarations occur after the function name and inside parentheses: + + +/* Return 1 if c is part of string s; 0 otherwise */ int is_in(char *s, char c) +{ +while(*s) +if(*s==c) return 1; else s++; + +return 0; } + +The function is_in() has two parameters: s and c. This function returns 1 if the character specified in c is contained within the string s; 0 if it is not. +You must specify the type of the formal parameters by declaring them as just shown. Then you may use them inside the function as normal local variables. Keep in mind that, as local variables, they are also dynamic and are destroyed upon exit from the function. +Aswithlocalvariables,youmaymakeassignmentstoafunction'sformalparameters orusetheminanyallowableexpression.Eventhoughthesevariablesreceivethevalueof theargumentspassedtothefunction,youcanusethemlikeanyotherlocalvariable. + +Global Variables +Unlike local variables, global variables are known throughout the program and may be used by any piece of code. Also, they will hold their value throughout the program's execution. You create global variables by declaring them outside of any function. Any expression may access them, regardless of what block of code that expression is in. +In the following program, the variable count has been declared outside of all functions. Although its declaration occurs before the main() function, you could have placed it anywhere before its first use as long as it was not in a function. However, it is usually best to declare global variables at the top of the program. + + +#include +int count; /* count is global */ + +void func1(void); +22 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void func2(void); + +int main(void) { +count = 100; func1(); + +return 0; } + +void func1(void) { +int temp; + +temp = count; func2(); +printf("count is %d", count); /* will print 100 */ } + +void func2(void) { +int count; + +for(count=1; count<10; count++) putchar('.'); +} + + +Look closely at this program. Notice that although neither main() nor func1() has declared the variable count, both may use it. func2() , however, has declared a local variable called count. When func2() refers to count, it refers to only its local variable, not the global one. If a global variable and a local variable have the same name, all references to that variable name inside the code block in which the local variable is declared will refer to that local variable and have no effect on the global variable. This can be convenient, but forgetting it can cause your program to act strangely, even though it looks correct. +Storage for global variables is in a fixed region of memory set aside for this purpose by the compiler. Global variables are helpful when many functions in your program use the same data. You should avoid using unnecessary global variables, however. They take up memory the entire time your programis executing, not just when they are needed. In addition, using a global where a local variable would do makes a function less general because it relies on something that must be defined outside itself. Finally, +using a large number of global variables can lead to programerrors because of unknown +C h a p t e r 2 : E x p r e s s i o n s 23 + + +and unwanted side effects. A major problemin developing large programs is the accidental changing of a variable's value because it was used elsewhere in the program. This can happen in C/C++ if you use too many global variables in your programs. + + +Access Modifiers +There are two modifiers that control how variables may be accessed or modified. These qualifiers are const and volatile. They must precede the type modifiers and the type names that they qualify. These modifiers are also referred to as cv-qualifiers. + +const +Variables of type const may not be changed by your program. (A const variable can be given an initial value, however.) The compiler is free to place variables of this type into read-only memory (ROM). For example, + + +const int a=10; + +creates an integer variable called a with an initial value of 10 that your program may not modify. However, you can use the variable a in other types of expressions. A const variable will receive its value either from an explicit initialization or by some hardware-dependent means. +The const qualifier can be used to protect the objects pointed to by the arguments to a function from being modified by that function. That is, when a pointer is passed to a function, that function can modify the actual variable pointed to by the pointer. However, if the pointer is specified as const in the parameter declaration, the function +code won't be able to modify what it points to. For example, the sp_to_dash() function in the following program prints a dash for each space in its string argument. That is, the string "this is a test" will be printed as "this-is-a-test". The use of const in the parameter declaration ensures that the code inside the function cannot modify the object pointed to by the parameter. + +#include + +void sp_to_dash(const char *str); + +int main(void) { +sp_to_dash("this is a test"); + +return 0; } +24 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void sp_to_dash(const char *str) { +while(*str) { +if(*str== ' ') printf("%c", '-'); else printf("%c", *str); +str++; } +} + + +If you had written sp_to_dash() in such a way that the string would be modified, it would not compile. For example, if you had coded sp_to_dash() as follows, you would receive a compile-time error: + + +/* This is wrong. */ +void sp_to_dash(const char *str) { +while(*str) { +if(*str==' ' ) *str = '-'; /* can't do this; str is const */ printf("%c", *str); +str++; } +} + +Many functions in the standard library use const in their parameter declarations. For example, the strlen() function has this prototype: + +size_t strlen(const char *str); + +Specifying str as const ensures that strlen() will not modify the string pointed to by str. In general, when a standard library function has no need to modify an object pointed to by a calling argument, it is declared as const. +You can also use const to verify that your program does not modify a variable. Remember, a variable of type const can be modified by something outside your program. For example, a hardware device may set its value. However, by declaring a variable as const, you can prove that any changes to that variable occur because of external events. + +volatile +The modifier volatile tells the compiler that a variable's value may be changed in ways not explicitly specified by the program. For example, a global variable's address may be passed to the operating system's clock routine and used to hold the real time of the +C h a p t e r 2 : E x p r e s s i o n s 25 + + +system. In this situation, the contents of the variable are altered without any explicit assignment statements in the program. This is important because most C/C++ compilers automatically optimize certain expressions by assuming that a variable's content is unchanging if it does not occur on the left side of an assignment statement; thus, it might not be reexamined each time it is referenced. Also, some compilers change the order of evaluation of an expression during the compilation process. The volatile modifier prevents these changes. +You can use const and volatile together. For example, if 0x30 is assumed to be the value of a port that is changed by external conditions only, the following declaration would prevent any possibility of accidental side effects: + + +const volatile char *port = (const volatile char *) 0x30; + + +Storage Class Specifiers +There are four storage class specifiers supported by C: + +extern static register auto + +These specifiers tell the compiler how to store the subsequent variable. The general form of a declaration that uses one is shown here. + +storage_specifier type var_name; + +Notice that the storage specifier precedes the rest of the variable declaration. + + +Note + +C++ adds another storage-class specifier called mutable, which is described in Part Two. + + +extern +Because C/C++ allows separate modules of a large program to be separately compiled and linked together, there must be some way of telling all the files about the global variables required by the program. Although C technically allows you to define a global variable more than once, it is not good practice (and may cause problems when linking). More importantly, in C++, you may define a global variable only once. How, then, do you inform all the files in your program about the global variables used by the program? +The solution to the problem is found in the distinction between the declaration +and the definition of a variable. A declaration declares the name and type of a variable. +26 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +File One + +int x, y; char ch; +int main(void) { +/* ... */ } + +void func1(void) { +x = 123; +} + +File Two + +extern int x, y; extern char ch; void func22(void) { +x = y / 10; } + +void func23(void) { +y = 10; +} + + + +Figure 2-1. Using global variables in separately compiled modules + + +A definition causes storage to be allocated for the variable. In most cases, variable declarations are also definitions. However, by preceding a variable name with the extern specifier, you can declare a variable without defining it. Thus, in a multifile program, you can declare all of your global variables in one file and use extern declarations in the other, as in Figure 2-1. +In File Two, the global variable list was copied from File One and the extern specifier was added to the declarations. The extern specifier tells the compiler that the variable types and names that follow it have been defined elsewhere. In other words, extern lets the compiler know what the types and names are for these global variables without actually creating storage for them again. When the linker links the two modules, all references to the external variables are resolved. +The extern keyword has this general form: + +extern var-list; + +There is another, optional use of extern that you may occasionally see. When you use a global variable inside a function, you can declare it as extern, as shown here: + +int first, last; /* global definition of first and last */ +C h a p t e r 2 : E x p r e s s i o n s 27 + + + + +main(void) { +extern int first; + +. . . +} + + + +/* optional use of the +extern declaration */ + + + +Although extern variable declarations as shown in this example are allowed, they are not necessary. If the compiler finds a variable that has not been declared within the current block, the compiler checks if it matches any of the variables declared within enclosing blocks. If it does not, the compiler then checks the global variables. If a match is found, the compiler assumes that the global variable is being referenced. +In C++, the extern specifier has another use, which is described in Part Two. + +static Variables +static variables are permanent variables within their own function or file. Unlike global +variables, they are not known outside their function or file, but they maintain their values between calls. This feature makes them useful when you write generalized functions and function libraries that other programmers may use. static has different effects upon local variables and global variables. + +static Local Variables +When you apply the static modifier to a local variable, the compiler creates permanent storage for it, much as it creates storage for a global variable. The key difference between a static local variable and a global variable is that the static local variable remains known only to the block in which it is declared. In simple terms, a static +local variable is a local variable that retains its value between function calls. +static local variables are very important to the creation of stand-alone functions because several types of routines must preserve a value between calls. If static variables were not allowed, globals would have to be used, opening the door to possible side effects. An example of a function that benefits from a static local variable is a number-series generator that produces a new value based on the previous one. You could use +a global variable to hold this value. However, each time the function is used in a program, you would have to declare that global variable and make sure that it did not conflict with any other global variables already in place. The better solution is to declare the variable that holds the generated number to be static, as in this program fragment: + +int series(void) +28 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +static int series_num; + +series_num = series_num+23; return series_num; +} + + +In this example, the variable series_num stays in existence between function calls, instead of coming and going the way a normal local variable would. This means that each call to series() can produce a new member in the series based on the preceding number without declaring that variable globally. +You can give a static local variable an initialization value. This value is assigned only once, at program start-up—not each time the block of code is entered, as with normal local variables. For example, this version of series() initializes series_num to 100: + +int series(void) { +static int series_num = 100; + +series_num = series_num+23; return series_num; +} + +As the function now stands, the series will always begin with the value 123. While this is acceptable for some applications, most series generators need to let the user specify the starting point. One way to give series_num a user-specified value is to make it a global variable and then let the user set its value. However, not defining series_num as global was the point of making it static. This leads to the second use of static. + +static Global Variables +Applying the specifier static to a global variable instructs the compiler to create a global variable that is known only to the file in which you declared it. This means +that even though the variable is global, routines in other files may have no knowledge of it or alter its contents directly, keeping it free from side effects. For the few situations where a local static cannot do the job, you can create a small file that contains only the functions that need the global static variable, separately compile that file, and use it without fear of side effects. +To illustrate a global static, the series generator example from the previous section is recoded so that a seed value initializes the series through a call to a second function called series_start() . The entire file containing series() , series_start() , and series_num is shown here: +C h a p t e r 2 : E x p r e s s i o n s 29 + + +/* This must all be in one file - preferably by itself. */ + +static int series_num; +void series_start(int seed); int series(void); + +int series(void) { +series_num = series_num+23; return series_num; +} + +/* initialize series_num */ void series_start(int seed) { +series_num = seed; } + +Calling series_start() with some known integer value initializes the series generator. After that, calls to series() generate the next element in the series. +To review: The names of local static variables are known only to the block of code in which they are declared; the names of global static variables are known only to the file in which they reside. If you place the series() and series_start() functions in a library, you can use the functions but cannot reference the variable series_num, which is hidden from the rest of the code in your program. In fact, you can even declare and use another variable called series_num in your program (in another file, of course). In essence, the static modifier permits variables that are known only to the functions that need them, without unwanted side effects. +static variables enable you to hide portions of your program from other portions. This can be a tremendous advantage when you are trying to manage a very large and complex program. + + +Note + +In C++, the preceding use of static is still supported, but deprecated. This means that it is not recommended for new code. Instead, you should use a namespace, which is described in Part Two. + + +register Variables +The register storage specifier originally applied only to variables of type int, char, or pointer types. However, in Standard C, register's definition has been broadened so that it applies to any type of variable. +Originally, the register specifier requested that the compiler keep the value of a variable in a register of the CPU rather than in memory, where normal variables are +30 C + + : T h e C o m p l e t e R e f e r e n c e + + +stored. This meant that operations on a register variable could occur much faster than on a normal variable because the register variable was actually held in the CPU and did not require a memory access to determine or modify its value. +Today, the definition of register has been greatly expanded and it now may be applied to any type of variable. Standard C simply states "that access to the object be as fast as possible." (Standard C++ states that register is a "hint to the implementation that the object so declared will be heavily used.") In practice, characters and integers are still stored in registers in the CPU. Larger objects like arrays obviously cannot be stored in a register, but they may still receive preferential treatment by the compiler. Depending upon the implementation of the C/C++ compiler and its operating environment, register variables may be handled in any way deemed fit by the compiler's implementor. In fact, it is technically permissible for a compiler to ignore the register specifier altogether and treat variables modified by it as if they weren't, but this is seldom done in practice. +You can only apply the register specifier to local variables and to the formal parameters in a function. Global register variables are not allowed. Here is an example that uses register variables. This function computes the result of M for integers: +e + + +int int_pwr(register int m, register int e) { +register int temp; + +temp = 1; + +for(; e; e--) temp = temp * m; return temp; +} + +In this example, e, m, and temp are declared as register variables because they are all used within the loop. The fact that register variables are optimized for speed makes them ideal for control of or use in loops. Generally, register variables are used where they will do the most good, which are often places where many references will be made to the same variable. This is important because you can declare any number of variables as being of type register, but not all will receive the same access speed optimization. +The number of register variables optimized for speed allowed within any one code block is determined by both the environment and the specific implementation of C/C++. You don't have to worry about declaring too many register variables because the compiler automatically transforms register variables into nonregister variables when the limit is reached. (This ensures portability of code across a broad line of processors.) +C h a p t e r 2 : E x p r e s s i o n s 31 + + +Usually at least two register variables of type char or int can actually be held in the registers of the CPU. Because environments vary widely, consult your compiler's user manual to determine if you can apply any other types of optimization options. +In C, you cannot find the address of a register variable using the & operator (discussed later in this chapter). This makes sense because a register variable might be stored in a register of the CPU, which is not usually addressable. But this restriction does not apply to C++. However, taking the address of a register variable in C++ may prevent it from being fully optimized. +Although the description of register has been broadened beyond its traditional meaning, in practice it still generally has a significant effect only with integer and character types. Thus, you should probably not count on substantial speed improvements for other variable types. + + +Variable Initializations +You can give variables a value as you declare them by placing an equal sign and a value after the variable name. The general form of initialization is + +type variable_name = value; + +Some examples are + +char ch = 'a'; int first = 0; +float balance = 123.23; + +Global and static local variables are initialized only at the start of the program. Local variables (excluding static local variables) are initialized each time the block in which they are declared is entered. Local variables that are not initialized have unknown values before the first assignment is made to them. Uninitialized global and static local variables are automatically set to zero. + + +Constants +Constants refer to fixed values that the program may not alter. Constants can be of any of the basic data types. The way each constant is represented depends upon its type. Constants are also called literals. +Character constants are enclosed between single quotes. For example 'a' and '%' are both character constants. Both C and C++ define wide characters (used mostly in +32 C + + : T h e C o m p l e t e R e f e r e n c e + + +non-English language environments), which are 16 bits long. To specify a wide character constant, precede the character with an L. For example, + + +wchar_t wc; wc = L'A'; + +Here, wc is assigned the wide-character constant equivalent of A. The type of wide characters is wchar_t. In C, this type is defined in a header file and is not a built-in type. In C++, wchar_t is built in. +Integer constants are specified as numbers without fractional components. For example, 10 and –100 are integer constants. Floating-point constants require the decimal point followed by the number's fractional component. For example, 11.123 is a floating-point constant. C/C++ also allows you to use scientific notation for floating-point numbers. +There are two floating-point types: float and double. There are also several variations of the basic types that you can generate using the type modifiers. By default, the compiler fits a numeric constant into the smallest compatible data type that will hold it. Therefore, assuming 16-bit integers, 10 is int by default, but 103,000 is a long. Even though the value 10 could fit into a character type, the compiler will not cross type boundaries. The only exception to the smallest type rule are floating-point constants, which are assumed to be doubles. +For most programs you will write, the compiler defaults are adequate. However, you can specify precisely the type of numeric constant you want by using a suffix. For floating-point types, if you follow the number with an F, the number is treated as a float. If you follow it with an L, the number becomes a long double. For integer types, the U suffix stands for unsigned and the L for long. Here are some examples: + + +Data type + +int long int +unsigned int float +double +long double + +Constant examples + +1 123 21000 −234 35000L −34L +10000U 987U 40000U 123.23F 4.34e−3F 123.23 1.0 −0.9876324 +1001.2L + + +Hexadecimal and Octal Constants +It is sometimes easier to use a number system based on 8 or 16 rather than 10 (our standard decimal system). The number system based on 8 is called octal and uses the +C h a p t e r 2 : E x p r e s s i o n s 33 + + +digits 0 through 7. In octal, the number 10 is the same as 8 in decimal. The base 16 number system is called hexadecimal and uses the digits 0 through 9 plus the letters A through F, which stand for 10, 11, 12, 13, 14, and 15, respectively. For example, the hexadecimal number 10 is 16 in decimal. Because these two number systems are +used frequently, C/C++ allows you to specify integer constants in hexadecimal or octal instead of decimal. A hexadecimal constant must consist of a 0x followed by the constant in hexadecimal form. An octal constant begins with a 0. Here are some examples: + + +int hex = 0x80; +int oct = 012; + +/* 128 in decimal */ +/* 10 in decimal */ + + +String Constants +C/C++ supports one other type of constant: the string. A string is a set of characters +enclosed in double quotes. For example, "this is a test" is a string. You have seen examples of strings in some of the printf() statements in the sample programs. Although C allows you to define string constants, it does not formally have a string data type. (C++ does define a string class, however.) +You must not confuse strings with characters. A single character constant is enclosed in single quotes, as in 'a'. However, "a" is a string containing only one letter. + + +Backslash Character Constants +Enclosing character constants in single quotes works for most printing characters. A few, however, such as the carriage return, are impossible to enter into a string from the keyboard. For this reason, C/C++ include the special backslash character constants shown in Table 2-2 so that you may easily enter these special characters as constants. These are also referred to as escape sequences. You should use the backslash codes instead of their ASCII equivalents to help ensure portability. +For example, the following program outputs a new line and a tab and then prints the string This is a test. + + +#include + +int main(void) { +printf("\n\tThis is a test."); + +return 0; } +34 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Code + +\b \f \n \r \t \" \' \0 \\ \v \a \? \N \xN + + +Table 2-2. + +Meaning + +Backspace Form feed New line Carriage return Horizontal tab Double quote Single quote Null +Backslash Vertical tab Alert +Question mark +Octal constant (where N is an octal constant) +Hexadecimal constant (where N is a hexadecimal constant) + + +Backslash Codes + + + + +Operators +C/C++ is very rich in built-in operators. In fact, it places more significance on operators than do most other computer languages. There are four main classes of operators: arithmetic, relational, logical, and bitwise. In addition, there are some special operators for particular tasks. + +The Assignment Operator +You can use the assignment operator within any valid expression. This is not the +case with most computer languages (including Pascal, BASIC, and FORTRAN), which treat the assignment operator as a special case statement. The general form of the assignment operator is + +variable_name = expression; +C h a p t e r 2 : E x p r e s s i o n s 35 + + +where an expression may be as simple as a single constant or as complex as you require. C/C++ uses a single equal sign to indicate assignment (unlike Pascal or Modula-2, which use the := construct). The target, or left part, of the assignment must be a variable or a pointer, not a function or a constant. +Frequently in literature on C/C++ and in compiler error messages you will see these two terms: lvalue and rvalue. Simply put, an lvalue is any object that can occur on the left side of an assignment statement. For all practical purposes, "lvalue" means "variable." The term rvalue refers to expressions on the right side of an assignment and simply means the value of an expression. + +Type Conversion in Assignments +When variables of one type are mixed with variables of another type, a type conversion will occur. In an assignment statement, the type conversion rule is easy: The value of the right side (expression side) of the assignment is converted to the type of the left side (target variable), as illustrated here: + + +int x; char ch; float f; + +void func(void) { +ch = x; /* line 1 */ x = f; /* line 2 */ f = ch; /* line 3 */ f = x; /* line 4 */ +} + +In line 1, the left high-order bits of the integer variable x are lopped off, leaving ch with the lower 8 bits. If x were between 255 and 0, ch and x would have identical values. Otherwise, the value of ch would reflect only the lower-order bits of x. In line 2, x will receive the nonfractional part of f. In line 3, f will convert the 8-bit integer value stored in ch to the same value in the floating-point format. This also happens in line 4, except that f will convert an integer value into floating-point format. +When converting from integers to characters and long integers to integers, the appropriate amount of high-order bits will be removed. In many 16-bit environments, this means that 8 bits will be lost when going from an integer to a character and 16 bits will be lost when going from a long integer to an integer. For 32-bit environments, 24 bits will be lost when converting from an integer to a character and 16 bits will be lost when converting from an integer to a short integer. +Table 2-3 summarizes the assignment type conversions. Remember that the conversion of an int to a float, or a float to a double, and so on, does not add any +36 C + + : T h e C o m p l e t e R e f e r e n c e + + +precision or accuracy. These kinds of conversions only change the form in which the value is represented. In addition, some compilers always treat a char variable as positive, no matter what value it has, when converting it to an int or float. Other compilers treat char variable values greater than 127 as negative numbers when converting. Generally speaking, you should use char variables for characters, and use ints, short ints, or signed chars when needed to avoid possible portability problems. +To use Table 2-3 to make a conversion not shown, simply convert one type at a time until you finish. For example, to convert from double to int, first convert from double to float and then from float to int. + +Multiple Assignments +C/C++ allows you to assign many variables the same value by using multiple assignments in a single statement. For example, this program fragment assigns x, y, and z the value 0: + + +x = y = z = 0; + + + + + +Target Type + +signed char char +char char char short int short int +int (16 bits) int (32 bits) int +float +double + +Expression Type + +char short int +int (16 bits) int (32 bits) long int +int (16 bits) int (32 bits) long int long int float double +long double + +Possible Info Loss + +If value > 127, target is negative High-order 8 bits +High-order 8 bits High-order 24 bits High-order 24 bits None +High-order 16 bits High-order 16 bits None +Fractional part and possibly more Precision, result rounded +Precision, result rounded + + +Table 2-3. The Outcome of Common Type Conversions +C h a p t e r 2 : E x p r e s s i o n s 37 + + +In professional programs, variables are frequently assigned common values using this method. + +Arithmetic Operators +Table 2-4 lists C/C++'s arithmetic operators. The operators +, −, *, and / work as they +do in most other computer languages. You can apply them to almost any built-in data type. When you apply / to an integer or character, any remainder will be truncated. For example, 5/2 will equal 2 in integer division. +The modulus operator % also works in C/C++ as it does in other languages, yielding the remainder of an integer division. However, you cannot use it on floating-point types. The following code fragment illustrates %: + + +int x, y; + +x = 5; y = 2; + + +printf("%d ", x/y); +printf("%d ", x%y); + +/* will display 2 */ +/* will display 1, the remainder of +the integer division */ + + +x = 1; y = 2; + +printf("%d %d", x/y, x%y); /* will display 0 1 */ + +The last line prints a 0 and a 1 because 1/2 in integer division is 0 with a remainder of 1. The unary minus multiplies its operand by –1. That is, any number preceded by a +minus sign switches its sign. + +Increment and Decrement +C/C++ includes two useful operators not generally found in other computer languages. These are the increment and decrement operators, ++ and −−. The operator ++ adds 1 to its operand, and −− subtracts one. In other words: + + +x = x+1; + +is the same as + +++x; + +and +38 C + + : T h e C o m p l e t e R e f e r e n c e + + +x = x-1; + +is the same as + +x--; + +Both the increment and decrement operators may either precede (prefix) or follow (postfix) the operand. For example, + + +x = x+1; + +can be written + +++x; + +or + +x++; + +There is, however, a difference between the prefix and postfix forms when you use these operators in an expression. When an increment or decrement operator precedes its operand, the increment or decrement operation is performed before obtaining the value of the operand for use in the expression. If the operator follows its operand, + + + + + +Operator + +− + * / % +– – ++ + +Table 2-4. + +Action + +Subtraction, also unary minus Addition +Multiplication Division Modulus Decrement Increment + +Arithmetic Operators +C h a p t e r 2 : E x p r e s s i o n s 39 + + +the value of the operand is obtained before incrementing or decrementing it. For instance, + + +x = 10; y = ++x; + +sets y to 11. However, if you write the code as + +x = 10; y = x++; + +y is set to 10. Either way, x is set to 11; the difference is in when it happens. +Most C/C++ compilers produce very fast, efficient object code for increment and decrement operations—code that is better than that generated by using the equivalent assignment statement. For this reason, you should use the increment and decrement operators when you can. +Here is the precedence of the arithmetic operators: + + +highest + + + +lowest + +++ – – +– (unary minus) * / % ++ – + + +Operators on the same level of precedence are evaluated by the compiler from left to right. Of course, you can use parentheses to alter the order of evaluation. C/C++ treats parentheses in the same way as virtually all other computer languages. Parentheses force an operation, or set of operations, to have a higher level of precedence. + +Relational and Logical Operators +In the term relational operator, relational refers to the relationships that values can have with one another. In the term logical operator, logical refers to the ways these relationships can be connected. Because the relational and logical operators often work together, they are discussed together here. +The idea of true and false underlies the concepts of relational and logical operators. In C, true is any value other than zero. False is zero. Expressions that use relational or logical operators return 0 for false and 1 for true. +C++ fully supports the zero/non-zero concept of true and false. However, it also defines the bool data type and the Boolean constants true and false. In C++, a 0 value is automatically converted into false, and a non-zero value is automatically converted into true. The reverse also applies: true converts to 1 and false converts to 0. In C++, +40 C + + : T h e C o m p l e t e R e f e r e n c e + + +the outcome of a relational or logical operation is true or false. But since this automatically converts into 1 or 0, the distinction between C and C++ on this issue is mostly academic. +Table 2-5 shows the relational and logical operators. The truth table for the logical operators is shown here using 1's and 0's. + +p q p && q p || q !p + +0 0 0 0 1 0 1 0 1 1 1 1 1 1 0 1 0 0 1 0 + +Both the relational and logical operators are lower in precedence than the arithmetic operators. That is, an expression like 10 > 1+12 is evaluated as if it were written 10 > (1+12). Of course, the result is false. +You can combine several operations together into one expression, as shown here: + +10>5 && !(10<9) || 3<=4 + + + +Relational Operators + +Operator > +>= < <= = = != +Logical Operators + +Operator && +|| +! + + + +Action Greater than +Greater than or equal Less than +Less than or equal Equal +Not equal + + +Action AND OR +NOT + + +Table 2-5. Relational and Logical Operators +C h a p t e r 2 : E x p r e s s i o n s 41 + + +In this case, the result is true. +Although neither C nor C++ contain an exclusive OR (XOR) logical operator, you can easily create a function that performs this task using the other logical operators. The outcome of an XOR operation is true if and only if one operand (but not both) is true. The following program contains the function xor() , which returns the outcome of an exclusive OR operation performed on its two arguments: + + +#include + +int xor(int a, int b); + +int main(void) { +printf("%d", xor(1, 0)); printf("%d", xor(1, 1)); printf("%d", xor(0, 1)); printf("%d", xor(0, 0)); + +return 0; } + +/* Perform a logical XOR operation using the two arguments. */ +int xor(int a, int b) { +return (a || b) && !(a && b); } + +The following table shows the relative precedence of the relational and logical operators: + +Highest ! +> >= < <= == != +&& Lowest || + +As with arithmetic expressions, you can use parentheses to alter the natural order of evaluation in a relational and/or logical expression. For example, +42 C + + : T h e C o m p l e t e R e f e r e n c e + + +!0 && 0 || 0 + +is false. However, when you add parentheses to the same expression, as shown here, the result is true: + +!(0 && 0) || 0 + +Remember, all relational and logical expressions produce either a true or false result. Therefore, the following program fragment is not only correct, but will print the number 1. + + +int x; + +x = 100; printf("%d", x>10); + +Bitwise Operators +Unlike many other languages, C/C++ supports a full complement of bitwise operators. Since C was designed to take the place of assembly language for most programming tasks, it needed to be able to support many operations that can be done in assembler, including operations on bits. Bitwise operation refers to testing, setting, or shifting the actual bits in a byte or word, which correspond to the char and int data types and variants. You cannot use bitwise operations on float, double, long double, void, bool, or other, more complex types. Table 2-6 lists the operators that apply to bitwise operations. These operations are applied to the individual bits of the operands. + + + + + +Operator + +& | ^ ~ + +Table 2-6. Bitwise Operators + +Action + +AND OR +Exclusive OR (XOR) +One's complement (NOT) +C h a p t e r 2 : E x p r e s s i o n s 43 + + + + +Operator + +>> << + + +Table 2-6. + +Action + +Shift right Shift left + + +Bitwise Operators (Continued) + + + + +The bitwise AND, OR, and NOT (one's complement) are governed by the same truth table as their logical equivalents, except that they work bit by bit. The exclusive OR has the truth table shown here: + +p q p ^q + +0 0 0 1 0 1 1 1 0 0 1 1 + +As the table indicates, the outcome of an XOR is true only if exactly one of the operands is true; otherwise, it is false. +Bitwise operations most often find application in device drivers—such as modem programs, disk file routines, and printer routines — because the bitwise operations can be used to mask off certain bits, such as parity. (The parity bit confirms that the rest of the bits in the byte are unchanged. It is usually the high-order bit in each byte.) +Think of the bitwise AND as a way to clear a bit. That is, any bit that is 0 in either operand causes the corresponding bit in the outcome to be set to 0. For example, the following function reads a character from the modem port and resets the parity bit to 0: + +char get_char_from_modem(void) { +char ch; + +ch = read_modem(); /* get a character from the modem port */ +return(ch & 127); } +44 C + + : T h e C o m p l e t e R e f e r e n c e + + +Parity is often indicated by the eighth bit, which is set to 0 by ANDing it with a byte that has bits 1 through 7 set to 1 and bit 8 set to 0. The expression ch & 127 means to AND together the bits in ch with the bits that make up the number 127. The net result is that the eighth bit of ch is set to 0. In the following example, assume that ch had received the character "A" and had the parity bit set: + + +Parity bit + + + +1 1 0 0 0 0 0 1 0 1 1 1 1 1 1 1 &___________ 0 1 0 0 0 0 0 1 + +ch containing an "A" with parity set 127 in binary +bitwise AND +"A" without parity + + + +The bitwise OR, as the reverse of AND, can be used to set a bit. Any bit that is set to 1 in either operand causes the corresponding bit in the outcome to be set to 1. For example, the following is 128 | 3: + + + +Ill 2-2 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 ¦___________ 1 0 0 0 0 0 1 1 + + +128 in binary 3 in binary bitwise OR result + + + +An exclusive OR, usually abbreviated XOR, will set a bit on if and only if the bits being compared are different. For example, 127 ^120 is + + + +0 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 ^___________ 0 0 0 0 0 1 1 1 + +127 in binary 120 in binary bitwise XOR result + + + +Remember, relational and logical operators always produce a result that is either true or false, whereas the similar bitwise operations may produce any arbitrary value in accordance with the specific operation. In other words, bitwise operations may produce values other than 0 or 1, while logical operators will always evaluate to 0 or 1. +The bit-shift operators, >> and <<, move all bits in a variable to the right or left as specified. The general form of the shift-right statement is +C h a p t e r 2 : E x p r e s s i o n s 45 + + +variable >> number of bit positions + +The general form of the shift-left statement is + +variable << number of bit positions + +As bits are shifted off one end, 0's are brought in the other end. (In the case of a signed, negative integer, a right shift will cause a 1 to be brought in so that the sign bit is preserved.) Remember, a shift is not a rotate. That is, the bits shifted off one end do not come back around to the other. The bits shifted off are lost. +Bit-shift operations can be very useful when you are decoding input from an external device, like a D/A converter, and reading status information. The bitwise shift operators can also quickly multiply and divide integers. A shift right effectively divides a number by 2 and a shift left multiplies it by 2, as shown in Table 2-7. The following program illustrates the shift operators: + + +/* A bit shift example. */ #include + +int main(void) { +unsigned int i; int j; + +i = 1; + +/* left shifts */ for(j=0; j<4; j++) { +i = i << 1; /* left shift i by 1, which +is same as a multiply by 2 */ printf("Left shift %d: %d\n", j, i); +} + +/* right shifts */ for(j=0; j<4; j++) { +i = i >> 1; /* right shift i by 1, which +is same as a division by 2 */ printf("Right shift %d: %d\n", j, i); +} + +return 0; } +46 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +unsigned char x; + + +x = 7; +x = x<<1; x = x<<3; x = x<<2; x = x>>1; +x = x>>2; + +x as each statement executes +0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 +0 0 0 1 1 0 0 0 + +value of x + + +7 14 +112 192 96 +24 + +*Each left shift multiplies by 2. Notice that information has been lost after x<<2 because a bit was shifted off the end. +**Each right shift divides by 2. Notice that subsequent divisions do not bring back any lost bits. + +Table 2-7. Multiplication and Division with Shift Operators + + + +The one's complement operator, ~, reverses the state of each bit in its operand. That is, all 1's are set to 0, and all 0's are set to 1. +The bitwise operators are often used in cipher routines. If you want to make a disk file appear unreadable, perform some bitwise manipulations on it. One of the simplest methods is to complement each byte by using the one's complement to reverse each bit in the byte, as is shown here: + + + +Original byte +After 1st complement After 2nd complement + +0 0 1 0 1 1 0 0 +1 1 0 1 0 0 1 1 Same 0 0 1 0 1 1 0 0 + + + +Notice that a sequence of two complements in a row always produces the original number. Thus, the first complement represents the coded version of that byte. The second complement decodes the byte to its original value. +You could use the encode() function shown here to encode a character. + + +/* A simple cipher function. */ char encode(char ch) +{ +C h a p t e r 2 : E x p r e s s i o n s 47 + + + +return(~ch); /* complement it */ } + +Of course, a file encoded using encode() would be very easy to crack! + +The ? Operator +C/C++ contains a very powerful and convenient operator that replaces certain statements of the if-then-else form. The ternary operator ? takes the general form + +Exp1 ? Exp2 : Exp3; + +where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon. The ? operator works like this: Exp1 is evaluated. If it is true, Exp2 is evaluated +and becomes the value of the expression. If Exp1 is false, Exp3 is evaluated and its value becomes the value of the expression. For example, in + + +x = 10; + +y = x>9 ? 100 : 200; + +y is assigned the value 100. If x had been less than 9, y would have received the value 200. The same code written using the if-else statement is + + +x = 10; + +if(x>9) y = 100; else y = 200; + +The ? operator will be discussed more fully in Chapter 3 in relationship to the other conditional statements. + +The & and * Pointer Operators +A pointer is the memory address of some object. A pointer variable is a variable that is +specifically declared to hold a pointer to an object of its specified type. Knowing a variable's address can be of great help in certain types of routines. However, pointers have three main functions in C/C++. They can provide a fast means of referencing array elements. They allow functions to modify their calling parameters. Lastly, +they support linked lists and other dynamic data structures. Chapter 5 is devoted exclusively to pointers. However, this chapter briefly covers the two operators that are used to manipulate pointers. +48 C + + : T h e C o m p l e t e R e f e r e n c e + + +The first pointer operator is &, a unary operator that returns the memory address of its operand. (Remember, a unary operator only requires one operand.) For example, + + +m = &count; + +places into m the memory address of the variable count. This address is the computer's internal location of the variable. It has nothing to do with the value of count. You can think of & as meaning "the address of." Therefore, the preceding assignment statement means "m receives the address of count." +To better understand this assignment, assume that the variable count is at memory location 2000. Also assume that count has a value of 100. Then, after the previous assignment, m will have the value 2000. +The second pointer operator is *, which is the complement of &. The * is a unary operator that returns the value of the variable located at the address that follows it. For example, if m contains the memory address of the variable count, + + +q = *m; + +places the value of count into q. Now q has the value 100 because 100 is stored at location 2000, the memory address that was stored in m. Think of * as meaning "at address." In this case, you could read the statement as "q receives the value at address m." +Unfortunately, the multiplication symbol and the "at address" symbol are the same, and the symbol for the bitwise AND and the "address of" symbol are the same. These operators have no relationship to each other. Both & and * have a higher precedence than all other arithmetic operators except the unary minus, with which they share equal precedence. +Variables that will hold memory addresses (i.e., pointers), must be declared by putting * in front of the variable name. This indicates to the compiler that it will hold a pointer. For example, to declare ch as a pointer to a character, write + +char *ch; + +Here, ch is not a character but a pointer to a character—there is a big difference. The type of data that a pointer points to, in this case char, is called the base type of the pointer. However, the pointer variable itself is a variable that holds the address to an object of the base type. Thus, a character pointer (or any pointer) is of sufficient size +to hold an address as defined by the architecture of the computer that it is running on. However, remember that a pointer should only point to data that is of that pointer's base type. +C h a p t e r 2 : E x p r e s s i o n s 49 + + +You can mix both pointer and nonpointer variables in the same declaration statement. For example, + + +int x, *y, count; + +declares x and count as integer types and y as a pointer to an integer type. +The following program uses * and & operators to put the value 10 into a variable called target. As expected, this program displays the value 10 on the screen. + + +#include + +int main(void) { +int target, source; int *m; + +source = 10; m = &source; target = *m; + +printf("%d", target); + +return 0; } + +The Compile-Time Operator sizeof +sizeof is a unary compile-time operator that returns the length, in bytes, of the variable or parenthesized type-specifier that it precedes. For example, assuming that integers are 4 bytes and doubles are 8 bytes, + + +double f; + +printf("%d ", sizeof f); printf("%d", sizeof(int)); + +will display 8 4. Remember,tocomputethesizeofatype,youmustenclosethetypenamein +parentheses.Thisisnotnecessaryforvariablenames,althoughthereisnoharmdone ifyoudoso. +50 C + + : T h e C o m p l e t e R e f e r e n c e + + +C/C++ defines (using typedef) a special type called size_t, which corresponds loosely to an unsigned integer. Technically, the value returned by sizeof is of type size_t. For all practical purposes, however, you can think of it (and use it) as if it were an unsigned integer value. +sizeof primarily helps to generate portable code that depends upon the size of the built-in data types. For example, imagine a database program that needs to store six integer values per record. If you want to port the database program to a variety of computers, you must not assume the size of an integer, but must determine its actual length using sizeof. This being the case, you could use the following routine to write a record to a disk file: + +/* Write 6 integers to a disk file. */ void put_rec(int rec[6], FILE *fp) +{ +int len; + +len = fwrite(rec, sizeof(int)*6, 1, fp); if(len != 1) printf("Write Error"); +} + +Coded as shown, put_rec() compiles and runs correctly in any environment, including those that use 16- and 32-bit integers. +One final point: sizeof is evaluated at compile time, and the value it produces is treated as a constant within your program. + +The Comma Operator +The comma operator strings together several expressions. The left side of the comma operator is always evaluated as void. This means that the expression on the right side becomes the value of the total comma-separated expression. For example, + + +x = (y=3, y+1); + +first assigns y the value 3 and then assigns x the value 4. The parentheses are necessary because the comma operator has a lower precedence than the assignment operator. +Essentially, the comma causes a sequence of operations. When you use it on the right side of an assignment statement, the value assigned is the value of the last expression of the comma-separated list. +The comma operator has somewhat the same meaning as the word "and" in normal English as used in the phrase "do this and this and this." +C h a p t e r 2 : E x p r e s s i o n s 51 + + +The Dot (.) and Arrow (−>) Operators +In C, the . (dot) and the −>(arrow) operators access individual elements of structures +and unions. Structures and unions are compound (also called aggregate) data types that may be referenced under a single name (see Chapter 7). In C++, the dot and arrow operators are also used to access the members of a class. +The dot operator is used when working with a structure or union directly. The arrow operator is used when a pointer to a structure or union is used. For example, given the fragment + + +struct employee { +char name[80]; int age; float wage; +} emp; + +struct employee *p = &emp; /* address of emp into p */ + +you would write the following code to assign the value 123.23 to the wage member of structure variable emp: + + +emp.wage = 123.23; + +However, the same assignment using a pointer to emp would be + +p->wage = 123.23; + +The [ ] and ( ) Operators +Parentheses are operators that increase the precedence of the operations inside them. Square brackets perform array indexing (arrays are discussed fully in Chapter 4). Given an array, the expression within square brackets provides an index into that array. For example, + + +#include char s[80]; + +int main(void) { +s[3] = 'X'; printf("%c", s[3]); +52 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +return 0; } + +first assigns the value 'X' to the fourth element (remember, all arrays begin at 0) of array s, and then prints that element. + +Precedence Summary +Table 2-8 lists the precedence of all operators defined by C. Note that all operators, except the unary operators and ?, associate from left to right. The unary operators (*, &, −) and ? associate from right to left. + + + + + + + +Highest + + + + + + + + + + + + + + + + + + + +Lowest + +Table 2-8. + +( ) [ ] −> . + +! ~ ++ –– (type) * & sizeof * / % ++ − << >> +< <= > >= == != +& ^ | +&& || ?: += += −=*= /= etc. , + +The Precedence of C Operators +C h a p t e r 2 : E x p r e s s i o n s 53 + + +Note C++definesafewadditionaloperators,whicharediscussedatlengthinPartTwo. + +Expressions +Operators, constants, and variables are the constituents of expressions. An expression in C/C++ is any valid combination of these elements. Because most expressions tend to follow the general rules of algebra, they are often taken for granted. However, a few aspects of expressions relate specifically to C and C++. + +Order of Evaluation +Neither C nor C++ specifies the order in which the subexpressions of an expression are evaluated. This leaves the compiler free to rearrange an expression to produce more optimal code. However, it also means that your code should never rely upon the order in which subexpressions are evaluated. For example, the expression + + +x = f1() + f2(); + +does not ensure that f1() will be called before f2() . + +Type Conversion in Expressions +When constants and variables of different types are mixed in an expression, they are +all converted to the same type. The compiler converts all operands up to the type of the largest operand, which is called type promotion. First, all char and short int values are automatically elevated to int. (This process is called integral promotion.) Once this step has been completed, all other conversions are done operation by operation, as described in the following type conversion algorithm: + +IF an operand is a long double +THEN the second is converted to long double ELSE IF an operand is a double +THEN the second is converted to double ELSE IF an operand is a float +THEN the second is converted to float ELSE IF an operand is an unsigned long +THEN the second is converted to unsigned long ELSE IF an operand is long +THEN the second is converted to long ELSE IF an operand is unsigned int +THEN the second is converted to unsigned int +54 C + + : T h e C o m p l e t e R e f e r e n c e + + + +char ch; int i; float f; double d; +result=(ch/i) + (f*d) – (f+i); + +int double float + + + +int double float + + + +double + +Figure 2-2. A type conversion example + + +There is one additional special case: If one operand is long and the other is unsigned int, and if the value of the unsigned int cannot be represented by a long, both operands are converted to unsigned long. +Once these conversion rules have been applied, each pair of operands is of the same type and the result of each operation is the same as the type of both operands. +For example, consider the type conversions that occur in Figure 2-2. First, the character ch is converted to an integer. Then the outcome of ch/i is converted to a double because f*d is double. The outcome of f+i is float, because f is a float. The final result is double. + +Casts +You can force an expression to be of a specific type by using a cast. The general form of a cast is + +(type) expression + +where type is a valid data type. For example, to make sure that the expression x/2 evaluates to type float, write + + +(float) x/2 +C h a p t e r 2 : E x p r e s s i o n s 55 + + +Casts are technically operators. As an operator, a cast is unary and has the same precedence as any other unary operator. +Although casts are not usually used a great deal in programming, they can be very useful when needed. For example, suppose you wish to use an integer for loop control, yet to perform computation on it requires a fractional part, as in the following program: + +#include + +int main(void) /* print i and i/2 with fractions */ { +int i; + +for(i=1; i<=100; ++i) +printf("%d / 2 is: %f\n", i, (float) i /2); + +return 0; } + +Without the cast (float), only an integer division would have been performed. The cast ensures that the fractional part of the answer is displayed. + + +Note + +C++ adds four new casting operators, such as const_cast and static_cast. These operators are discussed in Part Two. + + +Spacing and Parentheses +You can add tabs and spaces to expressions to make them easier to read. For example, the following two expressions are the same: + + +x=10/y~(127/x); + +x = 10 / y ~(127/x); + +Redundant or additional parentheses do not cause errors or slow down the execution of an expression. You should use parentheses to clarify the exact order of evaluation, both for yourself and for others. For example, which of the following two expressions is easier to read? + + +x = y/3-34*temp+127; + +x = (y/3) - (34*temp) + 127; +56 C + + : T h e C o m p l e t e R e f e r e n c e + + +Shorthand Assignments +There is a variation on the assignment statement, sometimes referred to as a shorthand assignment, that simplifies the coding of a certain type of assignment operation. For example, + + +x = x+10; + +can be written as + +x += 10; + +The operator += tells the compiler to assign to x the value of x plus 10. +This shorthand works for all the binary operators (those that require two operands). In general, statements like: + +var = var operator expression + +can be rewritten as + +var operator = expression + +For another example, + +x = x-100; + +is the same as + +x -= 100; + +Shorthand notation is widely used in professionally written C/C++ programs; you should become familiar with it. + +C++ + + + + +Chapter 3 Statements + + + + + + + + + + + + + + +57 +58 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter discusses the statement. In the most general sense, a statement is a part of your program that can be executed. That is, a statement specifies an action. C and C++ categorize statements into these groups: +T + + Selection Iteration Jump + Label + Expression Block +Included in the selection statements are if and switch. (The term conditional statement is often used in place of "selection statement.") The iteration statements are while, for, and do-while. These are also commonly called loop statements. The jump statements are break, continue, goto, and return. The label statements include the case and default statements (discussed along with the switch statement) and the label statement (discussed with goto). Expression statements are statements composed of a valid expression. Block statements are simply blocks of code. (Remember, a block begins with a { and ends with a }.) Block statements are also referred to as +compound statements. + + +Note + +C++addstwoadditionalstatementtypes:thetryblock(usedbyexceptionhandling) and the declaration statement. These are discussed in Part Two. + + +Since many statements rely upon the outcome of some conditional test, let's begin by reviewing the concepts of true and false. + + +True and False in C and C++ +Many C/C++ statements rely upon a conditional expression that determines what course of action is to be taken. A conditional expression evaluates to either a true or false value. In C, a true value is any nonzero value, including negative numbers. A false value is 0. This approach to true and false allows a wide range of routines to be coded extremely efficiently. +C++ fully supports the zero/nonzero definition of true and false just described. But C++ also defines a Boolean data type called bool, which can have only the values true and false. As explained in Chapter 2, in C++, a 0 value is automatically converted into false and a nonzero value is automatically converted into true. The reverse also applies: true converts to 1 and false converts to 0. In C++, the expression that controls a conditional statement is technically of type bool. But since any nonzero value converts +C h a p t e r 3 : S t a t e m e n t s 59 + + +to true and any zero value converts to false, there is no practical difference between C and C++ on this point. + + +Selection Statements +C/C++ supports two types of selection statements: if and switch. In addition, the ? operator is an alternative to if in certain circumstances. + +if +The general form of the if statement is + +if (expression) statement; else statement; + +where a statement may consist of a single statement, a block of statements, or nothing (in the case of empty statements). The else clause is optional. +If expression evaluates to true (anything other than 0), the statement or block that forms the target of if is executed; otherwise, the statement or block that is the target of else will be executed, if it exists. Remember, only the code associated with if or the code associated with else executes, never both. +In C, the conditional statement controlling if must produce a scalar result. A scalar is either an integer, character, pointer, or floating-point type. In C++, it may also be of type bool. It is rare to use a floating-point number to control a conditional statement because this slows execution time considerably. (It takes several instructions to perform a floating-point operation. It takes relatively few instructions to perform an integer or character operation.) +The following program contains an example of if. The program plays a very simple version of the "guess the magic number" game. It prints the message ** Right ** when the player guesses the magic number. It generates the magic number using the standard random number generator rand() , which returns an arbitrary number between 0 and RAND_MAX (which defines an integer value that is 32,767 or larger). rand() requires the header file stdlib.h. (A C++ program may also use the new-style header .) + + +/* Magic number program #1. */ #include +#include + +int main(void) { +int magic; /* magic number */ +60 C + + : T h e C o m p l e t e R e f e r e n c e + + + +int guess; /* user's guess */ + +magic = rand(); /* generate the magic number */ + +printf("Guess the magic number: "); scanf("%d", &guess); + +if(guess == magic) printf("** Right **"); + +return 0; } + +Taking the magic number program further, the next version illustrates the use of the else statement to print a message in response to the wrong number. + + +/* Magic number program #2. */ #include +#include + +int main(void) { +int magic; /* magic number */ int guess; /* user's guess */ + +magic = rand(); /* generate the magic number */ + +printf("Guess the magic number: "); scanf("%d", &guess); + +if(guess == magic) printf("** Right **"); else printf("Wrong"); + +return 0; } + +Nested ifs +A nested if is an if that is the target of another if or else. Nested ifs are very common in programming. In a nested if, an else statement always refers to the nearest if statement that is within the same block as the else and that is not already associated with an else. For example, +C h a p t e r 3 : S t a t e m e n t s 61 + + +if(i) { +if(j) statement 1; +if(k) statement 2; /* this if */ +else statement 3; /* is associated with this else */ } +else statement 4; /* associated with if(i) */ + +As noted, the final else is not associated with if(j) because it is not in the same block. Rather, the final else is associated with if(i). Also, the inner else is associated with if(k), which is the nearest if. +Standard C specifies that at least 15 levels of nesting must be supported. In practice, most compilers allow substantially more. More importantly, Standard C++ suggests that at least 256 levels of nested ifs be allowed in a C++ program. However, nesting beyond a few levels is seldom necessary, and excessive nesting can quickly confuse the meaning of an algorithm. +You can use a nested if to further improve the magic number program by providing the player with feedback about a wrong guess. + + +/* Magic number program #3. */ #include +#include + +int main(void) { +int magic; /* magic number */ int guess; /* user's guess */ + +magic = rand(); /* get a random number */ + +printf("Guess the magic number: "); scanf("%d", &guess); + +if (guess == magic) { printf("** Right **"); +printf(" %d is the magic number\n", magic); } +else { printf("Wrong, "); +if(guess > magic) printf("too high\n"); else printf("too low\n"); +} +62 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return 0; } + + +The if-else-if Ladder +A common programming construct is the if-else-if ladder, sometimes called the if-else-if staircase because of its appearance. Its general form is + +if (expression) statement; else +if (expression) statement; else +if (expression) statement; . +. . +else statement; + +The conditions are evaluated from the top downward. As soon as a true condition is found, the statement associated with it is executed and the rest of the ladder is bypassed. If none of the conditions are true, the final else is executed. That is, if all other conditional tests fail, the last else statement is performed. If the final else is not present, no action takes place if all other conditions are false. +Although the indentation of the preceding if-else-if ladder is technically correct, it can lead to overly deep indentation. For this reason, the if-else-if ladder is generally indented like this: + +if (expression) statement; +else if (expression) statement; +else if (expression) statement; +. . . +else statement; + +Using an if-else-if ladder, the magic number program becomes + +/* Magic number program #4. */ +C h a p t e r 3 : S t a t e m e n t s 63 + + + +#include #include + +int main(void) { +int magic; /* magic number */ int guess; /* user's guess */ + +magic = rand(); /* generate the magic number */ + +printf("Guess the magic number: "); scanf("%d", &guess); + +if(guess == magic) { printf("** Right ** "); +printf("%d is the magic number", magic); } +else if(guess > magic) printf("Wrong, too high"); +else printf("Wrong, too low"); + +return 0; } + + +The ? Alternative +You can use the ? operator to replace if-else statements of the general form: + +if(condition) expression; else expression; + +However, the target of both if and else must be a single expression—not another statement. +The ? is called a ternary operator because it requires three operands. It takes the general form + +Exp1 ? Exp2 : Exp3 + +where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon. The value of a ? expression is determined as follows: Exp1 is evaluated. If it is true, +Exp2 is evaluated and becomes the value of the entire ? expression. If Exp1 is false, then Exp3 is evaluated and its value becomes the value of the expression. For example, consider +64 C + + : T h e C o m p l e t e R e f e r e n c e + + +x = 10; +y = x>9 ? 100 : 200; + +In this example, y is assigned the value 100. If x had been less than 9, y would have received the value 200. The same code written with the if-else statement would be + + +x = 10; +if(x>9) y = 100; else y = 200; + +The following program uses the ? operator to square an integer value entered by the user. However, this program preserves the sign (10 squared is 100 and −10 squared is −100). + + +#include + +int main(void) { +int isqrd, i; + +printf("Enter a number: "); scanf("%d", &i); + +isqrd = i>0 ? i*i : -(i*i); + +printf("%d squared is %d", i, isqrd); + +return 0; } + +The use of the ? operator to replace if-else statements is not restricted to assignments only. Remember, all functions (except those declared as void) may return a value. Thus, you can use one or more function calls in a ? expression. When the function's name is encountered, the function is executed so that its return value may be determined. Therefore, you can execute one or more function calls using the ? operator by placing the calls in the expressions that form the ?'s operands. Here is an example. + + +#include + +int f1(int n); int f2(void); +C h a p t e r 3 : S t a t e m e n t s 65 + + + +int main(void) { +int t; + +printf("Enter a number: "); scanf("%d", &t); + +/* print proper message */ +t ? f1(t) + f2() : printf("zero entered.\n"); + +return 0; } + +int f1(int n) { +printf("%d ", n); return 0; +} + +int f2(void) { +printf("entered.\n"); return 0; +} + + +Entering a 0 in this example calls the printf() function and displays the message zero entered. If you enter any other number, both f1() and f2() execute. Note that the value of the ? expression is discarded in this example. You don't need to assign it to anything. +A word of warning: Some C++ compilers rearrange the order of evaluation of an expression in an attempt to optimize the object code. This could cause functions that form the operands of the ? operator to execute in an unintended sequence. +Using the ? operator, you can rewrite the magic number program yet again. + + +/* Magic number program #5. */ #include +#include + +int main(void) { +int magic; int guess; +66 C + + : T h e C o m p l e t e R e f e r e n c e + + + +magic = rand(); /* generate the magic number */ + +printf("Guess the magic number: "); scanf("%d", &guess); + +if(guess == magic) { printf("** Right ** "); +printf("%d is the magic number", magic); } +else +guess > magic ? printf("High") : printf("Low"); + +return 0; } + +Here, the ? operator displays the proper message based on the outcome of the test guess > magic. + +The Conditional Expression +Sometimes newcomers to C/C++ are confused by the fact that you can use any valid +expression to control the if or the ? operator. That is, you are not restricted to expressions involving the relational and logical operators (as is the case in languages like BASIC or Pascal). The expression must simply evaluate to either a true or false (zero or nonzero) value. For example, the following program reads two integers from the keyboard and displays the quotient. It uses an if statement, controlled by the second number, to avoid a divide-by-zero error. + + +/* Divide the first number by the second. */ + +#include + +int main(void) { +int a, b; + +printf("Enter two numbers: "); scanf("%d%d", &a, &b); + +if(b) printf("%d\n", a/b); +else printf("Cannot divide by zero.\n"); + +return 0; } +C h a p t e r 3 : S t a t e m e n t s 67 + + +This approach works because if b is 0, the condition controlling the if is false and the else executes. Otherwise, the condition is true (nonzero) and the division takes place. +One other point: Writing the if statement as shown here + + +if(b != 0) printf("%d\n", a/b); + +is redundant, potentially inefficient, and is considered bad style. Since the value of b alone is sufficient to control the if, there is no need to test it against 0. + +switch +C/C++ has a built-in multiple-branch selection statement, called switch, which +successively tests the value of an expression against a list of integer or character constants. When a match is found, the statements associated with that constant are executed. The general form of the switch statement is + +switch (expression) { case constant1: +statement sequence break; +case constant2: statement sequence break; +case constant3: statement sequence break; +. . . +default +statement sequence } + +The expression must evaluate to a character or integer value. Floating-point expressions, for example, are not allowed. The value of expression is tested, in order, against the values of the constants specified in the case statements. When a match is found, the statement sequence associated with that case is executed until the break statement or the end of the switch statement is reached. The default statement is executed if no matches are found. The default is optional and, if it is not present, no action takes place if all matches fail. +Standard C specifies that a switch can have at least 257 case statements. Standard C++ recommends that at least 16,384 case statements be supported! In practice, you will want to limit the number of case statements to a smaller amount for efficiency. Although case is a label statement, it cannot exist by itself, outside of a switch. +68 C + + : T h e C o m p l e t e R e f e r e n c e + + +The break statement is one of C/C++'s jump statements. You can use it in loops as well as in the switch statement (see the section "Iteration Statements"). When break is encountered in a switch, program execution "jumps" to the line of code following the switch statement. +There are three important things to know about the switch statement: + + The switch differs from the if in that switch can only test for equality, whereas if can evaluate any type of relational or logical expression. + + No two case constants in the same switch can have identical values. Of course, a switch statement enclosed by an outer switch may have case constants that are the same. + + If character constants are used in the switch statement, they are automatically converted to integers. + +The switch statement is often used to process keyboard commands, such as menu selection. As shown here, the function menu() displays a menu for a spelling-checker program and calls the proper procedures: + + +void menu(void) { +char ch; + +printf("1. Check Spelling\n"); printf("2. Correct Spelling Errors\n"); printf("3. Display Spelling Errors\n"); +printf("Strike Any Other Key to Skip\n"); printf(" Enter your choice: "); + +ch = getchar(); /* read the selection from the keyboard */ + +switch(ch) { case '1': +check_spelling(); break; +case '2': correct_errors(); break; +case '3': display_errors(); break; +default : +C h a p t e r 3 : S t a t e m e n t s 69 + + + +printf("No option selected"); } +} + + +Technically, the break statements inside the switch statement are optional. They terminate the statement sequence associated with each constant. If the break statement is omitted, execution will continue on into the next case's statements until either a break or the end of the switch is reached. For example, the following function uses the "drop through" nature of the cases to simplify the code for a device-driver input handler: + + +/* Process a value */ void inp_handler(int i) { +int flag; + +flag = -1; + +switch(i) { +case 1: /* These cases have common */ case 2: /* statement sequences. */ case 3: +flag = 0; break; +case 4: flag = 1; +case 5: error(flag); break; +default: process(i); +} } + +This example illustrates two aspects of switch. First, you can have case statements that have no statement sequence associated with them. When this occurs, execution simply drops through to the next case. In this example, the first three cases all execute the same statements, which are + + +flag = 0; break; +70 C + + : T h e C o m p l e t e R e f e r e n c e + + +Second, execution of one statement sequence continues into the next case if no break statement is present. If i matches 4, flag is set to 1 and, because there is no break statement at the end of that case, execution continues and the call to error(flag) is executed. If i had matched 5, error(flag) would have been called with a flag value of −1 (rather than 1). +The fact that cases can run together when no break is present prevents the unnecessary duplication of statements, resulting in more efficient code. + +Nested switch Statements +You can have a switch as part of the statement sequence of an outer switch. Even if the case constants of the inner and outer switch contain common values, no conflicts arise. For example, the following code fragment is perfectly acceptable: + + +switch(x) { case 1: +switch(y) { +case 0: printf("Divide by zero error.\n"); break; +case 1: process(x,y); } +break; case 2: +. . . + +Iteration Statements +In C/C++, and all other modern programming languages, iteration statements (also called loops) allow a set of instructions to be executed repeatedly until a certain condition is reached. This condition may be predefined (as in the for loop), or +open-ended (as in the while and do-while loops). + +The for Loop +The general design of the for loop is reflected in some form or another in all procedural programming languages. However, in C/C++, it provides unexpected flexibility and power. +The general form of the for statement is + +for(initialization; condition; increment) statement; + +The for loop allows many variations, but its most common form works like this. The initialization is an assignment statement that is used to set the loop control variable. The +C h a p t e r 3 : S t a t e m e n t s 71 + + +condition is a relational expression that determines when the loop exits. The increment defines how the loop control variable changes each time the loop is repeated. You must separate these three major sections by semicolons. The for loop continues to execute as long as the condition is true. Once the condition becomes false, program execution resumes on the statement following the for. +In the following program, a for loop is used to print the numbers 1 through 100 on the screen: + +#include + +int main(void) { +int x; + +for(x=1; x <= 100; x++) printf("%d ", x); + +return 0; } + +In the loop, x is initially set to 1 and then compared with 100. Since x is less than 100, printf() is called and the loop iterates. This causes x to be increased by 1 and again tested to see if it is still less than or equal to 100. If it is, printf() is called. This process repeats until x is greater than 100, at which point the loop terminates. In this example, x is the loop control variable, which is changed and checked each time the loop repeats. +The following example is a for loop that iterates multiple statements: + + +for(x=100; x != 65; x -= 5) { z = x*x; +printf("The square of %d, %f", x, z); } + +Both the squaring of x and the call to printf() are executed until x equals 65. Note that the loop is negative running: x is initialized to 100 and 5 is subtracted from it each time the loop repeats. +In for loops, the conditional test is always performed at the top of the loop. This means that the code inside the loop may not be executed at all if the condition is false to begin with. For example, in + +x = 10; +for(y=10; y!=x; ++y) printf("%d", y); printf("%d", y); /* this is the only printf() +statement that will execute */ +72 C + + : T h e C o m p l e t e R e f e r e n c e + + +the loop will never execute because x and y are equal when the loop is entered. Because this causes the conditional expression to evaluate to false, neither the body of the loop nor the increment portion of the loop executes. Hence, y still has the value 10, and the only output produced by the fragment is the number 10 printed once on the screen. + +for Loop Variations +The previous discussion described the most common form of the for loop. However, +several variations of the for are allowed that increase its power, flexibility, and applicability to certain programming situations. +One of the most common variations uses the comma operator to allow two or more variables to control the loop. (Remember, you use the comma operator to string together a number of expressions in a "do this and this" fashion. See Chapter 2.) For example, the variables x and y control the following loop, and both are initialized inside the for statement: + + +for(x=0, y=0; x+y<10; ++x) { y = getchar(); +y = y - '0'; /* subtract the ASCII code for 0 from y */ +. . . +} + +Commas separate the two initialization statements. Each time the loop repeats, x is incremented and y's value is set by keyboard input. Both x and y must be at the correct value for the loop to terminate. Even though y's value is set by keyboard input, y must be initialized to 0 so that its value is defined before the first evaluation of the conditional expression. (If y were not defined, it could by chance contain the value 10, making the conditional test false and preventing the loop from executing.) +The converge() function, shown next, demonstrates multiple loop control variables in action. The converge() function copies the contents of one string into another by moving characters from both ends, converging in the middle. + + +/* Demonstrate multiple loop control variables. */ #include +#include + +void converge(char *targ, char *src); + +int main(void) { +char target[80] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; +C h a p t e r 3 : S t a t e m e n t s 73 + + + + +converge(target, "This is a test of converge()."); printf("Final string: %s\n", target); + +return 0; } + +/* This function copies one string into another. It copies characters to both the ends, converging at the middle. */ +void converge(char *targ, char *src) { +int i, j; + +printf("%s\n", targ); +for(i=0, j=strlen(src); i<=j; i++, j--) { targ[i] = src[i]; +targ[j] = src[j]; printf("%s\n", targ); +} } + +Here is the output produced by the program. + +XXXXXXXXXXXXXXXXXXXXXXXXXXXXX TXXXXXXXXXXXXXXXXXXXXXXXXXXXX ThXXXXXXXXXXXXXXXXXXXXXXXXXX. ThiXXXXXXXXXXXXXXXXXXXXXXXX). ThisXXXXXXXXXXXXXXXXXXXXXX(). This XXXXXXXXXXXXXXXXXXXXe(). This iXXXXXXXXXXXXXXXXXXge(). This isXXXXXXXXXXXXXXXXrge(). This is XXXXXXXXXXXXXXerge(). This is aXXXXXXXXXXXXverge(). This is a XXXXXXXXXXnverge(). This is a tXXXXXXXXonverge(). This is a teXXXXXXconverge(). This is a tesXXXX converge(). This is a testXXf converge(). This is a test of converge(). +Final string: This is a test of converge(). +74 C + + : T h e C o m p l e t e R e f e r e n c e + + +In converge() , the for loop uses two loop control variables, i and j, to index the string from opposite ends. As the loop iterates, i is increased and j is decreased. The loop stops when i is greater than j, thus ensuring that all characters are copied. +The conditional expression does not have to involve testing the loop control variable against some target value. In fact, the condition may be any relational or logical statement. This means that you can test for several possible terminating conditions. +For example, you could use the following function to log a user onto a remote system. The user has three tries to enter the password. The loop terminates when the three tries are used up or the user enters the correct password. + + +void sign_on(void) { +char str[20]; int x; + +for(x=0; x<3 && strcmp(str, "password"); ++x) { printf("Enter password please:"); +gets(str); } + +if(x==3) return; +/* else log user in ... */ } + +This function uses strcmp() , the standard library function that compares two strings and returns 0 if they match. +Remember, each of the three sections of the for loop may consist of any valid expression. The expressions need not actually have anything to do with what the sections are generally used for. With this in mind, consider the following example: + + +#include + +int sqrnum(int num); int readnum(void); int prompt(void); + +int main(void) { +int t; + +for(prompt(); t=readnum(); prompt()) +C h a p t e r 3 : S t a t e m e n t s 75 + + + +sqrnum(t); + +return 0; } + +int prompt(void) { +printf("Enter a number: "); return 0; +} + +int readnum(void) { +int t; + +scanf("%d", &t); return t; +} + +int sqrnum(int num) { +printf("%d\n", num*num); return num*num; +} + + +Look closely at the for loop in main() . Notice that each part of the for loop is composed of function calls that prompt the user and read a number entered from the keyboard. If the number entered is 0, the loop terminates because the conditional expression will be false. Otherwise, the number is squared. Thus, this for loop uses the initialization and increment portions in a nontraditional but completely valid sense. +Another interesting trait of the for loop is that pieces of the loop definition need not be there. In fact, there need not be an expression present for any of the sections—the expressions are optional. For example, this loop will run until the user enters 123: + + +for(x=0; x!=123; ) scanf("%d", &x); + +Notice that the increment portion of the for definition is blank. This means that each time the loop repeats, x is tested to see if it equals 123, but no further action takes place. If you type 123 at the keyboard, however, the loop condition becomes false and the loop terminates. +76 C + + : T h e C o m p l e t e R e f e r e n c e + + +The initialization of the loop control variable can occur outside the for statement. This most frequently happens when the initial condition of the loop control variable must be computed by some complex means as in this example: + + +gets(s); /* read a string into s */ +if(*s) x = strlen(s); /* get the string's length */ else x = 10; + +for( ; x<10; ) { printf("%d", x); ++x; +} + +The initialization section has been left blank and x is initialized before the loop is entered. + +The Infinite Loop +Although you can use any loop statement to create an infinite loop, for is traditionally used for this purpose. Since none of the three expressions that form the for loop are required, you can make an endless loop by leaving the conditional expression empty: + + +for( ; ; ) printf("This loop will run forever.\n"); + +When the conditional expression is absent, it is assumed to be true. You may have an initialization and increment expression, but C++ programmers more commonly use the for(;;) construct to signify an infinite loop. +Actually, the for(;;) construct does not guarantee an infinite loop because a break statement, encountered anywhere inside the body of a loop, causes immediate termination. (break is discussed in detail later in this chapter.) Program control then resumes at the code following the loop, as shown here: + + +ch = '\0'; + +for( ; ; ) { +ch = getchar(); /* get a character */ if(ch=='A') break; /* exit the loop */ +} + +printf("you typed an A"); + +This loop will run until the user types an A at the keyboard. +C h a p t e r 3 : S t a t e m e n t s 77 + + +for Loops with No Bodies +A statement may be empty. This means that the body of the for loop (or any other loop) +may also be empty. You can use this fact to improve the efficiency of certain algorithms and to create time delay loops. +Removing spaces from an input stream is a common programming task. For example, a database program may allow a query such as "show all balances less than 400." The database needs to have each word fed to it separately, without leading spaces. That is, the database input processor recognizes "show" but not " show". The following loop shows one way to accomplish this. It advances past leading spaces in the string pointed to by str. + + +for( ; *str == ' '; str++) ; + +As you can see, this loop has no body—and no need for one either. +Time delay loops are often used in programs. The following code shows how to create one by using for: + + +for(t=0; t #include + +void pad(char *s, int length); + +int main(void) { +char str[80]; + +strcpy(str, "this is a test"); pad(str, 40); +printf("%d", strlen(str)); + +return 0; } + +/* Add spaces to the end of a string. */ void pad(char *s, int length) +{ +int l; + +l = strlen(s); /* find out how long it is */ + +while(l 100); + +Perhaps the most common use of the do-while loop is in a menu selection function. When the user enters a valid response, it is returned as the value of the function. Invalid responses cause a reprompt. The following code shows an improved version of the spelling-checker menu developed earlier in this chapter: + + +void menu(void) { +char ch; + +printf("1. Check Spelling\n"); printf("2. Correct Spelling Errors\n"); printf("3. Display Spelling Errors\n"); printf(" Enter your choice: "); + +do { +ch = getchar(); /* read the selection from the keyboard */ +switch(ch) { case '1': +check_spelling(); break; +case '2': correct_errors(); break; +case '3': display_errors(); break; +} +} while(ch!='1' && ch!='2' && ch!='3'); } +C h a p t e r 3 : S t a t e m e n t s 81 + + +Here, the do-while loop is a good choice because you will always want a menu function to execute at least once. After the options have been displayed, the program will loop until a valid option is selected. + + +Declaring Variables within Selection and Iteration Statements +In C++ (but not C), it is possible to declare a variable within the conditional expression of an if or switch, within the conditional expression of a while loop, or within the initialization portion of a for loop. A variable declared in one of these places has its scope limited to the block of code controlled by that statement. For example, a variable declared within a for loop will be local to that loop. +Here is an example that declares a variable within the initialization portion of a for loop: + +/* i is local to for loop; j is known outside loop. */ int j; +for(int i = 0; i<10; i++) j = i * i; + +/* i = 10; // *** Error *** -- i not known here! */ + + +Here, i is declared within the initialization portion of the for and is used to control the loop. Outside the loop, i is unknown. +Since often a loop control variable in a for is needed only by that loop, the declaration of the variable in the initialization portion of the for is becoming common practice. Remember, however, that this is not supported by C. + + +Tip + +Whether a variable declared within the initialization portion of a for loop is local to thatloophaschangedovertime.Originally,thevariablewasavailableafterthefor. However, Standard C++ restricts the variable to the scope of the for loop. + + +If your compiler fully complies with Standard C++, then you can also declare a variable within any conditional expression, such as those used by the if or a while. For example, this fragment, + + +if(int x = 20) { x = x - y; +82 C + + : T h e C o m p l e t e R e f e r e n c e + + + +if(x>10) y = 0; } + +declares x and assigns it the value 20. Since this is a true value, the target of the if executes. Variables declared within a conditional statement have their scope limited to the block of code controlled by that statement. Thus, in this case, x is not known outside the if. Frankly, not all programmers believe that declaring variables within conditional statements is good practice, and this technique will not be used in +this book. + + +Jump Statements +C/C++ has four statements that perform an unconditional branch: return, goto, break, and continue. Of these, you may use return and goto anywhere in your program. You may use the break and continue statements in conjunction with any of the loop statements. As discussed earlier in this chapter, you can also use break with switch. + +The return Statement +The return statement is used to return from a function. It is categorized as a jump statement because it causes execution to return (jump back) to the point at which the call to the function was made. A return may or may not have a value associated with it. If return has a value associated with it, that value becomes the return value of the function. In C, a non-void function does not technically have to return a value. If no return value is specified, a garbage value is returned. However, in C++, a non-void function must return a value. That is, in C++, if a function is specified as returning a value, any return statement within it must have a value associated with it. (Even in C, if a function is declared as returning a value, it is good practice to actually return one.) +The general form of the return statement is + +return expression; + +The expression is present only if the function is declared as returning a value. In this case, the value of expression will become the return value of the function. +You can use as many return statements as you like within a function. However, the function will stop executing as soon as it encounters the first return. The } that ends a function also causes the function to return. It is the same as a return without any specified value. If this occurs within a non-void function, then the return value of the function is undefined. +A function declared as void may not contain a return statement that specifies a value. Since a void function has no return value, it makes sense that no return statement within a void function can return a value. +C h a p t e r 3 : S t a t e m e n t s 83 + + +See Chapter 6 for more information on return. + +The goto Statement +Since C/C++ has a rich set of control structures and allows additional control using +break and continue, there is little need for goto. Most programmers' chief concern about the goto is its tendency to render programs unreadable. Nevertheless, although the goto statement fell out of favor some years ago, it occasionally has its uses. There are no programming situations that require goto. Rather, it is a convenience, which, if used wisely, can be a benefit in a narrow set of programming situations, such as jumping out of a set of deeply nested loops. The goto is not used outside of this section. +The goto statement requires a label for operation. (A label is a valid identifier followed by a colon.) Furthermore, the label must be in the same function as the goto that uses it—you cannot jump between functions. The general form of the goto statement is + +goto label; . +. . +label: + +where label is any valid label either before or after goto. For example, you could create a loop from 1 to 100 using the goto and a label, as shown here: + + +x = 1; loop1: x++; +if(x<100) goto loop1; + +The break Statement +The break statement has two uses. You can use it to terminate a case in the switch statement (covered in the section on switch earlier in this chapter). You can also use it to force immediate termination of a loop, bypassing the normal loop conditional test. +When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop. For example, + +#include + +int main(void) +84 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +int t; + +for(t=0; t<100; t++) { printf("%d ", t); if(t==10) break; +} + +return 0; } + +prints the numbers 0 through 10 on the screen. Then the loop terminates because break causes immediate exit from the loop, overriding the conditional test t<100. +Programmers often use the break statement in loops in which a special condition can cause immediate termination. For example, here a keypress can stop the execution of the look_up() function: + +void look_up(char *name) { +do { +/* look up names ... */ if(kbhit()) break; +} while(!found); /* process match */ +} + +The kbhit() function returns 0 if you do not press a key. Otherwise, it returns a nonzero value. Because of the wide differences between computing environments, neither Standard C nor Standard C++ defines kbhit(), but you will almost certainly have it (or one with a slightly different name) supplied with your compiler. +A break causes an exit from only the innermost loop. For example, + + +for(t=0; t<100; ++t) { count = 1; +for(;;) { +printf("%d ", count); count++; if(count==10) break; +} } +C h a p t e r 3 : S t a t e m e n t s 85 + + +prints the numbers 1 through 10 on the screen 100 times. Each time execution encounters break, control is passed back to the outer for loop. +A break used in a switch statement will affect only that switch. It does not affect any loop the switch happens to be in. + +The exit( ) Function +Although exit() is not a program control statement, a short digression that discusses it +is in order at this time. Just as you can break out of a loop, you can break out of a program by using the standard library function exit() . This function causes immediate termination of the entire program, forcing a return to the operating system. In effect, the exit() function acts as if it were breaking out of the entire program. +The general form of the exit() function is + +void exit(int return_code); + +The value of return_code is returned to the calling process, which is usually the operating system. Zero is generally used as a return code to indicate normal program termination. Other arguments are used to indicate some sort of error. You can also use the macros EXIT_SUCCESS and EXIT_FAILURE for the return_code. The exit() function requires the header stdlib.h. A C++ program may also use the new-style header . +Programmers frequently use exit() when a mandatory condition for program execution is not satisfied. For example, imagine a virtual reality computer game that requires a special graphics adapter. The main() function of this game might look like this: + + +#include + +int main(void) { +if(!virtual_graphics()) exit(1); play(); +/* ... */ } +/* .... */ + +where virtual_graphics() is a user-defined function that returns true if the virtual-reality graphics adapter is present. If the adapter is not in the system, virtual_graphics() returns false and the program terminates. +As another example, this version of menu() uses exit() to quit the program and return to the operating system: +86 C + + : T h e C o m p l e t e R e f e r e n c e + + +void menu(void) { +char ch; + +printf("1. Check Spelling\n"); printf("2. Correct Spelling Errors\n"); printf("3. Display Spelling Errors\n"); printf("4. Quit\n"); +printf(" Enter your choice: "); + +do { +ch = getchar(); /* read the selection from the keyboard */ +switch(ch) { case '1': +check_spelling(); break; +case '2': correct_errors(); break; +case '3': display_errors(); break; +case '4': +exit(0); /* return to OS */ } +} while(ch!='1' && ch!='2' && ch!='3'); } + +The continue Statement +The continue statement works somewhat like the break statement. Instead of forcing termination, however, continue forces the next iteration of the loop to take place, skipping any code in between. For the for loop, continue causes the conditional test and increment portions of the loop to execute. For the while and do-while loops, program control passes to the conditional tests. For example, the following program counts the number of spaces contained in the string entered by the user: + + +/* Count spaces */ #include + +int main(void) { +C h a p t e r 3 : S t a t e m e n t s 87 + + + +char s[80], *str; int space; + +printf("Enter a string: "); gets(s); +str = s; + +for(space=0; *str; str++) { if(*str != ' ') continue; space++; +} +printf("%d spaces\n", space); + +return 0; } + +Each character is tested to see if it is a space. If it is not, the continue statement forces the for to iterate again. If the character is a space, space is incremented. +The following example shows how you can use continue to expedite the exit from a loop by forcing the conditional test to be performed sooner: + + +void code(void) { +char done, ch; + +done = 0; while(!done) { +ch = getchar(); if(ch=='$') { +done = 1; continue; +} +putchar(ch+1); /* shift the alphabet one position higher */ +} } + +This function codes a message by shifting all characters you type one letter higher. For example, an A becomes a B. The function will terminate when you type a $. After a $ has been input, no further output will occur because the conditional test, brought into effect by continue, will find done to be true and will cause the loop to exit. +88 C + + : T h e C o m p l e t e R e f e r e n c e + + +Expression Statements +Chapter 2 covered expressions thoroughly. However, a few special points are mentioned here. Remember, an expression statement is simply a valid expression followed by a semicolon, as in + + +func(); /* a function call */ +a = b+c; /* an assignment statement */ +b+f(); /* a valid, but strange statement */ ; /* an empty statement */ + +The first expression statement executes a function call. The second is an assignment. The third expression, though strange, is still evaluated by the C++ compiler because the function f() may perform some necessary task. The final example shows that a statement can be empty (sometimes called a null statement). + + +Block Statements +Block statements are simply groups of related statements that are treated as a unit. The statements that make up a block are logically bound together. Block statements are also called compound statements. A block is begun with a { and terminated by its matching }. Programmers use block statements most commonly to create a multistatement target for some other statement, such as if. However, you may place a block statement anywhere you would put any other statement. For example, this is perfectly valid (although unusual) C/C++ code: + + +#include + +int main(void) { +int i; + +{ /* a block statement */ i = 120; +printf("%d", i); } + +return 0; } + +C++ + + + + +Chapter 4 Arrays and Null-Terminated Strings + + + + + + + + + + + +89 +90 C + + : T h e C o m p l e t e R e f e r e n c e + + +n array is a collection of variables of the same type that are referred to through a common name. A specific element in an array is accessed by an index. In C/C++, all arrays consist of contiguous memory locations. The lowest address +A +corresponds to the first element and the highest address to the last element. Arrays may have from one to several dimensions. The most common array is the null-terminated string, which is simply an array of characters terminated by a null. +Arrays and pointers are closely related; a discussion of one usually refers to the other. This chapter focuses on arrays, while Chapter 5 looks closely at pointers. You should read both to understand fully these important constructs. + + +Single-Dimension Arrays +The general form for declaring a single-dimension array is + +type var_name[size]; + +Like other variables, arrays must be explicitly declared so that the compiler may allocate space for them in memory. Here, type declares the base type of the array, which is the type of each element in the array, and size defines how many elements the array will hold. For example, to declare a 100-element array called balance of type double, use this statement: + + +double balance[100]; + +An element is accessed by indexing the array name. This is done by placing the index of the element within square brackets after the name of the array. For example, + + +balance[3] = 12.23; + +assigns element number 3 in balance the value 12.23. +In C/C++, all arrays have 0 as the index of their first element. Therefore, when you write + + +char p[10]; + +you are declaring a character array that has ten elements, p[0] through p[9]. For example, the following program loads an integer array with the numbers 0 through 99: + + +#include + +int main(void) +C h a p t e r 4 : A r r a y s a n d N u l l - T e r m i n a t e d S t r i n g s 91 + + + +{ +int x[100]; /* this declares a 100-integer array */ int t; + +/* load x with values 0 through 99 */ for(t=0; t<100; ++t) x[t] = t; + +/* display contents of x */ +for(t=0; t<100; ++t) printf("%d ", x[t]); + +return 0; } + +The amount of storage required to hold an array is directly related to its type and size. For a single-dimension array, the total size in bytes is computed as shown here: + +total bytes = sizeof(base type) x size of array + +C/C++ has no bounds checking on arrays. You could overwrite either end of an array and write into some other variable's data or even into the program's code. As the programmer, it is your job to provide bounds checking where needed. For example, this code will compile without error, but is incorrect because the for loop will cause the array count to be overrun. + + +int count[10], i; + +/* this causes count to be overrun */ for(i=0; i<100; i++) count[i] = i; + +Single-dimension arrays are essentially lists of information of the same type that are stored in contiguous memory locations in index order. For example, Figure 4-1 shows how array a appears in memory if it starts at memory location 1000 and is declared as shown here: + + +char a[7]; + + + +Element Address + +a[0] a[1] a[2] a[3] a[4] 1000 1001 1002 1003 1004 + +a[5] a[6] 1005 1006 + + + +Figure 4-1. A seven-element character array beginning at location 1000 +92 C + + : T h e C o m p l e t e R e f e r e n c e + + +Generating a Pointer to an Array +You can generate a pointer to the first element of an array by simply specifying the array name, without any index. For example, given + + +int sample[10]; + +you can generate a pointer to the first element by using the name sample. Thus, the following program fragment assigns p the address of the first element of sample: + + +int *p; +int sample[10]; + +p = sample; + +You can also specify the address of the first element of an array using the & operator. For example, sample and &sample[0] both produce the same results. However, in professionally written C/C++ code, you will almost never see &sample[0]. + + +Passing Single-Dimension Arrays to Functions In C/C++, you cannot pass an entire array as an argument to a function. You can, however, pass to the function a pointer to an array by specifying the array's name +without an index. For example, the following program fragment passes the address of i to func1() : + +int main(void) { +int i[10]; + +func1(i); . +. . +} + +If a function receives a single-dimension array, you may declare its formal parameter in one of three ways: as a pointer, as a sized array, or as an unsized array. For example, to receive i, a function called func1() can be declared as +C h a p t e r 4 : A r r a y s a n d N u l l - T e r m i n a t e d S t r i n g s 93 + + +void func1(int *x) /* pointer */ { +. . . +} + +or + +void func1(int x[10]) /* sized array */ { +. . . +} + +or finally as + +void func1(int x[]) /* unsized array */ { +. . . +} + +All three declaration methods produce similar results because each tells the compiler that an integer pointer is going to be received. The first declaration actually uses a pointer. The second employs the standard array declaration. In the final version, a modified version of an array declaration simply specifies that an array of type int of some length is to be received. As you can see, the length of the array doesn't matter as far as the function is concerned because C/C++ performs no bounds checking. In fact, as far as the compiler is concerned, + + +void func1(int x[32]) { +. . . +} + +also works because the compiler generates code that instructs func1() to receive a pointer—it does not actually create a 32-element array. +94 C + + : T h e C o m p l e t e R e f e r e n c e + + +Null-Terminated Strings +By far the most common use of the one-dimensional array is as a character string. C++ supports two types of strings. The first is the null-terminated string, which is a +null-terminated character array. (A null is zero.) Thus a null-terminated string contains the characters that comprise the string followed by a null. This is the only type of string defined by C, and it is still the most widely used. Sometimes null-terminated strings are called C-strings. C++ also defines a string class, called string, which provides an object-oriented approach to string handling. It is described later in this book. Here, +null-terminated strings are examined. +When declaring a character array that will hold a null-terminated string, you need to declare it to be one character longer than the largest string that it is to hold. For example, to declare an array str that can hold a 10-character string, you would write + + +char str[11]; + +This makes room for the null at the end of the string. +When you use a quoted string constant in your program, you are also creating a null-terminated string. A string constant is a list of characters enclosed in double quotes. For example, + +"hello there" + +You do not need to add the null to the end of string constants manually—the compiler does this for you automatically. +C/C++ supports a wide range of functions that manipulate null-terminated strings. The most common are + + +Name + +strcpy(s1, s2) strcat(s1, s2) strlen(s1) strcmp(s1, s2) + +strchr(s1, ch) +strstr(s1, s2) + +Function + +Copies s2 into s1. +Concatenates s2 onto the end of s1. Returns the length of s1. +Returns 0 if s1 and s2 are the same; less than 0 if s1s2. +Returns a pointer to the first occurrence of ch in s1. +Returns a pointer to the first occurrence of s2 in s1. + + +These functions use the standard header file string.h. (C++ programs can also use the new-style header .) The following program illustrates the use of these string functions: +C h a p t e r 4 : A r r a y s a n d N u l l - T e r m i n a t e d S t r i n g s 95 + + +#include #include + +int main(void) { +char s1[80], s2[80]; + +gets(s1); gets(s2); + +printf("lengths: %d %d\n", strlen(s1), strlen(s2)); + +if(!strcmp(s1, s2)) printf("The strings are equal\n"); + +strcat(s1, s2); printf("%s\n", s1); + +strcpy(s1, "This is a test.\n"); printf(s1); +if(strchr("hello", 'e')) printf("e is in hello\n"); if(strstr("hi there", "hi")) printf("found hi"); + +return 0; } + +If you run this program and enter the strings "hello" and "hello", the output is + +lengths: 5 5 +The strings are equal hellohello +This is a test. e is in hello found hi + +Remember, strcmp() returns false if the strings are equal. Be sure to use the logical operator ! to reverse the condition, as just shown, if you are testing for equality. +Although C++ now defines a string class, null-terminated strings are still widely used in existing programs. They will probably stay in wide use because they offer a high level of efficiency and afford the programmer detailed control of string operations. However, for many simple string-handling chores, C++'s string class provides a convenient alternative. +96 C + + : T h e C o m p l e t e R e f e r e n c e + + +Two-Dimensional Arrays +C/C++ supports multidimensional arrays. The simplest form of the multidimensional array is the two-dimensional array. A two-dimensional array is, essentially, an array of one-dimensional arrays. To declare a two-dimensional integer array d of size 10,20, you would write + + +int d[10][20]; + +Pay careful attention to the declaration. Some other computer languages use commas to separate the array dimensions; C/C++, in contrast, places each dimension in its own set of brackets. +Similarly, to access point 1,2 of array d, you would use + + +d[1][2] + +The following example loads a two-dimensional array with the numbers 1 through 12 and prints them row by row. + + +#include + +int main(void) { +int t, i, num[3][4]; + +for(t=0; t<3; ++t) for(i=0; i<4; ++i) +num[t][i] = (t*4)+i+1; + +/* now print them out */ for(t=0; t<3; ++t) { +for(i=0; i<4; ++i) printf("%3d ", num[t][i]); +printf("\n"); } + +return 0; } + +In this example, num[0][0] has the value 1, num[0][1] the value 2, num[0][2] the value 3, and so on. The value of num[2][3] will be 12. You can visualize the num array as shown here: +C h a p t e r 4 : A r r a y s a n d N u l l - T e r m i n a t e d S t r i n g s 97 + + + + + + + + + + + + + + + +Two-dimensional arrays are stored in a row-column matrix, where the first index indicates the row and the second indicates the column. This means that the rightmost index changes faster than the leftmost when accessing the elements in the array in the order in which they are actually stored in memory. See Figure 4-2 for a graphic representation of a two-dimensional array in memory. +In the case of a two-dimensional array, the following formula yields the number of bytes of memory needed to hold it: + +bytes = size of 1st index x size of 2nd index x sizeof(base type) + +Therefore, assuming 4-byte integers, an integer array with dimensions 10,5 would have + +10 x 5 x 4 + +or 200 bytes allocated. + + + + + + + + + + + + + + +Figure 4-2. A two-dimensional array in memory +98 C + + : T h e C o m p l e t e R e f e r e n c e + + +When a two-dimensional array is used as an argument to a function, only a pointer to the first element is actually passed. However, the parameter receiving a two-dimensional array must define at least the size of the rightmost dimension. (You can specify the left dimension if you like, but it is not necessary.) The rightmost dimension is needed because the compiler must know the length of each row if it is to index the array correctly. For example, a function that receives a two-dimensional integer array with dimensions 10,10 is declared like this: + + +void func1(int x[][10]) { +. . . +} + +The compiler needs to know the size of the right dimension in order to correctly execute expressions such as + + +x[2][4] + +inside the function. If the length of the rows is not known, the compiler cannot determine where the third row begins. +The following short program uses a two-dimensional array to store the numeric grade for each student in a teacher's classes. The program assumes that the teacher has three classes and a maximum of 30 students per class. Notice the way the array grade is accessed by each of the functions. + +/* A simple student grades database. */ #include +#include #include + +#define CLASSES 3 #define GRADES 30 + +int grade[CLASSES][GRADES]; + +void enter_grades(void); int get_grade(int num); +void disp_grades(int g[][GRADES]); +C h a p t e r 4 : A r r a y s a n d N u l l - T e r m i n a t e d S t r i n g s 99 + + + +int main(void) { +char ch, str[80]; + +for(;;) { do { +printf("(E)nter grades\n"); printf("(R)eport grades\n"); printf("(Q)uit\n"); gets(str); +ch = toupper(*str); +} while(ch!='E' && ch!='R' && ch!='Q'); + +switch(ch) { case 'E': +enter_grades(); break; +case 'R': disp_grades(grade); break; +case 'Q': exit(0); +} } + +return 0; } + +/* Enter the student's grades. */ void enter_grades(void) +{ +int t, i; + +for(t=0; t + +#define MAX 100 #define LEN 80 + +char text[MAX][LEN]; + +int main(void) { +register int t, i, j; + +printf("Enter an empty line to quit.\n"); + +for(t=0; t +#include + +char matrix[3][3]; /* the tic tac toe matrix */ + +char check(void); +void init_matrix(void); void get_player_move(void); +void get_computer_move(void); void disp_matrix(void); + +int main(void) { +char done; + +printf("This is the game of Tic Tac Toe.\n"); printf("You will be playing against the computer.\n"); + +done = ' '; +C h a p t e r 4 : A r r a y s a n d N u l l - T e r m i n a t e d S t r i n g s 109 + + + +init_matrix(); do{ +disp_matrix(); get_player_move(); +done = check(); /* see if winner */ if(done!= ' ') break; /* winner!*/ get_computer_move(); +done = check(); /* see if winner */ } while(done== ' '); +if(done=='X') printf("You won!\n"); else printf("I won!!!!\n"); +disp_matrix(); /* show final positions */ + +return 0; } + +/* Initialize the matrix. */ void init_matrix(void) +{ +int i, j; + +for(i=0; i<3; i++) +for(j=0; j<3; j++) matrix[i][j] = ' '; } + +/* Get a player's move. */ void get_player_move(void) { +int x, y; + +printf("Enter X,Y coordinates for your move: "); scanf("%d%*c%d", &x, &y); + +x--; y--; + +if(matrix[x][y]!= ' '){ +printf("Invalid move, try again.\n"); get_player_move(); +} +else matrix[x][y] = 'X'; } +110 C + + : T h e C o m p l e t e R e f e r e n c e + + + +/* Get a move from the computer. */ void get_computer_move(void) +{ +int i, j; +for(i=0; i<3; i++){ for(j=0; j<3; j++) +if(matrix[i][j]==' ') break; if(matrix[i][j]==' ') break; +} + +if(i*j==9) { printf("draw\n"); exit(0); +} else +matrix[i][j] = 'O'; } + +/* Display the matrix on the screen. */ void disp_matrix(void) +{ +int t; + +for(t=0; t<3; t++) { +printf(" %c | %c | %c ",matrix[t][0], matrix[t][1], matrix [t][2]); +if(t!=2) printf("\n---|---|---\n"); } +printf("\n"); } + +/* See if there is a winner. */ char check(void) +{ +int i; + +for(i=0; i<3; i++) /* check rows */ if(matrix[i][0]==matrix[i][1] && +matrix[i][0]==matrix[i][2]) return matrix[i][0]; + +for(i=0; i<3; i++) /* check columns */ if(matrix[0][i]==matrix[1][i] && +C h a p t e r 4 : A r r a y s a n d N u l l - T e r m i n a t e d S t r i n g s 111 + + + +matrix[0][i]==matrix[2][i]) return matrix[0][i]; + +/* test diagonals */ if(matrix[0][0]==matrix[1][1] && +matrix[1][1]==matrix[2][2]) return matrix[0][0]; + +if(matrix[0][2]==matrix[1][1] && matrix[1][1]==matrix[2][0]) +return matrix[0][2]; + +return ' '; } + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 5 Pointers + + + + + + + + + + + + + + +113 +114 C + + : T h e C o m p l e t e R e f e r e n c e + + +he correct understanding and use of pointers is critical to successful C/C++ programming. There are three reasons for this: First, pointers provide the means by which functions can modify their calling arguments. Second, pointers support +T +dynamic allocation. Third, pointers can improve the efficiency of certain routines. Also, as you will see in Part Two, pointers take on additional roles in C++. +Pointers are one of the strongest but also one of the most dangerous features in C/C++. For example, uninitialized pointers (or pointers containing invalid values) can cause your system to crash. Perhaps worse, it is easy to use pointers incorrectly, causing bugs that are very difficult to find. +Because of both their importance and their potential for abuse, this chapter examines the subject of pointers in detail. + + +What Are Pointers? +A pointer is a variable that holds a memory address. This address is the location of another object (typically another variable) in memory. For example, if one variable contains the address of another variable, the first variable is said to point to the second. Figure 5-1 illustrates this situation. + + + + + + + + + + + + + + + + + + + + + + +Figure 5-1. One variable points to another +C h a p t e r 5 : P o i n t e r s 115 + + +Pointer Variables +If a variable is going to hold a pointer, it must be declared as such. A pointer declaration consists of a base type, an *, and the variable name. The general form for declaring a pointer variable is + +type *name; + +where type is the base type of the pointer and may be any valid type. The name of the pointer variable is specified by name. +The base type of the pointer defines what type of variables the pointer can point to. Technically, any type of pointer can point anywhere in memory. However, all pointer arithmetic is done relative to its base type, so it is important to declare the pointer correctly. (Pointer arithmetic is discussed later in this chapter.) + + +The Pointer Operators +The pointer operators were discussed in Chapter 2. We will take a closer look at them here, beginning with a review of their basic operation. There are two special pointer operators: * and &. The & is a unary operator that returns the memory address of its operand. (Remember, a unary operator only requires one operand.) +For example, + +m = &count; + +places into m the memory address of the variable count. This address is the computer's internal location of the variable. It has nothing to do with the value of count. You can think of & as returning "the address of." Therefore, the preceding assignment statement means "m receives the address of count." +To understand the above assignment better, assume that the variable count uses memory location 2000 to store its value. Also assume that count has a value of 100. Then, after the preceding assignment, m will have the value 2000. +The second pointer operator, *, is the complement of &. It is a unary operator that returns the value located at the address that follows. For example, if m contains the memory address of the variable count, + +q = *m; + +places the value of count into q. Thus, q will have the value 100 because 100 is stored at location 2000, which is the memory address that was stored in m. You can think of +116 C + + : T h e C o m p l e t e R e f e r e n c e + + +* as "at address." In this case, the preceding statement means "q receives the value at address m." +Both & and * have a higher precedence than all other arithmetic operators except the unary minus, with which they are equal. +You must make sure that your pointer variables always point to the correct type of data. For example, when you declare a pointer to be of type int, the compiler assumes that any address that it holds points to an integer variable—whether it actually does or not. Because C allows you to assign any address to a pointer variable, the following code fragment compiles with no error messages (or only warnings, depending upon your compiler), but does not produce the desired result: + +#include + +int main(void) { +double x = 100.1, y; int *p; + +/* The next statement causes p (which is an integer pointer) to point to a double. */ +p = &x; + +/* The next statement does not operate as expected. */ +y = *p; + + +printf("%f", y); /* won't output 100.1 */ return 0; +} + +This will not assign the value of x to y. Because p is declared as an integer pointer, only 2 or 4 bytes of information will be transferred to y, not the 8 bytes that normally make up a double. + + +Note + +InC++,itisillegaltoconvertonetypeofpointerintoanotherwithouttheuseofan explicit type cast. For this reason, the preceding program will not even compile if you try to compile it as a C++ (rather than as a C) program. However, the type of error described can still occur in C++ in a more roundabout manner. + + + +Pointer Expressions +In general, expressions involving pointers conform to the same rules as other expressions. This section examines a few special aspects of pointer expressions. +C h a p t e r 5 : P o i n t e r s 117 + + +Pointer Assignments +As with any variable, you may use a pointer on the right-hand side of an assignment statement to assign its value to another pointer. For example, + + +#include + +int main(void) { +int x; +int *p1, *p2; + +p1 = &x; p2 = p1; + +printf(" %p", p2); /* print the address of x, not x's value! */ + +return 0; } + +Both p1 and p2 now point to x. The address of x is displayed by using the %p printf() format specifier, which causes printf() to display an address in the format used by the host computer. + +Pointer Arithmetic +There are only two arithmetic operations that you may use on pointers: addition and subtraction. To understand what occurs in pointer arithmetic, let p1 be an integer pointer with a current value of 2000. Also, assume integers are 2 bytes long. After the expression + + +p1++; + +p1 contains 2002, not 2001. The reason for this is that each time p1 is incremented, it will point to the next integer. The same is true of decrements. For example, assuming that p1 has the value 2000, the expression + + +p1--; + +causes p1 to have the value 1998. +Generalizing from the preceding example, the following rules govern pointer arithmetic. Each time a pointer is incremented, it points to the memory location of the next element of its base type. Each time it is decremented, it points to the location of the previous element. When applied to character pointers, this will +118 C + + : T h e C o m p l e t e R e f e r e n c e + + +appear as "normal" arithmetic because characters are always 1 byte long. All other pointers will increase or decrease by the length of the data type they point to. This approach ensures that a pointer is always pointing to an appropriate element of its base type. Figure 5-2 illustrates this concept. +You are not limited to the increment and decrement operators. For example, you may add or subtract integers to or from pointers. The expression + +p1 = p1 + 12; + +makes p1 point to the twelfth element of p1's type beyond the one it currently points to. Besides addition and subtraction of a pointer and an integer, only one other +arithmetic operation is allowed: You may subtract one pointer from another in order to find the number of objects of their base type that separate the two. All other arithmetic operations are prohibited. Specifically, you may not multiply or +divide pointers; you may not add two pointers; you may not aypply the bitwise operators to them; and you may not add or subtract type float or double to or from pointers. + + + + + + + + + + + + + + + + + + + + + +Figure 5-2. All pointer arithmetic is relative to its base type (assume 2-byte integers) +C h a p t e r 5 : P o i n t e r s 119 + + +Pointer Comparisons +You can compare two pointers in a relational expression. For instance, given two pointers p and q, the following statement is perfectly valid: + + +if(p #include + +#define SIZE 50 + +void push(int i); int pop(void); + +int *tos, *p1, stack[SIZE]; + +int main(void) { +int value; + +tos = stack; /* tos points to the top of stack */ p1 = stack; /* initialize p1 */ + +do { +printf("Enter value: "); scanf("%d", &value); if(value!=0) push(value); +else printf("value on top is %d\n", pop()); } while(value!=-1); +120 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +return 0; } + +void push(int i) { +p1++; if(p1==(tos+SIZE)) { +printf("Stack Overflow.\n"); exit(1); +} +*p1 = i; } + +int pop(void) { +if(p1==tos) { +printf("Stack Underflow.\n"); exit(1); +} +p1--; +return *(p1+1); } + +You can see that memory for the stack is provided by the array stack. The pointer p1 is set to point to the first element in stack. The p1 variable accesses the stack. The variable tos holds the memory address of the top of the stack. It is used to prevent stack overflows and underflows. Once the stack has been initialized, push() and pop() may be used. Both the push() and pop() functions perform a relational test on the pointer p1 to detect limit errors. In push() , p1 is tested against the end of stack by adding SIZE (the size of the stack) to tos. This prevents an overflow. In pop() , p1 is checked against tos to be sure that a stack underflow has not occurred. +In pop() , the parentheses are necessary in the return statement. Without them, the statement would look like this: + + +return *p1 +1; + +which would return the value at location p1 plus one, not the value of the location p1+1. + + +Pointers and Arrays +There is a close relationship between pointers and arrays. Consider this program fragment: +C h a p t e r 5 : P o i n t e r s 121 + + +char str[80], *p1; p1 = str; + +Here, p1 has been set to the address of the first array element in str. To access the fifth element in str, you could write + + +str[4] + +or + +*(p1+4) + +Both statements will return the fifth element. Remember, arrays start at 0. To access the fifth element, you must use 4 to index str. You also add 4 to the pointer p1 to access the fifth element because p1 currently points to the first element of str. (Recall that an array name without an index returns the starting address of the array, which is the address of the first element.) +The preceding example can be generalized. In essence, C/C++ provides +two methods of accessing array elements: pointer arithmetic and array indexing. Although the standard array-indexing notation is sometimes easier to understand, pointer arithmetic can be faster. Since speed is often a consideration in programming, C/C++ programmers commonly use pointers to access array elements. +These two versions of putstr()— one with array indexing and one with pointers— illustrate how you can use pointers in place of array indexing. The putstr() function writes a string to the standard output device one character at a time. + +/* Index s as an array. */ void putstr(char *s) +{ +register int t; + +for(t=0; s[t]; ++t) putchar(s[t]); } + +/* Access s as a pointer. */ void putstr(char *s) +{ +while(*s) putchar(*s++); } + +Most professional C/C++ programmers would find the second version easier to read and understand. In fact, the pointer version is the way routines of this sort are commonly written in C/C++. +122 C + + : T h e C o m p l e t e R e f e r e n c e + + +Arrays of Pointers +Pointers may be arrayed like any other data type. The declaration for an int pointer array of size 10 is + + +int *x[10]; + +To assign the address of an integer variable called var to the third element of the pointer array, write + + +x[2] = &var; + +To find the value of var, write + +*x[2] + +If you want to pass an array of pointers into a function, you can use the same method that you use to pass other arrays—simply call the function with the array name without any indexes. For example, a function that can receive array x looks +like this: + + +void display_array(int *q[]) { +int t; + +for(t=0; t<10; t++) printf("%d ", *q[t]); +} + +Remember, q is not a pointer to integers, but rather a pointer to an array of pointers to integers. Therefore you need to declare the parameter q as an array of integer pointers, as just shown. You cannot declare q simply as an integer pointer because that is not what it is. +Pointer arrays are often used to hold pointers to strings. You can create a function that outputs an error message given its code number, as shown here: + +void syntax_error(int num) { +static char *err[] = { "Cannot Open File\n", "Read Error\n", +C h a p t e r 5 : P o i n t e r s 123 + + + +"Write Error\n", "Media Failure\n" +}; + +printf("%s", err[num]); } + +The array err holds pointers to each string. As you can see, printf() inside syntax_error() is called with a character pointer that points to one of the various error messages indexed by the error number passed to the function. For example, if num is passed a 2, the message Write Error is displayed. +As a point of interest, note that the command line argument argv is an array of character pointers. (See Chapter 6.) + + +Multiple Indirection +You can have a pointer point to another pointer that points to the target value. This situation is called multiple indirection, or pointers to pointers. Pointers to pointers can be confusing. Figure 5-3 helps clarify the concept of multiple indirection. As you can see, the value of a normal pointer is the address of the object that contains the value +desired. In the case of a pointer to a pointer, the first pointer contains the address of the second pointer, which points to the object that contains the value desired. +Multiple indirection can be carried on to whatever extent rquired, but more than a pointer to a pointer is rarely needed. In fact, excessive indirection is difficult to follow and prone to conceptual errors. + + +Note + +Do not confuse multiple indirection with high-level data structures, such as linked lists, that use pointers. These are two fundamentally different concepts. + + +A variable that is a pointer to a pointer must be declared as such. You do this by placing an additional asterisk in front of the variable name. For example, the following declaration tells the compiler that newbalance is a pointer to a pointer of type float: + + +float **newbalance; + +You should understand that newbalance is not a pointer to a floating-point number but rather a pointer to a float pointer. +To access the target value indirectly pointed to by a pointer to a pointer, you must apply the asterisk operator twice, as in this example: +124 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include + +int main(void) { +int x, *p, **q; + +x = 10; p = &x; q = &p; + +printf("%d", **q); /* print the value of x */ + +return 0; } + +Here, p is declared as a pointer to an integer and q as a pointer to a pointer to an integer. The call to printf() prints the number 10 on the screen. + + +Initializing Pointers +After a local pointer is declared but before it has been assigned a value, it contains an unknown value. (Global pointers are automatically initialized to null.) Should you try to use the pointer before giving it a valid value, you will probably crash + + + + + + + + + + + + + + + + + + +Figure 5-3. Single and multiple indirection +C h a p t e r 5 : P o i n t e r s 125 + + +your program—and possibly your computer's operating system as well—a very nasty type of error! +There is an important convention that most C/C++ programmers follow when working with pointers: A pointer that does not currently point to a valid memory location is given the value null (which is zero). By convention, any pointer that is null implies that it points to nothing and should not be used. However, just because +a pointer has a null value does not make it "safe." The use of null is simply a convention that programmers follow. It is not a rule enforced by the C or C++ languages. For example, if you use a null pointer on the left side of an assignment statement, you still run the risk of crashing your program or operating system. +Because a null pointer is assumed to be unused, you can use the null pointer to make many of your pointer routines easier to code and more efficient. For example, you could use a null pointer to mark the end of a pointer array. A routine that accesses that array knows that it has reached the end when it encounters the null value. The search() function shown here illustrates this type of approach. + +/* look up a name */ +int search(char *p[], char *name) { +register int t; + +for(t=0; p[t]; ++t) if(!strcmp(p[t], name)) return t; + +return -1; /* not found */ } + +The for loop inside search() runs until either a match is found or a null pointer +is encountered. Assuming the end of the array is marked with a null, the condition controlling the loop fails when it is reached. +C/C++ programmers commonly initialize strings. You saw an example of this in the syntax_error() function in the section "Arrays of Pointers." Another variation on the initialization theme is the following type of string declaration: + + +char *p = "hello world"; + +As you can see, the pointer p is not an array. The reason this sort of initialization works is because of the way the compiler operates. All C/C++ compilers create what is called a string table, which is used to store the string constants used by the program. Therefore, the preceding declaration statement places the address +of hello world, as stored in the string table, into the pointer p. Throughout a +126 C + + : T h e C o m p l e t e R e f e r e n c e + + +program, p can be used like any other string. For example, the following program is perfectly valid: + + +#include #include + +char *p = "hello world"; + +int main(void) { +register int t; + +/* print the string forward and backwards */ printf(p); +for(t=strlen(p)-1; t>-1; t--) printf("%c", p[t]); + +return 0; } + +In Standard C++, the type of a string literal is technically const char *. But C++ provides an automatic conversion to char *. Thus, the preceding program is still valid. However, this automatic conversion is a deprecated feature, which means that you should not rely upon it for new code. For new programs, you should assume that string literals are constants and the declaration of p in the preceding program should be written like this. + + +const char *p = "hello world"; + + +Pointers to Functions +A particularly confusing yet powerful feature of C++ is the function pointer. Even though a function is not a variable, it still has a physical location in memory that can be assigned to a pointer. This address is the entry point of the function and it is +the address used when the function is called. Once a pointer points to a function, the function can be called through that pointer. Function pointers also allow functions to be passed as arguments to other functions. +You obtain the address of a function by using the function's name without any parentheses or arguments. (This is similar to the way an array's address is obtained when only the array name, without indexes, is used.) To see how this is done, study the following program, paying close attention to the declarations: +C h a p t e r 5 : P o i n t e r s 127 + + +#include #include + +void check(char *a, char *b, +int (*cmp)(const char *, const char *)); + +int main(void) { +char s1[80], s2[80]; +int (*p)(const char *, const char *); + +p = strcmp; + +gets(s1); gets(s2); + +check(s1, s2, p); + +return 0; } + +void check(char *a, char *b, +int (*cmp)(const char *, const char *)) { +printf("Testing for equality.\n"); if(!(*cmp)(a, b)) printf("Equal"); else printf("Not Equal"); +} + +When the check() function is called, two character pointers and one function pointer are passed as parameters. Inside the function check() , the arguments are declared as character pointers and a function pointer. Notice how the function pointer is declared. You must use a similar form when declaring other function pointers, although the return type and parameters of the function may differ. The parentheses around the *cmp are necessary for the compiler to interpret this statement correctly. +Inside check() , the expression + + +(*cmp)(a, b) + +calls strcmp() , which is pointed to by cmp, with the arguments a and b. The parentheses around *cmp are necessary. This is one way to call a function through a pointer. A second, simpler syntax, as shown here, may also be used. +128 C + + : T h e C o m p l e t e R e f e r e n c e + + +cmp(a, b); + +The reason that you will frequently see the first style is that it tips off anyone reading your code that a function is being called through a pointer. (That is, that +cmp is a function pointer, not the name of a function.) Other than that, the two expressions are equivalent. +Note that you can call check() by using strcmp() directly, as shown here: + +check(s1, s2, strcmp); + +This eliminates the need for an additional pointer variable. +You may wonder why anyone would write a program in this way. Obviously, nothing is gained and significant confusion is introduced in the previous example. However, at times it is advantageous to pass functions as parameters or to create an array of functions. For example, when a compiler or interpreter is written, the parser (the part that evaluates expressions) often calls various support functions, such as those that compute mathematical operations (sine, cosine, tangent, etc.), perform I/O, or access system resources. Instead of having a large switch statement with all of these functions listed in it, an array of function pointers can be created. In this approach, the proper function is selected by its index. You can get the flavor of this type of usage by studying the expanded version of the previous example. In this program, check() can be made to check for either alphabetical equality or numeric equality by simply calling it with a different comparison function. + + +#include #include #include #include + +void check(char *a, char *b, +int (*cmp)(const char *, const char *)); int numcmp(const char *a, const char *b); + +int main(void) { +char s1[80], s2[80]; + +gets(s1); gets(s2); + +if(isalpha(*s1)) +C h a p t e r 5 : P o i n t e r s 129 + + + +check(s1, s2, strcmp); else +check(s1, s2, numcmp); + +return 0; } + +void check(char *a, char *b, +int (*cmp)(const char *, const char *)) { +printf("Testing for equality.\n"); if(!(*cmp)(a, b)) printf("Equal"); else printf("Not Equal"); +} + +int numcmp(const char *a, const char *b) { +if(atoi(a)==atoi(b)) return 0; else return 1; +} + + +In this program, if you enter a letter, strcmp() is passed to check() . Otherwise, numcmp() is used. Since check() calls the function that it is passed, it can use different comparison functions in different cases. + + +C's Dynamic Allocation Functions +Pointers provide necessary support for C/C++'s dynamic allocation system. Dynamic allocation is the means by which a program can obtain memory while it is running. As you know, global variables are allocated storage at compile time. Local variables use the stack. However, neither global nor local variables can be added during program execution. Yet there will be times when the storage needs of a program cannot be known ahead of time. For example, a word processor or a database should +take advantage of all the RAM in a system. However, because the amount of available RAM varies between computers, such programs will not be able to do so using normal variables. Instead, these and other programs must allocate memory as +they need it. +C++ actually supports two complete dynamic allocation systems: the one defined by C and the one specific to C++. The system specific to C++ contains several improvements over that used by C, and this approach is discussed in Part Two. Here, C's dynamic allocation functions are described. +130 C + + : T h e C o m p l e t e R e f e r e n c e + + +Memory allocated by C's dynamic allocation functions is obtained from the +heap—the region of free memory that lies between your program and its permanent storage area and the stack. Although the size of the heap is unknown, it generally contains a fairly large amount of free memory. +The core of C's allocation system consists of the functions malloc() and free() . (Most compilers supply several other dynamic allocation functions, but these two +are the most important.) These functions work together using the free memory region to establish and maintain a list of available storage. The malloc() function allocates memory and the free() function releases it. That is, each time a malloc() memory request is made, a portion of the remaining free memory is allocated. Each time a free() memory release call is made, memory is returned to the system. Any program that uses these functions should include the header file stdlib.h. (A C++ program may also use the new-style header .) +The malloc() function has this prototype: + +void *malloc(size_t number_of_bytes); + +Here, number_of_bytes is the number of bytes of memory you wish to allocate. (The type size_t is defined in stdlib.h as, more or less, an unsigned integer.) The malloc() function returns a pointer of type void, which means that you can assign it to any type of pointer. After a successful call, malloc() returns a pointer to the first byte +of the region of memory allocated from the heap. If there is not enough available memory to satisfy the malloc() request, an allocation failure occurs and malloc() returns a null. +The code fragment shown here allocates 1,000 bytes of contiguous memory: + +char *p; +p = malloc(1000); /* get 1000 bytes */ + +After the assignment, p points to the start of 1,000 bytes of free memory. +In the preceding example, notice that no type cast is used to assign the return value of malloc() to p. In C, a void * pointer is automatically converted to the type +of the pointer on the left side of an assignment. However, it is important to understand that this automatic conversion does not occur in C++. In C++, an explicit type cast is needed when a void * pointer is assigned to another type of pointer. Thus, in C++, the preceding assignment must be written like this: + + +p = (char *) malloc(1000); + +As a general rule, in C++ you must use a type cast when assigning (or otherwise converting) one type of pointer to another. This is one of the few fundamental differences between C and C++. +C h a p t e r 5 : P o i n t e r s 131 + + +The next example allocates space for 50 integers. Notice the use of sizeof to ensure portability. + + +int *p; +p = (int *) malloc(50*sizeof(int)); + +Since the heap is not infinite, whenever you allocate memory, you must check +the value returned by malloc() to make sure that it is not null before using the pointer. Using a null pointer will almost certainly crash your program. The proper way to allocate memory and test for a valid pointer is illustrated in this code fragment: + + +p = (int *) malloc(100); if(!p) { +printf("Out of memory.\n"); exit(1); +} + +Of course, you can substitute some other sort of error handler in place of the call to exit() . Just make sure that you do not use the pointer p if it is null. +The free() function is the opposite of malloc() in that it returns previously allocated memory to the system. Once the memory has been freed, it may be reused by a subsequent call to malloc() . The function free() has this prototype: + +void free(void *p); +Here, p is a pointer to memory that was previously allocated using malloc() . +It is critical that you never call free() with an invalid argument; this will destroy the free list. + + +Problems with Pointers +Nothing will get you into more trouble than a wild pointer! Pointers are a mixed blessing. They give you tremendous power and are necessary for many programs. At the same time, when a pointer accidentally contains a wrong value, it can be the most difficult bug to find. +An erroneous pointer is difficult to find because the pointer itself is not the problem. The problem is that each time you perform an operation using the bad pointer, you are reading or writing to some unknown piece of memory. If you read from it, the worst that can happen is that you get garbage. However, if you write to it, you might be writing over other pieces of your code or data. This may not show up until later in the execution of your program, and may lead you to look for the bug in the wrong place. There may be little or no evidence to suggest that the pointer is +132 C + + : T h e C o m p l e t e R e f e r e n c e + + +the original cause of the problem. This type of bug causes programmers to lose sleep time and time again. +Because pointer errors are such nightmares, you should do your best never to generate one. To help you avoid them, a few of the more common errors are discussed here. The classic example of a pointer error is the uninitialized pointer. Consider this program. + +/* This program is wrong. */ int main(void) +{ +int x, *p; + +x = 10; *p = x; + +return 0; } + +This program assigns the value 10 to some unknown memory location. Here is why: Since the pointer p has never been given a value, it contains an unknown value when the assignment *p = x takes place. This causes the value of x to be written to some unknown memory location. This type of problem often goes unnoticed when your program is small because the odds are in favor of p containing a "safe" address—one that is not in your code, data area, or operating system. However, as your program grows, the probability increases of p pointing to something vital. Eventually, your program stops working. The solution is to always make sure that a pointer is pointing at something valid before it is used. +A second common error is caused by a simple misunderstanding of how to use a pointer. Consider the following: + +/* This program is wrong. */ #include + +int main(void) { +int x, *p; + +x = 10; p = x; +C h a p t e r 5 : P o i n t e r s 133 + + + +printf("%d", *p); + +return 0; } + +The call to printf() does not print the value of x, which is 10, on the screen. It prints some unknown value because the assignment + + +p = x; + +is wrong. That statement assigns the value 10 to the pointer p. However, p is supposed to contain an address, not a value. To correct the program, write + + +p = &x; + +Another error that sometimes occurs is caused by incorrect assumptions about the placement of variables in memory. You can never know where your data will be placed in memory, or if it will be placed there the same way again, or whether each compiler will treat it in the same way. For these reasons, making any comparisons between pointers that do not point to a common object may yield unexpected results. For example, + + +char s[80], y[80]; char *p1, *p2; + +p1 = s; p2 = y; +if(p1 < p2) . . . + +is generally an invalid concept. (In very unusual situations, you might use something like this to determine the relative position of the variables. But this would be rare.) +A related error results when you assume that two adjacent arrays may be indexed as one by simply incrementing a pointer across the array boundaries. For example, + + +int first[10], second[10]; int *p, t; + +p = first; +for(t=0; t<20; ++t) *p++ = t; +134 C + + : T h e C o m p l e t e R e f e r e n c e + + +This is not a good way to initialize the arrays first and second with the numbers 0 through 19. Even though it may work on some compilers under certain circumstances, it assumes that both arrays will be placed back to back in memory with first first. This may not always be the case. +The next program illustrates a very dangerous type of bug. See if you can find it. + +/* This program has a bug. */ #include +#include + +int main(void) { +char *p1; char s[80]; + +p1 = s; do { +gets(s); /* read a string */ + +/* print the decimal equivalent of each character */ +while(*p1) printf(" %d", *p1++); + +} while(strcmp(s, "done")); + +return 0; } + +This program uses p1 to print the ASCII values associated with the characters contained in s. The problem is that p1 is assigned the address of s only once. The first time through the loop, p1 points to the first character in s. However, the second time through, it continues where it left off because it is not reset to the start of s. This next character may be part of the second string, another variable, or a piece of the program! The proper way to write this program is + + +/* This program is now correct. */ #include +#include + +int main(void) { +char *p1; +C h a p t e r 5 : P o i n t e r s 135 + + + +char s[80]; + +do { +p1 = s; +gets(s); /* read a string */ + +/* print the decimal equivalent of each character */ +while(*p1) printf(" %d", *p1++); + +} while(strcmp(s, "done")); + +return 0; } + +Here, each time the loop iterates, p1 is set to the start of the string. In general, you should remember to reinitialize a pointer if it is to be reused. +The fact that handling pointers incorrectly can cause tricky bugs is no reason to avoid using them. Just be careful, and make sure that you know where each pointer is pointing before you use it. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 6 Functions + + + + + + + + + + + + + + +137 +138 C + + : T h e C o m p l e t e R e f e r e n c e + + +unctions are the building blocks of C and C++ and the place where all program activity occurs. This chapter examines their C-like features, including passing arguments, returning values, prototypes, and recursion. Part Two discusses +F +the C++-specific features of functions, such as function overloading and reference parameters. + + +The General Form of a Function The general form of a function is + +ret-type function-name(parameter list) { +body of the function } + +Theret-typespecifiesthetypeofdatathatthefunctionreturns.Afunctionmayreturn anytypeofdataexceptanarray.Theparameterlistisacomma-separatedlistofvariable namesandtheirassociatedtypesthatreceivethevaluesoftheargumentswhenthe functioniscalled.Afunctionmaybewithoutparameters,inwhichcasetheparameter listisempty.However,eveniftherearenoparameters,theparenthesesarestillrequired. +In variable declarations, you can declare many variables to be of a common type by using a comma-separated list of variable names. In contrast, all function parameters must be declared individually, each including both the type and name. That is, the parameter declaration list for a function takes this general form: + +f(type varname1, type varname2, . . . , type varnameN) + +For example, here are correct and incorrect function parameter declarations: + +f(int i, int k, int j) /* correct */ f(int i, k, float j) /* incorrect */ + +Scope Rules of Functions +The scope rules of a language are the rules that govern whether a piece of code knows about or has access to another piece of code or data. +Each function is a discrete block of code. A function's code is private to that function and cannot be accessed by any statement in any other function except through a call to that function. (For instance, you cannot use goto to jump into the middle of another function.) The code that constitutes the body of a function is hidden from the rest of the program and, unless it uses global variables or data, it can neither affect nor be affected +C h a p t e r 6 : F u n c t i o n s 139 + + +by other parts of the program. Stated another way, the code and data that are defined within one function cannot interact with the code or data defined in another function because the two functions have a different scope. +Variables that are defined within a function are called local variables. A local variable comes into existence when the function is entered and is destroyed upon exit. That is, local variables cannot hold their value between function calls. The only exception to this rule is when the variable is declared with the static storage class specifier. This causes the compiler to treat the variable as if it were a global variable for storage purposes, but limits its scope to within the function. (Chapter 2 covers global and local variables in depth.) +In C (and C++) you cannot define a function within a function. This is why neither C nor C++ are technically block-structured languages. + + +Function Arguments +If a function is to use arguments, it must declare variables that accept the values of the arguments. These variables are called the formal parameters of the function. +They behave like other local variables inside the function and are created upon entry into the function and destroyed upon exit. As shown in the following function, the parameter declarations occur after the function name: + +/* Return 1 if c is part of string s; 0 otherwise. */ int is_in(char *s, char c) +{ +while(*s) +if(*s==c) return 1; else s++; +return 0; } + +The function is_in() has two parameters: s and c. This function returns 1 if the character c is part of the string s; otherwise, it returns 0. +As with local variables, you may make assignments to a function's formal parameters or use them in an expression. Even though these variables perform the special task of receiving the value of the arguments passed to the function, you can use them as you do any other local variable. + +Call by Value, Call by Reference +In a computer language, there are two ways that arguments can be passed to a subroutine. The first is known as call by value. This method copies the value of an +140 C + + : T h e C o m p l e t e R e f e r e n c e + + +argument into the formal parameter of the subroutine. In this case, changes made to the parameter have no effect on the argument. +Call by reference is the second way of passing arguments to a subroutine. In this method, the address of an argument is copied into the parameter. Inside the subroutine, the address is used to access the actual argument used in the call. This means that changes made to the parameter affect the argument. +By default, C/C++ uses call by value to pass arguments. In general, this means that code within a function cannot alter the arguments used to call the function. Consider the following program: + + +#include + +int sqr(int x); + +int main(void) { +int t=10; + +printf("%d %d", sqr(t), t); + +return 0; } + +int sqr(int x) { +x = x*x; return(x); +} + +In this example, the value of the argument to sqr() , 10, is copied into the parameter x. When the assignment x = x*x takes place, only the local variable x is modified. The variable t, used to call sqr() , still has the value 10. Hence, the output is 100 10. +Remember that it is a copy of the value of the argument that is passed into the function. What occurs inside the function has no effect on the variable used in the call. + +Creating a Call by Reference +Even though C/C++ uses call by value for passing parameters, you can create a +call by reference by passing a pointer to an argument, instead of the argument itself. Since the address of the argument is passed to the function, code within the function can change the value of the argument outside the function. +Pointers are passed to functions just like any other value. Of course, you need to declare the parameters as pointer types. For example, the function swap() , +C h a p t e r 6 : F u n c t i o n s 141 + + +which exchanges the values of the two integer variables pointed to by its arguments, shows how. + + +void swap(int *x, int *y) { +int temp; + + +temp = *x; *x = *y; *y = temp; +} + +/* save the value at address x */ /* put y into x */ +/* put x into y */ + + +swap() is able to exchange the values of the two variables pointed to by x and y because their addresses (not their values) are passed. Thus, within the function, +the contents of the variables can be accessed using standard pointer operations, and the contents of the variables used to call the function are swapped. +Remember that swap() (or any other function that uses pointer parameters) must be called with the addresses of the arguments. The following program shows the correct way to call swap() : + +void swap(int *x, int *y); + +int main(void) { +int i, j; + +i = 10; j = 20; + +swap(&i, &j); /* pass the addresses of i and j */ + +return 0; } + +In this example, the variable i is assigned the value 10 and j is assigned the value 20. Then swap() is called with the addresses of i and j. (The unary operator & is used to produce the address of the variables.) Therefore, the addresses of i and j, not their values, are passed into the function swap() . + + +Note + +C++ allows you to fully automate a call by reference through the use of reference parameters. This feature is described in Part Two. +142 C + + : T h e C o m p l e t e R e f e r e n c e + + +Calling Functions with Arrays +Arrays are covered in detail in Chapter 4. However, this section discusses passing +arrays as arguments to functions because it is an exception to the normal call-by-value parameter passing. +When an array is used as a function argument, its address is passed to a function. This is an exception to the call-by-value parameter passing convention. In this case, the code inside the function is operating on, and potentially altering, the actual contents of the array used to call the function. For example, consider the function print_upper() , which prints its string argument in uppercase: + + +#include #include + +void print_upper(char *string); + +int main(void) { +char s[80]; + +gets(s); print_upper(s); +printf("\ns is now uppercase: %s", s); return 0; +} + +/* Print a string in uppercase. */ void print_upper(char *string) +{ +register int t; + +for(t=0; string[t]; ++t) { string[t] = toupper(string[t]); putchar(string[t]); +} } + +After the call to print_upper() , the contents of array s in main() will change to uppercase. If this is not what you want, you could write the program like this: + + +#include #include +C h a p t e r 6 : F u n c t i o n s 143 + + + + +void print_upper(char *string); + +int main(void) { +char s[80]; + +gets(s); print_upper(s); +printf("\ns is unchanged: %s", s); + +return 0; } + +void print_upper(char *string) { +register int t; + +for(t=0; string[t]; ++t) putchar(toupper(string[t])); +} + + +In this version, the contents of array s remain unchanged because its values are not altered inside print_upper() . +The standard library function gets() is a classic example of passing arrays into functions. Although the gets() in your standard library is more sophisticated, the following simpler version, called xgets() , will give you an idea of how it works. + +/* A simple version of the standard gets() library function. */ +char *xgets(char *s) { +char ch, *p; int t; + +p = s; /* gets() returns a pointer to s */ + +for(t=0; t<80; ++t){ ch = getchar(); + +switch(ch) { +144 C + + : T h e C o m p l e t e R e f e r e n c e + + + +case '\n': +s[t] = '\0'; /* terminate the string */ return p; +case '\b': if(t>0) t--; break; +default: s[t] = ch; +} } +s[79] = '\0'; return p; +} + +The xgets() function must be called with a character pointer. This, of course, can +be the name of a character array, which by definition is a character pointer. Upon entry, xgets() establishes a for loop from 0 to 79. This prevents larger strings from being entered at the keyboard. If more than 80 characters are entered, the function returns. (The real gets() function does not have this restriction.) Because C/C++ has no built-in bounds checking, you should make sure that any array used to call xgets() can accept at least 80 characters. As you type characters on the keyboard, they are placed in the string. If you type a backspace, the counter t is reduced by 1, effectively removing the previous character from the array. When you press ENTER, a null is placed at the end +of the string, signaling its termination. Because the actual array used to call xgets() is modified, upon return it contains the characters that you type. + + +argc and argv—Arguments to main( ) +Sometimes it is useful to pass information into a program when you run it. Generally, you pass information into the main() function via command line arguments. A command line argument is the information that follows the program's name on the command line of the operating system. For example, when you compile a program, you might type something like the following after the command prompt: + +cc program_name + +where program_name is a command line argument that specifies the name of the program you wish to compile. +There are two special built-in arguments, argv and argc, that are used to receive command line arguments. The argc parameter holds the number of arguments on +C h a p t e r 6 : F u n c t i o n s 145 + + +the command line and is an integer. It is always at least 1 because the name of the program qualifies as the first argument. The argv parameter is a pointer to an array of character pointers. Each element in this array points to a command line argument. All command line arguments are strings—any numbers will have to be converted by the program into the proper internal format. For example, this simple program prints Hello and your name on the screen if you type it directly after the program name. + + +#include #include + +int main(int argc, char *argv[]) { +if(argc!=2) { +printf("You forgot to type your name.\n"); exit(1); +} +printf("Hello %s", argv[1]); + +return 0; } + +If you called this program name and your name were Tom, you would type name Tom to run the program. The output from the program would be Hello Tom. +In many environments, each command line argument must be separated by a space or a tab. Commas, semicolons, and the like are not considered separators. For example, + + +run Spot, run + +is made up of three strings, while + +Herb,Rick,Fred + +is a single string since commas are not generally legal separators. +Some environments allow you to enclose within double quotes a string containing spaces. This causes the entire string to be treated as a single argument. Check your operating system documentation for details on the definition of command line parameters for your system. +You must declare argv properly. The most common method is + + +char *argv[]; +146 C + + : T h e C o m p l e t e R e f e r e n c e + + +The empty brackets indicate that the array is of undetermined length. You can now access the individual arguments by indexing argv. For example, argv[0] points to the first string, which is always the program's name; argv[1] points to the first argument, and so on. +Another short example using command line arguments is the program called countdown, shown here. It counts down from a starting value (which is specified on the command line) and beeps when it reaches 0. Notice that the first argument containing the number is converted into an integer by the standard function atoi() .If the string "display" is the second command line argument, the countdown will also be displayed on the screen. + +/* Countdown program. */ #include #include #include #include + +int main(int argc, char *argv[]) { +int disp, count; + +if(argc<2) { +printf("You must enter the length of the count\n"); printf("on the command line. Try again.\n"); exit(1); +} + +if(argc==3 && !strcmp(argv[2], "display")) disp = 1; else disp = 0; + +for(count=atoi(argv[1]); count; --count) if(disp) printf("%d\n", count); + +putchar('\a'); /* this will ring the bell */ printf("Done"); + +return 0; } + +Notice that if no command line arguments have been specified, an error message is printed. A program with command line arguments often issues instructions if the user attempts to run the program without entering the proper information. +To access an individual character in one of the command line arguments, add a second index to argv. For example, the next program displays all of the arguments with which it was called, one character at a time: +C h a p t e r 6 : F u n c t i o n s 147 + + +#include + +int main(int argc, char *argv[]) { +int t, i; + +for(t=0; t #include + +void pr_reverse(char *s); + +int main(void) { +pr_reverse("I like C++"); + +return 0; } + +void pr_reverse(char *s) { +register int t; + +for(t=strlen(s)-1; t>=0; t--) putchar(s[t]); } + +Once the string has been displayed, there is nothing left for pr_reverse() to do, so it returns to the place from which it was called. +Actually, not many functions use this default method of terminating their execution. Most functions rely on the return statement to stop execution either because a value must be returned or to make a function's code simpler and more efficient. +A function may contain several return statements. For example, the find_substr() function in the following program returns the starting position of a substring within a string, or returns −1 if no match is found. + + +#include + +int find_substr(char *s1, char *s2); + +int main(void) { +if(find_substr("C++ is fun", "is") != -1) printf("substring is found"); +C h a p t e r 6 : F u n c t i o n s 149 + + + + +return 0; } + +/* Return index of first match of s2 in s1. */ int find_substr(char *s1, char *s2) +{ +register int t; char *p, *p2; + +for(t=0; s1[t]; t++) { p = &s1[t]; +p2 = s2; + +while(*p2 && *p2==*p) { p++; +p2++; } +if(!*p2) return t; /* 1st return */ } +return -1; /* 2nd return */ } + + +Returning Values +All functions, except those of type void, return a value. This value is specified by the return statement. In C, if a non-void function does not explicitly return a value via a return statement, then a garbage value is returned. In C++, a non-void function must contain a return statement that returns a value. That is, in C++, if a function is specified as returning a value, any return statement within it must have a value associated with it. However, if execution reaches the end of a non-void function, then a garbage value is returned. Although this condition is not a syntax error, it is still a fundamental error and should be avoided. +As long as a function is not declared as void, you may use it as an operand in an expression. Therefore, each of the following expressions is valid: + + +x = power(y); +if(max(x,y) > 100) printf("greater"); for(ch=getchar(); isdigit(ch); ) ... ; + +As a general rule, a function cannot be the target of an assignment. A statement such as +150 C + + : T h e C o m p l e t e R e f e r e n c e + + +swap(x,y) = 100; /* incorrect statement */ + +is wrong. The C/C++ compiler will flag it as an error and will not compile a program that contains it. (As is discussed in Part Two, C++ allows some interesting exceptions to this general rule, enabling some types of functions to occur on the left side of an assignment.) +When you write programs, your functions generally will be of three types. The first type is simply computational. These functions are specifically designed to perform operations on their arguments and return a value based on that operation. A computational function is a "pure" function. Examples are the standard library +functions sqrt() and sin() , which compute the square root and sine of their arguments. The second type of function manipulates information and returns a value that +simply indicates the success or failure of that manipulation. An example is the library function fclose() , which is used to close a file. If the close operation is successful, the function returns 0; if the operation is unsuccessful, it returns EOF. +The last type of function has no explicit return value. In essence, the function is strictly procedural and produces no value. An example is exit() , which terminates a program. All functions that do not return values should be declared as returning type void. By declaring a function as void, you keep it from being used in an expression, thus preventing accidental misuse. +Sometimes, functions that really don't produce an interesting result return something anyway. For example, printf() returns the number of characters written. Yet it would be unusual to find a program that actually checked this. In other words, although all functions, except those of type void, return values, you don't have to use the return value for anything. A common question concerning function return values is, "Don't I have to assign this value to some variable since a value is being returned?" The answer is no. If there is no assignment specified, the return value is simply discarded. Consider the following program, which uses the function mul() : + +#include + +int mul(int a, int b); + +int main(void) { +int x, y, z; + +x = 10; y = 20; +z = mul(x, y); /* 1 */ printf("%d", mul(x,y)); /* 2 */ mul(x, y); /* 3 */ +C h a p t e r 6 : F u n c t i o n s 151 + + + +return 0; } + +int mul(int a, int b) { +return a*b; } + +In line 1, the return value of mul() is assigned to z. In line 2, the return value is not actually assigned, but it is used by the printf() function. Finally, in line 3, the return value is lost because it is neither assigned to another variable nor used as part of an expression. + +Returning Pointers +Although functions that return pointers are handled just like any other type of function, a few important concepts need to be discussed. +Pointers to variables are neither integers nor unsigned integers. They are the memory addresses of a certain type of data. The reason for this distinction is because pointer arithmetic is relative to the base type. For example, if an integer pointer is incremented, it will contain a value that is 4 greater than its previous value (assuming 4-byte integers). In general, each time a pointer is incremented (or decremented), it points to the next (or previous) item of its type. Since the length of different data types may differ, the compiler must know what type of data the pointer is pointing to. For this reason, a function that returns a pointer must declare explicitly what type of pointer it is returning. For example, you should not use a return type of int * to return a char * pointer! +To return a pointer, a function must be declared as having a pointer return type. For example, this function returns a pointer to the first occurrence of the character c in string s: + + +/* Return pointer of first occurrence of c in s. */ char *match(char c, char *s) +{ +while(c!=*s && *s) s++; return(s); +} + +If no match is found, a pointer to the null terminator is returned. Here is a short program that uses match() : +152 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include + +char *match(char c, char *s); /* prototype */ + +int main(void) { +char s[80], *p, ch; + +gets(s); +ch = getchar(); p = match(ch, s); + +if(*p) /* there is a match */ printf("%s ", p); +else +printf("No match found."); + +return 0; } + +This program reads a string and then a character. If the character is in the string, the program prints the string from the point of match. Otherwise, it prints No match found. + +Functions of Type void +One of void's uses is to explicitly declare functions that do not return values. This prevents their use in any expression and helps avert accidental misuse. For example, the function print_vertical() prints its string argument vertically down the side of the screen. Since it returns no value, it is declared as void. + + +void print_vertical(char *str) { +while(*str) printf("%c\n", *str++); +} + +Here is an example that uses print_vertical() . + +#include + +void print_vertical(char *str); /* prototype */ +C h a p t e r 6 : F u n c t i o n s 153 + + + +int main(int argc, char *argv[]) { +if(argc > 1) print_vertical(argv[1]); + +return 0; } + +void print_vertical(char *str) { +while(*str) printf("%c\n", *str++); +} + + +One last point: Early versions of C did not define the void keyword. Thus, in early C programs, functions that did not return values simply defaulted to type int. Therefore, don't be surprised to see many examples of this in older code. + +What Does main( ) Return? +The main() function returns an integer to the calling process, which is generally the +operating system. Returning a value from main() is the equivalent of calling exit() with the same value. If main() does not explicitly return a value, the value passed to the calling process is technically undefined. In practice, most C/C++ compilers automatically return 0, but do not rely on this if portability is a concern. + + +Recursion +In C/C++, a function can call itself. A function is said to be recursive if a statement in the body of the function calls itself. Recursion is the process of defining something in terms of itself, and is sometimes called circular definition. +A simple example of a recursive function is factr() , which computes the factorial of an integer. The factorial of a number n is the product of all the whole numbers between 1 and n. For example, 3 factorial is 1 x 2 x 3, or 6. B othfactr() and its iterative equivalent are shown here: + + +/* recursive */ int factr(int n) { +int answer; + +if(n==1) return(1); +answer = factr(n-1)*n; /* recursive call */ return(answer); +154 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} + +/* non-recursive */ int fact(int n) { +int t, answer; + +answer = 1; + +for(t=1; t<=n; t++) answer=answer*(t); + +return(answer); } + +The nonrecursive version of fact() should be clear. It uses a loop that runs from 1 to n and progressively multiplies each number by the moving product. +The operation of the recursive factr() is a little more complex. When factr() is called with an argument of 1, the function returns 1. Otherwise, it returns the product of factr(n−1)*n. To evaluate this expression, factr() is called with n−1. This happens until n equals 1 and the calls to the function begin returning. +Computing the factorial of 2, the first call to factr() causes a second, recursive call with the argument of 1. This call returns 1, which is then multiplied by 2 (the original n value). The answer is then 2. Try working through the computation of 3 factorial on your own. (You might want to insert printf() statements into factr() to see the level of each call and what the intermediate answers are.) +When a function calls itself, a new set of local variables and parameters are allocated storage on the stack, and the function code is executed from the top with these new variables. A recursive call does not make a new copy of the function. Only the values being operated upon are new. As each recursive call returns, the old local variables and parameters are removed from the stack and execution resumes at the point of the function call inside the function. Recursive functions could be said to "telescope" out and back. +Most recursive routines do not significantly reduce code size or improve memory utilization. Also, the recursive versions of most routines may execute a bit slower than their iterative equivalents because of the overhead of the repeated function calls. In fact, many recursive calls to a function could cause a stack overrun. Because storage for function parameters and local variables is on the stack and each new call creates a new copy of these variables, the stack could be overrun. However, you probably will not have to worry about this unless a recursive function runs wild. +The main advantage to recursive functions is that you can use them to create clearer and simpler versions of several algorithms. For example, the quicksort algorithm is difficult to implement in an iterative way. Also, some problems, especially ones related +C h a p t e r 6 : F u n c t i o n s 155 + + +to artificial intelligence, lend themselves to recursive solutions. Finally, some people seem to think recursively more easily than iteratively. +When writing recursive functions, you must have a conditional statement, such as an if, somewhere to force the function to return without the recursive call being executed. If you don't, the function will never return once you call it. Omitting the conditional statement is a common error when writing recursive functions. Use printf() liberally during program development so that you can watch what is going on and abort execution if you see a mistake. + + +Function Prototypes +In C++ all functions must be declared before they are used. This is normally accomplished using a function prototype. Function prototypes were not part of the original C language. They were, however, added when C was standardized. While prototypes are not technically required by Standard C, their use is strongly encouraged. Prototypes have always been required by C++. In this book, all examples include full function prototypes. Prototypes enable both C and C++ to provide stronger type checking, somewhat like that provided by languages such as Pascal. When you use prototypes, the compiler can find and report any illegal type conversions between the type of arguments used to call a function and the type definition of its parameters. The compiler will also catch differences between the number of arguments used to call a function and the number of parameters in the function. +The general form of a function prototype is + +type func_name(type parm_name1, type parm_name2,. . ., type parm_nameN); + +The use of parameter names is optional. However, they enable the compiler to identify any type mismatches by name when an error occurs, so it is a good idea to include them. +The following program illustrates the value of function prototypes. It produces an error message because it contains an attempt to call sqr_it() with an integer argument instead of the integer pointer required. (It is illegal to convert an integer into a pointer.) + + +/* This program uses a function prototype to enforce strong type checking. */ + +void sqr_it(int *i); /* prototype */ + +int main(void) { +156 C + + : T h e C o m p l e t e R e f e r e n c e + + + +int x; + +x = 10; +sqr_it(x); /* type mismatch */ + +return 0; } + +void sqr_it(int *i) { +*i = *i * *i; } + +A function's definition can also serve as its prototype if the definition occurs prior to the function's first use in the program. For example, this is a valid program. + + +#include + +/* This definition will also serve +as a prototype within this program. */ void f(int a, int b) +{ +printf("%d ", a % b); } + +int main(void) { +f(10,3); + +return 0; } + +In this example, since f() is defined prior to its use in main(), no separate prototype is required. While it is possible for a function's definition to serve as its prototype in small programs, it is seldom possible in large onesespecially when several files are used. The programs in this book include a separate prototype for each function because that is the way C/C++ code is normally written in practice. +The only function that does not require a prototype is main(), since it is the first function called when your program begins. +Because of the need for compatibility with the original version of C, there is a small but important difference between how C and C++ handle the prototyping of a +C h a p t e r 6 : F u n c t i o n s 157 + + +function that has no parameters. In C++, an empty parameter list is simply indicated in the prototype by the absence of any parameters. For example, + + +int f(); /* C++ prototype for a function with no parameters */ + +However, in C this prototype means something different. For historical reasons, +an empty parameter list simply says that no parameter information is given. As far as the compiler is concerned, the function could have several parameters or no parameters. In C, when a function has no parameters, its prototype uses void inside the parameter list. For example, here is f() 's prototype as it would appear in a C program. + + +float f(void); + +This tells the compiler that the function has no parameters, and any call to that function that has parameters is an error. In C++, the use of void inside an empty parameter list is still allowed, but is redundant. + +Remember In C++, f( ) and f(void) are equivalent. + +Function prototypes help you trap bugs before they occur. In addition, they help verify that your program is working correctly by not allowing functions to be called with mismatched arguments. +One last point: Since early versions of C did not support the full prototype syntax, prototypes are technically optional in C. This is necessary to support pre-prototype +C code. If you are porting older C code to C++, you may need to add full function prototypes before it will compile. Remember: Although prototypes are optional in C, they are required by C++. This means that every function in a C++ program must be fully prototyped. + +Standard Library Function Prototypes +Any standard library function used by your program must be prototyped. To accomplish this, you must include the appropriate header for each library function. All necessary headers are provided by the C/C++ compiler. In C, all headers are files that use the .H extension. In C++, headers may be either separate files or built into +the compiler itself. In either case, a header contains two main elements: any definitions used by the library functions and the prototypes for the library functions. For example, stdio.h is included in almost all programs in this part of the book because it contains the prototype for printf() . The headers for the standard library are described in +Part Three. +158 C + + : T h e C o m p l e t e R e f e r e n c e + + +Declaring Variable-Length Parameter Lists You can specify a function that has a variable number of parameters. The most common example is printf() . To tell the compiler that an unknown number of arguments may be passed to a function, you must end the declaration of its parameters using three periods. For example, this prototype specifies that func() will have at least two integer parameters and an unknown number (including 0) of parameters after that. + +int func(int a, int b, ...); + +This form of declaration is also used by a function's definition. +Any function that uses a variable number of parameters must have at least one actual parameter. For example, this is incorrect: + + +int func(...); /* illegal */ + + +Old-Style Versus Modern Function Parameter Declarations +Early versions of C used a different parameter declaration method than does either Standard C or Standard C++. This early approach is sometimes called the classic form. This book uses a declaration approach called the modern form. Standard C supports both forms, but strongly recommends the modern form. Standard C++ only supports the modern parameter declaration method. However, you should know the old-style form because many older C programs still use it. +The old-style function parameter declaration consists of two parts: a parameter list, which goes inside the parentheses that follow the function name, and the actual parameter declarations, which go between the closing parentheses and the function's opening curly brace. The general form of the old-style parameter definition is + +type func_name(parm1, parm2, . . .parmN) type parm1; +type parm2; . +. . +type parmN; { +function code } +C h a p t e r 6 : F u n c t i o n s 159 + + +For example, this modern declaration: + +float f(int a, int b, char ch) { +/* ... */ } + +will look like this in its old-style form: + +float f(a, b, ch) int a, b; +char ch; { +/* ... */ } + +Notice that the old-style form allows the declaration of more than one parameter in a list after the type name. + + +Remember + +The old-style form of parameter declaration is designated as obsolete by the C language and is not supported by C++. + + + +Implementation Issues +There are a few important things to remember about functions that affect their efficiency and usability. These issues are the subject of this section. + +Parameters and General-Purpose Functions +A general-purpose function is one that will be used in a variety of situations, perhaps by many different programmers. Typically, you should not base general-purpose functions on global data. All of the information a function needs should be passed +to it by its parameters. When this is not possible, you should use static variables. Besides making your functions general purpose, parameters keep your code +readable and less susceptible to bugs resulting from side effects. + +Efficiency +Functions are the building blocks of C/C++ and are crucial to all but the simplest programs. However, in certain specialized applications, you may need to eliminate a function and replace it with inline code. Inline code performs the same actions as a +160 C + + : T h e C o m p l e t e R e f e r e n c e + + +function, but without the overhead associated with a function call. For this reason, inline code is often used instead of function calls when execution time is critical. +Inline code is faster than a function call for two reasons. First, a CALL instruction takes time to execute. Second, if there are arguments to pass, these have to be placed on the stack, which also takes time. For most applications, this very slight increase in execution time is of no significance. But if it is, remember that each function call uses time that would be saved if the function's code were placed in line. For example, the following are two versions of a program that prints the square of the numbers from 1 to 10. The inline version runs faster than the other because the function call adds time. + + +in line + +#include + + +int main(void) { +int x; + +for(x=1; x<11; ++x) printf("%d", x*x); + +return 0; +} + +function call + +#include int sqr(int a); + +int main(void) { +int x; + +for(x=1; x<11; ++x) printf("%d", sqr(x)); + +return 0; +} + + +int sqr(int a) { +return a*a; } + + +Note + +In C++, the concept of inline functions is expanded and formalized. In fact, inline functions are an important component of the C++ language. + +C++ + + + + +Chapter 7 Structures, Unions, Enumerations, and +User-Defined Types + + + + + + + + +161 +162 C + + : T h e C o m p l e t e R e f e r e n c e + + +he C language gives you five ways to create a custom data type: +T + +1. The structure, which is a grouping of variables under one name and is called a compound data type. (The terms aggregate or conglomerate are also commonly used.) +2. The bit-field, which is a variation on the structure and allows easy access to individual bits. +3. The union, which enables the same piece of memory to be defined as two or more different types of variables. +4. The enumeration, which is a list of named integer constants. +5. The typedef keyword, which defines a new name for an existing type. + +C++ supports all of the above and adds classes, which are described in Part Two. The other methods of creating custom data types are described here. + + +Note + +In C++, structures and unions have both object-oriented and non-object-oriented attributes. This chapter discusses only their C-like, non-object-oriented features. Their object-oriented qualities are described later in this book. + + + +Structures +A structure is a collection of variables referenced under one name, providing a convenient means of keeping related information together. A structure declaration forms a template that may be used to create structure objects (that is, instances of +a structure). The variables that make up the structure are called members. (Structure members are also commonly referred to as elements or fields.) +Generally, all of the members of a structure are logically related. For example, the name and address information in a mailing list would normally be represented in a structure. The following code fragment shows how to declare a structure that defines the name and address fields. The keyword struct tells the compiler that a structure is being declared. + +struct addr { +char name[30]; char street[40]; char city[20]; char state[3]; +unsigned long int zip; }; +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 163 + + +Notice that the declaration is terminated by a semicolon. This is because a structure declaration is a statement. The type name of the structure is addr. As such, addr identifies this particular data structure and is its type specifier. +At this point, no variable has actually been created. Only the form of the data has been defined. When you define a structure, you are defining a compound variable type, not a variable. Not until you declare a variable of that type does one actually exist. In C, to declare a variable (i.e., a physical object) of type addr, write + + +struct addr addr_info; + +This declares a variable of type addr called addr_info. In C++, you may use this shorter form. + + +addr addr_info; + +As you can see, the keyword struct is not needed. In C++, once a structure +has been declared, you may declare variables of its type using only its type name, without preceding it with the keyword struct. The reason for this difference is that in C, a structure's name does not define a complete type name. In fact, Standard C +refers to a structure's name as a tag. In C, you must precede the tag with the keyword struct when declaring variables. However, in C++, a structure's name is a complete type name and may be used by itself to define variables. Keep in mind, however, that it is still perfectly legal to use the C-style declaration in a C++ program. Since the programs in Part One of this book are valid for both C and C++, they will use the C declaration method. Just remember that C++ allows the shorter form. +When a structure variable (such as addr_info) is declared, the compiler auto-matically allocates sufficient memory to accommodate all of its members. Figure 7-1 shows how addr_info appears in memory assuming 1-byte characters and 4-byte long integers. +You may also declare one or more structure variables when you declare a structure. For example, + + +struct addr { char name[30]; +char street[40]; char city[20]; char state[3]; +unsigned long int zip; +} addr_info, binfo, cinfo; + +defines a structure type called addr and declares variables addr_info, binfo, and cinfo of that type. +164 C + + : T h e C o m p l e t e R e f e r e n c e + + + + + + + + + + + + + + + + + + + + + +Figure 7-1. The addr_info structure in memory + + +If you only need one structure variable, the structure type name is not needed. That means that + + +struct { +char name[30]; char street[40]; char city[20]; char state[3]; +unsigned long int zip; } addr_info; + +declares one variable named addr_info as defined by the structure preceding it. The general form of a structure declaration is + +struct struct-type-name { type member-name; type member-name; type member-name; +. . . +} structure-variables; + +where either struct-type-name or structure-variables may be omitted, but not both. +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 165 + + +Accessing Structure Members +Individual members of a structure are accessed through the use of the . operator (usually called the dot operator). For example, the following code assigns the ZIP code 12345 to the zip field of the structure variable addr_info declared earlier: + + +addr_info.zip = 12345; + +The structure variable name followed by a period and the member name references that individual member. The general form for accessing a member of a structure is + +structure-name.member-name +Therefore, to print the ZIP code on the screen, write + +printf("%d", addr_info.zip); + +This prints the ZIP code contained in the zip member of the structure variable addr_info. +In the same fashion, the character array addr_info.name can be used to call gets() , as shown here: + + +gets(addr_info.name); + +This passes a character pointer to the start of name. +Since name is a character array, you can access the individual characters of addr_info.name by indexing name. For example, you can print the contents of addr_info.name one character at a time by using the following code: + + +register int t; + +for(t=0; addr_info.name[t]; ++t) putchar(addr_info.name[t]); + +Structure Assignments +The information contained in one structure may be assigned to another structure of the same type using a single assignment statement. That is, you do not need to assign the value of each member separately. The following program illustrates structure assignments: + + +#include + +int main(void) +166 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +struct { int a; int b; +} x, y; + +x.a = 10; + +y = x; /* assign one structure to another */ + +printf("%d", y.a); + +return 0; } + +After the assignment, y.a will contain the value 10. + + +Arrays of Structures +Perhaps the most common usage of structures is in arrays of structures. To declare an array of structures, you must first define a structure and then declare an array variable of that type. For example, to declare a 100-element array of structures of type addr, defined earlier, write + + +struct addr addr_info[100]; + +This creates 100 sets of variables that are organized as defined in the structure addr. To access a specific structure, index the structure name. For example, to print the +ZIP code of structure 3, write + + +printf("%d", addr_info[2].zip); + +Like all array variables, arrays of structures begin indexing at 0. + + +Passing Structures to Functions +This section discusses passing structures and their members to functions. +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 167 + + +Passing Structure Members to Functions +When you pass a member of a structure to a function, you are actually passing the value of that member to the function. Therefore, you are passing a simple variable (unless, of course, that element is compound, such as an array). For example, consider this structure: + + +struct fred { +char x; int y; float z; char s[10]; +} mike; + +Here are examples of each member being passed to a function: + +func(mike.x); /* passes character value of x */ func2(mike.y); /* passes integer value of y */ func3(mike.z); /* passes float value of z */ func4(mike.s); /* passes address of string s */ func(mike.s[2]); /* passes character value of s[2] */ + +If you wish to pass the address of an individual structure member, put the & operator before the structure name. For example, to pass the address of the members of the structure mike, write + + + +func(&mike.x); func2(&mike.y); func3(&mike.z); +func4(mike.s); + +/* passes address of character x */ /* passes address of integer y */ /* passes address of float z */ +/* passes address of string s */ + +func(&mike.s[2]); /* passes address of character s[2] */ + +Remember that the & operator precedes the structure name, not the individual member name. Note also that s already signifies an address, so no & is required. + +Passing Entire Structures to Functions +When a structure is used as an argument to a function, the entire structure is passed using the standard call-by-value method. Of course, this means that any changes +168 C + + : T h e C o m p l e t e R e f e r e n c e + + +made to the contents of the structure inside the function to which it is passed do not affect the structure used as an argument. +When using a structure as a parameter, remember that the type of the argument must match the type of the parameter. For example, in the following program both the argument arg and the parameter parm are declared as the same type of structure. + +#include + +/* Define a structure type. */ struct struct_type { +int a, b; char ch; +} ; + +void f1(struct struct_type parm); + +int main(void) { +struct struct_type arg; + +arg.a = 1000; + +f1(arg); + +return 0; } + +void f1(struct struct_type parm) { +printf("%d", parm.a); } + +As this program illustrates, if you will be declaring parameters that are structures, you must make the declaration of the structure type global so that all parts of your program can use it. For example, had struct_type been declared inside main() (for example), then it would not have been visible to f1(). +As just stated, when passing structures, the type of the argument must match +the type of the parameter. It is not sufficient for them to simply be physically similar; their type names must match. For example, the following version of the preceding program is incorrect and will not compile because the type name of the argument used to call f1() differs from the type name of its parameter. +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 169 + + +/* This program is incorrect and will not compile. */ #include + +/* Define a structure type. */ struct struct_type { +int a, b; char ch; +} ; + +/* Define a structure similar to struct_type, but with a different name. */ +struct struct_type2 { int a, b; +char ch; } ; + +void f1(struct struct_type2 parm); + +int main(void) { +struct struct_type arg; + +arg.a = 1000; + +f1(arg); /* type mismatch */ + +return 0; } + +void f1(struct struct_type2 parm) { +printf("%d", parm.a); } + +Structure Pointers +C/C++ allows pointers to structures just as it allows pointers to any other type of variable. However, there are some special aspects to structure pointers that you should know. +170 C + + : T h e C o m p l e t e R e f e r e n c e + + +Declaring a Structure Pointer +Like other pointers, structure pointers are declared by placing * in front of a structure variable's name. For example, assuming the previously defined structure addr, the following declares addr_pointer as a pointer to data of that type: + + +struct addr *addr_pointer; + +Remember, in C++ it is not necessary to precede this declaration with the keyword struct. + +Using Structure Pointers +There are two primary uses for structure pointers: to pass a structure to a function +using call by reference, and to create linked lists and other dynamic data structures that rely on dynamic allocation. This chapter covers the first use. +There is one major drawback to passing all but the simplest structures to functions: the overhead needed to push the structure onto the stack when the function call is executed. (Recall that arguments are passed to functions on the stack.) For simple structures with few members, this overhead is not too great. If the structure contains many members, however, or if some of its members are arrays, run-time performance may degrade to unacceptable levels. The solution to this problem is to pass only a pointer to the function. +When a pointer to a structure is passed to a function, only the address of the structure is pushed on the stack. This makes for very fast function calls. A second advantage, in some cases, is when a function needs to reference the actual structure used as the argument, instead of a copy. By passing a pointer, the function can modify the contents of the structure used in the call. +To find the address of a structure variable, place the & operator before the structure's name. For example, given the following fragment: + + +struct bal { float balance; char name[80]; +} person; + +struct bal *p; /* declare a structure pointer */ + +then + +p = &person; +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 171 + + +places the address of the structure person into the pointer p. +To access the members of a structure using a pointer to that structure, you must use the −> operator. For example, this references the balance field: + + +p->balance + +The −> is usually called the arrow operator, and consists of the minus sign followed by a greater-than sign. The arrow is used in place of the dot operator when you are accessing a structure member through a pointer to the structure. +To see how a structure pointer can be used, examine this simple program, which prints the hours, minutes, and seconds on your screen using a software timer. + + +/* Display a software timer. */ #include + +#define DELAY 128000 + +struct my_time { int hours; int minutes; int seconds; +} ; + +void display(struct my_time *t); void update(struct my_time *t); void delay(void); + +int main(void) { +struct my_time systime; + +systime.hours = 0; systime.minutes = 0; systime.seconds = 0; + +for(;;) { update(&systime); display(&systime); +} + +return 0; } +172 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +void update(struct my_time *t) { +t->seconds++; +if(t->seconds==60) { t->seconds = 0; +t->minutes++; } + +if(t->minutes==60) { t->minutes = 0; +t->hours++; } + +if(t->hours==24) t->hours = 0; delay(); +} + +void display(struct my_time *t) { +printf("%02d:", t->hours); printf("%02d:", t->minutes); printf("%02d\n", t->seconds); +} + +void delay(void) { +long int t; + +/* change this as needed */ for(t=1; thours==24) t->hours = 0; + +This tells the compiler to take the address of t (which points to systime in main() ) and to reset hours to zero. +Remember, use the dot operator to access structure elements when operating on the structure itself. When you have a pointer to a structure, use the arrow operator. + + +Arrays and Structures Within Structures +A member of a structure may be either a simple or compound type. A simple member is one that is of any of the built-in data types, such as integer or character. You have already seen one type of compound element: the character arrays used in addr. Other compound data types include one-dimensional and multidimensional arrays of the other data types and structures. +A member of a structure that is an array is treated as you might expect from the earlier examples. For example, consider this structure: + +struct x { +int a[10][10]; /* 10 x 10 array of ints */ float b; +} y; + +To reference integer 3,7 in a of structure y, write + +y.a[3][7] + +When a structure is a member of another structure, it is called a nested structure. For example, the structure address is nested inside emp in this example: + + +struct emp { +struct addr address; /* nested structure */ float wage; +} worker; + +Here, structure emp has been defined as having two members. The first is a structure of type addr, which contains an employee's address. The other is wage, which holds the employee's wage. The following code fragment assigns 93456 to the zip element of address. +174 C + + : T h e C o m p l e t e R e f e r e n c e + + +worker.address.zip = 93456; + +As you can see, the members of each structure are referenced from outermost to innermost. Standard C specifies that structures may be nested to at least 15 levels. Standard C++ suggests that at least 256 levels of nesting be allowed. + + +Bit-Fields +Unlike some other computer languages, C/C++ has a built-in feature called a bit-field that allows you to access a single bit. Bit-fields can be useful for a number of reasons, such as: + + If storage is limited, you can store several Boolean (true/false) variables in one byte. + + Certain devices transmit status information encoded into one or more bits within a byte. + + Certain encryption routines need to access the bits within a byte. + +Although these tasks can be performed using the bitwise operators, a bit-field can add more structure (and possibly efficiency) to your code. +To access individual bits, C/C++ uses a method based on the structure. In fact, a bit-field is really just a special type of structure member that defines how long, in bits, the field is to be. The general form of a bit-field definition is + +struct struct-type-name { type name1 : length; type name2 : length; +. . . +type nameN : length; } variable_list; + +Here, type is the type of the bit-field and length is the number of bits in the field. +A bit-field must be declared as an integral or enumeration type. Bit-fields of length 1 should be declared as unsigned, because a single bit cannot have a sign. +Bit-fields are frequently used when analyzing input from a hardware device. For example, the status port of a serial communications adapter might return a status byte organized like this: +C h a p t e r 7 : + + + +Bit + +0 1 2 3 4 5 6 +7 + +S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 175 + + + +Meaning When Set + +Change in clear-to-send line Change in data-set-ready Trailing edge detected Change in receive line Clear-to-send +Data-set-ready Telephone ringing +Received signal + + +You can represent the information in a status byte using the following bit-field: + +struct status_type { unsigned delta_cts: 1; unsigned delta_dsr: 1; unsigned tr_edge: 1; unsigned delta_rec: 1; unsigned cts: 1; unsigned dsr: 1; unsigned ring: 1; unsigned rec_line: 1; +} status; + +You might use a routine similar to that shown here to enable a program to determine when it can send or receive data. + + +status = get_port_status(); if(status.cts) printf("clear to send"); if(status.dsr) printf("data ready"); + +To assign a value to a bit-field, simply use the form you would use for any other type of structure element. For example, this code fragment clears the ring field: + + +status.ring = 0; + +As you can see from this example, each bit-field is accessed with the dot operator. However, if the structure is referenced through a pointer, you must use the −> operator. +176 C + + : T h e C o m p l e t e R e f e r e n c e + + +You do not have to name each bit-field. This makes it easy to reach the bit you want, bypassing unused ones. For example, if you only care about the cts and dsr bits, you could declare the status_type structure like this: + + +struct status_type { unsigned : 4; unsigned cts: 1; unsigned dsr: 1; +} status; + +Also, notice that the bits after dsr do not need to be specified if they are not used. It is valid to mix normal structure members with bit-fields. For example, + + +struct emp { +struct addr address; + +float pay; unsigned lay_off: +unsigned hourly: + + +1; /* lay off or active */ +1; /* hourly pay or wage */ + +unsigned deductions: 3; /* IRS deductions */ }; + +defines an employee record that uses only 1 byte to hold three pieces of information: the employee's status, whether the employee is salaried, and the number of deductions. Without the bit-field, this information would have taken 3 bytes. +Bit-fields have certain restrictions. You cannot take the address of a bit-field. Bit-fields cannot be arrayed. They cannot be declared as static. You cannot know, from machine to machine, whether the fields will run from right to left or from left to right; this implies that any code using bit-fields may have some machine dependencies. Other restrictions may be imposed by various specific implementations, so check the user manual for your compiler. + + +Unions +A union is a memory location that is shared by two or more different variables, generally of different types, at different times. Declaring a union is similar to declaring a structure. Its general form is + +union union-type-name { type member-name; type member-name; type member-name; +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 177 + + +. . . +} union-variables; + +For example: + +union u_type { int i; +char ch; }; + +This declaration does not create any variables. You may declare a variable either by placing its name at the end of the declaration or by using a separate declaration statement. In C, to declare a union variable called cnvt of type u_type using the definition just given, write + + +union u_type cnvt; + +When declaring union variables in C++, you need use only the type name— you don't need to precede it with the keyword union. For example, this is how cnvt is declared in C++: + + +u_type cnvt; + +In C++, preceding this declaration with the keyword union is allowed, but redundant. In C++, the name of a union defines a complete type name. In C, a union name is its tag and it must be preceded by the keyword union. (This is similar to the situation with structures described earlier.) However, since the programs in this chapter are valid for both C and C++, the C-style declaration form will be used. +In cnvt, both integer i and character ch share the same memory location. Of course, i occupies 2 bytes (assuming 2-byte integers) and ch uses only 1. Figure 7-2 shows how i and ch share the same address. At any point in your program, you can refer to the data stored in a cnvt as either an integer or a character. +When a union variable is declared, the compiler automatically allocates enough storage to hold the largest member of the union. For example (assuming 2-byte integers), cnvt is 2 bytes long so that it can hold i, even though ch requires only +1 byte. +178 C + + : T h e C o m p l e t e R e f e r e n c e + + + + + + + + + + + + + + + + + + +Figure 7-2. How i and ch utilize the union cnvt (assume 2-byte integers) + + +To access a member of a union, use the same syntax that you would use for structures: the dot and arrow operators. If you are operating on the union directly, use the dot operator. If the union is accessed through a pointer, use the arrow operator. For example, to assign the integer 10 to element i of cnvt, write + + +cnvt.i = 10; + +In the next example, a pointer to cnvt is passed to a function: + +void func1(union u_type *un) { +un->i = 10; /* assign 10 to cnvt using function */ +} + +Using a union can aid in the production of machine-independent (portable) code. Because the compiler keeps track of the actual sizes of the union members, no unnecessary machine dependencies are produced. That is, you need not worry about the size of an int, long, float, or whatever. +Unions are used frequently when specialized type conversions are needed because you can refer to the data held in the union in fundamentally different ways. For example, you may use a union to manipulate the bytes that comprise a double in order to alter its precision or to perform some unusual type of rounding. +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 179 + + +To get an idea of the usefulness of a union when nonstandard type conversions are needed, consider the problem of writing a short integer to a disk file. The C/C++ standard library defines no function specifically designed to write a short integer to a file. While you can write any type of data to a file using fwrite(), using fwrite() incurs excessive overhead for such a simple operation. However, using a union you can easily create a function called putw() , which writes the binary representation of a short integer to a file one byte at a time. (This example assumes that short integers are 2 bytes long.) To see how, first create a union consisting of one short integer and a 2-byte character array: + + +union pw { short int i; char ch[2]; +}; + +Now, you can use pw to create the version of putw() shown in the following program. + +#include + +union pw { short int i; char ch[2]; +}; + +int putw(short int num, FILE *fp); + +int main(void) { +FILE *fp; + +fp = fopen("test.tmp", "wb+"); + +putw(1000, fp); /* write the value 1000 as an integer */ fclose(fp); + +return 0; } + +int putw(short int num, FILE *fp) { +union pw word; +180 C + + : T h e C o m p l e t e R e f e r e n c e + + + +word.i = num; + +putc(word.ch[0], fp); /* write first half */ +return putc(word.ch[1], fp); /* write second half */ } + +Although putw() is called with a short integer, it can still use the standard function putc() to write each byte in the integer to a disk file one byte at a time. + + +Note + +C++ supports a special type of union called an anonymous union which is discussed in Part Two of this book. + + + +Enumerations +An enumeration is a set of named integer constants that specify all the legal values a variable of that type may have. Enumerations are common in everyday life. For example, an enumeration of the coins used in the United States is + +penny, nickel, dime, quarter, half-dollar, dollar + +Enumerations are defined much like structures; the keyword enum signals the start of an enumeration type. The general form for enumerations is + +enum enum-type-name { enumeration list } variable_list; + +Here, both the type name and the variable list are optional. (But at least one must be present.) The following code fragment defines an enumeration called coin: + + +enum coin { penny, nickel, dime, quarter, half_dollar, dollar}; + +The enumeration type name can be used to declare variables of its type. In C, the following declares money to be a variable of type coin. + + +enum coin money; + +In C++, the variable money may be declared using this shorter form: + +coin money; +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 181 + + +In C++, an enumeration name specifies a complete type. In C, an enumeration name is its tag and it requires the keyword enum to complete it. (This is similar to the situation as it applies to structures and unions, described earlier.) +Given these declarations, the following types of statements are perfectly valid: + + +money = dime; +if(money==quarter) printf("Money is a quarter.\n"); + +The key point to understand about an enumeration is that each of the symbols stands for an integer value. As such, they may be used anywhere that an integer may be used. Each symbol is given a value one greater than the symbol that precedes it. The value of the first enumeration symbol is 0. Therefore, + + +printf("%d %d", penny, dime); + +displays 0 2 on the screen. +You can specify the value of one or more of the symbols by using an initializer. Do this by following the symbol with an equal sign and an integer value. Symbols +that appear after initializers are assigned values greater than the previous initialization value. For example, the following code assigns the value of 100 to quarter: + + +enum coin { penny, nickel, dime, quarter=100, half_dollar, dollar}; + +Now, the values of these symbols are + +penny 0 nickel 1 dime 2 quarter 100 half_dollar 101 dollar 102 + +One common but erroneous assumption about enumerations is that the symbols can be input and output directly. This is not the case. For example, the following code fragment will not perform as desired: +182 C + + : T h e C o m p l e t e R e f e r e n c e + + +/* this will not work */ money = dollar; printf("%s", money); + +Remember, dollar is simply a name for an integer; it is not a string. For the same reason, you cannot use this code to achieve the desired results: + + +/* this code is wrong */ strcpy(money, "dime"); + +That is, a string that contains the name of a symbol is not automatically converted to that symbol. +Actually, creating code to input and output enumeration symbols is quite tedious (unless you are willing to settle for their integer values). For example, you need the following code to display, in words, the kind of coins that money contains: + +switch(money) { +case penny: printf("penny"); break; +case nickel: printf("nickel"); break; +case dime: printf("dime"); break; +case quarter: printf("quarter"); break; +case half_dollar: printf("half_dollar"); break; +case dollar: printf("dollar"); } + +Sometimes you can declare an array of strings and use the enumeration value as an index to translate that value into its corresponding string. For example, this code also outputs the proper string: + + +char name[][12]={ "penny", "nickel", "dime", "quarter", "half_dollar", "dollar" +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 183 + + + +}; +printf("%s", name[money]); + + +Of course, this only works if no symbol is initialized, because the string array must be indexed starting at 0. +Since enumeration values must be converted manually to their human-readable string values for I/O operations, they are most useful in routines that do not make such conversions. An enumeration is often used to define a compiler's symbol table, for example. Enumerations are also used to help prove the validity of a program by providing a compile-time redundancy check confirming that a variable is assigned only valid values. + + +Using sizeof to Ensure Portability +You have seen that structures and unions can be used to create variables of different sizes, and that the actual size of these variables may change from machine to machine. The sizeof operator computes the size of any variable or type and can help eliminate machine-dependent code from your programs. This operator is especially useful where structures or unions are concerned. +For the following discussion, assume an implementation, common to many C/C++ compilers, that has the sizes for data types shown here: + +Type Size in Bytes + +char 1 int 4 double 8 + +Therefore, the following code will print the numbers 1, 4, and 8 on the screen: + +char ch; int i; double f; + +printf("%d", sizeof(ch)); printf("%d", sizeof(i)); printf("%d", sizeof(f)); + +The size of a structure is equal to or greater than the sum of the sizes of its members. For example, +184 C + + : T h e C o m p l e t e R e f e r e n c e + + + + + +struct s { char ch; int i; double f; +} s_var; + + +Here, sizeof(s_var) is at least 13 (8 + 4 + 1). However, the size of s_var might be greater because the compiler is allowed to pad a structure in order to achieve word or paragraph alignment. (A paragraph is 16 bytes.) Since the size of a structure may be greater than the sum of the sizes of its members, you should always use sizeof when you need to know the size of a structure. +Since sizeof is a compile-time operator, all the information necessary to compute the size of any variable is known at compile time. This is especially meaningful for unions, because the size of a union is always equal to the size of its largest member. For example, consider + + +union u { char ch; int i; double f; +} u_var; + +Here, the sizeof(u_var) is 8. At run time, it does not matter what u_var is actually holding. All that matters is the size of its largest member, because any union must be as large as its largest element. + + +typedef +You can define new data type names by using the keyword typedef. You are not actually creating a new data type, but rather defining a new name for an existing type. This process can help make machine-dependent programs more portable. If you define your own type name for each machine-dependent data type used by your program, then only the typedef statements have to be changed when compiling for a new environment. typedef also can aid in self-documenting your code by allowing descriptive names for the standard data types. The general form of the typedef statement is +C h a p t e r 7 : S t r u c t u r e s , U n i o n s , E n u m e r a t i o n s , a n d U s e r - D e f i n e d T y p e s 185 + + +typedef type newname; + +where type is any valid data type and newname is the new name for this type. The new name you define is in addition to, not a replacement for, the existing type name. +For example, you could create a new name for float by using + + +typedef float balance; + +This statement tells the compiler to recognize balance as another name for float. Next, you could create a float variable using balance: + + +balance over_due; + +Here, over_due is a floating-point variable of type balance, which is another word for float. +Now that balance has been defined, it can be used in another typedef. For example, + + +typedef balance overdraft; + +tells the compiler to recognize overdraft as another name for balance, which is another name for float. +Using typedef can make your code easier to read and easier to port to a new machine, but you are not creating a new physical type. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 8 C-Style Console I/O + + + + + + + + + + + + + + +187 +188 C + + : T h e C o m p l e t e R e f e r e n c e + + +++ supports two complete I/O systems. The first it inherits from C. The second is the object-oriented I/O system defined by C++. This and the next chapter discuss the C-like I/O system. (Part Two examines C++ I/O.) While you will +C +probably want to use the C++ I/O system for most new projects, C-style I/O is still quite common, and knowledge of its features is fundamental to a complete understanding of C++. +In C, input and output are accomplished through library functions. There are both console and file I/O functions. Technically, there is little distinction between console I/O and file I/O, but conceptually they are in very different worlds. This chapter examines in detail the console I/O functions. The next chapter presents the file I/O system and describes how the two systems relate. +With one exception, this chapter covers only console I/O functions defined by Standard C++. Standard C++ does not define any functions that perform various screen control operations (such as cursor positioning) or that display graphics, because these operations vary widely between machines. Nor does it define any functions that write to a window or dialog box under Windows. Instead, the console I/O functions perform only TTY-based output. However, most compilers include in their libraries screen control and graphics functions that apply to the specific environment in which the compiler is designed to run. And, of course, you may use C++ to write Windows programs, but keep in mind that the C++ language does not directly define functions that perform these tasks. +The Standard C I/O functions all use the header file stdio.h. C++ programs can also use the new-style header . +This chapter refers to the console I/O functions as performing input from the keyboard and output to the screen. However, these functions actually have the standard input and standard output of the system as the target and/or source of their I/O operations. Furthermore, standard input and standard output may be redirected to other devices. These concepts are covered in Chapter 9. + + +An Important Application Note +Part One of this book uses the C-like I/O system because it is the only style of I/O that is defined for the C subset of C++. As explained, C++ also defines its own object-oriented I/O system. For most C++ applications, you will want to use the C++-specific I/O system, not the C I/O system described in this chapter. However, an understanding of C-based I/O is important for the following reasons: + + At some point in your career you may be called upon to write code that is restricted to the C subset. In this case, you will need to use the C-like I/O functions. + + For the foreseeable future, C and C++ will coexist. Also, many programs will be hybrids of both C and C++ code. Further, it will be common for C programs to be "upgraded" into C++ programs. Thus, knowledge of both the C and the C++ +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 189 + + +I/O system will be necessary. For example, in order to change the C-style I/O functions into their C++ object-oriented equivalents, you will need to know how both the C and C++ I/O systems operate. + + An understanding of the basic principles behind the C-like I/O system is crucial to an understanding of the C++ object-oriented I/O system. (Both share the same general concepts.) + + In certain situations (for example, in very short programs), it may be easier to use C's non-object-oriented approach to I/O than it is to use the object-oriented I/O defined by C++. + +In addition, there is an unwritten rule that any C++ programmer must also be a C programmer. If you don't know how to use the C I/O system, you will be limiting your professional horizons. + + +Reading and Writing Characters +The simplest of the console I/O functions are getchar() , which reads a character from the keyboard, and putchar() , which prints a character to the screen. The getchar() function waits until a key is pressed and then returns its value. The key pressed is also automatically echoed to the screen. The putchar() function writes a character to the screen at the current cursor position. The prototypes for getchar() and putchar() are shown here: + +int getchar(void); int putchar(int c); + +As its prototype shows, the getchar() function is declared as returning an integer. However, you can assign this value to a char variable, as is usually done, because the character is contained in the low-order byte. (The high-order byte is normally zero.) getchar() returns EOF if an error occurs. +In the case of putchar(), even though it is declared as taking an integer parameter, you will generally call it using a character argument. Only the low-order byte of its parameter is actually output to the screen. The putchar() function returns the character written, or EOF if an error occurs. (The EOF macro is defined in stdio.h and is generally equal to −1.) +The following program illustrates getchar() and putchar(). It inputs characters from the keyboard and displays them in reverse casethat is, it prints uppercase as lowercase and lowercase as uppercase. To stop the program, enter a period. + + +#include #include +190 C + + : T h e C o m p l e t e R e f e r e n c e + + + +int main(void) { +char ch; + +printf("Enter some text (type a period to quit).\n"); do { +ch = getchar(); + +if(islower(ch)) ch = toupper(ch); else ch = tolower(ch); + +putchar(ch); +} while (ch != '.'); + +return 0; } + + +A Problem with getchar( ) +There are some potential problems with getchar() . Normally, getchar() is implemented in such a way that it buffers input until ENTER is pressed. This is called line-buffered input; you have to pressENTER before anything you typed is actually sent to your program. Also, since getchar() inputs only one character each time it is called, line-buffering may leave one or more characters waiting in the input queue, which is annoying in interactive environments. Even though Standard C/C++ specify that getchar() can be implemented as an interactive function, it seldomis. Therefore, if the preceding programdid not behave as you expected, you nowknowwhy. + +Alternatives to getchar( ) +getchar() might not be implemented by your compiler in such a way that it is useful in +an interactive environment. If this is the case, you might want to use a different function to read characters from the keyboard. Standard C++ does not define any function that is guaranteed to provide interactive input, but virtually all C++ compilers do. Although these functions are not defined by Standard C++, they are commonly used since getchar() does not fill the needs of most programmers. +Two of the most common alternative functions, getch() and getche() , have these prototypes: + +int getch(void); int getche(void); +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 191 + + +For most compilers, the prototypes for these functions are found in the header file conio.h. For some compilers, these functions have a leading underscore. For example, in Microsoft's Visual C++, they are called _getch() and _getche() . +The getch() function waits for a keypress, after which it returns immediately. It does not echo the character to the screen. The getche() function is the same as getch() , but the key is echoed. You will frequently see getche() or getch() used instead of getchar() when a character needs to be read from the keyboard in an interactive program. However, if your compiler does not support these alternative +functions, or if getchar() is implemented as an interactive function by your compiler, you should substitute getchar() when necessary. +For example, the previous programis shown here using getch() instead of getchar() : + +#include #include #include + +int main(void) { +char ch; + +printf("Enter some text (type a period to quit).\n"); do { +ch = getch(); + +if(islower(ch)) ch = toupper(ch); else ch = tolower(ch); + +putchar(ch); +} while (ch != '.'); + +return 0; } + +When you run this version of the program, each time you press a key, it is immediately transmitted to the program and displayed in reverse case. Input is no longer line-buffered. While the code in this book will not make further use of getch() or getche() , they may be useful in the programs that you write. + + +Note + +At the time of this writing, when using Microsoft's Visual C++ compiler, _getche( ) and _getch( ) are not compatible with the standard C/C++ input functions, such as scanf( ) or gets( ). Instead, you must use special versions of the standard functions, such as cscanf( ) or cgets( ). You will need to examine the Visual C++ documentation for details. +192 C + + : T h e C o m p l e t e R e f e r e n c e + + +Reading and Writing Strings +The next step up in console I/O, in terms of complexity and power, are the functions gets() and puts() . They enable you to read and write strings of characters. +The gets() function reads a string of characters entered at the keyboard and places them at the address pointed to by its argument. You may type characters at the keyboard until you press ENTER. The carriage return does not become part of the string; instead, a null terminator is placed at the end and gets() returns. In fact, you cannot use gets() to return a carriage return (although getchar() can do so). You can correct typing mistakes by using the backspace key before pressing ENTER. The prototype for gets() is + +char *gets(char *str); + +where str is a character array that receives the characters input by the user. gets() also returns str. The following program reads a string into the array str and prints its length: + + +#include #include + +int main(void) { +char str[80]; + +gets(str); +printf("Length is %d", strlen(str)); + +return 0; } + +You need to be careful when using gets() because it performs no boundary checks on thearray that is receiving input. Thus, it is possible for the user to enter more characters than the array can hold. While gets() is fine for sample programs and simple utilities that only you will use, you will want to avoid its use in commercial code. One alternative is the fgets() function described in the next chapter, which allows you to prevent an array overrun. +The puts() function writes its string argument to the screen followed by a newline. Its prototype is: + +int puts(const char *str); +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 193 + + +puts() recognizes the same backslash codes as printf() , such as '\t' for tab. A call +to puts() requires far less overhead than the same call to printf() because puts() can only output a string of charactersit cannot output numbers or do format conversions. Therefore, puts() takes up less space and runs faster than printf() . For this reason, the puts() function is often used when it is important to have highly optimized code. The puts() function returns EOF if an error occurs. Otherwise, it returns a nonnegative value. However, when writing to the console, you can usually assume that no error will occur, so the return value of puts() is seldom monitored. The following statement displays hello: + + +puts("hello"); + +Table 8-1 summarizes the basic console I/O functions. +The following program, a simple computerized dictionary, demonstrates several of the basic console I/O functions. It prompts the user to enter a word and then checks to see if the word matches one in its built-in database. If a match is found, +the program prints the word's meaning. Pay special attention to the indirection used in this program. If you have any trouble understanding it, remember that the dic array is an array of pointers to strings. Notice that the list must be terminated by two nulls. + + + +Function + +getchar() + +getche() + + +getch() + + +putchar() gets() puts() + + +Table 8-1. + +Operation + +Reads a character from the keyboard; waits for carriage return. +Reads a character with echo; does not wait for carriage return; not defined by +Standard C/C++, but a common extension. +Reads a character without echo; does not wait for carriage return; not defined by Standard C/C++, but a common extension. +Writes a character to the screen. Reads a string from the keyboard. Writes a string to the screen. + + +The Basic I/O Functions +194 C + + : T h e C o m p l e t e R e f e r e n c e + + +/* A simple dictionary. */ #include #include #include + +/* list of words and meanings */ char *dic[][40] = { +"atlas", "A volume of maps.", "car", "A motorized vehicle.", +"telephone", "A communication device.", "airplane", "A flying machine.", +"", "" /* null terminate the list */ }; + +int main(void) { +char word[80], ch; char **p; + +do { +puts("\nEnter word: "); scanf("%s", word); + +p = (char **)dic; + +/* find matching word and print its meaning */ do { +if(!strcmp(*p, word)) { puts("Meaning:"); puts(*(p+1)); +break; } +if(!strcmp(*p, word)) break; +p = p + 2; /* advance through the list */ } while(*p); +if(!*p) puts("Word not in dictionary."); printf("Another? (y/n): "); +scanf(" %c%*c", &ch); +} while(toupper(ch) != 'N'); + +return 0; } +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 195 + + +Formatted Console I/O +The functions printf() and scanf() perform formatted output and inputthat is, they can read and write data in various formats that are under your control. The printf() function writes data to the console. The scanf() function, its complement, reads data from the keyboard. Both functions can operate on any of the built-in data types, including characters, strings, and numbers. + + +printf( ) +The prototype for printf() is + +int printf(const char *control_string, ...); + +The printf() function returns the number of characters written or a negative value if an error occurs. +The control_string consists of two types of items. The first type is composed of characters that will be printed on the screen. The second type contains format specifiers that define the way the subsequent arguments are displayed. A format specifier begins with a percent sign and is followed by the format code. There must be exactly the same number of arguments as there are format specifiers, and the format specifiers and the arguments are matched in order from left to right. For example, this printf() call + +printf("I like %c%s", 'C', "++ very much!"); + +displays + +I like C++ very much! + +The printf() function accepts a wide variety of format specifiers, as shown in Table 8-2. + + + + +Code + +%c %d + + +Table 8-2. + +Format + +Character +Signed decimal integers + + +printf( ) Format Specifiers +196 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Code + +%i %e %E %f %g %G %o %s %u %x %X %p %n + + +%% + +Table 8-2. + +Format + +Signed decimal integers Scientific notation (lowercase e) Scientific notation (uppercase E) Decimal floating point +Uses %e or %f, whichever is shorter Uses %E or %F, whichever is shorter Unsigned octal +String of characters Unsigned decimal integers +Unsigned hexadecimal (lowercase letters) Unsigned hexadecimal (uppercase letters) Displays a pointer +The associated argument must be a pointer to an integer. This specifier causes the number of +characters written so far to be put into that integer. +Prints a % sign + +printf( ) Format Specifiers (continued) + + + + +Printing Characters +To print an individual character, use %c. This causes its matching argument to be output, unmodified, to the screen. + +To print a string, use %s. + +Printing Numbers +You may use either %d or %i to indicate a signed decimal number. These format specifiers are equivalent; both are supported for historical reasons. + +To output an unsigned value, use %u. + +The %f format specifier displays numbers in floating point. +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 197 + + +The %e and %E specifiers tell printf() to display a double argument in scientific notation. Numbers represented in scientific notation take this general form: + +x.dddddE+/−yy + +If you want to display the letter "E" in uppercase, use the %E format; otherwise use %e. You can tell printf() to use either %f or %e by using the %g or %G format specifiers. +This causes printf() to select the format specifier that produces the shortest output. Where applicable, use %G if you want "E" shown in uppercase; otherwise, use %g. The following program demonstrates the effect of the %g format specifier: + + +#include + +int main(void) { +double f; + +for(f=1.0; f<1.0e+10; f=f*10) printf("%g ", f); + +return 0; } + +It produces the following output. + +1 10 100 1000 10000 100000 1e+006 1e+007 1e+008 1e+009 + +You can display unsigned integers in octal or hexadecimal format using %o and %x, respectively. Since the hexadecimal number system uses the letters A through F to represent the numbers 10 through 15, you can display these letters in either upper- or lowercase. For uppercase, use the %X format specifier; for lowercase, use %x, as shown here: + + +#include + +int main(void) { +unsigned num; + +for(num=0; num<255; num++) { printf("%o ", num); +198 C + + : T h e C o m p l e t e R e f e r e n c e + + + +printf("%x ", num); printf("%X\n", num); +} + +return 0; } + + +Displaying an Address +If you wish to display an address, use %p. This format specifier causes printf() to display a machine address in a format compatible with the type of addressing used by the computer. The next program displays the address of sample: + + +#include + +int sample; + +int main(void) { +printf("%p", &sample); + +return 0; } + +The %n Specifier +The %n format specifier is different fromthe others. Instead of telling printf() to +display something, it causes printf() to load the variable pointed to by its corresponding argument with a value equal to the number of characters that have been output. In other words, the value that corresponds to the %n format specifier must be a pointer to a variable. After the call to printf() has returned, this variable will hold the number of characters output, up to the point at which the %n was encountered. Examine this programto understand this somewhat unusual format code. + + +#include + +int main(void) { +int count; + +printf("this%n is a test\n", &count); printf("%d", count); + +return 0; } +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 199 + + +This program displays this is a test followed by the number 4. The %n format specifier is used primarily to enable your program to perform dynamic formatting. + +Format Modifiers +Many format specifiers may take modifiers that alter their meaning slightly. For example, you can specify a minimum field width, the number of decimal places, and left justification. The format modifier goes between the percent sign and the format code. These modifiers are discussed next. + +The Minimum Field Width Specifier +An integer placed between the % sign and the format code acts as a minimum field width +specifier. This pads the output with spaces to ensure that it reaches a certain minimum length. If the string or number is longer than that minimum, it will still be printed in full. The default padding is done with spaces. If you wish to pad with 0's, place a 0 before the field width specifier. For example, %05d will pad a number of less than five digits with 0's so that its total length is five. The following program demonstrates the minimum field width specifier: + + +#include + +int main(void) { +double item; + +item = 10.12304; + +printf("%f\n", item); printf("%10f\n", item); printf("%012f\n", item); + +return 0; } + +This program produces the following output: + +10.123040 10.123040 +00010.123040 + +The minimum field width modifier is most commonly used to produce tables in which the columns line up. For example, the next program produces a table of squares and cubes for the numbers between 1 and 19: +200 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include + +int main(void) { +int i; + +/* display a table of squares and cubes */ for(i=1; i<20; i++) +printf("%8d %8d %8d\n", i, i*i, i*i*i); + +return 0; } + +A sample of its output is shown here: + +1 1 1 2 4 8 3 9 27 4 16 64 5 25 125 6 36 216 7 49 343 8 64 512 9 81 729 10 100 1000 +11 121 1331 12 144 1728 13 169 2197 14 196 2744 15 225 3375 16 256 4096 17 289 4913 18 324 5832 19 361 6859 + + +The Precision Specifier +The precision specifier follows the minimum field width specifier (if there is one). It consists of a period followed by an integer. Its exact meaning depends upon the type of data it is applied to. +When you apply the precision specifier to floating-point data using the %f, %e, or %E specifiers, it determines the number of decimal places displayed. For example, +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 201 + + +%10.4f displays a number at least ten characters wide with four decimal places. If you don't specify the precision, a default of six is used. +When the precision specifier is applied to %g or %G, it specifies the number of significant digits. +Applied to strings, the precision specifier specifies the maximum field length. For example, %5.7s displays a string at least five and not exceeding seven characters long. If the string is longer than the maximum field width, the end characters will be truncated. +When applied to integer types, the precision specifier determines the minimum number of digits that will appear for each number. Leading zeros are added to achieve the required number of digits. +The following program illustrates the precision specifier: + +#include + +int main(void) { +printf("%.4f\n", 123.1234567); printf("%3.8d\n", 1000); +printf("%10.15s\n", "This is a simple test."); + +return 0; } + +It produces the following output: + +123.1235 00001000 +This is a simpl + +Justifying Output +By default, all output is right-justified. That is, if the field width is larger than the data printed, the data will be placed on the right edge of the field. You can force output to be left-justified by placing a minus sign directly after the %. For example, %−10.2f left-justifies a floating-point number with two decimal places in a 10-character field. +The following program illustrates left justification: + + +#include + +int main(void) { +202 C + + : T h e C o m p l e t e R e f e r e n c e + + + +printf("right-justified:%8d\n", 100); printf("left-justified:%-8d\n", 100); + +return 0; } + + +Handling Other Data Types +There are two format modifiers that allow printf() to display short and long integers. +These modifiers may be applied to the d, i, o, u, and x type specifiers. The l (ell) modifier tells printf() that a long data type follows. For example, %ld means that a long int is to be displayed. The h modifier instructs printf() to display a short integer. For instance, %hu indicates that the data is of type short unsigned int. +The L modifier may prefix the floating-point specifiers e, f, and g, and indicates that a long double follows. + +The * and # Modifiers +The printf() function supports two additional modifiers to some of its format +specifiers: * and #. +Preceding g, G, f, E, or e specifiers with a # ensures that there will be a decimal point even if there are no decimal digits. If you precede the x or X format specifier with a #, the hexadecimal number will be printed with a 0x prefix. Preceding the o specifier with # causes the number to be printed with a leading zero. You cannot +apply # to any other format specifiers. +Instead of constants, the minimum field width and precision specifiers may be provided by arguments to printf() . To accomplish this, use an * as a placeholder. When the format string is scanned, printf() will match the * to an argument in the order in which they occur. For example, in Figure 8-1, the minimum field width is 10, the precision is 4, and the value to be displayed is 123.3. +The following program illustrates both # and *: + + +#include + +int main(void) { +printf("%x %#x\n", 10, 10); printf("%*.*f", 10, 4, 1234.34); + +return 0; } +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 203 + + + + + +printf("%*.*f", 10, 4, 123.3); + + + + +Figure 8-1. How the * is matched to its value + + + +scanf( ) +scanf() is the general-purpose console input routine. It can read all the built-in data types and automatically convert numbers into the proper internal format. It is much like the reverse of printf() . The prototype for scanf() is + +int scanf(const char *control_string, ...); + +The scanf() function returns the number of data items successfully assigned a value. If an error occurs, scanf() returns EOF. The control_string determines how values are read into the variables pointed to in the argument list. +The control string consists of three classifications of characters: + + Format specifiers + + White-space characters + + Non-white-space characters + +Let's take a look at each of these now. + +Format Specifiers +The input format specifiers are preceded by a % sign and tell scanf() what type of data is to be read next. These codes are listed in Table 8-3. The format specifiers are matched, in order from left to right, with the arguments in the argument list. Let's look at some examples. + +Inputting Numbers +To read an integer, use either the %d or %i specifier. To read a floating-point number represented in either standard or scientific notation, use %e, %f, or %g. +You can use scanf() to read integers in either octal or hexadecimal form by using the %o and %x format commands, respectively. The %x may be in either upper- or +204 C + + : T h e C o m p l e t e R e f e r e n c e + + +lowercase. Either way, you may enter the letters "A" through "F" in either case when entering hexadecimal numbers. The following program reads an octal and hexadecimal number: + + +#include + +int main(void) { +int i, j; + +scanf("%o%x", &i, &j); printf("%o %x", i, j); + +return 0; } + + + +Code + +%c %d %i + +%e %f %g %o %s %x %p %n + +%u %[ ] %% + +Table 8-3. + +Meaning + +Read a single character. Read a decimal integer. +Read an integer in either decimal, octal, or hexadecimal format. +Read a floating-point number. Read a floating-point number. Read a floating-point number. Read an octal number. +Read a string. +Read a hexadecimal number. Read a pointer. +Receives an integer value equal to the number of characters read so far. +Read an unsigned decimal integer. Scan for a set of characters. +Read a percent sign. + +scanf( ) Format Specifiers +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 205 + + +The scanf() function stops reading a number when the first nonnumeric character is encountered. + +Inputting Unsigned Integers +To input an unsigned integer, use the %u format specifier. For example, + +unsigned num; scanf("%u", &num); + +reads an unsigned number and puts its value into num. + +Reading Individual Characters Using scanf( ) +As explained earlier in this chapter, you can read individual characters using +getchar() or a derivative function. You can also use scanf() for this purpose if +you use the %c format specifier. However, like most implementations of getchar() , scanf() will generally line-buffer input when the %c specifier is used. This makes it somewhat troublesome in an interactive environment. +Although spaces, tabs, and newlines are used as field separators when reading other types of data, when reading a single character, white-space characters are read like any other character. For example, with an input stream of "x y," this code fragment + +scanf("%c%c%c", &a, &b, &c); + +returns with the character x in a, a space in b, and the character y in c. + +Reading Strings +The scanf() function can be used to read a string from the input stream using the %s +format specifier. Using %s causes scanf() to read characters until it encounters a white-space character. The characters that are read are put into the character array pointed to by the corresponding argument and the result is null terminated. As it applies to scanf() , a white-space character is either a space, a newline, a tab, a vertical tab, or a form feed. Unlike gets() , which reads a string until a carriage return is typed, scanf() reads a string until the first white space is entered. This means that you cannot use scanf() to read a string like "this is a test" because the first space terminates the reading process. To see the effect of the %s specifier, try this program using the string "hello there". + + +#include + +int main(void) +206 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +char str[80]; + +printf("Enter a string: "); scanf("%s", str); +printf("Here's your string: %s", str); + +return 0; } + +The program responds with only the "hello" portion of the string. + +Inputting an Address +To input a memory address, use the %p format specifier. This specifier causes scanf() to read an address in the format defined by the architecture of the CPU. For example, this program inputs an address and then displays what is at that memory address: + + +#include + +int main(void) { +char *p; + +printf("Enter an address: "); scanf("%p", &p); +printf("Value at location %p is %c\n", p, *p); + +return 0; } + +The %n Specifier +The %n specifier instructs scanf() to assign the number of characters read from the input stream at the point at which the %n was encountered to the variable pointed to by the corresponding argument. + +Using a Scanset +The scanf() function supports a general-purpose format specifier called a scanset. A scanset defines a set of characters. When scanf() processes a scanset, it will input characters as long as those characters are part of the set defined by the scanset. The +characters read will be assigned to the character array that is pointed to by the scanset's +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 207 + + +corresponding argument. You define a scanset by putting the characters to scan for inside square brackets. The beginning square bracket must be prefixed by a percent sign. For example, the following scanset tells scanf() to read only the characters X, Y, and Z. + + +%[XYZ] + +When you use a scanset, scanf() continues to read characters, putting them into the corresponding character array until it encounters a character that is not in the scanset. Upon return from scanf() , this array will contain a null-terminated string that consists of the characters that have been read. To see how this works, try this program: + + +#include + +int main(void) { +int i; +char str[80], str2[80]; + +scanf("%d%[abcdefg]%s", &i, str, str2); printf("%d %s %s", i, str, str2); + +return 0; } + +Enter 123abcdtye followed by ENTER. The program will then display 123 abcd tye. Because the "t" is not part of the scanset, scanf() stops reading characters into str when it encounters the "t." The remaining characters are put into str2. +You can specify an inverted set if the first character in the set is a ^. The ^ instructs scanf() to accept any character that is not defined by the scanset. +In most implementations you can specify a range using a hyphen. For example, this tells scanf() to accept the characters A through Z: + + +%[A-Z] + +One important point to remember is that the scanset is case sensitive. If you want to scan for both upper- and lowercase letters, you must specify them individually. + +Discarding Unwanted White Space +A white-space character in the control string causes scanf() to skip over one or more leading white-space characters in the input stream. A white-space character is either a +208 C + + : T h e C o m p l e t e R e f e r e n c e + + +space, a tab, vertical tab, form feed, or a newline. In essence, one white-space character in the control string causes scanf() to read, but not store, any number (including zero) of white-space characters up to the first non-white-space character. + +Non-White-Space Characters in the Control String +A non-white-space character in the control string causes scanf() to read and discard +matching characters in the input stream. For example, "%d,%d" causes scanf() to read an integer, read and discard a comma, and then read another integer. If the specified character is not found, scanf() terminates. If you wish to read and discard a percent sign, use %% in the control string. + +You Must Pass scanf( ) Addresses +All the variables used to receive values through scanf() must be passed by their addresses. This means that all arguments must be pointers to the variables used as arguments. Recall that this is one way of creating a call by reference, and it allows a function to alter the contents of an argument. For example, to read an integer into the variable count, you would use the following scanf() call: + + +scanf("%d", &count); + +Strings will be read into character arrays, and the array name, without any index, is the address of the first element of the array. So, to read a string into the character array str, you would use + + +scanf("%s", str); + +In this case, str is already a pointer and need not be preceded by the & operator. + +Format Modifiers +As with printf() , scanf() allows a number of its format specifiers to be modified. +The format specifiers can include a maximum field length modifier. This is an integer, placed between the % and the format specifier, that limits the number of characters read for that field. For example, to read no more than 20 characters into str, write + + +scanf("%20s", str); + +If the input stream is greater than 20 characters, a subsequent call to input begins where this call leaves off. For example, if you enter + +ABCDEFGHIJKLMNOPQRSTUVWXYZ +C h a p t e r 8 : C - S t y l e C o n s o l e I / O 209 + + +as the response to the scanf() call in this example, only the first 20 characters, or up +to the "T," are placed into str because of the maximum field width specifier. This means that the remaining characters, UVWXYZ, have not yet been used. If another scanf() +call is made, such as + + +scanf("%s", str); + +the letters UVWXYZ are placed into str. Input for a field may terminate before the maximum field length is reached if a white space is encountered. In this case, scanf() moves on to the next field. +To read a long integer, put an l (ell) in front of the format specifier. To read a short integer, put an h in front of the format specifier. These modifiers can be used with the d, i, o, u, and x format codes. +By default, the f, e, and g specifiers instruct scanf() to assign data to a float. If you put an l (ell) in front of one of these specifiers, scanf() assigns the data to a double. Using an L tells scanf() that the variable receiving the data is a long double. + +Suppressing Input +You can tell scanf() to read a field but not assign it to any variable by preceding that field's format code with an *. For example, given + + +scanf("%d%*c%d", &x, &y); + +you could enter the coordinate pair 10,10. The comma would be correctly read, but not assigned to anything. Assignment suppression is especially useful when you need to process only a part of what is being entered. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 9 File I/O + + + + + + + + + + + + + + +211 +212 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the C file system. As explained in Chapter 8, C++ supports two complete I/O systems: the one inherited from C and the object-oriented system defined by C++. This chapter covers the C file system. (The C++ file +T +system is discussed in Part Two.) While most new code will use the C++ file system, knowledge of the C file system is still important for the reasons given in the preceding chapter. + + +C Versus C++ File I/O +There is sometimes confusion over how C's file system relates to C++. First, C++ supports the entire Standard C file system. Thus, if you will be porting older C code to C++, you will not have to change all of your I/O routines right away. Second, C++ defines its own, object-oriented I/O system, which includes both I/O functions and I/O operators. The C++ I/O system completely duplicates the functionality of the C I/O system and renders the C file system redundant. While you will usually want to use the C++ I/O system, you are free to use the C file system if you like. Of course, most C++ programmers elect to use the C++ I/O system for reasons that are made clear in Part Two of this book. + + +Streams and Files +Before beginning our discussion of the C file system, it is necessary to know the difference between the terms streams and files. The C I/O system supplies a consistent interface to the programmer independent of the actual device being accessed. That +is, the C I/O system provides a level of abstraction between the programmer and the device. This abstraction is called a stream and the actual device is called a file. It is important to understand how streams and files interact. + + +Note + +The concept of streams and files is also important to the C++ I/O system discussed in Part Two. + + + +Streams +The C file system is designed to work with a wide variety of devices, including terminals, disk drives, and tape drives. Even though each device is very different, the buffered file system transforms each into a logical device called a stream. All streams behave similarly. Because streams are largely device independent, the same function that can write to a disk file can also be used to write to another type of device, such as the console. There are two types of streams: text and binary. +C h a p t e r 9 : F i l e I / O 213 + + +Text Streams +A text stream is a sequence of characters. Standard C allows (but does not require) a +text stream to be organized into lines terminated by a newline character. However, the newline character is optional on the last line. (Actually, most C/C++ compilers do not terminate text streams with newline characters.) In a text stream, certain character translations may occur as required by the host environment. For example, a newline may be converted to a carriage return/linefeed pair. Therefore, there may not be a one-to-one relationship between the characters that are written (or read) and those +on the external device. Also, because of possible translations, the number of characters written (or read) may not be the same as those on the external device. + +Binary Streams +A binary stream is a sequence of bytes that have a one-to-one correspondence to those +in the external devicethat is, no character translations occur. Also, the number of bytes written (or read) is the same as the number on the external device. However, +an implementation-defined number of null bytes may be appended to a binary stream. These null bytes might be used to pad the information so that it fills a sector on a disk, for example. + + +Files +In C/C++, a file may be anything from a disk file to a terminal or printer. You associate a stream with a specific file by performing an open operation. Once a file is open, information may be exchanged between it and your program. +Not all files have the same capabilities. For example, a disk file can support random access while some printers cannot. This brings up an important point about the C I/O system: All streams are the same but all files are not. +If the file can support position requests, opening that file also initializes the file position indicator to the start of the file. As each character is read from or written to the file, the position indicator is incremented, ensuring progression through the file. +You disassociate a file from a specific stream with a close operation. If you close a file opened for output, the contents, if any, of its associated stream are written to the external device. This process is generally referred to as flushing the stream, and guarantees that no information is accidentally left in the disk buffer. All files are closed automatically when your program terminates normally, either by main() returning to the operating system or by a call to exit() . Files are not closed when a program terminates abnormally, such as when it crashes or when it calls abort() . +Each stream that is associated with a file has a file control structure of type FILE. Never modify this file control block. +214 C + + : T h e C o m p l e t e R e f e r e n c e + + +If you are new to programming, the separation of streams and files may seem unnecessary or contrived. Just remember that its main purpose is to provide a consistent interface. You need only think in terms of streams and use only one file system to accomplish all I/O operations. The I/O system automatically converts the raw input or output from each device into an easily managed stream. + + +File System Basics +The C file system is composed of several interrelated functions. The most common of these are shown in Table 9-1. They require the header stdio.h. C++ programs may also use the new-style header . + + + +Name + +fopen( ) fclose( ) putc( ) fputc( ) getc( ) fgetc( ) fgets( ) fputs( ) fseek( ) ftell( ) fprintf( ) fscanf( ) feof( ) ferror( ) rewind( ) + +remove( ) fflush( ) + +Table 9-1. + +Function + +Opens a file. Closes a file. +Writes a character to a file. Same as putc() . +Reads a character from a file. Same as getc() . +Reads a string from a file. Writes a string to a file. +Seeks to a specified byte in a file. Returns the current file position. +Is to a file what printf() is to the console. Is to a file what scanf() is to the console. Returns true if end-of-file is reached. Returns true if an error has occurred. +Resets the file position indicator to the beginning of the file. +Erases a file. Flushes a file. + +Commonly Used C File-System Functions +C h a p t e r 9 : F i l e I / O 215 + + +The header file stdio.h and header provide the prototypes for the I/O functions and define these three types: size_t, fpos_t, and FILE. The size_t type is some variety of unsigned integer, as is fpos_t. The FILE type is discussed in the next section. +Also defined in stdio.h and are several macros. The ones relevant to this chapter are NULL, EOF, FOPEN_MAX, SEEK_SET, SEEK_CUR, and SEEK_END. The NULL macro defines a null pointer. The EOF macro is generally defined as −1 and is the value returned when an input function tries to read past the end of the file. FOPEN_MAX defines an integer value that determines the number of files that may +be open at any one time. The other macros are used with fseek() , which is the function that performs random access on a file. + +The File Pointer +The file pointer is the common thread that unites the C I/O system. A file pointer is a +pointer to a structure of type FILE. It points to information that defines various things about the file, including its name, status, and the current position of the file. In essence, the file pointer identifies a specific file and is used by the associated stream to direct the operation of the I/O functions. In order to read or write files, your program needs to use file pointers. To obtain a file pointer variable, use a statement like this: + + +FILE *fp; + +Opening a File +The fopen() function opens a stream for use and links a file with that stream. Then it returns the file pointer associated with that file. Most often (and for the rest of this discussion), the file is a disk file. The fopen() function has this prototype: + +FILE *fopen(const char *filename, const char *mode); + +where filename is a pointer to a string of characters that make up a valid filename and may include a path specification. The string pointed to by modedetermines how the file will be opened. Table 9-2 shows the legal values for mode. Strings like "r+b" may also be represented as "rb+." + + + +Mode + +r w a + +Table 9-2. + +Meaning + +Open a text file for reading. Create a text file for writing. Append to a text file. + +The Legal Values for Mode +216 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Mode + +rb wb ab r+ w+ a+ + +r+b w+b a+b + + +Table 9-2. + +Meaning + +Open a binary file for reading. Create a binary file for writing. Append to a binary file. +Open a text file for read/write. Create a text file for read/write. +Append or create a text file for read/write. +Open a binary file for read/write. Create a binary file for read/write. +Append or create a binary file for read/write. + + +The Legal Values for Mode (continued) + + + + +As stated, the fopen() function returns a file pointer. Your program should never alter the value of this pointer. If an error occurs when it is trying to open the file, fopen() returns a null pointer. +The following code uses fopen() to open a file named TEST for output. + + +FILE *fp; +fp = fopen("test", "w"); + +While technically correct, you will usually see the preceding code written like this: + +FILE *fp; + +if ((fp = fopen("test","w"))==NULL) { printf("Cannot open file.\n"); exit(1); +} +C h a p t e r 9 : F i l e I / O 217 + + +This method will detect any error in opening a file, such as a write-protected or a full disk, before your program attempts to write to it. In general, you will always want to confirm that fopen() succeeded before attempting any other operations on the file. +Although most of the file modes are self-explanatory, a few comments are in order. If, when opening a file for read-only operations, the file does not exist, fopen() will fail. When opening a file using append mode, if the file does not exist, it will be created. Further, when a file is opened for append, all new data written to the file will be written to the end of the file. The original contents will remain unchanged. If, when a file is opened for writing, the file does not exist, it will be created. If it does exist, the contents of the original file will be destroyed and a new file created. The difference between modes r+ and w+ is that r+ will not create a file if it does not exist; however, w+ will. Further, if the file already exists, opening it with w+ destroys its contents; opening it with r+ does not. +As Table 9-2 shows, a file may be opened in either text or binary mode. In most implementations, in text mode, carriage return/linefeed sequences are translated to newline characters on input. On output, the reverse occurs: newlines are translated to carriage return/linefeeds. No such translations occur on binary files. +The number of files that may be open at any one time is specified by FOPEN_MAX. This value will usually be at least 8, but you must check your compiler manual for its exact value. + +Closing a File +The fclose() function closes a stream that was opened by a call to fopen() . It writes any data still remaining in the disk buffer to the file and does a formal operating-system-level close on the file. Failure to close a stream invites all kinds of trouble, including lost data, destroyed files, and possible intermittent errors in your program. fclose() also frees the file control block associated with the stream, making it available for reuse. There is an operating-system limit to the number of open files you may have at any one time, so you may have to close one file before opening another. +The fclose() function has this prototype: + +int fclose(FILE *fp); + +wherefpisthefilepointerreturnedbythecalltofopen() .Areturnvalueofzerosignifies asuccessfulcloseoperation.ThefunctionreturnsEOFifanerroroccurs.Youcanusethe standardfunctionferror() (discussedshortly)todetermineandreportanyproblems. Generally,fclose() willfailonlywhenadiskhasbeenprematurelyremovedfromthe driveorthereisnomorespaceonthedisk. +218 C + + : T h e C o m p l e t e R e f e r e n c e + + +Writing a Character +The C I/O system defines two equivalent functions that output a character: putc() and +fputc() . (Actually, putc() is usually implemented as a macro.) There are two identical functions simply to preserve compatibility with older versions of C. This book uses putc() , but you can use fputc() if you like. +The putc() function writes characters to a file that was previously opened for writing using the fopen() function. The prototype of this function is + +int putc(int ch, FILE *fp); + +where fp is the file pointer returned by fopen() and ch is the character to be output. The file pointer tells putc() which file to write to. For historical reasons, ch is defined as an int but only the low-order byte is written. +If a putc() operation is successful, it returns the character written. Otherwise, it returns EOF. + +Reading a Character +There are also two equivalent functions that input a character: getc() and fgetc() . Both +are defined to preserve compatibility with older versions of C. This book uses getc() (which is usually implemented as a macro), but you can use fgetc() if you like. +The getc() function reads characters from a file opened in read mode by fopen() . The prototype of getc() is + +int getc(FILE *fp); + +where fp is a file pointer of type FILE returned by fopen() . getc() returns an integer, but the character is contained in the low-order byte. Unless an error occurs, the high-order byte is zero. +The getc() function returns an EOF when the end of the file has been reached. Therefore, to read to the end of a text file, you could use the following code: + +do { +ch = getc(fp); } while(ch!=EOF); + +However, getc() also returns EOF if an error occurs. You can use ferror() to determine precisely what has occurred. + +Using fopen( ), getc( ), putc( ), and fclose( ) +The functions fopen() , getc() , putc() , and fclose() constitute the minimal set of file routines. The following program, KTOD, is a simple example of using putc() , fopen() , +C h a p t e r 9 : F i l e I / O 219 + + +and fclose() . It reads characters from the keyboard and writes them to a disk file until the user types a dollar sign. The filename is specified from the command line. For example, if you call this program KTOD, typing KTOD TEST allows you to enter lines of text into the file called TEST. + + +/* KTOD: A key to disk program. */ #include +#include + +int main(int argc, char *argv[]) { +FILE *fp; char ch; + +if(argc!=2) { +printf("You forgot to enter the filename.\n"); exit(1); +} + +if((fp=fopen(argv[1], "w"))==NULL) { printf("Cannot open file.\n"); exit(1); +} + +do { +ch = getchar(); putc(ch, fp); +} while (ch != '$'); + +fclose(fp); + +return 0; } + +The complementary program DTOS reads any text file and displays the contents on the screen. + + +/* DTOS: A program that reads files and displays them on the screen. */ +#include #include +220 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +int main(int argc, char *argv[]) { +FILE *fp; char ch; + +if(argc!=2) { +printf("You forgot to enter the filename.\n"); exit(1); +} + +if((fp=fopen(argv[1], "r"))==NULL) { printf("Cannot open file.\n"); exit(1); +} + +ch = getc(fp); /* read one character */ + +while (ch!=EOF) { +putchar(ch); /* print on screen */ ch = getc(fp); +} + +fclose(fp); + +return 0; } + +To try these two programs, first use KTOD to create a text file. Then read its contents using DTOS. + +Using feof( ) +As just described, getc() returns EOF when the end of the file has been encountered. However, testing the value returned by getc() may not be the best way to determine when you have arrived at the end of a file. First, the file system can operate on both text and binary files. When a file is opened for binary input, an integer value that will test equal to EOF may be read. This would cause the input routine to indicate an +end-of-file condition even though the physical end of the file had not been reached. Second, getc() returns EOF when it fails and when it reaches the end of the file. Using only the return value of getc() , it is impossible to know which occurred. To solve these +C h a p t e r 9 : F i l e I / O 221 + + +problems, the C file system includes the function feof() , which determines when the end of the file has been encountered. The feof() function has this prototype: + +int feof(FILE *fp); + +feof() returns true if the end of the file has been reached; otherwise, it returns 0. Therefore, the following routine reads a binary file until the end of the file is encountered: + + +while(!feof(fp)) ch = getc(fp); + +Of course, you can apply this method to text files as well as binary files. +The following program, which copies text or binary files, contains an example of feof() . The files are opened in binary mode and feof() checks for the end of the file. + + +/* Copy a file. */ #include #include + +int main(int argc, char *argv[]) { +FILE *in, *out; char ch; + +if(argc!=3) { +printf("You forgot to enter a filename.\n"); exit(1); +} + +if((in=fopen(argv[1], "rb"))==NULL) { printf("Cannot open source file.\n"); exit(1); +} +if((out=fopen(argv[2], "wb")) == NULL) { printf("Cannot open destination file.\n"); exit(1); +} + +/* This code actually copies the file. */ while(!feof(in)) { +ch = getc(in); +222 C + + : T h e C o m p l e t e R e f e r e n c e + + + +if(!feof(in)) putc(ch, out); } + +fclose(in); fclose(out); + +return 0; } + + +Working with Strings: fputs( ) and fgets( ) +In addition to getc() and putc() , the C file system supports the related functions fgets() and fputs() , which read and write character strings from and to a disk file. These functions work just like putc() and getc() , but instead of reading or writing a single character, they read or write strings. They have the following prototypes: + +int fputs(const char *str, FILE *fp); +char *fgets(char *str, int length, FILE *fp); + +The fputs() function writes the string pointed to by str to the specified stream. It returns EOF if an error occurs. +Thefgets() functionreadsastringfromthespecifiedstreamuntileitheranewline characterisreadorlength−1charactershavebeenread.Ifanewlineisread,itwillbepart ofthestring(unlikethegets() function).Theresultantstringwillbenullterminated.The functionreturnsstrifsuccessfulandanullpointerifanerroroccurs. +The following program demonstrates fputs(). It reads strings from the keyboard and writes them to the file called TEST. To terminate the program, enter a blank line. Since gets() does not store the newline character, one is added before each string is written to the file so that the file can be read more easily. + +#include #include #include + +int main(void) { +char str[80]; FILE *fp; + +if((fp = fopen("TEST", "w"))==NULL) { printf("Cannot open file.\n"); +C h a p t e r 9 : F i l e I / O 223 + + + +exit(1); } + +do { +printf("Enter a string (CR to quit):\n"); gets(str); +strcat(str, "\n"); /* add a newline */ fputs(str, fp); +} while(*str!='\n'); + +return 0; } + + +rewind( ) +The rewind() function resets the file position indicator to the beginning of the file specified as its argument. That is, it "rewinds" the file. Its prototype is + +void rewind(FILE *fp); + +where fp is a valid file pointer. +To see an example of rewind() , you can modify the program from the previous section so that it displays the contents of the file just created. To accomplish this, the program rewinds the file after input is complete and then uses fgets() to read back the file. Notice that the file must now be opened in read/write mode using "w+" for the mode parameter. + + +#include #include #include + +int main(void) { +char str[80]; FILE *fp; + +if((fp = fopen("TEST", "w+"))==NULL) { printf("Cannot open file.\n"); exit(1); +} +224 C + + : T h e C o m p l e t e R e f e r e n c e + + + +do { +printf("Enter a string (CR to quit):\n"); gets(str); +strcat(str, "\n"); /* add a newline */ fputs(str, fp); +} while(*str!='\n'); + +/* now, read and display the file */ +rewind(fp); /* reset file position indicator to start of the file. */ +while(!feof(fp)) { fgets(str, 79, fp); printf(str); +} + +return 0; } + + +ferror( ) +The ferror() function determines whether a file operation has produced an error. The ferror() function has this prototype: + +int ferror(FILE *fp); + +where fp is a valid file pointer. It returns true if an error has occurred during the last file operation; otherwise, it returns false. Because each file operation sets the error condition, ferror() should be called immediately after each file operation; otherwise, an error may be lost. +The following program illustrates ferror() by removing tabs from a file and substituting the appropriate number of spaces. The tab size is defined by TAB_SIZE. Notice how ferror() is called after each file operation. To use the program, specify the names of the input and output files on the command line. + + +/* The program substitutes spaces for tabs +in a text file and supplies error checking. */ + +#include #include + +#define TAB_SIZE 8 +C h a p t e r 9 : F i l e I / O 225 + + + +#define IN 0 #define OUT 1 + +void err(int e); + +int main(int argc, char *argv[]) { +FILE *in, *out; int tab, i; char ch; + +if(argc!=3) { +printf("usage: detab \n"); exit(1); +} + +if((in = fopen(argv[1], "rb"))==NULL) { printf("Cannot open %s.\n", argv[1]); exit(1); +} + +if((out = fopen(argv[2], "wb"))==NULL) { printf("Cannot open %s.\n", argv[1]); exit(1); +} + +tab = 0; do { +ch = getc(in); if(ferror(in)) err(IN); + +/* if tab found, output appropriate number of spaces */ if(ch=='\t') { +for(i=tab; i<8; i++) { putc(' ', out); if(ferror(out)) err(OUT); +} +tab = 0; } +else { +putc(ch, out); if(ferror(out)) err(OUT); +226 C + + : T h e C o m p l e t e R e f e r e n c e + + + +tab++; +if(tab==TAB_SIZE) tab = 0; if(ch=='\n' || ch=='\r') tab = 0; +} +} while(!feof(in)); fclose(in); fclose(out); + +return 0; } + +void err(int e) { +if(e==IN) printf("Error on input.\n"); else printf("Error on output.\n"); exit(1); +} + + +Erasing Files +The remove() function erases the specified file. Its prototype is + +int remove(const char *filename); + +It returns zero if successful; otherwise, it returns a nonzero value. +The following program erases the file specified on the command line. However, it first gives you a chance to change your mind. A utility like this might be useful to new computer users. + + +/* Double check before erasing. */ #include +#include #include + +int main(int argc, char *argv[]) { +char str[80]; + +if(argc!=2) { +printf("usage: xerase \n"); exit(1); +C h a p t e r 9 : F i l e I / O 227 + + + +} + +printf("Erase %s? (Y/N): ", argv[1]); gets(str); + +if(toupper(*str)=='Y') if(remove(argv[1])) { +printf("Cannot erase file.\n"); exit(1); +} return 0; +} + + +Flushing a Stream +If you wish to flush the contents of an output stream, use the fflush() function, whose prototype is shown here: + +int fflush(FILE *fp); + +This function writes the contents of any buffered data to the file associated with fp. If you call fflush() with fp being null, all files opened for output are flushed. +The fflush() function returns 0 if successful; otherwise, it returns EOF. + + +fread( ) and fwrite( ) +To read and write data types that are longer than one byte, the C file system provides two functions: fread() and fwrite() . These functions allow the reading and writing of blocks of any type of data. Their prototypes are + +size_t fread(void *buffer, size_t num_bytes, size_t count, FILE *fp); +size_t fwrite(const void *buffer, size_t num_bytes, size_t count, FILE *fp); + +For fread() , buffer is a pointer to a region of memory that will receive the data from the file. For fwrite() , buffer is a pointer to the information that will be written to the file. The value of count determines how many items are read or written, with each item being num_bytes bytes in length. (Remember, the type size_t is defined as some type of unsigned integer.) Finally, fp is a file pointer to a previously opened stream. +The fread() function returns the number of items read. This value may be less than count if the end of the file is reached or an error occurs. The fwrite() function returns the number of items written. This value will equal count unless an error occurs. +228 C + + : T h e C o m p l e t e R e f e r e n c e + + +Using fread( ) and fwrite( ) +As long as the file has been opened for binary data, fread() and fwrite() can read and write any type of information. For example, the following program writes and then reads back a double, an int, and a long to and from a disk file. Notice how it uses sizeof to determine the length of each data type. + + +/* Write some non-character data to a disk file and read it back. */ +#include #include + +int main(void) { +FILE *fp; +double d = 12.23; int i = 101; long l = 123023L; + +if((fp=fopen("test", "wb+"))==NULL) { printf("Cannot open file.\n"); exit(1); +} + +fwrite(&d, sizeof(double), 1, fp); fwrite(&i, sizeof(int), 1, fp); fwrite(&l, sizeof(long), 1, fp); + +rewind(fp); + +fread(&d, sizeof(double), 1, fp); fread(&i, sizeof(int), 1, fp); fread(&l, sizeof(long), 1, fp); + +printf("%f %d %ld", d, i, l); + +fclose(fp); + +return 0; } + +As this program illustrates, the buffer can be (and often is) merely the memory used to hold a variable. In this simple program, the return values of fread() and fwrite() are ignored. In the real world, however, you should check their return values for errors. +C h a p t e r 9 : F i l e I / O 229 + + +One of the most useful applications of fread() and fwrite() involves reading and writing user-defined data types, especially structures. For example, given this structure: + + +struct struct_type { float balance; char name[80]; +} cust; + +the following statement writes the contents of cust to the file pointed to by fp. + +fwrite(&cust, sizeof(struct struct_type), 1, fp); + + +fseek( ) and Random-Access I/O +You can perform random-access read and write operations using the C I/O system with the help of fseek() , which sets the file position indicator. Its prototype is shown here: + +int fseek(FILE *fp, long numbytes, int origin); + +Here, fp is a file pointer returned by a call to fopen() . numbytes is the number of bytes from origin that will become the new current position, and origin is one of the following macros: + + +Origin + +Beginning of file Current position +End of file + +Macro Name + +SEEK_SET SEEK_CUR +SEEK_END + + +Therefore, to seek numbytes from the start of the file, origin should be SEEK_SET. To seek from the current position, use SEEK_CUR; and to seek from the end of the file, use SEEK_END. The fseek() function returns 0 when successful and a nonzero value if an error occurs. +The following program illustrates fseek() . It seeks to and displays the specified byte in the specified file. Specify the filename and then the byte to seek to on the command line. + + +#include #include + +int main(int argc, char *argv[]) +230 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +FILE *fp; + +if(argc!=3) { +printf("Usage: SEEK filename byte\n"); exit(1); +} + +if((fp = fopen(argv[1], "rb"))==NULL) { printf("Cannot open file.\n"); exit(1); +} + +if(fseek(fp, atol(argv[2]), SEEK_SET)) { printf("Seek error.\n"); +exit(1); } + +printf("Byte at %ld is %c.\n", atol(argv[2]), getc(fp)); fclose(fp); + +return 0; } + +You can use fseek() to seek in multiples of any type of data by simply multiplying the size of the data by the number of the item you want to reach. For example, assume that you have a mailing list that consists of structures of type list_type. To seek to the tenth address in the file that holds the addresses, use this statement: + + +fseek(fp, 9*sizeof(struct list_type), SEEK_SET); + +You can determine the current location of a file using ftell() . Its prototype is + +long ftell(FILE *fp); + +It returns the location of the current position of the file associated with fp. If a failure occurs, it returns −1. +In general, you will want to use random access only on binary files. The reason for this is simple. Because text files may have character translations performed on them, there may not be a direct correspondence between what is in the file and the byte to which it would appear that you want to seek. The only time you should use +C h a p t e r 9 : F i l e I / O 231 + + +fseek() with a text file is when seeking to a position previously determined by ftell() , using SEEK_SET as the origin. +Remember one important point: Even a file that contains only text can be opened as a binary file, if you like. There is no inherent restriction about random access on files containing text. The restriction applies only to files opened as text files. + + +fprintf( ) and fscanf( ) +In addition to the basic I/O functions already discussed, the C I/O system includes fprintf() and fscanf() . These functions behave exactly like printf() and scanf() except that they operate with files. The prototypes of fprintf() and fscanf() are + +int fprintf(FILE *fp, const char *control_string,. . .); int fscanf(FILE *fp, const char *control_string,. . .); + +where fp is a file pointer returned by a call to fopen() . fprintf() and fscanf() direct their I/O operations to the file pointed to by fp. +As an example, the following program reads a string and an integer from the keyboard and writes them to a disk file called TEST. The program then reads the file and displays the information on the screen. After running this program, examine the TEST file. As you will see, it contains human-readable text. + + +/* fscanf() - fprintf() example */ #include +#include #include + +int main(void) { +FILE *fp; char s[80]; int t; + +if((fp=fopen("test", "w")) == NULL) { printf("Cannot open file.\n"); exit(1); +} + +printf("Enter a string and a number: "); +fscanf(stdin, "%s%d", s, &t); /* read from keyboard */ +232 C + + : T h e C o m p l e t e R e f e r e n c e + + + +fprintf(fp, "%s %d", s, t); /* write to file */ fclose(fp); + +if((fp=fopen("test","r")) == NULL) { printf("Cannot open file.\n"); exit(1); +} + +fscanf(fp, "%s%d", s, &t); /* read from file */ fprintf(stdout, "%s %d", s, t); /* print on screen */ + +return 0; } + +A word of warning: Although fprintf() and fscanf() often are the easiest way to write and read assorted data to disk files, they are not always the most efficient. Because formatted ASCII data is being written as it would appear on the screen (instead of in binary), extra overhead is incurred with each call. So, if speed or file size is a concern, you should probably use fread() and fwrite() . + + +The Standard Streams +As it relates to the C file system, when a program starts execution, three streams are opened automatically. They are stdin (standard input), stdout (standard output), and stderr (standard error). Normally, these streams refer to the console, but they may be redirected by the operating system to some other device in environments that support redirectable I/O. (Redirectable I/O is supported by Windows, DOS, Unix, and OS/2, for example.) +Because the standard streams are file pointers, they may be used by the C I/O system to perform I/O operations on the console. For example, putchar() could be defined like this: + + +int putchar(char c) { +return putc(c, stdout); } + +In general, stdin is used to read from the console, and stdout and stderr are used to write to the console. +C h a p t e r 9 : F i l e I / O 233 + + +You may use stdin, stdout, and stderr as file pointers in any function that uses a variable of type FILE *. For example, you could use fgets() to input a string from the console using a call like this: + + +char str[255]; fgets(str, 80, stdin); + +In fact, using fgets() in this manner can be quite useful. As mentioned earlier in this chapter, when using gets() it is possible to overrun the array that is being used to receive the characters entered by the user because gets() provides no bounds checking. When used with stdin, the fgets() function offers a useful alternative because it can limit the number of characters read and thus prevent array overruns. The only trouble is that fgets() does not remove the newline character and gets() does, so you will have to manually remove it, as shown in the following program. + + +#include #include + +int main(void) { +char str[80]; int i; + +printf("Enter a string: "); fgets(str, 10, stdin); + +/* remove newline, if present */ i = strlen(str)-1; if(str[i]=='\n') str[i] = '\0'; + +printf("This is your string: %s", str); + +return 0; } + +Keep in mind that stdin, stdout, and stderr are not variables in the normal sense and may not be assigned a value using fopen() . Also, just as these file pointers are created automatically at the start of your program, they are closed automatically at the end; you should not try to close them. +234 C + + : T h e C o m p l e t e R e f e r e n c e + + +The Console I/O Connection +Recall from Chapter 8 that there is little distinction between console I/O and file I/O. +The console I/O functions described in Chapter 8 actually direct their I/O operations to either stdin or stdout. In essence, the console I/O functions are simply special versions of their parallel file functions. The reason they exist is as a convenience to you, the programmer. +As described in the previous section, you can perform console I/O using any of the file system functions. However, what might surprise you is that you can perform disk file I/O using console I/O functions, such as printf() ! This is because all of the console I/O functions operate on stdin and stdout. In environments that allow redirection of I/O, this means that stdin and stdout could refer to a device other than the keyboard and screen. For example, consider this program: + + +#include + +int main(void) { +char str[80]; + +printf("Enter a string: "); gets(str); +printf(str); + +return 0; } + +Assume that this programis called TEST. If you execute TEST normally, it displays its prompt on the screen, reads a string fromthe keyboard, and displays that string on thedisplay. However, in an environment that supports I/O redirection, either stdin, stdout, or both could be redirected to a file. For example, in a DOS or Windows environment, executing TEST like this: + + +TEST > OUTPUT + +causes the output of TEST to be written to a file called OUTPUT. Executing TEST like this: + + +TEST < INPUT > OUTPUT + +directs stdin to the file called INPUT and sends output to the file called OUTPUT. When a program terminates, any redirected streams are reset to their default status. +C h a p t e r 9 : F i l e I / O 235 + + +Using freopen( ) to Redirect the Standard Streams +You can redirect the standard streams by using the freopen() function. This function +associates an existing stream with a new file. Thus, you can use it to associate a standard stream with a new file. Its prototype is + +FILE *freopen(const char *filename, const char *mode, FILE *stream); + +where filename is a pointer to the filename you wish associated with the stream pointed to by stream. The file is opened using the value of mode, which may have the same values as those used with fopen() . freopen() returns stream if successful or NULL on failure. +The following program uses freopen() to redirect stdout to a file called OUTPUT: + +#include + +int main(void) { +char str[80]; + +freopen("OUTPUT", "w", stdout); + +printf("Enter a string: "); gets(str); +printf(str); + +return 0; } + +In general, redirecting the standard streams by using freopen() is useful in special situations, such as debugging. However, performing disk I/O using redirected stdin and stdout is not as efficient as using functions like fread() or fwrite() . + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 10 The Preprocessor and +Comments + + + + + + + + + + + +237 +238 C + + : T h e C o m p l e t e R e f e r e n c e + + +ou can include various instructions to the compiler in the source code of a C/C++ program. These are called preprocessor directives, and although not actually part of the C or C++ language per se, they expand the scope of the +Y +programming environment. This chapter also examines comments. + + +The Preprocessor +Before beginning, it is important to put the preprocessor in historical perspective. As it relates to C++, the preprocessor is largely a holdover from C. Moreover, the C++ preprocessor is virtually identical to the one defined by C. The main difference between C and C++ in this regard is the degree to which each relies upon the preprocessor. In C, each preprocessor directive is necessary. In C++, some features have been rendered redundant by newer and better C++ language elements. In fact, one of the long-term design goals of C++ is the elimination of the preprocessor altogether. But for now and well into the foreseeable future, the preprocessor will still be widely used. +The preprocessor contains the following directives: + + +#define #error +#include + +#elif #else #if #ifdef +#line #pragma + +#endif #ifndef +#undef + + +As you can see, all preprocessor directives begin with a # sign. In addition, each preprocessing directive must be on its own line. For example, + +#include #include + +will not work. + + +#define +The #define directive defines an identifier and a character sequence (i.e., a set of characters) that will be substituted for the identifier each time it is encountered in the source file. The identifier is referred to as a macro name and the replacement process as macro replacement. The general form of the directive is + +#define macro-name char-sequence +C h a p t e r 1 0 : T h e P r e p r o c e s s o r a n d C o m m e n t s 239 + + +Notice that there is no semicolon in this statement. There may be any number of spaces between the identifier and the character sequence, but once the character sequence begins, it is terminated only by a newline. +For example, if you wish to use the word LEFT for the value 1 and the word RIGHT for the value 0, you could declare these two #define directives: + + +#define LEFT 1 #define RIGHT 0 + +This causes the compiler to substitute a 1 or a 0 each time LEFT or RIGHT is encountered in your source file. For example, the following prints 0 1 2 on the screen: + + +printf("%d %d %d", RIGHT, LEFT, LEFT+1); + +Once a macro name has been defined, it may be used as part of the definition of other macro names. For example, this code defines the values of ONE, TWO, and THREE: + + + +#define ONE #define TWO +#define THREE + +1 ONE+ONE +ONE+TWO + + +Macro substitution is simply the replacement of an identifier by the character sequence associated with it. Therefore, if you wish to define a standard error message, you might write something like this: + + +#define E_MS "standard error on input\n" /* ... */ +printf(E_MS); + +The compiler will actually substitute the string "standard error on input\n" when the identifier E_MS is encountered. To the compiler, the printf() statement will actually appear to be + + +printf("standard error on input\n"); + +No text substitutions occur if the identifier is within a quoted string. For example, + +#define XYZ this is a test + +printf("XYZ"); +240 C + + : T h e C o m p l e t e R e f e r e n c e + + +does not print this is a test, but rather XYZ. +If the character sequence is longer than one line, you may continue it on the next by placing a backslash at the end of the line, as shown here: + + +#define LONG_STRING "this is a very long \ string that is used as an example" + +C/C++ programmers commonly use uppercase letters for defined identifiers. This convention helps anyone reading the program know at a glance that a macro replacement will take place. Also, it is usually best to put all #defines at the start of the file or in a separate header file rather than sprinkling them throughout the program. +Macros are most frequently used to define names for "magic numbers" that occur in a program. For example, you may have a program that defines an array and has several routines that access that array. Instead of "hard-coding" the array's size with a constant, you can define the size using a #define statement and then use that macro name whenever the array size is needed. In this way, if you need to change the size of the array, you will only need to change the #define statement and then recompile your program. For example, + +#define MAX_SIZE 100 /* ... */ +float balance[MAX_SIZE]; /* ... */ +for(i=0; i + +#define ABS(a) (a)<0 ? -(a) : (a) + +int main(void) { +printf("abs of -1 and 1: %d %d", ABS(-1), ABS(1)); + +return 0; } + +When this program is compiled, a in the macro definition will be substituted with the values –1 and 1. The parentheses that enclose a ensure proper substitution in all cases. For example, if the parentheses around a were removed, this expression + + +ABS(10-20) + +would be converted to + +10-20<0 ? -10-20 : 10-20 + +after macro replacement and would yield the wrong result. +The use of a function-like macro in place of real functions has one major benefit: It increases the execution speed of the code because there is no function call overhead. However, if the size of the function-like macro is very large, this increased speed may be paid for with an increase in the size of the program because of duplicated code. + +Note Although parameterized macros are a valuable feature, C++ has a better way of +creating inline code, which uses the inline keyword. + + +#error +The #error directive forces the compiler to stop compilation. It is used primarily for debugging. The general form of the #error directive is + +#error error-message + +The error-message is not between double quotes. When the #error directive is encountered, the error message is displayed, possibly along with other information defined by the compiler. +242 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include +The #include directive instructs the compiler to read another source file in addition to the one that contains the #include directive. The name of the additional source file must be enclosed between double quotes or angle brackets. For example, + + +#include "stdio.h" #include + +both instruct the compiler to read and compile the header for the C I/O system library functions. +Include files can have #include directives in them. This is referred to as nested includes. The number of levels of nesting allowed varies between compilers. However, Standard C stipulates that at least eight nested inclusions will be available. Standard C++ recommends that at least 256 levels of nesting be supported. +Whether the filename is enclosed by quotes or by angle brackets determines how the search for the specified file is conducted. If the filename is enclosed in angle brackets, the file is searched for in a manner defined by the creator of the compiler. Often, this means searching some special directory set aside for include files. If the +filename is enclosed in quotes, the file is looked for in another implementation-defined manner. For many compilers, this means searching the current working directory. If the file is not found, the search is repeated as if the filename had been enclosed in angle brackets. +Typically, most programmers use angle brackets to include the standard header files. The use of quotes is generally reserved for including files specifically related to the program at hand. However, there is no hard and fast rule that demands this usage. +In addition to files, a C++ program can use the #include directive to include a C++ header. C++ defines a set of standard headers that provide the information necessary to the various C++ libraries. A header is a standard identifier that might, but need not, map to a filename. Thus, a header is simply an abstraction that guarantees that the appropriate information required by your program is included. Various issues associated with headers are described in Part Two. + + +Conditional Compilation Directives +There are several directives that allow you to selectively compile portions of your program's source code. This process is called conditional compilation and is used widely by commercial software houses that provide and maintain many customized versions of one program. +C h a p t e r 1 0 : T h e P r e p r o c e s s o r a n d C o m m e n t s 243 + + +#if, #else, #elif, and #endif +Perhaps the most commonly used conditional compilation directives are the #if, #else, +#elif, and #endif. These directives allow you to conditionally include portions of code based upon the outcome of a constant expression. +The general form of #if is + +#if constant-expression statement sequence +#endif + +If the constant expression following #if is true, the code that is between it and #endif is compiled. Otherwise, the intervening code is skipped. The #endif directive marks the end of an #if block. For example, + + +/* Simple #if example. */ #include + +#define MAX 100 + +int main(void) { +#if MAX>99 +printf("Compiled for array greater than 99.\n"); #endif + +return 0; } + +This program displays the message on the screen because MAX is greater than 99. This example illustrates an important point. The expression that follows the #if is evaluated at compile time. Therefore, it must contain only previously defined identifiers and constants—no variables may be used. +The #else directive works much like the else that is part of the C++ language: it establishes an alternative if #if fails. The previous example can be expanded as shown here: + + +/* Simple #if/#else example. */ #include +244 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +#define MAX 10 + +int main(void) { +#if MAX>99 +printf("Compiled for array greater than 99.\n"); #else +printf("Compiled for small array.\n"); #endif + +return 0; } + +In this case, MAX is defined to be less than 99, so the #if portion of the code is not compiled. The #else alternative is compiled, however, and the message Compiled for small array is displayed. +Notice that #else is used to mark both the end of the #if block and the beginning of the #else block. This is necessary because there can only be one #endif associated with any #if. +The #elif directive means "else if" and establishes an if-else-if chain for multiple compilation options. #elif is followed by a constant expression. If the expression is true, that block of code is compiled and no other #elif expressions are tested. Otherwise, the next block in the series is checked. The general form for #elif is + +#if expression statement sequence +#elif expression 1 statement sequence +#elif expression 2 statement sequence +#elif expression 3 statement sequence +#elif expression 4 . +. . +#elif expression N statement sequence +#endif +C h a p t e r 1 0 : T h e P r e p r o c e s s o r a n d C o m m e n t s 245 + + +For example, the following fragment uses the value of ACTIVE_COUNTRY to define the currency sign: + + +#define US 0 #define ENGLAND 1 #define FRANCE 2 + +#define ACTIVE_COUNTRY US + +#if ACTIVE_COUNTRY == US +char currency[] = "dollar"; #elif ACTIVE_COUNTRY == ENGLAND +char currency[] = "pound"; #else +char currency[] = "franc"; #endif + +Standard C states that #ifs and #elifs may be nested at least eight levels. Standard C++ suggests that at least 256 levels of nesting be allowed. When nested, each #endif, #else, or #elif associates with the nearest #if or #elif. For example, the following is perfectly valid: + + +#if MAX>100 +#if SERIAL_VERSION int port=198; +#elif +int port=200; #endif +#else +char out_buffer[100]; #endif + +#ifdef and #ifndef +Another method of conditional compilation uses the directives #ifdef and #ifndef, which mean "if defined" and "if not defined," respectively. The general form of #ifdef is + +#ifdef macro-name statement sequence +#endif +246 C + + : T h e C o m p l e t e R e f e r e n c e + + +If macro-name has been previously defined in a #define statement, the block of code will be compiled. +The general form of #ifndef is + +#ifndef macro-name statement sequence +#endif + +If macro-name is currently undefined by a #define statement, the block of code is compiled. +Both #ifdef and #ifndef may use an #else or #elif statement. For example, + +#include + +#define TED 10 + +int main(void) { +#ifdef TED +printf("Hi Ted\n"); #else +printf("Hi anyone\n"); #endif +#ifndef RALPH +printf("RALPH not defined\n"); #endif + +return 0; } + +will print Hi Ted and RALPH not defined. However, if TED were not defined, Hi anyone would be displayed, followed by RALPH not defined. +You may nest #ifdefs and #ifndefs to at least eight levels in Standard C. Standard C++ suggests that at least 256 levels of nesting be supported. + + +#undef +The #undef directive removes a previously defined definition of the macro name that follows it. That is, it "undefines" a macro. The general form for #undef is + +#undef macro-name +C h a p t e r 1 0 : T h e P r e p r o c e s s o r a n d C o m m e n t s 247 + + +For example, + +#define LEN 100 #define WIDTH 100 + +char array[LEN][WIDTH]; + +#undef LEN #undef WIDTH +/* at this point both LEN and WIDTH are undefined */ + +Both LEN and WIDTH are defined until the #undef statements are encountered. #undef is used principally to allow macro names to be localized to only those +sections of code that need them. + + +Using defined +In addition to #ifdef, there is a second way to determine if a macro name is defined. You can use the #if directive in conjunction with the defined compile-time operator. The defined operator has this general form: + +defined macro-name + +If macro-name is currently defined, then the expression is true. Otherwise, it is false. For example, to determine if the macro MYFILE is defined, you can use either of these two preprocessing commands: + + +#if defined MYFILE + +or + +#ifdef MYFILE + +You may also precede defined with the ! to reverse the condition. For example, the following fragment is compiled only if DEBUG is not defined. + + +#if !defined DEBUG printf("Final version!\n"); +#endif +248 C + + : T h e C o m p l e t e R e f e r e n c e + + +One reason for using defined is that it allows the existence of a macro name to be determined by a #elif statement. + + +#line +The #line directive changes the contents of _ _LINE_ _ and _ _FILE_ _ , which are predefined identifiers in the compiler. The _ _LINE_ _ identifier contains the line number of the currently compiled line of code. The _ _FILE_ _ identifier is a string that contains the name of the source file being compiled. The general form for #line is + +#line number "filename" + +where number is any positive integer and becomes the new value of _ _LINE_ _ , and the optional filename is any valid file identifier, which becomes the new value of +_ _FILE_ _. #line is primarily used for debugging and special applications. +For example, the following code specifies that the line count will begin with 100. The printf() statement displays the number 102 because it is the third line in the program after the #line 100 statement. + + +#include + + +#line 100 +int main(void) +{ + +/* reset the line counter */ /* line 100 */ +/* line 101 */ + +printf("%d\n",__LINE__); /* line 102 */ + +return 0; } + +#pragma +#pragma is an implementation-defined directive that allows various instructions to be given to the compiler. For example, a compiler may have an option that supports program execution tracing. A trace option would then be specified by a #pragma statement. You must check the compiler's documentation for details and options. + + +The # and ## Preprocessor Operators +There are two preprocessor operators: # and ##. These operators are used with the #define statement. +C h a p t e r 1 0 : T h e P r e p r o c e s s o r a n d C o m m e n t s 249 + + +The # operator, which is generally called the stringize operator, turns the argument it precedes into a quoted string. For example, consider this program. + + +#include + +#define mkstr(s) # s + +int main(void) { +printf(mkstr(I like C++)); + +return 0; } + +The preprocessor turns the line + +printf(mkstr(I like C++)); + +into + +printf("I like C++"); + +The ## operator, called the pasting operator, concatenates two tokens. For example, + +#include + +#define concat(a, b) a ## b + +int main(void) { +int xy = 10; + +printf("%d", concat(x, y)); + +return 0; } + +The preprocessor transforms + +printf("%d", concat(x, y)); +250 C + + : T h e C o m p l e t e R e f e r e n c e + + +into + +printf("%d", xy); + +If these operators seem strange to you, keep in mind that they are not needed or used in most programs. They exist primarily to allow the preprocessor to handle some special cases. + + +Predefined Macro Names +C++ specifies six built-in predefined macro names. They are + +_ _LINE_ _ _ _FILE_ _ _ _DATE_ _ _ _TIME_ _ _ _STDC_ _ +_ _cplusplus + +The C language defines the first five of these. Each will be described here, in turn. The _ _LINE_ _ and _ _FILE_ _ macros were described in the discussion of #line. +Briefly, they contain the current line number and filename of the program when it is being compiled. +The _ _DATE_ _ macro contains a string of the form month/day/year that is the date of the translation of the source file into object code. +The _ _TIME_ _ macro contains the time at which the program was compiled. The time is represented in a string having the form hour:minute:second. +The meaning of _ _STDC_ _ is implementation-defined. Generally, if _ _STDC_ _ is defined, the compiler will accept only standard C/C++ code that does not contain any nonstandard extensions. +A compiler conforming to Standard C++ will define_ _cplusplus as a value containing at least six digits. Nonconforming compilers will use a value with five or less digits. + + +C-Style Comments +A C-style comment begins with the character pair /* and ends with */. There must be no spaces between the asterisk and the slash. The compiler ignores any text between the beginning and ending comment symbols. For example, this program prints only hello on the screen: +C h a p t e r 1 0 : T h e P r e p r o c e s s o r a n d C o m m e n t s 251 + + +#include + +int main(void) { +printf("hello"); +/* printf("there"); */ + +return 0; } + +A C-style comment is commonly called a multiline comment because the text of the comment may extend over two or more lines. For example, + + +/* this is a multi-line comment */ + +Comments may be placed anywhere in a program, as long as they do not appear in the middle of a keyword or identifier. For example, this comment is valid: + + +x = 10+ /* add the numbers */5; + +while + +swi/*this will not work*/tch(c) { ... + +is incorrect because a keyword cannot contain a comment. However, you should not generally place comments in the middle of expressions because it obscures their meaning. +C-style comments may not be nested. That is, one comment may not contain another comment. For example, this code fragment causes a compile-time error: + + +/* this is an outer comment x = y/a; +/* this is an inner comment - and causes an error */ */ + +At the time of this writing, Standard C defines only the style of comments just described. However, C++ supports two types of comments. The first is the C-style, multiline comment. The second is the single-line comment. Single-line comments begin with a // and end at the end of the line. For example, +252 C + + : T h e C o m p l e t e R e f e r e n c e + + +// this is a single-line comment + +Although Standard C does not currently define the single-line comment, most C compilers will accept it and it will probably be formally incorporated into Standard C within the next year or two. We will look more closely at single-line comments in Part Two. +You should include comments whenever they are needed to explain the operation of the code. All but the most obvious functions should have a comment at the top that states what the function does, how it is called, and what it returns. +Part II C++ + + + + + + + + + +art One examined the C subset of C++. Part Two describes those features of the language specific to C++. That is, it +P +discusses those features of C++ that it does not have in common with C. Because many of the C++ features are designed to support object-oriented programming (OOP), Part Two also provides a discussion of its theory and merits. We will begin with an overview of C++. + + + + + + + + + +253 + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 11 An Overview of C++ + + + + + + + + + + + + + + +255 +256 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter provides an overview of the key concepts embodied in C++. C++ is an object-oriented programming language, and its object-oriented features are highly interrelated. In several instances, this interrelatedness makes it difficult +T +to describe one feature of C++ without implicitly involving several others. The object-oriented features of C++ are, in many places, so intertwined that discussion of one feature implies prior knowledge of one or more other ones. To address this problem, this chapter presents a quick overview of the most important aspects of C++, including its history, its key features, and the difference between traditional and Standard C++. The remaining chapters examine C++ in detail. + + +The Origins of C++ +C++ began as an expanded version of C. The C++ extensions were first invented by Bjarne Stroustrup in 1979 at Bell Laboratories in Murray Hill, New Jersey. He initially called the new language "C with Classes." However, in 1983 the name was changed to C++. +Although C was one of the most liked and widely used professional programming languages in the world, the invention of C++ was necessitated by one major program-ming factor: increasing complexity. Over the years, computer programs have become larger and more complex. Even though C is an excellent programming language, it has its limits. In C, once a program exceeds from 25,000 to 100,000 lines of code, it becomes so complex that it is difficult to grasp as a totality. The purpose of C++ is to allow this barrier to be broken. The essence of C++ is to allow the programmer to comprehend and manage larger, more complex programs. +Most additions made by Stroustrup to C support object-oriented programming, sometimes referred to as OOP. (See the next section for a brief explanation of object-oriented programming.) Stroustrup states that some of C++'s object-oriented features were inspired by another object-oriented language called Simula67. Therefore, C++ represents the blending of two powerful programming methods. +Since C++ was first invented, it has undergone three major revisions, with each adding to and altering the language. The first revision was in 1985 and the second in 1990. The third occurred during the standardization of C++. Several years ago, work began on a standard for C++. Toward that end, a joint ANSI (American National Standards Institute) and ISO (International Standards Organization) standardization committee was formed. The first draft of the proposed standard was created on January 25, 1994. In that draft, the ANSI/ISO C++ committee (of which I am a member) kept the features first defined by Stroustrup and added some new ones as well. But in general, this initial draft reflected the state of C++ at the time. +Soon after the completion of the first draft of the C++ standard, an event occurred that caused the language to be greatly expanded: the creation of the Standard Template Library (STL) by Alexander Stepanov. The STL is a set of generic routines that you can use to manipulate data. It is both powerful and elegant, but also quite large. Subsequent +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 257 + + +to the first draft, the committee voted to include the STL in the specification for C++. The addition of the STL expanded the scope of C++ well beyond its original definition. While important, the inclusion of the STL, among other things, slowed the standardization +of C++. +It is fair to say that the standardization of C++ took far longer than anyone had expected when it began. In the process, many new features were added to the language and many small changes were made. In fact, the version of C++ defined by the C++ committee is much larger and more complex than Stroustrup's original design. However, the standard is now complete. The final draft was passed out of committee on November 14, 1997. A standard for C++ is now a reality. +The material in this book describes Standard C++, including all of its newest features. This is the version of C++ created by the ANSI/ISO standardization committee, and it is the one that is currently accepted by all major compilers. + + +What Is Object-Oriented Programming? +Since object-oriented programming (OOP) drove the creation of C++, it is necessary to understand its foundational principles. OOP is a powerful way to approach the job of programming. Programming methodologies have changed dramatically since the invention of the computer, primarily to accommodate the increasing complexity of programs. For example, when computers were first invented, programming was done by toggling in the binary machine instructions using the computer's front panel. As long as programs were just a few hundred instructions long, this approach worked. As programs grew, assembly language was invented so that a programmer could deal with larger, increasingly complex programs, using symbolic representations of the machine instructions. As programs continued to grow, high-level languages were introduced that gave the programmer more tools with which to handle complexity. The first widespread language was, of course, FORTRAN. Although FORTRAN was a very impressive first step, it is hardly a language that encourages clear, easy-to-understand programs. +The1960sgavebirthtostructuredprogramming.Thisisthemethodencouragedby languagessuchasCandPascal.Theuseofstructuredlanguagesmadeitpossibletowrite moderatelycomplexprogramsfairlyeasily.Structuredlanguagesarecharacterizedby theirsupportforstand-alonesubroutines,localvariables,richcontrolconstructs,and theirlackofrelianceupontheGOTO.Althoughstructuredlanguagesareapowerfultool, eventheyreachtheirlimitwhenaprojectbecomestoolarge. +Consider this: At each milestone in the development of programming, techniques and tools were created to allow the programmer to deal with increasingly greater complexity. Each step of the way, the new approach took the best elements of the previous methods and moved forward. Prior to the invention of OOP, many projects were nearing (or exceeding) the point where the structured approach no longer +258 C + + : T h e C o m p l e t e R e f e r e n c e + + +worked. Object-oriented methods were created to help programmers break through these barriers. +Object-oriented programming took the best ideas of structured programming and combined them with several new concepts. The result was a different way of organizing a program. In the most general sense, a program can be organized in +one of two ways: around its code (what is happening) or around its data (who is being affected). Using only structured programming techniques, programs are typically organized around code. This approach can be thought of as "code acting on data." For example, a program written in a structured language such as C is defined by its functions, any of which may operate on any type of data used by the program. +Object-oriented programs work the other way around. They are organized around data, with the key principle being "data controlling access to code." In an object-oriented language, you define the data and the routines that are permitted to act on that data. Thus, a data type defines precisely what sort of operations can be applied to that data. +To support the principles of object-oriented programming, all OOP languages have three traits in common: encapsulation, polymorphism, and inheritance. Let's examine each. + +Encapsulation +Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. In an object-oriented language, code and data may be combined in such a way that a self-contained "black box" is created. When code and data are linked together in this fashion, an object is created. In other words, an object is the device that supports encapsulation. +Within an object, code, data, or both may be private to that object or public. Private code or data is known to and accessible only by another part of the object. That is, private code or data may not be accessed by a piece of the program that exists outside the object. When code or data is public, other parts of your program may access it even though it is defined within an object. Typically, the public parts of an object are used to provide a controlled interface to the private elements of the object. +For all intents and purposes, an object is a variable of a user-defined type. It may seem strange that an object that links both code and data can be thought of as a variable. However, in object-oriented programming, this is precisely the case. Each time you define a new type of object, you are creating a new data type. Each specific instance of this data type is a compound variable. + +Polymorphism +Object-oriented programming languages support polymorphism, which is characterized by the phrase "one interface, multiple methods." In simple terms, polymorphism is the attribute that allows one interface to control access to a general class of actions. The +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 259 + + +specific action selected is determined by the exact nature of the situation. A real-world example of polymorphism is a thermostat. No matter what type of furnace your house has (gas, oil, electric, etc.), the thermostat works the same way. In this case, the thermostat (which is the interface) is the same no matter what type of furnace (method) you have. For example, if you want a 70-degree temperature, you set the thermostat to 70 degrees. It doesn't matter what type of furnace actually provides the heat. +This same principle can also apply to programming. For example, you might have a program that defines three different types of stacks. One stack is used for integer values, one for character values, and one for floating-point values. Because +of polymorphism, you can define one set of names, push() and pop() , that can be used for all three stacks. In your program you will create three specific versions of these functions, one for each type of stack, but names of the functions will be the same. The compiler will automatically select the right function based upon the data being stored. Thus, the interface to a stack—the functions push() and pop() —are the same no matter which type of stack is being used. The individual versions of these functions define the specific implementations (methods) for each type of data. +Polymorphism helps reduce complexity by allowing the same interface to be used to access a general class of actions. It is the compiler's job to select the specific action (i.e., method) as it applies to each situation. You, the programmer, don't need to do this selection manually. You need only remember and utilize the general interface. +The first object-oriented programming languages were interpreters, so poly-morphism was, of course, supported at run time. However, C++ is a compiled language. Therefore, in C++, both run-time and compile-time polymorphism are supported. + +Inheritance +Inheritance is the process by which one object can acquire the properties of another +object. This is important because it supports the concept of classification. If you think about it, most knowledge is made manageable by hierarchical classifications. For example, a Red Delicious apple is part of the classification apple, which in turn is part of the fruit class, which is under the larger class food. Without the use of classifications, each object would have to define explicitly all of its characteristics. However, through the use of classifications, an object need only define those qualities that make it unique within its class. It is the inheritance mechanism that makes it possible for one object to be a specific instance of a more general case. As you will see, inheritance is an important aspect of object-oriented programming. + + +Some C++ Fundamentals +In Part One, the C subset of C++ was described and C programs were used to demonstrate those features. From this point forward, all examples will be "C++ +260 C + + : T h e C o m p l e t e R e f e r e n c e + + +programs." That is, they will be making use of features unique to C++. For ease of discussion, we will refer to these C++-specific features simply as "C++ features" from now on. +If you come from a C background, or if you have been studying the C subset programs in Part One, be aware that C++ programs differ from C programs in some important respects. Most of the differences have to do with taking advantage of C++'s object-oriented capabilities. But C++ programs differ from C programs in other ways, including how I/O is performed and what headers are included. Also, most C++ programs share a set of common traits that clearly identify them as C++ programs. Before moving on to C++'s object-oriented constructs, an understanding of the fundamental elements of a C++ program is required. +This section describes several issues relating to nearly all C++ programs. Along the way, some important differences with C and earlier versions of C++ are pointed out. + +A Sample C++ Program +Let's start with the short sample C++ program shown here. + +#include using namespace std; + +int main() { +int i; + +cout << "This is output.\n"; // this is a single line comment /* you can still use C style comments */ + +// input a number using >> cout << "Enter a number: "; cin >> i; + +// now, output a number using << +cout << i << " squared is " << i*i << "\n"; + +return 0; } + +As you can see, this program looks much different from the C subset programs found in Part One. A line-by-line commentary will be useful. To begin, the header is included. This header supports C++-style I/O operations. ( is to C++ what stdio.h is to C.) Notice one other thing: there is no .h extension to the +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 261 + + +name iostream. The reason is that is one of the new-style headers defined by Standard C++. New-style headers do not use the .h extension. +The next line in the program is + + +using namespace std; + +This tells the compiler to use the std namespace. Namespaces are a recent addition +to C++. A namespace creates a declarative region in which various program elements can be placed. Namespaces help in the organization of large programs. The using statement informs the compiler that you want to use the std namespace. This is the namespace in which the entire Standard C++ library is declared. By using the std namespace you simplify access to the standard library. The programs in Part One, which use only the C subset, don't need a namespace statement because the C library functions are also available in the default, global namespace. + + +Note + +Sincebothnew-styleheadersandnamespacesarerecentadditionstoC++,youmay encounteroldercodethatdoesnotusethem.Also,ifyouareusinganoldercompiler, itmaynotsupportthem.Instructionsforusinganoldercompilerarefoundlaterin this chapter. + + +Now examine the following line. + +int main() + +Notice that the parameter list in main() is empty. In C++, this indicates that main() has no parameters. This differs from C. In C, a function that has no parameters must use void in its parameter list, as shown here: + + +int main(void) + +This was the way main() was declared in the programs in Part One. However, in C++, the use of void is redundant and unnecessary. As a general rule, in C++ when a function takes no parameters, its parameter list is simply empty; the use of void is not required. +The next line contains two C++ features. + +cout << "This is output.\n"; // this is a single line comment + +First, the statement + +cout << "This is output.\n"; +262 C + + : T h e C o m p l e t e R e f e r e n c e + + +causes This is output. to be displayed on the screen, followed by a carriage return-linefeed combination. In C++, the << has an expanded role. It is still the left shift operator, but when it is used as shown in this example, it is also an output operator. The word cout is an identifier that is linked to the screen. (Actually, like C, C++ supports I/O redirection, but for the sake of discussion, assume that cout refers to the screen.) You can use cout and the << to output any of the built-in data types, as well as strings of characters. +Note that you can still use printf() or any other of C's I/O functions in a C++ program. However, most programmers feel that using << is more in the spirit of C++. Further, while using printf() to output a string is virtually equivalent to using << in this case, the C++ I/O system can be expanded to perform operations on objects that you define (something that you cannot do using printf() ). +What follows the output expression is a C++ single-line comment. As mentioned in Chapter 10, C++ defines two types of comments. First, you may use a C-like comment, which works the same in C++ as in C. You can also define a single-line comment by using //; whatever follows such a comment is ignored by the compiler until the end of theline is reached. In general, C++ programmers use C-like comments when a multiline comment is being created and use C++ single-line comments when only a single-line remark is needed. +Next, the program prompts the user for a number. The number is read from the keyboard with this statement: + +cin >> i; + +In C++, the >> operator still retains its right shift meaning. However, when used as shown, it also is C++'s input operator. This statement causes i to be given a value read from the keyboard. The identifier cin refers to the standard input device, which is usually the keyboard. In general, you can use cin >> to input a variable of any of the basic data types plus strings. + + +Note + +Thelineofcodejustdescribedisnotmisprinted.Specifically,thereisnotsupposedto be an & in front of the i. When inputting information using a C-based function like scanf( ), you have to explicitly pass a pointer to the variable that will receive the information.Thismeansprecedingthevariablenamewiththe"addressof"operator, &. However, because of the way the >> operator is implemented in C++, you do not need (in fact, must not use) the &. The reason for this is explained in Chapter 13. + + +Although it is not illustrated by the example, you are free to use any of the C-based input functions, such as scanf(), instead of using >>. However, as with cout, most programmers feel that cin >> is more in the spirit of C++. +Another interesting line in the program is shown here: + +cout << i << "squared is " << i*i << "\n"; +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 263 + + +Assuming that i has the value 10, this statement causes the phrase 10 squared is 100 to be displayed, followed by a carriage return-linefeed. As this line illustrates, you can run together several << output operations. +The program ends with this statement: + + +return 0; + +This causes zero to be returned to the calling process (which is usually the operating system). This works the same in C++ as it does in C. Returning zero indicates that the program terminated normally. Abnormal program termination should be signaled by returning a nonzero value. You may also use the values EXIT_SUCCESS and EXIT_ FAILURE if you like. + +A Closer Look at the I/O Operators +As stated, when used for I/O, the << and >> operators are capable of handling any of C++'s built-in data types. For example, this program inputs a float, a double, and a string and then outputs them: + + +#include using namespace std; + +int main() { +float f; char str[80]; double d; + +cout << "Enter two floating point numbers: "; cin >> f >> d; + +cout << "Enter a string: "; cin >> str; + +cout << f << " " << d << " " << str; + +return 0; } + +When you run this program, try entering This is a test. when prompted for the string. When the program redisplays the information you entered, only the word "This" will be displayed. The rest of the string is not shown because the >> operator stops reading input when the first white-space character is encountered. Thus, "is a test" is +264 C + + : T h e C o m p l e t e R e f e r e n c e + + +never read by the program. This program also illustrates that you can string together several input operations in a single statement. +The C++ I/O operators recognize the entire set of backslash character constants described in Chapter 2. For example, it is perfectly acceptable to write + + +cout << "A\tB\tC"; + +This statement outputs the letters A, B, and C, separated by tabs. + +Declaring Local Variables +If you come from a C background, you need to be aware of an important difference +between C and C++ regarding when local variables can be declared. In C, you must declare all local variables used within a block at the start of that block. You cannot declare a variable in a block after an "action" statement has occurred. For example, in C, this fragment is incorrect: + + +/* Incorrect in C. OK in C++. */ int f() +{ +int i; i = 10; + +int j; /* won't compile as a C program */ j = i*2; + +return j; } + +Because the assignment intervenes between the declaration of i and that of j, compiling this code as a C program will cause an error. However, when compiling it as a C++ program, this fragment is perfectly acceptable. In C++ you may declare local variables at any point within a block—not just at the beginning. +Here is another example. This version of the program from the preceding section declares each variable just before it is needed. + +#include using namespace std; + +int main() { +float f; +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 265 + + + +double d; +cout << "Enter two floating point numbers: "; cin >> f >> d; + +cout << "Enter a string: "; +char str[80]; // str declared here, just before 1st use cin >> str; + +cout << f << " " << d << " " << str; + +return 0; } + +Whether you declare all variables at the start of a block or at the point of first use is completely up to you. Since much of the philosophy behind C++ is the encapsulation of code and data, it makes sense that you can declare variables close to where they are used instead of just at the beginning of the block. In the preceding example, the declarations are separated simply for illustration, but it is easy to imagine more complex examples in which this feature of C++ is more valuable. +Declaring variables close to where they are used can help you avoid accidental side effects. However, the greatest benefit of declaring variables at the point of first use is gained in large functions. Frankly, in short functions (like many of the examples in this book), there is little reason not to simply declare variables at the start of a function. For this reason, this book will declare variables at the point of first use only when it seems warranted by the size or complexity of a function. +There is some debate as to the general wisdom of localizing the declaration of variables. Opponents suggest that sprinkling declarations throughout a block makes it harder, not easier, for someone reading the code to find quickly the declarations of all variables used in that block, making the program harder to maintain. For this +reason, some C++ programmers do not make significant use of this feature. This book will not take a stand either way on this issue. However, when applied properly, especially in large functions, declaring variables at the point of their first use can +help you create bug-free programs more easily. + +No Default to int +There has been a fairly recent change to C++ that may affect older C++ code as well as C code being ported to C++. The C language and the original specification for C++ state that when no explicit type is specified in a declaration, type int is assumed. However, the "default-to-int" rule was dropped from C++ a couple of years ago, during standardization. The next standard for the C language is also expected to drop this rule, but it is still currently in effect and is used by a large amount of existing code. The "default-to-int" rule is also applied in much older C++ code. +266 C + + : T h e C o m p l e t e R e f e r e n c e + + +The most common use of the "default-to-int" rule is with function return types. It was common practice to not specify int explicitly when a function returned an integer result. For example, in C and older C++ code the following function is valid. + + +func(int i) { +return i*i; } + +In Standard C++, this function must have the return type of int specified, as shown here. + +int func(int i) { +return i*i; } + +As a practical matter, nearly all C++ compilers still support the "default-to-int" rule for compatibility with older code. However, you should not use this feature for new code because it is no longer allowed. + +The bool Data Type +C++ defines a built-in Boolean type called bool. At the time of this writing, Standard C +does not. Objects of type bool can store only the values true or false, which are keywords defined by C++. As explained in Part One, automatic conversions take place which allow bool values to be converted to integers, and vice versa. Specifically, any non-zero value is converted to true and zero is converted to false. The reverse also occurs; true is converted to 1 and false is converted to zero. Thus, the fundamental concept of zero being false and non-zero being true is still fully entrenched in the C++ language. + + +Old-Style vs. Modern C++ +As explained, C++ underwent a rather extensive evolutionary process during its development and standardization. As a result, there are really two versions of C++. The first is the traditional version that is based upon Bjarne Stroustrup's original designs. This is the version of C++ that has been used by programmers for the past decade. The second is the new, Standard C++ that was created by Stroustrup and the ANSI/ISO standardization committee. While these two versions of C++ are very similar at their core, Standard C++ contains several enhancements not found in traditional C++. Thus, Standard C++ is essentially a superset of traditional C++. +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 267 + + +This book describes Standard C++. This is the version of C++ defined by the ANSI/ISO standardization committee and the one implemented by all modern C++ compilers. The code in this book reflects the contemporary coding style and practices as encouraged by Standard C++. However, if you are using an older compiler, it may not accept all of the programs in this book. Here's why. During the process of +standardization, the ANSI/ISO committee added many new features to the language. As these features were defined, they were implemented by compiler developers. Of course, there is always a lag time between when a new feature is added to the language and when it is available in commercial compilers. Since features were added to C++ over a period of years, an older compiler might not support one or more of them. This is important because two recent additions to the C++ language affect every program that you will write—even the simplest. If you are using an older compiler that does not accept these new features, don't worry. There is an easy work-around, which is described here. +The key differences between old-style and modern code involve two features: new-style headers and the namespace statement. To understand the differences, we will begin by looking at two versions of a minimal, do-nothing C++ program. The first version shown here reflects the way C++ programs were written using old-style coding. + + +/* +An old-style C++ program. */ + +#include + +int main() { +return 0; } + +Pay special attention to the #include statement. It includes the file iostream.h, not the header . Also notice that no namespace statement is present. +Here is the second version of the skeleton, which uses the modern style. + + +/* +A modern-style C++ program that uses the new-style headers and a namespace. +*/ +#include using namespace std; +268 C + + : T h e C o m p l e t e R e f e r e n c e + + + +int main() { +return 0; } + +This version uses the new-style header and specifies a namespace. Both of these features were mentioned in passing earlier. Let's look closely at them now. + +The New C++ Headers +As you know, when you use a library function in a program, you must include its header file. This is done using the #include statement. For example, in C, to include the header file for the I/O functions, you include stdio.h with a statement like this: + + +#include + +Here, stdio.h is the name of the file used by the I/O functions, and the preceding statement causes that file to be included in your program. The key point is that this #include statement includes a file. +When C++ was first invented and for several years after that, it used the same +style of headers as did C. That is, it used header files. In fact, Standard C++ still supports C-style headers for header files that you create and for backward compatibility. However, Standard C++ created a new kind of header that is used by the Standard C++ library. The new-style headers do not specify filenames. Instead, they simply specify standard identifiers that may be mapped to files by the compiler, although +they need not be. The new-style C++ headers are an abstraction that simply guarantee that the appropriate prototypes and definitions required by the C++ library have been declared. +Since the new-style headers are not filenames, they do not have a .h extension. They consist solely of the header name contained between angle brackets. For example, here are some of the new-style headers supported by Standard C++. + + + +The new-style headers are included using the #include statement. The only difference is that the new-style headers do not necessarily represent filenames. +Because C++ includes the entire C function library, it still supports the standard C-style header files associated with that library. That is, header files such as stdio.h or ctype.h are still available. However, Standard C++ also defines new-style headers that you can use in place of these header files. The C++ versions of the C standard +headers simply add a "c" prefix to the filename and drop the .h. For example, the C++ new-style header for math.h is . The one for string.h is . Although it +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 269 + + +is currently permissible to include a C-style header file when using C library functions, this approach is deprecated by Standard C++ (that is, it is not recommended). For this reason, from this point forward, this book will use new-style C++ headers in all #include statements. If your compiler does not support new-style headers for the C function library, then simply substitute the old-style, C-like headers. +Since the new-style header is a recent addition to C++, you will still find many, many older programs that don't use it. These programs employ C-style headers, in which a filename is specified. As the old-style skeletal program shows, the traditional way to include the I/O header is as shown here. + +#include + +This causes the file iostream.h to be included in your program. In general, an old-style header file will use the same name as its corresponding new-style header with +a .h appended. +As of this writing, all C++ compilers support the old-style headers. However, the old-style headers have been declared obsolete and their use in new programs is not recommended. This is why they are not used in this book. + +Remember While still common in existing C++ code, old-style headers are obsolete. + +Namespaces +When you include a new-style header in your program, the contents of that header +are contained in the std namespace. A namespace is simply a declarative region. The purpose of a namespace is to localize the names of identifiers to avoid name collisions. Elements declared in one namespace are separate from elements declared in another. Originally, the names of the C++ library functions, etc., were simply put into the global namespace (as they are in C). However, with the advent of the new-style headers, the contents of these headers were placed in the std namespace. We will look closely at namespaces later in this book. For now, you won't need to worry about them because the statement + + +using namespace std; + +brings the std namespace into visibility (i.e., it puts std into the global namespace). After this statement has been compiled, there is no difference between working with an old-style header and a new-style one. +One other point: for the sake of compatibility, when a C++ program includes a C header, such as stdio.h, its contents are put into the global namespace. This allows a C++ compiler to compile C-subset programs. +270 C + + : T h e C o m p l e t e R e f e r e n c e + + +Working with an Old Compiler +As explained, both namespaces and the new-style headers are fairly recent additions +to the C++ language, added during standardization. While all new C++ compilers support these features, older compilers may not. When this is the case, your compiler will report one or more errors when it tries to compile the first two lines of the sample programs in this book. If this is the case, there is an easy work-around: simply use an old-style header and delete the namespace statement. That is, just replace + + +#include using namespace std; + +with + +#include + +This change transforms a modern program into an old-style one. Since the old-style header reads all of its contents into the global namespace, there is no need for a namespace statement. +One other point: for now and for the next few years, you will see many C++ programs that use the old-style headers and do not include a using statement. Your C++ compiler will be able to compile them just fine. However, for new programs, you should use the modern style because it is the only style of program that complies with the C++ Standard. While old-style programs will continue to be supported for many years, they are technically noncompliant. + + +Introducing C++ Classes +This section introduces C++'s most important feature: the class. In C++, to create an object, you first must define its general form by using the keyword class. A class is similar syntactically to a structure. Here is an example. The following class defines a type called stack, which will be used to create a stack: + + +#define SIZE 100 + +// This creates the class stack. class stack { +int stck[SIZE]; int tos; +public: +void init(); +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 271 + + + +void push(int i); int pop(); +}; + + +A class may contain private as well as public parts. By default, all items defined in a class are private. For example, the variables stck and tos are private. This means that they cannot be accessed by any function that is not a member of the class. This is one way that encapsulation is achieved—access to certain items of data may be tightly controlled by keeping them private. Although it is not shown in this example, you can also define private functions, which then may be called only by other members of the class. +To make parts of a class public (that is, accessible to other parts of your program), you must declare them after the public keyword. All variables or functions defined after public can be accessed by all other functions in the program. Essentially, the rest of your program accesses an object through its public functions. Although you can have public variables, good practice dictates that you should try to limit their use. Instead, you should make all data private and control access to it through public functions. One other point: Notice that the public keyword is followed by a colon. +The functions init(), push(), and pop() are called member functions because they are part of the class stack. The variables stck and tos are called member variables (or data members). Remember, an object forms a bond between code and data. Only member functions have access to the private members of their class. Thus, only init(), push() , and pop() may access stck and tos. +Once you have defined a class, you can create an object of that type by using the class name. In essence, the class name becomes a new data type specifier. For example, this creates an object called mystack of type stack: + +stack mystack; + +When you declare an object of a class, you are creating an instance of that class. In this case, mystack is an instance of stack. You may also create objects when the class is defined by putting their names after the closing curly brace, in exactly the same way as you would with a structure. +To review: In C++, class creates a new data type that may be used to create objects of that type. Therefore, an object is an instance of a class in just the same way that some other variable is an instance of the int data type, for example. Put differently, a class is a logical abstraction, while an object is real. (That is, an object exists inside the memory of the computer.) +The general form of a simple class declaration is + +class class-name { +private data and functions +272 C + + : T h e C o m p l e t e R e f e r e n c e + + +public: +public data and functions } object name list; + +Of course, the object name list may be empty. +Inside the declaration of stack, member functions were identified using their prototypes. In C++, all functions must be prototyped. Prototypes are not optional. The prototype for a member function within a class definition serves as that function's prototype in general. +When it comes time to actually code a function that is the member of a class, you must tell the compiler which class the function belongs to by qualifying its name with the name of the class of which it is a member. For example, here is one way to code the push() function: + +void stack::push(int i) { +if(tos==SIZE) { +cout << "Stack is full.\n"; return; +} +stck[tos] = i; tos++; +} + +The :: is called the scope resolution operator. Essentially, it tells the compiler that this version of push() belongs to the stack class or, put differently, that this push() is in stack's scope. In C++, several different classes can use the same function name. The compiler knows which function belongs to which class because of the scope resolution operator. +When you refer to a member of a class from a piece of code that is not part of the class, you must always do so in conjunction with an object of that class. To do so, use the object's name, followed by the dot operator, followed by the name of the member. This rule applies whether you are accessing a data member or a function member. For example, this calls init() for object stack1. + + +stack stack1, stack2; + +stack1.init(); + +This fragment creates two objects, stack1 and stack2, and initializes stack1. Understand that stack1 and stack2 are two separate objects. This means, for example, that initializing stack1 does not cause stack2 to be initialized as well. The only relationship stack1 has with stack2 is that they are objects of the same type. +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 273 + + +Within a class, one member function can call another member function or refer to a data member directly, without using the dot operator. It is only when a member is referred to by code that does not belong to the class that the object name and the dot operator must be used. +The program shown here puts together all the pieces and missing details and illustrates the stack class: + +#include using namespace std; + +#define SIZE 100 + +// This creates the class stack. class stack { +int stck[SIZE]; int tos; +public: +void init(); void push(int i); int pop(); +}; + +void stack::init() { +tos = 0; } + +void stack::push(int i) { +if(tos==SIZE) { +cout << "Stack is full.\n"; return; +} +stck[tos] = i; tos++; +} + +int stack::pop() { +if(tos==0) { +cout << "Stack underflow.\n"; return 0; +} +tos--; +274 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return stck[tos]; } + +int main() { +stack stack1, stack2; // create two stack objects + +stack1.init(); stack2.init(); + +stack1.push(1); stack2.push(2); + +stack1.push(3); stack2.push(4); + +cout << stack1.pop() << " "; cout << stack1.pop() << " "; cout << stack2.pop() << " "; cout << stack2.pop() << "\n"; + +return 0; } + +The output from this program is shown here. + +3 1 4 2 + +One last point: Recall that the private members of an object are accessible only by functions that are members of that object. For example, a statement like + + +stack1.tos = 0; // Error, tos is private. + +could not be in the main() function of the previous program because tos is private. + + +Function Overloading +One way that C++ achieves polymorphism is through the use of function overloading. In C++, two or more functions can share the same name as long as their parameter declarations are different. In this situation, the functions that share the same name are said to be overloaded, and the process is referred to as function overloading. +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 275 + + +To see why function overloading is important, first consider three functions defined by the C subset: abs(), labs(), and fabs(). The abs() function returns the absolute value of an integer, labs() returns the absolute value of a long, and fabs() returns the absolute value of a double. Although these functions perform almost identical actions, in C three slightly different names must be used to represent these essentially similar tasks. This makes the situation more complex, conceptually, than it actually is. Even though the underlying concept of each function is the same, the programmer has to remember three things, not just one. However, in C++, you can use just one name for all three functions, as this program illustrates: + + +#include using namespace std; + +// abs is overloaded three ways int abs(int i); +double abs(double d); long abs(long l); + +int main() { +cout << abs(-10) << "\n"; + +cout << abs(-11.0) << "\n"; + +cout << abs(-9L) << "\n"; + +return 0; } + +int abs(int i) { +cout << "Using integer abs()\n"; + +return i<0 ? -i : i; } + +double abs(double d) { +cout << "Using double abs()\n"; + +return d<0.0 ? -d : d; } +276 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +long abs(long l) { +cout << "Using long abs()\n"; + +return l<0 ? -l : l; } + +The output from this program is shown here. + +Using integer abs() 10 +Using double abs() 11 +Using long abs() 9 + +This program creates three similar but different functions called abs(), each of which returns the absolute value of its argument. The compiler knows which function to call in each situation because of the type of the argument. The value of overloaded functions is that they allow related sets of functions to be accessed with a common name. Thus, the name abs() represents the general action that is being performed. It is left to the compiler to choose the right specific method for a particular circumstance. You need only remember the general action being performed. Due to polymorphism, three things to remember have been reduced to one. This example is fairly trivial, but if you expand the concept, you can see how polymorphism can help you manage very complex programs. +In general, to overload a function, simply declare different versions of it. The compiler takes care of the rest. You must observe one important restriction when overloading a function: the type and/or number of the parameters of each overloaded function must differ. It is not sufficient for two functions to differ only in their return types. They must differ in the types or number of their parameters. (Return types do not provide sufficient information in all cases for the compiler to decide which function to use.) Of course, overloaded functions may differ in their return types, too. +Here is another example that uses overloaded functions: + + +#include #include #include using namespace std; +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 277 + + + +void stradd(char *s1, char *s2); void stradd(char *s1, int i); + +int main() { +char str[80]; + +strcpy(str, "Hello "); stradd(str, "there"); cout << str << "\n"; + +stradd(str, 100); cout << str << "\n"; + +return 0; } + +// concatenate two strings +void stradd(char *s1, char *s2) { +strcat(s1, s2); } + +// concatenate a string with a "stringized" integer void stradd(char *s1, int i) +{ +char temp[80]; + +sprintf(temp, "%d", i); strcat(s1, temp); +} + + +In this program, the function stradd() is overloaded. One version concatenates two strings (just like strcat() does). The other version "stringizes" an integer and then appends that to a string. Here, overloading is used to create one interface that appends either a string or an integer to another string. +You can use the same name to overload unrelated functions, but you should not. For example, you could use the name sqr() to create functions that return the +square of an int and the square root of a double. However, these two operations are fundamentally different; applying function overloading in this manner defeats its purpose (and, in fact, is considered bad programming style). In practice, you should overload only closely related operations. +278 C + + : T h e C o m p l e t e R e f e r e n c e + + +Operator Overloading +Polymorphism is also achieved in C++ through operator overloading. As you know, in C++, it is possible to use the << and >> operators to perform console I/O operations. They can perform these extra operations because in the header, these operators are overloaded. When an operator is overloaded, it takes on an additional meaning relative to a certain class. However, it still retains all of its old meanings. +In general, you can overload most of C++'s operators by defining what they mean relative to a specific class. For example, think back to the stack class developed earlier in this chapter. It is possible to overload the + operator relative to objects of type stack so that it appends the contents of one stack to the contents of another. However, the + still retains its original meaning relative to other types of data. +Because operator overloading is, in practice, somewhat more complex than function overloading, examples are deferred until Chapter 14. + + +Inheritance Asstatedearlierinthischapter,inheritanceisoneofthemajortraitsofanobject-orientedprogramminglanguage.InC++,inheritanceissupportedbyallowingone classtoincorporateanotherclassintoitsdeclaration.Inheritanceallowsahierarchy ofclassestobebuilt,movingfrommostgeneraltomostspecific.Theprocessinvolves firstdefiningabaseclass,whichdefinesthosequalitiescommontoallobjectstobe derivedfromthebase.Thebaseclassrepresentsthemostgeneraldescription.The classesderivedfromthebaseareusuallyreferredtoasderivedclasses.Aderivedclass includesallfeaturesofthegenericbaseclassandthenaddsqualitiesspecifictothe derivedclass.Todemonstratehowthisworks,thenextexamplecreatesclassesthat categorizedifferenttypesofbuildings. +To begin, the building class is declared, as shown here. It will serve as the base for two derived classes. + + +class building { int rooms; int floors; int area; +public: +void set_rooms(int num); int get_rooms(); +void set_floors(int num); int get_floors(); +void set_area(int num); int get_area(); +}; +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 279 + + +Because (for the sake of this example) all buildings have three common features—one or more rooms, one or more floors, and a total area—the building +class embodies these components into its declaration. The member functions beginning with set set the values of the private data. The functions starting with +get return those values. +You can now use this broad definition of a building to create derived classes that describe specific types of buildings. For example, here is a derived class called house: + +// house is derived from building class house : public building { +int bedrooms; int baths; +public: +void set_bedrooms(int num); int get_bedrooms(); +void set_baths(int num); int get_baths(); +}; + +Notice how building is inherited. The general form for inheritance is + +class derived-class : access base-class { // body of new class +} + +Here, access is optional. However, if present, it must be public, private, or protected. (These options are further examined in Chapter 12.) For now, all inherited classes will use public. Using public means that all of the public members of the base class +will become public members of the derived class. Therefore, the public members of the class building become public members of the derived class house and are available +to the member functions of house just as if they had been declared inside house. However, house's member functions do not have access to the private elements of building. This is an important point. Even though house inherits building, it has access only to the public members of building. In this way, inheritance does not circumvent the principles of encapsulation necessary to OOP. + + +Remember + +Aderivedclasshasdirectaccesstobothitsownmembersandthepublicmembersof the base class. + + +Here is a program illustrating inheritance. It creates two derived classes of building using inheritance; one is house, the other, school. +280 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include using namespace std; + +class building { int rooms; int floors; int area; +public: +void set_rooms(int num); int get_rooms(); +void set_floors(int num); int get_floors(); +void set_area(int num); int get_area(); +}; + +// house is derived from building class house : public building { +int bedrooms; int baths; +public: +void set_bedrooms(int num); int get_bedrooms(); +void set_baths(int num); int get_baths(); +}; + +// school is also derived from building class school : public building { +int classrooms; int offices; +public: +void set_classrooms(int num); int get_classrooms(); +void set_offices(int num); int get_offices(); +}; + +void building::set_rooms(int num) { +rooms = num; } +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 281 + + + +void building::set_floors(int num) { +floors = num; } + +void building::set_area(int num) { +area = num; } + +int building::get_rooms() { +return rooms; } + +int building::get_floors() { +return floors; } + +int building::get_area() { +return area; } + +void house::set_bedrooms(int num) { +bedrooms = num; } + +void house::set_baths(int num) { +baths = num; } + +int house::get_bedrooms() { +return bedrooms; } + +int house::get_baths() { +282 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return baths; } + +void school::set_classrooms(int num) { +classrooms = num; } + +void school::set_offices(int num) { +offices = num; } + +int school::get_classrooms() { +return classrooms; } + +int school::get_offices() { +return offices; } + +int main() { +house h; school s; + +h.set_rooms(12); h.set_floors(3); h.set_area(4500); h.set_bedrooms(5); h.set_baths(3); + +cout << "house has " << h.get_bedrooms(); cout << " bedrooms\n"; + +s.set_rooms(200); s.set_classrooms(180); s.set_offices(5); s.set_area(25000); +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 283 + + + +cout << "school has " << s.get_classrooms(); cout << " classrooms\n"; +cout << "Its area is " << s.get_area(); + +return 0; } + +The output produced by this program is shown here. + +house has 5 bedrooms school has 180 classrooms Its area is 25000 + +As this program shows, the major advantage of inheritance is that you can create a general classification that can be incorporated into more specific ones. In this way, each object can precisely represent its own subclass. +When writing about C++, the terms base and derived are generally used to describe the inheritance relationship. However, the terms parent and child are also used. You may also see the terms superclass and subclass. +Aside from providing the advantages of hierarchical classification, inheritance also provides support for run-time polymorphism through the mechanism of virtual functions. (Refer to Chapter 16 for details.) + + +Constructors and Destructors +It is very common for some part of an object to require initialization before it can +be used. For example, think back to the stack class developed earlier in this chapter. Before the stack could be used, tos had to be set to zero. This was performed by +using the function init(). Because the requirement for initialization is so common, C++ allows objects to initialize themselves when they are created. This automatic initialization is performed through the use of a constructor function. +A constructor function is a special function that is a member of a class and has the same name as that class. For example, here is how the stack class looks when converted to use a constructor function for initialization: + + +// This creates the class stack. class stack { +int stck[SIZE]; int tos; +public: +284 C + + : T h e C o m p l e t e R e f e r e n c e + + + +stack(); // constructor void push(int i); +int pop(); }; + +Notice that the constructor stack() has no return type specified. In C++, constructor functions cannot return values and, thus, have no return type. +The stack() function is coded like this: + + +// stack's constructor function stack::stack() +{ +tos = 0; +cout << "Stack Initialized\n"; } + +Keep in mind that the message Stack Initialized is output as a way to illustrate the constructor. In actual practice, most constructor functions will not output or input anything. They will simply perform various initializations. +An object's constructor is automatically called when the object is created. This means that it is called when the object's declaration is executed. If you are accustomed to thinking of a declaration statement as being passive, this is not the case for C++. In C++, a declaration statement is a statement that is executed. This distinction is not just academic. The code executed to construct an object may be quite significant. An object's constructor is called once for global or static local objects. For local objects, the constructor is called each time the object declaration is encountered. +The complement of the constructor is the destructor. In many circumstances, an object will need to perform some action or actions when it is destroyed. Local objects are created when their block is entered, and destroyed when the block is left. Global objects are destroyed when the program terminates. When an object is destroyed, its destructor (if it has one) is automatically called. There are many reasons why a destructor function may be needed. For example, an object may need to deallocate memory that it had previously allocated or it may need to close a file that it had opened. In C++, it is the destructor function that handles deactivation events. The destructor has the same name as the constructor, but it is preceded by a ~. For example, here is the stack class and its constructor and destructor functions. (Keep in mind that the stack class does not require a destructor; the one shown here is just for illustration.) + + +// This creates the class stack. class stack { +int stck[SIZE]; int tos; +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 285 + + + +public: +stack(); // constructor ~stack(); // destructor void push(int i); +int pop(); }; + +// stack's constructor function stack::stack() +{ +tos = 0; +cout << "Stack Initialized\n"; } + +// stack's destructor function stack::~stack() +{ +cout << "Stack Destroyed\n"; } + +Notice that, like constructor functions, destructor functions do not have return values. To see how constructors and destructors work, here is a new version of the stack +program examined earlier in this chapter. Observe that init() is no longer needed. + + +// Using a constructor and destructor. #include +using namespace std; + +#define SIZE 100 + +// This creates the class stack. class stack { +int stck[SIZE]; int tos; +public: +stack(); // constructor ~stack(); // destructor void push(int i); +int pop(); }; + +// stack's constructor function stack::stack() +286 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +tos = 0; +cout << "Stack Initialized\n"; } + +// stack's destructor function stack::~stack() +{ +cout << "Stack Destroyed\n"; } + +void stack::push(int i) { +if(tos==SIZE) { +cout << "Stack is full.\n"; return; +} +stck[tos] = i; tos++; +} + +int stack::pop() { +if(tos==0) { +cout << "Stack underflow.\n"; return 0; +} +tos--; +return stck[tos]; } + +int main() { +stack a, b; // create two stack objects + +a.push(1); b.push(2); + +a.push(3); b.push(4); + +cout << a.pop() << " "; +C h a p t e r 1 1 : A n O v e r v i e w o f C + + 287 + + + +cout << a.pop() << " "; cout << b.pop() << " "; cout << b.pop() << "\n"; + +return 0; } + +This program displays the following: + +Stack Initialized Stack Initialized 3 1 4 2 +Stack Destroyed Stack Destroyed + + +The C++ Keywords +There are 63 keywords currently defined for Standard C++. These are shown in Table 11-1. Together with the formal C++ syntax, they form the C++ programming language. Also, early versions of C++ defined the overload keyword, but it is obsolete. Keep in mind that C++ is a case-sensitive language and it requires that all keywords be in lowercase. + + + + + +asm auto case catch +const const_cast delete do +else enum extern false friend goto int long +new operator + +bool char continue double explicit float +if mutable +private + +break class default +dynamic_cast export +for inline +namespace +protected + + + +Table 11-1. The C++ keywords +288 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +public short static_cast this typedef unsigned +volatile + +register signed struct throw typeid using +wchar_t + +reinterpret_cast sizeof +switch true typename virtual +while + +return static template try union +void + + +Table 11-1. The C++ keywords (continued) + + + +The General Form of a C++ Program +Although individual styles will differ, most C++ programs will have this general form: + +#includes +base-class declarations derived class declarations +nonmember function prototypes int main( ) +{ +//... } +nonmember function definitions + +In most large projects, all class declarations will be put into a header file and included with each module. But the general organization of a program remains the same. +The remaining chapters in this section examine in greater detail the features discussed in this chapter, as well as all other aspects of C++. + +C++ + + + + +Chapter 12 Classes and Objects + + + + + + + + + + + + + + +289 +290 C + + : T h e C o m p l e t e R e f e r e n c e + + +n C++, the class forms the basis for object-oriented programming. The class is used to define the nature of an object, and it is C++'s basic unit of encapsulation. This chapter examines classes and objects in detail. +I + + +Classes +Classes are created using the keyword class. A class declaration defines a new type that links code and data. This new type is then used to declare objects of that class. Thus, a class is a logical abstraction, but an object has physical existence. In other words, an object is an instance of a class. +A class declaration is similar syntactically to a structure. In Chapter 11, a simplified general form of a class declaration was shown. Here is the entire general form of a class declaration that does not inherit any other class. + +class class-name { +private data and functions access-specifier: +data and functions access-specifier: +data and functions // ... +access-specifier: +data and functions } object-list; + +The object-list is optional. If present, it declares objects of the class. Here, access-specifier is one of these three C++ keywords: + +public private protected + +By default, functions and data declared within a class are private to that class and may be accessed only by other members of the class. The public access specifier allows functions or data to be accessible to other parts of your program. The protected access specifier is needed only when inheritance is involved (see Chapter 15). Once an access specifier has been used, it remains in effect until either another access specifier is encountered or the end of the class declaration is reached. +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 291 + + +You may change access specifications as often as you like within a class declaration. For example, you may switch to public for some declarations and then switch back to private again. The class declaration in the following example illustrates this feature: + + +#include #include using namespace std; + +class employee { +char name[80]; // private by default public: +void putname(char *n); // these are public void getname(char *n); +private: +double wage; // now, private again public: +void putwage(double w); // back to public double getwage(); +}; + +void employee::putname(char *n) { +strcpy(name, n); } + +void employee::getname(char *n) { +strcpy(n, name); } + +void employee::putwage(double w) { +wage = w; } + +double employee::getwage() { +return wage; } + +int main() { +employee ted; +292 C + + : T h e C o m p l e t e R e f e r e n c e + + + +char name[80]; + +ted.putname("Ted Jones"); ted.putwage(75000); + +ted.getname(name); +cout << name << " makes $"; +cout << ted.getwage() << " per year."; + +return 0; } + +Here, employee is a simple class that is used to store an employee's name and wage. Notice that the public access specifier is used twice. +Although you may use the access specifiers as often as you like within a class declaration, the only advantage of doing so is that by visually grouping various parts of a class, you may make it easier for someone else reading the program to understand it. However, to the compiler, using multiple access specifiers makes no difference. Actually, most programmers find it easier to have only one private, protected, and public section within each class. For example, most programmers would code the employee class as shown here, with all private elements grouped together and all public elements grouped together: + +class employee { char name[80]; double wage; +public: +void putname(char *n); void getname(char *n); void putwage(double w); double getwage(); +}; + +Functions that are declared within a class are called member functions. Member functions may access any element of the class of which they are a part. This includes all private elements. Variables that are elements of a class are called member variables or data members. Collectively, any element of a class can be referred to as a member +of that class. +There are a few restrictions that apply to class members. A non-static member variable cannot have an initializer. No member can be an object of the class that is +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 293 + + +being declared. (Although a member can be a pointer to the class that is being declared.) No member can be declared as auto, extern, or register. +In general, you should make all data members of a class private to that class. This is part of the way that encapsulation is achieved. However, there may be situations in which you will need to make one or more variables public. (For example, a heavily used variable may need to be accessible globally in order to achieve faster run times.) When a variable is public, it may be accessed directly by any other part of your program. The syntax for accessing a public data member is the same as for calling a member function: Specify the object's name, the dot operator, and the variable name. This simple program illustrates the use of a public variable: + +#include using namespace std; + +class myclass { public: +int i, j, k; // accessible to entire program }; + +int main() { +myclass a, b; + +a.i = 100; // access to i, j, and k is OK a.j = 4; +a.k = a.i * a.j; + +b.k = 12; // remember, a.k and b.k are different cout << a.k << " " << b.k; + +return 0; } + +Structures and Classes Are Related +Structures are part of the C subset and were inherited from the C language. As you have seen, a class is syntactically similar to a struct. But the relationship between a class and a struct is closer than you may at first think. In C++, the role of the structure was expanded, making it an alternative way to specify a class. In fact, the only difference between a class and a struct is that by default all members are public in a struct and private in a class. In all other respects, structures and classes are equivalent. +294 C + + : T h e C o m p l e t e R e f e r e n c e + + +That is, in C++, a structure defines a class type. For example, consider this short program, which uses a structure to declare a class that controls access to a string: + + +// Using a structure to define a class. #include +#include using namespace std; + +struct mystr { +void buildstr(char *s); // public void showstr(); +private: // now go private char str[255]; +} ; + +void mystr::buildstr(char *s) { +if(!*s) *str = '\0'; // initialize string else strcat(str, s); +} + +void mystr::showstr() { +cout << str << "\n"; } + +int main() { +mystr s; + +s.buildstr(""); // init s.buildstr("Hello "); s.buildstr("there!"); + +s.showstr(); + +return 0; } + +This program displays the string Hello there!. +The class mystr could be rewritten by using class as shown here: + + +class mystr { char str[255]; +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 295 + + + +public: +void buildstr(char *s); // public void showstr(); +} ; + + +You might wonder why C++ contains the two virtually equivalent keywords struct and class. This seeming redundancy is justified for several reasons. First, there is no fundamental reason not to increase the capabilities of a structure. In C, structures already provide a means of grouping data. Therefore, it is a small step to allow them to include member functions. Second, because structures and classes are related, it may be easier to port existing C programs to C++. Finally, although struct and class are virtually equivalent today, providing two different keywords allows the definition of a class to be free to evolve. In order for C++ to remain compatible with C, the definition of struct must always be tied to its C definition. +Although you can use a struct where you use a class, most programmers don't. Usually it is best to use a class when you want a class, and a struct when you want a C-like structure. This is the style that this book will follow. Sometimes the acronym POD is used to describe a C-style structure—one that does not contain member functions, constructors, or destructors. It stands for Plain Old Data. (Actually, the term POD is a bit more narrowly defined in the Standard C++ specification, but means essentially the same thing.) + +Remember In C++, a structure declaration defines a class type. + +Unions and Classes Are Related +Like a structure, a union may also be used to define a class. In C++, unions may contain both member functions and variables. They may also include constructor and destructor functions. A union in C++ retains all of its C-like features, the most important being that all data elements share the same location in memory. Like the +structure, union members are public by default and are fully compatible with C. In the next example, a union is used to swap the bytes that make up an unsigned short integer. (This example assumes that short integers are 2 bytes long.) + + +#include using namespace std; + +union swap_byte { void swap(); +void set_byte(unsigned short i); void show_word(); +296 C + + : T h e C o m p l e t e R e f e r e n c e + + + +unsigned short u; unsigned char c[2]; +}; + +void swap_byte::swap() { +unsigned char t; + +t = c[0]; c[0] = c[1]; c[1] = t; +} + +void swap_byte::show_word() { +cout << u; } + +void swap_byte::set_byte(unsigned short i) { +u = i; } + +int main() { +swap_byte b; + +b.set_byte(49034); b.swap(); b.show_word(); + +return 0; } + +Like a structure, a union declaration in C++ defines a special type of class. This means that the principle of encapsulation is preserved. +There are several restrictions that must be observed when you use C++ unions. First, a union cannot inherit any other classes of any type. Further, a union cannot be a base class. A union cannot have virtual member functions. (Virtual functions are discussed in Chapter 17.) No static variables can be members of a union. A reference member cannot be used. A union cannot have as a member any object that overloads the = operator. Finally, no object can be a member of a union if the object has an explicit constructor or destructor function. +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 297 + + +As with struct, the term POD is also commonly applied to unions that do not contain member functions, constructors, or destructors. + +Anonymous Unions +There is a special type of union in C++ called an anonymous union. An anonymous +union does not include a type name, and no objects of the union can be declared. Instead, an anonymous union tells the compiler that its member variables are to share the same location. However, the variables themselves are referred to directly, without the normal dot operator syntax. For example, consider this program: + +#include #include using namespace std; + +int main() { +// define anonymous union union { +long l; double d; char s[4]; +} ; + +// now, reference union elements directly l = 100000; +cout << l << " "; d = 123.2342; cout << d << " "; strcpy(s, "hi"); cout << s; + +return 0; } + +As you can see, the elements of the union are referenced as if they had been declared as normal local variables. In fact, relative to your program, that is exactly how you will use them. Further, even though they are defined within a union declaration, they are at the same scope level as any other local variable within the same block. This implies that the names of the members of an anonymous union must not conflict with other identifiers known within the same scope. +All restrictions involving unions apply to anonymous ones, with these additions. First, the only elements contained within an anonymous union must be data. No member functions are allowed. Anonymous unions cannot contain private or protected elements. Finally, global anonymous unions must be specified as static. +298 C + + : T h e C o m p l e t e R e f e r e n c e + + +Friend Functions +It is possible to grant a nonmember function access to the private members of a class by using a friend. A friend function has access to all private and protected members of the class for which it is a friend. To declare a friend function, include its prototype within the class, preceding it with the keyword friend. Consider this program: + + +#include using namespace std; + +class myclass { int a, b; +public: +friend int sum(myclass x); void set_ab(int i, int j); +}; + +void myclass::set_ab(int i, int j) { +a = i; b = j; +} + +// Note: sum() is not a member function of any class. int sum(myclass x) +{ +/* Because sum() is a friend of myclass, it can directly access a and b. */ + +return x.a + x.b; } + +int main() { +myclass n; + +n.set_ab(3, 4); + +cout << sum(n); + +return 0; } +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 299 + + +In this example, the sum() function is not a member of myclass. However, it still has full access to its private members. Also, notice that sum() is called without the use of the dot operator. Because it is not a member function, it does not need to be (indeed, it may not be) qualified with an object's name. +Although there is nothing gained by making sum() a friend rather than a member function of myclass, there are some circumstances in which friend functions are quite valuable. First, friends can be useful when you are overloading certain types of operators (see Chapter 14). Second, friend functions make the creation of some types of I/O functions easier (see Chapter 18). The third reason that friend functions may be desirable is that in some cases, two or more classes may contain members that are interrelated relative to other parts of your program. Let's examine this third usage now. +To begin, imagine two different classes, each of which displays a pop-up message on the screen when error conditions occur. Other parts of your program may wish +to know if a pop-up message is currently being displayed before writing to the screen so that no message is accidentally overwritten. Although you can create member functions in each class that return a value indicating whether a message is active, +this means additional overhead when the condition is checked (that is, two function calls, not just one). If the condition needs to be checked frequently, this additional overhead may not be acceptable. However, using a function that is a friend of each class, it is possible to check the status of each object by calling only this one function. Thus, in situations like this, a friend function allows you to generate more efficient code. The following program illustrates this concept: + +#include using namespace std; + +const int IDLE = 0; const int INUSE = 1; + +class C2; // forward declaration + +class C1 { +int status; // IDLE if off, INUSE if on screen // ... +public: +void set_status(int state); friend int idle(C1 a, C2 b); +}; + +class C2 { +int status; // IDLE if off, INUSE if on screen // ... +300 C + + : T h e C o m p l e t e R e f e r e n c e + + + +public: +void set_status(int state); friend int idle(C1 a, C2 b); +}; + +void C1::set_status(int state) { +status = state; } + +void C2::set_status(int state) { +status = state; } + +int idle(C1 a, C2 b) { +if(a.status || b.status) return 0; else return 1; +} + +int main() { +C1 x; C2 y; + +x.set_status(IDLE); y.set_status(IDLE); + +if(idle(x, y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; + +x.set_status(INUSE); + +if(idle(x, y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; + +return 0; } + +Notice that this program uses a forward declaration (also called a forward reference) for the class C2. This is necessary because the declaration of idle() inside C1 refers +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 301 + + +to C2 before it is declared. To create a forward declaration to a class, simply use the form shown in this program. +A friend of one class may be a member of another. For example, here is the preceding program rewritten so that idle() is a member of C1: + + +#include using namespace std; + +const int IDLE = 0; const int INUSE = 1; + +class C2; // forward declaration + +class C1 { +int status; // IDLE if off, INUSE if on screen // ... +public: +void set_status(int state); +int idle(C2 b); // now a member of C1 }; + +class C2 { +int status; // IDLE if off, INUSE if on screen // ... +public: +void set_status(int state); friend int C1::idle(C2 b); +}; + +void C1::set_status(int state) { +status = state; } + +void C2::set_status(int state) { +status = state; } + +// idle() is member of C1, but friend of C2 int C1::idle(C2 b) +{ +302 C + + : T h e C o m p l e t e R e f e r e n c e + + + +if(status || b.status) return 0; else return 1; +} + +int main() { +C1 x; C2 y; + +x.set_status(IDLE); y.set_status(IDLE); + +if(x.idle(y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; +x.set_status(INUSE); + +if(x.idle(y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; + +return 0; } + +Because idle() is a member of C1, it can access the status variable of objects of type C1 directly. Thus, only objects of type C2 need be passed to idle(). +There are two important restrictions that apply to friend functions. First, a derived class does not inherit friend functions. Second, friend functions may not have a storage-class specifier. That is, they may not be declared as static or extern. + + +Friend Classes +It is possible for one class to be a friend of another class. When this is the case, the friend class and all of its member functions have access to the private members defined within the other class. For example, + + +// Using a friend class. #include using namespace std; + +class TwoValues { int a; +int b; +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 303 + + + +public: +TwoValues(int i, int j) { a = i; b = j; } friend class Min; +}; + +class Min { public: +int min(TwoValues x); }; + +int Min::min(TwoValues x) { +return x.a < x.b ? x.a : x.b; } + +int main() { +TwoValues ob(10, 20); Min m; + +cout << m.min(ob); + +return 0; } + +In this example, class Min has access to the private variables a and b declared within the TwoValues class. +It is critical to understand that when one class is a friend of another, it only has access to names defined within the other class. It does not inherit the other class. Specifically, the members of the first class do not become members of the friend class. +Friend classes are seldom used. They are supported to allow certain special case situations to be handled. + + +Inline Functions +There is an important feature in C++, called an inline function, that is commonly used with classes. Since the rest of this chapter (and the rest of the book) will make heavy use of it, inline functions are examined here. +In C++, you can create short functions that are not actually called; rather, their code is expanded in line at the point of each invocation. This process is similar to using a function-like macro. To cause a function to be expanded in line rather than called, +304 C + + : T h e C o m p l e t e R e f e r e n c e + + +precede its definition with the inline keyword. For example, in this program, the function max() is expanded in line instead of called: + + +#include using namespace std; + +inline int max(int a, int b) { +return a>b ? a : b; } + +int main() { +cout << max(10, 20); +cout << " " << max(99, 88); + +return 0; } + +As far as the compiler is concerned, the preceding program is equivalent to this one: + +#include using namespace std; + +int main() { + +cout << (10>20 ? 10 : 20); +cout << " " << (99>88 ? 99 : 88); + +return 0; } + +The reason that inline functions are an important addition to C++ is that they allow you to create very efficient code. Since classes typically require several frequently executed interface functions (which provide access to private data), the efficiency of these functions is of critical concern. As you probably know, each time a function is called, a significant amount of overhead is generated by the calling and return mechanism. Typically, arguments are pushed onto the stack and various registers are saved when a function is called, and then restored when the function returns. The trouble is that these instructions take time. However, when a function is expanded in line, none of those operations occur. Although expanding function calls in line can +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 305 + + +produce faster run times, it can also result in larger code size because of duplicated code. For this reason, it is best to inline only very small functions. Further, it is also a good idea to inline only those functions that will have significant impact on the performance of your program. +Like the register specifier, inline is actually just a request, not a command, to the compiler. The compiler can choose to ignore it. Also, some compilers may not inline all types of functions. For example, it is common for a compiler not to inline a recursive function. You will need to check your compiler's user manual for any restrictions to inline. Remember, if a function cannot be inlined, it will simply be called as a normal function. +Inline functions may be class member functions. For example, this is a perfectly valid C++ program: + +#include using namespace std; + +class myclass { int a, b; +public: +void init(int i, int j); void show(); +}; + +// Create an inline function. +inline void myclass::init(int i, int j) { +a = i; b = j; +} + +// Create another inline function. inline void myclass::show() +{ +cout << a << " " << b << "\n"; } + +int main() { +myclass x; + +x.init(10, 20); x.show(); + +return 0; } +306 C + + : T h e C o m p l e t e R e f e r e n c e + + +Defining Inline Functions Within a Class +It is possible to define short functions completely within a class declaration. When a +function is defined inside a class declaration, it is automatically made into an inline function (if possible). It is not necessary (but not an error) to precede its declaration with the inline keyword. For example, the preceding program is rewritten here with the definitions of init() and show() contained within the declaration of myclass: + + +#include using namespace std; + +class myclass { int a, b; +public: +// automatic inline +void init(int i, int j) { a=i; b=j; } +void show() { cout << a << " " << b << "\n"; } }; + +int main() { +myclass x; + +x.init(10, 20); x.show(); + +return 0; } + +Notice the format of the function code within myclass. Because inline functions are short, this style of coding within a class is fairly typical. However, you are free +to use any format you like. For example, this is a perfectly valid way to rewrite the myclass declaration: + + +#include using namespace std; + +class myclass { int a, b; +public: +// automatic inline void init(int i, int j) { +a = i; +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 307 + + + +b = j; } + +void show() { +cout << a << " " << b << "\n"; } +}; + + +Technically, the inlining of the show() function is of limited value because (in general) the amount of time the I/O statement will take far exceeds the overhead +of a function call. However, it is extremely common to see all short member functions defined inside their class in C++ programs. (In fact, it is rare to see short member functions defined outside their class declarations in professionally written C++ code.) +Constructor and destructor functions may also be inlined, either by default, if defined within their class, or explicitly. + + +Parameterized Constructors +It is possible to pass arguments to constructor functions. Typically, these arguments help initialize an object when it is created. To create a parameterized constructor, simply add parameters to it the way you would to any other function. When you define the constructor's body, use the parameters to initialize the object. For example, here is a simple class that includes a parameterized constructor: + + +#include using namespace std; + +class myclass { int a, b; +public: +myclass(int i, int j) {a=i; b=j;} void show() {cout << a << " " << b;} +}; + +int main() { +myclass ob(3, 5); + +ob.show(); + +return 0; } +308 C + + : T h e C o m p l e t e R e f e r e n c e + + +Notice that in the definition of myclass(), the parameters i and j are used to give initial values to a and b. +The program illustrates the most common way to specify arguments when you declare an object that uses a parameterized constructor function. Specifically, this statement + +myclass ob(3, 4); + +causes an object called ob to be created and passes the arguments 3 and 4 to the i and j parameters of myclass(). You may also pass arguments using this type of declaration statement: + + +myclass ob = myclass(3, 4); + +However, the first method is the one generally used, and this is the approach taken by most of the examples in this book. Actually, there is a small technical difference between the two types of declarations that relates to copy constructors. (Copy constructors are discussed in Chapter 14.) +Here is another example that uses a parameterized constructor function. It creates a class that stores information about library books. + +#include #include using namespace std; + +const int IN = 1; +const int CHECKED_OUT = 0; + +class book { +char author[40]; char title[40]; int status; +public: +book(char *n, char *t, int s); int get_status() {return status;} +void set_status(int s) {status = s;} void show(); +}; + +book::book(char *n, char *t, int s) { +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 309 + + + +strcpy(author, n); strcpy(title, t); status = s; +} + +void book::show() { +cout << title << " by " << author; cout << " is "; +if(status==IN) cout << "in.\n"; else cout << "out.\n"; +} + +int main() { +book b1("Twain", "Tom Sawyer", IN); +book b2("Melville", "Moby Dick", CHECKED_OUT); + +b1.show(); b2.show(); + +return 0; } + +Parameterized constructor functions are very useful because they allow you to avoid having to make an additional function call simply to initialize one or more variables in an object. Each function call you can avoid makes your program more efficient. Also, notice that the short get_status() and set_status() functions are defined in line, within the book class. This is a common practice when writing C++ programs. + +Constructors with One Parameter: A Special Case +If a constructor only has one parameter, there is a third way to pass an initial value to that constructor. For example, consider the following short program. + + +#include using namespace std; + +class X { int a; +310 C + + : T h e C o m p l e t e R e f e r e n c e + + + +public: +X(int j) { a = j; } +int geta() { return a; } }; + +int main() { +X ob = 99; // passes 99 to j + +cout << ob.geta(); // outputs 99 + +return 0; } + +Here, the constructor for X takes one parameter. Pay special attention to how ob +is declared in main() . In this form of initialization, 99 is automatically passed to the j parameter in the X() constructor. That is, the declaration statement is handled by the compiler as if it were written like this: + + +X ob = X(99); + +In general, any time you have a constructor that requires only one argument, you can use either ob(i) or ob = i to initialize an object. The reason for this is that whenever you create a constructor that takes one argument, you are also implicitly creating a conversion from the type of that argument to the type of the class. +Remember that the alternative shown here applies only to constructors that have exactly one parameter. + + +Static Class Members +Both function and data members of a class can be made static. This section explains the consequences of each. + +Static Data Members +When you precede a member variable's declaration with static, you are telling the compiler that only one copy of that variable will exist and that all objects of the class will share that variable. Unlike regular data members, individual copies of a static member variable are not made for each object. No matter how many objects of a class are created, only one copy of a static data member exists. Thus, all objects of that class use that same variable. All static variables are initialized to zero before the first object is created. +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 311 + + +When you declare a static data member within a class, you are not defining it. (That is, you are not allocating storage for it.) Instead, you must provide a global definition for it elsewhere, outside the class. This is done by redeclaring the static variable using the scope resolution operator to identify the class to which it belongs. This causes storage for the variable to be allocated. (Remember, a class declaration is simply a logical construct that does not have physical reality.) +To understand the usage and effect of a static data member, consider this program: + + +#include using namespace std; + +class shared { static int a; int b; +public: +void set(int i, int j) {a=i; b=j;} void show(); +} ; + +int shared::a; // define a + +void shared::show() { +cout << "This is static a: " << a; +cout << "\nThis is non-static b: " << b; cout << "\n"; +} + +int main() { +shared x, y; + +x.set(1, 1); // set a to 1 x.show(); + +y.set(2, 2); // change a to 2 y.show(); + +x.show(); /* Here, a has been changed for both x and y because a is shared by both objects. */ + +return 0; } +312 C + + : T h e C o m p l e t e R e f e r e n c e + + +This program displays the following output when run. + +This is static a: 1 This is non-static b: 1 This is static a: 2 This is non-static b: 2 This is static a: 2 This is non-static b: 1 + +Notice that the integer a is declared both inside shared and outside of it. As mentioned earlier, this is necessary because the declaration of a inside shared does not allocate storage. + + +Note + +As a convenience, older versions of C++ did not require the second declaration of a static member variable. However, this convenience gave rise to serious inconsistenciesanditwaseliminatedseveralyearsago.However,youmaystillfind older C++ code that does not redeclare static member variables. In these cases, you will need to add the required definitions. + + +A static member variable exists before any object of its class is created. For example, in the following short program, a is both public and static. Thus it may +be directly accessed in main(). Further, since a exists before an object of shared is created, a can be given a value at any time. As this program illustrates, the value of a is unchanged by the creation of object x. For this reason, both output statements display the same value: 99. + + +#include using namespace std; + +class shared { public: +static int a; } ; + +int shared::a; // define a + +int main() { +// initialize a before creating any objects shared::a = 99; + +cout << "This is initial value of a: " << shared::a; +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 313 + + + +cout << "\n"; + +shared x; + +cout << "This is x.a: " << x.a; + +return 0; } + +Notice how a is referred to through the use of the class name and the scope resolution operator. In general, to refer to a static member independently of an object, you must qualify it by using the name of the class of which it is a member. +One use of a static member variable is to provide access control to some shared resource used by all objects of a class. For example, you might create several objects, each of which needs to write to a specific disk file. Clearly, however, only one object can be allowed to write to the file at a time. In this case, you will want to declare a static variable that indicates when the file is in use and when it is free. Each object then interrogates this variable before writing to the file. The following program shows how you might use a static variable of this type to control access to a scarce resource: + + +#include using namespace std; + +class cl { +static int resource; public: +int get_resource(); +void free_resource() {resource = 0;} }; + +int cl::resource; // define resource + +int cl::get_resource() { +if(resource) return 0; // resource already in use else { +resource = 1; +return 1; // resource allocated to this object } +} +314 C + + : T h e C o m p l e t e R e f e r e n c e + + + +int main() { +cl ob1, ob2; + +if(ob1.get_resource()) cout << "ob1 has resource\n"; + +if(!ob2.get_resource()) cout << "ob2 denied resource\n"; + +ob1.free_resource(); // let someone else use it + +if(ob2.get_resource()) +cout << "ob2 can now use resource\n"; + +return 0; } + +Another interesting use of a static member variable is to keep track of the number of objects of a particular class type that are in existence. For example, + + +#include using namespace std; + +class Counter { public: +static int count; Counter() { count++; } ~Counter() { count--; } +}; +int Counter::count; + +void f(); + +int main(void) { +Counter o1; +cout << "Objects in existence: "; cout << Counter::count << "\n"; + +Counter o2; +cout << "Objects in existence: "; cout << Counter::count << "\n"; +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 315 + + + + +f(); +cout << "Objects in existence: "; cout << Counter::count << "\n"; + +return 0; } + +void f() { +Counter temp; +cout << "Objects in existence: "; cout << Counter::count << "\n"; +// temp is destroyed when f() returns } + +This program produces the following output. + +Objects in existence: 1 Objects in existence: 2 Objects in existence: 3 Objects in existence: 2 + +As you can see, the static member variable count is incremented whenever an object is created and decremented when an object is destroyed. This way, it keeps track of how many objects of type Counter are currently in existence. +By using static member variables, you should be able to virtually eliminate any need for global variables. The trouble with global variables relative to OOP is that they almost always violate the principle of encapsulation. + +Static Member Functions +Member functions may also be declared as static. There are several restrictions placed +on static member functions. They may only directly refer to other static members of the class. (Of course, global functions and data may be accessed by static member functions.) A static member function does not have a this pointer. (See Chapter 13 +for information on this.) There cannot be a static and a non-static version of the same function. A static member function may not be virtual. Finally, they cannot be declared as const or volatile. +Following is a slightly reworked version of the shared-resource program from the previous section. Notice that get_resource() is now declared as static. As the program +316 C + + : T h e C o m p l e t e R e f e r e n c e + + +illustrates, get_resource() may be called either by itself, independent of any object, by using the class name and the scope resolution operator, or in connection with an object. + + +#include using namespace std; + +class cl { +static int resource; public: +static int get_resource(); +void free_resource() { resource = 0; } }; + +int cl::resource; // define resource + +int cl::get_resource() { +if(resource) return 0; // resource already in use else { +resource = 1; +return 1; // resource allocated to this object } +} + +int main() { +cl ob1, ob2; + +/* get_resource() is static so may be called independent of any object. */ +if(cl::get_resource()) cout << "ob1 has resource\n"; + +if(!cl::get_resource()) cout << "ob2 denied resource\n"; + +ob1.free_resource(); + +if(ob2.get_resource()) // can still call using object syntax cout << "ob2 can now use resource\n"; + +return 0; } +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 317 + + +Actually, static member functions have limited applications, but one good use +for them is to "preinitialize" private static data before any object is actually created. For example, this is a perfectly valid C++ program: + + +#include using namespace std; + +class static_type { static int i; +public: +static void init(int x) {i = x;} void show() {cout << i;} +}; + +int static_type::i; // define i + +int main() { +// init static data before object creation static_type::init(100); + +static_type x; +x.show(); // displays 100 + +return 0; } + +When Constructors and Destructors Are Executed +As a general rule, an object's constructor is called when the object comes into existence, and an object's destructor is called when the object is destroyed. Precisely when these events occur is discussed here. +A local object's constructor function is executed when the object's declaration statement is encountered. The destructor functions for local objects are executed in the reverse order of the constructor functions. +Global objects have their constructor functions execute before main() begins execution. Global constructors are executed in order of their declaration, within +the same file. You cannot know the order of execution of global constructors spread among several files. Global destructors execute in reverse order after main() has terminated. +318 C + + : T h e C o m p l e t e R e f e r e n c e + + +This program illustrates when constructors and destructors are executed: + +#include using namespace std; + +class myclass { public: +int who; myclass(int id); ~myclass(); +} glob_ob1(1), glob_ob2(2); + +myclass::myclass(int id) { +cout << "Initializing " << id << "\n"; who = id; +} + +myclass::~myclass() { +cout << "Destructing " << who << "\n"; } + +int main() { +myclass local_ob1(3); + +cout << "This will not be first line displayed.\n"; + +myclass local_ob2(4); + +return 0; } + +It displays this output: + +Initializing 1 Initializing 2 Initializing 3 +This will not be first line displayed. Initializing 4 +Destructing 4 +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 319 + + + +Destructing 3 Destructing 2 Destructing 1 + +One thing: Because of differences between compilers and execution environments, you may or may not see the last two lines of output. + + +The Scope Resolution Operator +As you know, the :: operator links a class name with a member name in order to tell the compiler what class the member belongs to. However, the scope resolution +operator has another related use: it can allow access to a name in an enclosing scope that is "hidden" by a local declaration of the same name. For example, consider this fragment: + +int i; // global i + +void f() { +int i; // local i + +i = 10; // uses local i . +. . +} + +As the comment suggests, the assignment i = 10 refers to the local i. But what if function f() needs to access the global version of i? It may do so by preceding the i with the :: operator, as shown here. + + +int i; // global i + +void f() { +int i; // local i + +::i = 10; // now refers to global i . +. . +} +320 C + + : T h e C o m p l e t e R e f e r e n c e + + +Nested Classes +It is possible to define one class within another. Doing so creates a nested class. Since a class declaration does, in fact, define a scope, a nested class is valid only within the scope of the enclosing class. Frankly, nested classes are seldom used. Because of C++'s flexible and powerful inheritance mechanism, the need for nested classes is virtually nonexistent. + + +Local Classes +A class may be defined within a function. For example, this is a valid C++ program: + +#include using namespace std; + +void f(); + +int main() { +f(); +// myclass not known here return 0; +} + +void f() { +class myclass { int i; +public: +void put_i(int n) { i=n; } int get_i() { return i; } +} ob; + +ob.put_i(10); +cout << ob.get_i(); } + +When a class is declared within a function, it is known only to that function and unknown outside of it. +Several restrictions apply to local classes. First, all member functions must be defined within the class declaration. The local class may not use or access local variables of the function in which it is declared (except that a local class has access +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 321 + + +to static local variables declared within the function or those declared as extern). It may access type names and enumerators defined by the enclosing function, however. No static variables may be declared inside a local class. Because of these restrictions, local classes are not common in C++ programming. + + +Passing Objects to Functions +Objects may be passed to functions in just the same way that any other type of variable can. Objects are passed to functions through the use of the standard call-by-value mechanism. This means that a copy of an object is made when it is passed to +a function. However, the fact that a copy is created means, in essence, that another object is created. This raises the question of whether the object's constructor function is executed when the copy is made and whether the destructor function is executed when the copy is destroyed. The answer to these two questions may surprise you. To begin, here is an example: + + +// Passing an object to a function. #include +using namespace std; + +class myclass { int i; +public: myclass(int n); ~myclass(); +void set_i(int n) { i=n; } int get_i() { return i; } +}; + +myclass::myclass(int n) { +i = n; +cout << "Constructing " << i << "\n"; } + +myclass::~myclass() { +cout << "Destroying " << i << "\n"; } + +void f(myclass ob); +322 C + + : T h e C o m p l e t e R e f e r e n c e + + + +int main() { +myclass o(1); + +f(o); +cout << "This is i in main: "; cout << o.get_i() << "\n"; + +return 0; } + +void f(myclass ob) { +ob.set_i(2); + +cout << "This is local i: " << ob.get_i(); cout << "\n"; +} + + +This program produces this output: + +Constructing 1 This is local i: 2 Destroying 2 +This is i in main: 1 Destroying 1 + +Notice that two calls to the destructor function are executed, but only one call is made to the constructor function. As the output illustrates, the constructor function is not called when the copy of o (in main() ) is passed to ob (within f() ). The reason +that the constructor function is not called when the copy of the object is made is easy to understand. When you pass an object to a function, you want the current state of that object. If the constructor is called when the copy is created, initialization will occur, possibly changing the object. Thus, the constructor function cannot be executed when the copy of an object is generated in a function call. +Although the constructor function is not called when an object is passed to a function, it is necessary to call the destructor when the copy is destroyed. (The copy is destroyed like any other local variable, when the function terminates.) Remember, a new copy of the object has been created when the copy is made. This means that the copy could be performing operations that will require a destructor function to +be called when the copy is destroyed. For example, it is perfectly valid for the copy to +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 323 + + +allocate memory that must be freed when it is destroyed. For this reason, the destructor function must be executed when the copy is destroyed. +To summarize: When a copy of an object is generated because it is passed to a function, the object's constructor function is not called. However, when the copy of the object inside the function is destroyed, its destructor function is called. +By default, when a copy of an object is made, a bitwise copy occurs. This means that the new object is an exact duplicate of the original. The fact that an exact copy is made can, at times, be a source of trouble. Even though objects are passed to functions by means of the normal call-by-value parameter passing mechanism, which, in theory, protects and insulates the calling argument, it is still possible for a side effect to occur that may affect, or even damage, the object used as an argument. For example, if an object used as an argument allocates memory and frees that memory when it is destroyed, then its local copy inside the function will free the same memory when its destructor is called. This will leave the original object damaged and effectively useless. As explained in Chapter 14, it is possible to prevent this type of problem by defining the copy operation relative to your own classes by creating a special type of constructor called a copy constructor. + + +Returning Objects +A function may return an object to the caller. For example, this is a valid C++ program: + +// Returning objects from a function. #include +using namespace std; + +class myclass { int i; +public: +void set_i(int n) { i=n; } int get_i() { return i; } +}; + +myclass f(); // return object of type myclass + +int main() { +myclass o; + +o = f(); +324 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +cout << o.get_i() << "\n"; + +return 0; } + +myclass f() { +myclass x; + +x.set_i(1); return x; +} + + +When an object is returned by a function, a temporary object is automatically created that holds the return value. It is this object that is actually returned by the function. After the value has been returned, this object is destroyed. The destruction of this temporary object may cause unexpected side effects in some situations. For example, if the object returned by the function has a destructor that frees dynamically allocated memory, that memory will be freed even though the object that is receiving the return value is still using it. There are ways to overcome this problem that involve overloading the assignment operator (see Chapter 15) and defining a copy constructor (see Chapter 14). + + +Object Assignment +Assuming that both objects are of the same type, you can assign one object to another. This causes the data of the object on the right side to be copied into the data of the object on the left. For example, this program displays 99: + + +// Assigning objects. #include using namespace std; + +class myclass { int i; +public: +void set_i(int n) { i=n; } int get_i() { return i; } +}; +C h a p t e r 1 2 : C l a s s e s a n d O b j e c t s 325 + + + +int main() { +myclass ob1, ob2; + +ob1.set_i(99); +ob2 = ob1; // assign data from ob1 to ob2 + +cout << "This is ob2's i: " << ob2.get_i(); + +return 0; } + +By default, all data from one object is assigned to the other by use of a bit-by-bit copy. However, it is possible to overload the assignment operator and define some other assignment procedure (see Chapter 15). + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 13 Arrays, Pointers, References, +and the Dynamic Allocation Operators + + + + + + + +327 +328 C + + : T h e C o m p l e t e R e f e r e n c e + + +n Part One, pointers and arrays were examined as they relate to C++'s built-in types. Here, they are discussed relative to objects. This chapter also looks at a feature related to the pointer called a reference. The chapter concludes with an +I +examination of C++'s dynamic allocation operators. + + +Arrays of Objects +In C++, it is possible to have arrays of objects. The syntax for declaring and using an object array is exactly the same as it is for any other type of array. For example, this program uses a three-element array of objects: + + +#include using namespace std; + +class cl { int i; +public: +void set_i(int j) { i=j; } int get_i() { return i; } +}; + +int main() { +cl ob[3]; int i; + +for(i=0; i<3; i++) ob[i].set_i(i+1); + +for(i=0; i<3; i++) +cout << ob[i].get_i() << "\n"; + +return 0; } + +This program displays the numbers 1, 2, and 3 on the screen. +If a class defines a parameterized constructor, you may initialize each object in an array by specifying an initialization list, just like you do for other types of arrays. However, the exact form of the initialization list will be decided by the number of parameters required by the object's constructor function. For objects whose constructors have only one parameter, you can simply specify a list of initial values, using the normal array-initialization syntax. As each element in the array is created, a +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 329 + + +value from the list is passed to the constructor's parameter. For example, here is a slightly different version of the preceding program that uses an initialization: + + +#include using namespace std; + +class cl { int i; +public: +cl(int j) { i=j; } // constructor int get_i() { return i; } +}; + +int main() { +cl ob[3] = {1, 2, 3}; // initializers int i; + +for(i=0; i<3; i++) +cout << ob[i].get_i() << "\n"; + +return 0; } + +As before, this program displays the numbers 1, 2, and 3 on the screen. +Actually, the initialization syntax shown in the preceding program is shorthand for this longer form: + + +cl ob[3] = { cl(1), cl(2), cl(3) }; + +Here, the constructor for cl is invoked explicitly. Of course, the short form used in the program is more common. The short form works because of the automatic conversion that applies to constructors taking only one argument (see Chapter 12). Thus, the short form can only be used to initialize object arrays whose constructors only require one argument. +If an object's constructor requires two or more arguments, you will have to use the longer initialization form. For example, + +#include using namespace std; +330 C + + : T h e C o m p l e t e R e f e r e n c e + + + +class cl { int h; int i; +public: +cl(int j, int k) { h=j; i=k; } // constructor with 2 parameters int get_i() {return i;} +int get_h() {return h;} }; + +int main() { +cl ob[3] = { +cl(1, 2), // initialize cl(3, 4), +cl(5, 6) }; + +int i; + +for(i=0; i<3; i++) { cout << ob[i].get_h(); cout << ", "; +cout << ob[i].get_i() << "\n"; } + +return 0; } + +Here, cl's constructor has two parameters and, therefore, requires two arguments. This means that the shorthand initialization format cannot be used and the long form, shown in the example, must be employed. + +Creating Initialized vs. Uninitialized Arrays +A special case situation occurs if you intend to create both initialized and uninitialized arrays of objects. Consider the following class. + + +class cl { int i; +public: +cl(int j) { i=j; } +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 331 + + + +int get_i() { return i; } }; + +Here, the constructor function defined by cl requires one parameter. This implies that any array declared of this type must be initialized. That is, it precludes this array declaration: + + +cl a[9]; // error, constructor requires initializers + +The reason that this statement isn't valid (as cl is currently defined) is that it implies that cl has a parameterless constructor because no initializers are specified. However, as it stands, cl does not have a parameterless constructor. Because there is no valid constructor that corresponds to this declaration, the compiler will report an error. To solve this problem, you need to overload the constructor function, adding one that takes no parameters. In this way, arrays that are initialized and those that are not are both allowed. + + +class cl { int i; +public: +cl() { i=0; } // called for non-initialized arrays cl(int j) { i=j; } // called for initialized arrays int get_i() { return i; } +}; + +Given this class, both of the following statements are permissible: + +cl a1[3] = {3, 5, 6}; // initialized + +cl a2[34]; // uninitialized + + +Pointers to Objects +Just as you can have pointers to other types of variables, you can have pointers to objects. When accessing members of a class given a pointer to an object, use the arrow +(–>) operator instead of the dot operator. The next program illustrates how to access an object given a pointer to it: + + +#include using namespace std; +332 C + + : T h e C o m p l e t e R e f e r e n c e + + + +class cl { int i; +public: +cl(int j) { i=j; } +int get_i() { return i; } }; + +int main() { +cl ob(88), *p; + +p = &ob; // get address of ob + +cout << p->get_i(); // use -> to call get_i() + +return 0; } + +As you know, when a pointer is incremented, it points to the next element of its type. For example, an integer pointer will point to the next integer. In general, all pointer arithmetic is relative to the base type of the pointer. (That is, it is relative to the type of data that the pointer is declared as pointing to.) The same is true of pointers to objects. For example, this program uses a pointer to access all three elements of array ob after being assigned ob's starting address: + + +#include using namespace std; + +class cl { int i; +public: +cl() { i=0; } cl(int j) { i=j; } +int get_i() { return i; } }; + +int main() { +cl ob[3] = {1, 2, 3}; cl *p; +int i; +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 333 + + + +p = ob; // get start of array for(i=0; i<3; i++) { +cout << p->get_i() << "\n"; p++; // point to next object +} + +return 0; } + +You can assign the address of a public member of an object to a pointer and then access that member by using the pointer. For example, this is a valid C++ program that displays the number 1 on the screen: + + +#include using namespace std; + +class cl { public: +int i; +cl(int j) { i=j; } }; + +int main() { +cl ob(1); int *p; + +p = &ob.i; // get address of ob.i + +cout << *p; // access ob.i via p + +return 0; } + +Because p is pointing to an integer, it is declared as an integer pointer. It is irrelevant that i is a member of ob in this situation. + + +Type Checking C++ Pointers +There is one important thing to understand about pointers in C++: You may assign one pointer to another only if the two pointer types are compatible. For example, given: +334 C + + : T h e C o m p l e t e R e f e r e n c e + + +int *pi; float *pf; + +in C++, the following assignment is illegal: + +pi = pf; // error -- type mismatch + +Of course, you can override any type incompatibilities using a cast, but doing so bypasses C++'s type-checking mechanism. + + +Note + +C++'s stronger type checking where pointers are involved differs from C, in which you may assign any value to any pointer. + + + +The this Pointer +When a member function is called, it is automatically passed an implicit argument that is a pointer to the invoking object (that is, the object on which the function is called). This pointer is called this. To understand this, first consider a program that creates a class called pwr that computes the result of a number raised to some power: + + +#include using namespace std; + +class pwr { double b; int e; double val; +public: +pwr(double base, int exp); double get_pwr() { return val; } +}; + +pwr::pwr(double base, int exp) { +b = base; e = exp; val = 1; +if(exp==0) return; +for( ; exp>0; exp--) val = val * b; } +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 335 + + + +int main() { +pwr x(4.0, 2), y(2.5, 1), z(5.7, 0); + +cout << x.get_pwr() << " "; cout << y.get_pwr() << " "; cout << z.get_pwr() << "\n"; + +return 0; } + +Within a member function, the members of a class can be accessed directly, without any object or class qualification. Thus, inside pwr(), the statement + + +b = base; + +means that the copy of b associated with the invoking object will be assigned the value contained in base. However, the same statement can also be written like this: + + +this->b = base; + +The this pointer points to the object that invoked pwr(). Thus, this –>b refers to that object's copy of b. For example, if pwr() had been invoked by x (as in x(4.0, 2)), then this in the preceding statement would have been pointing to x. Writing the statement without using this is really just shorthand. +Here is the entire pwr() function written using the this pointer: + +pwr::pwr(double base, int exp) { +this->b = base; this->e = exp; this->val = 1; if(exp==0) return; +for( ; exp>0; exp--) +this->val = this->val * this->b; } + +Actually, no C++ programmer would write pwr() as just shown because nothing is gained, and the standard form is easier. However, the this pointer is very important when operators are overloaded and whenever a member function must utilize a pointer to the object that invoked it. +336 C + + : T h e C o m p l e t e R e f e r e n c e + + +Remember that the this pointer is automatically passed to all member functions. Therefore, get_pwr() could also be rewritten as shown here: + + +double get_pwr() { return this->val; } + +In this case, if get_pwr() is invoked like this: + +y.get_pwr(); + +then this will point to object y. +Two final points about this. First, friend functions are not members of a class and, therefore, are not passed a this pointer. Second, static member functions do not have a this pointer. + + +Pointers to Derived Types +In general, a pointer of one type cannot point to an object of a different type. However, there is an important exception to this rule that relates only to derived classes. To begin, assume two classes called B and D. Further, assume that D is derived from the base class B. In this situation, a pointer of type B * may also point to an object of type D. More generally, a base class pointer can also be used as a pointer to an object of any class derived from that base. +Although a base class pointer can be used to point to a derived object, the opposite is not true. A pointer of type D * may not point to an object of type B. Further, although you can use a base pointer to point to a derived object, you can access only the members of the derived type that were imported from the base. That is, you won't be able to access any members added by the derived class. (You can cast a base pointer into a derived pointer and gain full access to the entire derived class, however.) +Here is a short program that illustrates the use of a base pointer to access derived objects. + +#include using namespace std; + +class base { int i; +public: +void set_i(int num) { i=num; } int get_i() { return i; } +}; +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 337 + + + + +class derived: public base { int j; +public: +void set_j(int num) { j=num; } int get_j() { return j; } +}; + +int main() { +base *bp; derived d; + +bp = &d; // base pointer points to derived object + +// access derived object using base pointer bp->set_i(10); +cout << bp->get_i() << " "; + +/* The following won't work. You can't access element of a derived class using a base class pointer. + +bp->set_j(88); // error +cout << bp->get_j(); // error + +*/ +return 0; } + +As you can see, a base pointer is used to access an object of a derived class. +Although you must be careful, it is possible to cast a base pointer into a pointer of the derived type to access a member of the derived class through the base pointer. For example, this is valid C++ code: + + +// access now allowed because of cast ((derived *)bp)->set_j(88); +cout << ((derived *)bp)->get_j(); + +It is important to remember that pointer arithmetic is relative to the base type of the pointer. For this reason, when a base pointer is pointing to a derived object, incrementing the pointer does not cause it to point to the next object of the derived type. Instead, it will point to what it thinks is the next object of the base type. This, of +338 C + + : T h e C o m p l e t e R e f e r e n c e + + +course, usually spells trouble. For example, this program, while syntactically correct, contains this error. + + +// This program contains an error. #include +using namespace std; + +class base { int i; +public: +void set_i(int num) { i=num; } int get_i() { return i; } +}; + +class derived: public base { int j; +public: +void set_j(int num) {j=num;} int get_j() {return j;} +}; + +int main() { +base *bp; derived d[2]; + +bp = d; + +d[0].set_i(1); d[1].set_i(2); + +cout << bp->get_i() << " "; +bp++; // relative to base, not derived +cout << bp->get_i(); // garbage value displayed + +return 0; } + +The use of base pointers to derived types is most useful when creating run-time polymorphism through the mechanism of virtual functions (see Chapter 17). +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 339 + + +Pointers to Class Members +C++ allows you to generate a special type of pointer that "points" generically to a member of a class, not to a specific instance of that member in an object. This sort of pointer is called a pointer to a class member or a pointer-to-member, for short. A pointer to a member is not the same as a normal C++ pointer. Instead, a pointer to a member provides only an offset into an object of the member's class at which that member can be found. Since member pointers are not true pointers, the . and -> cannot be applied to them. To access a member of a class given a pointer to it, you must use the special pointer-to-member operators .* and –>*. Their job is to allow you to access a member of a class given a pointer to that member. +Here is an example: + +#include using namespace std; + +class cl { public: +cl(int i) { val=i; } int val; +int double_val() { return val+val; } }; + +int main() { +int cl::*data; // data member pointer +int (cl::*func)(); // function member pointer cl ob1(1), ob2(2); // create objects + +data = &cl::val; // get offset of val +func = &cl::double_val; // get offset of double_val() + +cout << "Here are values: "; +cout << ob1.*data << " " << ob2.*data << "\n"; + +cout << "Here they are doubled: "; cout << (ob1.*func)() << " "; +cout << (ob2.*func)() << "\n"; + +return 0; } +340 C + + : T h e C o m p l e t e R e f e r e n c e + + +In main(), this program creates two member pointers: data and func. Note carefully the syntax of each declaration. When declaring pointers to members, you must specify the class and use the scope resolution operator. The program also creates objects of cl called ob1 and ob2. As the program illustrates, member pointers may point to either functions or data. Next, the program obtains the addresses of val and double_val(). As stated earlier, these "addresses" are really just offsets into an object of type cl, at which point val and double_val() will be found. Next, to display the values of each object's val, each is accessed through data. Finally, the program uses func to call the double_val() function. The extra parentheses are necessary in order to correctly associate the .* operator. +When you are accessing a member of an object by using an object or a reference (discussed later in this chapter), you must use the .* operator. However, if you are using a pointer to the object, you need to use the –>* operator, as illustrated in this version of the preceding program: + +#include using namespace std; + +class cl { public: +cl(int i) { val=i; } int val; +int double_val() { return val+val; } }; + +int main() { +int cl::*data; // data member pointer +int (cl::*func)(); // function member pointer cl ob1(1), ob2(2); // create objects +cl *p1, *p2; + +p1 = &ob1; // access objects through a pointer p2 = &ob2; + +data = &cl::val; // get offset of val +func = &cl::double_val; // get offset of double_val() + +cout << "Here are values: "; +cout << p1->*data << " " << p2->*data << "\n"; + +cout << "Here they are doubled: "; +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 341 + + + +cout << (p1->*func)() << " "; cout << (p2->*func)() << "\n"; + +return 0; } + +In this version, p1 and p2 are pointers to objects of type cl. Therefore, the –>* operator is used to access val and double_val(). +Remember, pointers to members are different from pointers to specific instances of elements of an object. Consider this fragment (assume that cl is declared as shown in the preceding programs): + +int cl::*d; int *p; +cl o; + +p = &o.val // this is address of a specific val + +d = &cl::val // this is offset of generic val + +Here, p is a pointer to an integer inside a specific object. However, d is simply an offset that indicates where val will be found in any object of type cl. +In general, pointer-to-member operators are applied in special-case situations. They are not typically used in day-to-day programming. + + +References +C++ contains a feature that is related to the pointer called a reference. A reference is essentially an implicit pointer. There are three ways that a reference can be used: as a function parameter, as a function return value, or as a stand-alone reference. Each is examined here. + +Reference Parameters +Probably the most important use for a reference is to allow you to create functions that +automatically use call-by-reference parameter passing. As explained in Chapter 6, arguments can be passed to functions in one of two ways: using call-by-value or call-by-reference. When using call-by-value, a copy of the argument is passed to the function. Call-by-reference passes the address of the argument to the function. By +default, C++ uses call-by-value, but it provides two ways to achieve call-by-reference parameter passing. First, you can explicitly pass a pointer to the argument. Second, you +342 C + + : T h e C o m p l e t e R e f e r e n c e + + +can use a reference parameter. For most circumstances the best way is to use a reference parameter. +To fully understand what a reference parameter is and why it is valuable, we will begin by reviewing how a call-by-reference can be generated using a pointer parameter. The following program manually creates a call-by-reference parameter using a pointer in the function called neg(), which reverses the sign of the integer variable pointed to by its argument. + +// Manually create a call-by-reference using a pointer. #include +using namespace std; + +void neg(int *i); + +int main() { +int x; + +x = 10; +cout << x << " negated is "; + +neg(&x); +cout << x << "\n"; + +return 0; } + +void neg(int *i) { +*i = -*i; } + +In this program, neg() takes as a parameter a pointer to the integer whose sign it will reverse. Therefore, neg() must be explicitly called with the address of x. Further, inside neg() the * operator must be used to access the variable pointed to by i. This is how you generate a "manual" call-by-reference in C++, and it is the only way to obtain a call-by-reference using the C subset. Fortunately, in C++ you can automate this feature by using a reference parameter. +To create a reference parameter, precede the parameter's name with an &. For example, here is how to declare neg() with i declared as a reference parameter: + + +void neg(int &i); +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 343 + + +For all practical purposes, this causes i to become another name for whatever argument neg() is called with. Any operations that are applied to i actually affect the calling argument. In technical terms, i is an implicit pointer that automatically refers to the argument used in the call to neg() . Once i has been made into a reference, it is no longer necessary (or even legal) to apply the * operator. Instead, each time i is used, it is implicitly a reference to the argument and any changes made to i affect the argument. Further, when calling neg(), it is no longer necessary (or legal) to precede the argument's name with the & operator. Instead, the compiler does this automatically. Here is the reference version of the preceding program: + + +// Use a reference parameter. #include +using namespace std; + +void neg(int &i); // i now a reference + +int main() { +int x; + +x = 10; +cout << x << " negated is "; + +neg(x); // no longer need the & operator cout << x << "\n"; + +return 0; } + +void neg(int &i) { +i = -i; // i is now a reference, don't need * } + +To review: When you create a reference parameter, it automatically refers to (implicitly points to) the argument used to call the function. Therefore, in the preceding program, the statement + + +i = -i ; + +actually operates on x, not on a copy of x. There is no need to apply the & operator to an argument. Also, inside the function, the reference parameter is used directly +344 C + + : T h e C o m p l e t e R e f e r e n c e + + +without the need to apply the * operator. In general, when you assign a value to a reference, you are actually assigning that value to the variable that the reference points to. +Inside the function, it is not possible to change what the reference parameter is pointing to. That is, a statement like + + +i++: + +inside neg() increments the value of the variable used in the call. It does not cause i to point to some new location. +Here is another example. This program uses reference parameters to swap the values of the variables it is called with. The swap() function is the classic example of call-by-reference parameter passing. + + +#include using namespace std; + +void swap(int &i, int &j); + +int main() { +int a, b, c, d; + +a = 1; b = 2; c = 3; d = 4; + +cout << "a and b: " << a << " " << b << "\n"; swap(a, b); // no & operator needed +cout << "a and b: " << a << " " << b << "\n"; + +cout << "c and d: " << c << " " << d << "\n"; swap(c, d); +cout << "c and d: " << c << " " << d << "\n"; + +return 0; } + +void swap(int &i, int &j) { +int t; +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 345 + + + +t = i; // no * operator needed i = j; +j = t; } + +This program displays the following: + +a and b: 1 2 a and b: 2 1 c and d: 3 4 c and d: 4 3 + +Passing References to Objects +In Chapter 12 it was explained that when an object is passed as an argument to a +function, a copy of that object is made. When the function terminates, the copy's destructor is called. If for some reason you do not want the destructor function to be called, simply pass the object by reference. (Later in this book you will see examples where this is the case.) When you pass by reference, no copy of the object is made. This means that no object used as a parameter is destroyed when the function terminates, and the parameter's destructor is not called. For example, try this program: + + +#include using namespace std; + +class cl { int id; +public: int i; +cl(int i); ~cl(); +void neg(cl &o) { o.i = -o.i; } // no temporary created }; + +cl::cl(int num) { +cout << "Constructing " << num << "\n"; id = num; +} + +cl::~cl() +346 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +cout << "Destructing " << id << "\n"; } + +int main() { +cl o(1); + +o.i = 10; o.neg(o); + +cout << o.i << "\n"; + +return 0; } + +Here is the output of this program: + +Constructing 1 -10 Destructing 1 + +As you can see, only one call is made to cl's destructor function. Had o been passed by value, a second object would have been created inside neg(), and the destructor would have been called a second time when that object was destroyed at the time neg() terminated. +As the code inside neg() illustrates, when you access a member of a class through a reference, you use the dot operator. The arrow operator is reserved for use with pointers only. +When passing parameters by reference, remember that changes to the object inside the function affect the calling object. +One other point: Passing all but the smallest objects by reference is faster than passing them by value. Arguments are usually passed on the stack. Thus, large objects take a considerable number of CPU cycles to push onto and pop from the stack. + +Returning References +A function may return a reference. This has the rather startling effect of allowing a function to be used on the left side of an assignment statement! For example, consider this simple program: +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 347 + + +#include using namespace std; + +char &replace(int i); // return a reference + +char s[80] = "Hello There"; + +int main() { + +replace(5) = 'X'; // assign X to space after Hello + +cout << s; + +return 0; } + +char &replace(int i) { +return s[i]; } + +This program replaces the space between Hello and There with an X. That is, the program displays HelloXthere. Take a look at how this is accomplished. First, replace() is declared as returning a reference to a character. As replace() is coded, it returns a reference to the element of s that is specified by its argument i. The reference returned by replace() is then used in main() to assign to that element the character X. +One thing to beware of when returning references is that the object being referred to does not go out of scope after the function terminates. + +Independent References +By far the most common uses for references are to pass an argument using +call-by-reference and to act as a return value from a function. However, you can declare a reference that is simply a variable. This type of reference is called an independent reference. +When you create an independent reference, all you are creating is another name for an object variable. All independent references must be initialized when they are created. The reason for this is easy to understand. Aside from initialization, you cannot change what object a reference variable points to. Therefore, it must be initialized when it is declared. (In C++, initialization is a wholly separate operation from assignment.) +The following program illustrates an independent reference: +348 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include using namespace std; + +int main() { +int a; +int &ref = a; // independent reference + +a = 10; +cout << a << " " << ref << "\n"; + +ref = 100; +cout << a << " " << ref << "\n"; + +int b = 19; +ref = b; // this puts b's value into a cout << a << " " << ref << "\n"; + +ref--; // this decrements a +// it does not affect what ref refers to + +cout << a << " " << ref << "\n"; + +return 0; } + +The program displays this output: + +10 10 100 100 19 19 18 18 + +Actually, independent references are of little real value because each one is, literally, just another name for another variable. Having two names to describe the same object is likely to confuse, not organize, your program. + +References to Derived Types +Similar to the situation as described for pointers earlier, a base class reference can be used to refer to an object of a derived class. The most common application of this is found in function parameters. A base class reference parameter can receive objects of the base class as well as any other type derived from that base. +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 349 + + +Restrictions to References +There are a number of restrictions that apply to references. You cannot reference +another reference. Put differently, you cannot obtain the address of a reference. You cannot create arrays of references. You cannot create a pointer to a reference. You cannot reference a bit-field. +A reference variable must be initialized when it is declared unless it is a member of a class, a function parameter, or a return value. Null references are prohibited. + + +A Matter of Style +When declaring pointer and reference variables, some C++ programmers use a unique coding style that associates the * or the & with the type name and not the variable. For example, here are two functionally equivalent declarations: + +int& p; // & associated with type +int &p; // & associated with variable + +Associating the * or & with the type name reflects the desire of some programmers for C++ to contain a separate pointer type. However, the trouble with associating the & or * with the type name rather than the variable is that, according to the formal C++ syntax, neither the & nor the * is distributive over a list of variables. Thus, misleading declarations are easily created. For example, the following declaration creates one, not two, integer pointers. + +int* a, b; + +Here, b is declared as an integer (not an integer pointer) because, as specified by the C++ syntax, when used in a declaration, the * (or &) is linked to the individual variable that it precedes, not to the type that it follows. The trouble with this declaration is that the visual message suggests that both a and b are pointer types, even though, in fact, only a is a pointer. This visual confusion not only misleads novice C++ programmers, but occasionally old pros, too. +It is important to understand that, as far as the C++ compiler is concerned, it doesn't matter whether you write int *p or int* p. Thus, if you prefer to associate the * or & with the type rather than the variable, feel free to do so. However, to avoid confusion, this book will continue to associate the * and the & with the variables that they modify rather than their types. + + +C++'s Dynamic Allocation Operators +C++ provides two dynamic allocation operators: new and delete. These operators are used to allocate and free memory at run time. Dynamic allocation is an important part +350 C + + : T h e C o m p l e t e R e f e r e n c e + + +of almost all real-world programs. As explained in Part One, C++ also supports dynamic memory allocation functions, called malloc() and free(). These are included for the sake of compatibility with C. However, for C++ code, you should use the new and delete operators because they have several advantages. +The new operator allocates memory and returns a pointer to the start of it. The delete operator frees memory previously allocated using new. The general forms of new and delete are shown here: + +p_var = new type; delete p_var; + +Here, p_var is a pointer variable that receives a pointer to memory that is large enough to hold an item of type type. +Since the heap is finite, it can become exhausted. If there is insufficient available memory to fill an allocation request, then new will fail and a bad_alloc exception will be generated. This exception is defined in the header . Your program should handle this exception and take appropriate action if a failure occurs. (Exception handling is described in Chapter 19.) If this exception is not handled by your program, then your program will be terminated. +The actions of new on failure as just described are specified by Standard C++. The trouble is that not all compilers, especially older ones, will have implemented new in compliance with Standard C++. When C++ was first invented, new returned null on failure. Later, this was changed such that new caused an exception on failure. Finally, it was decided that a new failure will generate an exception by default, but that a null pointer could be returned instead, as an option. Thus, new has been implemented differently, at different times, by compiler manufacturers. Although all compilers will eventually implement new in compliance with Standard C++, currently the only way to know the precise action of new on failure is to check your compiler's documentation. +Since Standard C++ specifies that new generates an exception on failure, this is the way the code in this book is written. If your compiler handles an allocation failure differently, you will need to make the appropriate changes. +Here is a program that allocates memory to hold an integer: + + +#include #include +using namespace std; + +int main() { +int *p; + +try { +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 351 + + + +p = new int; // allocate space for an int } catch (bad_alloc xa) { +cout << "Allocation Failure\n"; return 1; +} + +*p = 100; + +cout << "At " << p << " "; +cout << "is the value " << *p << "\n"; + +delete p; + +return 0; } + +This program assigns to p an address in the heap that is large enough to hold an integer. It then assigns that memory the value 100 and displays the contents of the memory on the screen. Finally, it frees the dynamically allocated memory. Remember, if your compiler implements new such that it returns null on failure, you must change the preceding program appropriately. +The delete operator must be used only with a valid pointer previously allocated by using new. Using any other type of pointer with delete is undefined and will almost certainly cause serious problems, such as a system crash. +Although new and delete perform functions similar to malloc() and free(), they have several advantages. First, new automatically allocates enough memory to hold an object of the specified type. You do not need to use the sizeof operator. Because the size is computed automatically, it eliminates any possibility for error in this regard. Second, new automatically returns a pointer of the specified type. You don't need to use an explicit type cast as you do when allocating memory by using malloc(). Finally, both new and delete can be overloaded, allowing you to create customized allocation systems. +Although there is no formal rule that states this, it is best not to mix new and delete with malloc() and free() in the same program. There is no guarantee that they are mutually compatible. + +Initializing Allocated Memory +You can initialize allocated memory to some known value by putting an initializer after the type name in the new statement. Here is the general form of new when an initialization is included: + +p_var = new var_type (initializer); +352 C + + : T h e C o m p l e t e R e f e r e n c e + + +Of course, the type of the initializer must be compatible with the type of data for which memory is being allocated. +This program gives the allocated integer an initial value of 87: + + +#include #include +using namespace std; + +int main() { +int *p; + +try { +p = new int (87); // initialize to 87 } catch (bad_alloc xa) { +cout << "Allocation Failure\n"; return 1; +} + +cout << "At " << p << " "; +cout << "is the value " << *p << "\n"; + +delete p; + +return 0; } + +Allocating Arrays +You can allocate arrays using new by using this general form: + +p_var = new array_type [size]; + +Here, size specifies the number of elements in the array. To free an array, use this form of delete: + +delete [ ] p_var; + +Here, the [ ] informs delete that an array is being released. +For example, the next program allocates a 10-element integer array. +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 353 + + +#include #include +using namespace std; + +int main() { +int *p, i; + +try { +p = new int [10]; // allocate 10 integer array } catch (bad_alloc xa) { +cout << "Allocation Failure\n"; return 1; +} + +for(i=0; i<10; i++ ) p[i] = i; + +for(i=0; i<10; i++) cout << p[i] << " "; + +delete [] p; // release the array + +return 0; } + +Notice the delete statement. As just mentioned, when an array allocated by new is released, delete must be made aware that an array is being freed by using the [ ]. (As you will see in the next section, this is especially important when you are allocating arrays of objects.) +One restriction applies to allocating arrays: They may not be given initial values. That is, you may not specify an initializer when allocating arrays. + +Allocating Objects +You can allocate objects dynamically by using new. When you do this, an object is +created and a pointer is returned to it. The dynamically created object acts just like any other object. When it is created, its constructor function (if it has one) is called. When the object is freed, its destructor function is executed. +Here is a short program that creates a class called balance that links a person's name with his or her account balance. Inside main() , an object of type balance is created dynamically. +354 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include #include #include using namespace std; + +class balance { double cur_bal; char name[80]; +public: +void set(double n, char *s) { cur_bal = n; +strcpy(name, s); } + +void get_bal(double &n, char *s) { n = cur_bal; +strcpy(s, name); } +}; + +int main() { +balance *p; char s[80]; double n; + +try { +p = new balance; +} catch (bad_alloc xa) { +cout << "Allocation Failure\n"; return 1; +} + +p->set(12387.87, "Ralph Wilson"); + +p->get_bal(n, s); + +cout << s << "'s balance is: " << n; cout << "\n"; + +delete p; +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 355 + + + +return 0; } + +Because p contains a pointer to an object, the arrow operator is used to access members of the object. +As stated, dynamically allocated objects may have constructors and destructors. Also, the constructor functions can be parameterized. Examine this version of the previous program: + +#include #include #include using namespace std; + +class balance { double cur_bal; char name[80]; +public: +balance(double n, char *s) { cur_bal = n; +strcpy(name, s); } +~balance() { +cout << "Destructing "; cout << name << "\n"; +} +void get_bal(double &n, char *s) { n = cur_bal; +strcpy(s, name); } +}; + +int main() { +balance *p; char s[80]; double n; + +// this version uses an initializer try { +p = new balance (12387.87, "Ralph Wilson"); +356 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} catch (bad_alloc xa) { +cout << "Allocation Failure\n"; return 1; +} + +p->get_bal(n, s); + +cout << s << "'s balance is: " << n; cout << "\n"; + +delete p; + +return 0; } + +The parameters to the object's constructor function are specified after the type name, just as in other sorts of initializations. +You can allocate arrays of objects, but there is one catch. Since no array allocated by new can have an initializer, you must make sure that if the class contains constructor functions, one will be parameterless. If you don't, the C++ compiler will not find a matching constructor when you attempt to allocate the array and will not compile your program. +In this version of the preceding program, an array of balance objects is allocated, and the parameterless constructor is called. + + +#include #include #include using namespace std; + +class balance { double cur_bal; char name[80]; +public: +balance(double n, char *s) { cur_bal = n; +strcpy(name, s); } +balance() {} // parameterless constructor ~balance() { +cout << "Destructing "; +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 357 + + + +cout << name << "\n"; } +void set(double n, char *s) { cur_bal = n; +strcpy(name, s); } +void get_bal(double &n, char *s) { n = cur_bal; +strcpy(s, name); } +}; + +int main() { +balance *p; char s[80]; double n; int i; + +try { +p = new balance [3]; // allocate entire array } catch (bad_alloc xa) { +cout << "Allocation Failure\n"; return 1; +} + +// note use of dot, not arrow operators p[0].set(12387.87, "Ralph Wilson"); p[1].set(144.00, "A. C. Conners"); p[2].set(-11.23, "I. M. Overdrawn"); + +for(i=0; i<3; i++) { p[i].get_bal(n, s); + +cout << s << "'s balance is: " << n; cout << "\n"; +} + +delete [] p; return 0; +} +358 C + + : T h e C o m p l e t e R e f e r e n c e + + +The output from this program is shown here. + +Ralph Wilson's balance is: 12387.9 A. C. Conners's balance is: 144 +I. M. Overdrawn's balance is: -11.23 Destructing I. M. Overdrawn Destructing A. C. Conners Destructing Ralph Wilson + +One reason that you need to use the delete [ ] form when deleting an array of dynamically allocated objects is so that the destructor function can be called for each object in the array. + +The nothrow Alternative +In Standard C++ it is possible to have new return null instead of throwing an exception when an allocation failure occurs. This form of new is most useful when you are compiling older code with a modern C++ compiler. It is also valuable when you are replacing calls to malloc() with new. (This is common when updating C code to C++.) This form of new is shown here: + +p_var = new(nothrow) type; + +Here, p_var is a pointer variable of type. The nothrow form of new works like the original version of new from years ago. Since it returns null on failure, it can be "dropped into" older code without having to add exception handling. However, for new code, exceptions provide a better alternative. To use the nothrow option, you must include the header . +The following program shows how to use the new(nothrow) alternative. + + +// Demonstrate nothrow version of new. #include +#include +using namespace std; + +int main() { +int *p, i; + +p = new(nothrow) int[32]; // use nothrow option if(!p) { +cout << "Allocation failure.\n"; +C h a p t e r 1 3 : A r r a y s , P o i n t e r s , R e f e r e n c e s , a n d t h e D y n a m i c A l l o c a t i o n O p e r a t o r s 359 + + + +return 1; } + +for(i=0; i<32; i++) p[i] = i; + +for(i=0; i<32; i++) cout << p[i] << " "; + +delete [] p; // free the memory + +return 0; } + +As this program demonstrates, when using the nothrow approach, you must check the pointer returned by new after each allocation request. + +The Placement Forms of new and delete +There is a special form of new, called the placement form, that can be used to specify an +alternative method of allocating memory. It is primarily useful when overloading the new operator for special circumstances. There is a default implementation of the placement new operator, which has this general form: + +p_var = new (location) type; + +Here, location specifies an address that is simply returned by new. +There is also a placement form of delete, which is used to free memory allocated by the placement form of new. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 14 Function Overloading, Copy Constructors, and Default +Arguments + + + + + + + + +361 +362 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter examines function overloading, copy constructors, and default arguments. Function overloading is one of the defining aspects of the C++ programming language. Not only does it provide support for compile-time +T +polymorphism, it also adds flexibility and convenience. Some of the most commonly overloaded functions are constructors. Perhaps the most important form of an overloaded constructor is the copy constructor. Closely related to function overloading are default arguments. Default arguments can sometimes provide an alternative to function overloading. + + +Function Overloading +Function overloading is the process of using the same name for two or more functions. The secret to overloading is that each redefinition of the function must use either different types of parameters or a different number of parameters. It is only through these differences that the compiler knows which function to call in any +given situation. For example, this program overloads myfunc() by using different types of parameters. + +#include using namespace std; + +int myfunc(int i); // these differ in types of parameters double myfunc(double i); + +int main() { + +cout << myfunc(10) << " "; // calls myfunc(int i) cout << myfunc(5.4); // calls myfunc(double i) + +return 0; } + +double myfunc(double i) { +return i; } + +int myfunc(int i) { +return i; } +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 363 + + +The next program overloads myfunc() using a different number of parameters: + +#include using namespace std; + +int myfunc(int i); // these differ in number of parameters int myfunc(int i, int j); + +int main() { +cout << myfunc(10) << " "; // calls myfunc(int i) cout << myfunc(4, 5); // calls myfunc(int i, int j) + +return 0; } + +int myfunc(int i) { +return i; } + +int myfunc(int i, int j) { +return i*j; } + +As mentioned, the key point about function overloading is that the functions must differ in regard to the types and/or number of parameters. Two functions differing only in their return types cannot be overloaded. For example, this is an invalid attempt to overload myfunc(): + + +int myfunc(int i); // Error: differing return types are float myfunc(int i); // insufficient when overloading. + +Sometimes, two function declarations will appear to differ, when in fact they do not. For example, consider the following declarations. + + +void f(int *p); +void f(int p[]); // error, *p is same as p[] + +Remember, to the compiler *p is the same as p[ ]. Therefore, although the two prototypes appear to differ in the types of their parameter, in actuality they do not. +364 C + + : T h e C o m p l e t e R e f e r e n c e + + +Overloading Constructor Functions +Constructor functions can be overloaded; in fact, overloaded constructors are very common. There are three main reasons why you will want to overload a constructor function: to gain flexibility, to allow both initialized and uninitialized objects to be created, and to define copy constructors. In this section, the first two of these are examined. The following section describes the copy constructor. + +Overloading a Constructor to Gain Flexibility +Many times you will create a class for which there are two or more possible ways to construct an object. In these cases, you will want to provide an overloaded constructor function for each way. This is a self-enforcing rule because if you attempt to create an object for which there is no matching constructor, a compile-time error results. +By providing a constructor for each way that a user of your class may plausibly want to construct an object, you increase the flexibility of your class. The user is free to choose the best way to construct an object given the specific circumstance. Consider this program that creates a class called date, which holds a calendar date. Notice that the constructor is overloaded two ways: + +#include #include using namespace std; + +class date { +int day, month, year; public: +date(char *d); +date(int m, int d, int y); void show_date(); +}; + +// Initialize using string. date::date(char *d) +{ +sscanf(d, "%d%*c%d%*c%d", &month, &day, &year); } + +// Initialize using integers. date::date(int m, int d, int y) { +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 365 + + + + +day = d; month = m; year = y; +} + +void date::show_date() { +cout << month << "/" << day; cout << "/" << year << "\n"; +} + +int main() { +date ob1(12, 4, 2001), ob2("10/22/2001"); + +ob1.show_date(); ob2.show_date(); + +return 0; } + +In this program, you can initialize an object of type date, either by specifying the date using three integers to represent the month, day, and year, or by using a string that contains the date in this general form: + +mm/dd/yyyy + +Since both are common ways to represent a date, it makes sense that date allow both when constructing an object. +As the date class illustrates, perhaps the most common reason to overload a constructor is to allow an object to be created by using the most appropriate and natural means for each particular circumstance. For example, in the following main() , the user is prompted for the date, which is input to array s. This string can then be used directly to create d. There is no need for it to be converted to any other form. However, if date() were not overloaded to accept the string form, you would have to manually convert it into three integers. + + +int main() { +char s[80]; +366 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +cout << "Enter new date: "; cin >> s; + +date d(s); d.show_date(); + +return 0; } + +In another situation, initializing an object of type date by using three integers may be more convenient. For example, if the date is generated by some sort of computational method, then creating a date object using date(int, int, int) is the most natural and appropriate constructor to employ. The point here is that by overloading date's constructor, you have made it more flexible and easier to use. This increased flexibility and ease of use are especially important if you are creating class libraries that will be used by other programmers. + +Allowing Both Initialized and Uninitialized Objects Another common reason constructor functions are overloaded is to allow both +initialized and uninitialized objects (or, more precisely, default initialized objects) to be created. This is especially important if you want to be able to create dynamic arrays of objects of some class, since it is not possible to initialize a dynamically allocated array. To allow uninitialized arrays of objects along with initialized objects, you must include a constructor that supports initialization and one that does not. +For example, the following program declares two arrays of type powers; one is initialized and the other is not. It also dynamically allocates an array. + +#include #include +using namespace std; + +class powers { int x; +public: +// overload constructor two ways powers() { x = 0; } // no initializer powers(int n) { x = n; } // initializer + +int getx() { return x; } +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 367 + + + +void setx(int i) { x = i; } }; + +int main() { +powers ofTwo[] = {1, 2, 4, 8, 16}; // initialized powers ofThree[5]; // uninitialized +powers *p; int i; + +// show powers of two +cout << "Powers of two: "; for(i=0; i<5; i++) { +cout << ofTwo[i].getx() << " "; } +cout << "\n\n"; + +// set powers of three ofThree[0].setx(1); ofThree[1].setx(3); ofThree[2].setx(9); ofThree[3].setx(27); ofThree[4].setx(81); + +// show powers of three +cout << "Powers of three: "; for(i=0; i<5; i++) { +cout << ofThree[i].getx() << " "; } +cout << "\n\n"; + +// dynamically allocate an array try { +p = new powers[5]; // no initialization } catch (bad_alloc xa) { +cout << "Allocation Failure\n"; return 1; +} + +// initialize dynamic array with powers of two for(i=0; i<5; i++) { +p[i].setx(ofTwo[i].getx()); +368 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +} + +// show powers of two +cout << "Powers of two: "; for(i=0; i<5; i++) { +cout << p[i].getx() << " "; } +cout << "\n\n"; + +delete [] p; return 0; +} + + +In this example, both constructors are necessary. The default constructor is used to construct the uninitialized ofThree array and the dynamically allocated array. The parameterized constructor is called to create the objects for the ofTwo array. + + +Copy Constructors +One of the more important forms of an overloaded constructor is the copy constructor. Defining a copy constructor can help you prevent problems that might occur when one object is used to initialize another. +Let's begin by restating the problem that the copy constructor is designed to solve. By default, when one object is used to initialize another, C++ performs a bitwise copy. That is, an identical copy of the initializing object is created in the target object. Although this is perfectly adequate for many cases—and generally exactly what you want to happen—there are situations in which a bitwise copy should not be used. One of the most common is when an object allocates memory when it is created. For example, assume a class called MyClass that allocates memory for each object when it is created, and an object A of that class. This means that A has already allocated its memory. Further, assume that A is used to initialize B, as shown here: + +MyClass B= A; + +If a bitwise copy is performed, then B will be an exact copy of A. This means that B will be using the same piece of allocated memory that A is using, instead of allocating its own. Clearly, this is not the desired outcome. For example, if MyClass includes a destructor that frees the memory, then the same piece of memory will be freed twice when A and B are destroyed! +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 369 + + +The same type of problem can occur in two additional ways: first, when a copy of an object is made when it is passed as an argument to a function; second, when a temporary object is created as a return value from a function. Remember, temporary objects are automatically created to hold the return value of a function and they may also be created in certain other circumstances. +To solve the type of problem just described, C++ allows you to create a copy constructor, which the compiler uses when one object initializes another. When a copy constructor exists, the default, bitwise copy is bypassed. The most common general form of a copy constructor is + +classname (const classname &o) { // body of constructor +} + +Here, o is a reference to the object on the right side of the initialization. It is permissible for a copy constructor to have additional parameters as long as they have default arguments defined for them. However, in all cases the first parameter must be a reference to the object doing the initializing. +It is important to understand that C++ defines two distinct types of situations in which the value of one object is given to another. The first is assignment. The second is initialization, which can occur any of three ways: + + When one object explicitly initializes another, such as in a declaration When a copy of an object is made to be passed to a function + When a temporary object is generated (most commonly, as a return value) + +The copy constructor applies only to initializations. For example, assuming a class called myclass, and that y is an object of type myclass, each of the following statements involves initialization. + + +myclass x = y; // y explicitly initializing x + +func(y); +y = func(); + +// y passed as a parameter +// y receiving a temporary, return object + + +Following is an example where an explicit copy constructor function is needed. This program creates a very limited "safe" integer array type that prevents array boundaries from being overrun. (Chapter 15 shows a better way to create a safe array that uses overloaded operators.) Storage for each array is allocated by the use of new, and a pointer to the memory is maintained within each array object. +370 C + + : T h e C o m p l e t e R e f e r e n c e + + +/* This program creates a "safe" array class. Since space for the array is allocated using new, a copy constructor is provided to allocate memory when one array object is used to initialize another. +*/ +#include #include #include using namespace std; + +class array { int *p; int size; +public: +array(int sz) { try { +p = new int[sz]; +} catch (bad_alloc xa) { +cout << "Allocation Failure\n"; exit(EXIT_FAILURE); +} +size = sz; } +~array() { delete [] p; } + +// copy constructor array(const array &a); + +void put(int i, int j) { if(i>=0 && i=0; i--) cout << num.get(i); cout << "\n"; + +// create another array and initialize with num array x(num); // invokes copy constructor for(i=0; i<10; i++) cout << x.get(i); + +return 0; } + +Let's look closely at what happens when num is used to initialize x in the statement + +array x(num); // invokes copy constructor + +The copy constructor is called, memory for the new array is allocated and stored in x.p, and the contents of num are copied to x's array. In this way, x and num have arrays that contain the same values, but each array is separate and distinct. (That is, num.p and x.p do not point to the same piece of memory.) If the copy constructor had not been created, the default bitwise initialization would have resulted in x and num sharing the same memory for their arrays. (That is, num.p and x.p would have indeed pointed to the same location.) +Remember that the copy constructor is called only for initializations. For example, this sequence does not call the copy constructor defined in the preceding program: + + +array a(10); // ... +array b(10); + +b = a; // does not call copy constructor +372 C + + : T h e C o m p l e t e R e f e r e n c e + + +In this case, b = a performs the assignment operation. If = is not overloaded (as it is not here), a bitwise copy will be made. Therefore, in some cases, you may need to overload the = operator as well as create a copy constructor to avoid certain types of problems (see Chapter 15). + + +Finding the Address of an Overloaded Function As explained in Chapter 5, you can obtain the address of a function. One reason to do so is to assign the address of the function to a pointer and then call that function through that pointer. If the function is not overloaded, this process is straightforward. However, for overloaded functions, the process requires a little more subtlety. To understand why, first consider this statement, which assigns the address of some function called myfunc() to a pointer called p: + +p = myfunc; + +If myfunc() is not overloaded, there is one and only one function called myfunc(), and the compiler has no difficulty assigning its address to p. However, if myfunc() is overloaded, how does the compiler know which version's address to assign to p? The answer is that it depends upon how p is declared. For example, consider this program: + + +#include using namespace std; + +int myfunc(int a); +int myfunc(int a, int b); + +int main() { +int (*fp)(int a); // pointer to int f(int) + +fp = myfunc; // points to myfunc(int) + +cout << fp(5); + +return 0; } + +int myfunc(int a) { +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 373 + + + +return a; } + +int myfunc(int a, int b) { +return a*b; } + +Here, there are two versions of myfunc() . Both return int, but one takes a single integer argument; the other requires two integer arguments. In the program, fp is declared as a pointer to a function that returns an integer and that takes one integer argument. When fp is assigned the address of myfunc() , C++ uses this information to select the myfunc(int a) version of myfunc(). Had fp been declared like this: + + +int (*fp)(int a, int b); + +then fp would have been assigned the address of the myfunc(int a, int b) version of myfunc(). +In general, when you assign the address of an overloaded function to a function pointer, it is the declaration of the pointer that determines which function's address is obtained. Further, the declaration of the function pointer must exactly match one and only one of the overloaded function's declarations. + + + +The overload Anachronism +When C++ was created, the keyword overload was required to create an overloaded function. It is obsolete and no longer used or supported. Indeed, it is not even a reserved word in Standard C++. However, because you might encounter older programs, and for its historical interest, it is a good idea to know how overload was used. Here is its general form: + +overload func-name; + +Here, func-name is the name of the function that you will be overloading. This statement must precede the overloaded declarations. For example, this tells an old-style compiler that you will be overloading a function called test(): + + +overload test; +374 C + + : T h e C o m p l e t e R e f e r e n c e + + +Default Function Arguments +C++ allows a function to assign a parameter a default value when no argument corresponding to that parameter is specified in a call to that function. The default value is specified in a manner syntactically similar to a variable initialization. For example, this declares myfunc() as taking one double argument with a default value of 0.0: + + +void myfunc(double d = 0.0) { +// ... } + +Now, myfunc() can be called one of two ways, as the following examples show: + +myfunc(198.234); // pass an explicit value myfunc(); // let function use default + +The first call passes the value 198.234 to d. The second call automatically gives d the default value zero. +One reason that default arguments are included in C++ is because they provide another method for the programmer to manage greater complexity. To handle the widest variety of situations, quite frequently a function contains more parameters than are required for its most common usage. Thus, when the default arguments apply, you need specify only the arguments that are meaningful to the exact situation, not all those needed by the most general case. For example, many of the C++ I/O functions make use of default arguments for just this reason. +A simple illustration of how useful a default function argument can be is shown by the clrscr() function in the following program. The clrscr() function clears the screen by outputting a series of linefeeds (not the most efficient way, but sufficient for this example). Because a very common video mode displays 25 lines of text, the default argument of 25 is provided. However, because some terminals can display more or less than 25 lines (often depending upon what type of video mode is used), you can override the default argument by specifying one explicitly. + + +#include using namespace std; + +void clrscr(int size=25); + +int main() { +register int i; +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 375 + + + + +for(i=0; i<30; i++ ) cout << i << endl; cin.get(); +clrscr(); // clears 25 lines + +for(i=0; i<30; i++ ) cout << i << endl; cin.get(); +clrscr(10); // clears 10 lines + +return 0; } + +void clrscr(int size) { +for(; size; size--) cout << endl; } + +As this program illustrates, when the default value is appropriate to the situation, no argument need be specified when clrscr() is called. However, it is still possible to override the default and give size a different value when needed. +A default argument can also be used as a flag telling the function to reuse a previous argument. To illustrate this usage, a function called iputs() is developed here that automatically indents a string by a specified amount. To begin, here is a version of this function that does not use a default argument: + +void iputs(char *str, int indent) { +if(indent < 0) indent = 0; + +for( ; indent; indent--) cout << " "; + +cout << str << "\n"; } + +This version of iputs() is called with the string to output as the first argument and the amount to indent as the second. Although there is nothing wrong with writing iputs() this way, you can improve its usability by providing a default argument for the indent parameter that tells iputs() to indent to the previously specified level. It is quite common to display a block of text with each line indented the same amount. In this situation, instead of having to supply the same indent argument over and over, you can give +376 C + + : T h e C o m p l e t e R e f e r e n c e + + +indent a default value that tells iputs() to indent to the level of the previous call. This approach is illustrated in the following program: + + +#include using namespace std; + +/* Default indent to -1. This value tells the function to reuse the previous value. */ +void iputs(char *str, int indent = -1); + +int main() { +iputs("Hello there", 10); +iputs("This will be indented 10 spaces by default"); iputs("This will be indented 5 spaces", 5); iputs("This is not indented", 0); + +return 0; } + +void iputs(char *str, int indent) { +static i = 0; // holds previous indent value + +if(indent >= 0) i = indent; +else // reuse old indent value indent = i; + +for( ; indent; indent--) cout << " "; + +cout << str << "\n"; } + +This program displays this output: + +Hello there +This will be indented 10 spaces by default This will be indented 5 spaces +This is not indented +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 377 + + +When you are creating functions that have default arguments, it is important to remember that the default values must be specified only once, and this must be the first time the function is declared within the file. In the preceding example, the default argument was specified in iputs() 's prototype. If you try to specify new (or even the same) default values in iputs() 's definition, the compiler will display an error and not compile your program. Even though default arguments for the same function cannot be redefined, you can specify different default arguments for each version of an overloaded function. +All parameters that take default values must appear to the right of those that do not. For example, it is incorrect to define iputs() like this: + +// wrong! +void iputs(int indent = -1, char *str); + +Once you begin to define parameters that take default values, you cannot specify a nondefaulting parameter. That is, a declaration like this is also wrong and will not compile: + + +int myfunc(float f, char *str, int i=10, int j); + +Because i has been given a default value, j must be given one too. +You can also use default parameters in an object's constructor function. For example, the cube class shown here maintains the integer dimensions of a cube. Its constructor function defaults all dimensions to zero if no other arguments are supplied, as shown here: + + +#include using namespace std; + +class cube { int x, y, z; +public: +cube(int i=0, int j=0, int k=0) { x=i; +y=j; z=k; +} + +int volume() { return x*y*z; +} +378 C + + : T h e C o m p l e t e R e f e r e n c e + + + +}; + +int main() { +cube a(2,3,4), b; + +cout << a.volume() << endl; cout << b.volume(); + +return 0; } + +There are two advantages to including default arguments, when appropriate, in a constructor function. First, they prevent you from having to provide an overloaded constructor that takes no parameters. For example, if the parameters to cube() were not given defaults, the second constructor shown here would be needed to handle the declaration of b (which specified no arguments). + + +cube() {x=0; y=0; z=0} + +Second, defaulting common initial values is more convenient than specifying them each time an object is declared. + +Default Arguments vs. Overloading +In some situations, default arguments can be used as a shorthand form of function +overloading. The cube class's constructor just shown is one example. Let's look at another. Imagine that you want to create two customized versions of the standard strcat() function. The first version will operate like strcat() and concatenate the entire contents of one string to the end of another. The second version takes a third argument that specifies the number of characters to concatenate. That is, the second version will only concatenate a specified number of characters from one string to the end of another. Thus, assuming that you call your customized functions mystrcat() , they will have the following prototypes: + + +void mystrcat(char *s1, char *s2, int len); void mystrcat(char *s1, char *s2); + +The first version would copy len characters from s2 to the end of s1. The second version would copy the entire string pointed to by s2 onto the end of the string pointed to by s1 and would operate like strcat() . +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 379 + + +While it would not be wrong to implement two versions of mystrcat() to create the two versions that you desire, there is an easier way. Using a default argument, you can create only one version of mystrcat() that performs both functions. The following program demonstrates this. + + +// A customized version of strcat(). #include +#include using namespace std; + +void mystrcat(char *s1, char *s2, int len = -1); + +int main() { +char str1[80] = "This is a test"; char str2[80] = "0123456789"; + +mystrcat(str1, str2, 5); // concatenate 5 chars cout << str1 << '\n'; + +strcpy(str1, "This is a test"); // reset str1 + +mystrcat(str1, str2); // concatenate entire string cout << str1 << '\n'; + +return 0; } + +// A custom version of strcat(). +void mystrcat(char *s1, char *s2, int len) { +// find end of s1 while(*s1) s1++; + +if(len == -1) len = strlen(s2); + +while(*s2 && len) { +*s1 = *s2; // copy chars s1++; +s2++; len--; +} +380 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +*s1 = '\0'; // null terminate s1 } + +Here, mystrcat() concatenates up to len characters from the string pointed to by s2 onto the end of the string pointed to by s1. However, if len is –1, as it will be when it is allowed to default, mystrcat() concatenates the entire string pointed to by s2 onto s1. (Thus, when len is –1, the function operates like the standard strcat() function.) By using a default argument for len, it is possible to combine both operations into one function. In this way, default arguments sometimes provide an alternative to function overloading. + +Using Default Arguments Correctly +Although default arguments can be a very powerful tool when used correctly, they can +also be misused. The point of default arguments is to allow a function to perform its job in an efficient, easy-to-use manner while still allowing considerable flexibility. Toward this end, all default arguments should reflect the way a function is generally used, or a reasonable alternate usage. When there is no single value that is normally associated with a parameter, there is no reason to declare a default argument. In fact, declaring default arguments when there is insufficient basis for doing so destructures your code, because they are liable to mislead and confuse anyone reading your program. +One other important guideline you should follow when using default arguments is this: No default argument should cause a harmful or destructive action. That is, the accidental use of a default argument should not cause a catastrophe. + + +Function Overloading and Ambiguity +You can create a situation in which the compiler is unable to choose between two (or more) overloaded functions. When this happens, the situation is said to be ambiguous. Ambiguous statements are errors, and programs containing ambiguity will not compile. +By far the main cause of ambiguity involves C++'s automatic type conversions. As you know, C++ automatically attempts to convert the arguments used to call a function into the type of arguments expected by the function. For example, consider this fragment: + +int myfunc(double d); // ... +cout << myfunc('c'); // not an error, conversion applied +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 381 + + +As the comment indicates, this is not an error because C++ automatically converts the character c into its double equivalent. In C++, very few type conversions of this sort are actually disallowed. Although automatic type conversions are convenient, they are also a prime cause of ambiguity. For example, consider the following program: + + +#include using namespace std; + +float myfunc(float i); double myfunc(double i); + +int main() { +cout << myfunc(10.1) << " "; // unambiguous, calls myfunc(double) cout << myfunc(10); // ambiguous + +return 0; } + +float myfunc(float i) { +return i; } + +double myfunc(double i) { +return -i; } + +Here, myfunc() is overloaded so that it can take arguments of either type float or type double. In the unambiguous line, myfunc(double) is called because, unless explicitly specified as float, all floating-point constants in C++ are automatically of type double. Hence, that call is unambiguous. However, when myfunc() is called by using the integer 10, ambiguity is introduced because the compiler has no way of knowing whether it should be converted to a float or to a double. This causes an error message to be displayed, and the program will not compile. +As the preceding example illustrates, it is not the overloading of myfunc() relative to double and float that causes the ambiguity. Rather, it is the specific call to myfunc() using an indeterminate type of argument that causes the confusion. Put differently, the error is not caused by the overloading of myfunc() , but by the specific invocation. +382 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here is another example of ambiguity caused by C++'s automatic type conversions: + +#include using namespace std; + +char myfunc(unsigned char ch); char myfunc(char ch); + +int main() { +cout << myfunc('c'); // this calls myfunc(char) cout << myfunc(88) << " "; // ambiguous + +return 0; } + +char myfunc(unsigned char ch) { +return ch-1; } + +char myfunc(char ch) { +return ch+1; } + +In C++, unsigned char and char are not inherently ambiguous. However, when myfunc() is called by using the integer 88, the compiler does not know which function to call. That is, should 88 be converted into a char or an unsigned char? +Another way you can cause ambiguity is by using default arguments in overloaded functions. To see how, examine this program: + +#include using namespace std; + +int myfunc(int i); +int myfunc(int i, int j=1); + +int main() { +cout << myfunc(4, 5) << " "; // unambiguous cout << myfunc(10); // ambiguous +C h a p t e r 1 4 : F u n c t i o n O v e r l o a d i n g , C o p y C o n s t r u c t o r s , a n d D e f a u l t A r g u m e n t s 383 + + + + +return 0; } + +int myfunc(int i) { +return i; } + +int myfunc(int i, int j) { +return i*j; } + +Here, in the first call to myfunc(), two arguments are specified; therefore, no ambiguity is introduced and myfunc(int i, int j) is called. However, when the second call to myfunc() is made, ambiguity occurs because the compiler does not know whether to call the version of myfunc() that takes one argument or to apply the default to the version that takes two arguments. +Some types of overloaded functions are simply inherently ambiguous even if, at first, they may not seem so. For example, consider this program. + +// This program contains an error. #include +using namespace std; + +void f(int x); +void f(int &x); // error + +int main() { +int a=10; + +f(a); // error, which f()? + +return 0; } + +void f(int x) { +cout << "In f(int)\n"; +384 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} + +void f(int &x) { +cout << "In f(int &)\n"; } + +As the comments in the program describe, two functions cannot be overloaded when the only difference is that one takes a reference parameter and the other takes a normal, call-by-value parameter. In this situation, the compiler has no way of knowing which version of the function is intended when it is called. Remember, there is no syntactical difference in the way that an argument is specified when it will be received by a reference parameter or by a value parameter. + +C++ + + + + +Chapter 15 Operator Overloading + + + + + + + + + + + + + + +385 +386 C + + : T h e C o m p l e t e R e f e r e n c e + + +losely related to function overloading is operator overloading. In C++, you can overload most operators so that they perform special operations relative to classes that you create. For example, a class that maintains a stack might +C +overload + to perform a push operation and – – to perform a pop. When an operator is overloaded, none of its original meanings are lost. Instead, the type of objects it can be applied to is expanded. +The ability to overload operators is one of C++'s most powerful features. It allows the full integration of new class types into the programming environment. After overloading the appropriate operators, you can use objects in expressions in just the same way that you use C++'s built-in data types. Operator overloading also forms the basis of C++'s approach to I/O. +You overload operators by creating operator functions. An operator function defines the operations that the overloaded operator will perform relative to the +class upon which it will work. An operator function is created using the keyword operator. Operator functions can be either members or nonmembers of a class. Nonmember operator functions are almost always friend functions of the class, however. The way operator functions are written differs between member and nonmember functions. Therefore, each will be examined separately, beginning with member operator functions. + + +Creating a Member Operator Function A member operator function takes this general form: + +ret-type class-name::operator#(arg-list) { +// operations } + +Often, operator functions return an object of the class they operate on, but ret-type can be any valid type. The # is a placeholder. When you create an operator function, substitute the operator for the #. For example, if you are overloading the / operator, use operator/. When you are overloading a unary operator, arg-list will be empty. When you are overloading binary operators, arg-list will contain one parameter. (The reasons for this seemingly unusual situation will be made clear in a moment.) +Here is a simple first example of operator overloading. This program creates a class called loc, which stores longitude and latitude values. It overloads the + operator relative to this class. Examine this program carefully, paying special attention to the definition of operator+() : +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 387 + + +#include using namespace std; + +class loc { +int longitude, latitude; public: +loc() {} +loc(int lg, int lt) { longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +loc operator+(loc op2); }; + +// Overload + for loc. +loc loc::operator+(loc op2) { +loc temp; + +temp.longitude = op2.longitude + longitude; temp.latitude = op2.latitude + latitude; + +return temp; } + +int main() { +loc ob1(10, 20), ob2( 5, 30); + +ob1.show(); // displays 10 20 ob2.show(); // displays 5 30 + +ob1 = ob1 + ob2; +ob1.show(); // displays 15 50 + +return 0; } +388 C + + : T h e C o m p l e t e R e f e r e n c e + + +As you can see, operator+() has only one parameter even though it overloads the binary + operator. (You might expect two parameters corresponding to the two operands of a binary operator.) The reason that operator+() takes only one parameter is that the operand on the left side of the + is passed implicitly to the function through the this pointer. The operand on the right is passed in the parameter op2. The fact that the left operand is passed using this also implies one important point: When binary operators are overloaded, it is the object on the left that generates the call to the operator function. +As mentioned, it is common for an overloaded operator function to return an object of the class it operates upon. By doing so, it allows the operator to be used in larger expressions. For example, if the operator+() function returned some other type, this expression would not have been valid: + +ob1 = ob1 + ob2; + +In order for the sum of ob1 and ob2 to be assigned to ob1, the outcome of that operation must be an object of type loc. +Further, having operator+() return an object of type loc makes possible the following statement: + + +(ob1+ob2).show(); // displays outcome of ob1+ob2 + +In this situation, ob1+ob2 generates a temporary object that ceases to exist after the call to show() terminates. +It is important to understand that an operator function can return any type and that the type returned depends solely upon your specific application. It is just that, often, an operator function will return an object of the class upon which it operates. +One last point about the operator+() function: It does not modify either operand. Because the traditional use of the + operator does not modify either operand, it makes sense for the overloaded version not to do so either. (For example, 5+7 yields 12, but neither 5 nor 7 is changed.) Although you are free to perform any operation you want inside an operator function, it is usually best to stay within the context of the normal use of the operator. +The next program adds three additional overloaded operators to the loc class: the –, the =, and the unary ++. Pay special attention to how these functions are defined. + + +#include using namespace std; + +class loc { +int longitude, latitude; +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 389 + + + +public: +loc() {} // needed to construct temporaries loc(int lg, int lt) { +longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +loc operator+(loc op2); loc operator-(loc op2); loc operator=(loc op2); loc operator++(); +}; + +// Overload + for loc. +loc loc::operator+(loc op2) { +loc temp; + +temp.longitude = op2.longitude + longitude; temp.latitude = op2.latitude + latitude; + +return temp; } + +// Overload - for loc. +loc loc::operator-(loc op2) { +loc temp; + +// notice order of operands +temp.longitude = longitude - op2.longitude; temp.latitude = latitude - op2.latitude; + +return temp; } + +// Overload asignment for loc. +390 C + + : T h e C o m p l e t e R e f e r e n c e + + + +loc loc::operator=(loc op2) { +longitude = op2.longitude; latitude = op2.latitude; + +return *this; // i.e., return object that generated call } + +// Overload prefix ++ for loc. loc loc::operator++() +{ +longitude++; latitude++; + +return *this; } + +int main() { +loc ob1(10, 20), ob2( 5, 30), ob3(90, 90); + +ob1.show(); ob2.show(); + +++ob1; +ob1.show(); // displays 11 21 + +ob2 = ++ob1; +ob1.show(); // displays 12 22 ob2.show(); // displays 12 22 + +ob1 = ob2 = ob3; // multiple assignment ob1.show(); // displays 90 90 ob2.show(); // displays 90 90 + +return 0; } + +First, examine the operator–() function. Notice the order of the operands in the subtraction. In keeping with the meaning of subtraction, the operand on the right side of the minus sign is subtracted from the operand on the left. Because it is the object on the left that generates the call to the operator–() function, op2's data must be +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 391 + + +subtracted from the data pointed to by this. It is important to remember which operand generates the call to the function. +In C++, if the = is not overloaded, a default assignment operation is created automatically for any class you define. The default assignment is simply a member-by-member, bitwise copy. By overloading the =, you can define explicitly +what the assignment does relative to a class. In this example, the overloaded = does exactly the same thing as the default, but in other situations, it could perform other operations. Notice that the operator=() function returns *this, which is the object that generated the call. This arrangement is necessary if you want to be able to use multiple assignment operations such as this: + +ob1 = ob2 = ob3; // multiple assignment + +Now, look at the definition of operator++(). As you can see, it takes no parameters. Since ++ is a unary operator, its only operand is implicitly passed by using the this pointer. +Notice that both operator=() and operator++() alter the value of an operand. In the case of assignment, the operand on the left (the one generating the call to the operator=() function) is assigned a new value. In the case of the ++, the operand is incremented. As stated previously, although you are free to make these functions +do anything you please, it is almost always wisest to stay consistent with their original meanings. + +Creating Prefix and Postfix Forms of the Increment and Decrement Operators +In the preceding program, only the prefix form of the increment operator was overloaded. However, Standard C++ allows you to explicitly create separate prefix and postfix versions of increment or decrement operators. To accomplish this, you must define two versions of the operator++() function. One is defined as shown in the foregoing program. The other is declared like this: + + +loc operator++(int x); + +If the ++ precedes its operand, the operator++() function is called. If the ++ follows its operand, the operator++(int x) is called and x has the value zero. +The preceding example can be generalized. Here are the general forms for the prefix and postfix ++ and – – operator functions. + +// Prefix increment type operator++( ) { +// body of prefix operator } +392 C + + : T h e C o m p l e t e R e f e r e n c e + + + +// Postfix increment type operator++(int x) { +// body of postfix operator } + +// Prefix decrement type operator– –( ) { +// body of prefix operator } + +// Postfix decrement type operator– –(int x) { +// body of postfix operator } + + +Note + +YoushouldbecarefulwhenworkingwitholderC++programswheretheincrement anddecrementoperatorsareconcerned.InolderversionsofC++,itwasnotpossible tospecifyseparateprefixandpostfixversionsofanoverloaded ++or– –.Theprefix form was used for both. + + +Overloading the Shorthand Operators +You can overload any of C++'s "shorthand" operators, such as +=, –=, and the like. For example, this function overloads += relative to loc: + + +loc loc::operator+=(loc op2) { +longitude = op2.longitude + longitude; latitude = op2.latitude + latitude; + +return *this; } + +When overloading one of these operators, keep in mind that you are simply combining an assignment with another type of operation. + +Operator Overloading Restrictions +There are some restrictions that apply to operator overloading. You cannot alter the precedence of an operator. You cannot change the number of operands that an operator takes. (You can choose to ignore an operand, however.) Except for the function call +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 393 + + +operator (described later), operator functions cannot have default arguments. Finally, these operators cannot be overloaded: + +. : : .* ? + +As stated, technically you are free to perform any activity inside an operator function. For example, if you want to overload the + operator in such a way that it writes I like C++ 10 times to a disk file, you can do so. However, when you stray significantly from the normal meaning of an operator, you run the risk of dangerously destructuring your program. When someone reading your program sees a statement like Ob1+Ob2, he or she expects something resembling addition to be taking +place—not a disk access, for example. Therefore, before decoupling an overloaded operator from its normal meaning, be sure that you have sufficient reason to do so. One good example where decoupling is successful is found in the way C++ overloads the << and >> operators for I/O. Although the I/O operations have no relationship to bit shifting, these operators provide a visual "clue" as to their meaning relative to both I/O and bit shifting, and this decoupling works. In general, however, it is best to stay within the context of the expected meaning of an operator when overloading it. +Except for the = operator, operator functions are inherited by any derived class. However, a derived class is free to overload any operator (including those overloaded by the base class) it chooses relative to itself. + + +Operator Overloading Using a Friend Function You can overload an operator for a class by using a nonmember function, which is usually a friend of the class. Since a friend function is not a member of the class, it does not have a this pointer. Therefore, an overloaded friend operator function is passed the operands explicitly. This means that a friend function that overloads a binary operator has two parameters, and a friend function that overloads a unary operator has one parameter. When overloading a binary operator using a friend function, the left operand is passed in the first parameter and the right operand is passed in the second parameter. +In this program, the operator+() function is made into a friend: + +#include using namespace std; + +class loc { +int longitude, latitude; public: +394 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +loc() {} // needed to construct temporaries loc(int lg, int lt) { +longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +friend loc operator+(loc op1, loc op2); // now a friend loc operator-(loc op2); +loc operator=(loc op2); loc operator++(); +}; + +// Now, + is overloaded using friend function. loc operator+(loc op1, loc op2) +{ +loc temp; + +temp.longitude = op1.longitude + op2.longitude; temp.latitude = op1.latitude + op2.latitude; + +return temp; } + +// Overload - for loc. +loc loc::operator-(loc op2) { +loc temp; + +// notice order of operands +temp.longitude = longitude - op2.longitude; temp.latitude = latitude - op2.latitude; + +return temp; } + +// Overload assignment for loc. +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 395 + + + + +loc loc::operator=(loc op2) { +longitude = op2.longitude; latitude = op2.latitude; + +return *this; // i.e., return object that generated call } + +// Overload ++ for loc. loc loc::operator++() +{ +longitude++; latitude++; + +return *this; } + +int main() { +loc ob1(10, 20), ob2( 5, 30); + +ob1 = ob1 + ob2; ob1.show(); + +return 0; } + +There are some restrictions that apply to friend operator functions. First, you may not overload the =, ( ), [ ], or –> operators by using a friend function. Second, as explained in the next section, when overloading the increment or decrement operators, you will need to use a reference parameter when using a friend function. + +Using a Friend to Overload ++ or –– +If you want to use a friend function to overload the increment or decrement operators, you must pass the operand as a reference parameter. This is because friend functions do not have this pointers. Assuming that you stay true to the original meaning of the ++ and – – operators, these operations imply the modification of the operand they operate upon. However, if you overload these operators by using a friend, then the operand is passed by value as a parameter. This means that a friend operator function has no way to modify the operand. Since the friend operator function is not passed a +396 C + + : T h e C o m p l e t e R e f e r e n c e + + +this pointer to the operand, but rather a copy of the operand, no changes made to that parameter affect the operand that generated the call. However, you can remedy this situation by specifying the parameter to the friend operator function as a reference parameter. This causes any changes made to the parameter inside the function to affect the operand that generated the call. For example, this program uses friend functions to overload the prefix versions of ++ and – – operators relative to the loc class: + + +#include using namespace std; + +class loc { +int longitude, latitude; public: +loc() {} +loc(int lg, int lt) { longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +loc operator=(loc op2); +friend loc operator++(loc &op); friend loc operator--(loc &op); +}; + +// Overload assignment for loc. loc loc::operator=(loc op2) +{ +longitude = op2.longitude; latitude = op2.latitude; + +return *this; // i.e., return object that generated call } + +// Now a friend; use a reference parameter. loc operator++(loc &op) +{ +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 397 + + + + +op.longitude++; op.latitude++; + +return op; } + +// Make op-- a friend; use reference. loc operator--(loc &op) +{ +op.longitude--; op.latitude--; + +return op; } + +int main() { +loc ob1(10, 20), ob2; + +ob1.show(); ++ob1; +ob1.show(); // displays 11 21 + +ob2 = ++ob1; +ob2.show(); // displays 12 22 + +--ob2; +ob2.show(); // displays 11 21 + +return 0; } + +If you want to overload the postfix versions of the increment and decrement operators using a friend, simply specify a second, dummy integer parameter. For example, this shows the prototype for the friend, postfix version of the increment operator relative to loc. + + +// friend, postfix version of ++ friend loc operator++(loc &op, int x); +398 C + + : T h e C o m p l e t e R e f e r e n c e + + +Friend Operator Functions Add Flexibility +In many cases, whether you overload an operator by using a friend or a member +function makes no functional difference. In those cases, it is usually best to overload by using member functions. However, there is one situation in which overloading by using a friend increases the flexibility of an overloaded operator. Let's examine this case now. +As you know, when you overload a binary operator by using a member function, the object on the left side of the operator generates the call to the operator function. Further, a pointer to that object is passed in the this pointer. Now, assume some class called CL that defines a member operator+() function that adds an object of +the class to an integer. Given an object of that class called Ob, the following expression is valid: + +Ob + 100 // valid + +In this case, Ob generates the call to the overloaded + function, and the addition is performed. But what happens if the expression is written like this? + +100 + Ob // invalid + +In this case, it is the integer that appears on the left. Since an integer is a built-in type, no operation between an integer and an object of Ob's type is defined. Therefore, the compiler will not compile this expression. As you can imagine, in some applications, having to always position the object on the left could be a significant burden and cause of frustration. +The solution to the preceding problem is to overload addition using a friend, not a member, function. When this is done, both arguments are explicitly passed to the operator function. Therefore, to allow both object+integer and integer+object, simply overload the function twice—one version for each situation. Thus, when you overload an operator by using two friend functions, the object may appear on either the left or right side of the operator. +This program illustrates how friend functions are used to define an operation that involves an object and built-in type: + + +#include using namespace std; + +class loc { +int longitude, latitude; public: +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 399 + + + + +loc() {} +loc(int lg, int lt) { longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +friend loc operator+(loc op1, int op2); friend loc operator+(int op1, loc op2); +}; + +// + is overloaded for loc + int. loc operator+(loc op1, int op2) +{ +loc temp; + +temp.longitude = op1.longitude + op2; temp.latitude = op1.latitude + op2; + +return temp; } +// + is overloaded for int + loc. loc operator+(int op1, loc op2) +{ +loc temp; + +temp.longitude = op1 + op2.longitude; temp.latitude = op1 + op2.latitude; + +return temp; } + +int main() { +loc ob1(10, 20), ob2( 5, 30), ob3(7, 14); + +ob1.show(); +400 C + + : T h e C o m p l e t e R e f e r e n c e + + + +ob2.show(); ob3.show(); + +ob1 = ob2 + 10; // both of these ob3 = 10 + ob2; // are valid + +ob1.show(); ob3.show(); + +return 0; } + + +Overloading new and delete +It is possible to overload new and delete. You might choose to do this if you want +to use some special allocation method. For example, you may want allocation routines that automatically begin using a disk file as virtual memory when the heap has +been exhausted. Whatever the reason, it is a very simple matter to overload these operators. +The skeletons for the functions that overload new and delete are shown here: + +// Allocate an object. +void *operator new(size_t size) { +/* Perform allocation. Throw bad_alloc on failure. Constructor called automatically. */ +return pointer_to_memory; } + +// Delete an object. +void operator delete(void *p) { +/* Free memory pointed to by p. Destructor called automatically. */ +} + +The type size_t is a defined type capable of containing the largest single piece of memory that can be allocated. (size_t is essentially an unsigned integer.) The parameter size will contain the number of bytes needed to hold the object being +allocated. This is the amount of memory that your version of new must allocate. The overloaded new function must return a pointer to the memory that it allocates, or throw a bad_alloc exception if an allocation error occurs. Beyond these constraints, the +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 401 + + +overloaded new function can do anything else you require. When you allocate an object using new (whether your own version or not), the object's constructor is automatically called. +The delete function receives a pointer to the region of memory to be freed. It then releases the previously allocated memory back to the system. When an object is deleted, its destructor function is automatically called. +The new and delete operators may be overloaded globally so that all uses of these operators call your custom versions. They may also be overloaded relative to one or more classes. Lets begin with an example of overloading new and delete relative to a class. For the sake of simplicity, no new allocation scheme will be used. Instead, the overloaded operators will simply invoke the standard library functions malloc() and free(). (In your own application, you may, of course, implement any alternative allocation scheme you like.) +To overload the new and delete operators for a class, simply make the overloaded operator functions class members. For example, here the new and delete operators are overloaded for the loc class: + +#include #include #include +using namespace std; + +class loc { +int longitude, latitude; public: +loc() {} +loc(int lg, int lt) { longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +void *operator new(size_t size); void operator delete(void *p); +}; + +// new overloaded relative to loc. void *loc::operator new(size_t size) +402 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +{ +void *p; + +cout << "In overloaded new.\n"; p = malloc(size); +if(!p) { bad_alloc ba; throw ba; +} +return p; } + +// delete overloaded relative to loc. void loc::operator delete(void *p) +{ +cout << "In overloaded delete.\n"; free(p); +} + +int main() { +loc *p1, *p2; + +try { +p1 = new loc (10, 20); } catch (bad_alloc xa) { +cout << "Allocation error for p1.\n"; return 1; +} + +try { +p2 = new loc (-10, -20); } catch (bad_alloc xa) { +cout << "Allocation error for p2.\n"; return 1;; +} + +p1->show(); p2->show(); + +delete p1; +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 403 + + + + +delete p2; + +return 0; } + +Output from this program is shown here. + +In overloaded new. In overloaded new. 10 20 +-10 -20 +In overloaded delete. In overloaded delete. + + +When new and delete are for a specific class, the use of these operators on any other type of data causes the original new or delete to be employed. The overloaded operators are only applied to the types for which they are defined. This means that if you add this line to the main(), the default new will be executed: + + +int *f = new float; // uses default new + +You can overload new and delete globally by overloading these operators outside of any class declaration. When new and delete are overloaded globally, C++'s default new and delete are ignored and the new operators are used for all allocation requests. Of course, if you have defined any versions of new and delete relative to one or more classes, then the class-specific versions are used when allocating objects of the class for which they are defined. In other words, when new or delete are encountered, the compiler first checks to see whether they are defined relative to the class they are operating on. If so, those specific versions are used. If not, C++ uses the globally defined new and delete. If these have been overloaded, the overloaded versions are used. +To see an example of overloading new and delete globally, examine this program: + + +#include #include #include +using namespace std; + +class loc { +404 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +int longitude, latitude; public: +loc() {} +loc(int lg, int lt) { longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} }; + +// Global new +void *operator new(size_t size) { +void *p; + +p = malloc(size); if(!p) { +bad_alloc ba; throw ba; +} +return p; } + +// Global delete +void operator delete(void *p) { +free(p); } + +int main() { +loc *p1, *p2; float *f; + +try { +p1 = new loc (10, 20); } catch (bad_alloc xa) { +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 405 + + + + +cout << "Allocation error for p1.\n"; return 1;; +} + +try { +p2 = new loc (-10, -20); } catch (bad_alloc xa) { +cout << "Allocation error for p2.\n"; return 1;; +} + +try { +f = new float; // uses overloaded new, too } catch (bad_alloc xa) { +cout << "Allocation error for f.\n"; return 1;; +} + +*f = 10.10F; +cout << *f << "\n"; + +p1->show(); p2->show(); + +delete p1; delete p2; delete f; + +return 0; } + +Run this program to prove to yourself that the built-in new and delete operators have indeed been overloaded. + + +Overloading new and delete for Arrays +If you want to be able to allocate arrays of objects using your own allocation system, you will need to overload new and delete a second time. To allocate and free arrays, you must use these forms of new and delete. +406 C + + : T h e C o m p l e t e R e f e r e n c e + + +// Allocate an array of objects. void *operator new[](size_t size) { +/* Perform allocation. Throw bad_alloc on failure. Constructor for each element called automatically. */ +return pointer_to_memory; } + +// Delete an array of objects. void operator delete[](void *p) { +/* Free memory pointed to by p. +Destructor for each element called automatically. */ +} + +When allocating an array, the constructor function for each object in the array is automatically called. When freeing an array, each object's destructor is automatically called. You do not have to provide explicit code to accomplish these actions. +The following program allocates and frees an object and an array of objects of type loc. + + +#include #include #include +using namespace std; + +class loc { +int longitude, latitude; public: +loc() {longitude = latitude = 0;} loc(int lg, int lt) { +longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +void *operator new(size_t size); +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 407 + + + + +void operator delete(void *p); + +void *operator new[](size_t size); void operator delete[](void *p); +}; + +// new overloaded relative to loc. void *loc::operator new(size_t size) { +void *p; + +cout << "In overloaded new.\n"; p = malloc(size); +if(!p) { bad_alloc ba; throw ba; +} +return p; } + +// delete overloaded relative to loc. void loc::operator delete(void *p) +{ +cout << "In overloaded delete.\n"; free(p); +} + +// new overloaded for loc arrays. +void *loc::operator new[](size_t size) { +void *p; + +cout << "Using overload new[].\n"; p = malloc(size); +if(!p) { bad_alloc ba; throw ba; +} +return p; } +408 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +// delete overloaded for loc arrays. void loc::operator delete[](void *p) { +cout << "Freeing array using overloaded delete[]\n"; free(p); +} + +int main() { +loc *p1, *p2; int i; + +try { +p1 = new loc (10, 20); // allocate an object } catch (bad_alloc xa) { +cout << "Allocation error for p1.\n"; return 1;; +} + +try { +p2 = new loc [10]; // allocate an array } catch (bad_alloc xa) { +cout << "Allocation error for p2.\n"; return 1;; +} + +p1->show(); + +for(i=0; i<10; i++) p2[i].show(); + +delete p1; // free an object delete [] p2; // free an array + +return 0; } + + +Overloading the nothrow Version of new and delete +You can also create overloaded nothrow versions of new and delete. To do so, use these skeletons. +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 409 + + +// Nothrow version of new. +void *operator new(size_t size, const nothrow_t &n) { +// Perform allocation. +if(success) return pointer_to_memory; else return 0; +} + +// Nothrow version of new for arrays. +void *operator new[](size_t size, const nothrow_t &n) { +// Perform allocation. +if(success) return pointer_to_memory; else return 0; +} + +void operator delete(void *p, const nothrow_t &n) { +// free memory } + +void operator delete[](void *p, const nothrow_t &n) { +// free memory } + +The type nothrow_t is defined in . This is the type of the nothrow object. The nothrow_t parameter is unused. + + +Overloading Some Special Operators +C++ defines array subscripting, function calling, and class member access as operations. The operators that perform these functions are the [ ], ( ), and –>, respectively. These rather exotic operators may be overloaded in C++, opening up some very interesting uses. +One important restriction applies to overloading these three operators: They must be nonstatic member functions. They cannot be friends. + +Overloading [ ] +In C++, the [ ] is considered a binary operator when you are overloading it. Therefore, the general form of a member operator[ ]() function is as shown here: +410 C + + : T h e C o m p l e t e R e f e r e n c e + + +type class-name::operator[](int i) { +// . . . } + +Technically, the parameter does not have to be of type int, but an operator[ ]() function is typically used to provide array subscripting, and as such, an integer value is generally used. +Given an object called O, the expression + + +O[3] + +translates into this call to the operator[ ]() function: + +O.operator[](3) + +That is, the value of the expression within the subscripting operators is passed to the operator[ ]() function in its explicit parameter. The this pointer will point to O, the object that generated the call. +In the following program, atype declares an array of three integers. Its constructor function initializes each member of the array to the specified values. The overloaded operator[ ]() function returns the value of the array as indexed by the value of its parameter. + + +#include using namespace std; + +class atype { int a[3]; +public: +atype(int i, int j, int k) { a[0] = i; +a[1] = j; a[2] = k; +} +int operator[](int i) { return a[i]; } }; + +int main() { +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 411 + + + + +atype ob(1, 2, 3); + +cout << ob[1]; // displays 2 + +return 0; } + +You can design the operator[ ]() function in such a way that the [ ] can be used on both the left and right sides of an assignment statement. To do this, simply specify the return value of operator[ ]() as a reference. The following program makes this change and shows its use: + + +#include using namespace std; + +class atype { int a[3]; +public: +atype(int i, int j, int k) { a[0] = i; +a[1] = j; a[2] = k; +} +int &operator[](int i) { return a[i]; } }; + +int main() { +atype ob(1, 2, 3); + +cout << ob[1]; // displays 2 cout << " "; + +ob[1] = 25; // [] on left of = + +cout << ob[1]; // now displays 25 + +return 0; } +412 C + + : T h e C o m p l e t e R e f e r e n c e + + +Because operator[ ]() now returns a reference to the array element indexed by i, it can be used on the left side of an assignment to modify an element of the array. (Of course, it may still be used on the right side as well.) +One advantage of being able to overload the [ ] operator is that it allows a means of implementing safe array indexing in C++. As you know, in C++, it is possible to overrun (or underrun) an array boundary at run time without generating a run-time error message. However, if you create a class that contains the array, and allow access to that array only through the overloaded [ ] subscripting operator, then you can intercept an out-of-range index. For example, this program adds a range check to the preceding program and proves that it works: + + +// A safe array example. #include #include +using namespace std; + +class atype { int a[3]; +public: +atype(int i, int j, int k) { a[0] = i; +a[1] = j; a[2] = k; +} +int &operator[](int i); }; + +// Provide range checking for atype. int &atype::operator[](int i) +{ +if(i<0 || i> 2) { +cout << "Boundary Error\n"; exit(1); +} +return a[i]; } + +int main() { +atype ob(1, 2, 3); +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 413 + + + + +cout << ob[1]; // displays 2 cout << " "; + +ob[1] = 25; // [] appears on left cout << ob[1]; // displays 25 + +ob[3] = 44; // generates runtime error, 3 out-of-range + +return 0; } + +In this program, when the statement + +ob[3] = 44; + +executes, the boundary error is intercepted by operator[](), and the program is terminated before any damage can be done. (In actual practice, some sort of +error-handling function would be called to deal with the out-of-range condition; the program would not have to terminate.) + +Overloading ( ) +When you overload the ( ) function call operator, you are not, per se, creating a new way to call a function. Rather, you are creating an operator function that can be passed an arbitrary number of parameters. Let's begin with an example. Given the overloaded operator function declaration + + +double operator()(int a, float f, char *s); + +and an object O of its class, then the statement + +O(10, 23.34, "hi"); + +translates into this call to the operator() function. + +O.operator()(10, 23.34, "hi"); + +In general, when you overload the ( ) operator, you define the parameters that you want to pass to that function. When you use the ( ) operator in your program, the +414 C + + : T h e C o m p l e t e R e f e r e n c e + + +arguments you specify are copied to those parameters. As always, the object that generates the call (O in this example) is pointed to by the this pointer. +Here is an example of overloading ( ) for the loc class. It assigns the value of its two arguments to the longitude and latitude of the object to which it is applied. + + +#include using namespace std; + +class loc { +int longitude, latitude; public: +loc() {} +loc(int lg, int lt) { longitude = lg; latitude = lt; +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +loc operator+(loc op2); +loc operator()(int i, int j); }; + +// Overload ( ) for loc. +loc loc::operator()(int i, int j) { +longitude = i; latitude = j; + +return *this; } + +// Overload + for loc. +loc loc::operator+(loc op2) { +loc temp; + +temp.longitude = op2.longitude + longitude; temp.latitude = op2.latitude + latitude; +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 415 + + + + +return temp; } + +int main() { +loc ob1(10, 20), ob2(1, 1); + +ob1.show(); +ob1(7, 8); // can be executed by itself ob1.show(); + +ob1 = ob2 + ob1(10, 10); // can be used in expressions ob1.show(); + +return 0; } + +The output produced by the program is shown here. + +10 20 7 8 11 11 + +Remember, when overloading (), you can use any type of parameters and return any type of value. These types will be dictated by the demands of your programs. You can also specify default arguments. + +Overloading –> +The –> pointer operator, also called the class member access operator, is considered a unary operator when overloading. Its general usage is shown here: + +object->element; + +Here, object is the object that activates the call. The operator–>() function must return a pointer to an object of the class that operator–>() operates upon. The element must be some member accessible within the object. +The following program illustrates overloading the –> by showing the equivalence between ob.i and ob–>i when operator–>() returns the this pointer: +416 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include using namespace std; + +class myclass { public: +int i; +myclass *operator->() {return this;} }; + +int main() { +myclass ob; + +ob->i = 10; // same as ob.i + +cout << ob.i << " " << ob->i; + +return 0; } + +An operator–>() function must be a member of the class upon which it works. + + +Overloading the Comma Operator +You can overload C++'s comma operator. The comma is a binary operator, and like all overloaded operators, you can make an overloaded comma perform any operation you want. However, if you want the overloaded comma to perform in a fashion similar to its normal operation, then your version must discard the values of all operands except the rightmost. The rightmost value becomes the result of the comma operation. This is the way the comma works by default in C++. +Here is a program that illustrates the effect of overloading the comma operator. + +#include using namespace std; + +class loc { +int longitude, latitude; public: +loc() {} +loc(int lg, int lt) { longitude = lg; latitude = lt; +C h a p t e r 1 5 : O p e r a t o r O v e r l o a d i n g 417 + + + + +} + +void show() { +cout << longitude << " "; cout << latitude << "\n"; +} + +loc operator+(loc op2); loc operator,(loc op2); +}; + +// overload comma for loc loc loc::operator,(loc op2) { +loc temp; + +temp.longitude = op2.longitude; temp.latitude = op2.latitude; +cout << op2.longitude << " " << op2.latitude << "\n"; + +return temp; } + +// Overload + for loc +loc loc::operator+(loc op2) { +loc temp; + +temp.longitude = op2.longitude + longitude; temp.latitude = op2.latitude + latitude; + +return temp; } + +int main() { +loc ob1(10, 20), ob2( 5, 30), ob3(1, 1); + +ob1.show(); ob2.show(); ob3.show(); +418 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << "\n"; + +ob1 = (ob1, ob2+ob2, ob3); + +ob1.show(); // displays 1 1, the value of ob3 + +return 0; } + +This program displays the following output: + +10 20 5 30 1 1 + +10 60 1 1 1 1 + +Notice that although the values of the left-hand operands are discarded, each expression is still evaluated by the compiler so that any desired side effects will be performed. +Remember, the left-hand operand is passed via this, and its value is discarded by the operator,() function. The value of the right-hand operation is returned by the function. This causes the overloaded comma to behave similarly to its default operation. If you want the overloaded comma to do something else, you will have +to change these two features. + +C++ + + + + +Chapter 16 Inheritance + + + + + + + + + + + + + + +419 +420 C + + : T h e C o m p l e t e R e f e r e n c e + + +nheritance is one of the cornerstones of OOP because it allows the creation of hierarchical classifications. Using inheritance, you can create a general class that defines traits common to a set of related items. This class may then be inherited by +I +other, more specific classes, each adding only those things that are unique to the inheriting class. +In keeping with standard C++ terminology, a class that is inherited is referred to as a base class. The class that does the inheriting is called the derived class. Further, a derived class can be used as a base class for another derived class. In this way, multiple inheritance is achieved. +C++'s support of inheritance is both rich and flexible. Inheritance was introduced in Chapter 11. It is examined in detail here. + + +Base-Class Access Control +When a class inherits another, the members of the base class become members of the derived class. Class inheritance uses this general form: + +class derived-class-name : access base-class-name { // body of class +}; + +The access status of the base-class members inside the derived class is determined by access. The base-class access specifier must be either public, private, or protected. If no access specifier is present, the access specifier is private by default if the derived class is a class. If the derived class is a struct, then public is the default in the absence of an explicit access specifier. Let's examine the ramifications of using public or private access. (The protected specifier is examined in the next section.) +When the access specifier for a base class is public, all public members of the base become public members of the derived class, and all protected members of the base become protected members of the derived class. In all cases, the base's private elements remain private to the base and are not accessible by members of the derived class. For example, as illustrated in this program, objects of type derived can directly access the public members of base: + + +#include using namespace std; + +class base { int i, j; +public: +void set(int a, int b) { i=a; j=b; } +C h a p t e r 1 6 : I n h e r i t a n c e 421 + + + +void show() { cout << i << " " << j << "\n"; } }; + +class derived : public base { int k; +public: +derived(int x) { k=x; } +void showk() { cout << k << "\n"; } }; + +int main() { +derived ob(3); + +ob.set(1, 2); // access member of base ob.show(); // access member of base + +ob.showk(); // uses member of derived class + +return 0; } + +When the base class is inherited by using the private access specifier, all public and protected members of the base class become private members of the derived class. For example, the following program will not even compile because both set() and show() are now private elements of derived: + + +// This program won't compile. #include +using namespace std; + +class base { int i, j; +public: +void set(int a, int b) { i=a; j=b; } +void show() { cout << i << " " << j << "\n";} }; + +// Public elements of base are private in derived. class derived : private base { +int k; +422 C + + : T h e C o m p l e t e R e f e r e n c e + + + +public: +derived(int x) { k=x; } +void showk() { cout << k << "\n"; } }; + +int main() { +derived ob(3); + +ob.set(1, 2); // error, can't access set() ob.show(); // error, can't access show() + +return 0; } + + +Remember + +When a base class' access specifier is private, public and protected members of the base become private members of the derived class. This means that they are still accessible by members of the derived class but cannot be accessed by parts of your program that are not members of either the base or derived class. + + + +Inheritance and protected Members +The protected keyword is included in C++ to provide greater flexibility in the inheritance mechanism. When a member of a class is declared as protected, that member is not accessible by other, nonmember elements of the program. With one important exception, access to a protected member is the same as access to a private member—it can be accessed only by other members of its class. The sole exception to this is when a protected member is inherited. In this case, a protected member differs substantially from a private one. +As explained in the preceding section, a private member of a base class is not accessible by other parts of your program, including any derived class. However, protected members behave differently. If the base class is inherited as public, then the base class' protected members become protected members of the derived class and are, therefore, accessible by the derived class. By using protected, you can create class members that are private to their class but that can still be inherited and accessed by a derived class. Here is an example: + + +#include using namespace std; + +class base { +C h a p t e r 1 6 : I n h e r i t a n c e 423 + + + +protected: +int i, j; // private to base, but accessible by derived public: +void set(int a, int b) { i=a; j=b; } +void show() { cout << i << " " << j << "\n"; } }; + +class derived : public base { int k; +public: +// derived may access base's i and j void setk() { k=i*j; } + +void showk() { cout << k << "\n"; } }; + +int main() { +derived ob; + +ob.set(2, 3); // OK, known to derived ob.show(); // OK, known to derived + +ob.setk(); ob.showk(); + +return 0; } + +In this example, because base is inherited by derived as public and because i and j are declared as protected, derived's function setk() may access them. If i and j had been declared as private by base, then derived would not have access to them, and the program would not compile. +When a derived class is used as a base class for another derived class, any protected member of the initial base class that is inherited (as public) by the first derived class may also be inherited as protected again by a second derived class. For example, this program is correct, and derived2 does indeed have access to i and j. + +#include using namespace std; + +class base { +424 C + + : T h e C o m p l e t e R e f e r e n c e + + + +protected: int i, j; +public: +void set(int a, int b) { i=a; j=b; } +void show() { cout << i << " " << j << "\n"; } }; + +// i and j inherited as protected. class derived1 : public base { +int k; public: +void setk() { k = i*j; } // legal void showk() { cout << k << "\n"; } +}; + +// i and j inherited indirectly through derived1. class derived2 : public derived1 { +int m; public: +void setm() { m = i-j; } // legal void showm() { cout << m << "\n"; } +}; + +int main() { +derived1 ob1; derived2 ob2; + +ob1.set(2, 3); ob1.show(); ob1.setk(); ob1.showk(); + +ob2.set(3, 4); ob2.show(); ob2.setk(); ob2.setm(); ob2.showk(); ob2.showm(); + +return 0; } +C h a p t e r 1 6 : I n h e r i t a n c e 425 + + +If, however, base were inherited as private, then all members of base would become private members of derived1, which means that they would not be accessible by derived2. (However, i and j would still be accessible by derived1.) This situation is illustrated by the following program, which is in error (and won't compile). The comments describe each error: + + +// This program won't compile. #include +using namespace std; + +class base { protected: +int i, j; public: +void set(int a, int b) { i=a; j=b; } +void show() { cout << i << " " << j << "\n"; } }; + +// Now, all elements of base are private in derived1. class derived1 : private base { +int k; public: +// this is legal because i and j are private to derived1 void setk() { k = i*j; } // OK +void showk() { cout << k << "\n"; } }; + +// Access to i, j, set(), and show() not inherited. class derived2 : public derived1 { +int m; public: +// illegal because i and j are private to derived1 void setm() { m = i-j; } // Error +void showm() { cout << m << "\n"; } }; + +int main() { +derived1 ob1; derived2 ob2; + +ob1.set(1, 2); // error, can't use set() +426 C + + : T h e C o m p l e t e R e f e r e n c e + + + +ob1.show(); // error, can't use show() + +ob2.set(3, 4); // error, can't use set() ob2.show(); // error, can't use show() + +return 0; } + + +Note + +Even though base is inherited as private by derived1, derived1 still has access to base's public and protected elements. However, it cannot pass along this privilege. + + +Protected Base-Class Inheritance +It is possible to inherit a base class as protected. When this is done, all public and protected members of the base class become protected members of the derived class. For example, + + +#include using namespace std; + +class base { protected: +int i, j; // private to base, but accessible by derived public: +void setij(int a, int b) { i=a; j=b; } +void showij() { cout << i << " " << j << "\n"; } }; + +// Inherit base as protected. class derived : protected base{ +int k; public: +// derived may access base's i and j and setij(). void setk() { setij(10, 12); k = i*j; } + +// may access showij() here +void showall() { cout << k << " "; showij(); } }; + +int main() +C h a p t e r 1 6 : I n h e r i t a n c e 427 + + + +{ +derived ob; + +// ob.setij(2, 3); // illegal, setij() is +// protected member of derived + +ob.setk(); // OK, public member of derived ob.showall(); // OK, public member of derived + +// ob.showij(); // illegal, showij() is protected // member of derived + +return 0; } + +As you can see by reading the comments, even though setij() and showij() are public members of base, they become protected members of derived when it is inherited using the protected access specifier. This means that they will not be accessible inside main() . + + +Inheriting Multiple Base Classes +It is possible for a derived class to inherit two or more base classes. For example, in this short example, derived inherits both base1 and base2. + + +// An example of multiple base classes. + +#include using namespace std; + +class base1 { protected: +int x; public: +void showx() { cout << x << "\n"; } }; + +class base2 { protected: +int y; public: +428 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void showy() {cout << y << "\n";} }; + +// Inherit multiple base classes. +class derived: public base1, public base2 { public: +void set(int i, int j) { x=i; y=j; } }; + +int main() { +derived ob; + +ob.set(10, 20); // provided by derived ob.showx(); // from base1 +ob.showy(); // from base2 + +return 0; } + +As the example illustrates, to inherit more than one base class, use a comma-separated list. Further, be sure to use an access-specifier for each base inherited. + + +Constructors, Destructors, and Inheritance +There are two major questions that arise relative to constructors and destructors when inheritance is involved. First, when are base-class and derived-class constructor and destructor functions called? Second, how can parameters be passed to base-class constructor functions? This section examines these two important topics. + +When Constructor and Destructor Functions Are Executed +It is possible for a base class, a derived class, or both to contain constructor and/or destructor functions. It is important to understand the order in which these functions are executed when an object of a derived class comes into existence and when it goes out of existence. To begin, examine this short program: + + +#include using namespace std; +C h a p t e r 1 6 : I n h e r i t a n c e 429 + + + + +class base { public: +base() { cout << "Constructing base\n"; } ~base() { cout << "Destructing base\n"; } +}; + +class derived: public base { public: +derived() { cout << "Constructing derived\n"; } ~derived() { cout << "Destructing derived\n"; } +}; + +int main() { +derived ob; + +// do nothing but construct and destruct ob + +return 0; } + +As the comment in main() indicates, this program simply constructs and then destroys an object called ob that is of class derived. When executed, this program displays + + +Constructing base Constructing derived Destructing derived Destructing base + +As you can see, first base's constructor is executed followed by derived's. Next (because ob is immediately destroyed in this program), derived's destructor is called, followed by base's. +The results of the foregoing experiment can be generalized. When an object of a derived class is created, if the base class contains a constructor, it will be called first, followed by the derived class' constructor. When a derived object is destroyed, its destructor is called first, followed by the base class' destructor, if it exists. Put differently, constructor functions are executed in their order of derivation. Destructor functions are executed in reverse order of derivation. +If you think about it, it makes sense that constructor functions are executed in order of derivation. Because a base class has no knowledge of any derived class, any +430 C + + : T h e C o m p l e t e R e f e r e n c e + + +initialization it needs to perform is separate from and possibly prerequisite to any initialization performed by the derived class. Therefore, it must be executed first. +Likewise, it is quite sensible that destructors be executed in reverse order of derivation. Because the base class underlies the derived class, the destruction of the base object implies the destruction of the derived object. Therefore, the derived destructor must be called before the object is fully destroyed. +In cases of multiple inheritance (that is, where a derived class becomes the base class for another derived class), the general rule applies: Constructors are called in order of derivation, destructors in reverse order. For example, this program + + +#include using namespace std; + +class base { public: +base() { cout << "Constructing base\n"; } ~base() { cout << "Destructing base\n"; } +}; + +class derived1 : public base { public: +derived1() { cout << "Constructing derived1\n"; } ~derived1() { cout << "Destructing derived1\n"; } +}; + +class derived2: public derived1 { public: +derived2() { cout << "Constructing derived2\n"; } ~derived2() { cout << "Destructing derived2\n"; } +}; + +int main() { +derived2 ob; + +// construct and destruct ob + +return 0; } +C h a p t e r 1 6 : I n h e r i t a n c e 431 + + +displays this output: + +Constructing base Constructing derived1 Constructing derived2 Destructing derived2 Destructing derived1 Destructing base + +The same general rule applies in situations involving multiple base classes. For example, this program + + +#include using namespace std; + +class base1 { public: +base1() { cout << "Constructing base1\n"; } ~base1() { cout << "Destructing base1\n"; } +}; + +class base2 { public: +base2() { cout << "Constructing base2\n"; } ~base2() { cout << "Destructing base2\n"; } +}; + +class derived: public base1, public base2 { public: +derived() { cout << "Constructing derived\n"; } ~derived() { cout << "Destructing derived\n"; } +}; + +int main() { +derived ob; + +// construct and destruct ob + +return 0; } +432 C + + : T h e C o m p l e t e R e f e r e n c e + + +produces this output: + +Constructing base1 Constructing base2 Constructing derived Destructing derived Destructing base2 Destructing base1 + +As you can see, constructors are called in order of derivation, left to right, as specified in derived's inheritance list. Destructors are called in reverse order, right to left. This means that had base2 been specified before base1 in derived's list, as shown here: + + +class derived: public base2, public base1 { + +then the output of this program would have looked like this: + +Constructing base2 Constructing base1 Constructing derived Destructing derived Destructing base1 Destructing base2 + +Passing Parameters to Base-Class Constructors +So far, none of the preceding examples have included constructor functions that +require arguments. In cases where only the derived class' constructor requires one or more parameters, you simply use the standard parameterized constructor syntax (see Chapter 12). However, how do you pass arguments to a constructor in a base class? The answer is to use an expanded form of the derived class's constructor declaration that passes along arguments to one or more base-class constructors. The general form of this expanded derived-class constructor declaration is shown here: + +derived-constructor(arg-list) : base1(arg-list), base2(arg-list), // ... +baseN(arg-list) { +// body of derived constructor } +C h a p t e r 1 6 : I n h e r i t a n c e 433 + + +Here, base1 through baseN are the names of the base classes inherited by the derived class. Notice that a colon separates the derived class' constructor declaration from the base-class specifications, and that the base-class specifications are separated from each other by commas, in the case of multiple base classes. Consider this program: + + +#include using namespace std; + +class base { protected: +int i; public: +base(int x) { i=x; cout << "Constructing base\n"; } ~base() { cout << "Destructing base\n"; } +}; + +class derived: public base { int j; +public: +// derived uses x; y is passed along to base. derived(int x, int y): base(y) +{ j=x; cout << "Constructing derived\n"; } + +~derived() { cout << "Destructing derived\n"; } void show() { cout << i << " " << j << "\n"; } +}; + +int main() { +derived ob(3, 4); + +ob.show(); // displays 4 3 + +return 0; } + +Here, derived's constructor is declared as taking two parameters, x and y. However, derived() uses only x; y is passed along to base(). In general, the derived class' constructor must declare both the parameter(s) that it requires as well as any required by the base class. As the example illustrates, any parameters required by the base class are passed to it in the base class' argument list specified after the colon. +434 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here is an example that uses multiple base classes: + +#include using namespace std; + +class base1 { protected: +int i; public: +base1(int x) { i=x; cout << "Constructing base1\n"; } ~base1() { cout << "Destructing base1\n"; } +}; + +class base2 { protected: +int k; public: +base2(int x) { k=x; cout << "Constructing base2\n"; } ~base2() { cout << "Destructing base1\n"; } +}; + +class derived: public base1, public base2 { int j; +public: +derived(int x, int y, int z): base1(y), base2(z) { j=x; cout << "Constructing derived\n"; } + +~derived() { cout << "Destructing derived\n"; } +void show() { cout << i << " " << j << " " << k << "\n"; } }; + +int main() { +derived ob(3, 4, 5); + +ob.show(); // displays 4 3 5 + +return 0; } + +It is important to understand that arguments to a base-class constructor are passed via arguments to the derived class' constructor. Therefore, even if a derived class' constructor does not use any arguments, it will still need to declare one if the base class +C h a p t e r 1 6 : I n h e r i t a n c e 435 + + +requires it. In this situation, the arguments passed to the derived class are simply passed along to the base. For example, in this program, the derived class' constructor takes no arguments, but base1() and base2() do: + + +#include using namespace std; + +class base1 { protected: +int i; public: +base1(int x) { i=x; cout << "Constructing base1\n"; } ~base1() { cout << "Destructing base1\n"; } +}; + +class base2 { protected: +int k; public: +base2(int x) { k=x; cout << "Constructing base2\n"; } ~base2() { cout << "Destructing base2\n"; } +}; + +class derived: public base1, public base2 { public: +/* Derived constructor uses no parameter, +but still must be declared as taking them to pass them along to base classes. +*/ + +derived(int x, int y): base1(x), base2(y) { cout << "Constructing derived\n"; } + +~derived() { cout << "Destructing derived\n"; } void show() { cout << i << " " << k << "\n"; } +}; + +int main() { +derived ob(3, 4); + +ob.show(); // displays 3 4 +436 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +return 0; } + +A derived class' constructor function is free to make use of any and all parameters that it is declared as taking, even if one or more are passed along to a base class. Put differently, passing an argument along to a base class does not preclude its use by the derived class as well. For example, this fragment is perfectly valid: + + +class derived: public base { int j; +public: +// derived uses both x and y and then passes them to base. derived(int x, int y): base(x, y) +{ j = x*y; cout << "Constructing derived\n"; } + +One final point to keep in mind when passing arguments to base-class constructors: The argument can consist of any expression valid at the time. This includes function calls and variables. This is in keeping with the fact that C++ allows dynamic initialization. + + +Granting Access +When a base class is inherited as private, all public and protected members of that class become private members of the derived class. However, in certain circumstances, you may want to restore one or more inherited members to their original access specification. For example, you might want to grant certain public members of the base class public status in the derived class even though the base class is inherited as private. In Standard C++, you have two ways to accomplish this. First, you can use a using statement, which is the preferred way. The using statement is designed primarily to support namespaces and is discussed in Chapter 23. The second way to restore an inherited member's access specification is to employ an access declaration within the derived class. Access declarations are currently supported by Standard C++, but they are deprecated. This means that they should not be used for new code. Since there are still many, many existing programs that use access declarations, they will be examined here. +An access declaration takes this general form: + +base-class::member; +C h a p t e r 1 6 : I n h e r i t a n c e 437 + + +The access declaration is put under the appropriate access heading in the derived class' declaration. Notice that no type declaration is required (or, indeed, allowed) in an access declaration. +To see how an access declaration works, let's begin with this short fragment: + + +class base { public: +int j; // public in base }; + +// Inherit base as private. class derived: private base { public: + +// here is access declaration base::j; // make j public again . +. . +}; + +Because base is inherited as private by derived, the public member j is made a private member of derived. However, by including + + +base::j; + +as the access declaration under derived's public heading, j is restored to its public status. You can use an access declaration to restore the access rights of public and +protected members. However, you cannot use an access declaration to raise or lower a member's access status. For example, a member declared as private in a base class cannot be made public by a derived class. (If C++ allowed this to occur, it would destroy its encapsulation mechanism!) +The following program illustrates the access declaration; notice how it uses access declarations to restore j, seti(), and geti() to public status. + + +#include using namespace std; + +class base { +int i; // private to base +438 C + + : T h e C o m p l e t e R e f e r e n c e + + + +public: +int j, k; +void seti(int x) { i = x; } int geti() { return i; } +}; + +// Inherit base as private. class derived: private base { public: +/* The next three statements override +base's inheritance as private and restore j, seti(), and geti() to public access. */ +base::j; // make j public again - but not k base::seti; // make seti() public base::geti; // make geti() public + +// base::i; // illegal, you cannot elevate access + +int a; // public }; + +int main() { +derived ob; + +//ob.i = 10; // illegal because i is private in derived + +ob.j = 20; // legal because j is made public in derived //ob.k = 30; // illegal because k is private in derived + +ob.a = 40; // legal because a is public in derived ob.seti(10); + +cout << ob.geti() << " " << ob.j << " " << ob.a; + +return 0; } + +Access declarations are supported in C++ to accommodate those situations in which most of an inherited class is intended to be made private, but a few members are to retain their public or protected status. +C h a p t e r 1 6 : I n h e r i t a n c e 439 + + + +Remember + +While Standard C++ still supports access declarations, they are deprecated. This meansthattheyareallowedfornow,buttheymightnotbesupportedinthefuture. Instead, the standard suggests achieving the same effect by applying the using keyword. + + + +Virtual Base Classes +An element of ambiguity can be introduced into a C++ program when multiple base classes are inherited. For example, consider this incorrect program: + + +// This program contains an error and will not compile. #include +using namespace std; + +class base { public: +int i; }; + +// derived1 inherits base. class derived1 : public base { public: +int j; }; + +// derived2 inherits base. class derived2 : public base { public: +int k; }; + +/* derived3 inherits both derived1 and derived2. This means that there are two copies of base in derived3! */ +class derived3 : public derived1, public derived2 { public: +int sum; }; + +int main() { +440 C + + : T h e C o m p l e t e R e f e r e n c e + + + +derived3 ob; + +ob.i = 10; // this is ambiguous, which i??? ob.j = 20; +ob.k = 30; + +// i ambiguous here, too ob.sum = ob.i + ob.j + ob.k; + +// also ambiguous, which i? cout << ob.i << " "; + +cout << ob.j << " " << ob.k << " "; cout << ob.sum; + +return 0; } + +As the comments in the program indicate, both derived1 and derived2 inherit base. However, derived3 inherits both derived1 and derived2. This means that there are two copies of base present in an object of type derived3. Therefore, in an expression like + + +ob.i = 10; + +which i is being referred to, the one in derived1 or the one in derived2? Because there are two copies of base present in object ob, there are two ob.is! As you can see, the statement is inherently ambiguous. +There are two ways to remedy the preceding program. The first is to apply the scope resolution operator to i and manually select one i. For example, this version of the program does compile and run as expected: + +// This program uses explicit scope resolution to select i. #include +using namespace std; + +class base { public: +int i; }; + +// derived1 inherits base. +C h a p t e r 1 6 : I n h e r i t a n c e 441 + + + +class derived1 : public base { public: +int j; }; + +// derived2 inherits base. class derived2 : public base { public: +int k; }; + +/* derived3 inherits both derived1 and derived2. This means that there are two copies of base in derived3! */ +class derived3 : public derived1, public derived2 { public: +int sum; }; + +int main() { +derived3 ob; + +ob.derived1::i = 10; // scope resolved, use derived1's i ob.j = 20; +ob.k = 30; + +// scope resolved +ob.sum = ob.derived1::i + ob.j + ob.k; + +// also resolved here +cout << ob.derived1::i << " "; + +cout << ob.j << " " << ob.k << " "; cout << ob.sum; + +return 0; } + +As you can see, because the :: was applied, the program has manually selected derived1's version of base. However, this solution raises a deeper issue: What if only one copy of base is actually required? Is there some way to prevent two copies from +442 C + + : T h e C o m p l e t e R e f e r e n c e + + +being included in derived3? The answer, as you probably have guessed, is yes. This solution is achieved using virtual base classes. +When two or more objects are derived from a common base class, you can prevent multiple copies of the base class from being present in an object derived from those objects by declaring the base class as virtual when it is inherited. You accomplish this by preceding the base class' name with the keyword virtual when it is inherited. For example, here is another version of the example program in which derived3 contains only one copy of base: + +// This program uses virtual base classes. #include +using namespace std; + +class base { public: +int i; }; + +// derived1 inherits base as virtual. class derived1 : virtual public base { public: +int j; }; + +// derived2 inherits base as virtual. class derived2 : virtual public base { public: +int k; }; + +/* derived3 inherits both derived1 and derived2. +This time, there is only one copy of base class. */ class derived3 : public derived1, public derived2 { public: +int sum; }; + +int main() { +derived3 ob; + +ob.i = 10; // now unambiguous +C h a p t e r 1 6 : I n h e r i t a n c e 443 + + + +ob.j = 20; ob.k = 30; + +// unambiguous +ob.sum = ob.i + ob.j + ob.k; + +// unambiguous +cout << ob.i << " "; + +cout << ob.j << " " << ob.k << " "; cout << ob.sum; + +return 0; } + +As you can see, the keyword virtual precedes the rest of the inherited class' specification. Now that both derived1 and derived2 have inherited base as virtual, any multiple inheritance involving them will cause only one copy of base to be present. Therefore, in derived3, there is only one copy of base and ob.i = 10 is perfectly valid and unambiguous. +One further point to keep in mind: Even though both derived1 and derived2 specify base as virtual, base is still present in objects of either type. For example, the following sequence is perfectly valid: + +// define a class of type derived1 derived1 myclass; + +myclass.i = 88; + +The only difference between a normal base class and a virtual one is what occurs when an object inherits the base more than once. If virtual base classes are used, then only one base class is present in the object. Otherwise, multiple copies will be found. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 17 Virtual Functions and +Polymorphism + + + + + + + + + + + +445 +446 C + + : T h e C o m p l e t e R e f e r e n c e + + +olymorphism is supported by C++ both at compile time and at run time. As discussed in earlier chapters, compile-time polymorphism is achieved by overloading functions and operators. Run-time polymorphism is accomplished +P +by using inheritance and virtual functions, and these are the topics of this chapter. + + +Virtual Functions +A virtual function is a member function that is declared within a base class and redefined by a derived class. To create a virtual function, precede the function's declaration in the base class with the keyword virtual. When a class containing a virtual function is inherited, the derived class redefines the virtual function to fit its own needs. In essence, virtual functions implement the "one interface, multiple methods" philosophy that underlies polymorphism. The virtual function within the base class defines the form of the interface to that function. Each redefinition of the virtual function by a derived class implements its operation as it relates specifically to the derived class. That is, the redefinition creates a specific method. +When accessed "normally," virtual functions behave just like any other type of class member function. However, what makes virtual functions important and capable of supporting run-time polymorphism is how they behave when accessed via a pointer. As discussed in Chapter 13, a base-class pointer can be used to point to an object of any class derived from that base. When a base pointer points to a derived object that contains a virtual function, C++ determines which version of that function to call based upon the type of object pointed to by the pointer. And this determination is made at run time. Thus, when different objects are pointed to, different versions of the virtual function are executed. The same effect applies to base-class references. +To begin, examine this short example: + +#include using namespace std; + +class base { public: +virtual void vfunc() { +cout << "This is base's vfunc().\n"; } +}; + +class derived1 : public base { public: +void vfunc() { +cout << "This is derived1's vfunc().\n"; } +C h a p t e r 1 7 : V i r t u a l F u n c t i o n s a n d P o l y m o r p h i s m 447 + + + +}; + +class derived2 : public base { public: +void vfunc() { +cout << "This is derived2's vfunc().\n"; } +}; + +int main() { +base *p, b; derived1 d1; derived2 d2; + +// point to base p = &b; +p->vfunc(); // access base's vfunc() + +// point to derived1 p = &d1; +p->vfunc(); // access derived1's vfunc() + +// point to derived2 p = &d2; +p->vfunc(); // access derived2's vfunc() + +return 0; } + +This program displays the following: + +This is base's vfunc(). This is derived1's vfunc(). This is derived2's vfunc(). + +As the program illustrates, inside base, the virtual function vfunc() is declared. Notice that the keyword virtual precedes the rest of the function declaration. When vfunc() is redefined by derived1 and derived2, the keyword virtual is not needed. (However, it is not an error to include it when redefining a virtual function inside a derived class; it's just not needed.) +448 C + + : T h e C o m p l e t e R e f e r e n c e + + +In this program, base is inherited by both derived1 and derived2. Inside each class definition, vfunc() is redefined relative to that class. Inside main(), four variables are declared: + +Name Type + +p base class pointer b object of base +d1 object of derived1 d2 object of derived2 + +Next, p is assigned the address of b, and vfunc() is called via p. Since p is pointing to an object of type base, that version of vfunc() is executed. Next, p is set to the address of d1, and again vfunc() is called by using p. This time p points to an object of type derived1. This causes derived1::vfunc() to be executed. Finally, p is assigned the address of d2, and p−>vfunc() causes the version of vfunc() redefined inside derived2 to be executed. The key point here is that the kind of object to which p points determines which version of vfunc() is executed. Further, this determination is made at run time, and this process forms the basis for run-time polymorphism. +Although you can call a virtual function in the "normal" manner by using an object's name and the dot operator, it is only when access is through a base-class pointer (or reference) that run-time polymorphism is achieved. For example, assuming the preceding example, this is syntactically valid: + + +d2.vfunc(); // calls derived2's vfunc() + +Although calling a virtual function in this manner is not wrong, it simply does not take advantage of the virtual nature of vfunc() . +At first glance, the redefinition of a virtual function by a derived class appears similar to function overloading. However, this is not the case, and the term overloading is not applied to virtual function redefinition because several differences exist. Perhaps the most important is that the prototype for a redefined virtual function must match exactly the prototype specified in the base class. This differs from overloading a normal function, in which return types and the number and type of parameters may differ. (In fact, when you overload a function, either the number or the type of the parameters must differ! It +is through these differences that C++ can select the correct version of an overloaded function.) However, when a virtual function is redefined, all aspects of its prototype must be the same. If you change the prototype when you attempt to redefine a virtual function, the function will simply be considered overloaded by the C++ compiler, and its virtual nature will be lost. Another important restriction is that virtual functions must be +C h a p t e r 1 7 : V i r t u a l F u n c t i o n s a n d P o l y m o r p h i s m 449 + + +nonstatic members of the classes of which they are part. They cannot be friends. Finally, constructor functions cannot be virtual, but destructor functions can. +Because of the restrictions and differences between function overloading and virtual function redefinition, the term overriding is used to describe virtual function redefinition by a derived class. + +Calling a Virtual Function Through a Base Class Reference +In the preceding example, a virtual function was called through a base-class pointer, but the polymorphic nature of a virtual function is also available when called through a base-class reference. As explained in Chapter 13, a reference is an implicit pointer. Thus, a base-class reference can be used to refer to an object of the base class or any object derived from that base. When a virtual function is called through a base-class reference, the version of the function executed is determined by the object being referred to at the time of the call. +The most common situation in which a virtual function is invoked through a base class reference is when the reference is a function parameter. For example, consider the following variation on the preceding program. + + +/* Here, a base class reference is used to access a virtual function. */ +#include using namespace std; + +class base { public: +virtual void vfunc() { +cout << "This is base's vfunc().\n"; } +}; + +class derived1 : public base { public: +void vfunc() { +cout << "This is derived1's vfunc().\n"; } +}; + +class derived2 : public base { public: +450 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void vfunc() { +cout << "This is derived2's vfunc().\n"; } +}; + +// Use a base class reference parameter. void f(base &r) { +r.vfunc(); } + +int main() { +base b; derived1 d1; derived2 d2; + +f(b); // pass a base object to f() f(d1); // pass a derived1 object to f() f(d2); // pass a derived2 object to f() + +return 0; } + +This program produces the same output as its preceding version. In this example, the function f() defines a reference parameter of type base. Inside main() , the function is called using objects of type base, derived1, and derived2. Inside f() , the specific version of vfunc() that is called is determined by the type of object being referenced when the function is called. +For the sake of simplicity, the rest of the examples in this chapter will call virtual functions through base-class pointers, but the effects are same for base-class references. + + +The Virtual Attribute Is Inherited +When a virtual function is inherited, its virtual nature is also inherited. This means that when a derived class that has inherited a virtual function is itself used as a base class for another derived class, the virtual function can still be overridden. Put differently, no matter how many times a virtual function is inherited, it remains virtual. For example, consider this program: + + +#include using namespace std; +C h a p t e r 1 7 : V i r t u a l F u n c t i o n s a n d P o l y m o r p h i s m 451 + + + + +class base { public: +virtual void vfunc() { +cout << "This is base's vfunc().\n"; } +}; + +class derived1 : public base { public: +void vfunc() { +cout << "This is derived1's vfunc().\n"; } +}; + +/* derived2 inherits virtual function vfunc() from derived1. */ +class derived2 : public derived1 { public: +// vfunc() is still virtual void vfunc() { +cout << "This is derived2's vfunc().\n"; } +}; + +int main() { +base *p, b; derived1 d1; derived2 d2; + +// point to base p = &b; +p->vfunc(); // access base's vfunc() + +// point to derived1 p = &d1; +p->vfunc(); // access derived1's vfunc() + +// point to derived2 p = &d2; +p->vfunc(); // access derived2's vfunc() +452 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +return 0; } + +As expected, the preceding program displays this output: + +This is base's vfunc(). This is derived1's vfunc(). This is derived2's vfunc(). + +In this case, derived2 inherits derived1 rather than base, but vfunc() is still virtual. + + +Virtual Functions Are Hierarchical +As explained, when a function is declared as virtual by a base class, it may be overridden by a derived class. However, the function does not have to be overridden. When a derived class fails to override a virtual function, then when an object of that derived class accesses that function, the function defined by the base class is used. For example, consider this program in which derived2 does not override vfunc() : + + +#include using namespace std; + +class base { public: +virtual void vfunc() { +cout << "This is base's vfunc().\n"; } +}; + +class derived1 : public base { public: +void vfunc() { +cout << "This is derived1's vfunc().\n"; } +}; + +class derived2 : public base { +C h a p t e r 1 7 : V i r t u a l F u n c t i o n s a n d P o l y m o r p h i s m 453 + + + +public: +// vfunc() not overridden by derived2, base's is used }; + +int main() { +base *p, b; derived1 d1; derived2 d2; + +// point to base p = &b; +p->vfunc(); // access base's vfunc() + +// point to derived1 p = &d1; +p->vfunc(); // access derived1's vfunc() + +// point to derived2 p = &d2; +p->vfunc(); // use base's vfunc() + +return 0; } + +The program produces this output: + +This is base's vfunc(). This is derived1's vfunc(). This is base's vfunc(). + +Because derived2 does not override vfunc() , the function defined by base is used when vfunc() is referenced relative to objects of type derived2. +The preceding program illustrates a special case of a more general rule. Because inheritance is hierarchical in C++, it makes sense that virtual functions are also hierarchical. This means that when a derived class fails to override a virtual function, the first redefinition found in reverse order of derivation is used. For example, in the following program, derived2 is derived from derived1, which is derived from base. However, derived2 does not override vfunc() . This means that, relative to derived2, +454 C + + : T h e C o m p l e t e R e f e r e n c e + + +the closest version of vfunc() is in derived1. Therefore, it is derived1::vfunc() that is used when an object of derived2 attempts to call vfunc() . + + +#include using namespace std; + +class base { public: +virtual void vfunc() { +cout << "This is base's vfunc().\n"; } +}; + +class derived1 : public base { public: +void vfunc() { +cout << "This is derived1's vfunc().\n"; } +}; + +class derived2 : public derived1 { public: +/* vfunc() not overridden by derived2. +In this case, since derived2 is derived from derived1, derived1's vfunc() is used. +*/ }; + +int main() { +base *p, b; derived1 d1; derived2 d2; + +// point to base p = &b; +p->vfunc(); // access base's vfunc() + +// point to derived1 p = &d1; +p->vfunc(); // access derived1's vfunc() +C h a p t e r 1 7 : V i r t u a l F u n c t i o n s a n d P o l y m o r p h i s m 455 + + + +// point to derived2 p = &d2; +p->vfunc(); // use derived1's vfunc() + +return 0; } + +The program displays the following: + +This is base's vfunc(). This is derived1's vfunc(). This is derived1's vfunc(). + +Pure Virtual Functions +As the examples in the preceding section illustrate, when a virtual function is +not redefined by a derived class, the version defined in the base class will be used. However, in many situations there can be no meaningful definition of a virtual function within a base class. For example, a base class may not be able to define an object sufficiently to allow a base-class virtual function to be created. Further, in some situations you will want to ensure that all derived classes override a virtual function. To handle these two cases, C++ supports the pure virtual function. +A pure virtual function is a virtual function that has no definition within the base class. To declare a pure virtual function, use this general form: + +virtual type func-name(parameter-list) = 0; + +When a virtual function is made pure, any derived class must provide its own definition. If the derived class fails to override the pure virtual function, a compile-time error will result. +The following program contains a simple example of a pure virtual function. The base class, number, contains an integer called val, the function setval() , and the pure virtual function show() . The derived classes hextype, dectype, and octtype inherit number and redefine show() so that it outputs the value of val in each respective number base (that is, hexadecimal, decimal, or octal). + +#include using namespace std; + +class number { +456 C + + : T h e C o m p l e t e R e f e r e n c e + + + +protected: int val; +public: +void setval(int i) { val = i; } + +// show() is a pure virtual function virtual void show() = 0; +}; + +class hextype : public number { public: +void show() { +cout << hex << val << "\n"; } +}; + +class dectype : public number { public: +void show() { +cout << val << "\n"; } +}; + +class octtype : public number { public: +void show() { +cout << oct << val << "\n"; } +}; + +int main() { +dectype d; hextype h; octtype o; + +d.setval(20); +d.show(); // displays 20 - decimal + +h.setval(20); +h.show(); // displays 14 - hexadecimal +C h a p t e r 1 7 : V i r t u a l F u n c t i o n s a n d P o l y m o r p h i s m 457 + + + +o.setval(20); +o.show(); // displays 24 - octal + +return 0; } + +Although this example is quite simple, it illustrates how a base class may not be able to meaningfully define a virtual function. In this case, number simply provides the common interface for the derived types to use. There is no reason to define show() inside number since the base of the number is undefined. Of course, you can always create a placeholder definition of a virtual function. However, making show() pure also ensures that all derived classes will indeed redefine it to meet their own needs. +Keep in mind that when a virtual function is declared as pure, all derived classes must override it. If a derived class fails to do this, a compile-time error will result. + +Abstract Classes +A class that contains at least one pure virtual function is said to be abstract. Because an +abstract class contains one or more functions for which there is no definition (that is, a pure virtual function), no objects of an abstract class may be created. Instead, an abstract class constitutes an incomplete type that is used as a foundation for derived classes. +Although you cannot create objects of an abstract class, you can create pointers and references to an abstract class. This allows abstract classes to support run-time polymorphism, which relies upon base-class pointers and references to select the proper virtual function. + + +Using Virtual Functions +One of the central aspects of object-oriented programming is the principle of "one interface, multiple methods." This means that a general class of actions can be defined, the interface to which is constant, with each derivation defining its own specific operations. In concrete C++ terms, a base class can be used to define the nature of the interface to a general class. Each derived class then implements the specific operations as they relate to the type of data used by the derived type. +One of the most powerful and flexible ways to implement the "one interface, multiple methods" approach is to use virtual functions, abstract classes, and run-time polymorphism. Using these features, you create a class hierarchy that moves from general to specific (base to derived). Following this philosophy, you define all common features and interfaces in a base class. In cases where certain actions can be implemented only by the derived class, use a virtual function. In essence, in the base +458 C + + : T h e C o m p l e t e R e f e r e n c e + + +class you create and define everything you can that relates to the general case. The derived class fills in the specific details. +Following is a simple example that illustrates the value of the "one interface, multiple methods" philosophy. A class hierarchy is created that performs conversions from one system of units to another. (For example, liters to gallons.) The base class convert declares two variables, val1 and val2, which hold the initial and converted values, respectively. It also defines the functions getinit() and getconv() , which return the initial value and the converted value. These elements of convert are fixed and applicable to all derived classes that will inherit convert. However, the function that will actually perform the conversion, compute() , is a pure virtual function that must be defined by the classes derived from convert. The specific nature of compute() will be determined by what type of conversion is taking place. + +// Virtual function practical example. #include +using namespace std; + +class convert { + +protected: double val1; double val2; +public: + + +// initial value +// converted value + +convert(double i) { val1 = i; +} +double getconv() { return val2; } double getinit() { return val1; } + +virtual void compute() = 0; }; + +// Liters to gallons. +class l_to_g : public convert { public: +l_to_g(double i) : convert(i) { } void compute() { +val2 = val1 / 3.7854; } +}; + +// Fahrenheit to Celsius +class f_to_c : public convert { +C h a p t e r 1 7 : V i r t u a l F u n c t i o n s a n d P o l y m o r p h i s m 459 + + + +public: +f_to_c(double i) : convert(i) { } void compute() { +val2 = (val1-32) / 1.8; } +}; + +int main() { +convert *p; // pointer to base class + +l_to_g lgob(4); f_to_c fcob(70); + +// use virtual function mechanism to convert p = &lgob; +cout << p->getinit() << " liters is "; p->compute(); +cout << p->getconv() << " gallons\n"; // l_to_g + +p = &fcob; +cout << p->getinit() << " in Fahrenheit is "; p->compute(); +cout << p->getconv() << " Celsius\n"; // f_to_c + +return 0; } + +The preceding program creates two derived classes from convert, called l_to_g and f_to_c. These classes perform the conversions of liters to gallons and Fahrenheit to Celsius, respectively. Each derived class overrides compute() in its own way to perform the desired conversion. However, even though the actual conversion (that is, method) differs between l_to_g and f_to_c, the interface remains constant. +One of the benefits of derived classes and virtual functions is that handling a new case is a very easy matter. For example, assuming the preceding program, you can add a conversion from feet to meters by including this class: + +// Feet to meters +class f_to_m : public convert { public: +f_to_m(double i) : convert(i) { } +460 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void compute() { +val2 = val1 / 3.28; } +}; + + +An important use of abstract classes and virtual functions is in class libraries. You can create a generic, extensible class library that will be used by other programmers. Another programmer will inherit your general class, which defines the interface and all elements common to all classes derived from it, and will add those functions specific to the derived class. By creating class libraries, you are able to create and control the interface of a general class while still letting other programmers adapt it to their specific needs. +One final point: The base class convert is an example of an abstract class. The virtual function compute() is not defined within convert because no meaningful definition can be provided. The class convert simply does not contain sufficient information for compute() to be defined. It is only when convert is inherited by a derived class that a complete type is created. + + +Early vs. Late Binding +Before concluding this chapter on virtual functions and run-time polymorphism, there are two terms that need to be defined because they are used frequently in discussions of C++ and object-oriented programming: early binding and late binding. +Early binding refers to events that occur at compile time. In essence, early binding occurs when all information needed to call a function is known at compile time. (Put differently, early binding means that an object and a function call are bound during compilation.) Examples of early binding include normal function calls (including standard library functions), overloaded function calls, and overloaded operators. The main advantage to early binding is efficiency. Because all information necessary to call a function is determined at compile time, these types of function calls are very fast. +The opposite of early binding is late binding. As it relates to C++, late binding refers to function calls that are not resolved until run time. Virtual functions are used to achieve late binding. As you know, when access is via a base pointer or reference, the virtual function actually called is determined by the type of object pointed to by the pointer. Because in most cases this cannot be determined at compile time, the object and the function are not linked until run time. The main advantage to late binding is flexibility. Unlike early binding, late binding allows you to create programs that can respond to events occurring while the program executes without having to create a large amount of "contingency code." Keep in mind that because a function call is not resolved until run time, late binding can make for somewhat slower execution times. + +C++ + + + + +Chapter 18 Templates + + + + + + + + + + + + + + +461 +462 C + + : T h e C o m p l e t e R e f e r e n c e + + +he template is one of C++'s most sophisticated and high-powered features. Although not part of the original specification for C++, it was added several years ago and is supported by all modern C++ compilers. Using templates, it +T +is possible to create generic functions and classes. In a generic function or class, the type of data upon which the function or class operates is specified as a parameter. Thus, you can use one function or class with several different types of data without having to explicitly recode specific versions for each data type. Both generic functions and generic classes are discussed in this chapter. + + + +Generic Functions +A generic function defines a general set of operations that will be applied to various types of data. The type of data that the function will operate upon is passed to it as a parameter. Through a generic function, a single general procedure can be applied to a wide range of data. As you probably know, many algorithms are logically the same no matter what type of data is being operated upon. For example, the Quicksort sorting algorithm is the same whether it is applied to an array of integers or an array of floats. It is just that the type of the data being sorted is different. By creating a generic function, you can define the nature of the algorithm, independent of any data. Once you have done this, the compiler will automatically generate the correct code for the type of data that is actually used when you execute the function. In essence, when you create a generic function you are creating a function that can automatically overload itself. +A generic function is created using the keyword template. The normal meaning of the word "template" accurately reflects its use in C++. It is used to create a template (or framework) that describes what a function will do, leaving it to the compiler to fill in the details as needed. The general form of a template function definition is shown here: + +template ret-type func-name(parameter list) { +// body of function } + +Here, Ttype is a placeholder name for a data type used by the function. This name may be used within the function definition. However, it is only a placeholder that the compiler will automatically replace with an actual data type when it creates a specific version of the function. Although the use of the keyword class to specify a generic type in a template declaration is traditional, you may also use the keyword typename. +The following example creates a generic function that swaps the values of the two variables with which it is called. Because the general process of exchanging two values is independent of the type of the variables, it is a good candidate for being made into a generic function. +C h a p t e r 1 8 : T e m p l a t e s 463 + + +// Function template example. #include +using namespace std; + +// This is a function template. +template void swapargs(X &a, X &b) { +X temp; + +temp = a; a = b; +b = temp; } + +int main() { +int i=10, j=20; double x=10.1, y=23.3; char a='x', b='z'; + +cout << "Original i, j: " << i << ' ' << j << '\n'; cout << "Original x, y: " << x << ' ' << y << '\n'; cout << "Original a, b: " << a << ' ' << b << '\n'; + +swapargs(i, j); // swap integers swapargs(x, y); // swap floats swapargs(a, b); // swap chars + +cout << "Swapped i, j: " << i << ' ' << j << '\n'; cout << "Swapped x, y: " << x << ' ' << y << '\n'; cout << "Swapped a, b: " << a << ' ' << b << '\n'; + +return 0; } + +Let's look closely at this program. The line: + +template void swapargs(X &a, X &b) + +tells the compiler two things: that a template is being created and that a generic definition is beginning. Here, X is a generic type that is used as a placeholder. After the template portion, the function swapargs() is declared, using X as the data type of the values that will be swapped. In main() , the swapargs() function is called using three +464 C + + : T h e C o m p l e t e R e f e r e n c e + + +different types of data: ints, doubles, and chars. Because swapargs() is a generic function, the compiler automatically creates three versions of swapargs() : one that will exchange integer values, one that will exchange floating-point values, and one that will swap characters. +Here are some important terms related to templates. First, a generic function (that is, a function definition preceded by a template statement) is also called a template function. Both terms will be used interchangeably in this book. When the compiler creates a specific version of this function, it is said to have created a specialization. This is also called a generated function. The act of generating a function is referred to as instantiating it. Put differently, a generated function is a specific instance of a template function. +Since C++ does not recognize end-of-line as a statement terminator, the template clause of a generic function definition does not have to be on the same line as the function's name. The following example shows another common way to format the swapargs() function. + +template +void swapargs(X &a, X &b) { +X temp; + +temp = a; a = b; +b = temp; } + +If you use this form, it is important to understand that no other statements can occur between the template statement and the start of the generic function definition. For example, the fragment shown next will not compile. + + +// This will not compile. template +int i; // this is an error void swapargs(X &a, X &b) { +X temp; + +temp = a; a = b; +b = temp; } + +As the comments imply, the template specification must directly precede the function definition. +C h a p t e r 1 8 : T e m p l a t e s 465 + + +A Function with Two Generic Types +You can define more than one generic data type in the template statement by using a comma-separated list. For example, this program creates a template function that has two generic types. + + +#include using namespace std; + +template void myfunc(type1 x, type2 y) +{ +cout << x << ' ' << y << '\n'; } + +int main() { +myfunc(10, "I like C++"); + +myfunc(98.6, 19L); + +return 0; } + +In this example, the placeholder types type1 and type2 are replaced by the compiler with the data types int and char *, and double and long, respectively, when the compiler generates the specific instances of myfunc() within main() . + + +Remember + +When you create a template function, you are, in essence, allowing the compiler to generate as many different versions of that function as are necessary for handling the various ways that your program calls the function. + + +Explicitly Overloading a Generic Function +Even though a generic function overloads itself as needed, you can explicitly overload one, too. This is formally called explicit specialization. If you overload a generic function, that overloaded function overrides (or "hides") the generic function relative to that specific version. For example, consider the following revised version of the argument-swapping example shown earlier. + + +// Overriding a template function. #include +using namespace std; +466 C + + : T h e C o m p l e t e R e f e r e n c e + + + +template void swapargs(X &a, X &b) { +X temp; + +temp = a; a = b; +b = temp; +cout << "Inside template swapargs.\n"; } + +// This overrides the generic version of swapargs() for ints. void swapargs(int &a, int &b) +{ +int temp; + +temp = a; a = b; +b = temp; +cout << "Inside swapargs int specialization.\n"; } + +int main() { +int i=10, j=20; double x=10.1, y=23.3; char a='x', b='z'; + +cout << "Original i, j: " << i << ' ' << j << '\n'; cout << "Original x, y: " << x << ' ' << y << '\n'; cout << "Original a, b: " << a << ' ' << b << '\n'; + +swapargs(i, j); // calls explicitly overloaded swapargs() swapargs(x, y); // calls generic swapargs() +swapargs(a, b); // calls generic swapargs() + +cout << "Swapped i, j: " << i << ' ' << j << '\n'; cout << "Swapped x, y: " << x << ' ' << y << '\n'; cout << "Swapped a, b: " << a << ' ' << b << '\n'; + +return 0; } +C h a p t e r 1 8 : T e m p l a t e s 467 + + +This program displays the following output. + +Original i, j: 10 20 Original x, y: 10.1 23.3 Original a, b: x z +Inside swapargs int specialization. Inside template swapargs. +Inside template swapargs. Swapped i, j: 20 10 Swapped x, y: 23.3 10.1 Swapped a, b: z x + +As the comments inside the program indicate, when swapargs(i, j) is called, it invokes the explicitly overloaded version of swapargs() defined in the program. Thus, the compiler does not generate this version of the generic swapargs() function, because the generic function is overridden by the explicit overloading. +Recently, a new-style syntax was introduced to denote the explicit specialization of a function. This new method uses the template keyword. For example, using the +new-style specialization syntax, the overloaded swapargs() function from the preceding program looks like this. + + +// Use new-style specialization syntax. template<> void swapargs(int &a, int &b) { +int temp; + +temp = a; a = b; +b = temp; +cout << "Inside swapargs int specialization.\n"; } + +As you can see, the new-style syntax uses the template<> construct to indicate specialization. The type of data for which the specialization is being created is placed inside the angle brackets following the function name. This same syntax is used to specialize any type of generic function. While there is no advantage to using one specialization syntax over the other at this time, the new-style is probably a better approach for the long term. +Explicit specialization of a template allows you to tailor a version of a generic function to accommodate a unique situation—perhaps to take advantage of some performance boost that applies to only one type of data, for example. However, as a general rule, if you need to have different versions of a function for different data types, you should use overloaded functions rather than templates. +468 C + + : T h e C o m p l e t e R e f e r e n c e + + +Overloading a Function Template +In addition to creating explicit, overloaded versions of a generic function, you can also overload the template specification itself. To do so, simply create another version of the template that differs from any others in its parameter list. For example: + + +// Overload a function template declaration. #include +using namespace std; + +// First version of f() template. template void f(X a) +{ +cout << "Inside f(X a)\n"; } + +// Second version of f() template. +template void f(X a, Y b) { +cout << "Inside f(X a, Y b)\n"; } + +int main() { +f(10); // calls f(X) f(10, 20); // calls f(X, Y) + +return 0; } + + +Here, the template for f() is overloaded to accept either one or two parameters. + +Using Standard Parameters with Template Functions +You can mix standard parameters with generic type parameters in a template function. These nongeneric parameters work just like they do with any other function. For example: + + +// Using standard parameters in a template function. #include +using namespace std; +C h a p t e r 1 8 : T e m p l a t e s 469 + + + +const int TABWIDTH = 8; + +// Display data at specified tab position. template void tabOut(X data, int tab) { +for(; tab; tab--) +for(int i=0; i #include using namespace std; + +void myfunc(int i) { +cout << "value is: " << i << "\n"; } + +void myfunc(double d) { +double intpart; double fracpart; + +fracpart = modf(d, &intpart); +cout << "Fractional part: " << fracpart; cout << "\n"; +cout << "Integer part: " << intpart; } + +int main() { +myfunc(1); myfunc(12.2); + +return 0; } + +Applying Generic Functions +Generic functions are one of C++'s most useful features. They can be applied to all types of situations. As mentioned earlier, whenever you have a function that defines a generalizable algorithm, you can make it into a template function. Once you have done so, you may use it with any type of data without having to recode it. Before moving on to generic classes, two examples of applying generic functions will be given. They illustrate how easy it is to take advantage of this powerful C++ feature. +C h a p t e r 1 8 : T e m p l a t e s 471 + + +A Generic Sort +Sorting is exactly the type of operation for which generic functions were designed. +Within wide latitude, a sorting algorithm is the same no matter what type of data is being sorted. The following program illustrates this by creating a generic bubble sort. While the bubble sort is a rather poor sorting algorithm, its operation is clear and uncluttered and it makes an easy-to-understand example. The bubble() function will sort any type of array. It is called with a pointer to the first element in the array and the number of elements in the array. + + +// A Generic bubble sort. #include +using namespace std; + +template void bubble( +X *items, // pointer to array to be sorted int count) // number of items in array +{ +register int a, b; X t; + +for(a=1; a=a; b--) +if(items[b-1] > items[b]) { // exchange elements +t = items[b-1]; items[b-1] = items[b]; items[b] = t; +} } + +int main() { +int iarray[7] = {7, 5, 4, 3, 9, 8, 6}; +double darray[5] = {4.3, 2.5, -0.9, 100.2, 3.0}; + +int i; + +cout << "Here is unsorted integer array: "; for(i=0; i<7; i++) +472 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << iarray[i] << ' '; cout << endl; + +cout << "Here is unsorted double array: "; for(i=0; i<5; i++) +cout << darray[i] << ' '; cout << endl; + +bubble(iarray, 7); bubble(darray, 5); + +cout << "Here is sorted integer array: "; for(i=0; i<7; i++) +cout << iarray[i] << ' '; cout << endl; + +cout << "Here is sorted double array: "; for(i=0; i<5; i++) +cout << darray[i] << ' '; cout << endl; + +return 0; } + +The output produced by the program is shown here. + +Here is unsorted integer array: 7 5 4 3 9 8 6 +Here is unsorted double array: 4.3 2.5 -0.9 100.2 3 Here is sorted integer array: 3 4 5 6 7 8 9 +Here is sorted double array: -0.9 2.5 3 4.3 100.2 + +As you can see, the preceding program creates two arrays: one integer and one double. It then sorts each. Because bubble() is a template function, it is automatically overloaded to accommodate the two different types of data. You might want to try using bubble() to sort other types of data, including classes that you create. In each case, the compiler will create the right version of the function for you. + +Compacting an Array +Another function that benefits from being made into a template is called compact() . This function compacts the elements in an array. It is not uncommon to want to remove elements from the middle of an array and then move the remaining elements down so +C h a p t e r 1 8 : T e m p l a t e s 473 + + +that all unused elements are at the end. This sort of operation is the same for all types of arrays because it is independent of the type data actually being operated upon. The generic compact() function shown in the following program is called with a pointer to the first element in the array, the number of elements in the array, and the starting and ending indexes of the elements to be removed. The function then removes those elements and compacts the array. For the purposes of illustration, it also zeroes the unused elements at the end of the array that have been freed by the compaction. + + +// A Generic array compaction function. #include +using namespace std; + +template void compact( +X *items, // pointer to array to be compacted int count, // number of items in array +int start, // starting index of compacted region int end) // ending index of compacted region +{ +register int i; + +for(i=end+1; i class class-name { . +. . +} + +Here, Ttype is the placeholder type name, which will be specified when a class is instantiated. If necessary, you can define more than one generic data type using a comma-separated list. +Once you have created a generic class, you create a specific instance of that class using the following general form: + +class-name ob; + +Here, type is the type name of the data that the class will be operating upon. Member functions of a generic class are themselves automatically generic. You need not use template to explicitly specify them as such. +In the following program, the stack class (first introduced in Chapter 11) is reworked into a generic class. Thus, it can be used to store objects of any type. In this example, a character stack and a floating-point stack are created, but any data type can be used. + +// This function demonstrates a generic stack. #include +using namespace std; + +const int SIZE = 10; + +// Create a generic stack class +template class stack { StackType stck[SIZE]; // holds the stack int tos; // index of top-of-stack + +public: +stack() { tos = 0; } // initialize stack +void push(StackType ob); // push object on stack +476 C + + : T h e C o m p l e t e R e f e r e n c e + + + +StackType pop(); // pop object from stack }; + +// Push an object. +template void stack::push(StackType ob) { +if(tos==SIZE) { +cout << "Stack is full.\n"; return; +} +stck[tos] = ob; tos++; +} +// Pop an object. +template StackType stack::pop() { +if(tos==0) { +cout << "Stack is empty.\n"; +return 0; // return null on empty stack } +tos--; +return stck[tos]; } + +int main() { +// Demonstrate character stacks. +stack s1, s2; // create two character stacks int i; + +s1.push('a'); s2.push('x'); s1.push('b'); s2.push('y'); s1.push('c'); s2.push('z'); + +for(i=0; i<3; i++) cout << "Pop s1: " << s1.pop() << "\n"; for(i=0; i<3; i++) cout << "Pop s2: " << s2.pop() << "\n"; + +// demonstrate double stacks +stack ds1, ds2; // create two double stacks +C h a p t e r 1 8 : T e m p l a t e s 477 + + + + +ds1.push(1.1); ds2.push(2.2); ds1.push(3.3); ds2.push(4.4); ds1.push(5.5); ds2.push(6.6); + +for(i=0; i<3; i++) cout << "Pop ds1: " << ds1.pop() << "\n"; for(i=0; i<3; i++) cout << "Pop ds2: " << ds2.pop() << "\n"; + +return 0; } + +As you can see, the declaration of a generic class is similar to that of a generic function. The actual type of data stored by the stack is generic in the class declaration. It is not until an object of the stack is declared that the actual data type is determined. When a specific instance of stack is declared, the compiler automatically generates all the functions and variables necessary for handling the actual data. In this example, two different types of stacks are declared. Two are integer stacks. Two are stacks of doubles. Pay special attention to these declarations: + + +stack s1, s2; // create two character stacks stack ds1, ds2; // create two double stacks + +Notice how the desired data type is passed inside the angle brackets. By changing the type of data specified when stack objects are created, you can change the type of data stored in that stack. For example, by using the following declaration, you can create another stack that stores character pointers. + + +stack chrptrQ; + +You can also create stacks to store data types that you create. For example, if you want to use the following structure to store address information, + + +struct addr { char name[40]; +char street[40]; char city[30]; char state[3]; +478 C + + : T h e C o m p l e t e R e f e r e n c e + + + +char zip[12]; }; + +then to use stack to generate a stack that will store objects of type addr, use a declaration like this: + + +stack obj; + +As the stack class illustrates, generic functions and classes are powerful tools that you can use to maximize your programming efforts, because they allow you to define the general form of an object that can then be used with any type of data. You are saved from the tedium of creating separate implementations for each data type with which you want the algorithm to work. The compiler automatically creates the specific versions of the class for you. + +An Example with Two Generic Data Types +A template class can have more than one generic data type. Simply declare all the data types required by the class in a comma-separated list within the template specification. For example, the following short example creates a class that uses two generic data types. + + +/* This example uses two generic data types in a class definition. +*/ +#include using namespace std; + +template class myclass { +Type1 i; Type2 j; +public: +myclass(Type1 a, Type2 b) { i = a; j = b; } void show() { cout << i << ' ' << j << '\n'; } +}; + +int main() { +myclass ob1(10, 0.23); +myclass ob2('X', "Templates add power."); +C h a p t e r 1 8 : T e m p l a t e s 479 + + + +ob1.show(); // show int, double ob2.show(); // show char, char * + +return 0; } + +This program produces the following output: + +10 0.23 +X Templates add power. + +The program declares two types of objects. ob1 uses int and double data. ob2 uses a character and a character pointer. For both cases, the compiler automatically generates the appropriate data and functions to accommodate the way the objects are created. + +Applying Template Classes: A Generic Array Class +To illustrate the practical benefits of template classes, let's look at one way in which +they are commonly applied. As you saw in Chapter 15, you can overload the [ ] operator. Doing so allows you to create your own array implementations, including "safe arrays" that provide run-time boundary checking. As you know, in C++, it is possible to overrun (or underrun) an array boundary at run time without generating a run-time error message. However, if you create a class that contains the array, and allow access to that array only through the overloaded [ ] subscripting operator, then you can intercept an out-of-range index. +By combining operator overloading with a template class, it is possible to create a generic safe-array type that can be used for creating safe arrays of any data type. This type of array is shown in the following program: + + +// A generic safe array example. #include +#include using namespace std; + +const int SIZE = 10; + +template class atype { AType a[SIZE]; +public: atype() { +480 C + + : T h e C o m p l e t e R e f e r e n c e + + + +register int i; +for(i=0; i AType &atype::operator[](int i) { +if(i<0 || i> SIZE-1) { +cout << "\nIndex value of "; +cout << i << " is out-of-bounds.\n"; exit(1); +} +return a[i]; } + +int main() { +atype intob; // integer array atype doubleob; // double array + +int i; + +cout << "Integer array: "; +for(i=0; i +#include using namespace std; + +// Here, int size is a non-type argument. template class atype { +AType a[size]; // length of array is passed in size public: +atype() { register int i; +for(i=0; i +AType &atype::operator[](int i) { +if(i<0 || i> size-1) { +cout << "\nIndex value of "; +cout << i << " is out-of-bounds.\n"; exit(1); +} +return a[i]; } + +int main() { +482 C + + : T h e C o m p l e t e R e f e r e n c e + + + +atype intob; // integer array of size 10 atype doubleob; // double array of size 15 + +int i; + +cout << "Integer array: "; for(i=0; i<10; i++) intob[i] = i; +for(i=0; i<10; i++) cout << intob[i] << " "; cout << '\n'; + +cout << "Double array: "; +for(i=0; i<15; i++) doubleob[i] = (double) i/3; for(i=0; i<15; i++) cout << doubleob[i] << " "; cout << '\n'; + +intob[12] = 100; // generates runtime error + +return 0; } + +Look carefully at the template specification for atype. Note that size is declared as an int. This parameter is then used within atype to declare the size of the array a. Even though size is depicted as a "variable" in the source code, its value is known at compile time. This allows it to be used to set the size of the array. size is also used in the bounds checking within the operator[ ]() function. Within main() , notice how the integer and floating-point arrays are created. The second parameter specifies the size of each array. +Non-type parameters are restricted to integers, pointers, or references. Other types, such as float, are not allowed. The arguments that you pass to a non-type parameter must consist of either an integer constant, or a pointer or reference to a global function or object. Thus, non-type parameters should themselves be thought of as constants, since their values cannot be changed. For example, inside operator[ ]() , the following statement is not allowed. + + +size = 10; // Error + +Since non-type parameters are treated as constants, they can be used to set the dimension of an array, which is a significant, practical benefit. +As the safe-array example illustrates, the use of non-type parameters greatly expands the utility of template classes. Although the information contained in the non-type argument must be known at compile-time, this restriction is mild compared with the power offered by non-type parameters. +C h a p t e r 1 8 : T e m p l a t e s 483 + + +Using Default Arguments with Template Classes +A template class can have a default argument associated with a generic type. For example, + + +template class myclass { //... + +Here, the type int will be used if no other type is specified when an object of type myclass is instantiated. +It is also permissible for non-type arguments to take default arguments. The default value is used when no explicit value is specified when the class is instantiated. Default arguments for non-type parameters are specified using the same syntax as default arguments for function parameters. +Here is another version of the safe-array class that uses default arguments for both the type of data and the size of the array. + + +// Demonstrate default template arguments. #include +#include using namespace std; + +// Here, AType defaults to int and size defaults to 10. template class atype { +AType a[size]; // size of array is passed in size public: +atype() { register int i; +for(i=0; i +AType &atype::operator[](int i) { +if(i<0 || i> size-1) { +cout << "\nIndex value of "; +cout << i << " is out-of-bounds.\n"; exit(1); +} +484 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return a[i]; } + +int main() { +atype intarray; // integer array, size 100 atype doublearray; // double array, default size atype<> defarray; // default to int array of size 10 + +int i; + +cout << "int array: "; +for(i=0; i<100; i++) intarray[i] = i; +for(i=0; i<100; i++) cout << intarray[i] << " "; cout << '\n'; + +cout << "double array: "; +for(i=0; i<10; i++) doublearray[i] = (double) i/3; for(i=0; i<10; i++) cout << doublearray[i] << " "; cout << '\n'; + +cout << "defarray array: "; +for(i=0; i<10; i++) defarray[i] = i; +for(i=0; i<10; i++) cout << defarray[i] << " "; cout << '\n'; + +return 0; } + + +Pay close attention to this line: + +template class atype { + +Here, AType defaults to type int, and size defaults to 10. As the program illustrates, atype objects can be created three ways: + + explicitly specifying both the type and size of the array + explicitly specifying the type, but letting the size default to 10 letting the type default to int and the size default to 10 +C h a p t e r 1 8 : T e m p l a t e s 485 + + +The use of default arguments—especially default types—adds versatility to your template classes. You can provide a default for the type of data most commonly used while still allowing the user of your classes to specialize them as needed. + +Explicit Class Specializations +As with template functions, you can create an explicit specialization of a generic class. To do so, use the template<> construct, which works the same as it does for explicit function specializations. For example: + + +// Demonstrate class specialization. #include +using namespace std; + +template class myclass { T x; +public: myclass(T a) { +cout << "Inside generic myclass\n"; x = a; +} +T getx() { return x; } }; + +// Explicit specialization for int. template <> class myclass { +int x; public: +myclass(int a) { +cout << "Inside myclass specialization\n"; x = a * a; +} +int getx() { return x; } }; + +int main() { +myclass d(10.1); +cout << "double: " << d.getx() << "\n\n"; + +myclass i(5); +486 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << "int: " << i.getx() << "\n"; + +return 0; } + +This program displays the following output: + +Inside generic myclass double: 10.1 + +Inside myclass specialization int: 25 + +In the program, pay close attention to this line: + +template <> class myclass { + +It tells the compiler that an explicit integer specialization of myclass is being created. This same general syntax is used for any type of class specialization. +Explicit class specialization expands the utility of generic classes because it lets you easily handle one or two special cases while allowing all others to be automatically processed by the compiler. Of course, if you find that you are creating too many specializations, you are probably better off not using a template class in the first place. + + +The typename and export Keywords +Recently, two keywords were added to C++ that relate specifically to templates: typename and export. Both play specialized roles in C++ programming. Each is briefly examined. +The typename keyword has two uses. First, as mentioned earlier, it can be substituted for the keyword class in a template declaration. For example, the swapargs() template function could be specified like this: + + +template void swapargs(X &a, X &b) { +X temp; + +temp = a; +C h a p t e r 1 8 : T e m p l a t e s 487 + + + +a = b; +b = temp; } + +Here, typename specifies the generic type X. There is no difference between using class and using typename in this context. +The second use of typename is to inform the compiler that a name used in a template declaration is a type name rather than an object name. For example, + + +typename X::Name someObject; + +ensures that X::Name is treated as a type name. +The export keyword can precede a template declaration. It allows other files to use a template declared in a different file by specifying only its declaration rather than duplicating its entire definition. + + +The Power of Templates +Templates help you achieve one of the most elusive goals in programming: the creation of reusable code. Through the use of template classes you can create frameworks that can be applied over and over again to a variety of programming situations. For example, consider the stack class. When first shown in Chapter 11, it could only be used to store integer values. Even though the underlying algorithms could be used to store any type of data, the hard-coding of the data type into the stack class severely limited its application. However, by making stack into a generic class, it can create a stack for any type of data. +Generic functions and classes provide a powerful tool that you can use to amplify your programming efforts. Once you have written and debugged a template class, you have a solid software component that you can use with confidence in a variety of different situations. You are saved from the tedium of creating separate implementations for each data type with which you want the class to work. +While it is true that the template syntax can seem a bit intimidating at first, the rewards are well worth the time it takes to become comfortable with it. Template functions and classes are already becoming commonplace in programming, and this trend is expected to continue. For example, the STL (Standard Template Library) defined by C++ is, as its name implies, built upon templates. One last point: although templates add a layer of abstraction, they still ultimately compile down to the same, high-performance object code that you have come to expect from C++. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 19 Exception Handling + + + + + + + + + + + + + + +489 +490 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter discusses the exception handling subsystem. Exception handling allows you to manage run-time errors in an orderly fashion. Using exception handling, your program can automatically invoke an error-handling routine when an error +T +occurs. The principal advantage of exception handling is that it automates much of the error-handling code that previously had to be coded "by hand" in any large program. + + +Exception Handling Fundamentals +C++ exception handling is built upon three keywords: try, catch, and throw. In the most general terms, program statements that you want to monitor for exceptions are contained in a try block. If an exception (i.e., an error) occurs within the try block, it is thrown (using throw). The exception is caught, using catch, and processed. The following discussion elaborates upon this general description. +Code that you want to monitor for exceptions must have been executed from within a try block. (Functions called from within a try block may also throw an exception.) Exceptions that can be thrown by the monitored code are caught by a catch statement, which immediately follows the try statement in which the exception was thrown. The general form of try and catch are shown here. + +try { +// try block } +catch (type1 arg) { // catch block +} +catch (type2 arg) { // catch block +} +catch (type3 arg) { // catch block +} . . . +catch (typeN arg) { // catch block +} + +The try can be as short as a few statements within one function or as all-encompassing as enclosing the main() function code within a try block (which effectively causes the entire program to be monitored). +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 491 + + +When an exception is thrown, it is caught by its corresponding catch statement, which processes the exception. There can be more than one catch statement associated with a try. Which catch statement is used is determined by the type of the exception. That is, if the data type specified by a catch matches that of the exception, then that catch statement is executed (and all others are bypassed). When an exception is caught, arg will receive its value. Any type of data may be caught, including classes that you create. If no exception is thrown (that is, no error occurs within the try block), then no catch statement is executed. +The general form of the throw statement is shown here: + +throw exception; + +throw generates the exception specified by exception. If this exception is to be caught, then throw must be executed either from within a try block itself, or from any function called from within the try block (directly or indirectly). +If you throw an exception for which there is no applicable catch statement, an abnormal program termination may occur. Throwing an unhandled exception causes the standard library function terminate() to be invoked. By default, terminate() calls abort() to stop your program, but you can specify your own termination handler, as described later in this chapter. +Here is a simple example that shows the way C++ exception handling operates. + + +// A simple exception handling example. #include +using namespace std; + +int main() { +cout << "Start\n"; + +try { // start a try block +cout << "Inside try block\n"; throw 100; // throw an error cout << "This will not execute"; +} +catch (int i) { // catch an error +cout << "Caught an exception -- value is: "; cout << i << "\n"; +} + +cout << "End"; +492 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return 0; } + +This program displays the following output: + +Start +Inside try block +Caught an exception -- value is: 100 End + +Look carefully at this program. As you can see, there is a try block containing three statements and a catch(int i) statement that processes an integer exception. Within the try block, only two of the three statements will execute: the first cout statement and the throw. Once an exception has been thrown, control passes to the catch expression and the try block is terminated. That is, catch is not called. Rather, program execution is transferred to it. (The program's stack is automatically reset as needed to accomplish this.) Thus, the cout statement following the throw will never execute. +Usually, the code within a catch statement attempts to remedy an error by taking appropriate action. If the error can be fixed, execution will continue with the statements following the catch. However, often an error cannot be fixed and a catch block will terminate the program with a call to exit() or abort() . +As mentioned, the type of the exception must match the type specified in a catch statement. For example, in the preceding example, if you change the type in the catch statement to double, the exception will not be caught and abnormal termination will occur. This change is shown here. + + +// This example will not work. #include +using namespace std; + +int main() { +cout << "Start\n"; + +try { // start a try block +cout << "Inside try block\n"; throw 100; // throw an error cout << "This will not execute"; +} +catch (double i) { // won't work for an int exception cout << "Caught an exception -- value is: "; +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 493 + + + +cout << i << "\n"; } + +cout << "End"; + +return 0; } + +This program produces the following output because the integer exception will not be caught by the catch(double i) statement. + + +Start +Inside try block +Abnormal program termination + +An exception can be thrown from outside the try block as long as it is thrown by a function that is called from within try block. For example, this is a valid program. + + +/* Throwing an exception from a function outside the try block. +*/ +#include using namespace std; + +void Xtest(int test) { +cout << "Inside Xtest, test is: " << test << "\n"; if(test) throw test; +} + +int main() { +cout << "Start\n"; + +try { // start a try block +cout << "Inside try block\n"; Xtest(0); +Xtest(1); Xtest(2); +} +catch (int i) { // catch an error +494 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << "Caught an exception -- value is: "; cout << i << "\n"; +} + +cout << "End"; + +return 0; } + +This program produces the following output: + +Start +Inside try block +Inside Xtest, test is: 0 Inside Xtest, test is: 1 +Caught an exception -- value is: 1 End + +A try block can be localized to a function. When this is the case, each time the function is entered, the exception handling relative to that function is reset. For example, examine this program. + + +#include using namespace std; + +// Localize a try/catch to a function. void Xhandler(int test) +{ +try{ +if(test) throw test; } +catch(int i) { +cout << "Caught Exception #: " << i << '\n'; } +} + +int main() { +cout << "Start\n"; + +Xhandler(1); +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 495 + + + +Xhandler(2); Xhandler(0); Xhandler(3); + +cout << "End"; + +return 0; } + + +This program displays this output: + +Start +Caught Exception #: 1 Caught Exception #: 2 Caught Exception #: 3 End + +As you can see, three exceptions are thrown. After each exception, the function returns. When the function is called again, the exception handling is reset. +It is important to understand that the code associated with a catch statement will be executed only if it catches an exception. Otherwise, execution simply bypasses the +catch altogether. (That is, execution never flows into a catch statement.) For example, in the following program, no exception is thrown, so the catch statement does not execute. + +#include using namespace std; + +int main() { +cout << "Start\n"; + +try { // start a try block +cout << "Inside try block\n"; +cout << "Still inside try block\n"; } +catch (int i) { // catch an error +cout << "Caught an exception -- value is: "; cout << i << "\n"; +} +496 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << "End"; + +return 0; } + +The preceding program produces the following output. + +Start +Inside try block +Still inside try block End + +As you see, the catch statement is bypassed by the flow of execution. + +Catching Class Types +An exception can be of any type, including class types that you create. Actually, in +real-world programs, most exceptions will be class types rather than built-in types. Perhaps the most common reason that you will want to define a class type for an exception is to create an object that describes the error that occurred. This information can be used by the exception handler to help it process the error. The following example demonstrates this. + + +// Catching class type exceptions. #include +#include using namespace std; + +class MyException { public: +char str_what[80]; int what; + +MyException() { *str_what = 0; what = 0; } + +MyException(char *s, int e) { strcpy(str_what, s); +what = e; } +}; +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 497 + + + +int main() { +int i; + +try { +cout << "Enter a positive number: "; cin >> i; +if(i<0) +throw MyException("Not Positive", i); } +catch (MyException e) { // catch an error cout << e.str_what << ": "; +cout << e.what << "\n"; } + +return 0; } + + +Here is a sample run: + +Enter a positive number: -4 Not Positive: -4 + +The program prompts the user for a positive number. If a negative number is entered, an object of the class MyException is created that describes the error. Thus, MyException encapsulates information about the error. This information is then used by the exception handler. In general, you will want to create exception classes that will encapsulate information about an error to enable the exception handler to respond effectively. + +Using Multiple catch Statements +As stated, you can have more than one catch associated with a try. In fact, it is common to do so. However, each catch must catch a different type of exception. For example, this program catches both integers and strings. + + +#include using namespace std; + +// Different types of exceptions can be caught. +498 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void Xhandler(int test) { +try{ +if(test) throw test; +else throw "Value is zero"; } +catch(int i) { +cout << "Caught Exception #: " << i << '\n'; } +catch(const char *str) { +cout << "Caught a string: "; cout << str << '\n'; +} } + +int main() { +cout << "Start\n"; + +Xhandler(1); Xhandler(2); Xhandler(0); Xhandler(3); + +cout << "End"; + +return 0; } + +This program produces the following output: + +Start +Caught Exception #: 1 Caught Exception #: 2 +Caught a string: Value is zero Caught Exception #: 3 +End + + +As you can see, each catch statement responds only to its own type. +In general, catch expressions are checked in the order in which they occur in a program. Only a matching statement is executed. All other catch blocks are ignored. +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 499 + + +Handling Derived-Class Exceptions +You need to be careful how you order your catch statements when trying to catch exception types that involve base and derived classes because a catch clause for a base class will also match any class derived from that base. Thus, if you want to catch exceptions of both a base class type and a derived class type, put the derived class first in the catch sequence. If you don't do this, the base class catch will also catch all derived classes. For example, consider the following program. + + + +// Catching derived classes. #include +using namespace std; + +class B { }; + +class D: public B { }; + +int main() { +D derived; + +try { +throw derived; } +catch(B b) { +cout << "Caught a base class.\n"; } +catch(D d) { +cout << "This won't execute.\n"; } + +return 0; } + + +Here, because derived is an object that has B as a base class, it will be caught by the first catch clause and the second clause will never execute. Some compilers will flag this condition with a warning message. Others may issue an error. Either way, to fix this condition, reverse the order of the catch clauses. +500 C + + : T h e C o m p l e t e R e f e r e n c e + + +Exception Handling Options +There are several additional features and nuances to C++ exception handling that make it easier and more convenient to use. These attributes are discussed here. + +Catching All Exceptions +In some circumstances you will want an exception handler to catch all exceptions instead of just a certain type. This is easy to accomplish. Simply use this form of catch. + +catch(...) { +// process all exceptions } + +Here, the ellipsis matches any type of data. The following program illustrates catch(...). + +// This example catches all exceptions. #include +using namespace std; + +void Xhandler(int test) { +try{ +if(test==0) throw test; // throw int if(test==1) throw 'a'; // throw char if(test==2) throw 123.23; // throw double +} +catch(...) { // catch all exceptions cout << "Caught One!\n"; +} } + +int main() { +cout << "Start\n"; + +Xhandler(0); Xhandler(1); Xhandler(2); + +cout << "End"; +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 501 + + + +return 0; } + + +This program displays the following output. + +Start Caught One! Caught One! Caught One! End + +As you can see, all three throws were caught using the one catch statement. +One very good use for catch(...) is as the last catch of a cluster of catches. In this capacity it provides a useful default or "catch all" statement. For example, this slightly different version of the preceding program explicity catches integer exceptions but relies upon catch(...) to catch all others. + + +// This example uses catch(...) as a default. #include +using namespace std; + +void Xhandler(int test) { +try{ +if(test==0) throw test; // throw int if(test==1) throw 'a'; // throw char if(test==2) throw 123.23; // throw double +} +catch(int i) { // catch an int exception cout << "Caught an integer\n"; +} +catch(...) { // catch all other exceptions cout << "Caught One!\n"; +} } + +int main() { +cout << "Start\n"; +502 C + + : T h e C o m p l e t e R e f e r e n c e + + + +Xhandler(0); Xhandler(1); Xhandler(2); + +cout << "End"; + +return 0; } + +The output produced by this program is shown here. + +Start +Caught an integer Caught One! Caught One! +End + +As this example suggests, using catch(...) as a default is a good way to catch all exceptions that you don't want to handle explicitly. Also, by catching all exceptions, you prevent an unhandled exception from causing an abnormal program termination. + +Restricting Exceptions +You can restrict the type of exceptions that a function can throw outside of itself. In +fact, you can also prevent a function from throwing any exceptions whatsoever. To accomplish these restrictions, you must add a throw clause to a function definition. The general form of this is shown here: + +ret-type func-name(arg-list) throw(type-list) { +// ... } + +Here, only those data types contained in the comma-separated type-list may be thrown by the function. Throwing any other type of expression will cause abnormal program termination. If you don't want a function to be able to throw any exceptions, then use an empty list. +Attempting to throw an exception that is not supported by a function will cause the standard library function unexpected() to be called. By default, this causes abort() to be called, which causes abnormal program termination. However, you can specify your own unexpected handler if you like, as described later in this chapter. +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 503 + + +The following program shows how to restrict the types of exceptions that can be thrown from a function. + + +// Restricting function throw types. #include +using namespace std; + +// This function can only throw ints, chars, and doubles. void Xhandler(int test) throw(int, char, double) +{ +if(test==0) throw test; // throw int if(test==1) throw 'a'; // throw char if(test==2) throw 123.23; // throw double +} + +int main() { +cout << "start\n"; + +try{ +Xhandler(0); // also, try passing 1 and 2 to Xhandler() } +catch(int i) { +cout << "Caught an integer\n"; } +catch(char c) { +cout << "Caught char\n"; } +catch(double d) { +cout << "Caught double\n"; } + +cout << "end"; + +return 0; } + +In this program, the function Xhandler() may only throw integer, character, and double exceptions. If it attempts to throw any other type of exception, an abnormal program termination will occur. (That is, unexpected() will be called.) To see an example of this, remove int from the list and retry the program. +It is important to understand that a function can be restricted only in what types of exceptions it throws back to the try block that called it. That is, a try block within a +504 C + + : T h e C o m p l e t e R e f e r e n c e + + +function may throw any type of exception so long as it is caught within that function. The restriction applies only when throwing an exception outside of the function. +The following change to Xhandler() prevents it from throwing any exceptions. + + +// This function can throw NO exceptions! void Xhandler(int test) throw() +{ +/* The following statements no longer work. Instead, they will cause an abnormal program termination. */ +if(test==0) throw test; if(test==1) throw 'a'; if(test==2) throw 123.23; +} + + +Note + +At the time of this writing, Microsoft's Visual C++ does not support the throw( ) clause for functions. + + +Rethrowing an Exception +If you wish to rethrow an expression from within an exception handler, you may do so +by calling throw, by itself, with no exception. This causes the current exception to be passed on to an outer try/catch sequence. The most likely reason for doing so is to allow multiple handlers access to the exception. For example, perhaps one exception handler manages one aspect of an exception and a second handler copes with another. An exception can only be rethrown from within a catch block (or from any function called from within that block). When you rethrow an exception, it will not be recaught by the same catch statement. It will propagate outward to the next catch statement. The following program illustrates rethrowing an exception, in this case a char * exception. + + +// Example of "rethrowing" an exception. #include +using namespace std; + +void Xhandler() { +try { +throw "hello"; // throw a char * } +catch(const char *) { // catch a char * +cout << "Caught char * inside Xhandler\n"; throw ; // rethrow char * out of function +} } +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 505 + + + + +int main() { +cout << "Start\n"; + +try{ Xhandler(); +} +catch(const char *) { +cout << "Caught char * inside main\n"; } + +cout << "End"; + +return 0; } + +This program displays this output: + +Start +Caught char * inside Xhandler Caught char * inside main +End + + +Understanding terminate( ) and unexpected( ) As mentioned earlier, terminate() and unexpected() are called when something goes wrong during the exception handling process. These functions are supplied by the Standard C++ library. Their prototypes are shown here: + +void terminate( ); void unexpected( ); + +These functions require the header . +The terminate() function is called whenever the exception handling subsystem fails to find a matching catch statement for an exception. It is also called if your program attempts to rethrow an exception when no exception was originally thrown. The terminate() function is also called under various other, more obscure circumstances. For example, such a circumstance could occur when, in the process of unwinding the stack because of an exception, a destructor for an object being destroyed throws an exception. In general, terminate() is the handler of last resort when no other handlers for an exception are available. By default, terminate() calls abort() . +506 C + + : T h e C o m p l e t e R e f e r e n c e + + +The unexpected() function is called when a function attempts to throw an exception that is not allowed by its throw list. By default, unexpected() calls terminate() . + +Setting the Terminate and Unexpected Handlers +The terminate() and unexpected() functions simply call other functions to actually +handle an error. As just explained, by default terminate() calls abort() , and unexpected() calls terminate() . Thus, by default, both functions halt program execution when an exception handling error occurs. However, you can change the functions that are called by terminate() and unexpected() . Doing so allows your program to take full control of the exception handling subsystem. +To change the terminate handler, use set_terminate() , shown here: + +terminate_handler set_terminate(terminate_handler newhandler) throw( ); + +Here, newhandler is a pointer to the new terminate handler. The function returns a pointer to the old terminate handler. The new terminate handler must be of type terminate_handler, which is defined like this: + +typedef void (*terminate_handler) ( ); + +The only thing that your terminate handler must do is stop program execution. It must not return to the program or resume it in any way. +To change the unexpected handler, use set_unexpected() , shown here: + +unexpected_handler set_unexpected(unexpected_handler newhandler) throw( ); + +Here, newhandler is a pointer to the new unexpected handler. The function returns a pointer to the old unexpected handler. The new unexpected handler must be of type unexpected_handler, which is defined like this: + +typedef void (*unexpected_handler) ( ); + +This handler may itself throw an exception, stop the program, or call terminate() . However, it must not return to the program. +Both set_terminate() and set_unexpected() require the header . Here is an example that defines its own terminate() handler. + +// Set a new terminate handler. #include +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 507 + + + +#include #include using namespace std; + +void my_Thandler() { +cout << "Inside new terminate handler\n"; abort(); +} + +int main() { +// set a new terminate handler set_terminate(my_Thandler); + +try { +cout << "Inside try block\n"; throw 100; // throw an error +} +catch (double i) { // won't catch an int exception // ... +} + +return 0; } + +The output from this program is shown here. + +Inside try block +Inside new terminate handler abnormal program termination + +The uncaught_exception( ) Function +The C++ exception handling subsystem supplies one other function that you may find useful: uncaught_exception() . Its prototype is shown here: + +bool uncaught_exception( ); + +This function returns true if an exception has been thrown but not yet caught. Once caught, the function returns false. +508 C + + : T h e C o m p l e t e R e f e r e n c e + + +The exception and bad_exception Classes +When a function supplied by the C++ standard library throws an exception, it will be an object derived from the base class exception. An object of the class bad_exception can be thrown by the unexpected handler. These classes require the header . + + +Applying Exception Handling +Exception handling is designed to provide a structured means by which your program can handle abnormal events. This implies that the error handler must do something rational when an error occurs. For example, consider the following simple program. It inputs two numbers and divides the first by the second. It uses exception handling to manage a divide-by-zero error. + + +#include using namespace std; + +void divide(double a, double b); + +int main() { +double i, j; + +do { +cout << "Enter numerator (0 to stop): "; cin >> i; +cout << "Enter denominator: "; cin >> j; +divide(i, j); } while(i != 0); + +return 0; } + +void divide(double a, double b) { +try { +if(!b) throw b; // check for divide-by-zero cout << "Result: " << a/b << endl; +} +catch (double b) { +cout << "Can't divide by zero.\n"; +C h a p t e r 1 9 : E x c e p t i o n H a n d l i n g 509 + + + +} } + +While the preceding program is a very simple example, it does illustrate the essential nature of exception handling. Since division by zero is illegal, the program cannot continue if a zero is entered for the second number. In this case, the exception is handled by not performing the division (which would have caused abnormal program termination) and notifying the user of the error. The program then reprompts the user for two more numbers. Thus, the error has been handled in an orderly fashion and the user may continue on with the program. The same basic concepts will apply to more complex applications of exception handling. +Exception handling is especially useful for exiting from a deeply nested set of routines when a catastrophic error occurs. In this regard, C++'s exception handling is designed to replace the rather clumsy C-based setjmp() and longjmp() functions. +Remember, the key point about using exception handling is to provide an orderly way of handling errors. This means rectifying the situation, if possible. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 20 The C++ I/O System Basics + + + + + + + + + + + + + + +511 +512 C + + : T h e C o m p l e t e R e f e r e n c e + + +++ supports two complete I/O systems: the one inherited from C and the +C +object-oriented I/O system defined by C++ (hereafter called simply the C++ I/O system). The C-based I/O system was discussed in Part One. Here we will begin +to examine the C++ I/O system. Like C-based I/O, C++'s I/O system is fully integrated. The different aspects of C++'s I/O system, such as console I/O and disk I/O, are actually just different perspectives on the same mechanism. This chapter discusses the foundations of the C++ I/O system. Although the examples in this chapter use "console" I/O, the information is applicable to other devices, including disk files (discussed in Chapter 21). +Since the I/O system inherited from C is extremely rich, flexible, and powerful, you might be wondering why C++ defines yet another system. The answer is that C's I/O system knows nothing about objects. Therefore, for C++ to provide complete support for object-oriented programming, it was necessary to create an I/O system that could operate on user-defined objects. In addition to support for objects, there are several benefits to using C++'s I/O system even in programs that don't make extensive (or any) use of user-defined objects. Frankly, for all new code, you should use the C++ I/O system. The C I/O is supported by C++ only for compatibility. +This chapter explains how to format data, how to overload the << and >> I/O operators so they can be used with classes that you create, and how to create special I/O functions called manipulators that can make your programs more efficient. + + +Old vs. Modern C++ I/O +There are currently two versions of the C++ object-oriented I/O library in use: the older one that is based upon the original specifications for C++ and the newer one defined by Standard C++. The old I/O library is supported by the header file . The new I/O library is supported by the header . For the most part the two libraries appear the same to the programmer. This is because the new I/O library is, in essence, simply an updated and improved version of the old one. In fact, the vast majority of differences between the two occur beneath the surface, in the way that the libraries are implemented—not in how they are used. +From the programmer's perspective, there are two main differences between the old and new C++ I/O libraries. First, the new I/O library contains a few additional features and defines some new data types. Thus, the new I/O library is essentially a superset of the old one. Nearly all programs originally written for the old library will compile without substantive changes when the new library is used. Second, the +old-style I/O library was in the global namespace. The new-style library is in the std namespace. (Recall that the std namespace is used by all of the Standard C++ libraries.) Since the old-style I/O library is now obsolete, this book describes only the new I/O library, but most of the information is applicable to the old I/O library as well. +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 513 + + +C++ Streams +Like the C-based I/O system, the C++ I/O system operates through streams. Streams were discussed in detail in Chapter 9; that discussion will not be repeated here. However, to summarize: A stream is a logical device that either produces or consumes information. A stream is linked to a physical device by the I/O system. All streams behave in the same way even though the actual physical devices they are connected to may differ substantially. Because all streams behave the same, the same I/O functions can operate on virtually any type of physical device. For example, you can use the same function that writes to a file to write to the printer or to the screen. The advantage to this approach is that you need learn only one I/O system. + + +The C++ Stream Classes +As mentioned, Standard C++ provides support for its I/O system in . In this header, a rather complicated set of class hierarchies is defined that supports I/O operations. The I/O classes begin with a system of template classes. As explained in Chapter 18, a template class defines the form of a class without fully specifying the data upon which it will operate. Once a template class has been defined, specific instances of it can be created. As it relates to the I/O library, Standard C++ creates two specializations of the I/O template classes: one for 8-bit characters and another for wide characters. This book will use only the 8-bit character classes since they are by far the most common. But the same techniques apply to both. +The C++ I/O system is built upon two related but different template class hierarchies. The first is derived from the low-level I/O class called basic_streambuf. This class supplies the basic, low-level input and output operations, and provides the underlying support for the entire C++ I/O system. Unless you are doing advanced I/O programming, you will not need to use basic_streambuf directly. The class hierarchy that you will most commonly be working with is derived from basic_ios. This is a +high-level I/O class that provides formatting, error checking, and status information related to stream I/O. (A base class for basic_ios is called ios_base, which defines several nontemplate traits used by basic_ios.) basic_ios is used as a base for several derived classes, including basic_istream, basic_ostream, and basic_iostream. These classes are used to create streams capable of input, output, and input/output, respectively. +As explained, the I/O library creates two specializations of the template class hierarchies just described: one for 8-bit characters and one for wide characters. Here is a list of the mapping of template class names to their character and wide-character versions. +514 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Template Class + + +basic_streambuf basic_ios basic_istream basic_ostream basic_iostream basic_fstream basic_ifstream +basic_ofstream + +Character-based Class +streambuf ios istream ostream iostream fstream ifstream +ofstream + +Wide-Character-based Class +wstreambuf wios wistream wostream wiostream wfstream wifstream +wofstream + + +The character-based names will be used throughout the remainder of this book, since they are the names that you will normally use in your programs. They are also the same names that were used by the old I/O library. This is why the old and the new I/O library are compatible at the source code level. +One last point: The ios class contains many member functions and variables that control or monitor the fundamental operation of a stream. It will be referred to frequently. Just remember that if you include in your program, you will have access to this important class. + +C++'s Predefined Streams +When a C++ program begins execution, four built-in streams are automatically opened. They are: + + +Stream Meaning + +cin Standard input cout Standard output +cerr Standard error output +clog Buffered version of cerr + +Default Device + +Keyboard Screen Screen +Screen + + +Streams cin, cout, and cerr correspond to C's stdin, stdout, and stderr. +By default, the standard streams are used to communicate with the console. However, in environments that support I/O redirection (such as DOS, Unix, OS/2, and Windows), the standard streams can be redirected to other devices or files. For the sake of simplicity, the examples in this chapter assume that no I/O redirection has occurred. +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 515 + + +Standard C++ also defines these four additional streams: win, wout, werr, and wlog. These are wide-character versions of the standard streams. Wide characters are of type wchar_t and are generally 16-bit quantities. Wide characters are used to hold the large character sets associated with some human languages. + + +Formatted I/O +The C++ I/O system allows you to format I/O operations. For example, you can set a field width, specify a number base, or determine how many digits after the decimal point will be displayed. There are two related but conceptually different ways that you can format data. First, you can directly access members of the ios class. Specifically, you can set various format status flags defined inside the ios class or +call various ios member functions. Second, you can use special functions called manipulators that can be included as part of an I/O expression. +We will begin the discussion of formatted I/O by using the ios member functions and flags. + +Formatting Using the ios Members +Each stream has associated with it a set of format flags that control the way +information is formatted. The ios class declares a bitmask enumeration called fmtflags in which the following values are defined. (Technically, these values are defined within ios_base, which, as explained earlier, is a base class for ios.) + + +adjustfield fixed +left showbase +unitbuf + +basefield floatfield oct showpoint +uppercase + +boolalpha hex +right +showpos + +dec internal scientific +skipws + + +These values are used to set or clear the format flags. If you are using an older compiler, it may not define the fmtflags enumeration type. In this case, the format flags will be encoded into a long integer. +When the skipws flag is set, leading white-space characters (spaces, tabs, and newlines) are discarded when performing input on a stream. When skipws is cleared, white-space characters are not discarded. +When the left flag is set, output is left justified. When right is set, output is right justified. When the internal flag is set, a numeric value is padded to fill a field by inserting spaces between any sign or base character. If none of these flags are set, output is right justified by default. +516 C + + : T h e C o m p l e t e R e f e r e n c e + + +By default, numeric values are output in decimal. However, it is possible to change the number base. Setting the oct flag causes output to be displayed in octal. Setting the hex flag causes output to be displayed in hexadecimal. To return output to decimal, set the dec flag. +Setting showbase causes the base of numeric values to be shown. For example, if the conversion base is hexadecimal, the value 1F will be displayed as 0x1F. +By default, when scientific notation is displayed, the e is in lowercase. Also, when a hexadecimal value is displayed, the x is in lowercase. When uppercase is set, these characters are displayed in uppercase. +Setting showpos causes a leading plus sign to be displayed before positive values. Setting showpoint causes a decimal point and trailing zeros to be displayed for all +floating-point output—whether needed or not. +By setting the scientific flag, floating-point numeric values are displayed using scientific notation. When fixed is set, floating-point values are displayed using normal notation. When neither flag is set, the compiler chooses an appropriate method. +When unitbuf is set, the buffer is flushed after each insertion operation. +When boolalpha is set, Booleans can be input or output using the keywords true and false. +Since it is common to refer to the oct, dec, and hex fields, they can be collectively referred to as basefield. Similarly, the left, right, and internal fields can be referred to as adjustfield. Finally, the scientific and fixed fields can be referenced as floatfield. + +Setting the Format Flags +To set a flag, use the setf() function. This function is a member of ios. Its most common form is shown here: + +fmtflags setf(fmtflags flags); + +This function returns the previous settings of the format flags and turns on those flags specified by flags. For example, to turn on the showpos flag, you can use this statement: + + +stream.setf(ios::showpos); + +Here, stream is the stream you wish to affect. Notice the use of ios:: to qualify showpos. Since showpos is an enumerated constant defined by the ios class, it must be qualified by ios when it is used. +The following program displays the value 100 with the showpos and showpoint flags turned on. +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 517 + + +#include using namespace std; + +int main() { +cout.setf(ios::showpoint); cout.setf(ios::showpos); + +cout << 100.0; // displays +100.0 + +return 0; } + +It is important to understand that setf() is a member function of the ios class and affects streams created by that class. Therefore, any call to setf() is done relative to a specific stream. There is no concept of calling setf() by itself. Put differently, there is no concept in C++ of global format status. Each stream maintains its own format status information individually. +Although there is nothing technically wrong with the preceding program, there is a more efficient way to write it. Instead of making multiple calls to setf() , you can simply OR together the values of the flags you want set. For example, this single call accomplishes the same thing: + +// You can OR together two or more flags, cout.setf(ios::showpoint | ios::showpos); + + +Remember + +Because the format flags are defined within the ios class, you must access their values by using ios and the scope resolution operator. For example, showbase by itself will not be recognized. You must specify ios::showbase. + + +Clearing Format Flags +The complement of setf() is unsetf() . This member function of ios is used to clear one or more format flags. Its general form is + +void unsetf(fmtflags flags); + +The flags specified by flags are cleared. (All other flags are unaffected.) The previous flag settings are returned. +The following program illustrates unsetf() . It first sets both the uppercase and scientific flags. It then outputs 100.12 in scientific notation. In this case, the "E" used +518 C + + : T h e C o m p l e t e R e f e r e n c e + + +in the scientific notation is in uppercase. Next, it clears the uppercase flag and again outputs 100.12 in scientific notation, using a lowercase "e." + + +#include using namespace std; + +int main() { +cout.setf(ios::uppercase | ios::scientific); + +cout << 100.12; // displays 1.0012E+02 + +cout.unsetf(ios::uppercase); // clear uppercase + +cout << " \n" << 100.12; // displays 1.0012e+02 + +return 0; } + +An Overloaded Form of setf( ) +There is an overloaded form of setf() that takes this general form: + +fmtflags setf(fmtflags flags1, fmtflags flags2); + +In this version, only the flags specified by flags2 are affected. They are first cleared and then set according to the flags specified by flags1. Note that even if flags1 contains other flags, only those specified by flags2 will be affected. The previous flags setting is returned. For example, + + +#include using namespace std; + +int main( ) { +cout.setf(ios::showpoint | ios::showpos, ios::showpoint); + +cout << 100.0; // displays 100.0, not +100.0 + +return 0; } +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 519 + + +Here, showpoint is set, but not showpos, since it is not specified in the second parameter. +Perhaps the most common use of the two-parameter form of setf() is when setting the number base, justification, and format flags. As explained, references to the oct, dec, and hex fields can collectively be referred to as basefield. Similarly, the left, right, and internal fields can be referred to as adjustfield. Finally, the scientific and fixed fields can be referenced as floatfield. Since the flags that comprise these groupings are mutually exclusive, you may need to turn off one flag when setting another. For example, the following program sets output to hexadecimal. To output in hexadecimal, some implementations require that the other number base flags be turned off in addition to turning on the hex flag. This is most easily accomplished using the +two-parameter form of setf() . + +#include using namespace std; + +int main() { +cout.setf(ios::hex, ios::basefield); + +cout << 100; // this displays 64 + +return 0; } + +Here, the basefield flags (i.,e., dec, oct, and hex) are first cleared and then the hex flag is set. +Remember, only the flags specified in flags2 can be affected by flags specified by flags1. For example, in this program, the first attempt to set the showpos flag fails. + + +// This program will not work. #include +using namespace std; + +int main() { +cout.setf(ios::showpos, ios::hex); // error, showpos not set + +cout << 100 << '\n'; // displays 100, not +100 + +cout.setf(ios::showpos, ios::showpos); // this is correct +520 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << 100; // now displays +100 + +return 0; } + +Keep in mind that most of the time you will want to use unsetf() to clear flags and the single parameter version of setf() (described earlier) to set flags. The setf(fmtflags, fmtflags) version of setf() is most often used in specialized situations, such as setting the number base. Another good use may involve a situation in which you are using a flag template that specifies the state of all format flags but wish to alter only one or two. In this case, you could specify the template in flags1 and use flags2 to specify which of those flags will be affected. + +Examining the Formatting Flags +There will be times when you only want to know the current format settings but not +alter any. To accomplish this goal, ios includes the member function flags() , which simply returns the current setting of each format flag. Its prototype is shown here: + +fmtflags flags( ); + +The following program uses flags() to display the setting of the format flags relative to cout. Pay special attention to the showflags() function. You might find it useful in programs you write. + + +#include using namespace std; + +void showflags() ; + +int main() { +// show default condition of format flags showflags(); + +cout.setf(ios::right | ios::showpoint | ios::fixed); + +showflags(); + +return 0; } +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 521 + + + + +// This function displays the status of the format flags. void showflags() +{ +ios::fmtflags f; long i; + +f = (long) cout.flags(); // get flag settings + +// check each flag for(i=0x4000; i; i = i >> 1) +if(i & f) cout << "1 "; else cout << "0 "; + +cout << " \n"; } + +The output from the program is shown here: + +0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 + +Setting All Flags +The flags() function has a second form that allows you to set all format flags associated with a stream. The prototype for this version of flags() is shown here: + +fmtflags flags(fmtflags f); + +When you use this version, the bit pattern found in f is used to set the format flags associated with the stream. Thus, all format flags are affected. The function returns the previous settings. +The next program illustrates this version of flags() . It first constructs a flag mask that turns on showpos, showbase, oct, and right. All other flags are off. It then uses flags() to set the format flags associated with cout to these settings. The function showflags() verifies that the flags are set as indicated. (It is the same function used in the previous program.) + +#include using namespace std; +522 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void showflags(); + +int main() { +// show default condition of format flags showflags(); + +// showpos, showbase, oct, right are on, others off +long f = ios::showpos | ios::showbase | ios::oct | ios::right; cout.flags(f); // set all flags + +showflags(); + +return 0; } + + +Using width( ), precision( ), and fill( ) +In addition to the formatting flags, there are three member functions defined by ios +that set these format parameters: the field width, the precision, and the fill character. The functions that do these things are width() , precision() , and fill() , respectively. Each is examined in turn. +By default, when a value is output, it occupies only as much space as the number of characters it takes to display it. However, you can specify a minimum field width by using the width() function. Its prototype is shown here: + +streamsize width(streamsize w); + +Here, w becomes the field width, and the previous field width is returned. In some implementations, the field width must be set before each output. If it isn't, the default field width is used. The streamsize type is defined as some form of integer by the compiler. +After you set a minimum field width, when a value uses less than the specified width, the field will be padded with the current fill character (space, by default) to reach the field width. If the size of the value exceeds the minimum field width, the field will be overrun. No values are truncated. +When outputting floating-point values, you can determine the number of digits to be displayed after the decimal point by using the precision() function. Its prototype is shown here: + +streamsize precision(streamsize p); +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 523 + + +Here, the precision is set to p, and the old value is returned. The default precision is 6. In some implementations, the precision must be set before each floating-point output. If it is not, then the default precision will be used. +By default, when a field needs to be filled, it is filled with spaces. You can specify the fill character by using the fill() function. Its prototype is + +char fill(char ch); + +After a call to fill() , ch becomes the new fill character, and the old one is returned. Here is a program that illustrates these functions: + + +#include using namespace std; + +int main() { +cout.precision(4) ; cout.width(10); + +cout << 10.12345 << "\n"; // displays 10.12 + +cout.fill('*'); + +cout.width(10); +cout << 10.12345 << "\n"; // displays *****10.12 + +// field width applies to strings, too cout.width(10); +cout << "Hi!" << "\n"; // displays *******Hi! cout.width(10); +cout.setf(ios::left); // left justify cout << 10.12345; // displays 10.12***** + +return 0; } + +This program's output is shown here: + +10.12 *****10.12 *******Hi! 10.12***** +524 C + + : T h e C o m p l e t e R e f e r e n c e + + +There are overloaded forms of width() , precision() , and fill() that obtain but do not change the current setting. These forms are shown here: + +char fill( ); streamsize width( ); +streamsize precision( ); + +Using Manipulators to Format I/O +The second way you can alter the format parameters of a stream is through the use of special functions called manipulators that can be included in an I/O expression. The standard manipulators are shown in Table 20-1. As you can see by examining the table, many of the I/O manipulators parallel member functions of the ios class. Many of the manipulators were added recently to C++ and will not be supported by older compilers. + + + + + +Manipulator + +boolalpha dec +endl + +ends fixed flush hex internal left +nobooalpha noshowbase noshowpoint +noshowpos + +Purpose + +Turns on boolapha flag. Turns on dec flag. +Output a newline character and flush the stream. +Output a null. Turns on fixed flag. Flush a stream. Turns on hex flag. +Turns on internal flag. Turns on left flag. +Turns off boolalpha flag. Turns off showbase flag. Turns off showpoint flag. +Turns off showpos flag. + +Input/Output + +Input/Output Input/Output Output + +Output Output Output Input/Output Output Output Input/Output Output Output +Output + + + +Table 20-1. The C++ Manipulators +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 525 + + + + +Manipulator + +noskipws nounitbuf nouppercase oct +resetiosflags (fmtflags f) + +right scientific +setbase(int base) + +setfill(int ch) setiosflags(fmtflags f) + +setprecision (int p) + +setw(int w) showbase showpoint showpos skipws unitbuf uppercase +ws + +Purpose + +Turns off skipws flag. Turns off unitbuf flag. Turns off uppercase flag. Turns on oct flag. +Turn off the flags specified in f. +Turns on right flag. Turns on scientific flag. +Set the number base to base. +Set the fill character to ch. +Turn on the flags specified in f. +Set the number of digits of precision. +Set the field width to w. Turns on showbase flag. Turns on showpoint flag. Turns on showpos flag. Turns on skipws flag. Turns on unitbuf flag. Turns on uppercase flag. +Skip leading white space. + +Input/Output + +Input Output Output +Input/Output Input/Output + +Output Output Input/Output + +Output Input/output + +Output + +Output Output Output Output Input Output Output +Input + + + +Table 20-1. The C++ Manipulators (continued) + + + +To access manipulators that take parameters (such as setw() ), you must include in your program. +526 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here is an example that uses some manipulators: + +#include #include using namespace std; + +int main() { +cout << hex << 100 << endl; + +cout << setfill('?') << setw(10) << 2343.0; + +return 0; } + +This displays + +64 ??????2343 + +Notice how the manipulators occur within a larger I/O expression. Also notice that when a manipulator does not take an argument, such as endl() in the example, it is not followed by parentheses. This is because it is the address of the function that is passed to the overloaded << operator. +As a comparison, here is a functionally equivalent version of the preceding program that uses ios member functions to achieve the same results: + +#include #include using namespace std; + +int main() { +cout.setf(ios::hex, ios::basefield); cout << 100 << "\n"; // 100 in hex + +cout.fill('?'); cout.width(10); cout << 2343.0; + +return 0; } +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 527 + + +As the examples suggest, the main advantage of using manipulators instead of the ios member functions is that they commonly allow more compact code to be written. +You can use the setiosflags() manipulator to directly set the various format flags related to a stream. For example, this program uses setiosflags() to set the showbase and showpos flags: + +#include #include using namespace std; + +int main() { +cout << setiosflags(ios::showpos); cout << setiosflags(ios::showbase); cout << 123 << " " << hex << 123; + +return 0; } + +The manipulator setiosflags() performs the same function as the member function setf() . +One of the more interesting manipulators is boolapha. It allows true and false values to be input and output using the words "true" and "false" rather than numbers. For example, + + +#include using namespace std; + +int main() { +bool b; + +b = true; +cout << b << " " << boolalpha << b << endl; + +cout << "Enter a Boolean value: "; cin >> boolalpha >> b; +cout << "Here is what you entered: " << b; + +return 0; } +528 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here is a sample run. + +1 true +Enter a Boolean value: false Here is what you entered: false + +Overloading << and >> +As you know, the << and the >> operators are overloaded in C++ to perform I/O operations on C++'s built-in types. You can also overload these operators so that they perform I/O operations on types that you create. +In the language of C++, the << output operator is referred to as the insertion operator because it inserts characters into a stream. Likewise, the >> input operator is called the extraction operator because it extracts characters from a stream. The functions that overload the insertion and extraction operators are generally called inserters and extractors, respectively. + +Creating Your Own Inserters +It is quite simple to create an inserter for a class that you create. All inserter functions have this general form: + +ostream &operator<<(ostream &stream, class_type obj) { +// body of inserter return stream; +} + +Notice that the function returns a reference to a stream of type ostream. (Remember, ostream is a class derived from ios that supports output.) Further, the first parameter to the function is a reference to the output stream. The second parameter is the object being inserted. (The second parameter may also be a reference to the object being inserted.) The last thing the inserter must do before exiting is return stream. This allows the inserter to be used in a larger I/O expression. +Within an inserter function, you may put any type of procedures or operations that you want. That is, precisely what an inserter does is completely up to you. However, for the inserter to be in keeping with good programming practices, you should limit its operations to outputting information to a stream. For example, having an inserter compute pi to 30 decimal places as a side effect to an insertion operation is probably not a very good idea! +To demonstrate a custom inserter, one will be created for objects of type phonebook, shown here. + +class phonebook { public: +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 529 + + + +char name[80]; int areacode; int prefix; int num; +phonebook(char *n, int a, int p, int nm) { +strcpy(name, n); areacode = a; prefix = p; +num = nm; } +}; + + +This class holds a person's name and telephone number. Here is one way to create an inserter function for objects of type phonebook. + + +// Display name and phone number +ostream &operator<<(ostream &stream, phonebook o) { +stream << o.name << " "; +stream << "(" << o.areacode << ") "; +stream << o.prefix << "-" << o.num << "\n"; + +return stream; // must return stream } + +Here is a short program that illustrates the phonebook inserter function: + +#include #include using namespace std; + +class phonebook { public: +char name[80]; int areacode; int prefix; int num; +phonebook(char *n, int a, int p, int nm) { +strcpy(name, n); areacode = a; prefix = p; +num = nm; +530 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} }; + +// Display name and phone number. +ostream &operator<<(ostream &stream, phonebook o) { +stream << o.name << " "; +stream << "(" << o.areacode << ") "; +stream << o.prefix << "-" << o.num << "\n"; + +return stream; // must return stream } + +int main() { +phonebook a("Ted", 111, 555, 1234); phonebook b("Alice", 312, 555, 5768); phonebook c("Tom", 212, 555, 9991); + +cout << a << b << c; + +return 0; } + +The program produces this output: + +Ted (111) 555-1234 Alice (312) 555-5768 Tom (212) 555-9991 + +In the preceding program, notice that the phonebook inserter is not a member of phonebook. Although this may seem weird at first, the reason is easy to understand. When an operator function of any type is a member of a class, the left operand (passed implicitly through this) is the object that generates the call to the operator function. Further, this object is an object of the class for which the operator function is a member. There is no way to change this. If an overloaded operator function is a member of a class, the left operand must be an object of that class. However, when you overload inserters, the left operand is a stream and the right operand is an object of the class. Therefore, overloaded inserters cannot be members of the class for which they are overloaded. The variables name, areacode, prefix, and num are public in the preceding program so that they can be accessed by the inserter. +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 531 + + +The fact that inserters cannot be members of the class for which they are defined seems to be a serious flaw in C++. Since overloaded inserters are not members, how can they access the private elements of a class? In the foregoing program, all members were made public. However, encapsulation is an essential component of object-oriented programming. Requiring that all data that will be output be public conflicts with this principle. Fortunately, there is a solution to this dilemma: Make the inserter a friend of the class. This preserves the requirement that the first argument to the overloaded inserter be a stream and still grants the function access to the private members of the class for which it is overloaded. Here is the same program modified to make the inserter into a friend function: + + +#include #include using namespace std; + +class phonebook { // now private char name[80]; int areacode; int prefix; int num; +public: +phonebook(char *n, int a, int p, int nm) { +strcpy(name, n); areacode = a; prefix = p; +num = nm; } +friend ostream &operator<<(ostream &stream, phonebook o); }; + +// Display name and phone number. +ostream &operator<<(ostream &stream, phonebook o) { +stream << o.name << " "; +stream << "(" << o.areacode << ") "; +stream << o.prefix << "-" << o.num << "\n"; + +return stream; // must return stream } +532 C + + : T h e C o m p l e t e R e f e r e n c e + + + +int main() { +phonebook a("Ted", 111, 555, 1234); phonebook b("Alice", 312, 555, 5768); phonebook c("Tom", 212, 555, 9991); + +cout << a << b << c; + +return 0; } + +When you define the body of an inserter function, remember to keep it as general as possible. For example, the inserter shown in the preceding example can be used with any stream because the body of the function directs its output to stream, which is the stream that invoked the inserter. While it would not be wrong to have written + + +stream << o.name << " "; + +as + +cout << o.name << " "; + +this would have the effect of hard-coding cout as the output stream. The original version will work with any stream, including those linked to disk files. Although in some situations, especially where special output devices are involved, you will want to hard-code the output stream, in most cases you will not. In general, the more flexible your inserters are, the more valuable they are. + + +Note + +The inserter for the phonebook class works fine unless the value of num is somethinglike0034,inwhichcasetheprecedingzeroeswillnotbedisplayed.Tofix this, you can either make num into a string or you can set the fill character to zero andusethewidth( )formatfunctiontogeneratetheleadingzeroes.Thesolutionis left to the reader as an exercise. + + +Before moving on to extractors, let's look at one more example of an inserter function. An inserter need not be limited to handling only text. An inserter can be used to output data in any form that makes sense. For example, an inserter for some class that is part of a CAD system may output plotter instructions. Another inserter might generate graphics images. An inserter for a Windows-based program could display a dialog box. To sample the flavor of outputting things other than text, examine the following program, which draws boxes on the screen. (Because C++ does not define a +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 533 + + +graphics library, the program uses characters to draw a box, but feel free to substitute graphics if your system supports them.) + + +#include using namespace std; + +class box { int x, y; +public: +box(int i, int j) { x=i; y=j; } +friend ostream &operator<<(ostream &stream, box o); }; + +// Output a box. +ostream &operator<<(ostream &stream, box o) { +register int i, j; + +for(i=0; i>(istream &stream, class_type &obj) { +// body of extractor return stream; +} + +Extractors return a reference to a stream of type istream, which is an input stream. The first parameter must also be a reference to a stream of type istream. Notice that the +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 535 + + +second parameter must be a reference to an object of the class for which the extractor is overloaded. This is so the object can be modified by the input (extraction) operation. +Continuing with the phonebook class, here is one way to write an extraction function: + + +istream &operator>>(istream &stream, phonebook &o) { +cout << "Enter name: "; stream >> o.name; +cout << "Enter area code: "; stream >> o.areacode; +cout << "Enter prefix: "; stream >> o.prefix; +cout << "Enter number: "; stream >> o.num; +cout << "\n"; + +return stream; } + +Notice that although this is an input function, it performs output by prompting the user. The point is that although the main purpose of an extractor is input, it can perform any operations necessary to achieve that end. However, as with inserters, it is best to keep the actions performed by an extractor directly related to input. If you don't, you run the risk of losing much in terms of structure and clarity. +Here is a program that illustrates the phonebook extractor: + + +#include #include using namespace std; + +class phonebook { char name[80]; int areacode; int prefix; int num; +public: phonebook() { }; +phonebook(char *n, int a, int p, int nm) { +strcpy(name, n); areacode = a; prefix = p; +536 C + + : T h e C o m p l e t e R e f e r e n c e + + + +num = nm; } +friend ostream &operator<<(ostream &stream, phonebook o); friend istream &operator>>(istream &stream, phonebook &o); +}; + +// Display name and phone number. +ostream &operator<<(ostream &stream, phonebook o) { +stream << o.name << " "; +stream << "(" << o.areacode << ") "; +stream << o.prefix << "-" << o.num << "\n"; + +return stream; // must return stream } + +// Input name and telephone number. +istream &operator>>(istream &stream, phonebook &o) { +cout << "Enter name: "; stream >> o.name; +cout << "Enter area code: "; stream >> o.areacode; +cout << "Enter prefix: "; stream >> o.prefix; +cout << "Enter number: "; stream >> o.num; +cout << "\n"; + +return stream; } + +int main() { +phonebook a; + +cin >> a; + +cout << a; + +return 0; } +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 537 + + +Actually, the extractor for phonebook is less than perfect because the cout statements are needed only if the input stream is connected to an interactive device such as the console (that is, when the input stream is cin). If the extractor is used on a stream connected to a disk file, for example, then the cout statements would not be applicable. For fun, you might want to try suppressing the cout statements except when the input stream refers to cin. For example, you might use if statements such as the one shown here. + + +if(stream == cin) cout << "Enter name: "; + +Now, the prompt will take place only when the output device is most likely the screen. + + +Creating Your Own Manipulator Functions +In addition to overloading the insertion and extraction operators, you can further customize C++'s I/O system by creating your own manipulator functions. Custom manipulators are important for two main reasons. First, you can consolidate a sequence of several separate I/O operations into one manipulator. For example, it is not uncommon to have situations in which the same sequence of I/O operations occurs frequently within a program. In these cases you can use a custom manipulator to perform these actions, thus simplifying your source code and preventing accidental errors. A custom manipulator can also be important when you need to perform I/O operations on a nonstandard device. For example, you might use a manipulator to send control codes to a special type of printer or to an optical recognition system. +Custom manipulators are a feature of C++ that supports OOP, but also can benefit programs that aren't object oriented. As you will see, custom manipulators can help make any I/O-intensive program clearer and more efficient. +As you know, there are two basic types of manipulators: those that operate on input streams and those that operate on output streams. In addition to these two broad categories, there is a secondary division: those manipulators that take an argument and those that don't. Frankly, the procedures necessary to create a parameterized manipulator vary widely from compiler to compiler, and even between two different versions of the same compiler. For this reason, you must consult the documentation to your compiler for instructions on creating parameterized manipulators. However, the creation of parameterless manipulators is straightforward and the same for all compilers. It is described here. +All parameterless manipulator output functions have this skeleton: + +ostream &manip-name(ostream &stream) { +// your code here return stream; +} +538 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here, manip-name is the name of the manipulator. Notice that a reference to a stream of type ostream is returned. This is necessary if a manipulator is used as part of a larger I/O expression. It is important to note that even though the manipulator has as its single argument a reference to the stream upon which it is operating, no argument is used when the manipulator is inserted in an output operation. +As a simple first example, the following program creates a manipulator called sethex() , which turns on the showbase flag and sets output to hexadecimal. + +#include #include using namespace std; + +// A simple output manipulator. ostream &sethex(ostream &stream) { +stream.setf(ios::showbase); stream.setf(ios::hex, ios::basefield); + +return stream; } + +int main() { +cout << 256 << " " << sethex << 256; + +return 0; } + +This program displays 256 0x100. As you can see, sethex is used as part of an I/O expression in the same way as any of the built-in manipulators. +Custom manipulators need not be complex to be useful. For example, the simple manipulators la() and ra() display a left and right arrow for emphasis, as shown here: + + +#include #include using namespace std; + +// Right Arrow +ostream &ra(ostream &stream) { +stream << "-------> "; return stream; +C h a p t e r 2 0 : T h e C + + I / O S y s t e m B a s i c s 539 + + + +} + +// Left Arrow +ostream &la(ostream &stream) { +stream << " <-------"; return stream; +} + +int main() { +cout << "High balance " << ra << 1233.23 << "\n"; cout << "Over draft " << ra << 567.66 << la; + +return 0; } + +This program displays: + +High balance -------> 1233.23 +Over draft -------> 567.66 <------- + +If used frequently, these simple manipulators save you from some tedious typing. Using an output manipulator is particularly useful for sending special codes to a +device. For example, a printer may be able to accept various codes that change the type size or font, or that position the print head in a special location. If these adjustments are going to be made frequently, they are perfect candidates for a manipulator. +All parameterless input manipulator functions have this skeleton: + +istream &manip-name(istream &stream) { +// your code here return stream; +} + +An input manipulator receives a reference to the stream for which it was invoked. This stream must be returned by the manipulator. +The following program creates the getpass() input manipulator, which rings the bell and then prompts for a password: + + +#include #include +540 C + + : T h e C o m p l e t e R e f e r e n c e + + + +using namespace std; + +// A simple input manipulator. istream &getpass(istream &stream) { +cout << '\a'; // sound bell cout << "Enter password: "; + +return stream; } + +int main() { +char pw[80]; + +do { +cin >> getpass >> pw; +} while (strcmp(pw, "password")); + +cout << "Logon complete\n"; + +return 0; } + +Remember that it is crucial that your manipulator return stream. If it does not, your manipulator cannot be used in a series of input or output operations. + +C++ + + + + +Chapter 21 C++ File I/O + + + + + + + + + + + + + + +541 +542 C + + : T h e C o m p l e t e R e f e r e n c e + + +lthough C++ I/O forms an integrated system, file I/O is sufficiently specialized that it is generally thought of as a special case, subject to its own constraints and quirks. In part, this is because the most common file is a disk file, and disk files +A +have capabilities and features that most other devices don't. Keep in mind, however, that disk file I/O is simply a special case of the general I/O system and that most of the material discussed in this chapter also applies to streams connected to other types of devices. + + + and the File Classes +To perform file I/O, you must include the header in your program. It defines several classes, including ifstream, ofstream, and fstream. These classes are derived from istream, ostream, and iostream, respectively. Remember, istream, ostream, and iostream are derived from ios, so ifstream, ofstream, and fstream also have access to all operations defined by ios (discussed in the preceding chapter). Another class used by the file system is filebuf, which provides low-level facilities to manage a file stream. Usually, you don't use filebuf directly, but it is part of the other file classes. + + +Opening and Closing a File +In C++, you open a file by linking it to a stream. Before you can open a file, you must first obtain a stream. There are three types of streams: input, output, and input/output. To create an input stream, you must declare the stream to be of class ifstream. To create an output stream, you must declare it as class ofstream. Streams that will be performing both input and output operations must be declared as class fstream. For example, this fragment creates one input stream, one output stream, and one stream capable of both input and output: + + +ifstream in; // input ofstream out; // output +fstream io; // input and output + +Once you have created a stream, one way to associate it with a file is by using open() . This function is a member of each of the three stream classes. The prototype for each is shown here: + +void ifstream::open(const char *filename, ios::openmode mode = ios::in); +void ofstream::open(const char *filename, ios::openmode mode = ios::out | ios::trunc); void fstream::open(const char *filename, ios::openmode mode = ios::in | ios::out); +C h a p t e r 2 1 : C + + F i l e I / O 543 + + +Here, filename is the name of the file; it can include a path specifier. The value of mode determines how the file is opened. It must be one or more of the following values defined by openmode, which is an enumeration defined by ios (through its base class ios_base). + +ios::app ios::ate ios::binary ios::in ios::out ios::trunc + +You can combine two or more of these values by ORing them together. +Including ios::app causes all output to that file to be appended to the end. This value can be used only with files capable of output. Including ios::ate causes a seek to the end of the file to occur when the file is opened. Although ios::ate causes an initial seek to end-of-file, I/O operations can still occur anywhere within the file. +The ios::in value specifies that the file is capable of input. The ios::out value specifies that the file is capable of output. +The ios::binary value causes a file to be opened in binary mode. By default, all files are opened in text mode. In text mode, various character translations may take place, such as carriage return/linefeed sequences being converted into newlines. However, when a file is opened in binary mode, no such character translations will occur. Understand that any file, whether it contains formatted text or raw data, can be opened in either binary or text mode. The only difference is whether character translations +take place. +The ios::trunc value causes the contents of a preexisting file by the same name to be destroyed, and the file is truncated to zero length. When creating an output stream using ofstream, any preexisting file by that name is automatically truncated. +The following fragment opens a normal output file. + + +ofstream out; out.open("test", ios::out); + +However, you will seldom see open() called as shown, because the mode parameter provides default values for each type of stream. As their prototypes show, for ifstream, mode defaults to ios::in; for ofstream, it is ios::out | ios::trunc; and for fstream, it is ios::in | ios::out. Therefore, the preceding statement will usually look like this: + + +out.open("test"); // defaults to output and normal file + + +Note + +Depending on your compiler, the mode parameter for fstream::open( ) may not default to in | out. Therefore, you might need to specify this explicitly. +544 C + + : T h e C o m p l e t e R e f e r e n c e + + +If open() fails, the stream will evaluate to false when used in a Boolean expression. Therefore, before using a file, you should test to make sure that the open operation succeeded. You can do so by using a statement like this: + + +if(!mystream) { +cout << "Cannot open file.\n"; // handle error +} + +Although it is entirely proper to open a file by using the open() function, most of the time you will not do so because the ifstream, ofstream, and fstream classes have constructor functions that automatically open the file. The constructor functions have the same parameters and defaults as the open() function. Therefore, you will most commonly see a file opened as shown here: + + +ifstream mystream("myfile"); // open file for input + +As stated, if for some reason the file cannot be opened, the value of the associated stream variable will evaluate to false. Therefore, whether you use a constructor function to open the file or an explicit call to open() , you will want to confirm that the file has actually been opened by testing the value of the stream. +You can also check to see if you have successfully opened a file by using the is_open() function, which is a member of fstream, ifstream, and ofstream. It has this prototype: + +bool is_open( ); + +It returns true if the stream is linked to an open file and false otherwise. For example, the following checks if mystream is currently open: + + +if(!mystream.is_open()) { +cout << "File is not open.\n"; // ... + +To close a file, use the member function close() . For example, to close the file linked to a stream called mystream, use this statement: + + +mystream.close(); + +The close() function takes no parameters and returns no value. +C h a p t e r 2 1 : C + + F i l e I / O 545 + + +Reading and Writing Text Files +It is very easy to read from or write to a text file. Simply use the << and >> operators the same way you do when performing console I/O, except that instead of using cin and cout, substitute a stream that is linked to a file. For example, this program creates a short inventory file that contains each item's name and its cost: + + +#include #include using namespace std; + +int main() { +ofstream out("INVNTRY"); // output, normal file + +if(!out) { +cout << "Cannot open INVENTORY file.\n"; return 1; +} + +out << "Radios " << 39.95 << endl; out << "Toasters " << 19.95 << endl; out << "Mixers " << 24.80 << endl; + +out.close(); return 0; +} + +The following program reads the inventory file created by the previous program and displays its contents on the screen: + + +#include #include using namespace std; + +int main() { +ifstream in("INVNTRY"); // input + +if(!in) { +cout << "Cannot open INVENTORY file.\n"; return 1; +546 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} + +char item[20]; float cost; + +in >> item >> cost; +cout << item << " " << cost << "\n"; in >> item >> cost; +cout << item << " " << cost << "\n"; in >> item >> cost; +cout << item << " " << cost << "\n"; + +in.close(); return 0; +} + + +In a way, reading and writing files by using >> and << is like using the C-based functions fprintf() and fscanf() functions. All information is stored in the file in the same format as it would be displayed on the screen. +Following is another example of disk I/O. This program reads strings entered at the keyboard and writes them to disk. The program stops when the user enters an exclamation point. To use the program, specify the name of the output file on the command line. + +#include #include using namespace std; + +int main(int argc, char *argv[]) { +if(argc!=2) { +cout << "Usage: output \n"; return 1; +} + +ofstream out(argv[1]); // output, normal file + +if(!out) { +cout << "Cannot open output file.\n"; return 1; +} +C h a p t e r 2 1 : C + + F i l e I / O 547 + + + + +char str[80]; +cout << "Write strings to disk. Enter ! to stop.\n"; + +do { +cout << ": "; cin >> str; +out << str << endl; } while (*str != '!'); + +out.close(); return 0; +} + + +When reading text files using the >> operator, keep in mind that certain character translations will occur. For example, white-space characters are omitted. If you want to prevent any character translations, you must open a file for binary access and use the functions discussed in the next section. +When inputting, if end-of-file is encountered, the stream linked to that file will evaluate as false. (The next section illustrates this fact.) + + +Unformatted and Binary I/O +While reading and writing formatted text files is very easy, it is not always the most efficient way to handle files. Also, there will be times when you need to store unformatted (raw) binary data, not text. The functions that allow you to do this are described here. +When performing binary operations on a file, be sure to open it using the ios::binary mode specifier. Although the unformatted file functions will work on files opened for text mode, some character translations may occur. Character translations negate the purpose of binary file operations. + +Characters vs. Bytes +Before beginning our examination of unformatted I/O, it is important to clarify an important concept. For many years, I/O in C and C++ was thought of as byte oriented. This is because a char is equivalent to a byte and the only types of streams available were char streams. However, with the advent of wide characters (of type wchar_t) and their attendant streams, we can no longer say that C++ I/O is byte oriented. Instead, we must say that it is character oriented. Of course, char streams are still byte oriented and we can continue to think in terms of bytes, especially when operating on +548 C + + : T h e C o m p l e t e R e f e r e n c e + + +nontextual data. But the equivalency between a byte and a character can no longer be taken for granted. +As explained in Chapter 20, all of the streams used in this book are char streams since they are by far the most common. They also make unformatted file handling easier because a char stream establishes a one-to-one correspondence between bytes and characters, which is a benefit when reading or writing blocks of binary data. + +put( ) and get( ) +One way that you may read and write unformatted data is by using the member functions get() and put() . These functions operate on characters. That is, get() will read a character and put() will write a character. Of course, if you have opened the file for binary operations and are operating on a char (rather than a wchar_t stream), then these functions read and write bytes of data. +The get() function has many forms, but the most commonly used version is shown here along with put() : + +istream &get(char &ch); ostream &put(char ch); + +The get() function reads a single character from the invoking stream and puts that value in ch. It returns a reference to the stream. The put() function writes ch to the stream and returns a reference to the stream. +The following program displays the contents of any file, whether it contains text or binary data, on the screen. It uses the get() function. + +#include #include using namespace std; + +int main(int argc, char *argv[]) { +char ch; + +if(argc!=2) { +cout << "Usage: PR \n"; return 1; +} + +ifstream in(argv[1], ios::in | ios::binary); if(!in) { +cout << "Cannot open file."; +C h a p t e r 2 1 : C + + F i l e I / O 549 + + + +return 1; } + +while(in) { // in will be false when eof is reached in.get(ch); +if(in) cout << ch; } + +return 0; } + +As stated in the preceding section, when the end-of-file is reached, the stream associated with the file becomes false. Therefore, when in reaches the end of the file, it will be false, causing the while loop to stop. +There is actually a more compact way to code the loop that reads and displays a file, as shown here: + + +while(in.get(ch)) cout << ch; + +This works because get() returns a reference to the stream in, and in will be false when the end of the file is encountered. +The next program uses put() to write all characters from zero to 255 to a file called CHARS. As you probably know, the ASCII characters occupy only about half the available values that can be held by a char. The other values are generally called the extended character set and include such things as foreign language and mathematical symbols. (Not all systems support the extended character set, but most do.) + +#include #include using namespace std; + +int main() { +int i; +ofstream out("CHARS", ios::out | ios::binary); + +if(!out) { +cout << "Cannot open output file.\n"; return 1; +} +550 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +// write all characters to disk for(i=0; i<256; i++) out.put((char) i); + +out.close(); return 0; +} + + +You might find it interesting to examine the contents of the CHARS file to see what extended characters your computer has available. + +read( ) and write( ) +Another way to read and write blocks of binary data is to use C++'s read() and write() functions. Their prototypes are + +istream &read(char *buf, streamsize num); ostream &write(const char *buf, streamsize num); + +The read() function reads num characters from the invoking stream and puts them in the buffer pointed to by buf. The write() function writes num characters to the invoking stream from the buffer pointed to by buf. As mentioned in the preceding chapter, streamsize is a type defined by the C++ library as some form of integer. It is capable of holding the largest number of characters that can be transferred in any one I/O operation. +The next program writes a structure to disk and then reads it back in: + + +#include #include #include using namespace std; + +struct status { char name[80]; double balance; +unsigned long account_num; }; + +int main() { +struct status acc; +C h a p t e r 2 1 : C + + F i l e I / O 551 + + + + +strcpy(acc.name, "Ralph Trantor"); acc.balance = 1123.23; acc.account_num = 34235678; + +// write data +ofstream outbal("balance", ios::out | ios::binary); if(!outbal) { +cout << "Cannot open file.\n"; return 1; +} + +outbal.write((char *) &acc, sizeof(struct status)); outbal.close(); + +// now, read back; +ifstream inbal("balance", ios::in | ios::binary); if(!inbal) { +cout << "Cannot open file.\n"; return 1; +} + +inbal.read((char *) &acc, sizeof(struct status)); + +cout << acc.name << endl; +cout << "Account # " << acc.account_num; cout.precision(2); cout.setf(ios::fixed); +cout << endl << "Balance: $" << acc.balance; + +inbal.close(); return 0; +} + + +As you can see, only a single call to read() or write() is necessary to read or write the entire structure. Each individual field need not be read or written separately. As this example illustrates, the buffer can be any type of object. + + +Note + +Thetypecastsinsidethecallstoread( )andwrite( )arenecessarywhenoperating on a buffer that is not defined as a character array. Because of C++'s strong type checking, a pointer of one type will not automatically be converted into a pointer of another type. +552 C + + : T h e C o m p l e t e R e f e r e n c e + + +If the end of the file is reached before num characters have been read, then read() simply stops, and the buffer contains as many characters as were available. You can find out how many characters have been read by using another member function, called gcount() , which has this prototype: + +streamsize gcount(); + +It returns the number of characters read by the last binary input operation. The following program shows another example of read() and write() and illustrates the use of gcount() : + + +#include #include using namespace std; + +int main() { +double fnum[4] = {99.75, -34.4, 1776.0, 200.1}; int i; + +ofstream out("numbers", ios::out | ios::binary); if(!out) { +cout << "Cannot open file."; return 1; +} + +out.write((char *) &fnum, sizeof fnum); + +out.close(); + +for(i=0; i<4; i++) // clear array fnum[i] = 0.0; + +ifstream in("numbers", ios::in | ios::binary); in.read((char *) &fnum, sizeof fnum); + +// see how many bytes have been read cout << in.gcount() << " bytes read\n"; + +for(i=0; i<4; i++) // show values read from file cout << fnum[i] << " "; +C h a p t e r 2 1 : C + + F i l e I / O 553 + + + +in.close(); + +return 0; } + +The preceding program writes an array of floating-point values to disk and then reads them back. After the call to read() , gcount() is used to determine how many bytes were just read. + + +More get( ) Functions +In addition to the form shown earlier, the get() function is overloaded in several different ways. The prototypes for the three most commonly used overloaded forms are shown here: + +istream &get(char *buf, streamsize num); +istream &get(char *buf, streamsize num, char delim); int get( ); + +The first form reads characters into the array pointed to by buf until either num-1 characters have been read, a newline is found, or the end of the file has been encountered. The array pointed to by buf will be null terminated by get() . If the newline character is encountered in the input stream, it is not extracted. Instead, it remains in the stream until the next input operation. +The second form reads characters into the array pointed to by buf until either num-1 characters have been read, the character specified by delim has been found, or the end of the file has been encountered. The array pointed to by buf will be null terminated by get() . If the delimiter character is encountered in the input stream, it is not extracted. Instead, it remains in the stream until the next input operation. +The third overloaded form of get() returns the next character from the stream. It returns EOF if the end of the file is encountered. This form of get( ) is similar to C's getc() function. + + +getline( ) +Another function that performs input is getline() . It is a member of each input stream class. Its prototypes are shown here: + +istream &getline(char *buf, streamsize num); +istream &getline(char *buf, streamsize num, char delim); +554 C + + : T h e C o m p l e t e R e f e r e n c e + + +The first form reads characters into the array pointed to by buf until either num−1 characters have been read, a newline character has been found, or the end of the file has been encountered. The array pointed to by buf will be null terminated by getline() . If the newline character is encountered in the input stream, it is extracted, but is not put into buf. +The second form reads characters into the array pointed to by buf until either num−1 characters have been read, the character specified by delim has been found, or the end of the file has been encountered. The array pointed to by buf will be null terminated by getline() . If the delimiter character is encountered in the input stream, it is extracted, but is not put into buf. +As you can see, the two versions of getline() are virtually identical to the get(buf, num) and get(buf, num, delim) versions of get() . Both read characters from input and put them into the array pointed to by buf until either num−1 characters have been read or until the delimiter character is encountered. The difference is that getline() reads and removes the delimiter from the input stream; get() does not. +Here is a program that demonstrates the getline() function. It reads the contents of a text file one line at a time and displays it on the screen. + + +// Read and display a text file line by line. + +#include #include using namespace std; + +int main(int argc, char *argv[]) { +if(argc!=2) { +cout << "Usage: Display \n"; return 1; +} + +ifstream in(argv[1]); // input + +if(!in) { +cout << "Cannot open input file.\n"; return 1; +} + +char str[255]; +C h a p t e r 2 1 : C + + F i l e I / O 555 + + + + +while(in) { +in.getline(str, 255); // delim defaults to '\n' if(in) cout << str << endl; +} + +in.close(); + +return 0; } + + +Detecting EOF +You can detect when the end of the file is reached by using the member function eof(), which has this prototype: + +bool eof( ); + +It returns true when the end of the file has been reached; otherwise it returns false. The following program uses eof() to display the contents of a file in both +hexadecimal and ASCII. + + +/* Display contents of specified file in both ASCII and in hex. +*/ +#include #include #include #include using namespace std; + +int main(int argc, char *argv[]) { +if(argc!=2) { +cout << "Usage: Display \n"; return 1; +} +556 C + + : T h e C o m p l e t e R e f e r e n c e + + + +ifstream in(argv[1], ios::in | ios::binary); + +if(!in) { +cout << "Cannot open input file.\n"; return 1; +} + +register int i, j; int count = 0; char c[16]; + +cout.setf(ios::uppercase); while(!in.eof()) { +for(i=0; i<16 && !in.eof(); i++) { in.get(c[i]); +} +if(i<16) i--; // get rid of eof + +for(j=0; j..#i 6E 63 6C 75 64 65 20 3C 66 73 74 72 65 61 6D 3E nclude D A 23 69 6E 63 6C 75 64 65 20 3C 63 63 74 79 ..#include ..#include ..using n 61 6D 65 73 70 61 63 65 20 73 74 64 3B D A D amespace std;... + +A 69 6E 74 20 6D 61 69 6E 28 69 6E 74 20 61 72 +67 63 2C 20 63 68 61 72 20 2A 61 72 67 76 5B 5D + +.int main(int ar +gc, char *argv[] + +29 D A 7B D A 20 20 69 66 28 61 72 67 63 21 )..{.. if(argc! 3D 32 29 20 7B D A 20 20 20 20 63 6F 75 74 20 =2) {.. cout 3C 3C 20 22 55 73 61 67 65 3A 20 44 69 73 70 6C << "Usage: Displ +Press ENTER to continue: + + +The ignore( ) Function +You can use the ignore() member function to read and discard characters from the input stream. It has this prototype: + +istream &ignore(streamsize num=1, int_type delim=EOF); + +It reads and discards characters until either num characters have been ignored (1 by default) or the character specified by delim is encountered (EOF by default). If the delimiting character is encountered, it is not removed from the input stream. Here, int_type is defined as some form of integer. +The next program reads a file called TEST. It ignores characters until either a space is encountered or 10 characters have been read. It then displays the rest of the file. + + +#include #include using namespace std; + +int main() { +ifstream in("test"); +558 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +if(!in) { +cout << "Cannot open file.\n"; return 1; +} + +/* Ignore up to 10 characters or until first space is found. */ +in.ignore(10, ' '); char c; +while(in) { in.get(c); +if(in) cout << c; } + +in.close(); return 0; +} + + +peek( ) and putback( ) +You can obtain the next character in the input stream without removing it from that stream by using peek(). It has this prototype: + +int_type peek( ); + +It returns the next character in the stream or EOF if the end of the file is encountered. (int_type is defined as some form of integer.) +You can return the last character read from a stream to that stream by using putback(). Its prototype is + +istream &putback(char c); + +where c is the last character read. + + +flush( ) +When output is performed, data is not necessarily immediately written to the physical device linked to the stream. Instead, information is stored in an internal buffer until the buffer is full. Only then are the contents of that buffer written to disk. However, you +C h a p t e r 2 1 : C + + F i l e I / O 559 + + +can force the information to be physically written to disk before the buffer is full by calling flush() . Its prototype is + +ostream &flush( ); + +Calls to flush() might be warranted when a program is going to be used in adverse environments (for example, in situations where power outages occur frequently). + +Note Closing a file or terminating a program also flushes all buffers. + +Random Access +In C++'s I/O system, you perform random access by using the seekg() and seekp() functions. Their most common forms are + +istream &seekg(off_type offset, seekdir origin); ostream &seekp(off_type offset, seekdir origin); + +Here, off_type is an integer type defined by ios that is capable of containing the largest valid value that offset can have. seekdir is an enumeration defined by ios that determines how the seek will take place. +The C++ I/O system manages two pointers associated with a file. One is the get pointer, which specifies where in the file the next input operation will occur. The other is the put pointer, which specifies where in the file the next output operation will occur. Each time an input or output operation takes place, the appropriate pointer is automatically sequentially advanced. However, using the seekg() and seekp() functions allows you to access the file in a nonsequential fashion. +The seekg() function moves the associated file's current get pointer offset number of characters from the specified origin, which must be one of these three values: + + +ios::beg ios::cur +ios::end + +Beginning-of-file Current location +End-of-file + + +The seekp() function moves the associated file's current put pointer offset number of characters from the specified origin, which must be one of the values just shown. +Generally, random-access I/O should be performed only on those files opened for binary operations. The character translations that may occur on text files could cause a position request to be out of sync with the actual contents of the file. +560 C + + : T h e C o m p l e t e R e f e r e n c e + + +The following program demonstrates the seekp() function. It allows you to change a specific character in a file. Specify a filename on the command line, followed by the number of the character in the file you want to change, followed by the new character. Notice that the file is opened for read/write operations. + + +#include #include #include using namespace std; + +int main(int argc, char *argv[]) { +if(argc!=4) { +cout << "Usage: CHANGE \n"; return 1; +} + +fstream out(argv[1], ios::in | ios::out | ios::binary); if(!out) { +cout << "Cannot open file."; return 1; +} + +out.seekp(atoi(argv[2]), ios::beg); + +out.put(*argv[3]); out.close(); + +return 0; } + +For example, to use this program to change the twelfth character of a file called TEST to a Z, use this command line: + + +change test 12 Z + +The next program uses seekg() . It displays the contents of a file beginning with the location you specify on the command line. + + +#include #include +C h a p t e r 2 1 : C + + F i l e I / O 561 + + + +#include using namespace std; + +int main(int argc, char *argv[]) { +char ch; + +if(argc!=3) { +cout << "Usage: SHOW \n"; return 1; +} + +ifstream in(argv[1], ios::in | ios::binary); if(!in) { +cout << "Cannot open file."; return 1; +} + +in.seekg(atoi(argv[2]), ios::beg); + +while(in.get(ch)) cout << ch; + +return 0; } + +The following program uses both seekp() and seekg() to reverse the first characters in a file. + + +#include #include #include using namespace std; + +int main(int argc, char *argv[]) { +if(argc!=3) { +cout << "Usage: Reverse \n"; return 1; +} +562 C + + : T h e C o m p l e t e R e f e r e n c e + + + +fstream inout(argv[1], ios::in | ios::out | ios::binary); + +if(!inout) { +cout << "Cannot open input file.\n"; return 1; +} + +long e, i, j; char c1, c2; +e = atol(argv[2]); + +for(i=0, j=e; i #include using namespace std; + +void checkstatus(ifstream &in); + +int main(int argc, char *argv[]) { +if(argc!=2) { +cout << "Usage: Display \n"; return 1; +} + +ifstream in(argv[1]); + +if(!in) { +cout << "Cannot open input file.\n"; return 1; +} + +char c; while(in.get(c)) { +if(in) cout << c; checkstatus(in); +} + +checkstatus(in); // check final status in.close(); +return 0; } + +void checkstatus(ifstream &in) { +ios::iostate i; + +i = in.rdstate(); + +if(i & ios::eofbit) +cout << "EOF encountered\n"; +C h a p t e r 2 1 : C + + F i l e I / O 565 + + + +else if(i & ios::failbit) +cout << "Non-Fatal I/O error\n"; else if(i & ios::badbit) +cout << "Fatal I/O error\n"; } + +This program will always report one "error." After the while loop ends, the final call to checkstatus() reports, as expected, that an EOF has been encountered. You might find the checkstatus() function useful in programs that you write. +The other way that you can determine if an error has occurred is by using one or more of these functions: + +bool bad( ); bool eof( ); bool fail( ); bool good( ); + +The bad() function returns true if badbit is set. The eof() function was discussed earlier. The fail() returns true if failbit is set. The good() function returns true if there are no errors. Otherwise, it returns false. +Once an error has occurred, it may need to be cleared before your program continues. To do this, use the clear() function, which has this prototype: + +void clear(iostate flags=ios::goodbit); + +If flags is goodbit (as it is by default), all error flags are cleared. Otherwise, set flags as you desire. + + +Customized I/O and Files +In Chapter 20 you learned how to overload the insertion and extraction operators relative to your own classes. In that chapter, only console I/O was performed, but because all C++ streams are the same, you can use the same overloaded inserter or extractor function to perform I/O on the console or a file with no changes whatsoever. As an example, the following program reworks the phone book example in Chapter 20 so that it stores a list on disk. The program is very simple: It allows you to add names to the list or to display the list on the screen. It uses custom inserters and extractors to input and output the telephone numbers. You might find it interesting to enhance the program so that it will find a specific number or delete unwanted numbers. +566 C + + : T h e C o m p l e t e R e f e r e n c e + + +#include #include #include using namespace std; + +class phonebook { char name[80]; char areacode[4]; char prefix[4]; char num[5]; +public: phonebook() { }; +phonebook(char *n, char *a, char *p, char *nm) { +strcpy(name, n); strcpy(areacode, a); strcpy(prefix, p); strcpy(num, nm); +} +friend ostream &operator<<(ostream &stream, phonebook o); friend istream &operator>>(istream &stream, phonebook &o); +}; + +// Display name and phone number. +ostream &operator<<(ostream &stream, phonebook o) { +stream << o.name << " "; +stream << "(" << o.areacode << ") "; stream << o.prefix << "-"; +stream << o.num << "\n"; +return stream; // must return stream } + +// Input name and telephone number. +istream &operator>>(istream &stream, phonebook &o) { +cout << "Enter name: "; stream >> o.name; +cout << "Enter area code: "; stream >> o.areacode; +cout << "Enter prefix: "; stream >> o.prefix; +cout << "Enter number: "; +C h a p t e r 2 1 : C + + F i l e I / O 567 + + + +stream >> o.num; cout << "\n"; return stream; +} + +int main() { +phonebook a; char c; + +fstream pb("phone", ios::in | ios::out | ios::app); + +if(!pb) { +cout << "Cannot open phone book file.\n"; return 1; +} + +for(;;) { do { +cout << "1. Enter numbers\n"; cout << "2. Display numbers\n"; cout << "3. Quit\n"; +cout << "\nEnter a choice: "; cin >> c; +} while(c<'1' || c>'3'); + +switch(c) { case '1': +cin >> a; +cout << "Entry is: "; +cout << a; // show on screen pb << a; // write to disk break; +case '2': char ch; +pb.seekg(0, ios::beg); while(!pb.eof()) { +pb.get(ch); +if(!pb.eof()) cout << ch; } +pb.clear(); // reset eof cout << endl; +568 C + + : T h e C o m p l e t e R e f e r e n c e + + + +break; case '3': +pb.close(); return 0; +} } +} + + +Notice that the overloaded << operator can be used to write to a disk file or to the screen without any changes. This is one of the most important and useful features of C++'s approach to I/O. + +C++ + + + + +Chapter 22 Run-Time Type ID and the +Casting Operators + + + + + + + + + + + +569 +570 C + + : T h e C o m p l e t e R e f e r e n c e + + +tandard C++ contains two features that help support modern, object-oriented programming: run-time type identification (RTTI for short) and the new casting operators. Neither of these were part of the original specification for C++, but both +S +were added to provide enhanced support for run-time polymorphism. RTTI allows you to identify the type of an object during the execution of your program. The casting operators give you safer, more controlled ways to cast. Since one of the casting operators, dynamic_cast, relates directly to RTTI, it makes sense to discuss them in the same chapter. + + +Run-Time Type Identification (RTTI) +Run-time type information may be new to you because it is not found in nonpolymorphic languages, such as C. In nonpolymorphic languages there is no need for run-time type information because the type of each object is known at compile time (i.e., when the program is written). However, in polymorphic languages such as C++, there can be situations in which the type of an object is unknown at compile time because the precise nature of that object is not determined until the program is +executed. As explained in Chapter 17, C++ implements polymorphism through the use of class hierarchies, virtual functions, and base-class pointers. Since base-class pointers may be used to point to objects of the base class or any object derived from that base, it is not always possible to know in advance what type of object will be pointed to by a base pointer at any given moment in time. This determination must be made at run time, using run-time type identification. +To obtain an object's type, use typeid. You must include the header in order to use typeid. Its most commonly used form is shown here: + +typeid(object) + +Here, object is the object whose type you will be obtaining. It may be of any type, including the built-in types and class types that you create. typeid returns a reference to an object of type type_info that describes the type of object. +The type_info class defines the following public members: + +bool operator==(const type_info &ob); bool operator!=(const type_info &ob); bool before(const type_info &ob); const char *name( ); + +The overloaded == and != provide for the comparison of types. The before() function returns true if the invoking object is before the object used as a parameter in collation order. (This function is mostly for internal use only. Its return value has +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 571 + + +nothing to do with inheritance or class hierarchies.) The name() function returns a pointer to the name of the type. +Here is a simple example that uses typeid. + + +// A simple example that uses typeid. #include +#include using namespace std; + +class myclass1 { // ... +}; + +class myclass2 { // ... +}; + +int main() { +int i, j; float f; char *p; myclass1 ob1; myclass2 ob2; + +cout << "The type of i is: " << typeid(i).name(); cout << endl; +cout << "The type of f is: " << typeid(f).name(); cout << endl; +cout << "The type of p is: " << typeid(p).name(); cout << endl; + +cout << "The type of ob1 is: " << typeid(ob1).name(); cout << endl; +cout << "The type of ob2 is: " << typeid(ob2).name(); cout << "\n\n"; + +if(typeid(i) == typeid(j)) +cout << "The types of i and j are the same\n"; + +if(typeid(i) != typeid(f)) +cout << "The types of i and f are not the same\n"; +572 C + + : T h e C o m p l e t e R e f e r e n c e + + + +if(typeid(ob1) != typeid(ob2)) +cout << "ob1 and ob2 are of differing types\n"; + +return 0; } + + +The output produced by this program is shown here: + +The type of i is: int The type of f is: float The type of p is: char * +The type of ob1 is: class myclass1 The type of ob2 is: class myclass2 + +The types of i and j are the same +The types of i and f are not the same ob1 and ob2 are of differing types + +The most important use of typeid occurs when it is applied through a pointer of a polymorphic base class. In this case, it will automatically return the type of the actual object being pointed to, which may be a base-class object or an object derived from that base. (Remember, a base-class pointer can point to objects of the base class or of any class derived from that base.) Thus, using typeid, you can determine at run time the type of the object that is being pointed to by a base-class pointer. The following program demonstrates this principle. + + +// An example that uses typeid on a polymorphic class hierarchy. #include +#include using namespace std; + +class Mammal { public: +virtual bool lays_eggs() { return false; }// Mammal is polymorphic // ... +}; + +class Cat: public Mammal { public: +// ... +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 573 + + + +}; + +class Platypus: public Mammal { public: +bool lays_eggs() { return true; } // ... +}; + +int main() { +Mammal *p, AnyMammal; Cat cat; +Platypus platypus; + +p = &AnyMammal; +cout << "p is pointing to an object of type "; cout << typeid(*p).name() << endl; + +p = &cat; +cout << "p is pointing to an object of type "; cout << typeid(*p).name() << endl; + +p = &platypus; +cout << "p is pointing to an object of type "; cout << typeid(*p).name() << endl; + +return 0; } + +The output produced by this program is shown here: + +p is pointing to an object of type class Mammal p is pointing to an object of type class Cat +p is pointing to an object of type class Platypus + +As explained, when typeid is applied to a base-class pointer of a polymorphic type, the type of object pointed to will be determined at run time, as shown by the output produced by the program. +In all cases, when typeid is applied to a pointer of a nonpolymorphic class heirarchy, then the base type of the pointer is obtained. That is, no determination of what that pointer is actually pointing to is made. For example, comment out the virtual +574 C + + : T h e C o m p l e t e R e f e r e n c e + + +keyword before the function lays_eggs() in Mammal and then compile and run the program. You will see the following output. + + +p is pointing to an object of type class Mammal p is pointing to an object of type class Mammal p is pointing to an object of type class Mammal + +Since Mammal is no longer a polymorphic class, the type of each object will be Mammal because that is the type of the pointer. +Since typeid is commonly applied to a dereferenced pointer (i.e., one to which the * operator has been applied), a special exception has been created to handle the situation in which the pointer being dereferenced is null. In this case, typeid throws bad_typeid. References to an object of a polymorphic class hierarchy work the same as pointers. +When typeid is applied to a reference to an object of a polymorphic class, it will return the type of the object actually being referred to, which may be of a derived type. The circumstance where you will most often make use of this feature is when objects are passed to functions by reference. For example, in the following program, the function WhatMammal() declares a reference parameter to objects of type Mammal. This means that WhatMammal() can be passed references to objects of type Mammal or any class derived from Mammal. When the typeid operator is applied to this parameter, it returns the actual type of the object being passed. + + +// Use a reference with typeid. #include +#include using namespace std; + +class Mammal { public: +virtual bool lays_eggs() { return false; }// Mammal is polymorphic // ... +}; + +class Cat: public Mammal { public: +// ... }; + +class Platypus: public Mammal { public: +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 575 + + + +bool lays_eggs() { return true; } // ... +}; + +// Demonstrate typeid with a reference parameter. void WhatMammal(Mammal &ob) +{ +cout << "ob is referencing an object of type "; cout << typeid(ob).name() << endl; +} + +int main() { +Mammal AnyMammal; Cat cat; +Platypus platypus; + +WhatMammal(AnyMammal); WhatMammal(cat); WhatMammal(platypus); + +return 0; } + +The output produced by this program is shown here: + +ob is referencing an object of type class Mammal ob is referencing an object of type class Cat +ob is referencing an object of type class Platypus + +There is a second form of typeid that takes a type name as its argument. This form is shown here: + +typeid(type-name) + +For example, the following statement is perfectly acceptable: + +cout << typeid(int).name(); +576 C + + : T h e C o m p l e t e R e f e r e n c e + + +The main use of this form of typeid is to obtain a type_info object that describes the specified type so that it can be used in a type comparison statement. For example, this form of WhatMammal() reports that cats don't like water: + + +void WhatMammal(Mammal &ob) { +cout << "ob is referencing an object of type "; cout << typeid(ob).name() << endl; if(typeid(ob) == typeid(Cat)) +cout << "Cats don't like water.\n"; } + +A Simple Application of Run-Time Type ID +The following program hints at the power of RTTI. In the program, the function called +factory() creates instances of various types of objects derived from the class Mammal. (A function that produces objects is sometimes called an object factory.) The specific type of object created is determined by the outcome of a call to rand() , C++'s random number generator. Thus, there is no way to know in advance what type of object will be generated. The program creates 10 objects and counts the number of each type of mammal. Since any type of mammal may be generated by a call to factory() , the program relies upon typeid to determine which type of object has actually been made. + + +// Demonstrating run-time type id. #include +using namespace std; + +class Mammal { public: +virtual bool lays_eggs() { return false; }// Mammal is polymorphic // ... +}; + +class Cat: public Mammal { public: +// ... }; + +class Platypus: public Mammal { public: +bool lays_eggs() { return true; } // ... +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 577 + + + +}; + +class Dog: public Mammal { public: +// ... }; + +// A factory for objects derived from Mammal. Mammal *factory() +{ +switch(rand() % 3 ) { case 0: return new Dog; case 1: return new Cat; +case 2: return new Platypus; } +return 0; } + +int main() { +Mammal *ptr; // pointer to base class int i; +int c=0, d=0, p=0; + +// generate and count objects for(i=0; i<10; i++) { +ptr = factory(); // generate an object + +cout << "Object is " << typeid(*ptr).name(); cout << endl; + +// count it +if(typeid(*ptr) == typeid(Dog)) d++; if(typeid(*ptr) == typeid(Cat)) c++; if(typeid(*ptr) == typeid(Platypus)) p++; +} + +cout << endl; +cout << "Animals generated:\n"; + +cout << " +cout << " + +Dogs: " << d << endl; +Cats: " << c << endl; +578 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << " Platypuses: " << p << endl; + +return 0; } + +Sample output is shown here. + +Object is class Platypus Object is class Platypus Object is class Cat Object is class Cat Object is class Platypus Object is class Cat Object is class Dog Object is class Dog Object is class Cat Object is class Platypus + +Animals generated: Dogs: 2 +Cats: 4 Platypuses: 4 + + +typeid Can Be Applied to Template Classes +The typeid operator can be applied to template classes. The type of an object that is an instance of a template class is in part determined by what data is used for its generic data when the object is instantiated. Two instances of the same template class that are created using different data are therefore different types. Here is a simple example: + + +// Using typeid with templates. #include +using namespace std; + +template class myclass { T a; +public: +myclass(T i) { a = i; } // ... +}; +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 579 + + + +int main() { +myclass o1(10), o2(9); myclass o3(7.2); + +cout << "Type of o1 is "; +cout << typeid(o1).name() << endl; + +cout << "Type of o2 is "; +cout << typeid(o2).name() << endl; + +cout << "Type of o3 is "; +cout << typeid(o3).name() << endl; + +cout << endl; + +if(typeid(o1) == typeid(o2)) +cout << "o1 and o2 are the same type\n"; + +if(typeid(o1) == typeid(o3)) cout << "Error\n"; +else +cout << "o1 and o3 are different types\n"; + +return 0; } + +The output produced by this program is shown here. + +Type of o1 is class myclass Type of o2 is class myclass Type of o3 is class myclass + +o1 and o2 are the same type o1 and o3 are different types + +As you can see, even though two objects are of the same template class type, if their parameterized data does not match, they are not equivalent types. In the program, o1 is of type myclass and o3 is of type myclass. Thus, they are of different types. +580 C + + : T h e C o m p l e t e R e f e r e n c e + + +Run-time type identification is not something that every program will use. However, when you are working with polymorphic types, it allows you to know what type of object is being operated upon in any given situation. + + +The Casting Operators +C++ defines five casting operators. The first is the traditional-style cast inherited from C. The remaining four were added a few years ago. They are dynamic_cast, const_cast, reinterpret_cast, and static_cast. These operators give you additional control over how casting takes place. + + +dynamic_cast +Perhaps the most important of the new casting operators is dynamic_cast. The dynamic_cast performs a run-time cast that verifies the validity of a cast. If the cast is invalid at the time dynamic_cast is executed, then the cast fails. The general form of dynamic_cast is shown here: + +dynamic_cast (expr) + +Here, target-type specifies the target type of the cast, and expr is the expression being cast into the new type. The target type must be a pointer or reference type, and the expression being cast must evaluate to a pointer or reference. Thus, dynamic_cast may be used to cast one type of pointer into another or one type of reference into another. +The purpose of dynamic_cast is to perform casts on polymorphic types. For example, given two polymorphic classes Band D, with D derived from B, a dynamic_cast can always cast a D* pointer into a B* pointer. This is because a base pointer can always point to a derived object. But a dynamic_cast can cast a B* pointer into a D* pointer only if the object being pointed to actually is a D object. In general, dynamic_cast will succeed if the pointer (or reference) being cast is a pointer (or reference) to either an object of the target type or an object derived from the target type. Otherwise, the cast will fail. If the cast fails, then dynamic_cast evaluates to null if the cast involves pointers. If a dynamic_cast on reference types fails, a bad_cast exception is thrown. +Here is a simple example. Assume that Base is a polymorphic class and that Derived is derived from Base. + +Base *bp, b_ob; Derived *dp, d_ob; + +bp = &d_ob; // base pointer points to Derived object +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 581 + + + +dp = dynamic_cast (bp); // cast to derived pointer OK if(dp) cout << "Cast OK"; + +Here, the cast from the base pointer bp to the derived pointer dp works because bp is actually pointing to a Derived object. Thus, this fragment displays Cast OK. But in the next fragment, the cast fails because bp is pointing to a Base object and it is illegal to cast a base object into a derived object. + + +bp = &b_ob; // base pointer points to Base object dp = dynamic_cast (bp); // error if(!dp) cout << "Cast Fails"; + +Because the cast fails, this fragment displays Cast Fails. +The following program demonstrates the various situations that dynamic_cast can handle. + + +// Demonstrate dynamic_cast. #include +using namespace std; + +class Base { public: +virtual void f() { cout << "Inside Base\n"; } // ... +}; + +class Derived : public Base { public: +void f() { cout << "Inside Derived\n"; } }; + +int main() { +Base *bp, b_ob; Derived *dp, d_ob; + +dp = dynamic_cast (&d_ob); if(dp) { +cout << "Cast from Derived * to Derived * OK.\n"; dp->f(); +} else +582 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << "Error\n"; + +cout << endl; + +bp = dynamic_cast (&d_ob); if(bp) { +cout << "Cast from Derived * to Base * OK.\n"; bp->f(); +} else +cout << "Error\n"; + +cout << endl; + +bp = dynamic_cast (&b_ob); if(bp) { +cout << "Cast from Base * to Base * OK.\n"; bp->f(); +} else +cout << "Error\n"; + +cout << endl; + +dp = dynamic_cast (&b_ob); if(dp) +cout << "Error\n"; else +cout << "Cast from Base * to Derived * not OK.\n"; + +cout << endl; + +bp = &d_ob; // bp points to Derived object dp = dynamic_cast (bp); +if(dp) { +cout << "Casting bp to a Derived * OK\n" << "because bp is really pointing\n" << +"to a Derived object.\n"; dp->f(); +} else +cout << "Error\n"; + +cout << endl; +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 583 + + + +bp = &b_ob; // bp points to Base object dp = dynamic_cast (bp); if(dp) +cout << "Error"; else { +cout << "Now casting bp to a Derived *\n" << "is not OK because bp is really \n" << "pointing to a Base object.\n"; +} + +cout << endl; + +dp = &d_ob; // dp points to Derived object bp = dynamic_cast (dp); +if(bp) { +cout << "Casting dp to a Base * is OK.\n"; bp->f(); +} else +cout << "Error\n"; + +return 0; } + +The program produces the following output: + +Cast from Derived * to Derived * OK. Inside Derived + +Cast from Derived * to Base * OK. Inside Derived + +Cast from Base * to Base * OK. Inside Base + +Cast from Base * to Derived * not OK. + +Casting bp to a Derived * OK because bp is really pointing to a Derived object. +Inside Derived +584 C + + : T h e C o m p l e t e R e f e r e n c e + + + +Now casting bp to a Derived * is not OK because bp is really pointing to a Base object. + +Casting dp to a Base * is OK. Inside Derived + + +Replacing typeid with dynamic_cast +The dynamic_cast operator can sometimes be used instead of typeid in certain cases. For example, again assume that Base is a polymorphic base class for Derived. The following fragment will assign dp the address of the object pointed to by bp if and only if the object really is a Derived object. + + +Base *bp; Derived *dp; // ... +if(typeid(*bp) == typeid(Derived)) dp = (Derived *) bp; + +In this case, a traditional-style cast is used to actually perform the cast. This is safe because the if statement checks the legality of the cast using typeid before the cast actually occurs. However, a better way to accomplish this is to replace the typeid operators and if statement with this dynamic_cast. + + +dp = dynamic_cast (bp); + +Since dynamic_cast succeeds only if the object being cast is either an object of the target type or an object derived from the target type, after this statement executes dp will contain either a null or a pointer to an object of type Derived. Since dynamic_cast succeeds only if the cast is legal, it can simplify the logic in certain situations. The following program illustrates how a dynamic_cast can be used to replace typeid. It performs the same set of operations twice—first with typeid, then using dynamic_cast. + + +// Use dynamic_cast to replace typeid. #include +#include using namespace std; + +class Base { public: +virtual void f() {} +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 585 + + + +}; + +class Derived : public Base { public: +void derivedOnly() { +cout << "Is a Derived Object.\n"; } +}; + +int main() { +Base *bp, b_ob; Derived *dp, d_ob; + +// ************************************ // use typeid +// ************************************ bp = &b_ob; +if(typeid(*bp) == typeid(Derived)) { dp = (Derived *) bp; +dp->derivedOnly(); } +else +cout << "Cast from Base to Derived failed.\n"; + +bp = &d_ob; +if(typeid(*bp) == typeid(Derived)) { dp = (Derived *) bp; +dp->derivedOnly(); } +else +cout << "Error, cast should work!\n"; + +// ************************************ // use dynamic_cast +// ************************************ bp = &b_ob; +dp = dynamic_cast (bp); if(dp) dp->derivedOnly(); +else +cout << "Cast from Base to Derived failed.\n"; +586 C + + : T h e C o m p l e t e R e f e r e n c e + + + +bp = &d_ob; +dp = dynamic_cast (bp); if(dp) dp->derivedOnly(); +else +cout << "Error, cast should work!\n"; + +return 0; } + +As you can see, the use of dynamic_cast simplifies the logic required to cast a base pointer into a derived pointer. The output from the program is shown here: + + +Cast from Base to Derived failed. Is a Derived Object. +Cast from Base to Derived failed. Is a Derived Object. + +Using dynamic_cast with Template Classes +The dynamic_cast operator can also be used with template classes. For example, + +// Demonstrate dynamic_cast on template classes. #include +using namespace std; + +template class Num { protected: +T val; public: +Num(T x) { val = x; } +virtual T getval() { return val; } // ... +}; + +template class SqrNum : public Num { public: +SqrNum(T x) : Num(x) { } +T getval() { return val * val; } }; + +int main() +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 587 + + + +{ +Num *bp, numInt_ob(2); SqrNum *dp, sqrInt_ob(3); Num numDouble_ob(3.3); + +bp = dynamic_cast *> (&sqrInt_ob); if(bp) { +cout << "Cast from SqrNum* to Num* OK.\n"; cout << "Value is " << bp->getval() << endl; +} else +cout << "Error\n"; + +cout << endl; + +dp = dynamic_cast *> (&numInt_ob); if(dp) +cout << "Error\n"; else { +cout << "Cast from Num* to SqrNum* not OK.\n"; cout << "Can't cast a pointer to a base object into\n"; cout << "a pointer to a derived object.\n"; +} +cout << endl; + +bp = dynamic_cast *> (&numDouble_ob); if(bp) +cout << "Error\n"; else +cout << "Can't cast from Num* to Num*.\n"; cout << "These are two different types.\n"; + +return 0; } + +The output from this program is shown here: + +Cast from SqrNum* to Num* OK. Value is 9 + +Cast from Num* to SqrNum* not OK. Can't cast a pointer to a base object into +588 C + + : T h e C o m p l e t e R e f e r e n c e + + + +a pointer to a derived object. + +Can't cast from Num* to Num*. These are two different types. + +A key point illustrated by this example is that it is not possible to use dynamic_cast to cast a pointer to one type of template instantiation into a pointer to another type of instance. Remember, the precise type of an object of a template class is determined by the type of data used to create an instance of the template. Thus, Num and Num are two different types. + +const_cast +The const_cast operator is used to explicitly override const and/or volatile in a cast. The target type must be the same as the source type except for the alteration of its const or volatile attributes. The most common use of const_cast is to remove const-ness. The general form of const_cast is shown here. + +const_cast (expr) + +Here, type specifies the target type of the cast, and expr is the expression being cast into the new type. +The following program demonstrates const_cast. + + +// Demonstrate const_cast. #include +using namespace std; + +void sqrval(const int *val) { +int *p; + +// cast away const-ness. +p = const_cast (val); + +*p = *val * *val; // now, modify object through v } + +int main() { +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 589 + + + +int x = 10; + +cout << "x before call: " << x << endl; sqrval(&x); +cout << "x after call: " << x << endl; + +return 0; } + +The output produced by this program is shown here: + +x before call: 10 x after call: 100 + +As you can see, x was modified by sqrval() even though the parameter to sqrval() was specified as a const pointer. +const_cast can also be used to cast away const-ness from a const reference. For example, here is the preceding program reworked so that the value being squared is passed as a const reference. + + +// Use const_cast on a const reference. #include +using namespace std; + +void sqrval(const int &val) { +// cast away const on val const_cast (val) = val * val; +} + +int main() { +int x = 10; + +cout << "x before call: " << x << endl; sqrval(x); +cout << "x after call: " << x << endl; + +return 0; } +590 C + + : T h e C o m p l e t e R e f e r e n c e + + +This program produces the same output as before. Again, it works only because the const_cast temporarily removes the const attribute from val, allowing it to be used to assign a new value to the calling argument (in this case, x). +It must be stressed that the use of const_cast to cast way const-ness is a potentially dangerous feature. Use it with care. +One other point: Only const_cast can cast away const-ness. That is, neither dynamic_cast, static_cast nor reinterpret_cast can alter the const-ness of an object. + +static_cast +The static_cast operator performs a nonpolymorphic cast. It can be used for any standard conversion. No run-time checks are performed. Its general form is + +static_cast (expr) + +Here, type specifies the target type of the cast, and expr is the expression being cast into the new type. +The static_cast operator is essentially a substitute for the original cast operator. It simply performs a nonpolymorphic cast. For example, the following casts an int value into a double. + + +// Use static_cast. #include using namespace std; + +int main() { +int i; + +for(i=0; i<10; i++) +cout << static_cast (i) / 3 << " "; + +return 0; } + +reinterpret_cast +The reinterpret_cast operator converts one type into a fundamentally different type. For example, it can change a pointer into an integer and an integer into a pointer. It can also be used for casting inherently incompatible pointer types. Its general form is + +reinterpret_cast (expr) +C h a p t e r 2 2 : R u n - T i m e T y p e I D a n d t h e C a s t i n g O p e r a t o r s 591 + + +Here, type specifies the target type of the cast, and expr is the expression being cast into the new type. +The following program demonstrates the use of reinterpret_cast: + + +// An example that uses reinterpret_cast. #include +using namespace std; + +int main() { +int i; +char *p = "This is a string"; + +i = reinterpret_cast (p); // cast pointer to integer + +cout << i; + +return 0; } + +Here, reinterpret_cast converts the pointer p into an integer. This conversion represents a fundamental type change and is a good use of reinterpret_cast. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 23 Namespaces, +Conversion Functions, +and Other Advanced Topics + + + + + + + + +593 +594 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes namespaces and several other advanced features, including conversion functions, explicit constructors, const and volatile member functions, the asm keyword, and linkage specifications. It ends with a discussion of C++'s +T +array-based I/O and a summary of the differences between C and C++. + + +Namespaces +Namespaces were briefly introduced earlier in this book. They are a relatively recent addition to C++. Their purpose is to localize the names of identifiers to avoid name collisions. The C++ programming environment has seen an explosion of variable, function, and class names. Prior to the invention of namespaces, all of these names competed for slots in the global namespace and many conflicts arose. For example, if your program defined a function called abs() , it could (depending upon its parameter list) override the standard library function abs() because both names would be stored in the global namespace. Name collisions were compounded when two or more +third-party libraries were used by the same program. In this case, it was possible— even likely—that a name defined by one library would conflict with the same name defined by the other library. The situation can be particularly troublesome for class names. For example, if your program defines a class call ThreeDCircle and a library used by your program defines a class by the same name, a conflict will arise. +The creation of the namespace keyword was a response to these problems. Because it localizes the visibility of names declared within it, a namespace allows the same name to be used in different contexts without conflicts arising. Perhaps the most noticeable beneficiary of namespace is the C++ standard library. Prior to namespace, the entire C++ library was defined within the global namespace (which was, of course, the only namespace). Since the addition of namespace, the C++ library is now defined within its own namespace, called std, which reduces the chance of name collisions. You can also create your own namespaces within your program to localize the visibility of any names that you think may cause conflicts. This is especially important if you are creating class or function libraries. + +Namespace Fundamentals +The namespace keyword allows you to partition the global namespace by creating a +declarative region. In essence, a namespace defines a scope. The general form of namespace is shown here: + +namespace name { // declarations +} +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 595 + + +Anything defined within a namespace statement is within the scope of that namespace. Here is an example of a namespace. It localizes the names used to implement a +simple countdown counter class. In the namespace are defined the counter class, which implements the counter, and the variables upperbound and lowerbound, which contain the upper and lower bounds that apply to all counters. + +namespace CounterNameSpace { int upperbound; +int lowerbound; + +class counter { int count; +public: counter(int n) { +if(n <= upperbound) count = n; else count = upperbound; +} + +void reset(int n) { +if(n <= upperbound) count = n; } + +int run() { +if(count > lowerbound) return count--; else return lowerbound; +} }; +} + +Here, upperbound, lowerbound, and the class counter are part of the scope defined by the CounterNameSpace namespace. +Inside a namespace, identifiers declared within that namespace can be referred to directly, without any namespace qualification. For example, within CounterNameSpace, the run() function can refer directly to lowerbound in the statement + +if(count > lowerbound) return count--; + +However, since namespace defines a scope, you need to use the scope resolution operator to refer to objects declared within a namespace from outside that namespace. +596 C + + : T h e C o m p l e t e R e f e r e n c e + + +For example, to assign the value 10 to upperbound from code outside CounterNameSpace, you must use this statement: + + +CounterNameSpace::upperbound = 10; + +Or to declare an object of type counter from outside CounterNameSpace, you will use a statement like this: + + +CounterNameSpace::counter ob; + +In general, to access a member of a namespace from outside its namespace, precede the member's name with the name of the namespace followed by the scope resolution operator. +Here is a program that demonstrates the use of CounterNameSpace. + + +// Demonstrate a namespace. #include +using namespace std; + +namespace CounterNameSpace { int upperbound; +int lowerbound; + +class counter { int count; +public: counter(int n) { +if(n <= upperbound) count = n; else count = upperbound; +} + +void reset(int n) { +if(n <= upperbound) count = n; } + +int run() { +if(count > lowerbound) return count--; else return lowerbound; +} +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 597 + + + +}; } + +int main() { +CounterNameSpace::upperbound = 100; CounterNameSpace::lowerbound = 0; + +CounterNameSpace::counter ob1(10); int i; + +do { +i = ob1.run(); cout << i << " "; +} while(i > CounterNameSpace::lowerbound); cout << endl; + +CounterNameSpace::counter ob2(20); + +do { +i = ob2.run(); cout << i << " "; +} while(i > CounterNameSpace::lowerbound); cout << endl; + +ob2.reset(100); CounterNameSpace::lowerbound = 90; do { +i = ob2.run(); cout << i << " "; +} while(i > CounterNameSpace::lowerbound); + +return 0; } + +Notice that the declaration of a counter object and the references to upperbound and lowerbound are qualified by CounterNameSpace. However, once an object of type counter has been declared, it is not necessary to further qualify it or any of its members. Thus, ob1.run() can be called directly; the namespace has already +been resolved. +598 C + + : T h e C o m p l e t e R e f e r e n c e + + +using +As you can imagine, if your program includes frequent references to the members of a +namespace, having to specify the namespace and the scope resolution operator each time you need to refer to one quickly becomes a tedious chore. The using statement was invented to alleviate this problem. The using statement has these two +general forms: + +using namespace name; using name::member; + +In the first form, name specifies the name of the namespace you want to access. All of the members defined within the specified namespace are brought into view (i.e., they become part of the current namespace) and may be used without qualification. In the second form, only a specific member of the namespace is made visible. For example, assuming CounterNameSpace as shown above, the following using statements and assignments are valid. + + +using CounterNameSpace::lowerbound; // only lowerbound is visible lowerbound = 10; // OK because lowerbound is visible + +using namespace CounterNameSpace; // all members are visible upperbound = 100; // OK because all members are now visible + +The following program illustrates using by reworking the counter example from the previous section. + + +// Demonstrate using. #include using namespace std; + +namespace CounterNameSpace { int upperbound; +int lowerbound; + +class counter { int count; +public: counter(int n) { +if(n <= upperbound) count = n; else count = upperbound; +} +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 599 + + + +void reset(int n) { +if(n <= upperbound) count = n; } + +int run() { +if(count > lowerbound) return count--; else return lowerbound; +} }; +} + +int main() { +// use only upperbound from CounterNameSpace using CounterNameSpace::upperbound; + +// now, no qualification needed to set upperbound upperbound = 100; + +// qualification still needed for lowerbound, etc. CounterNameSpace::lowerbound = 0; + +CounterNameSpace::counter ob1(10); int i; + +do { +i = ob1.run(); cout << i << " "; +} while(i > CounterNameSpace::lowerbound); cout << endl; + +// now, use entire CounterNameSpace using namespace CounterNameSpace; + +counter ob2(20); + +do { +i = ob2.run(); cout << i << " "; +} while(i > lowerbound); cout << endl; + +ob2.reset(100); +600 C + + : T h e C o m p l e t e R e f e r e n c e + + + +lowerbound = 90; do { +i = ob2.run(); cout << i << " "; +} while(i > lowerbound); + +return 0; } + +The program illustrates one other important point: using one namespace does not override another. When you bring a namespace into view, it simply adds its names to whatever other namespaces are currently in effect. Thus, by the end of the program, both std and CounterNameSpace have been added to the global namespace. + +Unnamed Namespaces +There is a special type of namespace, called an unnamed namespace, that allows you to +create identifiers that are unique within a file. Unnamed namespaces are also called anonymous namespaces. They have this general form: + +namespace { +// declarations } + +Unnamed namespaces allow you to establish unique identifiers that are known only within the scope of a single file. That is, within the file that contains the unnamed namespace, the members of that namespace may be used directly, without qualification. But outside the file, the identifiers are unknown. +Unnamed namespaces eliminate the need for certain uses of the static storage class modifier. As explained in Chapter 2, one way to restrict the scope of a global name to the file in which it is declared is to use static. For example, consider the following two files that are part of the same program. + + +File One + +static int k; void f1() { +k = 99; // OK } + +File Two + +extern int k; void f2() { +k = 10; // error } + + +Because k is defined in File One, it may be used in File One. In File Two, k is specified as extern, which means that its name and type are known but that k itself is not +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 601 + + +actually defined. When these two files are linked, the attempt to use k within File Two results in an error because there is no definition for k. By preceding k with static in File One, its scope is restricted to that file and it is not available to File Two. +While the use of static global declarations is still allowed in C++, a better way to accomplish the same effect is to use an unnamed namespace. For example: + + +File One + +namespace { int k; +} +void f1() { +k = 99; // OK } + +File Two + +extern int k; void f2() { +k = 10; // error } + + +Here, k is also restricted to File One. The use of the unnamed namespace rather than static is recommended for new code. + +Some Namespace Options +There may be more than one namespace declaration of the same name. This allows a namespace to be split over several files or even separated within the same file. +For example: + + +#include using namespace std; + +namespace NS { int i; +} + +// ... + +namespace NS { int j; +} + +int main() { +NS::i = NS::j = 10; + +// refer to NS specifically +602 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << NS::i * NS::j << "\n"; + +// use NS namespace using namespace NS; + +cout << i * j; + +return 0; } + +This program produces the following output: + +100 100 + +Here, NS is split into two pieces. However, the contents of each piece are still within the same namespace, that is, NS. +A namespace must be declared outside of all other scopes. This means that you cannot declare namespaces that are localized to a function, for example. There is, however, one exception: a namespace can be nested within another. Consider +this program: + + +#include using namespace std; + +namespace NS1 { int i; +namespace NS2 { // a nested namespace int j; +} } + +int main() { +NS1::i = 19; +// NS2::j = 10; Error, NS2 is not in view NS1::NS2::j = 10; // this is right + +cout << NS1::i << " "<< NS1::NS2::j << "\n"; + +// use NS1 +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 603 + + + +using namespace NS1; + +/* Now that NS1 is in view, NS2 can be used to refer to j. */ +cout << i * NS2::j; + +return 0; } + +This program produces the following output: + +19 10 190 + +Here, the namespace NS2 is nested within NS1. Thus, when the program begins, to refer to j, you must qualify it with both the NS1 and NS2 namespaces. NS2 by itself is insufficient. After the statement + + +using namespace NS1; + +executes, you can refer directly to NS2 since the using statement brings NS1 into view. Typically, you will not need to create namespaces for most small to medium-sized +programs. However, if you will be creating libraries of reusable code or it you want to ensure the widest portability, then consider wrapping your code within a namespace. + + +The std Namespace +Standard C++ defines its entire library in its own namespace called std. This is the reason that most of the programs in this book include the following statement: + + +using namespace std; + +This causes the std namespace to be brought into the current namespace, which gives you direct access to the names of the functions and classes defined within the library without having to qualify each one with std::. +Of course, you can explicitly qualify each name with std:: if you like. For example, the following program does not bring the library into the global namespace. + + +// Use explicit std:: qualification. +604 C + + : T h e C o m p l e t e R e f e r e n c e + + + +#include + +int main() { +int val; + +std::cout << "Enter a number: "; + +std::cin >> val; + +std::cout << "This is your number: "; std::cout << std::hex << val; + +return 0; } + +Here, cout, cin, and the manipulator hex are explicitly qualified by their namespace. That is, to write to standard output, you must specify std::cout; to read from standard input, you must use std::cin; and the hex manipulator must be referred to as std::hex. +You may not want to bring the standard C++ library into the global namespace if your program will be making only limited use of it. However, if your program contains hundreds of references to library names, then including std in the current namespace is far easier than qualifying each name individually. +If you are using only a few names from the standard library, it may make more sense to specify a using statement for each individually. The advantage to this approach is that you can still use those names without an std:: qualification, but you will not be bringing the entire standard library into the global namespace. For example: + + +// Bring only a few names into the global namespace. #include + +// gain access to cout, cin, and hex using std::cout; +using std::cin; using std::hex; + +int main() { +int val; +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 605 + + + +cout << "Enter a number: "; + +cin >> val; +cout << "This is your number: "; cout << hex << val; +return 0; } + +Here, cin, cout, and hex may be used directly, but the rest of the std namespace has not been brought into view. +As explained, the original C++ library was defined in the global namespace. If you will be converting older C++ programs, then you will need to either include a using namespace std statement or qualify each reference to a library member with std::. This is especially important if you are replacing old .H header files with the new-style headers. Remember, the old .H headers put their contents into the global namespace; the new-style headers put their contents into the std namespace. + + +Creating Conversion Functions +In some situations, you will want to use an object of a class in an expression involving other types of data. Sometimes, overloaded operator functions can provide the means of doing this. However, in other cases, what you want is a simple type conversion from the class type to the target type. To handle these cases, C++ allows you to create custom conversion functions. A conversion function converts your class into a type compatible with that of the rest of the expression. The general format of a type conversion function is + +operator type( ) { return value; } + +Here, type is the target type that you are converting your class to, and value is the value of the class after conversion. Conversion functions return data of type type, and no other return type specifier is allowed. Also, no parameters may be included. A conversion function must be a member of the class for which it is defined. Conversion functions are inherited and they may be virtual. +The following illustration of a conversion function uses the stack class first developed in Chapter 11. Suppose that you want to be able to use objects of type stack within an integer expression. Further, suppose that the value of a stack object used in an integer expression is the number of values currently on the stack. (You might want +606 C + + : T h e C o m p l e t e R e f e r e n c e + + +to do something like this if, for example, you are using stack objects in a simulation and are monitoring how quickly the stacks fill up.) One way to approach this is to convert an object of type stack into an integer that represents the number of items on the stack. To accomplish this, you use a conversion function that looks +like this: + +operator int() { return tos; } + +Here is a program that illustrates how the conversion function works: + +#include using namespace std; + +const int SIZE=100; + +// this creates the class stack class stack { +int stck[SIZE]; int tos; +public: +stack() { tos=0; } void push(int i); int pop(void); +operator int() { return tos; } // conversion of stack to int }; + +void stack::push(int i) { +if(tos==SIZE) { +cout << "Stack is full.\n"; return; +} +stck[tos] = i; tos++; +} + +int stack::pop() { +if(tos==0) { +cout << "Stack underflow.\n"; return 0; +} +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 607 + + + +tos--; +return stck[tos]; } + +int main() { +stack stck; int i, j; + +for(i=0; i<20; i++) stck.push(i); + +j = stck; // convert to integer + +cout << j << " items on stack.\n"; + +cout << SIZE - stck << " spaces open.\n"; return 0; +} + + +This program displays this output: + +20 items on stack. 80 spaces open. + +As the program illustrates, when a stack object is used in an integer expression, such as j = stck, the conversion function is applied to the object. In this specific case, the conversion function returns the value 20. Also, when stck is subtracted from SIZE, the conversion function is also called. +Here is another example of a conversion function. This program creates a class called pwr() that stores and computes the outcome of some number raised to some power. It stores the result as a double. By supplying a conversion function to type double and returning the result, you can use objects of type pwr in expressions involving other double values. + +#include using namespace std; + +class pwr { double b; int e; double val; +608 C + + : T h e C o m p l e t e R e f e r e n c e + + + +public: +pwr(double base, int exp); pwr operator+(pwr o) { +double base; int exp; +base = b + o.b; exp = e + o.e; + +pwr temp(base, exp); return temp; +} +operator double() { return val; } // convert to double }; + +pwr::pwr(double base, int exp) { +b = base; e = exp; val = 1; +if(exp==0) return; +for( ; exp>0; exp--) val = val * b; } + +int main() { +pwr x(4.0, 2); double a; + +a = x; // convert to double +cout << x + 100.2; // convert x to double and add 100.2 cout << "\n"; + +pwr y(3.3, 3), z(0, 0); + +z = x + y; // no conversion a = z; // convert to double cout << a; + +return 0; } +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 609 + + +The output from the program is shown here. + +116.2 20730.7 + +As you can see, when x is used in the expression x + 100.2, the conversion function is used to produce the double value. Notice also that in the expression x + y, no conversion is applied because the expression involves only objects of type pwr. +As you can infer from the foregoing examples, there are many situations in which it is beneficial to create a conversion function for a class. Often, conversion functions provide a more natural syntax to be used when class objects are mixed with the built-in types. Specifically, in the case of the pwr class, the availability of the conversion to double makes objects of that class used in "normal" mathematical expressions both easier to program and easier to understand. +You can create different conversion functions to meet different needs. You could define one that converts to double or long, for example. Each will be applied automatically as determined by the type of each expression. + + +const Member Functions and mutable +Class member functions may be declared as const, which causes this to be treated as a const pointer. Thus, that function cannot modify the object that invokes it. Also, a const object may not invoke a non-const member function. However, a const member function can be called by either const or non-const objects. +To specify a member function as const, use the form shown in the following example. + + +class X { +int some_var; public: +int f1() const; // const member function }; + +As you can see, the const follows the function's parameter declaration. +The purpose of declaring a member function as const is to prevent it from modifying the object that invokes it. For example, consider the following program. + + +/* +Demonstrate const member functions. +610 C + + : T h e C o m p l e t e R e f e r e n c e + + + +This program won't compile. */ +#include using namespace std; + +class Demo { int i; +public: +int geti() const { return i; // ok +} + +void seti(int x) const { i = x; // error! +} }; + +int main() { +Demo ob; + +ob.seti(1900); cout << ob.geti(); + +return 0; } + +This program will not compile because seti() is declared as const. This means that it is not allowed to modify the invoking object. Since it attempts to change i, the program is in error. In contrast, since geti() does not attempt to modify i, it is perfectly acceptable. +Sometimes there will be one or more members of a class that you want a const function to be able to modify even though you don't want the function to be able to modify any of its other members. You can accomplish this through the use of mutable. It overrides constness. That is, a mutable member can be modified by a const member function. For example: + + +// Demonstrate mutable. #include using namespace std; + +class Demo { +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 611 + + + +mutable int i; int j; +public: +int geti() const { return i; // ok +} + +void seti(int x) const { i = x; // now, OK. +} + +/* The following function won't compile. void setj(int x) const { +j = x; // Still Wrong! } +*/ }; + +int main() { +Demo ob; + +ob.seti(1900); cout << ob.geti(); + +return 0; } + +Here, i is specified as mutable, so it may be changed by the seti() function. However, j is not mutable and setj() is unable to modify its value. + + +Volatile Member Functions +Class member functions may be declared as volatile, which causes this to be treated as a volatile pointer. To specify a member function as volatile, use the form shown in the following example: + + +class X { public: +void f2(int a) volatile; // volatile member function }; +612 C + + : T h e C o m p l e t e R e f e r e n c e + + +Explicit Constructors +As explained in Chapter 12, any time you have a constructor that requires only one argument, you can use either ob(x) or ob = x to initialize an object. The reason for this is that whenever you create a constructor that takes one argument, you are also implicitly creating a conversion from the type of that argument to the type of the class. But there may be times when you do not want this automatic conversion to take place. For this purpose, C++ defines the keyword explicit. To understand its effects, consider the following program. + + +#include using namespace std; + +class myclass { int a; +public: +myclass(int x) { a = x; } int geta() { return a; } +}; + +int main() { +myclass ob = 4; // automatically converted into myclass(4) + +cout << ob.geta(); + +return 0; } + +Here, the constructor for myclass takes one parameter. Pay special attention to how ob is declared in main() . The statement + + +myclass ob = 4; // automatically converted into myclass(4) + +is automatically converted into a call to the myclass constructor with 4 being the argument. That is, the preceding statement is handled by the compiler as if it were written like this: + + +myclass ob(4); +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 613 + + +If you do not want this implicit conversion to be made, you can prevent it by using explicit. The explicit specifier applies only to constructors. A constructor specified as explicit will only be used when an initialization uses the normal constructor syntax. It will not perform any automatic conversion. For example, by declaring the myclass constructor as explicit, the automatic conversion will not be supplied. Here is myclass() declared as explicit. + + +#include using namespace std; + +class myclass { int a; +public: +explicit myclass(int x) { a = x; } int geta() { return a; } +}; + +Now, only constructors of the form + +myclass ob(4); + +will be allowed and a statement like + +myclass ob = 4; // now in error + +will be invalid. + + +Using the asm Keyword +While C++ is a comprehensive and powerful programming language, there are a few highly specialized situations that it cannot handle. (For example, there is no C++ statement that disables interrupts.) To accommodate special situations, C++ provides a "trap door" that allows you to drop into assembly code at any time, bypassing the C++ compiler entirely. This "trap door" is the asm statement. Using asm, you can embed assembly language directly into your C++ program. This assembly code is compiled without any modification, and it becomes part of your program's code at the point at which the asm statement occurs. +The general form of the asm keyword is shown here: + +asm ("op-code"); +614 C + + : T h e C o m p l e t e R e f e r e n c e + + +where op-code is the assembly language instruction that will be embedded in your program. However, several compilers also allow the following forms of asm: + +asm instruction ; +asm instruction newline asm { +instruction sequence } + +Here, instruction is any valid assembly language instruction. Because of the implementation-specific nature of asm, you must check the documentation that came with your compiler for details. +At the time of this writing, Microsoft's Visual C++ uses _ _asm for embedding assembly code. It is otherwise similar to asm. +Here is a simple (and fairly "safe") example that uses the asm keyword: + +#include using namespace std; + +int main() { +asm int 5; // generate intertupt 5 + +return 0; } + +When run under DOS, this program generates an INT 5 instruction, which invokes the print-screen function. + + +Caution + +A thorough working knowledge of assembly language programming is required for usingtheasmstatement.Ifyouarenotproficientwithassemblylanguage,itisbest to avoid using asm because very nasty errors may result. + + + +Linkage Specification +In C++ you can specify how a function is linked into your program. By default, functions are linked as C++ functions. However, by using a linkage specification, you can cause a function to be linked for a different type of language. The general form of a linkage specifier is + +extern "language" function-prototype +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 615 + + +where language denotes the desired language. All C++ compilers support both C and C++ linkage. Some will also allow linkage specifiers for Fortran, Pascal, or BASIC. (You will need to check the user's manual for your compiler.) +This program causes myCfunc() to be linked as a C function. + + +#include using namespace std; + +extern "C" void myCfunc(); + +int main() { +myCfunc(); + +return 0; } + +// This will link as a C function. void myCfunc() +{ +cout << "This links as a C function.\n"; } + + +Note + +The extern keyword is a necessary part of the linkage specification. Further, the linkage specification must be global; it cannot be used inside of a function. + + +You can specify more than one function at a time using this form of the linkage specification: + +extern "language" { prototypes +} + + +Array-Based I/O +In addition to console and file I/O, C++'s stream-based I/O system allows array-based I/O. Array-based I/O uses a character array as either the input device, the output device, or both. Array-based I/O is performed through normal C++ streams. In fact, everything you already know about C++ I/O is applicable to array-based I/O. The only thing that makes array-based I/O unique is that the device linked to the stream is an array of characters. Streams that are linked to character arrays are commonly +616 C + + : T h e C o m p l e t e R e f e r e n c e + + +referred to as char * streams. To use array-based I/O in your programs, you must include . + + +Note + +The character-based stream classes described in this section are deprecated by Standard C++. This means that they are still valid, but not recommended for new code. This brief discussion is included because they are presently in wide use. + + +The Array-Based Classes +The array-based I/O classes are istrstream, ostrstream, and strstream. These classes are used to create input, output, and input/output streams, respectively. Further, the istrstream class is derived from istream, the ostrstream class is derived from ostream, and strstream has iostream as a base class. Therefore, all array-based classes are indirectly derived from ios and have access to the same member functions that the "normal" I/O classes do. + +Creating an Array-Based Output Stream +To perform output to an array, you must link that array to a stream using this ostrstream constructor: + +ostrstream ostr(char *buf, streamsize size, openmode mode=ios::out); + +Here, buf is a pointer to the array that will be used to collect characters written to the stream ostr. The size of the array is passed in the size parameter. By default, the stream is opened for normal output, but you can OR various other options with it to create the mode that you need. For example, you might include ios::app to cause output to be written at the end of any information already contained in the array. For most purposes, mode will be allowed to default. +Once you have opened an array-based output stream, all output to that stream is put into the array. However, no output will be written outside the bounds of the array. Attempting to do so will result in an error. +Here is a simple program that demonstrates an array-based output stream. + + +#include #include using namespace std; + +int main() { +char str[80]; + +ostrstream outs(str, sizeof(str)); +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 617 + + + +outs << "C++ array-based I/O. "; outs << 1024 << hex << " "; outs.setf(ios::showbase); +outs << 100 << ' ' << 99.789 << ends; + +cout << str; // display string on console + +return 0; } + +This program displays the following: + +C++ array-based I/O. 1024 0x64 99.789 + +Keep in mind that outs is a stream like any other stream; it has the same capabilities as any other type of stream that you have seen earlier. The only difference is that the device that it is linked to is a character array. Because outs is a stream, manipulators like hex and ends are perfectly valid. ostream member functions, such as setf() , are also available for use. +This program manually null terminates the array by using the ends manipulator. Whether the array will be automatically null terminated or not depends on the implementation, so it is best to perform null termination manually if it is important to your application. +You can determine how many characters are in the output array by calling the pcount() member function. It has this prototype: + +streamsize pcount( ); + +The number returned by pcount() also includes the null terminator, if it exists. The following program demonstrates pcount() . It reports that outs contains 18 +characters: 17 characters plus the null terminator. + + +#include #include using namespace std; + +int main() { +char str[80]; + +ostrstream outs(str, sizeof(str)); +618 C + + : T h e C o m p l e t e R e f e r e n c e + + + +outs << "abcdefg "; +outs << 27 << " " << 890.23; outs << ends; // null terminate + +cout << outs.pcount(); // display how many chars in outs + +cout << " " << str; + +return 0; } + + +Using an Array as Input +To link an input stream to an array, use this istrstream constructor: + +istrstream istr(const char *buf); + +Here, buf is a pointer to the array that will be used as a source of characters each time input is performed on the stream istr. The contents of the array pointed to by buf must be null terminated. However, the null terminator is never read from the array. +Here is a sample program that uses a string as input. + + +#include #include using namespace std; + +int main() { +char s[] = "10 Hello 0x75 42.73 OK"; + +istrstream ins(s); + +int i; +char str[80]; float f; + +// reading: 10 Hello ins >> i; +ins >> str; +cout << i << " " << str << endl; +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 619 + + + +// reading 0x75 42.73 OK ins >> hex >> i; +ins >> f; ins >> str; + +cout << hex << i << " " << f << " " << str; + +return 0; } + +If you want only part of a string to be used for input, use this form of the istrstream constructor: + +istrstream istr(const char *buf, streamsize size); + +Here, only the first size elements of the array pointed to by buf will be used. This string need not be null terminated, since it is the value of size that determines the size of +the string. +Streams linked to memory behave just like those linked to other devices. For example, the following program demonstrates how the contents of any text array can be read. When the end of the array (same as end-of-file) is reached, ins will be false. + + +/* This program shows how to read the contents of any array that contains text. */ +#include #include using namespace std; + +int main() { +char s[] = "10.23 this is a test <<>><> ch; cout << ch; +} + +return 0; } + + +Input/Output Array-Based Streams +To create an array-based stream that can perform both input and output, use this strstream constructor function: + +strstream iostr(char *buf, streamsize size, openmode mode = ios::in | ios::out); + +Here, buf points to the string that will be used for I/O operations. The value of size specifies the size of the array. The value of mode determines how the stream iostr operates. For normal input/output operations, mode will be ios::in | ios::out. For input, the array must be null terminated. +Here is a program that uses an array to perform both input and output. + + +// Perform both input and output. #include +#include using namespace std; + +int main() { +char iostr[80]; + +strstream strio(iostr, sizeof(iostr), ios::in | ios::out); + +int a, b; char str[80]; + +strio << "10 20 testing "; strio >> a >> b >> str; +cout << a << " " << b << " " << str << endl; + +return 0; } + +This program first writes 10 20 testing to the array and then reads it back in again. +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 621 + + +Using Dynamic Arrays +In the preceding examples, when you linked a stream to an output array, the array and its size were passed to the ostrstream constructor. This approach is fine as long as you know the maximum number of characters that you will be outputting to the array. However, what if you don't know how large the output array needs to be? The solution to this problem is to use a second form of the ostrstream constructor, shown here: + +ostrstream( ); + +When this constructor is used, ostrstream creates and maintains a dynamically allocated array, which automatically grows in length to accommodate the output that it must store. +To access the dynamically allocated array, you must use a second function, called str() , which has this prototype: + +char *str( ); + +This function "freezes" the array and returns a pointer to it. You use the pointer returned by str() to access the dynamic array as a string. Once a dynamic array is frozen, it cannot be used for output again unless its is unfrozen (see below). Therefore, you will not want to freeze the array until you are through outputting characters to it. +Here is a program that uses a dynamic output array. + +#include #include using namespace std; + +int main() { +char *p; + +ostrstream outs; // dynamically allocate array + +outs << "C++ array-based I/O "; outs << -10 << hex << " "; outs.setf(ios::showbase); +outs << 100 << ends; + +p = outs.str(); // Freeze dynamic buffer and return // pointer to it. +622 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << p; + +return 0; } + +You can also use dynamic I/O arrays with the strstream class, which can perform both input and output on an array. +It is possible to freeze or unfreeze a dynamic array by calling the freeze() function. Its prototype is shown here: + +void freeze(bool action = true); + +If action is true, the array is frozen. If action is false, the array is unfrozen. + + +Using Binary I/O with Array-Based Streams Remember that array-based I/O has all of the functionality and capability of "normal" I/O. Therefore, arrays linked to array-based streams can also contain binary information. When reading binary information, you may need to use the eof() function to determine when the end of the array has been reached. For example, the following program shows how to read the contents of any array—binary or text—using the function get() . + +#include #include using namespace std; + +int main() { +char *p = "this is a test\1\2\3\4\5\6\7"; + +istrstream ins(p); + +char ch; + +// read and display binary info while (!ins.eof()) { +ins.get(ch); +cout << hex << (int) ch << ' '; +C h a p t e r 2 3 : N a m e s p a c e s , C o n v e r s i o n F u n c t i o n s , a n d O t h e r A d v a n c e d T o p i c s 623 + + + +} +return 0; } + +In this example, the values formed by \1\2\3, and so on are nonprinting values. +To output binary characters, use the put() function. If you need to read buffers of binary data, you can use the read() member function. To write buffers of binary data, use the write() function. + + +Summarizing the Differences Between C and C++ +For the most part, Standard C++ is a superset of Standard C, and virtually all C programs are also C++ programs. However, a few differences do exist, and these have been discussed throughout Parts One and Two of this book. The most important are summarized here. +In C++, local variables can be declared anywhere within a block. In C, they must be declared at the start of a block, before any "action" statements occur. +In C, a function declared like + +int f(); + +says nothing about any parameters to that function. That is, when there is nothing specified between the parentheses following the function's name, in C this means that nothing is being stated, one way or the other, about any parameters to that function. It might have parameters, or it might not. However, in C++, a function declaration like this means that the function does not have parameters. That is, in C++, these two declarations are equivalent: + + +int f(); + +int f(void); + +In C++, void in a parameter list is optional. Many C++ programmers include void as a means of making it completely clear to anyone reading the program that a function does not have any parameters, but this is technically unnecessary. +In C++, all functions must be prototyped. This is an option in C (although good programming practice suggests full prototyping be used in a C program). +A small but potentially important difference between C and C++ is that in C, a character constant is automatically elevated to an integer. In C++, it is not. +624 C + + : T h e C o m p l e t e R e f e r e n c e + + +In C, it is not an error to declare a global variable several times, even though this is bad programming practice. In C++, it is an error. +In C, an identifier will have at least 31 significant characters. In C++, all characters are significant. However, from a practical point of view, extremely long identifiers are unwieldy and seldom needed. +In C, although it is unusual, you can call main() from within your program. This is not allowed by C++. +In C, you cannot take the address of a register variable. In C++, this is allowed. +In C, if no type specifier is present in some types of declaration statements, the type int is assumed. This "default-to-int" rule no longer applies to C++. (Future versions of C are also expected to drop the "default-to-int" rule.) + +C++ + + + + +Chapter 24 Introducing the Standard +Template Library + + + + + + + + + + + +625 +626 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter explores what is considered by many to be the most important new feature added to C++ in recent years: the standard template library (STL). The inclusion of the STL was one of the major efforts that took place during the +T +standardization of C++. It provides general-purpose, templatized classes and functions that implement many popular and commonly used algorithms and data structures, including, for example, support for vectors, lists, queues, and stacks. It also defines various routines that access them. Because the STL is constructed from template classes, the algorithms and data structures can be applied to nearly any type of data. +The STL is a complex piece of software engineering that uses some of C++'s most sophisticated features. To understand and use the STL, you must have a complete understanding of the C++ language, including pointers, references, and templates. Frankly, the template syntax that describes the STL can seem quite intimidating— although it looks more complicated than it actually is. While there is nothing in this chapter that is any more difficult than the material in the rest of this book, don't be surprised or dismayed if you find the STL confusing at first. Just be patient, study the examples, and don't let the unfamiliar syntax override the STL's basic simplicity. +The purpose of this chapter is to present an overview of the STL, including its design philosophy, organization, constituents, and the programming techniques needed to use it. Because the STL is a large library, it is not possible to discuss all of its features here. However, a complete reference to the STL is provided in Part Four. +This chapter also describes one of C++'s most important new classes: string. The string class defines a string data type that allows you to work with character strings much as you do other data types: using operators. The string class is closely related to the STL. + + +An Overview of the STL +Although the standard template library is large and its syntax can be intimidating, it is actually quite easy to use once you understand how it is constructed and what elements it employs. Therefore, before looking at any code examples, an overview of the STL is warranted. +At the core of the standard template library are three foundational items: containers, algorithms, and iterators. These items work in conjunction with one another to provide off-the-shelf solutions to a variety of programming problems. + +Containers +Containers are objects that hold other objects, and there are several different types. For example, the vector class defines a dynamic array, deque creates a double-ended queue, and list provides a linear list. These containers are called sequence containers because in STL terminology, a sequence is a linear list. In addition to the basic +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 627 + + +containers, the STL also defines associative containers, which allow efficient retrieval of values based on keys. For example, a map provides access to values with unique keys. Thus, a map stores a key/value pair and allows a value to be retrieved given its key. +Each container class defines a set of functions that may be applied to the container. For example, a list container includes functions that insert, delete, and merge elements. A stack includes functions that push and pop values. + +Algorithms +Algorithms act on containers. They provide the means by which you will manipulate the contents of containers. Their capabilities include initialization, sorting, searching, and transforming the contents of containers. Many algorithms operate on a range of elements within a container. + +Iterators +Iterators are objects that are, more or less, pointers. They give you the ability to cycle through the contents of a container in much the same way that you would use a pointer to cycle through an array. There are five types of iterators: + + +Iterator + +Random Access Bidirectional Forward +Input +Output + +Access Allowed + +Store and retrieve values. Elements may be accessed randomly. Store and retrieve values. Forward and backward moving. Store and retrieve values. Forward moving only. +Retrieve, but not store values. Forward moving only. +Store, but not retrieve values. Forward moving only. + + +In general, an iterator that has greater access capabilities can be used in place of one that has lesser capabilities. For example, a forward iterator can be used in place of an input iterator. +Iterators are handled just like pointers. You can increment and decrement them. You can apply the * operator to them. Iterators are declared using the iterator type defined by the various containers. +The STL also supports reverse iterators. Reverse iterators are either bidirectional or random-access iterators that move through a sequence in the reverse direction. Thus, if a reverse iterator points to the end of a sequence, incrementing that iterator will cause it to point to one element before the end. +When referring to the various iterator types in template descriptions, this book will use the following terms: +628 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Term + +BiIter ForIter InIter OutIter +RandIter + +Represents + +Bidirectional iterator Forward iterator Input iterator Output iterator +Random access iterator + + +Other STL Elements +In addition to containers, algorithms, and iterators, the STL relies upon several other standard components for support. Chief among these are allocators, predicates, comparison functions, and function objects. +Each container has defined for it an allocator. Allocators manage memory allocation for a container. The default allocator is an object of class allocator, but you can define your own allocators if needed by specialized applications. For most uses, the default allocator is sufficient. +Several of the algorithms and containers use a special type of function called a predicate. There are two variations of predicates: unary and binary. A unary predicate takes one argument, while a binary predicate has two. These functions return true/false results. But the precise conditions that make them return true or false are defined by you. For the rest of this chapter, when a unary predicate function is required, it will be notated using the type UnPred. When a binary predicate is required, the type BinPred will be used. In a binary predicate, the arguments are always in the order of first,second. For both unary and binary predicates, the arguments will contain values of the type of objects being stored by the container. +Some algorithms and classes use a special type of binary predicate that compares two elements. Comparison functions return true if their first argument is less than their second. Comparison functions will be notated using the type Comp. +In addition to the headers required by the various STL classes, the C++ standard library includes the and headers, which provide support for the STL. For example, the template class pair, which can hold a pair of values, is defined in . We will make use of pair later in this chapter. +The templates in help you construct objects that define operator() . These are called function objects and they may be used in place of function pointers in many places. There are several predefined function objects declared within . They are shown here: + + +plus minus negate equal_to +less less_equal + +multiplies not_equal_to +logical_and + +divides greater +logical_or + +modulus greater_equal +logical_not +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 629 + + +Perhaps the most widely used function object is less, which determines when one object is less than another. Function objects can be used in place of actual function pointers in the STL algorithms described later. Using function objects rather than function pointers allows the STL to generate more efficient code. +Two other entities that populate the STL are binders and negators. A binder binds an argument to a function object. A negator returns the complement of a predicate. +One final term to know is adaptor. In STL terms, an adaptor transforms one thing into another. For example, the container queue (which creates a standard queue) is an adaptor for the deque container. + + +The Container Classes +As explained, containers are the STL objects that actually store data. The containers defined by the STL are shown in Table 24-1. Also shown are the headers necessary to use each container. The string class, which manages character strings, is also a container, but it is discussed later in this chapter. + + + + + +Container + +bitset deque list map + +multimap + +multiset + +priority_queue queue +set stack +vector + +Description + +A set of bits. +A double-ended queue. A linear list. +Stores key/value pairs in which each key is associated with only one value. +Stores key/value pairs in which one key may be associated with two or more values. +A set in which each element is not necessarily unique. +A priority queue. A queue. +A set in which each element is unique. A stack. +A dynamic array. + +Required Header + + + + + + + + + + + +Table 24-1. The Containers Defined by the STL +630 C + + : T h e C o m p l e t e R e f e r e n c e + + +Since the names of the generic placeholder types in a template class declaration are arbitrary, the container classes declare typedefed versions of these types. This makes the type names concrete. Some of the most common typedef names are shown here: + + +size_type reference const_reference iterator const_iterator reverse_iterator +const_reverse_iterator value_type allocator_type key_type key_compare +value_compare + +Some type of integer +A reference to an element +A const reference to an element An iterator +A const iterator A reverse iterator +A const reverse iterator +The type of a value stored in a container The type of the allocator +The type of a key +The type of a function that compares two keys +The type of a function that compares two values + + + +General Theory of Operation +Although the internal operation of the STL is highly sophisticated, to use the STL is actually quite easy. First, you must decide on the type of container that you wish to use. Each offers certain benefits and trade-offs. For example, a vector is very +good when a random-access, array-like object is required and not too many insertions or deletions are needed. A list offers low-cost insertion and deletion but trades away speed. A map provides an associative container, but of course incurs additional overhead. +Once you have chosen a container, you will use its member functions to add elements to the container, access or modify those elements, and delete elements. Except for bitset, a container will automatically grow as needed when elements are added to it and shrink when elements are removed. +Elements can be added to and removed from a container a number of different ways. For example, both the sequence containers (vector, list, and deque) and the associative containers (map, multimap, set, and multiset) provide a member function called insert() , which inserts elements into a container, and erase() , which removes elements from a container. The sequence containers also provide push_back() and push_front() , which add an element to the end or the beginning of a container, respectively. These functions are probably the most common way that individual elements are added to a sequence container. You can remove individual elements from +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 631 + + +a sequence container by using pop_back() and pop_front() , which remove elements from the end and start of the container. +One of the most common ways to access the elements within a container is through an iterator. The sequence and the associative containers provide the member functions begin() and end() , which return iterators to the start and end of the container, respectively. These iterators are very useful when accessing the contents of a container. For example, to cycle through a container, you can obtain an iterator to its beginning using begin() and then increment that iterator until its value is equal to end() . +The associative containers provide the function find() , which is used to locate an element in an associative container given its key. Since associative containers link a key with its value, find() is how most elements in such a container are located. +Since a vector is a dynamic array, it also supports the standard array-indexing syntax for accessing its elements. +Once you have a container that holds information, it can be manipulated using one or more algorithms. The algorithms not only allow you to alter the contents of a container in some prescribed fashion, but they also let you transform one type of sequence into another. +In the following sections, you will learn to apply these general techniques to three representative containers: vector, list, and map. Once you understand how these containers work, you will have no trouble using the others. + +Vectors +Perhaps the most general-purpose of the containers is vector. The vector class supports a dynamic array. This is an array that can grow as needed. As you know, in C++ the size of an array is fixed at compile time. While this is by far the most efficient way to implement arrays, it is also the most restrictive because the size of the array cannot be adjusted at run time to accommodate changing program conditions. A vector solves this problem by allocating memory as needed. Although a vector is dynamic, you can still use the standard array subscript notation to access its elements. +The template specification for vector is shown here: + +template > class vector + +Here, T is the type of data being stored and Allocator specifies the allocator, which defaults to the standard allocator. vector has the following constructors: + +explicit vector(const Allocator &a = Allocator( ) ); explicit vector(size_type num, const T &val = T ( ), +const Allocator &a = Allocator( )); vector(const vector &ob); +template vector(InIter start, InIter end, const Allocator &a = Allocator( )); +632 C + + : T h e C o m p l e t e R e f e r e n c e + + +The first form constructs an empty vector. The second form constructs a vector that has num elements with the value val. The value of val may be allowed to default. The third form constructs a vector that contains the same elements as ob. The fourth form constructs a vector that contains the elements in the range specified by the iterators start and end. +Any object that will be stored in a vector must define a default constructor. It must also define the < and == operations. Some compilers may require that other comparison operators be defined. (Since implementations vary, consult your compiler's documentation for precise information.) All of the built-in types automatically satisfy these requirements. +Although the template syntax looks rather complex, there is nothing difficult about declaring a vector. Here are some examples: + + +vector iv; +vector cv(5); + +// create zero-length int vector +// create 5-element char vector + +vector cv(5, 'x'); // initialize a 5-element char vector vector iv2(iv); // create int vector from an int vector + +The following comparison operators are defined for vector: + +==, <, <=, !=, >, >= + +The subscripting operator [ ] is also defined for vector. This allows you to access the elements of a vector using standard array subscripting notation. +Several of the member functions defined by vector are shown in Table 24-2. (Remember, Part Four contains a complete reference to the STL classes.) Some of the most commonly used member functions are size() , begin() , end() , push_back() , insert() , and erase() . The size() function returns the current size of the vector. This function is quite useful because it allows you to determine the size of a vector at run time. Remember, vectors will increase in size as needed, so the size of a vector must be determined during execution, not during compilation. +The begin() function returns an iterator to the start of the vector. The end() function returns an iterator to the end of the vector. As explained, iterators are similar to pointers, and it is through the use of the begin() and end() functions that you obtain an iterator to the beginning and end of a vector. +The push_back() function puts a value onto the end of the vector. If necessary, the vector is increased in length to accommodate the new element. You can also add elements to the middle using insert() . A vector can also be initialized. In any event, once a vector contains elements, you can use array subscripting to access or modify those elements. You can remove elements from a vector using erase() . +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 633 + + + + +Member + +reference back( ); const_reference back( ) const; +iterator begin( ); const_iterator begin( ) const; +void clear( ); +bool empty( ) const; + +iterator end( ); const_iterator end( ) const; +iterator erase(iterator i); + + +iterator erase(iterator start, iterator end); + + +reference front( ); const_reference front( ) const; +iterator insert(iterator i, const T &val); + +void insert(iterator i, size_type num, const T & val) +template +void insert(iterator i, InIter start, InIter end); +reference operator[ ](size_type i) const; const_reference operator[ ](size_type i) +const; +void pop_back( ); +void push_back(const T &val); + +size_type size( ) const; + +Description + +Returns a reference to the last element in the vector. +Returns an iterator to the first element in the vector. +Removes all elements from the vector. +Returns true if the invoking vector is empty and false otherwise. +Returns an iterator to the end of the vector. +Removes the element pointed to by i. Returns an iterator to the element after the one removed. +Removes the elements in the range start to end. Returns an iterator to the element after the last element removed. +Returns a reference to the first element in the vector. +Inserts val immediately before the element specified by i. An iterator to the element is returned. +Inserts num copies of val immediately before the element specified by i. +Inserts the sequence defined by start and end immediately before the element specified by i. +Returns a reference to the element specified by i. + +Removes the last element in the vector. +Adds an element with the value speci-fied by val to the end of the vector. +Returns the number of elements currently in the vector. + + + +Table 24-2. Some Commonly Used Member Functions Defined by vector +634 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here is a short example that illustrates the basic operation of a vector. + +// Demonstrate a vector. #include #include #include +using namespace std; + +int main() { +vector v(10); // create a vector of length 10 int i; + +// display original size of v +cout << "Size = " << v.size() << endl; + +// assign the elements of the vector some values for(i=0; i<10; i++) v[i] = i + 'a'; + +// display contents of vector cout << "Current Contents:\n"; +for(i=0; i +#include #include +636 C + + : T h e C o m p l e t e R e f e r e n c e + + + +using namespace std; + +int main() { +vector v(10); // create a vector of length 10 vector::iterator p; // create an iterator +int i; + +// assign elements in vector a value p = v.begin(); +i = 0; +while(p != v.end()) { *p = i + 'a'; +p++; i++; +} + +// display contents of vector cout << "Original contents:\n"; p = v.begin(); +while(p != v.end()) { cout << *p << " "; p++; +} +cout << "\n\n"; + +// change contents of vector p = v.begin(); +while(p != v.end()) { *p = toupper(*p); p++; +} + +// display contents of vector cout << "Modified Contents:\n"; p = v.begin(); +while(p != v.end()) { cout << *p << " "; p++; +} +cout << endl; +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 637 + + + +return 0; } + +The output from this program is + +Original contents: a b c d e f g h i j + +Modified Contents: A B C D E F G H I J + +In the program, notice how the iterator p is declared. The type iterator is defined by the container classes. Thus, to obtain an iterator for a particular container, you will use a declaration similar to that shown in the example: simply qualify iterator with the name of the container. In the program, p is initialized to point to the start of the vector by using the begin() member function. This function returns an iterator to the start of the vector. This iterator can then be used to access the vector an element at a time by incrementing it as needed. This process is directly parallel to the way a pointer can be used to access the elements of an array. To determine when the end of the vector has been reached, the end() member function is employed. This function returns an iterator to the location that is one past the last element in the vector. Thus, when p equals v.end() , the end of the vector has been reached. + +Inserting and Deleting Elements in a Vector +In addition to putting new values on the end of a vector, you can insert elements into the middle using the insert() function. You can also remove elements using erase() . The following program demonstrates insert() and erase() . + + +// Demonstrate insert and erase. #include +#include using namespace std; + +int main() { +vector v(10); vector v2; +char str[] = ""; int i; +638 C + + : T h e C o m p l e t e R e f e r e n c e + + + +// initialize v +for(i=0; i<10; i++) v[i] = i + 'a'; + +// copy characters in str into v2 +for(i=0; str[i]; i++) v2.push_back(str[i]); + +// display original contents of vector cout << "Original contents of v:\n"; +for(i=0; i::iterator p = v.begin(); p += 2; // point to 3rd element + +// insert 10 X's into v v.insert(p, 10, 'X'); + +// display contents after insertion +cout << "Size after inserting X's = " << v.size() << endl; cout << "Contents after insert:\n"; +for(i=0; i c d e f g h i j + +This program demonstrates two forms of insert() . The first time it is used, it inserts 10 X's into v. The second time, it inserts the contents of a second vector, v2, into v. This second use is the most interesting. It takes three iterator arguments. The first specifies the point at which the insertion will occur within the invoking container. The last two point to the beginning and ending of the sequence to be inserted. + +Storing Class Objects in a Vector +Although the preceding examples have only stored objects of the built-in types in a +vector, vectors are not limited to this. They can store any type of objects, including those of classes that you create. Here is an example that uses a vector to store objects that hold the daily temperature highs for a week. Notice that DailyTemp defines the default constructor and that overloaded versions of < and == are provided. Remember, depending upon how your compiler implements the STL, other comparison operators may need to be defined. + + +// Store a class object in a vector. #include +#include #include using namespace std; +640 C + + : T h e C o m p l e t e R e f e r e n c e + + + +class DailyTemp { int temp; +public: +DailyTemp() { temp = 0; } DailyTemp(int x) { temp = x; } + +DailyTemp &operator=(int x) { temp = x; return *this; +} + +double get_temp() { return temp; } }; + +bool operator<(DailyTemp a, DailyTemp b) { +return a.get_temp() < b.get_temp(); } + +bool operator==(DailyTemp a, DailyTemp b) { +return a.get_temp() == b.get_temp(); } + +int main() { +vector v; int i; + +for(i=0; i<7; i++) v.push_back(DailyTemp(60 + rand()%30)); + +cout << "Farenheit temperatures:\n"; for(i=0; i> class list + +Here, T is the type of data stored in the list. The allocator is specified by Allocator, which defaults to the standard allocator. It has the following constructors: + +explicit list(const Allocator &a = Allocator( ) ); explicit list(size_type num, const T &val = T ( ), +const Allocator &a = Allocator( )); list(const list &ob); +template list(InIter start, InIter end, const Allocator &a = Allocator( )); + +The first form constructs an empty list. The second form constructs a list that has num elements with the value val, which can be allowed to default. The third form constructs a list that contains the same elements as ob. The fourth form constructs a list that contains the elements in the range specified by the iterators start and end. +642 C + + : T h e C o m p l e t e R e f e r e n c e + + +The following comparison operators are defined for list: + +==, <, <=, !=, >, >= + +Some of the commonly used list member functions are shown in Table 24-3. Like vectors, elements may be put into a list by using the push_back() function. You can + + + + +Member + +reference back( ); const_reference back( ) const; +iterator begin( ); const_iterator begin( ) const; +void clear( ); +bool empty( ) const; + +iterator end( ); const_iterator end( ) const; +iterator erase(iterator i); + + +iterator erase(iterator start, iterator end); + + +reference front( ); const_reference front( ) const; +iterator insert(iterator i, const T &val); + +void insert(iterator i, size_type num, const T &val) +template void insert(iterator i, +InIter start, InIter end); + +Description + +Returns a reference to the last element in the list. +Returns an iterator to the first element in the list. +Removes all elements from the list. +Returns true if the invoking list is empty and false otherwise. +Returns an iterator to the end of the list. + +Removes the element pointed to by i. Returns an iterator to the element after the one removed. +Removes the elements in the range start to end. Returns an iterator to the element after the last element removed. +Returns a reference to the first element in the list. +Inserts val immediately before the element specified by i. An iterator to the element is returned. +Inserts num copies of val immediately before the element specified by i. +Inserts the sequence defined by start and end immediately before the element specified by i. + + +Table 24-3. Some Commonly Used list Member Functions +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 643 + + + + +Member + +void merge(list &ob); template +void merge( &ob, Comp cmpfn); + + + +void pop_back( ); void pop_front( ); +void push_back(const T &val); + +void push_front(const T &val); + +void remove(const T &val); + +void reverse( ); size_type size( ) const; + +void sort( ); +template void sort(Comp cmpfn); + +void splice(iterator i, +list &ob); + +void splice(iterator i, +list &ob, iterator el); +void splice(iterator i, +list &ob, iterator start, iterator end); + +Description + +Merges the ordered list contained in ob with the ordered invoking list. The result is ordered. After the merge, the list contained in ob is empty. In the second form, a comparison function can be specified that determines when one element is less than another. +Removes the last element in the list. Removes the first element in the list. +Adds an element with the value specified by val to the end of the list. +Adds an element with the value specified by val to the front of the list. +Removes elements with the value val from the list. +Reverses the invoking list. +Returns the number of elements currently in the list. +Sorts the list. The second form sorts the list using the comparison function fn to determine when one element is less than another. +The contents of ob are inserted into the invoking list at the location pointed to by i. After the operation, ob is empty. +The element pointed to by el is removed from the list ob and stored in the invoking list at the location pointed to by i. +The range defined by start and end is removed from ob and stored in the invoking list beginning at the location pointed to by i. + + + +Table 24-3. Some Commonly Used list Member Functions (continued) +644 C + + : T h e C o m p l e t e R e f e r e n c e + + +put elements on the front of the list by using push_front() . An element can also be inserted into the middle of a list by using insert() . Two lists may be joined using splice() . One list may be merged into another using merge() . +Any data type that will be held in a list must define a default constructor. It must also define the various comparison operators. At the time of this writing, the precise requirements for an object that will be stored in a list vary from compiler to compiler, so you will need to check your compiler's documentation. +Here is a simple example of a list. + + +// List basics. #include #include using namespace std; + +int main() { +list lst; // create an empty list int i; + +for(i=0; i<10; i++) lst.push_back(i); + +cout << "Size = " << lst.size() << endl; + +cout << "Contents: "; list::iterator p = lst.begin(); while(p != lst.end()) { +cout << *p << " "; p++; +} +cout << "\n\n"; + +// change contents of list p = lst.begin(); +while(p != lst.end()) { *p = *p + 100; +p++; } + +cout << "Contents modified: "; p = lst.begin(); +while(p != lst.end()) { cout << *p << " "; +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 645 + + + +p++; } + +return 0; } + +The output produced by this program is shown here: + +Size = 10 +Contents: 0 1 2 3 4 5 6 7 8 9 + +Contents modified: 100 101 102 103 104 105 106 107 108 109 + +This program creates a list of integers. First, an empty list object is created. Next, 10 integers are put into the list. This is accomplished using the push_back() function, which puts each new value on the end of the existing list. Next, the size of the list and the list itself is displayed. The list is displayed via an iterator, using the following code: + + +list::iterator p = lst.begin(); while(p != lst.end()) { +cout << *p << " "; p++; +} + +Here, the iterator p is initialized to point to the start of the list. Each time through the loop, p is incremented, causing it to point to the next element. The loop ends when p points to the end of the list. This code is essentially the same as was used to cycle through a vector using an iterator. Loops like this are common in STL code, and the fact that the same constructs can be used to access different types of containers is part of the power of the STL. + +Understanding end( ) +Now is a good time to emphasize a somewhat unexpected attribute of the end() +container function. end() does not return a pointer to the last element in a container. Instead, it returns a pointer one past the last element. Thus, the last element in a container is pointed to by end() - 1 . This feature allows us to write very efficient algorithms that cycle through all of the elements of a container, including the last one, using an iterator. When the iterator has the same value as the one returned by end() , we know that all elements have been accessed. However, you must keep this feature in mind since it may seem a bit counterintuitive. For example, consider the following program, which displays a list forward and backward. +646 C + + : T h e C o m p l e t e R e f e r e n c e + + +// Understanding end(). #include #include +using namespace std; + +int main() { +list lst; // create an empty list int i; + +for(i=0; i<10; i++) lst.push_back(i); + +cout << "List printed forwards:\n"; list::iterator p = lst.begin(); while(p != lst.end()) { +cout << *p << " "; p++; +} +cout << "\n\n"; + +cout << "List printed backwards:\n"; p = lst.end(); +while(p != lst.begin()) { +p--; // decrement pointer before using cout << *p << " "; +} + +return 0; } + +The output produced by this program is shown here: + +List printed forwards: 0 1 2 3 4 5 6 7 8 9 + +List printed backwards: 9 8 7 6 5 4 3 2 1 0 + +The code that displays the list in the forward direction is the same as we have been using. But pay special attention to the code that displays the list in reverse order. The iterator p is initially set to the end of the list through the use of the end() function. Since end() returns an iterator to an object that is one past the last object actually +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 647 + + +stored in the list, p must be decremented before it is used. This is why p is decremented before the cout statement inside the loop, rather than after. Remember: end() does not return a pointer to the last object in the list; it returns a pointer that is one past the last value in the list. + +push_front( ) vs push_back( ) +You can build a list by adding elements to either the end or the start of the list. So far, we have been adding elements to the end by using push_back() . To add elements to the start, use push_front() . For example, + + +/* Demonstrating the difference between push_back() and push_front(). */ +#include #include using namespace std; + +int main() { +list lst1, lst2; int i; + +for(i=0; i<10; i++) lst1.push_back(i); for(i=0; i<10; i++) lst2.push_front(i); + +list::iterator p; + +cout << "Contents of lst1:\n"; p = lst1.begin(); +while(p != lst1.end()) { cout << *p << " "; p++; +} +cout << "\n\n"; + +cout << "Contents of lst2:\n"; p = lst2.begin(); +while(p != lst2.end()) { cout << *p << " "; p++; +} +648 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return 0; } + + +The output produced by this program is shown here: + +Contents of lst1: +0 1 2 3 4 5 6 7 8 9 + +Contents of lst2: +9 8 7 6 5 4 3 2 1 0 + +Since lst2 is built by putting elements onto its front, the resulting list is in the reverse order of lst1, which is built by putting elements onto its end. + +Sort a List +A list may be sorted by calling the sort() member function. The following program creates a list of random integers and then puts the list into sorted order. + + +// Sort a list. #include #include #include using namespace std; + +int main() { +list lst; int i; + +// create a list of random integers for(i=0; i<10; i++) +lst.push_back(rand()); + +cout << "Original contents:\n"; list::iterator p = lst.begin(); while(p != lst.end()) { +cout << *p << " "; p++; +} +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 649 + + + +cout << endl << endl; + +// sort the list lst.sort(); + +cout << "Sorted contents:\n"; p = lst.begin(); +while(p != lst.end()) { cout << *p << " "; p++; +} + +return 0; } + +Here is sample output produced by the program: + +Original contents: +41 18467 6334 26500 19169 15724 11478 29358 26962 24464 + +Sorted contents: +41 6334 11478 15724 18467 19169 24464 26500 26962 29358 + +Merging One List with Another +One ordered list may be merged with another. The result is an ordered list that +contains the contents of the two original lists. The new list is left in the invoking list, and the second list is left empty. The next example merges two lists. The first contains the even numbers between 0 and 9. The second contains the odd numbers. These lists are then merged to produce the sequence 0 1 2 3 4 5 6 7 8 9. + + +// Merge two lists. #include #include using namespace std; + +int main() { +list lst1, lst2; int i; +650 C + + : T h e C o m p l e t e R e f e r e n c e + + + +for(i=0; i<10; i+=2) lst1.push_back(i); for(i=1; i<11; i+=2) lst2.push_back(i); + +cout << "Contents of lst1:\n"; list::iterator p = lst1.begin(); while(p != lst1.end()) { +cout << *p << " "; p++; +} +cout << endl << endl; + +cout << "Contents of lst2:\n"; p = lst2.begin(); +while(p != lst2.end()) { cout << *p << " "; p++; +} +cout << endl << endl; + +// now, merge the two lists lst1.merge(lst2); if(lst2.empty()) +cout << "lst2 is now empty\n"; + +cout << "Contents of lst1 after merge:\n"; p = lst1.begin(); +while(p != lst1.end()) { cout << *p << " "; p++; +} + +return 0; } + +The output produced by this program is shown here: + +Contents of lst1: 0 2 4 6 8 + +Contents of lst2: 1 3 5 7 9 +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 651 + + + +lst2 is now empty +Contents of lst1 after merge: 0 1 2 3 4 5 6 7 8 9 + +One other thing to notice about this example is the use of the empty() function. It returns true if the invoking container is empty. Since merge() removes all of the elements from the list being merged, it will be empty after the merge is completed, as the program output confirms. + +Storing Class Objects in a List +Here is an example that uses a list to store objects of type myclass. Notice that the <, >, +!=, and == are overloaded for objects of type myclass. These are the operators that were required by Microsoft's Visual C++ (the compiler used to test the STL examples in this chapter.) Other compilers may require additional ones. The STL uses these functions to determine the ordering and equality of objects in a container. Even though a list is not an ordered container, it still needs a way to compare elements when searching, sorting, or merging. + + +// Store class objects in a list. #include +#include #include using namespace std; + +class myclass { int a, b; int sum; +public: +myclass() { a = b = 0; } myclass(int i, int j) { +a = i; b = j; +sum = a + b; } +int getsum() { return sum; } + +friend bool operator<(const myclass &o1, const myclass &o2); +friend bool operator>(const myclass &o1, const myclass &o2); +652 C + + : T h e C o m p l e t e R e f e r e n c e + + + +friend bool operator==(const myclass &o1, const myclass &o2); +friend bool operator!=(const myclass &o1, const myclass &o2); +}; + +bool operator<(const myclass &o1, const myclass &o2) { +return o1.sum < o2.sum; } + +bool operator>(const myclass &o1, const myclass &o2) { +return o1.sum > o2.sum; } + +bool operator==(const myclass &o1, const myclass &o2) { +return o1.sum == o2.sum; } + +bool operator!=(const myclass &o1, const myclass &o2) { +return o1.sum != o2.sum; } + +int main() { +int i; + +// create first list list lst1; +for(i=0; i<10; i++) lst1.push_back(myclass(i, i)); + +cout << "First list: "; list::iterator p = lst1.begin(); while(p != lst1.end()) { +cout << p->getsum() << " "; p++; +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 653 + + + + +} +cout << endl; + +// create a second list list lst2; +for(i=0; i<10; i++) lst2.push_back(myclass(i*2, i*3)); + +cout << "Second list: "; p = lst2.begin(); while(p != lst2.end()) { +cout << p->getsum() << " "; p++; +} +cout << endl; + +// now, merget lst1 and lst2 lst1.merge(lst2); + +// display merged list cout << "Merged list: "; p = lst1.begin(); while(p != lst1.end()) { +cout << p->getsum() << " "; p++; +} + +return 0; } + + +The program creates two lists of myclass objects and displays the contents of each list. It then merges the two lists and displays the result. The output from this program is shown here: + + +First list: 0 2 4 6 8 10 12 14 16 18 Second list: 0 5 10 15 20 25 30 35 40 45 +Merged list: 0 0 2 4 5 6 8 10 10 12 14 15 16 18 20 25 30 35 40 45 +654 C + + : T h e C o m p l e t e R e f e r e n c e + + +Maps +The map class supports an associative container in which unique keys are mapped with values. In essence, a key is simply a name that you give to a value. Once a value has been stored, you can retrieve it by using its key. Thus, in its most general sense, a map is a list of key/value pairs. The power of a map is that you can look up a value given its key. For example, you could define a map that uses a person's name as its key and stores that person's telephone number as its value. Associative containers are becoming more popular in programming. +As mentioned, a map can hold only unique keys. Duplicate keys are not allowed. To create a map that allows nonunique keys, use multimap. +The map container has the following template specification: + +template , class Allocator = allocator> class map + +Here, Key is the data type of the keys, T is the data type of the values being stored (mapped), and Comp is a function that compares two keys. This defaults to the standard less() utility function object. Allocator is the allocator (which defaults to allocator) . +A map has the following constructors: + +explicit map(const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( ) ); +map(const map &ob); template map(InIter start, InIter end, +const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( )); + +The first form constructs an empty map. The second form constructs a map that contains the same elements as ob. The third form constructs a map that contains the elements in the range specified by the iterators start and end. The function specified by cmpfn, if present, determines the ordering of the map. +In general, any object used as a key must define a default constructor and overload any necessary comparison operators. +The following comparison operators are defined for map. + +==, <, <=, !=, >, >= + +Several of the map member functions are shown in Table 24-4. In the descriptions, key_type is the type of the key, and value_type represents pair. +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 655 + + + + +Member + +iterator begin( ); const_iterator begin( ) const; +void clear( ); +size_type count(const key_type &k) const; + +bool empty( ) const; + +iterator end( ); const_iterator end( ) const; +void erase(iterator i); +void erase(iterator start, iterator end); + +size_type erase(const key_type &k) + +iterator find(const key_type &k); const_iterator find(const key_type &k) +const; + +iterator insert(iterator i, +const value_type &val); + +template +void insert(InIter start, InIter end) +pair +insert(const value_type &val); + +Description + +Returns an iterator to the first element in the map. +Removes all elements from the map. +Returns the number of times k occurs in the map (1 or zero). +Returns true if the invoking map is empty and false otherwise. +Returns an iterator to the end of the list. +Removes the element pointed to by i. +Removes the elements in the range start to end. +Removes from the map elements that have keys with the value k. +Returns an iterator to the specified key. If the key is not found, then an iterator to the end of the map is returned. +Inserts val at or after the element specified by i. An iterator to the element is returned. +Inserts a range of elements. + +Inserts val into the invoking map. An iterator to the element is returned. The element is inserted only if it does not already exist. If the element was inserted, pair is returned. Otherwise, pair is returned. + + + +Table 24-4. Several Commonly Used map Member Functions +656 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +reference operator[ ](const key_type &i) + + +size_type size( ) const; + +Description + +Returns a reference to the element specified by i. If this element does not exist, it is inserted. +Returns the number of elements currently in the list. + + +Table 24-4. Several Commonly Used map Member Functions (continued) + + + +Key/value pairs are stored in a map as objects of type pair, which has this template specification. + + +template struct pair { typedef Ktype first_type; // type of key typedef Vtype second_type; // type of value Ktype first; // contains the key +Vtype second; // contains the value + +// constructors pair(); +pair(const Ktype &k, const Vtype &v); template pair(const &ob); +} + +As the comments suggest, the value in first contains the key and the value in second contains the value associated with that key. +You can construct a pair using either one of pair's constructors or by using make_pair() , which constructs a pair object based upon the types of the data used as parameters. make_pair() is a generic function that has this prototype. + +template +pair make_pair(const Ktype &k, const Vtype &v); + +As you can see, it returns a pair object consisting of values of the types specified by Ktype and Vtype. The advantage of make_pair() is that the types of the objects being +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 657 + + +stored are determined automatically by the compiler rather than being explicitly specified by you. +The following program illustrates the basics of using a map. It stores key/value pairs that show the mapping between the uppercase letters and their ASCII character codes. Thus, the key is a character and the value is an integer. The key/value pairs stored are + +A 65 B66 +C 67 + +and so on. Once the pairs have been stored, you are prompted for a key (i.e., a letter between A and Z), and the ASCII code for that letter is displayed. + + +// A simple map demonstration. #include +#include +using namespace std; + +int main() { +map m; int i; + +// put pairs into map for(i=0; i<26; i++) { +m.insert(pair('A'+i, 65+i)); } + +char ch; +cout << "Enter key: "; cin >> ch; + +map::iterator p; + +// find value given key p = m.find(ch); +if(p != m.end()) +cout << "Its ASCII value is " << p->second; else +cout << "Key not in map.\n"; +658 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return 0; } + +Notice the use of the pair template class to construct the key/value pairs. The data types specified by pair must match those of the map into which the pairs are being inserted. +Once the map has been initialized with keys and values, you can search for a value given its key by using the find() function. find() returns an iterator to the matching element or to the end of the map if the key is not found. When a match is found, the value associated with the key is contained in the second member of pair. +In the preceding example, key/value pairs were constructed explicitly, using pair. While there is nothing wrong with this approach, it is often easier to use make_pair() , which constructs a pair object based upon the types of the data used as parameters. For example, assuming the previous program, this line of code will also insert key/value pairs into m. + + +m.insert(make_pair((char)('A'+i), 65+i)); + +Here, the cast to char is needed to override the automatic conversion to int when i is added to 'A.' Otherwise, the type determination is automatic. + +Storing Class Objects In a Map +As with all of the containers, you can use a map to store objects of types that you +create. For example, the next program creates a simple phone directory. That is, it creates a map of names with their numbers. To do this, it creates two classes called name and number. Since a map maintains a sorted list of keys, the program also defines the < operator for objects of type name. In general, you must define the < operator for any classes that you will use as the key. (Some compilers may require that additional comparison operators be defined.) + + +// Use a map to create a phone directory. #include +#include #include using namespace std; + +class name { char str[40]; +public: +name() { strcpy(str, ""); } +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 659 + + + +name(char *s) { strcpy(str, s); } char *get() { return str; } + +}; + +// Must define less than relative to name objects. bool operator<(name a, name b) +{ +return strcmp(a.get(), b.get()) < 0; } + +class phoneNum { char str[80]; +public: +phoneNum() { strcmp(str, ""); } phoneNum(char *s) { strcpy(str, s); } char *get() { return str; } +}; + + +int main() { +map directory; + +// put names and numbers into map directory.insert(pair(name("Tom"), +phoneNum("555-4533"))); directory.insert(pair(name("Chris"), +phoneNum("555-9678"))); directory.insert(pair(name("John"), +phoneNum("555-8195"))); directory.insert(pair(name("Rachel"), +phoneNum("555-0809"))); + +// given a name, find number char str[80]; +cout << "Enter name: "; cin >> str; + +map::iterator p; + +p = directory.find(name(str)); +660 C + + : T h e C o m p l e t e R e f e r e n c e + + + +if(p != directory.end()) +cout << "Phone number: " << p->second.get(); else +cout << "Name not in directory.\n"; + +return 0; } + +Here is a sample run: + +Enter name: Rachel Phone number: 555-0809. + +In the program, each entry in the map is a character array that holds a +null-terminated string. Later in this chapter, you will see an easier way to write this program that uses the standard string type. + + +Algorithms +As explained, algorithms act on containers. Although each container provides support for its own basic operations, the standard algorithms provide more extended or complex actions. They also allow you to work with two different types of containers at the same time. To have access to the STL algorithms, you must include in your program. +The STL defines a large number of algorithms, which are summarized in Table 24-5. All of the algorithms are template functions. This means that they can be applied to any type of container. All of the algorithms in the STL are covered in Part Four. The following sections demonstrate a representative sample. + +Counting +One of the most basic operations that you can perform on a sequence is to count its contents. To do this, you can use either count() or count_if() . Their general forms are shown here: + +template +size_t count(InIter start, InIter end, const T &val); template +size_t count_if(InIter start, InIter end, UnPred pfn); +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 661 + + + +Algorithm + +adjacent_find + +binary_search copy copy_backward + +count count_if + +equal equal_range + + +fill and fill_n find + +find_end + +find_first_of + +find_if + +for_each +generate and generate_n + +includes + +inplace_merge + +iter_swap + +lexicographical_compare + +Purpose + +Searches for adjacent matching elements within a sequence and returns an iterator to the first match. +Performs a binary search on an ordered sequence. Copies a sequence. +Same as copy() except that it moves the elements from the end of the sequence first. +Returns the number of elements in the sequence. +Returns the number of elements in the sequence that satisfy some predicate. +Determines if two ranges are the same. +Returns a range in which an element can be inserted into a sequence without disrupting the ordering of +the sequence. +Fills a range with the specified value. +Searches a range for a value and returns an iterator to the first occurrence of the element. +Searches a range for a subsequence. It returns an iterator to the end of the subsequence within the range. +Finds the first element within a sequence that matches an element within a range. +Searches a range for an element for which a user-defined unary predicate returns true. +Applies a function to a range of elements. +Assign elements in a range the values returned by a generator function. +Determines if one sequence includes all of the elements in another sequence. +Merges a range with another range. Both ranges must be sorted in increasingorder.Theresultingsequenceissorted. +Exchanges the values pointed to by its two iterator arguments. +Alphabetically compares one sequence with another. + + +Table 24-5. The STL Algorithms +662 C + + : T h e C o m p l e t e R e f e r e n c e + + + +Algorithm + +lower_bound + +make_heap max max_element merge + +min min_element mismatch + +next_permutation nth_element + + +partial_sort partial_sort_copy + +partition + + +pop_heap + +prev_permutation push_heap random_shuffle +remove, remove_if, remove_copy, and remove_copy_if +replace, replace_copy, replace_if, and replace_copy_if + +Purpose + +Finds the first point in the sequence that is not less than a specified value. +Constructs a heap from a sequence. Returns the maximum of two values. +Returnsaniteratortothemaximumelementwithinarange. +Merges two ordered sequences, placing the result into a third sequence. +Returns the minimum of two values. Returnsaniteratortotheminimumelementwithinarange. +Finds first mismatch between the elements in two sequences. Iterators to the two elements are returned. +Constructs next permutation of a sequence. +Arranges a sequence such that all elements less than a specified element E come before that element and all elements greater than E come after it. +Sorts a range. +Sorts a range and then copies as many elements as will fit into a resulting sequence. +Arranges a sequence such that all elements for which a predicate returns true come before those for which the predicate returns false. +Exchanges the first and last −1 elements and then rebuilds the heap. +Constructs previous permutation of a sequence. Pushes an element onto the end of a heap. Randomizes a sequence. +Removes elements from a specified range. + + +Replaces elements within a range. + + + +Table 24-5. The STL Algorithms (continued) +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 663 + + + + +Algorithm + +reverse and reverse_copy rotate and rotate_copy search +search_n + +set_difference + +set_intersection + +set_symmetric_difference + +set_union + +sort sort_heap +stable_partition + + + + +stable_sort + +swap swap_ranges transform + +unique and unique_copy +upper_bound + +Purpose + +Reverses the order of a range. +Left-rotates the elements in a range. Searches for subsequence within a sequence. +Searches for a sequence of a specified number of similar elements. +Produces a sequence that contains the difference between two ordered sets. +Produces a sequence that contains the intersection of the two ordered sets. +Produces a sequence that contains the symmetric difference between the two ordered sets. +Produces a sequence that contains the union of the two ordered sets. +Sorts a range. +Sorts a heap within a specified range. +Arranges a sequence such that all elements for which a predicate returns true come before those for which the predicate returns false. The partitioning is stable. This means that the relative ordering of the sequence is preserved. +Sorts a range. The sort is stable. This means that equal elements are not rearranged. +Exchanges two values. Exchanges elements in a range. +Applies a function to a range of elements and stores the outcome in a new sequence. +Eliminates duplicate elements from a range. +Finds the last point in a sequence that is not greater than some value. + + + +Table 24-5. The STL Algorithms (continued) +664 C + + : T h e C o m p l e t e R e f e r e n c e + + +The count() algorithm returns the number of elements in the sequence beginning at start and ending at end that match val. The count_if() algorithm returns the number of elements in the sequence beginning at start and ending at end for which the unary predicate pfn returns true. +The following program demonstrates count() . + +// Demonstrate count(). #include #include #include #include using namespace std; + +int main() { +vector v; int i; + +for(i=0; i < 10; i++) { +if(rand() % 2) v.push_back(true); else v.push_back(false); +} + +cout << "Sequence:\n"; for(i=0; i #include +#include using namespace std; + +/* This is a unary predicate that determines if number is divisible by 3. */ +bool dividesBy3(int i) { +if((i%3) == 0) return true; + +return false; } + +int main() { +vector v; int i; + +for(i=1; i < 20; i++) v.push_back(i); + +cout << "Sequence:\n"; for(i=0; i OutIter remove_copy(InIter start, InIter end, +OutIter result, const T &val); + +The remove_copy() algorithm copies elements from the specified range, removing those that are equal to val. It puts the result into the sequence pointed to by result and returns an iterator to the end of the result. The output container must be large enough to hold the result. +To replace one element in a sequence with another when a copy is made, use replace_copy() . Its general form is shown here: + +template OutIter replace_copy(InIter start, InIter end, +OutIter result, const T &old, const T &new); + +The replace_copy() algorithm copies elements from the specified range, replacing elements equal to old with new. It puts the result into the sequence pointed to by result and returns an iterator to the end of the result. The output container must be large enough to hold the result. +The following program demonstrates remove_copy() and replace_copy() . It creates a sequence of characters. It then removes all of the spaces from the sequence. Next, it replaces all spaces with colons. + +// Demonstrate remove_copy and replace_copy. #include +#include #include +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 667 + + + + +using namespace std; + +int main() { +char str[] = "The STL is power programming."; vector v, v2(30); +int i; + +for(i=0; str[i]; i++) v.push_back(str[i]); + +// **** demonstrate remove_copy **** cout << "Input sequence:\n"; +for(i=0; i void reverse(BiIter start, BiIter end); + +The reverse() algorithm reverses the order of the range specified by start and end. The following program demonstrates reverse() . + + +// Demonstrate reverse. #include #include #include using namespace std; + +int main() { +vector v; int i; + +for(i=0; i<10; i++) v.push_back(i); + +cout << "Initial: "; +for(i=0; i +#include #include using namespace std; + +// A simple transformation function. double reciprocal(double i) { +return 1.0/i; // return reciprocal } + +int main() +670 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +{ + +list vals; int i; + +// put values into list +for(i=1; i<10; i++) vals.push_back((double)i); + +cout << "Original contents of vals:\n"; list::iterator p = vals.begin(); while(p != vals.end()) { +cout << *p << " "; p++; +} + +cout << endl; + +// transform vals +p = transform(vals.begin(), vals.end(), vals.begin(), reciprocal); + +cout << "Transformed contents of vals:\n"; p = vals.begin(); +while(p != vals.end()) { cout << *p << " "; p++; +} + +return 0; } + +The output produced by the program is shown here: + +Original contents of vals: 1 2 3 4 5 6 7 8 9 +Transformed contents of vals: +1 0.5 0.333333 0.25 0.2 0.166667 0.142857 0.125 0.111111 + + +As you can see, each element in vals has been transformed into its reciprocal. +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 671 + + +Using Function Objects +As explained at the start of this chapter, the STL supports (and extensively utilizes) function objects. Recall that function objects are simply classes that define operator() . The STL provides many built-in function objects, such as less, minus, etc. It also allows you to define your own function objects. Frankly, it is beyond the scope of this book to fully describe all of the issues surrounding the creation and use of function objects. Fortunately, as the preceding examples have shown, you can make significant use of the STL without ever creating a function object. However, since function objects are a main ingredient of the STL, it is important to have a general understanding. + +Unary and Binary Function Objects +Just as there are unary and binary predicates, there are unary and binary function objects. A unary function object requires one argument; a binary function object requires two. You must use the type of object required. For example, if an algorithm is expecting a binary function object, you must pass it a binary function object. + +Using the Built-in Function Objects +The STL provides a rich assortment of built-in function objects. The binary function objects are shown here: + + +plus equal_to +less_equal + +minus not_equal_to +logical_and + +multiplies greater +logical_or + +divides +greater_equal + +modulus +less + + +Here are the unary function objects: + +logical_not negate + +The function objects perform the operations specified by their names. The only one that may not be self-evident is negate(), which reverses the sign of its argument. +The built-in function objects are template classes that overload operator() , which returns the result of the specified operation on whatever type of data you select. For example, to invoke the binary function object plus() , use this syntax: + + +plus() + +The built-in function objects use the header . +672 C + + : T h e C o m p l e t e R e f e r e n c e + + +Let's begin with a simple example. The following program uses the transform() algorithm (described in the preceding section) and the negate() function object to reverse the sign of a list of values. + + +// Use a unary function object. #include +#include #include #include using namespace std; + +int main() { +list vals; int i; + +// put values into list +for(i=1; i<10; i++) vals.push_back((double)i); + +cout << "Original contents of vals:\n"; list::iterator p = vals.begin(); while(p != vals.end()) { +cout << *p << " "; p++; +} +cout << endl; + +// use the negate function object +p = transform(vals.begin(), vals.end(), vals.begin(), +negate()); // call function object + +cout << "Negated contents of vals:\n"; p = vals.begin(); +while(p != vals.end()) { cout << *p << " "; p++; +} + +return 0; } +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 673 + + +This program produces the following output: + +Original contents of vals: 1 2 3 4 5 6 7 8 9 +Negated contents of vals: -1 -2 -3 -4 -5 -6 -7 -8 -9 + +In the program, notice how negate() is invoked. Since vals is a list of double values, negate() is called using negate() . The transform() algorithm automatically calls negate() for each element in the sequence. Thus, the single parameter to negate() receives as its argument an element from the sequence. +The next program demonstrates the use of the binary function object divides() . It creates two lists of double values and has one divide the other. This program uses the binary form of the transform() algorithm. + +// Use a binary function object. #include +#include #include #include using namespace std; + +int main() { +list vals; list divisors; int i; + +// put values into list +for(i=10; i<100; i+=10) vals.push_back((double)i); for(i=1; i<10; i++) divisors.push_back(3.0); + +cout << "Original contents of vals:\n"; list::iterator p = vals.begin(); while(p != vals.end()) { +cout << *p << " "; p++; +} + +cout << endl; + +// transform vals +674 C + + : T h e C o m p l e t e R e f e r e n c e + + + +p = transform(vals.begin(), vals.end(), divisors.begin(), vals.begin(), +divides()); // call function object + +cout << "Divided contents of vals:\n"; p = vals.begin(); +while(p != vals.end()) { cout << *p << " "; p++; +} + +return 0; } + +The output from this program is shown here: + +Original contents of vals: 10 20 30 40 50 60 70 80 90 Divided contents of vals: +3.33333 6.66667 10 13.3333 16.6667 20 23.3333 26.6667 30 + +In this case, the binary function object divides() divides the elements from the first sequence by their corresponding elements from the second sequence. Thus, divides() receives arguments in this order: + +divides(first, second) + +This order can be generalized. Whenever a binary function object is used, its arguments are ordered first, second. + +Creating a Function Object +In addition to using the built-in function objects, you can create your own. To do so, you will simply create a class that overloads the operator() function. However, for the greatest flexibility, you will want to use one of the following classes defined by the STL as a base class for your function objects. + + +template struct unary_function { typedef Argument argument_type; +typedef Result result_type; }; +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 675 + + + +template struct binary_function { +typedef Argument1 first_argument_type; typedef Argument2 second_argument_type; typedef Result result_type; +}; + + +These template classes provide concrete type names for the generic data types used by the function object. Although they are technically a convenience, they are almost always used when creating function objects. +The following program demonstrates a custom function object. It converts the reciprocal() function (used to demonstrate the transform() algorithm earlier) into a function object. + + +// Create a reciprocal function object. #include +#include #include #include using namespace std; + +// A simple function object. +class reciprocal: unary_function { public: +result_type operator()(argument_type i) { +return (result_type) 1.0/i; // return reciprocal } +}; + +int main() { +list vals; int i; + +// put values into list +for(i=1; i<10; i++) vals.push_back((double)i); + +cout << "Original contents of vals:\n"; list::iterator p = vals.begin(); while(p != vals.end()) { +676 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << *p << " "; p++; +} +cout << endl; + +// use reciprocal function object +p = transform(vals.begin(), vals.end(), vals.begin(), +reciprocal()); // call function object + +cout << "Transformed contents of vals:\n"; p = vals.begin(); +while(p != vals.end()) { cout << *p << " "; p++; +} + +return 0; } + + +Notice two important aspects of reciprocal() . First, it inherits the base class unary_function. This gives it access to the argument_type and result_type types. Second, it defines operator() such that it returns the reciprocal of its argument. In general, to create a function object, simply inherit the proper base class and overload operator() as required. It really is that easy. + +Using Binders +When using a binary function object, it is possible to bind a value to one of the arguments. This can be useful in many situations. For example, you may wish to remove all elements from a sequence that are greater than some value, such as 8. To do this, you need some way to bind 8 to the right-hand operand of the function object greater() . That is, you want greater() to perform the comparison + +val > 8 + +for each element of the sequence. The STL provides a mechanism, called binders, that accomplishes this. +There are two binders: bind2nd() and bind1st() . They take these general forms: + +bind1st(binfunc_obj, value) bind2nd(binfunc_obj, value) +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 677 + + +Here, binfunc_obj is a binary function object. bind1st() returns a unary function object that has binfunc_obj's left-hand operand bound to value. bind2nd() returns a unary function object that has binfunc_obj's right-hand operand bound to value. The bind2nd() binder is by far the most commonly used. In either case, the outcome of a binder is a unary function object that is bound to the value specified. +To demonstrate the use of a binder, we will use the remove_if() algorithm. It removes elements from a sequence based upon the outcome of a predicate. It has this prototype: + +template +ForIter remove_if(ForIter start, ForIter end, UnPred func); + +The algorithm removes elements from the sequence defined by start and end if the unary predicate defined by func is true. The algorithm returns a pointer to the new end of the sequence which reflects the deletion of the elements. +The following program removes all values from a sequence that are greater than the value 8. Since the predicate required by remove_if() is unary, we cannot simply use the greater() function object as-is because greater() is a binary object. Instead, we must bind the value 8 to the second argument of greater() using the bind2nd() binder, as shown in the program. + +// Demonstrate bind2nd(). #include #include +#include #include using namespace std; + +int main() { +list lst; list::iterator p, endp; + +int i; + +for(i=1; i < 20; i++) lst.push_back(i); + +cout << "Original sequence:\n"; p = lst.begin(); +while(p != lst.end()) { cout << *p << " "; p++; +678 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} +cout << endl; + +endp = remove_if(lst.begin(), lst.end(), bind2nd(greater(), 8)); + +cout << "Resulting sequence:\n"; p = lst.begin(); +while(p != endp) { cout << *p << " "; p++; +} + +return 0; } + +The output produced by the program is shown here: + +Original sequence: +1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Resulting sequence: +1 2 3 4 5 6 7 8 + +You might want to experiment with this program, trying different function objects and binding different values. As you will discover, binders expand the power of the STL in very significant ways. +One last point: There is an object related to a binder called a negator. The negators are not1() and not2() . They return the negation (i.e., the complement of) whatever predicate they modify. They have these general forms: + +not1(unary_predicate) not2(binary_predicate) + +For example, if you substitute the line + +endp = remove_if(lst.begin(), lst.end(), not1(bind2nd(greater(), 8))); + +into the preceding program, it will remove all elements from lst that are not greater than 8. +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 679 + + +The string Class +As you know, C++ does not support a built-in string type per se. It does, however, provide for two ways of handling strings. First, you may use the traditional, +null-terminated character array with which you are already familiar. This is sometimes referred to as a C string. The second way is as a class object of type string; this is the approach examined here. +Actually, the string class is a specialization of a more general template class called basic_string. In fact, there are two specializations of basic_string: string, which supports 8-bit character strings, and wstring, which supports wide-character strings. Since 8-bit characters are by far the most commonly used in normal programming, string is the version of basic_string examined here. +Before looking at the string class, it is important to understand why it is part of the C++ library. Standard classes have not been casually added to C++. In fact, a significant amount of thought and debate has accompanied each new addition. Given that C++ already contains some support for strings as null-terminated character arrays, it may at first seem that the inclusion of the string class is an exception to this rule. However, this is actually far from the truth. Here is why: Null-terminated strings cannot be manipulated by any of the standard C++ operators. Nor can they take part in normal C++ expressions. For example, consider this fragment: + +char s1[80], s2[80], s3[80]; + +s1 = "Alpha"; // can't do s2 = "Beta"; // can't do +s3 = s1 + s2; // error, not allowed + +As the comments show, in C++ it is not possible to use the assignment operator to give a character array a new value (except during initialization), nor is it possible to use the + operator to concatenate two strings. These operations must be written using library functions, as shown here: + + +strcpy(s1, "Alpha"); strcpy(s2, "Beta"); strcpy(s3, s1); strcat(s3, s2); + +Since null-terminated character arrays are not technically data types in their own right, the C++ operators cannot be applied to them. This makes even the most rudimentary string operations clumsy. More than anything else, it is the inability to operate on null-terminated strings using the standard C++ operators that has driven the development of a standard string class. Remember, when you define a class in C++, +680 C + + : T h e C o m p l e t e R e f e r e n c e + + +you are defining a new data type that may be fully integrated into the C++ environment. This, of course, means that the operators can be overloaded relative to the new class. Therefore, by adding a standard string class, it becomes possible to manage strings in the same way as any other type of data: through the use of operators. +There is, however, one other reason for the standard string class: safety. In the hands of an inexperienced or careless programmer, it is very easy to overrun the end of an array that holds a null-terminated string. For example, consider the standard string copy function strcpy() . This function contains no provision for checking the boundary of the target array. If the source array contains more characters than the target array can hold, then a program error or system crash is possible (likely). As you will see, the standard string class prevents such errors. +In the final analysis, there are three reasons for the inclusion of the standard string class: consistency (a string now defines a data type), convenience (you may use the standard C++ operators), and safety (array boundaries will not be overrun). Keep in mind that there is no reason that you should abandon normal, null-terminated strings altogether. They are still the most efficient way in which to implement strings. However, when speed is not an overriding concern, using the new string class gives you access to a safe and fully integrated way to manage strings. +Although not traditionally thought of as part of the STL, string is another container class defined by C++. This means that it supports the algorithms described in the previous section. However, strings have additional capabilities. To have access to the string class, you must include in your program. +The string class is very large, with many constructors and member functions. Also, many member functions have multiple overloaded forms. For this reason, it is not possible to look at the entire contents of string in this chapter. Instead, we will examine several of its most commonly used features. Once you have a general understanding of how string works, you can easily explore the rest of it on your own. +The string class supports several constructors. The prototypes for three of its most commonly used ones are shown here: + +string( ); +string(const char *str); string(const string &str); + +The first form creates an empty string object. The second creates a string object from the null-terminated string pointed to by str. This form provides a conversion +from null-terminated strings to string objects. The third form creates a string from another string. +A number of operators that apply to strings are defined for string objects, including: +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 681 + + + + +Operator + += + += == != < <= > >= [ ] << +>> + +Meaning + +Assignment Concatenation Concatenation assignment Equality +Inequality Less than +Less than or equal Greater than +Greater than or equal Subscripting +Output +Input + + +These operators allow the use of string objects in normal expressions and eliminate the need for calls to functions such as strcpy() or strcat() , for example. In general, you can mix string objects with normal, null-terminated strings in expressions. For example, a string object can be assigned a null-terminated string. +The + operator can be used to concatenate a string object with another string object or a string object with a C-style string. That is, the following variations are supported: + +string + string string + C-string C-string + string + +The + operator can also be used to concatenate a character onto the end of a string. +The string class defines the constant npos, which is −1. This constant represents the length of the longest possible string. +The C++ string classes make string handling extraordinarily easy. For example, using string objects you can use the assignment operator to assign a quoted string to a string, the + operator to concatenate strings, and the comparison operators to compare strings. The following program illustrates these operations. +682 C + + : T h e C o m p l e t e R e f e r e n c e + + +// A short string demonstration. #include +#include using namespace std; + +int main() { +string str1("Alpha"); string str2("Beta"); string str3("Omega"); string str4; + +// assign a string str4 = str1; +cout << str1 << "\n" << str3 << "\n"; + +// concatenate two strings str4 = str1 + str2; +cout << str4 << "\n"; + +// concatenate a string with a C-string str4 = str1 + " to " + str3; +cout << str4 << "\n"; + +// compare strings +if(str3 > str1) cout << "str3 > str1\n"; if(str3 == str1+str2) +cout << "str3 == str1+str2\n"; + +/* A string object can also be assigned a normal string. */ +str1 = "This is a null-terminated string.\n"; cout << str1; + +// create a string object using another string object string str5(str1); +cout << str5; + +// input a string +cout << "Enter a string: "; cin >> str5; +cout << str5; +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 683 + + + +return 0; } + +This program produces the following output: + +Alpha Omega AlphaBeta +Alpha to Omega str3 > str1 +This is a null-terminated string. This is a null-terminated string. Enter a string: STL +STL + + +Notice the ease with which the string handling is accomplished. For example, the + is used to concatenate strings and the > is used to compare two strings. To accomplish these operations using C-style, null-terminated strings, less convenient calls to the strcat() and strcmp() functions would be required. Because C++ string objects can be freely mixed with C-style null-terminated strings, there is no disadvantage to using them in your program—and there are considerable benefits to be gained. +There is one other thing to notice in the preceding program: the size of the strings is not specified. string objects are automatically sized to hold the string that they are given. Thus, when assigning or concatenating strings, the target string will grow as needed to accommodate the size of the new string. It is not possible to overrun the end of the string. This dynamic aspect of string objects is one of the ways that they are better than standard null-terminated strings (which are subject to boundary overruns). + + +Some string Member Functions +Although most simple string operations can be accomplished using the string operators, more complex or subtle ones are accomplished using string member functions. While string has far too many member functions to discuss them all, we will examine several of the most common. + + +Basic String Manipulations +To assign one string to another, use the assign() function. Two of its forms are shown here: +684 C + + : T h e C o m p l e t e R e f e r e n c e + + +string &assign(const string &strob, size_type start, size_type num); string &assign(const char *str, size_type num); + +In the first form, num characters from strob beginning at the index specified by start will be assigned to the invoking object. In the second form, the first num characters of the null-terminated string str are assigned to the invoking object. In each case, a reference to the invoking object is returned. Of course, it is much easier to use the = to assign one entire string to another. You will need to use the assign() function only when assigning a partial string. +You can append part of one string to another using the append() member function. Two of its forms are shown here: + +string &append(const string &strob, size_type start, size_type num); string &append(const char *str, size_type num); + +Here, num characters from strob beginning at the index specified by start will be appended to the invoking object. In the second form, the first num characters of the null-terminated string str are appended to the invoking object. In each case, a reference to the invoking object is returned. Of course, it is much easier to use the + to append one entire string to another. You will need to use the append() function only when appending a partial string. +You can insert or replace characters within a string using insert() and replace() . The prototypes for their most common forms are shown here: + +string &insert(size_type start, const string &strob); string &insert(size_type start, const string &strob, +size_type insStart, size_type num); +string &replace(size_type start, size_type num, const string &strob); string &replace(size_type start, size_type orgNum, const string &strob, +size_type replaceStart, size_type replaceNum); + +The first form of insert() inserts strob into the invoking string at the index specified by start. The second form of insert() function inserts num characters from strob beginning at insStart into the invoking string at the index specified by start. +Beginning at start, the first form of replace() replaces num characters from the invoking string, with strob. The second form replaces orgNum characters, beginning +at start, in the invoking string with the replaceNum characters from the string specified by strob beginning at replaceStart. In both cases, a reference to the invoking object +is returned. +You can remove characters from a string using erase() . One of its forms is shown here: +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 685 + + +string &erase(size_type start = 0, size_type num = npos); + +It removes num characters from the invoking string beginning at start. A reference to the invoking string is returned. +The following program demonstrates the insert() , erase() , and replace() functions. + + +// Demonstrate insert(), erase(), and replace(). #include +#include using namespace std; + +int main() { +string str1("String handling C++ style."); string str2("STL Power"); + +cout << "Initial strings:\n"; cout << "str1: " << str1 << endl; +cout << "str2: " << str2 << "\n\n"; + +// demonstrate insert() +cout << "Insert str2 into str1:\n"; str1.insert(6, str2); +cout << str1 << "\n\n"; + +// demonstrate erase() +cout << "Remove 9 characters from str1:\n"; str1.erase(6, 9); +cout << str1 <<"\n\n"; + +// demonstrate replace +cout << "Replace 8 characters in str1 with str2:\n"; str1.replace(7, 8, str2); +cout << str1 << endl; + +return 0; } + + +The output produced by this program is shown here: +686 C + + : T h e C o m p l e t e R e f e r e n c e + + +Initial strings: +str1: String handling C++ style. str2: STL Power + +Insert str2 into str1: +StringSTL Power handling C++ style. + +Remove 9 characters from str1: String handling C++ style. + +Replace 8 characters in str1 with str2: String STL Power C++ style. + +Searching a String +The string class provides several member functions that search a string, including find() and rfind() . Here are the prototypes for the most common versions of these functions: + +size_type find(const string &strob, size_type start=0) const; size_type rfind(const string &strob, size_type start=npos) const; + +Beginning at start, find() searches the invoking string for the first occurrence of the string contained in strob. If found, find() returns the index at which the match occurs within the invoking string. If no match is found, then npos is returned. rfind() is the opposite of find() . Beginning at start, it searches the invoking string in the reverse direction for the first occurrence of the string contained in strob (i.e, it finds the last occurrence of strob within the invoking string). If found, rfind() returns the index at which the match occurs within the invoking string. If no match is found, npos is returned. +Here is a short example that uses find() and rfind() . + + +#include #include using namespace std; + +int main() { +int i; string s1 = +"Quick of Mind, Strong of Body, Pure of Heart"; string s2; +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 687 + + + +i = s1.find("Quick"); if(i!=string::npos) { +cout << "Match found at " << i << endl; cout << "Remaining string is:\n"; s2.assign(s1, i, s1.size()); +cout << s2; } +cout << "\n\n"; + +i = s1.find("Strong"); if(i!=string::npos) { +cout << "Match found at " << i << endl; cout << "Remaining string is:\n"; s2.assign(s1, i, s1.size()); +cout << s2; } +cout << "\n\n"; + +i = s1.find("Pure"); if(i!=string::npos) { +cout << "Match found at " << i << endl; cout << "Remaining string is:\n"; s2.assign(s1, i, s1.size()); +cout << s2; } +cout << "\n\n"; + +// find list "of" i = s1.rfind("of"); +if(i!=string::npos) { +cout << "Match found at " << i << endl; cout << "Remaining string is:\n"; s2.assign(s1, i, s1.size()); +cout << s2; } + +return 0; } + +The output produced by this program is shown here: +688 C + + : T h e C o m p l e t e R e f e r e n c e + + +Match found at 0 Remaining string is: +Quick of Mind, Strong of Body, Pure of Heart + +Match found at 15 Remaining string is: +Strong of Body, Pure of Heart + +Match found at 31 Remaining string is: Pure of Heart + +Match found at 36 Remaining string is: of Heart + + +Comparing Strings +To compare the entire contents of one string object to another, you will normally use the overloaded relational operators described earlier. However, if you want to compare a portion of one string to another, you will need to use the compare() member function, shown here: + +int compare(size_type start, size_type num, const string &strob) const; + +Here, num characters in strob, beginning at start, will be compared against the invoking string. If the invoking string is less than strob, compare() will return less than zero. If the invoking string is greater than strob, it will return greater than zero. If strob is equal to the invoking string, compare() will return zero. + +Obtaining a Null-Terminated String +Although string objects are useful in their own right, there will be times when you will need to obtain a null-terminated character-array version of the string. For example, you might use a string object to construct a filename. However, when opening a file, you will need to specify a pointer to a standard, null-terminated string. To solve this problem, the member function c_str() is provided. Its prototype is shown here: + +const char *c_str( ) const; + +This function returns a pointer to a null-terminated version of the string contained in the invoking string object. The null-terminated string must not be altered. It is also not guaranteed to be valid after any other operations have taken place on the string object. +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 689 + + +Strings Are Containers +The string class meets all of the basic requirements necessary to be a container. Thus, it supports the common container functions, such as begin() , end() , and size() . It also supports iterators. Therefore, a string object can also be manipulated by the STL algorithms. Here is a simple example: + + +// Strings as containers. #include #include #include using namespace std; + +int main() { +string str1("Strings handling is easy in C++"); string::iterator p; +int i; + +// use size() +for(i=0; i +#include #include using namespace std; + +int main() { +map directory; + +directory.insert(pair("Tom", "555-4533")); directory.insert(pair("Chris", "555-9678")); directory.insert(pair("John", "555-8195")); directory.insert(pair("Rachel", "555-0809")); + +string s; +cout << "Enter name: "; cin >> s; + +map::iterator p; + +p = directory.find(s); if(p != directory.end()) +cout << "Phone number: " << p->second; +C h a p t e r 2 4 : I n t r o d u c i n g t h e S t a n d a r d T e m p l a t e L i b r a r y 691 + + + +else +cout << "Name not in directory.\n"; + +return 0; } + + +Final Thoughts on the STL +The STL is now an important, integral part of the C++ language. Many programming tasks can (and will) be framed in terms of it. The STL combines power with flexibility, and while its syntax is a bit complex, its ease of use is remarkable. No C++ programmer can afford to neglect the STL because it will play an important role in the way future programs are written. + + + + + + + + + +This page intentionally left blank. +Part III The Standard Function Library + + + + + + + + + + + + + +++ defines two types of libraries. The first is the standard function library. This library consists of general-purpose, +C +stand-alone functions that are not part of any class. The function library is inherited from C. The second library is the object-oriented class library. Part Three of the book provides a reference to the standard function library. Part Four describes the class library. + + + + + + +693 +694 C + + : T h e C o m p l e t e R e f e r e n c e + + +The standard function library is divided into the following categories: + + I/O + String and character handling Mathematical + Time, date, and localization Dynamic allocation + Miscellaneous + Wide-character functions + +The last category was added to Standard C in 1995 and was subsequently incorporated into C++. It provides wide-character (wchar_t) equivalents to several of the library functions. Frankly, the use of the wide-character library has been very limited, and C++ provides a better way of handling wide-character environments, but it is briefly described in Chapter 31 for completeness. +One last point: All compilers supply more functions than are defined by Standard C/C++. These additional functions typically provide for operating-system interfacing and other environment-dependent operations. You will want to check your compiler's documentation. + +C++ + + + + +Chapter 25 The C-Based I/O Functions + + + + + + + + + + + + + + +695 +696 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the C-based I/O functions. These functions are defined by Standard C and Standard C++. While you will usually want to use C++'s +T +object-oriented I/O system for new code, there is no fundamental reason that you cannot use the C I/O functions in a C++ program when you deem it appropriate. The functions in this chapter were first specified by the ANSI C standard, and they are commonly referred to collectively as the ANSI C I/O system. +The header associated with the C-based I/O functions is called . (A C program must use the header file stdio.h.) This header defines several macros and types used by the file system. The most important type is FILE, which is used to declare a file pointer. Two other types are size_t and fpos_t. The size_t type (usually some form of unsigned integer) defines an object that is capable of holding the size of the largest file allowed by the operating environment. The fpos_t type defines an object that can hold all information needed to uniquely specify every position within a file. The most commonly used macro defined by the headers is EOF, which is the value that indicates end-of-file. +Many of the I/O functions set the built-in global integer variable errno when an error occurs. Your program can check this variable when an error occurs to obtain more information about the error. The values that errno may take are implementation dependent. +For an overview of the C-based I/O system, see Chapters 8 and 9 in Part One. + + +Note + +This chapter describes the character-based I/O functions. These are the functions thatwereoriginallydefinedforStandardCandC++andare,byfar,themostwidely used.In1995,severalwide-character(wchar_t)functionswereadded,andtheyare briefly described in Chapter 31. + + +clearerr + + +#include +void clearerr(FILE *stream); + + +The clearerr() function resets (i.e., sets to zero) the error flag associated with the stream pointed to by stream. The end-of-file indicator is also reset. +The error flags for each stream are initially set to zero by a successful call to fopen() . Once an error has occurred, the flags stay set until an explicit call to either clearerr() or rewind() is made. +File errors can occur for a wide variety of reasons, many of which are system dependent. The exact nature of the error can be determined by calling perror() , which displays what error has occurred (see perror() ). +Related functions are feof() , ferror() , and perror() . +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 697 + + +fclose + + +#include +int fclose(FILE *stream); + + +The fclose() function closes the file associated with stream and flushes its buffer. After an fclose() , stream is no longer connected with the file, and any automatically allocated buffers are deallocated. +If fclose() is successful, zero is returned; otherwise EOF is returned. Trying to close a file that has already been closed is an error. Removing the storage media before closing a file will also generate an error, as will lack of sufficient free disk space. +Related functions are fopen() , freopen() , and fflush() . + +feof + + +#include +int feof(FILE *stream); + + +The feof() function checks the file position indicator to determine if the end of the file associated with stream has been reached. A nonzero value is returned if the file position indicator is at end-of-file; zero is returned otherwise. +Once the end of the file has been reached, subsequent read operations will return EOF until either rewind() is called or the file position indicator is moved using fseek() . +The feof() function is particularly useful when working with binary files because the end-of-file marker is also a valid binary integer. Explicit calls must be made to feof() rather than simply testing the return value of getc() , for example, to determine when the end of a binary file has been reached. +Related functions are clearerr() , ferror() , perror() , putc() , and getc() . + +ferror + + +#include +int ferror(FILE *stream); + + +The ferror() function checks for a file error on the given stream. A return value of zero indicates that no error has occurred, while a nonzero value means an error. +The error flags associated with stream will stay set until either the file is closed, or rewind() or clearerr() is called. +698 C + + : T h e C o m p l e t e R e f e r e n c e + + +To determine the exact nature of the error, use the perror() function. Related functions are clearerr( ), feof() , and perror() . + +fflush + + +#include +int fflush(FILE *stream); + + +If stream is associated with a file opened for writing, a call to fflush() causes the contents of the output buffer to be physically written to the file. If stream points to an input file, the contents of the input buffer are cleared. In either case, the file remains open. +A return value of zero indicates success; EOF indicates that a write error has occurred. +All buffers are automatically flushed upon normal termination of the program or when they are full. Also, closing a file flushes its buffer. +Related functions are fclose() , fopen() , fread() , fwrite() , getc() , and putc() . + +fgetc + + +#include +int fgetc(FILE *stream); + + +The fgetc() function returns the next character from the input stream from the current position and increments the file position indicator. The character is read as an unsigned char that is converted to an integer. +If the end of the file is reached, fgetc() returns EOF. However, since EOF is a valid integer value, when working with binary files you must use feof() to check for the end of the file. If fgetc() encounters an error, EOF is also returned. If working with binary files, you must use ferror() to check for file errors. +Related functions are fputc() , getc() , putc() , and fopen() . + +fgetpos + + +#include +int fgetpos(FILE *stream, fpos_t *position); +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 699 + + +The fgetpos() function stores the current value of the file position indicator in the object pointed to by position. The object pointed to by position must be of type fpos_t. The value stored there is useful only in a subsequent call to fsetpos() . +If an error occurs, fgetpos() returns nonzero; otherwise it returns zero. Related functions are fsetpos() , fseek() , and ftell() . + +fgets + + +#include +char *fgets(char *str, int num, FILE *stream); + + +The fgets() function reads up to num-1 characters from stream and places them into the character array pointed to by str. Characters are read until either a newline or an EOF is received or until the specified limit is reached. After the characters have been read, a null is placed in the array immediately after the last character read. A newline character will be retained and will be part of the array pointed to by str. +If successful, fgets() returns str; a null pointer is returned upon failure. If a read error occurs, the contents of the array pointed to by str are indeterminate. Because a null pointer will be returned when either an error has occurred or when the end of the file is reached, you should use feof() or ferror() to determine what has actually happened. +Related functions are fputs() , fgetc() , gets() , and puts() . + +fopen + + +#include +FILE *fopen(const char *fname, const char *mode); + + +The fopen() function opens a file whose name is pointed to by fname and returns the stream that is associated with it. The type of operations that will be allowed on the file are defined by the value of mode. The legal values for mode are shown in Table 25-1. The filename must be a string of characters comprising a valid filename as defined by the operating system and may include a path specification if the environment supports it. +If fopen() is successful in opening the specified file, a FILE pointer is returned. If the file cannot be opened, a null pointer is returned. +700 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Mode + +"r" "w" "a" "rb" "wb" "ab" "r+" "w+" "a+" +"rb+" or "r+b" "wb+" or "w+b" +"ab+" or "a+b" + +Meaning + +Open text file for reading. Create a text file for writing. Append to text file. +Open binary file for reading. Create binary file for writing. Append to a binary file. Open text file for read/write. +Create text file for read/write. Open text file for read/write. Open binary file for read/write. Create binary file for read/write. +Open binary file for read/write. + + + +Table 25-1. The Legal Values for the mode Parameter of fopen( ) + + + +As the table shows, a file may be opened in either text or binary mode. In text mode, some character translations may occur. For example, newlines may be converted into carriage return/linefeed sequences. No such translations occur on binary files. +The correct method of opening a file is illustrated by this code fragment: + + +FILE *fp; + +if ((fp = fopen("test", "w"))==NULL) { printf("Cannot open file.\n"); exit(1); +} + + +This method detects any error in opening a file, such as a write-protected or a full disk, before attempting to write to it. NULL is used to indicate an error because no file pointer will ever have that value. +If you use fopen() to open a file for output, any preexisting file by that name will be erased and a new file started. If no file by that name exists, one will be created. +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 701 + + +Opening a file for read operations requires that the file exists. If it does not exist, an error will be returned. If you want to add to the end of the file, you must use mode "a." If the file does not exist, it will be created. +When accessing a file opened for read/write operations, you may not follow an output operation with an input operation without an intervening call to either fflush() , fseek() , fsetpos() , or rewind() . Also, you may not follow an input operation with an output operation without an intervening call to one of the previously mentioned functions. +Related functions are fclose() , fread() , fwrite() , putc() , and getc() . + +fprintf + + +#include +int fprintf(FILE *stream, const char *format, ...); + + +The fprintf() function outputs the values of the arguments that comprise the argument list as specified in the format string to the stream pointed to by stream. The return value is the number of characters actually printed. If an error occurs, a negative number is returned. +There may be from zero to several arguments, with the maximum number being system dependent. +The operations of the format control string and commands are identical to those in printf() ; see printf() for a complete description. +Related functions are printf() and fscanf() . + +fputc + + +#include +int fputc(int ch, FILE *stream); + + +The fputc() function writes the character ch to the specified stream at the current file position and then advances the file position indicator. Even though ch is declared to be an int for historical reasons, it is converted by fputc() into an unsigned char. Because all character arguments are elevated to integers at the time of the call, you will generally see character values used as arguments. If an integer were used, the +high-order byte(s) would simply be discarded. +The value returned by fputc() is the value of the character written. If an error occurs, EOF is returned. For files opened for binary operations, an EOF may be a valid character, and the function ferror() will need to be used to determine whether an error has actually occurred. +702 C + + : T h e C o m p l e t e R e f e r e n c e + + +Related functions are fgetc() , fopen() , fprintf() , fread() , and fwrite() . + +fputs + + +#include +int fputs(const char *str, FILE *stream); + + +The fputs() function writes the contents of the string pointed to by str to the specified stream. The null terminator is not written. +The fputs() function returns nonnegative on success and EOF on failure. +If the stream is opened in text mode, certain character translations may take place. This means that there may not be a one-to-one mapping of the string onto the file. However, if the stream is opened in binary mode, no character translations will occur, and a one-to-one mapping between the string and the file will exist. +Related functions are fgets() , gets() , puts() , fprintf() , and fscanf() . + +fread + + +#include +size_t fread(void *buf, size_t size, size_t count, FILE *stream); + +The fread() function reads count number of objects, each object being size bytes in length, from the stream pointed to by stream and places them in the array pointed to by buf. The file position indicator is advanced by the number of characters read. +The fread() function returns the number of items actually read. If fewer items are read than are requested in the call, either an error has occurred or the end of the file has been reached. You must use feof() or ferror() to determine what has taken place. +If the stream is opened for text operations, certain character translations, such as carriage return/linefeed sequences being transformed into newlines, may occur. +Related functions are fwrite() , fopen() , fscanf() , fgetc() , and getc() . + +freopen + + +#include +FILE *freopen(const char *fname, const char *mode, FILE *stream); +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 703 + + +The freopen() function associates an existing stream with a different file. The new file's name is pointed to by fname, the access mode is pointed to by mode, and the stream to be reassigned is pointed to by stream. The string mode uses the same format as fopen() ; a complete discussion is found in the fopen() description. +When called, freopen() first tries to close a file that may currently be associated with stream. However, if the attempt to close the file fails, the freopen() function still continues to open the other file. +The freopen() function returns a pointer to stream on success and a null pointer otherwise. +The main use of freopen() is to redirect the system defined files stdin, stdout, and stderr to some other file. +Related functions are fopen() and fclose() . + +fscanf + + +#include +int fscanf(FILE *stream, const char *format, ...); + + +The fscanf() function works exactly like the scanf() function, except that it reads the information from the stream specified by stream instead of stdin. See scanf() +for details. +The fscanf() function returns the number of arguments actually assigned values. This number does not include skipped fields. A return value of EOF means that a failure occurred before the first assignment was made. +Related functions are scanf() and fprintf() . + +fseek + + +#include +int fseek(FILE *stream, long offset, int origin); + + +The fseek() function sets the file position indicator associated with stream according to the values of offset and origin. Its purpose is to support random-access I/O operations. The offset is the number of bytes from origin to seek to. The values for origin must be one of these macros (defined in ): +704 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Name + +SEEK_SET SEEK_CUR +SEEK_END + +Meaning + +Seek from start of file Seek from current location +Seek from end of file + + +A return value of zero means that fseek() succeeded. A nonzero value indicates failure. +You may use fseek() to move the position indicator anywhere in the file, even beyond the end. However, it is an error to attempt to set the position indicator before the beginning of the file. +The fseek() function clears the end-of-file flag associated with the specified stream. Furthermore, it nullifies any prior ungetc() on the same stream (see ungetc() ). +Related functions are ftell() , rewind() , fopen() , fgetpos() , and fsetpos() . + +fsetpos + + +#include +int fsetpos(FILE *stream, const fpos_t *position); + + +The fsetpos() function moves the file position indicator to the point specified by the object pointed to by position. This value must have been previously obtained through a call to fgetpos() . After fsetpos() is executed, the end-of-file indicator is reset. Also, any previous call to ungetc() is nullified. +If fsetpos() fails, it returns nonzero. If it is successful, it returns zero. Related functions are fgetpos() , fseek() , and ftell() . + +ftell + + +#include +long ftell(FILE *stream); + + +The ftell() function returns the current value of the file position indicator for the specified stream. In the case of binary streams, the value is the number of bytes the indicator is from the beginning of the file. For text streams, the return value may not be meaningful except as an argument to fseek() because of possible character translations, such as carriage return/linefeeds being substituted for newlines, which affect the apparent size of the file. +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 705 + + +The ftell() function returns −1 when an error occurs. If the stream is incapable of random seeks—if it is a modem, for instance—the return value is undefined. +Related functions are fseek() and fgetpos() . + +fwrite + + +#include +size_t fwrite(const void *buf, size_t size, size_t count, FILE *stream); + +The fwrite() function writes count number of objects, each object being size bytes in length, to the stream pointed to by stream from the character array pointed to by buf. The file position indicator is advanced by the number of characters written. +The fwrite() function returns the number of items actually written, which, if the function is successful, will equal the number requested. If fewer items are written than are requested, an error has occurred. For text streams, various character translations may take place but will have no effect upon the return value. +Related functions are fread() , fscanf() , getc() , and fgetc() . + +getc + + +#include +int getc(FILE *stream); + + +The getc() function returns the next character from the input stream and increments the file position indicator. The character is read as an unsigned char that is converted to an integer. +If the end of the file is reached, getc() returns EOF. However, since EOF is a valid integer value, when working with binary files you must use feof() to check for the end-of-file character. If getc() encounters an error, EOF is also returned. If working with binary files, you must use ferror() to check for file errors. +The functions getc() and fgetc() are identical, and in most implementations getc() is simply defined as the macro shown here. + + +#define getc(fp) fgetc(fp) + + +This causes the fgetc() function to be substituted for the getc() macro. Related functions are fputc() , fgetc() , putc() , and fopen() . +706 C + + : T h e C o m p l e t e R e f e r e n c e + + +getchar + + +#include int getchar(void); + +The getchar() function returns the next character from stdin. The character is read as an unsigned char that is converted to an integer. +If the end of the file is reached, getchar() returns EOF. However, since EOF is a valid integer value, when working with binary files you must use feof() to check for end-of-file. If getchar() encounters an error, EOF is also returned. If working with binary files, you must use ferror() to check for file errors. +The getchar() function is often implemented as a macro. Related functions are fputc() , fgetc() , putc() , and fopen() . + +gets + + +#include +char *gets(char *str); + + +The gets() function reads characters from stdin and places them into the character array pointed to by str. Characters are read until a newline or an EOF is received. The newline character is not made part of the string; instead, it is translated into a null to terminate the string. +If successful, gets() returns str; a null pointer is returned upon failure. If a read error occurs, the contents of the array pointed to by str are indeterminate. Because a null pointer will be returned when either an error has occurred or when the end +of the file is reached, you should use feof() or ferror() to determine what has actually happened. +There is no way to limit to the number of characters that gets() will read, and it is therefore your job to make sure that the array pointed to by str will not be overrun. +Related functions are fputs() , fgetc() , fgets() , and puts() . + +perror + + +#include +void perror(const char *str); +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 707 + + +The perror() function maps the value of the global variable errno onto a string and writes that string to stderr. If the value of str is not null, it is written first, followed by a colon, and then the implementation-defined error message. + +printf + + +#include +int printf(const char *format, ...); + + +The printf() function writes to stdout the arguments that comprise the argument list as specified by the string pointed to by format. +The string pointed to by format consists of two types of items. The first type is made up of characters that will be printed on the screen. The second type contains format specifiers that define the way the arguments are displayed. A format specifier begins with a percent sign and is followed by the format code. There must be exactly the same number of arguments as there are format specifiers, and the format specifiers and the arguments are matched in order. For example, the following printf() call displays "Hi c 10 there!". + + +printf("Hi %c %d %s", 'c', 10, "there!"); + + +If there are insufficient arguments to match the format specifiers, the output is undefined. If there are more arguments than format specifiers, the remaining arguments are discarded. The format specifiers are shown in Table 25-2. +The printf() function returns the number of characters actually printed. A negative return value indicates that an error has taken place. +The format codes may have modifiers that specify the field width, precision, and a left-justification flag. An integer placed between the % sign and the format code acts as a minimum field-width specifier. This pads the output with spaces or 0's to ensure that it is at least a certain minimum length. If the string or number is greater than that minimum, it will be printed in full, even if it overruns the minimum. The default padding is done with spaces. If you wish to pad with 0's, place a 0 before the +field-width specifier. For example, %05d will pad a number of less than five digits with 0's so that its total length is 5. +The exact meaning of the precision modifier depends on the format code being modified. To add a precision modifier, place a decimal point followed by the precision after the field-width specifier. For e, E, and f formats, the precision modifier +708 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Code + +%c %d %i %e %E %f %g %G %o %s %u %x %X %p %n + +%% + + +Table 25-2. + +Format + +Character +Signed decimal integers Signed decimal integers +Scientific notation (lowercase e) Scientific notation (uppercase E) Decimal floating point +Uses %e or %f, whichever is shorter (if %e, uses lowercase e) Uses %E or %f, whichever is shorter (if %E, uses uppercase E) Unsigned octal +String of characters Unsigned decimal integers +Unsigned hexadecimal (lowercase letters) Unsigned hexadecimal (uppercase letters) Displays a pointer +The associated argument is a pointer to an integer into which is placed the number of characters written so far +Prints a % sign + + +The printf( ) Format Specifiers + + + + + +determines the number of decimal places printed. For example, %10.4f will display a number at least 10 characters wide with four decimal places. When the precision modifier is applied to the g or G format code, it determines the maximum number +of significant digits displayed. When applied to integers, the precision modifier specifies the minimum number of digits that will be displayed. Leading zeros are added, if necessary. +When the precision modifier is applied to strings, the number following the period specifies the maximum field length. For example, %5.7s will display a string that will +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 709 + + +be at least five characters long and will not exceed seven. If the string is longer than the maximum field width, the characters will be truncated off the end. +By default, all output is right-justified: if the field width is larger than the data printed, the data will be placed on the right edge of the field. You can force the information to be left-justified by placing a minus sign directly after the %. For example, %−10.2f will left-justify a floating-point number with two decimal places in a 10-character field. +There are two format modifiers that allow printf() to display short and long integers. These modifiers may be applied to the d, i, o, u, and x type specifiers. The l modifier tells printf() that a long data type follows. For example, %ld means that a long integer is to be displayed. The h modifier tells printf() to display a short integer. Therefore, %hu indicates that the data is of type short unsigned integer. +If you are using a modern compiler that supports the wide-character features added in 1995, then you may use the l modifier with the c specifier to indicate a wide-character of type wchar_t. You may also use the l modifier with the s format command to indicate a wide-character string. +An L modifier may prefix the floating-point commands of e, f, and g and indicates that a long double follows. +The %n command causes the number of characters that have been written at the time the %n is encountered to be placed in an integer variable whose pointer is specified in the argument list. For example, this code fragment displays the number 14 after the line "This is a test": + + +int i; + +printf("This is a test%n", &i); printf("%d", i); + +The # has a special meaning when used with some printf() format codes. Preceding a g, G, f, e, or E code with a # ensures that the decimal point will be present, even if there are no decimal digits. If you precede the x or X format code with a #, the hexadecimal number will be printed with a 0x prefix. If you precede the o format with a #, the octal value will be printed with a 0 prefix. The # cannot be applied to any other format specifiers. +The minimum field-width and precision specifiers may be provided by arguments to printf() instead of by constants. To accomplish this, use an * as a placeholder. When the format string is scanned, printf() will match each * to an argument in the order in which they occur. +Related functions are scanf() and fprintf() . +710 C + + : T h e C o m p l e t e R e f e r e n c e + + +putc + + +#include +int putc(int ch, FILE *stream); + + +The putc() function writes the character contained in the least significant byte of ch to the output stream pointed to by stream. Because character arguments are elevated to integer at the time of the call, you may use character values as arguments to putc() . +The putc() function returns the character written on success or EOF if an error occurs. If the output stream has been opened in binary mode, EOF is a valid value for ch. This means that you must use ferror() to determine if an error has occurred. +Related functions are fgetc() , fputc() , getchar() , and putchar() . + +putchar + + +#include int putchar(int ch); + +The putchar() function writes the character contained in the least significant byte of ch to stdout. It is functionally equivalent to putc(ch, stdout). Because character arguments are elevated to integer at the time of the call, you may use character values as arguments to putchar() . +The putchar() function returns the character written on success or EOF if an error occurs. If the output stream has been opened in binary mode, EOF is a valid value for ch. This means that you must use ferror() to determine if an error has occurred. +A related function is putc(). + +puts + + +#include +int puts(const char *str); + + +The puts( ) function writes the string pointed to by str to the standard output device. The null terminator is translated to a newline. +The puts() function returns a nonnegative value if successful and an EOF upon failure. +Related functions are putc() , gets() , and printf() . +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 711 + + +remove + + +#include +int remove(const char *fname); + + +The remove() function erases the file specified by fname. It returns zero if the file was successfully deleted and nonzero if an error occurred. +A related function is rename() . + +rename + + +#include +int rename(const char *oldfname, const char *newfname); + + +The rename() function changes the name of the file specified by oldfname to newfname. The newfname must not match any existing directory entry. +The rename() function returns zero if successful and nonzero if an error has occurred. +A related function is remove() . + +rewind + + +#include +void rewind(FILE *stream); + + +The rewind() function moves the file position indicator to the start of the specified stream. It also clears the end-of-file and error flags associated with stream. It has no return value. +A related function is fseek() . + +scanf + + +#include +int scanf(const char *format, ...); +712 C + + : T h e C o m p l e t e R e f e r e n c e + + +The scanf() function is a general-purpose input routine that reads the stream stdin and stores the information in the variables pointed to in its argument list. It can read all the built-in data types and automatically convert them into the proper internal format. +The control string pointed to by format consists of three classifications of characters: + +Format specifiers White-space characters +Non–white-space characters + +The input format specifiers begin with a % sign and tell scanf() what type of data is to be read next. The format specifiers are listed in Table 25-3. For example, %s reads a string while %d reads an integer. The format string is read left to right and the format specifiers are matched, in order, with the arguments that comprise the argument list. + + + +Code Meaning + +%c Reads a single character. %d Reads a decimal integer. %i Reads an integer. +%e Reads a floating-point number. %f Reads a floating-point number. %g Reads a floating-point number. %o Reads an octal number. +%s Reads a string. +%x Reads a hexadecimal number. %p Reads a pointer. +%n Receives an integer value equal to the number of characters read so far. %u Reads an unsigned integer. +%[ ] Scans for a set of characters. %% Reads a percent sign. + +Table 25-3. The scanf( ) Format Specifiers +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 713 + + +To read a long integer, put an l (ell) in front of the format specifier. To read a short integer, put an h in front of the format specifier. These modifiers can be used with the d, i, o, u, and x format codes. +By default, the f, e, and g specifiers instruct scanf() to assign data to a float. If you put an l (ell) in front of one of these specifiers, scanf() assigns the data to a double. Using an L tells scanf() that the variable receiving the data is a long double. +If you are using a modern compiler that supports wide-character features added in 1995, you may use the l modifier with the c format code to indicate a pointer to a wide character of type wchar_t. You may also use the l modifier with the s format code to indicate a pointer to a wide-character string. The l may also be used to modify a scanset to indicate wide characters. +A white-space character in the format string causes scanf() to skip over one or more white-space characters in the input stream. A white-space character is either a space, a tab character, or a newline. In essence, one white-space character in the control string will cause scanf() to read, but not store, any number (including zero) of +white-space characters up to the first non–white-space character. +A non–white-space character in the format string causes scanf() to read and discard a matching character. For example, %d,%d causes scanf() to first read an integer, then read and discard a comma, and finally read another integer. If the specified character is not found, scanf() will terminate. +All the variables used to receive values through scanf() must be passed by their addresses. This means that all arguments must be pointers. +The input data items must be separated by spaces, tabs, or newlines. Punctuation such as commas, semicolons, and the like do not count as separators. This means that + + +scanf("%d%d", &r, &c); + + +will accept an input of 10 20 but fail with 10,20. +An * placed after the % and before the format code will read data of the specified type but suppress its assignment. Thus, the command + + +scanf("%d%*c%d", &x, &y); + + +given the input 10/20, will place the value 10 into x, discard the divide sign, and give y the value 20. +The format commands can specify a maximum field-length modifier. This is an integer number placed between the % and the format code that limits the number of characters read for any field. For example, if you wish to read no more than 20 characters into address, you would write the following: +714 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +scanf("%20s", address); + + +If the input stream were greater than 20 characters, a subsequent call to input would begin where this call left off. Input for a field may terminate before the maximum field length is reached if a white space is encountered. In this case, scanf() moves on to the next field. +Although spaces, tabs, and newlines are used as field separators, when reading a single character, these are read like any other character. For example, with an input stream of x y, + + +scanf("%c%c%c", &a, &b, &c); + + +will return with the character x in a, a space in b and the character y in c. +Beware: Any other characters in the control string—including spaces, tabs, and newlines—will be used to match and discard characters from the input stream. Any character that matches is discarded. For example, given the input stream 10t20, + + +scanf("%dt%d", &x, &y); + + +will place 10 into x and 20 into y. The t is discarded because of the t in the control string. +Another feature of scanf() is called a scanset. A scanset defines a set of characters that will be read by scanf() and assigned to the corresponding character array. A scanset is defined by putting the characters you want to scan for inside square brackets. The beginning square bracket must be prefixed by a percent sign. For example, this scanset tells scanf() to read only the characters A, B, and C: + + +%[ABC] + + +When a scanset is used, scanf() continues to read characters and put them into the corresponding character array until a character that is not in the scanset is encountered. The corresponding variable must be a pointer to a character array. Upon return from scanf() , the array will contain a null-terminated string comprised of the characters read. +You can specify an inverted set if the first character in the set is a ^. When the ^ is present, it instructs scanf() to accept any character that is not defined by the scanset. +You can specify a range using a hyphen. For example, this tells scanf() to accept the characters A through Z. +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 715 + + +%[A-Z] + +One important point to remember is that the scanset is case sensitive. Therefore, if you want to scan for both upper- and lowercase letters, they must be specified individually. +The scanf() function returns a number equal to the number of fields that were successfully assigned values. This number will not include fields that were read but not assigned because the * modifier was used to suppress the assignment. EOF is returned if an error occurs before the first field is assigned. +Related functions are printf() and fscanf() . + +setbuf + + +#include +void setbuf(FILE *stream, char *buf); + + +The setbuf() function is used to either specify the buffer the specified stream will use or, if called with buf set to null, to turn off buffering. If a programmer-defined buffer is to be specified, it must be BUFSIZ characters long. BUFSIZ is defined in . +The setbuf() function returns no value. +Related functions are fopen() , fclose() , and setvbuf() . + +setvbuf + + +#include +int setvbuf(FILE *stream, char *buf, int mode, size_t size); + + +The setvbuf() function allows the programmer to specify the buffer, its size, and its mode for the specified stream. The character array pointed to by buf is used as the stream buffer for I/O operations. The size of the buffer is set by size, and mode determines how buffering will be handled. If buf is null, setvbuf() will allocate its own buffer. +The legal values of mode are _IOFBF, _IONBF, and _IOLBF. These are defined in . When mode is set to _IOFBF, full buffering will take place. If mode is _IOLBF, the stream will be line buffered, which means that the buffer will be flushed each time a newline character is written for output streams; for input streams, an input request reads all characters up to a newline. In either case, the buffer is also flushed when full. If mode is _IONBF, no buffering takes place. +The value of size must be greater than zero. +716 C + + : T h e C o m p l e t e R e f e r e n c e + + +The setvbuf() function returns zero on success, nonzero on failure. A related function is setbuf() . + +sprintf + + +#include +int sprintf(char *buf, const char *format, ...); + + +The sprintf() function is identical to printf() except that the output is put into the array pointed to by buf instead of being written to the console. See printf() for details. +The return value is equal to the number of characters actually placed into the array. Related functions are printf() and fsprintf() . + +sscanf + + +#include +int sscanf(const char *buf, const char *format, ...); + + +The sscanf() function is identical to scanf() except that data is read from the array pointed to by buf rather than stdin. See scanf() for details. +The return value is equal to the number of variables that were actually assigned values. This number does not include fields that were skipped through the use of the * format command modifier. A value of zero means that no fields were assigned, and EOF indicates that an error occurred prior to the first assignment. +Related functions are scanf() and fscanf() . + +tmpfile + + +#include FILE *tmpfile(void); + +The tmpfile() function opens a temporary file for update and returns a pointer to the stream. The function automatically uses a unique filename to avoid conflicts with existing files. +The tmpfile() function returns a null pointer on failure; otherwise it returns a pointer to the stream. +C h a p t e r 2 5 : T h e C - B a s e d I / O F u n c t i o n s 717 + + +The temporary file created by tmpfile() is automatically removed when the file is closed or when the program terminates. +A related function is tmpnam() . + +tmpnam + + +#include +char *tmpnam(char *name); + + +The tmpnam() function generates a unique filename and stores it in the array pointed to by name. The main purpose of tmpnam() is to generate a temporary filename that is different from any other file in the current disk directory. +The function may be called up to TMP_MAX times. TMP_MAX is defined in , and it will be at least 25. Each time tmpnam() is called, it will generate a new temporary filename. +A pointer to name is returned on success; otherwise a null pointer is returned. A related function is tmpfile() . + +ungetc + + +#include +int ungetc(int ch, FILE *stream); + + +The ungetc() function returns the character specified by the low-order byte of ch to the input stream stream. This character will then be obtained by the next read operation on stream. A call to fflush() or fseek() undoes an ungetc() operation and discards +the character. +A one-character pushback is guaranteed; however, some implementations will accept more. +You may not unget an EOF. +A call to ungetc() clears the end-of-file flag associated with the specified stream. The value of the file position indicator for a text stream is undefined until all pushed-back characters are read, in which case it will be the same as it was prior to the first ungetc() call. For binary streams, each ungetc() call decrements the file position indicator. +The return value is equal to ch on success and EOF on failure. A related function is getc() . +718 C + + : T h e C o m p l e t e R e f e r e n c e + + +vprintf, vfprintf, and vsprintf + + +#include #include +int vprintf(char *format, va_list arg_ptr); int vfprintf(FILE *stream, const char *format, +va_list arg_ptr); +int vsprintf(char *buf, const char *format, va_list arg_ptr); + +The functions vprintf( ), vfprintf() , and vsprintf() are functionally equivalent to printf() , fprintf() , and sprintf() , respectively, except that the argument list has been replaced by a pointer to a list of arguments. This pointer must be of type va_list, which is defined in the header (or the C header file stdarg.h). +Related functions are va_arg() , va_start() , and va_end() . + +C++ + + + + +Chapter 26 The String and +Character Functions + + + + + + + + + + + +719 +720 C + + : T h e C o m p l e t e R e f e r e n c e + + +he standard function library has a rich and varied set of string and character handling functions. The string functions operate on null-terminated arrays of characters and require the header . The character functions use the +T +header . C programs must use the header files string.h and ctype.h. +Because C/C++ has no bounds checking on array operations, it is the programmer's responsibility to prevent an array overflow. Neglecting to do so may cause your program to crash. +In C/C++, a printable character is one that can be displayed on a terminal. These are usually the characters between a space (0x20) and tilde (0xFE). Control characters have values between (0) and (0x1F) as well as DEL (0x7F). +For historical reasons, the parameters to the character functions are integers, but only the low-order byte is used; the character functions automatically convert their arguments to unsigned char. However, you are free to call these functions with character arguments because characters are automatically elevated to integers at the time of the call. +The header defines the size_t type, which is essentially the same as unsigned. +This chapter describes only those functions that operate on characters of type char. These are the functions originally defined by Standard C and C++, and they are by far the most widely used and supported. Wide-character functions that operate on characters of type wchar_t are discussed in Chapter 31. + +isalnum + + +#include int isalnum(int ch); + +The isalnum() function returns nonzero if its argument is either a letter of the alphabet or a digit. If the character is not alphanumeric, zero is returned. +Related functions are isalpha() , iscntrl() , isdigit() , isgraph() , isprint() , ispunct() , and isspace() . + +isalpha + + +#include int isalpha(int ch); + +The isalpha() function returns nonzero if ch is a letter of the alphabet; otherwise zero is returned. What constitutes a letter of the alphabet may vary from language to language. For English, these are the upper- and lowercase letters A through Z. +C h a p t e r 2 6 : T h e S t r i n g a n d C h a r a c t e r F u n c t i o n s 721 + + +Related functions are isalnum() , iscntrl() , isdigit() , isgraph() , isprint() , ispunct() , and isspace() . + +iscntrl + + +#include int iscntrl(int ch); + +The iscntrl() function returns nonzero if ch is between zero and 0x1F or is equal to 0x7F (DEL); otherwise zero is returned. +Related functions are isalnum() , isalpha() , isdigit() , isgraph() , isprint() , ispunct() , and isspace() . + +isdigit + + +#include int isdigit(int ch); + +The isdigit() function returns nonzero if ch is a digit, that is, 0 through 9. Otherwise zero is returned. +Related functions are isalnum() , isalpha() , iscntrl() , isgraph() , isprint() , ispunct() , and isspace() . + +isgraph + + +#include int isgraph(int ch); + +The isgraph() function returns nonzero if ch is any printable character other than a space; otherwise zero is returned. Printable characters are generally in the range 0x21 through 0x7E. +Related functions are isalnum() , isalpha() , iscntrl() , isdigit() , isprint() , ispunct() , and isspace() . + +islower + + +#include int islower(int ch); +722 C + + : T h e C o m p l e t e R e f e r e n c e + + +The islower() function returns nonzero if ch is a lowercase letter; otherwise zero is returned. +A related function is isupper() . + +isprint + + +#include int isprint(int ch); + +The isprint() function returns nonzero if ch is a printable character, including a space; otherwise zero is returned. Printable characters are often in the range 0x20 through 0x7E. +Related functions are isalnum() , isalpha() , iscntrl() , isdigit() , isgraph() , ispunct() , and isspace() . + +ispunct + + +#include int ispunct(int ch); + +The ispunct() function returns nonzero if ch is a punctuation character; otherwise zero is returned. The term "punctuation," as defined by this function, includes all printing characters that are neither alphanumeric nor a space. +Related functions are isalnum() , isalpha() , iscntrl() , isdigit() , isgraph() , and isspace() . + +isspace + + +#include int isspace(int ch); + +The isspace() function returns nonzero if ch is either a space, horizontal tab, vertical tab, formfeed, carriage return, or newline character; otherwise zero is returned. +Related functions are isalnum() , isalpha() , iscntrl() , isdigit() , isgraph() , and ispunct() . +C h a p t e r 2 6 : T h e S t r i n g a n d C h a r a c t e r F u n c t i o n s 723 + + +isupper + + +#include int isupper(int ch); + +The isupper() function returns nonzero if ch is an uppercase letter; otherwise zero is returned. +A related function is islower() . + +isxdigit + + +#include +int isxdigit(int ch); + + +The isxdigit() function returns nonzero if ch is a hexadecimal digit; otherwise zero is returned. A hexadecimal digit will be in one of these ranges: A–F, a–f, or 0–9. +Related functions are isalnum() , isalpha() , iscntrl() , isdigit() , isgraph() , ispunct() , and isspace() . + +memchr + + +#include +void *memchr(const void *buffer, int ch, size_t count); + + +The memchr() function searches the array pointed to by buffer for the first occurrence of ch in the first count characters. +The memchr() function returns a pointer to the first occurrence of ch in buffer, or it returns a null pointer if ch is not found. +Related functions are memcpy() and isspace() . + +memcmp + + +#include +int memcmp(const void *buf1, const void *buf2, size_t count); +724 C + + : T h e C o m p l e t e R e f e r e n c e + + +The memcmp() function compares the first count characters of the arrays pointed to by buf1 and buf2. +The memcmp() function returns an integer that is interpreted as indicated here: + + +Value + +Less than zero Zero +Greater than zero + +Meaning + +buf1 is less than buf2. buf1 is equal to buf2. +buf1 is greater than buf2. + + +Related functions are memchr() , memcpy() , and strcmp() . + +memcpy + + +#include +void *memcpy(void *to, const void *from, size_t count); + + +The memcpy() function copies count characters from the array pointed to by from into the array pointed to by to. If the arrays overlap, the behavior of memcopy() is undefined. +The memcpy() function returns a pointer to to. A related function is memmove() . + +memmove + + +#include +void *memmove(void *to, const void *from, size_t count); + + +The memmove() function copies count characters from the array pointed to by from into the array pointed to by to. If the arrays overlap, the copy will take place correctly, placing the correct contents into to but leaving from modified. +The memmove() function returns a pointer to to. A related function is memcpy() . +C h a p t e r 2 6 : T h e S t r i n g a n d C h a r a c t e r F u n c t i o n s 725 + + +memset + + +#include +void *memset(void *buf, int ch, size_t count); + + +The memset() function copies the low-order byte of ch into the first count characters of the array pointed to by buf. It returns buf. +The most common use of memset() is to initialize a region of memory to some known value. +Related functions are memcmp() , memcpy() , and memmove() . + +strcat + + +#include +char *strcat(char *str1, const char *str2); + + +The strcat() function concatenates a copy of str2 to str1 and terminates str1 with a null. The null terminator originally ending str1 is overwritten by the first character of str2. The string str2 is untouched by the operation. If the arrays overlap, the behavior of strcat() is undefined. +The strcat() function returns str1. +Remember, no bounds checking takes place, so it is the programmer's responsibility to ensure that str1 is large enough to hold both its original contents and also those of str2. +Related functions are strchr() , strcmp() , and strcpy() . + +strchr + + +#include +char *strchr(const char *str, int ch); + + +The strchr() function returns a pointer to the first occurrence of the low-order byte of ch in the string pointed to by str. If no match is found, a null pointer is returned. +Related functions are strpbrk() , strspn() , strstr() , and strtok() . +726 C + + : T h e C o m p l e t e R e f e r e n c e + + +strcmp + + +#include +int strcmp(const char *str1, const char *str2); + + +The strcmp() function lexicographically compares two strings and returns an integer based on the outcome as shown here: + + +Value + +Less than zero Zero +Greater than zero + +Meaning + +str1 is less than str2. str1 is equal to str2. +str1 is greater than str2. + + +Related functions are strchr() , strcpy() , and strcmp() . + +strcoll + + +#include +int strcoll(const char *str1, const char *str2); + + +The strcoll() function compares the string pointed to by str1 with the one pointed to by str2. The comparison is performed in accordance to the locale specified using the setlocale() function (see setlocale for details). +The strcoll() function returns an integer that is interpreted as indicated here: + + +Value + +Less than zero Zero +Greater than zero + +Meaning + +str1 is less than str2. str1 is equal to str2. +str1 is greater than str2. + + +Related functions are memcmp() and strcmp() . +C h a p t e r 2 6 : T h e S t r i n g a n d C h a r a c t e r F u n c t i o n s 727 + + +strcpy + + +#include +char *strcpy(char *str1, const char *str2); + + +The strcpy() function is used to copy the contents of str2 into str1. str2 must be a pointer to a null-terminated string. The strcpy() function returns a pointer to str1. +If str1 and str2 overlap, the behavior of strcpy() is undefined. Related functions are memcpy() , strchr() , strcmp() , and strncmp() . + +strcspn + + +#include +size_t strcspn(const char *str1, const char *str2); + + +The strcspn() function returns the length of the initial substring of the string pointed to by str1 that is made up of only those characters not contained in the string pointed to by str2. Stated differently, strcspn() returns the index of the first character in the string pointed to by str1 that matches any of the characters in the string pointed to by str2. +Related functions are strrchr() , strpbrk() , strstr() , and strtok() . + +strerror + + +#include +char *strerror(int errnum); + + +The strerror() function returns a pointer to an implementation-defined string associated with the value of errnum. Under no circumstances should you modify the string. + +strlen + + +#include +size_t strlen(const char *str); +728 C + + : T h e C o m p l e t e R e f e r e n c e + + +The strlen() function returns the length of the null-terminated string pointed to by str. The null terminator is not counted. +Related functions are memcpy() , strchr() , strcmp() , and strncmp() . + +strncat + + +#include +char *strncat(char *str1, const char *str2, size_t count); + + +The strncat() function concatenates not more than count characters of the string pointed to by str2 to the string pointed to by str1 and terminates str1 with a null. The null terminator originally ending str1 is overwritten by the first character of str2. The string str2 is untouched by the operation. If the strings overlap, the behavior is undefined. +The strncat() function returns str1. +Remember that no bounds checking takes place, so it is the programmer's responsibility to ensure that str1 is large enough to hold both its original contents and also those of str2. +Related functions are strcat() , strnchr() , strncmp() , and strncpy() . + +strncmp + + +#include +int strncmp(const char *str1, const char *str2, size_t count); + + +The strncmp() function lexicographically compares not more than count characters from the two null-terminated strings and returns an integer based on the outcome, as shown here: + + +Value + +Less than zero Zero +Greater than zero + +Meaning + +str1 is less than str2. str1 is equal to str2. +str1 is greater than str2. + + +If there are less than count characters in either string, the comparison ends when the first null is encountered. +Related functions are strcmp() , strnchr() , and strncpy() . +C h a p t e r 2 6 : T h e S t r i n g a n d C h a r a c t e r F u n c t i o n s 729 + + +strncpy + + +#include +char *strncpy(char *str1, const char *str2, size_t count); + + +The strncpy() function is used to copy up to count characters from the string pointed to by str2 into the string pointed to by str1. str2 must be a pointer to a null-terminated string. +If str1 and str2 overlap, the behavior of strncpy() is undefined. +If the string pointed to by str2 has less than count characters, nulls will be appended to the end of str1 until count characters have been copied. +Alternatively, if the string pointed to by str2 is longer than count characters, the resultant string pointed to by str1 will not be null terminated. +The strncpy() function returns a pointer to str1. +Related functions are memcpy() , strchr() , strncat() , and strncmp() . + +strpbrk + + +#include +char *strpbrk(const char *str1, const char *str2); + + +The strpbrk() function returns a pointer to the first character in the string pointed to by str1 that matches any character in the string pointed to by str2. The null terminators are not included. If there are no matches, a null pointer is returned. +Related functions are strspn() , strrchr() , strstr() , and strtok() . + +strrchr + + +#include +char *strrchr(const char *str, int ch); + + +The strrchr() function returns a pointer to the last occurrence of the low-order byte of ch in the string pointed to by str. If no match is found, a null pointer is returned. +Related functions are strpbrk() , strspn() , strstr() , and strtok() . +730 C + + : T h e C o m p l e t e R e f e r e n c e + + +strspn + + +#include +size_t strspn(const char *str1, const char *str2); + + +The strspn() function returns the length of the initial substring of the string pointed to by str1 that is made up of only those characters contained in the string pointed to by str2. Stated differently, strspn() returns the index of the first character in the string pointed to by str1 that does not match any of the characters in the string pointed to +by str2. +Related functions are strpbrk() , strrchr() , strstr() , and strtok() . + +strstr + + +#include +char *strstr(const char *str1, const char *str2); + + +The strstr() function returns a pointer to the first occurrence in the string pointed to by str1 of the string pointed to by str2. It returns a null pointer if no match is found. +Related functions are strchr() , strcspn() , strpbrk() , strspn() , strtok() , and strrchr() . + +strtok + + +#include +char *strtok(char *str1, const char *str2); + + +The strtok() function returns a pointer to the next token in the string pointed to by str1. The characters making up the string pointed to by str2 are the delimiters that determine the token. A null pointer is returned when there is no token to return. +To tokenize a string, the first call to strtok() must have str1 point to the string being tokenized. Subsequent calls must use a null pointer for str1. In this way, the entire string can be reduced to its tokens. +It is possible to use a different set of delimiters for each call to strtok() . Related functions are strchr() , strcspn() , strpbrk() , strrchr() , and strspn() . +C h a p t e r 2 6 : T h e S t r i n g a n d C h a r a c t e r F u n c t i o n s 731 + + +strxfrm + + +#include +size_t strxfrm(char *str1, const char *str2, size_t count); + + +The strxfrm() function transforms the first count characters of the string pointed to by str2 so that it can be used by the strcmp() function and puts the result into the string pointed to by str1. After the transformation, the outcome of a strcmp() using str1 and a strcoll() using the original string pointed to by str2 will be the same. +The strxfrm() function returns the length of the transformed string. A related function is strcoll() . + +tolower + + +#include int tolower(int ch); + +The tolower() function returns the lowercase equivalent of ch if ch is a letter; otherwise ch is returned unchanged. +A related function is toupper( ). + +toupper + + +#include int toupper(int ch); + +The toupper() function returns the uppercase equivalent of ch if ch is a letter; otherwise ch is returned unchanged. +A related function is tolower() . + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 27 The Mathematical Functions + + + + + + + + + + + + + + +733 +734 C + + : T h e C o m p l e t e R e f e r e n c e + + +he standard function library contains several mathematical functions, which fall into the following categories: +T + + Trigonometric functions Hyperbolic functions + Exponential and logarithmic functions Miscellaneous functions +All the math functions require the header . (C programs must use the header file math.h.) In addition to declaring the math functions, this header defines the macro called HUGE_VAL. The macros EDOM and ERANGE are also used by the math functions. These macros are defined in the header (or the file errno.h). If an argument to a math function is not in the domain for which it is defined, an implementation-defined value is returned, and the built-in global integer variable errno is set equal to EDOM. If a routine produces a result that is too large to be represented, an overflow occurs. This causes the routine to return HUGE_VAL, and errno is set to ERANGE, indicating a range error. If an underflow happens, the function returns zero and sets errno to ERANGE. +All angles are in radians. +Originally, the mathematical functions were specified as operating on values of type double, but Standard C++ added overloaded versions to explicitly accommodate values of type float and long double. The operation of the functions is otherwise unchanged. + +acos + + +#include +float acos(float arg); double acos(double arg); +long double acos(long double arg); + + +The acos() function returns the arc cosine of arg. The argument to acos() must be in the range –1 to 1; otherwise a domain error will occur. +Related functions are asin() , atan() , atan2() , sin() , cos() , tan() , sinh() , cosh() , and tanh(). + +asin + + +#include +float asin(float arg); +C h a p t e r 2 7 : T h e M a t h e m a t i c a l F u n c t i o n s 735 + + + +double asin(double arg); +long double asin(long double arg); + + +The asin() function returns the arc sine of arg. The argument to asin() must be in the range –1 to 1; otherwise a domain error will occur. +Related functions are acos() , atan() , atan2() , sin() , cos() , tan() , sinh() , cosh() , and tanh() . + +atan + + +#include +float atan(float arg); double atan(double arg); +long double atan(long double arg); + + +The atan() function returns the arc tangent of arg. +Related functions are asin() , acos() , atan2() , tan() , cos() , sin() , sinh() , cosh() , and tanh() . + +atan2 + + +#include +float atan2(float y, float x); double atan2(double y, double x); +long double atan2(long double y, long double x); + + +The atan2() function returns the arc tangent of y/x. It uses the signs of its arguments to compute the quadrant of the return value. +Related functions are asin() , acos() , atan() , tan() , cos() , sin() , sinh() , cosh() , and tanh() . + +ceil + + +#include +float ceil(float num); double ceil(double num); +long double ceil(long double num); +736 C + + : T h e C o m p l e t e R e f e r e n c e + + +The ceil() function returns the smallest integer (represented as a floating-point value) not less than num. For example, given 1.02, ceil() would return 2.0. Given –1.02, ceil() would return –1. +Related functions are floor() and fmod() . + +cos + + +#include float cos(float arg); +double cos(double arg); +long double cos(long double arg); + + +The cos() function returns the cosine of arg. The value of arg must be in radians. Related functions are asin() , acos() , atan2() , atan() , tan() , sin() , sinh() , cos() , +and tanh() . + +cosh + + +#include +float cosh(float arg); double cosh(double arg); +long double cosh(long double arg); + + +The cosh() function returns the hyperbolic cosine of arg. +Related functions are asin() , acos() , atan2() , atan() , tan() , sin() , cosh() , and tanh(). + +exp + + +#include float exp(float arg); +double exp(double arg); +long double exp(long double arg); + + +The exp() function returns the natural logarithm base e raised to the arg power. A related function is log() . +C h a p t e r 2 7 : T h e M a t h e m a t i c a l F u n c t i o n s 737 + + +fabs + + +#include +float fabs(float num); double fabs(double num); +long double fabs(long double num); + + +The fabs() function returns the absolute value of num. A related function is abs() . + +floor + + +#include +float floor(float num); double floor(double num); +long double floor(long double num); + + +The floor() function returns the largest integer (represented as a floating-point value) not greater than num. For example, given 1.02, floor() would return 1.0. Given –1.02, floor() would return –2.0. +Related functions are fceil() and fmod() . + +fmod + + +#include +float fmod(float x, float y); double fmod(double x, double y); +long double fmod(long double x, long double y); + + +The fmod() function returns the remainder of x/y. Related functions are ceil() , floor() , and fabs() . + +frexp + + +#include +float frexp(float num, int *exp); +738 C + + : T h e C o m p l e t e R e f e r e n c e + + + +double frexp(double num, int *exp); +long double frexp(long double num, int *exp); + + +The frexp() function decomposes the number num into a mantissa in the range 0.5 to less than 1, and an integer exponent such that num = mantissa * 2 . The mantissa is returned by the function, and the exponent is stored at the variable pointed to by exp. +exp +A related function is ldexp() . + +ldexp + + +#include +float ldexp(float num, int exp); double ldexp(double num, int exp); +long double ldexp(long double num, int exp); + +The ldexp() returns the value of num * 2exp. If overflow occurs, HUGE_VAL is returned. +Related functions are frexp() and modf() . + +log + + +#include float log(float num); +double log(double num); +long double log(long double num); + + +The log() function returns the natural logarithm for num. A domain error occurs if num is negative, and a range error occurs if the argument is zero. +A related function is log10() . + +log10 + + +#include +float log10(float num); double log10(double num); +long double log10(long double num); +C h a p t e r 2 7 : T h e M a t h e m a t i c a l F u n c t i o n s 739 + + +The log10() function returns the base 10 logarithm for num. A domain error occurs if num is negative, and a range error occurs if the argument is zero. +A related function is log() . + +modf + + +#include +float modf(float num, float *i); double modf(double num, double *i); +long double modf(long double num, long double *i); + + +The modf() function decomposes num into its integer and fractional parts. It returns the fractional portion and places the integer part in the variable pointed to by i. +Related functions are frexp() and ldexp() . + +pow + + +#include +float pow(float base, float exp); float pow(float base, int exp); double pow(double base, double exp); double pow(double base, int exp); +long double pow(long double base, long double exp); long double pow(long double base, int exp); + +The pow() function returns base raised to the exp power (baseexp). A domain error may occur if base is zero and exp is less than or equal to zero. It will also happen if base is negative and exp is not an integer. An overflow produces a range error. +Related functions are exp() , log() , and sqrt() . + +sin + +#include float sin(float arg); +double sin(double arg); +long double sin(long double arg); + + +The sin() function returns the sine of arg. The value of arg must be in radians. +740 C + + : T h e C o m p l e t e R e f e r e n c e + + +Related functions are asin() , acos() , atan2() , atan() , tan() , cos() , sinh() , cosh() , and tanh() . + +sinh + + +#include +float sinh(float arg); double sinh(double arg); +long double sinh(long double arg); + + +The sinh() function returns the hyperbolic sine of arg. +Related functions are asin() , acos() , atan2() , atan() , tan() , cos() , tanh() , cosh() , and sin() . + +sqrt + + +#include +float sqrt(float num); double sqrt(double num); +long double sqrt(long double num); + + +The sqrt() function returns the square root of num. If it is called with a negative argument, a domain error will occur. +Related functions are exp() , log() , and pow() . + +tan + + +#include float tan(float arg); +double tan(double arg); +long double tan(long double arg); + + +The tan() function returns the tangent of arg. The value of arg must be in radians. Related functions are acos() , asin() , atan() , atan2() , cos() , sin() , sinh() , cosh() , +and tanh() . +C h a p t e r 2 7 : T h e M a t h e m a t i c a l F u n c t i o n s 741 + + +tanh + + +#include +float tanh(float arg); double tanh(double arg); +long double tanh(long double arg); + + +The tanh() function returns the hyperbolic tangent of arg. +Related functions are acos() , asin() , atan() , atan2() , cos() , sin() , cosh() , sinh() , and tan() . + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 28 Time, Date, and +Localization Functions + + + + + + + + + + + +743 +744 C + + : T h e C o m p l e t e R e f e r e n c e + + +he standard function library defines several functions that deal with the date and time. It also defines functions that handle the geopolitical information associated with a program. These functions are described here. +T +The time and date functions require the header . (A C program must use the header file time.h.) This header defines three time-related types: clock_t, time_t, and tm. The types clock_t and time_t are capable of representing the system time and date as some sort of integer. This is called the calendar time. The structure type tm holds the date and time broken down into its elements. The tm structure is defined as shown here: + + + +struct tm { int tm_sec; +int tm_min; + + +/* seconds, 0-61 */ +/* minutes, 0-59 */ + +int tm_hour; /* hours, 0-23 */ +int tm_mday; /* day of the month, 1-31 */ int tm_mon; /* months since Jan, 0-11 */ int tm_year; /* years from 1900 */ +int tm_wday; /* days since Sunday, 0-6 */ int tm_yday; /* days since Jan 1, 0-365 */ int tm_isdst /* Daylight Saving Time +indicator */ } + +The value of tm_isdst will be positive if daylight saving time is in effect, zero if it is not in effect, and negative if there is no information available. This form of the time and date is called the broken-down time. +In addition, defines the macro CLOCKS_PER_SEC, which is the number of system clock ticks per second. +The geopolitical environmental functions require the header . (A C program must use the header file locale.h.) + +asctime + + +#include +char *asctime(const struct tm *ptr); + + +The asctime() function returns a pointer to a string that contains the information stored in the structure pointed to by ptr converted into the following form: + +day month date hours:minutes:seconds year\n\0 +C h a p t e r 2 8 : T i m e , D a t e , a n d L o c a l i z a t i o n F u n c t i o n s 745 + + +For example: + +Wed Jun 19 12:05:34 1999 + +The structure pointer passed to asctime() is usually obtained from either localtime() or gmtime() . +The buffer used by asctime() to hold the formatted output string is a statically allocated character array and is overwritten each time the function is called. If you wish to save the contents of the string, you must copy it elsewhere. +Related functions are localtime() , gmtime() , time() , and ctime() . + +clock + + +#include clock_t clock(void); + +The clock() function returns a value that approximates the amount of time the calling program has been running. To transform this value into seconds, divide it by CLOCKS_PER_SEC. A value of –1 is returned if the time is not available. +Related functions are time() , asctime() , and ctime() . + +ctime + + +#include +char *ctime(const time_t *time); + + +The ctime() function returns a pointer to a string of the form + +day month year hours:minutes:seconds year\n\0 + +given a pointer to the calendar time. The calendar time is often obtained through a call to time() . +The buffer used by ctime() to hold the formatted output string is a statically allocated character array and is overwritten each time the function is called. If you wish to save the contents of the string, it is necessary to copy it elsewhere. +Related functions are localtime() , gmtime() , time() , and asctime() . +746 C + + : T h e C o m p l e t e R e f e r e n c e + + +difftime + + +#include +double difftime(time_t time2, time_t time1); + + +The difftime() function returns the difference, in seconds, between time1 and time2. That is, time2 –time1. +Related functions are localtime() , gmtime() , time() , asctime() . + +gmtime + + +#include +struct tm *gmtime(const time_t *time); + + +The gmtime() function returns a pointer to the broken-down form of time in the form of a tm structure. The time is represented in Coordinated Universal Time (UTC), which is essentially Greenwich mean time. The time value is usually obtained through a call to time() . If the system does not support UTC, NULL is returned. +The structure used by gmtime() to hold the broken-down time is statically allocated and is overwritten each time the function is called. If you wish to save the contents of the structure, you must copy it elsewhere. +Related functions are localtime() , time() , and asctime() . + +localeconv + + +#include +struct lconv *localeconv(void); + + +The localeconv() function returns a pointer to a structure of type lconv, which contains various geopolitical environmental information relating to the way numbers are formatted. The lconv structure is organized as shown here: + + + +struct lconv { +char *decimal_point; + +char *thousands_sep; + +char *grouping; + + +/* decimal point character for nonmonetary values */ +/* thousands separator +for nonmonetary values */ +/* specifies grouping for +C h a p t e r 2 8 : T i m e , D a t e , a n d L o c a l i z a t i o n F u n c t i o n s 747 + + + + + +char *int_curr_symbol; +char *currency_symbol; + +nonmonetary values */ +/* international currency symbol */ +/* local currency symbol */ + +char *mon_decimal_point; /* decimal point character for monetary values */ +char *mon_thousands_sep; /* thousands separator for + + +char *mon_grouping; + +char *positive_sign; + +char *negative_sign; + +char int_frac_digits; + + + +char frac_digits; + + + +char p_cs_precedes; + + +char p_sep_by_space; + + +char n_cs_precedes; + + +char n_sep_by_space; + + + +char p_sign_posn; + +char n_sign_posn; + +} + +monetary values */ +/* specifies grouping for monetary values */ +/* positive value indicator for monetary values */ +/* negative value indicator for monetary values */ +/* number of digits displayed to the right of the decimal point for monetary values displayed using international format */ +/* number of digits displayed to the right of the decimal point for monetary values displayed using local format */ +/* 1 if currency symbol precedes positive value, 0 if currency symbol follows value */ +/* 1 if currency symbol is separated from value by a space, 0 otherwise */ +/* 1 if currency symbol precedes +a negative value, 0 if currency symbol follows value */ +/* 1 if currency symbol is separated from a negative value by a space, 0 if +currency symbol follows value */ /* indicates position of +positive value symbol */ /* indicates position of +negative value symbol */ + + + +The localeconv() function returns a pointer to the lconv structure. You must not alter the contents of this structure. Refer to your compiler's documentation for implementation-specific information relating to the lconv structure. +748 C + + : T h e C o m p l e t e R e f e r e n c e + + +A related function is setlocale() . + +localtime + + +#include +struct tm *localtime(const time_t *time); + + +The localtime() function returns a pointer to the broken-down form of time in the form of a tm structure. The time is represented in local time. The time value is usually obtained through a call to time() . +The structure used by localtime() to hold the broken-down time is statically allocated and is overwritten each time the function is called. If you wish to save the contents of the structure, you must copy it elsewhere. +Related functions are gmtime() , time() , and asctime() . + +mktime + + +#include +time_t mktime(struct tm *time); + + +The mktime() function returns the calendar-time equivalent of the broken-down time found in the structure pointed to by time. The elements tm_wday and tm_yday are set by the function, so they need not be defined at the time of the call. +If mktime() cannot represent the information as a valid calendar time, –1 is returned. Related functions are time() , gmtime() , asctime() , and ctime() . + +setlocale + + +#include +char *setlocale(int type, const char *locale); + + +The setlocale() function allows certain parameters that are sensitive to the geopolitical environment of a program's execution to be queried or set. If locale is null, setlocale() returns a pointer to the current localization string. Otherwise, setlocale() attempts to use the string specified by locale to set the locale parameters as specified by type. Refer to your compiler's documentation for the localization strings that it supports. +At the time of the call, type must be one of the following macros: +C h a p t e r 2 8 : T i m e , D a t e , a n d L o c a l i z a t i o n F u n c t i o n s 749 + + +LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME + +LC_ALL refers to all localization categories. LC_COLLATE affects the operation of the strcoll() function. LC_CTYPE alters the way the character functions work. LC_MONETARY determines the monetary format. LC_NUMERIC changes the decimal-point character for formatted input/output functions. Finally, LC_TIME determines the behavior of the strftime() function. +The setlocale() function returns a pointer to a string associated with the type parameter. +Related functions are localeconv() , time() , strcoll() , and strftime() . + +strftime + + +#include +size_t strftime(char *str, size_t maxsize, const char *fmt, const struct tm *time); + +The strftime() function places time and date information, along with other information, into the string pointed to by str according to the format commands found in the string pointed to by fmt and using the broken-down time time. A maximum of maxsize characters will be placed into str. +The strftime() function works a little like sprintf() in that it recognizes a set of format commands that begin with the percent sign (%) and places its formatted output into a string. The format commands are used to specify the exact way various time and date information is represented in str. Any other characters found in the format string are placed into str unchanged. The time and date displayed are in local time. The format commands are shown in the table below. Notice that many of the commands are case sensitive. +The strftime() function returns the number of characters placed in the string pointed to by str or zero if an error occurs. + + +Command + +%a +%A + +Replaced By + +Abbreviated weekday name +Full weekday name +750 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Command + +%b +%BFull month name %c +%d %H %I %j %m %M %p %S %U %w %W %x %X %y %Y %Z +%% + +Replaced By + +Abbreviated month name + + +Standard date and time string Day of month as a decimal (1-31) Hour (0-23) +Hour (1-12) +Day of year as a decimal (1-366) Month as decimal (1-12) Minute as decimal (0-59) +Locale's equivalent of AM or PM Second as decimal (0-61) +Week of year, Sunday being first day (0-53) Weekday as a decimal (0-6, Sunday being 0) Week of year, Monday being first day (0-53) Standard date string +Standard time string +Year in decimal without century (0-99) Year including century as decimal Time zone name +The percent sign + + +Related functions are time() , localtime() , and gmtime() . + +time + + +#include +time_t time(time_t *time); + + +The time() function returns the current calendar time of the system. If the system has no time, –1 is returned. +C h a p t e r 2 8 : T i m e , D a t e , a n d L o c a l i z a t i o n F u n c t i o n s 751 + + +The time() function can be called either with a null pointer or with a pointer to a variable of type time_t. If the latter is used, the variable will also be assigned the calendar time. +Related functions are localtime() , gmtime() , strftime() , and ctime() . + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 29 The Dynamic +Allocation Functions + + + + + + + + + + + +753 +754 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the dynamic allocation functions, which were inherited from the C language. At their core are the functions malloc() and free() . Each time malloc() is called, a portion of the remaining free memory is allocated. Each +T +time free() is called, memory is returned to the system. The region of free memory from which memory is allocated is called the heap. The prototypes for the dynamic allocation functions are in . A C program must use the header file stdlib.h. +All C++ compilers will include at least these four dynamic allocation functions: calloc() , malloc() , free() , realloc() . However, your compiler will almost certainly contain several variants on these functions to accommodate various options and environmental differences. You will want to refer to your compiler's documentation. +While C++ supports the dynamic allocation functions described here, you will typically not use them in a C++ program. The reason for this is that C++ provides the dynamic allocation operators new and delete. There are several advantages to using the dynamic allocation operators. First, new automatically allocates the correct amount of memory for the type of data being allocated. Second, it returns the correct type of pointer to that memory. Third, both new and delete can be overloaded. Since new and delete have advantages over the C-based dynamic allocation functions, their use is recommended for C++ programs. + +calloc + + +#include +void *calloc(size_t num, size_t size); + + +The calloc() function allocates memory the size of which is equal to num * size. That is, calloc() allocates sufficient memory for an array of num objects of size size. +The calloc() function returns a pointer to the first byte of the allocated region. If there is not enough memory to satisfy the request, a null pointer is returned. It is always important to verify that the return value is not null before attempting to use it. +Related functions are free() , malloc() , and realloc() . + +free + + +#include void free(void *ptr); + +The free() function returns the memory pointed to by ptr to the heap. This makes the memory available for future allocation. +It is imperative that free() only be called with a pointer that was previously allocated using one of the dynamic allocation system's functions (either malloc() or +C h a p t e r 2 9 : T h e D y n a m i c A l l o c a t i o n F u n c t i o n s 755 + + +calloc() ). Using an invalid pointer in the call most likely will destroy the memory management mechanism and cause a system crash. +Related functions are calloc() , malloc() , and realloc() . + +malloc + + +#include +void *malloc(size_t size); + + +The malloc() function returns a pointer to the first byte of a region of memory of size size that has been allocated from the heap. If there is insufficient memory in the heap to satisfy the request, malloc() returns a null pointer. It is always important to verify that the return value is not null before attempting to use it. Attempting to use a null pointer will usually result in a system crash. +Related functions are free() , realloc() , and calloc() . + +realloc + + +#include +void *realloc(void *ptr, size_t size); + + +The realloc() function changes the size of the previously allocated memory pointed to by ptr to that specified by size. The value of size may be greater or less than the original. A pointer to the memory block is returned because it may be necessary for realloc() to move the block in order to increase its size. If this occurs, the contents of the old block are copied into the new block—no information is lost. +If ptr is null, realloc() simply allocates size bytes of memory and returns a pointer to it. If size is zero, the memory pointed to by ptr is freed. +If there is not enough free memory in the heap to allocate size bytes, a null pointer is returned, and the original block is left unchanged. +Related functions are free() , malloc() , and calloc() . + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 30 Utility Functions + + + + + + + + + + + + + + +757 +758 C + + : T h e C o m p l e t e R e f e r e n c e + + +he standard function library defines several utility functions that provide various commonly used services. They include a number of conversions, variable-length argument processing, sorting and searching, and random number generation. +T +Many of the functions covered here require the use of the header . (A C program must use the header file stdlib.h.) In this header are defined div_t and ldiv_t, which are the types of values returned by div() and ldiv() , respectively. Also defined is the type size_t, which is the unsigned value returned by sizeof. The following macros are defined: + + +Macro + +NULL RAND_MAX + +EXIT_FAILURE + +EXIT_SUCCESS + +Meaning + +A null pointer. +The maximum value that can be returned by the rand() function. +The value returned to the calling process if program termination is unsuccessful. +The value returned to the calling process if program termination is successful. + + +If a function requires a different header than , that function description will discuss it. + +abort + + +#include void abort(void); + +The abort() function causes immediate abnormal termination of a program. Generally, no files are flushed. In environments that support it, abort() will return an implementation-defined value to the calling process (usually the operating system) indicating failure. +Related functions are exit() and atexit() . + +abs + + +#include int abs(int num); long abs(long num); +double abs(double num); +C h a p t e r 3 0 : U t i l i t y F u n c t i o n s 759 + + +The abs() function returns the absolute value of num. The long version of abs() is the same as labs() . The double version of abs() is the same as fabs() . +A related function is labs() . + +assert + + +#include void assert(int exp); + +The assert() macro, defined in its header , writes error information to stderr and then aborts program execution if the expression exp evaluates to zero. Otherwise, assert() does nothing. Although the exact output is implementation defined, many compilers use a message similar to this: + +Assertion failed: , file , line + +The assert() macro is generally used to help verify that a program is operating correctly, with the expression being devised in such a way that it evaluates to true only when no errors have taken place. +It is not necessary to remove the assert() statements from the source code once a program is debugged because if the macro NDEBUG is defined (as anything), the assert() macros will be ignored. +A related function is abort() . + +atexit + + +#include +int atexit(void (*func)(void)); + + +The atexit() function causes the function pointed to by func to be called upon normal program termination. The atexit() function returns zero if the function is successfully registered as a termination function, nonzero otherwise. +At least 32 termination functions may be established, and they will be called in the reverse order of their establishment. +Related functions are exit() and abort() . + +atof + + +#include +double atof(const char *str); +760 C + + : T h e C o m p l e t e R e f e r e n c e + + +The atof() function converts the string pointed to by str into a double value. The string must contain a valid floating-point number. If this is not the case, the returned value is undefined. +The number may be terminated by any character that cannot be part of a valid floating-point number. This includes white space, punctuation (other than periods), and characters other than E or e. This means that if atof() is called with "100.00HELLO", the value 100.00 will be returned. +Related functions are atoi() and atol() . + +atoi + + +#include +int atoi(const char *str); + + +The atoi() function converts the string pointed to by str into an int value. The string must contain a valid integer number. If this is not the case, the returned value is undefined; however, most implementations will return zero. +The number may be terminated by any character that cannot be part of an integer number. This includes white space, punctuation, and characters. This means that if atoi() is called with "123.23", the integer value 123 will be returned, and the ".23" is ignored. +Related functions are atof() and atol() . + +atol + + +#include +long atol(const char *str); + + +The atol() function converts the string pointed to by str into a long value. The string must contain a valid long integer number. If this is not the case, the returned value is undefined; however, most implementations will return zero. +The number may be terminated by any character that cannot be part of an integer number. This includes white space, punctuation, and characters. This means that if atol() is called with "123.23", the long integer value 123L will be returned, and the ".23" is ignored. +Related functions are atof() and atoi() . + +bsearch + + +#include +void *bsearch(const void *key, const void *buf, +C h a p t e r 3 0 : U t i l i t y F u n c t i o n s 761 + + + +size_t num, size_t size, +int (*compare)(const void *, const void *)); + + +The bsearch() function performs a binary search on the sorted array pointed to by buf and returns a pointer to the first member that matches the key pointed to by key. The number of elements in the array is specified by num, and the size (in bytes) of each element is described by size. +The function pointed to by compare is used to compare an element of the array with the key. The form of the compare function must be as follows: + +int func_name(const void *arg1, const void *arg2); + +It must return values as described in the following table: + + +Comparison + +arg1 is less than arg2 Arg1 is equal to arg2 +Arg1 is greater than arg2 + +Value Returned + +Less than zero Zero +Greater than zero + + +The array must be sorted in ascending order with the lowest address containing the lowest element. +If the array does not contain the key, a null pointer is returned. A related function is qsort() . + +div + + +#include +div_t div(int numerator, int denominator); ldiv_t div(long numerator, long denominator); + +The int version of div() function returns the quotient and the remainder of the operation numerator / denominator in a structure of type div_t. The long version of div() returns the quotient and remainder in a structure of type ldiv_t. The long version of div() provides the same capabilities as the ldiv() function. +The structure type div_t will have at least these two fields: + +int quot; /* quotient */ int rem; /* remainder */ +762 C + + : T h e C o m p l e t e R e f e r e n c e + + +The structure type ldiv_t will have at least these two fields: + +long quot; /* quotient */ long rem; /* remainder */ + +A related function is ldiv() . + +exit + +#include +void exit(int exit_code); + +The exit() function causes immediate, normal termination of a program. +The value of exit_code is passed to the calling process, usually the operating system, if the environment supports it. By convention, if the value of exit_code is zero, or EXIT_SUCCESS, normal program termination is assumed. A nonzero value, or EXIT_FAILURE, is used to indicate an implementation-defined error. +Related functions are atexit() and abort() . + +getenv + +#include +char *getenv(const char *name); + +The getenv() function returns a pointer to environmental information associated with the string pointed to by name in the implementation-defined environmental information table. The string returned must never be changed by the program. +The environment of a program may include such things as path names and devices online. The exact nature of this data is implementation defined. You will need to refer to your compiler's documentation for details. +If a call is made to getenv() with an argument that does not match any of the environment data, a null pointer is returned. +A related function is system() . + +labs + +#include long labs(long num); + +The labs() function returns the absolute value of num. A related function is abs() . +C h a p t e r 3 0 : U t i l i t y F u n c t i o n s 763 + + +ldiv + + +#include +ldiv_t ldiv(long numerator, long denominator); + + +The ldiv() function returns the quotient and the remainder of the operation numerator / denominator. +The structure type ldiv_t will have at least these two fields: + + +long quot; /* quotient */ long rem; /* remainder */ + +A related function is div() . longjmp + +#include +void longjmp(jmp_buf envbuf, int status); + +The longjmp() function causes program execution to resume at the point of the last call to setjmp() . These two functions provide a means of jumping between functions. Notice that the header is required. +The longjmp() function operates by resetting the stack to the state as described in envbuf, which must have been set by a prior call to setjmp() . This causes program execution to resume at the statement following the setjmp() invocation. That is, the computer is "tricked" into thinking that it never left the function that called setjmp() . (As a somewhat graphic explanation, the longjmp() function "warps" across time and (memory) space to a previous point in your program without having to perform the normal function return process.) +The buffer evnbuf is of type jmp_buf, which is defined in the header . The buffer must have been set through a call to setjmp() prior to calling longjmp() . +The value of status becomes the return value of setjmp() and may be interrogated to determine where the long jump came from. The only value that is not allowed is zero. +By far the most common use of longjmp() is to return from a deeply nested set of routines when an error occurs. +A related function is setjmp() . + +mblen + +#include +int mblen(const char *str, size_t size); +764 C + + : T h e C o m p l e t e R e f e r e n c e + + +The mblen() function returns the length (in bytes) of a multibyte character pointed to by str. Only the first size number of characters are examined. It returns –1 on error. +If str is null, then mblen() returns non-zero if multibyte characters have state-dependent encodings. If they do not, zero is returned. +Related functions are mbtowc() and wctomb() . + +mbstowcs + + +#include +size_t mbstowcs(wchar_t *out, const char *in, size_t size); + + +The mbstowcs() function converts the multibyte string pointed to by in into a wide character string and puts that result in the array pointed to by out. Only size number of bytes will be stored in out. +The mbstowcs() function returns the number of multibyte characters that are converted. If an error occurs, the function returns –1. +Related functions are wcstombs(), mbtowc(). + +mbtowc + + +#include +int mbtowc(wchar_t *out, const char *in, size_t size); + + +The mbtowc() function converts the multibyte character in the array pointed to by in into its wide character equivalent and puts that result in the object pointed to by out. Only size number of characters will be examined. +This function returns the number of bytes that are put into out. –1 is returned if an error occurs. If in is null, then mbtowc() returns non-zero if multibyte characters have state dependencies. If they do not, zero is returned. +Related functions are mblen(), wctomb() . + +qsort + + +#include +void qsort(void *buf, size_t num, size_t size, +int (*compare) (const void *, const void *)); +C h a p t e r 3 0 : U t i l i t y F u n c t i o n s 765 + + +The qsort() function sorts the array pointed to by buf using a Quicksort (developed by C.A.R. Hoare). The Quicksort is the best general-purpose sorting algorithm. Upon termination, the array will be sorted. The number of elements in the array is specified by num, and the size (in bytes) of each element is described by size. +The function pointed to by compare is used to compare an element of the array with the key. The form of the compare function must be as follows: + +int func_name(const void *arg1, const void *arg2); + +It must return values as described here: + + +Comparison + +arg1 is less than arg2 arg1 is equal to arg2 +arg1 is greater than arg2 + +Value Returned + +Less than zero Zero +Greater than zero + + +The array is sorted into ascending order with the lowest address containing the lowest element. +A related function is bsearch() . + +raise + + +#include +int raise(int signal); + + +The raise() function sends the signal specified by signal to the executing program. It returns zero if successful, and nonzero otherwise. It uses the header . +The following signals are defined by Standard C++. Of course, your compiler is free to provide additional signals. + + +Macro + +SIGABRT SIGFPE +SIGILL + +Meaning + +Termination error Floating-point error +Bad instruction +766 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Macro + +SIGINT SIGSEGV +SIGTERM + +Meaning + +User pressed CTRL-C Illegal memory access +Terminate program + + +A related function is signal() . + +rand + + +#include int rand(void); + +The rand() function generates a sequence of pseudorandom numbers. Each time it is called, an integer between zero and RAND_MAX is returned. +A related function is srand() . + +setjmp + + +#include +int setjmp(jmp_buf envbuf); + + +The setjmp() function saves the contents of the system stack in the buffer envbuf for later use by longjmp() . It uses the header . +The setjmp() function returns zero upon invocation. However, longjmp() passes an argument to setjmp() when it executes, and it is this value (always nonzero) that will appear to be the value of setjmp() after a call to longjmp() has occurred. +See longjmp for additional information. A related function is longjmp() . + +signal + + +#include +void (*signal(int signal, void (*func)(int))) (int); +C h a p t e r 3 0 : U t i l i t y F u n c t i o n s 767 + + +The signal() function registers the function pointed to by func as a handler for the signal specified by signal. That is, the function pointed to by func will be called when signal is received by your program. +The value of func may be the address of a signal handler function or one of the following macros, defined in : + + +Macro + +SIG_DFL +SIG_IGN + +Meaning + +Use default signal handling +Ignore the signal + + +If a function address is used, the specified handler will be executed when its signal is received. +On success, signal() returns the address of the previously defined function for the specified signal. On error, SIG_ERR (defined in ) is returned. +A related function is raise() . + +srand + + +#include +void srand(unsigned seed); + + +The srand() function is used to set a starting point for the sequence generated by rand() . (The rand() function returns pseudorandom numbers.) +srand() is generally used to allow multiple program runs to use different sequences of pseudorandom numbers by specifying different starting points. Conversely, you can also use srand() to generate the same pseudorandom sequence over and over again by calling it with the same seed before starting the sequence each time. +A related function is rand() . + +strtod + + +#include +double strtod(const char *start, char **end); +768 C + + : T h e C o m p l e t e R e f e r e n c e + + +The strtod() function converts the string representation of a number stored in the string pointed to by start into a double and returns the result. +The strtod() function works as follows. First, any white space in the string pointed to by start is stripped. Next, each character that comprises the number is read. Any character that cannot be part of a floating-point number will cause this process to stop. This includes white space, punctuation (other than periods), and characters other than E or e. Finally, end is set to point to the remainder, if any, of the original string. This means that if strtod() is called with "100.00 Pliers", the value 100.00 will be returned, and end will point to the space that precedes "Pliers". +If no conversion takes place, zero is returned. If overflow occurs, strtod() returns either HUGE_VAL or –HUGE_VAL (indicating positive or negative overflow), and the global variable errno is set to ERANGE, indicating a range error. If underflow occurs, then zero is returned and the global variable errno is set to ERANGE. +A related function is atof() . + +strtol + +#include +long strtol(const char *start, char **end, int radix); + +The strtol() function converts the string representation of a number stored in the string pointed to by start into a long and returns the result. The base of the number is determined by radix. If radix is zero, the base is determined by rules that govern constant specification. If radix is other than zero, it must be in the range 2 through 36. +The strtol() function works as follows. First, any white space in the string pointed to by start is stripped. Next, each character that comprises the number is read. Any character that cannot be part of a long integer number will cause this process to stop. This includes white space, punctuation, and characters. Finally, end is set to point to the remainder, if any, of the original string. This means that if strtol() is called with "100 Pliers", the value 100L will be returned, and end will point to the space that precedes "Pliers". +If the result cannot be represented by a long integer, strtol() returns either LONG_MAX or LONG_MIN and the global errno is set to ERANGE, indicating a range error. If no conversion takes place, zero is returned. +A related function is atol() . + +strtoul + +#include +unsigned long strtoul(const char *start, char **end, int radix); +C h a p t e r 3 0 : U t i l i t y F u n c t i o n s 769 + + +The strtoul() function converts the string representation of a number stored in the string pointed to by start into an unsigned long and returns the result. The base of the number is determined by radix. If radix is zero, the base is determined by rules that govern constant specification. If the radix is specified, it must be in the range 2 through 36. +The strtoul() function works as follows. First, any white space in the string pointed to by start is stripped. Next, each character that comprises the number is read. Any character that cannot be part of an unsigned long integer number will cause this process to stop. This includes white space, punctuation, and characters. Finally, end is set to point to the remainder, if any, of the original string. This means that if strtoul() is called with " 100 Pliers", the value 100L will be returned, and end will point to the space that precedes "Pliers". +If the result cannot be represented by an unsigned long integer, strtoul() returns ULONG_MAX and the global variable errno is set to ERANGE, indicating a range error. If no conversion takes place, zero is returned. +A related function is strtol() . + +system + + +#include +int system(const char *str); + + +The system() function passes the string pointed to by str as a command to the command processor of the operating system. +If system() is called with a null pointer, it will return nonzero if a command processor is present, and zero otherwise. (Some C++ code will be executed in dedicated systems that do not have operating systems and command processors, so you may not be able to assume that a command processor is present.) The return value of system() +is implementation defined. However, generally it will return zero if the command was successfully executed, and nonzero otherwise. +A related function is exit() . + +va_arg, va_start, and va_end + + +#include +type va_arg(va_list argptr, type); void va_end(va_list argptr); +void va_start(va_list argptr, last_parm); + + +The va_arg(), va_start() , and va_end() macros work together to allow a variable number of arguments to be passed to a function. The most common example of a +770 C + + : T h e C o m p l e t e R e f e r e n c e + + +function that takes a variable number of arguments is printf() . The type va_list is defined by . +The general procedure for creating a function that can take a variable number of arguments is as follows. The function must have at least one known parameter, but may have more, prior to the variable parameter list. The rightmost known parameter is called the last_parm. The name of last_parm is used as the second parameter in a call to va_start() . Before any of the variable-length parameters can be accessed, the argument pointer argptr must be initialized through a call to va_start() . After that, parameters are returned via calls to va_arg() , with type being the type of the next parameter. Finally, once all the parameters have been read and prior to returning from the function, a call to va_end() must be made to ensure that the stack is properly restored. If va_end() is not called, a program crash is very likely. +A related function is vprintf() . + +wcstombs + + +#include +size_t wcstombs(char *out, const wchar_t *in, size_t size); + + +The wcstombs() converts the wide-character array pointed to by in into its multibyte equivalent and puts the result in the array pointed to by out. Only the first size bytes of in are converted. Conversion stops before that if the null terminator is encountered. +If successful, wcstombs() returns the number of bytes converted. On failure, –1 is returned. +Related functions are wctomb() and mbstowcs() . + +wctomb + + +#include +int wctomb(char *out, wchar_t in); + + +The wctomb() converts the wide character in in into its multibyte equivalent and puts the result in the object pointed to by out. The array pointed to by out must be MB_CUR_MAX characters long. +If successful, wctomb() returns the number of bytes contained in the multibyte character. On failure, –1 is returned. +If out is null, then wctomb() returns nonzero if the multibyte character has state dependencies and zero if it is not. +Related functions are wcstombs() and mbtowc() . + +C++ + + + + +Chapter 31 The Wide-Character Functions + + + + + + + + + + + + + + +771 +772 C + + : T h e C o m p l e t e R e f e r e n c e + + +n 1995, a number of wide-character functions were added to Standard C and subsequently adopted by Standard C++. The wide-character functions operate on characters of type wchar_t, which are 16 bits. For the most part these functions +I +parallel their char equivalents. For example, the function iswspace() is the +wide-character version of isspace() . In general, the wide-character functions use the same names as their char equivalents, except that a "w" is added. +The wide-character functions use two headers: and . The C header files wchar.h and wctype.h are also supported. +The header defines the types wint_t, wctrans_t, and wctype_t. Many of the wide-character functions receive a wide character as a parameter. The type of this parameter is wint_t. It is capable of holding a wide character. The use of the wint_t type in the wide-character functions parallels the use of int in the char-based functions. wctrans_t and wctype_t are the types of objects used to represent a character mapping (i.e., character translation) and the classification of a character, respectively. The +wide-character EOF mark is defined as WEOF. +In addition to defining win_t, the header defines the type mstate_t. This type describes an object that holds the state of a multibyte-to-wide-character conversion. The header also defines the macros NULL, WEOF, WCHAR_MAX, and WCHAR_MIN. The last two define the maximum and minimum value that can be held in an object of type wchar_t. +Although the standard function library's support for wide characters is quite extensive, these functions are not frequently used. One reason for this is that the Standard C++ I/O system and class libraries provide both normal and wide-character support through the use of template classes. Also, interest in wide-character-compliant programs has been less than expected. Of course, this situation may change. +Since most of the wide-character functions simply parallel their char equivalents and are not frequently used by most C++ programmers, only a brief description of these functions is provided. + + +The Wide-Character Classification Functions The header provides the prototypes for the wide-character functions that support character classification. These functions categorize wide characters as to their +type or convert the case of a character. Table 31-1 lists these functions along with their char equivalents, which are described in Chapter 26. +In addition to the functions shown in Table 31-1, defines the following ones, which provide an open-ended means of classifying characters. + +wctype_t wctype(const char *attr); +int iswctype(wint_t ch, wctype_t attr_ob); + +The function wctype() returns a value that can be passed to the attr_ob parameter to iswctype() . The string pointed to by attr specifies a property that a character must +C h a p t e r 3 1 : T h e W i d e - C h a r a c t e r F u n c t i o n s 773 + + + + +Function + +int iswalnum(wint_t ch) int iswalpha(wint_t ch) int iswcntrl(wint_t ch) int iswdigit(wint_t ch) int iswgraph(wint_t ch) int iswlower(wint_t ch) int iswprint(wint_t ch) int iswpunct(wint_t c) int iswspace(wint_t ch) int iswupper(wint_t ch) int iswxdigit(wint_t ch) +wint_t tolower(wint_t ch) +wint_t toupper(wint_t ch) + +char Equivalent + +isalnum( ) isalpha( ) iscntrl( ) isdigit( ) isgraph( ) islower( ) isprint( ) ispunct( ) isspace( ) isupper( ) isxdigit( ) tolower( ) +toupper( ) + + + +Table 31-1. The Wide-Character Classification Functions + + + +have. The value in attr_ob used to determine if ch is a character that has that property. If it is, iswctype() returns nonzero. Otherwise, it returns zero. The following property strings are defined for all execution environments. + +alnum alpha cntrl digit graph lower print punct space upper xdigit + +The following program demonstrates the wctype() and iswctype() functions. + +#include #include using namespace std; + +int main() +774 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +wctype_t x; + +x = wctype("space"); + +if(iswctype(L' ', x)) +cout << "Is a space.\n"; + +return 0; } + + +This program displays "Is a space." +The functions wctrans() and towctrans() are also defined in . They are shown here: + +wctrans_t wctrans(const char *mapping); +wint_t towctrans(wint_t ch, wctrans_t mapping_ob); + +The function wctrans() returns a value that can be passed to the mapping_ob parameter to towctrans() . Here, the string pointed to by mapping specifies a mapping of one character to another. This value can then be used by iswctrans() to map ch. The mapped value is returned. The following mapping strings are supported in all execution environments. + +tolower toupper + +Here is a short example that demonstrates wctrans() and towctrans() . + +#include #include using namespace std; + +int main() { +wctrans_t x; + +x = wctrans("tolower"); +C h a p t e r 3 1 : T h e W i d e - C h a r a c t e r F u n c t i o n s 775 + + + + +wchar_t ch = towctrans(L'W', x); cout << (char) ch; + +return 0; } + +This program displays a lowercase "w". + + +The Wide-Character I/O Functions +Several of the I/O functions described in Chapter 25 have wide-character implementations. These functions are shown in Table 31-2. The wide-character I/O functions use the header . Notice that swprintf() and vswprintf() require an additional parameter not needed by their char equivalents. +In addition to those shown in the table, the following wide-character I/O function has been added: + +int fwide(FILE *stream, int how); + +If how is positive, fwide() makes stream a wide-character stream. If how is negative, fwide() makes stream into a char stream. If how is zero, the stream is unaffected. If the stream has already been oriented to either wide or normal characters, it will not be changed. The function returns positive if the stream uses wide characters, negative if the stream uses chars, and zero on failure. A stream's orientation is determined by its first use. + + +The Wide-Character String Functions +There are wide-character versions of the string manipulation functions described in Chapter 26. These are shown in Table 31-3. They use the header . Note that wcstok() requires an additional parameter not used by its char equivalent. + + +Wide-Character String Conversion Functions The functions shown in Table 31-4 provide wide-character versions of the standard numeric and time conversion functions. These functions use the header . +776 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Function + +win_t fgetwc(FILE *stream) +wchar_t *fgetws(wchar_t *str, int num, FILE *stream) +wint_t fputwc(wchar_t ch, FILE *stream) +int fputws(const wchar_t *str, FILE *stream) +int fwprintf(FILE *stream, const wchar_t fmt, ...) int fwscanf(FILE *stream, const wchar_t fmt, ...) wint_t getwc(FILE *stream) +wint_t getwchar( ) +wint_t putwc(wchar_t ch, FILE *stream) wint_t putwchar(wchar_t ch) +int swprintf(wchar_t *str, size_t num, const wchar_t *fmt, ...) + + + +int swscanf(const wchar_t *str, const wchar_t *fmt, ...) +wint_t ungetwc(wint_t ch, FILE *stream) +int vfwprintf(FILE *stream, +const wchar_t fmt, va_list arg) +int vswprintf(wchar_t *str, size_t num, +const wchar_t *fmt, va_list arg) + + + +int vwprintf(const wchar_t *fmt, va_list arg) int wprintf(const wchar_t *fmt, ...) +int wscanf(const wchar_t *fmt, ...) + +char Equivalent + +fgetc( ) fgets( ) + +fputc( ) fputs( ) fprintf( ) fscanf( ) getc( ) getchar( ) putc( ) putchar( ) +sprintf( ) +Note the addition of the parameter num, which limits the number of characters written to str. +sscanf( ) + +ungetc( ) vfprintf( ) + +vsprintf( ) +Note the addition of the parameter num, which limits the number of characters written to str. +vprintf( ) printf( ) +scanf( ) + + + +Table 31-2. The Wide-Character I/O Functions +C h a p t e r 3 1 : T h e W i d e - C h a r a c t e r F u n c t i o n s 777 + + + + +Function + +wchar_t *wcscat(wchar_t *str1, const wchar_t *str2) wchar_t *wcschr(const wchar_t *str, wchar_t ch) +int wcscmp(const wchar_t *str1, const wchar_t *str2) int wcscoll(const wchar_t *str1, const wchar_t *str2) +size_t wcscspn(const wchar_t *str1, const wchar_t *str2) +wchar_t *wcscpy(wchar_t *str1, const wchar_t *str2) size_t wcslen(const wchar_t *str) +wchar_t *wcsncpy(wchar_t *str1, const wchar_t str2, size_t num) +wchar_t *wcsncat(wchar_t *str1, const wchar_t str2, size_t num) +int wcsncmp(const wchar_t *str1, +const wchar_t *str2, size_t num) +wchar_t *wcspbrk(const wchar_t *str1, const wchar_t *str2) +wchar_t *wcsrchr(const wchar_t *str, wchar_t ch) +size_t wcsspn(const wchar_t *str1, const wchar_t str2) +wchar_t *wcstok(wchar_t *str1, const wchar_t *str2, wchar_t **endptr) + + + +wchar_t *wcsstr(const wchar_t *str1, const wchar_t *str2) +size_t wcsxfrm(wchar_t *str1, const wchar_t *str2, size_t num) + +char Equivalent + +strcat( ) strchr( ) strcmp( ) strcoll( ) strcspn( ) + +strcpy( ) strlen( ) strncpy( ) + +strncat( ) + +strncmp( ) + +strpbrk( ) + +strrchr( ) strspn( ) + +strtok( ) +Here, endptr is a pointer that holds information necessary to continue the tokenizing process. +strstr( ) + +strxfrm( ) + + + +Table 31-3. The Wide-Character String Functions +778 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Function +size_t wcsftime(wchar_t *str, size_t max, const wchar_t *fmt, const struct tm *ptr) +double wcstod(const wchar_t *start, wchar_t **end); +long wcstol(const wchar_t *start, wchar_t **end, int radix) +unsigned long wcstoul(const wchar_t *start, wchar_t **end, int radix) + +char Equivalent strftime( ) + + +strtod( ) + +strtol( ) + +strtoul( ) + + +Table 31-4. The Wide-Character Conversion Functions + + + +Wide-Character Array Functions +The standard character array-manipulation functions, such as memcpy() , also have wide-character equivalents. They are shown in Table 31-5. These functions use the header . + + + + +Function +wchar_t *wmemchr(const wchar_t *str, wchar_t ch, size_t num) +int wmemcmp(const wchar_t *str1, +const wchar_t *str2, size_t num) +wchar_t *wmemcpy(wchar_t *str1, +const wchar_t *str2, size_t num) +wchar_t *wmemmove(wchar_t *str1, +const wchar_t *str2, size_t num) +wchar_t *wmemset(wchar_t *str, wchar_t ch, size_t num) + +char Equivalent memchr( ) + +memcmp( ) + +memcpy( ) + + +memmove( ) + + +memset( ) + + + +Table 31-5. The Wide-Character Array Functions +C h a p t e r 3 1 : T h e W i d e - C h a r a c t e r F u n c t i o n s 779 + + +Multibyte/Wide-Character Conversion Functions +The Standard C++ function library supplies various functions that support conversions between multibyte and wide characters. These functions, shown in Table 31-6, use the header . Many of them are restartable versions of the normal multibyte functions. The restartable version utilizes the state information passed to it in a parameter of type mbstate_t. If this parameter is null, the function will provide its own mbstate_t object. + + + + +Function + +win_t btowc(int ch) + + + +size_t mbrlen(const char *str, size_t num, mbstate_t *state) + + + + + +size_t mbrtowc(wchar_t *out, +const char *in, size_t num, mbstate_t *state) + + + + + +int mbsinit(const mbstate_t *state) + +size_t mbsrtowcs(wchar_t *out, const char **in, size_t num, mbstate_t state) + +Description + +Converts ch into its wide-character equivalent and returns the result. Returns WEOF on error or if ch is not a one-byte, multibyte character. +Restartable version of mblen() as described by state. Returns a positive value that indicates the length of the next multibyte character. Zero is returned if the next character is null. A negative value is returned if an error occurs. +Restartable version of mbtowc() as described by state. Returns a positive value that indicates the length of the next multibyte character. Zero is returned if the next character is null. A negative value is returned if an error occurs. If an error occurs, the macro EILSEQ is assigned to errno. +Returns true if state represents an initial conversion state. +Restartable version of mbstowcs() as described by state. Also, mbsrtowcs() differs from mbstowcs() in that in is an indirect pointer to the source array. If an error occurs, the macro EILSEQ is assigned to errno. + + +Table 31-6. Wide-Character/Multibyte Conversion Functions +780 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Function + +size_t wcrtomb(char *out, wchar_t ch, mbstate_t *state) + + +size_t wcsrtombs(char *out, +const wchar_t **in, size_t num, mbstate_t *state) + + +int wctob(wint_t ch) + +Description + +Restartable version of wctomb() as described by state. If an error occurs, the macro EILSEQ is assigned to errno. +Restartable version of wcstombs() as described by state. Also, wcsrtombs() differs from wcstombs() in that in is an indirect pointer to the source array. If an error occurs, the macro EILSEQ is assigned to errno. +Converts ch into its one-byte, multibyte equivalent. It returns EOF on failure. + + +Table 31-6. Wide-Character/Multibyte Conversion Functions (continued) +Part IV The Standard C++ Class Library + + + + + + + + + +tandard C++ defines an extensive set of classes that provide support for a number of common activities, including I/O, +S +strings, and numeric processing. The class library is in addition to the function library described in Part Three. The class library forms a major portion of the C++ language and defines much of its character. Despite its size, the class library is easy to master because it is organized around object-oriented principles. + + + + + + + + + +781 +782 C + + : T h e C o m p l e t e R e f e r e n c e + + +The Standard C++ library is quite large and an in-depth description of all of its classes, features, attributes, and implementation details is beyond the scope of this book. (A full description of the class library would easily fill a large book!) However, while most of the class library is for general use, some of it is intended mostly for compiler developers, or those programmers implementing extensions or enhancements. Therefore, this section describes only those parts of the class library that are used in an application. If you will be using the library for specialized work, you will need to acquire a copy of the C++ standard that contains the technical description of the class library. + +C++ + + + + +Chapter 32 The Standard C++ I/O Classes + + + + + + + + + + + + + + +783 +784 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the Standard C++ I/O class library. As explained in Part Two, there are currently two versions of C++'s I/O library in common use. The first is the old-style library, which is not defined by Standard C++. The second is +T +the modern, templatized Standard C++ I/O system. Since the modern I/O library is essentially a superset of the old-style one, its is the only one described here. However, much of the information still applies to the older version. + +Note For an overview of C++ I/O, see Chapters 20 and 21. + +The I/O Classes +The Standard C++ I/O system is constructed from a rather complex system of template classes. These classes are shown here. + + +Class + +basic_ios + + +basic_streambuf basic_istream basic_ostream basic_iostream + +basic_filebuf basic_ifstream basic_ofstream basic_fstream + +basic_stringbuf basic_istringstream basic_ostringstream +basic_stringstream + +Purpose + +Provides general-purpose I/O operations + + +Low-level support for I/O Support for input operations Support for output operations +Support for input/output operations + + +Low-level support for file I/O Support for file input +Support for file output Support for file input/output + +Low-level support for string-based I/O Support for string-based input +Support for string-based output +Support for string-based input/output + + +Also part of the I/O class hierarchy is the non-template class ios_base. It provides definitions for various elements of the I/O system. +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 785 + + +The C++ I/O system is built upon two related but different template class hierarchies. The first is derived from the low-level I/O class called basic_streambuf. This class supplies the basic, low-level input and output operations, and provides the underlying support for the entire C++ I/O system. The classes basic_filebuf and basic_stringbuf are derived from basic_streambuf. Unless you are doing advanced I/O programming, you will not need to use basic_streambuf or its subclasses directly. +The class hierarchy that you will most commonly be working with is derived from basic_ios. This is a high-level I/O class that provides formatting, error-checking, and status information related to stream I/O. basic_ios is used as a base for several derived classes, including basic_istream, basic_ostream, and basic_iostream. These classes are used to create streams capable of input, output, and input/output, respectively. Specifically, from basic_istream are derived the classes basic_ifstream and basic_istringstream, from basic_ostream are derived basic_ofstream and basic_ostringstream, and from basic_iostream are derived basic_fstream and basic_stringstream. A base class for basic_ios is ios_base. Thus, any class derived from basic_ios has access to the members of ios_base. +The I/O classes are parameterized for the type of characters that they act upon and for the traits associated with those characters. For example, here is the template specification for basic_ios: + +template > class basic_ios: public ios_base + +Here, CharType specifies the type of character (such as char or wchar_t) and Attr specifies a type that describes its attributes. The generic type char_traits is a utility class that defines the attributes associated with a character. +As explained in Chapter 20, the I/O library creates two specializations of the template class hierarchies just described: one for 8-bit characters and one for wide characters. Here is a complete list of the mapping of template class names to their character and wide-character versions. + + +Template Class + +basic_ios + + +basic_istream basic_ostream +basic_iostream + +Character-Based Class +ios + + +istream ostream +iostream + +Wide-Character-Based Class +wios + + +wistream wostream +wiostream +786 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Template Class +basic_ifstream basic_ofstream basic_fstream + +basic_istringstream basic_ostringstream basic_stringstream + +basic_streambuf basic_filebuf +basic_stringbuf + +Character-Based Class +ifstream ofstream fstream + +istringstream ostringstream stringstream + +streambuf filebuf +stringbuf + +Wide-Character-Based Class +wifstream wofstream wfstream + +wistringstream wostringstream wstringstream + +wstreambuf wfilebuf +wstringbuf + + +Since the vast majority of programmers will be using character-based I/O, those are the names used by this chapter. Thus, when referring to the I/O classes, we will simply use their character-based names rather than their internal, template names. For instance, this chapter will use the name ios rather than basic_ios, istream rather than basic_istream, and fstream rather than basic_fstream. Remember, parallel functions exist for wide-character streams and they work in the same way as those described here. + + +The I/O Headers +The Standard C++ I/O system relies upon several headers. They are shown here. + + +Header + + + + +For + +File I/O +Parameterized I/O manipulators Basic I/O support +Forward declarations used by the I/O system General I/O +Basic input support +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 787 + + + + +Header + + + + +For + +Basic output support String-based streams +Low-level I/O support + + +Several of these headers are used internally by the I/O system. In general, your program will only include , , , or . + + +The Format Flags and I/O Manipulators Each stream has associated with it a set of format flags that control the way +information is formatted. The ios_base class declares a bitmask enumeration called fmtflags in which the following values are defined. + + +adjustfield fixed +left showbase +unitbuf + +basefield floatfield oct showpoint +uppercase + +boolalpha hex +right +showpos + +dec internal scientific +skipws + + +These values are used to set or clear the format flags, using functions such as setf() and unsetf() . A detailed description of these flags is found in Chapter 20. +In addition to setting or clearing the format flags directly, you may alter the format parameters of a stream through the use of special functions called manipulators, which can be included in an I/O expression. The standard manipulators are shown in the following table: + + +Manipulator + +boolalpha dec +endl + +ends fixed +flush + +Purpose + +Turns on boolapha flag. Turns on dec flag. +Output a newline character and flush the stream. +Output a null. Turns on fixed flag. +Flush a stream. + +Input/Output + +Input/Output Input/Output Output + +Output Output +Output +788 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Manipulator + +hex internal left +noboolalpha noshowbase noshowpoint noshowpos noskipws nounitbuf nouppercase oct +resetiosflags (fmtflags f) + +right scientific +setbase(int base) setfill(int ch) setiosflags(fmtflags f) setprecision (int p) + +setw(int w) showbase showpoint showpos skipws unitbuf uppercase +ws + +Purpose + +Turns on hex flag. Turns on internal flag. Turns on left flag. +Turns off boolalpha flag. Turns off showbase flag. Turns off showpoint flag. Turns off showpos flag. Turns off skipws flag. Turns off unitbuf flag. Turns off uppercase flag. Turns on oct flag. +Turn off the flags specified in f. +Turns on right flag. Turns on scientific flag. +Set the number base to base. Set the fill character to ch. Turn on the flags specified in f. +Set the number of digits of precision. +Set the field width to w. Turns on showbase flag. Turns on showpoint flag. Turns on showpos flag. Turns on skipws flag. Turns on unitbuf flag. Turns on uppercase flag. +Skip leading white space. + +Input/Output + +Input/Output Output Output Input/Output Output Output Output +Input Output Output +Input/Output Input/Output + +Output Output Input/Output Output Input/output Output + +Output Output Output Output Input Output Output +Input + + +To use a manipulator that takes a parameter, you must include . +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 789 + + +Several Data Types +In addition to the fmtflags type just described, the Standard C++ I/O system defines several other types . + +The streamsize and streamoff Types +An object of type streamsize is capable of holding the largest number of bytes that will +be transferred in any one I/O operation. It is typically some form of integer. An object of type streamoff is capable of holding a value that indicates an offset position within a stream. It is typically some form of integer. These types are defined in the header , which is automatically included by the I/O system. + +The streampos and wstreampos Types +An object of type streampos is capable of holding a value that represents a position within a char stream. The wstreampos type is capable of holding a value that represents a position with a wchar_t stream. These are defined in , which is automatically included by the I/O system. + +The pos_type and off_type Types +The types pos_type and off_type create objects (typically integers) that are capable of holding a value that represents the position and an offset, respectively, within a stream. These types are defined by ios (and other classes) and are essentially the same as streamoff and streampos (or their wide-character equivalents). + +The openmode Type +The type openmode is defined by ios_base and describes how a file will be opened. It will be one or more of these values. + +app Append to end of file. +ate Seek to end of file on creation. binary Open file for binary operations. in Open file for input. +out Open file for output. +trunc Erase previously existing file. + +You can combine two or more of these values by ORing them together. +790 C + + : T h e C o m p l e t e R e f e r e n c e + + +The iostate Type +The current status of an I/O stream is described by an object of type iostate, which is an enumeration defined by ios_base that includes these members. + + +Name + +goodbit eofbit failbit +badbit + +Meaning + +No errors occurred. +End-of-file is encountered. +A nonfatal I/O error has occurred. +A fatal I/O error has occurred. + + +The seekdir type +The seekdir type describes how a random-access file operation will take place. It is defined within ios_base. Its valid values are shown here. + +beg Beginning-of-file cur Current location end End-of-file + +The failure Class +In ios_base is defined the exception type failure. It serves as a base class for the types of exceptions that can be thrown by the I/O system. It inherits exception (the standard exception class). The failure class has the following constructor: + +explicit failure(const string &str); + +Here, str is a message that describes the error. This message can be obtained from a failure object by calling its what() function, shown here: + +virtual const char *what( ) const throw( ); + + +Overload << and >> Operators +The following classes overload the << and/or >> operators relative to all of the built-in data types. +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 791 + + +basic_istream basic_ostream basic_iostream + +Any classes derived from these classes inherit these operators. + + +The General-Purpose I/O Functions +The remainder of this chapter describes the general-purpose I/O functions supplied by Standard C++. As explained, the Standard C++ I/O system is built upon an intricate hierarchy of template classes. Many of the members of the low-level classes are not used for application programming. Thus, they are not described here. + +bad + + +#include bool bad() const; + +The bad() function is a member of ios. +The bad() function returns true if a fatal I/O error has occurred in the associated stream; otherwise, false is returned. +A related function is good() . + +clear + + +#include +void clear(iostate flags = goodbit); + + +The clear() function is a member of ios. +The clear() function clears the status flags associated with a stream. If flags is goodbit (as it is by default), then all error flags are cleared (reset to zero). Otherwise, the status flags will be set to whatever value is specified in flags. +A related function is rdstate() . + +eof + + +#include bool eof() const; +792 C + + : T h e C o m p l e t e R e f e r e n c e + + +The eof() function is a member of ios. +The eof() function returns true when the end of the associated input file has been encountered; otherwise it returns false. +Related functions are bad() , fail() , good() , rdstate() , and clear() . + +exceptions + + +#include +iostate exceptions() const; void exceptions(iostate flags); + +The exceptions() function is a member of ios. +The first form returns an iostate object that indicates which flags cause an exception. The second form sets these values. +A related function is rdstate() . + +fail + + +#include bool fail() const; + +The fail() function is a member of ios. +The fail() function returns true if an I/O error has occurred in the associated stream. Otherwise, it returns false. +Related functions are good() , eof() , bad() , clear() , and rdstate() . + +fill + + +#include char fill() const; char fill(char ch); + +The fill() function is a member of ios. +By default, when a field needs to be filled, it is filled with spaces. However, you can specify the fill character using the fill() function and specifying the new fill character in ch. The old fill character is returned. +To obtain the current fill character, use the first form of fill() , which returns the current fill character. +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 793 + + +Related functions are precision() and width() . + +flags + + +#include fmtflags flags() const; fmtflags flags(fmtflags f); + +The flags() function is a member of ios (inherited from ios_base). +The first form of flags() simply returns the current format flags settings of the associated stream. +The second form of flags() sets all format flags associated with a stream as specified by f. When you use this version, the bit pattern found in f is copied into the format flags associated with the stream. This version also returns the previous settings. +Related functions are unsetf() and setf() . + +flush + + +#include ostream &flush(); + +The flush() function is a member of ostream. +The flush() function causes the buffer connected to the associated output stream to be physically written to the device. The function returns a reference to its associated stream. +Related functions are put() and write() . + +fstream, ifstream, and ofstream + + +#include fstream(); +explicit fstream(const char *filename, +ios::openmode mode = ios::in | ios::out); ifstream(); +explicit ifstream(const char *filename, ios::openmode mode=ios::in); + +ofstream(); +explicit ofstream(const char *filename, +ios::openmode mode=ios::out | ios::trunc); +794 C + + : T h e C o m p l e t e R e f e r e n c e + + +The fstream() , ifstream() , and ofstream() functions are the constructors of the fstream, ifstream, and ofstream classes, respectively. +The versions of fstream() , ifstream() , and ofstream() that take no parameters create a stream that is not associated with any file. This stream can then be linked to a file using open() . +The versions of fstream() , ifstream() , and ofstream() that take a filename for their first parameters are the most commonly used in application programs. Although it is entirely proper to open a file using the open() function, most of the time you will not do so because these ifstream, ofstream, and fstream constructor functions automatically open the file when the stream is created. The constructor functions have the same parameters and defaults as the open() function. (See open for details.) For instance, this is the most common way you will see a file opened: + +ifstream mystream("myfile"); + +If for some reason the file cannot be opened, the value of the associated stream variable will be false. Therefore, whether you use a constructor function to open the file or an explicit call to open() , you will want to confirm that the file has actually been opened by testing the value of the stream. +Related functions are close() and open() . + +gcount + + +#include streamsize gcount() const; + +The gcount() function is a member of istream. +The gcount() function returns the number of characters read by the last input operation. +Related functions are get() , getline() , and read() . + +get + + +#include int get(); +istream &get(char &ch): +istream &get(char *buf, streamsize num); +istream &get(char *buf, streamsize num, char delim); istream &get(streambuf &buf); +istream &get(streambuf &buf, char delim); +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 795 + + +The get() function is a member of istream. +In general, get() reads characters from an input stream. The parameterless form of get() reads a single character from the associated stream and returns that value. +get(char &ch) reads a character from the associated stream and puts that value in ch. It returns a reference to the stream. +get(char *buf, streamsize num) reads characters into the array pointed to by buf until either num−1 characters have been read, a newline is found, or the end of the file has been encountered. The array pointed to by buf will be null terminated by get() . If the newline character is encountered in the input stream, it is not extracted. Instead, it remains in the stream until the next input operation. This function returns a reference to the stream. +get(char *buf, streamsize num, char delim) reads characters into the array pointed to by buf until either num−1 characters have been read, the character specified by delim has been found, or the end of the file has been encountered. The array pointed to by buf will be null terminated by get( ). If the delimiter character is encountered in the input stream, it is not extracted. Instead, it remains in the stream until the next input operation. This function returns a reference to the stream. +get(streambuf &buf) reads characters from the input stream into the streambuf object. Characters are read until a newline is found or the end of the file is encountered. It returns a reference to the stream. If the newline character is encountered in the input stream, it is not extracted. +get(streambuf &buf, char delim) reads characters from the input stream into the streambuf object. Characters are read until the character specified by delim is found or the end of the file is encountered. It returns a reference to the stream. If the delimiter character is encountered in the input stream, it is not extracted. +Related functions are put() , read() , and getline() . + +getline + + +#include +istream &getline(char *buf, streamsize num); +istream &getline(char *buf, streamsize num, char delim); + + +The getline() function is a member of istream. +getline(char *buf, streamsize num) reads characters into the array pointed to by buf until either num−1 characters have been read, a newline character has been found, or the end of the file has been encountered. The array pointed to by buf will be null terminated by getline() . If the newline character is encountered in the input stream, it is extracted but is not put into buf. This function returns a reference to the stream. +getline(char *buf, streamsize num, char delim) reads characters into the array pointed to by buf until either num−1 characters have been read, the character specified by delim has been found, or the end of the file has been encountered. The array pointed +796 C + + : T h e C o m p l e t e R e f e r e n c e + + +to by buf will be null terminated by getline() . If the delimiter character is encountered in the input stream, it is extracted but is not put into buf. This function returns a reference to the stream. +Related functions are get() and read() . + +good + + +#include bool good() const; + +The good() function is a member of ios. +The good() function returns true if no I/O errors have occurred in the associated stream; otherwise, it returns false. +Related functions are bad() , fail() , eof() , clear() , and rdstate() . + +ignore + + +#include +istream &ignore(streamsize num = 1, int delim = EOF); + + +The ignore() function is a member of istream. +You can use the ignore() member function to read and discard characters from the input stream. It reads and discards characters until either num characters have been ignored (1 by default) or until the character specified by delim is encountered (EOF by default). If the delimiting character is encountered, it is removed from the input stream. The function returns a reference to the stream. +Related functions are get() and getline() . + +open + + +#include +void fstream::open(const char *filename, +ios::openmode mode = ios::in | ios:: out); void ifstream::open(const char *filename, +ios::openmode mode = ios::in); void ofstream::open(const char *filename, +ios::openmode mode = ios:: out | ios::trunc); +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 797 + + +The open() function is a member of fstream, ifstream, and ofstream. +A file is associated with a stream by using the open() function. Here, filename is the name of the file, which may include a path specifier. The value of mode determines how the file is opened. It must be one (or more) of these values: + +ios::app ios::ate ios::binary ios::in ios::out ios::trunc + +You can combine two or more of these values by ORing them together. +Including ios::app causes all output to that file to be appended to the end. This value can only be used with files capable of output. Including ios::ate causes a seek to the end of the file to occur when the file is opened. Although ios::ate causes a seek to the end-of-file, I/O operations can still occur anywhere within the file. +The ios::binary value causes the file to be opened for binary I/O operations. By default, files are opened in text mode. +The ios::in value specifies that the file is capable of input. The ios::out value specifies that the file is capable of output. However, creating an ifstream stream implies input, and creating an ofstream stream implies output, and opening a file using fstream implies both input and output. +The ios::trunc value causes the contents of a preexisting file by the same name to be destroyed, and the file is truncated to zero length. +In all cases, if open() fails, the stream will be false. Therefore, before using a file, you should test to make sure that the open operation succeeded. +Related functions are close() , fstream() , ifstream() , and ofstream() . + +peek + + +#include int peek(); + +The peek() function is a member of istream. +The peek() function returns the next character in the stream or EOF if the end of the file is encountered. It does not, under any circumstances, remove the character from the stream. +A related function is get() . +798 C + + : T h e C o m p l e t e R e f e r e n c e + + +precision + + +#include streamsize precision() const; +streamsize precision(streamsize p); + + +The precision() function is a member of ios (inherited from ios_base). +By default, six digits of precision are displayed when floating-point values are output. However, using the second form of precision(), you can set this number to the value specified in p. The original value is returned. +The first version of precision() returns the current value. Related functions are width() and fill() . + +put + + +#include ostream &put(char ch); + +The put() function is a member of ostream. +The put() function writes ch to the associated output stream. It returns a reference to the stream. +Related functions are write() and get() . + +putback + + +#include istream &putback(char ch); + +The putback() function is a member of istream. +The putback() function returns ch to the associated input stream. A related function is peek() . + +rdstate + + +#include iostate rdstate() const; +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 799 + + +The rdstate() function is a member of ios. +The rdstate() function returns the status of the associated stream. The C++ I/O system maintains status information about the outcome of each I/O operation relative to each active stream. The current state of a stream is held in an object of type iostate, in which the following flags are defined: + + +Name + +goodbit eofbit failbit +badbit + +Meaning + +No errors occurred. +End-of-file is encountered. +A nonfatal I/O error has occurred. +A fatal I/O error has occurred. + + +These flags are enumerated inside ios (via ios_base). +rdstate() returns goodbit when no error has occurred; otherwise, an error bit has been set. +Related functions are eof() , good() , bad() , clear() , setstate() , and fail() . + +read + + +#include +istream &read(char *buf, streamsize num); + + +The read() function is a member of istream. +The read() function reads num bytes from the associated input stream and puts them in the buffer pointed to by buf. If the end of the file is reached before num characters have been read, read() simply stops, sets failbit, and the buffer contains as many characters as were available. (See gcount() .) read() returns a reference +to the stream. +Related functions are gcount() , readsome() , get() , getline() , and write() . + +readsome + + +#include +streamsize readsome(char *buf, streamsize num); + + +The readsome() function is a member of istream. +The readsome() function reads num bytes from the associated input stream and puts them in the buffer pointed to by buf. If the stream contains less than num +800 C + + : T h e C o m p l e t e R e f e r e n c e + + +characters, that number of characters are read. readsome() returns the number of characters read. The difference between read() and readsome() is that readsome() does not set the failbit if there are less than num characters available. +Related functions are gcount() , read() , and write() . + +seekg and seekp + + +#include +istream &seekg(off_type offset, ios::seekdir origin) istream &seekg(pos_type position); + +ostream &seekp(off_type offset, ios::seekdir origin); ostream &seekp(pos_type position); + +The seekg() function is a member of istream, and the seekp() function is a member of ostream. +In C++'s I/O system, you perform random access using the seekg() and seekp() functions. To this end, the C++ I/O system manages two pointers associated with a file. One is the get pointer, which specifies where in the file the next input operation will occur. The other is the put pointer, which specifies where in the file the next output operation will occur. Each time an input or an output operation takes place, the appropriate pointer is automatically sequentially advanced. However, using the seekg() and seekp() functions, it is possible to access the file in a nonsequential fashion. +The two-parameter version of seekg() moves the get pointer offset number of bytes from the location specified by origin. The two-parameter version of seekp() moves the put pointer offset number of bytes from the location specified by origin. The offset parameter is of type off_type, which is capable of containing the largest valid value that offset can have. +The origin parameter is of type seekdir and is an enumeration that has these values: + + +ios::beg ios::cur +ios::end + +Seek from beginning +Seek from current position +Seek from end + + +The single-parameter versions of seekg() and seekp() move the file pointers to the location specified by position. This value must have been previously obtained using a call to either tellg() or tellp() , respectively. pos_type is a type that is capable of containing the largest valid value that position can have. These functions return a reference to the associated stream. +Related functions are tellg() and tellp() . +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 801 + + +setf + + +#include +fmtflags setf(fmtflags flags); +fmtflags setf(fmtflags flags1, fmtflags flags2); + + +The setf() function is a member of ios (inherited from ios_base). +The setf() function sets the format flags associated with a stream. See the discussion of format flags earlier in this section. +The first version of setf() turns on the format flags specified by flags. (All other flags are unaffected.) For example, to turn on the showpos flag for cout, you can use this statement: + + +cout.setf(ios::showpos); + +When you want to set more than one flag, you can OR together the values of the flags you want set. +It is important to understand that a call to setf() is done relative to a specific stream. There is no concept of calling setf() by itself. Put differently, there is no concept in C++ of global format status. Each stream maintains its own format status information individually. +The second version of setf() affects only the flags that are set in flags2. The corresponding flags are first reset and then set according to the flags specified by flags1. Even if flags1 contains other set flags, only those specified by flags2 will be affected. +Both versions of setf() return the previous settings of the format flags associated with the stream. +Related functions are unsetf() and flags() . + +setstate + + +#include +void setstate(iostate flags) const; + + +The setstate() function is a member of ios. +The setstate() function sets the status of the associated stream as described by flags. See rdstate() for further details. +Related functions are clear() and rdstate() . +802 C + + : T h e C o m p l e t e R e f e r e n c e + + +str + + +#include string str() const; void str(string &s) + +The str() function is a member of stringstream, istringstream, and ostringstream. The first form of the str() function returns a string object that contains the current +contents of the string-based stream. +The second form frees the string currently contained in the string stream and substitutes the string referred to by s. +Related functions are get() and put() . + +stringstream, istringstream, ostringstream + + +#include +explicit stringstream(ios::openmode mode = ios::in | ios::out); explicit stringstream(const string &str, +ios::openmode mode = ios::in | ios::out); explicit istringstream(ios::openmode mode=ios::in); +explicit istringstream(const string str, ios::openmode mode=ios::in); explict ostringstream(ios::openmode mode=ios::out); +explict ostringstream(const string str, ios::openmode mode=ios::out); + +The stringstream() , istringstream() , and ostringstream() functions are the constructors of the stringstream, istringstream, and ostringstream classes, respectively. These construct streams that are tied to strings. +The versions of stringstream() , istringstream() , and ostringstream() that specify only the openmode parameter create empty streams. The versions that take a string parameter initialize the string stream. +Here is an example that demonstrates the use of a string stream. + +// Demonstrate string streams. #include +#include using namespace std; +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 803 + + + +int main() { +stringstream s("This is initial string."); + +// get string +string str = s.str(); cout << str << endl; + +// output to string stream +s << "Numbers: " << 10 << " " << 123.2; + +int i; double d; +s >> str >> i >> d; +cout << str << " " << i << " " << d; + +return 0; } + +The output produced by this program is shown here: + +This is initial string. Numbers: 10 123.2 + +A related function is str() . + +sync_with_stdio + + +#include +bool sync_with_stdio(bool sync = true ); + + +The sync_with_stdio() function is a member of ios (inherited from ios_base). Calling sync_with_stdio() allows the standard C-like I/O system to be safely used +concurrently with the C++ class-based I/O system. To turn off stdio synchronization, pass false to sync_with_stdio(). The previous setting is returned: true for synchronized; false for no synchronization. By default, the standard streams are synchronized. This function is reliable only if called prior to any other I/O operations. +804 C + + : T h e C o m p l e t e R e f e r e n c e + + +tellg and tellp + + +#include pos_type tellg(); pos_type tellp(): + +The tellg() function is a member of istream, and tellp() is a member of ostream. The C++ I/O system manages two pointers associated with a file. One is the get +pointer, which specifies where in the file the next input operation will occur. The other is the put pointer, which specifies where in the file the next output operation will occur. Each time an input or an output operation takes place, the appropriate pointer is automatically sequentially advanced. You can determine the current position of the get pointer using tellg() and of the put pointer using tellp() . +pos_type is a type that is capable of holding the largest value that either function can return. +The values returned by tellg() and tellp() can be used as parameters to seekg() and seekp() , respectively. +Related functions are seekg() and seekp() . + +unsetf + + +#include +void unsetf(fmtflags flags); + + +The unsetf() function is a member of ios (inherited from ios_base). The unsetf() function is used to clear one or more format flags. +The flags specified by flags are cleared. (All other flags are unaffected.) Related functions are setf() and flags() . + +width + + +#include streamsize width() const; +streamsize width(streamsize w); + + +The width() function is a member of ios (inherited from ios_base). +C h a p t e r 3 2 : T h e S t a n d a r d C + + I / O C l a s s e s 805 + + +To obtain the current field width, use the first form of width() . It returns the current field width. To set the field width, use the second form. Here, w becomes the field width, and the previous field width is returned. +Related functions are precision() and fill() . + +write + + +#include +ostream &write(const char *buf, streamsize num); + + +The write() function is a member of ostream. +The write() function writes num bytes to the associated output stream from the buffer pointed to by buf. It returns a reference to the stream. +Related functions are read() and put() . + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 33 The STL Container Classes + + + + + + + + + + + + + + +807 +808 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the classes that implement the containers defined by the standard template library (STL). Containers are the part of the STL that provide storage for other objects. In addition to supplying the memory necessary to store +T +objects, they define the mechanisms by which the objects in the container may be accessed. Thus, containers are high-level storage devices. + +Note For an overview and tutorial to the STL, refer to Chapter 24. +In the container descriptions, the following conventions will be observed. When referring to the various iterator types generically, this book will use the terms listed here. + + +Term + +BiIter ForIter InIter OutIter +RandIter + +Represents + +Bidirectional iterator Forward iterator Input iterator Output iterator +Random access iterator + + +When a unary predicate function is required, it will be notated using the type UnPred. When a binary predicate is required, the type BinPred will be used. In a binary predicate, the arguments are always in the order of first,second relative to the function that calls the predicate. For both unary and binary predicates, the arguments will contain values of the type of objects being stored by the container. +Comparison functions will be notated using the type Comp. +One other point: In the descriptions that follow, when an iterator is said to point to the end of a container, this means that the iterator points just beyond the last object in the container. + + +The Container Classes +The containers defined by the STL are shown here. + + +Container + +bitset deque +list + +Description + +A set of bits. +A double-ended queue. +A linear list. + +Required Header + + + +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 809 + + + + +Container + +map + + + +multimap + + + +multiset + + +priority_queue queue +set + +stack +vector + +Description + +Stores key/value pairs in which each key is associated with only one value. +Stores key/value pairs in which one key may be associated with two or more values. +A set in which each element is not necessarily unique. +A priority queue. A queue. +A set in which each element is unique. +A stack. +A dynamic array. + +Required Header + + + + + + + + + + + + + + + + + + +Each of the containers is summarized in the following sections. Since the containers are implemented using template classes, various placeholder data types are used. In the descriptions, the generic type T represents the type of data stored by a container. +Since the names of the placeholder types in a template class are arbitrary, the container classes declare typedefed versions of these types. This makes the type names concrete. Here are the typedef names used by the container classes. + + +size_type reference const_reference difference_type iterator const_iterator reverse_iterator +const_reverse_iterator + +Some integral type roughly equivalent to size_t. A reference to an element. +A const reference to an element. +Can represent the difference between two addresses. An iterator. +A const iterator. A reverse iterator. +A const reverse iterator. +810 C + + : T h e C o m p l e t e R e f e r e n c e + + + +value_type + +allocator_type key_type key_compare mapped_type + +value_compare value_type + +pointer const_pointer +container_type + +The type of a value stored in a container. (Same as the generic type T.) +The type of the allocator. The type of a key. +The type of a function that compares two keys. +The type of value stored in a map. (Same as the generic type T.) +The type of a function that compares two values. +The type of the values being operated upon. (Same as the generic type T.) +The type of a pointer. +The type of a const pointer. +The type of a container. + + +bitset +The bitset class supports operations on a set of bits. Its template specification is + +template class bitset; + +Here, N specifies the length of the bitset, in bits. It has the following constructors: + +bitset( ); + +bitset(unsigned long bits); + +explicit bitset(const string &s, size_t i = 0, size_t num = npos); + +The first form constructs an empty bitset. The second form constructs a bitset that has its bits set according to those specified in bits. The third form constructs a bitset using the string s, beginning at i. The string must contain only 1's and 0's. Only num or s.size( )-i values are used, whichever is less. The constant npos is a value that is sufficiently large to describe the maximum length of s. + +The output operators << and >> are defined for bitset. + +bitset contains the following member functions. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 811 + + + + +Member + +bool any( ) const; + +size_type count( ) const; bitset &flip( ); + +bitset &flip(size_t i); + +bool none( ) const; + +bool operator !=(const bitset &op2) const; + +bool operator ==(const bitset &op2) const; + +bitset +&operator &=(const bitset &op2); + + +bitset +&operator ^=(const bitset &op2); + + +bitset +&operator |=(const bitset &op2); + + +bitset &operator ~=( ) const; + +bitset &operator <<=(size_t num); + + +bitset &operator >>=(size_t num); + +Description + +Returns true if any bit in the invoking bitset is 1; otherwise returns false. +Returns the number of 1 bits. +Reverses the state of all bits in the invoking bitset and returns *this. +Reverses the bit in position i in the invoking bitset and returns *this. +Returns true if no bits are set in the invoking bitset. +Returns true if the invoking bitset differs from the one specified by right-hand operator, op2. +Returns true if the invoking bitset is the same as the one specified by right-hand operator, op2. +ANDs each bit in the invoking bitset with the corresponding bit in op2 and leaves the result in the invoking bitset. It returns *this. +XORs each bit in the invoking bitset with the corresponding bit in op2 and leaves the result in the invoking bitset. It returns *this. +ORs each bit in the invoking bitset with the corresponding bit in op2 and leaves the result in the invoking bitset. It returns *this. +Reverses the state of all bits in the invoking bitset and returns the result. +Left-shifts each bit in the invoking bitset num positions and leaves the result in the invoking bitset. It returns *this. +Right-shifts each bit in the invoking bitset num positions and leaves the result in the invoking bitset. It returns *this. +812 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +reference operator [ ](size_type i); + +bitset &reset( ); + +bitset &reset(size_t i); + +bitset &set( ); + +bitset &set(size_t i, int val = 1); + + + +size_t size( ) const; + +bool test(size_t i) const; string to_string( ) const; + + +unsigned long to_ulong( ) const; + +Description + +Returns a reference to bit i in the invoking bitset. +Clears all bits in the invoking bitset and returns *this. +Clears the bit in position i in the invoking bitset and returns *this. +Sets all bits in the invoking bitset and returns *this. +Sets the bit in position i to the value specified by val in the invoking bitset and returns *this. Any nonzero value for val is assumed to be 1. +Returns the number of bits that the bitset can hold. +Returns the state of the bit in position i. +Returns a string that contains a representation of the bit pattern in the invoking bitset. +Converts the invoking bitset into an unsigned long integer. + + +deque +The deque class supports a double-ended queue. Its template specification is + +template > class deque + +Here, T is the type of data stored in the deque. It has the following constructors: + +explicit deque(const Allocator &a = Allocator( ) ); + +explicit deque(size_type num, const T &val = T ( ), const Allocator &a = Allocator( )); + +deque(const deque &ob); +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 813 + + +template deque(InIter start, InIter end, const Allocator &a = Allocator( )); + +The first form constructs an empty deque. The second form constructs a deque that has num elements with the value val. The third form constructs a deque that contains the same elements as ob. The fourth form constructs a deque that contains the elements in the range specified by start and end. +The following comparison operators are defined for deque: + +==, <, <=, !=, >, >= + +deque contains the following member functions. + + +Member + +template +void assign(InIter start, InIter end); +void assign(size_type num, const T &val); + +reference at(size_type i); const_reference at(size_type i) const; +reference back( ); const_reference back( ) const; +iterator begin( ); const_iterator begin( ) const; +void clear( ); +bool empty( ) const; + +const_iterator end( ) const; iterator end( ); +iterator erase(iterator i); + + +iterator erase(iterator start, iterator end); + + +reference front( ); const_reference front( ) const; + +Description + +Assigns the deque the sequence defined by start and end. +Assigns the deque num elements of value val. +Returns a reference to the element specified by i. +Returns a reference to the last element in the deque. +Returns an iterator to the first element in the deque. +Removes all elements from the deque. +Returns true if the invoking deque is empty and false otherwise. +Returns an iterator to the end of the deque. +Removes the element pointed to by i. Returns an iterator to the element after the one removed. +Removes the elements in the range start to end. Returns an iterator to the element after the last element removed. +Returns a reference to the first element in the deque. +814 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +allocator_type get_allocator( ) const; +iterator insert(iterator i, const T &val); + +void insert(iterator i, size_type num, const T &val); +template void insert(iterator i, +InIter start, InIter end); +size_type max_size( ) const; + +reference operator[ ](size_type i); const_reference +operator[ ](size_type i) const; +void pop_back( ); void pop_front( ); +void push_back(const T &val); + +void push_front(const T &val); + + +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +reverse_iterator rend( ); const_reverse_iterator rend( ) const; +void resize(size_type num, T val = T ( )); + + + +size_type size( ) const; + +void swap(deque &ob); + +Description + +Returns deque's allocator. +Inserts val immediately before the element specified by i. An iterator to the element is returned. +Inserts num copies of val immediately before the element specified by i. +Inserts the sequence defined by start and end immediately before the element specified by i. +Returns the maximum number of elements that the deque can hold. +Returns a reference to the ith element. + + +Removes the last element in the deque. Removes the first element in the deque. +Adds an element with the value specified by val to the end of the deque. +Adds an element with the value specified by val to the front of the deque. +Returns a reverse iterator to the end of the deque. +Returns a reverse iterator to the start of the deque. +Changes the size of the deque to that specified by num. If the deque must be lengthened, then elements with the value specified by val are added to the end. +Returns the number of elements currently in the deque. +Exchanges the elements stored in the invoking deque with those in ob. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 815 + + +list +The list class supports a list. Its template specification is + +template > class list + +Here, T is the type of data stored in the list. It has the following constructors: + +explicit list(const Allocator &a = Allocator( ) ); + +explicit list(size_type num, const T &val = T ( ), const Allocator &a = Allocator( )); + +list(const list &ob); + +template list(InIter start, InIter end, const Allocator &a = Allocator( )); + +The first form constructs an empty list. The second form constructs a list that has num elements with the value val. The third form constructs a list that contains the same elements as ob. The fourth form constructs a list that contains the elements in the range specified by start and end. +The following comparison operators are defined for list: + +==, <, <=, !=, >, >= + +list contains the following member functions. + + +Member + +Template +void assign(InIter start, InIter end); +Void assign(size_type num, const T &val); + +reference back( ); const_reference back( ) const; +iterator begin( ); const_iterator begin( ) const; + +Description + +Assigns the list the sequence defined by start and end. +Assigns the list num elements of value val. +Returns a reference to the last element in the list. +Returns an iterator to the first element in the list. +816 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +void clear( ); +bool empty( ) const; + +iterator end( ); const_iterator end( ) const; +iterator erase(iterator i); + + +iterator erase(iterator start, iterator end); + + + +reference front( ); const_reference front( ) const; +allocator_type get_allocator( ) const; +iterator insert(iterator i, +const T &val = T( )); + +void insert(iterator i, size_type num, const T & val); +template void insert(iterator i, +InIter start, InIter end); +size_type max_size( ) const; + +void merge(list &ob); template +void merge( &ob, Comp cmpfn); + + + +void pop_back( ); +void pop_front( ); + +Description + +Removes all elements from the list. +Returns true if the invoking list is empty and false otherwise. +Returns an iterator to the end of the list. +Removes the element pointed to by i. Returns an iterator to the element after the one removed. +Removes the elements in the range start to end. Returns an iterator to the element after the last element removed. +Returns a reference to the first element in the list. +Returns list's allocator. +Inserts val immediately before the element specified by i. An iterator to the element is returned. +Inserts num copies of val immediately before the element specified by i. +Inserts the sequence defined by start and end immediately before the element specified by i. +Returns the maximum number of elements that the list can hold. +Merges the ordered list contained in ob with the ordered invoking list. The result is ordered. After the merge, the list contained in ob is empty. In the second form, a comparison function can be specified that determines when one element is less than another. +Removes the last element in the list. +Removes the first element in the list. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 817 + + + + +Member + +void push_back(const T &val); + +void push_front(const T &val); + +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +void remove(const T &val); + +template void remove_if(UnPred pr); +reverse_iterator rend( ); const_reverse_iterator rend( ) const; +void resize(size_type num, T val = T ( )); + + + +void reverse( ); size_type size( ) const; + +void sort( ); +template void sort(Comp cmpfn); + +void splice(iterator i, +list &ob); + +void splice(iterator i, +list &ob, iterator el); + +void splice(iterator i, +list &ob, iterator start, iterator end); + +Description + +Adds an element with the value specified by val to the end of the list. +Adds an element with the value specified by val to the front of the list. +Returns a reverse iterator to the end of the list. +Removes elements with the value val from the list. +Removes elements for which the unary predicate pr is true. +Returns a reverse iterator to the start of the list. +Changesthesizeofthelisttothat specifiedbynum.Ifthelistmustbe lengthened,thenelementswiththevalue specifiedbyvalareaddedtotheend. +Reverses the invoking list. +Returns the number of elements currently in the list. +Sorts the list. The second form sorts the list using the comparison function cmpfn to determine when one element is less than another. +The contents of ob are inserted into the invoking list at the location pointed to by i. After the operation, ob is empty. +The element pointed to by el is removed from the list ob and stored in the invoking list at the location pointed to by i. +The range defined by start and end is removed from ob and stored in the invoking list beginning at the location pointed to by i. +818 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +void swap(list &ob); + +void unique( ); +template void unique(BinPred pr); + +Description + +Exchanges the elements stored in the invoking list with those in ob. +Removes duplicate elements from the invoking list. The second form uses pr to determine uniqueness. + + +map +The map class supports an associative container in which unique keys are mapped with values. Its template specification is shown here: + +template , class Allocator = allocator> class map + +Here, Key is the data type of the keys, T is the data type of the values being stored (mapped), and Comp is a function that compares two keys. It has the following constructors: + +explicit map(const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( ) ); + +map(const map &ob); + +template map(InIter start, InIter end, const Comp &cmpfn = Comp( ), +const Allocator &a = Allocator( )); + +The first form constructs an empty map. The second form constructs a map that contains the same elements as ob. The third form constructs a map that contains the elements in the range specified by start and end. The function specified by cmpfn, if present, determines the ordering of the map. +The following comparison operators are defined for map. + +==, <, <=, !=, >, >= + +The member functions contained by map are shown here. In the descriptions, key_type is the type of the key, and value_type represents pair. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 819 + + + + +Member + +iterator begin( ); const_iterator begin( ) const; +void clear( ); +size_type count(const key_type &k) const; + +bool empty( ) const; + +iterator end( ); const_iterator end( ) const; +pair equal_range(const key_type &k); +pair equal_range(const key_type &k) const; +void erase(iterator i); +void erase(iterator start, iterator end); + +size_type erase(const key_type &k); + +iterator find(const key_type &k); const_iterator find(const key_type &k) +const; + +allocator_type get_allocator( ) const; +iterator insert(iterator i, +const value_type &val); + +template +void insert(InIter start, InIter end); +pair +insert(const value_type &val); + +Description + +Returns an iterator to the first element in the map. +Removes all elements from the map. +Returns the number of times k occurs in the map (1 or zero). +Returns true if the invoking map is empty and false otherwise. +Returns an iterator to the end of the map. +Returns a pair of iterators that point to the first and last elements in the map that contain the specified key. + +Removes the element pointed to by i. +Removes the elements in the range start to end. +Removes from the map elements that have keys with the value k. +Returns an iterator to the specified key. If the key is not found, then an iterator to the end of the map is returned. +Returns map's allocator. +Inserts val at or after the element specified by i. An iterator to the element is returned. +Inserts a range of elements. + +Inserts val into the invoking map. An iterator to the element is returned. The element is only inserted if it does not already exist. If the element was inserted, pair is returned. Otherwise, pair is returned. +820 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +key_compare key_comp( ) const; + +iterator lower_bound(const key_type &k); const_iterator +lower_bound(const key_type &k) const; +size_type max_size( ) const; + +reference operator[ ](const key_type &i); + + +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +reverse_iterator rend( ); const_reverse_iterator rend( ) const; +size_type size( ) const; + +void swap(map &ob); +iterator upper_bound(const key_type &k); const_iterator +upper_bound(const key_type &k) const; +value_compare value_comp( ) const; + +Description + +Returns the function object that compares keys. +Returns an iterator to the first element in the map with the key equal to or greater than k. +Returns the maximum number of elements that the map can hold. +Returns a reference to the element specified by i. If this element does not exist, it is inserted. +Returns a reverse iterator to the end of the map. +Returns a reverse iterator to the start of the map. +Returns the number of elements currently in the map. +Exchanges the elements stored in the invoking map with those in ob. +Returns an iterator to the first element in the map with the key greater than k. +Returns the function object that compares values. + + +multimap +The multimap class supports an associative container in which possibly nonunique keys are mapped with values. Its template specification is shown here: + +template , class Allocator = allocator> class multimap + +Here, Key is the data of the keys, T is the data type of the values being stored (mapped), and Comp is a function that compares two keys. It has the following constructors: +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 821 + + +explicit multimap(const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( ) ); + +multimap(const multimap &ob); + +template multimap(InIter start, InIter end, const Comp &cmpfn = Comp( ), +const Allocator &a = Allocator( )); + +The first form constructs an empty multimap. The second form constructs a multimap that contains the same elements as ob. The third form constructs a multimap that contains the elements in the range specified by start and end. The function specified by cmpfn, if present, determines the ordering of the multimap. +The following comparison operators are defined by multimap: + +==, <, <=, !=, >, >= + +The member functions contained by multimap are shown here. In the descriptions, key_type is the type of the key, T is the value, and value_type represents pair. + + +Member + +iterator begin( ); const_iterator begin( ) const; +void clear( ); + +size_type count(const key_type &k) const; + +bool empty( ) const; + +iterator end( ); const_iterator end( ) const; +pair equal_range(const key_type &k); +pair equal_range(const key_type &k) const; +void erase(iterator i); +void erase(iterator start, iterator end); + +Description + +Returns an iterator to the first element in the multimap. +Removes all elements from the multimap. +Returns the number of times k occurs in the multimap. +Returns true if the invoking multimap is empty and false otherwise. +Returns an iterator to the end of the list. +Returns a pair of iterators that point to the first and last elements in the multimap that contain the specified key. +Removes the element pointed to by i. +Removes the elements in the range start to end. +822 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +size_type erase(const key_type &k); + + +iterator find(const key_type &k); const_iterator find(const key_type &k) +const; + +allocator_type get_allocator( ) const; +iterator insert(iterator i, +const value_type &val); + +template +void insert(InIter start, InIter end); +iterator insert(const value_type &val); + +key_compare key_comp( ) const; + +iterator lower_bound(const key_type &k); const_iterator +lower_bound(const key_type &k) const; +size_type max_size( ) const; + +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +reverse_iterator rend( ); const_reverse_iterator rend( ) const; +size_type size( ) const; + +void swap(multimap &ob); +iterator upper_bound(const key_type &k); const_iterator +upper_bound(const key_type &k) const; +value_compare value_comp( ) const; + +Description + +Removes from the multimap elements that have keys with the value k. +Returns an iterator to the specified key. If the key is not found, then an iterator to the end of the multimap is returned. +Returns multimap's allocator. +Inserts val at or after the element specified by i. An iterator to the element is returned. +Inserts a range of elements. + +Inserts val into the invoking multimap. +Returns the function object that compares keys. +Returns an iterator to the first element in the multimap with the key equal to or greater than k. +Returns the maximum number of elements that the multimap can hold. +Returns a reverse iterator to the end of the multimap. +Returns a reverse iterator to the start of the multimap. +Returns the number of elements currently in the multimap. +Exchanges the elements stored in the invoking multimap with those in ob. +Returns an iterator to the first element in the multimap with the key greater than k. +Returns the function object that compares values. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 823 + + +multiset +The multiset class supports a set containing possibly nonunique keys. Its template specification is shown here: + +template , +class Allocator = allocator> class multiset + +Here, Key is the data of the keys and Comp is a function that compares two keys. It has the following constructors: + +explicit multiset(const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( ) ); + +multiset(const multiset &ob); + +template multiset(InIter start, InIter end, const Comp &cmpfn = Comp( ), +const Allocator &a = Allocator( )); + +The first form constructs an empty multiset. The second form constructs a multiset that contains the same elements as ob. The third form constructs a multiset that contains the elements in the range specified by start and end. The function specified by cmpfn, if present, determines the ordering of the set. +The following comparison operators are defined for multiset. + +==, <, <=, !=, >, >= + +The member functions contained by multiset are shown here. In the descriptions, both key_type and value_type are typedefs for Key. + + +Member + +iterator begin( ); const_iterator begin( ) const; +void clear( ); + +size_type count(const key_type &k) const; + +bool empty( ) const; + +Description + +Returns an iterator to the first element in the multiset. +Removes all elements from the multiset. +Returns the number of times k occurs in the multiset. +Returns true if the invoking multiset is empty and false otherwise. +824 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +iterator end( ); const_iterator end( ) const; +pair equal_range(const key_type &k) const; + +void erase(iterator i); +void erase(iterator start, iterator end); + +size_type erase(const key_type &k); + +iterator find(const key_type &k) const; + + + +allocator_type get_allocator( ) const; +iterator insert(iterator i, +const value_type &val); + +template +void insert(InIter start, InIter end); +iterator insert(const value_type &val); + +key_compare key_comp( ) const; + +iterator lower_bound(const key_type &k) const; + +size_type max_size( ) const; + +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +reverse_iterator rend( ); const_reverse_iterator rend( ) const; + +Description + +Returns an iterator to the end of the multiset. +Returns a pair of iterators that point to the first and last elements in the multiset that contain the specified key. +Removes the element pointed to by i. +Removes the elements in the range start to end. +Removes from the multiset elements that have keys with the value k. +Returns an iterator to the specified key. If the key is not found, then an iterator to the end of the multiset is returned. +Returns multiset's allocator. +Inserts val at or after the element specified by i. An iterator to the element is returned. +Inserts a range of elements. + +Inserts val into the invoking multiset. An iterator to the element is returned. +Returns the function object that compares keys. +Returns an iterator to the first element in the multiset with the key equal to or greater than k. +Returns the maximum number of elements that the multiset can hold. +Returns a reverse iterator to the end of the multiset. +Returns a reverse iterator to the start of the multiset. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 825 + + + + +Member + +size_type size( ) const; + +void swap(multiset &ob); +iterator upper_bound(const key_type &k) const; + +value_compare value_comp( ) const; + +Description + +Returns the number of elements currently in the multiset. +Exchanges the elements stored in the invoking multiset with those in ob. +Returns an iterator to the first element in the multiset with the key greater than k. +Returns the function object that compares values. + + +queue +The queue class supports a single-ended queue. Its template specification is shown here: + +template > class queue + +Here, T is the type of data being stored and Container is the type of container used to hold the queue. It has the following constructor: + +explicit queue(const Container &cnt = Container( )); + +The queue() constructor creates an empty queue. By default it uses a deque as a container, but a queue can only be accessed in a first-in, first-out manner. You can also use a list as a container for a queue. The container is held in a protected object called c of type Container. +The following comparison operators are defined for queue: + +==, <, <=, !=, >, >= + +queue contains the following member functions. + + +Member + +value_type &back( ); +const value_type &back( ) const; +bool empty( ) const; + +Description + +Returns a reference to the last element in the queue. +Returns true if the invoking queue is empty and false otherwise. +826 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +value_type &front( ); +const value_type &front( ) const; +void pop( ); +void push(const T &val); + +size_type size( ) const; + +Description + +Returns a reference to the first element in the queue. +Removes the first element in the queue. +Adds an element with the value specified by val to the end of the queue. +Returns the number of elements current in the queue. + + +priority_queue +The priority_queue class supports a single-ended priority queue. Its template specification is shown here: + +template , +class Comp = less> class priority_queue + +Here, T is the type of data being stored. Container is the type of container used to hold the queue, and Comp specifies the comparison function that determines when one member for the priority queue is lower in priority than another. It has the following constructors: + +explicit priority_queue(const Comp &cmpfn = Comp( ), Container &cnt = Container( )); + +template priority_queue(InIter start, InIter end, const Comp &cmpfn = Comp( ), +Container &cnt = Container( )); + +The first priority_queue() constructor creates an empty priority queue. The second creates a priority queue that contains the elements specified by the range start and end. By default it uses a vector as a container. You can also use a deque as a container for a priority queue. The container is held in a protected object called c of type Container. +priority_queue contains the following member functions. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 827 + + + + +Member + +bool empty( ) const; + +void pop( ); +void push(const T &val); size_type size( ) const; + +const value_type &top( ) const; + +Description + +Returns true if the invoking priority queue is empty and false otherwise. +Removes the first element in the priority queue. Adds an element to the priority queue. +Returns the number of elements current in the priority queue. +Returns a reference to the element with the highest priority. The element is not removed. + + +set +The set class supports a set containing unique keys. Its template specification is shown here: + +template , +class Allocator = allocator> class set + +Here, Key is the data of the keys and Comp is a function that compares two keys. It has the following constructors: + +explicit set(const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( ) ); + +set(const set &ob); + +template set(InIter start, InIter end, const Comp &cmpfn = Comp( ), +const Allocator &a = Allocator( )); + +The first form constructs an empty set. The second form constructs a set that contains the same elements as ob. The third form constructs a set that contains the elements in the range specified by start and end. The function specified by cmpfn, if present, determines the ordering of the set. +The following comparison operators are defined for set: + +==, <, <=, !=, >, >= +828 C + + : T h e C o m p l e t e R e f e r e n c e + + +The member functions contained by set are shown here. + + +Member + +iterator begin( ); const_iterator begin( ) const; +void clear( ); +size_type count(const key_type &k) const; + +bool empty( ) const; + +const_iterator end( ) const; iterator end( ); +pair equal_range(const key_type &k) const; + +void erase(iterator i); +void erase(iterator start, iterator end); + +size_type erase(const key_type &k); + + + +iterator find(const key_type &k) const; + + + +allocator_type get_allocator( ) const; +iterator insert(iterator i, +const value_type &val); + + +template +void insert(InIter start, InIter end); + +Description + +Returns an iterator to the first element in the set. +Removes all elements from the set. +Returns the number of times k occurs in the set. +Returns true if the invoking set is empty and false otherwise. +Returns an iterator to the end of the set. +Returns a pair of iterators that point to the first and last elements in the set that contain the specified key. +Removes the element pointed to by i. +Removes the elements in the range start to end. +Removes from the set elements that have keys with the value k. The number of elements removed is returned. +Returns an iterator to the specified key. If the key is not found, then an iterator to the end of the set is returned. +Returns set's allocator. +Inserts val at or after the element specified by i. Duplicate elements are not inserted. An iterator to the element is returned. +Inserts a range of elements. Duplicate elements are not inserted. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 829 + + + + +Member + +pair +insert(const value_type &val); + + + + + +iterator lower_bound(const key_type &k) const; + +key_compare key_comp( ) const; + +size_type max_size( ) const; + +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +reverse_iterator rend( ); const_reverse_iterator rend( ) const; +size_type size( ) const; + +void swap(set &ob); + +iterator upper_bound(const key_type &k) const; + +value_compare value_comp( ) const; + +Description + +Inserts val into the invoking set. An iterator to the element is returned. The element is inserted only if it does not already exist. If the element was inserted, pair is returned. Otherwise, pair is returned. +Returns an iterator to the first element in the set with the key equal to or greater than k. +Returns the function object that compares keys. +Returns the maximum number of elements that the set can hold. +Returns a reverse iterator to the end of the set. +Returns a reverse iterator to the start of the set. +Returns the number of elements currently in the set. +Exchanges the elements stored in the invoking set with those in ob. +Returns an iterator to the first element in the set with the key greater than k. +Returns the function object that compares values. + + +stack +The stack class supports a stack. Its template specification is shown here: + +template > class stack +830 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here, T is the type of data being stored and Container is the type of container used to hold the queue. It has the following constructor: + +explicit stack(const Container &cnt = Container( )); + +The stack() constructor creates an empty stack. By default it uses a deque as a container, but a stack can only be accessed in a last-in, first-out manner. You may also use a vector or list as a container for a stack. The container is held in a protected member called c of type Container. +The following comparison operators are defined for stack: + +==, <, <=, !=, >, >= + +stack contains the following member functions. + + +Member + +bool empty( ) const; + +void pop( ); + + +void push(const T &val); + + +size_type size( ) const; + +value_type &top( ); +cont value_type &top( ) const; + +Description + +Returns true if the invoking stack is empty and false otherwise. +Removes the top of the stack, which is technically the last element in the container. +Pushes an element onto the end of the stack. The last element in the container represents the top of the stack. +Returns the number of elements currently in the stack. +Returns a reference to the top of the stack, which is the last element in the container. The element is not removed. + + +vector +The vector class supports a dynamic array. Its template specification is shown here. + +template > class vector + +Here, T is the type of data being stored and Allocator specifies the allocator. It has the following constructors. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 831 + + +explicit vector(const Allocator &a = Allocator( ) ); + +explicit vector(size_type num, const T &val = T ( ), const Allocator &a = Allocator( )); + +vector(const vector &ob); + +template vector(InIter start, InIter end, const Allocator &a = Allocator( )); + +The first form constructs an empty vector. The second form constructs a vector that has num elements with the value val. The third form constructs a vector that contains the same elements as ob. The fourth form constructs a vector that contains the elements in the range specified by start and end. +The following comparison operators are defined for vector: + +==, <, <=, !=, >, >= + +vector contains the following member functions. + + +Member + +template +void assign(InIter start, InIter end); +void assign(size_type num, const T &val); + +reference at(size_type i); const_reference at(size_type i) const; +reference back( ); const_reference back( ) const; +iterator begin( ); const_iterator begin( ) const; +size_type capacity( ) const; + + + +void clear( ); +bool empty( ) const; + +Description + +Assigns the vector the sequence defined by start and end. +Assigns the vector num elements of value val. +Returns a reference to an element specified by i. +Returns a reference to the last element in the vector. +Returns an iterator to the first element in the vector. +Returns the current capacity of the vector. This is the number of elements it can hold before it will need to allocate more memory. +Removes all elements from the vector. +Returns true if the invoking vector is empty and false otherwise. +832 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +iterator end( ); const_iterator end( ) const; +iterator erase(iterator i); + + +iterator erase(iterator start, iterator end); + + + +reference front( ); const_reference front( ) const; +allocator_type get_allocator( ) const; iterator insert(iterator i, const T &val); + + +void insert(iterator i, size_type num, const T & val); +template +void insert(iterator i, InIter start, InIter end); +size_type max_size( ) const; + +reference operator[ ](size_type i) const; const_reference operator[ ](size_type i) +const; +void pop_back( ); + +void push_back(const T &val); + + +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +reverse_iterator rend( ); const_reverse_iterator rend( ) const; + +Description + +Returns an iterator to the end of the vector. +Removes the element pointed to by i. Returns an iterator to the element after the one removed. +Removes the elements in the range start to end. Returns an iterator to the element after the last element removed. +Returns a reference to the first element in the vector. +Returns vector's allocator. +Inserts val immediately before the element specified by i. An iterator to the element is returned. +Inserts num copies of val immediately before the element specified by i. +Inserts the sequence defined by start and end immediately before the element specified by i. +Returns the maximum number of elements that the vector can hold. +Returns a reference to the element specified by i. + +Removes the last element in the vector. +Adds an element with the value specified by val to the end of the vector. +Returns a reverse iterator to the end of the vector. +Returns a reverse iterator to the start of the vector. +C h a p t e r 3 3 : T h e S T L C o n t a i n e r C l a s s e s 833 + + + + +Member + +void reserve(size_type num); + +void resize(size_type num, T val = T ( )); + + + + +size_type size( ) const; + +void swap(vector &ob); + +Description + +Sets the capacity of the vector so that it is equal to at least num. +Changes the size of the vector to that specified by num. If the vector must be lengthened, then elements with +the value specified by val are added to the end. +Returns the number of elements currently in the vector. +Exchanges the elements stored in the invoking vector with those in ob. + + +The STL also contains a specialization of vector for Boolean values. It includes all of the functionality of vector and adds these two members. + + +void flip( ); +static void swap(reference i, reference j); + +Reverses all bits in the vector. +Exchanges the bits specified by i and j. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 34 The STL Algorithms + + + + + + + + + + + + + + +835 +836 C + + : T h e C o m p l e t e R e f e r e n c e + + +he algorithms defined by the standard template library are described here. These algorithms operate on containers through iterators. All of the algorithms are template functions. Here are descriptions of the generic type names used by the +T +algorithms. + + +Generic Name BiIter +ForIter InIter OutIter RandIter T +Size Func +Generator BinPred UnPred +Comp + +Represents Bidirectional iterator Forward iterator Input iterator Output iterator +Random access iterator Some type of data Some type of integer Some type of function +A function that generates objects Binary predicate +Unary predicate +Comparison function + + +adjacent_find + +template +ForIter adjacent_find(ForIter start, ForIter end); template +ForIter adjacent_find(ForIter start, ForIter end, BinPred pfn); + +The adjacent_find() algorithm searches for adjacent matching elements within a sequence specified by start and end and returns an iterator to the first element. If no adjacent pair is found, end is returned. The first version looks for equivalent elements. The second version lets you specify your own method for determining matching elements. + +binary_search + +template +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 837 + + + +bool binary_search(ForIter start, ForIter end, const T &val); template +bool binary_search(ForIter start, ForIter end, const T &val, Comp cmpfn); + +The binary_search() algorithm performs a binary search on an ordered sequence beginning at start and ending with end for the value specified by val. It returns true if the val is found and false otherwise. The first version compares the elements in the specified sequence for equality. The second version allows you to specify your own comparison function. + +copy + +template +OutIter copy(InIter start, InIter end, OutIter result); + +The copy() algorithm copies a sequence beginning at start and ending with end, putting the result into the sequence pointed to by result. It returns a pointer to the end of the resulting sequence. The range to be copied must not overlap with result. + +copy_backward + +template +BiIter2 copy_backward(BiIter1 start, BiIter1 end, BiIter2 result); + +The copy_backward() algorithm is the same as copy() except that it moves the elements from the end of the sequence first. + +count + +template +size_t count(InIter start, InIter end, const T &val); + +The count() algorithm returns the number of elements in the sequence beginning at start and ending at end that match val. +838 C + + : T h e C o m p l e t e R e f e r e n c e + + +count_if + +template +size_t count(InIter start, InIter end, UnPred pfn); + +The count_if() algorithm returns the number of elements in the sequence beginning at start and ending at end for which the unary predicate pfn returns true. + +equal + +template +bool equal(InIter1 start1, InIter1 end1, InIter2 start2); template +bool equal(InIter1 start1, InIter1 end1, InIter2 start2, BinPred pfn); + +The equal() algorithm determines if two ranges are the same. The range determined by start1 and end1 is tested against the sequence pointed to by start2. If the ranges are the same, true is returned. Otherwise, false is returned. +The second form allows you to specify a binary predicate that determines when two elements are equal. + +equal_range + +template +pair equal_range(ForIter start, ForIter end, const T &val); +template +pair equal_range(ForIter start, ForIter end, const T &val, Comp cmpfn); + +The equal_range() algorithm returns a range in which an element can be inserted into a sequence without disrupting the ordering of the sequence. The region in which to search for such a range is specified by start and end. The value is passed in val. To specify your own search criteria, specify the comparison function cmpfn. +The template class pair is a utility class that can hold a pair of objects in its first and second members. +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 839 + + +fill and fill_n + +template +void fill(ForIter start, ForIter end, const T &val); template +void fill_n(ForIter start, Size num, const T &val); + +The fill() and fill_n() algorithms fill a range with the value specified by val. For fill() the range is specified by start and end. For fill_n() , the range begins at start and runs for num elements. + +find + +template +InIter find(InIter start, InIter end, const T &val); + +The find() algorithm searches the range start to end for the value specified by val. It returns an iterator to the first occurrence of the element or to end if the value is not in the sequence. + +find_end + +template +FwdIter1 find_end(ForIter1 start1, ForIter1 end1, ForIter2 start2, ForIter2 end2); +template FwdIter1 find_end(ForIter1 start1, ForIter1 end1, +ForIter2 start2, ForIter2 end2, BinPred pfn); + +The find_end() algorithm finds the last iterator of the subsequence defined by start2 and end2 within the range start1 and end1. If the sequence is found, an iterator to the last element in the sequence is returned. Otherwise, the iterator end1 is returned. +The second form allows you to specify a binary predicate that determines when elements match. + +find_first_of + +template +FwdIter1 find_first_of(ForIter1 start1, ForIter1 end1, +840 C + + : T h e C o m p l e t e R e f e r e n c e + + + +ForIter2 start2, ForIter2 end2); template +FwdIter1 find_first_of(ForIter1 start1, ForIter1 end1, ForIter2 start2, ForIter2 end2, BinPred pfn); + +The find_first_of() algorithm finds the first element within the sequence defined by start1 and end1 that matches an element within the range start1 and end1. If no matching element is found, the iterator end1 is returned. +The second form allows you to specify a binary predicate that determines when elements match. + +find_if + +template +InIter find_if(InIter start, InIter end, UnPred pfn); + +The find_if() algorithm searches the range start to end for an element for which the unary predicate pfn returns true. It returns an iterator to the first occurrence of the element or to end if the value is not in the sequence. + +for_each + +template +Func for_each(InIter start, InIter end, Func fn); + +The for_each() algorithm applies the function fn to the range of elements specified by start and end. It returns fn. + +generate and generate_n + +template +void generate(ForIter start, ForIter end, Generator fngen); template +void generate_n(OutIter start, Size num, Generator fngen); + +The algorithms generate() and generate_n() assign to elements in a range the values returned by a generator function. For generate() , the range being assigned is +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 841 + + +specified by start and end. For generate_n() , the range begins at start and runs for num elements. The generator function is passed in fngen. It has no parameters. + +includes + +template +bool includes(InIter1 start1, InIter1 end1, InIter2 start2, InIter2 end2); +template bool includes(InIter1 start1, InIter1 end1, +InIter2 start2, InIter2 end2, Comp cmpfn); + +The includes() algorithm determines if the sequence defined by start1 and end1 includes all of the elements in the sequence defined by start2 and end2. It returns true if the elements are all found and false otherwise. +The second form allows you to specify a comparison function that determines when one element is less than another. + +inplace_merge + +template +void inplace_merge(BiIter start, BiIter mid, BiIter end); template +void inplace_merge(BiIter start, BiIter mid, BiIter end, Comp cmpfn); + +Within a single sequence, the inplace_merge() algorithm merges the range defined by start and mid with the range defined by mid and end. Both ranges must be sorted in increasing order. After executing, the resulting sequence is sorted in increasing order. +The second form allows you to specify a comparison function that determines when one element is less than another. + +iter_swap + +template void iter_swap(ForIter1 i, ForIter2 j) + +The iter_swap() algorithm exchanges the values pointed to by its two iterator arguments. +842 C + + : T h e C o m p l e t e R e f e r e n c e + + +lexicographical_compare + +template +bool lexicographical_compare(InIter1 start1, InIter1 end1, InIter2 start2, InIter2 end2); +template +bool lexicographical_compare(InIter1 start1, InIter1 end1, InIter2 start2, InIter2 end2, Comp cmpfn); + +The lexicographical_compare() algorithm alphabetically compares the sequence defined by start1 and end1 with the sequence defined by start2 and end2. It returns true if the first sequence is lexicographically less than the second (that is, if the first sequence would come before the second using dictionary order). +The second form allows you to specify a comparison function that determines when one element is less than another. + +lower_bound + +template +ForIter lower_bound(ForIter start, ForIter end, const T &val); template +ForIter lower_bound(ForIter start, ForIter end, const T &val, Comp cmpfn); + +The lower_bound() algorithm finds the first point in the sequence defined by start and end that is not less than val. It returns an iterator to this point. +The second form allows you to specify a comparison function that determines when one element is less than another. + +make_heap + +template +void make_heap(RandIter start, RandIter end); template +void make_heap(RandIter start, RandIter end, Comp cmpfn); + +The make_heap() algorithm constructs a heap from the sequence defined by start and end. +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 843 + + +The second form allows you to specify a comparison function that determines when one element is less than another. + +max + +template +const T &max(const T &i, const T &j); template +const T &max(const T &i, const T &j, Comp cmpfn); + +The max() algorithm returns the maximum of two values. +The second form allows you to specify a comparison function that determines when one element is less than another. + +max_element + +template +ForIter max_element(ForIter start, ForIter last); template +ForIter max_element(ForIter start, ForIter last, Comp cmpfn); + +The max_element() algorithm returns an iterator to the maximum element within the range start and last. +The second form allows you to specify a comparison function that determines when one element is less than another. + +merge + +template OutIter merge(InIter1 start1, InIter1 end1, +InIter2 start2, InIter2 end2, OutIter result); +template OutIter merge(InIter1 start1, InIter1 end1, +InIter2 start2, InIter2 end2, OutIter result, Comp cmpfn); + +The merge() algorithm merges two ordered sequences, placing the result into a third sequence. The sequences to be merged are defined by start1, end1 and start2, end2. +844 C + + : T h e C o m p l e t e R e f e r e n c e + + +The result is put into the sequence pointed to by result. An iterator to the end of the resulting sequence is returned. +The second form allows you to specify a comparison function that determines when one element is less than another. + +min + +template +const T &min(const T &i, const T &j); template +const T &min(const T &i, const T &j, Comp cmpfn); + +The min() algorithm returns the minimum of two values. +The second form allows you to specify a comparison function that determines when one element is less than another. + +min_element + +template +ForIter min_element(ForIter start, ForIter last); template +ForIter min_element(ForIter start, ForIter last, Comp cmpfn); + +The min_element() algorithm returns an iterator to the minimum element within the range start and last. +The second form allows you to specify a comparison function that determines when one element is less than another. + +mismatch + +template +pair mismatch(InIter1 start1, InIter1 end1, InIter2 start2); +template pair mismatch(InIter1 start1, InIter1 end1, +InIter2 start2, BinPred pfn); + +The mismatch() algorithm finds the first mismatch between the elements in two sequences. Iterators to the two elements are returned. If no mismatch is found, iterators to the last element in each sequence are returned. +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 845 + + +The second form allows you to specify a binary predicate that determines when one element is equal to another. +The pair template class contains two data members called first and second that hold the pair of values. + +next_permutation + +template +bool next_permutation(BiIter start, BiIter end); template +bool next_permutation(BiIter start, BiIter end, Comp cmfn); + +The next_permutation() algorithm constructs the next permutation of a sequence. The permutations are generated assuming a sorted sequence: from low to high represents the first permutation. If the next permutation does not exist, next_permutation() sorts the sequence as its first permutation and returns false. Otherwise, it returns true. +The second form allows you to specify a comparison function that determines when one element is less than another. + +nth_element + +template +void nth_element(RandIter start, RandIter element, RandIter end); template +void nth_element(RandIter start, RandIter element, RandIter end, Comp cmpfn); + +The nth_element() algorithm arranges the sequence specified by start and end such that all elements less than element come before that element and all elements greater than element come after it. +The second form allows you to specify a comparison function that determines when one element is greater than another. + +partial_sort + +template +void partial_sort(RandIter start, RandIter mid, RandIter end); template +void partial_sort(RandIter start, RandIter mid, RandIter end, Comp cmpfn); +846 C + + : T h e C o m p l e t e R e f e r e n c e + + +The partial_sort() algorithm sorts the range start to end. However, after execution, only elements in the range start to mid will be in sorted order. +The second form allows you to specify a comparison function that determines when one element is less than another. + +partial_sort_copy + +template +RandIter partial_sort_copy(InIter start, InIter end, +RandIter res_start, RandIter res_end); template +RandIter partial_sort_copy(InIter start, InIter end, +RandIter res_start, RandIter res_end, Comp cmpfn); + +The partial_sort_copy() algorithm sorts the range start to end and then copies as many elements as will fit into the result sequence defined by res_start and res_end. It returns an iterator to the last element copied into the resulting sequence. +The second form allows you to specify a comparison function that determines when one element is less than another. + +partition + +template +BiIter partition(BiIter start, BiIter end, UnPred pfn); + +The partition() algorithm arranges the sequence defined by start and end such that all elements for which the predicate specified by pfn returns true come before those for which the predicate returns false. It returns an iterator to the beginning of the elements for which the predicate is false. + +pop_heap + +template +void pop_heap(RandIter start, RandIter end); template +void pop_heap(RandIter start, RandIter end, Comp cmpfn); + +The pop_heap() exchanges the first and last−1 elements and then rebuilds the heap. +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 847 + + +The second form allows you to specify a comparison function that determines when one element is less than another. + +prev_permutation + +template +bool prev_permutation(BiIter start, BiIter end); template +bool prev_permutation(BiIter start, BiIter end, Comp cmpfn); + +The prev_permutation() algorithm constructs the previous permutation of a sequence. The permutations are generated assuming a sorted sequence: from low to high represents the first permutation. If the next permutation does not exist, prev_permutation() sorts the sequence as its final permutation and returns false. Otherwise, it returns true. +The second form allows you to specify a comparison function that determines when one element is less than another. + +push_heap + +template +void push_heap(RandIter start, RandIter end); template +void push_heap(RandIter start, RandIter end, Comp cmpfn); + +The push_heap() algorithm pushes an element onto the end of a heap. The range specified by start and end is assumed to represent a valid heap. +The second form allows you to specify a comparison function that determines when one element is less than another. + +random_shuffle + +template +void random_shuffle(RandIter start, RandIter end); template +void random_shuffle(RandIter start, RandIter end, Generator rand_gen); + +The random_shuffle() algorithm randomizes the sequence defined by start and end. +848 C + + : T h e C o m p l e t e R e f e r e n c e + + +The second form specifies a custom random number generator. This function must have the following general form: + +rand_gen(num); + +It must return a random number between zero and num. + +remove, remove_if, remove_copy, and remove_copy_if + +template +ForIter remove(ForIter start, ForIter end, const T &val); template +ForIter remove_if(ForIter start, ForIter end, UnPred pfn); template +OutIter remove_copy(InIter start, InIter end, OutIter result, const T &val); +template OutIter remove_copy_if(InIter start, InIter end, +OutIter result, UnPred pfn); + +The remove() algorithm removes elements from the specified range that are equal to val. It returns an iterator to the end of the remaining elements. +The remove_if() algorithm removes elements from the specified range for which the predicate pfn is true. It returns an iterator to the end of the remaining elements. +The remove_copy() algorithm copies elements from the specified range that are equal to val and puts the result into the sequence pointed to by result. It returns an iterator to the end of the result. +The remove_copy_if() algorithm copies elements from the specified range for which the predicate pfn is true and puts the result into the sequence pointed to by result. It returns an iterator to the end of the result. + +replace, replace_copy, replace_if, and replace_copy_if + +template +void replace(ForIter start, ForIter end, const T &old, const T &new); +template void replace_if(ForIter start, ForIter end, +UnPred pfn, const T &new); template +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 849 + + + +OutIter replace_copy(InIter start, InIter end, OutIter result, const T &old, const T &new); +template OutIter replace_copy_if(InIter start, InIter end, OutIter result, +UnPred pfn, const T &new); + + +Within the specified range, the replace() algorithm replaces elements with the value old with elements that have the value new. +Within the specified range, the replace_if() algorithm replaces those elements for which the predicate pfn is true with elements that have the value new. +Within the specified range, the replace_copy() algorithm copies elements to result. In the process it replaces elements that have the value old with elements that have the value new. The original range is unchanged. An iterator to the end of result is returned. +Within the specified range, the replace_copy_if() algorithm copies elements to result. In the process it replaces elements for which the predicate pfn returns true with elements that have the value new. The original range is unchanged. An iterator to the end of result is returned. + +reverse and reverse_copy + +template +void reverse(BiIter start, BiIter end); template +OutIter reverse_copy(BiIter first, BiIter last, OutIter result); + +The reverse() algorithm reverses the order of the range specified by start and end. The reverse_copy() algorithm copies in reverse order the range specified by start +and end and stores the result in result. It returns an iterator to the end of result. + +rotate and rotate_copy + +template +void rotate(ForIter start, ForIter mid, ForIter end); template +OutIter rotate_copy(ForIter start, ForIter mid, ForIter end, OutIter result); + +The rotate() algorithm left-rotates the elements in the range specified by start and end so that the element specified by mid becomes the new first element. +850 C + + : T h e C o m p l e t e R e f e r e n c e + + +The rotate_copy() algorithm copies the range specified by start and end, storing the result in result. In the process it left-rotates the elements so that the element specified by mid becomes the new first element. It returns an iterator to the end of result. + +search + +template ForIter1 search(ForIter1 start1, ForIter1 end1, +ForIter2 start2, ForIter2 end2); template +ForIter1 search(ForIter1 start1, ForIter1 end1, +ForIter2 start2, ForIter2 end2, BinPred pfn); + +The search() algorithm searches for a subsequence within a sequence. The sequence being searched is defined by start1 and end1. The subsequence being searched is specified by start2 and end2. If the subsequence is found, an iterator to its beginning is returned. Otherwise, end1 is returned. +The second form allows you to specify a binary predicate that determines when one element is equal to another. + +search_n + +template ForIter search_n(ForIter start, ForIter end, +Size num, const T &val); +template ForIter search_n(ForIter start, ForIter end, +Size num, const T &val, BinPred pfn); + +The search_n() algorithm searches for a sequence of num elements equal to val within a sequence. The sequence being searched is defined by start1 and end1. If the subsequence is found, an iterator to its beginning is returned. Otherwise, end is returned. +The second form allows you to specify a binary predicate that determines when one element is equal to another. + +set_difference + +template OutIter set_difference(InIter1 start1, InIter1 end1, +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 851 + + + +InIter2 start2, InIter2 last2, OutIter result); template +OutIter set_difference(InIter1 start1, InIter1 end1, InIter2 start2, InIter2 last2, +OutIter result, Comp cmpfn); + + +The set_difference() algorithm produces a sequence that contains the difference between the two ordered sets defined by start1, end1 and start2, end2. That is, the set defined by start2, end2 is subtracted from the set defined by start1, end1. The result is ordered and put into result. It returns an iterator to the end of the result. +The second form allows you to specify a comparison function that determines when one element is less than another. + +set_intersection + +template OutIter set_intersection(InIter1 start1, InIter1 end1, +InIter2 start2, InIter2 last2, OutIter result); template +OutIter set_intersection(InIter1 start1, InIter1 end1, InIter2 start2, InIter2 last2, +OutIter result, Comp cmpfn); + +The set_intersection() algorithm produces a sequence that contains the intersection of the two ordered sets defined by start1, end1 and start2, end2. These are the elements common to both sets. The result is ordered and put into result. It returns an iterator to the end of the result. +The second form allows you to specify a comparison function that determines when one element is less than another. + +set_symmetric_difference + +template +OutIter set_symmetric_difference(InIter1 start1, InIter1 end1, InIter2 start2, InIter2 last2, OutIter result); +template OutIter set_symmetric_difference(InIter1 start1, InIter1 end1, +InIter2 start2, InIter2 last2, OutIter result, Comp cmpfn); +852 C + + : T h e C o m p l e t e R e f e r e n c e + + +The set_symmetric_difference() algorithm produces a sequence that contains the symmetric difference between the two ordered sets defined by start1, end1 and start2, end2. That is, the resultant set contains only those elements that are not common to both sets. The result is ordered and put into result. It returns an iterator to the end of the result. +The second form allows you to specify a comparison function that determines when one element is less than another. + +set_union + +template OutIter set_union(InIter1 start1, InIter1 end1, +InIter2 start2, InIter2 last2, OutIter result); template +OutIter set_union(InIter1 start1, InIter1 end1, +InIter2 start2, InIter2 last2, OutIter result, Comp cmpfn); + +The set_union() algorithm produces a sequence that contains the union of the two ordered sets defined by start1, end1 and start2, end2. Thus, the resultant set contains those elements that are in both sets. The result is ordered and put into result. It returns an iterator to the end of the result. +The second form allows you to specify a comparison function that determines when one element is less than another. + +sort + +template +void sort(RandIter start, RandIter end); template +void sort(RandIter start, RandIter end, Comp cmpfn); + +The sort() algorithm sorts the range specified by start and end. +The second form allows you to specify a comparison function that determines when one element is less than another. + +sort_heap + +template +void sort_heap(RandIter start, RandIter end); +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 853 + + + +template +void sort_heap(RandIter start, RandIter end, Comp cmpfn); + + +The sort_heap() algorithm sorts a heap within the range specified by start and end. The second form allows you to specify a comparison function that determines when +one element is less than another. + +stable_partition + +template +BiIter stable_partition(BiIter start, BiIter end, UnPred pfn); + +The stable_partition() algorithm arranges the sequence defined by start and end such that all elements for which the predicate specified by pfn returns true come before those for which the predicate returns false. The partitioning is stable. This means that the relative ordering of the sequence is preserved. It returns an iterator to the beginning of the elements for which the predicate is false. + +stable_sort + +template +void stable_sort(RandIter start, RandIter end); template +void stable_sort(RandIter start, RandIter end, Comp cmpfn); + +The sort() algorithm sorts the range specified by start and end. The sort is stable. This means that equal elements are not rearranged. +The second form allows you to specify a comparison function that determines when one element is less than another. + +swap + +template +void swap(T &i, T &j); + +The swap() algorithm exchanges the values referred to by i and j. +854 C + + : T h e C o m p l e t e R e f e r e n c e + + +swap_ranges + +template +ForIter2 swap_ranges(ForIter1 start1, ForIter1 end1, ForIter2 start2); + +The swap_ranges() algorithm exchanges elements in the range specified by start1 and end1 with elements in the sequence beginning at start2. It returns a pointer to the end of the sequence specified by start2. + +transform + +template OutIter transform(InIter start, InIter end, +OutIter result, Func unaryfunc); +template OutIter transform(InIter1 start1, InIter1 end1, +InIter2 start2, OutIter result, Func binaryfunc); + +The transform() algorithm applies a function to a range of elements and stores the outcome in result. In the first form, the range is specified by start and end. The function to be applied is specified by unaryfunc. This function receives the value of an element in its parameter and it must return its transformation. +In the second form, the transformation is applied using a binary operator function that receives the value of an element from the sequence to be transformed in its first parameter and an element from the second sequence as its second parameter. +Both versions return an iterator to the end of the resulting sequence. + +unique and unique_copy + +template +ForIter unique(ForIter start, ForIter end); template +ForIter unique(ForIter start, ForIter end, BinPred pfn); template +OutIter unique_copy(ForIter start, ForIter end, OutIter result); template +OutIter unique_copy(ForIter start, ForIter end, OutIter result, BinPred pfn); +C h a p t e r 3 4 : T h e S T L A l g o r i t h m s 855 + + +The unique() algorithm eliminates duplicate elements from the specified range. The second form allows you to specify a binary predicate that determines when one element is equal to another. unique() returns an iterator to the end of the range. +The unique_copy() algorithm copies the range specified by start1 and end1, eliminating duplicate elements in the process. The outcome is put into result. The second form allows you to specify a binary predicate that determines when one element is equal to another. unique_copy() returns an iterator to the end of the range. + +upper_bound + +template +ForIter upper_bound(ForIter start, ForIter end, const T &val); template +ForIter upper_bound(ForIter start, ForIter end, const T &val, Comp cmpfn); + +The upper_bound() algorithm finds the last point in the sequence defined by start and end that is not greater than val. It returns an iterator to this point. +The second form allows you to specify a comparison function that determines when one element is less than another. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 35 STL Iterators, Allocators, and Function Objects + + + + + + + + + + + +857 +858 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the classes and functions that support iterators, allocators, and function objects. These components are part of the standard template library. They may also be used for other purposes. +T + + +Iterators +While containers and algorithms form the foundation of the standard template library, iterators are the glue that holds it together. An iterator is a generalization (or perhaps more precisely, an abstraction) of a pointer. Iterators are handled in your program like pointers, and they implement the standard pointer operators. They give you the ability to cycle through the contents of a container in much the same way that you would use a pointer to cycle through an array. +Standard C++ defines a set of classes and functions that support iterators. However, for the vast majority of STL-based programming tasks, you will not use these classes directly. Instead, you will use the iterators provided by the various containers in the STL, manipulating them like you would any other pointer. The preceding notwithstanding, it is still valuable to have a general understanding of the iterator classes and their contents. For example, it is possible to create your own iterators that accommodate special situations. Also, developers of third-party libraries will find the iterator classes useful. +Iterators use the header . + +The Basic Iterator Types There are five types of iterators: + + +Iterator + +Random Access + +Bidirectional Forward Input +Output + +Access Allowed + +Store and retrieve values. Elements may be accessed randomly. +Store and retrieve values. Forward and backward moving. Store and retrieve values. Forward moving only. +Retrieve but not store values. Forward moving only. +Store but not retrieve values. Forward moving only. + + +In general, an iterator that has greater access capabilities can be used in place of one that has lesser capabilities. For example, a forward iterator can be used in place of an input iterator. +The STL also supports reverse iterators. Reverse iterators are either bidirectional or random-access iterators that move through a sequence in the reverse direction. Thus, if +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 859 + + +a reverse iterator points to the end of a sequence, incrementing that iterator will cause it to point one element before the end. +Stream-based iterators are available that allow you to operate on streams through iterators. Finally, insert iterator classes are provided that simplify the insertion of elements into a container. +All iterators must support the pointer operations allowed by their type. For example, an input iterator class must support –>, ++, *, ==, and !=. Further, the * operator cannot be used to assign a value. By contrast, a random-access iterator must support –>, +, ++, –, −−, *, <, >, <=, >=, –=, +=, ==, !=, and [ ]. Also, the * must allow assignment. + +The Low-Level Iterator Classes +The header defines several classes that provide support for and aid in the +implementation of iterators. As explained in Chapter 24, each of the STL containers defines its own iterator type, which is typedefed as iterator. Thus, when using the standard STL containers, you will not usually interact directly with the low-level iterator classes themselves. But you can use the classes described here to derive your own iterators. +Several of the iterator classes make use of the ptrdiff_t type. This type is capable of representing the difference between two pointers. + +iterator +The iterator class is a base for iterators. It is shown here: + +template +struct iterator { typedef T value_type; +typedef Dist difference_type; typedef Pointer pointer; typedef Ref reference; +typedef Cat iterator_category; }; + +Here, difference_type is a type that can hold the difference between two addresses, value_type is the type of value operated upon, pointer is the type of a pointer to a value, reference is the type of a reference to a value, and iterator_category describes the type of the iterator (such as input, random-access, etc.). +The following category classes are provided. Their tag names can be stored in iterator_category. + + +struct input_iterator_tag {}; struct output_iterator_tag {}; +860 C + + : T h e C o m p l e t e R e f e r e n c e + + + +struct forward_iterator_tag: public input_iterator_tag {}; +struct bidirectional_iterator_tag: public forward_iterator_tag {}; struct random_access_iterator_tag: public +bidirectional_iterator_tag {}; + + +iterator_traits +The class iterator_traits provides a convenient means of exposing the various types defined by an iterator. It is defined like this: + + +template struct iterator_traits { typedef Iterator::difference_type difference_type; typedef Iterator::value_type value_type; +typedef Iterator::pointer pointer; typedef Iterator::reference reference; +typedef Iterator::iterator_category iterator_category; } + +The Predefined Iterators +The header contains several predefined iterators that may be used directly +by your program or to help create other iterators. These iterators are shown in Table 35-1. Notice that there are four iterators that operate on streams. The main purpose for the stream iterators is to allow streams to be manipulated by algorithms. Also notice the insert iterators. When these iterators are used in an assignment statement, they insert elements into a sequence rather than overwriting existing elements. +Each of the predefined iterators is examined here. + +insert_iterator +The insert_iterator class supports output iterators that insert objects into a container. Its template definition is shown here: + +template class insert_iterator: +public iterator + +Here, Cont is the type of container that the iterator operates upon. insert_iterator has the following constructor: + +insert_iterator(Cont &cnt, typename Cont::iterator itr); + +Here, cnt is the container being operated upon and itr is an iterator into the container that will be used to initialize the insert_iterator. +C h a p t e r 3 5 : + + + +Class + +insert_iterator back_insert_iterator front_insert_iterator reverse_iterator istream_iterator istreambuf_iterator ostream_iterator +ostreambuf_iterator + +S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 861 + + + +Description + +An output iterator that inserts anywhere in the container. An output iterator that inserts at the end of a container. An output iterator that inserts at the front of a container. A reverse, bidirectional, or random-access iterator. +An input stream iterator. An input streambuf iterator. An output stream iterator. +An output streambuf iterator. + + + +Table 35-1. The Predefined Iterator Classes + + + +insert_iterator defines the following operators: =, *, ++. A pointer to the container is stored in a protected variable called container. The container's iterator is stored in a protected variable called iter. +Also defined is the function inserter() , which creates an insert_iterator. It is shown here: + +template insert_iterator inserter(Cont &cnt, Iterator itr); + +Insert iterators insert into, rather than overwrite, the contents of a container. To fully understand the effects of an insert iterator, consider the following program. It first creates a small vector of integers, and then uses an insert_iterator to insert new elements into the vector rather than overwriting existing elements. + + +// Demonstrate insert_iterator. #include +#include #include using namespace std; + +int main() { +vector v; +862 C + + : T h e C o m p l e t e R e f e r e n c e + + + +vector::iterator itr; int i; + +for(i=0; i<5; i++) v.push_back(i); + +cout << "Original array: "; itr = v.begin(); +while(itr != v.end()) cout << *itr++ << " "; +cout << endl; + +itr = v.begin(); +itr += 2; // point to element 2 + +// create insert_iterator to element 2 insert_iterator > i_itr(v, itr); + +// insert rather than overwrite *i_itr++ = 100; +*i_itr++ = 200; + +cout << "Array after insertion: "; itr = v.begin(); +while(itr != v.end()) cout << *itr++ << " "; + +return 0; } + +The output from the program is shown here: + +Original array: 0 1 2 3 4 +Array after insertion: 0 1 100 200 2 3 4 + +In the program, had the assignments of 100 and 200 been done using a standard iterator, the original elements in the array would have been overwritten. The same basic process applies to back_insert_iterator and front_insert_iterator as well. +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 863 + + +back_insert_iterator +The back_insert_iterator class supports output iterators that insert objects on the end of a container using push_back() . Its template definition is shown here: + +template class back_insert_iterator: +public iterator + +Here, Cont is the type of container that the iterator operates upon. back_insert_iterator has the following constructor: + +explicit back_insert_iterator(Cont &cnt); + +Here, cnt is the container being operated upon. All insertions will occur at the end. back_insert_iterator defines the following operators: =, *, ++. A pointer to the +container is stored in a protected variable called container. +Also defined is the function back_inserter() , which creates a back_insert_iterator. It is shown here: + +template back_insert_iterator back_inserter(Cont &cnt); + +front_insert_iterator +The front_insert_iterator class supports output iterators that insert objects on the front of a container using push_front() . Its template definition is shown here: + +template class front_insert_iterator: +public iterator + +Here, Cont is the type of container that the iterator operates upon. front_insert_iterator has the following constructor: + +explicit front_insert_iterator(Cont &cnt); + +Here, cnt is the container being operated upon. All insertions will occur at the front. front_insert_iterator defines the following operators: =, *, ++. A pointer to the +container is stored in a protected variable called container. +Also defined is the function front_inserter() , which creates a front_insert_iterator. It is shown here: + +template front_insert_iterator inserter(Cont &cnt); +864 C + + : T h e C o m p l e t e R e f e r e n c e + + +reverse_iterator +The reverse_iterator class supports reverse iterator operations. A reverse iterator operates the opposite of a normal iterator. For example, ++ causes a reverse iterator to back up. Its template definition is shown here: + +template class reverse_iterator: +public iterator::iterator_category, iterator_traits::value_type, iterator_traits::difference_type, iterator_traits::pointer, iterator_traits::reference> + +Here, Iter is either a random-access iterator or a bidirectional iterator. reverse_iterator has the following constructors: + +reverse_iterator( ); +explicit reverse_iterator(Iter itr); + +Here, itr is an iterator that specifies the starting location. +If Iter is a random-access iterator, then the following operators are available: –>, +, ++, –, −−, *, <, >, <=, >=, –=, +=, ==, !=, and [ ] . If Iter is a bidirectional iterator, then only –>, ++, −−, *, ==, and != are available. +The reverse_iterator class defines a protected member called current, which is an iterator to the current location. +The function base() is also defined by reverse_iterator. Its prototype is shown here: + +Iter base( ) const; + +It returns an iterator to the current location. + +istream_iterator +The istream_iterator class supports input iterator operations on a stream. Its template definition is shown here: + +template , class Dist = ptrdiff_t> class istream_iterator: +public iterator + +Here, T is the type of data being transferred, and CharType is the character type (char or wchar_t) that the stream is operating upon. Dist is a type capable of holding the difference between two addresses. istream_iterator has the following constructors: +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 865 + + +istream_iterator( ); istream_iterator(istream_type &stream); +istream_iterator(const istream_iterator &ob); + +The first constructor creates an iterator to an empty stream. The second creates an iterator to the stream specified by stream. The type istream_type is a typedef that specifies the type of the input stream. The third form creates a copy of an istream_iterator object. +The istream_iterator class defines the following operators: –>, *, ++. The operators == and != are also defined for objects of type istream_iterator. +Here is a short program that demonstrates istream_iterator. It reads and displays characters from cin until a period is received. + + +// Use istream_iterator #include #include using namespace std; + +int main() { +istream_iterator in_it(cin); + +do { +cout << *in_it++; +} while (*in_it != '.'); + +return 0; } + +istreambuf_iterator +The istreambuf_iterator class supports character input iterator operations on a stream. Its template definition is shown here: + +template > class istreambuf_iterator: +public iterator + +Here, CharType is the character type (char or wchar_t) that the stream is operating upon. istreambuf_iterator has the following constructors: + +istreambuf_iterator( ) throw( ); istreambuf_iterator(istream_type &stream) throw( ); istreambuf_iterator(streambuf_type *streambuf) throw( ); +866 C + + : T h e C o m p l e t e R e f e r e n c e + + +The first constructor creates an iterator to an empty stream. The second creates an iterator to the stream specified by stream. The type istream_type is a typedef that specifies the type of the input stream. The third form creates an iterator using the stream buffer specified by streambuf. +The istreambuf_iterator class defines the following operators: *, ++. The operators == and != are also defined for objects of type istreambuf_iterator. +istreambuf_iterator defines the member function equal() , which is shown here: + +bool equal(istreambuf_iterator &ob); + +Its operation is a bit counterintuitive. It returns true if the invoking iterator and ob both point to the end of the stream. It also returns true if both iterators do not point to the end of the stream. There is no requirement that what they point to be the same. It returns false otherwise. The == and != operators work in the same fashion. + +ostream_iterator +The ostream_iterator class supports output iterator operations on a stream. Its template definition is shown here: + +template > class ostream_iterator: +public iterator + +Here, T is the type of data being transferred, CharType is the character type (char or wchar_t) that the stream is operating upon. ostream_iterator has the following constructors: + +ostream_iterator(ostream_type &stream); ostream_iterator(ostream_type &stream, const CharType *delim); ostream_iterator(const ostream_iterator &ob); + +The first creates an iterator to the stream specified by stream. The type ostream_type is a typedef that specifies the type of the output stream. The second form creates an iterator to the stream specified by stream and uses the delimiters specified by delim. The delimiters are written to the stream after every output operation. The third form creates a copy of an ostream_iterator object. +The ostream_iterator class defines the following operators: =, *, ++. Here is a short program that demonstrates ostream_iterator. +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 867 + + +// Use ostream_iterator #include #include using namespace std; + +int main() { +ostream_iterator out_it(cout); + +*out_it = 'X'; out_it++; *out_it = 'Y'; out_it++; *out_it = ' '; + +char str[] = "C++ Iterators are powerful.\n"; char *p = str; + +while(*p) *out_it++ = *p++; + +ostream_iterator out_double_it(cout); *out_double_it = 187.23; +out_double_it++; *out_double_it = -102.7; + +return 0; } + +The output from this program is shown here: + +XY C++ Iterators are powerful. 187.23-102.7 + +ostreambuf_iterator +The ostreambuf_iterator class supports character output iterator operations on a stream. Its template definition is shown here: + +template > class ostreambuf_iterator: +public iterator +868 C + + : T h e C o m p l e t e R e f e r e n c e + + +Here, CharType is the character type (char or wchar_t) that the stream is operating upon. ostreambuf_iterator has the following constructors: + +ostreambuf_iterator(ostream_type &stream) throw( ); ostreambuf_iterator(streambuf_type *streambuf) throw( ); + +The first creates an iterator to the stream specified by stream. The type ostream_type is a typedef that specifies the type of the input stream. The second form creates an iterator using the stream buffer specified by streambuf. The type streambuf_type is a typedef that specifies the type of the stream buffer. +The ostreambuf_iterator class defines the following operators: =, *, ++. The member function failed() is also defined as shown here: + +bool failed( ) const throw( ); + +It returns false if no failure has occurred and true otherwise. + +Two Iterator Functions +There are two special functions defined for iterators: advance() and distance() . They are shown here: + +template void advance(InIter &itr, Dist d); template distance(InIter start, InIter end); + +The advance() function increments itr by the amount specified by d. The distance() function returns the number of elements between start and end. +The reason for these two functions is that only random-access iterators allow a value to be added to or subtracted from an iterator. The advance() and distance() functions overcome this restriction. It must be noted, however, that some iterators will not be able to implement these functions efficiently. + + +Function Objects +Function objects are classes that define operator() . The STL defines several built-in function objects that your programs may use. You can also define your own function objects. Support for function objects is in the header. Also defined in are several entities that support function objects. These are binders, negators, and adaptors. Each is described here. + +Note Refer to Chapter 24 for an overview of function objects. +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 869 + + +Function Objects +Function objects come in two varieties: binary and unary. The built-in binary function objects are shown here: + + +plus equal_to +less_equal + +minus not_equal_to +logical_and + +multiplies greater +logical_or + +divides +greater_equal + +modulus +less + + +Here are the built-in unary function objects. + +logical_not negate + +The general form for invoking a function object is shown here: + +func_ob( ) + +For example, + +less() + +invokes less() relative to operands of type int. +A base class for all binary function objects is binary_function, shown here: + + +template struct binary_function { +typedef Argument1 first_argument_type; typedef Argument2 second_argument_type; typedef Result result_type; +}; + +The base class for all unary functions is unary_function, shown here: + +template struct unary_function { typedef Argument argument_type; +typedef Result result_type; }; + +These template classes provide concrete type names for the generic data types used by the function object. Although they are technically a convenience, they are almost always used when creating function objects. +870 C + + : T h e C o m p l e t e R e f e r e n c e + + +The template specifications for all binary function objects are similar, and the template specifications for all unary function objects are similar. Here are examples of each: + + +template struct plus : binary_function { +T operator() (const T &arg1, const T&arg2) const; }; + +template struct negate : unary_function { +T operator() (const T &arg) const; }; + +Each operator() function returns the specified result. + +Binders +Binders bind a value to an argument of a binary function object, producing a unary +function object. There are two binders: bind2nd() and bind1st() . Here is how they are defined: + +template +binder1st bind1st(const BinFunc &op, const T &value); template +binder2nd bind2nd(const BinFunc &op, const T &value); + +Here, op is a binary function object, such as less() or greater() , that provides the desired operation, and value is the value being bound. bind1st() returns a unary function object that has op's left-hand operand bound to value. bind2nd() returns a unary function object that has op's right-hand operand bound to value. The bind2nd() binder is by far the most commonly used. In either case, the outcome of a binder is a unary function object that is bound to the value specified. +The binder1st and binder2nd classes are shown here: + + +template class binder1st: +public unary_function(typename BinFunc::second_argument_type, typename BinFunc::result_type> +{ protected: +BinFunc op; +typename BinFunc::first_argument_type value; public: +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 871 + + + +binder1st(const BinFunc &op, +const typename BinFunc::first_argument_type &v); result_type operator()(const argument_type &v) const; +}; + +template class binder2nd: +public unary_function(typename BinFunc::first_argument_type, typename BinFunc::result_type> +{ protected: +BinFunc op; +typename BinFunc::second_argument_type value; public: +binder2nd(const BinFunc &op, +const typename BinFunc::second_argument_type &v); result_type operator()(const argument_type &v) const; +}; + + +Here, BinFunc is the type of a binary function object. Notice that both classes inherit unary_function. This is why the resulting object of bind1st() and bind2nd() can be used anywhere that a unary function can be. + +Negators +Negators return predicates that yield the opposite of whatever predicate they modify. The negators are not1() and not2() . They are defined like this: + +template unary_negate not1(const UnPred &pred); template binary_negate not2(const BinPred &pred); + +The classes are shown here: + +template class unary_negate: +public unary_function { +public: +explicit unary_negate(const UnPred &pred); bool operator()(const argument_type &v) const; +}; + +template class binary_negate: +872 C + + : T h e C o m p l e t e R e f e r e n c e + + + +public binary_function +{ public: +explicit binary_negate(const BinPred &pred); bool operator()(const first_argument_type &v1, +const second_argument_type &v2) const; }; + +In both classes, operator() returns the negation of the predicate specified by pred. + +Adaptors +The header defines several classes called adaptors that allow you to adapt a function pointer to a form that can be used by the STL. For example, you can use an adaptor to allow a function such as strcmp() to be used as a predicate. Adaptors also exist for member pointers. + +The Pointer-to-Function Adaptors The pointer-to-function adaptors are shown here: + +template pointer_to_unary_function +ptr_fun(Result (*func)(Argument)); +template pointer_to_binary_function +ptr_fun(Result (*func)(Argument1, Argument2)); + +Here, ptr_fun() returns either an object of type pointer_to_unary_function or a pointer_to_binary_function. These classes are shown here: + + +template class pointer_to_unary_function: +public unary_function { +public: +explicit pointer_to_unary_function(Result (*func)(Argument)); Result operator()(Argument arg) const; +}; +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 873 + + + +template class pointer_to_binary_function: +public binary_function { +public: +explicit pointer_to_binary_function( +Result (*func)(Argument1, Argument2)); +Result operator()(Argument1 arg1, Argument2 arg2) const; }; + +For unary functions, operator() returns + +func(arg). + +For binary functions, operator() returns + +func(arg1, arg2); + +The type of the result of the operation is specified by the Result generic type. + +The Pointer-to-Member Function Adaptors The pointer-to-member function adaptors are shown here: + +template +mem_fun_t mem_fun(Result (T::*func)( )); template +mem_fun1_t mem_fun1(Result (T::*func)(Argument)); + +Here, mem_fun() returns an object of type mem_fun_t, and mem_fun1 returns an object of type mem_fun1_t. These classes are shown here: + + +template class mem_fun_t: public unary_function { +public: +explicit mem_fun_t(Result (T::*func)()); Result operator() (T *func) const; +874 C + + : T h e C o m p l e t e R e f e r e n c e + + + +}; + +template class mem_fun1_t: public binary_function { +public: +explicit mem_fun1_t(Result (T::*func)(Argument)); Result operator() (T *func, Argument arg) const; +}; + + +Here, the mem_fun_t constructor calls the member function specified as its parameter. The mem_fun1_t constructor calls the member function specified as its first parameter, passing a value of type Argument as its second parameter. +There are parallel classes and functions for using references to members. The general form of the functions is shown here: + +template +mem_fun_t mem_fun_ref(Result (T::*func)( )); + +template mem_fun1_t +mem_fun1_ref(Result (T::*func)(Argument)); + +The classes mem_fun_ref and mem_fun1_ref are shown here: + +template class mem_fun_ref_t: public unary_function +{ public: +explicit mem_fun_ref_t(Result (T::*func)()); Result operator()(T &func) const; +}; + +template class mem_fun1_ref_t: +public binary_function { +public: +explicit mem_fun1_ref_t(Result (T::*func)(Argument)); Result operator()(T &func, Argument arg) const; +}; +C h a p t e r 3 5 : S T L I t e r a t o r s , A l l o c a t o r s , a n d F u n c t i o n O b j e c t s 875 + + +Allocators +An allocator manages memory allocation for a container. Since the STL defines a default allocator that is automatically used by the containers, most programmers will never need to know the details about allocators or create their own. However, these details are useful if you are creating your own library classes, etc. +All allocators must satisfy several requirements. First, they must define the following types: + + +const_pointer const_reference difference_type pointer reference size_type + +value_type + +A const pointer to an object of type value_type. A const reference to an object of type value_type. +Can represent the difference between two addresses. A pointer to an object of type value_type. +A reference to an object of type value_type. +Capable of holding the size of the largest possible object that can be allocated. +The type of object being allocated. + + +Second, they must provide the following functions. + + +address allocate deallocate max_size construct +destroy + +Returns a pointer given a reference. Allocates memory. +Frees memory. +Returns the maximum number of objects that can be allocated. Constructs an object. +Destroys an object. + + +The operations == and != must also be defined. +The default allocator is allocator, and it is defined within the header . Its template specification is shown here: + +template class allocator + +Here, T is the type of objects that allocator will be allocating. allocator defines the following constructors: + +allocator( ) throw( ); +allocator(const allocator &ob) throw( ); +876 C + + : T h e C o m p l e t e R e f e r e n c e + + +The first creates a new allocator. The second creates a copy of ob. +The operators == and != are defined for allocator. The member functions defined by allocator are shown in Table 35-2. +One last point: A specialization of allocator for void * pointers is also defined. + + + + + +Function + +pointer address(reference ob) const; const_pointer address(const_reference ob) const; +pointer allocate(size_type num, typename allocator::const_pointer h = 0); + + + + + + +void construct(pointer ptr, const_reference val); + +void deallocate(pointer ptr, size_type num); + + + +void destroy(pointer ptr); + + +size_type max_size( ) const throw( ); + +Description + +Returns the address of ob. + +Returns a pointer to allocated memory that is large enough to hold num objects of type T. The value of h is a hint to the function that can be used to help satisfy the request or ignored. +Constructs an object of type T at ptr. +Deallocates num objects of type T starting at ptr. The value of ptr must have been obtained from allocate() . +Destroys the object at ptr. Its destructor is automatically called. +Returns the maximum number of objects of type T that can be allocated. + + + +Table 35-2. Member Functions of allocator + +C++ + + + + +Chapter 36 The String Class + + + + + + + + + + + + + + +877 +878 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the Standard C++ string class. C++ supports character strings two ways. The first is as a null-terminated character array. This is sometimes referred to as a C string. The second way is as a class object of type +T +basic_string. There are two specializations of basic_string: string, which supports char strings, and wstring, which supports wchar_t (wide character) strings. Most often, you will use string objects of type string. +The basic_string class is essentially a container. This means that iterators and the STL algorithms can operate on strings. However, strings have additional capabilities. +A class used by basic_string is char_traits, which defines several attributes of the characters that comprise a string. It is important to understand that while the most common strings are made up of either char or wchar_t characters, basic_string can operate on any object that can be used to represent a text character. Both basic_string and char_traits are described here. + +Note For an overview of using the string class, refer to Chapter 24. + +The basic_string Class The template specification for basic_string is + +template , class Allocator = allocator > class basic_string + +Here, CharType is the type of character being used, Attr is the class that describes the character's traits, and Allocator specifies the allocator. basic_string has the following constructors: + +explicit basic_string(const Allocator &a = Allocator( )); basic_string(size_type len, CharType ch , +const Allocator &a = Allocator( )); +basic_string(const CharType *str, const Allocator &a = Allocator( )); basic_string(const CharType *str, size_type len, +const Allocator &a = Allocator( )); basic_string(const basic_string &str, size_type indx = 0, +size_type len=npos, const Allocator &a = Allocator( )); template basic_string(InIter start, InIter end, +const Allocator &a = Allocator( )); + +The first form constructs an empty string. The second form constructs a string that has len characters of value ch. The third form constructs a string that contains the same elements as str. The fourth form constructs a string that contains a substring of str that begins at zero and is len characters long. The fifth form constructs a string from another +C h a p t e r 3 6 : T h e S t r i n g C l a s s 879 + + +basic_string using the substring that begins at indx that is len characters long. The sixth form constructs a string that contains the elements in the range specified by start and end. +The following comparison operators are defined for basic_string: + +==, <, <=, !=, >, >= + +Also defined is the + operator, which yields the result of concatenating one string with another, and the I/O operators << and >>, which can be used to input and output strings. +The + operator can be used to concatenate a string object with another string object or a string object with a C-style string. That is, the following variations are supported: + +string + string string + C-string C-string + string + +The + operator can also be used to concatenate a character onto the end of a string. The basic_string class defines the constant npos, which is usually –1. This constant +represents the length of the longest possible string. +In the descriptions, the generic type CharType represents the type of character stored by a string. Since the names of the placeholder types in a template class are arbitrary, basic_string declares typedefed versions of these types. This makes the type names concrete. The types defined by basic_string are shown here: + + +size_type reference const_reference iterator const_iterator reverse_iterator +const_reverse_iterator value_type allocator_type pointer +const_pointer traits_type +difference_type + +Some integral type loosely equivalent to size_t. A reference to a character within a string. +A const reference to a character within a string. An iterator. +A const iterator. A reverse iterator. +A const reverse iterator. +The type of character stored in a string. The type of the allocator. +A pointer to a character within a string. +A const pointer to a character within a string. A typedef for char_traits +A type that can store the difference between two addresses. +880 C + + : T h e C o m p l e t e R e f e r e n c e + + +The member functions defined by basic_string are shown in Table 36-1. Since the vast majority of programmers will be using char strings (and to keep the descriptions easy-to-understand), the table uses the type string, but the functions also apply to objects of type wstring (or any other type of basic_string). + + + + +Member + +string &append(const string &str); + +string &append(const string &str, size_type indx, size_type len); + + +string &append(const CharType *str); + +string &append(const CharType *str, size_type num); + +string &append(size_type len, CharType ch); + + +template +string &append(InIter start, InIter end); +string &assign(const string &str); + +string &assign(const string &str, size_type indx, size_type len); + +string &assign(const CharType *str); + +Description + +Appends str onto the end of the invoking string. Returns *this. +Appends a substring of str onto the end of the invoking string. The substring being appended begins at indx and runs for len characters. Returns *this. +Appends str onto the end of the invoking string. Returns *this. +Appends the first num characters from str onto the end of the invoking string. Returns *this. +Appends len characters specified by ch onto the end of the invoking string. Returns *this. +Appends the sequence specified by start and end onto the end of the invoking string. Returns *this. +Assigns str to the invoking string. Returns *this. +Assigns a substring of str to the invoking string. The substring being assigned begins at indx and runs for len characters. Returns *this. +Assigns str to the invoking string. Returns *this. + + +Table 36-1. The String Member Functions +C h a p t e r 3 6 : T h e S t r i n g C l a s s 881 + + + + +Member + +string &assign(const CharType *str, size_type len); + +string &assign(size_type len, CharType ch); + + +template +string &assign(InIter start, InIter end); + +reference at(size_type indx); const_reference at(size_type indx) const; +iterator begin( ); const_iterator begin( ) const; +const CharType *c_str( ) const; + + +size_type capacity( ) const; + + + +int compare(const string &str) const; + + + + +int compare(size_type indx, size_type len, const string &str) const; + +Description + +Assigns the first len character from str to the invoking string. Returns *this. +Assigns len characters specified by ch to the end of the invoking string. Returns *this. +Assigns the sequence specified by start and end to the invoking string. Returns *this. +Returns a reference to the character specified by indx. +Returns an iterator to the first element in the string. +Returns a pointer to a C-style (i.e., null-terminated) version of the invoking string. +Returns the current capacity of the string. This is the number of characters it can hold before it will need to allocate more memory. +Compares str to the invoking string. It returns one of the following: +Less than zero if *this < str Zero if *this == str +Greater than zero if *this > str +Compares str to a substring within the invoking string. The substring begins at indx and is len characters long. It returns one of the following: Less than zero if *this < str +Zero if *this == str +Greater than zero if *this > str + + + +Table 36-1. The String Member Functions (continued) +882 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +int compare(size_type indx, size_type len, const string &str, size_type indx2, +size_type len2) const; + + + + + + +int compare(const CharType *str) const; + + + + +int compare(size_type indx, size_type len, const CharType *str, size_type len2 = npos) const; + + + + + + + +size_type copy(CharType *str, size_type len, +size_type indx = 0) const; + + +const CharType *data( ) const; + +bool empty( ) const; + +Description + +Compares a substring of str to a substring within the invoking string. The substring in the invoking string begins at indx and is len characters long. The substring in str begins at indx2 and is len2 characters long. It returns one of the following: +Less than zero if *this < str Zero if *this == str +Greater than zero if *this > str +Compares str to the invoking string. It returns one of the following: +Less than zero if *this < str Zero if *this == str +Greater than zero if *this > str +Compares a substring of str to a substring within the invoking string. The substring in the invoking string begins at indx and is len characters long. The substring in str begins at zero and is len2 characters long. It returns one of the following: +Less than zero if *this < str Zero if *this == str +Greater than zero if *this > str +Beginning at indx, copies len characters from the invoking string into the character array pointed to by str. Returns the number of characters copied. +Returns a pointer to the first character in the invoking string. +Returns true if the invoking string is empty and false otherwise. + + + +Table 36-1. The String Member Functions (continued) +C h a p t e r 3 6 : T h e S t r i n g C l a s s 883 + + + + +Member + +iterator end( ); const_iterator end( ) const; +iterator erase(iterator i); + + +iterator erase(iterator start, iterator end); + + + +string &erase(size_type indx = 0, size_type len = npos); + +size_type find(const string &str, size_type indx = 0) const; + + + +size_type find(const CharType *str, size_type indx = 0) const; + + + +size_type find(const CharType *str, size_type indx, size_type len) const; + + +size_type find(CharType ch, +size_type indx = 0) const; + +Description + +Returns an iterator to the end of the string. +Removes character pointed to by i. Returns an iterator to the character after the one removed. +Removes characters in the range start to end. Returns an iterator to the character after the last character removed. +Beginning at indx, removes len characters from the invoking string. Returns *this. +Returns the index of the first occurrence of str within the invoking string. The search begins at index indx. npos is returned if no match is found. +Returns the index of the first occurrence of str within the invoking string. The search begins at index indx. npos is returned if no match is found. +Returns the index of the first occurrence of the first len characters of str within the invoking string. The search begins at index indx. npos is returned if no match is found. +Returns the index of the first occurrence of ch within the invoking string. The search begins at index indx. npos is returned if no match +is found. + + + +Table 36-1. The String Member Functions (continued) +884 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +size_type find_first_of(const string &str, size_type indx = 0) const; + + + + +size_type find_first_of(const CharType *str, size_type indx = 0) const; + + + +size_type find_first_of(const CharType *str, size_type indx, +size_type len) const; + + + +size_type find_first_of(CharType ch, size_type indx = 0) const; + + + +size_type find_first_not_of( const string &str, +size_type indx = 0) const; + + + +size_type find_first_not_of( +const CharType *str, size_type indx = 0) const; + +Description + +Returns the index of the first character within the invoking string that matches any character in str. The search begins at index indx. npos is returned if no match +is found. +Returns the index of the first character within the invoking string that matches any character in str. The search begins at index indx. npos is returned if no match is found. +Returns the index of the first character within the invoking string that matches any character in the first len characters of str. The search begins at index indx. npos is returned if no match is found. +Returns the index of the first occurrence of ch within the invoking string. The search begins at index indx. npos is returned if no match +is found. +Returns the index of the first character within the invoking string that does not match any character in str. The search begins at index indx. npos is returned if no mismatch +is found. +Returns the index of the first character within the invoking string that does not match any character in str. The search begins at index indx. npos is returned if no mismatch +is found. + + + +Table 36-1. The String Member Functions (continued) +C h a p t e r 3 6 : T h e S t r i n g C l a s s 885 + + + + +Member + +size_type find_first_not_of( +const CharType *str, size_type indx, size_type len) const; + + +size_type find_first_not_of( CharType ch, +size_type indx = 0) const; + + +size_type find_last_of(const string &str, size_type indx = npos) const; + + + +size_type find_last_of(const CharType *str, size_type indx = npos) const; + + + +size_type find_last_of(const CharType *str, size_type indx, +size_type len) const; + + + +size_type find_last_of(CharType ch, size_type indx = npos) const; + +Description + +Returns the index of the first character within the invoking string that does not match any character in the first len characters of str. The search begins at index indx. npos is returned if no mismatch is found. +Returns the index of the first character within the invoking string that does not match ch. The search begins at index indx. npos is returned if no mismatch is found. +Returns the index of the last character within the invoking string that matches any character in str. The search begins at index indx. npos is returned if no match is found. +Returns the index of the last character within the invoking string that matches any character in str. The search begins at index indx. npos is returned if no match is found. +Returns the index of the last character within the invoking string that matches any character in the first len characters of str. The search begins at index indx. npos is returned if no match is found. +Returns the index of the last occurrence of ch within the invoking string. The search begins at index indx. npos is returned if no match +is found. + + + +Table 36-1. The String Member Functions (continued) +886 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +size_type find_last_not_of( const string &str, +size_type indx = npos) const; + + +size_type find_last_not_of( +const CharType *str, size_type indx = npos) const; + + +size_type find_last_not_of( +const CharType *str, size_type indx, size_type len) const; + + +size_type find_last_not_of(CharType ch, size_type indx = npos) const; + + + +allocator_type get_allocator( ) const; +iterator insert(iterator i, +const CharType &ch ); + +string &insert(size_type indx, const string &str); + +string &insert(size_type indx1, const string &str, size_type indx2, size_type len); + +Description + +Returns the index of the last character within the invoking string that does not match any character in str. The search begins at index indx. npos is returned if no mismatch is found. +Returns the index of the last character within the invoking string that does not match any character in str. The search begins at index indx. npos is returned if no mismatch is found. +Returns the index of the last character within the invoking string that does not match any character in the first len characters of str. The search begins at index indx. npos is returned if no mismatch is found. +Returns the index of the last character within the invoking string that does not match ch. The search begins at index indx. npos is returned if no mismatch is found. +Returns the string's allocator. +Inserts ch immediately before the character specified by indx. An iterator to the character is returned. +Inserts str into the invoking string at the index specified by indx. Returns *this. +Inserts a substring of str into the invoking string at the index specified by indx1. The substring begins at indx2 and is len characters long. Returns *this. + + + +Table 36-1. The String Member Functions (continued) +C h a p t e r 3 6 : T h e S t r i n g C l a s s 887 + + + + +Member + +string &insert(size_type indx, +const CharType *str); + +string &insert(size_type indx, +const CharType *str, size_type len); +string &insert(size_type indx, size_type len, CharType ch); +void insert(iterator i, size_type len, const CharType &ch) +template +void insert(iterator i, InIter start, InIter end); +size_type length( ) const; + +size_type max_size( ) const; + +reference operator[ ](size_type indx) const; const_reference operator[ ](size_type indx) +const; +string &operator=(const string &str); string &operator=(const CharType *str); string &operator=(CharType ch); +string &operator+=(const string &str); string &operator+=(const CharType *str); string &operator+=(CharType ch); +reverse_iterator rbegin( ); const_reverse_iterator rbegin( ) const; +reverse_iterator rend( ); const_reverse_iterator rend( ) const; + +Description + +Inserts str into the invoking string at the index specified by indx. Returns *this. +Inserts the first len characters of str into the invoking string at the index specified by indx. Returns *this. +Inserts len characters of value ch into the invoking string at the index specified by indx. Returns *this. +Inserts len copies of ch immediately before the element specified by i. +Inserts the sequence defined by start and end immediately before the element specified by i. +Returns the number of characters in the string. +Returns the maximum number of characters that the string can hold. +Returns a reference to the character specified by indx. + +Assigns the specified string or character to the invoking string. Returns *this. +Appends the specified string or character onto the end of the invoking string. Returns *this. +Returns a reverse iterator to the end of the string. +Returns a reverse iterator to the start of the string. + + + +Table 36-1. The String Member Functions (continued) +888 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +string &replace(size_type indx, size_type len, const string &str); +string &replace(size_type indx1, size_type len1, const string &str, size_type indx2, size_type len2); +string &replace(size_type indx, size_type len, +const CharType *str); +string &replace(size_type indx1, size_type len1, +const CharType *str, size_type len2); + +string &replace(size_type indx, size_type len1, size_type len2, CharType ch); +string &replace(iterator start, iterator start, const string &str); +string &replace(iterator start, iterator start, +const CharType *str); +string &replace(iterator start, iterator end, +const CharType *str, size_type len); +string &replace(iterator start, +interator end, size_type len, CharType ch); + +Description + +Replaces up to len characters in the invoking string, beginning at indx with the string in str. Returns *this. +Replaces up to len1 characters in the invoking string beginning at indx1 with the len2 characters from the string in str that begin at indx2. Returns *this. +Replaces up to len characters in the invoking string, beginning at indx with the string in str. Returns *this. +Replaces up to len1 characters in the invoking string beginning at indx1 with the len2 characters from the string in str that begins at indx2. Returns *this. +Replaces up to len1 characters in the invoking string beginning at indx with len2 characters specified by ch. Returns *this. +Replaces the range specified by start and end with str. Returns *this. + +Replaces the range specified by start and end with str. Returns *this. + +Replaces the range specified by start and end with the first len characters from str. Returns *this. + +Replaces the range specified by start and end with the len characters specified by ch. Returns *this. + + + +Table 36-1. The String Member Functions (continued) +C h a p t e r 3 6 : T h e S t r i n g C l a s s 889 + + + + +Member + +template +string &replace(iterator start1, interator end1, InIter start2, InIter end2); +void reserve(size_type num = 0); + +void resize(size_type num) +void resize(size_type num, CharType ch); + + + +size_type rfind(const string &str, +size_type indx = npos) const; + + + +size_type rfind(const CharType *str, size_type indx = npos) const; + + + +size_type rfind(const CharType *str, size_type indx, size_type len) const; + + +size_type rfind(CharType ch, +size_type indx = npos) const; + + + +size_type size( ) const; + +Description + +Replaces the range specified by start1 and end1 with the characters specified by start2 and end2. Returns *this. + +Sets the capacity of the string so that it is equal to at least num. +Changes the size of the string to that specified by num. If the string must be lengthened, then elements with the value specified by ch are added to the end. +Returns the index of the last occurrence of str within the invoking string. The search begins at index indx. npos is returned if no match +is found. +Returns the index of the last occurrence of str within the invoking string. The search begins at index indx. npos is returned if no match +is found. +Returns the index of the last occurrence of the first len characters of str within the invoking string. The search begins at index indx. npos is returned if no match is found. +Returns the index of the last occurrence of ch within the invoking string. The search begins at index indx. npos is returned if no match +is found. +Returns the number of characters currently in the string. + + + +Table 36-1. The String Member Functions (continued) +890 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +string substr(size_type indx = 0, size_type len = npos) const; + +void swap(string &str) + +Description + +Returns a substring of len characters beginning at indx within the invoking string. +Exchanges the characters stored in the invoking string with those in ob. + + + +Table 36-1. The String Member Functions (continued) + + + + +The char_traits Class +The class char_traits describes several attributes associated with a character. Its template specification is shown here: + +template struct char_traits + +Here, CharType specifies the type of the character. +The C++ library provides two specializations of char_traits: one for char characters and one for wchar_t characters. The char_traits class defines the following five +data types: + + +char_type int_type + +off_type pos_type +state_type + +The type of the character. This is a typedef for CharType. +An integer type that can hold a character of type char_type or the EOF character. +An integer type that can represent an offset in a stream. An integer type that can represent a position in a stream. +An object type that stores the conversion state. (Applies to multibyte characters.) + + +The member functions of char_traits are shown in Table 36-2. +C h a p t e r 3 6 : T h e S t r i n g C l a s s 891 + + + + +Member + +static void assign(char_type &ch1, +const char_type &ch2); +static char_type *assign(char_type *str, size_t num, char_type ch2); +static int compare(const char_type *str1, const char_type *str2, size_t num); + + + + +static char_type *copy(char_type *to, +const char_type *from, size_t num); +static int_type eof( ); + +static bool eq(const char_type &ch1, const char_type &ch2); + + +static bool eq_int_type(const int_type &ch1, const int_type &ch2); +static const char_type *find(const char_type *str, size_t num, +const char_type *ch); + + +static size_t length(const char_type *str); +static bool lt(const char_type &ch1, const char_type &ch2); + +Description + +Assigns ch2 to ch1. + +Assigns ch2 to the first num characters in str. Returns str. + +Compares num characters in str1 to those in str2. Returns zero if the strings are same. Otherwise, returns less than zero if str1 is less than str2 or greater than zero if str1 is greater than str2. +Copies num characters from from to to. Returns to. + +Returns the end-of-file character. +Compares ch1 to ch2 and returns true if the characters are the same and false otherwise. +Returns true if ch1 equals ch2 and false otherwise. +Returns a pointer to the first occurrence of ch in str. Only the first num characters are examined. Returns a null pointer on failure. +Returns the length of str. +Returns true if ch1 is less than ch2 and false otherwise. + + + +Table 36-2. The char_traits Member Functions +892 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Member + +static char_type *move(char_type *to, +const char_type *from, size_t num); +static int_type not_eof(const int_type &ch); + + + +static state_type get_state(pos_type pos); +static char_type to_char_type(const int_type &ch); + +static int_type to_int_type(const char_type &ch); + +Description + +Copies num characters from from to to. Returns to. + +If ch is not the EOF character, then ch is returned. Otherwise, the EOF character is returned. +Returns the conversion state. +Converts ch into a char_type and returns the result. +Converts ch into an int_type and returns the result. + + + +Table 36-2. The char_traits Member Functions (continued) + +C++ + + + + +Chapter 37 The Numeric Classes + + + + + + + + + + + + + + +893 +894 C + + : T h e C o m p l e t e R e f e r e n c e + + +ne of the features added during the standardization of C++ is the numeric class library. These classes aid in the development of numerical programs. Several of the member functions of these classes parallel the stand-alone functions +O +inherited from the C library. The difference is that many of the numeric functions described here operate on objects of type valarray, which is essentially an array of values, or on objects of type complex, which represent complex numbers. By including the numeric classes, Standard C++ has expanded the scope of programming tasks to which it can be conveniently applied. + + +The complex Class +The header defines the complex class, which represents complex numbers. It also defines a series of functions and operators that operate on objects of type complex. +The template specification for complex is shown here: + +template class complex + +Here, T specifies the type used to store the components of a complex number. There are three predefined specializations of complex: + +class complex class complex +class complex + +The complex class has the following constructors: + +complex(const T &real = T( ), const T &imaginary = T( )); complex(const complex &ob); +template complex(const complex &ob); + +The first constructs a complex object with a real component of real and an imaginary component of imaginary. These values default to zero if not specified. The second creates a copy of ob. The third creates a complex object from ob. +The following operations are defined for complex objects: + ++ − * / −= += /= *= = == != +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 895 + + +The nonassignment operators are overloaded three ways. Once for operations involving a complex object on the left and a scalar object on the right, again for operations involving a scalar on the left and a complex object on the right, and finally for operations involving two complex objects. For example, the following types of operations are allowed: + +complex_ob + scalar scalar + complex_ob +complex_ob + complex_ob + +Operations involving scalar quantities affect only the real component. +Two member functions are defined for complex: real() and imag() . They are shown here: + +T real( ) const; T imag( ) const; + +The real() function returns the real component of the invoking object, and imag() returns the imaginary component. The functions shown in Table 37-1 are also defined for complex objects. +Here is a sample program that demonstrates complex. + +// Demonstrate complex. #include #include using namespace std; + +int main() { +complex cmpx1(1, 0); complex cmpx2(1, 1); + +cout << cmpx1 << " " << cmpx2 << endl; + +complex cmpx3 = cmpx1 + cmpx2; cout << cmpx3 << endl; + +cmpx3 += 10; +cout << cmpx3 << endl; + +return 0; } +896 C + + : T h e C o m p l e t e R e f e r e n c e + + +Its output is shown here: + +(1,0) (1,1) (2,1) (12,1) + + + + + + +Function + +template +T abs(const complex &ob); +template +T arg(const complex &ob); +template complex conj(const complex &ob); +template +complex cos(const complex &ob); +template complex +cosh(const complex &ob); +template complex +exp(const complex &ob); +template +T imag(const complex &ob); +template complex +log(const complex &ob); +template complex +log10(const complex &ob); +template +T norm(const complex &ob); + +Description + +Returns the absolute value of ob. + +Returns the phase angle of ob. + +Returns the conjugate of ob. + +Returns the cosine of ob. + +Returns the hyperbolic cosine of ob. + + +Returns the eob. + + +Returns the imaginary component of ob. +Returns the natural logarithm of ob. + + +Returns the base 10 logarithm of ob. + + +Returns the magnitude of ob squared. + + + +Table 37-1. Functions Defined for complex +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 897 + + + + +Function + +template complex +polar(const T &v, const T &theta=0); +template complex +pow(const complex &b, int e); +template complex +pow(const complex &b, const T &e); +template complex +pow(const complex &b, const complex &e); +template complex +pow(const T &b, +const complex &e); +template +T real(const complex &ob); +template +complex sin(const complex &ob); +template complex +sinh(const complex &ob); +template complex +sqrt(const complex &ob); +template complex +tan(const complex &ob); +template complex +tanh(const complex &ob); + +Description + +Returns a complex number that has the magnitude specified by v and a phase angle of theta. +Returns be. + + +Returns be. + + + +Returns be. + + + +Returns be. + + + +Returns the real component of ob. + +Returns the sine of ob. + +Returns the hyperbolic sine of ob. + + +Returns the square root of ob. + + +Returns the tangent of ob. + + +Returns the hyperbolic tangent of ob. + + +Table 37-1. Functions Defined for complex (continued) +898 C + + : T h e C o m p l e t e R e f e r e n c e + + +The valarray Class +The header defines a number of classes that support numeric arrays. The main class is valarray, and it defines a one-dimensional array of values. There are a wide variety of member operators and functions defined for it as well as a large number of nonmember functions. While the description of valarray that is given here will be sufficient for most programmers, those especially interested specifically in numeric processing will want to study valarray in greater detail. One other point: Although valarray is very large, most of its operations are intuitive. +The valarray class has this template specification: + +template class valarray + +It defines the following constructors: + +valarray( ); +explicit valarray (size_t num); valarray(const T &v, size_t num); valarray(const T *ptr, size_t num); valarray(const valarray &ob); valarray(const slice_array &ob); valarray(const gslice_array &ob); valarray(const mask_array &ob); valarray(const indirect_array &ob); + +Here, the first constructor creates an empty object. The second creates a valarray of length num. The third creates a valarray of length num initialized to v. The fourth creates a valarray of length num and initializes it with the elements pointed to by ptr. The fifth form creates a copy of ob. The next four constructors create a valarray from one of valarray's helper classes. These constructors are not used by your program, but are automatically called when certain valarray operations take place. +The following operators are defined for valarray: + ++ − * / −= += /= *= = == != << >> <<= >>= ^ ^= % %= ~ +! | |= & &= [ ] +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 899 + + +These operators have several overloaded forms that are described in the accompanying tables. +The member functions and operators defined by valarray are shown in Table 37-2. The nonmember operator functions defined for valarray are shown in Table 37-3. The transcendental functions defined for valarray are shown in Table 37-4. + + + + + +Function + +valarray apply(T func(T)) const; valarray apply(T func(const T &ob)) const; + +valarray cshift(int num) const; + + + +T max( ) const; + +T min( ) const + +valarray +&operator=(const valarray &ob); + + +valarray &operator=(const T &v); + + + +valarray +&operator=(const slice_array &ob); +valarray +&operator=(const gslice_array &ob); +valarray +&operator=(const mask_array &ob); + +Description + +Applies func( ) to the invoking array and returns an array containing the result. +Left-rotates the invoking array num places. (That is, it performs a circular shift left.) Returns an array containing the result. +Returns the maximum value in the invoking array. +Returns the minimum value in the invoking array. +Assigns the elements in ob to the corresponding elements in the invoking array. Returns a reference to the invoking array. +Assigns each element in the invoking array the value v. Returns a reference to the invoking array. +Assigns a subset. Returns a reference to the invoking array. +Assigns a subset. Returns a reference to the invoking array. +Assigns a subset. Returns a reference to the invoking array. + + + +Table 37-2. The Member Functions of valarray +900 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Function + +valarray +&operator=(const indirect_array &ob); +valarray operator+( ) const; + + +valarray operator−( ) const; + + +valarray operator~( ) const; + + + +valarray operator!( ) const; + + + +valarray &operator+=(const T &v) const; + + +valarray &operator−=(const T &v) const; + + +valarray &operator/=(const T &v) const; + + +valarray &operator*=(const T &v) const; + + +valarray &operator%=(const T &v) const; + +Description + +Assigns a subset. Returns a reference to the invoking array. +Unary plus applied to each element in the invoking array. Returns the resulting array. +Unary minus applied to each element in the invoking array. Returns the resulting array. +Unary bitwise NOT applied to each element in the invoking array. Returns the resulting array. +Unary logical NOT applied to each element in the invoking array. Returns the resulting array. +Adds v to each element in the invoking array. Returns a reference to the invoking array. +Subtracts v from each element in the invoking array. Returns a reference to the invoking array. +Divides each element in the invoking array by v. Returns a reference to the invoking array. +Multiplies each element in the invoking array by v. Returns a reference to the invoking array. +Assigns each element in the invoking array the remainder of a division by v. Returns a reference to the invoking array. + + + +Table 37-2. The Member Functions of valarray (continued) +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 901 + + + + + +Function + +valarray &operator^=(const T &v) const; + + +valarray &operator&=(const T &v) const; + + +valarray &operator|=(const T &v) const; + + +valarray &operator<<=(const T &v) const; + + +valarray &operator>>=(const T &v) const; + + +valarray +&operator+=(const valarray &ob) const; + + +valarray +&operator−=(const valarray &ob) const; + + + +valarray +&operator/=(const valarray &ob) const; + + + +valarray +&operator*=(const valarray &ob) const; + +Description + +XORs v with each element in the invoking array. Returns a reference to the invoking array. +ANDs v with each element in the invoking array. Returns a reference to the invoking array. +ORs v to each element in the invoking array. Returns a reference to the invoking array. +Left-shifts each element in the invoking array v places. Returns a reference to the invoking array. +Right-shifts each element in the invoking array v places. Returns a reference to the invoking array. +Corresponding elements of the invoking array and ob are added together. Returns a reference to the invoking array. +The elements in ob are subtracted from their corresponding elements in the invoking array. Returns a reference to the invoking array. +The elements in the invoking array are divided by their corresponding elements in ob. Returns a reference to the invoking array. +Corresponding elements of the invoking array and ob are multiplied together. Returns a reference to the invoking array. + + + +Table 37-2. The Member Functions of valarray (continued) +902 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Function + +valarray +&operator%=(const valarray &ob) const; + + + + +valarray +&operator^=(const valarray &ob) const; + + + +valarray +&operator&=(const valarray &ob) const; + + + +valarray +&operator|=(const valarray &ob) const; + + + +valarray +&operator<<=(const valarray &ob) const; + + + + +valarray +&operator>>=(const valarray &ob) const; + +Description + +The elements in the invoking array are divided by their corresponding elements in ob and the remainder is stored. Returns a reference to the invoking array. +The XOR operator is applied to corresponding elements in ob and the invoking array. Returns a reference to the invoking array. +The AND operator is applied to corresponding elements in ob and the invoking array. Returns a reference to the invoking array. +The OR operator is applied +to corresponding elements in ob and the invoking array. Returns a reference to the invoking array. +Elements in the invoking array are left-shifted by the number of places specified in the corresponding elements in ob. Returns a reference to the invoking array. +Elements in invoking array are right-shifted by the number of places specified in the corresponding elements in ob. Returns a reference to the invoking array. + + + +Table 37-2. The Member Functions of valarray (continued) +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 903 + + + + + +Function + +T &operator[ ] (size_t indx) ; + +T operator[ ] (size_t indx) const; + +slice_array operator[ ](slice ob); valarray operator[ ](slice ob) const; gslice_array operator[ ](const gslice &ob); valarray operator[ ](const gslice &ob) const; +mask_array +operator[ ](valarray &ob); +valarray +operator[ ](valarray &ob) const; +indirect_array +operator[ ](const valarray &ob); +valarray +operator[ ](const valarray &ob) const; +void resize(size_t num, T v = T( )); + + +size_t size( ) const; + + +valarray shift(int num) const; + + +T sum( ) const; + +Description + +Returns a reference to the element at the specified index. +Returns the value at the specified index. +Returns the specified subset. Returns the specified subset. Returns the specified subset. Returns the specified subset. Returns the specified subset. + +Returns the specified subset. + +Returns the specified subset. + +Returns the specified subset. + + +Resizes the invoking array. If elements must be added, they are assigned the value of v. +Returns the size (i.e., the number of elements) of the invoking array. +Shifts the invoking array left num places. Returns an array containing the result. +Returns the sum of the values stored in the invoking array. + + + +Table 37-2. The Member Functions of valarray (continued) +904 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Function + +template valarray operator+(const valarray ob, +const T &v); +template valarray operator+(const T &v, +const valarray ob); +template valarray operator+(const valarray ob1, +const valarray &ob2); + +template valarray operator−(const valarray ob, +const T &v); +template valarray operator−(const T &v, +const valarray ob); +template valarray operator−(const valarray ob1, +const valarray &ob2); + +template valarray operator*(const valarray ob, +const T &v); +template valarray operator*(const T &v, +const valarray ob); +template valarray operator*(const valarray ob1, +const valarray &ob2); + +Description + +Adds v to each element of ob. Returns an array containing the result. +Adds v to each element of ob. Returns an array containing the result. +Adds each element in ob1 to its corresponding element in ob2. Returns an array containing the result. +Subtracts v from each element of ob. Returns an array containing the result. +Subtracts each element of ob from v. Returns an array containing the result. +Subtracts each element in ob2 from its corresponding element in ob1. Returns an array containing the result. +Multiplies each element in ob by v. Returns an array containing the result. +Multiplies each element in ob by v. Returns an array containing the result. +Multiplies corresponding elements in ob1 by those in ob2. Returns an array containing the result. + + + +Table 37-3. The Nonmember Operator Functions Defined for valarray +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 905 + + + + +Function + +template valarray operator/(const valarray ob, +const T &v); +template valarray operator/(const T &v, +const valarray ob); +template valarray operator/(const valarray ob1, +const valarray &ob2); + +template valarray operator%(const valarray ob, +const T &v); + +template valarray operator%(const T &v, +const valarray ob); + +template valarray operator%(const valarray ob1, +const valarray &ob2); + + + +template valarray operator^(const valarray ob, +const T &v); +template valarray operator^(const T &v, +const valarray ob); + +Description + +Divides each element in ob by v. Returns an array containing the result. +Divides v by each element in ob. Returns an array containing the result. +Divides each element in ob1 by its corresponding element in ob2. Returns an array containing the result. +Obtains the remainder that results from dividing each element in ob by v. Returns an array containing the result. +Obtains the remainder that results from dividing v by each element in ob. Returns an array containing the result. +Obtains the remainder that results from dividing each element in ob1 by its corresponding element in ob2. Returns an array containing the result. +XORs each element in ob with v. Returns an array containing the result. +XORs each element in ob with v. Returns an array containing the result. + + + +Table 37-3. The Nonmember Operator Functions Defined for valarray (continued) +906 C + + : T h e C o m p l e t e R e f e r e n c e + + + + + +Function + +template valarray operator^(const valarray ob1, +const valarray &ob2); + +template valarray operator&(const valarray ob, +const T &v); +template valarray operator&(const T &v, +const valarray ob); +template valarray operator&(const valarray ob1, +const valarray &ob2); + +template valarray operator|(const valarray ob, +const T &v); +template valarray operator|(const T &v, +const valarray ob); +template valarray operator|(const valarray ob1, +const valarray &ob2); + +template valarray operator<<(const valarray ob, +const T &v); + +Description + +XORs each element in ob1 with its corresponding element in ob2. Returns an array containing the result. +ANDs each element in ob with v. Returns an array containing the result. +ANDs each element in ob with v. Returns an array containing the result. +ANDs each element in ob1 with its corresponding element in ob2. Returns an array containing the result. +ORs each element in ob with v. Returns an array containing the result. +ORs each element in ob with v. Returns an array containing the result. +ORs each element in ob1 with its corresponding element in ob2. Returns an array containing the result. +Left-shifts each element in ob by the number of places specified by v. Returns an array containing the result. + + + +Table 37-3. The Nonmember Operator Functions Defined for valarray (continued) +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 907 + + + + +Function + +template valarray operator<<(const T &v, +const valarray ob); + +template valarray operator<<(const valarray ob1, +const valarray &ob2); + + +template valarray operator>>(const valarray ob, +const T &v); + +template valarray operator>>(const T &v, +const valarray ob); + +template valarray operator>>(const valarray ob1, +const valarray &ob2); + + +template valarray operator==(const valarray ob, +const T &v); +template valarray operator==(const T &v, +const valarray ob); +template valarray operator==(const valarray ob1, +const valarray &ob2); + +Description + +Left-shifts v the number of places specified by the elements in ob. Returns an array containing the result. +Left-shifts each element in ob1 the number of places specified by its corresponding element in ob2. Returns an array containing the result. +Right-shifts each element in ob the number of places specified by v. Returns an array containing the result. +Right-shifts v the number of places specified by the elements in ob. Returns an array containing the result. +Right-shifts each element in ob1 the number of places specified by its corresponding element in ob2. Returns an array containing the result. +For every i, performs ob[i] == v. Returns a Boolean array containing the result. +For every i, performs v == ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] == ob2[i]. Returns a Boolean array containing the result. + + + +Table 37-3. The Nonmember Operator Functions Defined for valarray (continued) +908 C + + : T h e C o m p l e t e R e f e r e n c e + + + + + +Function + +template valarray operator!=(const valarray ob, +const T &v); +template valarray operator!=(const T &v, +const valarray ob); +template valarray operator!=(const valarray ob1, +const valarray &ob2); +template valarray operator<(const valarray ob, +const T &v); +template valarray operator<(const T &v, +const valarray ob); +template valarray operator<(const valarray ob1, +const valarray &ob2); +template valarray operator<=(const valarray ob, +const T &v); +template valarray operator<=(const T &v, +const valarray ob); +template valarray operator<=(const valarray ob1, +const valarray &ob2); +template valarray operator>(const valarray ob, +const T &v); + +Description + +For every i, performs ob[i] != v. Returns a Boolean array containing the result. +For every i, performs v != ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] != ob2[i]. Returns a Boolean array containing the result. +For every i, performs ob[i] < v. Returns a Boolean array containing the result. +For every i, performs v < ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] < ob2[i]. Returns a Boolean array containing the result. +For every i, performs ob[i] <= v. Returns a Boolean array containing the result. +For every i, performs v <= ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] <= ob2[i]. Returns a Boolean array containing the result. +For every i, performs ob[i] > v. Returns a Boolean array containing the result. + + + +Table 37-3. The Nonmember Operator Functions Defined for valarray (continued) +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 909 + + + + +Function + +template valarray operator>(const T &v, +const valarray ob); +template valarray operator>(const valarray ob1, +const valarray &ob2); +template valarray operator>=(const valarray ob, +const T &v); +template valarray operator>=(const T &v, +const valarray ob); +template valarray operator>=(const valarray ob1, +const valarray &ob2); +template valarray operator&&(const valarray ob, +const T &v); +template valarray operator&&(const T &v, +const valarray ob); +template valarray operator&&(const valarray ob1, +const valarray &ob2); +template valarray operator||(const valarray ob, +const T &v); +template valarray operator||(const T &v, +const valarray ob); +template valarray operator||(const valarray ob1, +const valarray &ob2); + +Description + +For every i, performs v > ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] > ob2[i]. Returns a Boolean array containing the result. +For every i, performs ob[i] >= v. Returns a Boolean array containing the result. +For every i, performs v >= ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] >= ob2[i]. Returns a Boolean array containing the result. +For every i, performs ob[i] && v. Returns a Boolean array containing the result. +For every i, performs v && ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] && ob2[i]. Returns a Boolean array containing the result. +For every i, performs ob[i] || v. Returns a Boolean array containing the result. +For every i, performs v || ob[i]. Returns a Boolean array containing the result. +For every i, performs ob1[i] || ob2[i]. Returns a Boolean array containing the result. + + +Table 37-3. The Nonmember Operator Functions Defined for valarray (continued) +910 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Function + +template valarray abs(const valarray &ob); + +template valarray acos(const valarray &ob); + +template valarray asin(const valarray &ob); + +template valarray atan(const valarray &ob); + +template valarray atan2(const valarray &ob1, +const valarray &ob2); +template valarray +atan2(const T &v, const valarray &ob); + +template valarray +atan2(const valarray &ob, const T &v); + +template valarray cos(const valarray &ob); + +template valarray cosh(const valarray &ob); + +template valarray exp(const valarray &ob); + +Description + +Obtains the absolute value of each element in ob and returns an array containing the result. +Obtains the arc cosine of each element in ob and returns an array containing the result. +Obtains the arc sine of each element in ob and returns an array containing the result. +Obtains the arc tangent of each element in ob and returns an array containing the result. +For all i, obtains the arc tangent of ob1[i] / ob2[i] and returns an array containing the result. +For all i, obtains the arc tangent of v / ob1[i] and returns an array containing the result. +For all i, obtains the arc tangent of ob1[i] / v and returns an array containing the result. +Obtains the cosine of each element in ob and returns an array containing the result. +Obtains the hyperbolic cosine of each element in ob and returns an array containing the result. +Computes exponential function for each element in ob and returns an array containing the result. + + +Table 37-4. Transcendental Functions Defined for valarray +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 911 + + + + +Function + +template valarray log(const valarray &ob); + +template valarray log10(const valarray &ob); + +template valarray pow(const valarray &ob1, +const valarray &ob2); +template valarray +pow(const T &v, const valarray &ob); + +template valarray +pow(const valarray &ob, const T &v); + +template valarray sin(const valarray &ob); + +template valarray sinh(const valarray &ob); + +template valarray sqrt(const valarray &ob); + +template valarray tan(const valarray &ob); + +template valarray tanh(const valarray &ob); + +Description + +Obtains the natural logarithm of each element in ob and returns an array containing the result. +Obtains the common logarithm of each element in ob and returns an array containing the result. +For all i, computes ob1[i]ob2[i] and returns an array containing the result. +For all i, computes vob[i] and returns an array containing the result. +For all i, computes ob1[i]v and returns an array containing the result. +Obtains the sine of each element in ob and returns an array containing the result. +Obtains the hyperbolic sine of each element in ob and returns an array containing the result. +Obtains the square root of each element in ob and returns an array containing the result. +Obtains the tangent of each element in ob and returns an array containing the result. +Obtains the hyperbolic tangent of each element in ob and returns an array containing the result. + + + +Table 37-4. Transcendental Functions Defined for valarray (continued) +912 C + + : T h e C o m p l e t e R e f e r e n c e + + +The following program demonstrates a few of the many capabilities of valarray. + +// Demonstrate valarray #include #include #include +using namespace std; + +int main() { +valarray v(10); int i; + +for(i=0; i<10; i++) v[i] = i; + +cout << "Original contents: "; for(i=0; i<10; i++) +cout << v[i] << " "; cout << endl; + +v = v.cshift(3); + +cout << "Shifted contents: "; for(i=0; i<10; i++) +cout << v[i] << " "; cout << endl; + +valarray vb = v < 5; +cout << "Those elements less than 5: "; for(i=0; i<10; i++) +cout << vb[i] << " "; cout << endl << endl; + +valarray fv(5); +for(i=0; i<5; i++) fv[i] = (double) i; + +cout << "Original contents: "; for(i=0; i<5; i++) +cout << fv[i] << " "; cout << endl; +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 913 + + + + +fv = sqrt(fv); + +cout << "Square roots: "; for(i=0; i<5; i++) +cout << fv[i] << " "; cout << endl; + +fv = fv + fv; +cout << "Double the square roots: "; for(i=0; i<5; i++) +cout << fv[i] << " "; cout << endl; + +fv = fv - 10.0; +cout << "After subtracting 10 from each element:\n"; for(i=0; i<5; i++) +cout << fv[i] << " "; cout << endl; + +return 0; } + +Its output is shown here: + +Original contents: 0 1 2 3 4 5 6 7 8 9 Shifted contents: 3 4 5 6 7 8 9 0 1 2 +Those elements less than 5: 1 1 0 0 0 0 0 1 1 1 + +Original contents: 0 1 2 3 4 +Square roots: 0 1 1.41421 1.73205 2 +Double the square roots: 0 2 2.82843 3.4641 4 After subtracting 10 from each element: +-10 -8 -7.17157 -6.5359 -6 + +The slice and gslice Classes +The header defines two utility classes called slice and gslice. These classes encapsulate a slice (i.e., a portion) from an array. These classes are used with the subset forms of valarray's operator[ ]. +914 C + + : T h e C o m p l e t e R e f e r e n c e + + +The slice class is shown here: + +class slice { public: +slice(); +slice(size_t start, size_t len, size_t interval); size_t start() const; +size_t size() const; size_t stride(); +}; + +The first constructor creates an empty slice. The second constructor creates a slice that specifies the starting element, the number of elements, and the interval between elements (that is, the stride). The member functions return these values. +Here is a program that demonstrates slice. + + +// Demonstrate slice #include #include using namespace std; + +int main() { +valarray v(10), result; int i; + +for(i=0; i<10; i++) v[i] = i; + +cout << "Contents of v: "; for(i=0; i<10; i++) +cout << v[i] << " "; cout << endl; + +result = v[slice(0,5,2)]; + +cout << "Contents of result: "; for(i=0; i &lens, const valarray &intervals); +size_t start() const; valarray size() const; valarray stride() const; +}; + +The first constructor creates an empty slice. The second constructor creates a slice that specifies the starting element, an array that specifies the number of elements, and an array that specifies the intervals between elements (that is, the strides). The number of lengths and intervals must be the same. The member functions return these parameters. This class is used to create multidimensional arrays from a valarray (which is always one-dimensional). +The following program demonstrates gslice. + + +// Demonstrate gslice() #include #include using namespace std; + +int main() { +valarray v(12), result; valarray len(2), interval(2); int i; + +for(i=0; i<12; i++) v[i] = i; + +len[0] = 3; len[1] = 3; +916 C + + : T h e C o m p l e t e R e f e r e n c e + + + +interval[0] = 2; interval[1] = 3; + +cout << "Contents of v: "; for(i=0; i<12; i++) +cout << v[i] << " "; cout << endl; + +result = v[gslice(0,len,interval)]; + +cout << "Contents of result: "; for(i=0; i defines four numeric algorithms that can be used to process the contents of containers. Each is examined here. + +accumulate +The accumulate() algorithm computes a summation of all of the elements within a specified range and returns the result. Its prototypes are shown here: + +template T accumulate(InIter start, InIter end, T v); template +T accumulate(InIter start, InIter end, T v, BinFunc func); + +Here, T is the type of values being operated upon. The first version computes the sum of all elements in the range start to end. The second version applies func to the running +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 917 + + +total. (That is, func specifies how the summation will occur.) The value of v provides an initial value to which the running total is added. +Here is an example that demonstrates accumulate() . + + +// Demonstrate accumulate() #include #include +#include using namespace std; + +int main() { +vector v(5); int i, total; + +for(i=0; i<5; i++) v[i] = i; + +total = accumulate(v.begin(), v.end(), 0); + +cout << "Summation of v is: " << total; + +return 0; } + +The following output is produced: + +Summation of v is: 10 + +adjacent_difference +The adjacent_difference() algorithm produces a new sequence in which each element is the difference between adjacent elements in the original sequence. (The first element in the result is the same as the original first element.) The prototypes for adjacent_difference() are shown here: + +template +outIter adjacent_difference(InIter start, InIter end, OutIter result); template +outIter adjacent_difference(InIter start, InIter end, OutIter result, BinFunc func); + +Here, start and end are iterators to the beginning and ending of the original sequence. The resulting sequence is stored in the sequence pointed to by result. In the first form, +918 C + + : T h e C o m p l e t e R e f e r e n c e + + +adjacent elements are subtracted, with the element at location n being subtracted from the element at location n+1. In the second, the binary function func is applied to adjacent elements. An iterator to the end of result is returned. +Here is an example that uses adjacent_difference() . + + +// Demonstrate adjacent_difference() #include +#include #include using namespace std; + +int main() { +vector v(10), r(10); int i; + +for(i=0; i<10; i++) v[i] = i*2; cout << "Original sequence: "; for(i=0; i<10; i++) +cout << v[i] << " "; cout << endl; + +adjacent_difference(v.begin(), v.end(), r.begin()); + +cout << "Resulting sequence: "; for(i=0; i<10; i++) +cout << r[i] << " "; + +return 0; } + +The output produced is shown here: + +Original sequence: 0 2 4 6 8 10 12 14 16 18 Resulting sequence: 0 2 2 2 2 2 2 2 2 2 + +As you can see, the resulting sequence contains the difference between the value of adjacent elements. + +inner_product +The inner_product() algorithm produces a summation of the product of corresponding elements in two sequences and returns the result. It has these prototypes: +C h a p t e r 3 7 : T h e N u m e r i c C l a s s e s 919 + + +template +T inner_product(InIter1 start1, InIter1 end1, InIter2 start2, T v); +template T inner_product(InIter1 start1, InIter1 end1, InIter2 start2, T v, +BinFunc1 func2, BinFunc2 func2); + +Here, start1 and end1 are iterators to the beginning and end of the first sequence. The iterator start2 is an iterator to the beginning of the second sequence. The value v provides an initial value to which the running total is added. In the second form, func1 specifies a binary function that determines how the running total is computed, and func2 specifies a binary function that determines how the two sequences are multiplied together. +Here is a program that demonstrates inner_product() . + +// Demonstrate inner_product() #include +#include #include using namespace std; + +int main() { +vector v1(5), v2(5); int i, total; + +for(i=0; i<5; i++) v1[i] = i; for(i=0; i<5; i++) v2[i] = i+2; + +total = inner_product(v1.begin(), v1.end(), v2.begin(), 0); + +cout << "Inner product is: " << total; + +return 0; } + +Here is the output: + +Inner product is: 50 + +partial_sum +The partial_sum() algorithm sums a sequence of values, putting the current total into each successive element of a new sequence as it goes. (That is, it creates a sequence that is a running total of the original sequence.) The first element in the result is the same as +920 C + + : T h e C o m p l e t e R e f e r e n c e + + +the first element in the original sequence. The prototypes for partial_sum() are shown here: + +template +OutIter partial_sum(InIter start, InIter end, OutIter result); template +OutIter partial_sum(InIter start, InIter end, OutIter result, BinFunc func); + +Here, start1 and end1 are iterators to the beginning and end of the original sequence. The iterator result is an iterator to the beginning of the resulting sequence. In the second form, func specifies a binary function that determines how the running total is computed. An iterator to the end of result is returned. +Here is an example of partial_sum() . + +// Demonstrate partial_sum() #include +#include #include using namespace std; + +int main() { +vector v(5), r(5); int i; + +for(i=0; i<10; i++) v[i] = i; cout << "Original sequence: "; for(i=0; i<5; i++) +cout << v[i] << " "; cout << endl; + +partial_sum(v.begin(), v.end(), r.begin()); + +cout << "Resulting sequence: "; for(i=0; i<5; i++) +cout << r[i] << " "; + +return 0; } + +Here is its output: + +Original sequence: 0 1 2 3 4 Resulting sequence: 0 1 3 6 10 + +C++ + + + + +Chapter 38 Exception Handling and Miscellaneous Classes + + + + + + + + + + + +921 +922 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter describes the exception handling classes. It also describes the auto_ptr and pair classes, and gives a brief introduction to the localization library. +T + + +Exceptions +The standard C++ library defines two headers that relate to exceptions: and . Exceptions are used to report error conditions. Each header is examined here. + + +The header defines classes, types, and functions that relate to exception handling. The classes defined by are shown here. + + +class exception { public: +exception() throw(); +exception(const bad_exception &ob) throw(); virtual ~exception() throw(); + +exception &operator=(const exception &ob) throw(); virtual const char *what(() const throw(); +}; + +class bad_exception: public exception { public: +bad_exception() throw(); +bad_exception(const bad_exception &ob) throw(); virtual ~bad_exception() throw(); + +bad_exception &operator=(const bad_exception &ob) throw(); virtual const char *what(() const throw(); +}; + +The exception class is a base for all exceptions defined by the C++ standard library. The bad_exception class is the type of exception thrown by the unexpected() function. In each, the member function what() returns a pointer to a null-terminated string that describes the exception. +Several important classes are derived from exception. The first is bad_alloc, thrown when the new operator fails. Next is bad_typeid. It is thrown when an illegal typeid +C h a p t e r 3 8 : E x c e p t i o n H a n d l i n g a n d M i s c e l l a n e o u s C l a s s e s 923 + + +expression is executed. Finally, bad_cast is thrown when an invalid dynamic cast is attempted. These classes contain the same members as exception. +The types defined by are: + + +Type + +terminate_handler +unexpected_handler + +Meaning + +typedef void (*terminate_handler) ( ); +typedef void (*unexpected_handler) ( ); + + +The functions declared in are shown in Table 38-1 + + +The header defines several standard exceptions that may be thrown by C++ +library functions and/or its run-time system. There are two general types of exceptions defined by : logic errors and run-time errors. Logic errors occur because of mistakes made by the programmer. Run-time errors occur because of mistakes in library functions or the run-time system, and are beyond programmer control. + + + + +Function + +terminate_handler set_terminate(terminate_handler fn) +throw( ); +unexpected_handler set_unexpected(unexpected_handler fn) +throw( ); +void terminate( ); + + +bool uncaught_exception( ); + +void unexpected( ); + +Description + +Sets the function specified by fn as the terminate handler. A pointer to the old terminate handler is returned. +Sets the function specified by fn as the unexpected handler. A pointer to the old unexpected handler is returned. +Calls the terminate handler when a fatal exception is unhandled. Calls abort() by default. +Returns true if an exception is uncaught. +Calls the unexpected exception handler when a function throws a disallowed exception. By default, terminate() is called. + + +Table 38-1. The Functions Defined Within +924 C + + : T h e C o m p l e t e R e f e r e n c e + + +The standard exceptions defined by C++ caused by logic errors are derived from the base class logic_error. These exceptions are shown here. + + +Exception + +domain_error invalid_argument length_error +out_of_range + +Meaning + +Domain error occurred. +Invalid argument used in function call. +An attempt was made to create an object that was too large. +An argument to a function was not in the required range. + + +The following run-time exceptions are derived from the base class runtime_error. + + +Exception + +overflow_error range_error +underflow_error + +Meaning + +Arithmetic overflow occurred. An internal range error occurred. +An underflow occurred. + + + +auto_ptr +A very interesting class is auto_ptr, which is declared in the header . An auto_ptr is a pointer that owns the object to which it points. Ownership of this object can be transferred to another auto_ptr, but some auto_ptr always owns the object. The key purpose of this scheme is to ensure that dynamically allocated objects are properly destroyed in all circumstances (that is, that the object's destructor is always properly executed). For example, when one auto_ptr object is assigned to another, only the target of the assignment will own the object. When the pointers are destroyed, the object will only be destroyed once, when the pointer holding ownership is destroyed. The main benefit of this approach is that dynamically allocated objects can be destroyed when an exception is handled. +The template specification for auto_ptr is shown here: + +template class auto_ptr + +Here, T specifies the type of pointer stored by the auto_ptr. Here are the constructors for auto_ptr: + +explicit auto_ptr(T *ptr = 0) throw( ); +C h a p t e r 3 8 : E x c e p t i o n H a n d l i n g a n d M i s c e l l a n e o u s C l a s s e s 925 + + +auto_ptr(const auto_ptr &ob) throw( ); + +template auto_ptr(const auto_ptr &ob) throw( ); + +The first constructor creates an auto_ptr to the object specified by ptr. The second constructor creates a copy of the auto_ptr specified by ob and transfers ownership to the new object. The third converts ob to type T (if possible) and transfers ownership. +The auto_ptr class defines the =, *, and −> operators. It also defines these two member functions: + +T *get( ) const throw( ); + +T *release( ) const throw( ); + +The get() function returns a pointer to the stored object. The release() function removes ownership of the stored object from the invoking auto_ptr and returns a pointer to the object. After a call to release() , the pointed-to object is not automatically destroyed when the auto_ptr object goes out-of-scope. +Here is a short program that demonstrates the use of auto_ptr. + + +// Demonstrate an auto_ptr. #include #include +using namespace std; + +class X { public: +X() { cout << "constructing\n"; } ~X() { cout << "destructing\n"; } void f() { cout << "Inside f()\n"; } +}; + +int main() { +auto_ptr p1(new X), p2; + +p2 = p1; // transfer ownership p2->f(); + +// can assign to a normal pointer X *ptr = p2.get(); +926 C + + : T h e C o m p l e t e R e f e r e n c e + + + +ptr->f(); + +return 0; } + +The output produced by this program is shown here: + +constructing Inside f() Inside f() destructing + +Notice that X's member function f() can be called either through an auto_ptr or through the "normal" pointer returned by get() . + + +The pair Class +The pair class is used to house pairs of objects, such as might be stored in an associative container. It has this template specification: + + +template struct pair { typedef Ktype first_type; +typedef Vtype second_type; Ktype first; +Vtype second; + +// constructors pair(); +pair(const Ktype &k, const Vtype &v); template pair(const &ob); +} + +The value in first typically contains a key, and the value in second typically contains the value associated with that key. +The following operators are defined for pair: ==, !=, <, <=, >, and >=. +You can construct a pair using either one of pair's constructors or by using make_pair() , which constructs a pair object based upon the types of the data used as parameters. make_pair() is a generic function that has this prototype: + +template +pair make_pair(const Ktype &k, const Vtype &v); +C h a p t e r 3 8 : E x c e p t i o n H a n d l i n g a n d M i s c e l l a n e o u s C l a s s e s 927 + + +As you can see, it returns a pair object consisting of values of the types specified by Ktype and Vtype. The advantage of make_pair() is that the types of the objects being stored are determined automatically by the compiler rather than being explicitly specified by you. +The pair class and the make_pair() function require the header . + + +Localization +Standard C++ provides an extensive localization class library. These classes allow an application to set or obtain information about the geopolitical environment in which it is executing. Thus, it defines such things as the format of currency, time and date, and collation order. It also provides for character classification. The localization library uses the header . It operates through a series of classes that define facets (bits of information associated with a locale). All facets are derived from the class facet, which is a nested class inside the locale class. +Frankly, the localization library is extraordinarily large and complex. A description of its features is beyond the scope of this book. While most programmers will not make direct use of the localization library, if you are involved in the preparation of internationalized programs, you will want to explore its features. + + +Other Classes of Interest +Here are a few other classes defined by the Standard C++ library that may be of interest. + + +Class + +type_info + + +numeric_limts + +raw_storage_iterator + +Description + +Used in conjunction with the typeid operator and fully described in Chapter 22. Uses the header . +Encapsulates various numeric limits. Uses the header . +Encapsulates allocation of uninitialized memory. Uses the header . + + + + + + + + + +This page intentionally left blank. +Part V Applying C++ + + + + + + + + + +art Five of this book provides two sample C++ applications. The purpose of this section is twofold. First, the examples +P +help illustrate the benefits of object-oriented programming. Second, they show how C++ can be applied to solve two very different types of programming problems. + + + + + + + + + + + + +929 + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 39 Integrating New Classes: +A Custom String Class + + + + + + + + + + + +931 +932 C + + : T h e C o m p l e t e R e f e r e n c e + + +his chapter designs and implements a small string class. As you know, Standard C++ provides a full-featured, powerful string class called basic_string. The purpose of this chapter is not to develop an alternative to this class, but rather to +T +give you insight into how any new data type can be easily added and integrated into the C++ environment. The creation of a string class is the quintessential example of this process. In the past, many programmers honed their object-oriented skills developing their own personal string classes. In this chapter, we will do the same. +While the example string class developed in this chapter is much simpler than the one supplied by Standard C++, it does have one advantage: it gives you full control over how strings are implemented and manipulated. You may find this useful in certain situations. It is also just plain fun to play with! + + +The StrType Class +Our string class is loosely modeled on the one provided by the standard library. Of course, it is not as large or as sophisticated. The string class defined here will meet the following requirements: + + Strings may be assigned by using the assignment operator. + Both string objects and quoted strings may be assigned to string objects. Concatenation of two string objects is accomplished with the + operator. Substring deletion is performed using the – operator. + String comparisons are performed with the relational operators. + String objects may be initialized by using either a quoted string or another string object. + Strings must be able to be of arbitrary and variable lengths. This implies that storage for each string is dynamically allocated. + A method of converting string objects to null-terminated strings will be provided. + +Although our string class will, in general, be less powerful than the standard string class, it does include one feature not defined by basic_string: substring deletion via the – operator. +The class that will manage strings is called StrType. Its declaration is shown here: + + +class StrType { char *p; +int size; public: +StrType(); +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 933 + + + +StrType(char *str); +StrType(const StrType &o); // copy constructor + +~StrType() { delete [] p; } + +friend ostream &operator<<(ostream &stream, StrType &o); friend istream &operator>>(istream &stream, StrType &o); + +StrType operator=(StrType &o); // assign a StrType object StrType operator=(char *s); // assign a quoted string + +StrType operator+(StrType &o); // concatenate a StrType object StrType operator+(char *s); // concatenate a quoted string friend StrType operator+(char *s, StrType &o); /* concatenate +a quoted string with a StrType object */ + +StrType operator-(StrType &o); // subtract a substring StrType operator-(char *s); // subtract a quoted substring + +// relational operations between StrType objects +int operator==(StrType &o) { return !strcmp(p, o.p); } int operator!=(StrType &o) { return strcmp(p, o.p); } int operator<(StrType &o) { return strcmp(p, o.p) < 0; } int operator>(StrType &o) { return strcmp(p, o.p) > 0; } +int operator<=(StrType &o) { return strcmp(p, o.p) <= 0; } int operator>=(StrType &o) { return strcmp(p, o.p) >= 0; } + +// operations between StrType objects and quoted strings int operator==(char *s) { return !strcmp(p, s); } +int operator!=(char *s) { return strcmp(p, s); } int operator<(char *s) { return strcmp(p, s) < 0; } int operator>(char *s) { return strcmp(p, s) > 0; } +int operator<=(char *s) { return strcmp(p, s) <= 0; } int operator>=(char *s) { return strcmp(p, s) >= 0; } + +int strsize() { return strlen(p); } // return size of string void makestr(char *s) { strcpy(s, p); } // make quoted string + +operator char *() { return p; } // conversion to char * }; +934 C + + : T h e C o m p l e t e R e f e r e n c e + + +The private part of StrType contains only two items: p and size. When a string object is created, memory to hold the string is dynamically allocated by using new, and a pointer to that memory is put in p. The string pointed to by p will be a normal, +null-terminated character array. Although it is not technically necessary, the size of the string is held in size. Because the string pointed to by p is a null-terminated string, it would be possible to compute the size of the string each time it is needed. However, as you will see, this value is used so often by the StrType member functions that the repeated calls to strlen() cannot be justified. +The next several sections detail how the StrType class works. + + +The Constructor and Destructor Functions +A StrType object may be declared in three different ways: without any initialization, with a quoted string as an initializer, or with a StrType object as an initializer. The constructors that support these three operations are shown here: + + +// No explicit initialization. StrType::StrType() { +size = 1; // make room for null terminator try { +p = new char[size]; +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(p, ""); } + +// Initialize using a quoted string. StrType::StrType(char *str) { +size = strlen(str) + 1; // make room for null terminator try { +p = new char[size]; +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(p, str); } + +// Initialize using a StrType object. StrType::StrType(const StrType &o) { +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 935 + + + +size = o.size; try { +p = new char[size]; +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(p, o.p); } + +When a StrType object is created with no initializer, it is assigned a null-string. Although the string could have been left undefined, knowing that all StrType objects contain a valid, null-terminated string simplifies several other member functions. +When a StrType object is initialized by a quoted string, first the size of the string is determined. This value is stored in size. Then, sufficient memory is allocated by new and the initializing string is copied into the memory pointed to by p. +When a StrType object is used to initialize another, the process is similar to using a quoted string. The only difference is that the size of the string is known and does not have to be computed. This version of the StrType constructor is also the class' copy constructor. This constructor will be invoked whenever one StrType object is used to initialize another. This means that it is called when temporary objects are created and when objects of type StrType are passed to functions. (See Chapter 14 for a discussion of copy constructors.) +Given the three preceding constructors, the following declarations are allowed: + + +StrType x("my string"); // use quoted string StrType y(x); // use another object +StrType z; // no explicit initialization + +The StrType destructor function simply frees the memory pointed to by p. + + +I/O on Strings +Because it is very common to want to input or output strings, the StrType class overloads the << and >> operators, as shown here: + + +// Output a string. +ostream &operator<<(ostream &stream, StrType &o) { +stream << o.p; +936 C + + : T h e C o m p l e t e R e f e r e n c e + + + +return stream; } + +// Input a string. +istream &operator>>(istream &stream, StrType &o) { +char t[255]; // arbitrary size - change if necessary int len; + +stream.getline(t, 255); len = strlen(t) + 1; + +if(len > o.size) { delete [] o.p; try { +o.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +o.size = len; } +strcpy(o.p, t); return stream; +} + + +As you can see, output is very simple. However, notice that the parameter o is passed by reference. Since StrType objects may be quite large, passing one by reference is more efficient than passing one by value. For this reason, all StrType parameters are passed by reference. (Any function you create that takes StrType parameters should probably do the same.) +Inputting a string proves to be a little more difficult than outputting one. First, the string is read using the getline() function. The length of the largest string that can be input is limited to 254 plus the null terminator. As the comments indicate, you can change this if you like. Characters are read until a newline is encountered. Once the string has been read, if the size of the new string exceeds that of the one currently held by o, that memory is released and a larger amount is allocated. The new string is then copied into it. +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 937 + + +The Assignment Functions +You can assign a StrType object a string in two ways. First, you can assign another StrType object to it. Second, you can assign it a quoted string. The two overloaded operator=() functions that accomplish these operations are shown here: + + +// Assign a StrType object to a StrType object. StrType StrType::operator=(StrType &o) +{ +StrType temp(o.p); + +if(o.size > size) { +delete [] p; // free old memory try { +p = new char[o.size]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +size = o.size; } + +strcpy(p, o.p); strcpy(temp.p, o.p); + +return temp; } + +// Assign a quoted string to a StrType object. StrType StrType::operator=(char *s) +{ +int len = strlen(s) + 1; if(size < len) { +delete [] p; try { +p = new char[len]; +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +938 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} +size = len; } +strcpy(p, s); return *this; +} + + +These two functions work by first checking to see if the memory currently pointed to by p of the target StrType object is sufficiently large to hold what will be copied to it. If not, the old memory is released and new memory is allocated. Then the string is copied into the object and the result is returned. These functions allow the following types of assignments: + + +StrType x("test"), y; + +y = x; // StrType object to StrType object + +x = "new string for x"; // quoted string to StrType object + +Each assignment function must return the value assigned (that is, the right-hand value) so that multiple assignments like this can be supported: + + +StrType x, y, z; + +x = y = z = "test"; + + +Concatenation +Concatenation of two strings is accomplished by using the + operator. The StrType class allows for the following three distinct concatenation situations: + + Concatenation of a StrType object with another StrType object Concatenation of a StrType object with a quoted string + Concatenation of a quoted string with a StrType object + +When used in these situations, the + operator produces as its outcome a StrType object that is the concatenation of its two operands. It does not actually modify either operand. +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 939 + + +The overloaded operator+() functions are shown here: + +// Concatenate two StrType objects. StrType StrType::operator+(StrType &o) { +int len; StrType temp; + +delete [] temp.p; +len = strlen(o.p) + strlen(p) + 1; temp.size = len; +try { +temp.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(temp.p, p); + +strcat(temp.p, o.p); + +return temp; } + +// Concatenate a StrType object and a quoted string. StrType StrType::operator+(char *s) +{ +int len; StrType temp; + +delete [] temp.p; + +len = strlen(s) + strlen(p) + 1; temp.size = len; +try { +temp.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; +940 C + + : T h e C o m p l e t e R e f e r e n c e + + + +exit(1); } +strcpy(temp.p, p); + +strcat(temp.p, s); + +return temp; } + +// Concatenate a quoted string and a StrType object. StrType operator+(char *s, StrType &o) +{ +int len; StrType temp; + +delete [] temp.p; + +len = strlen(s) + strlen(o.p) + 1; temp.size = len; +try { +temp.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(temp.p, s); + +strcat(temp.p, o.p); + +return temp; } + +All three functions work basically in the same way. First, a temporary StrType object called temp is created. This object will contain the outcome of the concatenation, and it is the object returned by the functions. Next, the memory pointed to by temp.p is freed. The reason for this is that when temp is created, only 1 byte of memory is allocated (as a placeholder) because there is no explicit initialization. Next, enough memory is allocated to hold the concatenation of the two strings. Finally, the two strings are copied into the memory pointed to by temp.p, and temp is returned. +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 941 + + +Substring Subtraction +A useful string function not found in basic_string is substring subtraction. As implemented by the StrType class, substring subtraction removes all occurrences of a specified substring from another string. Substring subtraction is accomplished by using the – operator. +The StrType class supports two cases of substring subtraction. One allows a StrType object to be subtracted from another StrType object. The other allows a quoted string to be removed from a StrType object. The two operator−( ) functions are shown here: + +// Subtract a substring from a string using StrType objects. StrType StrType::operator-(StrType &substr) +{ +StrType temp(p); char *s1; +int i, j; + +s1 = p; +for(i=0; *s1; i++) { +if(*s1!=*substr.p) { // if not first letter of substring temp.p[i] = *s1; // then copy into temp +s1++; } +else { +for(j=0; substr.p[j]==s1[j] && substr.p[j]; j++) ; if(!substr.p[j]) { // is substring, so remove it +s1 += j; i--; +} +else { // is not substring, continue copying temp.p[i] = *s1; +s1++; } +} } +temp.p[i] = '\0'; return temp; +} + +// Subtract quoted string from a StrType object. StrType StrType::operator-(char *substr) +{ +StrType temp(p); +942 C + + : T h e C o m p l e t e R e f e r e n c e + + + +char *s1; int i, j; + +s1 = p; +for(i=0; *s1; i++) { +if(*s1!=*substr) { // if not first letter of substring temp.p[i] = *s1; // then copy into temp +s1++; } +else { +for(j=0; substr[j]==s1[j] && substr[j]; j++) ; if(!substr[j]) { // is substring, so remove it +s1 += j; i--; +} +else { // is not substring, continue copying temp.p[i] = *s1; +s1++; } +} } +temp.p[i] = '\0'; return temp; +} + + +These functions work by copying the contents of the left-hand operand into temp, removing any occurrences of the substring specified by the right-hand operand during the process. The resulting StrType object is returned. Understand that neither operand is modified by the process. +The StrType class allows substring subtractions like these: + + +StrType x("I like C++"), y("like"); StrType z; + +z = x - y; // z will contain "I C++" + +z = x - "C++"; // z will contain "I like " + +// multiple occurrences are removed z = "ABCDABCD"; +x = z -"A"; // x contains "BCDBCD" +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 943 + + +The Relational Operators +The StrType class supports the full range of relational operations to be applied to strings. The overloaded relational operators are defined within the StrType class declaration. They are repeated here for your convenience: + + +// relational operations between StrType objects +int operator==(StrType &o) { return !strcmp(p, o.p); } int operator!=(StrType &o) { return strcmp(p, o.p); } int operator<(StrType &o) { return strcmp(p, o.p) < 0; } int operator>(StrType &o) { return strcmp(p, o.p) > 0; } +int operator<=(StrType &o) { return strcmp(p, o.p) <= 0; } int operator>=(StrType &o) { return strcmp(p, o.p) >= 0; } + +// operations between StrType objects and quoted strings int operator==(char *s) { return !strcmp(p, s); } +int operator!=(char *s) { return strcmp(p, s); } int operator<(char *s) { return strcmp(p, s) < 0; } int operator>(char *s) { return strcmp(p, s) > 0; } +int operator<=(char *s) { return strcmp(p, s) <= 0; } int operator>=(char *s) { return strcmp(p, s) >= 0; } + +The relational operations are very straightforward; you should have no trouble understanding their implementation. However, keep in mind that the StrType class implements comparisons between two StrType objects or comparisons that have a StrType object as the left operand and a quoted string as the right operand. If you want to be able to put the quoted string on the left and a StrType object on the right, you will need to add additional relational functions. +Given the overloaded relational operator functions defined by StrType, the following types of string comparisons are allowed: + + +StrType x("one"), y("two"), z("three"); + +if(x < y) cout << "x less than y"; + +if(z=="three") cout << "z equals three"; + +y = "o"; z = "ne"; +if(x==(y+z)) cout << "x equals y+z"; +944 C + + : T h e C o m p l e t e R e f e r e n c e + + +Miscellaneous String Functions +The StrType class defines three functions that make StrType objects integrate more completely with the C++ programming environment. They are strsize(), makestr(), and the conversion function operator char *() . These functions are defined within the StrType declaration and are shown here: + + +int strsize() { return strlen(p); } // return size of string void makestr(char *s) { strcpy(s, p); } // make quoted string operator char *(){ return p; } // conversion to char * + +The first two functions are easy to understand. As you can see, the strsize() function returns the length of the string pointed to by p. Since the length of the string might be different than the value stored in the size variable (because of an assignment of a shorter string, for example), the length is computed by calling strlen() . The makestr() function copies into a character array the string pointed to by p. This function is useful when you want to obtain a null-terminated string given a StrType object. +The conversion function operator char *() returns p, which is, of course, a pointer to the string contained within the object. This function allows a StrType object to be used anywhere that a null-terminated string can be used. For example, this is valid code: + + +StrType x("Hello"); char s[20]; + +// copy a string object using the strcpy() function strcpy(s, x); // automatic conversion to char * + +Recall that a conversion function is automatically executed when an object is involved in an expression for which the conversion is defined. In this case, because the prototype for the strcpy() function tells the compiler that its second argument is of type char *, the conversion from StrType to char * is automatically performed, causing a pointer to the string contained within x to be returned. This pointer is then used by strcpy() to copy the string into s. Because of the conversion function, you can use an StrType object in place of a null-terminated string as an argument to any function that takes an argument of type char *. +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 945 + + + +Note + +The conversion to char * does circumvent encapsulation, because once a function has a pointer to the object's string, it is possible for that function to modify the stringdirectly,bypassingtheStrTypememberfunctionsandwithoutthatobject's knowledge. For this reason, you must use the conversion to char * with care. The loss of encapsulation in this case is offset by increased utility and integration with existing library functions. However, such a trade-off is not always warranted. + + + +The Entire StrType Class +Here is a listing of the entire StrType class along with a short main() function that demonstrates its features: + + +#include #include #include #include using namespace std; + +class StrType { char *p; +int size; public: +StrType(); StrType(char *str); +StrType(const StrType &o); // copy constructor + +~StrType() { delete [] p; } + +friend ostream &operator<<(ostream &stream, StrType &o); friend istream &operator>>(istream &stream, StrType &o); + +StrType operator=(StrType &o); // assign a StrType object StrType operator=(char *s); // assign a quoted string + +StrType operator+(StrType &o); // concatenate a StrType object StrType operator+(char *s); // concatenate a quoted string friend StrType operator+(char *s, StrType &o); /* concatenate +a quoted string with a StrType object */ +946 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +StrType operator-(StrType &o); // subtract a substring StrType operator-(char *s); // subtract a quoted substring + +// relational operations between StrType objects +int operator==(StrType &o) { return !strcmp(p, o.p); } int operator!=(StrType &o) { return strcmp(p, o.p); } int operator<(StrType &o) { return strcmp(p, o.p) < 0; } int operator>(StrType &o) { return strcmp(p, o.p) > 0; } +int operator<=(StrType &o) { return strcmp(p, o.p) <= 0; } int operator>=(StrType &o) { return strcmp(p, o.p) >= 0; } + +// operations between StrType objects and quoted strings int operator==(char *s) { return !strcmp(p, s); } +int operator!=(char *s) { return strcmp(p, s); } int operator<(char *s) { return strcmp(p, s) < 0; } int operator>(char *s) { return strcmp(p, s) > 0; } +int operator<=(char *s) { return strcmp(p, s) <= 0; } int operator>=(char *s) { return strcmp(p, s) >= 0; } + +int strsize() { return strlen(p); } // return size of string +void makestr(char *s) { strcpy(s, p); } // null-terminated string operator char *() { return p; } // conversion to char * +}; + +// No explicit initialization. StrType::StrType() { +size = 1; // make room for null terminator try { +p = new char[size]; +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(p, ""); } + +// Initialize using a quoted string. StrType::StrType(char *str) { +size = strlen(str) + 1; // make room for null terminator try { +p = new char[size]; +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 947 + + + +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(p, str); } + +// Initialize using a StrType object. StrType::StrType(const StrType &o) { +size = o.size; try { +p = new char[size]; +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(p, o.p); } + +// Output a string. +ostream &operator<<(ostream &stream, StrType &o) { +stream << o.p; return stream; +} + +// Input a string. +istream &operator>>(istream &stream, StrType &o) { +char t[255]; // arbitrary size - change if necessary int len; + +stream.getline(t, 255); len = strlen(t) + 1; + +if(len > o.size) { delete [] o.p; try { +o.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +948 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} +o.size = len; } +strcpy(o.p, t); return stream; +} + +// Assign a StrType object to a StrType object. StrType StrType::operator=(StrType &o) +{ +StrType temp(o.p); + +if(o.size > size) { +delete [] p; // free old memory try { +p = new char[o.size]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +size = o.size; } + +strcpy(p, o.p); strcpy(temp.p, o.p); + +return temp; } + +// Assign a quoted string to a StrType object. StrType StrType::operator=(char *s) +{ +int len = strlen(s) + 1; if(size < len) { +delete [] p; try { +p = new char[len]; +} catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +size = len; +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 949 + + + +} +strcpy(p, s); return *this; +} + +// Concatenate two StrType objects. StrType StrType::operator+(StrType &o) { +int len; StrType temp; + +delete [] temp.p; +len = strlen(o.p) + strlen(p) + 1; temp.size = len; +try { +temp.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(temp.p, p); + +strcat(temp.p, o.p); + +return temp; } + +// Concatenate a StrType object and a quoted string. StrType StrType::operator+(char *s) +{ +int len; StrType temp; + +delete [] temp.p; + +len = strlen(s) + strlen(p) + 1; temp.size = len; +try { +temp.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +950 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} +strcpy(temp.p, p); + +strcat(temp.p, s); + +return temp; } + +// Concatenate a quoted string and a StrType object. StrType operator+(char *s, StrType &o) +{ +int len; StrType temp; + +delete [] temp.p; + +len = strlen(s) + strlen(o.p) + 1; temp.size = len; +try { +temp.p = new char[len]; } catch (bad_alloc xa) { +cout << "Allocation error\n"; exit(1); +} +strcpy(temp.p, s); + +strcat(temp.p, o.p); + +return temp; } + +// Subtract a substring from a string using StrType objects. StrType StrType::operator-(StrType &substr) +{ +StrType temp(p); char *s1; +int i, j; + +s1 = p; +for(i=0; *s1; i++) { +if(*s1!=*substr.p) { // if not first letter of substring temp.p[i] = *s1; // then copy into temp +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 951 + + + +s1++; } +else { +for(j=0; substr.p[j]==s1[j] && substr.p[j]; j++) ; if(!substr.p[j]) { // is substring, so remove it +s1 += j; i--; +} +else { // is not substring, continue copying temp.p[i] = *s1; +s1++; } +} } +temp.p[i] = '\0'; return temp; +} + +// Subtract quoted string from a StrType object. StrType StrType::operator-(char *substr) +{ +StrType temp(p); char *s1; +int i, j; + +s1 = p; +for(i=0; *s1; i++) { +if(*s1!=*substr) { // if not first letter of substring temp.p[i] = *s1; // then copy into temp +s1++; } +else { +for(j=0; substr[j]==s1[j] && substr[j]; j++) ; if(!substr[j]) { // is substring, so remove it +s1 += j; i--; +} +else { // is not substring, continue copying temp.p[i] = *s1; +s1++; } +} +952 C + + : T h e C o m p l e t e R e f e r e n c e + + + +} +temp.p[i] = '\0'; return temp; +} + +int main() { +StrType s1("A sample session using string objects.\n"); StrType s2(s1); +StrType s3; char s[80]; + +cout << s1 << s2; + +s3 = s1; cout << s1; + +s3.makestr(s); +cout << "Convert to a string: " << s; + +s2 = "This is a new string."; cout << s2 << endl; + +StrType s4(" So is this."); s1 = s2+s4; +cout << s1 << endl; + +if(s2==s3) cout << "Strings are equal.\n"; if(s2!=s3) cout << "Strings are not equal.\n"; if(s1s4) cout << "s1 greater than s4\n"; +if(s1<=s4) cout << "s1 less than or equals s4\n"; if(s1>=s4) cout << "s1 greater than or equals s4\n"; + +if(s2 > "ABC") cout << "s2 greater than ABC\n\n"; + +s1 = "one two three one two three\n"; s2 = "two"; +cout << "Initial string: " << s1; +cout << "String after subtracting two: "; s3 = s1 - s2; +cout << s3; +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 953 + + + + +cout << endl; +s4 = "Hi there!"; +s3 = s4 + " C++ strings are fun\n"; cout << s3; +s3 = s3 - "Hi there!"; s3 = "Aren't" + s3; cout << s3; + +s1 = s3 - "are "; cout << s1; +s3 = s1; + +cout << "Enter a string: "; cin >> s1; +cout << s1 << endl; +cout << "s1 is " << s1.strsize() << " characters long.\n"; + +puts(s1); // convert to char * + +s1 = s2 = s3; +cout << s1 << s2 << s3; + +s1 = s2 = s3 = "Bye "; cout << s1 << s2 << s3; + +return 0; } + +The preceding program produces this output: + +A sample session using string objects. A sample session using string objects. A sample session using string objects. +Convert to a string: A sample session using string objects. This is a new string. +This is a new string. So is this. Strings are not equal. +s1 greater than s4 +s1 greater than or equals s4 s2 greater than ABC +954 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +Initial string: one two three one two three String after subtracting two: one three one three + +Hi there! C++ strings are fun Aren't C++ strings are fun Aren't C++ strings fun +Enter a string: I like C++ s1 is 10 characters long. I like C++ +Aren't C++ strings fun Aren't C++ strings fun Aren't C++ strings fun Bye Bye Bye + +This output assumes that the string "I like C++" was entered by the user when prompted for input. +To have easy access to the StrType class, remove the main() function and put the rest of the preceding listing into a file called STR.H. Then, just include this header file with any program in which you want to use StrType. + + +Using the StrType Class +To conclude this chapter, two short examples are given that illustrate the StrType class. As you will see, because of the operators defined for it and because of its conversion function to char *, StrType is fully integrated into the C++ programming environment. That is, it can be used like any other type defined by Standard C++. +The first example creates a simple thesaurus by using StrType objects. It first creates a two-dimensional array of StrType objects. Within each pair of strings, the first contains the key word, which may be looked up. The second string contains a list of alternative or related words. The program prompts for a word, and if the word is in the thesaurus, alternatives are displayed. This program is very simple, but notice how clean and clear the string handling is because of the use of the StrType class and its operators. (Remember, the header file STR.H contains the StrType class.) + + +#include "str.h" #include using namespace std; + +StrType thesaurus[][2] = { "book", "volume, tome", +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 955 + + + +"store", "merchant, shop, warehouse", "pistol", "gun, handgun, firearm", "run", "jog, trot, race", +"think", "muse, contemplate, reflect", "compute", "analyze, work out, solve" "", "" +}; + +int main() { +StrType x; + +cout << "Enter word: "; cin >> x; + +int i; +for(i=0; thesaurus[i][0]!=""; i++) if(thesaurus[i][0]==x) cout << thesaurus[i][1]; + +return 0; } + +The next example uses a StrType object to check if there is an executable version of a program, given its filename. To use the program, specify the filename without an extension on the command line. The program then repeatedly tries to find an executable file by that name by adding an extension, trying to open that file, and reporting the results. (If the file does not exist, it cannot be opened.) After each extension is tried, the extension is subtracted from the filename and a new extension is added. Again, the StrType class and its operators make the string manipulations clean and easy to follow. + + +#include "str.h" #include #include using namespace std; + +// executable file extensions char ext[3][4] = { +"EXE", "COM", "BAT" +956 C + + : T h e C o m p l e t e R e f e r e n c e + + + +}; + +int main(int argc, char *argv[]) { +StrType fname; int i; + +if(argc!=2) { +cout << "Usage: fname\n"; return 1; +} + +fname = argv[1]; + +fname = fname + "."; // add period for(i=0; i<3; i++) { +fname = fname + ext[i]; // add extension cout << "Trying " << fname << " "; ifstream f(fname); +if(f) { +cout << "- Exists\n"; f.close(); +} +else cout << "- Not found\n"; +fname = fname - ext[i]; // subtract extension } + +return 0; } + +For example, if this program is called ISEXEC, and assuming that TEST.EXE exists, the command line ISEXEC TEST produces this output: + + +Trying TEST.EXE - Exists Trying TEST.COM - Not found Trying TEST.BAT - Not found + +One thing to notice about the program is that an StrType object is used by the ifstream constructor. This works because the conversion function char *() is automatically invoked. As this situation illustrates, by the careful application of C++ features, you can achieve significant integration between C++'s standard types and types that you create. +C h a p t e r 3 9 : I n t e g r a t i n g N e w C l a s s e s : A C u s t o m S t r i n g C l a s s 957 + + +Creating and Integrating New Types in General As the StrType class has demonstrated, it is actually quite easy to create and integrate a new data type into the C++ environment. To do so, just follow these steps. + +1. Overload all appropriate operators, including the I/O operators. 2. Define all appropriate conversion functions. +3. Provide constructors that allow objects to be easily created in a variety of situations. + +Part of the power of C++ is its extensibility. Don't be afraid to take advantage of it. + + +A Challenge +Here is an interesting challenge that you might enjoy. Try implementing StrType using the STL. That is, use a container to store the characters that comprise a string. Use iterators to operate on the strings, and use the algorithms to perform the various string manipulations. + + + + + + + + + +This page intentionally left blank. + +C++ + + + + +Chapter 40 An Object-Oriented +Expression Parser + + + + + + + + + + + +959 +960 C + + : T h e C o m p l e t e R e f e r e n c e + + +hile Standard C++ is quite extensive, there are still a few things that it does not provide. In this chapter we will examine one of them: the expression parser. An expression parser is used to evaluate an algebraic expression, such as +W +(10 – 8) * 3. Expression parsers are quite useful and are applicable to a wide range of applications. They are also one of programming's more elusive entities. For various reasons, the procedures used to create an expression parser are not widely taught or disseminated. Indeed, many otherwise accomplished programmers are mystified by the process of expression parsing. +Expression parsing is actually very straightforward, and in many ways easier than other programming tasks. The reason for this is that the task is well defined and works according to the strict rules of algebra. This chapter will develop what is commonly referred to as a recursive-descent parser and all the necessary support routines that enable you to evaluate complex numeric expressions. Three versions of the parser +will be created. The first two are nongeneric versions. The final one is generic and may be applied to any numeric type. However, before any parser can be developed, a brief overview of expressions and parsing is necessary. + + +Expressions +Since an expression parser evaluates an algebraic expression, it is important to understand what the constituent parts of an expression are. Although expressions can be made up of all types of information, this chapter deals only with numeric expressions. For our purposes, numeric expressions are composed of the following items: + + Numbers + The operators +, −, /, *, ^, %, = Parentheses + Variables + +For our parser, the operator ^ indicates exponentiation (not the XOR as it does in C++), and = is the assignment operator. These items can be combined in expressions according to the rules of algebra. Here are some examples: + +10 – 8 +(100 – 5) * 14/6 a + b – c +10^5 +a = 10 – b +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 961 + + +Assume this precedence for each operator: + + +highest + + + + + +lowest + ++ – (unary) ^ +* / % + – += + + +Operators of equal precedence evaluate from left to right. +In the examples in this chapter, all variables are single letters (in other words, 26 variables, A through Z, are available). The variables are not case sensitive (a and A are treated as the same variable). For the first version of the parser, all numeric values are elevated to double, although you could easily write the routines to handle other types of values. Finally, to keep the logic clear and easy to understand, only a minimal amount of error checking is included. + + +Parsing Expressions: The Problem +If you have not thought much about the problem of expression parsing, you might assume that it is a simple task. However, to better understand the problem, try to evaluate this sample expression: + +10 – 2 * 3 + +You know that this expression is equal to the value 4. Although you could easily create a program that would compute that specific expression, the question is how to create a program that gives the correct answer for any arbitrary expression. At first you might think of a routine something like this: + +a = get first operand while(operands present) { +op = get operator +b = get second operand a = a op b +} +962 C + + : T h e C o m p l e t e R e f e r e n c e + + +This routine gets the first operand, the operator, and the second operand to perform the first operation and then gets the next operator and operand to perform the next operation, and so on. However, if you use this basic approach, the expression 10 – 2 * 3 evaluates to 24 (that is, 8 * 3) instead of 4 because this procedure neglects the precedence of the operators. You cannot just take the operands and operators in order from left to right because the rules of algebra dictate that multiplication must be done before subtraction. Some beginners think that this problem can be easily overcome, and sometimes, in very restricted cases, it can. But the problem only gets worse when you add parentheses, exponentiation, variables, unary operators, and the like. +Although there are a few ways to write a routine that evaluates expressions, the one developed here is the one most easily written by a person. It is also the most common. The method used here is called a recursive-descent parser, and in the course of this chapter you will see how it got its name. (Some of the other methods used to write parsers employ complex tables that must be generated by another computer program. These are sometimes called table-driven parsers.) + + +Parsing an Expression +There are a number of ways to parse and evaluate an expression. For use with a recursive-descent parser, think of expressions as recursive data structures—that is, expressions that are defined in terms of themselves. If, for the moment, we assume that expressions can only use +, −, *, /, and parentheses, all expressions can be defined with the following rules: + +expression −> term [+ term] [− term] term −> factor [* factor] [/ factor] +factor −> variable, number, or (expression) + +The square brackets designate an optional element, and the -> means produces. In fact, the rules are usually called the production rules of the expression. Therefore, you could say: "Term produces factor times factor or factor divided by factor" for the definition of term. Notice that the precedence of the operators is implicit in the way an expression is defined. +The expression + +10 + 5 * B +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 963 + + +has two terms: 10, and 5 * B . Thesecond term contains two factors: 5 and B. These factors consist of one number and one variable. +On the other hand, the expression + +14 * (7 – C) + +hastwofactors:14and(7–C).Thefactorsconsistofonenumberandoneparenthesized expression.Theparenthesizedexpressioncontainstwoterms:onenumberandonevariable. +This process forms the basis for a recursive-descent parser, which is a set of mutually recursive functions that work in a chainlike fashion and implement the production rules. At each appropriate step, the parser performs the specified operations in the algebraically correct sequence. To see how the production rules are used to parse an expression, let's work through an example using this expression: + +9/3 – (100 + 56) + +Here is the sequence that you will follow: + +1. Get the first term, 9/3. +2. Get each factor and divide the integers. The resulting value is 3. +3. Get the second term, (100 + 56). At this point, start recursively analyzing the second subexpression. +4. Get each term and add. The resulting value is 156. +5. Return from the recursive call, and subtract 156 from 3. The answer is –153. + +If you are a little confused at this point, don't feel bad. This is a fairly complex concept that takes some getting used to. There are two basic things to remember about this recursive view of expressions. First, the precedence of the operators is implicit in the way the production rules are defined. Second, this method of parsing and evaluating expressions is very similar to the way humans evaluate mathematical expressions. +The remainder of this chapter develops three parsers. The first will parse and evaluate floating-point expressions of type double that consist only of constant values. Next, this parser is enhanced to support the use of variables. Finally, in the third version, the parser is implemented as a template class that can be used to parse expressions of any type. +964 C + + : T h e C o m p l e t e R e f e r e n c e + + +The Parser Class +The expression parser is built upon the parser class. The first version of parser is shown here. Subsequent versions of the parser build upon it. + + +class parser { +char *exp_ptr; // points to the expression char token[80]; // holds current token +char tok_type; // holds token's type + +void eval_exp2(double &result); void eval_exp3(double &result); void eval_exp4(double &result); void eval_exp5(double &result); void eval_exp6(double &result); void atom(double &result); +void get_token(); +void serror(int error); int isdelim(char c); +public: parser(); +double eval_exp(char *exp); }; + +The parser class contains three private member variables. The expression to be evaluated is contained in a null-terminated string pointed to by exp_ptr. Thus, the parser evaluates expressions that are contained in standard ASCII strings. For example, the following strings contain expressions that the parser can evaluate: + +"10 − 5" + +"2 * 3.3 / (3.1416 * 3.3)" + +When the parser begins execution, exp_ptr must point to the first character in the expression string. As the parser executes, it works its way through the string until the null-terminator is encountered. +The meaning of the other two member variables, token and tok_type, are described in the next section. +The entry point to the parser is through eval_exp() , which must be called with a pointer to the expression to be analyzed. The functions eval_exp2() through eval_exp6() along with atom() form the recursive-descent parser. They implement an enhanced set of the expression production rules discussed earlier. In subsequent versions of the parser, a function called eval_exp1() will also be added. +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 965 + + +The serror() handles syntax errors in the expression. The functions get_token() and isdelim() are used to dissect the expression into its component parts, as described in the next section. + + +Dissecting an Expression +In order to evaluate expressions, you need to be able to break an expression into its components. Since this operation is fundamental to parsing, let's look at it before examining the parser itself. +Each component of an expression is called a token. For example, the expression + +A * B – (W + 10) + +contains the tokens A, *, B, –, (, W, +, 10, and ). Each token represents an indivisible unit of the expression. In general, you need a function that sequentially returns each token in the expression individually. The function must also be able to skip over spaces and tabs and detect the end of the expression. The function that we will use to perform this task is called get_token() , which is a member function of the parser class. +Besides the token, itself, you will also need to know what type of token is being returned. For the parser developed in this chapter, you need only three types: VARIABLE, NUMBER, and DELIMITER. (DELIMITER is used for both operators and parentheses.) +The get_token() function is shown here. It obtains the next token from the expression pointed to by exp_ptr and puts it into the member variable token. It puts the type of the token into the member variable tok_type. + + +// Obtains the next token. void parser::get_token() +{ +register char *temp; + +tok_type = 0; temp = token; *temp = '\0'; + +if(!*exp_ptr) return; // at end of expression + +while(isspace(*exp_ptr)) ++exp_ptr; // skip over white space + +if(strchr("+-*/%^=()", *exp_ptr)){ tok_type = DELIMITER; +966 C + + : T h e C o m p l e t e R e f e r e n c e + + + +// advance to next char *temp++ = *exp_ptr++; +} +else if(isalpha(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = VARIABLE; +} +else if(isdigit(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = NUMBER; +} + +*temp = '\0'; } + +// Return true if c is a delimiter. int parser::isdelim(char c) +{ +if(strchr(" +-/*%^=()", c) || c==9 || c=='\r' || c==0) return 1; +return 0; } + +Look closely at the preceding functions. After the first few initializations, get_token() checks to see if the null terminating the expression has been found. It does so by checking the character pointed to by exp_ptr. Since exp_ptr is a pointer to the expression being analyzed, if it points to a null, the end of the expression has been reached. If there are still more tokens to retrieve from the expression, get_token() first skips over any leading spaces. Once the spaces have been skipped, exp_tpr is pointing to either a number, a variable, an operator, or if trailing spaces end the expression, a null. If the next character is an operator, it is returned as a string in token, and DELIMITER is placed in tok_type. If the next character is a letter instead, it is assumed to be one of the variables. It is returned as a string in token, and tok_type is assigned the value VARIABLE. If the next character is a digit, the entire number is read and placed in its string form in token and its type is NUMBER. Finally, if the next character is none of the preceding, it is assumed that the end of the expression has been reached. In this case, token is null, which signals the end of the expression. +As stated earlier, to keep the code in this function clean, a certain amount of error checking has been omitted and some assumptions have been made. For example, any unrecognized character may end an expression. Also, in this version, variables may be of any length, but only the first letter is significant. You can add more error checking and other details as your specific application dictates. +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 967 + + +To better understand the tokenization process, study what it returns for each token and type in the following expression: + +A + 100 – (B * C) /2 + + +Token + +A + 100 − +( +LE BVARIAB * +C ) / 2 +null + +Token type + +VARIABLE DELIMITER NUMBER DELIMITER DELIMITER + +DELIMITER VARIABLE DELIMITER DELIMITER NUMBER +null + + +Remember that token always holds a null-terminated string, even if it contains just a single character. + + +A Simple Expression Parser +Here is the first version of the parser. It can evaluate expressions that consist solely of constants, operators, and parentheses. It cannot accept expressions that contain variables. + + +/* This module contains the recursive descent parser that does not use variables. +*/ + +#include #include #include #include +968 C + + : T h e C o m p l e t e R e f e r e n c e + + + +using namespace std; + +enum types { DELIMITER = 1, VARIABLE, NUMBER}; + +class parser { +char *exp_ptr; // points to the expression char token[80]; // holds current token +char tok_type; // holds token's type + +void eval_exp2(double &result); void eval_exp3(double &result); void eval_exp4(double &result); void eval_exp5(double &result); void eval_exp6(double &result); void atom(double &result); +void get_token(); +void serror(int error); int isdelim(char c); +public: parser(); +double eval_exp(char *exp); }; + +// parser constructor parser::parser() +{ +exp_ptr = NULL; } + +// Parser entry point. +double parser::eval_exp(char *exp) { +double result; + +exp_ptr = exp; + +get_token(); if(!*token) { +serror(2); // no expression present return 0.0; +} eval_exp2(result); +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 969 + + + +if(*token) serror(0); // last token must be null return result; +} + +// Add or subtract two terms. +void parser::eval_exp2(double &result) { +register char op; double temp; + +eval_exp3(result); +while((op = *token) == '+' || op == '-') { get_token(); +eval_exp3(temp); switch(op) { +case '-': +result = result - temp; break; +case '+': +result = result + temp; break; +} } +} + +// Multiply or divide two factors. void parser::eval_exp3(double &result) { +register char op; double temp; + +eval_exp4(result); +while((op = *token) == '*' || op == '/' || op == '%') { get_token(); +eval_exp4(temp); switch(op) { +case '*': +result = result * temp; break; +case '/': +result = result / temp; break; +970 C + + : T h e C o m p l e t e R e f e r e n c e + + + +case '%': +result = (int) result % (int) temp; break; +} } +} + +// Process an exponent +void parser::eval_exp4(double &result) { +double temp, ex; register int t; + +eval_exp5(result); if(*token== '^') { +get_token(); eval_exp4(temp); ex = result; if(temp==0.0) { +result = 1.0; return; +} +for(t=(int)temp-1; t>0; --t) result = result * (double)ex; } +} + +// Evaluate a unary + or -. +void parser::eval_exp5(double &result) { +register char op; + +op = 0; +if((tok_type == DELIMITER) && *token=='+' || *token == '-') { op = *token; +get_token(); } +eval_exp6(result); +if(op=='-') result = -result; } + +// Process a parenthesized expression. void parser::eval_exp6(double &result) +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 971 + + + +{ +if((*token == '(')) { get_token(); eval_exp2(result); if(*token != ')') +serror(1); get_token(); +} +else atom(result); } + +// Get the value of a number. void parser::atom(double &result) { +switch(tok_type) { case NUMBER: +result = atof(token); get_token(); +return; default: +serror(0); } +} + +// Display a syntax error. void parser::serror(int error) { +static char *e[]= { "Syntax Error", +"Unbalanced Parentheses", "No expression Present" +}; +cout << e[error] << endl; } + +// Obtain the next token. void parser::get_token() { +register char *temp; + +tok_type = 0; temp = token; +972 C + + : T h e C o m p l e t e R e f e r e n c e + + + +*temp = '\0'; + +if(!*exp_ptr) return; // at end of expression + +while(isspace(*exp_ptr)) ++exp_ptr; // skip over white space + +if(strchr("+-*/%^=()", *exp_ptr)){ tok_type = DELIMITER; +// advance to next char *temp++ = *exp_ptr++; +} +else if(isalpha(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = VARIABLE; +} +else if(isdigit(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = NUMBER; +} + +*temp = '\0'; } + +// Return true if c is a delimiter. int parser::isdelim(char c) +{ +if(strchr(" +-/*%^=()", c) || c==9 || c=='\r' || c==0) return 1; +return 0; } + +The parser as it is shown can handle the following operators: +, –, *, /, %. In addition, it can handle integer exponentiation (^) and the unary minus. The parser can also deal with parentheses correctly. The actual evaluation of an expression takes place in the mutually recursive functions eval_exp2() through eval_exp6() , plus the atom() function, which returns the value of a number. The comments at the start of each function describe what role it plays in parsing the expression. +The simple main() function that follows demonstrates the use of the parser. + + +int main() { +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 973 + + + +char expstr[80]; + +cout << "Enter a period to stop.\n"; + +parser ob; // instantiate a parser + +for(;;) { +cout << "Enter expression: "; cin.getline(expstr, 79); if(*expstr=='.') break; +cout << "Answer is: " << ob.eval_exp(expstr) << "\n\n"; }; + +return 0; } + +Here is a sample run. + +Enter a period to stop. Enter expression: 10-2*3 Answer is: 4 + +Enter expression: (10-2)*3 Answer is: 24 + +Enter expression: 10/3 Answer is: 3.33333 + +Enter expression: . + + +Understanding the Parser +To understand exactly how the parser evaluates an expression, work through the following expression. (Assume that exp_ptr points to the start of the expression.) + +10 – 3 * 2 + +When eval_exp(), the entry point into the parser, is called, it gets the first token. If the token is null, the function prints the message No Expression Present and returns. However, in this case, the token contains the number 10. Since the first token is not null, eval_exp2() is called. As a result, eval_exp2() calls eval_exp3(), and eval_exp3() +974 C + + : T h e C o m p l e t e R e f e r e n c e + + +calls eval_exp4(), which in turn calls eval_exp5(). Then eval_exp5() checks whether the token is a unary plus or minus, which in this case it is not, so eval_exp6() is called. At this point eval_exp6() either recursively calls eval_exp2() (in the case of a parenthesized expression) or calls atom() to find the value of a number. Since the token is not a left parentheses, atom() is executed and result is assigned the value 10. Next, another token is retrieved, and the functions begin to return up the chain. Since the token is now the operator –, the functions return up to eval_exp2(). +What happens next is very important. Because the token is –, it is saved in op. The parser then gets the next token, which is 3, and the descent down the chain begins again. As before, atom() is entered. The value 3 is returned in result, and the token * is read. This causes a return back up the chain to eval_exp3(), where the final token 2 is read. At this point, the first arithmetic operation occurs—the multiplication of 2 and 3. The result is returned to eval_exp2(), and the subtraction is performed. The subtraction yields the answer 4. Although the process may at first seem complicated, work through some other examples to verify that this method functions correctly every time. +This parser would be suitable for use by a simple desktop calculator, as is illustrated by the previous program. Before it could be used in a computer language, database, or in a sophisticated calculator, however, it would need the ability to handle variables. This is the subject of the next section. + + +Adding Variables to the Parser +All programming languages, many calculators, and spreadsheets use variables to store values for later use. Before the parser can be used for such applications, it needs to be expanded to include variables. To accomplish this, you need to add several things to the parser. First, of course, are the variables themselves. As stated earlier, we will use the letters A through Z for variables. The variables will be stored in an array inside the parser class. Each variable uses one array location in a 26-element array of doubles. Therefore, add the following to the parser class: + + +double vars[NUMVARS]; // holds variables' values + +You will also need to change the parser constructor, as shown here. + +// parser constructor parser::parser() +{ +int i; + +exp_ptr = NULL; +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 975 + + + + +for(i=0; i #include #include #include using namespace std; + +enum types { DELIMITER = 1, VARIABLE, NUMBER}; + +const int NUMVARS = 26; + +class parser { +char *exp_ptr; // points to the expression char token[80]; // holds current token +char tok_type; // holds token's type +double vars[NUMVARS]; // holds variables' values + +void eval_exp1(double &result); void eval_exp2(double &result); +978 C + + : T h e C o m p l e t e R e f e r e n c e + + + +void eval_exp3(double &result); void eval_exp4(double &result); void eval_exp5(double &result); void eval_exp6(double &result); void atom(double &result); +void get_token(); void putback(); +void serror(int error); double find_var(char *s); int isdelim(char c); +public: parser(); +double eval_exp(char *exp); }; + +// parser constructor parser::parser() +{ +int i; + +exp_ptr = NULL; + +for(i=0; i0; --t) result = result * (double)ex; } +} + +// Evaluate a unary + or -. +void parser::eval_exp5(double &result) { +register char op; + +op = 0; +if((tok_type == DELIMITER) && *token=='+' || *token == '-') { op = *token; +get_token(); } +eval_exp6(result); +if(op=='-') result = -result; } + +// Process a parenthesized expression. void parser::eval_exp6(double &result) { +if((*token == '(')) { get_token(); eval_exp2(result); if(*token != ')') +serror(1); get_token(); +} +else atom(result); } + +// Get the value of a number or a variable. void parser::atom(double &result) +982 C + + : T h e C o m p l e t e R e f e r e n c e + + + +{ +switch(tok_type) { case VARIABLE: +result = find_var(token); get_token(); +return; case NUMBER: +result = atof(token); get_token(); +return; default: +serror(0); } +} + +// Return a token to the input stream. void parser::putback() +{ +char *t; + +t = token; +for(; *t; t++) exp_ptr--; } + +// Display a syntax error. void parser::serror(int error) { +static char *e[]= { "Syntax Error", +"Unbalanced Parentheses", "No expression Present" +}; +cout << e[error] << endl; } + +// Obtain the next token. void parser::get_token() { +register char *temp; + +tok_type = 0; temp = token; +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 983 + + + +*temp = '\0'; + +if(!*exp_ptr) return; // at end of expression + +while(isspace(*exp_ptr)) ++exp_ptr; // skip over white space + +if(strchr("+-*/%^=()", *exp_ptr)){ tok_type = DELIMITER; +// advance to next char *temp++ = *exp_ptr++; +} +else if(isalpha(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = VARIABLE; +} +else if(isdigit(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = NUMBER; +} + +*temp = '\0'; } + +// Return true if c is a delimiter. int parser::isdelim(char c) +{ +if(strchr(" +-/*%^=()", c) || c==9 || c=='\r' || c==0) return 1; +return 0; } + +// Return the value of a variable. double parser::find_var(char *s) +{ +if(!isalpha(*s)){ serror(1); return 0.0; +} +return vars[toupper(*token)-'A']; } +984 C + + : T h e C o m p l e t e R e f e r e n c e + + +To try the enhanced parser, you may use the same main() function that you used for the simple parser. With the enhanced parser, you can now enter expressions like + +A = 10/4 A – B +C = A * (F – 21) + + +Syntax Checking in a Recursive-Descent Parser Before moving on to the template version of the parser, let's briefly look at syntax checking. In expression parsing, a syntax error is simply a situation in which the input expression does not conform to the strict rules required by the parser. Most of the time, this is caused by human error, usually typing mistakes. For example, the following expressions are not valid for the parsers in this chapter: + +10 ** 8 +(10 – 5) * 9) /8 + +The first contains two operators in a row, the second has unbalanced parentheses, and the last has a division sign at the start of an expression. None of these conditions is allowed by the parsers. Because syntax errors can cause the parser to give erroneous results, you need to guard against them. +As you studied the code of the parsers, you probably noticed the serror() function, which is called under certain situations. Unlike many other parsers, the +recursive-descent method makes syntax checking easy because, for the most part, it occurs in atom(), find_var(), or eval_exp6() , where parentheses are checked. The only problem with the syntax checking as it now stands is that the entire parser is not terminated on syntax error. This can lead to multiple error messages. +The best way to implement the serror() function is to have it execute some sort of reset. For example, all C++ compilers come with a pair of companion functions called setjmp() and longjmp() . These two functions allow a program to branch to a different function. Therefore, serror() could execute a longjmp() to some safe point in your program outside the parser. +Depending upon the use you put the parser to, you might also find that C++'s exception handling mechanism (implemented through try, catch, and throw) will be beneficial when handling errors. +If you leave the code the way it is, multiple syntax-error messages may be issued. This can be an annoyance in some situations but a blessing in others because multiple errors may be caught. Generally, however, you will want to enhance the syntax checking before using it in commercial programs. +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 985 + + +Building a Generic Parser +The two preceding parsers operated on numeric expressions in which all values were assumed to be of type double. While this is fine for applications that use double values, it is certainly excessive for applications that use only integer values, for example. Also, by hard-coding the type of values being evaluated, the application of the parser is unnecessarily restricted. Fortunately, by using a class template, it is an easy task to create a generic version of the parser that can work with any type of data for which algebraic-style expressions are defined. Once this has been done, the parser can be used both with built-in types and with numeric types that you create. +Here is the generic version of the expression parser. + +// A generic parser. + +#include #include #include #include using namespace std; + +enum types { DELIMITER = 1, VARIABLE, NUMBER}; + +const int NUMVARS = 26; + +template class parser { +char *exp_ptr; // points to the expression char token[80]; // holds current token +char tok_type; // holds token's type +PType vars[NUMVARS]; // holds variable's values + +void eval_exp1(PType &result); void eval_exp2(PType &result); void eval_exp3(PType &result); void eval_exp4(PType &result); void eval_exp5(PType &result); void eval_exp6(PType &result); void atom(PType &result); +void get_token(), putback(); void serror(int error); PType find_var(char *s); +int isdelim(char c); public: +986 C + + : T h e C o m p l e t e R e f e r e n c e + + + +parser(); +PType eval_exp(char *exp); }; + +// parser constructor +template parser::parser() { +int i; + +exp_ptr = NULL; + +for(i=0; i PType parser::eval_exp(char *exp) { +PType result; + +exp_ptr = exp; + +get_token(); if(!*token) { +serror(2); // no expression present return (PType) 0; +} eval_exp1(result); +if(*token) serror(0); // last token must be null return result; +} + +// Process an assignment. +template void parser::eval_exp1(PType &result) { +int slot; +char ttok_type; char temp_token[80]; + +if(tok_type==VARIABLE) { // save old token +strcpy(temp_token, token); ttok_type = tok_type; +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 987 + + + + +// compute the index of the variable slot = toupper(*token) - 'A'; + +get_token(); if(*token != '=') { +putback(); // return current token +// restore old token - not assignment strcpy(token, temp_token); +tok_type = ttok_type; } +else { +get_token(); // get next part of exp eval_exp2(result); +vars[slot] = result; return; +} } + +eval_exp2(result); } + +// Add or subtract two terms. +template void parser::eval_exp2(PType &result) { +register char op; PType temp; + +eval_exp3(result); +while((op = *token) == '+' || op == '-') { get_token(); +eval_exp3(temp); switch(op) { +case '-': +result = result - temp; break; +case '+': +result = result + temp; break; +} } +} +988 C + + : T h e C o m p l e t e R e f e r e n c e + + + + +// Multiply or divide two factors. +template void parser::eval_exp3(PType &result) { +register char op; PType temp; + +eval_exp4(result); +while((op = *token) == '*' || op == '/' || op == '%') { get_token(); +eval_exp4(temp); switch(op) { +case '*': +result = result * temp; break; +case '/': +result = result / temp; break; +case '%': +result = (int) result % (int) temp; break; +} } +} + +// Process an exponent +template void parser::eval_exp4(PType &result) { +PType temp, ex; register int t; + +eval_exp5(result); if(*token== '^') { +get_token(); eval_exp4(temp); ex = result; if(temp==0.0) { +result = (PType) 1; return; +} +for(t=(int)temp-1; t>0; --t) result = result * ex; } +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 989 + + + +} + +// Evaluate a unary + or -. +template void parser::eval_exp5(PType &result) { +register char op; + +op = 0; +if((tok_type == DELIMITER) && *token=='+' || *token == '-') { op = *token; +get_token(); } +eval_exp6(result); +if(op=='-') result = -result; } + +// Process a parenthesized expression. +template void parser::eval_exp6(PType &result) { +if((*token == '(')) { get_token(); eval_exp2(result); if(*token != ')') +serror(1); get_token(); +} +else atom(result); } + +// Get the value of a number or a variable. +template void parser::atom(PType &result) { +switch(tok_type) { case VARIABLE: +result = find_var(token); get_token(); +return; case NUMBER: +result = (PType) atof(token); get_token(); +return; default: +990 C + + : T h e C o m p l e t e R e f e r e n c e + + + +serror(0); } +} + +// Return a token to the input stream. +template void parser::putback() { +char *t; + +t = token; +for(; *t; t++) exp_ptr--; } + +// Display a syntax error. +template void parser::serror(int error) { +static char *e[]= { "Syntax Error", +"Unbalanced Parentheses", "No expression Present" +}; +cout << e[error] << endl; } + +// Obtain the next token. +template void parser::get_token() { +register char *temp; + +tok_type = 0; temp = token; *temp = '\0'; + +if(!*exp_ptr) return; // at end of expression + +while(isspace(*exp_ptr)) ++exp_ptr; // skip over white space + +if(strchr("+-*/%^=()", *exp_ptr)){ tok_type = DELIMITER; +// advance to next char *temp++ = *exp_ptr++; +} +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 991 + + + +else if(isalpha(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = VARIABLE; +} +else if(isdigit(*exp_ptr)) { while(!isdelim(*exp_ptr)) *temp++ = *exp_ptr++; tok_type = NUMBER; +} + +*temp = '\0'; } + +// Return true if c is a delimiter. +template int parser::isdelim(char c) { +if(strchr(" +-/*%^=()", c) || c==9 || c=='\r' || c==0) return 1; +return 0; } + +// Return the value of a variable. +template PType parser::find_var(char *s) { +if(!isalpha(*s)){ serror(1); +return (PType) 0; } +return vars[toupper(*token)-'A']; } + +As you can see, the type of data now operated upon by the parser is specified by the generic type PType. The following main() function demonstrates the generic parser. + + +int main() { +char expstr[80]; + +// Demonstrate floating-point parser. parser ob; +992 C + + : T h e C o m p l e t e R e f e r e n c e + + + +cout << "Floating-point parser. "; cout << "Enter a period to stop\n"; for(;;) { +cout << "Enter expression: "; cin.getline(expstr, 79); if(*expstr=='.') break; +cout << "Answer is: " << ob.eval_exp(expstr) << "\n\n"; } +cout << endl; + +// Demonstrate integer-based parser. parser Iob; + +cout << "Integer parser. "; +cout << "Enter a period to stop\n"; for(;;) { +cout << "Enter expression: "; cin.getline(expstr, 79); if(*expstr=='.') break; +cout << "Answer is: " << Iob.eval_exp(expstr) << "\n\n"; } + +return 0; } + +Here is a sample run. + +Floating-point parser. Enter a period to stop Enter expression: a=10.1 +Answer is: 10.1 + +Enter expression: b=3.2 Answer is: 3.2 + +Enter expression: a/b Answer is: 3.15625 + +Enter expression: . + +Integer parser. Enter a period to stop Enter expression: a=10 +C h a p t e r 4 0 : A n O b j e c t - O r i e n t e d E x p r e s s i o n P a r s e r 993 + + + +Answer is: 10 + +Enter expression: b=3 Answer is: 3 + +Enter expression: a/b Answer is: 3 + +Enter expression: . + + + +As you can see, the floating-point parser uses floating-point values, and the integer parser uses integer values. + + +Some Things to Try +As mentioned early on in this chapter, only minimal error checking is performed by the parser. You might want to add detailed error reporting. For example, you could highlight the point in the expression at which an error was detected. This would allow the user to find and correct a syntax error. +As the parser now stands it can evaluate only numeric expressions. However, with a few additions, it is possible to enable the parser to evaluate other types of expressions, such as strings, spatial coordinates, or complex numbers. For example, to allow the parser to evaluate string objects, you must make the following changes: + +1. Define a new token type called STRING. +2. Enhance get_token() so that it recognizes strings. +3. Add a new case inside atom() that handles STRING type tokens. + +After implementing these steps, the parser could handle string expressions like these: a = "one" +b = "two" c = a + b +The result in c should be the concatenation of a and b, or "onetwo". +Here is one good application for the parser: create a simple, pop-up mini-calculator that accepts an expression entered by the user and then displays the result. This would make an excellent addition to nearly any commercial application. If you are programming for Windows, this would be especially easy to do. + + + + + + + + + +This page intentionally left blank. + + + + + + + + + +Index + + + + + + +& (bitwise operator), 42, 43-44 & (pointer operator), 48, 49, +115-116, 141, 262, 349 & (reference parameter), +342-343, 349 &&, 40, 41 +< >, 242, 268, 467, 485 +->, 51, 171, 175, 178, 331 overloading, 409, 415-416 +->* (pointer-to-member operator), 339, 340, 341 +* (multiplication operator), 37, 38 +* (pointer operator), 48-49, 115-116, 123-124, 349 +* (printf( ) placeholder), 202-203 |, 42, 43, 44 +||, 40, 41 +[ ], 51-52, 90, 352, 353, 358 overloading, 409-413 +^, 42, 43, 44, 207 :, 47, 271 + +::(scope resolution operator), 272, 319, 440-441 +, (comma operator), 50 overloading, 416-418 +{ }, 7, 18 +. (dot operator), 51, 165, 175, 178, 272, 293, 346 +.* (pointer-to-member operator), 339, 340 +!, 40, 41 !=, 40, 41 =, 35 +==, 40, 41 <, 40, 41 +<< (left shift), 43, 44-46 +<< (output operator), 262-264 overloading, 528-534, +790-791 <=, 40, 41 +-, 37, 38 + +—, 37-39, 391-392, 395-397 ( ) function operator, 138 + +overloading, 409, 413-415 ( ) precedence operator, 39, +41-42, 50, 51 +% (format specifier), 195 +% (modulus operator), 37, 38 +, 37, 38 +++, 37-39, 391-392, 395-397 +# (preprocessor directive), 238 # (preprocessor operator), +248-250 +# (printf( ) modifier), 202 ## (preprocessor operator), +248-250 ?, 47, 63-66 >, 40, 41 +>> (right shift), 43, 44-46 >> (input operator), 262, +263-264 +overloading, 528, 534-537, 790-791 +>=, 40, 41 +; (semicolon), 88, 163 /, 37, 38 + + + + + + + +995 +996 C + + : T h e C o m p l e t e R e f e r e n c e + + + +/* */, 250 //, 251, 262 +~, 42, 43, 46-47, 284 + + +A +abort( ), 491, 492, 502, 505, 506, 758 +abs( ), 758-759 +Access declarations, 436-439 Access modifiers, 23-25 Access specifiers, 290, 420-427 accumulate( ) algorithm, +916-917 acos( ), 734 Ada, 5 +Adaptor(s), 629, 872-874 Address, memory +& operator used to return, 48, 115-116 +pointer as, 47, 115 relocatable format, 12 +adjacent_difference( ) algorithm, 917-918 +adjacent_find( ) algorithm, 836 adjustfield format flag, 516 advance( ), 868 +Aggregate data type, 162 ALGOL, 6, 8 header, 660 +Algorithms, 627, 631, 660-670, 836-855 +table of STL, 661-663 allocator class, 628, 875-876 +member functions, table of, 876 +Allocators, 628, 875-876 AND +& bitwise operator, 42, 43-44 && logical operator, 40, 41 +ANSI/ISO C standard, 2, 4 app, 789 +append( ), 684 argc, 144-145, 147 +Arguments, function +call by reference passing convention, 140-141, 170, 341-345 +call by value passing convention, 139-140 + +command line, 144-147 default, 374-380, 382-383 passing arrays as, 92-93, 98, +102, 142-144 +passing functions as, 126-129 argv, 123, 144-147 +Arithmetic operators, 37-39 precedence of, 39 +Array(s) +allocating with new, 352-353 bounds checking on, 5, 91, +369, 412 compacting, 472-474 definition of, 90 +generating pointer to, 92 indexing versus pointer +arithmetic, 121 initialization, 105-107 multidimensional, 101-102 of objects, 328-331, 356, +366-368 +to functions, passing, 92-93, 142-144 +of pointers, 122-123 using pointers to access, +103-104, 121 +safe, creating, 369-371, 412-413 +single-dimension, 90-91 sorting, 471-472 +square brackets as operator for indexing, 51-52 +of strings, 100-101 of structures, 166 +within structures, 173 two-dimensional, 96-101 unsized, 106-107 +vector as dynamic, 631 Array-based I/O, 615-623 +and binary data, 622-623 using dynamic arrays and, +621-622 +using ios member functions with, 616 +Arrow operator (->), 51, 171, 175, 178, 331 +overloading, 409, 415-416 asctime( ), 744-745 +asin( ), 734-735 +asm statement, 613-614 Assembly language, 4, 8 + + +using asm to embed, 613-614 C used in place of, 8 +assert( ), 759 assign( ), 683-684 Assignment +functions used in, 149-150, 346-347 +multiple, 36-37 object, 324-325 +operation for C++ classes, default, 391 +operator, 34-35 pointer, 117, 333-334 +shorthand notation for, 56 structure, 165-166 +type conversion in, 35-36 atan( ), 735 +atan2( ), 735 ate, 789 atexit( ), 759 +atof( ), 759-760 atoi( ), 146, 760 atol( ), 760 +auto keyword, 18 auto_ptr class, 924-926 + + +B +Blanguage, 4 back_insert_iterator class, 862, +863 +Backslash character constants, 33-34 +bad( ), 565, 791 bad_alloc class, 350, 922 bad_cast, 580, 923 +bad_exception class, 508, 922 bad_typeid, 574, 922 +badbit, 563, 565, 790, 799 Base class +access control, 420-426 constructors, passing +parameters to, 432-436 definition of, 278, 420 general form for inheriting, +279, 420 inheritance, protected, +426-427 virtual, 439-443 +base( ), 864 +I n d e x 997 + + + +basefield format flag, 516 BASIC, 4, 5, 6, 7, 8 basic_filebuf class, 784, 785 basic_fstream class, 514, 783, +785 +basic_ifstream class, 514, 784, 785 +basic_ios class, 513, 514, 784, 785 +basic_iostream class, 513, 514, 784, 785 +basic_istream class, 513, 514, 784, 785 +basic_istringstream class, 784, 785 +basic_ofstream class, 514, 784, 785 +basic_ostream class, 513, 514, 784, 785 +basic_ostringstream class, 784, 785 +basic_streambuf class, 513, 514, 784, 785 +basic_string class, 679, 878-890 constructors, 878 +member functions, table of, 880-890 +basic_stringbuf class, 784, 785 basic_stringstream class, 784, +785 +BCPL language, 4 before( ), 570-571 beg, 790 +begin( ), 631, 632, 633, 637 BiIter, 628, 808 +binary, 789 +binary_function class, 675, 869, 870 +binary_negate class, 871-872 binary_search( ) algorithm, +836-837 +bind1st( ) binder, 676-677, 870-871 +bind2nd( ) binder, 676-677, 870-871 +Binders, 629, 676-678, 870-871 BinPred type, 628, 808 +Bit shift operators (>> and <<), 43, 44-46 +Bit-fields, 162, 174-176 + +bitset container, 629, 630, 808, 810-812 +member functions, table of, 811-812 + header, 629, 808 Bitwise operation, definition of, +42 +Bitwise operators, 42-47 table of, 42-43 +Block statements, 58, 88 +bool data type, 14, 39, 58, 266 boolalpha +format flag, 516 manipulator, 524, 527-528 +break statement, 67, 68, 69-70, 76, 83-85 +Broken-down time, 744 bsearch( ), 760-761 BUFSIZ macro, 715 + + +C +.C file extension, 12 +C Programming Language, The (Kernighan & Ritchie), 4 +C Standard, ANSI/ISO, 2, 4 C++ +differences between C and, 130, 623-624 +differences between +old-style and modern C++, 266-270 +origins of, 256-257 sample program, 260-263 +Standard, 256-257, 266-267 c_str( ), 688 +Calendar time, 744 +Call by reference, 140-141 automatic, using reference +parameter, 341-345 structure pointers used for, +170 +Call by value, 139-140 calloc( ), 754 +Case sensitivity, 10, 17, 287 case statement, 67, 69-70 header, 759 Casts, 54-55 +and base class pointers, 336, 337 + +C++ operators for, 55, 580-591 +used in pointer assignments, 130 +catch statement, 490-502, 504 catch(...) form of, 500-502 and derived-class +exceptions, 499 general form of, 490 using multiple, 497-498 + header, 720 ceil( ), 735-736 +cerr, 514 + header, 734 char data type, 14, 15 char_traits class, 785, 878, +890-892 +member functions, table of, 891-892 +Character(s) ASCII, 14, 549 +in C console I/O, 189-191 constants, 31-32, 623 constants, backslash, 33-34 control, 720 +printable, 720 +set, extended, 549-550 wide. See Wide character(s) +Character translations +in C I/O streams, 213, 702 in C++ file I/O, 547, 559 +cin, 262, 514 Class(es) +abstract, 457 +access specifications, 290-292 base. See Base class +creating conversion functions for, 605-609 +declaration, general form for, 271-272, 290 +defining functions within, 306-307, 309 +derived. See Derived class forward declaration of, +300-301 friend, 302-303 +generic. See Generic class instance of, 271 +libraries, 460 local, 320-321 nested, 320 +998 C + + : T h e C o m p l e t e R e f e r e n c e + + + +overview of, 270-274 stream, 513-514 structures and, 293-295 unions and, 295-297 +class keyword, 270, 290, 295 Class member(s) +accessing, public, 272-273, 293 +definition of, 271, 292 pointers to, 339-341 restrictions on, 292-293 static, 310-317 +clear( ), 791 clearerr( ), 696 header, 14 + header, 744 clock( ), 745 +clock_t type, 744 CLOCKS_PER_SEC, 744, 745 clog, 514 +close( ), 544 header, 734 COBOL, 5, 7, 8 +Code +block, 7-8, 18-19 compartmentalization of, 6, +7 +Comma operator, 50 overloading, 416-418 +Command line arguments, 144-147 +Comments +in C, 250-251 +in C++, 251-252, 262 Comp type, 628, 808 compare( ), 688 Compilation +conditional, 242-246 separate, 12, 25 +Compilers +compiling C programs with C++, 12 +working with older C++, 270 complex class, 894-897 +functions defined for, table of, 896-897 + header, 894 Compound data types, 162 Compound statements, 58, 88 Conditional expression, 58, +66-67 + + +Conglomerate data type, 162 conio.h header file, 191 +const access modifier, 23-24, 25 Constants, 31-34 +const_cast, 588-590 +Constructor function(s), 283-287 copy, 323, 324, 368-372 +and default arguments, 377-378 +execution order for, 317-319 explicit, 612-613 +and inheritance, 428-436 overloading, 364-372 parameterized, 307-310 passing parameters to base +class, 432-436 continue statement, 86-87 copy( ) algorithm, 837 copy_backward( ) algorithm, +837 +container protected variable, 863 +Containers, 626-627, 808-833 defined by STL, table of, 629, +808-809 +string class and, 689-691 typedef names for, 630, +809-810 cos( ), 736 cosh( ), 736 +count( ), algorithm, 660, 661, 664-665, 837 +count_if( ) algorithm, 660, 661, 664, 665-666, 838 +cout, 262, 514 +_ _cplusplus predefined macro, 250 +.CPP file extension, 12 header, 763, 766 header, 718, 770 header, 188, 214-215, +696, 715 + header, 59, 754, 758 header, 30>9, 767 header, 94, 720 ctime( ), 745 + header, 744 ctype.h header file, 720 cur, 790 +current protected member, 864 + + header, 772, 775, 778, 779 + header, 772 + + +D +Data +compartmentalization of, 6 in expressions, 14 +Data type(s) +ANSI/ISO C, table of, 15 basic, 14-15 +class as, 271 conversion of, in +assignments, 35-36 conversion of, in +expressions, 53-54 creating and integrating new +C++, 957 definition of, 5 +modifiers for basic, 15-16 +_ _DATE_ _ predefined macro, 250 +dec format flag, 516 Decrement operator (—), 37-39 +overloading for prefix and postfix, 391-392, 395-397 +default statement, 67 #define directive, 238-241 +and function-like macros, 240-241 +and preprocessor operators # and ##, 248-250 +defined compile-time operator, 247-248 +delete dynamic allocation operator, 349-359, 754 +and arrays, 352-353 +and arrays of objects, 358 overloading, 400-405, +408-409 overloading for arrays, +405-408 +placement form of, 359 deque container, 626, 629, 630, +808, 812-814 +member functions, table of, 813-814 + header, 629, 808 Derived class +I n d e x 999 + + + +access declaration within, 436-438 +creating, 279 definition of, 278, 420 +inheriting multiple base classes, 427-428 +objects, base class pointers to, 336-338 +Destructor functions, 284-287 execution order for, 317-319 and inheritance, 428-432 +difference_type, 859 difftime( ), 746 distance( ), 868 +div( ), 758, 761-762 div_t type, 758, 761 +divides( ) function object, 673-674 +do-while loop, 79-81 domain_error exception, 924 Dot operator (.), 51, 165, 175, +178, 272, 293, 346 double data type, 14, 15 +Dynamic allocation, 129-131 functions for, 130-131, +754-755 +operators for, 349-359, 754 dynamic_cast, 580-588 + + +E +Early binding, 460 EDOM, 734 +#elif directive, 243, 244-245, 248 else, 59 +#else directive, 243-245 empty( ), 642, 651 Encapsulation, 258, 265 +class as basic unit of, 290 and global variables, 315 how to achieve, 271, 293 +end, 790 +end( ), 631, 632, 633, 637, 645-647 +#endif, 243-245 enum keyword, 180 +Enumerations, 162, 180-183 EOF macro, 189, 215, 696 +eof( ), 555-557, 565, 622, 791-792 eofbit, 790, 799 + +equal( ) algorithm, 838 +member function, 866 equal_range( ) algorithm, 838 ERANGE, 734, 768, 769 erase( ), 630, 632, 633, 637, +684-685 +errno, 696, 734, 768, 769 errno.h header file, 734 Error checking, run-time, 5 #error directive, 241 +Errors +pointer problem, 131-135 See also Exception handling +Escape sequences, 33 exception class, 508, 790, +922-923 +Exception handling, 350, 490-509 +applying, 508-509 +and catching all exceptions, 500-502 +classes, 922-924 fundamentals, 490-499 and restricting exceptions, +502-504 +and rethrowing exceptions, 504-505 + header, 505, 506, 508, 922-923 +exceptions( ), 792 Exclusive OR. See XOR exit( ), 85-86, 150, 492, 762 +EXIT_FAILURE, 263, 758, 762 EXIT_SUCCESS, 263, 758, 762 exp( ), 736 +explicit specifier, 612-613 export keyword, 487 Expression(s), 53-56 +conditional, 58, 66-67 definition of, 14, 53 evaluation order, 53, 65 function calls used in, 64-65, +149-150 parser, 960-993 pointer, 116-120 +production rules of, 962-963 statements, 58, 88 +tokens, 965 +type conversion in, 53-54 + + +extern storage class specifier, 25-27, 615 +Extractors, creating, 528, 534-537 + + +F +fabs( ), 737 facet class, 927 fail( ), 565, 792 +failbit, 563, 565, 790, 799 failed( ), 868 +failure class, 790 false, 39, 58-59, 266 +fclose( ), 150, 217, 218-220, 697 feof( ), 220-222, 697 +ferror( ), 224-226, 697-698 fflush( ), 227, 698 +fgetc( ), 218, 698 fgetpos( ), 698-699 +fgets( ), 192, 222, 233, 699 File(s), C +in C I/O system, 213-214 closing, 216 +control structure, 213 erasing, 226-227 +opening, 215-217, 699-701 pointer, 215, 216 +File(s), C++ closing, 544 +get pointer, 559, 563 opening, 542-544 put pointer, 559, 563 reading and writing +unformatted and binary, 547-555 +reading and writing text, 545-547 +FILE data type, 213, 215, 696 File position indicator, 213, +698-699, 704 +resetting, 223-224, 711 setting, 229-231 +_ _FILE_ _ predefined macro, 248, 250 +filebuf class, 542, 786 fill( ) +algorithm, 839 +member function, 523-524, 792 +1000 C + + : T h e C o m p l e t e R e f e r e n c e + + + +fill_n( ) algorithm, 839 find( ) +algorithm, 839 +member function, 631, 655, 658, 686-688 +find_end( ) algorithm, 839 find_first_of( ) algorithm, +839-840 +find_if( ) alogrithm, 840 fixed format flag, 516 flags( ), 520-522, 793 float data type, 14, 15 +floatfield format flag, 516 Floating-point constants, 32 floor( ), 737 +flush( ), 558-559, 793 fmod( ), 737 +fmtflags enumeration, 515, 787 fopen( ), 215-217, 218-220, +699-701 +FOPEN_MAX macro, 215, 217 for loop, 6, 70-77 +declaring variable within, 81 general form of, 70-71 infinite, 76 +variations of, 72-76 with no body, 77 +for_each( ) algorithm, 840 ForIter, 628, 808 +Formal parameters. See Parameters, formal +Format flags, 515-522, 787 FORTH, 5 +FORTRAN, 5, 7, 257 Forward declaration, 300-301 fpos_t data type, 215, 696 fprintf( ), 231-232, 546, 701 fputc( ), 218, 701 +fputs( ), 222-223, 701 fread( ), 227-229, 702 free( ), 130-131, 350, 351, +754-755 freeze( ), 622 +freopen( ), 235, 702-703 frexp( ), 737-738 Friend classes, 302-303 +Friend functions, 298-302 +and the this pointer, 336, 393 friend keyword, 298 front_insert_iterator class, 862, +863 + + +fscanf( ), 231-232, 546, 703 fseek( ), 215, 229-231, 703-704 fsetpos( ), 704 +fstream class, 514, 542, 786 header, 542, 786, 787 fstream( ), 793-794 +ftell( ), 230-231, 704-705 Function(s), 7, 10 +arguments. See Arguments, function +conversion, creating, 605-609 formal parameters of. See +Parameters, formal friend. See Friend functions general form of, 138 +general-purpose, 159 generic. See Generic +function(s) +inline. See Inline functions inline code versus, 35-36 main( ). See main( ) member. See Member +functions +objects. See Function objects passing multidimensional +arrays to, 98, 102 passing objects to, 321-323 passing single-dimension +arrays to, 92-93 passing structures to, +166-169 pointers to, 126-129 +prototypes, 155-157, 623 predicate, 628 recursive, 153-155 +return type, default to int, 266 +returning from, 147-149 returning objects from, +323-324 +returning pointers from, 151-152 +returning references from, 346-347 +returning values from, 149-151 +scope rules of, 138-139 stand-alone, 7, 8, 27-28 used in assignment +statement, 346-347 + +used in expressions, 64-65, 149-150 +virtual. See Virtual functions +void, 150, 152-153 Function objects, 628-629, +671-678, 868-874 +built-in, list of, 628, 671, 869 using binders with, 676-678, +870-871 +creating, 674-676, 869 Function overloading, 274-277, +362-373 +and ambiguity, 380-384 and constructor functions, +364-372 +and function pointers, 372-373 +versus default arguments, 378-380 + header, 628-629, 671, 868 +fwide( ), 775 +fwrite( ), 179, 227-229, 705 + + +G +gcount( ), 552-553, 794 generate( ) algorithm, 840-841 generate_n( ) algorithm, +840-841 +Generated function, 464 Generic class, 474-486 +creating safe array with, 479-482 +default arguments and, using, 483-485 +explicit specialization of, 485-486 +general form of, 475 +using non-type arguments in, 481-482 +typeid and, 578-580 Generic function(s), 462-474 +applying, 470-474 explicitly overloading, +465-467 +general forms of, 462, 464 restrictions, 469-470 +get( ), 548-549, 622-623, 794-795 +I n d e x 1001 + + + +member function of auto_ptr, 925-926 +overloaded forms of, 553 Get pointer, 559, 800, 804 getc( ), 218-220, 705 +getch( ), 190-191, 193 getchar( ), 189-191, 192, 193, +205, 706 +getche( ), 190-191, 193 getenv( ), 762 +getline( ), 553-555, 795-796 gets( ), 143, 144, 192-193, 205, +233, 706 gmtime( ), 746 good( ), 565, 796 +goodbit, 563, 565, 790, 799 goto statement, 6, 83, 138 greater( ) function object, +676-678 +gslice class, 913, 915-916 gslice_array class, 916 + + +H +Headers and header files, 157, 242, 261, 268-269, 605 +Heap, 130, 754 +hex format flag, 516 Hexadecimal constants, 32-33 Hierarchical classifications, 420 Hoare, C.A.R., 765 HUGE_VAL macro, 734, 768 + + +I +Identifiers, 16-17, 624 +#if directive, 243, 245, 247 if statement +declaring variable within, 81-82 +general form of, 59 +if-else-if ladder, 62-63 nested, 60-62 +? as alternative to, 63-66 #ifdef directive, 245-246 #ifndef directive, 245-246 ifstream class, 514, 542, 786 ifstream( ), 793-794 +ignore( ), 557-558, 796 imag( ), 895 + +in, 789 +#include directive, 242, 268 includes( ) algorithm, 841 Increment operator (—), 37-39 +overloading for prefix and postfix, 391-392, 395-397 +indirect_array class, 916 Inheritance, 259, 278-283, +420-443 +access declaration in, 436-439 +access specifiers and, 420-427 +constructors, destructors, and, 428-436 +multiple base class, 427-428 and virtual base classes, +439-443 +and virtual attribute of functions, 450-452 +InIter, 628, 808 Inline code, 35-36 +Inline functions, 303-305 within a class, defining, +305-306 +inline keyword, 304, 306 inner_product( ) algorithm, +918-919 +inplace_merge( ) algorithm, 841 Input operator (>>), 262, +263-264 +overloading, 528, 534-537, 790-791 +insert( ), 630, 632, 633, 637, 639, 642, 644, 684, 685 +insert_iterator class, 860-862 inserter( ), 861 +Inserters, creating, 528-534 int data type, 14, 15 +default to, 265-266, 624 unsigned versus signed, 16 +Integers +signed vs. unsigned, 16 size of, 14 +internal format flag, 515 int_type data type, 557 invalid_argument exception, +924 +I/O, C-style, 188 +functions, 696-718, 775, 776 I/O, C console, 188-209 + + +basic functions for, table of, 193 +and characters, 189-191 formatted, 195-209 +and strings, 191-194 I/O, C file, 212-235 +common functions for, table of, 214 +connection with console I/O, 234 +files in, 212, 213-214 See also File(s), C +formatted, with fprintf( ) and fscanf( ), 231-232 +random-access, 229-231 reading and writing a +character in, 218 reading and writing blocks +of data in, 227-229 streams in, 212-214 See also +Streams +and strings, 222-223 I/O, C++ +array-based. See Array-based I/O +byte-oriented vs. character-oriented, 547-548 +formatted, 515-528 functions, 791-805 headers, 786-787 manipulators. See +Manipulators old vs. modern, 512 +operators. See Operators, I/O +predefined streams, 514-515 streams, 513 +template classes, 513-514, 784-786 +I/O, C++ file, 542-568 customized I/O and, +565-568 +flushing buffers in, 558-559 random access, 559-563, 810 status, obtaining, 563-565 See also Files, C++ +_IOFBF, 715 _IOLBF, 715 + header, 525, 786, 787, 788 +1002 C + + : T h e C o m p l e t e R e f e r e n c e + + + +_IONBF, 715 +ios class, 514, 542, 616, 785 header, 786 ios::app, 543, 797 +ios::ate, 543, 797 ios::badbit, 563 ios::badbit, 563 ios::beg, 559, 800 +ios::binary, 543, 547, 797 ios::cur, 559, 800 ios::end, 559, 800 ios::eofbit, 563 ios::failbit, 563 ios::goodbit, 563 +ios::in, 543, 797 ios::out, 543, 797 ios::trunc, 543, 797 +ios_base class, 513, 784, 785 header, 786, 789 iostate enumeration, 563, 790 iostream class, 514, 616, 785 header, 260, 278, +512, 514, 786, 787 iostream.h header file, 512 is_open( ), 544 +isalnum( ), 720 isalpha( ), 720 iscntrl( ), 721 isdigit( ), 721 isgraph( ), 721 islower( ), 721-722 isprint( ), 722 ispunct( ), 722 isspace( ), 722 +istream class, 514, 534, 616, 785 header, 786 istream_iterator class, 864-865 istream_type type, 865, 866 istreambuf_iterator class, 865 istringstream class, 786 istringstream( ), 802-803 istrstream class, 616, 618, 619 isupper( ), 723 +iswctype( ), 772-774 isxdigit( ), 723 +Iteration statements, 58, 70-81 declaring variables within, +81 +Iterator(s), 627, 631, 635-637, 808, 858-868 +functions, 868 + + +predefined, 860-868 iterator +class, 859 +type, 627, 637, 859 header, 858, 859 iterator_category type, 859 iterator_traits class, 860 iter_swap( ) algorithm, 841 + + +J +jmp_buf type, 763 +Jump statements, 58, 68, 82-87 + + +K +kbnit( ), 84 Kernighan, Brian, 4 Keywords +C, 6, 8 +C++, table of, 287-288 extended, common, 10 Standard C, table of, 9 + + +L +Label +identifier for goto statement, 83 +statements, 58, 67 labs( ), 762 Language(s), computer +block-structured, 6, 139 high-level, 4-6 +middle-level, C as, 4-6 programmer's, C as, 8-9 structured, C as, 6-8, 257-258 +Late binding, 460 LC_ALL, 749 LC_COLLATE, 749 LC_CTYPE, 749 LC_MONETRAY, 749 LC_NUMERIC, 749 LC_TIME, 749 +lconv structure, 746-747 ldexp( ), 738 +ldiv( ), 758, 763 +ldiv_t structure, 758, 761-762, 763 + + +left format flag, 515 length_error exception, 924 less( ) function object, 628, 629, +654 lexicographical_compare( ) +algorithm, 842 Library +class, 10, 11, 460, 782-783, 894 +standard function, 10-12, 694-695 +standard template. See Standard template library (STL) + header, 927 #line directive, 248 +_ _LINE_ _ predefined macro, 248, 250 +Line-buffered input, 190 Linkage specification, 614-615 Linker, 11-12 +list container, 626, 629, 698, 641-653, 808, 815-818 +member functions, table of, 642-643, 815-818 + header, 629 Literals, 31 +locale class, 927 header, 927 locale.h header file, 744 localeconv( ), 746-748 Localization +C functions for, 744, 746-747, 748-750 +class library, 927 localtime( ), 748 log( ), 738 +log10( ), 738-739 logic_error class, 924 Logical operators, 39-42 +truth table for, 40 long modifier, 15-16 LONG_MAX, 768 LONG_MIN, 768 longjmp( ), 509, 763, 766 Loops +do-while, 6, 79-81 for. See for loop infinite, 76 +and structured languages, 6 time delay, 77 +I n d e x 1003 + + + +while, 6, 77-79 with no bodies, 77 +lower_bound( ) algorithm, 842 lvalue, 35 + + +M +Macro +function-like, 240-241 name, 238 predefined, 250 replacement, 238 +main( ), 10, 156, 624 +argc and argv as arguments to, 144-147 +return value from, 153 using void in parameter list +of, 147 make_heap( ) algorithm, +842-843 +make_pair( ), 656-657, 658, 926-927 +malloc( ), 130-131, 350, 351, 358, 754, 755 +Manipulators +creating custom, 537-540 to format I/O, using, +524-528 +table of C++, 524-525, 787-788 +map container, 627, 629, 630, 654-660, 809, 818-820 +member functions, table of, 655-656, 819-820 + header, 629, 809 mask_array class, 916 math.h header file, 734 max( ) algorithm, 843 +max_element( ) algorithm, 843 MB_CUR_MAX, 770 +mblen( ), 763-764 mbstate_t type, 779 mbstowcs( ), 764 mbtowc( ), 764 mem_fun( ) adaptor, 873 +mem_fun_ref( ) adaptor, 874 mem_fun_ref_t class, 874 mem_fun_t class, 873-874 mem_fun1( ) adaptor, 873 mem_fun1_ref( ) adaptor, 874 + + +mem_fun1_ref_t class, 874 mem_fun1_t class, 873-874 Member functions, 271, 272, 292 +const, 609-611 +and scope resolution operator, 272 +static, 315-317 +and the this pointer, 334-336 volatile, 611 +within class, defining, 306-307, 309 +Member variables, 271, 272, 292, 293 +static, 310-315 memchr( ), 723 memcmp( ), 723-724 memcpy( ), 724 memmove( ), 724 + header, 875, 924, 927 +memset( ), 725 +merge( ), 643, 644, 649-651 algorithm, 843-844 +Microsoft's Visual C++, 191 min( ) algorithm, 844 min_element( ) algorithm, 844 mismatch( ) algorithm, 844-845 mktime( ), 748 +modf( ), 739 Modula-2, 5, 6, 7, 8 +multimap container, 629, 630, 654, 809, 820-822 +member functions, table of, 821-822 +multiset container, 629, 630, 809, 823-825 +member functions, table of, 823-825 +mutable keyword, 25, 610-611 + + +N +name( ), 570, 571 Namespace, 29, 261, 269, +594-605 +unnamed, 600-601 namespace statement, 267, 270, +594-595 NDEBUG, 759 + + +negate( ) function object, 671, 672-673 +Negators, 629, 678, 871-872 new dynamic allocation +operator, 349-359, 754, 922 and allocating arrays, +352-353 +and allocating objects, 353-358 +and initializing memory, 351-352 +overloading, 400-405, 408-409 +overloading for arrays, 405-408 +placement form of, 359 header, 350, 358 next_permutation( ) algorithm, +845 NOT +! logical operator, 40, 41 +~ bitwise operator, 42, 43, 46-47 +not1( ) negator, 678, 871 not2( ) negator, 678, 871 nothrow option for new, 358 +overloading, 408-409 nothrow_t data type, 409 npos constant, 681, 859 nth_element( ) algorithm, 845 Null +definition of, 94 statement, 88 +NULL macro, 215, 758 Numeric +classes, 894-920 constants, 32 +numeric_limits class, 927 + + +O +Object(s) +allocating, 353-358 arrays of, 328-331, 356, +366-368 assignment, 324-325 base class pointers to +derived class, 336-338 base class references to +dervied class, 348 +1004 C + + : T h e C o m p l e t e R e f e r e n c e + + + +creating, 271 definition of, 258, 290 factory, 576 +function. See Function objects +to functions, passing, 321-323 +from functions, returning, 323-324 +initialization, 283, 307, 309, 310, 369 +passing references to, 345-346 +pointers to, 331-333 +Object-oriented programming (OOP), 256, 257-259 +oct format flag, 516 Octal constants, 32-33 off_type type, 789, 800 +ofstream class, 514, 542, 786 ofstream( ), 793-794 +One's complement operator (~), 42, 43, 46-47 +OOP (Object-oriented programming), 256, 257-259 +open( ), 542-544, 796-797 openmode, 543, 789 Operator(s) +arithmetic, 37-39 +arrow. See Arrow operator (->) +assignment, 34-35 bitwise, 42-47 casting, 55, 580-591 comma, 50 +compile-time, 49-50 +dot, 51, 165, 175, 178, 272, 293, 346 +dynamic allocation, 349-359 pointer, 47-49, 115-116, 349 pointer-to-member (.* +and->*), 339, 340, 341 precedence summary table +of C, 52 +relational and logical, 39-42 scope resolution, 272, 319, +440-441 ternary, 47, 63-66 +operator functions +creating member, 386-393 definition of, 386 + + +using friend, 393-400 operator keyword, 386 Operator overloading, 278, +386-418 +[ ], ( ), and->, 409-416 comma, 416-418 increment and decrement, +391-392, 395-397 +new and delete, 400-409, 754 restrictions, 392-393 shorthand, 392 +See also operator functions operator( ), 628, 671, 674-676, +868, 872, 873 +Operators, I/O (<< and >>), 262-264 +overloading, 528-537, 790-791 +OR +bitwise operator (|), 42, 43, 44 +logical operator (||), 40, 41 ostream class, 514, 528, 616, 785 header, 787 ostream_iterator class, 866-867 ostream_type, 866, 868 ostreambuf_iterator class, +867-868 ostringstream class, 786 +ostringstream( ), 802-803 ostrstream class, 616, 621 out, 789 +out_of_range exception, 924 OutIter, 628, 808 +Output operator (<<), 262-264 overloading, 528-534, +790-791 +overflow_error exception, 924 overload keyword, 287, 373 Overloading functions. See +Function overloading Overloading operators. See +Operator overloading Overriding versus function +overloading, 448-449 + + +P +pair template class, 628, 656, 658, 926-927 + +Parameters, formal, 21, 139, 623 declarations, classic versus +modern, 158-159 reference, 141, 341-345, 348 variable number of, 158 +Parity bit, 43, 44 partial_sort( ) algorithm, +845-846 +partial_sort_copy( ) algorithm, 846 +partial_sum( ) algorithm, 919-920 +partition( ) algorithm, 846 Pascal, 4, 5, 6, 257 pcount( ), 617 +peek( ), 558, 797 perror( ), 706-707 +plus( ) function object, 671 POD (Plain Old Data), 295 Pointer(s), 114-135 +accessing arrays with, 103-104, 121 +arithmetic, 103, 117-118 to arrays, generating, 92 arrays of, 122-123 assignments, 117, 333-334 base type of, 48, 115, 118 C file, 215, 216 +C++ file, 559 +to class members, 339-341 comparisons, 119-120 definition of, 47, 114 +to derived class objects, 336-338 +dynamic allocation and, 129-131 +to functions, 126-129 indexing, 102-104 initializing, 124-126, 132, +134-135 +to objects, 331-333 operators, 47-49, 115-116, +349 +to pointers, 123-124 problems with, 131-135 returned from functions, +151-152 structure, 169-173 this, 315, 334-336 +typeid and base-class, 572-574 +I n d e x 1005 + + + +void*, 130 pointer type, 859 +pointer_to_binary_function class, 872-873 +pointer_to_unary_function class, 872, 873 +Polymorphism, 258-259 through function +overloading, 274, 276, 362 through operator +overloading, 278 Polymorphism, run-time +through inheritance and virtual functions, 283, 338, 446, 448, 457-460 +through RTTI and casting operators, 570 +pop_back( ), 631 pop_front( ), 631 +pop_heap( ) algorithm, 846-847 Portability, 4 +using sizeof to ensure, 183-184 +using typedef to aid, 184-185 using a union to help with, +178 +pos_type data type, 563, 789, 800 +pow( ), 739 +#pragma directive, 248 precision( ), 522-524, 798 Predicate functions, 628 Preprocessor directives, 238-248 Preprocessor operators, 248-250 prev_permutation( ) algorithm, +847 +printf( ), 117, 134, 193, 195-203, 234, 707-709 +in C++ program, 262 format specifiers, table of, +195-196, 708 +return value of, 150, 195, 707 priority_queue container, 629, +809, 827 +member functions, table of, 827 +private access specifier, 290, 420 effects of, 421-422 +Program(s) +general form of C, 10, 11 general form of C++, 288 + + +systems, 8-9 +protected access specifier, 290, 420, 422 +effects of, 422-427 Prototypes, function, 155-157, +623 +ptr_fun( ) adaptor, 872-873 ptrdiff_t type, 859 +public access specifier, 271, 290, 420 +effects of, 420-421 push_back( ), 630, 632, 633, 642, +643, 645, 647-648, 863 push_front( ), 630, 643, 644, +647-648, 863 +push_heap( ) algorithm, 847 Put pointer, 559, 800, 804 put( ), 548, 549-550, 623, 798 putback( ), 558, 798 +putc( ), 216-220, 710 +putchar( ), 189-190, 193, 232, 710 puts( ), 192-194, 710 + + +Q +qsort( ), 764-765 +queue container, 629, 809, 825-826 +member functions, table of, 825-826 + header, 629, 809 Quicksort, 765 + + +R +raise( ), 765 +rand( ), 59, 576, 766 RAND_MAX, 59, 758, 766 RandIter, 628, 808 +Random-access I/O, 229-231, 559-563, 800 +random_shuffle( ) algorithm, 847-638 +range_error exception, 924 raw_storage_iterator class, 927 rdstate( ), 563-565, 798-799 read( ), 550-553, 623, 799 readsome( ), 799-800 +real( ), 895 realloc( ), 754, 755 + + +Recursion, 153-155 Reference(s) +definition of, 341 independent, 347-348 +to objects, passing, 345-346 parameters, 341-345, 348, +395-396 restrictions, 349 returning, 346-347 typeid and, 574-575 +reference type, 859 +register storage class specifier, 29-31, 624 +reinterpret_cast, 590-591 Relational operators, 39-42 release( ), 925 +Relocatable format, 12 remove( ), 226-227, 711 +algorithm, 848 remove_copy( ) algorithm, 662, +666-668, 848 remove_copy_if( ) algorithm, +848 +remove_if( ) algorithm, 662, 677-678, 848 +rename( ), 711 replace( ), 684, 685 +algorithm, 848-849 replace_copy( ) algorithm, 662, +666-668, 848-849 replace_copy_if( ) algorithm, +848-849 +replace_if( ) algorithm, 848-849 return statement, 82-83 +using to return from a function, 147-149 +using to return a value, 149 reverse( ) algortihm, 663, +668-669, 849 +reverse_copy( ) algorithm, 849 reverse_iterator class, 864 rewind( ), 223-224, 711 +rfind( ), 686-688 Richards, Martin, 4 right format flag, 515 Ritchie, Dennis, 4 rotate( ) algorithm, 849 +rotate_copy( ) algorithm, 849-850 +Run-time type identification (RTTI), 570-580 +1006 C + + : T h e C o m p l e t e R e f e r e n c e + + + +runtime_error class, 924 rvalue, 35 + + +S +Scalar, 59 +scanf( ), 195, 203-209, 262, 711-715 +format specifiers, table of, 204, 712 +Scanset, 206-207, 714-715 scientific format flag, 516 Scope resolution operator (::), +272, 319, 440-441 Scope rules, 138 search( ) algorithm, 850 +search_n( ) algorithm, 850 SEEK_CUR macro, 215, 229, 704 SEEK_END macro, 215, 229, 704 SEEK_SET macro, 215, 229, 704 seekdir enumeration, 559, 790, +800 +seekg( ), 559-562, 800 seekp( ), 559-562, 800 +Selection statements, 58, 59-70 declaring variables within, +81-82 +set container, 629, 630, 809, 827-829 +member functions, table of, 828-829 + header, 629, 809 set_difference( ) algorithm, +850-851 +set_intersection( ) algorithm, 851 +set_symmetric_difference( ) algorithm, 851-852 +set_terminate( ), 506 set_unexpected( ), 506 set_union( ) algorithm, 852 setbuf( ), 715 +setf( ), 516-517, 801 overloaded, 518-520 +setiosflags( ) manipulator, 525, 527 +setjmp( ), 509, 763, 766 setlocale( ), 748-749 setvbuf( ), 715-716 short modifier, 15-16 + +Shorthand notation, 56, 392 showbase format flag, 516 showpoint format flag, 516 showpos format flag, 516 SIG_DFL, 767 +SIG_ERR, 767 SIG_IGN, 767 SIGABRT, 765 SIGFPE, 765 SIGILL, 765 SIGINT, 766 Sign flag, 16 signal( ), 766-767 +signed modifier, 15-16 SIGSEGV, 766 SIGTERM, 766 +sin( ), 150, 739 sinh( ), 740 size( ), 632, 633 +sizeof operator, 49-50, 131, 183-184 +size_t data type, 50, 130, 215, 400, 696, 720, 758 +skipws format flag, 515 slice class, 913-915 slice_array class, 916 sort( ), 643, 648-649 +algorithm, 852 +sort_heap( ) algorithm, 852-853 splice( ), 643, 644 +sprintf( ), 716 sqrt( ), 150, 740 sscanf( ), 716 sqrt( ), 150, 740 srand( ), 767 + header, 786 stable_partition( ) algorithm, +853 +stable_sort( ) algorithm, 853 Stack and local variables, 20 stack container, 629, 809, +829-830 +member functions, table of, 830 + header, 629, 809 Standard C, 4 +Standard template library (STL), 11, 256-257, 626-691 +elements of, 626-630 general theory of operation, +630-631 + + +Statements, 57-88 +static storage class specifier, 27-29, 310 +static_cast, 590 +std namespace, 261, 269, 512, 594, 603-605 +stdarg.h header file, 718 +_ _STDC_ _ predefined macro, 250 +stderr standard stream, 232-233 header, 922, +923-924 +stdin standard stream, 232-234 stdio.h header file, 188, 214-215, +696 +stdlib.h header file, 59, 755, 758 stdout standard stream, 232-234 Stepanov, Alexander, 256 Storage class specifiers, 25-31 str( ), 621, 802 +strcat( ), 94-95, 681, 725 strchr( ), 94-95, 725 strcmp( ), 74, 94-95, 726 strcoll( ), 726 +strcpy( ), 94-95, 680, 681, 727 strcspn( ), 727 +Stream(s) +binary, 212-213 C++, 512 +for C++ array-based I/O, 616-620 +for C++ file I/O, 542 classes, 512-514, 542, 616 flushing, 227 +predefined (C++), 514-515 standard C, 232-234, 235 text, 212-213 +streambuf class, 514, 786 header, 787 streambuf_type, 868 streamoff data type, 789 streampos data type, 789 streamsize data type, 550, 789 strerror( ), 727 +strftime( ), 749-750 Stride, 914 String(s) +as arrays, 90, 94-95 arrays of, 100-101 +class, creation of custom, 930-957 +I n d e x 1007 + + + +classes, Standard C++, 94, 626, 679-691, 878-892 +in console I/O, 192-194 constant, 33, 94, 125-126 in file I/O, 222-223 limitations of +null-terminated, 679-680 manipulation functions, +94-95 +substring subtraction from, 930, 941-942 +table, 125 +string class, 94, 626, 679-691, 878, 880 +and containers, 689-691 dynamic aspect of, 683 member functions, 683-688 operators defined for, 681 + header, 680 string.h header file, 720 stringbuf class, 786 stringstream class, 786 stringstream( ), 802-803 +strlen( ), 24, 79, 94-95, 727-728 strncat( ), 728 +strncmp( ), 728 strncpy( ), 729 +Stroustrup, Bjarne, 256, 266 strpbrk( ), 729 +strrchr( ), 729 strspn( ), 730 strstr( ), 94-95, 730 +strstream class, 616, 620, 622 header, 616 strtod( ), 767-768 +strtok( ), 730 strtol( ), 768 strtoul( ), 768-769 +struct keyword, 162, 163, 295 Structure(s), 162-174 +arrays of, 166 +arrays and structures within, 173-174 +assignments, 165-166 and classes, 293-295 declaration, 162, 164 members, accessing, 165, +171, 173 +passing to functions, 166-169 pointers, 169-173 +variable, declaring, 163-164 + + +strxfrm( ), 731 +swap( ) algorithm, 853 swap_ranges( ) algorithm, 854 switch statement, 67-70 +declaring variable within, 81 sync_with_stdio( ), 803 +system( ), 769 Systems program, 8-9 + + +T +tan( ), 740 tanh( ), 740 tellg( ), 563, 804 +tellp( ), 563, 804 +Template function. See Generic function(s) +template keyword, 462 template< > syntax, 467, 485 Templates, 462-487 +advantages to using, 487 definition of, 462 +See also Generic class; Generic function(s) +terminate( ), 491, 505-507 terminate_handler type, 506, +923 +Ternary operator (?), 47, 63-66 this pointer, 315, 334-336, 388, +393 +Thompson, Ken, 4 +throw statement, 491-492, 504-505 +throw( ) clause, 502, 504 Time and date functions, +744-751 +Time delay loops, 77 time.h header file, 744 time( ), 750-751 +_ _TIME_ _ predefined macro, 250 +time_t data type, 744 tm structure, 744 TMP_MAX, 717 tmpfile( ), 716-717 tmpnam( ), 717 tolower( ), 731 toupper( ), 731 towctrans( ), 774-775 + +transform( ) algorithm, 663, 669-670, 672-674, 854 +true, 39, 58-59, 266 +True and false in C and C++, 39, 58-59 +trunc, 789 +try statement, 490-495, 503-504 Two's complement, 16 +Type checking and C++ pointers, 551 +Type conversion +and ambiguity in function overloading, 380-382 +in assignment, 35-36 in expressions, 53-54 using unions for +nonstandard, 178-180 Type promotion, 53 +typedef statement, 162, 184-185 typeid, 34-596, 922-923 +using dynamic_cast to replace, 584-586 +type_info class, 570, 927 header, 570, 927 typename keyword, 462, +486-487 +Types. See Data types + + +U +ULONG_MAX, 769 unary_function class, 674, +869-870 +unary_negate class, 871, 872 uncaught_exception( ), 507 #undef directive, 246-247 underflow_error exception, 924 unexpected( ), 502, 503, 505-506, +922 +unexpected_handler type, 506, 923 +ungetc( ), 717 +union keyword, 177 Unions, 162, 176-180, 184 +anonymous, 180, 297 and classes, 295-297 for nonstandard type +conversions, 178-180 unique( ) algorithm, 854-855 +1008 C + + : T h e C o m p l e t e R e f e r e n c e + + + +unique_copy( ) algorithm, 854-855 +unitbuf format flag, 516 Unix, 4 +UnPred type, 628, 808 unsetf( ), 517-518, 804 unsigned modifier, 14-16 +upper_bound( ) algorithm, 855 uppercase format flag, 516 using statement, 261, 270, 436, +439, 598-600 + header, 628, 927 + + +V +va_arg( ), 769-770 va_end( ), 769-770 va_list type, 718, 770 va_start( ), 769-770 valarray class, 898-916 +member functions, table of, 899-903 +nonmember operator functions defined for, table of, 904-909 +transcendental functions defined for, table of, 910-911 + header, 898 Variables, 17-23 +access modifiers for, 23-25 automatic, 17 +declaration vs. definition of, 25-26 +declaring, 17, 81-82 +as formal parameters, 21 initializing, 31 +member. See Member variables +placement in memory, 133 pointer, 47-49, 115 + +reference. See Reference(s) storage class specifiers for, +25-31 structure, 163-164 +Variables, global, 6, 21-23 declarations, difference +between C and C++, 624 and encapsulation, 315 extern used with, 25-27 static, 28-29, 600-601 +Variables, local, 6, 17-20, 21, 22 declarations, differences +between C and C++, 19-20, 264-265, 623 +initializing, 20 +static used with, 20, 27-28, 29, 139 +vector container, 626, 629, 630, 631-641, 809, 830-833 +member functions, table of, 633, 831-833 + header, 629, 809 vfprintf( ), 718 +Virtual functions, 446-460 and class libraries, 460 hierarchical nature of, +452-455 +and inheritance of virtual attribute, 450-452 +and late binding, 460 overloading versus +overriding and, 448-449 pure, 455-457 +using, 457-460 +virtual keyword, 442, 446, 447 Visual C++ compiler, 191 +void data type, 14, 15, 153, 261, 623 +volatile access modifier, 24-25, 611 +vprintf( ), 718 vsprintf( ), 718 + + +W +wchar.h header file, 772 WCHAR_MAX, 772 WCHAR_MIN, 772 +wchar_t data type, 14, 32, 515, 772 +wcstombs( ), 770 wctomb( ), 770 wctrans( ), 774-775 wctrans_t type, 772 +wctype.h header file, 772 wctype( ), 772-774 wctype_t type, 772 WEOF macro, 772 +werr, 515 +what( ), 790, 922 while loop, 6, 77-79 +declaring variable within, 81 Wide character(s), 513, 515, 547 +functions, 772-780 +I/O classes, 514, 785-786 width( ), 522, 523-524, 804-805 win, 515 +wint_t type, 772 wlog, 515 +wout, 515 +write( ), 550-553, 623, 805 wstreampos type, 789 wstring class, 679, 858, 860 + + +X +XOR +bitwise operator (^), 42, 43, 44 +logical operation, 41 diff --git a/CCNP Routing and Switching ROUTE 300-101 Official Cert Guide conv.txt b/CCNP Routing and Switching ROUTE 300-101 Official Cert Guide conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..94d0c0fbdb2604cdcdcbe12820564c294e98fd99 --- /dev/null +++ b/CCNP Routing and Switching ROUTE 300-101 Official Cert Guide conv.txt @@ -0,0 +1,53905 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +CCNP Routing and Switching ROUTE 300-101 +Official Cert Guide + + +Kevin Wallace CCIE No. 7945 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Cisco Press 800 East 96th Street +Indianapolis, IN 46240 + + + +www.allitebooks.com From the Library of Alexey Evseenko +ii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Kevin Wallace + +Copyright© 2015 Pearson Education, Inc. + +Published by: Cisco Press +800 East 96th Street Indianapolis, IN 46240 USA + +All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review. + +Printed in the United States of America + +First Printing November 2014 + +Library of Congress Control Number: 2014951132 + +ISBN-13: 978-1-58720-559-0 ISBN-10: 1-58720-559-9 + +Warning and Disclaimer +This book is designed to provide information about the Cisco ROUTE exam (300-101). Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. + +The information is provided on an “as is” basis. The authors, Cisco Press, and Cisco Systems, Inc. shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accompany it. + +The opinions expressed in this book belong to the authors and are not necessarily those of Cisco Systems, Inc. + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +iii + +Trademark Acknowledgments +All terms mentioned in this book that are known to be trademarks or service marks have been appropri-ately capitalized. Cisco Press or Cisco Systems, Inc., cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. + +Special Sales +For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@pearsoned.com or (800) 382-3419. + +For government sales inquiries, please contact governmentsales@pearsoned.com. + +For questions about sales outside the U.S., please contact international@pearsoned.com. + + +Feedback Information +At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community. + +Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve the quality of this book, or otherwise alter it to better suit your needs, you can contact us through email at feedback@ciscopress.com. Please make sure to include the book title and ISBN in your message. + + +We greatly appreciate your assistance. + +Publisher: Paul Boger + +Associate Publisher: Dave Dusthimer + +Business Operation Manager, Cisco Press: Jan Cornelssen + +Executive Editor: Brett Bartow + +Managing Editor: Sandra Schroeder + +Senior Development Editor: Christopher Cleveland + +Senior Project Editor: Tonya Simpson + + +Copy Editor: John Edwards + +Technical Editors: Michelle Plumb, Michael J. Shannon + +Editorial Assistant: Vanessa Evans + +Cover Designer: Mark Shirar + +Composition: Bronkella Publishing + +Indexer: Tim Wright + +Proofreader: Debbie Williams + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +iv CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +About the Author + +Kevin Wallace, CCIEx2 No. 7945 (Route/Switch and Collaboration), is a Certified Cisco Systems Instructor (CCSI No. 20061) and holds multiple Cisco professional and associ-ate-level certifications in the Route/Switch, Collaboration, Security, Design, and Data Center tracks. With Cisco experience dating back to 1989, Kevin has been a network design specialist for the Walt Disney World Resort, an instructor of Cisco courses for Skillsoft, and a network manager for Eastern Kentucky University. + +Currently, Kevin produces video courses and writes books for Cisco Press/Pearson IT Certification ( http://kwtrain.com/books ). Also, he owns and operates Kevin Wallace Training, LLC ( http://kwtrain.com ), a provider of self-paced training materials that sim-plify computer networking. Kevin holds a Bachelor of Science degree in electrical engi-neering from the University of Kentucky, and he lives in central Kentucky with his wife (Vivian) and two daughters (Sabrina and Stacie). + +Kevin can be followed on these social media platforms: + +Blog: http://kwtrain.com + +Twitter: http://twitter.com/kwallaceccie + +Facebook: http://facebook.com/kwallaceccie + +YouTube: http://youtube.com/kwallaceccie + +LinkedIn: http://linkedin.com/in/kwallaceccie + +Google+: http://google.com/+KevinWallace + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +v + +About the Technical Reviewers + +Michelle Plumb is a full-time CCSI (Certified Cisco Systems Instructor) as well as being certified as a Cisco Leading Classroom Virtual Instructor for Skillsoft. Michelle has 25 plus years’ experience in the field as an IT professional and telephony specialist. She maintains a high level of Cisco, Microsoft, and CompTIA certifications. Michelle has been a technical reviewer for numerous books related to the Cisco CCNP Routing and Switching, CCNP Voice, and CompTIA course material tracks. She has also written numerous articles around training and implementation of modern technologies. When she is not busy trying out the latest technology gadgets, she spends time at home in Phoenix, Arizona, with her husband and two dogs. + +Michael J. Shannon began his career in IT when he transitioned from a studio recording engineer to a network technician for a large telecom in the early 1990s. He soon began to focus on security and was one of the first to attain the Certified HIPAA Security Specialist (CHSS) certification. He has worked as an employee, contractor, and con-sultant for a number of large companies including Platinum Technologies, MindSharp, IBM, State Farm, Fujitsu, Skillsoft, Pearson PLC, and several others. He has attained +the following certifications: CCSI No. 32364, CISSP, CCSP/CCNP Security, ITIL 2011 Intermediate SO/RCV, CWNA, MCSE, Security+, and Network+. He has authored several books and written several articles concerning HealthCare IT Security. He resides with his wife in Corpus Christi, Texas. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +vi CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Dedication + +For the greatest teachers in my life. Career: my role model, Walter Elias Disney. Mentally: authors Zig Ziglar and Anthony Robbins. Spiritually: Pastors Dr. Virgil Grant and Michael Denney. Physically: personal trainers Christopher Poe and Terri Stein (along with all the trainers at Edge Body Boot Camp). Emotionally: the wisest person I know, my best friend and wife, Vivian Wallace. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +vii + +Acknowledgments + +I am very grateful to executive editor Brett Bartow. Over the years, Brett has given me many opportunities to reach people in the Cisco community through books and videos. Also, thanks to the entire team at Cisco Press. Working with each of you is a pleasure. + +To my friend Wendell Odom, who made major contributions to this book, thank you for all you’ve done for the Cisco community. Thanks also go out to technical editors Michelle Plumb and Michael Shannon. I’ve had the privilege of working with each of you and respect how deeply you care about your students. + +What I do would be impossible without support from my wife, Vivian, and my daugh-ters, Stacie and Sabrina. Knowing that you are cheering me on means more to me than you know. + +Finally, thanks to Jesus Christ, the source of my strength. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +viii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Contents at a Glance + +Introduction xxix + +Part I Fundamental Routing Concepts + +Chapter 1 Characteristics of Routing Protocols 3 + +Chapter 2 Remote Site Connectivity 47 + +Part II IGP Routing Protocols + +Chapter 3 IPv6 Review and RIPng 71 + +Chapter 4 Fundamental EIGRP Concepts 121 + +Chapter 5 Advanced EIGRP Concepts 155 + +Chapter 6 EIGRP for IPv6 and Named EIGRP 233 + +Chapter 7 Fundamental OSPF Concepts 259 + +Chapter 8 The OSPF Link-State Database 301 + +Chapter 9 Advanced OSPF Concepts 345 + +Part III Route Redistribution and Selection + +Chapter 10 Route Redistribution 399 + +Chapter 11 Route Selection 471 + + +Part IV + +Chapter 12 + +Internet Connectivity + +Fundamentals of Internet Connectivity 511 + + +Chapter 13 Fundamental BGP Concepts 533 + + +Chapter 14 + +Chapter 15 + +Advanced BGP Concepts 595 + +IPv6 Internet Connectivity 669 + + + +Part V + +Chapter 16 + +Router and Routing Security + +Fundamental Router Security Concepts 701 + + + +Chapter 17 + +Part VI + +Routing Protocol Authentication 737 + +Final Preparation + + +Chapter 18 Final Preparation 769 + + + + +www.allitebooks.com From the Library of Alexey Evseenko +ix + + +Part VII + +Appendix A + +Appendixes + +Answers to the “Do I Know This Already?” Quizzes 779 + + +Appendix B ROUTE Exam Updates 805 + +Appendix C Conversion Tables 809 + +Index 812 + +CD-Only Appendixes and Glossary + + +Appendix D + +Appendix E + +Appendix F + +Appendix G + +Memory Tables + +Memory Tables Answer Key + +Completed Planning Practice Tables + +Study Planner + +Glossary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +Contents + +Introduction xxix + + +Part I +Chapter 1 + +Fundamental Routing Concepts +Characteristics of Routing Protocols 3 + +“Do I Know This Already?” Quiz 3 Foundation Topics 6 +Routing Protocol Fundamentals 6 +The Role of Routing in an Enterprise Network 6 Routing Protocol Selection 7 +Scalability 8 +Vendor Interoperability 8 +IT Staff’s Familiarity with Protocol 9 Speed of Convergence 9 +Capability to Perform Summarization 9 Interior or Exterior Routing 10 +Routing Protocol Categories 11 Network Technology Fundamentals 16 +Network Traffic Types 16 Unicast 16 +Broadcast 16 Multicast 17 Anycast 18 +Network Architecture Types 19 Point-to-Point Network 19 Broadcast Network 19 +NBMA 20 +TCP/IP Fundamentals 21 IP Characteristics 21 Routing Review 24 +Asymmetric Routing 27 Maximum Transmission Unit 30 ICMP Messages 30 +TCP Characteristics 31 Three-Way Handshake 33 TCP Sliding Window 33 Out-of-Order Delivery 35 UDP Characteristics 35 + + + +From the Library of Alexey Evseenko +xi + +Network Migration Strategies 36 Routing Protocol Changes 36 IPv6 Migration 37 +Spanning Tree Protocol Migration 38 Migration to Easy Virtual Networking 39 +Exam Preparation Tasks 42 Planning Practice 42 +Design Review Table 42 +Implementation Plan Peer Review Table 43 Review All the Key Topics 44 +Complete the Tables and Lists from Memory 45 Definitions of Key Terms 45 +Chapter 2 Remote Site Connectivity 47 “Do I Know This Already?” Quiz 47 Foundation Topics 50 +Remote Connectivity Overview 50 +MPLS-Based Virtual Private Networks 50 Tunnel-Based Virtual Private Networks 50 Hybrid Virtual Private Networks 51 +MPLS VPN 51 +Layer 2 MPLS VPN 51 Layer 3 MPLS VPN 52 +GRE 53 DMVPN 56 +Multipoint GRE 57 NHRP 59 +IPsec 61 +Exam Preparation Tasks 66 Planning Practice 66 +Design Review Table 66 +Implementation Plan Peer Review Table 67 Create an Implementation Plan Table 68 +Choose Commands for a Verification Plan Table 68 Review All the Key Topics 69 +Complete the Tables and Lists from Memory 69 Define Key Terms 69 + + + + + +From the Library of Alexey Evseenko +xii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Part II + +Chapter 3 + +IGP Routing Protocols + +IPv6 Review and RIPng 71 + +“Do I Know This Already?” Quiz 71 Foundation Topics 75 +Global Unicast Addressing, Routing, and Subnetting 76 Global Route Aggregation for Efficient Routing 77 Conventions for Representing IPv6 Addresses 79 Conventions for Writing IPv6 Prefixes 80 +Global Unicast Prefix Assignment Example 82 +Subnetting Global Unicast IPv6 Addresses Inside an Enterprise 84 Prefix Terminology 87 +IPv6 Global Unicast Addresses Assignment 87 Stateful DHCP for IPv6 88 +Stateless Autoconfiguration 89 +Learning the Prefix/Length and Default Router with NDP Router Advertisements 89 +Calculating the Interface ID Using EUI-64 91 +Finding the DNS IP Addresses Using Stateless DHCP 92 Static IPv6 Address Configuration 93 +Survey of IPv6 Addressing 93 Overview of IPv6 Addressing 93 Unicast IPv6 Addresses 94 Unique Local IPv6 Addresses 94 Link-local Unicast Addresses 95 +IPv6 Unicast Address Summary 96 +Multicast and Other Special IPv6 Addresses 97 +Layer 2 Addressing Mapping and Duplicate Address Detection 97 Neighbor Discovery Protocol for Layer 2 Mapping 98 Duplicate Address Detection (DAD) 99 +Inverse Neighbor Discovery 99 +Configuring IPv6 Addresses on Cisco Routers 100 Configuring Static IPv6 Addresses on Routers 101 Multicast Groups Joined by IPv6 Router Interfaces 103 Connected Routes and Neighbors 104 +The IPv6 Neighbor Table 104 Stateless Autoconfiguration 105 + + + + + +From the Library of Alexey Evseenko +xiii + +RIP Next Generation (RIPng) 107 +RIPng: Theory and Comparisons to RIPv2 108 Configuring RIPng 109 +Verifying RIPng 112 Exam Preparation Tasks 115 Planning Practice 115 +Design Review Table 115 +Implementation Plan Peer Review Table 115 Create an Implementation Plan Table 116 +Choose Commands for a Verification Plan Table 117 Review All the Key Topics 118 +Complete the Tables and Lists from Memory 118 Define Key Terms 118 +Chapter 4 Fundamental EIGRP Concepts 121 “Do I Know This Already?” Quiz 121 Foundation Topics 125 +EIGRP Fundamentals 125 Configuration Review 125 Verification Review 127 Internals Review 131 +Exchanging Topology Information 131 +Calculating the Best Routes for the Routing Table 132 EIGRP Neighborships 134 +Manipulating EIGRP Hello and Hold Timers 134 Configuring the Hello/Hold Timers 135 Verifying the Hello/Hold Timers 137 +Preventing Unwanted Neighbors Using Passive Interfaces 138 Controlling Neighborships with Static Configuration 141 Configuring Static EIGRP Neighbors 142 +Caveat When Using EIGRP Static Neighbors 143 +Configuration Settings That Could Prevent Neighbor Relationships 144 Configuring EIGRP Metric Components (K-values) 145 +EIGRP Router ID 146 Neighborship over WANs 147 +Neighborship on Frame Relay 147 Neighborship on MPLS VPN 148 Neighborship on Metro Ethernet 149 + + + + +From the Library of Alexey Evseenko +xiv CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks 150 Planning Practice 150 +Design Review Table 150 +Implementation Plan Peer Review Table 150 Create an Implementation Plan Table 151 +Choose Commands for a Verification Plan Table 151 Review All the Key Topics 152 +Complete the Tables and Lists from Memory 153 Define Key Terms 153 +Chapter 5 Advanced EIGRP Concepts 155 “Do I Know This Already?” Quiz 155 Foundation Topics 162 +Building the EIGRP Topology Table 162 Seeding the EIGRP Topology Table 162 +The Content of EIGRP Update Message 163 The EIGRP Update Process 166 +WAN Issues for EIGRP Topology Exchange 167 +Split Horizon Default on Frame Relay Multipoint Subinterfaces 167 EIGRP WAN Bandwidth Control 170 +Building the IP Routing Table 172 +Calculating the Metrics: Feasible Distance and Reported Distance 172 EIGRP Metric Tuning 174 +Configuring Bandwidth and Delay 175 +Choosing Bandwidth Settings on WAN Subinterfaces 175 Metric Weights (K-values) 178 +Offset Lists 178 +Unequal Metric Route Load Sharing 180 Optimizing EIGRP Convergence 183 +Fast Convergence to Feasible Successors 183 Successor and Feasible Successor Concepts 184 Verification of Feasible Successors 185 Converging by Going Active 188 +The Impact of Stub Routers on Query Scope 190 The Impact of Summary Routes on Query Scope 192 Stuck in Active 193 + + + + + + +From the Library of Alexey Evseenko +xv + +Route Filtering 194 +Filtering by Referencing ACLs 196 Filtering by Referencing IP Prefix Lists 198 IP Prefix List Concepts 199 +Samples of Prefix List Matching 201 +Using IP Prefix Lists to Filter EIGRP Routes 202 Filtering by Using Route Maps 204 +Route Map Concepts 204 +Using Route Maps to Filter EIGRP Routes 206 Route Summarization 208 +Calculating Summary Routes 209 Choosing Where to Summarize Routes 209 +Influencing the Choice of Best Route for Summary Routes 210 Suboptimal Forwarding with Summarization 211 +Route Summarization Benefits and Trade-offs 213 Configuring EIGRP Route Summarization 213 Auto-summary 217 +Default Routes 219 +Default Routing to the Internet Router 219 Default Routing Configuration with EIGRP 220 +Advertising Static Default Routes with EIGRP 220 Configuring a Default Network 221 +Exam Preparation Tasks 225 Planning Practice 225 +Design Review Table 225 +Implementation Plan Peer Review Table 226 Create an Implementation Plan Table 227 +Choose Commands for a Verification Plan Table 228 Review All the Key Topics 229 +Complete the Tables and Lists from Memory 230 Define Key Terms 230 +Chapter 6 EIGRP for IPv6 and Named EIGRP 233 “Do I Know This Already?” Quiz 233 Foundation Topics 236 +EIGRP for IPv6 236 +EIGRP for IPv4 and IPv6: Theory and Comparisons 236 Configuring EIGRP for IPv6 237 +Verifying EIGRP for IPv6 240 + + + +From the Library of Alexey Evseenko +xvi CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Named EIGRP 243 +The Named EIGRP Hierarchical Structure 244 +Traditional EIGRP and Named EIGRP Configurations Compared 245 Verifying Named EIGRP 250 +Exam Preparation Tasks 253 Planning Practice 253 +Design Review Table 253 +Implementation Plan Peer Review Table 253 Create an Implementation Plan Table 254 +Choose Commands for a Verification Plan Table 255 Review All the Key Topics 255 +Complete the Tables and Lists from Memory 256 Define Key Terms 256 +Chapter 7 Fundamental OSPF Concepts 259 “Do I Know This Already?” Quiz 259 Foundation Topics 263 +OSPF Review 263 +OSPF Link-State Concepts 263 OSPF Configuration Review 266 OSPF Verification Review 268 OSPF Feature Summary 271 +OSPF Neighbors and Adjacencies on LANs 272 Enabling OSPF Neighbor Discovery on LANs 272 +Settings That Must Match for OSPF Neighborship 274 Optimizing Convergence Using Hello and Dead Timers 275 Using a Unique OSPF Router ID 278 +Using the Same IP MTU 279 +OSPF Neighbors and Adjacencies on WANs 281 OSPF Network Types 281 +OSPF Neighborship over Point-to-Point Links 282 +Neighborship over Frame Relay Point-to-Point Subinterfaces 284 Neighborship on MPLS VPN 285 +Neighborship on Metro Ethernet 287 Virtual Links 288 +Understanding OSPF Virtual Link Concepts 289 Configuring OSPF Virtual Links 291 +Verifying the OSPF Virtual Link 292 + + + + +From the Library of Alexey Evseenko +xvii + +Exam Preparation Tasks 295 Planning Practice 295 +Design Review Table 295 +Implementation Plan Peer Review Table 295 Create an Implementation Plan Table 296 +Choose Commands for a Verification Plan Table 297 Review All the Key Topics 298 +Complete the Tables and Lists from Memory 299 Define Key Terms 299 +Chapter 8 The OSPF Link-State Database 301 “Do I Know This Already?” Quiz 301 Foundation Topics 305 +LSAs and the OSPF Link-State Database 305 LSA Type 1: Router LSA 306 +LSA Type 2: Network LSA 312 Background on Designated Routers 312 Type 2 Network LSA Concepts 312 Type 2 LSA show Commands 313 +LSA Type 3: Summary LSA 317 Limiting the Number of LSAs 320 Summary of Internal LSA Types 321 +The Database Exchange Process 321 +OSPF Message and Neighbor State Reference 322 Exchange Without a Designated Router 323 Discovering a Description of the Neighbor’s LSDB 324 Exchanging the LSAs 325 +Exchange with a Designated Router 326 Flooding Throughout the Area 328 Periodic Flooding 329 +Choosing the Best OSPF Routes 330 +OSPF Metric Calculation for Internal OSPF Routes 330 Calculating the Cost of Intra-Area Routes 331 Calculating the Cost of Interarea Routes 332 +Special Rules Concerning Intra-Area and Interarea Routes on ABRs 336 +Metric and SPF Calculations 337 + + + + + +From the Library of Alexey Evseenko +xviii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Metric Tuning 337 +Changing the Reference Bandwidth 338 Setting Bandwidth 338 +Configuring Cost Directly 339 Verifying OSPF Cost Settings 339 +Exam Preparation Tasks 340 Planning Practice 340 +Design Review Table 340 +Implementation Plan Peer Review Table 340 Create an Implementation Plan Table 341 +Choose Commands for a Verification Plan Table 342 Review All the Key Topics 343 +Complete the Tables and Lists from Memory 343 Define Key Terms 343 +Chapter 9 Advanced OSPF Concepts 345 “Do I Know This Already?” Quiz 345 Foundation Topics 350 +Route Filtering 350 +Type 3 LSA Filtering 351 +Filtering OSPF Routes Added to the Routing Table 355 Route Summarization 356 +Manual Summarization at ABRs 357 Manual Summarization at ASBRs 360 +Default Routes and Stub Areas 361 +Domain-Wide Defaults Using the default-information originate Command 362 +Stubby Areas 364 +Introducing Stubby Area Types 365 Configuring and Verifying Stubby Areas 366 +Configuring and Verifying Totally Stubby Areas 371 The Not-So-Stubby Area (NSSA) 374 +OSPF Version 3 376 +OSPFv2 and OSPFv3 Comparison 376 OSPFv3 Traditional Configuration 377 OSPFv3 Address Family Configuration 384 +Exam Preparation Tasks 392 + + + + + +From the Library of Alexey Evseenko +xix + +Planning Practice 392 Design Review Table 392 +Implementation Plan Peer Review Table 393 Create an Implementation Plan Table 394 +Choose Commands for a Verification Plan Table 394 Review All the Key Topics 396 +Complete the Tables and Lists from Memory 396 Define Key Terms 396 +Part III Route Redistribution and Selection + +Chapter 10 Route Redistribution 399 +“Do I Know This Already?” Quiz 399 Foundation Topics 405 +Route Redistribution Basics 405 +The Need for Route Redistribution 405 Redistribution Concepts and Processes 408 +Redistribution into EIGRP 410 +EIGRP redistribute Command Reference 410 +Baseline Configuration for EIGRP Redistribution Examples 411 Configuring EIGRP Redistribution with Default Metric Components 412 Verifying EIGRP Redistribution 415 +Redistribution into OSPF 417 +OSPF redistribute Command Reference 418 +Configuring OSPF Redistribution with Minimal Parameters 419 Setting OSPF Metrics on Redistributed Routes 423 +LSAs and Metrics for External Type 2 Routes 423 +Determining the Next Hop for Type 2 External Routes— Intra-area 425 +Determining the Next Hop for Type 2 External Routes—Interarea 427 Redistributing into OSPF as E1 Routes 431 +A Brief Comparison of E1 and E2 Routes 432 External Routes in NSSAs 433 +Redistribution with Route Maps and Distribute Lists 436 Overview of Using Route Maps with Redistribution 436 Filtering Redistributed Routes with Route Maps 438 Configuring Route Filtering with Redistribution 439 + +Verifying Redistribution Filtering Operations + + + + + +www.allitebooks.com + +441 + + + + + +From the Library of Alexey Evseenko +xx CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Setting Metrics When Redistributing 443 Configuring the Metric Settings 443 Verifying the Metric Settings 445 Setting the External Route Type 446 +Redistribution Filtering with the distribute-list Command 447 Issues with Multiple Redistribution Points 447 +Preventing Routing Domain Loops with Higher Metrics 448 Preventing Routing Domain Loops with Administrative Distance 449 +EIGRP Default AD Defeats Loop from EIGRP to OSPF to EIGRP 450 EIGRP Default AD Defeats Loop from OSPF to EIGRP to OSPF 451 Setting AD per Route Source for Internal and External Routes 452 Domain Loop Problems with More Than Two Routing Domains 453 Using Per-Route Administrative Distance Settings 454 +Preventing Domain Loops by Filtering on Subnet While Redistributing 458 +Preventing Domain Loops by Filtering on Route Tag Using Distribute Lists 459 +Exam Preparation Tasks 462 Planning Practice 462 +Design Review Table 462 +Implementation Plan Peer Review Table 463 Create an Implementation Plan Table 465 +Choose Commands for a Verification Plan Table 465 Review All the Key Topics 467 +Complete the Tables and Lists from Memory 468 Define Key Terms 468 +Chapter 11 Route Selection 471 +“Do I Know This Already?” Quiz 471 Foundation Topics 476 +Cisco Express Forwarding 476 Operation of Process Switching 476 Operation of Fast Switching 477 +Operation of Cisco Express Forwarding 478 Policy-Based Routing 483 +Matching the Packet and Setting the Route 484 PBR Configuration Example 485 +How the default Keyword Impacts PBR Logic Ordering 488 + + + + +From the Library of Alexey Evseenko +xxi + +Additional PBR Functions 489 +Applying PBR to Locally Created Packets 489 Setting IP Precedence 489 +PBR with IP SLA 490 +IP Service-Level Agreement 490 Understanding IP SLA Concepts 491 Configuring and Verifying IP SLA 492 +Tracking SLA Operations to Influence Routing 496 Configuring a Static Route to Track an IP SLA Operation 496 Configuring PBR to Track an IP SLA 499 +VRF-Lite 499 +VRF-Lite Configuration 500 VRF Verification 502 +Exam Preparation Tasks 505 Planning Practice 505 +Design Review Table 505 +Implementation Plan Peer Review Table 506 Create an Implementation Plan Table 507 +Choose Commands for a Verification Plan Table 507 Review All the Key Topics 508 +Complete the Tables and Lists from Memory 509 Definitions of Key Terms 509 +Part IV Internet Connectivity + +Chapter 12 Fundamentals of Internet Connectivity 511 “Do I Know This Already?” Quiz 511 Foundation Topics 514 +Provider-Assigned IPv4 Addresses 514 Static IP Address Assignment 514 Dynamic IP Address Assignment 516 +NAT 518 +Basic NAT 518 +Dynamic NAT Configuration and Verification 520 Static NAT Configuration and Verification 522 PAT 523 +NAT Design Considerations 526 NVI 526 +Exam Preparation Tasks 528 + + + + +From the Library of Alexey Evseenko +xxii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Planning Practice 528 Design Review Table 528 +Implementation Plan Peer Review Table 528 Create an Implementation Plan Table 529 +Choose Commands for a Verification Plan Table 530 Review All the Key Topics 531 +Complete the Tables and Lists from Memory 531 Define Key Terms 531 +Chapter 13 Fundamental BGP Concepts 533 “Do I Know This Already?” Quiz 533 Foundation Topics 539 +The Basics of Internet Routing and Addressing 539 Public IP Address Assignment 540 +Internet Route Aggregation 541 The Impact of NAT/PAT 543 +Private IPv4 Addresses and Other Special Addresses 544 Introduction to BGP 545 +BGP Basics 545 +BGP ASNs and the AS_SEQ Path Attribute 546 Internal and External BGP 549 +Public and Private ASNs 550 +Outbound Routing Toward the Internet 551 +Comparing BGP and Default Routing for Enterprises 551 Single-Homed 553 +Dual-Homed 554 +Preferring One Path over Another for All Destinations 556 Choosing One Path over Another Using BGP 557 +Partial and Full BGP Updates 559 Single-Multihomed 561 +Dual-Multihomed 562 External BGP for Enterprises 563 +eBGP Neighbor Configuration 564 +Requirements for Forming eBGP Neighborships 565 +Issues When Redundancy Exists Between eBGP Neighbors 567 eBGP Multihop Concepts 569 +BGP Internals and Verifying eBGP Neighbors 570 Verifying eBGP Neighbor Status 571 Administratively Controlling Neighbor Status 574 BGP Message Summary 576 + + + +From the Library of Alexey Evseenko +xxiii + +Verifying the BGP Table 576 +The BGP Update Message 577 Examining the BGP Table 577 Viewing Subsets of the BGP Table 580 +Injecting Routes into BGP for Advertisement to the ISPs 583 Injecting Routes Using the network Command 583 +The Effect of auto-summary on the BGP network Command 585 Injecting Routes Using Redistribution 585 +Exam Preparation Tasks 588 Planning Practice 588 +Design Review Table 588 +Implementation Plan Peer Review Table 589 Create an Implementation Plan Table 589 +Choose Commands for a Verification Plan Table 590 Review All the Key Topics 591 +Complete the Tables and Lists from Memory 592 Define Key Terms 593 +Chapter 14 Advanced BGP Concepts 595 “Do I Know This Already?” Quiz 597 Foundation Topics 602 +Internal BGP Between Internet-Connected Routers 602 +Establishing the Need for iBGP with Two Internet-Connected Routers 602 +Configuring iBGP 603 Verifying iBGP 606 +Examining iBGP BGP Table Entries 607 +Understanding Next-Hop Reachability Issues with iBGP 611 Ensuring That Routes Exist to the Next-Hop Address 612 +Using neighbor neighbor-ip next-hop-self to Change the Next-Hop Address 613 +Avoiding Routing Loops When Forwarding Toward the Internet 614 Using an iBGP Mesh 616 +IGP Redistribution and BGP Synchronization 618 Route Filtering and Clearing BGP Peers 620 +BGP Filtering Overview 620 +Inbound and Outbound BGP Filtering on Prefix/Length 621 Clearing BGP Neighbors 625 + + + + +From the Library of Alexey Evseenko +xxiv CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Displaying the Results of BGP Filtering 627 Peer Groups 629 +BGP Path Attributes and Best-Path Algorithm 631 BGP Path Attributes 631 +Overview of the BGP Best-Path Algorithm 633 Perspectives on the Core Eight Best-Path Steps 635 Memorization Tips for BGP Best Path 636 +Influencing an Enterprise’s Outbound Routes 637 Influencing BGP Weight 637 +Sample Internetwork Used in the Weight Examples 638 +Setting the BGP Administrative Weight Using a Route Map 642 Setting Weight Using the neighbor weight Command 643 Setting the Local Preference 644 +Sample Internetwork Used in the Local_Pref and AS_Path Length Examples 645 +Setting the BGP Local_Pref Using a Route Map 648 IP Routes Based on BGP Best Paths 651 +Example of a BGP RIB Failure 652 +BGP and the maximum-paths Command 654 +Increasing the Length of the AS_Path Using AS_Path Prepend 654 Influencing an Enterprise’s Inbound Routes with MED 656 +MED Concepts 657 MED Configuration 659 +Exam Preparation Tasks 661 Planning Practice 661 +Design Review Table 661 +Implementation Plan Peer Review Table 662 Create an Implementation Plan Table 663 +Choosing Commands for a Verification Plan Table 664 Review All the Key Topics 666 +Complete the Tables and Lists from Memory 666 Define Key Terms 667 +Chapter 15 IPv6 Internet Connectivity 669 “Do I Know This Already?” Quiz 669 Foundation Topics 672 +IPv6 Internet Connections 672 +Methods of Assigning an IPv6 Address to a Customer Router 672 Manual Configuration of IPv6 Address and Default Route 673 + + + +From the Library of Alexey Evseenko +xxv + +IPv6 Access Control Lists 674 +IPv6 Internet Connection Security 677 BGP Support for IPv6 677 +Multiprotocol BGP Fundamentals 678 +IPv6 Routing over an IPv4 BGP Session 678 IPv6 Routing over an IPv6 BGP Session 684 +Single IPv4 BGP Session Versus Dual (IPv4 and IPv6) Sessions 689 Filtering IPv6 Routes with Prefix Lists 689 +Using Local Preference for IPv6 Path Selection 693 Exam Preparation Tasks 695 +Planning Practice 695 Design Review Table 695 +Implementation Plan Peer Review Table 695 Create an Implementation Plan Table 696 +Choose Commands for a Verification Plan Table 698 Review All the Key Topics 698 +Complete the Tables and Lists from Memory 699 Define Key Terms 699 + +Part V + +Chapter 16 + +Router and Routing Security + +Fundamental Router Security Concepts 701 + +“Do I Know This Already?” Quiz 701 Foundation Topics 704 +Elements of a Router Security Policy 704 Access Control Lists 705 +Time-Based ACLs 705 Infrastructure ACLs 707 +Management Plane Security 708 Secure Shell Versus Telnet 709 Password Encryption 711 Enable Secret Password 711 Line Password 712 Username Password 713 +Unicast Reverse Path Forwarding 714 Authentication, Authorization, and Accounting 719 SNMP Security 721 +NTP Authentication 724 Exam Preparation Tasks 729 + + + +From the Library of Alexey Evseenko +xxvi CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Planning Practice 729 Design Review Table 729 +Implementation Plan Peer Review Table 730 Create an Implementation Plan Table 731 +Choose Commands for a Verification Plan Table 732 Review All the Key Topics 733 +Complete the Tables and Lists from Memory 734 Define Key Terms 734 +Chapter 17 Routing Protocol Authentication 737 “Do I Know This Already?” Quiz 737 Foundation Topics 740 +Authentication Methods 740 Plain Text Authentication 740 Hashing Authentication 741 Key Chains 742 +EIGRP Authentication 744 +EIGRP for IPv4 Authentication 744 EIGRP for IPv6 Authentication 746 Named EIGRP Authentication 749 +OSPF Authentication 751 +Plain Text OSPFv2 Authentication 751 OSPFv2 MD5 Authentication 754 OSPFv3 Authentication 756 +BGP Authentication 759 +IPv4 BGP Authentication 760 IPv6 BGP Authentication 761 +Exam Preparation Tasks 764 Planning Practice 764 +Design Review Table 764 +Implementation Plan Peer Review Table 764 Create an Implementation Plan Table 765 +Choose Commands for a Verification Plan Table 766 Review All the Key Topics 767 +Complete the Tables and Lists from Memory 767 Define Key Terms 767 + + + + + + +From the Library of Alexey Evseenko +xxvii + + +Part VI + +Chapter 18 + +Final Preparation + +Final Preparation 769 + +Tools for Final Preparation 769 +Exam Engine and Questions on the CD 769 Install the Exam Engine 770 +Activate and Download the Practice Exam 770 Activating Other Exams 771 +Premium Edition 771 +The Cisco Learning Network 771 Memory Tables 771 +Chapter-Ending Review Tools 772 Suggested Plan for Final Review/Study 772 +Step 1: Review Key Topics and DIKTA Questions 773 Step 3: Hands-On Practice 773 +Step 6: Subnetting Practice 774 Step 7: Use the Exam Engine 774 +Summary 776 +Keep in Touch with Kevin 776 + +Part VII Appendixes + +Appendix A Answers to the “Do I Know This Already?” Quizzes 779 + +Appendix B ROUTE Exam Updates 805 + +Appendix C Conversion Tables 809 + +Index 812 + +CD-Only + + +Appendix D + +Appendix E + +Appendix F + +Appendix G + +Memory Tables + +Memory Tables Answer Key + +Completed Planning Practice Tables + +Study Planner + +Glossary + + + + + + + + + + +From the Library of Alexey Evseenko +xxviii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Icons Used in This Book + + + + +Router + + + + +Network Cloud + + +Workgroup Switch + + + +Serial Cable + + +Multilayer Switch + + + + +Line: Ethernet + +Firewall Server + + + + +VPN Tunnel PC + + + + + + +Standing Scroll Man + +Command Syntax Conventions + +The conventions used to present command syntax in this book are the same conventions used in the IOS Command Reference. The Command Reference describes these conven-tions as follows: + +■ Boldface indicates commands and keywords that are entered literally as shown. In actual configuration examples and output (not general command syntax), boldface indicates commands that are manually input by the user (such as a show command). + +■ Italics indicate arguments for which you supply actual values. + +■ Vertical bars (|) separate alternative, mutually exclusive elements. + +■ Square brackets ([ ]) indicate an optional element. + +■ Braces ({ }) indicate a required choice. + +■ Braces within brackets ([{ }]) indicate a required choice within an optional element. + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +xxix + +Introduction + +This book focuses on one major goal: to help you prepare to pass the ROUTE exam (300-101). To help you prepare, this book achieves other useful goals as well: It explains a wide range of networking topics, shows how to configure those features on Cisco routers, and explains how to determine whether the feature is working. As a result, you also can use this book as a general reference for IP routing and IP routing protocols. However, the motivation for this book, and the reason it sits within the Cisco Press +Official Certification Guide series, is that its primary goal is to help you pass the ROUTE exam. + +The rest of this introduction focuses on two topics: the ROUTE exam and a description of this book. + +The CCNP ROUTE Exam + +Cisco announced the original ROUTE exam (642-902) in January 2010. The term ROUTE does not act as an acronym; instead, the name describes the content of the exam, which focuses on IP routing. Generally, the exam includes detailed coverage of the EIGRP, OSPF, and BGP IP routing protocols; IPv6; and a few other smaller topics related to IP routing. + +Cisco first announced its initial professional-level certifications in 1998 with the CCNP Routing and Switching certification. CCNP Routing and Switching certification from its inception has included the same kinds of IP routing topics found in today’s ROUTE exam, but the exam names changed over the years. The exam names have tracked the names of the associated Cisco authorized courses for the same topics: Advanced Cisco Router Configuration (ACRC) in the early days, followed by Building Scalable Cisco Internetworks (BSCI), and now ROUTE, because the current Cisco-authorized course also goes by the name ROUTE. + +Like its ancestors, the ROUTE exam is a part of the certification requirements for both of the following Cisco certifications: + +■ Cisco Certified Networking Professional (CCNP) + +■ Cisco Certified Design Professional (CCDP) + +Each of these certifications emphasizes different perspectives on some similar topics. CCNP focuses on the skills needed by a network engineer working for an enterprise— that is, a company that deploys networking gear for its own purposes. CCDP focuses more on design, but good design requires solid knowledge of the technology and con-figuration. So, although this book frequently refers to the most popular certification of these two—CCNP—the ROUTE exam does apply to both certifications. + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +xxx CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Contents of the ROUTE Exam + +Every student who ever takes an exam wants to know what’s on the exam. As with all its exams, Cisco publishes a set of exam topics. These exam topics give general guidance as to what’s on the exam. + +You can find the exam topics at Cisco.com. The most memorable way to navigate is to go to www.cisco.com/go/ccnp and look for the ROUTE exam. Also, you can go to the Cisco Learning Network website ( www.cisco.com/go/learnnetspace )—a less memorable URL but a great Cisco certification site. The Cisco Learning Network site hosts exam information, learning tools, and forums in which you can communicate with others and learn more about this and other Cisco exams. + +Interestingly, some of the topics on the ROUTE (300-101) exam are topics that you covered in your CCNA studies (that is, in the CCENT [ICND1] and ICND2 curriculum). Also, several topics on the ROUTE exam are not covered in the Cisco official ROUTE course. A big goal of this book is to make sure that you are prepared for any topic you might encounter on the ROUTE exam. Therefore, in addition to covering topics in the official ROUTE course, this book also covers topics not found in the ROUTE course. Additionally, you might want to review your CCENT (ICND1) and ICND2 materials for exam topics coming from those courses. + +Table I-1 lists the topics on the ROUTE exam blueprint, with a reference to the part of this book that covers the topic or a reference to the CCNA course (that is, CCENT [ICND1] or ICND2) that covers the topic. + +Table I-1 ROUTE Exam (300-101) Topics + +Book Part Exam Topic (or CCNA Content) + +Network Principles + +III + +I + +I + +I + +I + +I + + +Identify Cisco Express Forwarding Concepts + +Explain General Network Challenges + +Describe IP Operations + +Explain TCP Operations + +Describe UDP Operations + +Recognize Proposed Changes to a Network + + +Layer 2 Technologies + +ICND2 WAN Circuit Technologies + +ICND2 Explain Frame Relay + +Layer 3 Technologies + +CCENT Identify, Configure, and Verify IPv4 Addressing and Subnetting + +III Identify IPv6 Addressing and Subnetting + + + + +From the Library of Alexey Evseenko +xxxi + + +Book Part Exam Topic (or CCNA Content) +CCENT Configure and Verify Static Routing + +II Configure and Verify Default Routing + +I Evaluate Routing Protocol Types + +II Describe Administrative Distance + +II Troubleshoot Passive Interfaces + +III Configure and Verify VRF-Lite + +II Configure and Verify Filtering with any Routing Protocol + +III Configure and Verify Redistribution Between any Routing Protocol/ Source +II Configure and Verify Manual and Auto Summarization with any Routing Protocol +III Configure and Verify Policy-Based Routing + +III Identify Sub-Optimal Routing + +III Explain Route Maps + +III Configure and Verify Loop Prevention Mechanisms + +II Configure and Verify RIPv2 + +II Describe RIPng + +II Describe EIGRP Packet Types + +II, V Configure and Verify EIGRP Neighbor Relationship and Authentication +II Configure and Verify EIGRP Stubs + +II Configure and Verify EIGRP Load-Balancing + +II Describe and Optimize EIGRP Metrics + +II Configure and Verify EIGRP for IPv6 + +II Describe OSPF Packet Types + +II, V Configure and Verify OSPF Neighbor Relationships and Authentication +II Configure and Verify OSPF Network Types, Area Types, and Router Types +II Configure and Verify OSPF Path Preference + +II Configure and Verify OSPF Operations + +II Configure and Verify OSPF for IPv6 (OSPFv3) + + + + + + +From the Library of Alexey Evseenko +xxxii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Book Part Exam Topic (or CCNA Content) +V Describe, Configure, and Verify BGP Peer Relationships and Authentication +IV Configure and Verify eBGP + +IV Explain BGP Attributes and Best-Path Selection + +Change to VPN Technologies + +I Configure and Verify GRE + +I Describe DMVPN + +I Describe Easy Virtual Networking (EVN) + +Infrastructure Security + +V Describe Cisco IOS AAA Using Local Database + +V Describe Device Security Using Cisco IOS AAA with TACACS+ and RADIUS +V Configure and Verify Device Access Control + +IV, V Configure and Verify Router Security Features + +Infrastructure Services + +CCENT Configure and Verify Device Management + +ICND2 Configure and Verify SNMP + +ICND2 Configure and Verify Logging + +V Configure and Verify Network Time Protocol + +CCENT Configure and Verify IPv4 and IPv6 DHCP + +CCENT Configure and Verify IPv4 Network Address Translation + +CCENT Describe IPv6 Network Address Translation + +III Describe the SLA Architecture + +III Configure and Verify IP SLA + +III Configure and Verify Tracking Objects + +ICND2 Configure and Verify NetFlow + + + +Note Supplemental study materials are available from Cisco Press: CCNP ROUTE Complete Video Course: http://kwtrain.com/routecourse CCNA Complete Video Course: http://kwtrain.com/ccnacourse +CCNA Official Certification Library: http://kwtrain.com/ccnabooks + + + + + +From the Library of Alexey Evseenko +xxxiii + +How to Take the ROUTE Exam + +As of the publication of this book, Cisco exclusively uses testing vendor Pearson Vue (www.vue.com) for delivery of all Cisco career certification exams. To register, go to www.vue.com, establish a login, and register for the 300-101 ROUTE exam. You also need to choose a testing center near your home. + +Who Should Take This Exam and Read This Book + +This book has one primary audience, with several secondary audiences. First, this book is intended for anyone wanting to prepare for the ROUTE 300-101 exam. The audience includes self-study readers—people who pass the test by studying 100 percent on their own. It includes Cisco Networking Academy students taking the CCNP curriculum, who +use this book to round out their preparation as they get close to the end of the Academy curriculum. + +The broader question about the audience might well be why you should take the ROUTE exam. First, the exam is required for the aforementioned CCNP and CCDP certifications from Cisco. These certifications exist at the midpoint of the Cisco certifi-cation hierarchy. These certifications have broader and deeper technology requirements as compared to the Cisco Certified Entry Network Technician (CCENT) and Cisco Certified Network Associate (CCNA) certifications. + +The real question then about the audience for this book—at least the intended audi-ence—is whether you have motivation to get one of these professional-level Cisco certi-fications. CCNP in particular happens to be a popular, well-respected certification. Also, +CCDP has been a solid certification for a long time, particularly for engineers who spend a lot of time designing networks with customers, rather than troubleshooting. + +Format of the CCNP ROUTE Exam + +The ROUTE exam follows the same general format as the other Cisco exams. When you get to the testing center and check in, the proctor will give you some general instructions and then take you into a quiet room with a PC. When you’re at the PC, you have a few things to do before the timer starts on your exam. For example, you can take a sample quiz, just to get accustomed to the PC and to the testing engine. Anyone who has user-level skills in getting around a PC should have no problems with the testing environment. + +When you start the exam, you will be asked a series of questions. You answer the ques-tion and then move on to the next question. The exam engine does not let you go back and change your answer. + +The exam questions can be in any of the following formats: + +■ Multiple-choice (MC) + +■ Testlet + +■ Drag-and-drop (DND) + + + + + +From the Library of Alexey Evseenko +xxxiv CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ Simulated lab (Sim) + +■ Simlet + +The first three types of questions are relatively common in many testing environments. The multiple-choice format simply requires that you point and click on a circle (that is, a radio button) beside the correct answer for a single-answer question or on squares (that is, check boxes) beside the correct answers for a multi-answer question. Cisco tradition-ally tells you how many answers you need to choose, and the testing software prevents you from choosing too many answers. Testlets are questions with one general scenario, with a collection of multiple-choice questions about the overall scenario. Drag-and-drop questions require you to left-click and hold a mouse button, move an object (for exam-ple, a text box) to another area on the screen, and release the mouse button to place the object somewhere else—typically into a list. For some questions, as an example, to get the question correct, you might need to put a list of five things into the proper order. + +The last two types both use a network simulator to ask questions. Interestingly, the two types actually allow Cisco to assess two very different skills. First, sim questions gener-ally describe a problem, and your task is to configure one or more routers and/or switch-es to fix the problem. The exam then grades the question based on the configuration that you changed or added. The simlet questions might well be the most difficult style of question on the exams. Simlet questions also use a network simulator, but instead +of answering the question by changing the configuration, the question includes one or more MC questions. The questions require that you use the simulator to examine the current behavior of a network, interpreting the output of any show commands that you can remember to answer the question. Although sim questions require you to trouble-shoot problems related to a configuration, simlets require you to both analyze working networks and networks with problems, correlating show command output with your knowledge of networking theory and configuration commands. + +The Cisco Learning Network website (http://learningnetwork.cisco.com) has tools that let you experience the environment and see how each of these question types works. The environment should be the same as when you passed CCNA (a prerequisite for CCNP and CCDP). + +CCNP ROUTE 300-101 Official Cert Guide + +This section lists a general description of the contents of this book. The description includes an overview of each chapter and a list of book features seen throughout the book. + +Book Features and Exam Preparation Methods + +This book uses several key methodologies to help you discover the exam topics on which you need more review, to help you fully understand and remember those details, and to help you prove to yourself that you have retained your knowledge of those top-ics. Therefore, this book does not try to help you pass the exams only by memorization but by truly learning and understanding the topics. + + + + +From the Library of Alexey Evseenko +xxxv + +The book includes many features that provide different ways to study and be ready for the exam. If you understand a topic when you read it, but do not study it any further, you will probably not be ready to pass the exam with confidence. The features included in this book give you tools that help you determine what you know, review what you know, better learn what you don’t know, and be well prepared for the exam. These tools include + +■ “Do I Know This Already?” Quizzes: Each chapter begins with a quiz that helps you determine the amount of time that you need to spend studying that chapter. + +■ Foundation Topics: These are the core sections of each chapter. They explain the protocols, concepts, and configurations for the topics in that chapter. + +■ Exam Preparation Tasks: The “Exam Preparation Tasks” section lists a series of study activities that should be done after reading the “Foundation Topics” section. Each chapter includes the activities that make the most sense for studying the topics in that chapter. The activities include + + +■ + + + + + + + + + + + +■ Key +Topic + + + + +■ + + + + + + +■ + +Planning Tables: The ROUTE exam topics include some perspectives on how an engineer plans for various tasks. The idea is that the CCNP-level en-gineer in particular takes the design from another engineer, plans the imple-mentation, and plans the verification steps—handing off the actual tasks to engineers working during change-window hours. Because the engineer plans the tasks, but might not be at the keyboard when implementing a feature, that engineer must master the configuration and verification commands so that the planned commands work for the engineer making the changes off-shift. The planning tables at the end of the chapter give you the chance to take the details in the Foundation Topics core of the chapter and think about them as if you were writing the planning documents. +Key Topics Review: The Key Topic icon is shown next to the most impor-tant items in the “Foundation Topics” section of the chapter. The Key Topics Review activity lists the key topics from the chapter and the page number where each key topic can be found. Although the contents of the entire chapter could be on the exam, you should definitely know the information listed in each key topic. Review these topics carefully. +Memory Tables: To help you exercise your memory and memorize some lists of facts, many of the more important lists and tables from the chapter are included in a document on the CD. This document lists only partial in-formation, allowing you to complete the table or list. CD-only Appendix D holds the incomplete tables, and Appendix E includes the completed tables from which you can check your work. +Definition of Key Terms: Although Cisco exams might be unlikely to ask a question such as “Define this term,” the ROUTE exam requires that you learn and know a lot of networking terminology. This section lists some of the most important terms from the chapter, asking you to write a short +definition and compare your answer to the Glossary on the enclosed CD. + + + + + + + +From the Library of Alexey Evseenko +xxxvi CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ CD-Based Practice Exam: The companion CD contains an exam engine, including access to a bank of multiple-choice questions. Chapter 18 gives two suggestions on how to use these questions: either as study questions or to simulate the ROUTE exam. + +■ Companion Website: The website http://kwtrain.com/routebook posts up-to-the-minute materials that further clarify complex exam topics. Check this site regularly for new and updated postings written by the author that provide further insight into the more troublesome topics on the exam. + +Book Organization + +This book contains 18 chapters, plus appendixes. The topics all focus in some way on IP routing and IP routing protocols, making the topics somewhat focused, but with deep coverage on those topics. + +The book organizes the topics into six major parts. The following list outlines the major part organization of this book: + +■ Part I: “Fundamental Routing Concepts”: This part includes two chapters that focus on routing fundamentals within an enterprise network (including connections to remote offices): + +■ Chapter 1: “Characteristics of Routing Protocols”: This introductory chap-ter is theory based and contains minimal Cisco IOS configuration. Specifi-cally, the chapter reviews routing protocol characteristics. The last section of the chapter then introduces a newer routing technology, the ability to run multiple virtual routers inside a single physical router. +■ Chapter 2: “Remote Site Connectivity”: This chapter discusses how Virtual Private Networks (VPN) can be used to connect an enterprise headquarters to remote sites. While a variety of VPN technologies are discussed, the Cisco IOS configuration presented focuses on setting up a GRE tunnel. +■ Part II: “IGP Routing Protocols”: Because current versions of RIP, EIGRP, and OSPF support IPv6 routing (in addition to IPv4), this seven-chapter part begins with a review of IPv6 addressing and a look at RIPng configuration. Then, this part covers EIGRP and OSPF theory and configuration in detail: + +■ Chapter 3: “IPv6 Review and RIPng”: The new version of the ROUTE cur-riculum dramatically increases the focus on routing IPv6 networks. There-fore, this chapter begins with a CCNA-level review of IPv6 addressing. Then, this chapter shows how to configure RIPng, which supports IPv6 routing (after contrasting RIPng with RIPv2). +■ Chapter 4: “Fundamental EIGRP Concepts”: This chapter reviews the basics of EIGRP, including EIGRP path selection and neighbor formation. +■ Chapter 5: “Advanced EIGRP Concepts”: This chapter discusses the details of how EIGRP builds its topology table, how those EIGRP-learned routes become candidates to be injected into a router’s IP routing table, and options for optimizing EIGRP convergence. Then, the chapter explores EIGRP route filtering, route summarization, and the use of default routes with EIGRP. + + + + +From the Library of Alexey Evseenko +xxxvii + +■ Chapter 6: “EIGRP for IPv6 and Named EIGRP”: This chapter begins by contrasting EIGRP for IPv4 and EIGRP for IPv6. Then, a hierarchical EIGRP configuration approach, called Named EIGRP, is demonstrated. +■ Chapter 7: “Fundamental OSPF Concepts”: This chapter reviews the basics of OSPF, including configuration, verification, and neighbor formation. The chapter then concludes with a look at virtual links. +■ Chapter 8: “The OSPF Link-State Database”: This chapter explains the various LSA types that OSPF uses to construct a link-state database. The process involved in exchanging link-state database routers with neighboring routers is also discussed. +■ Chapter 9: “Advanced OSPF Concepts”: This chapter discusses OSPF route filtering, route summarization, sourcing default route information, and special area types. Then, the chapter concludes with an examination of OSPFv3 and describes how it can be used to route IPv6 networks. +■ Part III: “Route Redistribution and Selection”: Because many enterprise networks need to simultaneously support multiple IGPs, this part begins by explaining how IGPs can coexist and be redistributed into one another. Then, the discussion delves into how a Cisco router makes its packet-switching decisions and how those deci-sions can be altered using the Policy-Based Routing (PBR) and IP Service-Level Agreement (IP SLA) features: + +■ Chapter 10: “Route Redistribution”: This chapter offers an extensive look into route redistribution. Specifically, the chapter begins by explaining route redistribution basics, followed by configuring route redistribution into EIGRP, route redistribution into OSPF, and tuning route redistribution using route maps and distribute lists. Finally, this chapter discusses IPv6 IGP route redistribution. +■ Chapter 11: “Route Selection”: This chapter begins with a comparison of packet-switching technologies supported by Cisco IOS routers, with a focus on Cisco Express Forwarding (CEF). Then, this chapter discusses how a router’s route selection can be influenced with the use of the Cisco Policy-Based Routing (PBR) and IP Service-Level Agreement (IP SLA) features. Finally, this chapter concludes by examining a basic configuration of VRF-Lite, which can allow a single physical router to run multiple virtual router instances. +■ Part IV: “Internet Connectivity”: When an enterprise network connects to the Internet, it might do so through a single connection and a default static route. Such a connection often uses Network Address Translation (NAT). However, with multiple Internet connections, the enterprise network might need to run Border Gateway Protocol (BGP). This part of the book examines both approaches to Internet con-nectivity (along with a discussion of NAT), including how BGP can connect to the Internet through IPv6: + +■ Chapter 12: “Fundamentals of Internet Connectivity”: This chapter discusses how a network could connect to the Internet using a single con-nection, using either a statically assigned or a dynamically learned address. + + + + +From the Library of Alexey Evseenko +xxxviii CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Additionally, this chapter contrasts various approaches to NAT configura-tion, including a new approach, called NAT Virtual Interface (NVI). +■ Chapter 13: “Fundamental BGP Concepts”: This chapter begins with an overview of Internet routing and addressing, followed by an introduction to BGP. Single-homed and multi-homed Internet connections are contrasted. Then, this chapter discusses a variety of external BGP (eBGP) confi guration options. +■ Chapter 14: “Advanced BGP Concepts”: While BGP is primarily consid-ered to be an exterior gateway protocol (EGP), internal BGP (iBGP) can be used within an autonomous system. This chapter examines the operation, configuration, and verification of iBGP. Then, this chapter discusses ap-proaches for avoiding BGP routing loops, how to filter BGP routes, how BGP makes its route selection decisions, and how to administratively influence those decisions. +■ Chapter 15: “IPv6 Internet Connectivity”: As support for IPv6 continues to grow, enterprise networks have an increasing need to connect to their Internet Service Provider(s) through IPv6. This chapter discusses how an ISP could assign an IPv6 address to a customer router, and how that customer router could use a static, default IPv6 route to point to its ISP. Additionally, this chapter introduces Multiprotocol BGP (MP-BGP), which adds a collec-tion of extensions to BGP version 4 and supports IPv6. +■ Part V: “Router and Routing Security”: Although Cisco has an entire CCNP Security track, the ROUTE curriculum, and this part of the book, does cover general strategies for better securing a Cisco router and authenticating routing protocols used between routers: + +■ Chapter 16: “Fundamental Router Security Concepts”: This chapter intro-duces the concept of a router security policy, covers time-based ACLs, and offers tips for securing a router’s management plane. +■ Chapter 17: “Routing Protocol Authentication”: This chapter compares various router authentication methods, and then focuses on how to authenti-cate specific routing protocols, including EIGRP, OSPF, and BGP. +■ Part VI: “Final Preparation”: This part concludes the book with recommendations for exam preparation. + +■ Chapter 18: “Final Preparation”: This nontechnical chapter identifies and explains how to use various exam preparation tools, followed by a step-by-step strategy for using this book to prepare for the ROUTE exam. +In addition to the core chapters of the book, the book has several appendixes. Some appendixes exist in the printed book, whereas others exist in soft-copy form on the CD included with the book. + + + + + + + + +From the Library of Alexey Evseenko +xxxix + +Appendixes printed in the book include + +■ Appendix A, “Answers to the ‘Do I Know This Already?’ Quizzes”: Includes the answers to all the questions from Chapters 1 through 17. + +■ Appendix B, “ROUTE Exam Updates”: Covers a variety of short topics that either clarify or expand upon topics covered earlier in the book. This appendix is updated from time to time, and posted at http://kwtrain.com/routebook, with the most recent version available at the time of printing included here as Appendix B. (The first page of the appendix includes instructions on how to check to see whether a later version of Appendix B is available online.) + +■ Appendix C, “Conversion Tables”: Lists a decimal-to-binary conversion table, deci-mal values 0 through 255, along with the binary equivalents. It also lists a hex-to-decimal conversion table. + +The appendixes included on the CD-ROM are + +■ Appendix D, “Memory Tables”: This appendix holds the key tables and lists from each chapter with some of the content removed. You can print this appendix, and as a memory exercise, complete the tables and lists. The goal is to help you memorize facts that can be useful on the exam. + +■ Appendix E, “Memory Tables Answer Key”: This appendix contains the answer key for the exercises in Appendix D. + +■ Appendix F, “Completed Planning Practice Tables”: The ends of Chapters 1 through 17 list planning tables that you can complete to help learn the content more deeply. If you use these tables, refer to this appendix for the suggested answers. + +■ Appendix G, “Study Planner”: A spreadsheet with major study milestones, where you can track your progress through your study. + +■ Glossary: The glossary contains definitions for all the terms listed in the “Define Key Terms” sections at the conclusions of Chapters 1 through 17. + +For More Information + +If you have any comments about the book, you can submit those through www.ciscopress.com. Just go to the website, select Contact Us, and type in your message. + +Cisco might make changes that affect the ROUTE exam from time to time. You should always check www.cisco.com/go/ccnp for the latest details. + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Routing Protocol Fundamentals: This section offers an overview of the role that routing plays in an enterprise network and contrasts various types of routing protocols. +■ Network Technology Fundamentals: This section distinguishes between different types of network traffic flows and network architectures. +■ TCP/IP Fundamentals: This section reviews the fundamental characteristics of IP, ICMP, TCP, and UDP. +■ Network Migration Strategies: This section offers a collection of design considerations for making changes to a network. + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 1 + + + + + + +Characteristics of Routing Protocols + + +One of the most fundamental technologies in network is routing. Routing, at its essence, is concerned with forwarding packets from their source on one subnet to their destina-tion on another subnet. Of course, a multitude of options and protocols are available for making this happen. In fact, routing is the theme of this entire book, the focus of Cisco’s ROUTE course, and the accompanying ROUTE exam (300-101). + +This chapter launches the discussion of routing by providing a conceptual introduction. Specifically, this chapter begins with a discussion of routing protocol fundamentals, fol-lowed by the basics of network technology and the TCP/IP suite of protocols. + +The chapter then concludes with a design discussion revolving around how to accommo-date the inevitable changes your network will undergo. For example, you will be given a collection of strategies for changing routing protocols in your network or migrating from IPv4 to IPv6. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these eight self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 1-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A . + +Table 1-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Routing Protocol Fundamentals + +Network Technology Fundamentals + +TCP/IP Fundamentals + +Network Migration Strategies + +Questions +1, 2 + +3, 4 + +5, 6 + +7, 8 + + + + + + + + + + +From the Library of Alexey Evseenko +4 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. Which of the following features prevents a route learned on one interface from being advertised back out of that interface? + +a. Poison Reverse + +b. Summarization + +c. Split Horizon + +d. Convergence + +2. Identify the distance-vector routing protocols from the following. (Choose the two best answers.) + +a. IS-IS + +b. EIGRP + +c. RIP + +d. OSPF + +e. BGP + +3. Select the type of network communication flow that is best described as “one-to-nearest.” + +a. Unicast + +b. Multicast + +c. Broadcast + +d. Anycast + +4. An NBMA network has which of the following design issues? (Choose the two best answers.) + +a. Split Horizon issues + +b. Bandwidth issues + +c. Quality of service issues + +d. Designated router issues + +5. Which of the following best defines TCP MSS? + +a. The total data in a TCP segment, including only the TCP header + +b. The total data in a TCP segment, not including any headers + +c. The total data in a TCP segment, including only the IP and TCP headers + +d. The total data in a TCP segment, including the Layer 2, IP, and TCP headers + + + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 5 + +6. A network segment has a bandwidth of 10 Mbps, and packets experience an end-to-end latency of 100 ms. What is the bandwidth-delay product of the network segment? +a. 100,000,000 bits + +b. 10,000,000 bits + +c. 1,000,000 bits + +d. 100,000 bits + +7. When migrating from a PVST+ to Rapid-PVST+, which PVST+ features can be dis-abled, because similar features are built into Rapid-PVST+? (Choose the two best answers.) +a. UplinkFast + +b. Loop Guard + +c. BackboneFast + +d. PortFast + +8. Cisco EVN uses what type of trunk to carry traffic for all virtual networks between two physical routers? + +a. VNET + +b. ISL + +c. dot1Q + +d. 802.10 + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +6 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Foundation Topics + + +Routing Protocol Fundamentals + +Routing occurs when a router or some other Layer 3 device (for example, a multilayer switch) makes a forwarding decision based on network address information (that is, Layer 3 information). A fundamental question, however, addressed throughout this book, is from where does the routing information originate? + +A router could know how to reach a network by simply having one of its interfaces directly connect that network. Perhaps you statically configured a route, telling a router exactly how to reach a certain destination network. However, for large enterprises, the use of static routes does not scale well. Therefore, dynamic routing protocols are typi-cally seen in larger networks (and many small networks, too). A dynamic routing protocol allows routers configured for that protocol to exchange route information and update that information based on changing network conditions. + +The first topic in this section explores the role of routing in an enterprise network. Then some of the characteristics of routing protocols are presented, to help you decide which routing protocol to use in a specific environment and to help you better understand the nature of routing protocols you find already deployed in a network. + +The Role of Routing in an Enterprise Network + +An enterprise network typically interconnects multiple buildings, has connectivity to one or more remote offices, and has one or more connections to the Internet. Figure 1-1 iden-tifies some of the architectural layers often found in an enterprise network design: + +■ Building Access: This layer is part of the Campus network and is used to provide user access to the network. Security (especially authentication) is important at this layer, to verify that a user should have access to the network. Layer 2 switching is typically used at this layer, in conjunction with VLANs. + +■ Building Distribution: This layer is part of the Campus network that aggregates building access switches. Multilayer switches are often used here. + +■ Campus Backbone: This layer is part of the Campus network and is concerned with the high-speed transfer of data through the network. High-end multilayer switches are often used here. + +■ Edge Distribution: This layer is part of the Campus network and serves as the ingress and egress point for all traffic into and out of the Campus network. Routers or multilayer switches are appropriate devices for this layer. + +■ Internet Gateways: This layer contains routers that connect the Campus network out to the Internet. Some enterprise networks have a single connection out to the Internet, while others have multiple connections out to one or more Internet Service Providers (ISP). + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 7 + + +Campus +(RIP, OSPF, EIGRP) + + +Internet Gateways (BGP) + + + + + +Campus Backbone + +Edge +Distribution Internet + + + + + +WAN Aggregation (RIP, OSPF, EIGRP) + +Building IP WAN Remote Offices Distribution + + +Building Access + + + + +Figure 1-1 Typical Components of an Enterprise Network + +■ WAN Aggregation: This layer contains routers that connect the Campus network out to remote offices. Enterprises use a variety of WAN technologies to connect to remote offices (for example, Multiprotocol Label Switching [MPLS]). + +Routing protocols used within the Campus network and within the WAN aggregation layer are often versions of Routing Information Protocol (RIP), Open Shortest Path First (OSPF), or Enhanced Interior Gateway Routing Protocol (EIGRP). However, when con-necting out to the Internet, Border Gateway Protocol (BGP) is usually the protocol of choice for enterprises having more than one Internet connection. + +An emerging industry trend is to connect a campus to a remote office over the Internet, as opposed to using a traditional WAN technology. Of course, the Internet is considered an untrusted network, and traffic might need to traverse multiple routers on its way from the campus to a remote office. However, a technology called Virtual Private Networks (VPN) allows a logical connection to be securely set up across an Internet connection. Chapter 2, “Remote Site Connectivity,” examines VPNs in more detail. + +Routing Protocol Selection + +As you read through this book, you will learn about the RIPv2, RIPng, OSPFv2, OSPFv3, EIGRP, BGP, and MP-BGP routing protocols. With all of these choices (and even more) available, a fundamental network design consideration becomes which routing protocol + + + + + + +From the Library of Alexey Evseenko +8 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +to use in your network. As you learn more about these routing protocols, keeping the fol-lowing characteristics in mind can help you do a side-by-side comparison of protocols: + +■ Scalability + +■ Vendor interoperability + +■ IT staff’s familiarity with protocol + +■ Speed of convergence + +■ Capability to perform summarization + +■ Interior or exterior routing + +■ Type of routing protocol + +This section of the chapter concludes by taking a closer look at each of these characteristics. + +Scalability + +How large is your network now, and how large is it likely to become? The answers to those questions can help determine which routing protocols not to use in your network. For example, while you could use statically configured routes in a network with just a couple of routers, such a routing solution does not scale well to dozens of routers. + +While all the previously mentioned dynamic routing protocols are capable of support-ing most medium-sized enterprise networks, you should be aware of any limitations. For example, all versions of RIP have a maximum hop count (that is, the maximum number of routers across which routing information can be exchanged) of 15 routers. BGP, on the +other hand, is massively scalable. In fact, BGP is the primary routing protocol used on the Internet. + +Vendor Interoperability + +Will you be using all Cisco routers in your network, or will your Cisco routers need to interoperate with non-Cisco routers? A few years ago, the answer to this question could be a deal-breaker for using EIGRP, because EIGRP was a Cisco-proprietary routing protocol. + +However, in early 2013, Cisco announced that it was releasing EIGRP to the Internet Engineering Task Force (IETF) standards body as an Informational RFC. As a result, any networking hardware vendor can use EIGRP on its hardware. If you are working in an environment with routers from multiple vendors, you should ensure that your Cisco router has an appropriate Cisco IOS feature set to support your desired routing protocol and that the third-party router(s) also support that routing protocol. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 9 +Fa0/0 + +IT Staff’s Familiarity with Protocol + +You and the IT staff at your company (or your customer’s company) might be much more familiar with one routing protocol than another. Choosing the routing protocol with which the IT staff is more familiar could reduce downtime (because of faster resolutions to troubleshooting issues). Also, if the IT staff is more familiar with the inner workings of one routing protocol, they would be more likely to take advantage of the protocol’s non-trivial features and tune the protocol’s parameters for better performance. + +Speed of Convergence + +A benefit of dynamic routing protocols over statically configured routes is the ability of a dynamic routing protocol to reroute around a network failure. For example, consider Figure 1-2. Router R1’s routing protocol might have selected the path through Router R3 as the best route to reach the 192.168.1.0 /24 network connected to Router R4. However, imagine that a link failure occurred on the Fast Ethernet link between Routers R3 and R4. Router R1’s routing protocol should be able to reroute around the link failure by sending packets destined for the 192.168.1.0 /24 network through Router R2. + + +R2 +S1/0 +Backup Path +S1/0 +S1/1 + + + +Fa0/0 +SW1 10.1.1.0/24 R1 Link Failure +Fa0/1 + + +Fa0/1 +S1/0 +R4 SW2 +192.168.1.0/24 + + + + +R3 +Fa0/1 +Fa0/0 + +Figure 1-2 Routing Protocol Convergence + +After this failover occurs, and the network reaches a steady-state condition (that is, the routing protocol is aware of current network conditions and forwards traffic based on those conditions), the network is said to be a converged network. The amount of time for the failover to occur is called the convergence time. + +Some routing protocols have faster convergence times than others. RIP and BGP, for example, might take a few minutes to converge, depending on the network topology. By contrast, OSPF and EIGRP can converge in just a few seconds. + +Capability to Perform Summarization + +Large enterprise networks can have routing tables with many route entries. The more entries a router maintains in its routing table, the more router CPU resources are required to calculate the best path to a destination network. Fortunately, many routing protocols + + + + + +From the Library of Alexey Evseenko +10 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +support the ability to do network summarization, although the summarization options and how summarization is performed do differ. + +Network summarization allows multiple routes to be summarized in a single route adver-tisement. Not only does summarization reduce the number of entries in a router’s routing table, but it also reduces the number of network advertisements that need to be sent. + +Figure 1-3 shows an example of route summarization. Specifically, Router R1 is summa-rizing the 10.0.0.0 /24, 10.0.1.0 /24, 10.0.2.0 /24, and 10.0.3.0 /24 networks into a single network advertisement of 10.0.0.0 /22. Notice that the first two octets (and therefore the first 16 bits) of all the networks are the same. Also, as shown in the figure, the first 6 bits in the third octet are the same for all the networks. Therefore, all the networks have the first 22 bits (that is, 16 bits in the first two octets plus 6 bits in the third octet) in com-mon. By using those 22 bits and setting the remaining bits to 0s, you find the network address, 10.0.0.0 /22. + + + +Key Topic + +10.0.0.0/24 10.0.1.0/24 10.0.2.0/24 10.0.3.0/24 + + +10.0.0.0/22 + + + + + + + +Third 128 64 Octet +Value +0 0 0 1 0 0 2 0 0 +3 0 0 + +R1 + +Third Octet + +32 16 8 4 2 1 + + +0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 +0 0 0 0 1 1 + + + + +6 Bits in Common in the Third Octet + +Figure 1-3 Network Summarization + + +Interior or Exterior Routing + +An autonomous system (AS) is a network under a single administrative control. Your company’s network, as an example, might be in a single AS. When your company con-nects out to two different ISPs, they are each in their own AS. Figure 1-4 shows such a topology. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 11 + + +ISP 1 AS: 65100 + + + + +Company A AS: 65000 + + +Figure 1-4 + + +ISP 2 AS: 65200 + + +Interconnection of Autonomous Systems + + +In Figure 1-4, Company A is represented with an AS number of 65000. ISP 1 is using an AS number of 65100, and ISP 2 has an AS number of 65200. + +When selecting a routing protocol, you need to determine where the protocol will run. Will it run within an autonomous system or between autonomous systems? The answer to that question determines whether you need an interior gateway protocol (IGP) or an exterior gateway protocol (EGP): + + +■ Key +Topic + + +■ + +IGP: An IGP exchanges routes between routers in a single AS. Common IGPs include OSPF and EIGRP. Although less popular, RIP and IS-IS are also considered IGPs. Also, be aware that BGP is used as an EGP; however, you can use interior BGP (iBGP) within an AS. + +EGP: Today, the only EGP in use is BGP. However, from a historical perspective, be aware that there was once another EGP, which was actually named Exterior Gateway +Protocol (EGP). + + + +Routing Protocol Categories + +Another way to categorize a routing protocol is based on how it receives, advertises, and stores routing information. The three fundamental approaches are distance-vector, link-state, and path-vector. + +Distance-Vector +A distance-vector routing protocol sends a full copy of its routing table to its directly attached neighbors. This is a periodic advertisement, meaning that even if there have been no topological changes, a distance-vector routing protocol will, at regular intervals, re-advertise its full routing table to its neighbors. + +Obviously, this periodic advertisement of redundant information is inefficient. Ideally, you want a full exchange of route information to occur only once and subsequent updates to be triggered by topological changes. + +Another drawback to distance-vector routing protocols is the time they take to converge, which is the time required for all routers to update their routing table in response to a topological change in a network. Hold-down timers can speed the convergence process. + + + + +www.allitebooks.com From the Library of Alexey Evseenko +12 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +After a router makes a change to a route entry, a hold-down timer prevents any subse-quent updates for a specified period of time. This approach helps stop flapping routes (which are routes that oscillate between being available and unavailable) from preventing convergence. + +Yet another issue with distance-vector routing protocols is the potential of a routing loop. To illustrate, consider Figure 1-5. In this topology, the metric being used is hop count, which is the number of routers that must be crossed to reach a network. As one example, Router R3’s routing table has a route entry for network 10.1.1.0 /24 available off of Router R1. For Router R3 to reach that network, two routers must be transited (Routers R2 and R1). As a result, network 10.1.1.0 /24 appears in Router R3’s routing table with a metric (hop count) of 2. + +Ethernet 1/0 Ethernet 1/0 + +10.1.2.0/24 +R1 Serial 0/0 Serial 0/0 R2 +10.1.1.0/24 + + +10.1.3.0/24 +10.1.4.0/24 +Serial 0/1 Serial 0/0 R3 + + +Router R2’s Routing Table Router R3’s Routing Table +Network Interface Metric Network Interface Metric + +10.1.1.0/24 S0/0 1 10.1.2.0/24 S0/0 0 10.1.3.0/24 S0/1 0 +10.1.4.0/24 S0/1 1 + +10.1.1.0/24 S0/0 2 10.1.2.0/24 S0/0 1 10.1.3.0/24 S0/0 0 +10.1.4.0/24 E1/0 0 + + +Figure 1-5 Routing Loop: Before Link Failure + +Continuing with the example, imagine that interface Ethernet 1/0 on Router R3 goes down. As shown in Figure 1-6, Router R3 loses its directly connected route (with a metric of 0) to network 10.1.4.0 /24; however, Router R2 had a route to 10.1.4.0 /24 in its routing table (with a metric of 1), and this route was advertised to Router R3. Router R3 adds this entry for 10.1.4.0 to its routing table and increments the metric by 1. + +Ethernet 1/0 Ethernet 1/0 +10.1.1.0/24 +10.1.4.0/24 + +10.1.2.0/24 +R1 Serial 0/0 Serial 0/0 R2 + + +10.1.3.0/24 +Serial 0/1 Serial 0/0 R3 + + +Router R2’s Routing Table Router R3’s Routing Table +Network Interface Metric Network Interface Metric + +10.1.1.0/24 S0/0 10.1.2.0/24 S0/0 10.1.3.0/24 S0/1 +10.1.4.0/24 S0/1 + +1 0 0 +1 10.1.4.0/24 Hop Count 1 + +10.1.1.0/24 S0/0 2 10.1.2.0/24 S0/0 1 10.1.3.0/24 S0/0 0 10.1.4.0/24 E1/0 0 +10.1.4.0/24 S0/0 2 + + +Figure 1-6 Routing Loop: After Link Failure + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 13 + +The problem with this scenario is that the 10.1.4.0 /24 entry in Router R2’s routing table was because of an advertisement that Router R2 received from Router R3. Now, Router R3 is relying on that route, which is no longer valid. The routing loop continues as Router R3 advertises its newly learned route of 10.1.4.0 /24 with a metric of 2 to its neighbor, Router R2. Because Router R2 originally learned the 10.1.4.0 /24 network from Router R3, when it sees Router R3 advertising that same route with a metric of 2, the network gets updated in Router R2’s routing table to have a metric of 3, as shown in Figure 1-7. + +Ethernet 1/0 Ethernet 1/0 +10.1.1.0/24 +10.1.4.0/24 + +10.1.2.0/24 +R1 Serial 0/0 Serial 0/0 R2 + + +10.1.3.0/24 +Serial 0/1 Serial 0/0 R3 + + +Router R2’s Routing Table Router R3’s Routing Table +Network Interface Metric Network Interface Metric + +10.1.1.0/24 S0/0 1 10.1.2.0/24 S0/0 0 10.1.3.0/24 S0/1 0 10.1.4.0/24 S0/1 1 +10.1.4.0/24 S0/1 3 + +10.1.1.0/24 S0/0 2 10.1.2.0/24 S0/0 1 +10.1.3.0/24 S0/0 0 +10.1.4.0/24 2 10.1.4.0/24 E1/0 0 10.1.4.0/24 S0/0 2 +Hop Count + + +Figure 1-7 Routing Loop: Routers R2 and R3 Incrementing the Metric for 10.1.4.0 /24 + +The metric for the 10.1.4.0 /24 network continues to increment in the routing tables for both Routers R2 and R3, until the metric reaches a value considered to be an unreachable value (for example, 16 in the case of RIP). This process is referred to as a routing loop. + +Distance-vector routing protocols typically use one of two approaches for preventing routing loops: + + +■ +Key Topic + +■ + +Split Horizon: The Split Horizon feature prevents a route learned on one interface from being advertised back out of that same interface. + +Poison Reverse: The Poison Reverse feature causes a route received on one interface to be advertised back out of that same interface with a metric considered to be +infinite. + + +Having either approach applied to the previous example would have prevented Router R3 from adding the 10.1.4.0 /24 network into its routing table based on an advertisement from Router R2. + +Routing protocols falling under the distance-vector category include + +■ Routing Information Protocol (RIP): A distance-vector routing protocol that uses a metric of hop count. The maximum number of hops between two routers in an RIP-based network is 15. Therefore, a hop count of 16 is considered to be infinite. Also, RIP is an IGP. Three primary versions of RIP exist. RIPv1 periodically broadcasts its entire IP routing table, and it supports only fixed-length subnet masks. RIPv2 sup-ports variable-length subnet masks, and it uses multicasts (to a multicast address of + + + + +From the Library of Alexey Evseenko +14 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +224.0.0.9) to advertise its IP routing table, as opposed to broadcasts. RIP next genera-tion (RIPng) supports the routing of IPv6 networks, while RIPv1 and RIPv2 support the routing of IPv4 networks. + +■ Enhanced Interior Gateway Routing Protocol (EIGRP): A Cisco-proprietary proto-col until early 2013, EIGRP has been popular in Cisco-only networks; however, other vendors can now implement EIGRP on their routers. + +EIGRP is classified as an advanced distance-vector routing protocol, because it improves on the fundamental characteristics of a distance-vector routing protocol. For example, EIGRP does not periodically send out its entire IP routing table to its neighbors. Instead it uses triggered updates, and it converges quickly. Also, EIGRP can support mul-tiple routed protocols (for example, IPv4 and IPv6). EIGRP can even advertise network services (for example, route plan information for a unified communications network) using the Cisco Service Advertisement Framework (SAF). + +By default, EIGRP uses bandwidth and delay in its metric calculation; however, other parameters can be considered. These optional parameters include reliability, load, and maximum transmission unit (MTU) size. + +The algorithm EIGRP uses for its route selection is not Dijkstra’s Shortest Path First algo-rithm (as used by OSPF). Instead, EIGRP uses Diffusing Update Algorithm (DUAL). + +Link-State +Rather than having neighboring routers exchange their full routing tables with one anoth-er, a link-state routing protocol allows routers to build a topological map of a network. Then, similar to a global positioning system (GPS) in a car, a router can execute an algo-rithm to calculate an optimal path (or paths) to a destination network. + +Routers send link-state advertisements (LSA) to advertise the networks they know how to reach. Routers then use those LSAs to construct the topological map of a network. The algorithm run against this topological map is Dijkstra’s Shortest Path First algorithm. + +Unlike distance-vector routing protocols, link-state routing protocols exchange full routing information only when two routers initially form their adjacency. Then, routing updates are sent in response to changes in the network, as opposed to being sent periodi-cally. Also, link-state routing protocols benefit from shorter convergence times, as com-pared to distance-vector routing protocols (although convergence times are comparable to EIGRP). + +Routing protocols that can be categorized as link-state routing protocols include + +■ Open Shortest Path First (OSPF): A link-state routing protocol that uses a metric of cost, which is based on the link speed between two routers. OSPF is a popular IGP, because of its scalability, fast convergence, and vendor interoperability. + +■ Intermediate System–to–Intermediate System (IS-IS): This link-state routing pro-tocol is similar in its operation to OSPF. It uses a configurable, yet dimensionless, metric associated with an interface and runs Dijkstra’s Shortest Path First algorithm. + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 15 + +Although using IS-IS as an IGP offers the scalability, fast convergence, and vendor interoperability benefits of OSPF, it has not been as widely deployed as OSPF. + + +Path-Vector +A path-vector routing protocol includes information about the exact path packets take to reach a specific destination network. This path information typically consists of a series of autonomous systems through which packets travel to reach their destination. Border Gateway Protocol (BGP) is the only path-vector protocol you are likely to encounter in a modern network. + +Also, BGP is the only EGP in widespread use today. In fact, BGP is considered to be the routing protocol that runs the Internet, which is an interconnection of multiple autono-mous systems. + +BGP’s path selection is not solely based on AS hops, however. BGP has a variety of other parameters that it can consider. Interestingly, none of those parameters are based on +link speed. Also, although BGP is incredibly scalable, it does not quickly converge in the event of a topological change. The current version of BGP is BGP version 4 (BGP-4). +However, an enhancement to BGP-4, called Multiprotocol BGP (MP-BGP), supports the routing of multiple routed protocols, such as IPv4 and IPv6. + +Summary of Categories +As a reference, Table 1-2 categorizes the previously listed routing protocols, based on their type and whether they are primarily an IGP or an EGP. + +Table 1-2 Routing Protocol Characteristics Key +Topic Routing Protocol Type Primarily IGP or EGP + +RIP Distance-Vector IGP + +EIGRP (Advanced) Distance-Vector IGP + +OSPF Link-State IGP + +IS-IS Link-State IGP + +BGP Path-Vector EGP + + +Note that a network can simultaneously support more than one routing protocol through the process of route redistribution. For example, a router could have one of its inter-faces participating in an OSPF area of the network and have another interface participat-ing in an EIGRP area of the network. This router could then take routes learned through OSPF and inject those routes into the EIGRP routing process. Similarly, EIGRP-learned routes could be redistributed into the OSPF routing process. + + + + + + +From the Library of Alexey Evseenko +16 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Network Technology Fundamentals + +When designing a new network or analyzing an existing network, the ability to determine how traffic flows through that network is a necessary skill. Traffic flow is determined both by the traffic type (for example, unicast, multicast, broadcast, or anycast) and the network architecture type (for example, point-to-point, broadcast, and nonbroadcast multiaccess [NMBA]). This section provides you with the basic characteristics of these network technologies. + +Network Traffic Types + +Traffic can be sent to a single network host, all hosts on a subnet, or a select grouping of hosts that requested to receive the traffic. These traffic types include unicast, broadcast, multicast, and anycast. + +Older routing protocols, such as RIPv1 and IGRP (the now-antiquated predecessor to EIGRP), used broadcasts to advertise routing information; however, most modern IGPs use multicasts for their route advertisements. + + +Note BGP establishes a TCP session between peers. Therefore, unicast transmissions are used for BGP route advertisement. + + + +Unicast + +Most network traffic is unicast in nature, meaning that traffic travels from a single source device to a single destination device. Figure 1-8 illustrates an example of a unicast trans-mission. In IPv4 networks, unicast addresses are made up of Class A, B, and C addresses. IPv6 networks instead use global unicast addresses, which begin with the 2000::/3 prefix. + + + + + + +Destination + +Video Server 10.1.1.1 +Address: + + + + + +Destination Address: 10.1.1.2 + +Receiver 10.1.1.1 +Receiver 10.1.1.2 + +Non-Receiver 10.1.1.3 + + +Figure 1-8 Sample IPv4 Unicast Transmission + + +Broadcast + +Broadcast traffic travels from a single source to all destinations in a subnet (that is, a broadcast domain). A broadcast address of 255.255.255.255 might seem that it would reach all hosts on an interconnected network. However, 255.255.255.255 targets all + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 17 + +devices on a single network, specifically the network local to the device sending a packet destined for 255.255.255.255. Another type of broadcast address is a directed broad- +cast address, which targets all devices in a remote network. For example, the address 172.16.255.255 /16 is a directed broadcast targeting all devices in the 172.16.0.0 /16 net-work. Figure 1-9 illustrates an example of a broadcast transmission. + + +Note Broadcasts are used in IPv4 networks, but not in IPv6 networks. + + + + + + + + + +Video Server + + +Figure 1-9 + + + + + +Destination Address: 255.255.255.255 + +Sample IPv4 Broadcast Transmission + +Receiver 10.1.1.1 +Receiver 10.1.1.2 + +Non-Receiver 10.1.1.3 + + + +Multicast + +Multicast technology provides an efficient mechanism for a single host to send traffic to multiple, yet specific, destinations. For example, imagine a network with 100 users. +Twenty of those users want to receive a video stream from a video server. With a unicast solution, the video server would have to send 20 individual streams, one stream for each recipient. Such a solution could consume a significant amount of network bandwidth and put a heavy processor burden on the video server. + +With a broadcast solution, the video server would only have to send the video stream once; however, the stream would be received by every device on the local subnet, even devices not wanting to receive it. Even though those devices do not want to receive the video stream, they still have to pause what they are doing and take time to check each of these unwanted packets. + +As shown in Figure 1-10, multicast offers a compromise, allowing the video server to send the video stream only once, and only sending the video stream to devices on the network that want to receive the stream. + +What makes this possible in IPv4 networks is the use of a Class D address. A Class D address, such as 239.1.2.3, represents the address of a multicast group. The video server could, in this example, send a single copy of each video stream packet destined for 239.1.2.3. Devices wanting to receive the video stream can join the multicast group. Based on the device request, switches and routers in the topology can then dynamically deter-mine out of which ports the video stream should be forwarded. + + + + + + +From the Library of Alexey Evseenko +18 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Multicast Group: 239.1.2.3 + + + + + + + + +Video Server + + + +Figure 1-10 + + + + + +Destination Address: 239.1.2.3 + + + + +Sample IPv4 Multicast Transmission + +Receiver 10.1.1.1 +Receiver 10.1.1.2 + + + +Non-Receiver 10.1.1.3 + + + +Note In IPv6 networks, multicast addresses have a prefix of ff00::/8. + + +Anycast + +With anycast, a single IPv6 address is assigned to multiple devices, as depicted in Figure 1-11. The communication flow is one-to-nearest (from the perspective of a router’s rout-ing table). +2200::1 + +Server A + + + + + + +R2 + + +R1 +Destination Address: +2200::1 R3 + + + + + +2100::1 Server B + +2200::1 + +Figure 1-11 IPv6 Anycast Example + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 19 + +In Figure 1-11, a client with an IPv6 address of 2100::1 wants to send traffic to a desti-nation IPv6 address of 2200::1. Notice that two servers (Server A and Server B) have an IPv6 address of 2200::1. In the figure, the traffic destined for 2200::1 is sent to Server A through Router R2, because the network on which Server A resides appears to be closer than the network on which Server B resides, from the perspective of Router R1’s IPv6 routing table. + + +Note Anycast is an IPv6 concept and is not found in IPv4 networks. Also, note that IPv6 anycast addresses are not unique from IPv6 unicast addresses. + + + +Network Architecture Types + +Another set of network technologies that impact routing, and determine traffic flow, deal with network architecture types (for example, point-to-point, broadcast, and NBMA). For design and troubleshooting purposes, you should be familiar with the characteristics of each. + +Point-to-Point Network + +A very basic network architecture type is a point-to-point network. As seen in Figure +1-12, a point-to-point network segment consists of a single network link interconnecting two routers. This network type is commonly found on serial links. + + + +R1 + +Figure 1-12 + +R2 + +Point-to-Point Network Type + + + +Broadcast Network + +A broadcast network segment uses an architecture in which a broadcast sent from one of the routers on the network segment is propagated to all other routers on that segment. An Ethernet network, as illustrated in Figure 1-13, is a common example of a broadcast network. + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +20 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide +DLCI = 103 + + + +R1 + +Broadcast + + +SW1 + + + + +R2 R3 + +Figure 1-13 Broadcast Network Type + + +NBMA + +As its name suggests, a nonbroadcast multiaccess (NBMA) network does not support broadcasts. As a result, if an interface on a router connects to two other routers, as depict-ed in Figure 1-14, individual messages must be sent to each router. + + + +Frame Relay Switch BR1 +DLCI = 201 +S1/0: 10.1.1.2/24 + +HQ +DLCI = 102 +S1/0: 10.1.1.1/24 + + +BR2 +S1/0: 10.1.1.3/24 +DLCI = 301 + +Figure 1-14 NBMA Network Type + +The absence of broadcast support also implies an absence of multicast support. This can lead to an issue with dynamic routing protocols (such as OSPF and EIGRP) that +dynamically form neighborships with neighboring routers discovered through multicasts. Because neighbors cannot be dynamically discovered, neighboring IP addresses must be statically configured. Examples of NBMA networks include ATM and Frame Relay. + +The requirement for static neighbor configuration is not the only routing protocol issue stemming from an NBMA network. Consider the following: + + + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 21 + + +■ +Key Topic + + + + + + + + +■ + +Split Horizon issues: Distance-vector routing protocols (RIP and EIGRP, for exam-ple) can use the previously mentioned Split Horizon rule, which prevents routes learned on one interface from being advertised back out of that same interface. Consider Figure 1-14 again. Imagine that Router BR2 advertised a route to Router HQ, and Router HQ had Split Horizon enabled for its S 1/0 interface. That condi-tion would prevent Router HQ from advertising that newly learned route to Router BR1, because it would be advertising that route out the same interface on which it was learned. Fortunately, in situations like this, you can administratively disable Split Horizon. + +Designated router issues: Recall from your CCNA studies that a broadcast net-work (for example, an Ethernet network) OSPF elects a designated router (DR), with which all other routers on a network segment form an adjacency. Interestingly, OSPF attempts to elect a DR on an NMBA network, by default. Once again considering Figure 1-14, notice that only Router HQ has a direct connection to the other rout-ers; therefore, Router HQ should be the DR. This election might not happen without administrative intervention, however. Specifically, in such a topology, you would need to set the OSPF Priority to 0 on both Routers BR1 and BR2, which prevents +them from participating in a DR election. + + + +TCP/IP Fundamentals + +Recall from your CCNA studies that the Internet layer of the TCP/IP stack maps to Layer 3 (that is, the network layer) of the Open Systems Interconnection (OSI) model. While multiple routed protocols (for example, IP, IPX, and AppleTalk) reside at the OSI model’s network layer, Internet Protocol (IP) has become the de-facto standard for network communication. + +Sitting just above IP, at the transport layer (of both the TCP/IP and OSI models) is Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). This sec-tion reviews the basic operation of the TCP/IP suite of protocols, as their behavior is the foundation of the routing topics in the remainder of this book. + +IP Characteristics + +Figure 1-15 shows the IP version 4 packet header format. + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +22 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Version Length Type of Service Total Length +Header + +Identification IP Flags Fragment Offset + + +TTL Protocol Header Checksum + + +Source Address + + +Destination Address + + +IP Option (Variable Length) + + +Figure 1-15 IP Version 4 Packet Header Format + +The functions of the fields in an IPv4 header are as follows: + +■ Version field: The Version field indicates IPv4 (with a value of 0100). + +■ Header Length field: The Header Length field (commonly referred to as the Internet Header Length (IHL) field) is a 4-bit field indicating the number of 4-byte words in the IPv4 header. + +■ Type of Service field: The Type of Service (ToS) field (commonly referred to as the ToS Byte or DHCP field) has 8 bits used to set quality of service (QoS) mark-ings. Specifically, the 6 leftmost bits are used for the Differentiated Service Code Point (DSCP) marking, and the 2 rightmost bits are used for Explicit Congestion +Notification (an extension of Weighted Random Early Detection (WRED), used for flow control). + +■ Total Length field: The Total Length field is a 16-bit value indicating the size of the packet (in bytes). + +■ Identification field: The Identification field is a 16-bit value used to mark fragments that came from the same packet. + +■ IP Flags field: The IP Flags field is a 3-bit field, where the first bit is always set to a 0. The second bit (the Don’t Fragment [DF] bit) indicates that a packet should not be fragmented. The third bit (the More Fragments [MF] bit) is set on all of a pack-et’s fragments, except the last fragment. + +■ Fragment Offset field: The Fragment Offset field is a 13-bit field that specifies the offset of a fragment from the beginning of the first fragment in a packet, in 8-byte units. + +■ Time to Live (TTL) field: The Time to Live (TTL) field is an 8-bit field that is dec-remented by 1 every time the packet is routed from one IP network to another (that + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 23 + +is, passes through a router). If the TTL value ever reaches 0, the packet is discarded from the network. This behavior helps prevent routing loops. + +■ Protocol field: The Protocol field is an 8-bit field that specifies the type of data encapsulated in the packet. TCP and UDP are common protocols identified by this field. + +■ Header Checksum field: The Header Checksum field is a 16-bit field that performs error checking for a packet’s header. Interestingly, this error checking is performed for UDP segments, in addition to TCP segments, even though UDP is itself an “unre-liable” protocol. + +■ Source Address field: The 32-bit Source Address field indicates the source of an IPv4 packet. + +■ Destination Address field: The 32-bit Destination Address field indicates the desti-nation of an IPv4 packet. + +■ IP Option field: The IP Option field is a seldom-used field that can specify a variety of nondefault packet options. If the IP Option field is used, its length varies based on the options specified. + +An IPv6 packet header, as seen in Figure 1-16, is simpler in structure than the IPv4 packet header. + + +Version Traffic Class Flow Label + + +Payload Length Next Header Hop Limit + + +Source Address + + +Destination Address + + +Figure 1-16 IP Version 6 Packet Header Format + +The purposes of the fields found in an IPv6 header are as follows: + +■ Version field: Like an IPv4 header, an IPv6 header has a Version field, indicating IPv6 (with a value of 0110). + +■ Traffic Class field: The Traffic Class field is the same size, performs the same func-tions, and takes on the same values as the Type of Service field in an IPv4 header. + +■ Flow Label field: The 20-bit Flow Label field can be used to instruct a router to use a specific outbound connection for a traffic flow (if a router has multiple outbound connections). By having all packets in the same flow use the same connection, the probability of packets arriving at their destination out of order is reduced. + + + + +From the Library of Alexey Evseenko +24 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ Payload Length field: The Payload Length field is a 16-bit field indicating the size (in bytes) of the payload being carried by an IPv6 packet. + +■ Next Header field: The Next Header field, similar to the Protocol field in an IPv4 header, indicates the type of header encapsulated in the IPv6 header. Typically, this 8-bit header indicates a specific transport layer protocol. + +■ Hop Limit field: The 8-bit Hop Limit field replaces, and performs the same function as, the IPv4 header’s TTL field. Specifically, it is decremented at each router hop until it reaches 0, at which point the packet is discarded. + +■ Source Address field: Similar to the IPv4 header’s 32-bit Source Address field, the IPv6 Source Address field is 128 bits in size and indicates the source of an IPv6 packet. + +■ Destination Address field: Similar to the IPv4 header’s 32-bit Destination Address field, the IPv6 Destination Address field is 128 bits in size and indicates the destina-tion of an IPv6 packet. + + +Routing Review + +As a review from your CCNA studies, recall how the fields in an IP header are used to route a packet from one network to another. While the process is similar for IPv6, the fol-lowing example considers IPv4. + +In the topology shown in Figure 1-17, PC1 needs to send traffic to Server1. Notice that these devices are on different networks. So, the question becomes, “How does a packet from a source IP address of 192.168.1.2 get forwarded to a destination IP address of 192.168.3.2?” + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 +Default Gateway: 192.168.1.1 + +PC1 + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + + +Server1 + + + + + + +SW1 Fa0/0 R1 +192.168.1.1/24 AAAA.AAAA.AAAA + +S1/1 +192.168.2.1/30 S1/1 R2 192.168.2.2/30 + + +Fa0/0 SW2 192.168.3.1/24 +BBBB.BBBB.BBBB + + +Figure 1-17 Basic Routing Topology + +The answer is routing, as summarized in the following steps: + +Step 1. PC1 compares its IP address and subnet mask of 192.168.1.2 /24 with the des-tination IP address and subnet mask of 192.168.3.2 /24. PC1 concludes that the destination IP address resides on a remote subnet. Therefore, PC1 needs to + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 25 + +send the packet to its default gateway, which could have been manually con-figured on PC1 or dynamically learned through Dynamic Host Configuration Protocol (DHCP). In this example, PC1 has a default gateway of 192.168.1.1 (Router R1). However, to construct a Layer 2 frame, PC1 also needs the MAC address of its default gateway. PC1 sends an Address Resolution Protocol (ARP) request for Router R1’s MAC address. After PC1 receives an ARP reply from Router R1, PC1 adds Router R1’s MAC address to its ARP cache. PC1 now sends its data in a frame destined for Server1, as shown in Figure 1-18. + + +Note ARP uses broadcasts, which are not supported by IPv6. Therefore, IPv6 exchanges Neighbor Discovery messages with adjacent devices to perform functions similar to ARP. + + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 +Default Gateway: 192.168.1.1 + +PC1 PC1’s ARP Cache + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + +192.168.1.1 AAAA.AAAA.AAAA +Server1 + +ARP Request + +ARP Reply + + + +SW1 Fa0/0 192.168.1.1/24 +AAAA.AAAA.AAAA + +Data Frame + +S1/1 +R1 192.168.2.1/30 S1/1 R2 +192.168.2.2/30 + + +Fa0/0 SW2 192.168.3.1/24 +BBBB.BBBB.BBBB + + +Source IP Address: 192.168.1.2 Source MAC Address: 1111.1111.1111 Destination IP Address: 192.168.3.2 +Destination MAC Address: AAAA.AAAA.AAAA + + +Figure 1-18 + +Step 2. + + +Basic Routing: Step 1 + +Router R1 receives the frame sent from PC1 and interrogates the IP header. An IP header contains a Time to Live (TTL) field, which is decremented once for each router hop. Therefore, Router R1 decrements the packet’s TTL field. If the value in the TTL field is reduced to 0, the router discards the frame and sends a time exceeded Internet Control Message Protocol (ICMP) message back to the source. Assuming that the TTL is not decremented to 0, Router R1 checks its routing table to determine the best path to reach network 192.168.3.0 /24. In this example, Router R1’s routing table has an entry stating that network 192.168.3.0 /24 is accessible through interface Serial 1/1. Note that ARPs are not required for serial interfaces, because these interface types do not have MAC addresses. Router R1, therefore, forwards the frame out of +its Serial 1/1 interface, as shown in Figure 1-19. + + + + + + + +From the Library of Alexey Evseenko +26 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 +Default Gateway: 192.168.1.1 + +PC1 + + + + + +Source IP Address: 192.168.1.2 Source MAC Address: N/A Destination IP Address: 192.168.3.2 Destination MAC Address: N/A + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + + +Server1 + + + + + +SW1 Fa0/0 192.168.1.1/24 +AAAA.AAAA.AAAA + +Data Frame + +S1/1 +R1 192.168.2.1/30 S1/1 192.168.2.2/30 + + + +R2 Fa0/0 SW2 192.168.3.1/24 +BBBB.BBBB.BBBB + + +Router R1’s Route Entry 192.168.3.0/24 Serial 1/1 + + +Figure 1-19 + +Step 3. + + +Basic Routing: Step 2 + +When Router R2 receives the frame, it decrements the TTL in the IP header, just as Router R1 did. Again, assuming that the TTL did not get decremented to 0, Router R2 interrogates the IP header to determine the destination net-work. In this case, the destination network of 192.168.3.0 /24 is directly attached to Router R2’s Fast Ethernet 0/0 interface. Similar to how PC1 sent out an ARP request to determine the MAC address of its default gateway, Router R2 sends an ARP request to determine the MAC address of Server1. After an ARP Reply is received from Server1, Router R2 forwards the frame +out of its Fast Ethernet 0/0 interface to Server1, as illustrated in Figure 1-20. + + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 +Default Gateway: 192.168.1.1 + +PC1 + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + + +Server1 + + +Router R2’s ARP Cache ARP Request +192.168.3.2 2222.2222.2222 +ARP Reply + + +SW1 Fa0/0 R1 +192.168.1.1/24 AAAA.AAAA.AAAA + +S1/1 +192.168.2.1/30 S1/1 R2 192.168.2.2/30 + + +Fa0/0 SW2 192.168.3.1/24 +BBBB.BBBB.BBBB + + +Data Frame + +Source IP Address: 192.168.1.2 Source MAC Address: BBBB.BBBB.BBBB +Destination IP Address: 192.168.3.2 Destination MAC Address: 2222.2222.2222 + +Figure 1-20 Basic Routing: Step 3 + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 27 +DSW2 + +Asymmetric Routing + +Many times, routing operations are impacted by Layer 2 switching in a network. As an example, consider a situation, as depicted in Figure 1-21, where a VLAN is spread across multiple access layer switches, and a First-Hop Redundancy Protocol (FHRP) (for exam-ple, HSRP, VRRP, or GLBP) is being used on multilayer switches at the distribution layer. + + + +Internet + + + + + + + +CSW1 + + + + +Active HSRP Router + +Core Layer + + + + +Standby HSRP Router + + + + +DSW1 + +Distribution Layer + + + + + + + +ASW1 + + +VLAN 100 + + +ASW2 Access Layer + +VLAN 100 + + + +10.1.1.100/24 PC1 PC2 10.1.1.101/24 + + +Figure 1-21 Topology with Asymmetric Routing + +In the figure, notice that VLAN 100 (that is, 10.1.1.0 /24) exists on both switches ASW1 and ASW2 at the access layer. Also, notice that there are two multilayer switches (that is, DSW1 and DSW2) at the distribution layer with an HSRP configuration to provide default gateway redundancy to hosts in VLAN 100. The multilayer switch in the core layer (that is, CSW1) supports equal-cost load balancing between DSW1 and DSW2. + + + + + + +From the Library of Alexey Evseenko +28 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Focusing on the HSRP configuration, imagine that DSW1 is the active HSRP “router” and DSW2 is the standby HSRP “router.” Next, imagine that PC1 sends traffic out to the Internet. The traffic flows through ASW1, DSW1 (the active HSRP router), and CSW1, as shown in Figure 1-22. + + + +Internet + + + + + +Core Outbound Traffic CSW1 Layer +Flow + + + + +Active HSRP Router + +DSW1 + + +Standby HSRP Router + +Distribution Layer +DSW2 + + + + + + + +ASW1 + + +VLAN 100 + + +ASW2 Access Layer + +VLAN 100 + + + +10.1.1.100/24 PC1 PC2 10.1.1.101/24 + + +Figure 1-22 Unidirectional Outbound Traffic + +A challenge with this common scenario can occur with the return traffic, as illustrated in Figure 1-23. The return traffic flows from the Internet and into CSW1, which then load-balances between DSW1 and DSW2. When the path through DSW1 is used, the MAC address of PC1 is known to DSW1’s ARP cache (because it just saw PC1’s MAC address being used as the source MAC address in a packet going out to the Internet). However, when the path through DSW2 is used, DSW2 might not have PC1’s MAC address in its ARP cache (because PC1 isn’t normally using DSW2 as its default gateway). As a result, DSW2 floods this unknown unicast traffic out all its other ports. This issue is known as + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 29 +DSW2 + +asymmetric routing, because traffic might leave through one path (for example, through DSW1) and return through a different path (for example, through DSW2). Another name given to this issue is unicast flooding, because of the potential for a backup FHRP rout-er or multilayer switch to flood unknown unicast traffic for returning traffic. + + +Key +Topic Internet + + + + + + +Inbound Traffic Flow from Internet to CSW1 + +One Possible Load Balancing Path from CSW1 to DSW1 + +Another Possible Load Balancing Path from CSW1 to DSW2 + + +CSW1 + + + + +Active HSRP Router + +Core Layer + + + + +Standby HSRP Router + + + + +DSW1 + +Distribution Layer + + + + + + + +ASW1 + + +VLAN 100 + + +ASW2 Access Layer + +VLAN 100 + + + +10.1.1.100/24 PC1 PC2 10.1.1.101/24 + + +Figure 1-23 Unidirectional Flooding of Inbound Traffic + +Cisco recommends that you do not span a VLAN across more than one access layer switch to avoid such an issue. However, if a particular design requires the spanning of a VLAN across multiple access layer switches, the best-practice recommendation from Cisco is that you adjust the FHRP device’s ARP timer to be equal to or less than the Content Addressable Memory (CAM) aging time. Otherwise, the CAM table entry for the end station will time out before the ARP entry times out, meaning that the FHRP +device knows (from its ARP cache) the MAC address corresponding to the destination IP address, and therefore does not need to ARP for the MAC address. However, if the CAM + + + + +From the Library of Alexey Evseenko +30 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +entry has timed out, the FHRP device needs to flood the traffic to make sure that it gets to the intended destination. With an ARP timer equal to or less than the CAM aging time, there will never be an ARP entry for a MAC address not also stored in the CAM table. As a result, if the FHRP device’s ARP entry has timed out, it will use ARP to get the MAC address of the destination IP address, thus causing the CAM table to learn the appropriate egress port. + +Maximum Transmission Unit + +A Maximum Transmission Unit (MTU), in the context of Cisco routers, typically refers to the largest packet size supported on a router interface; 1500 bytes is a common value. Smaller MTU sizes result in more overhead, because more packets (and therefore more headers) are required to transmit the same amount of data. However, if you are sending data over slower link speeds, large MTU values could cause delay for latency-sensitive traffic. + + +Note Latency is the time required for a packet to travel from its source to destination. Some applications, such as Voice over IP (VoIP), are latency sensitive, meaning that they do not perform satisfactorily if the latency of their packets is too high. For example, the G.114 recommendation states that the one-way latency for VoIP traffic should not exceed 150 ms.Latency is a factor in the calculation of the bandwidth-delay product. Specifically, the bandwidth-delay product is a measurement of the maximum number of bits that can be on a network segment at any one time, and it is calculated by multiplying the segment’s band-width (in bits/sec) by the latency packets experience as they cross the segment (in sec). +For example, a network segment with a bandwidth of 768 kbps and an end-to-end latency of 100 ms would have a bandwidth-delay product of 76,800 bits (that is 768,000 * 0.1 = 76,800). + + + +ICMP Messages + +Another protocol residing alongside IP at Layer 3 of the OSI model is Internet Control Message Protocol (ICMP). ICMP is most often associated with the Ping utility, used to check connectivity with a remote network address (using ICMP Echo Request and ICMP Echo Reply messages). + + +Note There is some debate in the industry about where ICMP fits into the OSI model. Although it is generally considered to be a Layer 3 protocol, be aware that ICMP is encap-sulated inside of an IP packet, and some of its messages are based on Layer 4 events. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 31 + +ICMP does have other roles beyond Ping. By using a variety of message types, ICMP can be used by network devices (for example, routers) to provide information to one another. Figure 1-24 shows the structure of an ICMP packet header. + + +Type Code Checksum + + +Rest of Header + + +Figure 1-24 ICMP Packet Header Format + +The purposes of the fields found in an ICMP packet header are as follows: + +■ Type: The 1-byte Type field contains a number indicating the specific type of ICMP message. Here are a few examples: A Type 0 is an Echo Reply message, a Type 3 is a Destination Unreachable message, a Type 5 is a Redirect message, and a Type 8 is an ICMP Echo Request message. + +■ Code: The 1-byte Code field further defines the ICMP type. For example, there are 16 codes for Destination Unreachable ICMP messages. Here are a couple of exam-ples: A code of 0 means that the destination network is unreachable, while a code of 1 means that the destination host is unreachable. + +■ Checksum: The 2-byte Checksum field performs error checking. + +■ Rest of Header: The 4-byte Rest of Header field is 4 bytes in length, and its con-tents are dependent on the specific ICMP type. + +While ICMP has multiple messages types and codes, for purposes of the ROUTE exam, you should primarily be familiar with the two following ICMP message types: + + +■ Key +Topic + +■ + +Destination Unreachable: If a packet enters a router destined for an address that the router does not know how to reach, the router can let the sender know by sending a Destination Unreachable ICMP message back to the sender. + +Redirect: A host might have routing information indicating that to reach a particu-lar destination network, packets should be sent to a certain next-hop IP address. However, if network conditions change and a different next-hop IP address should be used, the original next-hop router can let the host know to use a different path by +sending the host a Redirect ICMP message. + + + +TCP Characteristics + +TCP is commonly touted as being a reliable transport mechanism, as compared to its unreliable counterpart, UDP. Examination of the TCP segment header format, as shown in Figure 1-25, provides valuable insight into how this reliability happens. + + + + + + +www.allitebooks.com From the Library of Alexey Evseenko +32 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Source Port Destination Port + + +Sequence Number + + +Acknowledgment Number + + +Offset Reserved TCP Flags Window + + +Checksum Urgent Pointer + + +TCP Options (Optional) + + +Figure 1-25 TCP Segment Header Format + +The purposes of the fields found in a TCP segment header are as follows: + +■ Source Port field: The Source Port field is a 16-bit field indicating the sending port number. + +■ Destination Port field: The Destination Port field is a 16-bit field indicating the receiving port number. + +■ Sequence Number field: The Sequence Number field is a 32-bit field indicting the amount of data sent during a TCP session. The sending party can be assured that the receiving party really received the data, because the receiving party uses the sequence number as the basis for the acknowledgment number in the next seg-ment it sends back to the sender. Specifically, the acknowledgment number in that segment equals the received sequence number plus 1. Interestingly, at the begin-ning of a TCP session, the initial sequence number can be any number in the range 0–4,294,967,295 (that is, the range of numbers that can be represented by 32 bits). However, when you are doing troubleshooting and performing a packet capture of a TCP session, the initial sequence number might appear to be a relative sequence number of 0. The use of a relative sequence number can often make data easier to interpret while troubleshooting. + +■ Acknowledgment Number field: The 32-bit Acknowledgment Number field is used by the recipient of a segment to request the next segment in the TCP session. The value of this field is calculated by adding 1 to the previously received sequence number. + +■ Offset field: The Offset field is a 4-bit field that specifies the offset between the data in a TCP segment and the start of the segment, in units of 4-byte words. + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 33 + +■ Reserved field: The 3-bit Reserved field is not used, and each of the 3 bits are set to a value of 0. + +■ TCP Flags field: The TCP Flags field is comprised of 9 flag bits (also known as con-trol bits), which indicate a variety of segment parameters. + +■ Window field: The 16-bit Window field specifies the number of bytes a sender is willing to transmit before receiving an acknowledgment from the receiver. + +■ Checksum field: The Checksum field is a 16-bit field that performs error checking for a segment. + +■ Urgent Pointer field: The 16-bit Urgent Pointer field indicates that last byte of a segment’s data that was considered urgent. The field specifies the number of bytes between the current sequence number and that urgent data byte. + +■ TCP Options field: The optional TCP Options field can range in size from 0 to 320 bits (as long as the number of bits is evenly divisible by 32), and the field can contain a variety of TCP segment parameters. + + +Three-Way Handshake + +The process of setting up a TCP session involves a three-way handshake, as listed in the following steps and as illustrated in Figure 1-26. + +Step 1. Key +Topic +Step 2. + + +Step 3. + + +The session initiator sends a Synchronization (SYN) message to the target host. + +The target host acknowledges receipt of the SYN message with an Acknowledgment (ACK) message and also sends a SYN message of its own. + +The session initiator receives the SYN messages from the target host and +acknowledges receipt by sending an ACK message. + + + +1 SYN + +SYN + ACK 2 + +3 ACK + + + +Session Initiator Session Target + +Figure 1-26 TCP Three-Way Handshake + + +TCP Sliding Window + +TCP communication uses windowing, meaning that one or more segments are sent at one time, and a receiver can acknowledge the receipt of all the segments in a window + + + + +From the Library of Alexey Evseenko +34 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +with a single acknowledgment. In some cases, as illustrated in Figure 1-27, TCP uses a sliding window, where the window size begins with one segment. If there is a successful acknowledgment of that one segment (that is, the receiver sends an ACK asking for the next segment), the window size doubles to two segments. Upon successful receipt of those two segments, the next window contains four segments. This exponential increase in window size continues until the receiver does not acknowledge successful receipt of all segments within a certain time period (known as the round-trip time [RTT], which +is sometimes called real transfer time), or until a configured maximum window size is reached. + + +Key Window Size 1 Topic + + +Segment 1 +ACK 2 + + + +Window Size 2 +Sender + + +Segment 2 Receiver Segment 3 +ACK 4 + + + +Window Size 4 +Segment 4 Segment 5 Segment 6 Segment 7 ACK 8 + +Figure 1-27 TCP Sliding Window + +The TCP Maximum Segment Size (MSS) is the amount of data that can be contained in a single TCP segment. The value is dependent on the current TCP window size. + + +Note The term Maximum Segment Size (MSS) seems to imply the size of the entire Layer 4 segment (that is, including Layer 2, Layer 3, and Layer 4 headers). However, MSS only refers to the amount of data in a segment. + + +If a single TCP flow drops a packet, that flow might experience TCP slow start, mean-ing that the window size is reduced to one segment. The window size then grows expo-nentially until it reaches one-half of its congestion window size (that is, the window size when congestion was previously experienced). At that point, the window size begins to grow linearly instead of exponentially. + +If a router interface’s output queue fills to capacity, all TCP flows can simultaneously start to drop packets, causing all TCP flows to experience slow start. This condition, called global synchronization or TCP synchronization, results in a very inefficient + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 35 + +use of bandwidth, because of all TCP flows having reduced window sizes and therefore spending more time waiting for acknowledgments. + + +Note To prevent global synchronization, Cisco IOS supports a feature called Weighted Random Early Detection (WRED), which can pseudo-randomly drop packets from flows based on the number of packets currently in a queue and the quality of service (QoS) markings on the packets. By dropping packets before the queue fills to capacity, the global synchronization issue is avoided. + + + +Out-of-Order Delivery + +In many routed environments, a router has more than one egress interface that can reach a destination IP address. If load balancing is enabled in such a scenario, some packets +in a traffic flow might go out one interface, while other packets go out of another inter-face. With traffic flowing out of multiple interfaces, there is a chance that the packets will arrive out of order. Fortunately, TCP can help prevent out-of-order packets by either sequencing them in the correct order or by requesting the retransmission of out-of-order packets. + +UDP Characteristics + +Figure 1-28 presents the structure of a UDP segment header. Because UDP is considered to be a connectionless, unreliable protocol, it lacks the sequence numbering, window size, and acknowledgment numbering present in the header of a TCP segment. Rather the UDP segment’s header contains only source and destination port numbers, a UDP +checksum (which is an optional field used to detect transmission errors), and the segment length (measured in bytes). + + +Source Port + +UDP Length + +Destination Port + +UDP Checksum + + +Figure 1-28 UDP Segment Header Format + +Because a UDP segment header is so much smaller than a TCP segment header, UDP becomes a good candidate for the transport layer protocol serving applications that need to maximize bandwidth and do not require acknowledgments (for example, audio or video streams). In fact, the primary protocol used to carry voice and video traffic, Real-time Transport Protocol (RTP), is a Layer 4 protocol that is encapsulated inside of UDP. + +If RTP is carrying interactive voice or video streams, the latency between the participants in a voice and/or video call should ideally be no greater than 150 ms. To help ensure that RTP experiences minimal latency, even during times of congestion, Cisco recommends a queuing technology called Low Latency Queuing (LLQ). LLQ allows one or more traffic + + + + + +From the Library of Alexey Evseenko +36 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +types to be buffered in a priority queue, which is serviced first (up to a maximum band-width limit) during times of congestion. Metaphorically, LLQ works much like a carpool lane found in highway systems in larger cities. With a carpool lane, if you are a special type of traffic (for example, a vehicle with two or more passengers), you get to drive in a separate lane with less congestion. However, the carpool lane is not the autobahn (a +German highway without a speed limit). You are still restricted as to how fast you can go. + +With LLQ, you can treat special traffic types (for example, voice and video using RTP) in a special way, by placing them in a priority queue. Traffic in the priority queue (much like a carpool lane) gets to go ahead of nonpriority traffic; however, there is a bandwidth limit (much like a speed limit) that traffic in the priority queue cannot exceed. Therefore, priority traffic does not starve out nonpriority traffic. + +Network Migration Strategies + +As networks undergo expansion or as new technologies are introduced, network engi-neers need to understand the implications of the changes being made. This section iden-tifies a few key areas where change is likely to occur (if it has not already occurred) in enterprise networks. + +Routing Protocol Changes + +The primary focus of this book is on routing protocols. As you read through the subse-quent chapters covering protocols such as RIPng, OSPF, EIGRP, and BGP, be on the look-out for protocol-specific parameters that need to match between neighboring devices. + +As one example, in Chapter 4, “Fundamental EIGRP Concepts,” you will read about EIGRP K-values and how they must match between EIGRP neighbors. Therefore, if you make a K-value change on one router, that change needs to be reflected on neighboring routers. + +In addition to making adjustments to existing routing protocols, network engineers some-times need to migrate to an entirely new routing protocol. For example, a network that was running RIP might migrate to OSPF. Two common approaches to routing protocol migration are as follows: + + +■ Key +Topic + + + + + + + +■ + +Using Administrative Distance (AD): When migrating from one routing protocol to another, one approach is to configure both routing protocols on all your routers, allowing them to run concurrently. However, when you do your configuration of the +new routing protocol, you should make sure that it has a higher AD than the existing routing protocol. This approach allows you to make sure that the new routing proto-col has successfully learned all the routes it needs to learn and has appropriate next hops for its route entries. After you are convinced that the new routing protocol is configured appropriately, you can adjust the AD on either the old or the new routing protocol such that the new routing protocol is preferred. + +Using route redistribution: Another approach to migrating between routing proto- +cols is to use redistribution, such that you cut over one section of your network at + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 37 + +a time, and mutually redistribute routes between portions of your network using the old routing protocol and portions using the new routing protocol. This approach allows you to, at your own pace, roll out and test the new routing protocol in your network locations. + + +IPv6 Migration + +You could argue that there are two kinds of IP networks: those that have already migrat-ed to IPv6 and those that will migrate to IPv6. With the depletion of the IPv4 address space, the adoption of IPv6 for most every IP-based network is an eventuality. Following are a few strategies to consider when migrating your network, or your customers’ net-works, from IPv4 to IPv6: + + +■ Key +Topic + + +■ + + + + + +■ + + + + +■ + +Check equipment for IPv6 compatibility: Before rolling out IPv6, you should check your existing network devices (for example, switches, routers, and firewalls) for IPv6 compatibility. In some cases, you might be able to upgrade the Cisco IOS on your existing gear to add IPv6 support for those devices. + +Run IPv4 and IPv6 concurrently: Most network devices (including end-user com-puters) that support IPv6 also support IPv4 and can run both at the same time. This type of configuration is called a dual-stack configuration. A dual-stack approach allows you to gradually add IPv6 support to your devices and then cut over to just IPv6 after all devices have their IPv6 configuration in place. + +Check the ISP’s IPv6 support: Many Internet Service Providers (ISP) allow you to connect with them using IPv6. The connection could be a default static route, or you might be running Multiprotocol BGP (MP-BGP) to peer with multiple ISPs. These options are discussed in Chapter 15, “IPv6 Internet Connectivity.” + +Configure NAT64: During the transition from a network running IPv4 to a network running IPv6, you might have an IPv6 host that needs to communicate with an IPv4 host. One approach to allow this is to use NAT64. You probably recall from your CCNA studies that Network Address Translation (NAT) in IPv4 networks is often used to translate private IP addresses used inside of a network (referred to as inside local addresses) into publicly routable IP addresses for use on the Internet (referred to as inside global addresses). However, NAT64 allows IPv6 addresses to be trans-lated into corresponding IPv4 addresses, thus permitting communication between an IPv4 host and an IPv6 host. + +A router configured for NAT64 maintains a mapping table that specifies which IPv4 address corresponds to an IPv6 address. This mapping table can be manually +configured, which is called stateless translation. Unfortunately, such a manual con-figuration is not very scalable. However, a stateless translation can be useful when you have a relatively small number of IPv4 hosts (for example, servers) that need to be reached by IPv6 clients. For more scalability, stateful translation can be used. +A router configured for stateful translation allows a dynamic IPv6-to-IPv4 address +binding to be created. + + + + + + +From the Library of Alexey Evseenko +38 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ Use NPTv6: Another type of translation that can benefit IPv6 networks is Network Prefix Translation version 6 (NPTv6). NPTv6 is sometimes referred to as IPv6-to-IPv6 Network Prefix Translation. Unlike NAT, NPTv6 cannot do any sort of NAT address overloading. Instead it simply translates one IPv6 prefix to another. For example, a router configured for NPTv6 might translate a prefix from 2001:1::/64 to 2001:2::/64. + +Many IPv6 networks will have no need for NPTv6. However, as an example of where it can be particularly beneficial, consider a situation where an IPv6 host has more than one global unicast address assigned to a network interface card. Perhaps one +of the global unicast addresses has permission (based on network filters in place) to reach a specific destination, while the other global unicast address would be dropped if it attempted to reach that destination. Because the host might not know from which of these IPv6 addresses to source a packet, it might use a source address that gets dropped by the network filter. However, a router configured for NPTv6 can translate the host’s unpermitted global unicast IPv6 address into a global unicast IPv6 address that is permitted. + +■ Send IPv6 traffic over an IPv6-over-IPv4 tunnel: Yet another approach to having IPv6 addressing and IPv4 addressing peacefully coexist on the same network is to have an IPv4 tunnel that spans an IPv4-only portion of the network. Routers at each end of this tunnel can run both IPv4 and IPv6 and can encapsulate IPv6 traffic inside of the IPv4 tunnel packets, thus allowing IPv6 traffic to traverse an IPv4-only por-tion of the network. This type of tunnel is called an IPv6-over-IPv4 tunnel. + + +Spanning Tree Protocol Migration + +Spanning Tree Protocol (STP), to which you were introduced in your CCNA studies, supports redundancy in a Layer 2 network, while preserving a loop-free topology. Several variants of STP have been developed since Radia Perlman’s first iteration of STP in the mid 1980s. + +Typically, the optimal type of STP to run on today’s Cisco Catalyst switches is Rapid Per-VLAN Spanning Tree Protocol Plus (Rapid-PVST+). Rapid-PVST+ allows for much faster convergence (commonly, less than one second) as compared to the relatively slow convergence (up to 50 seconds) of IEEE 802.1D (the first industry-standard version of STP). Another benefit of running Rapid-PVST+ is that it allows each VLAN to run its own instance of STP, as opposed to all VLANs using the same spanning-tree topology (which could lead to suboptimal paths for some VLANs). + +Fortunately, Rapid-PVST+ is backward compatible with IEEE 802.1D. This backward compatibility allows network engineers to take a phased approach in their migration to Rapid-PVST+. + +When converting a Cisco Catalyst switch to Rapid-PVST+, you can remove the following features, because similar features are built into Rapid-PVST+: + +■ UplinkFast + +■ BackboneFast + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 39 + +However, the following features still function with Rapid-PVST+ and do not need to be removed from a Cisco Catalyst switch being migrated to Rapid-PVST+: + +■ PortFast + +■ BPDU Guard + +■ BPDU Filter + +■ Root Guard + +■ Loop Guard + + +Migration to Easy Virtual Networking + +In recent years, virtualization has become a hot topic in the IT industry. Today’s data centers commonly use virtualization technologies (for example, VMware and Hyper-V) to allow multiple server instances (possibly running different operating systems) to run on a single physical server. This can make for a much more efficient use of hardware resources. + +Interestingly, in addition to virtualizing server instances, you can virtualize networks. Cisco supports a technology called Virtual Routing and Forwarding (VRF), which allows a single router to run multiple virtual router instances. Each virtual router instance can have its own configuration and its own IP routing process. + +VRF is therefore able to segment networks and isolate paths as needed. The capability to completely isolate one network from another (even though the networks use the same infrastructure devices) has obvious security benefits. + +Additionally, VRF helps network architects meet various industry regulations. For example, the Sarbanes-Oxley Act and the HIPAA Privacy Rule require privacy for cus-tomer and patient information. Also, the Payment Card Industry regulations require path segmentation for credit card transactions. Other scenarios for multitenant networks (for example, universities and airports) also have frequent network segmentation and path iso-lation design requirements. + +A traditional way to configure VRF on Cisco routers was to use an approach called VRF-Lite. A newer approach to virtualized network configuration, called Cisco Easy Virtual Network (EVN), dramatically simplifies the relatively complex configuration required by VRF-Lite. + +An EVN uses a Virtual Network Trunk (VNET Trunk) to carry traffic for each virtual network, and eliminates the need to manually configure a subinterface for each virtual network on all routers (which was a requirement with VRF-Lite). Traffic flowing over a VNET Trunk is tagged with a VNET tag, identifying the virtual network to which the traffic belongs. An EVN router connects to a Cisco Catalyst switch through an 802.1Q trunk, with the different VLANs on the 802.1Q trunk carrying traffic for the different virtual networks. + + + + + + + +From the Library of Alexey Evseenko +40 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note Even though VRF is the underlying technology being used, a common practice is to refer to a virtual network as a VRF. For example, an EVN might have three separate vir-tual networks that you might call VRF A, VRF B, and VRF C. + + +Figure 1-29 provides a sample EVN topology. + + + +Key Topic + +VRFs +Traffic for VRF A (172.16.0.0/16) Traffic for VRF B (172.17.0.0/16) Traffic for VRF C (172.18.0.0/16) + + +172.16.0.100/24 172.16.1.100/24 VNET Trunk + + + +172.17.0.100/24 +A B C +172.18.0.100/24 +R1 + +172.17.1.100/24 +A B C +172.18.1.100/24 R2 + + + + +802.1Q Trunk + +Figure 1-29 Sample EVN Topology + +Even though an EVN allows a network architect to isolate one virtual network from another (as if they were physically separate networks), there is an occasional need for one of the virtual networks to be accessible by other virtual networks. For example, one virtual network might contain corporate DNS, DHCP, and email servers, which need to be accessed by all the other virtual networks. Cisco EVN makes this possible through +a service called route replication. The route replication service allows IP routes known to one virtual network to be known to other virtual networks. As an example, consider Figure 1-30. + +In Figure 1-30, the 172.16.0.0 /16 virtual network (VRF A) and the 172.17.0.0 /16 virtual network (VRF B) are isolated from one another. However, the 192.168.0.0 /24 network (VRF C) contains servers (for example, DHCP, DNS, and email servers) that need to be accessed by both VRF A and VRF B. Route replication allows networks in VRF C to be added to the routing tables of VRF A and VRF B, while still keeping VRF A and VRF B separate from one another. Also, notice that the routing table for VRF C knows about routes in the other two VRFs. + + +Note Even though different IP address spaces were used in this example for VRF A and VRF B, in the real world, you could have overlapping address spaces in different VRFs. + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 41 + +VRFs + +Traffic for VRF A (172.16.0.0/16) Traffic for VRF B (172.17.0.0/16) +172.16.0.100/24 Traffic for VRF C (192.168.0.0/24) + + +802.1Q Trunk + +172.17.0.100/24 + + +DHCP Server 192.168.0.1/28 + + + + + +Gig 0/0/1 + +Routing Table for VRF A +172.16.0.0/16 => Gig 0/0/1.A 192.168.0.0/24 =>Gig 0/0/2.C + +Routing Table for VRF B + +172.17.0.0/16 => Gig 0/0/1.B 192.168.0.0/24 =>Gig 0/0/2.C + +Routing Table for VRF C + +172.16.0.0/16 => Gig 0/0/1.A 172.17.0.0/16 => Gig 0/0/1.B 192.168.0.0/24 =>Gig 0/0/2.C + +A B +C Gig 0/0/2 R1 + + +DNS Server 192.168.0.2/28 + + +Email Server 192.168.0.3/28 + + +Figure 1-30 Route Replication + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +42 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 1-3 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? You should write a general descrip-tion; specific configuration commands are not required. + +Table 1-3 Design Review + + +Design Goal + +The design requires the number of entries in a router’s routing table to be reduced. +The design calls for the use of a distance-vector routing protocol. Identify the two approaches that a distance-vector routing protocol can use to prevent loops. (2) +The design calls for the use of a link-state routing protocol. (2) +The design calls for IPv6 traffic to travel from a source IPv6 address to the nearest device of multiple devices assigned the same destination IPv6 address. +The design calls for the use of an NBMA network. Identify design issues that might be encountered when using EIGRP or OSPF. (2) +The design calls for the use of Hot Standby Router Protocol (HSRP). Identify the condition that can be created when return traffic flows through a standby HSRP router. + +Possible Implementation Choices Covered in This Chapter + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 43 + + + +Design Goal + +The design needs to mitigate a global synchronization condition (where all TCP flows simultaneously enter TCP slow start). +The design requires a network to be migrated to a different routing protocol. (2) +The design requires that you virtualize multiple routers inside of physical routers and carry traffic for the virtual networks between those physical routers. + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 1-4 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 1-4 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answers +The plan requires that Split Horizon be disabled for the hub router in a hub-and-spoke topology. Describe the purpose of Split Horizon. +The plan requires the use of EIGRP as the routing protocol. Provide a brief description of EIGRP. +The plan calls for the use of both IPv4 and IPv6. What network traffic types do IPv4 and IPv6 have in common, and what traffic types are different? +The plan calls for the use of Hot Standby Router Protocol (HSRP). What can you do to prevent an asymmetric routing issue, where traffic is forwarded from a subnet using the active HSRP router, and some of the return traffic returns using the standby HSRP router (because of load balancing)? + + + + + + + +From the Library of Alexey Evseenko +44 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Question Answers +The design calls for the transmission of interactive voice and video over a network. What Layer 4 protocols are typically used to transmit voice and data media? (2) +The plan requires that a network migrate from IPv4 to IPv6. Identify three strategies of a successful IPv6 migration. (3) +The plan calls for the use of Virtual Routing and Forwarding (VRF). Identify two approaches to configuring VRF. (2) + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 1-5 lists a reference of these key topics and the +page numbers on which each is found. + + +Table 1-5 Key Topics for Chapter 1 +Key +Topic Key Topic Element Description Page Number + + +Figure 1-3 + +List + +Network Summarization 10 + +IGP and EGP definitions 11 + + +List Distance-vector routing protocol approaches to avoid 13 routing loops + +Table 1-2 + +List + +Figure 1-23 + +List + +List + +Figure 1-27 + +List + +List + +Figure 1-29 + +Routing Protocol Characteristics 15 + +NBMA design considerations 21 + +Unidirectional Flooding of Inbound Traffic 29 + +Two ICMP message types 31 + +TCP three-way handshake 33 + +TCP Sliding Window 34 + +Approaches to routing protocol migration 36 + +Strategies for IPv6 migration 37 + +Sample EVN Topology 40 + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 1: Characteristics of Routing Protocols 45 + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Definitions of Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +convergence, route summarization, interior gateway protocol (IGP), exterior gateway protocol (EGP), distance-vector, link-state, path-vector, anycast, nonbroadcast multi-access (NBMA), Split Horizon, Poison Reverse, asymmetric routing, Administrative Distance, Easy Virtual Networking (EVN) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Remote Connectivity Overview: This section explains why VPNs are often a preferred method of remotely connecting to sites and identifies a collec-tion of available VPN technologies. +■ MPLS VPN: This section contrasts Layer 2 MPLS VPNs and Layer 3 MPLS VPNs. + +■ GRE: This section describes a GRE tunnel and dem-onstrates GRE tunnel configuration and verification. + +■ DMVPN: This section discusses how DMVPNs can dynamically bring up connections between specific spokes in a hub-and-spoke VPN topology. +■ Multipoint GRE: This section explains how a single GRE interface can have connections to multiple GRE peers. +■ NHRP: This section explains how NHRP can dis-cover next-hop IP addresses in networks using IP tunneling. +■ IPsec: This section explores how IPsec can be used to secure a VPN connection. + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 2 + + + + + + +Remote Site Connectivity + + +Traditional wide-area network (WAN) connections used technologies such as dedicated leased lines and permanent virtual circuits (PVC) defined in frame switching (for example, Frame Relay) and cell switching (for example, ATM) networks. As an example, if a com-pany opened a remote sales office, it might have purchased a Frame Relay connection for that remote office and used a PVC that interconnected that remote office with the corpo-rate headquarters. + +However, with the current state of the Internet, high-speed connections are widely acces-sible. For example, a remote sales office might purchase a DSL or cable modem con-nection to the Internet, at a relatively low cost as compared to traditional leased lines +or frame/cell switching technologies. Over that Internet connection, a virtual private network (VPN) could create a logical path between the sales office and the headquarters location. + +The theory and configuration of VPNs goes well beyond what is covered in this chapter; however, the ROUTE exam blueprint only requires configuration knowledge for Generic Routing Encapsulation (GRE) tunnels. Therefore, this chapter will help you understand the theory of multiple VPN technologies, while showing the configuration and verifica-tion of GRE. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these seven self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 2-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions covering the material in those headings so that you can assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + + + + + + + + + + + + + +From the Library of Alexey Evseenko +48 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 2-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Remote Connectivity Overview + +MPLS VPN + +GRE + +DMVPN + +Multipoint GRE + +NHRP + +IPsec + +Questions +1 + +2 + +3 + +4 + +5 + +6 + +7 + + + +1. Which of the following is a valid design consideration for a hybrid VPN? + +a. You cannot encapsulate an encrypted packet. + +b. You cannot encrypt an encapsulated packet. + +c. You might need to decrease the MTU size for frames on an interface. + +d. You might need to increase the MTU size for frames on an interface. + +2. In a Layer 3 MPLS VPN, with what does a CE router form a neighborship? + +a. A PE in the MPLS network. + +b. A CE at a remote location. + +c. No neighborship is formed, because the MPLS network acts as a logical switch. + +d. No neighborship is formed, because IP multicast traffic cannot be sent across an MPLS network. + +3. You want to interconnect two remote sites with a VPN tunnel. The tunnel needs to support IP unicast, multicast, and broadcast traffic. Additionally, you need to encrypt traffic being sent over the tunnel. Which of the following VPN solutions meets the design requirements? +a. Use a GRE tunnel. + +b. Use an IPsec tunnel. + +c. Use a GRE tunnel inside of an IPsec tunnel. + +d. Use an IPsec tunnel inside of a GRE tunnel. + +4. Identify technologies required for a DMVPN network. (Choose three.) + +a. NHRP + +b. IPsec + +c. MPLS + +d. mGRE + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 49 + +5. Which of the following are characteristics of multipoint GRE? (Choose two.) + +a. mGRE supports a wide variety of protocols. + +b. A single mGRE interface can service multiple tunnels. + +c. An mGRE interface is created for each tunnel. + +d. mGRE only transports unicast IP packets. + +6. Which of the following are true for NHRP? (Choose two.) + +a. The hub router is configured with the IP addresses of the spoke routers. + +b. The spoke routers are configured with the IP address of the hub router. + +c. Spoke routers query the hub router asking what tunnel interface IP address cor-responds to a known physical interface IP address. + +d. Spoke routers query the hub router asking what physical interface IP address corresponds to a known tunnel interface IP address. + +7. Which IPsec feature primarily performs encryption? + +a. Integrity + +b. Confidentiality + +c. Antireplay + +d. Authentication + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +50 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +Remote Connectivity Overview + +The voice, video, and data commonly sent between remote offices and central sites often demand low latency and easy provisioning, all while maintaining a low cost. Traditional WAN solutions (for example, leased lines, Frame Relay, and ATM) typically fail to simul-taneously meet all these requirements. Fortunately, a variety of VPN technologies fit nicely into such a design. + +This section categorizes various VPN technologies. Then, the remainder of this chapter examines these technologies in a bit more detail. + +MPLS-Based Virtual Private Networks + +Multiprotocol Label Switching (MPLS) is a technology commonly used by service providers, although many large enterprises also use MPLS for their backbone network. MPLS makes forwarding decisions based on labels rather than IP addresses. Specifically, a 32-bit label is inserted between a frame’s Layer 2 and Layer 3 headers. As a result, an MPLS header is often called a shim header, because it is stuck in between two existing headers. + +MPLS-based VPNs can be grouped into one of two primary categories: + +■ Layer 2 MPLS VPNs + +■ Layer 3 MPLS VPNs + +These two approaches are discussed further in the section “MPLS VPN,” later in this chapter. + +Tunnel-Based Virtual Private Networks + +A tunnel is a virtual connection that can physically span multiple router hops. However, from the perspective of the traffic flowing through the tunnel, the transit from one end of a tunnel to the other appears to be a single router hop. + +Multiple VPN technologies make use of virtual tunnels. A few examples discussed in this chapter include + +■ Generic Routing Encapsulation (GRE) + +■ Dynamic Multipoint VPN (DMVPN) + + + + + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 51 + +■ Multipoint GRE + +■ IPsec + + +Hybrid Virtual Private Networks + +Rather than just using a single MPLS-based VPN technology or a single tunnel-based VPN technology, you can use select VPN technologies in tandem. For example, you might want to extend an MPLS network at one corporate location to MPLS networks at remote corporate locations, while having a requirement that traffic traveling through a service provider’s cloud be encrypted. + +You could meet the requirements of such a design by having a Layer 3 MPLS VPN set up over a DMVPN. The DMVPN technology carrying the Layer 3 MPLS VPN traffic allows you to efficiently set up direct links between corporate locations, and it also allows you to use IPsec, which can encrypt the traffic flowing through the service provider’s cloud. + +When it comes to hybrid VPNs, a significant design consideration is overhead. Every time you add an encapsulation, you are adding to the total header size of the packet. With more headers, the amount of data you can carry inside a single packet is decreased. As a result, you might have to configure a lower maximum transmission unit (MTU) size for frames on an interface. + +MPLS VPN + +MPLS VPNs extend the capabilities of MPLS, supporting VPNs created across an MPLS network. These VPNs, most commonly found in service provider or large enterprise net-works, can be categorized as either Layer 2 MPLS VPNs or Layer 3 MPLS VPNs. + +Layer 2 MPLS VPN + +With a Layer 2 MPLS VPN, the MPLS network allows customer edge (CE) routers at dif-ferent sites to form routing protocol neighborships with one another as if they were Layer 2 adjacent. Therefore, you can think of a Layer 2 MPLS VPN as a logical Layer 2 switch, as depicted in Figure 2-1. + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +52 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Key Topic +CE +Neighborship CE + + +Location A LSR + +LSR LSR + + +Location B PE +(ELSR) + + + +PE (ELSR) + +LSR + + + + +CE +Location C + +Service Provider’s MPLS Cloud + + +CE + +Location D + + +Figure 2-1 Logical View of a Layer 2 MPLS VPN + + +Layer 3 MPLS VPN + +With a Layer 3 MPLS VPN, a service provider’s provider edge (PE) router (also known as an Edge Label Switch Router [ELSR]) establishes a peering relationship with a CE router, as seen in Figure 2-2. Routes learned from the CE router are then sent to the remote PE router in the MPLS cloud (typically using multiprotocol BGP [MP-BGP]), where they are sent out to the remote CE router. + + +Key Topic +CE CE + +LSR +Neighborship + +Location A + +PE (ELSR) +Neighborship + + +Location B + +LSR LSR +PE (ELSR) + + + + +LSR +Neighborship +Neighborship + + + + +CE +Location C + +Service Provider’s MPLS Cloud + + +CE + +Location D + + +Figure 2-2 Layer 3 MPLS VPN + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 53 + +GRE + +As its name suggests, a Generic Routing Encapsulation (GRE) tunnel can encapsulate nearly every type of data that you could send out of a physical router interface. In fact, GRE can encapsulate any Layer 3 protocol, which makes it very flexible. + +GRE by itself does not provide any security for the data it transmits; however, a GRE packet can be sent over an IPsec VPN, causing the GRE packet (and therefore its con-tents) to be protected. Such a configuration is commonly used, because IPsec can only protect unicast IP packets. This limitation causes issues for routing protocols that use IP multicasts. Fortunately, a GRE tunnel can encapsulate IP multicast packets. The resulting GRE packet is an IP unicast packet, which can then be protected by an IPsec tunnel. + +As an example, consider Figure 2-3. Routers R1 and R2 need to form an Open Shortest Path First (OSPF) neighborship across the service provider’s cloud. Additionally, traffic between these two routers needs to be protected. While IPsec can protect unicast IP traf-fic, OSPF communicates through IP multicasts. Therefore, all traffic between Routers R1 and R2 (including the OSPF multicasts) is encapsulated inside of a GRE tunnel. Those GRE packets, which are unicast IP packets, are then sent across, and protected by, an IPsec tunnel. + +GRE Tunnel IPsec Tunnel + + + + + +R1 R2 + +Service Provider’s Cloud + + +Figure 2-3 GRE over IPsec Tunnel + + +Note For exam purposes, the only type of tunnel you need to know how to configure, based on the objectives listed in the ROUTE exam blueprint, is a GRE tunnel. Therefore, this chapter only provides a configuration example for a GRE tunnel. + + +The steps to configure a GRE tunnel are as follows: + + +Step 1. +Key Topic +Step 2. + + +Step 3. + + +Create a virtual tunnel interface in global configuration mode with the inter-face tunnel id command. + +In interface configuration mode for the tunnel interface, add an IP address with the ip address ip_address subnet_mask command. + +Specify the source of the tunnel with the tunnel source {interface_id | ip_ +address} command. + + + + + +From the Library of Alexey Evseenko +54 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 4. Specify the destination of the tunnel with the tunnel destination ip_address command. + +Step 5. Repeat the previous steps on the router at the far side of the tunnel. + +To illustrate this configuration procedure, consider Example 2-1 and the topology shown in Figure 2-4. + + +Tunnel 1 192.168.0.1/30 + +Lo0 1.1.1.1/32 + +Tunnel 1 192.168.0.2/30 +GRE Tunnel Lo0 4.4.4.4/32 + + +R1 S1/0.1 S1/0.2 R2 S1/1.1 S1/0.2 R3 S1/1.1 S1/0.2 R4 + +Fa0/0 10.1.1.1/24 + + +192.0.2.0/30 203.0.113.0/30 Lo0 2.2.2.2/32 + + +198.51.100.0/30 Lo0 +3.3.3.3/32 + + +Fa0/0 10.2.2.1/24 + + + + + +Figure 2-4 GRE Sample Topology + +Example 2-1 GRE Sample Configuration +Key +Topic !ROUTER R1 +interface Tunnel1 +ip address 192.168.0.1 255.255.255.252 +tunnel source Loopback0 +tunnel destination 4.4.4.4 + +!ROUTER R4 +interface Tunnel1 +ip address 192.168.0.2 255.255.255.252 +tunnel source Loopback0 +tunnel destination 1.1.1.1 + +In Example 2-1, a virtual tunnel interface is created on Router R1 with the interface Tunnel 1 command. An IP address is then assigned with the ip address 192.168.0.1 255.255.255.252 command. Next, the tunnel source Loopback0 command is used to specify Router R1’s Lo 0 interface (and therefore its IP address of 1.1.1.1) as one end of the GRE tunnel. The tunnel destination 4.4.4.4 command is then used to specify the Lo 0 interface on Router R4 as the other end of the tunnel. A mirrored configuration of the tunnel interface is then entered on Router R4. + +Example 2-2 shows verification of the GRE tunnel. In the output of the show interfaces tunnel 1 command, notice that the interface is up at Layer 1 and Layer 2. Also, note that the encapsulation type is TUNNEL. Also, the output of the traceroute 192.168.0.2 com-mand shows that the IP address of 192.168.0.2 is logically a single hop away from Router R1, even though it is physically three hops away. + + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 55 + +Example 2-2 GRE Tunnel Verification Key +Topic R1# show interfaces tunnel 1 +Tunnel1 is up, line protocol is up +Hardware is Tunnel +Internet address is 192.168.0.1/30 +MTU 17916 bytes, BW 100 Kbit/sec, DLY 50000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation TUNNEL, loopback not set +Keepalive not set +Tunnel source 1.1.1.1 (Loopback0), destination 4.4.4.4 +Tunnel Subblocks: +src-track: +Tunnel1 source tracking subblock associated with Loopback0 +Set of tunnels with source Loopback0, 1 member (includes iterators), on +interface +Tunnel protocol/transport GRE/IP +Key disabled, sequencing disabled +Checksumming of packets disabled +Tunnel TTL 255, Fast tunneling enabled +Tunnel transport MTU 1476 bytes +Tunnel transmit bandwidth 8000 (kbps) +Tunnel receive bandwidth 8000 (kbps) +Last input 00:00:01, output 00:00:01, output hang never +Last clearing of "show interface" counters 00:54:43 +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo +Output queue: 0/0 (size/max) +5 minute input rate 0 bits/sec, 0 packets/sec +5 minute output rate 0 bits/sec, 0 packets/sec +779 packets input, 67357 bytes, 0 no buffer +Received 0 broadcasts (0 IP multicasts) +0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort +787 packets output, 68037 bytes, 0 underruns +0 output errors, 0 collisions, 0 interface resets +0 unknown protocol drops +0 output buffer failures, 0 output buffers swapped out +R1# traceroute 192.168.0.2 +Type escape sequence to abort. +Tracing the route to 192.168.0.2 +VRF info: (vrf in name/id, vrf out name/id) +1 192.168.0.2 108 msec 100 msec 108 msec + + + + + + + + +From the Library of Alexey Evseenko +56 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +DMVPN + +Consider a hub-and-spoke VPN topology in which multiple remote sites have a site-to-site VPN connection to a headquarters location. In such a topology, if one remote +site wanted to communicate securely with another remote site, the traffic would travel between the sites through the headquarters location, rather than directly between the sites. One fix for this suboptimal pathing issue would be to create a full mesh of IPsec site-to-site VPN connections, which would provide a direct IPsec VPN connection between any two remote sites. Such a solution, however, could be complex and expensive to configure and maintain. + +A more economical solution to providing optimal pathing without necessitating a full-mesh topology is the Dynamic Multipoint VPN (DMVPN) feature. DMVPN allows a VPN tunnel to be dynamically created and torn down between two remote sites on an as-needed basis. Consider Figure 2-5, which shows a hub-and-spoke topology, with the headquarters acting as the hub. Branch B and Branch C want to communicate with one another. Therefore, a DMVPN tunnel is created between these two locations. + +Branch A + + + + + + + +Branch B + + + + + + + +Headquarters + + + + +Dynamic Multipoint VPN Tunnel + + + +Branch C + +Figure 2-5 Dynamic Multipoint VPN + + + + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 57 + +From a troubleshooting perspective, a common issue experienced with DMVPN net-works is flapping (that is, the DMVPN tunnel is repeatedly torn down and reestablished). When experiencing such an issue, Cisco recommends that you check the routing protocol neighborship between the routers at each end of the DMVPN. If the neighborship is not always up, the DMVPN might flap. + + +Note Multipoint GRE, Next Hop Resolution Protocol (NHRP), and IPsec are required to support a DMVPN topology. Each of these technologies is discussed in the remainder of this chapter. + + + +Multipoint GRE + +The scalability offered by DMVPN is made possible, in part, by multipoint GRE (mGRE), which allows a router to support multiple GRE tunnels on a single GRE interface. + +Some of mGRE’s characteristics are as follows: + +■ Like traditional GRE, mGRE can transport a wide variety of protocols (for example, IP unicast, multicast, and broadcast). + +■ In a hub-and-spoke topology, a hub router can have a single mGRE interface, and multiple tunnels can use that single interface. + +■ An interface configured for mGRE is able to dynamically form a GRE tunnel by using Next Hop Resolution Protocol (NHRP) to discover the IP address of the device at the far end of the tunnel. + +You can deploy mGRE in a hub-and-spoke topology or a spoke-to-spoke topology. Figure 2-6 illustrates a hub-and-spoke topology, where only the hub router is configured with an mGRE interface. + +Figure 2-7 shows a spoke-to-spoke mGRE topology. With a spoke-to-spoke mGRE topol-ogy, each router has an mGRE interface, which allows the sites in the network to inter-connect using a partial mesh or a full mesh collection of tunnels. + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +58 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Branch A + + + + + +Spoke + +mGRE Interface Branch B + +Spoke + + +Hub + +Headquarters + +Spoke + + + + + +Branch C +Figure 2-6 Hub-and-Spoke mGRE Tunnel Topology + +Branch A + + + + + +mGRE Interface Spoke +mGRE Interface Branch B + +Spoke + + +Hub +mGRE Interface Headquarters +Spoke mGRE Interface + + + + + +Branch C +Figure 2-7 Spoke-to-Spoke mGRE Tunnel Topology + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 59 + +NHRP + +DMVPNs require that routers run Next Hop Resolution Protocol (NHRP), which uses a client-server model. A router designated as a hub router acts as a server. The remaining routers, designated as spokes, act as clients. NHRP spokes are configured with the IP address of the NHRP hub, and when a spoke comes online, it informs the hub of both a physical IP address (assigned to its physical interface) and a logical IP address (assigned to its virtual tunnel interface) that are going to be used for its tunnels. + +As an example, examine Figure 2-8. + +Branch A + +10.0.0.1 at 192.0.2.1 + + + +192.0.2.1 +Headquarters Spoke + + +10.0.0.2 at 203.0.113.1 + +Branch B + + + +Spoke + + +Hub 203.0.113.1 + +10.0.0.3 at 198.51.100.1 + +NHRP Database Spoke + +Tunnel Interface IP 10.0.0.1 +10.0.0.2 +10.0.0.3 + +Physical Interface IP 192.0.2.1 +203.0.113.1 +198.51.100.1 + + +198.51.100.1 + + +Branch C + +Figure 2-8 NHRP Registration Process + +In Figure 2-8, the Headquarters router is acting as the hub, and the Branch A, Branch B, and Branch C routers are acting as spokes. When the spokes come online, they each +advertise the IP address of their physical interface that is going to be used for tunnel for-mation, along with the IP address of the virtual tunnel interface. For example, the Branch A router informs the Headquarters router that the IP address of its virtual tunnel interface is 10.0.0.1, and it is available at a physical interface’s IP address of 192.0.2.1. The Branch B and Branch C routers send similar advertisements to the Headquarters router. As a result, the Headquarters router populates its NHRP database. + + + + + +From the Library of Alexey Evseenko +60 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note The prior description of NHRP used the term physical interface to distinguish a nontunnel interface from a tunnel interface. Realize, however, that an interface being referred to here as a physical interface could actually be a loopback interface. + + +With the hub’s database populated, a spoke can query the hub to find out the IP address of a physical interface that corresponds to a specific tunnel interface’s IP address. As an example, notice in Figure 2-9 how NHRP helps the Branch C router set up a GRE tunnel with the Branch B router. + +NHRP Database Branch A Tunnel Interface Physical Interface +IP IP + +10.0.0.1 10.0.0.2 +10.0.0.3 + +192.0.2.1 203.0.113.1 +198.51.100.1 + + +Headquarters 192.0.2.1 Spoke + +Branch B + + +Spoke (2) 10.0.0.2 is at 203.0.113.1. + +Hub 203.0.113.1 + +(3) Dynamic GRE tunnel formation. +NHRP Query +NHRP Reply + + +(1) What physical interface’s IP address is associated with a tunnel interface’s IP address of 10.0.0.2? + +Spoke + +198.51.100.1 + + + + + +Branch C + +Figure 2-9 NHRP Query Process + +In Figure 2-9, the Branch C router needs to dynamically form a GRE tunnel with the Branch B router. The Branch C router knows that the other end of the tunnel it wants to form has an IP address of 10.0.0.2. However, the Branch C router does not know the IP address of the physical interface on the Branch B router that corresponds to the virtual tunnel’s IP address. The process of discovering the remote physical IP address and the formation of the tunnel is as follows: + +Step 1. +Key Topic + + +The Branch C router sends an NHRP query to the hub router asking what physical interface’s IP address is associated with a tunnel interface’s IP address +of 10.0.0.2. + + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 61 + +Step 2. The hub router (that is, the Headquarters router) checks its NHRP database and responds to the query, telling the Branch C router that the physical inter-face’s IP address corresponding to the tunnel interface IP address of 10.0.0.2 is 203.0.113.1, which is the IP address of the Branch B router. +Step 3. Having dynamically learned the IP address of the physical interface in the Branch B router, the Branch C router sets up a GRE tunnel with the Branch B router. + +While the configuration of NHRP is beyond the scope of the ROUTE curriculum, you should be familiar with the output of the show ip nhrp verification command. Example 2-3 shows sample output from this command. + +Example 2-3 Sample Output from the show ip nhrp Command Key +Topic Router# show ip nhrp +192.168.0.2 255.255.255.255, tunnel 100 created 0:00:44 expire 1:59:15 +Type: dynamic Flags: authoritative +NBMA address: 10.1111.1111.1111.1111.1111.1111.1111.1111.1111.11 +192.168.0.1 255.255.255.255, Tunnel10 created 0:10:04 expire 1:49:56 +Type: static Flags: authoritative +NBMA address: 192.168.1.2 + +The output in Example 2-3 shows the IP addresses (and corresponding subnet masks) in the IP-to-NBMA address cache. Note that the subnet mask for an IP address is always a /32 mask, because the Cisco implementation of NHRP does not support the aggrega-tion of nonbroadcast multiaccess (NBMA) information. The output also shows the tunnel interface name and how long it has been since the tunnel was created. Finally, notice the +authoritative flag. This flag indicates that a next-hop server (or router) provided the NHRP information. + +IPsec +Security in a DMVPN is provided by IPsec. The following four security features are offered by IPsec: + + +■ Key +Topic +■ + + + + +■ + + +■ + +Confidentiality: Data confidentiality is provided by encrypting data. If a third party intercepts the encrypted data, the party would not be able to interpret the data. + +Integrity: Data integrity ensures that data is not modified in transit. For example, routers at each end of a tunnel could calculate a checksum value or a hash value for the data, and if both routers calculate the same value, the data has most likely not been modified in transit. + +Authentication: Data authentication allows parties involved in a conversation to verify that the other party is the party it claims to be. + +Antireplay: IPsec uses antireplay protection to ensure that packets being sent are not duplicate packets. For example, an attacker might capture packets that make up a valid login to a host and attempt to play those packets back, so that he can gain access to the host. However, IPsec uses sequence numbers to determine whether a packet is to +be considered a duplicate packet, and any duplicate packets are not transmitted. + + + + +From the Library of Alexey Evseenko +62 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Of these IPsec services, encryption and authentication are particularly helpful in a DMVPN network. For example, encryption can help protect traffic flowing between sites (either over the Internet or through a service provider’s cloud). Also, authentication can make sure that GRE tunnels are not dynamically set up with undesired spokes. + +IPsec uses a collection of protocols to provide its features. One of the primary protocols used by IPsec is the Internet Key Exchange (IKE) protocol. Specifically, IPsec can pro-vide encryption between authenticated peers using encryption keys, which are periodi-cally changed. IKE does, however, allow an administrator to manually configure keys. + +There are two phases to establish an IPsec tunnel. During IKE Phase 1, a secure Internet Security Association and Key Management Protocol (ISAKMP) session is established. As part of this phase, the IPsec endpoints establish transform sets (that is, a collection of encryption and authentication protocols), hash methods, and other parameters needed +to establish a secure ISAKMP session (sometimes called an ISAKMP tunnel or an IKE Phase 1 tunnel). This collection of parameters is called a security association (SA). With IKE Phase 1, the SA is bidirectional, meaning that the same key exchange is used for data flowing across the tunnel in either direction. + +IKE Phase 2 occurs within the protection of an IKE Phase 1 tunnel. A session formed during IKE Phase 2 is sometimes called an IKE Phase 2 tunnel, or simply an IPsec tun-nel. However, unlike IKE Phase 1, IKE Phase 2 performs unidirectional SA negotiations, meaning that each data flow uses a separate key exchange. + +In addition to IKE, which establishes the IPsec tunnel, IPsec also relies on either the Authentication Header (AH) protocol (IP protocol number 51) or the Encapsulating Security Payload (ESP) protocol (IP protocol number 50). Both AH and ESP offer origin authentication and integrity services, which ensure that IPsec peers are who they claim to be and that data was not modified in transit. + +The main distinction between AH and ESP, however, is encryption support. ESP encrypts the original packet, while AH does not offer any encryption. As a result, ESP is far more popular on today’s networks. + +Both AH and ESP can operate in one of two modes, transport mode or tunnel mode. Figure 2-10 illustrates the structure of an ESP transport mode packet versus an ESP tun-nel mode packet. + +Following is a detailed description of these two modes: + + +■ Key +Topic + + + +■ + +Transport Mode: Transport mode uses a packet’s original IP header, as opposed to adding an additional tunnel header. This approach works well in networks where increasing a packet’s size could cause an issue. Also, transport mode is frequently +used for client-to-site VPNs, where a PC running VPN client software connects back to a VPN termination device at a headquarters location. + +Tunnel Mode: Tunnel mode, unlike transport mode, encapsulates an entire packet. As a result, the encapsulated packet has a new header (that is, an IPsec header). This new header has source and destination IP address information that reflects the two VPN termination devices at different sites. Therefore, tunnel mode is frequently used +in an IPsec site-to-site VPN. + + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 63 + +Transport Mode + + +ESP ESP Auth Trailer + + +Payload + +ESP Original IP Header Header + + + + +Tunnel Mode + + +ESP ESP Auth Trailer + + +Payload + +Original IP ESP New IP Header Header Header + + +Figure 2-10 Transport Mode Versus Tunnel Mode + +The process of establishing, maintaining, and tearing down an IPsec site-to-site VPN consists of five primary steps, as illustrated in Figure 2-11 and described in the list that follows. + +PC1 PC2 + + +R1 R2 +Data Step 1 + + +Step 2 IKE Phase 1 Tunnel + +IKE Phase 2 Tunnel +Step 3 IKE Phase 1 Tunnel + + +Step 4 Data Data + + + + +Step 5 + + + +Figure 2-11 + +Step 1. + + +Step 2. + + +IPsec VPN Steps + +PC1 sends traffic destined for PC2. Router1 classifies the traffic as “interest-ing” traffic, which initiates the creation of an IPsec tunnel. + +Router1 and Router2 negotiate a security association (SA) used to form an +IKE Phase 1 tunnel, which is also known as an ISAKMP tunnel. + + + + + + +From the Library of Alexey Evseenko +64 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 3. Within the protection of the IKE Phase 1 tunnel, an IKE Phase 2 tunnel is negotiated and set up. An IKE Phase 2 tunnel is also known as an IPsec tunnel. +Step 4. After the IPsec tunnel is established, interesting traffic (for example, traf-fic classified by an ACL) flows through the protected IPsec tunnel. Note that traffic not deemed interesting can still be sent between PC1 and PC2. +However, the noninteresting traffic is transmitted outside of the protection of the IPsec tunnel. +Step 5. After no interesting traffic has been seen for a specified amount of time, or if the IPsec SA is deleted, the IPsec tunnel is torn down. + +Even though the configuration of IPsec is beyond the scope of the ROUTE curriculum, you should be familiar with the output of the show crypto ipsec sa command, which lets you see information about the SA negotiated between IPsec peers. Example 2-4 shows sample output from this command. + +Example 2-4 Sample Output from the show crypto ipsec sa Command Key +Topic R1# show crypto ipsec sa +interface: FastEthernet0/0 +Crypto map tag: test, local addr. 30.1.1.1 +local ident (addr/mask/prot/port): (20.1.1.0/255.255.255.0/0/0) +remote ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0) +current_peer: 30.1.1.2 +PERMIT, flags={origin_is_acl,} +#pkts encaps: 7647918, #pkts encrypt: 7647918, #pkts digest 7647918 +#pkts decaps: 7640382, #pkts decrypt: 7640382, #pkts verify 7640382 +#pkts compressed: 0, #pkts decompressed: 0 +#pkts not compressed: 0, #pkts compr. failed: 0, +#pkts decompress failed: 0, #send errors 1, #recv errors 0 +local crypto endpt.: 30.1.1.1, remote crypto endpt.: 30.1.1.2 +path mtu 1500, media mtu 1500 +current outbound spi: 3D3 +inbound esp sas: +spi: 0x136A010F(325714191) +transform: esp-3des esp-md5-hmac , +in use settings ={Tunnel, } +slot: 0, conn id: 3442, flow_id: 1443, crypto map: test +sa timing: remaining key lifetime (k/sec): (4608000/52) +IV size: 8 bytes +replay detection support: Y +inbound ah sas: +inbound pcp sas: +inbound pcp sas: +outbound esp sas: +spi: 0x3D3(979) + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 65 + +transform: esp-3des esp-md5-hmac , +in use settings ={Tunnel, } +slot: 0, conn id: 3443, flow_id: 1444, crypto map: test +sa timing: remaining key lifetime (k/sec): (4608000/52) +IV size: 8 bytes +replay detection support: Y +outbound ah sas: +outbound pcp sas: + +In Example 2-4, an IPsec tunnel is formed between 30.1.1.1 and 30.1.1.2. The tunnel goes between networks 10.1.1.0 /24 and 20.1.1.0 /24. An ACL is used to identify (that is, per-mit) traffic that should be sent over the IPsec tunnel. Encapsulating Security Payload (ESP) or Triple Data Encryption Standard (3DES) is being used for encryption, and Message Digest 5 (MD5) is used for authentication. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +66 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 2-2 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 2-2 Design Review + + +Design Goal + + +The design requires that routers at remote sites appear as adjacent to one another, and they are interconnected over an MPLS network. +The design requires customer edge (CE) routers at each enterprise site to communicate over an MPLS network and to form neighborships with provider edge (PE) routers to which they connect. +The design requires that multicast, broadcast, and unicast IP traffic between sites be secured within a VPN. +The design requires that spokes in a hub-and-spoke VPN topology be able to dynamically form GRE tunnels between themselves. + +Possible Implementation Choices Covered in This Chapter + +The design requires that a single GRE tunnel interface support multiple GRE tunnels. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 67 + + + +Design Goal + + +The design requires that spoke routers in a hub-and-spoke VPN design be able to query the hub to determine the IP address of a physical interface corresponding to the far side of a tunnel. +The design requires that you provide confidentiality, data integrity, authentication, and antireplay protection for unicast traffic flowing over a VPN. + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 2-3 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 2-3 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +The plan requires that an MPLS VPN technology be used to interconnect remote sites. What broad categories of MPLS VPNs could you choose from? (Choose two.) +The plan mandates the use of a Layer 3 MPLS VPN. What routing protocol will the service provider probably use to propagate route information from a customer edge (CE) router at one site to a CE router at another site? +The plan calls for the use of a GRE tunnel. What protocols can you send over a GRE tunnel? +The plan calls for the use of a Dynamic Multipoint VPN (DMVPN). What VPN technologies are required to support a DMVPN? (Choose three.) +The plan requires a hub router in a hub-and-spoke topology to have four GRE tunnels out to remote sites. If you use mGRE, how many tunnel interfaces need to be configured on the hub router to support the four GRE tunnels? + + + + +From the Library of Alexey Evseenko +68 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Question Answer +The plan calls for the use of NHRP in a hub-and-spoke VPN topology. What router, or routers, in the topology will hold the NHRP database? +The plan requires the use of IPsec. What are IPsec’s modes of operation? (Choose two.) + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 2-4 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 2-4 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Create a GRE virtual tunnel interface (in global configuration mode). +Assign an IP address to a GRE tunnel (in interface configuration mode). +Specify the source of a GRE tunnel (in interface configuration mode). +Specify the destination of a GRE tunnel (in interface configuration mode). + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table +2-5 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 2-5 Verification Plan Memory Drill + +Information Needed Command(s) +Verify the interface status and encapsulation of a GRE tunnel. + +Verify that a router sees the far side of a GRE tunnel as a single hop away, even though multiple routers might need to be transited to reach the far side of the tunnel. + + + + +From the Library of Alexey Evseenko +Chapter 2: Remote Site Connectivity 69 + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topics icon in the outer margin of the page. Table 2-6 lists a reference of these key topics and +the page numbers on which each is found. + + +Table 2-6 Key Topics for Chapter 2 +Key +Topic Key Topic Element Description Page Number + + +Figure 2-1 + +Figure 2-2 + +List + +Example 2-1 + +Example 2-2 + +Logical View of a Layer 2 MPLS VPN 52 + +A Layer 3 MPLS VPN 52 + +Steps to configure a GRE tunnel 53 + +GRE Sample Configuration 54 + +GRE Tunnel Verification 55 + + +List Steps used by NHRP to discover a remote physical IP 60 address and form a tunnel + +Example 2-3 + +List + +List + +Example 2-4 + +Sample Output from the show ip nhrp Command 61 + +Four security features offered by IPsec 61 + +Two modes of IPsec operation 62 + +Sample Output from the show crypto ipsec sa 64 Command + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +GRE, DMVPN, mGRE, NHRP, IPsec + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Global Unicast Addressing, Routing, and Subnetting: This section introduces the concepts behind unicast IPv6 addresses, IPv6 routing, and how to subnet using IPv6, all in comparison to IPv4. + +■ IPv6 Global Unicast Address Assignment: This section examines how global unicast addresses can be assigned to hosts and other devices. +■ Survey of IPv6 Addressing: This section examines all types of IPv6 addresses. + +■ Configuring IPv6 Addresses on Cisco Routers: This section shows how to configure and verify static IPv6 addresses on Cisco routers. +■ RIP Next Generation (RIPng): This section com-pares and contrasts IPv4’s RIPv2 and IPv6’s RIPng routing protocols and shows how to configure RIPng. + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 3 + + + + + + +IPv6 Review and RIPng + + +In your CCNA studies, you were introduced to IP version 6 (IPv6) addressing, and you learned that IPv6 is the replacement protocol for IPv4. IPv6 provides the ultimate solu-tion for the problem of running out of IPv4 addresses in the global Internet by using a 128-bit address, as opposed to IPv4’s 32-bit addresses. This gives IPv6 approximately 1038 total addresses, versus the mere (approximate) 4*109 total addresses in IPv4. However, many articles over the years have discussed when, if ever, a mass migration to IPv6 would take place. IPv6 has been the ultimate long-term solution for more than ten years, in part because the interim IPv4 solutions, including NAT/PAT, have thankfully delayed the day in which we truly run out of public unicast IP addresses. + +With all the promise of IPv6 and its rapid adoption, most networking professionals are still most familiar with IPv4. Therefore, this chapter spends a few pages reviewing the fundamentals of IPv6 to set the stage for a discussion of IPv6 routing protocols. + +IPv6 uses an updated version of the three popular interior gateway protocols (IGP) (RIP, EIGRP, and OSPF) to exchange routes inside an enterprise. Additionally, updates to the BGP version 4 standard, called multiprotocol extensions for BGP-4 (RFC 4760), allow the exchange of IPv6 routing information in the Internet. + +This chapter demonstrates how to configure RIPng to support IPv6 routing. Upcoming chapters delve into IPv6 routing using EIGRP and OSPF version 3 (OSPFv3). + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these ten self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 3-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 3-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Global Unicast Addressing, Routing, and Subnetting + +IPv6 Global Unicast Address Assignment + +Survey of IPv6 Addressing + +Questions +1, 2 + +3, 4 + +5, 6 + + + + +From the Library of Alexey Evseenko +72 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Foundation Topics Section +Configuring IPv6 Addresses on Cisco Routers + +RIP Next Generation (RIPng) + +Questions 7, 8 +9, 10 + + + +1. Which of the following is the shortest valid abbreviation for FE80:0000:0000:0000:0 010:0000:0000:0123? + +a. FE80::10::123 + +b. FE8::1::123 + +c. FE80:0:0:0:10::123 + +d. FE80::10:0:0:123 + +2. An ISP has assigned prefix 3000:1234:5678::/48 to Company1. Which of the follow-ing terms would typically be used to describe this type of public IPv6 prefix? + +a. Subnet prefix + +b. ISP prefix + +c. Global routing prefix + +d. Registry prefix + +3. Which of the following answers list either a protocol or function that can be used by a host to dynamically learn its own IPv6 address? (Choose two.) + +a. Stateful DHCP + +b. Stateless DHCP + +c. Stateless autoconfiguration + +d. Neighbor Discovery Protocol + +4. Which of the following is helpful to allow an IPv6 host to learn the IP address of a default gateway on its subnet? + +a. Stateful DHCP + +b. Stateless RS + +c. Stateless autoconfiguration + +d. Neighbor Discovery Protocol + +5. Which of the following answers lists a multicast IPv6 address? + +a. 2000::1:1234:5678:9ABC + +b. FD80::1:1234:5678:9ABC + +c. FE80::1:1234:5678:9ABC + +d. FF80::1:1234:5678:9ABC + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 73 + +6. Router R1 has two LAN interfaces and three serial interfaces enabled for IPv6. All the interfaces use link-local addresses automatically generated by the router. Which of the following could be the link-local address of R1’s interface S0/0? +a. FEA0::200:FF:FE11:0 + +b. FE80::200:FF:FE11:1111 + +c. FE80::0213:19FF:FE7B:0:1 + +d. FEB0::211:11FF:FE11:1111 + +7. Router R1 has the following configuration. Assuming that R1’s F0/0 interface has a MAC address of 0200.0011.1111, what IPv6 addresses will R1 list for interface F0/0 in the output of the show ipv6 interface brief command? (Choose two.) + +interface f0/0 +ipv6 address 2345:0:0:8::1/64 + +a. 2345:0:0:8::1 + +b. 2345:0:0:8:0:FF:FE11:1111 + +c. FE80::FF:FE11:1111 + +d. FE80:0:0:8::1 + +8. Router R1 lists the following output from a show command. Which of the following is true about R1? + +R1# show ipv6 interface f0/0 +FastEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::213:19FF:FE12:3456 +No Virtual link-local address(es): +Global unicast address(es): +2000::4:213:19FF:FE12:3456, subnet is 2000:0:0:4::/64 [EUI] +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:FF12:3456 + +a. R1’s solicited node multicast address is FF02::1:FF12:3456. + +b. R1’s 2000::4:213:19FF:FE12:3456 address is a global unicast with all 128 bits statically configured. + +c. Address FF02::2 is R1’s solicited node multicast. + +d. R1’s solicited node multicast, not listed in this output, would be FF02::213:19FF:FE12:3456. + + + + + + + +From the Library of Alexey Evseenko +74 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +9. Which of the following features work the same in both RIPv2 and RIPng? (Choose three.) + +a. Distance Vector Logic + +b. Uses UDP + +c. Uses RIP-specific authentication + +d. Maximum useful metric of 15 + +e. Automatic route summarization + +10. Router R1 currently has no configuration related to IPv6 or IPv4. The following configuration exists in a planning document, intended to be used to copy/paste into Router R1 to enable RIPng and IPv6 on interfaces Fa0/0 and S0/0/0. No other related configuration exists. Which of the following is true about RIPng on R1 after this configuration has been pasted into R1? + +ipv6 unicast-routing +interface fa0/0 +ipv6 rip one enable +ipv6 address 2000::1/64 +interface s0/0/0 +ipv6 address 2001::/64 eui-64 +ipv6 rip one enable + +a. RIPng will be enabled on no interfaces. + +b. RIPng will be enabled on one interface. + +c. RIPng will be enabled on two interfaces. + +d. RIPng will advertise about prefixes connected to S0/0/0 and Fa0/0, but only send Updates on one interface. + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 75 + +Foundation Topics + + +The world has changed tremendously over the past 10–20 years as a result of the growth and maturation of the Internet and networking technologies in general. As recently as 1990, a majority of the general public did not know about nor use global networks to communicate, and when businesses needed to communicate, those communications mostly flowed over private networks. During the last few decades, the public Internet grew to the point where people in most parts of the world could connect to the Internet. Many companies connected to the Internet for a variety of applications, with the pre-dominate applications being email and web access. During the first decade of the twenty-first century, the Internet has grown further to billions of addressable devices, with the majority of people on the planet having some form of Internet access. With that perva-sive access came a wide range of applications and uses, including voice, video, collabora-tion, and social networking, with a generation that has grown up with this easily accessed global network. + +The eventual migration to IPv6 will likely be driven by the need for more and more IP addresses. Practically every mobile phone supports Internet traffic, requiring the use of an IP address. Most new cars have the capability to acquire and use an IP address, along with wireless communications, allowing a car dealer to contact the customer when the car’s diagnostics detect a problem with the car. Some manufacturers have embraced the idea that all their appliances need to be IP-enabled. + +Although the two biggest reasons why networks might migrate from IPv4 to IPv6 are the need for more addresses and mandates from government organizations, at least IPv6 includes some attractive features and migration tools. Some of those advantages are as follows: + +■ Address assignment features: IPv6 supports a couple of methods for dynamic address assignment, including DHCP and stateless autoconfiguration. + +■ Built-in support for address renumbering: IPv6 supports the ability to change the public IPv6 prefix used for all addresses in an enterprise, using the capability to advertise the current prefix with a short timeout and the new prefix with a longer lease life. + +■ Built-in support for mobility: IPv6 supports mobility so that IPv6 hosts can move around an internetwork and retain their IPv6 addresses without losing current appli-cation sessions. + +■ Provider-independent and -dependent public address space: Internet Service Providers (ISP) can assign public IPv6 address ranges (dependent), or companies can register their own public address space (independent). + +■ Aggregation: IPv6’s huge address space makes for much easier aggregation of blocks of addresses in the Internet, making routing in the Internet more efficient. + +■ No need for NAT/PAT: The huge public IPv6 address space removes the need for NAT/PAT, which avoids some NAT-induced application problems and makes for more efficient routing. + + + +From the Library of Alexey Evseenko +76 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ IPsec: Unlike IPv4, IPv6 requires that every IPv6 implementation support IPsec. IPv6 does not require that each device use IPsec, but any device that implements IPv6 must also have the ability to implement IPsec. + +■ Header improvements: Although it might seem like a small issue, the IPv6 header actually improves several things compared to IPv4. In particular, routers do not need to recalculate a header checksum for every packet, reducing per-packet overhead. Additionally, the header includes a flow label that allows easy identification of pack-ets sent over the same single TCP or UDP connection. + +■ No broadcasts: IPv6 does not use Layer 3 broadcast addresses, instead relying on multicasts to reach multiple hosts with a single packet. + +■ Transition tools: As covered later in this chapter, IPv6 has many rich tools to help with the transition from IPv4 to IPv6. + +This list includes many legitimate advantages of IPv6 over IPv4, but the core difference is IPv6 addressing. The first two sections of this chapter examine one particular type of IPv6 addresses, global unicast addresses, which have many similarities to IPv4 addresses (particularly public IPv4 addresses). The third section broadens the discussion to include all types of IPv6 addresses, and protocols related to IPv6 address assignment, default router discovery, and neighbor discovery. The fourth section looks at the router configu-ration commands for IPv6 addressing. The fifth section of this chapter examines RIP Next Generation (RIPng) and shows how it can be used to route traffic for IPv6 networks. + +Global Unicast Addressing, Routing, and Subnetting + +The original Internet design called for all organizations to register and be assigned one or more public IP networks (Class A, B, or C). By registering to use a particular public network address, the company or organization using that network was assured by the numbering authorities that no other company or organization in the world would be +using the same addresses. As a result, all hosts in the world would have globally unique IP addresses. + +From the perspective of the Internet infrastructure, in particular the goal of keeping Internet routers’ routing tables from getting too large, assigning an entire network to each organization helped to some degree. The Internet routers could ignore all subnets as defined inside an enterprise, instead having a route for each classful network. For exam- +ple, if a company registered and was assigned Class B network 128.107.0.0/16, the Internet routers just needed one route for that entire network. + +Over time, the Internet grew tremendously. It became clear by the early 1990s that something had to be done, or the growth of the Internet would grind to a halt when all the public IP networks were assigned and no more existed. Additionally, the IP routing tables in Internet routers were becoming too large for the router technology of that day. So, the Internet community worked together to come up with both some short-term and long-term solutions to two problems: the shortage of public addresses and the size of the routing tables. + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 77 + +The short-term solutions included a much smarter public address assignment policy in which public addresses were not assigned as only Class A, B, and C networks, but as smaller subdivisions (prefixes), reducing waste. Additionally, the growth of the Internet routing tables was reduced by smarter assignment of the actual address ranges based on geography. For example, assigning the Class C networks that begin with 198 to only a particular ISP in a particular part of the world allowed other ISPs to use one route for 198.0.0.0/8—in other words, all addresses that begin with 198—rather than a route for each of the 65,536 different Class C networks that begin with 198. Finally, Network Address Translation/Port Address Translation (NAT/PAT) achieved amazing results by allowing a typical home or small office to consume only one public IPv4 address, greatly reducing the need for public IPv4 addresses. + +IPv6 provides the long-term solution to both problems (address exhaustion and Internet routing table size). The sheer size of IPv6 addresses takes care of the address exhaus-tion issue. The address assignment policies already used with IPv4 have been refined and applied to IPv6, with good results for keeping the size of IPv6 routing tables smaller in Internet routers. This section provides a general discussion of both issues, in particular how global unicast addresses, along with good administrative choices for how to assign IPv6 address prefixes, aid in routing in the global Internet. This section concludes with a discussion of subnetting in IPv6. + +Global Route Aggregation for Efficient Routing + +By the time the Internet community started serious work to find a solution to the growth problems in the Internet, many people already agreed that a more thoughtful public address assignment policy for the public IPv4 address space could help keep Internet routing tables much smaller and more manageable. IPv6 public address assignment fol-lows these same well-earned lessons. + + +Note The descriptions of IPv6 global address assignment in this section provide a general idea about the process. The process can vary from one Regional Internet Registry (RIR) to another and one Internet Service Provider (ISP) to another, based on many other factors. + + +The address assignment strategy for IPv6 is elegant, but simple, and can be roughly sum-marized as follows: + +■ Public IPv6 addresses are grouped (numerically) by major geographic region. + +■ Inside each region, the address space is further subdivided by ISPs inside that region. + +■ Inside each ISP in a region, the address space is further subdivided for each customer. + +The same organizations handle this address assignment for IPv6 as for IPv4. The Internet Corporation for Assigned Network Numbers (ICANN, www.icann.org) owns the process, with the Internet Assigned Numbers Authority (IANA) managing the process. IANA + + + + +From the Library of Alexey Evseenko +78 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +assigns one or more IPv6 address ranges to each RIR, of which there are five at the time of this publication, roughly covering North America, Central/South America, Europe, Asia/Pacific, and Africa. These RIRs then subdivide their assigned address space into smaller portions, assigning prefixes to different ISPs and other smaller registries, with the ISPs then assigning even smaller ranges of addresses to their customers. + +The IPv6 global address assignment plan results in more efficient routing, as shown in Figure 3-1. The figure shows a fictitious company (Company1), which has been assigned an IPv6 prefix by a fictitious ISP, NA-ISP1 (indicating North American ISP number 1). + +Company 1 +Key Topic + +R1 R2 + + + + + +NA-ISP2 + +1 Route for All +NA-ISP1 Addresses + +ISP-1 + + +1 Route for All Company 1 +Addresses +ISP-2 ISP-3 +NA-ISP1 + + +Europe + +1 Route for All North American IPv6 Addresses + + + + + +1 Route for All North American IPv6 Addresses + + +South America + +Figure 3-1 Conceptual View of IPv6 Global Routes + +As shown in the figure, the routers installed by ISPs in other major geographies of the world can have a single route that matches all IPv6 addresses in North America. Although there might be hundreds of ISPs operating in North America, and hundreds of thousands of enterprise customers of those ISPs, and tens of millions of individual customers of those ISPs, all the public IPv6 addresses can be from one (or a few) very large address blocks—requiring only one (or a few) routes on the Internet routers in other parts of the world. Similarly, routers inside other ISPs in North America (for example, NA-ISP2, indi-cating North American ISP number 2 in the figure) can have one route that matches all address ranges assigned to NA-ISP1. Also, the routers inside NA-ISP1 just need to have one route that matches the entire address range assigned to Company1, rather than need-ing to know about all the subnets inside Company1. + +Besides keeping the routers’ routing tables much smaller, this process also results in fewer changes to Internet routing tables. For example, if NA-ISP1 signed a service contract with + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 79 + +another enterprise customer, NA-ISP1 could assign another prefix inside the range of addresses already assigned to NA-ISP1 by the American Registry for Internet Numbers (ARIN). The routers outside NA-ISP1’s network (that is, the majority of the Internet) do not need to know any new routes, because their existing routes already match the address range assigned to the new customer. The NA-ISP2 routers (another ISP) already have a route that matches the entire address range assigned to NA-ISP1, so they do not need any more routes. Likewise, the routers in ISPs in Europe and South America already have a route that works as well. + +Conventions for Representing IPv6 Addresses + +IPv6 conventions use 32 hexadecimal numbers, organized into 8 quartets of 4 hex digits separated by a colon, to represent a 128-bit IPv6 address, for example: + +2340:1111:AAAA:0001:1234:5678:9ABC:1111 +Each hex digit represents 4 bits, so if you want to examine the address in binary, the con-version is relatively easy if you memorize the values shown in Table 3-2. + +Table 3-2 Hexadecimal/Binary Conversion Chart + +Hex Binary Hex Binary +0 0000 8 1000 + +1 0001 9 1001 + +2 0010 A 1010 + +3 0011 B 1011 + +4 0100 C 1100 + +5 0101 D 1101 + +6 0110 E 1110 + +7 0111 F 1111 + + +Writing or typing 32 hexadecimal digits, although more convenient than writing or typ-ing 128 binary digits, can still be a pain. To make things a little easier, two conventions allow you to shorten what must be typed for an IPv6 address: + +Key ■ Omit the leading 0s in any given quartet. +Topic ■ Represent one or more consecutive quartets of all hex 0s with “::” but only for one +such occurrence in a given address. + + +Note For IPv6, a quartet is one set of four hex digits in an IPv6 address. There are eight quartets in each IPv6 address. + + + + + +From the Library of Alexey Evseenko +80 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +For example, consider the following address. The bold digits represent digits in which the address could be abbreviated. + +FE00:0000:0000:0001:0000:0000:0000:0056 +This address has two different locations in which one or more quartets have four hex 0s, so two main options exist for abbreviating this address—using the :: abbreviation in one or the other location. The following two options show the two briefest valid abbreviations: + +FE00::1:0:0:0:56 FE00:0:0:1::56 +In particular, note that the :: abbreviation, meaning “one or more quartets of all 0s,” can-not be used twice, because that would be ambiguous. So, the abbreviation FE00::1::56 would not be valid. + +Conventions for Writing IPv6 Prefixes + +IPv6 prefixes represent a range or block of consecutive IPv6 addresses. Just like routers use IPv4 subnets in IPv4 routing tables to represent ranges of consecutive addresses, routers use IPv6 prefixes to represent ranges of consecutive IPv6 addresses. The concepts mirror those of IPv4 addressing when using a classless view of the IPv4 address. Figure +3-2 reviews both the classful and classless views of IPv4 addresses, compared to the IPv6 view of addressing and prefixes. + +Length of Network + Subnet Parts + + +Network Subnet Host IPv4 Classful Addressing + + +Prefix Host IPv4 Classless Addressing + + +Prefix Length + + +Prefix + +Host (Interface ID) + + +IPv6 Addressing + + + +Prefix Length + +Figure 3-2 IPv4 Classless and Classful Addressing, IPv6 Addressing + +First, for perspective, compare the classful and classless view of IPv4 addresses. Classful IPv4 addressing means that the class rules always identify part of the address as the net-work part. For example, the written value 128.107.3.0/24 (or 128.107.3.0 255.255.255.0) means 16 network bits (because the address is in a Class B network), 8 host bits (because the mask has 8 binary 0s), leaving 8 subnet bits. The same value, interpreted with + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 81 + +classless rules, means prefix 128.107.3.0, prefix length 24. Classless addressing and class-ful addressing just give a slightly different meaning to the same numbers. + +IPv6 uses a classless view of addressing, with no concept of classful addressing. Like IPv4, IPv6 prefixes list some prefix value, a slash, and then a numeric prefix length. Like IPv4 prefixes, the last part of the number, beyond the length of the prefix, will be repre-sented by binary 0s. And finally, IPv6 prefix numbers can be abbreviated with the same rules as IPv6 addresses. + + +Note IPv6 prefixes are often called IPv6 subnets. This book uses these terms interchangeably. + + +For example, consider the following IPv6 address that is assigned to a host on a LAN: + +2000:1234:5678:9ABC:1234:5678:9ABC:1111/64 +This value represents the full 128-bit IP address—there are no opportunities to even abbreviate this address. However, the /64 means that the prefix (subnet) in which this address resides is the subnet that includes all addresses that begin with the same first 64 bits as the address. Conceptually, it is the same logic as an IPv4 address. For example, address 128.107.3.1/24 is in the prefix (subnet) whose first 24 bits are the same values as address 128.107.3.1. + +As with IPv4, when writing or typing a prefix, the bits past the end of the prefix length are all binary 0s. In the IPv6 address previously shown, the prefix in which the address resides would be + +2000:1234:5678:9ABC:0000:0000:0000:0000/64 Which, when abbreviated, would be +2000:1234:5678:9ABC::/64 +Next, consider one last fact about the rules for writing prefixes before seeing some exam-ples. If the prefix length is not a multiple of 16, the boundary between the prefix and the interface ID (host) part of the address is inside a quartet. In such cases, the prefix value should list all the values in the last quartet in the prefix part of the value. For example, if the address just shown with a /64 prefix length instead had a /56 prefix length, the prefix would include all of the first three quartets (a total of 48 bits), plus the first 8 bits of the fourth quartet. The next 8 bits (last 2 hex digits) of the fourth octet should now be binary 0s, as part of the host portion of the address. So, by convention, the rest of the fourth octet should be written, after being set to binary 0s, as 9A00, which produces the follow-ing IPv6 prefix: + +2000:1234:5678:9A00::/56 +Key The following list summarizes some key points about how to write IPv6 prefixes. +Topic ■ A prefix has the same value as the IP addresses in the group for the number of bits in +the prefix length. + +■ Any bits after the prefix length number of bits are binary 0s. + + + +From the Library of Alexey Evseenko +82 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ A prefix can be abbreviated with the same rules as IPv6 addresses. + +■ If the prefix length is not on a quartet boundary, write down the value for the entire quartet. + +Examples can certainly help in this case. Table 3-3 shows several sample prefixes, their format, and a brief explanation. + + +Table 3-3 + +Prefix +2000::/3 + + +Example IPv6 Prefixes and Their Meanings + +Explanation +All addresses whose first 3 bits are equal to the first 3 bits of hex number 2000 (bits are 001). + + + +Incorrect Alternative +2000/3 (omits ::) + + + +2340:1140::/26 + +2340:1111::/32 + +All addresses whose first 26 bits match the listed hex number. +All addresses whose first 32 bits match the listed hex number. + +2340:114::/26 (omits trailing 0 in the second quartet) +2340:1111:/32 (uses : instead of ::) + + + +Note which options are not allowed. For example, 2::/3 is not allowed instead of 2000::/3, because it omits the rest of the quartet, and a device could not tell whether 2::/3 means “hex 0002” or “hex 2000.” + +Now that you understand a few of the conventions about how to represent IPv6 address-es and prefixes, a specific example can show how IANA’s IPv6 global unicast IP address assignment strategy can allow the easy and efficient routing previously shown in +Figure 3-1. + + +Global Unicast Prefix Assignment Example + +IPv6 standards reserve the range of addresses inside the 2000::/3 prefix as global unicast addresses. This address range includes all IPv6 addresses that begin with binary 001, or as more easily recognized, all IPv6 addresses that begin with a 2 or 3. IANA assigns global unicast IPv6 addresses as public and globally unique IPv6 addresses, as discussed using the example previously shown in Figure 3-1, allowing hosts using those addresses to com-municate through the Internet without the need for NAT. In other words, these addresses fit the purest design for how to implement IPv6 for the global Internet. + +Figure 3-3 shows an example set of prefixes that could result in a company (Company1) being assigned a prefix of 2340:1111:AAAA::/48. + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 83 + + + +Key Topic + +Company1 Owns 2340:1111:AAAA::/48 + + + +R1 R2 +Company1 + + + +Assigns 2340:1111:AAAA::/48 + +ISP-1 + + + +NA-ISP1Owns NA-ISPI 2340:1111::/32 + +ISP-2 ISP-3 + +Assigns 2340:1111::/32 + + + +ARIN (RIR) Owns 2340::/12 + + +Assigns 2340::/12 IANA + + + +Figure 3-3 Example IPv6 Prefix Assignment in the Internet + +The process starts with IANA, who owns the entire IPv6 address space and assigns the rights to a registry prefix to one of the RIRs (ARIN in this case, in North America). For the purposes of this chapter, assume that IANA assigns prefix 2340::/12 to ARIN. This assignment means that ARIN has the rights to assign any IPv6 addresses that begin with the first 12 bits of hex 2340 (binary value 0010 0011 0100). For perspective, that’s a large group of addresses: 2116 to be exact. + +Next, NA-ISP1 asks ARIN for a prefix assignment. After ARIN ensures that NA-ISP1 meets some requirements, ARIN might assign ISP prefix 2340:1111::/32 to NA-ISP1. This too is a large group: 296 addresses to be exact. For perspective, this one address block might well be enough public IPv6 addresses for even the largest ISPs, without that ISP ever needing another IPv6 prefix. + +Finally, Company1 asks its ISP, NA-ISP1, for the assignment of an IPv6 prefix. NA-ISP1 assigns Company1 the site prefix 2340:1111:AAAA::/48, which is again a large range of addresses: 280 in this case. A little later in this section, the text shows what Company1 could do with that prefix, but first, examine Figure 3-4, which presents the same con-cepts as in Figure 3-1, but now with the actual prefixes shown. + + + + + + + + +From the Library of Alexey Evseenko +84 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Company1 + + +R1 R2 + + + + + +NA-ISP2 + +1 Route for 2340:1111::/32 + +ISP-1 + + +1 Route for +2340:1111:AAAA::/48 + + +Europe + + +1 Route for 2340::/12 + + +ISP-2 ISP-3 NA-ISP1 + + + + +1 Route for 2340::/12 + + + +South America + +Figure 3-4 IPv6 Global Routing Concepts + +The figure shows the perspectives of routers outside North America, routers from another ISP in North America, and other routers in the same ISP. Routers outside North America can use a route for prefix 2340::/12, knowing the IANA assigned this prefix to be used only by ARIN. This one route could match all IPv6 addresses assigned in North America. Routers in NA-ISP2, an example alternative ISP in North America, need one route for 2340:1111::/32, the prefix assigned to NA-ISP1. This one route could match all packets destined for all customers of NA-ISP1. Inside NA-ISP1, its routers need to know to which NA-ISP1 router to forward packets for that particular customer (named ISP-1 in this case), so the routes inside NA-ISP1’s routers list a prefix of 2340:1111:AAAA::/48. + + +Note The /48 prefix assigned to a single company is called either a global routing prefix or a site prefix. + + + +Subnetting Global Unicast IPv6 Addresses Inside an Enterprise + +The original IPv4 Internet design called for each organization to be assigned a classful network number, with the enterprise subdividing the network into smaller address ranges by subnetting the classful network. This same concept of subnetting carries over from IPv4 to IPv6, with the enterprise subnetting its assigned global unicast prefix into smaller prefixes. + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 85 + +To better understand IPv6 subnetting, you can draw on either classful or classless IPv4 addressing concepts, whichever you find most comfortable. From a classless perspective, you can view the IPv6 addresses as follows: + + +■ Key +Topic +■ + + +■ + +The prefix assigned to the enterprise by the ISP (the global routing prefix) acts like the prefix assigned for IPv4. + +The enterprise engineer extends the prefix length, borrowing host bits, to create a subnet part of the address with which to identify individual subnets. + +The remaining part of the addresses on the right, called either the interface ID or host part, works just like the IPv4 host part, uniquely identifying a host inside a +subnet. + + +For example, Figure 3-5 shows a more detailed view of the Company1 enterprise net-work, shown in several of the previous figures in this chapter. The design concepts behind how many subnets are needed with IPv6 are identical to those of IPv4. Specifically, a subnet is needed for each VLAN and for each serial link, with the same Frame Relay sub-netting options. In this case, two LANs and two serial links exist. So Company1 needs four subnets. + + + +Key +Topic Subnet 1 + +Company 1 + +Subnet 2 Subnet 3 + + +Fa0/0 R1 S0/0/1 S0/1/0 R2 Fa0/0 +S0/1/1 + +Subnet 4 + + + + +ISP-1 + +48 Bits +Prefix (ISP-assigned) 2340:1111:AAAA + +16 Bits + +Subnet + +64 Bits +Host (Interface ID) + + + +Subnet Prefix Host + +Figure 3-5 Company1—Needs Four Subnets + +The figure also shows how the enterprise engineer extended the length of the prefix as assigned by the ISP (/48) to /64, thereby creating a 16-bit subnet part of the address structure. To create this extra 16-bit subnet field, the engineer uses the same concept as with IPv4 when choosing a subnet mask, by borrowing bits from the host field of an IPv4 address. In this case, think of the original host field (before subnetting) as having 80 bits, because the site prefix is 48 bits long, leaving 80 bits. The design in Figure 3-5 borrows 16 bits for the subnet field, leaving a measly 64 bits for the host field. + +A bit of math about the design choices can help provide some perspective on the scale of IPv6. The 16-bit subnet field allows for 216, or 65,536, subnets—overkill for all but the very largest organizations or companies. (There are no worries about a zero or broad-cast subnet in IPv6!) The host field is seemingly even more overkill: 264 hosts per subnet, + + + + +From the Library of Alexey Evseenko +86 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +which is more than 1,000,000,000,000,000,000 addresses per subnet. However, there is a good reason for this large host or interface ID part of the address. It allows one of the automatic IPv6 address assignment features to work well, as covered later in the “IPv6 Global Unicast Addresses Assignment” section of this chapter. + +Figure 3-6 takes the concept to the conclusion, assigning the specific four subnets to be used inside Company1. Note that the figure shows the subnet fields and prefix lengths (64 in this case) in bold. + + +Note The subnet numbers in Figure 3-6 could be abbreviated slightly, removing the three leading 0s from the last shown quartets. The figure includes the leading 0s to show the entire subnet part of the prefixes. + + +Company 1 + + +Prefix 2340:1111:AAAA:0001::/64 + + +Prefix 2340:1111:AAAA:0002::/64 + + +Prefix 2340:1111:AAAA:0003::/64 + + +Fa0/0 R1 S0/0/1 S0/1/0 R2 Fa0/0 S0/1/1 + +Prefix 2340:1111:AAAA:0004::/64 + + +ISP-1 + +Figure 3-6 Company1—Four Subnets Assigned + +Figure 3-6 just shows one option for subnetting the prefix assigned to Company1. However, any number of subnet bits could be chosen if the host field retained enough bits to number all hosts in a subnet. For example, a /112 prefix length could be used, extending the /48 prefix by 64 bits (four hex quartets). Then, for the design in Figure 3-6, you could choose the following four subnets: + +2340:1111:AAAA::0001:0000/112 2340:1111:AAAA::0002:0000/112 2340:1111:AAAA::0003:0000/112 2340:1111:AAAA::0004:0000/112 +By using global unicast IPv6 addresses, Internet routing can be very efficient. Enterprises can have plenty of IP addresses and plenty of subnets with no requirement for NAT func-tions to conserve the address space. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 87 + +Prefix Terminology + +Before wrapping up this section, you need to review a few terms. The process of global unicast IPv6 address assignment examines many different prefixes with many different prefix lengths. The text scatters a couple of more specific terms, but for easier study, Table 3-4 summarizes the four key terms with some reminders of what each means. + + +Table 3-4 + +Term + + +Example IPv6 Prefixes and Their Meanings + +Assignment Example + + + +Registry prefix + +ISP prefix + +Site prefix or global routing prefix +Subnet prefix + +By IANA to an RIR + +By an RIR to an ISP1 + +By an ISP or registry to a customer (site) +By an enterprise engineer for each individual link + +2340::/12 + +2340:1111/32 + +2340:1111:AAAA/48 + +2340:1111:AAAA:0001/64 + + +1 Although an RIR can assign a prefix to an ISP, an RIR can also assign a prefix to other Internet regis-tries, which might subdivide and assign additional prefixes, until eventually an ISP and then its customers are assigned some unique prefix. + +IPv6 Global Unicast Addresses Assignment + +This section still focuses on global unicast IPv6 addresses but now examines the topic of how a host, router interface, or other device knows what global unicast IPv6 address to use. Also, hosts (and sometimes routers) need to know a few other facts that can be learned at the same time as they learn their IPv6 address. So, this section also discusses how hosts can get all the following relevant information that lets them use their global unicast addresses: + +■ IP address + +■ IP subnet mask (prefix length) + +■ Default router IP address + +■ DNS IP address(es) + +IPv6 actually has four major options for IPv6 global unicast address assignment. This sec-tion looks at these options in the same order as listed in Table 3-5. Each method can use dynamic processes or static configuration, and each method can differ in terms of how a host or router gathers the other pertinent information (such as DNS IP addresses). Table 3-5 summarizes these main methods for easier review. + + + + + + + + +From the Library of Alexey Evseenko +88 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 3-5 Summary of IPv6 Address Assignment for Global Unicast Addresses + + +Method + + + +Stateful DHCP +Stateless Autoconfig + +Dynamic or Static + + +Dynamic + +Dynamic + +Prefix and Length Learned from... +DHCP Server + +Router, using NDP + +Host Learned from... + +DHCP Server + +Derived from MAC + +Default Router Learned from... +Router, using NDP +Router, using NDP + +DNS Addresses Learned from... +(Stateful) DHCP Server +Stateless DHCP + + + +Static Static Configuration + +Local config Local config Router, using NDP + +Stateless DHCP + + + +Static Config Static with EUI-64 + +Local config Derived from MAC + +Router, using NDP + +Stateless DHCP + + + +The rest of this section develops more detail about the topics in the table. Some of the processes work much like IPv4, and some do not. Regardless, as you work through the material, keep in mind one key fact about how IPv6 protocols approach the address assignment process: + +IPv6 address assignment processes can split the IPv6 address assignment into two parts: the prefix/length assignment and the host (interface ID) assignment. + +Stateful DHCP for IPv6 + +IPv6 hosts can use stateful DHCP to learn and lease an IP address and corresponding pre-fix length (mask) and the DNS IP address(es). The concept works basically like DHCP for IPv4. The host sends a (multicast) packet searching for the DHCP server. When a server replies, the DHCP client sends a message asking for a lease of an IP address, and the serv-er replies, listing an IPv6 address, prefix length, and DNS IP addresses. (Note that Stateful DHCPv6 does not supply the default router information, instead relying on Neighbor Discovery Protocol [NDP] between the client and local routers.) The names and formats of the actual DHCP messages have changed quite a bit from IPv4 to IPv6. So, DHCPv4 and DHCPv6 actually differ in detail, but the basic process remains the same. (The term DHCPv4 refers to the version of DHCP used for IPv4, and the term DHCPv6 refers to the version of DHCP used for IPv6.) + +DHCPv4 servers retain state information about each client, such as the IP address leased to that client and the length of time for which the lease is valid. In other words, DHCPv4 tracks the current state of DHCP clients. DHCPv6 servers happen to have two operational modes: stateful, in which the server does track state information, and stateless, in which the server does not track any state information. Stateful DHCPv6 servers fill the same role as the older DHCPv4 servers, whereas stateless DHCPv6 servers fill a different purpose as one part of the stateless autoconfiguration process. (Stateless DHCP, and its purpose, is covered in the upcoming section “Finding the DNS IP Addresses Using Stateless DHCP.”) + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 89 + +One difference between DHCPv4 and stateful DHCPv6 is that IPv4 hosts send IP broad-casts to find DHCP servers, whereas IPv6 hosts send IPv6 multicasts. IPv6 multicast addresses have a prefix of FF00::/8, meaning that the first 8 bits of an address are binary 11111111, or FF in hex. The multicast address FF02::1:2 (longhand FF02:0000:0000:00 00:0000:0000:0001:0002) has been reserved in IPv6 to be used by hosts to send packets to an unknown DHCP server, with the routers working to forward these packets to the appropriate DHCP server. + +Stateless Autoconfiguration + +The second of the two options for dynamic IPv6 address assignment uses a built-in IPv6 feature called stateless autoconfiguration as the core tool. Stateless autoconfiguration allows a host to automatically learn the key pieces of addressing information—prefix, host, and prefix length—plus the default router IP address and DNS IP addresses. To learn or derive all these pieces of information, stateless autoconfiguration actually uses +the following functions: + + +Step 1. +Key Topic + +Step 2. + + +Step 3. + + +IPv6 Neighbor Discovery Protocol (NDP), particularly the router solicitation and router advertisement messages, to learn the prefix, prefix length, and default router + +Some math to derive the interface ID (host ID) portion of the IPv6 address, using a format called EUI-64 + +Stateless DHCP to learn the DNS IPv6 addresses + + +This section examines all three topics in order. + + +Learning the Prefix/Length and Default Router with NDP Router Advertisements + +The IPv6 Neighbor Discovery Protocol (NDP) has many functions. One function allows IPv6 hosts to multicast a message that asks all routers on the link to announce two key pieces of information: the IPv6 addresses of routers willing to act as a default gateway and all known IPv6 prefixes on the link. This process uses ICMPv6 messages called a Router Solicitation (RS) and a Router Advertisement (RA). + +For this process to work, before a host sends an RS message on a LAN, some router con-nected to that same LAN must already be configured for IPv6. The router must have an IPv6 address configured, and it must be configured to route IPv6 traffic. At that point, the router knows it can be useful as a default gateway, and it knows at least one prefix that can be useful to any clients on the LAN. + +For example, Figure 3-7 shows a subset of the internetwork seen in Figures 3-5 and 3-6, with the same IPv6 addresses and subnets used. Router R1’s Fa0/0 has already been con-figured with an IPv6 address (2340:1111:AAAA:1:213:19FF:FE7B:5004/64) and has been configured to route IPv6 with the ipv6 unicast-routing global command. + + + + + + +From the Library of Alexey Evseenko +90 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +PC1 + + +1 + +RS – All Routers – Identity Yourselves + +2 + +R1 + + +RA – All Nodes: +Prefix Is 2340:1111:AAAA:1::/64 Default Router Is +2340:1111:AAAA:1:213:19FF:FE7B:5004 + + +Figure 3-7 Example NDP RS/RA Process to Find the Default Routers + +In the figure, host PC1, using stateless autoconfig, sends the RS message as an IPv6 multicast message destined to all IPv6 routers on the local link. The RS asks all routers to respond to the questions “What IPv6 prefix(s) is used on this subnet?” and “What is the IPv6 address(s) of any default routers on this subnet?” The figure also shows R1’s response (RA), listing the prefix (2340:1111:AAAA:1::/64), and with R1’s own IPv6 address as a potential default router. + + +Note IPv6 allows multiple prefixes and multiple default routers to be listed in the RA message; Figure 3-7 just shows one of each for simplicity’s sake. One router’s RA would also include IPv6 addresses and prefixes advertised by other routers on the link. + + +IPv6 does not use broadcasts. In fact, there is no such thing as a subnet broadcast address, a network-wide broadcast address, or an equivalent of the all-hosts 255.255.255.255 broadcast IPv4 address. Instead, IPv6 makes use of multicast addresses. By defining dif-ferent multicast IPv6 addresses for different functions, an IPv6 host that has no need to participate in a particular function can simply ignore those particular multicasts, reduc-ing the impact on the host. + +For example, the RS message needs to be received and processed only by routers, so the RS message’s destination IP address is FF02::2, which IPv6 reserves for use only by IPv6 routers. IPv6 defines that routers send RA messages to a multicast address intended for use by all IPv6 hosts on the link (FF02::1); routers do not forward these messages to other links. As a result, not only does the host that sent the RS message learn the information, but all other hosts on the link also learn the details. Table 3-6 summarizes some of the key details about the RS/RA messages. + + +Table 3-6 + +Message + + +Details of the RS/RA Process + +RS RA + + + +Multicast destination + +Meaning of multicast address + +FF02::2 + +All routers on this link + +FF02::1 + +All IPv6 nodes on this link + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 91 + +Calculating the Interface ID Using EUI-64 + +Earlier in the chapter, Figure 3-5 showed the format of an IPv6 global unicast address with the second half of the address called the host ID or interface ID. The value of the interface ID portion of a global unicast address can be set to any value if no other host in the same subnet attempts to use the same value. + +To automatically create a guaranteed-unique interface ID, IPv6 defines a method to cal-culate a 64-bit interface ID derived from that host’s MAC address. Because the burned-in MAC address should be literally globally unique, the derived interface ID should also be globally unique. + +The EUI-64 process takes the 6-byte (48-bit) MAC address and expands it into a 64-bit value. To do so, IPv6 fills in 2 more bytes into the middle of the MAC address. IPv6 sep-arates the original MAC address into two 3-byte halves and inserts hex FFFE in between the halves to form the Interface ID field of the IPv6 address. The conversion also requires flipping the seventh bit inside the IPv6 address, resulting in a 64-bit number that con-forms to a convention called the EUI-64 format. The process is shown in Figure 3-8. + +Subnet Prefix Key +Topic +48 Bits 16 Bits 64 Bits + +Prefix (ISP-assigned) Subnet Interface ID + + + +Site Prefix 1st Half of MAC + +EUI-64 Format +FFFE 2nd Half of +MAC + + + +Flip 7th Bit (Reading Left to Right) +in First Byte + +Figure 3-8 IPv6 Address Format with Interface ID and EUI-64 + +Although it might seem a bit convoluted, it works. Also, with a little practice, you can look at an IPv6 address and quickly notice the FFFE late in the address and then easily find the two halves of the corresponding interface’s MAC address. + +For example, the following two lines list a host’s MAC address, and corresponding EUI-64 format Interface ID, assuming the use of an address configuration option that uses the EUI-64 format: + +0034:5678:9ABC 0234:56FF:FE78:9ABC + +Note To change the seventh bit (left-to-right) in the example, we notice that hex 00 con-verts to binary 00000000. Then we change the seventh bit to 1 (00000010) and convert back to hex, which gives us hex 02 as the first two hexadecimal digits. + + + + +From the Library of Alexey Evseenko +92 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +At this point in the stateless autoconfig process, a host knows its full IPv6 address and prefix length, plus a local router to use as the default gateway. The next section discusses how to complete the process using stateless DHCP. + +Finding the DNS IP Addresses Using Stateless DHCP + +Although the DHCP server function for IPv4 does not explicitly use the word “stateful” in its name, IPv4 DHCP servers keep state information about DHCP clients. The server keeps a record of the leased IP addresses and when the lease expires. The server typically releases the addresses to the same client before the lease expires, and if no response is heard from a DHCP client in time to renew the lease, the server releases that IP address back into the pool of usable IP addresses—again keeping that state information. The server also has configuration of the subnets in use and a pool of addresses in most sub-nets from which the server can assign IP addresses. It also serves other information, such as the default router IP addresses in each subnet, and the DNS servers’ IP addresses. + +The IPv6 stateful DHCP server, as previously discussed in the section “Stateful DHCP for IPv6,” follows the same general idea. However, for IPv6, this server’s name includes the word stateful, to contrast it with the stateless DHCP server function in IPv6. + +The stateless DHCP server function in IPv6 solves one particular problem: It supplies the DNS servers’ IPv6 addresses to clients. Because all hosts typically use the same small number of DNS servers, the stateless DHCP server does not need to keep track of any state information. An engineer simply configures the stateless DHCP server to know the IPv6 addresses of the DNS servers, and the server tells any host or other device that asks, keeping no record of the process. + +Hosts that use stateless autoconfig also use stateless DHCP to learn the DNS servers’ IPv6 addresses. + +Table 3-7 summarizes some of the key features of stateful and stateless DHCPv6. + + + +Table 3-7 +Key +Topic Feature + + +Comparing Stateless and Stateful DHCPv6 Services + +Stateful DHCP Stateless DHCP + +Remembers IPv6 address (state information) of clients Yes No that make requests +Assigns IPv6 address to client Yes No + +Supplies useful information, such as DNS server IP Yes Yes addresses +Most useful in conjunction with stateless No Yes autoconfiguration + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 93 + +Static IPv6 Address Configuration + +Two options exist for static configuration of IPv6 addresses: + +■ You configure the entire 128-bit IPv6 address. + +■ You configure the 64-bit prefix and tell the device to use an EUI-64 calculation for the interface ID portion of the address. + +Both options result in the host or router interface knowing its full 128-bit IPv6 address and prefix length. + +When a host uses either form of static IPv6 address configuration, the host does not need to statically configure the other key pieces of information (default router and DNS IP addresses). The host can use the usual NDP process to discover any default routers and stateless DHCP to discover the DNS IPv6 addresses. + +When a router uses static IPv6 address configuration, it might still use stateless DHCP to learn the DNS IP addresses. The upcoming section “Configuring IPv6 Addresses on Cisco Routers” shows several examples of this configuration. + +Survey of IPv6 Addressing + +So far, this chapter has focused on the IPv6 addresses that most closely match the concept of IPv4 addresses: the global unicast IPv6 addresses. This section now takes a broader look at IPv6 addressing, including some concepts that can be tied to older IPv4 concepts, and some that are unique to IPv6. + +This section begins with a brief overview of IPv6 addressing. It then looks at unicast IPv6 addresses, along with a brief look at some of the commonly used multicast addresses. This section ends with a discussion of a couple of related protocols, namely, Neighbor Discovery Protocol (NDP) and Duplicate Address Detection (DAD). + +Overview of IPv6 Addressing + +The entire concept of global unicast addressing with IPv6 does have many similarities to IPv4. If viewing IPv4 addresses from a classless perspective, both IPv4 and IPv6 global unicast addresses have two parts: subnet plus host for IPv4 and prefix plus interface +ID for IPv6. The format of the addresses commonly list a slash followed by the prefix length—a convention sometimes referred to as CIDR notation and other times as prefix notation. Subnetting works much the same, with a public prefix assigned by some num-bering authority and the enterprise choosing subnet numbers, extending the length of the prefix to make room to number the subnets. + +IPv6 addressing, however, includes several other types of unicast IPv6 addresses in addi-tion to the global unicast address. Additionally, IPv6 defines other general categories of addresses, as summarized in the list that follows: + + +■ +Key Topic + +Unicast: Like IPv4, hosts and routers assign these IP addresses to a single interface +for the purpose of allowing that one host or interface to send and receive IP packets. + + + + + +From the Library of Alexey Evseenko +94 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ Multicast: Like IPv4, these addresses represent a dynamic group of hosts, allowing a host to send one packet that is then delivered to every host in the multicast group. IPv6 defines some special-purpose multicast addresses for overhead functions (such as NDP). IPv6 also defines ranges of multicast addresses for application use. + +■ Anycast: This address type allows the implementation of a nearest server among duplicate servers concept. This design choice allows servers that support the exact same function to use the exact same unicast IP address. The routers then forward a packet destined for such an address to the nearest server that is using the address. + +Two big differences exist when comparing general address categories for IPv4 and IPv6: + +■ IPv6 adds the formal concept of Anycast IPv6 addresses as shown in the preceding list. IPv4 does not formally define an Anycast IP address concept, although a similar concept might be implemented in practice. + +■ IPv6 simply has no Layer 3 broadcast addresses. For example, all IPv6 routing proto-cols send Updates either to unicast or multicast IPv6 addresses, and overhead proto-cols such as NDP make use of multicasts as well. In IPv4, ARP still uses broadcasts, and the RIP version 1 routing protocol also uses broadcasts. With IPv6, there is no need to calculate a subnet broadcast address (hoorah!) and no need to make hosts process overhead broadcast packets meant only for a few devices in a subnet. + +Finally, note that IPv6 hosts and router interfaces typically have at least two IPv6 address-es and might well have more. Hosts and routers typically have a link local type of IPv6 address (as described in the upcoming section “Link-local Unicast Addresses”). A router might or might not have a global unicast address, and might well have multiple addresses. IPv6 simply allows the configuration of multiple IPv6 addresses with no need for or con-cept of secondary IP addressing. + +Unicast IPv6 Addresses + +IPv6 supports three main types of unicast addresses: unique local, global unicast, and link-local. This section takes a brief look at unique local and link-local addresses. + +Unique Local IPv6 Addresses + +Unique local unicast IPv6 addresses have the same function as IPv4 RFC 1918 private addresses. RFC 4193 states that these addresses should be used inside a private orga-nization and should not be advertised into the Internet. Unique local unicast addresses begin with hex FC00::/7, with the format shown in Figure 3-9. The L-bit is set to a 1 if the address is locally assigned. This makes FD the first two hex digits in a unique local address that is locally assigned. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 95 + + + +111 110 L + + + +7 Bits 1 Bit + +Global ID + + + +40 Bits + +Subnet ID + + + +16 Bits + +Interface ID + + + +64 Bits + + +Figure 3-9 Unique Local Address Format + +To use these addresses, an enterprise engineer would choose a 40-bit global ID in a pseu-dorandom manner rather than asking for a registered public prefix from an ISP or other registry. To form the complete prefix, the chosen 40 bits would be combined with the initial required 8 bits (hex FD) to form a 48-bit site prefix. The engineer can then use a 16-bit subnet field to create subnets, leaving a 64-bit interface ID. The interface ID could be created by static configuration or by the EUI-64 calculation. + +This type of unicast address gives the engineer the ability to create the equivalent of an IPv4 private address structure, but given the huge number of available public IPv6 addresses, it might be more likely that engineers plan to use global unicast IP addresses throughout an enterprise. + +Link-local Unicast Addresses + +IPv6 uses link-local addresses for sending and receiving IPv6 packets on a single subnet. Many such uses exist; here’s just a small sample: + +■ Used as the source address for RS and RA messages for router discovery (as previ-ously shown in Figure 3-7 ) + +■ Used by Neighbor Discovery (the equivalent of ARP for IPv6) + +■ Used as the next-hop IPv6 address for IP routes + +By definition, routers use a link-local scope for packets sent to a link-local IPv6 address. The term link-local scope means exactly that—the packet should not leave the local link, or local subnet if you will. When a router receives a packet destined for such a destina-tion address, the router does not forward the packet. + +The link-local IPv6 addresses also help solve some chicken-and-egg problems, because each host, router interface, or other device can calculate its own link-local IPv6 address without needing to communicate with any other device. So, before sending the first packets, a host can calculate its own link-local address. Therefore, the host has an IPv6 address to use when doing its first overhead messages. For example, before a host sends an NDP RS (Router Solicitation) message, the host will have already calculated its link-local address, which can be used as the source IPv6 address in the RS message. + +Link-local addresses come from the FE80::/10 range, meaning that the first 10 bits must be 1111 1110 10. An easier range to remember is that all hex link-local addresses begin with FE8, FE9, FEA, or FEB. However, practically speaking, for link-local addresses formed automatically by a host (rather than through static configuration), the address always starts with FE80, because the automatic process sets bits 11-64 to binary 0s. + + + + +From the Library of Alexey Evseenko +96 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Figure 3-10 shows the format of the link-local address format under the assumption that the host or router is deriving its own link-local address, therefore using 54 binary 0s after the FE80::/10 prefix. + + + +Key Topic + +10 Bits +FE80/10 1111111010 + +54 Bits 64 Bits + +All 0s Interface ID + + +Figure 3-10 Link-local Address Format + + +IPv6 Unicast Address Summary + +You might come across a few other types of IPv6 addresses in other reading. For example, earlier IPv6 RFCs defined the site local address type, which was meant to be used like IPv4 private addresses. However, this address type has been deprecated (RFC 3879). Also, IPv6 migration and coexistence tools use some conventions for IPv6 unicast addresses such that IPv4 addresses are embedded in the IPv6 address. + +Additionally, it is helpful to know about other special unicast addresses. An address of all hex 0s, written ::/128, represents an unknown address. This can be used as a source IPv6 address in packets when a host has no suitable IPv6 address to use. The address ::1/128, representing an address of all hex 0s except a final hex digit 1, is a loopback address. Packets sent to this address will be looped back up the TCP/IP stack, allowing easier soft-ware testing. (This is the equivalent of IPv4’s 127.0.0.1 loopback address.) + +Table 3-8 summarizes the IPv6 unicast address types for easier study. + + + +Table 3-8 Common IPv6 Unicast Address Types +Key +Topic Type of Address Purpose Prefix + + + +Easily Seen Hex Prefix(es) + +Global unicast Unicast packets sent through the 2000::/3 2 or 3 public Internet + +Unique local + +Link-local + +Site local + + +Unspecified + +Loopback + +Unicast packets inside one organization +Packets sent in the local subnet + +Deprecated; originally meant to be used like private IPv4 addresses +An address used when a host has no usable IPv6 address +Used for software testing, like IPv4’s 127.0.0.1 + +FD00::/8 + +FE80::/10 + +FECO::/10 + + +::/128 + +::1/128 + +FD + +FE8* + +FEC, FED, FEE, FEF + + +N/A + +N/A + + +*IPv6 RFCs define the FE80::/10 prefix, which technically means that the first three hex digits could be FE8, FE9, FEA, or FEB. However, bit positions 11-64 of link-local addresses should be 0, so in practice, link-local addresses should always begin with FE80. + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 97 + +Multicast and Other Special IPv6 Addresses + +IPv6 supports multicasts on behalf of applications and multicasts to support the inner workings of IPv6. To aid this process, IPv6 defines ranges of IPv6 addresses and an asso-ciated scope, with the scope defining how far away from the source of the packet the network should forward a multicast. + +All IPv6 multicast addresses begin with FF::/8. In other words, they begin with FF as their first two digits. Multicasts with a link-local scope, like most of the multicast +addresses referenced in this chapter, begin with FF02::/16; the 2 in the fourth hex digit identifies the scope as link-local. A fourth digit of hex 5 identifies the broadcast as having a site local scope, with those multicasts beginning with FF05::/16. + +For reference, Table 3-9 lists some of the more commonly seen IPv6 multicast addresses. Of particular interest are the addresses chosen for use by Routing Information Protocol (RIP), Open Shortest Path First (OSPF), and Enhanced IGRP (EIGRP), which somewhat mirror the multicast addresses that each protocol uses for IPv4. Note also that all but the last two entries have a link-local scope. + + +Table 3-9 + +Purpose + + +Common Multicast Addresses + +IPv6 Address IPv4 Equivalent + + + +All IPv6 nodes on the link + +All IPv6 routers on the link + +OSPF messages + +RIPv2 messages + +EIGRP messages + +DHCP relay agents (routers that forward to the DHCP server) +DHCP servers (site scope) + +All NTP servers (site scope) + +FF02::1 + +FF02::2 + +FF02::5, FF02::6 + +FF02::9 + +FF02::A + +FF02::1:2 + +FF05::1:3 + +FF05::101 + +Subnet broadcast address + +— + +224.0.0.5, 224.0.0.6 + +224.0.0.9 + +224.0.0.10 + +— + +— + +— + + + + +Layer 2 Addressing Mapping and Duplicate Address Detection + +As with IPv4, any device running IPv6 needs to determine the data link layer address used by devices on the same link. IPv4 uses Address Resolution Protocol (ARP) on LANs and Inverse ARP (InARP) on Frame Relay. IPv6 defines a couple of new protocols that perform the same function. These new functions use ICMPv6 messages and avoid the use of broadcasts, in keeping with IPv6’s avoidance of broadcasts. This section gives a brief explanation of each protocol. + + + + + + + +From the Library of Alexey Evseenko +98 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Neighbor Discovery Protocol for Layer 2 Mapping + +When an IPv6 host or router needs to send a packet to another host or router on the same LAN, the host/router first looks in its neighbor database. This database contains a list of all neighboring IPv6 addresses (addresses on connected links) and their corresponding MAC addresses. If not found, the host or router uses the Neighbor Discovery Protocol (NDP) to dynamically discover the MAC address. + +Figure 3-11 shows a sample of such a process, using the same host and router seen earlier in Figure 3-8. + + +Key Topic + +PC1 R1 + + + +Neighbor Solicitation + +Source = PC1 IPv6 Address +Dest = Solicited Node Mcast of R1 Question = What’s Your Datalink Address? + +Neighbor Advertisement + +Source = R1’s IPv6 Address Dest = PC1’s IPv6 Address Answer = MAC 0013.197B.5004 + +Figure 3-11 Neighbor Discovery Protocol + +The process acts like the IPv4 ARP process, just with different details. In this case, PC1 sends a multicast message called a Neighbor Solicitation (NS) Internet Control +Message Protocol (ICMP) message, asking R1 to reply with R1’s MAC address. R1 sends a Neighbor Advertisement (NA) ICMP message, which is unicast back to PC1, listing R1’s MAC address. Now PC1 can build a data-link frame with R1’s MAC listed as the destina-tion address and send encapsulated packets to R1. + +The NS message uses a special multicast destination address called a solicited node mul-ticast address. On any given link, the solicited node multicast address represents all hosts with the same last 24 bits of their IPv6 addresses. By sending packets to the solicited node multicast address, the packet reaches the correct host, but it might also reach a few other hosts—which is fine. (Note that packets sent to a solicited node multicast address have a link-local scope.) + +The solicited node multicast address begins with FF02::1:FF00:0/104. The final 24 bits (6 hex digits) of the address are formed by adding the last 24 bits of the IPv6 address to which the message is being sent. All IPv6 hosts listen for frames sent to their own solic-ited node multicast address, so that when a host or router receives such a multicast, the + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 99 + +host realizes that it should reply. For example, in this case, based on R1’s IPv6 address previously seen in Figure 3-7 + +■ R1’s IPv6 address: 2340:1111:AAAA:1:213:19FF:FE7B:5004 + +■ R1’s solicited node address: FF02::1:FF7B:5004 + + +Note The corresponding Ethernet multicast MAC address would be 0100.5E7B.5004. + + + +Duplicate Address Detection (DAD) + +When an IPv6 interface first learns an IPv6 address, or when the interface begins working after being down for any reason, the interface performs Duplicate Address Detection (DAD). The purpose of this check is to prevent hosts from creating problems by trying to use the same IPv6 address already used by some other host on the link. + +To perform such a function, the interface uses the same NS message shown in Figure 3-11 but with small changes. To check its own IPv6 address, a host sends the NS message to the solicited node multicast address based on its own IPv6 address. If some host sends a reply, listing the same IPv6 address as the source address, the original host has found that a duplicate address exists. + +Inverse Neighbor Discovery + +The ND protocol discussed in this section starts with a known neighbor’s IPv6 address and seeks to discover the link-layer address used by that IPv6 address. On Frame Relay networks, and with some other WAN data-link protocols, the order of discovery is reversed. A router begins with knowledge of the neighbor’s data link layer address and instead needs to dynamically learn the IPv6 address used by that neighbor. + +IPv4 solves this discovery problem on LANs using ARP and the reverse problem over Frame Relay using Inverse ARP (InARP). IPv6 solves the problem on LANs using ND, and now for Frame Relay, IPv6 solves this problem using Inverse Neighbor Discovery (IND). IND, also part of the ICMPv6 protocol suite, defines an Inverse NS (INS) and Inverse NA (INA) message. The INS message lists the known neighbor link-layer address (Data-Link Connection Identifier [DLCI] for Frame Relay), and the INS asks for that neighboring device’s IPv6 addresses. The details inside the INS message include the following: + +■ Source IPv6: IPv6 unicast of sender + +■ Destination IPv6: FF02::1 (all IPv6 hosts multicast) + +■ Link-layer addresses + +■ Request: Please reply with your IPv6 address(es) + + + + + + +From the Library of Alexey Evseenko +100 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The IND reply lists all the IPv6 addresses. As with IPv4, the show frame-relay map com-mand lists the mapping learned from this process. + +Configuring IPv6 Addresses on Cisco Routers + +Most IPv6 implementation plans make use of both static IPv6 address configuration and dynamic configuration options. As is the case with IPv4, the plan assigns infrastructure devices with static addresses, with client hosts using one of the two dynamic methods for address assignment. + +IPv6 addressing includes many more options than IPv4, and as a result, many more con-figuration options exist. A router interface can be configured with a static global unicast IPv6 address, either with or without using the EUI-64 option. Although less likely, a rout-er could be configured to dynamically learn its IPv6 address with either stateful DHCP or stateless autoconfig. The router interface could be configured to either not use a global unicast address, instead relying solely on its link-local address, or to borrow another inter-face’s address using the IPv6 unnumbered feature. + +This section summarizes the address configuration commands and shows several exam-ples of configuration and verification commands for IPv6. To that end, Table 3-10 sum-marizes the IPv6 configuration commands and their meanings. + + +Table 3-10 + +Command + + +Router IOS IPv6 Configuration Command Reference + +Description + + + +ipv6 unicast-routing + +ipv6 cef + + +ipv6 flowset + + +ipv6 address address/length + +ipv6 address prefix/length eui64 + +ipv6 address autoconfig + +ipv6 address dhcp + +ipv6 unnumbered interface-type number + +ipv6 enable + +A global configuration mode command that enables the routing of unicast IPv6 traffic. +A global configuration mode command that enables Cisco Express Forwarding (CEF) for IPv6. +A global configuration mode command that configures flow-label marking in 1280-byte or larger packets sent from the router. +Static configuration of the entire IPv6 unicast address. +Static configuration of the first 64 address bits; the router derives the last 64 bits with EUI-64. +Router uses stateless autoconfig to find an address. +Router uses stateful DHCP to find an address. + +Uses the same IPv6 unicast address as a referenced interface. +Enables IPv6 on the interface, but results in only a link-local address. + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 101 + + + +Command +ipv6 address address link-local + + +ipv6 address address/length anycast + +Description +Overrides the automatically created link-local address. The configured value must conform to the FE80::/10 prefix. +Designates that the unicast address is an anycast address. + + + +Note All the interface subcommands in Table 3-10 enable IPv6 on an interface, which means that a router derives an IPv6 link-local address for the interface. The description shows what the command does in addition to enabling IPv6. + + + +Configuring Static IPv6 Addresses on Routers + +The configuration examples in this section use the internetwork shown in Figure 3-12. The figure shows a diagram that you might see in an implementation plan, with the five IPv6 subnet numbers shown over the five links. The interface ID of each interface is then abbreviated, or shown as EUI-64, as a reminder of whether to configure the entire 128-bit address or to rely on the EUI-64 feature. + +2000:0:0:0::/64 2000:0:0:1::/64 2000:0:0:2::/64 2000:0:0:3::/64 + + +::1 ::1 +f0/0 R1 s0/0/0 + + +eui-64 ::2 +s0/0/1 R2 f0/1 + + +::3 eui-64 +f0/0 R3 f0/1 + +f0/0 eui-64 + + +2000:0:0:4::/64 + +Figure 3-12 Sample IPv6 Address Planning Diagram + +Example 3-1 shows the configuration process on Router R2, which uses EUI-64 on two interfaces and a complete IPv6 address on another. Also, note that the configuration includes the ipv6 unicast-routing global configuration command, which enables the rout-er to route IPv6 traffic. (The addresses can be configured without also configuring ipv6 unicast-routing, but without this command, the router acts more like an IPv6 host, and it will not forward IPv6 packets.) + +Example 3-1 R2’s IPv6 Configuration + +R2# show running-config +! lines omitted for brevity + +interface FastEthernet0/0 +ipv6 address 2000:0:0:4::/64 eui-64 + + + + +From the Library of Alexey Evseenko +102 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +! +interface FastEthernet0/1 +ipv6 address 2000:0:0:2::2/64 +! +interface Serial0/0/1 +ipv6 address 2000:0:0:1::/64 eui-64 +! +! +R2# show ipv6 interface brief +FastEthernet0/0 [up/up] +FE80::213:19FF:FE7B:5004 +2000::4:213:19FF:FE7B:5004 +FastEthernet0/1 [up/up] +FE80::213:19FF:FE7B:5005 + +2000:0:0:2::2 +Serial0/0/0 +unassigned +Serial0/0/1 + + +[administratively down/down] + +[up/up] + +FE80::213:19FF:FE7B:5004 +2000::1:213:19FF:FE7B:5004 + +Serial0/1/0 +unassigned +Serial0/1/1 +unassigned + +[administratively down/down] + +[administratively down/down] + + +R2# show interfaces fa0/0 + +FastEthernet0/0 is up, line protocol is up +Hardware is Gt96k FE, address is 0013.197b.5004 (bia 0013.197b.5004) +MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, +reliability 255/255, txload 1/255, rxload 1/255 +! lines omitted for brevity + +The ipv6 address commands both enable IPv6 on the associated interfaces and define either the prefix (with the EUI-64 option) or the entire address. The show commands listed after the configuration confirm the IPv6 addresses. Of particular note: + +■ All three interfaces now have link-local addresses that begin with FE80. + +■ Fa0/1 has the address exactly as configured. + +■ S0/0/1 and Fa0/0 have the configured prefixes (2000:0:0:1 and 2000:0:0:4, respec-tively), but with EUI-64-derived interface IDs. + +■ S0/0/1 uses Fa0/0’s MAC address (as shown in the show interfaces fa0/0 command) when forming its EUI-64. + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 103 + +On this last point, whenever Cisco IOS needs a MAC address for an interface, and that interface does not have a built-in MAC address, the router uses the MAC address of the lowest-numbered LAN interface on the router—in this case, Fa0/0. The following list shows the derivation of the last 64 bits (16 hexadecimal digits) of R2’s IPv6 interface IDs for its global unicast IPv6 addresses on Fa0/0 and S0/0/1: +Step 1. Use Fa0/0’s MAC address: 0013.197B.5004. + +Step 2. Split and insert FFFE: 0013:19FF:FE7B:5004. + +Step 3. Invert bit 7: Hex 00 = 00000000 binary, flip for 00000010, and convert back to hex 02, resulting in 0213:19FF:FE7B:5004. + +Multicast Groups Joined by IPv6 Router Interfaces + +Next, consider the deeper information held in the show ipv6 interface fa0/0 command output on Router R2, as shown in Example 3-2. Not only does it list the same link-local and global unicast addresses, but it also lists other special addresses as well. + +Example 3-2 All IPv6 Addresses on an Interface + +R2# show ipv6 interface fa0/0 +FastEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::213:19FF:FE7B:5004 +No Virtual link-local address(es): +Global unicast address(es): +2000::4:213:19FF:FE7B:5004, subnet is 2000:0:0:4::/64 [EUI] +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:FF7B:5004 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 22807) +ND advertised reachable time is 0 (unspecified) +ND advertised retransmit interval is 0 (unspecified) +ND router advertisements are sent every 200 seconds +ND router advertisements live for 1800 seconds +ND advertised default router preference is Medium +Hosts use stateless autoconfig for addresses. + +The three joined multicast groups should be somewhat familiar after reading this chapter. The first multicast address, FF02::1, represents all IPv6 devices, so router interfaces must listen for packets sent to this address. FF02::2 represents all IPv6 routers, so again, R2 must listen for packets sent to this address. Finally, the FF02::1:FF beginning value is the + + + + +From the Library of Alexey Evseenko +104 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +range for an address’s solicited node multicast address, used by several functions, includ-ing Duplicate Address Detection (DAD) and Neighbor Discovery (ND). + +Connected Routes and Neighbors + +The third example shows some new concepts with the IP routing table. Example +3-3 shows R2’s current IPv6 routing table that results from the configuration shown in Example 3-1. Note that no IPv6 routing protocols have been configured, and no static routes have been configured. + +Example 3-3 Connected and Local IPv6 Routes + +R2# show ipv6 route +IPv6 Routing Table - Default - 7 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, M - MIPv6, R - RIP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external +O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +C 2000:0:0:1::/64 [0/0] +via Serial0/0/1, directly connected +L 2000::1:213:19FF:FE7B:5004/128 [0/0] +via Serial0/0/1, receive +C 2000:0:0:2::/64 [0/0] +via FastEthernet0/1, directly connected +L 2000:0:0:2::2/128 [0/0] +via FastEthernet0/1, receive +C 2000:0:0:4::/64 [0/0] +via FastEthernet0/0, directly connected +L 2000::4:213:19FF:FE7B:5004/128 [0/0] +via FastEthernet0/0, receive +L FF00::/8 [0/0] +via Null0, receive + +First, the IPv6 routing table lists the expected connected and local routes. The connected routes occur for any unicast IPv6 addresses on the interface that happen to have more than link-local scope. So, R2 has routes for subnets 2000:0:0:1::/64, 2000:0:0:2::/64, and 2000:0:0:4::/64, but no connected subnets related to R2’s link-local addresses. The local routes, all /128 routes, are essentially host routes for the router’s unicast IPv6 addresses. These local routes allow the router to more efficiently process packets directed to the router itself, as compared to packets directed toward connected subnets. + +The IPv6 Neighbor Table + +The IPv6 neighbor table replaces the IPv4 ARP table, listing the MAC address of other devices that share the same link. Example 3-4 shows a debug that lists messages during + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 105 + +the NDP process, a ping to R3’s Fa0/0 IPv6 address, and the resulting neighbor table entries on R2. + +Example 3-4 Creating Entries and Displaying the Contents of R2’s IPv6 Neighbor Table + +R2# debug ipv6 nd +ICMP Neighbor Discovery events debugging is on +R2# ping 2000:0:0:2::3 + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2000:0:0:2::3, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/4 ms +R2# +*Sep 2 17:07:25.807: ICMPv6-ND: DELETE -> INCMP: 2000:0:0:2::3 +*Sep 2 17:07:25.807: ICMPv6-ND: Sending NS for 2000:0:0:2::3 on FastEthernet0/1 +*Sep 2 17:07:25.807: ICMPv6-ND: Resolving next hop 2000:0:0:2::3 on interface +FastEthernet0/1 +*Sep 2 17:07:25.811: ICMPv6-ND: Received NA for 2000:0:0:2::3 on FastEthernet0/1 +from 2000:0:0:2::3 +*Sep 2 17:07:25.811: ICMPv6-ND: Neighbor 2000:0:0:2::3 on FastEthernet0/1 : LLA +0013.197b.6588 + +R2# undebug all +All possible debugging has been turned off + +R2# show ipv6 neighbors +IPv6 Address Age Link-layer Addr State Interface + +2000:0:0:2::3 +FE80::213:19FF:FE7B:6588 + +0 0013.197b.6588 +0 0013.197b.6588 + +REACH Fa0/1 +REACH Fa0/1 + + +The example shows the entire NDP process by which R2 discovers R3’s Fa0/0 MAC address. The example begins with a debug ipv6 nd command, which tells R2 to issue messages related to NDP messages. The ping 2000:0:0:2::3 command that follows tells Cisco IOS to use IPv6 to ping R3’s F0/0 address; however, R2 does not know the corre-sponding MAC address. The debug output that follows shows R2 sending an NS, with R3 replying with an NA message, listing R3’s MAC address. + +The example ends with the output of the show ipv6 neighbor command, which lists the neighbor table entries for both of R3’s IPv6 addresses. + +Stateless Autoconfiguration +The final example in this section demonstrates stateless autoconfiguration using two routers, R2 and R3. In Example 3-5, R2’s Fa0/1 configuration will be changed, using the ipv6 address autoconfig subcommand on that interface. This tells R2 to use the stateless autoconfig process, with R2 learning its prefix from Router R3. R2 then builds the rest of its IPv6 address using EUI-64. + + + +From the Library of Alexey Evseenko +106 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 3-5 Using Stateless Autoconfig on Router R2 + +R2# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)# interface fa0/1 +R2(config-if)# no ipv6 address +R2(config-if)# ipv6 address autoconfig +R2(config-if)# ^Z + +R2# show ipv6 interface brief +FastEthernet0/0 [up/up] +FE80::213:19FF:FE7B:5004 +2000::4:213:19FF:FE7B:5004 +FastEthernet0/1 [up/up] +FE80::213:19FF:FE7B:5005 +2000::2:213:19FF:FE7B:5005 + +Serial0/0/0 +unassigned +Serial0/0/1 + +[administratively down/down] + +[up/up] + +FE80::213:19FF:FE7B:5004 +2000::1:213:19FF:FE7B:5004 + +Serial0/1/0 +unassigned +Serial0/1/1 +unassigned + +[administratively down/down] + +[administratively down/down] + + +R2# show ipv6 router +Router FE80::213:19FF:FE7B:6588 on FastEthernet0/1, last update 0 min +Hops 64, Lifetime 1800 sec, AddrFlag=0, OtherFlag=0, MTU=1500 +HomeAgentFlag=0, Preference=Medium +Reachable time 0 (unspecified), Retransmit time 0 (unspecified) +Prefix 2000:0:0:2::/64 onlink autoconfig +Valid lifetime 2592000, preferred lifetime 604800 + +Starting with the configuration, the no ipv6 address command actually removes all con-figured IPv6 addresses from the interface and also disables IPv6 on interface Fa0/1. Then, the ipv6 address autoconfig command again enables IPv6 on Fa0/1 and tells R2 to use stateless autoconfig. + +The show commands confirm that R2 does indeed learn its IPv6 address: 2000:0:0:2:0213:19FF:FE7B:5005. The show ipv6 router command, which lists the cached contents of any received RA messages, lists the information received from R3’s RA message, including R3’s link-local address (used to identify the routers) and R3’s advertised prefix (2000:0:0:2::/64). + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 107 + +RIP Next Generation (RIPng) + +To support IPv6, all the IPv4 routing protocols had to go through varying degrees of changes, with the most obvious being that each had to be changed to support longer addresses and prefixes. The actual messages used to send and receive routing information have changed in some cases, using IPv6 headers instead of IPv4 headers, and using IPv6 addresses in those headers. In particular, like their IPv4 versions, each IPv6 IGP uses IPv6 multicast addresses. For example, RIPng sends routing updates to the IPv6 destination address FF02::9 instead of the old RIPv2 IPv4 224.0.0.9 address. Also, the routing proto-cols typically advertise their link local IP address as the next hop in a route. + +Even with these changes, each IPv6 IGP has more similarities than differences compared to its respective IPv4 cousin. For example, RIPng, based on RIPv2, is still a distance vec-tor protocol, with hop count as the metric and 15 hops as the longest valid route (16 is infinity). OSPF version 3 (OSPFv3), created specifically to support IPv6, uses link-state logic like OSPFv2, uses cost as the metric, and retains the link-state advertisement (LSA) types—but there are some changes to how the LSAs work. However, most of the core OSPF operational concepts remain the same. This section examines RIPng. Upcoming chapters examine OSPFv3 and EIGRP for IPv6. + +Table 3-11 lists the IPv6 routing protocols and their new RFCs (as appropriate). + + +Table 3-11 Updates to Routing Protocols for IPv6 + + +Routing Protocol +RIPng + +OSPFv3 + +EIGRP for IPv6 + +MP-BGP4 + +Full Name +RIP next generation + +OSPF version 3 + +EIGRP for IPv6 + +Multiprotocol BGP-4 + +RFC +2080 + +5340 + +Proprietary + +4760 + + + +Routing Information Protocol (RIP) began life as one of the earliest efforts in the field of dynamic IP routing protocols. It eventually became the first dynamic routing protocol for the emerging IP protocol back in the 1970s. Later, in the mid-1990s, the RIP version 2 (RIPv2) specifications enhanced RIP, with the original version becoming known as RIP version 1, or simply RIPv1. + +Also in the mid-1990s, the process of defining IPv6 was drawing toward completion, at least for the original IPv6 standards. To support IPv6, the IETF committees defined a new version of RIP to support IPv6. But rather than number this updated flavor of RIP as RIP version 3, the creators chose to number this new protocol as version 1, treating it like a new protocol. However, no one bothered to put “version 1” in the name, simply calling it RIP next generation (RIPng), or even simply RIP. To date, no new version of RIPng has been defined, making the original RIPng still the most recent version of the protocol. + + + + + + +From the Library of Alexey Evseenko +108 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note For you Star Trek TV show fans, yes, the name came in part from Star Trek: The Next Generation. + + + +RIPng: Theory and Comparisons to RIPv2 + +The RIPng RFC states that the protocol uses many of the same concepts and conventions as the original RIPv1 specification, also drawing on some RIPv2 concepts. Table 3-12 lists +a variety of facts about RIPv2 and RIPng. + + +Key Table 3-12 Comparing RIPv2 to RIPng +Topic Feature RIPv2 RIPng + + +Advertises routes for... + +RIP messages use these Layer 3/4 protocols + +UDP port + +Use distance vector + +Default administrative distance + +Supports VLSM + +Can perform automatic summarization + +Uses Split Horizon + +Uses Poison Reverse + +30-second periodic full updates + +Uses triggered updates + +Uses Hop Count metric + +Metric meaning infinity + +Supports route tags + +Multicast Update destination + +Authentication + +IPv4 + +IPv4, UDP + +520 + +Yes + +120 + +Yes + +Yes + +Yes + +Yes + +Yes + +Yes + +Yes + +16 + +Yes + +224.0.0.9 + +RIP-specific + +IPv6 + +IPv6, UDP + +521 + +Yes + +120 + +Yes + +— + +Yes + +Yes + +Yes + +Yes + +Yes + +16 + +Yes + +FF02::9 + +Uses IPv6 AH/ESP + + + +The overall operation of RIPng closely matches RIPv2. In both, routers send periodic full updates with all routes, except for routes omitted because of Split Horizon rules. No neighbor relationships occur. The continuing periodic Updates, on a slightly vari-able 30-second period, also serve the purpose of confirming that the neighboring router still works. The metrics work exactly the same. When a router ceases to see a route in received updates, ceases to receive updates, or receives a poisoned (metric 16) route, it reacts to converge, but relatively slowly compared to EIGRP and OSPF. + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 109 + +Some differences relate specifically to IPv6. First, the messages themselves list IPv6 prefixes/lengths, rather than subnet/mask. In RIPv1 and RIPv2, RIP-encapsulated RIP Update messages inside an IPv4 and UDP header; with IPv6, the encapsulation uses IPv6 packets, again with a UDP header. Some small differences in the Update message format exist as well, with the most obvious difference being that the Updates list IPv6 prefixes and prefix lengths. + +The last difference of note is that because IPv6 supports authentication using the IPsec Authentication Header (AH), RIPng does not natively support authentication, instead relying on IPsec. + +Configuring RIPng + +RIPng uses a new command style for the basic configuration, but most of the optional features and verification commands look much like the commands used for RIP for IPv4. This section first takes a look at the basic RIPng configuration, accepting as many defaults as possible. + +The big difference between RIPv2 and RIPng configuration is that RIPng discards the age-old RIP network command in deference to the ipv6 rip name enable interface sub-command, which enables RIPng on an interface. Another difference relates to the routing of IPv4 and IPv6: Cisco IOS routes IPv4 by default (because of a default global configu-ration command of ip routing), but Cisco IOS does not route IPv6 by default (a default of no ipv6 unicast-routing). Finally, RIPng allows multiple RIPng processes on a single router, so Cisco IOS requires that each RIPng process is given a text name that identifies each RIPng process for that one router—another difference compared to RIPv2. + +The following list shows the basic configuration steps for RIPng, including steps to enable IPv6 routing and enabling IPv6 on the interfaces: + +Step 1. Key +Topic Step 2. + + + +Step 3. + + +Enable IPv6 routing with the ipv6 unicast-routing global command. + +Enable RIPng using the ipv6 router rip name global configuration command. The name must be unique on a router but does not need to match on neigh-boring routers. + +Enable IPv6 on the interface, typically with one of these two methods: + + +■ Configure an IPv6 unicast address on each interface using the ipv6 address address/prefix-length [eui-64] interface command. + +■ Configure the ipv6 enable command, which enables IPv6 and causes the router to derive its link-local address. +Step 4. Enable RIP on the interface with the ipv6 rip name enable interface subcom-mand (where the name matches the ipv6 router rip name global configuration command). + +The list includes just a few straightforward configuration commands, but a few subtle interactions also exist. The list shows steps related directly to RIPng (Steps 2 and 4), plus + + + + + +From the Library of Alexey Evseenko +110 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +other steps related to making IPv6 itself work (Steps 1 and 3). The list also pairs two sets of dependent steps with each other, as follows: + +■ Step 2 relies on Step 1, because Cisco IOS rejects the command at Step 2 (ipv6 rout-er rip name) if the command at Step 1 (ipv6 unicast-routing) has been omitted. + +■ Step 4 relies on Step 3, because Cisco IOS rejects the command at Step 4 if IPv6 has not yet been enabled on the interface. + +Finally, note that although the ipv6 rip process-name enable interface subcommand (Step 4) refers to the process name configured at Step 2 (the ipv6 router rip process-name command), Cisco IOS creates the RIP process in reaction to the ipv6 rip process-name enable interface subcommand if that RIPng process name does not yet exist. In other words, if you followed the previous steps in order, but forgot to do Step 2, the com-mand at Step 4 causes Cisco IOS to automatically create the command at Step 2. + +As with RIPv1 and RIPv2, for any interface on which RIPng has been enabled, the RIP process does three main actions: +1. It starts sending RIP updates on that interface. + +2. It also starts processing any RIP updates received on that interface. + +3. Finally, it advertises the connected routes on that interface. In particular, because IPv6 allows the configuration of multiple IPv6 unicast addresses on an interface, RIP advertises most IPv6 unicast prefixes associated with the interface. The notable exceptions are that RIP does not advertise any link-local addresses, nor does RIP advertise the local host routes—routes with a /128 prefix length—created for each interface IPv6 address. In short, RIP advertises all routable subnets associated with the interface. + +Figure 3-13 shows a sample internetwork with IPv6 global unicast IPv6 subnets displayed. + +Subnet 2034::/64 + +SW1 + +Fa0/0 S0/0/0.1 R3 +S0/0/0.2 + +S0/0/0.1 +Fa0/0 +R4 +S0/0/0.2 + + + + +S0/0.1 +Fa0/0 + + +Subnet 2013::/64 + +Subnet 2014::/64 + + +Subnet 2015::/64 + +Subnet 2023::/64 + + +Subnet 2024::/64 + + +Fa0/0 R1 Fa0/1 +Fa0/0.1 + + + + + +Fa0/0.1 +Fa0/0 + + +Fa0/1 + +Fa0/2 Gi0/1 + + + + + + +Fa0/1 Gi0/1 + + + + + +Data SW3 Center +Subnet 2099::/64 + + + +R5 S0/0.2 Subnet 2025::/64 + +Subnet 2005::/64 + + +R2 Fa0/1 Fa0/2 +SW2 + + +Figure 3-13 Sample Internetwork for IPv6 Routing Protocol Configuration + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 111 + +The sample internetwork uses addressing values that are both memorable and make for shorter IPv6 addresses when abbreviated. All the subnets use /64 prefix length, with quartets 2, 3, and 4 composed of all 0 values. The interface ID portion of each address uses all hex 0s in the first three quartets (quartets 5, 6, and 7 in the overall address), with the final digit in the final quartet used to identify each router. This last digit matches the name of each router in most cases. + +For example, all of R1’s IPv6 addresses’ last four octets are 0000:0000:0000:0001. R1’s S0/0/0.3 subinterface, which connects with a permanent virtual circuit (PVC) to Router R3, uses a prefix of 2003:0000:0000:0000::/64, making the entire IPv6 address on this interface, when abbreviated, 2003::1/64—a convenient value for sifting through all the output in the upcoming examples. + +Example 3-6 shows the RIPng configuration on Router R1 in this design. The RIP process name is fred . + +Example 3-6 Configuring IPv6 Routing and Routing Protocols on R1 + +R1# show running-config +! The output is edited to remove lines not pertinent to this example. +! Next, step 1's task: enable IPv6 routing +ipv6 unicast-routing +! +! Next, on 5 interfaces, steps 3 and 4: configuring an IPv6 address, +! and enable RIPng, process "fred". +interface FastEthernet0/0.1 +ipv6 address 2012::1/64 +ipv6 rip fred enable +! +interface FastEthernet0/0.2 +ipv6 address 2017::1/64 +ipv6 rip fred enable +! +interface FastEthernet0/1.18 +ipv6 address 2018::1/64 +ipv6 rip fred enable +! +interface Serial0/0/0.3 +ipv6 address 2013::1/64 +ipv6 rip fred enable +! +interface Serial0/0/0.4 +ipv6 address 2014::1/64 +ipv6 rip fred enable +! +interface Serial0/0/0.5 +ipv6 address 2015::1/64 +ipv6 rip fred enable + + + + +From the Library of Alexey Evseenko +112 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +! +! Next, step 2's task, creating the RIPng process named "fred" +ipv6 router rip fred + + +Verifying RIPng + +The show commands related to RIPng have the same general kinds of information as seen with RIPv2. However, some of the commands used to get to the same piece of informa-tion differ, and of course, some obvious differences exist because of the different IPv6 address structure. Table 3-13 lists a cross-reference comparing all commands related to RIP that begin with either show ip or show ipv6. It also lists the similar debug commands used to display RIP routing information. + +Table 3-13 Comparing Verification Commands: show ip and show ipv6 + + +Function +All routes + +All RIP-learned routes + +Details on the routes for a specific prefix + +Interfaces on which RIP is enabled + +RIP timers + +List of routing information sources + +Debug that displays sent and received updates + +IPv4 +... route + +... route rip + +... route subnet mask + +... protocols + +... protocols + +... protocols + +debug ip rip + +IPv6 +... route + +... route rip + +... route prefix/length + +... protocols + +... rip + +... rip next-hops + +debug ipv6 rip + + + +The most notable differences occur with the information seen with IPv4 in the show ip protocols command. The show ip protocols command displays a wide variety of infor-mation for IPv4 RIP, whereas the IPv6 commands spread the information over a couple +of different commands, as listed in Table 3-13. Example 3-7 shows a sampling of the com-mands, taken from Router R3 in Figure 3-13. The explanatory comments are listed within the example in this case. Note that Router R3 used a RIPng process name of barney. + +Example 3-7 IPv6 RIPng show Commands + +! On R3, process name "barney" has two current routes to reach the +! datacenter prefix 2099::/64. + +R3# show ipv6 route 2099::/64 +Routing entry for 2099::/64 +Known via "rip barney ", distance 120, metric 3 +Route count is 2/2, share count 0 +Routing paths: +FE80::22FF:FE22:2222, Serial0/0/0.2 + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 113 + +Last updated 00:27:12 ago +FE80::11FF:FE11:1111, Serial0/0/0.1 +Last updated 00:27:10 ago + +! Note that the next command lists only RIP-learned routes. It lists +! two next-hops for 2099::64. Note the next-hop information lists +! link-local addresses. +R3# show ipv6 route rip +IPv6 Routing Table - Default - 19 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, M - MIPv6, R - RIP , I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external +O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +R 2005::/64 [120/3] +via FE80::11FF:FE11:1111, Serial0/0/0.1 +via FE80::22FF:FE22:2222, Serial0/0/0.2 +R 2012::/64 [120/2] +via FE80::11FF:FE11:1111, Serial0/0/0.1 +via FE80::22FF:FE22:2222, Serial0/0/0.2 + +! lines omitted for brevity... +R 2099::/64 [120/3] +via FE80::22FF:FE22:2222, Serial0/0/0.2 +via FE80::11FF:FE11:1111, Serial0/0/0.1 + +! Unlike show ip protocols, show ipv6 protocols displays little info. +R3# show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "rip barney" +Interfaces: +Serial0/0/0.2 +Serial0/0/0.1 +FastEthernet0/0 +Redistribution: +None + +! This command lists the timers displayed for RIPv2 with show ip protocols. +R3# show ipv6 rip +RIP process "barney", port 521, multicast-group FF02::9, pid 258 +Administrative distance is 120. Maximum paths is 16 +Updates every 30 seconds, expire after 180 +Holddown lasts 0 seconds, garbage collect after 120 +Split horizon is on; poison reverse is off +Default routes are not generated + + + + +From the Library of Alexey Evseenko +114 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Periodic updates 57, trigger updates 10 +Interfaces: +Serial0/0/0.2 +Serial0/0/0.1 +FastEthernet0/0 +Redistribution: +None + +! This command lists the equivalent of the information in the +! show ip protocols commands' "Routing Information Sources" heading. +! Note the link-local addresses are listed. +R3# show ipv6 rip next-hops +RIP process "barney", Next Hops +FE80::11FF:FE11:1111/Serial0/0/0.1 [9 paths] +FE80::44FF:FE44:4444/FastEthernet0/0 [3 paths] +FE80::22FF:FE22:2222/Serial0/0/0.2 [9 paths] + +Beyond the information emphasized in the comments inside the example, the next-hop IPv6 addresses in the example need to be scrutinized. RIPng uses the link-local IPv6 address as the next-hop IP address. (Reminder: link-local addresses begin with FE80.) + +To discover which routers use which link-local addresses, and to make it easier to work with link-local addresses, you have a couple of options. First, you can set the MAC address of each LAN interface to something noticeable. For Example 3-7, the routers each used a recognizable MAC: R1 used 0200.1111.1111, R2 used 0200.2222.2222, and so on. Alternatively, you can just configure the link-local address with the ipv6 address com-mand, using the link-local keyword at the end, and make each link-local address be more recognizable. Regardless, to find the router whose link-local address is listed in the IPv6 routing table, the show cdp entry name command can be useful, because it lists both the IPv4 and IPv6 addresses, including the neighbor’s link-local address. + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 115 + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 3-14 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an imple-mentation plan, what implementation options come to mind? You should write a general description; specific configuration commands are not required. + +Table 3-14 Design Review + + +Design Goal + +An IPv6 design suggests that all client hosts should dynamically learn their IPv6 addresses. Which tools can be used? (2) + +Possible Implementation Choices Covered in This Chapter + +A plan shows the use of stateless autoconfiguration. What functions should we expect the IPv6 DHCP server to perform? + + + +Implementation Plan Peer Review Table + +Table 3-15 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + + + + + + + + + +From the Library of Alexey Evseenko +116 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 3-15 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answers +An implementation plan states that router IPv6 addresses should be assigned as obvious values, using the lowest numbers in the range per each assigned prefix. What configuration methods could be used to configure these low address values? +A plan calls for the use of stateless autoconfig for client hosts. What must be configured on the routers to support this process? +A RIPng implementation plan lists two neighboring routers with unicast IPv6 addresses 2000::1/64 and 2001::2/64, respectively. Will this cause a neighborship issue? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own implementation plan, list in Table 3-16 all configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 3-16 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Globally enable the routing of IPv6 unicast traffic. + +Globally enable Cisco Express Forwarding (CEF) for IPv6. + +Configure flow-label marking in 1280-byte or larger packets sent by the router. + +Configure the full global unicast address on an interface. +Configure the unicast IPv6 prefix on an interface, and let the router add the inter-face ID. +Configure an interface to find its unicast IPv6 address using stateless autoconfig. + + + + +From the Library of Alexey Evseenko +Chapter 3: IPv6 Review and RIPng 117 + + +Feature Configuration Commands/Notes +Configure an interface to enable IPv6 and use another interface’s IPv6 address as needed. +Enable IPv6 on an interface and do not configure a unicast IPv6 address. +Configure the link-local address of an interface. +Assuming that IPv6 routing and IPv6 addresses have already been configured, configure RIPng. + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own verification plan, list in Table 3-17 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to be able to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Note Some of the entries in this table might not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + +Table 3-17 Verification Plan Memory Drill + +Information Needed Commands +All IPv6 routes + +A single line per IPv6 address + +Detailed information about IPv6 on an interface, including multicast addresses +The MAC address used by an interface + +The MAC addresses of neighboring IPv6 hosts +The information learned from another router in an RA message +All RIP-learned IPv6 routes + +All next-hop IPv6 addresses used by RIP routes +The interfaces on which RIP is enabled + + + + +From the Library of Alexey Evseenko +118 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 3-18 lists a reference of these key topics and the page numbers on which each is found. + +Table 3-18 Key Topics for Chapter 3 +Key +Topic Key Topic Element Description Page Number + + +Figure 3-1 + +List + +List + +Figure 3-3 + +List + +Figure 3-5 + +List + +Figure 3-8 + +Table 3-7 + +List + +Figure 3-10 + +Table 3-8 + +Figure 3-11 + +Table 3-12 + +List + +Conceptual View of IPv6 Global Routes 78 + +Rules for abbreviating IPv6 addresses 79 + +Rules about how to write IPv6 prefixes 81 + +Example IPv6 Prefix Assignment in the Internet 83 + +IPv6 subnetting process 85 + +Company1—Needs Four Subnets 85 + +Three steps used by the stateless autoconfig feature 89 + +IPv6 Address Format with Interface ID and EUI-64 91 + +Comparing Stateless and Stateful DHCPv6 Services 92 + +IPv6 address types (unicast, multicast, and anycast) 93 + +Link Local Address Format 96 + +Common IPv6 Unicast Address Types 96 + +Neighbor Discovery Protocol 98 + +Comparing RIPv2 to RIPng 108 + +Configuration steps for RIPng 109 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +global unicast address, link-local address, unique local address, stateful DHCP, state-less DHCP, stateless autoconfig, Neighbor Discovery Protocol (NDP), Neighbor Solicitation (NS), Neighbor Advertisement (NA), Router Solicitation (RS), Router Advertisement (RA), solicited node multicast address, Duplicate Address Detection (DAD), Inverse Neighbor Discovery, RIP next generation (RIPng) + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP ROUTE exam: + +■ EIGRP Fundamentals: This section reviews the EIGRP concepts, configuration, and verification commands covered in the CCNA curriculum. +■ EIGRP Neighborships: This section discusses a variety of features that impact when a router attempts to form EIGRP neighbor relationships +(neighborships), what must be true for those neigh-borships to work, and what might prevent those neighborships. +■ Neighborships over WANs: This section examines the typical usage of EIGRP neighborships over vari-ous types of WAN technologies. + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 4 + + + + + + +Fundamental EIGRP Concepts + + +Enhanced Interior Gateway Routing Protocol (EIGRP) is configured with a few relatively simple commands. In fact, for most any size network, you could go to every router, enter the router eigrp 1 command, followed by one or more network net-id subcommands (one for each classful network to which the router is connected), and EIGRP would likely work, and work very well, with no other configuration. + +In spite of that apparent simplicity, here you sit beginning the first of four chapters of EIGRP coverage in this book. Many reasons exist for the amount of EIGRP material included here. First, EIGRP includes many optional configuration features that you need to both understand and master for the CCNP ROUTE exam. Many of these features require a solid understanding of EIGRP internals as well—a topic that can be conve-niently ignored if you just do the minimal configuration, but something very important to planning, implementing, and optimizing a medium/large enterprise network. + +Another reason for the depth of EIGRP coverage in this book is a fundamental change in the philosophy of the CCNP exams, as compared with earlier CCNP exam versions. +Cisco has increased the focus on planning for the implementation and verification of new network designs. The bar has been raised, and in a way that is consistent with typical engineering jobs. Not only do you need to understand all the EIGRP features, but you also need to be able to look at a set of design requirements, and from that decide which EIGRP configuration settings could be useful—and which are not useful. You must also be able to direct others as to what verification steps would tell them if the implementa-tion worked or not, rather than just relying on typing a ? and looking around for that little piece of information you know exists somewhere. + +This chapter begins with the “EIGRP Fundamentals” section, which is a review of the core prerequisite facts about EIGRP. Following the review, the chapter examines EIGRP neighbor relationships, including a variety of configuration commands that impact neigh-bor relationships, and the verification commands that you can use to confirm how well EIGRP neighbors work. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz enables you to assess whether you should read the entire chapter. If you miss no more than one of these seven self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 4-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions covering the material in those headings so that you can assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + + + +From the Library of Alexey Evseenko +122 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 4-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +EIGRP Fundamentals + +EIGRP Neighborships + +Neighborships over WANs + +Questions +1, 2 + +3–6 + +7 + + + +1. A router has been configured with the commands router eigrp 9 and network 172.16.1.0 0.0.0.255. No other EIGRP-related commands have been configured. The answers list the IP addresses that could be assigned to this router’s Fa0/0 interface. Which answers list an IP address/prefix length that would cause the router to enable EIGRP on Fa0/0? (Choose two answers.) +a. 172.16.0.1/23 + +b. 172.16.1.1/26 + +c. 172.16.1.1/24 + +d. 172.16.0.255/23 + +e. None of the other answers are correct. + +2. Router R1 has working interfaces S0/0, S0/1, and S0/2, with IP address/prefix combi-nations of 10.10.10.1/24, 10.10.11.2/24, and 10.10.12.3/22. R1’s configuration includes the commands router eigrp 9 and network 10.0.0.0. The show ip eigrp interfaces command lists S0/0 and S0/1 in the command output, but not S0/2. Which answer gives a possible reason for the omission? +a. R1 has EIGRP neighbors reachable through S0/0 and S0/1, but not through S0/2, so it is not included. + +b. S0/2 might currently be in a state other than up/up. + +c. The network 10.0.0.0 command requires the use of mask 255.0.0.0 because of EIGRP being classful by default. + +d. S0/2 might be configured as a passive interface. + +3. Routers R1 and R2 are EIGRP neighbors using their Fa0/0 interfaces, respectively. An engineer adds the ip hello-interval eigrp 9 6 command to R1’s Fa0/0 configuration. Which of the following is true regarding the results from this change? +a. The show ip eigrp neighbors command on R1 lists the revised Hello timer. + +b. The show ip eigrp interfaces command on R1 lists the revised Hello timer. + +c. The R1-R2 neighborship fails because of a Hello timer mismatch. + +d. The show ip eigrp interfaces detail command on R1 lists the revised Hello timer. + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 123 + +4. Router R1 has been configured with the commands router eigrp 9 and network 172.16.2.0 0.0.0.255, with no other current EIGRP configuration. R1’s (working) Fa0/0 interface has been configured with IP address 172.16.2.2/26. R1 has found three EIGRP neighbors reachable through interface Fa0/0, including the router with IP address 172.16.2.20. When the engineer attempts to add the neighbor +172.16.2.20 fa0/0 command in EIGRP configuration mode, which of the following occurs? +a. Fa0/0 fails. + +b. The command is rejected. + +c. The existing three neighbors fail. + +d. The neighborship with 172.16.2.20 fails and then reestablishes. + +e. None of the other answers is correct. + +5. Which of the following settings could prevent two potential EIGRP neighbors from becoming neighbors? (Choose two answers.) + +a. The interface used by one router to connect to the other router is passive in the EIGRP process. + +b. Duplicate EIGRP router IDs. + +c. Mismatched Hold Timers. + +d. IP addresses of 10.1.1.1/24 and 10.2.2.2/24, respectively. + +6. An engineer has added the following configuration snippet to an implementation planning document. The configuration will be added to Router R1, whose Fa0/0 interface connects to a LAN to which Routers R2 and R3 also connect. R2 and R3 are already EIGRP neighbors with each other. Assuming that the snippet shows all commands on R1 related to EIGRP authentication, which answer lists an appropriate comment to be made during the implementation plan peer review? +key chain fred +key 3 +key-string whehew +interface fa0/0 +ip authentication key-chain eigrp 9 fred + +a. The configuration is missing one authentication-related configuration command. + +b. The configuration is missing two authentication-related configuration commands. + +c. Authentication type 9 is not supported; type 5 should be used instead. + +d. The key numbers must begin with key 1, so change the key 3 command to key 1. + + + + + + +From the Library of Alexey Evseenko +124 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +7. A company has a Frame Relay WAN with one central-site router and 100 branch office routers. A partial mesh of PVCs exists: one PVC between the central site and each of the 100 branch routers. Which of the following could be true about the number of EIGRP neighborships? +a. A partial mesh totaling 100: one between the central-site router and each of the 100 branches. + +b. A full mesh — (101 * 100) / 2 = 5050 — One neighborship between each pair of routers. + +c. 101 — One between each router (including the central site) and its nearby PE router. + +d. None of the answers is correct. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 125 + +Foundation Topics + + +EIGRP Fundamentals + +All the CCNP exams consider CCNA materials as prerequisites. So this book also assumes that the reader is already familiar with CCNA topics. However, the CCNP exams do test on features that overlap with CCNA. Additionally, most people forget some details along the way. Therefore, this section reviews the CCNA-level topics as a brief refresher. + +To that end, this section begins with a review of EIGRP configuration using only the router eigrp and network commands. Following that, the next section details the key fields used to verify that EIGRP is working. Finally, the last part of this introduction sum-marizes the basic EIGRP internals behind this initial simple example. + +Configuration Review + +Cisco IOS uses the router eigrp asn command (where asn is an autonomous system num-ber [ASN]), plus one or more network net-id wildcard-mask subcommands, to enable EIGRP on the router and on router interfaces. The rules for these commands are as follows: + +1. Key +Topic +2. + + +Neighboring routers’ router eigrp asn commands must be configured with the same ASN parameter to become neighbors. + +Cisco IOS enables only EIGRP on interfaces matched by an EIGRP network com- +mand. When enabled, the router does the following: + + +a. Attempts to discover EIGRP neighbors on that interface by sending multicast EIGRP Hello messages +b. Advertises to other neighbors about the subnet connected to the interface +3. If no wildcard mask is configured on the EIGRP network command, the command’s single parameter should be a classful network number (in other words, a class A, B, or C network number). +4. If no wildcard mask is configured on the EIGRP network command, the command enables EIGRP on all of that router’s interfaces directly connected to the configured classful network. +5. If the network command includes a wildcard mask, the router performs access con-trol list (ACL) logic when comparing the net-id configured in the network command with each interface’s IP address, using the configured wildcard mask as an ACL wild-card mask. + +Example 4-1 shows a sample configuration for each router in Figure 4-1, with several vari-ations in the network commands to make the details in the preceding list more obvious. + + + + + +From the Library of Alexey Evseenko +126 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Fa0/0 +1.1/24 R1 + +S0/0/0 12.1/30 + +Fa0/1 192.168.9.99/28 + +S0/0/1 13.1/30 + + + + + + + + +12.2/30 S0/0/1 + +13.2/30 S0/0/0 + + + +Fa0/1 222.2/27 + +S0/0/0 R2 23.2/30 +Fa0/0 +2.2/25 + + +S0/0/1 23.1/30 R3 +Fa0/0 +3.3/26 + + + + + + +Note: All IP addresses begin with 10.1 unless otherwise noted. + +Figure 4-1 Three-Router Internetwork + +Example 4-1 EIGRP Configuration on Routers R1, R2, and R3 + +! On Router R1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +router eigrp 1 +network 10.0.0.0 +network 192.168.9.0 + +! On Router R2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +router eigrp 1 +network 10.1.0.0 0.0.31.255 +network 10.1.2.2 0.0.0.0 + +! On Router R3: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +router eigrp 1 +network 10.1.0.0 0.0.255.255 + +First, note that all three routers use the router eigrp 1 command, so all three routers’ ASN values match. + +Next, consider the two network commands on R1. The network 10.0.0.0 command, without a wildcard-mask parameter, means that R1 matches all interfaces in class A network 10.0.0.0—which in this case means R1’s Fa0/0, S0/0/0, and S0/0/1 interfaces. The network 192.168.9.0 command, again without a wildcard mask, matches interface Fa0/1. + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 127 + +On R2, the network 10.1.0.0 0.0.31.255 command requires a little more thought. The router uses the 0.0.31.255 value—the wildcard (WC) mask—just like an ACL WC mask. Cisco IOS compares the 10.1.0.0 value with each interface IP address, but only for the bit positions for which the WC mask lists a binary 0. For example, 0.0.31.255 represents 19 binary 0s, followed by 13 binary 1s. So, R2 would compare the first 19 bits of 10.1.0.0 with the first 19 bits of each interface’s IP address. + +Two features of the mechanics of the network command require a little extra attention. First, Cisco IOS might convert the address portion of the network address wc-mask command before putting the command into the running config. Just as Cisco IOS does for the address/WC mask combinations for the access-list command, Cisco IOS inverts the WC mask and then performs a Boolean AND of the address and mask. For example, if you type the network 10.1.1.1 0.0.255.255 command, Cisco IOS inverts the WC mask (to 255.255.0.0) and ANDs this value with 10.1.1.1, resulting in 10.1.0.0. As a result, Cisco IOS stores the command network 10.1.0.0 0.0.255.255. + +The second feature is that when you know for sure the values in the network command, you can easily find the range of interface addresses that match the address/WC mask combination in the network command. The low end of the range is the address as listed in the network command. To find the high end of the range, just add the address and WC mask together. For example, the network 10.1.0.0 0.0.31.255 command has a range of 10.1.0.0 through 10.1.31.255. + +Finally, on R3, the network 10.1.0.0 0.0.255.255 command tells R3 to enable EIGRP on all interfaces whose IP addresses begin with 10.1, which includes all three interfaces on R3, as shown in Figure 4-1. + +Taking a step back from the details, this config has enabled EIGRP, with ASN 1, on all three routers, and on all interfaces shown in Figure 4-1—except one interface. R2’s Fa0/1 interface is not matched by any network commands on R2. So, EIGRP is not enabled on that interface. The next section reviews the commands that can be used to confirm that EIGRP is enabled, the interfaces on which it is enabled, the neighbor relationships that have been formed, and which EIGRP routes have been advertised and learned. + +Verification Review + +Even before starting to configure the routers, an engineer first considers all requirements. Those requirements lead to a design, which in turn leads to a chosen set of configuration commands. Then, the verification process that follows must consider the design require-ments. The goal of verification is to determine that the internetwork works as designed, not just that some EIGRP routes have been learned. + +For the purposes of this section, assume that the only design goal for the internetwork shown in Figure 4-1 is that EIGRP be used so that all routers have routes to reach all sub-nets shown in the figure. + +To verify such a simple design, an engineer should start by confirming on which interfac-es EIGRP has been enabled on each router. The next step should be to determine whether the EIGRP neighbor relationships that should occur are indeed up and working. Then, + + + + +From the Library of Alexey Evseenko +128 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +the EIGRP topology table should be examined to confirm that there is at least one entry for each subnet or network in the design. Finally, the IP routes on each router should be examined, confirming that all routes are known. To that end, Table 4-2 summarizes five key show commands that provide the information to answer these questions. + + +Note The following table mentions some information that is covered later in this chapter (passive interfaces) or in other chapters (successor/feasible successors). + + +Example 4-2 shows samples of each command listed in Table 4-2. Note that the output highlights various samples of items that should be verified: the interfaces on which EIGRP is enabled, the known neighbors, the subnets in the topology table, and the EIGRP routes. + +Table 4-2 Key EIGRP Verification Commands +Key +Topic Command Key Information + + +show ip eigrp interfaces + +show ip protocols + +show ip eigrp neighbors + + +show ip eigrp topology + + + +show ip route + +Lists the working interfaces on which EIGRP is enabled (based on the network commands); it omits passive interfaces. +Lists the contents of the network configuration commands for each routing process, and a list of neighbor IP addresses. +Lists known neighbors; does not list neighbors for which some mismatched parameter is preventing a valid EIGRP neighbor relationship. +Lists all successor and feasible successor routes known to this router. It does not list all known topology details. (See Chapter 5, “Advanced EIGRP Concepts,” for more detail on successors and feasible successors.) +Lists the contents of the IP routing table, listing EIGRP-learned routes with a code of D on the left side of the output. + + + +Example 4-2 EIGRP Verification on Routers R1, R2, and R3 + +! On Router R1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R1# show ip eigrp interfaces +IP-EIGRP interfaces for process 1 + + + + +Interface +Fa0/0 +Se0/0/0 + +Xmit Queue +Peers Un/Reliable +0 0/0 +1 0/0 + +Mean Pacing Time +SRTT Un/Reliable +0 0/1 +25 0/15 + +Multicast +Flow Timer +0 +123 + +Pending +Routes +0 +0 + + + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 129 + +Se0/0/1 1 0/0 23 0/15 111 0 +Fa0/1 0 0/0 0 0/1 0 0 + +! On Router R2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R2# show ip protocols +Routing Protocol is "eigrp 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +EIGRP maximum hopcount 100 +EIGRP maximum metric variance 1 +Redistributing: eigrp 1 +EIGRP NSF-aware route hold timer is 240s +Automatic network summarization is in effect +Maximum path: 4 +Routing for Networks: +10.1.2.2/32 +10.1.0.0/19 +Routing Information Sources: + +Gateway +10.1.12.1 +10.1.23.1 + +Distance +90 +90 + +Last Update +00:19:36 +00:19:36 + +Distance: internal 90 external 170 + +! On Router R3: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R3# show ip eigrp neighbors +IP-EIGRP neighbors for process 1 +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num + +1 10.1.23.2 +0 10.1.13.1 + +Se0/0/1 +Se0/0/0 + +11 00:19:53 31 200 0 6 +10 00:19:53 32 200 0 6 + + +! On Router R2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R2# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.1.222.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.13.0/30, 2 successors, FD is 2681856 +via 10.1.23.1 (2681856/2169856), Serial0/0/0 +via 10.1.12.1 (2681856/2169856), Serial0/0/1 +P 10.1.12.0/30, 1 successors, FD is 2169856 +via Connected, Serial0/0/1 + + + + +From the Library of Alexey Evseenko +130 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +P 10.1.3.0/26, 1 successors, FD is 2172416 +via 10.1.23.1 (2172416/28160), Serial0/0/0 +P 10.1.2.0/25, 1 successors, FD is 28160 +via Connected, FastEthernet0/0 +P 10.1.1.0/24, 1 successors, FD is 2172416 +via 10.1.12.1 (2172416/28160), Serial0/0/1 + +! On Router R3: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R3# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +D 192.168.9.0/24 [90/2172416] via 10.1.13.1, 00:19:55, Serial0/0/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 4 masks +C 10.1.13.0/30 is directly connected, Serial0/0/0 +D 10.1.12.0/30 [90/2681856] via 10.1.23.2, 00:19:55, Serial0/0/1 +[90/2681856] via 10.1.13.1, 00:19:55, Serial0/0/0 +C 10.1.3.0/26 is directly connected, FastEthernet0/0 +D 10.1.2.0/25 [90/2172416] via 10.1.23.2, 00:19:55, Serial0/0/1 +D 10.1.1.0/24 [90/2172416] via 10.1.13.1, 00:19:55, Serial0/0/0 +C 10.1.23.0/30 is directly connected, Serial0/0/1 + +To verify the interfaces on which EIGRP is enabled, both the show ip eigrp interfaces command (shown on R1) and the show ip protocols command (shown on R2) list the information. For this example, look at the list of interfaces in R2’s show ip protocols command output: S0/0/0, S0/0/1, and FA0/0 are listed, but Fa0/1—unmatched by any of R2’s network commands—is not. + +In this design, each router should form a neighbor relationship with the other two routers, in each case over a point-to-point serial link. The show ip eigrp neighbors command (on R3) confirms R3’s neighbors. + +Finally, one design goal was for all routers to have routes for all subnets/networks. You could move on to the show ip route command or first look for all prefixes in the show ip eigrp topology command. With relatively general requirements, just looking at the IP routing table is fine. The example highlights R3’s topology data and IP route for subnet 10.1.1.0/24. Of more interest might be the fact that the show ip route command output on R3 lists all subnet/network numbers except one: subnet 10.1.222.0/27. This subnet exists off R2’s Fa0/1 interface (as seen in Figure 4-1), which is the interface on which EIGRP has not yet been enabled. + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 131 + +Internals Review + +To complete the review of prerequisite CCNA-level EIGRP knowledge, this section looks at a few of the internals of EIGRP. Some of the facts listed here simply need to be memo-rized, whereas other topics will be discussed in more detail later. + +EIGRP follows three general steps to add routes to the IP routing table, as follows: + +Step 1. Neighbor discovery: EIGRP routers send Hello messages to discover potential neighboring EIGRP routers and perform basic parameter checks to determine which routers should become neighbors. +Step 2. Topology exchange: Neighbors exchange full topology updates when the neighbor relationship comes up, and then only partial updates as needed based on changes to the network topology. +Step 3. Choosing routes: Each router analyzes its respective EIGRP topology table, choosing the lowest-metric route to reach each subnet. + +Because the majority of the rest of this chapter examines EIGRP neighborships, this review section skips any discussion of EIGRP neighbors, instead focusing on topology exchange and route selection. + +Exchanging Topology Information + +First, the EIGRP neighbor table lists the neighboring routers. Second, the EIGRP topol-ogy table holds all the topology information learned from EIGRP neighbors. Finally, EIGRP chooses the best IP routes, and those routes become candidates to be injected into the IP routing table. (Table 4-2, earlier in this chapter, lists the show commands that can be used to examine these tables.) EIGRP routers follow the process shown in Figure 4-2 to build the necessary information in these tables, with the end goal of populating the IP routing table. + + + + +B + +Neighbor Discovery (Hello) + +A + +Neighbor Discovery (Hello) + + + +Full Routing Update + +Continuous Hellos + +Reliable Update + + +Full Routing Update + +Continuous Hellos + + + +Partial Updates (Status Changes and New Subnet Info) + +Partial Updates (Status Changes and New Subnet Info) + + +Figure 4-2 EIGRP Discovery and Update Process + +EIGRP uses Update messages to send topology information to neighbors. These Update messages can be sent to multicast IP address 224.0.0.10 if the sending router needs to + + + + +From the Library of Alexey Evseenko +132 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +update multiple routers on the same subnet. Unlike OSPF, there is no concept of a des-ignated router (DR) or backup designated router (BDR), but the use of multicast packets on LANs allows EIGRP to exchange routing information with all neighbors on the LAN efficiently. + +The update messages are sent using the Reliable Transport Protocol (RTP). The signifi-cance of RTP is that, like OSPF, EIGRP resends routing updates that are lost in transit. By using RTP to guarantee delivery of the EIGRP messages, EIGRP can better avoid loops. + + +Note The acronym RTP also refers to a different protocol, Real-time Transport Protocol (RTP), which is used to transmit voice and video IP packets. + + +Neighbors use both full routing updates and partial updates, as depicted in Figure 4-2. A full update means that a router sends information about all known routes, whereas a par-tial update includes only information about recently changed routes. Full updates occur when neighbors first come up. After that, the neighbors send only partial updates in reac-tion to changes to a route. + +Calculating the Best Routes for the Routing Table + +EIGRP topology information includes the subnet number and mask, along with the com-ponents of the EIGRP composite metric. Each router then calculates an integer metric for each route, using the individual values of the EIGRP metric components listed in the +EIGRP topology database. By default, EIGRP only uses the bandwidth and delay settings when calculating the metric. Optionally, the calculation can also include interface load and interface reliability, although Cisco recommends against using either. + + +Note Past documents and books often stated that EIGRP, and its predecessor IGRP, also could use Maximum Transmission Unit (MTU) as a part of the metric. However, MTU size is intended to be a tiebreaker if two paths have equal metrics but different MTU sizes. In such a case, the path with the higher MTU is selected. So, while MTU size is listed in EIGRP Update messages, it is not directly used in metric calculations. + + +EIGRP calculates the metric for each possible route by inserting the values of the com-posite metric into a formula. If the choice is made to just use the default parameters of bandwidth and delay, the formula is as follows: +(( + + +107 +Metric = + cumulative-delay least-bandwidth +(( + + +256 + + +In this formula, the term least-bandwidth represents the lowest-bandwidth link in the route, using a unit of kilobits per second. For example, if the slowest link in a route is a 10-Mbps Ethernet link, the first part of the formula is 107 / 10 4, because 10 Mbps equals + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 133 + +10,000 kbps, or 104 kbps. The cumulative-delay value used by the formula is the sum +of all the delay values for all links in the route, with a unit of “tens of microseconds.” So, if you add up all the delays (from the output of the show interfaces type number com-mand) from all egress interfaces, you would take that number (which is in microseconds) and divide by 10 (to give you a unit of tens of microseconds) for use in the formula. You can set both bandwidth and delay for each link, using the bandwidth and delay interface subcommands. + +Table 4-3 summarizes some of the key facts about EIGRP. + + + +Key Table 4-3 Topic Feature + +Transport + +Metric + + +EIGRP Feature Summary + +Description +IP, protocol type 88 (does not use UDP or TCP). + +Based on constrained bandwidth and cumulative delay by default, and optionally load and reliability. + + + +Hello interval + +Hold Timer + + +Update destination address + + +Full or partial updates + +Authentication + +VLSM/classless + +Route tags + +Next-hop field + +Manual route summarization + +Automatic summarization + +Multiprotocol + +Interval at which a router sends EIGRP Hello messages on an interface. +Timer used to determine when a neighboring router has failed, based on a router not receiving any EIGRP messages, including Hellos, in this timer period. +Normally sent to 224.0.0.10, with retransmissions being sent to each neighbor’s unicast IP address. Can also be sent to the neighbor’s unicast IP address. +Full updates are used when new neighbors are discovered; otherwise, partial updates are used. +Supports MD5 authentication only. + +EIGRP includes the mask with each route, also allowing it to support discontiguous networks and VLSM. +Allows EIGRP to tag routes as they are redistributed into EIGRP. +Supports the advertisement of routes with a different next-hop router than the advertising router. +Allows route summarization at any point in the EIGRP network. +EIGRP supports, and defaults to use, automatic route summarization at classful network boundaries. +Supports the advertisement of IPX, AppleTalk, IP version 4, and IP version 6 routes. + + + +This completes the CCNA-level EIGRP review. The rest of this chapter now examines EIGRP neighbor relationships. + + + + +From the Library of Alexey Evseenko +134 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +EIGRP Neighborships + +Like OSPF, EIGRP uses three major steps to achieve its goal of learning the best available loop-free routes: +Step 1. Establish EIGRP neighbor relationships—neighborships—with other routers that share a common subnet. + +Step 2. Exchange EIGRP topology data with those neighbors. + +Step 3. Calculate the currently best IP route for each subnet, based on the known EIGRP topology data, and add those best routes to the IP routing table. + +This three-step process hinges on the first step—the successful creation of neighbor rela-tionships between EIGRP routers. The basic EIGRP configuration described earlier in this chapter, particularly the network command, most directly tells EIGRP on which interfac-es to dynamically discover neighbors. After EIGRP neighborships have been formed with neighboring routers that are reachable through those interfaces, the final two steps occur without any additional direct configuration. + +EIGRP dynamically discovers neighbors by sending EIGRP Hello messages on each EIGRP-enabled interface. When two routers hear EIGRP Hello messages from each other, they check the EIGRP parameters listed in those messages and decide whether the two routers should or should not become neighbors. + +The rest of this section focuses on topics related to EIGRP neighborship, specifically: + +■ Manipulating EIGRP Hello and Hold Timers + +■ Controlling whether routers become neighbors by using either passive interfaces or statically defined neighbors + +■ Examining configuration settings that can prevent EIGRP neighborships + + +Manipulating EIGRP Hello and Hold Timers + +The word convergence defines the overall process by which routers notice internetwork topology changes, communicate about those changes, and change their routing tables to contain only the best currently working routes. EIGRP converges very quickly, even with all default settings. + +One of the slower components of the EIGRP convergence process relates to the timers that EIGRP neighbors use to recognize that a neighborship has failed. If the interface over which the neighbor is reachable fails, and Cisco IOS changes the interface state to anything other than “up/up,” a router immediately knows that the neighborship should fail. However, in some cases, an interface state might stay “up/up” during times when the link is not usable. In such cases, EIGRP convergence relies on the Hold Timer to expire, which by default, on LANs, means a 15-second wait. (The default EIGRP Hold time on interfaces/subinterfaces with a bandwidth of T1 or lower, with an encapsulation type of Frame Relay, is 180 seconds.) + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 135 + +The basic operation of these two timers is relatively simple. EIGRP uses the Hello mes-sages in part as a confirmation that the link between the neighbors still works. If a router does not receive a Hello from a neighbor for one entire Hold time, that router considers the neighbor to be unavailable. For example, with a default LAN setting of Hello = 5 and Hold = 15, the local router sends Hellos every 5 seconds. The neighbor resets its down-ward-counting Hold Timer to 15 upon receiving a Hello from that neighbor. Under nor-mal operation on a LAN, with defaults, the Hold Timer for a neighbor would vary from 15, down to 10, and then be reset to 15. However, if the Hellos were no longer received for 15 seconds, the neighborship would fail, driving convergence. + +To optimize convergence, an engineer could simply reduce the Hello and Hold Timers, accepting insignificant additional overhead, in return for shorter convergence times. These settings can be made per interface/subinterface, and per EIGRP process. + + +Note Although expected to be outside the scope of CCNP, EIGRP can also use the +Bi-directional Forwarding Detection (BFD) feature, which provides a means for subsecond detection of a failure in IP connectivity between two neighboring routers. + + + +Configuring the Hello/Hold Timers + +Most design engineers would normally choose Hello/Hold Timers that match on all rout-er interfaces on a subnet. However, these settings do not have to match. Interestingly, by setting the Hello and Hold Timers to nondefault values, you can see some oddities with how EIGRP neighbors use these values. + +For example, consider four WAN distribution routers, as shown in Figure 4-3. These routers might each have a number of Frame Relay PVCs to remote branches, or multiple MPLS VPN connections to branches. However, to communicate with each other and with data centers at the home office, these four routers connect through a core VLAN/subnet. Note that the design shows routers, rather than Layer 3 switches, but the concept is the same in either case. + +A design that hoped to speed EIGRP convergence might call for setting the Hello and Hold Timers to 2 and 6, respectively. (The Hold Timer does not have to be three times the Hello Timer, but the 3:1 ratio is a reasonable guideline.) However, to make an important point about operation of the configuration commands, Example 4-3 sets only R1’s Fa0/1 timers to the new values. Note that in this case, EIGRP has already been configured on all four routers, using ASN 9. + + + + + + + + + + + +From the Library of Alexey Evseenko +136 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +To Data Centers + + + + + +.1/24 R1 Fa0/1 + + +To Branches + + +.2/24 +Fa0/1 R2 + + +To Branches + + + +.3/24 R3 Fa0/1 + + +.4/24 +Fa0/1 R4 + + + + +Note: All IP addresses begin with 172.16.1 + +Figure 4-3 Four WAN Distribution Routers on the Same VLAN/Subnet + +Example 4-3 EIGRP Hello and Hold Timer Configuration—R1 + +interface Fastethernet0/1 +ip hello-interval eigrp 9 2 +ip hold-time eigrp 9 6 + +A couple of interesting points can be made about the operation of these seemingly simple commands. First, these two settings can be made per interface/subinterface, but not per neighbor. In Figure 4-3, the Example 4-3 configuration then applies on R1 for all three neighbors reachable on interface Fa0/1. + +The second interesting point about these commands is that one parameter (the Hello Interval) tells R1 what to do, whereas the other (the Hold Timer) actually tells the neigh-boring routers what to do. As shown in Figure 4-4, the ip hello-interval eigrp 9 2 inter-face subcommand tells R1 to send Hellos every 2 seconds. However, the ip hold-time eigrp 9 6 interface subcommand tells R1, again for the EIGRP process with ASN 9, to tell its neighbors to use a Hold Timer of 6 for their respective neighbor relationships with R1. In short, the EIGRP Hello message sent by R1 announces the Hold Timer that other rout-ers should use in the neighbor relationship with R1. Figure 4-4 shows this idea in graphi-cal form. + + +Note Cisco IOS does not prevent you from making the unfortunate configuration choice of setting the Hold Timer to a value smaller than the Hello interval. In such a case, the neighborship repeatedly fails and recovers, flapping routes in and out of the routing table. + + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 137 + + +R1 R2 + + +Hello Hello Timer: 2 Hold Timer: 6 + + + +Hello Timer: 5 Hello Hold Timer: 15 + + +Hold Timer 2 Seconds 6 + +5 + +Hello 4 6 + +2 Seconds 5 + +Hello 4 6 + +2 Seconds 5 + +Hello 4 + +Figure 4-4 R1 Announcing New Hello and Hold Timers + +Verifying the Hello/Hold Timers + +To find the Hello interface and Hold time configured on a router’s interface, you could of course look at a router’s configuration, but the show running-config command might not be available to you on some question types on the ROUTE exam. However, if you have access to only user mode, you can issue the show ip eigrp interfaces detail type number command. It’s important to note, however, that if you use that command on some older versions of Cisco IOS, the Hold time might not displayed. + +Example 4-4 shows some sample command output from R1, R2, and R3. Note that the Hello and Hold Timer settings on R1 are all in the range of 10–15 seconds, because the timers on R2, R3, and R4 all still default to 5 and 15 seconds, respectively. R2’s neighbor-ship with R1 lists a Hold Timer of 4, which is within the expected range of 4–6 seconds remaining. + +Example 4-4 Demonstration that R2 and R3 Use R1’s Configured Hold Timer + +! On Router R1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R1# show ip eigrp interfaces detail fa0/1 + +EIGRP-IPv4 Interfaces for AS(9) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + + + + + + + +From the Library of Alexey Evseenko +138 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Fa0/1 3 0/0 0/0 535 0/1 50 0 +Hello-interval is 2, Hold-time is 6 +Split-horizon is enabled +Next xmit serial +Packetized sent/expedited: 0/0 +Hello's sent/expedited: 102/1 +Un/reliable mcasts: 0/1 Un/reliable ucasts: 4/9 +Mcast exceptions: 1 CR packets: 1 ACKs suppressed: 1 +Retransmissions sent: 2 Out-of-sequence rcvd: 0 +Topology-ids on interface - 0 +Authentication mode is not set + + +R1# show ip eigrp neighbors +IP-EIGRP neighbors for process 9 + +H Address + +2 172.16.1.4 +1 172.16.1.3 +0 172.16.1.2 + +Interface + +Fa0/1 +Fa0/1 +Fa0/1 + +Hold Uptime +(sec) +11 00:03:17 +11 00:05:21 +13 00:09:04 + +SRTT RTO Q Seq +(ms) Cnt Num +1596 5000 0 7 +1 200 0 5 +4 200 0 2 + +! On Router R2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R2# show ip eigrp neighbors +IP-EIGRP neighbors for process 9 + +H Address + +2 172.16.1.4 +1 172.16.1.3 +0 172.16.1.1 + +Interface + +Fa0/1 +Fa0/1 +Fa0/1 + +Hold Uptime +(sec) +11 00:03:36 +11 00:05:40 +4 00:09:22 + +SRTT RTO Q Seq +(ms) Cnt Num +4 200 0 6 +12 200 0 4 +1 200 0 2 + +! On Router R3: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +R3# show ip eigrp neighbors +IP-EIGRP neighbors for process 9 + +H Address + +2 172.16.1.4 +1 172.16.1.1 +0 172.16.1.2 + +Interface + +Fa0/1 +Fa0/1 +Fa0/1 + +Hold Uptime +(sec) +11 00:03:40 +5 00:05:44 +13 00:05:44 + +SRTT RTO Q Seq +(ms) Cnt Num +4 200 0 5 +1278 5000 0 4 +1277 5000 0 4 + + + +Preventing Unwanted Neighbors Using Passive Interfaces + +When an EIGRP network configuration subcommand matches an interface, EIGRP on that router does two things: +Step 1. Attempts to find potential EIGRP neighbors by sending Hellos to the 224.0.0.10 multicast address + +Step 2. Advertises the subnet connected to that interface + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 139 + +In some cases, however, no legitimate EIGRP neighbors might exist off an interface. For example, consider the small internetwork shown in Figure 4-5, with three routers, and with only one router connected to each LAN interface. Each router needs to advertise the subnets connected to their various FastEthernet interfaces, but at the same time, there is no benefit to multicast EIGRP Hellos on those interfaces, because only one router con-nects to each LAN. + + + +Fa0/0 +1.1/24 R1 +S0/0/0 12.1/30 + +Fa0/1 192.168.9.99/28 + +S0/0/1 13.1/30 + + + + + + + + +12.2/30 S0/0/1 + +13.2/30 S0/0/0 + + + +Fa0/1 222.2/27 + +S0/0/0 R2 23.2/30 +Fa0/0 +2.2/25 + + +S0/0/1 23.1/30 + + +R3 +Fa0/0 +3.3/26 + + + + + + +Note: All IP addresses begin with 10.1 unless otherwise noted. + +Figure 4-5 LAN Interfaces That Benefit from the Passive Interface Feature + +The network designer can reasonably choose to limit EIGRP on those interfaces that have no legitimate EIGRP neighbors. However, the subnets connected to those same interfaces also typically need to be advertised by EIGRP. For example, subnet 10.1.1.0/24, off R1’s Fa0/0 interface, still needs to be advertised by EIGRP, even though R1 should never find an EIGRP neighbor on that interface. + +Given such a requirement—to advertise the subnet while disallowing EIGRP neighbor-ships on the interface—an engineer has two main configuration options to choose from: + + +■ Key +Topic + +■ + +Enable EIGRP on the interface using the EIGRP network command, but tell the rout-er to not send any EIGRP messages on the interface by making the interface passive (using the passive-interface command). + +Do not enable EIGRP on the interface, and advertise the connected route using route +redistribution (and the redistribute connected configuration command). + + + + + + + +From the Library of Alexey Evseenko +140 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The first option relies on the passive interface feature—a feature specifically created with this design requirement in mind. When an interface is passive, EIGRP does not send any EIGRP messages on the interface—multicasts or EIGRP unicasts—and the router ignores any EIGRP messages received on the interface. However, EIGRP still advertises the con-nected subnets if matched with an EIGRP network command. As a result, the first option in the preceding list directly meets all the design requirements. It has the added advantage of being very secure in that no EIGRP neighborships are possible on the interface. + +The second option—redistributing connected subnets—also works, but frankly it is the less preferred option in this case. Specifically, the passive interface option clearly meets the design requirements, while the redistribution option causes the connected route to be advertised as an external EIGRP route. This could cause problems in some cases with multiple redistribution points between routing domains (as discussed in Chapter 10, “Route Redistribution”). + +The configuration of the passive interface itself is fairly straightforward. To configure the passive interface option, these three routers could be configured as shown in Example +4-5. + +Example 4-5 Configuration of passive-interface Commands on R1, R2, and R3 + +! On Router R1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +router eigrp 1 +passive-interface fastethernet0/0 +passive-interface fastethernet0/1 +network 10.0.0.0 +network 192.168.9.0 + +! On Router R2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +router eigrp 1 +passive-interface default +no passive-interface serial0/0/0 +no passive-interface serial0/0/1 +network 10.0.0.0 + +! On Router R3: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +router eigrp 1 +passive-interface fastethernet0/0 +network 10.0.0.0 + +R1’s configuration lists two passive-interface commands, one per LAN interface. As a result, R1 no longer sends EIGRP messages on these two interfaces, including the multi-cast EIGRP Hellos used to discover neighbors. + +R2’s configuration uses a slightly different option: the passive-interface default com-mand. This command essentially changes the default for an interface from not being pas-sive to instead being passive. Then, to make an interface not passive, you have to use a no version of the passive-interface command for those interfaces. + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 141 + +Two commands help to verify that the passive interface design is working properly. First, the show ip eigrp interfaces command omits passive interfaces, listing the nonpassive interfaces matched by a network command. Alternatively, the show ip protocols com-mand explicitly lists all passive interfaces. Example 4-6 shows samples of both commands on R2. + +Example 4-6 Verifying the Results of passive-interface on R2 + +R2# show ip eigrp interfaces +IP-EIGRP interfaces for process 1 + + + + +Interface +Se0/0/0 +Se0/0/1 + +Xmit Queue Mean +Peers Un/Reliable SRTT +1 0/0 32 +1 0/0 1290 + +Pacing Time +Un/Reliable +0/15 +0/15 + +Multicast +Flow Timer +159 +6443 + +Pending +Routes +0 +0 + +R2# show ip protocols +Routing Protocol is "eigrp 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +EIGRP maximum hopcount 100 +EIGRP maximum metric variance 1 +Redistributing: eigrp 1 +EIGRP NSF-aware route hold timer is 240s +Automatic network summarization is in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Passive Interface(s): +FastEthernet0/0 +FastEthernet0/1 +Routing Information Sources: + +Gateway +10.1.12.1 +10.1.23.1 + +Distance +90 +90 + +Last Update +00:00:39 +00:00:39 + +Distance: internal 90 external 170 + + +Controlling Neighborships with Static Configuration + +EIGRP supports the ability to statically define neighbors instead of dynamically discover-ing neighbors. + + + + + + +From the Library of Alexey Evseenko +142 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Although seldom used, you can use this feature to reduce the overhead associated with EIGRP multicast messages. Frame Relay WANs in particular might benefit from the static neighbor definitions, because to support multicasts and broadcasts over Frame Relay, a router must replicate a frame and send a copy over every PVC associated with the inter-face or subinterface. For example, if a multipoint subinterface has ten PVCs associated with it, but only two of the remote routers used EIGRP, without static neighbors, all ten routers would be sent a copy of the EIGRP multicast Hello packets. With static neighbor definitions for the two routers, EIGRP messages would be sent as unicasts to each of the two neighbors, with no EIGRP messages sent to the eight non-EIGRP routers, reducing overhead. + +The configuration seems simple, but it has a few subtle caveats. This section examines the straightforward configuration first and then examines the caveats. + +Configuring Static EIGRP Neighbors + +To define a neighbor, both routers must configure the neighbor ip-address outgoing-interface EIGRP router subcommand. The IP address is the interface IP address of the neighboring router. Also, the configured IP address must be from the subnet connected to the interface listed in the neighbor command; otherwise, the command is rejected. Also, note that the EIGRP configuration still needs a network command that matches the interface referenced by the neighbor command. + +For example, consider Figure 4-6, which adds a new router (R5) to the internetwork of Figure 4-3. R1 and R5 have a PVC connecting them, with IP addresses and subinterface numbers shown. + + + +R5 10.10.15.5/29 +S0/0.1 + + +FR +10.10.15.1/29 S0/0/0.5 + + +R1 +R2 + + + + +R3 +R4 + +Figure 4-6 Adding a Branch, with a Static EIGRP Neighbor + +Example 4-7 shows the configuration on both R1 and R5 to use static neighbor defini-tions. Of note, R1’s neighbor command refers to R5’s IP address on their common subnet (10.10.15.5), with R1’s local interface (S0/0/0.5). R5 lists the reverse, with R1’s 10.10.15.1 IP address and R5’s local S0/0.1 interface. Also note that both routers have a network com-mand that references network 10.0.0.0, and both routers do advertise subnet 10.10.15.0/29. + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 143 + +The show ip eigrp neighbors command does not identify a neighbor as static, but the show ip eigrp neighbors detail command does. Example 4-7 shows the more detailed output near the end, with the designation of 10.10.15.5 (R5) as a static neighbor. + +Example 4-7 Static EIGRP Neighborship Between R1 and R5 + +! New configuration on router R1 +R1# show running-config +! lines omitted +router eigrp 9 +network 172.16.0.0 +network 10.0.0.0 +no auto-summary +neighbor 10.10.15.5 Serial0/0/0.5 +! Back to R1 +R1# show ip eigrp neighbors detail +IP-EIGRP neighbors for process 9 + +H Address + +3 10.10.15.5 +Static neighbor + +Interface + +Se0/0/0.5 + +Hold Uptime +(sec) +10 00:00:51 + +SRTT RTO Q Seq +(ms) Cnt Num +15 200 0 2 + +Version 12.4/1.2, Retrans: 0, Retries: 0 +2 172.16.1.2 Fa0/1 11 00:02:57 3 200 0 25 +Version 12.4/1.2, Retrans: 1, Retries: 0 +1 172.16.1.3 Fa0/1 10 00:03:45 5 200 0 21 +Version 12.4/1.2, Retrans: 0, Retries: 0 +0 172.16.1.4 Fa0/1 13 00:03:45 5 200 0 18 + +! R5's new config added to support the neighbor +R5# show running-config +! lines omitted +router eigrp 9 +network 10.0.0.0 +no auto-summary +neighbor 10.10.15.1 Serial0/0.1 + + +Caveat When Using EIGRP Static Neighbors + +Cisco IOS changes how it processes EIGRP packets on any interface referenced by an EIGRP neighbor command. Keeping in mind the design goal for this feature—to reduce multicasts—Cisco IOS disables all EIGRP multicast packet processing on an interface when an EIGRP neighbor command has been configured. For example, in Example 4-7, R1’s S0/0/0.5 subinterface will not process EIGRP multicast packets any more as a result of R1’s neighbor 10.10.15.5 Serial0/0/0.5 EIGRP subcommand. + +Because of the operation of the EIGRP neighbor command, if at least one EIGRP static neighbor is defined on an interface, no dynamic neighbors can be either discovered or + + + + +From the Library of Alexey Evseenko +144 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +continue to work if already discovered. For example, again in Figure 4-6 and Example +4-7, if R1 added a neighbor 172.16.1.5 FastEthernet0/1 EIGRP subcommand, R1 would lose its current neighborships with Routers R2, R3, and R4. + +Configuration Settings That Could Prevent Neighbor Relationships + +Some of the configuration settings already mentioned in this chapter, when configured incorrectly, might prevent EIGRP neighborships. This section summarizes those settings, and introduces a few other configuration settings that can prevent neighbor relationships. The list of items that must match—and that do not have to match—can be a useful place to start troubleshooting neighbor initialization problems in real life, and to troubleshoot neighborship problems for simulation questions on the CCNP ROUTE exam. + +Table 4-4 lists the neighbor requirements for both EIGRP and Open Shortest Path First (OSPF). (OSPF is included here just as a frame of reference for those more familiar with OSPF; this information will be repeated in Chapter 7, “Fundamental OSPF Concepts,” which discusses OSPF neighborship requirements.) Following the table, the next few pages examine some of these settings for EIGRP. + + +Table 4-4 Neighbor Requirements for EIGRP and OSPF +Key +Topic Requirement + +The routers must be able to send/receive IP packets to one another. + +Interfaces’ primary IP addresses must be in same subnet. + +Must not be passive on the connected interface. + +Must use the same ASN (EIGRP) or process-ID (OSPF) in the router configuration command. +Hello interval/timer, plus either the Hold (EIGRP) or Dead (OSPF) timer, must match. +Must pass neighbor authentication (if configured). + +Must be in same area. + +IP MTU must match. + +K-values (used in metric calculation) must match. + +Router IDs must be unique. + + + +EIGRP OSPF +Yes Yes + +Yes Yes + +Yes Yes + +Yes No + +No Yes + +Yes Yes + +N/A Yes + +No Yes + +Yes — + +No Yes +1 + + +1 Duplicate EIGRP RIDs do not prevent routers from becoming neighbors, but it can cause problems when adding external EIGRP routes to the IP routing table. + +Going through Table 4-4 sequentially, the first two items relate to IP connectivity. Two routers must be able to send and receive IP packets with each other. Additionally, the pri-mary IP address on the interfaces—in other words, the IP address configured without the secondary keyword on the ip address command—must be in the same subnet. + + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 145 + + +Note It should not matter for CCNP ROUTE, but possibly for CCIE R/S: EIGRP’s rules about neighbor IP addresses being in the same subnet are less exact than OSPF. OSPF requires matching subnet numbers and masks. EIGRP just asks the question of whether the neighbor’s IP address is in the range of addresses for the subnet as known to the local router. For example, two routers with addresses of 10.1.1.1/24 (range 10.1.1.1–10.1.1.254) and 10.1.1.2/30 (range 10.1.1.1–10.1.1.2) would actually allow EIGRP neighborship, because each router believes the neighbor’s IP address to be in the same subnet as the local router. + + +The next three items in Table 4-4 —passive interfaces, matching the EIGRP ASN number, and allowing mismatching Hello/Hold Timers—have already been covered in this chapter. + +The next item, authentication, is discussed in detail in Chapter 17, “Routing Protocol Authentication.” + +The next two items in the table—matching the IP MTU and matching OSPF areas—do not prevent EIGRP neighborships. These topics, are requirements for OSPF neighborship and will be discussed in Chapter 7. + +Finally, the last two items in the table (K-values and router IDs) each require more than a cursory discussion for EIGRP and will be explained in the upcoming pages. + +Configuring EIGRP Metric Components (K-values) + +EIGRP calculates its integer metric, by default, using a formula that uses constraining bandwidth and cumulative delay. You can change the formula to use link reliability and link load, and even disable the use of bandwidth and/or delay. To change the formula, an engineer can configure five weighting constants, called K-values, which are represented in the metric calculation formula as constants K1, K2, K3, K4, and K5. + +From a design perspective, Cisco strongly recommends against using link load and link reliability in the EIGRP metric calculation. Most shops that use EIGRP never touch the +K-values at all. However, in labs, it can be useful to disable the use of bandwidth from the metric calculation, because that simplifies the metric math and makes it easier to learn the concepts behind EIGRP. + +The metric weights command sets five variables (K1 through K5), each of which weights the metric calculation formula more or less heavily for various parts of the formula. Mismatched K-value settings prevent two routers from becoming neighbors. Thankfully, determining whether such a mismatch exists is easy. When a router receives an EIGRP Hello with mismatched K-values (as compared to itself), the router issues a log message stating that a K-value mismatch exists. You can also examine the values either by looking at the running configurations or by looking for the K-values listed in the output of the show ip protocols command, as shown in Example 4-8. + + + + + + + + +From the Library of Alexey Evseenko +146 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note In the command metric weights 0 1 0 1 1 0, the first number (that is, the leftmost 0) represents the Type of Service (ToS) value with which EIGRP packets should be marked. This is a Quality of Service (QoS) setting. It equals 0 and cannot be changed to a different value. The remaining five numbers are the K-values: K1, K2, K3, K4, and K5, respectively. + + +Example 4-8 Mismatched K-values + +R2(config)# router eigrp 1 +R2(config-router)# metric weights 0 1 0 1 1 0 +R2(config-router)# end +Feb 23 18:48:21.599: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 10.1.12.1 (Serial0/0/1) is down: metric changed +R2# +Feb 23 18:48:24.907: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 10.1.12.1 (Serial0/0/1) is down: K-value mismatch +R2# show ip protocols +Routing Protocol is "eigrp 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP metric weight K1=1, K2=0, K3=1, K4=1, K5=0 +! lines omitted for brevity + + +EIGRP Router ID + +EIGRP uses a concept of a representing each router with a router ID (RID). The EIGRP RID is a 32-bit number, represented in dotted decimal. Each router determines its RID when the EIGRP process starts, using the same general rules as does OSPF for determin-ing the OSPF RID, as follows: + +Step 1. +Key Topic +Step 2. + +Step 3. + + +Use the configured value (using the eigrp router-id a.b.c.d EIGRP subcom-mand). + +Use the highest IPv4 address on an up/up loopback interface. + +Use the highest IPv4 address on an up/up nonloopback interface. + + +Although EIGRP does require each router to have an RID, the actual value is of little practical importance. The EIGRP show commands seldom list the RID value, and unlike OSPF RIDs, engineers do not need to know each router’s EIGRP RID to interpret the EIGRP topology database. Additionally, although it is best to make EIGRP RIDs unique, duplicate RIDs do not prevent routers from becoming neighbors. + +The only time the value of EIGRP RIDs matters is when injecting external routes into EIGRP. In that case, the routers injecting the external routes must have unique RIDs to avoid confusion. + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 147 + +Neighborship over WANs + +EIGRP configuration and neighborship rules do not differ when comparing typical LAN and typical WAN technologies. However, some design and operational differences exist, particularly regarding which routers become neighbors with which other routers. This short section closes the EIGRP neighbor discussion with a brief look at Frame Relay, MPLS VPNs, and Metro Ethernet as implemented with Virtual Private LAN Service (VPLS). + +Neighborship on Frame Relay + +Frame Relay provides a Layer 2 WAN service. Each router connects to the service using a physical serial link, called a Frame Relay access link. The provider then creates logical connections, called permanent virtual circuits (PVC), which are logical paths between pairs of routers connected to a Frame Relay service. Any pair of routers that connect to the ends of a Frame Relay PVC can send Frame Relay frames to each other. Therefore, they can send IP packets and become EIGRP neighbors. Figure 4-7 shows a typical case, with R1 as a central-site router, and R2, R3, and R4 acting as branch routers. + + + + +R1 + + + + + + + +Frame Relay + + + + + + +R2 R4 + +R3 + + +Legend: +PVC +EIGRP Neighborship + +Figure 4-7 EIGRP Neighborships over Frame Relay + + + +From the Library of Alexey Evseenko +148 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Figure 4-7 shows EIGRP neighborships, but note that all routers can learn all routes in the internetwork, even though not all routers become neighbors. The neighborships can only form when a PVC exists between the two routers. + +Neighborship on MPLS VPN + +Multiprotocol Label Switching (MPLS) Virtual Private Networks (VPN) create a WAN service that has some similarities but many differences when compared to Frame Relay. The customer routers connect to the service, often with serial links but at other times with Frame Relay PVCs or with Ethernet. The service itself is a Layer 3 service, forward-ing IP packets through a cloud. As a result, no predefined PVCs need to exist between the customer routers. Additionally, the service uses routers at the edge of the service provider +cloud—generically called provider edge (PE) routers—and these routers are Layer 3 aware. + +That Layer 3 awareness means that the customer edge (CE) routers form an EIGRP neigh-borship with the PE router on the other end of their local access link, as shown in Figure 4-8. The PE routers exchange their routes, typically using Multiprotocol BGP (MP-BGP), a topic outside the scope of this book. However, all the CE routers then learn routes from each other, although each CE router has only one EIGRP neighborship for each of its connections into the MPLS VPN cloud. + + + + +R1 + + + +PE + + + +MPLS VPNs + + +PE PE PE + + +R2 R4 + +R3 + + +Legend: +EIGRP Neighborship + +Figure 4-8 EIGRP Neighborships over MPLS VPN + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 149 + +Neighborship on Metro Ethernet + +The term Metropolitan Ethernet (MetroE) represents a range of Layer 2 WAN services in which the CE device connects to the WAN service using some form of Ethernet. Because MetroE provides a Layer 2 Ethernet service, the service delivers an Ethernet frame sent by one customer router to another customer router (for unicast frames), or to many other routers (for multicast or broadcast frames). + +MetroE encompasses several underlying technologies to create the service. Of note for the purposes of this book are the Virtual Private Wire Service (VPWS) and the Virtual Private LAN Service (VPLS). Both technical specifications allow for connections using Ethernet links, with the service forwarding Ethernet frames. VPWS focuses on point-to-point topologies, whereas VPLS supports multipoint, approximating the concept of the entire WAN service acting like one large Ethernet switch. Because it is a Layer 2 service, MetroE does not have any Layer 3 awareness, and customer routers (typically referenced with the more general service provider term customer premises equipment, or CPE ) see the MetroE service as a VLAN. Because the customer routers connect to the service as a VLAN, all the routers connected to the service can become EIGRP neighbors, as shown in Figure 4-9. + + + + +R1 +Gi0/0 + + + + + + + +Metro Ethernet + + + + +Fa0/1 Fa0/1 + +R2 Fa0/1 R4 + +R3 + + +Legend: +EIGRP Neighborship + +Figure 4-9 EIGRP Neighborships over Metro Ethernet + + + + + +From the Library of Alexey Evseenko +150 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to be able to review design documents, create implementation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter, so that you can think about the same technical topics from the planning per-spective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables,” which you can find on the CD-ROM accompanying this book. + +Design Review Table + +Table 4-5 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? For any configuration items, a general description can be used, without any concern about the specific parameters. + +Table 4-5 Design Review + + +Design Goal + +Improve EIGRP convergence. + +Implement EIGRP on each router so that neighborships are formed (2). +Limit neighborship formation on interfaces matched with an EIGRP network command (3). + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 4-6 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 151 + +Table 4-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +What happens on a router interface on which an EIGRP network command matches the interface? (2) +What configuration settings prevent EIGRP neighbor discovery on an EIGRP-enabled interface? (2) +What configuration settings prevent any neighborships on an EIGRP-enabled interface? +What settings do potential neighbors check before becoming EIGRP neighbors? (5) +What settings that you might think would impact EIGRP neighbor relationships actually do not prevent neighborship? (3) + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own EIGRP implementation plan, list in Table 4-7 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 4-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Enabling EIGRP on interfaces + +Setting Hello and Hold Timers + +Passive interfaces + +Static EIGRP neighbors + +K-values + +EIGRP router ID + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own EIGRP verification plan, list in Table +4-8 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + + + + +From the Library of Alexey Evseenko +152 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 4-8 Verification Plan Memory Drill + +Information Needed Command +Routes that have been added to the IP routing table by EIGRP. +All routes in a router’s routing table. + +The specific route for a single destination address or subnet. +A listing of all (both statically configured and dynamically discovered) EIGRP neighbors. +Notation as to whether a neighbor was dynamically discovered or statically configured. +A listing of statistics regarding the numbers of EIGRP messages sent and received by a router. +A listing of interfaces on which EIGRP has been enabled (by virtue of the EIGRP network command). +A listing of the number of EIGRP peers known through a particular interface. +The elapsed time since a neighborship was formed. + +The parameters of any EIGRP network commands. + +The configured Hello Timer for an interface. + +The configured Hold Timer for an interface. + +The current actual Hold Timer for a neighbor. + +A router’s EIGRP ASN. + +A list of EIGRP passive interfaces. + +A list of nonpassive EIGRP interfaces. + +A listing of EIGRP K-values. + +A listing of traffic statistics about EIGRP. + +A router’s EIGRP Router ID. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 4-9 lists a reference of these key topics and the +page numbers on which each is found. + + + + + + +From the Library of Alexey Evseenko +Chapter 4: Fundamental EIGRP Concepts 153 + +Table 4-9 Key Topics for Chapter 4 +Key +Topic Key Topic Element Description Page Number + + +List + +Table 4-2 + +Table 4-3 + +Configuration step review for basic EIGRP 125 configuration +Key EIGRP verification commands 128 + +Summary of EIGRP features and facts 133 + + +List Methods of disallowing EIGRP neighborships on an 139 interface, while still advertising the connected subnet + +Table 4-4 + +List + +List of items that can impact the formation of 144 EIGRP neighborships +Rules for choosing an EIGRP Router ID 146 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +K-value, neighborship, Hello interval, Hold Timer, passive interface + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Building the EIGRP Topology Table: This sec-tion discusses how a router seeds its local EIGRP topology table, and how neighboring EIGRP routers exchange topology information. +■ Building the IP Routing Table: This section explains how routers use EIGRP topology data to choose the best routes to add to their local routing tables. +■ Optimizing EIGRP Convergence: This section examines items that have an impact on how fast EIGRP converges for a given route. +■ Route Filtering: This section examines how to filter prefixes from being sent in EIGRP Updates or filter them from being processed when received in an EIGRP Update. +■ Route Summarization: This section discusses the concepts and configuration of EIGRP route summarization. +■ Default Routes: This section examines the benefits of using default routes, and the mechanics of two methods for configuring default routes with EIGRP. + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 5 + + + + + + +Advanced EIGRP Concepts + + +Enhanced Interior Gateway Routing Protocol (EIGRP), like Open Shortest Path First (OSPF), uses three major branches of logic, each of which populates a different table. EIGRP begins by forming neighbor relationships and listing those relationships in the EIGRP neighbor table (as described in Chapter 4, “Fundamental EIGRP Concepts”). EIGRP then exchanges topology information with these same neighbors, with newly learned infor-mation being added to the router’s EIGRP topology table. Finally, each router processes the EIGRP topology table to choose the best IP routes currently available, adding those IP routes to the IP routing table. + +This chapter moves from the first major branch (neighborships, as covered in Chapter 4) to the second and third branches: EIGRP topology and EIGRP routes. To that end, the first major section of this chapter describes the protocol used by EIGRP to exchange the topolo-gy information and details exactly what information EIGRP puts in its messages sent between routers. The next major section shows how EIGRP examines the topology data to then choose the best route currently available for each prefix. The final section of this chapter examines how to optimize the EIGRP convergence processes so that when the topology does change, the routers in the internetwork quickly converge to the then-best routes. This chapter concludes with three sections covering categories of tools that you can use to limit the num-ber of routes in the routing table: route filtering, route summarization, and default routes. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than two of these 18 self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 5-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions covering the material in those headings, so that you can assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 5-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Building the EIGRP Topology Table + +Building the IP Routing Table + +Optimizing EIGRP Convergence + +Route Filtering + +Questions +1–3 + +4–8 + +9 + +10–13 + + + + +From the Library of Alexey Evseenko +156 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Foundation Topics Section Route Summarization +Default Routes + +Questions 14–16 +17, 18 + + + +1. Which of the following are methods that EIGRP uses to initially populate (seed) its EIGRP topology table, before learning topology data from neighbors? (Choose two.) + +a. By adding all subnets listed by the show ip route connected command + +b. By adding the subnets of working interfaces over which static neighbors have been defined +c. By adding subnets redistributed on the local router from another routing source + +d. By adding all subnets listed by the show ip route static command + +2. Which of the following are both advertised by EIGRP in the Update message and included in the formula for calculating the integer EIGRP metric? (Choose two.) + +a. Jitter + +b. Delay + +c. MTU + +d. Reliability + +3. Router R1 uses S0/0 to connect through a T/1 to the Frame Relay service. Five PVCs terminate on the serial link. Three PVCs (101, 102, and 103) are configured on subin-terface S0/0.1, and one each (104 and 105) are on S0/0.2 and S0/0.3. The configuration shows no configuration related to EIGRP WAN bandwidth control, and the band-width command is not configured. Which of the following is true about how Cisco IOS tries to limit EIGRP’s use of bandwidth on S0/0? +a. R1 limits EIGRP to around 250 kbps on DLCI 102. + +b. R1 limits EIGRP to around 250 kbps on DLCI 104. + +c. R1 limits EIGRP to around 150 kbps on every DLCI. + +d. R1 does not limit EIGRP because no WAN bandwidth control has been configured. + +4. The output of show ip eigrp topology on Router R1 shows the following output, which is all the output related to subnet 10.11.1.0/24. How many feasible successor routes does R1 have for 10.11.1.0/24? + +P 10.11.1.0/24, 2 successors, FD is 2172419 +via 10.1.1.2 (2172423/28167), Serial0/0/0.1 +via 10.1.1.6 (2172423/28167), Serial0/0/0.2 + +a. 0 + +b. 1 + +c. 2 + +d. 3 + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 157 + +5. A network design shows that R1 has four different possible paths from itself to the data center subnets. Which of the following can influence which of those routes become feasible successor routes, assuming that you follow the Cisco-recommended practice of not changing metric weights? (Choose two.) +a. The configuration of EIGRP offset lists + +b. Current link loads + +c. Changing interface delay settings + +d. Configuration of variance + +6. Router R1 is three router hops away from subnet 10.1.1.0/24. According to various show interfaces commands, all three links between R1 and 10.1.1.0/24 use the fol-lowing settings: bandwidth (in kbps): 1000, 500, 100000 and delay (in microsec-onds): 12000, 8000, 100. Which of the following answers correctly identify a value that feeds into the EIGRP metric calculation? (Choose two.) +a. Bandwidth of 101,500 kilobits per second + +b. Bandwidth of about 34,000 kilobits per second + +c. Bandwidth of 500 kilobits per second + +d. Delay of 1200 tens-of-microseconds + +e. Delay of 2010 tens-of-microseconds + +f. Delay of 20100 tens microseconds + +7. Routers R1 and R2 are EIGRP neighbors. R1 has been configured with the eigrp stub connected command. Which of the following are true as a result? (Choose two.) + +a. R1 can learn EIGRP routes from R2, but R2 cannot learn EIGRP routes from R1. + +b. R1 can send IP packets to R2, but R2 cannot send IP packets to R1. + +c. R2 no longer learns EIGRP routes from R1 for routes not connected to R1. + +d. R1 no longer replies to R2’s Query messages. + +e. R2 no longer sends Query messages to R1. + +8. Router R1 lists four routes for subnet 10.1.1.0/24 in the output of the show ip eigrp topology all-links command. The variance 100 command is configured, but no other related commands are configured. Which of the following rules is true regard-ing R1’s decision of what routes to add to the IP routing table? Note that RD refers to reported distance and FD to feasible distance. +a. Adds all routes for which the metric is <= 100 * the best metric among all routes + +b. Adds all routes because of the ridiculously high variance setting + +c. Adds all successor and feasible successor routes + +d. Adds all successor and feasible successor routes for which the metric is <= 100 * the best metric among all routes + + + +From the Library of Alexey Evseenko +158 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +9. A network design shows that R1 has four possible paths from itself to the data cen-ter subnets. Which of the following commands is most likely to show you all the possible next-hop IP addresses for these four possible routes? +a. show ip eigrp topology + +b. show ip eigrp topology all-links + +c. show ip route eigrp + +d. show ip route eigrp all-links + +e. show ip eigrp topology all-learned + +10. Router R1 has been configured for EIGRP. The configuration also includes an ACL with one line—access-list 1 permit 10.10.32.0 0.0.15.255—and the EIGRP con-figuration includes the distribute-list 1 in command. Which of the following routes could not be displayed in the output of the show ip eigrp topology command as a result? (Choose two.) +a. 10.10.32.0 /19 + +b. 10.10.44.0 /22 + +c. 10.10.40.96 /27 + +d. 10.10.48.0 /23 + +e. 10.10.60.0 /30 + +11. The command output that follows was gathered from Router R1. If correctly refer-enced by an EIGRP distribution list that filters outbound Updates, which of the fol-lowing statements are true about the filtering of various prefixes by this prefix list? (Choose three.) + +R1# sh ip prefix-list +ip prefix-list question: 3 entries +seq 5 deny 10.1.2.0/24 ge 25 le 27 +seq 15 deny 10.2.0.0/16 ge 30 le 30 +seq 20 permit 0.0.0.0/0 + +a. Prefix 10.1.2.0/24 will be filtered because of clause 5. + +b. Prefix 10.1.2.224/26 will be filtered because of clause 5. + +c. Prefix 10.2.2.4/30 will be filtered because of clause 15. + +d. Prefix 10.0.0.0/8 will be permitted. + +e. Prefix 0.0.0.0/0 will be permitted. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 159 + +12. R1 has correctly configured EIGRP to filter routes using a route map named ques-tion. The configuration that follows shows the entire route map and related con-figuration. Which of the following is true regarding the filtering action on prefix 10.10.10.0/24 in this case? + +route-map question deny 10 +match ip address 1 +route-map question permit 20 +match ip address prefix-list fred +! +access-list 1 deny 10.10.10.0 0.0.0.255 +ip prefix-list fred permit 10.10.10.0/23 le 25 + +a. It will be filtered because of the deny action in route map clause 10. + +b. It will be allowed because of the double negative (two deny references) in clause 10. + +c. It will be permitted because of matching clause 20’s reference to prefix-list fred. + +d. It will be filtered because of matching the implied deny all route map clause at the end of the route map. + +13. An engineer has typed four different single-line prefix lists in a word processor. The four answers show the four different single-line prefix lists. The engineer then does a copy/paste of the configuration into a router. Which of the lists could match a sub-net whose prefix length is 27? (Choose two.) +a. ip prefix-list fred permit 10.0.0.0/24 ge 16 le 28 + +b. ip prefix-list barney permit 10.0.0.0/24 le 28 + +c. ip prefix-list wilma permit 10.0.0.0/24 ge 25 + +d. ip prefix-list betty permit 10.0.0.0/24 ge 28 + +14. An engineer plans to configure summary routes with the ip summary-address eigrp asn prefix mask command. Which of the following, when added to such a command, would create a summary that includes all four of the following subnets: 10.1.100.0/25, 10.1.101.96/27, 10.1.101.224/28, and 10.1.100.128 /25? +a. 10.1.0.0 255.255.192.0 + +b. 10.1.64.0 255.255.192.0 + +c. 10.1.100.0 255.255.255.0 + +d. 10.1.98.0 255.255.252.0 + + + + + + + + + +From the Library of Alexey Evseenko +160 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +15. R1 has five working interfaces, with EIGRP neighbors existing off each interface. R1 has routes for subnets 10.1.1.0/24, 10.1.2.0/24, and 10.1.3.0/24, with EIGRP integer metrics of roughly 1 million, 2 million, and 3 million, respectively. An engineer then adds the ip summary-address eigrp 1 10.1.0.0 255.255.0.0 command to interface Fa0/0. Which of the following is true? +a. R1 loses and then reestablishes neighborships with all neighbors. + +b. R1 no longer advertises 10.1.1.0/24 to neighbors connected to Fa0/0. + +c. R1 advertises a 10.1.0.0/16 route out Fa0/0, with metric of around 3 million (larg-est metric of component subnets). + +d. R1 advertises a 10.1.0.0/16 route out Fa0/0, with metric of around 2 million (median metric of component subnets). + +16. In a lab, R1 connects to R2, which connects to R3. R1 and R2 each have several working interfaces, all assigned addresses in Class A network 10.0.0.0. Router R3 has some working interfaces in Class A network 10.0.0.0, and others in Class B network 172.16.0.0. The engineer experiments with the auto-summary command on R2 and R3, enabling and disabling the command in various combinations. Which of the fol-lowing combinations will result in R1 seeing a route for 172.16.0.0 /16, instead of the individual subnets of Class B network 172.16.0.0? (Choose two.) +a. auto-summary on R2 and no auto-summary on R3 + +b. auto-summary on R2 and auto-summary on R3 + +c. no auto-summary on R2 and no auto-summary on R3 + +d. no auto-summary on R2 and auto-summary on R3 + +17. Router R1 exists in an enterprise that uses EIGRP as its routing protocol. The show ip route command output on Router R1 lists the following phrase: “Gateway of last resort is 1.1.1.1 to network 2.0.0.0.” Which of the following is most likely to have caused this output to occur on R1? +a. R1 has been configured with an ip default-network 2.0.0.0 command. + +b. R1 has been configured with an ip route 0.0.0.0 0.0.0.0 1.1.1.1 command. + +c. R1 has been configured with an ip route 2.0.0.0 255.0.0.0 1.1.1.1 command. + +d. Another router has been configured with an ip default-network 2.0.0.0 command. + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 161 + +18. Enterprise Router R1 connects an enterprise to the Internet. R1 needs to create and advertise a default route into the enterprise using EIGRP. The engineer creating the implementation plan has chosen to base this default route on the ip route command, rather than using ip default-network. Which of the following are not useful steps with this style of default route configuration? (Choose two.) +a. Create the default route on R1 using the ip route 0.0.0.0 0.0.0.0 outgoing-interface command. + +b. Redistribute the statically configured default route. + +c. Disable auto-summary. + +d. Configure the network 0.0.0.0 command. + +e. Ensure that R1 has no manually configured summary routes using the ip summary-address eigrp command. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +162 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +Building the EIGRP Topology Table + +The overall process of building the EIGRP topology table is relatively straightforward. EIGRP defines some basic topology information about each route for each unique prefix/ length (subnet). This basic information includes the prefix, prefix length, metric informa-tion, and a few other details. EIGRP neighbors exchange topology information, with each router storing the learned topology information in its respective EIGRP topology table. EIGRP on a given router can then analyze the topology table, or topology database, and choose the best route for each unique prefix/length. + +EIGRP uses much simpler topology data than does OSPF, which is a link-state protocol that must describe the entire topology of a portion of a network with its topology data-base. EIGRP, essentially an advanced distance vector protocol, does not need to define nearly as much topology data, nor do EIGRP routers need to run the complex Shortest Path First (SPF) algorithm. This first major section examines the EIGRP topology data-base, how routers create and flood topology data, and some specific issues related to WAN links. + +Seeding the EIGRP Topology Table + +Before a router can send EIGRP topology information to a neighbor, that router must have some topology data in its topology table. Routers can, of course, learn about sub-nets and the associated topology data from neighboring routers. However, to get the process started, each EIGRP router needs to add topology data for some prefixes so that it can then advertise these routes to its EIGRP neighbors. A router’s EIGRP process adds subnets to its local topology table, without learning the topology data from an EIGRP neighbor, from three sources: + + +■ +Key Topic + +■ + + +■ + +Prefixes of connected subnets for interfaces on which EIGRP has been enabled on that router using the network command + +Prefixes of connected subnets for interfaces referenced in an EIGRP neighbor command + +Prefixes learned by the redistribution of routes into EIGRP from other routing proto- +cols or routing information sources + + +After a router adds such prefixes to its local EIGRP topology database, that router can then advertise the prefix information, along with other topology information associated with each prefix, to each working EIGRP neighbor. Each router adds any learned prefix information to its topology table, and then that router advertises the new information to other neighbors. Eventually, all routers in the EIGRP domain learn about all prefixes unless some other feature, such as route summarization or route filtering, alters the flow of topology information. + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 163 + +The Content of EIGRP Update Message + +EIGRP uses five basic protocol messages to do its work: + +■ Hello Key +Topic ■ Update + +■ Query + +■ Reply + +■ ACK (acknowledgment) + +EIGRP uses two messages as part of the topology data exchange process: Update and ACK. The Update message contains the topology information, whereas the ACK acknowledges receipt of the update packet. + +The EIGRP Update message contains the following information: + +■ Prefix + +■ Prefix length + +■ Metric components: bandwidth, delay, reliability, and load + +■ Nonmetric items: MTU and hop count + + +Note Many courses and books over the years have stated that MTU is part of the EIGRP metric. In practice, the MTU has never been part of the metric calculation, although it is included in the topology data for each prefix. + + +To examine this entire process in more detail, see Figure 5-1 and Figure 5-2. + + + +10.11.1.1 Fa0/0 + + + + +10.12.1.1 + +1.2 S0/0/0.1 +B1 +2.2 S0/0/0.2 + +1.6 S0/0/0.1 + +1.1 S0/0/0.1 +WAN1 1.5 +S0/0/0.2 + +2.1 S0/0/0.1 + + +10.9.1.1/24 Fa0/0 + + + + +10.9.1.2/24 + + + +Fa0/0 B2 2.6 S0/0/0.2 + + +2.5 WAN2 Fa0/0 S0/0/0.2 + + + + + +Note: All WAN IP addresses begin with 10.1 + +Figure 5-1 Typical WAN Distribution and Branch Office Design + + + +From the Library of Alexey Evseenko +164 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Figure 5-1 shows a portion of an enterprise network that will be used in several examples in this chapter. Routers B1 and B2 represent typical branch office routers, each with two Frame Relay permanent virtual circuits (PVC) connected back to the main site. WAN1 and WAN2 are WAN distribution routers, each of which could have dozens or hundreds of PVCs. + +The routers in Figure 5-1 have been configured and work. For EIGRP, all routers have been configured with as many defaults as possible, with the only configuration related to EIGRP being the router eigrp 1 and network 10.0.0.0 commands on each router. + +Next, consider what Router B1 does for its connected route for subnet 10.11.1.0/24, which is located on B1’s LAN. B1 matches its Fa0/0 interface IP address (10.11.1.1) because of +its network 10.0.0.0 configuration command. So, as mentioned earlier, B1 seeds its own topology table with an entry for this prefix. This topology table entry also lists the inter-face bandwidth of the associated interface and delay of the associated interface. Using default settings for Fast Ethernet interfaces, B1 uses a bandwidth of 100,000 kbps (the same as 100 Mbps) and a delay of 10, meaning 10 tens-of-microseconds. Router B1 also includes a default setting for the load (1) and reliability (255), even though the router, using the default K-value settings, will not use these values in its metric calculations. Finally, B1 adds to the topology database the MTU of the local interface and a hop count of 0 because the subnet is connected. + +Now that B1 has added some topology information to its EIGRP topology database, Figure 5-2 shows how B1 propagates the topology information to router WAN1 and beyond. + + + + + + + +Interface Settings: Delay 10 Bandwidth 100,000 + + + +1 + + + +B1 + +2 Topology Table: +Subnet 10.11.1.0/24 Delay = 10 + 2000 = 2010 +Update: Bandwidth = Min(100,000 Subnet 10.11.1.0/24 (MTU, Load, Reliability, Bandwidth 100,000 Hops) +or 1544) +Delay 10 +(MTU, Load, Reliability, Hops) +Interface S0/0/0.1 WAN1 +Delay 2000 Bandwidth 1544 + + + + +3 Update: +Subnet 10.11.1.0/24 Delay 2010 Bandwidth 1544 (MTU, Load, Reliability, Hops) + + +Figure 5-2 Contents of EIGRP Update Messages + +The steps in Figure 5-2 can be explained as follows: + +Step 1. B1 advertises the prefix (10.11.1.0/24) using an EIGRP Update message. The message includes the four metric components, plus MTU and hop count— essentially the information in B1’s EIGRP topology table entry for this prefix. +Step 2. WAN1 receives the Update message and adds the topology information for 10.11.1.0/24 to its own EIGRP topology table, with these changes: + +■ WAN1 considers the interface on which it received the Update (S0/0/0.1) to be the outgoing interface of a potential route to reach 10.11.1.0/24. + +■ WAN1 adds the delay of S0/0/0.1 (2000 tens-of-microseconds per Figure 5-2) to the delay listed in the Update message. + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 165 + +■ WAN1 compares the bandwidth of S0/0/0.1 (1544 kbps per Figure +5-2) to the bandwidth listed in the Update message (100,000 kbps) and chooses the lower value (1544) as the bandwidth for this route. + +■ WAN1 also updates load (highest value), reliability (lowest value), and MTU (lowest value) based on similar comparisons, and adds 1 to the hop count. +Step 3. WAN1 then sends an Update to its neighbors, with the metric components listed in their own topology table. + +This example provides a good backdrop to understand how EIGRP uses cumulative delay and minimum bandwidth in its metric calculation. Note that at Step 2, Router WAN1 adds to the delay value but does not add the bandwidth. For bandwidth, WAN1 simply chooses the lowest bandwidth, comparing the bandwidth of its own interface (S0/0/0.1) with the bandwidth listed in the received EIGRP update. + +Next, consider this logic on other routers (not shown in the figure) as WAN1 floods this routing information throughout the enterprise. WAN1 then sends this topology informa-tion to another neighbor, and that router sends the topology data to another, and so on. If the bandwidth of those links were 1544 or higher, the bandwidth setting used by those routers would remain the same, because each router would see that the routing update’s bandwidth (1544 kbps) was lower than the link’s bandwidth. However, each router would add something to the delay. + +As a final confirmation of the contents of this Update process, Example 5-1 shows the details of the EIGRP topology database for prefix 10.11.1.0/24 on both B1 and WAN1. + +Example 5-1 Topology Database Contents for 10.11.1.0/24, on B1 and WAN1 + +! On Router B1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +B1# show ip eigrp topology 10.11.1.0/24 +IP-EIGRP (AS 1): Topology entry for 10.11.1.0/24 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 28160 +Routing Descriptor Blocks: +0.0.0.0 (FastEthernet0/0), from Connected, Send flag is 0x0 +Composite metric is (28160/0), Route is Internal +Vector metric: +Minimum bandwidth is 100000 Kbit +Total delay is 100 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 0 + +! On Router WAN1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +WAN1# show ip eigrp topology 10.11.1.0/24 +IP-EIGRP (AS 1): Topology entry for 10.11.1.0/24 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2172416 +Routing Descriptor Blocks: + + + + +From the Library of Alexey Evseenko +166 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +10.1.1.2 (Serial0/0/0.1), from 10.1.1.2, Send flag is 0x0 +Composite metric is (2172416/28160), Route is Internal +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 20100 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 + +The highlighted portions of the output match the details shown in Figure 5-2, but with one twist relating to the units on the delay setting. The Cisco IOS delay command, which lets you set the delay, along with the data stored in the EIGRP topology database, uses a unit of tens-of-microseconds. However, the show interfaces and show ip eigrp topology commands list delay in a unit of microseconds. For example, WAN1’s listing of “20100 microseconds” matches the “2010 tens-of-microseconds” shown in Figure 5-2. + +The EIGRP Update Process + +So far, this chapter has focused on the detailed information that EIGRP exchanges with a neighbor about each prefix. This section takes a broader look at the process. + +When EIGRP neighbors first become neighbors, they begin exchanging topology infor-mation using Update messages using these rules: + + +■ Key +Topic +■ + + + +■ + + + + +■ + + +■ + +When a neighbor first comes up, the routers exchange full updates, meaning that the routers exchange all topology information. + +After all prefixes have been exchanged with a neighbor, the updates cease with that neighbor if no changes occur in the network. There is no subsequent periodic reflooding of topology data. + +If something changes—for example, one of the metric components changes, links fail, links recover, or new neighbors advertise additional topology information—the routers send partial updates about only the prefixes whose status or metric compo-nents have changed. + +If neighbors fail and then recover, or new neighbor adjacencies are formed, full updates occur over these adjacencies. + +EIGRP uses Split Horizon rules on most interfaces by default, which impacts exactly +which topology data EIGRP sends during both full and partial updates. + + +Split Horizon, the last item in the list, needs a little more explanation. Split Horizon lim-its the prefixes that EIGRP advertises out an interface. Specifically, if the currently best route for a prefix lists a particular outgoing interface, Split Horizon causes EIGRP to not include that prefix in the Update sent out that same interface. For example, router WAN1 uses S0/0/0.1 as its outgoing interface for subnet 10.11.1.0/24. So, WAN1 would not advertise prefix 10.11.1.0/24 in its Update messages sent out S0/0/0.1. + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 167 + +To send the Updates, EIGRP uses the Reliable Transport Protocol (RTP) to send the EIGRP Updates and confirm their receipt. On point-to-point topologies such as serial links, MPLS VPNs, and Frame Relay networks when using point-to-point subinterfaces, the EIGRP Update and ACK messages use a simple process of acknowledging each Update with an ACK. On multiaccess data links, EIGRP typically sends Update mes-sages to multicast address 224.0.0.10 and expects a unicast EIGRP ACK message from each neighbor in reply. RTP manages that process, setting timers so that the sender of an Update waits a reasonable time, but not too long, before deciding whether all neighbors received the Update or whether one or more neighbors did not reply with an ACK. + +Interestingly, although EIGRP relies on the RTP process, network engineers cannot manipulate how this works. + +WAN Issues for EIGRP Topology Exchange + +With all default settings, after you enable EIGRP on all the interfaces in an internetwork, the topology exchange process typically does not pose any problems. However, a few scenarios exist, particularly on Frame Relay, which can cause problems. This section sum-marizes two issues and shows the solutions. + +Split Horizon Default on Frame Relay Multipoint Subinterfaces + +Cisco IOS support for Frame Relay allows the configuration of IP addresses on the physi-cal serial interface, multipoint subinterfaces, or point-to-point subinterfaces. Additionally, IP packets can be forwarded over a PVC even when the routers on the opposite ends do not have to use the same interface or subinterface type. As a result, many small intrica-cies exist in the operation of IP and IP routing protocols over Frame Relay, particularly related to default settings on different interface types. + +Frame Relay supports several reasonable configuration options using different interfaces and subinterfaces, each meeting different design goals. For example, if a design includes a few centralized WAN distribution routers, with PVCs connecting each branch router to each distribution router, both distribution and branch routers might use point-to-point subinterfaces. Such a choice makes the Layer 3 topology simple, with all links acting like point-to-point links from a Layer 3 perspective. This choice also removes issues such as Split Horizon. + +In some cases, a design might include a small set of routers that have a full mesh of PVCs connecting each. In this case, multipoint subinterfaces might be used, consuming a single subnet and reducing the consumption of the IP address space. This choice also reduces the number of subinterfaces. + +Both options—using point-to-point subinterfaces or using multipoint subinterfaces— have legitimate reasons for being used. However, when using the multipoint subinterface option, a particular EIGRP issue can occur when the following are true: + +■ Three or more routers, connected over a Frame Relay network, are configured as part of a single subnet. + + + + +From the Library of Alexey Evseenko +168 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ The routers use multipoint interfaces. + +■ Either permanently or for a time, a full mesh of PVCs between the routers does not exist. + +For example, consider Router WAN1 shown earlier in Figure 5-1 and referenced again in Figure 5-3. In the earlier configurations, the WAN distribution routers and branch rout-ers all used point-to-point subinterfaces and a single subnet per VC. To see the problem raised in this section, consider that same internetwork, but now the engineer has chosen to configure WAN1 to use a multipoint subinterface and a single subnet for WAN1, B1, and B2, as shown in Figure 5-3. + +2 Update 10.11.1.0/24 . . . 10.11.1.0/24 + + +10.1.1.2/29 +B1 + +10.1.1.1/29 +S0/0/0.9 WAN1 + + + + +1 No PVC No Hellos +No Neighbors + +10.12.1.0/24 + + + +. . . But not here! (Split Horizon) + + + +10.1.1.3/29 B2 + + +Figure 5-3 Partial Mesh, Central Sites (WAN1) Uses Multipoint Subinterface + +The first issue to consider in this design is that B1 and B2 will not become EIGRP neigh-bors with each other, as noted with Step 1 in the figure. EIGRP routers must be reach-able using Layer 2 frames before they can exchange EIGRP Hello messages and become EIGRP neighbors. In this case, there is no PVC between B1 and B2. B1 exchanges Hellos with WAN1, and they become neighbors, as will B2 with WAN1. However, routers do not forward received EIGRP Hellos, so WAN1 will not receive a Hello from B1 and forward it to B2 or vice versa. In short, although in the same subnet (10.1.1.0/29), B1 and B2 will not become EIGRP neighbors. + +The second problem occurs because of Split Horizon logic on Router WAN1, as noted with Step 2 in the figure. As shown with Step 2, B1 could advertise its routes to WAN1, and WAN1 could advertise those routes to B2—and vice versa. However, with default settings, WAN1 will not advertise those routes because of its default setting of Split Horizon (a default interface subcommand setting of ip split-horizon eigrp asn). As a result, WAN1 receives the Update from B1 on its S0/0/0.9 subinterface, but Split Horizon prevents WAN1 from advertising that topology data to B2 in Updates sent out interface S0/0/0.9, and vice versa. + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 169 + +The solution is somewhat simple—just configure the no ip split-horizon eigrp asn com-mand on the multipoint subinterface on WAN1. The remote routers, B1 and B2 in this case, still do not become neighbors, but that does not cause a problem by itself. With Split Horizon disabled on WAN1, B1 and B2 learn routes to the other branch’s subnets. Example 5-2 lists the complete configuration and the command to disable Split Horizon. Also shown in Example 5-2 is the output of the show ip eigrp interfaces detail s0/0/0.9 command, which shows the operational state of Split Horizon on that subinterface. + + +Note Frame Relay configuration is considered a prerequisite, because it is part of the CCNA exam and courses. Example 5-2 uses frame-relay interface-dlci commands and relies on Inverse ARP. However, if frame-relay map commands were used instead, dis-abling Inverse ARP, the EIGRP details discussed in this example would remain unchanged. + + +Example 5-2 Frame Relay Multipoint Configuration on WAN1 + +! On Router WAN1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +interface Serial0/0/0 +no ip address +encapsulation frame-relay + +interface Serial0/0/0.9 multipoint +ip address 10.1.1.1 255.255.255.248 +no ip split-horizon eigrp 1 +frame-relay interface-dlci 103 +frame-relay interface-dlci 104 +! +router eigrp 1 +network 10.0.0.0 + +! Check Split Horizon State: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +WAN1# show ip eigrp interfaces detail s0/0/0.9 +EIGRP-IPv4 Interfaces for AS(1) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Se1/0 1 0/0 0/0 59 0/16 300 0 +Hello-interval is 5, Hold-time is 15 +Split-horizon is disabled +Next xmit serial +Packetized sent/expedited: 3/0 +Hello's sent/expedited: 248/2 +Un/reliable mcasts: 0/0 Un/reliable ucasts: 4/4 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 + + + + + + + +From the Library of Alexey Evseenko +170 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Retransmissions sent: 0 Out-of-sequence rcvd: 0 +Topology-ids on interface - 0 +Authentication mode is not set + + +Note The [no] ip split-horizon command controls Split Horizon behavior for RIP; the [no] ip split-horizon eigrp asn command controls Split Horizon behavior for EIGRP. + + + +EIGRP WAN Bandwidth Control + +In a multiaccess WAN, one physical link passes traffic for multiple data link layer des-tinations. For example, a WAN distribution router connected to many branches using Frame Relay might literally terminate hundreds, or even thousands, of Frame Relay PVCs. + +In a nonbroadcast multiaccess (NBMA) medium such as Frame Relay, when a router needs to send EIGRP updates, the Updates cannot be multicasted at Layer 2. So, the router must send a copy of the Update to each reachable neighbor. For a WAN distribution router with many Frame Relay PVCs, the sheer amount of traffic sent over the Frame Relay access link might overload the link. + +The EIGRP WAN bandwidth control allows the engineer to protect a multiaccess Frame Relay interface from being overrun with too much EIGRP message traffic. By default, +a router sends EIGRP messages out an interface but only up to 50 percent of the band-width defined on the interface with the bandwidth command. The engineer can adjust this percentage using the ip bandwidth-percent eigrp asn percent interface/subinter-face subcommand. Regardless of the percentage, Cisco IOS then limits the rate of send-ing the EIGRP messages so that the rate is not exceeded. To accomplish this, Cisco IOS queues the EIGRP messages in memory, delaying them briefly. + +The command to set the bandwidth percentage is simple, but there are a few caveats to keep in mind when trying to limit the bandwidth consumed by EIGRP: + +■ The Cisco IOS default for bandwidth on serial interfaces and subinterfaces is 1544 (kbps). + +■ EIGRP limits the consumed bandwidth based on the percentage of interface/subin-terface bandwidth. + +■ This feature keys on the bandwidth of the interface or subinterface through which the neighbor is reachable, so don’t set only the physical interface bandwidth and for-get the subinterfaces. + +■ Recommendation: Set the bandwidth of point-to-point links to the speed of the Committed Information Rate (CIR) of the single PVC on the subinterface. + +■ General recommendation: Set the bandwidth of multipoint subinterfaces to around the total CIR for all VCs assigned to the subinterface. + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 171 + +■ Note that for multipoint subinterfaces, Cisco IOS WAN bandwidth control first divides the subinterface bandwidth by the number of configured PVCs and then determines the EIGRP percentage based on that number. + +For example, consider Figure 5-4, which shows a router with one multipoint subinterface and one point-to-point subinterface. + + +B1 + + + +B2 + +S0/0/0.20 Multipoint + +B3 +WAN1 S0/0/0.21 Point-to-Point + +B4 + +Figure 5-4 WAN1, One Multipoint, One Point-to-Point + +With the configuration shown in Example 5-3, WAN1 uses the following bandwidth, at most, with each neighbor: + +■ B1, B2, and B3: 20 kbps (20% of 300 kbps / 3 VCs) + +■ B4: 30 kbps (30% of 100 kbps) + +Example 5-3 Configuration of WAN1, One Multipoint, One Point-to-Point + +! On Router WAN1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +interface Serial0/0/0.20 multipoint +ip address 172.16.1.1 255.255.255.240 +frame-relay interface-dlci 201 +frame-relay interface-dlci 202 +frame-relay interface-dlci 203 +bandwidth 300 +ip bandwidth-percent eigrp 1 20 +! +interface Serial0/0/0.21 point-to-point +ip address 172.16.1.17 255.255.255.252 +frame-relay interface-dlci 221 +bandwidth 100 +ip bandwidth-percent eigrp 1 30 + + + + + + +From the Library of Alexey Evseenko +172 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Building the IP Routing Table + +An EIGRP router builds IP routing table entries by processing the data in the topology table. Unlike OSPF, which uses a computationally complex SPF process, EIGRP uses a computationally simple process to determine which, if any, routes to add to the IP routing table for each unique prefix/length. This part of the chapter examines how EIGRP choos-es the best route for each prefix/length and then examines several optional tools that can influence the choice of routes to add to the IP routing table. + +Calculating the Metrics: Feasible Distance and Reported Distance + +The EIGRP topology table entry, for a single prefix/length, lists one or more possible routes. Each possible route lists the various component metric values—bandwidth, delay, and so on. Additionally, for connected subnets, the database entry lists an outgoing inter-face. For routes not connected to the local router, in addition to an outgoing interface, the database entry also lists the IP address of the EIGRP neighbor that advertised the route. + +EIGRP routers calculate an integer metric based on the metric components. Interestingly, an EIGRP router does this calculation both from its own perspective and from the per-spective of the next-hop router of the route. The two calculated values are as follows: + + +■ Key +Topic +■ + +Feasible Distance (FD): Integer metric for the route, from the local router’s perspec-tive, used by the local router to choose the best route for that prefix. + +Reported Distance (RD): Integer metric for the route, from the neighboring router’s perspective (the neighbor that told the local router about the route). Used by the +local router when converging to a new route. + + + +Note Some texts use the term Advertised Distance (AD) instead of Reported Distance (RD) as used in this book. Be ready for either term on the CCNP ROUTE exam. However, this book uses RD exclusively. + + +Routers use the FD to determine the best route, based on the lowest metric, and use the RD when falling back to an alternative route when the best route fails (EIGRP’s use of the RD is explained in the upcoming section “Successor and Feasible Successor Concepts”). Focusing on the FD, when a router has calculated the integer FD for each possible route to reach a single prefix/length, that router can then consider adding the lowest-metric route to the IP routing table. + +As a reminder, the following formula shows how EIGRP calculates the metric, assuming default settings of the EIGRP metric weights (K-values). The metric calculation grows when the slowest bandwidth in the end-to-end route decreases (the slower the bandwidth, the worse the metric), and its metric grows (gets worse) when the cumulative delay grows. Also, note that the unit of measure for slowest-bandwidth is kbps, and the unit of mea-sure for cumulative-delay is tens-of-microseconds. +Metric = 256 * [(107 / slowest-bandwidth) + cumulative-delay] + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 173 + +An example certainly helps in this case. Figure 5-5 repeats some information about the topology exchange process between Routers B1 and WAN1 (refer to Figure 5-1), essen-tially showing the metric components as sent by B1 to WAN1 (Step 1) and the metric components from WAN1’s perspective (Step 2). + + +2 + +1 Update: +Subnet 10.11.1.0/24 Delay 10 Bandwidth 100,000 (MTU, Load, Reliability, Hops) + + +Topology Table: Subnet 10.11.1.0/24 +Delay = 10 + 2000 = 2010 Bandwidth = Min(100,000 or 1544) +(MTU, Load, Reliability, Hops) + + + +Interface Settings: Delay 10 Bandwidth 100,000 + + +B1 + + +Interface Settings: Delay 2000 Bandwidth 1544 + +WAN1 + + +Metrics: + +3 RD = 256 (10,000,000 / 100,000) + 256 (10) = 28,160 + +4 FD =256 (10,000,000 / 1,544) + 256 (2010) = 2,172,416 + +Figure 5-5 Example Calculation of RD and FD on Router WAN1 + +Steps 3 and 4 in Figure 5-5 show WAN1’s calculation of the RD and FD for 10.11.1.0/24, respectively. Router WAN1 takes the metric components as received from B1, and plugs them into the formula, to calculate the RD, which is the same integer metric that Router B1 would have calculated as its FD. Step 4 shows the same formula but with the metric components as listed at Step 2—after the adjustments made on WAN1. Step 4 shows WAN1’s FD calculation, which is much larger because of the much lower constraining bandwidth plus the much larger cumulative delay. + +WAN1 chooses its best route to reach 10.11.1.0/24 based on the lowest FD among all possible routes. Looking back to the much more detailed Figure 5-1, presumably a couple of other routes might have been possible, but WAN1 happens to choose the route shown in Figure 5-5 as its best route. As a result, WAN1’s show ip route command lists the FD calculated in Figure 5-5 as the metric for this route, as shown in Example 5-4. + +Example 5-4 Router WAN1’s EIGRP Topology and IP Route Information for 10.11.1.0/24 + +! Below, note that WAN1's EIGRP topology table lists two possible next-hop +! routers: 10.1.1.2 (B1) and 10.9.1.2 (WAN2). The metric for each route, +! the first number in parentheses, shows that the lower metric route is the one +! through 10.1.1.2 as next-hop. Also note that the metric components +! match Figure 5-5 . +! +WAN1# show ip eigrp topo 10.11.1.0/24 +IP-EIGRP (AS 1): Topology entry for 10.11.1.0/24 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2172416 +Routing Descriptor Blocks: +10.1.1.2 (Serial0/0/0.1), from 10.1.1.2, Send flag is 0x0 +Composite metric is (2172416/28160), Route is Internal + + + + +From the Library of Alexey Evseenko +174 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 20100 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +10.9.1.2 (FastEthernet0/0), from 10.9.1.2, Send flag is 0x0 +Composite metric is (2174976/2172416), Route is Internal +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 20200 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 2 +! +! The next command not only lists the IP routing table entry for 10.11.1.0/24, +! it also lists the metric (FD), and components of the metric. +! +WAN1# show ip route 10.11.1.0 +Routing entry for 10.11.1.0/24 +Known via "eigrp 1", distance 90, metric 2172416, type internal +Redistributing via eigrp 1 +Last update from 10.1.1.2 on Serial0/0/0.1, 00:02:42 ago +Routing Descriptor Blocks: +* 10.1.1.2, from 10.1.1.2, 00:02:42 ago, via Serial0/0/0.1 +Route metric is 2172416 , traffic share count is 1 +Total delay is 20100 microseconds, minimum bandwidth is 1544 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 1 +! +! Below, the route for 10.11.1.0/24 is again listed, with the metric (FD), and +! the same next-hop and outgoing interface information. +! +WAN1# show ip route eigrp +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +D 10.11.1.0/24 [90/2172416 ] via 10.1.1.2, 00:10:40, Serial0/0/0.1 +D 10.12.1.0/24 [90/2172416] via 10.1.1.6, 00:10:40, Serial0/0/0.2 +D 10.1.2.0/30 [90/2172416] via 10.9.1.2, 00:10:40, FastEthernet0/0 +D 10.1.2.4/30 [90/2172416] via 10.9.1.2, 00:10:40, FastEthernet0/0 + + +EIGRP Metric Tuning + +EIGRP metrics can be changed using several methods: setting interface bandwidth, set-ting interface delay, changing the metric calculation formula by configuring K-values, and + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 175 + +even by adding to the calculated metric using offset lists. In practice, the most reasonable and commonly used methods are to set the interface delay and the interface bandwidth. This section examines all the methods, in part so that you will know which useful tools exist and in part to make you aware of some other design issues that then might impact the routes chosen by EIGRP. + +Configuring Bandwidth and Delay + +The bandwidth and delay interface subcommands set the bandwidth and delay associ-ated with the interface. The commands themselves require little thought, other than keep-ing the units straight. The unit for the bandwidth command is kilobits/second, and the delay command uses a unit of tens-of-microseconds. + +If a design requires that you influence the choice of route by changing bandwidth or delay, setting the delay value is typically the better choice. Cisco IOS uses the bandwidth setting of an interface for many other reasons: calculating interface utilization, as the basis for several QoS parameters, and for Simple Network Management Protocol (SNMP) statistics reporting. However, the delay setting has little influence on other Cisco IOS features besides EIGRP, so the better choice when influencing EIGRP metrics is to tune the delay. + +Table 5-2 lists some of the common default values for both bandwidth and delay. As a reminder, show commands list the bandwidth in kbps, which matches the bandwidth command, but lists the delay in microseconds, which does not match the tens-of-microseconds unit of the delay command. + +Table 5-2 Common Defaults for Bandwidth and Delay + + +Interface Type +Serial + +GigE + +FastE + +Ethernet + +Bandwidth (kbps) +1544 + +1,000,000 + +100,000 + +10,000 + +Delay (Microseconds) +20,000 + +10 + +100 + +1000 + + + +Note that on LAN interfaces that can run at different speeds, the bandwidth and delay settings default based on the current actual speed of the interface. + +Choosing Bandwidth Settings on WAN Subinterfaces + +Frame Relay and Metro Ethernet installations often use an access link with a particular physical sending rate (clock rate if you will) but with the contracted speed, over time, being more or less than the speed of the link. For example, with Frame Relay, the provid-er might supply a full T1 access link, so configuring bandwidth 1544 for such an inter-face is reasonable. However, the subinterfaces have one or more PVCs associated with them, and those PVCs each have Committed Information Rates (CIR) that are typically + + + + +From the Library of Alexey Evseenko +176 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +less than the access link’s clock speed. However, the cumulative CIRs for all PVCs often exceed the clock rate of a physical interface. Conversely, MetroE designs use Ethernet access links of 10-Mbps, 100-Mbps, or 1-Gbps actual link speed, but often the business contract limits the amount of traffic to some number below that link speed. + +Choosing a useful interface bandwidth setting on the subinterfaces in a Frame Relay or MetroE design requires some thought, with most of the motivations for choosing one number or another being unrelated to EIGRP. For example, imagine the network shown in Figure 5-6 . Router WAN1 has a single T1 (1.544-Mbps) access link. That interface has one multipoint subinterface, with three PVCs assigned to it. It also has nine other point-to-point subinterfaces, each with a single PVC assigned. + + +B1 + + + +B2 + + +S0/0/0.20 Multipoint + +B3 +WAN1 + + +B4 +S0/0/0.21 Point-to-Point +S0/0/0.29 Point-to-Point + + + +B12 + +Figure 5-6 One Multipoint and Nine Point-to-Point Subinterfaces + +For the sake of discussion, the design in Figure 5-6 oversubscribes the T1 access link off Router WAN1 by a 2:1 factor. Assume that all 12 PVCs have a CIR of 256 kbps, making the total bandwidth for the 12 PVCs roughly 3 Mbps. The design choice to oversubscribe the access link might be reasonable given the statistical chance of all sites sending at the same time. + +Now imagine that Router WAN1 has been configured with subinterfaces as shown in the figure: + +■ S0/0/0.20: Multipoint, 3 PVCs + +■ S0/0/0.21 through S0/0/0.29: Point-to-point, 1 PVC each + +Next, consider the options for setting the bandwidth command’s value on these ten sub-interfaces. The point-to-point subinterfaces could be set to match the CIR of each PVC (256 kbps, in this example). You could choose to set the bandwidth based on the CIR +of all combined PVCs on the multipoint subinterface—in this case, setting bandwidth 768 on multipoint subinterface s0/0/0.20. However, these bandwidths would total about + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 177 + +3 Mbps—twice the actual speed of WAN1’s access link. Alternatively, you could set the various bandwidths so that the total matches the 1.5 Mbps of the access link. Or you could split the difference, knowing that during times of low activity to most sites, that the sites with active traffic get more than their CIR’s worth of capacity anyway. + +As mentioned earlier, these bandwidth settings impact much more than EIGRP. The set-tings impact interface statistics, both in show commands and in SNMP reporting. They impact QoS features to some extent as well. Given that the better option for setting EIGRP metrics is to set the interface delay, EIGRP metric tuning might not be the driving force behind the decision as to what bandwidth values to use. However, some installa-tions might change these values over time while trying to find the right compromise num-bers for features other than EIGRP. So, you need to be aware that changing those values might result in different EIGRP metrics and impact the choices of best routes. + +Similar issues exist on the more modern Layer 2 WAN services like MetroE, particularly with the multipoint design of Virtual Private LAN Service (VPLS). Figure 5-7 shows a design that might exist after migrating the internetwork of Figure 5-6 to VPLS. Router WAN1 has been replaced by a Layer 3 switch, using a Gigabit interface to connect to the VPLS service. The remote sites might use the same routers as before, using a Fast Ethernet interface, and might be replaced with Layer 3 switch hardware as well. + +VPLS + +B1 + + + + +B2 + +• • • + +Gig0/1 + +802.1Q +Trunk WAN1 + +Shape 200M + + + +B12 + +Figure 5-7 VPLS Service—Issues in Choosing Bandwidth + +Concentrating on the mechanics of what happens at the central site, WAN1 might use 802.1Q trunking. With 12 remote sites, WAN1 configures 12 VLAN interfaces, one per VLAN, with a different subnet used for the connection to each remote branch. Such a design, from a Layer 3 perspective, looks like the age-old Frame Relay design with a point-to-point link from the main site to each remote branch. + +Additionally, the VPLS business contract might specify that WAN1 cannot send more than 200 Mbps of traffic into the VPLS cloud, with the excess being discarded by the VPLS service. To prevent unnecessary discards, the engineer likely configures a feature called shaping, which reduces the average rate of traffic leaving the Gi0/1 interface of WAN1 (regardless of VLAN). To meet the goal of 200 Mbps, WAN1 would send only part of the time—in this case averaging a sending rate of 1/5th of the time—so that the average rate is 1/5th of 1 Gbps, or 200 Mbps. + + + +From the Library of Alexey Evseenko +178 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Of note with the shaping function, the shaping feature typically limits the cumulative traf-fic on the interface, not per VLAN (branch). As a result, if the only traffic waiting to be sent by WAN1 happens to be destined for branch B1, WAN1 sends 200 Mbps of traffic to just branch B1. + +Pulling the discussion back around to EIGRP, as with Frame Relay, other design and imple-mentation needs can drive the decision to set or change the bandwidth on the associated interfaces. In this case, Layer 3 switch WAN1 probably has 12 VLAN interfaces. Each VLAN interface can be set with a bandwidth that influences EIGRP route choices. Should this setting be 1/12th of 1 Gbps, what is the speed at which the bits are actually sent? Should the setting be 1/12th of 200 Mbps, what is the shaping rate? Or knowing that a site might get most or all of that 200 Mbps for some short period of time, should the bandwidth be set somewhere in between? As with Frame Relay, there is no set answer. For the sake of EIGRP, be aware that changes to the bandwidth settings impact the EIGRP metrics. + +Metric Weights (K-values) +Engineers can change the EIGRP metric calculation by configuring the weightings (also called K-values) applied to the EIGRP metric calculation. To configure new values, use the metric weights tos k1 k2 k3 k4 k5 command in EIGRP configuration mode. To configure this command, configure any integer 0–255 inclusive for the five K-values. By default, K1 = K3 = 1, and the others default to 0. The tos parameter has only one valid value, 0, and can be otherwise ignored. + +The full EIGRP metric formula is as follows. Note that some items reduce to 0 if the cor-responding K-values are also set to 0. + +Metric = K1 * BWmin + 256 - load + K3 * delay * K4 + reliability * 256 +K2 * BW +min +K5 + +7 +10 +BWmin = least-bandwidth + +With default K-values, the EIGRP metric calculation can be simplified to the following formula: +7 +10 +Metric = least-bandwidth + cumulative-delay * 256 + +EIGRP requires that two routers’ K-values match before those routers can become neighbors. Also note that Cisco recommends against using K-values K2, K4, and K5, because a nonzero value for these parameters causes the metric calculation to include interface load and reli-ability. The load and reliability change over time, which causes EIGRP to reflood topology data, and might cause routers to repeatedly choose different routes (route flapping). + +Offset Lists +EIGRP offset lists, the final tool for manipulating the EIGRP metrics listed in this chapter, allow an engineer to simply add a value—an offset, if you will—to the calculated integer metric for a given prefix. To do so, an engineer can create and enable an EIGRP offset list that defines the value to add to the metric, plus some rules regarding which routes should be matched and therefore have the value added to their computed FD. + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 179 + +An offset list can perform the following functions: + +■ Match prefixes/prefix lengths using an IP ACL, so that the offset is applied only to routes matched by the ACL with a permit clause. + +■ Match the direction of the Update message, either sent (out) or received (in). + +■ Match the interface on which the Update is sent or received. + +■ Set the integer metric added to the calculation for both the FD and RD calculations for the route. + +The configuration itself uses the following command in EIGRP configuration mode, in addition to any referenced IP ACLs: +offset-list { access-list-number | access-list-name} {in | out} offset [interface-type interface-number] + +For example, consider again branch office Router B1 in Figure 5-1, with its connection to both WAN1 and WAN2 over a Frame Relay network. Formerly, WAN1 calculated a metric of 2,172,416 for its route, through B1, to subnet 10.11.1.0/24. (Refer to Figure 5-5 for the math behind WAN1’s calculation of its route to 10.11.1.0/24.) Router B1 also cal-culated a value of 28,160 for the RD of that same direct route. Example 5-5 shows the addition of an offset on WAN1, for received updates from Router B1. + +Example 5-5 Inbound Offset of 3 on WAN1, for Updates Received on S0/0/0.1 + +WAN1(config)# access-list 11 permit 10.11.1.0 +WAN1(config)# router eigrp 1 +WAN1(config-router)# offset-list 11 in 3 Serial0/0/0.1 +WAN1(config-router)# end + +Mar 2 11:34:36.667: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 10.1.1.2 (Serial0/0/0.1) is resync: peer graceful-restart +WAN1# show ip eigrp topo 10.11.1.0/24 +IP-EIGRP (AS 1): Topology entry for 10.11.1.0/24 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2172416 +Routing Descriptor Blocks: +10.1.1.2 (Serial0/0/0.1), from 10.1.1.2, Send flag is 0x0 +Composite metric is (2172419/28163 ), Route is Internal +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 20100 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +! output omitted for brevity + + + + + + +From the Library of Alexey Evseenko +180 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The configuration has two key elements: ACL 11 and the offset-list command. ACL 11 matches prefix 10.11.1.0, and that prefix only, with a permit clause. The offset-list 11 in 3 s0/0/0.1 command tells Router WAN1 to examine all EIGRP Updates received on S0/0/0.1, and if prefix 10.11.1.0 is found, add 3 to the computed FD and RD for that prefix. + +The show ip eigrp topology 10.11.1.0/24 command in Example 5-5 shows that the FD and RD, highlighted in parentheses, are now each three larger as compared with the ear-lier metrics. + +Next, continuing this same example, Router B1 has now been configured to add an offset (4) in its sent updates to all routers, but for prefix 10.11.1.0/24 only, as demonstrated in Example 5-6. + +Example 5-6 Outbound Offset of 4 on B1, for Updates Sent to All Neighbors, 10.11.1.0/24 + +B1(config)# access-list 12 permit 10.11.1.0 +B1(config)# router eigrp 1 +B1(config-router)# offset-list 12 out 4 +B1(config-router)# end +B1# + +! Back to router WAN1 +WAN1# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.9.1.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.11.1.0/24, 1 successors, FD is 2172419 +via 10.1.1.2 ( 2172423/28167), Serial0/0/0.1 +! lines omitted for brevity + +Note that the metrics, both FD and RD, are now four larger than in Example 5-5. + + +Unequal Metric Route Load Sharing + +Convergence to a feasible successor route should happen within a second after a router realizes the successor route has failed. Even in large well-designed networks, particularly with features like stub routers and route summarization in use, convergence can still hap-pen in a reasonable amount of time even when going active. The next feature, load shar-ing, takes convergence to another level, giving instantaneous convergence, while reaching other goals as well. + +Cisco IOS allows routing protocols to place multiple routes into the routing table for an individual prefix/length. Cisco IOS then balances traffic across those routes, by default balancing traffic on a per-destination IP address basis. + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 181 + +Load balancing, sometimes called load sharing, provides a primary benefit of making use of the available bandwidth, rather than using some links as simply backup links. For example, with the two-PVC design shown previously in Figure 5-1, without load sharing, a branch router would send traffic over one PVC, but not both. With load sharing, some traffic would flow over each PVC. + +A useful secondary benefit—faster convergence—occurs when using load balancing. By placing multiple routes into the routing table for a single prefix, convergence happens essentially instantly. For example, if a branch router has two routes for each data center subnet—one using each PVC that connects the branch to the core—and one of the routes fails, the other route is already in the routing table. In this case, the router does not need to look for FS routes nor go active on the route. The router uses the usual EIGRP conver-gence tools only when all such routes are removed from the routing table. + +The load-balancing configuration requires two commands, one of which already defaults to a reasonable setting. First, you need to define the number of allowed routes for each prefix/prefix length using the maximum-paths number EIGRP subcommand. The default setting of 4 is often high enough, because most internetworks do not have enough redun-dancy to have more than four possible routes. + + +Note The maximum number of paths varies based on Cisco IOS version and router plat-form. However, for the much older Cisco IOS versions, the maximum was 6 routes, with later versions typically supporting 16 or more. + + +The second part of the load-balancing configuration overcomes a challenge introduced by EIGRP’s metric calculation. The EIGRP integer metric calculation often results in 8- to 10-digit integer metrics, so the metrics of competing routes are seldom the exact same value. Calculating the exact same metric for different routes for the same prefix is statisti-cally unlikely. + +Cisco IOS includes the concept of EIGRP variance to overcome this problem. Variance lets you tell Cisco IOS that the EIGRP metrics can be close in value and still be consid-ered worthy of being added to the routing table—and you can define how close. + +The variance multiplier EIGRP router subcommand defines an integer in the range of 1 through 128. The router then multiplies the variance by the successor route’s FD—the metric of the best route to reach that subnet. Any FS routes whose metric is less than or equal to the product of the variance by the FD are considered to be equal routes and can be placed into the routing table, up to and including the number of routes defined by the maximum-paths command. + +For example, consider the example as shown in Figure 5-8 and Table 5-3. In this example, to keep the focus on the concepts, the metrics are small easy-to-compare numbers, rather than the usual large EIGRP metrics. The example focuses on R4’s three possible routes to reach Subnet 1. The figure shows the RD of each route next to Routers R1, R2, and R3, respectively. + + + + + +From the Library of Alexey Evseenko +182 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Metric 30 R1 +Metric 50 + + + +Metric 90 +R4 + +Metric 40 Subnet 1 R2 + + + +Metric 120 + +Metric 60 R3 + +Figure 5-8 Example of the Use of Variance + + +Table 5-3 Example of Routes Chosen as Equal Because of Variance + +Next-hop Metric RD Added to Routing Added to Routing Added to Routing Table at Variance 1? Table at Variance 2? Table at Variance 3? +R1 50 30 Yes Yes Yes + +R2 90 40 No Yes Yes + +R3 120 60 No No No + + +Before considering the variance, note that in this case the route through R1 is the suc-cessor route, because it has the lowest metric. This also means that the FD is 50. The route through R2 is an FS route, because its RD of 40 is less than the FD of 50. The route through R3 is not an FS route, because R3’s RD of 60 is more than the FD of 50. + +At a default variance setting of 1, the metrics must be exactly equal to be considered equal, so only the successor route is added to the routing table (the route through R1). With variance 2, the FD (50) is multiplied by the variance (2) for a product of 100. The route through R2, with FD 90, is less than 100, so R4 will add the route through R2 to the routing table as well. The router can then load-balance traffic across these two routes. + +In the third case, with variance 3, the product of the FD (50) times 3 equals 150. All three routes’ calculated metrics (their FD values) are less than 150. However, the route through R3 is not an FS route, so it cannot be added to the routing table for fear of causing a routing loop. So, R4 adds only the routes through R1 and R2 to its IP routing table. (Note that the variance and maximum-paths settings can be verified by using the show ip pro-tocols command.) + + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 183 + +The following list summarizes the key points to know about variance: + + +■ Key +Topic +■ + + + +■ + +The variance is multiplied by the current FD (the metric of the best route to reach a subnet). + +Any FS routes whose calculated metric is less than or equal to the product of vari-ance and FD are added to the IP routing table, assuming that the maximum-paths setting allows more routes. + +Routes that are neither successor nor feasible successor routes can never be added to +the IP routing table, regardless of the variance setting. + + +When the routes have been added to the routing table, the router supports a couple of methods for how to load-balance traffic across the routes. The router can load-balance the traffic proportionally with the metrics, meaning that lower metric routes send more packets. Alternately, the router can send all traffic over the lowest-metric route, with the other routes just being in the routing table for faster convergence in case the best route fails. + +Optimizing EIGRP Convergence + +The previous major section of this chapter focused on how EIGRP calculates metrics and how to change that metric calculation. However, that section discussed only one moti-vation for changing the metric: to make a router pick one route instead of another. This section, which focuses on optimizing the EIGRP convergence process, discusses another reason for choosing to manipulate the EIGRP metric calculations: faster convergence. + +EIGRP converges very quickly, but EIGRP does not achieve the most optimal fast conver-gence times in all conditions. One design goal might be to tune EIGRP configuration set-tings so that EIGRP uses faster convergence methods for as many routes as possible, and when not possible, that EIGRP converge as quickly as it can without introducing routing loops. As a result, routers might converge in some cases in a second instead of tens of seconds (from the point of a router realizing that a route has failed). + +For those of you who have not thought about EIGRP convergence before now, you must first get a comfortable understanding of the concept of EIGRP feasible successors—the first topic in this section. Following that, the text examines the EIGRP query process and route summarization. This section ends with EIGRP load balancing, which allows both spreading the load across multiple routes in addition to improving EIGRP convergence. + +Fast Convergence to Feasible Successors + +Earlier in this chapter, in the section “Calculating the Metrics: Feasible Distance and Reported Distance,” the text explains how a router, for each possible route, calculates two metric values. One value is the feasible distance (FD), which is the metric from that router’s perspective. The other metric is the reported distance (RD), which is the integer metric from the perspective of a next-hop router. + + + + + +From the Library of Alexey Evseenko +184 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +EIGRP routers use the RD value when determining whether a possible route can be con-sidered to be a loop-free backup route called a feasible successor. This section explains the concepts and shows how to confirm the existence or nonexistence of such routes. + +Successor and Feasible Successor Concepts + +For each prefix/prefix length, when multiple possible routes exist, the router chooses the route with the smallest integer metric (smallest FD). EIGRP defines each such route as the successor route for that prefix, and EIGRP defines the next-hop router in such a route as the successor. EIGRP then creates an IP route for this prefix, with the successor as the next-hop router, and places that route into the IP routing table. + +If more than one possible route exists for a given prefix/prefix length, the router exam-ines these other (nonsuccessor) routes and asks this question: Can any of these routes be used immediately if the currently best route fails, without causing a routing loop? EIGRP runs a simple algorithm to identify which routes could be used without causing a routing loop, and EIGRP keeps these loop-free backup routes in its topology table. Then, if the successor route (the best route) fails, EIGRP immediately uses the best of these alternate loop-free routes for that prefix. + +EIGRP calls these alternative, immediately usable, loop-free routes feasible successor routes, because they can feasibly be used as a new successor route when the current suc-cessor route fails. The next-hop router of such a route is called the feasible successor. + + +Note In general conversation, the term successor might refer to the route or specifically to the next-hop router. Likewise, the term feasible successor might refer to the route, or the next-hop router, of an alternative route. + + + + + + +Key Topic + +A router determines whether a route is a feasible successor based on the feasibility condi-tion, defined as follows: + +If a nonsuccessor route’s RD is less than the FD, the route is a feasible successor route. +Although technically correct, the preceding definition is much more understandable with an example as shown in Figure 5-9. The figure illustrates how EIGRP figures out which routes are feasible successors for Subnet 1. + +In Figure 5-9, Router E learns three routes to Subnet 1, from Routers B, C, and D. After calculating each route’s metric, Router E finds that the route through Router D has the lowest metric. Router E adds this successor route for Subnet 1 to its routing table, as shown. The FD in this case for this successor route is 14,000. + +EIGRP decides whether a route can be a feasible successor by determining whether the reported distance for that route (the metric as calculated on that neighbor) is less than its own best computed metric (the FD). If that neighbor has a lower metric for its route to +the subnet in question, that route is said to have met the feasibility condition. + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 185 + + + +Key Topic + +Router E Calculates FD for Each Route: +Route Through Router B — 19,000 Route Through Router C — 17,500 Route Through Router D — 14,000 + + + +Subnet 1 Metric 15,000 +B Subnet 1 Metric 13,000 + + + + +E Router E Routing Table + +Subnet 1 C A + +Subnet 1 Metric 14,000, Through Router D + +D Subnet 1 Metric 10,000 Router E Topology Table for Subnet 1 +Route Through Router D — Successor +Route Through Router C — Feasible Successor (C’s RD is 13,000, which Is Less than E’s Metric) + +Figure 5-9 Successors and Feasible Successors with EIGRP + +For example, Router E computes a metric (FD) of 14,000 on its successor route (through Router D). Router C’s computed metric—E’s RD for this alternate router through Router C—is 13,000, which is lower than E’s FD (14,000). As a result, E knows that C’s best route for this subnet could not possibly point toward Router E, so Router E believes that its route, to Subnet 1 through Router C, would not cause a loop. As a result, Router E marks its topology table entry for the route through Router C as a feasible successor route. + +Conversely, E’s RD for the route through Router B to Subnet 1 is 15,000, which is larger than Router E’s FD of 14,000. So, this alternative route does not meet the feasibility condition, so Router E does not consider the route through Router B a feasible successor route. + +If the route to Subnet 1 through Router D fails, Router E can immediately put the route through Router C into the routing table without fear of creating a loop. Convergence occurs almost instantly in this case. However, if both C and D fail, E would not have a feasible successor route, and would have to do additional work, as described later in the section “Converging by Going Active,” before using the route through Router B. + +By tuning EIGRP metrics, an engineer can create feasible successor routes in cases where none existed, improving convergence. + +Verification of Feasible Successors + +Determining which prefixes have both successor and feasible successor routes is some-what simple if you keep the following in mind: + + +Key ■ Topic + +■ + +The show ip eigrp topology command does not list all known EIGRP routes, but instead lists only successor and feasible successor routes. + +The show ip eigrp topology all-links command lists all possible routes, including +those that are neither successor nor feasible successor routes. + + + + + + + +From the Library of Alexey Evseenko +186 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +For example, consider Figure 5-10, which again focuses on Router WAN1’s route to Router B1’s LAN subnet, 10.11.1.0/24. The configuration on all routers has reverted back to defaults for all settings that impact the metric: default bandwidth and delay, no offset lists, and all interfaces are up. + +1 2 + + + + +10.11.1.1 +Fa0/0 + + +10.1.1.2 +B1 + +1.1 S0/0/0.1 +WAN1 + + +10.9.1.1/24 +Fa0/0 + +1.5 S0/0/0.2 + +10.1.1.6 3 + +B2 WAN2 10.9.1.2 + + + + +Note: All WAN IP addresses begin with 10.1 + +Figure 5-10 Three Possible Routes from WAN1 to 10.11.1.0/24 + +Figure 5-10 shows the three topologically possible routes to reach 10.11.1.0/24, labeled 1, 2, and 3. Route 1, direct to Router B1, is the current successor. Route 3, which goes to another branch router, back to the main site, and then to Router B1, is probably a route +you would not want to use anyway. However, route 2, through WAN2, would be a reason-able backup route. + +If the PVC between WAN1 and B1 failed, WAN1 would converge to route 2 from the figure. However, with all default settings, route 2 is not an FS route, as demonstrated in Example 5-7. + +Example 5-7 Only a Successor Route on WAN1 for 10.11.1.0/24 + +WAN1# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.9.1.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.11.1.0/24, 1 successors , FD is 2172416 +via 10.1.1.2 (2172416/28160), Serial0/0/0.1 +! lines omitted for brevity; no other lines of output pertain to 10.11.1.0/24. + +WAN1# show ip eigrp topology all-links + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 187 + +IP-EIGRP Topology Table for AS(1)/ID(10.9.1.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.11.1.0/24, 1 successors , FD is 2172416, serno 45 +via 10.1.1.2 (2172416/28160), Serial0/0/0.1 +via 10.9.1.2 (2174976/2172416 ), FastEthernet0/0 +! lines omitted for brevity; no other lines of output pertain to 10.11.1.0/24. + +A quick comparison of the two commands shows that the show ip eigrp topology com-mand shows only one next-hop address (10.1.1.2), whereas the show ip eigrp topology all-links command shows two (10.1.1.2 and 10.9.1.2). The first command lists only suc-cessor and feasible successor routes. So in this case, only one such route for 10.11.1.0/24 exists—the successor route, direct to B1 (10.1.1.2). + +The output of the show ip eigrp topology all-links command is particularly interesting in this case. It lists two possible next-hop routers: 10.1.1.2 (B1) and 10.9.1.2 (WAN2). It does not list the route through Router B2 (10.1.1.6), because B2’s current successor route for 10.11.1.0/24 is through WAN1. EIGRP’s Split Horizon rules tell B2 to not advertise 10.11.1.0/24 to WAN1. + +Next, focus on the route labeled as option 2 in Figure 5-9, the route from WAN1, to WAN2, then to B1. Per the show ip eigrp topology all-links command, this route has an RD of 2,172,416—the second number in parentheses as highlighted toward the end of Example 5-7. WAN1’s successor route has an FD of that exact same value. So, this one possible alternate route for 10.11.1.0/24, through WAN2, does not meet the feasibility condition—but just barely. To be an FS route, a route’s RD must be less than the FD, and in this example, the two are equal. + +To meet the design requirement for quickest convergence, you could use any method to manipulate the metrics such that either WAN2’s metric for 10.11.1.0 is lower or WAN1’s metric for its successor route is higher. Example 5-8 shows the results of simply adding back the offset list on WAN1, as seen in Example 5-5, which increases WAN1’s metric by 3. + +Example 5-8 Increasing WAN1’s Metric for 10.11.1.0/24, Creating an FS Route + +WAN1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +WAN1(config)# access-list 11 permit 10.11.1.0 +WAN1(config)# router eigrp 1 +WAN1(config-router)# offset-list 11 in 3 s0/0/0.1 +WAN1(config-router)# ^Z +WAN1# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.9.1.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + + + + + +From the Library of Alexey Evseenko +188 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +P 10.11.1.0/24, 1 successors , FD is 2172419 +via 10.1.1.2 (2172419/28163), Serial0/0/0.1 +via 10.9.1.2 (2174976/2172416), FastEthernet0/0 +! lines omitted for brevity; no other lines of output pertain to 10.11.1.0/24. + +Note that now WAN1’s successor route FD is 2,172,419, which is higher than WAN2’s (10.9.1.2’s) RD of 2,172,416. As a result, WAN1’s route through WAN2 (10.9.1.2) now meets the feasibility condition. Also, the show ip eigrp topology command, which lists only successor and feasible successor routes, now lists this new feasible successor route. Also note that the output still states “1 successor.” So, this counter only counts successor routes and does not include FS routes. + +When EIGRP on a router notices that a successor route has been lost, if a feasible suc-cessor exists in the EIGRP topology database, EIGRP places that feasible successor route into the routing table. The elapsed time from noticing that the route failed, until the route is replaced, is typically less than 1 second. (A Cisco Live conference presentation asserts that this convergence approaches 200 milliseconds.) With well-tuned EIGRP Hold Timers and with feasible successor routes, convergence time can be held low. + +Converging by Going Active + +When EIGRP removes a successor route and no FS route exists, the router begins a pro-cess by which the router discovers whether any loop-free alternative routes exist to reach that prefix. This process is called going active on a route. Routes for which the router has a successor route, and no failure has yet occurred, remain in a passive state. Routes for which the successor route fails, and no feasible successor routes exist, move to an active state, as follows: + + +■ +Key Topic + +■ + + + +■ + + + + +■ + + + +■ + + + +■ + +Change the state, as listed in the show ip eigrp topology command, from passive (p) to active (a). + +Send EIGRP Query messages to every neighbor except the neighbor in the failed route. The Query asks a neighbor whether that neighbor has a loop-free route for the listed prefix/length. + +The neighbor considers itself to have a loop-free route if that neighbor is passive for that prefix/length. If so, the neighbor 1) sends an EIGRP Reply message, telling the original router that it does indeed have a loop-free route and 2) does not forward the Query. + +If the neighbor itself is active on this route, that neighbor 1) floods EIGRP Query messages to its neighbors and 2) does not immediately send an EIGRP Reply back to the original router—instead waiting on replies to its own set of Query messages. + +When a router has received Reply messages from all neighbors to which it sent any Query messages, that router can then send a Reply message to any of its neighbors as necessary. + +When a router has received a Reply for all its Query messages, that router can safely +use the best of the routes confirmed to be loop-free. + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 189 + + +Note The EIGRP convergence process when going active on a route is sometimes also referenced by the name of the underlying algorithm, named Diffusing Update Algorithm (DUAL). + + +The process can and does work well in many cases, often converging to a new route in less than 10 seconds. However, in internetworks with many remote sites, with much +redundancy, and with a large number of routers in a single end-to-end route, convergence when going active can be inefficient. For example, consider the internetwork in Figure +5-11. The figure shows five branch routers as an example, but the internetwork has 300 branch routers, each with a PVC connected to two WAN routers, WAN1 and WAN2. When Router WAN1 loses its route for the LAN subnet at branch B1, without an FS route, the Query process can get out of hand. + + +B1 + + + +B2 +Core1 WAN1 + + +B3 + +Core2 WAN2 +B4 + + + + +B5 + + + + +Figure 5-11 Issues with Query Scope + +The arrowed lines show WAN1’s Query messages and the reaction by several other rout-ers to forward the Query messages. Although only five branch routers are shown, WAN1 would forward Query messages to 299 branch routers. WAN2 would do the same, assum-ing that its route to B1’s LAN also failed. These branch routers would then send Query messages back to the WAN routers. The network would converge, but more slowly than if an FS route existed. + + + + + +From the Library of Alexey Evseenko +190 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note EIGRP sends every Query and Reply message using RTP, so every message is acknowledged using an EIGRP ACK message. + + +By configuring EIGRP so that a router has FS routes for most routes, the entire Query process can be avoided. However, in some cases, creating FS routes for all routes on all routers is impossible. So, engineers should take action to limit the scope of queries. The next two sections discuss two tools—stub routers and route summarization—that help reduce the work performed by the DUAL and the scope of Query messages. + + + + + + + + + + + + + + + + + +Key Topic + +The Impact of Stub Routers on Query Scope + +Some routers, by design, should not be responsible for forwarding traffic between differ-ent sites. For example, consider the familiar internetwork shown throughout this chapter, most recently in Figure 5-11, and focus on the branch routers. If WAN2’s LAN interface failed, and WAN1’s PVC to B1 failed, a route still exists from the core to branch B1’s 10.11.1.0/24 subnet: WAN1–B2–WAN2–B1. (This is the same long route shown as route 3 in Figure 5-10.) However, this long route consumes the link bandwidth between the core and branch B2, and the traffic to/from B1 will be slower. Users at both branches will suf-fer, and these conditions might well be worse than just not using this long route. + +Route filtering could be used to prevent WAN1 from learning such a route. However, using route filtering would require a lot of configuration on all the branch routers, with specifics for the subnets—and it would have to change over time. A better solution exists, which is to make the branch routers stub routers. EIGRP defines stub routers as follows: + +A stub router is a router that should not forward traffic between two remote EIGRP-learned subnets. +To accomplish this goal, the engineer configures the stub routers using the eigrp stub command. Stub routers do not advertise EIGRP-learned routes from one neighbor to other EIGRP neighbors. Additionally, and possibly more significantly, nonstub routers note which EIGRP neighbors are stub routers, and the nonstub routers do not send Query messages to the stub routers. This action greatly reduces the scope of Query messages when a route goes active, in addition to preventing the long, circuitous, and possibly harmful route. + +The eigrp stub command has several options. When issued simply as eigrp stub, the router uses default parameters, which are the connected and summary options. (Note that Cisco IOS adds these two parameters onto the command as added to the running config.) Table 5-4 lists the eigrp stub command options and explains some of the logic +behind using them. + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 191 + + +Table 5-4 Key +Topic Option + + +Parameters on the eigrp stub Command + +This Router Is Allowed to... + + + +connected + +summary + +static + +leak-map name + +redistributed + +receive-only + +Advertise connected routes but only for interfaces matched with a network command. +Advertise auto-summarized or statically configured summary routes. + +Advertise static routes, assuming that the redistribute static command is configured. +Advertise routes (that would otherwise be part of a summary route) specified by a leak map. +Advertise redistributed routes, assuming that redistribution is configured. + +Does not advertise any routes. This option cannot be used with any other option. + + + +Note that stub routers still form neighborships, even in receive-only mode. The stub router simply performs less work and reduces the Query scope because neighbors will not send these routers any Query messages. + +For example, Example 5-9 shows the eigrp stub connected command on Router B2, with the results being noticeable on WAN1 (show ip eigrp neighbors detail). + +Example 5-9 Evidence of Router B2 as an EIGRP Stub Router + +B2# configure terminal +B2(config)# router eigrp 1 +B2(config-router)# eigrp stub connected +B2(config-router)# +Mar 2 21:21:52.361: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 10.9.1.14 +(FastEthernet0/0.12) is down: peer info changed +! A message like the above occurs for each neighbor. + +! Moving to router WAN1 next +WAN1# show ip eigrp neighbors detail +IP-EIGRP neighbors for process 1 + +H Address + +1 10.9.1.2 + +Interface + +Fa0/0 + +Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +11 00:00:04 7 200 0 588 + +Version 12.4/1.2, Retrans: 0, Retries: 0, Prefixes: 8 +2 10.1.1.6 Se0/0/0.2 13 00:21:23 1 200 0 408 +Version 12.4/1.2, Retrans: 2, Retries: 0, Prefixes: 2 +Stub Peer Advertising ( CONNECTED ) Routes +Suppressing queries +0 10.9.1.6 Fa0/0.4 12 00:21:28 1 200 0 175 +Version 12.2/1.2, Retrans: 3, Retries: 0, Prefixes: 6 + + + + + +From the Library of Alexey Evseenko +192 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The Impact of Summary Routes on Query Scope + + + + + + +Key Topic + +In addition to EIGRP stub routers, route summarization also limits EIGRP Query scope and therefore improves convergence time. The reduction in Query scope occurs because of the following rule: + +If a router receives an EIGRP Query for a prefix/prefix length, does not have an exactly matching (both prefix and prefix length) route, but does have a summary route that includes the prefix/prefix length, that router immediately sends an EIGRP Reply and does not flood the Query to its own neighbors. +For example, consider Figure 5-12. + + +1 Update: 10.11.0.1/16 10.12.0.0/16 + + +300 Branches All LAN subnets in ranges +10.11.0.0/16 10.12.0.0/16 + + +WAN1 2 Query: 10.11.1.0/24? + + +C1 + + +3 Reply: Nope! + + + +Other Core Routers + + + +WAN2 C2 +1 Update: 10.11.0.1/16 10.12.0.0/16 + +Figure 5-12 Route Summaries Limiting Query Scope + +Multilayer switches C1 and C2 sit in the core of the network shown in various other fig-ures in this chapter, and both C1 and C2 run EIGRP. The IP subnetting design assigns all branch office LAN subnets from the range 10.11.0.0/16 and 10.12.0.0/16. As such, Routers WAN1 and WAN2 advertise summary routes for these ranges, rather than for individual subnets. So, under normal operation, ignoring the entire Query scope issue, C1 and C2 would never have routes for individual branch subnets like 10.11.1.0/24 but would have routes for 10.11.0.0/16 and 10.12.0.0/16. + +The figure highlights three steps: + +Step 1. WAN1 and WAN2 advertise summary routes, so that C1, C2, and all other routers in the core have a route for 10.11.0.0/16 but not a route for 10.11.1.0/24. +Step 2. Some time in the future, WAN1 loses its route for 10.11.1.0/24, so WAN1 sends a Query for 10.11.1.0/24 to C1 and C2. + +Step 3. C1 and C2 send an EIGRP Reply immediately afterward, because both do not have a route for that specific prefix/length (10.11.1.0/24), but both do have a summary route (10.11.0.0/16) that includes that range of addresses. + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 193 + +Stuck in Active + +When a router notices a route failure and moves a route from the passive to active state, that router sends Query messages to its neighbors. With a sufficiently large network, particularly when routers exist several router hops away, the number of Queries might not only be large, but there also might be a string of routers that all must wait on mul-tiple Reply messages before they can, in turn, issue a Reply. For example, in Figure 5-13, Router R1 must wait on Routers R11, R12, and R13 to send a Reply. R11 must wait on Routers R21, R22, and R23. R21 must wait on three other routers, and so on—meaning that R1 might have to wait quite a while before getting a response. + + +21 + + +11 22 + + +23 + + + +24 + + +1 12 25 + + +26 + + + +27 + + +13 28 + + +29 + +Figure 5-13 Network Design That Causes Unreasonably Long Convergence + +Although the design shown in Figure 5-13 is admittedly contrived, the point is that a router might wait a while before getting a Reply message in response to each Query mes-sage for an active route. A router cannot use any alternative paths for that route until all such Reply messages have been received. + +To deal with this potentially long time, Cisco IOS first sets a limit on how long it should take to receive all such replies. That timer, called the active timer, is set to 3 minutes + + + + +From the Library of Alexey Evseenko +194 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +by default. (The timer can be configured for an entire EIGRP process using the timers active-time time EIGRP subcommand, where time is represented in minutes.) Routes for which a router does not receive a Reply within the active timer are considered to be Stuck-in-Active (SIA) routes. + +Cisco IOS has two major branches of logic when reacting to SIA routes. Earlier versions of Cisco IOS took a rather drastic action, bringing down the uncooperative neighbors that had yet to send back an EIGRP Reply for that route. For example, in Figure 5-12, if R1 received Reply messages from R11 and R12, but not R13, and the active timer expired, R1 would bring down the neighborship with R13. The active route would be considered to have failed, and all routes known through the failed neighbor would also be considered to have failed—possibly generating more Query messages for other routes. + +Later Cisco IOS versions (beginning in the 12.2 mainline) make an attempt to avoid failing the neighborship. At the halfway point through the Active timer—a seemingly long 90 seconds by default—a router sends an SIA-Query (Stuck-in-Active Query) EIGRP mes-sage to each neighbor that has yet to send back a Reply. The purpose of the message is to either get an SIA-Reply back, meaning that the neighbor really is still waiting for replies to its own queries, or to get nothing in reply. In the first case, because the neighbor is alive and still working, there is no need to kill the neighborship. In the second case, the neighbor was not able to reply, so the action of failing the neighborship is reasonable. + +Route Filtering + +Does a router in a branch office need to be able to forward packets to hosts in another branch office? Does a router in the sales division need to be able to forward packets to hosts in the manufacturing division? These questions are just a sampling of design ques-tions for which route filtering can be part of the solution. + +Route filtering allows the engineer to filter which routes are advertised in an EIGRP update. If routers in a branch do not need to learn routes about subnets in other branches, routers can filter that routing information. This filtering reduces the size of routing tables, saving memory, possibly improving routing performance, and making the internetwork more secure by limiting the flow of packets. + +EIGRP enables route filtering using the distribute-list router subcommand. The concept is relatively straightforward: The distribute list refers to an access control list (ACL), pre-fix list, or route map. These three tools classify whether a route should be permitted to be sent/received in an EIGRP Update or be denied (filtered). The distribute-list command also specifies the direction—outbound updates or inbound updates—and optionally, the specific interface on which to filter updates. + +For example, Figure 5-14 shows an expanded version of an internetwork used previously. The figure adds several links between the WAN routers and some core Layer 3 switches. It also notes the address ranges for all data centers (10.16.0.0/16) and the range of address-es used for subnets in the manufacturing division (10.17.32.0/19). + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 195 + + +Sales Branch Offices + +Manufacturing: 10.17.32.0 - 10.17.63.255 + + + + +Fa0/0 10.11.1.1 + + +S0/0/0.1 1.2 +B1 + + +S0/0/0.1 +1.1 .5 +WAN1 .9 +.1 + + +.6 Core1 .14 +.21 + +Data Center: 10.16.0.0/16 +S0/0/0.2 +1.5 +S0/0/0.2 S0/0/0.1 +2.2 2.1 + + +Fa0/0 10.12.1.1 +B2 + + + +S0/0/0.2 2.6 + + +.2 .13 +.17 S0/0/0.2 WAN2 +2.5 + +.22 .10 +.18 Core2 + + + +Note: All WAN IP addresses begin with 10.1. +All LAN Core IP addresses begin with 10.9.1. + +Figure 5-14 Expanded Design with a Range of Addresses in Manufacturing + +The design engineer could make many choices about what routes to filter, for example + +■ Filter routes to WAN subnets so that the core and manufacturing do not learn those routes, because these subnets should not be the destination of any user traffic. + +■ Filter manufacturing routes from being advertised to the branches, because the branches are in the sales division. + +■ Filter routes for the subnets sitting between the Layer 3 switches in the core, pre-venting them from being advertised to either manufacturing or the sales branches, because no users in these divisions should be sending packets to these subnets. + +The examples in this section focus on the second of these design options. + +Filtering the subnets that exist between Layer 3 devices, as is suggested in the second and third items in the list, have both pros and cons. For example, the first design goal filters the WAN subnets, because no end users need to be able to send packets to those sub-nets. This meets the goal of having smaller routing tables. However, operations personnel might have a larger challenge when monitoring and troubleshooting, because when a ping or traceroute fails, they also need to figure out whether the command failed by design because of the purposefully filtered routes or whether a problem has occurred. + +This section next examines how to filter EIGRP routes using ACLs, prefix lists, and then route maps. All three of these tools will be used throughout this book, so this chapter lays the foundation for understanding these tools, in addition to showing how to use these tools when filtering EIGRP routes. + + + + + + +From the Library of Alexey Evseenko +196 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Filtering by Referencing ACLs + +To filter EIGRP routes by matching them using ACLs, the ACL must match a route with a permit clause to then allow the route to be advertised, and match the route with a deny clause to filter the route. Before getting into how an ACL matches a route, first it is important to review what can be examined based on the configuration of an IP ACL. + +EIGRP distribute lists support the use of standard IP ACLs. The syntax of both num-bered and named standard ACLs allows a configuration of one dotted-decimal number and its corresponding wildcard (WC) mask. When used for packet filtering, this number is compared to the source IP address of the packet. When referenced by the distribute-list command for the purpose of EIGRP route filtering, EIGRP compares the standard ACL source address field to the subnet number (prefix) of each EIGRP route. + +The best way to learn the specifics is to consider several examples. Figure 5-15 shows the specific size subnets being advertised from the manufacturing division into the core. The design calls for the WAN routers to filter these routes from being advertised toward the Sales division’s branch offices. + +router eigrp 1 +distribute-list 2 out s0/0/0.1 + + + +WAN1 + + +To Branches + + + + +WAN2 + + +Routes from Manufacturing: 10.17.32.0/23 10.17.34.0/24 10.17.35.0/25 10.17.35.128/25 10.17.36.0/26 10.17.36.64/26 + + +Figure 5-15 Specific Manufacturing Routes to Be Filtered + +Figure 5-15 shows the distribute-list 2 out s0/0/0.1 command on Router WAN1 as one sample of the syntax. A command like this would need to be included in WAN1’s con-figuration for each interface connected to a branch. ACL number 2 would then be con-figured to match the manufacturing routes with a deny clause, and all other routes with a permit clause, filtering the routes. + +If WAN1 has hundreds of serial subinterfaces for its WAN connections, following the sample in the previous paragraph, WAN1 would have hundreds of distribute-list 2 out serial number commands, one per WAN interface/subinterface. Alternatively, the engi-neer could configure a single distribute-list 2 out command on Router WAN1, not speci-fying an interface. In this case, Router WAN1 would not advertise these routes to any neighbors, greatly reducing WAN1’s configuration. + +Consider the following access-list commands. Imagine that each command in this list is the first of two commands in a single access list. The second and only other command is + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 197 + +a command that permits all other routes—for example, access-list 2 permit any. Then, ask yourself: If used by a distribute list on WAN1 to filter the manufacturing routes (as seen in Figure 15-15), and you want that ACL to filter only manufacturing routes, which of these two-line ACLs meet the requirements? + +access-list 3 deny 10.17.32.0 +access-list 4 deny 10.17.32.0 0.0.0.255 +access-list 5 deny 10.17.32.0 0.0.3.255 +access-list 6 deny 10.16.0.0 0.1.255.255 + +Table 5-5 supplies the answers and explanation. + + +Table 5-5 Analysis of the Sample ACLs Used with the distribute-list Command + + +ACL Routes Filtered +3 10.17.32.0 /23 + +4 10.17.32.0 /23 + +5 10.17.32.0 /23 + +10.17.34.0 /24 + +10.17.35.0 /25 + +10.17.35.128 /25 + +6 All manufacturing and data center routes + +Explanation +The ACL matches exactly prefix 10.17.32.0, so it matches a single manufacturing route. +The ACL matches all prefixes that begin with 10.17.32 because of the WC mask, again matching a single route. +The ACL matches all prefixes in the range 10.17.32.0– 10.17.35.255, which includes four manufacturing routes. + + + + +The ACL matches all prefixes in the range 10.16.0.0– 10.17.255.255, which includes the data center routes. + + + +Note To find the range of numbers matched by an ACL’s address and wildcard mask val-ues, use the address field as the low end of the range and simply add the address and wild-card mask to find the high end of the range. + + +Example 5-10 shows the configuration on Router WAN1 to filter the manufacturing routes, with distribute lists enabled on its two WAN subinterfaces. The ACL matches (with a deny action) all manufacturing routes and matches all other routes with a permit clause. + +Example 5-10 WAN1’s distribute-list to Filter Manufacturing Routes + +! On Router B1, before the filtering is applied: +B1# show ip route | include 10.17 +D 10.17.35.0/25 [90/2300416] via 10.1.1.1, 00:00:18, Serial0/0/0.1 +D 10.17.34.0/24 [90/2300416] via 10.1.1.1, 00:00:18, Serial0/0/0.1 +D 10.17.32.0/23 [90/2300416] via 10.1.1.1, 00:00:18, Serial0/0/0.1 +D 10.17.36.0/26 [90/2300416] via 10.1.1.1, 00:00:18, Serial0/0/0.1 + + + + +From the Library of Alexey Evseenko +198 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +D 10.17.36.64/26 [90/2300416] via 10.1.1.1, 00:00:18, Serial0/0/0.1 +D 10.17.35.128/25 [90/2300416] via 10.1.1.1, 00:00:18, Serial0/0/0.1 + +! On Router WAN1: +WAN1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +WAN1(config)# access-list 2 deny 10.17.32.0 0.0.31.255 +WAN1(config)# access-list 2 permit any +WAN1(config)# router eigrp 1 +WAN1(config-router)# distribute-list 2 out +WAN1(config-router)# ^Z +WAN1# + +! On Router B1, after the filtering is applied +B1# show ip route | include 10.17 +B1# + + +Note The same configuration added to Router WAN1 was also added to Router WAN2; however, the commands were not repeated in Example 5-10. + + +The ACL in this case, ACL 2, matches all subnets with a value between 10.17.32.0 and 10.17.63.255 inclusive, based on the IP address value of 10.17.32.0 and WC mask of 0.0.31.255. By matching these routes with a deny clause, the ACL, used as a distribute list, filters the routes. The access-list 2 permit any command matches all other routes, allowing them to be advertised. + +Filtering by Referencing IP Prefix Lists + +The Cisco IOS IP prefix-list feature gives the network engineer another tool for matching routes when performing route filtering. IP prefix lists can examine both the prefix and the prefix length, and a range of prefixes or a range of prefix lengths. The command then sets either a deny or permit action for each matched prefix/length. To use the prefix list, the configuration simply refers to the prefix-list with the same distribute-list command seen earlier. + +Using IP prefix lists for route filtering has several advantages. First, IP prefix lists allow matching of the prefix length, whereas the ACLs used by the EIGRP distribute-list com-mand cannot. (Some other route filtering configurations can match both the prefix and prefix length using extended ACLs.) Many people find IP prefix lists more intuitive for configuring route filtering. Finally, the internal processing of the IP prefix lists uses an internal tree structure that results in faster matching of routes as compared with ACLs. + +This section begins by examining IP prefix lists as an end to itself, followed by an exam-ple of filtering EIGRP routes using a prefix list. + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 199 + +IP Prefix List Concepts + +IP prefix lists provide mechanisms to match two components of an IP route: + +■ The route prefix (the subnet number) + +■ The prefix length (the subnet mask) + +Each single IP prefix list has similar characteristics to a single ACL, with subtle similari-ties to both numbered and named ACLs. The IP prefix list consists of one or more global configuration commands (like numbered ACLs), with commands using the same name being in the same list (like named ACLs). As with named ACLs, each ip prefix-list com-mand has a sequence number to allow later deletion of individual commands and inser-tion of commands into a particular sequence position. Each command has a permit or deny action, but because it is used only for matching routes, and not for packet filtering, the permit or deny keyword just implies whether a route is matched (permit) or not +(deny). + +The generic command syntax is as follows: + +ip prefix-list list-name [seq seq-value] { deny | permit prefix/prefix-length} [ ge ge-value] [ le le-value] + +The following steps summarize the logic: + + +Step 1. Key +Topic +Step 2. + + +The route’s prefix must be within the range of addresses implied by the prefix-list command’s prefix /prefix-length parameters. + +The route’s prefix length must match the range of prefixes implied by the +prefix-list command’s prefix-length, ge, and le parameters. + + +The matching of the prefix works much like the ACL matching logic. The configured prefix/prefix length implies a range of IP addresses. For example, an ip prefix-list barney deny 10.0.0.0/8... implies any number whose first 8 bits (per the /8) match 10.0.0.0—in other words, all IPv4 addresses that begin with 10. Any route whose prefix is in this range—for example, 10.0.0.0, 10.1.1.0, and 10.5.255.128—would be considered to match this part of the logic. + +However, IP prefix lists always examine the prefix length as well. To perform the logic of matching a route’s prefix length, Cisco IOS considers the following parts of the ip prefix-list command: + +■ The required prefix-length parameter + +■ The optional ge-value, which stand for greater-than-or-equal-to + +■ The optional le-value, which stand for less-than-or-equal-to + +For a given ip prefix-list command, one of four configuration combinations affect the logic of matching prefix lengths, as listed in Table 5-6. The text following the table pro-vides a more detailed explanation as compared with the summarized information in the table. + + + + + +From the Library of Alexey Evseenko +200 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Key Topic + +Table 5-6 LE and GE Parameters on IP Prefix List, and the Implied Range of Prefix Lengths + + + +Prefix List Parameter +Neither + +Both ge and le + +Only le + +Only ge + +Range of Prefix Length +conf length must = route + +ge-value <= route-length <= le-value + +conf length <= route + +ge-value <= route-length <= 32 + + + +The first case in the table occurs when neither ge nor le is configured. In that case, an exact match of prefix length must occur between the configured prefix length and a route’s prefix length. For example, the ip prefix-list fred deny 10.0.0.0/8 command matches route 10.0.0.0/8, but not 10.0.0.0/20. + +The second case in the table occurs when both ge and le are configured. In that case, the route’s prefix length must be between the configured ge and le values, inclusive. For example, ip prefix-list fred deny 10.0.0.0/8 ge 20 le 22 matches route 10.0.0.0/20, but not 10.0.0.0/8, because the prefix length must either be 20, 21, or 22. + +The cases in which either ge or le is configured, but not both, require a little more thought. A visual representation can help, as shown in Figure 5-16. + +ip prefix-list prefix / prefix-length ge ge-value le le-value + + +0 32 + + + + + +neither ge nor le configured +(exact) + +Both ge and le Configured + + +Only ge Configured + + + +Only le Configured + +Figure 5-16 Representation of Prefix Length Ranges for ip prefix-list Command + +In short, with only ge configured, the command matches prefix length ranges from the ge-value up to 32 (the longest IPv4 prefix length), inclusive. With only le configured, the command matches prefix length ranges between the prefix-length parameter and the +le-value, inclusive. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 201 + + +Note Cisco IOS requires that the configured prefix-length, ge-value, and le-value meet the following requirement: prefix-length <= ge-value <= le-value. Otherwise, Cisco IOS rejects the ip prefix-list command. + + + +Samples of Prefix List Matching + +Several examples can really help nail down prefix list logic. The following routes will be examined by a variety of prefix lists, with the routes numbered for easier reference: +1. 10.0.0.0/8 + +2. 10.128.0.0/9 + +3. 10.1.1.0/24 + +4. 10.1.2.0/24 + +5. 10.128.10.4/30 + +6. 10.128.10.8/30 + +Next, Table 5-7 shows the results of seven different one-line prefix lists applied to these six example routes. The table lists the matching parameters in the prefix-list commands, omitting the first part of the commands. The table explains which of the six routes would match the listed prefix list, and why. + +Table 5-7 Example Prefix Lists Applied to the List of Routes + + +prefix-list Command Parameter + +Routes Matched from Result Previous List of Prefixes + + + +10.0.0.0/8 1 + + +10.128.0.0/9 2 + + +10.0.0.0/8 ge 9 2–6 + + +10.0.0.0/8 ge 24 le 24 3, 4 + + + +10.0.0.0/8 le 28 1–4 + + +Without ge or le configured, both the prefix (10.0.0.0) and length (8) must be an exact match. +Without ge or le configured, the prefix (10.128.0.0) and length (9) must be an exact match. +The 10.0.0.0/8 means “all routes whose first octet is 10.” The prefix length must be between 9 and 32, inclusive. +The 10.0.0.0/8 means “all routes whose first octet is 10,” and the prefix range is 24 to 24—meaning only routes with prefix length 24. +The prefix length needs to be between 8 and 28, inclusive. + + + + + + +From the Library of Alexey Evseenko +202 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +prefix-list Command Parameter + +Routes Matched from Result Previous List of Prefixes + + + +0.0.0.0/0 None + + + + + + + +0.0.0.0/0 le 32 All + +0.0.0.0/0 means “match all prefixes.” However, because no le nor ge parameter is configured, the /0 also means that the prefix length must be 0. So, it would match all routes’ prefixes but none of their prefix lengths. Only a default route would match this prefix list. +The range implied by 0.0.0.0/0 is all IPv4 addresses. The le 32 combined with prefix length 0 implies any prefix length between 0 and 32, inclusive. This is the syntax for “match all” prefix list logic. + + + +Note Pay particular attention to the match all logic of the final entry in the table. + + + +Using IP Prefix Lists to Filter EIGRP Routes + +After you master the logic behind IP prefix lists, using them with the distribute-list com-mand requires minimal extra effort. For example, to refer to a prefix list name Fred, you could configure the distribute-list prefix Fred... command, instead of distribute-list 2... to refer to ACL 2. (Note that the prefix list names are case sensitive.) + +For example, using the internetwork of Figure 5-14 and Figure 5-15 again, consider the following revised design requirements for route filtering: + +■ Of the routes from manufacturing, filter only those routes that begin with 10.17.35 and 10.17.36. + +■ Of the routes for subnets on the WAN links, filter routes to prevent the core routers and branch routers from learning routes whose prefix length is /30. + +Although the first of the preceding two requirements mainly exists to demonstrate the ip prefix-list command, the second goal might be more useful for real networks. Often, +routes with a /30 prefix length are routes used between two routers, either on WAN links or over LANs between Layer 3–enabled devices. Users should not need to send packets to addresses in these subnets. So, the only need to have routes to these subnets is for net-work management (ping tests, for example). + +Example 5-11 shows the configuration on WAN1; the equivalent configuration has been added on WAN2 as well. + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 203 + +Example 5-11 Filtering All Routes with a /30 Prefix Length + +! On Router WAN1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WAN1# show running-config +! lines omitted for brevity router eigrp 1 +network 10.0.0.0 +distribute-list prefix fred out auto-summary +! +ip prefix-list fred seq 5 deny 10.17.35.0/24 ge 25 le 25 ip prefix-list fred seq 10 deny 10.17.36.0/24 ge 26 le 26 ip prefix-list fred seq 15 deny 0.0.0.0/0 ge 30 le 30 +ip prefix-list fred seq 20 permit 0.0.0.0/0 le 32 + +! On Router B1: B1# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks +C 10.11.1.0/24 is directly connected, FastEthernet0/0 +D 10.12.1.0/24 [90/2684416] via 10.1.2.1, 00:06:15, Serial0/0/0.2 [90/2684416] via 10.1.1.1, 00:06:15, Serial0/0/0.1 +C 10.1.2.0/30 is directly connected, Serial0/0/0.2 C 10.1.1.0/30 is directly connected, Serial0/0/0.1 +D 10.16.1.0/24 [90/2172672] via 10.1.2.1, 00:00:32, Serial0/0/0.2 [90/2172672] via 10.1.1.1, 00:00:32, Serial0/0/0.1 +D 10.17.34.0/24 [90/2300416] via 10.1.2.1, 00:06:15, Serial0/0/0.2 [90/2300416] via 10.1.1.1, 00:06:15, Serial0/0/0.1 +D 10.17.32.0/23 [90/2300416] via 10.1.2.1, 00:06:15, Serial0/0/0.2 [90/2300416] via 10.1.1.1, 00:06:15, Serial0/0/0.1 + +B1# show ip route 10.17.32.0 255.255.248.0 longer-prefixes +! The legend is normally displayed; omitted here for brevity + +10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks +D 10.17.34.0/24 [90/2300416] via 10.1.2.1, 00:04:12, Serial0/0/0.2 [90/2300416] via 10.1.1.1, 00:04:12, Serial0/0/0.1 +D 10.17.32.0/23 [90/2300416] via 10.1.2.1, 00:04:12, Serial0/0/0.2 [90/2300416] via 10.1.1.1, 00:04:12, Serial0/0/0.1 + + + + +From the Library of Alexey Evseenko +204 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The configuration on WAN1 includes a four-line prefix list. The first line (sequence num-ber 5) matches 10.17.35.0 /25 and 10.17.35.128 /25, in part because it asks for a range of prefix lengths from 25 to 25—meaning an exact length of 25. Similarly, the second state-ment (sequence number 10) matches routes 10.17.36.0 /26 and 10.17.36.64 /26. The third statement (sequence number 15) uses wildcard logic (0.0.0.0/0) to match all prefixes, but only those with prefix length 30 (ge 30 le 30). The last command matches all prefixes, with prefix lengths from 0 to 32 (all prefix lengths). + +The resulting IP routing table on branch Router B1 shows only a small number of routes. B1 has a route to the other example branch’s subnet (10.12.1.0) and another in the range of addresses for the data centers (10.16.1.0 /24). It has the two routes leaked from manufac-turing. Note that the only two /30 routes known on B1 are two connected routes, so the distribute list is filtering all the /30 routes. + +Filtering by Using Route Maps + +Route maps, the third EIGRP route-filtering tool that can be referenced with the distrib-ute-list command, provide programming logic similar to the If/Then/Else logic seen in programming languages. A single route map has one or more route-map commands in it, and routers process route-map commands in sequential order based on sequence num-bers. Each route-map command has underlying matching parameters, configured with the aptly named match command. (To match all packets, the route-map clause simply omits the match command.) + +Route maps can be used for many functions besides being used to filter routes for a sin-gle routing protocol like EIGRP. Route maps can be used to filter routes during the route redistribution process, and to set Border Gateway Protocol (BGP) Path Attributes (PA) for the purpose of influencing the choice of the best routes in an internetwork. + +When used for filtering EIGRP routes, route maps do provide a few additional features beyond what can be configured using ACLs and prefix lists. However, route maps can be tricky to understand and sometimes counterintuitive. This subsection begins with an examination of the concepts behind Cisco IOS route maps, followed by some examples of their use for filtering EIGRP routes. + +Route Map Concepts + +Route maps have many similarities when compared to ACLs and prefix lists. A single route map has several route-map commands, with the commands in the same route map all having the same text name. When referenced by the distribute-list command, Cisco IOS processes the commands in the route map sequentially, based on the sequence num-bers in the commands. Like ACLs and prefix lists, Cisco IOS adds the sequence numbers automatically if omitted when configuring the route-map commands. And after a par-ticular route has been matched and determined to be either filtered (deny) or allowed to pass (permit), even if more route-map commands exist later in the list, Cisco IOS stops processing the route map for that route. + +Each route-map command includes the name of the route map, an action (permit or deny), and possibly a sequence number (optional). After typing this command, the CLI + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 205 + +user is in route-map configuration mode for that route-map clause. Any match com-mands configured in that mode apply to that single route-map command. For example, Example 5-12 shows the configuration of a sample route map on Router WAN1. + +Example 5-12 Pseudocode for Route Map Used as EIGRP Route Filter + +route-map sample-rm deny 8 +match (1st set of criteria) +route-map sample-rm permit 17 +match (2nd set of criteria) +route-map sample-rm deny 30 +match (3rd set of criteria) +route-map sample-rm permit 35 +! +router eigrp 1 +distribute-list route-map sample-rm out + +Example 5-12 shows pseudocode, ignoring the specifics of what is matched with the match commands. Focus on the actions in the route-map command (permit or deny) and the overall logic, as listed here: + +■ Seq #8: The action is deny, so discard or filter all routes matched by the match com-mand (first set of criteria). + +■ Seq #17: The action is permit, so allow through all routes matched by the match command (second set of criteria). + +■ Seq #30: The action is deny, so discard or filter all routes matched by the match command (third set of criteria). + +■ Seq #35: The action is permit. The absence of a match command means “match all,” so allow through all remaining routes. + +The match command can reference an ACL or prefix list, but doing so does introduce the possibility of confusion. The confusing part is that the decision to filter a route or allow the route through is based on the deny or permit in the route-map command, and not the deny or permit in the ACL or prefix list. When referencing an ACL or prefix list from a route map, the ACL or prefix list simply matches all routes permitted by the ACL or prefix list. Routes that are denied by the ACL or prefix list simply do not match that match command’s logic, making Cisco IOS then consider the next route-map command. + +The following list summarizes the key points about route map logic when used for redistribution: + + +■ +Key Topic + +■ + +route-map commands with the permit option either cause a route to be allowed through (if matched by the match command) or remain in the list of routes to be examined by the next route-map clause. + +route-map commands with the deny option either filter the route (if matched by the match command) or leave the route in the list of routes to be examined by the next +route-map clause. + + + + +From the Library of Alexey Evseenko +206 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ If a clause’s match commands refer to an ACL or prefix list, and the ACL or pre-fix list matches a route with the deny action, the route is not necessarily filtered. +Instead, it just means that route does not match that particular match command and can then be considered by the next route-map clause. + +■ The route-map command includes an implied deny all clause at the end; to configure a permit all, use the route-map command, with a permit action but without a match command. + +Route maps have several more options on the match command as compared to what can be examined by ACLs and IP prefix lists. However, for the purposes of EIGRP route filtering, the items that might be matched do not provide significant help in filtering +routes. However, when redistributing routes from other routing protocols, as is covered in Chapter 10, “Route Redistribution,” some of the match command’s other options can be very helpful. + +Using Route Maps to Filter EIGRP Routes + +The mechanics of the configuration work much like the other two filtering features. The distribute-list command refers to the feature that matches the packets, in this case a route-map command option. The distribute-list command again lists a direction (in or out) and optionally an interface. + +Example 5-13 shows the configuration results in an excerpt from the show running-config command, along with the output of the show route-map command. The configu-ration implements the same logic as used in Example 5-11 earlier in this chapter, in the section “Using IP Prefix Lists to Filter EIGRP Routes.” The design criteria are the same as with that earlier example: + +■ Of the routes from manufacturing, filter only those routes that begin with 10.17.35 and 10.17.36. + +■ Filter WAN routers from advertising any /30 routes in the Layer 3 core. + +Example 5-13 Filtering All Routes with a /30 Prefix Length, Plus Some Routes from Manufacturing + +! On Router WAN2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +WAN2# show running-config +! lines omitted for brevity +router eigrp 1 +network 10.0.0.0 +distribute-list route-map filter-man-slash30 out +auto-summary +! +ip prefix-list manufacturing seq 5 permit 10.17.35.0/24 ge 25 le 25 +ip prefix-list manufacturing seq 10 permit 10.17.36.0/24 ge 26 le 26 +! +ip prefix-list slash30 seq 5 permit 0.0.0.0/0 ge 30 le 30 + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 207 + +! +route-map filter-man-slash30 deny 8 +match ip address prefix-list manufacturing +! +route-map filter-man-slash30 deny 15 +match ip address prefix-list slash30 +! +route-map filter-man-slash30 permit 23 + +! Notice – no match commands, so the above clause matches all remaining routes +! +! lines omitted for brevity +WAN2# show route-map +route-map filter-man-slash30, deny, sequence 8 +Match clauses: +ip address prefix-lists: manufacturing +Set clauses: +Policy routing matches: 0 packets, 0 bytes +route-map filter-man-slash30, deny, sequence 15 +Match clauses: +ip address prefix-lists: slash30 +Set clauses: +Policy routing matches: 0 packets, 0 bytes +route-map filter-man-slash30, permit, sequence 23 +Match clauses: +Set clauses: +Policy routing matches: 0 packets, 0 bytes + +In particular, note that the first two route-map commands list a deny action, meaning that all routes matched in these two clauses will be filtered. The IP prefix lists referenced in the match commands, called manufacturing and slash30, respectively, each match (permit) the routes listed in one of the two design goals. Note that the logic of both prefix lists could have easily been configured into a single prefix list, reducing the length of the route-map command as well. Finally, note that the last route-map command has a permit action, with no match command, meaning that the default action is to allow the route to be advertised. + +Also, it can be useful to take a moment and review Example 5-11 as a point of compari-son for the use of the IP prefix lists in each case. In the route map of Example 5-13, the prefix list needs to match the routes with a permit clause so that the route-map deny action causes the routes to be filtered. Earlier, Example 5-11 shows the same basic logic in the prefix list, but with an action of deny. The reasoning is that when the distribute-list prefix-list... command refers directly to an IP prefix list, Cisco IOS then filters routes denied by the prefix list. + + + + + + + +From the Library of Alexey Evseenko +208 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Route Summarization + +Keeping routing tables small helps conserve memory and can improve the time required by a router to forward packets. Route summarization allows an engineer to keep the rout-ing tables more manageable, without limiting reachability. Instead of advertising routes for every subnet, a router advertises a single route that encompasses multiple subnets. Each router can forward packets to the same set of destinations, but the routing table is smaller. For example, instead of advertising routes 10.11.0.0/24, 10.11.1.0/24, 10.11.2.0/24, and so on—all subnets up through 10.11.255.0/24—a router could advertise a single route for 10.11.0.0/16, which includes the exact same range of addresses. + +Route summarization works best when the subnet planning process considers route sum-marization. To accommodate summarization, the engineer assigning subnets can assign larger address blocks to one part of the topology. The engineers working with that part of the internetwork can break the address blocks into individual subnets as needed. At the edge of that part of the network, the engineers can configure route summaries to be advertised to the other parts of the internetwork. In short, when possible, plan the route summaries before deploying the new parts of an internetwork, and then assign addresses to different parts of the internetwork within their assigned address blocks. + +For example, consider Figure 5-17, which shows a variation on the same internetwork shown earlier in this chapter, with the address blocks planned before deployment. + + +10.17.32.0/19 Manufacturing + + +10.11.0.0/16 B1 (Best Route +Through WAN1) +B2 + + + +10.12.0.0/16 (Best Route Through WAN2) + +Bx + + + + + +10.1.0.0/16 WAN Links + + + +WAN1 + + +10.9.1.0/24 Core Links + + +WAN2 + +Core1 + + + +10.16.0.0/16 Data Center + + + +Core2 + + +Figure 5-17 Address Blocks Planned for Example Enterprise Internetwork + +Figure 5-17 shows the address blocks planned for various parts of the internetwork, as follows: + +■ Assign branch subnets from two consecutive ranges—10.11.0.0/16 and 10.12.0.0/16. + +■ Assign WAN router-to-router subnets from the range 10.1.0.0/16. + +■ Assign core LAN router-to-router subnets from the range 10.9.1.0/24. + +■ Assign data center subnets from the range 10.16.0.0/16. + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 209 + +■ Give the manufacturing division, which has a separate IT staff, address block 10.17.32.0/19. + +Inside each of the circles in Figure 5-17, the engineering staff can assign subnets as the need arises. As long as addresses are not taken from one range and used in another part of the internetwork, the routers at the boundary between the regions (circles) in Figure 5-17 can configure EIGRP route summarization to both create one large summary route and prevent the advertisement of the smaller individual routes. + +Calculating Summary Routes + +The math to analyze a subnet/mask pair, or prefix/length pair, is identical to the math included as part of the CCNA certification. As such, this book does not attempt to explain those same concepts, other than this brief review of one useful shortcut when working with potential summary routes. + +If you can trust that the subnet/mask or prefix/length is a valid subnet or summary, the following method can tell you the range of numbers represented. For example, consider 10.11.0.0/16. Written in subnet/mask form, it is 10.11.0.0/255.255.0.0. Then, invert the mask by subtracting the mask from 255.255.255.255, yielding 0.0.255.255 in this case. Add this inverted mask to the subnet number (10.11.0.0 in this case), and you have the high end of the range (10.11.255.255). So, summary 10.11.0.0/16 represents all numbers from 10.11.0.0 to 10.11.255.255. + +When using less obvious masks, the process works the same. For example, consider 10.10.16.0/20. Converting to mask format, you have 10.10.16.0/255.255.240.0. Inverting the mask gives you 0.0.15.255. Adding the inverted mask to the subnet number gives you 10.10.31.255 and a range of 10.10.16.0–10.10.31.255. + +Note that the process of adding the inverted subnet mask assumes that the prefix/length or subnet/mask is a valid subnet number or valid summary route. If it is not, you can +still do the math, but neither the low end nor high end of the range is valid. For example, 10.10.16.0/19, similar to the previous example, is not actually a subnet number. 10.10.16.0 would be an IP address in subnet 10.10.0.0/19, with range of addresses 10.10.0.0– 10.10.31.255. + +Choosing Where to Summarize Routes + +EIGRP supports route summarization at any router, unlike OSPF, which requires that summarization be performed only at area border routers (ABR) or autonomous system border routers (ASBR). EIGRP’s flexibility helps when designing the internetwork, but it also poses some questions as to where to summarize EIGRP routes. + +In some cases, the options are relatively obvious. For example, consider the 10.17.32.0/19 address block in manufacturing in Figure 5-17. The manufacturing division’s router +could summarize all its routes as a single 10.17.32.0/19 route when advertising to Core1. Alternately, Core1 could summarize all those same routes, advertising a summary for 10.17.32.0/19. In either case, packets from the rest of the internetwork will flow toward Core1 and then to the Manufacturing division. + + + +From the Library of Alexey Evseenko +210 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Next, consider the 10.16.0.0/16 address block in the data center. Because all these subnets reside to the right of Layer 3 switches Core1 and Core2, these two devices could summa-rize 10.16.0.0/16. However, these routes could also be summarized on WAN1/WAN2 for advertisement to the branches on the left. Summarizing on Core1/Core2 helps reduce the size of the routing tables on WAN1 and WAN2. However, the sheer number of subnets in a data center is typically small compared to the number of small remote sites, so the sav-ings of routing table space might be small. One advantage of summarizing 10.16.0.0/16 on WAN1/WAN2 instead of Core1/Core2 in this case is to avoid routing inefficiencies in the core of the internetwork. + +Influencing the Choice of Best Route for Summary Routes + +Often, engineers plan route summarization for the same address block on multiple rout-ers. Such a design takes advantage of redundancy and can be used to perform basic load balancing of traffic across the various paths through the internetwork. Figure 5-18 shows one such example, with Routers WAN1 and WAN2 summarizing routes for the two address blocks located on the branch office LANs: 10.11.0.0/16 and 10.12.0.0/16. + + +Summaries: 10.11.0.0/16 10.12.0.0/16 + + +3,000,000 10,000,000 + + + + + +10.11.1.0/24 +B1 + + +1 + +BW 768 EIGRP +WAN1 + +Core1 + + +Routing Table + + + +BW 256 2 Destination 10.11.0.0/16 10.12.0.0/16 + + +Next hop WAN1 WAN2 + +BW 256 Core2 + + +10.12.1.0/24 +B2 + + +BW 768 +WAN2 EIGRP Routing Table + + + +1 + +Summaries: 10.11.0.0/16 10.12.0.0/16 + +2 + +10,000,000 3,000,000 + + +Destination 10.11.0.0/16 10.12.0.0/16 + + +Next hop WAN1 WAN2 + + +Figure 5-18 Choosing Locations for Route Summarization + +The figure shows the advertisements of the summary routes. WAN1 and WAN2 both advertise the same summaries: 10.11.0.0/16 for some branches and 10.12.0.0/16 for the others. Note that by advertising the WAN routes, instead of filtering, the operations staff might have an easier time monitoring and troubleshooting the internetwork, while still meeting the design goal of reducing the size of the routing table. (Also, note that Router WAN1 summarizes Manufacturing’s routes of 10.17.32.0/19.) + +In some cases, the network designer has no preference for which of the two or more rout-ers should be used to reach hosts within the summary route range. For example, for most data center designs, as shown earlier in Figure 5-13, the routes from the left of the figure toward the data center, through Core1 and Core2, would typically be considered equal. + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 211 + +However, in some cases, as in the design shown in Figure 5-18, the network designer wants to improve the metric of one of the summary routes for a single address block to make that route the preferred route. Using 10.11.0.0/16 as an example, consider this more detailed description of the design: + +■ Use two PVCs to each branch—one faster PVC with 768-kbps CIR and one slower PVC (either 128-kbps or 256-kbps CIR). + +■ Roughly half the branches should have a faster PVC connecting to Router WAN1, and the other half of the branches should have a faster PVC connecting to Router WAN2. + +■ Assign user subnets from the range 10.11.0.0/16 for branches that use WAN1 as the primary WAN access point, and from 10.12.0.0/16 for the branches that use WAN2 as primary. + +■ Routing should be influenced such that packets flow in both directions over the faster WAN link, assuming that link is working. + +This design requires that both directions of packets flow over the faster PVC to each branch. Focusing on the outbound (core-toward-branch) direction for now, by following the design and setting the interface bandwidth settings to match the PVC speeds, the outbound routes will send packets over the faster PVCs. The main reason for the route choices is the following fact about summary routes with Cisco IOS: + +Set the summary route’s metric components based on the lowest metric route upon which the summary route is based. +By setting the interface bandwidth settings to match the design, the two WAN routers should summarize and advertise routes for 10.11.0.0/16 and 10.12.0.0/16, advertising these routes toward the core—but with different metrics. + +WAN1 advertises its 10.11.0.0/16 route with a lower metric than WAN2’s summary for 10.11.0.0/16, because all of WAN1’s routes for subnets that begin with 10.11 are reachable over links set to use 768 kbps of bandwidth. All WAN1’s links to branches whose subnets begin with 10.12 are reachable over links of speed 128 kbps or 256 kbps, so WAN1’s metric is higher than WAN2’s metric for the 10.12.0.0/16 summary. WAN2 follows the same logic but with the lower metric route for 10.12.0.0/16. + +As a result of the advertisements on WAN1 and WAN2, the core routers both have rout-ing table entries that drive traffic meant for the faster-through-WAN1 branches to WAN1, and traffic for the faster-through-WAN2 branches to WAN2. + +Suboptimal Forwarding with Summarization + +An important concept to consider when summarizing routes is that the packets might take a longer path than if summarization is not used. The idea works a little like this story. Say that you were traveling to Europe from the United States. You knew nothing of European geography, other than that you wanted to go to Paris. So, you look around and find hundreds of flights to Europe and just pick the cheapest one. When you get to + + + + +From the Library of Alexey Evseenko +212 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Europe, you worry about how to get the rest of the way to Paris—be it a taxi ride from the Paris airport or whether it takes a day of train travel. Although you do eventually get to Paris, if you had chosen to know more about European geography before you left, you could have saved yourself some travel time in Europe. + +Similarly, routers that learn a summary route do not know about the details of the sub-nets inside the summary. Instead, like the person who just picked the cheapest flight to Europe, the routers pick the lowest metric summary route for a prefix. That router +forwards packets based on the summary route. Later, when these packets arrive at rout-ers that do know all the subnets inside the summary, those routers can then use the best route—be it a short route or long route. + +For example, Figure 5-19 shows the less efficient routing of packets to host 10.11.1.1, a host off Router B1, assuming that the route summarization shown in Figure 5-14 still +exists. When WAN1’s 768-kbps CIR PVC to Router B1 fails, WAN1 does not change its route advertisement for its 10.11.0.0/16 summary route. When EIGRP advertises a sum-mary route, the advertising router considers the summary route to be up and working unless all subordinate routes fail. Unless all of WAN1’s specific routes in the 10.11.0.0/16 range failed, R1 would not notify routers on the right about any problem. So, when the example shown in Figure 5-19 begins, the 10.11.0.0/16 summary advertised by WAN1, as seen earlier in Figure 5-18, is still working, and both Core1 and Core2 use WAN1 as their next-hop router for their routes to 10.11.0.0/16. + +10.11.1.0/24 10.11.1.0/24 - WAN2 10.11.0.0/16 - WAN1 + +Core1 1 + +4 B1 WAN1 + + +3 +2 + + + + + +WAN2 +Core2 10.11.1.0/24 - B1 + +Figure 5-19 Suboptimal Forwarding Path When Primary PVC Fails + +Following the steps in the figure: + +Step 1. Core 1 sends a packet to 10.11.1.1, using its route for 10.16.0.0/16, to WAN1. + +Step 2. WAN1, which has routes for all the subnets that begin with 10.11, has a route for 10.11.1.0/24 with WAN2 as the next hop (because WAN1’s link to B1 has failed). + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 213 + +Step 3. WAN2 has a route for 10.11.1.0/24, with B1 as the next hop, so WAN2 for-wards the packet. + +Step 4. B1 forwards the packet to host 10.11.1.1. + + +Route Summarization Benefits and Trade-offs + +The previous section showed details of a classic trade-off with route summarization: the benefits of the summary route versus the possibility of inefficient routing. For easier study, the benefits and trade-offs for route summarization are listed here: + +Benefits: + +■ Smaller routing tables, while all destinations are still reachable. Key +Topic ■ Reduces Query scope: EIGRP Query stops at a router that has a summary route that +includes the subnet listed in the Query but not the specific route listed in the Query. + +■ EIGRP supports summarization at any location in the internetwork. + +■ The summary has the metric of the best of the subnets being summarized. + +Trade-offs: + +■ Can cause suboptimal routing. + +■ Packets destined for inaccessible destinations will flow to the summarizing router before being discarded. + + +Configuring EIGRP Route Summarization + +The more difficult part of EIGRP route summarization relates to the planning, design, and analysis of trade-offs, as covered in the preceding section. After you have made those design choices, configuring route summarization requires the addition of a few instances of the following interface subcommand: +ip summary-address eigrp asn prefix subnet-mask + +When configured on an interface, the router changes its logic for the EIGRP Update mes-sages sent out the interface, as follows: + + +■ Key +Topic + +■ + + + +■ + +The router brings down, and then back up, all EIGRP neighbors reachable on that interface, effectively causing neighbors to forget previous topology information and to listen to new information (when the neighborships recover). + +When the neighborships recover, the router advertises the summary route, per the ip summary-address command, assuming that the router has at least one route whose address range is inside the range of the summary route. + +The router does not advertise the subordinate routes. (The term subordinate route refers to the routes whose address ranges are inside the range of addresses defined +by the summary route.) + + + + + +From the Library of Alexey Evseenko +214 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide +S0/0/0.2 +128 Kbps + +■ The router adds a route to its own routing table, for the summary prefix/prefix length, with an outgoing interface of null0. + +In Figure 5-20, WAN1 and WAN2 summarize the routes for the data center in the range 10.16.0.0/16, instead of sending individual routes for this range to the branch offices. Example 5-14 shows the results of summarization on both routers. + +EIGRP Update: 10.16.0.0/16 + + +Fa0/0 10.11.1.1 + + + + + + +Fa0/0 10.12.1.1 + + + +S0/0/0.1 +B1 + + + + + + +B2 S0/0/0.2 +S0/0/0.1 + + + +768 Kbps .5 +WAN1 .9 .1 + + + +.2 .13 +768 Kbps .17 WAN2 +256 Kbps + +Core1 + +.6 + +.14 +.21 + + + +.22 .10 +.18 + +Core2 + + + + +Data Center: 10.16.1.0/24 10.16.2.0/24 10.16.3.0/24 10.16.4.0/24 + + + +Example Branch Faster to WAN2 + + +EIGRP Update: 10.16.0.0/16 + + +Figure 5-20 Summary for 10.16.0.0/16 on WAN1, WAN2 + +Example 5-14 Summarizing Routes for Data Center (10.16.0.0/16) on WAN1/WAN2 + +! On Router WAN2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +WAN2# show running-config +! lines omitted for brevity +! +interface Serial0/0/0.1 point-to-point +bandwidth 256 +ip address 10.1.2.1 255.255.255.252 +ip summary-address eigrp 1 10.16.0.0 255.255.0.0 5 +frame-relay interface-dlci 103 +! +interface Serial0/0/0.2 point-to-point +bandwidth 768 +ip address 10.1.2.5 255.255.255.252 +ip summary-address eigrp 1 10.16.0.0 255.255.0.0 5 +frame-relay interface-dlci 104 +! +WAN2# show ip eigrp topology 10.16.0.0/16 +IP-EIGRP (AS 1): Topology entry for 10.16.0.0/16 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 28416 +Routing Descriptor Blocks: + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 215 + +0.0.0.0 (Null0), from 0.0.0.0, Send flag is 0x0 +Composite metric is (28416/0), Route is Internal +Vector metric: +Minimum bandwidth is 100000 Kbit +Total delay is 110 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +10.1.2.2 (Serial0/0/0.1), from 10.1.2.2, Send flag is 0x0 +Composite metric is (11026688/3847936), Route is Internal +Vector metric: +Minimum bandwidth is 256 Kbit +Total delay is 40110 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 3 + +! Note that the following command lists only routes in the range +! of the summary – 10.16.0.0 – 10.16.255.255. +WAN2# show ip route 10.16.0.0 255.255.0.0 longer-prefixes +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 23 subnets, 6 masks +D 10.16.2.0/24 [90/156160] via 10.9.1.14, 00:19:06, FastEthernet0/0.12 +D 10.16.3.0/24 [90/156160] via 10.9.1.14, 00:19:06, FastEthernet0/0.12 +D 10.16.0.0/16 is a summary, 00:14:07, Null0 +D 10.16.1.0/24 [90/28416] via 10.9.1.18, 00:19:06, FastEthernet0/1.16 +[90/28416] via 10.9.1.14, 00:19:06, FastEthernet0/0.12 +D 10.16.4.0/24 [90/156160] via 10.9.1.14, 00:19:06, FastEthernet0/0.12 +WAN2# show ip route 10.16.0.0 255.255.0.0 +Routing entry for 10.16.0.0/16 +Known via "eigrp 1", distance 5 , metric 28416, type internal +Redistributing via eigrp 1 +Routing Descriptor Blocks: +* directly connected, via Null0 +Route metric is 28416, traffic share count is 1 + + + + +From the Library of Alexey Evseenko +216 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Total delay is 110 microseconds, minimum bandwidth is 100000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 0 + +Example 5-14 shows the results only on Router WAN2, but WAN1 will be identically configured with the ip summary-address command. With only two branch office routers actually implemented in my lab, WAN2 needs only two ip summary-address commands: one for the subinterface connected to Router B1 and another for the subinterface con-nected to B2. With a full implementation, this same command would be needed on each subinterface connected to a branch router. + +The example also shows how a router like WAN2 uses a summary route to null0. This route—10.16.0.0/16 with an outgoing interface of null0—causes the router (WAN2) to discard packets matched by this route. However, as you can see from the end of Example 5-14, WAN2 also has routes for all the known specific subnets. Pulling all these thoughts together, when the summarizing router receives a packet within the summary route’s range: + +■ If the packet matches a more specific route than the summary route, the packet is forwarded based on that route. + +■ When the packet does not match a more specific route, it matches the summary route and is discarded. + +To ensure that the router adds this local summary route, the router uses the administra-tive distance (AD) setting of 5. The user might have typed the ip summary-address eigrp 1 10.16.0.0 255.255.0.0 command, without the 5 at the end. Even so, Cisco IOS will +add this default AD value as seen in Example 5-10. With an AD of 5, WAN2 will ignore any EIGRP-advertised summary routes for 10.16.0.0/16—for example, the summary cre-ated by neighbor WAN1—because EIGRP’s default AD for internal routes is 90. In fact, the output of WAN2’s show ip eigrp topology 10.16.0.0/16 command lists two known routes for 10.16.0.0/16: one to null0 and the other to branch Router WAN1 (outgoing interface S0/0/0.1). WAN2 uses the lower-AD route to null0, which prevents a routing loop. (Note that this summary route with outgoing interface null0 is often called a dis-card route.) + +Next, consider the results on the branch routers. The following might be reasonable design requirements that should be verified on the branch routers: + +■ Each branch router’s route for 10.16.0.0/16 should use the primary (faster) PVC (see Figure 5-20). + +■ Each branch router should be able to converge quickly to the other 10.16.0.0/16 summary route without using EIGRP Queries (in other words, there should be an FS route). + +Example 5-15 confirms that both requirements are met. + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 217 + +Example 5-15 Results of the 10.16.0.0/16 Summary on Routers B1, B2 + +! Router B1 first !!!!!!!!!!!!!!!!!!!! +B1# show ip route 10.16.0.0 255.255.0.0 longer-prefixes +! lines omitted for brevity + +10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks +D 10.16.0.0/16 [90/3847936] via 10.1.1.1 , 00:16:53, Serial0/0/0.1 + +B1# show ip eigrp topology +! lines omitted for brevity +P 10.16.0.0/16, 1 successors, FD is 3847936 +via 10.1.1.1 (3847936/28416), Serial0/0/0.1 +via 10.1.2.1 (10514688/28416), Serial0/0/0.2 + +! Router B2 Next !!!!!!!!!!!!!!!!!!!! +B2# show ip route 10.16.0.0 255.255.0.0 longer-prefixes +! lines omitted for brevity + +10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks +D 10.16.0.0/16 [90/3847936] via 10.1.2.5, 00:16:44, Serial0/0/0.2 + +First, on Router B1, the router has an IP route for 10.16.0.0/16, with outgoing interface S0/0/0.1. Per Figure 5-20, this subinterface indeed connects to the primary PVC. Per the show ip eigrp topology command, two possible routes for 10.16.0.0/16 are listed; this command only lists successor and feasible successor routes. Also, note that the FS route’s RD (28,416) is less than the successor route’s FD (3,847,936), which means that the sec-ondary route indeed meets the feasibility condition. + +The reverse is true on Router B2. B2’s best route for 10.16.0.0/16 uses its S0/0/0.2, which connects to B2’s primary (faster) PVC through WAN2. Although not shown, it also lists its backup route over the slower PVC as a feasible successor. + +The route summarization feature discussed in this section is sometimes referred to as manual route summarization to contrast it with the term auto-summarization. EIGRP auto-summarization is explained next. + + + + + + + + + + + +Key Topic + +Auto-summary + +Automatic summarization, also called auto-summary, causes a router to automatically advertise a summary route under certain conditions, without the use of the ip summary-address command. When using auto-summary, if a router has interfaces in more than one Class A, B, or C network, that router will advertise a single summary route for an entire Class A, B, or C network into the other classful network, rather than advertise routes for the individual subnets. The following is a more formal definition: + +When a router has multiple working interfaces, and those interfaces use IP addresses in different classful networks, the router advertises a summary route for each classful +network on interfaces attached to a different classful network. + + + + +From the Library of Alexey Evseenko +218 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The auto-summary feature first existed as a required feature of classful routing protocols. By definition, classful routing protocols (RIPv1 and IGRP) do not advertise subnet mask information. The omission of the subnet mask in routing updates causes several design problems—in particular, these protocols cannot support variable-length subnet masks (VLSM), route summarization, or discontiguous network designs. + +The newer IGPs (for example, EIGRP, OSPF, and RIPv2) are classless routing protocols, because they advertise the subnet mask and support VLSM. However, with auto-summa-ry enabled, EIGRP acts like classful routing protocols in one specific way: They do not support discontiguous networks. To support discontiguous networks with EIGRP, simply disable auto-summary. + +To better understand discontiguous networks, consider this analogy. U.S. residents can appreciate the concept of a discontiguous network based on the common term contigu-ous 48, referring to the 48 U.S. states other than Alaska and Hawaii. To drive to Alaska from the contiguous 48 U.S. states, for example, you must drive through another country (Canada), so Alaska is not contiguous with the 48 states. In other words, it is discontiguous. + +More formally: + +■ Contiguous network: A single classful network in which packets sent between every pair of subnets will pass only through subnets of that same classful network, without having to pass through subnets of any other classful network. + +■ Discontiguous network: A single classful network in which packets sent between at least one pair of subnets must pass through subnets of a different classful network. + +Figure 5-21 shows a classic example of a discontiguous network 10.0.0.0. Subnets of Class A network 10.0.0.0 exist on the left and the right, with subnets of Class B network +172.16.0.0 in the middle of the internetwork. Following the figure, the problem created by the auto-summary feature is described. + + +Which Route to Network 10.0.0.0 Do I Believe? + + +10.2.1.0 +10.2.2.0 + + +Albuquerque +172.16.2.0 172.16.3.0 + +10.3.4.0 +10.3.5.0 + + + +10.2.3.0 S0/0 S0/1 +10.2.4.0 Yosemite + +10.3.6.0 +Seville 10.3.7.0 + + +172.16.1.0 +Mask: 255.255.255.0 + +Figure 5-21 Discontiguous Network 10.0.0.0 + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 219 + +The problem is that when EIGRP auto-summarizes routes at the boundary between classful networks, routers in other classful networks cannot route packets to all the destinations. For example, because both Yosemite and Seville use auto-summary, they both advertise a route for 10.0.0.0/8 to Albuquerque. Albuquerque might choose one of the two as the better route—for example, it might choose the route to the left, through Yosemite. However, in that case, Albuquerque cannot forward packets to the network 10.0.0.0 hosts on the right. Even if Albuquerque decided to add both routes to its routing table, the load sharing typically occurs per destination IP address, not per subnet. So, some packets might be delivered to the correct host and others not. + +For EIGRP, two solutions exist. First, you could design the network to not use a discon-tiguous network. Alternatively, you can just disable auto-summary using the no auto-summary subcommand inside EIGRP configuration mode. This command affects the behavior of the router on which it is configured only and tells that router to not advertise a summary route for the entire classful network. Instead, that router advertises all the subnets, as if the auto-summary feature did not exist. + + +Note The auto-summary and no auto-summary commands have no effect on routers that connect to a single classful network. + + + +Default Routes + +A router’s default route matches the destination of all packets that are not matched by any other route in the IP routing table. In fact, a default route can be thought of as the ultimate summary route—a route for the prefix that includes all IPv4 addresses, as repre-sented by prefix/length 0.0.0.0/0. + +This section first examines the most common use of default routes inside an enterprise: to draw Internet traffic toward the Internet-connected routers without having to put routes for all Internet destinations into the enterprise routers’ routing tables. Following that, this section examines two methods for EIGRP to advertise the default route. + +Default Routing to the Internet Router + +Consider an enterprise network and its connection to the Internet, as shown in Figure 5-22. For now, the design shows a single Internet-facing router (I1). As is often the case, the entire enterprise in this figure uses private IP addresses. In this case, all enterprise subnets are part of private Class A network 10.0.0.0. + + + + + + + + + + +From the Library of Alexey Evseenko +220 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +default B1 +default WAN1 + + +Core1 + + + + +default B2 +default + + +default default + + + + +WAN2 default default +B3 + +Core2 + + +default + + +I1 S0/0/0 Internet + +Figure 5-22 Pulling Packets to the Internet Router (I1) + +From a design perspective, the entire enterprise can use a default route to forward packets to the Internet. To accomplish this design, the Internet-facing router advertises a default route. All routers flood this default prefix throughout the EIGRP domain, building their own default routes. + +When converged, all routers have a default route, plus the usual enterprise routes. Packets destined for addresses inside the enterprise use the same old routes, ignoring the default route. Packets destined outside the enterprise use each router’s respective default route because no other routes match the destination. Eventually, these packets arrive at Router I1. When I1 receives these packets, it can forward toward the Internet, either based on a default route or on routes learned using BGP. + +Figure 5-22 shows a case with just one Internet-facing router, but with multiple routers, the same concepts can be used. The multiple Internet-facing routers can each advertise a default route, and each enterprise router will think that one of the available defaults is best—causing the packets to arrive at the nearest Internet access point. + +Default Routing Configuration with EIGRP + +This section examines the two main options for EIGRP to advertise default routes: to define a static default route and advertise it with EIGRP and to flag an existing route to be used also as a default route. + +Advertising Static Default Routes with EIGRP + +To cause the advertisement of the default routes shown in Figure 5-22, Router I1 can fol-low these steps: + +Step 1. +Key Topic + + +Create a static route default route using the ip route 0.0.0.0 0.0.0.0 S0/0/0 +command. + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 221 + +Step 2. Inject this route into the EIGRP topology database, either using the network 0.0.0.0 command or by redistributing the static route. + +First, examine the command listed for Step 1: ip route 0.0.0.0 0.0.0.0 S0/0/0. The pre-fix and mask together represent all IPv4 addresses. The reasoning is that if a mask of 255.255.0.0 means “the last two octets can be any value,” and 255.0.0.0 means “the last three octets can be any value,” a subnet mask of 0.0.0.0 means that all four octets can be any value. The outgoing interface, S0/0/0 in this case, tells I1 to send packets for other-wise unknown destinations over the link to the Internet, as intended. + +After Step 1, Router I1 has a route in its routing table, but EIGRP does not yet advertise the route. I1 could be configured to perform route redistribution for this static route. (Refer to Chapter 10 for more information on route redistribution.) The other option is to use the network 0.0.0.0 EIGRP subcommand. Oddly enough, this is a special case in which Cisco IOS thinks “if my routing table has a default route in it, put a default route (0.0.0.0/0) into the EIGRP table.” (If the route leaves the routing table, the router will noti-fy neighbors that the route has failed.) + +Configuring a Default Network + +The second option for creating a default route is to flag a route for a classful network— for a prefix that will be advertised into the EIGRP domain—as a route that can be used as a default route. Then each router can use the forwarding details in that route—the out-going interface and next-hop router—as its default route. + +Configuring this feature requires a couple of steps. The concepts require the most thought, with the configuration commands that follow being relatively simple: + +Step 1. Key +Topic + + +Step 2. + + +On the router to which all traffic should be directed, identify a classful network that can be advertised into the EIGRP domain, and ensure that network is being advertised into EIGRP (typically using the EIGRP network command). + +Configure that network as a default network using the global command ip +default-network network-number. + + +Step 1 requires a Class A, B, or C network, known in the routing table of the router that will generate the default route (Router I1 in Figure 5-23). Most often, that route is either created off a loopback interface for the purpose of making this process work, or an exist-ing route on the Internet side of the router is used. + +Figure 5-23 shows two examples. First, Class C network 198.133.219.0/24 exists off I1’s S0/0/0 interface, so I1 has a connected route for this Class C network in its routing table. Alternatively, the engineer could configure a loopback interface, such as loopback 8, so that I1 would have a connected route for 192.31.7.0/24. In both cases, the routes would need to be advertised into EIGRP, by matching the address using the network command. + +If the configuration stopped at Step 1, the enterprise routers simply know yet another route. By adding the ip default-network command to refer to one of these networks, EIGRP then flags this route as a candidate default route. As a result, each EIGRP router treats its route for this particular network also as if it were a default route. + + + +From the Library of Alexey Evseenko +222 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Core1 + + +B1 WAN1 + + +Core2 + + +B2 WAN2 + +EIGRP Update 198.133.219.0/24 192.31.7.0/24 + + + +I1 + +S0/0/0 198.133.219.1 + + +198.133.219.2 ISP1 + + + +Loopback 8 192.31.7.1/24 + +Figure 5-23 Example Default Networks + +Example 5-16 shows an example of the configuration on Router I1, along with some of the show commands on Router I1. + +Example 5-16 Configuring a Default Network on Router I1 + +I1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +I1(config)# interface loopback 8 +I1(config-if)# ip address 192.31.7.1 255.255.255.0 +I1(config-if)# router eigrp 1 +I1(config-router)# network 192.31.7.0 +I1(config-router)# exit +I1(config)# ip default-network 192.31.7.0 +I1(config-router)# ^Z + +I1# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 15 subnets, 3 masks +! lines omitted for brevity + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 223 + +C* 192.31.7.0/24 is directly connected, Loopback8 + +I1# show ip eigrp topology 192.31.7.0/24 +IP-EIGRP (AS 1): Topology entry for 192.31.7.0/24 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 128256 +Routing Descriptor Blocks: +0.0.0.0 (Loopback8), from Connected , Send flag is 0x0 +Composite metric is (128256/0), Route is Internal +Vector metric: +Minimum bandwidth is 10000000 Kbit +Total delay is 5000 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1514 +Hop count is 0 +Exterior flag is set + +The configuration has several results, as seen in the example: + +■ A connected route for 192.31.7.0/24, a Class C network + +■ The advertisement of that network into EIGRP because of the network 192.31.7.0 command + +■ The setting of the exterior flag on the route + +Because of the ip default-network 192.31.7.0 command, the routing table lists the route as a candidate default route, as denoted by an asterisk. + +Interestingly, the router with the ip default-network command configured (I1 in this case) does not use that route as a default route, as indicated by the highlighted phrase “Gateway of last resort is not set.” (Gateway of last resort refers to the next-hop router of a router’s current default route.) Although I1 flags the route as a candidate default route, I1 itself does not use that route as its default, because I1 is actually the original advertiser of the default. + +Moving on to another enterprise router, in this case B1, you can see in Example 5-17 that not only does the remote router learn the candidate default route, but that B1 also uses this same information as B1’s default route. + +Example 5-17 Gateway of Last Resort on Router B1 + +B1# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route + + + + +From the Library of Alexey Evseenko +224 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 10.1.1.1 to network 192.31.7.0 + +10.0.0.0/8 is variably subnetted, 15 subnets, 3 masks +Lines omitted for brevity +D* 192.31.7.0/24 [90/2297856] via 10.1.1.1, 00:05:10, Serial0/0/0.1 + +In this case, B1 has indeed learned an EIGRP route for 192.31.7.0/24, a route flagged as exterior. Because this happens to be the only candidate default route learned by B1 at this point, it is the best default route. So, B1 sets its gateway of last resort to 10.1.1.1— the next-hop IP address of B1’s route to 192.31.7.0/24. If B1 knew of multiple candidate default routes, it would have chosen the best route based on administrative distance and then metric, and used that route as the basis for the gateway of last resort. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 225 + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 5-8 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 5-8 Design Review + + +Design Goal + +Limit consumption of IP subnets in Frame Relay WAN design. +In a relatively slow Frame Relay WAN, protect against consuming too much bandwidth with overhead EIGRP traffic. +Plan to change bandwidth from 1X CIR to 2X CIR on all Frame Relay subinterfaces. +Plan to set bandwidth to values other than actual interface speeds to manipulate EIGRP metrics. +A goal of ensuring all remote routers’ secondary EIGRP routes do not require Queries for convergence. +What tools can we use to meet the design goal of fast convergence? (four items) +R1 and R2 will advertise the same summary route; ensure that R1 is the preferred EIGRP path for that summary. + +Possible Implementation Choices Covered in This Chapter + + + + + + + +From the Library of Alexey Evseenko +226 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Design Goal + +Prevent the edge routers in sites for one division of the company from knowing routes for subnets in another division. +Always ensure that the shortest path is taken with each route. + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 5-9 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 5-9 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +A Frame Relay multipoint interface, with 20 PVCs attached, has a configuration for 10 percent of the bandwidth to be used for EIGRP. How much is allocated per PVC? +A configuration lists the no ip split-horizon command. When would that matter? +The plan calls for setting all EIGRP K-values to 1. What negative effect could this have on routes in the IP routing table? +The configuration uses offset lists. Will that impact the calculation of FD and/or RD? +The plan lists a sample configuration migrating an interface from delay 20 to delay 200. How much will the metric go up? +The plan shows extensive use of Class C private networks inside a large enterprise. What effect might EIGRP auto-summary have? +The plan shows a sample configuration of the ip summary-address eigrp 1 10.10.0.0 255.255.252.0 command on Router R1. What routes should I see on R1? What will their administrative distance be? + + + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 227 + + +Question Answer +The plan shows the use of the variance 4 command. What must be configured to add other routes to a routing table? (two items) +The plan calls for filtering 10.10.10.0/26 and 10.10.12.0/26, but not 10.10.11.0/24. What tools can be used? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own EIGRP implementation plan, list in Table 5-10 configuration commands related to the configuration of the following features. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 5-10 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Enabling EIGRP on interfaces + +Enabling or disabling Split Horizon for EIGRP + +Setting the bandwidth consumed by EIGRP on an interface +Setting an interface’s logical bandwidth + +Setting an interface’s logical delay + +K-values + +Configuring an EIGRP offset list that matches a prefix +Configuring an EIGRP offset list that matches a prefix and prefix length +Configuring a summary route + +Enabling or disabling auto-summary + +Configuring unequal-cost load balancing + +Configuring an EIGRP stub router + +Filtering EIGRP routes using numbered + +ACLs + +Filtering EIGRP routes using prefix lists + + + + + + +From the Library of Alexey Evseenko +228 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Feature Configuration Commands/Notes +Enabling filtering EIGRP routes using route maps +Configure a default route using ip default-network +Configure a default route using static routes + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own EIGRP verification plan, list in Table 5-11 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from +memory during your final reviews before taking the exam. + + +Table 5-11 Verification Plan Memory Drill +Key +Topic Information Needed Command + +The composite metric values for all EIGRP prefixes. +Display EIGRP Split Horizon settings. + +Calculate the maximum bandwidth EIGRP will consume on a physical or point-to-point subinterface. +Calculate the maximum bandwidth EIGRP will consume per PVC on a multipoint Frame Relay subinterface. +Display the increase in RD after implementing an EIGRP offset list. +Display interface bandwidth and delay settings. +List EIGRP K-values. + +Find the number of successor and feasible successor routes. +Find all routes, including nonsuccessors. + +Determine whether the local router is a stub router. +Determine whether a neighboring router is a stub router. +Display a summary IP route. + + + + +From the Library of Alexey Evseenko +Chapter 5: Advanced EIGRP Concepts 229 + + +Information Needed Command +On summarizing router, display EIGRP topology info on a summary route. +On summarizing router, display IP routes for a summary route and its subordinate routes. +On summarizing router, display the administrative distance of the null route. +Display the current auto-summary setting. + +Find the current settings of variance and maximum-paths. +Display messages each time EIGRP suppresses a prefix advertisement because of Split Horizon. +Display prefix lists. + +Display route maps. + +Determine whether a prefix in the EIGRP topology table has been flagged as a candidate default route. +Determine whether an IP route has been flagged as a candidate default route. +Display a router’s preferred default route. + + + +Review All the Key Topics + +Review the most important topics from the chapter, noted with the Key Topic icon in the outer margin of the page. Table 5-12 lists a reference of these key topics and the page numbers on which each is found. + +Table 5-12 Key Topics for Chapter 5 Key +Topic Key Topic Element Description Page Number + + +List + +List + +List + +Definitions + +List + +Three sources for seeding a local router’s EIGRP 162 topology table +EIGRP message types (5) 163 + +Rules for EIGRP topology exchange 166 + +Feasible Distance, Reported Distance 172 + +Key points about variance 183 + + + + + + + +From the Library of Alexey Evseenko +230 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Key Topic Element Definition +Figure 5-9 List + +List + +Definition + +Table 5-4 + +Definition + +List + +Table 5-6 + +List + +List + +List + +Definition + +List + +List + +Description Feasibility condition +Successors and Feasible Successors with EIGRP + +Two commands to find all EIGRP routes versus all successor/feasible successor routes +EIGRP process of finding routes when going active + +EIGRP stub router + +Parameters on the eigrp stub Command + +Rule by which summary routes reduce Query scope + +Prefix list logic + +LE and GE Parameters on IP Prefix List, and the Implied Range of Prefix Lengths +Key points of route map logic + +Benefits and trade-offs regarding the use of route summarization +A summary of what occurs when configuring an EIGRP summary route +Auto-summary + +Steps to advertise static routes with EIGRP + +Steps to configure a default network + +Page Number 184 +185 185 + +188 + +190 + +191 + +192 + +199 + +200 + +205 + +213 + +213 + +217 + +220 + +221 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +feasibility condition, feasible distance, feasible successor, full update, partial update, reported distance, advertised distance, successor, Split Horizon, bandwidth, delay, +K-value, offset list, going active, DUAL, Query scope, EIGRP stub router, variance, prefix list, route map, distribute list, address block, subordinate route, auto-summary, default network, static default route, gateway of last resort + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ EIGRP for IPv6: This section compares and con-trasts EIGRP for IPv4 and for IPv6, and shows how to configure EIGRP for IPv6. Verification commands are also covered in this section. +■ Named EIGRP: This section examines an alternate approach to configuring EIGRP. While traditional EIGRP configuration necessitates that some com-mands be entered under interface configuration mode and other commands be entered under router configuration mode, Named EIGRP allows those commands to be entered collectively, under a single EIGRP virtual instance. + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 6 + + + + + + +EIGRP for IPv6 and Named EIGRP + + +EIGRP’s original architecture allowed it to support the routing of multiple protocols, including IPv4, IPX, and AppleTalk. As a result, it was not difficult for Cisco to allow IPv6 support with Enhanced Interior Gateway Routing Protocol (EIGRP). One of the primary configuration differences between EIGRP for IPv4 and EIGRP for IPv6 is how an interface is told to participate in an EIGRP autonomous system (AS). As you’ll see in this chapter, you enter interface configuration mode and directly tell the interface to route IPv6 traffic as part of a specific EIGRP AS, as opposed to using a network command in router configuration mode for EIGRP. + +Another fairly recent enhancement to EIGRP is a new hierarchical approach to configu-ration, specifically Named EIGRP configuration. While the configuration of Named EIGRP might seem more complex at first, it allows you to enter all your EIGRP configu-ration commands under a single configuration section, rather than going back and forth between interface configuration mode and router configuration mode, which introduces the possibility of mistyping the EIGRP AS every time you go back into router configura-tion mode. Also, for many complex EIGRP configurations, a Named EIGRP configuration requires fewer commands than classic EIGRP configuration. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these six self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 6-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings, so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 6-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +EIGRP for IPv6 + +Named EIGRP + +Questions +1, 2 + +3–6 + + + + + + + + + +From the Library of Alexey Evseenko +234 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. You are attempting to configure EIGRP for IPv6 on a router. However, Cisco IOS presents you with a message indicating that routing is not enabled for IPv6. What command would you issue to enable IPv6 routing? +a. Router(config)# ipv6 unicast-routing + +b. Router(config-rtr)# ipv6 unicast-routing + +c. Router(config-rtr)# ipv6 cef + +d. Router(config)# ipv6 eigrp + +2. Router R1 connects to Router R2 over an Ethernet LAN with both routers using their Fa0/0 interfaces. R1 learns a route from R2 using EIGRP for IPv6. That route lists Fa0/0 as the outgoing interface with R2 as the next hop. The configuration excerpt shows all relevant configuration on R2’s Fa0/0 interface. Which of the following is true about R1’s route? + +interface f0/0 +mac-address 1111.1111.1111 +ipv6 address 2000::/64 eui-64 +ipv6 address 2001::1/64 + +a. The next hop is 2000::1311:11FF:FE11:1111 + +b. The next hop is FE80::1311:11FF:FE11:1111 + +c. The next hop is FE80::5111:11FF:FE11:1111 + +d. The next hop is 2001::1 + +3. Under what configuration mode for Named EIGRP would you configure a passive interface? + +a. Address-Family configuration mode + +b. Address-Family-Interface configuration mode + +c. Address-Family-Global configuration mode + +d. Address-Family-Topology configuration mode + +4. Under what configuration mode for Named EIGRP would you configure variance? + +a. Address-Family configuration mode + +b. Address-Family-interface configuration mode + +c. Address-Family-Global configuration mode + +d. Address-Family-Topology configuration mode + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 235 + +5. When configuring Named EIGRP, you want to specify the Hello interval for all interfaces. You could go into address-family-interface configuration mode for each interface and enter the hello-interval command. However, what command could you give from address-family configuration mode to go into a configuration mode that allowed you to configure the Hello Interval for all interfaces with a single hello-interval command? +a. address-family global + +b. af-interface default + +c. af-interface-all + +d. address-family * + +6. You configured a router with a Named EIGRP configuration. What command would you use to view the EIGRP for IPv4 topology table? + +a. show address-family ipv4 topology + +b. show ip eigrp topology + +c. show address-family-topology + +d. show ip address-family + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +236 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +IPv6 is no longer a curiosity that we know we will need to migrate to someday. IPv6 is happening all around us right now. So, we have to be able to support it on our networks. What IGP routing protocol options do we have for IPv6? Well, the common ones we might think of are RIP next generation (RIPng), EIGRP, and Open Shortest Path First ver-sion 3 (OSPFv3). The choice of which routing protocol to use will probably be based on what we are currently using to route IPv4 traffic. + +However, if you are currently running EIGRP for your IPv4 networks, you might want to stay with EIGRP as your interior gateway protocol (IGP) of choice to support IPv6 traffic. That is the focus of the first section in this chapter. + +The second major section of this chapter introduces you to a new paradigm for EIGRP configuration, called named mode configuration, which we will also refer to as Named EIGRP. This hierarchical approach to configuration can help reduce configuration errors, while being more efficient for complex EIGRP configurations. + +EIGRP for IPv6 + +Cisco originally created EIGRP to advertise routes for IPv4, IPX, and AppleTalk. This original EIGRP architecture easily allowed for yet another Layer 3 protocol, IPv6, to be added. As a result, Cisco did not have to change EIGRP significantly to support IPv6, so many similarities exist between the IPv4 and IPv6 versions of EIGRP. + + +Note Many documents, including this chapter, refer to the IPv6 version of EIGRP as EIGRP for IPv6. However, some documents at www.cisco.com also refer to this protocol as EIGRPv6, not because it is the sixth version of the protocol, but because it implies a relationship with IPv6. + + +This section begins with a discussion of the similarities and differences between the IPv4 and IPv6 versions of EIGRP. The remaining coverage of EIGRP in this section focuses on the changes to EIGRP configuration and verification in support of IPv6. + +EIGRP for IPv4 and IPv6: Theory and Comparisons + +For the most part, EIGRP for IPv4 and for IPv6 have many similarities. The following list outlines some of the key differences: + +■ EIGRP for IPv6 advertises IPv6 prefixes/lengths, rather than IPv4 subnet/mask information. + +■ EIGRP for IPv6 uses the neighbor’s link-local address as the next-hop IP address; EIGRP for IPv4 has no equivalent concept. + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 237 + +■ EIGRP for IPv6 encapsulates its messages in IPv6 packets, rather than IPv4 packets. + +■ EIGRP for IPv4 defaults to use automatic route summarization at the boundaries of classful IPv4 networks. IPv6 has no concept of classful networks, so EIGRP for IPv6 cannot perform any automatic summarization. + +■ EIGRP for IPv6 does not require neighbors to be in the same IPv6 subnet as a requirement to become neighbors. + +Other than these differences, most of the details of EIGRP for IPv6 work like EIGRP for IPv4. For reference, Table 6-2 compares the features of each. + +Table 6-2 Comparing EIGRP for IPv4 and IPv6 Key +Topic Feature EIGRP for IPv4 EIGRP for IPv6 + + +Advertises routes for... + +Layer 3 protocol for EIGRP messages + +Layer 3 header protocol type + +UDP port + +Uses Successor, Feasible Successor logic + +Uses DUAL + +Supports VLSM + +Can perform automatic summarization + +Uses triggered updates + +Uses composite metric, default using bandwidth and delay +Metric meaning infinity + +Supports route tags + +Multicast Update destination + +IPv4 + +IPv4 + +88 + +— + +Yes + +Yes + +Yes + +Yes + +Yes + +Yes + +232 – 1 + +Yes + +224.0.0.10 + +IPv6 + +IPv6 + +88 + +— + +Yes + +Yes + +Yes + +— + +Yes + +Yes + +232 – 1 + +Yes + +FF02::A + + + + +Configuring EIGRP for IPv6 + +EIGRP for IPv6 follows the same basic configuration style as for RIPng. The specific EIGRP for IPv6 configuration steps are as follows: + + +Key Topic + +Step 1. Enable IPv6 routing with the ipv6 unicast-routing global command. + +Step 2. Enable EIGRP using the ipv6 router eigrp { 1 – 65535} global configuration command. + + + + + + + + +From the Library of Alexey Evseenko +238 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 3. Enable IPv6 on the interface, typically with one of these two methods: + +■ Configure an IPv6 unicast address on each interface, using the ipv6 address address/prefix-length [eui-64] interface command. + +■ Configure the ipv6 enable command, which enables IPv6 and causes the router to derive its link-local address. +Step 4. Enable EIGRP on the interface with the ipv6 eigrp asn interface subcom-mand (where the asn matches the ipv6 router eigrp asn global configuration command). +Step 5. Enable EIGRP for IPv6 with a no shutdown command while in EIGRP con-figuration mode, if EIGRP is currently disabled. + +Step 6. If no EIGRP router ID has been automatically chosen, because of not hav-ing at least one working interface with an IPv4 address, configure an EIGRP router ID with the router-id rid command in EIGRP configuration mode. + +The first four steps essentially mirror the four steps in the RIPng configuration process discussed in Chapter 3, “IPv6 Review and RIPng.” The same interdependencies exist for EIGRP for IPv6 as well. Specifically, the command at Step 2 works only if Step 1’s com-mand has been configured, and the command at Step 4 fails if the command at Step 3 has not yet been completed. + +EIGRP for IPv6 might also require Steps 5 and 6, whereas RIPng does not need equivalent steps. First, at Step 5, Cisco IOS supports the ability to stop and start the EIGRP process with the shutdown and no shutdown router mode subcommands. + +Step 6 shows the other difference as compared to RIPng configuration, but this step might or might not be needed. The EIGRP for IPv6 process must have a router ID (RID) before the process works. EIGRP for IPv6 uses the same process as EIGRP for IPv4 for choosing the RID. The EIGRP for IPv6 RID is indeed a 32-bit number. The following list defines how EIGRP for IPv6 picks its RID, listed in the order of preference: +Step 1. Use the configured value (using the router-id a.b.c.d EIGRP subcommand under the ipv6 router eigrp configuration mode). + +Step 2. Use the highest IPv4 address on an up/up loopback interface. + +Step 3. Use the highest IPv4 address on an up/up nonloopback interface. + +Note that although most installations already have IPv4 addresses configured, it is pos-sible that the EIGRP for IPv6 process cannot derive an RID value. If the router has no working interfaces that have IPv4 addresses, and the EIGRP for IPv6 RID is not explicitly configured, the EIGRP for IPv6 process simply does not work. So, the six-step configura-tion process includes a mention of the EIGRP RID. More generally, it might be prudent to configure an RID explicitly as a matter of habit. + +After being enabled on an interface, EIGRP for IPv6 performs the same two basic tasks as it does with EIGRP for IPv4: It discovers neighbors and advertises connected subnets. EIGRP for IPv6 uses the same set of neighbor checks as do routers using EIGRP for IPv4, except that EIGRP for IPv6 does not require that neighboring IPv6 routers have IPv6 + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 239 + +addresses in the same subnet. Also, as with EIGRP for IPv4, EIGRP for IPv6 adver-tises any and all connected subnets on an interface, with the exception of the link-local addresses and the local routes (the host routes for a router’s own interface IPv6 addresses). + +Example 6-1 shows a sample configuration on Router R1 from Figure 6-1. All neighboring routers must use the same ASN; ASN 9 will be used in this case. + +Subnet 2034::/64 + +SW1 + +Fa0/0 S0/0/0.1 R3 +S0/0/0.2 + +S0/0/0.1 +Fa0/0 +R4 +S0/0/0.2 + + + + +S0/0.1 +Fa0/0 + + +Subnet 2013::/64 + +Subnet 2014::/64 + + +Subnet 2015::/64 + +Subnet 2023::/64 + + +Subnet 2024::/64 + + +Fa0/0 R1 Fa0/1 +Fa0/0.1 + + + + + +Fa0/0.1 +Fa0/0 + + +Fa0/1 + +Fa0/2 Gi0/1 + + + + + + +Fa0/1 Gi0/1 + + + + + +Data SW3 Center +Subnet 2099::/64 + + + +R5 S0/0.2 Subnet 2025::/64 + +Subnet 2005::/64 + + +R2 Fa0/1 Fa0/2 +SW2 + + + +Figure 6-1 Sample Internetwork for IPv6 Routing Protocol Configuration + +Example 6-1 Configuring EIGRP for IPv6 Routing on R1 Key +Topic R1# show running-config +! output is edited to remove lines not pertinent to this example +! Configuration step 1: enabling IPv6 routing +ipv6 unicast-routing + +! Next, configuration steps 3 and 4, on 5 different interfaces +interface FastEthernet0/0.1 +ipv6 address 2012::1/64 +ipv6 eigrp 9 +! +interface FastEthernet0/0.2 +ipv6 address 2017::1/64 +ipv6 eigrp 9 +! +interface FastEthernet0/1.18 +ipv6 address 2018::1/64 +ipv6 eigrp 9 +! +interface Serial0/0/0.3 +ipv6 address 2013::1/64 + + + + +From the Library of Alexey Evseenko +240 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ipv6 eigrp 9 +! +interface Serial0/0/0.4 +ipv6 address 2014::1/64 +ipv6 eigrp 9 +! +interface Serial0/0/0.5 +ipv6 address 2015::1/64 +ipv6 eigrp 9 +! +! Configuration steps 2, 5, and 6 +ipv6 router eigrp 9 +no shutdown +router-id 10.10.34.3 + + +Verifying EIGRP for IPv6 + +The EIGRP for IPv6 show commands generally list the same kinds of information as the equivalent commands for EIGRP for IPv4, even more so than RIPng. In most cases, sim-ply use the same show ip... commands applicable with IPv4 and EIGRP, and substitute ipv6 for ip. Table 6-3 lists a cross-reference comparing popular EIGRP-related commands for both versions. Note that the table assumes that the commands begin with either show ip or show ipv6 in all but the last row of the table. + + +Table 6-3 +Key +Topic Function + + +Comparing EIGRP Verification Commands: show ip… and show ipv6... + +show ip... show ipv6... + + + +All routes + +All EIGRP-learned routes + +Details on the routes for a specific prefix +Interfaces on which EIGRP is enabled, plus metric weights, variance, redistribution, max-paths, admin distance +List of routing information sources + +Hello interval + +EIGRP database + +Debug that displays sent and received Updates + + +... route + +... route eigrp + +... route subnet mask + +... protocols + + + +... protocols + +... eigrp neighbors + +... eigrp interfaces detail + +... eigrp topology [all-links] + +debug ip eigrp notifications + + +... route + +... route eigrp + +... route prefix/length + +... protocols + + + +... eigrp neighbors + + +... eigrp interfaces detail + +... eigrp topology [all-links] + +debug ipv6 eigrp notifications + + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 241 + +Example 6-2 shows a few sample show commands taken from Router R3 in the internet-work shown in Figure 6-1. The explanatory comments are listed within the example. + +Example 6-2 IPv6 EIGRP show Commands + +! On R3, as when using RIPng, the next-hop address is the +! link-local address of the next router. + +R3# show ipv6 route 2099::/64 +Routing entry for 2099::/64 +Known via "eigrp 9 ", distance 90, metric 2174976, type internal +Route count is 2/2, share count 0 +Routing paths: +FE80::22FF:FE22:2222, Serial0/0/0.2 +Last updated 00:24:32 ago +FE80::11FF:FE11:1111, Serial0/0/0.1 +Last updated 00:07:51 ago + +! Note that the next command lists only EIGRP-learned routes. It lists +! two next-hops for 2099::64. Note the next-hop information lists +! link-local addresses. +R3# show ipv6 route eigrp +IPv6 Routing Table - Default - 19 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, M - MIPv6, R - RIP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external +O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +D 2005::/64 [90/2684416] +via FE80::11FF:FE11:1111, Serial0/0/0.1 +via FE80::22FF:FE22:2222, Serial0/0/0.2 +D 2012::/64 [90/2172416] +via FE80::22FF:FE22:2222, Serial0/0/0.2 +via FE80::11FF:FE11:1111, Serial0/0/0.1 +D 2014::/64 [90/2681856] +via FE80::11FF:FE11:1111, Serial0/0/0.1 +D 2015::/64 [90/2681856] +via FE80::11FF:FE11:1111, Serial0/0/0.1 + +! lines omitted for brevity... +D 2099::/64 [90/2174976] +via FE80::22FF:FE22:2222 , Serial0/0/0.2 +via FE80::11FF:FE11:1111, Serial0/0/0.1 +! show ipv6 protocols displays less info than its IPv4 cousin. +R3# show ipv6 protocols +IPv6 Routing Protocol is "eigrp 9" + + + + +From the Library of Alexey Evseenko +242 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +EIGRP maximum hopcount 100 +EIGRP maximum metric variance 1 +Interfaces: +FastEthernet0/0 +Serial0/0/0.1 +Serial0/0/0.2 +Redistribution: +None +Maximum path: 16 +Distance: internal 90 external 170 + +! This command lists the equivalent of the information in the +! show ip protocols commands' "Routing Information Sources" heading. +! Note the link-local addresses are listed. +R3# show ipv6 eigrp neighbors +IPv6-EIGRP neighbors for process 9 +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num + +1 Link-local address: +FE80::22FF:FE22:2222 +0 Link-local address: +FE80::11FF:FE11:1111 + +Se0/0/0.2 + +Se0/0/0.1 + +14 01:50:51 3 200 0 82 + +13 01:50:52 14 200 0 90 + + +! The next command lists the EIGRP topology database, including +! feasible distance calculations, reported distance, and listing +! all successor and feasible successor routes. +R3# show ipv6 eigrp topology +IPv6-EIGRP Topology Table for AS(9)/ID(10.10.34.3) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2005::/64, 2 successors, FD is 2684416 +via FE80::11FF:FE11:1111 (2684416/2172416), Serial0/0/0.1 +via FE80::22FF:FE22:2222 (2684416/2172416), Serial0/0/0.2 +P 2012::/64, 2 successors, FD is 2172416 +via FE80::11FF:FE11:1111 (2172416/28160), Serial0/0/0.1 +via FE80::22FF:FE22:2222 (2172416/28160), Serial0/0/0.2 +P 2013::/64, 1 successors, FD is 2169856 +via Connected, Serial0/0/0.1 + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 243 + +! lines omitted for brevity +P 2099::/64, 2 successors , FD is 2174976 +via FE80::11FF:FE11:1111 (2174976/30720), Serial0/0/0.1 +via FE80::22FF:FE22:2222 (2174976/30720), Serial0/0/0.2 + +! Finally, the link-local address of neighbor R1 is identified. +R3# show cdp entry R1 +————————————- +Device ID: R1 +Entry address(es): +IP address: 10.10.13.1 +IPv6 address: 2013::1 (global unicast) +IPv6 address: FE80::11FF:FE11:1111 (link-local) +Platform: Cisco 1841, Capabilities: Router Switch IGMP +Interface: Serial0/0/0.1, Port ID (outgoing port): Serial0/0/0.3 +! lines omitted for brevity + +The most notable fact listed in the example is that the output confirms that little differ-ence exists with the show commands for EIGRP for IPv4 versus IPv6. The main differ-ences relate to the show ip protocols/show ipv6 protocols commands and that EIGRP for IPv6 uses a link-local IP address for the next hop of each route. + +Named EIGRP + +Configuring EIGRP for a simple topology that needs few if any parameters changed from their default settings is a fairly simple task. However, consider a router that needs one EIGRP instance to support IPv4 networks and another EIGRP instance to support IPv6 networks. Also, imagine that you want to adjust the default timers, configure the variance option, summarize addresses, and specify a router ID. Suddenly, EIGRP configuration becomes much more challenging, and you are required to jump back and forth between different configuration modes (that is, interface configuration mode, EIGRP for IPv4 con-figuration mode, and EIGRP for IPv6 configuration mode). + +Fortunately, Named EIGRP consolidates all of these disparate commands under a single hierarchical structure, as depicted in Figure 6-2. By having all EIGRP-related commands in one place, not only is configuration simplified, but troubleshooting is also more efficient. + +This section describes Named EIGRP’s hierarchical structure. Also, to illustrate the differ-ence in the traditional and Named EIGRP configuration approaches, an example of each approach is provided, both of which accomplish the same objectives. + + + + + + + + + + + +From the Library of Alexey Evseenko +244 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide +EIGRP for IPv4 Router +Configuration Mode +EIGRP for IPv6 Router +Configuration Mode +Interface +Configuration Mode + + + + + + + + + + + + + + + + + + + + +EIGRP Virtual Instance + +Figure 6-2 Conceptual View of Named EIGRP + +The Named EIGRP Hierarchical Structure + +Although Named EIGRP is configured very differently from traditional EIGRP, the con-figurations are compatible, meaning that an EIGRP-speaking router configured with the traditional approach can form a neighborship with an EIGRP-speaking router configured with the Named approach. Named EIGRP’s hierarchical structure consists of three pri-mary configuration modes. Table 6-4 identifies and describes these modes. + +Table 6-4 Configuration Modes of Named EIGRP +Key +Topic Configuration Mode Description + + +Address-Family + + + + +Address-Family-Interface + + +Address-Family-Topology + +General EIGRP configuration commands are issued under this configuration mode. For example, router ID, network, and EIGRP stub router configurations are performed here. Multiple address families (for example, IPv4 and IPv6) can be configured under the same EIGRP virtual instance. +Commands entered under interface configuration mode with a traditional EIGRP configuration are entered here for Named +EIGRP configuration. For example, timer and passive interface configurations are performed here. +Commands that have a direct impact on a router’s EIGRP topology table are given in this configuration mode. For example, variance and redistribution are configured in this mode. + + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 245 + + +Note Named EIGRP also has Service-Family and Service-Family-Interface configura-tion modes, similar to the Address-Family and Address-Family-Interface configuration modes. The service family modes are used when EIGRP is advertising a service, using the Service Advertisement Framework (SAF) feature. For example, the Call Control Discovery (CCD) service uses SAF to advertise dial plan information (as opposed to IP route information) for unified communications networks. However, the ROUTE course only focuses on address families. + + +The following steps can be used to configure Named EIGRP: + + +Step 1. Key +Topic + +Step 2. + + +Step 3. + + + +Step 4. + + + + + + +Step 5. + + +Configure a Named EIGRP virtual instance using the router eigrp virtual-instance-name command in global configuration mode. It is under this single virtual instance that all address families are configured. + +Specify an address family along with an autonomous system number using the address-family {ipv4 | ipv6 } autonomous-system asn command. + +Configure general EIGRP settings under Address-Family configuration mode. Examples of commands issued in this configuration mode include metric, network, eigrp stub, and eigrp router-id. + +(Optional) Enter Address-Family-Interface configuration mode, with the com-mand af-interface {default | interface-id}. If you specify the default option, commands entered in this configuration mode apply to all interfaces (unless overridden by a command applied to a specific interface). Examples of com-mands issued in this configuration mode include authentication, bandwidth-percent, hello-interval, hold-time, passive-interface, and split-horizon. + +(Optional) Exit Address-Family-Interface configuration mode (if currently in that mode) with the exit command, and enter Address-Family-Topology con-figuration mode with the topology base command. Examples of commands issued in the Address-Family-Topology configuration mode include auto- +summary , maximum-paths , redistribute, and variance . + + +To better understand the structure of a Named EIGRP configuration, the next part of this section contrasts a couple of traditional EIGRP configurations with Named EIGRP configurations. + +Traditional EIGRP and Named EIGRP Configurations Compared + +If a network does not have any special EIGRP requirements (for example, load balancing or summarization), many network administrators configure EIGRP by simply starting an EIGRP routing process and instructing all interfaces to participate in EIGRP. For example, using the topology seen in Figure 6-3, Example 6-3 shows a basic EIGRP for IPv4 con-figuration using the traditional configuration approach. + + + + + + +From the Library of Alexey Evseenko +246 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +EIGRP for IPv4 AS 1 + + + + +SW1 Fa0/0 172.16.1.1/24 + +S1/0 10.1.1.1/30 +R1 S1/0 10.1.1.2/30 + + + +R2 Fa0/0 SW2 192.168.1.1/24 + + + + +Figure 6-3 EIGRP for IPv4 Sample Topology + +Example 6-3 Basic EIGRP Configuration Using the Traditional Configuration Approach + +!Router R1 Configuration +R1# conf term +R1(config)# router eigrp 1 +R1(config-router)# network 0.0.0.0 + +!Router R2 Configuration +R2# conf term +R2(config)# router eigrp 1 +R2(config-router)# network 0.0.0.0 + +The configuration in Example 6-3 is very straightforward. It enters router configuration mode with the router eigrp asn command and instructs all router interfaces to partici-pate in that EIGRP autonomous system with the command network 0.0.0.0. Example +6-4, still using the topology in Figure 6-3, accomplishes the same result using the Named EIGRP configuration approach. + +Example 6-4 Basic EIGRP Configuration Using the Named Configuration Approach + +!R1 Router Configuration +R1# conf term +R1(config)# router eigrp R1DEMO +R1(config-router)# address-family ipv4 autonomous-system 1 +R1(config-router-af)# network 0.0.0.0 + +!R2 Router Configuration +R2# conf term +R2(config)# router eigrp R2DEMO +R2(config-router)# address-family ipv4 autonomous-system 1 +R2(config-router-af)# network 0.0.0.0 + +Although still very straightforward, the configuration seen in Example 6-4 is just a bit longer than the configuration seen in Example 6-3. However, the benefit of the Named EIGRP configuration approach becomes more evident when EIGRP has more complex requirements. + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 247 + +For example, consider Example 6-5. It uses the traditional EIGRP configuration approach to meet the following requirements for both Routers R1 and R2 in Figure 6-4: + +■ All interfaces should participate in EIGRP for IPv4 AS 1. + +■ All interfaces should participate in EIGRP for IPv6 AS 2. + +■ The variance option should be set to 2 for both autonomous systems. + +■ The Hello Interval should be set to 2 seconds for EIGRP for IPv4 AS1. + +■ The Hold Time should be set to 10 seconds for EIGRP for IPv4 AS1. + + + + + + + +SW1 Fa0/0 172.16.1.1/24 2001::1/64 + +EIGRP for IPv4 AS 1 +S1/0 10.1.1.1/30 2002::1/64 +R1 S1/0 R2 10.1.1.2/30 +2002::2/64 + +EIGRP for IPv6 AS 2 + + + + + +Fa0/0 SW2 192.168.1.1/24 2003::1/64 + + +Figure 6-4 EIGRP for IPv4 and EIGRP for IPv6 Sample Topology + +Example 6-5 Advanced EIGRP Configuration Using the Traditional Configuration Approach + +!Router R1 Configuration +interface FastEthernet0/0 +ip address 172.16.1.1 255.255.255.0 +ipv6 address 2001::1/64 +ipv6 eigrp 2 +! +interface Serial1/0 +ip address 10.1.1.1 255.255.255.252 +ip hello-interval eigrp 1 2 +ip hold-time eigrp 1 10 +ipv6 address 2002::1/64 +ipv6 eigrp 2 +! +router eigrp 1 +variance 2 +network 0.0.0.0 +passive-interface default +no passive-interface Serial1/0 +! +ipv6 router eigrp 2 +variance 2 + + + + + +From the Library of Alexey Evseenko +248 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +!Router R2 Configuration +interface FastEthernet0/0 +ip address 192.168.1.1 255.255.255.0 +ipv6 address 2003::1/64 +ipv6 eigrp 2 +! +interface Serial1/0 +ip address 10.1.1.2 255.255.255.252 +ip hello-interval eigrp 1 2 +ip hold-time eigrp 1 10 +ipv6 address 2002::2/64 +ipv6 eigrp 2 +! + +router eigrp 1 +variance 2 +network 0.0.0.0 +passive-interface default +no passive-interface Serial1/0 +! +ipv6 router eigrp 2 +variance 2 + +Using the same topology, Example 6-6 meets the previously stated goals; however, Example 6-6 uses the Named EIGRP configuration approach. + +Example 6-6 Advanced EIGRP Configuration Using the Named Configuration Topic Approach +Key +!Router R1 Configuration +router eigrp R1DEMO +! +address-family ipv4 unicast autonomous-system 1 +! +af-interface default +hello-interval 2 +hold-time 10 +passive-interface +exit-af-interface +! +af-interface Serial1/0 +no passive-interface +exit-af-interface +! +topology base +variance 2 +exit-af-topology + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 249 + +network 0.0.0.0 +exit-address-family +! +address-family ipv6 unicast autonomous-system 2 +! +topology base +variance 2 +exit-af-topology +exit-address-family + +!Router R2 Configuration +interface FastEthernet0/0 +ip address 192.168.1.1 255.255.255.0 +ipv6 address 2003::1/64 +! +interface Serial1/0 +ip address 10.1.1.2 255.255.255.252 +ipv6 address 2002::2/64 +! +router eigrp R2DEMO +! +address-family ipv4 unicast autonomous-system 1 +! +af-interface default +hello-interval 2 +hold-time 10 +passive-interface +exit-af-interface +! +af-interface Serial1/0 +no passive-interface +exit-af-interface +! +topology base +variance 2 +exit-af-topology +network 0.0.0.0 +exit-address-family +! +address-family ipv6 unicast autonomous-system 2 +! +topology base +variance 2 +exit-af-topology +exit-address-family + + + + + +From the Library of Alexey Evseenko +250 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +In the Named EIGRP configuration, notice that each router has a single EIGRP virtual instance, and the EIGRP virtual instance on each router includes two address families, one for IPv4 and one for IPv6. Also notice that each of the configuration commands required to meet the objectives is logically organized under an appropriate configuration mode of the Named EIGRP hierarchy. + +Verifying Named EIGRP + +Even though Named EIGRP is configured differently than traditional EIGRP, the verifica-tion commands remain the same. To illustrate, consider Example 6-7, which shows the output (on Router R1) from a collection of common EIGRP troubleshooting commands. + +Example 6-7 Verifying a Named EIGRP Configuration + +R1# show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 VR(R1DEMO) Address-Family Protocol for AS(1) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 K6=0 +Metric rib-scale 128 +Metric version 64bit +NSF-aware route hold timer is 240 +Router-ID: 172.16.1.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 2 +Total Prefix Count: 3 +Total Redist Count: 0 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +0.0.0.0 +Passive Interface(s): +FastEthernet0/0 +Routing Information Sources: + +Gateway +10.1.1.2 + +Distance +90 + +Last Update +01:18:03 + + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 251 + +Distance: internal 90 external 170 + +R1# show ip eigrp interfaces +EIGRP-IPv4 VR(R1DEMO) Address-Family Interfaces for AS(1) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Se1/0 1 0/0 0/0 81 0/16 352 0 + +R1# show ip eigrp interfaces detail s1/0 +EIGRP-IPv4 VR(R1DEMO) Address-Family Interfaces for AS(1) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Se1/0 1 0/0 0/0 81 0/16 352 0 +Hello-interval is 2, Hold-time is 10 +Split-horizon is enabled +Next xmit serial +Packetized sent/expedited: 2/0 +Hello's sent/expedited: 2980/2 +Un/reliable mcasts: 0/0 Un/reliable ucasts: 3/3 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 +Retransmissions sent: 0 Out-of-sequence rcvd: 0 +Topology-ids on interface - 0 +Authentication mode is not set + +R1# show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "eigrp 2" +EIGRP-IPv6 VR(R1DEMO) Address-Family Protocol for AS(2) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 K6=0 +Metric rib-scale 128 +Metric version 64bit +NSF-aware route hold timer is 240 +Router-ID: 172.16.1.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 16 +Maximum hopcount 100 +Maximum metric variance 2 +Total Prefix Count: 3 +Total Redist Count: 0 + + + + + + + + +From the Library of Alexey Evseenko +252 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Interfaces: +FastEthernet0/0 +Serial1/0 +Redistribution: +None + +The verification commands demonstrated in Example 6-7 confirm that the previously stated design goals have all been satisfied by the Named EIGRP configuration presented in Example 6-6. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 253 + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 6-5 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 6-5 Design Review + + +Design Goal + +Support the routing of IPv6 routes on a network currently using EIGRP for IPv4. + +Possible Implementation Choices Covered in This Chapter + +A router currently has a complex EIGRP configuration, with multiple EIGRP-related commands under various interfaces, in addition to multiple EIGRP commands under router configuration mode. This configuration needs to be simplified so that it becomes easier to understand and troubleshoot. + + + +Implementation Plan Peer Review Table + +Table 6-6 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + + + + + + + +From the Library of Alexey Evseenko +254 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 6-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +Some documentation refers to EIGRP for IPv4 as EIGRPv4 and to EIGRP for IPv6 as EIGRPv6. Does this mean there is a “version 5” of EIGRP? +If the EIGRP configuration on corporate routers is migrated from a traditional EIGRP configuration to a Named EIGRP configuration, will network technicians and help desk staff need to learn a new set of verification and troubleshooting commands? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 6-7 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 6-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Enable IPv6 routing. + +Enable EIGRP for IPv6. + +Enable IPv6 on an interface, causing a router to derive a link-local address for the interface. +Configure an IPv6 address on an interface. + +Enable EIGRP for IPv6 on an interface. + +Configure a router ID for EIGRP for IPv6. + +Create a Named EIGRP virtual instance. + +Specify an address family along with an autonomous system number. +Enter Address-Family-Interface configuration mode. +Enter Address-Family-Topology configuration mode for the base topology. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 6: EIGRP for IPv6 and Named EIGRP 255 + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table +6-8 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 6-8 Verification Plan Memory Drill + +Information Needed Command(s) +Show all EIGRP-learned IPv4 routes. + +Show all EIGRP-learned IPv6 routes. + +Show the variance configured for an EIGRP for IPv4 autonomous system. +Show the variance configured for an EIGRP for IPv6 autonomous system. +Show the Hello Interval for an EIGRP for IPv4 autonomous system. +Show the Hello Interval for an EIGRP for IPv6 autonomous system. +Display the EIGRP topology table for an EIGRP for IPv4 autonomous system. +Display the EIGRP topology table for an EIGRP for IPv6 autonomous system. +Display sent and received updates for an EIGRP for IPv4 autonomous system. +Display sent and received updates for an EIGRP for IPv6 autonomous system. + + +Note Some of the entries in this table may not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 6-9 lists a reference of these key topics and the page numbers on which each is found. + + + + + + + + +From the Library of Alexey Evseenko +256 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 6-9 Key Topics for Chapter 6 Key +Topic Key Topic Element Description Page Number + + +Table 6-2 + +List + +Example 6-1 + +Table 6-3 + +Table 6-4 + +List + +Example 6-6 + +Comparing EIGRP for IPv4 and IPv6 237 + +EIGRP for IPv6 configuration steps 237 + +Configuring EIGRP for IPv6 Routing on R1 239 + +Comparing EIGRP Verification Commands: show 240 ip… and show ipv6... +Configuration Modes of Named EIGRP 244 + +Named EIGRP configuration steps 245 + +Advanced EIGRP Configuration Using the Named 248 Configuration Approach + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +EIGRP for IPv6, Named EIGRP + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ OSPF Review: This section reviews the OSPF concepts, configuration, and verification commands assumed as prerequisites, specifically those details included in the CCNA Exam’s coverage of OSPF. +■ OSPF Neighbors and Adjacencies on LANs: This section discusses a variety of features that impact when a router attempts to form OSPF neighbor relationships (neighborships), what must be true for those neighborships to work, and what might pre-vent those neighborships. +■ OSPF Neighbors and Adjacencies on WANs: This short section examines the typical usage of OSPF neighborships over various types of WAN technologies. +■ Virtual Links: This section examines how engineers can use virtual links to connect separate parts of an area through another area to maintain the require-ment that OSPF areas be contiguous. + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 7 + + + + + + +Fundamental OSPF Concepts + + +Open Shortest Path First (OSPF) requires only a few relatively simple commands when using it in a small- to medium-sized internetwork. However, behind those commands resides a fairly complex routing protocol, with internals that can intimidate those new to OSPF. When compared to the less-complex Enhanced Interior Gateway Routing Protocol (EIGRP), OSPF requires more thought when planning and a few more configuration com-mands. Additionally, the underlying complexity of OSPF makes operating and verifying an OSPF internetwork more challenging. + +This chapter begins with a review of OSPF concepts covered in your CCNA studies. Next, the chapter turns its attention to the formation of OSPF neighborships and adja-cencies, followed by the establishment of OSPF neighbors and adjacencies over various WAN technologies. Finally, this chapter examines how a virtual link can be used to make discontiguous areas appear to be contiguous, or how an area not adjacent to an OSPF backbone area can appear to be adjacent. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these nine self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 7-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of those spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 7-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +OSPF Review + +OSPF Neighbors and Adjacencies on LANs + +OSPF Neighbors and Adjacencies on WANs + +Virtual Links + +Question +1–3 + +4–6 + +7 + +8, 9 + + + + + + + + + +From the Library of Alexey Evseenko +260 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. A router has been configured with the commands router ospf 9, network 172.16.1.0 0.0.0.255 area 8 and network 172.16.0.0 0.0.255.255 area 9, in that order. No other OSPF-related commands have been configured. The answers list the IP addresses that could be assigned to this router’s Fa0/0 interface. Which answers list an IP address/prefix length that would cause the router to put Fa0/0 into area 9? (Choose two.) +a. 172.16.0.1/23 + +b. 172.16.1.1/26 + +c. 172.16.1.1/24 + +d. 172.16.0.255/23 + +e. None of the other answers is correct. + +2. Which of the following is true about an OSPF area border router (ABR)? + +a. The ABR must have multiple interfaces connected to the backbone area. + +b. An ABR is a router with two interfaces, each connected to a different nonback-bone area. + +c. The only requirement to be considered an ABR is at least one interface con-nected to the backbone area. + +d. An ABR must have at least one interface in the backbone area plus at least one other interface in a nonbackbone area. + +3. Which of the following can either directly or indirectly identify all the interfaces for which 1) OSPF has been enabled and 2) OSPF is not passive? (Choose two.) + +a. show ip ospf database + +b. show ip ospf interface brief + +c. show ip protocols + +d. show ip route ospf + +e. show ip ospf neighbors + +4. Router R1 directly connects to subnet 10.1.1.0/24 with its Fa0/0 interface. R1 can ping four other working OSPF routers in that subnet. R1 is neither the designated router (DR) nor backup DR (BDR). OSPF is working correctly on all five routers. Which of the following are true on R1? (Choose two.) +a. The show ip ospf neighbors command lists two neighbors off Fa0/0. + +b. The show ip ospf neighbors command lists four neighbors off Fa0/0. + +c. The show ip ospf neighbors command lists two neighbors off Fa0/0 in the FULL state. + +d. The show ip ospf neighbors command lists two neighbors off Fa0/0 in the DISCO state. + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 261 + +5. Routers R1 and R2 are OSPF neighbors using their Fa0/0 interfaces, respectively, using default settings for all timers. An engineer adds the ip ospf hello-interval 6 command to R1’s Fa0/0 configuration. Which of the following are true regarding the results from this change? (Choose two.) +a. The show ip ospf neighbor command on R1 lists the revised Hello timer. + +b. The show ip ospf interface brief command on R1 lists the revised Hello timer. + +c. The R1-R2 neighborship fails because of Hello timer mismatch. + +d. The show ip ospf interface command on R1 lists the revised Hello timer. + +6. Which of the following settings do not prevent two potential OSPF neighbors from becoming neighbors? + +a. The interface used to connect to that neighbor being passive in the OSPF process + +b. Duplicate OSPF router IDs + +c. Mismatched Dead timers + +d. IP addresses of 10.1.1.1/24 and 10.2.2.2/24 + +e. Mismatched OSPF process IDs + +7. A company has a Frame Relay WAN with one central-site router and 100 branch office routers. A partial mesh of PVCs exists: one PVC between the central site and each of the 100 branch routers. All routers use point-to-point subinterfaces and one subnet per PVC. Which of the following is true about OSPF in this design? +a. The central-site router has 100 fully adjacent neighborships with the 100 branches. + +b. The central-site router has neighborships with all branch routers, but fully adja-cent neighborships with only two branches. + +c. The central-site router has a neighborship with the Frame Relay switch. + +d. None of the other answers is correct. + +8. Which of the following answers can be verified as true based on the following com-mand output from Router R1? + +R1# show ip ospf virtual-links +Virtual Link OSPF_VL0 to router 4.4.4.4 is up +Run as demand circuit +DoNotAge LSA allowed. +Transit area 1, via interface FastEthernet0/1, Cost of using 3? + +a. R1 is configured with an area 0 virtual-link 4.4.4.4 cost 3 command. + +b. The ping 4.4.4.4 command on R1 must currently be successful. + +c. R1’s Fa0/1 OSPF cost is 3. + +d. 4.4.4.4 is known to R1 based on a Type 1 LSA in area 1. + + + +From the Library of Alexey Evseenko +262 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +9. Several links have been broken so that for the next day or two, what was formerly a contiguous area 0 has been broken into two parts. However, both parts of area 0 have working links into area 1 using routers with RID 1.1.1.1 and 2.2.2.2. Which answer lists the command on the router with RID 1.1.1.1 to create a virtual link to help solve this temporary problem? +a. area 0 virtual-link 2.2.2.2 + +b. area 1 virtual-link 2.2.2.2 + +c. area 0 source-rid 1.1.1.1 dest-rid 2.2.2.2 + +d. virtual-link transit-area 1 RID 2.2.2.2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 263 + +Foundation Topics + + +OSPF Review + +All the CCNP exams consider CCNA materials as prerequisite. Similarly, this book also assumes that the reader is already familiar with CCNA topics. However, the CCNP exams do include features that overlap with CCNA. Additionally, most people forget some details about CCNA topics along the way. This section is intended as a quick reminder of the basics from your earlier CCNA studies related to OSPF, with the addition of a few related details you might not have seen during your CCNA study. + +Note that this section does not cover every detail of CCNA-level OSPF topics—the main goal is a quick refamiliarization. To that end, this section begins with a review of OSPF terminology and link-state theory, followed by a configuration and verification sample. + +OSPF Link-State Concepts + +OSPF uses link-state (LS) logic, which can be broken into three major branches. The first step, neighbor discovery, has the same overall goal as EIGRP’s neighbor discovery pro-cess: to find the neighboring routers and exchange enough information so that the two routers know whether they should exchange topology data. (Like EIGRP, OSPF keeps a list of neighbors in its neighbor table.) + +The second step, topology database exchange, requires each OSPF router to cooperate by sending messages so that all routers learn topology information—information that is the equivalent of the kinds of information a human would draw and write in a diagram of the internetwork. Each router stores this topology information in its topology database, sometimes called its link-state database (LSDB). The information communicated by OSPF routers and held in their LSDBs includes + +■ The existence of, and an identifier for, each router (router ID) + +■ Each router interface, IP address, mask, and subnet + +■ The list of routers reachable by each router on each interface + +During the third major step, route computation, each router independently analyzes the topology data to choose the best routes from its perspective. In particular, LS algorithms such as OSPF use a Shortest Path First (SPF) algorithm to analyze the data, choose the shortest (best) route for each reachable subnet, and add the correct next-hop/outgoing interface information for those routes to the IP routing table. + +OSPF requires more planning than does EIGRP, particularly with regard to the neces-sity for a hierarchical design using OSPF areas. Each router interface exists in a single area, with some special routers, called area border routers (ABR), being the boundary between areas. Inside an area, routers exchange detailed topology information. However, the detailed topology information does not flow between areas. Instead, the ABRs + + + + +From the Library of Alexey Evseenko +264 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +advertise briefer information between areas, including information about subnets/masks, but the information advertised into one area does not include details about the topology of the other area. For perspective on the OSPF design issues, consider Figure 7-1, which shows a typical hierarchical design. + +Area 0 (Backbone) + +Subnet 4 + + + + + + + + +Area 1 ABR1 Area 2 ABR2 Area 3 + + + +Subnet 3 + + + +Subnet 1 +Subnet 2 + + + +Figure 7-1 Typical Hierarchical OSPF Design + +One area, called the backbone area, must connect to all other areas. Packets that need to pass between two nonbackbone areas must pass through (at least) one backbone router. The ABRs must keep a copy of the LSDB for each area to which they attach. For exam-ple, ABR1 has LSDBs for area 0, area 1, and area 2. However, the ABRs do not forward all the topology details between areas. Instead, they simply advertise the subnets (prefix/ length) between the areas. + +Because of the sparse information advertised into one area about another area, topologi-cally, routers inside one area know only about the subnets in another area. They do not know about the details of the topology in the other area; instead, from a topology per-spective, it appears as if the subnets from another area connect to the ABR. Figure 7-2 shows the concept with the two routers in area 3 from Figure 7-1. + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 265 + +Subnet 1 Subnet 2 Subnet 4 + + + +ABR2 + + + + + + + + +Subnet 3 + +Figure 7-2 Area 3 LSDB Concept + +Figure 7-2 essentially shows the contents of area 3’s LSDB in graphical form. Two rout-ers exist, with a link between them, and one LAN subnet (Subnet 3) internal to the area. However, the other three sample subnets shown in Figure 7-1 (Subnets 1, 2, and 4) appear connected to ABR2. (Other subnets exist outside area 3 as well; the figure just shows a few as examples.) The routers inside area 3 can calculate and add routes to their routing tables, but without needing all the topology information shown in Figure 7-1. By using an area design similar to the one illustrated in Figure 7-1, network engineers can group rout- +ers and interfaces into areas, which results in smaller topology databases on those routers, as shown in Figure 7-2. As a result, each router reduces the processing time, memory con-sumption, and effort to calculate the best routes. + +OSPF uses a fairly large number of terms. Table 7-2 lists some of the more common OSPF terms as an early reference as you read through the chapter. + + +Table 7-2 +Key +Topic Term + + +Commonly Used OSPF Terms + +Definition + + + +Link-state database (LSDB) + +Shortest Path First (SPF) + + +Link-State Update (LSU) + +Link-State Advertisement (LSA) + +The data structure held by an OSPF router for the purpose of storing topology data +The name of the algorithm OSPF uses to analyze the LSDB (Note: The analysis determines the best [lowest-cost] route for each prefix/length.) +The name of the OSPF packet that holds the detailed topology information, specifically LSAs +The name of a class of OSPF data structures that hold topology information (Note: LSAs are held in memory in an LSDB and communicate over a network in LSU messages.) + + + + + + + +From the Library of Alexey Evseenko +266 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Term Area + + + +Area border router (ABR) + + + +Backbone router + +Internal routers + +Designated router (DR) + + + + +Backup designated router (BDR) + +Definition +A contiguous grouping of routers and router interfaces (Note: Routers in an area strive to learn all topology information about the area, but they do not learn topology information about all other areas.) +A router that has interfaces connected to at least two different OSPF areas, including the backbone area (Note: ABRs hold topology data for each area, calculate routes for each area, and advertise those routes between areas.) +Any router that has at least one interface connected to the backbone area +A router that has interfaces connected to only one area, making the router completely internal to that one area +On multiaccess data links like LANs, an OSPF router elected by the routers on that data link to perform special functions (Note: These functions include generating LSAs representing the subnet and playing a key role in the database exchange process.) +A router on a multiaccess data link that monitors the DR and becomes prepared to take over for the DR, should the DR fail + + + + +OSPF Configuration Review + +Other than the configuration of the OSPF areas, a basic configuration of OSPF basics looks similar to a simple EIGRP configuration. Cisco IOS uses the router ospf process-id command, plus one or more network net-id wildcard-mask area area-id subcom-mands, to enable OSPF on the router and on router interfaces. The rules for these com-mands are as follows: + +Step 1. +Key Topic +Step 2. + + +Neighboring routers’ router ospf process-id commands do not have to be configured with the same process-id parameter to become neighbors. + +Cisco IOS only enables OSPF on interfaces matched by an OSPF network +command. When enabled, the router does the following: + + +a. Attempts to discover OSPF neighbors on that interface by sending multi-cast OSPF Hello messages + +b. Includes the connected subnet in future topology database exchanges + +Step 3. To match an interface with the network command, Cisco IOS compares the net-id configured in the network command with each interface’s IP address, while using the configured wildcard mask as an ACL wildcard mask. + + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 267 + +Step 4. Regardless of the order in which the network commands are added to the configuration, Cisco IOS puts these commands into the configuration file with the most specific (most binary 0s) wildcard mask first, for overlapping network ranges. Cisco IOS lists the network commands in this sorted order in the configuration. +Step 5. The first network command that matches an interface, per the order shown in the output of the show running-config command, determines the OSPF area number associated with the interface. + +Example 7-1 shows a sample configuration for each router in Figure 7-3. + +Area 1 Area 0 + +RID 1.1.1.1 RID 2.2.2.2 RID 3.3.3.3 + + +S0/0/0 R1 12.1/30 +Fa0/0 +1.1/24 + + +S0/0/1 12.2/30 + +S0/0/0 R2 23.2/30 +Fa0/0 2.2/25 + + +S0/0/1 23.1/30 + + +Fa0/1 +R3 192.168.3.3/26 Fa0/0 +3.3/26 + + + + +Note: All IP addresses begin with 10.1 unless otherwise noted. + +Figure 7-3 Three-Router Internetwork with Two OSPF Areas + +Example 7-1 OSPF Configuration on Routers R1, R2, and R3 + +! On Router R1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +interface loopback 1 +ip address 1.1.1.1 255.255.255.255 +router ospf 1 +network 10.0.0.0 0.255.255.255 area 1 + +! On Router R2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +interface loopback 1 +ip address 2.2.2.2 255.255.255.255 + +router ospf 2 +network 10.1.12.2 0.0.0.0 area 1 +network 10.1.0.0 0.0.255.255 area 0 + +! On Router R3: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +interface loopback 1 +ip address 3.3.3.3 255.255.255.255 + +router ospf 3 + + + + +From the Library of Alexey Evseenko +268 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +network 10.1.0.0 0.0.255.255 area 0 +network 192.168.3.3 0.0.0.0 area 0 + +First, note that all three routers use a different process ID on their respective router ospf process-id commands. These mismatches do not prevent neighborships from forming. + +Next, consider the requirement that R1’s S0/0/0 and R2’s S0/0/1 must be in the same area. Typically, all routers on the same subnet need to be in the same area; the rout-ers themselves are the boundary between areas. In this case, R1’s network 10.0.0.0 +0.255.255.255 area 1 command matches all interfaces whose addresses begin with 10 in the first octet and assigns those interfaces (Fa0/0 and S0/0/0) to area 1. Similarly, R2’s network 10.1.12.2 0.0.0.0 area 1 command matches only one IP address—R2’s S0/0/1 IP address—and places it in area 1. Looking further at R2’s OSPF configuration, note that both network commands actually match the 10.1.12.2 S0/0/1 IP address: one with area 0 and one with area 1. However, R2 orders these two network commands with the most-specific wildcard mask first, placing the command with wildcard mask 0.0.0.0 first and +the one with wildcard mask 0.0.255.255 second. Then, R2 compares the commands to the interface IP addresses in order, so R2 places S0/0/1 into area 1. (Note that in real inter-networks, choosing wildcard masks such that it is clear which network command should match each interface is the better choice.) + +On R3, the network 10.1.0.0 0.0.255.255 area 0 command matches interfaces Fa0/0 and S0/0/0, adding them to area 0. R3 then needs an additional network command to enable OSPF on R3’s Fa0/1 interface with all three interfaces in area 0. + +Finally, note that the addition of the loopback interfaces causes each router to choose an obvious OSPF router ID (RID). OSPF uses the same logic as does EIGRP to choose a router ID on each router, at the time the OSPF process is initialized, as follows, in the listed order of precedence: + +Step 1. Key +Topic Step 2. + +Step 3. + + +Use the router ID defined in the router-id x.x.x.x OSPF router subcommand. + +Use the highest IP address of any up loopback interface. + +Use the highest IP address of any up nonloopback interface. + + +Note that for the second and third choices, the interface does not need to have OSPF enabled. + +OSPF Verification Review + +The verification process, whether it uses a formal verification plan or not, requires some knowledge of the intended design and function of the network. The design and imple-mentation documents dictate what the network should do, and the verification plan should confirm whether the network is meeting those goals. + +For the purposes of this OSPF review section, assume that the only design goal for the internetwork in Figure 7-3 is that OSPF be used so that all routers have routes to reach all subnets shown in the figure, within the constraints of the area design. + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 269 + +To verify such a simple design, an engineer should start by confirming on which interfac-es OSPF has been enabled on each router. The next step should be to determine whether the OSPF neighbor relationships that should occur are indeed up and working. Then, the OSPF topology table should be examined to confirm that non-ABRs have only topol-ogy information for their respective areas. Finally, the IP routes on each router should be examined, confirming that all routes are known. To that end, Table 7-3 summarizes five key show commands that provide the information to answer these questions: + +Table 7-3 Commonly Used OSPF show Commands Key +Topic Command Key Information + + +show ip ospf interface brief + +show ip protocols + + +show ip ospf neighbors + + +show ip ospf database + +show ip route + +Lists the interfaces on which OSPF is enabled (based on the network commands), omitting passive interfaces +Lists the contents of the network configuration commands for each routing process and a list of enabled but passive interfaces +Lists known neighbors, including neighbor state; does not list neighbors for which some mismatched parameter is preventing a valid OSPF neighbor relationship +Lists all LSAs for all connected areas + +Lists the contents of the IP routing table, listing OSPF-learned routes with a code of O on the left side of the output + + + +Example 7-2 shows samples of each command listed in Table 7-3. Note that the output highlights various samples of items that should be verified, including the interfaces on which OSPF is enabled, the known neighbors, the neighbors’ states, the LSAs in the topology table, and the OSPF routes. + +Example 7-2 OSPF Verification on Routers R1, R2, and R3 + +! On Router R2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! Note that S0/0/1 is shown as in area 1, while the other 2 interfaces are all in +! Area 0. + +R2# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Se0/0/0 2 0 +Fa0/0 2 0 +Se0/0/1 2 1 + +10.1.23.2/30 +10.1.2.2/25 +10.1.12.2/30 + +64 P2P 1/1 +1 DR 0/0 +64 P2P 1/1 + + +! Next, note that R2 lists two "Routing Information Sources", 1.1.1.1 (R1) and +! 3.3.3.3 (R3). +! These routers, listed by RID, should mirror those listed in the output of the show +! ip ospf neighbors command that follows. + + + + + +From the Library of Alexey Evseenko +270 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +R2# show ip protocols +Routing Protocol is "ospf 2" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 2.2.2.2 +It is an area border router +Number of areas in this router is 2. 2 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.12.2 0.0.0.0 area 1 +10.1.0.0 0.0.255.255 area 0 +Reference bandwidth unit is 100 mbps +Routing Information Sources: + +Gateway +3.3.3.3 +1.1.1.1 + +Distance +110 +110 + +Last Update +00:01:08 +00:01:08 + +Distance: (default is 110) + +! Note that the Full state means that the database exchange process is fully +! completed +! between these two neighbors. +R2# show ip ospf neighbors + + +Neighbor ID +3.3.3.3 +1.1.1.1 + +Pri State +0 FULL/ - +0 FULL/ - + +Dead Time +00:00:34 +00:00:34 + +Address +10.1.23.1 +10.1.12.1 + +Interface +Serial0/0/0 +Serial0/0/1 + + +! On Router R1: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! Note that R1's LSDB includes a "Router Link State" for RID 1.1.1.1 (R1) ,2.2.2.2 +! (R2), but not 3.3.3.3 (R3), because R3 is not attached to area 1. + +R1# show ip ospf database + +OSPF Router with ID (1.1.1.1) (Process ID 1) + +Router Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum Link count + +1.1.1.1 +2.2.2.2 + +1.1.1.1 210 +2.2.2.2 195 + +0x80000004 0x001533 3 +0x80000002 0x0085DB 2 + + +Summary Net Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.2.0 2.2.2.2 190 0x80000001 0x00B5F0 + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 271 + + +10.1.3.0 +10.1.23.0 +192.168.3.0 + +2.2.2.2 190 +2.2.2.2 190 +2.2.2.2 191 + +0x80000001 0x00AE76 +0x80000001 0x0031A4 +0x80000001 0x008B3B + + +! Below, note that R1 has routes for all remote subnets, including R3's +! LAN subnets, even though R1 does not list R3 in its LSDB. + +R1# show ip route ospf +10.0.0.0/8 is variably subnetted, 5 subnets, 4 masks +O IA 10.1.3.0/26 [110/129] via 10.1.12.2, 00:04:13, Serial0/0/0 +O IA 10.1.2.0/25 [110/65] via 10.1.12.2, 00:04:13, Serial0/0/0 +O IA 10.1.23.0/30 [110/128] via 10.1.12.2, 00:04:13, Serial0/0/0 +192.168.3.0/26 is subnetted, 1 subnets +O IA 192.168.3.0 [110/129] via 10.1.12.2, 00:04:13, Serial0/0/0 + + +OSPF Feature Summary + +Table 7-4 summarizes some key OSPF facts. The table includes some review items from CCNA-level OSPF topics, plus some topics that will be developed in this and upcoming chapters. The items that are not CCNA topics are included just for convenience when reviewing for final preparation before taking the exam. + + +Table 7-4 +Key +Topic Feature + +Transport + +Metric + + +OSPF Feature Summary + +Description +IP, protocol type 89 (does not use UDP or TCP). + +Based on cumulative cost of all outgoing interfaces in a route. The interface cost defaults to a function of interface bandwidth but can be set explicitly. + + + +Hello interval + +Dead interval + + +Update destination address + +Full or partial updates + +Authentication + +VLSM/classless + +Interval at which a router sends OSPF Hello messages out of an interface. +Timer used to determine when a neighboring router has failed, based on a router not receiving any OSPF messages, including Hellos, in this timer period. +Normally sent to 224.0.0.5 (All SPF Routers) and 224.0.0.6 (All Designated Routers). +Full updates used when new neighbors are discovered; partial updates used otherwise. +Supports MD5 and clear-text authentication. + +Includes the mask with each route, also allowing OSPF to support discontiguous networks and VLSM. + + + + + + + +From the Library of Alexey Evseenko +272 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Feature Route tags + +Next-hop field + +Manual route summarization + +Description +Allows OSPF to tag routes as they are redistributed into OSPF. +Supports the advertisement of routes with a different next-hop router than the advertising router. +Allows route summarization at ABR routers only. + + + +This concludes the review of OSPF topics. The rest of this chapter focuses on OSPF top-ics related to the formation of OSPF neighbor relationships. + +OSPF Neighbors and Adjacencies on LANs + +With EIGRP, neighborship is relatively simple, if two EIGRP routers discover each other (using Hellos) and meet several requirements (like being in the same subnet). After becom-ing neighbors, the two EIGRP routers exchange topology information. + +Comparing OSPF and EIGRP, OSPF neighborship is more complex. First, with EIGRP, two routers either become neighbors or they do not. With OSPF, even after all the neigh-bor parameter checks pass, two classes of neighborships exist: neighbors and fully adja-cent neighbors. The OSPF neighbor discovery process has many pitfalls when the inter-network uses Frame Relay, with a class of issues that simply do not exist with EIGRP. Finally, OSPF uses an underlying Finite State Machine (FSM) with eight neighbor states used to describe the current state of each OSPF neighbor, adding another layer of com-plexity compared to EIGRP. + +This section breaks down the OSPF neighbor relationship, the logic, and the OSPF con-figuration settings—anything that impacts OSPF neighborship on LAN interfaces. This section examines the following questions: + +■ On what interfaces will this router attempt to discover neighbors by sending multi-cast OSPF Hello messages? + +■ Does a potential neighbor meet all requirements to become a neighbor? + +This section examines these topics, in sequence. + + +Enabling OSPF Neighbor Discovery on LANs + +OSPF sends multicast OSPF Hello messages on LAN interfaces, attempting to discover OSPF neighbors, when two requirements are met: + + +Key ■ Topic + +■ + +OSPF has been enabled on the interface, either through the network router subcom-mand or the ip ospf area interface subcommand. + +The interface has not been made passive by the passive-interface router +subcommand. + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 273 + +When both requirements are met, OSPF sends Hellos to the 224.0.0.5 multicast address, an address reserved for all OSPF-speaking routers. The Hello itself contains several parameters that must be checked, including the OSPF RID of the router sending the Hello and the OSPF area that router has assigned to that LAN subnet. + +Of the three configuration commands that might impact whether a router attempts to discover potential neighbors on an interface, one is commonly understood (network) and was already covered in this chapter’s “OSPF Configuration Review” section. The second configuration command that impacts whether potential neighbors discover each other, passive-interface, works just like it does with EIGRP. In short, when a router configures an interface as passive to OSPF, OSPF quits sending OSPF Hellos, so the router will not discover neighbors. The router will still advertise the interface’s connected subnet if OSPF is enabled on the interface, but all other OSPF processing on the interface is stopped. + +The third configuration command that impacts whether a router discovers potential neighbors using Hellos is the ip ospf process-id area area-id interface subcommand. This command acts as a replacement for the OSPF network command. Simply put, this command enables OSPF directly on the interface and assigns the area number. + +To demonstrate the ip ospf area and passive-interface commands, Example 7-3 shows a revised configuration on Router R3, as seen originally in Example 7-1. In this new exam-ple configuration, R3 has made two interfaces passive, because no other OSPF routers exist on its LAN subnets. Additionally, R3 has migrated its configuration away from the older network commands, instead using the ip ospf area interface subcommand. + +Example 7-3 Configuring passive-interface and ip ospf area + +interface loopback 1 +Ip address 3.3.3.3 255.255.255.255 + +router ospf 3 +passive-interface FastEthernet0/0 +passive-interface FastEthernet0/1 + +interface FastEthernet0/0 +ip ospf 3 area 0 +interface FastEthernet0/1 +ip ospf 3 area 0 +interface Serial0/0/1 +ip ospf 3 area 0 + +R3# show ip protocols +Routing Protocol is "ospf 3" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 3.3.3.3 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 + + + + +From the Library of Alexey Evseenko +274 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Routing for Networks: +Routing on Interfaces Configured Explicitly (Area 0): +Serial0/0/1 +FastEthernet0/1 +FastEthernet0/0 +Reference bandwidth unit is 100 mbps +Passive Interface(s): +FastEthernet0/0 +FastEthernet0/1 +Routing Information Sources: +Gateway Distance Last Update +Distance: (default is 110) + +Note that in the second half of Example 7-3, the show ip protocols command now lists the interfaces as matched with the ip ospf area commands, and it lists the passive inter-faces. You can take the list of explicitly configured interfaces, remove the passive inter-faces, and know which interfaces on which R3 will attempt to discover OSPF neighbors. Also, take a moment to compare this output with the same command’s output in Example 7-2, with the earlier example listing the parameters of the configured network commands. + +Settings That Must Match for OSPF Neighborship + +After an OSPF router has discovered a potential neighbor by receiving a Hello from the other router, the local router considers the router that sent the Hello as a potential neigh-bor. The local router must examine the contents of the received Hello, plus a few other factors, compare those settings to its own, and check for agreement, and only then can that other router be considered an OSPF neighbor. + +For reference, the following list details the items seen in OSPF Hello messages. Note that some fields might not be present in a Hello, depending on the conditions in the network. + +■ OSPF router ID + +■ Stub area flag + +■ Hello interval + +■ Dead interval + +■ Subnet mask + +■ List of neighbors reachable on the interface + +■ Area ID + +■ Router priority + +■ Designated router (DR) IP address + +■ Backup DR (BDR) IP address + +■ Authentication digest + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 275 + +Table 7-5 summarizes the items that two routers will compare when deciding whether they can become OSPF neighbors. For study purposes, the table also lists some items that one might think prevent OSPF neighborship but do not, with comparisons to EIGRP. + + +Table 7-5 Neighbor Requirements for EIGRP and OSPF +Key +Topic Requirement + +Interfaces’ primary IP addresses must be in same subnet. + +Must not be passive on the connected interface. + +Must be in same area. + +Hello interval/timer, plus either the Hold (EIGRP) or Dead (OSPF) timer, must match. +Router IDs must be unique. + +IP MTU must match. + +Must pass neighbor authentication (if configured). + +K-values (used in metric calculation) must match. + +Must use the same ASN (EIGRP) or process ID (OSPF) on the router configuration command. + + + +OSPF EIGRP +Yes Yes + +Yes Yes + +Yes N/A + +Yes No + +Yes No + +Yes No +1 + +Yes Yes + +N/A Yes + +No Yes + + +1 Might allow the other router to be listed in the output of the show ip ospf neighbor command, but the MTU mismatch will prevent proper operation of the topology exchange. + +The first few items in Table 7-5 require only a minor amount of discussion. First, OSPF checks the IP address (found as the source address of the Hello message) and mask (listed in the Hello message) of the potential neighbor, calculates the subnet address, and compares the subnet address and mask to its own interface IP address. Both the +subnet address and mask must match. Additionally, the OSPF Hello messages include the area number of the subnet, as defined by that router. The receiving router compares the received Hello with its own configuration and rejects the potential neighbor if the area numbers do not match. + +The next several sections examine other settings that can prevent OSPF neighborship. + + +Optimizing Convergence Using Hello and Dead Timers + +Using the same concept as EIGRP, but with different terminology, OSPF uses two tim-ers to monitor the reachability of neighbors. With OSPF, the Hello interval defines how often the router sends a Hello on the interface. The Dead interval defines how long a router should wait, without hearing any Hello messages from a neighbor, before decid-ing that the neighbor failed. For example, with a default LAN interface Hello timer of 10 seconds, and a Dead interval of 40 seconds, the local router sends Hello messages every 10 seconds. The neighbor resets its downward-counting Hold timer to 40 upon receiv-ing a Hello from that neighbor. Under normal operation on a LAN, with defaults, the Dead timer for a neighbor would vary from 40 down to 30, and then be reset to 40 upon + + + + +From the Library of Alexey Evseenko +276 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +receipt of the next Hello. However, if Hello messages were not received for 40 seconds, the neighborship would fail, driving convergence. + +To tune for faster convergence, you can configure OSPF to set a lower Hello and Dead timer. It speeds convergence in some cases. Note that if the interface fails, OSPF will immediately realize that all neighbors reached through that interface have also failed and will not wait on the Dead timer to count down to 0. For example, consider the internet-work in Figure 7-4. This internetwork has four routers connected to the same VLAN, with interfaces, IP addresses, masks, and OSPF areas as shown. + +Area 0 + + + + +10.1.1.1/24 Fa0/1 + +R1 10.5.5.1/28 Fa0/0 + + + +10.5.5.3/28 Fa0/0 + +R3 10.3.3.3/26 Fa0/1 + + + +Area 3 + +10.2.2.2/25 Fa0/1 + +R2 10.5.5.2/28 Fa0/0 + + + +10.5.5.4/28 Fa0/0 + +R4 10.4.4.4/27 Fa0/1 + + + +Area 4 + + +Figure 7-4 Four OSPF Routers on the Same Subnet, with Two OSPF Areas + +Example 7-4 verifies some of the facts about the routers in Figure 7-4, showing the changes to the Hello interval and the resulting failed neighborships. Each router has been assigned an obvious RID: 1.1.1.1 for R1, 2.2.2.2 for R2, and so on. + +Example 7-4 Effect of Configuring a Different OSPF Hello Interval + +R4# show ip ospf neighbors + +Neighbor ID +1.1.1.1 +2.2.2.2 +3.3.3.3 +R4# conf t + +Pri State +1 2WAY /DROTHER +1 FULL /BDR +1 FULL /DR + +Dead Time +00:00:35 +00:00:39 +00:00:38 + +Address +10.5.5.1 +10.5.5.2 +10.5.5.3 + +Interface +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + +Enter configuration commands, one per line. End with CNTL/Z. +R4(config)# interface fastethernet0/0 +R4(config-if)# ip ospf hello-interval 9 +R4(config-if)# ^Z + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 277 + +*Apr 28 00:06:20.271: %SYS-5-CONFIG_I: Configured from console by console +R4# show ip ospf interface fa0/0 +FastEthernet0/0 is up, line protocol is up +Internet Address 10.5.5.4/28, Area 0 +Process ID 4, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 1 +Enabled by interface config, including secondary ip addresses +Transmit Delay is 1 sec, State DROTHER, Priority 1 +Designated Router (ID) 3.3.3.3, Interface address 10.5.5.3 +Backup Designated router (ID) 2.2.2.2, Interface address 10.5.5.2 +Timer intervals configured, Hello 9, Dead 36, Wait 36, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:01 +Supports Link-local Signaling (LLS) +Index 1/1, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 0, maximum is 3 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 3, Adjacent neighbor count is 2 + +Adjacent with neighbor 2.2.2.2 +Adjacent with neighbor 3.3.3.3 +Suppress hello for 0 neighbor(s) +R4# + +(Backup Designated Router) +(Designated Router) + +*Apr 28 00:06:51.559: %OSPF-5-ADJCHG: Process 4, Nbr 1.1.1.1 on FastEthernet0/0 +from 2WAY to DOWN, Neighbor Down: Dead timer expired +*Apr 28 00:06:57.183: %OSPF-5-ADJCHG: Process 4, Nbr 3.3.3.3 on FastEthernet0/0 from FULL to DOWN, +Neighbor Down: Dead timer expired +*Apr 28 00:06:58.495: %OSPF-5-ADJCHG: Process 4, Nbr 2.2.2.2 on FastEthernet0/0 from FULL to DOWN, +Neighbor Down: Dead timer expired + +This example demonstrates several interesting facts. First, note that upon configuring the ip ospf hello-interval 9 command under Fa0/0, the show ip ospf interface fa0/0 com-mand shows that not only did the Hello interval change, but the Dead timer was also set to 4X the Hello interval, or 36. To directly set the Dead timer on the interface, use the ip ospf dead-interval value interface subcommand. Then, at the end of the example, note that all three of R4’s neighbor relationships failed, because those routers now have mis-matched Hello and Dead timers. However, the neighbor relationships failed only after the Dead timers expired, as noted in the messages and as confirmed by the timestamps on the messages. + +Example 7-4 also shows the two normal, stable, and working neighbor states. Look to the heading “state” in the output of the show ip ospf neighbors command at the top of the example. The first word (before the /) lists the state or status of each neighbor. +FULL refers to a fully adjacent neighbor, meaning that the OSPF topology has been fully exchanged with that neighbor. The other state listed there, 2WAY, is a normal, stable, working state for neighbors with which topology data was not exchanged directly. In + + + + +From the Library of Alexey Evseenko +278 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +some cases, OSPF routers exchange their topology information to one specific router on a LAN, called the designated router (DR), but they do not exchange their database +directly with other routers. In the preceding example, taken from R4, R4 lists its relation-ship with R1 as 2WAY, which happens to be the status for a working neighbor that does not become fully adjacent. + + +Note OSPF has two methods to tune the Hello and Dead intervals to subsecond values. Like EIGRP, OSPF supports Bidirectional Forwarding Detection (BFD). Additionally, OSPF supports the command ip ospf dead-interval minimal hello-multiplier multiplier, which sets the Dead interval to one second, and the Hello interval to a fraction of a second based on the multiplier. For example, the command ip ospf dead-interval minimal hello-multiplier 4 sets the Dead interval to one second, with Hellos occurring four times (the multiple) per second, for an effective Hello interval of 1/4 seconds. + + + +Using a Unique OSPF Router ID + +As mentioned earlier in the “OSPF Review” section, each OSPF router assigns itself a router ID, based on the same rules as EIGRP. In OSPF’s case, that means a router first looks for the OSPF router-id rid-value OSPF subcommand; next, to the highest IP address of any up loopback interface; and finally, to the highest IP address of any up non-loopback interface. + +An OSPF RID mismatch makes for unpredictable results, because OSPF routers base their view of the topology on the topology database, and the database identifies routers based on their RIDs. By design, all OSPF RIDs in a domain should be unique. To avoid such issues, OSPF prevents neighborships between routers with duplicate RIDs. + +The next example shows what happens when two routers discover each other as poten-tial neighbors but notice a duplicate RID. Using the same network as in Figure 7-4, each router has been assigned an obvious RID: 1.1.1.1 for R1, 2.2.2.2 for R2, and so on. +Unfortunately, R4 has been mistakenly configured with RID 1.1.1.1, duplicating R1’s RID. R4 is powered on after all three other routers have established neighbor relationships. Example 7-5 shows some of the results. + +Example 7-5 OSPF RID Mismatch—R1 and R4, R4 Connects After R1 + +! On R1... the following output occurs AFTER R4 powers on. R1, RID 1.1.1.1, +! does not form a neighbor relationship with R4. +R1# show ip ospf neighbors + + +Neighbor ID +2.2.2.2 +3.3.3.3 + +Pri State +1 FULL/BDR +1 FULL/DR + +Dead Time +00:00:35 +00:00:33 + +Address +10.5.5.2 +10.5.5.3 + +Interface +FastEthernet0/0 +FastEthernet0/0 + + +! On R3 + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 279 + +! R3 does form a neighbor relationship, but does not learn routes from +! R4. Note that R3 does not have a route for R4's 10.4.4.0/27 subnet. +R3# show ip ospf neighbors + + +Neighbor ID +1.1.1.1 +1.1.1.1 +2.2.2.2 + +Pri State +1 FULL/DROTHER +1 FULL/DROTHER +1 FULL/BDR + +Dead Time +00:00:38 +00:00:37 +00:00:35 + +Address +10.5.5.1 +10.5.5.4 +10.5.5.2 + +Interface +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + +R3# show ip route ospf +10.0.0.0/8 is variably subnetted, 4 subnets, 4 masks +O 10.2.2.0/25 [110/2] via 10.5.5.2, 00:06:56, FastEthernet0/0 +O 10.1.1.0/24 [110/2] via 10.5.5.1, 00:01:34, FastEthernet0/0 + +As you can see from the output on R1, whose RID is duplicated with R4, the routers with duplicate RIDs do not form a neighbor relationship. Additionally, other routers, such as R3, do form neighbor relationships with the two routers, but the duplication confuses the topology flooding process. Because R3 formed its neighborship with R1 before R4, R3 does learn a route for R1’s 10.1.1.0/24 subnet, but does not for R4’s 10.4.4.0/27 subnet. However, with the same configuration, but a different sequence and timing of neighbors coming up, R3 might learn about 10.4.4.0/27 instead of 10.1.1.0/24. + + +Note The OSPF process will not start without an RID. + + + +Using the Same IP MTU + +The maximum transmission unit (MTU) of an interface tells Cisco IOS the largest IP packet that can be forwarded out an interface. This setting protects the packet from being discarded on data links whose Layer 2 features will not pass a frame over a certain size. For example, routers typically default to an IP MTU of 1500 bytes. + +From a data plane perspective, when a router needs to forward a packet larger than the outgoing interface’s MTU, the router either fragments the packet or discards it. If the IP header’s Do Not Fragment (DF) bit is set, the router discards the packet. If the DF bit is not set, the router can perform Layer 3 fragmentation on the packet, creating two (or more) IP packets with mostly identical IP headers, spreading the data that follows the +original IP packet header out among the fragments. The fragments can then be forwarded, with the reassembly process being performed by the receiving host. + +From a design perspective, the MTU used by all devices attached to the same data link ought to be the same value. However, routers have no dynamic mechanism to prevent the misconfiguration of MTU on neighboring routers. + +When an MTU mismatch occurs between two OSPF neighbors, one router will attempt to become neighbors with the other router whose MTU differs. The other router will be listed in the list of neighbors (show ip ospf neighbor). However, the two routers will not + + + + +From the Library of Alexey Evseenko +280 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +exchange topology information, and the two routers will not calculate routes that use this neighbor as a next-hop router. + +The IP MTU can be set on an interface using the ip mtu value interface subcommand and for all Layer 3 protocols with the mtu value interface subcommand. Example 7-6 shows an example, with R4 again configured so that it has problems. + +Example 7-6 Setting IP MTU and Failing the OSPF Database Exchange Process + +R4# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R4(config)# int fastethernet0/0 +R4(config-if)# ip mtu 1498 +R4(config-if)# ^Z +R4# +R4# show ip interface fa0/0 +FastEthernet0/0 is up, line protocol is up +Internet address is 10.5.5.4/28 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1498 bytes +! lines omitted for brevity +R4# show ip ospf neighbors + +Neighbor ID Pri State Dead Time Address Interface + +1.1.1.1 +2.2.2.2 + +1 EXSTART/DROTHER 00:00:39 +1 EXSTART/DROTHER 00:00:37 + +10.5.5.1 +10.5.5.2 + +FastEthernet0/0 +FastEthernet0/0 + +3.3.3.3 1 EXSTART/BDR 00:00:39 10.5.5.3 FastEthernet0/0 + +*Apr 28 12:36:00.231: %OSPF-5-ADJCHG: Process 4, Nbr 2.2.2.2 on FastEthernet0/0 +from EXSTART to DOWN, Neighbor Down: Too many retransmissions +R4# show ip ospf neighbors + + +Neighbor ID +1.1.1.1 +2.2.2.2 +3.3.3.3 + +Pri State +1 INIT/DROTHER +1 DOWN/DROTHER +1 INIT/DROTHER + +Dead Time +00:00:39 +- +00:00:39 + +Address +10.5.5.1 +10.5.5.2 +10.5.5.3 + +Interface +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + + +Note that you could argue that the mismatched MTU does not prevent routers from becoming neighbors, but it does prevent them from successfully exchanging topology data. When the mismatch occurs, a pair of routers tries to become neighbors, and they list each other in the output of the show ip ospf neighbors command, as seen in Example 7-6. However, the neighbor state (listed before the /, under the heading “State”) moves from EXSTART (which means that the database exchange process is starting), but it fails as implied by the highlighted message in the example. Then, the state changes to DOWN, and later one router tries again, moving to the INIT (initializing) state. So, the neighbor +is listed in the output of the show ip ospf neighbors command, but it never succeeds at exchanging topology data. + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 281 + +OSPF Neighbors and Adjacencies on WANs + +To form OSPF neighbor relationships on WAN connections, OSPF still must meet the same requirements as on LANs. The area number must match with each neighbor; the IP subnet address and mask of each router must match; authentication must pass; and so on. In short, the items in Table 7-5 earlier in this chapter must be true. + +However, the operation of OSPF on WAN links of various types requires some additional thought, particularly when developing an implementation and verification plan. In par-ticular, depending on the WAN technology and configuration, the following additional questions might matter for proper OSPF operation over WAN connections: + +■ Will the routers discover each other using multicast OSPF Hello messages, or do the neighbors require predefinition? + +■ Will the routers try to elect a DR, and if so, which router should be the DR? + +■ With which other routers should each router become an OSPF neighbor? + +The first two of these items depend in part on the setting of the OSPF network type, and the third question depends on the WAN service. This section first examines the concept of OSPF network types and then examines the use of OSPF over common WAN technologies. + +OSPF Network Types + +The OSPF network type (a per-interface setting) directs OSPF in regard to three impor-tant facts: + +■ Whether the router can expect to discover neighbors using multicast Hello messages + +■ Whether only two or more than two OSPF routers can exist in the subnet attached to the interface + +■ Whether the router should attempt to elect an OSPF DR on that interface + +For example, LAN interfaces require a DR because of the default OSPF network type of broadcast. An OSPF network type of broadcast dynamically discovers neighbors using multicast Hello messages. Also, the broadcast OSPF network type supports more than two routers on the same subnet, and it elects a DR. Conversely, point-to-point links and point-to-point WAN subinterfaces default to use a network type of point-to-point, mean-ing that only two OSPF routers can exist in the subnet, neighbors can be dynamically discovered through Hellos, and the routers do not elect a DR. + +In production networks, the network type is often ignored, because there is no motiva-tion to change this setting—you pick a combination that works, and most everyone ignores it. However, for the sake of CCNP ROUTE, you need to be able to distinguish between these different OSPF network types. + +Table 7-6 summarizes the OSPF network types and their meanings. Note that this per-interface or per-subinterface setting is configured with the ip ospf network type inter-face subcommand. + + + +From the Library of Alexey Evseenko +282 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 7-6 OSPF Network Types Key +Topic Interface Type Uses Default Hello Dynamic DR/BDR? Interval Discovery of +Neighbors? + + + +More Than Two Routers Allowed in the Subnet? + +Broadcast Yes 10 Yes Yes + +Point-to-point No 10 Yes No +1 + +Loopback No — — No + +Nonbroadcast2 (NBMA) Yes 30 No Yes + +Point-to-multipoint No 30 Yes Yes + +Point-to-multipoint No 30 No Yes nonbroadcast + +1 Default on Frame Relay point-to-point subinterfaces. +2 Default on Frame Relay physical and multipoint subinterfaces. + + +OSPF Neighborship over Point-to-Point Links + +Point-to-point serial links can be a bit boring. You configure IP addresses on either end, configure the clock rate if using a back-to-back serial cable in a lab, and configure no shutdown on the interfaces. When enabling OSPF on the interfaces, no extra effort is required compared to LANs—just enable OSPF on the interface, and rely on the default OSPF network type of point-to-point. + +However, serial links can provide a convenient and uncluttered place to experiment with OSPF network types. As such, Figure 7-5 shows a small network with two routers, with Example 7-7 that follows showing several examples of the OSPF network type. (This small network matches a portion of the network shown in Figure 7-1 earlier in this chapter.) +Area 1 + + + +RID 1.1.1.1 RID 2.2.2.2 + + +S0/0/0 R1 12.1/30 +Fa0/0 1.1/24 + + +S0/0/1 12.2/30 R2 +Fa0/0 2.2/25 + +Area 0 + + + + + +Note: All IP addresses begin with 10.1 unless otherwise noted. Figure 7-5 Simple Two-Router Internetwork + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 283 + +Example 7-7 demonstrates OSPF network types with all defaults on the High-Level Data Link Control (HDLC) link between R1 and R2. + +Example 7-7 OSPF Network Types, Default, on an HDLC Link + +R1# show run int s0/0/0 +Building configuration... + +Current configuration : 102 bytes +! +interface Serial0/0/0 +ip address 10.1.12.1 255.255.255.252 +no fair-queue +clock rate 1536000 +! +router ospf 1 +network 10.0.0.0 0.255.255.255 area 1 +! +end + +R1# show ip ospf interface s0/0/0 +Serial0/0/0 is up, line protocol is up +Internet Address 10.1.12.1/30, Area 1 +Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64 +! lines omitted for brevity + +R1# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 + +Pri State +0 FULL/ - + +Dead Time +00:00:31 + +Address +10.1.12.2 + +Interface +Serial0/0/0 + + +Example 7-7 begins listing R1’s configuration on the serial link, mainly to make the point that the OSPF network type has not been explicitly configured. The show ip ospf inter-face command then lists the network type (point-to-point). Based on Table 7-7, this type should dynamically discover neighbors, and it does, with neighbor 2.2.2.2 (R2) being listed at the end of the example. In particular, note that under the state heading in the show ip ospf neighbor command output, after the /, only a dash is listed. This notation means that no attempt was made to elect a DR. If the network type had implied that a DR should be elected, some text would be listed after the /, for example, “/DR” meaning that the neighbor was the DR. (Refer back to the end of Example 7-4 for an example of the output of show ip ospf neighbor in which a DR has been elected.) + +Example 7-8 shows an alternative where both routers change their OSPF network type on the serial link to nonbroadcast. This change is nonsensical in real designs and is only done for the purposes of showing the results: that the neighbors are not discovered dynami-cally, but after being defined, a DR is elected. + + + + + +From the Library of Alexey Evseenko +284 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note R2 has been preconfigured to match the configuration on R1 in Example 7-8. Specifically, the OSPF network type has been changed (ip ospf network non-broadcast), and R2 has been configured with a neighbor 10.1.12.1 OSPF router subcommand. + + +Example 7-8 Configuring OSPF Network Type Nonbroadcast on an HDLC Link + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# interface s0/0/0 +R1(config-if)# ip ospf network ? + +broadcast +non-broadcast + +Specify OSPF broadcast multi-access network +Specify OSPF NBMA network + + + +point-to-multipoint +point-to-point + +Specify OSPF point-to-multipoint network +Specify OSPF point-to-point network + +R1(config-if)# ip ospf network non-broadcast +R1(config-if)# ^Z + +R1# show ip ospf neighbor + +R1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# router ospf 1 +R1(config-router)# neighbor 10.1.12.2 +R1(config-router)# ^Z +R1# + +*Apr 28 20:10:15.755: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0/0 from LOADING to FULL, Loading Done +R1# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 + +Pri State +1 FULL/DR + +Dead Time +00:01:58 + +Address +10.1.12.2 + +Interface +Serial0/0/0 + + +The example begins with R2 already configured, so the neighbor relationship has already failed. When the OSPF network type changes on R1’s S0/0/0, the routers do not dynami-cally discover each other, based on the network type (nonbroadcast). However, by com-pleting the configuration in the example by adding R1’s neighbor 10.1.12.2 command, the neighbor relationship is formed. Also, note that the final show ip ospf neighbor com-mand lists a state of FULL, then a /, and then DR, meaning that a DR was indeed elected, as required by this OSPF network type. + +Neighborship over Frame Relay Point-to-Point Subinterfaces + +Frame Relay design allows several options for IP addressing and subnetting. One option treats each pair of routers on the ends of each PVC as a point-to-point topology, with one + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 285 + +subnet assigned to each pair of routers. Another option treats more than two routers as a group, whether connected with a full mesh or partial mesh of PVCs, with a single subnet assigned to that group. + +Many Frame Relay designs use the first option, treating each pair of routers on the ends of a PVC as a single subnet, as shown in Figure 7-6. In such cases, it makes sense to treat each PVC as a separate point-to-point connection, assigning a single subnet (at Layer 3) to each Layer 2 PVC. + + + + + +interface S0/0/0.1 point-to-point +ip address 10.1.1.1 255.255.255.252 frame-relay interface-dlci 101 +10.1.1.0/30 interface S0/0/0.2 point-to-point +ip address 10.1.1.5 255.255.255.252 frame-relay interface-dlci 102 + +interface s0/0/0.3 point-to-point +ip address 10.1.1.9 255.255.255.252 frame-relay interface-dlci 103 + + +R1 + +10.1.1.8/30 + + + +Frame Relay + +10.1.1.4/30 + + + + + +R2 R4 + +R3 + + + + +OSPF Neighborship + +Figure 7-6 Hub-and-Spoke Frame Relay Network + +With this design, if all the routers use point-to-point subinterfaces as shown in R1’s con-figuration in the figure, you can ignore the OSPF network (interface) type and OSPF works fine. Cisco IOS point-to-point subinterfaces unsurprisingly default to use an OSPF network type of point-to-point. The two routers discover each other using multicast OSPF Hellos. They do not bother to elect a DR, and everything works well. + +Neighborship on MPLS VPN + +Multiprotocol Label Switching (MPLS) virtual private networks (VPN) create a WAN service that has some similarities but many differences when compared to Frame Relay. The customer routers connect to the service, often with serial links but at other times + + + + +From the Library of Alexey Evseenko +286 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +with Frame Relay PVCs or with Ethernet. The service itself is a Layer 3 service, forward-ing IP packets through a cloud. As a result, no predefined PVCs need to exist between the customer routers. Additionally, the service uses routers at the edge of the service pro-vider cloud—generically called provider edge (PE) routers—and these routers are Layer 3 aware. + +That Layer 3 awareness means that the customer edge (CE) routers form an OSPF neigh-borship with the PE router on the other end of their local access link, as shown in Figure 7-7. The PE routers exchange their routes, typically using Multiprotocol BGP (MP-BGP). So, unlike the design seen previously in Figure 7-6, the central-site router will not have an OSPF neighborship with each branch office router but will have a neighborship with the MPLS VPN provider’s PE router. MPLS VPN characteristics do impact the data seen in the LSDB in the enterprise routers and require some different thinking in regard to area design. + + + + +R1 + + + +PE + + + + +MPLS VPNs + + +PE PE PE + + +R2 R4 + +R3 + + + + + +OSPF Neighborship + +Figure 7-7 OSPF Neighborships over MPLS VPN + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 287 + +Neighborship on Metro Ethernet + +In the like-named section “Neighborship on Metro Ethernet” in Chapter 4, “Fundamental EIGRP Concepts,” you were introduced to some basic terminology for Metro Ethernet, including Virtual Private Wire Service (VPWS), a point-to-point service, and Virtual Private LAN Service (VPLS), a multipoint service. In both cases, however, if a customer connects to the service using a router, the configuration typically uses VLAN trunking with subinterfaces off a Fast Ethernet or Gigabit Ethernet interface. If connecting with a Layer 3 switch, the configuration again often uses VLAN trunking, with the Layer 3 con-figuration being made on various VLAN interfaces inside the switch configuration. + +Because MetroE services provide Layer 2 connectivity, customer routers do not form OSPF neighborships with routers inside the service provider’s network. Instead, OSPF neighborships form between customer routers, essentially as if the service were a large WAN. Figure 7-8 shows the basic idea, with four routers connected to the service. + + + + +R1 +Gi0/0 + + + + + + + +Metro Ethernet + + + + +Fa0/1 Fa0/1 + +R2 Fa0/1 R4 + +R3 + + + + + +OSPF Neighborship + +Figure 7-8 OSPF Neighborships over Metro Ethernet + + + + + +From the Library of Alexey Evseenko +288 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Figure 7-8 shows four routers with any-to-any connectivity, typical of a VPWS service. However, from an OSPF design perspective, each pair of routers could communicate over a different VLAN, using a different Layer 3 subnet. Each Layer 3 subnet could be in a dif-ferent area. + +Virtual Links + +OSPF area design requires the use of a backbone area, area 0, with each area connecting to area 0 through an ABR. However, in some cases, two backbone areas exist. In other cases, a nonbackbone area might not have a convenient point of connection to the back-bone area, for example: + +■ Case 1: An existing internetwork needs to add a new area, with a convenient, low-cost connection point with another nonbackbone area; however, that connection does not give the new area any connection to area 0. + +■ Case 2: Even with a well-designed area 0, a combination of link failures might result in a discontiguous backbone area, essentially creating two backbone areas. + +■ Case 3: Two companies could merge, each using OSPF. To merge the OSPF domains, one backbone area must exist. It might be more convenient to connect the two net-works using links through an existing nonbackbone area, but that design means two backbone areas, which is not allowed. + +Figure 7-9 shows an example of each of the first two cases. + +The problems in each case have different symptoms, but the problems all stem from the area design requirements: Each area should be contiguous, and each nonbackbone area should connect to the backbone area through an ABR. When the network does not meet these requirements, engineers could simply redesign the areas. However, OSPF provides an alternative tool called an OSPF virtual link. + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 289 + + +(New) Area 111 + +(Old) +Area 222 Area 0 + + +Case 1 + + + + + +Backbone +Site 1 Area Site 2 + + + + + +Case 2 + + + + + + + + + + + + + +Area 1 + +Figure 7-9 Examples of Area Design Issues + +Understanding OSPF Virtual Link Concepts + +An OSPF virtual link allows two ABRs that connect to the same nonbackbone area to form a neighbor relationship through that nonbackbone area, even when separated by many other routers and subnets. This virtual link acts like a virtual point-to-point connec-tion between the two routers, with that link inside area 0. The routers form a neighbor relationship, inside area 0, and flood LSAs over that link. + + + + + + + + + + +From the Library of Alexey Evseenko +290 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +For example, consider the topology in Figure 7-10, which shows an example of the third of the three cases described in the beginning of this section. In this case, two companies merged. Both companies had a small office in the same city, so for expediency’s sake, they connected the two former enterprise internetworks through a newly combined local sales office in area 1. + + +Company 1 Area 0 + +Company 2 Area 0 + + + + + + + + + +RID 1.1.1.1 + + +Fa0/0 + + +C1 + +Fa0/1 10.21.1.1/24 + +Fa0/0 +RID 4.4.4.4 +Virtual Link C2 + +Fa0/1 10.24.1.1/24 + + + + + +Branch Company 1 + +Branch Company 2 + + +Area 1 + +Figure 7-10 Connecting Two Area 0s with a Virtual Link + +Although adding the link between branch offices can be a cost-effective temporary choice, it creates a design problem: Two backbone areas now exist, and OSPF requires that the backbone area be contiguous. To solve this problem, the engineer configures a virtual link between ABRs C1 and C2. The virtual link exists inside area 0, making area 0 contiguous. + +To define the virtual link, each router configures the other router’s RID and a reference to the area through which the virtual link passes (area 1 in this case). The two routers send the usual OSPF message types, encapsulated inside unicast IP packets, with a destination IP address of the router on the other end of the virtual link. Any routers between the two routers that create the virtual link—for example, the two branch routers in Figure +7-10—just forward these OSPF packets like any other packet. The neighbors on the ends of the virtual link flood their LSDBs to each other so that all routers in both parts of area 0 learn the routes from the other area 0. + +The ABRs connected over a virtual link act mostly like any other ABR, with a couple of differences. The first difference is that ABRs send all OSPF messages as unicasts to the IP address of the router on the other end of the link. Second, the routers also mark the Do Not Age (DNA) bit in the LSAs, meaning that all routers on the other side of the virtual + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 291 + +link will not expect the LSAs to be reflooded over the virtual link on the usual 30-minute refresh interval. This helps reduce overhead over the virtual link, which often runs over slower links and less-powerful routers. The router also assigns an OSPF cost to the virtual link, just as it would for an interface. + +After the virtual link is up, the ABRs’ SPF processes can calculate their best routes just like before, using the virtual link as another point-to-point link in area 0. For packets destined to pass from one part of the backbone over the virtual link to the other part of the backbone, the chosen best routes eventually lead the packets to the router with the virtual link. That router, connected to the transit nonbackbone area, has already calcu-lated its next hop based on the LSDB in the transit area (Router C1 and transit area 1 in the example of Figure 7-10). The routers in the transit area choose routes that eventually deliver the packet to the router on the other end of the virtual link (Router C2 in Figure 7-10). + +Configuring OSPF Virtual Links + +Configuring an OSPF virtual link requires a minor amount of configuration just to get the link working, with several optional configuration items. Most of the optional con-figuration settings relate to features that would normally be configured on the interface connecting two neighboring routers, but with a virtual link, there is no such interface, so the parameters must be added to the area virtual-link command. The following list sum-marizes the key configuration options on the area virtual-link router subcommand: + + +Key ■ Topic + +■ + + +■ + +■ + + + +■ + + + +■ + +The remote-RID in the area area-num virtual-link remote-RID command refers to the other router’s RID. + +The area-num in the area area-num virtual-link remote-RID command refers to the transit area over which the packets flow between the two routers. + +The transit area over which the two routers communicate must not be a stubby area. + +The optional configuration of OSPF neighbor authentication parameters, normally configured as interface subcommands, must be configured as additional parameters on the area virtual-link command. + +The optional configuration of Hello and Dead intervals, normally configured as interface subcommands, must be configured as additional parameters on the area virtual-link command. + +The router assigns the virtual link an OSPF cost as if it were a point-to-point link. The router calculates the cost as the cost to reach the router on the other end of the +link, as calculated using the transit area’s LSDB. + + +Example 7-9 shows the configuration of a virtual link on Router C1 and Router C2 shown in Figure 7-10. The configuration shows the virtual link, referencing area 1 as the transit area, with each router referring to the other router’s RIDs. The configuration also shows the loopback IP addresses on which the ABR’s RIDs are based being advertised into OSPF. + + + + + +From the Library of Alexey Evseenko +292 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 7-9 OSPF Virtual Link Configuration on Routers C1 and C2 + +! On Router C1: +router ospf 1 +area 1 virtual-link 4.4.4.4 +! +interface fastethernet0/0 +ip address 10.1.1.1 255.255.255.0 +ip ospf 1 area 0 +! +interface fastethernet0/1 +ip address 10.21.1.1 255.255.255.0 +ip ospf 1 area 1 +! +interface loopback 1 +ip address 1.1.1.1 255.255.255.0 +ip ospf 1 area 1 + +! On Router C2: +router ospf 4 +area 1 virtual-link 1.1.1.1 +! +interface fastethernet0/0 +ip address 10.4.4.4 255.255.255.0 +ip ospf 4 area 0 +! +interface fastethernet0/1 +ip address 10.24.1.1 255.255.255.0 +ip ospf 4 area 1 +! +interface loopback 1 +ip address 4.4.4.4 255.255.255.0 +ip ospf 4 area 1 + + +Verifying the OSPF Virtual Link + +To prove whether the virtual link works, a neighbor relationship between C1 and C2 must reach the FULL state, resulting in all routers in both parts of area 0 having the same area 0 LSDB. Example 7-10 shows the working neighbor relationship, plus status information for the virtual link with the show ip ospf virtual-links command. + +Example 7-10 OSPF Virtual Link Configuration on Routers C1 and C2 + +C1# show ip ospf virtual-links +Virtual Link OSPF_VL0 to router 4.4.4.4 is up +Run as demand circuit +DoNotAge LSA allowed. + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 293 + +Transit area 1, via interface FastEthernet0/1, Cost of using 3 +Transmit Delay is 1 sec, State POINT_TO_POINT, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:02 +Adjacency State FULL (Hello suppressed) +Index 1/2, retransmission queue length 0, number of retransmission 0 +First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) +Last retransmission scan length is 0, maximum is 0 +Last retransmission scan time is 0 msec, maximum is 0 msec +! +! next, note that the neighbor reaches FULL state, with no DR elected. + +C1# show ip ospf neighbor + + +Neighbor ID +4.4.4.4 + +Pri State +0 FULL/ - + +Dead Time +- + +Address +10.24.1.1 + +Interface +OSPF_VL0 + +2.2.2.2 1 FULL/DR 00:00:35 10.21.1.2 FastEthernet0/1 + + +C1# show ip ospf neighbor detail 4.4.4.4 +Neighbor 4.4.4.4, interface address 10.24.1.1 +In the area 0 via interface OSPF_VL0 +Neighbor priority is 0, State is FULL, 6 state changes +DR is 0.0.0.0 BDR is 0.0.0.0 +Options is 0x32 in Hello (E-bit, L-bit, DC-bit) +Options is 0x72 in DBD (E-bit, L-bit, DC-bit, O-bit) +LLS Options is 0x1 (LR) +Neighbor is up for 00:00:21 +Index 1/2, retransmission queue length 0, number of retransmission 0 +First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) +Last retransmission scan length is 0, maximum is 0 +Last retransmission scan time is 0 msec, maximum is 0 msec + +The only new command in the example, show ip ospf virtual-links, details some items unique to virtual links. In particular, the first highlighted portion shows the assignment of a name to the link (VL0); if multiple virtual links were configured, each would have +a different number. This virtual link name/number is then referenced inside the LSDB. It also shows that the routers both allow the use of the Do Not Age (DNA) bit, so periodic reflooding will not occur over this virtual link. It lists a cost of 3. As it turns out, each of the three interfaces between Router C1 and C2 have an OSPF cost of 1, so C1’s area 1 +cost to reach C2 is 3. The output also confirms that the routers have reached a fully adja-cent state and are suppressing the periodic Hello messages. + + + + + + + + +From the Library of Alexey Evseenko +294 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The familiar show ip ospf neighbor command lists a few new items as well. Note that the interface refers to the virtual link “OSPF VL0” instead of the interface, because there is no interface between the neighbors. It also lists no Dead timer, because the neighbors +choose to not use the usual Hello/Dead interval process over a virtual link. (Instead, if all the transit area’s routes to reach the router on the other router of the link fail, the virtual link fails.) Finally, the show ip ospf neighbor detail 4.4.4.4 command shows the interest-ing phrase “In the area 0 via interface OSPF VL0,” confirming that the neighborship does indeed exist in area 0. + + +Note OSPF does not require that the RID IP address range be advertised as a route in OSPF. As a result, the RID listed in the area virtual-link command might not be pingable, but the virtual link still works. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 295 + + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter, so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 7-7 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about specific parameters. + +Table 7-7 Design Review + + +Design Goal + +Improve OSPF convergence. + +Implement OSPF on each router so that neighborships are formed (2). +Limit neighborship formation on OSPF-enabled interfaces (2). +The design shows branch routers with WAN interfaces in area 0 and LAN interfaces in different areas for each branch. What LSDB information do you expect to see in the branch routers? +A merger design plan shows two companies with OSPF backbone areas. How can the two area 0s be connected? (2) + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 7-8 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + + +From the Library of Alexey Evseenko +296 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 7-8 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answers +What happens on a router interface on which an OSPF network command matches the interface? (2) +What configuration settings prevent OSPF neighbor discovery on an OSPF-enabled interface? +What settings do potential neighbors check before becoming OSPF neighbors? (7) +What settings that many CCNP candidates might think would impact OSPF neighbor relationships actually do not prevent a neighborship from forming? +A design shows one main site and 100 branches, with OSPF and MPLS VPNs. How many OSPF neighborships over the WAN do you expect to see on the central-site router? +A design shows one main site and 100 branches, with one Frame Relay PVC between the main site and each branch. How many OSPF neighborships over the WAN do you expect to see on the central-site router? +A design shows six routers connected to the same VLAN and subnet. How many OSPF fully adjacent neighborships over this subnet do you expect each router to have? +A design shows one main site and 100 branches, each connected with a VPWS service. The configuration shows that the central-site router uses a separate VLAN subinterface to connect to each branch, but the branch routers do not have a VLAN connecting to other branches. How many OSPF fully adjacent neighborships over the WAN do you expect to see on the central site router? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 7-9 configuration commands related to the configuration of the following features. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 297 + + +Table 7-9 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Enabling OSPF on interfaces—traditional method +Enabling OSPF on interfaces—using interface subcommands +Setting Hello and Dead intervals + +Passive interfaces, with router subcommands + +OSPF router ID + +Create a virtual link through transit area X + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table 7-10 all commands that supply the requested information. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 7-10 Verification Plan Memory Drill + +Information Needed Command +Which routes have been added to the IP routing table by OSPF? +All routes in a router’s routing table + +The specific route for a single destination address or subnet +A list of all (both static and dynamically discovered) OSPF neighbors +List interfaces on which OSPF has been enabled +List the number of OSPF neighbors and fully adjacent neighbors known through a particular interface +The elapsed time since a neighborship was formed +The configured Hello timer for an interface + +The configured Dead interval timer for an interface + + + + + +From the Library of Alexey Evseenko +298 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Information Needed Command The current actual Dead timer for a neighbor +A router’s RID + +A list of OSPF passive interfaces List traffic statistics about OSPF +Display the name and status of a virtual link + + +Note Some of the entries in this table may not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 7-11 lists a reference of these key topics and the +page numbers on which each is found. + + +Table 7-11 Key Topics for Chapter 7 +Key +Topic Key Topic Element Description Page Number + + +Table 7-2 + +List + +List + +Table 7-3 + +Table 7-4 + +List + + +Table 7-5 + +Table 7-6 + +Commonly Used OSPF 265 Terms +Base OSPF configuration 266 steps +Rules for choosing an OSPF 268 router ID +Commonly Used OSPF show 269 Commands +OSPF Feature Summary 271 + +Requirements before OSPF 272 will attempt to dynamically discover neighbors +Neighbor Requirements for 275 EIGRP and OSPF +OSPF Network Types 282 + + +List Configuration options for the 291 area virtual-link command + + + + + + +From the Library of Alexey Evseenko +Chapter 7: Fundamental OSPF Concepts 299 + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +area, area border router (ABR), backbone router, router ID, Hello interval, Dead inter-val, fully adjacent, OSPF network type, virtual link + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following topics: + +■ LSAs and the OSPF Link-State Database: This section examines LSA Types 1, 2, and 3 and describes how they allow OSPF routers to model a +topology and choose the best routes for each known subnet. +■ The Database Exchange Process: This section details how neighboring routers use OSPF messages to exchange their LSAs. +■ Choosing the Best Internal OSPF Routes: This section examines how OSPF routers calculate the cost for each possible route to each subnet. + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 8 + + + + + + +The OSPF Link-State Database + + +Open Shortest Path First (OSPF) and Enhanced Interior Gateway Routing Protocol (EIGRP) both use three major branches of logic, each of which populates a different table: the neighbor table, the topology table, or the IP routing table. This chapter exam-ines topics related to the OSPF topology table—the contents and the processes by which routers exchange this information—and describes how OSPF routers choose the best routes in the topology table to be added to the IP routing table. + +In particular, this chapter begins by looking at the building blocks of an OSPF topology table, namely, the OSPF link-state advertisement (LSA). Following that, the chapter examines the process by which OSPF routers exchange LSAs with each other. Finally, the last major section of the chapter discusses how OSPF chooses the best route among many when running the Shortest Path First (SPF) algorithm. + +Note that this chapter focuses on OSPF version 2, the long-available version of OSPF that supports IPv4 routes. Chapter 9, “Advanced OSPF Concepts,” discusses OSPF version 3, which applies to IPv6. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these nine self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 8-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of those spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 8-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +LSAs and the OSPF Link-State Database + +The Database Exchange Process + +Choosing the Best OSPF Routes + +Questions +1–3 + +4, 5 + +6–9 + + + + + + + + + +From the Library of Alexey Evseenko +302 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. A network design shows area 1 with three internal routers, area 0 with four internal routers, and area 2 with five internal routers. Additionally, one ABR (ABR1) connects areas 0 and 1, plus a different ABR (ABR2) connects areas 0 and 2. How many Type 1 LSAs would be listed in ABR2’s LSDB? +a. 6 + +b. 7 + +c. 15 + +d. 12 + +e. None of the other answers are correct. + +2. A network planning diagram shows a large internetwork with many routers. The con-figurations show that OSPF has been enabled on all interfaces, IP addresses correctly configured, and OSPF working. For which of the following cases would you expect a router to create and flood a Type 2 LSA? +a. When OSPF is enabled on a LAN interface, and the router is the only router connected to the subnet + +b. When OSPF is enabled on a point-to-point serial link, and that router has both the higher router ID and higher interface IP address on the link + +c. When OSPF is enabled on a Frame Relay point-to-point subinterface, has the lower RID and lower subinterface IP address, and otherwise uses default OSPF configuration on the interface +d. When OSPF is enabled on a working LAN interface on a router, and the router has been elected as a BDR + +e. None of the other answers are correct. + +3. A verification plan shows a network diagram with branch office Routers B1 through B100, plus two ABRs, ABR1 and ABR2, all in area 100. The branches connect to the ABRs using Frame Relay point-to-point subinterfaces. The verification plan lists the output of the show ip ospf database summary 10.100.0.0 command on a Router B1, one of the branches. Which of the following is true regarding the output that could be listed for this command? +a. The output lists nothing unless 10.100.0.0 has been configured as a summary route using the area range command. + +b. If 10.100.0.0 is a subnet in area 0, the output lists one Type 3 LSA, specifically the LSA with the lower metric when comparing ABR1’s and ABR2’s LSA for 10.100.0.0. +c. If 10.100.0.0 is a subnet in area 0, the output lists two Type 3 LSAs, one each created by ABR1 and ABR2. + +d. None, because the Type 3 LSAs would exist only in the ABR’s LSDBs. + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 303 + +4. Which of the following OSPF messages contains complete LSAs used during the database exchange process? + +a. LSR + +b. LSAck + +c. LSU + +d. DD + +e. Hello + +5. Routers R1, R2, R3, and R4 connect to the same 10.10.10.0/24 LAN-based subnet. OSPF is fully working in the subnet. Later, R5, whose OSPF priority is higher than the other four routers, joins the subnet. Which of the following are true about the OSPF database exchange process over this subnet at this point? (Choose two.) +a. R5 will send its DD, LSR, and LSU packets to the 224.0.0.5 all-DR-routers multi-cast address. + +b. R5 will send its DD, LSR, and LSU packets to the 224.0.0.6 all-DR-routers multi-cast address. + +c. The DR will inform R5 about LSAs by sending its DD, LSR, and LSU packets to the 224.0.0.6 all-SPF-routers multicast address. + +d. The DR will inform R5 about LSAs by sending its DD, LSR, and LSU packets to the 224.0.0.5 all-SPF-routers multicast address. +6. R1 is internal to area 1, and R2 is internal to area 2. Subnet 10.1.1.0/24 exists in area 2 as a connected subnet off R2. ABR1 connects area 1 to backbone area 0, and ABR2 connects area 0 to area 2. Which of the following LSAs must R1 use when calculat-ing R1’s best route for 10.1.1.0/24? +a. R2’s Type 1 LSA + +b. Subnet 10.1.1.0/24’s Type 2 LSA + +c. ABR1’s Type 1 LSA in area 0 + +d. Subnet 10.1.1.0/24’s Type 3 LSA in Area 0 + +e. Subnet 10.1.1.0/24’s Type 3 LSA in Area 1 + +7. Which of the following LSA types describe topology information that, when changed, requires a router in the same area to perform an SPF calculation? (Choose two.) + +a. 1 + +b. 2 + +c. 3 + +d. 4 + +e. 5 + +f. 7 + + + +From the Library of Alexey Evseenko +304 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +8. The following output was taken from Router R3. A scan of R3’s configuration shows that no bandwidth commands have been configured in this router. Which of the fol-lowing answers list configuration settings that could be a part of a configuration that results in the following output? Note that only two of the three interface’s costs have been set directly. (Choose two.) + +R3# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Se0/0/0.2 3 34 +Se0/0/0.1 3 34 +Fa0/0 3 34 + +10.10.23.3/29 +10.10.13.3/29 +10.10.34.3/24 + +647 P2P 1/1 +1000 P2P 1/1 +20 BDR 1/1 + + +a. An auto-cost reference-bandwidth 1000 command in router ospf mode + +b. An auto-cost reference-bandwidth 2000 command in router ospf mode + +c. An ip ospf cost 1000 interface S0/0/0.1 command in router ospf mode + +d. An auto-cost reference-bandwidth 64700 command in router ospf mode + +9. Which of the following LSA types describe information related to topology or subnets useful for calculating routes for subnets inside the OSPF domain? (Choose three.) +a. 1 + +b. 2 + +c. 3 + +d. 4 + +e. 5 + +f. 7 + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 305 + + +Foundation Topics + + +LSAs and the OSPF Link-State Database + +Every router that connects to a given OSPF area should learn the exact same topology data. Each router stores the data, composed of individual link-state advertisements (LSA), in its own copy of the link-state database (LSDB). Then, the router applies the Shortest Path First (SPF) algorithm to the LSDB to determine the best (lowest-cost) route for each reachable subnet (prefix/length). + +When a router uses SPF to analyze the LSDB, the SPF process has some similarities to how humans put a jigsaw puzzle together—but without a picture of what the puzzle looks like. Humans faced with such a challenge might first look for the obvious puzzle pieces, such as the corner and edge pieces, because they are easily recognized. You might then group puzzle pieces together if they have the same color or look for straight lines that might span multiple puzzle pieces. And of course, you would be looking at the shapes of the puzzle pieces to see which ones fit together. + +Similarly, a router’s SPF process must examine the individual LSAs and see how they fit together, based on their characteristics. To better appreciate the SPF process, the first section of this chapter examines the three LSA types that OSPF uses to describe an enterprise OSPF topology inside an OSPF domain. By understanding the types of LSAs, you can get a better understanding of what a router might look for to take the LSAs—the pieces of a network topology puzzle, if you will—and build the equivalent of a network diagram. + +Table 8-2 lists the various OSPF LSA types. Not all of these LSA types are discussed in this chapter but are provided in the table as a convenience when studying. + +Table 8-2 OSPF LSA Types Key +Topic LSA Type Common Name Description + + +1 Router + + + + +2 Network + + +3 Net Summary + +Each router creates its own Type 1 LSA to represent itself for each area to which it connects. The LSDB for one area contains one Type 1 LSA per router per area, listing the RID and all interface IP addresses on that router that are in that area. Represents stub networks as well. +One per transit network. Created by the DR on the subnet, and represents the subnet and the router interfaces connected to the subnet. +Created by ABRs to represent subnets listed in one area’s Type 1 and 2 LSAs when being advertised into another area. Defines the links (subnets) in the origin area, and cost, but no topology data. + + + + + + +From the Library of Alexey Evseenko +306 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +LSA Type 4 + +5 + +6 + +7 + +8 + + + + +9 + + + + + +10, 11 + +Common Name ASBR Summary + +AS External + +Group Membership + +NSSA External + +Link LSAs + + + + +Intra-Area Prefix LSAs + + + + +Opaque + +Description +Like a Type 3 LSA, except it advertises a host route used to reach an ASBR. +Created by ASBRs for external routes injected into OSPF. + +Defined for MOSPF; not supported by Cisco IOS. + +Created by ASBRs inside an NSSA area, instead of a Type 5 LSA. +Type 8 LSAs only exist on a local link, where they are used by a router to advertise the router’s link-local address to all other routers on the same link. Additionally, the Type 8 LSA provides to routers on that link a listing of all IPv6 addresses associated with the link. +Can send information about IPv6 networks (including stub networks) attached to a router (similar to the Type 1 LSA for IPv4 networks). Additionally, a Type 9 LSA can send information about transit IPv6 network segments within an area (similar to the Type 2 LSA for IPv4 networks). +Used as generic LSAs to allow easy future extension of OSPF. For example, Type 10 has been adapted for MPLS traffic engineering. + + + + +LSA Type 1: Router LSA + +An LSA type 1, called a Router LSA, identifies an OSPF router based on its OSPF router ID (RID). Each router creates a Type 1 LSA for itself and floods the LSA throughout the same area. To flood the LSA, the originating router sends the Type 1 LSA to its neighbors inside the same area, who in turn send it to their other neighbors inside the same area, until all routers in the area have a copy of the LSA. + +Besides the RID of the router, this LSA also lists information about the attached links. In particular, the Type 1 LSA lists + +■ For each interface on which no designated router (DR) has been elected, it lists the router’s interface subnet number/mask and interface OSPF cost. (OSPF refers to these subnets as stub networks .) + +■ For each interface on which a DR has been elected, it lists the IP address of the DR and a notation that the link attaches to a transit network (meaning that a Type 2 LSA exists for that network). + +■ For each interface with no DR, but for which a neighbor is reachable, it lists the neighbor’s RID. + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 307 + +As with all OSPF LSAs, OSPF identifies a Type 1 LSA using a 32-bit link-state identifier (LSID). When creating its own Type 1 LSA, each router uses its own OSPF RID value as the LSID. + +Internal routers each create a single Type 1 LSA for themselves, but area border routers (ABR) create multiple Type 1 LSAs for themselves: one per area. The Type 1 LSA in one area will list only interfaces in that area and only neighbors in that area. However, the router still has only a single RID, so all its Type 1 LSAs for a single router list the same RID. The ABR then floods each of its Type 1 LSAs into the appropriate area. + +To provide a better backdrop for the upcoming LSA discussions, Figure 8-1 shows a sam-ple internetwork, which will be used in most of the examples in this chapter. + +Area 34 + + + +Fa0/0 10.10.34.3/24 + + + +Fa0/0 10.10.34.4/24 + + + + + +Fa0/0 5.5/27 + + +Area 5 + + +S0/0/0.1 13.3 +R3 S0/0/0.2 +23.3 + +S0/0/0.1 14.4 +R4 +S0/0/0.2 +24.4 + + + +S0/0.1 15.5 + +R5 S0/0.2 +25.5 + + + +R1 + +Fa0/0.1 12.1 + + + + + +Fa0/0.1 12.2 + + +R2 + +SW1 Fa0/0 Fa0/1 +17.1 17.7 +Fa0/1 +18.1 Fa0/2 Gi0/1 27.7 98.7 + + + +SW3 + + +18.8 Gi0/1 Fa0/0 Fa0/1 98.8 27.2 + +Fa0/1 Fa0/2 28.2 28.8 +SW2 + +Area 0 + + + + + + +Data Center +Subnet 10.10.99.0/24 + + +Figure 8-1 Sample OSPF Multiarea Design + + +Note Unless otherwise noted, the first two octets of all networks in Figure 8-1 are 10.10, which are not shown to make the figure more readable. + + +All routers that participate in an area, be they internal routers or ABRs, create and flood a Type 1 LSA inside the area. For example, in Figure 8-1, area 5 has one internal router (R5, RID 5.5.5.5) and two ABRs: R1 with RID 1.1.1.1 and R2 with RID 2.2.2.2. Each of these three routers creates and floods its own Type 1 LSA inside area 5 so that all three routers know the same three Type 1 LSAs. + +Next, to further understand the details inside a Type 1 LSA, first consider the OSPF configuration of R5 as an example. R5 has three IP-enabled interfaces: Fa0/0, S0/0.1, and S0/0.2. R5 uses point-to-point subinterfaces, so R5 should form neighbor relationships with both R1 and R2 with no extra configuration beyond enabling OSPF, in area 5, on all three interfaces. Example 8-1 shows this baseline configuration on R5. + + + + +From the Library of Alexey Evseenko +308 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 8-1 R5 Configuration—IP Addresses and OSPF + +interface Fastethernet0/0 +ip address 10.10.5.5 255.255.255.224 +ip ospf 5 area 5 +! +interface s0/0.1 point-to-point +ip address 10.10.15.5 255.255.255.248 +frame-relay interface-dlci 101 +ip ospf 5 area 5 +! +interface s0/0.2 point-to-point +ip address 10.10.25.5 255.255.255.248 +frame-relay interface-dlci 102 +ip ospf 5 area 5 +! +router ospf 5 +router-id 5.5.5.5 +! +R5# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +se0/0.2 5 5 +se0/0.1 5 5 +fa0/0 5 5 + +10.10.25.5/29 +10.10.15.5/29 +10.10.5.5/27 + +64 P2P 1/1 +64 P2P 1/1 +1 DR 0/0 + +R5# show ip ospf neighbor + + +Neighbor ID +2.2.2.2 +1.1.1.1 + +Pri State +0 FULL/ - +0 FULL/ - + +Dead Time +00:00:30 +00:00:38 + +Address +10.10.25.2 +10.10.15.1 + +Interface +Serial0/0.2 +Serial0/0.1 + + +R5’s OSPF configuration enables OSPF, for process ID 5, placing three interfaces in area 5. As a result, R5’s Type 1 LSA will list at least these three interfaces as links, plus it will refer to the two working neighbors. Example 8-2 displays the contents of R5’s area 5 LSDB, including the detailed information in R5’s Type 1 LSA, including the following: + +■ The LSID of R5’s Type 1 LSA (5.5.5.5) + +■ Three links that connect to a stub network, each listing the subnet/mask + +■ Two links that state a connection to another router, one listing R1 (RID 1.1.1.1) and one listing R2 (RID 2.2.2.2) + +Example 8-2 R5 Configuration—IP Addresses and OSPF + +R5# show ip ospf database + +OSPF Router with ID (5.5.5.5) (Process ID 5) + +Router Link States (Area 5) + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 309 + + +Link ID +1.1.1.1 +2.2.2.2 +5.5.5.5 + +ADV Router Age +1.1.1.1 835 +2.2.2.2 788 +5.5.5.5 787 + +Seq# +0x80000002 +0x80000002 +0x80000004 + +Checksum +0x006BDA +0x0082A6 +0x0063C3 + +Link count +2 +2 +5 + + +Summary Net Link States (Area 5) + +Link ID ADV Router Age Seq# Checksum + +10.10.12.0 +10.10.12.0 + +1.1.1.1 835 +2.2.2.2 787 + +0x80000001 0x00F522 +0x80000001 0x00D73C + +! lines omitted for brevity + +R5# show ip ospf database router 5.5.5.5 + +OSPF Router with ID (5.5.5.5) (Process ID 5) + +Router Link States (Area 5) + +LS age: 796 +Options: (No TOS-capability, DC) +LS Type: Router Links +Link State ID: 5.5.5.5 +Advertising Router: 5.5.5.5 +LS Seq Number: 80000004 +Checksum: 0x63C3 +Length: 84 +Number of Links: 5 + +Link connected to: another Router (point-to-point) +(Link ID) Neighboring Router ID: 2.2.2.2 +(Link Data) Router Interface address: 10.10.25.5 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: a Stub Network +(Link ID) Network/subnet number: 10.10.25.0 +(Link Data) Network Mask: 255.255.255.248 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: another Router (point-to-point) +(Link ID) Neighboring Router ID: 1.1.1.1 +(Link Data) Router Interface address: 10.10.15.5 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: a Stub Network + + + +From the Library of Alexey Evseenko +310 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +(Link ID) Network/subnet number: 10.10.15.0 +(Link Data) Network Mask: 255.255.255.248 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: a Stub Network +(Link ID) Network/subnet number: 10.10.5.0 +(Link Data) Network Mask: 255.255.255.224 +Number of TOS metrics: 0 +TOS 0 Metrics: 1 + +The first command, show ip ospf database, displays a summary of the LSAs known to R5. The output mainly consists of a single line per LSA, listed by LSA ID. The three high-lighted lines of this output, in Example 8-2, highlight the RID of the three router (Type 1) LSAs, namely, 1.1.1.1 (R1), 2.2.2.2 (R2), and 5.5.5.5 (R5). + +The output of the show ip ospf database router 5.5.5.5 command displays the detailed information in R5’s Router LSA. Looking at the highlighted portions, you see three stub networks—three interfaces on which no DR has been elected—and the associated subnet numbers. The LSA also lists the neighbor IDs of two neighbors (1.1.1.1 and 2.2.2.2) and the interfaces on which these neighbors can be reached. + +Armed with the same kind of information in R1’s and R2’s Type 1 LSAs, a router has enough information to determine which routers connect, over which stub links, and then use the interface IP address configuration to figure out the interfaces that connect to the other routers. Figure 8-2 shows a diagram of area 5 that could be built just based on the detailed information held in the Router LSAs for R1, R2, and R5. + +Stub + + +Subnet 10.10.5.0/27 + + +neighbor 1.1.1.1 10.10.15.5 +R5 5.5.5.5 +10.10.15.0/29 Stub + +neighbor 5.5.5.5 10.10.15.1 +1.1.1.1 R1 +Stub Subnet 10.10.15.0/29 + + + +Subnet 10.10.25.0/29 + + +neighbor 2.2.2.2 10.10.25.5 + + + + +Stub +neighbor 5.5.5.5 +10.10.25.2 2.2.2.2 + + +R2 + +Stub Subnet 10.10.25.0/29 + +Figure 8-2 Three Type 1 LSAs in Area 5 + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 311 + +Note that Figure 8-2 displays only information that could be learned from the Type 1 Router LSAs inside area 5. Each Type 1 Router LSA lists information about a router, but only the details related to a specific area. As a result, Figure 8-2 shows R1’s interface in area 5 but none of the interfaces in area 34 nor in area 0. To complete the explanation sur-rounding Figure 8-2, Example 8-3 lists R1’s Type 1 Router LSA for area 5. + +Example 8-3 R1’s Type 1 LSA in Area 5 + +R5# show ip ospf database router 1.1.1.1 + +OSPF Router with ID (5.5.5.5) (Process ID 5) + +Router Link States (Area 5) + +Routing Bit Set on this LSA +LS age: 1306 +Options: (No TOS-capability, DC) +LS Type: Router Links +Link State ID: 1.1.1.1 +Advertising Router: 1.1.1.1 +LS Seq Number: 80000002 +Checksum: 0x6BDA +Length: 48 +Area Border Router +Number of Links: 2 + +Link connected to: another Router (point-to-point) +(Link ID) Neighboring Router ID: 5.5.5.5 +(Link Data) Router Interface address: 10.10.15.1 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: a Stub Network +(Link ID) Network/subnet number: 10.10.15.0 +(Link Data) Network Mask: 255.255.255.248 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + + +Note Because OSPF uses the RID for many purposes inside different LSAs—for exam-ple, as the LSID of a Type 1 LSA—Cisco recommends setting the RID to a stable, predict-able value. To do this, use the OSPF router-id value OSPF subcommand or define a loop-back interface with an IP address. + + + + + + + +From the Library of Alexey Evseenko +312 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +LSA Type 2: Network LSA + +SPF requires that the LSDB model the topology with nodes (routers) and connections between nodes (links). In particular, each link must be between a pair of nodes. When a multiaccess data link exists—for example, a LAN—OSPF must somehow model that LAN so that the topology represents nodes and links between only a pair of nodes. To do so, OSPF uses the concept of a Type 2 Network LSA. + +OSPF routers actually choose whether to use a Type 2 LSA for a multiaccess network based on whether a designated router (DR) has or has not been elected on an interface. So, before discussing the details of the Type 2 Network LSA, a few more facts about the concept of a DR need to be discussed. + +Background on Designated Routers + +As discussed in Chapter 7’s section “OSPF Network Types,” the OSPF network type assigned to a router interface tells that router whether to attempt to elect a DR on that interface. Then, when a router has heard a Hello from at least one other router, the routers elect a DR and BDR. + +OSPF uses a DR in a particular subnet for two main purposes: + +■ To create and flood a Type 2 Network LSA for that subnet Key +Topic ■ To aid in the detailed process of database exchange over that subnet + +Routers elect a DR, and a backup DR (BDR), based on information in the OSPF Hello. The Hello message lists each router’s RID and a priority value. When no DR exists at the time, routers use the following election rules when neither a DR nor BDR yet exists: + +■ Choose the router with the highest priority (default 1, max 255, set with the ip ospf priority value interface subcommand). + +■ If tied on priority, choose the router with highest RID. + +■ Choose a BDR, based on next-best priority, or if a tie, next-best (highest) RID. + +The preceding describes the election when no DR currently exists. However, the rules dif-fer a bit when a DR and BDR already exist. After a DR and BDR are elected, no election is held until either the DR or BDR fails. If the DR fails, the BDR becomes the DR—regard-less of whether a higher-priority router has joined the subnet—and a new election is held to choose a new BDR. If the BDR fails, a new election is held for the BDR, and the DR remains unchanged. + +On LANs, the choice of DR matters little from a design perspective, but it does matter from an operational perspective. Throughout this chapter, note the cases in which the output of show commands identifies the DR and its role. Now, back to the topic of Type 2 LSAs. + +Type 2 Network LSA Concepts + +OSPF uses the concept of a Type 2 LSA to model a multiaccess network—a network with more than two routers connected to the same subnet—while still conforming to the + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 313 + +“a link connects only two nodes” rule for the topology. For example, consider the net-work in Figure 8-3 (also shown as Figure 7-4 in the previous chapter). As seen in Chapter 7, “Fundamental OSPF Concepts,” all four routers form neighbor relationships inside area 0, with the DR and BDR becoming fully adjacent with the other routers. + +Area 0 + + + + + +10.1.1.1/24 Fa0/1 + +R1 10.5.5.1/28 Fa0/0 + +10.2.2.2/25 Fa0/1 + +R2 10.5.5.2/28 Fa0/0 + + + + + +10.5.5.3/28 Fa0/0 + +R3 10.3.3.3/26 Fa0/1 + + + +Area 3 + +10.5.5.4/28 Fa0/0 + +R4 10.4.4.4/27 Fa0/1 + + + +Area 4 + + +Figure 8-3 Small Network, Four Routers, on a LAN + +OSPF cannot represent the idea of four routers connected through a single subnet by using a link connected to all four routers. Instead, OSPF defines the Type 2 Network LSA, used as a pseudonode. Each router’s Type 1 Router LSA lists a connection to this pseudonode, often called a transit network, which is then modeled by a Type 2 Network LSA. The Type 2 Network LSA itself then lists references back to each Type 1 Router LSA connected to it—four in this example, as shown in Figure 8-4. + +The elected DR in a subnet creates the Type 2 LSA for that subnet. The DR identifies +the LSA by assigning an LSID of the DR’s interface IP address in that subnet. The Type 2 LSA also lists the DR’s RID as the router advertising the LSA. + +Type 2 LSA show Commands + +To see these concepts in the form of OSPF show commands, next consider area 34 back in Figure 8-1. This design shows that R3 and R4 connect to the same LAN, which means that a DR will be elected. (OSPF elects a DR on LANs when at least two routers pass the neighbor requirements and can become neighbors.) If both R3 and R4 default to use pri-ority 1, R4 wins the election, because of its 4.4.4.4 RID (versus R3’s 3.3.3.3 RID). So, R4 creates the Type 2 LSA for that subnet and floods the LSA. Figure 8-5 depicts the area 34 topology, and Example 8-4 shows the related LSDB entries. + + + +From the Library of Alexey Evseenko +314 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +R1 R2 Type 1 Type 1 + + + + + + +Type 2 10.5.5.0/28 + + +Pseudonode + + + + + + + +R3 Type 1 + + +Figure 8-4 + +R4 Type 1 + + +OSPF Topology When Using a Type 2 Network LSA + +R3 + + + +transit 10.10.34.4 3.3.3.3 Type 1 + +1.1.1.1 Type 1 + + +R1 + + + + + + +10.10.34.4 Type 2 + +to 3.3.3.3 Type 1 + +to 4.4.4.4 Type 1 + + + + + + +transit 10.10.34.4 + +4.4.4.4 Type 1 + +2.2.2.2 Type 1 + + +R2 + + + +R4 + +Figure 8-5 Area 34 Topology with Four Type 1 LSAs and One Type 2 LSA + + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 315 + +Example 8-4 Area 34 LSAs for R3, Network 10.10.34.0 /24 + +R3# show ip ospf database + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Router Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum Link count + +1.1.1.1 +2.2.2.2 +3.3.3.3 +4.4.4.4 + +1.1.1.1 +2.2.2.2 +3.3.3.3 +4.4.4.4 + +1061 0x80000002 0x00EA7A 4 +1067 0x80000001 0x0061D2 4 +1066 0x80000003 0x00E2E8 5 +1067 0x80000003 0x007D3F 5 + + +Net Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum +10.10.34.4 4.4.4.4 1104 0x80000001 0x00AB28 + +Summary Net Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum + +10.10.5.0 +10.10.5.0 + +1.1.1.1 +2.2.2.2 + +1023 0x80000001 0x000BF2 +1022 0x80000001 0x00EC0D + +! lines omitted for brevity +R3# show ip ospf database router 4.4.4.4 + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Router Link States (Area 34) + +LS age: 1078 +Options: (No TOS-capability, DC) +LS Type: Router Links +Link State ID: 4.4.4.4 +Advertising Router: 4.4.4.4 +LS Seq Number: 80000003 +Checksum: 0x7D3F +Length: 84 +Number of Links: 5 + +Link connected to: another Router (point-to-point) +(Link ID) Neighboring Router ID: 2.2.2.2 +(Link Data) Router Interface address: 10.10.24.4 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + + + + + +From the Library of Alexey Evseenko +316 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Link connected to: a Stub Network +(Link ID) Network/subnet number: 10.10.24.0 +(Link Data) Network Mask: 255.255.255.248 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: another Router (point-to-point) +(Link ID) Neighboring Router ID: 1.1.1.1 +(Link Data) Router Interface address: 10.10.14.4 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: a Stub Network +(Link ID) Network/subnet number: 10.10.14.0 +(Link Data) Network Mask: 255.255.255.248 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +Link connected to: a Transit Network +(Link ID) Designated Router address: 10.10.34.4 +(Link Data) Router Interface address: 10.10.34.4 +Number of TOS metrics: 0 +TOS 0 Metrics: 1 +R3# show ip ospf database network 10.10.34.4 + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Net Link States (Area 34) + +Routing Bit Set on this LSA +LS age: 1161 +Options: (No TOS-capability, DC) +LS Type: Network Links +Link State ID: 10.10.34.4 (address of Designated Router) +Advertising Router: 4.4.4.4 +LS Seq Number: 80000001 +Checksum: 0xAB28 +Length: 32 +Network Mask: /24 +Attached Router: 4.4.4.4 +Attached Router: 3.3.3.3 + +The show ip ospf database command lists a single line for each LSA. Note that the (high-lighted) heading for Network LSAs lists one entry, with LSID 10.10.34.4, which is R4’s Fa0/0 IP address. The LSID for Type 2 Network LSAs is the interface IP address of the DR that creates the LSA. + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 317 + +The show ip ospf database router 4.4.4.4 command shows the new style of entry for the reference to a transit network, which again refers to a connection to a Type 2 LSA. The output lists an LSID of 10.10.34.4, which again is the LSID of the Type 2 LSA. + +Finally, the show ip ospf database network 10.10.34.4 command shows the details of the Type 2 LSA, based on its LSID of 10.10.34.4. Near the bottom, the output lists the attached routers, based on RID. The SPF process can then use the cross-referenced information, as shown in Figure 8-5, to determine which routers connect to this transit network (pseudonode). The SPF process has information in both the Type 1 LSAs that +refer to the transit network link to a Type 2 LSA, and the Type 2 LSA has a list of RIDs of Type 1 LSAs that connect to the Type 2 LSA, making the process of modeling the network possible. + +OSPF can model all the topology inside a single area using Type 1 and 2 LSAs. When a router uses its SPF process to build a model of the topology, it can then calculate the best (lowest-cost) route for each subnet in the area. The next topic completes the LSA picture for internal OSPF routes by looking at Type 3 LSAs, which are used to model interarea routes. + +LSA Type 3: Summary LSA + +OSPF areas exist in part so that engineers can reduce the consumption of memory and compute resources in routers. Instead of having all routers, regardless of area, know all Type 1 and Type 2 LSAs inside an OSPF domain, ABRs do not forward Type 1 and Type 2 LSAs from one area into another area, and vice versa. This convention results in smaller per-area LSDBs, saving memory and reducing complexity for each run of the SPF algo-rithm, which saves CPU resources and improves convergence time. + +However, even though ABRs do not flood Type 1 and Type 2 LSAs into other areas, rout-ers still need to learn about subnets in other areas. OSPF advertises these interarea routes using the Type 3 Summary LSA. ABRs generate a Type 3 LSA for each subnet in one area, and advertise each Type 3 LSA into the other areas. + +For example, if subnet A exists in area 3, the routers in area 3 learn of that subnet as part of Type 1 and Type 2 LSAs. However, an ABR connected to area 3 will not forward the Type 1 and Type 2 LSAs into other areas, instead creating a Type 3 LSA for each subnet (including subnet A). The routers inside the other areas can then calculate a route for the subnets (like subnet A) that exist inside another area. + +Type 3 Summary LSAs do not contain all the detailed topology information, so in comparison to Types 1 and 2, these LSAs summarize the information—hence the name Summary LSA. Conceptually, a Type 3 LSA appears to be another subnet connected to the ABR that created and advertised the Type 3 LSA. The routers inside that area can cal-culate their best route to reach the ABR, which gives the router a good loop-free route to reach the subnet listed in a Type 3 LSA. + +An example can certainly help in this case. First, consider the comparison shown in the top and bottom of Figure 8-6. The top depicts the topology shown back in Figure 8-1 if that design had used a single area. In that case, every router would have a copy of each + + + + +From the Library of Alexey Evseenko +318 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Type 1 LSA (shown as a router name in the figure) and each Type 2 LSA (abbreviated as T2 in the figure). The bottom of Figure 8-6 shows the area 5 topology, when holding to the three-area design shown in Figure 8-1. + +SW1 + +T2 R3 R1 + +T2 + +T2 T2 T2 T2 + +T2 + + +R4 R2 T2 +SW2 + + + +R5 + +Type 3 LSAs +R1 + +R5 + +R2 + +Figure 8-6 Comparing a Single-Area LSDB to a Three-Area LSDB + +The ABR creates and floods each Type 3 LSA into the next area. The ABR assigns an LSID of the subnet address being advertised. It also adds its own RID to the LSA as well, so that routers know which ABR advertised the route. It also includes the subnet +mask. The correlation between the advertising router’s RID and the LSID (subnet address) allows the OSPF processes to create the part of the topology as shown with Type 3 LSAs at the bottom of Figure 8-6. + +Example 8-5 focuses on the Type 3 LSAs in area 34 of the network shown in Figure 8-1. Ten subnets exist outside area 34. As ABRs, both R1 and R2 create and flood a Type 3 LSA for each of these ten subnets, resulting in 20 Type 3 LSAs listed in the output of the show ip ospf database command inside area 34. Then, the example focuses specifically on the Type 3 LSA for subnet 10.10.99.0/24. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 319 + +Example 8-5 Type 3 LSAs in Area 34 + +R3# show ip ospf database + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Router Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum Link count + +1.1.1.1 +2.2.2.2 +3.3.3.3 +4.4.4.4 + +1.1.1.1 943 +2.2.2.2 991 +3.3.3.3 966 +4.4.4.4 977 + +0x80000003 0x00E87B 4 +0x80000002 0x005FD3 4 +0x80000004 0x00E0E9 5 +0x80000004 0x007B40 5 + + +Net Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum +10.10.34.4 4.4.4.4 977 0x80000002 0x00A929 + +Summary Net Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum +10.10.5.0 1.1.1.1 943 0x80000002 0x0009F3 + +10.10.5.0 +10.10.12.0 +10.10.12.0 +10.10.15.0 +10.10.15.0 +10.10.17.0 +10.10.17.0 +10.10.18.0 +10.10.18.0 +10.10.25.0 +10.10.25.0 +10.10.27.0 +10.10.27.0 +10.10.28.0 +10.10.28.0 +10.10.98.0 +10.10.98.0 +10.10.99.0 +10.10.99.0 + +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 +1.1.1.1 +2.2.2.2 + +991 0x80000002 0x00EA0E +943 0x80000002 0x00F323 +991 0x80000002 0x00D53D +943 0x80000002 0x0021BA +993 0x80000003 0x008313 +946 0x80000002 0x00BC55 +993 0x80000002 0x00A864 +946 0x80000002 0x00B15F +994 0x80000002 0x009D6E +946 0x80000002 0x00355C +993 0x80000002 0x009439 +946 0x80000002 0x0058AE +993 0x80000002 0x0030D3 +947 0x80000002 0x004DB8 +993 0x80000002 0x0025DD +946 0x80000002 0x004877 +993 0x80000002 0x002A91 +946 0x80000002 0x003D81 +993 0x80000002 0x001F9B + + +R3# show ip ospf database summary 10.10.99.0 + + + + + + + +From the Library of Alexey Evseenko +320 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Summary Net Link States (Area 34) + +Routing Bit Set on this LSA +LS age: 1062 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 10.10.99.0 (summary Network Number) +Advertising Router: 1.1.1.1 +LS Seq Number: 80000002 +Checksum: 0x3D81 +Length: 28 +Network Mask: /24 +TOS: 0 Metric: 2 + +Routing Bit Set on this LSA +LS age: 1109 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 10.10.99.0 (summary Network Number) +Advertising Router: 2.2.2.2 +LS Seq Number: 80000002 +Checksum: 0x1F9B +Length: 28 +Network Mask: /24 +TOS: 0 Metric: 2 + + +Note The Type 3 Summary LSA is not used for the purpose of route summarization. OSPF does support route summarization, and Type 3 LSAs might indeed advertise such a summary, but the Type 3 LSA does not inherently represent a summary route. The term Summary reflects the idea that the information is sparse compared to the detail inside Type 1 and Type 2 LSAs. + + +The upcoming section “Calculating the Cost of Interarea Routes” discusses how a router determines the available routes to reach subnets listed in a Type 3 LSA and how a router chooses which route is best. + +Limiting the Number of LSAs + +By default, Cisco IOS does not limit the number of LSAs that a router can learn. However, it might be useful to protect a router from learning too many LSAs to protect router memory. Also, with a large number of LSAs, the router might be unable to process the LSDB with SPF well enough to converge in a reasonable amount of time. + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 321 + +The maximum number of LSAs learned from other routers can be limited by a router using the max-lsa number OSPF subcommand. When configured, if the router learns more than the configured number of LSAs from other routers (ignoring those created by the router itself), the router reacts. The first reaction is to issue log messages. The router ignores the event for a time period, after which the router repeats the warning message. This ignore-and-wait strategy can proceed through several iterations, ending when the router closes all neighborships, discards its LSDB, and then starts adding neighbors again. (The ignore time, and the number of times to ignore the event, can be configured with the max-lsa command.) + +Summary of Internal LSA Types + +OSPF uses Type 1, 2, and 3 LSAs to calculate the best routes for all routes inside an OSPF routing domain. In a later chapter, we will explore Types 4, 5, and 7, which OSPF uses to calculate routes for external routes—routes redistributed into OSPF. + +Table 8-3 summarizes some of the key points regarding OSPF Type 1, 2, and 3 LSAs. In particular for the ROUTE exam, the ability to sift through the output of various show ip ospf database commands can be important. Knowing what the OSPF LSID represents can help you interpret the output, and knowing the keywords used with the show ip ospf database lsa-type lsid commands can also be very useful. Table 8-3 summarizes these details. + + +Table 8-3 Facts About LSA Types 1, 2, and 3 +Key +Topic LSA Type LSA Type This Type Display Using show (Number) (Name) Represents ip ospf database +keyword... + + + +LSID Is Created by Equal to + + + +1 Router + +2 Network + + +3 Summary + +A router + +A subnet in which a DR exists +A subnet in another area + + +router + +network + + +summary + +RID of router +DR’s IP address in the subnet +Subnet number + +Each router creates its own +The DR in that subnet + +An ABR + + + + +The Database Exchange Process + +Every router in an area, when OSPF stabilizes after topology changes occur, should have an identical LSDB for that area. Internal routers (routers inside a single area) have only that area’s LSAs, but an ABR’s LSDB will contain LSAs for each area to which it connects. The ABR does, however, know which LSAs exist in each area. + +OSPF routers flood both the LSAs they create, and the LSAs they learn from their neigh-bors, until all routers in the area have a copy of each of the most recent LSAs for that + + + + +From the Library of Alexey Evseenko +322 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +area. To manage and control this process, OSPF defines several messages, processes, and neighbor states that indicate the progress when flooding LSAs to each neighbor. This sec-tion begins by listing reference information for the OSPF messages and neighbor states. Next, the text describes the flooding process between two neighbors when a DR does not exist, followed by a description of the similar process used when a DR does exist. This section ends with a few items related to how routers avoid looping the LSA adver-tisements and how they periodically reflood the information. + +OSPF Message and Neighbor State Reference + +For reference, Table 8-4 lists the OSPF message types that will be mentioned in the next few pages. Additionally, Table 8-5 lists the various neighbor states. Although useful for study, when you are first learning this topic, feel free to skip these tables for now. + +Key Table 8-4 OSPF Message Types and Functions Topic Message Name/Number Description + + +Hello + + + + +Database Description (DD or DBD) + + +Link-State Request (LSR) + + +Link-State Update (LSU) + +Link-State Acknowledgment (LSAck) + +Used to discover neighbors and supply information used to confirm that two routers should be allowed to become neighbors, to bring a neighbor relationship to a 2-Way state, and to monitor a neighbor’s responsiveness in case it fails +Used to exchange brief versions of each LSA, typically on initial topology exchange, so that a router knows a list of that neighbor’s known LSAs +A packet that lists the LSIDs of LSAs that the sender of the LSR would like the receiver of the LSR to supply during database exchange +A packet that contains fully detailed LSAs, typically sent in response to an LSR message +Sent to confirm receipt of an LSU message + + + + +Table 8-5 OSPF Neighbor State Reference Key +Topic State Meaning + + +Down + +Attempt + +Init + +No Hellos have been received from this neighbor for more than the Dead interval. +Used when the neighbor is defined with the neighbor command, after sending a Hello, but before receiving a Hello from that neighbor. +A Hello has been received from the neighbor, but it did not have the local router’s RID in it or list parameters that do not pass the neighbor verification checks. This is a permanent state when Hello parameters do not match. + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 323 + + + +State 2-Way + +ExStart + +Exchange + +Loading + +Full + +Meaning +A Hello has been received from the neighbor; it has the router’s RID in it, and all neighbor verification checks passed. +Currently negotiating the DD sequence numbers and master/slave logic used for DD packets. +Finished negotiating the DD process particulars, and currently exchanging DD packets. +All DD packets are exchanged, and the routers are currently sending LSR, LSU, and LSAck packets to exchange full LSAs. +Neighbors are fully adjacent, meaning that they believe that their LSDBs for that area are identical. Routing table (re)calculations can begin. + + + + +Exchange Without a Designated Router + +As discussed in Chapter 7, an OSPF interface’s network type tells a router whether to attempt to elect a DR on that interface. The most common case for which routers do not elect a DR occur on point-to-point topologies, such as true point-to-point serial links and point-to-point subinterfaces. This section examines the database exchange process on such interfaces, in preparation for the slightly more complex process when using a DR on an OSPF broadcast network type, like a LAN. + +Each OSPF neighborship begins by exchanging Hellos until the neighbors (hopefully) reach the 2-Way state. During these early stages, the routers discover each other by send-ing multicast Hellos and then check each other’s parameters to make sure that all required items match (as listed in Chapter 7 ’s Table 7-5). Figure 8-7 shows the details, with the various neighbor states listed on the outside of the figure and the messages listed in the middle. + + +Neighbor State Down + +RID 1.1.1.1 + +Neighbor State Down + +(R1 to R2 link comes up...) RID 2.2.2.2 + +Init Init +R1 Hello, Seen [null], RID 1.1.1.1 R2 +Hello, Seen [1.1.1.1], RID 2.2.2.2 +2-Way +Hello, Seen [1.1.1.1, 2.2.2.2], RID 1.1.1.1 +2-Way + +Figure 8-7 Neighbor Initialization—Early Stages + +Figure 8-7 shows an example that begins with a failed neighborship, so the neighborship is in a down state. When a router tries to reestablish the neighborship, each router sends a multicast Hello and moves to an INIT state. After a router has both received a Hello and +verified that all the required parameters agree, the router lists the other router’s RID in the + + + + +From the Library of Alexey Evseenko +324 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Hello as being seen, as shown in the bottom two Hello messages in the figure. When a router receives a Hello that lists its own RID as having been seen by the other router, the router can transition to the 2-Way state. + +When a router has reached the 2-Way state with a neighbor, as shown at the bottom of Figure 8-7, the router then decides whether it should exchange its LSDB entries. When no DR exists, the answer is always “yes.” Each router next follows this general process: +Step 1. Discover the LSAs known to the neighbor but unknown to me. + +Step 2. Discover the LSAs known by both routers, but the neighbor’s LSA is more up to date. + +Step 3. Ask the neighbor for a copy of all the LSAs identified in the first two steps. + +Figure 8-8 details the messages and neighbor states used to exchange the LSAs between two neighbors. As with Figure 8-7, Figure 8-8 shows neighbor states on the outer edges of the flows (refer to Table 8-5 for reference). Routers display these neighbor states (with variants of the show ip ospf neighbor command), so a particular state can be useful in determining how far two neighbors have gotten in the database exchange process. The more important neighbor states will be mentioned throughout the chapter. + + +RID 1.1.1.1 + +R1 + +RID 2.2.2.2 + +R2 + + + +ExStart +DD (LSA Headers) + +DD (LSA Headers) ExStart + + +Exchange + + + +Loading + +Full + + +DD (LSA Headers) + + +LSR, LSU, LSAck (Full LSAs) + + +Exchange + + +Loading + +Full + + +Figure 8-8 Overview of the Database Exchange Process Between Two Neighbors + +The inner portions of Figure 8-8 represent the OSPF message flows, with Table 8-2, ear-lier in the chapter, listing the messages for reference. The next several pages examine the process shown in Figure 8-8 in more detail. + +Discovering a Description of the Neighbor’s LSDB + +After a router has decided to move forward from a 2-Way state and exchange its LSDB with a neighbor, the routers use the sequence shown in Figure 8-8. The next step in that process requires both routers to tell each other the LSIDs of all their known LSAs in that area. The primary goal is for each neighbor to realize which LSAs it does not know, so it + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 325 + +can then ask for those full LSAs to be sent. To learn the list of LSAs known by a neigh-bor, the neighboring routers follow these steps: +Step 1. Multicast database description packets (abbreviated as both DD and DBD, depending on the reference) to 224.0.0.5, which is the all-SPF-routers multicast address. +Step 2. When sending the first DD message, transition to the ExStart state until one router, the one with the higher RID, becomes the master in a master/slave relationship. +Step 3. After electing a master, transition the neighbor to the Exchange state. + +Step 4. Continue multicasting DD messages to each other until both routers have the same shared view of the LSIDs known collectively by both routers, in that area. + +Note that the DD messages themselves do not list the entire LSAs, but rather just the LSA headers. These headers include the LSIDs of the LSAs and the LSA sequence num-ber. The LS sequence number for an LSA begins at value 0x80000001 (hex) when initially created. The router creating the LSA increments the sequence number, and refloods the LSA, whenever the LSA changes. For example, if an interface moves from the up to down state, that router changes its Type 1 LSA to list that interface state as down, increments the LSA sequence number, and refloods the LSA. + +The master router for each exchange controls the flow of DD messages, with the slave responding to the master’s DD messages. The master keeps sending DD messages until it lists all its known LSIDs in that area. The slave responds by placing LSA headers in its DD messages. Some of those LSA headers simply repeat what the slave heard from the master, for the purpose of acknowledging to the master that the slave learned that LSA header from the master. Additionally, the slave includes the LSA headers for any LSAs that the master did not list. + +This exchange of DD messages ends with each router knowing a list of LSAs that it does not have in its LSDB, but the other router does have those LSAs. Additionally, each router also ends this process with a list of LSAs that the local router already knows, but for which the other router has a more recent copy (based on sequence numbers). + +Exchanging the LSAs + +When the two neighbors realize that they have a shared view of the list of LSIDs, they transition to the Loading state and start exchanging the full LSAs—but only those that they do not yet know about or those that have changed. + +For example, when the two routers in Figure 8-8 first become neighbors, neither router will have a copy of the Type 1 LSA for the other router. So, R1 will request that R2 send its LSA with LSID 2.2.2.2. R2 will send its Type 1 LSA, and R1 will acknowledge receipt. The mechanics work like this: +Step 1. Transition the neighbor state to Loading. + +Step 2. For any missing LSAs, send a Link-State Request (LSR) message, listing the LSID of the requested LSA. + + + +From the Library of Alexey Evseenko +326 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 3. Respond to any LSR messages with a Link-State Update (LSU), listing one or more LSAs in each message. + +Step 4. Acknowledge receipt by either sending a Link-State Acknowledgment (LSAck) message (called explicit acknowledgment) or by sending the same LSA that was received back to the other router in an LSU message (implicit acknowl-edgment). +Step 5. When all LSAs have been sent, received, and acknowledged, transition the neighborship to the FULL state (fully adjacent). + + +Note Because this section examines the case without a DR, all these messages flow as multicasts to 224.0.0.5, the all SPF routers multicast address, unless the neighbors have been defined with an OSPF neighbor command. + + +By the end of this process, both routers should have an identical LSDB for the area to which the link has been assigned. At that point, the two routers can run the SPF algo-rithm to choose the currently best routes for each subnet. + +Exchange with a Designated Router + +Database exchange with a DR differs slightly than database exchange when no DR exists. The majority of the process is similar, with the same messages, meanings, and neighbor states. The big difference is the overriding choice of with whom each router chooses to perform database exchange. + +Non-DR routers do not exchange their databases directly with all neighbors on a subnet. Instead, they exchange their database with the DR. Then, the DR exchanges any new/ changed LSAs with the rest of the OSPF routers in the subnet. + +The concept actually follows along with the idea of a Type 2 LSA as seen earlier in Figure 8-4. Figure 8-9 represents four Type 1 LSAs, for four real routers on the same LAN, plus a single Type 2 LSA that represents the multiaccess subnet. The DR created the Type 2 LSA as part of its role in life. + +Figure 8-9 shows two conceptual steps for database exchange. The non-DR router (R3) first exchanges its database with the pseudonode, and then the Type 2 pseudonode exchanges its database with the other routers. However, the pseudonode is a concept, not a router. To make the process depicted in Figure 8-9 work, the DR takes on the role of the Type 2 pseudonode. The messages differ slightly as well, as follows: + + +Key ■ Topic + + +■ + +The non-DR performs database exchange with the same messages, as shown in Figure 8-9, but sends these messages to the 224.0.0.6 all-DR-routers multicast address. + +The DR performs database exchange with the same messages but sends the messages +to the 224.0.0.5 all-SPF-routers multicast address. + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 327 + + + + +R1 Type 1 + + + + + + +1 +to 224.0.0.6 (All DR) + + + +2 +to 224.0.0.5 (All SPF) +2 + + +Type 2 10.5.5.0/28 + +R2 Type 1 + + + + + + +2 +to 224.0.0.5 (All SPF) + + + + + + +R3 Type 1 + + +Figure 8-9 + +R4 Type 1 + + +Conceptual View—Exchanging the Database with a Pseudonode + + +Consider these two conventions one at a time. First, the messages sent to 224.0.0.6 are processed by the DR and the BDR only. The DR actively participates, replying to the messages, with the BDR acting as a silent bystander. In effect, this allows the non-DR router to exchange its database directly with the DR and BDR, but with none of the other routers in the subnet. + +Next, consider the multicast messages from the DR to the 224.0.0.5 all-SPF-router mul-ticast address. All OSPF routers process these messages, so the rest of the routers—the DROthers to use the Cisco IOS term—also learn the newly exchanged LSAs. This pro-cess completes the second step shown in the conceptual Figure 8-9, where the DR, acting like the pseudonode, floods the LSAs to the other OSPF routers in the subnet. + +The process occurs in the background and can be generally ignored. However, for operat-ing an OSPF network, an important distinction must be made. With a DR in existence, a DROther router performs the database exchange process (as seen in Figure 8-9) with the DR/BDR only and not any other DROther routers in the subnet. For example, in Figure +8-9, R1 acts as DR, R2 acts as BDR, and R3/R4 act as DROther routers. Because the underlying process does not make R3 and R4 perform database exchange with each other, the routers do not reach the FULL neighbor state, remaining in a 2-Way state. + +Example 8-6 shows the resulting output for the LAN shown in Figure 8-9, with four routers. The output, taken from DROther R3, shows a 2-Way state with R4, the other DROther. It also shows on interface Fa0/0 that its own priority is 2. This output also shows a neighbor count (all neighbors) of 3 and an adjacent neighbor count (all fully adja-cent neighbors) of 2, again because the neighborship between DROthers R3 and R4 is not a full adjacency. + + + + + +From the Library of Alexey Evseenko +328 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 8-6 Demonstrating OSPF FULL and 2-Way Adjacencies + +R3# show ip ospf interface fa0/0 +FastEthernet0/0 is up, line protocol is up +Internet Address 172.16.1.3/24, Area 0 +Process ID 75, Router ID 3.3.3.3 , Network Type BROADCAST, Cost: 1 +Transmit Delay is 1 sec, State DROTHER, Priority 2 +Designated Router (ID) 1.1.1.1, Interface address 172.16.1.1 +Backup Designated router (ID) 2.2.2.2, Interface address 172.16.1.2 +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:02 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 1/1, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 0, maximum is 4 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 3, Adjacent neighbor count is 2 + +Adjacent with neighbor 1.1.1.1 +Adjacent with neighbor 2.2.2.2 +Suppress hello for 0 neighbor(s) + +(Designated Router) +(Backup Designated Router) + + +R3# show ip ospf neighbor fa0/0 + + +Neighbor ID +1.1.1.1 +2.2.2.2 +44.44.44.44 + +Pri State +4 FULL/DR +3 FULL/BDR +1 2WAY/DROTHER + +Dead Time +00:00:37 +00:00:37 +00:00:36 + +Address +172.16.1.1 +172.16.1.2 +172.16.1.4 + +Interface +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + + + +Flooding Throughout the Area + +So far in this section, the database exchange process has focused on exchanging the database between neighbors. However, LSAs need to be flooded throughout an area. To do so, when a router learns new LSAs from one neighbor, that router then knows that its other neighbors in that same area might not know of that LSA. Similarly, when an LSA changes—for example, when an interface changes state—a router might learn the same old LSA but with a new sequence number, and again need to flood the changed LSA to other neighbors in that area. + +Figure 8-10 shows a basic example of the process. In this case, R2, R3, and R4 have estab-lished neighbor relationships, with four LSAs in their LSDB in this area. R1 is again the new router added to the internetwork. + + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 329 + + + + +LSDB - Before R2 Type 1 +Area 1 R3 Type 1 R4 Type 1 Subnet 1 Type 2 + + +R3 + + +R1 R2 + + +R4 + + + + + +Figure 8-10 Flooding Throughout an Area + +First, consider what happens as the new R1-R2 neighborship comes up and goes through database exchange. When R1 loads and the link comes up, R1 and R2 reach a full state and have a shared view of the area 1 LSDB. R2 has learned all R1’s new LSAs (should only be R1’s Type 1 Router LSA), and R1 has learned all the area 1 LSAs known to R2, includ-ing the Type 1 LSAs for R3 and R4. + +Next, think about the LSDBs of R3 and R4 at this point. The database exchange between R1-R2 did not inform R3 or R4 about any of the new LSAs known by R1. So, R2, when it learns of R1’s Type 1 LSA, sends DD packets to the DR on the R2/R3/R4 LAN. LSR/LSU packets follow, resulting in R3 and R4 learning about the new LSA for R1. If more routers existed in area 1, the flooding process would continue throughout the entire area, until all routers know of the best (highest sequence number) copy of each LSA. + +The flooding process prevents the looping of LSAs as a side effect of the database exchange process. Neighbors use DD messages to learn the LSA headers known by the neighbor, and then only request the LSAs known by the neighbor but not known by the local router. By requesting only unknown LSAs or new versions of old LSAs, routers pre-vent the LSA advertisements from looping. + +Periodic Flooding + +Although OSPF does not send routing updates on a periodic interval, as do distance vec-tor protocols, OSPF does reflood each LSA every 30 minutes based on each LSA’s age variable. The router that creates the LSA sets this age to 0 (seconds). Each router then + + + + +From the Library of Alexey Evseenko +330 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +increments the age of its copy of each LSA over time. If 30 minutes pass with no changes to an LSA—meaning that no other reason existed in that 30 minutes to cause a reflood-ing of the LSA—the owning router increments the sequence number, resets the timer to 0, and refloods the LSA. + +Because the owning router increments the sequence number and resets the LSAge every 1800 seconds (30 minutes), the output of various show ip ospf database com-mands should also show an age of less than 1800 seconds. For example, referring back to Example 8-5, the Type 1 LSA for R1 (RID 1.1.1.1) shows an age of 943 seconds and a sequence number of 0x80000003. Over time, the sequence number should increment once every 30 minutes, with the LSAge cycle upward toward 1800 and then back to 0 when the LSA is reflooded. + +Note also that when a router realizes it needs to flush an LSA from the LSDB for an area, it actually sets the age of the LSA to the MaxAge setting (3600) and refloods the LSA. All the other routers receive the LSA, see that the age is already at the maximum, and cause those routers to also remove the LSA from their LSDBs. + +Choosing the Best OSPF Routes + +All this effort to define LSA types, create areas, and fully flood the LSAs has one goal in mind: to allow all routers in that area to calculate the best, loop-free routes for all known subnets. Although the database exchange process might seem laborious, the process by which SPF calculates the best routes requires a little less thought, at least to the level required for the CCNP ROUTE exam. In fact, the choice of the best route for a given subnet, and calculated by a particular router, can be summarized as follows: + +■ Analyze the LSDB to find all possible routes to reach the subnet. Key +Topic ■ For each possible route, add the OSPF interface cost for all outgoing interfaces in +that route. + +■ Pick the route with the lowest total cost. + +For humans, if you build a network diagram and note the OSPF cost for each interface (as shown with show ip ospf interface), you can easily add up the costs for each router’s possible routes to each subnet and tell which route OSPF will choose. The routers must +use a more complex SPF algorithm to derive a mathematical model of the topology based on the LSAs. This section examines both the simpler human view of metric calculation and folds in some of the basics of what SPF must do on a router to calculate the best routes. It also goes through the options for tuning the metric calculation to influence the choice of routes. + +OSPF Metric Calculation for Internal OSPF Routes + +The process of calculating the cost from a router to each subnet might be intuitive to most people. However, spending a few minutes considering the details is worthwhile, in part to link the concepts with the LSAs, and to be better prepared for questions on the + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 331 + +ROUTE exam. This section breaks the discussion into four sections: intra-area routes, interarea routes, a short discussion about cases when both intra-area and interarea routes exist for the same subnet, and an explanation of SPF calculations. + +Calculating the Cost of Intra-Area Routes + +When a router analyzes the LSDB to calculate the best route to each subnet, it does the following: + +Step 1. +Key Topic +Step 2. + + +Step 3. + + +Finds all subnets inside the area, based on the stub interfaces listed in the Type 1 LSAs and based on any Type 2 Network LSAs + +Runs SPF to find all possible paths through the area’s topology, from itself to each subnet + +Calculates the OSPF interface costs for all outgoing interfaces in each route, +picking the lowest-total-cost route for each subnet as the best route + + +For example, Figure 8-11 shows the routers and links inside area 34, as a subset of the internetwork also shown in Figure 8-1. Figure 8-11 shows the interface numbers and OSPF costs. + + + +Fa0/0 Cost 10 .3 + +13.3 +S0/0/0.1 Cost 647 +R3 + + +Cost 647 S0/0/0.3 +R1 + + + +Subnet 10.10.34.0/24 +S0/0/0.2 Cost 647 +14.4 +Cost 647 S0/0/0.3 +S0/0/0.1 Cost 647 Cost 647 S0/0/0.4 + + + + +Fa0/0 Cost 10 .4 + + +R4 S0/0/0.2 Cost 647 Cost 647 S0/0/0.4 R2 + + +Figure 8-11 Area 34 Portion of Figure 8-1 + +Following the basic three-step process, at Step 1, R1 can determine that subnet 10.10.34.0/24 exists in area 34 because of the Type 2 LSA created by the DR in that sub-net. For Step 2, R1 can then run SPF and determine four possible routes, two of which are clearly more reasonable to humans: R1-R3 and R1-R4. (The two other possible routes, R1-R3-R2-R4 and R1-R4-R2-R3, are possible and would be considered by OSPF but would clearly be higher cost.) For Step 3, R1 does the simple math of adding the costs of the outgoing interfaces in each route, as follows: + +■ R1-R3: Add R1’s S0/0/0.3 cost (647) and R3’s Fa0/0 cost (10), total 657 + +■ R1-R4: Add R1’s S0/0/0.4 cost (647) and R4’s Fa0/0 cost (10), total 657 + +The metrics tie, so with a default setting of maximum-paths 4, R1 adds both routes to its routing table. Specifically, the routes list the metric of 657 and the next-hop IP address + + + + +From the Library of Alexey Evseenko +332 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +on the other end of the respective links: 10.10.13.3 (R3’s S0/0/0.1) and 10.10.14.4 (R4’s S0/0/0.1). + +Note that OSPF supports equal-cost load balancing, but it does not support unequal-cost load balancing. The maximum-paths OSPF subcommand can be set as low as 1, with the maximum being dependent on router platform and Cisco IOS version. Modern Cisco IOS versions typically support 16 or 32 concurrent routes to one destination (maximum). + +Calculating the Cost of Interarea Routes + +From a human perspective, the cost for interarea routes can be calculated just like for intra-area routes if we have the full network diagram, subnet addresses, and OSPF inter-face costs. To do so, just find all possible routes from a router to the destination subnet, add up the costs of the outgoing interfaces, and choose the router with the lowest total cost. + +However, OSPF routers cannot do the equivalent for interarea routes, because routers internal to one area do not have topological data—LSA Types 1 and 2—for other areas. Instead, ABRs create and flood Type 3 Summary LSAs into an area, listing the subnet address and mask, but not listing details about routers and links in the other areas. For example, Figure 8-12 shows both areas 34 and 0 from Figure 8-1, including interface costs. Then consider how OSPF determines the lowest-cost route from Router R3 for sub-net 10.10.99.0/24, the data center subnet on the right. + +Area 34 Area 0 + + + + +Fa0/0 10.10.34.3/24 + + + +Fa0/0 10.10.34.4/24 + + +S0/0/0.1 13.3 +R3 +S0/0/0.2 23.3 + +S0/0/0.1 14.4 +R4 +S0/0/0.2 +24.4 + + +Fa0/0 17.1 +R1 Fa0/1 +Fa0/0.1 18.1 +12.1 + +SW1 Fa0/1 +17.7 + +Fa0/2 Gi0/1 27.2 98.7 + + +Data SW3 Center + + + + + +Fa0/0.1 12.2 +Fa0/0 27.2 + + + +18.8 Gi0/1 Fa0/1 98.8 + +Subnet 10.10.99.0/24 + + + +R2 + +Fa0/1 Fa0/2 28.2 28.8 +SW2 + + + +Figure 8-12 Area 34 and Area 0 Portion of Figure 8-1 + +R3 has a large number of possible routes to reach subnet 10.10.99.0/24. For example, just to get from R3 to R1, there are several possibilities: R3-R1, R3-R4-R1, and R3-R2-R1. From R1 the rest of the way to subnet 10.10.99.0/24, many more possibilities exist. The SPF algorithm has to calculate all possible routes inside an area to the ABR, so with more + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 333 + +redundancy, SPF’s run time goes up. And SPF has to consider all the options, whereas we humans can rule out some routes quickly, because they appear to be somewhat ridiculous. + +Because of the area design, with R1 and R2 acting as ABRs, R3 does not process all the topology shown in Figure 8-12. Instead, R3 relies on the Type 3 Summary LSAs created by the ABRs, which have the following information: + +■ The subnet number/mask represented by the LSA + +■ The cost of the ABR’s lowest-cost route to reach the subnet + +■ The RID of the ABR + +Example 8-7 begins to examine the information that R3 will use to calculate its best route for subnet 10.10.99.0/24, on the right side of Figure 8-12. To see these details, Example 8-7 lists several commands taken from R1. It lists R1’s best route (actually two that tie) for subnet 10.10.99.0/24, with cost 11. It also lists the Type 3 LSA R1 generated by R1 for 10.10.99.0/24, again listing cost 11, and listing the Type 3 LSA created by ABR R2 and flooded into area 34. + +Example 8-7 Route and Type 3 LSA on R1 for 10.10.99.0/24 + +R1# show ip route ospf +10.0.0.0/8 is variably subnetted, 15 subnets, 3 masks +O 10.10.5.0/27 [110/648] via 10.10.15.5, 00:04:19, Serial0/0/0.5 +O 10.10.23.0/29 [110/711] via 10.10.13.3, 00:04:19, Serial0/0/0.3 +O 10.10.24.0/29 [110/711] via 10.10.14.4, 00:04:19, Serial0/0/0.4 +O 10.10.25.0/29 [110/711] via 10.10.15.5, 00:04:19, Serial0/0/0.5 +O 10.10.27.0/24 [110/11] via 10.10.17.7, 00:04:19, FastEthernet0/0 +[110/11] via 10.10.12.2, 00:04:19, FastEthernet0/0.1 +O 10.10.28.0/24 [110/11] via 10.10.18.8, 00:04:19, FastEthernet0/1 +[110/11] via 10.10.12.2, 00:04:19, FastEthernet0/0.1 +O 10.10.34.0/24 [110/648] via 10.10.14.4, 00:04:19, Serial0/0/0.4 +[110/648] via 10.10.13.3, 00:04:19, Serial0/0/0.3 +O 10.10.98.0/24 [110/11] via 10.10.18.8, 00:04:19, FastEthernet0/1 +[110/11] via 10.10.17.7, 00:04:19, FastEthernet0/0 +O 10.10.99.0/24 [110/11] via 10.10.18.8, 00:04:19, FastEthernet0/1 +[110/11] via 10.10.17.7, 00:04:19, FastEthernet0/0 + +R1# show ip ospf database summary 10.10.99.0 + +OSPF Router with ID (1.1.1.1) (Process ID 1) + +! omitting output for area 5... +Summary Net Link States (Area 34) + +LS age: 216 +Options: (No TOS-capability, DC, Upward) + + + + +From the Library of Alexey Evseenko +334 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +LS Type: Summary Links(Network) +Link State ID: 10.10.99.0 (summary Network Number) +Advertising Router: 1.1.1.1 +LS Seq Number: 80000003 +Checksum: 0x951F +Length: 28 +Network Mask: /24 +TOS: 0 Metric: 11 + + +LS age: 87 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 10.10.99.0 (summary Network Number) +Advertising Router: 2.2.2.2 +LS Seq Number: 80000002 +Checksum: 0x7938 +Length: 28 +Network Mask: /24 +TOS: 0 Metric: 11 + + +Note The examples use default bandwidth settings, but with all routers configured with the auto-cost reference-bandwidth 1000 command. This command is explained in the upcoming section “Changing the Reference Bandwidth.” + + +For routers in one area to calculate the cost of an interarea route, the process is simple when you realize that the Type 3 LSA lists the ABR’s best cost to reach that interarea sub-net. To calculate the cost + +Step 1. +Key Topic +Step 2. + + +Calculate the intra-area cost from that router to the ABR listed in the Type 3 LSA. + +Add the cost value listed in the Type 3 LSA. (This cost represents the cost +from the ABR to the destination subnet.) + + +A router applies these two steps for each possible route to reach the ABR. Following the example of Router R3 and subnet 10.10.99.0/24, Figure 8-13 shows the components of the calculation. + +Figure 8-13 shows the calculation of both routes, with the intra-area cost to reach R1 either 647 or 657 in this case. For both routes, the cost listed in the Type 3 LSA sourced by R1, cost 11, is added. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 335 + +Best Route +647 + 11 = 658 + + +Cost 10 Cost 647 +R3 + +Cost 11 T3 +R1 10.10.99.0/24 + + +10 + 647 + 11 = 668 + + + + + +R4 +Cost 647 + + +Figure 8-13 R3’s Calculation of Cost for 10.10.99.0/24 + +When more than one ABR exists, as is the case as shown in Figure 8-12, each ABR should have created a Type 3 LSA for the subnet. In fact, the output in Example 8-7 showed +the Type 3 LSA for 10.10.99.0/24 created by both R1 and another created by R2. For example, in the internetwork used throughout this chapter, ABRs R1 and R2 would create a Type 3 LSA for 10.10.99.0/24. So, in this particular example, R3 would also have to cal-culate the best route to reach 10.10.99.0/24 through ABR R2. Then, R3 would choose the best route among all routes for 10.10.99.0/24. + +Each router repeats this process for all known routes to reach the ABR, considering the Type 3 LSAs from each ABR. In this case, R3 ties on metrics for one route through R1 and one through R2, so R3 adds both routes to its routing table, as shown in Example 8-8. + +Example 8-8 Route and Type 3 LSA on R3 for 10.10.99.0/24 + +R3# show ip route 10.10.99.0 255.255.255.0 +Routing entry for 10.10.99.0/24 +Known via "ospf 3", distance 110, metric 658, type inter area +Last update from 10.10.13.1 on Serial0/0/0.1, 00:08:06 ago +Routing Descriptor Blocks: +* 10.10.23.2, from 2.2.2.2 , 00:08:06 ago, via Serial0/0/0.2 +Route metric is 658, traffic share count is 1 +10.10.13.1, from 1.1.1.1, 00:08:06 ago, via Serial0/0/0.1 +Route metric is 658, traffic share count is 1 + +R3# show ip route ospf +10.0.0.0/8 is variably subnetted, 15 subnets, 3 masks +O IA 10.10.5.0/27 [110/1304] via 10.10.23.2, 00:07:57, Serial0/0/0.2 +[110/1304] via 10.10.13.1, 00:07:57, Serial0/0/0.1 +O IA 10.10.12.0/24 [110/657] via 10.10.23.2, 00:08:17, Serial0/0/0.2 +[110/657] via 10.10.13.1, 00:08:17, Serial0/0/0.1 +! lines omitted for brevity +O IA 10.10.99.0/24 [110/658] via 10.10.23.2, 00:08:17, Serial0/0/0.2 +[110/658] via 10.10.13.1, 00:08:17, Serial0/0/0.1 + + + +From the Library of Alexey Evseenko +336 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Besides the information that matches the expected outgoing interfaces per the figures, the output also flags these routes as interarea routes. The first command lists “type inter area” explicitly, and the show ip route ospf command lists the same information with the code “O IA,” meaning OSPF, interarea. Simply put, interarea routes are routes for which the subnet is known from a Type 3 Summary LSA. + +Special Rules Concerning Intra-Area and Interarea Routes on ABRs + +OSPF has a couple of rules concerning intra-area and interarea routes that take prece-dence over the simple comparison of the cost calculated for the various routes. The issue exists when more than one ABR connects to the same two areas. Many designs use two routers between the backbone and each nonbackbone area for redundancy, so this design occurs in many OSPF networks. + +The issue relates to the fact that with two or more ABRs, the ABRs themselves, when calculating their own routing tables, can calculate both an intra-area route and interarea route for subnets in the backbone area. For example, consider the perspective of Router R1 from the last several examples, as depicted in Figure 8-14. + +Area 34 Area 0 + + + + + +R1 + +Intra-area Route + + + +Interarea Route + + +10.10.99.0/24 + + + +Best Route R2 + + + +Figure 8-14 R1’s Choice: Intra-Area or Interarea Route to 10.10.99.0/24 + +Conceptually, R1 could calculate both the intra-area route and interarea route to 10.10.99.0/24. However, the OSPF cost settings could be set so that the lower-cost route for R1 actually goes through area 34, to ABR R2, and then on through area 0 to 10.10.99.0/24. However, two OSPF rules prevent such a choice by R1: +Step 1. When choosing the best route, an intra-area route is always better than a com-peting interarea route, regardless of metric. + +Step 2. If an ABR learns a Type 3 LSA inside a nonbackbone area, the ABR ignores that LSA when calculating its own routes. + +Because of the first rule, R1 would never choose the interarea route if the intra-area route were available. The second rule goes further, stating that R1 could never choose the interar-ea route—R1 simply ignores that LSA for the purposes of choosing its own best IP routes. + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 337 + +Metric and SPF Calculations + +Before moving on to discuss how to influence route choices by changing the OSPF inter-face costs, first take a moment to consider the CPU-intensive SPF work done by a router. SPF does the work to piece together topology information to find all possible routes to a destination. As a result, SPF must execute when the intra-area topology changes, because changes in topology impact the choice of best route. However, changes to Type 3 LSAs do not drive a recalculation of the SPF algorithm, because the Type 3 LSAs do not actu-ally describe the topology. + +To take the analysis a little deeper, remember that an internal router, when finding the best interarea route for a subnet, uses the intra-area topology to calculate the cost to reach the ABR. When each route is identified, the internal router adds the intra-area cost to the ABR, plus the corresponding Type 3 LSA’s cost. A change to the Type 3 LSA—it fails, comes back up, or the metric changes—does impact the choice of best route, so the changed Type 3 LSA must be flooded. However, no matter the change, the change does not affect the topology between a router and the ABR—and SPF focuses on processing that topology data. So, only changes to Type 1 and 2 LSAs require an SPF calculation. + +You can see the number of SPF runs, and the elapsed time since the last SPF run, using several variations of the show ip ospf command. Each time a Type 3 LSA changes and is flooded, SPF does not run, and the counter does not increment. However, each time a Type 1 or 2 LSA changes, SPF runs and the counter increments. Example 8-9 highlights the counter that shows the number of SPF runs on that router, in that area, and the time +since the last run. Note that ABRs list a group of messages per area, showing the number of runs per area. + +Example 8-9 Example with New Route Choices but No SPF Run + +R3# show ip ospf | begin Area 34 +Area 34 +Number of interfaces in this area is 3 +Area has no authentication +SPF algorithm last executed 00:41:02.812 ago +SPF algorithm executed 15 times +Area ranges are +Number of LSA 25. Checksum Sum 0x0BAC6B +Number of opaque link LSA 0. Checksum Sum 0x000000 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 + + +Metric Tuning + +Engineers have a couple of commands available that allow them to tune the values of the OSPF interface cost, thereby influencing the choice of best OSPF route. This section dis-cusses the three methods: changing the reference bandwidth, setting the interface band-width, and setting the OSPF cost directly. + + + +From the Library of Alexey Evseenko +338 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Changing the Reference Bandwidth + +OSPF calculates the default OSPF cost for an interface based on the following formula: + +Cost = Reference-Bandwidth / Interface-Bandwidth +The reference-bandwidth, which you can set using the auto-cost reference-bandwidth bandwidth router subcommand, sets the numerator of the formula for that one router, with a unit of Mbps. This setting can be different on different routers, but Cisco recom-mends using the same setting on all routers in an OSPF routing domain. + +For example, serial interfaces default to a bandwidth setting of 1544, meaning 1544 kbps. The reference bandwidth defaults to 100, meaning 100 Mbps. After converting the refer-ence bandwidth units to kbps (by multiplying by 1000) to match the bandwidth unit of measure, the cost, calculated per the defaults, for serial links would be + +Cost = 100,000 / 1544 = 64 + + +Note OSPF always rounds down when the calculation results in a decimal value. + + +The primary motivation for changing the reference bandwidth is to accommodate good defaults for higher-speed links. With a default of 100 Mbps, the cost of Fast Ethernet interfaces is a cost value of 1. However, the minimum OSPF cost is 1, so Gigabit Ethernet and 10 Gigabit interfaces also then default to OSPF cost 1. By setting the OSPF reference bandwidth so that there is some difference in cost between the higher-speed links, OSPF can then choose routes that use those higher-speed interfaces. + + +Note Although Cisco recommends that all routers use the same reference bandwidth, the setting is local to each router. + + +Note that in the examples earlier in this chapter, the bandwidth settings used default set-tings, but the auto-cost reference-bandwidth 1000 command was used on each router to allow different costs for Fast Ethernet and Gigabit interfaces. + +Setting Bandwidth + +You can indirectly set the OSPF cost by configuring the bandwidth speed interface sub-command (where speed is in kbps). In such cases, the formula shown in the previous sec-tion is used, just with the configured bandwidth value. + +While on the topic of the interface bandwidth subcommand, a couple of seemingly trivial facts might matter to your choice of how to tune the OSPF cost. First, on serial links, the bandwidth defaults to 1544. On subinterfaces of those serial interfaces, the same band-width default is used. + +On Ethernet interfaces, if not configured with the bandwidth command, the interface band-width matches the actual speed. For example, on an interface that supports autonegotiation + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 339 + +for 10/100, the bandwidth is either 100,000 kbps (or 100 Mbps) or 10,000 kbps (or 10 Mbps), depending on whether the link currently runs at 100 or 10 Mbps, respectively. + +Configuring Cost Directly + +The most controllable method of configuring OSPF costs, but the most laborious, is to configure the interface cost directly. To do so, use the ip ospf cost value interface sub-command, substituting your chosen value as the last parameter. + +Verifying OSPF Cost Settings + +Several commands can be used to display the OSPF cost settings of various interfaces. Example 8-10 shows several, along with the configuration of all three methods for chang-ing the OSPF cost. In this example, the following have been configured: + +■ The reference bandwidth is set to 1000. + +■ Interface S0/0/0.1 has its bandwidth set to 1000 kbps. + +■ Interface Fa0/0 has its cost set directly to 17. + +Example 8-10 R3 with OSPF Cost Values Set + +router ospf 3 +auto-cost reference-bandwidth 1000 +interface S0/0/0.1 +bandwidth 1000 +interface fa0/0 +ip ospf cost 17 + +R3# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Se0/0/0.2 3 34 +Se0/0/0.1 3 34 +Fa0/0 3 34 + +10.10.23.3/29 +10.10.13.3/29 +10.10.34.3/24 + +647 P2P 1/1 +1000 P2P 1/1 +17 BDR 1/1 + + +R3# show ip ospf interface fa0/0 +FastEthernet0/0 is up, line protocol is up +Internet Address 10.10.34.3/24, Area 34 +Process ID 3, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 17 +Enabled by interface config, including secondary ip addresses +Transmit Delay is 1 sec, State BDR, Priority 1 +Designated Router (ID) 4.4.4.4, Interface address 10.10.34.4 +Backup Designated router (ID) 3.3.3.3, Interface address 10.10.34.3 +! lines omitted for brevity + + + + + + + +From the Library of Alexey Evseenko +340 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 8-6 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 8-6 Design Review + + +Design Goal + +The design sets specific limits to the number of Type 1 and 2 LSAs in each area. Describe how to predict the number of each type of LSA. +How could you tune OSPF metrics to favor +10-Gbps links over 1-Gbps and 1-Gig over 100-Mbps? (2) +The design shows one physical path from ABR1 to core subnet 1 inside area 0, and one longer area 1 path to the same subnet. What can be done to ensure that both paths can be used? + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 8-7 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 341 + +Table 8-7 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +What conditions must be true for a router to create/flood a Type 2 LSA? (2) +The plan shows Frame Relay with all point-to-point subinterfaces. By default, will a DR/ BDR be elected? +The plan shows a reference bandwidth change planned for all routers with high-speed links, but not all other routers. What is the impact? (2) +The plan shows many different WAN links speeds but with the interface bandwidths not matching the actual speed. All OSPF cost changes are made explicitly with the ip ospf cost interface subcommand. Do the incorrect bandwidths cause any OSPF problems? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 8-8 configuration commands related to the configuration of the following features. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 8-8 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Tune metrics by changing the formula for calculating OSPF cost based on interface bandwidth. +Tune metrics by changing interface bandwidth. +Change metrics by setting cost directly. + +Set the number of equal-cost OSPF routes allowed in a router’s routing table. +Influence the choice of DR on a LAN. (2) + + + + + + + + +From the Library of Alexey Evseenko +342 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table 8-9 all commands that supply the requested information. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 8-9 Verification Plan Memory Drill + +Information Needed Command(s) +Display a summary of the OSPF database. + +Display all Type 1 Router LSAs known to a router. + +Display the details of a particular Type 1 Router LSA. +Display all Type 2 Network LSAs known to a router. +Display the details of a particular Type 2 Router LSA. +Display all Type 3 Summary LSAs known to a router. +Display the details of a particular Type 3 Router LSA. +Display a list of OSPF-enabled interfaces on a router. +Determine on which interfaces a router has formed at least one OSPF neighborship. +Determine the number of fully adjacent neighbors on an interface. +Determine which transit networks connect to a Type 1 LSA. +Determine the router that created and flooded a Type 3 LSA. +Determine the router that created and flooded a Type 2 LSA. +Determine the router that created and flooded a Type 1 LSA. +Display the IP address of the current DR and BDR on a LAN. +Display the OSPF interface cost (metric). + +Display all OSPF-learned routes. + +Display statistics about the number of SPF algorithm runs. + + + +From the Library of Alexey Evseenko +Chapter 8: The OSPF Link-State Database 343 + + +Note Some of the entries in this table might not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 8-10 lists a reference of these key topics and the +page numbers on which each is found. + + +Table 8-10 Key Topics for Chapter 8 +Key +Topic Key Topic Element Description Page Number + + +Table 8-2 + +List + +Table 8-3 + +Table 8-4 + +Table 8-5 + +List + +List + +OSPF LSA Types 305 + +Two main functions of a DR 312 + +Facts About LSA Types 1, 2, and 3 321 + +OSPF Message Types and Functions 322 + +OSPF Neighbor State Reference 322 + +Key differences between database exchange with and 326 without a DR +Three considerations a router makes when choosing 330 the best OSPF IP routes + +List Three steps to calculate OSPF costs for intra-area routes 331 + +List Two steps for calculating OSPF costs for interarea routes 334 + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +link-state identifier (LSID), designated router (DR), backup designated router (BDR), internal router, area border router (ABR), all-SPF-routers multicast, all-DR-routers multicast, link-state advertisement, Database Description (DD) packet, Link-State Request (LSR) packet, Link-State Acknowledgment (LSA) packet, Link-State Update (LSU) packet, Router LSA, Network LSA, Summary LSA, Type 1 LSA, Type 2 LSA, Type 3 LSA, reference bandwidth, SPF calculation + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Route Filtering: This section introduces three separate methods of route filtering with OSPF and discusses the commands to configure two of these methods. +■ Route Summarization: This section examines how OSPF can summarize routes at ABRs and at ASBRs. + +■ Default Routes and Stub Areas: This section examines the two main reasons that an enterprise might use default routes and then shows OSPF’s solution to each need: flooding a domain-wide default route and using OSPF stub areas. +■ OSPF version 3: This section introduces the new-est version of OSPF, OSPF version 3 (commonly written as OSPFv3). OSPFv3 adds support for the routing of IPv6 traffic. The theory and commands for OSPFv3 Address Family configuration are also covered. + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 9 + + + + + + +Advanced OSPF Concepts + + +This chapter discusses several features that optimize Open Shortest Path First (OSPF) operations: route filtering, route summarization, default routing, and OSPF stub areas, in addition to the features available in OSPFv3. + +Route filtering can be used to purposefully prevent hosts in one part of an internetwork from sending packets to another part. It can also reduce the size of a topology table and IP routing table, reducing both OSPF memory and CPU consumption, plus make the packet-forwarding process run slightly better. Route summarization can also reduce rout-ing protocol and packet forwarding overhead, but with a potential negative effect of creating less-efficient paths through an internetwork. + +Additionally, this chapter briefly covers default routing, followed by a discussion of OSPF stub routers. These stub routers can be used to limit the amount of topology data in an area, again reducing overhead. + +Finally, this chapter concludes with a look at OSPFv3, including configuration examples. This discussion also introduces the concept of OSPFv3 Address Families and includes configuration and verification examples. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than two of these 11 self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 9-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 9-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Route Filtering + +Route Summarization + +Default Routing and Stub Areas + +OSPF version 3 + +Questions +1–3 + +4, 5 + +6–8 + +9–11 + + + + + + +From the Library of Alexey Evseenko +346 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. Router B1, an internal router in area 1, displays the following output. The only two ABRs connected to area 1 are performing Type 3 LSA filtering. Which of the follow-ing answers is true based on the information in the output from B1? + +R1# show ip route 10.1.0.0 255.255.0.0 longer-prefixes +! Legend lines omitted for brevity + +10.0.0.0/8 is variably subnetted, 17 subnets, 3 masks +O 10.1.2.0/24 [110/658] via 10.10.13.1, 00:00:32, Serial0/0/0.1 +O IA 10.1.1.0/24 [110/658] via 10.10.23.2, 00:41:39, Serial0/0/0.2 +O IA 10.1.3.0/24 [110/658] via 10.10.23.2, 00:41:39, Serial0/0/0.2 + +a. A Type 3 LSA for 10.2.2.0/24 was filtered by both ABRs. + +b. A Type 3 LSA for 10.1.2.0/24 was not filtered by both ABRs. + +c. A Type 3 LSA for 10.1.3.0/24 was not filtered by at least one ABR. + +d. A Type 3 LSA for 10.1.1.0/24 was filtered by both ABRs. + +2. The following command output was gathered from Router R1, an ABR between area 0 (backbone) and area 1. In this internetwork, area 0 contains all the subnets of Class A network 10.0.0.0. R1’s OSPF process has a distribute list configured. Assuming that the subnets listed in the answers actually exist in area 0, which of the following occurs on Router R1? + +R1# sh ip prefix-list +ip prefix-list question: 3 entries +seq 5 deny 10.1.2.0/24 ge 25 le 27 +seq 15 deny 10.2.0.0/16 ge 30 le 30 +seq 20 permit 0.0.0.0/0 le 32 + +a. R1 will not create/flood a Type 3 LSA for subnet 10.1.2.0/26 into area 1. + +b. R1 will not create/flood a Type 3 LSA for subnet 10.1.2.0/24 into area 1. + +c. R1 will not have an OSPF route for subnet 10.1.2.0/26 in its IP routing table. + +d. R1 will not have an OSPF route for subnet 10.1.2.0/24 in its IP routing table. + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 347 + +3. Use the same scenario as the previous question, with one change. Instead of the dis-tribute list configured on R1, R1’s OSPF process has an area 1 filter list configured. Again assuming that the subnets listed in the answers actually exist in area 0, which of the following occurs on Router R1? + +R1# sh ip prefix-list +ip prefix-list question: 3 entries +seq 5 deny 10.1.2.0/24 ge 25 le 27 +seq 15 deny 10.2.0.0/16 ge 30 le 30 +seq 20 permit 0.0.0.0/0 le 32 + +a. R1 will not create/flood a Type 3 LSA for subnet 10.1.2.0/26 into area 1. + +b. R1 will not create/flood a Type 3 LSA for subnet 10.1.2.0/24 into area 1. + +c. R1 will not have an OSPF route for subnet 10.1.2.0/26 in its IP routing table. + +d. R1 will not have an OSPF route for subnet 10.1.2.0/24 in its IP routing table. + +4. R1, an ABR between backbone area 0 and area 1, has intra-area routes in area 0 for 10.1.1.0/24, 10.1.2.0/24, and 10.1.3.0/24. These routes have metrics of 21, 22, and 23, respectively. An engineer then adds the area 0 range 10.1.0.0 255.255.0.0 command under the OSPF process of R1. Which of the following are true? (Choose two.) +a. R1 loses and then reestablishes neighborships with all neighbors. + +b. R1 no longer advertises 10.1.1.0/24 to neighbors into area 1. + +c. R1 advertises a 10.1.0.0/16 route into area 1 with a metric of 23 (largest metric). + +d. R1 advertises a 10.1.0.0/16 route into area 1 with a metric of 21 (lowest metric). + +5. The following output exists on Router R1, a router internal to area 1. What can you determine as true from the output of the show ip ospf database summary command? + +Routing Bit Set on this LSA +LS age: 124 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links (Network) +Link State ID: 10.1.0.0 (summary Network Number) +Advertising Router: 1.1.1.1 +LS Seq Number: 80000001 +Checksum: 0x878F +Length: 28 +Network Mask: /22 +TOS: 0 Metric: 11 + +a. The LSA was created by an ABR because of an area range command. + +b. The LSA was created by an ASBR because of a summary-address command. + +c. If created by an area range command, the best metric for a subordinate subnet on that ABR must have been 11. + +d. None of the other answers are correct. + + + +From the Library of Alexey Evseenko +348 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +6. Router R1, an ASBR connected to the Internet and to backbone area 0, has been con-figured with a default-information originate command. Which of the following is true about the effects of this configuration command? +a. R1 will always create and flood a default route into the OSPF domain. + +b. R1 will create and flood an LSA for prefix/length 0.0.0.0/0 into the OSPF domain if R1’s IP routing table has a route to 0.0.0.0/0. + +c. R1 will set a flag on the LSA for the subnet between itself and one of the ISPs, noting this subnet as a default network, regardless of whether R1 has a default route. +d. R1 will set a flag on the LSA for the subnet between itself and one of the ISPs, noting this subnet as a default network, but only if R1 has a route to 0.0.0.0/0. + +7. Which of the following are true about routers internal to a totally NSSA area? (Choose two.) + +a. Routers cannot redistribute external routes into the area. + +b. Routers should have zero Type 3 LSAs in their LSDBs. + +c. Routers should have zero Type 5 LSAs in their LSDBs. + +d. Routers should learn default routes from the ABRs attached to the area. + +8. ABR R1 has been configured with an area 1 stub no-summary command. Which stubby area type is area 1? + +a. Stub + +b. Totally stubby + +c. NSSA + +d. Totally NSSA + +9. With an OSPFv3 Address Family configuration supporting both IPv4 and IPv6 rout-ing, which of the following is true regarding OSPFv3’s link-state database? + +a. IPv4 LSAs populate one database, while IPv6 LSAs populate a second database. + +b. Information received from all LSAs is aggregated in a single link-state database. + +c. OSPFv3 does not use a link-state database. Rather, it represents link-state infor-mation in a lookup table similar to Cisco Express Forwarding (CEF). + +d. A virtual Address Family is created, and it contains information from both IPv4 and IPv6 LSAs. + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 349 + +10. In an OSPFv3 Address Family configuration, how do you tell an interface to partici-pate in the OSPFv3 process for IPv6 routes? + +a. Router(config-router)# ospfv3 process_id ipv6 area area_number + +b. Router(config-router-af)# ospfv3 process_id ipv6 area area_number + +c. Router(config-router-af-if)# ospfv3 process_id ipv6 area area_number + +d. Router(config-if)# ospfv3 process_id ipv6 area area_number + +11. Which LSA used in IPv6 networks carries information similar to the information car-ried by Type 1 and Type 2 LSAs in IPv4 networks? + +a. Type 6 LSA + +b. Type 8 LSA + +c. Type 9 LSA + +d. Type 10 LSA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +350 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +Route Filtering + +OSPF supports several methods to filter routes. However, the OSPF’s internal logic restricts most filtering, requiring that the filtering be done either on an area border router (ABR) or autonomous system boundary router (ASBR). This same internal logic dictates what each type of filtering can do and what it cannot do. So, when thinking about OSPF route filtering, you need to go beyond the concept of matching IP prefix/length informa-tion and consider OSPF internals as well. This first major section begins with a discussion of the OSPF internals that impact OSPF route filtering, followed by information about two of OSPF’s route-filtering tools. + +First, consider the difference in how OSPF chooses intra-area versus interarea routes. For intra-area routes, OSPF uses pure link-state logic, with full topology information about an area, piecing together the topology map from the Type 1 and Type 2 LSAs. This logic relies on all routers inside the area having an identical copy of the link-state database (LSDB) for that area. With the full topology, the shortest path first (SPF) algorithm can be run, finding all possible routes to each subnet. + +For interarea routes, OSPF uses distance vector logic. The intra-area SPF calculation includes the calculation of the metric of the best route to reach each ABR in the area. To choose the best interarea route, a router uses distance vector logic of taking its known metric to reach the ABR and adds the metric for that subnet as advertised by the ABR. This means that no additional SPF calculation is required to find all interarea routes for a given prefix/length, making this logic more like distance vector logic. + +Keeping these thoughts in mind, next consider the concept of route filtering inside one area. First, OSPF routers do not advertise routes; instead, they advertise LSAs. Any filter-ing applied to OSPF messages would need to filter the transmission of LSAs. However, inside one area, all routers must know all LSAs, or the entire SPF concept fails, and rout-ing loops could occur. As a result, OSPF cannot and does not allow the filtering of LSAs inside an area, specifically the Type 1 and Type 2 LSAs that describe the intra-area topology. + +OSPF does allow some route filtering, however, taking advantage of the fact that OSPF uses distance vector logic with Type 3 LSAs (and Type 5 LSAs used for external routes). Because of the underlying distance vector logic, an OSPF ABR can be configured to filter Type 3 LSAs, with no risk of creating routing loops. (The same applies for ASBRs filter-ing Type 5 LSAs created for external routes.) As a result of these related concepts, Cisco IOS limits OSPF route filtering to the following: + +■ Filtering Type 3 LSAs on ABRs + +■ Filtering Type 5 LSAs on ASBRs + +■ Filtering the routes that OSPF would normally add to the IP routing table on a single router + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 351 + +Of these, the second option occurs as an option of the route redistribution process as explained in Chapter 10, “Route Redistribution.” So, it will not be covered in this chapter. The other two topics will be examined next. + +Type 3 LSA Filtering + +ABRs, by definition, connect to the backbone area and at least one other area. ABRs, as a fundamental part of their role, create and flood Type 3 Summary LSAs into one area to represent the subnets in the other areas connected to that ABR. Type 3 LSA filtering tells the ABR to filter the advertisement of these Type 3 LSAs. + +For example, consider Figure 9-1, which shows a generalized design with two ABR rout-ers. The figure focuses on three subnets in area 0 for which each ABR would normally create and flood a Type 3 Summary LSA into area 1. However, in this case, the engineer has made the following choices: + +■ On ABR1, filter subnet 3 from being advertised. + +■ On ABR2, filter both subnets 2 and 3 from being advertised. + +Area 1 Area 0 + +Type 3 Subnet 1 + + +Type 3 ABR1 Subnet 2 + + + +Type 3 Subnet 1 +ABR2 + + +Subnet 1 + +Subnet 2 + +Subnet 3 + + + + +Figure 9-1 Generic View of Type 3 LSA Filtering + +The goal of such a filtering plan could be to prevent all area 1 users from reaching subnet 3 and to allow access to subnet 2—but only through ABR1. If ABR1 were to fail, none of the area 1 routers could calculate a route for subnet 2 through ABR2, because ABR2 has not created and flooded a Type 3 LSA for that subnet. The goal for subnet 1 would be +to allow each area 1 router to choose the best route through either ABR, while having a redundant route in case one route failed. + +To configure Type 3 LSA filtering, you use the area number filter-list prefix name {in | out} command under router ospf configuration mode. The referenced prefix list matches subnets, with subnets matched by a deny action being filtered, and subnets matched with a permit action allowed through as normal. OSPF then performs the filtering by not flooding the Type 3 LSAs into the appropriate areas. + + + +From the Library of Alexey Evseenko +352 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The trickiest part of the configuration relates to the in and out parameters at the end of the area filter-list router subcommand. These parameters define the direction relative to the area listed in the command, as follows: + +■ When in is configured, Cisco IOS filters prefixes being created and flooded into the configured area. + +■ When out is configured, Cisco IOS filters prefixes coming out of the configured area. + +The need for the in and out parameters makes more sense when you consider an ABR connected to at least three areas. Figure 9-2 shows just such a sample, with both the in and out directions represented. + +area 0 filter-list... in +Area 1 Area 0 + +Subnet 111 ABR1 Stop Subnet 10 + + +Stop + +area 2 filter-list... out + + +Subnet 12 + +Area 2 + +Figure 9-2 Generic View of Type 3 LSA Filtering + +The area 0 filter-list... in command in the figure shows that the ABR considers filtering routes from all other areas (areas 1 and 2, in this case) when creating and flooding Type 3 LSAs into area 0. The area 2 filter-list... out command in the figure shows how the ABR only considers prefixes that exist in area 2. However, in this case, the ABR filters LSAs regardless of the area into which the Type 3 LSAs would be advertised. + +For example, consider the case of subnet 111, in area 1. Assume that all prefix lists hap-pen to match subnet 111, so that subnet 111 should be filtered. The following list summa-rizes what happens on ABR1 regarding the potential advertisement of a Type 3 LSA for this subnet being flooded into areas 0 and 2: + +■ ABR1 filters the subnet 111 LSA from being sent into area 0 because of the area 0 filter-list... in command. + +■ ABR1 does not filter the subnet 111 LSA from being sent into area 2, because there is no area 1 filter-list... out command nor area 2 filter-list... in command. + +As another example, Figure 9-3 shows an example internetwork with three candidate routes to be filtered by ABRs R1 and R2. ABRs R1 and R2 will play the roles of ABR1 + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 353 + +and ABR2 in Figure 9-1, with R1 filtering one of the three subnets and R2 filtering two of the subnets. Note that R1 and R2 will each use different in and out keywords as well. + +Area 34 + + + +R3 + +Subnets of +10.11.0.0/16 Area 0 + + +Subnets of 10.9.x.x/16 SW1 + + +R4 R1 + + +SW3 + + + +R5 R2 +Subnets of 10.12.0.0/16 SW2 + +Area 5 + + +Data Center 10.16.1.0/24 10.16.2.0/24 10.16.3.0/24 + + +Figure 9-3 Type 3 LSA Filtering Example + +Example 9-1 shows the configuration on both R1 and R2. + +Example 9-1 R1’s and R2’s distribute-list to Filter Manufacturing Routes + +! On Router R1: +ip prefix-list filter-into-area-34 seq 5 deny 10.16.3.0/24 +ip prefix-list filter-into-area-34 seq 10 permit 0.0.0.0/0 le 32 +! +router ospf 1 +area 34 filter-list prefix filter-into-area-34 in + +! On Router R2: +ip prefix-list filter-out-of-area-0 seq 5 deny 10.16.2.0/23 ge 24 le 24 +ip prefix-list filter-out-of-area-0 seq 10 permit 0.0.0.0/0 le 32 +! +router ospf 2 +area 0 filter-list prefix filter-out-of-area-0 out + +First, take a closer look at the specifics of the R1 configuration commands. The prefix list on R1 exactly matches route 10.16.3.0/24, with a deny action. The second prefix-list command matches all subnets, because the 0.0.0.0/0 parameter matches all subnet numbers, and the le 32 parameter, combined with the original /0 prefix length, matches + + + + +From the Library of Alexey Evseenko +354 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +all prefix lengths from /0 through /32. The area 34... in command tells R1 to apply this filtering to all Type 3 LSAs that R1 creates and would otherwise flood into area 34. As a result, the area 34 LSDB will not contain a Type 3 LSA for 10.16.3.0/24, as injected +by R1. + +R2’s configuration uses a slightly different prefix list. The filter examines all Type 3 LSAs for subnets in area 0. The first prefix-list command matches all prefixes in the range 10.16.2.0–10.16.3.255 (per the 10.16.2.0/23 parameter) but specifically for a prefix length of exactly 24. This command matches two of the three data center subnets. The second prefix-list command matches all other subnets with the same match-all logic seen earlier on R1, using a permit action. R2’s area 0... out command tells R2 to filter the subnets that R2 learns in area 0 and for which R2 would normally create Type 3 LSAs to flood into all other areas. So, neither area 34 nor area 5 will learn these two filtered subnets (10.16.2.0/24 and 10.16.3.0/24) in Type 3 LSAs from R2. + +The end result of this added configuration results in the following Type 3 LSAs for the three subnets shown on the right side of Figure 9-3: + +■ Two Type 3 LSAs for 10.16.1.0/24 (created by R1 and R2, respectively) + +■ One Type 3 LSA for 10.16.2.0/24 (created by R1) + +■ None for 10.16.3.0/24 + +Example 9-2 confirms the contents of the LSDB in area 34, on Router R3. + +Example 9-2 Area 34 LSDB, as Seen on R3 + +R3# show ip route 10.16.0.0 255.255.0.0 longer-prefixes +! Legend lines omitted for brevity + +10.0.0.0/8 is variably subnetted, 17 subnets, 3 masks +O IA 10.16.2.0/24 [110/658] via 10.10.13.1, 00:00:32, Serial0/0/0.1 +O IA 10.16.1.0/24 [110/658] via 10.10.23.2, 00:41:39, Serial0/0/0.2 +[110/658] via 10.10.13.1, 00:00:32, Serial0/0/0.1 + +R3# show ip ospf database | include 10.16 + +10.16.1.0 +10.16.1.0 +10.16.2.0 + +1.1.1.1 759 +2.2.2.2 745 +1.1.1.1 759 + +0x80000002 0x008988 +0x80000002 0x006BA2 +0x80000002 0x007E92 + + +The first command in the example lists R3’s routes for all subnets whose first two octets are 10.16. Note that R3 has no route to 10.16.3.0/24, because both R1 and R2 filtered the Type 3 LSA. R3 happens to have equal-cost routes for 10.16.1.0/24, which is possible, because both R1 and R2 permitted the advertisement of the Type 3 LSA for that subnet. R3 has only one route for 10.16.2.0/24, through R1, because R2 filtered its Type 3 LSA for that prefix. + +The second command in Example 9-2 lists all LSAs that include “10.16,” which includes the two Type 3 LSAs for 10.16.1.0/24 and the single Type 3 LSA for 10.16.2.0/24. + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 355 + +Finally, note that although the configuration in Example 9-1 showed area filter-list com-mands with both in and out parameters for variety, the result of R2’s area filter-list... out command is that R2 does not flood the filtered LSAs to either area 34 or area 5. If the design goals specifically meant to filter only LSAs from being advertised from area 0 into area 34, the area 34 filter-list... in command should have been used on both routers. + +Filtering OSPF Routes Added to the Routing Table + +In some cases, an engineer might need to filter a route, but the area design does not lend itself well to his filtering goals. For example, if an area has 20 routers and the engineer wants to filter a route so that five of the routers do not learn the route, Type 3 LSA fil-tering cannot be used. Type 3 LSA filtering can only filter the LSAs from being flooded throughout the entire area. + +The next feature discussed in this section, referenced as filtering with distribute lists (based on the configuration command it uses), allows individual routers to filter OSPF routes from getting into their respective IP routing tables. This type of filtering injects logic between the SPF algorithm on a router and that same router’s IP routing table. This feature does not change the LSDB flooding process, does not change the LSAs added by ABRs or ASBRs, and does not change the SPF algorithm’s choice of best route. However, when SPF chooses routes to add to the IP routing table, if a router has been configured with a distribute-list in router subcommand, enabling this feature, that router then filters the routes before adding them to that router’s IP routing table. Figure 9-4 shows the gen-eral idea. + +R1 R2 R3 + + + +IP Routing Table + + +distribute-list in + + +SPF + + +LSDB + +IP Routing Table + + +distribute-list in + + +SPF + + +LSDB + +IP Routing Table + + +distribute-list in + + +SPF + + +LSDB + + + +Figure 9-4 OSPF Filtering with Distribute Lists + +In effect, you could prevent an OSPF route from being added to one or more routers’ routing tables, but without risking causing routing loops, because the intra-area LSDB topology remains intact. By filtering routes from being added to the IP routing table, you + + + + +From the Library of Alexey Evseenko +356 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +prevent the routers from forwarding packets to the filtered subnets, but presumably that’s the intended goal of route filtering. + +The mechanics of the distribute-list router subcommand have a few surprises, which are summarized in this list: + +■ The command requires either an in or out direction. Only the in direction works for filtering routes as described in this section. + +■ The command must refer to either a numbered access control list (ACL), named ACL, prefix list, or route map. Regardless, routes matched with a permit action are allowed into the IP routing table, and routes matched with a deny action are filtered. + +■ Optionally, the command can include the interface interface-name-and-number parameters. The router compares these parameters to the route’s outgoing interface. + +Example 9-3 shows a sample configuration on Router R3 from Figure 9-3. In this case, all filtering listed in Examples 9-1 and 9-2 has been removed, so no routes or LSAs have been filtered. Then, the engineer adds the distribute-list command on R3 to filter the route for 10.16.1.0/24, based on prefix-list filter-1. + +Example 9-3 R3’s distribute-list to Filter 10.16.1.0/24 + +! On Router R3: +ip prefix-list filter-1 seq 5 deny 10.16.1.0/24 +ip prefix-list filter-1 seq 10 permit 0.0.0.0/0 le 32 +! +router ospf 3 +distribute-list prefix filter-1 in +! +R3# show ip route ospf | include 10.16.1 +R3# +R3# show ip ospf database | include 10.16.1.0 + +10.16.1.0 +10.16.1.0 + +1.1.1.1 +2.2.2.2 + +1143 0x80000007 0x007F8D +1538 0x80000007 0x0061A7 + + +Note that the configuration matches only prefix 10.16.1.0/24 with a deny clause and permits all other routes. As a result, OSPF on R3 does not add a route for subnet 10.16.1.0/24 to the IP routing table, as implied by the null output of the show ip route ospf | include 10.16.1 command. The show ip ospf database | include 10.16.1 command lists all LSAs that have 10.16.1 in the text output, showing the two Type 3 LSAs for the subnet. + +Route Summarization + +OSPF allows summarization at both ABRs and ASBRs but not on other OSPF routers. The main reason is again that the LSDB must be the same for all routers in a single area. So, if summarization is needed, the summary prefixes should be created at the edge of an area (ABR or ASBR) and flooded throughout that area. However, the idea of + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 357 + +summarizing on a router internal to an area, hoping that some routers in the area use the summary route and others in the same area do not, cannot be done with OSPF. + +Good planning of route summaries can overcome the restriction of performing the sum-marization only on ABRs and ASBRs. A good OSPF area design includes consideration of future address summaries, and a good OSPF route summarization design considers the ABR locations. Although it is rare to design a large internetwork from scratch, an addressing plan that assigns all or most subnets in an area from one large address block does make address summarization easier. + +OSPF summarization differs slightly on ABRs versus ASBRs. This section first examines route summarizations on ABRs and then considers ASBRs. + +Manual Summarization at ABRs + +The more difficult task with OSPF route summarization occurs when planning the design of IP address blocks and OSPF areas. When the IP addressing plan and OSPF design have been completed, if the subnet numbers inside an area happen to be from the same general range, and none of the subnets in that range exist in other OSPF areas, a reasonable sum-mary route can be created at the ABRs connected to that area. Without first having such a reasonable block of addresses, route summarization might not be a useful option. + +After a range of subnets has been chosen for summarization, the parameters in the area range command must be planned. This command defines the parameters for the summary route, most notably the origin area from which the subnets exist and the subnet number/ mask that defines the summary route that should be advertised. The generic version of the command is listed next, followed by some notes about the various parameters: + +area area-id range ip-address mask [cost cost] + + +■ Key +Topic +■ + + + + +■ + +■ + + +■ + +■ + +The configured area number refers to the area where the subnets exist; the summary will be advertised into all other areas connected to the ABR. + +The ABR compares the summary route’s range of addresses with all intra-area OSPF routes, in the origin area, for which the ABR is creating Type 3 LSAs. If at least one subordinate subnet exists (subnets that sit inside the range), the ABR advertises the summary route as a Type 3 LSA. + +The ABR does not advertise the subordinate subnet’s Type 3 LSAs. + +The ABR assigns a metric for the summary route’s Type 3 LSA, by default, to match the best metric among all subordinate subnets. + +The area range command can also explicitly set the cost of the summary. + +If no subordinate subnets exist, the ABR does not advertise the summary. + + +For example, Figure 9-3 (shown earlier in this chapter) lists three subnets on the right side of the figure, noted as data center subnets 10.16.1.0/24, 10.16.2.0/24, and 10.16.3.0/24. ABR R1 could be configured to summarize these routes as 10.16.0.0/22, which includes + + + + +From the Library of Alexey Evseenko +358 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +all three subnets. (10.16.0.0/22 implies a range from 10.16.0.0 to 10.16.3.255.) The ABRs (R1 and R2) could be configured to advertise a summary route using the area 0 range 10.16.0.0 255.255.252.0 router subcommand. + +Behind the scenes, ABR route summarization causes the ABR to no longer advertise the subordinate routes’ Type 3 LSAs, but to instead advertise one Type 3 LSA for the sum-mary prefix. Figure 9-5 shows this concept on ABR R1, assuming that the area 0 range 10.16.0.0 255.255.252.0 router subcommand has been configured. The three Type 3 LSAs that would normally have been advertised are shown above the ABR, and the one Type 3 LSA for the summary route, which replaces the upper LSAs, is shown under +the ABR. + +Type 3 Metric 11 10.16.1.0/24 + + +Type 3 Metric 12 10.16.2.0/24 + + +Type 3 Metric 13 10.16.3.0/24 + + +R1 ABR +or +area 0 range 10.16.0.0/22 + +Type 3 Metric 11 10.16.0.0/22 + +Figure 9-5 OSPF Area Summarization—Consolidating Type 3 LSAs + +Example 9-4 shows some show command output related to this example. All route filter-ing in earlier examples has been removed, and both R1 and R2 have configured OSPF to summarize 10.16.0.0/22 with the area 0 range 10.16.0.0 255.255.252.0 router OSPF sub-command. However, in R2’s case, the metric 12 parameter was used. + +Example 9-4 R1/R2/R3’s Area Summarization on 10.16.0.0/16 + +! On Router R1, before the summarization: +R1# sh ip route ospf | incl 10.16 +O 10.16.2.0/24 [110/12] via 10.10.17.7, 00:00:24, FastEthernet0/0 +O 10.16.3.0/24 [110/13] via 10.10.17.7, 00:00:24, FastEthernet0/0 +O 10.16.1.0/24 [110/11] via 10.10.17.7, 00:00:34, FastEthernet0/0 + +! Next, configuring the summarization: + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 359 + +router ospf 1 +area 0 range 10.16.0.0 255.255.252.0 + +! Next, on R2, configuring the same summary +router ospf 2 +area 0 range 10.16.0.0 255.255.252.0 cost 12 + +! Next, from R3 +R3# show ip ospf database summary 10.16.0.0 + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Summary Net Link States (Area 34) + +Routing Bit Set on this LSA +LS age: 124 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 10.16.0.0 (summary Network Number) +Advertising Router: 1.1.1.1 +LS Seq Number: 80000001 +Checksum: 0x878F +Length: 28 +Network Mask: /22 +TOS: 0 Metric: 11 + +LS age: 103 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 10.16.0.0 (summary Network Number) +Advertising Router: 2.2.2.2 +LS Seq Number: 80000001 +Checksum: 0x739E +Length: 28 +Network Mask: /22 +TOS: 0 Metric: 12 + +R3# show ip route 10.16.0.0 255.255.0.0 longer-prefixes +! legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 16 subnets, 4 masks +O IA 10.16.0.0/22 [110/ 658 ] via 10.10.13.1, 00:03:46, Serial0/0/0.1 + +The example demonstrates the theory of what happens behind the scenes. R3 lists only two Type 3 LSAs related to the 10.16.1.0/24, 10.16.2.0/24, and 10.16.3.0/24 subnets: the Type 3 LSAs created by R1 and R2 for 10.16.0.0/22. However, the output does not denote + + + + +From the Library of Alexey Evseenko +360 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +that this LSA represents a summarized route. It simply looks like yet another Type 3 LSA. (Any mention of the word “summary” in the output refers to the fact that Type 3 +LSAs are called Summary LSAs.) In this case, R3’s path to reach both R1 and R2 ties, but the LSA for R1’s 10.16.0.0/22 summary was injected with metric 11, based on the lowest metric subordinate route on R1, whereas R2’s uses the explicitly configured metric 12. As a result, R3’s best route for 10.16.0.0/22 uses R1, as shown in the route at the end of the example. + +The first show command in the example shows R1’s metrics for the three subordinate sub-nets, specifically metrics 11, 12, and 13. As such, R1’s summary for 10.16.0.0/22, as shown in R3’s show ip ospf database summary 10.16.0.0 command, confirms that, by default, R1 gave the summary route’s Type 3 LSA the best metric among the component subnets. + + +Note Although not discussed in depth here, the optional not-advertise option on the area range command tells the ABR to not advertise the Type 3 LSA for the summary route, making it possible to do the equivalent of Type 3 LSA filtering with the area range command. + + + +Manual Summarization at ASBRs + +OSPF defines an ASBR as a router that redistributes routes into OSPF from some other routing sources. When redistributing the routes, the ASBR creates a Type 5 External LSA for each redistributed subnet, listing the subnet number as the LSID and listing the mask as one of the fields in the LSA. The LSA also lists the ASBR’s RID as the advertis-ing router and a cost metric for the route. For the purposes of route summarization, you can think of a Type 5 LSA as working much like a Type 3 LSA, except for routes learned externally. + +This section describes ASBR route summarization, which has many similarities to summa-rization by an ABR. If you add the summary-address prefix mask OSPF subcommand, OSPF will then attempt to summarize the external routes by creating a Type 5 LSA for the summary route, and by no longer advertising the Type 5 LSAs for the subordinate subnets. When looking for potential subordinate subnets inside the summary, the ASBR looks at all routes being redistributed into OSPF from all outside route sources, and if any subordinate subnets exist, the ASBR performs the route summarization. + +Notably, this command works very much like the area range command on ABRs, with the main exception being that the summary-address command cannot explicitly set the metric of the summary route. The list of features is as follows: + + +■ Key +Topic + + +■ + +The ASBR compares the summary route’s range of addresses with all routes redis-tributed into OSPF on that ASBR to find any subordinate subnets (subnets that sit inside the summary route range). If at least one subordinate subnet exists, the ASBR advertises the summary route. + +The ASBR does not advertise the subordinate subnets. + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 361 + +■ To create the summary, the ASBR actually creates a Type 5 LSA for the summary route. + +■ The ASBR assigns the summary route the same metric as the lowest metric route among all subordinate subnets. + +■ If no subordinate subnets exist, the ASBR does not advertise the summary. + +■ Unlike the area range command, the summary-address command cannot be used to directly set the metric of the summary route. + +The summary-address subcommand defines the summary route on the ASBR, with simi-lar syntax and parameters as compared to the area range command seen on ABRs. Table 9-2 lists the two commands for comparison and study. + +Key Table 9-2 OSPF Route Summarization Commands Topic Where Used Command + +ASBR summary-address {{ip-address mask} | {prefix mask}} [not-advertise] + +ABR area area-id range ip-address mask [advertise | not-advertise] [cost cost] + + + +Default Routes and Stub Areas + +Enterprises typically use default routes in two different cases: + +■ To direct remote-site routers at the edge of the enterprise network to send all packets toward the core of the enterprise, with the core routers knowing all the more-specif-ic routes to enterprise destination addresses + +■ To direct traffic on all enterprise routers toward an Internet-facing router so that all traffic destined for the Internet eventually arrives at the enterprise’s Internet-connected routers + +Engineers could achieve both of these goals by using route summarization with the area range and summary-address commands. For example, consider a case in which the goal is to drive all packets destined for Internet hosts to one of two equal Internet routers for an enterprise, as shown in Figure 9-6. The design shows two ASBRs connected to the Internet. Both ASBRs could learn routes with Border Gateway Protocol (BGP). Rather than redistribute all BGP routes into the enterprise, the ASBRs summarize to the ultimate summary, 0.0.0.0/0. The two OSPF ASBRs flood the Type 5 LSA for a summary route— one from ASBR1 and one from ASBR2—throughout the enterprise. As a result, all OSPF routers choose a default route, with the packets destined for locations in the Internet eventually reaching one of the two ASBRs, which then forwards the packets into the Internet. + + + + + + + +From the Library of Alexey Evseenko +362 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Redistribute BGP Summary Address 0.0.0.0 +Area 1 + +ASBR1 BGP ISP1 + +ABR1 + +Area 0 + + +ABR2 + +ASBR2 BGP ISP2 Area 2 +Summary Address 0.0.0.0 Redistribute BGP +Legend: +Default Routes + +Figure 9-6 Using ASBR Route Summarization to Advertise Summary Routes + +To meet the other design goal for using defaults—to get the routers in an area to use default routing to deliver packets to an ABR—the ABR could use the area range com-mand to flood a default route into a single area. Again in Figure 9-6, if the design called for the routers in area 1 to use a default route to reach other destinations in the enter-prise, the ABRs connected to area 1, like ABR1, could use the area 0 range 0.0.0.0 0.0.0.0 command. ABR1 would then advertise a default route into the area, as an LSA Type 3, and not advertise any of the other Type 3 LSAs known from area 0. The routers inter- +nal to area 1 would use their default route for packets destined to unknown destination addresses, but the ABRs would have full knowledge of the routes inside the enterprise and know how to forward the packets at that point. + +Even though you can use the summary-address and area range commands, most engi-neers use other methods to introduce and control default routes inside an OSPF domain. The first tool, the default-information originate OSPF subcommand, introduces a default route to be flooded throughout the OSPF domain. As a result, it is most useful for default routing to draw packets toward ASBRs connected to external networks. The other tool, stub areas, focuses on the other common use of default routes, controlling when ABRs flood default routes into a given area. This section examines both topics. + +Domain-Wide Defaults Using the default-information originate Command + +The OSPF subcommand default-information originate tells OSPF to create a Type 5 LSA (used for external routes) for a default route—0.0.0.0/0—and flood it like any other Type + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 363 + +5 LSA. In other words, it tells the router to create and flood information about a default route throughout the OSPF domain. + +For example, consider a typical single multihomed Internet design, as shown in Figure 9-7. In this case, the enterprise has two Internet-connected routers, and the engineer wants to use default routing inside the enterprise to cause all the enterprise routers to send packets toward either ASBR1 or ASBR2. + + +OSPF Default +Area 12 Area 0 Metric 1 Default Route + + +ISP1 + + +BGP +B1 WAN1 Core1 ASBR2 10 Mbps I1-1 + + + + +B2 + +ISP3 Default Route + + +B3 WAN2 Core2 +Area 3 + +BGP +ASBR1 T/1 I2-1 + +OSPF +Default +Metric 30 ISP2 + + +Figure 9-7 Single Multihomed Internet Design Using Default Routes + +The default-information originate command tells the ASBRs to flood a default route into OSPF, but only if the ASBR itself has a default route in its IP routing table. This logic relies on the fact that the ASBRs typically either have a static default route pointing to the connected ISP router, or they learn a default route from the ISP using BGP. (In Figure 9-7, each ISP is advertising a default route.) All the routers then learn a default route, based on the Type 5 LSAs for 0.0.0.0/0 as flooded by the ASBRs. + +Because a router withdraws its OSPF default route when its own IP route to 0.0.0.0/0 fails, OSPF allows the design in Figure 9-7 to fail over to the other default route. When all is well, both ISP1 and ISP2 advertise a default route to the enterprise using BGP, so both ASBR1 and ASBR2 have a route to 0.0.0.0/0. As shown in the figure, ASBR2 has been configured to advertise its OSPF default with a lower metric (1) than does ASBR1 (metric 30). Therefore, the enterprise routers will forward traffic to the Internet through ASBR2. However, if ISP1 quits advertising that default with BGP, or if BGP fails between ASBR2 and ISP1’s I1-1 router, ASBR2 will withdraw its OSPF default route. The only remain- +ing OSPF default route will be the one that leads to ASBR1, making use of the backup default route. + + + + + + + +From the Library of Alexey Evseenko +364 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The full command syntax, as shown here, provides several optional parameters that impact its operation: +default-information originate [ always] [metric metric-value] [ metric-type type-value] [route-map map-name] + +The following list summarizes the features of the default-information originate OSPF subcommand: + +■ With all default parameters, it injects a default route into OSPF, as an External Type 2 route, using a Type 5 LSA, with metric 1, but only if a default route exists in that router’s routing table. + +■ With the always parameter, the default route is advertised even if there is no default route in the router’s routing table. + +■ The metric keyword defines the metric listed for the default route (default 1). + +■ The metric-type keyword defines whether the LSA is listed as external Type 1 or external Type 2 (default). + +■ The decision of when to advertise, and when to withdraw, the default route is based on matching the referenced route-map with a permit action. + +When configured, OSPF will flood the default route throughout the OSPF routing domain, drawing traffic to each ASBR, as shown earlier in Figure 9-6. + + +Note The type of external OSPF route (Type 1 or Type 2) is explained more fully in Chapter 10. + + + +Stubby Areas + +As mentioned earlier, the two most common reasons to consider using default routes are to drive all Internet-destined traffic toward Internet-connected routers in an enterprise and to drive traffic inside an area toward an ABR in that area. This second design choice allows the routers in an area to use default routes for forwarding packets to ABRs, rather than more specific routes. Using default routes inside an area reduces memory consump-tion and CPU processing time on routers inside the area, because the routers in that area can have fewer LSAs in their LSDBs. + +The OSPF stub router feature provides engineers with a very simple way to enable the function of flooding default routes inside an area, with those default routes driving IP packets back toward the ABRs attached to that area. ABRs in stub areas advertise a default route into the stub area. At the same time, the ABR chooses to not advertise +external routes (Type 5 LSAs) into the area. Similarly, the ABR chooses to not advertise interarea routes (in Type 3 LSAs) into the area. As a result, all routers in the stub area can still route to the destinations (based on default route information), and the routers require less memory and processing. + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 365 + +The following list summarizes these features of stub areas for easier study and review: + +■ ABRs create a default route, using a Type 3 LSA, listing subnet 0.0.0.0 and mask 0.0.0.0, and flood that into the stub area. + +■ ABRs do not flood Type 5 LSAs into the stub area. + +■ ABRs might not flood other Type 3 LSAs into the area. + +■ The default route has a metric of 1 unless otherwise configured using the router sub-command area area-num default-cost cost. + +■ Routers inside stub areas cannot redistribute external routes into the stubby area, because that would require a Type 5 LSA in the area. + +■ All routers in the area must be configured to be stubby; if not, neighbor relationships cannot form between potential neighbors based on this mismatched configuration. + +Figure 9-8 shows a familiar design in which area 34 will become a stub area. The design shows three external routes and lists three of many internal routes inside area 0. The fig-ure shows ABRs R1 and R2 advertising defaults into area 34. + + +Area 34 + + +Default +R3 R1 + +Area 0 External 11.11.0.0/16 11.12.0.0/16 11.13.0.0/16 + + + +Default + + +Default + +SW1 Data Center 10.16.11.0/24 10.16.12.0/24 10.16.13.0/24 + + + +R4 Default R2 +SW2 + + +Figure 9-8 Stubby Area Design + +Figure 9-8 demonstrates the core feature common to all types of stub areas: The ABRs flood a default route into the area. The routers inside the area can then calculate their best default route. Next, the text examines the different types of OSPF areas, before moving on to the details of configuration and verification. + +Introducing Stubby Area Types + +Even within the realm of stubby areas, four types of stubby areas exist: stub, totally stubby, not-so-stubby areas (NSSA), and totally NSSA. + + + + + + +From the Library of Alexey Evseenko +366 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Two types of stubby areas have the word “totally” as part of the name, and two do not. The differences between those with the word “totally” and those without have to do with whether Type 3 LSAs are flooded into the area. The rules are + +■ For all types of stubby areas, the ABR always filters Type 5 (external) LSAs. + +■ For totally stubby and totally NSSA areas, the ABR also filters Type 3 LSAs. + +■ For stubby and NSSA areas—those without the word “totally” in the name—the ABRs do not filter Type 3 LSAs, advertising Type 3 LSAs as normal. + +For example, consider the diagram shown in Figure 9-8, with area 34 as simply a stub area. As for all types, the ABRs each advertise a default route into area 34. As for all stubby area types, the ABRs filter all Type 5 LSAs, which means that the three Type 5 LSAs for 11.11.0.0/16, 11.12.0.0/16, and 11.13.0.0/16 would not exist in the LSDBs for area 34. Finally, because the area is not a totally stubby area, the ABRs do create and flood Type 3 LSAs for interarea routes as usual. So, they flood LSAs for the 10.16.11.0/24, 10.16.12.0/24, and 10.16.13.0/24 subnets listed in the figure. + +Next, consider a similar scenario but with a totally stubby area for area 5, as seen back in Figure 9-3. As for all stubby area types, the ABRs each advertise a default route into area 5. As for all stubby area types, the ABRs filter all Type 5 LSAs, which means that the three Type 5 LSAs for 11.11.0.0/16, 11.12.0.0/16, and 11.13.0.0/16 would not exist in the LSDBs for area 5. The key difference exists in that the ABRs also would not create and flood Type 3 LSAs for interarea routes as usual, so they would not advertise Type 3 LSAs for the 10.16.11.0/24, 10.16.12.0/24, and 10.16.13.0/24 subnets listed in the figure into area 5. + +The other difference in stubby area types relates to whether the name uses NSSA (NSSA or totally NSSA) or not (stubby, totally stubby). Stubby area types that use the NSSA name can redistribute external routes into the area; stubby area types without NSSA in the name cannot. + +Configuring and Verifying Stubby Areas + +Configuring stub and totally stubby areas requires only three commands, but with at least one command on each router, as listed in Table 9-3. + + +Table 9-3 +Key +Topic Action + +Stubby + + +Stub Area Configuration Options + +Configuration Steps +Configure area area-id stub on each router in the area. + + + +Totally stubby + + + + +Set the metric of the default route + + +Configure the area area-id stub no-summary command on the ABRs. + +Configure area area-id stub, without the no-summary keyword, on all other routers in the area. + +Configure area area-id default-cost metric on an ABR (can differ from ABR to ABR). Default value is 1. + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 367 + + +Note For totally stubby areas, only the ABRs must have the no-summary keyword on the area area-id stub no-summary command. However, including this keyword on internal routers does not cause a problem. + + +Figure 9-9 shows a more detailed view of area 34 from Figure 9-8. By making area 34 a stub area, ABRs R1 and R2 will not flood Type 3 LSAs into area 34—other than the +Type 3 LSAs for the default routes. Example 9-5 shows the configuration on Routers R1, R2, and R3 from Figure 9-9. + +Area 34 (Stubby) + + + + + + +Fa0/0 10.10.34.3/24 + + + + +Fa0/0 10.10.34.4/24 + +S0/0/0.1 13.3 +R3 +S0/0/0.2 23.3 + +S0/0/0.1 14.4 +R4 +S0/0/0.2 24.4 + + +S0/0/0.3 13.1 +R1 S0/0/0.4 +14.1 + + + + + +S0/0/0.3 23.2 + +S0/0/0.4 +24.2 R2 + + +Figure 9-9 Detailed View of Area 34 + +Example 9-5 Stub Area Configuration + +! On Router R1: +router ospf 1 +area 34 stub +auto-cost reference-bandwidth 1000 +! +interface s0/0/0.3 point-to-point +ip ospf 1 area 34 +! +interface s0/0/0.4 point-to-point + + + + + +From the Library of Alexey Evseenko +368 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ip ospf 1 area 34 + +! On Router R2: +router ospf 2 +area 34 stub +auto-cost reference-bandwidth 1000 +! +interface s0/0/0.3 point-to-point +ip ospf 2 area 34 +! +interface s0/0/0.4 point-to-point +ip ospf 2 area 34 + +! On Router R3: +router ospf 3 +area 34 stub +auto-cost reference-bandwidth 1000 +! +interface s0/0/0.1 point-to-point +ip ospf 3 area 34 +ip ospf 3 cost 500 +! +interface s0/0/0.2 point-to-point +ip ospf 3 area 34 +! +interface fa0/0 +ip ospf 3 area 34 + +With the configuration as shown, both R1 and R2 will inject a default route, represented as a Type 3 LSA, with default metric 1. They will also not flood the Type 5 LSAs into area 34. Example 9-6 confirms these facts, showing the Type 3 LSA for the summary, and the absence of Type 5 LSAs in the output of the show ip ospf database command on Router R3. + +Example 9-6 Evidence of Type 5 LSAs Existing, Disappearing, and Defaults Appearing + +! Before making Area 34 stubby: + +R3# show ip ospf database | begin AS External +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +11.11.0.0 +12.12.0.0 +13.13.0.0 + +7.7.7.7 929 +7.7.7.7 845 +7.7.7.7 835 + +0x80000001 +0x80000001 +0x80000001 + +0x00016D 0 +0x00E784 0 +0x00CE9B 0 + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 369 + +! After making area 34 stubby – no output from the next command. + +R3# show ip ospf database | begin AS External +R3# + +! The database for area 34 now has two Type 3 LSAs for default routes. +R3# show ip ospf database + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Router Link States (Area 34) + +! Lines omitted for brevity – skipped to "Summary Net" (Type 3) section + +Summary Net Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum + +0.0.0.0 +0.0.0.0 +10.10.5.0 +10.10.5.0 +10.10.12.0 +10.10.12.0 + +1.1.1.1 692 +2.2.2.2 686 +1.1.1.1 692 +2.2.2.2 686 +1.1.1.1 692 +2.2.2.2 686 + +0x80000001 0x0093A6 +0x80000001 0x0075C0 +0x8000000E 0x00445C +0x8000000F 0x002477 +0x8000000E 0x0054AF +0x8000000E 0x0036C9 + +! Many Type 3 LSAs omitted for brevity's sake + +Example 9-6 shows the existence of the Type 5 external LSAs before area 34 became a stubby area, and the disappearance of those same LSAs after it was made a stubby area. The show ip ospf database command then shows two LSAs that list default routes, one learned from RID 1.1.1.1 (R1) and one learned from RID 2.2.2.2 (R2). + +Example 9-7 continues the verification of how stub areas work with three more commands. + +Example 9-7 Three External Routes Before and None After Changing to Stubby + +! Next, R3 confirms it thinks area 34 is a stub area +R3# show ip ospf +Routing Process "ospf 3" with ID 3.3.3.3 +Start time: 00:00:38.756, Time elapsed: 07:51:19.720 +! lines omitted for brevity +Area 34 +Number of interfaces in this area is 3 +It is a stub area +Area has no authentication +SPF algorithm last executed 00:11:21.640 ago +SPF algorithm executed 18 times +Area ranges are + + + + +From the Library of Alexey Evseenko +370 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Number of LSA 29. Checksum Sum 0x0D3E01 +Number of opaque link LSA 0. Checksum Sum 0x000000 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 + +! The next command shows all Type 3 (summary) LSAs of prefix 0.0.0.0 + +R3# show ip ospf database summary 0.0.0.0 + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Summary Net Link States (Area 34) + +Routing Bit Set on this LSA +LS age: 879 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 0.0.0.0 (summary Network Number) +Advertising Router: 1.1.1.1 +LS Seq Number: 80000001 +Checksum: 0x93A6 +Length: 28 +Network Mask: /0 +TOS: 0 Metric: 1 + +LS age: 873 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 0.0.0.0 (summary Network Number) +Advertising Router: 2.2.2.2 +LS Seq Number: 80000001 +Checksum: 0x75C0 +Length: 28 +Network Mask: /0 +TOS: 0 Metric: 1 +! The next command lists statistics of the number of LSAs of each type – +! note a total of 0 Type 5 LSAs, but many Type 3 LSAs + +R3# show ip ospf database database-summary + +OSPF Router with ID (3.3.3.3) (Process ID 3) + +Area 34 database summary +LSA Type Count Delete Maxage + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 371 + +Router 4 0 0 +Network 1 0 0 +Summary Net 24 0 0 +Summary ASBR 0 0 0 +Type-7 Ext 0 0 0 +Prefixes redistributed in Type-7 0 +Opaque Link 0 0 0 +Opaque Area 0 0 0 +Subtotal 29 0 0 + +Process 3 database summary + +LSA Type Count +Router 4 +Network 1 +Summary Net 24 +Summary ASBR 0 +Type-7 Ext 0 +Opaque Link 0 +Opaque Area 0 +Type-5 Ext 0 + +Delete Maxage +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 + +Prefixes redistributed in Type-5 0 +Opaque AS 0 0 0 +Non-self 28 +Total 29 0 0 + +Following are the three commands in Example 9-7, in order: + +■ show ip ospf: Confirms with one (highlighted) line that the router believes the area is a stub area. + +■ show ip ospf database summary 0.0.0.0: By definition, this command lists all sum-mary (Type 3) LSAs with a prefix of 0.0.0.0. It lists two such LSAs, created by R1 and R2 (RIDs 1.1.1.1 and 2.2.2.2, respectively), both with metric 1 (the default setting). + +■ show ip ospf database database-summary: This command lists statistics about the numbers of and types of LSAs in the database. The counters show 0 Type 5 LSAs, and several Type 3 LSAs—confirming that the area, while stubby, is not totally stubby. + + +Configuring and Verifying Totally Stubby Areas + +Configuring totally stubby areas requires almost no additional effort as compared with stubby areas. As listed earlier in Table 9-3, the only difference for totally stubby configu-ration versus stubby configuration is that the ABRs include the no-summary keyword on the area stub command. (no-summary refers to the fact that ABRs in totally stubby areas do not create/flood Type 3 summary LSAs.) + + + + + +From the Library of Alexey Evseenko +372 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 9-7 shows another example configuration, this time with area 34 as a totally stubby area. Additionally, the default routes’ metrics have been set so that both R3 and R4 will use R1 as their preferred ABR, by setting R2’s advertised summary to a relatively high metric (500). Example 9-8 just shows the changes to the configuration shown in Example 9-4. + +Example 9-8 Totally Stubby Area Configuration + +! On Router R1: +router ospf 1 +area 34 stub no-summary +auto-cost reference-bandwidth 1000 + +! On Router R2: +router ospf 2 +area 34 stub no-summary +area 34 default-cost 500 +auto-cost reference-bandwidth 1000 + +The configuration of a totally stubby area reduces the size of the LSDB in area 34, because the ABRs no longer flood Type 3 LSAs into area 34, as shown in Example 9-9. R3 displays its LSDB, listing only two Summary (Type 3) LSAs—the two default routes advertised by the two ABRs, respectively. No other Type 3 LSAs exist, nor do any exter-nal (Type 5) or ASBR summary (Type 4) LSAs. + +Also, note that the example lists the OSPF routes known to R3. Interestingly, in the topol-ogy shown for area 34, R3 learns only three OSPF routes: the two intra-area routes for the subnets between R4 and the two ABRs plus the best default route. The default route has a metric of 501, based on R3’s S0/0/0.1 interface cost plus the cost 1 listed for R1’s Type 3 LSA for the default route. + +Example 9-9 Confirmation of the Effects of a Totally Stubby Area + +R3# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 10.10.13.1 to network 0.0.0.0 + +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks +C 10.10.13.0/29 is directly connected, Serial0/0/0.1 +O 10.10.14.0/29 [110/657] via 10.10.34.4, 00:57:37, FastEthernet0/0 +C 10.10.23.0/29 is directly connected, Serial0/0/0.2 + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 373 + +O 10.10.24.0/29 [110/657] via 10.10.34.4, 00:57:37, FastEthernet0/0 +C 10.10.34.0/24 is directly connected, FastEthernet0/0 +O*IA 0.0.0.0/0 [110/501] via 10.10.13.1, 00:24:35, Serial0/0/0.1 + +R3# show ip ospf database database-summary + +OSPF Router with ID (3.3.3.3) (Process ID 3) +! lines omitted for brevity + +Process 3 database summary + +LSA Type Count +Router 4 +Network 1 +Summary Net 2 +Summary ASBR 0 +Type-7 Ext 0 +Opaque Link 0 +Opaque Area 0 +Type-5 Ext 0 + +Delete Maxage +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 + +Prefixes redistributed in Type-5 0 +Opaque AS 0 0 0 +Non-self 6 +Total 7 0 0 + +R3# show ip ospf database | begin Summary +Summary Net Link States (Area 34) + +Link ID ADV Router Age Seq# Checksum + +0.0.0.0 +0.0.0.0 + +1.1.1.1 +2.2.2.2 + +1407 0x80000003 0x008FA8 +1506 0x80000004 0x00FF3E + + +Following are the three commands in Example 9-9, in order: + +■ show ip route: It lists a single interarea route—a default route, with destination 0.0.0.0/0. The output also lists this same next-hop information as the gateway of last resort. + +■ show ip ospf database database-summary: The statistics still show no external Type 5 LSAs, just as when the area was stubby, but now show only two Type 3 LSAs, whereas before, several existed. + +■ show ip ospf database | begin Summary: This command shows the output begin-ning with the Type 3 Summary LSAs. It lists two default route LSAs: one from R1 and one from R2. + +Examples 9-7 and 9-9 demonstrate the key differences between stub areas (they do see Type 3 LSAs) and totally stubby areas (which do not see Type 3 LSAs). Next, this section looks at the different types of not-so-stubby areas. + + + + +From the Library of Alexey Evseenko +374 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The Not-So-Stubby Area (NSSA) + +Stub and totally stubby areas do not allow external routes to be injected into a stubby area—a feature that originally caused some problems. The problem is based on the fact that stub areas by definition should never learn a Type 5 LSA, and OSPF injects exter-nal routes into OSPF as Type 5 LSAs. These two facts together mean that a stubby area could not normally have an ASBR that was injecting external routes into the stub area. + +The not-so-stubby area (NSSA) option for stubby areas overcomes the restriction on external routes. The solution itself is simple: Because stubby areas can have no Type 5 LSAs, later OSPF RFCs defined a newer LSA type (Type 7) that serves the same purpose as the Type 5 LSA, but only for external routes in stubby areas. So, an NSSA area can act just like a stub area, except that routers can inject external routes into the area. + +Figure 9-10 shows an example, with four steps. The same stubby area 34 from the last few figures still exists; it does not matter at this point whether area 34 is totally stubby or simply stubby. + +1 EIGRP Area 34 Area 0 + +2 redistribute eigrp + + + +R3 R9 + +R1 +3 Type 7 +LSAs 4 SW1 + +Type 5 LSAs + + +R4 R2 + +SW2 + +Figure 9-10 External Routes in an NSSA (34) + +The steps labeled in the figure are as follows: + +Step 1. ASBR R3 learns routes from some external source of routing information, in this case, EIGRP from R9. + +Step 2. An engineer configures route redistribution using the redistribute command, taking the routes learned with EIGRP and injecting them into OSPF. + +Step 3. R3 floods Type 7 LSAs throughout stub area 34. + +Step 4. ABRs R1 and R2 then create Type 5 LSAs for the subnets listed in the Type 7 LSAs, and flood these Type 5 LSAs into other areas, like area 0. + +Configuring NSSA works much like the configuration of stubby areas. For totally NSSAs, configure area area-number nssa no-summary instead of area area-number stub +no-summary. For normal NSSAs, as with stub areas, omit the no-summary keyword. + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 375 + +Additionally, normal NSSAs require that ABRs have the default-information-originate keyword specified, making the command on ABRs area area-number nssa default-information-originate. + +Example 9-10 shows a sample with the configuration of a totally NSSA 34 from the net-work represented in the last four figures. Note that as with the area stub command, the area nssa command’s no-summary option is required only on the ABRs. + +Example 9-10 Totally NSSA Configuration and Verification + +! On Router R1: +router ospf 1 +area 34 nssa no-summary + +! On Router R2: +router ospf 2 +area 34 nssa no-summary +area 34 default-cost 500 + +! On Router R3: +router ospf 3 +area 34 nssa + +! On Router R4: +router ospf 4 +area 34 nssa + +The same verification steps and commands can be used for NSSAs as were shown in the earlier examples for stub areas. In particular, the show ip ospf command states that the area is an NSSA. You can also see Type 7 LSAs in the OSPF LSDB after redistribution has been configured. + +Table 9-4 summarizes the key points regarding stubby areas. + + + +Table 9-4 OSPF Stubby Area Types +Key +Topic Area Type ABRs Flood Type 5 External LSAs into the Area? + + + +ABRs Flood Type 3 Summary LSAs into the Area? + + + +Allows Redistribution of External LSAs into the Stubby Area? + +Stub No Yes No + +Totally stubby No No No + +NSSA No Yes Yes + +Totally NSSA No No Yes + + + + + + + + +From the Library of Alexey Evseenko +376 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note Both types of totally stubby areas (totally stubby, totally NSSA) are Cisco proprietary. + + + +OSPF Version 3 + +The OSPF discussions thus far in this book focused on OSPF version 2 (OSPFv2). While OSPFv2 is feature-rich and widely deployed, it does have one major limitation in that it does not support the routing of IPv6 networks. Fortunately, OSPF version 3 (OSPFv3) does support IPv6 routing, and it can be configured to also support IPv4 routing. + +This section discusses two OSPFv3 configuration options: + +■ The traditional approach + +■ The OSPF Address Family approach + +The OSPF Address Family configuration approach is somewhat similar to Named EIGRP configuration, where you can have an IPv4 Address Family and an IPv6 Address Family hierarchically configured under the same routing protocol instance. + +This section begins by discussing some of the similarities and differences between OSPFv2 and OSPFv3. Then, the traditional OSPFv3 configuration is presented, followed by an explanation of the OSPF Address Family approach. + +OSPFv2 and OSPFv3 Comparison + +OSPFv3 bears many similarities to OSPFv2. For example, they both use interface cost as their metric; the same network types exist (that is, broadcast, point-to-point nonbroad-cast, multiaccess, and virtual links); the same packet types are used; and LSAs behave in much the same way. + +However, a couple of OSPFv2 LSA types are renamed, and a couple of new LSAs are introduced. The LSA changes are as follows: + +■ Renamed LSAs: +Key +Topic ■ Type 3: The Type 3 LSA is renamed as Interarea prefix LSA for ABRs. As with OSPFv2, this Type 3 LSA advertises one area’s internal networks with another area. This LSA is generated by an area border router (ABR). +■ Type 4: The Type 4 LSA is renamed Interarea prefix LSA for ASBRs. As with OSPFv2, this Type 4 LSA advertises information about how to reach an au-tonomous system boundary router (ASBR) to routers in a different area than the ASBR. Then, those routers wanting to reach an external network (that is, outside the OSPF autonomous system) use the Type 4 LSAs to determine the best path to reach the ASBR that will get them to a desired external network. + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 377 + +■ New LSAs: + +■ Type 8: The Type 8 LSAs, called Link LSAs, only exist on a local link, where they are used by a router to advertise the router’s link-local address to all other routers on the same link. Additionally, the Type 8 LSA provides to routers on that link a listing of all IPv6 addresses associated with the link. OSPFv3 also uses the Type 8 LSA to set option bits for a specific network’s LSA. These bits give OSPFv3 more information about the nature of a network advertisement. As just one example, the NU (no unicast) bit indicates that a network should not be used in OSPF calculations. See RFC 5340 for a complete discussion of the option bits. +■ Type 9: Type 9 LSAs, called Intra-Area Prefix LSAs, can send information about IPv6 networks (including stub networks) attached to a router (similar to the Type 1 LSA for IPv4 networks). Additionally, a Type 9 LSA can send information about transit IPv6 network segments within an area (similar to the Type 2 LSA for IPv4 networks). + +OSPFv3 Traditional Configuration + +The traditional approach to OSPFv3 configuration involves creating an OSPF routing process, going into the interfaces that you want to participate in the OSPF process, and instructing those interfaces to be part of that process. + +The steps required to configure OSPFv3 using the traditional approach are as follows: + + +Key Step 1. Topic + + + +Step 2. + + +Step 3. + + + + + + + +Step 4. + + +Enable IPv6 unicast routing on the router (if it is not already enabled). This can be accomplished with the ipv6 unicast-routing global configuration mode command. Although not required, a best practice is to also enable Cisco Express Forwarding (CEF) for IPv6, using the ipv6 cef command, because CEF enables the router to make more efficient route lookups. + +Start the OSPF process with the ipv6 router ospf process-id command, issued in global configuration mode. + +(Optional) Configure a router ID for the OSPF process with the router-id rid command, where the rid is a 32-bit value, in router configuration mode. This router ID is commonly an IPv4 address of one of the router’s interfaces. If you do not statically configure a router ID, the router attempts to dynamically determine a router ID to use based on currently active IPv4 addresses on the router. However, if you do not set a router ID, and no active IPv4 addresses exist on the router, the OSPF process will fail to start. + +Instruct one or more interfaces to participate in the OSPF routing process by entering the ipv6 ospf process-id area area_number command in interface +configuration mode. + + +To illustrate the traditional approach to OSPFv3 configuration, Examples 9-11, 9-12, 9-13, and 9-14 show a sample OSPFv3 configuration for the topology illustrated in Figure 9-11. + + + + + + + +From the Library of Alexey Evseenko +378 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Fa0/0 2006::1/64 + +R4 SW3 +S1/0 +2005::2/64 +Area 2 + + +Lo0 +1.1.1.1/32 Lo0 2007::1111/64 2.2.2.2/32 +Fa0/0 2007::2222/64 2001::1/64 2002::1/64 +S1/1 +2005::1/64 +Fa0/1 +R1 Fa0/0 R2 2002::2/64 +SW1 +Area 0 + + +Lo0 4.4.4.4/32 +Frame 2007::4444/64 Relay +Fa0/0 +S1/0 +PPP2003::2/64 2004::1/64 +S1/0 R3 +2003::1/64 SW2 +Area 1 Lo0 3.3.3.3/32 +2007::3333/64 + + +Figure 9-11 Sample IPv6 OSPFv3 Topology with Multiple Areas + +Example 9-11 Traditional OSPFv3 Configuration—Router R1 Key +Topic ! Configuration on Router R1 +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 1.1.1.1 255.255.255.255 +ipv6 address 2007::1111/64 +ipv6 ospf 1 area 0 +! +interface FastEthernet0/0 +ip address 10.1.1.1 255.255.255.0 +ipv6 address 2001::1/64 +ipv6 ospf 1 area 0 +! +interface FastEthernet0/1 +ip address 10.1.2.1 255.255.255.252 +ipv6 address 2002::1/64 +ipv6 ospf 1 area 0 +! +ipv6 router ospf 1 +router-id 1.1.1.1 +passive-interface FastEthernet0/0 +passive-interface Loopback0 + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 379 + +Example 9-12 Traditional OSPFv3 Configuration—Router R2 + +!Configuration on Router R2 +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 2.2.2.2 255.255.255.255 +ipv6 address 2007::2222/64 +ipv6 ospf 1 area 0 +! +interface FastEthernet0/0 +ip address 10.1.2.2 255.255.255.252 +ipv6 address 2002::2/64 +ipv6 ospf 1 area 0 +! +interface Serial1/0 +ip address 10.1.2.5 255.255.255.252 +encapsulation ppp +ipv6 address 2003::1/64 +ipv6 ospf 1 area 1 +! +interface Serial1/1 +ip address 10.1.2.9 255.255.255.252 +encapsulation frame-relay IETF +ipv6 address 2005::1/64 +ipv6 ospf 1 area 2 +frame-relay map ipv6 2005::2 204 broadcast +frame-relay map ipv6 FE80::C804:DFF:FE24:0 204 broadcast +frame-relay map ip 10.1.2.10 204 broadcast +! +ipv6 router ospf 1 +router-id 2.2.2.2 +passive-interface Loopback0 + + +Example 9-13 Traditional OSPFv3 Configuration—Router R3 + +!Configuration on Router R3 +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 3.3.3.3 255.255.255.255 +ipv6 address 2007::3333/64 +ipv6 ospf 1 area 1 +! +interface FastEthernet0/0 + + + + +From the Library of Alexey Evseenko +380 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ip address 10.1.3.1 255.255.255.0 +ipv6 address 2004::1/64 +ipv6 ospf 1 area 1 +! +interface Serial1/0 +ip address 10.1.2.6 255.255.255.252 +encapsulation ppp +ipv6 address 2003::2/64 +ipv6 ospf 1 area 1 +! +ipv6 router ospf 1 +router-id 3.3.3.3 +passive-interface FastEthernet0/0 +passive-interface Loopback0 + + +Example 9-14 Traditional OSPFv3 Configuration—Router R4 + +!Configuration on Router R4 +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 4.4.4.4 255.255.255.255 +ipv6 address 2007::4444/64 +ipv6 ospf 1 area 2 +! +interface FastEthernet0/0 +ip address 10.1.4.1 255.255.255.0 +ipv6 address 2006::1/64 +ipv6 ospf 1 area 2 +! +interface Serial1/0 +ip address 10.1.2.10 255.255.255.252 +encapsulation frame-relay IETF +ipv6 address 2005::2/64 +ipv6 ospf 1 area 2 +frame-relay map ipv6 2005::1 402 broadcast +frame-relay map ipv6 FE80::C802:1FF:FEC0:0 402 broadcast +frame-relay map ip 10.1.2.9 402 broadcast +! +ipv6 router ospf 1 +router-id 4.4.4.4 +passive-interface FastEthernet0/0 +passive-interface Loopback0 + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 381 + +In each of the four preceding examples, notice that an OSPF routing process was started with the ipv6 router ospf process-id command, and a router ID was associated with each routing process using the router-id rid command. Additionally, under router con-figuration mode, a passive-interface interface-id command was issued for each interface not connecting to another OSPF-speaking router. This prevents unnecessarily sending OSPF messages out of those interfaces. + +These examples illustrate how an interface is made to participate in an OSPFv3 routing process. Specifically, you enter interface configuration mode and enter the ipv6 ospf process-id area area_number command. + + +Note Routers R2 and R4 have a series of frame-relay map commands. This is because these configurations are for IPv6 over Frame Relay, an NBMA network. Interestingly, on some NBMA networks, you need to statically configure the mapping of IPv6 addresses to Layer 2 circuit identifiers (for example, Data-Link Connection Identifiers [DLCI] in Frame Relay networks). + + +Verification can be performed using the same commands you used to verify OSPFv2 configurations, except ip is replaced with ipv6. For example, instead of issuing the show ip ospf interface brief command, as you would with OSPFv2 to get a brief listing of OSPF-speaking interfaces, you would issue the show ipv6 ospf interface brief command for OSPFv3. The following examples provide sample output from a collection of verifica-tion commands. + +Example 9-15 shows sample output from the show ipv6 ospf interface brief command, issued on Router R2. The output from this command indicates that four interfaces on Router R2 are participating in the OSPFv3 routing process, along with the area mem-bership for each interface. Additionally, the interface costs are listed and the number of neighbors (if any) residing off of each interface is listed. + +Example 9-15 Viewing Interfaces Participating in an OSPFv3 Process + +R2# show ipv6 ospf interface brief +Interface PID Area Intf ID Cost State Nbrs F/C + +Lo0 1 0 +Fa0/0 1 0 +Se1/0 1 1 +Se1/1 1 2 + +8 1 LOOP 0/0 +2 1 BDR 1/1 +3 64 P2P 1/1 +4 64 DR 0/0 + + +In Example 9-16, the show ipv6 ospf neighbor command is used to create a listing of OSPFv3 neighbors. Interestingly, while Routers R1 (1.1.1.1) and R3 (3.3.3.3) are neighbors, Router R2 is not a neighbor. + + + + + + + + +From the Library of Alexey Evseenko +382 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 9-16 Viewing OSPFv3 Neighbors + +R2# show ipv6 ospf neighbor + +OSPFv3 Router with ID (2.2.2.2) (Process ID 1) + + +Neighbor ID +1.1.1.1 + +Pri State +1 FULL/DR + +Dead Time +00:00:36 + +Interface ID +3 + +Interface +FastEthernet0/0 + +3.3.3.3 0 FULL/ - 00:00:30 3 Serial1/0 + +Before reading on, pause for a moment and consider what might be happening to prevent this neighborship from forming. Recall that a nonbroadcast multiaccess (NBMA) net-work, as the name suggests, does not support broadcasts (or multicasts). Therefore, rout-ers belonging to an NBMA network do not dynamically discover one another. Instead, you need to statically configure a neighbor on at least one of the routers on the NBMA network. + +To resolve the specific issue seen in Example 9-16 , an ipv6 ospf neighbor neighbor_ ipv6_address command is given on Router R2, pointing to Router R4’s link-local address for the Frame Relay link interconnecting Routers R2 and R4. This command is shown +in Example 9-17, along with a verification that Router R4 then appears as Router R2’s neighbor. + +Example 9-17 Statically Configuring a Neighbor on an NBMA Network + +R2# conf term +R2(config)# interface s 1/1 +R2(config-if)# ipv6 ospf neighbor FE80::C804:DFF:FE24:0 +R2(config-if)# end +R2# show ipv6 ospf neigh + +OSPFv3 Router with ID (2.2.2.2) (Process ID 1) + + +Neighbor ID +1.1.1.1 + +Pri State +1 FULL /DR + +Dead Time +00:00:35 + +Interface ID +3 + +Interface +FastEthernet0/0 + +3.3.3.3 0 FULL / - 00:00:32 3 Serial1/0 +4.4.4.4 1 FULL /DR 00:01:42 3 Serial1/1 + +As a final OSPFv3 verification command, consider the output of the show ipv6 ospf database command issued on Router R1, as seen in Example 9-18. + +Example 9-18 Viewing the Contents of the OSPFv3 Link-State Database + +R1# show ipv6 ospf database + +OSPFv3 Router with ID (1.1.1.1) (Process ID 1) + +Router Link States (Area 0) + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 383 + + +ADV Router Age +1.1.1.1 1490 +2.2.2.2 1491 + +Seq# +0x80000002 +0x80000001 + +Fragment ID +0 +0 + +Link count Bits +1 None +1 B + + +Net Link States (Area 0) + + +ADV Router Age +1.1.1.1 1490 + +Seq# Link ID +0x80000001 3 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 0) + + +ADV Router Age +2.2.2.2 1482 +2.2.2.2 1482 +2.2.2.2 1342 +2.2.2.2 1259 +2.2.2.2 147 +2.2.2.2 147 + +Seq# +0x80000001 +0x80000001 +0x80000001 +0x80000001 +0x80000001 +0x80000001 + +Prefix +2003::/64 +2005::/64 +2007::3333/128 +2004::/64 +2007::4444/128 +2006::/64 + + +Link (Type-8) Link States (Area 0) + + +ADV Router Age +1.1.1.1 1855 +2.2.2.2 1491 +1.1.1.1 1876 + +Seq# Link ID +0x80000001 3 +0x80000001 2 +0x80000001 2 + +Interface +Fa0/1 +Fa0/1 +Fa0/0 + + +Intra Area Prefix Link States (Area 0) + + +ADV Router Age +1.1.1.1 1490 +1.1.1.1 1490 +2.2.2.2 1224 + +Seq# Link ID +0x80000004 0 +0x80000001 3072 +0x80000001 0 + +Ref-lstype +0x2001 +0x2002 +0x2001 + +Ref-LSID +0 +3 +0 + + +In the output shown in Example 9-18, Type 1 LSAs show up as Router Link States, just as they did with OSPFv2. Also like OSPFv3, Type 2 LSAs show up as Net Link States. However, the Type 3 LSAs have been renamed from Summary Net Link States to Inter-Area Prefix Link States. + +Also, as described earlier in this chapter, OSPFv3 introduces a couple of new LSA types, both of which are visible in this output. Specifically, OSPFv3 introduced Type 8 LSAs (which appear as Link (Type-8) Link States in the output) and Type 9 LSAs (which appear as Intra-Area Prefix Link States). For details about what these new LSA types do, refer to the “OSPFv2 and OSPFv3 Comparison” section, earlier in this chapter. + + + + + + + + +From the Library of Alexey Evseenko +384 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +OSPFv3 Address Family Configuration + +Somewhat similar to Named EIGRP, the OSPFv3 Address Family configuration approach lets you support the routing of both IPv4 and IPv6 under a single OSPF pro-cess. With such a configuration, there is a single link-state database containing informa-tion for both IPv4 and IPv6 networks. The steps to configure OSPFv3 using the Address Family approach are as follows: + +Step 1. Key +Topic +Step 2. + +Step 3. + + +Step 4. + + +Start the OSPFv3 routing process with the router ospfv3 process-id command. + +(Optional) Configure a router ID with the router-id rid command. + +Create an Address Family for IPv4 and/or IPv6 with the address-family {ipv4 | ipv6 } unicast command. + +Enter interface configuration mode for the interface(s) that you want to par-ticipate in the OSPF process, and enter the ospfv3 process-id {ipv4 | ipv6} +area area_number command. + + + +Note Even though the OSPFv3 Address Family configuration approach supports both IPv4 and/or IPv6 networks, it will not peer with a router using an OSPFv2 configuration. + + +Notice that the topology in Figure 9-12 is configured with both IPv4 and IPv6 addresses, and it is configured with OSPFv3. Examples 9-19, 9-20, 9-21, and 9-22 show the OSPFv3 configuration for each router, to support the routing of both IPv4 and IPv6 networks. + +Fa0/0 10.1.4.1/24 2006::1/64 + +R4 SW3 +S1/0 +10.1.2.10/30 +2005::2/64 +Area 2 + + +Lo0 +1.1.1.1/32 Lo0 2007::1111/64 2.2.2.2/32 +S1/1 +10.1.2.9/30 +2005::1/64 +Fa0/0 +10.1.1.1/24 +2001::1/64 +Fa0/1 2007::2222/64 10.1.2.1/30 2002::1/64 +R1 Fa0/0 R2 10.1.2.2/30 +SW1 +Area 0 2002::2/64 + +Lo0 4.4.4.4/32 +Frame 2007::4444/64 Relay Fa0/0 +S1/0 +PPP 10.1.2.6/30 10.1.3.1/24 +2004::1/64 +S1/0 2003::2/64 R3 +10.1.2.5/30 SW2 +2003::1/64 +Area 1 Lo0 3.3.3.3/32 +2007::3333/64 + + +Figure 9-12 Sample IPv4 and IPv6 OSPFv3 Address Family Topology with Multiple Areas + + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 385 + +Example 9-19 OSPFv3 Address Family Configuration on Router R1 Key +Topic ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 1.1.1.1 255.255.255.255 +ipv6 address 2007::1111/64 +ospfv3 1 ipv6 area 0 +ospfv3 1 ipv4 area 0 +! +interface FastEthernet0/0 +ip address 10.1.1.1 255.255.255.0 +ipv6 address 2001::1/64 +ospfv3 1 ipv6 area 0 +ospfv3 1 ipv4 area 0 +! +interface FastEthernet0/1 +ip address 10.1.2.1 255.255.255.252 +ipv6 address 2002::1/64 +ospfv3 1 ipv6 area 0 +ospfv3 1 ipv4 area 0 +! +router ospfv3 1 +router-id 1.1.1.1 +! +address-family ipv4 unicast +passive-interface FastEthernet0/0 +passive-interface Loopback0 +exit-address-family +! +address-family ipv6 unicast +passive-interface FastEthernet0/0 +passive-interface Loopback0 +maximum-paths 32 + + +Example 9-20 OSPFv3 Address Family Configuration on Router R2 + +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 2.2.2.2 255.255.255.255 +ipv6 address 2007::2222/64 +ospfv3 1 ipv6 area 0 +ospfv3 1 ipv4 area 0 +! + + + + +From the Library of Alexey Evseenko +386 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +interface FastEthernet0/0 +ip address 10.1.2.2 255.255.255.252 +ipv6 address 2002::2/64 +ospfv3 1 ipv6 area 0 +ospfv3 1 ipv4 area 0 +! +interface Serial1/0 +ip address 10.1.2.5 255.255.255.252 +encapsulation ppp +ipv6 address 2003::1/64 +ospfv3 1 ipv6 area 1 +ospfv3 1 ipv4 area 1 +! +interface Serial1/1 +ip address 10.1.2.9 255.255.255.252 +encapsulation frame-relay IETF +ipv6 address 2005::1/64 +ospfv3 neighbor FE80::C800:AFF:FE20:0 +ospfv3 1 neighbor FE80::C800:AFF:FE20:0 +ospfv3 1 ipv4 area 2 +ospfv3 1 ipv6 area 2 +frame-relay map ipv6 FE80::C800:AFF:FE20:0 204 broadcast +frame-relay map ip 10.1.2.10 204 broadcast +frame-relay map ipv6 2005::2 204 broadcast +! +router ospfv3 1 +router-id 2.2.2.2 +! +address-family ipv4 unicast +passive-interface Loopback0 +exit-address-family +! +address-family ipv6 unicast +passive-interface Loopback0 +maximum-paths 32 +area 2 stub no-summary +exit-address-family + + +Example 9-21 OSPFv3 Address Family Configuration on Router R3 + +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 4.4.4.4 255.255.255.255 +ipv6 address 2007::4444/64 + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 387 + +ospfv3 1 ipv6 area 2 +ospfv3 1 ipv4 area 2 +! +interface FastEthernet0/0 +ip address 10.1.4.1 255.255.255.0 +ipv6 address 2006::1/64 +ospfv3 1 ipv4 area 2 +ospfv3 1 ipv6 area 2 +! +interface Serial1/0 +ip address 10.1.2.10 255.255.255.252 +encapsulation frame-relay IETF +ipv6 address 2005::2/64 +ospfv3 1 neighbor FE80::C803:AFF:FEB8:0 +ospfv3 1 ipv4 area 2 +ospfv3 1 ipv6 area 2 +frame-relay map ipv6 FE80::C803:AFF:FEB8:0 402 broadcast +frame-relay map ip 10.1.2.9 402 broadcast +frame-relay map ipv6 2005::1 402 broadcast +! +router ospfv3 1 +router-id 4.4.4.4 +! +address-family ipv4 unicast +passive-interface FastEthernet0/0 +passive-interface Loopback0 +exit-address-family +! +address-family ipv6 unicast +passive-interface FastEthernet0/0 +passive-interface Loopback0 +area 2 stub no-summary +exit-address-family + + +Example 9-22 OSPFv3 Address Family Configuration on Router R4 + +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 3.3.3.3 255.255.255.255 +ipv6 address 2007::3333/64 +ospfv3 1 ipv4 area 1 +ospfv3 1 ipv6 area 1 +! +interface FastEthernet0/0 + + + + +From the Library of Alexey Evseenko +388 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ip address 10.1.3.1 255.255.255.0 +ipv6 address 2004::1/64 +ospfv3 1 ipv6 area 1 +ospfv3 1 ipv4 area 1 +! +interface Serial1/0 +ip address 10.1.2.6 255.255.255.252 +encapsulation ppp +ipv6 address 2003::2/64 +ospfv3 1 ipv6 area 1 +ospfv3 1 ipv4 area 1 +! +router ospfv3 1 +router-id 3.3.3.3 +! +address-family ipv4 unicast +passive-interface FastEthernet0/0 +passive-interface Loopback0 +exit-address-family +! +address-family ipv6 unicast +passive-interface FastEthernet0/0 +passive-interface Loopback0 +area 2 stub no-summary +exit-address-family + +In addition to the OSPFv3 configuration steps given earlier, these examples have a few optional features configured. For example, each router has one or more passive interfaces specified. Interestingly, even though the passive-interface interface_identifier command appears under Address Family configuration mode for both IPv4 and IPv6, those com-mands were entered under router configuration mode. The commands were then automat-ically copied down to the various Address Families configured under the router process. + +Also, the maximum-paths 32 command is entered under the IPv6 Address Family on Routers R1 and R2, illustrating that OSPFv3 allows you to load-balance across as many as 32 equal-cost paths. + +Additionally, notice that Routers R2 and R4 have area 2 configured as a totally stubby area, with the area 2 stub no-summary command. This option dramatically reduces the number of OSPFv3 routes that appear on Router R4, as illustrated in Example 9-23. This example contrasts the multiple OSPFv3 routes on Router R1 (which has all its interfaces residing in area 0) and the single summary OSPFv3 route on Router R4 (which has all its interfaces residing in area 2). + + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 389 + +Example 9-23 Verifying the Effect of a Totally Stubby Area Configuration + +!OSPFv3 Routes on R1 +R1# show ip route ospfv3 +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +2.0.0.0/32 is subnetted, 1 subnets +O 2.2.2.2 [110/1] via 10.1.2.2, 01:20:19, FastEthernet0/1 +3.0.0.0/32 is subnetted, 1 subnets +O IA 3.3.3.3 [110/65] via 10.1.2.2, 01:14:36, FastEthernet0/1 +4.0.0.0/32 is subnetted, 1 subnets +O IA 4.4.4.4 [110/65] via 10.1.2.2, 00:33:00, FastEthernet0/1 +10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks +O IA 10.1.2.4/30 [110/65] via 10.1.2.2, 01:20:19, FastEthernet0/1 +O IA 10.1.2.8/30 [110/65] via 10.1.2.2, 01:20:19, FastEthernet0/1 +O IA 10.1.3.0/24 [110/66] via 10.1.2.2, 01:14:26, FastEthernet0/1 +O IA 10.1.4.0/24 [110/66] via 10.1.2.2, 00:33:00, FastEthernet0/1 + +!OSPFv3 Routes on R4 +R4# show ipv6 route ospf +IPv6 Routing Table - default - 8 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +OI ::/0 [110/65] +via FE80::C803:AFF:FEB8:0, Serial1/0 + +Next, consider a few OSPFv3 verification commands. Example 9-24 shows output from the show ospfv3 neighbor command. Notice that one section of the output is for the IPv4 Address Family, and the other section is for the IPv6 Address Family. + + + + + + + + + +From the Library of Alexey Evseenko +390 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 9-24 Sample Output from the show ospfv3 neighbor Command + +R1# show ospfv3 neighbor + +OSPFv3 1 address-family ipv4 (router-id 1.1.1.1) + + +Neighbor ID +2.2.2.2 + +Pri State +1 FULL/BDR + +Dead Time +00:00:35 + +Interface ID +2 + +Interface +FastEthernet0/1 + + +OSPFv3 1 address-family ipv6 (router-id 1.1.1.1) + + +Neighbor ID +2.2.2.2 + +Pri State +1 FULL/BDR + +Dead Time +00:00:38 + +Interface ID +2 + +Interface +FastEthernet0/1 + + +Example 9-25 shows output from the show ospfv3 interface brief command. Again, a portion of the output is for the IPv4 Address Family, and another portion is for the IPv6 Address Family. + +Example 9-25 Sample Output from the show ospfv3 interface brief Command + +R1# show ospfv3 interface brief +Interface PID Area AF Cost State Nbrs F/C + +Lo0 1 0 +Fa0/0 1 0 +Fa0/1 1 0 +Lo0 1 0 +Fa0/0 1 0 +Fa0/1 1 0 + +ipv4 1 LOOP 0/0 +ipv4 1 DR 0/0 +ipv4 1 DR 1/1 +ipv6 1 LOOP 0/0 +ipv6 1 DR 0/0 +ipv6 1 DR 1/1 + + +Example 9-26 provides sample output from the show ospfv3 database command. Note that OSPFv3’s single link-state database contains information for both IPv4 and IPv6 networks. + +Example 9-26 Sample Output from the show ospfv3 database Command + +R1# show ospfv3 database + +OSPFv3 1 address-family ipv4 (router-id 1.1.1.1) + +Router Link States (Area 0) + + +ADV Router Age +1.1.1.1 677 +2.2.2.2 917 + +Seq# +0x80000010 +0x8000000E + +Fragment ID +0 +0 + +Link count Bits +1 None +1 B + + +Net Link States (Area 0) + +ADV Router Age Seq# Link ID Rtr count + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 391 + +1.1.1.1 677 0x8000000D 3 2 + +Inter Area Prefix Link States (Area 0) + + +ADV Router Age +2.2.2.2 917 +2.2.2.2 917 +2.2.2.2 408 +2.2.2.2 408 +2.2.2.2 1920 +2.2.2.2 1920 + +Seq# +0x8000000D +0x8000000D +0x8000000D +0x8000000D +0x8000000B +0x8000000B + +Prefix +10.1.2.4/30 +10.1.2.8/30 +3.3.3.3/32 +10.1.3.0/24 +4.4.4.4/32 +10.1.4.0/24 + + +...OUTPUT OMITTED... + + +OSPFv3 1 address-family ipv6 (router-id 1.1.1.1) + +Router Link States (Area 0) + + +ADV Router Age +1.1.1.1 853 +2.2.2.2 792 + +Seq# +0x80000010 +0x8000000E + +Fragment ID +0 +0 + +Link count Bits +1 None +1 B + + +Net Link States (Area 0) + + +ADV Router Age +1.1.1.1 853 + +Seq# Link ID +0x8000000D 3 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 0) + + +ADV Router Age +2.2.2.2 545 +2.2.2.2 282 +2.2.2.2 282 +2.2.2.2 1048 +2.2.2.2 1048 +2.2.2.2 1048 + +Seq# +0x8000000D +0x8000000D +0x8000000D +0x8000000B +0x8000000B +0x8000000B + +Prefix +2003::/64 +2007::3333/128 +2004::/64 +2007::4444/128 +2006::/64 +2005::/64 + + +...OUTPUT OMITTED... + + +Note Even though the preceding commands used a series of show ospfv3 commands, you can still use the more traditional show ipv6 ospf commands to verify your OSPFv3 Address Family configuration. + + + + + + +From the Library of Alexey Evseenko +392 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 9-5 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an implementation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 9-5 Design Review + + +Design Goal + +When using OSPF, prevent the routers in sites for one division of the company from knowing IP routes for subnets in another division. (3) +The design shows an enterprise that uses only OSPF. It lists a goal of keeping the LSDBs and routing tables in each area small. (3) +The design lists a goal of extremely small LSDBs and IP routing tables on branch office routers. Which stub area types work best? (2) +The design calls for the flooding of a domain-wide default route to draw traffic toward Internet-connected routers. +The design requires the routing of both IPv4 and IPv6 networks. (2) + +Possible Implementation Choices Covered in This Chapter + + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 393 + +Implementation Plan Peer Review Table + +Table 9-6 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 9-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +The plan shows a design with area 0, with different ABRs connecting area 0 to areas 1, 2, and 3. The configurations show Type 3 LSA filtering into the nonbackbone areas +but not in the opposite direction. Could this configuration filter subnets in area 1 from being seen in area 2? +The design shows the configuration of Type 3 LSA filtering on an internal router in area 1. Could the filter have any effect? +The plan shows the configuration of the area range command on an ABR. What is the metric for the summary route, and in what conditions will the ABR advertise the summary? +The plan shows the configuration of the area 1 stub command for an area mostly located on the west coast of the United States. The company just bought another company whose sites are also on the west coast. +What issues exist if you add links from the acquired company into area 1? +The plan shows the configuration of the default-information originate always command on the one router to which Internet links connect. What happens to the default route when the Internet link fails, and what happens to packets destined for the Internet during this time? +The plan calls for the routing of both IPv4 and IPv6 networks. What new, or renamed, LSA types might appear in an area’s link-state database? + + + + + + + + +From the Library of Alexey Evseenko +394 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 9-7 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 9-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Filter Type 3 LSAs from being sent into an area. +Filter the OSPF routes calculated on one router from being added to that one router’s routing table. +Configure route summarization on ABRs. + +Configure route summarization on ASBRs. + +Configure the OSPF domain-wide advertisement of a default route. +Configure stubby or totally stubby areas. + +Configure NSSAs or totally NSSAs. + +Start an OSPFv3 process, using the traditional configuration approach. +Instruct an interface to participate in an OSPFv3 area, using the traditional configuration approach. +Start an OSPFv3 process, using the Address Family configuration approach. +Instruct an interface to participate in an OSPFv3 area, using the Address Family configuration approach. + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table 9-8 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 9: Advanced OSPF Concepts 395 + +Table 9-8 Verification Plan Memory Drill + +Information Needed Command(s) +Display all IP routes for subnets in a range, regardless of prefix length. +Display the contents of an IP prefix list. + +Display details of all Type 3 LSAs known to a router. +Display details of all Type 5 external LSAs known to a router. +Display the metric advertised in a summary route created by the area range command. +Display the metric advertised in a summary route created by the summary-address command. +Discover whether a router resides in a stubby area, and if so, which kind. +Confirm stubby area concepts by looking at the numbers of Type 3 and Type 5 LSAs known to a router. +List the interfaces participating in a traditional OSPFv3 configuration. +Display neighbors in a traditional OSPFv3 configuration. +Display the contents of a router’s link-state database using a traditional OSPFv3 configuration. +List the interfaces participating in an +IPv4 and/or IPv6 OSPFv3 routing process configured with the OSPFv3 Address Family configuration approach. +Display IPv4 and/or IPv6 neighbors configured with the OSPFv3 Address Family configuration approach. +Display the contents of a router’s link-state database, containing entries for IPv4 and/or IPv6 networks, using the OSPFv3 Address Family configuration approach. + + +Note Some of the entries in this table may not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + + + +From the Library of Alexey Evseenko +396 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 9-9 lists a reference of these key topics and the page numbers on which each is found. + +Table 9-9 Key Topics for Chapter 9 Key +Topic Key Topic Element Description Page Number + + +List + +List + +Table 9-2 + +Table 9-3 + +Table 9-4 + +List + +List + +Example 9-11 + +List + +Example 9-19 + +Explanations of the features of the area range 357 command +Explanations of the features of the summary- 360 address command +OSPF Route Summarization Commands 361 + +Stub Area Configuration Options 366 + +OSPF Stubby Area Types 375 + +Renamed and new LSAs for OSPFv3 376 + +Steps to configure OSPFv3 using the traditional 377 approach +Traditional OSPFv3 Configuration—Router R1 378 + +Steps to configure OSPFv3 using the Address 384 Family configuration approach +OSPFv3 Address Family Configuration on 385 Router R1 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +Type 3 LSA filtering, stub area, totally stubby area, not-so-stubby area, Type 5 external LSA, OSPFv3, OSPFv3 Address Family + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Route Redistribution Basics: This section dis-cusses the reasons why designers might choose to use route redistribution, and how routing protocols redistribute routes from the IP routing table. +■ Redistribution in EIGRP: This section discusses the mechanics of how Cisco IOS redistributes routes from other sources into EIGRP. +■ Redistribution in OSPF: This section discusses the mechanics of how Cisco IOS redistributes routes from other sources into OSPF. +■ Redistribution with Route Maps and Distribution Lists: This section focuses on the functions available using route maps and distribute lists on the same router that performs redistribution into either EIGRP or OSPF. +■ Issues with Multiple Redistribution Points: This section examines the domain loop problem that +can occur when multiple routers redistribute routes between the same two routing domains. This sec-tion also examines various solutions, including the setting of large metrics, setting the administrative distance, and using route tags. + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 10 + + + + + + +Route Redistribution + + +This chapter examines how routers can exchange routes between routing protocols through route redistribution. Specifically, this chapter begins by discussing the mechanics of what happens when the routes are redistributed. Then the discussion shifts to filtering and summarizing routes when redistributing, along with typical issues and solutions when multiple routers redistribute the same routes. + +This chapter examines how routers can exchange routes between routing protocols through route redistribution. Specifically, this chapter begins by discussing the mechanics of what happens when the routes are redistributed. Then the discussion shifts to filtering and summarizing routes when redistributing, along with typical issues and solutions when multiple routers redistribute the same routes. + +This chapter then looks at the methods by which a router can manipulate the routes being redistributed, beyond the settings of the metrics. This manipulation includes the filtering of routes and the setting of other values that can be associated with a route during the redistribution process. + +Next, this chapter examines a variety of design issues that occur when multiple redistri-bution points exist between routing domains. Many designs use multiple redistribution points for redundancy and even for load sharing. This redundancy creates some addition-al complexity. (This complexity has long been a favorite topic for the CCIE R/S Lab.) This chapter also shows methods of dealing with the design issues, including the manipulation of metrics, administrative distance, and route tags. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than two of these 16 self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 10-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + + + + + + + + + +From the Library of Alexey Evseenko +400 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 10-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Route Redistribution Basics + +Redistribution into EIGRP + +Redistribution into OSPF + +Redistribution with route maps and distribute lists + +Issues with multiple redistribution points + +Questions +1–2 + +3–5 + +6–8 + +9–12 + +13–16 + + + +1. Which of the following answers is the least likely reason for an engineer to choose to use route redistribution? + +a. To exchange routes between merged companies + +b. To give separate control over routing to different parts of one company + +c. To support multiple router vendors + +d. To knit together an OSPF area if the area becomes discontiguous + +2. For a router to successfully redistribute routes between OSPF and EIGRP, which of the following are true? (Choose two.) + +a. The router must have one routing protocol configured, but configuration for both routing protocols is not necessary. + +b. The router must have at least one working link connected to each routing domain. + +c. The redistribute command must be configured under EIGRP to send the routes to OSPF. + +d. The redistribute command should be configured under OSPF to take routes from EIGRP into OSPF. + +3. Process EIGRP 1 is redistributing routes from process OSPF 2. Which of the fol-lowing methods can be used to set the metrics of the redistributed routes? (Choose two.) +a. Let the metrics default. + +b. Set the metric components using the redistribute command’s metric keyword. + +c. Set the metric components using the default-metric subcommand under router configuration mode. + +d. Set the integer (composite) metric using the redistribute command’s metric keyword. + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 401 + +4. Examine the following excerpt from the show ip eigrp topology 10.2.2.0/24 com-mand on Router R1. Which answer can be verified as definitely true based on this output? + +External data: +Originating router is 10.1.1.1 +AS number of route is 1 +External protocol is OSPF, external metric is 64 +Administrator tag is 0 (0x00000000) + +a. R1 is the router that redistributed the route. + +b. R1’s metric to reach subnet 10.2.2.0/24 is 64. + +c. The route was redistributed on a router that has a router ospf 1 command configured. + +d. R1 is redistributing a route to prefix 10.2.2.0/24 into OSPF. + +5. Router R1 has a connected route for 10.1.1.0/24 off interface Fa0/0. Interface Fa0/0 has been enabled for OSPF because of a router ospf 1 and network 10.1.1.0 0.0.0.255 area 0 command. R1 also has EIGRP configured, with the redistribute ospf 1 metric 1000 100 10 1 1500 command configured under EIGRP. Which of the following is true? +a. R1 will not redistribute 10.1.1.0/24 into EIGRP, because R1 knows it as a con-nected route and not as an OSPF route. + +b. For any OSPF routes redistributed into EIGRP, the metric components include a value equivalent to 1 Mbps of bandwidth. + +c. For any OSPF routes redistributed into EIGRP, the metric components include a value equivalent to 100 microseconds of delay. + +d. No subnets of network 10.1.1.0 will be redistributed because of the omission of the subnets parameter. + +6. Process OSPF 1 is redistributing routes from process OSPF 2. Which of the follow-ing methods can be used to set the metrics of the redistributed routes? (Choose two.) +a. Let the metrics default. + +b. Use each redistributed route’s OSPF metric using the redistribute command’s metric transparent keywords. + +c. Set the metric using the default-metric subcommand under router configuration mode. + +d. Redistribution is not allowed between two OSPF processes. + + + + + + + +From the Library of Alexey Evseenko +402 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +7. Examine the following excerpt from the show ip ospf database asbr-summary com-mand on Router R1 (RID 1.1.1.1). Which answer can be verified as definitely true based on this output? + +LS Type: Summary Links (AS Boundary Router) +Link State ID: 9.9.9.9 (AS Boundary Router address) +Advertising Router: 3.3.3.3 +LS Seq Number: 8000000D +Checksum: 0xE43A +Length: 28 +Network Mask: /0 +TOS: 0 Metric: 100 + +a. The output describes the contents of a Type 5 LSA. + +b. 3.3.3.3 identifies a router as being the router performing redistribution. + +c. R1’s metric for its best route to reach the router with RID 9.9.9.9 is 100. + +d. The router with RID 3.3.3.3’s metric for its best route to reach the router with RID 9.9.9.9 is 100. + +8. Router R1 sits inside OSPF area 1. Router R2 redistributes an E1 route into OSPF for prefix 2.2.2.0/24, with external metric 20. Router R22 redistributes an E2 route for the same prefix/length, external metric 10. Under what conditions will R1 choose as its best route the route through R22? +a. R1 will always choose the route through R22. + +b. As long as R1’s best internal OSPF cost to reach R22 is less than 10. + +c. As long as R1’s best internal OSPF cost to reach R22 is less than 20. + +d. R1 will never choose the route through R22 if the E1 route through R2 is avail-able. + +9. Router R1 has been configured with the redistribute ospf 1 route-map fred com-mand under router eigrp 1. The route map named fred needs to be configured to match routes to determine which routes are redistributed into EIGRP. Which of the following answers lists an item that cannot be matched by route map fred? +a. Subnet number + +b. Next-hop router IP address of the route + +c. Whether the route is an E1 or E2 route + +d. The route’s tag + +e. The number of router hops between the router and the subnet + + + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 403 + +10. Router R1 refers to route map fred when redistributing from EIGRP into OSPF. The entire route map is listed next. Which of the following answers must be true based on the configuration as shown? + +route-map fred deny 10 +match ip address one +route-map fred deny 20 +match ip address two +route-map fred permit 100 + +a. The third route map clause will allow any routes not already filtered by the first two clauses. + +b. Routes permitted by ACL “two” will be redistributed. + +c. Routes denied by ACL “one” will be redistributed. + +d. All routes will be filtered. + +11. On Router R1, process EIGRP 1 is redistributing routes from process OSPF 2, call-ing route map fred with the redistribute ospf 2 route-map fred command. R1 has learned intra-area routes for 10.1.1.0/24 and 10.1.2.0/24 in part because of the Type 2 LSAs known for each subnet. The route map filters route 10.1.1.0/24 and allows 10.1.2.0/24 through. Which of the following commands on Router R1 list subnet 10.1.1.0/24? (Choose two.) +a. show ip route + +b. show ip eigrp topology + +c. show ip ospf database + +d. show ip eigrp topology 10.1.1.0/24 + +12. Router R1 is redistributing between two OSPF processes. Given the configuration shown, which includes all commands in the route map named fred, which of the fol-lowing answers is true regarding the redistribution into OSPF process 1? + +router ospf 1 +redistribute ospf 2 match external 2 route-map fred +! +route-map fred permit 10 +match ip address 1 +set metric-type type-1 + +a. No routes are redistributed because a route cannot be both E1 and E2. + +b. Only OSPF E2 routes in the OSPF 2 domain will be considered for redistribution. + +c. Inside the OSPF 2 domain, any formerly E2 routes will become E1 routes. + +d. Routes permitted by ACL 1 will be redistributed, regardless of whether the routes are E1 or E2 routes. + + + +From the Library of Alexey Evseenko +404 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +13. Which of the following is not true regarding Cisco IOS default settings for adminis-trative distance? + +a. EIGRP internal: 90 + +b. OSPF external: 110 + +c. EIGRP external: 90 + +d. RIP: 120 + +e. OSPF internal: 110 + +14. A network includes a RIPv2 domain, an EIGRP domain, and an OSPF domain. Each pair of routing domains has multiple routers redistributing routes between the pair of domains. The design requires that the redistribution configuration avoid matching based on prefix/length because of the trouble in maintaining such configurations. Which of the following tools can be used in all three routing domains to attempt to prevent domain loops? (This book uses the term domain loop to refer to the long routes that might be chosen for routes when redistribution exists—for example, a route might forward packets from the EIGRP domain, to the OSPF domain, back to EIGRP, and then to subnet X in the RIP domain.) +a. Setting route tags + +b. Setting the default administrative distance differently for internal and external routes + +c. Setting administrative distance differently per route + +d. Setting metrics much higher for all external routes than for all internal routes + +15. A coworker is developing an implementation plan for a design that uses OSPF 2 and RIPv2 routing domains, with two routers redistributing between the two domains. The coworker asks your help in choosing how to prevent domain loops by setting administrative distance. Assuming that all other related settings use defaults, which of the following would solve the domain loop problem? +a. The distance ospf intra-area 80 inter-area 80 OSPF subcommand + +b. The distance ospf external 80 OSPF subcommand + +c. The distance ospf intra-area 180 inter-area 180 OSPF subcommand + +d. The distance ospf external 180 OSPF subcommand + +16. Router R1 sets a route tag for subnet 10.1.1.0/24 when redistributing from OSPF into EIGRP. Which of the following units is assigned to the route tag? + +a. Kilobits/second + +b. Tens-of-microseconds + +c. Cost + +d. Hop count + +e. No units assigned + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 405 + +Foundation Topics + + +Route Redistribution Basics + +Most internetworks use a single interior gateway protocol (IGP) to advertise and learn IP routes. However, in some cases, more than one routing protocol exists inside a single enter-prise. Also, in some cases, the routes learned with an IGP must then be advertised with Border Gateway Protocol (BGP), and vice versa. In such cases, engineers often need to take routing information learned by one routing protocol and advertise those routes into the other routing protocol—a function provided by the Cisco IOS route redistribution feature. + +This section examines the basics of route redistribution. + +The Need for Route Redistribution + +The potential need for route redistribution exists when a route learned through one source of routing information, most typically one routing protocol, needs to be distrib-uted into a second routing protocol domain. For example, two companies might merge, with one company using Enhanced Interior Gateway Routing Protocol (EIGRP) and the other using Open Shortest Path First (OSPF). The engineers could choose to immediately migrate away from OSPF to instead use EIGRP exclusively, but that migration would take time and potentially cause outages. Route redistribution allows those engineers to con-nect a couple of routers to both routing domains, and exchange routes between the two routing domains, with a minimal amount of configuration and with little disruption to the existing networks. + +Figure 10-1 shows just such a case, with R1 performing redistribution by using its knowl-edge of subnet 1 from the EIGRP domain and advertising a route for subnet 1 into the OSPF domain. Note that the opposite should also occur, with the OSPF domain’s subnet 2 being redistributed into the EIGRP domain. + +Company 1 Company 2 + + +redistribute + + +EIGRP Subnet1 + + +Subnet 1 + +EIGRP1 + +OSPF R1 Subnet1 + +Subnet 2 + +R2 OSPF2 + + + + + +Figure 10-1 Typical Use of Redistribution + + + +From the Library of Alexey Evseenko +406 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The main technical reason for needing redistribution is straightforward: An internetwork uses more than one routing protocol, and the routes need to be exchanged between those routing domains, at least temporarily. The business reasons vary widely but include the following: + +■ Mergers when different IGPs are used. + +■ Mergers when the same IGP is used. + +■ Momentum (The enterprise has been using multiple routing protocols for a long time.) + +■ Different company divisions are under separate control for business or political reasons. + +■ Connections between partners. + +■ Between IGPs and BGP when BGP is used between large segments of a multinational company. + +■ Layer 3 WAN (Multiprotocol Label Switching [MPLS]). + +The list begins with two entries for mergers just to make the point that even if both merging companies use the same IGP, redistribution can still be useful. Even if both com-panies use EIGRP, they probably use a different autonomous system number (ASN) in their EIGRP configuration (with the router eigrp asn command). In such a case, to have all routers exchange routing information with EIGRP, all the former company’s routers would need to migrate to use the same ASN as the first company. Such a migration might be simple, but it still requires disruptive configuration changes in a potentially large num-ber of routers. Redistribution could be used until a migration could be completed. + +Although useful as an interim solution, many permanent designs use redistribution as well. For example, it could be that a company has used different routing protocols (or different instances of the same routing protocol) in different divisions of a company. The network engineering groups can remain autonomous, and manage their own routing +protocol domains, using redistribution to exchange routes at a few key connecting points between the divisions. Similarly, partner companies have separate engineering staffs, and want autonomy for managing routing, but also need to exchange routes for key subnets to allow the partnership’s key applications to function. Figure 10-2 depicts both of these cases. + +The last two cases in the previous list each relate to BGP in some way. First, some large corporations actually use BGP internal to the company’s internetwork, redistributing routes from IGPs. Each large autonomous division of the company can design and con-figure its respective routing protocol instance, redistribute into BGP, and then redistribute out of BGP into other divisions. Also, when an enterprise uses an MPLS Virtual Private Network (VPN) service, the MPLS provider’s provider edge (PE) router typically redis-tributes customer routes with BGP inside the MPLS provider’s MPLS network. Figure +10-3 shows samples of both these cases. In each of these cases, a given prefix/length (subnet/mask) is typically distributed into BGP at one location, advertised over a BGP domain, and redistributed back into some IGP. + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 407 + + + +Division 1 Division 2 + + + +Routing redistribute Domain 1 + +Routing Domain 2 + + + + +redistribute + + + + + +Manufacturer Supplier + + + +Routing redistribute Domain 1 + + +Routing Domain 2 + + + + +redistribute + + + +Figure 10-2 Permanent Uses for Route Redistribution + + + +Division 1 EIGRP 1 + + + +R1 +redistribute + + + +BGP R2 redistribute + + +Division 2 OSPF + +Large Company Using BGP Internally + + + + +Division 3 R3 EIGRP 2 +redistribute + + + + + + +Company 1 Site 1 +EIGRP 1 CE1 + + + + +PE1 + +redistribute + +MPLS + +BGP +PE2 + +redistribute + + +Company 1 Site 2 +CE2 +EIGRP 1 + + + +Figure 10-3 Using Redistribution to Pass Routes Using BGP + + + +From the Library of Alexey Evseenko +408 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Redistribution Concepts and Processes + +Route redistribution requires at least one router to do the following: + +■ Use at least one working physical link with each routing domain. +Key +Topic ■ A working routing protocol configuration for each routing domain. + +■ Additional redistribution configuration for each routing protocol, specifically the redistribute command, which tells the routing protocol to take the routes learned by another source of routing information and to then advertise those routes. + +The first two steps do not require any new knowledge or commands, but the third step represents the core of the redistribution logic and requires some additional background information. To appreciate the third step, Figure 10-4 shows an example router, RD1, which has met the first two requirements. RD1 uses EIGRP on the left and OSPF on the right, and has learned some routes with each routing protocol (Steps 1 and 2). However, no redistribution has yet been configured. + + + + +EIGRP 1 + + + + +Subnet 1 Subnet 2 Subnet 3 + +RD1 + +OSPF + + + + +Subnet 11 Subnet 12 Subnet 13 + + + + + + +EIGRP 1 Neighbor Table + +OSPF 2 Neighbor Table + + + + +EIGRP 1 Topology Table: Subnet 1 Subnet 2 Subnet 3 + +IP Routing Table D Subnet 1 +D Subnet 2 D Subnet 3 O Subnet 11 O Subnet 12 O Subnet 13 + + +OSPF 2 Topology Table: Subnet 11 Subnet 12 Subnet 13 + + +Figure 10-4 Routing Protocol Tables on a Router Doing Redistribution + +The goal for redistribution in this case is to have EIGRP advertise subnets 11, 12, and 13, which exist inside the OSPF domain, and have OSPF advertise subnets 1, 2, and 3, which exist inside the EIGRP domain. To do that, EIGRP must put topology information +about subnets 11, 12, and 13 into its EIGRP topology table, and OSPF must put topology + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 409 + +information about subnets 1, 2, and 3 into its topology table. However, OSPF’s topology table has a lot of different information in it compared to EIGRP’s topology table. OSPF has link-state advertisements (LSA) and EIGRP does not. EIGRP lists the components of the composite metric and the neighbor’s reported distance (RD)—but OSPF does not. In short, EIGRP and OSPF differ significantly in the contents of their topology tables. + +Because the details of various routing protocols’ topology tables differ, the redistribution process does not use the topology tables when redistributing routes. Instead, redistri-bution uses the one table that both routing protocols understand: the IP routing table. Specifically, the Cisco IOS redistribute command takes routes from the IP routing table and passes those routes to a routing protocol for redistribution. The redistribute com-mand, configured inside a routing protocol configuration mode, redistributes routes into that routing protocol from some other source. Figure 10-5 spells it out with an example, which focuses on the internal logic of Router RD1 as shown in Figure 10-4. + + +EIGRP 1 Topology Table: Subnet 11 Subnet 12 Subnet 13 + +OSPF 2 Topology Table: Subnet 1 Subnet 2 Subnet 3 + + + + + + + +router eigrp 1 redistribute ospf 2 + +IP Routing Table D Subnet 1 +D Subnet 2 D Subnet 3 O Subnet 11 O Subnet 12 O Subnet 13 + + + +router ospf 2 redistribute eigrp 1 + + +Figure 10-5 Mutual Redistribution Between OSPF and EIGRP on Router RD1 + +Starting on the left of the figure, RD1’s EIGRP 1 process configuration lists the redis-tribute ospf 2 command. This command tells RD1 to look in the IP routing table, take all OSPF routes added to the IP routing table by the OSPF 2 process on RD1, and put those routes into EIGRP’s topology table. Conversely, the redistribute eigrp 1 command configured on the OSPF process tells RD1 to take IP routes from the IP routing table, if learned by EIGRP process 1, and add those routes to OSPF 2’s topology table. + +The process works as shown in Figure 10-5, but the figure leaves out some important details regarding the type of routes and the metrics used. For EIGRP, the EIGRP topol-ogy table needs more than the integer metric value held by the IP routing table—it needs values for the components of the EIGRP composite metric. EIGRP can use default set-tings that define the metric components for all routes redistributed into EIGRP, or the engineer can set the metric components in a variety of ways, as covered in several loca-tions later in this chapter. + +Like EIGRP, OSPF treats the redistributed routes as external routes. OSPF creates an LSA to represent each redistributed subnet—normally a Type 5 LSA, but when redistributed into a not-so-stubby area (NSSA), the router instead creates a Type 7 LSA. In both cases, OSPF needs an integer metric to assign to the external route’s LSA. The redistribution + + + +From the Library of Alexey Evseenko +410 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +configuration should include the OSPF cost setting, which might or might not match the metric listed for the route in the redistributing router’s IP routing table. + +The last concept, before moving on to the configuration options, is that the redistribute command tells the router to take not only routes learned by the source routing protocol but also connected routes on interfaces enabled with that routing protocol—including passive interfaces. Example 10-1, later in this chapter, demonstrates this concept. + +Redistribution into EIGRP + +This section looks at the specifics of how EIGRP performs redistribution—that is, how EIGRP takes routes from other routing sources, such as OSPF, and advertises them into EIGRP. In real life, engineers often use both route filtering and route summarization at the redistribution point on a router. However, for the sake of making the underlying concepts clear, this portion of the chapter focuses on the mechanics of redistribution, without filter-ing, or summarization, or any other changes to the redistributed routes. This chapter later looks at the interesting options for manipulating routes at the redistribution point. + +This section begins with a couple of short discussions of reference information. The first topic summarizes the parameters of the main configuration command, the EIGRP +redistribute command. Next, the baseline configuration used in the upcoming samples is listed, including all EIGRP and OSPF configuration, but no redistribution configuration. With those details listed for reference, the rest of this section examines the configuration of redistribution into EIGRP. + +EIGRP redistribute Command Reference + +First, for reference, the following lines show the generic syntax of the redistribute com-mand when used as a router eigrp subcommand. Note that the syntax differs slightly depending on the routing protocol into which routes will be redistributed. Following that, Table 10-2 lists the options on the command with a brief description. +redistribute protocol [process-id | as-number] [metric bw delay reliability load mtu ] [match {internal | nssa-external | external 1 | external 2}] [tag tag-value] [route-map name] + + + +Table 10-2 +Key +Topic Option + +protocol + + +Parameters of the EIGRP redistribute Command + +Description +The source of routing information. Includes bgp, connected , eigrp, isis, mobile, ospf, static and rip . + + + +process-id, as-number + + +metric + +If redistributing a routing protocol that uses a process ID or ASN on the router global config command, use this parameter to refer to that process or ASN value. +A keyword after which follows the four metric components (bandwidth, delay, reliability, link load), plus the MTU associated with the route. + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 411 + + + +Option match + + +tag + + +route-map + +Description +If redistributing from OSPF, this keyword lets you match internal OSPF routes, external (by type), and NSSA external routes, essentially filtering which routes are redistributed. +Assigns a unitless integer value to the routes redistributed by this command—tags that can be later matched by other routers using a route map. +Applies the logic in the referenced route map to filter routes, set metrics, and set route tags. + + + + +Baseline Configuration for EIGRP Redistribution Examples + +The best method to see the results of redistribution is to use examples, so this section explains the sample internetwork used in the upcoming EIGRP redistribution examples. Figure 10-6 shows the sample internetwork. In this case, the EIGRP domain on the left uses subnets of Class B network 172.30.0.0, and the OSPF domain on the right uses sub-nets of Class B network 172.16.0.0. Note that all OSPF subnets reside in area 0 in this example internetwork, although that is not a requirement. + + +EIGRP + + + +Subnet 172.30.6.0/23 + +Fa0/1 7.7/23 + +OSPF + +Area 0 + +Subnet 172.16.8.0/25 + +Fa0/1 8.8/25 + + + +R7 Fa0/0 +27.7/23 + +S0/0 17.2/30 + + + +S0/1/1 17.1/30 + + + +S0/0/1 18.1/30 + +S0/0 18.2/30 + + +R8 +Fa0/0 48.8/25 + + + +Subnet 172.30.26.0/23 + +Fa0/0 27.2/23 + +R2 +Fa0/1 2.2/23 + + + + + +S0/0/1 12.2/30 + + +RD1 +S0/0/0 S0/1/0 12.1/30 14.1/30 + + + + + +S0/0/0 14.2/30 + +Subnet 172.16.48.0/25 + +Fa0/0 48.4/25 + +R4 +Fa0/1 4.4/25 + + + +Subnet 172.30.2.0/23 + + +All addresses begin 172.30 + +Subnet 172.16.4.0/25 + + +All addresses begin 172.16 + + +Figure 10-6 Sample Internetwork Used for Redistribution Examples + + + +From the Library of Alexey Evseenko +412 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The internetwork uses a single router (RD1) to perform redistribution, just to avoid some interesting issues that occur when multiple routers redistribute the same routes (issues that are discussed later in this chapter). Example 10-1 shows the configuration on RD1, listing the IP addresses of the four active serial interfaces shown in Figure 10-6 , plus the complete but basic EIGRP and OSPF configuration—but without any redistribution con-figured yet. + +Example 10-1 Configuration on Router RD1 Before Adding Redistribution Configuration + +interface Serial0/0/0 +ip address 172.30.12.1 255.255.255.252 +clock rate 1536000 +! +interface Serial0/0/1 +ip address 172.16.18.1 255.255.255.252 +clock rate 1536000 +! +interface Serial0/1/0 +ip address 172.16.14.1 255.255.255.252 +clock rate 1536000 +! +interface Serial0/1/1 +ip address 172.30.17.1 255.255.255.252 +clock rate 1536000 +! +router eigrp 1 +network 172.30.0.0 +no auto-summary +! +router ospf 2 +router-id 1.1.1.1 +network 172.16.0.0 0.0.255.255 area 0 + + +Configuring EIGRP Redistribution with Default Metric Components + +For the internetwork of Figure 10-6, a reasonable design goal would be to redistribute EIGRP routes into OSPF, and OSPF routes into EIGRP. This section examines the case of redistributing the routes into EIGRP from OSPF. + +First, consider the EIGRP redistribute command. For those unfamiliar with the com-mand, the direction of redistribution might not be obvious. A better command name might have been “take-routes-from,” because the first parameter after the command tells Cisco IOS from where to get the routes. + +For example, consider the configuration in Example 10-2, which was added to RD1’s existing configuration in Example 10-1. The configuration uses only required parameters; + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 413 + +namely, a reference to the source from which routes should be redistributed. Because the configuration places this command in EIGRP configuration mode, the command tells Cisco IOS to redistribute the routes into EIGRP 1, from OSPF 2 in this case. + +Example 10-2 Minimal Configuration for Redistribution from OSPF into EIGRP + +RD1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +RD1(config)# router eigrp 1 +RD1(config-router)# redistribute ospf 2 +RD1(config-router)# end + +Cisco IOS does accept the configuration. Unfortunately, Cisco IOS does not actually redistribute routes from OSPF into EIGRP in this case. EIGRP does not have a default setting for the metric components to use when redistributing into EIGRP from OSPF. To confirm these results, examine the output shown in Example 10-3, which lists show com-mand output from RD1 when configured as shown in the previous example. Note that RD1’s EIGRP topology table lists only routes for Class B network 172.30.0.0, which all +sit inside the EIGRP domain. None of the routes from Class B network 172.16.0.0, which exist inside the OSPF domain, have been added to RD1’s EIGRP topology table. + +Example 10-3 Redistribution Did Not Work on RD1 + +RD1# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(172.30.17.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 172.30.17.0/30, 1 successors, FD is 2169856 +via Connected, Serial0/1/1 +P 172.30.26.0/23, 2 successors, FD is 2172416 +via 172.30.12.2 (2172416/28160), Serial0/0/0 +via 172.30.17.2 (2172416/28160), Serial0/1/1 +P 172.30.2.0/23, 1 successors, FD is 2172416 +via 172.30.12.2 (2172416/28160), Serial0/0/0 +via 172.30.17.2 (2174976/30720), Serial0/1/1 +P 172.30.6.0/23, 1 successors, FD is 2172416 +via 172.30.17.2 (2172416/28160), Serial0/1/1 +via 172.30.12.2 (2174976/30720), Serial0/0/0 +P 172.30.12.0/30, 1 successors, FD is 2169856 +via Connected, Serial0/0/0 + +To complete the configuration of redistribution into EIGRP, Router RD1 needs to set the metric values. EIGRP can set the metrics for redistributed routes in three ways, as sum-marized in Table 10-3. + + + + + + +From the Library of Alexey Evseenko +414 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 10-3 Key +Topic Function + + +Methods of Setting EIGRP Metrics When Redistributing into EIGRP + +Command + + + +Setting the default for all redistribute commands + +Setting the component metrics applied to all routes redistributed by a single redistribute command + + +The default-metric bw delay reliability load mtu EIGRP subcommand. + +The metric bw delay reliability load mtu parameters on the redistribute command. + +Setting different component metrics to different Use the route-map parameter on the routes from a single route source redistribute command, matching routes +and setting metric components. + + +Note EIGRP does have a default metric when redistributing from another EIGRP process, in which case it takes the metric from the source of the routing information. In all other cases, the metric must be set using one of the methods in Table 10-3. + + +If the metrics do not matter to the design, which is likely when only a single redistribu-tion point exists as in Figure 10-6, either of the first two methods listed in Table 10-3 is reasonable. The first method, using the default-metric command in EIGRP configuration mode, sets the metric for all routes redistributed into EIGRP, unless set by one of the other methods. Alternatively, the second method, which uses additional parameters on the redistribute command, sets the metric for all routes redistributed because of that one redistribute command. Finally, if the redistribute command also refers to a route map, the route map can use the set metric command to set the metric components for routes matched by the route map clause, overriding the metric settings in the default-metric command or with the metric keyword on the redistribute command. + +Example 10-4 shows the addition of the default-metric 1000 33 255 1 1500 command to RD1’s configuration. This command sets the bandwidth to 1000 (kbps), the delay to 33 (tens-of-microseconds, or 330 microseconds), the reliability to 255 (a value in the range +1–255, where 255 is best), the load to 1 (a value in the range 1–255, where 1 is best), and the maximum transmission unit (MTU) to 1500. Note that even though EIGRP ignores the last three parameters by default when calculating integer metrics, you still must con-figure these settings for the commands to be accepted. + +Example 10-4 Redistributed Routes in RD1 + +RD1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +RD1(config)# router eigrp 1 +RD1(config-router)# default-metric 1000 33 255 1 1500 +RD1(config-router)# end + +Because this example uses a single redistribute command for the EIGRP 1 process, you could have used the redistribute ospf 2 metric 1000 33 255 1 1500 command and ignored the default-metric command to achieve the same goal. + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 415 + +Verifying EIGRP Redistribution + +As shown earlier in Figure 10-5, redistribution takes routes from the routing table and places the correct information for those subnets into the redistributing router’s topol-ogy table. The redistributing router then advertises the routes from its topology table as it would for other routes. To verify that redistribution works, Example 10-5 shows the proof that RD1 indeed created entries in its EIGRP topology table for the five subnets in the OSPF domain. + +Example 10-5 Verifying That RD1 Added EIGRP Topology Data for Five OSPF Subnets + +RD1# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(172.30.17.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +! Note – all lines for class B network 172.30.0.0 have been omitted for brevity +P 172.16.48.0/25 , 1 successors, FD is 2568448 +via Redistributed (2568448/0 ) +P 172.16.18.0/30, 1 successors, FD is 2568448 +via Redistributed (2568448/0) +P 172.16.14.0/30, 1 successors, FD is 2568448 +via Redistributed (2568448/0) +P 172.16.8.0/25, 1 successors, FD is 2568448 +via Redistributed (2568448/0) +P 172.16.4.0/25, 1 successors, FD is 2568448 +via Redistributed (2568448/0) +RD1# show ip eigrp topology 172.16.48.0/25 +IP-EIGRP (AS 1): Topology entry for 172.16.48.0/25 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2568448 +Routing Descriptor Blocks: +172.16.18.2, from Redistributed , Send flag is 0x0 +Composite metric is (2568448/0), Route is External +Vector metric: +Minimum bandwidth is 1000 Kbit +Total delay is 330 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 0 +External data: +Originating router is 172.30.17.1 (this system) +AS number of route is 2 +External protocol is OSPF, external metric is 65 +Administrator tag is 0 (0x00000000) + + + + + +From the Library of Alexey Evseenko +416 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The show command output lists several interesting facts: + +■ On Router RD1, which performed the redistribution, the EIGRP topology table lists the outgoing interface as “via redistributed.” + +■ All the redistributed routes have the same feasible distance (FD) calculation (2568448), because all use the same component metrics per the configured default-metric command. + +■ RD1’s two connected subnets in the OSPF 2 domain—subnets 172.16.14.0/30 and 172.16.18.0/30—were also redistributed, even though these routes are connected routes in RD1’s routing table. + +■ The output of the show ip eigrp topology 172.16.48.0/25 command confirms that the component metrics match the values configured on the default-metric command. + +■ The bottom of the output of the show ip eigrp topology 172.16.48.0/25 command lists information about the external source of the route, including the routing source (OSPF) and that source’s metric for the route (65). It also lists the phrase “(this sys-tem),” meaning that the router on which the command was issued (RD1 in this case) redistributed the route. + +The third item in the list—the fact that RD1 redistributed some connected routes—bears further consideration. The redistribute ospf 2 command tells EIGRP to redistribute routes learned by the OSPF 2 process. However, it also tells the router to redistribute connected routes for interfaces on which process OSPF 2 has been enabled. Back in Example 10-1, the configuration on RD1 lists a network 172.16.0.0 0.0.255.255 area 0 command, enabling OSPF 2 on RD1’s S0/0/1 and S0/1/0 interfaces. As such, the redistri-bution process also redistributed those routes. + +Stated more generally, when the redistribute command refers to another IGP as the rout-ing source, it tells the router to redistribute the following: + +■ All routes in the routing table learned by that routing protocol Key +Topic ■ All connected routes of interfaces on which that routing protocol is enabled + +Although Example 10-5 shows the evidence that Router RD1 added the topology data to its EIGRP topology database, it did not show any routes. Example 10-6 shows the IP routing tables on both RD1 and Router R2, a router internal to the EIGRP domain. R2’s +routes forward the packets toward the redistributing router, which in turn has routes from the OSPF domain with which to forward the packet to the destination subnet. + +Example 10-6 Verification of IP Routes on RD1 and R2 + +! First, on RD1 +RD1# show ip route 172.16.0.0 +Routing entry for 172.16.0.0/16, 5 known subnets +Attached (2 connections) +Variably subnetted with 2 masks + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 417 + +Redistributing via eigrp 1 + +O 172.16.48.0/25 [110/65] via 172.16.18.2, 00:36:25, Serial0/0/1 +[110/65] via 172.16.14.2, 00:36:25, Serial0/1/0 +C 172.16.18.0/30 is directly connected, Serial0/0/1 +C 172.16.14.0/30 is directly connected, Serial0/1/0 +O 172.16.8.0/25 [110/65] via 172.16.18.2, 00:36:25, Serial0/0/1 +O 172.16.4.0/25 [110/65] via 172.16.14.2, 00:36:25, Serial0/1/0 + +! Next, on Router R2 +R2# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks +D EX 172.16.48.0/25 [170 /3080448] via 172.30.12.1, 00:25:15, Serial0/0/1 +D EX 172.16.18.0/30 [170/3080448] via 172.30.12.1, 00:25:15, Serial0/0/1 +D EX 172.16.14.0/30 [170/3080448] via 172.30.12.1, 00:25:15, Serial0/0/1 +D EX 172.16.8.0/25 [170/3080448] via 172.30.12.1, 00:25:15, Serial0/0/1 +D EX 172.16.4.0/25 [170/3080448] via 172.30.12.1, 00:25:15, Serial0/0/1 +172.30.0.0/16 is variably subnetted, 5 subnets, 2 masks +D 172.30.17.0/30 [90/2172416] via 172.30.27.7, 00:25:15, FastEthernet0/0 +C 172.30.26.0/23 is directly connected, FastEthernet0/0 +C 172.30.2.0/23 is directly connected, FastEthernet0/1 +D 172.30.6.0/23 [90/30720] via 172.30.27.7, 00:25:15, FastEthernet0/0 +C 172.30.12.0/30 is directly connected, Serial0/0/1 + +Beginning with the output for R2, in the second half of the example, R2 knows routes for all five subnets in Class B network 172.16.0.0, listing all as external EIGRP routes. The routes all use R2’s link connected to RD1. Also, note that the administrative distance (AD) is set to 170, rather than the usual 90 for EIGRP routes. EIGRP defaults to use AD 90 for internal routes and AD 170 for external routes. + +RD1 has routes for all routes in the OSPF domain as well, but as either connected or OSPF-learned routes. + +Redistribution into OSPF + +As you might expect, OSPF redistribution has several similarities and differences as com-pared to redistribution into EIGRP. Unlike EIGRP, OSPF does have useful default metrics + + + +From the Library of Alexey Evseenko +418 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +for redistributed routes, but OSPF does use the same general methods to configure met-rics for redistributed routes. Like EIGRP, OSPF flags redistributed routes as being exter-nal. Unlike EIGRP, OSPF creates LSAs to represent each external route, and OSPF must then apply some much different logic than EIGRP to calculate the best route to each external subnet. + +This section examines the OSPF redistribution process and configuration. It also discuss-es background on three OSPF LSA Types—Types 4, 5, and 7—all created to help OSPF distribute information so that routers can calculate the best route to each external subnet. + +OSPF redistribute Command Reference + +First, for reference, the following lines show the generic syntax of the redistribute com-mand when used as a router ospf subcommand. Note that the syntax differs slightly depending on the routing protocol into which routes will be redistributed. Following that, Table 10-4 lists the options on the command with a brief description. + +redistribute protocol [ process-id | as-number] [ metric metric-value] [metric-type type-value] [match { internal | external 1 | external 2 | nssa-external}] [ tag tag-value] [route-map map-tag] [subnets] + + +Table 10-4 +Key +Topic Option + +protocol + + +Parameters on the OSPF redistribute Command + +Description +The source of routing information. Includes bgp , connected , eigrp, isis, mobile, ospf, static, and rip . + +process-id, as-number If redistributing a routing protocol that uses a process ID or AS number on the router global config command, use this parameter to refer to that process ID or ASN value. + + +metric + +metric-type {1 | 2} + +match + + + +tag + + +route-map + +subnets + +Defines the cost metric assigned to routes redistributed by this command, unless overridden by a referenced route map. +Defines the external metric type for the routes redistributed by this command: 1 (E1 routes) or 2 (E2 routes). +If redistributing from another OSPF process, this keyword lets you match internal OSPF routes, external OSPF routes (either E1 or E2), and NSSA external routes, essentially filtering which routes are redistributed. +Assigns a unitless integer value to the routes redistributed by this command—a tag that can be later matched by other routers using a route map. +Applies the logic in the referenced route map to filter routes, set metrics, and set route tags. +Redistribute subnets of classful networks. Without this parameter, only routes for classful networks are redistributed. (This behavior is unique to the OSPF redistribute command.) + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 419 + +Configuring OSPF Redistribution with Minimal Parameters + +The redistribute subcommand under router ospf has many optional settings. To better appreciate some of these settings, this section first examines the results when using all defaults, using as few parameters as possible. Following the discussion of the behavior with defaults, the next examples add the parameters that complete the redistribution configuration. + +Redistribution into OSPF uses the following defaults: + +■ When taking from BGP, use a default metric of 1. +Key +Topic ■ When taking from another OSPF process, take the source route’s metric. + +■ When taking from all other sources, use a default metric of 20. + +■ Create a Type 5 LSA for each redistributed route (external) if not inside an NSSA; create a Type 7 LSA if inside an NSSA. + +■ Use external metric type 2. + +■ Redistribute only routes of classful (Class A, B, and C) networks, and not routes for subnets. + +To demonstrate OSPF redistribution, this section uses an example that uses the same internetwork shown in Figure 10-6, including the baseline configuration shown in Example 10-1, and the EIGRP redistribution configuration shown in Examples 10-2 and 10-4. Essentially, the upcoming OSPF examples begin with Router RD1 including all the configurations seen in all the earlier examples in this chapter. According to those +examples, OSPF has been correctly configured on the routers on the right side of Figure 10-6, EIGRP has been configured on the left, and the configuration of redistribution of OSPF routes into EIGRP has been completed. However, no redistribution into OSPF has yet been configured. + +For perspective, before showing the redistribution into OSPF, Example 10-7 reviews the OSPF configuration, along with show commands listing RD1’s IP routing table entries and its OSPF LSDB. + +Example 10-7 Router RD1 Routing Protocol Configuration, Before Redistribution into OSPF + +RD1# show run +! lines omitted for brevity +router eigrp 1 +redistribute ospf 2 +network 172.30.0.0 +default-metric 1000 33 255 1 1500 +no auto-summary +! +router ospf 2 +router-id 1.1.1.1 + + + + + +From the Library of Alexey Evseenko +420 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +log-adjacency-changes +network 172.16.0.0 0.0.255.255 area 0 + +RD1# show ip route 172.30.0.0 +Routing entry for 172.30.0.0/16, 5 known subnets +Attached (2 connections) +Variably subnetted with 2 masks +Redistributing via eigrp 1 + +C 172.30.17.0/30 is directly connected, Serial0/1/1 +D 172.30.26.0/23 [90/2172416] via 172.30.17.2, 01:08:50, Serial0/1/1 +[90/2172416] via 172.30.12.2, 01:08:50, Serial0/0/0 +D 172.30.2.0/23 [90/2172416] via 172.30.12.2, 01:08:50, Serial0/0/0 +D 172.30.6.0/23 [90/2172416] via 172.30.17.2, 01:08:50, Serial0/1/1 +C 172.30.12.0/30 is directly connected, Serial0/0/0 +RD1# show ip ospf database + +OSPF Router with ID (1.1.1.1) (Process ID 2) + +Router Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum Link count + +1.1.1.1 +4.4.4.4 +8.8.8.8 + +1.1.1.1 +4.4.4.4 +8.8.8.8 + +1425 0x80000007 0x007622 4 +1442 0x8000000D 0x00B1E9 4 +1466 0x80000006 0x00640E 4 + + +Net Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum +172.16.48.4 4.4.4.4 1442 0x80000004 0x007E07 + +! The following occurs on OSPF internal router R4 +R4# show ip route 172.30.0.0 +% Network not in table + +The output in Example 10-7 shows several important points relative to the upcoming redistribution configuration. First, by design, the EIGRP domain contains subnets of network 172.30.0.0. Router RD1 knows routes for five subnets in this range. RD1 has four LSAs: three Type 1 Router LSAs (one each for Routers RD1, R4, and R8) plus one Type 2 network LSA (because only one subnet, 172.16.48.0/25, has elected a DR). Because the design for this internetwork puts all OSPF routers in area 0, no Type 3 summary LSAs exist in RD1’s LSDB. Also, because no routers have redistributed external routes into OSPF yet, no Type 5 external nor Type 7 NSSA external routes are listed. + +By adding the redistribute eigrp 1 command in OSPF configuration mode, OSPF tries to redistribute routes from EIGRP—but with no success. The reason is that by omitting the + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 421 + +subnets parameter, OSPF will only redistribute routes for entire classful subnets, and only if such a route is listed in the IP routing table. Example 10-8 shows the results. + +Example 10-8 Redistributing into OSPF from EIGRP 1, All Default Settings + +RD1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +RD1(config)# router ospf 2 +RD1(config-router)# redistribute eigrp 1 +% Only classful networks will be redistributed +RD1(config-router)# end +RD1# +RD1# show ip ospf database + +OSPF Router with ID (1.1.1.1) (Process ID 2) + +Router Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum Link count +1.1.1.1 1.1.1.1 6 0x80000008 0x007A1B 4 + +4.4.4.4 +8.8.8.8 + +4.4.4.4 +8.8.8.8 + +1782 0x8000000D 0x00B1E9 4 +1806 0x80000006 0x00640E 4 + + +Net Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum +172.16.48.4 4.4.4.4 1782 0x80000004 0x007E07 + +Cisco IOS even mentions that only classful routes will be redistributed. As seen in Example 10-7, no route exists for the exact Class B network prefix of 172.30.0.0/16, and by default, OSPF does not redistribute any subnets inside that range, as noted in the informational message in Example 10-8. So, the OSPF database on Router RD1 remains unchanged. + +By changing the configuration to use the redistribute eigrp 1 subnets command, OSPF indeed redistributes the routes, as shown in Example 10-9. + +Example 10-9 Redistributing from EIGRP into OSPF, with Subnets + +RD1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +RD1(config)# router ospf 2 +RD1(config-router)# redistribute eigrp 1 subnets +RD1(config-router)# end +RD1# +May 12 12:49:48.735: %SYS-5-CONFIG_I: Configured from console by console +RD1# show ip ospf database + + + + + +From the Library of Alexey Evseenko +422 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +! omitting the Type 1 and 2 LSA output for brevity + +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +172.30.2.0 +172.30.6.0 +172.30.12.0 +172.30.17.0 +172.30.26.0 + +1.1.1.1 3 +1.1.1.1 3 +1.1.1.1 3 +1.1.1.1 3 +1.1.1.1 3 + +0x80000001 0x008050 0 +0x80000001 0x005478 0 +0x80000001 0x0005C3 0 +0x80000001 0x00CDF5 0 +0x80000001 0x007741 0 + + +! The following occurs on router R4 +R4# show ip route 172.30.0.0 +Routing entry for 172.30.0.0/16, 5 known subnets +Variably subnetted with 2 masks + +O E2 172.30.17.0/30 [110/20] via 172.16.14.1, 00:01:10, Serial0/0/0 +O E2 172.30.26.0/23 [110/20 ] via 172.16.14.1, 00:01:11, Serial0/0/0 +O E2 172.30.2.0/23 [110/20] via 172.16.14.1, 00:01:11, Serial0/0/0 +O E2 172.30.6.0/23 [110/20] via 172.16.14.1, 00:01:11, Serial0/0/0 +O E2 172.30.12.0/30 [110/20] via 172.16.14.1, 00:01:11, Serial0/0/0 + +After adding the subnets option, Router RD1 redistributes the five routes from the EIGRP domain. Of particular interest: + +■ If you look back to Example 10-7 ’s show ip route command output from Router RD1, you see three EIGRP-learned routes, plus two connected routes, inside the EIGRP domain. Example 10-9’s two show commands confirm that OSPF redis-tributes the three EIGRP-learned routes, plus the two connected subnets on which EIGRP is enabled (172.30.12.0/30 and 172.30.17.0/30). + +■ The show ip ospf database command in Example 10-9 lists R1 (RID 1.1.1.1) as the advertising router of the five new Type 5 LSAs, because RD1 (with RID 1.1.1.1) cre-ated each Type 5 LSA. + +■ Per OSPF internal Router R4’s show ip route 172.30.0.0 command at the end of Example 10-9, the external metric type is indeed E2, meaning external Type 2. + +■ Per that same command on Router R4, the metric for each route is 20. The reasoning is that the default metric is 20 when redistributing from EIGRP into OSPF, and with an E2 route, internal OSPF costs are not added to the cost of the route. + +That last point regarding the external route type requires a little more discussion. OSPF defines external routes as either an external Type 1 (E1) or external Type 2 (E2) route. By default, the OSPF redistribute command creates Type 2 routes, noting this external route type in the Type 5 LSA. The difference between the two lies in how OSPF calculates the metrics for E1 and E2 routes. + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 423 + +The next section completes the discussion of how OSPF can set the metrics when redis-tributing routes—or more specifically, the metric as listed in the Type 5 LSA created for that subnet. Following that, the text takes a detailed look at how OSPF calculates the best route for E2 routes. Later, the section “Redistributing into OSPF as E1 Routes” dis-cusses the same subject, but for E1 routes. + +Setting OSPF Metrics on Redistributed Routes + +As mentioned earlier, no matter the source of the redistributed route, OSPF has a default metric to use. However, OSPF can set the metrics for redistributed routes using the same options used for EIGRP. Table 10-5 summarizes the defaults and metric setting options for redistribution into OSPF. + + +Table 10-5 Key +Topic Function + + +Summary of Metric Values When Redistributing into OSPF + +Command or Metric Values + + + +Default if no metric configuration exists + + + + +Setting the default for all redistribute commands +Setting the metric for one route source + +Setting different metrics for routes learned from a single source + +Cost 1 for routes learned from BGP. + +If redistributed from another OSPF process, use the source route’s OSPF cost. + +Cost 20 for all other route sources. + +The default-metric cost OSPF subcommand. + +The metric cost parameters on the redistribute command. +Use the route-map parameter on the redistribute command. + + + + +LSAs and Metrics for External Type 2 Routes + +To appreciate how OSPF calculates the possible routes for each E2 route, you need to take a moment to think about the Type 5 LSA in more detail. First, by definition, the router that performs the redistribution into OSPF becomes an autonomous system border router (ASBR), because it injects external routes into OSPF. For each such route, that ASBR creates a Type 5 LSA for that subnet. The Type 5 LSA includes the following fields: + +■ LSID (Link-state ID): The subnet number + +■ Mask: The subnet mask + +■ Advertising Router: The RID of the ASBR injecting the route + +■ Metric: The metric as set by the ASBR + +■ External Metric Type: The external metric type, either 1 or 2 + + + + +From the Library of Alexey Evseenko +424 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +When created, the ASBR floods the Type 5 LSA throughout the area. Then, if any area border routers (ABR) exist, the ABRs flood the Type 5 LSAs into any normal (nonstubby) areas (note that ABRs cannot forward Type 5 LSAs into any type of stubby area, instead relying on default routes). Figure 10-7 shows a sample flooding of the Type 5 LSA for EIGRP subnet 172.30.27.0/23 as an E2 route. + +EIGRP OSPF + + + + + +R7 R8 + + + +172.30.26.0/23 RID +1.1.1.1 RD1 + + +Fa0/0 + + + +S0/0/0 Fa0/0 48.4 +14.2 + + +Fa0/1 R2 R3 R4 4.4 +S0/0/0 S0/0/1 35.3 45.4 + + + +S0/0 35.5 +R5 + + +S0/0/0 45.5 + +Area 1 + + +Figure 10-7 Flooding of Type 5 LSAs + +When flooded, OSPF has little work to do to calculate the metric for an E2 route, because by definition, the E2 route’s metric is simply the metric listed in the Type 5 LSA. In other words, the OSPF routers do not add any internal OSPF cost to the metric for an E2 route. + +Because routers ignore internal cost when calculating E2 external route metrics, whenever an alternative route can be calculated, the metrics tie. For example, in Figure 10-7, Router R4 has two possible physical routes to ASBR RD1—one directly to RD1 and one through R8. The cost for both routes to external subnet 172.30.26.0/23 will be 20, because that is the cost that RD1 assigned to the route (actually, the Type 5 LSA) when redistributing the route. + +To avoid loops, OSPF routers use a tiebreaker system to allow a router to choose a best external route. The logic differs slightly depending on whether the router in question resides in the same area as the ASBR (intra-area) or in a different area (interarea), as dis-cussed in the next two sections. + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 425 + +Determining the Next Hop for Type 2 External Routes—Intra-area + +When a router finds multiple routes for the same E2 destination subnet, it chooses the best route based on the lowest cost to reach any ASBR(s) that advertised the lowest E2 metric. For example, if five ASBRs all advertised the same subnet as an E2 route, and two ASBRs advertised a metric of 10, and the other three advertised a metric of 20, either +of the first two ASBRs could be used. Then, the router calculates its lowest-cost route to reach the ASBR and uses the next-hop IP address and outgoing interface listed in that route. + +The following list spells out the mechanics of the calculation used to break the tie when multiple equal-cost E2 routes exist for a particular subnet: + +Key Step 1. Topic Step 2. + + +Step 3. + + +Step 4. + + +Find the advertising ASBR(s) as listed in the Type 5 LSA(s) for Type 5 LSAs. + +Calculate the lowest-cost route to reach any of the ASBR(s) based on the intra-area LSDB topology. + +Use the outgoing interface and next hop based on the best route to reach the ASBR (as chosen at Step 2). + +The route’s metric is unchanged—it is still simply the value listed in the Type +5 LSA. + + +For example, use Router R4 in Figure 10-7 as an example and the E2 route for 172.30.26.0/23. Before using these four steps, R4 calculated two possible routes for 172.16.26.0/23: an E2 route directly to RD1 and another route through R8. Both routes use metric 20 in this case so the routes tie. Because of the tie, R4 proceeds with the fol-lowing steps: +Step 1. R4 looks in the Type 5 LSA and sees RID 1.1.1.1 (RD1) is the advertising ASBR. + +Step 2. R4 then looks at its area 0 LSDB entries, including the Type 1 LSA for RID 1.1.1.1, and calculates all possible area 0 routes to reach 1.1.1.1. + +Step 3. R4’s best route to reach RID 1.1.1.1 happens to be through its S0/0/0 interface, to next-hop RD1 (172.16.14.1), so R4’s route to 172.16.26.0/23 uses these details. +Step 4. The route lists metric 20, as listed in the Type 5 LSA. + +Figure 10-8 shows the interface costs that Router R4 will use, based on its LSDB, to calculate the cost for two possible routes to reach ASBR RD1. Again using subnet 172.30.26.0/23 as an example, RD1 first looks at the Type 5 external LSA and sees RID 1.1.1.1 as the advertising ASBR. R4 then calculates the costs based on its intra-area LSDB—but we can perform the equivalent by adding the interface costs seen in Figure +10-8. Example 10-10 lists the external Type 5 LSAs, highlighting subnet 172.30.26.0/23 and the interface costs on both R4 and R8, as seen in the figure. + + + + + + + +From the Library of Alexey Evseenko +426 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +S0/0 +Cost 64 R8 + + +Cost 65 + +RD1 ASBR + + +Cost 1 Fa0/0 + +S0/0/0 +Cost 64 R4 + +Cost 64 + +Figure 10-8 R4’s Cost to Reach ASBR RD1 + +Example 10-10 Verifying OSPF External Routes—Intra-area + +R4# show ip ospf database | begin Ext +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +172.30.2.0 +172.30.6.0 +172.30.12.0 +172.30.17.0 +172.30.26.0 + +1.1.1.1 189 +1.1.1.1 189 +1.1.1.1 189 +1.1.1.1 189 +1.1.1.1 189 + +0x80000002 0x007E51 0 +0x80000002 0x005279 0 +0x80000002 0x0003C4 0 +0x80000002 0x00CBF6 0 +0x80000002 0x007542 0 + + +R4# show ip ospf database external 172.30.26.0 + +OSPF Router with ID (4.4.4.4) (Process ID 4) + +Type-5 AS External Link States + +Routing Bit Set on this LSA +LS age: 175 +Options: (No TOS-capability, DC) +LS Type: AS External Link +Link State ID: 172.30.26.0 (External Network Number ) +Advertising Router: 1.1.1.1 +LS Seq Number: 80000001 +Checksum: 0x7741 +Length: 36 +Network Mask: /23 +Metric Type: 2 (Larger than any link state path) + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 427 + +TOS: 0 +Metric: 20 +Forward Address: 0.0.0.0 +External Route Tag: 0 + +R4# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Se0/0/0 4 0 +Fa0/1 4 0 +Fa0/0 4 0 +Se0/0/1 4 1 + +172.16.14.2/30 +172.16.4.4/25 +172.16.48.4/25 +172.16.45.4/25 + +64 P2P 1/1 +1 DR 0/0 +1 DR 1/1 +64 P2P 1/1 + + +! Next output occurs on R8 +R8# show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Fa0/1 8 0 +Se0/0 8 0 +Fa0/0 8 0 + +172.16.8.8/25 +172.16.18.2/30 +172.16.48.8/25 + +1 DR 0/0 +64 P2P 1/1 +1 BDR 1/1 + + + +Determining the Next Hop for Type 2 External Routes—Interarea + +When a router exists in a different area than the ASBR, the issues remain the same, but the tiebreaker calculation of choosing the least-cost route to reach the ASBR changes. If a router finds multiple routes to reach a single E2 subnet, some or all might tie based on metric, because the metric is based solely on the external cost as defined by the ASBR. (If multiple ASBRs redistribute routes for the same prefix, each ASBR can assign a differ- +ent metric.) A router then chooses the best route based on the least-cost route to reach an ASBR that has advertised the lowest E2 cost for the subnet. + +When the ASBR is in a different area, the calculation of the cost to reach the ASBR requires more information, and even an additional LSA type, as compared with the intra-area calculation. To calculate its best route to reach the ASBR, a router in another area adds the cost to reach an ABR between the areas, plus that ABR’s cost to reach the ASBR. To make more sense of that concept, Figure 10-9 shows a portion of Figure 10-7, with costs highlighted, assuming that the OSPF reference bandwidth is also using default settings. + +R5 has two possible routes shown in Figure 10-9 to reach ASBR RD1. On the left, the path through R3 has a total cost of 65. To the right, the router through ABR R4 has a total cost of 128. R5 then chooses the route through R3 as the best route based on the least cost to reach the ASBR. + + + + + + + + + + +From the Library of Alexey Evseenko +428 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Area 0 + +RD1 + + + + + +Cost 1 Fa0/0 + +R3 + + +Cost Cost 65 128 + +Cost 64 S0/0/0 + +R4 + + + + + +Cost 64 Cost 64 S0/0 S0/1 +R5 Area 1 + +Figure 10-9 R5’s Cost to Reach ASBR RD1 + +For humans, when you have a figure and know all costs, the calculation of the costs of the two routes is simple. However, for routers, the calculation occurs in two parts: +Step 1. Calculate the cost to reach the ABR, based on the local area’s topology database. + +Step 2. Add the cost from the ABR to the ASBR, as listed in a Type 4 LSA. + +ABRs create this new type of LSA—the Type 4 Summary ASBR LSA—to support the logic mentioned at Step 2. The Type 4 ASBR LSA lists the RID of the ASBR, and the RID of the ABR that created and flooded the Type 4 LSA. Most importantly, the Type 4 LSA lists that ABR’s cost to reach the ASBR. In effect, the LSA makes an announcement like this: “I am ABR X. I can reach ASBR Y, and my cost to reach that ASBR is Z.” In short, it allows the second part of the computation. + +ABRs create Type 4 LSAs in reaction to receiving an external LSA from some ASBR. When an ABR forwards a Type 5 LSA into an area, the ABR looks at the RID of the ASBR that created the Type 5 LSA. The ABR then creates a Type 4 LSA listing that ASBR, and the cost to reach that ASBR, flooding that Type 4 LSA into the neighboring areas. + +For example, using Figure 10-9 again, R3 would create and flood a Type 4 Summary ASBR LSA into area 1. R3’s Type 4 LSA lists ASBR 1.1.1.1 (RD1), ABR 3.3.3.3 (itself), and cost 1 (R3’s cost to reach 1.1.1.1). Similarly, in that same example, ABR R4 would create another Type 4 ASBR Summary LSA. This LSA also lists ASBR 1.1.1.1 (RD1), but with advertising ABR 4.4.4.4 (R4), and lists cost 64 (R4’s cost to reach 1.1.1.1). + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 429 + +R5, internal to area 1, then calculates the cost for each competing route by adding R5’s intra-area cost to reach the respective ABRs (Step 1 in the previous list) to the cost listed in the corresponding Type 4 LSAs (Step 2 in the previous list). When R5 calculates two possible routes to reach external subnet 172.30.26.0/23, R5 finds routes both have a met-ric of 20, so R5 tries to break the tie by looking at the cost to reach the ASBR over each route. To do so, R5 examines each route, adding its intra-area cost to reach the ABR to the ABR’s cost to reach the ASBR (as listed in the Type 4 LSA). In this case, R5 finds that the route through R3 has the lower cost (65), so R5 uses outgoing interface S0/0 for its route to 172.30.26.0/23. + +Example 10-11 lists the show command output that demonstrates the same example. Again focusing on R5’s route for 172.30.26.0/23, the example first shows R5’s LSDB, beginning with the Summary ASBR LSAs. More discussion follows the example. + +Example 10-11 Redistributing from EIGRP into OSPF, with Subnets + +R5# show ip ospf database | begin ASB +Summary ASB Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum + +1.1.1.1 +1.1.1.1 + +3.3.3.3 +4.4.4.4 + +956 0x8000000D 0x00E43A +1044 0x8000000B 0x00439A + + +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +172.30.2.0 +172.30.6.0 +172.30.12.0 +172.30.17.0 +172.30.26.0 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 + +1185 0x8000000B 0x006C5A 0 +1185 0x8000000B 0x004082 0 +1185 0x8000000B 0x00F0CD 0 +1185 0x8000000B 0x00B9FF 0 +1185 0x8000000B 0x00634B 0 + + +R5# show ip ospf database asbr-summary + +OSPF Router with ID (5.5.5.5) (Process ID 5) + +Summary ASB Link States (Area 1) + +Routing Bit Set on this LSA +LS age: 984 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(AS Boundary Router) +Link State ID: 1.1.1.1 (AS Boundary Router address) +Advertising Router: 3.3.3.3 +LS Seq Number: 8000000D +Checksum: 0xE43A +Length: 28 + + + + +From the Library of Alexey Evseenko +430 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Network Mask: /0 +TOS: 0 Metric: 1 + +LS age: 1072 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(AS Boundary Router) +Link State ID: 1.1.1.1 (AS Boundary Router address) +Advertising Router: 4.4.4.4 +LS Seq Number: 8000000B +Checksum: 0x439A +Length: 28 +Network Mask: /0 +TOS: 0 Metric: 64 + +R5# show ip ospf border-routers +OSPF Process 5 internal Routing Table +Codes: i - Intra-area route, I - Inter-area route + +i 4.4.4.4 [64] via 172.16.45.4, Serial0/1, ABR , Area 1, SPF 6 +I 1.1.1.1 [65] via 172.16.35.3, Serial0/0, ASBR , Area 1, SPF 6 +i 3.3.3.3 [64] via 172.16.35.3, Serial0/0, ABR , Area 1, SPF 6 + +R5# show ip route 172.30.0.0 +Routing entry for 172.30.0.0/16, 5 known subnets +Variably subnetted with 2 masks + +O E2 172.30.17.0/30 [110/20] via 172.16.35.3, 05:48:42, Serial0/0 +O E2 172.30.26.0/23 [110/20] via 172.16.35.3, 05:48:42, Serial0/0 + +O E2 172.30.2.0/23 +O E2 172.30.6.0/23 + +[110/20] via 172.16.35.3, 05:48:42, Serial0/0 +[110/20] via 172.16.35.3, 05:48:42, Serial0/0 + +O E2 172.30.12.0/30 [110/20] via 172.16.35.3, 05:48:42, Serial0/0 + +The show ip ospf database | begin ASB command’s output lists two Type 4 LSAs. (The command itself lists the summary of R5’s OSPF LSDB, beginning with the section that lists Type 4 LSAs.) Both Type 4 LSAs list ASBR RD1’s RID of 1.1.1.1 as the LSID, but they each list different advertising routers: 3.3.3.3 (R3) and 4.4.4.4 (R4). In that same com-mand, the output lists five Type 5 LSAs for the five subnets in the EIGRP domain, each with advertising Router 1.1.1.1 (RD1). + +The next command, show ip ospf database asbr-summary, lists the same two Type 4 LSAs seen in the previous command, but in detail. The first lists ASBR 1.1.1.1 (RD1), with ABR 3.3.3.3 (R3) and a cost of 1. The second lists ASBR 1.1.1.1, but with ABR 4.4.4.4 (R4) and a cost of 64. The costs list the respective ABR’s cost to reach ASBR 1.1.1.1. + +The third command, show ip ospf border-routers, lists a line for every ABR and ASBR known to the local router. It lists whether the router is inside the same area or in another area, the RID of the ABR or ASBR, and this router’s best route to reach each ABR and + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 431 + +ASBR. This command essentially shows the answer to the question “Which route to ASBR 1.1.1.1 is best?” Finally, the last command lists R5’s IP route for 172.30.26.0, with the same next-hop and outgoing interface information as seen in the entry for RID 1.1.1.1 in the output of the show ip ospf border-routers command. + +Redistributing into OSPF as E1 Routes + +OSPF’s external metric type feature gives engineers a design tool for influencing the choice of best route. E2 routes work well when the design needs to choose the best route based on the external metric—in other words, the metric as perceived outside the OSPF domain. E2 routes ignore the internal OSPF cost (except when breaking ties for +best route). Therefore, when OSPF compares two E2 routes for the same subnet, that first choice to pick the lowest-metric route is based on the external metric only. + +OSPF routers calculate the metrics of E1 routes by adding the internal cost to reach the ASBR to the external cost defined on the redistributing ASBR. As a result, an engineer can influence the choice of routes based on the combination of the external and internal OSPF cost simply by redistributing a route as an E1 route instead of as an E2 route. To take advantage of this feature, the redistribute command simply needs to set the metric type. + +Example 10-12 shows the simple change to the redistribution configuration on RD1 (as shown earlier in Example 10-9) to make all routes redistributed from EIGRP into OSPF be E1 routes. The example also lists output from R4 demonstrating the metric, which is based on the (default) external metric (20) plus R4’s best internal metric to reach ASBR 1.1.1.1 (64). + +Example 10-12 Redistributing from EIGRP into OSPF, with Subnets + +RD1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +RD1(config)# router ospf 2 +RD1(config-router)# redistribute eigrp 1 subnets metric-type 1 +RD1(config-router)# end +RD1# + +! Moving to router R4 +R4# show ip route 172.30.0.0 +Routing entry for 172.30.0.0/16, 5 known subnets +Variably subnetted with 2 masks + +O E1 172.30.17.0/30 [110/84] via 172.16.14.1, 00:00:06, Serial0/0/0 +O E1 172.30.26.0/23 [110/ 84 ] via 172.16.14.1, 00:00:06, Serial0/0/0 +O E1 172.30.2.0/23 [110/84] via 172.16.14.1, 00:00:06, Serial0/0/0 +O E1 172.30.6.0/23 [110/84] via 172.16.14.1, 00:00:06, Serial0/0/0 +O E1 172.30.12.0/30 [110/84] via 172.16.14.1, 00:00:06, Serial0/0/0 + + + + + + +From the Library of Alexey Evseenko +432 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +R4# show ip ospf border-routers + +OSPF Process 4 internal Routing Table +Codes: i - Intra-area route, I - Inter-area route + +i 1.1.1.1 [64] via 172.16.14.1, Serial0/0/0, ASBR, Area 0, SPF 16 +i 3.3.3.3 [65] via 172.16.14.1, Serial0/0/0, ABR, Area 0, SPF 16 +i 3.3.3.3 [128] via 172.16.45.5, Serial0/0/1, ABR, Area 1, SPF 8 + +Note that for routers in a different area than the ASBR, the calculation of metric follows the same general logic used when breaking ties for E2 routes. Generally, the computation adds three items: + +■ The best intra-area cost to reach the ABR (per that area’s LSDB) Key +Topic ■ The cost from that ABR to the ASBR (per Type 4 LSA) + +■ The external cost for the route (per Type 5 LSA) + +For example, Figure 10-9 shows that R5’s best cost to reach ASBR RD1 was out S0/0, to R3 next, with a cost of 65. Adding the external cost of 20, R5’s best route will have a metric of 85. R5 calculates that cost by adding the following: + +■ The intra-area cost to ABR R3 (64), by analyzing the area 1 LSDB entries + +■ R3’s cost to reach ASBR 1.1.1.1, as listed in its Type 4 LSA (1) + +■ The external cost as listed in the Type 5 LSA (20) + + +A Brief Comparison of E1 and E2 Routes + +OSPF defines two types of external routes to give network designers two slightly differ-ent tools with which to calculate the best route to reach a destination external to OSPF. For E1 routes, both the external cost and internal OSPF cost matter to the choice of best route. For E2 routes, only the external cost matters to the choice of best route (unless a tie needs to be broken). + +The benefits of the different external route types apply mostly to when multiple ASBRs advertise the same subnet. For example, imagine two ASBRs, ASBR1 and ASBR2, between OSPF and another routing domain. If the goal is to always send traffic through ASBR1, you could use E2 routes and set the metric for ASBR1’s redistributed routes to a lower metric than ASBR2. Because routers ignore the internal metrics when calculat-ing the E2 metrics, every router chooses ASBR1 as the better ASBR. Conversely, if the goal were to load-balance the traffic, and make each router pick the closest ASBR, both +ASBRs could set the same metric on their redistributed routes, but make the routes Type E1. As a result, routers closer to each ASBR choose best routes based on the lower OSPF internal costs. + +Also, note that for a given prefix/length, OSPF always prefers an E1 route over an E2 route. + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 433 + +External Routes in NSSAs + +Routes can be redistributed into OSPF on any OSPF router, with a few exceptions. The router can be internal to area 0, like Router RD1 in the many examples earlier in this chapter. It can also be an ABR connected to several areas. It can be a router internal to a nonbackbone area as well. + +Of the four types of stubby areas, two do not allow redistribution into the area, and two do allow redistribution—even though none of the stubby area types allow Type 5 LSAs. OSPF does not allow routers in stubby and totally stubby areas to inject external routes. However, routers in not-so-stubby areas—NSSAs—can redistribute routes, while still holding to the restriction of having no Type 5 LSAs. + +OSPF supports the injection of external routes into NSSAs by defining the Type 7 AS External LSA. This LSA type essentially replaces the Type 5 LSA’s role, but only inside the NSSA. Figure 10-10 shows a conceptual view. + +Other Routing Domain + +Subnet 1 +1 + +ASBR red2istribute 3 Type 5 4 Type 5 Type 7 T7 T5 LSA T5 LSA +LSA + +NSSA Area 1 + + +ABR1 R1 ABR2 + +Area 0 + + +R2 +Normal Area 2 + + +Figure 10-10 Process of Adding and Converting Type 7 LSAs + +Following the steps in the figure: + +Step 1. The ASBR attached to NSSA area 1 redistributes a route for subnet 1, creating a Type 7 LSA. + +Step 2. The ASBR floods the Type 7 LSA throughout NSSA area 1. + +Step 3. ABR1 converts the Type 7 LSA to a Type 5 LSA when forwarding into other areas (area 0 in this case). + +Step 4. ABR2, connected to another normal area, forwards the Type 5 LSA for subnet 1 into normal area 2. + +Example 10-13 demonstrates the concept using area 1 from Figures 10-7 and 10-9. Area 1 has been converted to be an NSSA. R5 has been configured to redistribute connected routes. This feature allows a router to inject connected routes into a routing domain with-out having to enable the routing protocol on the corresponding interfaces. In this case, + + + + +From the Library of Alexey Evseenko +434 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +R5 will redistribute subnet 10.1.1.0/24, a connected route added by R5 using interface Loopback0. + +Example 10-13 Redistributing from EIGRP into OSPF, with Subnets + +! R5's new configuration here: +interface loopback0 +ip address 10.1.1.1 255.255.255.0 +router ospf 5 +area 1 nssa +redistribute connected subnets + +R5# show ip ospf database | begin Type-7 +Type-7 AS External Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum Tag +10.1.1.0 5.5.5.5 26 0x80000001 0x00E0A6 0 + +R5# show ip ospf database nssa-external + +OSPF Router with ID (5.5.5.5) (Process ID 5) + +Type-7 AS External Link States (Area 1) + +LS age: 69 +Options: (No TOS-capability, Type 7/5 translation, DC) +LS Type: AS External Link +Link State ID: 10.1.1.0 (External Network Number ) +Advertising Router: 5.5.5.5 +LS Seq Number: 80000001 +Checksum: 0xE0A6 +Length: 36 +Network Mask: /24 +Metric Type: 2 (Larger than any link state path) +TOS: 0 +Metric: 20 +Forward Address: 172.16.45.5 +External Route Tag: 0 + +! Moving to router R8 +R8# show ip ospf database | begin Type-7 + +R8# show ip ospf database | begin External +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag +10.1.1.0 4.4.4.4 263 0x80000001 0x009302 0 + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 435 + + +172.30.2.0 +172.30.6.0 +172.30.12.0 +172.30.17.0 +172.30.26.0 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 + +1655 0x8000000E +1655 0x8000000E +1655 0x8000000E +1655 0x8000000E +1655 0x8000000E + +0x00665D 0 +0x003A85 0 +0x00EAD0 0 +0x00B303 0 +0x005D4E 0 + + +The example begins with configuration on R5, followed by show commands on both Router R5 and R8. In particular, the show ip ospf database | begin Type-7 command on R5 skips output until the heading for Type 7 LSAs, listing one such LSA. The LSA lists the subnet number (10.1.1.0) as the LSID and the ASBR’s RID (5.5.5.5, or R5). The next command provides output from the show ip ospf database nssa-external command on R5, which shows the details in the Type 7 LSA, including the LSA cost of 20—the same default used when injecting routes as Type 5 LSAs. + +The second half of the output, on Router R8, starts with another show ip ospf database | begin Type-7 command—the same command seen earlier in the example on R5. The null output in this command confirms that R8 has no Type 7 LSAs. However, the final command in the example confirms that R8 does have a Type 5 external LSA for subnet 10.1.1.0, with a listing of R4 (4.4.4.4) as the advertising router. This LSA does not list R5’s RID of 5.5.5.5 as the advertising router, because R5 did not create this Type 5 LSA. Instead, R4 created this Type 5 LSA when R4 reacted to learning the Type 7 LSA inside area 1. + +Finally, Example 10-14 shows a few interesting items about the IP routing table with NSSAs. Routers inside the NSSA use a different code in the output of show ip route to denote NSSA external routes as compared with normal external routes. The example +shows R4’s IP routing table, which lists an N2 route. This means that it is external Type 2, but inside an NSSA, and using a Type 7 AS external LSA. The second part of the exam-ple shows R8’s route for the same subnet. Because R8 is inside a non-NSSA, R8 knows of subnet 10.1.1.0/24 because of a Type 5 LSA, so R8 lists the route as an E2 route. + +Example 10-14 Redistributing from EIGRP into OSPF, with Subnets + +! R4's output here: +R4# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +! lines omitted for brevity + +10.0.0.0/24 is subnetted, 1 subnets + + + + +From the Library of Alexey Evseenko +436 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +O N2 10.1.1.0 [110/20] via 172.16.45.5, 00:10:54, Serial0/0/1 + +! R8, in area 0, next +R8# show ip route | begin 10.0.0.0 +10.0.0.0/24 is subnetted, 1 subnets +O E2 10.1.1.0 [110/20] via 172.16.48.4, 00:10:24, FastEthernet0/0 + + +Redistribution with Route Maps and Distribute Lists + +In some cases, a redistribution design calls for all routes to be redistributed, all with the same metric and all with the same external route type (if applicable). However, in other cases, the metrics might need to be set differently for different routes. Additionally, some designs require that only a subset of the routes should be redistributed, for example, when only a few key subnets need to be exposed for connections from a partner. And with routing protocols that have different types of external routes, such as OSPF and +IS-IS, the design might or might not allow all redistributed routes to be of the same exter-nal route type. + +All these features require a tool by which Cisco IOS can identify the routes that need to be treated differently, whether given different metrics, filtered, or assigned a different external route type. Cisco IOS provides such a feature by allowing a reference to a route map from the redistribute command. Specifically, the route map can perform the following: + + +Key ■ Topic + +■ + +■ + +■ + + +■ + +Identify the subset of the routes to filter or change based on the route’s prefix/ length, plus many other factors. + +Make filtering choices about which routes are redistributed and which are not. + +Set the metric to different values based on information matchable by the route map. + +Set the type of external route for different redistributed routes, for example, OSPF Type 1 for some routes and Type 2 for others. + +Set a route tag, a unitless integer value that can later be matched with a route map at +another redistribution point. + + +This section examines the mechanics of using the route-map option of the redistribute command to filter routes and set the metrics, along with a few other small features. + +Overview of Using Route Maps with Redistribution + +The redistribute command has two mechanisms that allow filtering of routes: + +■ The match {internal | external 1 | external 2 | nssa-external} parameters + +■ The route-map map-name option + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 437 + +Of these two options, the first applies only when redistributing from OSPF, and matches routes solely based on the types of routes listed here. However, the route map referenced by the redistribute command has many options for identifying routes by matching vari-ous facts about the route. + +To identify the routes, route maps use the match subcommand. The match command can refer to ACLs and prefix lists to match anything matchable by those tools, plus match other facts more directly. Table 10-6 lists the match command options that matter when using route maps for IGP redistribution. + +Table 10-6 match Command Options for Redistribution +Key +Topic match Command Description + + +match interface interface-type interface-number [... interface-type interface-number] + +* match ip address {[access-list-number | access-list-name] | prefix-list prefix-list-name} + +* match ip next-hop {access-list-number | access-list-name} + +* match ip route-source {access-list-number | access-list-name} + +match metric metric-value [ +- deviation ] + +match route-type {internal | external [type–1 | type–2 ] | level–1 | level–2} + +match tag tag-value [...tag-value] + +Looks at outgoing interface of routes + +Examines route destination prefix and prefix length + +Examines route’s next-hop address + +Matches advertising router’s IP address + +Matches route’s metric, or a range (plus/minus the configured deviation) +Matches route type + +Matches the route tag, which requires that another router has earlier set the tag + + +* Can reference multiple numbered and named ACLs with a single match command. + +A route map referenced by the redistribute command always attempts to filter routes. If the route map matches a particular route with a particular route-map clause, and the action in that clause is permit, the route is redistributed. However, if the first route-map clause matched by a route has a deny action, the route is filtered—in other words, not redistributed. + +Additionally, for routes not filtered by the route map, the route map can set other values (like the route’s metric) using the aptly named set command. Table 10-7 lists the various route map set subcommands that can be used to set the values used for routes redistrib-uted into IGPs. + + + + + + + + + + +From the Library of Alexey Evseenko +438 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 10-7 set Command Options for Redistribution into IGPs +Key +Topic set Command Description + + +set metric metric-value + +set metric bandwidth delay reliability loading mtu +set metric-type {type–1 | type–2} + +set tag tag-value + +Sets the route’s metric for OSPF, RIP, and IS-IS +Sets an EIGRP route’s metric values + +Sets type of route for OSPF + +Sets the unitless tag value in a route + + + + +Filtering Redistributed Routes with Route Maps + +As usual, the best way to understand the configuration, and the methods to verify the results, is to use an example. In this case, the same internetwork seen earlier in this chap-ter is used, but with some more routes added. Figure 10-11 shows some of the details of the internetwork. + + +EIGRP 1 Domain + + + +0.0/23 + +OSPF Domain + + + +8.0/25 + + + + + +R7 17.0/30 18.0/30 R8 + + + +26.0/23 RD1 + + +12.0/30 14.0/30 R2 + + +2.0/23 + +48.0/25 + + + +R4 + + + +4.0/25 + + +.101.0/24 .102.0/25 .103.0/26 .104.0/27 .105.0/28 .106.0/29 .107.0/30 + + + +Area 0 Area 3 + +All addresses begin 172.30 All addresses begin 172.16 + +Figure 10-11 Sample Internetwork Used for Redistribution Route Map Examples + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 439 + +The internetwork has been preconfigured with mainly defaults, as follows: + +■ EIGRP works on the left side of Figure 10-11. + +■ OSPF works on the right side. + +■ Mutual redistribution has been configured on Router RD1, with no filtering. + +■ All routes use these metric settings: EIGRP (1500 10 255 1 1500), OSPF (20). + +Example 10-15 shows the routing protocol configuration on Router RD1 at the beginning of the example. + +Example 10-15 Initial Configuration—Mutual Redistribution, No Filtering + +RD1# show run +! lines omitted for brevity +router eigrp 1 +redistribute ospf 2 +network 172.30.0.0 +default-metric 1500 10 255 1 1500 +auto-summary +! +router ospf 2 +router-id 1.1.1.1 +log-adjacency-changes +redistribute eigrp 1 subnets +network 172.16.0.0 0.0.255.255 area 0 + + +Configuring Route Filtering with Redistribution + +The configuration shown in Example 10-15 shows mutual redistribution with no filtering. The next example extends that same configuration to now use a route map that should filter routes being redistributed from OSPF process 2 into EIGRP AS 1. Any routes not mentioned in Table 10-8, but shown in Figure 10-11, should be redistributed. + + +Table 10-8 + +Prefixes + + +Parameters Used in Route-Filtering Example + +Action + +172.16.101.0/24 deny + +172.16.102.0/25 + +172.16.103.0/26 permit + +172.16.104.0/27 + +172.16.105.0/28 deny + +172.16.106.0/29 + +172.16.107.0/30 permit + + + + +From the Library of Alexey Evseenko +440 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The route map simply needs to match the routes to be filtered with a route-map clause that has a deny action and match the routes to not be filtered with a clause that has a permit action. Example 10-16 shows two such potential solutions, with route map names option1 and option2. The general style of the two options, both of which work, is as follows: + +■ option1: Begin with a match of the routes to be filtered, using extended IP ACLs, with a deny action so that the routes are filtered. Then use a permit clause with no match command, matching and allowing through all remaining routes. + +■ option2: Begin with a match of the routes to be allowed, matching with prefix lists, with a permit action. Then use the implicit deny all at the end of the route map to filter unwanted routes. + +Example 10-16 Redistribution Filtering Configuration Example + +! This ACL matches subnet 172.16.101.0, with mask 255.255.255.0 +ip access-list extended match-101 +permit ip host 172.16.101.0 host 255.255.255.0 + +! This ACL matches subnets 172.16.104.0 and 172.16.105.0, with masks +! 255.255.255.224 and 255.255.255.240, respectively. +ip access-list extended match-104-105 +permit ip host 172.16.104.0 host 255.255.255.224 +permit ip host 172.16.105.0 host 255.255.255.240 +! +! This prefix list matches the five subnets in area 0 +ip prefix-list match-area0-permit seq 5 permit 172.16.14.0/30 +ip prefix-list match-area0-permit seq 10 permit 172.16.18.0/30 +ip prefix-list match-area0-permit seq 15 permit 172.16.8.0/25 +ip prefix-list match-area0-permit seq 20 permit 172.16.4.0/25 +ip prefix-list match-area0-permit seq 25 permit 172.16.48.0/25 +! +! This prefix list matches the two sets of two area 3 subnets that will +! be permitted to be redistributed +ip prefix-list match-area3-permit seq 5 permit 172.16.102.0/23 ge 25 le 26 +ip prefix-list match-area3-permit seq 10 permit 172.16.106.0/23 ge 29 le 30 + +! The first alternative route-map: +route-map option1 deny 10 +match ip address match-101 +! +route-map option1 deny 20 +match ip address match-104-105 +! +route-map option1 permit 100 + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 441 + +! The second alternative route-map: +route-map option2 permit 10 +match ip address prefix-list match-area3-permit +! +route-map option2 permit 20 +match ip address prefix-list match-area0-permit + +! Finally, the configuration shows the enablement of option 1. +router eigrp 1 +redistribute ospf 2 route-map option1 + +Route map option1 takes the approach of denying the redistribution of some routes and then allowing the rest through. The last clause in this route map, with sequence number 100, does not have a match command, meaning that it will match any and all routes. The permit action on this last clause overrides the implied deny all at the end of the route map. + +The ACLs referenced by route map option1 show some particularly interesting features for matching routes. With an extended ACL, Cisco IOS compares the source IP address parameter to the subnet address of the route and the destination IP address to the subnet mask of the route. For example, the permit ip host 172.16.101.0 host 255.255.255.0 command matches the specific route for subnet 172.16.101.0, specifically with mask 255.255.255.0. + +Route map option2 takes the opposite approach compared to option1, for no other reason than to just show an alternative. It uses two different prefix lists to match the routes—one for subnets in area 0, all of which are redistributed, and another for subnets in area 3 that should be allowed through the redistribution process. Alternatively, all routes could have been matched with a single prefix list, with a single permit clause in the option2 route map. + +Finally, the very end of the example shows the syntax of the redistribute command, with route map option1 enabled. + +Verifying Redistribution Filtering Operations + +The redistribution process takes routes from the IP routing table of a router and adds the appropriate entries to the destination routing protocol’s topology table. The filtering +process prevents some of the routes from being added to the topology table, so an exami-nation of the destination routing protocol’s topology table shows whether the filtering worked correctly. Additionally, the routing tables of other routers in the destination rout-ing domain can be checked. + +A good redistribution verification plan should check that the correct routes are filtered and confirm that no extra routes are filtered. In a production environment, that work might be laborious. With the example shown in Figure 10-11 and Example 10-16, verifi-cation takes a little less time because of the relatively small number of routes and the fact that the subnets in the OSPF domain all begin with 172.16. + + + + +From the Library of Alexey Evseenko +442 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 10-17 shows an abbreviated version of the EIGRP topology table on Router RD1. The show ip route 172.16.0.0 command lists the 12 OSPF subnets that currently exist in the OSPF domain (as shown in Figure 10-11). The show ip eigrp topology | include 172[.]16 command lists only routes that include text “172.16,” listing only nine subnets—and omitting the three subnets that should have been filtered, which confirms that the filtering worked. + + +Note The brackets in the show ip eigrp topology | include 172[.]16 command tell Cisco IOS to treat the period as a literal, searching for the text “172.16” in the command output, instead of treating the period as a wildcard in a Cisco IOS regular expression. + + +Example 10-17 Verifying Redistribution Filtering + +RD1# show ip route 172.16.0.0 +Routing entry for 172.16.0.0/16, 12 known subnets +Attached (2 connections) +Variably subnetted with 7 masks +Redistributing via eigrp 1 + +O 172.16.48.0/25 [110/65] via 172.16.18.2, 03:25:56, Serial0/0/1 +[110/65] via 172.16.14.2, 03:24:09, Serial0/1/0 +C 172.16.18.0/30 is directly connected, Serial0/0/1 +C 172.16.14.0/30 is directly connected, Serial0/1/0 +O 172.16.8.0/25 [110/65] via 172.16.18.2, 03:25:56, Serial0/0/1 +O 172.16.4.0/25 [110/65] via 172.16.14.2, 03:24:49, Serial0/1/0 +O IA 172.16.104.0/27 [110/65] via 172.16.14.2, 03:24:44, Serial0/1/0 +O IA 172.16.105.0/28 [110/65] via 172.16.14.2, 03:24:44, Serial0/1/0 +O IA 172.16.106.0/29 [110/65] via 172.16.14.2, 03:24:44, Serial0/1/0 +O IA 172.16.107.0/30 [110/65] via 172.16.14.2, 03:24:44, Serial0/1/0 +O IA 172.16.101.0/24 [110/65] via 172.16.14.2, 03:24:44, Serial0/1/0 +O IA 172.16.102.0/25 [110/65] via 172.16.14.2, 03:24:44, Serial0/1/0 +O IA 172.16.103.0/26 [110/65] via 172.16.14.2, 03:24:44, Serial0/1/0 + +RD1# show ip eigrp topology | include 172[.]16 +P 172.16.48.0/25, 1 successors, FD is 1709056 +P 172.16.18.0/30, 1 successors, FD is 1709056 +P 172.16.14.0/30, 1 successors, FD is 1709056 +P 172.16.8.0/25, 1 successors, FD is 1709056 +P 172.16.4.0/25, 1 successors, FD is 1709056 +P 172.16.106.0/29, 1 successors, FD is 1709056 +P 172.16.107.0/30, 1 successors, FD is 1709056 +P 172.16.102.0/25, 1 successors, FD is 1709056 +P 172.16.103.0/26, 1 successors, FD is 1709056 + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 443 + +Besides examining the topology tables on the router doing the redistribution, a show ip route command on other routers inside the EIGRP domain, like R2, could be used to con-firm the presence and absence of the routes according to the plan. However, the routing table on the redistributing router will list the routes as learned from the original routing domain. + +Any ACLs or prefix lists used to match packets can also be used as a gauge to tell wheth-er the correct statements matched routes. The show ip access-list [number | name] and show ip prefix-list detail [name] commands list counters that increment each time Cisco IOS matches a route for redistribution. Particularly when first using the ACL or prefix list, these commands can confirm which statements have been matched. The counters +do increment each time the router considers whether to redistribute a route. Specifically, when a route fails, and the redistributing router removes the route from the routing table and then later adds the route to the routing table again, the counters for matching the ACL or prefix list will increment. Example 10-18 shows an example of each command and the appropriate counters. + +Example 10-18 Verifying Redistribution Filtering + +RD1# show access-list +Extended IP access list match-101 +10 permit ip host 172.16.101.0 host 255.255.255.0 (1 match ) +Extended IP access list match-104-105 +10 permit ip host 172.16.104.0 host 255.255.255.224 (1 match) +20 permit ip host 172.16.105.0 host 255.255.255.240 (1 match) +RD1# show ip prefix-list detail match-area0-permit +ip prefix-list match-area0-permit: +count: 5, range entries: 0, sequences: 5 - 25, refcount: 3 +seq 5 permit 172.16.14.0/30 (hit count: 6, refcount: 1) +seq 10 permit 172.16.18.0/30 (hit count: 5, refcount: 1) +seq 15 permit 172.16.8.0/25 (hit count: 4, refcount: 2) +seq 20 permit 172.16.4.0/25 (hit count: 3, refcount: 3) +seq 25 permit 172.16.48.0/25 (hit count: 2, refcount: 2) + + +Setting Metrics When Redistributing + +Setting a different metric for different redistributed routes requires only a minor amount of additional configuration. The redistributing router still needs a route map and still needs to match the routes. Additionally, to set the metric for routes matched by a particu-lar clause, the route map needs the set metric route map subcommand. When redistribut-ing into EIGRP, this command has five parameters (bandwidth, delay, reliability, load, and MTU). When redistributing into OSPF or Routing Information Protocol (RIP), a single integer metric is used. + +Configuring the Metric Settings + +Continuing with the same internetwork shown in Figure 10-11, and with the same filter-ing goals summarized earlier in Table 10-8, Table 10-9 further defines the goals from + + + +From the Library of Alexey Evseenko +444 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +redistribution from OSPF into EIGRP in this internetwork. The same routes will be fil-tered, but now the metrics of the allowed routes will be set differently as listed in the table. + +Table 10-9 Parameters Used in Metric and Tag Setting Example + + +Prefix Action +172.16.101.0 deny + +172.16.102.0 + +172.16.103.0 permit + +172.16.104.0 + +172.16.105.0 deny + +172.16.106.0 + +172.16.107.0 permit + +All others permit + +Metric (Bandwidth, Delay, Reliability, Load, MTU) +— + + +1000 44 255 1 1500 + + +— + + +100 4444 255 1 1500 + +1500 10 255 1 1500 + + + +The requirements in Table 10-9 list three different sets of metrics for the redistributed routes. To implement this design, the route map needs at least three clauses: one for each set of routes for which the metric should differ. The example route maps listed earlier in Example 10-16 do not happen to separate the three groups of allowed routes into differ-ent route-map clauses, so a new route map will be used. Example 10-19 shows the new configuration. Note that it does make use of one of the old IP prefix lists; namely, match-area0-permit. + +Example 10-19 Route Map to Set Metrics According to Table 10-9 + +! First, two new prefix lists are added – one to match subnets 102 and 103, +! and another to match subnets 106 and 107. + +ip prefix-list match-102-103 seq 5 permit 172.16.102.0/23 ge 25 le 26 +! +ip prefix-list match-106-107 seq 5 permit 172.16.106.0/23 ge 29 le 30 + +! The following is a repeat of the prefix list that matches the five routes +! in area 0 +ip prefix-list match-area0-permit seq 5 permit 172.16.14.0/30 +ip prefix-list match-area0-permit seq 10 permit 172.16.18.0/30 +ip prefix-list match-area0-permit seq 15 permit 172.16.8.0/25 +ip prefix-list match-area0-permit seq 20 permit 172.16.4.0/25 +ip prefix-list match-area0-permit seq 25 permit 172.16.48.0/25 + +! A new route map to filter and set metrics, with three clauses + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 445 + +route-map set-metric permit 10 +match ip address prefix-list match-area0-permit +! +route-map set-metric permit 20 +match ip address prefix-list match-102-103 +set metric 1000 44 255 1 1500 +! +route-map set-metric permit 30 +match ip address prefix-list match-106-107 +set metric 100 4444 255 1 1500 + +! +router eigrp 1 +default-metric 1500 10 255 1 1500 +redistribute ospf 2 route-map set-metric + +The new route map has three explicitly configured clauses, two of which explicitly set the metric values using the set metric command. However, the first clause (sequence number 10), which matches routes for the five subnets inside area 0, does not use a set metric command to set the metric. Instead, because this route map clause omits the set metric command, routes that match this clause use the metric keyword on the redis-tribute command, or if not listed, the metrics as defined by the default-metric EIGRP subcommand. In this case, because the redistribute command does not list a metric key-word, routes matched by this clause (sequence number 10) use the metric values listed in the default-metric command. + +Verifying the Metric Settings + +Verifying the metrics again requires an examination of the EIGRP topology table. In this case, Example 10-20 displays a couple of views of RD1’s EIGRP topology table, focus-ing on routes to 172.16.102.0/25 and 172.16.106.0/29. The configuration in the previous Example 10-19 set the metrics to different values, and next the output in Example 10-20 shows the differences. + +Example 10-20 Verifying Metrics as Set During Redistribution + +RD1# show ip eigrp topology 172.16.102.0/25 +IP-EIGRP (AS 1): Topology entry for 172.16.102.0/25 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 1709056 +Routing Descriptor Blocks: +172.16.14.2, from Redistributed, Send flag is 0x0 +Composite metric is (2571264/0), Route is External +Vector metric: +Minimum bandwidth is 1000 Kbit +Total delay is 440 microseconds +Reliability is 255/255 +Load is 1/255 + + + + +From the Library of Alexey Evseenko +446 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Minimum MTU is 1500 +Hop count is 0 +External data: +Originating router is 172.30.17.1 (this system) +AS number of route is 2 +External protocol is OSPF, external metric is 65 +Administrator tag is 0 (0x00000000) + +RD1# show ip eigrp topology 172.16.104.0/25 +% IP-EIGRP (AS 1): Route not in topology table + +RD1# show ip eigrp topo 172.16.106.0/29 +IP-EIGRP (AS 1): Topology entry for 172.16.106.0/29 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 1709056 +Routing Descriptor Blocks: +172.16.14.2, from Redistributed, Send flag is 0x0 +Composite metric is (26737664/0), Route is External +Vector metric: +Minimum bandwidth is 100 Kbit +Total delay is 44440 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 0 +External data: +Originating router is 172.30.17.1 (this system) +AS number of route is 2 +External protocol is OSPF, external metric is 65 +Administrator tag is 0 (0x00000000) +! +RD1# show ip prefix-list detail match-102-103 +ip prefix-list match-102-103: +count: 1, range entries: 1, sequences: 5 - 5, refcount: 2 +seq 5 permit 172.16.102.0/23 ge 25 le 26 (hit count: 14, refcount: 1) + +Although you could use variations of the show ip route command to verify the new met-rics, because the redistribution process sets the EIGRP component metrics, the show ip eigrp topology command displays much more useful verification information. + +Setting the External Route Type + +When redistributing into OSPF, Cisco IOS automatically sets the external route type to external Type 2 (E2). However, the type can be configured as E1 or E2 by using the set metric-type {type-1 | type-2} route map subcommand. When a redistribute OSPF sub-command references such a route map, the routes matched by the route map clause with the set metric-type command will be designated as that external type in the Type 5 LSA created for that subnet. + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 447 + +Note that the redistribute command also allows the match { internal | external 1 | exter-nal 2 | nssa-external} parameters, but these parameters do not set the type or route. Instead, these parameters match existing routes as part of the process of deciding which routes to redistribute. + +Redistribution Filtering with the distribute-list Command + +Using a route map as referenced on the redistribute command provides many features. You can filter routes, assign different metrics for different routes, and assign external route types. You can even assign route tags as discussed later in the section “Preventing Domain Loops by Filtering on Route Tag Using Distribute Lists.” However, if the plan calls for route filtering only when redistributing, but none of the other functions sup-plied by a route map are needed, and you can match all the routes with a single ACL or prefix list, Cisco IOS supports a second style of route filtering configuration using the distribute-list command. + +The distribute-list command can be configured to refer to the routing process from which routes are redistributed and cause the router to filter routes taken from that pro-cess. To do so, the command must use the out direction, and it must refer to the routing process from which routes are redistributed. For example, distribute-list 1 out ospf 2, configured under an EIGRP process, tells EIGRP to apply ACL 1 to routes redistributed from the OSPF 2 process. For another example, under an OSPF process, the distribute-list prefix fred out eigrp 1 command tells OSPF to apply IP prefix list fred to routes redistributed from the EIGRP 1 process. + +Finally, one note about internals of how this command works. The filtering takes place as the routes are redistributed. As a result, routes filtered by the distribute-list command +prevent the routes from being added to the topology table of the destination routing pro-tocol. So, the same verification commands seen in earlier examples, with a focus on the topology tables, can be used to show whether the filtering worked. Also, the counters in the show ip access-list and show ip prefix-list detail command output also increment to show whether the filtering worked. + +Issues with Multiple Redistribution Points + +The use of a single router to redistribute routes means that a single failure could cause hosts in different routing domains to fail. The redistributing router could simply fail, or interfaces or links on that router could fail. To avoid that single point of failure, many redistribution designs call for a minimum of two routers performing redistribution, par-ticularly in cases where the redistribution function will be somewhat permanent. + +The existence of two or more redistribution points between the same two routing domains introduces some complexity and caveats. The issues revolve around the concept that a route in one domain can be advertised into another domain, and then back into the original routing domain. + +Figure 10-12 shows one of the issues when using multiple redistribution points. In this case, the arrowed lines show the best route from a router in domain 2 to reach a subnet also in domain 2. However, the route actually passes through domain 1. + + + +From the Library of Alexey Evseenko +448 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + + +Routing Domain 1 + +Routing Domain 2 + + +RD1 +R2 + +R1 + +RD2 Subnet X + + + + +Figure 10-12 Domain Loop + +Figure 10-12 shows the long route that goes from R2, through RD1, to R1, and back into routing domain 2 through RD2. This long route occurs because of the routing advertise-ments that flow in the opposite direction: advertised by RD2 into routing domain 1 and then by RD1 back into routing domain 2. The problem occurs when the twice-redistrib-uted route for subnet X is redistributed back into the original domain with a relatively low metric. The twice-redistributed route then has a better metric than the route that was advertised only internal to that routing domain. + +This section examines how to prevent this “domain loop” problem when using multiple redistribution points. Interestingly, this problem does not occur, at least with default settings, when EIGRP is one of the two routing protocols. So this section begins with examples of RIP and OSPF redistribution, showing how to prevent this domain-looping problem and then showing why EIGRP accomplishes this same feat with default settings. + + +Note I know of no industry-standard name for the problem shown in Figure 10-12. For the duration of this chapter, I refer to it simply as the domain loop problem. + + + +Preventing Routing Domain Loops with Higher Metrics + +One easy method of preventing the domain loop problem is to assign purposefully high metric values when redistributing routes. For example, consider the case shown in Figure 10-13, with a RIP domain on the left and OSPF on the right. In this case, the two routers doing the redistribution (RD1 and RD2) assign an OSPF metric of 500 when redistribut-ing routes into OSPF and a metric value of 5 when redistributing routes into RIP. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 449 + +RIP OSPF + + +metric 500 + +R7 R8 +RD1 + +metric 5 + +metric 500 + + +RD2 +R2 metric 5 R4 + + + +Figure 10-13 Defeating Domain Loops by Using Very Large Metrics + +First, focus on routes inside the RIP domain. This design prevents the domain loop prob-lem—routes that send packets from the RIP domain, into OSPF, and back again—if the normal intra-domain RIP routes never exceed a hop count of 4. Then, all routes redis-tributed from RIP into OSPF, and then back into RIP, will at least have a metric of 5. As a result, the route advertisements that looped back into the RIP domain will always have less desirable metrics than the RIP advertisements from within the RIP domain. + +The same concept applies to OSPF. For routes completely internal to the OSPF domain, if the highest cost is 499, the redistribution of external routes with a metric of 500 prevents the domain loop. For example, a subnet that exists in the OSPF domain could be adver-tised into RIP by RD1 and then re-advertised by RD2 back into the OSPF domain—but with a metric value that begins at 500. Again, assuming that all the normal OSPF routes that were not reintroduced as external routes have a cost of less than 500, the domain loop problem is defeated. + +Note that OSPF actually defeats the domain loop problem without using the higher met-rics. OSPF always prefers internal routes over E1 routes, and E1 routes over E2 routes, before even considering the metrics. + +Preventing Routing Domain Loops with Administrative Distance + +Each router associates an administrative distance (AD) with every route it considers to be added to the routing table. When a router must consider multiple routes from different sources for the exact same prefix/length, the first item considered by the router is not the metric, but rather the AD. The lower the AD, the better the route. + +Note that the AD is a local setting on a router and cannot be advertised to neighboring routers. + +Each routing source has a default AD according to Cisco IOS. In some cases, a given routing source has different defaults for different types of routes inside that routing + + + + +From the Library of Alexey Evseenko +450 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +source. For example, EIGRP has different AD values for EIGRP internal routes (AD 90) and EIGRP external routes (AD 170). Table 10-10 lists the default settings. + + +Table 10-10 +Key +Topic Route Type + +Connected + +Static + + +Default Administrative Distances + +Administrative Distance +0 + +1 + + +EIGRP summary route 5 + +eBGP 20 + +EIGRP (internal) 90 + +IGRP 100 + +OSPF 110 + +IS-IS 115 + +RIP 120 + +On-Demand Routing (ODR) 160 + +EIGRP (external) 170 + +iBGP 200 + +Unreachable 255 + + + +EIGRP Default AD Defeats Loop from EIGRP to OSPF to EIGRP + +The default AD settings for EIGRP take care of the domain loop problem when redistrib-uting between EIGRP and OSPF. First, consider an EIGRP and OSPF domain with two redistribution points (Routers RD1 and RD2), as shown in Figure 10-14. The figure shows a general idea of route advertisements for subnet X, which exists in the EIGRP domain. (Note: To reduce clutter, the figure shows only route advertisements that affect Router RD2’s logic; the same issue exists on both redistributing routers.) + +Router RD2 hears about a route for subnet X as an internal EIGRP route (default AD 90) on the left. RD2 also hears about the subnet as an external OSPF route on the right (default AD 110). As a result, RD2 will do a couple of things that are important to this discussion: + +■ RD2 considers the internal EIGRP route as the best route, because of the lower AD, and places that route in its own IP routing table. + +■ RD2 does not redistribute a route for subnet X from OSPF back to EIGRP, because RD2 does not have an OSPF route for subnet X. + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 451 + + +Key EIGRP Topic + +Subnet X Internal +EIGRP + + + + + +RD1 + +OSPF + + +Subnet X External +OSPF + + +Subnet X + + + +Subnet X +Internal RD2 EIGRP + +Subnet X +External OSPF + + + +Route from Left: AD 90 + +Route from Right: AD 110 + + +Figure 10-14 Subnet X: Internal EIGRP, External OSPF, on Router RD2 + +The second point is particularly important but easily missed. Remember that routers use the IP routing table as the basis for route redistribution. Both RD1 and RD2 redistribute routes in both directions between both domains. However, a route must be in the routing table before it can be redistributed. Because RD2’s route for subnet X will list its EIGRP route, RD2’s redistribution from OSPF into EIGRP will not redistribute a route for subnet X. Because RD2 will not advertise a route for subnet X from OSPF back into EIGRP, the domain loop has been prevented. + +EIGRP Default AD Defeats Loop from OSPF to EIGRP to OSPF + +The reverse case—routes taken from OSPF, advertised into EIGRP, and then advertised back into OSPF—is the more interesting possible domain loop case. However, the default EIGRP AD settings still defeat the domain loop issue. Figure 10-15 shows an example similar to Figure 10-14, but this time with subnet Y in the OSPF domain. As before, the focus of the figure is on the routing advertisements that reach Router RD2, with other details omitted to reduce clutter. + + +EIGRP + + +Subnet Y +external EIGRP + + + + + +RD1 + +OSPF + + +Subnet Y +internal OSPF + + +Subnet X Subnet Y + + + +Subnet Y +external RD2 EIGRP + +Subnet Y +internal OSPF + + + +Route Y from Left: AD 170 + +Route Y from Right: AD 110 + + +Figure 10-15 IDS and IPS Operational Differences + + + +From the Library of Alexey Evseenko +452 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +In this case, Router RD2 hears about a route for subnet Y as an external EIGRP route (default AD 170) and as an internal OSPF route (default AD 110). As a result, RD2 choos-es the OSPF internal route as the best route and adds that to RD2’s routing table. Because RD2 does not have an EIGRP route for subnet Y, RD2 will not redistribute a route for subnet Y from EIGRP into OSPF, again defeating the domain loop problem. + +Setting AD per Route Source for Internal and External Routes + +The reason that the default EIGRP AD settings work well can be summarized generically as follows: + +For each of the two routing protocols, the AD used for internal routes for one routing protocol is better than the AD used for external routes by the other routing protocol. +When comparing EIGRP’s and OSPF’s defaults, both of the generic criteria are met: + +■ EIGRP internal AD 90 < OSPF external AD 110 + +■ OSPF internal AD 110 < EIGRP external AD 170 + +Likewise, when redistributing between EIGRP and RIP: + +■ EIGRP internal AD 90 < RIP external AD 120 + +■ RIP internal AD 120 < EIGRP external AD 170 + + +Note RIP does not have a concept of internal and external routes. The preceding refer-ences refer to internal routes as routes that exist inside the RIP domain and external as routes that exist outside the RIP domain. + + +When redistributing between OSPF and RIP, the default AD settings do not defeat the domain loop problem. However, Cisco IOS supports the definition of different AD set-tings for all routing protocols. With EIGRP, the internal and external AD settings can be overridden, although the defaults work well for the prevention of domain loops. OSPF can be configured to use a different AD for external routes, intra-area routes, and inter-area routes. RIP, which does not have a concept of internal and external routes, can only be set with a single AD value. Table 10-11 shows the router subcommands to set the AD values, per route category. + +Table 10-11 Setting AD Values with the distance Command + + +Routing Protocol +RIP + +EIGRP + +OSPF + +Command + +distance ad-value + +distance eigrp internal-ad external-ad + +distance ospf {external ad-value} { intra-area ad-value} { inter-area ad-value} + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 453 + +To defeat the OSPF-RIP domain loop problem by setting AD, just configure the AD for OSPF external routes using the distance ospf external ad-value command in OSPF con-figuration mode. The actual AD value does not matter much, but it should be higher than RIP’s AD on that same router. For example, the distance ospf external 130 command in OSPF configuration mode results in the following, assuming that all other AD values are set to their defaults: + +■ RIP internal AD 120 < OSPF external AD 130 + +■ OSPF internal AD 110 < RIP external AD 120 + + +Domain Loop Problems with More Than Two Routing Domains + +With only two routing domains, the solutions seen so far—setting higher metrics and AD values—can deal with domain loop problems. However, with three or more routing domains, setting metrics and AD values does not always solve the domain loop prob-lem. Specifically, problems can occur when three or more routing domains connect in sequence, as shown in Figure 10-16. Such a situation might exist in the real world where +a large company has multiple mergers and acquisitions with smaller companies (running a variety of routing protocols). + +OSPF EIGRP RIP + + + + +RD1 R9 +2 1 172.20.0.0/16 + + +4 RD2 +3 R4 + + +Legend: +Route Redistribution +Resulting Route + + +Figure 10-16 Inefficient Routing with Looped Routing Advertisements + +The steps noted in the figure are as follows: + +Step 1. Router R9 advertises a route for network 172.20.0.0/16 from the RIP domain into the EIGRP domain, where the route is treated with (default) AD 170 as an external route. + + + + +From the Library of Alexey Evseenko +454 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 2. Router RD1 redistributes this EIGRP external route into OSPF, where it is treated as an E2 route, AD 110, by default. + +Step 3. Router RD2 uses the AD 110 E2 route, rather than the AD 170 EIGRP exter-nal route, as its best route for 172.20.0.0/16. As a result, RD2 can then redis-tribute that OSPF route back into EIGRP as an external route. +Step 4. Router R4 learns of two external routes for 172.20.0.0/16, and the routes tie based on AD (170). R4 might have a better EIGRP metric through RD2, depending on the metrics used at redistribution, preferring this long route through the OSPF domain as shown. + +This is just one example case for such problems, but the problem exists, because the obviously better route and the longer domain loop route are both external routes. The two competing routes tie on AD as a result. In the earlier cases, with only two routing domains, this problem does not occur. + +Several solutions exist for such problems. None of the solutions require a lot of extra configuration, other than that some of the solutions require ACLs or prefix lists that match the prefixes from the various routing domains. The next three sections address each option, namely, using per-route AD settings, filtering routes based on prefix/length, and using route tags. + +Using Per-Route Administrative Distance Settings + +As seen in Table 10-11, you can use the distance router subcommand to set the AD value per routing protocol, per type (internal and external). The distance command also sup-ports another syntax in which the router sets the AD for individual routes based on the following criteria: + +■ The router that advertised the routing information + +■ Optionally, for the prefixes/lengths of the routes as matched by a referenced ACL + +The syntax of the command in this case is + +distance distance ip-adv-router wc-mask [acl-number-or-name] + +In this command, the required parameters match the neighboring router that advertises a route. The router with the distance command configured compares the advertising router’s IP address to the range of addresses implied by the ip-adv-router and wc-mask +parameters of the command, as if these were parameters in an ACL. For routes advertised by a matching neighbor, that router then applies the AD listed in the command. + +Optionally, the distance command can also refer to an ACL. If included, that router com-pares the ACL to the prefix/length of each route learned from any matched neighbors and uses the listed AD only for routes permitted by the ACL. + +For example, consider the problem shown in Figure 10-16. Assuming that the design calls for all hosts to have reachability to 172.20.0.0/16, the route must be redistributed by R9 into the EIGRP domain. For the best availability, this route should be redistributed from + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 455 +R7 + +EIGRP into OSPF at both redistribution points (RD1 and RD2). The unfortunate long-route choice by Router R4 in the figure occurs at what is listed as Step 3 in that figure, with Router RD2 using AD to determine that its external OSPF route for 172.20.0.0/16 (AD 110) is better than its EIGRP external route (AD 170) for that same prefix. + +One solution would be to cause RD2 to use a higher AD—specifically higher than the 170 AD used for EIGRP external routes—for prefix 172.20.0.0/16 as learned with OSPF. A distance command on RD2 could solve the problem. + +Upcoming Examples 10-21 and 10-22, plus Figure 10-17, demonstrate both the domain loop problem in this same case, along with the solution. First, Figure 10-17 shows a more detailed topology for reference. Then, Example 10-21 shows the relevant configuration and a few related show commands on Router RD2 before using the distance command to prevent the problem. This example shows Router R4 using the longer path through the +OSPF domain on the left. Finally, Example 10-22 shows the configuration of the distance command and resulting solution. + +OSPF EIGRP + + + +Fa0/1 7.7/23 + + +Fa0/0 27.7/23 + + + +S0/0 17.2/30 + + + + + +S0/1/1 17.1/30 + + + + + +S0/0/1 18.1/30 + + + +S0/0 18.2/30 + +Fa0/1 8.8/25 + +R8 +Fa0/0 48.8/25 + + + +172.20.0.0/16 R9 + +RIP + + +RD1 + + +Fa0/0 27.2/23 + + +S0/0/1 12.2/30 + +S0/0/0 12.1/30 + +S0/1/0 14.1/30 + + +S0/0/0 14.2/30 + + +Fa0/0 48.4/25 + + + +R2 +Fa0/1 S0/0/0 +2.2/23 23.2/30 + +R4 +Fa0/1 +S0/0/1 4.4/25 +34.2/30 + + + +S0/0/1 23.1/30 +RD2 + +S0/0/0 34.1/30 + + + +Figure 10-17 Detailed View of Internetwork + +Example 10-21 Long Route from RD2, into OSPF, for 172.20.0.0/16 + +! The following is the routing protocol configuration on RD2 +router eigrp 1 +redistribute ospf 2 metric 1000 200 255 1 1500 +network 172.16.0.0 +no auto-summary + + + + +From the Library of Alexey Evseenko +456 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +! +router ospf 2 +router-id 3.3.3.3 +log-adjacency-changes +redistribute eigrp 1 subnets +network 172.30.0.0 0.0.255.255 area 0 + +! Next, the long route for 172.20.0.0/16 is listed. This route goes from +! RD2 back into the OSPF domain; interface S0/0/1 connects to router R2. +RD2# show ip route | include 172.20.0.0 +O E2 172.20.0.0/16 [110 /20] via 172.30.23.2, 00:06:57, Serial0/0/1 + + +! Next, the source of this routing information is listed under the +! text "Known via". RD2's current route is learned by OSPF. +RD2# show ip route 172.20.0.0 +Routing entry for 172.20.0.0/16 +Known via "ospf 2", distance 110, metric 20, type extern 2, forward metric 128 +Redistributing via eigrp 1 +Advertised by eigrp 1 metric 1000 200 255 1 1500 +Last update from 172.30.23.2 on Serial0/0/1, 00:07:04 ago +Routing Descriptor Blocks: +* 172.30.23.2, from 1.1.1.1, 00:07:04 ago, via Serial0/0/1 +Route metric is 20, traffic share count is 1 + +! RD2 does know a working (successor) route for the same prefix, +! but prefers the lower-AD route (110) through OSPF. +RD2#show ip eigrp topology | section 172.20.0.0 +P 172.20.0.0/16, 1 successors, FD is 2611200 +via Redistributed (2611200/0) + +The comments inside Example 10-21 detail the current state, with the longer route, as shown in Figure 10-16. Most importantly, note the “Known via...” text in the output of the show ip route 172.20.0.0 command. This output specifically states the source of the route that is currently in the routing table. + +Next, Example 10-22 shows the configuration on RD2 to solve this problem by setting RD2’s AD for that specific route and additional show commands. + +Example 10-22 Configuring Per-Route AD on Router RD2 + +RD2# conf t +Enter configuration commands, one per line. End with CNTL/Z. +RD2(config)# router ospf 2 +RD2(config-router)# distance 171 1.1.1.1 0.0.0.0 match-172-20 +RD2(config-router)# ip access-list standard match-172-20 +RD2(config-std-nacl)# permit host 172.20.0.0 + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 457 + +RD2(config-std-nacl)# end +RD2# + +! Now the best route for 172.20.0.0 is known from EIGRP 1. +RD2# show ip route 172.20.0.0 +Routing entry for 172.20.0.0/16 +Known via "eigrp 1", distance 170, metric 3635200, type external +Redistributing via ospf 2, eigrp 1 +Advertised by ospf 2 subnets +Last update from 172.16.34.2 on Serial0/0/0, 00:08:01 ago +! lines omitted for brevity + +! The next command lists the matching logic of the distance command. +RD2# show ip protocols | section ospf +Routing Protocol is "ospf 2" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 172.30.23.1 +It is an autonomous system boundary router +Redistributing External Routes from, +eigrp 1, includes subnets in redistribution +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +172.30.0.0 0.0.255.255 area 0 +Reference bandwidth unit is 100 mbps +Routing Information Sources: + +Gateway +1.1.1.1 +2.2.2.2 +7.7.7.7 + +Distance +171 +110 +110 + +Last Update +00:00:35 +00:00:35 +00:00:35 + +Distance: (default is 110) + +Address +1.1.1.1 + +Wild mask +0.0.0.0 + +Distance +171 + +List +match-172-20 + +Redistributing: ospf 2, eigrp 1 + +The configuration, although short, has one possibly counterintuitive twist. The IP address of the neighboring router, referenced in the distance command in OSPF configuration mode, will be compared to the OSPF RID of the OSPF router that owns the LSA. In this case, Router RD1 creates the Type 5 LSA for 172.20.0.0, and RD1’s RID happens to be 1.1.1.1. RD2’s distance 171 1.1.1.1 0.0.0.0 match-172-20 command tells OSPF to look for LSAs owned by exactly RID 1.1.1.1, and if the prefix is permitted by the match-172-20 ACL, apply AD 171 to this route. + +The show ip route 172.20.0.0 command verifies that Router RD1 now prefers its AD 170 EIGRP route for 172.20.0.0/16. The highlighted portions of this command now refer to routing source EIGRP 1, with the outgoing interface of S0/0/0, which connects RD2 into + + + + +From the Library of Alexey Evseenko +458 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +the EIGRP domain. Because RD2 no longer has an OSPF route for 172.20.0.0/16, RD2 will not redistribute such an OSPF route back into EIGRP, defeating the domain loop problem. + + +Note A complete solution requires all redistributing routers to perform this kind of con-figuration, for all such routes from the third routing domain. + + +Although this example shows the OSPF version of the distance command, one notable difference exists between the OSPF version and the RIP and EIGRP distance commands. When used as a RIP or EIGRP subcommand, the distance command matches the inter-face IP address of the neighboring router that advertises the route. + +Preventing Domain Loops by Filtering on Subnet While Redistributing + +The next tool prevents domain loops by filtering the routes based on prefix. Figure 10-18 shows the idea from a redistribution design perspective. + +OSPF EIGRP RIP + +2 + + +RD1 +R9 +4 1 172.20.0.0/16 +3 3 + +2 + + +RD2 + +4 + +Figure 10-18 Preventing Domain Loops with Route Filtering + +Following are the steps as listed in the figure: + +Step 1. Router R9 advertises a route for network 172.20.0.0/16 from the RIP domain into the EIGRP domain. + +Step 2. Routers RD1 and RD2 both redistribute this EIGRP external route into OSPF. + +Step 3. Both RD1 and RD2 flood the route advertisement for the OSPF external route throughout the OSPF domain. + +Step 4. Both RD1 and RD2 apply a route map to their redistribution from OSPF into EIGRP, filtering routes with prefix 172.20.0.0. + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 459 +tag 1 only +tag 2 only + +The configuration itself uses the same methods and commands as included earlier in the section “Filtering Redistributed Routes with Route Maps.” + +Interestingly, this design does prevent the long routes, as shown earlier in Figure 10-16, but it does leave the possibility of a long route on a redistributing router. For example, if using all default AD settings, RD2 still learns an OSPF (default AD 110) route for 172.20.0.0 from RD1, so it might choose as best route the OSPF route through RD1. Setting the AD for OSPF external routes to something larger than EIGRP’s external AD of 170 would prevent this particular problem as well. + +Preventing Domain Loops by Filtering on Route Tag Using Distribute Lists + +Route tags, the last tool shown in this chapter for preventing the domain loop problem, have a much broader use than just preventing redistribution problems. + +A route tag is a unitless 32-bit integer that most routing protocols can assign to any given route. The assignment of a tag occurs when some Cisco IOS function adds the tag—for example, it can be assigned by a route map referenced by a routing protocol distribute-list or redistribute command. That tag follows the route advertisement, even through the redistribution process. At some later point in the flooding of routing information, other Cisco IOS tools, typically other route maps, can match routes with a given route tag to make a decision. + +In some cases, the idea of a route tag creates a mental block, because it has no one spe-cific purpose. The network engineer chooses the purpose of a route tag; the purpose has not been predetermined by a particular protocol. The folks that created the routing pro-tocol provided us all with a nice, convenient place to add the equivalent of a sticky note to each route. It’s up to us to decide what the note means. + +Figure 10-19 shows one common use of route tags other than for solving the domain loop problem. In the figure, one large company that uses EIGRP (the middle of the fig-ure) bought two smaller companies, both of whom use OSPF. The larger company wants to connect both small companies into the larger network, but it wants to prevent hosts in the two smaller companies from knowing routes to the other smaller company. The figure shows only left-to-right advertisements of routes to reduce the clutter. + + + +OSPF Domain +Company 1 +EIGRP +tag 1 Domain + +OSPF Domain Company 1 + + +tag 2 + + +OSPF Domain Company 2 + +OSPF Domain Company 2 + + + +Figure 10-19 Using Route Tags to Determine Routing Domain Origin + + + + +From the Library of Alexey Evseenko +460 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The two routers on the left each redistribute routes from the smaller companies into the EIGRP. The routers apply a route tag of 1 to each route from OSPF domain 1 and a tag of 2 to routes redistributed from OSPF domain 2. The actual numbers do not matter, as long as they are unique. On the right, the routers know that the routes from OSPF domain +1 have route tag 1, and only these routes should be redistributed into the other part of OSPF domain 1. So, when redistributing into OSPF domain 1, the route map makes a comparison of the route tag (command match tag 1) and allows only those routes. +Similarly, when redistributing into OSPF domain 2, the match tag 2 command would be used, redistributing only routes with tag 2. + +To use route tags to prevent domain loop problems, you can use the following strategy: + + +■ Key +Topic +■ + +Choose and set a tag value that identifies routes taken from domain X and advertised into domain Y. + +When redistributing in the opposite direction (from domain Y into domain X), +match the tag value and filter routes with that tag. + + +For example, consider the case shown in Figure 10-20. The figure shows the usual RD1 and RD2 between two routing domains, with EIGRP on the right in this case and OSPF on the left. The engineer planned to use route tag 11 to mean “routes taken from EIGRP and redistributed into OSPF.” The figure shows one direction of potential loops: from EIGRP through RD1, through OSPF, and back to EIGRP through RD2. However, the same concept would also apply to the other direction. + + +Key Topic + + +1 +set tag 11 + + + +RD1 + +OSPF EIGRP + + +RD2 + +2 +deny tag 11 permit all else + +Figure 10-20 Using Route Tags to Prevent Domain Loop Problems + +The first step (noted with a circled 1 in the figure) is the usual redistribution, but with a route map that tags all routes redistributed from EIGRP into OSPF with tag 11. RD2 +learns these routes with OSPF. At Step 2, RD2 tries to redistribute the routes but chooses to filter all routes that have a tag value of 11. As a result, none of the routes learned from EIGRP are re-advertised back into EIGRP. Example 10-23 shows the configuration that matches Figure 10-20. + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 461 + +Example 10-23 RD1 and RD2 Configuration with Route Tags to Prevent Domain Loops + +! The following is the routing protocol configuration on RD1 +router ospf 2 +router-id 3.3.3.3 +log-adjacency-changes +redistribute eigrp 1 subnets route-map set-tag-11 +network 172.30.0.0 0.0.255.255 area 0 +! +route-map set-tag-11 permit 10 +set tag 11 + +! The following is the routing protocol configuration on RD2 +router eigrp 1 +redistribute ospf 2 metric 1000 200 255 1 1500 route-map stop-tag-11 +network 172.16.0.0 +no auto-summary +! +route-map stop-tag-11 deny 10 +match tag 11 +! +route-map stop-tag-11 permit 20 + +First, note that the configuration does rely on a couple of default route map actions that bear some review. In the set-tag-11 route map on RD1, only one route map clause exists, and that clause has no match commands. A route map clause with no match commands matches all routes, so all routes are assigned tag 11. In the stop-tag-11 route map on RD2, the first clause lists a deny action, meaning that all routes matched by that clause (all with tag 11) are filtered. All other routes, for example those routes for subnets native to the OSPF domain, match the second, because that second clause does not have a match command. + +Example 10-23 shows the configuration that tags routes coming from EIGRP into OSPF and then filters routes with that same tag as they go from OSPF into EIGRP. For a com-plete solution, the reverse case would also need to be configured, using a different route tag value. + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +462 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 10-12 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an imple-mentation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 10-12 Design Review + + +Design Goal + +A design shows Router R1 as being connected to both an EIGRP and OSPF routing domain, with all external EIGRP routes using a particular set of +component EIGRP metrics. How can these metrics be set? (3) +A design shows Router R1 as being connected to two different EIGRP domains, with redistribution planned. Can the design cause the routers to calculate metrics based on both the metric assigned when redistributing and the internal EIGRP topology? +The same design as in the previous row is shown, except describe whether the design can cause the routers to calculate metrics based solely on the metric components assigned when redistributing. + +Possible Implementation Choices Covered in This Chapter + +A design shows Router R1 as being connected to two different OSPF domains, with redistribution planned, and all routes calculated by including internal and external OSPF distance. + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 463 + + +Design Goal Possible Implementation Choices Covered in This Chapter +The same design as in the previous row is shown, except that all external route metrics are based solely on external metrics. +Filter routes when redistributing. (2) + +Set different metrics for different routes redistributed from one routing source. +Set some OSPF routes as E1 and some as E2, when redistributed from one routing source. +The design shows multiple redistribution points with two routing domains, with a need to prevent domain loops. (3) +The design shows multiple redistribution points with more than two routing domains and a need to prevent domain loops. (2) + + + +Implementation Plan Peer Review Table + +Table 10-13 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 10-13 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +A design shows Router R1 as being connected to both an EIGRP and OSPF routing domain. What default metrics will be used by the redistribute command for each routing protocol, if not set in R1’s configuration? +A plan shows redistribution between two EIGRP domains. What must be done to use the source route’s original component metrics? +A plan shows redistribution between two OSPF domains. What must be done to use the source route’s original metric? + + + + + + +From the Library of Alexey Evseenko +464 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Question Answer +The plan shows the redistribute eigrp 2 command to redistribute from EIGRP 2 into OSPF. What other optional parameters are required to ensure redistribution of 10.1.1.0/24 from EIGRP? +R1 has two connected interfaces in the EIGRP 2 domain and knows dozens +of EIGRP routes. The plan shows the redistribute eigrp 2 subnets command under an OSPF process. What else must be done to redistribute the two connected subnets inside the EIGRP domain? +A design shows an OSPF and EIGRP routing domain, with multiple redistributing routers, with no obvious configuration to prevent routing domain loops. What default AD values exist, and do they prevent any problems? +The same question as the previous row, except with RIP and OSPF domains. +The same question as the previous row, except with RIP and EIGRP domains. +A plan shows redistribution between EIGRP and OSPF on two routers. The configuration for OSPF on one router lists redistribute eigrp 1 subnets and distribute-list 1 out. Will this configuration attempt to filter routes? Is a route map option required to filter when redistributing? +A partially complete plan shows three different routing domains, with multiple redistribution points between each pair of routing domains. The configuration shows large ACLs matching various subnets and setting AD per-route using the distance command. What alternative method might be easier to maintain as the network changes? +The plan shows an EIGRP for IPv6 and OSPFv3 domain with mutual redistribution. The configuration shows a redistribute eigrp 1 command under the OSPF process. What kinds of routes should be redistributed? Which kinds will not? + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 465 + +Create an Implementation Plan Table + +To practice skills useful when creating your own implementation plan, list in Table 10-14 configuration commands related to the configuration of the following features. You +might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 10-14 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Configuring redistribution into EIGRP from OSPF (List all parameters that you can recall.) +Configuring redistribution into OSPF from EIGRP (List all parameters that you can recall.) +Setting default metrics for all redistribute commands, redistributing into EIGRP +Setting default metrics for all redistribute commands, redistributing into OSPF +Filtering routes on redistribution from OSPF into EIGRP +Filtering routes on redistribution from EIGRP into OSPF +Configuring a route map that will set metric components to 1000, 200, 255, 1, and 1500, for routes permitted by ACL 1, and filter all other routes +Setting OSPF’s administrative distance for all internal routes to 110 and all external routes to 180 +Setting EIGRP’s administrative distance for routes learned from neighbor 1.1.1.1 to 190, only for subnets in the range 10.1.0.0–10.1.255.255 +Configuring RIPng to redistribute routes from OSPF process 1, including subnets and connected routes + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own verification plan, list in Table 10-15 all commands that supply the requested information. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + + + +From the Library of Alexey Evseenko +466 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 10-15 Verification Plan Memory Drill + +Information Needed Command(s) +Display a brief version of the EIGRP topology table, listing external routes. +Display the EIGRP topology table, including notations identifying external routes. +For external EIGRP routes, display the source of the route, external metric, and IP address of the router that redistributed the route. +Identify external EIGRP-learned IP routes. + +Display a brief version of the OSPF topology table, listing Type 5 external LSAs. +Display all OSPF Type 4 LSAs. + +Display all OSPF Type 5 LSAs. + +Display all OSPF Type 7 LSAs. + +Display the external route type for an OSPF external route. +Display OSPF cost for each interface, briefly. + +On an internal router, display any same-area ABRs’ costs to reach any ASBRs. +On an internal router, display that router’s best cost to reach an ASBR. +Display the metric for all currently best external OSPF routes. +Confirm that OSPF routes were redistributed from the IP routing table into that same router’s EIGRP topology table. +Display the number of matches in an ACL used for redistribution filtering. +Display the number of matches in an IP prefix list used for redistribution filtering. +Display the configuration of a route map. + +Display the component metrics of a route redistributed into EIGRP. +Confirm the absence or presence of a route that could have been redistributed from OSPF into EIGRP. + + + + + + + +From the Library of Alexey Evseenko +Chapter 10: Route Redistribution 467 + + +Information Needed Command(s) +Confirm the absence or presence of a route that could have been redistributed from EIGRP into OSPF. +Display an IP route’s administrative distance. + +Display the administrative distance settings for EIGRP. +Display the administrative distance settings for OSPF. + + +Note Some of the entries in this table might not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 10-16 lists a reference of these key topics and the page numbers on which each is found. + +Table 10-16 Key Topics for Chapter 10 +Key +Topic Key Topic Element Description Page Number + + +List + +Table 10-2 + +Table 10-3 + +List + +Table 10-4 + +List + +Requirements for redistribution in a router 408 + +Parameters of the EIGRP redistribute Command 410 + +Methods of Setting EIGRP Metrics When 414 Redistributing into EIGRP +Rules from what is redistributed from an IGP 416 + +Parameters on the OSPF redistribute Command 418 + +Defaults of the OSPF redistribute command 419 + + +Table 10-5 Summary of Metric Values When Redistributing into 423 OSPF + +List + +List + +List + +Table 10-6 + +Tiebreaker rules for choosing the best E2 routes 425 + +Rules for calculating the metric of an interarea E1 432 route +A summary of functions that can be performed by a 436 route map referenced by a redistribute command +match Command Options for Redistribution 437 + + + + + + +From the Library of Alexey Evseenko +468 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Key Topic Element Table 10-7 +Table 10-10 Figure 10-14 + +List + +Figure 10-20 + +Description +set Command Options for Redistribution into IGPs Default Administrative Distances +Subnet X: Internal EIGRP, External OSPF, on Router RD2 +Recommendations for how to use route tags to prevent the domain loop problems +Using Route Tags to Prevent Domain Loop Problems + +Page Number 438 +450 451 + +460 + +460 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +redistribution, external route, Type 4 Summary ASBR LSA, Type 5 External LSA, Type 7 AS External LSA, External Type 1, External Type 2, domain loop, adminis-trative distance, route tag + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Cisco Express Forwarding: This section discusses how a router performs packet switching, primarily focusing on Cisco Express Forwarding (CEF). +■ Policy-Based Routing: This section describes the Cisco IOS Policy-Based Routing (PBR) feature, which allows a router to make packet-forwarding decisions based on criteria other than the packet’s destination address as matched with the IP routing table. +■ IP Service-Level Agreement: This section gives a general description of the IP Service-Level Agreement (IP SLA) feature, with particular atten- +tion to how it can be used to influence when a rout-er uses a static route and when a router uses PBR. +■ VRF-Lite: This section demonstrates a basic con-figuration of VRF-Lite, which allows a single physi-cal router to run multiple virtual router instances, thereby providing network segmentation. + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 11 + + + + + + +Route Selection + + +The term path control can mean a variety of things, depending on the context. The typi-cal use of the term refers to any and every function that influences where a router for-wards a packet. With that definition, path control includes practically every topic in this book. In other cases, the term path control refers to tools that influence the contents of a routing table, usually referring to routing protocols. + +This chapter examines three path control topics that fit only into the broader definition of the term. The first, Cisco Express Forwarding (CEF), is a feature that allows a router to very quickly and efficiently make a route lookup. This chapter contrasts CEF with a couple of its predecessors, Process Switching and Fast Switching. + +The second major topic in this chapter is Policy-Based Routing (PBR), sometimes called Policy Routing. PBR influences the IP data plane, changing the forwarding decision a router makes, but without first changing the IP routing table. + +Then, this chapter turns its attention to the IP Service-Level Agreement (IP SLA) fea-ture. IP SLA monitors network health and reachability. A router can then choose when to use routes, and when to ignore routes, based on the status determined by IP SLA. + +Also, a physical router can be logically segmented into multiple virtual routers, each of which performs its own route selection. That is the focus of the final major topic in this chapter, which covers a basic VRF-Lite configuration. Specifically, Virtual Routing and Forwarding (VRF) enables you to have multiple virtual router instances running on a single physical router, and VRF-Lite is one approach to configuring VRF support on a router. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these nine self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 11-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + + + + + + + + +From the Library of Alexey Evseenko +472 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 11-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Cisco Express Forwarding + +Policy-Based Routing + +IP Service-Level Agreement + +VRF-Lite + +Questions +1, 2 + +3–5 + +6–8 + +9 + + + +1. Identify the architectural components of Cisco Express Forwarding (CEF). (Choose two.) + +a. Routing Information Base (RIB) + +b. Adjacency Table + +c. Forwarding Information Base (FIB) + +d. ARP Cache + +2. What command can be used to globally enable CEF on a router? + +a. ip flow egress + +b. ip route-cache cef + +c. no ip route-cache + +d. ip cef + +3. Policy-Based Routing (PBR) has been enabled on Router R1’s Fa 0/0 interface. Which of the following are true regarding how PBR works? (Choose two.) + +a. Packets entering Fa 0/0 will be compared based on the PBR route map. + +b. Packets exiting Fa 0/0 will be compared based on the PBR route map. + +c. Cisco IOS ignores the PBR forwarding directions when a packet matches a route map deny clause. + +d. Cisco IOS ignores the PBR forwarding directions when a packet matches a route map permit clause. + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 473 + +4. Examine the following configuration on Router R1. R1’s show ip route 172.16.4.1 command lists a route with outgoing interface S0/1/1. Host 172.16.3.3 uses Telnet to connect to host 172.16.4.1. What will Router R1 do with the packets generated by host 172.16.3.3 because of the Telnet session, assuming that the packets enter R1’s Fa0/0 interface? (Choose two.) + +interface Fastethernet 0/0 +ip address 172.16.1.1 255.255.255.0 +ip policy route-map Q2 +! +route-map Q2 permit +match ip address 101 +set interface s0/0/1 +! +access-list 101 permit tcp host 172.16.3.3 172.16.4.0 0.0.0.255 + +a. The packets will be forwarded out S0/0/1, or not at all. + +b. The packets will be forwarded out S0/0/1 if it is up. + +c. The packets will be forwarded out S0/1/1 if it is up. + +d. The packets will be forwarded out S0/1/1 if it is up, or if it is not up, out S0/0/1. + +e. The packets will be forwarded out S0/0/1 if it is up, or if it is not up, out S0/1/1. + +5. The following output occurs on Router R2. Which of the following statements can be confirmed as true based on the output? + +R2# show ip policy + +Interface +Fa0/0 +Fa0/1 +S0/0/0 + +Route map +RM1 +RM2 +RM3 + + +a. R2 will forward all packets that enter Fa0/0 per the PBR configuration. + +b. R2 will use route map RM2 when determining how to forward packets that exit interface Fa0/1. + +c. R2 will consider using PBR for all packets exiting S0/0/0 per route map RM3. + +d. R2 will consider using PBR for all packets entering S0/0/0 per route map RM3. + +6. Which of the following are examples of traffic that can be created as part of an IP Service-Level Agreement operation? (Choose two.) + +a. ICMP Echo + +b. VoIP (RTP) + +c. IPX + +d. SNMP + + + + +From the Library of Alexey Evseenko +474 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +7. The following configuration commands exist only in an implementation plan docu-ment. An engineer does a copy/paste of these commands into Router R1’s configura-tion. Which of the following answers is most accurate regarding the results? + +ip sla 1 +icmp-echo 1.1.1.1 source-ip 2.2.2.2 +ip sla schedule 1 start-time now life forever + +a. The SLA operation will be configured but will not start until additional com-mands are used. + +b. The SLA operation is not completely configured, so it will not collect any data. + +c. The SLA operation is complete and working, collecting data into the RTTMON MIB. + +d. The SLA operation is complete and working but will not store the data in the RTTMON MIB without more configuration. + +8. The following output occurs on Router R1. IP SLA operation 1 uses an ICMP echo operation type, with a default frequency of 60 seconds. The operation pings from address 1.1.1.1 to address 2.2.2.2. Which of the following answers is true regarding IP SLA and object tracking on R1? + +R1# show track +Track 2 +IP SLA 1 state +State is Up +3 changes, last change 00:00:03 +Delay up 45 secs, down 55 secs +Latest operation return code: OK +Latest RTT (millisecs) 6 +Tracked by: +STATIC-IP-ROUTING 0 + +a. The tracking return code fails immediately after the SLA operation results in an ICMP echo failure three times. + +b. The tracking return code fails immediately after the SLA operation results in an ICMP echo failure one time. + +c. After the tracking object fails, the tracking object moves back to an up state 45 seconds later in all cases. + +d. After moving to a down state, the tracking object moves back to an OK state 45 seconds after the SLA operation moves to an OK state. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 475 + +9. Which of the following is a benefit of Cisco EVN as compared to VRF-Lite? + +a. Cisco EVN allows a single physical router to run multiple virtual router instances. + +b. Cisco EVN allows two routers to be interconnected through an 802.1Q trunk, and traffic for different VRFs is sent over the trunk, using router subinterfaces. + +c. Cisco EVN allows routes from one VRF to be selectively leaked to other VRFs. + +d. Cisco EVN allows two routers to be interconnected through a VNET trunk, and traffic for different VRFs is sent over the trunk, without the need to configure router subinterfaces. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +476 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Foundation Topics + + +Cisco Express Forwarding + +Much of the literature on router architecture divides router functions into three opera-tional planes: + +■ Management plane: The management plane is concerned with the management of the device. For example, an administrator connecting to a router through a Secure Shell (SSH) connection through one of the router’s VTY lines would be a manage-ment plane operation. + +■ Control plane: The control plane is concerned with making packet-forwarding deci-sions. For example, routing protocol operation would be a control plane function. + +■ Data plane: The data plane is concerned with the forwarding of data through a router. For example, end-user traffic traveling from a user’s PC to a web server on a different network would go across the data plane. + +Of these three planes, the two planes that most directly impact how quickly packets can flow through a router are the control plane and the data plane. Therefore, we will consider these two planes of operation and examine three different approaches that Cisco routers can take to forward packets arriving on an ingress interface and being sent out an appro-priate egress interface, a process called packet switching. + + +Note Many learners have a challenge with the term packet switching, because they are accustomed to switching being a Layer 2 operation, while routing is a Layer 3 operation. The key to understanding this term is to think of frame switching being a Layer 2 opera-tion, while packet switching (the same thing as routing) is a Layer 3 operation. + + +In general, Cisco routers support the following three primary modes of packet switching: + +■ Process switching + +■ Fast switching + +■ Cisco Express Forwarding (CEF) + +The following subsections discuss each of these approaches. + + +Operation of Process Switching + +When a router routes a packet (that is, performs packet switching), the router removes the packet’s Layer 2 header, examines the Layer 3 addressing, and decides how to forward + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 477 + +the packet. The Layer 2 header is then rewritten (which might involve changing the source and destination MAC addresses and computing a new cyclic redundancy check [CRC]), and the packet is forwarded out an appropriate interface. With process switching, as illustrated in Figure 11-1, a router’s CPU becomes directly involved with packet-switching decisions. As a result, the performance of a router configured for process switching can suffer significantly. + + +Incoming Packets Outgoing Packets + + + + +Control Plane + +CPU +Packet Flow +Packet Flow + + + + + + +Ingress Interface + +Egress Interface + + + +Data Plane + +Figure 11-1 Data Flow with Process Switching + +An interface can be configured for process switching by disabling fast switching on that interface. The interface configuration mode command used to disable fast switching is no ip route-cache. + +Operation of Fast Switching + +Fast switching uses a fast cache maintained in a router’s data plane. The fast cache con-tains information about how traffic from different data flows should be forwarded. As seen in Figure 11-2, the first packet in a data flow is process switched by a router’s CPU. After the router determines how to forward the first frame of a data flow, the forward-ing information is stored in the fast cache. Subsequent packets in that same data flow are forwarded based on information in the fast cache, as opposed to being process switched. As a result, fast switching dramatically reduces a router’s CPU utilization, as compared to process switching. + + + + + + + + +From the Library of Alexey Evseenko +478 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Incoming Packets Outgoing Packets + + + + +Control Plane + +CPU +Packet #1 in a +Data Flow +Packet #1 in a +Data Flow +Forwarding +Information + + + + + + +Ingress Interface + +Fast Egress Cache Interface + + + +Subsequent Packets in a Data Flow + +Subsequent Packets in a Data Flow + + +Data Plane + +Figure 11-2 Data Flow with Fast Switching + +Fast switching can be configured in interface configuration mode with the command ip route-cache. + +Operation of Cisco Express Forwarding + +Cisco Express Forwarding (CEF) maintains two tables in the data plane. Specifically, the Forwarding Information Base (FIB) maintains Layer 3 forwarding information, whereas the adjacency table maintains Layer 2 information for next hops listed in the FIB. + +Using these tables, populated from a router’s IP routing table and ARP cache, CEF can efficiently make forwarding decisions. Unlike fast switching, CEF does not require the first packet of a data flow to be process switched. Rather, an entire data flow can be for-warded at the data plane, as seen in Figure 11-3. + +On many router platforms, CEF is enabled by default. If it is not, you can globally enable it with the ip cef command. Alternately, if CEF is enabled globally but is not enabled on a specific interface, you can enable it on that interface with the interface configuration mode command ip route-cache cef. + +Table 11-2 lists and describes the configuration and verification commands for CEF. + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 479 + + +Incoming Packets Outgoing Packets + + + + + + +IP Routing Table + +Control Plane + +CPU ARP Cache + + +CEF Data Structures +Layer 2 +Information + +FIB +Layer 3 +Information + + +Ingress Interface + + +Data Flow + + +Adjacency Table + + +Data Flow + +Egress Interface + + + +Data Plane + +Figure 11-3 Data Flow with Cisco Express Forwarding + + +Table 11-2 +Key +Topic Command + +ip cef + + +CEF Configuration and Verification Commands + +Description +Globally enables CEF, in global configuration mode. + + + +ip route-cache cef + +show ip interface interface-id + +show ip cef + +show adjacency [detail ] + +Enables CEF on an interface (if CEF is globally enabled), in interface configuration mode. +Displays multiple interface statistics, including information about an interface’s packet-switching mode. +Displays the contents of a router’s FIB. + +Provides information contained in the adjacency table of a router, including protocol and timer information. + + + +To illustrate the configuration and operation of CEF, the remainder of this section pres-ents a series of CEF configuration and verification examples. Each of these examples is based on the topology shown in Figure 11-4. The routers in this topology have already been configured to exchange routes through Enhanced Interior Gateway Routing Protocol (EIGRP). + + + + + + + + + +From the Library of Alexey Evseenko +480 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Lo0 1.1.1.1/32 + +Lo0 2.2.2.2/32 + + + + + +SW1 + + + +Fa0/0 R1 172.16.1.1/24 + +S1/0 10.1.1.1/30 + +S1/0 10.1.1.2/30 + + + +R2 Fa0/0 SW2 192.168.1.1/24 + + +Figure 11-4 Sample Topology Configured with CEF + +Router R1 in Figure 11-4 has CEF enabled globally; however, CEF is not enabled on interface Fa 0/0. Example 11-1 shows how to enable CEF on an interface if CEF is already enabled globally. + +Key Example 11-1 Enable CEF on Router R1’s Fa 0/0 Interface Topic R1# show ip int fa 0/0 +FastEthernet0/0 is up, line protocol is up +Internet address is 172.16.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are always sent +ICMP unreachables are always sent +ICMP mask replies are never sent +IP fast switching is enabled +IP Flow switching is disabled +IP CEF switching is disabled +... OUTPUT OMITTED ... + +R1# conf term +R1(config)# int fa 0/0 +R1(config-if)# ip route-cache cef +R1(config-if)# end + +R1# show ip int fa 0/0 +FastEthernet0/0 is up, line protocol is up +Internet address is 172.16.1.1/24 +Broadcast address is 255.255.255.255 + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 481 + +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are always sent +ICMP unreachables are always sent +ICMP mask replies are never sent +IP fast switching is enabled +IP Flow switching is disabled +IP CEF switching is enabled +... OUTPUT OMITTED ... + +Router R2 in Figure 11-4 has CEF disabled globally. Example 11-2 shows how to globally enable CEF. + +Example 11-2 Enable CEF on Router R2 + +R2# show ip int fa 0/0 +FastEthernet0/0 is up, line protocol is up +Internet address is 192.168.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are always sent +ICMP unreachables are always sent +ICMP mask replies are never sent +IP fast switching is disabled +IP Flow switching is disabled +IP CEF switching is disabled +... OUTPUT OMITTED ... + + + + + +From the Library of Alexey Evseenko +482 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +R2# conf term +R2(config)# ip cef +R2(config)# end + +R2# show ip int fa 0/0 +FastEthernet0/0 is up, line protocol is up +Internet address is 192.168.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are always sent +ICMP unreachables are always sent +ICMP mask replies are never sent +IP fast switching is enabled +IP Flow switching is disabled +IP CEF switching is enabled +... OUTPUT OMITTED ... + +Example 11-3 shows the output of the show ip cef and show adjacency detail commands issued on Router R1. + +Example 11-3 Output from the show ip cef and show adjacency detail Commands + + +R1# show ip cef +Prefix +0.0.0.0/0 +0.0.0.0/8 +0.0.0.0/32 +1.1.1.1/32 +2.2.2.2/32 +10.1.1.0/30 +10.1.1.0/32 +10.1.1.1/32 +10.1.1.3/32 +127.0.0.0/8 +172.16.1.0/24 +172.16.1.0/32 +172.16.1.1/32 + + +Next Hop +no route +drop +receive +receive +10.1.1.2 +attached +receive +receive +receive +drop +attached +receive +receive + + +Interface + + + +Loopback0 +Serial1/0 +Serial1/0 +Serial1/0 +Serial1/0 +Serial1/0 + +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 483 + + +172.16.1.255/32 +192.168.1.0/24 +224.0.0.0/4 +224.0.0.0/24 +240.0.0.0/4 +255.255.255.255/32 + +receive +10.1.1.2 +drop +receive +drop +receive + +FastEthernet0/0 +Serial1/0 + + +R1# show adjacency detail +Protocol Interface Address +IP Serial1/0 point2point(11) +0 packets, 0 bytes +epoch 0 +sourced in sev-epoch 1 +Encap length 4 +0F000800 +P2P-ADJ + +Output from the show ip cef command, as seen in Example 11-3, contains the contents of the FIB for Router R1. Note that if the next hop of a network prefix is set to attached, the entry represents a network to which the router is directly attached. However, if the next hop of a network prefix is set to receive, the entry represents an IP address on one of the router’s interfaces. + +For example, the network prefix 10.1.1.0/30, with a next hop of attached, is a network (as indicated by the 30-bit subnet mask) directly attached to Router R1’s Serial 1/0 inter-face. However, the network prefix of 10.1.1.1/32 with a next hop of receive is a specific IP address (as indicated by the 32-bit subnet mask). Note that the all-0s host addresses for directly attached networks (for example, 10.1.1.0/30) and the all-1s host addresses for +directly attached networks (for example, 172.16.1.255/32) also show up as receive entries. + +Output from the show adjacency detail command displays information about how to reach a specific adjacency shown in the FIB. For example, Example 11-3 indicates that network 192.168.1.0 /24 is reachable by going out of interface Serial 1/0. The adjacency table also shows interface Serial 1/0 uses a point-to-point connection. Therefore, the adja-cent router is on the other side of the point-to-point link. If an interface in the adjacency table is an Ethernet interface, source and destination MAC address information is con-tained in the entry for the interface. + +Policy-Based Routing + +When a packet arrives at the incoming interface of a router, the router’s data plane pro-cessing logic takes several steps to process the packet. The incoming packet actually arrives encapsulated inside a data link layer frame, so the router must check the incom-ing frame’s Frame Check Sequence (FCS) and discard the frame if errors occurred in transmission. If the FCS check passes, the router discards the incoming frame’s data-link header and trailer, leaving the Layer 3 packet. Finally, the router does the equivalent of + + + + + +From the Library of Alexey Evseenko +484 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +comparing the destination IP address of the packet with the IP routing table, matching the longest-prefix route that matches the destination IP address. + +Policy-Based Routing (PBR) overrides a router’s natural destination-based forwarding logic. PBR intercepts the packet after deencapsulation on the incoming interface, before the router performs the CEF table lookup. PBR then chooses how to forward the packet using criteria other than the usual matching of the packet’s destination address with the CEF table. + +PBR chooses how to forward the packet by using matching logic defined through a route map, which in turn typically refers to an IP access control list (ACL). That same route map also defines the forwarding instructions—the next-hop IP address or outgoing inter-face—for packets matched by the route map. Figure 11-5 shows the general concept, with PBR on interface Fa0/0 overriding the usual routing logic, forwarding packets out three different outgoing interfaces. + + +Key Topic + + + +IP Packet + +PBR on F0/0 +Match X +set next-hop A + +Match Y +set interface F0/0 S0/1 +Match Z +set next-hop C + + +S0/0 +A + +IP Routing +Table S0/1 B + + +S0/2 C + + + +Figure 11-5 PBR Concepts + +To perform the actions shown in Figure 11-5, the engineer configures two general steps: + +Step 1. Create a route map with the logic to match packets, and choose the route, as shown on the left side of the figure. + +Step 2. Enable the route map for use with PBR, on an interface, for packets entering the interface. + +The rest of this section focuses on the configuration and verification of PBR. + + +Matching the Packet and Setting the Route + +To match packets with a route map enabled for PBR, you use the familiar route-map match command. However, you have two match command options to use: + +■ match ip address + +■ match length min max + + + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 485 + +The match ip address command can reference standard and extended ACLs. Any item matchable by an ACL can be matched in the route map. The match length command allows you to specify a range of lengths, in bytes. + +When a route map clause (with a permit action) matches a packet, the set command defines the action to take regarding how to forward the packet. The four set command options define either the outgoing interface or the next-hop IP address, just like routes in the IP routing table. Table 11-3 lists the options, with some explanations. + + +Table 11-3 +Key +Topic Command + + +Choosing Routes Using the PBR set Command + +Comments + + + +set ip next-hop ip-address [...ip-address] + + +set ip default next-hop ip-address [...ip-address] + +Next-hop addresses must be in a connected subnet; PBR forwards to the first address in the list for which the associated interface is up. +Same logic as previous command, except PBR first attempts to route based on the routing table. + +set interface interface-type interface- PBR forwards packets using the first interface number [...interface-type interface-number] in the list that is up. + + +set default interface interface-type interface- number [...interface-type interface-number] + +Same logic as previous command, except PBR first attempts to route based on the routing table. + + + +Note that two of the commands allow the definition of a next-hop router, and two allow the definition of an outgoing interface. The other difference in the commands relates +to whether the command includes the default keyword. The section “How the default Keyword Impacts PBR Logic Ordering,” later in this chapter, describes the meaning of the default keyword. + +After the route map has been configured with all the clauses to match packets and to set an outgoing interface or next-hop address, the only remaining step requires the ip policy route-map name command to enable PBR for packets entering an interface. + +PBR Configuration Example + +To tie the concepts together, Figure 11-6 shows a sample internetwork to use in a PBR example. In this case, EIGRP on R1 chooses the upper route to reach the subnets on the right, because of the higher bandwidth on the upper link (T1) as compared with the lower link (64 kbps). + + + + + + + + + +From the Library of Alexey Evseenko +486 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +10.1.234.0/24 10.1.1.0/24 + +10.1.1.1 + +PC1 + + +10.1.1.2 + +PC2 + +10.1.12.2 +R2 +S0/0/0 T1 Fa0/0 +R1 +S0/0/1 +64kbps + +10.1.14.4 R4 + + +10.1.3.0/24 + + + +Fa0/0 R3 + +S1 + + + +Figure 11-6 Network Used in PBR Example + +For this example, the PBR configuration matches packets sent from PC2 on the left to server S1 in subnet 10.1.3.0/24 on the right. PBR on R1 routes these packets out S0/0/1 to R4. These packets will be routed over the lower path—out R1’s S0/0/1 to R4—instead of through the current through R2, as listed in R1’s IP routing table. The PBR configuration on Router R1 is shown in Example 11-4. + +Example 11-4 R1 PBR Configuration + +interface Fastethernet 0/0 +ip address 10.1.1.9 255.255.255.0 +ip policy route-map PC2-over-low-route +! +route-map PC2-over-low-route permit +match ip address 101 +set ip next-hop 10.1.14.4 +! +access-list 101 permit ip host 10.1.1.2 10.1.3.0 0.0.0.255 + +The configuration enables PBR with Fa0/0’s ip policy route-map PC2-over-low-route command. The referenced route map matches packets that match ACL 101; ACL 101 matches packets from PC2 only, going to subnet 10.1.3.0/24. The route-map clause uses a permit action, which tells Cisco IOS to indeed apply PBR logic to these matched pack-ets. (Had the route-map command listed a deny action, Cisco IOS would simply route the packet as normal—it would not filter the packet.) Finally, for packets matched with +a permit action, the router forwards the packets based on the set ip next-hop 10.1.14.4 command, which tells R1 to forward the packet to R4 next. + +Note that for each packet entering Fa0/0, PBR either matches a packet with a route map permit clause or matches a packet with a route map deny clause. All route maps have an implicit deny clause at the end that matches all packets not already matched by the route map. PBR processes packets that match a permit clause using the defined set command. For packets matched by a deny clause, PBR lets the packet go through to the normal IP routing process. + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 487 + +To verify the results of the policy routing, Example 11-5 shows two traceroute com-mands: one from PC1 and one from PC2. Each shows the different paths. (Note that the output actually comes from a couple of routers configured to act as hosts PC1 and PC2 for this example.) + +Example 11-5 Confirming PBR Results Using traceroute + +! First, from PC1 (actually, a router acting as PC1): +PC1# trace 10.1.3.99 +Type escape sequence to abort. +Tracing the route to 10.1.3.99 + +1 10.1.1.9 4 msec 0 msec 4 msec +2 10.1.12.2 0 msec 4 msec 4 msec +3 10.1.234.3 0 msec 4 msec 4 msec +4 10.1.3.99 0 msec * 0 msec + +! Next, from PC2 +PC2# trace 10.1.3.99 + +Type escape sequence to abort. +Tracing the route to 10.1.3.99 + +1 10.1.1.9 4 msec 0 msec 4 msec +2 10.1.14.4 8 msec 4 msec 8 msec +3 10.1.234.3 8 msec 8 msec 4 msec +4 10.1.3.99 4 msec * 4 msec + +The output differs only in the second router in the end-to-end path—R2’s 10.1.12.2 address as seen for PC1’s packet and 10.1.14.4 as seen for PC2’s packet. + +The verification commands on the router doing the PBR function list relatively sparse information. The show ip policy command just shows the interfaces on which PBR is enabled and the route map used. The show route-map command shows overall statistics for the number of packets matching the route map for PBR purposes. The only way to verify the types of packets that are policy routed is to use the debug ip policy command, which can produce excessive overhead on production routers, given its multiple lines of output per packet, or to use traceroute. Example 11-6 lists the output of the show and debug commands on Router R1, with the debug output being for a single policy-routed packet. + +Example 11-6 Verifying PBR on Router R1 + +R1# show ip policy + +Interface +Fa0/0 + +Route map +PC2-over-low-route + + +R1# show route-map + + + + +From the Library of Alexey Evseenko +488 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +route-map PC2-over-low-route, permit, sequence 10 +Match clauses: +ip address (access-lists): 101 +Set clauses: +ip next-hop 10.1.14.4 +Policy routing matches: 12 packets, 720 bytes +R1# debug ip policy +*Sep 14 16:57:51.675: IP: s=10.1.1.2 (FastEthernet0/0), d=10.1.3.99 , len 28, +policy match +*Sep 14 16:57:51.675: IP: route map PC2-over-low-route, item 10, permit +*Sep 14 16:57:51.675: IP: s=10.1.1.2 (FastEthernet0/0), d=10.1.3.99 (Serial0/0/1), len 28, policy routed +*Sep 14 16:57:51.675: IP: FastEthernet0/0 to Serial0/0/1 10.1.14.4 + + +How the default Keyword Impacts PBR Logic Ordering + +The example in the previous section showed a set command that did not use the default keyword. However, the inclusion or omission of this keyword significantly impacts how PBR works. This parameter in effect tells Cisco IOS whether to apply PBR logic before trying to use normal destination-based routing, or whether to first try to use the normal destination-based routing, relying on PBR’s logic only if the destination-based routing logic fails to match a nondefault route. + +First, consider the case in which the set command omits the default parameter. When Cisco IOS matches the associated PBR route map permit clause, Cisco IOS applies the PBR logic first. If the set command identifies an outgoing interface that is up, or a next-hop router that is reachable, Cisco IOS uses the PBR-defined route. However, if the PBR route (as defined in the set command) is not working—because the outgoing interface is down or the next hop is unreachable using a connected route—Cisco IOS next tries to route the packet using the normal destination-based IP routing process. + +Next, consider the case in which the set command includes the default parameter. When Cisco IOS matches the associated PBR route map permit clause, Cisco IOS applies the normal destination-based routing logic first, with one small exception: It ignores any default routes. Therefore, the router first tries to route the packet as normal, but if no nondefault route matches the packet’s destination address, the router forwards the packet as directed in the set command. + +For example, for the configuration shown in Example 11-4, by changing the set com-mand to set ip default next-hop 10.1.14.4, R1 would have first looked for (and found) a working route through R2, and forwarded packets sent by PC2 over the link to R2. Summarizing: + + +■ Key +Topic +■ + +Omitting the default parameter gives you logic like this: “Try PBR first, and if PBR’s route does not work, try to route as usual.” + +Including the default parameter gives you logic like this: “Try to route as usual while +ignoring any default routes, but if normal routing fails, use PBR.” + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 489 + +Additional PBR Functions + +Primarily, PBR routes packets received on an interface, but using logic other than match-ing the destination IP address and the CEF table. This section briefly examines three additional PBR functions. + +Applying PBR to Locally Created Packets + +In some cases, it might be useful to use PBR to process packets generated by the router itself. However, PBR normally processes packets that enter the interface(s) on which the ip policy route-map command has been configured, and packets generated by the router itself do not actually enter the router through some interface. To make Cisco IOS process locally created packets using PBR logic, configure the ip local policy route-map name global command, referring to the PBR route map at the end of the command. + +The section “Configuring and Verifying IP SLA,” later in this chapter, shows an example use of this command. IP SLA causes a router to create packets, so applying PBR to such packets can influence the path taken by the packets. + +Setting IP Precedence + +Quality of service (QoS) refers to the entire process of how a network infrastructure can choose to apply different levels of service to different packets. For example, a router +might need to keep delay and jitter (delay variation) low for VoIP and Video over IP pack-ets, because these interactive voice and video calls only work well when the delay and jitter are held very low. As a result, the router might let VoIP packets bypass a long queue of data packets waiting to exit an interface, giving the voice packet better (lower) delay and jitter. + +Most QoS designs mark each packet with a different value inside the IP header, for the purpose of identifying groups of packets—a service class—that should get a particular QoS treatment. For example, all VoIP packets could be marked with a particular value so that the router can then find those marked bits, know that the packets are VoIP packets because of that marking, and apply QoS accordingly. + +Although the most commonly used QoS marking tool today is Class-Based Marking, in the past, PBR was one of the few tools that could be used for this important QoS func-tion of marking packets. PBR still supports marking. However, most modern QoS designs ignore PBR’s marking capabilities. + +Before discussing PBR’s marking features, a little background about the historical view of the IP header’s type of service (ToS) byte is needed. The IP header originally defined a ToS byte whose individual bits have been defined in a couple of ways over the years. One such definition used the three leftmost bits in the ToS byte as a 3-bit IP Precedence (IPP) field, which could be used for generic QoS marking, with higher values gener- +ally implying a better QoS treatment. Back in the 1990s, the ToS byte was redefined as the Differentiated Services (DS) byte, with the six leftmost bits defined as the +Differentiated Service Code Point (DSCP) marking. Most QoS implementations today revolve around setting the DSCP value. + + + +From the Library of Alexey Evseenko +490 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +PBR supports setting the older QoS marking fields—the IP Precedence (IPP) and the entire ToS byte—using the commands set ip precedence value and set ip tos value, respectively, in a route map. To configure packet marking, configure PBR as normal, but add a set command that defines the field to be marked and the value. + +PBR with IP SLA + +Besides matching a packet’s length, or matching a packet with an ACL, PBR can also react to some dynamic measurements of the health of an IP network. To do so, PBR relies on the IP Service-Level Agreement (IP SLA) tool. In short, if the IP SLA tool measures the network’s current performance, and the performance does not meet the defined thresh-old, PBR chooses to not use a particular route. The last major section of this chapter dis-cusses IP SLA, with the section “Configuring and Verifying IP SLA” demonstrating how PBR works with IP SLA. + +IP Service-Level Agreement + +The Cisco IOS IP Service-Level Agreement (IP SLA) feature measures the ongoing behav-ior of the network. The measurement can be as simple as using the equivalent of a ping to determine whether an IP address responds, or as sophisticated as measuring the jit- +ter (delay variation) of VoIP packets that flow over a particular path. To use IP SLA, an engineer configures IP SLA operations on various routers, and the routers will then send packets, receive responses, and gather data about whether a response was received, and the specific characteristics of the results, such as delay and jitter measurements. + +IP SLA primarily acts as a tool to test and gather data about a network. Network man-agement tools can then collect that data and report whether the network reached SLAs for the network. Many network management tools support the ability to configure IP SLA from the management tools’ graphical interfaces. When configured, the routers gather the results of the operations, storing the statistics in the CISCO-RTTMON-MIB. Management applications can later gather the statistics from this management informa-tion base (MIB) on various routers and report on whether the business SLAs were met based on the gathered statistics. + +Why bother with a pure network management feature in this book focused on IP rout-ing? Well, you can configure static routes and PBR to use IP SLA operations, such that if an operation shows a failure of a particular measurement or a reduced performance of the measurement below a configured threshold, the router stops using either the static route or PBR logic. This combination of features provides a means to control when the static and PBR paths are used and when they are ignored. + +This section begins with a discussion of IP SLA as an end to itself. Following that, the topic of SLA object tracking is added, along with how to configure static routes and PBR to track IP SLA operations, so that Cisco IOS knows when to use, and when to ignore, these routes. + + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 491 +1 + +Understanding IP SLA Concepts + +IP SLA uses the concept of an operation. Each operation defines a type of packet that the router will generate, the destination and source address, and other characteristics of the packet. The configuration includes settings about the time of day when the router should be sending the packets in a particular operation, the types of statistics that should be gathered, and how often the router should send the packets. Also, you can configure a router with multiple operations of different types. + +For example, a single IP SLA operation could define the following: + +■ Use Internet Control Message Protocol (ICMP) echo packets. + +■ Measure the end-to-end round-trip response time (ICMP echo). + +■ Send the packets every 5 minutes, all day long. + + +Note For those of you who have been around Cisco IOS for a while, the function of IP SLA might sound familiar. Cisco IP SLA has origins in earlier Cisco IOS features, including the Response Time Reporter (RTR) feature. The RTR feature is configured with the rtr command and uses the term probe to refer to what IP SLA refers to as an operation. + + +All the SLA operations rely on the router sending packets and some other device sending packets back. Figure 11-7 shows the general idea and provides a good backdrop to dis-cuss some related issues. + + + +SLA Operation +Key Topic + +SLA Responder RTP + + + +R1 +2 RTP + + + +3 ICMP echo request + +R3 + +R2 + + + + +Normal Server (no special +services) + +SLA Operation ICMP echo reply 4 S1 + + +Figure 11-7 Sending and Receiving Packets with IP SLA + +An IP SLA operation can cause the router to send packets to any IP address, whether on a router or a host. When sending to a host, as seen in the bottom part of the figure, the + + + + +From the Library of Alexey Evseenko +492 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +host does not need any special software or configuration—instead, the host just acts as normal. That means that if an SLA operation sends packets to a host, the router can only use operation types that send packets that the host understands. For example, the router could use ICMP echo requests (as seen in Steps 3 and 4), TCP connection requests, or even HTTP GET requests to a web server, because the server should try to respond to these requests. + +The operation can also send packets to another router, which gives IP SLA a wider range of possible operation types. If the operation sends packets to which the remote router would normally respond, like ICMP echo requests, the other router needs no special configuration. However, IP SLA supports the concept of the IP SLA responder, as noted in Figure 11-7 for R2. By configuring R2 as an IP SLA responder, it responds to packets that a router would not normally respond to, giving the network engineer a way to moni-tor network behavior without having to place devices around the network just to test the network. + +For example, the operation could send Real-time Transport Protocol (RTP) packets— packets that have the same characteristics as VoIP packets—as shown in Figure 11-7 +as Step 1. Then the IP SLA responder function on R2 can reply as if a voice call exists between the two routers, as shown in Step 2 of that figure. + +A wide range of IP SLA operations exist. The following list summarizes the majority of the available operation types, just for perspective: + +■ ICMP (echo, jitter) + +■ RTP (VoIP) + +■ TCP connection (establishes TCP connections) + +■ UDP (echo, jitter) + +■ DNS + +■ DHCP + +■ HTTP + +■ FTP + + +Configuring and Verifying IP SLA + +This book describes IP SLA configuration in enough depth to get a sense for how it can be used to influence static routes and PBR. To that end, this section examines the use of an ICMP echo operation, which requires configuration only on one router, with no IP SLA responder. The remote host, router, or other device replies to the ICMP echo requests just like any other ICMP echo requests. + +The general steps to configure an ICMP-based IP SLA operation are as follows: + + +Step 1. +Key Topic + + +Create the IP SLA operation and assign it an integer operation number, using +the ip sla sla-ops-number global configuration command. + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 493 + +Step 2. Define the operation type and the parameters for that operation type. For ICMP echo, you define the destination IP address or host name, and option-ally, the source IP address or host name, using the icmp-echo {destination-ip-address | destination-hostname} [source-ip {ip-address | hostname} | source-interface interface-name] SLA operation subcommand. +Step 3. (Optional) Define a (nondefault) frequency at which the operation should send the packets, in seconds, using the frequency seconds IP SLA subcommand. + +Step 4. Schedule when the SLA will run, using the ip sla schedule sla-ops-number [life {forever | seconds}] [start-time {hh:mm [:ss] [month day | day month] | pending | now | after hh:mm:ss}] [ageout seconds] [recurring] global command. + +Example 11-7 shows the process of configuring an ICMP echo operation on Router R1 from Figure 11-6. The purpose of the operation is to test the PBR route through R4. In this case, the operation will be configured as shown in Figure 11-8, with the following criteria: + +■ Send ICMP echo requests to server S1 (10.1.3.99). + +■ Use source address 10.1.1.9 (R1’s F0/0 IP address). + +■ Send these packets every 60 seconds. + +■ Start the operation immediately, and run it forever. + +■ Enable PBR for locally generated packets, matching the IP SLA operation with the PBR configuration so that the SLA operation’s packets flow over the lower route. + +10.1.234.0/24 + +10.1.1.0/24 + + +S0/0/0 + + +10.1.12.2 10.1.3.0/24 +R2 + +T1 + + + +PC1 Fa0/0 +.9 R1 +S0/0/1 +64kbps + + +Fa0/0 R3 + +S1 + + +10.1.14.4 R4 + + + + + +Operation 11 +ICMP Echo + +Figure 11-8 Concept of IP SLA Operation on R1 + + + + + +From the Library of Alexey Evseenko +494 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 11-7 Configuring an ICMP Echo Operation on Router R1 + +R1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# ip sla 11 +R1(config-ip-sla)# icmp? +icmp-echo icmp-jitter + +R1(config-ip-sla)# icmp-echo 10.1.3.99 source-ip 10.1.1.9 +R1(config-ip-sla)# frequency 60 +R1(config-ip-sla)# exit +R1(config)# ip sla schedule 11 start-time now life forever + +! Changes to the PBR configuration below +R1(config)# access-list 101 permit ip host 10.1.1.9 host 10.1.3.99 +R1(config)# ip local policy route-map PC2-over-low-route +R1(config)# end + +First, focus on the pure IP SLA configuration, located from the beginning of the example through command ip sla schedule. The configuration creates IP SLA operation 11. The parameters on the icmp-echo command act as if you used an extended ping from the command line, specifying both the source and destination IP address. The last command directly relates to IP SLA. The ip sla schedule command enables the operation now, and runs the operation until the network engineer takes some action to disable it, in some cases by removing the operation with the no ip sla sla-ops-number command. + +The last two commands in the example show a change to the earlier PBR configuration so that the SLA operation’s packets flow over the lower route. The ip local policy PC2-over-low-route global configuration command tells R1 to process packets generated by R1, including the IP SLA operation packets, using PBR. The addition of the access-list 101 command to the configuration shown earlier in Example 11-4 makes the route map match the source and destination address of the SLA operation. That former route map’s set command sent the packets over the link to R4. + +IP SLA supports a couple of particularly useful verification commands: show ip sla con-figuration and show ip sla statistics. The first command confirms all the configuration settings for the operation, and the second lists the current statistics for the operation. Example 11-8 shows examples of each on R1, after the configuration shown in +Example 11-7. + +Example 11-8 Verification of an IP SLA Operation + +R1# show ip sla configuration +IP SLAs Infrastructure Engine-II +Entry number: 11 +Owner: +Tag: +Type of operation to perform: echo +Target address/Source address: 10.1.3.99/10.1.1.9 + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 495 + +Type Of Service parameter: 0x0 +Request size (ARR data portion): 28 +Operation timeout (milliseconds): 5000 +Verify data: No +Vrf Name: +Schedule: +Operation frequency (seconds): 60 (not considered if randomly scheduled) +Next Scheduled Start Time: Start Time already passed +Group Scheduled : FALSE +Randomly Scheduled : FALSE +Life (seconds): Forever +Entry Ageout (seconds): never +Recurring (Starting Everyday): FALSE +Status of entry (SNMP RowStatus): Active +Threshold (milliseconds): 5000 (not considered if react RTT is configured) +Distribution Statistics: +Number of statistic hours kept: 2 +Number of statistic distribution buckets kept: 1 +Statistic distribution interval (milliseconds): 20 +History Statistics: +Number of history Lives kept: 0 +Number of history Buckets kept: 15 +History Filter Type: None +Enhanced History: + +R1# show ip sla statistics 11 +IPSLAs Latest Operation Statistics + +IPSLA operation id: 11 +Latest RTT: 8 milliseconds +Latest operation start time: *19:58:08.395 UTC Mon Sep 14 2009 +Latest operation return code: OK +Number of successes: 22 +Number of failures: 0 +Operation time to live: Forever + +The highlighted lines in the output of the show ip sla configuration command corre-spond to the values explicitly configured in Example 11-7. The more interesting output exists in the output of the show ip sla statistics 11 command, which lists the statistics only for operation 11. In this case, 22 intervals have passed, showing 22 ICMP echo requests as successful with no failures. The output also lists the latest round-trip time (RTT). Finally, it lists the return code of the most recent operation (OK in this case)—a key value used by SLA tracking. + + + + + + + +From the Library of Alexey Evseenko +496 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Tracking SLA Operations to Influence Routing + +As previously mentioned, you can configure both static routes and PBR to be used only when an SLA operation remains successful. The configuration to achieve this logic requires the configuration of a tracking object and cross-references between the static route, PBR, and IP SLA, as shown in Figure 11-9. + +Key SLA +Topic Operation + + + +Tracking Object + + + +Static Route PBR + +Figure 11-9 Configuration Relationships for Path Control Using IP SLA + +The tracking object looks at the IP SLA operation’s most recent return code to then determine the tracking state as either “up” or “down.” Depending on the type of SLA operation, the return code can be a simple toggle, with “OK” meaning that the last opera-tion worked. The tracking object would then result in an “up” state if the SLA operation resulted in an “OK” return code. Other SLA operations that define thresholds have more possible return codes. The tracking operation results in an “up” state if the IP SLA opera-tion is within the configured threshold. + +One of the main reasons that Cisco IOS requires the use of this tracking object is to pre-vent flapping routes. Route flapping occurs when a router adds a route to its routing table then quickly removes it, conditions change causing the route to be added back to the table again, and so on. If a static route tracked an IP SLA object directly, the SLA object’s return code could change each time the operation ran, causing a route flap. The track- +ing object concept provides the ability to set a delay of how soon after a tracking state change the tracking object should change state. This feature gives the engineer a tool to control route flaps. + +This section shows how to configure a tracking object for use with both a static route and with PBR. + +Configuring a Static Route to Track an IP SLA Operation + +To configure a static route to track an IP SLA, you need to configure the tracking object and then configure the static route with the track keyword. To do so, use these steps: + +Key Step 1. Topic + + +Use the track object-number ip sla sla-ops-number [state | reachability] +global command. + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 497 + +Step 2. (Optional) Configure the delay to regulate flapping of the tracking state by using the delay {down seconds | up seconds} command in tracking configura-tion mode. +Step 3. Configure the static route with the ip route destination mask {interface | next-hop} track object-number command in global configuration mode. + +Example 11-9 shows the configuration of tracking object 2, using the same design shown in Figures 11-6 and 11-8. In this case, the configuration adds a static route for subnet 10.1.234.0/24, the LAN subnet to which R2, R3, and R4 all connect. EIGRP chooses a route over R1’s S0/0/0 interface as its best route, but this static route uses S0/0/1 as the outgoing interface. + +Example 11-9 Configuring a Static Route with Tracking IP SLA + +R1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# track 2 ip sla 11 state +R1(config-track)# delay up 90 down 90 +R1(config-track)# exit +R1(config)# ip route 10.1.234.0 255.255.255.0 s0/0/1 track 2 +R1(config)# end + +The configuration begins with the creation of the tracking object number 2. As with IP SLA operation numbers, the number itself is unimportant, other than that the ip route command refers to this same number with the track 2 option at the end of the command. The tracking object’s delay settings have been made at 90 seconds. + +The show track command lists the tracking object’s configuration plus many other details. It lists the current tracking state, the time in this state, the number of state transi-tions, and the other entities that track the object (in this case, a static route). + +Example 11-10 shows what happens when the IP SLA operation fails, causing the static route to be removed. The example starts with the configuration shown in Example 11-9, along with the SLA operation 11 as configured in Example 11-7. The following list details the current operation and what happens sequentially in the example: +Step 1. Before the text seen in Example 11-10, the current IP SLA operation already sends packets using PBR, over R1’s link to R4, using source IP address 10.1.1.9 and destination 10.1.3.99 (server S1). +Step 2. At the beginning of the next example, because the IP SLA operation is work-ing, the static route is in R1’s IP routing table. + +Step 3. An ACL is configured on R4 (not shown) so that the IP SLA operation fails. + +Step 4. A few minutes later, R1 issues a log message stating that the tracking object changed state from up to down. + +Step 5. The example ends with several commands that confirm the change in state for the tracking object, and confirmation that R1 now uses the EIGRP-learned route through R2. + + + +From the Library of Alexey Evseenko +498 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note This example uses the show ip route ... longer-prefixes command, because this command lists only the route for 10.1.234.0/24, which is the route that fails over in the example. + + +Example 11-10 Verifying Tracking of Static Routes + +! Next – Step 2 +R1# show ip route 10.1.234.0 255.255.255.0 longer-prefixes +! Legend omitted for brevity + +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +S 10.1.234.0/24 is directly connected, Serial0/0/1 +R1# show track +Track 2 +IP SLA 11 state +State is Up +1 change, last change 01:24:14 +Delay up 90 secs, down 90 secs +Latest operation return code: OK +Latest RTT (millisecs) 7 +Tracked by: +STATIC-IP-ROUTING 0 + +! Next, Step 3 +! Not shown – SLA Operations packets are now filtered by an ACL on R4 +! Sometime later... +! + +! Next – Step 4 +R1# +*Sep 14 22:55:43.362: %TRACKING-5-STATE: 2 ip sla 11 state Up->Down + +! Final Step – Step 5 +R1# show track +Track 2 +IP SLA 11 state +State is Down +2 changes, last change 00:00:15 +Delay up 90 secs, down 90 secs +Latest operation return code: No connection +Tracked by: +STATIC-IP-ROUTING 0 +R1# show ip route 10.1.234.0 255.255.255.0 longer-prefixes +! Legend omitted for brevity + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 499 + +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +D 10.1.234.0/24 [90/2172416] via 10.1.12.2, 00:00:25, Serial0/0/0 + + +Configuring PBR to Track an IP SLA + +To configure PBR to use object tracking, use a modified version of the set command in the route map. For example, the earlier PBR configuration used the following set command: + +set ip next-hop 10.1.14.4 +Instead, use the verify-availability keyword, as shown in this command: + +set ip next-hop verify-availability 10.1.14.4 1 track 2 +When the tracking object is up, PBR works as configured. When the tracking object is down, PBR acts as if the set command does not exist. That means that the router will still attempt to route the packet per the normal destination-based routing process. + +The output of the related verification commands does not differ significantly when com-paring the configuration of tracking for static routes versus PBR. The show track com-mand lists “ROUTE-MAP” instead of “STATIC-IP-ROUTING,” but the details of the show track, show ip sla statistics, and object tracking log message seen in Example +11-10 remain the same. + + +VRF-Lite + +Service providers often need to allow their customers’ traffic to pass through their cloud without one customer’s traffic (and corresponding routes) exposed to another customer. Similarly, enterprise networks might need to segregate various application types, such as keeping voice and video traffic separate from data. These are just a couple of scenarios that could benefit from the Cisco Virtual Routing and Forwarding (VRF) feature. VRF allows a single physical router to host multiple virtual routers, with those virtual routers logically isolated from one another, each with its own IP routing table. + + +Note Some Cisco literature states that VRF is an acronym for Virtual Routing and Forwarding, while other Cisco literature states that VRF is an acronym for VPN Routing/ Forwarding (because of its common use in Virtual Private Networks [VPN]). This book uses the more generic Virtual Routing and Forwarding definition. + + +Cisco Easy Virtual Network (EVN), as described in Chapter 1, “Characteristics of Routing Protocols,” is a newer approach to VRF configuration, as compared to VRF-Lite. With VRF-Lite, if you want to send traffic for multiple virtual networks (that is, multiple VRFs) between two routers, you need to create a subinterface for each VRF on each router. However, with Cisco EVN, you instead create a trunk (called a Virtual Network (VNET) trunk) between the routers. Then, traffic for multiple virtual networks can travel over that single trunk interface, which uses tags to identify the virtual networks to which packets belong. + + + + +From the Library of Alexey Evseenko +500 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Even though Cisco EVN can help reduce the amount of configuration required for a VRF solution, VRF-Lite configuration is still often used in VRF networks. This section covers the basics of setting up and verifying a VRF configuration, for VRFs using Open Shortest Path First (OSPF) as their interior gateway protocol (IGP). + +VRF-Lite Configuration + +Table 11-4 lists the steps to perform a basic VRF-Lite configuration for VRF instances running OSPF. + + +Note VRF-Lite has several other options, beyond the scope of this book. For example, you can allow VRF to selectively “leak” routes between VRF instances. + + + + +Table 11-4 + +Command + + +Steps for a Basic OSPF VRF-Lite Configuration + +Description + + + +ip vrf vrf-name + +ip vrf forwarding vrf-name + + + + + +router ospf process-id vrf vrf-name + +A global configuration mode command that creates a VRF and enters VRF configuration mode. +An interface or subinterface configuration mode command that assigns an interface or a subinterface to a VRF instance. (Note: If the interface or subinterface already had an IP address assigned, this command will remove that address, and you will need to add it back.) +A global configuration mode command that associates a unique process ID with a VRF instance and enters OSPF router configuration mode for +a specific VRF instance. (Note: When in OSPF router configuration mode, you can enter the OSPF commands that you would normally enter in this mode.) + + + +To illustrate a basic VRF-Lite configuration, consider Figure 11-10. A goal of the net-work topology shown is to isolate the voice, data, and video networks into separate VRF instances. Notice that the Fa 0/0 interface on the COMMON router is divided into three subinterfaces (Fa 0/0.2, Fa 0/0.3, and Fa 0/0.4). The COMMON router then connects to switch SW1 over an 802.1Q trunk. Switch SW1 then connects out to the VOICE, DATA, and VIDEO routers, where the switch port connecting to each router belongs to a differ-ent VLAN (that is, VOICE VLAN = 2, DATA VLAN = 3, VIDEO VLAN = 4). + +Example 11-11 illustrates the configuration of the three VRFs (VOICE, DATA, and VIDEO) shown in Figure 11-10. + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 501 + +Fa0/1: 10.1.1.1/24 + +VOICE SW2 +Fa0/0: 192.0.2.2/30 + + + + + +Fa0/0.2: 192.0.2.1/30 Fa0/0.3: 198.51.100.1/30 Fa0/0.4: 203.0.113.1/30 + + +Fa0/0: 198.51.100.2/30 Fa0/1: 172.16.1.1/24 + + +COMMON 802.1Q Trunk SW1 DATA SW3 + + + + + +Fa0/1: 192.168.1.1/24 +Fa0/0: 203.0.113.2/30 + +VIDEO SW4 + +Figure 11-10 VRF-Lite Sample Topology + +Example 11-11 VRF-Lite Sample Configuration Using OSPF as the Routing Protocol +Key +Topic ... OUTPUT OMITTED... +ip vrf VOICE +! +ip vrf DATA +! +ip vrf VIDEO +! +... OUTPUT OMITTED... +! +interface FastEthernet0/0 +no ip address +! +interface FastEthernet0/0.2 +encapsulation dot1Q 2 +ip vrf forwarding VOICE +ip address 192.0.2.1 255.255.255.252 +! +interface FastEthernet0/0.3 +encapsulation dot1Q 3 +ip vrf forwarding DATA +ip address 198.51.100.1 255.255.255.252 +! +interface FastEthernet0/0.4 +encapsulation dot1Q 4 + + + +From the Library of Alexey Evseenko +502 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ip vrf forwarding VIDEO +ip address 203.0.113.1 255.255.255.252 +! +... OUTPUT OMITTED... +! +router ospf 1 vrf VOICE +network 0.0.0.0 255.255.255.255 area 0 +! +router ospf 2 vrf DATA +network 0.0.0.0 255.255.255.255 area 0 +! +router ospf 3 vrf VIDEO +network 0.0.0.0 255.255.255.255 area 0 +... OUTPUT OMITTED... + +In Example 11-11, notice that the ip vrf vrf-name command is used to create each of the VRFs. Then each subinterface is assigned to one of the VRFs, using the ip vrf forwarding vrf-name command. If the subinterface previously had an IP address, the ip vrf forward-ing vrf-name command removes the address, and it has to be reentered. + +This example used OSPF as the routing protocol for the different VRFs, and the router ospf process-id vrf vrf-name command was used to enter OSPF configuration mode for each VRF. Also, keep in mind that even though different VRFs can have overlapping net-work addresses (because the VRF’s IP routing tables are logically separated), the OSPF process ID needs to be unique for each VRF. + +VRF Verification + +The show ip vrf command, as demonstrated in Example 11-12, can be used to list a rout-er’s VRFs, along with the interfaces assigned to each VRF. + +Example 11-12 show ip vrf Output + + +COMMON# show ip vrf +Name +DATA +VIDEO +VOICE + + +Default RD + + + + + +Interfaces +Fa0/0.3 +Fa0/0.4 +Fa0/0.2 + + +Each VRF maintains its own IP routing table. Therefore, to view the contents of a specific VRF’s IP routing table, you can use the show ip route vrf vrf-name command. Example 11-13 shows the output of this command for each of the three VRFs created in Example 11-11. Notice that each VRF learned a different network through OSPF. + +Example 11-13 show ip route vrf vrf-name Output + +COMMON# show ip route vrf VOICE + +...OUTPUT OMITTED... + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 503 + +Gateway of last resort is not set + +10.0.0.0/24 is subnetted, 1 subnets +O 10.1.1.0 [110/2] via 192.0.2.2, 00:00:46, FastEthernet0/0.2 +192.0.2.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.0.2.0/30 is directly connected, FastEthernet0/0.2 +L 192.0.2.1/32 is directly connected, FastEthernet0/0.2 +COMMON# show ip route vrf DATA + +...OUTPUT OMITTED... + +Gateway of last resort is not set + +172.16.0.0/24 is subnetted, 1 subnets +O 172.16.1.0 [110/2] via 198.51.100.2, 00:00:42, FastEthernet0/0.3 +198.51.100.0/24 is variably subnetted, 2 subnets, 2 masks +C 198.51.100.0/30 is directly connected, FastEthernet0/0.3 +L 198.51.100.1/32 is directly connected, FastEthernet0/0.3 +COMMON# show ip route vrf VIDEO + +...OUTPUT OMITTED... + +Gateway of last resort is not set + +O 192.168.1.0/24 [110/2] via 203.0.113.2, 00:00:20, FastEthernet0/0.4 +203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks +C 203.0.113.0/30 is directly connected, FastEthernet0/0.4 +L 203.0.113.1/32 is directly connected, FastEthernet0/0.4 + +The ping command is commonly used to check connectivity with a remote IP address. However, on a router configured with multiple VRFs, you might need to specify the VRF in which the destination address resides. Example 11-14 shows a series of ping vrf vrf-name destination-ip commands. The destination IP addresses specified are IP addresses assigned to the Fa 0/1 interfaces on the VOICE, DATA, and VIDEO routers. Notice that for the VOICE VRF, only the 10.1.1.1 IP address is reachable, because the VOICE VRF is logically isolated from the DATA and VIDEO VLANs. Subsequent ping commands in the example demonstrate similar results for the DATA and VIDEO VRFs. + +Example 11-14 Pinging an IP Address in a VRF + +! Pinging from VRF VOICE +COMMON# ping vrf VOICE 10.1.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 32/40/48 ms +COMMON# ping vrf VOICE 172.16.1.1 + + + + +From the Library of Alexey Evseenko +504 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) +COMMON# ping vrf VOICE 192.168.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: +..... + +! Pinging from VRF DATA +COMMON# ping vrf DATA 10.1.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) +COMMON# ping vrf DATA 172.16.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: +!!!!! +COMMON# ping vrf DATA 192.168.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: +..... + +! Pinging from VRF VIDEO +COMMON# ping vrf VIDEO 10.1.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) +COMMON# ping vrf VIDEO 172.16.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) +COMMON# ping vrf VIDEO 192.168.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: +!!!!! +Success rate is 80 percent (4/5), round-trip min/avg/max = 24/36/52 ms +COMMON# + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 505 + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 11-5 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an imple-mentation plan, what implementation options come to mind? You should write a general description; specific configuration commands are not required. + +Table 11-5 Design Review + + +Design Goal + +The design requires that the routers use the most efficient method of packet switching available. +The design calls for traffic destined for one server in subnet 10.1.1.0/24 to be sent over a different route than the IGP-learned route for 10.1.1.0/24. (2) + +Possible Implementation Choices Covered in This Chapter + +Same requirement as the previous row, except that only a subset of the source hosts should have their packets take a different route than the IGP-learned route. +The design requires that a static route be used, but only when a particular database server is reachable. +A design requires that a service provider router connect to and be able to communicate with three customer routers. (2) + + + + + + + +From the Library of Alexey Evseenko +506 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Implementation Plan Peer Review Table + +Table 11-6 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 11-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answers +The plan shows an upgrade from an older router using Fast Switching to a new router using CEF. What is the fundamental difference in those packet-switching technologies? +A plan lists two PBR route maps—one that uses the default keyword in its set command and the other that does not. What is the fundamental difference? +A plan shows a route map enabled for policy routing, and the route map matches some packets with a deny route-map clause. What does Cisco IOS do with those packets? +The plan document shows a PBR route map with the command set ip dscp ef. Does PBR support marking? And can it mark DSCP? +The plan shows an IP SLA operation number 5, with a static route configured with the track 5 parameter. What issues might exist with the linkages between these commands? +The IP SLA configuration shows an IP SLA operation that uses ICMP Echo, with the destination IP address of a server. What must be done on the server to support this operation? +Same scenario as the previous row, except the destination address is on a router. +Same scenario as the previous row, except the operation generates RTP packets to measure voice jitter. +How will a VRF-Lite configuration on a router (configured with a subinterface for each VRF) connect to a Cisco Catalyst switch while keeping traffic from each VRF isolated? + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 507 + +Create an Implementation Plan Table + +To practice skills useful when creating your own implementation plan, list in Table 11-7 all configuration commands related to the configuration of the following features. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 11-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Globally enabled CEF. + +Enable CEF on an interface (if CEF is globally enabled). +Configure the matching logic in a PBR route map (2). +Configure the next-hop IP address in a PBR route map (2). +Configure the outgoing interface in a PBR route map (2). +Enable PBR on an interface. + +Enable PBR for packets created by a router. + +Create a VRF. + +Assign an interface or subinterface to a VRF. + +Enter OSPF router configuration mode for a specific VRF instance. + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own verification plan, list in Table 11-8 all commands that supply the requested information. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 11-8 Verification Plan Memory Drill + +Information Needed Command +Display multiple interface statistics, including information about an interface’s packet-switching mode. +Display the contents of a router’s FIB. + + + + + +From the Library of Alexey Evseenko +508 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Information Needed Command +Show information contained in the adjacency table of a router, including protocol and timer information. +List interfaces on which PBR is enabled and the route map used. +Display the configuration of a route map. + +Generate debug messages for each packet that matches PBR. +Display the configuration of an SLA operation. +Show the measurements from an SLA operation. +Display the status of a tracking object. + +Display a listing of configured VRFs. + +Show the IP routing table for a specific VRF. + +Ping an IP address residing in a specific VRF. + + +Note Some of the entries in this table might not have been specifically mentioned in this chapter, but are listed in the table for review and reference. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 11-9 lists a reference of these key topics and the page numbers on which each is found. + +Table 11-9 Key Topics for Chapter 11 +Key +Topic Key Topic Element Description Page Number + + +Table 11-2 + +Example 11-1 + +Figure 11-5 + +Table 11-3 + +List + +Figure 11-7 + +CEF Configuration and Verification Commands 479 + +Enable CEF on Router R1’s Fa 0/0 Interface 480 + +PBR Concepts 484 + +Choosing Routes Using the PBR set Command 485 + +Comparisons of PBR logic when including/omitting 488 the set command’s default keyword +Sending and Receiving Packets with IP SLA 491 + + + + + + +From the Library of Alexey Evseenko +Chapter 11: Route Selection 509 + + + +Key Topic Element List +Figure 11-9 + +List + +Example 11-11 + +Description +Configuration checklist for IP SLA + +Configuration Relationships for Path Control Using IP SLA +Configuration checklist for object tracking + +VRF-Lite Sample Configuration Using OSPF as the Routing Protocol + +Page Number 492 +496 + +496 + +501 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Definitions of Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +Cisco Express Forwarding, Policy-Based Routing, IP Service-Level Agreement, track-ing object, path control, ToS, IP Precedence, SLA Operation, Virtual Routing and Forwarding (VRF), VRF-Lite + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Provider Assigned IPv4 Addresses: This sec-tion contrasts a couple of ways that an Internet service provider (ISP) can assign IPv4 addresses to their customers’ routers. Specifically, the ISP could give a customer an IP address to statically assign to his router, or the customer could use Dynamic Host Configuration Protocol (DHCP) to dynami- +cally assign an IPv4 address from a pool of available addresses. +■ NAT: This section discusses how the Network Address Translation (NAT) service allows an enter-prise network to use private IPv4 addresses (that +is, RFC 1918 addresses) internally, and have those private IP addresses translated into one or more pub-licly routable IPv4 addresses. + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 12 + + + + +Fundamentals of Internet Connectivity + + + +The movie Field of Dreams said it best, “If you build it, they will come.” That has hap-pened with the Internet. Over the past couple of decades, Internet access speeds have gone up as prices have come down, resulting in an increasing dependence on the Internet. For example, companies with multiple locations frequently securely interconnect those locations by creating a Virtual Private Network (VPN) tunnel across the Internet. Cloud storage services allow computers to back up and synchronize files over the Internet. The Internet is increasingly being used for voice and video communication, not to mention its traditional web browsing and email uses. + +With such a reliance on the Internet, most network designs need to include Internet con-nectivity. This module begins with a look at how a router connecting to an Internet ser-vice provider (ISP) obtains an IP address. One option is for the ISP to statically assign one or more publicly routable IP address(es) to a customer. Another approach is to use Dynamic Host Configuration Protocol (DHCP), which allows an ISP to dynamically assign IP addresses to customer routers. + +If an enterprise network is primarily using IPv4 addresses, as opposed to IPv6 addresses, it probably uses Network Address Translation (NAT) when connecting to the Internet. The issue necessitating the use of NAT is the depletion of IPv4 addresses, as discussed in Chapter 3, “IPv6 Review and RIPng.” Because there are not enough IPv4 addresses to give every networked device in the world a unique IPv4 address, NAT allows networks to use private IP addresses (that is, IPv4 addresses defined by RFC 1918, which are not +routable on the public Internet). Those internally used private IP addresses are then trans-lated, using NAT, into one or more publicly routable IPv4 addresses. This chapter con-cludes with a discussion of NAT theory and configuration. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these seven 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 that you can assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + + + + + + + +From the Library of Alexey Evseenko +512 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 12-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Provider-Assigned IPv4 Addresses + +NAT + +Questions +1–4 + +5–7 + + + +1. You are configuring a default route that should direct traffic for unknown networks out of interface Fa 0/0 to a next-hop IP address of 192.168.1.100. Which of the fol-lowing commands should you use to configure the default route? +a. ip route 255.255.255.255 255.255.255.255 fa 0/0 + +b. ip route 255.255.255.255 255.255.255.255 192.168.1.100 + +c. ip route 0.0.0.0 0.0.0.0 fa 0/0 + +d. ip route 0.0.0.0 0.0.0.0 192.168.1.100 + +2. What interface configuration mode command instructs an interface to dynamically obtain its IP address from a DHCP server? + +a. ip address 255.255.255.255 + +b. ip address dynamic + +c. ip address dhcp + +d. ip address bootp + +3. Interface Fa 0/0 on your router has obtained an IP address through DHCP. You notice that in addition to an IP address assigned to interface Fa 0/0, your router now has +a default static route configured. What command can you issue to prevent a router from automatically installing a default static route based on default gateway informa-tion learned through DHCP? +a. no ip dhcp client request router + +b. ip dhcp suppress gateway + +c. ip dhcp route local + +d. no ip dhcp server response router + +4. Interface Fa 0/0 on your router has obtained an IP address through DHCP. You notice that in addition to an IP address assigned to interface Fa 0/0, your router now has a default static route configured. What is the administrative distance (AD) of that route? +a. 0 + +b. 1 + +c. 254 + +d. 255 + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 513 + +5. What type of Network Address Translation (NAT) allows a collection of inside local addresses to share a single inside global address, for use when communicating on the Internet? +a. DNAT + +b. SNAT + +c. PAT + +d. MAT + +6. A laptop inside your network has an IP address of 10.1.1.241. Using NAT, a router translates the 10.1.1.241 private IP address into 198.51.100.54, a public IP address, as the laptop is connecting to a web server on the Internet. The web server has an IP address of 203.0.113.10. What type of address is 10.1.1.241 in this scenario? +a. Outside global + +b. Inside local + +c. Inside global + +d. Outside local + +7. A laptop inside your network has an IP address of 10.1.1.241. Using NAT, a router translates the 10.1.1.241 private IP address into 198.51.100.54, a public IP address, as the laptop is connecting to a web server on the Internet. The web server has an IP address of 203.0.113.10. What type of address is 203.0.113.10 in this scenario? +a. Outside global + +b. Inside local + +c. Inside global + +d. Outside local + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +514 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +Provider-Assigned IPv4 Addresses + +ISPs have collections of publicly routable IPv4 addresses that they can distribute to their customers, thus allowing devices in the customer networks to communicate over the Internet. The IPv4 address assignments to customers could be either static assignments or dynamic assignments. + +Static assignments might be useful to customers that have servers needing to be accessed from the Internet. For example, a company might have a web server as part of its net-work. If there is a static IP address assignment for that server, a Domain Name System (DNS) name could be associated with that IP address, allowing users on the Internet to access the web server by specifying the DNS name of the server (as opposed to its IP address) in their web browser. + +However, if a company does not have any on-site servers needing to be accessed from the public Internet, it might not need a static IP address. In such situations, an ISP might dynamically assign one or more IP addresses to the company. + + +Note If an ISP does not offer static IP address assignment to its customers, or if there is an extra charge associated with a static IP address, the customers might be able to use Dynamic DNS (DDNS), which dynamically updates DNS records to reflect current IP address assignments. + + + +Static IP Address Assignment + +Configuring an Internet-facing router with a statically assigned IP address involves two configuration steps: + +Step 1. +Key Topic +Step 2. + + +Assign an IP address to the router interface connecting to the ISP, using the ip address ip_address subnet_mask command, in interface configuration mode. + +Configure a default route pointing to the ISP, with the ip route 0.0.0.0 0.0.0.0 +ip_address_of_isp_router command, in global configuration mode. + + + +Note Even though a default route can reference an egress router interface, rather than a next-hop IP address, specifying the next-hop IP address is considered a best practice. This is because, if you specify an Ethernet interface as the egress interface in a default route command, the router might generate an excessive number of ARP requests, resulting in poor router performance. + + + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 515 + +To illustrate the configuration of an Internet-facing router with a static IP address, con-sider Figure 12-1 and Example 12-1. + + +Default Route + + +S1/0 10.1.1.2/30 + +R1 +Fa0/0 192.168.1.1/24 + + +S1/0 10.1.1.1/30 +ISP + + +Internet +Lo0 1.1.1.1/32 + + + + + +Figure 12-1 Topology with Static IP Address Assignment + +Example 12-1 Static IP Address and Default Route Configuration + +R1# conf term +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# int s 1/0 +R1(config-if)# ip address 10.1.1.2 255.255.255.252 +R1(config-if)# no shutdown +R1(config-if)# exit +R1(config)# ip route 0.0.0.0 0.0.0.0 10.1.1.1 +R1(config)# end +R1# show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 10.1.1.1 to network 0.0.0.0 + +S* 0.0.0.0/0 [1/0] via 10.1.1.1 +10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks +C 10.1.1.0/30 is directly connected, Serial1/0 +L 10.1.1.2/32 is directly connected, Serial1/0 +192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.1.0/24 is directly connected, FastEthernet0/0 +L 192.168.1.1/32 is directly connected, FastEthernet0/0 +R1# ping 1.1.1.1 + + + + +From the Library of Alexey Evseenko +516 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 36/37/44 ms +R1# + +In Example 12-1, Router R1 is an Internet-facing router located at a customer site. The ISP assigned the customer a static IP address of 10.1.1.2 /30. The configuration on Router R1 begins by configuring the IP address of the Serial 1/0 interface with the ip address 10.1.1.2 255.255.255.252 command, followed by administratively bringing up the inter- +face (if it were shut down) with the no shutdown command. Next, in global configuration mode, a default static route is configured, using the ip route 0.0.0.0 0.0.0.0 10.1.1.1 com-mand, to point to a next-hop address of 10.1.1.1, which is the IP address of the ISP router interface connecting to the customer. Then, the show ip route command was issued to verify the creation of the static route. Finally, a ping 1.1.1.1 command was issued to see whether Router R1 had connectivity to an address residing in the Internet, and the ping was successful. + +Dynamic IP Address Assignment + +Dynamic IP address assignment, which is commonly used in residential and small-business environments, allows an Internet-facing interface on a customer router to learn IP address information from an ISP’s Dynamic Host Configuration Protocol (DHCP) server. + +Interestingly, there is no need to configure a static default route (as was configured in Example 12-1), because the DHCP server informs the customer router of an IP address of the default gateway (that is, the ISP router). Therefore, the customer router needs only a single command, issued in interface configuration mode: ip address dhcp (in addition to administratively bringing up the interface, if it were shut down). + +To illustrate the configuration and verification of dynamic IP address assignment, con-sider Figure 12-2 and Example 12-2. + + + +DHCP Assignment: IP Address 10.1.1.2/30 +Default Gateway: 10.1.1.1 + + + +Fa0/1 DHCP +R1 +Fa0/0 192.168.1.1/24 + +Fa0/0 10.1.1.1/30 +ISP + + +Internet +Lo0 1.1.1.1/32 + + + + + +Figure 12-2 Topology with Dynamic IP Address Assignment + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 517 + +Example 12-2 Dynamic IP Address Configuration Key +Topic R1# conf term +R1(config)# interface fa 0/1 +R1(config-if)# ip address dhcp +R1(config-if)# end +R1# +*Jun 3 10:56:42.111: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/1 assigned DHCP address +10.1.1.2, mask 255.255.255.252, hostname R1 + +R1# show ip interface brief +Interface IP-Address OK? Method Status Protocol + +FastEthernet0/0 +FastEthernet0/1 + +192.168.1.1 +10.1.1.2 + +YES NVRAM up up +YES DHCP up up + + + +Serial1/0 +Serial1/1 +Serial1/2 +Serial1/3 +R1# show ip route + +unassigned +unassigned +unassigned +unassigned + +YES NVRAM +YES NVRAM +YES NVRAM +YES NVRAM + +administratively down down +administratively down down +administratively down down +administratively down down + +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 10.1.1.1 to network 0.0.0.0 + +S* 0.0.0.0/0 [254/0] via 10.1.1.1 +10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks +C 10.1.1.0/30 is directly connected, FastEthernet0/1 +L 10.1.1.2/32 is directly connected, FastEthernet0/1 +192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.1.0/24 is directly connected, FastEthernet0/0 +L 192.168.1.1/32 is directly connected, FastEthernet0/0 +R1# ping 1.1.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 24/30/56 ms +R1# + + + + + + + +From the Library of Alexey Evseenko +518 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +In Example 12-2, the ip address dhcp command is issued for interface Fa 0/1, which instructs the interface to obtain IP address information through DHCP. A syslog mes-sage is then displayed, stating that an IP address of 10.1.1.2, with a subnet mask of 255.255.255.252, has been assigned to Fa 0/1. + +Output from the show ip interface brief command indicates that the Fa 0/1 interface obtained an IP address of 10.1.1.2 through DHCP. The show ip route command output shows a default static route pointing to a next-hop IP address of 10.1.1.1, which was learned through DHCP. Note that the administrative distance for the route is 254. This high value makes the route a floating static route, meaning that the route will only be used if a default route is not already known to another routing process (with a lower administrative distance). Finally, the ping 1.1.1.1 output verifies that Router R1 has con-nectivity to an address on the Internet. + + +Note You can prevent a router from installing a static default route, based on the default gateway information learned from a DHCP server, by issuing the no ip dhcp client request router command in interface configuration mode. + + + +NAT + +While IP addresses are routable through the public Internet, other IP addresses (as defined by RFC 1918) are considered private and are intended for use within an organiza-tion. Network Address Translation (NAT) allows private IP addresses to be translated into Internet-routable IP addresses (that is, public IP addresses). This section examines the operation of basic NAT and a variant called Port Address Translation (PAT). Then, this section reviews a collection of NAT design considerations and a fairly recent enhance-ment to NAT configuration, called NAT Virtual Interface (NVI). + +Basic NAT + +Consider Figure 12-3, which shows a basic NAT topology. + +In the topology, two clients, with private IP addresses of 10.1.1.1 and 10.1.1.2, want to communicate with a web server on the public Internet. The server’s IP address is +203.0.113.2. Router R1 is configured for NAT. As an example, Router R1 takes packets coming from 10.1.1.1 destined for 203.0.113.2 and changes the source IP address in the packets’ headers to 198.51.100.3. When the server at IP address 203.0.113.2 receives traffic from the client, the server’s return traffic is sent to a destination address of 198.51.100.3. When Router R1 receives traffic from the outside network destined for 198.51.100.3, the router translates the destination IP address to 10.1.1.1 and forwards the traffic to the inside network where Client 1 receives the traffic. Similarly, Client 2’s IP address of 10.1.1.2 is translated into an IP address of 198.51.100.4. + +Table 12-2 introduces you to the terminology used when describing the various IP addresses involved in a translation. + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 519 + + +Client 1 10.1.1.1 + + + +Inside + +Source IP: 10.1.1.1 Destination IP: 203.0.113.2 + + + +Outside + +Source IP: 198.51.100.3 Destination IP: 203.0.113.2 + + + + +Fa0/0 10.1.1.100/24 + +Fa0/1 +198.51.100.1/28 Internet R1 + + + +NAT-Enabled Router + + +Server 203.0.113.2 + + + +Source IP: 10.1.1.2 Destination IP: 203.0.113.2 + +Source IP: 198.51.100.4 Destination IP: 203.0.113.2 + + + + +Client 2 10.1.1.2 + + +Router R1’s NAT Translation Table +Inside Local Inside Global Address Address + + + +10.1.1.1 +10.1.1.2 + +198.51.100.3 +198.51.100.4 + + +Figure 12-3 Basic NAT Topology + +Key Table 12-2 Names of NAT IP Addresses Topic NAT IP Address Definition + + +Inside local + +Inside global + +Outside local + +Outside global + +A private IP address referencing an inside device + +A public IP address referencing an inside device + +A private IP address referencing an outside device (seen when NAT is used at the destination location) +A public IP address referencing an outside device + + + +As a memory aid, remember that inside always refers to an inside device, while outside always refers to an outside device. Also, think of the word local being similar to the Spanish word loco, meaning crazy. That is what a local address could be considered. It is a crazy, made-up address (that is, a private IP address that is not routable on the Internet). Finally, let the g in global remind you of the g in good, because a global address is a good IP address (that is, routable on the Internet). + +Based on these definitions, Table 12-3 categorizes the IP addresses previously shown in Figure 12-3. + + + + + + + +From the Library of Alexey Evseenko +520 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 12-3 Classifying the NAT IP Addresses Shown in Figure 12-3 + + +NAT IP Address +Inside local + +Inside local + +Inside global + +Inside global + +Outside local + +Outside global + +NAT IP Address Type +10.1.1.1 + +10.1.1.2 + +198.51.100.3 + +198.51.100.4 + +N/A (There is no outside device using private IP addressing.) + +203.0.113.2 + + + +Whether an inside local address is randomly assigned an inside global address from a pool of available addresses or is assigned an address from a static configuration deter-mines the type of NAT you are using. These two approaches to NAT are called Dynamic NAT (DNAT) and Static NAT (SNAT): + +■ DNAT: Dynamic NAT occurs when inside local addresses are automatically assigned an inside global address from a pool of available addresses. + +■ SNAT: Sometimes you might want to statically configure the inside global address assigned to a specific device inside your network. For example, you might have an email server inside your company, and you want other email servers on the Internet to send email messages to your server. Those email servers on the Internet need to point to a specific IP address, not one that was randomly picked from a pool of available IP addresses. In such a case, you could statically configure the mapping of an inside local address (that is, the IP address of your internal email server) to an inside global address (that is, the IP address to which email servers on the Internet +will send email for your company). This approach to NAT is referred to as static NAT (SNAT). + + +Dynamic NAT Configuration and Verification + +You can configure dynamic NAT (where inside local addresses are translated into an inside global address by dynamically being assigned an address from a pool of available addresses) with the following steps: + +Step 1. Key +Topic + + + +Step 2. + + +Create an access control list (ACL) to match the inside local addresses to be translated. While you could use either a named or numbered ACL and either a standard or an extended ACL, the command to create a standard numbered ACL (in global configuration mode) is access-list {1 – 99} permit network_ address wildcard_mask. + +Define a NAT pool containing the available inside global addresses by issuing the ip nat pool pool_name starting_ip ending_ip netmask subnet_mask +command in global configuration mode. + + + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 521 + +Step 3. Specify that an interface is an inside interface with the ip nat inside command (in interface configuration mode). + +Step 4. Specify that an interface is an outside interface, with the ip nat outside com-mand (in interface configuration mode). + +Step 5. Associate the ACL (identifying the inside local addresses) with the NAT pool (identifying the inside global addresses) using the ip nat inside source list acl pool nat_pool command (in global configuration mode). + +Example 12-3, based on the topology illustrated in Figure 12-4, shows a dynamic NAT configuration example. + +Client 1 10.1.1.1 + + + + + + +Fa0/0 10.1.1.100/24 + +Fa0/1 +198.51.100.1/28 Internet R1 + + + +NAT-Enabled Router + + +Server 203.0.113.2 + + + + + + +Client 2 10.1.1.2 + +Figure 12-4 NAT Topology + +Example 12-3 Dynamic NAT Configuration + +R1# show run +... OUTPUT OMITTED ... +interface FastEthernet0/0 +ip address 10.1.1.100 255.255.255.0 +ip nat inside +! +interface FastEthernet0/1 +ip address 198.51.100.1 255.255.255.240 +ip nat outside +... OUTPUT OMITTED ... +ip nat pool ISP-POOL 198.51.100.3 198.51.100.14 netmask 255.255.255.240 +ip nat inside source list 1 pool ISP-POOL +! + + + + + +From the Library of Alexey Evseenko +522 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +access-list 1 permit 10.1.1.0 0.0.0.255 + +R1# show ip nat translations + +Pro Inside global +icmp 198.51.100.3:6 +--- 198.51.100.3 +icmp 198.51.100.4 :1 +--- 198.51.100.4 + +Inside local +10.1.1.1 :6 +10.1.1.1 +10.1.1.2 :1 +10.1.1.2 + +Outside local +203.0.113.2:6 +--- +203.0.113.2:1 +--- + +Outside global +203.0.113.2:6 +--- +203.0.113.2:1 +--- + + +In Example 12-3, the Fa 0/0 interface is designated as an inside interface with the ip nat inside command. Similarly, the Fa 0/1 interface is designated as an outside interface with the ip nat outside command. + +The inside local addresses are identified with the access-list 1 permit 10.1.1.0 0.0.0.255 command, and a NAT pool containing a range of inside global addresses is specified with the ip nat pool ISP-POOL 198.51.100.3 198.51.100.14 netmask 255.255.255.240 command. The ACL specifying the inside local addresses and the NAT pool specifying the inside global addresses are then associated with one another using the ip nat inside source list 1 pool ISP-POOL command. + +Output from the show ip nat translations command verifies that Router R1 is indeed per-forming NAT translations. The output also shows the sessions that Client 1 and Client 2 have with the Server, and the corresponding IP addresses being used. + + +Note In Example 12-3, the Outside local column contains the server’s IP address of 203.0.113.2, which is the same IP address shown in the Outside global column. The reason these IP addresses are the same is that NAT is not being performed at the server’s location. Because there is no private IP address representing the server, you can ignore the Outside local column for this topology (and in most NAT topologies). + + + +Static NAT Configuration and Verification + +Unlike a dynamic NAT configuration, a static NAT configuration requires no ACL or NAT pool. Instead, a series of ip nat inside source static inside_local_address inside_global_ address commands can be issued (in global configuration mode) to instruct NAT how to perform its translations. The steps to perform a static NAT configuration are as follows: + +Step 1. +Key Topic + +Step 2. + + +Step 3. + + +Create one or more inside local address to inside global address mappings with the ip nat inside source static inside_local_address inside_global_ address command in global configuration mode. + +Specify that an interface is an inside interface with the ip nat inside command (in interface configuration mode). + +Specify that an interface is an outside interface with the ip nat outside com- +mand (in interface configuration mode). + + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 523 + +Example 12-4 shows a static NAT configuration performed on Router R1 from the topol-ogy in Figure 12-4. + +Example 12-4 Static NAT Configuration + +R1# show run +... OUTPUT OMITTED ... +interface FastEthernet0/0 +ip address 10.1.1.100 255.255.255.0 +ip nat inside +! +interface FastEthernet0/1 +ip address 198.51.100.1 255.255.255.240 +ip nat outside +... OUTPUT OMITTED ... +ip nat inside source static 10.1.1.1 198.51.100.3 +ip nat inside source static 10.1.1.2 198.51.100.4 + +R1# show ip nat translations + +Pro Inside global +--- 198.51.100.3 +--- 198.51.100.4 + +Inside local +10.1.1.1 +10.1.1.2 + +Outside local +--- +--- + +Outside global +--- +--- + + +As you saw in Example 12-3, in Example 12-4, the Fa 0/0 interface is designated as an inside interface with the ip nat inside command. Also, the Fa 0/1 interface is designated as an outside interface with the ip nat outside command. + +The ip nat inside source static 10.1.1.1 198.51.100.3 command instructs the router to translate an inside local address of 10.1.1.1 into an inside global address of 198.51.100.3. Similarly, the ip nat inside source static 10.1.1.2 198.51.100.4 command instructs the router to translate an inside local address of 10.1.1.2 into an inside global address of 198.51.100.4. + +Also, notice that the output of the show ip nat translations command only shows the inside local and inside global addresses specified in the static assignments. There is no dynamic session information to show information about active sessions (such as an out-side global address). + +PAT + +A challenge with basic NAT, however, is that there is a one-to-one mapping of inside local addresses to inside global addresses, meaning that a company would need as many pub-licly routable IP addresses as it had internal devices needing IP addresses. This does not scale well, because a service provider will often only provide a customer with a single IP address or a small block of IP addresses. + +Fortunately, Cisco routers support Port Address Translation (PAT), which allows mul-tiple inside local addresses to share a single inside global address (that is, a single publicly + + + + +From the Library of Alexey Evseenko +524 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +routable IP address). Recall that when a client sends an IP packet, not only does that packet have a source and a destination IP address, but it also has a source and destination port number. PAT leverages these port numbers to keep track of separate communication flows. + +As an example, consider Figure 12-5. Unlike the example shown in Figure 12-3, in which each inside local address was translated to its own inside global address, the example shown in Figure 12-5 only has one inside global address (198.51.100.1). This single inside global address is shared among all the devices inside a network. The different communi-cation flows are kept separate in Router R1’s NAT translation table by considering port numbers. + + +Client 1 10.1.1.1 + + + +Inside + +Source IP/Port: 10.1.1.1:19759 Destination IP/Port: 203.0.113.2:80 + + + +Fa0/0 10.1.1.100/24 + + + +Outside + +Source IP/Port: 198.51.100.1:4096 Destination IP/Port: 203.0.113.2:80 + + + +Fa0/1 198.51.100.1/28 +R1 + + + +NAT-Enabled Router + + +Server 203.0.113.2 + + + +Source IP/Port: 10.1.1.2:16633 Destination IP/Port: 203.0.113.2:80 + +Source IP/Port: 198.51.100.1:4097 Destination IP/Port: 203.0.113.2:80 + + + + +Client 2 +10.1.1.2 Router R1’s NAT Translation Table + +Inside Local Address/Port +10.1.1.1:19759 +10.1.1.2:16633 + +Inside Global Address/Port +198.51.100.1:4096 +198.51.100.1:4097 + + +Figure 12-5 PAT Topology + +When Client 1 (with an IP address of 10.1.1.1) sends a packet to the web server (with an IP address of 203.0.113.2), the client’s ephemeral port number (that is, its source port, +which is greater than 1023) is 19759. Router R1 notes that port number, and translates the inside local address of 10.1.1.1 with a port number of 19759 to an inside global address of 198.51.100.1 with a port number of 4096. + +When Client 2 sends a packet to the same web server, its inside local address of 10.1.1.2 with a port number of 16633 is translated into an outside local address of 198.51.100.1 with a port number of 4097. + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 525 + +Notice that both Client 1 and Client 2 had their inside local addresses translated into the same inside global address of 198.51.100.1. Therefore, when the web server is sending packets back to Client 1 and Client 2, those packets are destined for the same IP address (that is, 198.51.100.1). However, when Router R1 receives those packets, it knows to which client each packet should be forwarded, based on the destination port number. For example, if a packet from the web server (203.0.113.2) arrived at Router R1 with a destina-tion IP address of 198.51.100.1 and a destination port number of 4097, Router R1 would translate the destination IP address to 10.1.1.2 with a port number of 16633, and they forward the packet off to Client 2. The steps to configure PAT are as follows: + +Step 1. Key +Topic + + + +Step 2. + + +Step 3. + + +Step 4. + + +Create an access control list (ACL) to match the inside local addresses to be translated. While you could use either a named or numbered ACL and either a standard or an extended ACL, the command to create a standard numbered ACL (in global configuration mode) is access-list {1 - 99} permit network_ address wildcard_mask. + +Specify that an interface is an inside interface with the ip nat inside command (in interface configuration mode). + +Specify that an interface is an outside interface with the ip nat outside com-mand (in interface configuration mode). + +Associate the ACL (identifying the inside local addresses) with the router’s outside interface, and enable overloading with the ip nat inside source list acl interface outside_interface overload command (in global configuration +mode). + + +Example 12-5 shows a sample PAT configuration, based on the topology shown in Fig-ure 12-5. + +Example 12-5 PAT Configuration + +R1# show run +... OUTPUT OMITTED ... +interface FastEthernet0/0 +ip address 10.1.1.100 255.255.255.0 +ip nat inside +! +interface FastEthernet0/1 +ip address 198.51.100.1 255.255.255.240 +ip nat outside +... OUTPUT OMITTED ... +ip nat inside source list 1 interface FastEthernet0/1 overload +! +access-list 1 permit 10.1.1.0 0.0.0.255 + +R1# show ip nat translations + +Pro Inside global +tcp 198.51.100.1:4096 +tcp 198.51.100.1:4097 + +Inside local +10.1.1.1:19759 +10.1.1.2:16633 + +Outside local +203.0.113.2:80 +203.0.113.2:80 + +Outside global +203.0.113.2:80 +203.0.113.2:80 + + + + + +From the Library of Alexey Evseenko +526 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +As in Examples 12-3 and 12-4, in Example 12-5, the Fa 0/0 interface is designated as an inside interface with the ip nat inside command. Also, the Fa 0/1 interface is designated as an outside interface with the ip nat outside command. + +The access-list 1 permit 10.1.1.0 0.0.0.255 command is used to identify inside local addresses. Then, the ip nat inside source list 1 interface FastEthernet0/1 overload com-mand is used to associate the ACL defining the inside local addresses with the IP address of the Fa 0/1 interface. The overload parameter given in the command enables the PAT feature, allowing multiple inside local addresses to share an inside global address (specifi-cally, the IP address of the Fa 0/1 interface). + +Output from the show ip nat translations command shows that the same inside global address (the IP address of the Fa 0/1 interface) is being used by both Client 1 (10.1.1.1) and Client 2 (10.1.1.2). However, PAT is able to distinguish between these clients, because they have unique port numbers (4096 for Client 1 and 4097 for Client 2). + +NAT Design Considerations + +While NAT has done much to extend the life of IPv4, it does have limitations you should consider in your design. Consider the following: + +■ Applications requiring end-to-end connectivity, where source and destination IP addresses are not modified at any point on the data path, could fail because of NAT’s modification of source and destination IP addresses. + +■ NAT might have compatibility issues with IPsec, because IPsec performs message integrity checks, which could fail because of NAT’s manipulation of header contents. + +■ In a Public Key Infrastructure (PKI) environment, digital certificates can be used for authentication and encryption. However, the digital signature on a digital certificate could be incorrect, based on a device’s IP being changed by NAT. + + +NVI + +Cisco IOS Release 12.3(14)T introduced a feature called NAT Virtual Interface (NVI), which allows you to do a NAT configuration without the need to specify an interface as being an inside or an outside interface. Specifically, instead of issuing the ip nat inside or ip nat outside command in interface configuration mode, you can issue the ip nat enable command. Not only does this feature make configuration easier, but it also allows traffic to flow between two interfaces that would both be considered inside interfaces, from a classic NAT perspective. + + +Note Not all platforms and Cisco IOS versions since Cisco IOS Release 12.3(14)T sup-port the NAT Virtual Interface feature. Therefore, the ip nat enable command might not be accepted on your device, even though you are running Cisco IOS Release 12.3(14)T or later. + + + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 527 + +This feature is made possible by performing an additional routing operation. To better understand this change, consider how classic NAT operated. It would make a routing decision prior to performing the address translation. However, an NVI makes an initial routing decision, then performs address translation, and finally performs another routing decision (based on the translated addresses). + +Example 12-6 illustrates an NVI configuration, based on the Figure 12-4 topology. + +Example 12-6 NVI Configuration Key +Topic R1# show run +... OUTPUT OMITTED ... +interface FastEthernet0/0 +ip address 10.1.1.100 255.255.255.0 +ip nat enable +! +interface FastEthernet0/1 +ip address 198.51.100.1 255.255.255.240 +ip nat enable +... OUTPUT OMITTED ... +ip nat inside source list 1 interface FastEthernet0/1 overload +! +access-list 1 permit 10.1.1.0 0.0.0.255 + +The only difference in the NVI configuration shown in Example 12-6 and the PAT con-figuration shown in Example 12-5 is the use of the ip nat enable command (in global configuration mode), as opposed to either the ip nat inside or ip nat outside command. + + +Note The NAT Virtual Interface feature can be used with a Dynamic NAT configuration or a PAT configuration, but it is not supported with a Static NAT configuration. + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +528 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 12-4 lists several design goals related to this chapter. If these design goals were list-ed in a design document, and you had to take that document and develop an implemen-tation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 12-4 Design Review + + +Design Goal + +The design specifies that a router interface connecting to an ISP be assigned an IP address determined by the ISP. (2) +The design specifies that private IP addresses be assigned to devices inside an office and that those private IP addresses be translated into publicly routable IP addresses, available from a pool of addresses provided by an ISP. (2) +The design specifies that private IP addresses be assigned to devices inside an office and that those private IP addresses be translated into a single publicly routable IP address provided by an ISP. + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 12-5 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 529 + +Table 12-5 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +The plan requires that a remote site’s Internet-facing router automatically be configured with a default static route pointing to the ISP’s router. What addressing approach would support that requirement? +NAT has a variety of descriptions for different types of IP addresses. What term is used to describe the private IP addresses assigned to devices inside a network? +A network using NAT is configured with multiple inside interfaces. However, the plan requires that NAT be performed on traffic being routed between inside NAT interfaces. What NAT feature would make this possible? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 12-6 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 12-6 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Assign an IP address to a router interface connecting to an ISP (in interface configuration mode). +Configure a default route pointing to an ISP (in global configuration mode). +Instruct an Ethernet router interface to obtain its IP address through DHCP (in interface configuration mode). +Instruct a router not to install a default static route based on default gateway information learned through DHCP. +Create one or more inside local address to inside global address mappings (in global configuration mode). + + + + + + +From the Library of Alexey Evseenko +530 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Feature Configuration Commands/Notes +Designate an interface as an inside NAT interface (in interface configuration mode). +Designate an interface as an outside NAT interface (in interface configuration mode). +Create an ACL to match inside local addresses to be translated through NAT (in global configuration mode). +Define a NAT pool containing a collection of inside global addresses (in global configuration mode). +Associate an ACL identifying NAT inside local addresses with a NAT pool identifying NAT inside global addresses (in global configuration mode). +Associate an ACL identifying NAT inside local addresses with a router’s outside interface, and enable overloading (in global configuration mode). +Configure an interface to use the NAT Virtual Interface (NVI) feature (in interface configuration mode). + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table +12-7 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 12-7 Verification Plan Memory Drill + +Information Needed Command(s) +List a router’s interfaces and their IP addresses, along with an indication of whether the IP address assigned to an interface was assigned through DHCP. +Display active NAT translations. + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 12: Fundamentals of Internet Connectivity 531 + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 12-8 lists a reference of these key topics and the page numbers on which each is found. + +Table 12-8 Key Topics for Chapter 12 +Key +Topic Key Topic Element Description Page Number + + +List + +Example 12-2 + +Table 12-2 + +List + +List + +List + +Example 12-6 + +Steps to configure static IP addresses 514 + +Dynamic IP Address Configuration 517 + +Names of NAT IP Addresses 519 + +Steps to configure dynamic NAT 520 + +Steps to configure static NAT 522 + +Steps to configure PAT 525 + +NVI Configuration 527 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +NAT, DNAT, SNAT, PAT, NVI + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ The Basics of Internet Routing and Addressing: This section reviews the use of public and private +IP addresses in the Internet, both in theory and practice. +■ Introduction to BGP: This section introduces sev-eral basic concepts about BGP, including the concept of autonomous system numbers (ASN), path attri-butes (PA), and both internal and external BGP. +■ Outbound Routing Toward the Internet: This section examines the options and tradeoffs for how to influence outbound routes from an enterprise toward the Internet. +■ External BGP for Enterprises: This section exam-ines the required configuration for external BGP connections, plus a few optional but commonly used configuration settings. It also examines the com-mands used to verify that eBGP works. +■ Verifying the BGP Table: This section discusses the contents of the BGP table, particularly the routes learned using eBGP connections. +■ Injecting Routes into BGP for Advertisement to the ISPs: This section shows how you can config-ure an eBGP router to advertise the public IP address range used by an enterprise. + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 13 + + + + + + +Fundamental BGP Concepts + + +Enterprises almost always use some interior gateway protocol (IGP). Sure, enterprises could instead choose to exclusively use static routes throughout their internetworks, but they typically do not. Using an IGP requires much less planning, configuration, and ongo-ing effort compared to using static routes. Routing protocols take advantage of new links without requiring more static route configuration, and the routing protocols avoid the misconfiguration issues likely to occur when using a large number of static routes. + +Similarly, when connecting to the Internet, enterprises can use either static routes or a routing protocol; namely, Border Gateway Protocol (BGP). However, the decision to use BGP instead of static routes does not usually follow the same logic that leads engineers to almost always use an IGP inside the enterprise. BGP might not be necessary or even useful in some cases. To quote Jeff Doyle, author of two of the most respected books +on the subject of IP routing, “Not as many internetworks need BGP as you might think” (from his book Routing TCP/IP, Volume II). + +This chapter examines the facts, rules, design options, and some perspectives on Internet connectivity for enterprises. Along the way, the text examines when static routes might work fine, how BGP might be useful in some cases, and the cases for which BGP can be of the most use. + +The chapter then discusses the configuration and verification of BGP for basic opera-tion, but with no overt attempt to influence BGP’s choice of best paths. Chapter 14, “Advanced BGP Concepts,” discusses the need for internal BGP (iBGP), along with BGP route filtering. Chapter 14 also examines the tools by which BGP can be made to choose different routes, and some basic configuration to manipulate the choices of best route. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than two of these 15 self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 13-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + + + + + + + +From the Library of Alexey Evseenko +534 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 13-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +The Basics of Internet Routing and Addressing + +Introduction to BGP + +Outbound Routing Toward the Internet + +External BGP for Enterprises + +Verifying the BGP Table + +Injecting Routes into BGP for Advertisement to the ISPs + +Questions +1, 2 + +3–5 + +6, 7 + +8–11 + +12–14 + +15 + + + +1. Which of the following are considered private IPv4 addresses? (Choose two.) + +a. 192.16.1.1 + +b. 172.30.1.1 + +c. 225.0.0.1 + +d. 127.0.0.1 + +e. 10.1.1.1 + +2. Class C network 200.1.1.0/24 was allocated to an ISP that operated primarily in Asia. That ISP then assigned this entire Class C network to one of its Asian customers. Network 200.1.2.0/24 has yet to be assigned to any ISP. Which of the following is most likely to be true? +a. 200.1.2.0/24 could be assigned to any registrar or ISP in the world. + +b. 200.1.2.0/24 will be assigned in the same geography (Asia) as 200.1.1.0/24. + +c. 200.1.2.0/24 cannot be assigned as public address space. + +d. Routers inside North American ISPs increase their routing table size by 1 as a result of the customer with 200.1.1.0/24 connecting to the Internet. + +3. Router R1, in ASN 11, learns a BGP route from BGP peer R22 in ASN 22. R1 and then uses BGP to advertise the route to R2, also in ASN 11. What ASNs would you see in the BGP table on R2 for this route? +a. 22 + +b. 11 + +c. 1 + +d. None + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 535 + +4. Which of the following are most likely to be used as an ASN by a company that has a registered public 16-bit ASN? (Choose two.) + +a. 1 + +b. 65,000 + +c. 64,000 + +d. 64,550 + +5. Which of the following statements is true about a router’s eBGP peers that is not also true about that same router’s iBGP peers? + +a. The eBGP peer neighborship uses TCP. + +b. The eBGP peer uses port 180 (default). + +c. The eBGP peer uses the same ASN as the local router. + +d. The eBGP peer updates its AS_PATH PA before sending updates to this router. + +6. Which of the following is the primary motivation for using BGP between an enter-prise and its ISPs? + +a. To influence the choice of best path (best route) for at least some routes + +b. To avoid having to configure static routes + +c. To allow redistribution of BGP routes into the IGP routing protocol + +d. To monitor the size of the Internet BGP table + +7. The following terms describe various design options for enterprise connectivity to the Internet. Which of the following imply that the enterprise connects to two or more ISPs? (Choose two.) +a. Single-homed + +b. Dual-homed + +c. Single-multihomed + +d. Dual-multihomed + +8. Enterprise Router R1, in ASN 1, connects to ISP Router I1, ASN 2, using eBGP. The single serial link between the two routers uses IP addresses 10.1.1.1 and 10.1.1.2, respectively. Both routers use their S0/0 interfaces for this link. Which of the follow-ing commands would be needed on R1 to configure eBGP? (Choose two.) +a. router bgp 2 + +b. router bgp 1 + +c. neighbor 10.1.1.2 remote-as 2 + +d. neighbor 10.1.1.2 update-source 10.1.1.1 + +e. neighbor 10.1.1.2 update-source S0/0 + + + + +From the Library of Alexey Evseenko +536 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +9. Enterprise Router R1, in ASN 1, connects to ISP Router I1, ASN 2, using eBGP. There are two parallel serial links between the two routers. The implementation plan calls for each router to base its BGP TCP connection on its respective loopback1 inter-faces, with IP addresses 1.1.1.1 and 2.2.2.2, respectively. Which of the following com-mands would not be part of a working eBGP configuration on Router R1? +a. router bgp 1 + +b. neighbor 2.2.2.2 remote-as 2 + +c. neighbor 2.2.2.2 update-source loopback1 + +d. neighbor 2.2.2.2 multihop 2 + +10. The following output, taken from a show ip bgp summary command on Router R1, lists two neighbors. In what BGP neighbor state is neighbor 1.1.1.1? + +... +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +1.1.1.1 4 1 60 61 +2.2.2.2 4 3 153 159 + +26 0 0 00:45:01 0 +26 0 0 00:38:13 1 + + +a. Idle + +b. Opensent + +c. Active + +d. Established + +11. The following output was taken from the show ip bgp summary command on Router R2. In this case, which of the following commands are most likely to already be configured on R2? (Choose two.) + +... +BGP router identifier 11.11.11.11, local AS number 11 +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +1.1.1.1 4 1 87 87 0 0 0 00:00:06 Idle (Admin) +2.2.2.2 4 3 173 183 41 0 0 00:58:47 2 + +a. router bgp 11 + +b. neighbor 1.1.1.1 remote-as 11 + +c. neighbor 2.2.2.2 prefix-limit 1 + +d. neighbor 1.1.1.1 shutdown + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 537 + +12. Which of the following answers is most true about the BGP Update message? + +a. It lists a set of path attributes, along with a list of prefixes that use those PAs. + +b. It lists a prefix/length, plus the PA settings for that prefix. + +c. It lists withdrawn routes, but never in the same Update message as newly adver-tised routes. + +d. A single Update message lists at most a single prefix/length. + +13. The following output occurs on Router R1. Which of the following cannot be deter-mined from this output? + +R1# show ip route 180.1.1.0 255.255.255.240 +Routing entry for 180.1.1.0/28 +Known via "bgp 2", distance 20, metric 0 +Tag 3, type external +Last update from 192.168.1.2 00:10:27 ago +Routing Descriptor Blocks: +* 192.168.1.2, from 192.168.1.2, 00:10:27 ago +Route metric is 0, traffic share count is 1 +AS Hops 2 +Route tag 3 + +a. The type of BGP peer (iBGP or eBGP) that advertised this route to R1 + +b. R1’s ASN + +c. The next-hop router’s ASN + +d. The AS_PATH length + +14. The following line of output was extracted from the output of the show ip bgp com-mand on Router R1. Which of the following can be determined from this output? + +... + +Network +* 130.1.1.0/28 + +Next Hop +1.1.1.1 + +Metric LocPrf Weight Path +0 1 2 3 4 i + + +a. The route is learned from an eBGP peer. + +b. The route has no more than three ASNs in the AS_PATH. + +c. The route is the best route for this prefix. + +d. None of these facts can be positively determined by this output. + + + + + + + + + + +From the Library of Alexey Evseenko +538 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +15. Router R1 has eBGP connections to I1 and I2, routers at the same ISP. The company that owns R1 can use public address range 130.1.16.0/20. The following output +lists all the IP routes in R1’s routing table within this range. Which of the following answers would cause R1 to advertise the 130.1.16.0/20 prefix to its eBGP peers? (You should assume default settings for any parameters not mentioned in this question.) + +R1# show ip route 130.1.16.0 255.255.240.0 longer-prefixes +... +O 130.1.16.0/24 [110/3] via 10.5.1.1, 00:14:36, FastEthernet0/1 +O 130.1.17.0/24 [110/3] via 10.5.1.1, 00:14:36, FastEthernet0/1 +O 130.1.18.0/24 [110/3] via 10.5.1.1, 00:14:36, FastEthernet0/1 + +a. Configure R1 with the network 130.1.16.0 mask 255.255.240.0 command. + +b. Configure R1 with the network 130.1.16.0 mask 255.255.240.0 summary-only command. + +c. Redistribute from OSPF into BGP, filtering so that only routes in the 130.1.16.0/20 range are redistributed. + +d. Redistribute from OSPF into BGP, filtering so that only routes in the 130.1.16.0/20 range are redistributed, and create a BGP summary for 130.1.16.0/20. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 539 + +Foundation Topics + + +The Basics of Internet Routing and Addressing + +The original design for the Internet called for the assignment of globally unique IPv4 addresses for all hosts connected to the Internet. The idea is much like the global tele-phone network, with a unique phone number, worldwide, for all phone lines, cell phones, and so on. + +To achieve this goal, the design called for all organizations to register and be assigned one or more public IP networks (Class A, B, or C). Then, inside that organization, each address would be assigned to a single host. By using only the addresses in their assigned network number, each company’s IP addresses would not overlap with other companies. As a result, all hosts in the world would have globally unique IP addresses. + +The assignment of a single classful network to each organization actually helped keep Internet routers’ routing tables small. The Internet routers could ignore all subnets used inside each company, and instead just have a route for each classful network. For example, if a company registered and was assigned Class B network 128.107.0.0/16, and had 500 subnets, the Internet routers just needed one route for that entire Class B network. + +Over time, the Internet grew tremendously. It became clear by the early 1990s that some-thing had to be done, or the growth of the Internet would grind to a halt. At the then-current rate of assigning new networks, all public IP networks would soon be assigned and growth would be stifled. Additionally, even with routers ignoring the specific sub-nets, the routing tables in Internet routers were becoming too large for the router technol-ogy of that day. (For perspective, more than 2 million public Class C networks exist, and 2 million IP routes in a single IP routing table would be considered quite large—maybe even too large—for core routers in the Internet even today.) + +To deal with these issues, the Internet community worked together to come up with both some short-term and long-term solutions to two problems: the shortage of public address-es and the size of the routing tables. The short-term solutions to these problems included + +■ Reduce the number of wasted public IP addresses by using classless IP addressing when assigning prefixes, assigning prefixes/lengths instead of being restricted to assigning only Class A, B, and C network numbers. + +■ Reduce the need for public IP addresses by using Port Address Translation (PAT, also called NAT overload) to multiplex more than 65,000 concurrent flows using a single public IPv4 address. + +■ Reduce the size of IP routing tables by making good choices for how address blocks are allocated to ISPs and end users, allowing for route summarization on a global scale. + +This section examines some of the details related to these three points, but this informa-tion is not an end to itself for the purposes of this book. The true goal is to understand + + + + +From the Library of Alexey Evseenko +540 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +outbound routing (from the enterprise to the Internet), and the reasons why you might or might not need to use a dynamic routing protocol, such as Border Gateway Protocol (BGP), between the enterprise and the Internet. + +Public IP Address Assignment + +The Internet Corporation for Assigned Names and Numbers (ICANN, www.icann.org) owns the processes by which public IPv4 (and IPv6) addresses are allocated and assigned. A related organization, the Internet Assigned Numbers Authority (IANA, www.iana.org) carries out many of ICANN’s policies. These organizations define which IPv4 addresses can be allocated to different geographic regions, in addition to managing the development of the Domain Name System (DNS) naming structure and new Top Level Domains (TLD), such as domains ending in .com. + +ICANN works with several other groups to administer a public IPv4 address assignment strategy that can be roughly summarized as follows: +Step 1. ICANN and IANA group public IPv4 addresses by major geographic region. + +Step 2. IANA allocates those address ranges to Regional Internet Registries (RIR). + +Step 3. Each RIR further subdivides the address space by allocating public address ranges to National Internet Registries (NIR) or Local Internet Registries (LIR). (ISPs are typically LIRs.) +Step 4. Each type of Internet Registry (IR) can assign a further subdivided range of addresses to the end-user organization to use. + +Figure 13-1 shows an example that follows the same preceding four-step sequence. In this example, a company in North America needs a subnet with six hosts, so the ISP assigns a /29 prefix (198.133.219.16/29). Before that happens, however, the process gave this com-pany’s ISP (NA-ISP1, an ISP in North America) the right to assign that particular prefix. + +The process starts with ICANN and IANA. These organizations maintain a set of current-ly unallocated public IPv4 addresses. (See www.iana.org/numbers, and look for the IPv4 addresses link to see the current list.) When the American Registry for Internet Numbers (ARIN), the RIR for North America, notices that it is running out of IPv4 address space, ARIN requests a new public address block. IANA examines the request, finds a currently unallocated public address block (Step 1 in the figure), and allocates the block to ARIN (Step 2 in the figure). + +Next, an ISP named NA-ISP1 (shorthand for North American ISP number 1) asks ARIN for a prefix assignment for a /16-sized address block. After ARIN ensures that NA-ISP1 meets some requirements, ARIN assigns a prefix of 198.133.0.0/16 (Step 3 in the figure). Then, when Company1 becomes a customer of NA-ISP1, NA-ISP1 can assign a prefix to Company 1 (198.133.219.16/29 in this example, Step 4). + +Although the figure shows the process, the big savings for public addresses occur because the user of the IP addresses can be assigned a group much smaller than a single Class C network. In some cases, companies only need one public IP address; in other cases, they might need only a few, as with Company1 in Figure 13-1. This practice allows IRs to assign the right-sized address block to each customer, reducing waste. + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 541 + + +Key Topic + +Company 1 Owns 198.133.219.16/29 + +R1 R2 + + + +4 +Assigns 198.133.219.16/29 + + +Company 1 + + + + +NA-ISP1 Owns 198.133.0.0/16 +3 Allocates +198.133.0.0/16 + +ISP-1 + + +NA-ISP1 + +ISP-2 ISP-3 + + + + +1 + +ARIN needs a new /8 block. 198.0.0.0/8 is not yet allocated, so give it to ARIN. + + + + +ARIN (RIR) Owns 198.0.0.0.0/8 + +2 +Allocates 198.0.0.0/8 IANA + + + +Figure 13-1 Conceptual View of Public IPv4 Address Assignment + +Note On January 31, 2011, ICANN gave out its last two blocks of IPv4 addresses meant for general usage. This left only five blocks of usable addresses. ICANN’s “Global Policy for the Allocation of the Remaining IPv4 Address Space” policy dictates how those remain-ing blocks (one for each Regional Internet Registry) will be given out as we approach the exhaustion of IPv4 addresses. + + + +Internet Route Aggregation + +Although the capability to assign small blocks of addresses helped extend the IPv4 public address space, this practice also introduced many more public subnets into the Internet, driving up the number of routes in Internet routing tables. At the same time, the number of hosts connected to the Internet, back in the 1990s, was increasing at a +double-digit rate per month. Internet core routers could not have kept up with the rate of increase in the size of the IP routing tables. + +The solution was, and still is today, to allocate numerically consecutive addresses— addresses that can be combined into a single route prefix/length—by geography and by ISP. These allocations significantly aid route summarization. + +For example, continuing the same example shown in Figure 13-1, Figure 13-2 shows some of the routes that can be used in ISPs around the globe based on the address assignment shown in Figure 13-1. + + + + + +From the Library of Alexey Evseenko +542 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Company 1 + + +R1 R2 198.133.219.16/29 + + + + +NA-ISP2 + + +1 Route for 198.133.0.0/16 + +ISP-1 + +1 Route for 198.133.219.16/29 +1 Route for 198.0.0.0/8 + +ISP-2 ISP-3 +NA-ISP1 +Europe + +1 Route for 198.0.0.0/8 +South America + + +Figure 13-2 IPv4 Global Route Aggregation Concepts + +First, focus on the routers shown in Europe and South America. Routers outside North America can use a route for prefix 198.0.0.0/8, knowing that IANA assigned this prefix to be used only by ARIN, which manages IP addresses in North America. The underly-ing logic is that if the routers outside North America can forward a packet into North America, the North American routers will have more specific routes. The single route for 198.0.0.0/8 shown in Europe and South America can be used instead of literally millions of subnets deployed to companies in North America, such as Company1. + +Next, consider routers in North America, specifically those outside the NA-ISP1 net-work. Figure 13-2 shows one such ISP, named NA-ISP2 (North American ISP number 2), on the left. This router can learn one route for 198.133.0.0/16, the portion of the 198.0.0.0/8 block assigned to NA-ISP1 by IANA. Routers in NA-ISP2 can forward all packets for destinations inside this prefix to NA-ISP1, rather than needing a route for all small address blocks assigned to individual enterprises such as Company1. This signifi-cantly reduces the number of routes required on NA-ISP2 routers. + +Finally, inside NA-ISP1, its routers need to know to which NA-ISP1 router to forward packets for that particular customer. So, the routes listed on NA-ISP1’s routers lists a pre-fix of 198.133.219.16/29. As a result, packets are forwarded toward Router ISP-1 (located inside ISP NA-ISP1), and finally into Company 1. + +The result of the summarization inside the Internet allows Internet core routers to have a much smaller routing table—on the order of a few hundred thousand routes instead of a few tens of millions of routes. For perspective, the website www.potaroo.net, a website maintained by Geoff Huston, who has tracked Internet growth for many years, lists a statis-tic showing approximately 480,000 BGP routes in Internet routers back in February 2014. + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 543 + +The Impact of NAT/PAT + +Although classless public IP address assignment does help extend the life of the IPv4 address space, NAT probably has a bigger positive impact, because it enables an enter-prise to use such a small number of public addresses. NAT allows an enterprise to use pri-vate IP addresses for each host, plus a small number of public addresses. As packets pass through a device performing NAT—often a firewall, but it could be a router—the NAT function translates the IP address from the private address (called an inside local address by NAT) into a public address (called an inside global address). + + +Note For the purposes of this book, the terms NAT, PAT, and NAT overload are used synonymously. There is no need to distinguish between static NAT, dynamic NAT without overload, and dynamic NAT with overload (also called PAT). + + +NAT reduces the need for public IPv4 addresses to only a few addresses per enterprise because of how NAT can multiplex flows using different TCP or UDP port numbers. Figure 13-3 shows a sample that focuses on a router performing NAT. The figure shows an enterprise network on the left, with the enterprise using private Class A network 10.0.0.0/8. The Internet sits on the right, with the NAT router using public IP address 200.1.1.2. + + +Enterprise Private Network 10.0.0.0 + +Internet Public Addresses + + + +10.1.1.1 + + +10.1.1.2 + + +10.1.1.3 + +10.1.1.1, Port 1024 + + +10.1.1.2, Port 1024 +NAT + + +10.1.1.3, Port 1033 + +200.1.1.2, Port 1024 170.1.1.1, Port 80 + + + +200.1.1.2, Port 1025 170.1.1.1, Port 80 + + +200.1.1.2, Port 1026 170.1.1.1, Port 80 + + + +Server + + + +170.1.1.1 + + + + +Dynamic NAT Table, With Overloading + +Inside Local 10.1.1.1:1024 10.1.1.2:1024 +10.1.1.3:1033 + +Inside Global 200.1.1.2:1024 200.1.1.2:1025 +200.1.1.2:1026 + + +Figure 13-3 IPv4 Global Route Aggregation Concepts + +The figure shows how the enterprise, on the left, can support three flows with a single public IP address (200.1.1.2). The NAT feature dynamically builds its translation table, which tells the router what address/port number pairs to translate. The router reacts when + + + + +From the Library of Alexey Evseenko +544 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +a new flow occurs between two hosts, noting the source IP address and port number of the enterprise host on the left, and translating those values to use the public IP address (200.1.1.2) and an unused port number in the Internet. Note that if you collected the traf-fic using a network analyzer on the right side of the NAT router, the IP addresses would include 200.1.1.2 but not any of the network 10.0.0.0/8 addresses. Because the combina-tion of the IP address (200.1.1.2 in this case) and port number must be unique, this one IP address can support 216 different concurrent flows. + +Private IPv4 Addresses and Other Special Addresses + +When allocating the public IPv4 address space, IANA/ICANN restricts themselves in several ways. Of course, the private IP address ranges cannot be assigned to any group for use in the public Internet. Additionally, several other number ranges inside the IPv4 address space, as summarized in RFC 3330, are reserved for various reasons. Tables 13-2 and 13-3 list the private addresses and other reserved values, respectively, for your reference. + +Table 13-2 Private IP Address Reference + + +Number of Classful Networks +(1) Class A + +(16) Class B + +(256) Class C + +Range of Classful Networks + +10.0.0.0 + +172.16.0.0 through 172.31.0.0 + +192.168.0.0 through 192.168.255.0 + +Prefix for Entire Range + +10.0.0.0/8 + +172.16.0.0/12 + +192.168.0.0/16 + + + +Table 13-3 lists other reserved ranges of IPv4 addresses that IANA will not allocate in the public Internet. + +Table 13-3 Reserved Values in IPv4 Address Range (RFC 3330) + + +Value or Range +0.0.0.0/8 + +127.0.0.0/8 + +169.254.0.0/16 + +192.0.2.0/24 + +192.88.99.0/24 + +198.18.0.0/15 + +Reason +Used for self-identification on a local subnet + +Loopback testing + +This “link-local” block is used for default IPv4 address assignment when the DHCP process fails +Reserved for use in documentation and example code + +Used for IPv6-to-IPv4 relay (6to4 relay) (RFC 3068) + +Benchmark testing for Internet devices (RFC 2544) + + + +In summary, every enterprise that connects to the Internet must use at least one public IP address and often several public IP addresses. Although some companies do have a large + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 545 + +public IPv4 address block—often obtained before the shortage of public IPv4 addresses in the early to mid-1990s—most companies have a small address block, which then requires the use of NAT/PAT. These details have some impact on whether BGP is useful in a given case. + +Introduction to BGP + +Border Gateway Protocol (BGP) advertises, learns, and chooses the best paths inside the global Internet. When two ISPs connect, they typically use BGP to exchange routing +information. Collectively, the ISPs of the world exchange the Internet’s routing table using BGP. And enterprises sometimes use BGP to exchange routing information with one or more ISPs, allowing the enterprise routers to learn Internet routes. + +One key difference when comparing BGP to the usual IGP routing protocols is BGP’s robust best-path algorithm. BGP uses this algorithm to choose the best BGP path (route) using rules that extend far beyond just choosing the route with the lowest metric. This more complex best-path algorithm gives BGP the power to let engineers configure many different settings that influence BGP best-path selection, allowing great flexibility in how routers choose the best BGP routes. + +BGP Basics + +BGP, specifically BGP version 4 (BGPv4), is the one routing protocol in popular use today that was designed as an exterior gateway protocol (EGP) instead of as an interior gateway protocol (IGP). As such, some of the goals of BGP differ from those of an IGP, such as Open Shortest Path First (OSPF) or Enhanced Interior Gateway Routing Protocol (EIGRP), but some of the goals remain the same. + +First, consider the similarities between BGP and various IGPs. BGP does need to adver-tise IPv4 prefixes, just like IGPs. BGP needs to advertise some information, so that routers can choose one of many routes for a given prefix as the currently best route. As for the mechanics of the protocol, BGP does establish a neighbor relationship before exchanging topology information with a neighboring router. + +Next, consider the differences. BGP does not require neighbors to be attached to the same subnet. Instead, BGP routers use a TCP connection (port 179) between the routers to pass BGP messages, allowing neighboring routers to be on the same subnet or to be separated by several routers. (It is relatively common to see BGP neighbors who do not connect to the same subnet.) Another difference lies in how the routing protocols choose the best route. Instead of choosing the best route just by using an integer metric, BGP uses a more complex process, using a variety of information, called BGP path attributes (PAs), which are exchanged in BGP routing updates much like IGP metric information. + +Table 13-4 summarizes some of these key comparison points. + + + + + + + + +From the Library of Alexey Evseenko +546 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 13-4 Comparing OSPF and EIGRP Logic to BGP Key +Topic OSPF/EIGRP BGP + + +Forms neighbor relationship before sending routing information +Neighbors typically discovered using multicast packets on the connected subnets +Does not use TCP + +Advertises prefix/length + +Advertises metric information + + +Emphasis on fast convergence to the truly most efficient route +Link-state (OSPF) or distance-vector (EIGRP) logic + +Same + +Neighbor IP address is explicitly configured and may not be on common subnet +Uses a TCP connection between neighbors (port 179) + +Advertises prefix/length, called Network Layer Reachability Information (NLRI) +Advertises a variety of path attributes (PA) that BGP uses instead of a metric to choose the best path +Emphasis on scalability; might not always choose the most efficient route +Path-vector logic (similar to distance-vector) + + + +Note BGP also uses the term Network Layer Reachability Information (NLRI) to describe the IP prefix and length. This book uses the more familiar term prefix. + + +BGP ASNs and the AS_SEQ Path Attribute +BGP uses BGP path attributes for several purposes. PAs define information about a path, or route, through a network. Some BGP PAs describe information that can be useful in choosing the best BGP route, using the best-path algorithm. BGP also uses some PAs for purposes other than choosing the best path. + +By default, if no BGP PAs have been explicitly set, BGP routers use the BGP AS_PATH (autonomous system path) PA when choosing the best route among many competing routes. The AS_PATH PA itself has many subcomponents, only some of which matter to the depth of the CCNP coverage of the topic. However, the most obvious component of AS_PATH, the AS_SEQ (AS_SEQUENCE), can be easily explained with an example when the concept of an autonomous system number (ASN) has been explained. + +The integer BGP ASN uniquely identifies one organization that considers itself autono-mous from other organizations. Each company whose enterprise network connects to the Internet can be considered to be an autonomous system and can be assigned a BGP ASN. (IANA/ICANN also assigns globally unique ASNs.) Additionally, each ISP has an ASN, or possibly several, depending on the size of the ISP. + +When a router uses BGP to advertise a route, the prefix/length is associated with a set of PAs, including the AS_PATH. The AS_PATH PA associated with a prefix/length lists the ASNs that would be part of an end-to-end route for that prefix as learned using BGP. In a + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 547 + +way, the AS_PATH implies information like this: “If you use this path (route), the path will go through this list of ASNs.” + +BGP uses the AS_PATH to perform two key functions: + + +■ Key +Topic +■ + +Choose the best route for a prefix based on the shortest AS_PATH (fewest number of ASNs listed). + +Prevent routing loops. + + +An example can help demonstrate the concept. This example, and some others in this chapter, uses the design shown in Figure 13-4. This network has five ASNs: three ISPs and two customers. + + +ISP1 ASN 1 + +Company 1 + + + +Company 2 + +192.31.7.32/29 + + + +I1 I1-1 I1-2 +198.133.219.16/29 +I2 + +ASN 11 ASN 12 + + + + + +I3-1 + + + +I3-2 + + +ISP3 ASN3 + +I2-1 + + + +I2-2 + + +ISP2 ASN2 + + +Figure 13-4 Sample Portion of the Internet + +Figure 13-4 shows only a couple of routers in each ISP, and it also does not bother to show much of the enterprise networks for the two companies. However, the diagram does show enough detail to demonstrate some key BGP concepts. For the sake of dis-cussion, assume that each line between routers represents some physical medium that is working. Each router will use BGP, and each router will form BGP neighbor relationships with the routers on the other end of each link. For example, ISP1’s I1-2 router will have a BGP neighbor relationship with Routers I1-1 and I2-1. + + + + + + + +From the Library of Alexey Evseenko +548 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +With that in mind, consider Figure 13-5, which shows the advertisement of BGP updates for prefix 192.31.7.32/29 to the other ASNs. The figure shows four steps, as follows: +Step 1. I2, in ASN 12, advertises the route outside ASN 12. So, I2 adds its own ASN (12) to the AS_PATH PA when advertising the route. + + + +Key Topic + +192.31.7.32/29 AS_PATH = (12,2,1) +I1 + +3 192.31.7.32/29 +AS_PATH = (12,2,3) + +ISP1 ASN 1 + + + + +I1-1 I1-2 + + +4 192.31.7.32/29 +AS_PATH = (12,2,1) + + + + + + + +2 192.31.7.32/29 AS_PATH = (12,2) + + +ASN 12 + + + +I2 + +1 192.31.7.32/29 +AS_PATH = (12) + + + +I3-1 I2-1 + + + + +I3-2 + +2 +192.31.7.32/29 AS_PATH = (12,2) + + +I2-2 + + + +ISP3 ASN3 ISP2 ASN2 + + +Figure 13-5 + +Step 2. + + + +Step 3. + + + + +Step 4. + + +Advertisement of NLRI to Demonstrate AS_PATH + +The routers inside ASN 2, when advertising the route outside ASN 2, add their own ASN (2) to the AS_PATH PA when advertising the route. Their advertised AS_PATH is then (12,2). + +Router I3-1, inside ASN 3, had previously learned about the route for 192.31.7.32/29 from ASN 2, with AS_PATH (12,2). So, I3-1 advertises the route to ASN 1, after adding its own ASN (3) to the AS_PATH so that the AS_PATH is (12,2,3). + +Similarly, Router I1-1, inside ASN 1, advertises the route to ASN3. Because ASN 3 is a different ASN, I1-1 adds its own ASN (1) to the AS_PATH PA so +that the AS_PATH lists ASNs 12, 2, and 1. + + +Now, step back from the details, and consider the two alternative routes learned collec-tively by the routers in ASN 1: + +■ 192.31.7.32/29, AS_PATH (12,2) + +■ 192.31.7.32/29, AS_PATH (12,2,3) + +Because the BGP path selection algorithm uses the shortest AS_PATH, assuming that no other PAs have been manipulated, the routers in ASN 1 use the first of the two paths, sending packets to ASN 2 next, and not using the path through ASN 3. Also, as a result, note that the advertisement from ASN 1 into ASN 11 lists an AS_PATH that reflects the + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 549 + +best-path selection of the routers inside ASN 1, with the addition of ASN 1 to the end of the AS_PATH of the best route (12,2,1). + +BGP routers also prevent routing loops using the ASNs listed in the AS_PATH. When a BGP router receives an update, and a route advertisement lists an AS_PATH with its own ASN, the router ignores that route. This is because the route has already been advertised through the local ASN; to believe the route and then advertise it further might cause routing loops. + +Internal and External BGP + +BGP defines two classes of neighbors (peers): internal BGP (iBGP) and external BGP (eBGP). These terms use the perspective of a single router, with the terms referring to whether a BGP neighbor is in the same ASN (iBGP) or a different ASN (eBGP). + +A BGP router behaves differently in several ways depending on whether the peer (neigh-bor) is an iBGP or eBGP peer. The differences include different rules about what must be true before the two routers can become neighbors, different rules about which routes the BGP best-path algorithm chooses as best, and even some different rules about how the routers update the BGP AS_PATH PA. + +When advertising to an eBGP peer, a BGP router updates the AS_PATH PA, but it does not do so when advertising to an iBGP peer. For example, Figure 13-6 shows the same design, with the same route advertisement, as in Figure 13-5. However, in this case, all the BGP connections have been listed as either iBGP or eBGP. + + +ISP1 ASN 1 +ASN 11 Company 1 + +eBGP + + +ASN 12 +192.31.7.32/29 Company 2 + +I1 I1-1 iBGP I1-2 +198.133.219.16/29 +I2 + + +eBGP eBGP eBGP + + +1 +...AS_PATH = (12) + + +I3-1 I2-1 + +4 iBGP iBGP 2 + +...AS_PATH = (12,2) + +I3-2 + +...AS_PATH = (12) eBGP +3 I2-2 + +...AS_PATH = (12,2) + + +ISP3 ASN3 ISP2 ASN2 + +Figure 13-6 iBGP, eBGP, and Updating AS_PATH for eBGP Peers + +The figure highlights the route advertisement from ASN 12, over the lower path through ASN 2 and 3. Note that at Step 1, Router I2, advertising to an eBGP peer, adds its own ASN to the AS_PATH. At Step 2, Router I2-1 is advertising to an iBGP peer (I2-2), so it + + + + +From the Library of Alexey Evseenko +550 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +does not add its own ASN (2) to the AS_PATH. Then, at Step 3, Router I2-2 adds its own ASN (2) to the AS_PATH before sending an update to eBGP peer I3-2, and so on. + +Public and Private ASNs + +For the Internet to work well using BGP, IANA administers the assignment of ASNs much like it does with IP address prefixes. One key reason why ASNs must be assigned as unique values is that if ASNs are duplicated, the BGP loop-prevention process can actual-ly prevent parts of the Internet from learning about a route. For example, consider Figure 13-7, with the same design as in the last few figures—but this time with a duplicate ASN. + + +Key Topic + +This update lists ASN 12 - ignore that route. + + +ISP 1 ASN 12 + + +This update lists ASN 12 - ignore that route. + + +Company 1 ASN 12 + + + + + +I1-1 + + + +Update +...AS_PATH = (12,2,3) + +I1-2 + + +Update +...AS_PATH = (12,2) + + + + + + +Update ...AS_PATH = (12) + +Update +...AS_PATH = (12,2) + + + + +ASN 3 + +Figure 13-7 + +ASN 2 + +Duplicate ASN (12) Preventing Route Advertisement + + +In this figure, both ISP1 and Company 1 use ASN 12. The example’s BGP updates begin as in Figures 13-5 and 13-6, with Company 1 advertising its prefix. Routers inside ISP1 receive BGP updates that list the same prefix used by Company 1, but both Updates list an AS_PATH that includes ASN 12. Because ISP1 thinks it uses ASN 12, ISP1 thinks that these BGP Updates should be ignored as part of the BGP loop-prevention process. As a result, customers of ISP1 cannot reach the prefixes advertised by routers in Company 1. + +To prevent such issues, IANA controls the ASN numbering space. Using the same gen-eral process as for IPv4 addresses, ASNs can be assigned to different organizations. The 16-bit BGP ASN implies a decimal range of 0 through 65,535. Table 13-5 shows some of the details of IANA’s current ASN assignment conventions. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 551 + +Table 13-5 16-Bit ASN Assignment Categories from IANA +Key +Topic Value or Range Purpose + + +0 + +1 through 64,495 + +64,496 through 64,511 + +64,512 through 65,534 + +65,535 + +Reserved + +Assignable by IANA for public use + +Reserved for use in documentation + +Private use + +Reserved + + + +Like the public IPv4 address space has suffered with the potential for complete deple-tion of available addresses, the public BGP ASN space has similar issues. To help over-come this issue, the ASN assignment process requires that each AS justify whether it truly needs a publicly unique ASN or whether it can just as easily use a private ASN. Additionally, RFC 5398 reserves a small range of ASNs for use in documentation, so that the documents can avoid the use of ASNs assigned to specific organizations. + +Private ASNs allow the routers inside an AS to participate with BGP, while using the same ASN as many other organizations. Most often, an AS can use a private AS in cases where the AS connects to only one other ASN. (Private ASNs can be used in some cases of connecting to multiple ASNs as well.) The reason is that with only one connection point to another ASN, loops cannot occur at that point in the BGP topology, so the need for unique ASNs in that part of the network no longer exists. (The loops cannot occur because of the logic behind the BGP best-path algorithm, coupled with the fact that BGP only advertises the best path for a given prefix.) + +Outbound Routing Toward the Internet + +The single biggest reason to consider using BGP between an enterprise and an ISP is to influence the choice of best path (best route). The idea of choosing the best path sounds appealing at first. However, because the majority of the end-to-end route exists inside the Internet, particularly if the destination is 12 routers and a continent away, it can be a challenge to determine which exit point from the enterprise is actually a better route. + +As a result, enterprises typically have two major classes of options for outbound routing toward the Internet: default routing and BGP. Using default routes is perfectly reasonable, depending on the objectives. This section examines the use of default routes toward the Internet, and describes some of the typical enterprise BGP designs and how they can be used to influence outbound routes toward the Internet. + +Comparing BGP and Default Routing for Enterprises + +A default static route is a statically configured route that can be used by a router if a more specific route to a destination network is not found in the router’s IP routing table. Oftentimes, a branch office router uses a default static route pointing toward the core of a + + + + +From the Library of Alexey Evseenko +552 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +network. The WAN edge routers then needed static routes for the subnets at each branch, with the WAN edge routers advertising these branch subnets into the core using an IGP. + +The branch office default routing design results in less processing on the routers, less memory consumption, and no IGP overhead on the link between the branch and WAN distribution routers. Specifically, the branch routers can have a single or a few default routes, instead of potentially hundreds of routes for specific prefixes, all with the same next-hop information. + +The same general concept of using defaults and static routes at enterprise branches can be applied to the enterprise network and its connections to one or a few ISPs. Similar to a branch router, an entire enterprise often has only a few connections to the Internet. If one of those connections is considered better than the others, all packets sent from the enterprise toward the Internet would normally follow that one Internet link, for all +Internet destinations. Likewise, the ISPs, similar to WAN distribution routers in this anal-ogy, could configure static routes for the enterprise’s public IP address prefix and then use BGP in the Internet to advertise those routes. Figure 13-8 illustrates this idea. + +Company 1 Enterprise Network -Public Addresses: 128.107.0.0/16 + + + + +B1 default +default WAN1 + + +Core1 + + +default +B2 default default + +default + + + +default WAN2 B3 + +Core2 +default + + +default + + +ip route 0.0.0.0 0.0.0.0 ISP-1 E1 S0/0/0 ISP-1 Internet + +ip route 128.107.0.0 255.255.0.0 E1 + +Figure 13-8 Use of Static Default into the Internet + +Although the enterprise could choose to use BGP in this case, such a decision is not automatic. First, the alternative of using static routes, as shown in the figure, does not require a lot of work. The enterprise network engineer just needs to configure a default route and advertise it throughout the enterprise; the dashed lines in the figure represent the advertisement of the default route with the enterprise’s IGP. + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 553 + +In addition to the configuration on the enterprise router (E1), the ISP network engineer has to configure static routes for that enterprise’s public IP address range, and redistrib-ute those routes into BGP to advertise them throughout the Internet. The figure shows a static route for Company 1’s 128.107.0.0/16 public address range. Additionally, this prefix would need to be injected into BGP for advertising into the rest of the Internet. + +Instead of using static default routes, you could enable BGP between E1 and ISP-1. Running BGP could mean that the enterprise router requires significant memory and more processing power on the router. The design might also require other enterprise routers besides the Internet-connected routers to know the BGP routes, requiring additional rout-ers to have significant CPU and memory resources. Finally, although you can configure BGP to choose one route over another using PAs, the advantage of choosing one path over another might not be significant. Alternatively, you could ask the ISP to advertise only a default route with BGP. + +Now that you have seen a few of the reasons why you might be fine using static routes instead of BGP, consider why you might want to use BGP. First, it makes the most sense to use BGP when you have at least two Internet connections. Second, BGP becomes most useful when you want to choose one outbound path over another path for particular destinations in the Internet. In short, when you have multiple Internet connections, and you want to influence some packets to take one path and some packets to take another, consider BGP. + +This chapter next examines different cases of Internet connectivity and weighs the reasons why you might choose to use BGP. For this discussion, the perspective of the enterprise network engineer will be used. As such, outbound routing is considered to be routing that direct packets from the enterprise network toward the Internet, and inbound routing refers to routing that direct packets into the enterprise network from the Internet. + +To aid in the discussion, this section examines four separate cases: + +■ Single-homed (1 link per ISP, 1 ISP) Key +Topic ■ Dual-homed (2+ links per ISP, 1 ISP) + +■ Single-multihomed (1 link per ISP, 2+ ISPs) + +■ Dual-multihomed (2+ links per ISP, 2+ ISPs) + + +Note The terms in the preceding list can be used differently depending on what book or document you read. For consistency, this book uses these terms in the same way as the Cisco authorized ROUTE course associated with the ROUTE exam. + + + +Single-Homed + +The single-homed Internet design uses a single ISP, with a single link between the enter-prise and the ISP. With single-homed designs, only one possible next-hop router exists + + + + +From the Library of Alexey Evseenko +554 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +for any and all routes for destinations in the Internet. As a result, no matter what you do with BGP, all learned routes would list the same outgoing interface for every route, which minimizes the benefits of using BGP. + +Single-homed designs often use one of two options for routing to and from the Internet: + +■ Use static routes (default in the enterprise, and a static route for the enterprise’s pub-lic address range at the ISP). + +■ Use BGP, but only to exchange a default route (ISP to enterprise) and a route for the enterprise’s public prefix (enterprise to ISP). + +The previous section already showed the main concepts for the first option. For the sec-ond option, the concept still uses the IGP’s mechanisms to flood a default route through-out the enterprise, causing all packets to go toward the Internet-facing router. Instead of using static routes, however, the following must happen: + +■ The ISP router uses BGP to advertise a default route to the enterprise. + +■ You must configure the IGP on the enterprise’s Internet-facing router to flood a default route (typically only if the default route exists in that router’s routing table). + +■ You must configure BGP on the enterprise router and advertise the enterprise’s pub-lic prefix toward the ISP. + +Both options—using static default routes and BGP-learned default routes—have some negatives. Some packets for truly nonexistent destinations flow through the enterprise to the Internet-facing router (E1 in the example of Figure 13-8) and over the link to the Internet, before being discarded for lack of a matching route. For example, if the enter- +prise used private network 10.0.0.0/8 internally, packets destined for addresses in network 10.0.0.0/8 that have not yet been deployed will match the default route and be routed to the Internet. + +To avoid wasting this bandwidth by sending packets unnecessarily, a static route for 10.0.0.0/8, destination null0, could be added to the Internet-facing router but not adver-tised into the rest of the enterprise. (This type of route is sometimes called a discard route.) This route would prevent the Internet-facing router from forwarding packets des-tined for network 10.0.0.0/8 into the Internet. + +Dual-Homed + +The dual-homed design has two (or more) links to the Internet, but with all links con-necting to a single ISP. This type of design can use a pair of routers, two pairs, or a com-bination, as shown in the three cases in Figure 13-9. + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 555 + +Key ASN 1000 ASN 1, ISP1 Topic + + + +E1 + + + + + +ASN 1000 + +I1-1 + + + + +ASN 1, ISP1 + + +I1-1 + +E1 + +I1-2 + + + +ASN 1000 + + +E1 + + + +E2 + +ASN 1, ISP1 + + +I1-1 + + + +I1-2 + + + +Figure 13-9 Dual-Homed Design Options + +Comparing the dual-homed case to the single-homed design, the second link gives the enterprise a choice. The enterprise router(s) could choose between one of two links, and in the case with two enterprise routers, the choice of a different link also means the choice of sending packets to a different router. + +Each of the cases shown in Figure 13-9 is interesting, but the case with two enterprise routers provides the most ideas to consider. When considering whether to use BGP in this case, and if so, how to use it, first think about whether you want to influence the choice of outbound route. The common cases when using defaults works well, ignoring BGP, are + +■ To prefer one Internet connection over another for all destinations, but when the bet-ter ISP connection fails, all traffic reroutes over the secondary connection. + +■ To treat both Internet connections as equal, sending packets for some destinations out each path. However, when one fails, all traffic reroutes over the one still-working path. + +The text now examines each option, in order, including a discussion of how to choose the best outbound routing using both partial and full BGP updates. + + + + +From the Library of Alexey Evseenko +556 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Preferring One Path over Another for All Destinations + +When the design calls for one of the two Internet connections to always be preferred, regardless of destination, BGP can be used, but it is not required. With a goal of prefer-ring one path over another, the routers can use default routes into the Internet. + +To demonstrate the concept, Figure 13-10 shows a dual-homed design, this time with two routers (E1 and E2) connected to the Internet. Each router has a single link into the single ISP. Figure 13-10 shows the routes that result from using default routes to forward all traffic toward Router E1. + +Enterprise ASN 1 ISP1 + + + +Default +WAN1 + + +100 Mbps +E1 I1-1 + + + +Default +Default + + +10 Mbps +WAN2 E2 I1-2 + + +Figure 13-10 Dual-Homed Design, Using Defaults to Favor One Link + +Figure 13-10 shows that all routers forward the Internet-destined packets toward Router E1, because this router has the faster Internet connection to ISP1 (100 Mbps in this case). Again in this example, the other connection from Router E2 to ISP1 uses a 10-Mbps link. + +To make this design work, with failover, both E1 and E2 need to advertise a default route into the enterprise, but the route advertised by the primary router (E1) needs to have metrics set so that it is always the better of the two routes. For example, with EIGRP, E1 can configure a static default route with Router I1-1 as the next hop, but with very high bandwidth and very low delay upon redistribution into EIGRP. Conversely, E2 can create a default for Router I1-2 as the next-hop router, but with a low bandwidth but high delay. Example 13-1 shows the configuration of the static default route on both E1 and E2, with the redistribute command setting the metrics. + + +Note With EIGRP as the IGP, remember that the delay setting must be set higher to avoid cases where some routers forward packets toward the secondary Internet router (E2). The reason is that EIGRP uses constraining bandwidth, so a high setting of bandwidth at the redistribution point on E1 might or might not cause more remote routers to use that route. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 557 + +Example 13-1 Default Routing on Router E1 + +! Configuration on router E1 – note that the configuration uses +! a hostname instead of I1-1's IP address +ip route 0.0.0.0 0.0.0.0 I1-1 +router eigrp 1 +redistribute static metric 100000 1 255 1 1500 + +! Configuration on router E2 - note that the configuration uses +! a hostname instead of I1-2's IP address +ip route 0.0.0.0 0.0.0.0 I1-2 +router eigrp 1 +redistribute static metric 10000 100000 255 1 1500 + +A slightly different approach can be taken in other variations of the dual-homed design, as seen back in Figure 13-9. The first two example topologies in that figure show a single router with two links to the same ISP. If the design called for using one link as the pre-ferred link, and the engineer decided to use default routes, that one router would need two default routes. To make one route be preferred, that static default route would be assigned a better administrative distance (AD) than the other route. For example, the commands ip route 0.0.0.0 0.0.0.0 I1-1 3 and ip route 0.0.0.0 0.0.0.0 I1-2 4 could be used on Router E1 in Figure 13-9, giving the route through I1-1 a lower AD (3), preferring that route. If the link to I1-1 failed, the other static default route, through I1-2, would be used. + +Choosing One Path over Another Using BGP + +The big motivation to use BGP occurs when you want to influence which link is used for certain destinations in the Internet. To see such a case, consider Figure 13-11, which adds Company 3 to the design. In this case, Company 3 uses prefix 192.135.250.0/28 as its public address range. Company 3 might be located closer to I1-2 inside ISP1 than to Router I1-1, and in such cases, the BGP design calls for making the packets flow over the route as shown. + +Two notable actions must take place for this design to work, beyond the basic configura-tion of the eBGP peers as shown. First, the engineers at the enterprise and ISP must agree on to how to make BGP specify a prefix as being best reached through a particular link. In this case, the routes advertised by I1-2 for prefix for 192.135.250.0/28 must have BGP PA settings that appear better than those learned from I1-1. In this case, you cannot just rely on the default of checking the AS_PATH length, because the AS_PATH length should tie, because I1-1 and I1-2 are in the same ASN. So when planning with the engineers of ISP1, the enterprise network engineer must discuss what kinds of prefixes that might work better through I1-1, which would be better through I1-2, and how the ISP might set PA values to which the enterprise routers (E1 and E2) can react. + + + + + + + + +From the Library of Alexey Evseenko +558 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ASN 1 ISP1 1 iBGP Mesh + + +B1 + +2 +WAN1 Core1 + + +S0/0 eBGP +E1 I1-1 +ASN 2 ISP2 + + +B2 + + +WAN2 Core2 +3 S0/0 eBGP + +B3 + + +dest = 192.135.250.1 +4 + +E2 I1-2 +5 I1-3 +6 + + +ASN 13 Company 3 + +I3 +192.135.250.0/28 + + +Figure 13-11 Preferring One Outbound Link over Another + +The second big consideration occurs inside the enterprise network with a need to run BGP between multiple routers. So far in this chapter, the enterprise routers all used default routes to send packets to the Internet-facing routers, and only those routers knew Internet routes. However, for the design of Figure 13-11 to work, E1 and E2 must com-municate BGP routes using an iBGP connection. And because packet forwarding between E1 and E2 goes through other routers (such as Core1 and Core2), those routers typically also need to run BGP. You might even decide to run BGP on the WAN routers as well. By doing so, the core routers know the best BGP routes. For example, they all know that the better route for Company 3’s 192.135.250.0/28 public address space is through E2, so the packet is forwarded to E2. The following list outlines the logic matching Figure 13-11: +Step 1. A host at Branch B1 sends a packet to 192.135.250.1. + +Step 2. Router B1 matches its default route, forwarding the packet to Router WAN2. + +Step 3. WAN2 matches its iBGP-learned route for 192.135.250.0/28, forwarding to Core2. + +Step 4. Core2 matches its iBGP-learned route for 192.135.250.0/28, forwarding to E2. + +Step 5. E2 matches its eBGP-learned route for 192.135.250.0/28, forwarding to I1-2. + +Step 6. The routers in ISP1 forward the packet to Router I3, in Company 3. + +The routers in the core of the enterprise need to run BGP, because without it, routing loops can occur. For example, if WAN1, WAN2, Core1, and Core2 did not use BGP, and relied on default routes, their default would drive packets to either E1 or E2. Then, E1 or E2 might send the packets right back to Core1 or Core2. (Note that there is no direct link between E1 and E2.) Figure 13-12 shows just such a case. + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 559 + + + +Key Topic + +Default +1 + +Default (Again) +4 ISP1 Default +2 + + +WAN1 Core1 3 E1 I1-1 192.135.250.0/28 +to E2 + + + +WAN2 Core2 E2 I1-2 + + + + +R + +192.135.250.0/28 + +Company 3 + +Figure 13-12 Routing Loop Without BGP in the Enterprise Core + +In this case, both E1 and E2 know that E2 is the best exit point for packets destined to 192.135.250.0/28 (from Figure 13-11). However, the core routers use default routes, with WAN1 and Core1 using defaults that send packets to E1. Following the numbers in the + +figure: + +Step 1. + + +Step 2. + + +Step 3. + + +Step 4. + + + +WAN1 gets a packet destined for 192.135.250.1 and forwards the packet to Core1 based on its default route. + +Core1 gets the packet and has no specific route, so it forwards the packet to E1 based on its default route. + +E1’s BGP route tells it that E2 is the better exit point for this destination. To send the packet to E2, E1 forwards the packet to Core1. + +Core1, with no knowledge of the BGP route for 192.135.250.0/28, uses its +default route to forward the packet to E1, so the packet is now looping. + + +A mesh of iBGP peerings between at least E1, E2, Core1, and Core2 would prevent this problem. + +Partial and Full BGP Updates + +Unfortunately, enterprise routers must pay a relatively large price for the ability to choose between competing BGP routes to reach Internet destinations. As previously mentioned, + + + + + + +From the Library of Alexey Evseenko +560 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +the BGP table in the Internet core is at approximately 480,000 routes as of the writing of this chapter in 2014. To make a decision to use one path instead of another, an enterprise router must know about at least some of those routes. Exchanging BGP information for such a large number of routes consumes bandwidth. It also consumes memory in the routers and requires some processing to choose the best routes. Some samples at Cisco. com show BGP using approximately 70 MB of RAM for the BGP table on a router with 100,000 BGP-learned routes. + +To make matters a bit worse, in some cases, several enterprise routers might also need to use BGP, as shown in the previous section. Those routers also need more memory to hold the BGP table, and they consume bandwidth exchanging the BGP table. + +To help reduce the memory requirements of receiving full BGP updates (BGP updates that include all routes), some ISPs give you three basic options for what routes the ISP advertises: + +■ Default route only: The ISP advertises a default route with BGP, but no other routes. +Key +Topic ■ Full updates: The ISP sends you the entire BGP table. + +■ Partial updates: The ISP sends you routes for prefixes that might be better reached through that ISP, but not all routes, plus a default route (to use as needed instead of the purposefully omitted routes). + +If all you want to do with a BGP connection is use it by default, you can have the ISP send just a default route. If you are willing to take on the overhead of getting all BGP routes, asking for full updates is reasonable. However, if you want something in between, the partial updates option is useful. + +BGP partial updates give you the benefit of choosing the best routes for some destina-tions, while limiting the bandwidth and memory consumption. With partial updates, the ISP advertises routes for prefixes that truly are better reached through a particular link. However, for prefixes that might not be any better through that link, the ISP does not advertise those prefixes with BGP. Then the enterprise routers can use the better path based on the routes learned with BGP, and use a default route for the prefixes not learned with BGP. For example, previously in Figure 13-11, Router I1-2 could be configured to only advertise routes for those such as 192.135.250.0/28 from Company 3 in that fig- +ure—in other words, only routes for which Router I1-2 had a clearly better route than the other ISP1 routers. + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 561 + +Single-Multihomed + +A single-multihomed topology means a single link per ISP, but multiple (at least two) ISPs. Figure 13-13 shows a couple of single-multihomed designs, each with two ISPs. + +ASN 1, ISP1 Enterprise + + +E1 I1-1 + + + +ASN 2, ISP2 + + + +I2-1 + + + + +ASN 1, ISP1 Enterprise + + +E1 I1-1 + + + +ASN 2, ISP2 + + + +E2 I2-1 + + +Figure 13-13 Single-Multihomed Designs + +The single-multihomed design has some similarities with both the single-homed and +dual-homed designs previously seen in this section. The single-multihomed design on the top of the figure, which uses a single router, acts like the single-homed design for default routes in the enterprise. This design can flood a default route throughout the enterprise, drawing traffic to that one router, because only one router connects to the Internet. With the two-router design on the lower half of Figure 13-13, default routes can still be used in the enterprise to draw traffic to the preferred Internet connection (if one is preferred) or to balance traffic across both. + + + + + + + +From the Library of Alexey Evseenko +562 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The single-multihomed design works like the dual-homed design in some ways, because two (or more) links connect the enterprise to the Internet. With two links, the Internet design might call for the use of defaults, always preferring one of the links. The design engineer might also choose to use BGP, learn either full or partial updates, and then favor one connection over another for some of the routes. + +Figure 13-14 shows these concepts with a single-multihomed design, with default routes in the enterprise to the one Internet router (E1). + +ISP1 + +Use Defaults? Use BGP? + + +S0/0 + +E1 ISP3 S0/1 + + + + + + +Default Routes with IGP + +Figure 13-14 Outbound Routing with a Single-Multihomed Design + + +Dual-Multihomed + +The last general category of Internet access topologies is called dual-multihomed . With this design, two or more ISPs are used, with two or more connections to each. A number of different routers can be used. Figure 13-15 shows several examples. + +Figure 13-15 does not show all design options, but because at least two ISPs exist, with at least two connections per ISP, much redundancy exists. That redundancy can be used for backup, but most often, BGP is used to make some decisions about the best path to reach various destinations. + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 563 + + + +Key Topic + +ASN 1, ISP1 Enterprise + + + +E1 I1-1 + + +ASN 2, ISP2 + + + +E2 I2-1 + + + + + + +Enterprise ASN 1, ISP1 + + +E1 I1-1 + + +I1-2 + + +ASN 2, ISP2 + + +I2-1 + + +E2 I2-2 + + +Figure 13-15 Dual-Multihomed Options + +External BGP for Enterprises + +Some of the core operational concepts of BGP mirror those of EIGRP and OSPF. BGP first forms a neighbor relationship with peers. BGP then learns information from its neighbors, placing that information in a table—the BGP table. Finally, BGP analyzes the BGP table to choose the best working route for each prefix in the BGP table, placing those routes into the IP routing table. + + + + + + + + +From the Library of Alexey Evseenko +564 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +This section discusses external BGP (eBGP), focusing on two of the three aspects of how a routing protocol learns routes: forming neighborships and exchanging the reach-ability or topology information that is stored in the BGP table. First, this section exam-ines the baseline configuration of eBGP peers (also called neighbors), along with several optional settings that might be needed specifically for eBGP connections. This configura-tion should result in working BGP neighborships. Then, this section examines the BGP table, listing the prefix/length and path attributes (PA) learned from the Internet, and the IP routing table. + +eBGP Neighbor Configuration + +At a minimum, a router participating in BGP must configure the following settings: + +■ The router’s own ASN (router bgp asn global command) +Key +Topic ■ The IP address of each neighbor and that neighbor’s ASN (neighbor ip-address +remote-as remote-asn BGP subcommand) + +For example, consider a typical multihomed enterprise Internet design, as shown in Figure 13-16. In this case, the following design requirements have already been decided, but you must then determine the configuration, knowing the information in the following list and the figure: + +■ The enterprise uses ASN 11. + +ASN 11 +Enterprise ASN 1 ISP1 + + +Public +128.107.0.0/19 10.1.1.1 Default S0/0/0 +Routes +E1 +S0/0/1 S0/1/1 10.1.1.5 +192.168.1.1 + + +10.1.1.2 S0/0/0 + +S0/0/1 I1-1 10.1.1.6 + + + + +ASN 2 ISP2 + + + + +I2-1 ASN 3 ISP3 + +S0/0/0 192.168.1.2 + +I3-1 + + + +Figure 13-16 Sample Single-Multihomed Design + +■ The connection to ISP1 (two T-1s) is considered the primary connection, with the connection to ISP3 (one T-1) being secondary. + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 565 + +■ ISP1 advertises a default route, plus full updates. + +■ ISP1 uses ASN 1. + +■ ISP3 advertises a default route, plus partial updates that include only ISP3’s local customers. + +■ ISP3 uses ASN 3. + +■ Each ISP uses the IP address of its lowest-numbered interface for its peer relationships. + +For Router E1, as shown in Example 13-2, the BGP configuration requires only three commands, at least to configure BGP to the point where E1 will form neighborships with the two other routers. (Note that this chapter continues to change and add to this con-figuration when introducing new concepts.) The example also shows the configuration on Routers I1-1 and I3-1 added solely to support the neighbor connections to E1; other BGP configuration on these routers is not shown. + +Example 13-2 BGP Configuration on E1: Neighborships Configured + +! Configuration on router E1 +router bgp 11 +neighbor 10.1.1.2 remote-as 1 +neighbor 192.168.1.2 remote-as 3 + +! Next commands are on I1-1 +router bgp 1 +neighbor 10.1.1.1 remote-as 11 + +! Next commands are on I3-1 +router bgp 3 +neighbor 192.168.1.1 remote-as 11 + +The gray portions of the output highlight the configuration of the local ASN and the neighbors’ ASNs—parameters that must match for the neighborships to form. First, E1 configures its own ASN as 11 by using the router bgp 11 command. The other routers must refer to ASN 11 on the neighbor commands that refer to E1; in this case, I1-1 refers to ASN 11 with its neighbor 10.1.1.1 remote-as 11 command. Conversely, I1-1’s local ASN (1) on its router bgp 1 global command must match what E1 configures in a neigh-bor command—in this case, with E1’s neighbor 10.1.1.2 remote-as 1 command. + +Requirements for Forming eBGP Neighborships + +Routers must meet several requirements to become BGP neighbors: + + +■ +Key Topic + +■ + +A local router’s ASN (on the router bgp asn command) must match the neighboring router’s reference to that ASN with its neighbor remote-as asn command. + +The BGP router IDs of the two routers must not be the same. + + + + + +From the Library of Alexey Evseenko +566 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ If configured, authentication must pass. + +■ Each router must be part of a TCP connection with the other router, with the remote router’s IP address used in that TCP connection matching what the local router con-figures in a BGP neighbor remote-as command. + +Consider the first two items in this list. First, the highlights in Example 13-2 demonstrate the first of the four requirements. Next, the second requirement in the list requires only a little thought if you recall the similar details about router IDs (RID) with EIGRP and OSPF. Like EIGRP and OSPF, BGP defines a 32-bit router ID, written in dotted-decimal notation. And like EIGRP and OSPF, BGP on a router chooses its RID the same general way, by using the following steps, in order, until a BGP RID has been chosen: + +■ Configured: Use the setting of the bgp router-id rid router subcommand. Key +Topic ■ Highest loopback: Choose the highest numeric IP address of any up loopback inter- +face, at the time the BGP process initializes. + +■ Highest other interface: Choose the highest numeric IP address of any up nonloop-back interface, at the time the BGP process initializes. + +The third requirement in the list, the authentication check, occurs only if authentication has been configured on at least one of the two routers, using the neighbor neighbor-ip password key command. If two BGP neighbors configure this command, referring to the other routers’ IP address, while configuring a matching authentication key value, the authentication passes. If both omit this command, no authentication occurs. However, +the neighborship can still form. If the keys do not match, or if only one router configures authentication, authentication fails, resulting in no neighborship forming. + +The fourth neighbor requirement—that the IP addresses used for the neighbor TCP con-nection match—requires a more detailed discussion. BGP neighbors first form a TCP connection. Later, BGP messages flow over that connection, which allows BGP routers to know when the messages arrived at the neighbor and when they did not. + +A BGP router creates the TCP connection by trying to establish a TCP connection to the address configured in the neighbor neighbor-ip remote-as command. However, Cisco IOS does not require the BGP configuration to explicitly state the source address that router uses when establishing this TCP connection, and if not explicitly configured, Cisco IOS picks an IP address on the local router. By default, Cisco IOS chooses its BGP source IP address for a given neighbor as the interface IP address of the outgoing interface of the route used to forward packets to that neighbor. That’s a lot of words to fight through, and much more easily seen with a figure, such as Figure 13-17, which focuses on the eBGP connection between E1 and I1-1 shown in Figure 13-16. + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 567 + + + +Key Topic + + +Source 10.1.1.1 +4 + + +Destination +10.1.1.2 TCP BGP + + + +Routing Table + +Destination Outgoing + +10.1.1.1/30 +E1 S0/0/0 I1-1 +5 + + + +10.1.1.0/30 S0/0/0 +3 + + +neighbor 10.1.1.1 .... + + +1 2 +neighbor 10.1.1.2 remote-as 1 + +Figure 13-17 Default Choice for Update Source + +A description of the steps in the logic shown in the figure follows: + +Step 1. E1 finds the neighbor 10.1.1.2 command, so E1 sends the BGP messages for this neighbor inside packets with destination IP address 10.1.1.2. + +Step 2. E1 looks in the IP routing table for the route that matches destination 10.1.1.2. + +Step 3. The route matched in Step 2 lists S0/0/0 as the outgoing interface. + +Step 4. E1’s interface IP address for S0/0/0 is 10.1.1.1, so E1 uses 10.1.1.1 as its source IP address for this BGP peer. + +Step 5. The neighbor command on the other router, I1-1, must refer to E1’s source IP address (10.1.1.1 in this case). + +Now, consider again the last of the four requirements to become neighbors. Restated, for proper operation, the BGP update source on one router must match the IP address con-figured on the other router’s neighbor command, and vice versa. As shown in Figure 13-14, E1 uses update source 10.1.1.1, with I1-1 configuring the neighbor 10.1.1.1 command. Conversely, I1-1 uses 10.1.1.2 as its update source for this neighbor relationship, with E1 configuring a matching neighbor 10.1.1.2 command. + + +Note The update source concept applies per neighbor. + + + +Issues When Redundancy Exists Between eBGP Neighbors + +In many cases, a single Layer 3 path exists between eBGP neighbors. For example, a sin-gle T1, or single T3, or maybe a single MetroE Virtual Private Wire Service (VPWS) path exists between the two routers. In such cases, the eBGP configuration can simply use the interface IP addresses on that particular link. For example, in Figure 13-16, a single serial link exists between Routers E1 and I3-1, and they can reasonably use the serial link’s IP addresses, as shown in Example 13-2. + + + + + +From the Library of Alexey Evseenko +568 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +However, when redundant Layer 3 paths exist between two eBGP neighbors, the use of interface IP addresses for the underlying TCP connection can result in an outage when only one of the two links fails. BGP neighborships fail when the underlying TCP connec-tion fails. TCP uses a concept called a socket, which consists of a local TCP port number and an IP address. That IP address must be associated with a working interface (an inter-face whose state is line status up, line protocol up, per the show interfaces command). +If the interface whose IP address is used by BGP were to fail, the TCP socket would fail, closing the TCP connection. As a result, the BGP neighborship can only be up when the associated interface also happens to be up. + +Two alternative solutions exist in this case. One option would be to configure two neigh-bor commands on each router, one for each of the neighbor’s interface IP addresses. This solves the availability issue, because if one link fails, the other neighborship can remain up and working. However, in this case, both neighborships exchange BGP routes, con-suming bandwidth and more memory in the BGP table. + +The preferred option, which uses loopback interfaces as the TCP connection endpoints, solves the availability problem while avoiding the extra overhead. The two routers each configure a loopback interface and IP address, and use those loopback IP addresses as the source of their single BGP TCP connection. If one of the multiple links fails, the loop-back interface does not fail. As long as the two routers have working routes to reach each other’s loopback IP addresses, the TCP connection does not fail. + +Configuring eBGP peers to use a loopback interface IP address with BGP requires several steps, as follows: + +Step 1. Key +Topic Step 2. + + + +Step 3. + + + +Step 4. + + +Step 5. + + +Configure an IP address on a loopback interface on each router. + +Tell BGP on each router to use the loopback IP address as the source IP address using the neighbor neighbor-ip update-source interface-id command. + +Configure the BGP neighbor command on each router to refer to the other router’s loopback IP address at the neighbor IP address in the neighbor neigh-bor-ip remote-as command. + +Make sure that each router has IP routes so that they can forward packets to the loopback interface IP address of the other router. + +Configure eBGP multihop using the neighbor neighbor-ip ebgp-multihop +hops command. + + +The first three steps in the list require configuration on both the routers. Figure 13-18 shows the details related to the first three steps, focusing on Router E1’s use of its Loopback1 interface (based on Figure 13-16). + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 569 + +Key Router E1 +Topic neighbor 1.1.1.1 remote-as 1 + + +neighbor 1.1.1.1 update-source loopback 1 + +interface loopback 1 + +ip address 11.11.11.11 255.255.255.255 + + +Router I1-1 + +neighbor 11.11.11.11 remote-as 11 + + + +neighbor 11.11.11.11 update-source loopback2 + + +interface loopback2 +ip address 1.1.1.1 255.255.255.255 + +Figure 13-18 Using Loopbacks with Update Source for eBGP + +The fourth step in the list is an overt reminder that for TCP to work, both routers must be able to deliver packets to the IP address listed in the neighbor commands. Because the neighbor commands now refer to loopback IP addresses, the routers cannot rely on connected routes for forwarding the packets. To give each router a route to the other router’s loopback, you can run an instance of an IGP to learn the routes, or just configure +static routes. If using static routes, make sure to configure the routes so that all redundant paths would be used (as seen in the upcoming Example 13-3). If using an IGP, make sure that the configuration allows the two routers to become IGP neighbors over all redundant links as well. + +eBGP Multihop Concepts + +The fifth configuration step for using loopback IP addresses with eBGP peers refers to a feature called eBGP multihop. By default, when building packets to send to an eBGP +peer, Cisco IOS sets the IP Time-To-Live (TTL) field in the IP header to a value of 1. With this default action, the eBGP neighborship fails to complete when using loopback inter-face IP addresses. The reason is that when the packet with TTL=1 arrives at the neighbor, the neighbor decrements the TTL value to 0 and discards the packet. + +The logic of discarding the BGP packets can be a bit surprising, so an example can help. For this example, assume that the default action of TTL=1 is used and that eBGP mul-tihop is not configured yet. Router E1 from Figure 13-16 is trying to establish a BGP connection to I1-1, using I1-1’s loopback IP address 1.1.1.1, as shown in Figure 13-18. The following occurs with the IP packets sent by E1 when attempting to form a TCP connec-tion for BGP to use: +Step 1. E1 sends a packet to destination address 1.1.1.1, TTL=1. + +Step 2. I1-1 receives the packet. Seeing that the packet is not destined for the receiv-ing interface’s IP address, I1-1 passes the packet off to its own IP forwarding (IP routing) logic. + + + + + +From the Library of Alexey Evseenko +570 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 3. I1-1’s IP routing logic matches the destination (1.1.1.1) with the routing table and finds interface loopback 2 as the outgoing interface. + +Step 4. I1-1’s IP forwarding logic decrements the TTL by 1, decreasing the TTL to 0, and as a result, I1-1 discards the packet. + +In short, the internal Cisco IOS packet-forwarding logic decrements the TTL before giving the packet to the loopback interface, meaning that the normal IP forwarding logic discards the packet. + +Configuring the routers with the neighbor ebgp-multihop 2 command, as seen in the upcoming Example 13-3, solves the problem. This command defines the TTL that the router will use when creating the BGP packets (two in this case). As a result, the receiving router will decrement the TTL to 1, so the packet will not be discarded. + +BGP Internals and Verifying eBGP Neighbors + +Similar to OSPF, the BGP neighbor relationship goes through a series of states over time. Although the Finite State Machine (FSM) for BGP neighbor states has many twists and turns, particularly for handling exceptions, retries, and failures, the overall process works as follows: +Step 1. A router tries to establish a TCP connection with the IP address listed on a neighbor command, using well-known destination port 179. + +Step 2. When the three-way TCP connection completes, the router sends its first BGP message, the BGP Open message, which generally performs the same function as the EIGRP and OSPF Hello messages. The Open message contains several BGP parameters, including those that must be verified before allowing the rout-ers to become neighbors. +Step 3. After an Open message has been sent and received and the neighbor param-eters match, the neighbor relationship is formed and the neighbors reach the Established state. + +Table 13-6 lists the various BGP states. If all works well, the neighborship reaches the final state: Established. When the neighbor relationship (also called a BGP peer or BGP peer connection) reaches the Established state, the neighbors can send BGP Update messages, which list PAs and prefixes. However, if neighbor relationship fails for any reason, the neighbor relationship can cycle through all the states listed in Table 13-6 while the routers periodically attempt to bring up the neighborship. + + +Table 13-6 Key +Topic State + +Idle + +Connect + + +BGP Neighbor States + +Typical Reasons +The BGP process is either administratively down or awaiting the next retry attempt. +The BGP process is waiting for the TCP connection to be completed. You cannot determine from this state information whether the TCP connection can complete. + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 571 + + + +State Active + +Opensent + + +Openconfirm + + + +Established + +Typical Reasons +The TCP connection has been completed, but no BGP messages have yet been sent to the peer. +The TCP connection exists, and a BGP Open message has been sent to the peer, but the matching Open message has not yet been received from the other router. +An Open message has been both sent to and received from the other router. The next step is to receive a BGP Keepalive message (to confirm that all neighbor-related parameters match) or a BGP Notification message (to learn that there is some mismatch in neighbor parameters). +All neighbor parameters match, the neighbor relationship works, and the peers can now exchange Update messages. + + + + +Verifying eBGP Neighbor Status + +The two most common commands to display a BGP neighbor’s status are show ip bgp summary and show ip bgp neighbors [neighbor-id]. Interestingly, most people use the first of these commands, because it supplies a similar amount of information, one line per neighbor, as do the familiar show ip eigrp neighbors and show ip ospf neighbor com-mands. The show ip bgp neighbors command lists a large volume of output per neighbor, which, although useful, usually contains far too much information for the verification of the current neighbor state. Examples 13-3 and 13-4 show samples of the output of each of these two commands on Router E1, respectively, based on the configuration shown in Example 13-2, with some description following each example. + +Example 13-3 Summary Information with the show ip bgp summary Command + +E1# show ip bgp summary +BGP router identifier 11.11.11.11, local AS number 11 +BGP table version is 26, main routing table version 26 +6 network entries using 792 bytes of memory +7 path entries using 364 bytes of memory +6/4 BGP path/bestpath attribute entries using 888 bytes of memory +5 BGP AS-PATH entries using 120 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +Bitfield cache entries: current 1 (at peak 2) using 32 bytes of memory +BGP using 2196 total bytes of memory +BGP activity 12/6 prefixes, 38/31 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +1.1.1.1 4 1 +192.168.1.2 4 3 + +60 61 26 0 +153 159 26 0 + +0 00:45:01 6 +0 00:38:13 1 + + + + + + +From the Library of Alexey Evseenko +572 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The first line in the summary lists the local router’s BGP RID (11.11.11.11), along with the local router’s ASN (11). The rest of the summary focuses on statistics for the BGP table entries. The bottom of the output lists a heading line (highlighted in the output), plus one line per neighbor, with two neighbors in this case. The Neighbor column lists the IP address as defined on the local router’s neighbor command and not the neighbor’s BGP RID. Other notable information includes the neighbor’s ASN (as configured on the local router’s neighbor remote-as command), the time spent in the current state, and an inter-esting heading: State/PfxRcd. + +This State/PfxRcd heading either lists the BGP neighbor state, as summarized in Table 13-6, or the number of prefixes received (PfxRcd) from that neighbor. A numeric value under this heading implies a neighbor state of Established, because the peers must be in the Established state before Updates can be sent. If the peer is not in an Established state, the value in this heading lists the text name of the current BGP state. + +Example 13-4 shows a sample of the show ip bgp neighbors 1.1.1.1 command on Router E1, which displays information about the connection to Router I1-1 in Figure 13-16. This command lists several facts not seen in the shorter show ip bgp summary command out-put in Example 13-3. The example highlights some of those key items, with the following comments referring to those highlighted items, in order: + +■ The neighbor is an eBGP neighbor (external link). + +■ The neighbor’s BGP RID (1.1.1.1). + +■ The current state (Established) is explicitly listed. + +■ Route refresh is enabled. + +■ The eBGP multihop setting (two hops). + +■ Local and remote TCP socket information (IP addresses and port numbers). + +Example 13-4 Detailed Information with the show ip bgp neighbors Command + +E1# show ip bgp neighbors 1.1.1.1 +BGP neighbor is 1.1.1.1, remote AS 1, external link +BGP version 4, remote router ID 1.1.1.1 +BGP state = Established, up for 00:45:08 +Last read 00:00:02, last write 00:00:38, hold time is 180, keepalive interval is +60 seconds +Neighbor capabilities: +Route refresh: advertised and received(new) +Address family IPv4 Unicast: advertised and received +Message statistics: +InQ depth is 0 +OutQ depth is 0 + +Sent Rcvd +Opens: 2 2 +Notifications: 0 0 + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 573 + +Updates: 16 12 +Keepalives: 43 47 +Route Refresh: 0 0 +Total: 61 61 +Default minimum time between advertisement runs is 30 seconds + +For address family: IPv4 Unicast +BGP table version 26, neighbor version 26/0 + +Output queue size : 0 +Index 1, Offset 0, Mask 0x2 +1 update-group member +Sent +Prefix activity: ---- +Prefixes Current: 6 +Prefixes Total: 19 +Implicit Withdraw: 11 +Explicit Withdraw: 2 +Used as bestpath: n/a +Used as multipath: n/a + + + + +Rcvd +---- +6 (Consumes 312 bytes) +7 +0 +1 +5 +0 + + +Outbound Inbound +Local Policy Denied Prefixes: ---- ---- +AS_PATH loop: n/a 2 +Total: 0 2 +Number of NLRIs in the update sent: max 3, min 1 + +Address tracking is enabled, the RIB does have a route to 1.1.1.1 +Connections established 2; dropped 1 +Last reset 00:45:10, due to Peer closed the session +External BGP neighbor may be up to 2 hops away. +Transport(tcp) path-mtu-discovery is enabled +Connection state is ESTAB, I/O status: 1, unread input bytes: 0 +Connection is ECN Disabled, Minimum incoming TTL 0, Outgoing TTL 2 +Local host: 11.11.11.11, Local port: 179 +Foreign host: 1.1.1.1, Foreign port: 28995 +Connection tableid (VRF): 0 + +Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes) +Event Timers (current time is 0x8217A0): + +Timer +Retrans +TimeWait +AckHold +SendWnd +KeepAlive +GiveUp + +Starts Wakeups Next +49 0 0x0 +0 0 0x0 +49 46 0x0 +0 0 0x0 +0 0 0x0 +0 0 0x0 + + + + + +From the Library of Alexey Evseenko +574 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +PmtuAger 0 0 0x0 +DeadWait 0 0 0x0 +Linger 0 0 0x0 +ProcessQ 0 0 0x0 + +iss: 2070882650 snduna: 2070884280 sndnxt: 2070884280 sndwnd: 15890 +irs: 3327995414 rcvnxt: 3327996693 rcvwnd: 16156 delrcvwnd: 228 + +SRTT: 300 ms, RTTO: 306 ms, RTV: 6 ms, KRTT: 0 ms +minRTT: 0 ms, maxRTT: 300 ms, ACK hold: 200 ms +Status Flags: passive open, gen tcbs +Option Flags: nagle, path mtu capable, md5 +IP Precedence value : 6 + +Datagrams (max data segment is 516 bytes): +Rcvd: 98 (out of order: 0), with data: 50, total data bytes: 1278 +Sent: 99 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 50, total data bytes: 1629 +Packets received in fast path: 0, fast processed: 0, slow path: 0 +fast lock acquisition failures: 0, slow path: 0 +E1# show tcp brief + +TCB +66D27FE0 +66D27378 + +Local Address +192.168.1.1.179 +11.11.11.11.179 + +Foreign Address +192.168.1.2.16489 +1.1.1.1.28995 + +(state) +ESTAB +ESTAB + + +Note that the end of the example shows another command that you can use to confirm the TCP socket details of the underlying TCP connection: show tcp brief. + +Administratively Controlling Neighbor Status + +Interestingly, Cisco IOS provides a means by which network operations personnel can administratively disable any BGP neighbor. To do so, the operator would enter BGP con-figuration mode and issue the neighbor neighbor-ip shutdown command. This command brings down the current neighbor to an idle state. Later, when the BGP connection should be brought up, the operator should repeat the process, but with the no version of the command (no neighbor neighbor-ip shutdown). + +These commands can be particularly useful to try in a lab when learning BGP. Teamed with the debug ip bgp command, you can bring down neighbors and see the somewhat-readable BGP messages. These messages list the BGP states from Table 13-6. They also show the information inside the Open messages. Example 13-5 shows a sample, with the debug messages that note a state transition highlighted. The output also lists the show ip bgp summary command output, with the administratively idle state created by the neighbor 1.1.1.1 shutdown BGP configuration command on Router E1. + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 575 + +Example 13-5 BGP Shutdown and BGP Neighbor State Transitions + +E1# debug ip bgp +BGP debugging is on for address family: IPv4 Unicast +E1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +E1(config)# router bgp 11 +E1(config-router)# neighbor 1.1.1.1 shutdown +E1(config-router)# + +*Aug 11 20:23:01.335: BGPNSF state: 1.1.1.1 went from nsf_not_active to nsf_not_ +active +*Aug 11 20:23:01.335: BGP: 1.1.1.1 went from Established to Idle +*Aug 11 20:23:01.335: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down Admin. Shutdown + +E1(config-router)# do show ip bgp summary +! lines omitted for brevity + + +Neighbor V AS +1.1.1.1 4 1 +192.168.1.2 4 3 + +MsgRcvd +87 +173 + +MsgSent TblVer InQ OutQ +87 0 0 0 +183 41 0 0 + +Up/Down +00:00:06 +00:58:47 + +State/PfxRcd +Idle (Admin) +1 + + +E1(config-router)# no neighbor 1.1.1.1 shutdown +E1(config-router)# +*Aug 11 20:23:26.571: BGP: 1.1.1.1 went from Idle to Active +*Aug 11 20:23:26.571: BGP: 1.1.1.1 open active, local address 11.11.11.11 +*Aug 11 20:23:26.575: BGP: 1.1.1.1 read request no-op +*Aug 11 20:23:26.575: BGP: 1.1.1.1 went from Active to OpenSent +*Aug 11 20:23:26.575: BGP: 1.1.1.1 sending OPEN, version 4, my as: 11, holdtime 180 +seconds +*Aug 11 20:23:26.579: BGP: 1.1.1.1 send message type 1, length (incl. header) 45 +*Aug 11 20:23:26.583: BGP: 1.1.1.1 rcv message type 1, length (excl. header) 26 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 rcv OPEN, version 4, holdtime 180 seconds +*Aug 11 20:23:26.587: BGP: 1.1.1.1 rcv OPEN w/ OPTION parameter len: 16 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 rcvd OPEN w/ optional parameter type 2 +(Capability) len 6 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 OPEN has CAPABILITY code: 1, length 4 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 OPEN has MP_EXT CAP for afi/safi: 1/1 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 rcvd OPEN w/ optional parameter type 2 +(Capability) len 2 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 OPEN has CAPABILITY code: 128, length 0 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 OPEN has ROUTE-REFRESH capability(old) for all address-families +*Aug 11 20:23:26.587: BGP: 1.1.1.1 rcvd OPEN w/ optional parameter type 2 +(Capability) len 2 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 OPEN has CAPABILITY code: 2, length 0 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 OPEN has ROUTE-REFRESH capability(new) for all +address-families + + + +From the Library of Alexey Evseenko +576 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +BGP: 1.1.1.1 rcvd OPEN w/ remote AS 1 +*Aug 11 20:23:26.587: BGP: 1.1.1.1 went from OpenSent to OpenConfirm +*Aug 11 20:23:26.591: BGP: 1.1.1.1 went from OpenConfirm to Established +*Aug 11 20:23:26.591: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up +*Aug 11 20:23:26.603: BGP_Router: unhandled major event code 128, minor 0 + + +BGP Message Summary + +So far, this chapter has mentioned three of the four BGP messages. For reference, Table 13-7 lists the four BGP messages, with comparisons to EIGRP messages for perspective. + + +Table 13-7 Key +Topic Message + +Open + + +Keepalive + + + +Update + + +BGP Message Types + +Purpose +Used to establish a neighbor relationship and exchange basic parameters, including ASN and authentication values. +Sent on a periodic basis to maintain the neighbor relationship. The lack of receipt of a Keepalive message within the negotiated Hold timer causes BGP to bring down the neighbor connection. +Used to exchange PAs and the associated prefix/ length (NLRI) that use those attributes. + + + +Similarity with EIGRP +Hello + + +Hello + + + +Update + +Notification Used to signal a BGP error; typically results in a No direct equivalent reset to the neighbor relationship. + + +Verifying the BGP Table + +When an enterprise router has established its eBGP neighbor relationships, that router can advertise and learn routes using BGP. To learn routes, an enterprise BGP router does not need additional configuration beyond the configuration of eBGP neighbors, as discussed earlier. To advertise routes to eBGP peers, particularly the public IP address prefix(es) used by that enterprise, the enterprise BGP router needs some additional configuration, as discussed in the upcoming section “Injecting Routes into BGP for Advertisement to the ISPs.” + +The BGP table plays a key role in the process of learning and using routing information with BGP. A router stores all learned BGP prefixes and PAs in its BGP table. The router will later choose which route for each prefix is the best BGP route. The router can then advertise its BGP table to its neighbors, advertising only the best route for each prefix. + +This section begins with a brief examination of the BGP Update process by which BGP neighbors exchange routing information. Next, the text looks at the various show com-mands that can be used to examine and confirm the contents of the BGP table. + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 577 + +The BGP Update Message + +When a BGP neighborship reaches the Established state, those neighbors begin sending BGP Update messages to each other. The router receiving an Update places those learned prefixes into its BGP table, regardless of whether the route appears to be the best route. Like EIGRP and OSPF, BGP puts all learned routing information into its table, and then BGP processes all such potential routes to choose the best route for each prefix. + +The BGP Update message itself can be revealing about the motivations behind BGP. Figure 13-19 shows the format of the Update message. + +2 Bytes Wide + +Length (Bytes) of Withdrawn Routes Section + +Withdrawn Routes (Variable) + +Length (Bytes) of Path Attributes Section + +Path Attributes (Variable) + + +Prefix Length + +Prefix Length + +Prefix (Variable) + +Prefix (Variable) + +. +. +. + + +Figure 13-19 Format of the BGP Update Message + +Interestingly, the format of the Update message tells us something about the nature of BGP as a Path Vector algorithm. The message lists a set of PAs and then a potentially long list of prefixes that use that set of PAs. So, you might view the BGP Update message as focusing on advertising paths, or a set of PAs, along with the associated list of prefixes that use the advertised path. Because BGP uses the information in the combined set of PAs to make a decision of which path is best, its underlying logic is called path vector. + +BGP uses the Update message to both announce and withdraw routes. For example, when a router realizes that a route in the router’s BGP table has failed, that router withdraws that route by sending a BGP Update to its neighbors, listing the prefix in the list of with-drawn routes. When a router receives an Update that lists a prefix as withdrawn, that router knows that the route has failed. (Note the field near the top of the Update message that lists withdrawn routes.) That same Update message might contain other announced prefixes later in the Update message. + +Examining the BGP Table + +One of the key tasks in a BGP verification plan should be to examine the prefixes in the BGP table and confirm that the right prefixes have been learned from the expected + + + + +From the Library of Alexey Evseenko +578 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +neighbors. The BGP table should hold all learned prefixes, from each neighbor, except for any prefixes filtered by an inbound BGP filter. For example, in a router configured with +a neighbor route-map in command, the local router would first filter the routes and then add the allowed routes into the BGP table. + +As an example, consider Figure 13-20, which shows the same basic topology as Figure 13-16 but with only the information pertinent to the upcoming discussions listed in the figure. In this case, five prefixes exist somewhere in the Internet, with ISP1 and ISP3 learning these prefixes from ISP2. An additional prefix exists at the site of a customer of ISP3. The design calls for the following actions by ISP1 and ISP3 in their eBGP advertise-ments to the enterprise: + +■ ISP1 should supply a default route plus full BGP updates. + +■ ISP3 should supply a default route plus partial BGP updates that include only ISP3’s customers’ prefixes (for example, 192.135.250.0/28). + + +Enterprise + +RID 11.11.11.11 +.1 + + +ASN 1 ISP1 + +RID 1.1.1.1 +.2 + + +E1 .5 .6 I1-1 ASN 2 + + +192.168.1.1 + + + + + +192.168.1.2 + + + + + +ASN 3 ISP3 + +RID 3.3.3.3 + + +181.0.0.0/8 182.0.0.0/8 183.0.0.0/8 184.0.0.0/8 185.0.0.0/8 + + +I3-1 + + + + + +ASN 4 + + +192.135.250.0/28 + +Customer of ISP3 + +Figure 13-20 Three Prefixes to Be Advertised to E1 + +The show ip bgp output lists the entirety of the BGP routing table. Example 13-6 shows a sample from Router E1. Note that the configuration of this network is based on Example 13-2, with Routers E1 and I1-1 still using their loopback interfaces in their neighbor commands. + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 579 + +Example 13-6 E1’s BGP Table with Routes Learned from the ISPs + +E1# show ip bgp +BGP table version is 78, local router ID is 11.11.11.11 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +* 0.0.0.0 192.168.1.2 0 0 3 i + +*> +*> 181.0.0.0/8 +*> 182.0.0.0/8 +*> 183.0.0.0/8 +*> 184.0.0.0/8 +*> 185.0.0.0/8 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 + +0 0 1 i +0 1 2 111 111 i +0 1 2 222 i +0 1 2 i +0 1 2 i +0 1 2 i + +* 192.135.250.0/28 1.1.1.1 0 1 2 3 4 i +*> 192.168.1.2 0 3 4 i + +First, examine the overall format and the headings in the output of the show ip bgp com-mand. The Network column lists the prefix/length (NLRI). The Next Hop heading lists the next-hop IP address that would be used for the route. Then, skipping over to the far right, the Path heading lists the AS_PATH PA. (Note that it is difficult to see the begin-ning of the AS_PATH, but the weight [another PA] for each route is 0 in this case. So, the next number after the 0, in this case, is the beginning of the AS_PATH.) + +Next, focus on the last two lines of output from the show ip bgp command. Each of the last two lines describes a different route to reach 192.135.250.0/28—one with next-hop 1.1.1.1 (Router I1-1) and one with next-hop 192.168.1.2 (Router I3-1). Because the sec-ond of these two lines does not list a prefix (under the heading “Network”), the output implies that this line is just another route for the prefix listed on the previous line. Next, examine the highlighted AS_PATH values at the end of each of these lines. For the route through I1-1 (1.1.1.1), the AS_PATH lists ASNs 1, 2, 3, and 4. Similarly, the AS_PATH for the other route lists only ASNs 3 and 4. + + +Note The show ip bgp command lists the AS_PATH with the first-added ASN on the right and the last-added ASN on the left. BGP uses this convention, because when BGP adds an ASN to the AS_PATH, BGP prepends the ASN to the list, causing the new ASN to show up as the leftmost ASN in the AS_PATH. + + +Continuing to focus on the final two lines of the show ip bgp output, examine the far left part of the output and note that the second of these two lines has a > highlighted. Per the legend at the top of the command output, the > denotes the chosen best route. In this case, none of the routers inside the various ISPs set PAs for the purpose of influ-encing the best-path choice, so the first-used BGP best-path decision is the shortest + + + + +From the Library of Alexey Evseenko +580 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +AS_PATH. As a result, the path through ISP3, ASN 3, is best, having only two ASNs, compared to the path through ISP1, ASN 1, with four ASNs. + +You can confirm that all of E1’s BGP table entries were learned using eBGP, rather than iBGP, by the absence of the letter “i” in the third column. Immediately after the *>, a space appears in the output. If a route were learned with iBGP, an “i” would appear in this third character position. By implication, all the routes in Example 13-6 are eBGP routes because of the absence of the letter “i” in the third character of possible output. + +Finally, taking a broader view of the output of the show ip bgp command, consider which prefixes have two known routes and which have only one. Then, consider the design requirements listed before Example 13-6: I1-1 would advertise all prefixes, plus a default, but I3-1 would advertise only partial updates plus a default. As such, I3-1 did not advertise the prefixes that begin 181 through 185, by design, resulting in Router E1 only learning one route for each of these prefixes. + +E1 chose the route through I3-1 as the best route for prefix 192.135.250.0/28. Example 13-7 shows the details of the IP routing table entry for this route. + +Example 13-7 E1’s IP Route for 192.135.250.0/28 + +E1# show ip route 192.135.250.0 255.255.255.240 +Routing entry for 192.135.250.0/28 +Known via "bgp 11", distance 20, metric 0 +Tag 3, type external +Last update from 192.168.1.2 00:10:27 ago +Routing Descriptor Blocks: +* 192.168.1.2, from 192.168.1.2, 00:10:27 ago +Route metric is 0, traffic share count is 1 +AS Hops 2 +Route tag 3 + +The output of the show ip route 192.135.250.0 255.255.255.240 command lists the source of the route (BGP process 11), the next-hop router (192.168.1.2), and the AS Path length (AS Hops 2). The output also confirms that the route is an external (eBGP) route. + +Viewing Subsets of the BGP Table + +When accepting full or partial BGP updates, the sheer number of BGP table entries can be much too large for the show ip bgp command to be useful. The command could list thousands, or even hundreds of thousands, of prefixes. In practice, you need to be com-fortable with a variety of options on the show ip bgp command, each listing a different part of the BGP table. + +For example, you will likely want to look at BGP table entries for specific prefixes, including the default route prefix of 0.0.0.0/0. Additionally, you might want to see routes per neighbor, and see which routes were heard from that neighbor—and which of those routes passed through any inbound route filters to make it into the BGP table. Finally, to verify whether neighboring ISPs sent full or partial updates, you can look at counters for + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 581 + +the number of prefixes learned from each neighbor. Although you probably will never know the exact number of prefixes to expect, you should see a significant difference in the number of prefixes learned from a neighbor sending full updates as compared to a neighbor sending partial updates. + +Table 13-8 summarizes some of the key command options that can supply these subsets of information. + +Table 13-8 Verification Commands for eBGP-Learned Routes +Key +Topic Verification Step Command + + +List possible default routes + +List possible routes, per prefix + +List routes learned from one neighbor, before any inbound filtering is applied + + +show ip bgp 0.0.0.0 0.0.0.0 + +show ip bgp prefix [subnet-mask] + +show ip bgp neighbors ip-address received-routes + +List routes learned from a specific show ip bgp neighbors ip-address routes neighbor that passed any inbound filters + + +Lists routes advertised to a neighbor after applying outbound filtering + +List the number of prefixes learned per neighbor + + +show ip bgp neighbors ip-address advertised-routes +show ip bgp summary + + + +Example 13-8 shows a few samples of these commands on Router E1 from Figures 13-16 and 13-20. + +Example 13-8 Command Samples from Table 13-8 + +E1# show ip bgp 0.0.0.0 0.0.0.0 +BGP routing table entry for 0.0.0.0/0, version 75 +Paths: (2 available, best #2, table Default-IP-Routing-Table) +Advertised to update-groups: +1 +3 +192.168.1.2 from 192.168.1.2 ( 3.3.3.3) +Origin IGP, metric 0, localpref 100, valid, external +1 +1.1.1.1 from 1.1.1.1 (1.1.1.1 ) +Origin IGP, metric 0, localpref 100, valid, external, best + +E1# show ip bgp 192.135.250.0 +BGP routing table entry for 192.135.250.0/28, version 78 +Paths: (2 available, best #2, table Default-IP-Routing-Table) +Advertised to update-groups: +1 + + + + +From the Library of Alexey Evseenko +582 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1 2 3 4 +1.1.1.1 from 1.1.1.1 (1.1.1.1) +Origin IGP, localpref 100, valid, external +3 4 +192.168.1.2 from 192.168.1.2 (3.3.3.3) +Origin IGP, localpref 100, valid, external, best + +E1# show ip bgp summary +BGP router identifier 11.11.11.11, local AS number 11 +BGP table version is 78, main routing table version 78 +7 network entries using 924 bytes of memory +9 path entries using 468 bytes of memory +8/5 BGP path/bestpath attribute entries using 1184 bytes of memory +7 BGP AS-PATH entries using 168 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +Bitfield cache entries: current 1 (at peak 2) using 32 bytes of memory +BGP using 2776 total bytes of memory +BGP activity 7/0 prefixes, 53/44 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +1.1.1.1 4 1 186 189 +192.168.1.2 4 3 161 199 + +78 0 0 00:53:33 7 +78 0 0 00:51:48 2 + + +The first command, show ip bgp 0.0.0.0 0.0.0.0, displays details about the default routes in the BGP table. The output lists three lines per route, with the AS_PATH on the first line. Working through the highlighted portions of the output, in this case, the AS_PATH is either 3 or 1, because the ISP routers each originated the route, and those neighbor-ing ASNs are ASN 1 and ASN 3. The output also lists the next-hop address of the route (192.168.1.2 and 1.1.1.1) and the neighbor’s BGP RID (I1-1’s is 1.1.1.1 and I3-1’s is 3.3.3.3). +Finally, instead of the > seen in the output of show ip bgp, this command simply lists the term “best” for the best route. + +The next command, show ip bgp 192.135.250.0, looks much like the first. In this case, with no subnet mask listed in the command, Cisco IOS displays information for any pre-fix 192.135.250.0 regardless of prefix length. The output again lists three lines per route beginning with the AS_PATH values (as highlighted). + +The final command, listed earlier in Table 13-8, show ip bgp summary, lists the num-ber of prefixes received from each neighbor on the far right side. Also, you can see the +amount of memory used for the prefixes (listed as network entries) and for different PAs. + +The rest of the commands from Table 13-8 focus on displaying information relative to whether BGP filtering has yet occurred. The first, show ip bgp neighbors ip-address received-routes, lists routes received from the neighbor before inbound BGP filtering. The second, show ip bgp neighbors ip-address routes, lists routes received from that neighbor that passed through any inbound filtering. These commands are particularly useful when verifying the results of any configured BGP filters or route maps. + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 583 + +Injecting Routes into BGP for Advertisement to the ISPs + +So far, this chapter has focused on configuring eBGP peers and the routes learned by enterprise routers from eBGP peers at ISPs. These outbound routes let the enterprise routers forward packets toward the Internet. + +At the same time, the ISPs need to learn routes for the enterprise’s public IP address space. This chapter assumes that the choice to use BGP has already been made, so using BGP to advertise the enterprise’s public IP address range makes good sense. This short final major section of this chapter examines the options for advertising these routes. Specifically, this section looks at two options: + +■ BGP network command + +■ Redistribution from an IGP + + +Injecting Routes Using the network Command + +The BGP network router subcommand differs significantly from the network command used by IGPs. For OSPF and EIGRP, the network command lists parameters that the rout-er then compares to all its interface IP addresses. If matched, the router enables the IGP routing protocol on those interfaces. BGP does not use the network command to enable BGP on interfaces—in fact, BGP has no concept of being enabled on interfaces. For a point of comparison, note that the show ip ospf interface and show ip eigrp interfaces commands identify the enabled interfaces for OSPF and EIGRP, respectively, but no such equivalent BGP command even exists. + +The BGP network command does cause a comparison to occur, but the comparison occurs between the network command’s parameters and the contents of that router’s IP routing table, as follows: + +Look for a route in the router’s current IP routing table that exactly matches the parameters of the network command; if a route for that exact prefix/length exists, put the equivalent prefix/length into the local BGP table. + + +Note The preceding statement, and the remaining logic in this section, assumes a BGP default setting of no auto-summary. The effect of reversing this setting to auto-summary is described in the next section. + + +For example, the enterprise shown earlier on the left side of Figure 13-16 might use a private address range and use NAT to translate to usable public addresses. For example, the enterprise might use private Class A network 10.0.0.0 for all private address needs and public address block 128.107.0.0/19 for public addresses. Enterprise Router E1 would then need to advertise the public prefix (128.107.0.0/19) to its ISPs, but not the private address range. Example 13-9 shows an example. + + + + +From the Library of Alexey Evseenko +584 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 13-9 E1’s Configuration of a network Command to Advertise Prefixes with eBGP + +router bgp 11 +network 128.107.0.0 mask 255.255.224.0 +E1# sh ip bgp +BGP table version is 9, local router ID is 11.11.11.11 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +* 0.0.0.0 192.168.1.2 0 0 3 i + +*> +*> 128.107.0.0/19 +*> 181.0.0.0/8 +*> 182.0.0.0/8 +*> 183.0.0.0/8 +*> 184.0.0.0/8 +*> 185.0.0.0/8 + +1.1.1.1 +10.1.1.66 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 + +0 0 1 i +3 32768 i +0 1 2 111 111 i +0 1 2 222 i +0 1 2 i +0 1 2 i +0 1 2 i + +* 192.135.250.0/28 1.1.1.1 0 1 2 3 4 i +*> 192.168.1.2 0 3 4 i + +The network 128.107.0.0 mask 255.255.224.0 command lists both the subnet number and mask. It adds this prefix to the BGP table only if the exact prefix with that same mask exists in Router E1’s routing table. In this case, such a route existed, so the show ip bgp command output that follows now lists 128.107.0.0/19 in the BGP table. + +In some cases, the Internet-connected router might not have a single route for the entire public prefix. For example, with such a large range of public addresses as 128.107.0.0/19, the enterprise will most likely have broken that range into subnets, and the enterprise router might not have a route for the entire range. For example, Router E1 might see routes for 128.107.1.0/24, 128.107.2.0/24, and so on but no route for 128.107.0.0/19. + +When a router knows routes only for subsets of the prefix that needs to be advertised, an additional step is needed when using the network command. For example, the network 128.107.0.0 mask 255.255.224.0 command will not add this prefix to the BGP table even if routes for subsets of this range exist, such as 128.107.1.0/24. So, either configure +a static route for the entire range, with outgoing interface null0, on the Internet-facing router, or use IGP route summarization to create a summary route for the entire prefix with IGP. + + +Note The static route for 128.107.0.0/19 to null0—a discard route—is not meant to be advertised to other routers. Its only purpose is to enable the operation of the network command. This discard route should not cause routing problems on the local router, because of the more specific routes for subnets inside the same range of addresses. + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 585 + +Finally, the network command examples in this section use the mask parameter, but if omitted, Cisco IOS assumes a classful network mask. For example, a network 9.0.0.0 command assumes a Class A default mask of 255.0.0.0, and the network 128.1.0.0 com-mand assumes a Class B default mask of 255.255.0.0. + +The Effect of auto-summary on the BGP network Command + +As of Cisco IOS Release 15.1 mainline, BGP defaults to a setting of no auto-summary, and the previous section’s discussion of the network command assumed this default setting. However, if the configuration is changed to auto-summary, Cisco IOS makes a small change in how it interprets the network command. + +The change in logic occurs only when the network command omits its mask parameter; there is no difference in logic if the mask parameter is explicitly configured. When the network command refers to a Class A, B, or C network, with no mask parameter con-figured and with auto-summary configured, the router adds a route for that classful net-work to the BGP table under one of the following conditions: + +■ If the exact classful route is in the IP routing table + +■ If any subset routes of that classful network are in the routing table + +In summary, of the two actions in the list, the first occurs regardless of the auto-summary setting and the second occurs only if auto-summary is configured. + +For example, with network 9.0.0.0 configured, regardless of the auto-summary setting, if a route to 9.0.0.0/8 exists, the router adds 9.0.0.0/8 to the BGP table. However, if the network 9.0.0.0 (without the mask parameter) and the auto-summary commands were both configured, and if only a subset route exists (for example, 9.1.1.0/24), but no route for exactly 9.0.0.0/8 exists, the router still adds a route for the classful network (9.0.0.0/8) to the BGP table. This second example demonstrates the additional logic that occurs with the auto-summary command configured. + +Injecting Routes Using Redistribution + +Instead of using a BGP network command to add routes to the BGP table, the enterprise BGP routers can instead redistribute routes from an IGP into BGP. The end goals are the same: + +■ Inject the public address range, but not the private IP address range, into the BGP table. + +■ Advertise one route for the public address range, instead of any individual subnets of the range. + +The enterprise routers that run BGP often already run the IGP as well and have learned routes for either the entire public range as one route or with subset routes. If a single route exists for the entire public range, for example, the 128.107.0.0/19 range used in the last several examples, the engineer simply needs to add a redistribute command to the + + + + +From the Library of Alexey Evseenko +586 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +BGP configuration to redistribute that route, and only that route, into BGP. If only subset routes exist, one of several additional steps needs to be taken to meet the design goal to inject one route for the entire public address range. + +Example 13-10 shows the majority of the work in a case for which Router E1 has three subset routes in the 128.107.0.0/19 range: 128.107.1.0/24, 128.107.2.0/24, and 128.107.3.0/24. However, E1 does not have a single route for the entire 128.107.0.0/19 public prefix. The configuration matches prefixes in the public range and redistributes them into BGP. + +Example 13-10 Redistributing OSPF into BGP, but for Public Range Only + +router bgp 11 +redistribute ospf 1 route-map only-128-107 +! +route-map only-128-107 permit +match ip address prefix 128-107 +! +ip prefix-list 128-107 permit 128.107.0.0/19 le 32 + +E1# show ip route 128.107.0.0 255.255.224.0 longer-prefixes +! Legend omitted for brevity + +Gateway of last resort is 1.1.1.1 to network 0.0.0.0 + +128.107.0.0/24 is subnetted, 3 subnets +O 128.107.3.0 [110/3] via 10.1.1.66, 00:05:26, FastEthernet0/0 +O 128.107.2.0 [110/3] via 10.1.1.66, 00:05:26, FastEthernet0/0 +O 128.107.1.0 [110/3] via 10.1.1.66, 00:05:36, FastEthernet0/0 + +E1# show ip bgp 128.107.0.0/19 longer-prefixes +BGP table version is 11, local router ID is 11.11.11.11 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 128.107.1.0/24 +*> 128.107.2.0/24 +*> 128.107.3.0/24 + +10.1.1.66 +10.1.1.66 +10.1.1.66 + +3 32768 ? +3 32768 ? +3 32768 ? + + +The two show commands following the configuration list the IP routes that should match the redistribution configuration, and the resulting BGP table entries. The show ip route 128.107.0.0 255.255.224.0 longer-prefixes command lists all three IP routes in the pub-lic address range in this case. The show ip bgp 128.107.0.0/19 longer-prefixes command shows the same range, listing the three BGP table entries created by the redistribute ospf command. These BGP table entries list the same next-hop IP addresses listed in the OSPF routes in the IP routing table, with the same metrics. + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 587 + +Left as is, this configuration results in Router E1 advertising all three BGP routes to the ISPs. However, to reach the goal of advertising only a single route for the entire public prefix 128.107.0.0/19, another step must be taken, typically one of the following: + +■ Use IGP route summarization to create the route for the entire prefix. + +■ Configure a null static route (a discard route) for the entire prefix on the Internet-connected router. + +■ Configure BGP route summarization to make BGP advertise only the entire prefix. + +The first two would cause Router E1 to list a route for the entire public pre- +fix—128.107.0.0/19 in this case—in its IP routing table. The redistribution configuration could then be changed so that only that exact prefix would be redistributed. (For exam-ple, removing the le 32 parameter from the ip prefix-list 128-107 permit 128.107.0.0/19 le 32 command would make this command match only the exact route.) + +The third option would be to use BGP route summarization, telling Router E1 that when any subset routes of 128.107.0.0/19 exist in the BGP table, advertise only 128.107.0.0/19 but none of the subset routes. Example 13-11 shows this last option. + +Example 13-11 BGP aggregate-address Command to Advertise the Entire Public IP Address Prefix + +E1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +E1(config)# router bgp 11 +E1(config-router)# aggregate-address 128.107.0.0 255.255.224.0 summary-only +E1(config-router)# ^Z + +E1# show ip bgp 128.107.0.0/19 longer-prefixes +BGP table version is 15, local router ID is 11.11.11.11 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + + +Network +*> 128.107.0.0/19 + +Next Hop +0.0.0.0 + +Metric LocPrf Weight Path +32768 i + + + +s> 128.107.1.0/24 +s> 128.107.2.0/24 +s> 128.107.3.0/24 + +10.1.1.66 +10.1.1.66 +10.1.1.66 + +3 32768 ? +3 32768 ? +3 32768 ? + + +Note that with the addition of the aggregate-address command, the BGP table now also has a route for 128.107.0.0/19, which will be advertised to E1’s neighbors at the two ISPs. Also, the summary-only keyword in the aggregate-address command tells Cisco IOS +to suppress the advertisement of the subset routes, as noted by the code “s” beside the other three routes listed at the end of the example. + + + + + + +From the Library of Alexey Evseenko +588 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 13-9 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an imple-mentation plan, what implementation options come to mind? You should write a general description; specific configuration commands are not required. + +Table 13-9 Design Review + + +Design Goal + +A design shows a single router connected to the Internet as part of a single-homed Internet design. It lists sections for enterprise routing toward +the Internet-facing router(s) in the enterprise, and another section for choosing routes on the Internet-facing router into the Internet. List the reasonable options. +Use the same criteria as the previous item in this table, except the single enterprise router connected to the Internet now has two links to the same ISP (dual-homed). +Use the same criteria as the previous item, except use two routers with one link each to the same ISP (dual-homed). + +Possible Implementation Choices Covered in This Chapter + +Use the same criteria as the previous row, but with a single-multihomed connection with two routers. +The plan shows the use of public prefix 200.1.1.0/26 by an enterprise. What methods should you consider adding to your implementation plan for advertising that prefix to your ISPs using BGP? (2) + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 589 + +Implementation Plan Peer Review Table + +Table 13-10 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 13-10 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +The plan shows a single router in a dual-homed Internet design, with the router using BGP over each link to that same ISP. What criteria would impact your choice of accepting only default routes, or partial updates, or full updates, using BGP in this case? (3) +The plan shows four enterprise routers with BGP configuration, with two of those routers with links to two different ISPs. Which connections are eBGP? iBGP? +The plan shows enterprise Router R1, with two parallel Layer 3 paths to ISP Router R2, with a need for BGP. What options exist for high availability eBGP peering? (2) Which is better? +The implementation plan shows an enterprise router with an eBGP connection to an ISP router, using a loopback interface as the Update source. What other feature must be configured to make the eBGP connection work? +Router R1 connects through eBGP to Router I1 at ISP1. R1 has routes for 130.1.1.0/24 and 130.1.2.0/24 in its routing table. The design claims the company uses 130.1.0.0/21 as its public range. What methods can be used to advertise one route for the entire range to the eBGP peer? (2) + + + +Create an Implementation Plan Table + +This chapter does not focus on implementation or verification, but it did review one con-cept about static routes, as listed in Table 13-11. + + + + + +From the Library of Alexey Evseenko +590 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 13-11 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Configure multiple static default routes, each with different administrative distance settings +Configure an eBGP connection as follows: local AS 1, remote AS 2, remote router uses 1.1.1.1 for BGP peering, with 1.1.1.1 being an IP address on a common link between the routers. +Configure an eBGP connection as follows: local AS 1, remote AS 2, local uses loopback1 (1.1.1.1), remote uses loopback2 (2.2.2.2). +Administratively disable the neighbor configured in the previous two items in this table. +Reenable the neighbor that was disabled in the previous row of this table. +Cause the advertisement of IGP-learned prefix 130.1.1.0/24 to the neighbor configured in this table, without redistribution. +Repeat the task in the previous row of this table, but this time with route redistribution, assuming that OSPF process 1 is used for the IGP. + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own verification plan, list in Table 13-12 all commands that supply the requested information. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 13-12 Verification Plan Memory Drill + +Information Needed Commands +Display a single-line neighbor status for each iBGP neighbor. +Display the number of prefixes learned from a neighbor. (List where the information is located.) + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 591 + + +Information Needed Commands +Display the number of prefixes advertised to a neighbor. (List where the information is located.) +Display the local and neighbor ASN. + +Display the number of eBGP hops allowed. + +List the current TCP ports used for BGP connections. +List all prefixes in the BGP table. + +List all the best routes in the BGP table. + +Find the AS_PATH for each BGP table entry. (Describe how.) +Determine whether a particular BGP table entry is iBGP-learned. (Describe how.) +Display one-line entries for all BGP table entries with a given prefix/length, plus any subnets inside that range. +List possible default routes. + +List possible routes per prefix. + +List routes learned from one neighbor, which passed any inbound filters. +List routes learned from one neighbor before any inbound filtering is applied. +Display routes suppressed and added to the BGP table because of BGP route summarization (aggregation). + + +Note Some of the entries in this table might not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 13-13 lists a reference of these key topics and the page numbers on which each is found. + + + + + + + +From the Library of Alexey Evseenko +592 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 13-13 Key Topics for Chapter 13 Key +Topic Key Topic Element Description Page Number + + +Figure 13-1 + +Table 13-4 + +List + +Figure 13-5 + +Conceptual View of Public IPv4 Address Assignment 541 + +Comparing OSPF and EIGRP Logic to BGP 546 + +Two key functions for BGP AS_PATH 547 + +Advertisement of NLRI to Demonstrate AS_PATH 548 + + + +Figure 13-7 + +Table 13-5 + +List + +Figure 13-9 + +Figure 13-12 + +List + +Figure 13-15 + +List + +List + +List + +Figure 13-17 + +List + +Figure 13-18 + +Table 13-6 + +Table 13-7 + +Table 13-8 + +Duplicate ASN (12) Preventing Route Advertisement 550 + +16-Bit ASN Assignment Categories from IANA 551 + +Description of the terms single-homed, dual-homed, 553 single-multihomed, and dual-multihomed +Dual-Homed Design Options 555 + +Routing Loop Without BGP in the Enterprise Core 559 + +Three options for the routes received from an ISP 560 + +Dual-Multihomed Options 563 + +Minimal eBGP configuration checklist 564 + +Required plus commonly used optional eBGP 565 configuration command list +Rules for how a router chooses its BGP Router ID 566 + +Default Choice for Update Source 567 + +eBGP configuration checklist including use of 568 loopbacks as Update source and eBGP Multihop +Using Loopbacks with Update Source for eBGP 569 + +BGP Neighbor States 570 + +BGP Message Types 576 + +Verification Commands for eBGP-Learned Routes 581 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 13: Fundamental BGP Concepts 593 + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +public IP address, private IP address, Network Address Translation (NAT), Port Address Translation (PAT), AS_SEQUENCE, Path Attribute (PA), AS path, public ASN, private ASN, default route, single-homed, dual-homed, single-multihomed, dual-multihomed, autonomous system number (ASN), eBGP multihop, Update Source (BGP), Established (BGP state), Open, Update, Active (BGP state), BGP table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Internal BGP Between Internet-Connected Routers: This section examines the need for iBGP peering inside an enterprise, and both the required and the commonly used optional configuration settings. + +■ Avoiding Routing Loops When Forwarding Toward the Internet: This section discusses the issues that can occur when Internet-connected rout-ers forward packets to each other through routers that do not use BGP, and how such a design requires some means to supply BGP-learned routes to the internal enterprise routers. +■ Route Filtering and Clearing BGP Peers: This section gives a brief description of the options for filtering the contents of BGP Updates, along with explaining some operational issues related to the BGP clear command. +■ BGP Path Attributes and Best Path Algorithm: This section describes the BGP Path Attributes (PA) that have an impact on the BGP best path algo-rithm–the algorithm BGP uses to choose the best BGP route for each destination prefix. +■ Influencing an Enterprise’s Outbound Routes: This section shows how to use the BGP features that influence the BGP best path algorithm. +■ Influencing an Enterprise’s Inbound Routes with MED: This section shows how to use the Multi-Exit Discriminator (MED) BGP feature that influences the BGP best path algorithm for inbound routes. + + + + + + +From the Library of Alexey Evseenko +CHAPTER 14 + + + + + + +Advanced BGP Concepts + + +Outbound routing is simple with a single Internet-connected router. An enterprise interior gateway protocol (IGP) could flood a default route throughout the enterprise, funnel- +ing all Internet traffic toward the one Internet-connected router. That router could then choose the best route to any and all Internet destinations it learned with external BGP (eBGP). + +With two (or more) Internet-connected routers in a single enterprise, additional issues arise; in particular, issues related to outbound routing. These issues require the use of Border Gateway Protocol (BGP) between enterprise routers. In some cases, the design might require BGP even on enterprise routers that do not peer with routers at the vari-ous Internet service providers (ISP). This chapter examines the scenarios in which using internal BGP (iBGP) makes sense, and shows the related configuration and verification commands. + +This chapter begins by focusing on the issues that can occur when an enterprise uses +a pair of Internet-connected routers. Specifically, the examples use the sample network shown in Figure 14-1. This design uses the same ISPs and ISP routers as in Chapter 13, “Fundamental BGP Concepts,” with familiar IP address ranges but with a few different links. The design now also shows two of the core routers (actually Layer 3 switches) inside the enterprise—routers that do not directly connect to any ISP. Figure 14-1 shows the design that will be referenced in the first few sections of this chapter. + + +Note Figure 14-1 shows the IP addresses as just the last octet of the address; in these cases, the first three octets are 10.1.1. + + +The first section of this chapter focuses on concepts, configuration, and verification of the iBGP connection between E1 and E2 in the figure. The second major section of this chapter, “Avoiding Routing Loops When Forwarding Toward the Internet,” examines the need for iBGP on routers internal to the enterprise, such as Routers Core1 and Core2 in the figure. The third section of this chapter examines the process of filtering both iBGP and eBGP routing updates. + +IGPs choose the best route based on some very straightforward concepts. Routing Information Protocol (RIP) uses the least number of router hops between a router and the destination subnet. Enhanced Interior Gateway Routing Protocol (EIGRP) uses a for-mula based on a combination of the constraining bandwidth and least delay, and Open Shortest Path First (OSPF) uses lowest cost with that cost based on bandwidth. + + + +From the Library of Alexey Evseenko +596 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +ASN 11 Enterprise + +Core1 +S0/0/0 .1 + + +ASN 1 ISP1 + + +S0/0/0 .2 + + +E1 S0/0/1 .5 S0/0/1 .6 I1-1 ASN 2 ISP2 Fa0/1 .9 + + + +Rest of Enterprise + + +I2-1 +ASN 3 ISP3 + + + +Fa0/1 .10 + +E2 +Core2 + + +S0/0/0 +192.168.1.5 + + +S0/0/0 192.168.1.6 I3-1 + + + + +ASN 4 + + +192.135.250.0/28 + +Customer of ISP3 + +Figure 14-1 Dual Internet Router Design Used in Chapter 14 + +BGP uses a much more detailed process to choose the best BGP route. BGP does not consider router hops, bandwidth, or delay when choosing the best route to reach each subnet. Instead, BGP defines several items to compare about the competing routes, in a particular order. Some of these comparisons use BGP features that can be set based on the router configuration, allowing network engineers to then influence which path BGP chooses as the best path. + +BGP’s broader set of tools allows much more flexibility when influencing the choice of best route. This BGP best-path process also requires only simple comparisons by the router to choose the best route for a prefix. Although the detail of the BGP best-path selection process requires more work to understand, that complexity gives engineers additional design and implementation options, and gives engineers many options to achieve their goals when working with the large interconnected networks that comprise the Internet. + +This chapter completes the BGP coverage in this book by examining the topic of BGP Path Control, including BGP Path Attributes, the BGP Best Path selection process, along with a discussion of how to use four different features to influence the choice of best path by setting BGP Path Attribute (PA) values. + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 597 + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than two of these 14 self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 14-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 14-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Internal BGP Between Internet-Connected Routers + +BGP Synchronization and iBGP Meshes + +Route Filtering and Clearing BGP Peers + +BGP Path Attributes and Best-Path Algorithm + +Influencing an Enterprise’s Outbound Routes + +Influencing an Enterprise’s Inbound Routes with MED + +Questions +1–4 + +5 + +6–8 + +9–11 + +12, 13 + +14 + + +1. R1 in ASN 1 with loopback1 address 1.1.1.1 needs to be configured with an iBGP connection to R2 with loopback2 IP address 2.2.2.2. The connection should use the loopbacks. Which of the following commands is required on R1? +a. neighbor 1.1.1.1 remote-as 1 + +b. neighbor 2.2.2.2 remote-as 2 + +c. neighbor 2.2.2.2 update-source loopback1 + +d. neighbor 2.2.2.2 ibgp-multihop 2 + +e. neighbor 2.2.2.2 ibgp-mode + +2. The following output occurred as a result of the show ip bgp command on Router R1. The output shows all BGP table entries on R1. How many iBGP-learned routes exist on this router? + + +*>i181.0.0.0/8 +*>i182.0.0.0/8 +*>i183.0.0.0/8 +*>i184.0.0.0/8 + +10.100.1.1 +10.100.1.1 +10.100.1.1 +10.100.1.1 + +0 100 0 1 2 111 112 i +0 100 0 1 2 222 i +0 100 0 1 2 i +0 100 0 1 2 i + +*> 192.135.250.0/28 192.168.1.6 0 3 4 i + +a. 1 + +b. 2 + +c. 3 + +d. 4 + +e. 5 + + + +From the Library of Alexey Evseenko +598 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +3. The following output on Router R1 lists details of a BGP route for 190.1.0.0/16. Which of the following are true based on this output? (Choose two.) + +R1# show ip bgp 190.1.0.0/16 +BGP routing table entry for 190.1.0.0/16, version 121 +Paths: (1 available, best #1, table Default-IP-Routing-Table) +Advertised to update-groups: +1 +1 2 3 4 +1.1.1.1 from 2.2.2.2 (3.3.3.3) +Origin IGP, metric 0, localpref 100, valid, internal, best + +a. R1 has a neighbor 1.1.1.1 command configured. + +b. R1 has a neighbor 2.2.2.2 command configured. + +c. The show ip bgp command lists a line for 190.1.0.0/16 with both an > and an i on the left. + +d. R1 is in ASN 1. + +4. A company uses Routers R1 and R2 to connect to ISP1 and ISP2, respectively, with Routers I1 and I2 used at the ISPs. R1 peers with I1 and R2. R2 peers with I2 and R1. Assuming that as many default settings as possible are used on all four routers, which of the following is true about the next-hop IP address for routes R1 learns over its iBGP connection to R2? +a. The next hop is I2’s BGP RID. + +b. The next hop is I2’s IP address used on the R2-I2 neighbor relationship. + +c. The next hop is R2’s BGP RID. + +d. The next hop is R2’s IP address used on the R1-R2 neighbor relationship. + +5. A company uses Routers R1 and R2 to connect to ISP1 and ISP2, respectively, with Routers I1 and I2 used at the ISPs. R1 peers with I1 and R2. R2 peers with I2 and R1. R1 and R2 do not share a common subnet, relying on other routers internal to the enterprise for IP connectivity between the two routers. Which of the following could be used to prevent potential routing loops in this design? (Choose two.) +a. Using an iBGP mesh inside the enterprise core + +b. Configuring default routes in the enterprise pointing to both R1 and R2 + +c. Redistributing BGP routes into the enterprise IGP + +d. Tunneling the packets for the iBGP connection between R1 and R2 + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 599 + +6. R1 is currently advertising prefixes 1.0.0.0/8, 2.0.0.0/8, and 3.0.0.0/8 over its eBGP connection to neighbor 2.2.2.2 (R2). An engineer configures a prefix list (fred) on R1 that permits only 2.0.0.0/8 and then enables the filter with the neighbor R2 prefix-list fred out command. Upon exiting configuration mode, the engineer uses some show commands on R1, but no other commands. Which of the following is true in this case? +a. The show ip bgp neighbor 2.2.2.2 received-routes command lists the three original prefixes. + +b. The show ip bgp neighbor 2.2.2.2 advertised-routes command lists the three original prefixes. + +c. The show ip bgp neighbor 2.2.2.2 routes command lists the three original prefixes. + +d. The show ip bgp neighbor 2.2.2.2 routes command lists only 2.0.0.0/8. + +e. The show ip bgp neighbor 2.2.2.2 advertised-routes command lists only 2.0.0.0/8. + +7. Which of the following BGP filtering methods enabled with the neighbor command will filter BGP prefixes based on the prefix and prefix length? (Choose three.) + +a. A neighbor distribute-list out command, referencing a standard ACL + +b. A neighbor prefix-list out command + +c. A neighbor filter-list out command + +d. A neighbor distribute-list out command, referencing an extended ACL + +e. A neighbor route-map out command + +8. Which of the following commands cause a router to bring down BGP neighbor rela-tionships? (Choose two.) + +a. clear ip bgp * + +b. clear ip bgp 1.1.1.1 + +c. clear ip bgp * soft + +d. clear ip bgp 1.1.1.1 out + +9. An engineer is preparing an implementation plan in which the configuration needs to influence BGP’s choice of best path. Which of the following is least likely to be used by the configuration in this implementation plan? +a. Weight + +b. Origin code + +c. AS_Path + +d. Local_Pref + + + + + +From the Library of Alexey Evseenko +600 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +10. Router R1 learns two routes with BGP for prefix 200.1.0.0/16. Comparing the two routes, route 1 has a longer AS_Path Length, bigger MED, bigger Weight, and smaller Local Preference. Which of the following is true about Router R1’s choice of best path for this prefix? +a. Route 1 is the best route. + +b. Route 2 is the best route. + +c. The routes tie as best, but one will be picked to be placed in the routing table based on tiebreakers. + +d. Neither route is considered best. + +11. Router R1 learns two routes with BGP for prefix 200.1.0.0/16. Comparing the two routes, route 1 has a shorter AS_Path Length, smaller MED, the same Weight, and smaller Local Preference. Which of the following is true about Router R1’s choice of best path for this prefix? +a. Route 1 is the best route. + +b. Route 2 is the best route. + +c. The routes tie as best, but one will be picked to be placed in the routing table based on tiebreakers. + +d. Neither route is considered best. + +12. An engineer has been told to create an implementation plan to influence the choice of best BGP route on a single router using the Weight feature. The sole enterprise Internet-connected router, Ent1, has neighbor relationships with Routers ISP1 and ISP2, which reside inside two different ISPs. The goal is to prefer all routes learned from ISP1 over ISP2 using Weight. Which of the following answers list a configura-tion step that would not be useful for achieving these goals? (Choose two.) +a. Configuring the neighbor weight command on Ent1 + +b. Having the ISPs configure the neighbor route-map out command on ISP1 and ISP2, with the route map setting the Weight + +c. Configuring the set weight command inside a route map on Router Ent1 + +d. Configuring a prefix list to match all Class C networks + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 601 + +13. An enterprise router, Ent1, displays the following excerpt from the show ip bgp command. Ent1 has an eBGP connection to an ISP router with address 3.3.3.3 and an iBGP connection to a router with address 4.4.4.4. Which of the following is most likely to be true? + +Network Next Hop Metric LocPrf Weight Path +*> 3.3.3.3 0 0 1 1 1 1 2 18 i + +a. The enterprise likely uses ASN 1. + +b. The neighboring ISP likely uses ASN 1. + +c. The route has been advertised through ASN 1 multiple times. + +d. Router Ent1 will add another ASN to the AS_Path before advertising this route to its iBGP peer (4.4.4.4). + +14. The following line of output was gathered on enterprise Router Ent1 using the com-mand show ip route. Which of the following answers is most likely to be true, based on this output? +B 128.107.0.0 [20/10] via 11.11.11.11, 00:02:18 + +a. This router has set the Weight of this route to 10. + +b. This router’s BGP table lists this route as an iBGP route. + +c. This router’s MED has been set to 10. + +d. This router’s BGP table lists an AS_Path length of 10 for this route. + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +602 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Foundation Topics + + +Internal BGP Between Internet-Connected Routers + +When an enterprise uses more than one router to connect to the Internet, and those rout-ers use BGP to exchange routing information with their ISPs, those same routers need +to exchange BGP routes with each other as well. The BGP neighbor relationships occur inside that enterprise—inside a single AS—making these routers iBGP peers. + +This first major section of this chapter begins with a look at why two Internet-connected routers need to have an iBGP neighbor relationship. Then, the text looks at various iBGP configuration and verification commands. Finally, the discussion turns to a common issue that occurs with next-hop reachability between iBGP peers, with an examination of the options to overcome the problem. + +Establishing the Need for iBGP with Two Internet-Connected Routers + +Two Internet-connected routers in an enterprise need to communicate BGP routes to each other, because these routers might want to forward IP packets to the other Internet-connected router, which in turn would forward the packet to the Internet. With an iBGP peer connection, each Internet-connected router can learn routes from the other router and decide whether that other router has a better route to reach some destinations in the Internet. Without that iBGP connection, the routers have no way to know whether the other router has a better BGP path. + +For example, consider Figure 14-2, which shows two such cases. + + + +ASN 1 ISP1 + +Full Updates + +Default + + + + + + +IGP Default Routes Lead Packets to Either E1 or E2 + + +E1 +.9 To 181.0.0.0/8 + + + + +.10 + + +I1-1 + + +ASN 3 ISP3 + +ASN 2 ISP2 + + + +181.0.0.0/8 + + + +E2 I3-1 +To 192.135.250.0/28 + + + +Partial Updates (no 181.0.0.0/8) + Default + + +ASN 4 +192.135.250.0/28 + +Figure 14-2 Choosing the Best Routes from ASN 11 to 181.0.0.0/8 and 192.135.250.0/28 + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 603 + +The figure shows a topology that uses the following design options, as agreed upon with ISP1 and ISP3: + +■ ISP1 sends full routing updates and a default route. + +■ ISP3 sends partial updates and a default route. + +First, consider the eBGP routing updates, particularly for the two prefixes highlighted in the figure. Both ISP1 and ISP3 know routes for 181.0.0.0/8, but ISP3’s agreement with the enterprise is that ISP3 sends partial updates. This usually means that ISP3 sends updates for prefixes in its own autonomous system number (ASN) plus prefixes for cus-tomers attached to its ASN, such as 192.135.250.0/28 in this case. ISP1, however, sends full updates. So, E1 learns an eBGP route for both 181.0.0.0/8 and 192.135.250.0/28, but Router E2 only learns an eBGP route for 192.135.250.0/28. + +Next, take a closer look at the routes for 181.0.0.0/8, both on E1 and E2. Only E1 learns an eBGP route for 181.0.0.0/8; E2 does not, because of ISP3’s partial updates. If E1 and E2 did not use iBGP between each other, E2 would never know that E1 had a good route for 181.0.0.0/8. Without an iBGP connection, packets destined to hosts in 181.0.0.0/8, if they arrived at E2, would be sent to ISP3 because of E2’s default route learned from ISP3. However, if E1 and E2 form an iBGP neighbor relationship, E2 would know a route for 181.0.0.0/8 through E1 and would choose this route as its best route and would forward such packets to E1. Then E1 would forward the packets to ISP1, as shown in the figure. + +Finally, take a closer look at the routes for 192.135.250.0/28 on both E1 and E2. If none of the ISPs changed the default PA settings for these routes, both E1 and E2 would choose the route through E2 as the better route, because of the shorter AS_Path length (two ASNs away through ISP3 versus four ASNs away through ISP1). Without iBGP between E1 and E2, E1 would not learn of this better route through E2. So, any packets destined to 192.135.250.0/28 that reach E1 would be forwarded to ISP1. With iBGP, E1 would know of E2’s better route and forward the packets toward E2, as shown in the figure. + +For both prefixes, iBGP allowed both routers in the same ASN to reach the same conclu-sion about the better router through which to send packets for each Internet destination. + +Configuring iBGP + +The most basic iBGP configuration differs only slightly compared to eBGP configuration. The configuration does not explicitly identify an eBGP versus an iBGP peer. Instead, for iBGP, the neighbor’s ASN listed on the neighbor neighbor-ip remote-as neighbor-asn command lists the same ASN as the local router’s router bgp command. eBGP neighbor remote-as commands list a different ASN. + +When two iBGP peers share a common physical link, such as E1 and E2 in Figure 14-2, the iBGP configuration simply requires a single neighbor remote-as command on each router. Example 14-1 shows the BGP configuration on both Router E1 and E2 with this single neighbor command highlighted. The rest of the configuration lists the commands used to configure other BGP settings (as described after the example). Note that Figure 14-1 in the introduction to this chapter shows more detail about the eBGP peers. + + + +From the Library of Alexey Evseenko +604 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 14-1 BGP Configuration on E1: Neighborships Configured + +! Configuration on router E1 +router bgp 11 +no synchronization +bgp log-neighbor-changes +aggregate-address 128.107.0.0 255.255.224.0 summary-only +redistribute ospf 1 route-map only-128-107 +neighbor 1.1.1.1 remote-as 1 +neighbor 1.1.1.1 password fred +neighbor 1.1.1.1 ebgp-multihop 2 +neighbor 1.1.1.1 update-source Loopback1 +neighbor 10.1.1.10 remote-as 11 +no auto-summary +! +! Next, static routes so that the eBGP neighbor packets can reach +! I1-1's loopback interface address 1.1.1.1 +ip route 1.1.1.1 255.255.255.255 Serial0/0/0 +ip route 1.1.1.1 255.255.255.255 Serial0/0/1 +! +ip prefix-list 128-107 seq 5 permit 128.107.0.0/19 le 32 +! +route-map only-128-107 permit 10 +match ip address prefix-list 128-107 + +! Now, on router E2 +router bgp 11 +no synchronization +bgp log-neighbor-changes +network 128.107.32.0 +aggregate-address 128.107.0.0 255.255.224.0 summary-only +redistribute ospf 1 route-map only-128-107 +neighbor 10.1.1.9 remote-as 11 +neighbor 192.168.1.6 remote-as 3 +neighbor 192.168.1.6 password barney +no auto-summary +! +ip prefix-list 128-107 seq 5 permit 128.107.0.0/19 le 32 +! +route-map only-128-107 permit 10 +match ip address prefix-list 128-107 + +Only the four highlighted configuration commands are required for the E1-E2 iBGP peer-ing. Both refer to the other router’s IP address on the FastEthernet link between the two routers, and both refer to ASN 11. The two routers then realize that the neighbor is an iBGP neighbor, because the neighbor’s ASN (11) matches the local router’s ASN, as seen on the router bgp 11 command. + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 605 + +The example also lists the rest of the BGP configuration. Focusing on Router E1, the configuration basically matches the configuration of Router E1 from the end of Chapter 13, except that E1 has only one eBGP peer (I1-1) in this case, instead of two eBGP peers. The configuration includes the eBGP peer connection to I1-1, using loopback interfaces (1.1.1.1 on I1-1 and 11.11.11.11 on E1). The eBGP peers need to use eBGP multihop because of the use of the loopbacks, and they use message digest algorithm 5 (MD5) authentication as well. Finally, the configuration shows the redistribution of the enter-prise’s public address range of 128.107.0.0/19 by redistributing from OSPF and summariz-ing with the aggregate-address BGP subcommand. + +E2’s configuration lists the same basic parameters, but with a few differences. E2 does not use a loopback for its peer connection to I3-1, because only a single link exists between the two routers. As a result, E2 also does not need to use eBGP multihop. + +Refocusing on the iBGP configuration, Example 14-1 uses the interface IP addresses of the links between Routers E1 and E2. However, often the Internet-connected routers in an enterprise do not share a common subnet. For example, the two routers might be in sepa-rate buildings in a campus for the sake of redundancy. The two routers might actually be in different cities, or even different continents. In such cases, it makes sense to configure the iBGP peers using a loopback IP address for the TCP connection so that a single link failure does not cause the iBGP peer connection to fail. For example, in Figure 14-1, if the FastEthernet link between E1 and E2 fails, the iBGP connection defined in Example 14-1, which uses the interface IP addresses of that link, would fail even though a redun-dant IP path exists between E1 and E2. + +The configuration to use loopback interfaces as the update source mirrors that same con-figuration for eBGP peers, except that iBGP peers do not need to configure the neighbor neighbor-ip ebgp-multihop command. One difference between iBGP and eBGP is that Cisco IOS uses the low TTL of 1 for eBGP connections by default but does not for iBGP connections. So, for iBGP connections, only the following steps are required to make two iBGP peers use a loopback interface: + +Step 1. +Key +Topic Step 2. + + + +Step 3. + + + +Step 4. + + +Configure an IP address on a loopback interface on each router. + +Configure each router to use the loopback IP address as the source IP address, for the neighborship with the other router, using the neighbor neighbor-ip update-source interface-id command. + +Configure the BGP neighbor command on each router to refer to the other router’s loopback IP address as the neighbor IP address in the neighbor neighbor-ip remote-as command. + +Make sure that each router has IP routes so that they can forward packets to +the loopback interface IP address of the other router. + + +Example 14-2 shows an updated iBGP configuration for Routers E1 and E2 to migrate to use a loopback interface. In this case, E1 uses loopback IP address 10.100.1.1/32 and E2 uses 10.100.1.2/32. OSPF on each router has already been configured with a network 10.0.0.0 0.255.255.255 area 0 command (not shown), which causes OSPF to advertise routes to reach the respective loopback interface IP addresses. + + + + +From the Library of Alexey Evseenko +606 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 14-2 iBGP Configuration to Use Loopbacks as the Update Source + +! Configuration on router E1 +interface loopback 0 +ip address 10.100.1.1 255.255.255.255 +router bgp 11 +neighbor 10.100.1.2 remote-as 11 +neighbor 10.100.1.2 update-source loopback0 + +! Configuration on router E2 +interface loopback 1 +ip address 10.100.1.2 255.255.255.255 +router bgp 11 +neighbor 10.100.1.1 remote-as 11 +neighbor 10.100.1.1 update-source loopback1 + +The highlighted portions of the output link the key values together for the E1’s defini-tion of its loopback as the update source and E2’s reference of that same IP address on its neighbor command. The neighbor 10.100.1.2 update-source loopback0 command on E1 tells E1 to look to interface loopback0 for its update source IP address. Loopback0’s IP address on E1 has IP address 10.100.1.1. Then, E2’s neighbor commands for Router E1 all refer to that same 10.100.1.1 IP address, meeting the requirement that the update source on one router matches the IP address listed on the other router’s neighbor command. + +Verifying iBGP + +iBGP neighbors use the same messages and neighbor states as eBGP peers. As a result, the same commands in Chapter 13 for BGP neighbor verification can be used for iBGP peers. Example 14-3 shows a couple of examples, using Router E1’s iBGP neighbor rela-tionship with E2 (10.100.1.2) based on the configuration in Example 14-2. + +Example 14-3 Verifying iBGP Neighbors + +E1# show ip bgp summary +BGP router identifier 11.11.11.11, local AS number 11 +BGP table version is 190, main routing table version 190 +11 network entries using 1452 bytes of memory +14 path entries using 728 bytes of memory +11/7 BGP path/bestpath attribute entries using 1628 bytes of memory +7 BGP AS-PATH entries using 168 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +Bitfield cache entries: current 3 (at peak 4) using 96 bytes of memory +BGP using 4072 total bytes of memory +BGP activity 31/20 prefixes, 100/86 paths, scan interval 60 secs + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 607 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +1.1.1.1 +10.100.1.2 + +4 1 339 344 +4 11 92 132 + +190 0 0 00:28:41 7 +190 0 0 01:02:04 3 + + +E1# show ip bgp neighbors 10.100.1.2 +BGP neighbor is 10.100.1.2, remote AS 11, internal link +BGP version 4, remote router ID 10.100.1.2 +BGP state = Established, up for 01:02:10 +Last read 00:00:37, last write 00:00:59, hold time is 180, keepalive interval is +60 seconds +Neighbor capabilities: +Route refresh: advertised and received(new) +Address family IPv4 Unicast: advertised and received +! lines omitted for brevity + +The show ip bgp summary command lists E1’s two neighbors. As with eBGP peers, if the last column (the State/PfxRcd column) lists a number, the neighbor has reached the estab-lished state, and BGP Update messages can be sent. The output can distinguish between an iBGP or eBGP neighbor but only by comparing the local router’s ASN (in the first line of output) to the ASN listed in each line at the bottom of the output. + +The show ip bgp neighbors 10.100.1.2 command lists many details specifically for the neighbor. Specifically, it states that the neighbor is an iBGP neighbor with the phrase “internal link,” as highlighted in the output. + +Examining iBGP BGP Table Entries + +To better understand the BGP table with two (or more) Internet-connected routers inside the same company, start with one prefix and compare the BGP table entries on the two routers for that one prefix. By examining several such examples, you can appreciate more about the benefits and effects of these iBGP neighborships. + +This section examines the BGP tables on Routers E1 and E2, focusing on the prefixes highlighted in Figure 14-2—namely, prefixes 181.0.0.0/8 and 192.135.250.0/28. To make reading the output of the show commands a little more obvious, Figure 14-3 collects some key pieces of information into a single figure. This figure shows the two BGP neigh-bor relationships on each router, showing the update source and neighbor IP address of each BGP neighbor relationship. It also lists the BGP router ID (RID) of the routers. + +Examples 14-4 and 14-5 compare the output on Routers E2 and E1 for prefix 181.0.0.0/8. Example 14-4 lists output on Router E2, listing the BGP table entries for prefix 181.0.0.0/8. Remember, the design calls for ISP3 to only send partial updates, so E2 has not received an eBGP route for 181.0.0.0/8 from I3-1. However, E1 has indeed learned of that prefix from I1-1 (ISP1), and E1 has already advertised prefix 181.0.0.0/8 to E2. + + +Note Several BGP routes seen in the examples in this chapter originate in ASNs not shown in the figure. The figure shows enough of the topology to understand the first few ASNs in the AS_Path for these routes. + + + +From the Library of Alexey Evseenko +608 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +RID 11.11.11.11 + + + +Loop 11.11.11.11 + + +ASN 1 + +1.1.1.1 + + + +Loop 10.100.1.1 + + +E1 +10.1.1.9 Fa0/1 + +RID +I1-1 1.1.1.1 ASN 2 + +181/8 182/8 183/8 184/8 +ASN 3 185/8 + + + +Loop 10.100.1.2 + +Fa0/1 10.1.1.10 + +E2 + + +RID I3-1 3.3.3.3 + +192.168.1.5 192.168.1.6 RID +10.100.1.2 + +ASN 4 + + +192.135.250.0/28 + +Figure 14-3 Reference Information for BGP Table Verification + +Example 14-4 Notations of iBGP-Learned Routes in the show ip bgp Command + +E2# show ip bgp 181.0.0.0/8 longer-prefixes +BGP table version is 125, local router ID is 10.100.1.2 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +*>i181.0.0.0/8 1.1.1.1 0 100 0 1 2 111 112 i + +E2# show ip bgp 181.0.0.0/8 +BGP routing table entry for 181.0.0.0/8, version 121 +Paths: (1 available, best #1, table Default-IP-Routing-Table) +Advertised to update-groups: +1 +1 2 111 111 +1.1.1.1 from 10.100.1.1 (11.11.11.11) +Origin IGP, metric 0, localpref 100, valid, internal, best + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 609 + +The first command, show ip bgp 181.0.0.0/8 longer-prefixes, lists output with the same general format as the show ip bgp command, but it limits the output to the prefixes in the listed range. Only one such route exists in this case. The legend information at the top of the output, plus the headings and meanings of the different fields, is the same as with the show ip bgp command. + +Next, the first command’s output denotes this route as an iBGP-learned route with code “i” in the third character. The second command in the example, show ip bgp 181.0.0.0/8 , displays a more detailed view of the BGP table entry and denotes this route as iBGP-learned with the word “internal.” Similarly, the briefer show ip bgp 181.0.0.0/8 command output lists this one route as E2’s best route by displaying a “>” in the second column, whereas the more verbose output in the second command simply lists this route as “best.” + +Next, consider these same commands on Router E1, as shown in Example 14-5. Comparing the highlighted fields as matched in each of the examples: + +■ Both list the same AS_Path (1, 2, 111, 112), because iBGP peers do not add ASNs to the AS_Path when advertising to each other. So, both E1 and E2 have the same per-spective on the AS_Path and AS_Path length. + +■ Both list the one route for 181.0.0.0/8 as the best path, in part because each has learned only one such path. + +■ Both list a Next_Hop (a BGP PA) as 1.1.1.1, which is I1-1’s loopback interface used in the E1–to–I1-1 BGP neighbor relationship (also called the BGP neighbor ID). + +■ E2 lists the route as an internal (iBGP-learned) route, whereas E1 lists it as an external route. + +Example 14-5 Router E1’s show Commands for BGP Routes for 181.0.0.0/8 + +E1# show ip bgp 181.0.0.0/8 longer-prefixes +BGP table version is 190, local router ID is 11.11.11.11 +Status codes: s suppressed, d damped, h history, * valid, > best , i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + + +Network +*> 181.0.0.0/8 + +Next Hop +1.1.1.1 + +Metric LocPrf Weight Path +0 1 2 111 112 i + + +E1# show ip bgp 181.0.0.0/8 +BGP routing table entry for 181.0.0.0/8, version 181 +Paths: (1 available, best #1, table Default-IP-Routing-Table) +Advertised to update-groups: +2 +1 2 111 111, (received & used) +1.1.1.1 from 1.1.1.1 (1.1.1.1) +Origin IGP, localpref 100, valid, external, best + + + + + + +From the Library of Alexey Evseenko +610 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The output from these examples confirms that E1 learned the eBGP route for 181.0.0.0/8 and advertised it to E2, and E2 chose to use that iBGP-learned route as its best route to reach 181.0.0.0/8. + +Next, consider the route for 192.135.250.0/28, a route learned in the full BGP updates from ISP1’s Router I1-1 and in the partial BGP updates from ISP3’s Router I3-1. After exchanging this route using their iBGP peering, both E1 and E2 should see two possible routes: an eBGP route learned from their one connected ISP and the iBGP route learned from each other. Again assuming that the ISPs have not made any attempt to set PA val-ues to influence the best-path choice, and knowing that neither E1 nor E2 have config-ured BGP to influence the best-path choice, the route through E2 should be best because of the shorter AS_Path. + +Example 14-6 shows the output of the show ip bgp command on both E1 and E2, again for comparison. Note that the command used in the examples, show ip bgp 192.135.250.0/28 longer-prefixes, is used, because it lists only the routes for that pre- +fix, rather than the full BGP table displayed by show ip bgp. However, the format of the output is almost identical. + +Example 14-6 Comparing BGP Routes for 192.135.250.0/28 on E1 and E2 + +! First, on E1: +E1# show ip bgp 192.135.250.0/28 longer-prefixes +BGP table version is 26, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +* 192.135.250.0/28 1.1.1.1 0 1 2 3 4 i +*>i 192.168.1.6 0 100 0 3 4 i + +! Next, on E2: +E2# show ip bgp 192.135.250.0/28 longer-prefixes +BGP table version is 25, local router ID is 10.100.1.2 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +*> 192.135.250.0/28 192.168.1.6 0 3 4 i + +First, E1 lists two routes for this prefix, one external and one internal. The output identi-fies external routes by the absence of an “i” in the third character, whereas the output lists an “i” in the third character for internal routes. In this case, E1’s internal route, with Next_Hop 192.168.1.6, is E1’s best route, as was shown back in Figure 14-2. E1 chose this iBGP route because of the shorter AS_Path length; the AS_Path is highlighted at the end of each line. + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 611 + +E2’s output in the second half of Example 14-6 lists only a single route—its eBGP route for 192.135.250.0/28. That only one route appears, rather than two, is a good example of the effect of two rules about how BGP operates: + +■ Only advertise the best route in any BGP Update. + +■ Do not advertise iBGP-learned routes to iBGP peers. + +E2’s output lists a single route for 192.135.250.0/28—its external route learned from ISP3—because E1 chooses not to advertise a route for 192.135.250.0/28 over the iBGP connection. If you look back at E1’s output, E1’s best route for this prefix is its internal route. So, if E1 were to advertise any route for this prefix to E2, E1 would advertise this internal route, because it is E1’s best BGP route for that prefix. However, the second rule—do not advertise iBGP-learned routes to iBGP peers—prevents E1 from advertis- +ing this route back to E2. (Logically speaking, it makes no sense for E1 to tell E2 about a route when E2 is the router that originally advertised the route to E1 in the first place—a concept much like Split Horizon, although technically the term does not apply to BGP.) As a result, E2 lists a single route for 192.135.250.0/28. + +Note that if the route for 192.135.250.0/28 through ISP3 failed, E1 would start using the route through ISP1 as its best route. E1 would then advertise that best route to E2 that could then forward traffic through E1 for destinations in 192.135.250.0/28. + +Understanding Next-Hop Reachability Issues with iBGP + +With IGPs, the IP routes added to the IP routing table list a next-hop IP address. With few exceptions, the next-hop IP address exists in a connected subnet. For example, the E1-E2 iBGP connection uses loopback interfaces 10.100.1.1 (E1) and 10.100.1.2 (E2). E1’s OSPF-learned route to reach 10.100.1.2 lists outgoing interface Fa0/1, next-hop +10.1.1.10—an address in the LAN subnet that connects E1 and E2. (See Figure 14-3 a few pages back for reference.) + +Examples 14-5 and 14-6 also happened to show two examples of iBGP-learned routes and their next-hop addresses. The next-hop addresses were not in connected subnets; the next-hop addresses were not even IP addresses on a neighboring router. The two exam-ples were as follows; again, it might be helpful to refer to the notations in Figure 14-3: + +■ Example 14-5: E2’s route for 181.0.0.0/8 lists next-hop address 1.1.1.1, a loopback interface IP address on I1-1. + +■ Example 14-6: E1’s route for 192.135.250.0/28 lists next-hop address 192.168.1.6, which is I3-1’s interface IP address on the link between E2 and I3-1. + +In fact, in the case of Example 14-5, the output of the show ip bgp 181.0.0.0/8 com-mand on E2 listed the phrase “1.1.1.1 from 10.100.1.1 (11.11.11.11).” This phrase lists the next hop (1.1.1.1) of the route, the neighbor from which the route was learned (10.100.1.1 or E1), and the neighbor’s BGP RID (11.11.11.11, as listed in Figure 14-3). + +BGP advertises these particular IP addresses as the next-hop IP addresses because of a default behavior for BGP. By default, when a router advertises a route using eBGP, the + + + + +From the Library of Alexey Evseenko +612 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +advertising router lists its own update-source IP address as the next-hop address of the route. In other words, the next-hop IP address is the IP address of the eBGP neighbor, as listed on the neighbor remote-as command. However, when advertising a route to an iBGP peer, the advertising router (by default) does not change the next-hop address. For example, when I1-1 advertises 181.0.0.0/8 to E1, because it is an eBGP connection, I1-1 sets its own IP address (1.1.1.1)—specifically the IP address I1-1 uses on its eBGP peer +connection to E1—as the next hop. When E1 advertises that same route to iBGP peer E2, E1 does not change the next-hop address of 1.1.1.1. So, Router E2’s iBGP-learned route lists 1.1.1.1 as the next-hop address. + +The IP routing process can use routes whose next-hop addresses are not in connected subnets as long as each router has an IP route that matches the next-hop IP address. Therefore, engineers must understand these rules about how BGP sets the next-hop address and ensure that each router can reach the next-hop address listed in the BGP routes. Two main options exist to ensure reachability to these next-hop addresses: + +■ Create IP routes so that each router can reach these next-hop addresses that exist in other ASNs. + +■ Change the default iBGP behavior with the neighbor neighbor-ip next-hop-self command. + +The text now examines each of these two options in more detail. + + +Ensuring That Routes Exist to the Next-Hop Address + +Routers can still forward packets using routes whose next-hop addresses are not in con-nected subnets. To do so, when forwarding packets, the router performs a recursive route table lookup. For example, for packets arriving at E2 with a destination of 181.0.0.1, the following would occur: +Step 1. E2 would match the routing table for destination address 181.0.0.1, matching the route for 181.0.0.0/8, with next hop 1.1.1.1. + +Step 2. E2 would next look for its route matching destination 1.1.1.1—the next hop of the first route—and forward the packet based on that route. + +So, regardless of the next-hop IP address listed in the routing table, as long as a work-ing route exists to reach that next-hop IP address, the packet can be forwarded. Figure 14-4 shows the necessary routes in diagram form using two examples. E1 has a route to 192.135.250.0/28 with next hop 192.168.1.6; two arrowed lines show the required routes on Routers E1 and E2 for forwarding packets to this next-hop address. Similarly, the dashed lines show the necessary routes on E2 and E1 for next-hop address 1.1.1.1, the next-hop IP address for their routes to reach 181.0.0.0/8. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 613 + + + +Key Topic + +Loopback to 1.1.1.1 1.1.1.1 + + + +E1 + +Destination 192.168.1.6 + +I1-1 + +Next-Hop E2 + + +to +1.1.1.1 to 192.168.1.6 + + + + + +to 192.168.1.6 + + +E2 + +Destination 1.1.1.1 + + +192.168.1.6 + +I3-1 + +Next-Hop E1 + + +Figure 14-4 Ensuring That Routes Exist for Next-Hop Addresses in Other ASNs + +Two easily implemented solutions exist to add routes for these nonconnected next-hop IP addresses: Either add static routes or use an IGP between the enterprise and the ISPs for the sole purpose of advertising these next-hop addresses. + +Using neighbor neighbor-ip next-hop-self to Change the Next-Hop Address + +The second option for dealing with these nonconnected next-hop IP addresses changes the iBGP configuration so that a router changes the next-hop IP address on iBGP-adver-tised routes. This option simply requires the neighbor neighbor-ip next-hop-self com-mand to be configured for the iBGP neighbor relationship. A router with this command configured advertises iBGP routes with its own update source IP address as the next-hop IP address. And because the iBGP neighborship already relies on a working route for these update source IP addresses, if the neighborship is up, IP routes already exist for these next-hop addresses. + +For example, on the iBGP connection from E1 to E2, E1 would add the neighbor 10.100.1.2 next-hop-self command, and E2 would add the neighbor 10.100.1.1 next-hop-self command. When configured, E1 advertises iBGP routes with its update source IP address (10.100.1.1) as the next-hop address. E2 likewise advertises routes with a next-hop address of 10.100.1.2. Example 14-7 shows E2’s BGP table, with a few such examples highlighted, after the addition of these two configuration commands on the respective routers. + + + + + + + + +From the Library of Alexey Evseenko +614 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 14-7 Seeing the Effects of next-hop-self from Router E2 + +E2# show ip bgp +BGP table version is 76, local router ID is 10.100.1.2 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 0.0.0.0 +* i +* i128.107.0.0/19 +*> +s> 128.107.1.0/24 +s> 128.107.2.0/24 +s> 128.107.3.0/24 +*>i181.0.0.0/8 +*>i182.0.0.0/8 +*>i183.0.0.0/8 +*>i184.0.0.0/8 +*>i185.0.0.0/8 + +192.168.1.6 +10.100.1.1 +10.100.1.1 +0.0.0.0 +10.1.1.77 +10.1.1.77 +10.1.1.77 +10.100.1.1 +10.100.1.1 +10.100.1.1 +10.100.1.1 +10.100.1.1 + +0 0 3 i +0 100 0 1 i +0 100 0 i +32768 i +2 32768 ? +2 32768 ? +2 32768 ? +0 100 0 1 2 111 112 i +0 100 0 1 2 222 i +0 100 0 1 2 i +0 100 0 1 2 i +0 100 0 1 2 i + +*> 192.135.250.0/28 192.168.1.6 0 3 4 i + +This completes the discussion of iBGP configuration and operation as related to the rout-ers actually connected to the Internet. The next section continues the discussion of iBGP but with a focus on some particular issues with routing that might require iBGP on rout-ers other than the Internet-connected routers. + +Avoiding Routing Loops When Forwarding Toward the Internet + +A typical enterprise network design uses default routes inside an enterprise, as advertised by an IGP, to draw all Internet traffic toward one or more Internet-connected routers. The Internet-connected routers then forward the traffic into the Internet. + +However, as discussed in Chapter 13, in the section “Choosing One Path over Another Using BGP,” routing loops can occur when the Internet-connected routers do not have a direct connection to each other. For example, if the Internet-connected routers sit on +opposite sides of the country, the two routers might be separated by several routers inter-nal to the enterprise, because they do not have a direct link. + +To show a simple example, the same enterprise network design shown in all previous figures in this chapter can be changed slightly by just disabling the FastEthernet link between the two routers, as shown in Figure 14-5. + +Figure 14-5 shows an example of the looping problem. + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 615 + + +Default +1 + +Default ISP1 +2 + + +WAN1 Core1 3 E1 I1-1 192.135.250.0/28 +to E2 ISP3 + + +WAN2 Core2 E2 I3-1 + + + + +I4-1 + +192.135.250.0/28 + +Company 3 + +Figure 14-5 Routing Loop for Packets Destined to 192.135.250.1 + +The figure uses the same general criteria as the other examples in this chapter, such that E1’s best route for 192.135.250.0/28 points to Router E2 as the next hop. E1’s best route for the next-hop IP address for its route to 192.135.250.0/28—regardless of whether using the next-hop-self option or not—sends the packet back toward the enterprise core. However, some of (or possibly all) the enterprise routers internal to the enterprise, such as WAN1 and Core1, use a default that sends all packets toward Router E1. Per the steps in the figure, the following happens for a packet destined to 192.135.250.1: +Step 1. WAN1 sends the packet using its default route to Core1. + +Step 2. Core1 sends the packet using its default route to E1. + +Step 3. E1 matches its BGP route for 192.135.250.0/28, with next-hop E2 (10.100.1.2). The recursive lookup on E1 matches a route for 10.100.1.2 with a next hop of Core1, so E1 sends the packet back to Core1. + +At this point, Steps 2 and 3 repeat until the packet’s TTL mechanism causes one of the routers to discard the packet. + +The lack of knowledge about the best route for subnet 192.135.250.0/28, particularly on the routers internal to the enterprise, causes this routing loop. To avoid this problem, internal routers, such as Core1 and Core2, need to know the best BGP routes. Two solu-tions exist to help these internal routers learn the routes: + +■ Run BGP on at least some of the routers internal to the enterprise (such as Core1 and Core2 in Figure 14-5). + +■ Redistribute BGP routes into the IGP (not recommended). + + + + + +From the Library of Alexey Evseenko +616 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Both solutions solve the problem by giving some of the internal routers the same best-path information already known to the Internet-connected routers. For example, if Core1 knew a route for 192.135.250.0/28, and that route caused the packets to go to Core2 next and then on to Router E2, the loop could be avoided. This section examines both solu-tions briefly. + + +Note BGP Confederations and BGP Route Reflector features, which are outside the scope of this book, can be used instead of a full mesh of iBGP peers. + + + +Using an iBGP Mesh + +To let the internal routers in the enterprise learn the best BGP routes, one obvious solu-tion is to just run BGP on these routers as well. The not-so-obvious part relates to the implementation choice of what routers need to be iBGP peers with each other. Based on the topology shown in Figure 14-5, at first glance, the temptation might be to run BGP on E1, E2, Core1, and Core2, but use iBGP peers as shown in Figure 14-6. + +Core1 + + +E1 +10.100.1.3 iBGP 10.100.1.1 + + + +iBGP + + + +10.100.1.4 iBGP 10.100.1.2 + + +E2 +Core2 + +Figure 14-6 Partial Mesh of iBGP Peers + + + + + + + + +Key Topic + +The iBGP peers shown in the figure actually match the kinds of IGP neighbor relation-ships you might expect to see with a similar design. With an IGP routing protocol, each router would learn routes and tell its neighbor so that all routers would learn all routes. Unfortunately, with this design, not all the routers learn all the routes because of the fol-lowing feature of iBGP: + +When a router learns routes from an iBGP peer, that router does not advertise the +same routes to another iBGP peer. + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 617 + + +Note This particular iBGP behavior helps prevent BGP routing loops. + + +Because of this feature, to ensure that all four routers in ASN 11 learn the same BGP routes, a full mesh of iBGP peers must be created. By creating an iBGP peering between all routers inside ASN 11, they can all exchange routes directly and overcome the restric-tion. In this case, six such neighborships exist: one between each pair of routers. + +The configuration itself does not require any new commands that have not already been explained in this book. However, for completeness, Example 14-8 shows the configura-tion on both E1 and Core1. Note that all configuration related to iBGP has been included, and the routers use the loopback interfaces shown in Figure 14-6. + +Example 14-8 iBGP Configuration for the Full Mesh Between E1, E2, Core, and Core2—E1 and Core1 Only + +! First, E1's configuration +router bgp 11 +neighbor 10.100.1.2 remote-as 11 +neighbor 10.100.1.2 update-source loopback0 +neighbor 10.100.1.2 next-hop-self +! +neighbor 10.100.1.3 remote-as 11 +neighbor 10.100.1.3 update-source loopback0 +neighbor 10.100.1.3 next-hop-self +! +neighbor 10.100.1.4 remote-as 11 +neighbor 10.100.1.4 update-source loopback0 +neighbor 10.100.1.4 next-hop-self + +! Next, Core1's configuration +interface loopback0 +ip address 10.100.1.3 255.255.255.255 +! +router bgp 11 +neighbor 10.100.1.1 remote-as 11 +neighbor 10.100.1.1 update-source loopback0 +! +neighbor 10.100.1.2 remote-as 11 +neighbor 10.100.1.2 update-source loopback0 +! +neighbor 10.100.1.4 remote-as 11 +neighbor 10.100.1.4 update-source loopback0 + +The configurations on E1 and Core1 mostly match. The commonly used commands sim-ply define the neighbor’s ASN (neighbor neighbor-ip remote-as) and list the local rout-er’s BGP update source interface (neighbor neighbor-ip update-source). However, note + + + + +From the Library of Alexey Evseenko +618 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +that the engineer also configured E1—the Internet-connected router—with the neighbor neighbor-ip next-hop-self command. In this case, the Internet-connected routers want to set their own update source IP addresses as the next hop for any routes. However, the engineer purposefully chose not to use this command on the two internal routers (Core1 and Core2), because the eventual destination of these packets will be to make it to either E1 or E2 and then out to the Internet. By making the next-hop router for all iBGP-learned routes an address on one of the Internet-connected routers, the packets will be correctly forwarded. + +For perspective, Example 14-9 shows Core1’s BGP table after adding the configuration shown in Example 14-8, plus the equivalent configuration in E2 and Core2. Focusing on the routes for 181.0.0.0/8 and 192.135.250.0/28 again, note that E1 and E2 had already agreed that E1’s route for 181.0.0.0/8 was best and that E2’s route for 192.135.250.0/28 was best. As a result, Core1 knows only one route for each of these destinations, as shown in the example. Also, the next-hop addresses for each route refer to the correct router of the two Internet-connected routers: 10.100.1.1 (E1) for the route to 181.0.0.0/8 and 10.100.1.2 (E2) for the route to 192.135.250.0/28. + +Example 14-9 BGP Table on Router Core1 + +Core-1# show ip bgp +BGP table version is 10, local router ID is 10.100.1.3 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +r i0.0.0.0 +r>i +* i128.107.0.0/19 +*>i +*>i181.0.0.0/8 +*>i182.0.0.0/8 +*>i183.0.0.0/8 +*>i184.0.0.0/8 +*>i185.0.0.0/8 + +10.100.1.2 +10.100.1.1 +10.100.1.2 +10.100.1.1 +10.100.1.1 +10.100.1.1 +10.100.1.1 +10.100.1.1 +10.100.1.1 + +0 100 0 3 i +0 100 0 1 i +0 100 0 i +0 100 0 i +0 100 0 1 2 111 112 i +0 100 0 1 2 222 i +0 100 0 1 2 i +0 100 0 1 2 i +0 100 0 1 2 i + +*>i192.135.250.0/28 10.100.1.2 0 100 0 3 4 i + + +IGP Redistribution and BGP Synchronization + +You can also redistribute BGP routes into the IGP to solve the routing loop problem. This solution prevents the routing loop by giving the internal enterprise routers knowledge of the best exit point for each known Internet destination. + +Although this solves the problem, particularly when just learning with lab gear at home, redistribution of BGP routes into an IGP is generally not recommended. This redistribution requires a relatively large amount of memory and a relatively large amount of processing by + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 619 + +an IGP with the much larger number of routes to process. Redistributing all the routes in the full Internet BGP table could crash the IGP routing protocols. + + +Note BGP consumes less memory and uses less CPU resources for a large number of routes as compared to the equivalent number of routes advertised by an IGP, particularly when compared to OSPF. So, using the iBGP mesh can cause internal routers to learn all the same routes but without risk to the IGP. + + +Although not recommended, the idea of redistributing eBGP-learned Internet routes into the enterprise IGP needs to be discussed as a backdrop to discuss a related BGP feature called synchronization, or sync. The term refers to the idea that the iBGP-learned routes must be synchronized with IGP-learned routes for the same prefix before they can be used. In other words, if an iBGP-learned route is to be considered to be a usable route, that same prefix must be in the IP routing table and learned using some IGP protocol such as EIGRP or OSPF. More formally, the synchronization features tells a BGP router the following: + +Do not consider an iBGP-learned route as “best” unless the exact prefix was learned through an IGP and is currently in the IP routing table. +For companies, such as the enterprise shown in Figure 14-5, the combination of redistrib-uting eBGP routes into an IGP, and configuring synchronization on the two routers that run BGP (E1 and E2), prevents the routing loop shown in that figure. Again using prefix 192.135.250.0/28 as an example (see Figure 14-5), E2 learns this prefix with eBGP. E1 learns this same prefix through its iBGP neighborship with E2, and both agree that E2’s BGP route is best. + +When E2 has successfully redistributed prefix 192.135.250.0/28 into the enterprise’s IGP (OSPF in the examples in this chapter), E1, with sync enabled, thinks like this: + +I see an IGP route for 192.135.250.0/28 in my IP routing table, so my iBGP route for that same prefix is safe to use. +However, if for some reason the redistribution does not result in an IGP route for 192.135.250.0/28, E1 thinks as follows: + +I do not see an IGP-learned route for 192.135.250.0/28 in my IP routing table, so I will not consider the iBGP route through E2 to be usable. +In this second case, E1 uses its eBGP route learned through I1-1, which defeats the rout-ing loop caused at Step 3 of Figure 14-5. + +Later Cisco IOS versions default to disable synchronization, because most sites avoid redistributing routes from BGP into an IGP when using BGP for Internet routes, instead preferring iBGP meshes (or alternatives) to avoid these routing black holes. The setting is applied to the entire BGP process, with the synchronization command enabling synchro-nization and the no synchronization command (default) disabling it. + + + + + + +From the Library of Alexey Evseenko +620 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note The suggestion to avoid redistribution from BGP into an IGP generally applies to cases in which BGP is used to exchange Internet routes. However, BGP can be used for other purposes as well, including the implementation of Multiprotocol Label Switching (MPLS). Redistribution from BGP into an IGP when using BGP for MPLS is reasonable and commonly done. + + + +Route Filtering and Clearing BGP Peers + +BGP allows the filtering of BGP Update messages on any BGP router. The router can filter updates per neighbor for both inbound and outbound Updates on any BGP router. + +After adding a new BGP filter to a router’s configuration, the BGP neighbor relationships must be reset or cleared to cause the filter to take effect. The Cisco IOS BGP clear com-mand tells the router specifically how to reset the neighborship. This section also exam-ines the variations on the BGP clear command, including the more disruptive hard reset options and the less disruptive soft reset options. + +BGP Filtering Overview + +BGP filtering works generally like IGP filtering, particularly like EIGRP. Similar to EIGRP, BGP Updates can be filtered on any router, without the restrictions that exist for OSPF with various area design issues. The filtering can examine the prefix information about each router and both the prefix and prefix length information, in either direction (in or out), on any BGP router. + +The biggest conceptual differences between BGP and IGP filtering relate to what BGP can match about a prefix to make a choice of whether to filter the route. EIGRP focuses on matching the prefix/length. Not only can BGP also match the prefix/length, but it can also match a large set of BGP Path Attributes (PA). For example, a filter could compare +a BGP route’s AS_Path PA and check to see whether the first ASN is 4, that at least three ASNs exist, and that the AS_Path does not end with 567. The matching of routes based on their PA settings has no equivalent with any of the IGPs. + +The biggest configuration difference between BGP and IGP filtering, besides the details of matching BGP PAs, has to do with the fact that the filters must apply to specific neighbors with BGP. With EIGRP, the filters can be applied to all outbound updates from EIGRP, or all inbound updates into EIGRP, using a single EIGRP distribute-list command. BGP configuration does not allow filtering of all inbound or outbound updates. Instead, the BGP filtering configuration enables filters per neighbor (using a neighbor command), referencing the type of BGP filter, the filter number or name, and the direction (in or out). So, a router could literally use the same filter for all BGP Updates sent by a router, but the configuration would require a neighbor command for each neighbor that enabled the same filter. + +The ROUTE course and exam focus on enterprise routing topics, whereas BGP filtering— especially the more detailed filtering with BGP PAs—is used most frequently by ISP + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 621 + +network engineers. As a result, CCNP ROUTE covers BGP filtering very lightly, at least compared to IGP filtering. + +This section briefly describes the BGP filtering commands, showing a few samples just for perspective. Table 14-2 summarizes the BGP filtering options and commands, along with the fields in the BGP Update message that can be matched with each type. +Following the table, the text shows an example of how an enterprise might apply an out-bound and inbound filter based on prefix/length. + +Table 14-2 BGP Filtering Tools + + +BGP Subcommand + +neighbor distribute-list (standard ACL) +neighbor distribute-list (extended ACL) +neighbor prefix-list + + +neighbor filter-list + + +neighbor route-map + +Commands Referenced by the neighbor Command +access-list, ip access-list + +access-list, ip access-list + +ip prefix-list + + +ip as-path access-list + + +route-map + +What Can Be Matched + +Prefix, with WC mask + +Prefix and prefix length, with WC mask for each +Exact or “first N” bits of prefix, plus range of prefix lengths +AS_Path contents; all NLRI whose AS_Paths are matched considered to be a match +Prefix, prefix length, AS_ Path, and/or any other PA matchable within a BGP route map + + + + +Inbound and Outbound BGP Filtering on Prefix/Length + +Enterprises that choose to use BGP benefit from both learning routes from the connected ISPs and advertising the enterprise’s public prefix to the same ISPs. However, when the eBGP connections to the various ISPs come up, the enterprise BGP routers advertise all the best routes in each router’s BGP table over the eBGP connection. As a result, the ISPs could learn a best route that causes one ISP to send packets to the enterprise, with the enterprise then forwarding the packet out to another ISP. In such a case, the enterprise AS would be acting as a transit AS. + +Enterprise engineers can, and probably should, make an effort to filter inappropriate routes sent to the ISP over the eBGP peer connections with the goal of preventing their enterprise AS from becoming a transit AS. Additionally, the enterprise can filter all private IP address ranges, in case any such address ranges get into the enterprise BGP router’s BGP table. + + + + + + +From the Library of Alexey Evseenko +622 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +As an example, consider Figure 14-7, with the now-familiar prefix 192.135.250.0/28. As seen in earlier examples, both E1 and E2 learn this prefix, and both agree that the best route from ASN 11 (the enterprise) toward this prefix is through E2. The figure shows the BGP routing updates as dashed lines. + + +Key Enterprise - ASN 11 Topic 128.107.0.0/19 + +10.0.0.0/8 + + +ASN 1 ISP1 + +Stop + + +E1 I1-1 ASN 2 Stop + + + + +192.135.250.0/28 + + + +E2 + +I2-1 ASN 3 ISP3 + + +I3-1 + + + + + +ASN 4 + +I4-1 192.135.250.0/28 + +Figure 14-7 Need for Enterprise BGP Filtering + +E1’s best route for 192.135.250.0/28 lists E2 as the next-hop router. So, without any filter-ing in place, E1 then advertises prefix 192.135.250.0/28 to Router I1-1 in ISP1. I1-1 can be configured to filter this prefix. (In the Chapter 13 examples, Router I1-1 was indeed con-figured to filter such prefixes.) However, if the enterprise did not filter this prefix when advertising to ISP1, and ISP1 did not filter it, ISP1 might choose the route through ASN 11 as its best route, making ASN 11 a transit AS for this prefix and consuming the enter-prise’s Internet bandwidth. + +Typically, an enterprise would use outbound filtering on its eBGP neighborships, filter-ing all routes except for the known public prefixes that need to be advertised into the Internet. Example 14-10 shows just such a case, using the neighbor prefix-list com-mand. The example also highlights a particularly useful command, show ip bgp neighbor neighbor-ip advertised-routes, which shows the post-filter BGP update sent to the listed neighbor. The example shows the BGP Update before adding the filter, after adding the filter, and then after clearing the peer connection to router I1-1. + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 623 + +Example 14-10 Filtering to Allow Only Public Prefix 128.107.0.0/19 Outbound + +! The next command occurs before filtering is added. +E1# show ip bgp neighbor 1.1.1.1 advertised-routes +BGP table version is 16, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + + +Network +*> 128.107.0.0/19 + +Next Hop +0.0.0.0 + +Metric LocPrf Weight Path +32768 i + +*>i192.135.250.0/28 10.100.1.2 0 100 0 3 4 i + +Total number of prefixes 2 + +! Next, the filtering is configured. +E1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. + +E1(config)# ip prefix-list only-public permit 128.107.0.0/19 +E1(config)# router bgp 11 +E1(config-router)# neighbor 1.1.1.1 prefix-list only-public out +E1(config-router)# end +E1# + +! Next, the Update sent to I1-1 is displayed. +E1# show ip bgp neighbor 1.1.1.1 advertised-routes +BGP table version is 16, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + + +Network +*> 128.107.0.0/19 + +Next Hop +0.0.0.0 + +Metric LocPrf Weight Path +32768 i + +*>i192.135.250.0/28 10.100.1.2 0 100 0 3 4 i + +Total number of prefixes 2 + +! Next, the peer connection is cleared, causing the filter to take effect. +E1# clear ip bgp 1.1.1.1 +E1# +*Aug 17 20:19:51.763: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down User reset +*Aug 17 20:19:52.763: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up + +! Finally, the Update is displayed with the filter now working. +E1# show ip bgp neighbor 1.1.1.1 advertised-routes + + + + + +From the Library of Alexey Evseenko +624 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +BGP table version is 31, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + + +Network +*> 128.107.0.0/19 + +Next Hop +0.0.0.0 + +Metric LocPrf Weight Path +32768 i + + +Total number of prefixes 1 + +Example 14-10 shows an interesting progression if you just read through the example from start to finish. To begin, the show ip bgp 1.1.1.1 advertised-routes command lists the routes that E1 has advertised to neighbor 1.1.1.1 (Router I1-1) in the past. Then, the configuration shows a prefix list that matches only 128.107.0.0/19, with a permit action; all other prefixes will be denied by the implied deny all at the end of each prefix list. Then, the neighbor 1.1.1.1 prefix-list only-public out BGP subcommand tells BGP to apply the prefix list to filter outbound routes sent to I1-1. + +The second part of the output shows an example of how BGP operates on a Cisco router, particularly how BGP requires that the neighbor be cleared before the newly config- +ured filter takes effect. Router E1 has already advertised two prefixes to this neighbor: 128.107.0.0/19 and 192.135.250.0/28, as seen at the beginning of the example. To make the filtering action take effect, the router must be told to clear the neighborship with Router I1-1. The clear ip bgp 1.1.1.1 command tells E1 to perform a hard reset of that neighbor connection, which brings down the TCP connection and removes all BGP +table entries associated with that neighbor. The neighbor (I1-1, using address 1.1.1.1) also removes its BGP table entries associated with Router E1. After the neighborship recovers, E1 resends its BGP Update to Router I1-1—but this time with one less prefix, as noted at the end of the example with the output of the show ip bgp neighbor 1.1.1.1 advertised-routes command. + +This same filtering action could have been performed with several other configuration options: using the neighbor distribute-list or neighbor route-map commands. The neigh-bor distribute-list command refers to an IP ACL, which tells Cisco IOS to filter routes based on matching the prefix (standard ACL) or prefix/length (extended ACL). The neigh-bor route-map command refers to a route map that can use several matching options to filter routes, keeping routes matched with a route map permit clause and filtering routes matched with a route map deny clause. Example 14-11 shows two such options just for comparison’s sake. + +Example 14-11 Alternatives to the Configuration in Example 14-10 + +! First option – ACL 101 as a distribute-list +access-list 101 permit ip host 128.107.0.0 host 255.255.224.0 +router bgp 11 +neighbor 1.1.1.1 distribute-list 101 out + +! Second option: Same prefix list as Example 14-10 , referenced by a route map + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 625 + +ip prefix-list only-public seq 5 permit 128.107.0.0/19 +! +route-map only-public-rmap permit 10 +match ip address prefix-list only-public +! +router bgp 11 +neighbor 1.1.1.1 route-map only-public-rmap out + + +Clearing BGP Neighbors + +As noted in Example 14-10 and the related explanations, Cisco IOS does not cause a newly configured BGP filter to take effect until the neighbor relationship is cleared. The neighborship can be cleared in several ways, including reloading the router and by admin-istratively disabling and reenabling the BGP neighborship using the neighbor shutdown and no neighbor shutdown configuration commands. However, Cisco IOS supports several options on the clear ip bgp EXEC command for the specific purpose of resetting BGP connections. This section examines the differences in these options. + +Each variation on the clear ip bgp... command either performs a hard reset or soft reset of one or more BGP neighborships. When a hard reset occurs, the local router brings down the neighborship, brings down the underlying TCP connection, and removes all BGP table entries learned from that neighbor. Both the local and neighboring router react just like they do for any failed BGP neighborship by removing their BGP table entries learned over that neighborship. With a soft reset, the router does not bring down the BGP neighborship or the underlying TCP connection. However, the local router +resends outgoing Updates, adjusted per the outbound filter, and reprocesses incoming Updates per the inbound filter, which adjusts the BGP tables based on the then-current configuration. + +Table 14-3 lists many of the variations on the clear ip bgp command, with a reference as to whether it uses hard or soft reset. + + +Table 14-3 Key +Topic Command + + +BGP clear Command Options + +Hard or Soft + + + +One or All Neighbors + + + +Direction (In or Out) + + + +clear ip bgp * Hard + +clear ip bgp neighbor-id Hard + +clear ip bgp neighbor-id out Soft + +clear ip bgp neighbor-id soft out Soft + +clear ip bgp neighbor-id in Soft + +clear ip bgp neighbor-id soft in Soft + +clear ip bgp * soft Soft + +clear ip bgp neighbor-id soft Soft + +All Both + +One Both + +One Out + +One Out + +One In + +One In + +All Both + +One Both + + + + + +From the Library of Alexey Evseenko +626 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +The commands listed in the table should be considered as pairs. In the first pair, both commands perform a hard reset. The first command uses a * instead of the neighbor IP address, causing a hard reset of all BGP neighbors, while the second command resets that particular neighbor. + +The second pair of commands performs soft resets for a particular neighbor but only for outgoing updates, making these commands useful when a router changes its outbound BGP filters. Both commands do the same function; two such commands exist in part because of the history of BGP’s implementation in Cisco IOS. When issued, these two commands cause the router to reevaluate its existing BGP table and create a new BGP Update for that neighbor. The router builds that new Update based on the existing con-figuration, so any new or changed outbound filters affect the contents of the Update. The router sends the new BGP Update, and the neighboring router receives the new Update and adjusts its BGP table as a result. + +The third pair of commands performs soft resets for a particular neighbor, but only for incoming updates, making these commands useful when a router changes its inbound BGP filters. However, unlike the two previous commands in the table, these two com-mands do have slightly different behavior and need a little more description. + +The clear ip bgp neighbor-id soft in command, the older command of the two, works only if the configuration includes the neighbor neighbor-id soft-reconfiguration inbound BGP configuration command for this same neighbor. This configuration com-mand causes the router to retain the received BGP Updates from that neighbor. This con-sumes extra memory on the router, but it gives the router a copy of the original pre-filter Update received from that neighbor. Using that information, the clear ip bgp neighbor-id soft in command tells Cisco IOS to reapply the inbound filter to the cached received Update, updating the local router’s BGP table. + +The newer version of the clear ip bgp command, namely, the clear ip bgp neighbor-id in command (without the soft keyword), removes the requirement for the neighbor neighbor-id soft-reconfiguration inbound configuration command. Instead, the router uses a newer BGP feature, the route refresh feature, which essentially allows a BGP router to ask its neighbor to resend its full BGP Update. The clear ip bgp neighbor-id in com-mand tells the local router to use the route refresh feature to ask the neighbor to resend its BGP Update, and then the local router can apply its current inbound BGP filters, updating its BGP table. + +Example 14-12 shows a sample of how to confirm whether a router has the route refresh capability. In this case, both the local router (E1 from Figure 14-5) and the neighbor (I1-1 from Figure 14-5) have route refresh capability. As a result, E1 can perform a soft reset inbound without the need to consume the extra memory with the neighbor soft-reconfiguration inbound configuration command. + +Example 14-12 Alternatives to the Configuration in Example 14-10 + +E1# show ip bgp neighbor 1.1.1.1 +BGP neighbor is 1.1.1.1, remote AS 1, external link +BGP version 4, remote router ID 1.1.1.1 + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 627 + +BGP state = Established, up for 00:04:21 +Last read 00:00:20, last write 00:00:48, hold time is 180, keepalive interval is +60 seconds +Neighbor capabilities: +Route refresh: advertised and received(new) +! Lines omitted for brevity + +The last pair of commands in Table 14-3 do a soft reset both inbound and outbound at the same time, either for all neighbors (the * option) or for the single neighbor listed in the clear command. + +Displaying the Results of BGP Filtering + +To verify and troubleshoot filtering configurations, you need to see both the results before and after the filter. Cisco IOS provides several show commands that allow you to do exactly that. For example, Example 14-10 shows several cases of the show ip bgp neighbor advertised-routes command that shows the post-filter BGP Updates sent by a router. Figure 14-8 summarizes these commands, showing how they can be used to display the pre- and post-filter BGP table contents. The figure shows Router E1, with inbound filtering for Updates received from Router I3-1 and outbound filtering of BGP Updates sent to Router I1-1. + + +Key Router E1 +Topic BGP Table + + +show ip bgp neighbors I1-1 advertised-routes + + + +“Best” Routes + +show ip bgp + +BGP Table Subset Learned from I3-1 + +Outbound Sent +Filter Update I1-1 + + + +Inbound Filter + +Received +Update I3-1 + + + +show ip bgp neighbors I3-1 routes show ip bgp neighbors I3-1 received-routes + +Figure 14-8 show Commands Related to BGP Filtering + +The commands for displaying inbound updates, at the bottom of the figure, display out-put in the same format as the show ip bgp command. These commands restrict the con-tents to either exactly what has been received from that one neighbor (the show ip bgp neighbors received-routes command) or what has been received and passed through any inbound filter (the show ip bgp neighbors routes command). + +One of the two commands helpful for the inbound direction, namely, the show ip bgp neighbor received-routes command, requires the configuration of the BGP subcommand + + + + +From the Library of Alexey Evseenko +628 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +neighbor soft-reconfiguration inbound. As a result, to see the pre-filter BGP Update received from a neighbor, a router must configure this extra command, which causes the router to use more memory to store the inbound Update. However, when learning in a lab, the extra memory should not pose a problem. + +Of the two commands for outbound filtering, the post-filter command is somewhat obvi-ous, but there is no command to specifically display a pre-filter view of the BGP Update sent to a neighbor. However, BGP advertises the best route for each prefix in the BGP table, within certain restrictions. Those restrictions state that BGP will not advertise iBGP-learned routes to an iBGP peer, and a router will not advertise the best route back +to the same neighbor that advertised that route. So, to see the pre-filter BGP table entries, use the show ip bgp command, look for all the best routes, and then consider the addi-tional rules. Use the show ip bgp neighbor advertised-routes command to display the post-filter BGP Update for a given neighbor. + +Example 14-13 shows the output of these commands on E1. In this case, E1 has already been configured with an inbound filter that filters inbound prefixes 184.0.0.0/8 and 185.0.0.0/8. (The filter configuration is not shown.) As a result, the post-filter output lists five prefixes, and the pre-filter output lists seven prefixes. The example also shows the error message when soft reconfiguration is not configured. + +Example 14-13 Displaying the BGP Table Pre- and Post-Inbound Filter + +E1# show ip bgp neighbors 1.1.1.1 routes +BGP table version is 78, local router ID is 11.11.11.11 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 0.0.0.0 +*> 181.0.0.0/8 +*> 182.0.0.0/8 +*> 183.0.0.0/8 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 + +0 0 1 i +0 1 2 111 111 i +0 1 2 222 i +0 1 2 i + +* 192.135.250.0/28 1.1.1.1 0 1 2 3 4 i + +Total number of prefixes 5 +E1# show ip bgp neighbors 1.1.1.1 received-routes +% Inbound soft reconfiguration not enabled on 1.1.1.1 + +E1# configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +E1(config)# router bgp 11 +E1(config-router)# neighbor 1.1.1.1 soft-reconfiguration inbound +E1(config-router)# end +E1# +E1# show ip bgp neighbors 1.1.1.1 received-routes +BGP table version is 78, local router ID is 11.11.11.11 + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 629 + +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 0.0.0.0 +*> 181.0.0.0/8 +*> 182.0.0.0/8 +*> 183.0.0.0/8 +*> 184.0.0.0/8 +*> 185.0.0.0/8 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 + +0 0 1 i +0 1 2 111 111 i +0 1 2 222 i +0 1 2 i +0 1 2 i +0 1 2 i + +* 192.135.250.0/28 1.1.1.1 0 1 2 3 4 i + +Total number of prefixes 7 + + +Peer Groups + +Cisco IOS creates BGP updates, by default, on a neighbor-by-neighbor basis. As a result, more neighbors result in more CPU resources being used. Also, by applying nondefault settings (for example, performing filtering using prefix lists, route maps, or filter lists) to those neighbors, even more CPU resources are required. + +However, many neighbors might have similarly configured parameters. Cisco IOS allows you to logically group those similar neighbors into a BGP peer group. Then, you can apply your nondefault BGP configuration to the peer group, as opposed to applying those parameters to each neighbor individually. In fact, a single router can have multiple peer groups, each representing a separate set of parameters. The result can be a dramatic decrease in required CPU resources. + + +Note Even though the filtering operations are performed for a peer group, rather than the individual members of the peer group, a Cisco IOS router still sends out individual BGP Updates to each of its neighbors. This is a requirement, based on BGP’s characteristic of establishing a TCP session with each neighbor. + + +To illustrate the configuration of a peer group, consider Figure 14-9. In the figure, the HQ router has connections to two ISPs. Because the same IP prefix list needs to be applied to each peer, a BGP peer group is used in the configuration, as shown in Example 14-14. + + + + + + + + + + +From the Library of Alexey Evseenko +630 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide +Fa0/0 +198.51.100.2/30 + + + +BGP AS ISP1 64702 + + +BGP AS 64701 + + +HQ +Fa0/1 +198.51.100.1/30 +Fa1/0 +198.51.100.5/30 +Fa0/0 192.0.2.1/24 + +Fa0/1 + + + +Internet + + + +Fa0/1 + +BGP AS ISP2 64703 +Fa0/0 +198.51.100.6/30 + + + +Figure 14-9 Topology Using a BGP Peer Group + +Example 14-14 BGP Peer Group Configuration + +router bgp 64701 +bgp log-neighbor-changes +network 192.0.2.0 +network 198.51.100.0 mask 255.255.255.252 +network 198.51.100.4 mask 255.255.255.252 +neighbor ROUTE-PG peer-group +neighbor ROUTE-PG prefix-list ROUTE-DEMO in +neighbor 198.51.100.2 remote-as 64702 +neighbor 198.51.100.2 peer-group ROUTE-PG +neighbor 198.51.100.6 remote-as 64703 +neighbor 198.51.100.6 peer-group ROUTE-PG +! +ip prefix-list ROUTE-DEMO seq 5 deny 10.0.0.0/8 le 32 +ip prefix-list ROUTE-DEMO seq 10 deny 172.16.0.0/12 le 32 +ip prefix-list ROUTE-DEMO seq 15 deny 192.168.0.0/16 le 32 +ip prefix-list ROUTE-DEMO seq 20 permit 0.0.0.0/0 +ip prefix-list ROUTE-DEMO seq 25 permit 0.0.0.0/0 ge 8 + +The purpose of Example 14-14 is to prevent RFC 1918 private IP addresses from being learned by Router HQ. The neighbor ROUTE-PG peer-group command creates a BGP peer group named ROUTE-PG. The neighbor ROUTE-PG prefix-list ROUTE-DEMO in command applies the ROUTE-DEMO IP prefix list, in the inbound direction, to the peer group. Also, the commands neighbor 198.51.100.2 peer-group ROUTE-PG and neighbor 198.51.100.6 peer-group ROUTE-PG make ISP1 (198.51.100.2) and ISP2 (198.51.100.6) members of the peer group. + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 631 + +BGP Path Attributes and Best-Path Algorithm + +BGP supports a wide variety of Path Attributes (PA). Some of the PAs exist solely to be used as part of the litany of options in the BGP best-path algorithm, some have noth-ing to do with the BGP best-path algorithm, and some impact the best-path algorithm +as well as being used for other purposes. For example, the Local Preference PA exists to give control to a single AS regarding its outbound routes from an AS-wide perspective. Conversely, the BGP Next_Hop PA provides BGP with a place to list the next-hop IP address for a path, but it does not provide a useful means for engineers to set different values for the purpose of influencing the best-path choice. + +The term BGP best-path algorithm refers to the process by which BGP on a single router examines the competing BGP paths (routes) in its BGP table, for a single prefix, choos-ing one route as the best route. The best path algorithm has many steps, but it eventually results in the choice of a single route for each prefix as that router’s best BGP path. + +This section of the chapter examines the BGP PAs used by the BGP best-path algorithm, the BGP best-path algorithm itself, and some related topics. + +BGP Path Attributes + +BGP Path Attributes define facts about a particular route or path through a network. Each PA defines something different about the path, so to truly understand BGP PAs, you need to examine each PA. This section begins by reviewing a few PAs that should now be familiar, and then this section introduces a few new PAs. + +BGP uses the Autonomous System Path (AS_Path) PA for several purposes. This par-ticular PA lists the ASNs in the end-to-end path. BGP uses the AS_Path PA as its primary loop-prevention tool. Specifically, when an eBGP peer receives an Update, if its own ASN is already in the received AS_Path, that route has already been advertised into the local ASN and should be ignored. In addition to loop prevention, the BGP best-path algorithm uses the AS_Path PA to calculate the AS_Path length, which the algorithm considers as one of its many steps. + +BGP also defines the next-hop IP address (Next_Hop) of a route as a PA. BGP can advertise one of several different IP addresses as a route’s Next_Hop, depending on sever-al factors. To support such features, BGP needs to list the Next_Hop IP address for each path (route), and BGP defines this concept in the Next_Hop PA. The best-path algorithm includes a check related to the Next_Hop IP address of the route. + +Table 14-4 lists these two PAs, plus a few more PAs, and a related BGP feature (Weight) that is not a PA but is used by Cisco BGP best-path implementation. The table lists the PAs in the same order that the BGP best-path algorithm will consider them. The table also describes each feature listed in the table, relative to whether it is most useful to influence outbound routes (away from the enterprise) and inbound routes (toward the enterprise). + + + + + + + + +From the Library of Alexey Evseenko +632 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 14-4 Key +Topic PA + + +BGP Path Attributes That Affect the BGP Best-Path Algorithm + +Description Enterprise Route Direction (Typical) + + + +Next_Hop + +Weight +1 + + + +Local Preference (Local_Pref) + + +AS_Path (length) + +Origin + + +Multi-Exit Discriminator (MED) + +Lists the next-hop IP address used to reach a prefix. +A numeric value, range 0 through 216 – 1, set by a router when receiving Updates, +influencing that one router’s route for a prefix. Not advertised to any BGP peers. +A numeric value, range 0 through 232 – 1, set and communicated throughout a single AS for the purpose of influencing the choice of best route for all routers in that AS. +The number of ASNs in the AS_Path PA. + +Value implying that the route was injected into BGP; I (IGP), E (EGP), or ? (incomplete information). +Set and advertised by routers in one AS, impacting the BGP decision of routers in the other AS. Smaller is better. + +— + +Outbound + + + +Outbound + + + +Outbound, Inbound + +Outbound + + +Inbound + + +1 Weight is not a BGP PA; it is a Cisco-proprietary feature that acts somewhat like a PA. + +The short descriptions in the table can be helpful for review when doing your final prepa-ration study, but the table does not hold enough information to truly appreciate how an engineer might use these PAs effectively. The next two major sections of this chapter examine most of these PAs and describe how to influence the best-path choice with each. + +To find the current settings of the features in Table 14-4, you can use commands like show ip bgp and show ip bgp prefix/length. However, picking the values out of the clut-ter in the output of the show ip bgp command can be a challenge. Figure 14-10 shows +a sample of this command’s output and some notations on where to find the various PA settings. + +The examples throughout the rest this chapter include examples of these commands, along with the PA settings as changed by various route maps. + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 633 + + +R3 #show ip bgp +Key BGP table version is 12, local router ID is 3.3.3.3 +Topic Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S stale AS_Path +Origin codes: i - IGP, e - EGP, ? - incomplete + + + +Origin + + + +Network * 11.0.0.0 +* Neighbor > Type +* +* +i +* 12.0.0.0 * +* i > +* +* i 16.0.0.0/4 + +Next Hop 10.1.36.6 10.1.35.5 10.1.14.4 10.1.34.4 10.1.36.6 10.1.35.5 10.1.14.4 10.1.34.4 10.1.14.4 + + +Metric LocPrf Weight Path +0 65000 1 33333 10 200 44 i 0 5 1 33333 10 200 44 i +0 100 0 (111)4 1 33333 10 200 44 i 0 4 1 33333 10 200 44 i +0 65000 1 33333 10 200 44 i 0 5 1 33333 10 200 44 i +0 100 0 (111) 4 1 33333 10 200 44 i 0 4 1 33333 10 200 44 i +0 100 0 (111) 4 {1, 404, 303, 202} i + + +NEXT_HOP LOCAL_PREF MED Weight +Comments: To Discover Other Details… Neighbor Type: No Letter Means “EBGP” IGP Metric: show ip route next-hop-address RID: show ip bgp nlri + +Figure 14-10 Finding PA Settings in the Output of the show ip bgp Command + +Overview of the BGP Best-Path Algorithm + +The BGP best-path algorithm follows the steps shown in shorthand form in Table 14-5. The table lists steps 0 through 8, a short descriptive phrase, and a notation about the cri-teria for one value to be better than another. + +Table 14-5 BGP Decision Process Plus Mnemonic: N WLLA OMNI Key +Topic Step Mnemonic Letter Short Phrase Which Is Better? + + +0 N Next hop: reachable? + +1 W Weight + +2 L Local_Pref + +3 L Locally injected routes + +4 A AS_Path length + +5 O Origin + +6 M MED + +7 N Neighbor type + +8 I IGP metric to Next_Hop + +If no route to reach Next_Hop, router cannot use this route. +Bigger. + +Bigger. + +Locally injected is better than iBGP/ eBGP learned. +Smaller. + +Prefer I over E. Prefer E over ? + +Smaller. + +Prefer eBGP over iBGP. + +Smaller. + + + + + + + +From the Library of Alexey Evseenko +634 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note The step numbering of the BGP best-path steps does not exist in the BGP RFCs. The steps are numbered in this book for easier reference. Because the RFCs do not dictate a particular step numbering, other references likely use different step numbers. Therefore, do not be concerned about memorizing the step numbers. + +Starting with a Step 0 might seem odd, but it helps make an important point about the logic listed at this step. Some BGP best-path references include the logic in this step as a best-path step, and some just list this same information as a side note. Regardless, the +Step 0 concept is important. For Step 0, a router looks at the BGP route and compares the Next_Hop IP address to the IP routing table. + +If that router does not have a matching IP route for the BGP route’s Next_Hop IP address, that router will not know how to forward packets for that particular prefix, using that particular route. To avoid using such a route, at Step 0, the BGP best-path algorithm removes such routes from consideration. BGP then uses the following eight steps, in order, until one best route is chosen for a given prefix. + +If a router still did not determine a best route when finishing Step 8, the router takes several other small steps to break the tie. At this point, the competing routes are consid-ered to be just as good as each other. However, unlike IGPs, BGP needs to choose one and only one route as best, in part because BGP advertises only the best routes to its neighbors. In such cases, BGP breaks the tie with these additional steps, which would be considered Steps 9–11: +Step 9. Oldest (longest-known) eBGP route + +Step 10. Lowest neighbor BGP RID + +Step 11. Lowest neighbor IP address + +Taking a more detailed view of the entire best-path algorithm, BGP begins by choosing the oldest known route for a given prefix as the best route. It then takes the next longest-known route for that same prefix and compares the two routes using the best-path algo-rithm. The router eventually chooses one of the two BGP routes as the best path (route). If another route exists for the same prefix, the router repeats the process, using the win-ner of the previous comparisons and the new route, choosing one of those as the better route. The process continues until all routes have been considered, with one route being listed as best in the BGP table. +For example, if Router R1 were considering two routes for prefix 181.0.0.0/8, it would first make sure that both routes had reachable Next_Hop IP addresses. The router would then compare the Weight settings, choosing the route with the bigger Weight. If they tied on Weight, the router would prefer the route with a bigger Local_Pref. If again a tie, the router would prefer the one route that was injected into BGP locally (using the network command or using route redistribution). If neither or both routes were locally injected, the router moves on to AS_Path length, and so on, until the router chooses one of the two as the better route. +As soon as one of the steps determines a best route, the comparison of those two routes stops. + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 635 + +Perspectives on the Core Eight Best-Path Steps + +Some of the BGP best-path steps purposefully give the engineer a tool for influencing the choice of best path, whereas other steps have a different purpose, often simply being a side effect of some BGP feature. So, when an engineer starts building a BGP implementa-tion plan, only a subset of the core eight BGP best-path steps need be considered, as follows: + +■ Weight (Step 1) +Key +Topic ■ Local_Pref (Step 2) + +■ AS_Path Length (Step 4) + +■ MED (often called metric) (Step 6) + +Because the ROUTE exam focuses on the more practical aspects of BGP for enterprises, it gives much more attention to these four features and less attention to the other BGP best-path steps. This chapter describes each of these four features in some depth in the context of best-path selection. However, before focusing on these four items, it can be helpful to see a small glimpse into the meaning of the other steps, which can be helpful as you work to memorize the steps in the BGP best-path algorithm. + +Step 3 compares the source from which the routes were added to the BGP table. When the BGP best-path algorithm compares two routes at this step, if one were injected into BGP locally and the other were not (it was learned from a BGP peer), the router chooses the route that was injected locally. The Chapter 13 section “Injecting Routes into BGP for Advertisement to the ISPs” describes the two ways to locally inject these routes, the net-work command, and redistribution from an IGP. + +Step 5 refers to the BGP Origin PA. The Origin PA attempts to identify the source from outside BGP from which the route was injected into BGP. The three Origin code values are + +■ i: Injected from an IGP (using a network command) + +■ e: Injected from exterior gateway protocol (EGP) + +■ ?: Undetermined + +Although the original intent of the Origin PA is to identify the source from which BGP learned the route, routers can also set the Origin PA as part of a strategy to influence the BGP best path. + +Step 7 refers to the Neighbor type: iBGP or eBGP. Remembering that BGP compares two routes at a time, if one is learned with eBGP and the other with iBGP, the router chooses the eBGP route as best. Using this feature to influence the best-path choice would be dif-ficult, because the ASN in which a router resides is fixed by the BGP design. + +Finally, Step 8 refers to the IGP metric to the Next_Hop address. At this step, the router compares the metrics of the IP routes for each Next_Hop IP address and chooses the BGP route with the lower IGP metric to its Next_Hop. (If an IGP-learned route is not + + + + +From the Library of Alexey Evseenko +636 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +used—for example, if both use connected routes—BGP considers the metrics to tie.) It is conceivable that an engineer might tune the IGP to manipulate BGP’s best-path choice, but this step is so far into the algorithm that the earlier and more flexible settings would be much better options. + +Memorization Tips for BGP Best Path + +This short section suggests a mnemonic tool to help you memorize Steps 0 through 8 of the BGP best-path algorithm. Feel free to skim this section for now, or ignore it +entirely—there is no requirement that you memorize the best-path algorithm using the mnemonics in this section. (However, you might want to at least review upcoming Figure 14-11, which gives a good visual reference for some of the information summarized in Table 14-5.) But you should plan on memorizing the list at some point before the exam, even if you ignore the mnemonic device. + + + +N W L L A O M N I + + + + +Popular to Influence Outbound Routes + + +Popular to Influence Inbound Routes + + +Figure 14-11 BGP Best-Path Mnemonics + +First, if you refer back to the BGP best-path algorithm as listed in Table 14-5, you see that the second column lists a single-letter mnemonic letter. These letters match the first letter of the description in the third column of that table. Then, take these initial letters and group them as follows: + +■ N + +■ WLLA + +■ OMNI + +The N is listed separately, because it represents the “Is the next-hop reachable?” logic of Step 0 and is somewhat separate from the other steps. + +The mnemonic groups the eight main steps as two sets of four letters for a couple of rea-sons. Both sets can be pronounced, even if they don’t spell words. It should be easier to memorize as two sets of four. And maybe most importantly, the first set of four letters, representing Steps 1 through 4, include all the features that engineers typically use to influence outbound routes from the enterprise: + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 637 + +■ WLLA: Refers to the three steps that an engineer might use to influence outbound routes: Weight, Local_Pref, and AS_Path length. (Additionally, the second L, in WLLA for Step 3, represents the “Locally injected routes” choice.) + +■ OMNI: As listed in Table 14-5, the letters represent Origin (i, e, or ?), MED, neigh-bor type (eBGP over iBGP), and IGP metric to Next_Hop. + +So, if you can memorize N WLLA OMNI, by the time you’ve read this chapter, you can probably pick out which of those correlate to the four bigger topics later in this chapter: Weight, Local_Pref, AS_Path length, and MED. Hopefully with a little more study, you can memorize the rest of the list. + +Figure 14-11 shows the mnemonic letters in graphical form just as another aid in memo-rizing the steps. It also shows a reminder of which features are most likely to be used to influence outbound routes from the enterprise, and the one setting (MED) most likely to be used to influence inbound routes into the enterprise. + +The rest of this chapter focuses on a deeper explanation of the four best-path steps that engineers typically use to influence the choice of best path. + +Influencing an Enterprise’s Outbound Routes + +This section examines three different features that can influence the outbound routes from an enterprise: Weight, the Local_Pref PA, and AS_Path length. The topics are listed in the order used by the BGP best-path algorithm (Steps 1, 2, and 4). It also introduces the concept of a Routing Table Manager (RTM) function on a router. + +Influencing BGP Weight + +A Cisco router can use the BGP Weight, on that single router, to influence that one rout-er’s choice of outbound route. To do so, when a router receives a BGP Update, that router can set the Weight either selectively, per route, using a route map, or for all routes learned from a single neighbor. The router’s best-path algorithm then examines the Weight of competing routes, choosing the route with the bigger Weight. + +The Cisco-proprietary Weight settings configured on a single router can influence only that one router, because the Weight cannot be communicated to other neighboring BGP routers. So, to use the Weight, a router must be configured to examine incoming Updates to set the Weight. The Weight cannot simply be learned in a received Update, because that Update message does not support a field in which to communicate the Weight setting. + +Table 14-6 summarizes some of the key facts about BGP administrative Weight. Following the table, the text first explains a sample internetwork and its existing configu-ration, a configuration that begins with configurations that do not set any values that influence the choice of best paths. The next section shows how to set the Weight using the neighbor route-map in command, which allows a router to set different Weights for different routes. The second example shows how to set the Weight for all routes learned from a neighbor, using the neighbor weight command. + + + + +From the Library of Alexey Evseenko +638 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 14-6 Key +Topic Feature + +Is it a PA? + +Purpose + +Scope + +Range + + +Key Features of Administrative Weight + +Description +No; Cisco-proprietary feature + +Identifies a single router’s best route + +Set on inbound route Updates; influences only that one router’s choice +0 through 65,535 (216 – 1) + + + +Which is better? + +Default + +Defining a new default + +Configuration + +Bigger values are better + +0 for learned routes, 32,768 for locally injected routes + +Not supported + +neighbor route-map (per prefix) neighbor weight (all routes learned from this neighbor) + + + +Note For those of you memorizing using the N WLLA OMNI mnemonic, Weight is the W in WLLA. + + + +Sample Internetwork Used in the Weight Examples + +Figure 14-12 shows a sample internetwork used to demonstrate setting the Weight. +The figure shows a single enterprise and a single enterprise router. The following design requirements have already been met by the configuration in Router E1 and in the ISP routers: + +■ E1 and I1-1 use loopback IP addresses (11.11.11.11 and 1.1.1.1) for their neighborship. + +■ E1 and I3-1 use interface IP addresses for their neighborship. + +■ None of the routers have attempted to change any settings that can impact the choice of best path. + +Next, to have some routes to manipulate with the upcoming examples, the ISP routers each advertise BGP routes for the same five prefixes. Figure 14-13 shows five such pre-fixes that both ISPs advertise to E1. + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 639 + + + +RID 11.11.11.11 + +11.11.11.11 eBGP + +ASN 1 ISP1 + + +1.1.1.1 + + +E1 I1-1 RID 1.1.1.1 + +192.168.1.1 + + + + +eBGP ASN 3 ISP3 + + +192.168.1.2 +I3-1 RID 3.3.3.3 + + + +Figure 14-12 Sample Internetwork for BGP Weight Examples + + + +Best BGP Routes: 181,182 : I1-1 183 : I1-1 184,185 : I3-1 + +E1 + + +BGP Update + +Prefix/Length AS_Path Length +181/8 2 182/8 3 183/8 4 184/8 5 185/8 6 + + + +ASN 1 ISP1 + + + +I1-1 + + + +Internet + + + +BGP Update + +Prefix/Length AS_Path Length +181/8 6 182/8 5 183/8 4 184/8 3 185/8 2 + + +ASN 3 ISP3 + + + +I3-1 + + +Figure 14-13 Prefixes and AS_Path Lengths Used in Upcoming Examples + + + + + +From the Library of Alexey Evseenko +640 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Just to get a little deeper understanding of the best-path algorithm before getting into the Weight configuration, consider the original configuration state of the sample internet-work, with no attempt to influence E1’s choice of best path. The best path for four of the five prefixes will be obvious. Prefixes 181.0.0.0/8 and 182.0.0.0/8 have a shorter AS_Path through ISP1, and 184.0.0.0/8 and 185.0.0.08 have a shorter AS_Path through ISP3. Only 183.0.0.0/8 is in question, because its AS_Path length for the competing routes is equal. Example 14-15 shows the output of the show ip bgp 176.0.0.0/4 longer-prefixes com-mand, which lists all five of the BGP prefixes listed in Figure 14-13, confirming the results. (Prefix 176.0.0.0/4 implies a range of values whose first octets are in the range 176 through 191, which includes the routes listed in Example 14-15.) + +Example 14-15 BGP Configuration on E1: Neighborships Configured + +E1# show ip bgp 176.0.0.0/4 longer-prefixes +BGP table version is 41, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +* 181.0.0.0/8 192.168.1.2 0 0 3 2 50 51 52 1811 i +*> 1.1.1.1 0 0 1 1811 i +* 182.0.0.0/8 192.168.1.2 0 0 3 2 50 51 1822 i +*> 1.1.1.1 0 0 1 2 1822 i +* 183.0.0.0/8 192.168.1.2 0 0 3 2 50 1833 i + +*> +*> 184.0.0.0/8 +* +*> 185.0.0.0/8 +* + +1.1.1.1 +192.168.1.2 +1.1.1.1 +192.168.1.2 +1.1.1.1 + +0 0 1 2 50 1833 i +0 0 3 2 1844 i +0 0 1 2 50 51 1844 i +0 0 3 1855 i +0 0 1 2 50 51 52 1855 i + + +First, consider the best-path algorithm on Router E1 for 181.0.0.0/8. E1 knows two BGP routes for 181.0.0.0/8, as expected. The one listed as the best path has 1.1.1.1 (I1-1) as Next_Hop. The following list outlines the best-path logic: +Step 0. The Next_Hop of each is reachable. (Otherwise the neighbors would not be up.) + +Step 1. The Weight ties (both 0). + +Step 2. The Local_Pref ties (unset, so no value is listed; defaults to 100). + +Step 3. Neither route is locally injected; both are learned using BGP, so neither is bet-ter at this step. + +Step 4. AS_Path length is shorter for the route through I1-1 (1.1.1.1). + +Next, consider the example of the route to 183.0.0.0/8. E1 currently lists the path through I1-1 (1.1.1.1) as best, but the best-path decision actually falls all the way to Step 9. For completeness’ sake, E1’s best-path logic runs as follows: + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 641 + +Step 0. The Next_Hop of each is reachable. (Otherwise the neighbors would not be up.) + +Step 1. The Weight ties (both 0). + +Step 2. The Local_Pref ties (unset, defaults to 100). + +Step 3. Neither route is locally injected. + +Step 4. AS_Path length is 4 in both cases. + +Step 5. Both Origin codes are i . + +Step 6. MED, listed under the Metric column, ties (0). + +Step 7. Neighbor type for each neighbor is eBGP. + +Step 8. IGP metric does not apply, because neither uses IGP routes. (The routes from E1 to 1.1.1.1 are static routes.) + +Step 9. The route learned from 1.1.1.1 is the oldest route. + +Although you might believe the claims at Step 9, the output in Example 14-15 does not explicitly state that fact. However, when Cisco IOS lists output in the variations of the show ip bgp command, the oldest route for each prefix is listed last, and the newest (most recently learned) is listed first. Example 14-16 confirms this logic, and confirms how Step 9 works in this case. Example 14-16 clears peer 1.1.1.1 (I1-1), making E1’s route through 192.168.1.2 (I3-1) become the oldest known route for 183.0.0.0/8. + +Example 14-16 Clearing Neighbors to Force a New Route + +E1# clear ip bgp 1.1.1.1 +E1# +*Aug 24 11:30:41.775: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down User reset +*Aug 24 11:30:43.231: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up +E1# show ip bgp 176.0.0.0/4 longer-prefixes +BGP table version is 47, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +-r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 181.0.0.0/8 +* +*> 182.0.0.0/8 +* + +1.1.1.1 +192.168.1.2 +1.1.1.1 +192.168.1.2 + +0 0 1 1811 i +0 0 3 2 50 51 52 1811 i +0 0 1 2 1822 i +0 0 3 2 50 51 1822 i + +* 183.0.0.0/8 1.1.1.1 0 0 1 2 50 1833 i +*> 192.168.1.2 0 0 3 2 50 1833 i +* 184.0.0.0/8 1.1.1.1 0 0 1 2 50 51 1844 i +*> 192.168.1.2 0 0 3 2 1844 i +* 185.0.0.0/8 1.1.1.1 0 0 1 2 50 51 52 1855 i +*> 192.168.1.2 0 0 3 1855 i + + + + +From the Library of Alexey Evseenko +642 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +After the hard reset of peer 1.1.1.1, E1’s oldest-known route for 183.0.0.0/8 is the route through 192.168.1.2, listed second (last). That E1 now chooses this route as best is anoth-er confirmation that E1’s best-path decision fell to Step 9. + +Setting the BGP Administrative Weight Using a Route Map + +The neighbor neighbor-ip route-map in BGP subcommand tells a router to apply the route map to all BGP Updates received from the listed neighbor. Such route maps always attempt to filter routes. The router allows routes first matched in a permit clause and fil-ters (discards) routes first matched with a deny clause. + +BGP route maps can also be used to change the PAs of routes by using the set com-mand. For example, a router could use a neighbor 1.1.1.1 route-map fred in command. The route map could contain permit clauses that cause some routes to not be filtered. In those same route map clauses, the inclusion of commands such as set weight 100 and set local-preference 200 can be used to set items such as the Weight or Local_Pref of a route. (Although you can configure a set command in a route map deny clause, the set command has no effect, because the deny clause filters the route.) + +Example 14-17 shows a sample configuration that sets the Weight for prefix 181.0.0.0/8 as learned from I3-1 (neighbor ID 192.168.1.2). As shown in Example 14-15, E1’s original best route for this prefix is through I1-1 (1.1.1.1), because of the shorter AS_Path length at Step 4 of the best-path algorithm. By setting the Weight higher on the route learned from I3-1, E1 now chooses the route through I3-1. + +Example 14-17 Setting the Weight to 50 for 181/8, as Learned from I3-1 + +E1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +E1(config)# ip prefix-list match-181 permit 181.0.0.0/8 +E1(config)# route-map set-weight-50 permit 10 +E1(config-route-map)# match ip address prefix-list match-181 +E1(config-route-map)# set weight 50 +E1(config-route-map)# route-map set-weight-50 permit 20 +E1(config-route-map)# router bgp 11 +E1(config-router)# neighbor 192.168.1.2 route-map set-weight-50 in +E1(config-router)# end +E1# +E1# clear ip bgp 192.168.1.2 soft +E1# show ip bgp 176.0.0.0/4 longer-prefixes +BGP table version is 48, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +* 181.0.0.0/8 1.1.1.1 0 0 1 1811 i +*> 192.168.1.2 0 50 3 2 50 51 52 1811 i + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 643 + + +*> 182.0.0.0/8 +* + +1.1.1.1 +192.168.1.2 + +0 0 1 2 1822 i +0 0 3 2 50 51 1822 i + +* 183.0.0.0/8 1.1.1.1 0 0 1 2 50 1833 i +*> 192.168.1.2 0 0 3 2 50 1833 i +* 184.0.0.0/8 1.1.1.1 0 0 1 2 50 51 1844 i +*> 192.168.1.2 0 0 3 2 1844 i +* 185.0.0.0/8 1.1.1.1 0 0 1 2 50 51 52 1855 i +*> 192.168.1.2 0 0 3 1855 i + +! The next command lists the pre-route-map received Update +E1# show ip bgp neigh 192.168.1.2 received-routes | include 181 +* 181.0.0.0/8 192.168.1.2 0 0 3 2 50 51 52 1811 i + +! The next command shows the post-route-map received Update +E1# show ip bgp neigh 192.168.1.2 routes | incl 181 +*> 181.0.0.0/8 192.168.1.2 0 50 3 2 50 51 52 1811 i + +The configuration uses a single-line IP prefix list that matches exactly prefix 181.0.0.0/8, and a two-clause route map. The first route map clause, a permit clause, matches 181.0.0.0/8. The permit action allows the route through the filter. The set weight 50 com-mand then sets the Weight. + +The second route map clause, also with a permit action, matches the rest of the prefixes in the Update, because there is no match command. The permit action allows these routes through the filter. Without clause 20, this route map would have matched all other routes with the route map’s implied deny clause at the end of every route map, filtering all other routes learned from 192.168.1.2 except 181.0.0.0/8. + +The configuration also includes a neighbor 192.168.1.2 route-map set-weight-50 in command to enable the route map for incoming updates from Router I3-1. The example also shows that the neighbor must be cleared, in this case with a soft reset command of clear ip bgp 192.168.1.2 soft, which causes the route map logic to take effect. + +Examining the results of this change, note that E1 now thinks the better route is through I3-1 (192.168.1.2). The output lists the new Weight of 50, with the route through I1-1 (1.1.1.1) using the default Weight of 0. With Weight, bigger is better. + +Finally, the last two commands in the example show the pre-route map received update (with the received-routes option) and the post-route map results of the received update (with the routes option). The received Update does not include Weight, because it is Cisco-proprietary. So, E1 initially assigned the Weight to its default value (0). After apply-ing the route map, E1 now lists a Weight of 50. + +Setting Weight Using the neighbor weight Command + +Alternatively, the Weight can be set for all routes learned from a neighbor using the neighbor weight command. Example 14-18 shows this configuration added to E1, set-ting the Weight for all routes learned from I1-1 (1.1.1.1) to 60. As a result, E1’s route for 181.0.0.0/8 switches back to using the route through 1.1.1.1 (I1-1). + + + +From the Library of Alexey Evseenko +644 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 14-18 Setting the Weight to 60 for All Routes Learned from I1-1 + +E1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +E1(config)# router bgp 11 +E1(config-router)# neighbor 1.1.1.1 weight 60 +E1(config-router)# end +E1# clear ip bgp 1.1.1.1 soft + +E1# show ip bgp 176.0.0.0/4 longer-prefixes +BGP table version is 54, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 181.0.0.0/8 +* +*> 182.0.0.0/8 +* +*> 183.0.0.0/8 +* +*> 184.0.0.0/8 +* +*> 185.0.0.0/8 +* + +1.1.1.1 +192.168.1.2 +1.1.1.1 +192.168.1.2 +1.1.1.1 +192.168.1.2 +1.1.1.1 +192.168.1.2 +1.1.1.1 +192.168.1.2 + +0 60 1 1811 i +0 50 3 2 50 51 52 1811 i +0 60 1 2 1822 i +0 0 3 2 50 51 1822 i +0 60 1 2 50 1833 i +0 0 3 2 50 1833 i +0 60 1 2 50 51 1844 i +0 0 3 2 1844 i +0 60 1 2 50 51 52 1855 i +0 0 3 1855 i + + +The neighbor weight command does not use an in or out direction, because Weight can only be set on input. The configuration results in all routes learned from 1.1.1.1 (I1-1) hav-ing a Weight of 60, as noted in the Weight column of the show ip bgp output. + +Setting the Local Preference + +The BGP Local Preference (Local_Pref) PA gives the routers inside a single AS a value that they can set per-route and advertise to all iBGP routers inside the AS, so that all routers in the AS agree about which router is the best exit point for packets destined for that prefix. By design, Local_Pref can be set by routers as they receive eBGP routes by using an inbound route map. The routers then advertise the Local_Pref in iBGP updates. As +a result, all the routers in the same AS can then make the same choice of which route is best, agreeing as to which router to use to exit the AS for each prefix. + +As with the discussion of Weight, this section begins with a description of a sample sce-nario. Following that, a sample Local_Pref configuration is shown, using a route map to set Local_Pref for routes advertised into an enterprise. Table 14-7 summarizes some of the key features of Local_Pref as demonstrated in the upcoming pages. + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 645 + + +Table 14-7 Key +Topic Feature + +PA? + +Purpose + +Scope + +Range + + +Key Features of Local_Pref + +Description +Yes + +Identifies the best exit point from the AS to reach a given prefix + +Throughout the AS in which it was set; not advertised to eBGP peers + +0 through 4,294,967,295 (232 – 1) + + + +Which is better? + +Default + +Changing the default + +Configuration + +Higher values are better + +100 + +Using the bgp default local-preference <0-4294967295> BGP subcommand +Through the neighbor route-map command; in option is required for updates from an eBGP peer + + + +Note For those of you memorizing using the N WLLA OMNI mnemonic, Local_Pref is the first L in WLLA. + + + +Sample Internetwork Used in the Local_Pref and AS_Path Length Examples + +Figure 14-14 shows a sample internetwork used to demonstrate setting both Local_Pref, and later, AS_Path length. The figure shows a single enterprise with two Internet-connected routers. A full iBGP mesh exists with these two routers plus two routers inter-nal to the enterprise. Two eBGP neighborships exist, one with ISP1 and one with ISP3. (Note in particular that unlike Figure 14-12, E1 does not have a neighborship with Router I3-1 in this case.) The following design requirements have already been met by the initial configuration in all routers shown in the figure: + +■ E1 and I1-1 use loopback IP addresses (11.11.11.11 and 1.1.1.1) for their neighborship. + +■ E2 and I3-1 use interface IP addresses for their neighborship. + +■ None of the routers have attempted to change any settings that can impact the choice of best path, and Weight settings in the previous examples have been removed. + + + + + + + + + + + + +From the Library of Alexey Evseenko +646 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ASN 1 ISP1 + +Core1 11.11.11.11 eBGP 1.1.1.1 + +E1 I1-1 + +10.100.1.3 10.100.1.1 + + +iBGP Mesh + +ASN 3 ISP3 + +10.100.1.4 10.100.1.2 + + + +E2 +Core2 192.168.1.5 eBGP + +I3-1 +192.168.1.6 + + +Figure 14-14 Sample Internetwork for BGP Local_Pref and AS_Path Length Examples + +As with the Weight example, both ISPs advertise the same five prefixes, with different AS_Paths, so that the routers have some prefixes to manipulate. Figure 14-15 shows five such prefixes that both ISPs advertise to E1 and E2. Note that this example network uses the same five prefixes, prefix lengths, and AS_Path values as the previous Weight exam-ples in this chapter. + + +Best BGP Routes: 181,182 : I1-1 183 : I1-1 +184,185 : E2 + +E1 + + + + + +Best BGP Routes: +181,182 : E1 183 : I3-1 184,185 : I3-1 +E2 + + +BGP Update +Prefix/Length AS_Path Length +181/8 2 182/8 3 183/8 4 184/8 5 185/8 6 + + + + +BGP Update +Prefix/Length AS_Path Length +181/8 6 182/8 5 183/8 4 184/8 3 185/8 2 + + +ASN 1 ISP1 + + + +I1-1 + + + + +Internet + +ASN 3 ISP3 + + + +I3-1 + + +Figure 14-15 Prefixes and AS_Path Lengths Used in Upcoming Examples + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 647 + +Before showing the example of how to set the Local_Pref and how it impacts the routes, it is helpful to look at the best BGP routes on the enterprise routers before any PAs have been changed. Example 14-19 shows the relevant BGP table entries on E1, E2, and Core1 with no attempt to influence E1’s choice of best path. The best path for four of the five prefixes will be obvious, but the output listed in the commands requires some review. Prefixes 181.0.0.0/8 and 182.0.0.0/8 have a shorter AS_Path through ISP1, so E1 and E2 will agree that E1’s path, through ISP1, is best. Similarly, 184.0.0.0/8 and 185.0.0.08 have +a shorter AS_Path through ISP3, so both E1 and E2 agree that E2’s path is best for these prefixes. Again, 183.0.0.0/8 ties on AS_Path length. + +Example 14-19 BGP Tables on E1, E2, and Core1, with No Changes to Settings That Affect Best Path + +! First, on router E1 +E1# show ip bgp 176.0.0.0/4 longer-prefixes +BGP table version is 15, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 181.0.0.0/8 +*> 182.0.0.0/8 +* i183.0.0.0/8 +*> +*>i184.0.0.0/8 +* +*>i185.0.0.0/8 +* + +1.1.1.1 +1.1.1.1 +10.100.1.2 +1.1.1.1 +10.100.1.2 +1.1.1.1 +10.100.1.2 +1.1.1.1 + +0 0 1 1811 i +0 0 1 2 1822 i +0 100 0 3 2 50 1833 i +0 0 1 2 50 1833 i +0 100 0 3 2 1844 i +0 0 1 2 50 51 1844 i +0 100 0 3 1855 i +0 0 1 2 50 51 52 1855 i + + +! Next, on router E2 +E2# show ip bgp 176.0.0.0/4 longer-prefixes +! legend omitted for brevity + +Network Next Hop Metric LocPrf Weight Path + +*>i181.0.0.0/8 +* +*>i182.0.0.0/8 +* +* i183.0.0.0/8 +*> +*> 184.0.0.0/8 +*> 185.0.0.0/8 + +10.100.1.1 +192.168.1.6 +10.100.1.1 +192.168.1.6 +10.100.1.1 +192.168.1.6 +192.168.1.6 +192.168.1.6 + +0 100 0 1 1811 i +0 0 3 2 50 51 52 1811 i +0 100 0 1 2 1822 i +0 0 3 2 50 51 1822 i +0 100 0 1 2 50 1833 i +0 0 3 2 50 1833 i +0 0 3 2 1844 i +0 0 3 1855 i + + +! Next, on router Core1 +Core1# show ip bgp 176.0.0.0/4 longer-prefixes +! legend omitted for brevity + + + + +From the Library of Alexey Evseenko +648 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Network Next Hop Metric LocPrf Weight Path + +*>i181.0.0.0/8 +*>i182.0.0.0/8 +*>i183.0.0.0/8 +* i +*>i184.0.0.0/8 +*>i185.0.0.0/8 + +10.100.1.1 +10.100.1.1 +10.100.1.1 +10.100.1.2 +10.100.1.2 +10.100.1.2 + +0 100 0 1 1811 i +0 100 0 1 2 1822 i +0 100 0 1 2 50 1833 i +0 100 0 3 2 50 1833 i +0 100 0 3 2 1844 i +0 100 0 3 1855 i + + +First, pay close attention to the LocPrf column of output in the example. This column lists the Local_Pref settings of each route. Some list a (default) value of 100, and some list nothing. As it turns out, because Updates received from eBGP peers do not include the Local_Pref PA, Cisco IOS lists a null value for Local_Pref for eBGP-learned routes by default. However, Updates from iBGP peers do include the Local_Pref. Because this network does not have any configuration that attempts to set Local_Pref yet, the routers advertise their default Local_Pref value of 100 over the iBGP connections. + +Also note that when comparing the output on both E1 and E2, the output lists a single eBGP route, but not the alternative iBGP route through the other Internet-connected router in the enterprise. For example, E2 lists a single route for 184.0.0.0/8 and 185.0.0.0/8, through I3-1 (192.168.1.6). The reason that E2 does not list an alternative route through E1 is that E1’s best route for these prefixes, as seen near the top of the example, is E1’s iBGP-learned route through E2 (10.100.1.2). BGP does not allow a router to advertise iBGP-learned routes to iBGP peers, so E1 will not advertise routes for 184.0.0.0/8 or 185.0.0.0/8 to Router E2. + +Finally, for prefix 183.0.0.0/8, both E1 and E2 tie on the AS_Path length. In this case, all best-path choices tie until Step 7, which prefers eBGP routes over iBGP routes. E1 prefers its eBGP route for 183.0.0.0/8 through ISP1’s Router I1-1, and E2 prefers its eBGP route through ISP3’s Router I3-1. + +Setting the BGP Local_Pref Using a Route Map + +To set the Local_Pref, a router can use the neighbor neighbor-ip route-map in BGP sub-command. Typically, a router uses this command with the inbound direction for routes received from eBGP peers. Then, with no additional configuration required, the router then advertises the Local_Pref to any iBGP peers. + +To show the Local_Pref configuration and results, start with the sample network shown in the previous section. The configuration will now be changed to set the Local_Pref for two different prefixes for Updates received on E1 from I1-1, as shown in Figure 14-16. Note that the figure reinforces the idea that BGP does not include the Local_Pref PA in eBGP Updates but will in iBGP Updates. + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 649 + + + +Key Topic + +Set 184.0.0.0/8 Local_Pref = 50 Set 185.0.0.0/8 Local_Pref = 150 + + +2 +1 +184/8, 185/8 +E1 No Local_Pref I1-1 + + + +3 +iBGP Updates with Local_Pref Set + + + +184.0.0.0/8: My Local_Pref = 100 is Better 185.0.0.0/8: E1’s Local_Pref = 150 is Better + + +4 +1 184/8, 185/8 +E2 No Local_Pref I3-1 + + +Figure 14-16 Example Local_Pref Settings for the Upcoming Example + +The figure shows a series of steps, as follows: + +Step 1. I1-1 and I3-1 advertise the prefixes into the enterprise but with no Local_Pref set, because the connections are eBGP peers. + +Step 2. E1 sets the Local_Pref for routes learned from I1-1: 184.0.0.0/8 (50) and 185.0.0.0/8 (150). + +Step 3. E1 includes the Local_Pref settings in its iBGP Updates to Core1, Core2, and E2. + +Step 4. E2 realizes that E1’s route for 185.0.0.0/8, Local_Pref 150, is better than E2’s eB-GP route for this prefix, which E2 assigned default Local_Pref 100. Converse-ly, E1’s advertised route for 184.0.0.0/8, Local_Pref 50, is worse than E2’s eBGP route for that same prefix, with the assigned default Local_Pref of 100. + +Example 14-20 shows the configuration on Router E1 to assign the Local_Pref values shown in Figure 14-16. The example also shows the results on E1 and E2. Note that the configuration differs only slightly as compared with the configuration for administrative Weight as shown in Example 14-17, the only substantive difference being the set local-preference route map command rather than the set weight command. + +Example 14-20 Configuring Local_Pref on Router E1 (Step 2 per Figure 14-16) + +E1# show running-config +! only pertinent portions shown +ip prefix-list match-184 seq 5 permit 184.0.0.0/8 +! +ip prefix-list match-185 seq 5 permit 185.0.0.0/8 +! +route-map set-LP-150 permit 10 +match ip address prefix-list match-185 +set local-preference 150 +! +route-map set-LP-150 permit 15 + + + + +From the Library of Alexey Evseenko +650 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +match ip address prefix-list match-184 +set local-preference 50 +! +route-map set-LP-150 permit 20 +! +router bgp 11 +neighbor 1.1.1.1 route-map set-LP-150 in + +! The clearing of BGP neighbor I1-1 is done next, but not shown. +! Next, E1's Updated BGP Table + +E1# show ip bgp 176.0.0.0/4 longer-prefixes +BGP table version is 29, local router ID is 128.107.9.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*> 181.0.0.0/8 +*> 182.0.0.0/8 +* i183.0.0.0/8 +*> +*>i184.0.0.0/8 +* +*> 185.0.0.0/8 + +1.1.1.1 +1.1.1.1 +10.100.1.2 +1.1.1.1 +10.100.1.2 +1.1.1.1 +1.1.1.1 + +0 0 1 1811 i +0 0 1 2 1822 i +0 100 0 3 2 50 1833 i +0 0 1 2 50 1833 i +0 100 0 3 2 1844 i +0 50 0 1 2 50 51 1844 i +0 150 0 1 2 50 51 52 1855 i + + +E1# show ip bgp 185.0.0.0/8 +BGP routing table entry for 185.0.0.0/8, version 7 +Paths: (1 available, best #1, table Default-IP-Routing-Table) +Advertised to update-groups: +1 +1 2 50 51 52 1855, (received & used) +1.1.1.1 from 1.1.1.1 (1.1.1.1) +Origin IGP, metric 0, localpref 150, valid, external, best + +! The next output occurs on router E2 +E2# show ip bgp 185.0.0.0/8 longer-prefixes +! heading lines omitted + +Network Next Hop Metric LocPrf Weight Path + +*>i185.0.0.0/8 +* + +10.100.1.1 +192.168.1.6 + +0 150 0 1 2 50 51 52 1855 i +0 0 3 1855 i + + +Example 14-20’s output shows E1’s BGP table entries, now with updated Local_Pref val-ues as compared with Example 14-19. E1 now uses its eBGP route, Next_Hop 1.1.1.1, for prefix 185.0.0.0/8 because of the higher Local_Pref. + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 651 + +The end of the example shows E2 with two possible routes for 185.0.0.0/8. The following list outlines E2’s BGP best-path logic in this case: +Step 0. The two routes both have reachable Next_Hop IP addresses. + +Step 1. Both have Weight 0 (tie). + +Step 2. The iBGP route through 10.100.1.1 (E1) has a bigger (better) Local_Pref (150 versus 100) than the route through 192.168.1.6 (I3-1), so it is the better route. + +Also, note that both the show ip bgp longer-prefixes command’s briefer output, and the show ip bgp 185.0.0.0/8 commands more verbose output, both identify the Local_Pref value. However, the longer command output does not list the Weight value. + +IP Routes Based on BGP Best Paths + +Some of the complexity related to BGP occurs around the BGP functions created by BGP PAs, including their use by the best-path algorithm. When the BGP best-path algorithm has gotten through this complexity and chosen a best route for a prefix, the router then tries to add that route to the IP routing table. However, rather than add the BGP route to the IP routing table directly, BGP actually gives that best BGP route to another process for consideration: the Cisco IOS Routing Table Manager (RTM). + +The Cisco IOS RTM chooses the best route among many competing sources. For exam-ple, routes can be learned by an IGP, BGP, or even as connected or static routes. Cisco IOS collects the best such route for each prefix and feeds those into the RTM function. The RTM then chooses the best route. Figure 14-17 shows the general idea. + +Connected Routes + + + + + + +BGP Best Routes Only + +Routing +Table Best IGP Manager Only Routes +(RTM) + + + + + +IP Routing Table +Routing Information Base (RIB) + + +Figure 14-17 Routing Table Manager Concept + + + +From the Library of Alexey Evseenko +652 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Among its tasks, RTM uses the concept of administrative distance (AD) to choose the best route among these different sources. Table 14-8 provides a reminder (and a reference) for the default AD of various route information sources. However, focus on the eBGP and iBGP AD values. + +Table 14-8 Default Administrative Distances + + +Route Type +Connected + +Static + +EIGRP summary route + +eBGP + +EIGRP (internal) + +IGRP + +OSPF + +IS-IS + +RIP + +On-Demand Routing (ODR) + +EIGRP (external) + +iBGP + +Unreachable + +Administrative Distance +0 + +1 + +5 + +20 + +90 + +100 + +110 + +115 + +120 + +160 + +170 + +200 + +255 + + + +For the most part, an enterprise router should not see cases in which a prefix learned with BGP has also been learned as a connected or IGP-learned route. (Conversely, these issues occur more often when implementing MPLS VPNs with BGP/IGP redistribution.) However, it can happen, and when it does, the show ip bgp rib-failures command can be helpful. This command lists routes for which BGP has chosen the route as best, but the RTM function has not placed the route into the Routing Information Base (RIB), which is simply another name for the IP routing table. + +Example of a BGP RIB Failure + +To show an example of a RIB failure, imagine that an enterprise engineer needs to do some testing, so the engineer just picks an IP address range to use. The engineer tries to avoid problems by not using network 10.0.0.0, which is used throughout the enter-prise. Rather than choosing another private network, the engineer chooses public range +185.0.0.0/8. After changing the lab configuration repeatedly, a route for 185.0.0.0/8 leaks into the OSPF topology database. + +Keep in mind that at the end of the previous example, E1 had chosen its eBGP route for 185.0.0.0/8 as its best route, and E2 had chosen its iBGP route as its best route for + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 653 + +185.0.0.0/8. Example 14-21 shows the results, based on RTM’s comparisons of the AD values. + +Example 14-21 Example with the RTM and RIB Failures + +! First, E1's IP Routing table for 185.0.0.0/8 +E1# show ip route 185.0.0.0 255.0.0.0 longer-prefixes +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 1.1.1.1 to network 0.0.0.0 + +B 185.0.0.0/8 [20/0] via 1.1.1.1, 00:25:11 + +! Next, E2's IP Routing table +E2# show ip route 185.0.0.0 255.0.0.0 longer-prefixes +! Legend omitted for brevity + +Gateway of last resort is 192.168.1.6 to network 0.0.0.0 + +O 185.0.0.0/8 [110/2] via 10.1.1.77, 00:15:44, FastEthernet0/0 + +E2# show ip bgp rib-failure + +Network +185.0.0.0/8 + +Next Hop +10.100.1.1 + +RIB-failure +Higher admin distance + +RIB-NH Matches +n/a + + +The first command shows that E1, with an eBGP route, actually adds its route to the IP routing table. The route lists a code of B, meaning BGP. The output lists the eBGP default AD of 20, which is a better default AD than OSPF’s 110. RTM added this BGP route to the IP routing table on E1 because of eBGP’s better AD. + +E2 currently lists its iBGP route through E1 as its current best BGP route for 185.0.0.0/8 because of the higher Local_Pref configured in Example 14-20. However, after giving this route to the RTM, RTM instead chose the lower-AD OSPF route (AD 110) rather than the higher-AD iBGP route (AD 200). + +Finally, the show ip bgp rib-failure command lists one line for each best BGP route that the RTM does not place into the IP routing table. In this case, this command on Router E2 lists the route for 185.0.0.0/8, with the reason listed. + + + + + + + + +From the Library of Alexey Evseenko +654 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +BGP and the maximum-paths Command + +Like the IGP protocols, BGP supports the maximum-paths number-of-paths subcom-mand, but BGP uses significantly different logic than the IGPs. Unlike the IGP routing protocols, BGP truly needs to pick one route, and only one route, as the best path for a given prefix/length. In effect, the BGP best-path algorithm already breaks the ties for +“best” route for each prefix. Therefore, from BGP’s perspective, one route for each prefix is always best. + +BGP does allow multiple BGP routes for a prefix to be considered to tie, at least for the purpose of adding multiple routes to the IP routing table. The conditions are as follows: + +If the BGP best-path algorithm does not choose a best path by Step 8 (per the num-bering in this book), the routes which still tie for being best path will be allowed into the IP routing table, up to and including the number defined by the BGP maximum-paths number-of-paths router subcommand. +The section “Overview of the BGP Best-Path Algorithm,” earlier in this chapter, lists the best-path steps, including the tiebreaker steps that allow routes to be considered by the maximum-paths command. + +Increasing the Length of the AS_Path Using AS_Path Prepend + +Step 4 of the BGP best-path algorithm examines the length of the AS_Path PA. The length of the AS_Path might appear to be obvious: Just add the number of ASNs listed in the AS_Path. However, some BGP features outside the scope of this book actually impact the AS_Path length calculation as well. However, for the purposes of this book, AS_Path length is simply the number of ASNs listed in the AS_Path. + +The AS_Path prepend tool gives engineers a means to increase the length of an AS_Path by adding ASNs to the AS_Path, while not impacting the loop-prevention role of the AS_Path PA. By increasing the length of an AS_Path, a route is less likely to become the best route. By adding ASNs that already exist inside a particular route’s AS_Path, the fea-ture does not inadvertently prevent a route from being ignored because of AS_Path loop prevention. + +For example, using the design shown most recently in Figures 14-13, 14-14, and 14-15, imagine that the enterprise considers ISP1 to be the better ISP, but it does not want to send all traffic through ISP1. So, the enterprise network engineers could make the follow-ing type of implementation choice: + +Make the AS_Paths received from ISP3 be two ASNs longer. +By making such a choice, when an AS_Path through ISP1 is better, or when it’s a tie on AS_Path length between ISP1 and ISP3, or when the AS_Path through ISP1 is even slight-ly longer than through ISP3, the routers can still choose their routes through ISP1. Only when the AS_Path (before prepending) is at least two ASNs shorter through ISP3 can the ISP3 path be chosen. + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 655 + + +Note For those of you memorizing using the N WLLA OMNI mnemonic, AS_Path Length is the A in WLLA. + + +Figure 14-18 shows the mechanics of how an enterprise router would prepend the AS_Path for routes received by Router E2 from ISP3, namely, Router I3-1. Looking specifically at the route for 185.0.0.0/8, in this case, I3-1 has not changed the AS_Path and advertised the route with AS_Path (3, 1855). At Step 2, Router E2 prepends ASN +3—twice—making the AS_Path length 4. At Step 3, E2 advertises the route to its iBGP peers—peers that might now prefer the other route for this prefix through Router E1. + + + +Key Topic + + +E1 + + +185/8 AS_Path = 3 (3,3,3,1855) + + + +Prefix AS_Path 2 185/8 3 3 3 1855 + +Inbound: Prepend ASN 3 Twice + + +1 185/8 +AS_Path = (3,1855) I3-1 + + + +BGP Table + + +Router E2 + +Figure 14-18 + + +Inbound Route Map + + +Prepending Two ASNs to an AS_Path + + +The configuration itself requires only a little additional work compared to the other examples. As shown in Figure 14-18, Router E2 could use an inbound route map, using the set as-path prepend 3 3 command to add the two ASN instances. (The router send-ing the Update, ISP3’s Router I3-1 in this case, could instead use an outbound route map.) Example 14-22 shows the configuration on E2 to add the ASNs at ingress into E2. (Note that all configuration for changing the Weight and Local_Pref, and the extra OSPF route for 185.0.0.0/8 shown in Example 14-20, has been removed before gathering the output in this example.) + +Example 14-22 Prepending Additional ASNs to the AS_Path + +! First, E2's new configuration +route-map add-two-asns permit 10 +set as-path prepend 3 3 +router bgp 11 +neighbor 192.168.1.6 route-map add-two-asns in +! +! Next, note the AS_Path values all start with 3, 3, 3 +E2# show ip bgp 176.0.0.0/4 longer-prefixes +BGP table version is 41, local router ID is 10.100.1.2 + + + + +From the Library of Alexey Evseenko +656 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + +*>i181.0.0.0/8 +* +*>i182.0.0.0/8 +* +*>i183.0.0.0/8 +* +* i184.0.0.0/8 +*> +*> 185.0.0.0/8 + +10.100.1.1 +192.168.1.6 +10.100.1.1 +192.168.1.6 +10.100.1.1 +192.168.1.6 +10.100.1.1 +192.168.1.6 +192.168.1.6 + +0 100 0 1 1811 i +0 0 3 3 3 2 50 51 52 1811 i +0 100 0 1 2 1822 i +0 0 3 3 3 2 50 51 1822 i +0 100 0 1 2 50 1833 i +0 0 3 3 3 2 50 1833 i +0 100 0 1 2 50 51 1844 i +0 0 3 3 3 2 1844 i +0 0 3 3 3 1855 i + + + +Note When using AS_Path prepending, do not prepend just any ASN. BGP still uses the AS_Path for loop avoidance. So, using an ASN already in the AS_Path, like the ASN of the most recently added ASN (for example, ASN 3 in this case), or the local ASN (for example, ASN 11 in this case), makes the most sense. +Although presented here as a tool for influencing outbound routes, AS_Path prepending can also be used to influence the inbound routes. + + + +Influencing an Enterprise’s Inbound Routes with MED + +An enterprise has reasonably good control over its outbound IP routes. The engineers can configure BGP to set and react to Weight, Local_Pref, and AS_Path length, manipulat- +ing each to choose a different outgoing link or different router through which to forward packets to the Internet. + +An enterprise has much less control over inbound routes: routes for packets coming back toward the enterprise. First, these inbound routes exist on routers that the enterprise does not own. Even if an ISP or set of ISPs can be convinced by engineers at the enterprise to make their routes toward an enterprise take a particular path, technical issues can prevent the design from being implemented. In particular, if the enterprise’s public IP address range is summarized, the companies that use addresses in that range might have compet-ing goals. As a result, no policy can be applied to influence the best route. + +However, several tools exist that allow some control over the last ASN hop between an ISP and its enterprise customer. This book examines one such tool, called Multi-Exit Discriminator (MED), which originally worked for a dual-homed design—that is, with a single ISP but with multiple links to that ISP. MED was later expanded to support dual-multihomed designs (2+ ASNs, 2+ links), relying on the concept that ISPs would work together. This section examines the dual-homed case, with a single ISP. + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 657 +I1-1 is best + +MED Concepts + +The name Multi-Exit Discriminator actually describes its function to a great degree. With a dual-homed design, at least two links exist between an enterprise and its ISP. The enterprise can announce to the ISP a value (MED) that tells the ISP which path into the enterprise is best. As a result, the ISP can discriminate between the multiple exit points from that ISP to the enterprise. + +Because MED lets the enterprise ASN tell just the neighboring ASN which link into the enterprise to use, engineers typically use MED when advertising an enterprise’s public IP address space. Those inbound routes into the enterprise from the ISP typically consist of either one, or a few, public IP address ranges. + +For example, consider a new network design as shown in Figure 14-19. In this case, the enterprise uses the same 128.107.0.0/19 public address range used in Chapter 13 and in this chapter. The enterprise connects only to ASN 1 with a total of four physical links and three BGP neighbors. + + + +Enterprise + + + +E1 + + + +1 Update: MED = 10 + +eBGP + +ASN 1 ISP1 + + +3 + +I1-1 + + + + + +Public: 128.107.0.0/19 + +1 +eBGP 2 iBGP Internet + + + +3 +Update: MED = 20 + +eBGP +I1-1 is best +E2 I1-4 1 Update: MED = 30 + + + +Figure 14-19 Example of Using MED + +MED uses smallest-is-best logic. As a result, the figure shows a design in which the enterprise engineer prefers the top BGP neighborship as the best path to use for inbound routes (MED 10), the middle link next (MED 20), and the bottom connection last (MED 30). Following the steps in the figure: +Step 1. E1 and E2 advertise 128.107.0.0/19, setting MED with an outbound route map, to various settings: MED 10 sent by E1 to I1-1, MED 20 sent by E1 to I1-4, and MED 30 sent by E2 to I1-4. +Step 2. I1-1 and I1-4 have an iBGP connection, so they learn each other’s routes and agree as to which route wins based on MED. + + + + + +From the Library of Alexey Evseenko +658 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 3. I1-1 and I1-4 also tell the other routers inside ISP1, causing all inbound traffic to funnel toward Router I1-1. + +Note that Routers I1-1 and I1-4 in this example could have chosen a better route based on all the earlier best-path steps. However, a brief analysis of the steps tells us that unless someone makes an effort to override the effects of MED, these routers’ best-path algo-rithms will use MED. Assuming that the enterprise and ISP agree to rely on MED, the earlier best-path steps should not matter. Here’s why: +Step 1. Weight: Needs to be set locally. Therefore, if relying on MED, the ISP simply chooses to not set the Weight for received Updates from the enterprise. + +Step 2. Local_Pref: Again, this takes overt effort to match and set the Local_Pref. If relying on MED, the ISP simply chooses to not set the Local_Pref. + +Step 3. Locally injected? All these public routes from the enterprise will be learned with eBGP and not locally injected. + +Step 4. AS_Path length: All such routes on the ISP routers should list one ASN—the enterprise’s ASN—so all should tie on this point. + +Step 5. Origin: Whatever the Origin is (i, e, or ?), it should tie. + +Step 6. MED: None of the other steps determined the best route. Therefore, MED now takes effect. + +Table 14-9 summarizes the key points about MED. + + + +Table 14-9 +Key +Topic Feature + +Is it a PA? + +Purpose + +Scope + +Range + + +Key Features of MED + +Description +Yes. + +Allows an AS to tell a neighboring AS the best way to forward packets into the first AS. +Advertised by one AS into another, propagated inside the AS, but not sent to any other autonomous systems. +0 through 4,294,967,295 (232 – 1). + + + +Which is better? + +Default + +Configuration + +Smaller is better. + +0 + +Through neighbor neighbor-ip route-map route-map-name out command, using the set metric command inside the route map. + + + +Note For those of you memorizing using the N WLLA OMNI mnemonic, MED is the M in OMNI. + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 659 + +MED Configuration + +MED configuration usually occurs on the routers in the AS that want to control inbound routes from the neighboring AS. As such, in the example design shown in Figure 14-19, Routers E1 and E2 would configure MED. Example 14-23 shows E1’s configuration. + +Example 14-23 MED Configuration on Router E1 + +route-map set-med-to-I1-1 permit 10 +match ip address prefix-list only-public +set metric 10 +! +route-map set-med-to-I1-4 permit 10 +match ip address prefix-list only-public +set metric 20 +! +ip prefix-list only-public permit 128.107.0.0/19 +! +router bgp 11 +neighbor 1.1.1.1 route-map set-med-I1-1 out +neighbor 192.168.1.2 route-map set-med-I1-4 out + +Both the configuration and the show ip bgp command output refer to MED as metric. Note that the route map in Example 14-23 uses the set metric command, rather than set med (which does not exist). And as shown in I1-1’s output for the show ip bgp command in Example 14-24, the output lists MED under the heading metric. Specifically, note that even the show ip route command lists the MED value in brackets as the metric for the BGP route. + +Example 14-24 BGP Table and IP Routing Table on Router I1-1 + +I1-1# show ip bgp 128.107.0.0/19 +BGP routing table entry for 128.107.0.0/19, version 13 +Paths: (1 available, best #1, table Default-IP-Routing-Table) +Flag: 0x820 +Not advertised to any peer +11, (aggregated by 11 128.107.9.1), (received & used) +11.11.11.11 from 11.11.11.11 (128.107.9.1) +Origin IGP, metric 10 , localpref 100, valid, external, atomic-aggregate, best + +I1-1# sh ip bgp 128.107.0.0/19 longer-prefixes +BGP table version is 13, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path + + + + + +From the Library of Alexey Evseenko +660 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +*> 128.107.0.0/19 11.11.11.11 10 0 11 i + +I1-1# show ip route 128.107.0.0 255.255.224.0 longer-prefixes +! Legend omitted for brevity + +Gateway of last resort is not set + +128.107.0.0/19 is subnetted, 1 subnets +B 128.107.0.0 [20/10] via 11.11.11.11, 00:02:18 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 661 + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 14-10 lists several design goals related to this chapter. If these design goals were listed in a design document, and you had to take that document and develop an imple-mentation plan, what implementation options come to mind? You should write a general description; specific configuration commands are not required. + +Table 14-10 Design Review + + +Design Goal + +The plan shows a typical single-multihomed design with two routers connected to +two ISPs. How will you ensure next-hop reachability? (2) +The plan shows the same design as the last item. The two enterprise Internet-connected routers do not have a direct link between each other. What methods discussed in this chapter can be used to prevent packet loops in the enterprise core? (2) +The plan shows the same design as the previous items but with public range 200.1.1.0/24 being the only public address range used by the enterprise. How can the enterprise avoid becoming a transit AS? +Influence the outbound route from an enterprise toward prefixes in the Internet (3). + +Possible Implementation Choices Covered in This Chapter + + + + + + + + +From the Library of Alexey Evseenko +662 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Design Goal + +Influence the outbound route from an enterprise toward prefixes in the Internet so that multiple Internet-connected enterprise routers make the same choice based on the same information (2). +Influence inbound routes into an enterprise from a neighboring AS (2). + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 14-11 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 14-11 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answers +The plan shows a typical single-multihomed design with two routers (R1 and R2) connected to two ISPs. Will R1 and R2 be BGP neighbors? Why? +The plan shows the same design as the previous item. What configuration setting must be used to ensure that the routers are iBGP rather than eBGP peers? +The plan calls for filtering all prefixes except the 200.1.1.0/24 public address range when advertising any eBGP peers. Which neighbor command options exist for filtering based on the prefix/length? (3) +A plan shows two enterprise routers, R1 and R2, connected to two different ISPs, with iBGP between R1 and R2. The plan shows R1 setting Weight for routes learned from an ISP. Will R2 react to those settings? Why or why not? + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 663 + + +Question Answers +A plan shows two enterprise routers, R1 and R2, connected to two different ISPs, with iBGP between R1 and R2. The plan shows R1 setting Local_Pref for routes learned from an ISP. Will R2 react to those settings? Why or why not? +The plan calls for the use of BGP Weight, but the incomplete plan lists no configuration yet. What configuration alternatives +exist? (2) + +The plan calls for the use of BGP Local Preference, but the incomplete plan lists no configuration yet. What configuration alternatives exist? +A plan shows two enterprise routers, R1 and R2, connected to different ISPs. The plan calls for using MED to influence inbound routes. Which configuration options exist? +A plan shows the use of BGP Weight, Local Preference, AS_Path prepending, and MED to influence the best-path algorithm. Which of these can be set and advertised to eBGP peers? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own implementation plan, list in Table 14-12 all configuration commands related to the configuration of the following features. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 14-12 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Configure an iBGP peer. + +Advertise the local router’s Update source IP address as the next-hop address to iBGP peers. +Configure an iBGP mesh with peers 1.1.1.1, 2.2.2.2, and 3.3.3.3. +Enable BGP synchronization. + + + + + +From the Library of Alexey Evseenko +664 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Feature Configuration Commands/Notes +Configure filtering of routes sent to eBGP peer 9.9.9.9, using a prefix list to allow only 200.1.1.0/24. +Configure filtering of routes sent to eBGP peer 9.9.9.9, using an ACL to allow only 200.1.1.0/24. +Configure a route map that sets Weight. + +Enable a route map to set BGP Weight. + +Enable a router to set BGP Weight for all routes received from a neighbor. +Configure a route map that sets BGP Local Preference. +Enable a route map to set BGP Local Preference. +Configure a route map that prepends ASNs to an AS_Path. +Enable a route map to perform AS_Path prepending. +Configure a route map that sets MED. + +Enable a route map to set MED. + + + +Choosing Commands for a Verification Plan Table + +To practice skills useful when creating your own verification plan, list in Table 14-13 all commands that supply the requested information. You might want to record your answers outside the book and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 14-13 Verification Plan Memory Drill + +Information Needed Commands +Display a single-line neighbor status for all iBGP neighbors. +Determine whether a particular BGP table entry is iBGP-learned. +Determine the next-hop IP address of an iBGP-learned route. + + + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 665 + + +Information Needed Commands +Identify the neighbor from which a BGP route was learned. +Display one-line entries for all BGP table entries with a given prefix/length, plus any subnets inside that range. +Display BGP routes learned from a neighbor, before being processed by an inbound filter. +The same as the previous item, but after applying the inbound filter. +Display BGP routes sent to a neighbor but after applying the outbound filter. +Display whether a neighbor can perform BGP route refresh. +Display the BGP table, including the chosen best path for each prefix. (State how to identify the best paths.) +List one line per BGP route but for the prefixes within a range. +Identify a BGP table entry’s BGP Weight. (Specify where to find the output.) +Identify a BGP table entry’s BGP Local Preference. (Specify where to find the output.) +Identify a BGP table entry’s AS_Path length. (Specify where to find the output.) +Identify a BGP table entry’s MED. (Specify where to find the output.) (4 methods) +Display routes received from a neighbor before being processed by an inbound filter. +The same as the previous item but after applying the outbound filter. +Display BGP routes sent to a neighbor but after applying the outbound filter. +Display BGP best paths that were not added to the IP routing table. + + +Note Some of the entries in this table may not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + + + +From the Library of Alexey Evseenko +666 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 14-14 lists a reference of these key topics and the page numbers on which each is found. + +Key Table 14-14 Key Topics for Chapter 14 +Topic Key Topic Element Description Page Number + + +List + +Figure 14-4 + +Text + +Figure 14-7 + +Table 14-3 + +Figure 14-8 + +Table 14-4 + +Figure 14-10 + +Table 14-5 + +List + +Table 14-6 + +Table 14-7 + +Figure 14-16 + +Figure 14-18 + +Table 14-9 + +Configuration steps for iBGP peer using a loopback 605 as the Update source +Ensuring That Routes Exist for Next-Hop Addresses 613 in Other ASNs +iBGP behavior regarding not forwarding iBGP- 616 learned routes +Need for Enterprise BGP Filtering 622 + +BGP clear Command Options 625 + +show Commands Related to BGP Filtering 627 + +BGP Path Attributes That Affect the BGP Best-Path 632 Algorithm +Finding PA Settings in the Output of the show ip 633 bgp Command +BGP Decision Process Plus Mnemonic: N WLLA 633 OMNI +Four items commonly set for the purpose of 635 influencing the BGP best-path decision +Key Features of Administrative Weight 638 + +Key Features of Local_Pref 645 + +Example Local_Pref Settings for the Upcoming 649 Example +Prepending Two ASNs to an AS_Path 655 + +Key Features of MED 658 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + + + + +From the Library of Alexey Evseenko +Chapter 14: Advanced BGP Concepts 667 + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +BGP synchronization, iBGP Mesh, next-hop self, BGP soft reset, BGP hard reset, BGP Weight, Local Preference, AS_Path Prepending, Multi-Exit Discriminator, best-path algorithm, Routing Table Manager, RIB failure, path attribute + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ IPv6 Internet Connections: This section examines how to configure a single-homed connection to an Internet service provider (ISP) using IPv6 on your Internet-facing router. +■ BGP Support for IPv6: This section discusses how Multiprotocol BGP (MP-BGP) can be used to sup-port the routing of both IPv4 and IPv6 networks. Two configuration approaches are demonstrated, followed by a look at route filtering and influencing outbound path selection. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 15 + + + + + + +IPv6 Internet Connectivity + + +For decades, enterprise networks have connected to the Internet through IPv4 connec-tions. However, with IPv6’s growing popularity, those IPv4 Internet connections are being joined by (and in some cases, replaced by) IPv6 Internet connections. + +This chapter begins its look at IPv6 Internet connectivity by considering a single-homed Internet connection. With a single-homed connection, an enterprise’s Internet-facing rout-er probably does not need to learn IPv6 routes through BGP from its ISP. Instead, that enterprise router could be configured with an IPv6 address and point to the IPv6 address of the ISP’s router, using a default static route. This chapter begins by discussing how that IPv6 address could be assigned to the enterprise’s Internet-facing router. + +When an enterprise has more than one connection to the Internet, the use of default stat-ic routes might not be sufficient. Fortunately, an update to Border Gateway Protocol ver-sion 4 (BGP-4), called Multiprotocol BGP (MP-BGP), allows the advertisement of both IPv4 and IPv6 networks. This chapter demonstrates two approaches to MP-BGP configu-ration. Specifically, you will see how both IPv4 and IPv6 routes can be advertised over a single IPv4 BGP session. Then, you will see how IPv6 routes can use their own IPv6 BGP session, while IPv4 routes use their own IPv4 BGP session. Finally, this chapter looks at how to perform route filtering with MP-BGP and how to influence outbound path selec-tion using the Local Preference attribute. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these seven self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 15-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions covering the material in those headings so that you can assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 15-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +IPv6 Internet Connections + +BGP Support for IPv6 + +Questions +1–3 + +4–7 + + + + + +From the Library of Alexey Evseenko +670 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. Which of the following methods of address assignment can assign a collection of IPv6 networks to a router, which could then assign those IPv6 networks to its vari-ous interfaces? +a. Stateful DHCPv6 + +b. DHCPv6-PD + +c. SLAAC + +d. Stateless SLAAC + +2. Identify the command used to create an IPv6 default static route. + +a. ipv6 route ::0 next_hop_ipv6_address + +b. ipv6 route 0/128 next_hop_ipv6_address + +c. ipv6 route 0/0 next_hop_ipv6_address + +d. ipv6 route ::/0 next_hop_ipv6_address + +3. Select the implicit instructions that reside at the bottom of an IPv6 ACL. (Choose all that apply.) +a. permit icmp any any nd-na + +b. deny ipv6 any any + +c. permit icmp any any na-ns + +d. permit icmp any any nd-ns + +4. You are configuring IPv6 routing over an IPv4 BGP session. Your initial configura-tion on Router R1 is the following: +router bgp 64702 +neighbor 198.51.100.1 remote-as 64701 +! +address-family ipv4 +network 203.0.113.0 +neighbor 198.51.100.1 activate +exit-address-family +! +address-family ipv6 +network 2000:3::/64 +neighbor 198.51.100.1 activate + +Your BGP neighbor has a similar configuration. You notice that IPv4 routes are being successful exchanged, but IPv6 routes are not being exchanged. What is missing from the above configuration? +a. You need an IPv6 ACL to match the routes to be advertised. + +b. You need a route map that specifies a local next-hop IPv6 address to advertise to a neighbor. +c. You need a neighbor statement that references an IPv6 address. + +d. You need an additional BGP AS for IPv6. + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 671 + +5. What information can be obtained by issuing the show bgp ipv6 unicast summary command? (Choose all that apply.) + +a. The local router’s BGP router ID + +b. A list of IPv6 routes known to the BGP table + +c. A list of configured BGP neighbors + +d. The AS of configured BGP neighbors + +6. Identify the valid IPv6 prefix list commands. (Choose two.) + +a. ipv6 prefix-list LIST1 seq 10 permit 2000::/16 ge 64 + +b. ipv6 prefix-list LIST1 seq 10 permit 2000::/16 le 64 + +c. ipv6 prefix-list LIST1 seq 10 permit 2000::/16 eq 64 + +d. ipv6 prefix-list LIST1 seq 10 permit 2000::/16 ne 64 + +7. Given the following output, determine why BGP chose 2000:3::2 as the best next hop to reach the 2000:4::/64 network. + +R1# show bgp ipv6 unicast +BGP table version is 7, local router ID is 198.51.100.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - inter-nal, +r RIB-failure, S Stale, m multipath, b backup-path, f +RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2000:1::/64 +* 2000:2::/64 +*> +* 2000:3::/64 +*> +*> 2000:4::/64 +* + +:: +2000:2::2 +:: +2000:3::2 +:: +2000:3::2 +2000:2::2 + +0 32768 i +0 50 0 64702 i +0 32768 i +0 150 0 64703 i +0 32768 i +0 150 0 64703 i +0 50 0 64702 i + + +a. Lower router ID + +b. Shorter AS path + +c. Higher Local Preference + +d. Lower Weight + + + + + + + +From the Library of Alexey Evseenko +672 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +IPv6 Internet Connections + +Not only is IPv6 rapidly being adopted inside enterprise networks, but it is also increas-ingly being used for connecting enterprises out to the public Internet. Interestingly, connecting to an Internet service provider (ISP) using IPv6 (as opposed to IPv4) comes with some new security concerns, and network engineers need to be aware of these new threats and have strategies to mitigate them. + +Therefore, this section begins with a look at how an ISP might assign an IPv6 address to one of its customer’s Internet-facing routers. Then, a configuration example is presented, showing how to assign an IPv6 address to an Internet-facing router, and how to config-ure that router with a default gateway that points to the IPv6 address of an ISP router. Next, IPv6 access control lists (ACL) are introduced, and their configuration is contrasted with the configuration of IPv4 ACLs. Finally in this section, you are introduced to IPv6-specific security threats and methods for defending against these threats. + +Methods of Assigning an IPv6 Address to a Customer Router + +A router residing at a customer’s location (often referred to as customer premises equip-ment [CPE]) needing to connect with an ISP using IPv6 can obtain an IPv6 address in a variety of ways: + + +■ +Key Topic + + +■ + + + + + +■ + + + + + + + +■ + +Manual configuration: An ISP could provide an IPv6 address to its customer and instruct the customer to manually configure that IPv6 address on its router’s Internet-facing interface. + +Stateless Address Autoconfiguration (SLAAC): With SLAAC, an ISP router could send Router Advertisements (RA), which advertise an IPv6 prefix, on the link con-necting to a customer router. The customer router could then take the advertised pre-fix and fill in the remainder of the IPv6 address by either randomly selecting those bits or by using the EUI-64 process. + +Stateless DHCPv6: If a router needs more IPv6 information than just an IPv6 address, it might benefit from a stateless DHCPv6 configuration. With this approach, a router obtains an IPv6 address using SLAAC. However, the RA has an other- +config-flag set, which tells the router to check with a DHCP server to obtain addi-tional IPv6 information (for example, the address of a Domain Name System [DNS] server). However, because the router’s IPv6 address was obtained through SLAAC, the DHCPv6 server does not keep track of IPv6 address assignment. + +Stateful DHCPv6: While stateless DHCPv6 allowed a router (or other device) to obtain an IPv6 address through SLAAC and set the other-config-flag instructing the router to learn additional IPv6 configuration information from a DHCPv6 server, stateful DHCPv6 sets the managed-config-flag to instruct the router to obtain its +IPv6 address (along with other IPv6 configuration information) from a DHCPv6 + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 673 + +server. Therefore, with stateful DHCPv6, a DHCPv6 server does keep track of IPv6 address assignment. + +■ DHCPv6 Prefix Delegation (DHCPv6-PD): Rather than assigning a single IPv6 address to a router, DHCPv6-PD allows a DHCPv6 server to assign a collection of IPv6 networks to the router (or other DHCPv6 client). A router could then assign those different IPv6 networks to its various interfaces. + + +Manual Configuration of IPv6 Address and Default Route + +Manually configuring a CPE router to point to an IPv6-speaking ISP router is a fairly simple process, involving only two steps: + +Step 1. +Key Topic + +Step 2. + + +Configure the ISP-provided IPv6 address on a CPE router’s Internet-facing interface with the ipv6 address ipv6_address/prefix_length command in interface configuration mode. + +Statically configure a default route pointing to the IPv6 address of the next-hop ISP router, using the ipv6 route ::/0 next_hop_ipv6_address command +in global configuration mode. + + +To illustrate this configuration, consider Figure 15-1. Router R1 needs to point to the ISP router to allow devices at its site to reach the Internet. The ISP has told the network engi-neer responsible for Router R1’s configuration to assign an IPv6 address of 2000:1::2/64 to Router R1’s Internet-facing interface (that is, Fa 0/0). Also, for other devices at Router R1’s site to reach the Internet, Router R1 should be statically configured with a default routing pointing to the ISP router’s IPv6 address of 2000:1::1. Example 15-1 shows +the required configuration on router R1, along with ping command output from R1, CLIENT1, and TFTP_SERVER, verifying that all three of those devices can reach the web server (with an IPv6 address of 2000:A::1/64) located on the Internet. + + +Note The type of connection seen in Figure 15-1 is called a single-homed Internet con-nection, because there is a single connection to the Internet from the customer’s location. + + + + +Internet + + + +Web Server 2000:A::1/64 + + + +2000:1::/64 +ISP Fa0/1 Fa0/0 +1 2 + + +Fa1/0 1 +R1 2000:2::/64 +Fa0/1 +1 2000:3::/64 2 + + + +2 + +CLIENT1 + + + + +TFTP_SERVER + +Figure 15-1 IPv6 Router with a Single-Homed Internet Connection + + + +From the Library of Alexey Evseenko +674 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Key Topic + +Example 15-1 Manual IPv6 Address Assignment and Static Default Route Configuration + +*** CONFIGURATION AND VERIFICATION ON ROUTER R1 *** + +R1# conf term +R1(config)# interface fa 0/0 +R1(config-if)# ipv6 address 2000:1::2/64 +R1(config-if)# exit +R1(config)# ipv6 route ::/0 2000:1::1 +R1(config)# end +R1# ping 2000:a::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2000:A::1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 44/62/88 ms +R1# + +*** VERIFICATION ON CLIENT1 *** + +CLIENT1# ping 2000:a::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2000:A::1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 60/87/96 ms +Client1# + +*** VERIFICATION ON TFTP_SERVER *** + +TFTP_SERVER# ping 2000:a::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2000:A::1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 60/82/120 ms +TFTP_SERVER# + + +Note In Example 15-1, the CLIENT1 and TFTP_SERVER computers are actually routers (configured with an IPv6 address and a default gateway configuration pointing to Router R1). + + + +IPv6 Access Control Lists + +In your CCNA studies, you learned how to configure IPv4 access control lists (ACL). Recall that ACLs are not exclusively used to permit or deny traffic. You could also use + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 675 + +an ACL to match traffic (for example, to identify traffic to be forwarded using Policy-Based Routing or to match inside local addresses to be translated with Network Address Translation). + +Cisco IOS also supports IPv6 ACLs; however, a few differences exist with IPv6 ACLs as compared with IPv4 ACLs: + +■ While IPv4 ACLs could be either standard or extended, and either numbered or named, IPv6 ACLs are always extended and named. + +■ IPv4 ACLs have an implicit deny all instruction as the last instruction in all ACLs, whereas IPv6 ACLs have three implicit instructions residing at the bottom of all ACLs: +permit icmp any any nd-na +permit icmp any any nd-ns +deny ipv6 any any +The permit icmp any any nd-na command permits Neighbor Discovery – Neighbor Advertisements, and the permit icmp any any nd-ns command permits Neighbor Discovery – Neighbor Solicitations. These Neighbor Discovery commands are required for IPv6 to function correctly, because they serve a purpose, similar to Address Resolution Protocol (ARP) in an IPv4 network. Therefore, be aware that these messages will be denied if you enter a deny ipv6 any any command in an IPv6 ACL. + +Example 15-2 illustrates an IPv6 ACL, based on the topology previously seen in Figure 15-1. The goal of the configuration is to allow HTTP and HTTPS connections to the Internet, while blocking other connection types. + +Example 15-2 IPv6 ACL Configuration and Verification +Key +Topic *** TESTING ON CLIENT 1 *** +Client1# telnet 2000:a::1 80 +Trying 2000:A::1, 80 ... Open *** SUCCESSFUL HTTP CONNECTION *** +exit +HTTP/1.1 400 Bad Request +Date: Tue, 10 Jun 2014 14:34:55 GMT +Server: cisco-IOS +Accept-Ranges: none + +400 Bad Request +[Connection to 2000:a::1 closed by foreign host] +Client1# telnet 2000:a::1 +Trying 2000:A::1 ... Open *** SUCCESSFUL TELNET CONNECTION *** + +User Access Verification + +Password: +WEB_SERVER> exit + + + + +From the Library of Alexey Evseenko +676 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +[Connection to 2000:a::1 closed by foreign host] +Client1# + +*** IPv6 ACL CONFIGURATION AND VERIFICATION ON R1 *** +R1# conf term +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# ipv6 access-list ALLOW_WEB +R1(config-ipv6-acl)# permit tcp any any eq www +R1(config-ipv6-acl)# permit tcp any any eq 443 +R1(config-ipv6-acl)# exit +R1(config)# interface fa 0/0 +R1(config-if)# ipv6 traffic-filter ALLOW_WEB out +R1(config-if)# end +R1# show access-lists +IPv6 access list ALLOW_WEB + +permit tcp any any +permit tcp any any + +eq www (23 matches) sequence 10 +eq 443 sequence 20 + + +*** TESTING ON CLIENT 1 *** +Client1# telnet 2000:a::1 80 +Trying 2000:A::1, 80 ... Open *** SUCCESSFUL HTTP CONNECTION *** +exit +HTTP/1.1 400 Bad Request +Date: Tue, 10 Jun 2014 14:37:55 GMT +Server: cisco-IOS +Accept-Ranges: none + +400 Bad Request +[Connection to 2000:a::1 closed by foreign host] +Client1# telnet 2000:a::1 +Trying 2000:A::1 ... +% Destination unreachable; gateway or host down *** UNSUCCESSFUL TELNET +CONNECTION *** + +Example 15-2 begins on Client 1, where the telnet 2000:a::1 80 command is used to tel-net to the Internet-based web server, using port 80 (that is, the HTTP port). The connec-tion was successful as evidenced by the Open response. Similarly, Client 1 successfully established a Telnet session with the Internet-based server (using the default Telnet port of 23), as seen with the Open response. + +Next, an extended-named ACL was created on Router R1 with the ipv6 access-list ALLOW_WEB command. In IPv6 ACL configuration mode, the permit tcp any any eq www and permit tcp any any eq 443 commands instruct the ACL to permit HTTP and HTTPS (that is, port 443) traffic. Then, in interface configuration mode, the ALLOW_ WEB IPv6 ACL was applied to interface Fa 0/0 in the outbound direction with the ipv6 traffic-filter ALLOW_WEB out command. Notice the use of the traffic-filter command option, as opposed to access-group used with IPv4 ACLs. Finally on Router R1, the + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 677 + +show access-lists command was issued, showing the configuration of the ALLOW_WEB IPv6 ACL. + +Finally, to test the operation of the IPv6 ACL, two connection attempts are once again made, one using a permitted protocol (HTTP) and one using a denied protocol (Telnet). This time, with the IPv6 ACL in place, the HTTP session succeeds while the Telnet ses-sion fails. + +IPv6 Internet Connection Security + +Connecting an enterprise network to the Internet through IPv6 introduces some security risks. A couple of examples are as follows: + +■ The Neighbor Discovery process used by IPv6 might be leveraged by a malicious user to launch a man-in-the-middle attack, similar to a gratuitous ARP attack in an IPv4 network. + +■ If an IPv4 network used NAT, the inside local addresses assigned to network devices would not be visible to devices on the Internet, because of NAT’s translation of inside local addresses to inside global addresses. However, because NAT is not typically used in IPv6 networks, IPv6 addresses of network devices are no longer concealed. + +To mitigate such threats, Cisco recommends protecting an enterprise network with a stateful firewall. Additionally, IPv6 protocols should be hardened by disabling any unnec-essary functions or services and tweaking any suboptimal default settings. + +BGP Support for IPv6 + +The predominant routing protocol found on the Internet is Border Gateway Protocol (BGP), as discussed in Chapter 13, “Fundamental BGP Concepts,” and Chapter 14, “Advanced BGP Concepts.” A challenge with traditional BGP version 4 (BGP-4) is that it only supported the routing of IPv4 networks. Fortunately, an update to BGP, called Multiprotocol BGP (MP-BGP), allows BGP to support multiple address types. This update consists of a set of multiprotocol extensions added to BGP-4. + +This section begins by introducing MP-BGP and discussing its new components. Then, you will see how IPv6 networks can be routed across an IPv4 BGP session, in addition to an IPv6 session. Next, from a design perspective, this section contrasts the benefits and drawbacks of routing IPv4 and IPv6 networks over a single IPv4 BGP session versus using separate BGP sessions for IPv4 and IPv6 networks. Finally, this section discusses the filtering of IPv6 networks and describes how to perform IPv6 path selection using the Local Preference attribute. + + + + + + + + + +From the Library of Alexey Evseenko +678 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Multiprotocol BGP Fundamentals + +MP-BGP allows you to consolidate a variety of protocol types under a single BGP con-figuration. These protocol types are called address families and include (as just a few examples): + +■ Unicast IPv4 + +■ Multicast IPv4 + +■ Unicast IPv6 + +■ Multicast IPv6 + + +Note MP-BGP supports several additional address families, largely used to support vir-tualization technologies, such as Virtual Private LAN Service (VPLS) and Layer 2 VPN (L2VPN). However, the ROUTE curriculum focuses on IPv4 and IPv6 address families. + + +MP-BGP contains several new elements and features not found in BGP-4, including + +■ Address Family Identifier (AFI): Specifies the type of address being used by an Address Family. + +■ Subsequent Address Family Identifier (SAFI): Provides additional address family information for some address families. + +■ Multiprotocol Reachable Network Layer Reachability Information (MP_REACH_ NLRI): An attribute that transports a collection of reachable networks, along with next-hop information. + +■ Multiprotocol Unreachable Network Layer Reachability Information (MP_ UNREACH_NLRI): An attribute that transports a collection of unreachable net-works (used to indicate that specific previously reachable networks are no longer reachable). + +■ BGP Capabilities Advertisement: Used by a router to tell a neighboring router its BGP capabilities—used during BGP session negotiation. + +Note that the multiprotocol extensions making up MP-BGP are backward compatible with traditional BGP-4. As a result, a traditional BGP-4 router can form a neighborship with an MP-BGP router, and simply ignore any received BGP messages containing unrec-ognized extensions. + +IPv6 Routing over an IPv4 BGP Session + +MP-BGP routers can exchange updates for a variety of address families over an IPv4 BGP session. The steps to configure IPv6 routing over an IPv4 BGP session are as follows: + + + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 679 + + +Step 1. Key +Topic +Step 2. + + +Step 3. + + + +Step 4. + + +Step 5. + + +Step 6. + + +Step 7. + + + + + +Step 8. + + +Step 9. + + +Enable IPv6 routing with the ipv6 unicast-routing command, in global con-figuration mode. + +Create a route map by issuing the route-map route_map_name command, in global configuration mode. + +Specify the IPv6 address of the router’s interface connecting to a neighbor as a next-hop IPv6 address, using the set ipv6 next-hop ipv6_address, in route map configuration mode. + +Define the BGP autonomous system with the router bgp as-number com-mand, in global configuration mode. + +Define an IPv4 BGP neighbor with the neighbor neighbor’s_ipv4_address remote-as command, in router configuration mode. + +Enter address family configuration mode for the IPv4 address family with the address-family ipv4 command, in router configuration mode. + +Specify which interfaces will participate in the IPv4 address family by issuing one or more network ip4_network_address [mask subnet_mask] commands, in IPv4 address family configuration mode. (Note: The neighbor neighbor’s_ ipv4_address activate command is automatically entered for you in IPv4 address family configuration mode.) + +Exit IPv4 address family configuration mode with the exit-address-family command, in IPv4 address family configuration mode. + +Enter address family configuration mode for the IPv6 address family with the +address-family ipv6 command, in router configuration mode. + + +Step 10. Specify which interfaces will participate in the IPv6 address family by issuing one or more network ipv6_network_address/prefix-length commands, in IPv6 address family configuration mode. +Step 11. Activate the BGP neighbor for the IPv6 address family with the neighbor neighbor’s_ipv4_address activate command, in IPv6 address family configu-ration mode. +Step 12. Associate the previously configured route map (which specifies the next-hop IPv6 address to advertise to a neighbor) with the neighbor using the neighbor neighbor_ipv4_address route-map route_map_name out command, in IPv6 address family configuration mode. + +As an example, consider Figure 15-2. + + + + + + + + + + + +From the Library of Alexey Evseenko +680 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + + + +BGP AS 64701 + + +R1 +Fa0/0 192.0.2.1/24 2000:1::1/64 + + +Fa0/1 198.51.100.1/30 2000:2::1/64 +Fa0/0 198.51.100.2/30 2000:2::2/64 + + +BGP AS 64702 + + +R2 +Fa0/1 203.0.113.1/24 2000:3::1/64 + + + + + + +Figure 15-2 BGP Routing for IPv4 and IPv6 Networks + +In Figure 15-2, two BGP autonomous systems are configured with both IPv4 and IPv6 networks. The BGP session between Routers R1 and R2 is an IPv4 BGP session. However, both IPv4 and IPv6 route updates are exchanged over the IPv4 BGP session. Example +15-3 shows the configuration on Router R1. + +Example 15-3 IPv6 over IPv4 BGP Session—R1 Configuration + +ipv6 unicast-routing +! *** OUTPUT OMITTED *** +router bgp 64701 +neighbor 198.51.100.2 remote-as 64702 +! +address-family ipv4 +network 192.0.2.0 +neighbor 198.51.100.2 activate +exit-address-family +! +address-family ipv6 +network 2000:1::/64 +neighbor 198.51.100.2 activate +neighbor 198.51.100.2 route-map IPV6-NEXT-HOP out +exit-address-family +! *** OUTPUT OMITTED *** +route-map IPV6-NEXT-HOP permit 10 +set ipv6 next-hop 2000:2::1 + +In Example 15-3, Router R1 belongs to AS 64701 and is forming a neighborship with Router R2, which has an IPv4 address of 198.51.100.2 and resides in AS 64702. Then, in IPv4 address family configuration mode, the network 192.0.2.0 command was issued +to make Router R1’s Fa 0/0 interface participate in the IPv4 address family. The neighbor + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 681 + +198.51.100.2 activate command is automatically entered in IPv4 address family configu-ration mode, to activate the previously configured neighbor for the IPv4 address family. + +In IPv6 address family configuration mode, the network 2000:1::/64 command is issued to make Router R1’s Fa 0/0 interface participate in the IPv6 address family. Also, unlike the IPv4 address family, the BGP neighbor (198.51.100.2) configuration has to be manu-ally activated to associate the preconfigured neighbor with the IPv6 address family. This is done with the neighbor 198.51.100.2 activate command. Finally, in IPv6 address fam-ily configuration mode, the neighbor 198.51.100.2 route-map IPV6-NEXT-HOP out command is issued. This command causes BGP route advertisements sent to Router R2 to specify Router R1’s Fa 0/1 IPv6 address as an IPv6 next-hop address, as specified in the IPV6-NEXT-HOP route map. + +The previously mentioned route map is created with the route-map IPV6-NEXT-HOP permit 10 command. Then, in route map configuration mode, the set ipv6 next-hop 2000:2::1 command was entered to specify the IPv6 address of Router R1’s Fa 0/1 inter-face as the next-hop IPv6 address that Router R2 should use when attempting to reach IPv6 networks advertised by Router R1. Without this route map instruction, Router R2 will receive IPv6 route advertisements, but those advertisements will not have a reachable next-hop address and therefore will not be injected into Router R2’s IPv6 routing table. + +Example 15-4 shows the complementary configuration on Router R2. + +Example 15-4 IPv6 over IPv4 BGP Session—R2 Configuration + +ipv6 unicast-routing +! *** OUTPUT OMITTED *** +router bgp 64702 +neighbor 198.51.100.1 remote-as 64701 +! +address-family ipv4 +network 203.0.113.0 +neighbor 198.51.100.1 activate +exit-address-family +! +address-family ipv6 +network 2000:3::/64 +neighbor 198.51.100.1 activate +neighbor 198.51.100.1 route-map IPV6-NEXT-HOP out +exit-address-family +! *** OUTPUT OMITTED *** +route-map IPV6-NEXT-HOP permit 10 +set ipv6 next-hop 2000:2::2 + +The show ipv6 route command issued on both Routers R1 and R2, as seen in Example 15-5, confirms that Routers R1 and R2 are exchanging IPv6 routing information. + + + + + + +From the Library of Alexey Evseenko +682 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 15-5 show ipv6 route Output on Routers R1 and R2 + +*** ROUTER R1 *** +R1# show ipv6 route +IPv6 Routing Table - default - 6 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +C 2000:1::/64 [0/0] +via FastEthernet0/0, directly connected +L 2000:1::1/128 [0/0] +via FastEthernet0/0, receive +C 2000:2::/64 [0/0] +via FastEthernet0/1, directly connected +L 2000:2::1/128 [0/0] +via FastEthernet0/1, receive +B 2000:3::/64 [20/0] +via FE80::C801:13FF:FE74:8, FastEthernet0/1 +L FF00::/8 [0/0] +via Null0, receive + +*** ROUTER R2 *** +R2# show ipv6 route +IPv6 Routing Table - default - 6 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +B 2000:1::/64 [20/0] +via FE80::C800:13FF:FE74:6, FastEthernet0/0 +C 2000:2::/64 [0/0] +via FastEthernet0/0, directly connected +L 2000:2::2/128 [0/0] +via FastEthernet0/0, receive +C 2000:3::/64 [0/0] +via FastEthernet0/1, directly connected +L 2000:3::1/128 [0/0] +via FastEthernet0/1, receive +L FF00::/8 [0/0] +via Null0, receive + + + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 683 + +The show bgp ipv6 unicast command, as seen in Example 15-6, displays IPv6 networks known to BGP, along with next-hop information to reach those networks. Note that a next-hop address of :: indicates that the network is local to the router. + +Example 15-6 show bgp ipv6 unicast Output on Routers R1 and R2 + +*** ROUTER R1 *** +R1# show bgp ipv6 unicast +BGP table version is 3, local router ID is 198.51.100.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2000:1::/64 +*> 2000:3::/64 + +:: +2000:2::2 + +0 32768 i +0 0 64702 i + + +*** ROUTER R2 *** +R2# show bgp ipv6 unicast +BGP table version is 3, local router ID is 203.0.113.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2000:1::/64 +*> 2000:3::/64 + +2000:2::1 +:: + +0 0 64701 i +0 32768 i + + +The show bgp ipv6 unicast summary command, as demonstrated in Example 15-7, pro-vides a collection of valuable output, including a router’s BGP router ID, the local autono-mous system (AS) number, and a listing of neighbors and their AS numbers. + +Example 15-7 show bgp ipv6 unicast summary Output on Routers R1 and R2 + +*** ROUTER R1 *** +R1# show bgp ipv6 unicast summary +BGP router identifier 198.51.100.1, local AS number 64701 +BGP table version is 3, main routing table version 3 +2 network entries using 336 bytes of memory +2 path entries using 208 bytes of memory +2/2 BGP path/bestpath attribute entries using 272 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory + + + + + +From the Library of Alexey Evseenko +684 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 840 total bytes of memory +BGP activity 4/0 prefixes, 4/0 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +198.51.100.2 4 64702 8 8 3 0 0 00:02:10 1 + +*** ROUTER R2 *** +R2# show bgp ipv6 unicast summary +BGP router identifier 203.0.113.1, local AS number 64702 +BGP table version is 3, main routing table version 3 +2 network entries using 336 bytes of memory +2 path entries using 208 bytes of memory +2/2 BGP path/bestpath attribute entries using 272 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 840 total bytes of memory +BGP activity 4/0 prefixes, 4/0 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +198.51.100.1 4 64701 11 10 3 0 0 00:04:28 1 + + +IPv6 Routing over an IPv6 BGP Session + +While you could configure an IPv4 BGP session and advertise IPv6 networks over that session (as seen in the previous discussion), an alternative is to create an IPv6 BGP ses-sion between two routers and then advertise IPv6 networks over that session. If you also needed to advertise IPv4 networks, you could do so by creating an additional BGP rout-ing process, using an IPv4 BGP session, just for the handling of IPv4 networks. + +The steps to configure IPv6 routing over an IPv6 BGP session are as follows: + + +Step 1. +Key Topic +Step 2. + + +Step 3. + + +Step 4. + + +Enable IPv6 routing with the ipv6 unicast-routing command, in global con-figuration mode. + +Define the BGP autonomous system with the router bgp as-number com-mand, in global configuration mode. + +Define an IPv6 BGP neighbor with the neighbor neighbor’s_ipv6_address remote-as command, in router configuration mode. + +Enter address family configuration mode for the IPv6 address family with the +address-family ipv6 command, in router configuration mode. + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 685 + +Step 5. Specify which interfaces will participate in the IPv6 address family by issuing one or more network ipv6_network_address/prefix-length commands, in IPv6 address family configuration mode. +Step 6. Activate the BGP neighbor for the IPv6 address family with the neighbor neighbor’s_ipv4_address activate command, in IPv6 address family configu-ration mode. + + +Note Unlike the configuration for IPv6 routing over an IPv4 BGP session, the configura-tion for IPv6 routing over an IPv6 session does not require the configuration of a route map to specify a next-hop IPv6 address. This step is not required, because the neighbors are configured with one another’s IPv6 addresses. Therefore, they know the appropriate next-hop IPv6 address to associate with IPv6 route updates received from a neighbor. + + +To illustrate this configuration, consider Example 15-8, which is using the topology previ-ously seen in Figure 15-2. + +Example 15-8 IPv6 over IPv6 BGP Session—R1 Configuration + +ipv6 unicast-routing +! *** OUTPUT OMITTED *** +router bgp 64701 +neighbor 2000:2::2 remote-as 64702 +! +address-family ipv4 +no neighbor 2000:2::2 activate +exit-address-family +! +address-family ipv6 +network 2000:1::/64 +neighbor 2000:2::2 activate +exit-address-family + +In Example 15-8, note that the neighbor 2000:2::2 remote-as 64702 command points to the IPv6 address of Router R2, as opposed to the IPv4 address of Router R2, as seen in Example 15-3. Also, be aware that you do not have to go into IPv4 address family con-figuration mode and issue the no neighbor neighbor’s_ipv6_address activate command, because that is done automatically. Another difference that you will notice from the configuration in Example 15-3 is the absence of a route map, which is no longer needed, because the neighbor commands on both routers point to one another’s IPv6 addresses, instead of one another’s IPv4 addresses. + +Example 15-9 shows the complementary configuration on Router R2. + + + + + + + +From the Library of Alexey Evseenko +686 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 15-9 IPv6 over IPv6 BGP Session—R2 Configuration + +ipv6 unicast-routing +! *** OUTPUT OMITTED *** +router bgp 64702 +bgp log-neighbor-changes +neighbor 2000:2::1 remote-as 64701 +! +address-family ipv4 +no neighbor 2000:2::1 activate +exit-address-family +! +address-family ipv6 +network 2000:3::/64 +neighbor 2000:2::1 activate +exit-address-family + +The show ipv6 route command issued on both Routers R1 and R2, as seen in Example 15-10, confirms that Routers R1 and R2 are exchanging IPv6 routing information. + +Example 15-10 show ipv6 route Output on Routers R1 and R2 + +*** ROUTER R1 *** +R1# show ipv6 route +IPv6 Routing Table - default - 6 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +C 2000:1::/64 [0/0] +via FastEthernet0/0, directly connected +L 2000:1::1/128 [0/0] +via FastEthernet0/0, receive +C 2000:2::/64 [0/0] +via FastEthernet0/1, directly connected +L 2000:2::1/128 [0/0] +via FastEthernet0/1, receive +B 2000:3::/64 [20/0] +via FE80::C804:12FF:FEA8:8, FastEthernet0/1 +L FF00::/8 [0/0] +via Null0, receive + +*** ROUTER R2 *** +R2# show ipv6 route +IPv6 Routing Table - default - 6 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 687 + +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +B 2000:1::/64 [20/0] +via FE80::C803:12FF:FEA8:6, FastEthernet0/0 +C 2000:2::/64 [0/0] +via FastEthernet0/0, directly connected +L 2000:2::2/128 [0/0] +via FastEthernet0/0, receive +C 2000:3::/64 [0/0] +via FastEthernet0/1, directly connected +L 2000:3::1/128 [0/0] +via FastEthernet0/1, receive +L FF00::/8 [0/0] +via Null0, receive + +The show bgp ipv6 unicast command output, seen in Example 15-11, is similar to what was seen in Example 15-6. + +Example 15-11 show bgp ipv6 unicast Output on Routers R1 and R2 + +*** ROUTER R1 *** +R1# show bgp ipv6 unicast +BGP table version is 3, local router ID is 198.51.100.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2000:1::/64 +*> 2000:3::/64 + +:: +2000:2::2 + +0 32768 i +0 0 64702 i + + +*** ROUTER R2 *** +R2# show bgp ipv6 unicast +BGP table version is 3, local router ID is 203.0.113.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2000:1::/64 +*> 2000:3::/64 + +2000:2::1 +:: + +0 0 64701 i +0 32768 i + + + + +From the Library of Alexey Evseenko +688 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Also, as previously seen in Example 15-7, the show bgp ipv6 unicast summary com-mand, as shown in Example 15-12, provides information such as a router’s BGP router ID, the local AS number, and a listing of neighbors and their AS numbers. + +Example 15-12 show bgp ipv6 unicast summary Output on Routers R1 and R2 + +*** ROUTER R1 *** +R1# show bgp ipv6 unicast summary +BGP router identifier 198.51.100.1, local AS number 64701 +BGP table version is 3, main routing table version 3 +2 network entries using 336 bytes of memory +2 path entries using 208 bytes of memory +2/2 BGP path/bestpath attribute entries using 272 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 840 total bytes of memory +BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2000:2::2 4 64702 8 9 3 0 0 00:03:52 1 + +*** ROUTER R2 *** +R2# show bgp ipv6 unicast summary +BGP router identifier 203.0.113.1, local AS number 64702 +BGP table version is 3, main routing table version 3 +2 network entries using 336 bytes of memory +2 path entries using 208 bytes of memory +2/2 BGP path/bestpath attribute entries using 272 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 840 total bytes of memory +BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2000:2::1 4 64701 11 10 3 0 0 00:05:42 1 + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 689 + +Single IPv4 BGP Session Versus Dual (IPv4 and IPv6) Sessions + +At this point in this chapter, you have seen two approaches to support both the routing of IPv4 and IPv6 networks in a BGP environment. One option was to have a single IPv4 BGP session, and use that single session to carry IPv4 and IPv6 route information. The second option was to have an IPv4 BGP session, carrying just IPv4 network advertise-ments, and an IPv6 BGP session, carrying just IPv6 network advertisements. + +While you can choose either approach to support IPv4 and IPv6 routing, from a design perspective, you should understand the benefits (and any drawbacks) of each approach. The following lists highlight the characteristics of each approach: + +■ Single IPv4 BGP session: +Key +Topic ■ Fewer neighborships are formed. + +■ When sending IPv6 route information over the IPv4 BGP session, you need to create a route map to modify the Next-Hop BGP attribute. + +■ Dual (IPv4/IPv6) BGP sessions: + +■ More neighborships must be configured. +■ You do not need to configure a route map to modify the Next-Hop BGP attribute. + +Filtering IPv6 Routes with Prefix Lists + +The Cisco IOS implementation of MP-BGP allows you to filter IPv6 routes in much the same way that you filtered IPv4 routes. Specifically, you can filter IPv6 routes using pre-fix lists, filter lists, and route maps. However, you should understand the order of opera-tions of these various filtering mechanisms. The following lists show the order in which these mechanisms are applied to IPv6 routes, for both incoming and outgoing route advertisements. + +■ Order of operations for ingress IPv6 BGP route filtering: + +■ Inbound route map ■ Inbound filter list +■ Inbound prefix list + +■ Order of operations for egress IPv6 BGP route filtering: + +■ Outbound prefix list ■ Outbound filter list +■ Outbound route map + +As an example, consider the IPv6 prefix list filtering example presented in Examples 15-13, 15-14, 15-15, and 15-16. The topology is illustrated in Figure 15-3. + + + + + + +From the Library of Alexey Evseenko +690 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + + + +BGP AS 64701 + + +R1 +Fa0/0 192.0.2.1/24 2000:1::1/64 + + +Fa0/1 198.51.100.1/30 2000:2::1/64 +Fa0/0 198.51.100.2/30 2000:2::2/64 + + +BGP AS +64702 Lo0:2000:A::1/96 Lo1:2000:B::1/96 Lo2:2000:C::1/64 +R2 Lo3:2000:D::1/64 +Fa0/1 203.0.113.1/24 2000:3::1/64 + + + + + + +Figure 15-3 Prefix List Filtering Sample Topology + +Example 15-13 Starting Configuration on Router R2 + +R2# show run +... OUTPUT OMITTED ... +router bgp 64702 +bgp log-neighbor-changes +neighbor 198.51.100.1 remote-as 64701 +! +address-family ipv4 +network 203.0.113.0 +neighbor 198.51.100.1 activate +exit-address-family +! +address-family ipv6 +network 2000:3::/64 +network 2000:A::/96 +network 2000:B::/96 +network 2000:C::/64 +network 2000:D::/64 +neighbor 198.51.100.1 activate +neighbor 198.51.100.1 route-map IPV6-NEXT-HOP out +exit-address-family +... OUTPUT OMITTED ... +route-map IPV6-NEXT-HOP permit 10 +set ipv6 next-hop 2000:2::2 + +Example 15-13 shows the starting configuration on Router R2. Notice that Router R2 is configured to route both IPv4 and IPv6 networks over a single IPv4 BGP session. + + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 691 + +Example 15-14 Starting IPv6 Routing Table on Router R1 + +R1# show ipv6 route +IPv6 Routing Table - default - 10 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +C 2000:1::/64 [0/0] +via FastEthernet0/0, directly connected +L 2000:1::1/128 [0/0] +via FastEthernet0/0, receive +C 2000:2::/64 [0/0] +via FastEthernet0/1, directly connected +L 2000:2::1/128 [0/0] +via FastEthernet0/1, receive +B 2000:3::/64 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +B 2000:A::/96 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +B 2000:B::/96 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +B 2000:C::/64 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +B 2000:D::/64 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +L FF00::/8 [0/0] +via Null0, receive + +Example 15-15 shows that Router R1 has learned five IPv6 routes through BGP from Router R2. Notice that two of the IPv6 networks have a prefix length of 96 bits, while three of the IPv6 networks have a prefix length of 64 bits. + +Example 15-15 Prefix List Configuration on Router R2 +Key +Topic R2# conf term +R2(config)# ipv6 prefix-list SMALL_NETS seq 10 permit 2000::/16 ? +ge Minimum prefix length to be matched +le Maximum prefix length to be matched + +R2(config)# ipv6 prefix-list SMALL_NETS seq 10 permit 2000::/16 le 64 +R2(config)# router bgp 64702 +R2(config-router)# address-family ipv6 +R2(config-router-af)# neighbor 198.51.100.1 prefix-list SMALL_NETS out +R2(config-router-af)# end +R2# clear ip bgp * soft + + + + +From the Library of Alexey Evseenko +692 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +In Example 15-15, an IPv6 prefix list (named SMALL_NETS) is configured to match IPv6 routes beginning with 2000 (as the first 16 bits in hexadecimal notation) and a prefix length less than or equal to 64 bits. This prefix list is then applied in the outbound direc-tion to a neighbor with an IP address of 198.51.100.1 (which is Router R1). Therefore, the 2000:A::/96 and 2000:B::/96 networks known to Router R2 should not be advertised to Router R1, because their prefix length of 96 bits is not less than or equal to the 64-bit length specified by the prefix list. + + +Note The clear ip bgp * soft command was used to trigger route changes to immediately be sent to Router R1, without tearing down the existing IPv4 BGP session. + + +Example 15-16 Final IPv6 Routing Table on Router R1 + +R1# show ipv6 route +IPv6 Routing Table - default - 8 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +C 2000:1::/64 [0/0] +via FastEthernet0/0, directly connected +L 2000:1::1/128 [0/0] +via FastEthernet0/0, receive +C 2000:2::/64 [0/0] +via FastEthernet0/1, directly connected +L 2000:2::1/128 [0/0] +via FastEthernet0/1, receive +B 2000:3::/64 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +B 2000:C::/64 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +B 2000:D::/64 [20/0] +via FE80::C801:10FF:FED0:8, FastEthernet0/1 +L FF00::/8 [0/0] +via Null0, receive + +In Example 15-16, notice that networks 2000:A::/96 and 2000:B::/96 no longer appear in Router R1’s IPv6 routing table. This output confirms that Router R2 filtered those routes, using a prefix list. + + + + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 693 + +Using Local Preference for IPv6 Path Selection + +Frequent real-world BGP implementations require you to influence outbound path selec-tion on your router. In Chapter 14, you saw how the Local Preference BGP attribute could be used to influence outbound IPv4 path selection decisions. Similarly, you can use the Local Preference attribute to influence outbound IPv6 path selection decisions. + +Example 15-17, as illustrated in Figure 15-4, shows a sample Local Preference configuration. + + + + + + +Fa0/1 +BGP AS 198.51.100.1/30 +64701 2000:2::1/64 + + +R1 + +Fa0/0 198.51.100.2/30 2000:2::2/64 + + +BGP AS R2 64702 +Fa0/1 203.0.113.1/24 2000:4::1/64 + + + +Fa0/0 192.0.2.1/24 2000:1::1/64 + +Fa1/0 198.51.100.5/30 2000:3::1/64 + + +Fa0/0 +198.51.100.6/30 Fa0/1 2000:3::2/64 203.0.113.2/24 +2000:4::2/64 + + +BGP AS R3 64703 + + + + +Figure 15-4 Influencing Path Selection with Local Preference + +Example 15-17 Local Preference Configuration +Key +Topic R1# show bgp ipv6 unicast +BGP table version is 5, local router ID is 198.51.100.5 +Status codes: s suppressed, d damped, h history, * valid, > best , i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2000:1::/64 +* 2000:2::/64 +*> +* 2000:3::/64 +*> +* 2000:4::/64 + +:: +2000:2::2 +:: +2000:3::2 +:: +2000:3::2 + +0 32768 i +0 0 64702 i +0 32768 i +0 0 64703 i +0 32768 i +0 0 64703 i + + + + + +From the Library of Alexey Evseenko +694 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +*> 2000:2::2 0 0 64702 i +R1# conf term +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# route-map LP-R2 +R1(config-route-map)# set local-preference 50 +R1(config-route-map)# exit +R1(config)# route-map LP-R3 +R1(config-route-map)# set local-preference 150 +R1(config-route-map)# exit +R1(config)# router bgp 64701 +R1(config-router)# address-family ipv6 +R1(config-router-af)# neighbor 198.51.100.2 route-map LP-R2 in +R1(config-router-af)# neighbor 198.51.100.6 route-map LP-R3 in +R1(config-router-af)# end +R1# clear ip bgp * soft +R1# show bgp ipv6 unicast +BGP table version is 7, local router ID is 198.51.100.5 +Status codes: s suppressed, d damped, h history, * valid, > best , i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2000:1::/64 +* 2000:2::/64 +*> +* 2000:3::/64 +*> +*> 2000:4::/64 +* +R1# + +:: +2000:2::2 +:: +2000:3::2 +:: +2000:3::2 +2000:2::2 + +0 32768 i +0 50 0 64702 i +0 32768 i +0 150 0 64703 i +0 32768 i +0 150 0 64703 i +0 50 0 64702 i + + +The show bgp ipv6 unicast command output at the beginning of Example 15-17 shows that BGP initially prefers Router R2 as the next hop to reach the 2000:4::/64 network. The reason for this path selection is that Router R2 has the lowest router ID. The purpose of the example is to show how that outbound path selection decision can be altered through a Local Preference configuration. + +Two route maps are then configured for Router R1. One route map sets the Local Preference attribute to a value of 50 and is associated with incoming routes from Router R2, while the other route map sets the Local Preference attribute to a value of 150 and is associated with incoming routes from Router R3. BGP prefers higher preference values. Therefore, after refreshing the BGP table with the clear ip bgp * soft command, the show bgp ipv6 unicast command output indicates that Router R1 now prefers Router R3 as the next-hop router to reach the 2000:4::/64 network. + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 695 + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 15-2 lists several design goals related to this chapter. If these design goals were list-ed in a design document, and you had to take that document and develop an implemen-tation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 15-2 Design Review + + +Design Goal + +The design specifies that a customer’s Internet-facing router should dynamically obtain the IPv6 address for its Internet-facing interface from an ISP. (4) +The design specifies that a customer’s Internet-facing router exchange IPv4 and IPv6 routes with an ISP. +The design requires that you filter specific IPv6 routes sent to or received from an ISP. +The design has a dual-homed Internet connection running MP-BGP, with a requirement that you influence the outbound path selection. + +Possible Implementation Choices Covered in This Chapter + + + + +Implementation Plan Peer Review Table + +Table 15-3 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + +From the Library of Alexey Evseenko +696 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 15-3 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +The plan requires a client’s Internet-facing router to obtain an IPv6 address from the client’s ISP. What approach to dynamically assigning IPv6 addresses allows an Internet-facing router to obtain a single IP address from an ISP’s DHCP server? +The plan requires the use of an IPv6 ACL. What two traffic types does an IPv6 ACL implicitly permit? (2) +The plan calls for the use of MP-BGP. List at least three of the new elements introduced by MP-BGP. (3) +The plan calls for the routing of both IPv4 and IPv6 networks with an ISP. What variant of BGP supports this requirement? +The plan calls for the use of MP-BGP, configured such that both IPv4 and IPv6 routes can be advertised over a single IPv4 BGP session. What additional configuration element is required to support this type of design, as opposed to a design where IPv6 routes are advertised over an IPv6 BGP session? +The plan calls for the use of the Local Preference attribute to influence outbound path selection for an MP-BGP network. Are higher or lower Local Preference values preferred? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 15-4 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 697 + + +Table 15-4 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Assign an IPv6 address to a router interface connecting to an ISP (in interface configuration mode). +Configure a default route pointing to an ISP (in global configuration mode). +Create an IPv6 ACL (in global configuration mode). +Apply an IPv6 ACL to an interface (in interface configuration mode). +Enable IPv6 unicast routing (in global configuration mode). +Create a route map (in global configuration mode). +Specify the IPv6 address of a router’s interface connecting to a neighbor as a next-hop IPv6 address (in route map configuration mode). +Define a BGP autonomous system (in global configuration mode). +Define an IPv4 neighbor (in router configuration mode for BGP). +Enter IPv4 address family configuration mode (in router configuration mode for BGP). +Specify which interface(s) will participate in the IPv4 address family (in address family configuration mode). +Enter IPv6 address family configuration mode (in router configuration mode for BGP). +Specify which interface(s) will participate in the IPv6 address family (in address family configuration mode). +Activate the BGP neighbor for the IPv6 address family (in address family configuration mode). +Associate a route map with a neighbor, to advertise an appropriate next-hop IPv6 +address to that neighbor (in address family configuration mode). + + + + + + +From the Library of Alexey Evseenko +698 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Feature Configuration Commands/Notes +Define an IPv6 BGP neighbor (in router configuration mode for BGP). +Create an IPv6 prefix list (in global configuration mode). +Apply an IPv6 prefix list (in address family configuration mode). +Specify a Local Preference (in route map configuration mode). + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table 15-5 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 15-5 Verification Plan Memory Drill + +Information Needed Command(s) +Display ACLs (both IPv4 and IPv6 ACLs). + +Display IPv6 routes. + +Display the IPv6 networks known to BGP. + +Display the BGP router ID, local AS number, and a listing of neighbors and their AS numbers in an MP-BGP configuration. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 15-6 lists a reference of these key topics and the page numbers on which each is found. + +Table 15-6 Key Topics for Chapter 15 +Key +Topic Key Topic Element Description Page Number + +List Methods of assigning an IPv6 address to a router 672 + +List Steps to configure an IPv6 address and a default 673 static route + + + + +From the Library of Alexey Evseenko +Chapter 15: IPv6 Internet Connectivity 699 + + +Key Topic Element Description Page Number + +Example 15-1 + +Example 15-2 + +List + +List + +List + +Example 15-15 + +Example 15-17 + +Manual IPv6 Address Assignment and Static Default 674 Route Configuration +IPv6 ACL Configuration and Verification 675 + +Steps to configure IPv6 routing over an IPv4 BGP 679 session +Steps to configure IPv6 routing over an IPv6 BGP 684 session +Characteristics of single or dual BGP sessions 689 + +Prefix List Configuration on Router R2 691 + +Local Preference Configuration 693 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +SLAAC, Stateless DHCPv6, Stateful DHCPv6, DHCPv6-PD, MP-BGP + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Elements of a Router Security Policy: This sec-tion defines a router security policy, explains why it is important to have one, and lists common elements comprising such a policy. +■ Access Control Lists: This section builds on your CCNA-level knowledge of standard, extended, and named access control lists (ACL) by introducing time-based ACLs and the concept of infrastructure ACLs. +■ Management Plane Security: This section dis-cusses a collection of features and services avail-able in Cisco IOS routers that can be used to better secure a router from attack. + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 16 + + + + +Fundamental Router Security Concepts + + + +Cisco uses the term defense-in-depth to describe an approach to network security hav-ing multiple layers of overlapping security mechanisms. One such layer of protection is the hardening (that is, more strictly enforcing security) of Cisco IOS routers. This chap-ter focuses on some of the techniques used to better secure these critical infrastructure devices. The first section of this chapter begins with a look at the importance of having a router security policy and what a policy might contain. + +Next, this chapter builds on your CCNA-level knowledge of access control lists (ACL) and introduces time-based ACLs that are only active at specified times. Also, the chapter presents a best-practice recommendation for creating infrastructure ACLs (that is, ACLs that sit at the edge of a network and help protect a network infrastructure from external attacks). + +The remainder of the chapter examines a collection of features and services that you can use to better secure a router’s management plane. These features and services include Secure Shell (SSH), password encryption, Unicast Reverse Path Forwarding (uRPF), AAA, SNMP security, and NTP authentication. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these eight self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 16-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these spe-cific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A . + +Table 16-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Elements of a Router Security Policy + +Access Control Lists + +Management Plane Security + +Questions +1, 2 + +3, 4 + +5–8 + + + + + + + +From the Library of Alexey Evseenko +702 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. What mechanisms can be used to defend against IP spoofing? (Choose two.) + +a. AAA + +b. uRPF + +c. CAR + +d. ACLs + +2. Which of the following features can provide router redundancy? + +a. SNMP + +b. HSRP + +c. AAA + +d. TACACS+ + +3. Identify two types of time-based ACLs. (Choose two.) + +a. Reflexive + +b. Periodic + +c. Absolute + +d. Adaptive + +4. What term is given to an ACL that typically resides on a network’s boundary routers (that is, routers facing another autonomous system), which is designed to protect a network from malicious traffic? +a. Time-based ACL + +b. Reflexive ACL + +c. Absolute ACL + +d. Infrastructure ACL + +5. When configuring a router to support SSH connections, which of the following are used in generating an RSA key pair? (Choose two.) + +a. Host name + +b. Router ID + +c. Domain name + +d. Configuration revision number + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 703 + +6. Which type of Cisco IOS password encryption uses the Vigenere cipher? + +a. Type 0 + +b. Type 4 + +c. Type 5 + +d. Type 7 + +7. Which mode of uRPF causes a router interface to accept a packet, if the network to which the packet’s source IP address belongs is found in the router’s FIB? + +a. Strict mode + +b. Loose mode + +c. Auto mode + +d. Desirable mode + +8. Which of the following are characteristics of TACACS+? (Choose two.) + +a. Uses UDP + +b. Encrypts an entire packet + +c. Offers robust accounting + +d. Cisco-proprietary + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +704 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +Elements of a Router Security Policy + +In today’s enterprise networks, routers often sit at the edge of the network, connecting out to other sites. As a result, they often come under a multitude of attacks. + +Because these precariously positioned devices reside at a critical line of defense, Cisco recommends that you have a documented plan detailing how your routers are secured. Having a formalized approach to router security helps ensure a consistent configuration across multiple devices and helps identify potential security weaknesses. + +A document defining the security features deployed on a router is called a router secu-rity policy. While the elements of a router security policy can vary from network to network, the following list provides a collection of security topics commonly addressed in a router security policy: + + +■ Key +Topic +■ + + + + + +■ + + + + +■ + + +■ + + + + +■ + + +■ + + +■ + + +■ + +Passwords: Will passwords appear encrypted in the router’s running configuration? How often should passwords be changed? How complex should passwords be? + +Authentication: Will users be authenticated by a router’s local database or by an external authentication, authorization, and accounting (AAA) server (for example, a TACACS+ or RADIUS server)? Will a AAA server be used to log login and logout events? Will a banner be presented to someone logging in, letting him know that only authorized users should attempt to log in? + +Access: When administrators remotely connect to the router, what protocols are they allowed to use (for example, SSH, HTTPS, Telnet, HTTP)? If Simple Network Management Protocol (SNMP) is configured to use community strings for authenti-cation, how often should those community strings be changed? + +Services: What services currently running on the router are unneeded and should be disabled? + +Filtering: Are private IP addresses (as defined in RFC 1918) being filtered? How is the router configured to defend against IP spoofing attacks, where a malicious user on a remote network makes his source IP address appear to be a trusted IP address? (Examples of antispoofing mechanisms include ACLs and uRPF.) + +Routing protocols: What kind of authentication (if any) is used by the router’s rout-ing protocol(s)? + +Backups: How is the router configuration backed up (for example, to a TFTP server)? How often does this backup occur? + +Documentation: What procedure is in place to ensure that all router configuration changes are documented? + +Redundancy: If a router fails, is there a backup router to take over? If there is a back- +up router, is it a hot standby router (for example, a router that is currently running + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 705 + +and configured with a first-hop redundancy protocol such as Hot Standby Router Protocol [HSRP]) or a cold standby router (for example, a router that was on-site, but was not necessarily powered on or configured)? + +■ Monitoring: What parameters are being monitored and logged (for example, CPU utilization, memory utilization, and failed access attempts)? + +■ Updates: What procedure is in place to determine whether security vulnerabilities have been identified in the version of Cisco IOS running on the router? What proce-dure is in place to update the version of Cisco IOS running on the router? + + +Note This book lightly touches on router and network security topics; however, router and network security are much larger fields of study. If you are interested in learning more about router and network security, consider taking the courses or reading the books in the Cisco CCNA Security and CCNP Security tracks. + + + +Access Control Lists + +In your CCNA studies, you learned about access control lists (ACL). Specifically, you learned how standard ACLs could match traffic based on source IP addresses and how extended ACLs could match traffic based on source IP addresses, destination IP address-es, and a variety of other criteria such as port numbers. You also learned how to create numbered or named ACLs. These ACLs are frequently used to protect a router’s data plane (that is, to filter traffic traveling through a router). However, ACLs can also be used to help protect the management plane and the control plane. + +The ROUTE exam blueprint requires that you remember these fundamental ACL con-cepts. Additionally you need to know how to configure time-based ACLs. This section introduces you to time-based ACLs and illustrates how to create infrastructure ACLs, which are applied to routers sitting at the edge of an enterprise network. + +Time-Based ACLs + +You might want to allow specific protocols to come into your network during business hours, but not outside of business hours. For example, imagine that a company has an internal web server that it wants to be accessible to its remote employees during working hours (that is, Monday through Friday from 8:00 a.m. to 5:00 p.m.). You could accom-plish such a design goal through the use of time-based ACLs, which are only in effect during a specified time range. + + +Note A time range configured on a router references a router’s clock. Therefore, a best practice is to configure Network Time Protocol (NTP) on a router, which can help ensure that the router’s internal clock has the correct time. + + + + + +From the Library of Alexey Evseenko +706 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +A time range can be periodic, where it becomes active or inactive at specific times of the day on specific days of the week. Alternately, a time range can be absolute, where there is a fixed starting and stopping date and time during which the ACL is active. Table 16-2 presents a list of commands used in creating a time-based ACL. + +Table 16-2 Time-Based ACL Commands Key +Topic Command Description + + +time-range name + +periodic days-of-week hh:mm to hh:mm + +absolute [ start hh:mm day_of_month month year] end hh:mm day_of_month month year + +access-list ACL_number time-range name_of_time_range + + time-range name_of_ time_range + +Create a named time range (in global configuration mode). +Define a periodic time range (in time range configuration mode). +Define an absolute time range (in time range configuration mode). + +Apply a time range to a numbered ACL (in global configuration mode). + +Apply a time range to a named ACL (in named access list configuration mode). + + + +Consider the topology presented in Figure 16-1, where an enterprise network needs remote employees to access an internal web server Monday through Friday from 8:00 a.m. to 5:00 p.m. + + +Only permit connections to the internal web server Mon–Fri from +8:00 am–5:00 pm. + + +Internet + + + + +S1/0 Remote User Attempting to +R1 Reach the Internal Corporate Web +Server + + + + + +Internal Web Server 192.168.1.10 + +Figure 16-1 Web Server with Time-Based Access Permissions + +Example 16-1 shows the configuration on Router R1 that supports time-based access to the internal web server for an external user. + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 707 + +Example 16-1 Time-Based ACL Configuration Example +Key +Topic R1# conf term +R1(config)# time-range WEEKDAYS +R1(config-time-range)# periodic ? + +Friday +Monday +Saturday +Sunday +Thursday +Tuesday +Wednesday +daily +weekdays +weekend + +Friday +Monday +Saturday +Sunday +Thursday +Tuesday +Wednesday +Every day of the week +Monday thru Friday +Saturday and Sunday + + +R1(config-time-range)# periodic weekdays 8:00 to 17:00 +R1(config-time-range)# exit +R1(config)# access-list 100 permit tcp any host 192.168.1.10 eq 80 time-range +WEEKDAYS + +... OUTPUT OMITTED FOR OTHER PERMIT ACL STATEMENTS NOT RELEVANT TO THIS EXAMPLE ... + +R1(config)# interface serial 1/0 +R1(config-if)# ip access-group 100 in +R1(config-if)# end + +In Example 16-1, a time range named WEEKDAYS was created. Context-sensitive help revealed that a keyword of weekdays could be used to specify the days Monday through Friday, without the need to list each day. An extended access list, numbered 100, was cre-ated to permit traffic to IP address 192.168.1.10 (that is, the internal web server) on TCP port 80, and the time range of WEEKDAYS was applied. + +Infrastructure ACLs + +An infrastructure ACL is typically an extended ACL that is applied to routers residing on the outer edges of an enterprise network. The primary purpose of this ACL is to pre-vent malicious traffic from entering the enterprise. As an example, an infrastructure ACL could be used to block packet fragments while permitting packets being exchanged with trusted Border Gateway Protocol (BGP) peers, management stations, and transit traffic (that is, traffic whose source and destination are both off-net). + +Although the specific elements present in an infrastructure ACL can vary widely from network to network, Example 16-2 shows a sample infrastructure ACL configuration. + + + + + + + +From the Library of Alexey Evseenko +708 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 16-2 Sample Infrastructure ACL +Key +Topic ip access-list extended INFRASTRUCTURE +! +! BLOCK PACKET FRAGMENTS +deny tcp any any fragments +deny udp any any fragments +deny icmp any any fragments +deny ip any any fragments +! +! ALLOW NECESSARY ROUTING PROTOCOL +! AND NETWORK MANAGMENT TRAFFIC +permit tcp host < external-bgp-peer> host eq bgp +permit tcp host < external-bgp-peer> eq bgp host < internal-bgp-peer> +permit tcp any eq 22 +permit tcp any eq 161 +permit icmp any echo +! +! BLOCK ALL OTHER TRAFFIC DESTINED FOR INTERNAL NETWORK +deny ip any < address-space-of-internal-network> +! +! PERMIT OFF-NET TO OFF-NET TRAFFIC +permit ip any any +! +! APPLY ACL IN THE INBOUND DIRECTION TO AN INTERFACE +! CONNECTING TO AN EXTERNAL NETWORK +interface Serial1/0 +ip access-group INFRASTRUCTURE in + +To make Example 16-2 simpler to understand, variables (which are in italics) representing IP addresses and network address spaces are used instead of actual IP addresses. In the example, an ACL named INFRASTRUCTURE was created. A collection of deny state-ments was then given to block packet fragments. Next, a series of permit statements was given to allow peering with an external BGP router (possibly a service provider’s router), SSH and SNMP connections from trusted management stations, and pings from trusted management stations. All other traffic destined for internal IP addresses was denied, while traffic that originated off-net and was destined for an off-net IP address was permitted. The INFRASTRUCTURE ACL was then applied in the inbound direction to an Internet-facing interface (interface Serial 1/0 in this example). + +Management Plane Security + +As mentioned in Chapter 11, “Route Selection,” a router’s architecture can be categorized into three operational planes: + + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 709 + + +■ +Key Topic + + + +■ + + +■ + +Management plane: The management plane is concerned with the management of the device. For example, an administrator connecting to a router through a Secure Shell (SSH) connection through one of the router’s VTY lines would be a manage-ment plane operation. + +Control plane: The control plane is concerned with making packet-forwarding deci-sions. For example, routing protocol operation would be a control plane function. + +Data plane: The data plane is concerned with the forwarding of data through a router. For example, end-user traffic traveling from a user’s PC to a web server on a +different network would go across the data plane. + + +The ROUTE exam blueprint requires that you know how to protect each of these planes. This chapter discusses approaches for protecting the management plane. Chapter 17, “Routing Protocol Authentication,” covers control plane security, by performing authen-tication for a variety of routing protocols. Finally, you should be familiar with access con-trol lists (ACL) to protect the data plane. ACLs were discussed in your CCNA studies. + +Secure Shell Versus Telnet + +Many network engineers commonly use Telnet to remotely connect to their routers; how-ever, Cisco strongly recommends using Secure Shell (SSH) instead of Telnet. + +The issue with Telnet is that it sends data (including passwords) across a network in clear text. This opens the door for a malicious user to launch a man-in-middle attack and use packet capture software to read the contents of the Telnet session’s packets. + +Fortunately, SSH encrypts this traffic. So, even if a malicious user did capture packets from the SSH session, the packets would be unreadable. + +The steps to configure SSH on a router are as follows: + + +Step 1. Key +Topic + +Step 2. + + + +Step 3. + + + +Step 4. + + +Step 5. + + +Specify a host name for the router, with the hostname name command in global configuration mode. (The host name is one of the elements used to cre-ate an RSA key pair.) + +Specify a domain name for the router with the ip domain-name domain_ name command in global configuration mode. (The domain name is one of the elements used to create an RSA key pair.) + +Create a username and password for a user with a privilege level of 15 using the username username privilege 15 secret password global configuration mode command. + +Generate an RSA key pair with the crypto key generate rsa modulus size_ of_modulus command in global configuration mode. + +Use the transport input ssh command in VTY line configuration mode to +make SSH the only supported VTY transport protocol. + + + + + + + + +From the Library of Alexey Evseenko +710 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 6. Issue the login local command in VTY line configuration mode to tell SSH to use a router’s local user database for authentication. + +Step 7. (Optional) Use the access-class acl in command in VTY line configuration mode to limit VTY access to IP addresses matched by the specified ACL. + +Example 16-3 illustrates a sample SSH configuration on Router R1, as shown in Figure 16-2. + +Access Denied +Internet + + + + + +R1 + +Malicious User Attempting to SSH into the Router R1 + + +Data Encrypted “clljk6q33u902jasd;lkjq2p09asf25sd&7qwe” +10.1.1.0/24 + + + + + + +Malicious User Capturing Packets from Network Engineer’s Laptop + +Network Engineer’s Laptop + + +Figure 16-2 Defending Against Unauthorized VTY Access + +Example 16-3 Enabling SSH for VTY Access Key +Topic hostname R1 +ip domain-name 1ExamAMonth.com +! +crypto key generate rsa modulus 2014 +! +username kevin privilege 15 secret cisco +! +access-list 1 permit 10.1.1.0 0.0.0.255 +access-list 1 deny any log +! +line vty 0 15 +access-class 1 in +login local +transport input ssh + + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 711 + +Figure 16-2 shows a network engineer’s laptop on subnet 10.1.1.0 /24 that currently has an SSH session open to Router R1; however, a malicious user located on the same subnet is capturing packets from the SSH session (possibly after a man-in-the-middle attack). Fortunately, the network engineer used SSH to connect to the router, causing the packets captured by the malicious user to be unreadable. + +Another malicious user, located somewhere on the Internet, is attempting to set up an SSH session with Router R1, possibly using a program that does a brute-force attack (that is, repeatedly trying different passwords until the correct password is determined). Fortunately, this user is not even presented with a login prompt, because an access class has been configured for the router’s VTY lines that does not permit connections from any source IP address not on the 10.1.1.0 /24 subnet. + +Example 16-3 shows Router R1’s configuration that allows it to defend against the mali-cious users pictured in Figure 16-1. First, the host name is set to R1 and the domain name is set to 1ExamAMonth.com. These values are used in the calculation of the RSA key pair, which is initiated with the crypto key generate rsa modulus 2014 command. Note that you can use different modulus lengths in the range 260–4096. However, longer lengths are considered more secure. + +A username of kevin with a password of cisco was created, and that user account was given a privilege level of 15, which is the highest privilege level. An access list was then created to match IP addresses in the 10.1.1.0 /24 subnet. + +In VTY line configuration mode, the transport input ssh command causes the VTY lines to accept only SSH connections. The access-class 1 in command tells the VTY lines to accept only those connections coming from IP addresses matched by ACL 1. Finally, the login local command tells SSH to use the router’s local database (as populated with the username command) for authentication. + +Password Encryption + +Ideally, all passwords associated with your routers would be stored on an external AAA server; however, it is often necessary to locally store passwords on a router. If someone were to see that router’s running configuration, she would be able to see any of those passwords, if they were in clear text. Therefore, a best-practice security recommendation is to encrypt any passwords appearing in a router’s configuration. + +Cisco IOS has a few different passwords that you might want to encrypt (or represent as a hash value), including the enable secret password, line password, and username password. + +Enable Secret Password + +The enable secret password can be used to give a network engineer full privileges on a router. This password is configured with the enable secret password global configura-tion mode command. The password then appears in a router’s running configuration as a Secure Hash Algorithm–256 (SHA-256) hash value, which is very difficult to reverse, even if it did fall into the hands of a malicious user. + + + + + +From the Library of Alexey Evseenko +712 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 16-4 shows the configuration and verification of an enable secret password. + +Example 16-4 Enable Secret Password Configuration and Verification + +R1# conf term +R1(config)# enable secret cisco +R1(config)# end + +R1# show run +...OUTPUT OMITTED... +enable secret 4 tnhtc92DXBhelxjYk8LWJrPV36S2i4ntXrpb4RFmfqY + +In Example 16-4, an enable secret password of cisco is configured on Router R1. The running configuration then shows the SHA-256 hash of the password. The 4 indicates that the string is an SHA-256 hash. On some older versions of Cisco IOS, you will see a 5 there instead of a 4. A 5 indicates that the hash is a Message Digest 5 (MD5) hash, which is not considered as secure as SHA-256. + + +Note If you happen to know the MD5 or SHA-256 hash of the password you want to use, you can specify the actual hash as part of the enable secret command. Specifically, you could use the enable secret 5 md5-hash command to specify an MD5 hash for a pass-word. Alternately, you could use the enable secret 4 sha-256-hash command to specify an SHA-256 hash for a password. + + + +Line Password + +A line password is used to authenticate a user attempting to log in to one of the router’s lines; for example, a VTY (virtual TTY) line, the console line, or the auxiliary line. You can define a line password in line configuration mode with the password password command; however, at that point, the password still shows up in the router’s running configuration in clear text. To encrypt that password, you can issue the service pass-word-encryption command in global configuration mode. Unfortunately, this type of encryption is not very strong. It uses the Vigenere cipher and is also known as Type 7 encryption. While this type of encryption can protect passwords from a casual observer who happens to catch a glimpse of the password, it can easily be deciphered (using freely available utilities on the Internet) if someone were to come into possession of a router’s running configuration. Therefore, Cisco recommends configuring username/password combinations (discussed in the next section) and requiring those credentials to be entered before accessing one of the router’s lines. + +Example 16-5 shows the configuration and verification of a line password for the +console line. The example continues to show the configuration and verification of Type 7 encryption. + + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 713 + +Example 16-5 Line Password Configuration and Verification +Key +Topic R1# conf term +R1(config)# line con 0 +R1(config-line)# password cisco +R1(config-line)# login +R1(config-line)# end +R1# show run | s line +line con 0 +password cisco +login +... OUTPUT OMITTED ... + +R1# conf term +R1(config)# service password-encryption +R1(config)# end +R1# show run | s line +line con 0 +password 7 1511021F0725 +... OUTPUT OMITTED ... + +In Example 16-5, a line password of cisco is configured for the console 0 line. The login command enables the ability for someone to log in to the console port, supplying the configured password as his only authentication credential. However, as seen in the run-ning configuration, the password was not encrypted. Therefore, the example then shows the service password-encryption command being entered, which does encrypt the password. Unfortunately, the type of encryption used is Type 7 encryption, which is very weak encryption. A more preferable approach (as demonstrated in the next section) is to authenticate users based on a username/password combination, where the password appears in the running configuration as an SHA-256 hash value. + +Username Password + +Instead of just requiring a password to log in to a router, you can create a username/ password combination that a network engineer must enter to gain access to the router. Usernames can also be configured with various privilege levels (where a privilege level of 15 indicates a full set of privileges). These privilege levels can be used to control what Cisco IOS commands a user can execute. + +You can populate a locally stored user database with the command username username privilege privilege secret password. This causes an SHA-256 hash of the password to appear in the router’s running configuration, which is vastly more secure than Type 7 encryption. + +Example 16-6 shows the configuration and verification of creating a local user and allow-ing that user account to access a router’s VTY lines. + + + + + + +From the Library of Alexey Evseenko +714 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 16-6 Local User Account Creation and Verification + +R1# conf term +R1(config)# username kevin privilege 15 secret cisco +R1(config)# line vty 0 15 +R1(config-line)# login local +R1(config-line)# end + +R1# show run +... OUTPUT OMITTED ... +! +username kevin privilege 15 secret 4 tnhtc92DXBhelxjYk8LWJrPV36S2i4ntXrpb4RFmfqY +! +... OUTPUT OMITTED ... +! +line vty 0 15 +login local +... OUTPUT OMITTED ... + +Example 16-6 shows the configuration of a username of kevin with a password of cisco. The login local command issued in line configuration mode tells the VTY lines to use the router’s local user account database for authentication. This is as opposed to only using a password configured in line configuration mode for authentication, as was seen in Example 16-5. Notice that the password appears in the running config as an SHA-256 hash of the password, as evidenced by the 4 preceding the hash. On some older versions of Cisco IOS, you might instead see a 5 preceding the hash, indicating an MD5 hash. + +Unicast Reverse Path Forwarding + +One approach to preventing malicious traffic from entering a network is to use Unicast Reverse Path Forwarding (uRPF). Specifically, uRPF can help block packets having +a spoofed IP address. The way that uRPF works is to check the source IP address of a packet arriving on an interface and determine whether that IP address is reachable, based on the router’s Forwarding Information Base (FIB) used by Cisco Express Forwarding (CEF). Optionally, the router can also check to see whether the packet is arriving on the interface the router would use to send traffic back to that IP address. + + +Note CEF must be enabled on a router to use uRPF. + + +You can choose between three modes of operation for uRPF: + +■ Strict mode: With strict mode operation, a router not only checks to make sure that the source IP address of an arriving packet is reachable, based on the router’s FIB, but the packet must also be arriving on the same interface the router would use to send traffic back to that IP address. + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 715 + +■ Loose mode: With loose mode operation, a router only verifies that the source IP address of a packet is reachable, based on the router’s FIB. + +■ VRF mode: Virtual Routing and Forwarding (VRF) is a technology that allows a router to have multiple IP routing table instances, thus allowing overlapping IP +addresses to be used. uRPF operating in VRF mode (also known as uRPF version 3 or uRPFv3) is similar to loose mode operation in that source IP addresses are checked against the FIB for a specific VRF. + + +Note Based on the scope of the ROUTE exam blueprint, this book covers the configura-tion and verification of strict mode and loose mode. + + +From a design perspective, strict mode could cause traffic to be dropped if an asyn-chronous routing situation exists (that is, traffic from a network address space might be received on one router interface, but traffic to that same network address space might be transmitted out of a different router interface). Therefore, strict mode should typically be used where there is no chance of asynchronous routing (for example, a branch office with only one connection going back to a corporate headquarters). + +Some IP routing tables (and therefore, the associated FIBs) might not have explicit entries for individual networks with which they communicate. Instead, a default route might be used. In such a situation, would a router configured with uRPF drop an arriving packet if the network for that packet’s source IP address was not present in the router’s FIB? + +By default, a router with uRPF configured would drop a packet whose source IP address was only reachable by a default route; however, uRPF supports an allow-default option that accepts a default route as a valid way to get back to a source IP address. + +To further fine-tune uRPF operation, you can configure an ACL and reference that ACL in the uRPF configuration command. If you do reference an ACL, it is checked only when a uRPF check fails. After a uRPF check failure, if a packet is matched and permitted by the associated ACL, it is transmitted. If a packet fails the uRPF check and is denied by the associated ACL, however, the packet is dropped. + +The command used to configure uRPF in interface configuration mode is as follows: + +ip verify unicast source reachable-via { rx | any} [ allow-default] [ allow-self-ping] [ acl] + +Table 16-3 describes the parameters of this command. + + + +Table 16-3 +Key +Topic Parameter + +rx + +any + + +uRPF Configuration Parameters + +Description +Enables uRPF in strict mode + +Enables uRPF in loose mode + + + + + + +From the Library of Alexey Evseenko +716 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide +Source: 10.0.0.1 +Destination: 192.168.0.2 + + + +Parameter allow-default + + +allow-self-ping + + +acl + +Description +Allows uRPF to use a default route if a network is not found in a router’s FIB (Note: The allow-default option can be used with either strict or loose mode.) +Allows a router to ping itself when checking the reachability of an IP address (Note: Cisco recommends against using the allow-self-ping option in most cases, because it introduces a security risk.) +Identifies an optional access control list that can either permit or deny traffic that fails the uRPF check + + + +To illustrate the configuration of uRPF, consider Figure 16-3 and Examples 16-7 and 16-8. + + + + + +Trusted Management Subnet 10.0.0.0/24 + + + + + +Fa0/ .1 + + + + +Fa0/0 +.1 S2/0 .1 + +R1 +Fa1/0 .1 + + + + +Source: 198.51.100.2 Destination: 192.168.1.100 +IP WAN +Loose Mode Allow Default + +Remote User Accessing Public Web Server + + + + + +.2 .3 +Data Center Subnet 192.168.0.0/24 + + +.100 + +192.168.1.0/24 + +Public Strict Mode Web +Server + + + + + +Malicious User Spoofing a Source IP Address of 10.0.0.1 + +Figure 16-3 uRPF Sample Topology + + + + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 717 + +Example 16-7 uRPF Sample Configuration +Key +Topic interface FastEthernet1/0 +ip address 192.168.1.1 255.255.255.0 +ip verify unicast source reachable-via rx +! +... OUTPUT OMITTED ... +! +interface Serial2/0 +ip address 172.16.0.1 255.255.255.252 +ip verify unicast source reachable-via any allow-default + + +Example 16-8 Router R1’s FIB + + +R1# show ip cef +Prefix +0.0.0.0/0 +0.0.0.0/8 +0.0.0.0/32 +10.0.0.0/24 +10.0.0.0/32 +10.0.0.1/32 +10.0.0.255/32 +127.0.0.0/8 +172.16.0.0/30 +172.16.0.0/32 +172.16.0.1/32 +172.16.0.2/32 +172.16.0.3/32 +192.168.0.0/24 +192.168.0.0/32 +192.168.0.1/32 +192.168.0.255/32 +192.168.1.0/24 +192.168.1.0/32 +192.168.1.1/32 +192.168.1.255/32 +Prefix +224.0.0.0/4 +224.0.0.0/24 +240.0.0.0/4 +255.255.255.255/32 + + +Next Hop +172.16.0.2 +drop +receive +attached +receive +receive +receive +drop +attached +receive +receive +attached +receive +attached +receive +receive +receive +attached +receive +receive +receive +Next Hop +drop +receive +drop +receive + + +Interface +Serial2/0 + + +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + +Serial2/0 +Serial2/0 +Serial2/0 +Serial2/0 +Serial2/0 +FastEthernet0/1 +FastEthernet0/1 +FastEthernet0/1 +FastEthernet0/1 +FastEthernet1/0 +FastEthernet1/0 +FastEthernet1/0 +FastEthernet1/0 +Interface + + +In the preceding example, a malicious user on the 192.168.1.0 /24 network is spoof-ing his IP address. Specifically, he is sending packets to a server (with an IP address of +192.168.0.2) in the data center subnet, and he is altering his source IP address to 10.0.0.1. The reason for this IP spoofing is so that the user’s traffic will appear to come from the + + + + +From the Library of Alexey Evseenko +718 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +trusted management subnet of 10.0.0.0 /24 (which has permission to access the data cen-ter servers). However, as his traffic enters interface Fa 1/0 on Router R1, uRPF (configured for strict mode) checks to see what interface would be used to send traffic back to an IP address of 10.0.0.1. As seen in Example 16-8, Router R1’s FIB indicates that traffic des-tined for 10.0.0.1 would go out of interface Fa 0/0. Because the received traffic is being received on interface Fa 1/0, the uRPF check fails and the traffic is dropped. + +Also, a remote user with an IP address of 198.51.100.2 is attempting to access a pub-lic web server with an IP address of 192.168.1.100. Traffic from the remote user enters +Router R1 on interface Serial 2/0. This interface has been configured with uRPF in loose mode, along with the allow-default option. As seen in Example 16-8, Router R1’s FIB does not have a specific entry for this user’s network. However, there is a default route +in the FIB (that is, the 0.0.0.0/0 route). Because uRPF configured on interface Serial 2/0 is using the allow-default option, the default route is considered to be a route that matches the source IP address. Therefore, the traffic from this remote user is permitted into Router R1. + +You can use the show cef interface interface_id command to determine whether uRPF is enabled on an interface. Example 16-9 shows the output of this command for both inter-face Fa 1/0 and Serial 2/0. + +Example 16-9 uRPF Verification + +R1# show cef interface fa 1/0 +FastEthernet1/0 is up (if_number 4) +Corresponding hwidb fast_if_number 4 +Corresponding hwidb firstsw->if_number 4 +Internet address is 192.168.1.1/24 +ICMP redirects are always sent +Per packet load-sharing is disabled +IP unicast RPF check is enabled +Input features: uRPF +IP policy routing is disabled +BGP based policy accounting on input is disabled +BGP based policy accounting on output is disabled +Hardware idb is FastEthernet1/0 +Fast switching type 1, interface type 18 +IP CEF switching enabled +IP CEF switching turbo vector +IP CEF turbo switching turbo vector +IP prefix lookup IPv4 mtrie 8-8-8-8 optimized +Input fast flags 0x4000, Output fast flags 0x0 +ifindex 4(4) +Slot Slot unit 0 VC -1 +IP MTU 1500 +R1# show cef interface s 2/0 +Serial2/0 is up (if_number 6) +Corresponding hwidb fast_if_number 6 + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 719 + +Corresponding hwidb firstsw->if_number 6 +Internet address is 172.16.0.1/30 +ICMP redirects are never sent +Per packet load-sharing is disabled +IP unicast RPF check is enabled +Input features: uRPF, iEdge +Output features: iEdge +IP policy routing is disabled +BGP based policy accounting on input is disabled +BGP based policy accounting on output is disabled +Interface is marked as point to point interface +Hardware idb is Serial2/0 +Fast switching type 7, interface type 70 +IP CEF switching enabled +IP CEF switching turbo vector +IP CEF turbo switching turbo vector +IP prefix lookup IPv4 mtrie 8-8-8-8 optimized +Input fast flags 0x10004000, Output fast flags 0x100000 +ifindex 6(6) +Slot Slot unit 0 VC -1 +IP MTU 1500 + + +Authentication, Authorization, and Accounting + +Enforcing router login security in larger networks can be challenging if you have to man-age multiple user databases (for example, having a separate user database locally config-ured on each router of your network). Fortunately, with AAA (authentication, authoriza-tion, and accounting) services, you can have a single repository for user credentials. Then, when a network engineer attempts to log in to, for example, a router, the credentials that she supplies can be authenticated against a centralized AAA database. + +Another advantage of giving different network administrators their own login credentials, as opposed to an enable secret password used on all routers, is that users can quickly be added and deleted from the database without the need to reconfigure each router. Not only can AAA service administrative logins connecting to a router, but AAA can also control connections passing through a router to, for example, resources inside a network. + +Three services are offered by a AAA server, as follows: + +■ Authentication: The authentication service can check a user’s credentials to confirm he is who he claims to be. + +■ Authorization: After being authenticated, the authorization service determines what that user is allowed to do. + +■ Accounting: The accounting service can collect and store information about a user’s login. This information can be used, for example, to keep an audit trail of what a user did on the network. + + + + +From the Library of Alexey Evseenko +720 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Figure 16-4 shows a AAA topology where only authentication is being performed. The user at an IP address of 192.168.1.50 is attempting to establish a Telnet session with a router at an IP address of 10.3.3.2. The router’s configuration, shown in Example 16-10, causes Router R1 to prompt a user for username and password credentials and to check those credentials against a AAA server (a TACACS+ server in this example, as opposed to a RADIUS server). If the provided credentials match the database being referenced by the AAA configuration, the user is permitted to log in to the router. + + + +10.3.3.2 + +R1 + +Telnet + + +R2 + +Telnet Client 192.168.1.50 + + + +Authentication + + + + + + +AAA Server (TACACS+) 192.168.0.40 + +Figure 16-4 AAA Sample Topology + +Example 16-10 AAA Configuration for Authenticating Remote Logins Key +Topic aaa new-model +aaa authentication login ADMIN group tacacs+ local +! +username kevin secret cisco +! +tacacs server CISCO-ACS +address ipv4 192.168.0.40 +key cisco +! +line vty 0 4 +login authentication ADMIN + +In the previous example, the aaa new-model command is used to enable AAA services on the router. The aaa authentication login ADMIN group tacacs+ local command defines a method list named ADMIN, which attempts to perform authentication through a TACACS+ server. However, if the TACACS+ is unavailable, the local key work instructs + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 721 + +the router to perform authentication using the local user database (which includes the user kevin with a password of cisco in this example). + +The TACACS+ server is defined as having an IP address of 192.168.0.40 with a shared secret key of cisco. The method list of ADMIN is then applied as the authentica- +tion method list for connections coming into the router over VTY lines 0 through 4. Therefore, when someone attempts to Telnet into this router, she is challenged to provide valid username and password credentials, which are then validated by the TACACS+ serv-er or the router’s local user database if the TACACS+ server is not available. + + +Note The Cisco IOS implementation of AAA services includes multiple configuration options, and a comprehensive discussion of AAA is beyond the scope of the ROUTE exam blueprint. For more information on AAA configuration, consult the Cisco “Authentication, Authorization, and Accounting Configuration Guide” available at the following URL: http://bit.ly/aaaconfig. + + +While Example 16-10 used a TACACS+ server as an external AAA server, another option is to use a RADIUS server. Table 16-4 compares these two authentication protocols. + +Table 16-4 Contrasting the TACACS+ and RADIUS Protocols +Key +Topic Characteristic TACACS+ RADIUS + + +Transport layer protocol + +Modularity + + +Encryption + +Accounting functionality + +Standards-based + +TCP + +Provides separate services for authentication, authorization, and accounting +Encrypts entire packet + +Offers basic accounting features + +No (Cisco-proprietary) + +UDP + +Combines authentication and authorization functions + +Only encrypts the password + +Offers robust accounting features +Yes + + + + +SNMP Security + +The first Request for Comments (RFC) for SNMP came out in 1988. Since then, SNMP has become the de facto standard for network management protocols. The original intent for SNMP was for SNMP to manage network nodes, such as network servers, routers, switches, and hubs. SNMP version 1 (SNMPv1) and SNMP version 2c (SNMPv2c) speci-fy three major components of an SNMP solution, as detailed in Table 16-5. + + + + + + + + +From the Library of Alexey Evseenko +722 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 16-5 Components of an SNMPv1 and SNMPv2c Network Management Solution +Key +Topic Component Description + + +SNMP manager + + +SNMP agent + +Management Information Base (MIB) + +An SNMP manager runs a network management application. This SNMP manager is sometimes referred to as a Network Management Server (NMS). +An SNMP agent is a piece of software that runs on a managed device (for example, a server, router, or switch). +Information about a managed device’s resources and activity is defined by a series of objects. The structure of these management objects is defined by a managed device’s Management Information Base (MIB). + + + +As depicted in Figure 16-5, an SNMP manager (an NMS) can send information to, request information from, or receive unsolicited information from a managed device (a managed router in this example). The managed device runs an SNMP agent and contains a MIB. + + +Manager + + + + +Network Management Station (NMS) + + +SNMP Trap + + + +SNMP Get + +SNMP Set + +Agent and Management Information Base (MIB) + + + +Managed Router + + +Figure 16-5 SNMPv1 and SNMPv2c Network Management Components and Messages + +Even though multiple SNMP messages might be sent between an SNMP manager and a managed device, consider the three broad categories of SNMP message types: + +■ GET: An SNMP GET message retrieves information from a managed device. + +■ SET: An SNMP SET message sets a variable in a managed device or triggers an action on a managed device. + +■ Trap: An SNMP Trap message is an unsolicited message sent from a managed device to an SNMP manager, which can notify the SNMP manager about a significant event that occurred on the managed device. + +SNMP offers security against malicious users attempting to collect information from a managed device, changing the configuration of a managed device, or intercepting +information being sent to an NMS. However, the security integrated with SNMPv1 and SNMPv2c is considered weak. Specifically, SNMPv1 and SNMPv2c use community strings to gain read-only or read-write access to a managed device. You can think of a community string as being much like a password. Also, be aware that multiple SNMP-compliant devices on the market today have a default read-only community string of public and a default read-write community string of private. As a result, such devices, left at their default SNMP settings, might be compromised. + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 723 + + +Note This section refers to SNMPv2c as opposed to SNMPv2. SNMPv2 contained security enhancements in addition to other performance enhancements. However, few net-work administrators adopted SNMPv2 because of the complexity of the newly proposed security system. Instead, Community-Based Simple Network Management Protocol (SNMPv2c) gained widespread acceptance, because SNMPv2c included the feature enhancements of SNMPv2 without using SNMPv2’s complex security solution. Instead, SNMPv2c kept the SNMPv1 concept of community strings. + + +If you do need to secure an SNMPv1 or SNMPv2c environment, you should change the community strings to nondefault values and possibly reference an ACL. The ACL could match a trusted subnet of management stations or a specific IP address of a management station. To illustrate how to better secure SNMPv1 and SNMPv2c router configurations, consider Example 16-11. + +Example 16-11 Securing SNMPv1 and SNMPv2c + +R1(config)# snmp-server community $3cr3T ro 10 +R1(config)# snmp-server community c1$c0 rw 10 +R1(config)# access-list 10 permit host 10.1.1.1 + +In Example 16-11, the read-only and read-write community strings (as specified with the ro and rw options) are being set to nondefault values, and the snmp-server community commands are referencing ACL 10, which is matching a trusted network management station with an IP address of 10.1.1.1. With this configuration, even if the community strings were compromised, an attacker would still have to appear to have an IP address of 10.1.1.1. + +Fortunately, the security weakness of SNMPv1 and SNMPv2c are addressed in SNMPv3. To better understand these security enhancements, consider the concept of a security model and a security level: + +■ Security model: Defines an approach for user and group authentications (for exam-ple, SNMPv1, SNMPv2c, and SNMPv3). + +■ Security level: Defines the type of security algorithm performed on SNMP packets. The three available security levels are + +■ noAuthNoPriv: The noAuthNoPriv (no authentication, no privacy) security level uses a username for authentication and does not use encryption to provide privacy. +■ authNoPriv: The authNoPriv (authentication, no privacy) security level provides authentication using Hash Message Authentication Code (HMAC) with MD5 or SHA-1. However, no encryption is used. +■ authPriv: The authPriv (authentication, privacy) security level offers HMAC MD5 or SHA-1 authentication and provides privacy through encryption. Spe-cifically, the encryption uses the Data Encryption Standard (DES), Triple DES (3DES), or Advanced Encryption Standard (AES) algorithm. + + + +From the Library of Alexey Evseenko +724 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +As summarized in Table 16-6, SNMPv3 supports all three security levels. Notice that SNMPv1 and SNMPv2c only support the noAuthNoPriv security level. + +Table 16-6 Security Models and Security Levels Supported by Cisco IOS +Key +Topic Security Model Security Level Authentication Strategy Encryption Type + + +SNMPv1 + +SNMPv2c + +SNMPv3 + +SNMPv3 + +SNMPv3 + +noAuthNoPriv + +noAuthNoPriv + +noAuthNoPriv + +authNoPriv + +authPriv + +Community string + +Community string + +Username + +MD5 or SHA-1 + +MD5 or SHA-1 + +None + +None + +None + +None + +DES, 3DES, or AES + + + +Through the use of security algorithms, as shown in Table 16-6, SNMPv3 dramatically increases the security of network-management traffic, as compared to SNMPv1 and SNMPv2c. Specifically, SNMPv3 offers three primary security enhancements: + +■ Integrity: Using hashing algorithms, SNMPv3 ensures that an SNMP message was not modified in transit. + +■ Authentication: Hashing allows SNMPv3 to validate the source of an SNMP message. + +■ Encryption: Using the DES, 3DES, or AES encryption algorithm, SNMPv3 provides privacy for SNMP messages, making them unreadable by an attacker who might cap-ture SNMP packets. + + +NTP Authentication + +Imagine that you are reviewing device logs collected in a router’s buffer and are attempt-ing to correlate the events in the device logs with an issue that you are troubleshooting. To make that correlation, the logged events need to have accurate timestamps. + +Although you could individually set the clock on each of your routers, those clocks might drift over time and not agree. You might have heard the saying that a man with one watch always knows what time it is, but a man with two watches is never quite sure. This implies that devices need to have a common point of reference for their time. Such a ref-erence point is made possible by Network Time Protocol (NTP), which allows routers to point to a device acting as an NTP server. Because devices in different time zones might reference the same NTP server, each device has its own time zone configuration, which indicates how many hours its time zone differs from Greenwich Mean Time (GMT). + +NTP uses a value, called a stratum value, to indicate the believability of a time source. Valid stratum values are in the range 0–15, with a value of 16 being used to indicate that a device does not have its time synchronized. However, Cisco IOS only permits you to set stratum values in the range 1–15. Lower stratum values are considered more authorita-tive than higher stratum values, with a stratum value of 0 being the most authoritative. + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 725 + +Stratum calculations work much like a hop count. For example, an Internet-based time source using a cesium clock might have a stratum value of a 0. If one of your routers learns time from this stratum 0 time source, your router will have a stratum level of 1. If other devices (for example, servers, switches, and other routers) in your network get their time from your stratum 1 router, they will each have a stratum level of 2. + + +Note NTP represents time as a 64-bit value, 32 bits for seconds and 32 bits for a frac-tional second. At the time of this writing, the current version of NTP is NTP version 4 (NTPv4), as defined in RFC 5905. NTPv4 is backward compatible with NTPv3. + + +From a security perspective, consider how an attacker might use NTP as part of an attack. She might introduce her own NTP device into a network and advertise false time to network devices. This could not only result in misleading timestamp information appearing in logs (which might be reviewed by a network engineer after an attack), but routers with time-based ACLs might also be convinced to permit traffic that should cur-rently be denied. + +To mitigate the risk of having a rogue NTP device advertise false time to your network routers, you can configure NTP authentication. This authentication should be configured on your router that is providing NTP information and on your routers receiving NTP information. + +The steps to configure an NTP server (that is, the router providing time, also known as an NTP master) and an NTP client (that is, the router receiving time) are as follows: + +NTP server configuration steps: +Key +Topic Step 1. Enter the ntp authentication-key key-id md5 key command to specify both +the secret key and a key ID, which can be used to reference the secret key. + +Step 2. Enter the ntp authenticate command to instruct the router to authenticate time sources. + +Step 3. Enter the ntp trusted-key key-id command to indicate which previously con-figured key should be trusted for NTP authentication. + +Step 4. (Optional) If the router is not receiving time from an external time source, enter the ntp master stratum-number command to tell a router to use its local clock as its time source and to specify the stratum level of the router. + +NTP client configuration steps: + +Step 1. Enter the ntp authentication-key key-id md5 key command to specify both the secret key and a key ID, which can be used to reference the secret key. + +Step 2. Enter the ntp authenticate command to instruct the router to authenticate time sources. + +Step 3. Enter the ntp trusted-key key-id command to indicate which previously con-figured key should be trusted for NTP authentication. + + + + +From the Library of Alexey Evseenko +726 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 4. Enter the ntp server ip-address-of-ntp-server key key-id command to tell the router to receive time from an NTP server at the specified IP address and to use the specified key ID for authentication. + +Example 16-12 shows a sample NTP authentication example for Routers R1 and R2 depicted in Figure 16-6. The configurations are identical with two exceptions. Only the NTP server has the ntp master stratum-number command, which says that the router is getting time from its local clock. If, however, Router R1 were getting time from a different NTP server, this command would not be required. The other difference in the configura-tions is the ntp server ip-address-of-ntp-server key key-id command on Router R2, which tells Router R2 to receive time from Router R1. + + +S1/0 172.16.0.1/30 +R1 +NTP Server with Stratum Value of 1 (Using Internal Clock as Time Source) + + +S1/0 172.16.0.2/30 +R2 +NTP Client with Stratum Value of 2 (Using R1 as Time Source) + + +Figure 16-6 NTP Server and NTP Client Sample Topology + +Example 16-12 NTP Authentication Configuration Key +Topic ROUTER R1 CONFIGURATION + +R1# conf term +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# ntp authentication-key 1 md5 $3cretKEY +R1(config)# ntp authenticate +R1(config)# ntp trusted-key 1 +R1(config)# ntp master 1 +ROUTER R2 CONFIGURATION + +R2# conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)# ntp authentication-key 1 md5 $3cretKEY +R2(config)# ntp authenticate +R2(config)# ntp trusted-key 1 +R2(config)# ntp server 172.16.0.1 key 1 + +A router’s current NTP status can be checked with the show ntp status and show ntp associations detail commands. Example 16-13 shows output from these commands issued on Routers R1 and R2 in Figure 16-6. + +Example 16-13 Verification of Current NTP Status + +ROUTER R1 + +R1# show ntp status + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 727 + +Clock is synchronized, stratum 1, reference is .LOCL. +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18 +ntp uptime is 333900 (1/100 of seconds), resolution is 4000 +reference time is D729D7CC.5CEC43FD (14:21:00.362 UTC Fri May 23 2014) +clock offset is 0.0000 msec, root delay is 0.00 msec +root dispersion is 0.44 msec, peer dispersion is 0.23 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000000000 s/s +system poll interval is 16, last update was 14 sec ago. + +R1# show ntp associations detail +127.127.1.1 configured, ipv4, our_master, sane, valid, stratum 0 +ref ID .LOCL., time D729D7DC.5CEBD803 (14:21:16.362 UTC Fri May 23 2014) +our mode active, peer mode passive, our poll intvl 16, peer poll intvl 16 +root delay 0.00 msec, root disp 0.00, reach 377, sync dist 1.00 +delay 0.00 msec, offset 0.0000 msec, dispersion 0.23, jitter 0.00 msec +precision 2**18, version 4 +assoc id 30001, assoc name 127.127.1.1 +assoc in packets 21, assoc out packets 21, assoc error packets 0 +org time D729D7DC.5CEBD803 (14:21:16.362 UTC Fri May 23 2014) +rec time 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900) +xmt time D729D7DC.5CEBA253 (14:21:16.362 UTC Fri May 23 2014) + +filtdelay = 0.00 0.00 0.00 +filtoffset = 0.00 0.00 0.00 +filterror = 0.00 0.24 0.48 + +0.00 0.00 0.00 0.00 0.00 +0.00 0.00 0.00 0.00 0.00 +0.72 0.96 1.20 1.44 1.68 + +minpoll = 4, maxpoll = 4 +ROUTER R2 + +R2# show ntp status +Clock is synchronized, stratum 2, reference is 172.16.0.1 +nominal freq is 250.0000 Hz, actual freq is 250.0006 Hz, precision is 2**18 +ntp uptime is 313800 (1/100 of seconds), resolution is 4000 +reference time is D729D70A.90E382F6 (14:17:46.565 UTC Fri May 23 2014) +clock offset is -34.9053 msec, root delay is 31.96 msec +root dispersion is 4035.10 msec, peer dispersion is 1.40 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is -0.000002539 s/s +system poll interval is 128, last update was 243 sec ago. +R2# show ntp associations detail +172.16.0.1 configured, ipv4, authenticated, our_master, sane, valid, stratum 1 +ref ID .LOCL., time D729D78C.5CEB7981 (14:19:56.362 UTC Fri May 23 2014) +our mode client, peer mode server, our poll intvl 128, peer poll intvl 128 +root delay 0.00 msec, root disp 0.24, reach 3, sync dist 30.29 +delay 23.91 msec, offset -34.9053 msec, dispersion 1.40, jitter 14.95 msec +precision 2**18, version 4 +assoc id 54223, assoc name 172.16.0.1 +assoc in packets 8, assoc out packets 8, assoc error packets 0 +org time 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900) + + + + +From the Library of Alexey Evseenko +728 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +rec time D729D78D.85E1EDAD (14:19:57.522 UTC Fri May 23 2014) +xmt time D729D78D.85E1EDAD (14:19:57.522 UTC Fri May 23 2014) +filtdelay = 23.93 40.04 36.09 40.09 23.91 28.08 31.96 63.89 +filtoffset = -20.95 -12.96 -16.83 -18.82 -34.90 -24.91 -26.99 -22.98 +filterror = 0.00 0.03 1.85 1.88 1.91 1.94 1.97 2.00 +minpoll = 6, maxpoll = 10 + +In Example 16-13, notice that Router R1 is synchronized with itself. This is evidenced by the .LOCL reference in the output of the show ntp status command and the 127.127.1.1 IP address in the output of the show ntp associations detail command. The 127.127.1.1 IP address is a well-known IP address used to communicate with a local NTP source. + +Similarly, you can see that Router R2 is synchronized with Router R1’s IP address and has a stratum level of 2. Also, Router R2 is configured to receive time from 172.16.0.1 (Router R1’s IP address), which is shown to have a stratum value of 1. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 729 + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 16-7 lists several design goals related to this chapter. If these design goals were list-ed in a design document, and you had to take that document and develop an implemen-tation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 16-7 Design Review + + +Design Goal + +The design requires a documented router security policy. (List five or more security topics commonly addressed in a router security policy.) (11) +The design requires that an accounting server (located in a data center subnet) only be accessible during business hours. +The design requires that router management traffic be encrypted. +The design requires that a router’s line passwords be encrypted, so that someone catching a glimpse of the router’s running configuration would not be able to read any of the passwords. + +Possible Implementation Choices Covered in This Chapter + + + + + + + + + + + +From the Library of Alexey Evseenko +730 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Design Goal Possible Implementation Choices Covered in This Chapter +The design requires that a router’s Internet-facing interface check the source IP address of an incoming packet and only permit +that packet if a route back to the packet’s IP source address is found in the router’s FIB and if the FIB indicates that the egress +interface to get back to that source IP address is the same interface on which the packet arrived. +The design requires that router authentication requests be handled by an external server. However, if that external server is not available, router authentication requests should be handled by the router’s local user database. +You want to prevent an attacker from influencing a router’s time, in an effort to pass traffic through a time-based ACL. + + + +Implementation Plan Peer Review Table + +Table 16-8 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + +Table 16-8 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +The plan is using a time-based ACL to protect specific servers. What types of time-based ACLs can be configured in Cisco IOS? (2) +The plan calls for the use of SSH as opposed to Telnet. What two configurable router parameters are used in the generation of the RSA key pair used by SSH? +The plan shows a variety of password types to be used, including Type 0, Type 4, Type 5, and Type 7. What is the difference in these password types? + + + + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 731 + + +Question Answer +The plan calls for the configuration of uRPF. What are uRPF’s three modes of operation? +The plan calls for the use of AAA with an external server running an open standard protocol. What AAA protocol should you choose? +Even though you know that SNMPv3 is more secure than SNMPv2c, the plan requires +the use of SNMPv2c on your routers. What can you do to better secure this network management protocol? (2) +The plan calls for one enterprise router to receive time from an Internet-based cesium clock. That router will then provide time to all other routers inside the enterprise. Will that router need to have the ntp master command configured? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 16-9 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 16-9 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +Create a named time range for an ACL (in global configuration mode). +Define a periodic time range (in time range configuration mode). +Define an absolute time range (in time range configuration mode). +Apply a time range to a numbered ACL (in global configuration mode). +Apply a time range to a named ACL (in named access list configuration mode). +Specify a router’s host name. + +Specify a router’s domain name. + + + + + +From the Library of Alexey Evseenko +732 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Feature Configuration Commands/Notes +Create a user with a privilege level of 15 and a hashed password. +Generate an RSA key pair. + +In VTY line configuration mode, only permit SSH connections. +In VTY configuration mode, instruct SSH to use a router’s local user database for authentication. +Enable the password encryption service to encrypt line passwords. +Enable uRPF in interface configuration mode. +Enable AAA services on a router. + +Create a AAA method list named TEST that attempts to use a TACACS+ server for authentication, but will fall back to a local user database if the TACACS+ server is unavailable. +Configure the read-only or read-write community string on a router, and specify an ACL that defines trusted IP addresses. +Specify an NTP authentication key, along with a key ID. +Instruct a router to authenticate time sources. + +Specify a trusted NTP key ID. + +Instruct a router to provide time to other NTP-speaking devices, using its internal clock as the time source, and specify the router’s stratum value. +Specify the IP address of an NTP server from which a router should receive time, along with the key ID that should be used to authenticate with that NTP server. + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table 16-10 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + + +From the Library of Alexey Evseenko +Chapter 16: Fundamental Router Security Concepts 733 + +Table 16-10 Verification Plan Memory Drill + +Information Needed Command(s) +Display the contents of a router’s FIB. + +Determine whether an interface has uRPF enabled. +Display a router’s NTP stratum value. + +Display the stratum value of a router’s NTP reference. + + + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 16-11 lists a reference of these key topics and the +page numbers on which each is found. + + +Key Table 16-11 Key Topics for Chapter 16 +Topic Key Topic Element Description Page Number + + +List + +Table 16-2 + +Example 16-1 + +Example 16-2 + +List + +List + +Example 16-3 + +Example 16-5 + +Table 16-3 + +Example 16-7 + +Example 16-10 + +Table 16-4 + +Table 16-5 + +Table 16-6 + +Topics commonly addressed in a router security 704 policy +Time-Based ACL Commands 706 + +Time-Based ACL Configuration Example 707 + +Sample Infrastructure ACL 708 + +A router’s architectural planes of operation 709 + +Steps to configure SSH on a router 709 + +Enabling SSH for VTY Access 710 + +Line Password Configuration and Verification 713 + +uRPF Configuration Parameters 715 + +uRPF Sample Configuration 717 + +AAA Configuration for Authenticating Remote 720 Logins +Contrasting the TACACS+ and RADIUS Protocols 721 + +Components of an SNMPv1 and SNMPv2c Network 722 Management Solution +Security Models and Security Levels Supported by 724 Cisco IOS + + + + + + +From the Library of Alexey Evseenko +734 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Key Topic Element Description Page Number + +List + +Example 16-12 + +Steps to configure an NTP server and an NTP client 725 + +NTP Authentication Configuration 726 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +router security policy, time-based ACL, infrastructure ACL, NTP, uRPF, AAA, SNMP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + +This chapter covers the following subjects: + +■ Authentication Methods: This section contrasts different approaches to routing protocol authentica-tion, including simple password authentication and hashing authentication. Routing protocol authentica-tion can be used to prevent a malicious user from forming a neighborship between his router and a production router. +■ EIGRP Authentication: This section examines the operation and configuration of EIGRP authentica-tion, including EIGRP for IPv4, EIGRP for IPv6, and Named EIGRP. +■ OSPF Authentication: Similar to the concepts presented in the preceding “EIGRP Authentication” section, this section demonstrates how to authenti-cate OSPF neighbor relationships, using a variety of approaches. +■ BGP Authentication: This section explains the threat of session hijacking in a BGP environment and demonstrates how to configure authentication between BGP peers. + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 17 + + + + + + +Routing Protocol Authentication + + +Protocols such as Enhanced Interior Gateway Routing Protocol (EIGRP) and Open Shortest Path First (OPSF), using multicasts, can dynamically form neighborships with adjacent routers. The ease with which neighborships can be formed is a concern from a security perspective. + +For example, consider a malicious user that introduces his router into a network. If that router successfully forms one or more neighborships, that rogue router could inject false routing information into a corporate network, perhaps causing corporate data traffic to flow through the rogue router, thus allowing the malicious user to capture that traffic. To help mitigate such a situation, this short chapter begins with a comparison of authentica-tion methods followed by a discussion of the operation and configuration of EIGRP and OSPF authentication. + +Unlike the dynamic neighbor formation of EIGRP and OSPF, Border Gateway Protocol (BGP) requires neighbors to be statically configured. Therefore, the previous scenario of injecting a rogue router with the intent of manipulating routing tables is less likely with BGP. However, session hijacking can still occur, where a router takes over an existing TCP session between two routers that have already formed a BGP neighborship. Therefore, this chapter concludes with examples of BGP authentication, including IPv4 and IPv6 environments. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter. If you miss no more than one of these eight self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section. Table 17-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions cover-ing the material in those headings so that you can assess your knowledge of these specific areas. The answers to the “Do I Know This Already?” quiz appear in Appendix A. + +Table 17-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Authentication Methods + +EIGRP Authentication + +OSPF Authentication + +BGP Authentication + +Questions +1, 2 + +3, 4 + +5, 6 + +7, 8 + + + + + +From the Library of Alexey Evseenko +738 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +1. Identify possible approaches that Cisco IOS uses to authenticate neighboring rout-ers. (Choose two.) + +a. Plain text authentication + +b. Two-factor authentication + +c. Hashing authentication + +d. Biometric authentication + +2. Two neighboring routers are each configured with a key chain. What element(s) of the key chain must match for the two routers to mutually authenticate? (Choose all that apply.) +a. Key chain name + +b. Key number + +c. Key string + +d. Accept-lifetime + +e. Send-lifetime + +3. What types of neighbor authentication does Named EIGRP support? (Choose all that apply.) + +a. Plain text authentication + +b. MD5 hashing authentication + +c. SHA hashing authentication + +d. PAP authentication + +4. What command can be used to view the configuration of a key chain used by EIGRP? + +a. show key chain + +b. show key-chain + +c. show authentication key chain + +d. show eigrp key chain + +5. Routers R1 and R2 are both running OSPFv2, and they are currently authenticated with one another, using MD5, over their Fa 0/0 interfaces. Interface Fa 0/0 on Router R1 is participating in area 0. However, you notice that the OSPF router configuration on Router R1 does not contain the area 0 authentication message-digest command. What command must have been configured under Router R1’s Fa 0/0 interface? +a. area 0 authentication md5 + +b. ip ospf authentication message-digest + +c. ip ospf authentication 0 md5 + +d. area 1 authentication message-digest + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 739 + +6. Identify the valid types of OSPFv3 authentication supported in Cisco IOS. (Choose all that apply.) + +a. SHA + +b. MD5 + +c. PAP + +d. Clear text + +7. BGP can use what type of authentication? + +a. SHA + +b. Clear text + +c. MD5 + +d. DH Group 1 + +8. Because BGP neighborships require neighbors to be statically configured, what is the most likely approach that an attacker would take to inject a rogue router into a net-work and have that rogue router form a BGP neighborship with a production router? +a. Man-in-the-middle attack + +b. Denial of service (DoS) attack + +c. Session hijacking + +d. Distributed DoS (DDoS) attack + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +740 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Foundation Topics + + +Authentication Methods + +Cisco routers support a couple of different approaches to authenticating route advertise-ments received from a neighboring router: + +■ Plain text authentication + +■ Hashing authentication + +Both of these approaches require routers to have matching passwords (also referred to as keys); however, Cisco recommends the use of hashing authentication. + +Plain text authentication, as the name suggests, simply sends a password from one router to another in clear text. This leads to the security concern of having a malicious user cap-ture authentication traffic containing a password and then injecting her own router, which could use the compromised password to authenticate with one of the network’s produc-tion routers. + +Hashing authentication is preferred over plain text authentication, because it never sends the password over the network. Instead, a mathematical algorithm is run on the password, and the result of that algorithm (called a hash digest) is sent from one router to its neigh-bor. That neighboring router also runs the hashing algorithm on its configured password, and if its hash digest matches the hash digest it receives from the first router, it can con-clude that the passwords match. + +The two hashing algorithms that you can select from (depending on the routing protocol) include Message Digest 5 (MD5) and Secure Hash Algorithm (SHA). SHA is generally considered to be somewhat more secure than MD5; however, either algorithm is vastly superior to using plain text authentication. + +Plain Text Authentication + +The plain text authentication process follows a procedure that can generally be summa-rized as follows: +Step 1. A routing update is sent from one router to another. That routing update includes a key (that is, a password) and a key number, because some routing protocols support the configuration of multiple keys. Note that if a routing protocol does not support multiple keys, the key number associated with a routing update is 0. +Step 2. A neighboring router receives the routing update. That router determines whether the received key matches its configured key (with a matching key number). +Step 3. If the neighboring router determines that the keys match, it accepts the rout-ing update. However, the routing update is rejected if the keys do not match. + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 741 + +The only routing protocols supported in Cisco IOS that you can configure with plain text authentication are + +■ Routing Information Protocol version 2 (RIPv2) + +■ Open Shortest Path First version 2 (OSPFv2) + +■ Intermediate System–to–Intermediate System (IS-IS) + + +Hashing Authentication + +The basic operation of hashing authentication bears some similarity to plain text authen-tication. Notably different, however, is how hashing authentication never transmits a key across a network, instead sending the hash digest (that is, the result of running a hashing algorithm on a router’s configured password). + +The hashing authentication process follows a procedure that can generally be summarized as follows: + +Key Step 1. Topic + +Step 2. + + + +Step 3. + + +A hashing algorithm is run on a routing update along with a router’s config-ured key. The result of the hashing algorithm (that is, the hash digest) is added to the end of the routing update, which is then sent to a neighboring router. + +The neighboring router receives the update and runs a hashing algorithm on the routing update combined with its locally configured key, which results in a hash digest. + +If the locally configured hash digest matches the received hash digest, the receiving router accepts the packet. If the independently calculated hash +digest values do not match, the update is rejected. + + +Hashing authentication using MD5 can be configured for the following protocols within Cisco IOS: + +■ RIPv2 + +■ EIGRP + +■ OSPFv2 + +■ OSPFv3 + +■ IS-IS + +■ BGP + +SHA authentication is supported by the following protocols: + +■ RIP next generation (RIPng) + +■ Named EIGRP + +■ OSPFv2 (see note) + + + + + +From the Library of Alexey Evseenko +742 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +■ OSPFv3 + +■ IS-IS (see note) + + +Note While RFC 5709 states that OSPFv2 can support SHA authentication, this feature is not widely deployed in Cisco IOS. Therefore, depending on your version of Cisco IOS, you might not have the option of configuring SHA authentication for OSPFv2. The same holds true for IS-IS (as described in RFC 5310). +Also note that RIPng and OSPFv3, used for routing in IPv6 networks, do not have any native authentication features. Instead, they rely on IPsec to handle their authentication. + + +Key Chains + +Having two routers each configured with an identical key (called a shared secret key) is a basic requirement for routing protocol authentication. However, if that shared secret key were learned, that might permit a malicious user to introduce a rogue router into a network and have that router form one or more neighborships with existing routers. The probability that a shared secret key will be learned increases with time. Therefore, Cisco recommends that you frequently change your keys. + +Fortunately, you can configure time-based key chains. A key chain is a collection of keys, each identified with a key ID, that is associated with an interface. A time-based key chain not only includes a collection of keys and key IDs, but it also includes key life-times. These lifetimes dictate the periods of time when a router will send a specific key and when a router will accept a specific key. The period of time during which a router will accept a specific key is called the accept lifetime, while the period of time during which a router will send a specific key is called the send lifetime. + + +Note To make sure that there is never a period of time when no key is active, you should configure your key lifetimes to overlap. If a router sends an update at a time when multiple keys are active, the router uses the key with the lowest key ID. + + +To better understand the concept and configuration of time-based key chains, consider Example 17-1. This example shows the configuration for the two routers pictured in Figure 17-1. + + + +R1 +172.16.1.0/24 +Fa0/0 .1 + +10.1.1.0/30 +S1/0 .1 + + +S1/0 R2 +192.168.1.0/24 +.2 Fa0/0 .1 + + + + +Figure 17-1 Two Routers Configured with Time-Based Key Chains + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 743 + +Example 17-1 Time-Based Key Chain Configuration Key +Topic !Configuration on Router R1 +R1# conf term +R1(config)# key chain R1KEYCHAIN +R1(config-keychain)# key 1 +R1(config-keychain-key)# key-string PRIMARY_KEY +R1(config-keychain-key)# accept-lifetime 01:00:00 April 1 2014 01:00:00 May 2 2014 +R1(config-keychain-key)# send-lifetime 01:00:00 April 1 2014 01:00:00 May 2 2014 +R1(config-keychain-key)# exit +R1(config-keychain)# key 2 +R1(config-keychain-key)# key-string SECONDARY_KEY +R1(config-keychain-key)# accept-lifetime 01:00:00 May 1 2014 infinite +R1(config-keychain-key)# send-lifetime 01:00:00 May 1 2014 infinite +R1(config-keychain-key)# end +R1# + +!Configuration on Router R2 +R2# conf term +R2(config)# key chain R2KEYCHAIN +R2(config-keychain)# key 1 +R2(config-keychain-key)# key-string PRIMARY_KEY +R2(config-keychain-key)# accept-lifetime 01:00:00 April 1 2014 01:00:00 May 2 2014 +R2(config-keychain-key)# send-lifetime 01:00:00 April 1 2014 01:00:00 May 2 2014 +R2(config-keychain-key)# exit +R2(config-keychain)# key 2 +R2(config-keychain-key)# key-string SECONDARY_KEY +R2(config-keychain-key)# accept-lifetime 01:00:00 May 1 2014 infinite +R2(config-keychain-key)# send-lifetime 01:00:00 May 1 2014 infinite +R2(config-keychain-key)# end +R2# + +In Example 17-1, a key chain with a name of R1KEYCHAIN is created on Router R1. This key chain is then configured with two keys, key 1 and key 2. The value of the first key was set to PRIMARY_KEY, and the value of the second key was set to SECONDARY_ KEY. + +The configuration also specifies that the first key is valid, for both sending and receiv-ing, for a time period beginning at 1:00 a.m. on April 1, 2014, and ending at 1:00 a.m. on May 2, 2014. The second key becomes valid, for both sending and receiving, at 1:00 a.m. on May 1, 2014, but the infinite keyword in the accept-lifetime and send-lifetime com-mands means that when the second key becomes valid, it will stay valid indefinitely. + +A nearly identical key chain configuration is then created for Router R2, with the only difference being the name of the key chain. On R2, the key chain name is R2KEYCHAIN. + + + + + + +From the Library of Alexey Evseenko +744 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +In the example, key 1 stays valid for one day after key 2 becomes valid. Using overlap-ping time periods for key lifetimes helps ensure that there will not be a period of time when no key is valid. + + +Note This key chain configuration will be used in the next section of this chapter. + + + +EIGRP Authentication + +EIGRP authentication causes routers to authenticate every EIGRP message. To do so, the routers should use the same preshared key (PSK) and generate an MD5 digest for each EIGRP message based on that PSK. If a router configured for EIGRP authentication receives an EIGRP message, and the message’s MD5 digest does not pass the authentica- +tion checking based on the local copy of the key, the router silently discards the message. As a result, when authentication fails, two routers cannot become EIGRP neighbors, because they ignore each other’s EIGRP Hello messages. + +From a design perspective, EIGRP authentication helps prevent denial of service (DoS) attacks, but it does not provide any privacy. The device that physically receives the bits can read the EIGRP messages. Note that on LANs, the updates flow to the 224.0.0.10 multicast IP address, so any attacker could join the 224.0.0.10 multicast group and read the packets. However, authentication prevents attackers from forming neighborships with legitimate routers, thus preventing the advertisement of incorrect routing information. + +This section examines EIGRP authentication configuration generically, followed by exam-ples of authentication configurations for EIGRP for IPv4, EIGRP for IPv6, and Named EIGRP. + +EIGRP for IPv4 Authentication + +The EIGRP for IPv4 authentication configuration process requires a few steps, which are summarized as follows: + +Key Step 1. Topic +Step 2. + + + +Step 3. + + +Create a key chain. (This procedure was discussed in the earlier section “Authentication Methods.”) + +Enable EIGRP MD5 authentication on an interface, for a particular EIGRP autonomous system number (ASN), using the ip authentication mode eigrp asn md5 interface subcommand. + +Refer to the correct key chain to be used on an interface using the ip authen- +tication key-chain eigrp asn name-of-chain interface subcommand. + + +The configuration in Step 1 is fairly detailed, but Steps 2 and 3 are relatively simple. Essentially, Cisco IOS configures the key values separately (Step 1) and then requires an interface subcommand to refer to those key values. To support the capability to have multiple keys, and even multiple sets of keys, the configuration includes the concept of a key chain and multiple keys on each key chain. + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 745 + +To illustrate this configuration further, consider Example 17-2, which shows the configu-ration of the routers in Figure 17-2. + + + + + +R1 +172.16.1.0/24 +Fa0/0 .1 + +10.1.1.0/30 +S1/0 .1 + + +S1/0 R2 +192.168.1.0/24 +.2 Fa0/0 .1 + + +EIGRP AS 1 + + + + +Figure 17-2 Two Routers Configured with EIGRP for IPv4 Authentication + +Example 17-2 EIGRP for IPv4 Authentication Configuration +Key +Topic !Configuration on Router R1 +key chain R1KEYCHAIN +key 1 +key-string PRIMARY_KEY +accept-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +send-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +key 2 +key-string SECONDARY_KEY +accept-lifetime 01:00:00 May 1 2014 infinite +send-lifetime 01:00:00 May 1 2014 infinite +! +interface Serial1/0 +ip address 10.1.1.1 255.255.255.252 +ip authentication mode eigrp 1 md5 +ip authentication key-chain eigrp 1 R1KEYCHAIN +! +router eigrp 1 +network 0.0.0.0 + + +!Configuration on Router R2 +key chain R2KEYCHAIN +key 1 +key-string PRIMARY_KEY +accept-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +send-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +key 2 + + + + +From the Library of Alexey Evseenko +746 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +key-string SECONDARY_KEY +accept-lifetime 01:00:00 May 1 2014 infinite +send-lifetime 01:00:00 May 1 2014 infinite +! +interface Serial1/0 +ip address 10.1.1.2 255.255.255.252 +ip authentication mode eigrp 1 md5 +ip authentication key-chain eigrp 1 R2KEYCHAIN +! +router eigrp 1 +network 0.0.0.0 + +Example 17-2 builds on the key chain configuration shown in Example 17-1. Specifically, Router R1 has a key chain named R1KEYCHAIN, and Router R2 has a key chain named R2KEYCHAIN. In interface configuration mode for each of the routers, the ip authen-tication mode eigrp asn md5 command was issued for EIGRP autonomous system 1 . Then, the ip authentication key-chain eigrp asn name-of-chain command was issued in interface configuration mode to specify which key chain the interface would use for its MD5 authentication. + +The show key chain command can be used to view the details of any configured key chains. Also, you can issue the show ip eigrp neighbors command to confirm that expected EIGRP neighborships have been formed. Example 17-3 shows sample output from Router R1 and confirms that key 1 is currently valid. + +Example 17-3 Verifying EIGRP for IPv4 Authentication + +R1# show key chain +Key-chain R1KEYCHAIN: +key 1 -- text "PRIMARY_KEY" +accept lifetime (01:00:00 UTC Apr 1 2014) - (01:00:00 UTC May 2 2014) [valid +now] +send lifetime (01:00:00 UTC Apr 1 2014) - (01:00:00 UTC May 2 2014) [valid +now] +key 2 -- text "SECONDARY_KEY" +accept lifetime (01:00:00 UTC May 1 2014) - (infinite) +send lifetime (01:00:00 UTC May 1 2014) - (infinite) +R1# show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(1) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.1.1.2 Se1/0 12 01:01:05 79 474 0 7 + + +EIGRP for IPv6 Authentication + +Configuring authentication for EIGRP for IPv6 is nearly identical to configuring authen-tication for EIGRP for IPv4. The only difference is the ip authentication mode eigrp + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 747 + +asn md5 and ip authentication key-chain eigrp asn name-of-chain commands have ip replaced with ipv6. These steps can be summarized as follows: + +Step 1. +Key Topic +Step 2. + + + +Step 3. + + +Create a key chain. (This procedure was discussed in the earlier section “Authentication Methods.”) + +Enable EIGRP MD5 authentication on an interface, for a particular EIGRP ASN, using the ipv6 authentication mode eigrp asn md5 interface subcommand. + +Refer to the correct key chain to be used on an interface using the ipv6 +authentication key-chain eigrp asn name-of-chain interface subcommand. + + +Consider Example 17-4 , based on the topology in Figure 17-3. Note how the configura-tion closely mirrors Example 17-2, which showed how to configure authentication for EIGRP for IPv4. + + + + + +R1 +Fa0/0 +2001::1/64 + +S1/0 2002::1/64 + + +S1/0 R2 2002::2/64 Fa0/0 +2003::1/64 + + + +EIGRP AS 100 + + + + +Figure 17-3 Two Routers Configured with EIGRP for IPv6 Authentication + +Example 17-4 EIGRP for IPv6 Authentication Configuration Key +Topic !Configuration on Router R1 +key chain R1KEYCHAIN +key 1 +key-string PRIMARY_KEY +accept-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +send-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +key 2 +key-string SECONDARY_KEY +accept-lifetime 01:00:00 May 1 2014 infinite +send-lifetime 01:00:00 May 1 2014 infinite +! +interface Serial1/0 +ipv6 address 2002::1/64 +ipv6 eigrp 100 +ipv6 authentication mode eigrp 100 md5 + + + + +From the Library of Alexey Evseenko +748 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +ipv6 authentication key-chain eigrp 100 R1KEYCHAIN +! +ipv6 router eigrp 100 +eigrp router-id 1.1.1.1 + +!Configuration on Router R2 +key chain R2KEYCHAIN +key 1 +key-string PRIMARY_KEY +accept-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +send-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +key 2 +key-string SECONDARY_KEY +accept-lifetime 01:00:00 May 1 2014 infinite +send-lifetime 01:00:00 May 1 2014 infinite +! +interface Serial1/0 +ipv6 address 2002::2/64 +ipv6 eigrp 100 +ipv6 authentication mode eigrp 100 md5 +ipv6 authentication key-chain eigrp 100 R2KEYCHAIN +! +ipv6 router eigrp 100 +eigrp router-id 2.2.2.2 + +In Example 17-4, the previously configured key chains were used to configure authen-tication for EIGRP for IPv6. The ipv6 authentication mode eigrp asn md5 and ipv6 authentication key-chain eigrp asn name-of-chain commands were issued in interface configuration mode, to make the interface authenticate any received EIGRP messages using the specified key chain for EIGRP autonomous system 100. + +Example 17-5 shows how to verify your configuration. The show key chain command displays the details of the key chain, while the show ipv6 eigrp neighbors command con-firms that a neighborship has formed. + +Example 17-5 Verifying EIGRP for IPv6 Authentication + +R1# show key chain +Key-chain R1KEYCHAIN : +key 1 -- text "PRIMARY_KEY" +accept lifetime (01:00:00 UTC Apr 1 2014) - (01:00:00 UTC May 2 2014) [valid +now] +send lifetime (01:00:00 UTC Apr 1 2014) - (01:00:00 UTC May 2 2014) [valid +now] +key 2 -- text "SECONDARY_KEY" +accept lifetime (01:00:00 UTC May 1 2014) - (infinite) +send lifetime (01:00:00 UTC May 1 2014) - (infinite) + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 749 + +R1# show ipv6 eigrp neighbors +EIGRP-IPv6 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 Link-local address: Se1/0 11 00:35:12 38 228 0 3 +FE80::C801:17FF:FE94:0 + + +Named EIGRP Authentication + +The configuration of Named EIGRP authentication is very similar to the authentication configuration of EIGRP for IPv4. After configuring a key chain, you enter the authenti-cation mode {md5 | hmac-sha-256} command in address family interface configuration mode. Finally, still in address family interface configuration mode, you enter the authenti-cation key-chain name-of-chain command. Following are the steps: + +Step 1. Key +Topic Step 2. + + +Step 3. + + +Create a key chain. + +Enable authentication for Named EIGRP in address family interface configu-ration mode, using the command authentication mode { md5 | hmac-sha-256}. + +Refer to the correct key chain to be used, while still in address family inter-face configuration mode, with the command authentication key-chain name- +of-chain. + + +Example 17-6 demonstrates the configuration of Named EIGRP authentication for the topology shown in Figure 17-4. + + + + + +R1 +172.16.1.0/24 +Fa0/0 .1 + +10.1.1.0/30 +S1/0 .1 + + +S1/0 R2 +192.168.1.0/24 +.2 Fa0/0 .1 + + +EIGRP AS 2 + + + + +Figure 17-4 Two Routers Configured with EIGRP for IPv6 Authentication + +Example 17-6 Named EIGRP Authentication Configuration +Key +Topic !Configuration on Router R1 +key chain R1KEYCHAIN +key 1 +key-string PRIMARY_KEY +accept-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 + + + + +From the Library of Alexey Evseenko +750 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +send-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +key 2 +key-string SECONDARY_KEY +accept-lifetime 01:00:00 May 1 2014 infinite +send-lifetime 01:00:00 May 1 2014 infinite +! +interface FastEthernet0/0 +ip address 172.16.1.1 255.255.255.0 +! +interface Serial1/0 +ip address 10.1.1.1 255.255.255.252 +! +router eigrp AUTH_DEMO +! +address-family ipv4 unicast autonomous-system 2 +! +af-interface Serial1/0 +authentication mode md5 +authentication key-chain R1KEYCHAIN +exit-af-interface +! +topology base +exit-af-topology +network 0.0.0.0 +exit-address-family + +!Configuration on Router R2 +key chain R2KEYCHAIN +key 1 +key-string PRIMARY_KEY +accept-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +send-lifetime 01:00:00 Apr 1 2014 01:00:00 May 2 2014 +key 2 +key-string SECONDARY_KEY +accept-lifetime 01:00:00 May 1 2014 infinite +send-lifetime 01:00:00 May 1 2014 infinite +! +interface FastEthernet0/0 +ip address 192.168.1.1 255.255.255.0 +! +interface Serial1/0 +ip address 10.1.1.2 255.255.255.252 +! +router eigrp AUTH_DEMO +! +address-family ipv4 unicast autonomous-system 2 + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 751 + +! +af-interface Serial1/0 +authentication mode md5 +authentication key-chain R2KEYCHAIN +exit-af-interface +! +topology base +exit-af-topology +network 0.0.0.0 +exit-address-family + +Verification can be performed with the same show key chain and show ip eigrp neigh-bors command used for verifying a classic EIGRP for IPv4 configuration. Note that the authentication mode specified in Example 17-6 is md5. However, hmac-sha-256 is anoth-er supported authentication mode. + +OSPF Authentication + +OSPF authentication causes routers to authenticate every OSPF message. To do so, the routers use the same preshared key value. This key might be in plain text, or it might be a hash digest from either the MD5 hashing algorithms (although SHA might also be sup-ported depending on the type and version of Cisco IOS you are running). Table 17-2 lists the authentication types supported by OSPF. + + +Table 17-2 OSPF Authentication Types Key +Topic OSPF Authentication Type + +Type 0 + +Type 1 + +Type 2 + + + +Description +Does not provide any authentication + +Provides plain text authentication + +Provides hashing authentication + + + +On a router, OSPF authentication can be enabled on individual interfaces or an entire area. This section begins by examining plain text and hashing authentication for OSPFv2. Then, the section concludes with a look at hashing authentication for OSPFv3. Interestingly, OSPFv3 relies on the authentication features provided by IPsec, rather than any authentication function natively built into OSPFv3. + +Plain Text OSPFv2 Authentication + +Plain text authentication (also known as clear text authentication or simple password authentication) for OSPFv2 requires neighboring OSPF routers to be preconfigured with the same authentication key (that is, a shared secret password). The steps to configure plain text OSPFv2 authentication are as follows: + + + + + +From the Library of Alexey Evseenko +752 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Step 1. +Key Topic + + +Plain text authentication must be enabled for either an interface or an OSPF +area: + +■ Enable per interface using the ip ospf authentication interface subcommand. + +■ Enable on all interfaces in an area by changing the area-wide authentica-tion setting using the area area-number authentication subcommand under OSPF router configuration mode. +Step 2. The authentication keys must be configured per interface, using the ip ospf authentication-key name-of-key interface subcommand. + + +Note OSPFv3 does not support the plain text authentication supported by OSPFv2. + + +Example 17-7 illustrates the configuration of OSPFv2 plain text authentication for the topology shown in Figure 17-5. + + + + + +R1 +172.16.1.0/24 +Fa0/0 .1 + +10.1.1.0/30 +S1/0 .1 + + +S1/0 R2 +192.168.1.0/24 +.2 Fa0/0 .1 + + +Area 0 + + + + +Figure 17-5 Two Routers Configured with OSPFv2 Plain Text Authentication + +Example 17-7 OSPFv2 Plain Text Authentication Configuration Key +Topic !Configuration on Router R1 +interface Serial1/0 +ip address 10.1.1.1 255.255.255.252 +ip ospf authentication-key KEYLIME +! +router ospf 1 +area 0 authentication +network 0.0.0.0 255.255.255.255 area 0 + +!Configuration on Router R2 +interface Serial1/0 +ip address 10.1.1.2 255.255.255.252 + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 753 + +ip ospf authentication +ip ospf authentication-key KEYLIME +! +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + + +Note The maximum length of the authentication key is eight characters. If you enter a longer key, it will automatically be truncated to eight characters. + + +Example 17-7 shows two approaches for configuring plain text authentication for OSPF. The ip ospf authentication-key key-string command is issued in interface configura-tion mode on both Routers R1 and R2. However, Router R1 uses the area area_number authentication command in router configuration mode to enable authentication for all its interfaces participating in area 0, while Router R2 uses the ip ospf authentication com- +mand in interface configuration mode to enable authentication for an individual interface. These two approaches are compatible with one another, and a neighborship successfully forms. + +The show ip ospf interface interface_identifier command can be used to confirm that plain text authentication (referred to as simple password authentication in Cisco IOS command output) is enabled on an interface. Of course, you could also use the show ip ospf neighbor command to confirm that a neighborship exists between two routers. Example 17-8 offers sample output from these commands issued on Router R1. + +Example 17-8 Verifying OSPFv2 Plain Text Authentication + +R1# show ip ospf interface s 1/0 +Serial1/0 is up, line protocol is up +Internet Address 10.1.1.1/30, Area 0, Attached via Network Statement +Process ID 1, Router ID 172.16.1.1, Network Type POINT_TO_POINT, Cost: 64 + +Topology-MTID Cost +0 64 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State POINT_TO_POINT +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:00 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 2/2, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 1 +Last flood scan time is 4 msec, maximum is 4 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 192.168.1.1 + + + + +From the Library of Alexey Evseenko +754 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Suppress hello for 0 neighbor(s) +Simple password authentication enabled +R1# show ip ospf neighbor + + +Neighbor ID +192.168.1.1 + +Pri State +0 FULL/ - + +Dead Time +00:00:32 + +Address +10.1.1.2 + +Interface +Serial1/0 + + + +OSPFv2 MD5 Authentication + +Unlike EIGRP for IPv4 MD5 authentication, OSPFv2 MD5 authentication does not allow the configuration of a key chain with time-based authentication keys. However, multiple keys can be configured on an interface, each with a different key number, called a key ID. To migrate to a new key, you would first configure a new key value on all routers in a subnet and then delete the configuration of the old keys. To avoid having network failures during this cutover, OSPF actually sends and accepts messages that use all the currently configured authentication keys on an interface. + +Unlike OSPFv2 plain text authentication (which has a maximum key length of eight characters), OSPFv2 MD5 authentication allows a key length of 16 characters. This key, along with the key ID, is used to calculate the MD5 hash for each OSPF packet. As with OSPFv2 plain text authentication, you can enable OSPFv2 MD5 authentication on a per-interface basis or on an area-wide basis (which applies to all router interfaces belonging to the specific area). Also, you could (but are not required to) have a separate key string for each interface. The configuration steps can be summarized as follows: + +Step 1. Key +Topic + + +Plain text authentication must be enabled for either an interface or an OSPF +area: + +■ Enable per interface using the ip ospf authentication message-digest interface subcommand. + +■ Enable on all interfaces in an area by changing the area-wide authentica-tion setting using the area area-number authentication message-digest subcommand under OSPF router configuration mode. +Step 2. The authentication keys must be configured per interface, using the ip ospf message-digest-key key-id md5 name-of-key interface subcommand. + +Example 17-9 illustrates the configuration of OSPFv2 MD5 authentication between Routers R1 and R2 pictured in Figure 17-6. + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 755 + + + + + +R1 +172.16.1.0/24 +Fa0/0 .1 + +10.1.1.0/30 +S1/0 .1 + + +S1/0 R2 +192.168.1.0/24 +.2 Fa0/0 .1 + + +Area 0 + + + + +Figure 17-6 Two Routers Configured with OSPFv2 MD5 Authentication + +Example 17-9 OSPFv2 MD5 Authentication Configuration Key +Topic !Configuration on Router R1 +interface Serial1/0 +ip address 10.1.1.1 255.255.255.252 +ip ospf message-digest-key 1 md5 KEYLIME +! +router ospf 1 +area 0 authentication message-digest +network 0.0.0.0 255.255.255.255 area 0 +! + +!Configuration on Router R2 +interface Serial1/0 +ip address 10.1.1.2 255.255.255.252 +ip ospf authentication message-digest +ip ospf message-digest-key 1 md5 KEYLIME +! +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + +In Example 17-9, both Routers R1 and R2 have the ip ospf message-digest-key key-id md5 key-string command entered in interface configuration mode. However, Router R1’s configuration enables authentication for all the router’s interface participating in area 0, using the area area-number authentication message-digest command in router configu-ration mode. Conversely, Router R2’s configuration enables authentication at the interface level, with the ip ospf message-digest-key key-id md5 key-string command issued in interface configuration mode. + +The same verification commands used for OSPFv2 plain text authentication apply to OSPFv2 MD5 configuration. However, the output of the show ip ospf interface interface_ identifier command, as shown in Example 17-10, shows that message digest authentication + + + + + +From the Library of Alexey Evseenko +756 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +is enabled, along with the youngest key ID. So, if a router is configured with multiple keys, the youngest key ID will be used when sending authenticated OSPF packets. + + +Note The youngest key ID appearing in the output of the show ip ospf interface inter-face_identifier command is not necessarily the lowest key ID. Rather it is the key that has been most recently configured, regardless of its key ID. + + +Example 17-10 Verifying OSPFv2 MD5 Authentication + +R1# show ip ospf interface s 1/0 +Serial1/0 is up, line protocol is up +Internet Address 10.1.1.1/30, Area 0, Attached via Network Statement +Process ID 1, Router ID 172.16.1.1, Network Type POINT_TO_POINT, Cost: 64 + +Topology-MTID Cost +0 64 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State POINT_TO_POINT +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:02 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 2/2, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 1 +Last flood scan time is 4 msec, maximum is 4 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 192.168.1.1 +Suppress hello for 0 neighbor(s) +Message digest authentication enabled +Youngest key id is 1 + + +OSPFv3 Authentication + +OSPFv3 has no authentication field in its headers. So, rather than using any authentica-tion mechanism natively built into OSPFv3, it relies on IPsec to provide authentication. Interestingly, IPsec is capable of encrypting messages in addition to authenticating them. The Authentication Header (AH) encapsulation type for IPsec provides authentication services, but no encryption, while Encapsulating Security Payload (ESP) provides both authentication and encryption services. + +The ipv6 ospf authentication command enables the use of AH to provide authentica-tion, while the ipv6 ospf encryption command enables authentication and encryption services through ESP. + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 757 + +In addition to specifying whether you want to just perform authentication or also per-form encryption, you need to specify an identifier called the security policy index (SPI) and a key string. The combination of an SPI and a key string is called a security policy. As with OSPFv2 authentication, OSPFv3 authentication (and encryption) can be per-formed on a per-interface or per-area basis; however, Cisco recommends the per-interface approach for enhanced security. + +Unlike configuring OSPFv2 authentication, OSPFv3 authentication can be accomplished with a single command, as illustrated in Example 17-11 for the topology in Figure 7-7. + + + + + +R1 +Fa0/0 +2001::1/64 + +S1/0 2002::1/64 + + +S1/0 R2 2002::2/64 Fa0/0 +2003::1/64 + + + +Area 0 + + + + +Figure 17-7 Two Routers Configured for OSPFv3 SHA1 Authentication + +Example 17-11 OSPFv3 Authentication Configuration Key +Topic !Configuration on Router R1 +interface Serial1/0 +ipv6 address 2002::1/64 +ipv6 ospf 2 area 0 +! +ipv6 router ospf 2 +router-id 1.1.1.1 +area 0 authentication ipsec spi 256 sha1 0123456789012345678901234567890123456789 +! + +!Configuration on Router R2 +interface Serial1/0 +ipv6 address 2002::2/64 +ipv6 ospf authentication ipsec spi 256 sha1 +0123456789012345678901234567890123456789 +ipv6 ospf 2 area 0 +! +ipv6 router ospf 2 +router-id 2.2.2.2 + + + + + + +From the Library of Alexey Evseenko +758 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Note that OSPFv3 authentication can be configured on a router with a single command. In Example 17-11, Router R1 has OSPFv3 authentication configured for an area, while Router R2 has OSPFv3 authentication configured for an interface. + +In router configuration mode, the command to enable authentication is + +area area_number authentication ipsec spi security_policy_index [ md5 | sha1] {0 | 7} key-string + +Notice that you can specify either md5 or sha1 as your hashing algorithm. After speci-fying the algorithm you want to use, you can enter a 0 to indicate that you do not want your key string encrypted when it appears in your router’s running configuration. +Alternately, you can select a 7 if you do want it to appear encrypted. Finally in this com-mand, you enter the key string, which is a hexadecimal number. If you are using MD5 as your hashing algorithm, the key string must be 32 hexadecimal digits. However, if you selected SHA1, the key string must be 40 hexadecimal characters. + +If you are configuring OSPFv3 authentication in interface configuration mode, then the command you issue is +ipv6 ospf authentication ipsec spi security_policy_index [md5 | sha1] { 0 | 7} key-string + +Because OSPFv3 authentication is based on IPsec, you can verify the authentication configuration with the command show crypto ipsec sa interface interface_identifier. Example 17-12 illustrates sample output from this command from Router R1. + +Example 17-12 Verifying OSPFv3 Authentication + +R1# show crypto ipsec sa interface s 1/0 + +interface: Serial1/0 + +IPsecv6 policy name: OSPFv3-256 + +protected vrf: (none) +local ident (addr/mask/prot/port): (FE80::/10/89/0) +remote ident (addr/mask/prot/port): (::/0/89/0) +current_peer FF02::5 port 500 +PERMIT, flags={origin_is_acl,} +#pkts encaps: 517, #pkts encrypt: 517, #pkts digest: 517 +#pkts decaps: 517, #pkts decrypt: 517, #pkts verify: 517 +#pkts compressed: 0, #pkts decompressed: 0 +#pkts not compressed: 0, #pkts compr. failed: 0 +#pkts not decompressed: 0, #pkts decompress failed: 0 +#send errors 0, #recv errors 0 + +local crypto endpt.: FE80::C800:8FF:FEA4:0, +remote crypto endpt.: FF02::5 +path mtu 1500, ipv6 mtu 1500, ipv6 mtu idb Serial1/0 +current outbound spi: 0x100(256) + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 759 + +PFS (Y/N): N, DH group: none +inbound esp sas: + +inbound ah sas: +spi: 0x100(256) +transform: ah-sha-hmac , +in use settings ={Transport, } +conn id: 1, flow_id: 1, sibling_flags 80000011, crypto map: +Serial1/0-OSPF-MAP +sa timing: remaining key lifetime (sec): (0) +Kilobyte Volume Rekey has been disabled +replay detection support: N +Status: ACTIVE(ACTIVE) + +inbound pcp sas: + +outbound esp sas: + +outbound ah sas: +spi: 0x100(256) +transform: ah-sha-hmac , +in use settings ={Transport, } +conn id: 2, flow_id: 2, sibling_flags 80000011, crypto map: +Serial1/0-OSPF-MAP +sa timing: remaining key lifetime (sec): (0) +Kilobyte Volume Rekey has been disabled +replay detection support: N +Status: ACTIVE(ACTIVE) + +outbound pcp sas: +Crypto map tag: Serial1/0-OSPF-MAP, local addr FE80::C800:8FF:FEA4:0 + +Notice that the transform sets shown in the output use ah-sha-hmac. This indicates that the configuration is using Authentication Header (AH) for authentication (as opposed to Encapsulating Security Payload [ESP] for authentication and encryption). It also indi-cates that Secure Hash Algorithm (SHA) is the specific hashing algorithm being used for authentication (as opposed to Message Digest 5 [MD5]). + +BGP Authentication + +Unlike EIGRP and OSPF, which can (in some configurations) dynamically form neighbor-ships, BGP requires neighboring routers to be explicitly configured. Therefore, the threat of someone maliciously forming a neighborship with your BGP router is far less likely, as compared to OSPF or EIGRP. + +However, imagine that your BGP-speaking router had already established a TCP session with a configured BGP peer. In such a scenario, an attacker could possibly hijack that + + + +From the Library of Alexey Evseenko +760 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +existing TCP session and proceed to corrupt the BGP table on your router. To help miti-gate such a threat, you can configure authentication for BGP. This authentication is going to be through MD5. There is no Cisco IOS support for plain text or SHA authentication for BGP. + +BGP does not require a series of configuration steps. Rather, BGP can be enabled on a router with a single command, as demonstrated next. + +IPv4 BGP Authentication + +To configure BGP authentication between two neighboring BGP neighbors, enter the neighbor neighbor-ip password key command in BGP router configuration mode on each router. + +Example 17-13 shows a BGP authentication configuration for an IPv4 network, the topol-ogy for which is provided in Figure 17-8. + + + + + +R1 +172.16.1.0/24 +Fa0/0 .1 + +10.1.1.0/30 +S1/0 .1 + + +S1/0 R2 +192.168.1.0/24 +.2 Fa0/0 .1 + + + + +AS 65001 AS 65002 + + + +Figure 17-8 Two Routers in an IPv4 Network Configured for BGP Authentication + +Example 17-13 IPv4 BGP Authentication Configuration Key +Topic !Configuration on Router R1 +router bgp 65001 +network 172.16.1.0 mask 255.255.255.0 +neighbor 10.1.1.2 remote-as 65002 +neighbor 10.1.1.2 password KEYNOTE + +!Configuration on Router R2 +router bgp 65002 +network 192.168.1.0 +neighbor 10.1.1.1 remote-as 65001 +neighbor 10.1.1.1 password KEYNOTE + +There is no BGP command to specifically troubleshoot BGP authentication; however, you can issue the show ip bgp summary command to determine whether a neighborship is currently up, as demonstrated in Example 17-14. If the neighborship is not up, you + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 761 + +can check the keys on each neighbor to make sure that they match, just like the key of KEYNOTE matches on Routers R1 and R2 in Example 17-13. + +Example 17-14 Verification of IPv4 BGP Authentication + +R1# show ip bgp summary +BGP router identifier 172.16.1.1, local AS number 65001 +BGP table version is 5, main routing table version 5 +2 network entries using 288 bytes of memory +2 path entries using 160 bytes of memory +2/2 BGP path/bestpath attribute entries using 272 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 744 total bytes of memory +BGP activity 7/5 prefixes, 7/5 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +10.1.1.2 4 65002 9 10 5 0 0 00:05:21 1 + + +IPv6 BGP Authentication + +The procedure to configure BGP authentication on an IPv6 network is identical to the procedure previously seen for IPv4. Specifically, you issue the neighbor neighbor-ip password key command in BGP router configuration mode; however, the neighbor-ip value will be an IPv6 address, as opposed to an IPv4 address. + +Example 17-15 shows a sample BGP authentication for the IPv6 network illustrated in Figure 17-9. + + + + + +R1 +Fa0/0 +2001::1/64 + +S1/0 2002::1/64 + + +S1/0 R2 2002::2/64 Fa0/0 +2003::1/64 + + + + +AS 65001 AS 65002 + + + +Figure 17-9 Two Routers in an IPv6 Network Configured for BGP Authentication + + + + + + + + +From the Library of Alexey Evseenko +762 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Example 17-15 IPv6 BGP Authentication Configuration +Key +Topic !Configuration on Router R1 +router bgp 65001 +bgp router-id 1.1.1.1 +bgp log-neighbor-changes +no bgp default ipv4-unicast +neighbor 2002::2 remote-as 65002 +neighbor 2002::2 password KEYNOTE +! +address-family ipv4 +exit-address-family +! +address-family ipv6 +network 2001::/64 +network 2002::/64 +neighbor 2002::2 activate +exit-address-family + +!Configuration on Router R2 +router bgp 65002 +bgp router-id 2.2.2.2 +bgp log-neighbor-changes +no bgp default ipv4-unicast +neighbor 2002::1 remote-as 65001 +neighbor 2002::1 password KEYNOTE +! +address-family ipv4 +exit-address-family +! +address-family ipv6 +network 2002::/64 +network 2003::/64 +neighbor 2002::1 activate +exit-address-family + +Example 17-16 shows output from the show bgp ipv6 unicast summary command, con-firming that Router R1 has a BGP neighborship with Router R2. + +Example 17-16 Verification of IPv6 BGP Authentication + +R1# show bgp ipv6 unicast summary +BGP router identifier 1.1.1.1, local AS number 65001 +BGP table version is 6, main routing table version 6 +3 network entries using 504 bytes of memory +4 path entries using 416 bytes of memory +2/2 BGP path/bestpath attribute entries using 272 bytes of memory + + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 763 + +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 1216 total bytes of memory +BGP activity 6/3 prefixes, 8/4 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2002::2 4 65002 10 10 6 0 0 00:04:56 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +764 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Exam Preparation Tasks + + +Planning Practice + +The CCNP ROUTE exam expects test takers to review design documents, create imple-mentation plans, and create verification plans. This section provides some exercises that can help you to take a step back from the minute details of the topics in this chapter so that you can think about the same technical topics from the planning perspective. + +For each planning practice table, simply complete the table. Note that any numbers in parentheses represent the number of options listed for each item in the solutions in Appendix F, “Completed Planning Practice Tables.” + +Design Review Table + +Table 17-3 lists several design goals related to this chapter. If these design goals were list-ed in a design document, and you had to take that document and develop an implemen-tation plan, what implementation options come to mind? For any configuration items, a general description can be used, without concern about the specific parameters. + +Table 17-3 Design Review + + +Design Goal + +Prevent a malicious user from injecting a rogue router into an EIGRP autonomous system and forming a neighborship. +Configure OSPFv2 authentication such that a malicious user could not do a packet capture of the authentication traffic and determine the authentication key. + +Possible Implementation Choices Covered in This Chapter + +Prevent a malicious user from causing a rogue router to hijack an existing BGP session. + + + +Implementation Plan Peer Review Table + +Table 17-4 shows a list of questions that others might ask, or that you might think about, during a peer review of another network engineer’s implementation plan. Complete the table by answering the questions. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 765 + +Table 17-4 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +An EIGRP-speaking router is configured with a key chain containing multiple keys. Which key is going to be used? +What authentication types are available for OSPFv3? +Why would you want to authenticate BGP neighbors, because BGP requires a router to have a static configuration of its neighbors’ IP addresses? + + + +Create an Implementation Plan Table + +To practice skills useful when creating your own OSPF implementation plan, list in Table 17-5 configuration commands related to the configuration of the following features. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + + +Table 17-5 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + +For EIGRP, create a key chain and give it a name. + +For EIGRP, create one or more key numbers. + +For EIGRP, define an authentication key’s value. + +Enable EIGRP for IPv4 MD5 authentication on an interface for a particular EIGRP autonomous system. +For EIGRP for IPv4, specify the key chain to be used on an interface. +Enable EIGRP for IPv6 authentication on an interface for a particular EIGRP autonomous system. +For EIGRP for IPv6, specify the key chain to be used on an interface. +Enable Named EIGRP authentication for an interface. +For Named EIGRP, specify the key chain to be used on an interface. +Enable OSPFv2 authentication on an interface. + + + + +From the Library of Alexey Evseenko +766 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Feature Configuration Commands/Notes +Enable OSPFv2 authentication on all interfaces in an area by configuring area-wide authentication. +Specify a key to use with OSPFv2 plain text authentication. +Specify a key to use with OSPFv2 MD5 authentication. +Enable OSPFv3 authentication on an interface. + +Enable OSPFv3 authentication on all interfaces in an area by configuring area-wide authentication. +Specify an authentication key to use with a BGP neighbor. + + + +Choose Commands for a Verification Plan Table + +To practice skills useful when creating your own OSPF verification plan, list in Table +17-6 all commands that supply the requested information. You might want to record your answers outside the book, and set a goal to complete this table (and others like it) from memory during your final reviews before taking the exam. + +Table 17-6 Verification Plan Memory Drill + +Information Needed Command(s) +Verify that an EIGRP for IPv4 neighborship is up. + +Verify that an EIGRP for IPv6 neighborship is up. + +Collect information about a configured key chain. + +Verify that OSPFv2 authentication is enabled. + +Verify that OSPFv3 authentication is enabled. + +Verify that an OSPF neighborship is up. + +Verify that a BGP for IPv4 neighborship is up. + +Verify that a BGP for IPv6 neighborship is up. + + +Note Some of the entries in this table might not have been specifically mentioned in this chapter but are listed in this table for review and reference. + + + + + + + + +From the Library of Alexey Evseenko +Chapter 17: Routing Protocol Authentication 767 + +Review All the Key Topics + +Review the most important topics from inside the chapter, noted with the Key Topic icon in the outer margin of the page. Table 17-7 lists a reference of these key topics and the page numbers on which each is found. + +Key Table 17-7 Key Topics for Chapter 17 +Topic Key Topic Element Description Page Number + + +List + +Example 17-1 + +List + +Example 17-2 + +List + +Example 17-4 + +List + +Example 17-6 + +Table 17-2 + +List + +Example 17-7 + +List + +Example 17-9 + +Example 17-11 + +Example 17-13 + +Example 17-15 + +Hashing authentication process 741 + +Time-Based Key Chain Configuration 743 + +EIGRP for IPv4 authentication configuration steps 744 + +EIGRP for IPv4 Authentication Configuration 745 + +EIGRP for IPv6 authentication configuration steps 747 + +EIGRP for IPv6 Authentication Configuration 747 + +Named EIGRP authentication configuration steps 749 + +Named EIGRP Authentication Configuration 749 + +OSPF Authentication Types 751 + +OSPF plain text authentication configuration steps 752 + +OSPFv2 Plain Text Authentication Configuration 752 + +OSPFv2 MD5 configuration steps 754 + +OSPFv2 MD5 Authentication Configuration 755 + +OSPFv3 Authentication Configuration 757 + +IPv4 BGP Authentication Configuration 760 + +IPv6 BGP Authentication Configuration 762 + + + + +Complete the Tables and Lists from Memory + +Print a copy of Appendix D, “Memory Tables,” (found on the CD) or at least the section for this chapter, and complete the tables and lists from memory. Appendix E, “Memory Tables Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary. + +authentication, key chain, Message Digest 5 authentication, Secure Hash Algorithm (SHA), shared key + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +CHAPTER 18 + + + + + + +Final Preparation + + +The first 17 chapters of this book cover the technologies, protocols, commands, and fea-tures required to be prepared to pass the ROUTE exam. Although these chapters supply the detailed information, most people need more preparation than simply reading the first 17 chapters of this book. This chapter details a set of tools and a study plan to help you complete your preparation for the exams. + +This short chapter has two main sections. The first section lists the exam preparation tools useful at this point in the study process. The second section details a suggested study plan now that you have completed all the preceding chapters in this book. + + +Note Appendixes D, E, F, and G exist as soft-copy appendixes on the CD included in the back of this book. + + + +Tools for Final Preparation + +This section lists some information about exam preparation tools and how to access the tools. + +Exam Engine and Questions on the CD + +The CD in the back of the book includes the Pearson Cert Practice Test engine. This soft-ware presents you with a set of multiple-choice questions, covering the topics that you will be challenged with on the real exam. The Pearson Cert Practice Test engine lets you study the exam content (using study mode) or take a simulated exam (in practice exam mode). + +The CD in the back of the book contains the exam engine. After it is installed, you can then activate and download the current ROUTE exam from Pearson’s website. Installation of the exam engine takes place in two steps: +Step 1. Install the exam engine from the CD. + +Step 2. Activate and download the ROUTE practice exam. + + + + + + + +From the Library of Alexey Evseenko +770 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Install the Exam Engine + +The software installation process is pretty routine as compared with other software installation processes. To be complete, the following steps outline the installation + +process: + +Step 1. + +Step 2. + + + +Step 3. + + + +Insert the CD into your PC. + +The software that automatically runs is the Cisco Press software to access and use all CD-based features, including the exam engine and the CD-only appen-dixes. From the main menu, click the option to Install the Exam Engine. + +Respond to prompts as with any typical software installation process. + + +The installation process gives you the option to activate your exam with the activation code supplied on the paper in the CD sleeve. This process requires that you establish a Pearson website login. You will need this login to activate the exam. Therefore, please do register when prompted. If you already have a Pearson website login, there is no need to register again. Just use your existing login. + +Activate and Download the Practice Exam + +After the exam engine is installed, you should then activate the exam associated with this book (if you did not do so during the installation process) as follows: +Step 1. Start the Pearson Cert Practice Test (PCPT) software. + +Step 2. To activate and download the exam associated with this book, from the My Products or Tools tab, click the Activate button. + +Step 3. At the next screen, enter the activation key from the paper inside the card-board CD holder in the back of the book. After it is entered, click the Activate button. +Step 4. The activation process will download the practice exam. Click Next; then click Finish. + +When the activation process is completed, the My Products tab should list your new exam. If you do not see the exam, make sure that you selected the My Products tab on the menu. At this point, the software and practice exam are ready to use. Simply select the exam and click the Use button. + +To update a particular exam you have already activated and downloaded, simply select the Tools tab and click the Update Products button. Updating your exams will ensure that you have the latest changes and updates to the exam data. + +If you want to check for updates to the Pearson Cert Practice Test exam engine software, simply select the Tools tab and click the Update Application button. This will ensure that you are running the latest version of the software engine. + + + + + + + +From the Library of Alexey Evseenko +Chapter 18: Final Preparation 771 + +Activating Other Exams + +The exam software installation process, and the registration process, only has to happen once. Then, for each new exam, only a few steps are required. For example, if you buy another new Cisco Press Official Cert Guide or Pearson IT Certification Cert Guide, remove the activation code from the CD sleeve in the back of that book; you don’t even need the CD at this point. From there, all you have to do is start the exam engine (if not still up and running) and perform Steps 2 through 4 from the previous list. + +Premium Edition + +In addition to the free practice exam provided on the CD-ROM, you can purchase addi-tional exams with expanded functionality directly from Pearson IT Certification. The Premium Edition of this title contains an additional two full practice exams as well as an eBook (in both PDF and ePub format). In addition, the Premium Edition title also has remediation for each question to the specific part of the eBook that relates to that question. + +Because you have purchased the print version of this title, you can purchase the Premium Edition at a deep discount. There is a coupon code in the CD sleeve that contains a one-time use code, as well as instructions for where you can purchase the Premium Edition. + +To view the Premium Edition product page, go to www.ciscopress.com/ title/9780133149920. + +The Cisco Learning Network + +Cisco provides a wide variety of CCNP preparation tools at a Cisco website called the Cisco Learning Network. Resources found here include sample questions, forums on each Cisco exam, learning video games, and information about each exam. + +To reach the Cisco Learning Network, go to http://learningnetwork.cisco.com or just search for “Cisco Learning Network.” To access some of the features/resources, you need to use the login that you created at www.cisco.com. If you don’t have such a login, you can register for free. To register, simply go to www.cisco.com, click Register at the top of the page, and supply some information. + +Memory Tables + +Like most Certification Guides from Cisco Press, this book purposefully organizes infor-mation into tables and lists for easier study and review. Rereading these tables can be very useful before the exam. However, it is easy to skim over the tables without paying atten-tion to every detail, especially when you remember having seen the table’s contents when reading the chapter. + +Instead of simply reading the tables in the various chapters, this book’s Appendixes D and E give you another review tool. Appendix D, “Memory Tables,” lists partially com-pleted versions of many of the tables from the book. You can open Appendix D (a PDF + + + + +From the Library of Alexey Evseenko +772 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +file on the CD that comes with this book) and print the appendix. For review, you can attempt to complete the tables. This exercise can help you focus during your review. It also exercises the memory connectors in your brain, plus it makes you think about the information without as much information, which forces a little more contemplation about the facts. + +Appendix E, “Memory Tables Answer Key,” also a PDF file located on the CD, lists the completed tables to check yourself. You can also just refer to the tables as printed in the book. + +Chapter-Ending Review Tools + +Chapters 1 through 17 each have several features in the “Exam Preparation Tasks” section at the end of the chapter. You might have used some or all of these tools at the end of each chapter. It can also be useful to use these tools again as you make your final prepa-rations for the exam. + +Suggested Plan for Final Review/Study + +This section lists a suggested study plan from the point at which you finish reading through Chapter 17 until you take the ROUTE exam. Certainly, you can ignore this plan, use it as is, or just take suggestions from it. + +The plan uses seven steps. If following the plan verbatim, you should proceed by part through the steps. That is, starting with Part I (Fundamental Routing Concepts), do the following seven steps. Then, for Part II (IGP Routing Protocols), do the following seven steps, and so on. The steps are as follows: +Step 1. Review key topics and DIKTA questions: You can use the table that lists the key topics in each chapter, or just flip the pages looking for the Key Topic icons. Also, reviewing the Do I Know This Already? (DIKTA) questions from the beginning of the chapter can be helpful for review. +Step 2. Complete memory tables: Open Appendix D on the CD and print the entire appendix, or print the tables by major part. Then complete the tables and check your answers in Appendix E, which also appears on the CD. +Step 3. Hands-on practice: Most people practice CCNP configuration and verifica-tion before the exam. Whether you use real gear, a simulator, or an emulator, practice the configuration and verification commands. +Step 4. Build configuration checklists: Glance through the Table of Contents, looking for major configuration tasks. Then from memory create your own configura-tion checklists for the various configuration commands. +Step 5. Planning practice: Even if you used the “Planning Practice” tables when you initially read each chapter, repeat the process, particularly for the tables relat-ed to interpreting a design and reviewing another engineer’s implementation plan. + + + + +From the Library of Alexey Evseenko +Chapter 18: Final Preparation 773 + +Step 6. Subnetting practice: If you can no longer do subnetting well and quickly without a subnetting calculator, take some time to get better and faster before going to take the ROUTE exam. +Step 7. Use the exam engine to practice: The exam engine on the CD can be used to study using a bank of unique exam-realistic, multiple-choice questions avail-able only with this book. + +The rest of this section describes Steps 1, 3, 6, and 7, for which a little more explanation might be helpful. + +Step 1: Review Key Topics and DIKTA Questions + +This review step focuses on the core facts related to the ROUTE exam. The exam certain-ly covers other topics as well, but the DIKTA questions and the key topics items attempt to focus attention on the more important topics in each chapter. + +As a reminder, if you follow this plan after reading the first 17 chapters, working a major part at a time (Fundamental Routing Concepts in Chapters 1 and 2, for example) helps you pull each major topic together. + +Step 3: Hands-On Practice + +Although this book gives you many configuration checklists, specific configuration examples, examples of output, and explanations for the meaning of that output, there is no substitute for hands-on practice. This short section provides a few suggestions regard-ing your efforts to practice from the command-line interface (CLI). + +First, most people use one or more of the following options for hands-on skills: + +■ Real gear: Either purchased (often used), borrowed, or rented + +■ Simulators: Software that acts like real gear + +■ Emulators: Software that emulates Cisco hardware and runs Cisco IOS + +For real gear, the minimum recommended home lab configuration would have three ISR (or ISR2) routers running Cisco IOS Release 15.2 (or later). This would allow you to experiment with most of the technologies discussed in this book. + +Pearson IT Certification offers an excellent simulator with nearly 400 structured labs to help you get hands-on experience. Even though the simulator targets the CCNA exam, many of its labs are appropriate for your ROUTE studies. You can learn more about the “CCNA Routing and Switching 200-120 Network Simulator” here: + +http://kwtrain.com/netsim +As for emulators, you can purchase access to emulated routers from the Cisco Learning Network. What you are purchasing is a block of hours to access the emulated gear, along with structured labs to follow. The product is called Cisco Learning Labs, and more information can be found here: + +http://kwtrain.com/route-emulator + + + +From the Library of Alexey Evseenko +774 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Step 6: Subnetting Practice + +This book assumes that you have mastered subnetting and the related math. However, many people who progress through CCNA, and move on to CCNP, follow a path like this: +Step 1. Learn subnetting conceptually. + +Step 2. Get really good at doing the math quickly. + +Step 3. Pass CCNA. + +Step 4. Don’t practice regularly and therefore become a lot slower at doing the sub-netting math. + +Step 5. Study for CCNP ROUTE. + +Although subnetting should not be assessed as an end to itself on CCNP ROUTE, many questions require that you understand subnetting math and do that math just as quickly as you did when you passed CCNA. If you are a little slow on doing subnetting math, before you go to the ROUTE exam, try some of the following exercises: + +■ Practice finding the subnet number, broadcast address, and range of addresses in a subnet. To do so, pick a network address and mask, calculate the values, and use your favorite subnet calculator to check your work. + +■ Use the Cisco Subnetting Game, also at the Cisco Learning Network. You can find it here:http://kwtrain.com/subnet-game + +■ Practice choosing the best summary route for a range of subnets. Pick three or four addresses/masks. Calculate the subnet number and range. Then, try to choose the summary (subnet number/mask) that includes those three or four subnets, without including any more subnets than what is required. You can check your math with a subnet calculator. + +If you like performing binary/decimal conversions when you work through these prob-lems, but just need to go faster, check out the Cisco Binary Game, also at the Cisco Learning Network. You can find it here: + +http://kwtrain.com/binary-game + +Step 7: Use the Exam Engine + +The Pearson Cert Practice Test engine on the CD lets you access a database of questions created specifically for this book. The Pearson Cert Practice Test engine can be used either in study mode or practice exam mode, as follows: + +■ Study mode: Study mode is most useful when you want to use the questions for learning and practicing. In study mode, you can select options like randomizing the order of the questions and answers, automatically viewing answers to the questions as you go, testing on specific topics, and many other options. + + + + + +From the Library of Alexey Evseenko +Chapter 18: Final Preparation 775 + +■ Practice exam mode: This mode presents questions in a timed environment, provid-ing you with a more exam-realistic experience. It also restricts your ability to see your score as you progress through the exam and view answers to questions as you are taking the exam. These timed exams not only allow you to study for the actual 300-101 ROUTE exam, but they also help you simulate the time pressure that can occur on the actual exam. + +When doing your final preparation, you can use study mode, practice exam mode, or both. However, after you have seen each question a couple of times, you will likely start to remember the questions, and the usefulness of the exam database might go down. So, consider the following options when using the exam engine: + +■ Use the question database for review. Use study mode to study the questions by chapter, just as with the other final review steps listed in this chapter. Consider upgrading to the Premium Edition of this book if you want to take additional simu-lated exams. + +■ Save the question database, not using it for review during your review of each book part. Save it until the end so that you will not have seen the questions before. Then, use practice exam mode to simulate the exam. + +Picking the correct mode from the exam engine’s user interface is pretty obvious. The following steps show how to move to the screen from which you can select the study or practice exam mode: +Step 1. Click the My Products tab if you are not already in that screen. + +Step 2. Select the exam that you want to use from the list of available exams. + +Step 3. Click the Use button. + +By taking these actions, the engine should display a window from which you can choose Study Mode or Practice Exam Mode. When in study mode, you can further choose the book chapters, limiting the questions to those explained in the specified chapters of the book. + + +Note Please revisit Table I-1, “Route Exam (300-101) Topics,” in the Introduction. This table identifies the topic areas that you are responsible for on the ROUTE exam; note that several are topics you covered in your CCNA studies. Therefore, you might want to review those topics in your CCNA study materials. If you need current CCNA materials for your study, they can be purchased from Cisco Press: +■ CCNA Complete Video Course: http://kwtrain.com/ccnacourse +■ CCNA Official Certification Library: http://kwtrain.com/ccnabooks + + + + + + + + + +From the Library of Alexey Evseenko +776 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Summary + +The tools and suggestions listed in this chapter have been designed with one goal in mind: to help you develop the skills required to pass the ROUTE exam. This book has been developed from the beginning to not just tell you the facts but also to help you learn how to apply the facts. No matter what your experience level is leading up to when you take the exams, it is my hope that the broad range of preparation tools, and even the structure of the book, can help you pass the exams with ease. I wish you all the best in your studies and on your exam. + +Keep in Touch with Kevin + +Please take a few moments to follow me on one of (or all) the social media platforms list-ed here. You’ll find that I periodically post technical tips, free training videos, announce-ments about my new training products, and random things that make me laugh: + +Blog: http://kwtrain.com +Twitter: http://twitter.com/kwallaceccie Facebook: http://facebook.com/kwallaceccie YouTube: http://youtube.com/kwallaceccie LinkedIn: http://linkedin.com/in/kwallaceccie Google+: http://google.com/+KevinWallace + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +APPENDIX A + + + + +Answers to the “Do I Know This Already?” Quizzes + + +Chapter 1 + +1. C. The Split Horizon feature prevents a route learned on one interface from being advertised back out of that same interface. + +The Summarization feature allows multiple contiguous networks to be represented with a single route advertisement. + +The Poison Reverse feature causes a route received on one interface to be advertised back out of that same interface with a metric considered to be infinite. + +Convergence is the speed at which a backup route takes over for a failed preferred route. +2. B and C. Both RIP and EIGRP are distance-vector routing protocols, although EIGRP is considered an advanced distance-vector routing protocol. + +Both OSPF and IS-IS are link-state routing protocols, and BGP is a path-vector rout-ing protocol. +3. D. A unicast network communication flow is considered a “one-to-one” flow, because there is one source and one destination. + +A multicast network communication flow is considered a “one-to-many” flow, because there is one source and potentially many destinations (specifically, destina-tions that have joined a multicast group). + +A broadcast network communication flow is considered a “one-to-all” flow, because there is one source, and the destinations include all devices in a subnet. + +An anycast network communication flow is considered as “one-to-nearest” flow, because there are multiple devices assigned the same IPv6 address, and traffic is routed from one source to the nearest device assigned the destination IPv6 address. +4. A and D. A nonbroadcast multiaccess (NBMA) network can have Split Horizon issues in a hub-and-spoke topology, because a route learned by the hub router from a spoke router might not be advertised back out to any other spoke routers, because of Split Horizon operation. Also, if the NBMA network is using OSPF, there can be designated router issues, because the spoke routers might not be able to communi-cate with one another through broadcasts. + + + + + + +From the Library of Alexey Evseenko +780 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +5. B. The term TCP Maximum Segment Size (MSS) seems to imply the size of the entire Layer 4 segment (that is, including Layer 2, Layer 3, and Layer 4 headers). However, TCP MSS only refers to the amount of data in the segment (without the inclusion of any headers). +6. C. The bandwidth-delay product of a segment is the measure of the maximum num-ber of bits that can be on the segment at any one time. The bandwidth-delay prod-uct is calculated by multiplying the segment’s bandwidth (in bits/sec) by the latency that packets experience as they cross the segment (in sec). + +In this question, the bandwidth-delay product can be calculated as follows: + +bandwidth-delay product = 10,000,000 bits/sec * 0.1 sec = 1,000,000 bits. + +7. A and C. When converting a Cisco Catalyst switch to Rapid-PVST+, you can remove the UplinkFast and BackboneFast features, because similar features are built into Rapid-PVST+. However, the following features can still be used with Rapid-PVST+: PortFast, BPDU Guard, BPDU Filter, Root Guard, and Loop Guard. +8. A. Cisco Easy Virtual Network (EVN) uses a Virtual Network Trunk (VNET Trunk) to carry traffic for each virtual network, and eliminates the need to manually config-ure a subinterface for each virtual network on all routers. + +Inter-Switch Link (ISL) is a Cisco-proprietary trunking technology for Ethernet net-works. + +IEEE 802.1Q is an industry-standard trunking technology for Ethernet networks. + +IEEE 802.10 is an industry-standard trunking technology for FDDI networks. + + +Chapter 2 + +1. C. A hybrid VPN uses more than one VPN technology. While you can encrypt a packet that has already been encapsulated by a VPN technology, and while you can encapsulate a packet that has already been encrypted, you might need to decrease the MTU for a frame on an interface configured for tunneling. The reason for the MTU decrease is that additional header information is added for each VPN tech-nology you use. As a result, the maximum amount of data contained in a frame is reduced. +2. A. In a Layer 3 MPLS VPN, a customer edge (CE) router forms a neighborship with a provider edge (PE) router (or an edge label switch router [ELSR]) in an MPLS net-work. In a Layer 2 MPLS VPN, the MPLS network acts as a Layer 2 switch. IP multi-cast traffic can flow across an MPLS network with no issue. +3. C. A GRE tunnel can encapsulate any Layer 3 protocol, including IP unicast, mul-ticast, and broadcast traffic. However, a GRE tunnel does not offer encryption. An IPsec tunnel does offer encryption, but it can only transmit unicast IP traffic. +Therefore, to meet the design requirements in this question, you could encapsulate the IP unicast, multicast, and broadcast traffic inside of a GRE tunnel. Because a GRE packet is a unicast IP packet, you could encapsulate the GRE packets inside of an IPsec tunnel, thus providing the required encryption. + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 781 + +4. A, B, and D. A DMVPN network uses mGRE to dynamically form GRE tunnels between two sites needing a direct tunnel. NHRP is used by mGRE to discover the IP address of the device at the remote side of the tunnel. IPsec is used to secure the GRE packets. However, MPLS is not a requirement. +5. A and B. Like traditional GRE, mGRE can transport a wide variety of protocols (for example, IP unicast, multicast, and broadcast traffic). Also, a single mGRE interface can service multiple tunnels. +6. B and D. NHRP (Next Hop Resolution Protocol) spokes are configured with the IP address of an NHRP hub, but the hub is not configured with the IP addresses of +the spokes. When the spokes come online, they inform the hub of both the physical IP address (assigned to a physical interface) and the logical IP address (assigned to +a virtual tunnel interface) that are going to be used for their tunnels. With the hub’s database populated, a spoke can query the hub to find out the IP address of a physi-cal interface that corresponds to a specific tunnel interface’s IP address. +7. B. Data confidentiality is provided by encrypting data. Data integrity ensures that data is not modified in transit. Data authentication allows parties involved in a con-versation to verify that the other party is the party it claims to be. IPsec uses antire-play protection to ensure that packets being sent are not duplicate packets. + +Chapter 3 + +1. D. Inside a quartet, any leading 0s can be omitted, and one sequence of one or more quartets of all 0s can be replaced with “::”. The correct answer replaces the longer three-quartet sequence of 0s with ::. +2. C. The name of the prefix generally represents the group to which the prefix is given, with the exception of the term global routing. IANA assigns a prefix to a registry (registry prefix). The registry can assign a subset of that range as a prefix to an +ISP (ISP prefix). That ISP then subdivides that range of addresses into prefixes and assigns a prefix to one of its customers (site prefix, also called global routing prefix). The enterprise network engineers then further subdivide the range, often with prefix length 64, into subnet prefixes. +3. A and C. IPv6 supports stateful DHCP, which works similarly to IPv4’s DHCP to dynamically assign the entire IP address. Stateless autoconfiguration also allows for the assignment by finding the prefix from some nearby router and calculating the Interface ID using the EUI-64 format. Stateless DHCP simply supplies the DNS server IP addresses, and NDP supplies Layer 2 mapping information. +4. D. Stateless autoconfiguration only helps a host learn and form its own IP address, but it does not help the host learn a default gateway. Stateless RS is not a valid term or feature. Neighbor Discovery Protocol (NDP) is used for several purposes, includ-ing the same purpose as ARP in IPv4, plus to learn configuration parameters such as a default gateway IP address. + + + + + + +From the Library of Alexey Evseenko +782 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +5. D. Global unicast addresses begin with 2000::/3, meaning that the first 3 bits match the value in hex 2000. Similarly, unique local addresses match FD00::/8, and link-local addresses match FE80::/10 (values that begin with FE8, FE9, FEA, and FEB hex). Multicast IPv6 addresses begin FF00::/8, meaning that the first two hex digits are F. +6. B. When created automatically, link-local addresses begin FE80::/64, because after the prefix of FE80::/10, the device builds the next 54 bits as binary 0s. Statically assigned link-local addresses simply need to conform to the FE80::/10 prefix. As a result, only two answers are candidates with a beginning quartet of FE80. Of these, only one has only hex 0s in the second, third, and fourth quartets, making answer B the only valid answer. +7. A and C. The ipv6 address command does not list an eui-64 parameter, so R1 does not form its global unicast address using the EUI-64 format. However, it does form its link-local address using EUI-64. The show ipv6 interface brief command lists both the global unicast and link-local addresses in its output. +8. A. The group addresses listed in the output are the all IPv6 hosts address (FF02::1), the all IPv6 routers address (FF02::2), and the solicited node address that is based on R1’s global unicast address (FF02::1:FF12:3456). Also, R1’s global unicast address is listed correctly in answer B, but the “[EUI]” notation implies that R1 derived the interface ID portion using EUI-64 conventions. +9. A, B, and D. RIPv2 and RIPng both use UDP, both use distance-vector logic, and both use the same metric, with the same maximum (15) and same metric that means infinity (16). RIPng does not perform automatic route summarization because IPv6 has no concept of a classful network. RIPng also uses the built-in IPv6 authentica-tion mechanisms rather than a RIP-specific authentication such as RIPv2. +10. B. The fact that the configuration will be copied/pasted into a router means that the order of the commands matters. In this case, the fact that the ipv6 rip one enable command precedes the ipv6 address command on interface f0/0 means that Cisco IOS will reject the first of these commands, therefore not enabling RIPng on F0/0. The correct order listed under S0/0/0 means that RIPng will be enabled on S0/0/0. As a result, RIPng on R1 will advertise about S0/0/0’s connected IPv6 prefixes, and send Updates on S0/0/0, but will do nothing related for F0/0. + +Chapter 4 + +1. B and C. The network 172.16.1.0 0.0.0.255 command tells Cisco IOS to match the first three octets when comparing the interface IP addresses to the configured “172.16.1.0” value. Only two answers match in the first three octets. The other two answers have a 0 in the third octet, making the addresses not match the network command. +2. D. The show ip eigrp interfaces command displays interfaces on which EIGRP has been enabled but omits passive interfaces. Making the interface passive would omit the interface from the output of this command. + + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 783 + +3. D. The show ip eigrp interfaces detail command does display a router’s EIGRP Hello timer setting for each enabled interface. The other listed commands do not display the timer. Also, EIGRP routers do not have to have matching Hello timers to become neighbors. +4. C. The neighbor 172.16.2.20 fa0/0 command would only be rejected if the IP address (172.16.2.20) is not inside the range of addresses in the subnet (172.16.2.0/26, range 172.16.2.0–172.16.2.63). This command does not impact the interface state. The command does disable all EIGRP multicasts, and because the three dynamically discovered neighbors require the EIGRP multicasts, all three neighbors fail. Although 172.16.2.20 is a valid potential neighbor, both routers must be configured with static neighbor commands, and we know that 172.16.2.20 was not previously configured with a static neighbor command; otherwise, it could not have been a neighbor +with R1. + +5. A and D. Table 4-4 lists the issues. For EIGRP, Router IDs do not have to be unique for EIGRP routers to become neighbors, and the hold timer does not have to match between the two neighbors. However, making an interface passive disables the processing of all EIGRP messages on the interface, preventing all neighborships. Mismatched IP subnets also prevent neighborships from forming. +6. A. The configuration requires the ip authentication mode eigrp asn md5 command, which is currently missing. This command enables MD5-style authentication, rather than the default of no authentication. Adding this one command completes the con-figuration. Any valid key numbers can be used. Also, the 9 in the ip authentication key-chain eigrp 9 fred command refers to the EIGRP ASN, not an authentication type. +7. A. EIGRP forms neighborships only when two routers can communicate directly over a data link. As a result, with Frame Relay, EIGRP neighborships occur only between routers on the ends of a PVC, so in this case, 100 neighborships exist. + +Chapter 5 + +1. B and C. Other than the two listed correct answers, the local router also adds con-nected routes for which the network command matches the corresponding interfac-es, so it might not add all connected routes. Also, EIGRP does not add static routes to the EIGRP topology table, unless those routes are redistributed. +2. B and D. EIGRP sends bandwidth, delay, reliability, load, MTU, and hop count in the message. The formula to calculate the metric includes bandwidth, delay, reliability, and load. +3. A. EIGRP performs WAN bandwidth control without any explicit configuration, using default settings. Because no bandwidth commands have been configured, each subinterface uses the default 1544-kbps setting. For S0/0.1, WAN bandwidth control divides the 1544 by 3 (515 kbps) and then takes the (default) WAN bandwidth of 50 percent, meaning about 250 kbps for each of the three DLCIs. For the two subinter-faces with one PVC, the default 1544 is multiplied by the 50 percent default WAN bandwidth, meaning that each could use about 750 kbps. + + + +From the Library of Alexey Evseenko +784 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +4. A. This command lists all successor and feasible successor routes. The output states that two successors exist, and only two routes (listed with the “via...” text) exist. So, no feasible successor routes exist. +5. A and C. By default, the metric weights cause EIGRP to consider bandwidth and delay in the metric calculation, so changing either bandwidth or delay impacts the calculation of the feasible distance and reported distance, and impacts the choice of feasible successor routes. Offset lists also change the metric, which in turn can change whether a route is an FS route. Link loading would impact the metrics, but not without changing the metric weights to nonrecommended values. Finally, vari-ance impacts which routes end up in the IP routing table, but it is not considered by EIGRP when determining which routes are FS routes. +6. C and E. The EIGRP metric calculation treats bandwidth and delay differently. For bandwidth, EIGRP takes the lowest bandwidth, in kbps, which is in this case 500 kbps. For delay, EIGRP takes the cumulative delay, which is 20100 per the various show interfaces commands. However, the show interfaces command uses a unit of microseconds, and the interface delay command and the EIGRP metric formula use a unit of tens-of-microseconds, making the delay that feeds into the formula be 2010. +7. C and E. R1, as a stub router with the connected option, still advertises routes, but only routes for connected subnets. R1 announces its stub attribute to R2, so R2 chooses to not send Query messages to R1, knowing that R1 cannot be a transit router for other subnets anyway. +8. D. EIGRP considers only successor and feasible successor routes. Each of those routes must have metrics such that variance * metric is less than the best route’s met-ric; the best route’s metric is called the feasible distance (FD). +9. B. Of the five options, show ip route eigrp all-links and show ip eigrp topology all-learned are not valid commands. Both show ip eigrp topology and show ip route eigrp can show at most successor and feasible successor routes. However, show ip eigrp topology all-links shows also nonfeasible successor routes, making it more likely to show all possible neighbors. +10. D and E. The two listed commands correctly configure EIGRP route filtering such that prefixes matched by the ACL’s permit clause will be allowed. All other prefixes will be filtered because of the implied deny all at the end of the ACL. The ACL permits numbers in the range 10.10.32.0–10.10.47.255, which leaves 10.10.48.0 and 10.10.60.0 unmatched by the permit clause. +11. B, C, and E. Sequence number 5 matches prefixes 10.1.2.0–10.1.2.255, with prefix lengths between 25 and 27, and denies (filters) those prefixes. This results in answer A being incorrect, because the prefix length (/24) is not in the correct range. Clause 15 matches prefixes 10.2.0.0–10.2.255.255, with prefix length exactly 30, matching answer C. Clause 20 matches only prefix 0.0.0.0 with length /0, so only a default route would match this entry. As a result, 10.0.0.0/8 does not match any of the three clauses. + + + + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 785 + +12. C. When used for route filtering, the route map action (permit or deny) defines the filtering action, and any referenced match commands’ permit or deny action just defines whether the prefix is matched. By not matching ACL 1 with a permit action, EIGRP does not consider a match to have occurred with clause 10, so it moves to clause 20. The prefix list referenced in clause 20 has a permit action, matching pre-fixes 10.10.10.0–10.10.11.255, with prefix lengths from 23 to 25. Both criteria match the prefix in question, making answer C correct. +13. B and C. Answer A is invalid. The ge value must be larger than /24 in this case, so the command is rejected. Answer B implies a prefix length range of 24–28, inclusive. Answer C implies a range of 25–32 inclusive, because no le parameter exists to limit the prefix length lower than the full length of an IPv4 subnet mask. The same logic applies with answer D, but with a range of 28–32, so this final list could not match prefix lengths of /27. +14. B. 10.1.0.0/18 implies a range of 10.1.0.0–10.1.63.255, which includes none of the four subnets. 10.1.64.0/18 implies a range of 10.1.64.0–10.1.127.255, which includes all subnets. 10.1.100.0/24 implies a range of 10.1.100.0–10.1.100.255, which leaves out two of the subnets. Finally, 10.1.98.0/22 does not actually represent a summary. Instead, 10.1.96.0/22 represents a range of 10.1.96.0–10.1.99.255, with 10.1.98.0 as listed in answer D being an IP address in that range. As such, Cisco IOS would actu-ally accept the command, would change the parameter from 10.1.98.0 to 10.1.96.0, and would not include the four listed subnets. +15. B. The ip summary-address command does reset neighborships, but only on the interface under which it is configured. After those neighborships come up, R1 will advertise the summary route, but none of the subordinate routes inside that sum-mary. The summary route will use a metric equal to the metric of the lowest metric subordinate route, approximately 1,000,000 in this case. +16. B and D. R2 has interfaces only in Class A network 10.0.0.0, so the auto-summary setting has no effect. R3 has interfaces in both Class A network 10.0.0.0 and Class B network 172.16.0.0, so auto-summary causes R3 to summarize all subnets of 172.16.0.0/16 as a summary route when advertising to R2. +17. D. The phrase quoted in the question means that R1 is using its route for Class A net-work 2.0.0.0 to decide where to send packets by default. R1’s route for network 2.0.0.0 must have 1.1.1.1 as its next-hop router. This phrase occurs when EIGRP has learned +a route for Class A network 2.0.0.0 that has been flagged as a candidate default route by another router. The router flagging a route as a candidate default route, using the ip default-network command, does not actually use the route as its default route. +18. C and E. With the suggested configuration style, the static route must first be con-figured statically, as shown in answer A. Then, either this route must be redistributed as a static route into EIGRP (answer B) or pulled into EIGRP by virtue of the network 0.0.0.0 EIGRP subcommand (answer D). The other two options have no effect on default route creation and advertisement. + + + + + + +From the Library of Alexey Evseenko +786 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Chapter 6 + +1. A. By default, IPv6 routing is not enabled on a router. To enable it, you issue the ipv6 unicast-routing command in global configuration mode. + +As a best practice, you should also enter ipv6 cef in global configuration mode (not router configuration mode) to enable Cisco Express Forwarding for IPv6. + +However, ipv6 eigrp is not a valid command. + +2. B. EIGRP uses the link-local address as the next hop for routing proto-cols. Based on R2’s MAC address, R2’s link-local address on Fa 0/0 will be +FE80::1311:11FF:FE11:1111. This value is derived by splitting the MAC, inserting FFFE, and flipping bit 7, making the initial hex 11 become hex 13. +3. B. General EIGRP commands (for example, metric, eigrp stub, and eigrp router-id) are configured under address-family configuration mode. + +Commands entered under interface configuration mode with a traditional EIGRP configuration (for example, authentication, bandwidth-percent, hello-interval, hold-time , passive-interface, and split-horizon) are entered under address-family-interface configuration mode with Named EIGRP. + +Commands having a direct impact on a router’s EIGRP topology (for example, auto-summary , maximum-paths, redistribute, and variance) are given under address-family-topology configuration mode. + +There is no address-family-global configuration mode. + +4. D. General EIGRP commands (for example, metric, eigrp stub, and eigrp router-id) are configured under address-family configuration mode. + +Commands entered under interface configuration mode with a traditional EIGRP configuration (for example, authentication, bandwidth-percent, hello-interval, hold-time , passive-interface, and split-horizon) are entered under address-family-interface configuration mode with Named EIGRP. + +Commands having a direct impact on a router’s EIGRP topology (for example, auto-summary , maximum-paths, redistribute, and variance) are given under address-family-topology configuration mode. + +There is no address-family-global configuration mode. + +5. B. EIGRP parameters configured under interface configuration mode with a traditional EIGRP configuration can be configured under address-family-interface configuration mode with Named EIGRP. To enter address-family-interface configuration mode for a specific interface, you can enter the af-interface interface_identifier command. + +However, if you want an interface setting to be applied to all interfaces, you can enter the af-interface default command. Although commands entered from this configuration mode are inherited by all router interfaces, you can go into address-family-interface configuration mode for specific interfaces to override any globally configured interface settings. + +None of the commands given in the question, other than af-interface default, are valid. + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 787 + +6. B. Even though Named EIGRP is configured quite differently than a traditional EIGRP configuration, the verification commands remain the same. Therefore, to view a router’s EIGRP for IPv4 topology table, you would issue the same show ip eigrp topology command that you would use with a traditional EIGRP for IPv4 configuration. + +Chapter 7 + +1. A and D. The wildcard mask is used for matching the prefix only, and not the prefix length. As such, 172.16.1.0 0.0.0.255 matches all addresses that begin with 172.16.1, and 172.16.0.0 0.0.255.255 matches all addresses that begin 172.16. Also, OSPF reviews the network command with the most specific wildcard masks (wildcard masks with the most binary 0s) first, so an interface IP address beginning with 172.16.1 matches the command that references area 8. +2. D. ABRs, by definition, connect the backbone area to one or more nonbackbone areas. To perform this function, a router must have at least one interface assigned to the backbone area and at least one interface assigned to a nonbackbone area. +3. B and C. First, for the two correct answers: show ip ospf interface brief explicitly lists all OSPF-enabled interfaces that are not passive. show ip protocols lists either the details of the configured network commands, or if configured using the ip ospf area command, it lists the interfaces on which OSPF is enabled. This command also lists the passive interfaces, so armed with interface IP address information, the list of OSPF-enabled nonpassive interfaces could be derived. Of the three wrong answers, show ip ospf database does not list enough detail to show the OSPF-enabled inter-faces. show ip route ospf lists only routes learned with OSPF, so if no routes use +a particular OSPF-enabled interface as an outgoing interface, this command would not indirectly identify the interface. Finally, an interface might be OSPF-enabled but with no neighbors reachable on the interface, so the show ip ospf neighbor com-mand might not identify all OSPF-enabled interfaces. +4. B and C. On a LAN, the non-DRs form fully adjacent neighborships with only the DR and BDR, giving R1 two neighbors in the FULL state. The other two neighbors settle into the 2-Way state. +5. C and D. The show ip ospf interface command displays a router’s OSPF Hello Interval setting for each enabled interface. The other listed commands do not display the timer. Also, OSPF routers do need to have matching Hello timers to become neighbors, so the neighborship would fail. +6. E. Table 7-5 in Chapter 7 lists the issues. For OSPF, Router IDs must be unique, the interfaces must not be passive, the dead timers must match, and the primary IP +addresses must be in the same subnet, with the same subnet mask. However, the pro-cess IDs, found in the router ospf process-id command, do not have to match. + + + + + + + + +From the Library of Alexey Evseenko +788 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +7. A. Frame Relay is a Layer 2 service and as such does not participate in customer routing protocols. Because the design uses a separate subnet per PVC, and one point-to-point subinterface per PVC/subnet, OSPF will use a point-to-point network +type. That means that the two routers on either end of a PVC will become neighbors, and become fully adjacent, meaning that the central-site router will have 100 fully adjacent neighborships. +8. D. The answer with area 0 virtual-link 4.4.4.4 cost 3 is incorrect, because the show command output lists a transit area of 1, but the answer’s area parameter refers to area 0 as the transit area. (There is also no cost parameter on the area virtual-link command.) The RID of the router on the other end of the virtual link, 4.4.4.4 per the show command output, does not have to be pingable for the virtual link to work. The cost of the virtual link is 3, but that cost is calculated as the cost to reach the other router through the transit area, so the command output listed with the ques-tion cannot be used to predict Fa0/1’s OSPF interface cost alone. However, because the output lists area 1 as the transit area, and because the neighbor RID is listed as 4.4.4.4, R1 will use the area 1 LSDB entries to calculate the cost to reach 4.4.4, a process that will include the area 1 Type 1 LSA for RID 4.4.4.4. +9. B. The area virtual-link command defines the virtual link, with the transit area—the area through which the virtual link passes—listed as the first parameter. The other parameter is the RID of the other router. Two of the wrong answers are not Cisco IOS commands. + +Chapter 8 + +1. D. As an ABR connected to areas 0 and 2, ABR2 will have LSDB entries for both area 0 and area 2. In area 0, ABR2 learns Type 1 LSAs from the four routers internal to area 0, plus ABR1, and plus 1 for the area 0 Type 1 LSA that ABR2 creates for itself. In area 2, ABR2 learns 1 each for the five routers internal to area 2, plus the 1 Type 1 LSA ABR2 created for itself inside area 2. The total is 12. +2. E. OSPF creates a Type 2 LSA for a subnet when the router interface connected to the subnet calls for the election of a designated router (DR) and at least two routers have discovered each other and elected a DR. Then, the DR creates and floods the Type 2 LSA. IOS by default does not elect a DR on point-to-point topologies. It does on router LAN interfaces. One answer states that one router only exists in the subnet, so it does not actually find a second router and elect a DR. In the other case, a DR and BDR have been elected, but the router described in the answer is the BDR, not the DR. So, none of the other answers is correct. +3. C. Each ABR, by definition, creates a single Type 3 LSA to represent a subnet known in one area to be advertised into another area. Assuming that 10.100.0.0 is a subnet in area 0, both ABR1 and ABR2 would advertise a Type 3 LSA into area 100. The show ip ospf database summary command specifically lists Type 3 network summary LSAs. +4. C. The Database Description (DD) packet lists a short LSA header but not the entire LSA. The Link State Request (LSR) packet asks the neighbors for a copy of an LSA. The Link State Update (LSU) holds the LSAs. LSAck simply acknowledges received LSAs, and Hello is used for neighbor discovery and neighbor state maintenance. + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 789 + +5. B and D. Because the subnet was stable before R5 arrived, the other routers will have elected a DR and BDR. OSPF does not preemptively elect a new DR or BDR, so R5 will be neither (DROther). As a result, R5’s messages to the DR will be sent to the 224.0.0.6 all-DR-routers multicast address, and the DR’s messages directed to R5 will be sent to the 224.0.0.5 all-SPF-router address. +6. E. R1, internal to area 1, can use LSAs only in the area 1 LSDB. R2’s Type 1 LSA exists only in area 2’s LSDB. The Type 2 LSA for subnet 10.1.1.0/24, if one exists, also only exists in area 2’s LSDB. R1 will use ABR1’s Type 1 LSA in area 1 to calcu-late the possible intra-area routes inside area 1, but R1 will use ABR1’s Type 1 LSA in area 1. Finally, the Type 3 LSA, created for 10.1.1.0/24 and flooded into area 1, is also needed to calculate the metric. +7. A and B. OSPF builds the SPF tree based on the topology information in Type 1 and Type 2 LSAs. Changes therefore require another SPF run. Changes to the other LSA types do not require an SPF calculation. +8. A and B. Because none of the interfaces have a bandwidth command configured, the only commands that can influence the OSPF cost are the auto-cost reference-bandwidth router subcommand and the ip ospf cost interface subcommand. To give +the output shown in the question, the interface cost could be set directly on all three interfaces listed. Alternatively, the reference bandwidth could be set (in router con-figuration mode) to cause one of the interface costs to be as shown in the output, with the other two interfaces having their costs set directly. + +For the wrong answers, the ip ospf cost interface s0/0/0.1 router subcommand does not exist—instead, it is an interface subcommand. An auto-cost of 64700, used as the numerator in the ref-bw/bandwidth cost calculation, does not result in any of the three listed interface costs. + +For the two correct answers, with a default bandwidth of 1544 (kbps) on the serial subinterfaces, a reference bandwidth of 1000 (Mbps) implies the math 1,000,000 / 1544, for an interface cost of 647. With a default bandwidth of 100,000 kbps (100 Mbps) on Fa0/0, a reference bandwidth of 2000 (Mbps) implies math of 2000 / 100 = 20. +9. A, B, and C. OSPF uses Types 1, 2, and 3 for calculating routes internal to the OSPF domain. OSPF uses Types 4, 5, and 7 for external routes redistributed into the OSPF domain, as discussed in Chapter 10, “Route Redistribution.” + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +790 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Chapter 9 + +1. C. The output lists all of B1’s routes for subnets within the range 10.1.0.0– 10.1.255.255 whose prefix lengths are longer than /16. One answer lists subnet 10.2.2.0/24, which is not in this range, so the output cannot be used to confirm or deny whether the subnet was filtered. B1’s route for 10.1.2.0/24 is an intra-area +route by virtue of not listing an inter-area (IA) code by the route. Type 3 LSA filter-ing only filters Type 3 LSAs, which routers use to calculate interarea routes, so the output tells us nothing about any filtering of 10.1.2.0/24. The output shows a single interarea route for 10.1.3.0/24, so at least one ABR has flooded a Type 3 LSA for this route. Additionally, the output confirms that at least one ABR flooded a Type 3 LSA for 10.1.3.0/24, or the output would not show an IA route for 10.1.3.0/24. So, the Type 3 LSA for 10.1.3.0/24 was not filtered by both ABRs. +2. C. When referenced from a distribute list, OSPF filters routes from being added to that router’s IP routing table but has no impact on the flow of LSAs. As such, neither A nor B is correct. An OSPF distribute-list command does attempt to filter routes from being added to the IP routing table by OSPF, so the two answers that mention the IP routing table might be correct. Sequence number 5 matches prefixes from 10.1.2.0 through 10.1.2.255, with prefix lengths in the range 25–27, and denies (fil-ters) those prefixes. So, the prefix list will match 10.1.2.0/26 with the first line, with a deny action. The 10.1.2.0/24 subnet does not match the first line of the prefix list, but it does match the third line, the match all line, with a permit action. Because 10.1.2.0/26 is matched by a deny clause, this route is indeed filtered, so it is not added to R1’s IP routing table. 10.1.2.0/24, matched with a permit clause, is allowed and would be in the IP routing table. +3. A. When referenced from an area filter-list command, OSPF filters Type 3 LSAs created on that router, preventing them from being flooded into area 1 (per the configuration command). As an ABR, R1 would calculate intra-area routes to these area 0 subnets, so this filtering will have no effect on R1’s routes. Sequence number 5 matches prefixes from 10.1.2.0 through 10.1.2.255, with prefix lengths in the range 25–27, and denies (filters) those prefixes. So, the prefix list will match 10.1.2.0/26 +with the first line, with a deny action. The 10.1.2.0/24 subnet does not match the first line of the prefix list, because the prefix length does not match. However, it does match the third line, the match all line, with a permit action. By matching subnet 10.1.2.0/26 with a deny action, the filter list does prevent R1 from flooding a Type 3 LSA for that subnet. By matching 10.1.2.0/24 with a permit action, R1 does not filter the Type 3 LSA for that subnet. +4. B and D. The area range command does not cause a failure in neighborships. Because at least one intra-area subordinate subnet of 10.1.0.0/16 exists in R1, R1 both creates a summary route for 10.1.0.0/16 and stops advertising LSAs for the (three) subordinate subnets. By default, the metric of the summary is the metric of the lowest-metric component subnet. + + + + + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 791 + +5. D. The show ip ospf database summary command lists only Type 3 LSAs. The summary-address command creates Type 5 LSAs on ASBRs, ruling out one answer. The output does not specify whether the LSA was created as a summary route; all references to the word “summary” refer to Type 3 Summary LSAs. If created by an area range command, the metric defaults to be the best metric of all subordinate subnets, but it can also be explicitly set, ruling out another of the possible answers. In short, this LSA can represent a route summarized by the area range command, but that fact cannot be proved or disproved by the output as shown. +6. B. Without the always parameter, the default-information originate command gen-erates an LSA for a default route, with prefix 0.0.0.0/0, but only if its own IP routing table has a route for 0.0.0.0/0. It does not flag another LSA as being used as a candi-date default route. +7. C and D. Both types of NSSA stubby areas allow the redistribution of external routes into an area, but these routes are advertised as Type 7 LSAs. As a totally NSSA, the ABR should flood no Type 5 LSAs into the area and flood no Type 3 LSAs into the area, except for the Type 3 LSAs used to advertise the default route into the area. As such, a router internal to a totally stubby area should see zero Type 5 LSAs and a small number of Type 3 LSAs for the default route(s) advertised by the ABR(s). +8. B. The stub keyword means either a stub area or a totally stubby area. The no-summary command means that the area is totally stubby. + +9. B. When using OSPFv3’s Address Family configuration to support both IPv4 and IPv6, LSAs for both IPv4 and IPv6 networks populate a single link-state database. The database can be viewed with the show ospfv3 database command. +10. D. With Named EIGRP, all EIGRP configuration can be done under a single EIGRP virtual instance. However, with an OSPFv3 Address Family configuration, you have to enter interface configuration mode to instruct an interface to participate in the routing process. The command (issued in interface configuration mode) is ospfv3 process_id ipv6 area area_number. +11. C. OSPFv3 introduces two LSAs, Type 8 LSAs (called Link LSAs) and Type 9 LSAs (called Intra-Area Prefix LSAs). + +The Type 8 LSAs, called Link LSAs, only exist on a local link, where they are used by a router to advertise its link-local address to all other routers on the same link. Additionally, the Type 8 LSA provides a listing of all IPv6 addresses associated with a link to routers on that link. OSPFv3 also uses the Type 8 LSA to set option bits for a specific network’s LSA. + +A Type 9 LSA can send information about IPv6 networks (including stub networks) attached to a router (similar to the Type 1 LSA for IPv4 networks). Additionally, a Type 9 LSA can send information about transit network segments within an area (similar to the Type 2 LSA for IPv4 networks). + + + + + + +From the Library of Alexey Evseenko +792 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Chapter 10 + +1. D. The three incorrect answers list typical reasons for using route redistribution. The correct answer—the least likely reason among the answers for using route redistribu-tion—lists a problem for which an OSPF virtual link is often used. Route redistribu-tion could be attempted to solve a problem with a discontiguous OSPF area, but the redistribution completely changes the LSAs that would have otherwise been known and could have negative impacts on route summaries and cause routing loops, and have other problems as well. +2. B and D. For a router to redistribute routes between two routing protocols, the router must have both routing protocols configured, have a working link into each routing domain, and configure redistribute commands under each routing process. The redistribute command, issued in routing protocol configuration mode, pulls routes into that routing process from another routing process as referenced on the redistribute command. +3. B and C. Because the metrics come from a different routing protocol than EIGRP, the metric must be set. The metric must be set with five components; EIGRP will then use those components as it would for an internal route. The metric components can be set as listed in the two correct answers, plus using a route map as referenced by the redistribute command. +4. C. This output is the external data section of a detailed view of an EIGRP topology table entry for an external route. This output confirms that this route was redis-tributed into EIGRP. If R1 were the redistributing router, the output would include the phrase “(this system)”; this example does not include that notation. The output means that on the router that did the redistribution, the route was redistributed from OSPF process 1, and the OSPF metric was 64. R1’s metric is not based on the OSPF metric of the route. +5. B. The redistribute ospf command will attempt to redistribute OSPF routes and connected routes from interfaces on which OSPF is enabled. The metric components include 1000 kbps (or 1 Mbps), 100 tens-of-microseconds (or 1000 microseconds), 10 for the loading, 1 for the reliability, and 1500 for MTU. The EIGRP version of the redistribute command does not include a subnets option. +6. A and C. Because the routes come from OSPF and feed into OSPF, the metrics can be set with the usual tools or the metric can default. When taking routes from OSPF into another OSPF process, the default metric is taken from the source route’s OSPF cost. Alternatively, the metric can be set for all routes, regardless of the route source, using the default-metric OSPF subcommand. The metric transparent keywords can-not be used for an OSPF redistribute command. +7. D. This command lists the output of Type 4 Summary ASBR LSAs. The LSID identi-fies the redistributing ASBR (9.9.9.9). The advertising router is the ABR that created and flooded the LSA (3.3.3.3), and the metric is the ABR’s best metric route to reach the ASBR. + + + + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 793 + +8. D. Routers add internal and external costs for E1 routes and use only external costs for E2 routes, so the cost for the route through R22 will always be lower. However, for a given prefix/length, OSPF always prefers intra-area routes first, then interarea, then E1, and finally, E2, all regardless of metric. +9. E. Because OSPF does not use hop count as a metric, the information about the number of hops is not available in OSPF routes in the IP routing table. The other answers list items that can be matched with the route map match subcommand. +10. A. The deny clauses in the route map mean that the route map will filter routes matched by that clause. The permit or deny action of the referenced ACLs just defines whether the route is matched. So, routes permitted by ACL “two” will be matched and then filtered because of the route map clause deny action. Routes denied by ACL “one” simply do not match the route map clause numbered 10; +such routes might or might not be redistributed depending on the next two clauses. Clause number 100 does not have a match command, meaning that it matches all routes not otherwise matched, with a permit action, allowing these routes to be redistributed. +11. A and C. The problem states that R1 has learned OSPF intra-area routes for 10.1.1.0/24, so show ip route will display that subnet. As an intra-area route based on a Type 2 LSA, the show ip ospf database command lists the summary of the LSAs, including the 10.1.1.0 subnet number for that Type 2 LSA. However, because the redistribution filtering discards subnet 10.1.1.0/24, this value will not be included in the EIGRP topology table. +12. B. The external 2 parameters on the redistribute command act as matching logic. Only routes from the source routing protocol (in this case OSPF 2) that match this extra logic will be considered for redistribution by this redistribute command. The set metric-type type-1 route map subcommand sets the route type as it is injected into the destination routing protocol (in this case, OSPF 1); this logic is not used for matching the source routes. The routes permitted by ACL 1 will be redistributed, but only those that are also E2 routes from the (source) OSPF 2 domain. The redistribute function will not change the attributes of routes inside a single routing domain, but only in the destination routing domain (OSPF 1), so the configuration has no effect on the OSPF 2 routes that remain in OSPF 2. +13. C. EIGRP, by default, sets a different AD for internal (90) and external (170) routes. The rest of the answers are accurate regarding default settings. + +14. A. All the answers list reasonable options in some cases, but the only feature listed that is useful with all three routing protocols is the route tag feature. RIPv2 does not support the concept of differentiating between internal and external routes, so the two answers that suggest setting administrative distance (AD) based on the route type (internal or external) could not be used in all three routing domains, as required by the question. All three routing protocols support setting route tags and setting the AD per route. However, because RIPv2 cannot match based on the route type (internal/external), the option to set the route tags is the only option that applies to all three routing domains. + + + + +From the Library of Alexey Evseenko +794 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +15. D. AD can be used to prevent the domain loop problem with two routing domains by making each routing protocol’s AD for internal routes be better (lower) than the other routing protocol’s AD for external routes. RIP uses AD 120 for all routes, with no distinction of internal or external. As such, OSPF’s internal default AD settings of 110 meet the requirement that OSPF’s internal AD (110) is better than RIP’s external (120). However, RIP’s default of 120 is not better than OSPF’s default for externals (110), so the distance ospf external 180 command changes that setting to meet both requirements. The three wrong answers, while syntactically valid, do not help meet the requirements. +16. E. Route tags are unitless integers that can be given to a route and even passed between different routing protocols by routers that perform redistribution. + +Chapter 11 + +1. B and C. Cisco Express Forwarding (CEF) maintains its information in two tables, the Adjacency Table (which contains information about Layer 2 adjacencies) and the Forwarding Information Base (FIB) (which contains Layer 3 information). The Routing Information Base (RIB) is a data structure used by a routing protocol such as OSPF. The ARP Cache contains IP address to MAC address mappings. Although information from the ARP Cache is used to help populate the Adjacency Table, the ARP Cache itself is not a CEF table. +2. D. To globally enable CEF on a router, use the ip cef command in global configura-tion mode. The ip flow egress interface configuration mode command is used to enable outbound NetFlow. The ip route-cache cef interface configuration mode command is used to enable CEF on an individual interface, if CEF has already been globally enabled on the router. The no ip route-cache interface configuration mode command is used to enable process switching on an interface. +3. A and C. PBR supports processing packets on an interface, for the inbound direction only. The referenced route map causes PBR to attempt policy routing of packets that match a permit clause in the route map. +4. B and E. Packets created by Telnet use TCP, so the packets will match ACL 101 with a permit action. PBR will match the only route map clause shown in the configura-tion, with the permit route map clause listing a set command. The set command lists S0/0/1 as the outgoing interface and without a default parameter. So, Router R1 will first attempt to forward the packet based on the set command (interface S0/0/1), but if the interface is down, R1 will then try to forward based on the IP routing table (interface S0/1/1). +5. D. The output from the show ip policy command shows the interfaces on which PBR has been enabled and the name of the route map enabled for PBR on each interface. For the purposes of this question, the output tells us the interfaces on which PBR has been enabled. Two answers mention packets exiting the interface. Therefore, these answers cannot be correct, because PBR applies to packets entering an inter-face. For the two interfaces that mention inbound packets, one suggests that all packets will be forwarded per the PBR configuration; some might not be forwarded + + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 795 + +per PBR, depending on the configuration of the route map. The correct answer spe-cifically mentions that PBR will consider all packets with PBR, which is the more accurate statement about PBR operations. +6. A and B. The IP SLA feature focuses on IP traffic. Therefore, Cisco IOS does not include Novell’s older IPX protocol as part of IP SLA. IP SLA uses SNMP MIBs to store statistics, but it does not use SNMP as an operation. +7. C. The three lines shown create the operation number (first command), define the operation (second command), and start the operation (third command). All com-mands are correct. After the operation is started, IP SLA stores the data in the RTTMON MIB; no additional configuration is necessary. +8. D. The up timer on the tracking object defines how long to wait, when in a down state, after seeing the IP SLA object transition to an OK state. Similarly, the down timer defines how long to wait, when in an OK state, after seeing the IP SLA object move to a down state, before moving the tracking object to a down state. +9. D. Both Cisco EVN and VRF-Lite allow a single physical router to run multiple vir-tual router instances, and both technologies allow routes from one VRF to be selec-tively leaked to other VRFs. However, a major difference is the way that two physical routers interconnect. With VRF-Lite, a router is configured with multiple subinter-faces, one for each VRF. However, with Cisco EVN, routers interconnect using a VNET trunk, which simplifies configuration. + +Chapter 12 + +1. D. A default route is specified with an IP address/mask combination of 0.0.0.0 0.0.0.0. As a best practice, you should point a default route to a next-hop IP address, rather than an Ethernet interface, because specifying an Ethernet interface can gener-ate an excessive number of ARP requests and hurt router performance. +2. C. The command used to instruct an interface to obtain its IP address information from a DHCP server is ip address dhcp. All the other options are not valid commands. + +3. A. The no ip dhcp client request router command can be used to prevent a router from automatically installing a static default route based on default gateway informa-tion learned from a DHCP server. None of the other options are valid commands. +4. C. The administrative distance (AD) of a static default route automatically installed in a router based on default gateway information provided by a DHCP server is 254. This makes the default static route a “floating static route,” meaning that it will only be used if another routing source (with a lower AD) does not know of a default static route. +5. C. Dynamic NAT (DNAT) allows an inside local address to be dynamically associated with an inside global address specified in a pool of available inside global addresses. Static NAT (SNAT) specifies an inside global address to be associated with an inside local address. Port Address Translation (PAT) allows multiple inside local addresses to use a single inside global address, for use when communicating on the Internet. MAT is not a valid variant of NAT. + + + +From the Library of Alexey Evseenko +796 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +6. B. An outside global address represents a device outside of a network with a globally routable address. In this scenario, the web server’s IP address of 203.0.113.10 would be an outside global address. + +An inside local address represents a device inside of a network with an address that is not routable on the public Internet. In this scenario, the laptop’s IP address of 10.1.1.241 would be an inside local address. + +An inside global address represents a device on the inside of our network with an address that is a globally routable address. In this scenario, the laptop’s translated address of 198.51.100.54 would be an inside global address. + +An outside local address represents a device on the outside of a network that has an address that is not routable on the public Internet. For example, if NAT were being per-formed at a remote site, the destination device at the remote site would have an outside local address. In the scenario presented in this question, there is no outside local address. +7. A. An outside global address represents a device outside of a network with a globally routable address. In this scenario, the web server’s IP address of 203.0.113.10 would be an outside global address. + +An inside local address represents a device inside of a network with an address that is not routable on the public Internet. In this scenario, the laptop’s IP address of 10.1.1.241 would be an inside local address. + +An inside global address represents a device on the inside of our network with an address that is a globally routable address. In this scenario, the laptop’s translated address of 198.51.100.54 would be an inside global address. + +An outside local address represents a device on the outside of a network that has an address that is not routable on the public Internet. For example, if NAT were being per-formed at a remote site, the destination device at the remote site would have an outside local address. In the scenario presented in this question, there is no outside local address. + +Chapter 13 + +1. B and E. The private IPv4 address space consists of Class A network 10.0.0.0, Class B networks 172.16.0.0–172.31.0.0, and the 256 Class C networks that begin 192.168. + +2. B. ICANN and IANA manage the assignment of public IPv4 address space such that large address blocks (often called CIDR blocks) exist in a particular geography or are assigned to particular ISPs. As such, Internet routers can more easily create summary routes to help keep the routing table small in the Internet. 200.1.2.0/24 would likely also be allocated to some registrar, ISP, or customer in Asia. Because of the large route summaries, in this case possibly a summary for 200.0.0.0/8, routers in North America would not see an increase in the size of their routing tables. +3. A. The router in ASN 22, R22, advertises the BGP update with (at least) 22 in the AS_Path Path Attribute (PA). When R1 advertises the route to R2, also in ASN 11, R1 does not add an ASN. As a result, R2’s AS_Path has at least ASN 22 and not ASN 11. + + + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 797 + +4. A and C. The public range of 16-bit BGP ASNs is 1 through 64,495. + +5. D. The question asks which answers are true about the eBGP peer but also not true about an iBGP peer. Both iBGP and eBGP use TCP port 179. An eBGP peer uses a different ASN than the local router, by definition, making that answer incorrect. The correct answer refers to the fact that an eBGP peer adds its own ASN to the BGP AS_Path PA before sending routing information to another router, whereas iBGP peers do not. +6. A. Although using BGP does avoid some static configuration at the enterprise and the ISP, the primary reason to consider using BGP in the enterprise is to influence and react to Path Attributes for the purpose of choosing the best path. Typically, engineers do not redistribute BGP routes into the IGP because of scalability prob-lems. And although it can be interesting to monitor the size of the Internet BGP table, it is not a primary motivation for choosing to use BGP on a router. +7. C and D. The term “homed” makes reference to a single-homed ISP, and “multi-homed” references multiple ISPs. The terms “single” and “dual” refer to the number of connections to each ISP. +8. B and C. The router bgp command lists the local ASN, and the neighbor remote-as command lists the neighbor’s ASN. Because the neighbor relationship uses the IP addresses on the common link, the routers do not need to identify the update source interface, because each will default to use their S0/0 interfaces (in this case) as the update source. +9. D. Three of the commands list valid commands. The neighbor 2.2.2.2 multihop 2 command is syntactically incorrect; it should be neighbor 2.2.2.2 ebgp-multihop 2. + +10. D. The show ip bgp command lists the BGP neighbor state in the last column of output, listing the literal state, unless in an established state. In that state, the output lists the number of prefixes learned from the neighbor, so a numeric value implies an established state. +11. A and D. The output lists R2’s local ASN as ASN 11, a value that is configured in the router bgp asn command. The line for neighbor 1.1.1.1 lists that router’s ASN as 1, so a neighbor 1.1.1.1 remote-as 1 command should exist on R2 instead of the neighbor 1.1.1.1 remote-as 11 command. The state for neighbor 1.1.1.1 lists “Idle (Admin),” implying that the neighbor 1.1.1.1 shutdown command has been configured. The other answer lists a nonexistent command. +12. A. The BGP Update message lists a set of PAs, plus any prefixes/lengths that use those PAs. It can also list withdrawn routes in the same Update message as newly advertised routes. It can also list multiple prefixes in a single Update message. +13. C. The “Known via” text refers to the local router’s (R1’s) router bgp command, which identifies the local router’s ASN. The rest of the output does not identify the neighboring ASN, nor the rest of the AS_Path details. It does list that the route is external, with the text “type external” and the AS Hops (which is the AS_Path length). + + + + + +From the Library of Alexey Evseenko +798 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +14. A. The third character in each line for each router is either blank, meaning that the route is an eBGP route, or an “i,” meaning an iBGP-learned route. The contents of the AS_Path can be determined (1, 2, 3, 4), but the answer about AS_Path does not sug-gest four ASNs. The best route for each prefix has a “>” in the second character, and this route does not. +15. D. The network command will take the route from the IP routing table and put the equivalent into the BGP table, if that exact route exists. The output does not show a route for 130.1.16.0/20, so the network 130.1.16.0 mask 255.255.240.0 command does not match a specific route. The other answer with a network command is syn-tactically incorrect. Redistribution without aggregation would redistribute the three routes, but all three subordinate routes would be advertised into eBGP. By also using BGP route summarization, a single route for 130.1.16.0/20 can be advertised. + +Chapter 14 + +1. C. R1 needs to be configured with router bgp 1, neighbor 2.2.2.2 remote-as 1, and neighbor 2.2.2.2 update-source loopback1. The neighbor 2.2.2.2 ibgp-multihop 2 and neighbor 2.2.2.2 ibgp-mode commands are simply unsupported commands. The neighbor 1.1.1.1 remote-as 1 command has correct syntax and is used as a command in R2’s configuration but not on R1. The neighbor 2.2.2.2 remote-as 2 command has the correct syntax but with the wrong ASN (2 instead of 1). +2. D. The small letter “i” in the third character position implies that the route was learned with iBGP. Of the five lines, four have an “i” in the third column. + +3. B and C. The line reading “1.1.1.1 from 2.2.2.2...” implies the BGP RID of the neigh-bor is 1.1.1.1, with neighbor ID—the IP address on the local router’s neighbor command—of 2.2.2.2. The end of the output shows that the route is internal (iBGP learned) and is best, so both the > and i will be displayed for this route by the show ip bgp command. Finally, the output does not identify the local ASN, although it does list the AS_Path of the route (1, 2, 3, 4). +4. B. By default, when a router advertises an iBGP route, it leaves the Next-Hop PA unchanged. By default, R2’s next hop for routes learned from I2 will be I2’s IP address used on the R2-I2 neighbor relationship. +5. A and C. The enterprise core routers need to know which exit point (R1 or R2) is best; the correct answers supply those routes to the routers internal to the company. Note that redistribution from BGP into the IGP is not recommended, but it does defeat this particular problem. +6. B. The show ip bgp neighbors 2.2.2.2 advertised-routes command does list the post-outbound-filter BGP Update; however, the user did not issue a clear command, so the filter has not yet taken effect. As such, the output still lists the original three prefixes as if the filter had not yet been applied. +7. B, D, and E. The neighbor distribute-list out command refers to an ACL, but for the ACL to match on both prefix and prefix length, the ACL must be an extended ACL. The neighbor filter-list command refers to an AS-path filter and cannot match based on prefix/length. + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 799 + +8. A and B. The router resets the BGP neighborship when performing a hard reset of the peer. See Table 14-3 in the chapter for a list of several variations of the clear command and whether they perform a hard or soft reset. +9. B. Weight and Local_Pref were created for the purpose of giving engineers tools to influence the BGP best-path choice. AS_Path was created for loop avoidance, but AS_Path length can also be manipulated (for example, with AS_Path prepend) to influence the best-path choice. Although the Origin PA can be changed by configu-ration for the purpose of influencing the best-path decision, the intent of this PA is to identify the source from which the route was introduced into BGP. Additionally, the best-path algorithm considers the Origin PA after the other PAs listed in the answers, making Origin the least useful of these answers for influencing path choice. +10. A. Of the items listed in the question, Weight is the first one considered in the best-path algorithm, with a bigger Weight being better. As a result, Route 1 is the better route of the two. +11. B. Of the items listed in the question, Weight is the first one considered in the best-path algorithm, and it is a tie. The next item considered, Local Preference, uses bigger-is-better logic, so Route 2 will be considered best. +12. B and D. Weight, a Cisco-proprietary feature of BGP on Cisco routers, cannot be transmitted in a BGP Update, so setting Weight on an outbound route map at the ISPs will have no effect. Also, the goals call for setting Weight for all routes from an ISP to the same number, so creating a prefix list to match a subset of reachable pre-fixes, in this case all Class C networks, is not useful. However, two methods of con-figuring Weight do exist: the neighbor weight command and configuring an inbound route map with a set weight command in the route map. +13. B. The output shows the results of AS_Path prepending. The repetitive 1s cannot mean that the route has been advertised into and out of the same ASN repeatedly because loop prevention would have prevented such an advertisement. With AS_Path prepending, the neighboring ASN typically adds its own ASN to the end of the AS_Path (as listed on the left of the output). +14. C. The command lists the administrative distance as the first number inside the square brackets and the MED values as the second number in brackets. The AD of 20 implies an eBGP route instead of iBGP. The output says nothing about the Weight or AS_Path length. + +Chapter 15 + +1. B. With Stateless Address Autoconfiguration (SLAAC), an ISP router could send Router Advertisements (RA), which advertise an IPv6 prefix, on the link connecting to a customer router. Stateless DHCPv6 uses SLAAC for IP address assignment and a DHCPv6 server to provide additional configuration options. Stateful DHCPv6 uses a DHCPv6 server for address assignment, as opposed to SLAAC. DHCPv6 Prefix Delegation (DHCPv6-PD) allows a DHCPv6 server to assign a collection of IPv6 net-works to a DHCPv6 client (such as a router). However, stateless SLAAC is not a valid option. + + + +From the Library of Alexey Evseenko +800 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +2. D. The ipv6 route ::/0 next_hop_ipv6_address command is used to create a default static IPv6 route. + +3. A, B, and D. In addition to the deny ipv6 any any implicit command (which blocks all IPv6 traffic) at the very bottom of an IPv6 ACL, the permit icmp any any nd-na and permit icmp any any nd-ns commands are used to permit Neighbor Discovery – Neighbor Advertisements and Neighbor Discovery – Neighbor Solicitations. These Neighbor Discovery commands are required for IPv6 to function properly. +4. B. When configuring IPv6 routing over an IPv4 BGP session, you need to create a route map that specifies the local router interface’s IPv6 address as the next-hop IPv6 address to advertise to its neighbor. However, this step is not a requirement when configuring IPv6 routing over an IPv6 BGP session. +5. A, C, and D. The show bgp ipv6 unicast summary command displays several valu-able pieces of information, including the local router’s BGP router ID, a list of con-figured BGP neighbors, and the AS of configured BGP neighbors. However, while the show bgp ipv6 unicast summary command does not list IPv6 routes known to the BGP table, the show bgp ipv6 unicast command does. +6. A and B. The only valid options after ipv6 prefix-list LIST1 seq 10 permit 2000::/16 are le (meaning less than or equal to) and ge (meaning greater than or equal to). The number of bits in the prefix length then follows those options. +7. C. The AS path length and weights are the same for both next hops. However, the next-hop IPv6 address of 2000:3::2 has a higher Local Preference (150) than 2000:2::2 (50). Therefore, 2000:3::2 is chosen as the best next hop (as indicated with the “>” sign). Also, while having a lower router ID can cause BGP to select a best path, it is used as a tiebreaker, which is not needed in this example. + +Chapter 16 + +1. B and D. Unicast Reverse Path Forwarding (uRPF) can help prevent IP spoofing attacks by checking the source IP address of received traffic and verifying that the traffic is arriving on the interface that would be used to send traffic to that IP +address. ACLs can also be used to help prevent IP spoofing attacks by denying traf-fic coming in on an interface having a source address that lives off of a different interface. AAA is a technology that is used to authenticate users, authorize what they can do, and keep a log of what they did. However, AAA does not protect against IP spoofing attacks. CAR (Committed Access Rate) is a legacy quality of ser-vice (QoS) policing mechanism that does not protect against IP spoofing. +2. B. Hot Standby Router Protocol (HSRP) is a first-hop redundancy protocol that pro-vides router redundancy. Specifically, HSRP can have two or more routers capable of servicing a single IP address, and that IP address can be used as the default gateway IP address for devices residing on a subnet connected to the HSRP routers. SNMP is a network management protocol. AAA is a technology that is used to authenticate users, authorize what they can do, and keep a log of what they did. TACACS+ is a type of server that can be used with AAA. + + + + +From the Library of Alexey Evseenko +Appendix A: Answers to the “Do I Know This Already?” Quizzes 801 + +3. B and C. A periodic time-based ACL can specify a recurring time period during which the ACL will be active. An absolute time-based ACL can specify a specific starting and ending time and date (or just an ending time and date). A reflexive ACL contains temporary entries that are created when a session begins. There is no “adap-tive” ACL. +4. D. An infrastructure ACL is typically an extended ACL that is applied to routers residing on the outer edges of an enterprise network. The primary purpose of this ACL is to prevent malicious traffic from entering the enterprise. A time-based ACL is an ACL that specifies a time period during which the ACL is active. A reflexive ACL contains temporary entries that are created when a session begins. “Absolute” is a type of time-based ACL. +5. A and C. Of the options listed, only host name and domain name are used by a router when generating an RSA key pair. + +6. D. Type 7 password encryption is a very weak encryption, and it uses the Vigenere cipher. A Type 0 password has no encryption. A Type 4 password is represented by an SHA-256 hash value, and a Type 5 password is represented by an MD5 hash value. +7. B. Unicast Reverse Path Forwarding (uRPF) has three modes of operation: strict mode, loose mode, and VRF mode. In strict mode, a router not only checks to make sure that the source IP address of an arriving packet is reachable, based on the router’s FIB, but the packet must also be arriving on the same interface that the +router would use to send traffic back to that IP address. In loose mode, a router only verifies that the source IP address of the packet is reachable, based on the router’s FIB. VRF mode is similar to loose mode, in that the source IP addresses are checked against the FIB of a specific VRF. There is no auto or desirable uRPF mode. +8. B and D. TACACS+ and RADIUS are each protocols that can be used by a AAA server. TACACS+ uses TCP, while RADIUS uses UDP. TACACS+ encrypts an entire packet, while RADIUS only encrypts a password. TACACS+ offers basic account-ing functionality. However, RADIUS offers robust accounting. Also, TACACS+ is a Cisco-proprietary protocol, while RADIUS is an open standard protocol. + +Chapter 17 + +1. A and C. Cisco IOS supports both plain text and hashing authentication for neigh-boring routers to authenticate themselves to one another. Plain text authentication sends a shared secret key across a network in clear text. However, hashing authenti-cation sends the hash value of a key across a network, as opposed to the key itself. Therefore, hashing authentication is considered more secure. There is no support for two-factor or biometric authentication to authenticate neighboring routers. +2. C. A key string specifies a preshared key to be used between routers. Therefore, the key string must match on two routers for them to mutually authenticate. The key chain name and key number values are locally significant and do not have to match on a neighboring router. Also, as long as a matching key on each router is currently active, the specific send and receive lifetimes do not have to match on mutually authenticating routers. + + + +From the Library of Alexey Evseenko +802 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +3. B and C. Plain text authentication is not supported by Named EIGRP, nor is Password Authentication Protocol (PAP), which might be found on WAN connec-tions using the Point-to-Point Protocol (PPP). Named EIGRP does support both MD5 and SHA hashing authentication. Traditional EIGRP does not support SHA hashing authentication, but does support MD5 hashing authentication. +4. A. A key chain, which consists of one or more key numbers each of which can be assigned a key string, can be viewed with the show key chain Cisco IOS command. None of the other options are valid Cisco IOS commands. +5. B. OSPF can have authentication enabled at the area level (in router configuration mode) or at the interface level (in interface configuration mode). The question states that authentication is functioning and is using MD5 hashing, but there is no area 0 authentication message-digest command in router configuration mode. Therefore, OSPF MD5 authentication must be enabled in interface configuration mode, which is done with the ip ospf authentication message-digest command. +6. A and B. Authentication is not a feature natively built into OSPFv3. However, OSPFv3 can leverage IPsec for authentication (and even encryption). As a result, both the MD5 and SHA hashing algorithms can be used. Plain text authentication is not supported by OSPFv3, nor is Password Authentication Protocol (PAP), which might be found on WAN connections using the Point-to-Point Protocol (PPP). +7. C. BGP only supports MD5 for neighbor authentication. Neither plain text nor SHA is supported, and Diffie Hellman Group 1 is an approach to exchanging shared secret keys over an untrusted network. +8. C. Unlike OSPF and EIGRP, which can dynamically find neighbors through multi-cast, BGP requires neighbors to be statically configured. Therefore, BGP is less sus-ceptible to a malicious user adding a router to a network and using that router to cor-rupt the routing table of production routers. However, after a session (which is TCP-based) is established between two BGP neighbors, a malicious user could attempt to do session hijacking to take over the existing BGP neighborship. + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +APPENDIX B + + + + + + +ROUTE Exam Updates + + +Over time, reader feedback allows Cisco Press to gauge which topics give our read-ers the most problems when taking the exams. To assist readers with those topics, the authors create new materials clarifying and expanding upon those troublesome exam +topics. As mentioned in the Introduction, the additional content about the exam is con-tained in a PDF document on this book’s companion website, at www.ciscopress.com/ title/9781587205590. + +This appendix is intended to provide you with updated information if Cisco makes minor modifications to the exam upon which this book is based. When Cisco releases an entirely new exam, the changes are usually too extensive to provide in a simple update appendix. In those cases, you might need to consult the new edition of the book for the updated content. + +This appendix attempts to fill the void that occurs with any print book. In particular, this appendix does the following: + +■ Mentions technical items that might not have been mentioned elsewhere in the book + +■ Covers new topics if Cisco adds new content to the exam over time + +■ Provides a way to get up-to-the-minute current information about content for the exam + + +Always Get the Latest at the Companion Website + +You are reading the version of this appendix that was available when your book was printed. However, given that the main purpose of this appendix is to be a living, changing document, it is important that you look for the latest version online at the book’s com-panion website. To do so, follow these steps: +Step 1. Browse to www.ciscopress.com/title/9781587205590. + +Step 2. Select the Appendix option under the More Information box. + +Step 3. Download the latest “Appendix B” document. + + + + + + + + + +From the Library of Alexey Evseenko +806 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Note Note that the downloaded document has a version number. Comparing the version of the print Appendix B (Version 1.0) with the latest online version of this appendix, you should do the following: + +■ Same version: Ignore the PDF file that you downloaded from the companion website. + +■ Website has a later version: Ignore this Appendix B in your book and read only the latest version that you downloaded from the companion website. + + +Technical Content + +The current version of this appendix does not contain any additional technical coverage. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +APPENDIX C + + +Conversion Tables + + + + + + +This appendix lists two conversion tables for reference when studying: + +■ Hex-to-decimal + +■ Decimal-to-binary + +Use these tables for learning; however, such tables will not be available on the exam. + +Table C-1 Hex-to-Decimal Conversion Table + +Hex Decimal +0 0 + +1 1 + +2 2 + +3 3 + +4 4 + +5 5 + +6 6 + +7 7 + +8 8 + +9 9 + +A 10 + +B 11 + +C 12 + +D 13 + +E 14 + +F 15 + + + + + + + + +From the Library of Alexey Evseenko +810 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table C-2 Binary-to-Decimal Conversion Table + +Decimal Value +0 +1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 +17 + +18 + +19 + +20 + +21 + +22 + +23 + +24 + +25 + +26 + +27 + +28 + +29 + +30 + +31 + +Binary Value +00000000 +00000001 00000010 00000011 00000100 00000101 00000110 00000111 00001000 00001001 00001010 00001011 00001100 00001101 00001110 00001111 00010000 +00010001 + +00010010 + +00010011 + +00010100 + +00010101 + +00010110 + +00010111 + +00011000 + +00011001 + +00011010 + +00011011 + +00011100 + +00011101 + +00011110 + +00011111 + +Decimal Value +32 +33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 +49 + +50 + +51 + +52 + +53 + +54 + +55 + +56 + +57 + +58 + +59 + +60 + +61 + +62 + +63 + +Binary Value +00100000 +00100001 00100010 00100011 00100100 00100101 00100110 00100111 00101000 00101001 00101010 00101011 00101100 00101101 00101110 00101111 00110000 +00110001 + +00110010 + +00110011 + +00110100 + +00110101 + +00110110 + +00110111 + +00111000 + +00111001 + +00111010 + +00111011 + +00111100 + +00111101 + +00111110 + +00111111 + +Decimal Value +64 +65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 +81 + +82 + +83 + +84 + +85 + +86 + +87 + +88 + +89 + +90 + +91 + +92 + +93 + +94 + +95 + +Binary Value +01000000 +01000001 01000010 01000011 01000100 01000101 01000110 01000111 01001000 01001001 01001010 01001011 01001100 01001101 01001110 01001111 01010000 +01010001 + +01010010 + +01010011 + +01010100 + +01010101 + +01010110 + +01010111 + +01011000 + +01011001 + +01011010 + +01011011 + +01011100 + +01011101 + +01011110 + +01011111 + +Decimal Value +96 +97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 +113 + +114 + +115 + +116 + +117 + +118 + +119 + +120 + +121 + +122 + +123 + +124 + +125 + +126 + +127 + +Binary Value +01100000 +01100001 01100010 01100011 01100100 01100101 01100110 01100111 01101000 01101001 01101010 01101011 01101100 01101101 01101110 01101111 01110000 +01110001 + +01110010 + +01110011 + +01110100 + +01110101 + +01110110 + +01110111 + +01111000 + +01111001 + +01111010 + +01111011 + +01111100 + +01111101 + +01111110 + +01111111 + + + + + +From the Library of Alexey Evseenko +Appendix C: Conversion Tables 811 + +Table C-2 Binary-to-Decimal Conversion Table + +Decimal Value + +128 + +129 + +130 + +131 + +132 + +133 + +134 + +135 + +136 + +137 + +138 + +139 + +140 + +141 + +142 + +143 + +144 + +145 + +146 + +147 + +148 + +149 + +150 + +151 + +152 + +153 + +154 + +155 + +156 + +157 + +158 + +159 + +Binary Value + +10000000 + +10000001 + +10000010 + +10000011 + +10000100 + +10000101 + +10000110 + +10000111 + +10001000 + +10001001 + +10001010 + +10001011 + +10001100 + +10001101 + +10001110 + +10001111 + +10010000 + +10010001 + +10010010 + +10010011 + +10010100 + +10010101 + +10010110 + +10010111 + +10011000 + +10011001 + +10011010 + +10011011 + +10011100 + +10011101 + +10011110 + +10011111 + +Decimal Value + +160 + +161 + +162 + +163 + +164 + +165 + +166 + +167 + +168 + +169 + +170 + +171 + +172 + +173 + +174 + +175 + +176 + +177 + +178 + +179 + +180 + +181 + +182 + +183 + +184 + +185 + +186 + +187 + +188 + +189 + +190 + +191 + +Binary Value + +10100000 + +10100001 + +10100010 + +10100011 + +10100100 + +10100101 + +10100110 + +10100111 + +10101000 + +10101001 + +10101010 + +10101011 + +10101100 + +10101101 + +10101110 + +10101111 + +10110000 + +10110001 + +10110010 + +10110011 + +10110100 + +10110101 + +10110110 + +10110111 + +10111000 + +10111001 + +10111010 + +10111011 + +10111100 + +10111101 + +10111110 + +10111111 + +Decimal Value + +192 + +193 + +194 + +195 + +196 + +197 + +198 + +199 + +200 + +201 + +202 + +203 + +204 + +205 + +206 + +207 + +208 + +209 + +210 + +211 + +212 + +213 + +214 + +215 + +216 + +217 + +218 + +219 + +220 + +221 + +222 + +223 + +Binary Value + +11000000 + +11000001 + +11000010 + +11000011 + +11000100 + +11000101 + +11000110 + +11000111 + +11001000 + +11001001 + +11001010 + +11001011 + +11001100 + +11001101 + +11001110 + +11001111 + +11010000 + +11010001 + +11010010 + +11010011 + +11010100 + +11010101 + +11010110 + +11010111 + +11011000 + +11011001 + +11011010 + +11011011 + +11011100 + +11011101 + +11011110 + +11011111 + +Decimal Value + +224 + +225 + +226 + +227 + +228 + +229 + +230 + +231 + +232 + +233 + +234 + +235 + +236 + +237 + +238 + +239 + +240 + +241 + +242 + +243 + +244 + +245 + +246 + +247 + +248 + +249 + +250 + +251 + +252 + +253 + +254 + +255 + +Binary Value + +11100000 + +11100001 + +11100010 + +11100011 + +11100100 + +11100101 + +11100110 + +11100111 + +11101000 + +11101001 + +11101010 + +11101011 + +11101100 + +11101101 + +11101110 + +11101111 + +11110000 + +11110001 + +11110010 + +11110011 + +11110100 + +11110101 + +11110110 + +11110111 + +11111000 + +11111001 + +11111010 + +11111011 + +11111100 + +11111101 + +11111110 + +11111111 + + + + +From the Library of Alexey Evseenko + +Index + + + + + + + + +A + +AAA (authentication, authorization, and accounting), 719-721 +abbreviating IPv6 hexadecimal addresses, 79-80 +ABRs (area border routers), 264-265 best path selection, 336 +manual route summarization, 357-360 virtual links, 288-294 +configuring, 291-292 verifying, 292-294 +Acknowledgment Number field (TCP), 32 +ACLs (access control lists), 705-708 infrastructure ACLs, 707-708 +IPv6, 675 +comparing with IPv4, 675 +Neighbor Discovery commands, 675 +verifying, 677 +time-based ACLs, 705-707 WC mask, 196 +activating practice exam, 770 Active state, BGP neighbors, 570 AD (Administrative Distance) +default ADs, 652 +routing domain loops, preventing, 449-458 +routing protocol migration, 36 + + +address families, 678 +OSPFv3 address family configuration approach, 384-391 +administratively controlling BGP neighbor status, 574-576 +adoption of IPv6, 75 +advanced distance-vector routing pro-tocols, 14 +aggregate-address command, 587 +AH (Authentication Header) protocol, 62 +answers +to "Do I Know This Already?" quiz-zes, 779-802 +anycast traffic, 18-19 +applying to locally created packets, 489 +architecture +of enterprise networks, 6-7 network architecture types +broadcast networks, 19 NBMA networks, 20-21 point-to-point networks, 19 +areas, 265 +NSSAs, configuring, 374-376 stubby areas, 364-371 +totally stubby areas, configuring, 371-373 +ARIN (American Registry for Internet Numbers), 79, 83 + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + +ARP (Address Resolution Protocol), 25 +AS (autonomous systems), 10 EGPs, 11 +IGPs, 11 transit AS, 621 +AS_PATH PA, 547-549 AS_PATH prepend tool, 654-656 AS_SEQ PA, 546-549 +ASBRs (autonomous system boundary routers), manual route summariza-tion, 360-361 +ASNs (autonomous system numbers), 546-549 +assigning, 550-551 private ASNs, 551 +assigning +ASNs, 550-551 +IPv4 addresses, 540-541 +Internet route aggregation, 541-542 +NAT, 543-544 PAT, 543-544 +private IPv4 addresses, 544-545 static IPv4 addresses, 514-516 TLDs, 540 +IPv6 addresses, 87-93 to CPE, 672-673 +IANA, 78 + + +ICANN, 78 NDP, 89-90 prefixes, 82-84 +stateful DHCPv6, 88-89 stateless autoconfiguration, 89 +asymmetric routing, 27-30 attributes (BGP) +Local Preference +IPv6 path selection, 693-694 authentication, 740 +BGP authentication methods, 759-763 +EIGRP, 744-751 +for IPv4, 744-746 for IPv6, 746-749 +Named EIGRP authentication, 749-751 +hashing authentication, 741-742 key chains, 742-744 +NTP, 724-728 OSPF, 751-759 +MD5 authentication, 754-756 +plain text authentication, 751-754 +OSPFv3, 756-759 +plain text authentication, 740-741 +auto-summary, 217-219 + + + + + + + +From the Library of Alexey Evseenko +814 backbone routers + + +B + +backbone routers, 264-265 bandwidth, configuring +on interfaces, 175 +on WAN subinterfaces, 175-178 bandwidth-delay product, latency, 30 +baseline configuration examples, redis-tribution into EIGRP, 411-412 +BDRs (backup designated routers), 265 best path selection +BGP, 633-637 +decision process, memorizing, 636-637 +RTM, 651-652 EIGRP, 132-133 +metrics, calculating, 172-174 influencing, 210-211 +IPv6 path selection, influencing with Local Preference attribute, 693-694 +OSPF, 330-339 +cost of interarea routes, calculat-ing, 332-336 +cost of intra-area routes, calculat-ing, 331-332 +intra-area E2 routes, 425-427 tiebreakers, 424 +BFD (Bidirectional Forwarding Detection), 278 +BGP, 545 +administratively controlling neighbor status, 574-576 +AS_PATH prepend tool, 654-656 ASNs, 546-549 +assigning, 550-551 private ASNs, 551 +authentication, 759-763 + + +best path selection, 633-637 +decision process, memorizing, 633, 636-637 +RTM, 651-652 BGP table, 576-582 +confirming prefixes, 577-580 verifying, 581-582 +comparing with EIGRP and OSPF, 546 +default ADs, 652 +dual sessions, comparing with single IPv4 session, 689 +eBGP, 549-550, 563-576 eBGP multihop, 569-570 +neighborships, 564-567, 570-574 goals of, 545-546 +iBGP, 549-550 configuring, 603-606 need for, 602-603 +next hop addresses, 611-612 +nonconnected next-hop addresses, 612-613 +verifying, 606-607 injecting routes into, 583-587 +using network command, 583-585 using redistribution, 585-587 +IPv6, configuring +routing over IPv4 BGP sessions, 678-684 +routing over IPv6 BGP sessions, 684-688 +Local Preference attribute, influencing IPv6 path selection, 693-694 +maximum paths command, 654 messages, 576 +MP-BGP +address families, 678 +features, 678 + + + + + + +From the Library of Alexey Evseenko +Cisco routers 815 + + +neighborships, clearing, 625-627 +outbound routing toward the Internet, 551-563 +dual-homed Internet connection, 554-555 +dual-multihomed connection, 562-563 +full BGP updates, 559-560 influencing with Weight, 637-644 partial BGP updates, 560 +preferring one path over another, 556-559 +single-homed Internet connection, 553-554 +single-multihomed connection, 561-562 +PAs, 631-633 AS_PATH, 547-549 AS_SEQ, 546-549 +LOCAL_PREF, setting, 644-651 MED, 656-660 +NEXT_HOP, 631 RIB, 652-653 +route filtering, 620-630 +displaying results of, 627-629 outbound filtering, 622-625 peer groups, 629-630 +routing loops, preventing, 614-620 using iBGP mesh, 616-618 using redistribution, 618-620 +synchronization, 618-620 transit AS, 621 +Update messages, 577 Weight, setting +with neighbor weight command, 643-644 +with route maps, 642-643 +EIGRP K-values, configuring, 178-180 + + +EIGRP metrics, calculating, 172-174 +EIGRP offset lists, 178-180 variance, 181-183 +broadcast networks, 19 broadcast traffic, 16-17 building IP routing table + +C calculating +best routes, EIGRP, 132-133 IPv6 interface ID, 91-92 metrics, EIGRP, 172-174 summary routes, 209 +campus networks, 6-7 +CEF (Cisco Express Forwarding), 478-483 +uRPF, 714-719 +changing next-hop addresses, 613-614 characteristics +of routing protocols, 15 of TCP, 31-33 +of UDP, 35-36 Checksum field +ICMP, 31 TCP, 33 +CIDR notation, 93 +Cisco Learning Network, 771 Cisco routers +authentication, 740 +hashing authentication, 741-742 key chains, 742-744 +plain text authentication, 740-741 IPv6 address configuration, 100-106 +connected routes, 104 local IPv6 routes, 104 +multicast groups, 103-104 + + + + + +From the Library of Alexey Evseenko +816 Cisco routers + + +stateless autoconfiguration, 105-106 +static IPv6 addresses, 96-103 security +ACLs, 705-708 +management plane security, 708-728 +security policies, elements of, 704-705 Class D addresses, 18 +classful addressing, 81 classless addressing, 81 +clear ip bgp * soft command, 692 Code field (ICMP), 31 commands +aggregate-address command, 587 clear ip bgp * soft command, 692 +default-information originate com-mand, 362-364 +distribute-list command, 197, 447 ip nhrp command, 61 +ip split horizon command, 170 +IPv6 configuration command reference, 100 +maximum paths command, 654 metric weights command, 145 neighbor weight command, 643-644 network command, 125-127 +injecting routes into BGP, 583-585 offset-list command, 179 +OSPF route redistribution command reference, 418 +OSPF show command reference, 269 redistribute command +parameters for EIGRP redistribu-tion, 410 +router eigrp asn command, 125-127 +router ospf process-id command, 266-268 + +show bgp ipv6 unicast command, 683, 688 +show ip bgp command, 608, 633 +show ip eigrp interfaces command, 128, 130 +show ip ospf database command, 310 +show ip ospf virtual-links command, 292-293 +show ip protocols command, 128, 130 show ip route command, 128 +show ipv6 route command, 681 +show running-config command, 101-102 +Type 2 LSA show commands, 314-317 comparing +BGP with EIGRP and OSPF, 545-546 E1 and E2 routes, 432 +EIGRP for IPv4 and IPv6, 236-237 IPv4 and IPv6 +ACLs, 675 +address categories, 94 RIPng and RIPv2, 108-109 +single IPv4 BGP session and dual ses-sions, 689 +SSH and Telnet, 709-711 +stateless and stateful DHCPv6 services, 92 +TACACS+ and RADIUS, 721 configuring +BGP neighborships, 564-565 default routes, 219-224 EIGRP, 125-127 +bandwidth, 175 delay, 175 +Hello timer, 135-137 Hold timer, 135-137 for IPv6, 237-240 +K-values, 145-146 + + + + + + +From the Library of Alexey Evseenko +database exchange process 817 + + +neighborships, 134-137 static neighbors, 141-144 +verifying configuration, 127-130 WAN bandwidth control, 170-171 +GRE tunnels, 53-54 iBGP, 603-606 +IP SLA, 491 +IPsec VPNs, 63-65 IPv6 +on Cisco routers, 100-106 prefix lists, 689-692 +routing over IPv4 BGP sessions, 678-684 +routing over IPv6 BGP sessions, 684-688 +static addresses, 93 MED PA, 659-660 Named EIGRP, 245-250 NTP, 725-728 +OSPF, 266-268 NSSAs, 374-376 +route redistribution, 419-423 stubby areas, 366-371 +totally stubby areas, 371-373 OSPFv3 +address family configuration approach, 384-391 +traditional approach, 377-383 PBR, 485-488 +RIPng, 109-112 +route filtering, 439-441 +route redistribution into EIGRP, 412-414 +route summarization, 213-217 virtual links, 291-292 +VRF-Lite, 500-502 +confirming prefixes in BGP table, 577-580 + +Connect state, BGP neighbors, 570 connected routes, 104 +contents +of EIGRP Update messages, 163-166 of LSDBs, 264-265 +of ROUTE exam, xxx-xxxii contiguous networks, 218 control plane, 476 convergence +distance-vector routing protocols, 12 EIGRP, optimizing, 183-194 +feasible successors, 184-188 going active on a route, 188-190 +OSPF, optimizing, 275-278 +speed of as routing protocol selection criteria, 9 +cost metric +for interarea routes, calculating, 332-336 +for intra-area routes, calculating, 331-332 +tuning, 337-339 +CPE (customer premises equipment) IPv6 address assignment, 672-673 +manual address configuration, 673-674 +CPU processing of SPF runs, 337 + +D + +DAD (Duplicate Address Detection), 99 data plane, 476 +database exchange process, 321-330 +discovering neighbor's LSDB descrip-tion, 324-325 +exchange with DR, 326-328 exchange without DR, 323-324 +exchanging LSAs, 325-326 + + + + + +From the Library of Alexey Evseenko +818 database exchange process + + +flooding LSAs in area, 328-329 periodic LSA flooding, 329-330 +DD (Database Description) messages, 322 +Dead timer, optimizing convergence, 275-278 +default ADs (BGP), 652 +default keyword, impact on PBR logic ordering, 488 +default routes, 219-224, 361-362 default networks, configuring, 221-224 domain-wide default routes, 362-364 EIGRP configuration, 220-221 gateway of last resort, 223 +outbound routing toward the Internet, 552-553 +default-information originate command, 362-364 +delay, configuring on interfaces, 175 Destination Address field (IPv4), 23 Destination Address field (IPv6), 24 Destination Port field (TCP), 32 +Destination Unreachable messages (ICMP), 31 +DHCPv6-PD (Dynamic Host Configuration Protocol version 6 -Prefix Delegation), 673 +Dijkstra's SPF (Shortest Path First) algo-rithm, 14 +directed broadcasts, 17 discontiguous networks, 218 +discovering OSPF neighbor's LSDB description, 324-325 +displaying BGP route filtering results, 627-629 +distance-vector routing protocols, 11-14 convergence, 12 +EIGRP, 14 +authentication methods, 744-751 +best path selection, 132-133 + + +configuring, 125-127 convergence, optimizing, 183-194 default routes, 219-224 +features, 133 +for IPv6, 236-243 +K-values, configuring, 145-146 neighborships, 134-149 +offset lists, 178-180 +populating the IP routing table, 131-133 +RID, 146 +route filtering, 194-207 route redistribution, 410-417 +route summarization, 208-219 +static neighbors, configuring, 141-144 +unequal metric load balancing, 180-183 +Update process, 166-167 variance, 181-183 +verifying configuration, 127-130 periodic advertisements, 11 +RIPng, 107-114 +comparing with RIPv2, 108-109 configuring, 109-112 +verifying, 112-114 RIPv2, 107-108 +routing loops, 12 preventing, 13 +distribute lists, filtering OSPF routes added to routing table, 355-356 +distribute-list command, 197 redistribution filtering, 447 +DMVPN (Dynamic Multipoint VPN), 56-57 +IPsec, 61-65 +DNAT (Dynamic NAT), 520-522 + + + + +From the Library of Alexey Evseenko +EIGRP 819 + + +DNS IPv6 addresses, finding with state-less DHCP, 92 +"Do I Know This Already?" quizzes answers to, 779-802 +Chapter 1, 4-5 Chapter 2, 48-49 Chapter 3, 72-74 Chapter 4, 122-124 Chapter 5, 156-161 Chapter 6, 234-235 Chapter 7, 260-262 Chapter 8, 302-304 Chapter 9, 346-349 Chapter 10, 400-404 Chapter 11, 472-475 Chapter 12, 512-513 Chapter 13, 534-538 Chapter 14, 597-601 Chapter 15, 670-671 Chapter 16, 702-703 Chapter 17, 738-739 +domain loops, preventing with AD, 449-458 +with route tags, 459-461 +domain-wide default routes, 362-364 DRs (designated routers), 265, 312 +in database exchange process, 323-324, 326-328 +DUAL (Diffusing Update Algorithm), 14 +dual BGP sessions, comparing with sin-gle IPv4 session, 689 +dual-homed Internet connection, select-ing BGP for, 554-555 +dual-multihomed Internet connection, 562-563 +dynamic routing protocols, 6 + +E + +E1 (external Type 1) routes, redistribu-tion into OSPF, 431-432 +E2 (external Type 2) routes +best path selection, intra-area, 425-427 LSAs, 423-424 +metrics, 424 +eBGP (external BGP), 549-550, 563-576 +eBGP multihop, 569-570 neighborships, 570-574 +configuring, 564-565 requirements for, 565-567 troubleshooting, 567-569 verifying, 570-574 +EGPs (exterior gateway protocols), 11 EIGRP, 14 +authentication, 744-751 for IPv4, 744-746 for IPv6, 746-749 +Named EIGRP authentication, 749-751 +bandwidth, configuring, 175 comparing with BGP, 545-546 configuring, 125-127 convergence +feasible successors, 184-188 going active on a route, 188-190 optimizing, 183-194 +default routes, 219-224 configuring, 220-221 gateway of last resort, 223 +features, 133 +IP routing table, populating, 131-133 best path selection, 132-133 +EIGRP discovery and update pro-cess, 131-132 + + + + + +From the Library of Alexey Evseenko +820 EIGRP + + +for IPv6, 236-243 configuring, 237-240 verifying, 240-243 +load balancing, 180-183 metrics +configuring for redistribution, 413, 443-445 +FD, 172-174 +K-values, configuring, 145-146, 178 +offset lists, 178-180 tuning, 174-175 +verifying for redistribution, 445-446 +Named EIGRP, 243-252 configuring, 245-250 hierarchical structure, 244-245 verifying, 250-252 +neighborships, 134-149 +Hello timer, configuring, 135-137 Hello timer, verifying, 137-141 Hold timer, configuring, 135-137 +Hold timer, manipulating, 134-137 +Hold timer, verifying, 137-141 over Frame Relay, 147-148 over Metro Ethernet, 149 +over MPLS VPN, 148 requirements, 144-145 +Query messages +limiting scope of, 190-192 RID, 146 +route filtering, 194-207 ACLs, 196-198 +IP prefix lists, 198 +route maps, 204-207 + +route redistribution, 410-417 +baseline configuration examples, 411-412 +configuring, 412-414 into OSPF, 433-436 +redistribute command parameters, 410 +verifying, 415-417 +route summarization, 208-219 auto-summary, 217-219 benefits of, 213 configuring, 213-217 +influencing best route selection, 210-211 +suboptimal forwarding, 211-213 summary routes, calculating, 209 +SIA-Query messages, 194 topology table +Frame Relay issues for topology exchange, 167-170 +populating, 162 Update messages +contents, 163-166 Update process, 166-167 variance, 181-183 +verifying configuration, 127-130 WAN bandwidth control, 170-171 +election process, DRs, 312 +elements of router security policies, 704-705 +enable secret password, 711-712 encrypting passwords, 711-714 +enable secret password, 711-712 line passwords, 712-713 username passwords, 713-714 +enterprise networks +domain-wide default routes, 362-364 +eBGP, 563-576 + + + + + +From the Library of Alexey Evseenko +Frame Relay 821 + + +inbound routes, influencing with MED PA, 656-660 +IPv6 subnetting, 84-86 +outbound routing toward the Internet, 551-563 +BGP as solution, 553-563 +default routes as solution, 552-553 routing, 6-7 +routing protocol migration strategies, 36-37 +ESP (Encapsulating Security Payload) protocol, 62 +Established state, BGP neighbors, 570 EUI-64, calculating interface ID, 91-92 +EVN (Cisco Easy Virtual Networking), 499 +migrating to, 38-39 sample topology, 40 +exam, preparing for, 769, xxxiv-xxxvi. See also "Do I Know This Already?" quizzes +Cisco Learning Network, 771 memory tables, 771-772 +Pearson Cert Practice Test engine, 769-770 +practice exam, activating, 770 suggested study plan, 772-775 +exchanging LSAs between neighbors, 325-326 + +F + +fast switching, 477-478 +FCS (Frame Check Sequence), 484 +FD (Feasible Distance), calculating, 172-174 +FE80::/10 prefix, 96 feasible successors, 184-188 +verifying, 185-188 + +features +of EIGRP, 133 of IPv6, 75-76 of MP-BGP, 678 of OSPF, 271 +FHRP (First-Hop Redundancy Protocol), 27 +fields +of IPv4 headers, 22-23 of IPv6 headers, 23-24 +of OSPF Hello messages, 274 filtering routes, 194-207 +ACLs, 196-198 BGP, 620-630 +clearing neighborships, 625-627 displaying results of, 627-629 outbound filtering, 622-625 peer groups, 629-630 +IP prefix lists, 198-204 IPv6 routes, 689-692 OSPF, 350-351 +filtering routes added to routing table, 355-356 +Type 3 LSA filtering, 351-355 redistributed routes, 438-439 +route maps, 204-207 flapping routes, 12 flooding +LSAs in database exchange process, 328-329 +unicast flooding, 27-30 Flow Label field (IPv6), 23 +format of ROUTE exam, xxxiii-xxxiv Fragment Offset field (IPv4), 22 Frame Relay +EIGRP neighborships over, 147-148 +EIGRP topology exchange, trouble-shooting, 167-170 + + + + + +From the Library of Alexey Evseenko +822 Frame Relay + + +OSPF neighborships over, 284-285 +restricting EIGRP bandwidth consumed, 170-171 +full BGP updates, 559-560 + +G + +gateway of last resort, 223 GET messages (SNMP), 722 +global IPv6 address assignment, 77-79 global routing prefix assignment, 87 global synchronization, 35 +global unicast address assignment, 87-93, 539 +NDP, 89-90 +stateful DHCPv6, 88-89 stateless autoconfiguration, 89 +goals of BGP, 545-546 +going active on a route, 188-190 +GRE (Generic Routing Encapsulation) tunneling, 53-55 +mGRE, 57-58 + +H + +hashing authentication, 741-742 Header Checksum field (IPv4), 23 header fields +ICMP, 31 IPv4, 22-23 IPv6, 23-24 +Header Length field (IPv4), 22 +Hello interval (OSPF), optimizing con-vergence, 275-278 +Hello messages (OSPF), fields, 274 Hello timer (EIGRP) +configuring, 135-137 manipulating, 134-135 +verifying, 137-141 + +hexadecimal IPv6 addresses, abbreviat-ing, 79-80 +hierarchical design Named EIGRP, 244-245 OSPF, 264 +Hold timer (EIGRP) configuring, 135-137 manipulating, 134-135 verifying, 137-141 +Hop Limit field (IPv6), 24 hub routers, 59 +hybrid VPNs, 51 + +I + +IANA (Internet Assigned Numbers Authority), 78 +ASN assignment, 550-551 iBGP (internal BGP), 549-550 +BGP table, 607-611 configuring, 603-606 need for, 602-603 +next-hop addresses, 611-612 changing, 613-614 +nonconnected next-hop addresses, 612-613 +verifying, 606-607 iBGP mesh, 616-618 +ICANN (Internet Corporation for Assigned Network Numbers), 78 +ICMP (Internet Control Message Protocol), 25, 30-31 +messages, 31 +Identification field (IPv4), 22 Idle state, BGP neighbors, 570 +IGPs (interior gateway protocols), 11 IKE (Internet Key Exchange), 62 +InARP (Inverse ARP), 99 + + + + +From the Library of Alexey Evseenko +IPsec 823 + + +inbound routes, influencing with MED PA, 656-660 +IND (Inverse Neighbor Discovery), 99-100 +influencing best route selection, 210-211 +Informational RFCs, 8 infrastructure ACLs, 707-708 injecting routes into BGP, 583-587 +using network command, 583-585 using redistribution, 585-587 +installing Pearson Cert Practice Test engine, 770 +interarea routes, calculating cost of, 332-336 +interface ID, calculating, 91-92 internal LSAs, 306-321 +Type 1 LSAs, 306-311 Type 2 LSAs +DR election process, 312 pseudonodes, 313 +show commands, 314-317 Type 3 LSAs, 317-321 +internal routers, 265 Internet access topologies +dual-homed Internet connection, select-ing BGP for, 554-555 +dual-multihomed connection, selecting BGP for, 562-563 +preferring one path over another, 556-559 +single-homed connection, 668 selecting BGP for, 553-554 +single-homed Internet connection, selecting BGP for, 553-554 +single-multihomed connection, select-ing BGP for, 561-562 +Internet route aggregation, 541-542 + +Internet-facing routers, IPv6 address assignment, 672-673 +manual address configuration, 673-674 +intra-area routes, calculating cost of, 331-332 +IP Flags field (IPv4), 22 ip nhrp command, 61 +IP Option field (IPv4), 23 +IP Precedence, setting for PBR packet marking, 489-490 +IP prefix lists, 198-204 IP routing table +building, 172-183 +bandwidth, configuring (EIGRP), 175 +EIGRP metrics, calculating, 172-174 +EIGRP metrics, tuning, 174-175 EIGRP offset lists, 178-180 feasible successors, 184-188 variance, 181-183 +populating +EIGRP best path selection, 132-133 +EIGRP discovery and update pro-cess, 131-132 +IP SLA (Service-Level Agreement) tool, 490-499 +configuring, 492-495 RTR, 491 +tracking operations to influence rout-ing, 496-499 +ip split horizon command, 170 IPsec, 61-65 +AH, 62 ESP, 62 IKE, 62 +VPNs, configuring, 63-65 + + + + + + +From the Library of Alexey Evseenko +824 IPv4 + + +IPv4 +classful addressing, 81 +dynamic IP address assignment, 516-518 +EIGRP authentication, 744-746 header fields, 22-23 +migrating to IPv6, 37-38 +provider-assigned IPv4 addresses, 514-518 +public address assignment, 540-541 +Internet route aggregation, 541-542 +NAT, 543-544 PAT, 543-544 +private IPv4 addresses, 544-545 +shortage of public addresses, solutions for, 77 +static IPv4 address assignment, 514-516 IPv6, 672-694 +ACLs, 675 +comparing with IPv4, 675 +Neighbor Discovery commands, 675 +verifying, 677 address prefix, 18 addresses +representing, 79-80 static configuration, 93 +adoption of, 75 anycast traffic, 18-19 +assigning IPv6 addresses to CPE, 672-673 +manual address configuration, 673-674 +BGP support, 677-694 See also MP-BGP (Multiprotocol BGP) +address families, 678 +authentication, 759-763 + + +path selection, influencing with Local Preference attribute, 693-694 +configuring on Cisco routers, 100-106 command reference, 100 connected routes, 104 +local IPv6 routes, 104 multicast groups, 103-104 +stateless autoconfiguration, 105-106 +static IPv6 addresses, 96-103 DAD, 99 +DNS IP address, finding with stateless DHCP, 92 +EIGRP for IPv6, 236-243 authentication, 746-749 configuring, 237-240 verifying, 240-243 +features, 75-76 +global address assignment, ICANN, 78 +global unicast address assignment, 77-79, 87-93 +NDP, 89-90 +stateful DHCPv6, 88-89 stateless autoconfiguration, 89 +header fields, 23-24 +interface ID, calculating, 91-92 Internet connection security, 677 Layer 2 address mapping, 97-99 mobility, 75 +multicast addresses, 97 neighbor table, 104-105 +prefix lists, configuring, 689-692 prefixes +assignment process, 82-84 conventions for writing, 80-82 +routing over IPv4 BGP sessions, config-uring, 678-684 + + + + + +From the Library of Alexey Evseenko +link-state routing protocols 825 + + +routing over IPv6 BGP sessions, config-uring, 684-688 +subnets, 81 subnetting, 84-86 +unicast addresses, 94-96 +link-local addresses, 95-96 unique local addresses, 94-95 +IRs (Internet Registries), 540 +ISAKMP (Internet Association and Key Management Protocol), 62 +ISPs (Internet service providers) +CPE, IPv6 address assignment, 672-673 prefix assignment, 87 +IT staff familiarity as routing protocol selection criteria, 9 +J-K jitter, 489 +key chains, 742 +K-values, configuring, 145-146, 178 + +L + +LANs, OSPF over, 272-280 +neighbor discovery, enabling, 272-274 optimizing convergence, 275-278 +RID mismatches, 278-279 latency, 30 +Layer 2 address mapping, 97-99 Layer 2 MPLS VPNs, 51 +Layer 3 MPLS VPNs, 52 +layers of enterprise networks, 6-7 limiting +EIGRP bandwidth consumed on WANs, 170-171 +scope of Query messages, 190-192 stub routers, 190-191 +stuck in active, 193-194 +summary routes, 192 + +line passwords, 712-713 +link-local IPv6 addresses, 95-96 link-state routing protocols, 14-15 +OSPF +ABRs, 264 +authentication methods, 751-759 backbone routers, 264 +best path selection, 330-339 configuring, 266-268 +database exchange process, 321-330 +DD messages, 322 +domain-wide default routes, 362-364 +DRs, 312 features, 271 +Hello messages, 274 hierarchical design, 264 LS logic, 263 +LSAs, 305-321 LSDB, 263, 305 neighbor states, 322 +over Frame Relay, 284-285 over LANs, 272-280 +over Metro Ethernet, 287-288 over MPLS VPN, 285-286 +over point-to-point links, 282-284 over WANs, 281-290 +redistribution into EIGRP, 412-414 +requirements for neighborships, 275-280 +RID mismatches, 278-279 route redistribution, 417-436 route summarization, 356-357 show commands, 269 +stubby areas, 364-366 +totally stubby areas, configuring, 371-373 + + + + +From the Library of Alexey Evseenko +826 link-state routing protocols + + +Type 1 LSAs, 306-311 Type 2 LSAs, 312-317 Type 3 LSAs, 317-321 verifying, 268-271 virtual links, 288-294 +OSPFv3 +address family configuration approach, 384-391 +LSAs, 376-377 +traditional configuration, 377-383 LLQ (Low Latency Queuing), 35-36 +load balancing, unequal metric load bal-ancing, 180-183 +Local_Pref PA, 644-651 +IPv6 path selection, 693-694 loopback addresses, 96 +LS logic, OSPF, 263 +LSAck (link-state acknowledgment) mes-sages, 322 +LSAs (link-state advertisements), 14, 265, 305-321 +exchanging between neighbors, 325-326 +flooding, 328-329 LSID, 307 +for OSPFv3, 376-377 periodic flooding, 329-330 Type 1 LSAs, 306-311 Type 2 LSAs, 312-317 +DR election process, 312 pseudonodes, 313 +show commands, 314-317 Type 3 LSAs, 317-321 +filtering, 351-355 +LSDB (link-state database), 263, 305 contents of, 264-265 +database exchange process, 321-330 +discovering neighbor's LSDB description, 324-325 + +exchange with DR, 326-328 exchange without DR, 323-324 exchanging LSAs, 325-326 flooding LSAs in area, 328-329 +LSID (link-state identifier), 307 +LSR (link-state request) messages, 322 LSUs (link-state updates), 265, 322 + +M + +MAC addresses, Layer 2 address map-ping, 97-99 +management plane security, 708-728 AAA, 719-721 +NTP authentication, 724-728 password encryption, 711-714 +enable secret password, 711-712 line passwords, 712-713 username passwords, 713-714 +SNMP, 721-724 SSH, 709-711 uRPF, 714-719 +manipulating EIGRP neighborships, 134-135 +manual IPv6 address configuration, 673-674 +manual route summarization at ABRs, 357-360 +at ASBRs, 360-361 mapping tables, 37 marking packets, 489 +master/slave routers, DD message exchange, 324-325 +matching packets with PBR, 484-485 maximum-paths command, 654 +MD5 authentication, 754-756 + + + + +From the Library of Alexey Evseenko +multicast traffic 827 + + +MED PA +configuring, 659-660 +influencing inbound routes with, 656-658 +memorizing BGP decision process, 633, 636-637 +mergers as reason for route redistribu-tion, 406 +messages, 193-194 BGP, 576 +Update, 577 EIGRP +SIA-Query, 194 +Update, 131-132, 163-166 ICMP, 31 +OSPF, 322 SNMP, 722 +metric weights command, 145 metrics +configuring for redistribution into EIGRP, 443-445 +EIGRP +best path selection, 132-133 calculating, 172-174 +configuring for redistribution into EIGRP, 413 +FD, 172-174 +K-values, configuring, 145-146, 178 +offset lists, 178-180 tuning, 174-175 +unequal metric load balancing, 180-183 +verifying for redistribution, 445-446 +OSPF +cost of interarea routes, calculat-ing, 332-336 +cost of intra-area routes, calculat-ing, 331-332 + + +for E2 routes, 424 +reference bandwidth, changing, 338 +setting on redistributed routes, 423 +Metro Ethernet +EIGRP neighborships over, 149 OSPF neighborships over, 287-288 +mGRE (multipoint GRE), 57-58 migration strategies +IPv4-to-IPv6 migration, 37-38 migration to EVN, 38-39 +routing protocol migration in enterprise networks, 36-37 +STP migration, 38-39 mismatched RIDs, 278-279 mobility, IPv6, 75 +MP-BGP (Multiprotocol BGP) address families, 678 features, 678 +prefix lists, 689-692 MPLS-based VPNs, 50-52 +EIGRP neighborships over, 148 Layer 2 MPLS VPNs, 51 +Layer 3 MPLS VPNs, 52 +OSPF neighborships over, 285-286 MSS (Maximum Segment Size), 34 MTU (Maximum Transmission Unit), 30 +establishing OSPF neighborships, 275-280 +multiaccess networks, 313 multicast IPv6 addresses, 97 +multicast traffic, 17-18 + + + + +From the Library of Alexey Evseenko +828 Named EIGRP + + +N + +Named EIGRP, 243-252 authentication, 749-751 configuring, 245-250 hierarchical design, 244-245 verifying, 250-252 +NAT (Network Address Translation), 518-520, 543-544 +design considerations, 526 DNAT, 520-522 +NVI, 526-527 PAT, 523-526 SNAT, 522-523 +NAT64, 37 +NBMA (nonbroadcast multiaccess) net-works, 20-21 +NDP (Neighbor Discovery Protocol), 89-90 +Layer 2 address mapping, 97-99 +Neighbor Discovery commands (IPv6 ACLs), 675 +neighbor table (IPv6), 104-105 neighbor weight command, 643-644 neighborships +BGP +administratively controlling neighbor status, 574-576 +clearing, 625-627 configuring, 564-565 eBGP, 569-574 +eBGP +configuring, 564-565 requirements for, 565-567 troubleshooting, 567-569 +neighbor states, 570 + + +EIGRP, 134-149 +configuration requirements, 144-145 +Hello timer, 131-134 Hold timer, 134-141 +over WANs, 147-149 Frame Relay, 147-148 Metro Ethernet, 149 +MPLS-based VPNs, 148 OSPF +LSA exchange process, 325-326 +neighbor discovery, enabling, 272-274 +neighbor states, 322 +over Frame Relay, 284-285 over Metro Ethernet, 287-288 over MPLS VPN, 285-286 +over point-to-point links, 282-284 requirements, 275-280 +static neighbors, configuring, 141-144 network architectures +broadcast, 19 NBMA, 20-21 point-to-point, 19 +network command, 125-127 injecting routes into BGP, 583-585 +Network LSAs, 312-317 network traffic +anycast, 18-19 broadcast, 16-17 multicast, 17-18 unicast, 16 +Next Header field (IPv6), 24 +NEXT_HOP PA, 631 + + + + + + + + +From the Library of Alexey Evseenko +OSPF 829 + + +next-hop addresses changing, 613-614 +nonconnected next-hop addresses, 612-613 +OSPF E2 routes, 425-427 +NHRP (Next Hop Resolution Protocol), 59-61 +nonconnected next-hop addresses, 612-613 +NPTv6 (Network Prefix Translation ver-sion 6), 38 +NSSAs (not-so-stubby areas) configuring, 374-376 external routes, 433-436 +NTP (Network Time Protocol) authenti-cation, 724-728 +NVI (NAT Virtual Interface), 526-527 + +O + +Offset field (TCP), 32 offset lists, 178-180 offset-list command, 179 +OpenConfirm state, BGP neighbors, 570 OpenSent state, BGP neighbors, 570 optimizing convergence +EIGRP, 183-194 +feasible successors, 184-188 OSPF, 275-278 +OSI (Open Systems Interconnection) model, 21 +OSPF. See also OSPFv3 ABRs, 264 authentication, 751-759 +MD5 authentication, 754-756 plain text authentication, 751-754 +backbone routers, 264 + +best path selection, 330-339 +cost of interarea routes, calculat-ing, 332-336 +cost of intra-area routes, calculat-ing, 331-332 +tiebreakers, 424 comparing with BGP, 545-546 configuring, 266-268 +convergence, optimizing, 275-278 DD messages, 322 +domain-wide default routing, 362-364 DRs, election process, 312 +E2 routes, intra-area best path selection, 425-427 +features, 271 +Hello messages, fields, 274 hierarchical design, 264 +on LANs, 272-280 +neighbor discovery, enabling, 272-274 +LS logic, 263 LSAs, 305-321 +LSID, 307 +Type 1 LSAs, 306-311 Type 2 LSAs, 312-317 Type 3 LSAs, 317-321 +LSDB, 263, 305 +contents of, 264-265 +database exchange process, 321-330 +metrics +cost, 337-339 +for E2 routes, 424 neighborships +LSA exchange process, 325-326 neighbor states, 322 requirements, 275-280 +network types, 281 + + + + + +From the Library of Alexey Evseenko +830 OSPF + + +NSSAs, configuring, 374-376 over WANs, 281-290 +Frame Relay, 284-285 Metro Ethernet, 287-288 MPLS-based VPNs, 285-286 +point-to-point links, 282-284 RID mismatches, 278-279 +route filtering, 350-351 +filtering routes added to routing table, 355-356 +Type 3 LSAs, 351-355 route redistribution, 417-436 +command reference, 418 configuring, 419-423 E1 routes, 431-432 +into EIGRP, 412-414 +external routes in NSSAs, 433-436 +setting external route type, 446-447 +setting metrics on redistributed routes, 423 +route summarization, 356-357 +manual summarization at ABRs, 357-360 +manual summarization at ASBRs, 360-361 +show commands, 269 SPF, CPU processing, 337 stubby areas, 364-366 +configuring, 366-371 verifying, 268-271 +virtual links, 288-294 configuring, 291-292 +verifying, 292-294 + +OSPFv3, 376-391 authentication, 756-759 configuring +address family configuration approach, 384-391 +traditional approach, 377-383 LSAs, 376-377 +out-of-order delivery, 35 outbound filtering, 622-625 +outbound routing toward the Internet BGP as solution +full BGP updates, 559-560 influencing with Weight, 637-644 partial BGP updates, 560 +default routes as solution, 552-553 +dual-homed Internet connection, 554-555 +dual-multihomed connection, 562-563 +preferring one path over another, 556-559 +single-homed Internet connection, 553-554 +single-multihomed connection, 561-562 + +P + +PAs (path attributes), 631-633 AS_PATH, 547-549 +AS_SEQ, 546-549 LOCAL_PREF, setting, 644-651 MED +configuring, 659-660 +influencing inbound routes with, 656-658 +NEXT_HOP, 631 + + + + + + + + + +From the Library of Alexey Evseenko +path-vector routing protocols, BGP 831 + + +packet switching, 476 CEF, 478-483 +uRPF, 714-719 fast switching, 477-478 +process switching, 476-477 packets, MTU, 30 parameters +for EIGRP redistribute command, 410 for OSPF redistribute command, 418 +partial BGP updates, 560 passwords, encrypting, 711-714 +enable secret password, 711-712 line passwords, 712-713 username passwords, 713-714 +PAT (Port Address Translation), 523-526, 543-544 +path control, 470 +path-vector routing protocols, BGP, 15, 545 +administratively controlling neighbor status, 574-576 +AS_PATH prepend tool, 654-656 ASNs, 546-549 +assigning, 550-551 private ASNs, 551 +authentication, 759-763 best path selection, 633-637 +decision process, memorizing, 633, 636-637 +RTM, 651-652 BGP table, 576-582 +confirming prefixes, 577-580 verifying, 581-582 +comparing with EIGRP and OSPF, 545-546 +default ADs, 652 +dual sessions, comparing with single IPv4 session, 689 + +eBGP, 549-550, 563-576 eBGP multihop, 569-570 +neighborships, 564-567, 570-574 goals of, 545-546 +iBGP, 549-550 configuring, 603-606 need for, 602-603 +next hop addresses, 611-612 +nonconnected next-hop addresses, 612-613 +verifying, 606-607 injecting routes into, 583-587 +using network command, 583-585 using redistribution, 585-587 +IPv6, configuring +routing over IPv4 BGP sessions, 678-684 +routing over IPv6 BGP sessions, 684-688 +Local Preference attribute, influencing IPv6 path selection, 693-694 +maximum paths command, 654 messages, 576 +MP-BGP +address families, 678 features, 678 +neighborships, clearing, 625-627 +outbound routing toward the Internet, 551-563 +dual-homed Internet connection, 554-555 +dual-multihomed connection, 562-563 +full BGP updates, 559-560 influencing with Weight, 637-644 partial BGP updates, 560 +preferring one path over another, 556-559 + + + + + +From the Library of Alexey Evseenko +832 path-vector routing protocols, BGP + + +single-homed Internet connection, 553-554 +single-multihomed connection, 561-562 +PAs, 631-633 AS_PATH, 547-549 AS_SEQ, 546-549 +LOCAL_PREF, setting, 644-651 MED, 656-660 +NEXT_HOP, 631 RIB, 652-653 +route filtering, 620-630 +displaying results of, 627-629 outbound filtering, 622-625 peer groups, 629-630 +routing loops, preventing, 614-620 using iBGP mesh, 616-618 using redistribution, 618-620 +synchronization, 618-620 transit AS, 621 +Update messages, 577 Weight, setting +with neighbor weight command, 643-644 +with route maps, 642-643 Payload Length field (IPv6), 24 +PBR (Policy-Based Routing), 483-490 applying to locally created packets, 489 configuring, 485-488 +default keyword, impact on PBR logic ordering, 488 +IP SLA, 490-499 configuring, 492-495 RTR, 491 +tracking operations to influence routing, 496-499 +marking packets, 489 + +matching packets, 484-485 setting IP Precedence, 489-490 +Pearson Cert Practice Test engine, 769-770 +peer groups, 629-630 periodic advertisements, 11 +periodic flooding of LSAs, 329-330 Perlman, Radia, 38 +plain text authentication, 740-741 for OSPF, 751-754 +point-to-point network architectures, 19 +establishing OSPF neighborships on, 282-284 +Poison Reverse, 13 populating +EIGRP topology table, 162 IP routing table +EIGRP best path selection, 132-133 +EIGRP discovery and update pro-cess, 131-132 +practice exam, activating, 770 prefix lists, 198-204 +IPv6, configuring, 689-692 prefixes (IPv6) . See also subnetting +assignment process, 82-84 conventions for writing, 80-82 FE80::/10 prefix, 96 +in iBGP table, 607-611 registry prefix, 84 subnetting, 84-86 +Premium Edition of this book, 771 +preparing for ROUTE exam, 769, xxxiv-xxxvi. See also "Do I Know This Already?" quizzes +Cisco Learning Network, 771 +memory tables, 771-772 + + + + + + + +From the Library of Alexey Evseenko +Rest of Header field (ICMP) 833 + + +Pearson Cert Practice Test engine, 769-770 +installing, 770 +practice exam, activating, 770 suggested study plan, 772-775 +preventing +global synchronization, 35 routing domain loops +with AD, 449-458 +with higher metrics, 448-449 with route tags, 459-461 +routing loops, 13, 614-620 using iBGP mesh, 616-618 +using redistribution, 618-620 priority queuing, 36 +private ASNs, 551 +private IPv4 addresses, 544-545 process switching, 476-477 Protocol field (IPv4), 23 +provider-assigned IPv4 addresses, 514-518 +dynamic IP address assignment, 516-518 +static IPv4 address assignment, 514-516 pseudonodes, 313 + +Q + +QoS (quality of service), 489 +Query messages, limiting scope of, 190-192 +stub routers, 190-191 stuck in active, 193-194 summary routes, 192 +queuing LLQ, 36 +priority queuing, 36 +WRED, 35 + +R + +RA (Router Advertisement) messages, 89-90 +RADIUS, comparing with TACACS+, 721 +RD (Reported Distance), calculating, 172-174 +reachability, iBGP, 611-612 Redirect messages (ICMP), 31 redistribute command, parameters +for EIGRP redistribution, 410 for OSPF redistribution, 418 +redistribution filtering with distribute-list command, 447 +redundancy between eBGP neighbors, 567-569 +reference bandwidth (OSPF), changing, 338 +registering for ROUTE exam, xxxiii registry prefix assignment, 84 remote connectivity +GRE tunneling, 53-55 mGRE, 57-58 +NHRP, 59-61 VPNs +DMVPN, 56-57 hybrid VPNs, 51 MPLS-based VPNs, 50 +tunnel-based VPNs, 50-51 representing IPv6 addresses, 79-80 requirements +for eBGP neighborships, 565-567 for EIGRP neighborships, 144-145 for OSPF neighborships, 275-280 +Reserved field (TCP), 32 +Rest of Header field (ICMP), 31 + + + + + +From the Library of Alexey Evseenko +834 restricting EIGRP bandwidth consumed on WANs + + +restricting EIGRP bandwidth consumed on WANs, 170-171 +results of BGP route filtering, display-ing, 627-629 +RFCs, Informational RFCs, 8 +RIB (Routing Information Base), 652-653 +RIDs (Router IDs), 146 OSPF, 278-279 +RIP (Routing Information Protocol), 13 RIPng (RIP Next Generation), 107-114 +comparing with RIPv2, 108-109 configuring, 109-112 +verifying, 112-114 +RIPv2 (Routing Information Protocol version 2), 107-108 +RIRs (Regional Internet Registries), 77 ROUTE exam +contents of, xxx-xxxii format of, xxxiii-xxxiv +preparing for, xxxiv-xxxvi, 769 Cisco Learning Network, 771 +Pearson Cert Practice Test engine, 769-770 +practice exam, activating, 770 suggested study plan, 772-775 +registering, xxxiii route filtering, 194-207 +ACLs, 196-198 BGP, 620-630 +clearing neighborships, 625-627 displaying results of, 627-629 outbound filtering, 622-625 peer groups, 629-630 +configuring with route redistribution, 439-441 + +OSPF, 350-351 +filtering routes added to routing table, 355-356 +Type 3 LSA filtering, 351-355 prefix lists, 198-204, 689-692 +redistributed routes, filtering with route maps, 438-439 +redistribution filtering, verifying, 441-443 +route maps, 204-207 route maps, 204-207 +filtering redistributed routes, 438-439 LOCAL_PREF PA, setting, 648-651 matching packets with PBR, 484-485 for route redistribution, 436-437 Weight (BGP), setting, 642-643 +route redistribution, 409-410 into EIGRP, 410-417 +baseline configuration examples, 411-412 +configuring, 412-414 metrics, verifying, 445-446 +redistribute command parameters, 410 +verifying, 415-417 goal of, 409 +injecting routes into BGP, 585-587 need for, 405-407 +into OSPF, 417-436 command reference, 418 configuring, 419-423 +as E1 routes, 431-432 +external routes in NSSAs, 433-436 +intra-area E2 routes, 425-427 +setting external route type, 446-447 +setting metrics on redistributed routes, 423 + + + + + +From the Library of Alexey Evseenko +routing protocols 835 + + +redistribution filtering configuring, 439-441 distribute-list command, 447 verifying, 441-443 +route maps, 436-439 +routing domain loops, preventing with AD, 449-458 +with higher metrics, 448-449 with route tags, 459-461 +routing protocol migration, 36 +setting metrics for redistributed routes, 443-445 +topology tables, 409 +route summarization, 208-219 auto-summary, 217-219 benefits of, 213 +configuring, 213-217 +influencing best route selection, 210-211 +OSPF, 356-357 +manual summarization at ABRs, 357-360 +manual summarization at ASBRs, 360-361 +suboptimal forwarding, 211-213 summary routes, calculating, 209 +route tags, preventing domain loops, 459-461 +router eigrp asn command, 125-127 Router LSAs, 306-311 +router ospf process-id command, 266-268 +routers authentication, 740 +hashing authentication, 741-742 key chains, 742-744 +plain text authentication, 740-741 + +security +ACLs, 705-708 +management plane security, 708-728 +security policies, elements of, 704-705 +routing, 24-26. See also routing loops; routing protocols +asymmetric routing, 27-30 in enterprise networks, 6-7 +IPv6 routing over IPv4 sessions, config-uring, 678-684 +IPv6 routing over IPv6 BGP sessions, configuring, 684-688 +latency, 30 MTU, 30 +routing domain loops, preventing with AD, 449-458 +with higher metrics, 448-449 with route tags, 459-461 +routing loops, 12-13 preventing, 13, 614-620 +using iBGP mesh, 616-618 using redistribution, 618-620 +routing protocols AS, 10 +authentication, 736-737 in campus networks, 7 characteristics, 15 convergence, 12 +distance-vector routing protocols, 11-14 +EIGRP, 14, 125-130 periodic advertisements, 11 RIPng, 107-114 +RIPv2, 107-108 routing loops, 12 +dynamic routing protocols, 6 +EGPs, 11 + + + + + +From the Library of Alexey Evseenko +836 routing protocols + + +IGPs, 11 +link-state routing protocols, 14-15 migration strategies, 36-37 +path-vector routing protocols, 15 selection criteria, 8-11 +capability to perform summariza-tion, 9-10 +IT staff's familiarity with proto-col, 9 +scalability, 8 +speed of convergence, 9 vendor operability, 8 +RS (Router Solicitation) messages, 89-90 +RTM (Cisco IOS Routing Table Manager), 651-652 +RTP (Reliable Transport Protocol), 132 RTR (Response Time Reporter), 491 RTT (round-trip time), 34 +rules for writing IPv6 prefixes, 80-82 + +S + +SAF (Cisco Service Advertisement Framework), 14 +scalability as routing protocol selection criteria, 8 +scope of Query messages, limiting, 190-192 +stub routers, 190-191 summary routes, 192 +security +ACLs, 705-708 +infrastructure ACLs, 707-708 time-based ACLs, 705-707 +authentication, 740 +BGP authentication methods, 759-763 +EIGRP authentication methods, 744-751 + + +hashing authentication, 741-742 key chains, 742-744 +OSPF authentication methods, 751-759 +plain text authentication, 740-741 IPsec, 61-65 +AH, 62 ESP, 62 IKE, 62 +VPNs, configuring, 63-65 +IPv6 Internet connection security, 677 management plane security, 708-728 +AAA, 719-721 +NTP authentication, 724-728 password encryption, 711-714 SNMP, 721-724 +SSH, 709-711 uRPF, 714-719 +router security policies, elements of, 704-705 +security models, 723 +seeding EIGRP topology table, 162 segments, MSS, 34 +selecting routing protocols, 8-11 Sequence Number field (TCP), 32 SET messages (SNMP), 722 +shortage of IPv4 public addresses, solu-tions for, 77 +shortage of public addresses, solutions for, 539-540 +Internet route aggregation, 541-542 NAT, 543-544 +PAT, 543-544 +private IPv4 addresses, 544-545 +show bgp ipv6 unicast command, 683, 688 +show ip bgp command, 608, 633 + + + + + +From the Library of Alexey Evseenko +synchronization (BGP) 837 + + +show ip eigrp interfaces command, 128, 130 +show ip ospf database command, 310 +show ip ospf virtual-links command, 292-293 +show ip protocols command, 128, 130 show ip route command, 128 +show ipv6 route command, 681 +show running-config command, 101-102 +SIA-Query messages, 194 +single-homed Internet connection, 668 selecting BGP for, 553-554 +single-multihomed Internet connection, 561-562 +SLAAC (Stateless Address Autoconfiguration), 672-673 +sliding windows, 33-35 SNAT (Static NAT), 522-523 +SNMP (Simple Network Management Protocol), 721-724 +solicited node multicast addresses, 98 Source Address field (IPv4), 23 Source Address field (IPv6), 24 Source Port field (TCP), 32 +speed of convergence as routing proto-col selection criteria, 9 +SPF (Shortest Path First), 265 best path selection, 330-339 CPU processing, 337 +Split Horizon, 13, 166 +troubleshooting on Frame Relay multi-point subinterfaces, 167-170 +spoke routers, 59 +SSH (Secure Shell), 709-711 stateful DHCPv6, 672 +global unicast address assignment, 88-89 + +stateless autoconfiguration, 89, 105-106 +stateless DHCPv6, 672 +DNS IPv6 addresses, finding, 92 +static IPv4 address assignment, 514-516 +static IPv6 address configuration, 93, 96-103 +static neighbors (EIGRP), configuring, 141-144 +static routes, configuring to track IP SLA, 496-499 +STP (Spanning Tree Protocol), migration strategies, 38-39 +stub routers, 190-191 stubby areas, 364-366 +configuring, 366-371 +NSSAs, external routes, 433-436 stuck in active, 193-194 +subnets, 81 +subnetting, IPv6, 84-86 suboptimal forwarding, 211-213 successors, 184 +summarization, 208-219. See also route summarization +auto-summary, 217-219 benefits of, 213 configuring, 213-217 +influencing best route selection, 210-211 +limiting scope of Query messages, 192 +as routing protocol selection criteria, 9-10 +suboptimal forwarding, 211-213 summary routes, calculating, 209 +Summary LSAs, 317-321 +synchronization (BGP), 618-620 + + + + + + +From the Library of Alexey Evseenko +838 TACACS+, comparing with RADIUS + + +T + +TACACS+, comparing with RADIUS, 721 +TCP (Transmission Control Protocol), 21 +global synchronization, 35 MSS, 34 +out-of-order delivery, 35 three-way handshake, 33 windowing, 33-35 +TCP Flags field (TCP), 33 TCP Options field (TCP), 33 +TCP/IP, IPv4 header fields, 22-23 Telnet, 709-711 +three-way handshake, 33 +tiebreakers for best path selection, OSPF, 424 +time-based ACLs, 705-707 timers +Hello timer (EIGRP) configuring, 135-137 manipulating, 134-135 +Hold timer (EIGRP) configuring, 135-137 manipulating, 134-135 +TLDs (Top Level Domains), 540 topologies, EVN, 40 +topology table (EIGRP) +Frame Relay issues for topology exchange, 167-170 +populating, 162 +Total Length field (IPv4), 22 +totally stubby areas, configuring, 371-373 +tracking SLA operations to influence routing, 496-499 + + +traditional OSPFv3 configuration, 377-383 +traffic +anycast, 18-19 broadcast, 16-17 multicast, 17-18 unicast, 16 +Traffic Class field (IPv6), 23 transit AS, 621 +transport mode, 63 +Trap messages (SNMP), 722 troubleshooting +eBGP neighborships, 567-569 EIGRP topology exchange +Frame Relay issues, 167-170 TTL field (IPv4), 22 +tuning EIGRP metrics, 174-175 tunnel mode, 63 +tunnel-based VPNs, 50-51 tunneling +GRE tunneling, 53-55 +as IPv6 migration strategy, 38 ISAKMP, 62 +mGRE, 57-58 +Type 1 LSAs, 306-311 Type 2 LSAs, 312-317 +DR election process, 312 pseudonodes, 313 +show commands, 314-317 Type 3 LSAs, 317-321 +filtering, 351-355 Type 8 LSAs, 377 Type 9 LSAs, 377 Type field (ICMP), 31 +Type of Service field (IPv4), 22 + + + + + + + +From the Library of Alexey Evseenko +VPNs (virtual private networks) 839 + + +U + +UDP (User Datagram Protocol), charac-teristics, 35-36 +unequal metric load balancing, 180-183 unicast flooding, 27-30 +unicast IPv6 addresses, 94-96 link-local addresses, 95-96 unique local addresses, 94-95 +unicast traffic, 16 +unique local IPv6 addresses, 94-95 unknown addresses, representing, 96 Update messages +BGP, 577 EIGRP +contents of, 163-166 +EIGRP discovery and update pro-cess, 131-132 +Update process (EIGRP), 166-167 Urgent Point field (TCP), 33 +uRPF (Unicast Reverse Path Forwarding), 714-719 +username passwords, 713-714 + +V + +variance, 181-183 +vendor operability as routing protocol selection criteria, 8 +verifying BGP table +command reference, 581-582 prefixes, 577-580 +eBGP neighbors, 570-574 EIGRP, 127-130 +Hello timer, 137-141 Hold timer, 137-141 for IPv6, 240-243 +route redistribution, 415-417 + + +feasible successors, 185-188 GRE tunnels, 54-55 +iBGP, 606-607 IP SLA, 491 IPv6 ACLs, 677 +Named EIGRP, 250-252 NSSAs, 374-376 +OSPF, 268-271 +redistribution filtering, 441-443 RIPng, 112-114 +stubby areas, 366-371 +totally stubby areas, 371-373 virtual links, 292-294 +VRF-Lite, 502-504 Version field +IPv4, 22 IPv6, 23 +virtual links, 288-294 configuring, 291-292 verifying, 292-294 +VNET Trunk (Virtual Network Trunk), 39 +VPNs (virtual private networks) DMVPN, 56-57 +IPsec, 61-65 EVN +migrating to, 38-39 sample topology, 40 +hybrid VPNs, 51 IPsec, 61-65 +AH, 62 configuring, 63-65 ESP, 62 +IKE, 62 +MPLS-based VPNs, 50 +Layer 2 MPLS VPNs, 51 Layer 3 MPLS VPNs, 52 +tunnel-based VPNs, 50-51 + + + + +From the Library of Alexey Evseenko +840 VRF (Virtual Routing and Forwarding) + + +VRF (Virtual Routing and Forwarding), 39 +VRF-Lite, 39, 499-504 configuring, 500-502 verifying, 502-504 +VTY access, SSH versus Telnet, 709-711 + +W-X-Y-Z WANs +bandwidth, configuring on subinter-faces, 175-178 +EIGRP WAN bandwidth control, 170-171 +Frame Relay +EIGRP neighborships over, 147-148 +EIGRP topology exchange, trou-bleshooting, 167-170 + +Metro Ethernet, EIGRP neighborships over, 149 +MPLS-based VPNs, EIGRP neighbor-ships over, 148 +OSPF over, 281-290 WC (wildcard) mask, 196 Weight (BGP) +influencing outbound routes, 637-644 setting +with neighbor weight command, 643-644 +with route maps, 642-643 Window field (TCP), 33 windowing, 33-35 +WRED (Weighted Random Early Detection), 35 +writing IPv6 prefixes, 80-82 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +APPENDIX D + + + + + + +Memory Tables + + +Chapter 1 + +Table 1-2 Routing Protocol Characteristics + + +Routing Protocol +RIP + +EIGRP + +OSPF + +IS-IS + +BGP + +Type +Distance-Vector + +Primarily IGP or EGP +IGP + + + + +Chapter 3 + +Table 3-2 Hexadecimal/Binary Conversion Chart + +Hex Binary Hex Binary +0 0000 8 + +1 0001 9 + +2 0010 A + +3 0011 B + +4 C + +5 D + +6 E + +7 F + + + + + + + + + +From the Library of Alexey Evseenko +4 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 3-5 Summary of IPv6 Address Assignment for Global Unicast Addresses + + +Method + + + +Stateful DHCP +Stateless Autoconfig + +Dynamic or Static + + +Dynamic + +Prefix and Length Learned from... +DHCP Server + +Host Learned from... + +DHCP Server + +Default Router Learned from... +Router, using NDP + +DNS Addresses Learned from... +(Stateful) DHCP Server + +Static Configuration + +Static Config Static with EUI-64 + +Local config Derived from MAC + +Router, using NDP + +Stateless DHCP + + + + + +Table 3-7 + +Feature + + +Comparing Stateless and Stateful DHCPv6 Services + +Stateful DHCP Stateless DHCP + +Remembers IPv6 address (state information) of clients Yes No that make requests +Assigns IPv6 address to client + +Supplies useful information, such as DNS server IP addresses +Most useful in conjunction with stateless autoconfiguration + + + + +Table 3-9 + +Purpose + + +Common Multicast Addresses + +IPv6 Address IPv4 Equivalent + + + +All IPv6 nodes on the link + +All IPv6 routers on the link + +OSPF messages + +RIPv2 messages + +EIGRP messages + +DHCP relay agents (routers that forward to the DHCP server) +DHCP servers (site scope) + +All NTP servers (site scope) + +FF02::1 + + + + + + + + + + +FF05::101 + +Subnet broadcast address + +— + +224.0.0.5, 224.0.0.6 + +224.0.0.9 + +224.0.0.10 + +— + +— + +— + + + + + +From the Library of Alexey Evseenko +Appendix D: Memory Tables 5 + + +Table 3-12 + +Feature + + +Comparing RIPv2 to RIPng + +RIPv2 RIPng + + + +Advertises routes for... + +RIP messages use these Layer 3/4 protocols +UDP port + +Use distance vector + +Default administrative distance + +Supports VLSM + +Can perform automatic summarization +Uses Split Horizon + +Uses Poison Reverse + +30-second periodic full updates + +Uses triggered updates + +Uses Hop Count metric + +Metric meaning infinity + +Supports route tags + +Multicast Update destination + +Authentication + +IPv4 + +IPv4, UDP + + + + + + +Yes + + + + + + + + + + + + + + +RIP-specific + +IPv6 + +IPv6, UDP + +521 + + + +Yes + +— + + + + + + + + + + + + + +Uses IPv6 AH/ESP + + + + +Chapter 4 + + +Table 4-3 + +Feature +Transport + +Metric + + +EIGRP Feature Summary + +Description +IP, protocol type 88 (does not use UDP or TCP). + +Based on constrained bandwidth and cumulative delay by default, and optionally load and reliability. + +Hello interval + +Hold Timer + + + + + + + + +From the Library of Alexey Evseenko +6 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Feature Description Update destination address + +Full or partial updates + +Authentication + +VLSM/classless + +Route tags + +Next-hop field + +Manual route summarization + +Automatic summarization + +Multiprotocol Supports the advertisement of IPX, AppleTalk, IP version 4, and IP version 6 routes. + + + +Table 4-4 Neighbor Requirements for EIGRP and OSPF + + +Requirement +The routers must be able to send/receive IP packets to one another. + +Interfaces’ primary IP addresses must be in the same subnet. + +Must not be passive on the connected interface. + +Must use the same ASN (EIGRP) or process-ID (OSPF) in the router configuration command. + +EIGRP OSPF +Yes Yes + +Hello interval/timer, plus either the Hold (EIGRP) or Dead (OSPF) timer, must match. +Must pass neighbor authentication (if configured). Yes Yes + +Must be in the same area. — Yes + +IP MTU must match. + +K-values (used in metric calculation) must match. — + +Router IDs must be unique. No Yes +1 + +1 Duplicate EIGRP RIDs do not prevent routers from becoming neighbors, but it can cause problems when adding external EIGRP routes to the IP routing table. + + + + + + + +From the Library of Alexey Evseenko +Appendix D: Memory Tables 7 + +Chapter 5 + +Table 5-2 Common Defaults for Bandwidth and Delay + + +Interface Type +Serial + +GigE + +FastE + +Ethernet + +Bandwidth (kbps) +1544 + +1,000,000 + +100,000 + +10,000 + +Delay (Microseconds) +20,000 + + + + + +Table 5-4 + +Option + + +Parameters on the eigrp stub Command + +This Router Is Allowed to... + + + +connected + +summary + +static + +Advertise connected routes but only for interfaces matched with a network command. + + +leak-map name +redistributed + +receive-only + + + + +Chapter 6 + +Table 6-4 Configuration Modes of Named EIGRP + + +Configuration Mode +Address-Family + + + + +Address-Family-Interface + +Description +General EIGRP configuration commands are issued under this configuration mode. For example, router ID, network, and EIGRP stub router configurations are performed here. Multiple address families (for example, IPv4 and IPv6) can be configured under the same EIGRP virtual instance. + + + + + + + + + +From the Library of Alexey Evseenko +8 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Configuration Mode Description Address-Family-Topology + + + + + +Chapter 7 + + +Table 7-2 + +Term + + +Commonly Used OSPF Terms + +Definition + + + +Link-state database (LSDB) + +Shortest Path First (SPF) + + +Link-State Update (LSU) + +Link-State Advertisement (LSA) + +The data structure held by an OSPF router for the purpose of storing topology data +The name of the algorithm OSPF uses to analyze the LSDB (Note: The analysis determines the best [lowest-cost] route for each prefix/length.) +The name of the OSPF packet that holds the detailed topology information, specifically LSAs + + + +Area + + + +Area border router (ABR) + + + +Backbone router + +Internal routers + +Designated router (DR) + + + +Backup designated router (BDR) + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix D: Memory Tables 9 + + +Table 7-4 + +Feature +Transport + +Metric + + +OSPF Feature Summary + +Description +IP, protocol type 89 (does not use UDP or TCP). + +Based on cumulative cost of all outgoing interfaces in a route. The interface cost defaults to a function of interface bandwidth but can be set explicitly. + + + +Hello interval + +Dead interval + + +Update destination address + +Interval at which a router sends OSPF Hello messages out of an interface. +Timer used to determine when a neighboring router has failed, based on a router not receiving any OSPF messages, including Hellos, in this timer period. + + +Full or partial updates + +Authentication + +VLSM/classless + +Route tags + +Next-hop field + +Manual route summarization + + + +Table 7-5 Neighbor Requirements for EIGRP and OSPF + + +Requirement +Interfaces’ primary IP addresses must be in same subnet. + +Must not be passive on the connected interface. + +Must be in same area. + +OSPF EIGRP +Yes Yes + +Yes Yes + +— + + +Hello interval/timer, plus either the Hold (EIGRP) or Dead (OSPF) timer, must match. +Router IDs must be unique. + +IP MTU must match. + +Must pass neighbor authentication (if configured). + +K-values (used in metric calculation) must match. + +Must use the same ASN (EIGRP) or process ID (OSPF) on the router configuration command. + +1 Might allow the other router to be listed in the output of the show ip ospf neighbor command, but the MTU mismatch will prevent proper operation of the topology exchange. + + + +From the Library of Alexey Evseenko +10 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 7-6 OSPF Network Types + + +Interface Type + + + +Broadcast + +Point-to-point +1 + +Loopback + +Nonbroadcast2 (NBMA) +Point-to-multipoint +Point-to-multipoint nonbroadcast + +Uses DR/BDR? + + + +Yes + +No + +No + +Default Hello Interval + + +10 + +10 + +— + +Dynamic Discovery of Neighbors? + +Yes + +Yes + +— + +More Than Two Routers Allowed in the Subnet? +Yes + +No + +No + + +1 Default on Frame Relay point-to-point subinterfaces. + +2 Default on Frame Relay physical and multipoint subinterfaces. + + +Chapter 8 + +Table 8-2 OSPF LSA Types + + +LSA Type +1 + + + +2 + + +3 + + + +4 + +5 + +6 + +Common Name +Router + + + +Network + + +Net Summary + + + +ASBR Summary + +AS External + +Group Membership + +Description + + + + + + + + + + + + + + +Defined for MOSPF; not supported by Cisco IOS. + + + + + + + + +From the Library of Alexey Evseenko +Appendix D: Memory Tables 11 + + + +LSA Type 7 + +8 + + + + +9 + + + + +10, 11 + +Common Name NSSA External + +Link LSAs + + + + +Intra-Area Prefix LSAs + + + +Opaque + +Description +Created by ASBRs inside an NSSA area, instead of a Type 5 LSA. +Type 8 LSAs only exist on a local link, where they are used by a router to advertise the router’s link-local address to all other routers on the same link. Additionally, the Type 8 LSA provides to routers on that link a listing of all IPv6 addresses associated with the link. +Can send information about IPv6 networks (including stub networks) attached to a router (similar to the Type 1 LSA for IPv4 networks). Additionally, a Type 9 LSA can send information about transit IPv6 network segments within an area (similar to the Type 2 LSA for IPv4 networks). +Used as generic LSAs to allow easy future extension of OSPF. For example, Type 10 has been adapted for MPLS traffic engineering. + + + + +Table 8-4 OSPF Message Types and Functions + + +Message Name/Number +Hello + + + + + +Database Description (DD or DBD) + +Description +Used to discover neighbors and supply information used to confirm that two routers should be allowed to become neighbors, +to bring a neighbor relationship to a +2-Way state, and to monitor a neighbor’s responsiveness in case it fails. + + + + +Link-State Request (LSR) + + +Link-State Update (LSU) + +Link-State Acknowledgment (LSAck) + + + + + + + + + + + + +From the Library of Alexey Evseenko +12 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 8-5 OSPF Neighbor State Reference + + +State +Down + +Attempt + +Init + +Meaning +No Hellos have been received from this neighbor for more than the Dead interval. + +Used when the neighbor is defined with the neighbor command, after sending a Hello, but before receiving a Hello from that neighbor. + + + +2-Way + +ExStart + +Exchange + +Loading + +Full + + + + +Chapter 9 + +Table 9-4 OSPF Stubby Area Types + + +Area Type + + + +Stub + +Totally stubby + +NSSA + +Totally NSSA + +ABRs Flood Type 5 External LSAs into the Area? + +No + +ABRs Flood Type 3 Summary LSAs into the Area? + +Yes + +Allows Redistribution of External LSAs into the Stubby Area? +No + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix D: Memory Tables 13 + +Chapter 10 + + +Table 10-2 + +Option +protocol + +process-id, as-number + +metric + + +match + + +Parameters of the EIGRP redistribute Command + +Description +The source of routing information. Includes bgp, connected, eigrp, isis, mobile, ospf, static and rip. +If redistributing a routing protocol that uses a process ID or ASN on the router global config command, use this parameter to refer to that process or ASN value. +A keyword after which follow the four metric components (bandwidth, delay, reliability, link load), plus the MTU associated with the route. + + + +tag + + +route-map + + + + + +Table 10-4 + +Option + +protocol + + +Parameters on the OSPF redistribute Command + +Description +The source of routing information. Includes bgp, connected, eigrp, isis, mobile, ospf, static, and rip. + + + +process-id, as-number + + +metric + +If redistributing a routing protocol that uses a process ID or AS number on the router global config command, use this parameter to refer to that process ID or ASN value. + + +metric-type {1 | 2} + +match + + + +tag + + + + + + + + +From the Library of Alexey Evseenko +14 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Option Description route-map + +subnets + + + + + +Table 10-10 + +Route Type +Connected + +Static + + +Default Administrative Distances + +Administrative Distance + + +EIGRP summary route 5 + +eBGP + +EIGRP (internal) + +IGRP 100 + +OSPF 110 + +IS-IS + +RIP + +On-Demand Routing (ODR) 160 + +EIGRP (external) 170 + +iBGP + +Unreachable 255 + + + +Chapter 12 + +Table 12-2 Names of NAT IP Addresses + + +NAT IP Address +Inside local + +Inside global + +Outside local + +Definition +A private IP address referencing an inside device + + +Outside global + + + + + + +From the Library of Alexey Evseenko +Appendix D: Memory Tables 15 + +Chapter 13 + +Table 13-4 Comparing OSPF and EIGRP Logic to BGP + + +OSPF/EIGRP +Forms neighbor relationship before sending routing information +Neighbors typically discovered using multicast packets on the connected subnets +Does not use TCP + +BGP +Same + +Neighbor IP address is explicitly configured and may not be on common subnet + + +Advertises prefix/length + +Advertises metric information + + +Emphasis on fast convergence to the truly most efficient route +Link-state (OSPF) or distance-vector (EIGRP) logic + + + + +Table 13-6 + +State +Idle + +Connect + + +Active + + +BGP Neighbor States + +Typical Reasons +The BGP process is either administratively down or awaiting the next retry attempt. +The BGP process is waiting for the TCP connection to be completed. You cannot determine from this state information whether the TCP connection can complete. + + +Opensent + + +Openconfirm + + + +Established + + + + + + + +From the Library of Alexey Evseenko +16 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 13-7 + +Message +Open + + +Keepalive + + +BGP Message Types + +Purpose +Used to establish a neighbor relationship and exchange basic parameters, including ASN and authentication values. + + + +Similarity with EIGRP +Hello + + + + +Update + + +Notification No direct equivalent + + + + +Chapter 14 + +Table 14-4 BGP Path Attributes That Affect the BGP Best-Path Algorithm + + +PA + +Next_Hop + +Weight +1 + + + + +Local Preference (Local_Pref) + + + + +AS_Path (length) + +Origin + +Description + + + +A numeric value, range 0 through +216 – 1, set by a router when receiving Updates, influencing that one router’s route for a prefix. Not advertised to any BGP peers. +A numeric value, range 0 through 232 +– 1, set and communicated throughout a single AS for the purpose of influencing the choice of best route for all routers in that AS. + +Enterprise Route Direction (Typical) +— + +Outbound + + + + +Outbound + + + +Multi-Exit Discriminator (MED) + +1 Weight is not a BGP PA; it is a Cisco-proprietary feature that acts somewhat like a PA. + + + + + + +From the Library of Alexey Evseenko +Appendix D: Memory Tables 17 + +Table 14-5 BGP Decision Process Plus Mnemonic: N WLLA OMNI + + +Step Mnemonic Letter +0 N + +1 W + +2 L + +3 L + +Short Phrase +Next hop: reachable? + +Weight + +Which Is Better? +If no route to reach Next_Hop, router cannot use this route. +Bigger. + + +4 A + +5 O + +6 M + +7 N + +8 I + + + + +Chapter 16 + + +Table 16-3 + +Parameter +rx + +any + + +uRPF Configuration Parameters + +Description +Enables uRPF in strict mode + +Enables uRPF in loose mode + + +allow-default + + +allow-self-ping + + +acl + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +18 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 16-4 Contrasting the TACACS+ and RADIUS Protocols + + +Characteristic +Transport layer protocol + +Modularity + +TACACS+ RADIUS +TCP UDP + + + +Encryption + +Accounting functionality + +Standards-based + + + +Table 16-5 Components of an SNMPv1 and SNMPv2c Network Management Solution + + +Component +SNMP manager + + + +SNMP agent + +Description +An SNMP manager runs a network management application. This SNMP manager is sometimes referred to as a Network Management Server (NMS). + + + +Management Information Base (MIB) + + + + + + +Chapter 17 + +Table 17-2 OSPF Authentication Types + + +OSPF Authentication Type +Type 0 + +Type 1 + +Type 2 + +Description +Does not provide any authentication + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +APPENDIX E + + + + + + +Memory Tables Answer Key + + +Chapter 1 + +Table 1-2 Routing Protocol Characteristics + + +Routing Protocol +RIP + +EIGRP + +OSPF + +IS-IS + +BGP + +Type +Distance-Vector + +(Advanced) Distance-Vector + +Link-State + +Link-State + +Path-Vector + +Primarily IGP or EGP +IGP + +IGP + +IGP + +IGP + +EGP + + + + +Chapter 3 + +Table 3-2 Hexadecimal/Binary Conversion Chart + +Hex Binary Hex Binary +0 0000 8 1000 + +1 0001 9 1001 + +2 0010 A 1010 + +3 0011 B 1011 + +4 0100 C 1100 + +5 0101 D 1101 + +6 0110 E 1110 + +7 0111 F 1111 + + + + + + + + + +From the Library of Alexey Evseenko +4 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 3-5 Summary of IPv6 Address Assignment for Global Unicast Addresses + + +Method + + + +Stateful DHCP +Stateless Autoconfig + +Dynamic or Static + + +Dynamic + +Dynamic + +Prefix and Length Learned from... +DHCP Server + +Router, using NDP + +Host Learned from... + +DHCP Server + +Derived from MAC + +Default Router Learned from... +Router, using NDP +Router, using NDP + +DNS Addresses Learned from... +(Stateful) DHCP Server +Stateless DHCP + + + +Static Static Configuration + +Local config Local config Router, using NDP + +Stateless DHCP + + + +Static Config Static with EUI-64 + +Local config Derived from MAC + +Router, using NDP + +Stateless DHCP + + + + + +Table 3-7 + +Feature + + +Comparing Stateless and Stateful DHCPv6 Services + +Stateful DHCP Stateless DHCP + +Remembers IPv6 address (state information) of clients Yes No that make requests +Assigns IPv6 address to client Yes No + +Supplies useful information, such as DNS server IP Yes Yes addresses +Most useful in conjunction with stateless No Yes autoconfiguration + + + + +Table 3-9 + +Purpose + + +Common Multicast Addresses + +IPv6 Address IPv4 Equivalent + + + +All IPv6 nodes on the link + +All IPv6 routers on the link + +OSPF messages + +RIPv2 messages + +EIGRP messages + +DHCP relay agents (routers that forward to the DHCP server) +DHCP servers (site scope) + +All NTP servers (site scope) + +FF02::1 + +FF02::2 + +FF02::5, FF02::6 + +FF02::9 + +FF02::A + +FF02::1:2 + +FF05::1:3 + +FF05::101 + +Subnet broadcast address + +— + +224.0.0.5, 224.0.0.6 + +224.0.0.9 + +224.0.0.10 + +— + +— + +— + + + + + +From the Library of Alexey Evseenko +Appendix E: Memory Tables Answer Key 5 + + +Table 3-12 + +Feature + + +Comparing RIPv2 to RIPng + +RIPv2 RIPng + + + +Advertises routes for... + +RIP messages use these Layer 3/4 protocols +UDP port + +Use distance vector + +Default administrative distance + +Supports VLSM + +Can perform automatic summarization +Uses Split Horizon + +Uses Poison Reverse + +30-second periodic full updates + +Uses triggered updates + +Uses Hop Count metric + +Metric meaning infinity + +Supports route tags + +Multicast Update destination + +Authentication + +IPv4 + +IPv4, UDP + +520 + +Yes + +120 + +Yes + +Yes + +Yes + +Yes + +Yes + +Yes + +Yes + +16 + +Yes + +224.0.0.9 + +RIP-specific + +IPv6 + +IPv6, UDP + +521 + +Yes + +120 + +Yes + +— + +Yes + +Yes + +Yes + +Yes + +Yes + +16 + +Yes + +FF02::9 + +Uses IPv6 AH/ESP + + + + +Chapter 4 + + +Table 4-3 + +Feature +Transport + +Metric + + +EIGRP Feature Summary + +Description +IP, protocol type 88 (does not use UDP or TCP). + +Based on constrained bandwidth and cumulative delay by default, and optionally load and reliability. + + + +Hello interval + +Hold Timer + +Interval at which a router sends EIGRP Hello messages on an interface. +Timer used to determine when a neighboring router has failed, based on a router not receiving any EIGRP messages, including Hellos, in this timer period. + + + + + + + +From the Library of Alexey Evseenko +6 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Feature +Update destination address + + +Full or partial updates + +Authentication + +VLSM/classless + +Route tags + +Next-hop field + +Manual route summarization + +Automatic summarization + +Multiprotocol + +Description +Normally sent to 224.0.0.10, with retransmissions being sent to each neighbor’s unicast IP address. Can also be sent to the neighbor’s unicast IP address. +Full updates are used when new neighbors are discovered; otherwise, partial updates are used. +Supports MD5 authentication only. + +EIGRP includes the mask with each route, also allowing it to support discontiguous networks and VLSM. +Allows EIGRP to tag routes as they are redistributed into EIGRP. +Supports the advertisement of routes with a different next-hop router than the advertising router. +Allows route summarization at any point in the EIGRP network. +EIGRP supports, and defaults to use, automatic route summarization at classful network boundaries. +Supports the advertisement of IPX, AppleTalk, IP version 4, and IP version 6 routes. + + + + +Table 4-4 Neighbor Requirements for EIGRP and OSPF + +Requirement EIGRP OSPF +The routers must be able to send/receive IP packets to one another. Yes Yes + +Interfaces’ primary IP addresses must be in same subnet. Yes Yes + +Must not be passive on the connected interface. Yes Yes + +Must use the same ASN (EIGRP) or process-ID (OSPF) in the router Yes No configuration command. +Hello interval/timer, plus either the Hold (EIGRP) or Dead (OSPF) timer, No Yes must match. +Must pass neighbor authentication (if configured). Yes Yes + +Must be in same area. N/A Yes + +IP MTU must match. No Yes + +K-values (used in metric calculation) must match. Yes — + +Router IDs must be unique. No Yes +1 + +1 Duplicate EIGRP RIDs do not prevent routers from becoming neighbors, but it can cause problems when adding external EIGRP routes to the IP routing table. + + + + +From the Library of Alexey Evseenko +Appendix E: Memory Tables Answer Key 7 + +Chapter 5 + +Table 5-2 Common Defaults for Bandwidth and Delay + + +Interface Type +Serial + +GigE + +FastE + +Ethernet + +Bandwidth (kbps) +1544 + +1,000,000 + +100,000 + +10,000 + +Delay (Microseconds) +20,000 + +10 + +100 + +1000 + + + + + +Table 5-4 + +Option + + +Parameters on the eigrp stub Command + +This Router Is Allowed to... + + + +connected + +summary + +static + +leak-map name + +redistributed + +receive-only + +Advertise connected routes but only for interfaces matched with a network command. +Advertise auto-summarized or statically configured summary routes. + +Advertise static routes, assuming that the redistribute static command is configured. +Advertise routes (that would otherwise be part of a summary route) specified by a leak map. +Advertise redistributed routes, assuming that redistribution is configured. + +Does not advertise any routes. This option cannot be used with any other option. + + + + +Chapter 6 + +Table 6-4 Configuration Modes of Named EIGRP + + +Configuration Mode +Address-Family + + + + +Address-Family-Interface + +Description +General EIGRP configuration commands are issued under this configuration mode. For example, router ID, network, and EIGRP stub router configurations are performed here. Multiple address families (for example, IPv4 and IPv6) can be configured under the same EIGRP virtual instance. +Commands entered under interface configuration mode with a traditional EIGRP configuration are entered here for Named +EIGRP configuration. For example, timer and passive interface configurations are performed here. + + + + + + +From the Library of Alexey Evseenko +8 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Configuration Mode +Address-Family-Topology + +Description +Commands that have a direct impact on a router’s EIGRP topology table are given in this configuration mode. For example, variance and redistribution are configured in this mode. + + + + +Chapter 7 + + +Table 7-2 + +Term + + +Commonly Used OSPF Terms + +Definition + + + +Link-state database (LSDB) + +Shortest Path First (SPF) + + +Link-State Update (LSU) + +The data structure held by an OSPF router for the purpose of storing topology data +The name of the algorithm OSPF uses to analyze the LSDB (Note: The analysis determines the best [lowest-cost] route for each prefix/length.) +The name of the OSPF packet that holds the detailed topology information, specifically LSAs + +Link-State Advertisement (LSA) The name of a class of OSPF data structures that hold topology information (Note: LSAs are held in memory in an LSDB and communicate over a network in LSU messages.) + +Area + + + +Area border router (ABR) + + + +Backbone router + +Internal routers + +Designated router (DR) + + + + +Backup designated router (BDR) + +A contiguous grouping of routers and router interfaces (Note: Routers in an area strive to learn all topology information about the area, but they do not learn topology information about all other areas.) +A router that has interfaces connected to at least two different OSPF areas, including the backbone area (Note: ABRs hold topology data for each area, calculate routes for each area, and advertise those routes between areas.) +Any router that has at least one interface connected to the backbone area +A router that has interfaces connected to only one area, making the router completely internal to that one area +On multiaccess data links like LANs, an OSPF router elected by the routers on that data link to perform special functions (Note: These functions include generating LSAs representing the subnet and playing a key role in the database exchange process.) +A router on a multiaccess data link that monitors the DR and becomes prepared to take over for the DR, should the DR fail + + + + + +From the Library of Alexey Evseenko +Appendix E: Memory Tables Answer Key 9 + + +Table 7-4 + +Feature +Transport + +Metric + + +OSPF Feature Summary + +Description +IP, protocol type 89 (does not use UDP or TCP). + +Based on cumulative cost of all outgoing interfaces in a route. The interface cost defaults to a function of interface bandwidth but can be set explicitly. + + + +Hello interval + +Dead interval + + +Update destination address + +Full or partial updates + +Authentication + +VLSM/classless + +Route tags + +Next-hop field + +Manual route summarization + +Interval at which a router sends OSPF Hello messages out of an interface. +Timer used to determine when a neighboring router has failed, based on a router not receiving any OSPF messages, including Hellos, in this timer period. +Normally sent to 224.0.0.5 (All SPF Routers) and 224.0.0.6 (All Designated Routers). +Full updates used when new neighbors are discovered; partial updates used otherwise. +Supports MD5 and clear-text authentication. + +Includes the mask with each route, also allowing OSPF to support discontiguous networks and VLSM. +Allows OSPF to tag routes as they are redistributed into OSPF. + +Supports the advertisement of routes with a different next-hop router than the advertising router. +Allows route summarization at ABR routers only. + + + +Table 7-5 Neighbor Requirements for EIGRP and OSPF + + +Requirement +Interfaces’ primary IP addresses must be in same subnet. + +Must not be passive on the connected interface. + +Must be in same area. + +Hello interval/timer, plus either the Hold (EIGRP) or Dead (OSPF) timer, must match. +Router IDs must be unique. + +IP MTU must match. + +Must pass neighbor authentication (if configured). + +K-values (used in metric calculation) must match. + +Must use the same ASN (EIGRP) or process ID (OSPF) on the router configuration command. + +OSPF EIGRP +Yes Yes + +Yes Yes + +Yes N/A + +Yes No + +Yes No + +Yes No +1 + +Yes Yes + +N/A Yes + +No Yes + + +1 Might allow the other router to be listed in the output of the show ip ospf neighbor command, but the MTU mismatch will prevent proper operation of the topology exchange. + + + +From the Library of Alexey Evseenko +10 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 7-6 OSPF Network Types + + +Interface Type + + + +Broadcast + +Point-to-point +1 + +Loopback + +Nonbroadcast2 (NBMA) +Point-to-multipoint +Point-to-multipoint nonbroadcast + +Uses DR/BDR? + + + +Yes + +No + +No + +Yes + +No + +No + +Default Hello Interval + + +10 + +10 + +— + +30 + +30 + +30 + +Dynamic Discovery of Neighbors? + +Yes + +Yes + +— + +No + +Yes + +No + +More Than Two Routers Allowed in the Subnet? +Yes + +No + +No + +Yes + +Yes + +Yes + + +1 Default on Frame Relay point-to-point subinterfaces. +2 Default on Frame Relay physical and multipoint subinterfaces. + + +Chapter 8 + +Table 8-2 OSPF LSA Types + +LSA Type Common Name Description + +1 Router + + + + +2 Network + + +3 Net Summary + + + +4 ASBR Summary + +5 AS External + +6 Group Membership + +Each router creates its own Type 1 LSA to represent itself for each area to which it connects. The LSDB for one area contains one Type 1 LSA per router per area, listing the RID and all interface IP addresses on that router that are in that area. Represents stub networks as well. +One per transit network. Created by the DR on the subnet, and represents the subnet and the router interfaces connected to the subnet. +Created by ABRs to represent subnets listed in one area’s Type 1 and 2 LSAs when being advertised into another area. Defines the links (subnets) in the origin area, and cost, but no topology data. +Like a Type 3 LSA, except it advertises a host route used to reach an ASBR. +Created by ASBRs for external routes injected into OSPF. + +Defined for MOSPF; not supported by Cisco IOS. + + + + + + +From the Library of Alexey Evseenko +Appendix E: Memory Tables Answer Key 11 + + +LSA Type Common Name Description + +7 NSSA External + +8 Link LSAs + + + + +9 Intra-Area Prefix LSAs + + + +10, 11 Opaque + +Created by ASBRs inside an NSSA area, instead of a Type 5 LSA. +Type 8 LSAs only exist on a local link, where they are used by a router to advertise the router’s link-local address to all other routers on the same link. Additionally, the Type 8 LSA provides to routers on that link a listing of all IPv6 addresses associated with the link. +Can send information about IPv6 networks (including stub networks) attached to a router (similar to the Type 1 LSA for IPv4 networks). Additionally, a Type 9 LSA can send information about transit IPv6 network segments within an area (similar to the Type 2 LSA for IPv4 networks). +Used as generic LSAs to allow easy future extension of OSPF. For example, Type 10 has been adapted for MPLS traffic engineering. + + + + +Table 8-4 OSPF Message Types and Functions + + +Message Name/Number +Hello + + + + + +Database Description (DD or DBD) + + + +Link-State Request (LSR) + + +Link-State Update (LSU) + +Link-State Acknowledgment (LSAck) + +Description +Used to discover neighbors and supply information used to confirm that two routers should be allowed to become neighbors, +to bring a neighbor relationship to a +2-Way state, and to monitor a neighbor’s responsiveness in case it fails +Used to exchange brief versions of each LSA, typically on initial topology exchange, so that a router knows a list of that neighbor’s known LSAs +A packet that lists the LSIDs of LSAs that the sender of the LSR would like the receiver of the LSR to supply during database exchange +A packet that contains fully detailed LSAs, typically sent in response to an LSR message +Sent to confirm receipt of an LSU message + + + + + + + + + + + + +From the Library of Alexey Evseenko +12 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 8-5 + +State +Down + +Attempt + +Init + + +2-Way + +ExStart + +Exchange + +Loading + +Full + + +OSPF Neighbor State Reference + +Meaning +No Hellos have been received from this neighbor for more than the Dead interval. +Used when the neighbor is defined with the neighbor command, after sending a Hello, but before receiving a Hello from that neighbor. +A Hello has been received from the neighbor, but it did not have the local router’s RID in it or lists parameters that do not pass the neighbor verification checks. This is a permanent state when Hello parameters do not match. +A Hello has been received from the neighbor; it has the router’s RID in it, and all neighbor verification checks passed. +Currently negotiating the DD sequence numbers and master/slave logic used for DD packets. +Finished negotiating the DD process particulars, and currently exchanging DD packets. +All DD packets are exchanged, and the routers are currently sending LSR, LSU, and LSAck packets to exchange full LSAs. +Neighbors are fully adjacent, meaning that they believe that their LSDBs for that area are identical. Routing table (re)calculations can begin. + + + + +Chapter 9 + +Table 9-4 OSPF Stubby Area Types + + +Area Type + + + +Stub + +Totally stubby + +NSSA + +Totally NSSA + +ABRs Flood Type 5 External LSAs into the Area? + +No + +No + +No + +No + +ABRs Flood Type 3 Summary LSAs into the Area? + +Yes + +No + +Yes + +No + +Allows Redistribution of External LSAs into the Stubby Area? +No + +No + +Yes + +Yes + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix E: Memory Tables Answer Key 13 + +Chapter 10 + + +Table 10-2 + +Option +protocol + +process-id, as-number + +metric + + +match + + +tag + + +route-map + + + + +Table 10-4 + +Option + +protocol + +process-id, as-number + +metric + + +Parameters of the EIGRP redistribute Command + +Description +The source of routing information. Includes bgp, connected, eigrp, isis, mobile, ospf, static and rip. +If redistributing a routing protocol that uses a process ID or ASN on the router global config command, use this parameter to refer to that process or ASN value. +A keyword after which follow the four metric components (bandwidth, delay, reliability, link load), plus the MTU associated with the route. +If redistributing from OSPF, this keyword lets you match internal OSPF routes, external (by type), and NSSA external routes, essentially filtering which routes are redistributed. +Assigns a unitless integer value to the routes redistributed by this command—tags that can be later matched by other routers using a route map. +Applies the logic in the referenced route map to filter routes, set metrics, and set route tags. + + + +Parameters on the OSPF redistribute Command + +Description +The source of routing information. Includes bgp, connected, eigrp, isis, mobile, ospf, static, and rip. +If redistributing a routing protocol that uses a process ID or AS number on the router global config command, use this parameter to refer to that process ID or ASN value. +Defines the cost metric assigned to routes redistributed by this command, unless overridden by a referenced route map. + + + +metric-type {1 | 2} + +match + + + +tag + +Defines the external metric type for the routes redistributed by this command: 1 (E1 routes) or 2 (E2 routes). +If redistributing from another OSPF process, this keyword lets you match internal OSPF routes, external OSPF routes (either E1 or E2), and NSSA external routes, essentially filtering which routes are redistributed. +Assigns a unitless integer value to the routes redistributed by this command—a tag that can be later matched by other routers using a route map. + + + + + + +From the Library of Alexey Evseenko +14 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Option route-map + +subnets + + + + + +Table 10-10 + +Route Type +Connected + +Static + +Description +Applies the logic in the referenced route map to filter routes, set metrics, and set route tags. +Redistribute subnets of classful networks. Without this parameter, only routes for classful networks are redistributed. (This behavior is unique to the OSPF redistribute command.) + + + +Default Administrative Distances + +Administrative Distance +0 + +1 + + +EIGRP summary route 5 + +eBGP 20 + +EIGRP (internal) 90 + +IGRP 100 + +OSPF 110 + +IS-IS 115 + +RIP 120 + +On-Demand Routing (ODR) 160 + +EIGRP (external) 170 + +iBGP 200 + +Unreachable 255 + + + +Chapter 12 + +Table 12-2 Names of NAT IP Addresses + + +NAT IP Address +Inside local + +Inside global + +Outside local + +Outside global + +Definition +A private IP address referencing an inside device + +A public IP address referencing an inside device + +A private IP address referencing an outside device (seen when NAT is used at the destination location) +A public IP address referencing an outside device + + + + + + +From the Library of Alexey Evseenko +Appendix E: Memory Tables Answer Key 15 + +Chapter 13 + +Table 13-4 Comparing OSPF and EIGRP Logic to BGP + + +OSPF/EIGRP +Forms neighbor relationship before sending routing information +Neighbors typically discovered using multicast packets on the connected subnets +Does not use TCP + +Advertises prefix/length + +Advertises metric information + + +Emphasis on fast convergence to the truly most efficient route +Link-state (OSPF) or distance-vector (EIGRP) logic + +BGP +Same + +Neighbor IP address is explicitly configured and may not be on common subnet +Uses a TCP connection between neighbors (port 179) + +Advertises prefix/length, called Network Layer Reachability Information (NLRI) +Advertises a variety of path attributes (PA) that BGP uses instead of a metric to choose the best path +Emphasis on scalability; might not always choose the most efficient route +Path-vector logic (similar to distance-vector) + + + + + +Table 13-6 + +State +Idle + +Connect + + +Active + +Opensent + + +BGP Neighbor States + +Typical Reasons +The BGP process is either administratively down or awaiting the next retry attempt. +The BGP process is waiting for the TCP connection to be completed. You cannot determine from this state information whether the TCP connection can complete. +The TCP connection has been completed, but no BGP messages have yet been sent to the peer. +The TCP connection exists, and a BGP Open message has been sent to the peer, but the matching Open message has not yet been received from the other router. + + + +Openconfirm + + + +Established + +An Open message has been both sent to and received from the other router. The next step is to receive a BGP Keepalive message (to confirm that all neighbor-related parameters match) or a BGP Notification message (to learn that there is some mismatch in neighbor parameters). +All neighbor parameters match, the neighbor relationship works, and the peers can now exchange Update messages. + + + + + + +From the Library of Alexey Evseenko +16 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 13-7 + +Message +Open + + +Keepalive + + + + +Update + + +BGP Message Types + +Purpose +Used to establish a neighbor relationship and exchange basic parameters, including ASN and authentication values. +Sent on a periodic basis to maintain the neighbor relationship. The lack of receipt of a Keepalive message within the negotiated Hold timer causes BGP to bring down the neighbor connection. +Used to exchange PAs and the associated prefix/length (NLRI) that use those attributes. + + + +Similarity with EIGRP +Hello + + +Hello + + + + +Update + +Notification Used to signal a BGP error; typically results No direct equivalent in a reset to the neighbor relationship. + + +Chapter 14 + +Table 14-4 BGP Path Attributes That Affect the BGP Best-Path Algorithm + + +PA + +Next_Hop + +Weight +1 + +Description + +Lists the next-hop IP address used to reach a prefix. +A numeric value, range 0 through +216 – 1, set by a router when receiving Updates, influencing that one router’s route for a prefix. Not advertised to any BGP peers. + +Enterprise Route Direction (Typical) +— + +Outbound + +Local Preference (Local_Pref) A numeric value, range 0 through 232 Outbound – 1, set and communicated throughout +a single AS for the purpose of influencing the choice of best route for all routers in that AS. + +AS_Path (length) + +Origin + +The number of ASNs in the AS_Path PA. Outbound, Inbound + +Value implying that the route was Outbound injected into BGP; I (IGP), E (EGP), or ? (incomplete information). + + + +Multi-Exit Discriminator (MED) + +Set and advertised by routers in one AS, Inbound impacting the BGP decision of routers +in the other AS. Smaller is better. + + +1 Weight is not a BGP PA; it is a Cisco-proprietary feature that acts somewhat like a PA. + + + + +From the Library of Alexey Evseenko +Appendix E: Memory Tables Answer Key 17 + +Table 14-5 BGP Decision Process Plus Mnemonic: N WLLA OMNI + + +Step Mnemonic Letter +0 N + +1 W + +2 L + +3 L + +4 A + +5 O + +6 M + +7 N + +8 I + +Short Phrase +Next hop: reachable? + +Weight + +Local_Pref + +Locally injected routes +AS_Path length + +Origin + +MED + +Neighbor type + +IGP metric to Next_ Hop + +Which Is Better? +If no route to reach Next_Hop, router cannot use this route. +Bigger. + +Bigger. + +Locally injected is better than iBGP/eBGP learned. +Smaller. + +Prefer I over E. Prefer E over ? + +Smaller. + +Prefer eBGP over iBGP. + +Smaller. + + + + +Chapter 16 + + +Table 16-3 + +Parameter +rx + +any + + +uRPF Configuration Parameters + +Description +Enables uRPF in strict mode + +Enables uRPF in loose mode + + + +allow-default + + +allow-self-ping + + +acl + +Allows uRPF to use a default route if a network is not found in a router’s FIB (Note: The allow-default option can be used with either strict or loose mode.) +Allows a router to ping itself when checking the reachability of an IP address (Note: Cisco recommends against using the allow-self-ping option in most cases, because it introduces a security risk.) +Identifies an optional access control list that can either permit or deny traffic that fails the uRPF check + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +18 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 16-4 Contrasting the TACACS+ and RADIUS Protocols + + +Characteristic +Transport layer protocol + +Modularity + + +Encryption + +Accounting functionality + +Standards-based + +TACACS+ +TCP + +Provides separate services for authentication, authorization, and accounting +Encrypts entire packet + +Offers basic accounting features +No (Cisco-proprietary) + +RADIUS +UDP + +Combines authentication and authorization functions + +Only encrypts the password + +Offers robust accounting features +Yes + + + + +Table 16-5 Components of an SNMPv1 and SNMPv2c Network Management Solution + + +Component +SNMP manager + + + +SNMP agent + + +Management Information Base (MIB) + +Description +An SNMP manager runs a network management application. This SNMP manager is sometimes referred to as a Network Management Server (NMS). +An SNMP agent is a piece of software that runs on a managed device (for example, a server, router, or switch). +Information about a managed device’s resources and activity is defined by a series of objects. The +structure of these management objects is defined by a managed device’s Management Information Base (MIB). + + + + +Chapter 17 + +Table 17-2 OSPF Authentication Types + + +OSPF Authentication Type +Type 0 + +Type 1 + +Type 2 + +Description +Does not provide any authentication + +Provides plain text authentication + +Provides hashing authentication + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +APPENDIX F + + + + + + +Completed Planning Practice Tables + + +Chapter 1 + +Table 1-3 Design Review + + +Design Goal + +The design requires the number of entries in a router’s routing table to be reduced. +The design calls for the use of a distance-vector routing protocol. Identify the two approaches that a distance-vector routing protocol can use to prevent loops. (2) +The design calls for the use of a link-state routing protocol. (2) + +The design calls for IPv6 traffic to travel from a source IPv6 address to the nearest device of multiple devices assigned the same destination IPv6 address. +The design calls for the use of an NBMA network. Identify design issues that might be encountered when using EIGRP or OSPF. (2) +The design calls for the use of Hot Standby Router Protocol (HSRP). Identify the condition that can be created when return traffic flows through a standby HSRP router. +The design needs to mitigate a global synchronization condition (where all TCP flows simultaneously enter TCP slow start). + +Possible Implementation Choices Covered in This Chapter +Summarization. + +Split Horizon. + +Poison Reverse. + + +Use OSPF. + +Use IS-IS. + +Use anycast. + + + +Issue with EIGRP: Split Horizon. + +Issue with OSPF: Designated router. + +Asymmetric routing (or unicast flooding). + + + +Use WRED. + +The design requires a network to be migrated Configure both routing protocols, and use to a different routing protocol. (2) Administrative Distance (AD) to control +which routing protocol is being used. + +Use route redistribution as you migrate individual sections of the network. + + + + + +From the Library of Alexey Evseenko +4 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Design Goal + +The design requires that you virtualize multiple routers inside of physical routers and carry traffic for the virtual networks between those physical routers. + +Possible Implementation Choices Covered in This Chapter +Use Cisco Easy Virtual Networking (EVN). + + + + +Table 1-4 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan requires that Split Horizon be disabled for the hub router in a hub-and-spoke topology. Describe the purpose of Split Horizon. +The plan requires the use of EIGRP as the routing protocol. Provide a brief description of EIGRP. + + + + +The plan calls for the use of both IPv4 and IPv6. What network traffic types do IPv4 and IPv6 have in common, and what traffic types are different? +The plan calls for the use of Hot Standby Router Protocol (HSRP). What can you do to prevent an asymmetric routing issue, where traffic is forwarded from a subnet using the active HSRP router, and some of the return traffic returns using the standby HSRP router (because of load balancing)? +The design calls for the transmission of interactive voice and video over a network. What Layer 4 protocols are typically used to transmit voice and data media? (2) + +The plan requires that a network migrate from IPv4 to IPv6. Identify three strategies of a successful IPv6 migration. (3) + +Answers +Split Horizon is a feature that prevents a route learned on one interface from being advertised back out of that same interface. + +Enhanced Interior Gateway Routing Protocol (EIGRP) is classified as an advanced distance-vector routing protocol. It was Cisco-proprietary until early 2013, but is now open to other vendors. EIGRP uses the Diffusing Update Algorithm (DUAL) to make its path selection decisions. +Both IPv4 and IPv6 use unicasts and multicasts. However, IPv4 can use broadcasts, while IPv6 cannot. Also, IPv6 supports anycasts, while IPv4 does not. +Ideally, you should not span a VLAN across more than one access layer switch. However, if you must span a VLAN across multiple access layer switches, you can adjust the HSRP router’s ARP timer to be equal to or less than the CAM aging time. + +The Real-time Transport Protocol (RTP) is a Layer 4 protocol that carries voice and video media. RTP is encapsulated inside of User Datagram Protocol (UDP), which is another Layer 4 protocol. +Check existing equipment for IPv6 compatibility. + +Run IPv4 and IPv6 concurrently. + +Check the ISP’s support for IPv6. + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 5 + + + +Question +The plan calls for the use of Virtual Routing and Forwarding (VRF). Identify two approaches to configuring VRF. (2) + +Answers +A traditional way to configure VRF on Cisco routers is an approach called VRF-Lite. + +A newer approach to virtualized network configuration, called Cisco Easy Virtual Network (EVN), dramatically simplifies the relatively complex configuration required by VRF-Lite. + + + + +Chapter 2 + +Table 2-2 Design Review + + +Design Goal + +The design requires that routers at remote sites appear as adjacent to one another, and they are interconnected over an MPLS network. +The design requires customer edge (CE) routers at each enterprise site to communicate over an MPLS network and to form neighborships with provider edge (PE) routers to which they connect. +The design requires that multicast, broadcast, and unicast IP traffic between sites be secured within a VPN. + +The design requires that spokes in a hub-and-spoke VPN topology be able to dynamically form GRE tunnels between themselves. +The design requires that a single GRE tunnel interface support multiple GRE tunnels. +The design requires that spoke routers in a hub-and-spoke VPN design be able to query the hub to determine the IP address of a physical interface corresponding to the far side of a tunnel. +The design requires that you provide confidentiality, data integrity, authentication, and antireplay protection for unicast traffic flowing over a VPN. + +Possible Implementation Choices Covered in This Chapter +Use a Layer 2 MPLS VPN. + + +Use a Layer 3 MPLS VPN. + + + +Encapsulate the multicast, broadcast, and unicast IP traffic inside of a GRE tunnel, and then encapsulate the GRE packets inside of an IPsec tunnel. +Use Dynamic Multipoint VPN (DMVPN). + +Use multipoint GRE (mGRE). + +Use NHRP. + + + +Use IPsec. + + + + + + + + + +From the Library of Alexey Evseenko +6 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 2-3 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan requires that an MPLS VPN technology be used to interconnect remote sites. What broad categories of MPLS VPNs could you choose from? (Choose two.) +The plan mandates the use of a Layer 3 MPLS VPN. What routing protocol will the service provider probably use to propagate route information from a customer edge (CE) router at one site to a CE router at another site? +The plan calls for the use of a GRE tunnel. What protocols can you send over a GRE tunnel? + +The plan calls for the use of a Dynamic Multipoint VPN (DMVPN). What VPN technologies are required to support a DMVPN? (Choose three.) +The plan requires a hub router in a hub-and-spoke topology to have four GRE tunnels out to remote sites. If you use mGRE, how many tunnel interfaces need to be configured on the hub router to support the four GRE tunnels? +The plan calls for the use of NHRP in a hub-and-spoke VPN topology. What router, or routers, in the topology will hold the NHRP database? +The plan requires the use of IPsec. What are IPsec’s modes of operation? (Choose two.) + +Answer +Layer 2 MPLS VPNs, Layer 3 MPLS VPNs + + +Multiprotocol BGP (MP-BGP) + + + + +A GRE tunnel supports any Layer 3 protocol (including IP unicast, broadcast, and multicast traffic). +Multipoint GRE (mGRE), Next Hop Resolution Protocol (NHRP), IPsec + +One + + + + +The hub router + + +Transport Mode, Tunnel Mode + + + + + +Table 2-4 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Create a GRE virtual tunnel interface (in global configuration mode). +Assign an IP address to a GRE tunnel (in interface configuration mode). +Specify the source of a GRE tunnel (in interface configuration mode). +Specify the destination of a GRE tunnel (in interface configuration mode). + + +interface tunnel id + +ip address ip_address subnet_mask + +tunnel source {interface_id | ip_address} + +tunnel destination ip_address + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 7 + +Table 2-5 Verification Plan Memory Drill + + +Information Needed +Verify the interface status and encapsulation of a GRE tunnel. + +Command(s) + +show interface tunnel id + +Verify that a router sees the far side of a GRE trace route ip_address_of_far_side_of_ tunnel as a single hop away, even though tunnel +multiple routers might need to be transited to reach the far side of the tunnel. + + + +Chapter 3 + +Table 3-14 Design Review + + +Design Goal + +An IPv6 design suggests that all client hosts should dynamically learn their IPv6 addresses. Which tools can be used? (2) + +Possible Implementation Choices Covered in This Chapter +Stateful DHCP + +Stateless autoconfig + +A plan shows the use of stateless To supply the DNSv6 server’s IPv6 addresses autoconfiguration. What functions should we +expect the IPv6 DHCP server to perform? + + + +Table 3-15 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answers +An implementation plan states that router IPv6 Statically configure the entire address addresses should be assigned as obvious values, with the ipv6 address command. using the lowest numbers in the range per each +Configure the MAC address to a low +number, and configure the address with +assigned prefix. What configuration methods could +be used to configure these low address values? the ipv6 address eui-64 command. + + +A plan calls for the use of stateless autoconfig for client hosts. What must be configured on the routers to support this process? + + + +A RIPng implementation plan lists two neighboring routers with unicast IPv6 addresses 2000::1/64 +and 2001::2/64, respectively. Will this cause a neighborship issue? + +Routers must respond to Router Solicitation messages with Router Advertisement (RA). To do so, a router must have IPv6 routing enabled and a unicast IPv6 address configured on the interface in which the RS is received. +No; RIPv6 does not use the concept of neighbors, but it also does not prevent routes from being exchanged. + + + + + +From the Library of Alexey Evseenko +8 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 3-16 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Globally enable the routing of IPv6 unicast traffic. +Globally enable Cisco Express Forwarding (CEF) for IPv6. +Configure flow-label marking in 1280-byte or larger packets sent by the router. +Configure the full global unicast address on an interface. + + +ipv6 unicast-routing + +ipv6 cef + +ipv6 flowset + +interface type number + +ipv6 address address/prefix-length + + +Configure the unicast IPv6 prefix on an interface type number +interface, and let the router add the interface ID. ipv6 address address/prefix-length eui-64 + + +Configure an interface to find its unicast IPv6 address using stateless autoconfig. + +Configure an interface to enable IPv6 and use another interface’s IPv6 address as needed. + +Enable IPv6 on an interface and do not configure a unicast IPv6 address. + +Configure the link-local address of an interface. + +Assuming that IPv6 routing and IPv6 addresses have already been configured, configure RIPng. + + +interface type number + +ipv6 address autoconfig + +interface type number + +ipv6 unnumbered type number + +interface type number + +ipv6 enable + +interface type number + +ipv6 address address link-local + +ipv6 router rip process-name + +interface type number + +ipv6 rip process-name enable + +(Repeat previous two commands for each interface.) + + + + +Table 3-17 Verification Plan Memory Drill + + +Information Needed +All IPv6 routes + +A single line per IPv6 address + +Detailed information about IPv6 on an interface, including multicast addresses +The MAC address used by an interface + +Commands +show ipv6 route + +show ipv6 interface brief + +show ipv6 interface [type number] + +show interfaces [type number] + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 9 + + + +Information Needed +The MAC addresses of neighboring IPv6 hosts + +The information learned from another router in an RA message +All RIP-learned IPv6 routes + +All next-hop IPv6 addresses used by RIP routes + +The interfaces on which RIP is enabled + +Commands +show ipv6 neighbors show ipv6 router + +show ipv6 route rip + +show ipv6 rip next-hops + +show ipv6 protocols + + + + +Chapter 4 + +Table 4-5 Design Review + + +Design Goal + +Improve EIGRP convergence. + +Implement EIGRP on each router so that neighborships are formed (2). + + + + +Limit neighborship formation on interfaces matched with an EIGRP network command (3). + +Possible Implementation Choices Covered in This Chapter +Tune EIGRP Hold and Hello Timers so that neighbor failures are recognized more quickly. +Discover neighbors using multicasts as a result of matching an interface with the EIGRP network command, in router EIGRP configuration mode. + +Allow only specific neighbors on an interface by configuring the neighbor command in router EIGRP configuration mode. +Use EIGRP authentication to allow only neighbors with the correct keys. + +Prevent all neighborships on an interface by making the interface passive. + +Allow only specific neighbors on an interface by configuring a static neighbor. + + + + +Table 4-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +What happens on a router interface on which an EIGRP network command matches the interface? (2) + +Answer +EIGRP attempts to discover EIGRP neighbors by sending and receiving multicast EIGRP Hellos. + +EIGRP advertises about the subnet on the connected interface. + + + + + + +From the Library of Alexey Evseenko +10 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Question Answer +What configuration settings prevent Static configuration of at least one neighbor on EIGRP neighbor discovery on an EIGRP- that interface. +enabled interface? (2) Configuring the interface as passive. + + +What configuration settings prevent any neighborships on an EIGRP-enabled interface? +What settings do potential neighbors check before becoming EIGRP neighbors? (5) + + + + + +What settings that you might think would impact EIGRP neighbor relationships actually do not prevent neighborship? (3) + +Configuring the interface as passive. + + +Whether the neighbor’s IP address is in the same primary subnet as the local router. + +EIGRP authentication failure. + +ASN in router eigrp asn commands must match. + +The interfaces cannot be passive. + +The configured K-values must match. + +Mismatched Hello and Hold Timer settings. + +Duplicate Router IDs. + +IP MTU mismatch. + + + + + +Table 4-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Enabling EIGRP on interfaces + + +Setting Hello and Hold Timers + + +Passive interfaces + + + +Static EIGRP neighbors + +K-values + +EIGRP router ID + + +router eigrp autonomous-system + +network network-number [wildcard-mask] + +ip hello-interval eigrp as-number timer-value + +ip hold-time eigrp as-number timer-value + +passive-interface type number + +passive-interface default + +no passive-interface type number + +neighbor a.b.c.d interface + +metric weights 0 k1 k2 k3 k4 k5 + +eigrp router-id a.b.c.d + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 11 + +Table 4-8 Verification Plan Memory Drill + + +Information Needed +Routes that have been added to the IP routing table by EIGRP. +All routes in a router’s routing table. + +The specific route for a single destination address or subnet. +A listing of all (both statically configured and dynamically discovered) EIGRP neighbors. + +Notation as to whether a neighbor was dynamically discovered or statically configured. +A listing of statistics regarding the numbers of EIGRP messages sent and received by a router. +A listing of interfaces on which EIGRP has been enabled (by virtue of the EIGRP network command). +A listing of the number of EIGRP peers known through a particular interface. + + +The elapsed time since a neighborship was formed. + + +The parameters of any EIGRP network commands. + +The configured Hello timer for an interface. + +The configured Hold Timer for an interface. + +The current actual Hold Timer for a neighbor. + +A router’s EIGRP ASN. + + + +A list of EIGRP passive interfaces. + +A list of nonpassive EIGRP interfaces. + +A listing of EIGRP K-values. + +A listing of traffic statistics about EIGRP. + +A router’s EIGRP Router ID. + +Command +show ip route eigrp + +show ip route + +show ip route ip-address [mask] + +show ip eigrp neighbors + +show ip eigrp neighbors detail + +show ip eigrp neighbors detail + +show ip eigrp traffic + +show ip eigrp interfaces + +show ip eigrp interfaces detail + +show ip eigrp interfaces + +show ip eigrp interfaces detail + +show ip eigrp interfaces type number + +show ip protocols + +show ip eigrp neighbors [detail] + +show ip protocols + +show ip eigrp interfaces detail [type number] +None + +show ip eigrp neighbor [detail] + +show ip protocols + +show ip eigrp traffic + +show ip eigrp accounting + +show ip protocols + +show ip eigrp interfaces [detail] + +show ip protocols + +show ip eigrp traffic + +show ip eigrp topology + +show ip eigrp accounting + + + + + + +From the Library of Alexey Evseenko +12 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Chapter 5 + +Table 5-8 Design Review + + +Design Goal + +Limit consumption of IP subnets in Frame Relay WAN design. +In a relatively slow Frame Relay WAN, protect against consuming too much bandwidth with overhead EIGRP traffic. +Plan to change bandwidth from 1X CIR to 2X CIR on all Frame Relay subinterfaces. + +Possible Implementation Choices Covered in This Chapter +Use multipoint subinterfaces, with more than two routers sharing the same WAN subnet. +Use the EIGRP WAN bandwidth control feature to limit the amount of bandwidth consumed by EIGRP. +Adjust metrics with delay as well, to ensure the correct best routes are chosen plus backup routes are feasible successors where possible. + +Plan to set bandwidth to values other than Ask whether the design could use delay actual interface speeds to manipulate EIGRP instead. +metrics. + + +A goal of ensuring all remote routers’ secondary EIGRP routes do not require queries for convergence. +What tools can we use to meet the design goal of fast convergence? (four items) + + + + + + +R1 and R2 will advertise the same summary route; ensure that R1 is the preferred EIGRP path for that summary. +Prevent the edge routers in sites for one division of the company from knowing routes for subnets in another division. + +Tune metrics using delay or offset lists such that secondary routes are FS routes. + +Tune metrics so that feasible successor routes exist. + +Make appropriate routers EIGRP stubs. + +Use unequal cost multipath to add multiple routes to the routing table. + +Use route summarization to limit query scope. + +Tune EIGRP metrics so that all R2’s metrics for the subordinate routes are higher than the metric of R1’s best subordinate route. +Use EIGRP route filtering (distribution lists). + +Always ensure that the shortest path is taken Avoid the use of summary routes. with each route. + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 13 + +Table 5-9 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +A Frame Relay multipoint interface, with 20 PVCs attached, has a configuration for 10 percent of the bandwidth to be used for EIGRP. How much is allocated per PVC? +A configuration lists the no ip split-horizon command. When would that matter? + +The plan calls for setting all EIGRP K-values to 1. What negative effect could this have on routes in the IP routing table? +The configuration uses offset lists. Will that impact the calculation of FD and/or RD? +The plan lists a sample configuration migrating an interface from delay 20 to delay 200. How much will the metric go up? + + + +The plan shows extensive use of Class C private networks inside a large enterprise. What effect might EIGRP auto-summary have? + +The plan shows a sample configuration of the ip summary-address eigrp 1 10.10.0.0 255.255.252.0 command on Router R1. What routes should I see on R1? What will their administrative distance be? + + +The plan shows the use of the variance 4 command. What must be configured to add other routes to a routing table? (two items) + + + +The plan calls for filtering 10.10.10.0/26 and 10.10.12.0/26, but not 10.10.11.0/24. What tools can be used? + +Answer +Cisco IOS first divides the subinterface bandwidth by 20 (the number of PVCs) and then takes 10% (per the configuration). + +This command influences RIP’s use of +Split Horizon, not EIGRP’s, so consider the routing protocol in use. +Route flapping. + + +Both. + +The delay interface subcommand and the metric formula both use a unit of tens-of microseconds. In this case, the delay is 180 more, and then multiplied by 256, for a total of 4608. (Note: Don’t worry if your answer wasn’t as detailed in this case.) +Auto-summary will cause EIGRP to advertise a summary for a Class C network when advertising out an interface in a different Class C network, resulting in many summary routes. +R1 will list 10.10.0.0/18 as a summary route, AD 5, with outgoing interface null0, if at least one subordinate route exists. R1 will also have routes for all the subordinate subnets in the range. Other routers will just see a summary route, with the same EIGRP AD (90) as for other internal routes. +Check that the number of maximum-paths is high enough for all the routes you want to include. + +Configure metrics such that the alternative routes are feasible successors. +EIGRP distribution lists, with a prefix-list or route-map that refers to a prefix-list for matching. An ACL can also be used, matching each prefix explicitly. + + + + + + + +From the Library of Alexey Evseenko +14 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 5-10 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Enabling EIGRP on interfaces + + +Enabling or disabling Split Horizon for EIGRP +Setting the bandwidth consumed by EIGRP on an interface +Setting an interface’s logical bandwidth + +Setting an interface’s logical delay + +K-values + +Configuring an EIGRP offset list that matches a prefix + + + + +Configuring an EIGRP offset list that matches a prefix and prefix length + + + +Configuring a summary route + + + +Enabling or disabling auto-summary + + +Configuring unequal-cost load balancing + + + +Configuring an EIGRP stub router + +Filtering EIGRP routes using numbered ACLs + + +router eigrp autonomous-system + +network network-number [wildcard-mask] + +[no] ip split-horizon eigrp asn + +ip bandwidth-percent eigrp asn percent + +bandwidth value + +delay value + +metric weights tos k1 k2 k3 k4 k5 + +1) Create an IP ACL to match routes (various; considered prerequisite). + +2) In EIGRP configuration mode, configure: + +offset-list {access-list-number | access-list-name} {in | out} offset [interface-type interface-number] +The same as the previous row of the table, except that you create an extended IP ACL that matches the prefix with the ACL source IP address parameter, and the mask with the destination IP address field. +In interface mode: + +ip summary-address eigrp asn prefix subnet-mask [admin-distance] +(EIGRP configuration mode.) + +[no] auto-summary + +maximum-paths value + +variance value + +Tune metrics to ensure feasible successor routes. + +eigrp stub [[connected] [summary] [static] [redistributed]] | [receive-only]] +access-list {1-99} {permit | deny} subnet-number wildcard-mask + +router eigrp asn + +distribute-list acl-number {in | out} [interface-type number] + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 15 + + + +Feature +Filtering EIGRP routes using prefix lists + + + + + + +Enabling filtering EIGRP routes using route maps + + + +Configure a default route using ip default-network +Configure a default route using static routes + +Configuration Commands/Notes +ip prefix-list [seq sequence-no] list-name [seq seq-value] {deny | permit prefix/prefix-length} [ge ge-value] [le le-value] + +router eigrp asn + +distribute-list prefix prefix-list-name {in | out} [interface-type number] +(Create route map.) + +router eigrp asn + +distribute-list route-map route-map-name {in | out} [interface-type number] + +ip default-network net-id + +ip route 0.0.0.0 0.0.0.0 outgoing-interface + + + + +Table 5-11 Verification Plan Memory Drill + + +Information Needed +The composite metric values for all EIGRP prefixes. +Display EIGRP Split Horizon settings. + +Calculate the maximum bandwidth EIGRP will consume on a physical or point-to-point subinterface. + + +Calculate the maximum bandwidth EIGRP will consume per PVC on a multipoint Frame Relay subinterface. + + + + + + + +Display the increase in RD after implementing an EIGRP offset list. + +Command + +show ip eigrp topology prefix/length + +show running-config + +show interfaces to find the interface bandwidth + +show running-config to find the EIGRP bandwidth percentage +show interfaces to find the interface bandwidth + +show running-config to find the EIGRP bandwidth percentage + +show frame-relay pvc interface number type to find the number of active PVCs associated with the interface + +Calculate (interface bandwidth/# pvcs) * percentage +show ip route + +show ip eigrp topology + +show ip eigrp topology prefix/length + + + + + + +From the Library of Alexey Evseenko +16 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Information Needed +Display interface bandwidth and delay settings. + +List EIGRP K-values. + +Find the number of successor and feasible successor routes. + +Find all routes, including nonsuccessors. + + + +Determine whether the local router is a stub router. + +Determine whether a neighboring router is a stub router. +Display a summary IP route. + +On summarizing router, display EIGRP topology info on a summary route. + +Command +show ip eigrp topology + +show ip eigrp topology prefix/length show ip protocols +show ip eigrp topology + +show ip eigrp topology prefix/length show ip eigrp topology all-links +show ip eigrp topology all-links prefix/ length +show running-config + +show ip protocols + +show ip eigrp neighbors detail + +show ip route + +show ip eigrp topology prefix/length + +On summarizing router, display IP routes for show ip route prefix mask longer-prefixes a summary route and its subordinate routes. + + +On summarizing router, display the administrative distance of the null route. +Display the current auto-summary setting. + +Find the current settings of variance and maximum-paths. +Display messages each time EIGRP suppresses a prefix advertisement because of Split Horizon. +Display prefix lists. + +Display route maps. + +Determine whether a prefix in the EIGRP topology table has been flagged as a candidate default route. +Determine whether an IP route has been flagged as a candidate default route. + +Display a router’s preferred default route. + + +show ip route prefix mask + +show ip protocols + +show ip protocols + +debug eigrp packet + + +show ip prefix-list + +show route-maps + +show ip eigrp topology prefix/length + +Look for the exterior flag setting. + +show ip route + +Look for the asterisk beside the route. + +show ip route + +Look for the gateway of last resort setting. + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 17 + +Chapter 6 + +Table 6-5 Design Review + + +Design Goal + +Support the routing of IPv6 routes on a network currently using EIGRP for IPv4. +A router currently has a complex EIGRP configuration, with multiple EIGRP-related commands under various interfaces, in addition to multiple EIGRP commands under router configuration mode. This configuration needs to be simplified so that it becomes easier to understand and troubleshoot. + +Possible Implementation Choices Covered in This Chapter +Configure EIGRP for IPv6, which allows the network to continue using EIGRP. +Replace the router’s traditional EIGRP configuration with a Named EIGRP configuration, which consolidates all of a router’s EIGRP commands under a single hierarchical structure. + + + + +Table 6-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +Some documentation refers to EIGRP for IPv4 as EIGRPv4 and to EIGRP for IPv6 as EIGRPv6. Does this mean there is a “version 5” of EIGRP? + +If the EIGRP configuration on corporate routers is migrated from a traditional EIGRP configuration to a Named EIGRP configuration, will network technicians and help desk staff need to learn a new set of +verification and troubleshooting commands? + +Answer + +No. Documentation that refers to EIGRP for IPv6 as EIGRPv6 does so because of its relationship to IPv6, not because it is the sixth generation of EIGRP. +No. Even though Named EIGRP has a significantly different configuration than a traditional EIGRP configuration, the verification commands (for example, the show commands) remain the same. + + + + + +Table 6-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Enable IPv6 routing. + +Enable EIGRP for IPv6. + +ipv6 unicast-routing + +ipv6 router eigrp {1 – 65535} + + +Enable IPv6 on an interface, causing a router ipv6 enable to derive a link-local address for the interface. + +Configure an IPv6 address on an interface. + +Enable EIGRP for IPv6 on an interface. + + +ipv6 address address/prefix-length [eui-64] + +ipv6 eigrp asn + + + + + + +From the Library of Alexey Evseenko +18 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Feature +Configure a router ID for EIGRP for IPv6. + +Create a Named EIGRP virtual instance. + +Specify an address family along with an autonomous system number. +Enter Address-Family-Interface configuration mode. +Enter Address-Family-Topology configuration mode for the base topology. + +Configuration Commands/Notes +eigrp router-id rid + +router eigrp virtual-instance-name + +address-family {ipv4 | ipv6} autonomous-system asn + +af-interface {default | interface-id} + +topology base + + + + +Table 6-8 Verification Plan Memory Drill + + +Information Needed +Show all EIGRP-learned IPv4 routes. + +Show all EIGRP-learned IPv6 routes. + +Show the variance configured for an EIGRP for IPv4 autonomous system. +Show the variance configured for an EIGRP for IPv6 autonomous system. +Show the Hello Interval for an EIGRP for IPv4 autonomous system. +Show the Hello Interval for an EIGRP for IPv6 autonomous system. +Display the EIGRP topology table for an EIGRP for IPv4 autonomous system. +Display the EIGRP topology table for an EIGRP for IPv6 autonomous system. +Display sent and received updates for an EIGRP for IPv4 autonomous system. +Display sent and received updates for an EIGRP for IPv6 autonomous system. + +Command(s) +show ip route + +show ipv6 route + +show ip protocols + +show ipv6 protocols + +show ip eigrp interfaces detail + +show ipv6 eigrp interfaces detail + +show ip eigrp topology [all-links] + +show ipv6 eigrp topology [all-links] + +debug ip eigrp notifications + +debug ipv6 eigrp notifications + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 19 + +Chapter 7 + +Table 7-7 Design Review + + +Design Goal + +Improve OSPF convergence. + +Implement OSPF on each router so that neighborships are formed (2). + + + + + + +Limit neighborship formation on OSPF-enabled interfaces (2). + + + +The design shows branch routers with WAN interfaces in area 0 and LAN interfaces in different areas for each branch. What LSDB information do you expect to see in the branch routers? + +Possible Implementation Choices Covered in This Chapter +Tune OSPF Hello and Dead intervals so that neighbor failures are recognized more quickly. +Discover neighbors using multicasts as a result of matching an interface with the OSPF network command, in router OSPF configuration mode. + +Instead of the OSPF network command, use the ip ospf process-id area area-id interface subcommand to enable OSPF on an interface. +Use OSPF authentication to allow only neighbors with the correct keys. + +Prevent all neighborships on an interface by making the interface passive. +The branch routers, traditionally less expensive, less powerful, with less memory, will need to hold the area 0 LSDB, which can become large given the design. + +A merger design plan shows two Physical links between routers in the two area 0s. companies with OSPF backbone areas. +A virtual link. +How can the two area 0s be connected? (2) + + + +Table 7-8 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +What happens on a router interface on which an OSPF network command matches the interface? (2) + + + +What configuration settings prevent OSPF neighbor discovery on an OSPF-enabled interface? + +Answers +OSPF attempts to discover OSPF neighbors by sending and receiving multicast OSPF Hellos. + +OSPF advertises about the subnet on the connected interface. +Configuring the interface as passive. + + + + + + + +From the Library of Alexey Evseenko +20 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Question +What settings do potential neighbors check before becoming OSPF neighbors? (7) + + + + + + + + + +What settings that many CCNP candidates might think would impact OSPF neighbor relationships actually do not prevent a neighborship from forming? +A design shows one main site and 100 branches, with OSPF and MPLS VPNs. How many OSPF neighborships over the WAN do you expect to see on the central-site router? +A design shows one main site and 100 branches, with one Frame Relay PVC between the +main site and each branch. How many OSPF neighborships over the WAN do you expect to see on the central-site router? +A design shows six routers connected to the same VLAN and subnet. How many OSPF fully adjacent neighborships over this subnet do you expect each router to have? + +A design shows one main site and 100 branches, each connected with a VPWS service. The configuration shows that the central-site router uses a separate VLAN subinterface to connect to each branch, but the branch routers do not have a VLAN connecting to other branches. How many OSPF fully adjacent neighborships over the WAN do you expect to see on the central site router? + +Answers +Whether the neighbor’s IP address is in the same primary subnet as the local router. + +OSPF authentication failure. + +The interfaces cannot be passive. + +Must be in the same area. + +Hello and Dead intervals must match. + +Unique RIDs. + +IP MTUs must match. + +Mismatched process IDs on the router ospf commands. + + +One. Each router becomes neighbors with the provider edge (PE) router inside the MPLS VPN service. + +100. The central site router forms a neighborship with each branch router. + + + +The DR and BDR will be fully adjacent with each other and with all four of the other routers. The other four routers will be fully adjacent with only two routers: the DR and BDR. +100. The central site’s subinterface for each VLAN acts like a separate logical interface. A DR and BDR will be used, but in this design, 100 such instances exist, and the central site will become fully adjacent with all 100 branches. + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 21 + + +Table 7-9 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Enabling OSPF on interfaces—traditional method + + +router ospf process-id + +network network-number wildcard-mask area area-id + +Enabling OSPF on interfaces—using interface router ospf process-id subcommands interface type number + + + +Setting Hello and Dead intervals + + +Passive interfaces, with router subcommands + + + +OSPF router ID + +Create a virtual link through transit area X + +ip ospf process-id area area-id + +ip ospf hello-interval timer-value + +ip ospf dead-interval timer-value + +passive-interface type number + +passive-interface default + +no passive-interface type number + +router-id a.b.c.d + +router ospf process-id + +area X virtual-link neighbor-RID + + + + +Table 7-10 Verification Plan Memory Drill + + +Information Needed +Which routes have been added to the IP routing table by OSPF? +All routes in a router’s routing table + +The specific route for a single destination address or subnet +A list of all (both static and dynamically discovered) OSPF neighbors + +List interfaces on which OSPF has been enabled + + + +List the number of OSPF neighbors and fully adjacent neighbors known through a particular interface + +Command +show ip route ospf + +show ip route + +show ip route ip-address [mask] + +show ip ospf neighbor + +show ip ospf neighbor detail + +show ip ospf interface + +show ip ospf interface brief + +show ip protocols (if enabled with the ip ospf area interface subcommand) +show ip ospf interface + +show ip ospf interface brief + +show ip ospf interface type number + + + + + + +From the Library of Alexey Evseenko +22 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Information Needed +The elapsed time since a neighborship was formed + +The configured Hello timer for an interface + +The configured Dead interval timer for an interface +The current actual Dead timer for a neighbor + +A router’s RID + + + +A list of OSPF passive interfaces + +List traffic statistics about OSPF + +Display the name and status of a virtual link + +Command +show ip protocols + +show ip ospf neighbor [detail] + +show ip ospf interface [type number] + +show ip ospf interface [type number] + +show ip ospf neighbor [detail] + +show ip ospf + +show ip ospf database + +show ip ospf statistics + +show ip protocols + +show ip ospf statistics + +show ip ospf virtual-links + +show ip ospf neighbor [detail] + + + + +Chapter 8 + +Table 8-6 Design Review + + +Design Goal + +The design sets specific limits to the number of Type 1 and 2 LSAs in each area. Describe how to predict the number of each type of LSA. + + +How could you tune OSPF metrics to favor 10-Gbps links over 1-Gbps and 1-Gig over 100-Mbps? (2) + + + +The design shows one physical path from ABR1 to core subnet 1 inside area 0, and one longer area 1 path to the same subnet. What can be done to ensure that both paths can be used? + +Possible Implementation Choices Covered in This Chapter +Add one Type 1 per internal router in that area. + +Add one Type 1 per ABR. + +Add one Type 2 per subnet in which a DR should be elected, and for which two such routers exist in that subnet. +Configure all routers with an auto-cost reference bandwidth command, in router ospf configuration mode, of at least 10,000. + +Manually configure OSPF interface costs with the ip ospf cost cost interface subcommand. +Nothing—ABR1, like all ABRs, ignores Type 3 LSAs (like the LSA for subnet 1) learned in a nonbackbone area (such as area 1). + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 23 + +Table 8-7 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +What conditions must be true for a router to create/flood a Type 2 LSA? (2) + + +The plan shows Frame Relay with all point-to-point subinterfaces. By default, will a DR/ BDR be elected? +The plan shows a reference bandwidth change planned for all routers with high-speed links, but not all other routers. What is the impact? (2) + + + +The plan shows many different WAN links speeds but with the interface bandwidths not matching the actual speed. All OSPF cost changes are made explicitly with the ip ospf cost interface subcommand. Do the incorrect bandwidths cause any OSPF problems? + +Answer +At least two routers must be neighbors and have elected a DR. + +The router creating the LSA must be the DR. + +This is the case where, on Frame Relay, the default point-to-point OSPF network type works fine. No DR/BDR will be elected. +This plan breaks the recommendation to use the same value throughout the network. Potential impacts: + +1. The setting on one router changes only that router’s OSPF costs. + +2. It can result in poor route choices. + +No problem for OSPF, which uses the interface cost per ip ospf cost if it is configured. + + + + + +Table 8-8 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Tune metrics by changing the formula for calculating OSPF cost based on interface bandwidth. +Tune metrics by changing interface bandwidth. + +Change metrics by setting cost directly. + + +Set the number of equal-cost OSPF routes allowed in a router’s routing table. + +Influence the choice of DR on a LAN. (2) + + +router ospf process-id + +auto-cost reference-bandwidth ref-bw + +interface type number + +bandwidth bandwidth + +interface type number + +ip ospf cost cost + +router ospf process-id + +maximum-paths number + +Configure ip ospf priority value on the interface. + +Set the OSPF router ID, using either the router-id value router subcommand, creating a loopback interface with a high IP address, or another interface with a high IP address. + + + + + +From the Library of Alexey Evseenko +24 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 8-9 Verification Plan Memory Drill + + +Information Needed +Display a summary of the OSPF database. + +Display all Type 1 Router LSAs known to a router. + +Display the details of a particular Type 1 Router LSA. +Display all Type 2 Network LSAs known to a router. + +Display the details of a particular Type 2 Router LSA. + +Command(s) +show ip ospf database + +show ip ospf database router + +show ip ospf database router lsid + +show ip ospf database network + +show ip ospf database network lsid + +Display all Type 3 Summary LSAs known to a router. show ip ospf database summary + + +Display the details of a particular Type 3 Router LSA. +Display a list of OSPF-enabled interfaces on a router. + + +show ip ospf database summary lsid + +show ip ospf interface + +show ip ospf interface brief + +show ip ospf interface type number + +show ip protocols + + +Determine on which interfaces a router has formed at show ip ospf interface +least one OSPF neighborship. show ip ospf interface brief + +show ip ospf interface type number + +Determine the number of fully adjacent neighbors on show ip ospf interface +an interface. show ip ospf interface brief + + + + + + +Determine which transit networks connect to a Type 1 LSA. +Determine the router that created and flooded a Type 3 LSA. + +Determine the router that created and flooded a Type 2 LSA. + +Determine the router that created and flooded a Type 1 LSA. + +Display the IP address of the current DR and BDR on a LAN. + +show ip ospf interface type number + +show ip ospf neighbor + +show ip ospf neighbor detail + +show ip ospf database router [lsid] + +show ip ospf database + +show ip ospf database summary + +show ip ospf database + +show ip ospf database network + +show ip ospf database + +show ip ospf database router + +show ip ospf neighbor [detail] + +show ip ospf interface type number + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 25 + + + +Information Needed +Display the OSPF interface cost (metric). + + +Display all OSPF-learned routes. + +Command(s) +show ip ospf database router show ip ospf interface [brief] +show ip route ospf + + +Display statistics about the number of SPF algorithm show ip ospf [statistics] runs. + + + +Chapter 9 + +Table 9-5 Design Review + + +Design Goal + +When using OSPF, prevent the routers in sites for one division of the company from knowing IP routes for subnets in another division. (3) + + +The design shows an enterprise that uses only OSPF. It lists a goal of keeping the LSDBs and routing tables in each area small. (3) + +The design lists a goal of extremely small LSDBs and IP routing tables on branch office routers. Which stub area types work best? (2) +The design calls for the flooding of a domain-wide default route to draw traffic toward Internet-connected routers. +The design requires the routing of both IPv4 and IPv6 networks. (2) + +Possible Implementation Choices Covered in This Chapter +Type 3 LSA filtering on ABRs. + +Type 5 LSA filtering on ASBRs. + +Filtering routes added by OSPF to the IP routing table. +Use manual route summarization on ABRs. + +Use Type 3 LSA filtering. + +Use stub areas. + +Totally stubby areas. + +Totally NSSA areas. + +Use the default-information originate command on the Internet routers. + +You could configure two OSPF processes, an OSPFv2 process to support the routing of IPv4 networks and an OSPFv3 process (configured in the traditional fashion) to support the routing of IPv6 networks. + +Alternately, you could configure a single OSPFv3 Address Family hierarchy that included two Address Families, one for IPv4 and one for IPv6. + + + + + + + + + +From the Library of Alexey Evseenko +26 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 9-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan shows a design with area 0, with different ABRs connecting area 0 to areas 1, 2, and 3. The configurations show Type 3 LSA filtering into the nonbackbone areas but not in the opposite direction. Could this configuration filter subnets in area 1 from being seen in area 2? + +Answer +Type 3 LSA filtering only filters subnets whose Type 3 LSAs would be created by that ABR. So, if the area 1–area 0 ABR created an LSA for an area 1 subnet, flooding that LSA into area 0, the area 0–area 2 ABR would not attempt to filter that subnet with Type 3 LSA filtering. + +The design shows the configuration of No. The filtering only has effect on ABRs, for Type 3 LSA filtering on an internal router in Type 3 LSAs created on that ABR. +area 1. Could the filter have any effect? + + +The plan shows the configuration of the area range command on an ABR. What is the metric for the summary route, and in what conditions will the ABR advertise the summary? + +The plan shows the configuration of the area 1 stub command for an area mostly located on the west coast of the United States. The company just bought another company whose sites are also on the west coast. What issues exist if you add links from the acquired company into area 1? + +The metric, if not listed in with the cost parameter on the area range command, is the lowest cost among all subordinate routes. The ABR advertises only the summary if at least one subordinate subnet exists as an intra-area route. +As a stubby area, the area will not allow the redistribution of external routes. The acquired company’s routes might at least initially need to be redistributed into OSPF. + +The plan shows the configuration of the This command makes the router always default-information originate always advertise a default route, even if that router’s command on the one router to which default route pointing toward the Internet Internet links connect. What happens to the fails. As such, all packets destined outside the default route when the Internet link fails, enterprise will still pass through the enterprise and what happens to packets destined for to this router and then be discarded. +the Internet during this time? + + +The plan calls for the routing of both IPv4 and IPv6 networks. What new, or renamed, LSA types might appear in an area’s link-state database? + +With OSPFv3, the Type 3 LSAs have been renamed to Interarea prefix LSAs for ABRs. The Type 4 LSAs have been renamed to Interarea router LSAs for ASBRs. Also, two new LSAs have been introduced: the Type 8 Link LSAs and Type 9 Intra-area prefix LSAs. + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 27 + + +Table 9-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Filter Type 3 LSAs from being sent into an area. + +(Create an IP prefix list) + +router ospf process-id area area-number filter-list prefix listname {in | out} + +Filter the OSPF routes calculated on (Create an IP prefix list) one router from being added to that one +router ospf process-id +router’s routing table. + + +Configure route summarization on ABRs. + +Configure route summarization on ASBRs. + +Configure the OSPF domain-wide advertisement of a default route. + + +Configure stubby or totally stubby areas. + + + + + + +Configure NSSAs or totally NSSAs. + + + + + + + +Start an OSPFv3 process, using the traditional configuration approach. +Instruct an interface to participate in an OSPFv3 area, using the traditional configuration approach. + +distribute-list prefix list-name in + +router ospf process-id + +area area-id range ip-address mask [cost cost] + +router ospf process-id + +summary-address {ip-address mask | prefix mask} + +router ospf process-id + +default-information originate [always] [cost metric] [metric-type type] + +router ospf process-id + +area area-number stub (stubby areas and totally stubby areas on non-ABRs) + +area area-number stub no-summary (totally stubby areas on ABRs only) + +area area-num default-cost cost (optional) + +router ospf process-id + +area area-number nssa (NSSAs and totally NSSAs on non-ABRs) + +area area-number nssa no-summary (totally NSSAs on ABRs only) + +area area-num default-cost cost (optional) + +ipv6 router ospf process-id + +ipv6 ospf process-id area area_number + +Start an OSPFv3 process, using the router ospfv3 process-id Address Family configuration approach. + +Instruct an interface to participate in an ospfv3 process-id {ip4 | ipv6} OSPFv3 area, using the Address Family +configuration approach. + + + + +From the Library of Alexey Evseenko +28 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 9-8 Verification Plan Memory Drill + + +Information Needed +Display all IP routes for subnets in a range, regardless of prefix length. +Display the contents of an IP prefix list. + +Display details of all Type 3 LSAs known to a router. +Display details of all Type 5 external LSAs known to a router. +Display the metric advertised in a summary route created by the area range command. +Display the metric advertised in a summary route created by the summary-address command. +Discover whether a router resides in a stubby area, and if so, which kind. +Confirm stubby area concepts by looking at the numbers of Type 3 and Type 5 LSAs known to a router. +List the interfaces participating in a traditional OSPFv3 configuration. +Display neighbors in a traditional OSPFv3 configuration. +Display the contents of a router’s link-state database using a traditional OSPFv3 configuration. +List the interfaces participating in an +IPv4 and/or IPv6 OSPFv3 routing process configured with the OSPFv3 Address Family configuration approach. +Display IPv4 and/or IPv6 neighbors configured with the OSPFv3 Address Family configuration approach. +Display the contents of a router’s link-state database, containing entries for IPv4 and/or IPv6 networks, using the OSPFv3 Address Family configuration approach. + +Command(s) + +show ip route subnet mask longer-prefixes + +show ip prefix-list [name] + +show ip ospf database summary + +show ip ospf database external + +show ip ospf database summary [lsid] + +show ip ospf database external [lsid] + + +show ip ospf + +show ip ospf database database-summary + + +show ipv6 ospf interface brief + +show ipv6 ospf neighbors + +show ipv6 ospf database + + +show ospfv3 interface brief + + + +show ospfv3 neighbor + + +show ospfv3 database + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 29 + +Chapter 10 + +Table 10-12 Design Review + + +Design Goal + +A design shows Router R1 as being connected to both an EIGRP and OSPF routing domain, with all external EIGRP routes using a particular set of component EIGRP metrics. How can these metrics be set? (3) + +A design shows Router R1 as being connected to two different EIGRP domains, with redistribution planned. Can the design cause the routers to calculate metrics based on both the metric assigned when redistributing and the internal EIGRP topology? + +Possible Implementation Choices Covered in This Chapter +Set the metrics on the redistribute command. + +Use the default-metric command. + +Set the metric inside a route map referenced by the redistribute command. +No special action is required; this behavior occurs for all routes redistributed into EIGRP. + +The same design as in the previous row is The behavior is not supported by EIGRP. shown, except describe whether the design can +cause the routers to calculate metrics based solely on the metric components assigned when redistributing. + +A design shows Router R1 as being connected to two different OSPF domains, with redistribution planned, and all routes calculated by including internal and external OSPF distance. +The same design as in the previous row is shown, except that all external route metrics are based solely on external metrics. + +Filter routes when redistributing. (2) + + + + +Set different metrics for different routes redistributed from one routing source. +Set some OSPF routes as E1 and some as E2, when redistributed from one routing source. + +Routes must be distributed as E1 routes, using redistribute... metric-type 1. + + + +Routes must be distributed as E2 routes, using redistribute... metric-type 2, or by omitting the metric-type keyword on the redistribute command. +Refer to a route map on the redistribute command. + +Use a distribute-list command that refers to the routing source. +Use the redistribute... route-map option. + +Use the redistribute... route-map option, with the set metric-type command. + + + + + + + + + + +From the Library of Alexey Evseenko +30 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Design Goal Possible Implementation Choices Covered in This Chapter +The design shows multiple redistribution points Set high metrics when redistributing. with two routing domains, with a need to Set administrative distance (AD) on +prevent domain loops. (3) +redistributing routers so that internal routes are better than other routing protocol’s external routes. + +Set and filter on route tags. + +The design shows multiple redistribution points Set per-route administrative distance (AD) with more than two routing domains and a on redistributing routers. +need to prevent domain loops. (2) Set and filter on route tags. + + + +Table 10-13 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +A design shows Router R1 as being connected to both an EIGRP and OSPF routing domain. What default metrics will be used by the redistribute command for each routing protocol, if not set in R1’s configuration? +A plan shows redistribution between two EIGRP domains. What must be done to use the source route’s original component metrics? +A plan shows redistribution between two OSPF domains. What must be done to use the source route’s original metric? + +The plan shows the redistribute eigrp 2 command to redistribute from EIGRP 2 into OSPF. What other optional parameters are required to ensure redistribution of 10.1.1.0/24 from EIGRP? + +Answer +EIGRP—no default metrics + +OSPF—20 + + + + +Nothing when redistributing from EIGRP into EIGRP. The default action, if the metric is not set by any other means, uses the source route’s metric components. +Nothing when redistributing from OSPF into OSPF. The default action, if the metric is +not set by any other means, uses the source route’s metric. +10.1.1.0/24 is a subnet of a classful network, and redistribution into OSPF takes only classful networks if the (optional) subnets keyword is omitted on the redistribute command. + +R1 has two connected interfaces in the Nothing—the redistribute command EIGRP 2 domain and knows dozens takes routes learned by the source routing +of EIGRP routes. The plan shows the protocol, plus connected routes for interfaces redistribute eigrp 2 subnets command under enabled by that protocol. +an OSPF process. What else must be done to redistribute the two connected subnets inside the EIGRP domain? + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 31 + + + +Question +A design shows an OSPF and EIGRP routing domain, with multiple redistributing routers, with no obvious configuration to prevent routing domain loops. What default AD values exist, and do they prevent any problems? + +The same question as the previous row, except with RIP and OSPF domains. + + + + +The same question as the previous row, except with RIP and EIGRP domains. + + + + +A plan shows redistribution between EIGRP and OSPF on two routers. The configuration for OSPF on one router lists redistribute eigrp 1 subnets and distribute-list 1 out. Will this configuration attempt to filter routes? Is a route map option required to filter when redistributing? + +Answer +EIGRP: internal 90, external 170. + +OSPF: internal 110, external 110. + +Domain loops are prevented because EIGRP’s internal 90 is less than OSPF’s external 110, and OSPF’s internal 110 is less than EIGRP’s external 170. +RIP: 120 (all). + +OSPF: internal 110, external 110. + +Domain loops are not prevented because RIP’s 120 AD is not less than OSPF’s external 110. +RIP: 120 (all). + +EIGRP: internal 90, external 170. + +Domain loops are prevented because EIGRP’s internal 90 is less than RIP’s 120, and RIP’s 120 is less than EIGRP’s external 170. +The configuration is incomplete for filtering. If the distribute-list 1 out eigrp 1 command was used (for example), referring to the routing source, the redistributed routes would be filtered. This is an alternative to filtering by using the route-map option on the redistribute command. + +A partially complete plan shows three Using route tags does not require matching different routing domains, with multiple on subnets, which could reduce the amount redistribution points between each pair of of configuration changes required over time. routing domains. The configuration shows +large ACLs matching various subnets and setting AD per-route using the distance command. What alternative method might be easier to maintain as the network changes? + +The plan shows an EIGRP for IPv6 and OSPFv3 domain with mutual redistribution. The configuration shows a redistribute eigrp 1 command under the OSPF process. What kinds of routes should be redistributed? Which kinds will not? + +The configuration redistributes EIGRP-learned routes. It will not redistribute +■ link-local addresses ■ local routes +■ connected routes + + + + + + + + + + +From the Library of Alexey Evseenko +32 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 10-14 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Configuring redistribution into EIGRP from OSPF (List all parameters that you can recall.) + + + +Configuring redistribution into OSPF from EIGRP (List all parameters that you can recall.) + + + + +Setting default metrics for all redistribute commands, redistributing into EIGRP + +Setting default metrics for all redistribute commands, redistributing into OSPF + +Filtering routes on redistribution from OSPF into EIGRP + + + + + + + + + + + + +Filtering routes on redistribution from EIGRP into OSPF + + +router eigrp asn + +redistribute protocol [process-id | as-number] [metric bw delay reliability load mtu ] [match {internal | nssa-external | external 1 | external 2}] [tag tag-value] [route-map name] + +router ospf process-id + +redistribute protocol [process-id | as-number] [metric metric-value] [metric-type type-value] [match {internal | external 1 | external 2 | nssa-external}] [tag tag-value] [route-map map-tag] [subnets] + +router eigrp asn + +default-metric bw delay reliability load mtu + +router ospf process-id + +default-metric cost + +Examples: +router eigrp 1 +redistribute ospf 2 metric 1000 10 255 1 +1500 route-map fred +route-map fred permit 10 +match ip address 1 +or +router eigrp 1 +redistribute ospf 2 +distribute-list 1 out ospf 2 + +Examples: +router ospf 2 +redistribute eigrp 1 subnets route-map fred +route-map fred permit 10 +match ip prefix-list barney +or +router ospf 2 +redistribute eigrp 1 subnets +distribute-list prefix barney out eigrp 1 + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 33 + + + +Feature +Configuring a route map that will set metric components to 1000, 200, 255, 1, and 1500, for routes permitted by ACL 1, and filter all other routes + +Configuration Commands/Notes route-map fred permit 10 +match ip address 1 + +set metric 1000 200 255 1 1500 + + +Setting OSPF’s administrative distance for router ospf process-id +all internal routes to 110 and all external distance ospf external 180 +routes to 180 + + + +Setting EIGRP’s administrative distance for routes learned from neighbor 1.1.1.1 to 190, only for subnets in the range 10.1.0.0–10.1.255.255 + +Configuring RIPng to redistribute routes from OSPF process 1, including subnets and connected routes + +(intra-area and interarea AD will default to 110) + +router eigrp asn + +distance 190 1.1.1.1 0.0.0.0 list 1 + +access-list 1 permit 10.1.0.0 0.0.255.255 + +ipv6 router rip process-name + +redistribute ospf 1 include-connected + + + + +Table 10-15 Verification Plan Memory Drill + + +Information Needed +Display a brief version of the EIGRP topology table, listing external routes. +Display the EIGRP topology table, including notations identifying external routes. +For external EIGRP routes, display the source of the route, external metric, and IP address of the router that redistributed the route. +Identify external EIGRP-learned IP routes. + + +Display a brief version of the OSPF topology table, listing Type 5 external LSAs. +Display all OSPF Type 4 LSAs. + +Display all OSPF Type 5 LSAs. + +Display all OSPF Type 7 LSAs. + +Display the external route type for an OSPF external route. + +Display OSPF cost for each interface, briefly. + +Command(s) +show ip eigrp topology + +show ip eigrp topology prefix/length + +show ip eigrp topology prefix/length + + +show ip route + +show ip route eigrp + +show ip ospf topology + +show ip ospf topology asbr-summary + +show ip ospf topology external + +show ip ospf topology nssa-external + +show ip ospf database external + +show ip route ospf + +show ip ospf interface brief + + + + + + + +From the Library of Alexey Evseenko +34 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Information Needed +On an internal router, display any same-area ABRs’ costs to reach any ASBRs. +On an internal router, display that router’s best cost to reach an ASBR. +Display the metric for all currently best external OSPF routes. + +Confirm that OSPF routes were redistributed from the IP routing table into that same router’s EIGRP topology table. +Display the number of matches in an ACL used for redistribution filtering. + +Display the number of matches in an IP prefix list used for redistribution filtering. +Display the configuration of a route map. + +Display the component metrics of a route redistributed into EIGRP. +Confirm the absence or presence of a route that could have been redistributed from OSPF into EIGRP. +Confirm the absence or presence of a route that could have been redistributed from EIGRP into OSPF. +Display an IP route’s administrative distance. + +Display the administrative distance settings for EIGRP. + +Command(s) +show ip ospf database asbr-summary + +show ip ospf border-routers + +show ip route + +show ip route ospf + +show ip eigrp topology + + +show ip access-lists [number-or-name] + +show access-lists [number-or-name] + +show ip prefix-list detail [name] + +show route-map [name] + +show ip eigrp topology prefix/length + +show ip eigrp topology prefix/length + +show ip eigrp topology + +show ip ospf topology prefix/length + +show ip ospf topology + +show ip route [subnet] + +show ip protocols + +Display the administrative distance settings for OSPF. show ip protocols + + + +Chapter 11 + +Table 11-5 Design Review + + +Design Goal + +The design requires that the routers use the most efficient method of packet switching available. +The design calls for traffic destined for one server in subnet 10.1.1.0/24 to be sent over a different route than the IGP-learned route for 10.1.1.0/24. (2) + +Possible Implementation Choices Covered in This Chapter +Use CEF. + +Use Policy-Based Routing. +Configure a static route for packets sent to that single server. + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 35 + + + +Design Goal + +Same requirement as the previous row, except that only a subset of the source hosts should have their packets take a different route than the IGP-learned route. +The design requires that a static route be used, but only when a particular database server is reachable. +A design requires that a service provider router connect to and be able to communicate with three customer routers. (2) + +Possible Implementation Choices Covered in This Chapter +Use PBR. + + + +Use IP SLA with object tracking for the static route. +VRF-Lite + +Cisco EVN + + + + +Table 11-6 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan shows an upgrade from an older router using Fast Switching to a new router using CEF. What is the fundamental difference in those packet-switching technologies? + + + +A plan lists two PBR route maps—one that uses the default keyword in its set command and the other that does not. What is the fundamental difference? + + +A plan shows a route map enabled for policy routing, and the route map matches some packets with a deny route-map clause. What does Cisco IOS do with those packets? +The plan document shows a PBR route map with the command set ip dscp ef. Does PBR support marking? And can it mark DSCP? + + + +The plan shows an IP SLA operation number 5, with a static route configured with the track 5 parameter. What issues might exist with the linkages between these commands? + +Answers +With Fast Switching, each flow has its first packet routed by the router’s processor. Subsequent packets in the flow can then be forwarded based on information learned in the Fast Cache. + +With CEF, all packets in a data flow can be routed independently of a router’s processor. +The route map with the default keyword will cause Cisco IOS to attempt to route the packet as normal first, and if no nondefault route is matched, use the route in the set command. Without the default keyword, Cisco IOS tries the PBR route first. +Cisco IOS does not route these packets with PBR and allows the packets through the normal Cisco IOS packet-forwarding logic. The packets are not filtered. +PBR can mark the IP Precedence bits and the entire ToS byte, but it cannot mark using DSCP values. + +Class-based marking is preferred for QoS marking today. +To track the state of an IP SLA operation, the ip route command must refer to a tracking object number, which in turn refers to the IP SLA operation number. + + + + + + +From the Library of Alexey Evseenko +36 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Question +The IP SLA configuration shows an IP SLA operation that uses ICMP Echo, with the destination IP address of a server. What must be done on the server to support this operation? + +Answers +Nothing—the server naturally responds to the ICMP Echo. + +Same scenario as the previous row, except the Nothing—the router also naturally responds destination address is on a router. to an ICMP Echo. +Same scenario as the previous row, except the The remote router needs to be configured as operation generates RTP packets to measure an IP SLA responder. +voice jitter. + + +How will a VRF-Lite configuration on a router (configured with a subinterface for each VRF) connect to a Cisco Catalyst switch while keeping traffic from each VRF isolated? + +An 802.1Q trunk will be used to connect the router interface (which has been divided into multiple subinterfaces) to the Cisco Catalyst switch. Traffic for each VRF will travel in a separate VLAN on the 802.1Q trunk. + + + + + +Table 11-7 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Globally enabled CEF. + +Enable CEF on an interface (if CEF is globally enabled). + +ip cef + +ip route-cache cef + +Configure the matching logic in a PBR route route-map name [number] permit +map (2). match ip address {acl-number | acl-name} + + + + + +Configure the next-hop IP address in a PBR route map (2). + + + + + +Configure the outgoing interface in a PBR route map (2). + +or + +match length min max + +route-map name [number] permit + +set ip next-hop ip-address [... ip-address] + +or + +set ip default next-hop ip-address [... ip-address] + +route-map name [number] permit + +set interface type number [... type number] + +or + +set default interface type number [... type number] + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 37 + + + +Feature +Enable PBR on an interface. + + +Enable PBR for packets created by a router. + + +Create a VRF. + +Configuration Commands/Notes +interface type number + +ip policy route-map route-map-name + +ip local policy route-map route-map-name + +(global command) + +ip vrf vrf-name + + +Assign an interface or subinterface to a VRF. ip vrf forwarding vrf-name + +Enter OSPF router configuration mode for a router ospf process-id vrf vrf-name specific VRF instance. + + + +Table 11-8 Verification Plan Memory Drill + + +Information Needed +Display multiple interface statistics, including information about an interface’s packet-switching mode. +Display the contents of a router’s FIB. + +Show information contained in the adjacency table of a router, including protocol and timer information. +List interfaces on which PBR is enabled and the route map used. +Display the configuration of a route map. + +Generate debug messages for each packet that matches PBR. +Display the configuration of an SLA operation. + +Show the measurements from an SLA operation. + +Display the status of a tracking object. + +Display a listing of configured VRFs. + +Show the IP routing table for a specific VRF. + +Ping an IP address residing in a specific VRF. + +Command +show ip interface interface-id + +show ip cef + +show adjacency [detail] + +show ip policy + +show route-map + +debug ip policy + +show ip sla configuration + +show ip sla statistics + +show track + +show ip vrf + +show ip route vrf vrf-name + +ping vrf vrf-name ip-address + + + + + + + + + + + + + +From the Library of Alexey Evseenko +38 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Chapter 12 + +Table 12-4 Design Review + +Design Goal Possible Implementation Choices Covered in This Chapter +The design specifies that a router interface connecting Static IP address assignment. to an ISP be assigned an IP address determined by the +DHCP. +ISP. (2) + + +The design specifies that private IP addresses be assigned to devices inside an office and that those private IP addresses be translated into publicly routable IP addresses, available from a pool of addresses provided by an ISP. (2) +The design specifies that private IP addresses be assigned to devices inside an office and that those private IP addresses be translated into a single publicly routable IP address provided by an ISP. + +Dynamic NAT (DNAT). + +Static NAT (DNAT). + + + +Port Address Translation (PAT). + + + + +Table 12-5 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +The plan requires that a remote site’s Internet-facing router DHCP automatically be configured with a default static route pointing +to the ISP’s router. What addressing approach would support that requirement? + +NAT has a variety of descriptions for different types of IP addresses. What term is used to describe the private IP addresses assigned to devices inside a network? +A network using NAT is configured with multiple inside interfaces. However, the plan requires that NAT be performed on traffic being routed between inside NAT interfaces. What NAT feature would make this possible? + +Inside local + + +NAT Virtual Interface (NVI) + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 39 + + +Table 12-6 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Assign an IP address to a router interface connecting to an ISP (in interface configuration mode). +Configure a default route pointing to an ISP (in global configuration mode). + + +ip address ip_address subnet_mask + + +ip route 0.0.0.0 0.0.0.0 ip_address_of_isp_ router + +Instruct an Ethernet router interface to obtain ip address dhcp its IP address through DHCP (in interface +configuration mode). + + +Instruct a router not to install a default static route based on default gateway information learned through DHCP. +Create one or more inside local address to inside global address mappings (in global configuration mode). +Designate an interface as an inside NAT interface (in interface configuration mode). +Designate an interface as an outside NAT interface (in interface configuration mode). +Create an ACL to match inside local addresses to be translated through NAT (in global configuration mode). +Define a NAT pool containing a collection of inside global addresses (in global configuration mode). +Associate an ACL identifying NAT inside local addresses with a NAT pool identifying NAT inside global addresses (in global configuration mode). +Associate an ACL identifying NAT inside local addresses with a router’s outside interface, and enable overloading (in global configuration mode). +Configure an interface to use the NAT Virtual Interface (NVI) feature (in interface configuration mode). + + +no ip dhcp client request + + +ip nat inside source static inside_local_ address inside_global_address + +ip nat inside + +ip nat outside + +access-list {1 - 99} permit network_address wildcard_mask + +ip nat pool pool_name starting_ip ending_ ip netmask subnet_mask + +ip nat inside source list acl pool nat_pool + + + +ip nat inside source list acl interface outside_interface overload + + +ip nat enable + + + + + + + + + + + +From the Library of Alexey Evseenko +40 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 12-7 Verification Plan Memory Drill + + +Information Needed +List a router’s interfaces and their IP addresses, along with an indication of whether the IP address assigned to an interface was assigned through DHCP. +Display active NAT translations. + +Command(s) +show ip interface brief + + + +show ip nat translations + + + + +Chapter 13 + +Table 13-9 Design Review + + +Design Goal + +A design shows a single router connected to the Internet as part of a single-homed Internet design. It lists sections for enterprise routing toward the Internet-facing router(s) in the enterprise, and another section for choosing routes on the Internet- +facing router into the Internet. List the reasonable options. + +Possible Implementation Choices Covered in This Chapter +For enterprise routers toward the Internet-facing router in the enterprise: +■ Internet router to inject/flood a default route with the IGP. Can be based on a static default or BGP-learned default. +For routes on the Internet-facing router, use either: + +■ Static default + +■ BGP-learned default + + +Use the same criteria as the previous item in this table, except the single enterprise router connected to the Internet now has two links to the same ISP (dual-homed). + +Same as previous table row for enterprise toward Internet router. + +For routes on the Internet-facing router: + +■ Use static defaults. + +■ Use BGP-learned defaults. +■ Accept partial or full tables and choose the best path for each destination. + +Use the same criteria as the previous item, except use two routers with one link each to the same ISP (dual-homed). + +For enterprise routers toward the Internet-facing routers in the enterprise, flood default routes with the IGP from each Internet-facing router. + +Same three options as in the previous row of this table for routes toward the Internet. However, +if the design requires a choice of some paths (routes) as better than others with BGP, use iBGP between Internet-connected routers, and possibly with other enterprise routers. + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 41 + + + +Design Goal + +Use the same criteria as the previous row, but with a single-multihomed connection with two routers. +The plan shows the use of public prefix 200.1.1.0/26 by an enterprise. What methods should you consider adding to your implementation plan for advertising that prefix to your ISPs using BGP? (2) + +Possible Implementation Choices Covered in This Chapter +Same as previous row. + + +Use the BGP network command. + +Redistribute from the IGP into BGP. + + + + +Table 13-10 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan shows a single router in a dual-homed Internet design, with the router using BGP over each link to that same ISP. What criteria would impact your choice of accepting only default routes, or partial updates, or full updates, using BGP in this case? (3) + +Answer +Default: If the goal were to use one path as primary, but to use the other path if the first failed + +Partial: If the ISP can identify each link as a better link by setting PAs, but for a smaller set of prefixes + +Full: If each link can be considered better for the majority of BGP routes + +The plan shows four enterprise routers The BGP neighborships between the four with BGP configuration, with two of enterprise routers would be iBGP. Any +those routers with links to two different neighborships with ISP routers would be eBGP. ISPs. Which connections are eBGP? iBGP? + +The plan shows enterprise Router R1, with two parallel Layer 3 paths to ISP Router R2, with a need for BGP. What options exist for high availability eBGP peering? (2) Which is better? + +1. Use a loopback interface as an update source, and configure eBGP multihop with a single BGP peer. + +2. Use interface IP addresses for BGP peering, but with two neighbor relationships with the same neighboring router. + +The first option reduces the amount of overhead, while giving the same higher availability. + +The implementation plan shows an eBGP multihop. enterprise router with an eBGP connection +to an ISP router, using a loopback interface as the Update source. What other feature must be configured to make the eBGP connection work? + + + + + +From the Library of Alexey Evseenko +42 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Question +Router R1 connects through eBGP to Router I1 at ISP1. R1 has routes for 130.1.1.0/24 and 130.1.2.0/24 in its routing table. The design claims the company uses 130.1.0.0/21 as its public range. What methods can be used to advertise one route for the entire range to the eBGP peer? (2) + +Answer +1. Cause a route to be created on R1, through static config or IGP route summarization, for 130.1.0.0/21, combined with the BGP network 130.1.0.0 mask 255.255.248.0 command. + +2. Redistribute from the IGP into BGP, and then configure route summarization with the summary-only keyword to advertise 130.1.0.0/21 without advertising the subordinate routes. + + + + + +Table 13-11 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Configure multiple static default routes, each with different administrative distance settings + + + +Configure an eBGP connection as follows: local AS 1, remote AS 2, remote router uses 1.1.1.1 for BGP peering, with 1.1.1.1 being an IP address on a common link between the routers. +Configure an eBGP connection as follows: local AS 1, remote AS 2, local uses loopback1 (1.1.1.1), remote uses loopback2 (2.2.2.2). + + + +Administratively disable the neighbor configured in the previous two items in this table. +Reenable the neighbor that was disabled in the previous row of this table. + +Cause the advertisement of IGP-learned prefix 130.1.1.0/24 to the neighbor configured in this table, without redistribution. +Repeat the task in the previous row of this table, but this time with route redistribution, assuming that OSPF process 1 is used for the IGP. + + +ip route subnet mask next-hop-ip + +ad-value + +(Configure two different routes, each with a different AD value.) +router bgp 1 + +neighbor 1.1.1.1 remote-as 2 + + +router bgp 1 + +neighbor 2.2.2.2 remote-as 2 + +neighbor 2.2.2.2 update-source loopback1 + +neighbor 2.2.2.2 ebgp-multihop + +router bgp 1 + +neighbor 2.2.2.2 shutdown + +router bgp 1 + +no neighbor 2.2.2.2 shutdown + +router bgp 1 + +network 130.1.1.0 mask 255.255.255.0 + +router bgp 1 + +redistribute ospf 1 + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 43 + +Table 13-12 Verification Plan Memory Drill + + +Information Needed +Display a single-line neighbor status for each iBGP neighbor. +Display the number of prefixes learned from a neighbor. (List where the information is located.) + + + + +Display the number of prefixes advertised to a neighbor. (List where the information is located.) + + + + +Display the local and neighbor ASN. + + +Display the number of eBGP hops allowed. + +List the current TCP ports used for BGP connections. + +List all prefixes in the BGP table. + +List all the best routes in the BGP table. + +Find the AS_PATH for each BGP table entry. (Describe how.) + +Determine whether a particular BGP table entry is iBGP-learned. (Describe how.) + + + + +Display one-line entries for all BGP table entries with a given prefix/length, plus any subnets inside that range. +List possible default routes. + +List possible routes per prefix. + +List routes learned from one neighbor, which passed any inbound filters. + +Commands +show ip bgp summary + +show ip bgp [summary] + +(Look for “State/PfxRcd” heading on the right.) + +show ip bgp neighbors [neighbor-id] + +(Look for “prefix activity.”) + +show ip bgp neighbors [neighbor-id] + +(Look for “prefix activity.”) + +show ip bgp neighbors neighbor-id advertised-routes + +(Look for “Total number of prefixes.”) + +show ip bgp summary + +(Look for “Local AS Number” near the top.) + +show ip bgp neighbors [neighbor-id] + +show ip bgp neighbors [neighbor-id] + +show tcp brief + +show ip bgp + +show ip bgp + +show ip bgp + +(Look for “Path” heading on the right.) + +show ip bgp + +(Look for code “i” on the left.) + +show ip bgp prefix/length + +(Look for “internal.”) + +show ip bgp prefix/length longer-prefixes + + +show ip bgp 0.0.0.0 0.0.0.0 + +show ip bgp prefix [subnet-mask] + +show ip bgp neighbors ip-address routes + + + + + + + +From the Library of Alexey Evseenko +44 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Information Needed +List routes learned from one neighbor before any inbound filtering is applied. + +Display routes suppressed and added to the BGP table because of BGP route summarization (aggregation). + +Commands +show ip bgp neighbors ip-address received-routes +show ip bgp + + + + +Chapter 14 + +Table 14-10 Design Review + + +Design Goal + +The plan shows a typical single-multihomed design with two routers connected to +two ISPs. How will you ensure next-hop reachability? (2) + +The plan shows the same design as the last item. The two enterprise Internet-connected routers do not have a direct link between each other. What methods discussed in this chapter can be used to prevent packet loops in the enterprise core? (2) +The plan shows the same design as the previous items but with public range 200.1.1.0/24 being the only public address range used by the enterprise. How can the enterprise avoid becoming a transit AS? +Influence the outbound route from an enterprise toward prefixes in the Internet (3). + +Influence the outbound route from an enterprise toward prefixes in the Internet so that multiple Internet-connected enterprise routers make the same choice based on the same information (2). +Influence inbound routes into an enterprise from a neighboring AS (2). + +Possible Implementation Choices Covered in This Chapter +1. Configure the enterprise routers with next-hop-self. + +2. Ensure that both enterprise BGP routers have routes to reach all eBGP peers. +1. Run an iBGP mesh with all enterprise core routers between the Internet-connected routers. + +2. Redistribute BGP into your IGP, and enable synchronization. + +Use filtering to advertise only prefix 200.1.1.0/24 to the ISPs. + + + +Set administrative Weight, Local Preference, and AS_Path length (using AS_Path prepending) +Set Local Preference and AS_Path length (using AS_Path prepending) + + + +Set MED, AS_Path Length (using AS_Path prepending) + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 45 + +Table 14-11 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan shows a typical single-multihomed design with two routers (R1 and R2) connected to two ISPs. Will R1 and R2 be BGP neighbors? Why? + +Answers +R1 can use R2 as the best next-hop router to reach some destinations, and vice versa, but only if the two routers exchange BGP routes by becoming iBGP neighbors. + +The plan shows the same design as the previous Each router’s neighbor remote-as command item. What configuration setting must be used refers to its own ASN, as configured in the to ensure that the routers are iBGP rather than router bgp command. +eBGP peers? + + +The plan calls for filtering all prefixes except the 200.1.1.0/24 public address range when advertising any eBGP peers. Which neighbor command options exist for filtering based on the prefix/length? (3) +A plan shows two enterprise routers, R1 and R2, connected to two different ISPs, with iBGP between R1 and R2. The plan shows R1 setting Weight for routes learned from an ISP. Will R2 react to those settings? Why or why not? +A plan shows two enterprise routers, R1 and R2, connected to two different ISPs, with iBGP between R1 and R2. The plan shows R1 setting Local_Pref for routes learned from an ISP. Will R2 react to those settings? Why or why not? +The plan calls for the use of BGP Weight, but the incomplete plan lists no configuration yet. What configuration alternatives exist? (2) + + + +The plan calls for the use of BGP Local Preference, but the incomplete plan lists no configuration yet. What configuration alternatives exist? +A plan shows two enterprise routers, R1 and R2, connected to different ISPs. The plan calls for using MED to influence inbound routes. Which configuration options exist? + +1. neighbor prefix-list + +2. neighbor distribute-list + +3. neighbor route-map + +No. Weight is local to a single router and is not advertised to neighboring routers. + + + +Yes. Local_Pref is advertised to iBGP peers, so both R1 and R2 make the same choices based on the Local_Pref. + + +1. Setting Weight for routes matched in a route map clause. + +2. Setting Weight for all routes learned from a neighbor with the neighbor weight command. +Setting Local Preference for routes matched in a route map clause. + + +Setting MED for routes matched in a route map clause, either outbound from the enterprise or inbound into the ISP. + +A plan shows the use of BGP Weight, Local AS_Paths can be prepended, and MED can Preference, AS_Path prepending, and MED to be set, before being sent to eBGP neighbors influence the best-path algorithm. Which of in BGP Updates. +these can be set and advertised to eBGP peers? + + + + + +From the Library of Alexey Evseenko +46 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Table 14-12 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Configure an iBGP peer. + + +Advertise the local router’s Update source IP address as the next-hop address to iBGP peers. +Configure an iBGP mesh with peers 1.1.1.1, 2.2.2.2, and 3.3.3.3. + + + + +Enable BGP synchronization. + + +Configure filtering of routes sent to eBGP peer 9.9.9.9, using a prefix list to allow only 200.1.1.0/24. + + +Configure filtering of routes sent to eBGP peer 9.9.9.9, using an ACL to allow only 200.1.1.0/24. + + +Configure a route map that sets Weight. + + + +Enable a route map to set BGP Weight. + + +Enable a router to set BGP Weight for all routes received from a neighbor. + +Configure a route map that sets BGP Local Preference. + + +Enable a route map to set BGP Local Preference. + + +router bgp asn + +neighbor neighbor-ip remote-as asn + +router bgp asn + +neighbor neighbor-ip next-hop-self + +router bgp asn + +neighbor 1.1.1.1 remote-as same-asn + +neighbor 2.2.2.2 remote-as same-asn + +neighbor 3.3.3.3 remote-as same-asn + +router bgp asn + +synchronization + +ip prefix-list plist-name permit 200.1.1.0/24 + +router bgp asn + +neighbor 9.9.9.9 prefix-list plist-name out + +access-list 101 permit ip host 200.1.1.0 host 255.255.255.0 + +router bgp asn + +neighbor 9.9.9.9 distribute-list 101 out + +route-map name permit + +match... + +set weight value + +router bgp asn + +neighbor neighbor-ip route-map name in + +router bgp asn + +neighbor neighbor-ip weight value + +route-map name permit + +match... + +set local-preference value + +router bgp asn + +neighbor neighbor-ip route-map name in + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 47 + + + +Feature +Configure a route map that prepends ASNs to an AS_Path. + + +Enable a route map to perform AS_Path prepending. + + +Configure a route map that sets MED. + + + +Enable a route map to set MED. + +Configuration Commands/Notes +route-map name permit + +match... + +set as-path prepend asn1 [asn2]... + +router bgp asn + +neighbor neighbor-ip route-map name [in | out] + +route-map name permit + +match... + +set metric value + +router bgp asn + +neighbor neighbor-ip route-map name [in | out] + + + + +Table 14-13 Verification Plan Memory Drill + + +Information Needed +Display a single-line neighbor status for all iBGP neighbors. +Determine whether a particular BGP table entry is iBGP-learned. + + + + +Determine the next-hop IP address of an iBGP-learned route. + +Identify the neighbor from which a BGP route was learned. + +Display one-line entries for all BGP table entries with a given prefix/length, plus any subnets inside that range. +Display BGP routes learned from a neighbor, before being processed by an inbound filter. + +The same as the previous item, but after applying the inbound filter. + +Commands +show ip bgp summary + +show ip bgp + +(Look for code “i” on the left.) + +show ip bgp prefix/length + +(Look for “internal.”) + +show ip bgp + +show ip bgp prefix/length + +show ip bgp prefix/length + +(Look for the “from ip-address” phrase.) + +show ip bgp prefix/length longer-prefixes + + +show ip bgp neighbors neighbor-ip received-routes + +show ip bgp neighbors neighbor-ip routes + + + + + + + +From the Library of Alexey Evseenko +48 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Information Needed +Display BGP routes sent to a neighbor but after applying the outbound filter. + +Commands +show ip bgp neighbors neighbor-ip advertised-routes + +Display whether a neighbor can perform BGP show ip bgp neighbors [neighbor-id] route refresh. + + +Display the BGP table, including the chosen best path for each prefix. (State how to identify the best paths.) +List one line per BGP route but for the prefixes within a range. +Identify a BGP table entry’s BGP Weight. (Specify where to find the output.) + +Identify a BGP table entry’s BGP Local Preference. (Specify where to find the output.) + + + +Identify a BGP table entry’s AS_Path length. (Specify where to find the output.) + + + + +Identify a BGP table entry’s MED. (Specify where to find the output.) (4 methods) + + + + + + + + + +Display routes received from a neighbor before being processed by an inbound filter. + +The same as the previous item but after applying the outbound filter. +Display BGP routes sent to a neighbor but after applying the outbound filter. + +Display BGP best paths that were not added to the IP routing table. + + +show ip bgp + +(Look for > as the second character.) + +show ip bgp prefix/length longer-prefixes + +show ip bgp + +(Look for heading “Weight.”) + +show ip bgp + +(Look for heading “LocPrf.”) + +show ip bgp prefix/length + +(Look for “localpref.”) + +show ip bgp + +(Count the ASNs under heading “Path.”) + +show ip bgp prefix/length + +(Count the number of ASNs.) + +show ip bgp +(Look for heading “Metric.”) +show ip bgp prefix/length +(Look for “metric.”) +show ip route +(Look for second number in square brackets.) +show ip route prefix mask +(Look for “route metric.”) + +show ip bgp neighbors neighbor-ip received-routes + +show ip bgp neighbors neighbor-ip routes + +show ip bgp neighbors neighbor-ip advertised-routes +show ip bgp rib-failures + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 49 + +Chapter 15 + +Table 15-2 Design Review + + +Design Goal + +The design specifies that a customer’s Internet-facing router should dynamically obtain the IPv6 address for its Internet-facing interface from an ISP. (4) + + + +The design specifies that a customer’s Internet-facing router exchange IPv4 and IPv6 routes with an ISP. +The design requires that you filter specific IPv6 routes sent to or received from an ISP. + +The design has a dual-homed Internet connection running MP-BGP, with a requirement that you influence the outbound path selection. + +Possible Implementation Choices Covered in This Chapter +Stateless Address Autoconfiguration (SLAAC) + +Stateless DHCPv6 + +Stateful DHCPv6 + +DHCPv6 Prefix Delegation (DHCPv6-PD) + +Multiprotocol BGP (MP-BGP) + + +Prefix lists (Note: While other options exist for route filtering, the focus in the ROUTE curriculum is on the use of prefix lists.) +Local Preference (Note: While other options exist for influencing MP-BGP’s outbound path selection, the focus in the ROUTE curriculum is on the use of the Local Preference attribute.) + + + + +Table 15-3 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan requires a client’s Internet-facing router to obtain an IPv6 address from the client’s ISP. What approach to dynamically assigning IPv6 addresses allows an Internet-facing router to obtain a single IP address from an ISP’s DHCP server? +The plan requires the use of an IPv6 ACL. What two traffic types does an IPv6 ACL implicitly permit? (2) + +Answer +Stateful DHCPv6 + + + + + +Neighbor Discovery – Neighbor Advertisements + +Neighbor Discovery – Neighbor Solicitations + + + + + + + + + + +From the Library of Alexey Evseenko +50 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +Question +The plan calls for the use of MP-BGP. List at least three of the new elements introduced by MP-BGP. (3) + + + + + + + + +The plan calls for the routing of both IPv4 and IPv6 networks with an ISP. What variant of BGP supports this requirement? +The plan calls for the use of MP-BGP, configured such that both IPv4 and IPv6 routes can be advertised over a single IPv4 BGP session. What additional configuration element is required to support this type of design, as opposed to a design where IPv6 routes are advertised over an IPv6 BGP session? +The plan calls for the use of the Local Preference attribute to influence outbound path selection for an MP-BGP network. Are higher or lower Local Preference values preferred? + +Answer +Address Family Identifier (AFI) +Subsequent Address Family Identifier (SAFI) +Multiprotocol Reachable Network Layer Reachability Information (MP_REACH_ NLRI) +Multiprotocol Unreachable Network Layer Reachability Information (MP_UNREACH_ NLRI) +BGP Capabilities Advertisement + +MP-BGP + + +A route map that specifies the local router interface’s IPv6 address as the Next-Hop attribute to advertise to an MP-BGP neighbor + + + +Higher Local Preference values + + + + + +Table 15-4 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Assign an IPv6 address to a router interface connecting to an ISP (in interface configuration mode). +Configure a default route pointing to an ISP (in global configuration mode). +Create an IPv6 ACL (in global configuration mode). +Apply an IPv6 ACL to an interface (in interface configuration mode). +Enable IPv6 unicast routing (in global configuration mode). + + +ipv6 address ipv6_address/prefix_length + + +ipv6 route ::/0 ipv6_address_of_isp_router + +ipv6 access-list name + +ipv6 traffic-filter name {in | out} + +ipv6 unicast-routing + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 51 + + + +Feature +Create a route map (in global configuration mode). +Specify the IPv6 address of a router’s interface connecting to a neighbor as a next-hop IPv6 address (in route map configuration mode). +Define a BGP autonomous system (in global configuration mode). +Define an IPv4 neighbor (in router configuration mode for BGP). + +Enter IPv4 address family configuration mode (in router configuration mode for BGP). +Specify which interface(s) will participate in the IPv4 address family (in address family configuration mode). +Enter IPv6 address family configuration mode (in router configuration mode for BGP). +Specify which interface(s) will participate in the IPv6 address family (in address family configuration mode). +Activate the BGP neighbor for the IPv6 address family (in address family configuration mode). +Associate a route map with a neighbor, to advertise an appropriate next-hop IPv6 +address to that neighbor (in address family configuration mode). +Define an IPv6 BGP neighbor (in router configuration mode for BGP). + +Create an IPv6 prefix list (in global configuration mode). + +Apply an IPv6 prefix list (in address family configuration mode). + +Specify a Local Preference (in route map configuration mode). + +Configuration Commands/Notes +route-map route_map_name + +set ipv6 next-hop ipv6_address + + + +router bgp as-number + +neighbor neighbor’s_ipv4_address remote-as +address-family ipv4 + + +network ipv4_address [mask subnet_mask] + + +address-family ipv6 + + +network ipv6_network_address/prefix-length + +neighbor neighbor’s_ip_address activate + + +neighbor neighbor’s_ip_address route-map route_map_name out + + +neighbor neighbor’s_ipv6_address remote-as remote-as + +ipv6 prefix-list name seq number {permit | deny} ipv6_network/prefix-length {ge | le} bits + +neighbor neighbor’s_ip_address prefix-list name {in | out} + +set local-preference value + + + + + + + + +From the Library of Alexey Evseenko +52 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 15-5 Verification Plan Memory Drill + + +Information Needed +Display ACLs (both IPv4 and IPv6 ACLs). + +Display IPv6 routes. + +Display the IPv6 networks known to BGP. + +Display the BGP router ID, local AS number, and a listing of neighbors and their AS numbers in an MP-BGP configuration. + +Command(s) +show access-lists + +show ipv6 route + +show bgp ipv6 unicast + +show bgp ipv6 unicast summary + + + + +Chapter 16 + +Table 16-7 Design Review + + +Design Goal + +The design requires a documented router security policy. (List five or more security topics commonly addressed in a router security policy.) (11) + + +The design requires that an accounting server (located in a data center subnet) only be accessible during business hours. +The design requires that router management traffic be encrypted. + +Possible Implementation Choices Covered in This Chapter +A router security policy commonly addresses security topics such as passwords, authentication, access, services, filtering, routing protocols, backups, documentation, redundancy, monitoring, and updates. +Use time-based ACLs. + + +Use SSH instead of Telnet. + +Use SNMPv3 instead of SNMPv1 or SNMPv2c. + +The design requires that a router’s line passwords Enable the password-encryption service. be encrypted, so that someone catching a +glimpse of the router’s running configuration would not be able to read any of the passwords. +The design requires that a router’s Internet-facing Enable uRPF in strict mode. interface check the source IP address of an +incoming packet and only permit that packet if a route back to the packet’s IP source address is found in the router’s FIB and if the FIB indicates that the egress interface to get back to that source IP address is the same interface on which the packet arrived. + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 53 + + + +Design Goal + +The design requires that router authentication requests be handled by an external server. However, if that external server is not available, router authentication requests should be handled by the router’s local user database. + +Possible Implementation Choices Covered in This Chapter +Enable AAA on a router. As part of the AAA configuration, use a method list that specifies a TACACS+ or RADIUS server as the first choice for authentication +and the router’s local user database as a backup authentication mechanism. + +You want to prevent an attacker from influencing Have the routers set their time by using a router’s time, in an effort to pass traffic NTP, and enable NTP authentication on through a time-based ACL. all of those routers. + + + +Table 16-8 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + + +Question +The plan is using a time-based ACL to protect specific servers. What types of time-based ACLs can be configured in Cisco IOS? (2) + + +The plan calls for the use of SSH as opposed to Telnet. What two configurable router parameters are used in the generation of the RSA key pair used by SSH? +The plan shows a variety of password types to be used, including Type 0, Type 4, Type 5, and Type 7. What is the difference in these password types? + +The plan calls for the configuration of uRPF. What are uRPF’s three modes of operation? + +The plan calls for the use of AAA with an external server running an open standard protocol? What AAA protocol should you choose? + +Answer +A time range can be periodic, where it becomes active or inactive at specific times or on specific days of the week. Alternately, a time range can be absolute, where there is a fixed starting and stopping date and time, during which the ACL is active. +A router’s host name and domain name are used in the generation of its RSA key pair. + + +A Type 0 is not encrypted. A Type 4 password is represented by an SHA-256 hash value. A Type 5 password is represented by an MD5 hash value. A Type 7 password is encrypted using the Vigenere cipher. + +uRPF can operate in the strict mode, loose mode, or VRF mode. +The two AAA protocols supported by Cisco IOS include TACACS+ and RADIUS. However, TACACS+ is a Cisco-proprietary protocol, while RADIUS is an open standard protocol. Therefore, RADIUS should be chosen in this instance. + + + + + + + + + + +From the Library of Alexey Evseenko +54 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +Question Answer +Even though you know that SNMPv3 is more If you are using SNMPv2c on a router, secure than SNMPv2c, the plan requires consider setting the read-only and read- +the use of SNMPv2c on your routers. What write community strings to values not easily can you do to better secure this network guessed. Also, you can specify an ACL that management protocol? (2) controls which IP addresses are allowed to +communicate with the router using SNMP. + + +The plan calls for one enterprise router to receive time from an Internet-based cesium clock. That router will then provide time to all other routers inside the enterprise. Will that router need to have the ntp master command configured? + +No. The ntp master command is only needed if a router is going to be providing time to other devices, and it is using its internal clock as its time source. + + + + + +Table 16-9 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +Create a named time range for an ACL (in global configuration mode). +Define a periodic time range (in time range configuration mode) +Define an absolute time range (in time range configuration mode). + +Apply a time range to a numbered ACL (in global configuration mode). + +Apply a time range to a named ACL (in named access list configuration mode). + +Specify a router’s host name. + +Specify a router’s domain name. + +Create a user with a privilege level of 15 and a hashed password. + +Generate an RSA key pair. + +In VTY line configuration mode, only permit SSH connections. +In VTY configuration mode, instruct SSH to use a router’s local user database for authentication. + + +time-range name + +periodic days-of-week hh:mm to hh:mm + +absolute [start hh:mm day_of_month month year] end hh:mm day_of_month month year + +access-list ACL_number time-range name_of_time_ range + + time-range name_ of_time_range + +hostname name + +ip domain-name domain_name + +username username privilege 15 secret password + +crypto key generate rsa modulus size_of_ modulus +transport input ssh + +login local + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 55 + + + +Feature +Enable the password encryption service to encrypt line passwords. +Enable uRPF in interface configuration mode. +Enable AAA services on a router. + +Create a AAA method list named TEST that attempts to use a TACACS+ server for authentication, but will fall back to a local user database if the TACACS+ server is unavailable. +Configure the read-only or read-write community string on a router, and specify an ACL that defines trusted IP addresses. +Specify an NTP authentication key, along with a key ID. + +Configuration Commands/Notes service password-encryption + +ip verify unicast source reachable-via {rx | any} [allow-default] [allow-self-ping] [acl] +aaa new-model + +aaa authentication login TEST group tacacs+ local + + + +snmp-server community community-string {ro | rw} acl + +ntp authentication-key key-id md5 key + +Instruct a router to authenticate time sources. ntp authenticate + + +Specify a trusted NTP key ID. + +Instruct a router to provide time to other NTP-speaking devices, using its internal clock as the time source, and specify the router’s stratum value. +Specify the IP address of an NTP server from which a router should receive time, along with the key ID that should be used to authenticate with that NTP server. + + +ntp trusted-key key-id + +ntp master stratum-number + + + +ntp server ip-address-of-ntp-server key key-id + + + + +Table 16-10 Verification Plan Memory Drill + + +Information Needed +Display the contents of a router’s FIB. + +Determine whether an interface has uRPF enabled. +Display a router’s NTP stratum value. + +Display the stratum value of a router’s NTP reference. + +Command(s) +show ip cef + +show cef interface interface_id + +show ntp status + +show ntp associations detail + + + + + + + + + +From the Library of Alexey Evseenko +56 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Chapter 17 + +Table 17-3 Design Review + + +Design Goal + +Prevent a malicious user from injecting a rogue router into an EIGRP autonomous system and forming a neighborship. + +Possible Implementation Choices Covered in This Chapter +Configure EIGRP authentication, which uses MD5 authentication. + +Configure OSPFv2 authentication such that a Although OSPFv2 can be configured malicious user could not do a packet capture for plain text authentication (Type 1 +of the authentication traffic and determine authentication), this goal can be met by the authentication key. configuring hashing authentication (Type 2 +authentication). + + +Prevent a malicious user from causing a rogue router to hijack an existing BGP session. + +Configure BGP authentication, which uses MD5 authentication. + + + + +Table 17-4 Notable Questions from This Chapter to Consider During an Implementation Plan Peer Review + +Question Answer +An EIGRP-speaking router is configured with When sending an EIGRP message, the lowest a key chain containing multiple keys. Which key number (of all the valid keys) is used. key is going to be used? However, when receiving an EIGRP message +and checking the MD5 digest, all currently valid keys are checked. + +What authentication types are available for OSPFv3? + + + +Why would you want to authenticate BGP neighbors, because BGP requires a router to have a static configuration of its neighbors’ IP addresses? + +OSPFv3 does not have any built-in authentication features; however, it can leverage the authentication features available in IPsec. Therefore, you can use either MD5 or SHA authentication with OSPFv3. +A malicious user could attempt to hijack an existing session between two BGP neighbors and then manipulate routing information. + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix F: Completed Planning Practice Tables 57 + + +Table 17-5 + +Feature + + +Implementation Plan Configuration Memory Drill + +Configuration Commands/Notes + + + +For EIGRP, create a key chain and give it a name. +For EIGRP, create one or more key numbers. + +For EIGRP, define an authentication key’s value. +Enable EIGRP for IPv4 MD5 authentication on an interface for a particular EIGRP autonomous system. +For EIGRP for IPv4, specify the key chain to be used on an interface. + +Enable EIGRP for IPv6 authentication on an interface for a particular EIGRP autonomous system. +For EIGRP for IPv6, specify the key chain to be used on an interface. + +Enable Named EIGRP authentication for an interface. +For Named EIGRP, specify the key chain to be used on an interface. +Enable OSPFv2 authentication on an interface. + + +key chain name + +key number + +key-string value + +ip authentication mode eigrp asn md5 + + +ip authentication key-chain eigrp asn name-of-chain + +ipv6 authentication mode eigrp asn md5 + + +ipv6 authentication key-chain eigrp asn name-of-chain +authentication mode {md5 | hmac-sha-256} + +authentication key-chain name-of-chain + +ip ospf authentication [message-digest] + +Enable OSPFv2 authentication on all area area-number authentication interfaces in an area by configuring area-wide +authentication. + + +Specify a key to use with OSPFv2 plain text authentication. +Specify a key to use with OSPFv2 MD5 authentication. + +Enable OSPFv3 authentication on an interface. + + +ip ospf authentication key key-string + +ip ospf message-digest-key key-id md5 key-string + +area area-number authentication ipsec spi security_policy_index [md5 | sha1] {0 | 7} key-string + +Enable OSPFv3 authentication on all ipv6 ospf authentication ipsec spi security_ interfaces in an area by configuring area-wide policy_index [md5 | sh1] {0 | 7} key-string authentication. + +Specify an authentication key to use with a neighbor neighbor_ip password key BGP neighbor. + + + + + + + +From the Library of Alexey Evseenko +58 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Table 17-6 Verification Plan Memory Drill + + +Information Needed +Verify that an EIGRP for IPv4 neighborship is up. +Verify that an EIGRP for IPv6 neighborship is up. +Collect information about a configured key chain. +Verify that OSPFv2 authentication is enabled. + +Verify that OSPFv3 authentication is enabled. + +Verify that an OSPF neighborship is up. + +Verify that a BGP for IPv4 neighborship is up. + +Verify that a BGP for IPv6 neighborship is up. + +Command(s) +show ip eigrp neighbors + +show ipv6 eigrp neighbors + +show key chain + +show ip ospf interface interface_id + +show crypto ipsec sa interface interface_id + +show ip[v6] ospf neighbor + +show ip bgp neighbors + +show bgp ipv6 unicast summary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +Appendix G Study Planner +Practice Exam Reading Task + + + +Element Task Goal Date First Date Completed + +Second Date Completed (Optional) + + + +Introduction + +1) Characteristics of Routing Protocols + +1) Characteristics of Routing Protocols + +2) Remote Site Connectivity + +2) Remote Site Connectivity + + +Part I Review + + + +3) IPv6 Review and RIPng + +3) IPv6 Review and RIPng + +4) Fundamental EIGRP Concepts + +4) Fundamental EIGRP Concepts + +5) Advanced EIGRP Concepts + +5) Advanced EIGRP Concepts + +6) EIGRP for IPv6 and Named EIGRP + +6) EIGRP for IPv6 and Named EIGRP + +7) Fundamental OSPF Concepts + +7) Fundamental OSPF Concepts + +8) The OSPF Link State Database + +8) The OSPF Link State Database + +9) Advanced OSPF Concepts 9) Advanced OSPF Concepts + + +Part II Review + + + +10) Basic IGP Redistribution + +10) Basic IGP Redistribution + +Read Introduction + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for chapters 1-2 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 3-9 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks +From the Library of Alexey Evseenko +11) Route Selection + +11) Route Selection + + +Part III Review + + + +12) Fundamentals of Internet Connectivity + +12) Fundamentals of Internet Connectivity + +13) Fundamental BGP Concepts + +13) Fundamental BGP Concepts + +14) Advanced BGP Concepts + +14) Advanced BGP Concepts + +15) IPv6 Internet Connectivity + +15) IPv6 Internet Connectivity + + +Part IV Review + + + +16) Fundamental Router Security Concepts + +16) Fundamental Router Security Concepts + +17) Routing Protocol Authentication + +17) Routing Protocol Authentication + + +Part V Review + + + +18) Final Preparation + + +18) Final Review + + +18) Final Review + +18) Final Review + +18) Final Review + + +18) Final Review + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 10-11 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 12-15 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for chapters 16-17 in practice test software + +Read Final Preparation Chapter +Take practice test in study mode for all Book Questions in practice test software +Review all Key Topics in all chapters +Complete all memory tables from appendix E +Practice CLI Skills + +Take practice test in practice exam mode using Exam Bank #2 questions for all chapters + + +From the Library of Alexey Evseenko + + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko +GLOSSARY + + + + + + + + + + + + +224.0.0.5 + +224.0.0.6 routers. + + +The All OSPF Routers multicast IP address, listened for by all OSPF routers. + +The All OSPF DR Routers multicast IP address, listened for by DR and BDR + + +2-Way (OSPF) A neighbor state that signifies the other router has reached neighbor status, having passed the parameter check. + +6to4 An IPv6/IPv4 tunneling method. + +ABR See area border router. + +access layer A Cisco network design term that refers to the devices that connect directly to the user. For LAN designs, the access layer consists of the switches connected to end user hosts. For WANs, the access layer consists mainly of routers at remote sites. +Ack (EIGRP) An EIGRP message that is used to acknowledge reliable EIGRP messages, namely Update, Query, and Reply messages. Ack messages do not require acknowledgment with an ACK message. +ACL (access control list) A list configured on a router to control packet flow through the router, such as to prevent packets with a certain IP address from leaving a particular interface on the router. +active (BGP state) A BGP neighbor state in which the TCP connection has successfully completed but the BGP neighbors have not yet agreed to exchange path information. + +active (EIGRP) A state for a route in an EIGRP topology table that indicates that the router is actively sending Query messages for this route, attempting to validate and learn the current best route to that subnet. +address block Refers to a set of consecutive IP addresses. Often, this term is used more generically than the terms subnet or CIDR block, all of which refer to a set of IP addresses. + +adjacent (OSPF) Any OSPF neighbor for which the database flooding process has completed. + +administrative distance In Cisco routers, a means for one router to choose between multiple routes to reach the same subnet when those routes are learned by different routing protocols. The lower the administrative distance, the more preferred the source of the rout-ing information. + + + + +From the Library of Alexey Evseenko +4 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +administrative weight A Cisco-proprietary BGP feature. The administrative weight can be assigned to each NLRI and path locally on a router, impacting the local router’s choice of the best BGP routes. The value cannot be communicated to another router. +advertised distance See reported distance. + +aggregate route Another term for summary route. + +aggregator An optional transitive BGP path attribute that, for a summary route, lists the BGP RID and ASN of the router that created the summary. + +All DR Multicast The multicast IP address 224.0.0.6, listened to by DR and BDR routers. + +All SPF Routers Multicast The multicast IP address 224.0.0.5, listened to by all OSPF routers. + +anycast An IPv6 address type that is used by a number of hosts in a network that are pro-viding the same service. Hosts accessing the service are routed to the nearest host in an any-cast environment based on routing protocol metrics. +area A grouping of routers and router interfaces, typically contiguous. Routers in an area strive to learn all topology information about the area and do not learn topology information about areas to which they do not connect. +area border router (ABR) A router that has interfaces connected to at least two differ-ent OSPF areas, one of which must be the backbone area. ABRs hold topology data for each area, calculate routes for each area, and advertise about those routes between areas. +ARP (Address Resolution Protocol) Defined in RFC 826, a protocol used on LANs so that an IP host can discover the MAC address of another device that uses a particular IP address. +AS_PATH A BGP path attribute that lists ASNs through which the route has been adver-tised. The AS_PATH includes four types of segments: AS_SEQ, AS_SET, AS_CONFED_SEQ, and AS_CONFED_SET. Often, this term is used synonymously with AS_SEQ. +AS_PATH access list A Cisco IOS configuration tool using the ip as-path access-list com-mand that defines a list of statements that match the AS_PATH BGP path attribute using regular expressions. +AS_PATH length A calculation of the length of the AS_PATH PA, which includes 1 for each number in the AS_SEQ, 1 for an entire AS_SET segment, and possibly other considerations. +AS_PATH prepending This term has two BGP-related definitions. First, it is the normal process in which a router, before sending an Update to an eBGP peer, adds its local ASN to the beginning of the AS_PATH path attribute. Second, it is the routing policy of purposefully adding one or more ASNs to the beginning of a route’s AS_PATH path attribute, typically to lengthen the AS_PATH and make the route less desirable in the BGP decision process. +AS_SEQUENCE A type of AS_PATH segment consisting of an ordered list of ASNs through which the route has been advertised. + + + + + +From the Library of Alexey Evseenko +Glossary 5 + +AS_SET A type of AS_PATH segment consisting of an unordered list of ASNs consoli-dated from component subnets of a summary BGP route. + +ASBR (Autonomous System Border Router) A router using OSPF in which the router learns routes via another source, typically another routing protocol, exchanging routes that are external to OSPF with the OSPF domain. +ASBR Summary LSA See Type 4 Summary ASBR LSA + +asymmetric routing A routing condition where packets take one path when traveling from a source device to a destination device, but return traffic takes a different path. + +authentication With routing protocols, the process by which the router receiving a routing update determines whether the routing update came from a trusted router. + +Authentication, Authorization, and Accounting (AAA) A security feature that enables a router to authenticate user credentials, determine what a user is allowed to do, and keep an audit trail of what they did. +auto summary A routing protocol feature in which a router that connects to more than one classful network advertises summarized routes for each entire classful network when sending updates out interfaces connected to other classful networks. +Automatic 6to4 tunnel A type of IPv6 multipoint tunnel that uses a reserved address range (2002::/16) and imbeds the IPv4 address in the second and third quartets of the IPv6 address. +autonomous system In BGP, a set of routers inside a single administrative authority, grouped together for the purpose of controlling routing policies for the routes advertised by that group to the Internet. +Autonomous System Border Router See ASBR. + +Autonomous System Number (AS Number or ASN) A number between 1 and 64,511 (public) and 64,512 and 65,535 (private) assigned to an AS for the purpose of proper BGP operation. +autosummarization A routing protocol feature in which a router that connects to more than one classful network advertises summarized routes for each entire classful network when sending updates out interfaces connected to other classful networks. +backbone area (OSPF) Area 0; the area to which all other OSPF areas must connect for OSPF to work. + +backbone router Any OSPF router that has at least one interface connected to the back-bone area. + +backup designated router (BDR) In OSPF, a router that is prepared to take over the des-ignated router. + +balanced hybrid Refers to one of three general types of routing protocol algorithms. The other two are distance-vector and link-state. EIGRP is the only routing protocol that Cisco classifies as using a balanced hybrid algorithm. + + + + + +From the Library of Alexey Evseenko +6 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +bandwidth 1) The rate at which bits are sent on an interface. 2) The Cisco IOS Software setting, per the bandwidth command, that tells Cisco IOS the speed of the interface. + +BDR See backup designated router. + +best path algorithm A set of rules by which BGP examines the details of multiple BGP routes for the same NLRI and chooses the single best BGP route to install in the local BGP table. +BGP See Border Gateway Protocol. + +BGP decision process See best path algorithm. + +BGP hard reset The process of restarting a BGP neighbor relationship by closing the TCP connection, causing both neighboring routers to remove all paths formerly learned from that neighbor from their respective BGP tables. +BGP peer Another name for a BGP neighbor. A BGP neighbor is another router running BGP with which the local router has formed a BGP neighbor relationship for the purpose of exchanging BGP Updates. +BGP peer group In BGP, a configuration construct in which multiple neighbors’ param-eters can be configured as a group, thereby reducing the length of the configuration. Additionally, BGP performs routing policy logic against only one set of Updates for the entire peer group, improving convergence time. +BGP soft reset The process of restarting a BGP neighbor relationship without closing the underlying TCP connection, instead resending full Updates to the neighbor and asking for the neighbor to send a full Update again. +BGP synchronization In BGP, a feature in which BGP routes cannot be considered to be a best route to reach an NLRI unless that same prefix exists in the router’s IP routing table as learned via some IGP. +BGP table A table inside a router that holds the path attributes and NLRI known by the BGP implementation on that router. + + +BGP Update + +BGP Weight + + +A BGP message that includes withdrawn routes, path attributes, and NLRI. + +A local Cisco-proprietary BGP setting that is not advertised to any peers. A + +larger value is considered to be better. + +Border Gateway Protocol (BGP) An exterior routing protocol designed to exchange prefix information between different autonomous systems. The information includes a rich set of characteristics called path attributes, which in turn allows for great flexibility regarding routing choices. +cable A short term to refer to using Cable TV (CATV) to transmit data, typically for high-speed Internet connections. + +Challenge Handshake Authentication Protocol (CHAP) A security feature defined by PPP that allows either or both endpoints on a link to authenticate the other device as a par-ticular authorized device. + + + + + +From the Library of Alexey Evseenko +Glossary 7 + +CHAP See Challenge Handshake Authentication Protocol. + +CIDR See Classless Interdomain Routing. + +CIDR notation See prefix notation. + +Cisco Express Forwarding (CEF) An optimized Layer 3 forwarding path through a router or switch. CEF optimizes routing table lookup by creating a special, easily searched tree structure based on the contents of the IP routing table. The forwarding information is called the Forwarding Information Base (FIB), and the cached adjacency information is called the adjacency table. +Cisco Lifecycle Services An approach to the implementation of Cisco technologies, as defined by Cisco. + +classful IP addressing A convention for discussing and thinking about IP addresses by which Class A, B, and C default network prefixes (of 8, 16, and 24 bits, respectively) are considered. +classful network An IPv4 Class A, B, or C network. It is called a classful network because these networks are defined by the class rules for IPv4 addressing. + +classful routing A type of logic for how a router uses a default route. When a default route exists, and the Class A, B, or C network for the destination IP address does not exist in the routing table, the default route is used. If any part of that classful network exists in the routing table but the packet does not match any existing subnet of that classful network, the packet does not match the default route and thus is discarded. +classful routing protocol An inherent characteristic of a routing protocol—specifically, the routing protocol does not send subnet masks in its routing updates. This requires the protocol to make assumptions about classful networks and makes it unable to support VLSM and manual route summarization. +classless addressing A concept in IPv4 addressing that defines a subnetted IP address as having two parts: a prefix (or subnet) and a host. + +Classless Interdomain Routing (CIDR) Defined in RFCs 1517–1520, a scheme to help reduce Internet routing table sizes by administratively allocating large blocks of consecutive classful IP network numbers to ISPs for use in different global geographies. CIDR results in large blocks of networks that can be summarized, or aggregated, into single routes. +classless IP addressing A convention for IP addresses in which Class A, B, and C default network prefixes (of 8, 16, and 24 bits, respectively) are ignored. + +classless routing protocol An inherent characteristic of a routing protocol—specifically, the routing protocol sends subnet masks in its routing updates, thereby removing any need to make assumptions about the addresses in a particular subnet or network. This allows the protocol to support VLSM and manual route summarization. +component route A route that is included in a larger summary route. + +contiguous network In IPv4, an internetwork design in which packets forwarded between any two subnets of a single classful network pass through only the subnets of that classful network. + + + +From the Library of Alexey Evseenko +8 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + +control plane protocols. + +convergence + + +In IP routing, refers to the building of IP routing tables by IP routing + + +The time required for routing protocols to react to changes in the network, + +removing bad routes and adding new, better routes so that the current best routes are in all the routers’ routing tables. +core layer A Cisco network design term that refers to the devices through which most traf-fic flows, typically located near the center of a network. Core devices must forward packets/ frames with low delay, in high volume, and either do little or no services with the packets, or do so without a degradation in speed or throughput. +CSU/DSU (channel service unit/data service unit) A device that connects a physical circuit installed by the telco to some CPE device, adapting between the voltages, current, framing, and connectors used on the circuit to the physical interface supported by the DTE. +data communications equipment (DCE) From a physical layer perspective, the device providing the clocking on a WAN link, typically a CSU/DSU, is the DCE. From a packet-switching perspective, the service provider’s switch, to which a router might connect, is con-sidered the DCE. +data-link connection identifier A Frame Relay address used in Frame Relay headers to identify the Virtual Circuit. + +data plane In IP routing, a term referring to a set of processes that forward packets through a router. + +Database Description (DD) A type of OSPF packet used to exchange and acknowledge LSA headers. Sometimes called DBD. + +DCE See data communications equipment. + +DD See Database Description. + +Dead Interval With OSPF, the timer used to determine when a neighboring router has failed, based on a router not receiving any OSPF messages, including Hellos, in this timer period. Also called the Dead Timer. +default network A Cisco IOS mechanism for determining a router’s default route, by which the router is configured with a classful network number as the default network, and the router uses its route for that network as its default route. +default route A route that is used to forward packets when the packet does not match any more specific routes in the IP routing table. + +delay A Cisco IOS Software setting, per the delay command, that defines to the router an estimate of the time that a packet is expected to spend trying to exit a router interface. The delay command uses a unit of tens-of-microseconds. +designated router (DR) On multiaccess data links such as LANs, an OSPF router elected by the routers on that data link to perform special functions. These functions include the generation of LSAs representing the subnet and playing a key role in the database exchange process. + + + + +From the Library of Alexey Evseenko +Glossary 9 + +DHCP See Dynamic Host Configuration Protocol. + +DHCPv6 Prefix Delegation (DHCPv6-PD) A variant of Stateful DHCPv6, which allows a DHCPv6 server to assign a collection of IPv6 networks to a router (or other DHCPv6 client). + +Differentiated Services A set of QoS RFCs that redefines the IP header’s ToS byte and suggests specific settings of the DSCP field and the implied QoS actions based on those settings. +Differentiated Services Code Point (DSCP) The first six bits of the DS field, used for QoS marking. + +Diffie-Hellman Key Exchange A key exchange protocol in which two devices can gener-ate a shared secure symmetric key over an insecure medium. + +DiffServ See Differentiated Services. + +Diffused Update Algorithm A convergence algorithm used in EIGRP that provides loop-free operation at every instance throughout a route computation. Allows routers involved in a topology change to synchronize at the same time, while not involving routers that are unaf-fected by the change. Also called Diffusing Update Algorithm in some references. +Digital Signal Level 0 Inside Telcos’ original TDM hierarchy, the smallest unit of transmis-sion at 64 kbps. + +digital subscriber line (DSL) A Layer 1 technology used on the Telco local loop to trans-mit digital data signals, using frequencies more than 4000 Hz, over the same two-wire circuit as analog voice signals (which typically use frequencies less than 4000 Hz). +Dijkstra Alternative name for the SPF algorithm, named for its inventor, Edsger W. Dijkstra. + +Dijkstra Shortest Path First (SPF) algorithm The name of the algorithm used by link-state routing protocols to analyze the LSDB and find the least-cost routes from that router to each subnet. +discontiguous network In IPv4, an internetwork design in which packets forwarded between two subnets of a single classful network must pass through the subnets of another classful network. +Discretionary Path Attribute Describes some BGP Path Attributes, specifically those attributes for which a router does not have to support the PA. + +distance-vector The logic behind the behavior of some interior routing protocols, such as RIP and IGRP, characterized by routers sending brief information about a subnet, and a met-ric (vector) describing how far away that subnet is. Distance-vector routing algorithms call for each router to send its entire routing table in each periodic update, but only to its neighbors. Distance-vector routing algorithms can be prone to routing loops but are computationally simpler than link-state routing algorithms. Also called Bellman-Ford routing algorithm. +distribute list A Cisco IOS configuration tool for routing protocols by which routing updates may be filtered. + + + + + +From the Library of Alexey Evseenko +10 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +distribution layer A Cisco design term that refers to the devices to which the access layer connects, with the distribution layer distributing packets among the many access devices. + +DLCI See data-link connection identifier. + +domain loop A term used in this book, but not necessarily used widely, to describe a rout-ing loop that occurs between different IGP routing domains as a result of multiple route redistribution points between routing domains. +DR See designated router. + +DR election (OSPF) The process by which neighboring OSPF routers examine their Hello messages and elect the DR. The decision is based on priority (highest), or RID (highest) if pri-ority is a tie. +DROther The term to describe a router that is neither the DR nor the BDR on a subnet that elects a DR and BDR. + +DS field The second byte of the IP header, formerly known as the ToS byte and redefined by DiffServ. + +DSCP See Differentiated Services Code Point. + +DUAL See Diffused Update Algorithm. + +dual homed Refers to a particular type of design between an enterprise and the Internet, in which only one ISP is used but using two or more links to that ISP. + +dual multihomed Refers to a particular type of design between an enterprise and the Internet, in which more than one ISP is used, with more than one link to each ISP. + +dual stacks In IPv6, a mode of operation in which a host or router runs both IPv4 and IPv6. + +duplicate address detection (DAD) An IPv6 mechanism through which a host can deter-mine whether another active host on the same link is trying to use the same IPv6 address. + +Dynamic Host Configuration Protocol (DHCP) A standard (RFC 2131) protocol by which a host can dynamically broadcast a request for a server to assign to it an IP address, along with other configuration settings, including a subnet mask and default gateway IP address. +Dynamic Multipoint VPN (DMVPN) A virtual private network (VPN) technology that enables a tunnel to be set up or torn down between two sites on an as-needed basis. + +Dynamic NAT (DNAT) A version of Network Address Translation (NAT), where inside local addresses are dynamically assigned an inside global address from a pool of available addresses. +E1 route (OSPF) An OSPF external route for which internal OSPF cost is added to the cost of the route as it was redistributed into OSPF. + +E2 route (OSPF) An OSPF external route for which internal OSPF cost is not added to the cost of the route as it was redistributed into OSPF. + + + + + +From the Library of Alexey Evseenko +Glossary 11 + +Easy Virtual Networking (EVN) A simplified approach to configure Virtual Routing and Forwarding (VRF) on Cisco routers. + +eBGP See External BGP. + +eBGP multihop A BGP feature that defines the IP TTL field value in packets sent between two eBGP peers. This feature is required when using IP addresses other than the interface IP address on the link between peers. +EGP See Exterior Gateway Protocol. + +EIGRP (Enhanced Interior Gateway Routing Protocol) An advanced version of IGRP developed by Cisco. Provides superior convergence properties and operating efficiency and combines the advantages of link-state protocols with those of distance-vector protocols. +EIGRP for IPv6 An interior routing protocol for IPv6 based on the original EIGRP proto-col for IPv4. + +EIGRP stub router A router running EIGRP that limits itself in several different ways for the purpose of limiting the EIGRP DUAL algorithm and reducing EIGRP Query scope. + +Enterprise Edge A network design term referring to the routers at the distribution layer, connected to the WAN. Also called the WAN edge. + +established A BGP neighbor state in which the BGP neighbors have stabilized and can exchange routing information using BGP Update messages. + +Ethernet over MPLS (EoMPLS) The transport of Ethernet frames (mostly) transparently across an MPLS network. + +EUI-64 A specification for the 64-bit interface ID in an IPv6 address, composed of the first half of a MAC address (with the seventh bit flipped), hex FFFE, and the last half of the MAC. +extended ping A Cisco IOS command in which the ping command accepts many other options besides just the destination IP address. + +Exterior Gateway Protocol (EGP) A routing protocol that was designed to exchange routing information between different autonomous systems. EGP has been replaced by BGP and is no longer supported in Cisco IOS. +External BGP A term referring to how a router views a BGP peer relationship, in which the peer is in another AS. + +External LSA In OSPF, an LSA that represents a subnet that OSPF learned from another (external) routing source, typically through route redistribution. + +external route A characteristic of a route, as defined by a particular routing protocol, that means that the route was learned by that routing protocol through the route redistribution + +process. + +External Type 1 + +External Type 2 + + + +See E1 route. + +See E2 route. + + + + + + +From the Library of Alexey Evseenko +12 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +FD See feasible distance. + +feasibility condition With EIGRP, for a particular route, the case in which the reported distance is lower than the feasible distance. + +feasible distance With EIGRP, the metric value for the lowest-metric route to a particular subnet. + +feasible successor With EIGRP, a route that is not a successor route but that meets the feasibility condition; can be used when the successor route fails, without causing loops. + +flash updates See triggered updates. + +floating static route A static route configured with an administrative distance greater than a routing protocol on that same router, resulting in the static route floating into the routing table when the routing protocol’s learned route fails. +flooding In OSPF, the process of exchanging LSA information throughout an area, by hav-ing a router send the LSAs to their neighbors who in turn send the LSAs to their neighbors, and so on. +forward route From one host’s perspective, the route over which a packet travels from that host to some other host. + +Frame Relay An international standard data-link protocol that defines the capabilities to create a frame-switched (packet-switched) service, allowing DTE devices (typically routers) to send data to many other devices using a single physical connection to the Frame Relay service. +Frame Relay Inverse ARP Defined in RFC 1293, this protocol enables a Frame Relay– attached device to react to a received LMI “PVC up” message by announcing its Layer 3 addresses to the device on the other end of the PVC. +Frame Relay mapping The information that correlates, or maps, a Frame Relay DLCI to the Layer 3 address of the DTE on the other end of the VC identified by the local DLCI. + +full mesh A network design term often used with multiaccess networks such as Frame Relay, referring to the case in which a direct communications path exists between every pair of devices in the design. +full SPF calculation An SPF calculation as a result of changes inside the same area as a router, for which the SPF run must examine the full LSDB. + +Full State In OSPF, a neighbor state that implies that the two routers have exchanged the complete (full) contents of their respective LSDBs. + +full update A routing protocol feature by which the routing update includes the entire set of routes, even if some or all the routes are unchanged. + +fully adjacent (OSPF) Any OSPF neighbor for which the database flooding process directly between the two neighbors has completed. Note that not all neighbors directly exchange databases, so not all neighbors reach a full state. +gateway of last resort The notation in a Cisco IOS IP routing table that identifies the route used by that router as the default route. + + + +From the Library of Alexey Evseenko +Glossary 13 + +Generic Routing Encapsulation (GRE) A tunneling protocol that can be used to encapsu-late many different protocol types, including IPv4, IPv6, IPsec, and others, to transport them across a network. +global routing prefix The first 48 bits of an IPv6 global address, used for efficient route aggregation. + +global unicast address A type of unicast IPv6 address that has been allocated from a range of public globally unique IP addresses as registered through ICANN, its member agen-cies, and other registries or ISPs. +going active EIGRP jargon meaning that EIGRP has placed a route into active status. + +Goodbye (EIGRP) An EIGRP message that is used by a router to notify its neighbors when the router is gracefully shutting down. + +Graceful Restart (OSPF) As defined in RFC 3623, graceful restart allows for uninterrupt-ed forwarding if an OSPF router’s OSPF routing process must restart. The router does this by first notifying the neighbor routers that the restart is about to occur; the neighbors must be RFC 3623-compliant and the restart must occur within the defined grace period. +Graceful shutdown EIGRP process of sending a goodbye message (actually held inside a Hello message) for the purpose of informing neighbors that the local EIGRP process is shut down. +GRE See Generic Routing Encapsulation. + +GRE tunnel A tunnel created using Generic Routing Encapsulation. See Generic Routing Encapsulation. + +Hello (EIGRP) An EIGRP message that identifies neighbors, exchanges parameters, and is sent periodically as a keepalive function. Hellos do not require an Ack. + +Hello (OSPF) A type of OSPF packet used to discover neighbors, check for parameter agreement, and monitor the health of another router. + +Hello interval With OSPF and EIGRP, an interface timer that dictates how often the router should send Hello messages. + +Hold timer With EIGRP, the timer used to determine when a neighboring router has failed, based on a router not receiving any EIGRP messages, including Hellos, in this timer period. + +holddown A state into which a route is placed so that routers neither advertise the route nor accept advertisements about it for a specific length of time (the holddown period). Holddown is used to flush bad information about a route from all routers in the network. A route typically is placed in holddown when a link in that route fails. +iBGP Internal BGP Refers to how a router views a BGP peer relationship, in which the peer is in the same AS. + +iBGP Mesh A BGP design convention in which all BGP peers internal to a single AS have been directly peered so that all pairs of internal BGP routers are neighbors. + + + + + + +From the Library of Alexey Evseenko +14 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +IEEE 802.1X An IEEE standard that, when used with EAP, provides user authentication before their connected switch port enables the device to fully use the LAN. + +IGRP (Interior Gateway Routing Protocol) An old, no-longer-supported Interior Gateway Protocol (IGP) developed by Cisco. + +InARP See Inverse ARP. + +infinity In the context of IP routing protocols, a finite metric value defined by the routing protocol that is used to represent an unusable route in a routing protocol update. + +infrastructure ACL An ACL typically configured on routers at the edge of an enterprise network, which helps prevent malicious traffic from entering the network. + +input event Any occurrence that could change a router’s EIGRP topology table, including a received Update or Query, a failed interface, or the loss of a neighbor. + +inside global address A NAT term referring to the IP address used for a host inside the trusted part of the network, but in packets as they traverse the global (untrusted) part of the network. +inside local address A NAT term referring to the IP address used for a host inside the trusted part of the network, but in packets as they traverse the local (trusted) part of the network. +interface ID Sixty-four bits at the end of an IPv6 global address, used to uniquely identify each host in a subnet. + +Interior Gateway Protocol (IGP) A routing protocol designed to be used to exchange routing information inside a single autonomous system. + +Internal BGP (iBGP) A characteristic of a BGP neighbor relationship, specifically when the two routers are internal to the same BGP ASN. + +internal routers An OSPF router that has interfaces connected to only one area, making the router completely internal to that one area. + +Internet Assigned Numbers Authority (IANA) An organization that directs the assign-ment of IPv4 and IPv6 addresses worldwide. + +Internet Service Provider (ISP) A company that provides Internet connectivity. + +Inter-Switch Link (ISL) The Cisco-proprietary VLAN trunking protocol that predated 802.1Q by many years. ISL defines a 26-byte header that encapsulates the original Ethernet frame. +Invalid timer With RIP, a per-route timer that increases until the router receives a routing update that confirms the route is still valid, upon which the timer is reset to 0. If the updates cease, the Invalid timer will grow, until reaching the timer setting (default 180 seconds), after which the route is considered invalid. +Inverse ARP Defined in RFC 1293, this protocol enables a Frame Relay–attached device to react to a received LMI “PVC up” message by announcing its Layer 3 addresses to the device on the other end of the PVC. + + + + +From the Library of Alexey Evseenko +Glossary 15 + +inverse neighbor discovery An IPv6 feature on non-broadcast multiaccess (NBMA) data links such as Frame Relay, providing the ability to learn a neighbor’s Layer 3 address when the underlying Layer 2 address is known. The IPv6 equivalent of Frame Relay Inverse ARP. +IOS service level agreement (IOS SLA) An IOS feature that can be configured to gener-ate packets, measure the delay, jitter, and simple working state of the measurement, and col-lect the data for reporting. +IP forwarding The process of forwarding packets through a router. Also called IP routing. + +IP Precedence A three-bit field in the first three bits of the ToS byte in the IP header, used for QoS marking. + +IP prefix list See prefix list. + +IP routing The process of forwarding packets through a router. Also called IP forwarding. + +IPsec Refers to the IP Security Protocols, which is an architecture for providing encryption and authentication services, typically when creating VPN services through an IP network. + +IPsec tunnel A tunnel created using IPsec protocols. + +IPv4 Version 4 of the IP protocol, which is the generally deployed version worldwide (at publication) and uses 32-bit IP addresses. + +IPv6 Version 6 of the IP protocol, which uses 128-bit IP addresses. + +ISATAP The Intra-site Automatic Tunnel Addressing Protocol that defines a protocol for creating dynamic multipoint IPv6 over IPv4 tunnels by embedding the tunnel destination’s IPv4 address in the last two quartets of the IPv6 address. +ISATAP tunnel A tunnel created using ISATAP. See ISATAP. + +ISP prefix In IPv6, the prefix that describes an address block that has been assigned to an ISP by some Internet registry. + +K-value EIGRP (and IGRP) allows for the use of bandwidth, load, delay, MTU, and link reliability; the K-values refer to an integer constant that includes these five possible metric components. Only bandwidth and delay are used by default, to minimize recomputation of metrics for small changes in minor metric components. +keepalive A feature of many data-link protocols in which the router sends messages peri-odically to let the neighboring router know that the first router is still alive and well. + +Keepalive (BGP) A BGP message sent to maintain an active neighbor relationship and maintain the underlying TCP connection when a router has no other BGP messages to send. + +key chain A collection of one or more keys (that is, passwords) used for authentication, where each key has an associated key ID and key string. + +LAPF See Link Access Procedure for Frame-Mode Bearer Services. + +leased line A transmission line reserved by a communications carrier for a customer’s pri-vate use. A leased line is a type of dedicated line. + + + + + +From the Library of Alexey Evseenko +16 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +limiting query scope (EIGRP) An effort to reduce the query scope with EIGRP, using route summarization or EIGRP stub routers. + +Link Access Procedure for Frame-Mode Bearer Services An ITU standard Frame Relay header, including the DLCI, DE, FECN, and BECN bits in the LAPF header and a frame check in the LAPF trailer. +link control protocol The portion of PPP focused on features that are unrelated to any specific Layer 3 protocol. + +link local address A type of unicast IPv6 address that represents an interface on a single data link. Packets sent to a link local address cross only that particular link and are never for-warded to other subnets by a router. Used for communications that do not need to leave the local link, such as neighbor discovery. +link-state A classification of the underlying algorithm used in some routing protocols. Link-state protocols build a detailed database that lists links (subnets) and their state (up, down), from which the best routes can then be calculated. +link-state acknowledgment A type of OSPF packet used to acknowledge LSU packets. + +Link-State Advertisement (LSA) The name of a class of OSPF data structures that hold topology information. LSAs are held in memory in the LSDB and communicated over the network in LSU messages. +Link-State Database (LSDB) In OSPF, the data structure in RAM of a router that holds the various LSAs, with the collective LSAs representing the entire topology of the network. + +link-state identifier (LSID) A 32-bit number used to uniquely identify an OSPF LSA. + +link-state request An OSPF packet used to ask a neighboring router to send a particular LSA. + +link-state routing protocol Any routing protocol that uses the concept of using the SPF algorithm with an LSDB to compute routes. + +link-state update (LSU) The name of the OSPF packet that holds the detailed topology information, specifically LSAs. + +LMI See Local Management Interface. + +load A Cisco router interface statistic that measures the percentage link utilization, with the value represented as an integer between 0 to 255 and the percentage calculated as the listed number/255. EIGRP can use load as input to the EIGRP metric calculation. +loading An OSPF neighbor state that occurs after the completion of database description messages but while the database exchange using link-state request and link-state update pack-ets continues. +local computation An EIGRP router’s reaction to an input event, leading to the use of a feasible successor or going active on a route. + + + + + + + +From the Library of Alexey Evseenko +Glossary 17 + +Local Management Interface (LMI) A Frame Relay protocol used between a DTE (rout-er) and DCE (Frame Relay switch). LMI acts as a keepalive mechanism. The absence of LMI messages means that the other device has failed. It also tells the DTE about the existence of each VC and DLCI, along with its status. +local preference See LOCAL_PREF. + +LOCAL_PREF A BGP path attribute that is communicated throughout a single AS to sig-nify which route of multiple possible routes is the best route to be taken when leaving that AS. A larger value is considered to be better. +LSA See link-state advertisement. + +LSA flooding The process of successive neighboring routers exchanging LSAs such that all routers have an identical LSDB for each area to which they are attached. + +LSA type (OSPF) A definition that determines the data structure and information implied by a particular LSA. + +LSAck See link-state acknowledgment. + +LSDB See link-state database. + +LSRefresh Link-State Refresh An OSPF timer that determines how often the originating router should reflood an LSA, even if no changes have occurred to the LSA. + +LSU See link-state update. + +Management Information Base (MIB) The definitions for a particular set of data vari-ables, with those definitions following the Structure of Management Information (SMI) specifications. +Mandatory PA A description of a BGP Path Attribute that means that all routers using BGP must support, understand, and react to that PA. + +manually configured tunnel A type of IPV6-over-IPv5 point-to-point tunnel in which the tunnel source and destination are preconfigured. + +Maximum Transmission Unit (MTU) An IP variable that defines the largest size allowed in an IP packet, including the IP header. IP hosts must support an MTU of at least 576 bytes. + +measured round-trip time A TCP variable used as the basis for a TCP sender’s timer defining how long it should wait for a missing acknowledgment before resending the data. + +Message Digest 5 (MD5) Authentication with IP routing protocols, a method of apply-ing a mathematical formula, with input including a private key, the message contents, and sometimes a shared text string, with the resulting digest being included with the message. The sender and the receiver perform the same math to allow authentication and to prove that no intermediate device changed the message contents. +metric With routing protocols, the measurement of favorability that determines which entry will be installed in a routing table if more than one router is advertising that exact net-work and mask with one routing protocol. + + + + + +From the Library of Alexey Evseenko +18 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +Metro Ethernet A general term for Ethernet-like WAN connectivity services, including VPWS and VPLS. + +MIB See Management Information Base. + +MLP See Multilink PPP. + +MLS See multilayer switching. + +Modified EUI-64 A variation on the EUI-64 method of completing the last 64 bits of an IPv6 address, specifically used for ISATAP tunnels. The last 64 bits (last four quartets) consist of 0000:5EFE, followed by the hex version of the tunnel destination’s IPv4 address. +MRTT See measured round-trip time. + +MTU Maximum transmission unit. The maximum packet size, in bytes, that a particular interface can handle. + +Multi Exit Discriminator (MED) See MULTI_EXIT_DISC. + +MULTI_EXIT_DISC (MED) A BGP path attribute that enables routers in one AS to set a value and advertise it into a neighboring AS, impacting the decision process in that neighbor-ing AS. A smaller value is considered better. Also called the BGP metric. +multicast IP address range For IPv4, the multicast address range is from 224.0.0.0 through 239.255.255.255. For IPv6, multicast addresses have a prefix of ff00::/8. + +multicast IP address structure For IPv4, the first 4 bits of the first octet must be 1110. The last 28 bits are unstructured. For IPv6, multicast addresses have a prefix of ff00::/8. + +multicast MAC address A type of Ethernet MAC address meant to be used to send frames to a subset of the devices on a single broadcast domain. More specifically, as used with IPv4 multicast packets, a 48-bit address that is calculated from a Layer 3 multicast address by using 0x0100.5E as the multicast vendor code (OUI) for the first 24 bits, always binary 0 for the 25th bit, and copying the last 23 bits of the Layer 3 multicast address. +multihomed A description of an Enterprise’s connection to the Internet. This term refers to both single multihomed, which consists of one link each to two or more ISPs, and dual multihomed, with two or more links each to two or more ISPs. +multilayer switching A process whereby a switch, when making a forwarding decision, uses not only Layer 2 logic but other OSI layer equivalents as well. + +multilink PPP A PPP feature used to load balance multiple parallel links at Layer 2 by fragmenting frames, sending one frame over each of the links in the bundle, and reassembling them at the receiving end of the link. +multipoint GRE A virtual private network (VPN) technology that enables multiple GRE tunnels to terminate on a single GRE tunnel interface. + +multipoint subinterface A configuration construct in a Cisco router, typically with Frame Relay, in which one logical subinterface can be used to forward traffic to more than one remote router. + + + + + +From the Library of Alexey Evseenko +Glossary 19 + +multipoint tunnel A type of tunnel in which more than one destination may be reached over a single tunnel. + +Multiprotocol BGP (MP-BGP) An updated version of BGPv4 that includes components supporting the routing of both IPv4 and IPv6 networks. + +NA See neighbor advertisement. + +named access list An ACL that identifies the various statements in the ACL based on a name rather than a number. + +Named EIGRP An EIGRP configuration approach that enables you to configure all EIGRP commands under a single hierarchical configuration. + +NAT See Network Address Translation. + +NAT overload See Port Address Translation. + +NAT Virtual Interface (NVI) A feature that enables a router interface to act as either a NAT inside or a NAT outside interface. + +native VLAN The one VLAN on an 802.1Q trunk for which the endpoints do not add the 4-byte 802.1Q tag when transmitting frames in that VLAN. + +NBMA See non-broadcast multi-access. + +NCP See Network Control Protocol. + +ND See Neighbor Discovery. + +neighbor In routing protocols, another router with which a router decides to exchange routing information. + +neighbor (EIGRP) With EIGRP, a router sharing the same primary subnet, with which Hellos are exchanged, parameters match, and routes can be exchanged. + +neighbor (OSPF) Any other router, sharing a common data link, with which a router exchanges Hellos, and for which the parameters in the Hello pass the parameter-check process. +Neighbor Advertisement (NA) In IPv6, the Neighbor Discovery message used by an IPv6 node to send information about itself to its neighbors. + +Neighbor Discovery (ND) The protocol used in IPv6 for many functions, including address autoconfiguration; duplicate address detection; router, neighbor, and prefix discov-ery; neighbor address resolution; and parameter discovery. +Neighbor Discovery Protocol (NDP) A longer name for IPv6 Neighbor Discovery. See Neighbor Discovery. + +Neighbor Solicitation (NS) In IPv6, the Neighbor Discovery message used by an IPv6 node to request information about a neighbor or neighbors. + +neighbor state A state variable kept by a router for each known neighbor or potential neighbor. + + + + + +From the Library of Alexey Evseenko +20 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +neighbor table For OSPF and EIGRP, a list of routers that have reached neighbor status. + +neighbor type In BGP, either external BGP (eBGP), confederation eBGP, or internal BGP (iBGP). The term refers to a peer connection and whether the peers are in different ASs (eBGP), different confederation subautonomous systems (confederation eBGP), or in the same AS (iBGP). +neighborship A shortened version of the phrase neighbor relationship. + +Network Address Translation (NAT) A mechanism for reducing the need for glob-ally unique IPv4 addresses. NAT enables an organization with addresses that are not glob-ally unique to connect to the Internet by translating those addresses into globally routable address space. +Network Address Translation-Protocol Translation (NAT-PT) As defined in RFCs 2765 and 2766, a method of translating between IPv4 and IPv6 packets that enables an IPv4-only host to communicate with an IPv6-only host. +Network Control Protocol (NCP) The portions of PPP focused on features that are relat-ed to specific Layer 3 protocols. + +network layer reachability information A BGP term referring to an IP prefix and prefix length. + +network LSA An OSPFv2 Type 2 LSA. See Type 2 LSA. + +Network Time Protocol (NTP) A protocol used to synchronize time among network devices. + +network type (OSPF) A characteristic of OSPF interfaces that determines whether a DR election is attempted and whether neighbors must be statically configured, and the default Hello and Dead timer settings. +Next Hop field With a routing update or routing table entry, the portion of a route that defines the next router to which a packet should be sent to reach the destination subnet. With routing protocols, the Next Hop field may define a router other than the router send-ing the routing update. +Next Hop Resolution Protocol (NHRP) A virtual private network (VPN) technology that enables a spoke in a hub-and-spoke topology to query the hub for the IP address of a physi-cal interface on a different spoke that corresponds to the IP address of the far end of a tunnel. +next-hop self A BGP configuration setting that tells the local router to change the NEXT_ HOP path attribute to refer to its own BGP Update Source when advertising routes to BGP neighbors. +NEXT_HOP A BGP path attribute that lists the next-hop IP address used to reach an NLRI. + +NLPID Network Layer Protocol ID is a field in the RFC 2427 header that is used as a Protocol Type field to identify the type of Layer 3 packet encapsulated inside a Frame Relay frame. +NLRI See network layer reachability information. + + + + +From the Library of Alexey Evseenko +Glossary 21 + +nonbackbone area Any OSPF area that is not the backbone area. + +Non-Broadcast Multi-Access (NBMA) A characterization of a type of Layer 2 network in which more than two devices connect to the network, but the network does not allow broad-cast frames to be sent to all devices on the network. +not-so-stubby area A type of OSPF stub area that acts like other stub areas in that ABRs inject default routes into the area, but unlike non-NSSA stub areas, external routes can be injected into the area. +notification (BGP) A BGP message used to inform BGP neighbors of a protocol error. + +NS See Neighbor Solicitation. + +NSSA See not-so-stubby area. + +object tracking A Cisco IOS feature in which IOS repeatedly checks the current state of some item so that other items can then react in response to a change in the monitored state. For example, object tracking can track the state of IP SLA operations, with static routes and policy routes reacting to a change in the object tracking feature. +offset list A Cisco IOS configuration tool for RIP and EIGRP for which the list matches routes in routing updates and adds a defined value to the sent or received metric for the routes. The value added to the metric is the offset. +one-way redistribution The process of route redistribution in which one routing protocol redistributes routes into a second routing protocol, but the reverse redistribution is not configured. +Open A BGP message type used when the underlying TCP connection completes, for the purpose of exchanging parameter information to determine whether the two routers are will-ing to become BGP neighbors. +Open Shortest Path First (OSPF) A popular link-state IGP that uses a link-state database and the Shortest Path First (SPF) algorithm to calculate the best routes to reach each known subnet. +optional nontransitive A characterization of a BGP path attribute in which BGP imple-mentations are not required to support the attribute (optional), and for which if a router receives a route with such an attribute, the router should remove the attribute before adver-tising the route (nontransitive). +optional transitive A characterization of a BGP path attribute in which BGP implementa-tions are not required to support the attribute (optional), and for which if a router receives a route with such an attribute, the router should forward the attribute unchanged (transitive). +ORIGIN A BGP path attribute that implies how the route was originally injected into some router’s BGP table. + +OSPF See Open Shortest Path First. + +OSPF area A group of routers and links, identified by a 32-bit area number, whose detailed topology information OSPF shares among all routers in the group. Routers inside an area learn full detailed topology information about the area; this detailed information is not advertised outside the area. + + + +From the Library of Alexey Evseenko +22 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +OSPF network type A characteristic of OSPF interfaces that determines whether a DR election is attempted, whether neighbors must be statically configured, and the default Hello and Dead Timer settings. +OSPF Version 3 (OSPFv3) An interior routing protocol created for IPv6 but based on OSPF Version 2, which was designed for IPv4. + +OSPFv3 Address Family A newer configuration approach for OSPFv3 that supports the routing of both IPv4 and IPv6 networks with a single OSPFv3 process (as opposed to having one OSPFv2 process for the routing of IPv4 networks and one OSPFv3 process for the rout-ing of IPv6 networks). +Outside Global address A NAT term describing an IP address representing a host that resides outside the enterprise network, with the address being used in packets outside the enterprise network. +Outside Local address A NAT term describing an IP address representing a host that resides outside the enterprise network, with the address being used in packets inside the enterprise network. +overlapping subnets An (incorrect) IP subnet design condition in which one subnet’s range of addresses includes addresses in the range of another subnet. + +overloading Another term for Port Address Translation. See PAT. + +packet switching A WAN service in which each DTE device connects to a telco using a single physical line, with the possibility of forwarding traffic to all other sites connected to the same service. The telco switch makes the forwarding decision based on an address in the packet header. +partial mesh A network topology in which more than two devices could physically com-municate but, by choice, only a subset of the pairs of devices connected to the network are allowed to communicate directly. +partial SPF calculation An SPF calculation for which a router does not need to run SPF for any LSAs inside its area but instead runs a simple algorithm for changes to LSAs outside its own area. +partial update A routing protocol feature by which the routing update includes only routes that have changed rather than including the entire set of routes. + +passive (EIGRP) A state for a route in an EIGRP topology table that indicates that the router believes that the route is stable and that it is not currently looking for any new routes to that subnet. +passive interface A routing protocol setting on an interface for which the router does not send Updates on the interface (RIP) or the router does not attempt to dynamically discover neighbors (EIGRP and OSPF), which indirectly prevents the EIGRP or OSPF router from sending Updates on the interface. +PAT See Port Address Translation. + +path attribute Generally describes characteristics about BGP paths advertised in BGP Updates. + + + +From the Library of Alexey Evseenko +Glossary 23 + +path control A general term, with several shades of meaning, that refers to any function that impacts how routers forward packets. These functions include routing protocols and any other feature that impacts the IP routing table, plus any feature that impacts the packet for-warding process. +path-vector A category of routing protocol that includes information about the exact path packets take to reach a specific destination network. BGP is a common example of a path-vector routing protocol. +peer group See BGP peer group. + +periodic update With routing protocols, the concept that the routing protocol advertises routes in a routing update on a regular periodic basis. This is typical of distance-vector rout-ing protocols. +permanent virtual circuit (PVC) A preconfigured communications path between two Frame Relay DTEs, identified by a local DLCI on each Frame Relay access link, that provides the functional equivalent of a leased circuit but without a physical leased line for each VC. +permit An action taken with an ACL that implies that the packet is allowed to proceed through the router and be forwarded. + +Point-to-Point Protocol (PPP) An Internet standard serial data-link protocol used on syn-chronous and asynchronous links that provides data-link framing, link negotiation, Layer 3 interface features, and other functions. +point-to-point tunnel A logical path between two devices created by encapsulating pack-ets of one protocol (the passenger protocol) inside packets of another protocol (the transport protocol) specifically in cases where only two routers exist in the tunnel. +poison reverse With RIP, the advertisement of a poisoned route out an interface when that route was formerly not advertised out that interface due to split horizon rules. + +poisoned route A route in a routing protocol’s advertisement that lists a subnet with a spe-cial metric value, called an infinite metric, that designates the route as a failed route. + +policy-based routing Cisco IOS router feature by which a route map determines how to forward a packet, typically based on information in the packet other than the destination IP address. +port 1) In TCP and UDP, a number used to uniquely identify the application process that either sent (source port) or should receive (destination port) data. 2) In LAN switching, anoth-er term for switch interface. +Port Address Translation (PAT) A NAT term describing the process of multiplexing TCP and UDP flows, based on port numbers, to a small number of public IP addresses. Also called NAT overloading. +PPDIOO Prepare, Plan, Design, Implement, Operate, Optimize. The six phases of the Cisco Lifecycle Services approach. + +PPP See Point-to-Point Protocol. + + + + + +From the Library of Alexey Evseenko +24 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +PPP over ATM (PPPoA) A convention often used as the data link protocol over DSL in which Asynchronous Transfer Mode (ATM) is used as the data link protocol, but with PPP encapsulated inside ATM. The combination gives the data link features of both ATM and PPP, in particular, the capability to forward the Layer 2 ATM cells to the DSLAM and the PPP authentication function of CHAP. +PPP over Ethernet (PPPoE) A convention often used as the data link protocol over cable in which Ethernet is used as the data link protocol but with PPP being encapsulated inside Ethernet. The combination gives the data link features of both Ethernet and PPP, in particu-lar, the capability to forward the Layer 2 Ethernet frames to the correct router, plus PPP authentication function of CHAP. +prefix (IPv4) Formally, a numeric value between 0 and 32 (inclusive) that defines the num-ber of beginning bits in an IP address for which all IP addresses in the same group have the same value. Less formally, the subnet number when writing an address/mask combination using prefix notation. +prefix (IPv6) A numeric value between 0 and 128 (inclusive) that defines the number of beginning bits in an IPv6 address for which all IP addresses in the same group have the same value. +prefix list A Cisco IOS configuration tool that you can use to match routing updates based on a base network address, a prefix, and a range of possible masks used inside the values defined by the base network address and prefix. +prefix notation A shorter way to write a subnet mask in which the number of binary 1s in the mask is simply written in decimal. For instance, /24 denotes the subnet mask with 24 binary 1 bits in the subnet mask. The number of bits of value binary 1 in the mask is consid-ered to be the prefix. +priority (OSPF) An administrative setting included in Hellos that is the first criteria for electing a DR. The highest priority wins, with values from 1 to 255, with priority 0 meaning a router cannot become DR or BDR. +private address space An IPv4 address in several Class A, B, and C networks that is set aside for use inside private organizations. These addresses, as defined in RFC 1918, are not routable through the Internet. +private addresses RFC 1918-defined IPv4 network numbers that are not assigned as pub-lic IP address ranges and are not routable on the Internet. Intended for use inside enterprise networks. +private AS A BGP ASN whose value is between 64,512 and 65,535. These values are not assigned for use on the Internet and can be used for private purposes, typically either within confederations or by ISPs to hide the ASN used by some customers. +private ASN An Autonomous System Number (ASN) that falls inside the Private AS range. + + +private IP address + +private IP network + + +See private addresses. + +One of several classful IPv4 network numbers that will never be + +assigned for use in the Internet; meant for use inside a single enterprise. + + + + +From the Library of Alexey Evseenko +Glossary 25 + +private key A secret value used in public/private key encryption systems. Values encrypt-ed with the public key can be decrypted with the private key and vice versa. + +process switching A least optimized Layer 3 forwarding path through a router. + +protocol data unit A generic term that refers to the data structure used by a layer in a lay-ered network architecture when sending data. + +protocol type A field in the IP header that identifies the type of header that follows the IP header, typically a Layer 4 header, such as TCP or UDP. ACLs can examine the protocol type to match packets with a particular value in this header field. +proxy ARP A router feature used when a router sees an ARP request searching for an IP host’s MAC, when the router believes the IP host could not be on that LAN because the host is in another subnet. If the router has a route to reach the subnet where the ARP-determined host resides, the router replies to the ARP request with the router’s MAC address. +public address space (IPv4) The nonreserved portions of the IPv4 unicast address space. + +public ASN An ASN that fits below the private ASN range, specifically from 1 through 54,511. + +public IP address See public address space. + +public key A published value used in public/private key encryption systems. Values encrypted with the public key can be decrypted with the private key and vice versa. + +PVC See permanent virtual circuit. + +quartet A set of four hex digits listed in an IPv6 address. Each quartet is separated by a colon. + +Query (EIGRP) An EIGRP message that asks neighboring routers to verify their route to a particular subnet. Query messages require an Ack. + +query scope (EIGRP) The characterization of how far EIGRP Query messages flow away from the router that first notices a failed route and goes active for a particular subnet. + +RA See router advertisement. + +RD See reported distance. + +redistribution The process on a router of taking the routes from the IP routing table, as learned by one routing protocol, and injecting routes for those same subnets into another routing protocol. +reference bandwidth In OSPF, the numerator in the calculation of interface cost. The for-mula is reference-bandwidth / interface-bandwidth. + +Regional Internet Registry (RIR) The generic term for one of five current organizations responsible for assigning the public globally unique IPv4 and IPv6 address space. + +registry prefix In IPv6, the prefix that describes a block of public globally unique IPv6 addresses assigned to a Regional Internet Registry by IANA. + +regular area In OSPF, a nonbackbone area. + + + + +From the Library of Alexey Evseenko +26 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +regular expression A list of interspersed alphanumeric literals and metacharacters used to apply complex matching logic to alphanumeric strings. Often used for matching AS_PATHs in Cisco routers. +reliability A Cisco router interface statistic that measures the percentage of packet loss, with the value represented as an integer between 0 to 255 and the percentage calculated as the listed number / 255. EIGRP can use reliability as input to the EIGRP metric calculation. +Reliable Transport Protocol A protocol used for reliable multicast and unicast transmis-sions. Used by EIGRP. + +Reply (EIGRP) An EIGRP message that is used by neighbors to reply to a Query. Reply messages require an Ack. + +reported distance From one EIGRP router’s perspective, the metric for a subnet as calcu-lated on a neighboring router and reported in a routing update to the first router. + +Retransmission Timeout (RTO) With EIGRP, a timer started when a reliable (to be acknowledged) message is transmitted. For any neighbor(s) failing to respond in its RTO, Reliable Transport Protocol (RTP) causes retransmission. +reverse route From one host’s perspective, for packets sent back to this host from another host, the route over which the packet travels. + +RIB failure An event that occurs when the Routing Table Manager (RTM) attempts to add a route to the IP routing table, but a problem exists with the route that prevents RTM from adding the route. +RID See router ID. + +RIP (Routing Information Protocol) An Interior Gateway Protocol (IGP) that uses dis-tance vector logic and router hop count as the metric. RIP version 1 (RIP-1) has become unpopular. +RIP Next Generation (RIPng) An IPv6 Interior Routing Protocol based on RIP (for IPv4). + +RIP version 2 (RIPv2) Provides more features, including support for VLSM. + +route map A configuration tool in Cisco IOS that enables basic programming logic to be applied to a set of items. Often used for decisions about what routes to redistribute and for setting particular characteristics of those routes—for example, metric values. +route poisoning The process of sending an infinite-metric route in routing updates when that route fails. + +route redistribution The process of taking routes known through one routing protocol and advertising those routes with another routing protocol. + +route summarization A consolidation of advertised addresses that causes a single sum-mary route to be advertised. + + + + + + + + +From the Library of Alexey Evseenko +Glossary 27 + +Route Tag A field within a route entry in a routing update used to associate a generic number with the route. It is used when passing routes between routing protocols, allowing an intermediate routing protocol to pass information about a route that is not natively defined to that intermediate routing protocol. Frequently used for identifying certain routes for fil-tering by a downstream routing process. +routed protocol A Layer 3 protocol that defines a packet that can be routed, such as IPv4 and IPv6. + +router advertisement (RA) In IPv6, a router advertisement message used by an IPv6 rout-er to send information about itself to nodes and other routers connected to that router. + +router ID (RID) In OSPF, a 32-bit number, written in dotted decimal, that uniquely identi-fies each router. + +Router LSA Another name for an OSPF Type 1 LSA. + +router security policy A document that defines security features deployed on a router. + +router solicitation (RS) An IPv6 message, part of the Neighbor Discovery Protocol (NDP), used by a host to request that the routers on the same data link announce their presence, IPv6 addresses, and all prefix/length combinations using a router advertisement (RA) message. +routing black hole A problem that occurs when an AS does not run BGP on all routers, with synchronization disabled. The routers running BGP might believe they have working routes to reach a prefix, and forward packets to internal routers that do not run BGP and do not have a route to reach the prefix. +Routing Information Base (RIB) A term referring to the IP routing table. + +routing protocol A set of messages and processes with which routers can exchange infor-mation about routes to reach subnets in a particular network. Examples of routing protocols include Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), and Routing Information Protocol (RIP). +Routing Table Manager A component of IOS that manages the process of adding IP routes to the IP routing table. RTM considers routes from all routing sources (static, con-nected, routing protocols) and chooses the best route to add for a given prefix/length. +RTP 1) See Reliable Transport Protocol. 2) Real-time Transport Protocol, a Layer 4 proto-col used to transmit voice and video media in a unified communications network. + +RTTMON MIB An MIB used by the IP SLA feature to collect data generated by IP SLA. + +secondary IP address The second (or more) IP address configured on a router interface using the secondary keyword on the ip address command. + +Secure Hash Algorithm (SHA) An authentication algorithm, considered to be more secure than MD5, that can provide neighbor authentication for Named EIGRP and OSPFv3. + +Secure Sockets Layer (SSL) A security protocol integrated into commonly used web browsers that provides encryption and authentication services between the browser and a website. + + + + +From the Library of Alexey Evseenko +28 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +seed metric When redistributing routes, the metric set for routes injected into another routing protocol. + +segment 1) In TCP, a term used to describe a TCP header and its encapsulated data (also called an L4PDU). 2) Also in TCP, the set of bytes formed when TCP breaks a large chunk of data given to it by the application layer into smaller pieces that fit into TCP segments. 3) In Ethernet, either a single Ethernet cable or a single collision domain (no matter how many cables are used). +sequence number (OSPF) In OSPF, a number assigned to each LSA, ranging from 0x80000001 and wrapping back around to 0x7FFFFFFF, that determines which LSA is most recent. +Service-Oriented Network Architecture (SONA) A robust open framework for building Unified Communications products. + +shared key A reference to a security key whose value is known by both the sender and the receiver. + +Shortest Path First (SPF) The name of the algorithm OSPF uses to analyze the LSDB. The analysis determines the best (lowest cost) route for each prefix/length. + +SIA-query An EIGRP Hello specially used halfway through a router’s active timer for a route in which a router queries the downstream neighbor to discover whether that neighbor is still working. +Simple Network Management Protocol (SNMP) A network management protocol that can enable a network management system (NMS) to query a managed device (that is, an SNMP client) for information found in the device’s Management Information Base (MIB), and can also enable a managed device to proactively send notifications (called “traps”) to an NMS in response to specific events. +single homed Refers to a particular type of design between an enterprise and the Internet in which only one ISP is used with a single link to that ISP. + +single multihomed Refers to a particular type of design between an enterprise and the Internet in which more than one ISP is used with one link to each ISP. + +site prefix In IPv6, the prefix that describes a public globally unique IPv6 address block that has been assigned to an end-user organization (for example, an enterprise or government agency). An ISP or Internet registry typically makes the assignment. +SLA Operation A configuration construct used by the IP SLA feature inside router Cisco IOS that defines a type of packet to be sent, plus a set of measurements to be made about the packet. (Did a reply occur? What delay occurred, jitter, and so on?) +SLSM Static-length subnet mask. The use of the same subnet mask for all subnets of a single Class A, B, or C network. + +Smoothed Round-Trip Time With EIGRP, a purposefully slowly changing measurement of round-trip time between neighbors from which the EIGRP RTO is calculated. + +socket A three-tuple consisting of an IP address, port number, and transport layer proto-col. TCP connections exist between a pair of sockets. + + + +From the Library of Alexey Evseenko +Glossary 29 + +soft reconfiguration A BGP process by which a router reapplies routing policy configu-ration (route maps, filters, and the like) based on stored copies of sent and received BGP Updates. +solicited node multicast In IPv6, an address used in the neighbor discovery (ND) process. The format for these addresses is FF02::1:FF00:0000/104, and each IPv6 host must join the corresponding group for each of its unicast and anycast addresses. +SONA See Service-Oriented Network Architecture. + +SPF calculation The process of running the SPF algorithm against the OSPF LSDB, with the result being the determination of the current best route(s) to each subnet. + +split horizon Instead of advertising all routes out a particular interface, the routing pro-tocol omits the routes whose outgoing interface field matches the interface out which the update would be sent. +SSL See Secure Sockets Layer. + +standard access list A list of IOS global configuration commands that can match only a packet’s source IP address for the purpose of deciding which packets to discard and which to allow through the router. +stateful autoconfiguration A method of obtaining an IPv6 address that uses DHCPv6. See also Stateless Address Autoconfiguration. + +stateful DHCPv6 A term used in IPv6 to contrast with stateless DHCP. Stateful DHCP keeps track of which clients have been assigned which IPv6 addresses (state information). + +Stateless Address Autoconfiguration (SLAAC) A method used by an IPv6 host to determine its own IP address, without DHCPv6, by using Neighbor Discovery Protocol (NDP) and the modified EUI-64 address format. See also stateful autoconfiguration. +stateless DHCPv6 A term used in IPv6 to contrast with stateful DHCP. Stateless DHCP servers don’t lease IPv6 addresses to clients. Instead, they supply other useful information, such as DNS server IP addresses, but with no need to track information about the clients (state information). +static default route A default route configured in Cisco IOS using the ip route command. + +static length subnet masking A strategy for subnetting a classful network for which all masks/prefixes are the same value for all subnets of that one classful network. + +Static NAT (SNAT) A version of Network Address Translation (NAT) where there is a static assignment of an inside global address to an inside local address. + +stub area An OSPF area into which external (Type 5) LSAs are not introduced by its ABRs; instead, the ABRs originate and inject default routes into the area. + +stub network (OSPF) A network/subnet to which only one OSPF router is connected. + +stub router (EIGRP) A router that should not be used to forward packets between other routers. Other routers will not send Query messages to a stub router. + + + + + +From the Library of Alexey Evseenko +30 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +stub router (OSPF) A router that should either permanently or temporarily not be used as a transit router. Can wait a certain time after OSPF process starts, or after BGP notifies OSPF that BGP has converged, before ceasing to be a stub router. +stubby area The same as stub area. See stub area. + +stuck-in-active The condition in which a route has been in an EIGRP active state for lon-ger than the router’s Active timer. + +subinterface One of the virtual interfaces on a single physical interface. + +subnet A subdivision of a Class A, B, or C network, as configured by a network adminis-trator. Subnets enable a single Class A, B, or C network to be used and still allow for a large number of groups of IP addresses, as is required for efficient IP routing. +subnet broadcast address A single address in each subnet for which packets sent to this address will be broadcast to all hosts in the subnet. It is the highest numeric value in the range of IP addresses implied by a subnet number and prefix/mask. +subnet prefix In IPv6, a term for the prefix that is assigned to each data link, acting like a subnet in IPv4. + +subnet zero When subnetting a Class A, B, or C address, the subnet for which all subnet bits are binary 0. + +subordinate route A term used in this book to refer to routes whose address ranges sit inside a large range that is advertised as a summary route. + +successor In EIGRP, the route to reach a subnet that has the best metric and should be placed in the IP routing table. + +successor route With EIGRP, the route to each destination for which the metric is the lowest of all known routes to that network. + +Summary LSA In OSPF, a Type 3 LSA. See Type 3 LSA. + +summary route A route that is created to represent one or more smaller component routes, typically to reduce the size of routing and topology tables. + +sync An abbreviation of synchronization; also, the command that enables BGP synchroni-zation. See synchronization. + +synchronization In BGP, a feature in which BGP routes cannot be considered to be a best route to reach an NLRI unless that same prefix exists in the router’s IP routing table as learned via some IGP. +synchronous The imposition of time ordering on a bit stream. Practically, a device tries to use the same speed as another device on the other end of a serial link. However, by examin-ing transitions between voltage states on the link, the device can notice slight variations in the speed on each end and can adjust its speed accordingly. +time-based ACL An access control list that can permit or deny defined traffic based on time-of-day and day-of-week. + + + + + +From the Library of Alexey Evseenko +Glossary 31 + +Time-To-Live (TTL) A field in the IP header that is decremented at each pass through a Layer 3 forwarding device. + +topology database The structured data that describes the network topology to a routing protocol. Link-state and balanced hybrid routing protocols use topology tables, from which they build the entries in the routing table. +ToS Byte See Type of Service (ToS) Byte. + +totally NSSA area A type of OSPF NSSA area for which neither external (Type 5) LSAs are introduced nor Type 3 summary LSAs; instead, the ABRs originate and inject default routes into the area. External routes can be injected into a totally NSSA area. +totally stubby area A type of OSPF stub area for which neither external (Type 5) LSAs are introduced nor Type 3 summary LSAs; instead, the ABRs originate and inject default routes into the area. External routes cannot be injected into a totally stubby area. +tracking object A concept in Cisco IOS that analyzes different conditions on a router that results in the object’s state being either up or down. IOS can then use different features, or not use different features, based on the current state of the tracking object. (In this book, tracking objects watch IP SLA operations and influence static routes and policy-based routing.) +transit area The area over which an OSPF virtual link’s messages flow. + +transit AS With BGP, an AS that receives packets from one neighboring AS and forwards the packet to yet another AS. An enterprise typically does not want to be a transit AS. + +transit network (OSPF) A network/subnet over which two or more OSPF routers have become neighbors, thereby able to forward packets from one router to another across that network. +transit router (OSPF) A router that is allowed to receive a packet from an OSPF router and then forward the packet to another OSPF router. + +Transitive PA A description of a BGP PA, meaning that the PA can and should transit over multiple ASNs. + +triggered updates A routing protocol feature for which the routing protocol sends rout-ing updates immediately upon hearing about a changed route, even though it may normally only send updates on a regular update interval. +TTL See Time-To-Live. + +tunnel A method of taking one packet and encapsulating it in another packet so that the original encapsulated packet can be delivered across another network—in some cases across networks through which the original packet could not have been forwarded. The tunnel might simply provide for packet delivery, and it might add other services, such as encryption and authentication. +tunnel interface In Cisco IOS, a software interface used as a configuration construct to configure a tunnel. + +tunneling The process of using a tunnel. See tunnel. + + + + +From the Library of Alexey Evseenko +32 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +two-way redistribution With route redistribution, the process of redistributing routes from one routing protocol into a second routing protocol and vice versa. + +two-way state In OSPF, a neighbor state that implies that the router has exchanged Hellos with the neighbor and all required parameters match. + +Type 1 LSA An OSPF LSA type that describes a router. It lists the router’s OSPF ID, its interfaces, their states, and the link-state IDs of neighboring LSAs. + +Type 2 LSA An OSPF LSA type that describes a multiaccess network on which a DR has been elected and for which at least one other router connects. The LSA represents the sub-net. Also called a network LSA. +Type 3 LSA An OSPF LSA type that describes a subnet in another area. Also called a sum-mary LSA. + +Type 3 LSA Filtering The process of causing an ABR to not create and flood a Type 3 LSA into another area. + +Type 4 Summary ASBR LSA An LSA type used to describe an ASBR and the cost to reach that ASBR for the purpose of allowing routers to determine the OSPF cost to reach an external subnet advertised as a Type 5 or Type 7 LSA. Also called an ASBR summary LSA. +Type 5 External LSA An LSA type that describes an external subnet as advertised into OSPF by an ASBR. Also called an external LSA. + +Type 7 AS External LSA An LSA type that describes an external subnet as injected into an NSSA area. + +Type of Service (ToS) Byte A 1-byte field in the IP header, originally defined by RFC 791 for QoS marking purposes. + +U/L bit The second most significant bit in the most significant byte of an Ethernet MAC address. A value of binary 0 implies that the address is a Universally Administered Address (UAA) (also known as Burned-In Address [BIA]), and a value of binary 1 implies that the MAC address is a locally configured address. +unequal-cost load balancing A feature of EIGRP in which EIGRP includes multiple routes for the same prefix in the IP routing table but with IOS forwarding packets propor-tionally based on the calculated integer metric for each route. +unicast MAC address Ethernet MAC address that represents a single NIC or interface. + +Unicast Reverse Path Forwarding (uRPF) A Cisco IOS feature that enables an interface to check the source IP address of an arriving packet and permit or deny that packet based on whether that IP address is reachable, based on the router’s FIB (and optionally based on whether the egress interface to get back to that source IP address is the same interface on which it is arriving). +unique local address A type of IPv6 unicast address meant as a replacement for IPv4 pri-vate addresses. + +Update (EIGRP) An EIGRP message that informs neighbors about routing information. Update messages require an Ack. + + + + +From the Library of Alexey Evseenko +Glossary 33 + +Update Source (BGP) In BGP, a reference to the IP address used as the source address of packets that hold BGP messages. The Update source can differ from neighbor to neighbor and is important in that a BGP router may set a route’s NEXT_HOP PA to its Update Source IP address. +update timer The time interval that regulates how often a routing protocol sends its next periodic routing updates. Distance-vector routing protocols send full routing updates every update interval. +variable-length subnet masking A strategy for subnetting a classful network for which masks/prefixes are different for some subnets of that one classful network. + +variance An integer setting for EIGRP. Any FS route whose metric is less than this variance multiplier times the successor’s metric is added to the routing table, within the restrictions of the maximum-paths command. +virtual circuit A logical concept that represents the path over which frames travel between DTEs. VCs are particularly useful when comparing Frame Relay to leased physical circuits. + +virtual link With OSPF, the encapsulation of OSPF messages inside IP to a router with which no common subnet is shared for the purpose of either mending partitioned areas or providing a connection from some remote area to the backbone area. +virtual private LAN service (VPLS) Ethernet-like service that provides connectivity between two or more endpoints, typically using Ethernet over MPLS (EoMPLS) technology. + +virtual private network (VPN) A set of security protocols that, when implemented by two devices on either side of an unsecure network such as the Internet, can enable the devic-es to send data securely. VPNs provide privacy, device authentication, antireplay services, and data integrity services. +virtual private wire service (VPWS) Ethernet-like service that provides connectivity between exactly two endpoints, typically using Ethernet over MPLS (EoMPLS) technology. + +virtual routing and forwarding (VRF) A technology that enables a single physical router to run multiple virtual router instances. + +VLSM Variable-Length Subnet Mask(ing). The ability to specify a different subnet mask for the same Class A, B, or C network number on different subnets. VLSM can help optimize available address space. +VoIP Voice over IP. The transport of voice traffic inside IP packets over an IP network. + +VPN See virtual private network. + +VPN client Software that resides on a PC, often a laptop, so that the host can implement the protocols required to be an endpoint of a VPN. + +VRF-Lite A traditional approach to configuring Virtual Routing and Forwarding (VRF) on Cisco routers. + +WAN Edge Same as Enterprise Edge. See Enterprise Edge. + +weight A local Cisco-proprietary BGP setting that is not advertised to any peers. A larger value is considered to be better. + + + +From the Library of Alexey Evseenko +34 CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + +well-known discretionary A characterization of a BGP path attribute in which all BGP implementations must support and understand the attribute (well known), but BGP Updates can either include the attribute or not, depending on whether a related feature has been con-figured (discretionary). +well-known mandatory A characterization of a BGP path attribute in which all BGP implementations must support and understand the attribute (well known), and all BGP Updates must include the attribute (mandatory). +well-known PA See well-known discretionary and well-known mandatory. + +zero subnet For every classful IPv4 network that is subnetted, the one subnet whose sub-net number has all binary 0s in the subnet part of the number. In decimal, the 0 subnet can be easily identified because it is the same number as the classful network number. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Alexey Evseenko + + +Where are the companion content files? + +Thank you for purchasing this Premium Edition version of +CCNP Routing and Switching ROUTE 300-101 Official Cert Guide + + + +The print version of this title comes with a disc of companion content. +As an eBook reader, you have access to these files by following the steps below: + +1. Go to ciscopress.com/account and log in. + +2. Click on the “Access Bonus Content” link in the Registered Products section of your account page for this product, to be taken to the page where your +downloadable content is available. + + +Please note that many of our companion content files can be very large, especially image and video files. + +If you are unable to locate the files for this title by following the steps +at left, please visit ciscopress.com/ contact and select the “Site Problems/ Comments” option. Our customer +service representatives will assist you. + + + + + + + + + +The Professional and Personal Technology Brands of Pearson + + + + + + + +From the Library of Alexey Evseenko diff --git a/CCNP Routing and Switching SWITCH 300-115 Official Cert Guide conv.txt b/CCNP Routing and Switching SWITCH 300-115 Official Cert Guide conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..670e4c3fd1e4c9376c7402bf180f33120103b94a --- /dev/null +++ b/CCNP Routing and Switching SWITCH 300-115 Official Cert Guide conv.txt @@ -0,0 +1,29856 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +CCNP Routing and Switching SWITCH 300-115 +Official Cert Guide + + +David Hucaby, CCIE No. 4594 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Cisco Press 800 East 96th Street +Indianapolis, IN 46240 + + +www.allitebooks.com From the Library of Outcast Outcast +ii CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +David Hucaby + +Copyright © 2015 Pearson Education, Inc. + +Published by: Cisco Press +800 East 96th Street Indianapolis, IN 46240 USA + +All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review. + +Printed in the United States of America + +First Printing: November 2014 + +Library of Congress Control Number: 2014954903 + +ISBN-13: 978-1-58720-560-6 + +ISBN-10: 1-58720-560-2 + + +Warning and Disclaimer +This book is designed to provide information about the Cisco CCNP SWITCH exam (300-115). Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fit-ness is implied. + +The information is provided on an “as is” basis. The authors, Cisco Press, and Cisco Systems, Inc. shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accompany it. + +The opinions expressed in this book belong to the author and are not necessarily those of Cisco Systems, Inc. + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +iii + +Trademark Acknowledgments +All terms mentioned in this book that are known to be trademarks or service marks have been appropri-ately capitalized. Cisco Press or Cisco Systems, Inc., cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. + +Special Sales +For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@pearsoned.com or (800) 382-3419. + +For government sales inquiries, please contact governmentsales@pearsoned.com. + +For questions about sales outside the U.S., please contact international@pearsoned.com. + + +Feedback Information +At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community. + +Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve the quality of this book, or otherwise alter it to better suit your needs, you can contact us through email at feedback@ciscopress.com. Please make sure to include the book title and ISBN in your message. + + +We greatly appreciate your assistance. + +Publisher: Paul Boger + +Associate Publisher: Dave Dusthimer + +Business Operation Manager, Cisco Press: Jan Cornelssen + +Executive Editor: Brett Bartow + +Managing Editor: Sandra Schroeder + +Senior Development Editor: Christopher Cleveland + + +Project Editor: Seth Kerney + +Copy Editor: Keith Cline + +Technical Editors: Joe Harris, Geoff Tagg + +Editorial Assistant: Vanessa Evans + +Book Designer: Mark Shirar + +Composition: Bronkella Publishing + +Indexer: Johnna Vanhoose Dinse + +Proofreader: Debbie Williams + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +iv CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +About the Author + +David Hucaby, CCIE No. 4594, is a lead network engineer for the University of Kentucky, where he works with a large healthcare network based on the Cisco product lines. David holds bachelor’s and master’s degrees in electrical engineering from the University of Kentucky. He is the author of several Cisco Press titles, including CCNA Wireless Cert Guide, Cisco ASA, PIX, and FWSM Firewall Handbook, Second Edition; Cisco Firewall Video Mentor; and Cisco LAN Switching Video Mentor. David lives in Kentucky with his wife, Marci, and two daughters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +v + +About the Technical Reviewers + +Joe Harris, CCIE No. 6200 (R/S, Security & SP), is a triple CCIE working for Cisco as a Consulting Systems Engineer with their SP organization, where he specializes in security and data center technologies. With more than 16 years of extensive experience focus-ing on advanced technologies within the IP arena, Joe has been primarily focused on supporting some of Cisco’s large service provider accounts, in addition to local govern-ment and federal agencies. Joe holds a bachelor of science degree from Louisiana Tech University and resides with his wife and two children in Frisco, Texas. + +Geoff Tagg is based in Oxford in the United Kingdom, where he runs a networking consulting business. Geoff has worked with clients ranging from small UK businesses to large multinationals and service providers for many years, combining implementa-tion with onsite training. He is currently working with a large international organization in Italy, but is also a course author for Learning Tree International and Professor of Networking at Oxford Brookes University. Over the past 30 years, Geoff has worked +with most major networking technologies, developing a specific expertise in secure, con-verged network infrastructures based largely on Cisco hardware. Before that, he accumu-lated 15 years in systems programming and operations management. Geoff lives with his wife Christine, and family, where he finds the combination of work, family, and garden a continuing, but exciting, challenge. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +vi CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Dedications + +As always, this book is dedicated to the most important people in my life: my wife, Marci, and my two daughters, Lauren and Kara. Their love, encouragement, and sup-port carry me along. I’m so grateful to God, who gives endurance and encouragement (Romans 15:5), and who has allowed me to work on projects like this. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +vii + +Acknowledgments + +It has been my great pleasure to work on another Cisco Press project. I enjoy the net-working field very much, and technical writing even more. And more than that, I’m thankful for the joy and inner peace that Jesus Christ gives, making everything more abundant. + +Technical writing may be hard work, but I’m finding that it’s also quite fun because I’m working with very good friends at Cisco Press. Even after nearly 15 years, I still get to work with Brett Bartow and Chris Cleveland, the finest editors I know. + +I am very grateful for the insight, suggestions, and helpful comments that Geoff Tagg and Joe Harris contributed. Their knowledge and attention to detail helped make this a more well-rounded book and me a more educated author. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +viii CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Contents at a Glance + +Introduction xxiv + +Part I Designing Campus Networks + +Chapter 1 Enterprise Campus Network Design 3 + +Chapter 2 Switch Operation 29 + +Chapter 3 Switch Port Configuration 55 + +Part II Building a Campus Network + +Chapter 4 VLANs and Trunks 89 + +Chapter 5 VLAN Trunking Protocol 123 + +Part III Working with Redundant Links + +Chapter 6 Traditional Spanning Tree Protocol 147 + +Chapter 7 Spanning-Tree Configuration 177 + +Chapter 8 Protecting the Spanning Tree Protocol Topology 203 + +Chapter 9 Advanced Spanning Tree Protocol 219 + +Chapter 10 Aggregating Switch Links 241 + +Part IV Multilayer Switching + +Chapter 11 Multilayer Switching 265 + +Chapter 12 Configuring DHCP 289 + +Part V Monitoring Campus Networks + +Chapter 13 Logging Switch Activity 305 + +Chapter 14 Managing Switches with SNMP 321 + +Chapter 15 Monitoring Performance with IP SLA 333 + +Chapter 16 Using Port Mirroring to Monitor Traffic 349 + +Part VI Implementing High Availability + +Chapter 17 Understanding High Availability 365 + +Chapter 18 Layer 3 High Availability 381 + + +www.allitebooks.com From the Library of Outcast Outcast +ix + +Part VII Securing Switched Networks + +Chapter 19 Securing Switch Access 411 + +Chapter 20 Securing VLANs 431 + +Chapter 21 Preventing Spoofing Attacks 449 + + +Chapter 22 + +Part VIII + +Managing Switch Users 461 + +Final Preparation + + + +Chapter 23 + +Part IX + +Final Preparation 475 + +Appendixes + + +Appendix A Answers to the “Do I Know This Already?” Quizzes 481 + +Appendix B Exam Updates 489 + +Glossary 493 + +Index 504 + +CD-Only Appendixes + + +Appendix C + +Appendix D + +Appendix E + +Memory Tables + +Memory Table Answer Key + +Study Planner + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +Contents + +Introduction xxiv + + +Part I + +Chapter 1 + +Designing Campus Networks + +Enterprise Campus Network Design 3 + +“Do I Know This Already?” Quiz 3 Foundation Topics 7 +Hierarchical Network Design 7 Predictable Network Model 9 Access Layer 12 +Distribution Layer 12 Core Layer 12 +Modular Network Design 13 Sizing a Switch Block 16 Switch Block Redundancy 18 Network Core 20 +Collapsed Core 23 +Core Size in a Campus Network 24 +Cisco Products in a Hierarchical Network Design 24 Exam Preparation Tasks 27 +Review All Key Topics 27 +Complete Tables and Lists from Memory 27 Define Key Terms 27 +Chapter 2 Switch Operation 29 +“Do I Know This Already?” Quiz 29 Foundation Topics 32 +Layer 2 Switch Operation 32 Transparent Bridging 32 Follow That Frame! 35 +Multilayer Switch Operation 36 Types of Multilayer Switching 36 Follow That Packet! 37 +Multilayer Switching Exceptions 39 Tables Used in Switching 40 +Content-Addressable Memory 40 +Ternary Content-Addressable Memory 41 TCAM Structure 42 +TCAM Example 43 +Port Operations in TCAM 44 + +From the Library of Outcast Outcast +xi + +Managing Switching Tables 45 CAM Table Operation 45 TCAM Operation 48 +Managing Switching Table Sizes 49 Exam Preparation Tasks 52 +Review All Key Topics 52 +Complete Tables and Lists from Memory 52 Define Key Terms 52 +Use Command Reference to Check Your Memory 52 + +Chapter 3 Switch Port Configuration 55 “Do I Know This Already?” Quiz 55 Foundation Topics 59 +Ethernet Concepts 59 Ethernet Overview 59 Scaling Ethernet 60 Fast Ethernet 60 Gigabit Ethernet 61 +10-Gigabit Ethernet 62 +Beyond 10-Gigabit Ethernet 63 +Duplex Operation over Ethernet Links 63 Connecting Switches and Devices 65 +Ethernet Port Cables and Connectors 65 Switch Port Configuration 66 +Selecting Ports to Configure 66 Identifying Ports 68 +Port Speed 68 +Port Duplex Mode 69 +Managing Error Conditions on a Switch Port 69 Detecting Error Conditions 69 +Automatically Recover from Error Conditions 70 Enable and Use the Switch Port 71 Troubleshooting Port Connectivity 71 +Looking for the Port State 71 +Looking for Speed and Duplex Mismatches 72 Discovering Connected Devices 73 +Cisco Discovery Protocol 73 +Link Layer Discovery Protocol 75 + + + +From the Library of Outcast Outcast +xii CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Using Power over Ethernet 77 How PoE Works 78 +Detecting a Powered Device 79 Configuring PoE 80 +Verifying PoE 81 +Exam Preparation Tasks 84 Review All Key Topics 84 +Complete Tables and Lists from Memory 84 Define Key Terms 84 +Use Command Reference to Check Your Memory 85 + +Part II Building a Campus Network + +Chapter 4 VLANs and Trunks 89 +“Do I Know This Already?” Quiz 89 Foundation Topics 95 +Virtual LANs 95 +VLAN Membership 96 Static VLANs 96 +Configuring Static VLANs 97 Dynamic VLANs 99 Deploying VLANs 99 +End-to-End VLANs 100 Local VLANs 101 +VLAN Trunks 101 +VLAN Frame Identification 103 Inter-Switch Link Protocol 103 IEEE 802.1Q Protocol 104 Dynamic Trunking Protocol 105 +VLAN Trunk Configuration 106 Configuring a VLAN Trunk 106 Trunk Configuration Example 108 +Troubleshooting VLANs and Trunks 110 Voice VLANs 112 +Voice VLAN Configuration 113 Verifying Voice VLAN Operation 115 +Wireless VLANs 117 +Exam Preparation Tasks 119 Review All Key Topics 119 + + +From the Library of Outcast Outcast +xiii + +Complete Tables and Lists from Memory 119 Define Key Terms 119 +Use Command Reference to Check Your Memory 119 + +Chapter 5 VLAN Trunking Protocol 123 +“Do I Know This Already?” Quiz 123 Foundation Topics 127 +VLAN Trunking Protocol 127 VTP Domains 127 +VTP Modes 127 +VTP Advertisements 128 VTP Synchronization 131 +VTP Configuration 132 +Configuring the VTP Version 133 Configuring a VTP Management Domain 134 Configuring the VTP Mode 135 +VTP Configuration Example 136 VTP Status 137 +VTP Pruning 138 +Enabling VTP Pruning 140 Troubleshooting VTP 141 Exam Preparation Tasks 143 Review All Key Topics 143 +Complete Tables and Lists from Memory 143 Define Key Terms 143 +Use Command Reference to Check Your Memory 143 + +Part III Working with Redundant Links + +Chapter 6 Traditional Spanning Tree Protocol 147 “Do I Know This Already?” Quiz 147 Foundation Topics 151 +IEEE 802.1D Overview 151 Bridging Loops 151 +Preventing Loops with Spanning Tree Protocol 154 +Spanning-Tree Communication: Bridge Protocol Data Units 155 Electing a Root Bridge 156 +Electing Root Ports 158 Electing Designated Ports 160 + + + +From the Library of Outcast Outcast +xiv CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +STP States 162 STP Timers 165 +Topology Changes 167 +Direct Topology Changes 168 Indirect Topology Changes 169 Insignificant Topology Changes 171 +Types of STP 172 +Common Spanning Tree 173 Per-VLAN Spanning Tree 173 +Per-VLAN Spanning Tree Plus 173 Exam Preparation Tasks 175 +Review All Key Topics 175 +Complete Tables and Lists from Memory 175 Define Key Terms 175 +Chapter 7 Spanning-Tree Configuration 177 “Do I Know This Already?” Quiz 177 Foundation Topics 181 +STP Root Bridge 181 +Root Bridge Placement 181 Root Bridge Configuration 184 Tuning the Root Path Cost 188 Tuning the Port ID 190 +Tuning Spanning-Tree Convergence 191 Modifying STP Timers 191 +Manually Configuring STP Timers 192 Automatically Configuring STP Timers 192 +Redundant Link Convergence 194 PortFast: Access Layer Nodes 194 UplinkFast: Access Layer Uplinks 196 +BackboneFast: Redundant Backbone Paths 197 Monitoring STP 199 +Exam Preparation Tasks 200 Review All Key Topics 200 +Complete Tables and Lists from Memory 200 Define Key Terms 200 +Use Command Reference to Check Your Memory 200 + + + + +From the Library of Outcast Outcast +xv + +Chapter 8 Protecting the Spanning Tree Protocol Topology 203 “Do I Know This Already?” Quiz 203 +Foundation Topics 207 +Protecting Against Unexpected BPDUs 207 Root Guard 207 +BPDU Guard 208 +Protecting Against Sudden Loss of BPDUs 210 Loop Guard 210 +UDLD 211 +Using BPDU Filtering to Disable STP on a Port 213 Troubleshooting STP Protection 214 +Exam Preparation Tasks 215 Review All Key Topics 215 +Complete Tables and Lists from Memory 215 Define Key Terms 215 +Use Command Reference to Check Your Memory 215 + +Chapter 9 Advanced Spanning Tree Protocol 219 “Do I Know This Already?” Quiz 219 Foundation Topics 223 +Rapid Spanning Tree Protocol 223 RSTP Port Behavior 223 BPDUs in RSTP 224 +RSTP Convergence 225 Port Types 226 Synchronization 227 +Topology Changes and RSTP 229 RSTP Configuration 229 +Rapid Per-VLAN Spanning Tree Protocol 230 Multiple Spanning Tree Protocol 231 +MST Overview 233 MST Regions 233 +Spanning-Tree Instances Within MST 234 IST Instances 234 +MST Instances 235 MST Configuration 236 +Exam Preparation Tasks 238 Review All Key Topics 238 + + +From the Library of Outcast Outcast +xvi CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Complete Tables and Lists from Memory 238 Define Key Terms 239 +Use Command Reference to Check Your Memory 239 + +Chapter 10 Aggregating Switch Links 241 “Do I Know This Already?” Quiz 241 Foundation Topics 245 +Switch Port Aggregation with EtherChannel 245 Bundling Ports with EtherChannel 247 Distributing Traffic in EtherChannel 247 Configuring EtherChannel Load Balancing 249 +EtherChannel Negotiation Protocols 251 Port Aggregation Protocol 252 +Link Aggregation Control Protocol 252 EtherChannel Configuration 253 +Configuring a PAgP EtherChannel 253 Configuring a LACP EtherChannel 254 +Avoiding Misconfiguration with EtherChannel Guard 255 Troubleshooting an EtherChannel 257 +Exam Preparation Tasks 261 Review All Key Topics 261 +Complete Tables and Lists from Memory 261 Define Key Terms 261 +Command Reference to Check Your Memory 261 + +Part IV Multilayer Switching + +Chapter 11 Multilayer Switching 265 +“Do I Know This Already?” Quiz 265 Foundation Topics 268 +Inter-VLAN Routing 268 Types of Interfaces 268 +Configuring Inter-VLAN Routing 269 Layer 2 Port Configuration 270 Layer 3 Port Configuration 270 +SVI Port Configuration 271 Multilayer Switching with CEF 272 Traditional MLS Overview 272 CEF Overview 272 +Forwarding Information Base 273 + + +From the Library of Outcast Outcast +xvii + +Adjacency Table 276 Packet Rewrite 279 Configuring CEF 280 +Verifying Multilayer Switching 280 Verifying Inter-VLAN Routing 280 Verifying CEF 283 +Exam Preparation Tasks 285 Review All Key Topics 285 +Complete Tables and Lists from Memory 285 Define Key Terms 285 +Use Command Reference to Check Your Memory 285 + +Chapter 12 Configuring DHCP 289 +“Do I Know This Already?” Quiz 289 Foundation Topics 292 +Using DHCP with a Multilayer Switch 292 Configuring an IPv4 DHCP Server 293 Configuring a Manual Address Binding 294 Configuring DHCP Options 296 Configuring a DHCP Relay 296 +Configuring DHCP to Support IPv6 297 Stateless Autoconfiguration 298 DHCPv6 298 +DHCPv6 Lite 299 +Configuring a DHCPv6 Relay Agent 300 Verifying IPv6 DHCP Operation 300 +Exam Preparation Tasks 301 Review All Key Topics 301 +Complete Tables and Lists from Memory 301 Define Key Terms 301 +Use Command Reference to Check Your Memory 301 + +Part V Monitoring Campus Networks + +Chapter 13 Logging Switch Activity 305 +“Do I Know This Already?” Quiz 305 Foundation Topics 308 + + + + + +From the Library of Outcast Outcast +xviii CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Syslog Messages 308 +Logging to the Switch Console 310 Logging to the Internal Buffer 310 Logging to a Remote Syslog Server 311 +Adding Time Stamps to Syslog Messages 312 Setting the Internal System Clock 312 +Using NTP to Synchronize with an External Time Source 313 Securing NTP 316 +Using SNTP to Synchronize Time 316 +Adding Time Stamps to Logging Messages 317 Exam Preparation Tasks 318 +Review All Key Topics 318 +Complete Tables and Lists from Memory 318 Define Key Terms 318 +Use Command Reference to Check Your Memory 318 + +Chapter 14 Managing Switches with SNMP 321 “Do I Know This Already?” Quiz 321 Foundation Topics 324 +SNMP Overview 324 Configuring SNMP 326 +Configuring SNMPv1 327 Configuring SNMPv2C 327 Configuring SNMPv3 328 +Exam Preparation Tasks 330 Review All Key Topics 330 +Complete Tables and Lists from Memory 330 Define Key Terms 330 +Use Command Reference to Check Your Memory 330 + +Chapter 15 Monitoring Performance with IP SLA 333 “Do I Know This Already?” Quiz 333 Foundation Topics 336 +IP SLA Overview 336 Configuring IP SLA 338 Using IP SLA 341 +Exam Preparation Tasks 345 Review All Key Topics 345 +Complete Tables and Lists from Memory 345 + + +From the Library of Outcast Outcast +xix + +Define Key Terms 345 +Use Command Reference to Check Your Memory 345 + +Chapter 16 Using Port Mirroring to Monitor Traffic 349 “Do I Know This Already?” Quiz 349 Foundation Topics 352 +Using Local SPAN 352 +Local SPAN Configuration 354 Remote SPAN 356 +Remote SPAN Configuration 357 Managing SPAN Sessions 359 +Exam Preparation Tasks 361 Review All Key Topics 361 +Complete Tables and Lists from Memory 361 Define Key Terms 361 +Use Command Reference to Check Your Memory 361 + +Part VI Implementing High Availability + +Chapter 17 Understanding High Availability 365 “Do I Know This Already?” Quiz 365 Foundation Topics 368 +Leveraging Logical Switches 368 StackWise 371 +Virtual Switching System 372 +Supervisor and Route Processor Redundancy 373 Redundant Switch Supervisors 373 Configuring the Redundancy Mode 374 Configuring Supervisor Synchronization 376 Nonstop Forwarding 377 +Exam Preparation Tasks 378 Review All Key Topics 378 +Complete Tables and Lists from Memory 378 Define Key Terms 378 +Use Command Reference to Check Your Memory 378 + +Chapter 18 Layer 3 High Availability 381 +“Do I Know This Already?” Quiz 381 Foundation Topics 384 +Packet-Forwarding Review 384 + + +www.allitebooks.com From the Library of Outcast Outcast +xx CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Hot Standby Router Protocol 385 HSRP Router Election 386 +Plain-Text HSRP Authentication 388 MD5 Authentication 388 Conceding the Election 389 +HSRP Gateway Addressing 390 Load Balancing with HSRP 391 +Virtual Router Redundancy Protocol 394 Gateway Load Balancing Protocol 397 +Active Virtual Gateway 397 Active Virtual Forwarder 398 GLBP Load Balancing 400 Enabling GLBP 400 +Verifying Gateway Redundancy 405 Exam Preparation Tasks 406 +Review All Key Topics 406 +Complete Tables and Lists from Memory 406 Define Key Terms 406 +Use Command Reference to Check Your Memory 406 + +Part VII Securing Switched Networks + +Chapter 19 Securing Switch Access 411 +“Do I Know This Already?” Quiz 411 Foundation Topics 415 +Port Security 415 +Port-Based Authentication 418 802.1X Configuration 419 +802.1X Port-Based Authentication Example 420 Using Storm Control 421 +Best Practices for Securing Switches 423 Exam Preparation Tasks 428 +Review All Key Topics 428 +Complete Tables and Lists from Memory 428 Define Key Terms 428 +Use Command Reference to Check Your Memory 428 + + + + + + +From the Library of Outcast Outcast +xxi + +Chapter 20 Securing VLANs 431 +“Do I Know This Already?” Quiz 431 Foundation Topics 435 +VLAN Access Lists 435 VACL Configuration 435 +Private VLANs 436 +Private VLAN Configuration 438 Configure the Private VLANs 438 Associate Ports with Private VLANs 439 +Associate Secondary VLANs to a Primary VLAN SVI 440 Securing VLAN Trunks 441 +Switch Spoofing 441 VLAN Hopping 443 +Exam Preparation Tasks 446 Review All Key Topics 446 +Complete Tables and Lists from Memory 446 Define Key Terms 446 +Use Command Reference to Check Your Memory 446 + +Chapter 21 Preventing Spoofing Attacks 449 “Do I Know This Already?” Quiz 449 Foundation Topics 451 +DHCP Snooping 451 IP Source Guard 453 +Dynamic ARP Inspection 455 Exam Preparation Tasks 458 Review All Key Topics 458 +Complete Tables and Lists from Memory 458 Define Key Terms 458 +Use Command Reference to Check Your Memory 458 + +Chapter 22 Managing Switch Users 461 +“Do I Know This Already?” Quiz 461 Foundation Topics 464 +Configuring Authentication 465 Configuring Authorization 468 Configuring Accounting 469 Exam Preparation Tasks 471 + + + +From the Library of Outcast Outcast +xxii CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Review All Key Topics 471 +Complete Tables and Lists from Memory 471 Define Key Terms 471 +Use Command Reference to Check Your Memory 471 + +Part VIII Final Preparation + +Chapter 23 Final Preparation 475 +Tools for Final Preparation 475 +Exam Engine and Questions on the CD 475 Install the Exam Engine 476 +Activate and Download the Practice Exam 476 Activating Other Exams 477 +Premium Edition 477 +The Cisco Learning Network 477 Memory Tables 477 +Chapter-Ending Review Tools 478 Study Plan 478 +Recall the Facts 478 Practice Configurations 478 Using the Exam Engine 479 +Part IX Appendixes + +Appendix A Answers to the “Do I Know This Already?” Quizzes 481 + +Appendix B Exam Updates 489 +Always Get the Latest at the Companion Website 489 Technical Content 490 +Glossary 493 + +Index 504 + + +CD-Only Appendixes + + +Appendix C + +Appendix D + +Appendix E + +Memory Tables + +Memory Table Answer Key + +Study Planner + + + + + + + +From the Library of Outcast Outcast +xxiii + +Command Syntax Conventions + +The conventions used to present command syntax in this book are the same conventions used in the IOS Command Reference. The Command Reference describes these conven-tions as follows: + +■ Boldface indicates commands and keywords that are entered literally as shown. In actual configuration examples and output (not general command syntax), boldface indicates commands that are manually input by the user (such as a show command). + +■ Italic indicates arguments for which you supply actual values. + +■ Vertical bars (|) separate alternative, mutually exclusive elements. + +■ Square brackets ([ ]) indicate an optional element. + +■ Braces ({ }) indicate a required choice. + +■ Braces within brackets ([{ }]) indicate a required choice within an optional element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +xxiv CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Introduction + +This book focuses on one major goal: to help you prepare to pass the SWITCH exam (300-115). To help you prepare, this book achieves other useful goals as well: It explains a wide range of networking topics, shows how to configure those features on Cisco switches, and explains how to determine whether the features are working. As a result, you can also use this book as a general reference as you work with switched networks in your job. The main motivation for this book and the Cisco Press Certification Guide series is to help you pass the SWITCH exam. + +The rest of this introduction focuses on two topics: the SWITCH exam and a description of this book. + +The CCNP SWITCH Exam + +Professional certifications have been an important part of the computing industry for many years and will continue to become more important. Many reasons exist for these certifications, but the most popularly cited reason is that of credibility. All other consid-erations held equal, the certified employee/consultant/job candidate is considered more valuable than one who is not. + +Cisco offers four levels of routing and switching certification, each with an increasing level of proficiency: Entry, Associate, Professional, and Expert. These are commonly known by their acronyms CCENT (Cisco Certified Entry Networking Technician), CCNA (Cisco Certified Network Associate), CCNP (Cisco Certified Network Professional), and CCIE (Cisco Certified Internetworking Expert). There are others, too, but this book focuses on the certifications for enterprise networks. + +Cisco first announced its initial Professional level certifications in 1998 with the CCNP Routing and Switching certification. To become certified, you must pass exams on a series of CCNP topics, including the SWITCH, ROUTE, and TSHOOT exams. For most exams, Cisco does not publish the scores needed for passing. You need to take the exam to find that out for yourself. + +To see the most current requirements for the CCNP Routing and Switching certifica-tion, go to http://www.cisco.com/go/ccnp, and look for the 300-115 SWITCH exam (Implementing IP Switched Networks, SWITCH v2.0). There you can find out other exam details such as an exam blueprint, which contains a list of exam topics. You will also learn how to register for an exam. + +Also, you can go to the Cisco Learning Network website at http://www.cisco.com/go/ learnnetspace to find exam information, learning tools, and forums in which you can communicate with others and learn more about this and other Cisco exams. + +The SWITCH exam topics are grouped into three broad categories: + +■ Layer 2 Technologies + +■ Infrastructure Security + +■ Infrastructure Services + + + +From the Library of Outcast Outcast +xxv + +Table I-1 lists the exam topics, along with the part of this book where the topic is cov-ered. The list of topics is accurate, as of the time this book was printed. + +Table I-1 SWITCH Exam 300-115 Topics + + +Exam Topic +Layer 2 Technologies + +Configure and Verify Switch Administration + +Configure and Verify Layer 2 Protocols + +Configure and Verify VLANs + +Configure and Verify Trunking + +Configure and Verify EtherChannels + +Configure and Verify Spanning Tree + +Configure and Verify Other LAN Switching Technologies + +Describe Chassis Virtualization and Aggregation Technologies + +Infrastructure Security + +Configure and Verify Switch Security Features + +Describe Device Security Using Cisco IOS AAA with TACACS+ and RADIUS + +Infrastructure Services + +Configure and Verify First-Hop Redundancy Protocols + +Book Part + + +I + +I, III + +II + +II + +III + +III + +V + +VI + + +VII + +VII + + +VI + + + + +How to Take the SWITCH Exam + +As of the publication of this book, Cisco exclusively uses testing vendor Pearson Vue (http://www.vue.com) for delivery of all Cisco career certification exams. To register, go to http://www.vue.com, establish a login, and register for the 300-115 SWITCH exam. You also need to choose a testing center near your home. + +Format of the CCNP SWITCH Exam + +The SWITCH exam follows the same general format as the other Cisco exams. When you get to the testing center and check in, the proctor will give you some general instructions and then take you into a quiet room with a PC. When you’re at the PC, you have a few things to do before the timer starts on your exam. For instance, you can take a sample quiz, just to get accustomed to the PC and to the testing engine. + +When you start the exam, you will be asked a series of questions. Answer a question, and then move on to the next question. The exam engine does not let you go back and change the answers you entered on previous questions. + + + +From the Library of Outcast Outcast +xxvi CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The exam questions can be in any of the following formats: + +■ Multiple choice (MC) + +■ Testlet + +■ Drag-and-drop (DND) + +■ Simulated lab (sim) + +■ Simlet + +The first three types of questions are relatively common in many testing environments. The MC format simply requires that you point and click on a circle (that is, a radio but-ton) beside the correct answer for a single-answer question or on squares (that is, check boxes) beside the correct answers for a multi-answer question. Cisco traditionally tells you how many answers you need to choose, and the testing software prevents you from choosing too many answers. Testlets are questions with one general scenario, with mul-tiple MC questions about the overall scenario. DND questions require you to left-click and hold a mouse button, move an object (for example, a text box) to another area on the screen, and release the mouse button to place the object somewhere else-typically into a list. For some questions, as an example, you might need to put a list of five things into the proper order to get the whole question correct. + +The last two types both use a network simulator to ask questions. Interestingly, the two types actually allow Cisco to assess two very different skills. First, sim questions gener-ally describe a problem, and your task is to configure one or more routers/switches to fix the problem. The exam then grades the question based on the configuration you changed or added. The simlet questions may well be the most difficult style of question on the exams. Simlet questions also use a network simulator, but instead of answering the question by changing the configuration, the question includes one or more multiple choice questions. The questions require that you use the simulator to examine the cur-rent behavior of a network, interpreting the output of any show commands that you can remember to answer the question. Although sim questions require you to troubleshoot problems related to a configuration, simlets require you to both analyze working net-works and networks with problems, correlating show command output with your knowl-edge of networking theory and configuration commands. + +The Cisco Learning Network (http://learningnetwork.cisco.com) website has tools that let you experience the environment and see how each of these question types work. The environment should be the same as when you passed CCNA (a prerequisite for CCNP and CCDP). + +CCNP SWITCH 300-115 Official Certification Guide + +The most important and somewhat obvious objective of this book is to help you pass the Cisco CCNP SWITCH exam (Exam 300-115). While you are learning about topics that can help you pass the SWITCH exam, you will also become much more knowledgeable about how to do your job. Although this book and the accompanying CD have many + + + + +From the Library of Outcast Outcast +xxvii + +exam preparation tasks and example test questions, the method in which they are used is not to simply make you memorize as many questions and answers as you possibly can. + +The methodology of this book helps you discover the exam topics about which you need more review, fully understand and remember exam topic details, and prove to yourself that you have retained your knowledge of those topics. So this book helps you pass not by memorization, but by helping you truly learn and understand the topics. The SWITCH exam is just one of the foundation topics in the CCNP Routing and Switching certification, and the knowledge contained within is vitally important to consider your-self a truly skilled routing and switching engineer or specialist. + +The strategy you use to prepare for the SWITCH exam might differ slightly from strate-gies used by other readers, mainly based on the skills, knowledge, and experience you already have obtained. For instance, if you have attended the SWITCH course, you might take a different approach than someone who learned switching through on-the-job training. Regardless of the strategy you use or the background you have, this book is designed to help you get to the point where you can pass the exam with the least amount of time required. + +Book Features and Exam Preparation Methods + +This book uses several key methodologies to help you discover the exam topics on which you need more review, to help you fully understand and remember those details, and to help you prove to yourself that you have retained your knowledge of those topics. + +The book includes many features that provide different ways to study and prepare your-self for the exam. If you understand a topic when you read it, but do not study it any further, you will probably not be ready to pass the exam with confidence. The features included in this book give you tools that help you determine what you know, review what you know, better learn what you don’t know, and be well prepared for the exam. These tools include the following: + +■ “Do I Know This Already?” quizzes: Each chapter begins with a quiz that helps you determine the amount of time you need to spend studying that chapter. + +■ Foundation topics: These are the core sections of each chapter. They explain the protocols, concepts, and configuration for the topics in that chapter. + +■ Exam preparation tasks: The “Exam Preparation Tasks” section lists a series of study activities that should be done after reading the “Foundation Topics” section. Each chapter includes the activities that make the most sense for studying the topics in that chapter. The activities include the following: + + +■ +Key Topic + +Key Topics Review: The Key Topic icon is shown next to the most important items in the “Foundation Topics” section of the chapter. The Key Topics Review activity lists the key topics from the chapter, and page number. Although the contents of the entire chapter could be on the exam, you should definitely know +the information listed in each key topic. Review these topics carefully. + + + + +From the Library of Outcast Outcast +xxviii CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Memory tables: To help you exercise your memory and memorize some lists of facts, many of the more important lists and tables from the chapter are included in a document on the CD. This document lists only partial information, allow-ing you to complete the table or list. CD-only Appendix C holds the incomplete tables, and Appendix D includes the completed tables from which you can check your work. +■ Definition of key terms: Although Cisco exams might be unlikely to ask a question such as “Define this term,” the SWITCH exam requires that you learn and know a lot of networking terminology. This section lists some of the most important terms from the chapter, asking you to write a short definition and compare your answer to the glossary on the enclosed CD. +■ CD-based practice exam: The companion CD contains an exam engine, including a bank of multiple-choice questions. You can use the practice exams to get a feel for the actual exam content and to gauge your knowledge of switching topics. + +How This Book is Organized + +Although this book can be read cover to cover, it is designed to be flexible and allow you to easily move between chapters and sections of chapters to focus on specific mate-rial. The chapters can be covered in any order, although some chapters are related and build upon each other. If you do intend to read them all, the order in the book is an excellent sequence to use. + +This book contains 23 chapters, plus appendixes. The book organizes switching top-ics into nine major parts. The following list outlines the major part organization of this book. + +■ Part I: Designing Campus Networks + +■ Chapter 1, “Enterprise Campus Network Design”: This chapter covers different campus network models, hierarchical network design, and how to design, size, and scale a campus network using a modular approach. +■ Chapter 2, “Switch Operation”: This chapter covers Layer 2 and multilayer switch operation, how various content-addressable memory (CAM) and ternary content-addressable memory (TCAM) tables are used to make switching deci-sions, and how to monitor these tables to aid in troubleshooting. +■ Chapter 3, “Switch Port Configuration”: This chapter covers basic Ethernet concepts, how to use scalable Ethernet, how to connect switches and devices together, and how to verify switch port operation to aid in troubleshooting. +■ Part II: Building a Campus Network + +■ Chapter 4, “VLANs and Trunks”: This chapter covers basic VLAN concepts, how to transport multiple VLANs over single links, how to configure VLAN trunks, and how to verify VLAN and trunk operation. +■ Chapter 5, “VLAN Trunking Protocol”: This chapter covers VLAN management using VTP, VTP configuration, traffic management through VTP pruning, and how to verify VTP operation. + + +From the Library of Outcast Outcast +xxix + +■ Part III: Working with Redundant Links +■ Chapter 6, “Traditional Spanning Tree Protocol”: This chapter covers IEEE 802.1D Spanning Tree Protocol (STP) and gives an overview of the other STP types that might be running on a switch. +■ Chapter 7, “Spanning-Tree Configuration”: This chapter covers the STP root bridge, how to customize the STP topology, how to tune STP convergence, redundant link convergence, and how to verify STP operation. +■ Chapter 8, “Protecting the Spanning Tree Protocol Topology”: This chapter covers protecting the STP topology using Root Guard, BPDU Guard, and Loop Guard, and also how to use BPDU filtering and how to verify that these STP protection mechanisms are functioning properly. +■ Chapter 9, “Advanced Spanning Tree Protocol”: This chapter covers Rapid Spanning Tree Protocol (RSTP) for Rapid PVST+ and Multiple Spanning Tree (MST) Protocol. +■ Chapter 10, “Aggregating Switch Links”: This chapter covers switch port ag-gregation with EtherChannel, EtherChannel negotiation protocols, EtherChannel configuration, and how to verify EtherChannel operation. +■ Part IV: Multilayer Switching +■ Chapter 11, “Multilayer Switching”: This chapter covers inter-VLAN routing, multilayer switching with Cisco Express Forwarding (CEF), and how to verify that multilayer switching is functioning properly. +■ Chapter 12, “Configuring DHCP”: This chapter discusses ways to configure a switch to relay Dynamic Host Configuration Protocol (DHCP) requests or to act as a DHCP server to local client devices. +■ Part V: Monitoring Campus Networks +■ Chapter 13, “Logging Switch Activity”: This chapter explains how to configure a switch to generate logging information and how to correlate logging messages with accurate timestamps. +■ Chapter 14, “Managing Switches with SNMP”: This chapter discusses SNMP and how you can use it to monitor and manage switches in a network. +■ Chapter 15, “Monitoring Performance with IP SLA”: This chapter explains how to leverage IP SLA probes to measure network performance against expected service level agreement parameters. +■ Chapter 16, “Using Port Mirroring to Monitor Traffic”: This chapter covers methods you can use to mirror or copy switched traffic to a destination where it can be collected and analyzed. +■ Part VI: Implementing High Availability + +■ Chapter 17, “Understanding High Availability”: This chapter discusses ways that multiple physical switches can be connected or configured together to oper-ate as one logical switch, increasing availability. +■ Chapter 18, “Layer 3 High Availability”: This chapter covers providing redun-dant router or gateway addresses on Catalyst switches and verifying that redun-dancy is functioning properly. + +www.allitebooks.com From the Library of Outcast Outcast +xxx CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Part VII: Securing Switched Networks + +■ Chapter 19, “Securing Switch Access”: This chapter covers port security using MAC addresses, port-based security using IEEE 802.1X, storm control to reduce traffic storms, and best practices for securing switches. +■ Chapter 20, “Securing VLANs”: This chapter covers how to control traffic within a VLAN using access lists, implementing private VLANs, and best practices for securing trunk links. +■ Chapter 21, “Preventing Spoofing Attacks”: This chapter explains features like DHCP snooping, IP Source Guard, and dynamic ARP inspection, which you can le-verage to prevent network attacks that use spoofed information to gain a foothold. +■ Chapter 22, “Managing Switch Users”: This chapter covers switch authentication, authorization, and accounting (AAA)—mechanisms that control who can access a switch and what they can do on the switch, as well as provide a record of what occurred. +■ Part VIII: Final Preparation + +■ Chapter 23, “Final Preparation”: This chapter explains how to use the practice exam CD to enhance your study, along with a basic study plan. +■ Part IX: Appendixes + +■ Appendix A: This appendix contains answers to the “Do I Know This Already” quizzes. +■ Appendix B: This appendix tells you how to find any updates, should there be changes to the exam. +■ Glossary: The glossary contains definitions for all the terms listed in the “Define Key Terms” sections at the conclusions of Chapters 1 through 22. +In addition, you can find the following appendixes on the CD that is included with this book: + +■ Appendix C, “Memory Tables”: This appendix holds the key tables and lists from each chapter with some of the content removed. You can print this appendix, and as a memory exercise, complete the tables and lists. The goal is to help you memorize facts that can be useful on the exams. + +■ Appendix D, “Memory Table Answer Key”: This appendix contains the answer key for the exercises in Appendix D. +■ Appendix E, “Study Planner,” is a spreadsheet with major study milestones, where you can track your progress through your study. + +For More Information + +If you have any comments about the book, you can submit those via http://www.ciscopress.com. Just go to the website, select Contact Us, and type your message. + +Cisco might make changes that affect the SWITCH exam from time to time. You should always check http://www.cisco.com/go/ccnp for the latest details. + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Hierarchical Network Design: This section details a three-layer hierarchical structure of campus net-work designs. +■ Modular Network Design: This section covers the process of designing a campus network, based on breaking it into functional modules. You also learn how to size and scale the modules in a design. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 1 + + + + + + +Enterprise Campus Network Design + + +This chapter presents a logical design process that you can use to build a new switched campus network or to modify and improve an existing network. Networks can be designed in layers using a set of building blocks that can organize and streamline even a large, complex campus network. These building blocks can then be placed using several campus design models to provide maximum efficiency, functionality, and scalability. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 1-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 1-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Hierarchical Network Design + +Modular Network Design + +Questions Covered in This Section +1–10 + +11–17 + + +1. Where does a collision domain exist in a switched network? + +a. On a single switch port + +b. Across all switch ports + +c. On a single VLAN + +d. Across all VLANs + +2. Where does a broadcast domain exist in a switched network? + +a. On a single switch port + +b. Across all switch ports + +c. On a single VLAN + +d. Across all VLANs + + + +From the Library of Outcast Outcast +4 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +3. What is a VLAN primarily used for? + +a. To segment a collision domain + +b. To segment a broadcast domain + +c. To segment an autonomous system + +d. To segment a spanning-tree domain + +4. How many layers are recommended in the hierarchical campus network design model? + +a. 1 + +b. 2 + +c. 3 + +d. 4 + +e. 7 + +5. What is the purpose of breaking a campus network into a hierarchical design? + +a. To facilitate documentation + +b. To follow political or organizational policies + +c. To make the network predictable and scalable + +d. To make the network more redundant and secure + +6. End-user PCs should be connected into which of the following hierarchical layers? + +a. Distribution layer + +b. Common layer + +c. Access layer + +d. Core layer + +7. In which OSI layer should devices in the distribution layer typically operate? + +a. Layer 1 + +b. Layer 2 + +c. Layer 3 + +d. Layer 4 + +8. A hierarchical network’s distribution layer aggregates which of the following? + +a. Core switches + +b. Broadcast domains + +c. Routing updates + +d. Access layer switches + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 5 + +9. In the core layer of a hierarchical network, which of the following are aggregated? + +a. Routing tables + +b. Packet filters + +c. Distribution switches + +d. Access layer switches + +10. In a properly designed hierarchical network, a broadcast from one PC is confined to which one of the following? + +a. One access layer switch port + +b. One access layer switch + +c. One switch block + +d. The entire campus network + +11. Which one or more of the following are the components of a typical switch block? + +a. Access layer switches + +b. Distribution layer switches + +c. Core layer switches + +d. E-commerce servers + +e. Service provider switches + +12. Which of the following are common types of core, or backbone, designs? (Choose all that apply.) + +a. Collapsed core + +b. Loop-free core + +c. Dual core + +d. Layered core + +e. Multinode core + +13. What is the maximum number of access layer switches that can connect into a single distribution layer switch? + +a. 1 + +b. 2 + +c. Limited only by the number of ports on the access layer switch + +d. Limited only by the number of ports on the distribution layer switch + +e. Unlimited + + + + +From the Library of Outcast Outcast +6 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +14. A switch block should be sized according to which two of the following parameters? (Choose all that apply.) + +a. The number of access layer users + +b. A maximum of 250 access layer users + +c. A study of the traffic patterns and flows + +d. The amount of rack space available + +e. The number of servers accessed by users + +15. What evidence can be seen when a switch block is too large? (Choose all that apply.) + +a. IP address space is exhausted. + +b. You run out of access layer switch ports. + +c. Broadcast traffic becomes excessive. + +d. Traffic is throttled at the distribution layer switches. + +e. Network congestion occurs. + +16. How many distribution switches should be built into each switch block? + +a. 1 + +b. 2 + +c. 4 + +d. 8 + +17. Which are the most important aspects to consider when designing the core layer in a large network? (Choose all that apply.) + +a. Low cost + +b. Switches that can efficiently forward traffic, even when every uplink is at 100 percent capacity + +c. High port density of high-speed ports + +d. A low number of Layer 3 routing peers + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 7 + +Foundation Topics + + +Hierarchical Network Design + +A campus network is an enterprise network consisting of many LANs in one or more buildings, all connected and all usually in the same geographic area. A company typically owns the entire campus network and the physical wiring. Campus networks commonly consist of wired Ethernet LANs and shared wireless LANs. + +An understanding of traffic flow is a vital part of the campus network design. You might be able to leverage high-speed LAN technologies and “throw bandwidth” at a network to improve traffic movement. However, the emphasis should be on providing an overall +design that is tuned to known, studied, or predicted traffic flows. The network traffic can then be effectively moved and managed, and you can scale the campus network to sup-port future needs. + +As a starting point, consider the simple network shown in Figure 1-1. A collection of PCs, printers, and servers are all connected to the same network segment and use the 192.168.1.0 subnet. All devices on this network segment must share the available band-width. + + + + + + +192.168.1.0 + +Figure 1-1 Simple Shared Ethernet Network + +Recall that if two or more hosts try to transmit at the same time on a shared network, their frames will collide and interfere. When collisions occur, all hosts must become silent and wait to retransmit their data. The boundary around such a shared network is called +a collision domain. In Figure 1-1, the entire shared segment represents one collision domain. + +A network segment with six hosts might not seem crowded. Suppose the segment con-tains hundreds of hosts instead. Now the network might not perform very well if many of the hosts are competing to use the shared media. Through network segmentation, you +can reduce the number of stations on a segment. This, in turn, reduces the size of the col-lision domain and lowers the probability of collisions because fewer stations will try to transmit at a given time. + +Broadcast traffic can also present a performance problem on a Layer 2 network because all broadcast frames flood to reach all hosts on a network segment. If the segment is large, the broadcast traffic can grow in proportion and monopolize the available band-width. In addition, all hosts on the segment must listen to and process every broadcast + + + +From the Library of Outcast Outcast +8 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +frame. To contain broadcast traffic, the idea is to provide a barrier at the edge of a LAN segment so that broadcasts cannot pass or be forwarded outward. The extent of a Layer 2 network, where a broadcast frame can reach, is known as a broadcast domain. + +To limit the size of a collision domain, you can connect smaller numbers of hosts to individual switch interfaces. Ideally, each host should connect to a dedicated switch interface so that they can operate in full-duplex mode, preventing collisions altogether. Switch interfaces do not propagate collisions, so each interface becomes its own collision domain—even if several interfaces belong to a common VLAN. + +In contrast, when broadcast traffic is forwarded, it is flooded across switch interface boundaries. In fact, broadcast frames will reach every switch interface in a VLAN. In other words, a VLAN defines the extent of a broadcast domain. To reduce the size of a broadcast domain, you can segment a network or break it up into smaller Layer 2 +VLANs. The smaller VLANs must be connected by a Layer 3 device, such as a router or a multilayer switch, as shown in Figure 1-2. The simple network of Figure 1-1 now has two segments or VLANs interconnected by Switch A, a multilayer switch. A Layer 3 device cannot propagate a collision condition from one segment to another, and it will not for-ward broadcasts between segments. + + +VLAN 1 192.168.1.0 + +VLAN 2 192.168.2.0 + + + + + + + +Switch A + +Figure 1-2 Example of Network Segmentation + +The network might continue to grow as more users and devices are added to it. Switch A has a limited number of ports, so it cannot directly connect to every device. Instead, the network segments can be grown by adding a new switch to each, as shown in Figure 1-3. + + +VLAN 1 192.168.1.0 + +Switch A VLAN 2 192.168.2.0 + + + + + + +Switch B Switch C + +Figure 1-3 Expanding a Segmented Network + + + + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 9 + +Switch B aggregates traffic to and from VLAN 1, while Switch C aggregates VLAN 2. As the network continues to grow, more VLANs can be added to support additional applica-tions or user communities. As an example, Figure 1-4 shows how Voice over IP (VoIP) has been implemented by placing IP phones into two new VLANs (10 and 20). The same two aggregating switches can easily support the new VLANs. + + + +VLAN 1 192.168.1.0 + +Switch A VLAN 2 192.168.2.0 + + + + + + +Switch B Switch C + + + +VLAN 10 192.168.10.0 + +VLAN 20 192.168.20.0 + + + +Figure 1-4 Network Growth Through New VLANs + + +Predictable Network Model + + + + + + + + + + + + + + + +Key Topic + +Ideally, you should design a network with a predictable behavior in mind to offer low maintenance and high availability. For example, a campus network needs to recover from failures and topology changes quickly and in a predetermined manner. You should scale the network to easily support future expansions and upgrades. With a wide variety of multiprotocol and multicast traffic, the network should be capable of efficiently connect-ing users with the resources they need, regardless of location. + +In other words, design the network around traffic flows rather than a particular type of traffic. Ideally, the network should be arranged so that all end users are located at a +consistent distance from the resources they need to use. If one user at one corner of the network passes through two switches to reach an email server, any other user at any other location in the network should also require two switch hops for email service. + +Cisco has refined a hierarchical approach to network design that enables network design-ers to organize the network into distinct layers of devices. The resulting network is effi-cient, intelligent, scalable, and easily managed. + +Figure 1-4 can be redrawn to emphasize the hierarchy that is emerging. In Figure 1-5, two layers become apparent: the access layer, where switches are placed closest to the end +users; and the distribution layer, where access layer switches are aggregated. + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +10 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Distribution + + + + + + +Access Access + +Figure 1-5 Two-Layer Network Hierarchy Emerges + +As the network continues to grow with more buildings, more floors, and larger groups +of users, the number of access switches increases. As a result, the number of distribution switches increases. Now things have scaled to the point where the distribution switches need to be aggregated. This is done by adding a third layer to the hierarchy, the core layer, as shown in Figure 1-6. + +Core + + + + + +Distribution Distribution + + + + + +Access Access Access Access + + + + + +Access Access Access Access + +Figure 1-6 Core Layer Emerges + +Traffic flows in a campus network can be classified as three types, based on where the network service or resource is located in relation to the end user. Figure 1-7 illustrates the flow types between a PC and some file servers, along with three different paths the traf-fic might take through the three layers of a network. Table 1-2 also lists the types and the extent of the campus network that is crossed going from any user to the service. + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 11 + +Core + + + + + +Distribution Distribution + + + +Access Access + + + + +Access Access +Enterprise +Remote +Local + +Access Access + + + + +Access Access + + + + + + + + +Figure 1-7 Traffic Flow Paths Through a Network Hierarchy + + +Table 1-2 Types of Network Services + + +Service Type +Local + +Remote + +Enterprise + +Location of Service +Same segment/VLAN as user + +Different segment/VLAN as user + +Central to all campus users + +Extent of Traffic Flow +Access layer only + +Access to distribution layers + +Access to distribution to core layers + + + +Notice how easily the traffic paths can be described. Regardless of where the user is located, the traffic path always begins at the access layer and progresses into the distri-bution and perhaps into the core layers. Even a path between two users at opposite ends of the network becomes a consistent and predictable access > distribution > core > distri-bution > access layer. + +Each layer has attributes that provide both physical and logical network functions at the appropriate point in the campus network. Understanding each layer and its functions or limitations is important to properly apply the layer in the design process. + + + + + + + + +From the Library of Outcast Outcast +12 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + +Key Topic + +Access Layer + +The access layer exists where the end users are connected to the network. Access switch-es usually provide Layer 2 (VLAN) connectivity between users. Devices in this layer, +sometimes called building access switches, should have the following capabilities: + + +■ Low cost per switch port + +■ High port density + +■ Scalable uplinks to higher layers + +■ High availability + +■ Ability to converge network services (that is, data, voice, video) + +■ Security features and quality of service (QoS) + + + + + +Key Topic + +Distribution Layer + +The distribution layer provides interconnection between the campus network’s access and core layers. Devices in this layer, sometimes called building distribution switches, +should have the following capabilities: + + +■ Aggregation of multiple access layer switches + +■ High Layer 3 routing throughput for packet handling + +■ Security and policy-based connectivity functions + +■ QoS features + +■ Scalable and redundant high-speed links to the core and access layers + +In the distribution layer, uplinks from all access layer devices are aggregated, or come together. The distribution layer switches must be capable of processing the total volume of traffic from all the connected devices. These switches should have a high port density of high-speed links to support the collection of access layer switches. + +VLANs and broadcast domains converge at the distribution layer, requiring routing, filter-ing, and security. The switches at this layer also must be capable of routing packets with high throughput. + +Notice that the distribution layer usually is a Layer 3 boundary, where routing meets the VLANs of the access layer. + + + + + +Key Topic + +Core Layer + +A campus network’s core layer provides connectivity between all distribution layer devic-es. The core, sometimes referred to as the backbone, must be capable of switching traffic +as efficiently as possible. Core switches should have the following attributes: + + +■ Very high Layer 3 routing throughput + +■ No costly or unnecessary packet manipulations (access lists, packet filtering) + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 13 + +■ Redundancy and resilience for high availability + +■ Advanced QoS functions + +Devices in a campus network’s core layer or backbone should be optimized for high-per-formance switching. Because the core layer must handle large amounts of campus-wide data, the core layer should be designed with simplicity and efficiency in mind. + +Although campus network design is presented as a three-layer approach (access, distri-bution, and core layers), the hierarchy can be collapsed or simplified in certain cases. For example, small or medium-size campus networks might not have the size or volume requirements that would require the functions of all three layers. In that case, you could combine the distribution and core layers for simplicity and cost savings. When the dis-tribution and core layers are combined into a single layer of switches, a collapsed core network results. + +Modular Network Design + +Designing a new network that has a hierarchy with three layers is fairly straightforward. You can also migrate an existing network into a hierarchical design. The resulting net-work is organized, efficient, and predictable. However, a simple hierarchical design does not address other best practices like redundancy, in the case where a switch or a link fails, or scalability, when large additions to the network need to be added. + +Consider the hierarchical network shown in the left portion of Figure 1-8. Each layer of the network is connected to the adjacent layer by single links. If a link fails, a significant portion of the network will become isolated. In addition, the access layer switches are aggregated into a single distribution layer switch. If that switch fails, all the users will become isolated. + + + +Core + + + + +Distribution + + + + + +Access + +Core + + + + +Distribution + + + + + +Access + + + + +Switch Block + +Figure 1-8 Improving Availability in the Distribution and Access Layers + + + +From the Library of Outcast Outcast +14 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +To mitigate a potential distribution switch failure, you can add a second, redundant dis-tribution switch. To mitigate a potential link failure, you can add redundant links from each access layer switch to each distribution switch. These improvements are shown on the right in Figure 1-8. + +One weakness is still present in the redundant design of Figure 1-8: The core layer has only one switch. If that core switch fails, users in the access layer will still be able to communicate with each other. However, they will not be able to reach other areas of the network, such as a data center, the Internet, and so on. To mitigate the effects of a +core switch failure, you can add a second, redundant core switch, as shown in Figure 1-9. Redundant links should also be added between each distribution layer switch and each core layer switch. + + +Core + + + + + +Distribution + + + + + + +Access + + + +Switch Block + +Figure 1-9 Fully Redundant Hierarchical Network Design + +The redundancy needed for the small network shown in Figure 1-9 is fairly straight-forward. As the network grows and more redundant switches and redundant links are added into the design, the design can become confusing. For example, suppose many more access layer switches need to be added to the network of Figure 1-9 because sev-eral departments of users have moved into the building or into an adjacent building. Should the new access layer switches be dual-connected into the same two distribution switches? Should new distribution switches be added, too? If so, should each of the dis-tribution switches be connected to every other distribution and every other core switch, creating a fully meshed network? + +Figure 1-10 shows one possible network design that might result. With so many intercon-necting links between switches, it becomes a “brain-buster” exercise to figure out where VLANs are trunked, what the spanning-tree topologies look like, which links should have Layer 3 connectivity, and so on. Users might have connectivity through this network, but + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 15 + +it might not be clear how they are actually working or what has gone wrong if they are not working. This network looks more like a spider’s web than an organized, streamlined design. + + +Core + + + + +Distribution + + + + + + +Access + + + +New Users + + +Figure 1-10 + +New Users Switch Block + +Network Growth in a Disorganized Fashion + + +To maintain organization, simplicity, and predictability, you can design a campus network in a logical manner, using a modular approach. In this approach, each layer of the hierar-chical network model can be broken into basic functional units. These units, or modules, can then be sized appropriately and connected, while allowing for future scalability and expansion. + +You can divide enterprise campus networks into the following basic elements or building blocks: + +■ Switch block: A group of access layer switches, together with their distribution switches. This is also called an access distribution block, named for the two switch layers that it contains. The dashed rectangle in Figures 1-8 through 1-10 represent typical switch blocks. + +■ Core: The campus network’s backbone, which connects all switch blocks. + + + +Key Topic + +Other related elements can exist. Although these elements do not contribute to the cam-pus network’s overall function, they can be designed separately and added to the network design. For example, a data center containing enterprise resources or services can have its own access and distribution layer switches, forming a switch block that connects into the core layer. In fact, if the data center is very large, it might have its own core switches, too, which connect into the normal campus core. Recall how a campus network is divided into access, distribution, and core layers. The switch block contains switching devices from the access and distribution layers. The switch block then connects into the core layer, +providing end-to-end connectivity across the campus. As the network grows, you can + + + + +From the Library of Outcast Outcast +16 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +add new access layer switches by connecting them into an existing pair of distribution switches, as shown in Figure 1-11. You could also add a completely new access distribu-tion switch block that contains the areas of new growth, as shown in Figure 1-12. + + +Core + + + +Distribution + + + + + +Access + + +Switch Block + +Figure 1-11 Network Growth by Adding Access Switches to a Switch Block + + +Core + + + + + +Distribution + + + +Access + + +Switch Block Switch Block Switch Block + +Figure 1-12 Network Growth by Adding New Switch Blocks + + +Sizing a Switch Block + +Containing access and distribution layer devices, the switch block is simple in concept. You should consider several factors, however, to determine an appropriate size for the switch block. The range of available switch devices makes the switch block size very flex-ible. At the access layer, switch selection is usually based on port density or the number of connected users. + + + + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 17 + +The distribution layer must be sized according to the number of access layer switches that are aggregated or brought into a distribution device. Consider the following factors: + +■ Traffic types and patterns + +■ Amount of Layer 3 switching capacity at the distribution layer + +■ Total number of users connected to the access layer switches + +■ Geographic boundaries of subnets or VLANs + +Designing a switch block based solely on the number of users or stations contained within the block is usually inaccurate. Usually, no more than 2000 users should be placed within a single switch block. Although this is useful for initially estimating a switch block’s size, this idea doesn’t take into account the many dynamic processes that occur on a functioning network. + +Instead, switch block size should be based primarily on the following: + +■ Traffic types and behavior + +■ Size and number of common workgroups + +Because of the dynamic nature of networks, you can size a switch block too large to han-dle the load that is placed on it. Also, the number of users and applications on a network tends to grow over time. A provision to break up or downsize a switch block might be necessary as time passes. Again, base these decisions on the actual traffic flows and pat-terns present in the switch block. You can estimate, model, or measure these parameters with network-analysis applications and tools. + + +Note The actual network-analysis process is beyond the scope of this book. Traffic esti-mation, modeling, and measurement are complex procedures, each requiring its own dedi-cated analysis tool. + + +Generally, a switch block is too large if the following conditions are observed: + +■ The routers (multilayer switches) at the distribution layer become traffic bottlenecks. This congestion could be because of the volume of inter-VLAN traffic, intensive CPU processing, or switching times required by policy or security functions (access lists, queuing, and so on). + +■ Broadcast or multicast traffic slows the switches in the switch block. Broadcast and multicast traffic must be replicated and forwarded out many ports simultaneously. This process requires some overhead in the multilayer switch, which can become too great if significant traffic volumes are present. + + + + + + +From the Library of Outcast Outcast +18 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + + + + + + + + + + +Key Topic + +Switch Block Redundancy + +In any network design, the potential always exists for some component to fail. For example, if an electrical circuit breaker is tripped or shuts off, a switch might lose power. A better design is to use a switch that has two independent power supplies. Each power supply could be connected to two power sources so that one source is always likely to be available to power the switch. In a similar manner, a single switch might have an internal problem that causes it to fail. A single link might go down because a media module fails, a fiber-optic cable gets cut, and so on. To design a more resilient network, you can imple-ment most of the components in redundant pairs. + +A switch block consists of two distribution switches that aggregate one or more access layer switches. Each access layer switch should have a pair of uplinks—one connecting to each distribution switch. The physical cabling is easy to draw, but the logical connectiv-ity is not always obvious. For example, Figure 1-13 shows a switch block that has a single VLAN A that spans multiple access switches. You might find this where there are several separate physical switch chassis in an access layer room, or where two nearby commu-nications rooms share a common VLAN. Notice from the shading how the single VLAN spans across every switch (both access and distribution) and across every link connecting the switches. This is necessary for the VLAN to be present on both access switches and +to have redundant uplinks for high availability. + + +To Core Layer + + +Layer 3 + + +Distribution + +Layer 2 Links + +Layer 2 + + + + +Access + + +VLAN A VLAN B + +Switch Block + +Figure 1-13 A Redundant Switch Block Design + +Although this design works, it is not optimal. VLAN A must be carried over every pos-sible link within the block to span both access switches. Both distribution switches must also support VLAN A because they provide the Layer 3 router function for all hosts on + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 19 + +the VLAN. The two distribution switches can use one of several redundant gateway pro-tocols to provide an active IP gateway and a standby gateway at all times. These proto-cols require Layer 2 connectivity between the distribution switches and are discussed in Chapter 18, “Layer 3 High Availability.” + +Notice how the shaded links connect to form two triangular loops. Layer 2 networks cannot remain stable or usable if loops are allowed to form, so some mechanism must be used to detect the loops and keep the topology loop free. + +In addition, the looped topology makes the entire switch block a single failure domain. If a host in VLAN A misbehaves or generates a tremendous amount of broadcast traffic, all the switches and links in the switch block could be negatively impacted. + +A better design works toward keeping the switch block inherently free of Layer 2 loops. As Figure 1-14 shows, a loop-free switch block requires a unique VLAN on each access switch. In other words, VLANs are not permitted to span across multiple access switches. The extent of each VLAN, as shown by the shaded areas, becomes a V shape rather than a closed triangular loop. + +To Core Layer + + +Layer 3 + + +Distribution Layer 3 Link + +Layer 2 Links + +Layer 2 + + + + +Access + + +VLAN A VLAN B + +Switch Block + +Figure 1-14 Best Practice Loop-Free Switch Block Topology + + + +Key Topic + +The boundary between Layers 2 and 3 remains the same. All Layer 2 connectivity is con-tained within the access layer, and the distribution layer has only Layer 3 links. Without any potential Layer 2 loops, the switch block can become much more stable and much less reliant on any mechanisms to detect and prevent loops. Also, because each access switch has two dedicated paths into the distribution layer, both links can be fully utilized with traffic load balanced across them. In turn, each Layer 3 distribution switch can load +balance traffic over its redundant links into the core layer using routing protocols. + + + +www.allitebooks.com From the Library of Outcast Outcast +20 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +It is also possible to push the Layer 3 boundary from the distribution layer down into the access layer, as long as the access switches can support routing functions. Figure 1-15 illustrates this design. Because Layer 3 links are used throughout the switch block, net-work stability is offered through the fast convergence of routing protocols and updates. Routing can also load balance packets across the redundant uplinks, making full use of every available link between the network layers. + +To Core Layer + + + + +Distribution Layer 3 Link +Layer 3 Layer 3 +Links + + + + + +Access + +Layer 2 VLAN A VLAN B + +Switch Block + +Figure 1-15 A Completely Routed Switch Block + +You should become familiar with a few best practices that can help with a redundant hier-archical network design: + +■ Design each layer with pairs of switches. + +■ Connect each switch to the next higher layer with two links for redundancy. + +■ Connect each pair of distribution switches with a link, but do not connect the access layer switches to each other (unless the access switches support some other means to function as one logical stack or chassis). + +■ Do not extend VLANs beyond distribution switches. The distribution layer should always be the boundary of VLANs, subnets, and broadcasts. Although Layer 2 switches can extend VLANs to other switches and other layers of the hierarchy, this activity is discouraged. VLAN traffic should not traverse the network core. + + +Network Core + +A core layer is required to connect two or more switch blocks in a campus network. Because all traffic passing to and from all switch blocks must cross the core, the core + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 21 + + + + + + + + + + + + + + + + + +Key Topic + +layer must be as efficient and resilient as possible. The core is the campus network’s basic foundation and carries much more traffic than any other switch block. + +Recall that both the distribution and core layers provide Layer 3 functionality. Preferably, the links between distribution and core layer switches should be Layer 3 routed interfac-es. You can also use Layer 2 links that carry a small VLAN bounded by the two switches. In the latter case, a Layer 3 switch virtual interface (SVI) is used to provide routing within each small VLAN. + +The links between layers should be designed to carry the amount of traffic load handled by the distribution switches, at a minimum. The links between core switches should be of sufficient size to carry the aggregate amount of traffic coming into one of the core switches. Consider the average link utilization, but allow for future growth. An Ethernet core allows simple and scalable upgrades of magnitude; consider the progression from Gigabit Ethernet to 10-Gigabit Ethernet (10GE), and so on. + +A core should consist of two multilayer switches that connect two or more switch blocks in a redundant fashion. A redundant core is sometimes called a dual core because it is usually built from two identical switches. Figure 1-16 illustrates the core. Notice that this +core appears as an independent module and is not merged into any other block or layer. + + + + + +Core + + + + + + +Distribution + + + + +Access + + +Switch Block Switch Block + +Figure 1-16 A Redundant Core Layer + +Redundant links connect each switch block’s distribution layer portion to each of the dual core switches. The two core switches connect by a common link. + +With a redundant core, each distribution switch has two equal-cost paths into the core, allowing the available bandwidth of both paths to be used simultaneously. Both paths + + + + +From the Library of Outcast Outcast +22 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +remain active because the distribution and core layers use Layer 3 devices that can man-age equal-cost paths in routing tables. The routing protocol in use determines the avail-ability or loss of a neighboring Layer 3 device. If one switch fails, the routing protocol reroutes traffic using an alternative path through the remaining redundant switch. + +If the campus network continues to grow to the point that it spans two large buildings or two large locations, the core layer can be replicated, as shown in Figure 1-17. Notice how the two-node redundant core has been expanded to include four core switches. This is known as a multinode core. Each of the four core switches is connected to the other core switches to form a fully meshed core layer. + +Switch Block Switch Block + + +Access + + + + + +Distribution + + + + + + +Multi-Node Core + + + + + + + + + +Distribution + + + + +Access + + +Switch Block Switch Block + +Figure 1-17 Using a Multi-Node Core in a Very Large Campus Network + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 23 + +Even though the multinode core is fully meshed, the campus network is still divided across the two pairs of core switches. Each switch block has redundant connections to only one core pair—not to all of the core switches. + +Collapsed Core + +Should all networks have a distinct redundant core layer? Perhaps not, in smaller campus net-works, where the cost and scalability of a separate core layer is not warranted. A collapsed core block is one in which the hierarchy’s core layer is collapsed into the distribution layer. Here, both distribution and core functions are provided within the same switch devices. + +Figure 1-18 shows the basic collapsed core design. Although the distribution and core layer functions are performed in the same device, keeping these functions distinct and properly designed is important. Note also that the collapsed core is not an independent building block but is integrated into the distribution layer of the individual standalone switch blocks. + +Switch Block + + +Access + + + + + +Distribution + + + +Collapsed Core + + + +Distribution + + + + +Access + + +Switch Block + +Figure 1-18 A Collapsed Core Network Design + +In the collapsed core design, each access layer switch has a redundant link to each distribu-tion layer switch. All Layer 3 subnets present in the access layer terminate at the distribution + + + + +From the Library of Outcast Outcast +24 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +switches’ Layer 3 ports, as in the basic switch block design. The distribution switches con-nect to each other with redundant links, completing a path to use during a failure. + +Core Size in a Campus Network + +The core layer is made up of redundant switches and is bounded and isolated by Layer 3 devices. Routing protocols determine paths and maintain the core’s operation. As with any network, you must pay some attention to the overall design of the routers and rout-ing protocols in the network. Because routing protocols propagate updates throughout the network, network topologies might be undergoing change. The network’s size (the number of routers) then affects routing protocol performance as updates are exchanged and network convergence takes place. + +Although the network shown previously in Figure 1-16 might look small, with only two switch blocks of two Layer 3 switches (route processors within the distribution layer switches) each, large campus networks can have many switch blocks connected into the core. If you think of each multilayer switch as a router, you will recall that each route processor must communicate with and keep information about each of its directly con-nected peers. Most routing protocols have practical limits on the number of peer rout-ers that can be directly connected on a point-to-point or multiaccess link. In a network with a large number of switch blocks, the number of connected routers can grow quite large. Should you be concerned about a core switch peering with too many distribution switches? + +No, because the actual number of directly connected peers is quite small, regardless of the campus network size. Access layer VLANs terminate at the distribution layer switches (unless the access layer is configured for Layer 3 operation). The only peering routers +at that boundary are pairs of distribution switches, each providing routing redundancy for each of the access layer VLAN subnets. At the distribution and core boundary, each distribution switch connects to only two core switches over Layer 3 switch interfaces. Therefore, only pairs of router peers are formed. + +When multilayer switches are used in the distribution and core layers, the routing proto-cols running in both layers regard each pair of redundant links between layers as equal-cost paths. Traffic is routed across both links in a load-sharing fashion, utilizing the band-width of both. + +One final core layer design point is to scale the core switches to match the incoming load. At a minimum, each core switch must handle switching each of its incoming distribution links at 100 percent capacity. + +Cisco Products in a Hierarchical Network Design + +Before delving into the design practices needed to build a hierarchical campus network, you should have some idea of the actual devices that you can place at each layer. Cisco has switching products tailored for layer functionality and for the size of the campus network. + +For the purposes of this discussion, a large campus can be considered to span across many buildings. A medium campus might make use of one or several buildings, and a small campus might have only a single building. + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 25 + +Choose your Cisco products based on the functionality that is expected at each layer of a small, medium, or large campus. Do not get lost in the details of the tables. Rather, try to understand which switch fits into which layer for a given network size. + +In the access layer, high port density, Power over Ethernet (PoE), and low cost are usu-ally desirable. The Catalyst 2960-X, 3650, and 3850 switches provide 48 ports each. Like switch models can be connected to form a single logical switch when a greater number of ports is needed. The Catalyst 4500E is a single-switch chassis that can be populated with a variety of line cards. It also offers a choice of redundant supervisor modules that offer redundancy and even the ability to perform software upgrades with no impact to the production network. Table 1-3 describes some Cisco switch platforms that are commonly used in the access layer. + +Table 1-3 Common Access Layer Switch Platforms + + +Catalyst Model + +Max Port Uplinks Density + +Max Other Backplane Features + + + +2960-X 384 (Up to 8 48-port switches in a stack) + +2 10GE or 80 Gbps 4 1 Gigabit +Ethernet per switch + +RIP, OSPF available for routed access layer; PoE+ + + + +3650 432 (Up to 9 48-port switches in a stack) + +2 Gigabit 160 Gbps Ethernet +or 4 10GE + +Full-featured routing available, integrated wireless controller, PoE+ + + + +3850 432 (Up to 9 48-port switches in a stack) + +4 Gigabit 480 Gbps Ethernet, 4 +10GE + +Full-featured routing available, integrated wireless controller, PoE+, UPoE + + + +4500E 384 (Up to 8 48-port modules per chassis) + +Up to 12-port +10GE per module + +928 Gbps Dual supervisors, full-featured routing available, integrated wireless controller, PoE+, UPoE + + + + + + + +From the Library of Outcast Outcast +26 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The distribution and core layers are very similar in function and switching features. Generally, these layers require high Layer 3 switching throughput and a high density of high-bandwidth optical media. Cisco offers the Catalyst 3750-X, 4500-X, 4500E, and 6800, as summarized in Table 1-4. + +Table 1-4 Common Distribution and Core Layer Switch Platforms + + +Catalyst Model +4500-X + + + + +4500E + + + + + + + + + + + + +6807-XL + +Max Port Density +80 10GE + + + + +96 10GE or 384 Gigabit Ethernet + + + + + + + + + + + +40 40Gbps, 160 Gigabit Ethernet, 480 Gigabit Ethernet + +Max Backplane +1.6 Tbps + + + + +928 Gbps + + + + + + + + + + + + +22.8 Tbps + +Other Features + +Dual-chassis Virtual Switching System (VSS) redundancy +Dual supervisors + + + + + + + + + + + + +Dual supervisor, dual-chassis VSS redundancy + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Enterprise Campus Network Design 27 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 1-5 lists a reference of these key topics and the page num- +bers on which each is found. + + +Table 1-5 Key Topics for Chapter 1 +Key +Topic Key Topic Element Description Page Number + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Describes the Cisco hierarchical network design 9 principles +Describes the access layer 12 + +Describes the distribution layer 12 + +Describes the core layer 12 + +Explains modular network design using switch 15 blocks +Discusses the pitfalls of letting VLANs span access 18 layer switches +Discusses two best practice designs for switch block 19 redundancy +Explains a redundant core design 21 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +hierarchical network design, access layer, distribution layer, core layer, switch block, collapsed core, dual core + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Layer 2 Switch Operation: This section describes the functionality of a switch that forwards Ethernet frames. +■ Multilayer Switch Operation: This section describes the mechanisms that forward packets at OSI Layers 3 and 4. +■ Tables Used in Switching: This section explains how tables of information and computation are used to make switching decisions. Coverage focuses on the content-addressable memory table involved in Layer 2 forwarding, and the ternary content-address-able memory used in packet-handling decisions at Layers 2 through 4. +■ Managing Switching Tables: This section reviews the Catalyst commands that you can use to config-ure and monitor the switching tables and memory. You will find these commands useful when trouble-shooting or tracing the sources of data or problems in a switched network. + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 2 + + + + + + +Switch Operation + + +To have a good understanding of the many features that you can configure on a Catalyst switch, you first should understand the fundamentals of the switching function. + +This chapter serves as a primer, describing how an Ethernet switch works. It presents Layer 2 forwarding, along with the hardware functions that make forwarding possible. Multilayer switching is also explained. A considerable portion of the chapter deals with the memory architecture that performs switching at Layers 3 and 4 both flexibly and effi-ciently. This chapter also provides a brief overview of useful switching table management commands. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 2-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 2-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Layer 2 Switch Operation + +Multilayer Switch Operation + +Switching Tables + +Troubleshooting Switching Tables + +Questions Covered in This Section +1–5 + +6–9 + +10–11 + +12 + + + +1. Which of the following devices performs transparent bridging? + +a. Ethernet hub + +b. Layer 2 switch + +c. Layer 3 switch + +d. Router + + +www.allitebooks.com From the Library of Outcast Outcast +30 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. When a PC is connected to a Layer 2 switch port, how far does the collision domain spread? + +a. No collision domain exists. + +b. One switch port. + +c. One VLAN. + +d. All ports on the switch. + +3. What information is used to forward frames in a Layer 2 switch? + +a. Source MAC address + +b. Destination MAC address + +c. Source switch port + +d. IP addresses + +4. What does a switch do if a MAC address cannot be found in the CAM table? + +a. The frame is forwarded to the default port. + +b. The switch generates an ARP request for the address. + +c. The switch floods the frame out all ports (except the receiving port). + +d. The switch drops the frame. + +5. In a Catalyst switch, frames can be filtered with access lists for security and QoS purposes. This filtering occurs according to which of the following? + +a. Before a CAM table lookup + +b. After a CAM table lookup + +c. Simultaneously with a CAM table lookup + +d. According to how the access lists are configured + +6. Access list contents can be merged into which of the following? + +a. CAM table + +b. TCAM table + +c. FIB table + +d. ARP table + +7. Multilayer switches using CEF are based on which of these techniques? + +a. Route caching + +b. NetFlow switching + +c. Topology-based switching + +d. Demand-based switching + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 31 + +8. Which answer describes multilayer switching with CEF? + +a. The first packet is routed and then the flow is cached. + +b. The switch supervisor CPU forwards each packet. + +c. The switching hardware learns station addresses and builds a routing database. + +d. A single database of routing information is built for the switching hardware. + +9. In a switch, frames are placed in which buffer after forwarding decisions are made? + +a. Ingress queues + +b. Egress queues + +c. CAM table + +d. TCAM + +10. What size are the mask and pattern fields in a TCAM entry? + +a. 64 bits + +b. 128 bits + +c. 134 bits + +d. 168 bits + +11. Access list rules are compiled as TCAM entries. When a packet is matched against an access list, in what order are the TCAM entries evaluated? + +a. Sequentially in the order of the original access list. + +b. Numerically by the access list number. + +c. Alphabetically by the access list name. + +d. All entries are evaluated in parallel. + +12. Which Catalyst IOS command can you use to display the addresses in the CAM table? + +a. show cam + +b. show mac address-table + +c. show mac + +d. show cam address-table + + + + + + + + + + +From the Library of Outcast Outcast +32 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +Layer 2 Switch Operation + + + + + + + +Key Topic + +Consider a simple network that is built around many hosts that all share the same avail-able bandwidth. This is known as a shared media network and was used in early legacy LANs made up of Ethernet hubs. The carrier sense multiple access collision detect (CSMA/CD) scheme determines when a device can transmit data on the shared LAN. + +When more than one host tries to talk at one time, a collision occurs, and everyone must back off and wait to talk again. This forces every host to operate in half-duplex mode, by either talking or listening at any given time. In addition, when one host sends a frame, all connected hosts hear it. When one host generates a frame with errors, everyone hears that, too. This type of LAN is a collision domain because all device transmissions are susceptible to collisions. + +An Ethernet switch operates at OSI Layer 2, making decisions about forwarding frames based on the destination MAC addresses found within the frames. This means that the Ethernet media is no longer shared among connected devices. Instead, at its most basic +level, an Ethernet switch provides isolation between connected hosts in several ways: + + +■ The collision domain’s scope is severely limited. On each switch port, the collision domain consists of the switch port itself and the devices directly connected to that port—either a single host or, if a shared-media hub is connected, the set of hosts connected to the hub. + +■ Host connections can operate in full-duplex mode because there is no contention on the media. Hosts can talk and listen at the same time. + +■ Bandwidth is no longer shared. Instead, each switch port offers dedicated bandwidth across a switching fabric to another switch port. (These frame forwarding paths change dynamically.) + +■ Errors in frames are not propagated. Each frame received on a switch port is checked for errors. Good frames are regenerated when they are forwarded or transmitted. This is known as store-and-forward switching technology: Packets are received, stored for inspection, and then forwarded. + +■ You can limit broadcast traffic to a volume threshold. + +■ Other types of intelligent filtering or forwarding become possible. + + +Transparent Bridging + +A Layer 2 switch is basically a multiport transparent bridge, where each switch port is its own Ethernet LAN segment, isolated from the others. Frame forwarding is based com-pletely on the MAC addresses contained in each frame, such that the switch will not for-ward a frame unless it knows the destination’s location. (When the switch does not know + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 33 + +where the destination is, it makes some safe assumptions.) Figure 2-1 shows the progres-sion from a two-port to a multiport transparent bridge, and then to a Layer 2 switch. + + + +1 + + + + +1 + +2 + +3 + +4 + + + + +Transparent Bridge + + + + + + + +Multiport Bridge + + +2 + + + + +5 + +6 + +7 + +8 + +Forwarding Table +0000.1111.1111: port 2 0000.2222.2222: port 1 0000.3333.3333: port 1 0000.4444.4444: port 2 + +Broadcast: all ports + + +Forwarding Table +0000.1111.1111: port 4 0000.2222.2222: port 6 0000.3333.3333: port 1 0000.4444.4444: port 2 0000.5555.5555: port 8 0000.6666.6666: port 5 0000.7777.7777: port 3 0000.8888.8888: port 7 + +Broadcast: all ports + + + +1 9 + +2 10 + + +3 + +4 + +5 + +6 + +7 + +8 + + +VLAN X + + + + + + +VLAN Y +. . +. +Other VLANs + +Layer 2 Switch + +11 + +12 + +13 + +14 + +15 + +16 + + +Forwarding Table +0000.1111.1111: port 11, vlan X 0000.2222.2222: port 6, vlan Y 0000.3333.3333: port 1, vlan X 0000.4444.4444: port 9, vlan X 0000.5555.5555: port 8, vlan Y 0000.6666.6666: port 14, vlan Y 0000.7777.7777: port 3, vlan X 0000.8888.8888: port 16, vlan Y + +Broadcast: VLAN X: all VLAN X ports Broadcast: VLAN Y: all VLAN Y ports + + +Figure 2-1 A Comparison of Transparent Bridges and Switches + +The entire process of forwarding Ethernet frames then becomes figuring out what MAC addresses connect to which switch ports. For example, the Layer 2 switch in Figure 2-1 knows that the device using MAC address 0000.5555.5555 is located on switch port 8, which is assigned to VLAN Y. It also knows that frames arriving on VLAN Y and des-tined for the broadcast MAC address must be flooded out all ports that are assigned to VLAN Y. + +A switch either must be told explicitly where hosts are located or must learn this informa-tion for itself. You can configure MAC address locations through a switch’s command-line interface, but this quickly gets cumbersome when there are many stations on the network or when stations move around from one switch port to another. + +From the Library of Outcast Outcast +34 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + + + + + + +Key Topic + +To dynamically learn about station locations, a switch listens to incoming frames and keeps a table of address information. In Figure 2-1, this information is kept in a forward-ing table. As a frame is received on a switch port, the switch inspects the source MAC address. If that address is not in the address table already, the MAC address, switch port, and virtual LAN (VLAN) on which it arrived are recorded in the table. Learning the address locations of the incoming packets is easy and straightforward. + +Incoming frames also include the destination MAC address. Again, the switch looks up this address in the address table, hoping to find the switch port and VLAN where the destination address is attached. If it is found, the frame can be forwarded out the corre-sponding switch port. If the address is not found in the table, the switch must take more drastic action: The frame is forwarded in a “best effort” fashion by flooding it out all switch ports assigned to the source VLAN. This is known as unknown unicast flooding, because the location of the unicast destination is unknown. + +Figure 2-2 illustrates this process, using only a single VLAN for simplification. Suppose, for instance, that a packet arrives on switch port 3, containing destination MAC address 0000.aaaa.aaaa. The switch looks for that MAC address in its forwarding table, but is unable to find a matching entry. The switch then floods copies of the packet out every other port that is assigned to port 3’s VLAN, to increase the likelihood that 0000.aaaa. aaaa will eventually receive the packet that is destined for it. If the destination is the broadcast MAC address, the switch knows that the frame should be flooded out all ports +on the VLAN. + + +1 5 + +2 6 + + +Packet to 0000.aaaa.aaaa 3 + +4 + +7 + +Forwarding Table 8 + +0000.1111.1111: port 4 0000.2222.2222: port 6 0000.3333.3333: port 1 0000.4444.4444: port 2 +0000.aaaa.aaaa ? 0000.5555.5555: port 8 0000.6666.6666: port 5 0000.7777.7777: port 3 0000.8888.8888: port 7 + +Broadcast: all ports + +Packet to 0000.aaaa.aaaa 1 + +Packet to 0000.aaaa.aaaa 2 + +3 + +Packet to 0000.aaaa.aaaa 4 + + + + + + +Unknown Unicast Flooding + +5 Packet to 0000.aaaa.aaaa + +6 Packet to 0000.aaaa.aaaa + +7 Packet to 0000.aaaa.aaaa + +8 Packet to 0000.aaaa.aaaa + + +Figure 2-2 Unknown Unicast Flooding + +A switch constantly listens to incoming frames on each of its ports, learning source MAC addresses. However, be aware that the learning process is allowed only when the + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 35 + +Spanning Tree Protocol (STP) algorithm has decided that a port is stable for normal use. STP is concerned only with maintaining a loop-free network, where frames will not be forwarded recursively. If a loop formed, a flooded frame could follow the looped path, where it would be flooded again and again. STP is covered in greater detail in Chapters 6, “Traditional Spanning Tree Protocol,” through 9, “Advanced Spanning Tree Protocol.” + +In a similar manner, frames containing a broadcast or multicast destination address are also flooded. These destination addresses are not unknown—the switch knows them well because they use standardized address values. For example, the Ethernet broadcast address is always ffff.ffff.ffff, IPv4 multicast addresses always begin with 01xx.xxxx. xxxx, and IPv6 multicast addresses begin with 3333.xxxx.xxxx. These addresses are destined for multiple locations, so they must be flooded by definition. In the case of multicast addresses, flooding is performed by default unless more specific recipient loca-tions have been learned. + +Follow That Frame! + +You should have a basic understanding of the operations that a frame undergoes as it passes through a Layer 2 switch. This helps you get a firm grasp on how to configure the switch for complex functions. Figure 2-3 shows a typical Layer 2 Catalyst switch and the decision processes that take place to forward each frame. + + + + + + +RX Switch Ports + + + + + + +Ingress Queues + +Security ACLs Inbound and Outbound +(TCAM) + +Permit, QoS ACLs Deny, or +Other +Classification and Policing +(TCAM) Egress Queues + + + + + +TX Switch Ports + + + +L2 Forwarding Table (CAM) + +CAM Table + +MAC Egress VLAN Address Port + + + + + + +Figure 2-3 Operations Within a Layer 2 Catalyst Switch + +When a frame arrives at a switch port, it is placed into one of the port’s ingress queues. The queues each can contain frames to be forwarded, with each queue having a different priority or service level. The switch port then can be fine-tuned so that important frames + + + +From the Library of Outcast Outcast +36 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +get processed and forwarded before less-important frames. This can prevent time-critical data from being “lost in the shuffle” during a flurry of incoming traffic. + +As the ingress queues are serviced and a frame is pulled off, the switch must figure out not only where to forward the frame, but also whether it should be forwarded and how. Three fundamental decisions must be made: one concerned with finding the egress switch port, and two concerned with forwarding policies. All these decisions are made +simultaneously by independent portions of switching hardware and can be described as follows: + +■ L2 forwarding table: The frame’s destination MAC address is used as an index, or key, into the content-addressable memory (CAM), or address, table. If the address is found, the egress switch port and the appropriate VLAN ID are read from the table. (If the address is not found, the frame is marked for flooding so that it is forwarded out every switch port in the VLAN.) + +■ Security ACLs: Access control lists (ACLs) can be used to identify frames according to their MAC addresses, protocol types (for non-IP frames), IP addresses, protocols, and Layer 4 port numbers. The ternary content-addressable memory (TCAM) con-tains ACLs in a compiled form so that a decision can be made on whether to forward a frame in a single table lookup. + +■ QoS ACLs: Other ACLs can classify incoming frames according to quality of service (QoS) parameters, to police or control the rate of traffic flows, and to mark QoS parameters in outbound frames. The TCAM is also used to make these decisions in a single table lookup. + +The CAM and TCAM tables are discussed in greater detail in the “Content-Addressable Memory” and “Ternary Content-Addressable Memory” sections, later in this chapter. After the CAM and TCAM table lookups have occurred, the frame is placed into the appropriate egress queue on the appropriate outbound switch port. The egress queue is determined by QoS values either contained in the frame or passed along with the frame. Like the ingress queues, the egress queues are serviced according to importance or time criticality; higher priority frames are sent out without being delayed by other outbound traffic. + +Multilayer Switch Operation + +Many Cisco Catalyst switches can also forward frames based on Layers 3 and 4 informa-tion contained in packets. This is known as multilayer switching (MLS). Naturally, Layer 2 switching is performed at the same time because even the higher-layer encapsulations still are contained in Ethernet frames. + +Types of Multilayer Switching + +Catalyst switches have supported two basic generations or types of MLS: route caching (first-generation MLS) and topology based (second-generation MLS). This section pres-ents an overview of both, although only the second generation is supported in the Cisco + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 37 + +IOS Software-based switch families, such as the Catalyst 2960, 3750, 4500, and 6500. You should understand the two types and the differences between them: + + +■ + + + + + + + + + + +■ Key +Topic + +Route caching: The first generation of MLS, requiring a route processor (RP) and a switch engine (SE). The RP must process a traffic flow’s first packet to determine the destination. The SE listens to the first packet and to the resulting destination, and then sets up a “shortcut” entry in its MLS cache. The SE forwards subsequent pack-ets belonging to the same traffic flow based on shortcut entries in its cache. + +This type of MLS also is known by the names NetFlow LAN switching, flow-based or demand-based switching, and route once, switch many. The RP must examine each new traffic flow and set up shortcut entries for the SE. Even if this method isn’t used to forward packets in Cisco IOS–based Catalyst switches, the technique can still be used to generate traffic flow information and statistics. + +Topology based: The second generation of MLS, utilizing specialized hardware, is also organized with distinct RP and SE functions. The RP uses Layer 3 routing +information to build and prepopulate a single database of the entire known network topology. This database becomes an efficient table lookup in hardware, and is con-sulted so that packets can be forwarded at high rates by the SE. The longest match found in the database is used as the correct Layer 3 destination. As the routing topology changes over time, the database contained in the hardware can be updated +dynamically with no performance penalty. + + +This type of MLS is known as Cisco Express Forwarding (CEF). A routing pro-cess running on the switch downloads the current routing table database into the Forwarding Information Base (FIB) area of hardware. CEF is discussed in greater detail in Chapter 11, “Multilayer Switching.” + + +Tip Although the RP and SE functions within a multilayer switch do interact, they can operate independently, as if they are on different “planes.” The control plane of a switch includes the RP and any process that runs to control or manage the switch, whereas the data plane exists in the SE, where data is forwarded. + + + +Follow That Packet! + +The path that a Layer 3 packet follows through a multilayer switch is similar to that of a Layer 2 switch. Obviously, some means of making a Layer 3 forwarding decision must be added. Beyond that, several, sometimes unexpected, things can happen to packets as they are forwarded. Figure 2-4 shows a typical multilayer switch and the decision processes that must occur. Packets arriving on a switch port are placed in the appropriate ingress queue, just as in a Layer 2 switch. + + + + + + +From the Library of Outcast Outcast +38 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + + + + + + +RX Switch Ports + + + + + + + + +Ingress Queues + +Security ACLs Inbound and Outbound (TCAM) + +QoS ACLs Classification and Policing (TCAM) + +L3 Forwarding Table (FIB) + + + + +Permit, Deny, or Other + + +L3 Packet Egress Rewrite Queues + + + + + + + +TX Switch Ports + + +L2 Forwarding Table (CAM) + + +CAM Table FIB Table + + +MAC Egress +Address Port VLAN + +IP Address + +Next-Hop IP Addr + +Next-Hop Egress MAC Addr Port + + + + + + + + +Figure 2-4 Operations Within a Multilayer Catalyst Switch + +Each packet is pulled off an ingress queue and inspected for both Layer 2 and Layer 3 destination addresses. Now, the decision of where to forward the packet is based on two address tables, whereas the decision of how to forward the packet still is based on access list results. + +All the multilayer switching decisions are performed simultaneously in hardware, using the following functions: + +■ L2 forwarding table: The destination MAC address is used as an index into the CAM table. If the frame contains a Layer 3 packet that needs to be forwarded from one subnet to another, the destination MAC address will contain the address of a Layer 3 port on the switch itself. In this case, the CAM table results are used only to decide that the frame should be processed at Layer 3. + +■ L3 forwarding table: The FIB table is consulted, using the destination IP address as an index. The longest match in the table is found (both address and mask), and the resulting next-hop Layer 3 address is obtained. The FIB also contains each next-hop router’s Layer 2 MAC address and the egress switch port (and VLAN ID) so that fur-ther table lookups are not necessary. + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 39 + +■ Security ACLs: Inbound and outbound access lists are compiled into TCAM entries so that decisions of whether to forward a packet can be determined as a single table lookup. + +■ QoS ACLs: Packet classification, policing, and marking all can be performed as single table lookups in the QoS TCAM. + +As with Layer 2 switching, the packet finally must be placed in the appropriate egress queue on the appropriate egress switch port. + +During the multilayer switching process, some portions of the frame must be modified or rewritten, just as any router would do. For example, the destination MAC address in the inbound frame contains the address of the next-hop destination, which is the ingress Layer 3 interface on the multilayer switch. Once the FIB table is consulted, the next-hop router IP and MAC addresses are found. + +The next-hop Layer 2 address must be put into the frame in place of the original destina-tion address (the multilayer switch). The frame’s Layer 2 source address also must become that of the multilayer switch’s egress interface before the frame is sent on to the next +hop. As any good router must do, the time-to-live (TTL) value in the Layer 3 packet must be decremented by one. + +Because the contents of the Layer 3 packet (the TTL value) have changed, the Layer 3 header checksum must be recalculated. And because both Layers 2 and 3 contents have changed, the Layer 2 checksum must be recalculated. In other words, the entire Ethernet frame must be rewritten before it goes into the egress queue. This also is accomplished efficiently in hardware. + +Multilayer Switching Exceptions + +To forward packets using the simultaneous decision processes described in the preceding section, the packet must be “MLS ready” and must require no additional decisions. For example, CEF can directly forward most IP and IPv6 packets between hosts. This occurs when the source and destination addresses (both MAC and IP) are already known and no other IP parameters must be manipulated. + +Other packets cannot be directly forwarded by CEF and must be handled in more detail. This is done by a quick inspection during the forwarding decisions. If a packet meets cri-teria such as the following, it is flagged for further processing and sent or “punted” to the switch CPU for process switching: + +■ ARP requests and replies + +■ IP packets requiring a response from a router (TTL has expired, maximum transmis-sion unit [MTU] is exceeded, fragmentation is needed, and so on) + +■ IP broadcasts that will be relayed as unicast (Dynamic Host Configuration Protocol [DHCP] requests, IP helper-address functions) + +■ Routing protocol updates + + + +www.allitebooks.com From the Library of Outcast Outcast +40 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Cisco Discovery Protocol (CDP) packets + +■ Packets needing encryption + +■ Packets triggering Network Address Translation (NAT) + +■ Legacy multiprotocol packets (IPX, AppleTalk, and so on) + +As you might expect, packets that are punted to the CPU cannot be forwarded as effi-ciently as ones that can be forwarded in hardware directly. The additional processing takes additional time and consumes CPU resources. Ideally, all packets should be for-warded in hardware, but that is not always possible. + +Tables Used in Switching + +Catalyst switches maintain several types of tables to be used in the switching process. The tables are tailored for Layer 2 switching or MLS and are kept in very fast memory so that many fields within a frame or packet can be compared in parallel. + + + + +Key Topic + +Content-Addressable Memory + +All Catalyst switch models use a CAM table for Layer 2 switching. As frames arrive on switch ports, the source MAC addresses are learned and recorded in the CAM table. The port of arrival and the VLAN both are recorded in the table, along with a time stamp. If a MAC address learned on one switch port has moved to a different port, the MAC address and time stamp are recorded for the most recent arrival port. Then, the previous entry +is deleted. If a MAC address is found already present in the table for the correct arrival port, only its time stamp is updated. + +Switches generally have large CAM tables so that many addresses can be looked up for frame forwarding. However, there is not enough table space to hold every possible +address on large networks. To manage the CAM table space, stale entries (addresses that have not been heard from for a period of time) are aged out. By default, idle CAM table entries are kept for 300 seconds before they are deleted. You can change the default set-ting using the following configuration command: +Switch(config)# mac address-table aging-time seconds + + +By default, MAC addresses are learned dynamically from incoming frames. You also can configure static CAM table entries that contain MAC addresses that might not be learned otherwise. To do this, use the following configuration command: +Switch(config)# mac address-table static mac-address vlan vlan-id interface type +mod/num + + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 41 + + +Note You should be aware that there is a slight discrepancy in the CAM table command syntax. Until Catalyst IOS version 12.1(11)EA1, the syntax for CAM table commands used the keywords mac-address-table. In more recent Cisco IOS versions, the syntax has +changed to use the keywords mac address-table (first hyphen omitted). The Catalyst 4500 and 6500 IOS Software are exceptions, however, and continue to use the mac-address-table keyword form. Many switch platforms support either syntax to ease the transition. + + +Exactly what happens when a host’s MAC address is learned on one switch port, and then the host moves so that it appears on a different switch port? Ordinarily, the host’s original CAM table entry would have to age out after 300 seconds, while its address was learned on the new port. To avoid having duplicate CAM table entries during that time, a switch purges any existing entries for a MAC address that has just been learned on a different switch port. This is a safe assumption because MAC addresses are unique, and a single host should never be seen on more than one switch port unless problems exist in the network. If a switch notices that a MAC address is being learned on alternating switch ports, it generates an error message that flags the MAC address as “flapping” between interfaces. + +Ternary Content-Addressable Memory + +In traditional routing, ACLs can match, filter, or control specific traffic. Access lists are made up of one or more access control entities (ACEs) or matching statements that are evaluated in sequential order. Evaluating an access list can take up additional time, adding to the latency of forwarding packets. + +In multilayer switches, however, all the matching process that ACLs provide is imple-mented in hardware called a TCAM. With a TCAM, a packet can be evaluated against an entire access list within a single table lookup. Most switches have multiple TCAMs so that both inbound and outbound security and QoS ACLs can be evaluated simultane-ously, or entirely in parallel with a Layer 2 or Layer 3 forwarding decision. + +The Catalyst IOS Software has two components that are part of the TCAM operation: + +■ Feature Manager (FM): After an access list has been created or configured, the Feature Manager software compiles, or merges, the ACEs into entries in the TCAM table. The TCAM then can be consulted at full frame-forwarding speed. + +■ Switching Database Manager (SDM): On some Catalyst switch models, the TCAM is partitioned into several areas that support different functions. The SDM software configures or tunes the TCAM partitions, if needed, to provide ample space for spe-cific switching functions. (The TCAM is fixed on Catalyst 4500 and 6500 platforms and cannot be repartitioned.) + + + + + + + +From the Library of Outcast Outcast +42 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +TCAM Structure + +The TCAM is an extension of the CAM table concept. Recall that a CAM table takes in an index or key value (usually a MAC address) and looks up the resulting value (usually a switch port or VLAN ID). Table lookup is fast and always based on an exact key match consisting of binary numbers made up of two possible values: 0 and 1 bits. + +TCAM also uses a table-lookup operation but is greatly enhanced to allow a more abstract operation. For example, binary values (0s and 1s) make up a key into the table, but a mask value also is used to decide which bits of the key are actually relevant. This effectively makes a key consisting of three input values: 0, 1, and X (do not care) bit values—a threefold or ternary combination. + +TCAM entries are composed of Value, Mask, and Result (VMR) combinations. Fields from frame or packet headers are fed into the TCAM, where they are matched against the value and mask pairs to yield a result. As a quick reference, these can be described as follows: + +■ Values are always 134-bit quantities, consisting of source and destination addresses and other relevant protocol information—all patterns to be matched. The informa-tion concatenated to form the value depends on the type of access list, as shown in Table 2-2. Values in the TCAM come directly from any address, port, or other proto-col information given in an ACE, up to a maximum of 134 bits. + +Table 2-2 TCAM Value Pattern Components + + +Access List Type +Ethernet + +ICMP + +Extended IP using TCP/UDP + + +Other IP + +IGMP + +Value and Mask Components (Number of Bits) +Source MAC (48), destination MAC (48), EtherType (16) + +Source IP (32), destination IP (32), protocol (16), ICMP code (8), ICMP type (4), IP type of service (ToS) (8) +Source IP (32), destination IP (32), protocol (16), IP ToS (8), source port (16), source operator (4), destination port (16), destination operator (4) +Source IP (32), destination IP (32), protocol (16), IP ToS (8) + +Source IP (32), destination IP (32), protocol (16), IP ToS (8), IGMP message type (8) + + + +■ Masks are also 134-bit quantities, in exactly the same format, or bit order, as the values. Masks select only the value bits of interest; a mask bit is set to mark a value bit to be exactly matched or is not set to mark a value bit that does not matter. The masks used in the TCAM stem from address or bit masks in ACEs. + +■ Results are numeric values that represent what action to take after the TCAM lookup occurs. Whereas traditional access lists offer only a permit or deny result, TCAM lookups offer a number of possible results or actions. For example, the result can be a permit or deny decision, an index value to a QoS policer, a pointer to a next-hop routing table, and so on. + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 43 + + +Note This section discusses TCAM from an IPv4 perspective. When a dual IPv4-IPv6 SDM template is used, the TCAM becomes more limited in size. Because IPv6 addresses are 128 bits in length, some address compression must be used to store them in TCAM entries. + + + + +Key Topic + +The TCAM is always organized by masks, where each unique mask has eight value pat-terns associated with it. For example, the Catalyst 6500 TCAM (one for security ACLs and one for QoS ACLs) holds up to 4096 masks and 32,768 value patterns. The trick is that each of the mask-value pairs is evaluated simultaneously, or in parallel, revealing the +best or longest match in a single table lookup. + + +TCAM Example +Figure 2-5 shows how the TCAM is built and used. This is a simple example and might or might not be identical to the results that the Feature Manager produces because the ACEs might need to be optimized or rewritten to achieve certain TCAM algorithm requirements. + +access-list 100 permit tcp host 192.168.199.14 10.41.0.0 0.0.255.255 eq telnet access-list 100 permit ip any 192.168.100.0 0.0.0.255 +access-list 100 deny udp any 192.168.5.0 0.0.0.255 gt 1024 +access-list 100 deny udp any 192.168.199.0 0.0.0.255 range 1024 2047 + + +Masks (134 bits) + +Value Patterns (134 bits) + + + +IP IP Protocol ToS + +Src S Port +Source IP port LOU Dest IP + +Dest D Port port LOU + + +Result + + + + + + + + +Frame or Packet Header + +Mask 1 TCP 192.168.199.14 +Match 32 bits of Src IP +(255.255.255.255) +Match 16 bits of Dest IP (0.0.255.255) +All other bits XXX +(don't care) + +Mask 2 UDP +Match 24 bits UDP of Dest IP +(0.0.0.255) +All other bits XXX +(don't care) + + +10.41.0.0 23 permit + + + + + + +192.168.100.0 permit 192.168.5.0 A1 deny +192.168.199.0 B1:2 deny + + + +Mask 3 +... + + + + + + +A Mask n +... B + +LOU register pairs 1 2 +gt 1024 +range start range end 1024 2047 + + +Figure 2-5 How an Access List Is Merged into TCAM + + +From the Library of Outcast Outcast +44 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The sample access list 100 (extended IP) is configured and merged into TCAM entries. First, the mask values must be identified in the access list. When an address value and a corresponding address mask are specified in an ACE, those mask bits must be set for +matching. All other mask bits can remain in the “do not care” state because they will not be used. + +The access list contains only three unique masks: one that matches all 32 bits of the source IP address (found with an address mask of 0.0.0.0 or the keyword host), one that matches 16 bits of the destination address (found with an address mask of 0.0.255.255), and one that matches only 24 bits of the destination address (found with an address mask of 0.0.0.255). The keyword any in the ACEs means “match anything” or “do not care.” + +The three unique masks are placed into the TCAM. Then, for each mask, all possible value patterns are identified. For example, a 32-bit source IP mask (Mask 1) can be found only in ACEs with a source IP address of 192.168.199.14 and a destination of 10.41.0.0. (The rest of Mask 1 is the destination address mask 0.0.255.255.) Those address values are placed into the first value pattern slot associated with Mask 1. Mask 2 (0.0.255.255) has three value patterns: destination addresses 192.168.100.0, 192.168.5.0, and 192.168.199.0. Each of these is placed in the three pattern positions of Mask 2. This process continues until all ACEs have been merged. + +When a mask’s eighth pattern position has been filled, the next pattern with the same mask must be placed under a new mask in the table. A bit of a balancing act occurs to try to fit all ACEs into the available mask and pattern entries without an overflow. + +Port Operations in TCAM + +You might have noticed that matching strictly based on values and masks covers only ACE statements that involve exact matches (either the eq port operation keyword or no Layer 4 port operations). For example, ACEs such as the following involve specific address values, address masks, and port numbers: +access-list test permit ip 192.168.254.0 0.0.0.255 any +access-list test permit tcp any host 192.168.199.10 eq www + +What about ACEs that use port operators, where a comparison must be made? Consider the following: +access-list test permit udp any host 192.168.199.50 gt 1024 +access-list test permit tcp any any range 2000 2002 + +A simple logical operation between a mask and a pattern cannot generate the desired result. The TCAM also provides a mechanism for performing a Layer 4 operation or com-parison, also done during the single table lookup. If an ACE has a port operator, such as gt, lt, neq, or range, the Feature Manager software compiles the TCAM entry to include the use of the operator and the operand in a logical operation unit (LOU) register. Only +a limited number of LOUs are available in the TCAM. If there are more ACEs with com-parison operators than there are LOUs, the Feature Manager must break up the ACEs into multiple ACEs with only regular matching (using the eq operator). + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 45 + +In Figure 2-5, two ACEs require a Layer 4 operation: + +■ One that checks for UDP destination ports greater than 1024 + +■ One that looks for the UDP destination port range 1024 to 2047 + +The Feature Manager checks all ACEs for Layer 4 operation and places these into LOU register pairs. These can be loaded with operations, independent of any other ACE parameters. The LOU contents can be reused if other ACEs need the same comparisons and values. After the LOUs are loaded, they are referenced in the TCAM entries that need them. This is shown by LOUs A1 and the B1:2 pair. A finite number (actually, a rather small number) of LOUs are available in the TCAM, so the Feature Manager software must use them carefully. + +Managing Switching Tables + +You can display or query the switching tables to verify the information that the switch has learned. As well, you might want to check the tables to find out on which switch port a specific MAC address has been learned. You can also manage the size of the various switching tables to optimize performance. + +CAM Table Operation + +To view the contents of the CAM table, you can use the following form of the show mac address-table EXEC command: +Switch# show mac address-table dynamic [ address mac-address | interface type mod/num | vlan vlan-id] + +The entries that have been learned dynamically will be shown. You can add the address keyword to specify a single MAC address, or the interface or vlan keyword to see addresses that have been learned on a specific interface or VLAN. + +For example, assume that you need to find the learned location of the host with MAC address 0050.8b11.54da. The show mac address-table dynamic address 0050.8b11.54da command might produce the output in Example 2-1. + +Example 2-1 Determining Host Location by MAC Address + +Switch# show mac address-table dynamic address 0050.8b11.54da +Mac Address Table +-------------------------------------------- + + +Vlan Mac Address +---- ----------- +54 0050.8b11.54da + +Type +---- +DYNAMIC + +Ports +----- +Gi1/0/1 + +Total Mac Addresses for this criterion: 1 +Switch# + + + + +From the Library of Outcast Outcast +46 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +From this output, you can see that the host is somehow connected to interface Gigabit Ethernet 1/0/1, on VLAN 54. + + +Tip If your Catalyst IOS switch is not accepting commands of the form mac address-table, try adding a hyphen between the keywords. For example, the Catalyst 4500 and 6500 most likely will accept show mac-address-table instead. + + +Suppose that this same command produced no output, showing nothing about the inter-face and VLAN where the MAC address is found. What might that mean? Either the host has not sent a frame that the switch can use for learning its location, or something odd +is going on. Perhaps the host is using two network interface cards (NICs) to load balance traffic; one NIC is only receiving traffic, whereas the other is only sending. Therefore, the switch never hears and learns the receiving-only NIC address. + +To see all the MAC addresses that are currently found on interface Gigabit Ethernet 1/0/29, you could use the show mac address-table dynamic interface gig1/0/29 com-mand. The output shown in Example 2-2 indicates that only one host has been learned on the interface. Perhaps only a single PC connects to that interface. + +Example 2-2 Determining Hosts Active on an Interface + +Switch# show mac address-table dynamic interface gigabitethernet1/0/29 +Mac Address Table +----------------------------------------------- + + +Vlan Mac Address +---- ----------- +537 0013.7297.3d4b + +Type +---- +DYNAMIC + +Ports +----- +Gi1/0/29 + +Total Mac Addresses for this criterion: 1 +Switch# + +However, suppose the same command is used to check interface Gigabit Ethernet 1/1/1. The output shown in Example 2-3 lists many MAC addresses—all found on a single inter-face. How can so many addresses be learned on one switch interface? This interface must lead to another switch or another part of the network where other devices are located. As frames have been received on Gigabit Ethernet 1/1/1, coming from the other devices, the local switch has added the source MAC addresses into its CAM table. + +Example 2-3 Finding Many Hosts on an Interface + +Switch# show mac address-table dynamic interface gig1/1/1 +Mac Address Table +------------------------------------------------ + +Vlan Mac Address Type Ports + + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 47 + + +---- ----------- +580 0000.0c07.ac01 +580 0007.0e0b.f918 +580 000f.1f78.1094 +580 0011.43ac.b083 +580 0011.bb2d.3f6e +580 0014.6a86.1f1e +580 0014.6a86.1f3d +580 0014.6a86.1f3f +580 0014.6a86.1f47 + +---- +DYNAMIC +DYNAMIC +DYNAMIC +DYNAMIC +DYNAMIC +DYNAMIC +DYNAMIC +DYNAMIC +DYNAMIC + +----- +Gi1/1/1 +Gi1/1/1 +Gi1/1/1 +Gi1/1/1 +Gi1/1/1 +Gi1/1/1 +Gi1/1/1 +Gi1/1/1 +Gi1/1/1 + +—More— + + +Tip Often, you need to know where a user with a certain MAC address is connected. In a large network, discerning at which switch and switch port a MAC address can be found might be difficult. Start at the network’s center, or core, and display the CAM table entry +for the user’s MAC address. Look at the switch port shown in the entry and find the neigh-boring switch connected to that port using CDP neighbor information. Then move to that switch and repeat the CAM table query process. Keep moving from switch to switch until you reach the edge of the network where the MAC address physically connects. + + +To see the CAM table’s size, use the show mac address-table count command, as shown in Example 2-4. MAC address totals are shown for each active VLAN on the switch, as well as the total number of spaces remaining in the CAM table. This can give you a good idea of the size of the CAM table and how many hosts are using the network. + +Example 2-4 Checking the Size of the CAM Table + +Switch# show mac address-table count +Mac Entries for Vlan 1: +--------------------------- +Dynamic Address Count : 0 +Static Address Count : 0 +Total Mac Addresses : 0 + +Mac Entries for Vlan 2: +---------------------------- +Dynamic Address Count : 89 +Static Address Count : 0 +Total Mac Addresses : 89 + +Mac Entries for Vlan 580: +----------------------------- +Dynamic Address Count : 244 +Static Address Count : 0 + + + +From the Library of Outcast Outcast +48 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Total Mac Addresses : 244 + +Total Mac Address Space Available: 5791 +Switch# + +CAM table entries can be cleared manually, if needed, by using the following EXEC command: +Switch# clear mac address-table dynamic [ address mac-address | interface type mod/num | vlan vlan-id] + + +TCAM Operation + +The TCAM in a switch is more or less self-sufficient. Access lists are compiled or merged automatically into the TCAM, so there is nothing to configure. The only concept you need to be aware of is how the TCAM resources are being used. You can use the show platform tcam utilization EXEC command shown in Example 2-5 to get an idea of the TCAM utilization. Compare the Used number of entries to the Max value. + +Example 2-5 Displaying TCAM Utilization + + +Switch# show platform tcam utilization +CAM Utilization for ASIC# 0 + +Unicast mac addresses: +IPv4 IGMP groups + multicast routes: +IPv4 unicast directly-connected routes: +IPv4 unicast indirectly-connected routes: +IPv4 policy based routing aces: +IPv4 qos aces: +IPv4 security aces: + + +Max +Masks/Values +6364/6364 +1120/1120 +6144/6144 +2048/2048 +452/452 +512/512 +964/964 + + +Used +Masks/Values +311/311 +8/8 +0/0 +28/28 +12/12 +21/21 +33/33 + + +Note: Allocation of TCAM entries per feature uses +a complex algorithm. The above information is meant +to provide an abstract view of the current TCAM utilization +Switch# + +TCAMs have a limited number of usable mask, value pattern, and LOU entries. If access lists grow to be large or many Layer 4 operations are needed, the TCAM tables and reg-isters can overflow. If that happens while you are configuring an ACL, the switch will generate syslog messages that flag the TCAM overflow situation as it tries to compile the ACL into TCAM entries. + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 49 + +Managing Switching Table Sizes + +High-end Cisco switches are designed for efficient multilayer switching at any location within a network. For example, the versatile Catalyst 4500 and 6500 models can be used equally well in the core, distribution, or access layer because their hardware contains ample switching engines and table space for any application. Other models, such as the 2960, 3750, and 3850, have a fixed architecture with limited switching table space. The CAM, FIB, and other tables must all share resources; for one table to grow larger, the oth-ers must grow smaller. + +Fortunately, you can select a preferred type of switching that, in turn, affects the relative size of the switching tables. To excel at Layer 2 switching, the CAM table should increase in size, whereas the FIB or routing table space should decrease. If a switch is used to route traffic, its FIB table space should grow and its CAM table should shrink. + +The SDM manages the memory partitions in a switch. You can display the current parti-tion preference and a breakdown of table sizes with the following EXEC command: +Switch# show sdm prefer + +Example 2-6 shows that the switch is operating with the “desktop default” memory template, which is tailored for the access layer. According to the numbers, the desktop default template provides a balanced mix of Layer 2 (unicast MAC addresses, or the CAM table) and Layer 3 (IPv4 unicast routes, or the FIB table), in addition to IPv4 ACLs, and some minimal support for IPv6. + +Example 2-6 Displaying the Current SDM Template + +Switch# show sdm prefer +The current template is "desktop default" template. +The selected template optimizes the resources in +the switch to support this level of features for +8 routed interfaces and 1024 VLANs. + +number of unicast mac addresses: 6K +number of IPv4 IGMP groups + multicast routes: 1K +number of IPv4 unicast routes: 8K +number of directly-connected IPv4 hosts: 6K +number of indirect IPv4 routes: 2K +number of IPv6 multicast groups: 64 +number of directly-connected IPv6 addresses: 74 +number of indirect IPv6 unicast routes: 32 +number of IPv4 policy based routing aces: 0 +number of IPv4/MAC qos aces: 0.5K +number of IPv4/MAC security aces: 0.875k +number of IPv6 policy based routing aces: 0 +number of IPv6 qos aces: 0 +number of IPv6 security aces: 60 +Switch# + + + +From the Library of Outcast Outcast +50 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +You can configure a switch to operate based on other SDM templates by using the fol-lowing global configuration command: +Switch(config)# sdm prefer template + +The switch must then be rebooted for the new template to take effect. Tables 2-3 and 2-4 list the template types along with the number of entries allowed in each memory parti-tion. The two shaded rows represent the CAM and FIB table spaces. To get a feel for the SDM templates, notice which function is favored in each of the template types. The uni-cast MAC addresses and unicast routes rows are highlighted as examples. + +Do not worry about memorizing the tables and their contents; instead, you should know how to display the current template and how to configure a new one. + +Table 2-3 IPv4 SDM Templates and Memory Partitions + +Memory Partition SDM Template Type Keyword + + + +Unicast MAC Addresses + +IPv4 IGMP Groups + Multicast Routes + +IPv4 Unicast Routes + +Directly Connected IPv4 Hosts + +Indirect IPv4 Routes + +IPv4 Policy-Based Routing ACEs + +IPv4/MAC QoS ACEs + +IPv4/MAC Security ACEs + +VLANs + +default +6 K + +1 K + +8 K + +6 K + +2 K + +0 + +0.5 K + +1 K + +1 K + +access vlan +4 K 12 K + +1 K 1 K + +6 K 0 + +4 K 0 + +2 K 0 + +0.5 K 0 + +0.5 K 0.5 K + +2 K 1 K + +1 K 1 K + +routing +3 K + +1 K + +11 K + +3 K + +8 K + +0.5 K + +0.375 K + +1 K + +1 K + + + + +Table 2-4 Dual IPv4-IPv6 SDM Templates and Memory Partitions + +Memory Partition SDM Template Type Keyword + +dual-ipv4-and-ipv6 indirect-ipv4-and-ipv6 + + + +Unicast MAC Addresses + +IPv4 IGMP Groups + Multicast Routes +IPv4 Unicast Routes + +Directly Connected IPv4 Hosts + +default +2 K + +1 K + +3 K + +2 K + +vlan +8 K + +1 K IGMP 0 multicast +0 + +0 + +routing +1.5 K 2 K + +1 K 1 K + +2.7 K 4 K + +1.5 K 2 K + + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 51 + + +Memory Partition SDM Template Type Keyword + +dual-ipv4-and-ipv6 indirect-ipv4-and-ipv6 + + + +Indirect IPv4 Routes + +IPv6 Multicast Groups + +Directly Connected IPv6 Addresses +Indirect IPv6 Unicast Routes + +IPv4 Policy-Based Routing ACEs +IPv4/MAC QoS ACEs + +IPv4/MAC Security ACEs + +IPv6 Policy-Based Routing ACEs +IPv6 QoS ACEs + +IPv6 Security ACEs + +default vlan 1 K 0 +1 K 1 K 2 K 0 + +1 K 0.125 K + +0 0 + +0.5 K 0.5 K + +1 K 1 K + +0 0 + +0.5 K 0.5 K + +0.5 K 0.5 K + +routing +1.2 K 2 K 1 K 1 K 1.5 K 2 K + +1.25 K 3 K + +0.25 K 0.125 K + +0.5 K 0.5 K + +0..5 K 0.625 K + +0.25 K 0.125 K + +0.5 K 0.125 K + +0.5 K 0.125 K + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +52 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 2-5 lists a reference of these key topics and the page +numbers on which each is found. + + +Table 2-5 Key Topics for Chapter 2 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +List + +Paragraph + +Paragraph + +Discusses collision domain 32 + +Discusses flooding and unknown unicast flooding 34 + +Describes topology-based switching 37 + +Discusses the CAM table 40 + +Explains TCAM operation 43 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +collision domain, flooding, unknown unicast flooding, CEF, FIB, CAM, TCAM, SDM + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the CAM-related commands, cover the right side of Table 2-6 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. For most of the skills covered in this chapter, remember that the commands always involve the keywords mac address-table. + + + +From the Library of Outcast Outcast +Chapter 2: Switch Operation 53 + + +Table 2-6 + +Task + + +Commands Used to Monitor and Manipulate the CAM Table + +Command + + + +Find the location of a specific MAC address. + +Display all MAC addresses learned on a specific interface. +Display the current CAM table size. + +Enter a static CAM table entry. + +Clear a CAM entry. + + +Display TCAM utilization. + +Display the current memory template. + +Configure a preferred memory template. + + +show mac address-table dynamic address mac-address +show mac address-table dynamic interface type number +show mac address-table count + +mac address-table static mac-address vlan vlan-id {drop | interface type number} +clear mac address-table dynamic [address mac-address | interface type number | vlan vlan-id] +show platform tcam utilization + +show sdm prefer + +sdm prefer template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Ethernet Concepts: This section discusses the concepts and technology behind various forms of Ethernet media. +■ Connecting Switches and Devices: This section discusses the physical cabling and connectivity used with Catalyst switches. +■ Switch Port Configuration: This section cov-ers the configuration steps and commands needed to use Ethernet, Fast Ethernet, and Gigabit and +10-Gigabit Ethernet switch ports in a network. + +■ Discovering Connected Devices: This section explains the protocols that can be used to automati-cally discover other devices that are connected to a Catalyst switch. +■ Using Power over Ethernet: This section discuss-es how a Catalyst switch can provide power to oper-ate devices such as wireless access points and Cisco IP phones. + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 3 + + + + + + +Switch Port Configuration + + +This chapter presents the various Ethernet network technologies used to establish switched connections within the campus network. You can connect a switch to an end device such as a PC or to another switch. The chapter also details the switch commands required for configuring and troubleshooting Ethernet LAN ports. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 3-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 3-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Ethernet Concepts + +Connecting Switches and Devices + +Switch Port Configuration + +Discovering Connected Devices + +Using Power over Ethernet + +Questions Covered in This Section +1–6 + +7 + +8–10 + +11–12 + +13–14 + + + +1. What does the IEEE 802.3 standard define? + +a. Spanning Tree Protocol + +b. Token Ring + +c. Ethernet + +d. Switched Ethernet + + + + + + +From the Library of Outcast Outcast +56 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. At what layer are traditional 10-Mbps Ethernet, Fast Ethernet, and Gigabit Ethernet the same? + +a. Layer 1 + +b. Layer 2 + +c. Layer 3 + +d. Layer 4 + +3. At what layer are traditional 10-Mbps Ethernet, Fast Ethernet, and Gigabit Ethernet different? + +a. Layer 1 + +b. Layer 2 + +c. Layer 3 + +d. Layer 4 + +4. What is the maximum cable distance for an Ethernet, Fast Ethernet, and Gigabit Ethernet connection over unshielded twisted pair cabling? + +a. 100 feet + +b. 100 m + +c. 328 m + +d. 500 m + +5. Ethernet autonegotiation determines which of the following? + +a. Spanning-tree mode + +b. Duplex mode + +c. Quality of service mode + +d. MAC address learning + +e. Device discovery + +6. Which of the following cannot be automatically determined and set if the far end of a connection does not support autonegotiation? + +a. Link speed + +b. Link duplex mode + +c. Link media type + +d. MAC address + + + + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 57 + +7. Which of these is not a standard type of gigabit interface converter (GBIC) or small form factor pluggable (SFP) module? + +a. 1000BASE-LX/LH + +b. 1000BASE-T + +c. 1000BASE-FX + +d. 1000BASE-ZX + +8. Assume that you have just entered the configure terminal command. You want to configure the speed and duplex of the first 10/100/1000 twisted-pair Ethernet inter-face on the first Cisco Catalyst switch stack member to 1-Gbps full-duplex mode. Which one of these commands should you enter first? +a. speed 1000 mbps + +b. speed 1000 + +c. interface gigabitethernet 1/0/1 + +d. interface gigabit ethernet 1/0/1 + +e. duplex full + +9. If a switch port is in the errdisable state, what is the first thing you should do? + +a. Reload the switch. + +b. Use the clear errdisable port command. + +c. Use the shut and no shut interface-configuration commands. + +d. Determine the cause of the problem. + +10. Which of the following show interface output information can you use to diagnose a switch port problem? + +a. Port state + +b. Port speed + +c. Input errors + +d. Collisions + +e. All answers are correct + +11. Which one of the following is a standards-based protocol that can be used to dis-cover and collect information about connected devices? + +a. CDP + +b. STP + +c. ICMP + +d. LLDP + + + + +From the Library of Outcast Outcast +58 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +12. Which one of the following statements is true about a Catalyst switch? + +a. Neither CDP nor LLDP are enabled by default. + +b. CDP is enabled and LLDP is disabled by default. + +c. CDP is disabled and LLDP is enabled by default. + +d. Both CDP and LLDP are enabled by default. + +13. For a Catalyst switch to offer Power over Ethernet to a device, what must occur? + +a. Nothing; power always is enabled on a port. + +b. The switch must detect that the device needs inline power. + +c. The device must send a CDP message asking for power. + +d. The device must send an LLDP message asking for power. + +e. The switch is configured to turn on power to the port. + +14. Which one of these commands can enable Power over Ethernet to a switch interface? + +a. inline power enable + +b. inline power on + +c. power inline on + +d. power inline auto + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 59 + +Foundation Topics + + +Ethernet Concepts + +This section reviews the varieties of Ethernet and their application in a campus network. The bandwidth requirements for a network segment are determined by the types of appli-cations in use, the traffic flows within the network, and the size of the user community served. Ethernet scales to support increasing bandwidths; the Ethernet medium should be chosen to match the need at each point in the campus network. As network bandwidth requirements grow, you can scale the links between access, distribution, and core layers to match the load. + +Ethernet Overview + + + + + + + + + + + + + + + + + + + + +Key Topic + +Ethernet is a LAN technology based on the Institute of Electrical and Electronics Engineers (IEEE) 802.3 standard. Ethernet offers a specific bandwidth between end users. In its most basic form, Ethernet is a shared medium that becomes both a collision and +a broadcast domain. As the number of users on the shared media increases, so does the probability that a user is trying to transmit data at any given time. When one user trans-mits at about the same time as another, a collision occurs. In other words, both users cannot transmit data at the same time if they both are sharing the same network media. + +Ethernet is based on the carrier sense multiple access collision detect (CSMA/CD) tech-nology, which requires that transmitting stations back off for a random period of time when a collision occurs. If a station must wait its turn to transmit, it cannot transmit and receive at the same time. This is called half-duplex operation. + +The more crowded an Ethernet segment becomes, the number of stations likely to be transmitting at a given time increases. Imagine standing in a crowded room trying to tell a story. Instead of attempting to talk over the crowd, you stop and politely wait while other people talk. The more people there are in the room, the more difficult talking becomes. Likewise, as an Ethernet segment becomes more crowded, it becomes more inefficient. + +Ethernet switching addresses this problem by breaking a shared segment up into many individual segments. An Ethernet switch can allocate a dedicated amount of bandwidth to each of its interfaces or ports. The resulting increased network performance occurs by reducing the number of users connected to an Ethernet segment. In effect, collisions are less probable and the collision domain is reduced in size. Ideally, each switch port is connected to only one end user, which in turn, limits the collision domain to that single switch port. + +Because switched Ethernet can remove the possibility of collisions, stations do not have to listen to each other to take a turn transmitting on the wire. Instead, stations can oper-ate in full-duplex mode—transmitting and receiving simultaneously. Full-duplex mode further increases network performance by effectively doubling the net throughput on +each switch port. + + + + +From the Library of Outcast Outcast +60 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Scaling Ethernet + +The original Ethernet standard was based on a bandwidth of 10 Mbps per network segment. Over time, networking technology has evolved to offer higher amounts of bandwidth. Instead of requiring campuses to invest in a completely new technology to leverage ever increasing bandwidth, the networking industry has developed higher-speed generations of Ethernet that are based on existing Ethernet standards. + +Typically, each generation of Ethernet offers a ten-fold bandwidth improvement. Even so, the Ethernet cabling schemes, CSMA/CD operation, and all upper-layer protocol opera-tions are maintained with each generation. The net result is the same data link Media Access Control (MAC) layer (OSI Layer 2) merged with a new physical layer (OSI Layer 1). Table 3-2 lists several generations and bandwidths that are included in the IEEE 802.3 standard. + +Table 3-2 Generations of Ethernet + + +Ethernet Technology +Ethernet + +Fast Ethernet + +Gigabit Ethernet + +10-Gigabit Ethernet + +40-Gigabit Ethernet + +100-Gigabit Ethernet + +Segment Bandwidth +10 Mbps + +100 Mbps + +1 Gbps + +10 Gbps + +40 Gbps + +100 Gbps + + + +The following sections provide a brief overview of the successive Ethernet technologies and their cabling requirements. + +Fast Ethernet + +Fast Ethernet supports a maximum of 100 Mbps untwisted pair (UTP) or fiber-optic cabling. Table 3-3 lists the specifications for Fast Ethernet that define the media types and distances. Notice that UTP cabling is limited to 100 meters, which is identical to the original 10 Mbps Ethernet. + +Table 3-3 Cabling Specifications for Fast Ethernet + + +Technology +100BASE-TX + +100BASE-T2 + +100BASE-T4 + +Wiring Type +EIA/TIA Category 5 UTP + +EIA/TIA Category 3, 4, 5 UTP + +EIA/TIA Category 3, 4, 5 UTP + +Pairs Cable Length +2 100 m + +2 100 m + +4 100 m + + + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 61 + + + +Technology +100BASE-FX + +Wiring Type Pairs +Multimode fiber (MMF); 62.5-micron 1 core, 125-micron outer cladding (62.5/125) +Single-mode fiber (SMF) 1 + +Cable Length +400 m half duplex or 2000 m full duplex +10 km + + + +Cisco provides one additional capability to Fast Ethernet, which allows several Fast Ethernet links to be bundled together for increased throughput. Fast EtherChannel (FEC) allows two to eight full-duplex Fast Ethernet links to act as a single physical link, for +400- to 1600-Mbps duplex bandwidth. This technology is described in greater detail in Chapter 10, “Aggregating Switch Links.” + + +Gigabit Ethernet + + + +Key Topic + +You can scale a Fast Ethernet network by an additional order of magnitude with Gigabit Ethernet (which supports 1000 Mbps or 1 Gbps) using the same IEEE 802.3 Ethernet frame format as before. However, the physical layer has been modified to increase data-transmission speeds. Two technologies were merged to gain the benefits of each: the IEEE 802.3 Ethernet standard and the American National Standards Institute (ANSI) X3T11 Fibre Channel. IEEE 802.3 provided the foundation of frame format, CSMA/CD, full duplex, and other Ethernet characteristics. Fibre Channel provided a base of high-speed application-specific integrated circuits (ASICs), optical components, and encoding/ decoding and serialization mechanisms. + +Gigabit Ethernet supports several cabling types, referred to as 1000BASE-X. Table 3-4 +lists the cabling specifications for each type. + + + + +Table 3-4 + +GE Type + + +Gigabit Ethernet Cabling and Distance Limitations + +Wiring Type Pairs Cable Length + + + +1000BASE-CX + +1000BASE-T + +1000BASE-SX + + + +1000BASE-LX/LH + + + +1000BASE-ZX + +Shielded twisted pair (STP) 1 25 m + +EIA/TIA Category 5 UTP 4 100 m + +Multimode fiber (MMF) with 62.5-micron 1 275 m core; 850-nm laser 1 550 m MMF with 50-micron core; 850-nm laser +MMF with 62.5-micron core; 1300-nm laser 1 550 m + +MMF with 50-micron core; 1300-nm laser 1 550 m + +SMF with 9-micron core; 1300-nm laser 1 10 km + +SMF with 9-micron core; 1550-nm laser 1 70 km + +SMF with 8-micron core; 1550-nm laser 1 100 km + + + + + + +From the Library of Outcast Outcast +62 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Most Gigabit Ethernet switch ports used between switches are fixed at 1000 Mbps. However, other switch ports can support a fallback to Fast or Legacy Ethernet speeds. The “Gigabit over copper” solution that the 1000BASE-T media provides can be autone-gotiated between end nodes to use the highest common speed—10 Mbps, 100 Mbps, or 1000 Mbps. These ports are often called 10/100/1000 ports to denote the triple speed. + +Cisco has extended the concept of Fast EtherChannel to bundle several Gigabit Ethernet links to act as a single physical connection. With Gigabit EtherChannel (GEC), two to eight full-duplex Gigabit Ethernet connections can be aggregated, for a single logical link of up to 16-Gbps throughput. Link aggregation and the EtherChannel technology are described further in Chapter 6. + + + + + +Key Topic + +10-Gigabit Ethernet + +To meet the demand for aggregating many Gigabit Ethernet links over a single connec-tion, 10-Gigabit Ethernet was developed. Again, the Layer 2 characteristics of Ethernet have been preserved; the familiar 802.3 frame format and size, along with the MAC pro-tocol, remain unchanged. + +The 10-Gigabit Ethernet, also known as 10GE, and the IEEE 802.3ae standard differ from their predecessors only at the physical layer (PHY); 10GE operates only at full duplex. The standard defines several different transceivers that can be used as Physical Media +Dependent (PMD) interfaces. These are classified into the following: + + +■ LAN PHY: Interconnects switches in a campus network, predominantly in the core layer + +■ WAN PHY: Interfaces with existing synchronous optical network (SONET) or syn-chronous digital hierarchy (SDH) networks that were typically found in metropoli-tan-area networks (MAN) + +The PMD interfaces also have a common labeling scheme, much as Gigabit Ethernet does. Whereas Gigabit Ethernet uses 1000BASE-X to indicate the media type, 10-Gigabit Ethernet uses 10GBASE-X. Table 3-5 lists the different PMDs defined in the standard, along with the type of fiber and distance limitations. All the fiber-optic PMDs can be used as either a LAN or a WAN PHY, except for the 10GBASE-LX4, which is only a LAN PHY. Be aware that the extra-long wavelength PMDs carry a significantly greater expense than the others. + +Table 3-5 10-Gigabit Ethernet PMD Types and Characteristics + + +PMD Type* +10GBASE-SR/SW (850 nm serial) + +Fiber Medium +MMF: 50 micron + +MMF: 50 micron (2GHz* km modal bandwidth) + +MMF: 62.5 micron + +Maximum Distance +66m + +300m + +33m + + + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 63 + + + +PMD Type* +10GBASE-LR/LW (1310 nm serial) 10GBASE-ER/EW(1550 nm serial) +10GBASE-LX4/LW4 (1310 nm WWDM) + + +10GBASE-CX4 + +Fiber Medium SMF: 9 micron SMF: 9 micron MMF: 50 micron +MMF: 62.5 micron + +SMF: 9 micron + +Copper: CX4 with Infiniband connectors + +Maximum Distance 10 km +40 km 300 m +300 m + +10 km + +15 m + + +Transceiver types are denoted by a two-letter suffix. The first letter specifies the wavelength used: S = short, L = long, E = extra-long wavelength. The second letter specifies the PHY type: R = LAN PHY, W = WAN PHY. For LX4 and LW4, L refers to a long wavelength, X and W refer to the coding used, and 4 refers to the number of wavelengths transmitted. WWDM is wide-wavelength division multiplexing. + +Cisco Catalyst switches supported 10-Gigabit Ethernet PMDs in the form of XENPAK, X2, and SFP+ transceivers. Generally, the X2 form factor is smaller than the XENPAK, and the SFP+ is smaller still, allowing more port density on a switch module. + +For the most current switch compatibility listing, refer to the “Cisco 10-Gigabit Ethernet Transceiver Modules Compatibility Matrix” document at http://www.cisco.com/en/US/ docs/interfaces_modules/transceiver_modules/compatibility/matrix/OL_6974.html. + +Beyond 10-Gigabit Ethernet + +With 10-Gigabit Ethernet links extending further toward the access layer, even higher bandwidth is needed to aggregate traffic in the distribution and core layers, as well as in the data center. Some Catalyst switches now offer 40-Gigabit Ethernet and 100-Gigabit Ethernet capabilities. + +You have already learned that Ethernet bandwidth increases ten-fold with each new gen-eration. For example, it is easy to see the progression from 1 Gbps to 10 Gbps to 100 Gbps, but 40 Gbps might seem like an odd multiple. The 40-Gigabit Ethernet standard bonds four individual 10-Gigabit Ethernet fiber optic links together using a single QSFP+ (quad SFP+) media module. 100 Gigabit Ethernet uses similar schemes to bond multiple channels or “lanes” together to leverage much greater bandwidth. In fact, both 40 and 100 Gigabit Ethernet are defined by the same 802.3ba standard. + + +Tip 40- and 100-Gigabit Ethernet are beyond the scope of the CCNP SWITCH course and exam. + + + +Duplex Operation over Ethernet Links + +Recall that when multiple devices share an Ethernet segment, they must cooperate with each other by not transmitting at the same time. This half-duplex mode of communication + + +From the Library of Outcast Outcast +64 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + + + + + + + + + + + + + + + + + + +Key Topic + +also means that a device cannot transmit and receive at the same time. To maximize the use of a segment, only two devices should be connected to it so that each one can transmit and receive simultaneously. The natural progression to full-duplex operation effectively doubles a link’s throughput. + +This maximum throughput is possible only when one device (a workstation, server, router, or another switch) is connected directly to a switch port. In addition, the devices at each end of the link must both support full-duplex operation, allowing each to transmit at will without having to detect and recover from collisions. + +The Fast Ethernet and Gigabit Ethernet specifications offer backward compatibility to support the lower Ethernet speeds. In the case of 100BASE-TX, switch ports often are called “10/100” ports, to denote the dual speed. Twisted pair Gigabit Ethernet ports support all three 10/100/1000 speeds. To provide support for alternate speeds, the two devices at each end of a network connection automatically can negotiate link capabili-ties so that they both can operate at a maximum common level. This negotiation involves detecting and selecting the highest physical layer technology (available bandwidth) and half-duplex or full-duplex operation. To properly negotiate a connection, both ends should be configured for autonegotiation. + +The link speed is determined by electrical signaling so that either end of a link can deter-mine what speed the other end is trying to use. If both ends of the link are configured to autonegotiate, they will use the highest speed that is common to them. + +A link’s duplex mode, however, is negotiated through an exchange of information. This means that for one end to successfully autonegotiate the duplex mode, the other end also must be set to autonegotiate. Otherwise, one end never will see duplex information from the other end and won’t be capable of determining the correct mode to use. If duplex autonegotiation fails, a switch port always falls back to its default setting—half-duplex— +because it offers the safety of collision detection. + + + +Tip Beware of a duplex mismatch when both ends of a link are not set for autonegotia-tion. During a mismatch, one end uses full duplex while the other end uses half duplex. The result is that the half-duplex station will detect a collision when both ends transmit; it will back off appropriately. The full-duplex station, however, will assume that it has the +right to transmit at any time. It will not stop and wait for any reason. This can cause errors on the link and poor response times between the stations. + + +Autonegotiation selects port speed and duplex mode according to a series of priorities. If both devices can support more than one speed, they will agree to use the highest speed available. Likewise, full-duplex mode will be chosen over half-duplex. As an example, if two devices can support 10/100/1000, both devices will select 1000 (1 Gbps) with full-duplex, if possible. + +To ensure proper configuration at both ends of a link, Cisco recommends that the appro-priate values for transmission speed and duplex mode be configured manually on switch ports. This precludes any possibility that one end of the link will change its settings, + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 65 + +resulting in an unusable connection. If you manually set the switch port, do not forget to manually set the device on the other end of the link accordingly. Otherwise, a speed or duplex mismatch between the two devices might occur. + + +Tip Speed and duplex mode can be configured or negotiated only on switch ports that support twisted-pair cabling. Fixed speed Gigabit and 10-Gigabit Ethernet ports always use full-duplex mode. + + + +Connecting Switches and Devices + +Switch deployment in a network involves two steps: physical connectivity and switch configuration. This section describes the connections and cabling requirements for devic-es in a switched network. + +Ethernet Port Cables and Connectors + +Catalyst switches support a variety of network connections, including all forms of Ethernet. In addition, Catalyst switches support several types of cabling, including UTP and optical fiber. + +All Catalyst switch families support 10/100/1000 autosensing for Gigabit Ethernet. These ports use RJ-45 connectors on UTP cabling to complete the connections. UTP cabling is arranged so that RJ-45 pins 1 and 2, 3 and 6, 4 and 5, and 7 and 8 form four twisted pairs. These pairs connect straight through to the far end. + +Gigabit Ethernet connections take a different approach by providing modular connectiv-ity options. Catalyst switch ports have standardized rectangular openings that can accept small form factor pluggable (SFP) modules. The SFP modules provide the media personal-ity for the port so that various cable media can connect. In this way, the switch chassis is completely modular and requires no major change to accept a new media type. Instead, the appropriate module is hot-swappable and is plugged into the switch to support the new media. SFP modules can use LC and MT-RJ fiber-optic and RJ-45 UTP connectors and are available for the following Gigabit Ethernet media: + +■ 1000BASE-SX: Short-wavelength connectivity using SC fiber connectors and MMF for distances up to 550 m (1804 feet). + +■ 1000BASE-LX/LH: Long-wavelength/long-haul connectivity using SC fiber connec-tors and either MMF or single-mode fiber (SMF); MMF can be used for distances up to 550 m (1804 feet), and SMF can be used for distances up to 10 km (32,810 feet). MMF requires a special mode-conditioning cable for fiber distances less than 100 m (328 feet) or greater than 300 m (984 feet). This keeps the GBIC from overdriving the far-end receiver on a short cable and lessens the effect of differential mode delay on a long cable. + + + + +From the Library of Outcast Outcast +66 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ 1000BASE-ZX: Extended-distance connectivity using SC fiber connectors and SMF; works for distances up to 70 km, and even to 100 km when used with premi-um-grade SMF. +■ 1000BASE-T: Sports an RJ-45 connector for fixed-speed four-pair UTP cabling; works for distances up to 100 m (328 feet). + +10-Gigabit Ethernet switch ports support the following rectangular X2 and SFP+ media modules: + +■ 10GBASE-CX4: Copper connectivity up to 15 m + +■ 10GBASE-SR: Short-reach connectivity using 62.5 or 50 micron MMF for distances up to 33 m or 300 m, respectively + +■ 10GBASE-LRM: Long-reach multimode connectivity using 62.5 or 50 micron MMF for distances up to 220 m + +■ 10GBASE-LX4: Provides connectivity using 62.5 or 50 micron MMF for distances up to 300 m + +■ 10GBASE-LR: Long-reach connectivity using SMF for distances up to 10 km + +■ 10GBASE-ER: Extended-reach connectivity using SMF for distances up to 40 km + +40- and 100-Gigabit Ethernet both use unique fiber optical modules that leverage mul-tiple fibers simultaneously. These technologies are beyond the scope of the SWITCH exam. + + +Caution The fiber-based modules could produce invisible laser radiation from the trans-mit connector. Therefore, always keep unused connectors covered with the rubber plugs, and do not ever look directly into the connectors. + + + +Switch Port Configuration + +You can configure the individual ports on a switch with various information and settings, as detailed in the following sections. + +Selecting Ports to Configure + +Before you can modify port settings, you must select one or more switch ports. Even though they have traditionally been called ports, Catalyst switches running the Cisco IOS Software refer to them as interfaces. + +To select a single switch port, enter the following command in global configuration mode: Key +Topic Switch(config)# interface type member/module/number + +A physical port is identified by its Ethernet type (fastethernet, gigabitethernet, tengiga-bitethernet), the stack member or chassis slot number, the module where it is located, + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 67 + +and the port number within the module. Most switches do not have individual modules within each stack member or chassis, so the module number is usually 0. As an example, the Gigabit Ethernet port numbered 14 on the first switch in a stack is selected for con-figuration using the following command: +Switch(config)# interface gigabitethernet 1/0/14 + +Naturally, you can select and configure multiple interfaces in this fashion, one at a time. If you need to make many configuration changes for each interface in a 48-port switch or in several switches in a stack, however, this can get very tedious. The Catalyst IOS Software also allows multiple interfaces to be selected in a single pass through the interface range configuration command. After you select the range, any interface configuration com-mands entered are applied to each of the interfaces in the range. + +To select several arbitrary ports for a common configuration setting, you can identify them as a “range” entered as a list. All port numbers and the commas that separate them must be separated with spaces. Use the following command in global configuration mode: +Switch(config)# interface range type member/module/number [, type member/module/ number ...] + +For example, to select interfaces Gigabit Ethernet 1/0/3, 1/0/7, 1/0/9, and 1/0/48 for con-figuration, you could use this command: +Switch(config)# interface range gigabitethernet 1/0/3 , gigabitethernet 1/0/7, gigabitethernet 1/0/9 , gigabitethernet 1/0/48 + +You also can select a continuous range of ports, from a beginning interface number to an ending interface number. Enter the interface type, stack member, and module, followed by the beginning and ending port number separated by a dash with spaces. Use this com-mand in global configuration mode: +Switch(config)# interface range type member/module/first-number – last-number + +For example, you could select all 48 Gigabit Ethernet interfaces on switch stack member 1 with the following command: +Switch(config)# interface range gigabitethernet 1/0/1 - 48 + +Finally, you sometimes need to make configuration changes to several groups or ranges of ports at the same time. You can define a macro that contains a list of interfaces or ranges of interfaces or both. Then, you can invoke the interface-range macro just before configuring the port settings. This applies the port settings to each interface that is iden-tified by the macro. The steps for defining and applying this macro are as follows: +Step 1. Define the macro name and specify as many lists and ranges of interfaces as needed. The command syntax is open ended but follows the list and range syntax of the interface range commands defined previously: +Switch(config)# define interface-range macro-name type member/module/ number [, type member/module/ number ...] [ type member/module/first-number – last-number] [...] + + +From the Library of Outcast Outcast +68 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Step 2. Invoke the macro called macro-name just as you would with a regular inter-face, just before entering any interface-configuration commands: + +Switch(config)# interface range macro macro-name + +Suppose, for example, that you need to configure Gigabit Ethernet 2/0/1, 2/0/3 through 2/0/5, 3/0/1, 3/0/10, and 3/0/32 through 3/0/48 with a set of identical interface configura-tions. You could use the following commands to define and apply a macro, respectively: + +Switch(config)# define interface-range MyGroup gig 2/0/1 , gig 2/0/3 – 2/0/5 , gig 3/0/1 , gig 3/0/10, gig 3/0/32 – 3/0/48 +Switch(config)# interface range macro MyGroup + +Remember to surround any commas and hyphens with spaces when you enter interface range commands. + +Identifying Ports + +You can add a text description to a switch port’s configuration to help identify it. This description is meant as a comment field only, as a record of port use or other unique information. The port description is included when displaying the switch configuration and interface information. + +To assign a comment or description to a port, enter the following command in interface configuration mode: +Switch(config-if)# description description-string + +The description string can have embedded spaces between words, if needed. To remove a description, use the no description interface-configuration command. + +As an example, interface Gigabit Ethernet 2/0/11 is labeled with “Printer in Bldg A, room 213”: +Switch(config)# interface gigabitethernet 2/0/11 +Switch(config-if)# description Printer in Bldg A, room 213 + +Port Speed + + + +Key Topic + +You can assign a specific speed to multiple-speed switch ports through interface con-figuration commands. Use the speed command to set a speed of 10, 100, 1000, or +Autonegotiate (the default). + + + +Note If a 10/100 or a 10/100/1000 port is assigned a speed of Auto, both its speed and duplex mode will be negotiated. + + +To specify the port speed on a particular Ethernet port, use the following interface-con-figuration command: +Switch(config-if)# speed {10 | 100 | 1000 | auto} + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 69 + +Port Duplex Mode + + + +Key Topic + +You also can assign a specific duplex mode to Ethernet-based switch ports. A port can operate in half-duplex, full-duplex, or autonegotiated mode. Autonegotiation is allowed only on UTP 10/100 and 10/100/1000 ports. In this mode, the port participates in a negotiation by attempting full-duplex operation first and then half-duplex operation if full-duplex operation is not successful. The autonegotiation process repeats whenever the link status changes. Be sure to set both ends of a link to the same speed and duplex set-tings to eliminate any chance that the two ends will be mismatched. + +To set the link mode on a switch port, enter the following command in interface configu-ration mode: +Switch(config-if)# duplex {auto | full | half} + + +For instance, you could use the commands in Example 3-1 to configure 10/100/1000 interfaces Gigabit Ethernet 3/0/1 for autonegotiation and 3/0/2 for 100-Mbps full duplex (no autonegotiation). + +Example 3-1 Configuring the Link Mode on a Switch Port + +Switch(config)# interface gigabitethernet 3/0/1 +Switch(config-if)# speed auto +Switch(config-if)# duplex auto +Switch(config-if)# interface gigabitethernet 3/0/2 +Switch(config-if)# speed 100 +Switch(config-if)# duplex full + + +Managing Error Conditions on a Switch Port + +A network-management application can be used to detect a serious error condition on a switch port. A switch can be polled periodically so that its port error counters can be +examined to see whether an error condition has occurred. If so, an alert can be issued so that someone can take action to correct the problem. + +Catalyst switches can detect error conditions automatically, without any further help. If a serious error occurs on a switch port, that port can be shut down automatically until someone manually enables the port again, or until a predetermined time has elapsed. + + + + + +Key Topic + +Detecting Error Conditions + +By default, a Catalyst switch detects an error condition on every switch port for every possible cause. If an error condition is detected, the switch port is put into the “errdis-able” state and is disabled. You can tune this behavior on a global basis so that only certain causes trigger any port being disabled. Use the following command in global con-figuration mode, where the no keyword is added to disable the specified cause: +Switch(config)# [no] errdisable detect cause [ all | cause-name] + + + + + +From the Library of Outcast Outcast +70 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +You can repeat this command to enable or disable more than one cause. One of the fol-lowing triggers the errdisable state: + +■ all : Detects every possible cause + +■ arp-inspection: Detects errors with dynamic ARP inspection + +■ bpduguard: Detects when a spanning-tree bridge protocol data unit (BPDU) is received on a port configured for STP PortFast + +■ dhcp-rate-limit: Detects an error with DHCP snooping + +■ dtp-flap: Detects when trunking encapsulation is changing from one type to another + +■ gbic-invalid: Detects the presence of an invalid GBIC or SFP module + +■ inline-power: Detects an error with offering PoE inline power + +■ l2ptguard: Detects an error with Layer 2 Protocol Tunneling + +■ link-flap: Detects when the port link state is “flapping” between the up and down states + +■ loopback: Detects when an interface has been looped back + +■ pagp-flap: Detects when an EtherChannel bundle’s ports no longer have consistent configurations + +■ pppoe-ia-rate-limit: Detects errors with PPPoE Intermediate Agent rate limiting + +■ psecure-violation: Detects conditions that trigger port security configured on a port + +■ psp: Detects an error related to protocol storm protection + +■ security-violation: Detects errors related to 802.1X security + +■ sfp-config-mismatch: Detects errors related to SFP configuration mismatches + +■ small-frame: Detects errors when VLAN-tagged packets are too small and arrive above a certain rate + +■ storm-control: Detects when a storm control theshhold has been exceeded on a port + +■ udld: Detects when a link is seen to be unidirectional (data passing in only one direction) + + +Automatically Recover from Error Conditions + +By default, ports put into the errdisable state must be re-enabled manually. This is done by issuing the shutdown command in interface configuration mode, followed by the no shutdown command. Before you reenable a port from the errdisable condition, you should always determine the cause of the problem so that the errdisable condition does not occur again. + +You can decide to have a switch automatically reenable an errdisabled port if it is more important to keep the link up until the problem can be resolved. To automatically reen- + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 71 + +able an errdisabled port, you first must specify the errdisable causes that can be reen-abled. Use the following command in global configuration mode, with a cause-name from the preceding list: +Switch(config)# errdisable recovery cause [all | cause-name] + +If any errdisable causes are configured for automatic recovery, the errdisabled port stays down for 300 seconds (5 minutes), by default. To change the recovery timer, use the fol-lowing command in global configuration mode: +Switch(config)# errdisable recovery interval seconds + +You can set the interval from 30 to 86,400 seconds (24 hours). + +For example, you could use the following commands to configure all switch ports to be reenabled automatically in 1 hour after a PoE error has been detected: + +Switch(config)# errdisable recovery cause inline-power +Switch(config)# errdisable recovery interval 3600 + +Remember that the errdisable causes and automatic recovery are configured globally; the settings apply to all switch ports. + +Enable and Use the Switch Port + +If the port is not enabled or activated automatically, use the no shutdown interface-configuration command. To view a port’s current speed and duplex state, use the show interfaces command. You can see a brief summary of all interface states with the show interfaces status command. + +Troubleshooting Port Connectivity + +Suppose that you are experiencing problems with a switch port. How would you trouble-shoot it? The following sections cover a few common troubleshooting techniques. + + + + + +Key Topic + +Looking for the Port State + +Use the show interfaces EXEC command to see complete information about the switch +port. The port’s current state is given in the first line of output, as in Example 3-2. + + +Example 3-2 Determining Port State Information + +Switch# show interfaces gigabitethernet 1/0/1 +GigabitEthernet1/0/1 is up, line protocol is up +Hardware is Gigabit Ethernet, address is 0009.b7ee.9801 (bia 0009.b7ee.9801) +MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, +reliability 255/255, txload 1/255, rxload 1/255 + + + + + +From the Library of Outcast Outcast +72 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The first up tells the state of the port’s physical or data link layer. If this is shown as down, the link is physically disconnected or a link cannot be detected. The second state, given as line protocol is up, shows the Layer 2 status. If the state is given as err-disabled, the switch has detected a serious error condition on this port and has automatically disabled it. + +To quickly see a list of states for all switch ports, use the show interface status EXEC command. Likewise, you can see a list of all ports in the errdisable state (and the cause) by using the show interface status err-disabled EXEC command. + + + + + +Key Topic + +Looking for Speed and Duplex Mismatches + +If a user notices slow response time or low throughput on a 10/100 or 10/100/1000 switch port, the problem could be a mismatch of the port speed or duplex mode between the switch and the host. This is particularly common when one end of the link is set to autonegotiate the link settings and the other end is not. + +Use the show interface command for a specific interface and look for any error counts that are greater than 0. For example, in the following output in Example 3-3, the switch port is set to autonegotiate the speed and duplex mode. It has decided on 100 Mbps at half duplex. Notice that there are many runts (packets that were truncated before they were fully received) and input errors. These are symptoms that a setting mismatch exists +between the two ends of the link. + + +Example 3-3 Determining Link Speed and Duplex Mode + +Switch# show interfaces gigabitethernet 1/0/13 +GigabitEthernet1/0/13 is up, line protocol is up +Hardware is Gigabit Ethernet, address is 00d0.589c.3e8d (bia 00d0.589c.3e8d) +MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive not set +Auto-duplex (Half), Auto Speed (100), media type is 10/100/1000BaseTX +ARP type: ARPA, ARP +Timeout 04:00:00 +Last input never, output 00:00:01, output hang never +Last clearing of "show interface" counters never +Queueing strategy: fifo +Output queue 0/40, 0 drops; input queue 0/75, 0 drops +5 minute input rate 0 bits/sec, 0 packets/sec +5 minute output rate 81000 bits/sec, 49 packets/sec +500867 packets input, 89215950 bytes +Received 12912 broadcasts, 374879 runts, 0 giants, 0 throttles +374879 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 watchdog, 0 multicast +0 input packets with dribble condition detected +89672388 packets output, 2205443729 bytes, 0 underruns + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 73 + +0 output errors, 0 collisions, 3 interface resets +0 babbles, 0 late collision, 0 deferred +0 lost carrier, 0 no carrier +0 output buffer failures, 0 output buffers swapped out + +Because this port is autonegotiating the link speed, it must have detected an electrical signal that indicated 100 Mbps in common with the host. However, the host most likely was configured for 100 Mbps at full duplex (not autonegotiating). The switch was incapa-ble of exchanging duplex information, so it fell back to its default of half duplex. Again, always make sure both ends of a connection are set to the same speed and duplex mode. + +Discovering Connected Devices + +Suppose that you have two switches and connect a cable between them. Through your knowledge of the physical cabling, you know that the switches are connected and that they are directly connected neighbors. If you are not onsite with the equipment, you might not have an easy way to discover or verify how the switches are connected or even if they are connected at all. This situation might grow even more frustrating in a large network with many devices, except that you have a couple of handy discovery tools at your disposal. A switch can also leverage the discovery tools to learn about connected devices and their power requirements. + + + + + + + + + + +Key Topic + +Cisco Discovery Protocol + +The Cisco Discovery Protocol (CDP) is designed as an automated method for Cisco devices to advertise their existence to other neighboring devices. CDP is a Cisco propri-etary protocol, so it is not always compatible with equipment from other manufacturers. CDP works in only one direction; advertisements are sent at regular intervals toward any listening device, but nothing is expected in return. + +CDP advertisements are sent at the data link layer (Layer 2) so that neighboring devices can receive and understand them regardless of what upper layer protocol is in use on an interface. The advertisements are not meant to be routed or forwarded on through a net-work. Rather, they are received and processed by only directly connected neighbors. + +Cisco devices such as routers and switches have CDP enabled by default. CDP advertise-ments are sent out every active interface at 60-second intervals. You can use the following command to display information about CDP advertisements that have been received by a switch: +Switch(config)# show cdp neighbors [ type member/module/number] [detail] + + +The show cdp neighbors command will display a summary of CDP neighbors that have been discovered on all switch ports, as shown in Example 3-4. Switch1 has received advertisements from three other devices (a switch, a wireless access point, and an IP phone) that are connected to local interfaces. The Cisco device platform model is dis-played, along with the port identifier on the connected device. + + + +From the Library of Outcast Outcast +74 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 3-4 Output from the show cdp neighbors Command + +Switch1# show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + +Device ID Local Intrfce Holdtme Capability Platform Port ID +Switch2 Gig 1/0/24 178 S I WS-C3750E Gig 2/0/24 +APb838.6181.0664 Gig 1/0/23 137 R T AIR-CAP37 Gig 0.1 +SEP2893FEA2E7F4 Gig 1/0/22 159 H P M IP Phone Port 1 +Switch1# + +If there are many discovered neighbors, you can specify the local switch interface where a single device is connected. For example, the show cdp neighbors gig1/0/24 command would display only the CDP entry for Switch 2. + +To see all of the CDP information received in an advertisement, add the detail keyword. Example 3-5 lists details learned about the CDP neighbor on interface Gigabit Ethernet 1/0/22, which is a Cisco IP phone. Notice that you find out useful information such as the software release, the neighbor’s duplex mode, and power requirements that have been negotiated. + +Example 3-5 Displaying Detailed CDP Neighbor Information + +Switch1# show cdp neighbors gig1/0/22 detail +------------------------- +Device ID: SEP2893FEA2E7F4 +Entry address(es): +IP address: 10.120.48.177 +Platform: Cisco IP Phone 7942, Capabilities: Host Phone Two-port Mac Relay +Interface: GigabitEthernet2/0/7, Port ID (outgoing port): Port 1 +Holdtime : 131 sec +Second Port Status: Down +Version : +SCCP42.9-3-1-1S +advertisement version: 2 +Duplex: full +Power drawn: 6.300 Watts +Power request id: 59380, Power management id: 3 +Power request levels are:6300 0 0 0 0 +Management address(es): +Switch1# + +Although CDP is enabled by default, you disable it globally with the no cdp run com-mand or reenable it with the cdp run global configuration command. Sometimes for security reasons, you might want to disable CDP advertisements on an individual inter-face so that devices (and people) on the other end of a switch port cannot learn about + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 75 + +your switch. You can control CDP operation with the following interface configuration command: + +Switch(config)# interface type member/module/number +Switch(config-if)# [no] cdp enable + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +Link Layer Discovery Protocol + +The Link Layer Discovery Protocol (LLDP) is similar to CDP, but is based on the IEEE 802.1ab standard. As a result, LLDP works in multivendor networks. It is also extensible because information is advertised by grouping attributes into Type-Length-Value (TLV) structures. For example, a device can advertise its system name with one TLV, its manage-ment address in another TLV, its port description in another TLV, its power requirements in another TLV, and so on. The LLDP advertisement then becomes a chain of various TLVs that can be interpreted by the receiving device. + +LLDP also supports additional TLVs that are unique to audio-visual devices such as VoIP phones. The LLDP Media Endpoint Device (LLDP-MED) TLVs carry useful device informa-tion like a network policy with VLAN numbers and quality of service information needed for voice traffic, power management, inventory management, and physical location data. + +LLDP supports the LLDP-MED TLVs by default, but it cannot send both basic and MED TLVs simultaneously on a switch port. Instead, LLDP sends only the basic TLVs to con-nected devices. If a switch receives LLDP-MED TLVs from a device, it will begin sending LLDP-MED TLVs back to the device. + +By default, LLDP is globally disabled on a Catalyst switch. To see if it is currently run-ning or not, use the show lldp command. You can enable or disable LLDP with the lldp run and no lldp run global configuration commands, respectively. + +Use the following command to display information about LLDP advertisements that have been received by a switch. +Switch(config)# show lldp neighbors [ type member/module/number] [detail] + +Use the show lldp neighbors command to see a summary of neighbors that have been discovered. Example 3-6 lists the same three neighboring devices that were discovered +with CDP in Example 3-4. + + +Example 3-6 Output from the show lldp neighbors Command + +Switch1# show lldp neighbors +Capability codes: +(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device +(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other + +Device ID +Switch2 +APb838 +SEP2893FEA2E7F4 + +Local Intf +Gi1/0/24 +Gi1/0/23 +Gi1/0/22 + +Hold-time +113 +91 +180 + +Capability +B +B,R +B,T + +Port ID +Gi2/0/24 +Gi0 +2893FEA2E7F4:P1 + +Total entries displayed: 2 +Switch1# + + +From the Library of Outcast Outcast +76 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +You can specify a switch interface to display the LLDP neighbor discovered there. Add the detail keyword to see all of the information about a neighbor. Example 3-7 lists the detailed information about the Cisco IP phone that is connected to interface Gigabit Ethernet 1/0/22. Notice that the bottom portion of the output contains parameters that were advertised in the LLDP-MED TLVs, such as the phone’s VLAN, quality of service, power configuration, and location. + +Example 3-7 Displaying Detailed LLDP Neighbor Information + +Switch1# show lldp neighbors gig1/0/22 detail +------------------------------------------------ +Chassis id: 10.120.48.177 +Port id: 2893FEA2E7F4:P1 +Port Description: SW PORT +System Name: SEP2893FEA2E7F4.voice.uky.edu +System Description: +Cisco IP Phone 7942G,V6, SCCP42.9-3-1-1S +Time remaining: 124 seconds +System Capabilities: B,T +Enabled Capabilities: B,T +Management Addresses: +IP: 10.120.48.177 +Auto Negotiation - supported, enabled +Physical media capabilities: +1000baseT(HD) +1000baseX(FD) +Symm, Asym Pause(FD) +Symm Pause(FD) +Media Attachment Unit type: 16 +Vlan ID: - not advertised + +MED Information: +MED Codes: +(NP) Network Policy, (LI) Location Identification +(PS) Power Source Entity, (PD) Power Device +(IN) Inventory + +H/W revision: 6 +F/W revision: tnp42.8-3-1-21a.bin +S/W revision: SCCP42.9-3-1-1S +Serial number: FCH1414A0BA +Manufacturer: Cisco Systems, Inc. +Model: CP-7942G +Capabilities: NP, PD, IN +Device type: Endpoint Class III +Network Policy(Voice): VLAN 837, tagged, Layer-2 priority: 5, DSCP: 46 +Network Policy(Voice Signal): VLAN 837, tagged, Layer-2 priority: 4, DSCP: 32 + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 77 + +PD device, Power source: Unknown, Power Priority: Unknown, Wattage: 6.3 +Location - not advertised + +Total entries displayed: 1 +Switch1# + +Once LLDP is enabled, advertisements are sent and received on every switch interface. You can control LLDP operation on an interface with the following command. +Switch(config-if)# [no] lldp {receive | transmit} + + +Tip Why should you choose to use LLDP over CDP? LLDP is standards-based so devices from different vendors can discover each other. Switches that use LLDP can also collect detailed location information from connected devices that can be exported to a Cisco Management Services Engine (MSE). The MSE offers a location service to track devices as they join and leave a network and change locations. + + + +Using Power over Ethernet + +A Cisco wireless access point or a Cisco IP phone is like any other node on the network; it must have power to operate. Power can come from the following three sources, as illus-trated in Figure 3-1. +1. An external AC adapter connected directly to the device + +2. A power injector, which connects to AC power near an Ethernet switch and provides DC power over the network data cable + +3. A switch capable of providing DC Power over Ethernet (PoE) over the network data cable + + + + + + + + + + + + + + +Key Topic + +The external AC adapter plugs into a normal AC wall outlet and provides 48V DC to the device. These adapters, commonly called wall warts, are handy if no other power source is available. However, if a power failure occurs in the room or outlet where the adapter is located, the powered device will fail. + +As an alternative, you can connect a regular data switch port to a power injector, which injects DC power onto the network cable leading to the powered device. The power injec-tor lets you use the network cabling for both power and data, but requires a connection to a normal AC power source. Typically, a power injector is connected to AC power in +a wiring closet close to the switch. One pitfall of using power injectors is that you need one injector and one AC power outlet per switch port! + +A more elegant solution is available as inline power or Power over Ethernet (PoE). Here, a 48V DC supply is provided to a device over the same unshielded twisted-pair cable that is used for Ethernet connectivity. The DC power source is the Catalyst switch itself. No +other power source is needed unless an AC adapter is required as a redundant source. + + + + +From the Library of Outcast Outcast +78 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Switch 1 UTP Cable + + +AC Power + + + + + +Power Switch 2 UTP Cable Injector + + +AC Power + + + + +PoE + + + + +Switch +3 UTP Cable + + +AC Power + + + + +PoE + +Figure 3-1 Methods to Supply Power to a Networked Device + +PoE has the benefit that it can be managed, monitored, and offered only to a known device. In fact, this capability is not limited to Cisco devices—any device that can request and use inline power in a compatible manner can be used. Otherwise, if a non-powered device such as a normal PC is plugged into the same switch port, the switch will not offer power to it. + +In a best practice design, the Catalyst switch should be connected to an uninterruptible power supply (UPS) so that it continues to receive and offer power even if the regular AC source fails. This allows an IP phone or other powered device to be available for use even during a power failure. + +How PoE Works + +A Catalyst switch can offer power over its Ethernet ports only if it is designed to do so. It must have one or more power supplies that are rated for the additional load that will be offered to the connected devices. PoE is available on many Cisco Catalyst switch platforms. + +Several methods provide PoE to connected devices, as listed in Table 3-6. Cisco Inline Power (ILP) is a proprietary method that was developed before the IEEE standards. The + + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 79 + +802.3af and 802.3at standards offer vendor interoperability, as well as power at varying capacities. Cisco Universal PoE (UPoE) is a proprietary method to deliver high capacity power to devices beyond that of 802.3at. + +Table 3-6 PoE Methods + +Method Common Name Power Offered +Cisco Inline Power ILP 7W + +IEEE 802.3af PoE 15.4W + +IEEE 802.3at PoE+ 25.5W + +Cisco Universal PoE UPoE 60W + + + +Detecting a Powered Device + +A switch always keeps the power disabled when a switch port is down; however, the switch must continually try to detect whether a powered device is connected to a port. If it is, the switch must begin providing power so that the device can initialize and become operational. Only then will the Ethernet link be established. + +The switch begins by supplying a small voltage across the transmit and receive pairs of the copper twisted-pair connection. It then can measure the resistance across the pairs to detect whether current is being drawn by the device. For example, if a 25K ohm resis-tance is measured, a powered device is indeed present. + +The switch also can apply several predetermined voltages to test for corresponding resis-tance values. These values are applied by the powered device to indicate which of the five PoE power classes it belongs to. Knowing this, the switch can begin allocating the appro-priate maximum power needed by the device. Table 3-7 lists the power classes. + + +Table 3-7 PoE Power Classes Key +Topic Power Class + +0 (default) + +1 + +2 + +3 + +4 (802.3at) + + + +Maximum Power Offered at 48V DC +15.4W + +4.0W + +7.0W + +15.4W + +Up to 30W + + + +The default class 0 is used if either the switch or the powered device does not support or does not attempt the optional power class discovery. Class 4 represents the highest power range (up to 30W) that can be offered to a device. + + + +From the Library of Outcast Outcast +80 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Normally, a switch will offer a maximum of 15.4W per port. Once the switch begins offering power on the port, the device can power up all or a portion of its circuitry. If additional power is needed, the device can inform the switch through CDP or LLDP advertisements and request up to the full 30W allowed for PoE class 4. + +On a Catalyst switch that can support the Cisco proprietary UPoE feature, a powered device can request more than 30W of power. The device can use special TLVs with either CDP or LLDP to request UPoE up to a maximum of 60W. At press time, only the Catalyst 4500 offers UPoE. + +Configuring PoE + +PoE configuration is fairly straightforward. By default, each switch port can automatical-ly detect the presence of a PoE-capable device before applying power. You can configure how the switch will handle PoE with the following interface configuration command: +Switch(config-if)# power inline {auto | static} [ max milliwatts] + +With the auto keyword, the connected device can request power through CDP or LLDP and the switch will attempt to deliver it, up to a default maximum of 30W—as long as there is enough power available from the switch’s power supply. You can use the static keyword instead, to preallocate a fixed amount of power to a device. + +Add the max keyword to specify a maximum amount of power to offer on the interface, regardless of what the device requests. Specify the maximum power with a value from 4000 to 30000 milliwatts (4 to 30W). The maximum value you choose should be more than you expect the connected device to use, but not set to the maximum possible. + +In Example 3-8, interface Gigabit Ethernet 1/0/1 has been configured for PoE auto mode with a maximum power of 6 watts (6000 milliwatts). Unfortunately, the connected device would like to use 15.4W; as a result, the switch rejects the power request and keeps the device in a not-connected state. The request-reject cycle continues at regular intervals until the PoE maximum is set to a sufficient value. + +Example 3-8 Setting a Maximum PoE Limit on a Switch Port + +Switch(config)# interface gigabitethernet1/0/1 +Switch(config-if)# power inline auto max 6000 +Switch(config-if)# +Mar 30 02:36:21.269: %ILPOWER-7-DETECT: Interface Gi1/0/1: Power Device detected: IEEE PD +Mar 30 02:36:21.269: %ILPOWER-5-ILPOWER_POWER_DENY: Interface Gi1/0/1: inline power denied. Reason: Insufficient total available power +Mar 30 02:36:37.073: %ILPOWER-7-DETECT: Interface Gi1/0/1: Power Device detected: IEEE PD +Mar 30 02:36:37.073: %ILPOWER-5-ILPOWER_POWER_DENY: Interface Gi1/0/1: inline power denied. Reason: Insufficient total available power +Switch(config-if)# +Switch(config-if)# power inline auto max 15400 +Switch(config-if)# + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 81 + +Switch(config-if)# +Mar 30 01:38:37.034: %ILPOWER-5-POWER_GRANTED: Interface Gi1/0/1: Power granted +Mar 30 01:38:41.513: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/1, changed state to up +Mar 30 01:38:42.520: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther-net1/0/1, changed state to up +Mar 30 01:39:09.540: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up + +To disable PoE on a switch interface, use the following interface configuration command: + +Switch(config-if)# power inline never + +Power never will be offered and powered devices never will be detected on that port. + + +Verifying PoE + +As you manage a PoE switch, be mindful of its power capacity. The power supply installed in the switch must provide power for the switch electronics, as well as any con-nected PoE devices. It is quite possible that the power supply is not rated to offer the maximum power on every switch port. Make sure that the maximum power configured on each switch port represents a reasonable value expected for the connected device. You should also make sure that the total power that can possibly be used by all connected devices does not exceed the total power available from the power supply. + +You might be tempted to leave a switch with its default configuration, using auto-discovery of PoE devices on every port, with a generous maximum power level. In that way, the switch should be able to power devices as they are connected, with no further intervention from you. However, suppose that more and more PoE devices are connected to the switch over time. Some of them may be newer models that require greater amounts of power to operate. Without keeping a close watch on the switch’s power budget, you might end up with more demand for power than the switch can supply. Once that occurs, the best outcome is that some devices will not receive power; the worst outcome is that the power supply might be damaged. + +To monitor the power budget, you can use the following command: + +Switch# show power inline + +With no other options, show power inline displays a list of switch ports and their current states. Example 3-9 lists the inline power status for all interfaces on a switch. + +Example 3-9 Displaying Switch Port PoE Status + +Switch1# show power inline + +Module Available +(Watts) +------ --------- +1 710.0 + +Used +(Watts) +-------- +110.4 + +Remaining +(Watts) +--------- +599.6 + + + + + +From the Library of Outcast Outcast +82 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Interface Admin Oper Power Device Class Max +(Watts) +--------- ------ ---------- ------- ------------------- ----- ---- + +Gi1/0/1 auto on +Gi1/0/2 auto on +Gi1/0/3 auto off +Gi1/0/4 auto off +Gi1/0/5 auto on +Gi1/0/6 auto off +Gi1/0/7 auto on +Gi1/0/8 auto on +Gi1/0/9 auto on +Gi1/0/10 auto on +Gi1/0/11 auto off +Gi1/0/12 auto on +Gi1/0/13 auto on +Gi1/0/14 auto on +Gi1/0/15 auto on +Gi1/0/16 auto on +Gi1/0/17 auto on +Gi1/0/18 auto off + +6.3 IP Phone 7910 n/a 30.0 +6.3 IP Phone 7912 n/a 30.0 +0.0 n/a n/a 30.0 +0.0 n/a n/a 30.0 +6.3 IP Phone 7910 n/a 30.0 +0.0 n/a n/a 30.0 +6.3 IP Phone 7910 n/a 30.0 +6.3 IP Phone 7910 n/a 30.0 +6.3 IP Phone 7910 n/a 30.0 +6.3 IP Phone 7942 2 30.0 +0.0 n/a n/a 30.0 +16.8 AIR-CAP3702I-A-K9 4 30.0 +16.8 AIR-CAP3702I-A-K9 4 30.0 +16.8 AIR-CAP3702I-A-K9 4 30.0 +16.8 AIR-CAP3702I-A-K9 4 30.0 +4.0 Ieee PD 1 30.0 +4.0 Ieee PD 1 30.0 +0.0 n/a n/a 30.0 + + +Notice that the first few lines display information about the current power budget. The switch has 710.0W available for PoE; 110.4W are used, leaving 599.6W for additional PoE use. + +Switch ports are listed with the following columns: + +■ Interface: The interface number + +■ Admin: The administrative PoE state; autodiscover, on, or off + +■ Oper: The operational state; on, off, or errdisable + +■ Power (watts): The actual amount of power being drawn by the device, measured in real-time by power measurement circuitry +■ Device: The device model or type, determined by CDP or LLDP + +■ Class: The IEEE PoE class number + +■ Max: The maximum allowed power draw on the port + +In Example 3-9, all switch ports have defaulted to a maximum allowed power of 30W. Suppose that PoE devices were connected to every one of the 48 ports and each device required the full 30W. The total power needed would be 1440W—much greater than the 710W available. Even at 15.4W per port, the power supply would still be oversubscribed. As a best practice, you should configure each port’s maximum power to a reasonable value that won’t overwhelm the switch. + + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 83 + +You can use the following commands to focus on the PoE activity on a specific switch stack member or a specific interface, respectively: +Switch# show power inline [module member] [detail] +Switch# show power inline [type member/module/number] [detail] + +Example 3-10 provides some sample output from the latter command, with and without the detail keyword. + +Example 3-10 Displaying Detailed PoE Information + +Switch1# show power inline gigabitethernet1/0/5 +Interface Admin Oper Power Device Class Max +(Watts) +--------- ------ ---------- ------- ------------------- ----- ---- +Gi1/0/5 auto on 16.8 AIR-CAP3702I-A-K9 4 30.0 + + +Interface AdminPowerMax +(Watts) + +AdminConsumption +(Watts) + +---------- --------------- -------------------- + +Gi1/0/5 30.0 30.0 +Switch1# +Switch1# show power inline gigabitethernet1/0/5 detail +Interface: Gi1/0/5 +Inline Power Mode: auto +Operational status: on +Device Detected: no +Device Type: cisco AIR-CAP3702I- +IEEE Class: 4 +Discovery mechanism used/configured: Unknown +Police: off +Power Allocated +Admin Value: 30.0 +Power drawn from the source: 16.8 +Power available to the device: 16.8 + +Actual consumption +Measured at the port: 6.2 +Maximum Power drawn by the device since powered on: 9.2 + +Absent Counter: 0 +Over Current Counter: 0 +Short Current Counter: 0 +Invalid Signature Counter: 0 +Power Denied Counter: 0 +Switch1# + + + +From the Library of Outcast Outcast +84 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 3-8 lists a reference of these key topics and the page numbers on which each is found. + +Table 3-8 Key Topics for Chapter 3 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Table 3-7 + +Describes the characteristics of Ethernet switching 59 + +Discusses Ethernet scaling 61 + +Covers 10-Gigabit Ethernet 62 + +Explains Ethernet autonegotiation 64 + +Covers interface selection for configuration 66 + +Explains how to configure the port speed 68 + +Explains how to configure the port duplex mode 69 + +Explains how to configure port error detection 69 + +Explains how to verify the port state 71 + +Explains how to verify port speed and duplex mode 72 + +Covers CDP neighbor discovery 73 + +Covers LLDP neighbor discovery 75 + +Describes Power over Ethernet for Cisco IP phones 77 + +Lists IEEE 802.3af PoE device classes 79 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +CSMA/CD, duplex mode, autonegotiation, duplex mismatch, IEEE 802.3, CDP, LLDP, TLV, Power over Ethernet (PoE), power class + + + + +From the Library of Outcast Outcast +Chapter 3: Switch Port Configuration 85 + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the port configuration commands, cover the right side of Tables 3-9 through 3-11 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. Therefore, you should remember the commands needed to con-figure and test a switch interface. + + +Table 3-9 + +Task + + +Switch Port Configuration Commands + +Command Syntax + + + +Select a port. + +Select multiple ports. + + + + + +Define an interface macro. + + + + + +Identify port. + +Set port speed. + +Set port mode. + +Detect port error conditions. + +Automatically recover from errdisable. + + +Switch(config)# interface type member/module/number + +Switch(config)# interface range type member/module/ number [, type member/module/number ...] + +or + +Switch(config)# interface range type member/module/ first-number – last-number + +Switch(config)# define interface-range macro-name type member/module/number [, type member/module/ number ...] [type member/module/first-number – last-number] [...] + +Switch(config)# interface range macro macro-name + +Switch(config-if)# description description-string + +Switch(config-if)# speed {10 | 100 | 1000 | auto} + +Switch(config-if)# duplex {auto | full | half} + +Switch(config-if)# errdisable detect cause [all | cause-name ] + +Switch(config-if)# errdisable recovery cause [all | cause-name ] + +Switch(config-if)# errdisable recovery interval seconds + + +Manually recover from errdisable. Switch(config-if)# shutdown + +Switch(config-if)# no shutdown + +Display ports in errdisable state Switch(config)# show interface status err-disabled + + + + + + +From the Library of Outcast Outcast +86 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Table 3-10 + +Task + + +Neighbor Discovery Commands + +Command Syntax + + + +Display CDP neighbor information. + +Control CDP operation globally. + +Control CDP operation on an interface. + +Display LLDP neighbor information. + +Control LLDP operation globally. + +Control LLDP operation on an interface. + + +Switch# show cdp neighbors [type member/ module/number] [detail] +Switch(config)# [no] cdp run + +Switch(config-if)# [no] cdp enable + +Switch(config)# show lldp neighbors [type member/module/number] [detail] +Switch(config)# [no] lldp run + +Switch(config-if)# [no] lldp { receive | transmit} + + + + + +Table 3-11 + +Task + + +Power over Ethernet Commands + +Command Syntax + + + +Set PoE behavior. + +Disable PoE on a switch port + +Display PoE status. + + +Switch(config-if)# power inline { auto | static} [max milliwatts ] +Switch(config-if)# power inline never + +Switch# show power inline [type member/ mod/num] [detail] + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Virtual LANs: This section reviews VLANs, VLAN membership, and VLAN configuration on a Catalyst switch. +■ VLAN Trunks: This section covers transporting multiple VLANs over single links and VLAN trunk-ing with Ethernet. +■ VLAN Trunk Configuration: This section outlines the Catalyst switch commands that configure VLAN trunks. +■ Troubleshooting VLANs and Trunks: This section provides commands to use when a VLAN or trunk is not operating properly. +■ Voice VLANs: This section describes the basic con-figuration needed to support Cisco IP phones and Voice over IP traffic. +■ Wireless VLANs: This section provides an overview of switch port configuration to support Cisco wire-less access points in the access layer. + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 4 + + + + + + +VLANs and Trunks + + +Switched campus networks can be broken up into distinct broadcast domains or virtual LANs (VLANs). A flat network topology, or a network with a single broadcast domain, can be simple to implement and manage. However, flat network topology is not scalable. Instead, the campus can be divided into segments using VLANs, while Layer 3 routing protocols manage inter-VLAN communication. + +This chapter details the process of defining common workgroups within a group of switches. It covers switch configuration for VLANs, along with the method of identifying and transporting VLANs on various types of links. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 4-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 4-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Virtual LANs + +VLAN TrunksVLAN Trunk Configuration + +Troubleshooting VLANs and Trunks + +Voice VLANs + +Wireless VLANs + +Questions Covered in This Section +1–4 + +5–12 + +13–14 + +15-17 + +18 + + + +1. A VLAN is which of the following? + +a. Collision domain + +b. Spanning-tree domain + +c. Broadcast domain + +d. VTP domain + +From the Library of Outcast Outcast +90 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. Switches provide VLAN connectivity at which layer of the OSI model? + +a. Layer 1 + +b. Layer 2 + +c. Layer 3 + +d. Layer 4 + +3. Which one of the following switch functions is needed to pass data between two PCs, each connected to a different VLAN? + +a. Layer 2 switch + +b. Layer 3 switch + +c. Trunk + +d. Tunnel + +4. Which Catalyst IOS switch command is used to assign a port to a VLAN? + +a. access vlan vlan-id + +b. switchport access vlan vlan-id + +c. vlan vlan-id + +d. set port vlan vlan-id + +5. Which of the following is a standardized method of trunk encapsulation? + +a. 802.1d + +b. 802.1Q + +c. 802.3z + +d. 802.1a + +6. What is the Cisco proprietary method for trunk encapsulation? + +a. CDP + +b. EIGRP + +c. ISL + +d. DSL + +7. Which of these protocols dynamically negotiates trunking parameters? + +a. PAgP + +b. STP + +c. CDP + +d. DTP + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 91 + +8. How many different VLANs can an 802.1Q trunk support? + +a. 256 + +b. 1024 + +c. 4096 + +d. 32,768 + +e. 65,536 + +9. Which of the following incorrectly describes a native VLAN? + +a. Frames are untagged on an 802.1Q trunk. + +b. Frames are untagged on an ISL trunk. + +c. Frames can be interpreted by a nontrunking host. + +d. The native VLAN can be configured for each trunking port. + +10. If two switches each support all types of trunk encapsulation on a link between them, which one will be negotiated? + +a. ISL + +b. 802.1Q + +c. DTP + +d. VTP + +11. Which VLANs are allowed on a trunk link by default? + +a. None + +b. Only the native VLAN + +c. All active VLANs + +d. Only negotiated VLANs + +12. Which command configures a switch port to form a trunk without using negotiation? + +a. switchport mode trunk + +b. switchport mode trunk nonegotiate + +c. switchport mode dynamic auto + +d. switchport mode dynamic desirable + + + + + + + + +From the Library of Outcast Outcast +92 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +13. Two hosts are connected to switch interfaces Gigabit Ethernet 1/0/1 and 1/0/33, but they cannot communicate with each other. Their IP addresses are in the 192.168.10.0/24 subnet, which is carried over VLAN 10. The show vlan id 10 com-mand generates the following output: + +Switch# show vlan id 10 +VLAN Name Status Ports +---- -------------------------------- --------- ----------------------------- + +Users +Gi1/0/4, +Gi1/0/5, Gi1/0/6, +Gi1/0/9, Gi1/0/10, +Gi1/0/13, Gi1/0/14, +Gi1/0/17, Gi1/0/18, +Gi1/0/21, Gi1/0/22, +Gi1/0/26, Gi1/0/27, +Gi1/0/32, Gi1/0/34, +Gi1/0/37, Gi1/0/39, +Gi1/0/42, Gi1/0/43, + +active Gi1/0/1, Gi1/0/2, Gi1/0/3, + +Gi1/0/7, Gi1/0/8, +Gi1/0/11, Gi1/0/12, +Gi1/0/15, Gi1/0/16, +Gi1/0/19, Gi1/0/20, +Gi1/0/23, Gi1/0/25, +Gi1/0/28, Gi1/0/31, +Gi1/0/35, Gi1/0/36, +Gi1/0/40, Gi1/0/41, +Gi1/0/46 + + +The hosts are known to be up and connected. Which of the following reasons might be causing the problem? (Choose all that apply.) +a. The two hosts are assigned to VLAN 1. + +b. The two hosts are assigned to different VLANs. + +c. Interface Gigabit Ethernet 1/0/33 is a VLAN trunk. + +d. The two hosts are using unregistered MAC addresses. + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 93 + +14. A trunk link between two switches did not come up as expected. The configuration on Switch A is as follows: + +Switch A# show running-config interface gigabitethernet1/0/1 +interface GigabitEthernet1/0/1 +switchport trunk encapsulation dot1q +switchport trunk allowed vlan 1-10 +switchport mode dynamic auto +no shutdown + +The interface configuration on Switch B is as follows: + +Switch B# show running-config interface gigabitethernet1/0/1 +interface GigabitEthernet1/0/1 +switchport trunk encapsulation dot1q +switchport mode dynamic auto +switchport access vlan 5 +no shutdown + +Assuming the interfaces began with a default configuration before the commands were applied, which one of the following reasons is probably causing the problem? +a. The two switches do not have matching switchport trunk allowed vlan commands. + +b. Neither switch has a native VLAN configured. + +c. Both switches are configured in the dynamic auto mode. + +d. Switch B is configured to use access VLAN 5. + +15. What command configures an IP phone to use VLAN 9 for voice traffic? + +a. switchport voice vlan 9 + +b. switchport voice-vlan 9 + +c. switchport voice 9 + +d. switchport voip 9 + +16. What is the default voice VLAN condition for a switch port? + +a. switchport voice vlan 1 + +b. switchport voice vlan dot1p + +c. switchport voice vlan untagged + +d. switchport voice vlan none + + + + + + + + +From the Library of Outcast Outcast +94 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +17. If the following interface configuration commands have been used, what VLAN numbers will the voice and PC data be carried over, respectively? + +interface gigabitethernet1/0/1 +switchport access vlan 10 +switchport trunk native vlan 20 +switchport voice vlan 50 +switchport mode access + +a. VLAN 50, VLAN 20 + +b. VLAN 50, VLAN 1 + +c. VLAN 1, VLAN 50 + +d. VLAN 20, VLAN 50 + +e. VLAN 50, VLAN 10 + +18. A Cisco lightweight wireless access point is connected to switch interface Gigabit Ethernet 1/0/20. Which one of the following commands enables you to configure the interface on the switch? +a. switchport access vlan 50 + +switchport mode access + +b. switchport trunk allowed vlan 1-100 + +switchport mode trunk + +c. switchport ap vlan 50 + +d. no switchport mode dynamic autonomous + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 95 + +Foundation Topics + + +Virtual LANs + + + + + + + + + + + + + + + + +Key Topic + +Consider a network design that consists of Layer 2 devices only. For example, this design could be a single Ethernet segment, an Ethernet switch with many ports, or a network with several interconnected Ethernet switches. A full Layer 2-only switched network is referred to as a flat network topology. A flat network is a single broadcast domain, such that every connected device sees every broadcast packet that is transmitted anywhere in the network. As the number of stations on the network increases, so does the number of broadcasts. + +Because of the Layer 2 foundation, flat networks cannot contain redundant paths for load balancing or fault tolerance. The reason for this is explained in Chapters 6, +“Traditional Spanning Tree Protocol,” through 9, “Advanced Spanning Tree Protocol.” To gain any advantage from additional paths to a destination, Layer 3 routing functions must be introduced. + +A switched environment offers the technology to overcome flat network limitations. Switched networks can be subdivided into virtual networks, or VLANs. By definition, a VLAN is a single broadcast domain. All devices connected to the VLAN receive broad-casts sent by any other VLAN members. However, devices connected to a different VLAN will not receive those same broadcasts. (Naturally, VLAN members also receive unicast packets directed toward them from other members of the same VLAN.) + +A VLAN consists of hosts defined as members, communicating as a logical network segment. In contrast, a physical segment consists of devices that must be connected to a physical cable segment. A VLAN can have connected members located anywhere in the campus network, as long as VLAN connectivity is provided among all members. Layer +2 switches are configured with a VLAN mapping and provide the logical connectivity among the VLAN members. + +Figure 4-1 shows how a VLAN can provide logical connectivity between switch ports. Two workstations on the left Catalyst switch are assigned to VLAN 1, whereas a third workstation is assigned to VLAN 100. In this example, no communication can occur between VLAN 1 and VLAN 100. VLAN 1 can also be extended into the right Catalyst switch by assigning both ends of the link between the Catalysts to VLAN 1. One work-station on the right Catalyst also is assigned to VLAN 1. Because there is end-to-end con-nectivity of VLAN 1, any of the workstations on VLAN 1 can communicate as if they +were connected to the same physical network segment. + + + + + + + + + + +From the Library of Outcast Outcast +96 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +VLAN 1 Connectivity + +VLAN 1 + +VLAN 1 + + +VLAN 1 +VLAN 1 + + + + + + + +VLAN 200 VLAN 100 + +Figure 4-1 VLAN Functionality + + +VLAN Membership + +When a VLAN is provided at an access layer switch, an end user must have some means of gaining membership to it. Two membership methods exist on Cisco Catalyst switches: + +■ Static VLAN configuration + +■ Dynamic VLAN assignment + + +Static VLANs + +Static VLANs offer port-based membership, in which switch ports are assigned to specific VLANs. End-user devices become members in a VLAN based on the physical switch port to which they are connected. No handshaking or unique VLAN membership protocol is needed for the end devices; they automatically assume VLAN connectivity when they connect to a port. Normally, the end device is not even aware that the VLAN exists. The switch port and its VLAN simply are viewed and used as any other network segment, with other “locally attached” members on the wire. + +Switch ports are assigned to VLANs through manual intervention and configuration, hence the static nature. Each port receives a port VLAN ID (PVID) that associates it with a VLAN number. The ports on a single switch can be assigned and grouped into many VLANs. Even though two devices are connected to the same switch, traffic will not pass between them if they are connected to ports on different VLANs. To perform this func-tion, you could use either a Layer 3 device to route packets or an external Layer 2 device to bridge packets between the two VLANs. + + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 97 + +The static port-to-VLAN membership is normally handled in hardware with application-specific integrated circuits (ASICs) in the switch. This membership provides good perfor-mance because all port mappings are done at the hardware level, with no complex table lookups needed. + +Configuring Static VLANs + +To use a VLAN, it must be created on the switch, if it does not already exist. Then, the VLAN must be assigned to specific switch ports. VLANs are always referenced by a VLAN number, which can range from 1 to 1005. VLANs 1 and 1002 through 1005 auto-matically are created and are set aside for special uses. + +VLAN 1 is the default VLAN for every switch port. VLANs 1002 to 1005 are reserved for legacy functions related to Token Ring and FDDI switching. VLAN 1 is set to be a VLAN type of Ethernet, and have a maximum transmission unit (MTU) size of 1500 bytes. + +Catalyst switches can also support extended-range VLAN numbers 1006 through 4094. With the addition of the extended-range VLANs VLAN numbers can be 1 to 4094—the same range of numbers as the IEEE 802.1Q standard. The extended range is enabled only when the switch is configured for VTP transparent mode with the vtp mode transparent global configuration command. This is because of limitations with VTP Versions 1 and 2. VTP Version 3 does allow extended range VLANs to be used and advertised. (VTP is covered in Chapter 5, “VLAN Trunking Protocol.”) + + +Tip Although the extended range of VLAN numbers enables you to support more VLANs in your network, some limitations exist. For example, a switch normally maintains VLAN definitions in a special database file, separate from the switch configuration. The VLAN Trunking Protocol (VTP) uses the VLAN database so that VLAN definitions can be advertised and shared between switches over trunk links. When extended-range VLANs are created, they are not stored in the VLAN database file. +Why does this matter? As long as the switch remains in VTP transparent mode, the extend-ed VLANs can be used. However, if the switch is later configured to participate in VTP as either a server or a client, you must manually delete the extended VLANs. For any switch ports that were assigned to the extended VLANs, you must also reconfigure them for VLAN membership within the normal VLAN range. + + + + +Key Topic + +To configure a VLAN, begin by defining the VLAN with the following commands in global configuration mode: + +Switch(config)# vlan vlan-num +Switch(config-vlan)# name vlan-name + + +The VLAN numbered vlan-num is immediately created and stored in the database, along with a descriptive text string defined by vlan-name (up to 32 characters with no embed-ded spaces). The name command is optional; if it is not used, the default VLAN name + + +From the Library of Outcast Outcast +98 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +is of the form VLANXXX, where XXX represents the VLAN number. If you need to include spaces to separate words in the VLAN name, use underscore characters instead. + +As an example, you can use the following commands to create VLANs 2 and 101: + +Switch(config)# vlan 2 +Switch(config-vlan)# name Engineering +Switch(config-vlan)# vlan 101 +Switch(config-vlan)# name Marketing + +To delete a VLAN from the switch configuration, you can use the no vlan vlan-num command. + +Next, you should assign one or more switch ports to the VLAN. Use the following con-figuration commands: + +Switch(config)# interface type member/module/number +Switch(config-if)# switchport +Switch(config-if)# switchport mode access +Switch(config-if)# switchport access vlan vlan-num + +The initial switchport command configures the port for Layer 2 operation. Switch ports on most Catalyst switch platforms default to Layer 2 operation. In that case, the switch-port command will already be present in the configuration and you will not have to enter it explicitly. Otherwise, the switch will reject any Layer 2 configuration command if the port is not already configured for Layer 2 operation. + +The switchport mode access command forces the port to be assigned to only a single VLAN, providing VLAN connectivity to the access layer or end user. The port is given a static VLAN membership by the switchport access vlan command. Here, the logical VLAN is referenced by the vlan-num setting (1 to 1005 or 1 to 4094). In Example 4-1, several switch ports are put into access mode and assigned to VLANs 2 and 101. + +Example 4-1 Assigning Switch Ports to VLANs + +Switch(config)# interface range gigabitethernet4/0/1 - 24 +Switch(config-if)# switchport +Switch(config-if)# switchport mode access +Switch(config-if)# switchport access vlan 2 +Switch(config)# interface range gigabitethernet2/0/1 - 24 +Switch(config-if)# switchport +Switch(config-if)# switchport mode access +Switch(config-if)# switchport access vlan 101 +Switch(config-if)# exit +Switch(config)# + +To verify VLAN configuration, use the show vlan or show vlan brief command to output a list of all VLANs defined in the switch, along with the ports that are assigned to each + + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 99 + +VLAN. Example 4-2 shows some sample output from the show vlan command, based on the configuration listed in Example 4-1. + +Example 4-2 Verifying VLAN Configuration with the show vlan Command + +Switch# +show vlan +VLAN Name Status Ports +---- -------------------------------- ------ ------------------------------- + +1 default +2 Engineering + + +101 Marketing + +active Gi1/0/1, Gi1/0/2, Gi3/0/20, Gi4/0/20 +active Gi4/0/2, Gi4/0/3, Gi4/0/4, Gi4/0/5 +Gi4/0/6, Gi4/0/7, Gi4/0/8, Gi4/0/9 +Gi4/0/10, Gi4/0/11, Gi4/0/12 +active Gi2/0/5, Gi2/0/6, Gi2/0/7, Gi2/0/8 +Gi2/0/9, Gi2/0/10, Gi2/0/11, Gi2/0/12 +Gi2/0/13, Gi2/0/14, Gi2/0/15, Gi2/0/16 +Gi2/0/17, Gi2/0/18 + + + +Dynamic VLANs + +Dynamic VLANs provide membership based on the MAC address of an end-user device, rather than the switch port where it is connected. The switch must, in effect, query a database to establish VLAN membership for the device. A network administrator also must assign the user’s MAC address to a VLAN in the database of a VLAN Membership Policy Server (VMPS). Dynamic VLANs allow a great deal of flexibility and mobility for end users but require more administrative overhead. + + +Note Dynamic VLANs are not covered in this text or in the SWITCH course or exam. For more information, refer to a Catalyst switch configuration guide. + + + +Deploying VLANs + + + +Key Topic + +To implement VLANs, you must consider the number of VLANs you need and how best to place them. As usual, the number of VLANs depends on traffic patterns, application types, segmentation of common workgroups, and network-management requirements. + +An important factor to consider is the relationship between VLANs and the IP addressing schemes used. Cisco recommends a one-to-one correspondence between VLANs and IP subnets. This recommendation means that if a subnet with a 24-bit mask (255.255.255.0) is used for a VLAN, no more than 254 devices should be in the VLAN. In addition, you should not allow VLANs to extend beyond the Layer 2 domain of a distribution switch. In other words, the VLAN should stay inside a switch block and not reach across a network’s core and into another switch block. The idea again is to keep broadcasts and +unnecessary traffic movement out of the core block. This also limits the failure domain, + + + + +From the Library of Outcast Outcast +100 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +or the extent of the network that would be affected if something goes wrong and the VLAN becomes saturated with traffic to the point that it is unusable. + +VLANs can be scaled in the switch block by using two basic methods: + +■ End-to-end VLANs + +■ Local VLANs + + +End-to-End VLANs + +End-to-end VLANs, also called campus-wide VLANs, span the entire switch fabric of a network. They seem attractive because they can support maximum flexibility and mobil-ity of end devices. Users can be assigned to an end-to-end VLAN regardless of their physical location. As a user moves around the campus, that user’s VLAN membership stays the same. This means that the VLAN must be made available at the access layer in every switch block. It also means that the VLAN must be made available on the network core switches too. Figure 4-2 illustrates how an end-to-end VLAN can exist in multiple locations but must be carried across multiple switch blocks and the core. + + + + +Core + + + + + + +Distribution + + + + +Access + + +Switch Block Switch Block + + +Local VLAN End-to-End VLAN + +Figure 4-2 The Extent of an End-to-End VLAN + +End-to-end VLANs should group users according to common requirements. All users in a VLAN should have roughly the same traffic flow patterns, following the 80/20 rule. Recall that this rule estimates that 80 percent of user traffic stays within the local work-group, whereas 20 percent is destined for a remote resource in the campus network. + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 101 + +Although only 20 percent of the traffic in a VLAN is expected to cross the network core, end-to-end VLANs make it possible for 100 percent of the traffic within a single VLAN to cross the core. + + +Tip End-to-end VLANs are not recommended in an enterprise network, unless there is a good reason. In an end-to-end VLAN, broadcast traffic is carried over from one end of the network to the other, creating the possibility for a broadcast storm or Layer 2 bridg- +ing loop to spread across the whole extent of a VLAN. This can exhaust the bandwidth of distribution and core layer links, as well as switch CPU resources. In that case, the storm or loop will have disrupted all users on the end-to-end VLAN, in addition to users on other VLANs that might be crossing the core to reach resources on the other side.When such a problem occurs, troubleshooting becomes more difficult. In other words, the risks of end-to-end VLANs outweigh the convenience and benefits. + + + +Local VLANs + +Because most enterprise networks have moved toward the 20/80 rule (where server and intranet/Internet resources are centralized), end-to-end VLANs have become cumber-some and difficult to maintain. The 20/80 rule reverses the traffic pattern of the end-to-end VLAN: Only 20 percent of traffic is local, whereas 80 percent is destined to a remote resource across the core layer. End users usually require access to central resources outside their VLAN. Users must cross into the network core more frequently to reach +the centralized resources. In this type of network, VLANs should be designed to contain user communities based on geographic boundaries, with little regard to the amount of traffic leaving the VLAN. + +Local or geographic VLANs range in size from a single switch in a wiring closet to an entire building. Arranging VLANs in this fashion enables the Layer 3 function in the cam-pus network to intelligently handle the inter-VLAN traffic loads, where traffic passes into the core. This scenario provides maximum availability by using multiple paths to destina-tions, maximum scalability by keeping the VLAN within a switch block, and maximum manageability. + +Figure 4-2 shows a local VLAN. Notice how it is limited to a single switch block, creat-ing a very small failure domain in comparison to the end-to-end VLAN. As a best prac-tice, you should always try to build local VLANs and keep them bounded inside a single switch block. + +VLAN Trunks + +At the access layer, end-user devices usually connect to switch ports that provide simple connectivity to a single VLAN each. The attached devices are unaware of any VLAN structure and simply attach to what appears to be a normal physical network segment. Remember, sending information from an access link on one VLAN to another VLAN is + + + +From the Library of Outcast Outcast +102 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +not possible without the intervention of an additional device—either a Layer 3 router or an external Layer 2 bridge connected between the VLANs. + +Suppose that you have one switch that groups users together into three different VLANs. You would like to expand your one-switch network to include a second switch so that the same three VLANs exist on both switches. To bring the three VLANs from one switch to the other, you could take a brute force approach and use three separate physical links— one for each VLAN. The top half of Figure 4-3 shows how two switches might be con-nected in this fashion. + +As VLANs are added to a network, the number of links between switches can grow quickly. A more efficient use of physical interfaces and cabling involves the use of trunking. + +A trunk link can transport more than one VLAN through a single switch port. Trunk links are most beneficial when switches are connected to other switches or routers. A trunk link is not assigned to a specific VLAN. Instead, one, many, or all active VLANs can be transported between switches using a single physical trunk link, as shown in the bottom half of Figure 4-3. + +VLAN 1 VLAN 1 + + + + +VLAN 2 3 VLAN 2 2 +1 VLANs +VLAN 3 VLAN 3 + + + + + + + +VLAN 1 VLAN 1 + + + + +VLAN 2 VLAN 2 Trunk link +VLANs 1, 2, 3 + +VLAN 3 VLAN 3 + + + + +Figure 4-3 Passing VLAN Traffic Using Single Links Versus a Trunk Link + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 103 + +Cisco supports trunking on all forms of Ethernet switch links, as well as aggregated EtherChannel links. To distinguish between traffic belonging to different VLANs on a trunk link, the switch must have a method of associating each frame with the appropriate VLAN. The switches on each end of a trunk link must use the same method for correlat-ing frames with VLAN numbers so that frames do not get lost as they traverse the trunk. The next section covers several available VLAN identification methods. + +VLAN Frame Identification + +Because a trunk link can transport many VLANs, a switch must identify frames with their respective VLANs as they are sent and received over a trunk link. Frame identifica-tion, or tagging, assigns a unique user-defined ID to each frame transported on a trunk link. Think of this ID as the VLAN number or VLAN “color,” as if each VLAN were drawn on a network diagram in a unique color. + +VLAN frame identification was developed for switched networks. As each frame is transmitted over a trunk link, a unique identifier is placed in the frame header so that the VLAN association travels with the frame itself. As the frame exits the trunk, the switch at the far end of the link examines the VLAN identifier and places the frame into the correct VLAN. + +If a frame must be transported out another trunk link, the VLAN identifier simply trav-els along with the frame in the header. Otherwise, if the frame is destined out an access (nontrunk) link, the VLAN identifier is removed before the frame is transmitted to the destination host. Therefore, all traces of VLAN association are hidden from the end station. + +VLAN identification can be performed using two methods, each using a different frame identifier mechanism: + +■ Inter-Switch Link (ISL) protocol + +■ IEEE 802.1Q protocol + +These methods are described in the sections that follow. + + +Inter-Switch Link Protocol + +The Inter-Switch Link (ISL) protocol is a Cisco-proprietary method for preserving the source VLAN identification of frames passing over a trunk link. ISL performs frame iden-tification in Layer 2 by encapsulating the original frame between a header and a trailer. Any Cisco switch or router device configured for ISL can process and understand the ISL VLAN information. + +When a frame is destined out a trunk link to another switch or router, ISL adds a 26-byte header and a 4-byte trailer to the frame. The source VLAN is identified with a 15-bit VLAN ID field in the ISL header; however, VLAN numbers are limited to a range from +1 to 4094. The trailer contains a cyclic redundancy check (CRC) value to ensure the data integrity of the new encapsulated frame. Figure 4-4 shows how Ethernet frames are encapsulated and forwarded out a trunk link. + + +From the Library of Outcast Outcast +104 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Access Link Trunk Link + + + + + +Frame (Variable Length) + +ISL Header (26 Bytes) + +CRC (4 Bytes) + + +Figure 4-4 ISL Frame Identification + + +Tip The ISL method of VLAN identification or trunking encapsulation no longer is sup-ported across all Cisco Catalyst switch platforms. Even so, you should still be familiar with it and know how it compares to the standards-based IEEE 802.1Q method. + + + + + + +Key Topic + +IEEE 802.1Q Protocol + +The IEEE 802.1Q protocol also can carry VLAN associations over trunk links. However, this frame-identification method is standardized, allowing VLAN trunks to exist and operate between equipment from multiple vendors. You can find further information about the 802.1Q standard at http://grouper.ieee.org/groups/802/1/pages/802.1Q.html . + +As with Cisco ISL, IEEE 802.1Q can be used for VLAN identification with Ethernet trunks. However, instead of encapsulating each frame with a VLAN ID header and trailer, 802.1Q embeds its tagging information within the Layer 2 frame. This method is referred to as single tagging or internal tagging. + +802.1Q also introduces the concept of a native VLAN on a trunk. Frames belonging to this VLAN are not encapsulated with any tagging information at all, as if a trunk link was not being used. If an end station is connected to an 802.1Q trunk link, the end station can receive and understand only the native VLAN frames because they are not tagged. This provides a simple way to offer full trunk encapsulation to the devices that can understand it, while giving normal access stations some inherent connectivity over the trunk. + +In an Ethernet frame, 802.1Q adds a 4-byte tag just after the Source Address field, as shown in Figure 4-5. + +The first two bytes are used as a tag protocol identifier (TPID) and always have a value of 0x8100 to signify an 802.1Q tag. The remaining two bytes are used as a Tag Control Information (TCI) field. The TCI information contains a three-bit Priority field, which is used to implement class of service (CoS) functions. The last 12 bits are used as a VLAN identifier (VID) to indicate the source VLAN for the frame. The VID can have values +from 0 to 4095, but VLANs 0, 1, and 4095 are reserved. + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 105 + + + +Access Link + + + + +Frame (Variable Length) + +Trunk Link + + + + +802.1Q Tag (+4 Bytes) + + + +Dest Addr Data Payload FCS Src Addr +Type/Length + +Figure 4-5 IEEE 802.1Q Frame-Tagging Standard + +Note that both ISL and 802.1Q tagging methods have one implication—they add to the length of an existing Ethernet frame. ISL adds a total of 30 bytes to each frame, whereas 802.1Q adds 4 bytes. Because Ethernet frames cannot exceed 1518 bytes, the additional VLAN tagging information can cause the frame to become too large. Frames that barely exceed the MTU size are called baby giant frames. Switches usually report these frames as Ethernet errors or oversize frames. + + +Note Baby giant, or oversize, frames can exceed the frame size set in various standards. To properly handle and forward them anyway, Catalyst switches use proprietary hardware with the ISL encapsulation method. In the case of 802.1Q encapsulation, switches can comply with the IEEE 802.3ac standard, which extends the maximum frame length to 1522 bytes. + + + +Dynamic Trunking Protocol + +You can manually configure trunk links on Catalyst switches for either ISL or 802.1Q mode. In addition, Cisco has implemented a proprietary, point-to-point protocol called Dynamic Trunking Protocol (DTP) that negotiates a common trunking mode between two switches. The negotiation covers the encapsulation (ISL or 802.1Q) and whether the link becomes a trunk at all. This allows trunk links to be used without a great deal of manual configuration or administration. The use of DTP is explained in the next section. + + +Tip You should disable DTP negotiation if a switch has a trunk link connected to a nontrunking router or firewall interface because those devices cannot participate in DTP negotiation. A trunk link can be negotiated between two switches only if both switches belong to the same VLAN Trunking Protocol (VTP) management domain or if one or both switches have not defined their VTP domain (that is, the NULL domain). VTP is discussed in Chapter 5. + + + + +From the Library of Outcast Outcast +106 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +If the two switches are in different VTP domains and trunking is desired between them, you must set the trunk links to on mode or nonegotiate mode. This setting forces the trunk to be established. These options are explained in the next section. + +VLAN Trunk Configuration + +By default, all switch ports in Layer 2 mode are nontrunking and operate as access links until some intervention changes the mode. Specifically, ports actively try to become trunks as long as the far end agrees. In that case, a common encapsulation is chosen, favoring ISL if both support it. The sections that follow demonstrate the commands nec-essary to configure VLAN trunks. + +Configuring a VLAN Trunk + +Use the following commands to create a VLAN trunk link: + +Switch(config)# interface type member/module/number +Switch(config-if)# switchport +Switch(config-if)# switchport trunk encapsulation { isl | dot1q | negotiate} +Switch(config-if)# switchport trunk native vlan vlan-id +Switch(config-if)# switchport trunk allowed vlan { vlan-list | all | +{ add | except | remove} vlan-list} +Switch(config-if)# switchport mode {trunk | dynamic {desirable | auto}} + +A switch port must be in Layer 2 mode before it can support a trunk. To accomplish this, you use the switchport command with no other keywords. You then can configure the trunk encapsulation with the switchport trunk encapsulation command, as one of the following: + +■ isl: VLANs are tagged by encapsulating each frame using the Cisco ISL protocol. + +■ dot1q: VLANs are tagged in each frame using the IEEE 802.1Q standard protocol. The only exception is the native VLAN, which is sent normally and is not tagged. + +■ negotiate (the default): The encapsulation is negotiated to select either ISL or IEEE 802.1Q, whichever both ends of the trunk support. If both ends support both types, ISL is favored. + +In the case of an IEEE 802.1Q trunk, you should configure the native VLAN with the switchport trunk native vlan command, identifying the untagged or native VLAN num-ber as vlan-id (1 to 4094). By default, an 802.1Q trunk uses VLAN 1 as the native VLAN. In the case of an ISL trunk, using this command has no effect because ISL does not sup-port an untagged VLAN. + +The last command, switchport trunk allowed vlan, defines which VLANs can be trunked over the link. By default, a switch transports all active VLANs (1 to 4094) over a trunk link. An active VLAN is one that has been defined on the switch and has ports assigned to carry it. + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 107 + +There might be times when the trunk link should not carry all VLANs. For example, broadcasts are forwarded to every switch port on a VLAN—including a trunk link because it, too, is a member of the VLAN. If the VLAN does not extend past the far end of the trunk link, propagating broadcasts across the trunk makes no sense and only wastes trunk bandwidth. + +You can tailor the list of allowed VLANs on the trunk by using the switchport trunk allowed vlan command with one of the following: + +■ vlan-list: An explicit list of VLAN numbers, separated by commas or dashes. + +■ all: All active VLANs (1 to 4094) will be allowed. + +■ add vlan-list: A list of VLAN numbers will be added to the already configured list; this is a shortcut to keep from typing a long list of numbers. + +■ except vlan-list: All VLANs (1 to 4094) will be allowed, except for the VLAN num-bers listed; this is a shortcut to keep from typing a long list of numbers. + +■ remove vlan-list: A list of VLAN numbers will be removed from the already config-ured list; this is a shortcut to keep from typing a long list of numbers. + +In the switchport mode command, you can set the trunking mode to any of the following: + +■ trunk: This setting places the port in permanent trunking mode. DTP is still opera-tional, so if the far-end switch port is configured to trunk, dynamic desirable, or dynamic auto mode, trunking will be negotiated successfully. + +The trunk mode is usually used to establish an unconditional trunk. Therefore, the corresponding switch port at the other end of the trunk should be configured simi-larly. In this way, both switches always expect the trunk link to be operational with-out any negotiation. You also should manually configure the encapsulation mode to eliminate its negotiation. + +■ dynamic desirable (the default): The port actively attempts to convert the link into trunking mode. In other words, it “asks” the far-end switch to bring up a trunk. If the far-end switch port is configured to trunk, dynamic desirable, or dynamic auto mode, trunking is negotiated successfully. + +■ dynamic auto: The port can be converted into a trunk link, but only if the far-end switch actively requests it. Therefore, if the far-end switch port is configured to trunk or dynamic desirable mode, trunking is negotiated. Because of the passive negotiation behavior, the link never becomes a trunk if both ends of the link are left to dynamic auto. + + + + + + + + +From the Library of Outcast Outcast +108 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Tip In all these modes, DTP frames are sent out every 30 seconds to keep neighboring switch ports informed of the link’s mode. On critical trunk links in a network, manually configuring the trunking mode on both ends is best so that the link never can be negoti-ated to any other state. +As a best practice, you should configure both ends of a trunk link as a fixed trunk (switch-port mode trunk) or as an access link (switchport mode access), to remove any uncertain-ty about the link operation. In the case of a trunk, you can disable DTP completely so that the negotiation frames are not exchanged at all. To do this, add the switchport nonegoti-ate command to the interface configuration. Be aware that after DTP frames are disabled, no future negotiation is possible until this configuration is reversed. + + +To view the trunking status on a switch port, use the following command, as demonstrat-ed in Example 4-3: +Switch# show interface type member/module/number trunk + + +Example 4-3 Determining Switch Port Trunking Status + +Switch# show interface gigabitethernet 2/0/1 trunk + +Port Mode +Gi2/0/1 on + +Encapsulation +802.1q + +Status +trunking + +Native vlan +1 + + + +Port +Gi2/0/1 + +Port +Gi2/0/1 + +Port +Gi2/0/1 + +Vlans allowed on trunk +1-4094 + +Vlans allowed and active in management domain +1-2,526,539,998 + +Vlans in spanning tree forwarding state and not pruned +1-2,526,539,998 + + + +Trunk Configuration Example + +As an example of trunk configuration, consider two switches, Switch D and Switch A, which are distribution layer and access layer switches, respectively. The two switches are connected by a link between their Gigabit Ethernet 2/0/1 interfaces. This link should be configured as a trunk carrying only VLAN numbers 100 through 105, although more VLANs might exist on the switches. + +The trunk link should use 802.1Q encapsulation, with VLAN 100 as the native VLAN. First, configure Switch D to actively negotiate a trunk with the far-end switch. You could use the following configuration commands on Switch D: + +Switch-D(config)# interface gigabitethernet 2/0/1 +Switch-D(config-if)# switchport +Switch-D(config-if)# switchport trunk encapsulation dot1q + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 109 + +Switch-D(config-if)# switchport trunk native vlan 100 +Switch-D(config-if)# switchport trunk allowed vlan 100-105 +Switch-D(config-if)# switchport mode dynamic desirable + +At this point, you assume that Switch A is configured correctly, too. Now, you should try to verify that the trunk is working as expected. On Switch D, you can view the trunk sta-tus with the following command: + +Switch-D# show interface gigabitethernet 2/0/1 trunk +Port Mode Encapsulation Status Native vlan + +Gi2/0/1 desirable 802.1q not-trunking 100 + +Port +Gi2/0/1 +Port +Gi2/0/1 +Port +Gi2/0/1 + +Vlans allowed on trunk +100 +Vlans allowed and active in management domain +100 +Vlans in spanning tree forwarding state and not pruned +none + + +To your surprise, the trunk’s status is not-trunking. Next, you should verify that the physical link is up: + +Switch-D# show interface status + +Port Name +Gi2/0/1 +Gi2/0/2 +Gi2/0/3 + +Status Vlan +connected 100 +notconnect 1 +notconnect 1 + +Duplex Speed Type +full 1000 1000BaseSX +auto 1000 1000BaseSX +auto 1000 1000BaseSX + + +What could be preventing the trunk from being established? If Switch D is in dynamic desirable negotiation mode, it is actively asking Switch A to bring up a trunk. Obviously, Switch A must not be in agreement. The desirable mode can negotiate a trunk with +all other trunking modes, so Switch A’s interface must not be configured for trunking. Instead, it is most likely configured as an access port (switchport mode access). + +Switch A can be corrected by configuring its Gigabit Ethernet 2/0/1 interface to negoti-ate a trunk. Switch D is in dynamic desirable mode, so Switch A could use either trunk , dynamic desirable, or dynamic auto mode. + +Now, suppose that you realize VLAN 103 should not be passed between these switches. You can use either of the following command sequences to manually prune VLAN 103 from the trunk: + +Switch-D(config)# interface gigabitethernet 2/0/1 +Switch-D(config-if)# switchport trunk allowed vlan 100-102,104-105 + +or + +Switch-D(config-if)# switchport trunk allowed vlan remove 103 + + + + +From the Library of Outcast Outcast +110 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +In the latter case, the previous range of 100 to 105 is kept in the configuration, and only 103 is removed from the list. + +When you manually prune VLANs from being allowed on a trunk, the same operation should be performed at both ends of the trunk link. Otherwise, one of the two switches still could flood broadcasts from that VLAN onto the trunk, using unnecessary band-width in only one direction. + +For completeness, the configuration of Switch A at this point would look like the following: + +Switch-A(config)# interface gigabitethernet 2/0/1 +Switch-A(config-if)# switchport trunk encapsulation dot1q +Switch-A(config-if)# switchport trunk native vlan 100 +Switch-A(config-if)# switchport trunk allowed vlan 100-105 +Switch-A(config-if)# switchport trunk allowed vlan remove 103 +Switch-A(config-if)# switchport mode dynamic desirable + + + + + + + + + + + + +Key Topic + +Troubleshooting VLANs and Trunks + +Remember that a VLAN is nothing more than a logical Layer 2 network segment that can be spread across many switches. If a PC in one location cannot communicate with a PC in another location, where both are assigned to the same IP subnet, make sure that both of their switch ports are configured for the same VLAN. If they are, examine the path between the two. Is the VLAN carried continuously along the path? If there are trunks along the way, is the VLAN being carried across the trunks? + +To verify a VLAN’s configuration on a switch, use the show vlan id vlan-id EXEC com-mand, as demonstrated in Example 4-4. Make sure that the VLAN is shown to have an +active status and that it has been assigned to the correct switch ports. + + +Example 4-4 Verifying Switch VLAN Configuration + +Switch# show vlan id 2 +VLAN Name Status Ports +---- ---------------------------------- --------- ------- +2 Engineering active Gi2/0/1, Gi2/0/2, Gi2/0/3, Gi2/0/4 +Gi4/0/2, Gi4/0/3, Gi4/0/4, Gi4/0/5 +Gi4/0/6, Gi4/0/7, Gi4/0/8, Gi4/0/9 +Gi4/0/10, Gi4/0/11, Gi4/0/12 + +VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 +---- ----- ---------- ----- ------- ------ -------- ---- -------- ------ ------- +2 enet 100002 1500 - - - - - 0 0 + +Primary Secondary Type Ports +------- --------- ------------------ -------------------------------------------- + +Switch# + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 111 + +For a trunk, the following parameters must be agreeable on both ends before the trunk can operate correctly: + +■ Trunking mode (unconditional trunking, negotiated, or non-negotiated). + +■ Trunk encapsulation (ISL, IEEE 802.1Q, or negotiated through DTP). + +■ Native VLAN. You can bring up a trunk with different native VLANs on each end; however, both switches will log error messages about the mismatch, and the poten-tial exists that traffic will not pass correctly between the two native VLANs. + +■ The native VLAN mismatch is discovered through the exchange of Cisco Discovery Protocol (CDP) or Link Layer Discovery Protocol (LLDP) messages, not through examination of the trunk itself. Also, the native VLAN is configured independently of the trunk encapsulation, so it is possible to have a native VLAN mismatch even if the ports use ISL encapsulation. In this case, the mismatch is only cosmetic and will not cause a trunking problem. + +■ Allowed VLANs. By default, a trunk allows all VLANs to be transported across it. If one end of the trunk is configured to disallow a VLAN, that VLAN will not be contiguous across the trunk. A trunk link can become operational even if the list of allowed VLANs is not consistent on both ends. + + + +Key Topic + +To see a comparison of how a trunking switch port is configured versus its operational state, use the show interface type member/module/number switchport command, as demonstrated in Example 4-5. Look for the administrative versus operational values, respectively, to see whether the trunk is working the way you configured it. + +Notice that the port has been configured to negotiate a trunk through DTP (dynamic auto), but the port is operating in the static access (nontrunking) mode. This should tell you that both ends of the link probably are configured for the auto mode so that neither +will actively request a trunk. + + +Example 4-5 Comparing Switch Port Trunking Configuration and Operational State + +Switch# show interface gigabitethernet 2/0/2 switchport +Name: Gi2/0/2 +Switchport: Enabled +Administrative Mode: dynamic auto + +Operational Mode: static access +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: native +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Operational private-vlan: none +Trunking VLANs Enabled: ALL + + + +From the Library of Outcast Outcast +112 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Pruning VLANs Enabled: 2-1001 + +Protected: false +Unknown unicast blocked: disabled +Unknown multicast blocked: disabled + +Voice VLAN: none (Inactive) +Appliance trust: none +Switch# + +For more concise information about a trunking port, you can use the show interface [type member/module/number] trunk command, as demonstrated in Example 4-6. + +Example 4-6 Viewing Concise Information About a Trunking Port + +Switch# show interface gigabitethernet 2/0/2 trunk +Port Mode Encapsulation Status Native vlan +Gi2/0/2 auto 802.1q not-trunking 1 + + +Port +Gi2/0/2 + +Port +Gi2/0/2 + +Port +Gi2/0/2 +Switch# + +Vlans allowed on trunk +1 + +Vlans allowed and active in management domain +1 + +Vlans in spanning tree forwarding state and not pruned +1 + + +Again, notice that the port is in the autonegotiation mode, but it is currently not-trunk-ing. Because the port is not-trunking, only the access VLAN (VLAN 1 in this example) is listed as allowed and active on the trunk. + +To see whether and how DTP is being used on a switch, use the show dtp [interface type member/module/number] command. Specifying an interface shows the DTP activity in greater detail. + +Voice VLANs + +A Cisco IP phone provides a data connection for a user’s PC, in addition to its own voice data stream. This allows a single Ethernet drop to be installed per user, even though sev-eral types of data pass over it. The IP phone also can control some aspects of how the packets (both voice and user data) are presented to the switch. + +Most Cisco IP phone models contain a three-port switch, connecting to the upstream switch, the user’s PC, and the internal Voice over IP (VoIP) data stream, as illustrated in Figure 4-6. The voice and user PC ports always function as access mode switch ports. + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 113 + +The port that connects to the upstream switch, however, can operate as an 802.1Q trunk or as an access mode (single VLAN) port. + + +Distribution and +Core Layers +Cisco CallManager + +Access Layer Catalyst + + +Power and Data + + +Cisco +IP Phone + + + +User PC + + +Figure 4-6 Basic Connections to a Cisco IP Phone + +The link mode between the IP phone and the switch is negotiated; you can configure the switch to instruct the phone to use a special-case 802.1Q trunk or a single VLAN access link. With a trunk, the voice traffic can be isolated from other user data, providing secu-rity and quality of service (QoS) capabilities. + +As an access link, both voice and data must be combined over the single VLAN. This sim-plifies other aspects of the switch configuration because a separate voice VLAN is not needed, but it could compromise the voice quality, depending on the PC application mix and traffic load. + +Voice VLAN Configuration + + + +Key Topic + +Although you can configure the IP phone uplink as a trunk or nontrunk, the real consid-eration pertains to how the voice traffic will be encapsulated. The voice packets must be carried over a unique voice VLAN (known as the voice VLAN ID or VVID) or over the regular data VLAN (known as the native VLAN or the port VLAN ID, PVID). The QoS information from the voice packets also must be carried somehow. + +To configure the IP phone uplink, just configure the switch port where the phone con-nects. The switch instructs the phone to follow the mode that is selected. In addition, the switch port does not need any special trunking configuration commands if a trunk is +wanted. If an 802.1Q trunk is needed, a special-case trunk is automatically negotiated by +the Dynamic Trunking Protocol (DTP) and CDP. + + + + + +From the Library of Outcast Outcast +114 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Use the following interface configuration command to select the voice VLAN mode that will be used: +Switch(config-if)# switchport voice vlan {vlan-id | dot1p | untagged | none} + +Figure 4-7 shows the four different voice VLAN configurations. Pay particular attention to the link between the IP phone and the switch. + + +switchport voice vlan vvid + + +Voice: Tagged as VLAN vvid +A + + +Special 802.1Q Trunk CoS in 802.1p Bits + + + + +User PC + + +Cisco IP Phone + +Data: Untagged; Native VLAN + + +Catalyst Cisco CallManager + + + +switchport voice vlan dot1p + + +Voice: Tagged as VLAN 0 +B + + +Special 802.1Q Trunk CoS in 802.1p Bits + + + + +User PC + + +Cisco IP Phone + +Data: Untagged; Native VLAN + + +Catalyst Cisco CallManager + + +switchport voice vlan untagged +Special 802.1Q Trunk CoS in 802.1p Bits + + + +C + +User PC + + + + +Cisco IP Phone + +Voice: Untagged; Native VLAN + +Data: Untagged; Native VLAN + + + + +Catalyst Cisco CallManager + + +switchport voice vlan none +Access VLAN Only No CoS Sent + + + +D + +User PC + + + + +Cisco IP Phone + +Voice: Untagged; Access VLAN +Data: Untagged; Access VLAN + + + + +Catalyst Cisco CallManager + + +Figure 4-7 Trunking Modes for Voice VLANs with a Cisco IP Phone + +Table 4-2 documents the four different voice VLAN configurations and how the voice and PC traffic are carried over the link between the phone and the switch. + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 115 + + +Table 4-2 + +Keyword + + +Trunking Modes with a Cisco IP Phone + +Representation in Figure 4-7 Trunk? Voice Traffic PC Traffic + + + +vlan-id A + +dot1p B + +untagged C + +none (default) D + +Yes VLAN vlan-id + +Yes VLAN 0 + +Yes Untagged + +No Access VLAN + +Untagged + +Untagged + +Untagged + +Access VLAN + + + +The default condition for every switch port is none, where a trunk is not used. All modes except for none use the special-case 802.1Q trunk. The only difference between the dot1p and untagged modes is the encapsulation of voice traffic. The dot1p mode puts the voice packets on VLAN 0, which requires a VLAN ID (not the native VLAN) but does not require a unique voice VLAN to be created. The untagged mode puts voice packets in the native VLAN, requiring neither a VLAN ID nor a unique voice VLAN. + +The most versatile mode uses the vlan-id, as shown in case A in Figure 4-7. Here, voice and user data are carried over separate VLANs. Be aware that the special-case 802.1Q trunk is automatically enabled through a CDP or LLDP information exchange between the switch and the IP phone. The trunk contains only two VLANs—a voice VLAN (tagged VVID) and the data VLAN. The switch port’s access VLAN is used as the data VLAN that carries packets to and from a PC that is connected to the phone’s PC port. + +If an IP phone is removed and a PC is connected to the same switch port, the PC still will be capable of operating because the data VLAN still will appear as the access VLAN— even though the special trunk no longer is enabled. + +Verifying Voice VLAN Operation + +You can verify the switch port mode (access or trunk) and the voice VLAN by using the show interface switchport command. As demonstrated in Example 4-7, the port is in access mode and uses access VLAN 10 and voice VLAN 110. + +Example 4-7 Verifying Switch Port Mode and Voice VLAN + +Switch# show interfaces gigabitethernet 1/0/1 switchport +Name: Gi1/0/1 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: static access +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: On +Access Mode VLAN: 10 (VLAN0010) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: 110 (VoIP) + + + +From the Library of Outcast Outcast +116 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Administrative private-vlan trunk native VLAN: none +Administrative private-vlan trunk Native VLAN tagging: enabled +Administrative private-vlan trunk encapsulation: dot1q +Administrative private-vlan trunk normal VLANs: none +Administrative private-vlan trunk private VLANs: none +Operational private-vlan: none +Trunking VLANs Enabled: ALL +Pruning VLANs Enabled: 2-1001 +Capture Mode Disabled +Capture VLANs Allowed: ALL +Protected: false +Unknown unicast blocked: disabled +Unknown multicast blocked: disabled +Appliance trust: none +Switch# + +When the IP phone trunk is active, it is not shown in the trunking mode from any Cisco IOS Software show command. However, you can verify the VLANs being carried over the trunk link by looking at the Spanning Tree Protocol (STP) activity. STP runs with two instances—one for the voice VLAN and one for the data VLAN, which can be seen with the show spanning-tree interface command. + +For example, suppose that a switch port is configured with access VLAN 10, voice VLAN 110, and native VLAN 99. Example 4-8 shows the switch port configuration and STP information when the switch port is in access mode. The access VLAN (10) is being used as the data VLAN from the IP phone. + +Example 4-8 IP Phone Trunk Configuration and STP Information + +Switch# show running-config interface gigabitethernet 1/0/1 +interface GigabitEthernet1/0/1 +switchport trunk native vlan 99 +switchport access vlan 10 +switchport voice vlan 110 +Switch# show spanning-tree interface gigabitethernet 1/0/1 +Vlan Role Sts Cost Prio.Nbr Type +---------------- ---- --- --------- -------- -------------------------------- + +VLAN0010 +VLAN0110 +Switch# + +Desg FWD 19 +Desg FWD 19 + +128.51 P2p +128.51 P2p + + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 117 + +Wireless VLANs + +Cisco wireless access points (APs) are access devices that can connect to switch ports in the access layer. The switch provides connectivity between wired and wireless environ-ments, or between VLANs and wireless LANs (WLANs). Although the SWITCH exam might not cover wireless AP support, you should become familiar with the basic concepts and know how to configure a switch port where an AP is connected. + +Cisco APs can operate in one of the two following modes: + +■ Autonomous mode: The AP operates independently and directly connects VLANs to WLANs on a one-to-one basis. + +■ Lightweight mode: The AP must join and cooperate with a wireless LAN controller located elsewhere on the network. The AP connects each of its own WLANs with a VLAN connected to the controller. All of the VLAN-WLAN traffic is encapsulated and carried over a special tunnel between the AP and the controller. + +Figure 4-8 illustrates the switch port configuration needed to support an AP in autono-mous mode. Because the AP maps VLANs to WLANs locally, each VLAN must be transported to it over a trunk link. Suppose there are three WLANs that connect to three VLANs 10, 20, and 30. The switch port connected to the AP might be configured with the commands listed in Example 4-9. + + +Switch A Switch D Autonomous AP Trunk Link Trunk Link +VLANs a, b, c VLANs a, b, c VLAN a: SSID a +VLAN b: SSID b VLAN c: SSID c + +Figure 4-8 Configuring a Switch Port to Support an Autonomous Wireless AP + +Example 4-9 Switch Port Configuration for an Autonomous AP + +SwitchA(config)# interface gigabitethernet1/0/5 +SwitchA(config-if)# switchport +SwitchA(config-if)# switchport trunk encapsulation dot1q +SwitchA(config-if)# switchport trunk allowed vlans 10,20,30 +SwitchA(config-if)# switchport mode trunk +SwitchA(config-if)# no shutdown + +An AP operating in lightweight mode needs a different configuration approach. Figure +4-9 shows how a lightweight AP connects to a switch port over a nontrunking access link. The AP needs a single VLAN to support IP connectivity between itself and the wireless LAN controller so that a Control and Provisioning of Wireless Access Points (CAPWAP) protocol tunnel can be built to transport wireless traffic. The VLAN used on the switch + + + + +From the Library of Outcast Outcast +118 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +port is not related to any wireless LANs at all; the wireless VLANs terminate on the con-troller elsewhere in the network. + + + +Switch A +Lightweight AP Access Link Trunk Link + +Switch D + +Trunk Link + + +Wireless LAN Controller + +VLAN x VLANs x, y, z,… VLANs a, b, c VLAN a: SSID a +VLAN b: SSID b VLAN c: SSID c + +Figure 4-9 Configuring a Switch Port to Support a Lightweight Wireless AP + +Suppose that the lightweight AP is connected to the switch port using VLAN 100. Three WLANs map to three VLANs 10, 20, and 30. The switch port can be configured using the commands listed in Example 4-10. + +Example 4-10 Switch Port Configuration for a Lightweight AP + +SwitchA(config)# interface gigabitethernet1/0/5 +SwitchA(config-if)# switchport +SwitchA(config-if)# switchport access vlan 100 +SwitchA(config-if)# switchport mode access +SwitchA(config-if)# no shutdown + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: VLANs and Trunks 119 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 4-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 4-3 Key Topics for Chapter 4 +Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Explains VLAN characteristics 95 + +Discusses how to configure a VLAN 97 + +Discusses planning strategies for VLAN 99 implementation +Explains the 802.1Q trunking protocol 104 + +Describes VLAN trunk link configuration 110 + +Discusses how to verify VLAN configuration 111 + +Explains how to verify that a trunk link is working 113 properly + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +VLAN, broadcast domain, VLAN number, end-to-end VLAN, local VLAN, 20/80 rule, VLAN trunk, ISL, 802.1Q, DTP, native VLAN, voice VLAN + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the VLAN and trunk-related commands, cover the right side of Tables 4-4 and Table 4-5 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + +From the Library of Outcast Outcast +120 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. For the skills covered in this chapter, notice that most of the commands involve the keyword switchport. + + +Table 4-4 + +Task + + +VLAN and Trunking Configuration Commands + +Command Syntax + + + +Create VLAN. + +Assign port to VLAN. + + +Configure trunk. + + + + + + + +Define the trunking on a port to a Cisco IP phone. + + +Switch(config)# vlan vlan-num Switch(config-vlan)# name vlan-name + +Switch(config)# interface type member/module/number Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan vlan-num + +Switch(config)# interface type member/module/number Switch(config-if)# switchport trunk encapsulation {isl | dot1q | negotiate} +Switch(config-if)# switchport trunk native vlan vlan-id Switch(config-if)# switchport trunk allowed vlan { vlan-list | all | {add | except | remove} vlan-list} +Switch(config-if)# switchport mode {trunk | dynamic {desirable | auto}} + +Switch(config-if)# switchport voice vlan {vlan-id | dot1p | untagged | none} + + + + + +Table 4-5 + +Task + + +VLAN and Trunking Troubleshooting Commands + +Command Syntax + + + +Verify VLAN configuration. + +Verify active trunk parameters. + +Compare trunk configuration and active parameters. + +Verify DTP operation. + + +Switch# show vlan id vlan-id Switch# show vlan [brief] + +Switch# show interface type member/module/number trunk + +Switch# show interface type member/module/number switchport + +Switch# show dtp [interface type member/module/number] + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ VLAN Trunking Protocol: This section presents Cisco VLAN Trunking Protocol (VTP) for VLAN management in a campus network. +■ VTP Configuration: This section covers the Catalyst switch commands used to configure VTP. + +■ VTP Pruning: This section details traffic manage-ment by pruning within VTP domains, along with the commands needed for configuration. +■ Troubleshooting VTP: This section gives a brief summary of things to consider and commands to use when VTP is not operating properly. + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 5 + + + + + + +VLAN Trunking Protocol + + +When VLANs are defined and used on switches throughout an enterprise or campus net-work, the administrative overhead can easily increase. Using the VLAN Trunking Protocol (VTP) can make VLAN administration more organized and manageable. This chapter cov-ers VTP and its configuration. A similar standards-based VLAN-management protocol for IEEE 802.1Q trunks is called GARP VLAN Registration Protocol (GVRP). The GARP and GVRP protocols are defined in the IEEE 802.1D and 802.1Q (clause 11) standards, respec-tively. At the time of this writing, GVRP was not supported in any of the Cisco Catalyst switches. Therefore, it is not covered in this text or in the SWITCH course. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 5-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 5-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +VLAN Trunking Protocol VTP Configuration +VTP Pruning + +Troubleshooting VTP + +Questions Covered in This Section +1-9 + + +10-11 + +12 + + + +1. Which of the following is not a Catalyst switch VTP mode? + +a. Server + +b. Client + +c. Designated + +d. Transparent + + + +From the Library of Outcast Outcast +124 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. A switch in VTP transparent mode can do which one of the following? + +a. Create a new VLAN + +b. Only listen to VTP advertisements + +c. Send its own VTP advertisements + +d. Cannot make VLAN configuration changes + +3. Which one of the following is a valid VTP advertisement? + +a. Triggered update + +b. VLAN database + +c. Subset + +d. Domain + +4. Which one of the following is needed for VTP communication? + +a. A Management VLAN + +b. A trunk link + +c. An access VLAN + +d. An IP address + +5. Which one of the following VTP modes does not allow any manual VLAN configu-ration changes? + +a. Server + +b. Client + +c. Designated + +d. Transparent + +6. Select all the parameters that decide whether to accept new VTP information. + +a. VTP priority + +b. VTP domain name + +c. Configuration revision number + +d. VTP server name + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 125 + +7. How many VTP management domains can a Catalyst switch participate in? + +a. 1 + +b. 2 + +c. Unlimited + +d. 4096 + +8. Which command configures a Catalyst switch for VTP client mode? + +a. set vtp mode client + +b. vtp client + +c. vtp mode client + +d. vtp client mode + +9. If a VTP server is configured for VTP Version 2, what else must happen for success-ful VTP communication in a domain? + +a. A VTP version 2 password must be set. + +b. All other switches in the domain must be version 2 capable. + +c. All other switches must be configured for VTP version 2. + +d. The VTP configuration revision number must be reset. + +10. What is the purpose of VTP pruning? + +a. Limit the number of VLANs in a domain + +b. Stop unnecessary VTP advertisements + +c. Limit the extent of broadcast traffic + +d. Limit the size of the virtual tree + +11. Which VLAN number is never eligible for VTP pruning? + +a. 0 + +b. 1 + +c. 1000 + +d. 1001 + + + + + + + + + + + +From the Library of Outcast Outcast +126 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +12. Which of the following might present a VTP problem? + +a. Two or more VTP servers in a domain + +b. Two servers with the same configuration revision number + +c. A server in two domains + +d. A new server with a higher configuration revision number + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 127 + +Foundation Topics + + +VLAN Trunking Protocol + +As the previous chapter demonstrated, VLAN configuration and trunking on a switch or a small group of switches is fairly intuitive. Campus network environments, however, usu-ally consist of many interconnected switches. Configuring and managing a large number of switches, VLANs, and VLAN trunks quickly can get out of control. + +Cisco has developed a method to manage VLANs across the campus network. The VLAN Trunking Protocol (VTP) uses Layer 2 trunk frames to communicate VLAN information among a group of switches. VTP manages the addition, deletion, and renaming of VLANs across the network from a central point of control. Any switch participating in a VTP exchange is aware of and can use any VLAN that VTP manages. + +VTP Domains + +VTP is organized into management domains, or areas with common VLAN require-ments. A switch can belong to only one VTP domain, sharing VLAN information with other switches in the domain. Switches in different VTP domains, however, do not share VTP information. + +Switches in a VTP domain advertise several attributes to their domain neighbors. Each advertisement contains information about the VTP management domain, VTP revision number, known VLANs, and specific VLAN parameters. When a VLAN is added to a switch in a management domain, other switches are notified of the new VLAN through VTP advertisements. In this way, all switches in a domain can prepare to receive traffic on their trunk ports using the new VLAN. + + +VTP Modes + + + +Key Topic + +To participate in a VTP management domain, each switch must be configured to operate in one of several modes. The VTP mode determines how the switch processes and adver- +tises VTP information. You can use the following modes: + + +■ Server mode: VTP servers have full control over VLAN creation and modifica-tion for their domains. All VTP information is advertised to other switches in the +domain, while all received VTP information is synchronized with the other switches. By default, a switch is in VTP server mode. Note that each VTP domain must have at least one server so that VLANs can be created, modified, or deleted, and VLAN information can be propagated. +■ Client mode: VTP clients do not allow the administrator to create, change, or delete any VLANs. Instead, they listen to VTP advertisements from other switches and modify their VLAN configurations accordingly. In effect, this is a passive listening mode. Received VTP information is forwarded out trunk links to neighboring switch-es in the domain, so the switch also acts as a VTP relay. + +From the Library of Outcast Outcast +128 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Transparent mode: VTP transparent switches do not participate in VTP. While in transparent mode, a switch does not advertise its own VLAN configuration, and it does not synchronize its VLAN database with received advertisements. In VTP ver-sion 1, a transparent mode switch does not even relay VTP information it receives to other switches unless its VTP domain names and VTP version numbers match those of the other switches. In VTP version 2, transparent switches do forward received VTP advertisements out of their trunk ports, acting as VTP relays. This occurs regardless of the VTP domain name setting. +■ Off mode: Like transparent mode, switches in VTP off mode do not participate in VTP; however, VTP advertisements are not relayed at all. You can use VTP off mode to disable all VTP activity on or through a switch. + + +Tip While a switch is in VTP transparent mode, it can create and delete VLANs that are local only to itself. These VLAN changes, however, are not propagated to any other switch. + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +VTP Advertisements + +VTP has evolved over time to include three different versions. Cisco switches can support all three versions, but the versions are not fully backward compatible with each other. If +a network contains switches that are running different VTP versions, you should consider how the switches will interact with their VTP information. By default, Cisco switches use VTP Version 1. + +Each Cisco switch participating in VTP advertises VLANs, revision numbers, and VLAN parameters on its trunk ports to notify other switches in the management domain. VTP Versions 1 and 2 support VLAN numbers 1 to 1005, whereas only VTP Version 3 sup-ports the full extended VLAN range 1 to 4094. + +VTP advertisements are sent as multicast frames. A switch intercepts frames sent to the VTP multicast address and processes them locally. The advertisements can also be relayed or forwarded out trunk links toward neighboring switches in all VTP modes except off mode. Because all switches in a management domain learn of new VLAN configuration changes, a VLAN must be created and configured on only one VTP server switch in the domain. + +By default, management domains are set to use nonsecure advertisements without a pass-word. You can add a password to set the domain to secure mode. The same password must be configured on every switch in the domain so that all switches exchanging VTP information use identical encryption methods. + +VTP switches use an index called the VTP configuration revision number to keep track of the most recent information. Every switch in a VTP domain stores the configuration revision number that it last heard from a VTP advertisement. The VTP advertisement pro- +cess always starts with configuration revision number 0. + + + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 129 + +When subsequent changes are made on a VTP server, the revision number is incremented before the advertisements are sent. When listening switches (configured as members of the same VTP domain as the advertising switch) receive an advertisement with a greater revision number than is stored locally, they assume that the advertisement contains new and updated information. The advertisement is stored and overwrites any previously stored VLAN information. + +VTP advertisements usually originate from server mode switches as VLAN configuration changes occur and are announced. Advertisements can also originate as requests from cli-ent mode switches that want to learn about the VTP database as they boot. + +VTP advertisements can occur in three forms: + +■ Summary advertisements: VTP domain servers send summary advertisements every 300 seconds and every time a VLAN database change occurs. The summary adver-tisement lists information about the management domain, including VTP version, domain name, configuration revision number, time stamp, MD5 encryption hash code, and the number of subset advertisements to follow. For VLAN configuration changes, summary advertisements are followed by one or more subset advertise-ments with more specific VLAN configuration data. Figure 5-1 shows the summary advertisement format. + + + + + + + + + + + + + +Figure 5-1 VTP Summary Advertisement Format + +■ Subset advertisements: VTP domain servers send subset advertisements after a VLAN configuration change occurs. These advertisements list the specific changes that have been performed, such as creating or deleting a VLAN, suspending or acti-vating a VLAN, changing the name of a VLAN, and changing a VLAN’s maximum transmission unit (MTU). Subset advertisements can list the following VLAN param-eters: status of the VLAN, VLAN type (such as Ethernet or Token Ring), MTU, length of the VLAN name, VLAN number, security association identifier (SAID) value, and VLAN name. VLANs are listed individually in sequential subset advertise-ments. Figure 5-2 shows the VTP subset advertisement format. + + + + + +From the Library of Outcast Outcast +130 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +VTP Subset Advertisement + + + + + + + + + + + + + + + + + + + + + + + + +Figure 5-2 VTP Subset Advertisement and VLAN Info Field Formats + +■ Advertisement requests from clients: A VTP client can request any VLAN informa-tion it lacks. For example, a client switch might be reset and have its VLAN database cleared, and its VTP domain membership might be changed, or it might hear a VTP summary advertisement with a higher revision number than it currently has. After +a client advertisement request, the VTP domain servers respond with summary and subset advertisements to bring it up to date. Figure 5-3 shows the advertisement request format. + + + +0 + +Version (1 byte) + +1 + +Type +(Adv request) (1 byte) + + +2 + +Reserved (1 byte) + + +3 + +Domain name length (1 byte) + +Management Domain Name (zero-padded to 32 bytes) + +Starting advertisement to request + +Figure 5-3 VTP Advertisement Request Format + + + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 131 + +Catalyst switches in server mode store VTP information separately from the switch con-figuration in NVRAM. VLAN and VTP data are saved in the vlan.dat file on the switch’s flash memory file system. All VTP information, including the VTP configuration revision number, is retained even when the switch power is off. In this manner, a switch can recov-er the last known VLAN configuration from its VTP database after it reboots. + + + + + +Key Topic + +VTP Synchronization + +Whenever a switch receives a VTP advertisement with a configuration revision number that is greater than the value stored locally, it considers the advertisement to contain newer information. The switch will overwrite its own VLAN data with the newer ver- +sion—even if the newer version contains irrelevant information. Because of this, it is very important to always force any newly added network switches to have revision number 0 before being attached to the network. Otherwise, a switch might have stored a revision number that is greater than the value currently in use in the domain. + +The VTP revision number is stored in NVRAM and is not altered by a power cycle of the switch; therefore, the revision number can be initialized to 0 only by using one of the fol- +lowing methods: + + +■ Change the switch’s VTP mode to transparent and then change the mode back to server. + +■ Change the switch’s VTP domain to a bogus name (a nonexistent VTP domain), and then change the VTP domain back to the original name. + + + + + + + + + +Key Topic + +If the VTP revision number is not reset to 0, the switch might enter the network as a VTP server and have a preexisting revision number (from a previous life) that is higher than in previous legitimate advertisements. The new switch’s VTP information would be seen as more recent, so all other switches in the VTP domain would gladly accept its database +of VLANs and overwrite their good VLAN database entries with null or deleted VLAN status information. + +In other words, a new server switch might inadvertently cause every other working switch to flush all records of every VLAN in production. The VLANs would be deleted from +the VTP database and from the switches, causing any switch port assigned to them to be returned to the default VLAN 1. This is referred to as a VTP synchronization problem. For critical portions of your network, you should consider using VTP transparent or off +mode to prevent the synchronization problem from ever becoming an issue. + + + + + + + + + + + + + +From the Library of Outcast Outcast +132 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Tip It might seem intuitive that a switch acting as a VTP server could come online with +a higher configuration revision number and wreak havoc on the whole domain. You should also be aware that this same thing can happen if a VTP client comes online with a higher revision, too! +Even though it seems as if a client should strictly listen to advertisements from servers, a client can and does send out its own advertisements. When it first powers up, a cli- +ent sends a summary advertisement from its own stored database. It realizes that it has a greater revision number if it receives an inferior advertisement from a server. Therefore, it sends out a subset advertisement with the greater revision number, which VTP servers will accept as more up-to-date information. Even in VTP client mode, a switch will store the last known VTP information—including the configuration revision number. Do not assume that a VTP client will start with a clean slate when it powers up. + + +In the days when networks were flat and VLANs stretched end to end, VTP was a con-venient administrative tool. VLANs could be created or deleted on all switches in a VTP domain very easily. In this book, you have learned that end-to-end VLANs are not a good idea. Instead, VLANs should be contained within a single switch block or a single access switch. + +In such small areas, VTP is not really necessary at all. In fact, Cisco recommends a best practice of configuring all switches in VTP transparent or off mode. You should under-stand VTP because you might encounter it in an existing network and you should know how to maintain and disable it. + +VTP Configuration + +By default, every switch operates in VTP server mode for the management domain NULL (a blank string), with no password or secure mode. If the switch hears a VTP summary advertisement on a trunk port from any other switch, it automatically learns the VTP domain name, VLANs, and the configuration revision number it hears. This makes it easy to bring up a new switch in an existing VTP domain. However, be aware that the new switch stays in VTP server mode, something that might not be desirable. + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 133 + + +Tip You should get into the habit of double-checking the VTP configuration of any switch before you add it into your network. Make sure that the VTP configuration revision number is set to 0. You can do this by isolating the switch from the network, powering it up, and using the show vtp status command, as demonstrated in the following output: + +Switch# show vtp status +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID + + +: 1 to 3 +: 1 +: +: Disabled +: Disabled +: aca0.164f.3f80 + +Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 +Local updater ID is 0.0.0.0 (no valid interface found) + +Feature VLAN: +-------------- +VTP Operating Mode +Maximum VLANs supported locally +Number of existing VLANs +Configuration Revision +MD5 digest + + + +: Server +: 1005 +: 5 +: 0 +: 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD +0x56 0x9D 0x4A 0x3E 0xA5 0x69 0x35 0xBC +Switch# + +Here, the switch has a configuration revision number of 0, and is in the default state of VTP server mode with an undefined VTP domain name. This switch would be safe to add to a network. + + +The following sections discuss the commands and considerations that you should use to configure a switch for VTP operation. + +Configuring the VTP Version + +Three versions of VTP are available for use in a management domain. Catalyst switches can run either VTP Version 1, 2, or 3. Within a management domain, the versions are not fully interoperable. Therefore, the same VTP version should be configured on every switch in a domain. Switches use VTP Version 1 by default. + +However, a switch can make some adjustments to be more compatible with neighbors using different VTP versions. For example, a switch running VTPv1 will attempt to change to VTPv2 if it hears a switch running Version 2 or 3 in the domain and it is capa-ble of running Version 2. A switch running VTPv3 will begin sending scaled-down adver-tisements if it hears a VTPv1 switch. One exception is if extended range VLANs (1006 to 4094) are in use; the extended range is supported only on switches capable of VTPv3. + + + + + +From the Library of Outcast Outcast +134 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Key Topic + +The VTP versions differ in the features they support. VTP Versions 2 and 3 offer addi- +tional features over Version 1, as listed in Tables 5-2 and 5-3, respectively. + + +Table 5-2 Additional Features Supported by VTP Version 2 + +VTP v2 Feature Description +Version-dependent transparent mode Relay VTP messages in transparent mode without checking for version mismatches. + +Consistency checks + + + +Token Ring support + +Unrecognized Type-Length-Value (TLV) support + +Check VTP and VLAN parameters entered from the command-line interface (CLI) or Simple Network Management Protocol (SNMP) to prevent errors from being propagated to other switches. +Token Ring switching and VLANs can be advertised. + +VTP messages are relayed even if they contain advertisements other than known types. This allows VTP to be extended to include new advertisement types. + + + + +Table 5-3 Additional Features Supported by VTP Version 3 + + +VTP v3 Feature +Extended VLAN range + +Enhanced authentication + +Database propagation + +Primary and secondary servers + + +Per-port VTP + +Description +VLANs 1 through 4094 can be advertised throughout a VTPv3 domain. +Switches can authenticate with each other through a secret key that can be hidden from the configuration. +Databases other than VTP can be advertised. + +By default, all VTPv3 switches operate as secondary servers and can send updates throughout the domain. A primary server is only needed to take control of a domain. +VTPv3 can be enabled on a per-trunk port basis, rather than a switch as a whole. + + + +The VTP version number is configured using the following global configuration command: + +Switch(config)# vtp version {1 | 2 | 3} + +By default, a switch uses VTP Version 1. + + + + + +Key Topic + +Configuring a VTP Management Domain + +Before a switch is added into a network, the VTP management domain should be iden- +tified. If this switch is the first one on the network, the management domain must be + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 135 + +created. Otherwise, the switch might have to join an existing management domain with other existing switches. + +You can use the following global configuration command to assign a switch to a manage-ment domain, where the domain-name is a text string up to 32 characters long: +Switch(config)# vtp domain domain-name + + +Configuring the VTP Mode + +Next, you need to choose the VTP mode for the new switch. The VTP modes of opera-tion and their guidelines for use are as follows: + + +■ Key +Topic + +Server mode: Server mode can be used on any switch in a management domain, even if other server and client switches are already in use. This mode provides some redundancy in case of a server failure in the domain. Each VTP management domain should have at least one server. The first server defined in a network also defines +the management domain that will be used by future VTP servers and clients. Server +mode is the default VTP mode and allows VLANs to be created and deleted. + + + +Note Multiple VTP servers can coexist in a domain. This is usually recommended for redundancy. The servers do not elect a primary or secondary server; they all simply func-tion as servers. If one server is configured with a new VLAN or VTP parameter, it advertis-es the changes to the rest of the domain. All other servers synchronize their VTP databases to this advertisement, just as any VTP client would. + + +■ Client mode: If other switches are in the management domain, you should configure a new switch for client mode operation. In this way, the switch is forced to learn any existing VTP information from a reliable existing server. After the switch has learned the current VTP information, you can reconfigure it for server mode if it will be used as a redundant server. +■ Transparent mode: This mode is used if a switch will not share VLAN information with any other switch in the network. VLANs still can be manually created, deleted, and modified on the transparent switch (and on every other transparent switch that the VLANs touch). However, they are not advertised to other neighboring switches. VTP advertisements received by a transparent switch, however, are forwarded to other switches on trunk links. + +Keeping switches in transparent mode can eliminate the chance for duplicate, over-lapping VLANs in a large network with many network administrators. For example, two administrators might configure VLANs on switches in their respective areas but use the same VLAN identification or VLAN number. Even though the two VLANs have different meanings and purposes, they could overlap if both administrators advertised them using VTP servers. + + + + +From the Library of Outcast Outcast +136 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Off mode: You can use off mode to disable all VTP activity on a switch. No VTP advertisements are sent, none will be received and processed, and none will be relayed to other neighboring switches. + + + +Key Topic + +You can configure the VTP mode with the following sequence of global configuration commands: +Switch(config)# vtp mode {server | client | transparent | off} +Switch(config)# vtp password password [hidden | secret] + + +If the domain is operating in secure mode, a password also can be defined. The pass-word can be configured only on VTP servers and clients. The password itself is not sent; instead, a message digest 5 (MD5) authentication or hash code is computed and sent in VTP advertisements (servers) and is used to validate received advertisements (clients). The password is a string of 1 to 32 characters (case sensitive). For VTP Version 3, the pass-word can be hidden (only a hash of the password is saved in the running configuration) or secret (the password is saved in the running configuration). + +If secure VTP is implemented using passwords, begin by configuring a password on the VTP servers. The client switches retain the last-known VTP information but cannot pro-cess received advertisements until the same password is configured on them, too. + +Table 5-4 shows a summary of the VTP modes. You can use this table for quick review as you study VTP operation. + +Table 5-4 Catalyst VTP Modes + + +VTP Mode +Server + + +Client + + +Transparent + + +Off + +Characteristics +All VLAN and VTP configuration changes occur here. The server advertises settings and changes to all other servers and clients in a VTP domain. (This is the default mode for Catalyst switches.) +Listens to all VTP advertisements from servers in a VTP domain. Advertisements are relayed out other trunk links. No VLAN or VTP configuration changes can be made on a client. +VLAN configuration changes are made locally, independent of any VTP domain. VTP advertisements are not received but merely are relayed out other trunk links, if possible. +VLAN configuration changes are made locally; incoming VTP advertisements are not processed locally, but simply relayed instead. + + + + +VTP Configuration Example + +As an example, a switch is configured as a VTP Version 1 server in a domain named MyCompany. The domain uses secure VTP with the password bigsecret. You can use the following configuration commands to accomplish this: + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 137 + +Switch(config)# vtp version 1 +Switch(config)# vtp domain MyCompany +Switch(config)# vtp mode server +Switch(config)# vtp password bigsecret + +To follow the best practice and put a switch into VTP transparent mode, you can use the following command: +Switch(config)# vtp mode transparent + + +VTP Status + +The current VTP parameters for a management domain can be displayed using the show vtp status command. Example 5-1 demonstrates some sample output of this command from a switch acting as a VTP client in the VTP domain called CampusDomain. + +Key Example 5-1 show vtp status Reveals VTP Parameters for a Management Domain Topic Switch# show vtp status + +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID + +: 1 to 3 +: 1 +: CampusDomain +: Disabled +: Disabled +: aca0.164f.3f80 + +Configuration last modified by 0.0.0.0 at 3-30-11 04:42:25 + + +Feature VLAN: +-------------- +VTP Operating Mode +Maximum VLANs supported locally +Number of existing VLANs +Configuration Revision +MD5 digest + +Switch# + + + +: Client +: 1005 +: 17 +: 25 +: 0x6E 0x21 0x14 0x12 0x56 0x0E 0x0A 0x21 +0x4A 0x32 0x6C 0xB7 0xA8 0xA5 0x28 0x08 + + +You can also use the show vtp status command to verify that a switch is operating in the VTP transparent mode, as shown in Example 5-2. + +Example 5-2 show vtp status Verifies VTP Transparent Mode + + +Switch# show vtp status +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation + + +: 1 to 3 +: 1 +: +: Disabled +: Disabled + + + + +From the Library of Outcast Outcast +138 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Device ID : aca0.164f.3f80 +Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 + + +Feature VLAN: +-------------- +VTP Operating Mode +Maximum VLANs supported locally +Number of existing VLANs +Configuration Revision +MD5 digest + +Switch# + + + +: Transparent +: 1005 +: 5 +: 0 +: 0x5E 0x0E 0xA7 0x4E 0xC7 0x4C 0x6F 0x3B +0x9E 0x17 0x1F 0x31 0xE0 0x05 0x91 0xCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +VTP Pruning + +Recall that, by definition, a switch must forward broadcast frames out all available ports in the broadcast domain because broadcasts are destined everywhere there is a listener. Unless forwarded by more intelligent means, multicast frames follow the same pattern. + +In addition, frames destined for an address that the switch has not yet learned or has forgotten (the MAC address has aged out of the address table) must be forwarded out all ports in an attempt to find the destination. These frames are referred to as unknown unicast. + +When forwarding frames out all ports in a broadcast domain or VLAN, trunk ports are included if they transport that VLAN. By default, a trunk link transports traffic from all VLANs, unless specific VLANs are removed from the trunk. Generally, in a network +with several switches, trunk links are enabled between switches, and VTP might be used to manage the propagation of VLAN information. This scenario causes the trunk links between switches to carry traffic from all VLANs, not just from the specific VLANs created. Consider the network shown in Figure 5-4. When end user Host PC in VLAN 3 sends a broadcast, Catalyst switch C forwards the frame out all VLAN 3 ports, including the trunk link to Catalyst A. Catalyst A, in turn, forwards the broadcast on to Catalysts B and D over those trunk links. Catalysts B and D forward the broadcast out only their access links that have been configured for VLAN 3. If Catalysts B and D do not have any active users in VLAN 3, forwarding that broadcast frame to them would consume band-width on the trunk links and processor resources in both switches, only to have switches B and D discard the frames. + +VTP pruning makes more efficient use of trunk bandwidth by reducing unnecessary flooded traffic. Broadcast, multicast, and unknown unicast frames on a VLAN are for-warded over a trunk link only if the switch on the receiving end of the trunk has ports in that VLAN. + +VTP pruning occurs as an extension to VTP version 1, using an additional VTP mes-sage type. When a Catalyst switch has a port associated with a VLAN, the switch sends an advertisement to its neighbor switches that it has active ports on that VLAN. The neighbors keep this information, enabling them to decide whether flooded traffic from a +VLAN should be allowed on the trunk links. + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 139 + +Catalyst A (VLANs 1-1000) + + + + +Catalyst B Catalyst C Catalyst D + + + + + +VLAN 2 VLANs 3,4 + + + +Host PC VLAN 3 + +Figure 5-4 Flooding in a Catalyst Switch Network + +Figure 5-5 shows the network from Figure 5-4 with VTP pruning enabled. Because Catalyst B has not advertised its use of VLAN 3, Catalyst A will prune VLAN 3 from the trunk to B and will choose not to flood VLAN 3 traffic to Catalyst B over the trunk link. Catalyst D has advertised the need for VLAN 3, so traffic will be flooded to it. + +Catalyst A (VLANs 1-1000) + + + + +Catalyst B Catalyst C Catalyst D + + + + + +VLAN 2 VLANs 3,4 + + + +Host PC VLAN 3 + +Figure 5-5 Flooding in a Catalyst Switch Network Using VTP Pruning + + + + + + + +From the Library of Outcast Outcast +140 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Tip Even when VTP pruning has determined that a VLAN is not needed on a trunk, +an instance of the Spanning Tree Protocol (STP) will run for every VLAN that is allowed on the trunk link. To reduce the number of STP instances, you should manually “prune” unneeded VLANs from the trunk and allow only the needed ones. Use the switchport trunk allowed vlan command to identify the VLANs that should be added or removed from a trunk. + + + +Enabling VTP Pruning + +By default, VTP pruning is disabled. To enable pruning, use the following global configu-ration command: +Switch(config)# vtp pruning + +If you use this command on a VTP server, it also advertises that pruning needs to be enabled for the entire management domain. All other switches listening to that advertise-ment will also enable pruning. + +When pruning is enabled, all general-purpose VLANs become eligible for pruning on all trunk links, if needed. However, you can modify the default list of pruning eligibility with the following interface-configuration command: +Switch(config)# interface type member/module/number +Switch(config-if)# switchport trunk pruning vlan {{{ add | except | remove} vlan-list} | none} + +By default, VLANs 2 through 1001 are eligible, or “enabled,” for potential pruning on every trunk. Use one of the following keywords with the command to tailor the list: + +■ vlan-list: An explicit list of eligible VLAN numbers (anything from 2 to 1001), sepa-rated by commas or by dashes, but no spaces. + +■ add vlan-list: A list of VLAN numbers (anything from 2 to 1001) is added to the already configured list; this is a shortcut to keep from typing a long list of numbers. + +■ except vlan-list: All VLANs are eligible except for the VLAN numbers listed (any-thing from 2 to 1001); this is a shortcut to keep from typing a long list of numbers. + +■ remove vlan-list: A list of VLAN numbers (anything from 2 to 1001) is removed from the already configured list; this is a shortcut to keep from typing a long list of numbers. +■ None: No VLAN will be eligible for pruning. + + + + + + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 141 + + +Tip Be aware that VTP pruning has no effect on switches in the VTP transparent mode. Instead, those switches must be configured manually to “prune” VLANs from trunk links. By default, VLANs 2 to 1001 are eligible for pruning. VLAN 1 has a special meaning because it is sometimes used for control traffic and is the default access VLAN on switch ports. Because of these historical reasons, VLAN 1 is never eligible for pruning. In addi-tion, VLANs 1002 through 1005 are reserved for Token Ring and FDDI VLANs and are never eligible for pruning. + + + +Troubleshooting VTP + +If a switch does not seem to be receiving updated information from a VTP server, con-sider these possible causes: + +■ The switch is configured for VTP transparent mode. In this mode, incoming VTP advertisements are not processed; they are relayed only to other switches in the domain. + +■ If the switch is configured as a VTP client, there might not be another switch func-tioning as a VTP server. In this case, configure the local switch to become a VTP server itself. + +■ The link toward the VTP server is not in trunking mode. VTP advertisements are sent only over trunks. Use the show interface type member/module/number switchport to verify the operational mode as a trunk. + +■ Make sure that the VTP domain name is configured correctly to match that of the VTP server. + +■ Make sure that the VTP version is compatible with other switches in the VTP domain. + +■ Make sure that the VTP password matches others in the VTP domain. If the server does not use a password, make sure the password is disabled or cleared on the local switch. + + +Tip Above all else, verify a switch’s VTP configuration before connecting it to a produc-tion network. If the switch has been configured previously or used elsewhere, it might already be in VTP server mode and have a VTP configuration revision number that is high-er than that of other switches in the production VTP domain. In that case, other switches will listen and learn from the new switch because it has a higher revision number and +must know more recent information. This could cause the new switch to introduce bogus VLANs into the domain or, worse yet, to cause all other switches in the domain to delete all their active VLANs. +To prevent this from happening, reset the configuration revision number of every new switch before it is added to a production network. Even better, avoid using VTP completely! + + + +From the Library of Outcast Outcast +142 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Table 5-5 lists and describes the commands that are useful for verifying or troubleshoot-ing VTP configuration. + + +Table 5-5 + +Function + + +VTP Configuration Troubleshooting Commands + +Command Syntax + + + +Displays current VTP parameters, including the last advertising server +Displays defined VLANs + +Displays trunk status, including pruning eligibility + +Displays VTP pruning state + +show vtp status + +show vlan brief + +show interface type member/module/number switchport + +show interface type member/module/number pruning + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 5: VLAN Trunking Protocol 143 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 5-6 lists a reference of these key topics and the page numbers on which each is found. + +Table 5-6 Key Topics for Chapter 5 +Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +List + +Example 5-1 + +Paragraph + +Describes VTP modes 127 + +Explains the VPN configuration revision number 128 + +Discusses the VTP synchronization problem and 131 how to prevent it from occurring +Describes VTP version operation 134 + +Explains how to configure the VTP mode 135 + +Discusses how to verify VTP operation 137 + +Explains VTP pruning 138 + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +VTP, VTP domain, VTP configuration revision number, VTP synchronization prob-lem, VTP pruning + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + + + + +From the Library of Outcast Outcast +144 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +To test your memory of the VTP-related commands, cover the right side of Table 5-7 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. For the skills covered in this chapter, remember that the com-mands always involve the vtp keyword. + + +Table 5-7 + +Task + + +VTP Configuration Commands + +Command Syntax + + + +Define the VTP domain. + +Set the VTP mode. + +Define an optional VTP password. + +Configure VTP version. + +Enable VTP pruning. + +Select VLANs eligible for pruning on a trunk interface. + + +Switch(config)# vtp domain domain-name + +Switch(config)# vtp mode { server | client | transparent | off} + +Switch(config)# vtp password password [hidden | secret] +Switch(config)# vtp version { 1 | 2 | 3} + +Switch(config)# vtp pruning + +Switch(config)# interface type member/ module/number + +Switch(config-if)# switchport trunk pruning vlan { add | except | none | remove} vlan-list + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ IEEE 802.1D Overview: This section discusses the original, or more traditional, Spanning Tree Protocol (STP). This protocol is the foundation for the +default Catalyst STP and for all the enhancements that are described in Chapters 7, “Spanning-Tree Configuration,” through 9, “Advanced Spanning Tree Protocol.” +■ Types of STP: This section discusses other types of STP that might be running on a Catalyst switch— specifically, the Common Spanning Tree, Per-VLAN Spanning Tree (PVST), and PVST+. + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 6 + + + + + + +Traditional Spanning Tree Protocol + + +Previous chapters covered ways to connect two switches together with a VLAN trunk link. What if something happens to the trunk link? The two switches would be isolated from each other. A more robust network design would add redundant links between switches. Although this increases the network availability, it also opens up the possibility for conditions that would impair the network. In a Layer 2 switched network, preventing bridging loops from forming over redundant paths is important. Spanning Tree Protocol (STP) was designed to monitor and control the Layer 2 network so that a loop-free topol-ogy is maintained. + +This chapter discusses the theory and operation of the STP. More specifically, the origi-nal, or traditional, STP is covered, as defined in IEEE 802.1D. Several chapters explain STP topics in this book. Here is a brief roadmap so that you can chart a course: + +■ Chapter 6, “Traditional Spanning Tree Protocol”: Covers the theory of IEEE 802.1D + +■ Chapter 7, “Spanning-Tree Configuration”: Covers the configuration commands needed for IEEE 802.1D + +■ Chapter 8, “Protecting the Spanning Tree Protocol Topology”: Covers the fea-tures and commands to filter and protect a converged STP topology from conditions that could destabilize it +■ Chapter 9, “Advanced Spanning Tree Protocol”: Covers the newer 802.1w and 802.1s enhancements to STP, allowing more scalability and faster convergence + + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 6-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + + + + + + + +From the Library of Outcast Outcast +148 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Table 6-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +IEEE 802.1D Overview + +Types of STP + +Questions Covered in This Section +1–9 + +10–11 + + + +1. How is a bridging loop best described? + +a. A loop formed between switches for redundancy + +b. A loop formed by the Spanning Tree Protocol + +c. A loop formed between switches where frames circulate endlessly + +d. The round-trip path a frame takes from source to destination + +2. Which of these is one of the parameters used to elect a root bridge? + +a. Root path cost + +b. Path cost + +c. Bridge priority + +d. BPDU revision number + +3. If all switches in a network are left at their default STP values, which one of the fol-lowing is not true? + +a. The root bridge will be the switch with the lowest MAC address. + +b. The root bridge will be the switch with the highest MAC address. + +c. One or more switches will have a bridge priority of 32,768. + +d. A secondary root bridge will be present on the network. + +4. Configuration BPDUs are originated by which of the following? + +a. All switches in the STP domain + +b. Only the root bridge switch + +c. Only the switch that detects a topology change + +d. Only the secondary root bridge when it takes over + +5. What happens to a port that is neither a root port nor a designated port? + +a. It is available for normal use. + +b. It can be used for load balancing. + +c. It is put into the Blocking state. + +d. It is disabled. + + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 149 + +6. What is the maximum number of root ports that a Catalyst switch can have? + +a. 1 + +b. 2 + +c. Unlimited + +d. None + +7. What mechanism is used to set STP timer values for all switches in a network? + +a. Configuring the timers on every switch in the network. + +b. Configuring the timers on the root bridge switch. + +c. Configuring the timers on both primary and secondary root bridge switches. + +d. The timers cannot be adjusted. + +8. MAC addresses can be placed into the CAM table, but no data can be sent or received if a switch port is in which of the following STP states? + +a. Blocking + +b. Forwarding + +c. Listening + +d. Learning + +9. What is the default “hello” time for IEEE 802.1D? + +a. 1 second + +b. 2 seconds + +c. 30 seconds + +d. 60 seconds + +10. Which of the following is the Spanning Tree Protocol that is defined in the IEEE 802.1Q standard? + +a. PVST + +b. CST + +c. EST + +d. MST + + + + + + + + + + +From the Library of Outcast Outcast +150 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +11. If a switch has ten VLANs defined and active, how many instances of STP will run using PVST+ versus CST? + +a. 1 for PVST+, 1 for CST + +b. 1 for PVST+, 10 for CST + +c. 10 for PVST+, 1 for CST + +d. 10 for PVST+, 10 for CST + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 151 + +Foundation Topics + + +IEEE 802.1D Overview + +A robust network design not only includes efficient transfer of packets or frames, but also considers how to recover quickly from faults in the network. In a Layer 3 environ-ment, the routing protocols in use keep track of redundant paths to a destination network so that a secondary path can be used quickly if the primary path fails. Layer 3 rout- +ing allows many paths to a destination to remain up and active, and allows load sharing across multiple paths. + +In a Layer 2 environment (switching or bridging), however, no routing protocols are used, and active redundant paths are neither allowed nor desirable. Instead, some form of bridging provides data transport between networks or switch ports. The Spanning Tree Protocol (STP) provides network link redundancy so that a Layer 2 switched network can recover from failures without intervention in a timely manner. The STP is defined in the IEEE 802.1D standard. + +STP is discussed in relation to the problems it solves in the sections that follow. + + +Bridging Loops + +Recall that a Layer 2 switch mimics the function of a transparent bridge. A transparent bridge must offer segmentation between two networks while remaining transparent to all the end devices connected to it. For the purpose of this discussion, consider a two-port Ethernet switch and its similarities to a two-port transparent bridge. + +A transparent bridge (and the Ethernet switch) must operate as follows: Key +Topic ■ The bridge has no initial knowledge of any end device’s location; therefore, the +bridge must “listen” to frames coming into each of its ports to figure out on which network each device resides. The bridge assumes that a device using the source MAC address is located behind the port that the frame arrives on. As the listening process continues, the bridge builds a table that correlates source MAC addresses with the bridge port numbers where they were detected. + +■ The bridge can constantly update its bridging table on detecting the presence of a new MAC address or on detecting a MAC address that has changed location from one bridge port to another. The bridge then can forward frames by looking at the destination MAC address, looking up that address in the bridge table, and sending the frame out the port where the destination device is known to be located. + +■ If a frame arrives with the broadcast address as the destination address, the bridge must forward, or flood, the frame out all available ports. However, the frame is not forwarded out the port that initially received the frame. In this way, broadcasts can reach all available Layer 2 networks. A bridge segments only collision domains; it does not segment broadcast domains. + + + +From the Library of Outcast Outcast +152 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ If a frame arrives with a destination address that is not found in the bridge table, the bridge cannot determine which port to forward the frame to for transmission. This type of frame is known as an unknown unicast. In this case, the bridge treats the frame as if it were a broadcast and floods it out all remaining ports. When a reply to that frame is overheard, the bridge can learn the location of the unknown station and can add it to the bridge table for future use. + +■ Frames forwarded across the bridge cannot be modified by the bridge itself. Therefore, the bridging process is effectively transparent. + +Bridging or switching in this fashion works well. Any frame forwarded, whether to a known or unknown destination, is forwarded out the appropriate port or ports so that it is likely to be received successfully at the intended destination. Figure 6-1 shows a simple two-port switch functioning as a bridge, forwarding frames between two end devices. However, this network design offers no additional links or paths for redundancy if the switch or one of its links fails. In that case, the networks on either side of the bridge would become isolated from each other. + +PC-1 PC-2 + + + + + +Segment A + +gi1/0/1 + +Switch A + +gi1/0/2 + +Segment B + + + + + + + +PC-3 + +Figure 6-1 + +PC-4 + +Transparent Bridging with a Switch + + +To add some redundancy, you can add a second switch between the two original network segments, as shown in Figure 6-2. Now, two switches offer the transparent bridging func-tion in parallel. In theory, a single switch or a single link can fail without causing end-to-end connectivity to fail. + +Consider what happens when PC 1 sends a frame to PC 4. For now, assume that both PC 1 and PC 4 are known to the switches and are in their address tables. PC 1 sends the frame onto network Segment A. Switch A and switch B both receive the frame on their + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 153 + +gi1/0/1 ports. Because PC 4 already is known to the switches, the frame is forwarded out ports gi1/0/2 on each switch onto Segment B. The end result is that PC 4 receives two copies of the frame from PC 1. This is not ideal, but it is not disastrous, either. + +PC-1 PC-2 + + + + + +Segment A + +gi1/0/1 gi1/0/1 + + +Switch A + +gi1/0/2 + + +Switch B + +gi1/0/2 + + +Segment B + + + + + + +PC-3 PC-4 + +Figure 6-2 Redundant Bridging with Two Switches + + + +Key Topic + +Now, consider the same process of sending a frame from PC 1 to PC 4. This time, how-ever, neither switch knows anything about the location of PC 1 or PC 4. PC 1 sends the +frame to PC 4 by placing it on Segment A. The sequence of events is as follows: + + +Step 1. Both Switch A and Switch B receive the frame on their gi1/0/1 ports. Because the MAC address of PC 1 has not yet been seen or recorded, each switch records PC 1’s MAC address in its address table along with the receiving port number, gi1/0/1. From this information, both switches infer that PC 1 must reside on Segment A. +Step 2. Because the location of PC 4 is unknown, both switches correctly decide that they must flood the frame out all available ports. This is an unknown unicast condition and is their best effort to make sure that the frame eventually reach-es its destination. +Step 3. Each switch floods or copies the frame to its gi1/0/2 port on Segment B. PC 4, located on Segment B, receives the two frames destined for it. However, on Segment B, Switch A now hears the new frame forwarded by Switch B, and Switch B hears the new frame forwarded by Switch A. +Step 4. Switch A sees that the “new” frame is from PC 1 to PC 4. From the address table, the switch previously learned that PC 1 was on port gi1/0/1, or Segment + + + +From the Library of Outcast Outcast +154 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +A. However, the source address of PC 1 has just been heard on port gi1/0/2, or Segment B. By definition, the switch must relearn the location of PC 1 with the most recent information, which it now incorrectly assumes to be Segment B. (Switch B follows the same procedure, based on the “new” frame from Switch A.) +Step 5. At this point, neither Switch A nor Switch B has learned the location of PC 4 because no frames have been received with PC 4 as the source address. +Therefore, the new frame must be flooded out all available ports in an attempt to find PC 4. This frame then is sent out Switch A’s gi1/0/1 port and on to Segment A, as well as Switch B’s gi1/0/1 port and on to Segment A. +Step 6. Now both switches relearn the location of PC 1 as Segment A and forward the “new” frames back onto Segment B; then the entire process repeats. + +This process of forwarding a single frame around and around between two switches is known as a bridging loop. Neither switch is aware of the other, so each happily forwards the same frame back and forth between its segments. Also note that because two switches are involved in the loop, the original frame has been duplicated and now is sent around in two counter-rotating loops. What stops the frame from being forwarded in this fashion forever? Nothing! PC 4 begins receiving frames addressed to it as fast as the switches can forward them. + +Notice how the learned location of PC 1 keeps changing as frames get looped. Even a simple unicast frame has caused a bridging loop to form, and each switch’s bridge table is repeatedly corrupted with incorrect data. + +What would happen if PC 1 sent a broadcast frame instead? The bridging loops (remem-ber that two of them are produced by the two parallel switches) form exactly as before. The broadcast frames continue to circulate forever. Now, however, every end-user device located on both Segments A and B receives and processes every broadcast frame. This type of broadcast storm can easily saturate the network segments and bring every host on the segments to a halt. + +The only way to end the bridging loop condition is to physically break the loop by discon-necting switch ports or shutting down a switch. Obviously, it would be better to prevent bridging loops than to be faced with finding and breaking them after they form. + +Preventing Loops with Spanning Tree Protocol + +Bridging loops form because parallel switches (or bridges) are unaware of each other. STP was developed to overcome the possibility of bridging loops so that redundant switches and switch paths could be used for their benefits. Basically, the protocol enables switches to become aware of each other so they can negotiate a loop-free path through the network. + + +Note Because STP is involved in loop detection, many people refer to the catastrophic loops as spanning-tree loops. This is technically incorrect because the Spanning Tree Protocol’s entire function is to prevent bridging loops. The correct terminology for this condition is a bridging loop. + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 155 + +Loops are discovered before they are made available for use, and redundant links are effectively shut down to prevent the loops from forming. In the case of redundant links, switches can be made aware that a link shut down for loop prevention should be brought up quickly in case of a link failure. The section “Redundant Link Convergence” in Chapter 7 provides more information. + +STP is communicated among all connected switches on a network. Each switch executes the spanning-tree algorithm based on information received from other neighboring switches. The algorithm chooses a reference point in the network and calculates all the redundant paths to that reference point. When redundant paths are found, the spanning-tree algorithm picks one path by which to forward frames and disables, or blocks, for-warding on the other redundant paths. + +As its name implies, STP computes a tree structure that spans all switches in a subnet or network. Redundant paths are placed in a Blocking or Standby state to prevent frame forwarding. The switched network is then in a loop-free condition. However, if a for- +warding port fails or becomes disconnected, the spanning-tree algorithm recomputes the spanning-tree topology so that the appropriate blocked links can be reactivated. + + +Spanning-Tree Communication: Bridge Protocol Data Units + + + +Key Topic + +STP operates as switches communicate with one another. Data messages are exchanged in the form of bridge protocol data units (BPDUs). A switch sends a BPDU frame out a port, using the unique MAC address of the port itself as a source address. The switch is unaware of the other switches around it, so BPDU frames are sent with a destination address of the well-known STP multicast address 01-80-c2-00-00-00. + +Two types of BPDU exist: + + +■ Configuration BPDU, used for spanning-tree computation + +■ Topology Change Notification (TCN) BPDU, used to announce changes in the net-work topology + +The Configuration BPDU message contains the fields shown in Table 6-2. The TCN BPDU is discussed in the “Topology Changes” section later in this chapter. + +Table 6-2 Configuration BPDU Message Content + + +Field Description +Protocol ID (always 0) + +Version + +Number of Bytes +2 + +1 + + +Message Type (Configuration or TCN BPDU) 1 + +Flags 1 + +Root Bridge ID 8 + +Root Path Cost 4 + + + +From the Library of Outcast Outcast +156 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Field Description Sender Bridge ID Port ID +Message age (in 256ths of a second) Maximum age (in 256ths of a second) Hello time (in 256ths of a second) +Forward delay (in 256ths of a second) + +Number of Bytes 8 +2 2 2 2 +2 + + + +The exchange of BPDU messages works toward the goal of electing reference points as a foundation for a stable spanning-tree topology. Also, loops can be identified and removed by placing specific redundant ports in a Blocking or Standby state. Notice that several key fields in the BPDU are related to bridge (or switch) identification, path costs, and timer values. These all work together so that the network of switches can converge on a common spanning-tree topology and select the same reference points within the network. These reference points are defined in the sections that follow. + +By default, BPDUs are sent out all switch ports every 2 seconds so that current topology information is exchanged and loops are identified quickly. + + + + + +Key Topic + +Electing a Root Bridge + +For all switches in a network to agree on a loop-free topology, a common frame of refer-ence must exist to use as a guide. This reference point is called the root bridge. (The term bridge continues to be used even in a switched environment because STP was developed for use in bridges. Therefore, when you see bridge, think switch.) + +An election process among all connected switches chooses the root bridge. Each switch has a unique bridge ID that identifies it to other switches. The bridge ID is an 8-byte +value consisting of the following fields: + + +■ Bridge Priority (2 bytes): The priority or weight of a switch in relation to all other switches. The Priority field can have a value of 0 to 65,535 and defaults to 32,768 (or 0x8000) on every Catalyst switch. + +■ MAC Address (6 bytes): The MAC address used by a switch can come from the Supervisor module, the backplane, or a pool of 1024 addresses that are assigned to every supervisor or backplane, depending on the switch model. In any event, this address is hard-coded and unique, and the user cannot change it. + +When a switch first powers up, it has a narrow view of its surroundings and assumes that it is the root bridge itself. (This notion probably will change as other switches check in and enter the election process.) The election process then proceeds as follows: Every switch begins by sending out BPDUs with a root bridge ID equal to its own bridge ID and a sender bridge ID that is its own bridge ID. The sender bridge ID simply tells other + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 157 + +switches who is the actual sender of the BPDU message. (After a root bridge is decided on, configuration BPDUs are sent only by the root bridge. All other bridges must forward or relay the BPDUs, adding their own sender bridge IDs to the message.) + +Received BPDU messages are analyzed to see if a “better” root bridge is being announced. A root bridge is considered better if the root bridge ID value is lower than another. Again, think of the root bridge ID as being broken into Bridge Priority and MAC Address fields. If two bridge priority values are equal, the lower MAC address makes the bridge ID better. When a switch hears of a better root bridge, it replaces its own root bridge ID with the root bridge ID announced in the BPDU. The switch then is required to recommend or advertise the new root bridge ID in its own BPDU messages, although it still identifies itself as the sender bridge ID. + +Sooner or later, the election converges and all switches agree on the notion that one of them is the root bridge. As might be expected, if a new switch with a lower bridge prior-ity powers up, it begins advertising itself as the root bridge. Because the new switch does indeed have a lower bridge ID, all the switches soon reconsider and record it as the new root bridge. This can also happen if the new switch has a bridge priority equal to that of the existing root bridge but has a lower MAC address. Root bridge election is an ongoing process, triggered by root bridge ID changes in the BPDUs every 2 seconds. + +As an example, consider the small network shown in Figure 6-3. For simplicity, assume that each switch has a MAC address of all 0s, with the last hex digit equal to the switch label. + +Switch A +32768: 0000.0000.000a + + + +gi1/0/1 gi1/0/2 + + + +1 Gbps Cost = 4 + + + + +gi1/0/1 + +gi1/0/2 + + +Switch B +32768: 0000.0000.000b + +1 Gbps Cost = 4 + + + + +gi1/0/1 + +gi1/0/2 +1 Gbps +Cost = 4 Switch C 32768: 0000.0000.000c + + +Figure 6-3 Example of Root Bridge Election + +In this network, each switch has the default bridge priority of 32,768. The switches are interconnected with Gigabit Ethernet links. All three switches try to elect themselves as + + + + +From the Library of Outcast Outcast +158 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +the root, but all of them have equal bridge priority values. The election outcome produc-es the root bridge, determined by the lowest MAC address—that of Switch A. + + + + + +Key Topic + +Electing Root Ports + +Now that a reference point has been nominated and elected for the entire switched net-work, each nonroot switch must figure out where it is in relation to the root bridge. This action can be performed by selecting only one root port on each nonroot switch. The root port always points toward the current root bridge. + +STP uses the concept of cost to determine many things. Selecting a root port involves evaluating the root path cost. This value is the cumulative cost of all the links leading to the root bridge. A particular switch link also has a cost associated with it, called the path cost. To understand the difference between these values, remember that only the root path cost is carried inside the BPDU. (Refer to Table 6-2.) As the root path cost travels along, other switches can modify its value to make it cumulative. The path cost, however, is not contained in the BPDU. It is known only to the local switch where the port (or “path” to a neighboring switch) resides. + +Path costs are defined as a 1-byte value, with the default values shown in Table 6-3. Generally, the higher the bandwidth of a link, the lower the cost of transporting data across it. The original IEEE 802.1D standard defined path cost as 1000 Mbps divided by the link bandwidth in megabits per second. These values are shown in the center column of the table. Modern networks commonly use Gigabit and 10-Gigabit Ethernet, which are both either too close to or greater than the maximum scale of 1000 Mbps. The IEEE now +uses a nonlinear scale for path cost, as shown in the right column of the table. + + + +Tip Be aware that there are two STP path cost scales, one that is little used with a linear scale and one commonly used that is nonlinear. If you decide to memorize some common path cost values, learn only the ones in the New STP Cost column of the table. + + +Table 6-3 STP Path Cost + + +Link Bandwidth +4 Mbps + +10 Mbps + +16 Mbps + +45 Mbps + +100 Mbps + +155 Mbps + +622 Mbps + +1 Gbps + +10 Gbps + +Old STP Cost +250 + +100 + +63 + +22 + +10 + +6 + +2 + +1 + +0 + +New STP Cost +250 + +100 + +62 + +39 + +19 + +14 + +6 + +4 + +2 + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 159 + +The root path cost value is determined in the following manner: + +1. The root bridge sends out a BPDU with a root path cost value of 0 because its ports sit directly on the root bridge. + +2. When the next-closest neighbor receives the BPDU, it adds the path cost of its own port where the BPDU arrived. (This is done as the BPDU is received.) + +3. The neighbor sends out BPDUs with this new cumulative value as the root path cost. + +4. The root path cost is incremented by the ingress port path cost as the BPDU is received at each switch down the line. + +5. Notice the emphasis on incrementing the root path cost as BPDUs are received. When computing the spanning-tree algorithm manually, remember to compute a new root path cost as BPDUs come in to a switch port, not as they go out. + +After incrementing the root path cost, a switch also records the value in its memory. When a BPDU is received on another port and the new root path cost is lower than the previously recorded value, this lower value becomes the new root path cost. In addition, the lower cost tells the switch that the path to the root bridge must be better using this port than it was on other ports. The switch has now determined which of its ports has the best path to the root: the root port. + +Figure 6-4 shows the same network from Figure 6-3 in the process of root port selection. + +Root Bridge + +Switch A +32768: 0000.0000.000a + + + +gi1/0/1 gi1/0/2 + + +1 Gbps 1 Gbps Cost = 4 Cost = 4 + + + +Root Port + +Root Path Cost = 4 + + + +gi1/0/1 + +gi1/0/2 + + + +gi1/0/1 + +gi1/0/2 + +Root Port + +Root Path Cost = 4 + + + + +Switch B +32768: 0000.0000.000b + +1 Gbps +Cost = 4 Switch C 32768: 0000.0000.000c + + +Root Path Cost = 4 + 4 + +Figure 6-4 Example of Root Port Selection + + + + +From the Library of Outcast Outcast +160 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The root bridge, Switch A, already has been elected. Therefore, every other switch in the network must choose one port that has the best path to the root bridge. Switch B selects its port gi1/0/1, with a root path cost of 0 plus 19. Port gi1/0/2 is not chosen because its root path cost is 0 (BPDU from Switch A) plus 19 (path cost of A–C link), plus 19 (path cost of C–B link), or a total of 38. Switch C makes an identical choice of port gi1/0/1. + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + + + + +Key Topic + +Electing Designated Ports + +By now, you should begin to see the process unfolding: A starting or reference point has been identified, and each switch “connects” itself toward the reference point with the single link that has the best path. A tree structure is beginning to emerge, but links have only been identified at this point. All links still are connected and could be active, leaving bridging loops. + +To remove the possibility of bridging loops, STP makes a final computation to identify one designated port on each network segment. Suppose that two or more switches have ports connected to a single common network segment. If a frame appears on that seg-ment, all the bridges attempt to forward it to its destination. Recall that this behavior was the basis of a bridging loop and should be avoided. + +Instead, only one of the links on a segment should forward traffic to and from that seg-ment—the one that is selected as the designated port. Switches choose a designated port based on the lowest cumulative root path cost to the root bridge. For example, a switch always has an idea of its own root path cost, which it announces in its own BPDUs. If a neighboring switch on a shared LAN segment sends a BPDU announcing a lower root path cost, the neighbor must have the designated port. If a switch learns only of higher root path costs from other BPDUs received on a port, however, it then correctly assumes that its own receiving port is the designated port for the segment. + +Notice that the entire STP determination process has served only to identify bridges and ports. All ports are still active, and bridging loops still might lurk in the network. STP has a set of progressive states that each port must go through, regardless of the type or iden-tification. These states actively prevent loops from forming and are described in the next section. + +In each determination process discussed so far, two or more links might have identical root path costs. This results in a tie condition, unless other factors are considered. All tie- +breaking STP decisions are based on the following sequence of four conditions: + + +1. Lowest root bridge ID + +2. Lowest root path cost to root bridge + +3. Lowest sender bridge ID + +4. Lowest sender port ID + +Figure 6-5 demonstrates an example of designated port selection. This figure is identical to Figure 6-3 and Figure 6-4, with further spanning-tree development shown. The only changes are the choices of designated ports, although seeing all STP decisions shown on one network diagram is handy. + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 161 + + +Root Bridge + +Switch A +32768: 0000.0000.000a + + +Designated Port Designated Port + +gi1/0/1 gi1/0/2 + + +1 Gbps 1 Gbps Cost = 4 Cost = 4 + + + +Root Port + +Root Path Cost = 4 + + + +gi1/0/1 + +gi1/0/2 + + + +gi1/0/1 + +gi1/0/2 + +Root Port + +Root Path Cost = 4 + + + + +Switch B +32768: 0000.0000.000b + +1 Gbps Cost = 4 + +Designated Port + + +Switch C 32768: 0000.0000.000c + + +Both Root Path Cost = 8 Switch B has lowest Bridge ID + +Figure 6-5 Example of Designated Port Selection + +The three switches have chosen their designated ports (DPs) for the following reasons: + +■ Catalyst A: Because this switch is the root bridge, all its active ports are designated ports, by definition. At the root bridge, the root path cost of each port is 0. + +■ Catalyst B: Switch A port gi1/0/1 is the DP for the Segment A–B because it has the lowest root path cost (0). Switch B port gi1/0/2 is the DP for segment B–C. The root path cost for each end of this segment is 19, determined from the incoming BPDU on port gi1/0/1. Because the root path cost is equal on both ports of the segment, the DP must be chosen by the next criteria—the lowest sender bridge ID. When Switch B sends a BPDU to Switch C, it has the lowest MAC address in the bridge ID. Switch C also sends a BPDU to Switch B, but its sender bridge ID is higher. Therefore, Switch B port gi1/0/2 is selected as the segment’s DP. +■ Catalyst C: Switch A port gi1/0/2 is the DP for Segment A–C because it has the low-est root path cost (0). Switch B port gi1/0/2 is the DP for Segment B–C. Therefore, Switch C port gi1/0/2 will be neither a root port nor a designated port. As discussed in the next section, any port that is not elected to either position enters the Blocking state. Where blocking occurs, bridging loops are broken. + +As a final step, it is often helpful to see the resulting network topology after STP has made its decisions. Figure 6-6 shows the topology without all of the STP notation and clutter. Even though the three switches are physically connected in a closed loop, STP has + + + +From the Library of Outcast Outcast +162 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +detected that possibility and has blocked the link between Switches B and C, effectively preventing a loop from forming. Both B and C can still pass traffic through Switch A, so the network is still fully functional. + +Root Bridge + +Switch A + + + +gi1/0/1 gi1/0/2 + + + + + + + + +gi1/0/1 gi1/0/1 + + +Switch B Switch C + +Figure 6-6 The Resulting STP Topology + +Think about how this topology might apply to a real network, where Switch A is in the distribution layer and Switches B and C are in the access layer. The root bridge is located higher in the network hierarchy, feeding lower-level switches with active links. The loop will be broken farthest away from the root, where traffic might have traveled between switches inefficiently. + + + + + +Key Topic + +STP States + +To participate in STP, each port of a switch must progress through several states. A port begins its life in a Disabled state, moving through several passive states and, finally, into +an active state if allowed to forward traffic. The STP port states are as follows: + + +■ Disabled: Ports that are administratively shut down by the network administrator, or by the system because of a fault condition, are in the Disabled state. This state is special and is not part of the normal STP progression for a port. +■ Blocking: After a port initializes, it begins in the Blocking state so that no bridging loops can form. In the Blocking state, a port cannot receive or transmit data and can-not add MAC addresses to its address table. Instead, a port is allowed to receive only BPDUs so that the switch can hear from other neighboring switches. In addition, ports that are put into standby mode to remove a bridging loop enter the Blocking state. + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 163 + +■ Listening: A port is moved from Blocking to Listening if the switch thinks that the port can be selected as a root port or designated port. In other words, the port is on its way to begin forwarding traffic. + +In the Listening state, the port still cannot send or receive data frames. However, the port is allowed to receive and send BPDUs so that it can actively participate in the Spanning Tree topology process. Here, the port finally is allowed to become a root port or designated port because the switch can advertise the port by sending BPDUs to other switches. If the port loses its root port or designated port status, it returns to the Blocking state. +■ Learning: After a period of time called the forward delay in the Listening state, the port is allowed to move into the Learning state. The port still sends and receives BPDUs as before. In addition, the switch now can learn new MAC addresses to add to its address table. This gives the port an extra period of silent participation and +allows the switch to assemble at least some address information. The port cannot yet send any data frames, however. +■ Forwarding: After another forward delay period of time in the Learning state, the port is allowed to move into the Forwarding state. The port now can send and +receive data frames, collect MAC addresses in its address table, and send and receive BPDUs. The port is now a fully functioning switch port within the spanning-tree topology. + +Remember that a switch port is allowed into the Forwarding state only if no redundant links (or loops) are detected and if the port has the best path to the root bridge as the root port or designated port. + +Table 6-4 summarizes the STP port states and what can and cannot be done in those states. + +Table 6-4 STP States and Port Activity + + +STP State +Disabled + +Blocking + +Listening + +The Port Can... +N/A + +Receive BPDUs + +Send and receive BPDUs + +The Port Cannot... +Send or receive data + +Send or receive data or learn MAC addresses +Send or receive data or learn MAC addresses + +Duration +N/A + +Indefinite if loop has been detected +Forward Delay timer (15 seconds) + + + +Learning + +Forwarding + +Send and receive BPDUs Send or receive data and learn MAC addresses +Send and receive BPDUs, learn MAC addresses, and send and receive data + +Forward Delay timer (15 seconds) +Indefinite as long as port is up and loop is not detected + + + + + + + +From the Library of Outcast Outcast +164 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 6-1 shows the output from a switch as one of its ports progresses through the STP port states. + +Example 6-1 Switch Port Progressing Through the STP Port States + +Switch(config)# interface gigabitethernet1/0/1 +Switch(config-if)# no shutdown +Switch(config-if)# ^Z +Switch# +Mar 30 08:12:11.199: STP SW: Gi1/0/1 new blocking req for 1 vlans + +Mar 30 08:12:13.196: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/1, changed state to up +Mar 30 08:12:14.203: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther-net1/0/1, changed state to up + +Switch# show spanning interface gigabitethernet1/0/1 +Vlan Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- +VLAN0001 Desg LIS 4 128.1 P2p + +Mar 30 08:12:26.207: STP SW: Gi1/0/1 new learning req for 1 vlans + +Switch# show spanning interface gigabitethernet1/0/1 +Vlan Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- +VLAN0001 Desg LRN 4 128.1 P2p + +Mar 30 08:12:41.214: STP SW: Gi1/0/1 new forwarding req for 1 vlans + +Switch# show spanning interface gigabitethernet1/0/1 + +Vlan Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- -------------------------------- +VLAN0001 Desg FWD 4 128.1 P2p +Switch# + +The example begins as the port is administratively disabled from the command line. When the port is enabled, successive show spanning-tree interface type +member/module/number commands display the port state as Listening, Learning, and then Forwarding. These are shown in the shaded text of the example. Notice also the time stamps and port states provided by the debug spanning-tree switch state command, which give a sense of the timing between port states. Because this port was eligible as a root port, the show command never could execute fast enough to show the port in the Blocking state. + +You can manually work out a spanning-tree topology using a network diagram. Follow the basic steps listed in Table 6-5 to add information to the network diagram. By the time + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 165 + +you reach step 5, your STP will have converged, just like the switches in a live network would do. + + +Table 6-5 + +Task + + +Manual STP Computation + +Description + + + +1. Identify path costs on links. + +2. Identify the root bridge. + +3. Select root ports (1 per switch). + + +4. Select designated ports (1 per segment). + + +5. Identify the blocking ports. + +For each link between switches, write the path cost that each switch uses for the link. +Find the switch with the lowest bridge ID; mark it on the drawing. +For each switch, find the one port that has the best path to the root bridge. This is the one with the lowest root path cost. Mark the port with an RP label. +For each link between switches, identify which end of the link will be the designated port. This is the one with the lowest root path cost; if equal on both ends, use STP tie-breakers. Mark the port with a DP label. +Every switch port that is neither a root nor a designated port will be put into the Blocking state. Mark these with an X. + + + + +STP Timers + + + + + + + + + + +Key Topic + +STP operates as switches send BPDUs to each other in an effort to form a loop-free topology. The BPDUs take a finite amount of time to travel from switch to switch. In addition, news of a topology change (such as a link or root bridge failure) can suffer from propagation delays as the announcement travels from one side of a network to the other. Because of the possibility of these delays, keeping the spanning-tree topology from set-tling out or converging until all switches have had time to receive accurate information is important. + +STP uses three timers to make sure that a network converges properly before a bridging +loop can form. The timers and their default values are as follows: + + +■ Hello timer: The time interval between Configuration BPDUs sent by the root bridge. The hello time value configured in the root bridge switch determines the hello time for all nonroot switches because they just relay the Configuration BPDUs as they are received from the root. However, all switches have a locally configured hello time that is used to time TCN BPDUs when they are retransmitted. The IEEE 802.1D standard specifies a default hello time value of 2 seconds. +■ Forward Delay timer: The time interval that a switch port spends in both the Listening and Learning states. The default value is 15 seconds. + + + + +From the Library of Outcast Outcast +166 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Max (Maximum) Age timer: The time interval that a switch stores a BPDU before discarding it. While executing the STP, each switch port keeps a copy of the “best” BPDU that it has heard. If the switch port loses contact with the BPDU’s source (no more BPDUs are received from it), the switch assumes that a topology change must have occurred after the max age time elapsed and so the BPDU is aged out. The default Max Age timer value is 20 seconds. + +The STP timers can be configured or adjusted from the switch command line. However, the timer values never should be changed from the defaults without careful consideration. Then the values should be changed only on the root bridge switch. Recall that the timer values are advertised in fields within the BPDU. The root bridge ensures that the timer values propagate to all other switches. + + +Tip The default STP timer values are based on some assumptions about the size of the network and the length of the hello time. A reference model of a network having a diam-eter of seven switches derives these values. The diameter is measured from the root bridge switch outward, including the root bridge. +In other words, if you draw the STP topology, the diameter is the number of switches con-nected in series from the root bridge out to the end of any branch in the tree. The hello time is based on the time it takes for a BPDU to travel from the root bridge to a point seven switches away. This computation uses a hello time of 2 seconds. + + +The network diameter can be configured on the root bridge switch to more accurately reflect the true size of the physical network. Making that value more accurate reduces the total STP convergence time during a topology change. Cisco also recommends that if changes need to be made, only the network diameter value should be modified on the +root bridge switch. When the diameter is changed, the switch calculates new values for all three timers automatically. + +Table 6-6 summarizes the STP timers, their functions, and their default values. + + +Table 6-6 STP Timers + + +Timer +Hello + +Forward delay +Max age + +Function +Interval between configuration BPDUs. + +Time spent in Listening and Learning states before transitioning toward Forwarding state. +Maximum length of time a BPDU can be stored without receiving an update. Timer expiration signals an indirect failure with designated or root bridge. + +Default Value +2 seconds + +15 seconds + +20 seconds + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 167 + +Topology Changes + +To announce a change in the active network topology, switches send a TCN BPDU. Table 6-7 shows the format of these messages. + +Table 6-7 Topology Change Notification BPDU Message Content + + +Field Description +Protocol ID (always 0) + +Version (always 0) + +Number of Bytes +2 + +1 + + +Message Type (Configuration or TCN BPDU) 1 + + + + +Key Topic + +A topology change occurs when a switch either moves a port into the Forwarding state or moves a port from the Forwarding or Learning states into the Blocking state. In other words, a port on an active switch comes up or goes down. The switch sends a TCN BPDU out its root port so that, ultimately, the root bridge receives news of the topol-ogy change. Notice that the TCN BPDU carries no data about the change but informs recipients only that a change has occurred. Also notice that the switch will not send TCN BPDUs if the port has been configured with PortFast enabled. + +The switch continues sending TCN BPDUs every hello time interval until it gets an acknowledgment from its upstream neighbor. As the upstream neighbors receive the TCN BPDU, they propagate it on toward the root bridge and send their own acknowledgments. When the root bridge receives the TCN BPDU, it also sends out an acknowledgment. However, the root bridge sets the Topology Change flag in its Configuration BPDU, which is relayed to every other bridge in the network. This is done to signal the topol-ogy change and cause all other bridges to shorten their bridge table aging times from the default (300 seconds) to the forward delay value (default 15 seconds). + +This condition causes the learned locations of MAC addresses to be flushed out much sooner than they normally would, easing the bridge table corruption that might occur because of the change in topology. However, any stations that are actively communicat-ing during this time are kept in the bridge table. This condition lasts for the sum of the forward delay and the max age (default 15 + 20 seconds). + +The theory behind topology changes is fairly straightforward, but it is often difficult to grasp how a working network behaves during a change. For example, suppose that you have a Layer 2 network (think of a single VLAN or a single instance of STP) that is stable and loop free. If a switch uplink suddenly failed or a new uplink was added, how would the various switches in the network react? Would users all over the network lose connec-tivity while the STP “recomputes” or reconverges? + +Examples of different types of topology changes are presented in the following sections, along with the sequence of STP events. Each type has a different cause and a different effect. To provide continuity as the STP concepts are presented, the same network previ- +ously shown in Figures 6-3 through 6-5 is used in each of these examples. + + + + +From the Library of Outcast Outcast +168 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Direct Topology Changes + +A direct topology change is one that can be detected on a switch interface. For example, if a trunk link suddenly goes down, the switch on each end of the link can immediately detect a link failure. The absence of that link changes the bridging topology, so other switches should be notified. + +Figure 6-7 shows a network that has converged into a stable STP topology. The VLAN is forwarding on all trunk links except port gi1/0/2 on Switch C, where it is in the Blocking state. + +This network has just suffered a link failure between Switch A and Switch C. The sequence of events unfolds as follows: +1. Switch C detects a link down on its port gi1/0/1; Switch A detects a link down on its port gi1/0/2. + +2. Switch C removes the previous “best” BPDU it had received from the root over port gi1/0/1. Port gi1/0/1 is now down so that BPDU is no longer valid. + +Normally, Switch C would try to send a TCN message out its root port, to reach the root bridge. Here, the root port is broken, so that is not possible. Without an +advanced feature such as STP UplinkFast, Switch C is not yet aware that another path exists to the root. + +Also, Switch A is aware of the link down condition on its own port gi1/0/2. It nor-mally would try to send a TCN message out its root port to reach the root bridge. Here, Switch A is the root, so that is not really necessary. +3. The root bridge, Switch A, sends a Configuration BPDU with the TCN bit set out its port gi1/0/1. This is received and relayed by each switch along the way, informing each one of the topology change. +4. Switches B and C receive the TCN message. The only reaction these switches take is to shorten their bridging table aging times to the forward delay time. At this point, they do not know how the topology has changed; they only know to force fairly recent bridging table entries to age out. +5. Switch C basically just sits and waits to hear from the root bridge again. The Configuration BPDU TCN message is received on port gi1/0/2, which was previously in the Blocking state. This BPDU becomes the “best” one received from the root, so port gi1/0/2 becomes the new root port. + +Switch C now can progress port gi1/0/2 from Blocking through the Listening, Learning, and Forwarding states. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 169 + + +Root Bridge + +Switch A + + + + + +3 +Root Sends Config BPDU; TCN + + + +gi1/0/1 gi1/0/2 + + +1 + +2 +Switch A Needs to Send TCN Toward Root But It Is the Root! + + +2 + +Link Failure Switch C Needs to Send TCN Toward Root But Can’t! + + + +Root Port Designated Port gi1/0/1 +gi1/0/2 + +Root Port gi1/0/1 +gi1/0/2 + + + + +Switch B + +4 +Switches B and C Receive TCN and Shorten Their Bridge Table Aging Times + +Switch C + +5 +New Superior BPDU Received from Root; +Port gi1/0/2 Becomes New Root Port + + + +Figure 6-7 Effects of a Direct Topology Change + +As a result of a direct link failure, the topology has changed and STP has converged again. Notice that only Switch C has undergone any real effects from the failure. Switches A and B heard the news of the topology change but did not have to move any links through the STP states. In other words, the whole network did not go through a massive STP reconvergence. + +The total time that users on Switch C lost connectivity was roughly the time that port gi1/0/2 spent in the Listening and Learning states. With the default STP timers, this amounts to about two times the forward delay period (15 seconds), or 30 seconds total. + +Indirect Topology Changes + +Figure 6-8 shows the same network as Figure 6-7, but this time the link failure indi-rectly involves Switches A and C. The link status at each switch stays up, but something between them has failed or is filtering traffic. This could be another device, such as a +service provider’s switch, a firewall, and so on. As a result, no data (including BPDUs) can pass between those switches. + + + + + + + +From the Library of Outcast Outcast +170 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Root Bridge + +Switch A + +1 +Data Is Filtered gi1/0/1 gi1/0/2 + + + +2 +No TCNs Are Sent + + +Root Port Designated Port gi1/0/1 +gi1/0/2 + +Root Port gi1/0/1 +gi1/0/2 + + + + +Switch B + +4 +New BPDU Heard from Root; Port gi1/0/2 Becomes Root Port and Is Unblocked + +Switch C + +3 +Root BPDU Is Flushed After MaxAge Timer Expires + + + +Figure 6-8 Effects of an Indirect Topology Change + +STP can detect and recover from indirect failures, thanks to timer mechanisms. The sequence of events unfolds as follows: +1. Switches A and C both show a link up condition; data begins to be filtered elsewhere on the link. + +2. No link failure is detected, so no TCN messages are sent. + +3. Switch C already has stored the “best” BPDU it had received from the root over port gi1/0/1. No further BPDUs are received from the root over that port. After the Max Age timer expires, no other BPDU is available to refresh the “best” entry, so it is flushed. Switch C now must wait to hear from the Root again on any of its ports. +4. The next Configuration BPDU from the root is heard on Switch C port gi1/0/2. This BPDU becomes the new “best” entry, and port gi1/0/2 becomes the root port. Now the port is progressed from Blocking through the Listening, Learning, and finally Forwarding states. + +As a result of the indirect link failure, the topology does not change immediately. The absence of BPDUs from the root causes Switch C to take some action. Because this type of failure relies on STP timer activity, it generally takes longer to detect and mitigate. + +In this example, the total time that users on Switch C lost connectivity was roughly the time until the max age timer expired (20 seconds), plus the time until the next + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 171 + +Configuration BPDU was received (2 seconds) on port gi1/0/2, plus the time that port gi1/0/2 spent in the Listening (15 seconds) and Learning (15 seconds) states. In other words, 52 seconds elapse if the default timer values are used. + +Insignificant Topology Changes + +Figure 6-9 shows the same network topology as Figure 6-7 and Figure 6-8, with the addi-tion of a user PC on access layer switch Switch C. The user’s switch port, gi1/0/33/, is just another link as far as the switch is concerned. If the link status goes up or down, the switch must view that as a topology change and inform the root bridge. + +Root Bridge + +Switch A + + + + +gi1/0/1 gi1/0/2 +3 + +3 +Root Sends BPDU with TCN Set + + +2 +Switch C Starts Sending TCNs Toward Root + + +Root Port Designated Port Root Port + + + +Switch B + +4 + +gi1/0/1 + +gi1/0/2 + +gi1/0/1 + +gi1/0/2 + + +1 gi1/0/33 + + + +Switch C + +4 + + + +Switch B Receives TCN; Bridge Table Aging Time Is Shortened + +PC Is Turned Off; Link Goes Down + +Switch B Receives TCN; Bridge Table Aging Time Is Shortened + + + + + +Figure 6-9 Effects of an Insignificant Topology Change + +Obviously, user ports are expected to go up and down as the users reboot their machines, turn them on and off as they go to and from work, and so on. Regardless, TCN messages are sent by the switch, just as if a trunk link between switches had changed state. + +To see what effect this has on the STP topology and the network, consider the following sequence of events: +1. The PC on switch port gi1/0/33 is turned off. The switch detects the link status going down. + + + + +From the Library of Outcast Outcast +172 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. Switch C begins sending TCN BPDUs toward the root, over its root port (gi1/0/1). + +3. The root sends a TCN acknowledgment back to Switch C and then sends a Configuration BPDU with the TCN bit set to all downstream switches. This is done to inform every switch of a topology change somewhere in the network. +4. The TCN flag is received from the root, and both Switches B and C shorten their bridge table aging times. This causes recently idle entries to be flushed, leaving only the actively transmitting stations in the table. The aging time stays short for the dura-tion of the Forward Delay and Max Age timers. + +Notice that this type of topology change is mostly cosmetic. No actual topology change occurred because none of the switches had to change port states to reach the root bridge. Instead, powering off the PC caused all the switches to age out entries from their bridge or CAM tables much sooner than normal. + +At first, this does not seem like a major problem because the PC link state affects only the “newness” of the CAM table contents. If CAM table entries are flushed as a result, they probably will be learned again. This becomes a problem when every user PC is con-sidered. Now every time any PC in the network powers up or down, every switch in the network must age out CAM table entries. + +Given enough PCs, the switches could be in a constant state of flushing bridge tables. Also remember that when a switch does not have a CAM entry for a destination, the packet must be flooded out all its ports. Flushed tables mean more unknown unicasts, which mean more broadcasts or flooded packets throughout the network. + +Fortunately, Catalyst switches have a feature that can designate a port as a special case. You can enable the STP PortFast feature on a port with a single attached PC. As a result, TCNs are not sent when the port changes state, and the port is brought right into the Forwarding state when the link comes up. The section “Redundant Link Convergence,” in Chapter 7, covers PortFast in more detail. + +Types of STP + +So far, this chapter has discussed STP in terms of its operation to prevent loops and to recover from topology changes in a timely manner. STP was originally developed to operate in a bridged environment, basically supporting a single LAN (or one VLAN). Implementing STP into a switched environment has required additional consideration +and modification to support multiple VLANs. Because of this, the IEEE and Cisco have approached STP differently. This section reviews the three traditional types of STP that are encountered in switched networks and how they relate to one another. No specific configuration commands are associated with the various types of STP here. Instead, you need a basic understanding of how they interoperate in a network. + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 173 + + +Note The IEEE 802.1D standard also includes spanning-tree enhancements that greatly improve on its scalability and convergence aspects. These are covered in Chapter 9. When you have a firm understanding of the more traditional forms of STP presented in this chap-ter, you can grasp the enhanced versions much easier. + + + +Common Spanning Tree + + + +Key Topic + +The IEEE 802.1Q standard specifies how VLANs are to be trunked between switches. It also specifies only a single instance of STP that encompasses all VLANs. This instance is referred to as the Common Spanning Tree (CST). All CST BPDUs are transmitted over trunk links using the native VLAN with untagged frames. + +Having a single STP for many VLANs simplifies switch configuration and reduces switch CPU load during STP calculations. However, having only one STP instance can cause limitations, too. Redundant links between switches will be blocked with no capability for load balancing. Conditions also can occur that would cause CST to mistakenly enable forwarding on a link that does not carry a specific VLAN, whereas other links would be +blocked. + + + +Per-VLAN Spanning Tree + +Cisco has a proprietary version of STP that offers more flexibility than the CST version. Per-VLAN Spanning Tree (PVST) operates a separate instance of STP for each individual VLAN. This allows the STP on each VLAN to be configured independently, offering bet-ter performance and tuning for specific conditions. Multiple spanning trees also make load balancing possible over redundant links when the links are assigned to different VLANs. One link might forward one set of VLANs, while another redundant link might forward a different set. + +Because of its proprietary nature, PVST requires the use of Cisco Inter-Switch Link (ISL) trunking encapsulation between switches. In networks where PVST and CST coexist, interoperability problems occur. Each requires a different trunking method, so BPDUs are never exchanged between STP types. + + +Per-VLAN Spanning Tree Plus + + + +Key Topic + +Cisco has a second proprietary version of STP that allows devices to interoperate with both PVST and CST. Per-VLAN Spanning Tree Plus (PVST+) effectively supports three +groups of STP operating in the same campus network: + + +■ Catalyst switches running PVST + +■ Catalyst switches running PVST+ + +■ Switches running CST over 802.1Q + +Table 6-8 summarizes the three STP types and their basic functions. + + +From the Library of Outcast Outcast +174 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Table 6-8 Types of STP + + +Type of STP +CST + +PVST + +PVST+ + +Function +1 instance of STP, over the native VLAN; 802.1Q based + +1 instance of STP per VLAN; Cisco ISL based + +Provides interoperability between CST and PVST; operates over both 802.1Q and ISL + + + +To do this, PVST+ acts as a translator between groups of CST switches and groups of PVST switches. PVST+ can communicate directly with PVST by using ISL trunks. To communicate with CST, however, PVST+ exchanges BPDUs with CST as untagged frames over the native VLAN. BPDUs from other instances of STP (other VLANs) are propa-gated across the CST portions of the network by tunneling. PVST+ sends these BPDUs by using a unique multicast address so that the CST switches forward them on to down-stream neighbors without interpreting them first. Eventually, the tunneled BPDUs reach other PVST+ switches where they are understood. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Traditional Spanning Tree Protocol 175 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 6-9 lists a reference of these key topics and the page numbers on which each is found. + +Table 6-9 Key Topics for Chapter 6 Key +Topic Key Topic Element Description Page Number + + +List + +List + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +List + +List + +List + +Paragraph + +Paragraph + +Paragraph + +Describes transparent bridge operation 151 + +Explains a bridging loop 153 + +Discusses BPDUs 155 + +Discusses root bridge election 156 + +Explains root port selection and root path cost 158 + +Discusses designated port selection 160 + +Explains tie-breaking decision process 160 + +Discusses the sequence of STP port states 162 + +Explains the three STP timers and their uses 165 + +Explains STP topology changes 167 + +Describes the Common Spanning Tree 173 + +Describes Per-VLAN Spanning Tree+ 173 + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +transparent bridge, bridging loop, Spanning Tree Protocol (STP), BPDU, root bridge, root port, root path cost, designated port, hello time, forward delay, max age time, TCN, Common Spanning Tree (CST), PVST, PVST+ + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ STP Root Bridge: This section discusses the importance of identifying a root bridge and sugges-tions for its placement in the network. This section also presents the root bridge configuration commands. +■ Spanning-Tree Customization: This section cov-ers the configuration commands that enable you to alter the spanning-tree topology. +■ Tuning Spanning-Tree Convergence: This sec-tion discusses how to alter, or tune, the STP timers to achieve optimum convergence times in a network. +■ Redundant Link Convergence: This section describes the methods that cause a network to con-verge more quickly after a topology change. +■ Monitoring STP: This section offers a brief sum-mary of the commands that you can use to verify that an STP instance is working properly. + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 7 + + + + + + +Spanning-Tree Configuration + + +This chapter presents the design and configuration considerations necessary to imple-ment the IEEE 802.1D Spanning Tree Protocol (STP) in a campus network. This chapter also discusses the commands needed to configure the STP features, previously described in Chapter 6, “Traditional Spanning Tree Protocol.” + +You can also tune STP or make it converge more efficiently in a given network. This chapter presents the theory and commands needed to accomplish this. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 7-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 7-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +STP Root Bridge + +Spanning-Tree Customization + +Tuning Spanning-Tree Convergence + +Redundant Link Convergence + +Monitoring STP + +Questions Covered in This Section +1-6 + +7-8 + +9-10 + +11-13 + +14 + + + +1. Which of these is the single most important design decision to be made in a network running STP? + +a. Removing any redundant links + +b. Making sure all switches run the same version of IEEE 802.1D + +c. Root bridge placement + +d. Making sure all switches have redundant links + + + +From the Library of Outcast Outcast +178 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. Where should the root bridge be placed on a network? + +a. On the fastest switch + +b. Closest to the most users + +c. Closest to the center of the network + +d. On the least-used switch + +3. Which of the following is a result of a poorly placed root bridge in a network? + +a. Bridging loops form. + +b. STP topology cannot be resolved. + +c. STP topology can take unexpected paths. + +d. Root bridge election flapping occurs. + +4. Which of these parameters should you change to make a switch become a root bridge? + +a. Switch MAC address + +b. Path cost + +c. Port priority + +d. Bridge priority + +5. What is the default base 802.1D STP bridge priority on a Catalyst switch? + +a. 0 + +b. 1 + +c. 32,768 + +d. 65,535 + +6. Which of the following commands is most likely to make a switch become the root bridge for VLAN 5, assuming that all switches have the default STP parameters? + +a. spanning-tree root + +b. spanning-tree root vlan 5 + +c. spanning-tree vlan 5 priority 100 + +d. spanning-tree vlan 5 root + +7. What is the default path cost of a Gigabit Ethernet switch port? + +a. 1 + +b. 2 + +c. 4 + +d. 19 + +e. 1000 + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 179 + +8. What command can change the path cost of interface Gigabit Ethernet 1/0/3 to a value of 8? + +a. spanning-tree path-cost 8 + +b. spanning-tree cost 8 + +c. spanning-tree port-cost 8 + +d. spanning-tree gig 1/0/3 cost 8 + +9. What happens if the root bridge switch and another switch are configured with dif-ferent STP Hello timer values? + +a. Nothing; each sends hellos at different times. + +b. A bridging loop could form because the two switches are out of sync. + +c. The switch with the lower Hello timer becomes the root bridge. + +d. The other switch changes its Hello timer to match the root bridge + +10. What network diameter value is the basis for the default STP timer calculations? + +a. 1 + +b. 3 + +c. 7 + +d. 9 + +e. 15 + +11. Where should the STP PortFast feature be used? + +a. An access layer switch port connected to a PC + +b. An access layer switch port connected to a hub + +c. A distribution layer switch port connected to an access layer switch + +d. A core layer switch port + +12. Where should the STP UplinkFast feature be enabled? + +a. An access layer switch. + +b. A distribution layer switch. + +c. A core layer switch. + +d. All these answers are correct. + + + + + + + + +From the Library of Outcast Outcast +180 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +13. If used, the STP BackboneFast feature should be enabled on which of these? + +a. All backbone or core layer switches + +b. All backbone and distribution layer switches + +c. All access layer switches + +d. All switches in the network + +14. Which one of the following commands enables you to verify the current root bridge in VLAN 10? + +a. show root vlan 10 + +b. show root-bridge vlan 10 + +c. show spanning-tree vlan 10 root + +d. show running-config + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 181 + +Foundation Topics + + +STP Root Bridge + +Spanning Tree Protocol (STP) and its computations are predictable; however, other fac-tors might subtly influence STP decisions, making the resulting tree structure neither expected nor ideal. + +As the network administrator, you can make adjustments to the spanning-tree operation to control its behavior. The location of the root bridge should be determined as part of the design process. You can use redundant links for load balancing in parallel, if config-ured correctly. You can also configure STP to converge quickly and predictably if a major topology change occurs. + + +Tip By default, STP is enabled for all active VLANs and on all ports of a switch. STP should remain enabled in a network to prevent bridging loops from forming. However, you might find that STP has been disabled in some way. +If an entire instance of STP has been disabled, you can reenable it with the following global configuration command: +Switch(config)# spanning-tree vlan vlan-id +If STP has been disabled for a specific VLAN on a specific port, you can reenable it with the following interface configuration command: +Switch (config-if)# spanning-tree vlan vlan-id + + + +Root Bridge Placement + + + + + + + + + + +Key Topic + +Although STP is wonderfully automatic with its default values and election processes, the resulting tree structure might perform quite differently than expected. The root bridge election is based on the idea that one switch is chosen as a common reference point, and all other switches choose ports that have the best-cost path to the root. The root bridge election is also based on the idea that the root bridge can become a central hub that interconnects other legs of the network. Therefore, the root bridge can be faced with heavy switching loads in its central location. + +If the root bridge election is left to its default state, several things can occur to result in a poor choice. For example, the slowest switch (or bridge) could be elected as the root bridge. If heavy traffic loads are expected to pass through the root bridge, the slowest switch is not the ideal candidate. Recall that the only criteria for root bridge election is +that the switch must have the lowest bridge ID (bridge priority and MAC address), which is not necessarily the best choice to ensure optimal performance. If the slowest switch has the same bridge priority as the others and has the lowest MAC address, the slowest +switch will be chosen as the root. + + + + +From the Library of Outcast Outcast +182 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +A second factor to consider relates to redundancy. If all switches are left at their default states, only one root bridge is elected, with no clear choice for a backup. What happens if that switch fails? Another root bridge election occurs, but again, the choice might not be the ideal switch or the ideal location. + +The final consideration is the location of the root bridge switch. As before, an election with default switch values could place the root bridge in an unexpected location in the network. More important, an inefficient spanning-tree structure could result, causing traffic from a large portion of the network to take a long and winding path just to pass through the root bridge. + +Figure 7-1 shows a portion of a hierarchical campus network that is staged for just such an inefficient topology. A single VLAN extends end to end, from the core to the access layer. End-to-end VLANs are considered a bad practice, but will serve nicely for an STP scenario. + +Switch C1 32768: 0000.0000.eeee +Core Layer + + + + + + + +Distribution Layer + +10 Gbps Cost = 2 + +Switch D1 +32768: 0000.0000.cccc 10 Gbps Cost = 2 + +10 Gbps Cost = 2 +Switch D2 32768: 0000.0000.dddd + + + +10 Gbps 10 Gbps 10 Gbps Cost = 2 Cost = 2 Cost = 2 + + +Access Layer + + +Switch A1 32768: 0000.0000.aaaa + +Switch A2 32768: 0000.0000.bbbb + + +Figure 7-1 Campus Network with an Inefficient Root Bridge Election + +Catalyst switches A1 and A2 are two access layer devices; Catalysts D1 and D2 form the distribution layer, and Catalyst C1 makes up the network core. Notice that most of the switches use redundant links to other layers of the hierarchy. At the time of this example, however, Switch A2 still has only a single uplink. This switch is slated for an “upgrade,” in which a redundant link will be added to the other half of the distribution layer. + +As you will see, Catalyst A1 will become the root bridge because of its low MAC address. All switches have been left to their default STP states—the bridge priority of each is 32,768 (or 32,768 plus the VLAN ID, if the extended system ID is enabled). + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 183 + +Figure 7-2 shows the converged state of STP. For the purposes of this discussion, the root ports and designated ports are simply shown on the network diagram. As an exercise, work through the spanning-tree process yourself; begin with the information shown in Figure 7-1 and see whether you arrive at the results shown in Figure 7-2. The more exam-ples you can work out by hand, the better you will understand the entire spanning-tree process. + +Switch C1 32768: 0000.0000.eeee +Core Layer +RP + + + + + +Distribution Layer + +DP + +Switch D1 +32768: 0000.0000.cccc DP + +DP + +Switch D2 +32768: 0000.0000.dddd + + +RP RP DP + + + +DP + +Switch A1 Access 32768: 0000.0000.aaaa +Layer + +RP + +Switch A2 +DP 32768: 0000.0000.bbbb + + + +Root Bridge + +Figure 7-2 Campus Network with STP Converged + +Notice that Switch A1, one of the access layer switches, has been elected the root bridge. Note the location of the X symbols over the ports that are neither root ports nor des-ignated ports. These ports will enter the Blocking state, and no data packets will pass through them. + +Finally, Figure 7-3 shows the same network with the blocking links and other clutter removed. Now you can see the true structure of the final spanning tree. + +Switch A1, an access layer switch, is the root bridge. Workstations connected to Switch A1 can reach resources elsewhere on the network by crossing through the distribution (Switch D1) and core layer (Switch C1), as expected. However, notice what has happened to the other access layer switch, Switch A2. Data frames from workstations on this switch must cross into the distribution layer (Switch D2), back into the access layer (Switch A1), back through the distribution (Switch D1), and finally into the core (Switch C1). + + + + + + +From the Library of Outcast Outcast +184 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Switch C1 +Core Layer + + + + + + +Distribution Layer + + + + + + +Access Layer + + +Switch D1 + + + + + + + + +Switch A1 + + +Switch D2 + + + + + + + + +Switch A2 + + +Root Bridge + +Figure 7-3 Final Spanning-Tree Structure for the Campus Network + +This action is obviously inefficient. Data frames from users connected to Switch A2 are forced to thread through the winding path that will likely become a major bottleneck. + + +Root Bridge Configuration + +To prevent the surprises outlined in the previous section, you should always do two things: +Key +Topic ■ Configure one switch as a root bridge in a determined fashion. + +■ Configure another switch as a secondary root bridge, in case of a primary root bridge failure. + +As the common reference point, the root bridge (and the secondary) should be placed near the center of the Layer 2 network. For example, a switch in the distribution layer would make a better root bridge choice than one in the access layer because more traffic is expected to pass through the distribution layer devices. + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 185 + + +Tip A Catalyst switch can be configured to use one of the following formats for its STP bridge ID: +■ Traditional 802.1D bridge priority value (16 bits), followed by the unique switch MAC address for the VLAN +■ The 802.1t extended system ID (4-bit priority multiplier, plus a 12-bit VLAN ID), fol-lowed by a nonunique switch MAC address for the VLAN + +If the switch cannot support 1024 unique MAC addresses for its own use, the extended sys-tem ID is always enabled by default. Otherwise, the traditional method is enabled by default. +To begin using the extended system ID method, you can use the following global configu-ration command: +Switch(config)# spanning-tree extend system-id + + +Otherwise, you can use the traditional method by beginning the command with the no keyword. +You can configure a Catalyst switch to become the root bridge using one of two methods, which are configured as follows: + + +■ Key +Topic + +Manually setting the bridge priority value so that a switch is given a lower-than-default bridge ID value to win a root bridge election. You must know the bridge priorities of every other switch in a VLAN so that you can choose a value that is less than all the others. The command to accomplish this is as follows: +Switch(config)# spanning-tree vlan vlan-list priority bridge-priority + + +The bridge-priority value defaults to 32,768, but you can also assign a value of 0 to 65,535. If STP extended system ID is enabled, the default bridge-priority is 32,768 plus the VLAN number. In that case, the value can range from 0 to 61,440, but only as multiples of 4096. A lower bridge priority is preferable. + +Remember that Catalyst switches run one instance of STP for each VLAN (PVST+), so the VLAN ID must always be given. You should designate an appropriate root bridge for each VLAN. For example, you could use the following command to set the bridge priority for VLAN 5 and VLANs 100 through 200 to 4096: +Switch(config)# spanning-tree vlan 5,100-200 priority 4096 + +If you are not sure that your priority value will be accepted, enter it anyway. The switch will respond with a list of accepted values that are multiples of 4096: +Switch(config)#spanning vlan 5,100-200 priority 4000 +% Bridge Priority must be in increments of 4096. +% Allowed values are: +0 4096 8192 12288 16384 20480 24576 28672 +32768 36864 40960 45056 49152 53248 57344 61440 +Switch(config)# + + + + + +From the Library of Outcast Outcast +186 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +■ Key +Topic + +Causing the would-be root bridge switch to choose its own priority, based on some assumptions about other switches in the network. You can accomplish this with the following command: +Switch(config)# spanning-tree vlan vlan-id root {primary | +secondary} [ diameter diameter] + + +This command is actually a macro on the switch that executes several other commands. The result is a more direct and automatic way to force one switch to become the root bridge. Notice that the actual bridge priorities are not given in the command. Instead, the switch modifies its STP values according to the current values in use within the active network. These values are modified only once, when the macro command is issued. Use the primary keyword to make the switch attempt to become the primary root bridge. This command modifies the switch’s bridge priority value to become less than +the bridge priority of the current root bridge. If the current root priority is more than 24,576, the local switch sets its priority to 24,576. If the current root priority is less than that, the local switch sets its priority to 4096 less than the current root. + +For the secondary root bridge, the root priority is set to an artificially low value of 28,672. There is no way to query or listen to the network to find another potential sec-ondary root simply because there are no advertisements or elections of secondary root bridges. Instead, the fixed secondary priority is used under the assumption that it will be less than the default priorities (32,768) that might be used on switches elsewhere. + +You can also modify the network diameter by adding the diameter keyword to this com-mand. This modification is discussed further in the “Tuning Spanning-Tree Convergence” section, later in the chapter. + +As a final example, consider a switch that is currently using its default bridge priority for VLAN 100. In the extended system-id mode, the default priority is 32,768 plus 100 (the VLAN number). The output in Example 7-1 demonstrates this under the bridge ID infor-mation. The default priority is greater than the current root bridge priority of 4200, so the local switch cannot become the root. + +Example 7-1 Displaying the STP Bridge Priority Values + +Switch# show spanning-tree vlan 100 +VLAN0100 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +4196 +000b.5f65.1f80 +4 +1 (GigabitEthernet1/0/1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32868 (priority 32768 sys-id-ext 100) +Address 000c.8554.9a80 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 +[output omitted] + + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 187 + +As an alternative, the automatic method is used to attempt to make the switch become root for VLAN 100, using the command demonstrated in Example 7-2. + +Example 7-2 Using a Macro Command to Configure a Root Bridge + +Switch(config)# spanning-tree vlan 100 root primary +% Failed to make the bridge root for vlan 100 +% It may be possible to make the bridge root by setting the priority +% for some (or all) of these instances to zero. +Switch(config)# + +Why did this method fail? The current root bridge has a bridge priority of 4196. Because that priority is less than 24,576, the local switch will try to set its priority to 4096 less than the current root. Although the resulting priority would be 100, the local switch is using an extended system ID, which requires bridge priority values that are multiples +of 4096. The only value that would work is 0, but the automatic method will not use it. Instead, the only other option is to manually configure the bridge priority to 0 with the following command: +Switch(config)# spanning-tree vlan 100 priority 0 + +Remember that on switches that use an extended system ID, the bridge priority is the configured priority (multiple of 4096) plus the VLAN number. Even though the priority was set to 0 with the previous command, the switch is actually using a value of 100—pri-ority 0 plus VLAN number 100, as the output in Example 7-3 reveals. + +Example 7-3 Displaying Bridge Priorities with Extended System IDs + +Switch# show spanning-tree vlan 100 +VLAN0100 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +100 +000c.8554.9a80 + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 100 (priority 0 sys-id-ext 100) +Address 000c.8554.9a80 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 +[output omitted] + + + + + + + + + + +From the Library of Outcast Outcast +188 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Note The spanning-tree vlan vlan-id root command will not be shown in a Catalyst switch configuration because the command is actually a macro executing other switch commands. The actual commands and values produced by the macro will be shown, how-ever. For example, the macro can potentially adjust the four STP values, as follows: +Switch(config)# spanning-tree vlan 1 root primary +vlan 1 bridge priority set to 24576 +vlan 1 bridge max aging time unchanged at 20 +vlan 1 bridge hello time unchanged at 2 +vlan 1 bridge forward delay unchanged at 15 +Be aware that this macro does not guarantee that the switch will become the root and maintain that status. After the macro is used, it is entirely possible for another switch in the network to have its bridge priority configured to a lower value. The other switch would become the new root, displacing the switch that ran the macro. +On the root, it is usually good practice to directly modify the bridge priority to an artifi-cially low value (even priority 1 or 0) with the spanning-tree vlan vlan-id priority bridge-priority command. This makes it more difficult for another switch in the network to win the root bridge election, unless it is manually configured with a priority that is even lower. + + +Spanning-Tree Customization +The most important decision you can make when designing your spanning-tree topol-ogy is the placement of the root bridge. Other decisions, such as the exact loop-free path structure, will occur automatically as a result of the spanning-tree algorithm (STA). Occasionally, the path might need additional tuning, but only under special circumstanc-es and after careful consideration. + +Recall the sequence of four criteria that STP uses to choose a path: + +1. Lowest bridge ID + +2. Lowest root path cost + +3. Lowest sender bridge ID + +4. Lowest sender port ID + +The previous section discussed how to tune a switch’s bridge ID to force it to become the root bridge in a network. You can also change the bridge priority on a switch to influence the value it uses in the sender bridge ID that it announced as it relays bridge protocol data units (BPDUs) to other neighboring switches. + +Only the automatic STP computation has been discussed, using the default switch port costs to make specific path decisions. The following sections discuss ways you can influ-ence the exact topology that results. + +Tuning the Root Path Cost + +The root path cost for each active port of a switch is determined by the cumulative cost as a BPDU travels along. As a switch receives a BPDU, the port cost of the receiving + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 189 + +port is added to the root path cost in the BPDU. The port or port path cost is inversely proportional to the port’s bandwidth. If desired, a port’s cost can be modified from the default value. + + +Note Before modifying a switch port’s path cost, you should always calculate the root path costs of other alternative paths through the network. Changing one port’s cost might influence STP to choose that port as a root port, but other paths still could be preferred. You also should calculate a port’s existing path cost to determine what the new cost value should be. Careful calculation will ensure that the desired path indeed will be chosen. + + +Use the following interface configuration command to set a switch port’s path cost: +Key +Topic Switch (config-if)# spanning-tree [vlan vlan-id] cost cost + +If the vlan parameter is given, the port cost is modified only for the specified VLAN. Otherwise, the cost is modified for the port as a whole (all active VLANs). The cost value can range from 1 to 200,000,000. There are standard or default values that correspond to port bandwidth, as shown in Table 7-2. + +Table 7-2 STP Port Cost + + +Link Bandwidth +4 Mbps + +10 Mbps + +16 Mbps + +45 Mbps + +100 Mbps + +155 Mbps + +622 Mbps + +1 Gbps + +10 Gbps + +STP Cost +250 + +100 + +62 + +39 + +19 + +14 + +6 + +4 + +2 + + + +For example, a Gigabit Ethernet interface has a default port cost of 4. You can use the following command to change the cost to 2, but only for VLAN 10: +Switch(config-if)# spanning-tree vlan 10 cost 2 + +You can see the port cost of an interface by using the following command: + +Switch# show spanning-tree interface type member/module/number [cost] + +As an example, Gigabit Ethernet 1/0/1 is configured as a trunk port, carrying VLANs 1, 10, and 20. Example 7-4 shows the port cost for each of the VLANs. + + +From the Library of Outcast Outcast +190 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 7-4 Displaying STP Port Cost Values on an Interface + +Switch# show spanning-tree interface gigabitEthernet1/0/1 +Vlan Role Sts Cost Prio.Nbr Type +----------------- ---- --- ---------- -------- ----------------------------- + +VLAN0001 +VLAN0010 +VLAN0020 + +Root FWD 4 +Desg FWD 2 +Root FWD 4 + +128.1 P2p +128.1 P2p +128.1 P2p + + + +Tuning the Port ID + +The fourth criteria of an STP decision is the port ID. The port ID value that a switch uses is actually a 16-bit quantity: 8 bits for the port priority, and 8 bits for the port number. The port priority is a value from 0 to 255 and defaults to 128 for all ports. The port num-ber can range from 0 to 255 and represents the port’s actual physical mapping. Port num-bers generally begin with 1 at port 1/0/1 and increment across each module, then across each stack member or slot. However, the numbers might not be completely intuitive or consecutive because each member or module is assigned a particular range of numbers. In addition, ports that are bundled into an EtherChannel or port channel interface always have a higher port ID than they would if they were not bundled. + + +Tip Port numbers are usually intuitive on a single fixed configuration switch. For exam-ple, the STP port number can simply be the interface number, from 1 to 48.However, it +is not easy to find the STP port number in a switch with many modules and many ports. Notice how Gigabit Ethernet 1/0/1 is known as port number 1 (shown as Prio.Nbr 128.1), whereas 2/0/44 is known as port number 102 in the following example: +Switch# show spanning-tree interface gi1/0/1 +Vlan Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- ---------------- +VLAN0100 Desg FWD 4 128.1 P2p Edge +Switch# show spanning-tree interface gi2/0/44 +Vlan Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- ---------------- +VLAN0100 Desg FWD 4 128.102 P2p Edge +Switch# + + +Obviously, a switch port’s port number is fixed because it is based only on its hardware location or index. The port ID, however, can be modified to influence an STP decision by using the port priority. You can configure the port priority with this interface-configura-tion command: +Switch(config-if)# spanning-tree [vlan vlan-list] port-priority port-priority + +You can modify the port priority for one or more VLANs by using the vlan parameter. The VLAN numbers are given as vlan-list, a list of single values or ranges of values sepa-rated by commas. Otherwise, the port priority is set for the port as a whole (all active + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 191 + +VLANs). The value of port-priority can range from 0 to 255 and defaults to 128. A lower port priority value indicates a more preferred path toward the root bridge. + +As an example, you can use the following command sequence to change the port priority of Gigabit Ethernet 2/0/44 from 128 (the default) to 64 for VLANs 10 and 100: + +Switch(config)# interface gigabitethernet 2/0/44 +Switch(config-if)# spanning-tree vlan 10,100 port-priority 64 + +You can confirm the changes with the show spanning-tree interface command, as dem-onstrated in Example 7-5. + +Example 7-5 Confirming STP Port Priority Values After Configuration + +Switch# show spanning-tree interface gigabitEthernet 2/0/44 +Vlan Role Sts Cost Prio.Nbr Type +----------------- ---- --- --------- -------- ----------------------------- + +VLAN0010 +VLAN0100 +VLAN0200 +Switch# + +Desg FWD 4 +Desg FWD 4 +Desg FWD 4 + +64 .102 +64 .102 +128.102 + +Edge P2p +Edge P2p +Edge P2p + + + +Tuning Spanning-Tree Convergence + +STP uses several timers, a sequence of states that ports must move through, and specific topology change conditions to prevent bridging loops from forming in a complex net-work. Each of these parameters or requirements is based on certain default values for a typical network size and function. For the majority of cases, the default STP operation is sufficient to keep the network loop free and enable users to communicate. + +However, in certain situations, the default STP can cause network access to be delayed while timers expire and while preventing loops on links where loops are not possible. For example, when a single PC is connected to a switch port, a bridging loop is simply not possible. Another situation relates to the size of a Layer 2 switched network: The default STP timers are based on a benchmark network size. + +In a network that is smaller, waiting until the default timer values expire might not make sense when they could be safely set to shorter values. In situations like this, you can safely make adjustments to the STP convergence process for more efficiency. + + +Modifying STP Timers + + + +Key Topic + +Recall that STP uses three timers to keep track of various port operation states and communication between bridges. The three STP timers can be adjusted by using the commands documented in the sections that follow. Remember that the timers need to be modified only on the root bridge because the root bridge propagates all three timer +values throughout the network as fields in the configuration BPDU. + + + + + +From the Library of Outcast Outcast +192 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Manually Configuring STP Timers + +Use one or more of the following global configuration commands to modify STP timers: + +Switch(config)# spanning-tree [vlan vlan-id] hello-time seconds +Switch(config)# spanning-tree [vlan vlan-id] forward-time seconds +Switch(config)# spanning-tree [vlan vlan-id] max-age seconds + +Notice that the timers can be changed for a single instance (VLAN) of STP on the switch by using the vlan vlan-id parameters. If you omit the vlan keyword, the timer values are configured for all instances (all VLANs) of STP on the switch. + +The Hello timer triggers periodic “hello” (actually, the configuration BPDU) messages that are sent from the root to other bridges in the network. This timer also sets the interval in which a bridge expects to hear a hello relayed from its neighboring bridges. Configuration BPDUs are sent every 2 seconds, by default. You can modify the Hello timer with the hello-time keyword, along with a value of 1 to 10 seconds, as in the fol-lowing command: +Switch(config)# spanning-tree hello-time 1 + +The Forward Delay timer determines the amount of time a port stays in the Listening state before moving into the Learning state, and how long it stays in the Learning state before moving to the Forwarding state. You can modify the Forward Delay timer with the forward-time keyword. The default value is 15 seconds, but this can be set to a value of 4 to 30 seconds. This timer should be modified only under careful consideration because the value depends on the diameter of the network and the propagation of BPDUs across all switches. A value that is too low allows loops to form, possibly crippling a network. + +The Max Age timer specifies a stored BPDU’s lifetime that has been received from a neighboring switch with a designated port. Suppose that BPDUs are being received on a nondesignated switch port every 2 seconds, as expected. Then an indirect failure, or one that does not involve a physical link going down, occurs that prevents BPDUs from being sent. The receiving switch waits until the Max Age timer expires to listen for further BPDUs. If none is received, the nondesignated port moves into the Listening state, and the receiving switch generates configuration BPDUs. This port then becomes the desig-nated port to restore connectivity on the segment. + +To modify the Max Age timer, use the max-age keyword. The timer value defaults to 20 seconds but can be set from 6 to 40 seconds. + +Automatically Configuring STP Timers + +Modifying STP timers can be tricky, given the conservative nature of the default values and the calculations needed to derive proper STP operation. Timer values are basically dependent on the Hello Time and the switched network’s diameter, in terms of switch hops. Catalyst switches offer a single command that can change the timer values in a more controlled fashion. As described earlier, the spanning-tree vlan vlan-list root + + + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 193 + +macro command is a better tool to use than setting the timers with the individual com-mands. This global configuration command has the following syntax: +Switch(config)# spanning-tree vlan vlan-list root {primary | secondary} [ diameter diameter [ hello-time hello-time]] + +Here, STP timers will be adjusted according to the formulas specified in the 802.1D stan-dard by giving only the network’s diameter (the maximum number of switches that traffic will traverse across a Layer 2 network) and an optional hello-time. If you do not specify a hello time, the default value of 2 seconds is assumed. + +This command can be used only on a per-VLAN basis to modify the timers for a par-ticular VLAN’s spanning tree instance. The network diameter can be a value from 1 to 7 switch hops; the default STP timers are based on a diameter of 7. Because this command makes a switch become the root bridge, all the modified timer values resulting from this command will be propagated to other switches through the configuration BPDU. + +Suppose, for example, that a small network consists of three switches connected in a tri-angle fashion. The command output in Example 7-6 shows the current (default) STP timer values that are in use for VLAN 100. + +Example 7-6 Displaying the STP Timer Values in Use + +Switch# show spanning-tree vlan 100 +VLAN0100 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +100 +000c.8554.9a80 + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 100 (priority 0 sys-id-ext 100) +Address 000c.8554.9a80 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 +[output omitted] + +The longest path that a packet can take through the sample network is three switches. This is considerably less than the reference diameter of seven that is used to calculate the default timer values. Therefore, you can safely assume that this network diameter is three, provided that no additional switches will be added to lengthen the longest path. Suppose that a hello time of 1 second is also desired, to shorten the time needed to detect a dead neighbor. The following command attempts to make the local switch become the root bridge and automatically adjusts the STP timers: +Switch(config)# spanning-tree vlan 100 root primary diameter 3 hello-time 1 + +You can confirm the new timer values with the show spanning-tree vlan vlan-id com-mand, as demonstrated in Example 7-7. + + + +From the Library of Outcast Outcast +194 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 7-7 Confirming STP Timer Configuration Changes + +Switch# show spanning-tree vlan 100 +VLAN0100 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +100 +000c.8554.9a80 + +This bridge is the root +Hello Time 1 sec Max Age 7 sec Forward Delay 5 sec + +Bridge ID Priority 100 (priority 0 sys-id-ext 100) +Address 000c.8554.9a80 +Hello Time 1 sec Max Age 7 sec Forward Delay 5 sec +Aging Time 300 + + +Redundant Link Convergence + +Some additional methods allow faster STP convergence if a link failure occurs: + +■ PortFast: Enables fast connectivity to be established on access layer switch ports to workstations that are booting + +■ UplinkFast: Enables fast-uplink failover on an access layer switch when dual uplinks are connected into the distribution layer +■ BackboneFast: Enables fast convergence in the network backbone or core layer switches after a spanning-tree topology change occurs + +Instead of modifying timer values, these methods work by controlling convergence on specifically located ports within the network hierarchy. + + +Tip The STP has been enhanced to allow almost instantaneous topology changes instead of having to rely on these Cisco-proprietary extensions. This enhancement is known as the Rapid Spanning Tree Protocol, or IEEE 802.1w, and is covered in Chapter 9, “Advanced Spanning Tree Protocol.” You should become familiar with the topics in this chapter first because they provide the basis for the concepts in Chapter 9. + + + +PortFast: Access Layer Nodes + +An end-user workstation is usually connected to a switch port in the access layer. If the workstation is powered off and then turned on, the switch will sense that the port link status has gone down and back up. The port will not be in a usable state until STP cycles from the Blocking state to the Forwarding state. With the default STP timers, this transi-tion takes at least 30 seconds (15 seconds for Listening to Learning, and 15 seconds for Learning to Forwarding). Therefore, the workstation cannot transmit or receive any useful data until the Forwarding state finally is reached on the port. + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 195 + + +Tip Port initialization delays of up to 50 seconds can be observed. As discussed, 30 of these seconds are due to the STP state transitions. If a switch port is running Port Aggregation Protocol (PAgP) to negotiate EtherChannel configuration, an additional 20-second delay can occur. + + + + + + + + + +Key Topic + +On switch ports that connect only to single workstations or specific devices, bridging loops never should be possible. The potential for a loop exists only if the workstation had additional connections back into the network and if it were bridging traffic itself. For example, this can happen on PCs that are running Windows when network bridging has been enabled. In most situations, this is not very likely to happen. + +Catalyst switches offer the PortFast feature, which shortens the Listening and Learning states to a negligible amount of time. When a workstation link comes up, the switch immediately moves the PortFast port into the Forwarding state. Spanning-tree loop detec-tion is still in operation, however, and the port moves into the Blocking state if a loop is ever detected on the port. + +By default, PortFast is disabled on all switch ports. You can configure PortFast as a global default, affecting all switch ports with a single command. All ports that are configured for access mode (nontrunking) will have PortFast automatically enabled. You can use the following global configuration command to enable PortFast as the default: +Switch(config)# spanning-tree portfast default + + +You can also enable or disable the PortFast feature on specific switch ports by using the following interface configuration command: +Switch(config-if)# [no] spanning-tree portfast + +Obviously, you should not enable PortFast on a switch port that is connected to anoth-er switch because bridging loops could form. One other benefit of PortFast is that Topology Change Notification (TCN) BPDUs are not sent when a switch port in PortFast mode goes up or down. This simplifies the TCN transmission on a large network when end-user workstations are coming up or shutting down. + + +Tip You can also use a macro configuration command to force a switch port to sup-port a single host. The following command enables STP PortFast, sets the port to access (nontrunking) mode, and disables PAgP to prevent the port from participating in an EtherChannel: +Switch(config)# interface type member/module/number +Switch(config-if)# switchport host +switchport mode will be set to access +spanning-tree portfast will be enabled +channel group will be disabled + + + + + +From the Library of Outcast Outcast +196 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +You can display the current PortFast status with the following command: + +Switch# show spanning-tree interface type member/module/number portfast + +For example, the following output shows that port Gigabit Ethernet 1/0/10 supports only access VLAN 10 and has PortFast enabled: + +Switch# show spanning-tree interface gigabitethernet 1/0/10 portfast +VLAN0010 enabled +Switch# + + + + + + + + + +Key Topic + +UplinkFast: Access Layer Uplinks + +Consider an access layer switch that has redundant uplink connections to two distribu-tion layer switches. Normally, one uplink would be in the Forwarding state and the other would be in the Blocking state. If the primary uplink went down, up to 50 seconds could elapse before the redundant uplink could be used. + +The UplinkFast feature on Catalyst switches enables leaf-node switches or switches at the ends of the spanning-tree branches to have a functioning root port while keeping one or more redundant or potential root ports in Blocking mode. When the primary root port +uplink fails, another blocked uplink immediately can be brought up for use. + + + +Tip Many Catalyst switches have two built-in, high-speed uplink ports (Gigabit Ethernet, for example). You might get the idea that UplinkFast can only toggle between two leaf-node uplink ports. This is entirely untrue. UplinkFast keeps a record of all parallel paths +to the root bridge. All uplink ports but one are kept in the Blocking state. If the root port fails, the uplink with the next-lowest root path cost is unblocked and used without delay. + + +To enable the UplinkFast feature, use the following global configuration command: + +Switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second] + +When UplinkFast is enabled, it is enabled for the entire switch and all VLANs. UplinkFast works by keeping track of possible paths to the root bridge. Therefore, the command is not allowed on the root bridge switch. UplinkFast also makes some modifications to the local switch to ensure that it does not become the root bridge and that the switch is not used as a transit switch to get to the root bridge. In other words, the goal is to keep UplinkFast limited to leaf-node switches that are farthest from the root. + +First, the switch’s bridge priority is raised to 49,152, making it unlikely that the switch will be elected to root bridge status. The port cost of all local switch ports is incremented by 3000, making the ports undesirable as paths to the root for any downstream switches. + +The command also includes a max-update-rate parameter. When an uplink on a switch goes down, UplinkFast makes it easy for the local switch to update its bridging table of MAC addresses to point to the new uplink. However, UplinkFast also provides a mecha-nism for the local switch to notify other upstream switches that stations downstream (or within the access layer) can be reached over the newly activated uplink. + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 197 + +The switch accomplishes this by sending dummy multicast frames to destination 0100.0ccd.cdcd on behalf of the stations contained in its CAM table. The MAC address-es are used as the source addresses in the dummy frames, as if the stations actually had sent them. The idea is to quickly send the multicast frames over the new uplink, giving upstream hosts a chance to receive the frames and learn of the new path to those source addresses. + +These multicast frames are sent out at a rate specified by the max-update-rate parameter in packets per second. This limits the amount of bandwidth used for the dummy multi-casts if the CAM table is quite large. The default is 150 packets per second (pps), but the rate can range from 0 to 65,535 pps. If the value is 0, no dummy multicasts are sent. + + +Tip You can use the following command to display the current status of STP UplinkFast: Switch# show spanning-tree uplinkfast +UplinkFast is enabled +Station update rate set to 150 packets/sec. +UplinkFast statistics +Number of transitions via UplinkFast (all VLANs) : 2 +Number of proxy multicast addresses transmitted (all VLANs) : 52 +Name Interface List +--------------------- -------------------------------- + +VLAN0001 +VLAN0010 +VLAN0100 +Switch# + +Gi1/0/1(fwd) +Gi1/0/1(fwd) +Gi1/0/1(fwd) + + + + +BackboneFast: Redundant Backbone Paths + +In the network backbone, or core layer, a different method is used to shorten STP con-vergence. BackboneFast works by having a switch actively determine whether alternative paths exist to the root bridge, in case the switch detects an indirect link failure . Indirect link failures occur when a link that is not directly connected to a switch fails. + +A switch detects an indirect link failure when it receives inferior BPDUs from its des-ignated bridge on either its root port or a blocked port. (Inferior BPDUs are sent from a designated bridge that has lost its connection to the root bridge, making it announce itself as the new root.) + +Normally, a switch must wait for the Max Age timer to expire before responding to the inferior BPDUs. However, BackboneFast begins to determine whether other alternative paths to the root bridge exist according to the following port types that received the inferior BPDU: + +■ If the inferior BPDU arrives on a port in the Blocking state, the switch considers the root port and all other blocked ports to be alternative paths to the root bridge. + + + +From the Library of Outcast Outcast +198 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ If the inferior BPDU arrives on the root port itself, the switch considers all blocked ports to be alternative paths to the root bridge. + +■ If the inferior BPDU arrives on the root port and no ports are blocked, however, the switch assumes that it has lost connectivity with the root bridge. In this case, the switch assumes that it has become the root bridge, and BackboneFast allows it to do so before the Max Age timer expires. + + + + + + + + + + + + + + + +Key Topic + +Detecting alternative paths to the root bridge also involves an interactive process with other bridges. If the local switch has blocked ports, BackboneFast begins to use the Root Link Query (RLQ) protocol to see whether upstream switches have stable connections to the root bridge. + +First, RLQ Requests are sent out. If a switch receives an RLQ Request and either is the root bridge or has lost connection to the root, it sends an RLQ Reply. Otherwise, the RLQ Request is propagated on to other switches until an RLQ Reply can be generated. On the local switch, if an RLQ Reply is received on its current root port, the path to the root bridge is intact and stable. If it is received on a nonroot port, an alternative root path must be chosen. The Max Age timer immediately is expired so that a new root port can be found. + +BackboneFast is simple to configure and operates by short-circuiting the Max Age timer when needed. Although this function shortens the time a switch waits to detect a root path failure, ports still must go through full-length Forward Delay timer intervals during the Listening and Learning states. Where PortFast and UplinkFast enable immediate tran-sitions, BackboneFast can reduce the maximum convergence delay only from 50 to 30 seconds. + +To configure BackboneFast, use the following global configuration command: + +Switch(config)# spanning-tree backbonefast + + +When used, BackboneFast should be enabled on all switches in the network because BackboneFast requires the use of the RLQ Request and Reply mechanism to inform switches of Root Path stability. The RLQ protocol is active only when BackboneFast is enabled on a switch. By default, BackboneFast is disabled. + + +Tip You can verify the current BackboneFast state with the following command: Switch# show spanning-tree backbonefast +BackboneFast is enabled +Switch# + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 199 + +Monitoring STP + +Because the STP running in a network uses several timers, costs, and dynamic calcula-tions, predicting the current state is difficult. You can use a network diagram and work out the STP topology by hand, but any change on the network could produce an entirely different outcome. Then, figure in something like PVST+, in which you have one instance of STP running for each VLAN present. Obviously, simply viewing the STP status on the active network devices would be better. + +You can display information about many aspects of the STP from a Catalyst switch com-mand-line interface (CLI). Specifically, you need to find out the current root bridge and its location in the network. You also might want to see the bridge ID of the switch where you are connected, to see how it participates in STP. Use the information in Table 7-3 to determine what command is useful for what situation. + + +Table 7-3 + +Task + + +Commands for Displaying Spanning-Tree Information + +Command Syntax + + + +View all possible STP parameters for all VLANs. Port information is summarized. +View all possible STP information for all VLANs. Port information is very detailed. +View the total number of switch ports currently in each of the STP states. + +Find the root bridge ID, the root port, and the root path cost. + +Show the bridge ID and STP timers for the local switch. + +Show the STP activity on a specific interface. + +Show the STP UplinkFast status. + +Show the STP BackboneFast status. + +Switch# show spanning tree + +Switch# show spanning-tree detail + +Switch# show spanning-tree [vlan vlan-id] summary + +Switch# show spanning-tree [vlan vlan-id] root + +Switch# show spanning-tree [vlan vlan-id] bridge + +Switch# show spanning-tree interface type port +Switch# show spanning-tree uplinkfast + +Switch# show spanning-tree backbonefast + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +200 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 7-4 lists a reference of these key topics and the page num-bers on which each is found. + +Table 7-4 Key Topics for Chapter 7 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +Bullet + +Bullet + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Explains the pitfalls of a default root bridge election 181 + +Covers best practices for root bridge placement 184 + +Discusses manual root bridge configuration 185 + +Discusses automatic root bridge configuration 186 + +Explains how to configure the root path cost on an 189 interface +Explains how STP timers can be adjusted on the root 191 bridge +Explains the PortFast feature 195 + +Explains the UplinkFast feature 196 + +Explains the BackboneFast feature 198 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +PortFast, UplinkFast, BackboneFast + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + + + + +From the Library of Outcast Outcast +Chapter 7: Spanning-Tree Configuration 201 + +To test your memory of the STP configuration commands, cover the right side of Table +7-5 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. For the skills covered in this chapter, notice that the commands always begin with the keyword spanning-tree. + + +Table 7-5 + +Task + + +STP Configuration Commands + +Command Syntax + + + +Enable STP. + +Set bridge priority. + +Set root bridge (macro). + +Set port cost. + +Set port priority. + +Set STP timers. + + + + + + +Set PortFast on an interface. + +Set UplinkFast on a switch. + + +Switch(config)# spanning-tree vlan-id + +Switch(config)# spanning-tree vlan vlan-id priority bridge-priority + +Switch(config)# spanning-tree vlan vlan-id root {primary | secondary } [diameter diameter ] + +Switch(config-if)# spanning-tree [vlan vlan-id] cost cost + +Switch(config-if)# spanning-tree [vlan vlan-id] port-priority port-priority + +Switch(config)# spanning-tree [vlan vlan-id] hello-time seconds + +Switch(config)# spanning-tree [vlan vlan-id] forward-time seconds + +Switch(config)# spanning-tree [vlan vlan-id] max-age seconds +Switch(config-if)# spanning-tree portfast + +Switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second] + +Set BackboneFast on a switch. Switch(config)# spanning-tree backbonefast + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Protecting Against Unexpected BPDUs: This section covers the Root Guard and BPDU Guard features, which protect against unexpected root can-didates and unexpected BPDUs, respectively. +■ Protecting Against Sudden Loss of BPDUs: This section discusses the Loop Guard and Unidirectional Link Detection (UDLD) features, which detect and protect against the loss of root bridge BPDUs and conditions causing unidirectional links, respectively. +■ Using BPDU Filtering to Disable STP on a Port: This section explains how to filter BPDUs on a switch port to prevent the port from participating in STP altogether. Bridging loops are neither detected nor prevented. +■ Troubleshooting STP Protection: This section summarizes the commands that diagnose or verify actions to protect the topology. + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 8 + + + + +Protecting the Spanning Tree Protocol Topology + + +Achieving and maintaining a loop-free Spanning Tree Protocol (STP) topology revolves around the simple process of sending and receiving bridge protocol data units (BPDUs). Under normal conditions, with all switches playing fairly and according to the rules, a loop-free topology is determined dynamically. + +This chapter discusses two basic conditions that can occur to disrupt the loop-free topol-ogy (even while STP is running): + +■ On a port that has not been receiving BPDUs, BPDUs are not expected. When BPDUs suddenly appear for some reason, the STP topology can reconverge to give unexpected results. + +■ On a port that normally receives BPDUs, BPDUs always are expected. When BPDUs suddenly disappear for some reason, a switch can make incorrect assumptions about the topology and unintentionally create loops. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 8-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 8-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Protecting Against Unexpected BPDUs + +Protecting Against Sudden Loss of BPDUs + +Using BPDU Filtering to Disable STP on a Port + +Troubleshooting STP Protection + +Questions Covered in This Section +1–5 + +6–11 + +12 + +13 + + + + + + + + +From the Library of Outcast Outcast +204 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +1. Why is it important to protect the placement of the root bridge? + +a. To keep two root bridges from becoming active + +b. To keep the STP topology stable + +c. So all hosts have the correct gateway + +d. So the root bridge can have complete knowledge of the STP topology + +2. Which of the following features protects a switch port from accepting superior BPDUs? + +a. STP Loop Guard + +b. STP BPDU Guard + +c. STP Root Guard + +d. UDLD + +3. Which of the following commands can you use to enable STP Root Guard on a switch port? + +a. spanning-tree root guard + +b. spanning-tree root-guard + +c. spanning-tree guard root + +d. spanning-tree rootguard enable + +4. Where should the STP Root Guard feature be enabled on a switch? + +a. All ports + +b. Only ports where the root bridge should never appear + +c. Only ports where the root bridge should be located + +d. Only ports with PortFast enabled + +5. Which of the following features protects a switch port from accepting BPDUs when PortFast is enabled? + +a. STP Loop Guard + +b. STP BPDU Guard + +c. STP Root Guard + +d. UDLD + + + + + + + + + +From the Library of Outcast Outcast +Chapter 8: Protecting the Spanning Tree Protocol Topology 205 + +6. To maintain a loop-free STP topology, which one of the following should a switch uplink be protected against? + +a. A sudden loss of BPDUs + +b. Too many BPDUs + +c. The wrong version of BPDUs + +d. BPDUs relayed from the root bridge + +7. Which of the following commands can enable STP Loop Guard on a switch port? + +a. spanning-tree loop guard + +b. spanning-tree guard loop + +c. spanning-tree loop-guard + +d. spanning-tree loopguard enable + +8. STP Loop Guard detects which of the following conditions? + +a. The sudden appearance of superior BPDUs + +b. The sudden lack of BPDUs + +c. The appearance of duplicate BPDUs + +d. The appearance of two root bridges + +9. Which of the following features can actively test for the loss of the receive side of a link between switches? + +a. POST + +b. BPDU + +c. UDLD + +d. STP + +10. UDLD must detect a unidirectional link before which of the following? + +a. The Max Age timer expires. + +b. STP moves the link to the Blocking state. + +c. STP moves the link to the Forwarding state. + +d. STP moves the link to the Listening state. + +11. What must a switch do when it receives a UDLD message on a link? + +a. Relay the message on to other switches + +b. Send a UDLD acknowledgment + +c. Echo the message back across the link + +d. Drop the message + + +From the Library of Outcast Outcast +206 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +12. Which of the following features effectively disables spanning-tree operation on a switch port? + +a. STP PortFast + +b. STP BPDU filtering + +c. STP BPDU Guard + +d. STP Root Guard + +13. To reset switch ports that have been put into the errdisable mode by UDLD, which one of the following commands should you use? + +a. clear errdisable udld + +b. udld reset + +c. no udld + +d. show udld errdisable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 8: Protecting the Spanning Tree Protocol Topology 207 + +Foundation Topics + + +Protecting Against Unexpected BPDUs + +A network running STP uses BPDUs to communicate between switches (bridges). Switches become aware of each other and of the topology that interconnects them. After a root bridge is elected, BPDUs are generated by the root and are relayed down through the spanning-tree topology. Eventually, all switches in the STP domain receive the root’s BPDUs so that the network converges and a stable loop-free topology forms. + +To maintain an efficient topology, the placement of the root bridge must be predictable. Hopefully, you configured one switch to become the root bridge and a second one to be the secondary root. What happens when a “foreign” or rogue switch is connected to the network, and that switch suddenly is capable of becoming the root bridge? Cisco added two STP features that help prevent the unexpected: Root Guard and BPDU Guard. + +Root Guard + +After an STP topology has converged and becomes loop free, switch ports are assigned the following roles: + +■ Root port: The one port on a switch that is closest (with the lowest root path cost) to the root bridge. + +■ Designated port: The port on a LAN segment that is closest to the root. This port relays, or transmits, BPDUs down the tree. + +■ Blocking port: Ports that are neither root nor designated ports. + +■ Alternate port: Ports that are candidate root ports (they are also close to the root bridge) but are in the Blocking state. These ports are identified for quick use by the STP UplinkFast feature. +■ Forwarding port: Ports where no other STP activity is detected or expected. These are ports with normal end-user connections. + +The root bridge always is expected to be seen on the root port and the alternative ports because these are “closest” (have the best-cost path) to it. + +Suppose that another switch is introduced into the network with a bridge priority that is more desirable (lower) than that of the current root bridge. The new switch then would become the root bridge, and the STP topology might reconverge to a new shape. This is entirely permissible by the STP because the switch with the lowest bridge ID always wins the root election. + +However, this is not always desirable for you, the network administrator, because the new STP topology might be something totally unacceptable. In addition, while the topology is reconverging, your production network might become unavailable. + + + +From the Library of Outcast Outcast +208 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Key Topic + +The Root Guard feature was developed as a means to control where candidate root bridg-es can be connected and found on a network. Basically, a switch learns the current root bridge’s bridge ID. If another switch advertises a superior BPDU, or one with a better bridge ID, on a port where Root Guard is enabled, the local switch will not allow the new switch to become the root. As long as the superior BPDUs are being received on the port, the port will be kept in the root-inconsistent STP state. No data can be sent or received in that state, but the switch can listen to BPDUs received on the port to detect a new root advertising itself. + +In essence, Root Guard designates that a port can only forward or relay BPDUs; the port cannot be used to receive BPDUs. Root Guard prevents the port from ever becoming a root port where BPDUs normally would be received from the root bridge. + +You can enable Root Guard only on a per-port basis. By default, it is disabled on all switch ports. To enable it, use the following interface configuration command: +Switch(config-if)# spanning-tree guard root + + +When the superior BPDUs no longer are received, the port is cycled through the normal STP states to return to normal use. + +Use Root Guard on switch ports where you never expect to find the root bridge for a VLAN. In fact, Root Guard affects the entire port so that a root bridge never can be allowed on any VLAN on the port. When a superior BPDU is heard on the port, the entire port, in effect, becomes blocked. + + +Tip You can display switch ports that Root Guard has put into the root-inconsistent state with the following command: +Switch# show spanning-tree inconsistentports + + + +BPDU Guard + +Recall that the traditional STP offers the PortFast feature, in which switch ports are allowed to immediately enter the Forwarding state as soon as the link comes up. Normally, PortFast provides quick network access to end-user devices, where bridging loops never are expected to form. Even while PortFast is enabled on a port, STP still is running and can detect a bridging loop. However, a loop can be detected only in a finite amount of time—the length of time required to move the port through the normal STP states. + + +Note Remember that enabling PortFast on a port is not the same as disabling the STP on it. + + + + + + +From the Library of Outcast Outcast +Chapter 8: Protecting the Spanning Tree Protocol Topology 209 + + + + + + + + +Key Topic + +By definition, if you enable PortFast, you do not expect to find anything that can cause a bridging loop—especially another switch or device that produces BPDUs. Suppose that a switch is connected by mistake to a port where PortFast is enabled. Now there is a poten-tial for a bridging loop to form. An even greater consequence is that the potential now exists for the newly connected device to advertise itself and become the new root bridge. + +The BPDU Guard feature was developed to further protect the integrity of switch ports that have PortFast enabled. If any BPDU (whether superior to the current root or not) is received on a port where BPDU Guard is enabled, that port immediately is put into the errdisable state. The port is shut down in an error condition and must be either manually reenabled or automatically recovered through the errdisable timeout function. + +By default, BPDU Guard is disabled on all switch ports. You can configure BPDU Guard as a global default, affecting all switch ports with a single command. All ports that have PortFast enabled also have BPDU Guard automatically enabled. You can use the follow-ing global configuration command to enable BPDU Guard as the default: +Switch(config)# spanning-tree portfast bpduguard default + + +You also can enable or disable BPDU Guard on a per-port basis, using the following inter-face configuration command: +Switch(config-if)# [no] spanning-tree bpduguard enable + +When the BPDUs no longer are received, the port still remains in the errdisable state. See Chapter 3, “Switch Port Configuration,” for more information about recovering from the errdisable state. + +You should use BPDU Guard on all switch ports where STP PortFast is enabled. This prevents any possibility that a switch will be added to the port, either intentionally or by mistake. An obvious application for BPDU Guard is on access layer switch ports where users and end devices connect. BPDUs normally would not be expected there and would be detected if a switch or hub inadvertently were connected. + +Naturally, BPDU Guard does not prevent a bridging loop from forming if an Ethernet hub is connected to the PortFast port. This is because a hub does not transmit BPDUs itself; it merely repeats Ethernet frames from its other ports. A loop could form if the hub became connected to two locations in the network, providing a path for frames to be looped without any STP activity. + +You never should enable BPDU Guard on any switch uplink where the root bridge is located. If a switch has multiple uplinks, any of those ports could receive legitimate BPDUs from the root—even if they are in the Blocking state as a result of the UplinkFast feature. If BPDU Guard is enabled on an uplink port, BPDUs will be detected, and the uplink will be put into the errdisable state. This will preclude that uplink port from being used as an uplink into the network. + + + + + + + +From the Library of Outcast Outcast +210 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Protecting Against Sudden Loss of BPDUs + +STP BPDUs are used as probes to learn about a network topology. When the switches participating in STP converge on a common and consistent loop-free topology, BPDUs still must be sent by the root bridge and must be relayed by every other switch in the STP domain. The STP topology’s integrity then depends on a continuous and regular flow of BPDUs from the root. + +What happens if a switch does not receive BPDUs in a timely manner or when it does not receive any? The switch can view that condition as acceptable—perhaps an upstream switch or an upstream link is dead. In that case, the topology must have changed, so blocked ports eventually can be unblocked again. + +However, if the absence of BPDUs is actually a mistake and BPDUs are not being received even though there is no topology change, bridging loops easily can form. + +Cisco has added two STP features that help detect or prevent the unexpected loss of BPDUs: + +■ Loop Guard + +■ Unidirectional Link Detection (UDLD) + + + + + + + + + + + + + + + + + + + +Key Topic + +Loop Guard + +Suppose that a switch port is receiving BPDUs and the switch port is in the Blocking state. The port makes up a redundant path; it is blocking because it is neither a root port nor a designated port. It will remain in the Blocking state as long as a steady flow of BPDUs is received. + +If BPDUs are being sent over a link but the flow of BPDUs stops for some reason, the last-known BPDU is kept until the Max Age timer expires. Then that BPDU is flushed, and the switch thinks there is no longer a need to block the port. After all, if no BPDUs are received, there must not be another STP device connected there. + +The switch then moves the port through the STP states until it begins to forward traf-fic—and forms a bridging loop. In its final state, the port becomes a designated port +where it begins to relay or send BPDUs downstream, when it actually should be receiving BPDUs from upstream. + +To prevent this situation, you can use the Loop Guard STP feature. When enabled, Loop Guard keeps track of the BPDU activity on nondesignated ports. While BPDUs are received, the port is allowed to behave normally. When BPDUs go missing, Loop Guard moves the port into the loop-inconsistent state. The port is effectively blocking at this point to prevent a loop from forming and to keep it in the nondesignated role. + +When BPDUs are received on the port again, Loop Guard allows the port to move through the normal STP states and become active. In this fashion, Loop Guard automati- +cally governs ports without the need for manual intervention. + + + + + +From the Library of Outcast Outcast +Chapter 8: Protecting the Spanning Tree Protocol Topology 211 + +By default, Loop Guard is disabled on all switch ports. You can enable Loop Guard as a global default, affecting all switch ports, with the following global configuration command: +Switch(config)# spanning-tree loopguard default + +You also can enable or disable Loop Guard on a specific switch port by using the follow-ing interface-configuration command: +Switch(config-if)# [no] spanning-tree guard loop + +Although Loop Guard is configured on a switch port, its corrective blocking action is taken on a per-VLAN basis. In other words, Loop Guard does not block the entire port; only the offending VLANs are blocked. + +You can enable Loop Guard on all switch ports, regardless of their functions. The switch figures out which ports are nondesignated and monitors the BPDU activity to keep them nondesignated. Nondesignated ports are generally the alternative root ports and ports that normally are blocking. + +UDLD + + + + + + + + + + + + + + + + + + +Key Topic + +In a campus network, switches are connected by bidirectional links, where traffic can flow in two directions. Clearly, if a link has a physical layer problem, the two switches it connects detect a problem, and the link is shown as not connected. + +What would happen if just one side of the link (receive or transmit) had an odd failure, such as malfunctioning transmit circuitry in a gigabit interface converter (GBIC) or small form factor pluggable (SFP) modules? In some cases, the two switches still might see +a functional bidirectional link, although traffic actually would be delivered in only one direction. This is known as a unidirectional link. + +A unidirectional link poses a potential danger to STP topologies because BPDUs will not be received on one end of the link. If that end of the link normally would be in the +Blocking state, it will not be that way for long. A switch interprets the absence of BPDUs to mean that the port can be moved safely through the STP states so that traffic can be forwarded. However, if that is done on a unidirectional link, a bridging loop forms and the switch never realizes the mistake. + +To prevent this situation, you can use the Cisco proprietary UDLD STP feature. When enabled, UDLD interactively monitors a port to see whether the link is truly bidirectional. A switch sends special Layer 2 UDLD frames identifying its switch port at regular inter-vals. UDLD expects the far-end switch to echo those frames back across the same link, with the far-end switch port’s identification added. + +If a UDLD frame is received in return and both neighboring ports are identified in the frame, the link must be bidirectional. However, if the echoed frames are not seen, the link must be unidirectional for some reason. + +Naturally, an echo process such as this requires both ends of the link to be configured for +UDLD. Otherwise, one end of the link will not echo the frames back to the originator. In + + + +From the Library of Outcast Outcast +212 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +addition, each switch at the end of a link sends its own UDLD messages independently, expecting echoes from the far end. This means that two echo processes are occurring on any given link. + +UDLD messages are sent at regular intervals, as long as the link is active. You can config-ure the message interval UDLD uses. (The default is 15 seconds.) The objective behind UDLD is to detect a unidirectional link condition before STP has time to move a blocked port into the Forwarding state. To do this, the target time must be less than the Max Age timer plus two intervals of the Forward Delay timer, or 50 seconds. UDLD can detect a unidirectional link after about three times the UDLD message interval (45 seconds total, using the default). + +UDLD has two modes of operation: + +■ Normal mode: When a unidirectional link condition is detected, the port is allowed to continue its operation. UDLD merely marks the port as having an undetermined state and generates a syslog message. +■ Aggressive mode: When a unidirectional link condition is detected, the switch takes action to reestablish the link. UDLD messages are sent out once a second for 8 sec-onds. If none of those messages is echoed back, the port is placed in the errdisable state so that it cannot be used. + +You configure UDLD on a per-port basis, although you can enable it globally for all fiber-optic switch ports (either native fiber or fiber-based GBIC or SFP modules). By default, UDLD is disabled on all switch ports. To enable it globally, use the following global con-figuration command: +Switch(config)# udld {enable | aggressive | message time seconds} + +For normal mode, use the enable keyword; for aggressive mode, use the aggressive key-word. You can use the message time keywords to set the message interval to seconds, ranging from 1 to 90 seconds. The default interval is 7 seconds. + +You also can enable or disable UDLD on individual switch ports, if needed, using the fol-lowing interface configuration command: +Switch(config-if)# udld { enable | aggressive | disable} + +Here, you can use the disable keyword to completely disable UDLD on a fiber-optic interface. + + +Note The default UDLD message interval times differ among Catalyst switch platforms. Although two neighbors might have mismatched message time values, UDLD still works correctly. This is because each of the two neighbors simply echoes UDLD messages back as they are received, without knowledge of their neighbor’s own time interval. The time interval is used only to decide when to send UDLD messages and as a basis for detecting a unidirectional link from the absence of echoed messages.If you decide to change the default message time, make sure that UDLD still can detect a fault before STP decides to move a link to the Forwarding state. + + +From the Library of Outcast Outcast +Chapter 8: Protecting the Spanning Tree Protocol Topology 213 + +You safely can enable UDLD on all switch ports. The switch globally enables UDLD only on ports that use fiber-optic media. Twisted-pair or copper media does not suffer from the physical layer conditions that allow a unidirectional link to form. However, you can enable UDLD on nonfiber links individually, if you want. + +At this point, you might be wondering how UDLD can be enabled gracefully on the two end switches. Recall that in aggressive mode, UDLD disables the link if the neighbor does not reflect the messages back within a certain time period. If you are enabling UDLD on a production network, is there a chance that UDLD will disable working links before you can get the far end configured? + +The answer is no. UDLD makes some intelligent assumptions when it is enabled on a link for the first time. First, UDLD has no record of any neighbor on the link. It starts send-ing out messages, hoping that a neighboring switch will hear them and echo them back. Obviously, the device at the far end also must support UDLD so that the messages will be echoed back. + +If the neighboring switch does not yet have UDLD enabled, no messages will be echoed. UDLD will keep trying (indefinitely) to detect a neighbor and will not disable the link. After the neighbor has UDLD configured also, both switches become aware of each other and the bidirectional state of the link through their UDLD message exchanges. From then on, if messages are not echoed, the link can accurately be labeled as unidirectional. + +Finally, be aware that if UDLD detects a unidirectional condition on a link, it takes action on only that link. This becomes important in an EtherChannel: If one link within the channel becomes unidirectional, UDLD flags or disables only the offending link in the bundle, not the entire EtherChannel. UDLD sends and echoes its messages on each link within an EtherChannel channel independently. + +Once UDLD aggressive mode has put a switch port into the errdisable state, you must use the following command to reenable it: +Switch# udld reset + +Actually, all ports errdisabled because of UDLD will be reset and reenabled simultane-ously, allowing traffic to begin passing through them again. This behavior differs some-what from other errdisable conditions, where you would use the shutdown and no shut-down commands to reenable a port. + +Using BPDU Filtering to Disable STP on a Port + + + + + + + +Key Topic + +Ordinarily, STP operates on all switch ports in an effort to eliminate bridging loops before they can form. BPDUs are sent on all switch ports—even ports where PortFast has been enabled. BPDUs also can be received and processed if any are sent by neighboring switches. + +You always should allow STP to run on a switch to prevent loops. However, in special cases when you need to prevent BPDUs from being sent or processed on one or more +switch ports, you can use BPDU filtering to effectively disable STP on those ports. + + + +From the Library of Outcast Outcast +214 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +By default, BPDU filtering is disabled on all switch ports. You can configure BPDU filter-ing as a global default, affecting all switch ports with the following global configuration command: +Switch(config)# spanning-tree portfast bpdufilter default + +The default keyword indicates that BPDU filtering will be enabled automatically on all ports that have PortFast enabled. If PortFast is disabled on a port, then BPDU filtering will not be enabled there. + +You also can enable or disable BPDU filtering on specific switch ports by using the fol-lowing interface configuration command: +Switch(config-if)# spanning-tree bpdufilter { enable | disable} + +Be very careful to enable BPDU filtering only under controlled circumstances in which you are absolutely sure that a switch port will have a single host connected and that a loop will be impossible. Enable BPDU filtering only if the connected device cannot allow BPDUs to be accepted or sent. Otherwise, you should permit STP to operate on the switch ports as a precaution. + + +Tip Do not confuse BPDU filtering with the BPDU Guard feature. BPDU Guard is used to detect inbound BPDUs on ports where BPDUs are not expected to be seen, then protect the STP stability by preventing those BPDUs from being processed. In contrast, BPDU filtering stops all BPDUs from being received or sent on a switch port, effectively disabling STP. + + + +Troubleshooting STP Protection + +With several different types of STP protection features available, you might need to know which (if any) has been configured on a switch port. Table 8-2 lists and describes the EXEC commands useful for verifying the features presented in this chapter. + +Table 8-2 Commands for Verifying and Troubleshooting STP Protection Features + + +Display Function +List the ports that have been labeled in an inconsistent state. +Look for detailed reasons for inconsistencies. + +Display the global BPDU Guard, BPDU filter, and Loop Guard states. +Display the UDLD status on one or all ports. + +Reenable ports that UDLD aggressive mode has errdisabled. + +Command Syntax +Switch# show spanning-tree inconsistentports +Switch# show spanning-tree interface type mod/num [detail] +Switch# show spanning-tree summary + +Switch# show udld [type mod/num] + +Switch# udld reset + + + + +From the Library of Outcast Outcast +Chapter 8: Protecting the Spanning Tree Protocol Topology 215 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 8-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 8-3 Key Topics for Chapter 8 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Discusses the Root Guard feature 208 + +Discusses the BPDU Guard feature 209 + +Discusses the Loop Guard feature 210 + +Discusses the UDLD feature 211 + +Explains BPDU filtering 213 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +Root Guard, superior BPDU, BPDU Guard, Loop Guard, UDLD, BPDU filtering + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +With so many similar and mutually exclusive STP protection features available, you might have a hard time remembering which ones to use where. Use Figure 8-1 as a quick reference. + +Figure 8-1 shows two backbone switches (Switch A and B), along with an access layer switch (Switch C), with redundant uplinks. Users are connected to the access switch, where PortFast is in use. An additional access switch (Switch D) has an uplink to access layer switch C. All switch-to-switch links are fiber-based Gigabit Ethernet. Obviously, a root bridge never should appear out of Switch D. + + +From the Library of Outcast Outcast +216 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Root Bridge + +Secondary Root Bridge + + +RP UDLD +X +Switch A Switch B + +DP + + +UDLD + + +RP Switch C + +Root Guard + + +UDLD + + + +Loop Guard + +BPDU Guard + + + +PortFast + +Switch D + + +Root guard: Apply to ports where root is never expected. +BPDU guard: Apply to all user ports where PortFast is enabled. +Loop guard: Apply to nondesignated ports but okay to apply to all ports. +UDLD: Apply to all fiber-optic links between switches (must be enabled on both ends). + + +Permissible combinations on a switch port: +Loop guard and UDLD Root guard and UDLD + +Not permissible on a switch port: +Root guard and Loop guard Root guard and BPDU guard + +Figure 8-1 Guidelines for Applying STP Protection Features in a Network + +To test your memory of the STP protection feature commands, cover the rightmost col-umns of Tables 8-4 and 8-5 with a piece of paper, read the description on the left side, then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. + + + + + + + + +From the Library of Outcast Outcast +Chapter 8: Protecting the Spanning Tree Protocol Topology 217 + + +Table 8-4 + +Task + + +STP Protection Configuration Commands + +Global Command Syntax + + + +Interface Command Syntax + + + +Enable Root Guard. + +Enable BPDU Guard. + +Enable Loop Guard. + +Enable UDLD. + +Enable BPDU filtering. + +— + +Switch(config)# spanning-tree portfast bpduguard default +Switch(config)# spanning-tree loopguard default +Switch(config)# udld {enable | aggressive | message time seconds} +Switch(config)# spanning-tree bpdufilter default + + +Switch(config-if)# spanning-tree guard root +Switch(config-if)# spanning-tree bpduguard enable +Switch(config-if)# spanning-tree guard loop +Switch(config-if)# udld {enable | aggressive | disable} +Switch(config-if)# spanning-tree bpdufilter enable + + + + + +Table 8-5 + +Task + + +STP Protection Activity Commands + +Command Syntax + + + +Look for ports that have been put in an inconsistent state. +Display the global BPDU Guard, BPDU filter, and Loop Guard states. +Show UDLD status. + +Reenable all ports that UDLD has errdisabled. + + +Switch# show spanning-tree inconsistentports +Switch# show spanning-tree summary + +Switch# show udld [type mod/num] + +Switch# udld reset + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Rapid Spanning Tree Protocol: This section dis-cusses the enhancements that allow switches to run STP efficiently, offering fast convergence. +■ Multiple Spanning Tree Protocol: This section discusses the latest IEEE standard that supports a reduced number of STP instances for a campus net-work while using RSTP for efficient operation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 9 + + + + + + +Advanced Spanning Tree Protocol + + +Familiarity with the IEEE 802.1D STP standard is essential because that protocol is used universally to maintain loop-free bridged and switched networks. However, it now is con-sidered a legacy protocol, offering topology change and convergence times that are not as acceptable as they once were. + +This chapter discusses the many STP enhancements that are available in new standards. Rapid STP (RSTP) is presented first because it provides the foundation for efficient STP activity. RSTP can be coupled with either per-VLAN STP (PVST+) or Multiple STP +modes. This allows a Layer 2 campus network to undergo change quickly and efficiently, with little downtime for today’s applications. + +This chapter also covers Multiple STP (MST or MSTP). MST allows VLANs to be individ-ually mapped into arbitrary STP instances while RSTP operates in the background. You can use MST to greatly simplify the Layer 2 topologies and STP operations when many VLANs (and many instances of STP) are present in a network. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 9-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 9-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Rapid Spanning Tree Protocol + +Multiple Spanning Tree Protocol + +Questions Covered in This Section +1–8 + +9–12 + + + + + + + + + + +From the Library of Outcast Outcast +220 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +1. Which one of the following commands enables the use of RSTP? + +a. spanning-tree mode rapid-pvst + +b. no spanning-tree mode pvst + +c. spanning-tree rstp + +d. spanning-tree mode rstp + +e. None. RSTP is enabled by default. + +2. On which standard is RSTP based? + +a. 802.1Q + +b. 802.1D + +c. 802.1w + +d. 802.1s + +3. Which of the following is not a port state in RSTP? + +a. Listening + +b. Learning + +c. Discarding + +d. Forwarding + +4. When a switch running RSTP receives an 802.1D BPDU, what happens? + +a. The BPDU is discarded or dropped. + +b. An ICMP message is returned. + +c. The switch begins to use 802.1D rules on that port. + +d. The switch disables RSTP. + +5. When does an RSTP switch consider a neighbor to be down? + +a. After three BPDUs are missed + +b. After six BPDUs are missed + +c. After the Max Age timer expires + +d. After the Forward timer expires + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 221 + +6. Which process is used during RSTP convergence? + +a. BPDU propagation + +b. Synchronization + +c. Forward timer expiration + +d. BPDU + +7. What causes RSTP to view a port as a point-to-point port? + +a. Port speed + +b. Port media + +c. Port duplex + +d. Port priority + +8. Which of the following events triggers a topology change with RSTP on a nonedge port? + +a. A port comes up or goes down. + +b. A port comes up. + +c. A port goes down. + +d. A port moves to the Forwarding state. + +9. Which of the following is not a characteristic of MST? + +a. A reduced number of STP instances + +b. Fast STP convergence + +c. Eliminated need for CST + +d. Interoperability with PVST+ + +10. Which of the following standards defines the MST protocol? + +a. 802.1Q + +b. 802.1D + +c. 802.1w + +d. 802.1s + + + + + + + + + + + +From the Library of Outcast Outcast +222 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +11. How many instances of STP are supported in the Cisco implementation of MST? + +a. 1 + +b. 16 + +c. 256 + +d. 4096 + +12. What switch command can be used to change from PVST+ to MST? + +a. spanning-tree mst enable + +b. no spanning-tree pvst+ + +c. spanning-tree mode mst + +d. spanning-tree mst + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 223 + + +Foundation Topics + + +Rapid Spanning Tree Protocol + +The IEEE 802.1D Spanning Tree Protocol was designed to keep a switched or bridged network loop free, with adjustments made to the network topology dynamically. A topol-ogy change typically takes 30 seconds, with a port moving from the Blocking state to +the Forwarding state after two intervals of the Forward Delay timer. As technology has improved, 30 seconds has become an unbearable length of time to wait for a production network to fail over or “heal” itself during a problem. + +The IEEE 802.1w standard was developed to use 802.1D’s principal concepts and make the resulting convergence much faster. This is also known as the Rapid Spanning Tree Protocol (RSTP), which defines how switches must interact with each other to keep the network topology loop free in a very efficient manner. + +As with 802.1D, RSTP’s basic functionality can be applied as a single instance or multiple instances. This can be done by using RSTP as the underlying mechanism for the Cisco-proprietary Per-VLAN Spanning Tree Protocol (PVST+). The resulting combination is called Rapid PVST+ (RPVST+). RSTP also is used as part of the IEEE 802.1s Multiple Spanning Tree (MST) operation. RSTP operates consistently in each, but replicating RSTP as multiple instances requires different approaches. + +RSTP Port Behavior + +In 802.1D, each switch port is assigned a role and a state at any given time. Depending on the port’s proximity to the root bridge, it takes on one of the following roles: + +■ Root port + +■ Designated port + +■ Blocking port (neither root nor designated) + +The Cisco proprietary UplinkFast feature also reserved a hidden alternate port role for ports that offered parallel paths to the root but were in the Blocking state. + +Recall that each switch port also is assigned one of five possible states: + +■ Disabled + +■ Blocking + +■ Listening + +■ Learning + +■ Forwarding + + + + +From the Library of Outcast Outcast +224 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + + + + + + + +Key Topic + +Only the Forwarding state allows data to be sent and received. A port’s state is somewhat tied to its role. For example, a blocking port cannot be a root port or a designated port. + +RSTP achieves its rapid nature by letting each switch interact with its neighbors through each port. This interaction is performed based on a port’s role, not strictly on the bridge protocol data units (BPDUs) that are relayed from the root bridge. After the role is deter-mined, each port can be given a state that determines what it does with incoming data. + +The root bridge in a network using RSTP is elected just as with 802.1D—by the lowest bridge ID. After all switches agree on the identity of the root, the following port roles are +determined: + + +■ Root port: The one switch port on each switch that has the best root path cost to the root. This is identical to 802.1D. (By definition, the root bridge has no root ports.) +■ Designated port: The switch port on a network segment that has the best root path cost to the root. + +■ Alternate port: A port that has an alternative path to the root, different from the path the root port takes. This path is less desirable than that of the root port. (An example of this is an access layer switch with two uplink ports; one becomes the root port, and the other is an alternate port.) +■ Backup port: A port that provides a redundant (but less desirable) connection to a segment where another switch port already connects. If that common segment is lost, the switch might or might not have a path back to the root. + +RSTP defines port states only according to what the port does with incoming frames. (Naturally, if incoming frames are ignored or dropped, so are outgoing frames.) Any port role can have any of these port states: + + +■ Key +Topic + + +■ + +■ + +Discarding: Incoming frames simply are dropped; no MAC addresses are learned. (This state combines the 802.1D Disabled, Blocking, and Listening states because all three did not effectively forward anything. The Listening state is not needed because RSTP quickly can negotiate a state change without listening for BPDUs first.) +Learning: Incoming frames are dropped, but MAC addresses are learned. + +Forwarding: Incoming frames are forwarded according to MAC addresses that have been (and are being) learned. + + + +BPDUs in RSTP + +In 802.1D, BPDUs basically originate from the root bridge and are relayed by all switches down through the tree. Because of this propagation of BPDUs, 802.1D convergence must wait for steady-state conditions before proceeding. + +RSTP uses the 802.1D BPDU format for backward compatibility. However, some previ-ously unused bits in the Message Type field are used. The sending switch port identifies + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 225 + + + + + + + + + + + + + + + + +Key Topic + +itself by its RSTP role and state. The BPDU version also is set to 2 to distinguish RSTP BPDUs from 802.1D BPDUs. In addition, RSTP uses an interactive process so that two neighboring switches can negotiate state changes. Some BPDU bits are used to flag mes-sages during this negotiation. + +BPDUs are sent out every switch port at hello time intervals, regardless of whether BPDUs are received from the root. In this way, any switch anywhere in the network can play an active role in maintaining the topology. Switches also can expect to receive regu-lar BPDUs from their neighbors. When three BPDUs are missed in a row, that neighbor is presumed to be down, and all information related to the port leading to the neighbor immediately is aged out. This means that a switch can detect a neighbor failure in three +Hello intervals (default 6 seconds), versus the Max Age timer interval (default 20 seconds) for 802.1D. + +Because RSTP distinguishes its BPDUs from 802.1D BPDUs, it can coexist with switches still using 802.1D. Each port attempts to operate according to the STP BPDU that is received. For example, when an 802.1D BPDU (Version 0) is received on a port, that port begins to operate according to the 802.1D rules. + +However, each port has a measure that locks the protocol in use, in case BPDUs from both 802.1D and RSTP are received within a short time frame. This can occur if the switches in a network are being migrated from one STP type to another. Instead of flap-ping or toggling the STP type during a migration, the switch holds the protocol type for the duration of a migration delay timer. After this timer expires, the port is free to change +protocols if needed. + + + +RSTP Convergence + +The convergence of STP in a network is the process that takes all switches from a state of independence (each thinks it must be the STP root) to one of uniformity, in which each switch has a place in a loop-free tree topology. You can think of convergence as a two-stage process: +1. One common root bridge must be “elected,” and all switches must know about it. + +2. The state of every switch port in the STP domain must be brought from a Blocking state to the appropriate state to prevent loops. + +Convergence generally takes time because messages are propagated from switch to switch. The traditional 802.1D STP also requires the expiration of several timers before switch ports can safely be allowed to forward data. + +RSTP takes a different approach when a switch needs to decide how to participate in the tree topology. When a switch first joins the topology (perhaps it was just powered up) or has detected a failure in the existing topology, RSTP requires it to base its forwarding decisions on the type of port. + + + + + + +From the Library of Outcast Outcast +226 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Port Types + +Every switch port can be considered one of the following types: + + +■ Key +Topic + + + + +■ + + + + + +■ + +Edge port: A port at the “edge” of the network, where only a single host connects. Traditionally, this has been identified by enabling the STP PortFast feature. RSTP keeps the PortFast concept for familiarity. By definition, the port cannot form a loop as it connects to one host, so it can be placed immediately in the Forwarding state. However, if a BPDU ever is received on an edge port, the port immediately loses its edge port status. +Root port: The port that has the best cost to the root of the STP instance. Only one root port can be selected and active at any time, although alternative paths to the root can exist through other ports. If alternative paths are detected, those ports are identified as alternative root ports and immediately can be placed in the Forwarding state when the existing root port fails. +Point-to-point port: Any port that connects to another switch and becomes a desig-nated port. A quick handshake with the neighboring switch, rather than a timer expi-ration, decides the port state. BPDUs are exchanged back and forth in the form of a proposal and an agreement. One switch proposes that its port becomes a designated +port; if the other switch agrees, it replies with an agreement message. + + +Point-to-point ports automatically are determined by the duplex mode in use. Full-duplex ports are considered point to point because only two switches can be present on the link. STP convergence can occur quickly over a point-to-point link through RSTP handshake messages. + +Half-duplex ports, on the other hand, are considered to be on a shared medium with pos-sibly more than two switches present. They are not point-to-point ports. STP convergence on a half-duplex port must occur between several directly connected switches. Therefore, the traditional 802.1D style convergence must be used. This results in a slower response because the shared-medium ports must go through the fixed Listening and Learning state time periods. + +It is easy to see how two switches quickly can converge to a common idea of which one is the root and which one will have the designated port after just a single exchange of BPDUs. What about a larger network, where 802.1D BPDUs normally would have to be relayed from switch to switch? + +RSTP handles the complete STP convergence of the network as a propagation of hand-shakes over point-to-point links. When a switch needs to make an STP decision, a handshake is made with the nearest neighbor. When that is successful, the handshake sequence is moved to the next switch and the next, as an ever-expanding wave moving toward the network’s edges. + +During each handshake sequence, a switch must take measures to completely ensure that it will not introduce a bridging loop before moving the handshake outward. This is done through a synchronization process. + + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 227 + + + + +Key Topic + +Synchronization + +To participate in RSTP convergence, a switch must decide the state of each of its ports. Nonedge ports begin in the Discarding state. After BPDUs are exchanged between the switch and its neighbor, the Root Bridge can be identified. If a port receives a superior BPDU from a neighbor, that port becomes the root port. + +For each nonedge port, the switch exchanges a proposal-agreement handshake to decide the state of each end of the link. Each switch assumes that its port should become the designated port for the segment, and a proposal message (a configuration BPDU) is sent to the neighbor suggesting this. + +When a switch receives a proposal message on a port, the following sequence of events +occurs. Figure 9-1 shows the sequence, based on the center Catalyst switch: + + +1. If the proposal’s sender has a superior BPDU, the local switch realizes that the sender should be the designated switch (having the designated port) and that its own port must become the new root port. +2. Before the switch agrees to anything, it must synchronize itself with the topology. + +3. All nonedge ports immediately are moved into the Discarding (blocking) state so that no bridging loops can form. + +4. An agreement message (a configuration BPDU) is sent back to the sender, indicating that the switch is in agreement with the new designated port choice. This also tells the sender that the switch is in the process of synchronizing itself. +5. The root port immediately is moved to the Forwarding state. The sender’s port also immediately can begin forwarding. + +6. For each nonedge port that is currently in the Discarding state, a proposal message is sent to the respective neighbor. + +7. An agreement message is expected and received from a neighbor on a nonedge port. + +8. The nonedge port immediately is moved to the Forwarding state. + +Notice that the RSTP convergence begins with a switch sending a proposal message. The recipient of the proposal must synchronize itself by effectively isolating itself from the rest of the topology. All nonedge ports are blocked until a proposal message can be sent, causing the nearest neighbors to synchronize themselves. This creates a moving “wave” of synchronizing switches, which quickly can decide to start forwarding on their links only if their neighbors agree. Figure 9-2 shows how the synchronization wave travels through a network at three successive time intervals. Isolating the switches along the traveling wave inherently prevents bridging loops. + + + + + + + + + +From the Library of Outcast Outcast +228 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide +X +X +X +X +X +X + + + +5. Forward + + +1. Proposal 4. Agreement +X + + + + +Catalyst Switch + +5. Forward + +2. Sync! + +3. Block + + +Edge Port 8. Forward + +7. Agreement + + +6. Proposal Point-to-Point + + + +Figure 9-1 Sequence of Events During RSTP Convergence + + +Proposal +X + + + + +Sync t = 1 +X +X +X +X +X + + + +Sync t = 2 + + + + + + + +Sync t = 3 + +X X + +Figure 9-2 RSTP Synchronization Traveling Through a Network + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 229 + +The entire convergence process happens quickly, at the speed of BPDU transmission, without the use of any timers. However, a designated port that sends a proposal message might not receive an agreement message reply. Suppose that the neighboring switch does not understand RSTP or has a problem replying. The sending switch then must become overly cautious and must begin playing by the 802.1D rules: The port must be moved through the legacy Listening and Learning states (using the Forward Delay timer) before moving to the Forwarding state. + + + + + + + + + +Key Topic + +Topology Changes and RSTP + +Recall that when an 802.1D switch detects a port state change (either up or down), it sig-nals the root bridge by sending Topology Change Notification (TCN) BPDUs. The root bridge, in turn, must signal the topology change by sending out a TCN message that is relayed to all switches in the STP domain. + +RSTP detects a topology change only when a nonedge port transitions to the Forwarding state. This might seem odd because a link failure is not used as a trigger. RSTP uses all its rapid convergence mechanisms to prevent bridging loops from forming. Therefore, topol-ogy changes are detected only so that bridging tables can be updated and corrected as hosts appear first on a failed port and then on a different functioning port. + +When a topology change is detected, a switch must propagate news of the change to other switches in the network so that they can correct their bridging tables, too. This pro-cess is similar to the convergence and synchronization mechanism; topology change (TC) messages propagate through the network in an ever-expanding wave. + +BPDUs, with their TC bit set, are sent out all the nonedge designated ports. This is done until the TC timer expires, after two intervals of the Hello time. This notifies neighbor-ing switches of the new link and the topology change. In addition, all MAC addresses associated with the nonedge designated ports are flushed from the content-addressable memory (CAM) table. This forces the addresses to be relearned after the change, in case hosts now appear on a different link. + +All neighboring switches that receive the TC messages also must flush the MAC address-es learned on all ports except the one that received the TC message. Those switches then +must send TC messages out their nonedge designated ports, and so on. + + + +RSTP Configuration + +By default, a switch operates in Per-VLAN Spanning Tree Plus (PVST+) mode using tradi-tional 802.1D STP. Therefore, RSTP cannot be used until a different spanning-tree mode (MST or RPVST+) is enabled. Remember that RSTP is just the underlying mechanism that a spanning-tree mode can use to detect topology changes and converge a network into a loop-free topology. + +The only configuration changes related to RSTP affect the port or link type. The link type is used to determine how a switch negotiates topology information with its neighbors. + + + +From the Library of Outcast Outcast +230 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Key Topic + +To configure a port as an RSTP edge port, use the following interface configuration command: +Switch(config-if)# spanning-tree portfast + + +You already should be familiar with this command from the 802.1D STP configuration. After PortFast is enabled, the port is considered to have only one host and is positioned at the edge of the network. + +By default, RSTP automatically decides that a port is a point-to-point link if it is oper-ating in full-duplex mode. Ports connecting to other switches are usually full duplex because there are only two switches on the link. However, you can override the automatic determination, if needed. For example, a port connecting to one other switch might be operating at half duplex, for some reason. To force the port to act as a point-to-point link, use the following interface configuration command: +Switch(config-if)# spanning-tree link-type point-to-point + + + + + + + + + + + + + +Key Topic + +Rapid Per-VLAN Spanning Tree Protocol + +Chapter 6, “Traditional Spanning Tree Protocol,” describes PVST+ as the default STP mode on Catalyst switches. In PVST+, one spanning tree instance is created and used for each active VLAN that is defined on the switch. Each STP instance behaves according to the traditional 802.1D STP rules. + +You can improve the efficiency of each STP instance by configuring a switch to begin using RSTP instead. This means that each VLAN will have its own independent instance of RSTP running on the switch. This mode is known as Rapid PVST+ (RPVST+). + +You need only one configuration step to change the STP mode and begin using RPVST+. You can use the following global configuration command to accomplish this: +Switch(config)# spanning-tree mode rapid-pvst + + +Be careful when you use this command on a production network because any STP pro-cess that is currently running must be restarted. This can cause functioning links to move through the traditional STP states, preventing data from flowing for a short time. + + +Tip To revert back to the default PVST+ mode, using traditional 802.1D STP, you can use the following command: +Switch(config)# spanning-tree mode pvst + + +After you enable the RPVST+ mode, the switch must begin supporting both RSTP and 802.1D STP neighbors. The switch can detect the neighbor’s STP type by the BPDU ver-sion that is received. You can see the neighbor type in the output of the show spanning-tree vlan vlan-id command, as demonstrated in Example 9-1. + + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 231 + +Example 9-1 Detecting a Neighboring Switch’s STP Type + +Switch# show spanning-tree vlan 171 +VLAN0171 +Spanning tree enabled protocol rstp + +Root ID Priority +Address +Cost +Port + +4267 +00d0.0457.38aa +3 +833 (Port-channel1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32939 (priority 32768 sys-id-ext 171) +Address 0007.0d55.a800 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type +---------------- ---- ---- --------- -------- ------------------------------- + +Gi1/0/7 +Gi1/0/9/6 +Po1 +Po2 +Po3 +Switch# + +Desg FWD 4 +Altn BLK 4 +Root FWD 3 +Desg FWD 3 +Desg FWD 3 + +128.7 +128.9 +128.104 +128.834 +128.835 + +P2p +P2p Peer(STP) +P2p +P2p +P2p + + +The output in Example 9-1 shows information about the RSTP instance for VLAN 171. The first shaded line confirms that the local switch indeed is running RSTP. (The only other way to confirm the STP mode is to locate the spanning-tree mode command in the running configuration.) + +In addition, this output displays all the active ports participating in the VLAN 171 instance of RSTP, along with their port types. The string P2p denotes a point-to-point RSTP port type in which a full-duplex link connects two neighboring switches that both are running RSTP. If you see P2p Peer(STP), the port is a point-to-point type but the neighboring device is running traditional 802.1D STP. + +Multiple Spanning Tree Protocol + +Chapter 6 covered two “flavors” of spanning-tree implementations, IEEE 802.1Q and PVST+, both based on the 802.1D STP. These also represent the two extremes of STP operation in a network: + +■ 802.1Q : Only a single instance of STP is used for all VLANs. If there are 500 VLANs, only 1 instance of STP will be running. This is called the Common Spanning Tree (CST) and operates over the trunk’s native VLAN. +■ PVST+: One instance of STP is used for each active VLAN in the network. If there are 500 VLANs, 500 independent instances of STP will be running. + + +From the Library of Outcast Outcast +232 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +In most networks, each switch has a redundant path to another switch. For example, an access layer switch usually has two uplinks, each connecting to a different distribution or core layer switch. If 802.1Q’s CST is used, only one STP instance will run. This means that there is only one loop-free topology at any given time and that only one of the two uplinks in the access layer switch will be forwarding. The other uplink always will be blocking. + +Obviously, arranging the network so that both uplinks can be used simultaneously would be best. One uplink should carry one set of VLANs, whereas the other should carry a different set as a type of load balancing. + +PVST+ seems more attractive to meet that goal because it allows different VLANs to have different topologies so that each uplink can be forwarding. But think of the consequences: As the number of VLANs increases, so does the number of independent STP instances. Each instance uses some amount of the switch CPU and memory resources. The more instances that are in use, the fewer CPU resources will be available for switching. + +Beyond that, what is the real benefit of having 500 STP topologies for 500 VLANs, when only a small number of possible topologies exist for a switch with two uplinks? Figure 9-3 shows a typical network with an access layer switch connecting to a pair of core switches. Two VLANs are in use, with the root bridges configured to support load balancing across the two uplinks. The right portion of the figure shows every possible topology for VLANs A and B. Notice that because the access layer switch has only two uplinks, only two topologies actually matter—one in which the left uplink forwards, and one in which the right uplink forwards. +X +X + +Root Root VLAN A VLAN B + + +Trunk Links + + + + +Access Layer Switch + + + + + +VLAN A VLAN B + + +VLAN ATopology +(Primary Root) +X + + +VLAN ATopology +(Secondary Root) +X + + + + + + + +VLAN B Topology (Primary Root) + +Figure 9-3 Possible STP Topologies for Two VLANs + + +VLAN B Topology +(Secondary Root) + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 233 + +Notice also that the number of useful topologies is independent of the number of VLANs. If 10 or 100 VLANs were used in the figure, there would still be only two pos-sible outcomes at the access layer switch. Therefore, running 10 or 100 instances of STP when only a couple would suffice is rather wasteful. + +The Multiple Spanning Tree Protocol was developed to address the lack of and surplus of STP instances. As a result, the network administrator can configure exactly the number of STP instances that makes sense for the enterprise network, no matter how many VLANs are in use. MST is defined in the IEEE 802.1s standard. + +MST Overview + +MST is built on the concept of mapping one or more VLANs to a single STP instance. Multiple instances of STP can be used (hence the name MST), with each instance sup-porting a different group of VLANs. + +For the network shown in Figure 9-3, only two MST instances would be needed. Each could be tuned to result in a different topology so that Instance 1 would forward on the left uplink, whereas Instance 2 would forward on the right uplink. Therefore, VLAN A would be mapped to Instance 1, and VLAN B would be mapped to Instance 2. + +To implement MST in a network, you need to determine the following: + +■ The number of STP instances needed to support the desired topologies + +■ Whether to map a set of VLANs to each instance + + +MST Regions + + + +Key Topic + +MST is different from 802.1Q and PVST+, although it can interoperate with them. If a switch is configured to use MST, it somehow must figure out which of its neighbors are using which type of STP. This is done by configuring switches into common MST regions, where every switch in a region runs MST with compatible parameters. + +In most networks, a single MST region is sufficient, although you can configure more than one region. Within the region, all switches must run the instance of MST that is +defined by the following attributes: + + +■ MST configuration name (32 characters) + +■ MST configuration revision number (0 to 65535) + +■ MST instance-to-VLAN mapping table (4096 entries) + +If two switches have the same set of attributes, they belong to the same MST region. If not, they belong to two independent regions. + +MST BPDUs contain configuration attributes so that switches receiving BPDUs can compare them against their local MST configurations. If the attributes match, the STP instances within MST can be shared as part of the same region. If not, a switch is seen + + + +From the Library of Outcast Outcast +234 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +to be at the MST region boundary, where one region meets another or one region meets traditional 802.1D STP. + + +Note The entire MST instance-to-VLAN mapping table is not sent in the BPDUs because the instance mappings must be configured on each switch. Instead, a digest, or a hash code computed from the table contents, is sent. As the contents of the table change, the digest value will be different. Therefore, a switch quickly can compare a received digest to its own to see if the advertised table is the same. + + + +Spanning-Tree Instances Within MST + +MST was designed to interoperate with all other forms of STP. Therefore, it also must support STP instances from each STP type. This is where MST can get confusing. Think of the entire enterprise network as having a single CST topology so that one instance of STP represents any and all VLANs and MST regions present. The CST maintains a com-mon loop-free topology while integrating all forms of STP that might be in use. + +To do this, CST must regard each MST region as a single “black box” bridge because it has no idea what is inside the region, nor does it care. CST maintains a loop-free topol-ogy only with the links that connect the regions to each other and to standalone switches running 802.1Q CST. + + + + + +Key Topic + +IST Instances + +Something other than CST must work out a loop-free topology inside each MST region. Within a single MST region, an Internal Spanning Tree (IST) instance runs to work out +a loop-free topology between the links where CST meets the region boundary and all switches inside the region. Think of the IST instance as a locally significant CST, bound-ed by the edges of the region. + +The IST presents the entire region as a single virtual bridge to the CST outside. BPDUs are exchanged at the region boundary only over the native VLAN of trunks, as if a single CST were in operation. And, indeed, it is. + +Figure 9-4 shows the basic concept behind the IST instance. The network at the left has an MST region, where several switches are running compatible MST configurations. Another switch is outside the region because it is running only the CST from 802.1Q. + +The same network is shown at the right, where the IST has produced a loop-free topol-ogy for the network inside the region. The IST makes the internal network look like a single bridge (the “big switch” in the cloud) that can interface with the CST running out- +side the region. + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 235 + + +MST Region + + + + + +IST + +IST + +CST X CST X + + +Figure 9-4 Concepts Behind the IST Instance + + + + +Key Topic + +MST Instances + +Recall that the whole idea behind MST is the capability to map multiple VLANs to a smaller number of STP instances. Inside a region, the actual MST instances (MSTI) exist alongside the IST. Cisco supports a maximum of 16 MSTIs in each region. The IST always exists as MSTI number 0, leaving MSTIs 1 through 15 available for use. + +Figure 9-5 shows how different MSTIs can exist within a single MST region. The left por-tion of the figure is identical to that of Figure 9-4. In this network, two MST instances, MSTI 1 and MSTI 2, are configured with different VLANs mapped to each. Their topolo-gies follow the same structure as the network on the left side of the figure, but each has +converged differently. + + + + + +MST Region MSTI 1 + + +CST X + + + + +IST + +CST X MSTI 2 + + +CST X + + +Figure 9-5 Concepts Behind MST Instances + +From the Library of Outcast Outcast +236 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Notice that within the MST cloud, there are now three independent STP instances coex-isting: MSTI1, MSTI 2, and the IST. + +Only the IST (MSTI 0) is allowed to send and receive MST BPDUs. Information about each of the other MSTIs is appended to the MST BPDU as an M-record. Therefore, even if a region has all 16 instances active, only 1 BPDU is needed to convey STP information about them all. + +Each of the MSTIs is significant only within a region, even if an adjacent region has the same MSTIs in use. In other words, the MSTIs combine with the IST only at the region boundary to form a subtree of the CST. That means only IST BPDUs are sent into and out of a region. + +What if an MST region connects with a switch running traditional PVST+? MST can detect this situation by listening to the received BPDUs. If BPDUs are heard from more than one VLAN (the CST), PVST+ must be in use. When the MST region sends a BPDU toward the PVST+ switch, the IST BPDUs are replicated into all the VLANs on the PVST+ switch trunk. + + +Tip Keep in mind that the IST instance is active on every port on a switch. Even if a port does not carry VLANs that have been mapped to the IST, IST must be running on the port. +Also, by default, all VLANs are mapped to the IST instance. You must explicitly map them to other instances, if needed. + + + + + + +Key Topic + +MST Configuration + +You must manually configure the MST configuration attributes on each switch in a region. There is currently no method to propagate this information from one switch to another, as is done with a protocol such as VLAN Trunking Protocol (VTP). To define the +MST region, use the following configuration commands in the order shown: + + +Step 1. Enable MST on the switch: + +Switch(config)# spanning-tree mode mst +Step 2. Enter the MST configuration mode: + +Switch(config)# spanning-tree mst configuration +Step 3. Assign a region configuration name (up to 32 characters): + +Switch(config-mst)# name name +Step 4. Assign a region configuration revision number (0 to 65,535): + +Switch(config-mst)# revision version +The configuration revision number gives you a means of tracking changes to the MST region configuration. Each time you make changes to the configura-tion, you should increase the number by one. Remember that the region con-figuration (including the revision number) must match on all switches in the + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 237 + +region. Therefore, you also need to update the revision numbers on the other switches to match. +Step 5. Map VLANs to an MST instance: + +Switch(config-mst)# instance instance-id vlan vlan-list +The instance-id (0 to 15) carries topology information for the VLANs listed in vlan-list. The list can contain one or more VLANs separated by commas. You also can add a range of VLANs to the list by separating numbers with a hyphen. VLAN numbers can range from 1 to 4094. (Remember that, by default, all VLANs are mapped to instance 0, the IST.) +Step 6. Show the pending changes you have made: + +Switch(config-mst)# show pending +Step 7. Exit the MST configuration mode; commit the changes to the active MST region configuration: + +Switch(config-mst)# exit +After MST is enabled and configured, PVST+ operation stops and the switch changes to RSTP operation. A switch cannot run both MST and PVST+ at the same time. + +You also can tune the parameters that MST uses when it interacts with CST or tradi-tional 802.1D. The parameters and timers are identical to those discussed in Chapter 7, “Spanning-Tree Configuration.” In fact, the commands are very similar except for the addition of the mst keyword and the instance-id. Instead of tuning STP for a VLAN instance, you use an MST instance. + +Table 9-2 summarizes the commands as a quick reference. Notice that the timer configu-rations are applied to MST as a whole, not to a specific MST instance. This is because all instance timers are defined through the IST instance and BPDUs. + + +Table 9-2 + +Task + + +MST Configuration Commands + +Command Syntax + + + +Set root bridge (macro). + +Set bridge priority. + +Set port cost. + +Set port priority. + +Set STP timers. + + +Switch(config)# spanning-tree mst instance-id root {primary | secondary } [diameter diameter ] + +Switch(config)# spanning-tree mst instance-id priority bridge-priority + +Switch(config)# spanning-tree mst instance-id cost cost + +Switch(config)# spanning-tree mst instance-id port-priority port-priority + +Switch(config)# spanning-tree mst hello-time seconds + +Switch(config)# spanning-tree mst forward-time seconds + +Switch(config)# spanning-tree mst max-age seconds + + + + + + +From the Library of Outcast Outcast +238 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 9-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 9-3 Key Topics for Chapter 9 +Key +Topic Key Topic Element Description Page Number + +Paragraph + +Paragraph + +Paragraph + +Bullet + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +List + +Describes RSTP root bridge election and port states 224 + +Describes RSTP port states 224 + +Discusses RSTP compatibility with 802.1D STP 225 + +Describes RSTP port types 226 + +Explains the RSTP synchronization process 227 + +Discusses how RSTP detects topology changes 229 + +Explains how to configure an RSTP edge port 230 + +Explains how to enable the RPVST+ mode, using 230 RSTP +Discusses how MST is organized into regions 233 + +Describes the IST instance 234 + +Describes MST instances 235 + +Explains how to configure MST 236 + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Advanced Spanning Tree Protocol 239 + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +RSTP, RPVST+, alternate port, backup port, discarding state, edge port, point-to-point port, synchronization, MST, MST region, IST instance, MST instance (MSTI) + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the Rapid STP and MST commands, cover the right side of Tables 9-4 and 9-5 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + +Table 9-4 + +Task + + +RSTP Configuration Commands + +Command Syntax + + + +Define an edge port. + +Override a port type. + + +Switch(config-if)# spanning-tree portfast + +Switch(config-if)# spanning-tree link-type point-to-point + + + + + +Table 9-5 + +Task + + +MST Region Configuration Commands + +Command Syntax + + + +Enable MST on a switch. + +Enter MST configuration mode. + +Name the MST region. + +Set the configuration revision number. + +Switch(config)# spanning-tree mode mst + +Switch(config)# spanning-tree mst configuration + +Switch(config-mst)# name name + +Switch(config-mst)# revision version + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Switch Port Aggregation with EtherChannel: This section discusses the concept of aggregating, or “bundling,” physical ports into a single logical link. Methods for load balancing traffic across the physical links also are covered. +■ EtherChannel Negotiation Protocols: This sec-tion covers two protocols that dynamically negoti-ate and control EtherChannels: Port Aggregation Protocol (PAgP), a Cisco proprietary protocol, and Link Aggregation Control Protocol (LACP), a stan-dards-based protocol. +■ EtherChannel Configuration: This section explains the Catalyst switch commands needed to configure EtherChannel. +■ Troubleshooting an EtherChannel: This section gives a brief summary of things to consider and commands to use when an aggregated link is not operating properly. + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 10 + + + + + + +Aggregating Switch Links + + +In previous chapters, you learned about connecting switches and organizing users and devices into common workgroups. Using these principles, end users can be given effective access to resources both on and off the campus network. However, today’s mission-critical applications and services demand networks that provide high availability and reliability. + +This chapter presents technologies that you can use in a campus network to provide higher bandwidth and reliability between switches. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 10-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 10-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Switch Port Aggregation with EtherChannel + +EtherChannel Negotiation Protocols + +EtherChannel Configuration + +Troubleshooting an EtherChannel + +Questions Covered in This Section +1–7 + +8–10 + +11–12 + +13 + + + +1. If Gigabit Ethernet ports are bundled into an EtherChannel, what is the maximum throughput supported on a Catalyst switch? + +a. 1 Gbps + +b. 2 Gbps + +c. 4 Gbps + +d. 8 Gbps + +e. 16 Gbps + + + +From the Library of Outcast Outcast +242 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. Which of these methods distributes traffic over an EtherChannel? + +a. Round robin + +b. Least-used link + +c. A function of address + +d. A function of packet size + +3. What type of interface represents an EtherChannel as a whole? + +a. Channel + +b. Port + +c. Port channel + +d. Channel port + +4. Which of the following is not a valid method for EtherChannel load balancing? + +a. Source MAC address + +b. Source and destination MAC addresses + +c. Source IP address + +d. IP precedence + +e. UDP/TCP port + +5. How can the EtherChannel load-balancing method be set? + +a. Per switch port + +b. Per EtherChannel + +c. Globally per switch + +d. Cannot be configured + +6. What logical operation is performed to calculate EtherChannel load balancing as a function of two addresses? + +a. OR + +b. AND + +c. XOR + +d. NOR + +7. Which one of the following is a valid combination of ports for an EtherChannel? + +a. Two access links (one VLAN 5, one VLAN 5) + +b. Two access links (one VLAN 1, one VLAN 10) + +c. Two trunk links (one VLANs 1 to 10, one VLANs 1, 11 to 20) + +d. Two 10/100/1000 Ethernet links (both full duplex, one 100 Mbps) + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 243 + +8. Which of these is a method for negotiating an EtherChannel? + +a. PAP + +b. CHAP + +c. LAPD + +d. LACP + +9. Which of the following is a valid EtherChannel negotiation mode combination between two switches? + +a. PAgP auto, PAgP auto + +b. PAgP auto, PAgP desirable + +c. on, PAgP auto + +d. LACP passive, LACP passive + +10. When is PAgP’s “desirable silent” mode useful? + +a. When the switch should not send PAgP frames + +b. When the switch should not form an EtherChannel + +c. When the switch should not expect to receive PAgP frames + +d. When the switch is using LACP mode + +11. Which of the following EtherChannel modes does not send or receive any negotia-tion frames? + +a. channel-group 1 mode passive + +b. channel-group 1 mode active + +c. channel-group 1 mode on + +d. channel-group 1 mode desirable + +e. channel-group 1 mode auto + +12. Two computers are the only hosts sending IP data across an EtherChannel between two switches. Several different applications are being used between them. Which of these load-balancing methods would be more likely to use the most links in the EtherChannel? +a. Source and destination MAC addresses. + +b. Source and destination IP addresses. + +c. Source and destination TCP/UDP ports. + +d. None of the other answers is correct. + + + + + + +From the Library of Outcast Outcast +244 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +13. Which command enables you to see the status of an EtherChannel’s links? + +a. show channel link + +b. show etherchannel status + +c. show etherchannel summary + +d. show ether channel status + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 245 + +Foundation Topics + + +Switch Port Aggregation with EtherChannel + +As discussed in Chapter 3, “Switch Port Configuration,” switches can use Ethernet, Fast Ethernet, Gigabit, or 10-Gigabit Ethernet ports to scale link speeds by a factor of 10. It might seem logical to simply add more links between two switches to scale the band-width incrementally. Suppose two switches have a single Gigabit Ethernet link between them. If you add a second link, will the available bandwidth double? No, because each link acts independently, a bridging loop could easily form through them. As the left por-tion of Figure 10-1 shows, STP will detect the loop potential and will place one of the links in the blocking state. The end result is still a single active link between switches. Even if you add several more links, STP will keep all but one in the blocking state, as shown on the right portion of Figure 10-1. + +Switch A Switch A + + + +gi1/0/1 + +gi1/0/1 + +gi1/0/2 + +gi1/0/2 + +gi1/0/1 2 3 4 + +gi1/0/1 2 3 4 + + + + +Switch B + +Figure 10-1 + +Switch B + +The Effects of Trying to Scale Bandwidth with Individual Links + + +Cisco offers another method of scaling link bandwidth by aggregating, or bundling, parallel links, termed the EtherChannel technology. Two to eight links of either Fast Ethernet (FE), Gigabit Ethernet (GE), or 10-Gigabit Ethernet (10GE) can be bundled as one logical link of Fast EtherChannel (FEC), Gigabit EtherChannel (GEC), or 10-Gigabit Etherchannel (10GEC), respectively. This bundle provides a full-duplex bandwidth of up to 1600 Mbps (eight links of Fast Ethernet), 16 Gbps (eight links of GE), or 160 Gbps (eight links of 10GE). + +This also provides an easy means to “grow,” or expand, a link’s capacity between two switches, without having to continually purchase hardware for the next magnitude of throughput. For example, a single Fast Ethernet link (200 Mbps throughput) can be incrementally expanded up to eight Fast Ethernet links (1600 Mbps) as a single Fast EtherChannel. If the traffic load grows beyond that, the growth process can begin again with a single GE link (2 Gbps throughput), which can be expanded up to eight GE links as a Gigabit EtherChannel (16 Gbps). The process repeats again by moving to a single 10GE link, and so on. + +Ordinarily, having multiple or parallel links between switches creates the possibility of bridging loops, an undesirable condition. EtherChannel avoids this situation by bundling parallel links into a single, logical link, which can act as either an access or a trunk link. + + +From the Library of Outcast Outcast +246 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Switches or devices on each end of the EtherChannel link must understand and use the EtherChannel technology for proper operation. Figure 10-2 demonstrates how the links added in Figure 10-1 can be configured as an EtherChannel bundle. All the bundled phys-ical links are collectively known by the logical EtherChannel interface, port channel 1. Notice that none of the physical links are in the Blocking state; STP is aware of the single port channel interface, which is kept in the Forwarding state. + +Key Switch A Switch A Topic + +gi1/0/1 gi1/0/2 gi1/0/1 2 3 4 +port-channel1 port-channel1 +gi1/0/1 gi1/0/2 gi1/0/1 2 3 4 + + +Switch B Switch B + +Figure 10-2 Scaling Bandwidth by Bundling Physical Links into an EtherChannel + +Although an EtherChannel link is seen as a single logical link, the link does not necessar-ily have an inherent total bandwidth equal to the sum of its component physical links. For example, suppose that a GEC link is made up of four full-duplex 1-Gbps GE links. Although it is possible for the GEC link to carry a total throughput of 8 Gbps (if each link becomes fully loaded), the single resulting GEC bundle does not operate at this speed. + +Instead, traffic is distributed across the individual links within the EtherChannel. Each of these links operates at its inherent speed (2 Gbps full duplex for GE) but carries only the frames placed on it by the EtherChannel hardware. If the load-distribution algorithm favors one link within the bundle, that link will carry a disproportionate amount of traf-fic. In other words, the load is not always distributed equally among the individual links. The load-balancing process is explained further in the next section. + +EtherChannel also provides redundancy with several bundled physical links. If one of the links within the bundle fails, traffic sent through that link is automatically moved to an adjacent link. Failover occurs in less than a few milliseconds and is transparent to the end user. As more links fail, more traffic is moved to further adjacent links. Likewise, as links are restored, the load automatically is redistributed among the active links. + +As you plan on configuring an EtherChannel, you should give some thought to several different failure scenarios. For example, the failure of a single physical link within an EtherChannel is not catastrophic because the switches compensate by moving traffic to the other, still functioning, links. However, what if all of the physical links are connected to the same switch, as shown in Figure 10-2? The switch itself might fail someday, taking all of the physical links of the EtherChannel down with it. + +A more robust solution involves distributing the physical links across multiple switches at each end of the EtherChannel. This is possible when the switches are configured as + + + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 247 + +one logical or virtual switch, such as the Cisco stackable Catalyst switches or chassis-based Virtual Switching System (VSS) switch families. In Figure 10-3, a four-port GEC is made up of two links connected to the first switch in a stack and two links connected to the second switch in a stack. This is known as a multichassis EtherChannel (MEC). +Even if one switch fails within a stack, the MEC will keep functioning thanks to the other stacked switch. + + + + + +Switch 1 Switch 2 + + + + + + +Switch 1 +Switch 2 + +Switch +Stack A gi1/0/1 gi1/0/2 +gi2/0/1 gi2/0/2 + + + + +Switch +Stack B gi1/0/1 gi1/0/2 +gi2/0/1 +gi2/0/2 + + + + + + +port-channel1 + + + + +port-channel1 + + +Figure 10-3 Increasing Availability with a Multichassis EtherChannel + + +Bundling Ports with EtherChannel + +EtherChannel bundles can consist of up to eight physical ports of the same Ethernet media type and speed. Some configuration restrictions exist to ensure that only similarly configured links are bundled. + +Generally, all bundled ports first must belong to the same VLAN. If used as a trunk, bundled ports must be in trunking mode, have the same native VLAN, and pass the same set of VLANs. Each of the ports should have the same speed and duplex settings before being bundled. Bundled ports also must be configured with identical spanning-tree settings. + + +Distributing Traffic in EtherChannel + + + +Key Topic + +Traffic in an EtherChannel is distributed across the individual bundled links in a deter-ministic fashion; however, the load is not necessarily balanced equally across all the links. Instead, frames are forwarded on a specific link as a result of a hashing algorithm. The algorithm can use source IP address, destination IP address, or a combination of source and destination IP addresses, source and destination MAC addresses, or TCP/UDP port numbers. The hash algorithm computes a binary pattern that selects a link number in the bundle to carry each frame. + +If only one address or port number is hashed, a switch forwards each frame by using +one or more low-order bits of the hash value as an index into the bundled links. If two + + + + +From the Library of Outcast Outcast +248 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +addresses or port numbers are hashed, a switch performs an exclusive-OR (XOR) opera-tion on one or more low-order bits of the addresses or TCP/UDP port numbers as an index into the bundled links. + +For example, an EtherChannel consisting of two links bundled together requires a 1-bit index. If the index is 0, link 0 is selected; if the index is 1, link 1 is used. Either the low-est-order address bit or the XOR of the last bit of the addresses in the frame is used as the index. A four-link bundle uses a hash of the last 2 bits. Likewise, an eight-link bundle uses a hash of the last 3 bits. The hashing operation’s outcome selects the EtherChannel’s outbound link. Table 10-2 shows the results of an XOR on a two-link bundle, using the source and destination addresses. + +Table 10-2 Frame Distribution on a Two-Link EtherChannel + + +Binary Address +Addr1: ... xxxxxxx0 + +Addr2: ... xxxxxxx0 + +Addr1: ... xxxxxxx0 + +Addr2: ... xxxxxxx1 + +Addr1: ... xxxxxxx1 + +Addr2: ... xxxxxxx0 + +Addr1: ... xxxxxxx1 + +Addr2: ... xxxxxxx1 + +Two-Link EtherChannel XOR and Link Number +... xxxxxxx0: Use link 0 + + +... xxxxxxx1: Use link 1 + + +... xxxxxxx1: Use link 1 + + +... xxxxxxx0: Use link 0 + + + +The XOR operation is performed independently on each bit position in the address value. If the two address values have the same bit value, the XOR result is always 0. If the two address bits differ, the XOR result is always 1. In this way, frames can be distributed sta-tistically among the links with the assumption that MAC or IP addresses themselves are distributed statistically throughout the network. In a four-link EtherChannel, the XOR is performed on the lower 2 bits of the address values, resulting in a 2-bit XOR value (each bit is computed separately) or a link number from 0 to 3. + +As an example, consider a packet being sent from IP address 192.168.1.1 to 172.31.67.46. Because EtherChannels can be built from two to eight individual links, only the right-most (least-significant) 3 bits are needed as a link index. From the source and destination addresses, these bits are 001 (1) and 110 (6), respectively. For a two-link EtherChannel, +a 1-bit XOR is performed on the rightmost address bit: 1 XOR 0 = 1, causing Link 1 in the bundle to be used. A four-link EtherChannel produces a 2-bit XOR: 01 XOR 10 = 11, causing Link 3 in the bundle to be used. Finally, an eight-link EtherChannel requires a +3-bit XOR: 001 XOR 110 = 111, where Link 7 in the bundle is selected. + +A conversation between two devices always is sent through the same EtherChannel link because the two endpoint addresses stay the same. However, when a device talks to sev- + + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 249 + +eral other devices, chances are that the destination addresses are distributed equally with 0s and 1s in the last bit (even and odd address values). This causes the frames to be dis-tributed across the EtherChannel links. + +Note that the load distribution is still proportional to the volume of traffic passing between pairs of hosts or link indexes. For example, suppose that there are two pairs of hosts talking across a two-link channel, and each pair of addresses results in a unique link index. Frames from one pair of hosts always travel over one link in the channel, whereas frames from the other pair travel over the other link. The links are both being used as a result of the hash algorithm, so the load is being distributed across every link in the channel. + +However, if one pair of hosts has a much greater volume of traffic than the other pair, one link in the channel will be used much more than the other. This still can create a load imbalance. To remedy this condition, you should consider other methods of hashing algo-rithms for the channel. For example, a method that combines the source and destination addresses along with UDP or TCP port numbers in a single XOR operation can distribute traffic much differently. Then, packets are placed on links within the bundle based on the applications (port numbers) used within conversations between two hosts. The possible hashing methods are discussed in the following section. + +Configuring EtherChannel Load Balancing + +The hashing operation can be performed on either MAC or IP addresses and can be based solely on source or destination addresses, or both. Use the following command to configure frame distribution for all EtherChannel switch links: +Switch(config)# port-channel load-balance method + +Notice that the load-balancing method is set with a global configuration command. You must set the method globally for the switch, not on a per-port basis. Table 10-3 lists +the possible values for the method variable, along with the hashing operation and some sample supporting switch models. + +Table 10-3 Types of EtherChannel Load-Balancing Methods +Key +Topic Method Value Hash Input Hash Operation Switch Model + + +src-ip + +dst-ip + +src-dst-ip + +src-mac + +dst-mac + +src-dst-mac + +src-port + +Source IP address Bits + +Destination IP address Bits + +Source and destination IP address XOR + +Source MAC address Bits + +Destination MAC address Bits + +Source and destination MAC XOR + +Source port number Bits + +All models + +All models + +All models + +All models + +All models + +All models + +4500, 6500 + + + + + +From the Library of Outcast Outcast +250 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Method Value dst-port +src-dst-port + +Hash Input +Destination port number + +Source and destination port + +Hash Operation Bits +XOR + +Switch Model 4500, 6500 +4500, 6500 + + + +The default configuration depends on the switch model and hardware capabilities. In common access layer switch models such as the Catalyst 3750-X, the default is src-mac. You can verify the load-balancing method currently in use with the show etherchannel load-balance command, as shown in Example 10-1. + +Example 10-1 Displaying the Current EtherChannel Load-Balancing Method + +Switch# show etherchannel load-balance +EtherChannel Load-Balancing Configuration: +src-mac + +EtherChannel Load-Balancing Addresses Used Per-Protocol: +Non-IP: Source MAC address +IPv4: Source MAC address +IPv6: Source MAC address +Switch# + +Normally, the default action should result in a statistical distribution of frames; however, you should determine whether the EtherChannel is imbalanced according to the traf- +fic patterns present. For example, if a single server is receiving most of the traffic on an EtherChannel, the server’s address (the destination IP address) always will remain con-stant in the many conversations. This can cause one link to be overused if the destination IP address is used as a component of a load-balancing method. In the case of a four-link EtherChannel, perhaps two of the four links are overused. Configuring the use of MAC addresses, or only the source IP addresses, might cause the distribution to be more bal-anced across all the bundled links. + + +Tip To verify how effectively a configured load-balancing method is performing, you can use the show etherchannel port-channel command. Each link in the channel is displayed, along with a hex “Load” value. Although this information is not intuitive, you can use the hex values to get an idea of each link’s traffic loads relative to the others. + + +In some applications, EtherChannel traffic might consist of protocols other than IP. For example, IPX or SNA frames might be switched along with IP. Non-IP protocols need to be distributed according to MAC addresses because IP addresses are not applicable. Here, the switch should be configured to use MAC addresses instead of the IP default. + + + + + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 251 + + +Tip A special case results when a router is connected to an EtherChannel. Recall that a router always uses its burned-in MAC address in Ethernet frames, even though it is for-warding packets to and from many different IP addresses. In other words, all the traffic sent by the router will use the router’s MAC address as the source. As well, many end sta-tions send frames to their local router address with the router’s MAC address as the des-tination. This means that the destination MAC address is the same for all frames destined through the router. +Usually, this will not present a problem because the source MAC addresses are all differ-ent. When two routers are forwarding frames to each other, however, both source and des-tination MAC addresses remain constant, and only one link of the EtherChannel is used. If the MAC addresses remain constant, choose IP addresses instead. Beyond that, if most of the traffic is between the same two IP addresses, as in the case of two servers talking, choose IP port numbers to disperse the frames across different links. + + +You should choose the load-balancing method that provides the greatest distribution or variety when the channel links are indexed. Also consider the type of addressing that is being used on the network. If most of the traffic is IP, it might make sense to load bal-ance according to IP addresses or TCP/UDP port numbers. + +But if IP load balancing is being used, what happens to non-IP frames? If a frame cannot meet the load-balancing criteria, the switch automatically falls back to the “next lowest” method. With Ethernet, MAC addresses must always be present, so the switch distrib-utes those frames according to their MAC addresses. + +A switch also provides some inherent protection against bridging loops with EtherChannels. When ports are bundled into an EtherChannel, no inbound (received) broadcasts and multi-casts are sent back out over any of the remaining ports in the channel. Outbound broadcast and multicast frames are load-balanced like any other: The broadcast or multicast address becomes part of the hashing calculation to choose an outbound channel link. + +EtherChannel Negotiation Protocols + +EtherChannels can be negotiated between two switches to provide some dynamic link configuration. Two protocols are available to negotiate bundled links in Catalyst switches. The Port Aggregation Protocol (PAgP) is a Cisco proprietary solution, and the Link Aggregation Control Protocol (LACP) is standards based. Table 10-4 summarizes the negotiation protocols and their operation. + +Table 10-4 EtherChannel Negotiation Protocols + + +Negotiation + +PAgP +On + +Auto + +Desirable + +Mode + +LACP +On + +Passive + +Active + +Negotiation Packets Sent? + + +No + +Yes + +Yes + +Characteristics + + +All ports channeling + +Waits to channel until asked + +Actively asks to form a channel + + + +From the Library of Outcast Outcast +252 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + +Key Topic + + + + + + + + + + + + + + + + + +Key Topic + +Port Aggregation Protocol + +To provide automatic EtherChannel configuration and negotiation between switches, Cisco developed the Port Aggregation Protocol. PAgP packets are exchanged between switches over EtherChannel-capable ports. Neighbors are identified and port group capa-bilities are learned and compared with local switch capabilities. Ports that have the same neighbor device ID and port group capability are bundled together as a bidirectional, point-to-point EtherChannel link. + +PAgP forms an EtherChannel only on ports that are configured for either identical static VLANs or trunking. PAgP also dynamically modifies parameters of the EtherChannel +if one of the bundled ports is modified. For example, if the configured VLAN, speed, or duplex mode of a port in an established bundle is changed, PAgP reconfigures that parameter for all ports in the bundle. + +PAgP can be configured in active mode (desirable), in which a switch actively asks a far-end switch to negotiate an EtherChannel, or in passive mode (auto, the default), in which a switch negotiates an EtherChannel only if the far end initiates it. + + +Link Aggregation Control Protocol + +LACP is a standards-based alternative to PAgP, defined in IEEE 802.3ad (also known as IEEE 802.3 Clause 43, “Link Aggregation”). LACP packets are exchanged between switches over EtherChannel-capable ports. As with PAgP, neighbors are identified and +port group capabilities are learned and compared with local switch capabilities. However, LACP also assigns roles to the EtherChannel’s endpoints. + +The switch with the lowest system priority (a 2-byte priority value followed by a 6-byte switch MAC address) is allowed to make decisions about what ports actively are partici-pating in the EtherChannel at a given time. + +Ports are selected and become active according to their port priority value (a 2-byte priority followed by a 2-byte port number), where a low value indicates a higher prior-ity. A set of up to 16 potential links can be defined for each EtherChannel. Through LACP, a switch selects up to eight of these having the lowest port priorities as active EtherChannel links at any given time. The other links are placed in a standby state and will be enabled in the EtherChannel if one of the active links goes down. + +Like PAgP, LACP can be configured in active mode (active), in which a switch actively asks a far-end switch to negotiate an EtherChannel, or in passive mode (passive), in which +a switch negotiates an EtherChannel only if the far end initiates it. + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 253 + +EtherChannel Configuration + +For each EtherChannel on a switch, you must choose the EtherChannel negotiation protocol and assign individual switch ports to the EtherChannel. Both PAgP- and LACP-negotiated EtherChannels are described in the following sections. You also can configure an EtherChannel to use the on mode, which unconditionally bundles the links. In this case, neither PAgP nor LACP packets are sent or received. + +As ports are configured to be members of an EtherChannel, the switch automatically cre-ates a logical port-channel interface. This interface represents the channel as a whole. + +Configuring a PAgP EtherChannel + + + + + +Key Topic + +To configure switch ports for PAgP negotiation (the default), use the following commands: +Switch(config)# interface type member/module/number +Switch(config-if)# channel-protocol pagp +Switch(config-if)# channel-group number mode { on | {{auto | desirable} +[ non-silent]}} + + +Each interface that will be included in a single EtherChannel bundle must be configured and assigned to the same unique channel group number (1 to 64). Channel negotiation must be set to on (unconditionally channel, no PAgP negotiation), auto (passively listen and wait to be asked), or desirable (actively ask). + +By default, PAgP operates in silent submode with the desirable and auto modes, and allows ports to be added to an EtherChannel even if the other end of the link is silent and never transmits PAgP packets. This might seem to go against the idea of PAgP, in which two endpoints are supposed to negotiate a channel. After all, how can two switches negotiate anything if no PAgP packets are received? + +The key is in the phrase “if the other end is silent.” The silent submode listens for any PAgP packets from the far end, looking to negotiate a channel. If none is received, silent submode assumes that a channel should be built anyway, so no more PAgP packets are expected from the far end. + +This allows a switch to form an EtherChannel with a device such as a file server or a network analyzer that does not participate in PAgP. In the case of a network analyzer connected to the far end, you also might want to see the PAgP packets generated by the switch, as if you were using a normal PAgP EtherChannel. + +If you expect a PAgP-capable switch to be on the far end, you should add the non-silent keyword to the desirable or auto mode. This requires each port to receive PAgP packets before adding them to a channel. If PAgP is not heard on an active port, the port remains in the up state, but PAgP reports to the Spanning Tree Protocol (STP) that the port is down. + + + + + +From the Library of Outcast Outcast +254 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Tip In practice, you might notice a delay from the time the links in a channel group are connected until the time the channel is formed and data can pass over it. You will encoun-ter this if both switches are using the default PAgP auto mode and silent submode. Each interface waits to be asked to form a channel, and each interface waits and listens before accepting silent channel partners. The silent submode amounts to approximately a 15-sec-ond delay. +Even if the two interfaces are using PAgP auto mode, the link will still eventually come up, although not as a channel. You might notice that the total delay before data can pass over the link is actually approximately 45 or 50 seconds. The first 15 seconds are the result of PAgP silent mode waiting to hear inbound PAgP messages, and the final 30 seconds are the result of the STP moving through the listening and learning stages. + + +As an example of PAgP configuration, suppose that you want a switch to use an EtherChannel load-balancing hash of both source and destination port numbers. A Gigabit EtherChannel will be built from interfaces Gigabit Ethernet 1/0/1 through 1/0/4, with the switch actively negotiating a channel. The switch should not wait to listen for silent partners. You can use the following configuration commands to accomplish this: +Switch(config)# port-channel load-balance src-dst-port +Switch(config)# interface range gig 1/0/1 – 4 +Switch(config-if)# channel-protocol pagp +Switch(config-if)# channel-group 1 mode desirable non-silent + +Configuring a LACP EtherChannel + +To configure switch ports for LACP negotiation, use the following commands: Key +Topic Switch(config)# lacp system-priority priority +Switch(config)# interface type member/module/number +Switch(config-if)# channel-protocol lacp +Switch(config-if)# channel-group number mode {on | passive | active} +Switch(config-if)# lacp port-priority priority + +First, the switch should have its LACP system priority defined (1 to 65,535; default 32,768). If desired, one switch should be assigned a lower system priority than the other so that it can make decisions about the EtherChannel’s makeup. Otherwise, both switch-es will have the same system priority (32,768), and the one with the lower MAC address will become the decision maker. + +Each interface included in a single EtherChannel bundle must be assigned to the same unique channel group number (1 to 64). Channel negotiation must be set to on (uncondi-tionally channel, no LACP negotiation), passive (passively listen and wait to be asked), or active (actively ask). + +You can configure more interfaces in the channel group number than are allowed to be active in the channel. This prepares extra standby interfaces to replace failed active ones. Use the lacp port-priority command to configure a lower port priority (1 to 65,535; default 32,768) for any interfaces that must be active, and a higher priority for interfaces + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 255 + +that might be held in the standby state. Otherwise, just use the default scenario, in which all ports default to 32,768 and the lower port numbers (in interface number order) are used to select the active ports. + +As an example of LACP configuration, suppose that you want to configure a switch to negotiate a Gigabit EtherChannel using interfaces Gigabit Ethernet 1/0/1 through 1/0/4 and 2/0/1 through 2/0/4. Interfaces Gigabit Ethernet 1/0/5 through 1/0/8 and 2/0/5 through 2/0/8 are also available, so these can be used as standby links to replace failed links in the channel. This switch should actively negotiate the channel and should be the decision maker about the channel operation. + +You can use the following configuration commands to accomplish this: + +Switch(config)# lacp system-priority 100 +Switch(config)# interface range gig 1/0/1 – 4 , gig 2/0/1 – 4 +Switch(config-if)# channel-protocol lacp +Switch(config-if)# channel-group 1 mode active +Switch(config-if)# lacp port-priority 100 +Switch(config-if)# exit +Switch(config)# interface range gig 1/0/5 – 8 , gig 2/0/5 – 8 +Switch(config-if)# channel-protocol lacp +Switch(config-if)# channel-group 1 mode active + +Notice that interfaces Gigabit Ethernet 1/0/5-8 and 2/0/5-8 have been left to their default port priorities of 32,768. This is higher than the others, which were configured for 100, so they will be held as standby interfaces. + +Avoiding Misconfiguration with EtherChannel Guard + +Once you configure a set of physical interfaces on one switch to participate in an EtherChannel, you should configure the corresponding interfaces on the neighboring switch. Your goal should be to keep the EtherChannel configurations as predictable as possible, so that nothing unexpected can happen, + +What might happen anyway? Suppose that you configure two interfaces on Switch A to form an unconditional EtherChannel that carries all active VLANs. Your associate config-ures Switch B for the same set of two interfaces, but manages to plug the cables into the wrong two interfaces. It is entirely possible that a bridging loop might form over the dual links because an EtherChannel has not formed on both ends. STP will not operate consis-tently on all interfaces because Switch A is expecting a working EtherChannel. + +If you decide to use PAgP or LACP to negotiate an EtherChannel, the chances of a mis-configuration are slim. An EtherChannel will not be built if it cannot be negotiated on all member links on the switches at both ends. + +To reduce the chances of a misconfigured EtherChannel, Cisco Catalyst switches run the EtherChannel Guard feature by default. You can control the feature with the following global configuration command: +Switch(config)# [no] spanning-tree etherchannel guard misconfig + + + +From the Library of Outcast Outcast +256 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Notice that the command is directly related to STP operation over an EtherChannel. If a misconfiguration is detected once the interfaces are enabled, the switch will log the prob-lem and will automatically shut the interfaces down and place them in the errdisable state. + +In Example 10-2, two interfaces should have formed an EtherChannel, but a misconfigu-ration has been detected. Notice that both member interfaces, as well as the port channel 1 EtherChannel interface, have been errdisabled. To see the reason behind this action, you can use the show interfaces status err-disabled command. + +Example 10-2 Detecting EtherChannel Misconfiguration with EtherChannel Guard + +Mar 30 05:02:16.073: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Gi1/0/25, putting Gi1/0/25 in err-disable state +Mar 30 05:02:16.081: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Gi1/0/26, putting Gi1/0/26 in err-disable state +Mar 30 05:02:16.115: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Po1, putting Gi1/0/25 in err-disable state +Mar 30 05:02:16.115: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Po1, putting Gi1/0/26 in err-disable stning-ate +Mar 30 05:02:16.115: %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Po1, putting Po1 in err-disable state +Mar 30 05:02:17.079: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther-net1/0/25, changed state to down +Mar 30 05:02:17.096: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther-net1/0/26, changed state to down +Mar 30 05:02:17.104: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to down +Switch# show interface status err-disabled +Port Name Status Reason Err-disabled Vlans + +Gi1/0/25 +Gi1/0/26 +Po1 +Switch# + +err-disabled channel-misconfig (STP) +err-disabled channel-misconfig (STP) +err-disabled channel-misconfig (STP) + + +To recover from a misconfigured EtherChannel, first review the interface configuration on both switches. After you have corrected the problem, you must shut down the port channel interface and reenable it. The member interfaces will follow suit automatically, as shown in Example 10-3. + +Example 10-3 Reenabling a Misconfigured EtherChannel + +Switch(config)# interface port-channel1 +Switch(config-if)# shutdown +Switch(config-if)# no shutdown +Switch(config-if)# ^Z +Switch# +Mar 30 05:09:21.518: %SYS-5-CONFIG_I: Configured from console by console +Mar 30 05:09:21.719: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/25, changed state to up +Mar 30 05:09:21.736: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/26, changed state to up + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 257 + +Mar 30 05:09:25.536: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther-net1/0/25, changed state to up +Mar 30 05:09:25.544: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEther-net1/0/26, changed state to up +Mar 30 05:09:26.509: %LINK-3-UPDOWN: Interface Port-channel1, changed state to up +Mar 30 05:09:27.516: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up +Switch# + + +Troubleshooting an EtherChannel + +If you find that an EtherChannel is having problems, remember that the whole concept is based on consistent configurations on both ends of the channel. Here are some reminders about EtherChannel operation and interaction: + + +■ Key +Topic +■ + + + +■ + + + +■ + +EtherChannel on mode does not send or receive PAgP or LACP packets. Therefore, both ends should be set to on mode before the channel can form. + +EtherChannel desirable (PAgP) or active (LACP) mode attempts to ask the far end to bring up a channel. Therefore, the other end must be set to either desirable or auto mode. + +EtherChannel auto (PAgP) or passive (LACP) mode participates in the channel proto-col, but only if the far end asks for participation. Therefore, two switches in the auto or passive mode will not form an EtherChannel. + +PAgP desirable and auto modes default to the silent submode, in which no PAgP packets are expected from the far end. If ports are set to non-silent submode, PAgP +packets must be received before a channel will form. + + +First, verify the EtherChannel state with the show etherchannel summary command. Each port in the channel is shown, along with flags indicating the port’s state, as shown in Example 10-4. + +Example 10-4 show etherchannel summary Command Output + +Switch# show etherchannel summary +Flags: D - down P - in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) +R - Layer3 S - Layer2 +u - unsuitable for bundling +U - in use f - failed to allocate aggregator +d - default port +Number of channel-groups in use: 1 +Number of aggregators: 1 + + + + + + +From the Library of Outcast Outcast +258 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Group Port-channel Protocol Ports +------+--------------+-----------+------------------------------------------------ + + +1 Po1(SU) LACP Gi1/0/1(P) +Gi2/0/1(P) + +Gi1/0/2(P) +Gi2/0/2(P) + +Gi1/0/3(D) +Gi2/0/3(P) + +Gi1/0/4(P) +Gi2/0/4(P) + + +The status of the port channel shows the EtherChannel logical interface as a whole. This should show SU (Layer 2 channel, in use) if the channel is operational. You also can examine the status of each port within the channel. Notice that most of the channel ports have flags (P), indicating that they are active in the port-channel. One port shows (D) because it is physically not connected or down. If a port is connected but not bundled in the channel, it will have an independent, or (I), flag. You can verify the channel negotia-tion mode with the show etherchannel port command, as shown in Example 10-5. The local switch interface Gigabit Ethernet 1/0/25 is shown using LACP active mode. Notice that you also verify each end’s negotiation mode under the Flags heading—the local switch as A (active mode) and the partner, or far end switch, as P (passive mode). + +Example 10-5 show etherchannel port Command Output + +Switch# show etherchannel port +Channel-group listing: +---------------------- + +Group: 1 +---------- +Ports in the group: +------------------- +Port: Gi1/0/25 +------------ + +Port state = Up Mstr Assoc In-Bndl +Channel group = 1 Mode = Active Gcchange = - +Port-channel = Po1 GC = - Pseudo port-channel = Po1 +Port index = 0 Load = 0x00 Protocol = LACP + + +Flags: S - Device is sending Slow LACPDUs +A - Device is in active mode. + +F - Device is sending fast LACPDUs. +P - Device is in passive mode. + + +Local information: + + +Port Flags State +Gi1/0/25 SA bndl + +LACP port Admin +Priority Key +32768 0x1 + +Oper Port Port +Key Number State +0x1 0x11A 0x3D + + +Partner's information: + +LACP port Admin Oper Port Port +Port Flags Priority Dev ID Age key Key Number State + + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 259 + +Gi1/0/25 SP 32768 aca0.164e.8280 21s 0x0 0x1 0x21A 0x3C + +Age of the port in the current state: 0d:00h:02m:37s +[output truncated for clarity] + +Within a switch, an EtherChannel cannot form unless each of the component or member ports is configured consistently. Each must have the same switch mode (access or trunk), native VLAN, trunked VLANs, port speed, port duplex mode, and so on. + +You can display a port’s configuration by looking at the show running-config interface type mod/ num output. Also, the show interface type member/module/number ether-channel shows all active EtherChannel parameters for a single port. If you configure a port inconsistently with others for an EtherChannel, you see error messages from the switch. + +Some messages from the switch might look like errors but are part of the normal EtherChannel process. For example, as a new port is configured as a member of an exist-ing EtherChannel, you might see this message: +4d00h: %EC-5-L3DONTBNDL2: GigabitEthernet1/0/11 suspended: +incompatible partner port with GigabitEthernet1/0/10 + +When the port is first added to the EtherChannel, it is incompatible because the STP runs on the channel and the new port. After STP takes the new port through its progression of states, the port is automatically added into the EtherChannel. + +Other messages do indicate a port-compatibility error. In these cases, the cause of the error is shown. For example, the following message announces that Gigabit Ethernet1/0/3 has a different duplex mode than the other ports in the EtherChannel: +4d00h: %EC-5-CANNOT_BUNDLE2: GigabitEthernet1/0/3 is not compatible +with GigabitEthernet1/0/1 and will be suspended (duplex of Gi1/0/3 +is full, Gi1/0/1 is half) + +Finally, you can verify the EtherChannel load-balancing or hashing algorithm with the show etherchannel load-balance command. Remember that the switches on either end of an EtherChannel can have different load-balancing methods. The only drawback to this is that the load balancing will be asymmetric in the two directions across the channel. + +Table 10-5 lists the commands useful for verifying or troubleshooting EtherChannel operation. + +Table 10-5 EtherChannel Troubleshooting Commands + + +Display Function +Current EtherChannel status of each member port + + +Time stamps of EtherChannel changes + +Command Syntax +show etherchannel summary + +show etherchannel port + +show etherchannel port-channel + + + + + +From the Library of Outcast Outcast +260 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Display Function +Detailed status about each EtherChannel component Load-balancing hashing algorithm +Load-balancing port index used by hashing algorithm EtherChannel neighbors on each port +LACP system ID + +Command Syntax show etherchannel detail +show etherchannel load-balance show etherchannel port-channel show { pagp | lacp} neighbor +show lacp sys-id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 10: Aggregating Switch Links 261 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 10-6 lists a reference of these key topics and the page numbers on which each is found. + +Table 10-6 Key Topics for Chapter 10 Key +Topic Key Topic Element Description Page Number + + +Figure 10-2 + +Paragraph + +Table 10-3 + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Illustrates aggregating links into EtherChannels 246 + +Explains how traffic is distributed in an 247 EtherChannel +Lists EtherChannel load-balancing methods 249 + +Describes the PAgP negotiation protocol 252 + +Describes the LACP negotiation protocol 252 + +Explains PAgP configuration 253 + +Explains LACP configuration 254 + +Discusses rules of thumb for proper EtherChannel 257 operation + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +EtherChannel, PAgP, LACP, multichassis EtherChannel, EtherChannel Guard + +Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should be able to remember the basic keywords that are needed. + + +From the Library of Outcast Outcast +262 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +To test your memory of the commands related to EtherChannels, cover the right side of Table 10-7 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. For the skills covered in this chapter, remember that an EtherChannel is called a port channel interface when you are configuring it. When you are displaying information about an EtherChannel, begin the commands with the show etherchannel keywords. + + +Table 10-7 + +Task + + +EtherChannel Configuration Commands + +Command Syntax + + + +Select a load-balancing method for the switch. +Use a PAgP mode on an interface. + + + +Assign the LACP system priority. + +Use an LACP mode on an interface. + + + +Configure EtherChannel Guard + + +port-channel load-balance method + +channel-protocol pagp + +channel-group number mode {on | {{ auto | desirable} [non-silent]}} + +lacp system-priority priority + +channel-protocol lacp + +channel-group number mode { on | passive | active} + +lacp port-priority priority + +[no] spanning-tree etherchannel guard misconfig + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Inter-VLAN Routing: This section discusses how you can use a routing function with a switch to for-ward packets between VLANs. +■ Multilayer Switching with CEF: This section dis-cusses Cisco Express Forwarding (CEF) and how it is implemented on Catalyst switches. CEF forwards or routes packets in hardware at a high throughput. +■ Verifying Multilayer Switching: This section provides a brief summary of the commands that can verify the configuration and operation of inter-VLAN routing, CEF, and fallback bridging. + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 11 + + + + + + +Multilayer Switching + + +Chapter 2, “Switch Operation,” presents a functional overview of how multilayer switch-ing (MLS) is performed at Layers 3 and 4. The actual MLS process can take two forms: inter-VLAN routing and Cisco Express Forwarding (CEF). This chapter expands on multi-layer switch operation by discussing both of these topics in greater detail. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 11-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 11-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Inter-VLAN Routing + +Multilayer Switching with CEF + +Verifying Multilayer Switching + +Questions Covered in This Section +1–5 + +6–10 + +11 + + + +1. Which of the following arrangements can be considered inter-VLAN routing? + +a. One switch, two VLANs, one connection to a router. + +b. One switch, two VLANs, two connections to a router. + +c. Two switches, two VLANs, two connections to a router. + +d. All of these answers are correct. + + + + + + + + + +From the Library of Outcast Outcast +266 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. How many interfaces are needed in a “router-on-a-stick” implementation for inter-VLAN routing among four VLANs? + +a. 1 + +b. 2 + +c. 4 + +d. Cannot be determined + +3. Which of the following commands configures a switch port for Layer 2 operation? + +a. switchport + +b. no switchport + +c. ip address 192.168.199.1 255.255.255.0 + +d. no ip address + +4. Which of the following commands configures a switch port for Layer 3 operation? + +a. switchport + +b. no switchport + +c. ip address 192.168.199.1 255.255.255.0 + +d. no ip address + +5. Which one of the following interfaces is an SVI? + +a. interface fastethernet 0/1 + +b. interface gigabit 0/1 + +c. interface vlan 1 + +d. interface svi 1 + +6. What information must be learned before CEF can forward packets? + +a. The source and destination of the first packet in a traffic flow + +b. The MAC addresses of both the source and destination + +c. The contents of the routing table + +d. The outbound port of the first packet in a flow + +7. Which of the following best defines an adjacency? + +a. Two switches connected by a common link. + +b. Two contiguous routes in the FIB. + +c. Two multilayer switches connected by a common link. + +d. The MAC address of a host is known. + + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 267 + +8. Assume that CEF is active on a switch. What happens to a packet that arrives, but an ICMP redirect must be sent in return? + +a. The packet is switched by CEF and kept intact. + +b. The packet is fragmented by CEF. + +c. The packet is dropped. + +d. The packet is sent to the Layer 3 engine. + +9. Suppose that a host sends a packet to a destination IP address and that the CEF-based switch does not yet have a valid MAC address for the destination. How is the ARP entry (MAC address) of the next-hop destination in the FIB obtained? +a. The sending host must send an ARP request for it. + +b. The Layer 3 forwarding engine (CEF hardware) must send an ARP request for it. + +c. CEF must wait until the Layer 3 engine sends an ARP request for it. + +d. All packets to the destination are dropped. + +10. During a packet rewrite, what happens to the source MAC address? + +a. There is no change. + +b. It is changed to the destination MAC address. + +c. It is changed to the MAC address of the outbound Layer 3 switch interface. + +d. It is changed to the MAC address of the next-hop destination. + +11. What command can you use to view the CEF FIB table contents? + +a. show fib + +b. show ip cef fib + +c. show ip cef + +d. show fib-table + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +268 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + + + + + + + + + + + + + +Key Topic + +Inter-VLAN Routing + +Recall that a Layer 2 network is defined as a broadcast domain. A Layer 2 network can also exist as a VLAN inside one or more switches. VLANs essentially are isolated from each other so that packets in one VLAN cannot cross into another VLAN. + +To transport packets between VLANs, you must use a Layer 3 device. Traditionally, this has been a router’s function. The router must have a physical or logical connection to each VLAN so that it can forward packets between them. This is known as inter-VLAN routing. + +Inter-VLAN routing can be performed by an external router that connects to each of the VLANs on a switch. Separate physical connections can be used, or the router can access each of the VLANs through a single trunk link. Part A of Figure 11-1 illustrates this concept. The external router also can connect to the switch through a single trunk link, carrying all the necessary VLANs, as illustrated in Part B of Figure 11-1. Part B illustrates what commonly is referred to as a “router-on-a-stick” or a “one-armed router” because +the router needs only a single interface to do its job. + + + + + +A + + + + +B + +VLAN 3 + +VLAN 2 + +VLAN 1 + + + +VLANs 1, 2, 3 +Trunk + + + +Inter-VLAN Router + + + + +“Router on a Stick” + + + +VLAN 1 +C VLAN 2 Multilayer Switch +VLAN 3 + +Figure 11-1 Examples of Inter-VLAN Routing Connections + +Finally, Part C of Figure 11-1 shows how the routing and switching functions can be com-bined into one device: a multilayer switch. No external router is needed. + +Types of Interfaces + +Multilayer switches can perform both Layer 2 switching and inter-VLAN routing, as appropriate. Layer 2 switching occurs between interfaces that are assigned to Layer 2 VLANs or Layer 2 trunks. Layer 3 switching can occur between any type of interface, as long as the interface can have a Layer 3 address assigned to it. + + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 269 + + + +Key Topic + +As with a router, a multilayer switch can assign a Layer 3 address to a physical interface. It also can assign a Layer 3 address to a logical interface that represents an entire VLAN. This is known as a switched virtual interface (SVI), sometimes called a switch virtual interface (SVI). Keep in mind that the Layer 3 address you configure becomes the default gateway for any hosts that are connected to the interface or VLAN. The hosts will use +the Layer 3 interface to communicate outside of their local broadcast domains. + + + +Configuring Inter-VLAN Routing + +Inter-VLAN routing first requires that routing be enabled for the Layer 3 protocol. In the case of IP, you would enable IP routing. In addition, you must configure static routes or a dynamic routing protocol. These topics are covered fully in the CCNP ROUTE course. By default, every switch port on most Catalyst switch platforms is a Layer 2 interface, whereas every switch port on a Catalyst 6500 is a Layer 3 interface. If an interface needs to operate in a different mode, you must explicitly configure it. + +An interface is either in Layer 2 or Layer 3 mode, depending on the use of the switchport interface configuration command. You can display a port’s current mode with the follow-ing command: +Switch# show interface type member/module/number switchport + +If the switchport: line in the command output is shown as enabled, the port is in Layer 2 mode. If this line is shown as disabled, as in the following example, the port is in Layer 3 mode: +Switch# show interface gigabitethernet 1/0/1 switchport +Name: Gi1/0/1 +Switchport: Disabled +Switch# + + +Tip Whenever you see the term switch port, think Layer 2. So if the switch port is dis-abled, it must be Layer 3. + + +Figure 11-2 shows how the different types of interface modes can be used within a single switch. + + + + + + + + + + + + +From the Library of Outcast Outcast +270 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +SVI + + + + + +1 + +2 + + + +Layer 3 Port 40 10.30.30.1 255.255.255.0 + + +8 + +9 + +Interface VLAN 11 10.10.10.1 255.255.255.0 + + + + + + + + + + + + +VLAN 20 10.20.20.1 255.255.255.0 +. . +. +Other VLANs + +Multilayer Switch + + + +3 +Layer 2 Ports 4 + + + +48 Layer 2 Trunk Port + + + +10 +Layer 2 Ports 11 + + +Figure 11-2 Catalyst Switch with Various Types of Ports + +Layer 2 Port Configuration + + +Key Topic + +If an interface is in Layer 3 mode and you need to reconfigure it for Layer 2 functionality instead, use the following command sequence: +Switch(config)# interface type member/module/number +Switch(config-if)# switchport + + +The switchport command puts the port in Layer 2 mode. Then you can use other switch-port command keywords to configure trunking, access VLANs, and so on. As displayed in Figure 11-2, several Layer 2 ports exist, each assigned to a specific VLAN. A Layer 2 port also can act as a trunk, transporting multiple Layer 2 VLANs. + + + + +Key Topic + +Layer 3 Port Configuration +Physical switch ports also can operate as Layer 3 interfaces, where a Layer 3 network address is assigned and routing can occur, as shown previously in Figure 11-2. For Layer 3 function-ality, you must explicitly configure switch ports with the following command sequence: +Switch(config)# interface type member/module/number +Switch(config-if)# no switchport +Switch(config-if)# ip address ip-address mask [secondary] + + +The no switchport command takes the port out of Layer 2 operation. You then can assign a network address to the port, as you would to a router interface. + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 271 + + +Tip By default, a Catalyst switch sets aside the appropriate amounts of TCAM space to perform Layer 3 operation for IPv4. If you intend to use IPv6 also, be sure to reconfigure the SDM template with the sdm prefer dual-ipv4-and-ipv6 command. + + +Note Keep in mind that a Layer 3 port assigns a network address to one specific physical interface. If several interfaces are bundled as an EtherChannel, the EtherChannel can also become a Layer 3 port. In that case, the network address is assigned to the port-channel interface—not to the individual physical links within the channel. + + + +SVI Port Configuration + + + + + + + + + + + +Key Topic + +On a multilayer switch, you also can enable Layer 3 functionality for an entire VLAN on the switch. This allows a network address to be assigned to a logical interface—that of the VLAN itself. This is useful when the switch has many ports assigned to a common VLAN, and routing is needed in and out of that VLAN. + +In Figure 11-2, you can see how an IP address is applied to the SVI called VLAN 10. Notice that the SVI itself has no physical connection to the outside world; to reach the outside, VLAN 10 must extend through a Layer 2 port or trunk to the outside. + +The logical Layer 3 interface is known as an SVI. However, when it is configured, it uses the much more intuitive interface name vlan vlan-id, as if the VLAN itself is a physical interface. First, define or identify the VLAN interface; then assign any Layer 3 functional-ity to it with the following configuration commands: +Switch(config)# interface vlan vlan-id +Switch(config-if)# ip address ip-address mask [ secondary] + + +The VLAN must be defined and active on the switch before the SVI can be used. Make sure that the new VLAN interface also is enabled with the no shutdown interface con-figuration command. + + +Note The VLAN and the SVI are configured separately, even though they interoperate. Creating or configuring the SVI does not create or configure the VLAN; you still must define each one independently. +As an example, the following commands show how VLAN 100 is created and then defined as a Layer 3 SVI: +Switch(config)# vlan 100 +Switch(config-vlan)# name Example_VLAN +Switch(config-vlan)# exit +Switch(config)# interface vlan 100 +Switch(config-if)# ip address 192.168.100.1 255.255.255.0 +Switch(config-if)# no shutdown + + + +From the Library of Outcast Outcast +272 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Be aware that an SVI cannot become active until at least one Layer 2 port assigned to the VLAN has also become active and STP has converged. By automatically keeping the SVI down until the VLAN is ready, no other switching or routing functions can attempt to use the SVI prematurely. This function is called SVI autostate. + +You might sometimes want the SVI to stay up even when no Layer 2 ports are active on the VLAN. For example, you might have a Layer 2 port configured for port mirroring to capture traffic. In that case, the port would not be up and functioning normally, so it should be excluded from affecting the state of the SVI. You can exclude a switch port with the following interface configuration command: +Switch(config-if)# switchport autostate exclude + + +Multilayer Switching with CEF + +Catalyst switches can use several methods to forward packets based on Layer 3 and Layer 4 information. The current generation of Catalyst multilayer switches uses the efficient Cisco Express Forwarding (CEF) method. This section describes the evolution of multi-layer switching and discusses CEF in detail. Although CEF is easy to configure and use, the underlying switching mechanisms are more involved and should be understood. + +Traditional MLS Overview + +Multilayer switching began as a dual effort between a route processor (RP) and a switch-ing engine (SE). The basic idea is to “route once and switch many.” The RP receives the first packet of a new traffic flow between two hosts, as usual. A routing decision is made, and the packet is forwarded toward the destination. + +To participate in multilayer switching, the SE must know the identity of each RP. The SE then can listen in to the first packet going to the router and also going away from the router. If the SE can switch the packet in both directions, it can learn a “shortcut path” so that subsequent packets of the same flow can be switched directly to the destination port without passing through the RP. + +This technique also is known as NetFlow switching or route cache switching. Traditionally, NetFlow switching was performed on legacy Cisco hardware, such as the Catalyst 6000 Supervisor 1/1a and Multilayer Switch Feature Card (MSFC), Catalyst 5500 with a Route Switch Module (RSM), Route Switch Feature Card (RSFC), or exter-nal router. Basically, the hardware consisted of an independent RP component and a NetFlow-capable SE component. + +CEF Overview + +NetFlow switching has given way to a more efficient form of multilayer switching: Cisco Express Forwarding. Cisco developed CEF for its line of routers, offering high- perfor-mance packet forwarding through the use of dynamic lookup tables. CEF also has been carried over to the Catalyst switching platforms. CEF runs by default, taking advantage of the specialized hardware. + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 273 + +A CEF-based multilayer switch consists of two basic functional blocks, as shown in Figure 11-3: The Layer 3 engine is involved in building routing information that the Layer 3 forwarding engine can use to switch packets in hardware. + +Layer 3 Engine + + + + +Routing Table + + +Reorder entries according to +longest prefix match. + +FIB + +ARP Table + +Resolve MAC addresses +of each next hop in the FIB. + +Adjacency Table + + + + +CEF Punt (to L3 Engine) + + +Layer 3 Forwarding Engine + +Rewrite Engine + + + +Ingress Packet + + +Figure 11-3 + +Egress Normal CEF Packet +(to L3 Fwd Engine) + +Packet Flow Through a CEF-Based Multilayer Switch + + + +Forwarding Information Base + + + +Key Topic + +The Layer 3 engine (essentially a router) maintains routing information, whether from static routes or dynamic routing protocols. Basically, the routing table is reformatted into an ordered list with the most specific route first, for each IP destination subnet in the table. The new format is called a Forwarding Information Base (FIB) and contains routing or forwarding information that the network prefix can reference. + +In other words, a route to 10.1.0.0/16 might be contained in the FIB along with routes to 10.1.1.0/24 and 10.1.1.128/25, if those exist. Notice that these examples are increasingly more specific subnets, as designated by the longer subnet masks. In the FIB, these would be ordered with the most specific, or longest match, first, followed by less specific sub-nets. When the switch receives a packet, it easily can examine the destination address and find the longest-match destination route entry in the FIB. + +The FIB also contains the next-hop address for each entry. When a longest-match entry is found in the FIB, the Layer 3 next-hop address is found, too. + +You might be surprised to know that the FIB also contains host route (subnet mask 255.255.255.255) entries. These normally are not found in the routing table unless they are advertised or manually configured. Host routes are maintained in the FIB for the most +efficient routing lookup to directly connected or adjacent hosts. + + + + +From the Library of Outcast Outcast +274 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +As with a routing table, the FIB is dynamic in nature. When the Layer 3 engine sees a change in the routing topology, it sends an update to the FIB. Anytime the routing table receives a change to a route prefix or the next-hop address, the FIB receives the same change. Also, if a next-hop address is changed or aged out of the Address Resolution Protocol (ARP) table, the FIB must reflect the same change. + +You can display FIB table entries related to a specific interface or VLAN with the follow-ing form of the show ip cef command: +Switch# show ip cef [type member/module/number | vlan vlan-id] [detail] + +The FIB entries corresponding to the VLAN 101 switched virtual interface might be shown as demonstrated in Example 11-1. + +Example 11-1 Displaying FIB Table Entries for a Specified VLAN + +Switch# show ip cef vlan 101 + +Prefix +10.1.1.0/24 +10.1.1.2/32 +10.1.1.3/32 +Switch# + +Next Hop +attached +10.1.1.2 +10.1.1.3 + +Interface +Vlan101 +Vlan101 +Vlan101 + + +You also can view FIB entries by specifying an IP prefix address and mask, using the fol-lowing form of the show ip cef command: +Switch# show ip cef [prefix-ip prefix-mask] [ longer-prefixes] [ detail] + +The output in Example 11-2 displays any subnet within 10.1.0.0/16 that is known by the switch, regardless of the prefix or mask length. Normally, only an exact match of the IP prefix and mask will be displayed if it exists in the CEF table. To see other longer match entries, you can add the longer-prefixes keyword. + +Example 11-2 Displaying FIB Table Entries for a Specified IP Prefix Address/Mask + +Switch# show ip cef 10.1.0.0 255.255.0.0 longer-prefixes + +Prefix +10.1.1.0/24 +10.1.1.2/32 +10.1.1.3/32 +10.1.2.0/24 +10.1.3.0/26 + +10.1.3.64/26 + +10.1.3.128/26 + +[output omitted] +Switch# + +Next Hop +attached +10.1.1.2 +10.1.1.3 +attached +192.168.1.2 +192.168.1.3 +192.168.1.2 +192.168.1.3 +192.168.1.4 +192.168.1.3 + +Interface +Vlan101 +Vlan101 +Vlan101 +Vlan102 +Vlan99 +Vlan99 +Vlan99 +Vlan99 +Vlan99 +Vlan99 + + + + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 275 + +Notice that the first three entries are the same ones listed in Example 11-1. Other subnets also are displayed, along with their next-hop router addresses and switch interfaces. + +You can add the detail keyword to see more information about each FIB table entry for CEF, as demonstrated in Example 11-3. + +Example 11-3 Displaying Detailed CEF Entry Information + +Switch# show ip cef 10.1.3.0 255.255.255.192 detail +10.1.3.0/26, version 270, epoch 0, per-destination sharing +0 packets, 0 bytes +via 192.168.1.2, Vlan99, 0 dependencies +traffic share 1 +next hop 192.168.1.2, Vlan99 +valid adjacency +via 192.168.1.3, Vlan99, 0 dependencies +traffic share 1 +next hop 192.168.1.3, Vlan99 +valid adjacency +0 packets, 0 bytes switched through the prefix +tmstats: external 0 packets, 0 bytes +internal 0 packets, 0 bytes +Switch# + +The version number describes the number of times the CEF entry has been updated since the table was generated. The epoch number denotes the number of times the CEF table has been flushed and regenerated as a whole. The 10.1.3.0/26 subnet has two next-hop router addresses, so the local switch is using per-destination load sharing between the two routers. + +After the FIB is built, packets can be forwarded along the bottom dashed path in Figure 11-3. This follows the hardware switching process, in which no “expensive” or time-consuming operations are needed. At times, however, a packet cannot be switched in hardware, according to the FIB. Packets then are marked as “CEF punt” and immediately are sent to the Layer 3 engine for further processing, as shown in the top dashed path in Figure 11-3. Some of the conditions that can cause this are as follows: + +■ An entry cannot be located in the FIB. + +■ The FIB table is full. + +■ The IP Time-To-Live (TTL) has expired. + +■ The maximum transmission unit (MTU) is exceeded, and the packet must be fragmented. + +■ An Internet Control Message Protocol (ICMP) redirect is involved. + +■ The encapsulation type is not supported. + +■ Packets are tunneled, requiring a compression or encryption operation. + + + +From the Library of Outcast Outcast +276 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ An access list with the log option is triggered. + +■ A Network Address Translation (NAT) operation must be performed. + +CEF operations can be handled on a single, fixed hardware platform. The FIB is gener-ated and contained centrally in the switch. CEF also can be optimized through the use of specialized forwarding hardware, using the following techniques: + +■ Accelerated CEF (aCEF): CEF is distributed across multiple Layer 3 forwarding engines, typically located on individual line cards in chassis-based Catalyst switches. These engines do not have the capability to store and use the entire FIB, so only +a portion of the FIB is downloaded to them at any time. This functions as an FIB “cache,” containing entries that are likely to be used again. If FIB entries are not found in the cache, requests are sent to the Layer 3 engine for more FIB information. The net result is that CEF is accelerated on the line cards, but not necessarily at a sustained wire-speed rate. +■ Distributed CEF (dCEF): CEF can be distributed completely among multiple Layer 3 forwarding engines for even greater performance. Because the FIB is self- con-tained for complete Layer 3 forwarding, it can be replicated across any number of independent Layer 3 forwarding engines. For example, the Catalyst 6500 has line cards that support dCEF, each with its own FIB table and forwarding engine. A cen-tral Layer 3 engine maintains the routing table and generates the FIB, which is then dynamically downloaded in full to each of the line cards. + + + + + + + + + +Key Topic + +Adjacency Table + +A router normally maintains a routing table containing Layer 3 network and next-hop information, and an ARP table containing Layer 3 to Layer 2 address mapping. These tables are kept independently. + +Recall that the FIB keeps the Layer 3 next-hop address for each entry. To streamline packet forwarding even more, the FIB has corresponding Layer 2 information for every next-hop entry. This portion of the FIB is called the adjacency table, consisting of the MAC addresses of nodes that can be reached in a single Layer 2 hop. + +You can display the adjacency table’s contents with the following command: + +Switch# show adjacency [type member/module/number | vlan vlan-id] [ summary | +detail] + + +As an example, the total number of adjacencies known on each physical or VLAN inter-face can be displayed with the show adjacency summary command, as demonstrated in Example 11-4. + + + + + + + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 277 + +Example 11-4 Displaying the Total Number of Known Adjacencies + +Switch# show adjacency summary +Adjacency Table has 106 adjacencies +Table epoch: 0 (106 entries at this epoch) + +Interface +Vlan99 +Vlan101 +Vlan102 +Vlan103 +Vlan104 +Vlan105 +Switch# + +Adjacency Count +21 +3 +1 +47 +7 +27 + + +Adjacencies are kept for each next-hop router and each host that is connected directly to the local switch. You can see more detailed information about the adjacencies by using the detail keyword, as demonstrated in Example 11-5. + +Example 11-5 Displaying Detailed Information About Adjacencies + +Switch# show adjacency vlan 99 detail +Protocol Interface Address + +IP Vlan99 + + + + + + + + + +IP Vlan99 + +192.168.1.2(5) +0 packets, 0 bytes +epoch 0 +sourced in sev-epoch 0 +Encap length 14 +000A5E45B145000E387D51000800 +L2 destination address byte offset 0 +L2 destination address byte length 6 +Link-type after encap: ip +ARP +192.168.1.3(5) +1 packets, 104 bytes +L2 destination address byte offset 0 +L2 destination address byte length 6 +Link-type after encap: ip +ARP +000CF1C909A0000E387D51000800 +L2 destination address byte offset 0 +L2 destination address byte length 6 +Link-type after encap: ip +ARP + + + + + + + + +From the Library of Outcast Outcast +278 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Notice that the adjacency entries include both the IP address (Layer 3) and the MAC address (Layer 2) of the directly attached host. The MAC address could be shown as the first six octets of the long string of hex digits (as shaded in the previous output) or on a line by itself. The remainder of the string of hex digits contains the MAC address of the Layer 3 engine’s interface (six octets, corresponding to the Vlan99 interface in the exam-ple) and the EtherType value (two octets, where 0800 denotes IP). + +The adjacency table information is built from the ARP table. Example 11-5 shows adja-cency with the age of its ARP entry. As a next-hop address receives a valid ARP entry, the adjacency table is updated. If an ARP entry does not exist, the FIB entry is marked as “CEF glean.” This means that the Layer 3 forwarding engine cannot forward the packet +in hardware because of the missing Layer 2 next-hop address. The packet is sent to the Layer 3 engine so that it can generate an ARP request and receive an ARP reply. This is known as the CEF glean state, in which the Layer 3 engine must glean the next-hop des-tination’s MAC address. + +The glean state can be demonstrated in several ways, as demonstrated in Example 11-6. + +Example 11-6 Displaying Adjacencies in the CEF Glean State + +Switch# show ip cef adjacency glean + +Prefix +10.1.1.2/32 +127.0.0.0/8 +[output omitted] + +Next Hop +attached +attached + +Interface +Vlan101 +EOBC0/0 + +Switch# show ip arp 10.1.1.2 +Switch# show ip cef 10.1.1.2 255.255.255.255 detail +10.1.1.2/32, version 688, epoch 0, attached, connected +0 packets, 0 bytes +via Vlan101, 0 dependencies +valid glean adjacency +Switch# + +Notice that the FIB entry for directly connected host 10.1.1.2/32 is present but listed in the glean state. The show ip arp command shows that there is no valid ARP entry for the IP address. +During the time that an FIB entry is in the CEF glean state waiting for the ARP resolu-tion, subsequent packets to that host are immediately dropped so that the input queues do not fill and the Layer 3 engine does not become too busy worrying about the need for duplicate ARP requests. This is called ARP throttling or throttling adjacency. If an ARP reply is not received in 2 seconds, the throttling is released so that another ARP request can be triggered. Otherwise, after an ARP reply is received, the throttling is released, the FIB entry can be completed, and packets can be forwarded completely in hardware. +The adjacency table also can contain other types of entries so that packets can be han-dled efficiently. For example, you might see the following adjacency types listed: + +■ Null adjacency: Used to switch packets destined for the null interface. The null interface always is defined on a router or switch; it represents a logical interface that silently absorbs packets without actually forwarding them. + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 279 + +■ Drop adjacency: Used to switch packets that cannot be forwarded normally. In effect, these packets are dropped without being forwarded. Packets can be dropped because of an encapsulation failure, an unresolved address, an unsupported proto-col, no valid route present, no valid adjacency, or a checksum error. You can gauge drop adjacency activity with the following command: +Switch# show cef drop +CEF Drop Statistics +Slot Encap_fail Unresolved Unsupported No_route No_adj ChkSum_Err +RP 8799327 1 45827 5089667 32 0 +Switch# +■ Discard adjacency: Used when packets must be discarded because of an access list or other policy action. + +■ Punt adjacency: Used when packets must be sent to the Layer 3 engine for further processing. You can gauge the CEF punt activity by looking at the various punt adja-cency reasons listed by the show cef not-cef-switched command: + +Switch# show cef not-cef-switched +CEF Packets passed on to next switching layer +Slot No_adj No_encap Unsupp'ted Redirect Receive Options Access Frag +RP 3579706 0 0 0 41258564 0 0 0 +Switch# +The reasons shown are as follows: + +■ No_adj: An incomplete adjacency + +■ No_encap: An incomplete ARP resolution + +■ Unsupp’ted: Unsupported packet features + +■ Redirect: ICMP redirect + +■ Receive: Layer 3 engine interfaces; includes packets destined for IP addresses that are assigned to interfaces on the Layer 3 engine, IP network addresses, and IP broad-cast addresses +■ Options: IP options present + +■ Access: Access list evaluation failure + +■ Frag: Fragmentation failure + + +Packet Rewrite + +When a multilayer switch finds valid entries in the FIB and adjacency tables, a packet is almost ready to be forwarded. One step remains: The packet header information must be rewritten. Keep in mind that multilayer switching occurs as quick table lookups to find the next-hop address and the outbound switch port. The packet is untouched and still has the original destination MAC address of the switch itself. The IP header also must be adjusted, as if a traditional router had done the forwarding. + + + +From the Library of Outcast Outcast +280 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The switch has an additional functional block that performs a packet rewrite in real time. The packet rewrite engine (shown in Figure 11-3) makes the following changes to the packet just before forwarding: + +■ Layer 2 destination address: Changed to the next-hop device’s MAC address Key +Topic ■ Layer 2 source address : Changed to the outbound Layer 3 switch interface’s MAC +address + +■ Layer 3 IP TTL : Decremented by one because one router hop has just occurred + +■ Layer 3 IP checksum : Recalculated to include changes to the IP header + +■ Layer 2 frame checksum: Recalculated to include changes to the Layer 2 and Layer 3 headers + +A traditional router normally would make the same changes to each packet. The multi-layer switch must act as if a traditional router were being used, making identical changes. However, the multilayer switch can do this very efficiently with dedicated packet-rewrite hardware and address information obtained from table lookups. + +Configuring CEF + +CEF is enabled on all CEF-capable Catalyst switches by default. In fact, many switches run CEF inherently, so CEF never can be disabled. + + +Tip Switches such as the Catalyst 3750 and 4500 run CEF by default, but you can disable CEF on a per-interface basis. You can use the no ip route-cache cef and no ip cef interface configuration commands to disable CEF on the Catalyst 3750 and 4500, respectively. +You should always keep CEF enabled whenever possible, except when you need to disable it for debugging purposes. + + +Verifying Multilayer Switching + +The multilayer switching topics presented in this chapter are not difficult to configure; however, you might need to verify how a switch is forwarding packets. In particular, the following sections discuss the commands that you can use to verify the operation of inter-VLAN routing and CEF. + +Verifying Inter-VLAN Routing + +To verify the configuration of a Layer 2 port, you can use the following EXEC command: + +Switch# show interface type member/module/number switchport + +The output from this command displays the access VLAN or the trunking mode and native VLAN. The administrative modes reflect what has been configured for the port, whereas the operational modes show the port’s active status. + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 281 + +You can use this same command to verify the configuration of a Layer 3 or routed port. In this case, you should see the switchport (Layer 2) mode disabled, as in Example 11-7. + +Example 11-7 Verifying Configuration of a Layer 3 Switch Port + +Switch# show interface gigabitethernet 1/0/1 switchport +Name: Gi1/0/1 +Switchport: Disabled +Switch# + +To verify the configuration of an SVI, you can use the following EXEC command: + +Switch# show interface vlan vlan-id + +The VLAN interface should be up, with the line protocol also up. If this is not true, either the interface is disabled with the shutdown command, the VLAN itself has not been defined on the switch, or there are no active Layer 2 switch interfaces configured to use the VLAN. Use the show vlan command to see a list of configured VLANs. + +Example 11-8 shows the output produced from the show vlan command. Notice that each defined VLAN is shown, along with the switch ports that are assigned to it. + +Example 11-8 Displaying a List of Configured VLANs + +Switch# show vlan + +VLAN Name Status Ports +---- ---------------------------------- ----------- ------------------------------ + +1 default + + + + + + + + +2 VLAN0002 +5 VLAN0005 +10 VLAN0010 +11 VLAN0011 +12 VLAN0012 +99 VLAN0099 + +active Gi1/0/1, Gi1/0/2, Gi1/0/3 +Gi1/0/4, Gi1/0/5, Gi1/0/6 +Gi1/0/7, Gi1/0/8, Gi1/0/9 +Gi1/0/10, Gi1/0/11, Gi1/0/12 +Gi1/0/13, Gi1/0/14, Gi1/0/15 +Gi1/0/16, Gi1/0/17, Gi1/0/18 +Gi1/0/19, Gi1/0/20, Gi1/0/21 +Gi1/0/25, Gi1/0/26, Te1/0/1 +Te1/0/2 +active Gi1/0/22 +active +active +active Gi1/0/23 +active +active Gi1/0/24 + +Switch# + +You also can display the IP-related information about a switch interface with the show ip interface command, as demonstrated in Example 11-9. + + + + + +From the Library of Outcast Outcast +282 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 11-9 Displaying IP-Related Information About a Switch Interface + +Switch# show ip interface vlan 101 +Vlan101 is up, line protocol is up +Internet address is 10.1.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are always sent +ICMP unreachables are always sent +ICMP mask replies are never sent +IP fast switching is enabled +IP fast switching on the same interface is disabled +IP Flow switching is disabled +IP CEF switching is enabled +IP Feature Fast switching turbo vector +IP Feature CEF switching turbo vector +IP multicast fast switching is enabled +IP multicast distributed fast switching is disabled +IP route-cache flags are Fast, Distributed, CEF +Router Discovery is disabled +IP output packet accounting is disabled +IP access violation accounting is disabled +TCP/IP header compression is disabled +RTP/IP header compression is disabled +Probe proxy name replies are disabled +Policy routing is disabled +Network address translation is disabled +WCCP Redirect outbound is disabled +WCCP Redirect inbound is disabled +WCCP Redirect exclude is disabled +BGP Policy Mapping is disabled +Sampled Netflow is disabled +IP multicast multilayer switching is disabled +Switch# + +You can use the show ip interface brief command to see a summary listing of the Layer 3 interfaces involved in routing IP traffic, as demonstrated in Example 11-10. + + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 283 + +Example 11-10 Displaying a Summary Listing of Interfaces Routing IP Traffic + +Switch# show ip interface brief +Interface IP-Address OK? Method Status Protocol +Vlan1 unassigned YES NVRAM administratively down down + +Vlan54 +Vlan101 +GigabitEthernet1/0/10 +[output omitted] +Switch# + +10.3.1.6 +10.1.1.1 +10.1.5.1 + +YES manual up up +YES manual up up +YES manual up up + + + +Verifying CEF + +CEF operation depends on the correct routing information being generated and down-loaded to the Layer 3 forwarding engine hardware. This information is contained in the FIB and is maintained dynamically. To view the entire FIB, use the following EXEC command: +Switch# show ip cef + +Example 11-11 shows sample output from this command. + +Example 11-11 Displaying the FIB Contents for a Switch + +Switch# show ip cef + +Prefix +0.0.0.0/32 +192.168.199.0/24 +192.168.199.0/32 +192.168.199.1/32 +192.168.199.2/32 +192.168.199.255/32 +Switch# + +Next Hop +receive +attached +receive +receive +192.168.199.2 +receive + +Interface + +Vlan1 + + +Vlan1 + + +On this switch, only VLAN 1 has been configured with the IP address 192.168.199.1 255.255.255.0. Notice several things about the FIB for such a small configuration: + +■ 0.0.0.0/32 : An FIB entry has been reserved for the default route. No next hop is defined, so the entry is marked “receive” so that packets will be sent to the Layer 3 engine for further processing. +■ 192.168.199.0/24: The subnet assigned to the VLAN 1 interface is given its own entry. This is marked “attached” because it is connected directly to an SVI, VLAN 1. + +■ 192.168.199.0/32 : An FIB entry has been reserved for the exact network address. This is used to contain an adjacency for packets sent to the network address, if the network is not directly connected. In this case, there is no adjacency, and the entry is marked “receive.” + + + + +From the Library of Outcast Outcast +284 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ 192.168.199.1/32: An entry has been reserved for the VLAN 1 SVI’s IP address. Notice that this is a host route (/32). Packets destined for the VLAN 1 interface must be dealt with internally, so the entry is marked “receive.” +■ 192.168.199.2/32: This is an entry for a neighboring multilayer switch, found on the VLAN 1 interface. The Next Hop field has been filled in with the same IP address, denoting that an adjacency is available. +■ 192.168.199.255/32: An FIB entry has been reserved for the 192.168.199.0 subnet’s broadcast address. The route processor (Layer 3 engine) handles all directed broad-casts, so the entry is marked “receive.” + +To see complete FIB table information for a specific interface, use the following EXEC command: +Switch# show ip cef type member/module/number [detail] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 11: Multilayer Switching 285 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 11-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 11-2 Key Topics for Chapter 11 +Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +List + +Describes inter-VLAN routing 268 + +Describes SVIs 269 + +Explains Layer 2 interface mode configuration 270 + +Explains Layer 3 interface mode configuration 270 + +Explains how to configure an SVI 271 + +Discusses the FIB and its contents 273 + +Explains the CEF adjacency table 276 + +Explains which IP packet fields are changed during 280 the packet rewrite process + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +inter-VLAN routing, SVI, FIB, adjacency table, packet rewrite + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should be able to remember the basic keywords that are needed. + +To test your memory of the inter-VLAN routing and CEF configuration and verification commands, use a piece of paper to cover the right side of Tables 11-3 and 11-4, respec-tively. Read the description on the left side, and then see how much of the command you + + + +From the Library of Outcast Outcast +286 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +can remember. Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. + + +Table 11-3 + +Task + + +Inter-VLAN Routing Configuration Commands + +Command Syntax + + + +Put a port into Layer 2 mode. + +Put a port into Layer 3 mode. + +Define an SVI. + +Switch(config-if)# switchport + +Switch(config-if)# no switchport + +Switch(config)# interface vlan vlan-id + + + + + +Table 11-4 + +Task + + +Multilayer Switching Verification Commands + +Command Syntax + + + +Show a Layer 2 port status. + +Show a Layer 3 port status. + +Show an SVI status. + +View the FIB contents. + +View FIB information for an interface. + +View FIB information for an IP prefix. + +View FIB adjacency information. + + +Switch# show interface type member/ module/number switchport + +Switch# show interface type member/ module/number + +Switch# show interface vlan vlan-id + +Switch# show ip cef + +Switch# show ip cef [type member/ module/number | vlan vlan-id] [detail] + +Switch# show ip cef [prefix-ip prefix-mask] [longer-prefixes] [detail ] + +Switch# show adjacency [type member/ module/number | vlan vlan-id] [summary | detail] + +View counters for packets not switched by CEF. Switch# show cef not-cef-switched + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Configuring an IPv4 DHCP Server: This section covers the basic configuration needed to make a switch act as a DHCP server or as a DHCP relay so that IPv4 hosts can request addresses and learn their local default gateway addresses and other necessary information. +■ Configuring DHCP to Support IPv6: This section discusses several mechanisms that hosts can use +to obtain IPv6 addresses and other network information. + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 12 + + + + + + +Configuring DHCP + + +This chapter explains how a multilayer switch can be configured as a Dynamic Host Configuration Protocol (DHCP) server or relay to supply IP addressing information to cli-ent devices. Both IPv4 and IPv6 addressing services are discussed. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 12-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 12-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Configuring an IPv4 DHCP Server + +Configuring DHCP to Support IPv6 + +Questions Covered in This Section +1-5 + +6-8 + + + +1. If a DHCP scope is configured on a Catalyst switch, which one of the following must also be configured so that the switch becomes a DHCP server for client machines connected to VLAN 3? +a. A corresponding ip dhcp server command configured on interface VLAN 3 + +b. A corresponding IP address configured on interface VLAN 3 + +c. An ip helper-address command configured on interface VLAN 3 + +d. A switch cannot operate as a DHCP server + + + + + + + + + +From the Library of Outcast Outcast +290 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. Which one of the following commands can be used to prevent IP addresses 192.168.16.10 through 192.168.16.30 from being assigned by the DHCP server run-ning on a switch? +a. ip dhcp reserve-address 192.168.16.10 – 192.168.16.30 + +b. ip dhcp pool users + +no network 192.168.16.10 192.168.16.30 + +c. ip dhcp excluded-address 192.168.16.10 192.168.16.30 + +d. ip dhcp pool users + +no lease 192.168.16.10 192.168.16.30 + +3. To configure a manual DHCP binding for two different IP addresses, which one of the following approaches should you take? + +a. Define two DHCP pools that contain a single host address each. + +b. Define a DHCP pool that contains the network of the host addresses. + +c. Enter two ip dhcp excluded-address commands to configure the host addresses. + +d. Define one DHCP pool that contains a host command for each host address binding. + +4. Which one of the following answers represents configuration commands needed to implement a DHCP relay function? + +a. interface vlan 5 + +ip address 10.1.1.1 255.255.255.0 + +ip helper-address 10.1.1.10 + +b. interface vlan 5 + +ip address 10.1.1.1 255.255.255.0 + +ip dhcp-relay + +c. ip dhcp pool staff + +network 10.1.1.0 255.255.255.0 + +default-router 10.1.1.1 + +exit + +d. hostname Switch + +ip helper-address 10.1.1.10 + + + + + + +From the Library of Outcast Outcast +Chapter 12: Configuring DHCP 291 + +5. Which one of the following commands can be used to display IPv4 addresses that have been assigned through the DHCP server on a switch? + +a. show ip dhcp pool + +b. show ip dhcp clients + +c. show ip dhcp binding + +d. show ip dhcp leases + +6. Which one of the following forms of IPv6 address does a host use to discover its local router? + +a. CDPv6 + +b. ICMPv6 + +c. Stateless address + +d. Link-local address + +7. Without a DHCP server available, which one of the following represents a valid method for a host to obtain a unique IPv6 address? + +a. The local switch interface will assign one, provided it has an IPv6 address configured + +b. Stateless autoconfiguration + +c. DHCP relay + +d. Link-local address proxy + +8. To exclude specific IPv6 addresses from being handed out by a DHCPv6 server configured on a Catalyst switch, which one of the following describes the correct strategy? +a. Enter the ip dhcp excluded-address command along with the IPv6 addresses to exclude. + +b. Enter the no address prefix ipv6-address command as part of the DHCPv6 pool configuration. + +c. Define a separate DHCPv6 pool for each excluded address. + +d. None of these answers; you cannot exclude addresses with DHCPv6. + + + + + + + + + + + +From the Library of Outcast Outcast +292 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +Using DHCP with a Multilayer Switch + +When a switch is configured with a Layer 3 address on an interface, it becomes the router or default gateway that connected hosts will use to send traffic to and from their local VLAN or subnet. How do those hosts know to use the Layer 3 interface as their default gateway? As well, how do those hosts know what IP address to use for their own identities? + +Hosts can be manually configured to use a static IP address, subnet mask, default gate-way address, and so on. That might be appropriate for some devices, such as servers, which would need stable and reserved addresses. For the majority of end user devices, static address assignment can become a huge administrative chore. + +Instead, the Dynamic Host Configuration Protocol (DHCP) is usually leveraged to pro-vide a means for dynamic address assignment to any host that can use the protocol. DHCP is defined in RFC 2131 and is built around a client/server model: Hosts requesting IP addresses use a DHCP client, and address assignment is handled by a DHCP server. + +Suppose a host connects to the network, but does not yet have an IP address. It needs to request an address via DHCP. How can it send a packet to a DHCP server without having a valid IP address to use as a source address? The answer lies in the DHCP negotiation, which plays out in the following four steps: + +1. +Key Topic + + +2. + + + + + + + +3. + + + + + + +4. + + +The client sends a “DHCP Discover” message as a broadcast: Even without a valid source address, the client can send to the broadcast address to find any DHCP server that might be listening. The client’s MAC address is included in the broadcast message. + +A DHCP server replies with a “DHCP Offer” message: The offer contains an offer for the use of an IP address, subnet mask, default gateway, and some parameters for using the IP address. + +The server also includes its own IP address to identify who is making the offer. (There could be multiple addresses offered, if more than one DHCP server received the broadcast DHCP Discover message.) Because the client does not yet have a valid IP address, the server must broadcast the offer so the client can receive it. + +The client sends a “DHCP Request” message: When it is satisfied with a DHCP offer, the client formally requests use of the offered address. A record of the offer is included so that only the server that sent the offer will set aside the requested IP address. Again, the request is sent as a broadcast as a public announcement to any other servers that may have responded, and because the client hasn’t officially start-ed using a valid address. + +The DHCP server replies with a “DHCP ACK” message: The IP address and all parameters for its use are returned to the client as formal approval to begin using the +address. The ACK message is sent as a unicast, but may be broadcast instead. + + + +From the Library of Outcast Outcast +Chapter 12: Configuring DHCP 293 + +Because DHCP is a dynamic mechanism, IP addresses are offered on a leased basis. Before the offered lease time expires, the client must try to renew its address; otherwise, that address may be offered up to a different client. + +Notice that DHCP is designed to work within a broadcast domain. Most of the messages in a DHCP exchange are sent as broadcasts. On this basis, the DHCP server would need to be located in the same broadcast domain as the client. In this scenario, you might have a dedicated DHCP server connected to the network and located in the same VLAN as the client. You can also configure a multilayer switch to operate as a DHCP server if you have configured a Layer 3 address on the switch interface or SVI where the client is located. + +This design would require one DHCP server for each broadcast domain or VLAN on the network—something that is not always practical at all! You can get around this require-ment by configuring a multilayer switch to relay the DHCP negotiation across VLAN boundaries. + +The following sections explain how to configure a DHCP server on a multilayer switch within a VLAN and how to configure DHCP relay between VLANs. + +Configuring an IPv4 DHCP Server + + + + + + + + + + + +Key Topic + +First, configure a Layer 3 address on a switch interface so that the switch can participate in IP-related activities. Then you can configure a DHCP server that runs natively on the switch itself. You can configure a pool of addresses that are offered by the DHCP server, as well as addresses that are reserved or manually assigned. In all of those cases, the DHCP server address scope must correlate with a Layer 3 IP subnet that is configured on a switch interface. The switch will then intercept DHCP broadcast packets from client machines within a VLAN. Use the following command sequence to configure a DHCP server: +Switch(config)# ip dhcp excluded-address start-ip end-ip +Switch(config)# ip dhcp pool pool-name +Switch(config-dhcp)# network ip-address subnet-mask +Switch(config-dhcp)# default-router ip-address [ip-address2] [ip-address3] ... +Switch(config-dhcp)# lease {infinite | {days [hours [minutes]]}} +Switch(config-dhcp)# exit + + +If some addresses within the IP subnet should be reserved and not offered to clients, use the ip dhcp excluded-address command. You can define a range of addresses or a single address to be excluded. You do not have to worry about excluding the addresses used by a switch interface or a broadcast address; the switch automatically excludes those. + +The ip dhcp pool command uses a text string pool-name to define the pool or scope of addresses that will be offered. The network command identifies the IP subnet and subnet mask of the address range. The subnet should be identical to the one configured on the Layer 3 interface. In fact, the switch uses the network command to bind its DHCP server to the matching Layer 3 interface. By definition, the network and broadcast addresses +for the subnet won’t be offered to any client. The default-router command identifies the default router address that will be offered to clients. Generally, the default router should be the IP address of the corresponding Layer 3 interface on the switch. + + +From the Library of Outcast Outcast +294 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Finally, you can set the IP address lease duration with the lease command. By default, leases are offered with a 1 day limit. + +In Example 12-1, a DHCP scope for the 192.168.1.0/24 subnet has been configured. Addresses 192.168.1.2 through 192.168.1.5 are excluded to preserve them for future use. + +Example 12-1 Configuring a DHCP Server with a Pool of Addresses + +Switch(config)# interface vlan10 +Switch(config-if)# ip address 192.168.1.1 255.255.255.0 +Switch(config-if)# no shutdown +Switch(config-if)# exit +Switch(config)# ip dhcp excluded-address 192.168.1.2 192.168.1.5 +Switch(config)# ip dhcp pool Users +Switch(dhcp-config)# network 192.168.1.0 255.255.255.0 +Switch(dhcp-config)# default-router 192.168.1.1 +Switch(dhcp-config)# exit + +You can monitor the DHCP server address leases with the show ip dhcp binding com-mand. Example 12-2 lists three IP addresses that have been assigned by the DHCP server configured in Example 12-1. + +Example 12-2 Displaying Current DHCP Server Address Assignments + +Switch# show ip dhcp binding +Bindings from all pools not associated with VRF: + +IP address + + +192.168.1.2 +192.168.1.3 +192.168.1.4 +Switch# + +Client-ID/ +Hardware address/ +User name +0100.50b6.5bc0.b5 +010c.8bfd.752e.c4 +010e.8bfd.752e.c0 + +Lease expiration + + +Aug 31 2014 01:57 AM +Aug 30 2014 12:03 AM +Aug 30 2011 08:03 PM + +Type + + +Automatic +Automatic +Automatic + + +An address lease is normally released or cleared by the client that is using it. In some cases, you may need to clear an address binding manually with the following command. You can enter a specific IP address to be cleared or an asterisk to clear all address bindings. +Switch# clear ip dhcp binding {* | ip-address} + + +Configuring a Manual Address Binding + +Not all clients and applications can operate with an IP address that might change over time because of the dynamic nature of DHCP address assignments. If a device requires an IP address that will always be assigned to it, you can configure a manual address bind-ing on the DHCP server. + + + + +From the Library of Outcast Outcast +Chapter 12: Configuring DHCP 295 + +Define a manual binding just as you would a regular DHCP pool. The difference is that the manual binding “pool” consists of one IP address that you configure with the host ip-address subnet-mask command. When a client requests an address, it can be identified by its client identifier (DHCP requests) or its hardware MAC address (BOOTP requests), configured with the client-identifier or hardware-address commands, respectively. + +Sometimes it can be difficult to know how to enter the appropriate client information in a manual binding. For example, you should use the client-identifier command for cli-ents that request an address through DHCP. The client identifier is a string of hex digits arranged in groups of four, separated by dots. Typical identifier strings are shown in the +list of address bindings in Example 12-2. Notice how they appear to be MAC addresses, but end with an extra pair of hex digits. + +Client identifiers commonly consist of the digits 01 followed by the client’s MAC address. The 01 prefix, indicating that the client uses Ethernet, causes the dotted hex notation to appear shifted from the familiar form. In some cases, the client might send a different identifier string in its DHCP requests. If you find that the client does not pick up the address you are expecting (or none at all), you can use the debug ip dhcp server command to display detailed information about the client’s request. + +In Example 12-3, a manual address binding is configured for the client, so that it always receives IP address 192.168.1.99. The debug output displays the client MAC address (0050.b65b.c0b5) and its client identifier (0100.50b6.5bc0.b5). + +Example 12-3 Finding a Client Identifier and Configuring a Manual Binding + +Switch(config)# ip dhcp pool my-pc +Switch(dhcp-config)# host 192.168.1.99 255.255.255.0 +Switch(dhcp-config)# client-identifier 0100.50b6.5bc0.b5 +Switch(dhcp-config)# exit +Switch(config)# exit + +Switch# debug ip dhcp server +Mar 31 02:40:35.528: DHCPD: Sending notification of DISCOVER: + +Mar 31 02:40:35.528: +Mar 31 02:40:35.528: +Mar 31 02:40:35.528: +Mar 31 02:40:35.528: + +DHCPD: htype 1 chaddr 0050.b65b.c0b5 +DHCPD: interface = Vlan1 +DHCPD: class id 4d53465420352e30 +DHCPD: out_vlan_id 0 + +Mar 31 02:40:37.541: DHCPD: assigned IP address 192.168.1.99 to client 0100.50b6.5bc0.b5. (2069 0) +Mar 31 02:40:37.541: DHCPD: DHCPOFFER notify setup address 192.168.1.99 mask 255.255.255.0 +Mar 31 02:40:37.541: DHCPD: Sending notification of ASSIGNMENT: + +Mar 31 02:40:37.541: +Mar 31 02:40:37.541: +Mar 31 02:40:37.541: +Mar 31 02:40:37.541: +Mar 31 02:40:37.541: + +DHCPD: address 192.168.1.99 mask 255.255.255.0 +DHCPD: htype 1 chaddr 0050.b65b.c0b5 +DHCPD: lease time remaining (secs) = 86400 +DHCPD: interface = Vlan1 +DHCPD: out_vlan_id 0 + + + + + +From the Library of Outcast Outcast +296 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Configuring DHCP Options + +Client devices sometimes need more information beyond the basic set of IP address, subnet mask, gateway address, and lease time. Depending on the nature of the device, it might also need some bootstrap information so that it can find the address of a machine offering a needed service. You can accomplish this by specifying DHCP options as part of the DHCP server configuration. + +You can configure a DHCP option in a DHCP pool with the following command: + +Switch(dhcp-config)# option option-num value + +The option-num parameter is the decimal number of a predefined DHCP option. Table 12-2 lists some common options and their functions. The option value can be one or more IP addresses, a string of hex digits, or other value. + +Key Table 12-2 Common DHCP Options Topic Option Number Function + +43 Location of a wireless LAN controller for lightweight wireless access points +69 Location of an SMTP server + +70 Location of a POP3 mail server + +150 Location of a TFTP server for Cisco IP phones + + +Tip Many more commands are available for configuring the DHCP server. For the CCNP SWITCH exam, try to keep things simple and know the basic structure of DHCP pool con-figuration, as previously shown. + + + + + + +Key Topic + +Configuring a DHCP Relay + +In a large network, you may encounter a DHCP server that is centrally located, rather than distributed on individual switches. In that case, you can configure the multilayer switch to relay DHCP messages between clients and the server, even if they are located on different VLANs or subnets. + +First, configure a Layer 3 interface that is bound to the same VLAN as the client machines. This interface can be the default gateway for the clients and can act as a DHCP relay. Next, use the ip helper-address interface configuration command to identify the IP address of the actual DHCP server, as in the following example: +Switch(config)# interface vlan5 +Switch(config-if)# ip address 192.168.1.1 255.255.255.0 +Switch(config-if)# ip helper-address 192.168.199.4 +Switch(config-if)# exit + + + + +From the Library of Outcast Outcast +Chapter 12: Configuring DHCP 297 + +As a DHCP relay, the switch will intercept the broadcast DHCP messages from the client and will forward them on to the server address as unicast messages. The switch keeps track of the subnet where the client messages arrived so that it can relay the DHCP server responses back appropriately. + +You can configure more than one helper address by repeating the ip helper-address com-mand with different addresses. In this case, the switch will relay each DHCP request from a client to each of the helper addresses simultaneously. If more than one server replies, each reply will be relayed back to the client and the client will have to choose one accept-able response. + +Configuring DHCP to Support IPv6 + +In addition to traditional IPv4, Cisco Catalyst switches can support IPv6 addressing and routing, as well as DHCP services. IPv6 topics are normally covered in the Cisco CCNP ROUTE course and exam, but you might find DHCP support in the SWITCH course and exam. + +As a quick review, recall that IPv4 addresses use 32 bits while IPv6 uses 128 bits. IPv6 leverages a vastly increased address space, removing the need for address translation within enterprise networks. In fact, IPv6 addresses are inherently globally unique. + +IPv6 offers some very efficient and convenient mechanisms for devices to use when they join a network. By discovering a local IPv6 router, a device can learn about which address prefix to use and can generate its own globally unique address. To discover a neighboring router, the device can use a special link-local address. + +Link-local addresses always begin with the IPv6 prefix FE80::/10. A device then appends its own interface identifier, which includes the MAC address. Even though the link-local address might seem unique, devices must always go through a duplicate address detection process to see if any other device might be using the same address. If the address proves to be unique, then a device can begin to discover any local routers that are connected to the local network segment. The link-local address provides a means to come online and learn about the Layer 3 surroundings—with very little intervention. + +The ultimate goal for any IPv6 device joining a network is to find a globally unique address that it can use to communicate outside of the local link. In the IPv4 world, this can be done through static IP address configuration or dynamically through DHCP. IPv6 is somewhat different; a device can be configured with a static IPv6 address or it can obtain an address dynamically, but not normally through DHCP. The following sections describe the mechanisms that can be used to provide IPv6 addresses and parameters. + + +Tip Remember that IPv6 addresses are always 128 bits long, represented by eight groups of four hex digits that are separated by colons. Leading 0s do not have to be shown. To shorten the address notation, you can replace one long string of consecutive 0s with a double colon. For example, the full address 3000:A120:000B:0000:0000:0000:0000:0021 can be rewritten as 3000:A120:B::21. + + + +From the Library of Outcast Outcast +298 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Key Stateless Autoconfiguration +Topic A client can create a globally unique address by combining information advertised from +a router with information from the client’s own network adapter. The router provides 64 bits from the Layer 3 subnet prefix, while the client appends a 64-bit EUI-64 interface ID. The interface ID consists of the upper half of the interface’s MAC address (24 bits), fol-lowed by the hex string FFFE (16 bits), followed by the lower half of the MAC address (24 bits). + +As a result, a client can quickly join a network with a unique unicast IPv6 address with little intervention. The client can also pick up other necessary information from the router, like the default router address and the maximum transmission unit (MTU). Router advertisements are sent periodically or the client can request one on-demand to reduce the wait time. + +This process is called stateless autoconfiguration or serverless client configuration. IPv6 addresses are determined on the fly, with no dependence upon a DHCP server at all, which greatly simplifies the client configuration. All of the necessary addressing information is found on the local IPv6 router, which is also very easy to configure. After you have identified a Layer 3 interface on a switch, configure an IPv6 address prefix on it with the ipv6 address interface configuration command. In Example 12-4, the VLAN 5 switch virtual interface (SVI) has been configured with IPv6 prefix 2001:db8a:00 0a:0000:0000:0000:0001. + +Example 12-4 Configuring a Layer 3 Interface for IPv6 Stateless Autoconfiguration + +Switch(config)# interface vlan 5 +Switch(config-if)# ipv6 address 2001:db8:a::1/64 +Switch(config-if)# no shutdown + + + + + + + + + + + + + + +Key Topic + +DHCPv6 + +Notice that stateless autoconfiguration provides only the most basic information a client needs to communicate: an IPv6 address, the IPv6 prefix, and the default router address. To get anything more, such as a domain name, DNS server address, and so on, a client must depend on a DHCP server. + +Catalyst switches can function as a DHCPv6 server, which is compatible with IPv6. In order to use DHCPv6, clients must determine whether the service is available. Routers can indicate that DHCPv6 is offered in their router advertisements or a client can send a request asking for the service. + +To configure DHCPv6, begin by defining an IPv6 address pool with the following global configuration command: +Switch(config)# ipv6 dhcp pool pool-name + + +If you intend for the DHCPv6 server to assign IPv6 addresses to client machines, specify the IPv6 address prefix for the scope with the following command: +Switch(config-dhcpv6)# address prefix ipv6-prefix + + +From the Library of Outcast Outcast +Chapter 12: Configuring DHCP 299 + + +Tip DHCPv6 does not allow you to exclude addresses as you can with DHCPv4. As well, you cannot configure manual address bindings with DHCPv6. + + +Within the DHCPv6 pool, you can assign any necessary options with the following commands: +Switch(config-dhcpv6)# dns-server dns-address +Switch(config-dhcpv6)# domain-name name + +Finally, configure a Layer 3 interface with both an IPv6 address and the DHCPv6 pool with the following commands: +Switch(config)# interface type member/module/number +Switch(config-if)# ipv6 address ipv6-address +Switch(config-if)# ipv6 dhcp server pool-name +Switch(config-if)# no shutdown + +In Example 12-5, a DHCPv6 pool named v6-users has been configured. The DHCPv6 pool has been bound to interface VLAN 5. + +Example 12-5 Configuring a DHCPv6 Pool + +Switch(config)# ipv6 dhcp pool v6-users +Switch(config-dhcpv6)# address prefix 2001:db8:a::/64 +Switch(config-dhcpv6)# dns-server 2001:db8:c12::10 +Switch(config-dhcpv6)# domain-name mydomain.com +Switch(config-dhcpv6)# exit +Switch(config)# interface vlan 5 +Switch(config-if)# ipv6 address 2001:db8:a::1/64 +Switch(config-if)# ipv6 dhcp server v6-users +Switch(config-if)# no shutdown + + +DHCPv6 Lite + +Cisco also offers DHCPv6 Lite, which combines the simplicity of stateless autoconfigura-tion for address management with the DHCP option management function of DHCPv6. + +You can configure DHCPv6 Lite by defining a DHCPv6 pool. However, you should omit the address prefix command from the pool so that clients cannot use DHCPv6 to obtain their addresses. The clients will rely on the normal stateless autoconfiguration using the IPv6 prefix that you have configured on the Layer 3 interface. The DHCPv6 pool should contain any options you would like to push out to the clients. + +After you configure an IPv6 address prefix on the Layer 3 interface, you should reference the DHCPv6 pool and also enter the following interface configuration command. This will inform the clients that options are available via the DHCPv6 Lite server after stateless auto-config yields a usable IPv6 address. The complete configuration is listed in Example 12-6. +Switch(config-if)# ipv6 nd other-config-flag + + +From the Library of Outcast Outcast +300 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 12-6 Configuring DHCPv6 Lite + +Switch(config)# ipv6 dhcp pool v6-users +Switch(config-dhcpv6)# dns-server 2001:db8:c12::10 +Switch(config-dhcpv6)# domain-name mydomain.com +Switch(config-dhcpv6)# exit + +Switch(config)# interface vlan 5 +Switch(config-if)# ipv6 address 2001:db8:a::1/64 +Switch(config-if)# ipv6 dhcp server v6-users +Switch(config-if)# ipv6 nd other-config-flag +Switch(config-if)# no shutdown + + +Configuring a DHCPv6 Relay Agent + +Sometimes you might have a DHCPv6 server operating on an external machine that is located elsewhere in the network. Like DHCPv4, you can enable a DHCP relay agent on the Layer 3 interface. Use the following command to relay DHCPv6 requests between cli-ents and the DHCPv6 server located at the IPv6 address. +Switch(config-if)# ipv6 dhcp relay destination ipv6-address + + +Verifying IPv6 DHCP Operation + +Like DHCP for IPv4, you can monitor DHCPv6 address bindings with the show ipv6 dhcp pool and show ipv6 dhcp binding EXEC commands. Example 12-7 demonstrates these commands to show that there is one IPv6 client with an address binding. + +Example 12-7 Displaying DHCPv6 Address Bindings + +Switch# show ipv6 dhcp pool +DHCPv6 pool: v6-users +Domain name: myV6domain.net +Active clients: 1 +Switch# +Switch# show ipv6 dhcp binding +Client: FE80::DA5:D707:B5F2:8E81 (Vlan1) +DUID: 00010001194C482DC48508B164FD +IA NA: IA ID 0x220050B6, T1 0, T2 0 +Switch# + +You can also manually clear an address binding with the following EXEC command: + +Switch# clear ipv6 dhcp binding {* | ipv6-address} + + + + + + + +From the Library of Outcast Outcast +Chapter 12: Configuring DHCP 301 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 12-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 12-3 Key Topics for Chapter 12 Key +Topic Key Topic Element Description Page Number + + +List + +Paragraph + +Table 12-2 + +Paragraph + +Paragraph + +Paragraph + +Explains DHCP address negotiation 292 + +Covers how to configure a DHCP pool 293 + +Common DHCP options 296 + +Discusses how to configure a DHCP relay 296 + +Explains IPv6 stateless autoconfiguration 298 + +Discusses how to configure DHCPv6 298 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +DHCP, DHCP relay, link-local address, DHCPv6, stateless autoconfiguration, DHCPv6 Lite + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should be able to remember the basic keywords that are needed. + +To test your memory of the DHCP configuration and verification commands related to IPv4 and IPv6, use a piece of paper to cover the right side of Tables 12-4 and 12-5, respectively. Read the description on the left side, and then see how much of the com- +mand you can remember. Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. + + + +From the Library of Outcast Outcast +302 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Table 12-4 + +Task + + +DHCP Commands Related to IPv4 + +Command Syntax + + + +Exclude addresses from a DHCP server scope. + +Define a DHCP server scope. + +Identify the IP subnet for the server scope. +Identify the default router used in the server scope. + +Define the DHCP server lease time. + +Define a DHCP option. + +Configure a manual DHCP binding. + + + + +Enable DHCP relay on a Layer 3 interface. +Display current DHCP bindings. + +Manually clear a DHCP binding. + + +Switch(config-if)# ip dhcp excluded-address start-ip end-ip + +Switch(config-if)# ip dhcp pool pool-name + +Switch(config-dhcp)# network ip-address subnet-mask + +Switch(config-dhcp)# default-router ip-address [ip-address2] [ip-address3] ... + +Switch(config-dhcp)# lease {infinite | { days [hours [minutes]]}} + +Switch(dhcp-config)# option option-num value + +Switch(config)# ip dhcp pool pool-name + +Switch(dhcp-config)# host ip-address mask + +Switch(dhcp-config)# client-identifier identifier + +Switch(dhcp-config)# exit + +Switch(config-if)# ip helper-address ip-address + +Switch# show ip dhcp binding + +Switch# clear ip dhcp binding {* | ip-address} + + + + + +Table 12-5 + +Task + + +DHCP Commands Related to IPv6 + +Command Syntax + + + +Define an IPv6 address prefix on a Layer 3 interface. + +Define a DHCPv6 pool. + + +Switch(config)# interface type member/module/number + +Switch(config-if)# ipv6 address ipv6-prefix + +Switch(config)# ipv6 dhcp pool pool-name + +Switch(config-dhcpv6)# address prefix ipv6-prefix + +Switch(config-dhcpv6)# dns-server dns-address + +Switch(config-dhcpv6)# domain-name name + + +Bind a DHCPv6 pool to a Layer Switch(config)# interface type member/module/number 3 interface. Switch(config-if)# ipv6 address ipv6-address + +Switch(config-if)# ipv6 dhcp server pool-name + +Enable DHCPv6 Lite options. Switch(config-if)# ipv6 nd other-config-flag + + + + +From the Library of Outcast Outcast +Chapter 12: Configuring DHCP 303 + + + +Task +Enable DHCPv6 relay on a Layer 3 interface. + +Manually clear a DHCPv6 binding. + +Command Syntax +Switch(config-if)# ipv6 dhcp relay destination ipv6-address + +Switch# clear ipv6 dhcp binding {* | ipv6-address} + +Display a summary of DHCPv6 Switch# show ipv6 dhcp pool pool activity. +Display current DHCPv6 Switch# show ipv6 dhcp binding [ipv6-address] bindings. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Syslog Messages: This section explains how a switch can maintain a log of important events and send the logging messages to various destinations. +■ Adding Time Stamps to Syslog Messages: This section discusses ways you can set the internal switch clock and synchronize to an accurate source. The switch can then add time stamps to its logging messages as a record of event history. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 13 + + + + + + +Logging Switch Activity + + +This chapter discusses the logging methods you can use to monitor Catalyst switches and collect their event logs. Switch messages should be generated with an accurate time stamp so that you can correlate events across devices. The chapter also covers several methods to set the switch clock and keep it accurate. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 13-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 13-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Syslog Messages + +Adding Time Stamps to Syslog Messages + +Questions Covered in This Section +1-4 + +5-8 + + + +1. Which one of the following syslog severity levels would generate the most types of logging messages? + +a. Emergencies + +b. Alerts + +c. Critical + +d. Warnings + +e. Informational + + + + + + + +From the Library of Outcast Outcast +306 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. The logging trap 0 command sends logging messages to which one of the following destinations? + +a. Switch console + +b. Internal buffer + +c. SNMP server + +d. Syslog server + +e. Nowhere; logging is disabled + +3. If you have configured a switch to send logging messages to an internal buffer, which one of the following commands will let you review the buffer contents? + +a. show logging buffer + +b. show buffer logging + +c. show logging + +d. show event log + +4. Which one of the following syslog severity levels will generate only messages about the most critical or severe events? + +a. 0 + +b. 1 + +c. 5 + +d. 7 + +e. 10 + +5. Which one of the following protocols is used to synchronize time between net-worked devices? + +a. TSP + +b. NTP + +c. STP + +d. RTP + +6. Which one of the following time servers is considered to be the most accurate? + +a. Stratum 0 + +b. Stratum 1 + +c. Stratum 10 + +d. Stratum 100 + + + + + +From the Library of Outcast Outcast +Chapter 13: Logging Switch Activity 307 + +7. Suppose you configure a switch with the command ntp server 192.168.100.100. Which one of the following is a true statement? + +a. The switch will become only an NTP client. + +b. The switch will become only an NTP server. + +c. The switch will become both an NTP server and an NTP client. + +d. The switch will not use NTP until you enter the ntp enable command. + +8. Which one of the following answers correctly describes SNTP? + +a. Secure Network Time Protocol + +b. Simplified Network Time Protocol + +c. Syslog Network Time Protocol + +d. Switched Network Time Protocol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +308 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +This book presents a variety of features and functions that you can leverage to build a working network and accomplish design goals. How can you stay aware of what is +going on inside a switch while it operates? You can use show commands to display vari-ous information from time to time, but you may not catch an event as it happens in real time. Suppose, for instance, that a link goes down for some reason. If you do not know about it and are not able to fix it right away, you might miss an opportunity to keep the network functioning properly. Likewise, you might get news of a problem within the net-work and need to start troubleshooting. + +You should leverage the logging system available in each switch so that you can collect messages as they are generated. By doing so, you can monitor the network to detect fail-ures and gather information about switch activity. + +Syslog Messages + +Catalyst switches can be configured to generate an audit trail of messages describing important events that have occurred. These system message logs (syslog) can then be col-lected and analyzed to determine what has happened, when it happened, and how severe the event was. + +When system messages are generated, they always appear in a consistent format, as shown in Figure 13-1. Each message contains the following fields: + +■ Timestamp: The date and time from the internal switch clock. By default, the amount of time that the switch has been up is used. + +■ Facility Code: A system identifier that categorizes the switch function or module that has generated the message; the facility code always begins with a percent sign. + +■ Severity: A number from 0 to 7 that indicates how important or severe the event is; a lower severity means the event is more critical. + +■ Mnemonic: A short text string that categorizes the event within the facility code. + +■ Message Text: A description of the event or condition that triggered the system message. + +In Figure 13-1, an event in the System or SYS facility has triggered the system message. The event is considered to be severity level 5. From the mnemonic CONFIG_I, you can infer that something happened with the switch configuration. Indeed, the text descrip-tion says that the switch was configured by someone connected to the switch console port. + + + + + + + +From the Library of Outcast Outcast +Chapter 13: Logging Switch Activity 309 + + + +00:30:39 %SYS-5-CONFIG_I: +Timestamp + +Configured from Console by Console +Message Text + + + +%SYS - 5 - CONFIG_I: + +Facility Severity Mnemonic (0-7) + +Figure 13-1 Catalyst Switch Syslog Message Format + +Generally, you should configure a switch to generate syslog messages that are occurring at or above a certain level of importance; otherwise, you might collect too much informa-tion from a switch that logs absolutely everything or too little information from a switch that logs almost nothing. + +You can use the severity level to define that threshold. Figure 13-2 shows each of the log-ging severity levels, along with a general list of the types of messages that are generated. Think of the severity levels as concentric circles. When you configure the severity level threshold on a switch, the switch will only generate logging messages that occur at that level or at any other level that is contained within it. + + + +Key Topic + + +Platform Errors + +• Hardware Issues • Port Security +• STP +• ACL Issues +• TCAM Issues +• PAgP Problems +• Ethernet Controller • Interface Up/Down + +DHCP Snooping + +• 802.1X • DTP +• EtherChannel • Inline Power • STP +• Interface Line Protocol + +• Crashes +• Stopped Processes + + + + +Emergencies (0) + +Alerts (1) Critical (2) Errors (3) Warnings (4) Notifications (5) +Informational (6) +Debugging (7) + + + +Importance or Severity + +High + + + + + + + +Low + + + +• Stack Events • Port Security +• Dynamic ARP Inspection • VTP +• UDLD • STP +• Hardware Diagnostics + + +Debug Output + + +Figure 13-2 Syslog Severity Levels + +For example, if the syslog severity level is set to critical (severity level 2), the switch will generate messages in the Critical, Alerts, and Emergencies levels, but nothing else. Notice that the severity levels are numbered such that the most urgent events are reported at level 0 and the least urgent at level 7. + + +From the Library of Outcast Outcast +310 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Tip You should try to have a good understanding of the severity level names and num-bers, as well as their order, in case you need to identify them on the exam. +Remember that the severity numbers are opposite of what you might perceive as the actual message importance. If the exam asks about an event that has a “high” or “greater” severity, that means the severity level number will be lower. + + +System messages can be sent to the switch console, collected in an internal memory buf-fer, and sent over the network to be collected by a syslog server. The following sections cover the configuration commands for each of these destinations. + +Logging to the Switch Console + +By default, system messages are sent to the switch console port at the Debugging level. You can change the console severity level with the following command: +Switch(config)# logging console severity + +The severity parameter can be either a severity level keyword, such as informational, or the corresponding numeric value (0 to 7). + +Remember that syslog information can be seen on the console only when you are con-nected to the console port. Even then, the console is not a very efficient way to collect and view system messages because of its low throughput. If you are connected to a switch through a Telnet or Secure Shell (SSH) session, you can redirect the console mes-sages to your remote access session by using the terminal monitor command. + +Logging to the Internal Buffer + +Every Catalyst switch has an internal memory buffer where syslog messages can be col-lected. The internal buffer is an efficient way to collect messages over time. As long as the switch is powered up, the logging buffer is available. + +By default, the internal logging buffer is disabled. To enable it and begin sending system messages into the buffer, you can use the following command: +Switch(config)# logging buffered severity + +The severity parameter can be either a severity level keyword, such as informational, or the corresponding numeric value (0 to 7). + +The logging buffer has a finite size and operates in a circular fashion. If the buffer fills, the oldest messages roll off as new ones arrive. By default, the logging buffer is 4096 bytes or characters long, which is enough space to collect 50 lines of full-length text. If you depend on the logging buffer to keep a running history of logging messages, you might need to increase its size with the following command: +Switch(config)# logging buffered size + + + + +From the Library of Outcast Outcast +Chapter 13: Logging Switch Activity 311 + +The buffer length is set to size (4096 to 2147483647) bytes. Be careful not to set the length too big because the switch reserves the logging buffer space from the memory it might need for other operations. + +To review the internal logging buffer at any time, you can use the show logging command. + +Logging to a Remote Syslog Server + +Syslog servers provide the most robust method of logging message collection. Messages are sent from a switch to a syslog server over the network using UDP port 514. This means that a syslog server can be located anywhere, as long as it is reachable by the switch. Keep in mind that UDP is not a reliable means of communication because it is not connection-oriented like TCP. Therefore, logging messages are not acknowledged; they are just sent toward a syslog server on a best effort basis. + +A syslog server can collect logs from many different devices simultaneously and can archive the logging information for a long period of time. To identify a syslog server and begin sending logging messages to it, you can use the following commands: + +Switch(config)# logging host ip-address +Switch(config)# logging trap severity + +The syslog server is located at the hostname or IP address specified. You can enter the logging host command more than once if you have more than one syslog server collect-ing logging information. The syslog server severity level can be either a severity level keyword, such as informational, or the corresponding numeric value (0 to 7). + + +Tip Notice that each of the logging message destinations can have a unique severity level configured. For example, you might collect messages of severity level Debugging into the internal buffer, while collecting severity level Notifications to a syslog server. + + +Tip By default, a switch will generate a system message every time it detects an interface going up or down. That sounds like a good thing, until you realize that the syslog server will be receiving news of every user powering their PC on and off each day. Each link state change will generate a message at the Errors (3) severity level, in addition to a line protocol state change at the Notifications (5) severity level. To prevent this from happening with access layer interfaces where end users are connected, you can use the following interface configuration command: +Switch(config-if)# no logging event link-status + + + + + + + + +From the Library of Outcast Outcast +312 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Adding Time Stamps to Syslog Messages + +If you are watching system messages appear in real time, it is obvious what time those events have occurred; however, if you need to review messages that have been collected and archived in the internal logging buffer or on a syslog server, message time stamps become really important. + +By default, Catalyst switches add a simple “uptime” time stamp to logging messages. This is a cumulative counter that shows the hours, minutes, and seconds since the switch has been booted. Suppose that you find an important event in the logs and you want to know exactly when it occurred. With the uptime time stamp, you would have to backtrack and compute the time of the event based on how long the switch has been operating. + +Even worse, as time goes on, the uptime time stamp becomes more coarse and difficult to interpret. In the following output, an interface went down 20 weeks and 2 days after the switch was booted. Someone made a configuration change 21 weeks and 3 days after the switch booted. At exactly what date and time did that occur? Who knows! + +20w2d: %LINK-3-UPDOWN: Interface FastEthernet1/0/27, changed state to down +21w3d: %SYS-5-CONFIG_I: Configured from console by vty0 (172.25.15.246) + +Instead, you can configure the switch to add accurate clock-like time stamps that are eas-ily interpreted. Sometimes you also will need to correlate events in the logs of several network devices. In that case, it is important to synchronize the clocks (and time stamps) across all those devices. + +Setting the Internal System Clock + +Each Cisco switch has an internal time clock that runs continuously without any interven-tion. However, do not assume that a switch already has its internal clock set to the cor-rect date and time. You can use the show clock command to find out, as in the following example: + +Switch# show clock +*00:54:09.691 UTC Mon Mar 1 1993 +Switch# + +Here the clock has been set to its default value, and it is March 1, 1993! Clearly, that is not useful at all. + +You can use the following commands as a guideline to define the time zone and summer (daylight savings) time and to set the clock: + +Switch(config)# clock timezone name offset-hours [ offset-minutes] +Switch(config)# clock summer-time name date start-month date year hh:mm +end-month day year hh:mm [ offset-minutes] + + + + + + +From the Library of Outcast Outcast +Chapter 13: Logging Switch Activity 313 + +Or + +Switch(config)# clock summer-time name recurring [ start-week day month +hh:mm end-week day month hh:mm [offset-minutes] +Switch(config)# exit +Switch# clock set hh:mm:ss + +In the following example, the switch is configured for the eastern time zone in the U.S. and the clock is set for 3:23 p.m. If no other parameters are given with the clock summer-time recurring command, U.S. daylight savings time is assumed: + +Switch(config)# clock timezone EST -5 +Switch(config)# clock summer-time EDT recurring +Switch(config)# exit +Switch# clock set 15:23:00 + + +Using NTP to Synchronize with an External Time Source + +To synchronize the clocks across multiple switches in your network from common, trusted time sources, you should use the Network Time Protocol (NTP). Each switch still maintains its own internal clock, but each periodically synchronizes its clock with one +or more external time sources. The goal is to synchronize to a source with some level of implied trust that the time is accurate. NTP can also cope with the delay that occurs from the time a source transmits its current time until a switch receives the message. + +With NTP, time sources or servers are arranged in a hierarchical fashion, with each layer of time servers synchronizing with other servers in a higher layer. Ideally, a networked device should synchronize its time clock with an authoritative source, or one that offers the most accuracy. Authoritative time sources can use an atomic clock or a GPS receiver to maintain very accurate time. However, it often is not practical or scalable to point every device in your network toward one authoritative source. Instead, the time synchro-nization process can be distributed so that one layer of NTP servers synchronizes with the authoritative source, then another layer of devices synchronizes with the next highest layer, and so on. + +Each layer of the hierarchy is known as a stratum, where the stratum number indicates the number of NTP “hops” needed to reach the top. Authoritative time servers are locat-ed in stratum 1. NTP servers that synchronize with stratum 1 servers are designated as stratum 2. The NTP stratums keep incrementing toward the servers that client devices use for their synchronization, as shown in Figure 13-3. + +The NTP hierarchy is also flexible. For example, you might have an authoritative time source located somewhere in your network. You can configure all of your switches, rout-ers, firewalls, and clients to synchronize their clocks with your stratum 1 NTP server. For a more scalable solution, you could configure a few centrally located switches as NTP servers and point them toward stratum 1 servers. Your NTP server switches would then become stratum 2 servers. All of your other devices could then synchronize their clocks with the stratum 2 servers. + + + +From the Library of Outcast Outcast +314 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Key Time Server Topic (GPS or Atomic Clock) + + +Stratum 1 + + + + + + +Switch A NTP Server + + + + + +Switch B NTP Server + + +Stratum 2 + + + + + +Stratum 3 + + + + + + +End User NTP Client + + +Figure 13-3 The NTP Hierarchy of Stratums + +The NTP stratum numbers also serve as an indicator of time accuracy. For instance, if a device has a choice of synchronizing with a stratum 4 server or a stratum 3 server, it will prefer the stratum 3 server because it is ultimately better synchronized with an authorita-tive source. + +Table 13-2 lists the possible NTP modes that a device can use. + + + +Table 13-2 + +NTP Mode +Server + + +Client + +Peer + + +NTP Modes + +Description +The device synchronizes with a source in a lower stratum and provides time synchronization with servers or clients in a higher stratum. +The device synchronizes its clock with an NTP server. + +The device exchanges time information with another peer device. + + +Broadcast/multicast The device operates as an NTP server, but pushes time information out to any listening device. Because the “push” is in only one direction, the time accuracy can suffer somewhat. + + + + + + +From the Library of Outcast Outcast +Chapter 13: Logging Switch Activity 315 + +To configure NTP on a switch, enter the following command, along with the IP address of an upstream NTP server. You can repeat the ntp server command to specify more than one time source to use. In that case, you can add the prefer keyword to identify which server to prefer over others. By default, NTP Version 3 is used; NTP Version 4 adds IPv6 capability. +Switch(config)# ntp server ip-address [prefer] [version {3 | 4}] Key +Topic Example 13-1 lists the commands used to enable NTP and use the local NTP server at +192.168.2.168 as an authoritative source. A second server at 24.56.178.140 (time.nist.gov) is added as well. + +Example 13-1 Configuring NTP and Identifying Servers + +Switch(config)# ntp server 192.168.2.168 prefer +Switch(config)# ntp server 24.56.178.140 + +After NTP is configured and enabled, you can use the show ntp status command to verify that the switch clock is synchronized to the NTP server. You can also use the show ntp associations command to see a summary of all the NTP relationships a switch has. In Example 13-2, the switch has synchronized its clock with the stratum 1 server at 192.168.2.168. The switch is associated with the server at 192.168.2.168, which uses a GPS receiver as its reference clock, and a server at 24.56.178.140, which uses an atomic clock time source (ACTS). + +Example 13-2 Verifying NTP Operation + +Switch# show ntp status +Clock is synchronized, stratum 1, reference is 192.168.2.168 +nominal freq is 250.0000 Hz, actual freq is 249.9978 Hz, precision is 2**18 +reference time is D74EEAB6.8408DB3D (13:15:34.515 EDT Wed Aug 20 2014) +clock offset is -0.0089 msec, root delay is 0.82 msec +root dispersion is 10.45 msec, peer dispersion is 0.03 msec +Switch# +Switch# show ntp associations +address ref clock st when poll reach delay offset disp + +*~192.168.2.168 .GPS. ++~24.56.178.140 .ACTS. + +1 335 512 377 +1 268 512 377 + +3.0 -1.00 0.9 +68.3 -9.90 1.2 + +* master (synced), # master (unsynced), + selected, - candidate, ~ configured +Switch# + + +Tip Be aware that an NTP server can provide accurate time from a global perspective, but it is not able to provide a time zone or seasonal time change information. You should use the clock timezone and clock summer-time commands to configure a switch to reference the NTP time to its local settings. + + + + + +From the Library of Outcast Outcast +316 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Securing NTP + +Notice that the NTP configurations in the preceding section reference only the IP addresses of NTP servers, implying that time synchronization is open for any device to use. You can take some additional measures to secure NTP in your network. + +First, you can enable NTP authentication. The authentication process does not encrypt the NTP data; it is used to authenticate an NTP server so that the NTP client knows it is a trusted source. Without authentication, a client might mistakenly synchronize its clock with an attacker posing as an NTP server. + +Use the following global configuration commands to enable NTP authentication. Define an authentication key, then enable authentication, then specify the authentication key number to use when communicating with an NTP server: + +Switch(config)# ntp authentication-key key-number md5 key-string +Switch(config)# ntp authenticate +Switch(config)# ntp trusted-key key-number +Switch(config)# ntp server ip-address key key-number + +NTP authentication only provides a means to validate the server; it does not limit which IP addresses can synchronize time with the server. In fact, any IP address is permitted to synchronize time, even if an authentication key is configured on the server. You should also consider adding an access list to limit which devices can communicate with a switch using NTP. + +Use the following global configuration commands to define an access list and to apply +it to NTP operation. Only addresses permitted by the access list are allowed to use NTP services: +Switch(config)# access-list acl-num permit ip-address mask +Switch(config)# ntp access-group {serve-only | serve | peer | query-only} acl-num +For the ntp access-group command, you should use one of the following keywords to specify which type of NTP activity should be permitted: + +■ serve-only: Only synchronization requests are permitted. + +■ serve: Synchronization and control requests are permitted; the device is not permit-ted to synchronize its own time clock. + +■ peer: Synchronization and control requests are permitted; the device can synchro-nize its own time clock. + +■ query-only: Permit only control queries. + + +Using SNTP to Synchronize Time + +In the preceding section, you learned that the ntp server command enables NTP so that a switch can synchronize its clock with a specified server. You might be surprised to learn that the command also enables the NTP service on every configured Layer 3 interface + + + +From the Library of Outcast Outcast +Chapter 13: Logging Switch Activity 317 + +so that the switch becomes an NTP server for any other device that tries to synchronize time with it. + +As its name implies, the Simplified Network Time Protocol (SNTP) offers a reduced set of NTP functions. When a switch is configured for SNTP, it operates as an NTP client only. In other words, the switch can synchronize its clock with an NTP server, but it can-not allow other devices to synchronize from its own clock. Time synchronization is also simplified, resulting in a slightly less accurate result. + +To configure SNTP, use the typical NTP commands and substitute sntp for the ntp key-word. For example, the following SNTP configuration commands correspond to their NTP counterparts: +Switch(config)# sntp authentication-key key-number md5 key-string +Switch(config)# sntp authenticate +Switch(config)# sntp trusted-key key-number +Switch(config)# sntp server ip-address key key-number + +Adding Time Stamps to Logging Messages + +Finally, you can use the following command to begin using the switch clock as an accu-rate time stamp for syslog messages: +Switch(config)# service timestamps log datetime [localtime] [ show-timezone] [msec] +Key [year] Topic +Use the localtime keyword to use the local time zone configured on the switch; other-wise, coordinated universal time (UTC) is assumed. Add the show-timezone keyword if you want the time zone name added to the time stamps. Use the msec keyword to add milliseconds and the year keyword to add the year to the time stamps. + +In the following example, the local time zone and milliseconds have been added into the time stamps of the logging messages shown: + +Switch(config)# service timestamps log datetime localtime show-timezone msec +Switch(config)# exit +Switch# show logging +*May 2 02:39:23.871 EDT: %DIAG-SP-6-DIAG_OK: Module 1: Passed Online Diagnostics +*May 2 02:39:27.827 EDT: %HSRP-5-STATECHANGE: Vlan62 Grp 1 state Standby -> Active +*May 2 02:41:40.431 EDT: %OIR-SP-6-INSCARD: Card inserted in slot 9, interfaces are now online +*May 3 08:24:13.944 EDT: %IP-4-DUPADDR: Duplicate address 10.1.2.1 on Vlan5, sourced by 0025.64eb.216f +*May 13 09:55:57.139 EDT: %SYS-5-CONFIG_I: Configured from console by herring on vty0 (10.1.1.7) + + + + + + + + +From the Library of Outcast Outcast +318 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 13-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 13-3 Key Topics for Chapter 13 Key +Topic Key Topic Element Description Page Number + + +Figure 13-2 + +Figure 13-3 + +Paragraph + +Paragraph + +Syslog security levels 309 + +NTP hierarchy 314 + +Configuring an NTP server 315 + +Adding time stamps to logging messages 317 + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +NTP, stratum, syslog, syslog severity level + + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the port configuration commands, cover the right side of Tables 13-4 and 13-5 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. Therefore, you should remember the commands needed to con-figure and test a switch interface. + + +From the Library of Outcast Outcast +Chapter 13: Logging Switch Activity 319 + + +Table 13-4 + +Task + + +Switch Logging Configuration Commands + +Command Syntax + + + +Log to the console port. + +Log to a buffer. + +Display the logging buffer. + +Log to a syslog server. + + +Switch(config)# logging console severity + +Switch(config)# logging buffered severity Switch(config)# logging buffered size +Switch# show logging + +Switch(config)# logging host Switch(config)# logging trap severity + + + + + +Table 13-5 + +Task + + +Time Clock Configuration Commands + +Command Syntax + + + +Display the clock. + +Set the local time zone. + + + +Synchronize with an NTP server. +Verify NTP synchronization. + + +Switch# show clock [detail] + +Switch(config)# clock timezone name offset-hours [offset-minutes] +Switch(config)# clock summer-time name date start-month date year hh:mm end-month day year hh:mm [offset-minutes] + +Switch(config)# ntp server ip-address [prefer] [version { 3 | 4}] + +Switch# show ntp status Switch# show ntp associations + +Use NTP authentication. Switch(config)# ntp authentication-key key-number md5 key-string +Switch(config)# ntp authenticate Switch(config)# ntp trusted-key key-number +Switch(config)# ntp server ip-address key key-number + + +Limit NTP access. + + +Add time stamps to logging messages. + + +Switch(config)# access-list acl-num permit ip-address mask Switch(config)# ntp access-group {serve-only | serve | peer | query-only} acl-num +Switch(config)# service timestamps log datetime [localtime] [show-timezone] [msec] [year ] + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ SNMP Overview: This section discusses SNMP basics such as the system roles, data organization, data operations, and SNMP versions. +■ Configuring SNMP: This section explains the steps and commands required to configure each SNMP version on a switch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 14 + + + + + + +Managing Switches with SNMP + + +The Simple Network Management Protocol (SNMP) can be used to manage switches and other network devices remotely, usually from a central network management plat-form. This chapter discusses three versions of SNMP that you can leverage to lighten the administrative load when you are monitoring or configuring many switches. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 14-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 14-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +SNMP Overview + +Configuring SNMP + +Questions Covered in This Section +1–4 + +5–8 + + + +1. SNMP access is configured on a switch. Which one of the following roles does the switch play during SNMP communication? + +a. SNMP agent + +b. SNMP server + +c. SNMP manager + +d. SNMP responder + + + + + + + + +From the Library of Outcast Outcast +322 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. Which one of the following contains information about a switch, its interfaces, and many other counters and statistics? + +a. FIB + +b. RIB + +c. MIB + +d. OID + +3. SNMP communication utilizes which one of the following protocols and port numbers? + +a. GRE port 2 + +b. UDP port 112 + +c. TCP port 21 + +d. UDP port 161 + +e. TCP port 443 + +4. Which one of the following event message types is sent via SNMP and must be acknowledged? + +a. SNMP poll + +b. SNMP trap + +c. SNMP inform + +d. SNMP alarm + +5. Which one of the following credentials does SNMPv1 use to authenticate manage-ment platforms? + +a. Username + +b. Community string + +c. Group name + +d. Certificate + +6. Which SNMP version can use MD5 or SHA as a security means to authenticate packets? + +a. SNMPv1 + +b. SNMPv2 + +c. SNMPv2C + +d. SNMPv3 + + + + + +From the Library of Outcast Outcast +Chapter 14: Managing Switches with SNMP 323 + +7. The snmp-server host command is used to define which one of the following? + +a. The polling SNMP manager + +b. The SNMP user’s machine + +c. The machine that will receive traps and informs + +d. The machines that are allowed to poll + +8. SNMPv3 can leverage which of the following attributes to control access to switch information? (Choose all that apply.) + +a. SNMP group + +b. SNMP user + +c. IP address + +d. SNMP view + +e. All of these answers are correct. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +324 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +SNMP Overview + +The Simple Network Management Protocol (SNMP) enables a network device to share information about itself and its activities. A complete SNMP system consists of the following parts: + + +■ +Key Topic + + +■ + +SNMP manager: A network management system that uses SNMP to poll and receive data from any number of network devices. The SNMP manager usually is an applica-tion that runs in a central location. + +SNMP agent: A process that runs on the network device being monitored. All types of data are gathered by the device itself and stored in a local database. The agent can then respond to SNMP polls and queries with information from the database, and it +can send unsolicited alerts or “traps” to an SNMP manager. + + +In the case of Catalyst switches in the network, each switch automatically collects data about itself, its resources, and each of its interfaces. This data is stored in a Management Information Base (MIB) database in memory and is updated in real time. + +The MIB is organized in a structured, hierarchical fashion, forming a tree structure. In fact, the entire MIB is really a collection of variables that are stored in individual, more granular MIBs that form the branches of the tree. Each MIB is based on the Abstract Syntax Notation 1 (ASN.1) language. Each variable in the MIB is referenced by an object identifier (OID), which is a long string of concatenated indexes that follow the path from the root of the tree all the way to the variable’s location. For example, a counter for the number of inbound bytes on an interface can be found at OID 1.3.6.1.2.1.2.2.1.10 in the IF (interface) MIB. + +Fortunately, only the SNMP manager and agent need to be concerned with interpreting the MIBs. As far as the SWITCH exam and course go, you should just be aware that the MIB structure exists and that it contains everything about a switch that can be monitored. + +To see any of the MIB data, an SNMP manager must send an SNMP poll or query to the switch. The query contains the OID of the specific variable being requested so that the agent running on the switch knows what information to return. An SNMP manager +can use the following mechanisms to communicate with an SNMP agent, all over UDP port 161: + +■ Get request: The value of one specific MIB variable is needed. + +■ Get next request: The next or subsequent value following an initial get request is needed. + +■ Get bulk request: Whole tables or lists of values in a MIB variable are needed. + +■ Set request: A specific MIB variable needs to be set to a value. + + +From the Library of Outcast Outcast +Chapter 14: Managing Switches with SNMP 325 + +SNMP polls or requests are usually sent by the SNMP manager at periodic intervals. This makes real-time monitoring difficult because changing variables will not be noticed until the next poll cycle. However, SNMP agents can send unsolicited alerts to notify the SNMP manager of real-time events at any time. Alerts can be sent using the following mechanisms over UDP port 162: + +■ SNMP trap: News of an event (interface state change, device failure, and so on) is sent without any acknowledgment that the trap has been received. + +■ Inform request: News of an event is sent to an SNMP manager, and the manager is required to acknowledge receipt by echoing the request back to the agent. + +As network management has evolved, SNMP has developed into three distinct versions. The original, SNMP Version 1 (SNMPv1), is defined in RFC 1157. It uses simple one-variable Get and Set requests, along with simple SNMP traps. SNMP managers can gain access to SNMP agents by matching a simple “community” text string. When a manager wants to read or write a MIB variable on a device, it sends the community string in the clear, as part of the request. The request is granted if that community string matches the agent’s community string. + +In theory, only managers and agents belonging to the same community should be able to communicate. In practice, any device has the potential to read or write variables to an agent’s MIB database by sending the right community string, whether it is a legitimate SNMP manager or not. This creates a huge security hole in SNMPv1. + +The second version of SNMP, SNMPv2C (RFC 1901), was developed to address some efficiency and security concerns. For example, SNMPv2C adds 64-bit variable counters, extending the useful range of values over the 32-bit counters used in SNMPv1. With +64-bit counters, a switch can keep track of very large numbers, such as byte counters found on high-speed interfaces. + +In addition, SNMPv2C offers the bulk request, by which MIB variables can be retrieved in a bulk form with a single request. Event notifications sent from an SNMPv2C agent can be in the form of SNMP traps or inform requests. The latter form requires an acknowledgment from the SNMP manager that the inform message was received. Despite the intentions of its developers, SNMPv2C does not address any security concerns over that of SNMPv1. In addition, there were other implementations of SNMPv2 that were incompatible with SNMPv2C, which acted as a further deterrent to its acceptance. + +The third generation of SNMP, SNMPv3, is defined in RFCs 3410 through 3415. It addresses the security features that are lacking in the earlier versions. SNMPv3 can authenticate SNMP managers through usernames. When usernames are configured on the SNMP agent of a switch, they can be organized into SNMPv3 group names. In addi-tion, access to MIB information can be controlled on a per-group basis. You can config-ure a “view” that defines which MIB variable trees can be read or written. + +Each SNMPv3 group is defined with a security level that describes the extent to which the SNMP data will be protected. Data packets can be authenticated to preserve their integrity, encrypted to obscure their contents, or both. The following security levels are + + + +From the Library of Outcast Outcast +326 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +available. The naming scheme uses auth to represent packet authentication and priv to represent data privacy or encryption: + +■ noAuthNoPriv: SNMP packets are neither authenticated nor encrypted. + +■ authNoPriv: SNMP packets are authenticated but not encrypted. + +■ authPriv: SNMP packets are authenticated and encrypted. + +As a best practice, you should use SNMPv3 to leverage its superior security features whenever possible. If you must use SNMPv1 for a device, you should configure the switch to limit SNMP access to a read-only role. Never permit read-write access because the simple community string authentication can be exploited to make unexpected chang-es to a switch configuration. + +Catalyst switches offer one additional means of limiting SNMP access—an access list can be configured to permit only specific (and known) SNMP manager IP addresses. You should configure and apply an access list to your SNMP configurations whenever possible. + +Because SNMP is a universal method for monitoring all sorts of network devices, it is not unique to LAN switches. Therefore, you should understand the basics of how SNMP works, the differences between the different SNMP versions, and how you might apply SNMP to monitor a switched network. You can use Table 14-2 as a memory aid for your exam study. + +Table 14-2 Comparison of SNMP Versions and Features +Key +Topic Version Authentication Data Protection Unique Features + + +SNMPv1 + +SNMPv2c + +Community string None + +Community string None + +32-bit counters + +Adds bulk request and inform request message types, 64-bit counters + +SNMPv3 Username Hash-based MAC (SHA or Adds user authentication, MD5)DES, 3DES, AES (128-, data integrity, and encryp-192-, 256-bit) encryption tionAdds restricted views + + + +Configuring SNMP + +SNMP is normally available in three versions. As a best practice, though, you should use SNMPv3. You can find information about configuring all three versions in the sections that follow. + + + + + + + +From the Library of Outcast Outcast +Chapter 14: Managing Switches with SNMP 327 + +Configuring SNMPv1 + +You should be familiar with the basic SNMPv1 configuration. Fortunately, this involves just a few commands, as follows: + +Switch(config)# access-list access-list-number permit ip-addr +Switch(config)# snmp-server community community- string [ ro | rw] [ access-list-number] +! +Switch(config)# snmp-server host host-address community-string [ trap-type] + +First, define a standard IP access list that permits only the IP addresses of your SNMP agent machines. Then apply that access list to the SNMPv1 community string with the snmp-server community command. Use the ro keyword to allow read-only access by +the SNMP manager; otherwise, you can use the rw keyword to allow both read and write access. + +Finally, use the snmp-server host command to identify the IP address of the SNMP man-ager where SNMP traps will be sent. By default, all types of traps are sent. You can use the ? key in place of trap-type to see a list of the available trap types. + +In Example 14-1, the switch is configured to allow SNMP polling from network manage-ment stations at 192.168.3.99 and 192.168.100.4 only. The community string MonitorIt is used to authenticate the SNMP requests. All possible SNMP traps are sent to 192.168.3.99. + +Example 14-1 Configuring SNMPv1 Access + +Switch(config)# access-list 10 permit 192.168.3.99 +Switch(config)# access-list 10 permit 192.168.100.4 +Switch(config)# snmp-server community MonitorIt ro 10 +Switch(config)# snmp-server host 192.168.3.99 MonitorIt + + +Configuring SNMPv2C + +Configuring SNMPv2C is similar to configuring SNMPv1. The only difference is with SNMP trap or inform configuration. You can use the following commands to configure basic SNMPv2C operation: + +Switch(config)# access-list access-list-number permit ip-addr +Switch(config)# snmp-server community string [ro | rw] [ access-list-number] +! +Switch(config)# snmp-server host host-address [ informs] version 2c community-string + +In the snmp-server host command, use the version 2c keywords to identify SNMPv2C operation. By default, regular SNMP traps are sent. To use inform requests instead, add the informs keyword. + + + + +From the Library of Outcast Outcast +328 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Configuring SNMPv3 + + + +Key Topic + +SNMPv3 configuration is a bit more involved than versions 1 or 2C, due mainly to the additional security features. You can use the following steps to configure SNMPv3 on a +switch: + + +Step 1. You can limit which hosts can access the switch via SNMP by defining a named or numbered IP access list. Permitted addresses will be given SNMPv3 access. +Step 2. You can use the snmp-server view command to define a specific view for the users. Only the MIB variables located under the OID name given as oid-tree will be visible to the user group. For example, ifAdminStatus contains the interface administrative status, ifDescr contains the interface description, and so on. You can repeat the snmp-server view command to add additional OID names to the view: +Switch(config)# snmp-server view view-name oid-tree +If no view is configured, all MIB variables are visible to the users. + +Step 3. Use the snmp-server group command to configure a group name that will set the security level policies for SNMPv3 users that are assigned to the group. The security level is defined by the noauth (no packet authentication or encryption), auth (packets are authenticated but not encrypted), or priv (packets are both authenticated and encrypted) keyword. Only the security policy is defined in the group; no passwords or keys are required yet. + + +Tip The SNMPv3 priv keyword and packet encryption can be used only if the switch is running a cryptographic version of its Cisco IOS Software image. The auth keyword and packet authentication can be used regardless. + + +If you configured a view, you can use the read, write, and notify keywords to limit access to read, write, or notification operations. If you configured an access list, you can apply it to the group with the access keyword: +Switch(config)# snmp-server group group-name v3 { noauth | auth | priv} [read read-view] [ write write-view] [ notify notify-view] [access access-list] +Step 4. Define a username that an SNMP manager will use to communicate with the switch. Use the snmp-server user command to define the user-name and associate it with the SNMPv3 group-name. The v3 keyword configures the user to use SNMPv3. + + + + + + + + +From the Library of Outcast Outcast +Chapter 14: Managing Switches with SNMP 329 + +The SNMPv3 user must also have some specifics added to its security policy. Use the auth keyword to define either message digest 5 (MD5) authentica-tion or the secure hash algorithm (SHA) as the packet authentication method, along with the auth-password text string that will be used in the hash com-putation. The priv keyword defines the encryption method (DES, 3DES, or AES 128/192/256-bit) and the priv-password text string that will be used in the encryption algorithm. +Switch(config)# snmp-server user user-name group-name v3 auth {md5 | sha} auth-password priv {des | 3des | aes {128 | 192 | 256} priv-password [access-list-number] +The same SNMPv3 username, authentication method and password, and encryption method and password must also be defined on the SNMP man-ager so it can successfully talk to the switch. +Step 5. You can use the snmp-server host command to identify the SNMP manager that will receive either traps or informs. The switch can use SNMPv3 to send traps and informs, using the security parameters that are defined for the SNMPv3 username: +Switch(config)# snmp-server host host-address [informs] version 3 {noauth | auth |priv} username [trap-type] +In Example 14-2, a switch is configured for SNMPv3 operation. Access list 10 permits only stations at 192.168.3.99 and 192.168.100.4 with SNMP access. SNMPv3 access is defined for a group named NetOps using the priv (authentication and encryption) secu-rity level. One SNMPv3, a user named mymonitor, is defined; the network management station will use that username when it polls the switch for information. The username will require SHA packet authentication and AES-128 encryption, using the s3cr3tauth and s3cr3tpr1v passwords, respectively. + +Finally, SNMPv3 informs will be used to send alerts to station 192.168.3.99 using the priv security level and username mymonitor. + +Example 14-2 Configuring SNMPv3 Access + +Switch(config)# access-list 10 permit 192.168.3.99 +Switch(config)# access-list 10 permit 192.168.100.4 +Switch(config)# snmp-server group NetOps v3 priv +Switch(config)# snmp-server user mymonitor NetOps v3 auth sha s3cr3tauth priv aes 128 s3cr3tpr1v 10 +Switch(config)# snmp-server host 192.168.3.99 informs version 3 priv mymonitor + + + + + + + + + + + + +From the Library of Outcast Outcast +330 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 14-3 lists a reference of these key topics and the page numbers on which each is found. + + + +Key Topic + +Table 14-3 Key Topics for Chapter 14 + +Key Topic Element Description Page Number + + + +List + +Table 14-2 + +Step list + +Describes the SNMP manager and agent roles 324 + +Lists the SNMP versions and unique features 326 + +Lists the configuration steps necessary to implement 328 SNMPv3 + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +MIB, OID, Simple Network Management Protocol (SNMP), SNMP manager, SNMP agent, SNMP inform, SNMP trap + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the SNMP configuration commands, cover the right side of Table 14-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + + + + + +From the Library of Outcast Outcast +Chapter 14: Managing Switches with SNMP 331 + + +Table 14-4 + +Task + + +SNMP Configuration Commands + +Command Syntax + + + +Define SNMPv1 or SNMPv2C access. + +Define an SNMPv1 trap receiver. + +Define an SNMPv2C trap or inform receiver. + +Define an SNMPv3 view. + + +Switch(config)# snmp-server community community-string [ro | rw] [access-list-number] + +Switch(config)# snmp-server host host-address community-string [trap-type] + +Switch(config)# snmp-server host host-address [informs] version 2c community-string + +Switch(config)# snmp-server view view-name oid-tree + + +Define an SNMPv3 user group. Switch(config)# snmp-server group group-name v3 +{noauth | auth | priv} [read read-view] [write write-view] [notify notify-view] [access access-list] + +Define an SNMPv3 user. + + +Define an SNMPv3 trap or inform receiver. + + +Switch(config)# snmp-server user user-name group-name v3 auth {md5 | sha auth-password priv { des | 3des | aes +{128 | 192 | 256} priv-password [access-list] + +Switch(config)# snmp-server host host-address [informs] version 3 { noauth | auth | priv} user-name [trap-type] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ IP SLA Overview: This section provides a brief overview of the IP SLA feature and how you can use it to measure network performance. +■ Configuring IP SLA: This section explains how you can configure several types of IP SLA tests on Cisco Catalyst switches. +■ Using IP SLA: This section discusses ways you can set up IP SLA tests and interpret their results. + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 15 + + + + + + +Monitoring Performance with IP SLA + + +Switches routinely transport data throughout a network, based on their configuration and how they are interconnected. A well-designed network might move packets efficiently, but many other factors, such as actual traffic loads and link conditions, can change over time and impact time-critical applications. + +Once a network is built, you might have a hard time gauging how well it is performing from an end-user perspective. This chapter explains how you can leverage the switches themselves to actively test end-to-end network performance. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 15-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 15-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +IP SLA Overview + +Configuring IP SLA + +Using IP SLA + +Questions Covered in This Section +1-2 + +3-4 + +5-6 + + + +1. Is the following statement true or false? To use the IP SLA feature, a third-party net-work management platform must be used. + +a. True + +b. False + + + + + + +From the Library of Outcast Outcast +334 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. Which of the following are valid types of IP SLA tests? (Choose all that apply.) + +a. ICMP echo + +b. ICMP time exceeded + +c. UDP jitter + +d. UDP connect + +e. TCP jitter + +f. TCP connect + +3. Which one of the following commands will enable a switch to participate in all types of IP SLA tests? + +a. ip sla enable + +b. ip sla all + +c. ip sla reflector + +d. ip sla responder + +e. ip sla reply all + +4. Suppose the following configuration commands have been entered on Switch A, which has IP address 10.1.1.1. Which one of the answers correctly identifies the con-figuration that is needed on the target switch so it can participate in the UDP jitter tests? + +ip sla 40132 +udp-jitter 10.9.1.100 17000 source-ip 10.1.1.1 num-packets 100 +request-data-size 100 +frequency 300 +ip sla schedule 40132 life forever start-time now ageout 3600 + +a. Enter the same set of commands on the target switch. + +b. Enter the ip sla responder command on the target switch. + +c. Do nothing; the target switch will automatically participate. + +d. Do nothing; UDP jitter is not a valid IP SLA test. + +5. To verify that an IP SLA test operation 123 has been configured and is scheduled to run, which one of the following commands should you use? + +a. show ip sla status 123 + +b. show ip sla configuration 123 + +c. show ip sla operation 123 + +d. show ip sla 123 + + + + +From the Library of Outcast Outcast +Chapter 15: Monitoring Performance with IP SLA 335 + +6. According to the following output, how many IP SLA tests have run and gotten results? (Choose one answer.) + +Switch# show ip sla statistics aggregated 123 +Round Trip Time (RTT) for Index 123 +Start Time Index: 09:53:57.314 EDT Fri Aug 8 2014 +Type of operation: jitter +Voice Scores: +MinOfICPIF: 0 MaxOfICPIF: 0 MinOfMOS: 0 MaxOfMOS: 0 +RTT Values +Number Of RTT: 1100 +RTT Min/Avg/Max: 1/3/6 ms +Latency one-way time milliseconds +Number of Latency one-way Samples: 1046 +Source to Destination Latency one way Min/Avg/Max: 0/0/3 ms +Destination to Source Latency one way Min/Avg/Max: 1/2/4 ms +Jitter time milliseconds +Number of SD Jitter Samples: 1089 +Number of DS Jitter Samples: 1089 +Source to Destination Jitter Min/Avg/Max: 0/1/3 ms +Destination to Source Jitter Min/Avg/Max: 0/1/3 ms +Packet Loss Values +Loss Source to Destination: 0 Loss Destination to Source: 0 + +Out Of Sequence: 0 +Packet Late Arrival: 0 +Number of successes: 238 +Number of failures: 7 + +Tail Drop: 0 +Packet Skipped: 0 + + +a. 123 + +b. 1100 + +c. 1046 + +d. 238 + +e. 7 + + + + + + + + + + + + + + +From the Library of Outcast Outcast +336 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +IP SLA Overview + +The Cisco IOS IP Service Level Agreement (IP SLA) feature enables you to gather realistic information about how specific types of traffic are being handled end to end across a network. To do this, an IP SLA device runs a preconfigured test and generates traffic that is destined for a far-end device. As the far end responds with packets that are received back at the source, IP SLA gathers data about what happened along the way. + + +Tip As the IP SLA feature has evolved, it has been known by several other names. You might also find references to Cisco Response Time Reporter (RTR) and Service Assurance Agent (SAA). + + +IP SLA can be configured to perform a variety of tests. The simplest test involves Internet Control Message Protocol (ICMP) echo packets that are sent toward a target address, +as shown in Figure 15-1. If the target answers with ICMP echo replies, IP SLA can then assess how well the source and destination were able to communicate. In this case, the echo failures (packet loss) and round-trip transit (RTT) times are calculated, as shown in Example 15-1. + + + +IP SLA Operation: +Key icmp-echo +Topic 1 + + +ICMP Echo Request + + + + +ICMP Echo Response Cisco IOS IP SLA + +2 +Any IP Device + + + +Figure 15-1 IP SLA ICMP Echo Test Operation + +Example 15-1 Sample ICMP Echo Test Results + +Switch# show ip sla statistics aggregated +Round Trip Time (RTT) for Index 1 +Type of operation: icmp-echo +Start Time Index: 15:10:17.665 EDT Fri Aug 22 2014 +RTT Values +Number Of RTT: 24 +RTT Min/Avg/Max: 1/1/4 ms +Number of successes: 24 +Number of failures: 0 + + + +From the Library of Outcast Outcast +Chapter 15: Monitoring Performance with IP SLA 337 + +For the ICMP echo test, IP SLA can use any live device at the far end; after all, most networked devices will reply when they are pinged. IP SLA can also test some network protocols, such as DNS, by sending requests to a server at the far end. Cisco IOS is needed only at the source of the IP SLA test because the far end is simply responding to ordinary request packets. + +However, IP SLA is capable of running much more sophisticated tests. Table 15-2 shows some sample test operations that are available with IP SLA. + + +Table 15-2 Key +Topic Test Type + + +icmp-echo + +path-echo + +path-jitter + +dns + +dhcp + +ftp + +http + +udp-echo + +udp-jitter + +tcp-connect + + +IP SLA Test Operations + +Description + +ICMP echo response time + +Hop-by-hop and end-to-end response times over path discovered from ICMP echo +Hop-by-hop jitter over ICMP echo path + +DNS query response time + +DHCP IP address request response time + +FTP file-retrieval response time + +Web page-retrieval response time + +End-to-end response time of UDP echo + +Round-trip delay, one-way delay, one-way jitter, one-way packet loss, and connectivity using UDP packets +Response time to build a TCP connection with a host + + + +IP SLA Required on Target? +No + +No + +Yes + +No + +No + +No + +No + +No + +Yes + +No + + + +To leverage its full capabilities, Cisco IOS IP SLA must be available on both the source and the target devices, as shown in Figure 15-2. The source device handles the test scheduling and sets up each test over a special IP SLA control connection with the tar-get device. The source generates the traffic involved in a test operation and analyzes the results as packets return from the target. The target end has a simpler role: respond to the incoming test packets. In fact, the target device is called an IP SLA responder . + +The responder must also add time stamps to the packets it sends, to flag the time a test packet arrived and the time it left the responder. The idea is to account for any latency incurred while the responder is processing the test packets. For this to work accurately, both the source and responder must synchronize their clocks through NTP. + +An IP SLA source device can schedule and keep track of multiple test operations. For example, an ICMP echo operation might run against target 10.1.1.1, while UDP jitter operations are running against targets 10.2.2.2, 10.3.3.3, and 10.4.4.4. Each test runs inde-pendently, at a configured frequency and duration. + + + + +From the Library of Outcast Outcast +338 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +IP SLA Operation: Key udp-jitter Topic 1 + +2 + +IP SLA Source + + +IP SLA Control Protocol + + +UDP Packet Stream + +UDP Return Stream + + + + + + +3 +IP SLA Responder + + + +Time Clocks Synchronized + +Figure 15-2 IP SLA UDP Jitter Test Operation + + +Tip To set up an IP SLA operation, the Cisco IP SLA source device begins by opening a control connection to the IP SLA responder over UDP port 1967. The source uses the con-trol connection to inform the responder to begin listening on an additional port where the actual IP SLA test operation will take place. + + +What in the world does this have to do with LAN switching, and why would you want to run IP SLA on a Catalyst switch anyway? Here’s a twofold answer: + +■ IP SLA will likely appear on your SWITCH exam. + +■ IP SLA is actually a useful tool in a switched campus network. + +To run live tests and take useful measurements without IP SLA, you would need to place some sort of probe devices at various locations in the network—all managed from a cen-tral system. With IP SLA, you do not need probes at all! Wherever you have a Catalyst switch, you already have an IP SLA “probe.” + +By leveraging IP SLA test operations, you can take advantage of some fancy features: + +■ Generate SNMP traps when certain test thresholds are exceeded + +■ Schedule further IP SLA tests automatically when test thresholds are crossed + +■ Track an IP SLA test to trigger a next-hop gateway redundancy protocol, such as Hot Standby Router Protocol (HSRP) + +■ Gather voice quality measurements from all over a network + + +Configuring IP SLA + +To define an IP SLA operation, you must configure both the source switch and identify the target device. Some test types, such as ICMP echo, can use any target device pro-vided it can reply to the simple test requests. In that case, you do not need to configure anything on the target device. + + +From the Library of Outcast Outcast +Chapter 15: Monitoring Performance with IP SLA 339 + +Other test types, such as UDP jitter, require a target that can negotiate an IP SLA test, keep time stamps during the test, and respond to protocols that do not necessarily require a response. In those cases, the target must be an IP SLA-capable Cisco switch or router. You must enable the IP SLA responder on the target switch so that it can com-municate with the source. You should make sure that both switches are configured to use Network Time Protocol (NTP) to synchronize their time clocks with a common, accurate source. Configuring IP SLA on the target switch is easy; just enable the IP SLA responder with the following command. By default, the IP SLA responder is disabled. +Switch(config)# ip sla responder + + +Tip For the most accurate results, you should configure the IP SLA source and target switches to use a trusted NTP server so that the time stamps will be correct and synchro-nized. NTP configuration is covered in Chapter 13, “Logging Switch Activity.” + + +You can secure IP SLA operations with message digest 5 (MD5) authentication so that only known and trusted devices can participate. Using the following commands, you can define a key chain that consists of keys, each containing an authentication key string. Normally, you will need only one key in the key chain. Assign the key chain to IP SLA with the ip sla key-chain command. Be sure to enter the same commands on both the responder and the source switch so that their authentication keys match: + +Switch(config)# key chain chain-name +Switch(config-keychain)# key key-number +Switch(config-keychain-key)# key-string string +Switch(config-keychain-key)# exit +Switch(config-keychain)# exit +Switch(config)# ip sla key-chain chain-name + +On the source switch, IP SLA configuration is a bit more involved. You can use the fol-lowing configuration steps to define and run an IP SLA test operation: +Step 1. Define a new IP SLA operation on the source switch. + +Switch(config)# ip sla operation-number +The operation-number is an arbitrary index that can range from 1 to a very large number. This number uniquely identifies the test. +Step 2. Select the type of test operation to perform. + +Switch(config-ip-sla)# test-type parameters... +Some of the possible test-type values are the following: + +dhcp, dns, ethernet, ftp , http, icmp-echo, mpls, path-echo , path-jitter , slm, tcp-connect, udp-echo, or udp-jitter + + + + + +From the Library of Outcast Outcast +340 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The list of parameters following the test-type varies according to the test operation. As an example, consider the following icmp-echo operation syntax: +Switch(config-ip-sla)# icmp-echo destination-ip-addr [source-ip-addr] +The parameters are simple: a destination address to ping and an optional source address to use. If a switch has several Layer 3 interfaces, you can spec-ify which one of their IP address to use as the source of the test packets. + +As another example, the udp-jitter command is useful for testing time-critical traffic paths through a switched network. The command syntax is a little more complex, as follows: + +Switch(config-ip-sla)# udp-jitter destination-ip-addr dest-udp-port [source-ip source-ip-addr] [source-port source-udp-port] [num-packets number-of-packets] [interval packet-interval] + +In addition to the source and destination IP addresses, you can define the UDP port numbers that will be used for the packet stream. By default, 10 packets spaced at 20 milliseconds will be sent. You can override that by speci-fying the num-packets and interval keywords. + +As an alternative, you can configure the udp-jitter operation to test Voice over IP (VoIP) call quality. To do this, the udp-jitter command must include the codec keyword and a codec definition. The IP SLA operation will then simulate a real-time stream of voice traffic using a specific codec. In this way, you can tailor the test to fit the type of calls that are actually being used in the network. + +You can define the UDP jitter codec operation by using the following com-mand syntax: +Switch(config-ip-sla)# udp-jitter destination-ip-addr dest-udp-port codec { g711alaw | g711ulaw | g729a} +There are other keywords and parameters you can add to the command, but those are beyond the scope of this book. By default, 1000 packets are sent, 20 milliseconds apart. +Step 3. Set the frequency of the operation. + +By default, IP SLA operations are run at regular 60-second intervals for the lifetime of the test. You can configure the frequency with the following command: +Switch(config-ip-sla)# frequency seconds + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Monitoring Performance with IP SLA 341 + +Step 4. Schedule the test operation. + +Switch(config)# ip sla schedule operation-number [ life { forever | sec-onds}] [start-time {hh:mm[:ss] [month day | day month] | pending | now | after hh:mm:ss}] [ageout seconds] [recurring] +In a nutshell, the ip sla schedule command tells the switch when to start the test, how long to let it run, and how long to keep the data that is collected. + +Set the lifetime with the life keyword: forever means the operation will keep running forever, until you manually remove it. Otherwise, specify how many seconds it will run. By default, an IP SLA scheduled operation will run for 3600 seconds (1 hour). + +Set the start time with the start-time keyword. You can define the start time as a specific time or date, after a delay with the after keyword, or right now with the now keyword. + +By default, the test statistics are collected and held in memory indefinitely. You can use the ageout keyword to specify how many seconds elapse before the data is aged out. + +The recurring keyword can be used to schedule the test operation to run at the same time each day, as long as you have defined the starting time with hh:mm:ss, too. + + +Tip Be aware that the IP SLA operation command syntax has changed along the way. In Cisco IOS Releases 12.2(33) and later, the syntax is as shown in Steps 2 through 4. Before 12.2(33), the commands in Steps 2 through 4 included additional keywords, as +follows: +Step 2. ip sla monitor operation-number Step 3. type test-type +Step 4. ip sla monitor schedule operation-number + + + +Using IP SLA + +After you have configured an IP SLA operation, you can verify the configuration with the show ip sla configuration [operation-number] command. As an example, the follow-ing configuration commands are used to define IP SLA operation 100—an ICMP echo test that pings target 172.25.226.1 every 5 seconds: + +Switch(config)# ip sla 100 +Switch(config-ip-sla)# icmp-echo 172.25.226.1 +Switch(config-ip-sla)# frequency 5 +Switch(config-ip-sla)# exit +Switch(config)# ip sla schedule 100 life forever start-time now + + + + +From the Library of Outcast Outcast +342 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 15-2 shows the output of the show ip sla configuration command. + +Example 15-2 Displaying the Current IP SLA Configuration + +Switch# show ip sla configuration +IP SLAs, Infrastructure Engine-II +Entry number: 100 +Owner: +Tag: +Type of operation to perform: echo +Target address: 172.25.226.1 +Source address: 0.0.0.0 +Request size (ARR data portion): 28 +Operation timeout (milliseconds): 5000 +Type Of Service parameters: 0x0 +Verify data: No +Vrf Name: +Schedule: +Operation frequency (seconds): 5 +Next Scheduled Start Time: Start Time already passed +Group Scheduled : FALSE +Randomly Scheduled : FALSE +Life (seconds): Forever +Entry Ageout (seconds): never +Recurring (Starting Everyday): FALSE +Status of entry (SNMP RowStatus): Active +Threshold (milliseconds): 5000 +Distribution Statistics: +Number of statistic hours kept: 2 +Number of statistic distribution buckets kept: 1 +Statistic distribution interval (milliseconds): 20 +History Statistics: +Number of history Lives kept: 0 +Number of history Buckets kept: 15 +History Filter Type: None +Enhanced History: + +You can use the show ip sla statistics [aggregated] [operation-number] command to dis-play the IP SLA test analysis. By default, the most recent test results are shown. You can add the aggregated keyword to show a summary of the data gathered over the life of the operation. Example 15-3 shows the statistics gathered for ICMP echo operation 100. + +Example 15-3 Displaying IP SLA Statistics + +Switch# show ip sla statistics 100 +Round Trip Time (RTT) for Index 100 +Latest RTT: 1 ms + + + +From the Library of Outcast Outcast +Chapter 15: Monitoring Performance with IP SLA 343 + +Latest operation start time: 15:52:00.834 EDT Fri Aug 29 2014 +Latest operation return code: OK +Number of successes: 117 +Number of failures: 0 +Operation time to live: Forever + +Switch# show ip sla statistics aggregated 100 +Round Trip Time (RTT) for Index 100 +Type of operation: icmp-echo +Start Time Index: 15:43:55.842 EDT Fri Aug 29 2014 +RTT Values +Number Of RTT: 121 +RTT Min/Avg/Max: 1/1/4 ms +Number of successes: 121 +Number of failures: 0 + +It is not too difficult to configure an IP SLA operation manually and check the results every now and then. But does IP SLA have any greater use? Yes, you can also use an IP SLA operation to make some other switch features change behavior automatically, with-out any other intervention. + +For example, HSRP can track the status of an IP SLA operation to automatically decre-ment the priority value when the target device stops answering ICMP echo packets. To do this, begin by using the track command to define a unique track object-number index that will be bound to the IP SLA operation number. +Switch(config)# track object-number ip sla operation-number { state | reachability} + +You can use the state keyword to track the return code or state of the IP SLA operation; the state is up if the IP SLA test was successful or down if it was not. The reachability keyword differs slightly: The result is up if the IP SLA operation is successful or has risen above a threshold; otherwise, the reachability is down. + +Next, configure the HSRP standby group to use the tracked object to control the priority decrement value. As long as the tracked object (the IP SLA operation) is up or successful, the HSRP priority stays unchanged. If the tracked object is down, the HSRP priority is decremented by decrement-value (default 10): +Switch(config-if)# standby group track object-number decrement decrement-value + + +Tip HSRP configuration is covered in greater detail in Chapter 18, “Layer 3 High Availability.” + + +In Example 15-4, Switches A and B are configured as an HSRP pair, sharing gateway address 192.168.1.1. Switch A has a higher priority (120) than Switch B (the default 100), so it is normally the active gateway. However, it is configured to ping an upstream router + + + +From the Library of Outcast Outcast +344 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +at 192.168.70.1 every 5 seconds; if that router does not respond, Switch A will decrement its HSRP priority by 30, permitting Switch B to take over. + +Example 15-4 Tracking an IP SLA Operation in an HSRP Group + +Switch-A(config)# ip sla 10 +Switch-A(config-ip-sla)# icmp-echo 192.168.70.1 +Switch-A(config-ip-sla)# frequency 5 +Switch-A(config-ip-sla)# exit +Switch-A(config)# ip sla schedule 10 life forever start-time now + +Switch-A(config)# track 1 ip sla 10 reachability + +Switch-A(config)# interface vlan10 +Switch-A(config-if)# ip address 192.168.1.3 255.255.255.0 +Switch-A(config-if)# standby 1 priority 120 +Switch-A(config-if)# standby 1 track 1 decrement 30 +Switch-A(config-if)# standby 1 preempt +Switch-A(config-if)# no shutdown + +In some cases, you might need many IP SLA operations to take many measurements in a network. For example, you could use UDP jitter operations to measure voice call quality across many different parts of the network. Manually configuring and monitoring more than a few IP SLA operations can become overwhelming and impractical. Instead, you can leverage a network management application that can set up and monitor IP SLA tests automatically. To do this, the network management system needs SNMP read and write access to each switch that will use IP SLA. Tests are configured by writing to the IP SLA MIB, and results are gathered by reading the MIB. + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Monitoring Performance with IP SLA 345 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 15-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 15-3 Key Topics for Chapter 15 Key +Topic Key Topic Element Description Page Number + + +Figure 15-1 + +Table 15-2 + +Figure 15-2 + +IP SLA ICMP echo test 336 + +IP SLA test types 337 + +IP SLA UDP Jitter test 338 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +IP SLA, IP SLA responder + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the VLAN and trunk-related commands, cover the right side of Table 15-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. + + + + + + + + +From the Library of Outcast Outcast +346 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Table 15-4 + +Task + + +IP SLA Configuration and Monitoring Commands + +Command Syntax + + + +Enable IP SLA responder. + +Authenticate IP SLA operations. + + + + +Define a new IP SLA operation. +Define an ICMP echo test. + +Define a UDP jitter test. + + +Define UDP jitter codec. + +Set the test frequency. + +Set the test schedule. + + +Display the IP SLA test configuration. +Display the results of an IP SLA test operation. + + +Switch(config)# ip sla responder + +Switch(config)# key chain chain-name Switch(config-keychain)# key key-number Switch(config-keychain-key)# key-string string Switch(config-keychain-key)# exit Switch(config-keychain)# exit +Switch(config)# ip sla key-chain chain-name + +Switch(config)# ip sla operation-number + +Switch(config-ip-sla)# icmp-echo destination-ip-addr [source-ip-addr] + +Switch(config-ip-sla)# udp-jitter destination-ip-addr dest-udp-port [source-ip source-ip-addr] [source-port source-udp-port] [num-packets number-of-packets] [interval packet-interval] + +Switch(config-ip-sla)# udp-jitter destination-ip-addr dest-udp-port codec { g711alaw | g711ulaw | g729a} + +Switch(config-ip-sla)# frequency seconds + +Switch(config)# ip sla schedule operation-number [life {forever | seconds}] [start-time {hh:mm[:ss] [month day | day month] | pending | now | after hh:mm:ss}] [ageout seconds] [recurring] + +Switch# show ip sla configuration [operation-number] + +Switch# show ip sla statistics [operation-number] [aggregated] [detail] + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Using Local SPAN: This section explains how you can use a local SPAN session to mirror traffic from one or more interfaces or VLANs to a differ-ent interface, so that the traffic can be captured or monitored. +■ Using Remote SPAN: This section expands on the local SPAN idea to include traffic monitoring across two switches that are separated from each other. +■ Managing SPAN Sessions: This section explains how you can monitor and delete active SPAN ses-sions on a switch. + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 16 + + + + +Using Port Mirroring to Monitor Traffic + + +Sometimes network traffic must be monitored for troubleshooting or analysis purposes. By nature, switches try to forward traffic to a destination as directly as possible. As a result, all traffic is not normally flooded to all switch ports, so you cannot simply con-nect to a switch and monitor interesting traffic flows. + +Catalyst switches can mirror traffic passing through switch ports or VLANs onto other ports so that a network analysis device can capture or “listen in” on interesting traffic within the switch. This chapter explains how you can leverage the Switch Port Analysis (SPAN) feature to mirror traffic between ports on the same switch or across a switched network to a remote switch. In fact, SPAN is also commonly known as port mirroring. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 16-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 16-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Using Local SPAN + +Using Remote SPAN + +Managing SPAN Sessions + +Questions Covered in This Section +1-3 + +4-6 + +7-8 + + + +1. Which of the following allows traffic on one port to be mirrored to another port on the same switch? + +a. VSPAN + +b. RSPAN + +c. Local SPAN + +d. CSPAN + +From the Library of Outcast Outcast +350 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. A local SPAN session can use which of the following as a source? (Choose all that apply.) + +a. Physical interface + +b. VLAN + +c. SVI + +d. An interface in an EtherChannel + +e. A port-channel interface + +3. Which one of the following answers contains the command(s) to correctly configure a local SPAN session to mirror all traffic from interface Gi1/0/13 to interface Gi1/0/27? + +a. monitor session 1 interface gi1/0/13 interface gi1/0/27 + +b. monitor interface gi1/0/13 interface gi1/0/27 + +c. monitor session 1 source interface gi1/0/13 both + +monitor session 1 destination interface gi1/0/27 + +d. monitor session 1 source interface gi1/0/27 both + +monitor session 1 destination interface gi1/0/13 + +4. Which one of the following must be configured to connect switches used for RSPAN? + +a. An 802.1Q trunk allowing data VLANs + +b. Access mode switch ports (single VLAN) + +c. A private VLAN over a trunk + +d. An RSPAN VLAN over a trunk + +5. Which one of the following correctly describes a difference between an RSPAN VLAN and a regular VLAN? + +a. The RSPAN VLAN disables MAC address learning. + +b. The RSPAN VLAN uses static MAC address definitions. + +c. The RSPAN VLAN has the RSPAN source and destination MAC addresses defined in the CAM table. + +d. The RSPAN VLAN cannot be carried over a trunk link. + +6. To configure an RSPAN session’s source switch, what is used for the session destination? + +a. The switch port leading to the destination switch + +b. The RSPAN VLAN + +c. The final destination switch port + +d. The next-hop router + + +From the Library of Outcast Outcast +Chapter 16: Using Port Mirroring to Monitor Traffic 351 + +7. Which two of the following will correctly display active SPAN sessions on a switch? + +a. show span + +b. show monitor + +c. show running-config + +d. show session + +8. Suppose a switch has the following SPAN configuration: + +monitor session 1 source interface gi1/0/1 both +monitor session 1 destination interface gi1/0/48 +monitor session 2 source interface gi1/0/1 both +monitor session 2 destination remote vlan 99 + +Which of the following commands will correctly delete only the local SPAN session? (Choose all that apply.) +a. no monitor session all + +b. no monitor session 1 + +c. no monitor session 2 + +d. no monitor session local + +e. no monitor session remote + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +352 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +Suppose that a problem exists on your switched network and you want to use a network analyzer to gather data. Of interest is a conversation between two hosts connected to a switch, one on interface Gigabit Ethernet 1/0/1 and the other on Gigabit Ethernet 1/0/47. Both ports are assigned to VLAN 100. Because other devices are already connected there, you must connect your analyzer to a different switch port. If you connect your analyzer to another port on VLAN 100, what will your packet capture show? + +Recall that, by definition, switches learn where MAC addresses are located and forward packets directly to those ports. The only time a packet is flooded to ports other than the specific destination is when the destination MAC address has not already been located or when the packet is destined for a broadcast or multicast address. Therefore, your packet capture will show only the broadcast and multicast packets that are being flooded to the analyzer’s switch port. None of the conversation between the two hosts of interest will be overheard. + +Catalyst switches can use the Switched Port Analyzer (SPAN) feature to mirror traffic from one source switch port or VLAN to a destination port. This allows a monitoring device, such as a network analyzer or “sniffer,” to be attached to the destination port for capturing traffic. + +When packets arrive on the source port or VLAN, they are specially marked so that they can be copied to the SPAN destination port as they are delivered to the normal destina-tion port. In this way, the packet capture receives an exact copy of the packets that are being forwarded to and from the SPAN source. + +SPAN is available in two different forms: + + +Key ■ Topic + +■ + +Local SPAN: Both the SPAN source and destination are located on the local switch. The source is one or more switch ports. + +Remote SPAN (RSPAN): The SPAN source and destination are located on differ-ent switches. Mirrored traffic is copied over a special-purpose VLAN across trunks +between switches from the source to the destination. + + +The sections that follow describe each of these SPAN forms in more detail. + + +Using Local SPAN + +A local SPAN session exists on only one switch or one logical switch stack. In other words, you must identify one or more source interfaces and a destination interface where monitored traffic will be copied or mirrored. Figure 16-1 illustrates the basic local SPAN operation where the goal is to monitor all traffic coming from PC A. Interface Gi1/0/1, where PC A is connected, is identified as the SPAN source. A network analyzer is con-nected to interface Gi1/0/48, which is identified as the SPAN destination. As Ethernet frames arrive from PC A on interface Gi1/0/1, the switch makes copies of them and for-wards them to the analyzer. + + +From the Library of Outcast Outcast +Chapter 16: Using Port Mirroring to Monitor Traffic 353 + +Analyzer Key +Topic + + + + +SPAN Destination Gi1/0/48 + +Dst: PC-B Src: PC-A + +Gi1/0/1 +PC-A SPAN Source + +Dst: PC-B Src: PC-A + + + +Dst: PC-B Src: PC-A + +Gi1/0/2 +PC-B + + +Figure 16-1 Using Local SPAN to Monitor Received Traffic + +Figure 16-2 shows how SPAN works with traffic in the opposite direction. In this case, the SPAN session is monitoring traffic going toward PC A. As Ethernet frames exit the switch going toward the SPAN source (PC A), they are copied to the SPAN destination (the analyzer). When you configure a SPAN session, you can specify the direction of traf-fic that will be mirrored, as either received, transmitted, or both. + +Analyzer + + + + +Dst: PC-A Src: PC-B + + + +Dst: PC-A Src: PC-B + +Gi1/0/1 +PC-A SPAN Source + + +SPAN Destination Gi1/0/48 + +Dst: PC-A Src: PC-B + +Gi1/0/2 +PC-B + + +Figure 16-2 Using Local SPAN to Monitor Transmitted Traffic + +The SPAN source can be identified as one or more physical switch ports on the switch. The ports can belong to the same VLAN or different VLANs. In addition, a trunk port can be used as a SPAN source, causing traffic from all VLANs that are active on the trunk to be copied to the SPAN destination. You can apply a VLAN filter to the SPAN source to limit which VLANs will be monitored on the trunk. + +A SPAN source can also be a switch port that is a member of an EtherChannel. In this case, only traffic passing over that physical port in the EtherChannel will be copied to the SPAN destination, allowing you to monitor a single link in the channel. To monitor all traffic passing across an entire EtherChannel, you can identify a port-channel interface as the SPAN source. + + +From the Library of Outcast Outcast +354 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +To monitor traffic passing within one or more VLANs on the switch, you can identify the VLANs as the SPAN source. This is essentially the same as local SPAN, but is often +called VLAN-based SPAN or VSPAN. All switch ports that are active on a source VLAN become sources themselves. + +The destination is identified as a physical interface located on the same switch as the source. Frames that are copied or mirrored from the SPAN source are copied into the SPAN destination port’s egress queue. Because the frames are merely copied within the switch, the original data is not affected and is still forwarded normally. + +What happens if the SPAN source and destination ports are operating at different speeds? This easily could happen if the source is a VLAN with many hosts, or if the source is a 10-Gigabit Ethernet port and the destination is a Gigabit Ethernet port. + +Mirrored frames are copied into the destination port’s egress queue, as if normal Layer 2 switching had decided to forward them there. If the destination port becomes congested, the mirrored frames might be dropped from the queue and not transmitted out the desti-nation port. Therefore, if the bandwidth of SPAN source traffic exceeds that of the SPAN destination port, some mirrored traffic might not be seen at the destination port. + +Local SPAN Configuration + +You can configure one or more simultaneous SPAN sessions on a Catalyst switch. The number of supported SPAN sessions depends on the switch model. For example, a Catalyst 3750-X can support two sessions, whereas a Catalyst 6500 can support up to 64. Each SPAN session is completely independent because there is no interaction between the mirroring processes of each one. + +To configure a SPAN session, start by defining the source of the SPAN session data, using the following global configuration command: +Switch(config)# monitor session session-number source {interface type member/mod/num | vlan vlan-id}[ rx | tx | both] + +SPAN sessions must be numbered uniquely using the session-number parameter. If mul-tiple SPAN sources are needed, you can repeat this command. The SPAN source must +be a physical switch interface or a Layer 2 VLAN, not a logical VLAN interface or SVI. However, you cannot mix both interfaces and VLANs in the same SPAN session. Instead, you can create separate sessions to monitor each type of source. + +Traffic can be selected for mirroring based on the direction it is traveling through the SPAN source. For example, you can select only traffic received on the source (rx), only traffic transmitted from the source (tx), or traffic in both directions (both). By default, both directions are used. + +Next, identify the SPAN destination by using the following global configuration com-mand. Be sure to enter the same session number so that the destination gets bound to the corresponding source: +Switch(config)# monitor session session-number destination interface type member/mod/num [encapsulation replicate] + + + +From the Library of Outcast Outcast +Chapter 16: Using Port Mirroring to Monitor Traffic 355 + +You can define only one destination for each SPAN session. In addition, different SPAN sessions cannot share a common destination. The destination must be a physical inter-face, not a VLAN SVI interface. + +SPAN normally copies packets to the destination without any VLAN trunk tags. As well, SPAN does not normally copy Layer 2 protocols that are sent by the switch itself. Examples include Spanning Tree Protocol (STP) bridge protocol data units (BPDUs), Cisco Discovery Protocol (CDP), Virtual Trunking Protocol (VTP), Dynamic Trunking Protocol (DTP), and Page Aggregation Protocol (PAgP). If you want to capture any +VLAN tagging information or the Layer 2 protocol packets, you can add the encapsulate replicate keywords. + +Be aware that the SPAN destination interface can only transmit mirrored traffic by default. Any frames that are sent into the destination interface are simply dropped. In most cases, the one-way traffic is sufficient because network analyzers only receive frames to be captured and analyzed. If you connect a device that also needs to transmit data back into the network, you can override the default SPAN behavior. Add the follow-ing command syntax to the monitor session destination command to allow ingress traffic: +ingress {dot1q vlan vlan-id | isl | untagged vlan vlan-id} + +Because the SPAN destination interface is not bound to any specific interface or trunking encapsulation, you must specify how the ingress traffic should be handled. If the ingress traffic uses 802.1Q encapsulation, use the dot1q keyword and identify the default VLAN number. If the ingress traffic uses Inter-Switch Link (ISL) encapsulation, enter the isl keyword. Otherwise, if the ingress traffic is not encapsulated, use the untagged keyword and identify to which VLAN the traffic should be sent. + +If the SPAN source is a trunk port, you might want to mirror only traffic from specific VLANs on the trunk. You can specify a list of VLANs with the following global configu-ration command: +Switch(config)# monitor session session-number filter vlan vlan-range + +Following the scenario from Figure 16-1, suppose you would like to monitor traffic going to and coming from a device connected to interface Gigabit Ethernet 1/0/1. You have con-nected a network analyzer to interface Gigabit Ethernet1/0/48. Because the source and destination devices are connected to the same logical switch, you can use a local SPAN session to monitor the traffic. Example 16-1 lists the commands that are necessary to set up the SPAN session. + +Example 16-1 Configuring a Local SPAN Session + +Switch(config)# monitor session 1 source interface gigabitethernet1/0/1 both +Switch(config)# monitor session 1 destination interface gigabitethernet1/0/48 + + + + + + + +From the Library of Outcast Outcast +356 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Note When local SPAN is enabled, STP is disabled on the destination port. This allows STP BPDUs to be captured and monitored but also allows the possibility for a bridging loop to form. Never connect a SPAN session’s destination port back into an active network. If the monitored packets need to be sent toward another switch, use RSPAN instead. + + + +Remote SPAN + +In a large switched network or one that is geographically separated, it might not always be convenient to take a network analyzer to the switch where a SPAN source is located. To make SPAN more extensible, Cisco developed the Remote SPAN (RSPAN) feature. With RSPAN, the source and destination can be located on different switches in different locations. + +The RSPAN source is identified on one switch where the source is connected, just as with local SPAN. The RSPAN destination is identified on another switch where the mirrored traffic will be collected. Then RSPAN will carry only the mirrored data over a special-purpose VLAN across trunk links and intermediate switches between the source and destination. As long as every switch along the way is RSPAN capable, the source can be located at the far-end switch, while the network analyzer might be conveniently located at the switch nearest you. + +Figure 16-3 shows an example network that uses RSPAN to mirror traffic from the source on Switch A to the destination on Switch C. The switches are connected by trunk links that carry a VLAN that is set aside for RSPAN traffic. At the source switch, mirrored frames are copied and sent toward the RSPAN destination over the RSPAN VLAN. At the destination switch, packets are pulled off the RSPAN VLAN and copied to the RSPAN destination port. + +The RSPAN VLAN has some important differences from a regular VLAN. First, MAC address learning is disabled on the RSPAN VLAN. This is to prevent intermediate switch-es that transport the RSPAN VLAN from trying to forward the mirrored packets to their real destination MAC addresses. After all, the purpose of SPAN or RSPAN is to simply mirror or copy interesting frames, not forward them normally. + +An RSPAN-capable switch also floods the RSPAN packets out all its ports belonging to the RSPAN VLAN, in an effort to send them toward the RSPAN destination. Intermediate switches have no knowledge of the RSPAN source or destination; they know only of the RSPAN VLAN itself. Therefore, the RSPAN VLAN should be limited to the links that participate in RSPAN transport. In other words, the RSPAN VLAN should be allowed on trunks between switches, but should not be assigned to any other switch ports along the path. + + + + + + + +From the Library of Outcast Outcast +Chapter 16: Using Port Mirroring to Monitor Traffic 357 + +Analyzer Key +Topic +RSPAN Destination + +Gi1/0/48 + + +Switch-C + + +Trunk + + +RSPAN VLAN 99 + +Dst: PC-B Src: PC-A + + + +Switch-B + + + + +Dst: PC-B Src: PC-A + + +Switch-A + + +Gi1/0/1 + +Trunk + + + +Gi1/0/2 + + +Dst: PC-B Src: PC-A + +PC-A RSPAN Source PC-B + +Figure 16-3 Using RSPAN to Mirror Traffic Across Multiple Switches + +Remote SPAN Configuration + +RSPAN configuration begins with the definition of the special-purpose RSPAN VLAN. If you configure the RSPAN VLAN on a VTP server, VTP correctly propagates it to other intermediate switches. If you are not using VTP, be sure to configure this VLAN for RSPAN explicitly on each intermediate switch. Otherwise, the RSPAN packets will not be delivered correctly. + +In addition, if VTP pruning is in use, the RSPAN VLAN will be pruned from unnecessary trunks, limiting the traffic impact in unrelated areas of the network. + +Create and maintain one or more RSPAN VLANs for the special monitoring purpose only. Set aside one RSPAN VLAN for each RSPAN session that will be used. Do not allow any normal hosts to join an RSPAN VLAN. Define an RSPAN VLAN on each switch between the source and destination with the following configuration commands: + +Switch(config)# vlan vlan-id +Switch(config-vlan)# remote-span + +Next, you must identify the RSPAN source and destination on the two switches where the source and destination are connected. At the source switch, identify the source and destination with the following global configuration commands: + +Switch(config)# monitor session session-number source {interface type member/ mod/num | vlan vlan-id}[rx | tx | both] +Switch(config)# monitor session session-number destination remote vlan rspan-vlan-id + + +From the Library of Outcast Outcast +358 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Here, the source is either a physical switch interface or a Layer 2 VLAN (not a VLAN SVI interface). Notice that the command syntax is identical to the local SPAN monitor ses-sion source command. The RSPAN destination is simply the RSPAN VLAN. This allows the mirrored packets to be copied into the special VLAN and sent on their way toward the final RSPAN destination. + +As with a local SPAN session, you can also use the monitor session filter command to filter VLANs from a trunk interface that is used as a SPAN source. + +At the destination switch, you must again identify the RSPAN source and destination by using the following global configuration commands: + +Switch(config)# monitor session session-number source remote vlan rspan-vlan-id +Switch(config)# monitor session session-number destination interface type member/mod/num [ encapsulation replicate] + +Here the roles are reversed. RSPAN packets are pulled from the RSPAN VLAN and placed onto the destination, which is either a physical switch interface or a Layer 2 VLAN. As with local SPAN, you can add the ingress keyword and its parameters to allow traffic to be received and forwarded from the destination interface. + + +Note Be aware that RSPAN traffic can increase the traffic load on a trunk, even though RSPAN is restricted to one special VLAN within the trunk. If the additional load is signifi-cant, the normal production and the monitored traffic contend with each other for avail-able bandwidth. As a result, both types of traffic could suffer. +Also, RSPAN must allow the STP to run on the RSPAN VLAN to prevent bridging loops from forming. As a result, STP BPDUs normally are sent and received on the VLAN. You cannot monitor BPDUs with RSPAN. + + +Suppose, for instance, that you would like to set up an RSPAN session for the scenario shown in Figure 16-3. The source is connected to Switch A port Gigabit Ethernet 1/0/1. The destination is a network analyzer connected to port Gigabit Ethernet 1/0/48 on Switch C. Switch B simply passes the RSPAN session traffic over VLAN 99, transported by trunk links to switches A and C. The corresponding configuration commands are list-ed in Examples 16-2, 16-3, and 16-4 for Switches A, B, and C, respectively. For Switch B, only the commands relevant to the RSPAN VLAN are listed. The trunk links are assumed to allow VLAN 99 toward Switches A and C. + +Example 16-2 Configuring RSPAN on Switch A in Figure 16-3 + +Switch(config)# vlan 99 +Switch(config-vlan)# remote-span +Switch(config-vlan)# exit +Switch(config)# monitor session 1 source interface gigabitethernet 1/0/1 both +Switch(config)# monitor session 1 destination remote vlan 99 + + + + +From the Library of Outcast Outcast +Chapter 16: Using Port Mirroring to Monitor Traffic 359 + +Example 16-3 Configuring RSPAN on Switch B in Figure 16-3 + +Switch(config)# vlan 99 +Switch(config-vlan)# remote-span +Switch(config-vlan)# exit + + +Example 16-4 Configuring RSPAN on Switch C in Figure 16-3 + +Switch(config)# vlan 99 +Switch(config-vlan)# remote-span +Switch(config-vlan)# exit +Switch(config)# monitor session 1 source remote vlan 99 +Switch(config)# monitor session 1 destination interface gigabitethernet 1/0/48 + + +Managing SPAN Sessions + +Like any other configuration commands, the monitor session source and monitor ses-sion destination commands are placed into the running configuration of the switch as you enter them. You can display SPAN sessions by searching for the commands in the switch configuration, as Example 16-5 shows. + +Example 16-5 Displaying SPAN Sessions in the Switch Configuration + +Switch# show running-config | include monitor +monitor session 1 source interface Gi1/0/1 +monitor session 1 destination interface Gi1/0/48 +Switch# + +You can also see information about currently active SPAN sessions by entering the show monitor EXEC command. By default, all active sessions are displayed. You can use the session keyword to limit the output to specific sessions, all session, only local sessions, or only remote sessions. The command syntax follows: +Switch# show monitor [session {session-number | all | local | range range-list | remote}] [detail] + +In Example 16-6, two SPAN sessions are in use on a switch. + +Example 16-6 Displaying the Currently Active SPAN Sessions + + +Switch# show monitor +Session 1 +---------- +Type +Source Ports +Both +Destination Ports +Encapsulation +Ingress + + + + +: Local Session +: +: Gi1/0/1 +: Gi1/0/48 +: Native +: Disabled + + + + +From the Library of Outcast Outcast +360 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Session 2 +---------- +Type +Source Ports +Both +Dest RSPAN VLAN +Switch# + + + +: Remote Source Session +: +: Gi1/0/1 +: 99 + + +You can delete a SPAN session after the packet analysis is complete. SPAN sessions are numbered, so you can delete them by referencing the session number. Use the following global configuration command to delete one or more sessions: +Switch(config)# no monitor session { session | range session-range} | local | all} + +Session numbers can be given as an individual session, a range of sessions, all local SPAN sessions, or all sessions (local or remote). + +When you finish using a SPAN session, you always should disable or delete it; otherwise, someone might try to connect to the port that is configured as the SPAN destination. You could spend a good bit of time troubleshooting that user’s connectivity problem only to find that you left a SPAN session active there. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 16: Using Port Mirroring to Monitor Traffic 361 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 16-2 lists a reference of these key topics and the page +numbers on which each is found. + + +Table 16-2 Key Topics for Chapter 16 +Key +Topic Key Topic Element Description Page Number + + +List + +Figure 16-1 + +Figure 16-3 + +Types of SPAN sessions 352 + +Local SPAN session operation 353 + +Remote SPAN session operation 357 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +local SPAN, RSPAN, SPAN, VSPAN + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the VLAN and trunk-related commands, cover the right side of Table 16-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +Remember that the CCNP exam focuses on practical or hands-on skills that are used by a networking professional. + + + + + + + + +From the Library of Outcast Outcast +362 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Table 16-3 + +Task + + +IP SLA Configuration and Monitoring Commands + +Command Syntax + + + +Configure a local SPAN session source. + +Configure a local SPAN session destination. + +Enable ingress traffic from the destination interface. +Filter VLANs from a trunk link as a SPAN source. + +Create an RSPAN VLAN. + +Configure an RSPAN session on the source switch. + + +Configure an RSPAN session on the destination switch. + +Display active SPAN sessions. + +Delete SPAN sessions. + + +Switch(config)# monitor session session-number source +{interface type member/mod/num | vlan vlan-id}[rx | tx | both] + +Switch(config)# monitor session session-number destination interface type member/mod/num [encapsulation replicate] + +... ingress {dot1q vlan vlan-id | isl | untagged vlan vlan-id} + +Switch(config)# monitor session session-number filter vlan vlan-range + +Switch(config)# vlan vlan-id Switch(config-vlan)# remote-span + +Switch(config)# monitor session session-number source {interface type member/mod/num | vlan vlan-id}[rx | tx | both] +Switch(config)# monitor session session-number destination remote vlan rspan-vlan-id + +Switch(config)# monitor session session-number source remote vlan rspan-vlan-id +Switch(config)# monitor session session-number destination interface type member/mod/num [encapsulation replicate] + +Switch# show monitor [session {session-number | all | local | range range-list | remote}] [detail] + +Switch(config)# no monitor session { session | range session-range} | local | all} + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Leveraging Logical Switches: This section pro-vides an overview of the StackWise and Virtual Switching System (VSS) techniques that can config-ure multiple physical switches into a single logical switch. The goals are improved network stability, efficiency, and scalability. +■ Supervisor and Route Processor Redundancy: This section covers the methods that can be used on some Catalyst switch platforms to operate an active-standby pair of hardware modules in one chassis. The redundancy modes include route processor redundancy (RPR), RPR+, stateful switchover (SSO), and nonstop forwarding (NSF). + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 17 + + + + + + +Understanding High Availability + + +This chapter describes the techniques that can make switching hardware more redun-dant and available. Multiple switches can be configured to act as a single logical switch. Within a single multilayer switch chassis, two supervisor modules with integrated route processors can be used to provide hardware redundancy. If one supervisor module fails, the other module can pick up the pieces and continue operating the switch. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 17-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 17-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Leveraging Logical Switches + +Supervisor and Route Processor Redundancy + +Questions Covered in This Section +1-5 + +6-7 + + + +1. Before a multichassis EtherChannel can be configured and used, which one of the following requirements must be met? + +a. All the MEC links must connect to the same physical switch. + +b. Only chassis-based switches like the Catalyst 4500 or 6500 can be used. + +c. Physical switches must be configured as one logical switch. + +d. Logical switches must be configured as one physical switch. + + + + + + + +From the Library of Outcast Outcast +366 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. The term StackWise refers to which one of the following? + +a. Switches that can be physically mounted or stacked upon each other + +b. Multiple switches can share a common power bus for PoE + +c. Switches that can stack packets and forward them more efficiently + +d. Switches that can be configured as one logical switch + +3. When StackWise switches are properly connected, they form which one of the fol-lowing topologies? + +a. A bidirectional ring + +b. A hub and spoke + +c. A star + +d. An EtherChannel + +4. Which one of the following features makes it possible for a switch to be added or removed from a StackWise switch stack without interrupting service? + +a. NSF + +b. SSO + +c. Stacking ring + +d. Multichassis EtherChannel + +5. Which one of the following terms refers to two Catalyst 6500 switch chassis that are linked together and configured to act as a single logical switch? + +a. RSS + +b. VSS + +c. ISL + +d. SSO + +6. Which one of the following features is used to reduce the amount of time needed to rebuild the routing information after a supervisor module failure? + +a. NFS + +b. NSF + +c. RPR+ + +d. SSO + + + + + + + + +From the Library of Outcast Outcast +Chapter 17: Understanding High Availability 367 + +7. Which one of the following features provides the fastest failover for supervisor or route processor redundancy? + +a. SSL + +b. SSO + +c. RPR+ + +d. RPR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +368 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +Leveraging Logical Switches + +In Chapter 1, “Enterprise Campus Network Design,” you learned that networks should be structured in distinct layers, in a modular fashion. Switches at each network layer should be implemented in pairs to provide redundancy in case of a device failure. Likewise, links between switch layers should be arranged in pairs to mitigate the effects of a link failure. + +With so much redundancy and high availability, the network should be robust and effi-cient, right? Consider the network shown in Figure 17-1, which is a single switch block or module. In Chapters 6, “Traditional Spanning Tree Protocol,” through 9, “Advanced Spanning Tree Protocol,” you learned that the Spanning Tree Protocol (STP) will place some of the redundant links in Blocking mode, preventing bridging loop structures from +forming. The end result is a network that still sports redundancy, but not every redundant link can be put to active use forwarding traffic. + +To Core Layer + + + + + + +Distribution Layer + + + + + +Access Layer + + +Switch D1 + + + + + + +Switch A1 + + +Switch D2 + + + + + + +Switch A2 + + + +Switch Block + +Figure 17-1 A Typical Redundant Network Design + +Also notice that arranging the switches in pairs does provide switch redundancy, but only in the distribution and core layers. Pairs of access layer switches cannot provide redun-dancy for each other. In other words, users and their traffic can be spread across two access switches; if the CPU in one of the switches fails, however, the other switch cannot take over because the stranded users are not directly connected to it. + +Having independent access switches also restricts some aspects of the access layer. Usually no direct link exists between two access switches, as shown in Figure 17-1. Therefore, each access switch should support a different VLAN for the end users. If there + + + +From the Library of Outcast Outcast +Chapter 17: Understanding High Availability 369 + +are many users fed out of one access layer room, you might have to use several switches and several different VLANs to maintain. + +One way to improve the situation would be to somehow make two redundant physical switches into one logical switch. The single logical switch can group the redundant links into an EtherChannel, removing the dependence on STP to prevent loops and block links. In Figure 17-2, switches A1 and A2 are configured as one logical switch. The pairs of redundant links to the two distribution switches are configured as two EtherChannels. With no blocked links, all the links can actively transport traffic and increase the avail-able bandwidth. + +To Core Layer + + + + + + +Distribution Layer + + + + + +Access Layer + + +Switch D1 + +EtherChannel + + + +Switch A1 + + +Switch D2 + +EtherChannel + + + +Switch A2 + + + +Switch Block + +Figure 17-2 Improving Availability by Creating One Logical Switch from Two + +Having one logical access switch also allows a single VLAN to be used to support the users. As well, you would have to manage and configure only one logical access switch, rather than two physical switches. The logical switch would support one logical control plane for management, while maintaining two separate data planes that are inherent with-in the physical switches. + +Notice that the single logical access switch in Figure 17-2 still has two uplinks—one to each of the two distribution switches, organized as two EtherChannels. It is possible that one of the two EtherChannels might be blocked by STP or that only one of them will lead to the active gateway address upstream. In either case, all the links might not be fully used. + +A further improvement would be to leverage the same logical switch scheme upstream in the distribution layer. As Figure 17-3 shows, the network architecture has been reduced to two logical switches (D1/D2 and A1/A2) that are connected by a single EtherChannel. All of the links can be used all the time. Even if one or more links fail, the rest of the EtherChannel will survive. With a single link between switches, STP should always keep it unblocked. The resulting topology becomes more stable because the EtherChannel will stay active even if STP fails or has a problem. + + +From the Library of Outcast Outcast +370 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +To Core Layer + + + + + + +Distribution Switch D1 Switch D2 Layer + +Multi-Chassis EtherChannel + + + +Access Layer + + +Switch A1 Switch A2 + + + +Switch Block + +Figure 17-3 Connecting Two Logical Switches with an EtherChannel + +To see how the logical switch architecture can simplify a whole network, compare the topologies shown in Figures 17-4 and 17-5. The former is full of redundant links to redundant switches, many not in use because STP blocked them. The latter has similar redundancy, but has a simple tree structure that STP will not have to alter. + + +Core + + + + + +Distribution + + + +Access + + +Switch Block Switch Block Switch Block + +Figure 17-4 Traditional Redundant Switched Network Architecture + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 17: Understanding High Availability 371 + + +Core + + + + + +Distribution + + + +Access + + +Switch Block Switch Block Switch Block + +Figure 17-5 Enhanced Logical Switched Network Architecture + +Cisco offers two approaches to building logical switches, which are discussed in the fol-lowing sections. + +StackWise + +Traditionally, access layer switches have been independent physical devices. If you need-ed multiple switches in one location, you had to configure links between them. Cisco introduced the StackWise and StackWise Plus technologies to enable separate physical switches to act as a single logical switch. StackWise is available on switch models such as the Cisco Catalyst 3750-E, 3750-X, and 3850 platforms. + +To create a logical “stacked” switch, individual physical switches must be connected to each other using special-purpose stacking cables. Each switch supports two stack ports; switches are connected in a daisy-chain fashion, one switch to the next, and one final connection connects the chain into a closed loop. You can think of the stacking cables as an extension of the switching fabric. When frames need to be moved from one physical switch to another, they are sent across the bidirectional stacking cable loop to get there. Figure 17-6 illustrates how two physical switches are cabled to become one logical stack. The same daisy-chain scheme can be used to connect up to nine physical switches in a closed ring fashion, as shown in Figure 17-7. + +Logical Switch Stack Key +Topic +Switch1 Switch2 + + + + +StackWise Cables + + +Figure 17-6 Creating a Logical Switch with StackWise + + + + +From the Library of Outcast Outcast +372 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Logical Switch Stack + +Switch 1 Switch n + +••• + + +StackWise Cables + +Figure 17-7 Extending StackWise to Include Multiple Physical Switches + +One advantage of the closed stacking loop is that individual switches can be inserted or removed without breaking the path between switches completely. The ring can be broken to add or remove a switch, but the remaining switches stay connected over the rest of the ring. In other words, you can make changes to the stack without interrupting its operation. + +When the physical switches are not part of a stack, each one operates independently and manages its own functions. When switches are connected as a stack, each one still main-tains switching functionality, but only one switch becomes the stack master and performs all of the management functions. In fact, the whole stack is managed through a single IP address. If the master switch fails, other member switches can take over the role. + +In Chapter 10, “Aggregating Switch Links,” you learned about multichassis EtherChannels (MECs). Ports on different physical switches in a stack can be bundled into a MEC. Even if one stack member fails, the MEC links connected to other stack members will stay up and functioning. + +Virtual Switching System +Cisco also offers switches that are based on a chassis with slots that can contain mul-tiple switching modules. The chassis must contain a supervisor module that handles all the switch management functions, including things like routing updates and forwarding tables. A chassis can also contain a redundant supervisor module, which can take over in case the current supervisor fails. + +With platforms like the Cisco Catalyst 4500R, 6500, and 8500, you can configure two identical chassis to work as one logical switch. This is known as a Virtual Switching System (VSS), often called a VSS pair. One supervisor in one of the chassis controls the operation of the logical switch. If it fails, a supervisor in the other chassis can take over. To build the logical switch, the two chassis must be linked together by multiple interfaces that have been configured as a virtual switch link (VSL). Figure 17-8 shows two switch chassis operating as a VSS pair. + +Virtual Switching System + +Chassis 1 Chassis 2 + +VSL + + +Figure 17-8 Configuring Two Identical Chassis to Work as One Logical Switch via VSS + +From the Library of Outcast Outcast +Chapter 17: Understanding High Availability 373 + +Supervisor and Route Processor Redundancy + +The Hot Standby Router Protocol (HSRP), Virtual Router Redundancy Protocol (VRRP), and Gateway Load Balancing Protocol (GLBP) router or gateway redundancy protocols covered in Chapter 18, “Layer 3 High Availability,” can provide high availability only for the default gateway addresses. If one of the redundant gateway routers fails, another can pick up the pieces and appear to be the same gateway address. + +But what happens to the devices that are connected directly to the router that fails? If the switching or routing engine fails, packets probably will not get routed and interfaces will go down. Some Cisco switches have the capability to provide redundancy for the super-visor engine itself. This is accomplished by having redundant hardware in place within a switch chassis, ready to take over during a failure. + +You also should consider switch power as a vital part of achieving high availability. For example, if a switch has a single power supply and a single power cord, the whole switch will fail if the power supply fails or if the power cord is accidentally unplugged. Some switch platforms can have multiple power supplies; if one power supply fails, another immediately takes over the load. + +Redundant Switch Supervisors + +Modular switch platforms such as the Catalyst 4500R, 6500, and 6800 can accept two supervisor modules installed in a single chassis. The first supervisor module to success-fully boot becomes the active supervisor for the chassis. The other supervisor remains in a standby role, waiting for the active supervisor to fail. + +The active supervisor always is allowed to boot and become fully initialized and opera-tional. All switching functions are provided by the active supervisor. The standby super-visor, however, is allowed to boot and initialize only to a certain level. When the active module fails, the standby module can proceed to initialize any remaining functions and take over the active role. + +Redundant supervisor modules can be configured in several modes. The redundancy mode affects how the two supervisors handshake and synchronize information. In addi-tion, the mode limits the standby supervisor’s state of readiness. The more ready the standby module is allowed to become, the less initialization and failover time will be required. + +You can use the following redundancy modes on Catalyst switches: + + +■ Key +Topic + + +■ + +Route processor redundancy (RPR): The redundant supervisor is only partially booted and initialized. When the active module fails, the standby module must reload every other module in the switch and then initialize all the supervisor func-tions. + +Route processor redundancy plus (RPR+): The redundant supervisor is booted, allowing the supervisor and route engine to initialize. No Layer 2 or Layer 3 func-tions are started, however. When the active module fails, the standby module finishes initializing without reloading other switch modules. This allows switch ports to +retain their state. + + +From the Library of Outcast Outcast +374 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Stateful switchover (SSO): The redundant supervisor is fully booted and initialized. Both the startup and running configuration contents are synchronized between the supervisor modules. Layer 2 information is maintained on both supervisors so that hardware switching can continue during a failover. The state of the switch interfaces is also maintained on both supervisors so that links do not flap during a failover. + + +Tip Sometimes the redundancy mode terminology can be confusing. In addition to the RPR, RPR+, and SSO terms, you might see single-router mode (SRM) and dual-router mode (DRM). +SRM simply means that two route processors (integrated into the supervisors) are being used, but only one of them is active at any time. In DRM, two route processors are active at all times. HSRP usually is used to provide redundancy in DRM. +Although RPR and RPR+ have only one active supervisor, the route processor portion is not initialized on the standby unit. Therefore, SRM is not compatible with RPR or RPR+. +SRM is inherent with SSO, which brings up the standby route processor. You usually will find the two redundancy terms together, as “SRM with SSO.” + + + +Configuring the Redundancy Mode + +Table 17-2 details the redundancy modes you can configure on supported switch platforms. + +Table 17-2 Redundancy Modes and Failover Time + + +Redundancy Mode +RPR + +RPR+ + +SSO + +Failover Time +Good (> 2 minutes) + +Better (> 30 seconds) + +Best (> 1 second) + + + +Figure 17-9 shows how the supervisor redundancy modes compare with respect to the functions they perform. The shaded functions are performed as the standby supervisor initializes and then waits for the active supervisor to fail. When a failure is detected, the remaining functions must be performed in sequence before the standby supervisor can become fully active. Notice how the redundancy modes get progressively more initialized and ready to become active. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 17: Understanding High Availability 375 + + + +Standby Initializes + +Supervisor Bootstrap Image Loaded + +IOS Image Loaded + +Sync Startup-Config + +Supervisor Diagnostics + +All Switch Modules Active Fails Reloaded +Route Engine Initialized +Layer 2 Protocols Initialized + + +Layer 3 Protocols Initialized +Routing Protocols Converge +FIB Table Flushed and Re-Created +RPR + +Supervisor Bootstrap Image Loaded + +IOS Image Loaded + +Sync Startup-Config + +Supervisor Diagnostics + + +Route Engine Initialized +Layer 2 Protocols Initialized + + +Layer 3 Protocols Initialized +Routing Protocols Converge +FIB Table Flushed and Re-Created +RPR+ + +Supervisor Bootstrap Image Loaded + +IOS Image Loaded + +Sync Startup-Config + +Supervisor Diagnostics + + +Route Engine Initialized +Layer 2 Protocols Initialized +FIB Table Synchronized +Layer 3 Protocols Initialized +Routing Protocols Converge + +FIB Table Updated + +SSO + + + + + + + + + + + + + + +NSF (Optional Optimization) + + +Figure 17-9 Standby Supervisor Readiness as a Function of Redundancy Mode + +You can configure the supervisor redundancy mode by entering the redundancy configu-ration mode with the following command: +Switch(config)# redundancy + +Next, select the redundancy mode with one of the following commands: + +Switch(config-red)# mode {rpr | rpr-plus | sso} + +If you are configuring redundancy for the first time on the switch, you must enter the previous commands on both supervisor modules. When the redundancy mode is enabled, you will make all configuration changes on the active supervisor only. The running con-figuration is synchronized automatically from the active to the standby module. + + +Tip If you configure RPR+ with the rpr-plus keyword, the supervisor attempts to bring up RPR+ with its peer module. The IOS images must be of exactly the same release before RPR+ will work. If the images differ, the supervisor automatically falls back to RPR mode instead. + + +You can verify the redundancy mode and state of the supervisor modules by using the following command: +Switch# show redundancy states + + +From the Library of Outcast Outcast +376 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The output in Example 17-1 shows that the switch is using RPR+ and that the second supervisor module (denoted by unit ID 2 and “my state”) holds the active role. The other supervisor module is in the standby state and is HOT, meaning that it has initialized as far as the redundancy mode will allow. + +Example 17-1 Verifying Supervisor Module Redundancy Mode and State + +Switch# show redundancy states +my state = 13 - ACTIVE +peer state = 8 -STANDBY HOT +Mode = Duplex +Unit = Secondary + +Unit ID = 2 + +Redundancy Mode (Operational) = Route Processor Redundancy Plus +Redundancy Mode (Configured) = Route Processor Redundancy Plus +Split Mode = Disabled +Manual Swact = Enabled +Communications = Up + +client count = 11 +client_notification_TMR = 30000 milliseconds +keep_alive TMR = 9000 milliseconds +keep_alive count = 1 +keep_alive threshold = 18 +RF debug mask = 0x0 +Switch# + + +Configuring Supervisor Synchronization + +By default, the active supervisor synchronizes its startup configuration and configuration register values with the standby supervisor. You also can specify other information that should be synchronized. + +First, use the following commands to enter the main-cpu configuration mode: + +Switch(config)# redundancy +Switch(config-red)# main-cpu + +Then use the following command to specify the information that will be synchronized: + +Switch(config-r-mc)# auto-sync { startup-config | config-register | bootvar} + +You can repeat the command if you need to use more than one of the keywords. To return to the default, use the auto-sync standard command. + + + + + +From the Library of Outcast Outcast +Chapter 17: Understanding High Availability 377 + + + + +Key Topic + +Nonstop Forwarding + +You can enable another redundancy feature along with SSO. Nonstop forwarding (NSF) is an interactive method that focuses on quickly rebuilding the Routing Information Base (RIB) table after a supervisor switchover. The RIB is used to generate the Forwarding Information Base (FIB) table for CEF, which is downloaded to any switch modules or hardware that can perform Cisco Express Forwarding (CEF). + +Instead of waiting on any configured Layer 3 routing protocols to converge and rebuild the FIB, a router can use NSF to get assistance from other NSF-aware neighbors. The neighbors then can provide routing information to the standby supervisor, allowing the routing tables to be assembled quickly. In a nutshell, the Cisco proprietary NSF functions must be built in to the routing protocols on both the router that will need assistance and the router that will provide assistance. + +NSF is supported by the Border Gateway Protocol (BGP), Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest path First (OSPF), and Intermediate System-to-Intermediate System (IS-IS) routing protocols. + +To configure NSF, you must add the commands in Table 17-3 to any routing protocol +configuration on the switch. + + + +Table 17-3 Configuring NSF (by Routing Protocol) + + +Routing Protocol +BGP + +EIGRP + +OSPF + +IS-IS + +Configuration Commands + +Switch(config)# router bgp as-number +Switch(config-router)# bgp graceful-restart + +Switch(config)# router eigrp as-number +Switch(config-router)# nsf + +Switch(config)# router ospf process-id +Switch(config-router)# nsf + +Switch(config)# router isis [tag] +Switch(config-router)# nsf [cisco | ietf] +Switch(config-router)# nsf interval [ minutes] +Switch(config-router)# nsf t3 {manual [seconds] | adjacency} +Switch(config-router)# nsf interface wait seconds + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +378 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 17-4 lists a reference of these key topics and the page numbers on which each is found. + + + +Key Topic + +Table 17-4 Key Topics for Chapter 17 + +Key Topic Element Description Page Number + + + +Figure 17-6 + +List + +Paragraph + +Illustrates StackWise switch topology 371 + +Describes Catalyst supervisor redundancy modes 373 + +Describes nonstop forwarding 377 + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +StackWise, Virtual Switching System (VSS), route processor redundancy (RPR), route processor redundancy plus (RPR+), stateful switchover (SSO), nonstop forwarding (NSF) + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the configuration commands presented in this chapter, cover the right side of Tables 17-5 and 17-6 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + + + + + +From the Library of Outcast Outcast +Chapter 17: Understanding High Availability 379 + + +Table 17-5 + +Task + + +Supervisor Redundancy Configuration Commands + +Command Syntax + + + +Enable supervisor redundancy. + +Set the supervisor redundancy mode. + +Display supervisor redundancy states. + +Enable supervisor redundancy synchronization. + + +Switch(config)# redundancy + +Switch(config-red)# mode {rpr | rpr-plus | sso} + +Switch# show redundancy states + +Switch(config-red)# main-cpu +Switch(config-r-mc)# auto-sync {startup-config | config-register | bootvar } + + + + +Table 17-6 Configuring NSF (by Routing Protocol) + + +Routing Protocol +BGP + + +EIGRP + + +OSPF + + +IS-IS + +Configuration Commands +Switch(config)# router bgp as-number Switch(config-router)# bgp graceful-restart +Switch(config)# router eigrp as-number Switch(config-router)# nsf +Switch(config)# router ospf process-id Switch(config-router)# nsf +Switch(config)# router isis [tag] Switch(config-router)# nsf [cisco | ietf] Switch(config-router)# nsf interval [minutes] +Switch(config-router)# nsf t3 {manual [seconds] | adjacency} +Switch(config-router)# nsf interface wait seconds + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following first-hop redun-dancy protocols that you need to master for the CCNP SWITCH exam: + +■ Hot Standby Routing Protocol (HSRP) + +■ Virtual Router Redundancy Protocol (VRRP) + +■ Gateway Load Balancing Protocol (GLBP) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 18 + + + + + + +Layer 3 High Availability + + +A multilayer switch can provide routing functions for devices on a network, as described in Chapter 11, “Multilayer Switching.” If that switch happens to fail, clients have no way of having their traffic forwarded; their gateway has gone away. + +Other multilayer switches can be added into the network to provide redundancy in the form of redundant router or gateway addresses. This chapter describes the protocols that can be used for redundant router addresses, load balancing across multiple routers, and load balancing into a server farm. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 18-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 18-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Hot Standby Router Protocol + +Virtual Router Redundancy Protocol + +Gateway Load Balancing Protocol + +Questions Covered in This Section +1-5 + +6-7 + +8-10 + + + +1. Which one of the following do multilayer switches share when running HSRP? + +a. Routing tables + +b. ARP cache + +c. CAM table + +d. IP address + + + + +From the Library of Outcast Outcast +382 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. What HSRP group uses the MAC address 0000.0c07.ac11? + +a. Group 0 + +b. Group 7 + +c. Group 11 + +d. Group 17 + +3. Two routers are configured for an HSRP group. One router uses the default HSRP priority. What priority should be assigned to the other router to make it more likely to be the active router? +a. 1 + +b. 100 + +c. 200 + +d. 500 + +4. How many routers are in the Standby state in an HSRP group? + +a. 0 + +b. 1 + +c. 2 + +d. All but the active router + +5. A multilayer switch is configured as follows: + +interface gigabitethernet 1/0/1 +no switchport +ip address 192.168.199.3 255.255.255.0 +standby 1 ip 192.168.199.2 +Which IP address should a client PC use as its default gateway? + +a. 192.168.199.1 + +b. 192.168.199.2 + +c. 192.168.199.3 + +d. Any of these + +6. Which one of the following is based on an IETF RFC standard? + +a. HSRP + +b. VRRP + +c. GLBP + +d. STP + + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 383 + +7. What VRRP group uses the virtual MAC address 0000.5e00.01ff? + +a. Group 0 + +b. Group 1 + +c. Group 255 + +d. Group 94 + +8. Which one of the following protocols is the best choice for load balancing redundant gateways? + +a. HSRP + +b. VRRP + +c. GLBP + +d. GVRP + +9. Which one of the following GLBP functions answers ARP requests? + +a. AVF + +b. VARP + +c. AVG + +d. MVR + +10. By default, which of the following virtual MAC addresses will be sent to the next client that looks for the GLBP virtual gateway? + +a. The GLBP interface’s MAC address + +b. The next virtual MAC address in the sequence + +c. The virtual MAC address of the least-used router + +d. 0000.0c07.ac00 + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +384 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +Multilayer switches can act as IP gateways for connected hosts by providing gateway addresses at VLAN switch virtual interfaces (SVIs) and Layer 3 physical interfaces. These switches can also participate in routing protocols, just as traditional routers do. + +For high availability, multilayer switches should offer a means of preventing one switch (gateway) failure from isolating an entire VLAN. This chapter discusses several approach-es to providing router redundancy, including the following: + +■ Hot Standby Router Protocol (HSRP) + +■ Virtual Router Redundancy Protocol (VRRP) + +■ Gateway Load Balancing Protocol (GLBP) + +These are also commonly called first-hop redundancy protocols (FHRP) because the first router hop is given high availability. + +Packet-Forwarding Review + +When a host must communicate with a device on its local subnet, it can generate an Address Resolution Protocol (ARP) request, wait for the ARP reply, and exchange packets directly. However, if the far end is located on a different subnet, the host must rely on an intermediate system (a router, for example) to relay packets to and from that subnet. + +A host identifies its nearest router, also known as the default gateway or next hop, by its IP address. If the host understands something about routing, it recognizes that all pack-ets destined off-net must be sent to the gateway’s MAC address rather than the far end’s MAC address. Therefore, the host first sends an ARP request to find the gateway’s MAC address. Then packets can be relayed to the gateway directly without having to look for ARP entries for individual destinations. + +If the host is not so savvy about routing, it might still generate ARP requests for every off-net destination, hoping that someone will answer. Obviously, the off-net destinations cannot answer because they never receive the ARP request broadcasts; these requests are not forwarded across subnets. Instead, you can configure the gateway to provide a proxy ARP function so that it will reply to ARP requests with its own MAC address, as if the destination itself had responded. + +Now the issue of gateway availability becomes important. If the gateway router for a subnet or VLAN goes down, packets have no way of being forwarded off the local sub-net. Several protocols are available that allow multiple routing devices to share a common gateway address so that if one goes down, another automatically can pick up the active gateway role. The sections that follow describe these protocols. + + + + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 385 + + +Note IPv6 offers some inherent gateway redundancy because every router connected to a subnet advertises its presence. Hosts overhear the advertisements and use the first router received. If that router fails, hosts have to wait up to 40 seconds to discover a replacement router—an inefficient process. + + + +Hot Standby Router Protocol + + + + + + +Key Topic + +HSRP is a Cisco proprietary protocol developed to allow several routers (or multilayer switches) to appear as a single gateway IP address. RFC 2281 describes this protocol in more detail. + +Basically, each of the routers that provides redundancy for a given gateway address is assigned to a common HSRP group. One router is elected as the primary, or active, HSRP router; another is elected as the standby HSRP router; and all the others remain in the listen HSRP state. The routers exchange HSRP hello messages at regular intervals so that they can remain aware of each other’s existence and that of the active router. + +Figure 18-1 shows a simple network in which two multilayer switches use HSRP Group 1 to provide the redundant gateway address 192.168.1.1. Switch A is the active router, with priority 200, and answers the ARP request for the gateway address. Because Switch B is in the Standby state, it never is used for traffic sent to 192.168.1.1. Instead, only Switch A +performs the gateway routing function, and only its uplink to the access layer is utilized. + + + +VLAN 50 192.168.1.10 +MAC: 0000.aaaa.aaaa + +VLAN 50 192.168.1.11 +MAC: 0000.bbbb.bbbb + + + +Switch A + +ARP Replies for 192.168.1.1 + +HSRP 1: 192.168.1.1 +MAC: 0000.0c07.ac01 + +Active Standby (200) (100) + + +Switch B + + +All Traffic Through 192.168.1.1 + + + + + +VLAN 50 +Gateway: 192.168.1.1 Gateway ARP: 0000.0c07.ac01 + +Figure 18-1 Typical HSRP Scenario with One HSRP Group + + + + +From the Library of Outcast Outcast +386 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Note HSRP sends its hello messages to the multicast destination 224.0.0.2 (“all routers”) using UDP port 1985. + + +An HSRP group can be assigned an arbitrary group number, from 0 to 255. If you config-ure HSRP groups on several VLAN interfaces, it can be handy to make the group number the same as the VLAN number. However, most Catalyst switches support only up to 16 unique HSRP group numbers. If you have more than 16 VLANs, you will quickly run out of group numbers. An alternative is to make the group number the same (that is, 1) for every VLAN interface. This is perfectly valid because the HSRP groups are locally signifi-cant only on an interface. In other words, HSRP Group 1 on interface VLAN 10 is unique and independent from HSRP Group 1 on interface VLAN 11. + +HSRP Router Election + +HSRP election is based on a priority value (0 to 255) that is configured on each router in the group. By default, the priority is 100. The router with the highest priority value (255 is highest) becomes the active router for the group. If all router priorities are equal or set to the default value, the router with the highest IP address on the HSRP interface becomes the active router. To set the priority, use the following interface configuration command: +Switch(config-if)# standby group priority priority + +For example, suppose that one switch is left at its default priority of 100, while the local switch is intended to win the active role election. You can use the following command to set the HSRP priority to 200: +Switch(config-if)# standby 1 priority 200 + +When HSRP is configured on an interface, the router progresses through a series of states before becoming active. This forces a router to listen for others in a group and see where it fits into the pecking order. Devices participating in HSRP must progress their interfaces through the following state sequence: +1. Disabled + +2. Init + +3. Listen + +4. Speak + +5. Standby + +6. Active + +Only the standby (the one with the second-highest priority) router monitors the hello messages from the active router. By default, hellos are sent every 3 seconds. If hellos are missed for the duration of the Hold-Time timer (default 10 seconds, or three times the + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 387 + +Hello timer), the active router is presumed to be down. The standby router is then clear to assume the active role. + +At that point, if other routers are sitting in the Listen state, the next-highest priority router is allowed to become the new standby router. + +If you need to change the timer values, use the following interface configuration com-mand. If you decide to change the timers on a router, you should change them identically on all routers in the HSRP group. +Switch(config-if)# standby group timers [msec] hello [msec] holdtime + +The hello and holdtime values can be given in seconds or in milliseconds, if the msec keyword precedes a value. The hello time can range from 1 to 254 seconds or from 15 to 999 milliseconds. The holdtime always should be at least three times the Hello timer and can range from 1 to 255 seconds or 50 to 3000 milliseconds. + +For example, you can use the following command to set the hello time at 100 millisec-onds and the hold time to 300 milliseconds: +Switch(config-if)# standby 1 timers msec 100 msec 300 + + +Note Be aware that decreasing the HSRP hello time allows a router failure to be detected more quickly. At the same time, HSRP hellos will be sent more often, increasing the amount of traffic on the interface. + + +Normally, after the active router fails and the standby becomes active, the original active router cannot immediately become active when it is restored. In other words, if a router is not already active, it cannot become active again until the current active router fails— even if its priority is higher than that of the active router. An interesting case arises when routers are just being powered up or added to a network. The first router to bring up its interface becomes the HSRP active router, even if it has the lowest priority of all. + +You can configure a router to preempt or immediately take over the active role if its pri-ority is the highest at any time. Use the following interface configuration command to allow preemption: +Switch(config-if)# standby group preempt [delay [ minimum seconds] [ reload seconds]] + +By default, the local router immediately can preempt another router that has the active role. To delay the preemption, use the delay keyword followed by one or both of the fol-lowing parameters: + +■ Add the minimum keyword to force the router to wait for seconds (0 to 3600 sec-onds) before attempting to overthrow an active router with a lower priority. This delay time begins as soon as the router is capable of assuming the active role, such as after an interface comes up or after HSRP is configured. + + + +From the Library of Outcast Outcast +388 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Add the reload keyword to force the router to wait for seconds (0 to 3600 seconds) after it has been reloaded or restarted. This is handy if there are routing protocols that need time to converge. The local router should not become the active gateway before its routing table is fully populated; otherwise, it might not be capable of rout-ing traffic properly. + +■ HSRP also can use an authentication method to prevent unexpected devices from spoofing or participating in HSRP. All routers in the same standby group must have an identical authentication method and key. You can use either plain-text or MD5 authentication, as described in the following sections. + + +Plain-Text HSRP Authentication + +HSRP messages are sent with a plain-text key string (up to eight characters) as a simple method to authenticate HSRP peers. If the key string in a message matches the key con-figured on an HSRP peer, the message is accepted. + +When keys are sent in the clear, they can be easily intercepted and used to impersonate legitimate peers. Plain-text authentication is intended only to prevent peers with a default configuration from participating in HSRP. Cisco devices use cisco as the default key string. + +You can configure a plain-text authentication key for an HSRP group with the following interface configuration command: +Switch(config-if)# standby group authentication string + + +MD5 Authentication + +A message digest 5 (MD5) authentication hash is computed on a portion of each HSRP message and a secret key known only to legitimate HSRP group peers. The MD5 hash value is sent along with HSRP messages. As a message is received, the peer recomputes the hash of the expected message contents and its own secret key; if the hash values are identical, the message is accepted. + +MD5 authentication is more secure than plain-text authentication because the hash value contained in the HSRP messages is extremely difficult (if not impossible) to reverse. The hash value itself is not used as a key; instead, the hash is used to validate the message contents. + +You can configure MD5 authentication by associating a key string with an interface, using the following interface configuration command: +Switch(config-if)# standby group authentication md5 key-string [0 | 7] string + +By default, the key string (up to 64 characters) is given as plain text. This is the same as specifying the 0 keyword. After the key string is entered, it is shown as an encrypted value in the switch configuration. You also can copy and paste an encrypted key string value into this command by preceding the string with the 7 keyword. + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 389 + +Alternatively, you can define an MD5 key string as a key on a key chain. This method is more flexible, enabling you to define more than one key on the switch. Any of the keys then can be associated with HSRP on any interface. If a key needs to be changed, you simply add a new key to the key chain and retire (delete) an old key. + +First define the key chain globally with the key chain command; then add one key at a time with the key and key-string commands. The key-number index is arbitrary, but keys are tried in sequential order. Finally, associate the key chain with HSRP on an interface +by referencing its chain-name. You can use the following commands to configure HSRP MD5 authentication: +Switch(config)# key chain chain-name +Switch(config-keychain)# key key-number +Switch(config-keychain-key)# key-string [0 | 7] string +Switch(config)# interface type mod/num +Switch(config-if)# standby group authentication md5 key-chain chain-name + +Conceding the Election + +Consider an active router in an HSRP group: A group of clients sends packets to it for forwarding, and it has one or more links to the rest of the world. If one of those links fails, the router remains active. If all of those links fail, the router still remains active. But sooner or later, the path to the rest of the world is either crippled or removed, and pack-ets from the clients no longer can be forwarded. + +HSRP has a mechanism for detecting link failures and swaying the election, giving anoth-er router an opportunity to take over the active role. When a specific interface is tracked, HSRP reduces the router’s priority by a configurable amount as soon as the interface goes down. If more than one interface is tracked, the priority is reduced even more with each failed interface. The priority is incremented by the same amount as interfaces come back up. + +This proves particularly useful when a switch has several paths out of a VLAN or subnet; as more interfaces fail and remove the possible paths, other HSRP peers should appear to be more desirable and take over the active role. To configure interface tracking, use the following interface configuration command: +Switch(config-if)# standby group track type mod/num [decrementvalue] + +By default, the decrementvalue for an interface is 10. Keep in mind that interface tracking does not involve the state of the HSRP interface itself. Instead, the state of other specific interfaces affects the usefulness of the local router as a gateway. You also should be aware that the only way another router can take over the active role after interface tracking reduces the priority is if the following two conditions are met: + +■ Another router now has a higher HSRP priority. + +■ That same router is using preempt in its HSRP configuration. + +Without preemption, the active role cannot be given to any other router. + + + +From the Library of Outcast Outcast +390 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +HSRP Gateway Addressing + +Each router in an HSRP group has its own unique IP address assigned to an interface. This address is used for all routing protocol and management traffic initiated by or destined to the router. In addition, each router has a common gateway IP address, the virtual router address, which is kept alive by HSRP. This address also is referred to as the HSRP address or the standby address. Clients can point to that virtual router address as their default gateway, knowing that a router always keeps that address active. Keep in mind that the actual interface address and the virtual (standby) address must be configured to be in the same IP subnet. + +You can assign the HSRP address with the following interface command: + +Switch(config-if)# standby group ip ip-address [secondary] + +When HSRP is used on an interface that has secondary IP addresses, you can add the sec-ondary keyword so that HSRP can provide a redundant secondary gateway address. + + +Note To use HSRP with IPv6, use the following commands to enable HSRP Version 2 and set the HSRP address: +Switch(config-if)# standby version 2 +Switch(config-if)# standby ipv6 autoconfig + + + + +Key Topic + +Naturally, each router keeps a unique MAC address for its interface. This MAC address is always associated with the unique IP address configured on the interface. For the virtual router address, HSRP defines a special MAC address of the form 0000.0c07.acxx, where xx represents the HSRP group number as a two-digit hex value. For example, HSRP Group 1 appears as 0000.0c07.ac01, HSRP Group 16 appears as 0000.0c07.ac10, and so on. + +Example 18-1 shows the configuration commands you can use to configure switches A +and B to implement the scenario shown in Figure 18-1. + + +Example 18-1 Configuring an HSRP Group on a Switch + +Switch-A(config)# interface vlan 50 +Switch-A(config-if)# ip address 192.168.1.10 255.255.255.0 +Switch-A(config-if)# standby 1 priority 200 +Switch-A(config-if)# standby 1 preempt +Switch-A(config-if)# standby 1 ip 192.168.1.1 +Switch-A(config-if)# no shutdown + +Switch-B(config)# interface vlan 50 +Switch-B(config-if)# ip address 192.168.1.11 255.255.255.0 +Switch-B(config-if)# standby 1 priority 100 +Switch-B(config-if)# standby 1 preempt +Switch-B(config-if)# standby 1 ip 192.168.1.1 +Switch-B(config-if)# no shutdown + + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 391 + +Load Balancing with HSRP + +Consider a network in which HSRP is used on two distribution switches to provide a redundant gateway address for access layer users. Only one of the two becomes the active HSRP router; the other remains in standby. All the users send their traffic to the active router over the uplink to the active router. The standby router and its uplink essen-tially sit idle until a router failure occurs. + +Load balancing traffic across two uplinks to two HSRP routers with a single HSRP group is not possible. Then how is it possible to load balance with HSRP? The trick is to use two HSRP groups: + +■ One group assigns an active router to one switch. + +■ The other group assigns another active router to the other switch. + +In this way, two different virtual router or gateway addresses can be used simultaneously. The rest of the trick is to make each switch function as the standby router for its partner’s HSRP group. In other words, each router is active for one group and standby for the other group. The clients or end users also must have their default gateway addresses configured as one of the two virtual HSRP group addresses. + +Figure 18-2 presents this scenario. Now, Switch A is not only the active router for HSRP Group 1 (192.168.1.1), but it is also the standby router for HSRP Group 2 (192.168.1.2). Switch B is configured similarly, but with its roles reversed. The remaining step is to con-figure half of the client PCs with the HSRP Group 1 virtual router address and the other half with the Group 2 address. This makes load balancing possible and effective. Each half of the hosts uses one switch as its gateway over one uplink. + + +VLAN 50 192.168.1.10 +Switch A MAC: 0000.aaaa.aaaa HSRP 1: (active, 200) 192.168.1.1 +MAC: 0000.0c07.ac01 +HSRP 2: (standby, 100) 192.168.1.2 MAC: 0000.0c07.ac02 +ARP Replies for 192.168.1.1 + + +Half of Traffic Through 192.168.1.1 + + + + + +Gateway: 192.168.1.1 Gateway ARP: 0000.0c07.ac01 + + +VLAN 50 192.168.1.11 +MAC: 0000.bbbb.bbbb Switch B +HSRP 1: (standby, 100) 192.168.1.1 MAC: 0000.0c07.ac01 +HSRP 2: (active, 200) 192.168.1.2 MAC: 0000.0c07.ac02 +ARP Replies for 192.168.1.2 + +Half of Traffic Through 192.168.1.2 + + + + + + +Gateway: 192.168.1.2 Gateway ARP: 0000.0c07.ac02 + + +VLAN 50 + +Figure 18-2 Load Balancing with Two HSRP Groups + + +From the Library of Outcast Outcast +392 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 18-2 shows the configuration commands you can use for the scenario shown in Figure 18-2. + +Example 18-2 Configuring Load Balancing Between HSRP Groups + +Switch-A(config)# interface vlan 50 +Switch-A(config-if)# ip address 192.168.1.10 255.255.255.0 +Switch-A(config-if)# standby 1 priority 200 +Switch-A(config-if)# standby 1 preempt +Switch-A(config-if)# standby 1 ip 192.168.1.1 +Switch-A(config-if)# standby 1 authentication MyKey +Switch-A(config-if)# standby 2 priority 100 +Switch-A(config-if)# standby 2 ip 192.168.1.2 +Switch-A(config-if)# standby 2 authentication MyKey +Switch-B(config)# interface vlan 50 +Switch-B(config-if)# ip address 192.168.1.11 255.255.255.0 +Switch-B(config-if)# standby 1 priority 100 +Switch-B(config-if)# standby 1 ip 192.168.1.1 +Switch-B(config-if)# standby 1 authentication MyKey +Switch-B(config-if)# standby 2 priority 200 +Switch-B(config-if)# standby 2 preempt +Switch-B(config-if)# standby 2 ip 192.168.1.2 +Switch-B(config-if)# standby 2 authentication MyKey + +You can use the following command to display information about the status of one or more HSRP groups and interfaces: +Router# show standby [brief] [vlan vlan-id | type mod/num] + +Based on the configuration in Example 18-2, the output in Example 18-3 shows that Switch A is the active router for HSRP Group 1 and the standby router for HSRP Group 2 on interface VLAN 50. + +Example 18-3 Displaying the HSRP Router Role of a Switch: Switch A + +Switch-A# show standby vlan 50 brief +P indicates configured to preempt. +| +Interface Grp Prio P State Active addr Standby addr Group addr + +Vl50 1 +Vl50 2 +Switch-A# + +200 P Active +100 Standby + +local +192.168.1.11 + +192.168.1.11 +local + +192.168.1.1 +192.168.1.2 + +Switch-A# show standby vlan 50 +Vlan50 - Group 1 + +Local state is Active, priority 200, may preempt +Hellotime 3 sec, holdtime 10 sec +Next hello sent in 2.248 + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 393 + +Virtual IP address is 192.168.1.1 configured +Active router is local +Standby router is 192.168.1.11 expires in 9.860 +Virtual mac address is 0000.0c07.ac01 +Authentication text "MyKey" +2 state changes, last state change 00:11:58 +IP redundancy name is "hsrp-Vl50-1" (default) +Vlan50 - Group 2 +Local state is Standby, priority 100 +Hellotime 3 sec, holdtime 10 sec +Next hello sent in 1.302 +Virtual IP address is 192.168.1.2 configured +Active router is 192.168.1.11, priority 200 expires in 7.812 +Standby router is local +Authentication text "MyKey" +4 state changes, last state change 00:10:04 +IP redundancy name is "hsrp-Vl50-2" (default) +Switch-A# + +The output from Switch B in Example 18-4 shows that it has inverted roles from Switch A for HSRP Groups 1 and 2. + +Example 18-4 Displaying the HSRP Router Role of a Switch: Switch B + +Switch-B# show standby vlan 50 brief +P indicates configured to preempt. +| +Interface Grp Prio P State Active addr Standby addr Group addr + +Vl50 1 +Vl50 2 +Switch-B# + +100 Standby +200 P Active + +192.168.1.10 +local + +local +192.168.1.10 + +192.168.1.1 +192.168.1.2 + +Switch-B# show standby vlan 50 +Vlan50 - Group 1 + +Local state is Standby, priority 100 +Hellotime 3 sec, holdtime 10 sec +Next hello sent in 0.980 +Virtual IP address is 192.168.1.1 configured +Active router is 192.168.1.10, priority 200 expires in 8.128 +Standby router is local +Authentication text "MyKey" +1 state changes, last state change 00:01:12 +IP redundancy name is "hsrp-Vl50-1" (default) +Vlan50 - Group 2 +Local state is Active, priority 200, may preempt +Hellotime 3 sec, holdtime 10 sec +Next hello sent in 2.888 + + + +From the Library of Outcast Outcast +394 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Virtual IP address is 192.168.1.2 configured +Active router is local +Standby router is 192.168.1.10 expires in 8.500 +Virtual mac address is 0000.0c07.ac02 +Authentication text "MyKey" +1 state changes, last state change 00:01:16 +Switch-B# + + + + + + + + + + + +Key Topic + +Virtual Router Redundancy Protocol + +The Virtual Router Redundancy Protocol (VRRP) is a standards-based alternative to HSRP, defined in IETF standard RFC 2338. VRRP is so similar to HSRP that you need to learn only slightly different terminology and a couple of slight functional differences. When you understand HSRP operation and configuration, you will also understand VRRP. This section is brief, highlighting only the differences between HSRP and VRRP. + +VRRP provides one redundant gateway address from a group of routers. The active router is called the master router, whereas all others are in the backup state. The master router is the one with the highest router priority in the VRRP group. + +VRRP group numbers range from 0 to 255; router priorities range from 1 to 254. (254 is the highest, 100 is the default.) + +The virtual router MAC address is of the form 0000.5e00.01xx, where xx is a two-digit hex VRRP group number. + +VRRP advertisements are sent at 1-second intervals. Backup routers optionally can learn the advertisement interval from the master router. + +By default, all VRRP routers are configured to preempt the current master router if their +priorities are greater. + + + +Note VRRP sends its advertisements to the multicast destination address 224.0.0.18 (VRRP), using IP protocol 112. VRRP was introduced in Cisco IOS Software Release 12.0(18)ST for routers, but is not supported consistently across all switching platforms. + + +To configure VRRP, use the interface configuration commands documented in Table 18-2. + + + +Table 18-2 + +Task + + +VRRP Configuration Commands + +Command Syntax + + + +Assign a VRRP router priority (default 100). + +Alter the advertisement timer (default 1 second). + +Learn the advertisement interval from the master router. + + +Switch(config-if)# vrrp group priority level + +Switch(config-if)# vrrp group timers advertise [msec] interval + +Switch(config-if)# vrrp group timers learn + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 395 + + + +Task +Disable preempting (default is to preempt). + +Change the preempt delay (default 0 seconds). + +Use authentication for advertisements. + +Assign a virtual IP address. + +Track an object. + +Command Syntax +Switch(config-if)# no vrrp group preempt + +Switch(config-if)# vrrp group preempt [delay seconds] + +Switch(config-if)# vrrp group authentication string + +Switch(config-if)# vrrp group ip ip-address [secondary ] + +Switch(config-if)# vrrp group track object-number [decrement priority] + + + +As an example, the load-balancing scenario shown in Figure 18-2 is implemented using VRRP. You would use the configuration commands in Example 18-5 on the two Catalyst switches. + +Example 18-5 Configuring Load Balancing with VRRP + +Switch-A(config)# interface vlan 50 +Switch-A(config-if)# ip address 192.168.1.10 255.255.255.0 +Switch-A(config-if)# vrrp 1 priority 200 +Switch-A(config-if)# vrrp 1 ip 192.168.1.1 +Switch-A(config-if)# vrrp 2 priority 100 +Switch-A(config-if)# no vrrp 2 preempt +Switch-A(config-if)# vrrp 2 ip 192.168.1.2 + +Switch-B(config)# interface vlan 50 +Switch-B(config-if)# ip address 192.168.1.11 255.255.255.0 +Switch-B(config-if)# vrrp 1 priority 100 +Switch-B(config-if)# no vrrp 1 preempt +Switch-B(config-if)# vrrp 1 ip 192.168.1.1 +Switch-B(config-if)# vrrp 2 priority 200 +Switch-B(config-if)# vrrp 2 ip 192.168.1.2 + +You can use the following command to display information about VRRP status on one or more interfaces: +Switch# show vrrp [ brief] + +Example 18-6 shows this command executed on both Switch A and Switch B, with the out-put showing the alternating roles for the two VRRP groups configured in Example 18-5. + +Example 18-6 Displaying Switch Roles for VRRP Load Balancing + +Switch-A# show vrrp brief +Interface Grp Pri Time Own Pre State Master addr Group addr +Vlan50 1 200 3218 Y Master 192.168.1.10 192.168.1.1 + + +From the Library of Outcast Outcast +396 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Vlan50 2 100 3609 Backup 192.168.1.11 192.168.1.2 +Switch-A# + +Switch-B# show vrrp brief +Interface Grp Pri Time Own Pre State Master addr Group addr + +Vlan50 +Vlan50 +Switch-B# + +1 100 3609 +2 200 3218 + +Backup +Y Master + +192.168.1.10 +192.168.1.11 + +192.168.1.1 +192.168.1.2 + + +Table 18-3 compares the detailed VRRP status between the Switch A and Switch B switches. + + +Table 18-3 + +Switch A + + +Verifying VRRP Status for multiple VRRP Groups + +Switch B + + + +Switch-A# show vrrp +Vlan50 - Group 1 +State is Master +Virtual IP address is 192.168.1.1 +Virtual MAC address is 0000.5e00.0101 +Advertisement interval is 1.000 sec +Preemption is enabled +min delay is 0.000 sec +Priority is 200 +Authentication is enabled +Master Router is 192.168.1.10 (local), +priority is 200 +Master Advertisement interval is 1.000 +sec +Master Down interval is 3.218 sec + +Vlan50 - Group 2 +State is Backup +Virtual IP address is 192.168.1.2 +Virtual MAC address is 0000.5e00.0102 +Advertisement interval is 1.000 sec +Preemption is disabled +Priority is 100 +Authentication is enabled +Master Router is 192.168.1.11, priority +is 200 +Master Advertisement interval is 1.000 +sec +Master Down interval is 3.609 sec (expires in 2.977 sec) +Switch-A# + +Switch-B# show vrrp +Vlan50 - Group 1 +State is Backup +Virtual IP address is 192.168.1.1 +Virtual MAC address is 0000.5e00.0101 +Advertisement interval is 1.000 sec +Preemption is disabled +Priority is 100 +Authentication is enabled +Master Router is 192.168.1.10, priority +is 200 +Master Advertisement interval is 1.000 +sec +Master Down interval is 3.609 sec +(expires in 2.833 sec) + +Vlan50 - Group 2 +State is Master +Virtual IP address is 192.168.1.2 +Virtual MAC address is 0000.5e00.0102 +Advertisement interval is 1.000 sec +Preemption is enabled +min delay is 0.000 sec +Priority is 200 +Authentication is enabled +Master Router is 192.168.1.11 (local), +priority is 200 +Master Advertisement interval is 1.000 +sec +Master Down interval is 3.218 sec +Switch-B# + + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 397 + +Gateway Load Balancing Protocol + +You should now know how both HSRP and VRRP can effectively provide a redundant gateway (virtual router) address. You can accomplish load balancing by configuring only multiple HSRP/VRRP groups to have multiple virtual router addresses. More manual configuration is needed so that the client machines are divided among the virtual routers. Each group of clients must point to the appropriate virtual router. This makes load bal-ancing somewhat labor-intensive, having a more or less fixed, or static, behavior. + +The Gateway Load Balancing Protocol (GLBP) is a Cisco proprietary protocol designed to overcome the limitations of existing redundant router protocols. Some of the concepts are the same as with HSRP/VRRP, but the terminology is different, and the behavior is much more dynamic and robust. + + +Note GLBP was introduced in Cisco IOS Software Release 12.2(14)S for routers, but is not consistently supported across all switching platforms. + + +To provide a virtual router, multiple switches (routers) are assigned to a common GLBP group. Instead of having just one active router performing forwarding for the virtual rout-er address, all routers in the group can participate and offer load balancing by forwarding a portion of the overall traffic. + +The advantage is that none of the clients has to be pointed toward a specific gateway address; they can all have the same default gateway set to the virtual router IP address. The load balancing is provided completely through the use of virtual router MAC addresses in ARP replies returned to the clients. As a client sends an ARP request look-ing for the virtual router address, GLBP sends back an ARP reply with the virtual MAC address of a selected router in the group. The result is that all clients use the same gate-way address but have differing MAC addresses for it. + + + + + +Key Topic + +Active Virtual Gateway + +The trick behind this load balancing lies in the GLBP group. One router is elected the active virtual gateway (AVG). This router has the highest priority value, or the highest IP address in the group, if there is no highest priority. The AVG answers all ARP requests for the virtual router address. Which MAC address it returns depends on which load-balanc-ing algorithm it is configured to use. In any event, the virtual MAC address supported by one of the routers in the group is returned. + +The AVG also assigns the necessary virtual MAC addresses to each of the routers partici-pating in the GLBP group. Up to four virtual MAC addresses can be used in any group. Each of these routers is referred to as an active virtual forwarder (AVF), forwarding traffic received on its virtual MAC address. Other routers in the group serve as backup or secondary virtual forwarders, in case the AVF fails. The AVG also assigns secondary +roles. + + + + + +From the Library of Outcast Outcast +398 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Assign the GLBP priority to a router with the following interface configuration command: +Switch(config-if)# glbp group priority level + +GLBP group numbers range from 0 to 1023. The router priority can be 1 to 255 (255 is the highest priority), defaulting to 100. + +As with HSRP, another router cannot take over an active role until the current active router fails. GLBP does allow a router to preempt and become the AVG if it has a higher priority than the current AVG. Use the following command to enable preempting and to set a time delay before preempting begins: +Switch(config-if)# glbp group preempt [delay minimum seconds] + +Routers participating in GLBP must monitor each other’s presence so that another router can assume the role of a failed router. To do this, the AVG sends periodic hello messages to each of the other GLBP peers. In addition, it expects to receive hello messages from each of them. + +Hello messages are sent at hellotime intervals, with a default of 3 seconds. If hellos are not received from a peer within a holdtime, defaulting to 10 seconds, that peer is pre-sumed to have failed. You can adjust the GLBP timers with the following interface con-figuration command: +Switch(config-if)# glbp group timers [msec] hellotime [ msec] holdtime + +The timer values normally are given in seconds, unless they are preceded by the msec keyword, to indicate milliseconds. The hellotime can range from 1 to 60 seconds or from 50 to 60,000 milliseconds. The holdtime must be greater than the hellotime and can go up to 180 seconds or 180,000 milliseconds. You always should make the holdtime at least three times greater than the hellotime to give some tolerance to missed or delayed hellos from a functional peer. + + +Tip Although you can use the previous command to configure the GLBP timers on each peer router, it is not necessary. Instead, just configure the timers on the router you have identified as the AVG. The AVG will advertise the timer values it is using, and every other peer will learn those values if they have not already been explicitly set. + + + +Active Virtual Forwarder + +Each router participating in the GLBP group can become an AVF, if the AVG assigns it that role, along with a virtual MAC address. The virtual MAC addresses always have the form 0007.b4xx.xxyy. The 16-bit value denoted by xx.xx represents six 0 bits followed by a 10-bit GLBP group number. The 8-bit yy value is the virtual forwarder number. + +By default, GLBP uses the periodic hello messages to detect AVF failures, too. Each router within a GLBP group must send hellos to every other GLBP peer. Hellos also are + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 399 + +expected from every other peer. For example, if hellos from the AVF are not received by the AVG before its Hold-Time timer expires, the AVG assumes that the current AVF has failed. The AVG then assigns the AVF role to another router. + +Naturally, the router that is given the new AVF role might already be an AVF for a dif-ferent virtual MAC address. Although a router can masquerade as two different virtual MAC addresses to support the two AVF functions, it does not make much sense to continue doing that for a long period of time. The AVG maintains two timers that help resolve this condition. + +The redirect timer is used to determine when the AVG will stop using the old virtual MAC address in ARP replies. The AVF corresponding to the old address continues to act as a gateway for any clients that try to use it. + +When the timeout timer expires, the old MAC address and the virtual forwarder using it are flushed from all the GLBP peers. The AVG assumes that the previously failed AVF will not return to service, so the resources assigned to it must be reclaimed. At this point, cli-ents still using the old MAC address in their ARP caches must refresh the entry to obtain the new virtual MAC address. + +The redirect timer defaults to 600 seconds (10 minutes) and can range from 0 to 3600 seconds (1 hour). The timeout timer defaults to 14,400 seconds (4 hours) and can range from 700 to 64,800 seconds (18 hours). You can adjust these timers with the following interface configuration command: +Switch(config-if)# glbp group timers redirect redirect timeout + +GLBP also can use a weighting function to determine which router becomes the AVF for a virtual MAC address in a group. Each router begins with a maximum weight value (1 to 254). As specific interfaces go down, the weight is decreased by a configured amount. GLBP uses thresholds to determine when a router can and cannot be the AVF. If the weight falls below the lower threshold, the router must give up its AVF role. When the weight rises above the upper threshold, the router can resume its AVF role. + +By default, a router receives a maximum weight of 100. If you want to make a dynamic weighting adjustment, GLBP must know which interfaces to track and how to adjust the weight. You must first define an interface as a tracked object with the following global configuration command: +Switch(config)# track object-number interface type member/module/number { line-protocol | ip routing} + +The object-number is an arbitrary index (1 to 500) that is used for weight adjustment. The condition that triggers an adjustment can be line-protocol (the interface line protocol is up) or ip routing. (IP routing is enabled, the interface has an IP address, and the interface is up.) + +Next, you must define the weighting thresholds for the interface with the following inter-face configuration command: +Switch(config-if)# glbp group weighting maximum [ lower lower] [upper upper] + + + + +From the Library of Outcast Outcast +400 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +The maximum weight can range from 1 to 254 (default 100). The upper (default maxi-mum) and lower (default 1) thresholds define when the router can and cannot be the AVF, respectively. + +Finally, you must configure GLBP to know which objects to track so that the weighting can be adjusted with the following interface configuration command: +Switch(config-if)# glbp group weighting track object-number [ decrement value] + +When the tracked object fails, the weighting is decremented by value (1 to 254, default 10). + +Likewise, a router that might serve as an AVF cannot preempt another when it has a higher weight value. + +GLBP Load Balancing + +The AVG establishes load balancing by handing out virtual router MAC addresses to clients in a deterministic fashion. Naturally, the AVG first must inform the AVFs in the group of the virtual MAC address that each should use. Up to four virtual MAC address-es, assigned in sequential order, can be used in a group. + +You can use one of the following load-balancing methods in a GLBP group: Key +Topic ■ Round robin: Each new ARP request for the virtual router address receives the next +available virtual MAC address in reply. Traffic load is distributed evenly across all routers participating as AVFs in the group, assuming that each of the clients sends and receives the same amount of traffic. This is the default method used by GLBP. +■ Weighted: The GLBP group interface’s weighting value determines the proportion of traffic that should be sent to that AVF. A higher weighting results in more frequent ARP replies containing the virtual MAC address of that router. If interface tracking is not configured, the maximum weighting value configured is used to set the relative proportions among AVFs. +■ Host dependent: Each client that generates an ARP request for the virtual router address always receives the same virtual MAC address in reply. This method is used if the clients have a need for a consistent gateway MAC address. (Otherwise, a client could receive replies with different MAC addresses for the router over time, depend-ing on the load-balancing method in use.) + +On the AVG router (or its successors), use the following interface configuration command to define the method: +Switch(config-if)# glbp group load-balancing [round-robin | weighted | host-dependent] + +Enabling GLBP + +To enable GLBP, you must assign a virtual IP address to the group by using the following interface configuration command: +Switch(config-if)# glbp group ip [ip-address [secondary]] + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 401 + +If the ip-address is not given in the command, it is learned from another router in the group. However, if this router is to be the AVG, you must explicitly configure the IP address; otherwise, no other router knows what the value should be. + + +Note GLBP can also be used with IPv6. Rather than specifying an IPv6 address, use the following command to autoconfigure the address: +Switch(config-if)# glbp group ipv6 autoconfigure + + +Figure 18-3 shows a typical network in which three multilayer switches are participating in a common GLBP group. Switch A is elected the AVG, so it coordinates the entire GLBP process. The AVG answers all ARP requests for the virtual router 192.168.1.1. It has identi-fied itself, Switch B, and Switch C as AVFs for the group. +In this figure, round-robin load balancing is being used. Each of the client PCs sends an ARP request to look for the virtual router address (192.168.1.1) in turn, from left to right. Each time the AVG replies, the next sequential virtual MAC address is sent back to a cli-ent. After the fourth PC sends a request, all three virtual MAC addresses (and AVF rout-ers) have been used, so the AVG cycles back to the first virtual MAC address. +Notice that only one GLBP group has been configured, and all clients know of only one gateway IP address: 192.168.1.1. However, all uplinks are being used, and all routers are proportionately forwarding traffic. + + +AVG +AVF vMAC 0007.b400.0101 +VLAN 50 192.168.1.10 0000.aaaa.aaaa + +Switch A + +Standby AVG +AVF vMAC 0007.b400.0102 +VLAN 50 192.168.1.11 0000.bbbb.bbbb + +Switch B + + +AVF vMAC 0007.b400.0103 +VLAN 50 192.168.1.12 0000.cccc.cccc + +Switch C + + + + + +AVG: +All ARP Replies for 192.168.1.1 + + + +Outbound Traffic to Gateways + + + + + + +Gateway: 192.168.1.1 Gateway ARP: 0007.b400.0101 + +Gateway: 192.168.1.1 Gateway ARP: 0007.b400.0102 + +Gateway: 192.168.1.1 Gateway: 192.168.1.1 Gateway ARP: 0007.b400.0103 Gateway ARP: 0007.b400.0101 + +VLAN 50 Figure 18-3 Multilayer Switches in a GLBP Group + +From the Library of Outcast Outcast +402 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Redundancy is also inherent in the GLBP group: Switch A is the AVG, but the next-high-est priority router can take over if the AVG fails. All routers have been given an AVF role for a unique virtual MAC address in the group. If one AVF fails, some clients remember the last-known virtual MAC address that was handed out. Therefore, another of the rout-ers also takes over the AVF role for the failed router, causing the virtual MAC address to remain alive at all times. +Figure 18-4 shows how these redundancy features react when the current active AVG fails. Before its failure, Switch A was the AVG because of its higher GLBP priority. After it failed, Switch B became the AVG, answering ARP requests with the appropriate virtual MAC address for gateway 192.168.1.1. Switch A also had been acting as an AVF, partici-pating in the gateway load balancing. Switch B also picks up this responsibility, using +its virtual MAC address 0007.b400.0102 along with the one Switch A had been using, 0007.b400.0101. Therefore, any hosts that know the gateway by any of its virtual MAC addresses still can reach a live gateway or AVF. +You can implement the scenario shown in Figures 18-3 and 18-4 with the configuration commands in Example 18-7 for Switch A, Switch B, and Switch C, respectively. + + + +AVG +AVF vMAC 0007.b400.0101 GLBP Group 1 Priority 200 VLAN 50 192.168.1.10 0000.aaaa.aaaa + +Switch A + +Active AVG +AVF vMAC 0007.b400.0102 AVF vMAC 0007.b400.0101 +GLBP Group 1 Priority 150 VLAN 50 +192.168.1.11 0000.bbbb.bbbb + +Switch B + +AVG: +All ARP Replies for 192.168.1.1 + + + +AVF vMAC 0007.b400.0103 GLBP Group 1 Priority 100 VLAN 50 192.168.1.12 0000.cccc.cccc + +Switch C + + + + + + + +Outbound Traffic to Gateways + + + + + +VLAN 50 + +Gateway: 192.168.1.1 Gateway ARP: 0007.b400.0101 +Gateway: 192.168.1.1 Gateway ARP: 0007.b400.0102 + +Gateway: 192.168.1.1 Gateway ARP: 0007.b400.0101 +Gateway: 192.168.1.1 Gateway ARP: 0007.b400.0103 + + +Figure 18-4 How GLBP Reacts to a Component Failure + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 403 + +Example 18-7 Configuring GLBP Load Balancing + +Switch-A(config)# interface vlan 50 +Switch-A(config-if)# ip address 192.168.1.10 255.255.255.0 +Switch-A(config-if)# glbp 1 priority 200 +Switch-A(config-if)# glbp 1 preempt +Switch-A(config-if)# glbp 1 ip 192.168.1.1 + +Switch-B(config)# interface vlan 50 +Switch-B(config-if)# ip address 192.168.1.11 255.255.255.0 +Switch-B(config-if)# glbp 1 priority 150 +Switch-B(config-if)# glbp 1 preempt +Switch-B(config-if)# glbp 1 ip 192.168.1.1 + +Switch-C(config)# interface vlan 50 +Switch-C(config-if)# ip address 192.168.1.12 255.255.255.0 +Switch-C(config-if)# glbp 1 priority 100 +Switch-C(config-if)# glbp 1 ip 192.168.1.1 + +You can verify GLBP operation with the show glbp [brief] command, as demonstrated in Example 18-8. With the brief keyword, the GLBP roles are summarized showing the interface, GLBP group number (Grp), virtual forwarder number (Fwd), GLBP priority (Pri), state, and addresses. + +Example 18-8 Verifying GLBP Operation + +Switch-A# show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Vl50 1 - 200 Active 192.168.1.1 local 192.168.1.11 + +Vl50 1 +Vl50 1 +Vl50 1 +Switch-A# + +1 7 Active +2 7 Listen +3 7 Listen + +0007.b400.0101 +0007.b400.0102 +0007.b400.0103 + +local - +192.168.1.11 - +192.168.1.12 - + + +Switch-B# show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Vl50 1 - 150 Standby 192.168.1.1 192.168.1.10 local + +Vl50 1 +Vl50 1 +Vl50 1 +Switch-B# + +1 7 Listen +2 7 Active +3 7 Listen + +0007.b400.0101 +0007.b400.0102 +0007.b400.0103 + +192.168.1.10 - +local - +192.168.1.12 - + + +Switch-C# show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Vl50 1 - 100 Listen 192.168.1.1 192.168.1.10 192.168.1.11 +Vl50 1 1 7 Listen 0007.b400.0101 192.168.1.10 - + + + + +From the Library of Outcast Outcast +404 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Vl50 1 +Vl50 1 +Switch-C# + +2 7 Listen +3 7 Active + +0007.b400.0102 +0007.b400.0103 + +192.168.1.11 - +local - + + +Notice that Switch A is shown to be the AVG because it has a dash in the Fwd column and is in the Active state. It also is acting as AVF for virtual forwarder number 1. Because the GLBP group has three routers, there are three virtual forwarders and virtual MAC addresses. Switch A is in the Listen state for forwarders number 2 and 3, waiting to be given an active role in case one of those AVFs fails. + +Switch B is shown to have the Standby role, waiting to take over in case the AVG fails. It is the AVF for virtual forwarder number 2. + +Finally, Switch C has the lowest GLBP priority, so it stays in the Listen state, waiting for the active or standby AVG to fail. It is also the AVF for virtual forwarder number 3. + +You also can display more detailed information about the GLBP configuration and sta-tus by omitting the brief keyword. Example 18-9 shows this output on the AVG router. Because this is the AVG, the virtual forwarder roles it has assigned to each of the routers in the GLBP group also are shown. + +Example 18-9 Displaying Detailed GLBP Configuration and Status Information + +Switch-A# show glbp +Vlan50 - Group 1 +State is Active +7 state changes, last state change 03:28:05 +Virtual IP address is 192.168.1.1 +Hello time 3 sec, hold time 10 sec +Next hello sent in 1.672 secs +Redirect time 600 sec, forwarder time-out 14400 sec +Preemption enabled, min delay 0 sec +Active is local +Standby is 192.168.1.11, priority 150 (expires in 9.632 sec) +Priority 200 (configured) +Weighting 100 (default 100), thresholds: lower 1, upper 100 +Load balancing: round-robin +There are 3 forwarders (1 active) +Forwarder 1 +State is Active +3 state changes, last state change 03:27:37 +MAC address is 0007.b400.0101 (default) +Owner ID is 00d0.0229.b80a +Redirection enabled +Preemption enabled, min delay 30 sec +Active is local, weighting 100 +Forwarder 2 +State is Listen + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 405 + +MAC address is 0007.b400.0102 (learnt) +Owner ID is 0007.b372.dc4a +Redirection enabled, 598.308 sec remaining (maximum 600 sec) +Time to live: 14398.308 sec (maximum 14400 sec) +Preemption enabled, min delay 30 sec +Active is 192.168.1.11 (primary), weighting 100 (expires in 8.308 sec) +Forwarder 3 +State is Listen +MAC address is 0007.b400.0103 (learnt) +Owner ID is 00d0.ff8a.2c0a +Redirection enabled, 599.892 sec remaining (maximum 600 sec) +Time to live: 14399.892 sec (maximum 14400 sec) +Preemption enabled, min delay 30 sec +Active is 192.168.1.12 (primary), weighting 100 (expires in 9.892 sec) +Switch-A# + + +Verifying Gateway Redundancy + +To verify the operation of the features discussed in this chapter, you can use the com-mands listed in Table 18-4 . In particular, look for the active, standby, or backup routers in use. + + +Table 18-4 + +Task + + +Gateway Redundancy Verification Commands + +Command Syntax + + + +HSRP and VRRP + +Display HSRP status. + +Display HSRP on an interface. + +Display VRRP status. + +Display VRRP on an interface. + +GLBP + +Display status of a GLBP group. + + +Switch# show standby brief + +Switch# show standby type member/module/number + +Switch# show vrrp brief all + +Switch# show vrrp interface type member/module/ number + + +Switch# show glbp [group] [brief] + + + + + + + + + + + + + + +From the Library of Outcast Outcast +406 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 18-5 lists a reference of these key topics and the page numbers on which each is found. + +Table 18-5 Key Topics for Chapter 18 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +List + +Explains HSRP active and standby routers 385 + +Describes the virtual MAC address used by HSRP 390 + +Discusses VRRP master and backup routers and the 394 virtual MAC address +Describes the GLBP active virtual gateway and 397 active virtual forwarder roles +Describes the methods GLBP uses for load 400 balancing traffic within a GLBP group + + + + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answer Key,” also on the CD, includes completed tables and lists to check your work. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +HSRP active router, HSRP standby router, VRRP master router, VRRP backup router, active virtual gateway (AVG), active virtual forwarder (AVF) + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + + + + +From the Library of Outcast Outcast +Chapter 18: Layer 3 High Availability 407 + +To test your memory of the configuration commands presented in this chapter, cover the right side of Tables 18-6 through 18-8 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + +Table 18-6 + +Task + + +HSRP Configuration Commands + +Command Syntax + + + +Set the HSRP priority. + +Set the HSRP timers. + +Allow router preemption. + +Use group authentication. + + +Switch(config-if)# standby group priority priority + +Switch(config-if)# standby group timers hello holdtime + +Switch(config-if)# standby group preempt [delay seconds] + +Switch(config-if)# standby group authentication string + +Adjust priority by tracking an interface. Switch(config-if)# standby group track type member/module/number decrementvalue +Assign the virtual router address. Switch(config-if)# standby group ip ip address [secondary ] + + + + +Table 18-7 + +Task + + +VRRP Configuration Commands + +Command Syntax + + + +Assign a VRRP router priority (default 100). + +Alter the advertisement timer (default 1 second). + +Learn the advertisement interval from the master router. +Disable preempting (default is to preempt). + +Change the preempt delay (default 0 seconds). + +Use authentication for advertisements. + +Assign a virtual IP address. + + +Switch(config-if)# vrrp group priority level + +Switch(config-if)# vrrp group timers advertise [msec] interval + +Switch(config-if)# vrrp group timers learn + +Switch(config-if)# no vrrp group preempt + +Switch(config-if)# vrrp group preempt [delay seconds] + +Switch(config-if)# vrrp group authentication string + +Switch(config-if)# vrrp group ip ip-address [secondary ] + + + + + + + + + + +From the Library of Outcast Outcast +408 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Table 18-8 + +Task + + +GLBP Configuration Commands + +Command Syntax + + + +Assign a GLBP priority. + +Allow GLBP preemption. + +Define an object to be tracked. + + +Define the weighting thresholds. + +Track an object. + +Choose the load-balancing method. + + +Assign a virtual router address. + + +Switch(config-if)# glbp group priority level + +Switch(config-if)# glbp group preempt [delay minimum seconds] + +Switch(config)# track object-number interface type member/module/number {line-protocol | ip routing} + +Switch(config-if)# glbp group weighting maximum [lower lower] [upper upper] + +Switch(config-if)# glbp group weighting track object-number [decrement value ] + +Switch(config-if)# glbp group load-balancing [round-robin | weighted | host-dependent] + +Switch(config-if)# glbp group ip [ip-address [secondary ]] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Port Security: This section explains how to con-figure switch ports to allow network access to only hosts with specific or learned MAC addresses. +■ Port-Based Authentication: This section discusses a method you can use to require user authentication before network access is offered to a client host. +■ Using Storm Control: This section explains how you can configure a method to limit the effects of traffic storms coming from devices that are con-nected to a switch. +■ Best Practices for Securing Switches: This sec-tion provides several guidelines for tightening con-trol over Catalyst switches and the protocols they use for switch communication and maintenance. + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 19 + + + + + + +Securing Switch Access + + +Traditionally, users have been able to connect a PC to a switched network and gain imme-diate access to enterprise resources. As networks grow and as more confidential data and restricted resources become available, it is important to limit the access that users receive. + +Catalyst switches have a variety of methods that can secure or control user access. Users can be authenticated as they connect to or through a switch and can be authorized to perform certain actions on a switch. User access can be recorded as switch accounting information. The physical switch port access also can be controlled based on the user’s MAC address or authentication. + +In addition, Catalyst switches can detect and prevent certain types of attacks. Several features can be used to validate information passing through a switch so that spoofed addresses cannot be used to compromise hosts. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 19-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 19-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Port Security + +Port-Based Authentication + +Using Storm Control + +Best Practices for Securing Switches + +Questions Covered in This Section +1–4 + +5–9 + +10-11 + +12–13 + + + + + + + + +From the Library of Outcast Outcast +412 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +1. Which switch feature can grant access through a port only if the host with MAC address 0005.0004.0003 is connected? + +a. SPAN + +b. MAC address ACL + +c. Port security + +d. Port-based authentication + +2. Port security is being used to control access to a switch port. Which one of these commands will put the port into the errdisable state if an unauthorized station connects? +a. switchport port-security violation protect + +b. switchport port-security violation restrict + +c. switchport port-security violation errdisable + +d. switchport port-security violation shutdown + +3. If port security is enabled and left to its default configuration, how many different MAC addresses can be learned at one time on a switch port? + +a. 0 + +b. 1 + +c. 16 + +d. 256 + +4. The following commands are configured on a Catalyst switch port. What happens when the host with MAC address 0001.0002.0003 tries to connect? + +switchport port-security +switchport port-security maximum 3 +switchport port-security mac-address 0002.0002.0002 +switchport port-security violation shutdown + +a. The port shuts down. + +b. The host is allowed to connect. + +c. The host is denied a connection. + +d. The host can connect only when 0002.0002.0002 is not connected. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 413 + +5. What protocol is used for port-based authentication? + +a. 802.1D + +b. 802.1Q + +c. 802.1X + +d. 802.1w + +6. When 802.1X802.1X is used for a switch port, where must it be configured? + +a. Switch port and client PC + +b. Switch port only + +c. Client PC only + +d. Switch port and a RADIUS server + +7. When port-based authentication is enabled globally, what is the default behavior for all switch ports? + +a. Authenticate users before enabling the port. + +b. Allow all connections without authentication. + +c. Do not allow any connections. + +d. There is no default behavior. + +8. When port-based authentication is enabled, what method is available for a user to authenticate? + +a. Web browser + +b. Telnet session + +c. 802.1X client + +d. DHCP + +9. The users in a department are using a variety of host platforms, some old and some new. All of them have been approved with a user ID in a RADIUS server database. Which one of these features should be used to restrict access to the switch ports in the building? +a. AAA authentication + +b. AAA authorization + +c. Port security + +d. Port-based authentication + + + + + + + +From the Library of Outcast Outcast +414 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +10. Which of the following are types of frames that Storm Control can limit before they can cause problems for hosts that are connected to a switch? (Choose all that apply.) + +a. Unicast frames + +b. Broadcast frames + +c. Multicast frames + +d. Unknown unicast frames + +11. Suppose that an interface receives the following configuration command: + +storm-control broadcast level 10 +Storm control will be triggered when which one of the following rising thresholds is reached? +a. At least 10 broadcast frames are received + +b. At least 10 hosts are connected to a VLAN that will receive a flooded broadcast frame + +c. Broadcast frames exceed 10 percent of the interface bandwidth + +d. Broadcast frames exceed 10 percent of the interface MTU size + +12. Which two of the following methods should you use to secure inbound CLI sessions to a switch? + +a. Disable all inbound CLI connections. + +b. Use SSH only. + +c. Use Telnet only. + +d. Apply an access list to the vty lines. + +13. Suppose that you need to disable CDP and LLDP advertisements on a switch port so that untrusted devices cannot learn anything about your switch. Which one of the following answers contains the interface configuration commands that should be used? +a. cdp disable + +lldp disable + +b. no cdp + +no lldp + +c. no cdp enable + +no lldp transmit + +d. no cdp transmit + +no lldp transmit + + + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 415 + +Foundation Topics + + +Port Security + +In some environments, a network must be secured by controlling what stations can gain access to the network itself. Where user workstations are stationary, their MAC addresses always can be expected to connect to the same access layer switch ports. If stations are mobile, their MAC addresses can be learned dynamically or added to a list of addresses to expect on a switch port. + +Catalyst switches offer the port security feature to control port access based on MAC addresses. To configure port security on an access layer switch port, begin by enabling it on a per-interface basis with the following interface-configuration command: +Switch(config-if)# switchport port-security + +Next, you must identify a set of allowed MAC addresses so that the port can grant them access. You can explicitly configure addresses or they can be learned dynamically from port traffic. On each interface that uses port security, specify the maximum number of MAC addresses that will be allowed access using the following interface configuration command: +Switch(config-if)# switchport port-security maximum max-addr + + + + + + +Key Topic + +By default, port security will make sure that only one MAC address will be allowed access on each switch port. You can set the maximum number of addresses in the range of 1 to 1024. + +Each interface using port security dynamically learns MAC addresses by default and expects those addresses to appear on that interface in the future. MAC addresses are learned as hosts transmit frames on an interface. The interface learns up to the maximum number of addresses allowed. Learned addresses also can be aged out of the table if those hosts are silent for a period of time. By default, no aging occurs. + +For example, to set the maximum number of MAC addresses that can be active on a switch port at any time to two, you could use the following command: +Switch(config-if)# switchport port-security maximum 2 + + +By default, port security learns MAC addresses dynamically and stores them in the CAM table and also in the running configuration. If the switch reboots for some reason, port security will have to relearn a new set of MAC addresses. To make the learned addresses persistent across a switch reboot, you can enable “sticky” MAC address learning with the following command: +Switch(config-if)# switchport port-security mac-address sticky + + + + + +From the Library of Outcast Outcast +416 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +You also can statically define one or more MAC addresses on an interface. Any of these addresses are allowed to access the network through the port. Use the following interface configuration command to define a static address: +Switch(config-if)# switchport port-security mac-address mac-addr + +The MAC address is given in dotted-triplet format. If the number of static addresses con-figured is less than the maximum number of addresses secured on a port, the remaining addresses are learned dynamically. Be sure to set the maximum number appropriately. + +As an example, you could use the following command to configure a static address entry on an interface, so that 0006.5b02.a841 will be expected: +Switch(config-if)# switchport port-security mac-address 0006.5b02.a841 + +Finally, you must define how each interface using port security should react if a MAC address is in violation by using the following interface-configuration command: +Switch(config-if)# switchport port-security violation {shutdown | restrict | protect} + +A violation occurs if more than the maximum number of MAC addresses are learned or if an unknown (not statically defined) MAC address attempts to transmit on the port. The switch port takes one of the following configured actions when a violation is detected: + + +■ +Key Topic + + +■ + + + +■ + +Shutdown: The port immediately is put into the errdisable state, which effectively shuts it down. It must be reenabled manually or through errdisable recovery to be used again. + +Restrict: The port is allowed to stay up, but all packets from violating MAC address-es are dropped. The switch keeps a running count of the number of violating packets and can send an SNMP trap and a syslog message as an alert of the violation. + +Protect: The port is allowed to stay up, as in the restrict mode. Although packets +from violating addresses are dropped, no record of the violation is kept. + + +As an example of the restrict mode, a switch interface has received the following configu-ration commands: + +interface GigabitEthernet1/0/11 +switchport access vlan 991 +switchport mode access +switchport port-security +switchport port-security violation restrict +spanning-tree portfast + +When the default maximum of one MAC address is exceeded on this interface, the con-dition is logged but the interface stays up. This is shown by the following syslog message: +Jun 3 17:18:41.888 EDT: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0000.5e00.0101 on port GigabitEthernet1/0/11. + + + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 417 + + +Tip If an interface is undergoing the restrict or protect condition, you might need to clear the learned MAC addresses so that a specific host can use the switch port. You can clear a MAC address or the complete port cache with the following command: +Switch# clear port-security {all | configured | dynamic | sticky} +[address mac-addr | interface type member/mod/num] + + +In the shutdown mode, the port security action is much more drastic. When the maxi-mum number of MAC addresses is exceeded, the following syslog messages indicate that the port has been shut down in the errdisable state: + +Jun 3 17:14:19.018 EDT: %PM-4-ERR_DISABLE: psecure-violation error detected on Gi1/0/11, putting Gi1/0/11 in err-disable state +Jun 3 17:14:19.022 EDT: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0003.a089.efc5 on port GigabitEthernet1/0/11. +Jun 3 17:14:20.022 EDT: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/11, changed state to down +Jun 3 17:14:21.023 EDT: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/11, changed state to down + +You also can show the port status with the show port-security interface command, as demonstrated in Example 19-1. + +Example 19-1 Displaying Port Security Port Status + +Switch# show port-security interface gigabitethernet 1/0/11 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-shutdown +: Shutdown +: 0 mins +: Absolute + + + +SecureStatic Address Aging +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address +Security Violation Count +Switch# + +: Disabled +: 1 +: 0 +: 0 +: 0 +: 0003.a089.efc5 +: 1 + + +To see a quick summary of only ports in the errdisable state, along with the reason for errdisable, you can use the show interfaces status err-disabled command, as demon-strated in Example 19-2. + + + + + + + +From the Library of Outcast Outcast +418 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 19-2 Displaying Summary Information for Ports in the Errdisable State + +Switch# show interfaces status err-disabled +Port Name Status Reason +Gi1/0/11 Test port err-disabled psecure-violation +Switch# + + +Tip When a port is moved to the errdisable state, you must either manually cycle it or configure the switch to automatically re-enable ports after a prescribed delay. To manually cycle a port and return it to service, use the following commands: +Switch(config)# interface type member/mod/num +Switch(config-if)# shutdown +Switch(config-if)# no shutdown + + +Finally, you can display a summary of the port-security status with the show port-security command, as demonstrated in Example 19-3. + +Example 19-3 Displaying Port Security Status Summary Information + +Switch# show port-security + +Secure Port MaxSecureAddr +(Count) + +CurrentAddr +(Count) + +SecurityViolation Security Action +(Count) + +--------------------------------------------------------------------------- + +Gi1/0/11 5 1 +Gi1/0/12 1 0 + +0 Restrict +0 Shutdown + +--------------------------------------------------------------------------- +Total Addresses in System (excluding one mac per port) : 0 +Max Addresses limit in System (excluding one mac per port) : 6176 +Switch# + + + + + + + + + + +Key Topic + +Port-Based Authentication + +Catalyst switches can support port-based authentication, a combination of AAA authen-tication and port security. This feature is based on the IEEE 802.1X standard. When it +is enabled, a switch port will not pass any traffic until a user has authenticated with the switch. If the authentication is successful, the user can use the port normally. + +For port-based authentication, both the switch and the end user’s PC must support the 802.1X standard, using the Extensible Authentication Protocol over LANs (EAPOL). The 802.1X standard is a cooperative effort between the client and the switch offering +network service. If the client PC is configured to use 802.lx but the switch does not sup-port it, the PC abandons the protocol and communicates normally. However, if the switch is configured for 802.1X but the PC does not support it, the switch port remains in the +unauthorized state so that it will not forward any traffic to the client PC. + + + + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 419 + + +Note 802.1X EAPOL is a Layer 2 protocol. At the point that a switch detects the pres-ence of a device on a port, the port remains in the unauthorized state. Therefore, the client PC cannot communicate with anything other than the switch by using EAPOL. If the PC does not already have an IP address, it cannot request one. The PC also has no knowledge of the switch or its IP address, so any means other than a Layer 2 protocol is not possible. This is why the PC must also have an 802.1X-capable application or client software. + + +An 802.1X switch port begins in the unauthorized state so that no data other than the 802.1X protocol itself is allowed through the port. Either the client or the switch can initiate an 802.1X session. The authorized state of the port ends when the user logs out, causing the 802.1X client to inform the switch to revert back to the unauthorized state. The switch can also time out the user’s authorized session. If this happens, the client must reauthenticate to continue using the switch port. + +802.1X Configuration + +Port-based authentication can be handled by one or more external Remote Authentication Dial-In User Service (RADIUS) servers. Although many Cisco switch plat-forms allow other authentication methods to be configured, only RADIUS is supported for 802.1X. + +The actual RADIUS authentication method must be configured first, followed by 802.1X, as shown in the following steps: +Step 1. Enable AAA on the switch.By default, AAA is disabled. You can enable AAA for port-based authentication by using the following global configuration command: +Switch(config)# aaa new-model + +The new-model keyword refers to the use of method lists, by which authenti-cation methods and sources can be grouped or organized. The new model is much more scalable than the “old model,” in which the authentication source was explicitly configured. +Step 2. Define external RADIUS servers. + +First, define each server along with its secret shared password. This string is known only to the switch and the server, and provides a key for encrypting the authentication session. Use the following global configuration command: + +Switch(config)# radius-server host{hostname | ip-address} [key string] + +This command can be repeated to define additional RADIUS servers. + +Step 3. Define the authentication method for 802.1X. + +Using the following command causes all RADIUS authentication servers that are defined on the switch to be used for 802.1X authentication: + +Switch(config)#aaa authentication dot1x default group radius + + +From the Library of Outcast Outcast +420 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Step 4. Enable 802.1X on the switch: + +Switch(config)#dot1x system-auth-control + +Step 5. Configure each switch port that will use 802.1X: + +Switch(config)# interfacetype mod/num +Switch(config-if)# dot1x port-control {force-authorized | force-unauthorized | auto} +Here, the 802.1X state is one of the following: + +■ force-authorized: The port is forced to always authorize any connected client. No authentication is necessary. This is the default state for all switch ports when 802.1X is enabled. + +■ force-unauthorized: The port is forced to never authorize any connected client. As a result, the port cannot move to the authorized state to pass traffic to a connected client. + +■ Auto: The port uses an 802.1X exchange to move from the unauthorized to the authorized state, if successful. This requires an 802.1X-capable application on the client PC. + + +Tip After 802.1X is globally enabled on a switch, all switch ports default to the force-authorized state. This means that any PC connected to a switch port can immediately start accessing the network. Ideally, you should explicitly configure each port to use the auto state so that connected PCs are forced to authenticate through the 802.1X exchange. + + +Step 6. Allow multiple hosts on a switch port. +It might be obvious that port-based authentication is tailored to controlling access to a single host PC that is connected to a switch port. However, 802.1X also supports cases in which multiple hosts are attached to a single switch port through an Ethernet hub or another access layer switch. +If the switch should expect to find multiple hosts present on the switch port, use the following interface configuration command: + +Switch(config-if)# dot1x host-mode multi-host + + +Tip You can use the show dot1x all command to verify the 802.1X operation on each switch port that is configured to use port-based authentication. + + + +802.1X Port-Based Authentication Example + +In Example 19-4, two RADIUS servers are located at 10.1.1.1 and 10.1.1.2. Switch ports Gigabit Ethernet 1/0/1 through 1/0/40 will use 802.1X for port-based authentication. When authenticated, the end users will be associated with VLAN 10. + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 421 + +Example 19-4 Configuring 802.1X Port-Based Authentication + +Switch(config)# aaa new-model +Switch(config)# radius-server host 10.1.1.1 key BigSecret +Switch(config)# radius-server host 10.1.1.2 key AnotherBigSecret +Switch(config)# aaa authentication dot1x default group radius +Switch(config)# dot1x system-auth-control +Switch(config)# interface range gigabitethernet1/0/1 - 40 +Switch(config-if)# switchport access vlan 10 +Switch(config-if)# switchport mode access +Switch(config-if)# dot1x port-control auto + + +Using Storm Control + +Recall from Chapter 2, “Switch Operation,” that a LAN switch makes a network operate more efficiently by breaking it up into many isolated portions. A single host can connect to a single switch port, forming a tiny collision domain. More importantly, a switch uses a destination MAC address to deliver a frame to the switch port where the corresponding host is connected. For the most part, each host receives only the frames that are meant +to reach it. Frame delivery is streamlined and hosts are spared spending their resources receiving and discarding unnecessary and unrelated frames. + +Three exceptions apply to this idealized scenario: + +■ Broadcast frames + +■ Multicast frames + +■ Unknown unicast frames + +In each of these cases, frames have a destination MAC address that is not specific or one that cannot be located. Therefore, the frames must be flooded or delivered to multiple hosts over multiple switch ports. Some amount of flooded traffic is normal and should be expected. After all, hosts must rely on broadcasts like ARP requests to find other hosts. Until a host transmits a frame and the switch learns its MAC address, the switch must flood frames destined for the host. + +However, it is entirely possible to have an excessive amount of flooded traffic on a network. For example, a host might have a runaway process or malicious software that sends a broadcast storm into its local VLAN. Another host might set aside one network interface card (NIC) to receive traffic and another one to transmit traffic. The receiving NIC will never send a frame, so the switch will never learn its MAC address. As a result, all traffic destined for the receiving NIC will be flooded to all hosts on the VLAN as unknown unicast frames. + +By default, frames will be flooded at the same rate they are received by a switch. Under normal conditions, the volume of flooded frames should not be too great for hosts to handle. Under extreme conditions, flooded frames can overwhelm many hosts. You can leverage the Storm Control feature to set limits on flooded traffic before it can cause problems on your network. + + +From the Library of Outcast Outcast +422 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Storm Control is configured on a per-interface basis to monitor traffic that is arriving or being received at the interface, as shown in Figure 19-1. The idea is to take action on frames as they enter the switch and arrive at the internal switching bus, before they are +flooded to multiple switch ports. You can configure thresholds for the amount of broad-cast, multicast, or unknown unicast traffic and an action to be taken when the thresholds are exceeded. + + + + +Storm Control + + + + + + + +PC-A + + + + + + + + +Figure 19-1 Using Storm Control to Limit Received Frames Before They Are Flooded + + + +Key Topic + +First, select an interface where frames might be received and flooded. Then configure a threshold using the following interface configuration command: + +Switch(config-if)# storm-control {broadcast | multicast | unicast} +level { level [level-low] | bps bps [bps-low] | pps pps [ pps-low]} + + +Select the type of threshold with the broadcast, multicast, or unicast keyword. Keep in mind that “unicast” actually means unknown unicast; otherwise, the threshold would limit the volume of normal unicast frames passing through the interface. + +You can set the traffic threshold with the level keyword and one of the following key-words and values: + +■ level [level-low]: The threshold is set to a percentage of the interface bandwidth. The level and level-low percentages can be a value with two decimal places from 0.00 +to 100.00. + +■ bps bps [bps-low]: The threshold is set to a specific bits per second rate. The bps and bps-low values can range from 0.0 to 10000000000.0 (10 Gbps), with one deci-mal place. + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 423 + +■ pps pps [pps-low]: The threshold is set to a specific packets per second rate. The pps and pps-low values can range from 0.0 to 10000000000.0 (10 Gbps), with one decimal place. + +Storm Control will take action when the flooded traffic rises to the first value, then will stop the action when the traffic falls below that value. You can set a different falling threshold by specifying the second -low value. + + +Tip Rather than counting zeroes for large bps and pps values, you can use k, m, and g to designate kilo-, mega-, and giga- units. + + +You can repeat the storm control command to define separate thresholds for broadcast, multicast, and unknown unicast traffic. + +Next, specify the action to be taken when the threshold is exceeded. By default, the excessive frames are simply dropped as they are received. In addition, you can use the following interface configuration command to shut down the interface in errdisable mode or to send an SNMP trap as an alert of a storm condition in progress: +Switch(config-if)# storm-control action { shutdown | trap} + +In Example 19-5, Storm Control is enabled for traffic received on interface Gigabit Ethernet 1/0/1. Because there is no storm control action command entered, the default action to drop excessive frames will be taken. When broadcast frames exceed 50 percent of the interface bandwidth, they will be dropped. When the rate of multicast frames exceeds 50,000 packets per second, they will be dropped. Finally, when the volume of unknown unicast frames rises above 20 percent and then stays above 10 percent of the interface bandwidth, they will be dropped. + +Example 19-5 Enabling Storm Control + +Switch(config)# interface gigabitethernet1/0/1 +Switch(config-if)# storm control broadcast level 50 +Switch(config-if)# storm control multicast level pps 50k +Switch(config-if)# storm control unicast level 20 10 + +You can display the rising and falling Storm Control thresholds, in addition to the current rate, with the following EXEC command: +Switch# show storm-control [interface-id] [broadcast | multicast | unicast] + + +Best Practices for Securing Switches + +Although you can configure and use many different features on Cisco Catalyst switches, you should be aware of some common weaknesses that can be exploited. In other words, do not become complacent and assume that everyone connected to your network will + + + +From the Library of Outcast Outcast +424 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +be good citizens and play by the rules. Think ahead and try to prevent as many things as possible that might be leveraged to assist an attacker. + +This section presents a brief overview of many best-practice suggestions that can help secure your switched network: + +■ Configure secure passwords: Whenever possible, you should use the enable secret command to set the privileged-level password on a switch. This command uses a stronger encryption than the normal enable password command. + +You also should use external AAA servers to authenticate administrative users when-ever possible. The usernames and passwords are maintained externally, so they are not stored or managed directly on the switch. In addition, having a centralized user management is much more scalable than configuring and changing user credentials on many individual switches and routers. + +Finally, you always should use the service password-encryption configuration com-mand to automatically encrypt password strings that are stored in the switch con-figuration. Although the encryption is not excessively strong, it can prevent casual observers from seeing passwords in the clear. + +■ Use system banners: When users successfully access a switch, they should be aware of any specific access or acceptable use policies that are pertinent to your organiza-tion. You should configure system banners so that this type of information is dis-played when users log in to a switch. The idea is to warn unauthorized users (if they gain access) that their activities could be grounds for prosecution—or that they are unwelcome, at the very least. + +You should use the banner motd command to define the text that is displayed to authenticated users. Try to avoid using other banner types that display information about your organization or the switch before users actually log in. Never divulge any extra information about your network that malicious users could use. + +■ Secure the web interface: Decide whether you will use the web interface to manage or monitor a switch. Some network professionals use the command line interface exclusively, so the web interface is not needed in a production environment. In this case, you should disable the web interface with the no ip http server global configu-ration command. + +If you do decide to use the web interface, be sure to use the HTTPS interface, if it is supported on the switch platform. The standard HTTP web interface has some glar-ing weaknesses, mainly because none of the traffic is encrypted or protected. Enable the HTTPS interface with the ip http secure server global configuration command instead of the ip http server command. + +In addition, try to limit the source addresses that can access the HTTPS interface. First, create an access list that permits only approved source addresses; then apply the access list to the HTTPS interface with the ip http access-class configuration + + + + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 425 + +command. As an example, the following configuration commands permit HTTPS connections that are sourced from the 10.100.50.0/24 network: +Switch(config)# ip http secure server +Switch(config)# access-list 1 permit 10.100.50.0 0.0.0.255 +Switch(config)# ip http access-class 1 + +■ Secure the switch console: In many environments, switches are locked away in wir-ing closets where physical security is used to keep people from connecting to the switch console. Even so, you always should configure authentication on any switch console. It is usually appropriate to use the same authentication configuration on the console as the virtual terminal (vty) lines. + +■ Secure virtual terminal access: You always should configure user authentication on all the vty lines on a switch. In addition, you should use access lists to limit the +source IP addresses of potential administrative users who try to use Telnet or Secure Shell (SSH) to access a switch. + +You can use a simple IP access list to permit inbound connections only from known source addresses, as in the following example: +Switch(config)# access-list 10 permit 192.168.199.10 +Switch(config)# access-list 10 permit 192.168.201.100 +Switch(config)# line vty 0 15 +Switch(config-line)# access-class 10 in + +Be sure you apply the access list to all the line vty entries in the switch configura-tion. Many times, the vty lines are separated into groups in the configuration. You can use the show user all command to see every possible line that can be used to access a switch. + +■ Use SSH whenever possible: Although Telnet access is easy to configure and use, Telnet is not secure. Every character you type in a Telnet session is sent to and echoed from a switch in the clear, with no encryption. Therefore, it is very easy to eavesdrop on Telnet sessions to overhear usernames and passwords. + +Instead, you should use SSH whenever possible. SSH uses strong encryption to secure session data. Therefore, you need a strong-encryption IOS image running on a switch before SSH can be configured and used. You should use the highest SSH version that is available on a switch. The early SSHv1 and SSHv1.5 have some weak-nesses, so you should choose SSHv2 with the ip ssh version 2 global configuration command whenever possible. + +■ Secure SNMP access: As a best practice, you should always leverage the secure fea-tures of SNMPv3. You should also prevent unauthorized users from making changes to a switch configuration by disabling any SNMPv1 or SNMPv2C read-write SNMP access. These are commands of the form snmp-server community string rw. + +Instead, you should have only read-only commands in the configuration. In addi-tion, you should use access lists to limit the source addresses that have read-only access. Do not depend on the SNMPv1 or SNMPv2c community strings for security because these are passed in the clear in SNMP packets. + + +From the Library of Outcast Outcast +426 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +■ Secure unused switch ports: Every unused switch port should be disabled so that unexpected users cannot connect and use them without your knowledge. You can do this with the shutdown interface configuration command. + +In addition, you should configure every user port as an access port with the switch-port mode access interface configuration command. Otherwise, a malicious user might connect and attempt to negotiate trunking mode on a port. You also should consider associating every unused access port with a bogus or isolated VLAN. If an unexpected user does gain access to a port, he will have access only to a VLAN that is isolated from every other resource on your network. + + +Tip You might consider using the switchport host interface configuration command as a quick way to force a port to support only a single PC. This command is actually a macro, as shown in the following example: +Switch(config)# interface gigabitethernet 1/0/1 +Switch(config-if)# switchport host +switchport mode will be set to access +spanning-tree portfast will be enabled +channel group will be disabled +Switch(config-if)# + + +■ Secure STP operation: A malicious user can inject STP bridge protocol data units (BPDUs) into switch ports or VLANs, and can disrupt a stable, loop-free topology. You always should enable the BPDU Guard feature so that access switch ports auto-matically are disabled if unexpected BPDUs are received. + +■ Secure the use of CDP and LLDP: By default, Cisco Discovery Protocol (CDP) advertisements are sent on every switch port at 60-second intervals. If Link Layer Discovery Protocol (LLDP) is enabled, its advertisements are sent at 30-second intervals. Although CDP and LLDP are very handy tools for discovering neighbor-ing network devices, you should not allow those protocols to advertise unnecessary information about your switch to listening attackers. + +For example, the following information is sent in a CDP advertisement in the clear. An attacker might use the device ID to physically locate the switch, its IP address to target Telnet, SSH, or Simple Network Management Protocol (SNMP) attacks, or the native VLAN and switch port ID to attempt a VLAN hopping attack: + +Device ID: nyc-bldgA-dist1.mycompany.com +Entry address(es): +IP address: 10.1.76.2 +Platform: cisco WS-C6509-E, Capabilities: Router Switch IGMP +Interface: TenGigabitEthernet1/1/1, Port ID (outgoing port): TenGigabitEthernet1/5 +Holdtime : 137 sec +Version : + + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 427 + +Cisco IOS Software, s72033_rp Software (s72033_rp-ADVIPSERVICESK9_WAN-M), Version 12.2(33)SXI4, RELEASE SOFTWARE (fc3) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2010 by Cisco Systems, Inc. +Compiled Sat 29-May-10 17:54 by prod_rel_team +advertisement version: 2 +VTP Management Domain: 'MyCompany' +Native VLAN: 101 +Duplex: full +Management address(es): +IP address: 10.1.76.2 + +CDP should be enabled only on switch ports that connect to other trusted Cisco devices. Do not forget that CDP must be enabled on access switch ports where Cisco IP phones are connected. When the CDP messages reach the IP phone, they will not be relayed on to a PC connected to the phone’s data port. You can disable CDP on a port-by-port basis with the no cdp enable interface configuration command. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +428 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 19-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 19-2 Key Topics for Chapter 19 +Key +Topic Key Topic Element Description Page Number + +Paragraph + +List + +Paragraph + +Paragraph + +Discusses port security and MAC address control 415 using sticky MAC addresses +Explains the actions port security can take when the 416 MAC address limits are violated +Discusses port based authentication using IEEE 418 802.1X and EAPOL +Explains how to configure Storm Control 422 + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +sticky MAC address, IEEE 802.1X + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the STP configuration commands, cover the right side of Tables 19-3 through 19-5 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + + + + + +From the Library of Outcast Outcast +Chapter 19: Securing Switch Access 429 + + +Table 19-3 + +Task + + +Port Security Configuration Commands + +Command Syntax + + + +Enable port security on an interface. + +Set the maximum number of learned addresses. +Define a static MAC address. + +Define an action to take. + +Display port security status. + + +Switch(config-if)# switchport port-security + +Switch(config-if)# switchport port-security maximum max-addr +Switch(config-if)# switchport port-security mac-address mac-addr +Switch(config-if)# switchport port-security violation {shutdown | restrict | protect} + +Switch# show port-security [interface type member/module/number] + + + + + +Table 19-4 + +Task + + +Port-Based Authentication Configuration Commands + +Command Syntax + + + +Define a method list for 802.1X. + +Globally enable 802.1X. + +Define the 802.1X behavior on a port. + +Support more than one host on a port. + +Display 802.1X interface status. + +Switch(config)# aaa authentication dot1x default group radius +Switch(config)# dot1x system-auth-control + +Switch(config-if)# dot1x port-control {force-authorized | force- unauthorized | auto} +Switch(config-if)# dot1x host-mode multi-host + +Switch# show dot1x [all] [interface type member/ module/number] + + + + + +Table 19-5 + +Task + + +Storm Control Configuration Commands + +Command Syntax + + + +Enable a Storm Control threshold on an interface. + +Define an action for Storm Control. (By default, frames are dropped if this command is not present.) +Display Storm Control status. + +Switch(config-if)# storm-control { broadcast | multicast | unicast } level {level [level-low] | bps bps [bps-low] | pps pps [pps-low]} +Switch(config-if)# storm-control action { shutdown | trap} + +Switch# show storm-control [interface-id] [broadcast | multicast | unicast] + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ VLAN Access Lists: This section discusses how traffic can be controlled within a VLAN. You can use VLAN access control lists (ACL) to filter packets even as they are bridged or switched. +■ Private VLANs: This section explains the mecha-nisms that you can use to provide isolation within a single VLAN. Private VLANs have a unidirectional nature; several of them can be isolated yet share a common subnet and gateway. +■ Securing VLAN Trunks: This section covers two types of attacks that can be leveraged against a VLAN trunk link. If a trunk link is extended to or accessible from an attacker, any VLAN carried over the trunk can be compromised in turn. + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 20 + + + + + + +Securing VLANs + + +Traditionally, traffic has been filtered only at router boundaries, where packets naturally are inspected before being forwarded. This is true within Catalyst switches because access lists can be applied as a part of multilayer switching. Catalysts also can filter packets even if they stay within the same VLAN; VLAN access control lists, or VACLs, provide this capability. + +Catalyst switches also have the capability to logically divide a single VLAN into multiple partitions. Each partition can be isolated from others, with all of them sharing a com-mon IP subnet and a common gateway address. Private VLANs make it possible to offer up a single VLAN to many disparate customers or organizations without any interaction between them. + +VLAN trunks are commonly used on links between switches to carry data from multiple VLANs. If the switches are all under the same administrative control, it is easy to become complacent about the security of the trunks. A few known attacks can be used to gain access to the VLANs that are carried over trunk links. Therefore, network administrators should be aware of the steps that can be taken to prevent any attacks. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 20-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 20-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +VLAN Access Lists + +Private VLANs + +Securing VLAN Trunks + +Questions Covered in This Section +1–4 + +5–8 + +9–12 + + + + + + +From the Library of Outcast Outcast +432 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +1. Which one of the following can filter packets even if they are not routed to another Layer 3 interface? + +a. IP extended access lists + +b. MAC address access lists + +c. VLAN access lists + +d. Port-based access lists + +2. In what part of a Catalyst switch are VLAN ACLs implemented? + +a. NVRAM + +b. CAM + +c. RAM + +d. TCAM + +3. Which one of the following commands can implement a VLAN ACL called test? + +a. access-list vlan test + +b. vacl test + +c. switchport vacl test + +d. vlan access-map test + +4. After a VACL is configured, where is it applied? + +a. Globally on a VLAN + +b. On the VLAN interface + +c. In the VLAN configuration + +d. On all ports or interfaces mapped to a VLAN + +5. Which of the following private VLANs is the most restrictive? + +a. Community VLAN + +b. Isolated VLAN + +c. Restricted VLAN + +d. Promiscuous VLAN + +6. The vlan 100 command has just been entered. What is the next command needed to configure VLAN 100 as a secondary isolated VLAN? + +a. private-vlan isolated + +b. private-vlan isolated 100 + +c. pvlan secondary isolated + +d. No further configuration necessary + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 433 + +7. What type of port configuration should you use for private VLAN interfaces that connect to a router? + +a. Host + +b. Gateway + +c. Promiscuous + +d. Transparent + +8. Promiscuous ports must be ______________ to primary and secondary VLANs, and host ports must be ________________. + +a. Mapped, associated + +b. Mapped, mapped + +c. Associated, mapped + +d. Associated, associated + +9. In a switch spoofing attack, an attacker makes use of which one of the following? + +a. The switch management IP address + +b. CDP message exchanges + +c. Spanning Tree Protocol + +d. DTP to negotiate a trunk + +10. Which one of the following commands enables you to prevent a switch spoofing attack on an end-user port? + +a. switchport mode access + +b. switchport mode trunk + +c. no switchport spoof + +d. spanning-tree spoof-guard + +11. Which one of the following represents the spoofed information an attacker sends in a VLAN hopping attack? + +a. 802.1Q tags + +b. DTP information + +c. VTP information + +d. 802.1x information + + + + + + + + + +From the Library of Outcast Outcast +434 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +12. Which one of the following methods can be used to prevent a VLAN hopping attack? + +a. Use VTP throughout the network. + +b. Set the native VLAN to the user access VLAN. + +c. Remove the native VLAN from a trunk link. + +d. Avoid using EtherChannel link bundling. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 435 + +Foundation Topics + + +VLAN Access Lists + +Access lists can manage or control traffic as it passes through a switch. When nor-mal access lists are configured on a Catalyst switch, they filter traffic through the use of the ternary content-addressable memory (TCAM). Recall from Chapter 2, “Switch Operation,” that access lists (also known as router access lists, or RACLs) are merged +or compiled into the TCAM. Each ACL is applied to an interface according to the direc-tion of traffic—inbound or outbound. Packets then can be filtered in hardware with no switching performance penalty. However, only packets that pass between VLANs can be filtered this way. + +Packets that stay in the same VLAN do not cross a VLAN or interface boundary and do not necessarily have a direction in relation to an interface. These packets also might be non-IP or completely bridged; therefore, they never pass through the multilayer switching mechanism. VLAN access lists (VACLs) are filters that directly can affect how packets are handled within a VLAN. + +VACLs are somewhat different from RACLs or traditional access control lists. Although they, too, are merged into the TCAM, they can permit, deny, or redirect packets as they are matched. VACLs also are configured in a route map fashion, with a series of matching conditions and actions to take. + + +VACL Configuration + + + +Key Topic + +VACLs are configured as a VLAN access map in much the same format as a route map. A VLAN access map consists of one or more statements, each having a common map name. First, you define the VACL with the following global configuration command: +Switch(config)# vlan access-map map-name [sequence-number] + + +Access map statements are evaluated in sequence according to the sequence number. Each statement can contain one or more matching conditions, followed by an action. + +Next, define the matching conditions that identify the traffic to be filtered. Matching is performed by access lists (IP or MAC address ACLs), which you must configure indepen-dently. Configure a matching condition with one of the following access map configura-tion commands: +Switch(config-access-map)# match ip address { acl-number | acl-name} +Switch(config-access-map)# match mac address acl-name + +You can repeat these commands to define several matching conditions; the first match encountered triggers an action to take. Define the action with the following access map configuration command: +Switch(config-access-map)# action { drop | forward [ capture] | redirect type mod/ num} + + +From the Library of Outcast Outcast +436 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +A VACL can either drop a matching packet, forward it, or redirect it to another inter-face. The TCAM performs the entire VACL match and action as packets are switched or bridged within a VLAN or routed into or out of a VLAN. + +Finally, you must apply the VACL to a VLAN using the following global configuration command: +Switch(config)# vlan filter map-name vlan-list vlan-list + +Notice that the VACL is applied globally to one or more VLANs listed and not to a VLAN interface switch virtual interface (SVI). Recall that VLANs can be present in a switch as explicit interfaces or as inherent Layer 2 entities. The VLAN interface is the point where packets enter or leave a VLAN, so it does not make sense to apply a VACL there. Instead, the VACL needs to function within the VLAN itself, where there is no inbound or outbound direction. + +For example, suppose that you need to filter traffic within VLAN 99 so that host 192.168.99.17 is not allowed to contact any other host on its local subnet. Access list local-17 is created to identify traffic between this host and anything else on its local subnet. Then a VLAN access map is defined: If the local-17 access list matches (permits) the IP address, the packet is dropped; otherwise, the packet is forwarded. Example 20-1 shows the commands necessary for this example. + +Example 20-1 Filtering Traffic Within the Local Subnet + +Switch(config)# ip access-list extended local-17 +Switch(config-acl)# permit ip host 192.168.99.17 192.168.99.0 0.0.0.255 +Switch(config-acl)# exit +Switch(config)# vlan access-map block-17 10 +Switch(config-access-map)# match ip address local-17 +Switch(config-access-map)# action drop +Switch(config-access-map)# vlan access-map block-17 20 +Switch(config-access-map)# action forward +Switch(config-access-map)# exit +Switch(config)# vlan filter block-17 vlan-list 99 + + +Private VLANs + +Normally, traffic is allowed to move unrestricted within a VLAN. Packets sent from one host to another normally are heard only by the destination host because of the nature of Layer 2 switching. + +However, if one host broadcasts a packet, all hosts on the VLAN must listen. You can use a VACL to filter packets between a source and destination in a VLAN if both connect to the local switch. + +Sometimes it would be nice to have the capability to segment traffic within a single VLAN, without having to use multiple VLANs and a router. For example, in a single-VLAN server farm, all servers should be capable of communicating with the router or + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 437 + + + + + + + + + + + + +Key Topic + +gateway, but the servers should not have to listen to each other’s broadcast traffic. Taking this a step further, suppose that each server belongs to a separate organization. Now each server should be isolated from the others but still be capable of reaching the gateway to find clients not on the local network. + +Another application is a service provider network. Here, the provider might want to use a single VLAN to connect to several customer networks. Each customer needs to be able to contact the provider’s gateway on the VLAN. Clearly, the customer sites do not need to interact with each other. + +Private VLANs (PVLANs) solve this problem on Catalyst switches. In a nutshell, a normal, or primary, VLAN can be logically associated with special unidirectional, or secondary, VLANs. Hosts associated with a secondary VLAN can communicate with ports on the primary VLAN (a router, for example), but not with another secondary VLAN. A second- +ary VLAN is configured as one of the following types: + + +■ Isolated: Any switch ports associated with an isolated VLAN can reach the primary VLAN but not any other secondary VLAN. In addition, hosts associated with the same isolated VLAN cannot reach each other. They are, in effect, isolated from everything except the primary VLAN. +■ Community : Any switch ports associated with a common community VLAN can communicate with each other and with the primary VLAN but not with any other secondary VLAN. This provides the basis for server farms and workgroups within an organization, while giving isolation between organizations. + +All secondary VLANs must be associated with one primary VLAN to set up the uni-directional relationship. Private VLANs are configured using special cases of regular VLANs. However, the VLAN Trunking Protocol (VTP) does not pass any information about the private VLAN configuration. Therefore, private VLANs are only locally signifi-cant to a switch. Each of the private VLANs must be configured locally on each switch that interconnects them. + +You must configure each physical switch port that uses a private VLAN with a VLAN association. You also must define the port with one of the following modes: + + +■ Key +Topic + + +■ + +Promiscuous: The switch port connects to a router, firewall, or other common gate-way device. This port can communicate with anything else connected to the primary or any secondary VLAN. In other words, the port is in promiscuous mode, in which the rules of private VLANs are ignored. +Host: The switch port connects to a regular host that resides on an isolated or com-munity VLAN. The port communicates only with a promiscuous port or ports on +the same community VLAN. + + +Figure 20-1 shows the basic private VLAN operation. Some host PCs connect to a sec-ondary community VLAN. The two community VLANs associate with a primary VLAN, where the router connects. The router connects to a promiscuous port on the primary VLAN. A single host PC connects to a secondary isolated VLAN, so it can communicate only with the router’s promiscuous port. + + +From the Library of Outcast Outcast +438 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Secondary VLAN 10 Gi1/0/1 (Community) + + + +Gi1/0/2 + + +Secondary VLAN 30 Gi1/0/48 Gi1/0/3 (Isolated) +Host Ports + +Primary VLAN (Promiscuous) +Gi1/0/4 + + + +Gi1/0/5 +Secondary VLAN 20 (Community) + + + + +Figure 20-1 Private VLAN Functionality Within a Switch + + +Private VLAN Configuration + +Defining a private VLAN involves several configuration steps. These steps are described in the sections that follow. + +Configure the Private VLANs + +To configure a private VLAN, begin by defining any secondary VLANs that are needed for isolation using the following configuration commands: +Switch(config)# vlan vlan-id +Switch(config-vlan)# private-vlan { isolated | community} + +The secondary VLAN can be an isolated VLAN (no connectivity between isolated ports) or a community VLAN (connectivity between member ports). + +Now define the primary VLAN that will provide the underlying private VLAN connectiv-ity using the following configuration commands: +Switch(config)# vlan vlan-id +Switch(config-vlan)# private-vlan primary +Switch(config-vlan)# private-vlan association {secondary-vlan-list | add second-ary-vlan-list | remove secondary-vlan-list} + + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 439 + +Be sure to associate the primary VLAN with all its component secondary VLANs using the association keyword. If the primary VLAN already has been configured, you can add (add) or remove (remove) secondary VLAN associations individually. + +These VLAN configuration commands set up only the mechanisms for unidirectional connectivity from the secondary VLANs to the primary VLAN. You also must associate the individual switch ports with their respective private VLANs. + +Associate Ports with Private VLANs + +First, define the function of the port that will participate on a private VLAN using the following configuration command: +Switch(config-if)# switchport mode private-vlan {host | promiscuous} + +If the host connected to this port is a router, firewall, or common gateway for the VLAN, use the promiscuous keyword. This allows the host to reach all other promiscuous, iso-lated, or community ports associated with the primary VLAN. Otherwise, any isolated or community port must receive the host keyword. + +For a nonpromiscuous port (using the switchport mode private-vlan host command), you must associate the switch port with the appropriate primary and secondary VLANs. Remember, only the private VLANs themselves have been configured until now. The switch port must know how to interact with the various VLANs using the following inter-face configuration command: +Switch(config-if)# switchport private-vlan host-association primary-vlan-id secondary-vlan-id + + +Note When a switch port is associated with private VLANs, you do not have to con-figure a static access VLAN. Instead, the port takes on membership in the primary and secondary VLANs simultaneously. This does not mean that the port has a fully functional assignment to multiple VLANs. Instead, it takes on only the unidirectional behavior between the secondary and primary VLANs. + + +For a promiscuous port (using the switchport mode private-vlan promiscuous com-mand), you must map the port to primary and secondary VLANs. Notice that promiscu-ous mode ports, or ports that can communicate with any other private VLAN device, are mapped, whereas other secondary VLAN ports are associated. One (promiscuous mode port) exhibits bidirectional behavior, whereas the other (secondary VLAN ports) exhibits unidirectional or logical behavior. + +Use the following interface configuration command to map promiscuous mode ports to primary and secondary VLANs: +Switch(config-if)# switchport private-vlan mapping primary-vlan-id secondary-vlan-list | {add secondary-vlan-list} | { remove secondary-vlan-list} + + + + +From the Library of Outcast Outcast +440 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Assume, for example, that the switch in Figure 20-1 is configured as in Example 20-2. Host PCs on ports Gigabit Ethernet 1/0/1 and 1/0/2 are in community VLAN 10, hosts on ports Gigabit Ethernet 1/0/4 and 1/0/5 are in community VLAN 20, and the host on port Gigabit Ethernet 1/0/3 is in isolated VLAN 30. The router on port Gigabit Ethernet 1/0/48 is in promiscuous mode on primary VLAN 100. Each VLAN is assigned a role, and the primary VLAN is associated with its secondary VLANs. Then each interface is associated with a primary and secondary VLAN (if a host is attached) or mapped to the primary and secondary VLANs (if a promiscuous host is attached). + +Example 20-2 Configuring Ports with PVLANs + +Switch(config)# vlan 10 +Switch(config-vlan)# private-vlan community +Switch(config-vlan)# vlan 20 +Switch(config-vlan)# private-vlan community +Switch(config-vlan)# vlan 30 +Switch(config-vlan)# private-vlan isolated +Switch(config-vlan)# vlan 100 +Switch(config-vlan)# private-vlan primary +Switch(config-vlan)# private-vlan association 10,20,30 +Switch(config-vlan)# exit +Switch(config)# interface range gigabitethernet 1/0/1 - 1/0/2 +Switch(config-if)# switchport mode private-vlan host +Switch(config-if)# switchport private-vlan host-association 100 10 +Switch(config-if)# exit +Switch(config)# interface range gigabitethernet 1/0/4 - 1/0/5 +Switch(config-if)# switchport mode private-vlan host +Switch(config-if)# switchport private-vlan host-association 100 20 +Switch(config-if)# exit +Switch(config)# interface gigabitethernet 1/0/3 +Switch(config-if)# switchport mode private-vlan host +Switch(config-if)# switchport private-vlan host-association 100 30 +Switch(config-if)# exit +Switch(config)# interface gigabitethernet 1/0/48 +Switch(config-if)# switchport mode private-vlan promiscuous +Switch(config-if)# switchport private-vlan mapping 100 10,20,30 + + +Associate Secondary VLANs to a Primary VLAN SVI + +On switched virtual interfaces, or VLAN interfaces configured with Layer 3 addresses, you must configure some additional private VLAN mapping. Consider a different example, where the SVI for the primary VLAN, VLAN 200, has an IP address and partici-pates in routing traffic. Secondary VLANs 40 (an isolated VLAN) and 50 (a community VLAN) are associated at Layer 2 with primary VLAN 200 using the configuration in Example 20-3. + + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 441 + +Example 20-3 Associating Secondary VLANs to a Primary VLAN SVI + +Switch(config)# vlan 40 +Switch(config-vlan)# private-vlan isolated +Switch(config-vlan)# vlan 50 +Switch(config-vlan)# private-vlan community +Switch(config-vlan)# vlan 200 +Switch(config-vlan)# private-vlan primary +Switch(config-vlan)# private-vlan association 40,50 +Switch(config-vlan)# exit +Switch(config)# interface vlan 200 +Switch(config-if)# ip address 192.168.199.1 255.255.255.0 + +Primary VLAN 200 can forward traffic at Layer 3, but the secondary VLAN associa-tions with it are good at only Layer 2. To allow Layer 3 traffic switching coming from the secondary VLANs as well, you must add a private VLAN mapping to the primary VLAN (SVI) interface, using the following interface configuration command: +Switch(config-if)# private-vlan mapping { secondary-vlan-list | add secondary-vlan-list | remove secondary-vlan-list} + +The primary VLAN SVI function is extended to the secondary VLANs instead of requir-ing SVIs for each of them. If some mapping already has been configured for the primary VLAN SVI, you can add (add) or remove (remove) secondary VLAN mappings individu-ally. + +Continuing with Example 20-3, you would map the private VLAN by adding the follow-ing commands: +Switch(config)# interface vlan 200 +Switch(config-if)# private-vlan mapping 40,50 + +Securing VLAN Trunks + +Because trunk links usually are bounded between two switches, you might think that they are more or less secure. Each end of the trunk is connected to a device that is under your control, VLANs carried over the trunk remain isolated, and so on. + +Some attacks or exploits can be leveraged to gain access to a trunk or to the VLANs car-ried over a trunk. Therefore, you should become familiar with how the attacks work and what steps you can take to prevent them in the first place. + +Switch Spoofing + +Recall from Chapter 4, “VLANs and Trunks,” that two switches can be connected by a common trunk link that can carry traffic from multiple VLANs. The trunk does not have to exist all the time. The switches dynamically can negotiate its use and its encapsulation mode by exchanging Dynamic Trunking Protocol (DTP) messages. + + + + +From the Library of Outcast Outcast +442 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + + + + + +Key Topic + +Although DTP can make switch administration easier, it also can expose switch ports to be compromised. Suppose that a switch port is left to its default configuration, in which the trunking mode is auto. Normally, the switch port would wait to be asked by another switch in the auto or on mode to become a trunk. + +Now suppose that an end user’s PC is connected to that port. A well-behaved end user would not use DTP at all, so the port would come up in access mode with a single-access VLAN. A malicious user, however, might exploit the use of DTP and attempt to negotiate a trunk with the switch port. This makes the PC appear to be another switch; in effect, the PC is spoofing a switch. + +After the trunk is negotiated, the attacker has access to any VLAN that is permitted to pass over the trunk. If the switch port has been left to its default configuration, all VLANs configured on the switch are allowed onto the trunk. Figure 20-2 shows this +scenario. The attacker can receive any traffic being sent over the trunk on any VLAN. In +addition, he can send traffic into any VLAN of his choice. + + + + + + +VLAN 10 + + + +Switch A +Default Switch Port Configuration: +switchport mode dynamic auto switchport trunk allowed vlan all + +Switch B + +Trunk VLAN 20 +VLANs 10.20.30 + + + +Negotiated Trunk VLANs 1-4094 +Via VLAN 10 +Via VLAN 20 + + + +Figure 20-2 An Example of Switch Spoofing to Gain Access to a Trunk + +To demonstrate this further, consider the output in Example 20-4, which shows the default access switch port configuration. Notice that trunking is possible because the port is set to dynamic auto mode, awaiting DTP negotiation from a connected device. If a trunk is negotiated, all VLANs are permitted to be carried over it. + +Example 20-4 Displaying the Default Switch Port Configuration + +Switch# show interfaces gigabitethernet 1/0/46 switchport +Name: Gi1/0/46 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: trunk +Administrative Trunking Encapsulation: negotiate + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 443 + +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Administrative private-vlan trunk native VLAN: none +Administrative private-vlan trunk Native VLAN tagging: enabled +Administrative private-vlan trunk encapsulation: dot1q +Administrative private-vlan trunk normal VLANs: none +Administrative private-vlan trunk private VLANs: none +Operational private-vlan: none +Trunking VLANs Enabled: ALL +Pruning VLANs Enabled: 2-1001 +Capture Mode Disabled Capture VLANs Allowed: ALL +Protected: false +Unknown unicast blocked: disabled +Unknown multicast blocked: disabled +Appliance trust: none +Switch# + +The solution to this situation is to configure every switch port to have an expected and controlled behavior. For example, instead of leaving an end-user switch port set to use DTP in auto mode, configure it to static access mode with the following commands: +Switch(config)# interface type member/mod/num +Switch(config-if)# switchport access vlan vlan-id +Switch(config-if)# switchport mode access + +This way, an end user never will be able to send any type of spoofed traffic that will make the switch port begin trunking. + +In addition, you might be wise to disable any unused switch ports to prevent someone from discovering a live port that might be exploited. + + +VLAN Hopping + + + +Key Topic + +When securing VLAN trunks, also consider the potential for an exploit called VLAN hopping. Here, an attacker positioned on one access VLAN can craft and send frames with spoofed 802.1Q tags so that the packet payloads ultimately appear on a totally dif-ferent VLAN, all without the use of a router. + +For this exploit to work, the following conditions must exist in the network configuration: + + +■ The attacker is connected to an access switch port. + +■ The same switch must have an 802.1Q trunk. + +■ The trunk must have the attacker’s access VLAN as its native VLAN. + + +From the Library of Outcast Outcast +444 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide +10 20 +20 + +Figure 20-3 shows how VLAN hopping works. The attacker, situated on VLAN 10, sends frames that are doubly tagged as if an 802.1Q trunk were being used. Naturally, the attacker is not connected to a trunk; he is spoofing the trunk encapsulation to trick the switch into making the frames hop over to another VLAN. + + +Switch A + +VLAN 10 + + +802.1Q Trunk +Native VLAN 10 + +Switch B + +VLAN 20 + + + + +VLAN VLAN Payload VLAN Payload VLAN +10 + + +Payload Payload VLAN +20 + + + +1. Attacker Sends a Double-Tagged Packet onto His Local Access VLAN + +2. When Switch A +Is Ready to Forward the Packet onto the Trunk, the First Tag Is Stripped Because it Is the Same as the Trunk’s Native VLAN + +3. The Packet Is Received by Switch B; as the Second Tag Is Stripped, it Appears to Identify the Source VLAN as VLAN 20 + +4. The Packet Originally from VLAN 10 Is Now Sent into VLAN 20! + + +Figure 20-3 VLAN Hopping Attack Process + +The regular frame—or malicious payload, in this case—is first given an 802.1Q tag with the VLAN ID of the target VLAN. Then a second bogus 802.1Q tag is added with the attacker’s access VLAN ID. + +When the local switch Switch A receives a doubly tagged frame, it decides to forward it out the trunk interface. Because the first (outermost) tag has the same VLAN ID as the trunk’s native VLAN, that tag is removed as the frame is sent on the trunk. The switch believes that the native VLAN should be untagged, as it should. Now the second (inner-most) tag is exposed on the trunk. + +When Switch B receives the frame, it examines any 802.1Q tag it finds. The spoofed tag for VLAN 20 is found, so the tag is removed and the frame is forwarded onto VLAN 20. Now the attacker successfully has sent a frame on VLAN 10 and gotten the frame inject-ed onto VLAN 20—all through Layer 2 switching. + +Clearly, the key to this type of attack revolves around the use of untagged native VLANs. Therefore, to thwart VLAN hopping, you always should carefully configure trunk links with the following steps: + +Step 1. +Key +Topic Step 2. + + +Set the native VLAN of a trunk to a bogus or unused VLAN ID. + +Prune the native VLAN off both ends of the trunk. + + +For example, suppose that an 802.1Q trunk should carry only VLANs 10 and 20. You should set the native VLAN to an unused value, such as 800. Then you should remove VLAN 800 from the trunk so that it is confined to the trunk link itself. Example 20-5 demonstrates how to accomplish this. + +Example 20-5 Configuring the 802.1Q Trunk to Carry Only VLANs 10 and 20 + +Switch(config)# vlan 800 +Switch(config-vlan)# name bogus_native +Switch(config-vlan)# exit + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 445 + +Switch(config)# interface gigabitethernet 1/0/1 +Switch(config-if)# switchport trunk encapsulation dot1q +Switch(config-if)# switchport trunk native vlan 800 +Switch(config-if)# switchport trunk allowed vlan remove 800 +Switch(config-if)# switchport mode trunk + + +Tip Although maintenance protocols such as Cisco Discovery Protocol (CDP), Port Aggregation Protocol (PAgP), and Dynamic Trunking Protocol (DTP) normally are carried over the native VLAN of a trunk, they will not be affected if the native VLAN is removed or manually pruned from the trunk. They still will be sent and received on the native VLAN as a special case even if the native VLAN ID is not in the list of allowed VLANs. + + +One alternative is to force all 802.1Q trunks to add tags to frames for the native VLAN, too. The double-tagged VLAN hopping attack will not work because the switch will not remove the first tag with the native VLAN ID (VLAN 10 in the example). Instead, that tag will remain on the spoofed frame as it enters the trunk. At the far end of the trunk, the same tag will be examined, and the frame will stay on the original access VLAN (VLAN 10). + +To force a switch to tag the native VLAN on all its 802.1Q trunks, you can use the fol-lowing command: +Switch(config)# vlan dot1q tag native + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +446 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 20-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 20-2 Key Topics for Chapter 20 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraph + +List + +Paragraph + +Paragraph + +List + +Explains VLAN ACLs and how they are configured 435 + +Discusses private VLANs, primary and secondary 437 VLANs, and isolated and community VLANs +Discusses promiscuous and host ports within a 437 private VLAN +Explains the switch spoofing attack 442 + +Explains the VLAN hopping attack 443 + +Explains the steps necessary to prevent a VLAN 444 hopping attack + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +VACL, private VLAN, primary VLAN, secondary VLAN, isolated VLAN, commu-nity VLAN, promiscuous port, host port, switch spoofing, VLAN hopping + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the VLAN ACL and private VLAN configuration, cover the right side of Tables 20-3 and 20-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + + +From the Library of Outcast Outcast +Chapter 20: Securing VLANs 447 + + +Table 20-3 + +Task + + +VLAN ACL Configuration Commands + +Command Syntax + + + +Define a VACL. + +Define a matching condition. + +Define an action. + +Apply the VACL to VLANs. + + +Switch(config)# vlan access-map map-name [sequence-number ] + +Switch(config-access-map)# match {ip address {acl-number | acl-name}} | { mac address acl-name}} +Switch(config-access-map)# action { drop | forward [capture] | redirect type mod/num} + +Switch(config)# vlan filter map-name vlan-list vlan-list + + + + + +Table 20-4 + +Task + + +Private VLAN Configuration Commands + +Command Syntax + + + +Define a secondary VLAN. + + + +Define a primary VLAN; associate it with secondary VLANs. + + + + +Associate ports with private VLANs. +Associate nonpromiscuous ports with private VLANs. +Associate promiscuous ports with private VLANs. + +Associate secondary VLANs with a primary VLAN Layer 3 SVI. + + +Switch(config)# vlan vlan-id +Switch(config-vlan)# private-vlan { isolated | community } + +Switch(config)# vlan vlan-id Switch(config-vlan)# private-vlan primary +Switch(config-vlan)# private-vlan association +{secondary-vlan-list | add secondary-vlan-list | remove secondary-vlan-list} +Switch(config-if)# switchport mode private-vlan { host | promiscuous} +Switch(config-if)# switchport private-vlan host-association primary-vlan-id secondary-vlan-id +Switch(config-if)# switchport private-vlan mapping {primary-vlan-id} {secondary-vlan-list} | {add secondary-vlan-list} | {remove secondary-vlan-list} + +Switch(config-if)# private-vlan mapping { secondary-vlan-list | add secondary-vlan-list | remove secondary-vlan-list} + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ DHCP Snooping: This section covers a method to prevent rogue DHCP servers from appearing on your network and disrupting service to your users. +■ IP Source Guard: This section discusses a mecha-nism you can leverage to detect and suppress hosts that use spoofed IP addresses to attack a network. +■ Dynamic ARP Inspection: This section explains how you can configure a switch to detect and miti-gate ARP spoofing attacks. + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 21 + + + + + + +Preventing Spoofing Attacks + + +Catalyst switches can detect and prevent certain types of attacks. This chapter discusses several features that you can use to validate information passing through a switch so that spoofed addresses cannot be used to compromise hosts. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 21-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 21-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +DHCP Snooping + +IP Source Guard + +Dynamic ARP Inspection + +Questions Covered in This Section +1–2 + +3–4 + +5–6 + + + +1. DHCP snooping helps mitigate which one of the following spoofed parameters? + +a. Subnet mask + +b. Gateway address + +c. DNS address + +d. DHCP request + +2. With DHCP snooping, an untrusted port filters out which one of the following? + +a. DHCP replies from legitimate DHCP servers + +b. DHCP replies from rogue DHCP servers + +c. DHCP requests from legitimate clients + +d. DHCP requests from rogue clients + +From the Library of Outcast Outcast +450 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +3. Which two of the following methods does a switch use to detect spoofed addresses when IP Source Guard is enabled? + +a. ARP entries + +b. DHCP database + +c. DHCP snooping database + +d. Static IP source binding entries + +e. Reverse path-forwarding entries + +4. Which one of the following commands should you use to enable IP Source Guard on a switch interface? + +a. ip source-guard + +b. ip guard source + +c. ip verify source + +d. ip source spoof + +5. Dynamic ARP Inspection helps mitigate an attack based on which one of the follow-ing parameters within an ARP reply packet? + +a. Source IP address + +b. MAC address + +c. Destination IP address + +d. Sequence number + +6. Which one of the following should be configured as a trusted port for dynamic ARP inspection? + +a. The port where the ARP server is located. + +b. The port where an end-user host is located. + +c. The port where another switch is located. + +d. None; all ports are untrusted. + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 21: Preventing Spoofing Attacks 451 + +Foundation Topics + + +Malicious users sometimes can send spoofed—information to trick switches or other hosts into using a rogue machine as a gateway. The attacker’s goal is to become the man in the middle, with a naive user sending packets to the attacker as if it were a router. The attacker can glean information from the packets sent to it before it forwards them nor-mally. This section describes three Cisco Catalyst features—DHCP snooping, IP Source Guard, and dynamic ARP inspection—that prevent certain types of spoofing attacks. + +DHCP Snooping + + + + + + + + + + + + + + + + + +Key Topic + +A Dynamic Host Configuration Protocol (DHCP) server normally provides all the basic information a client PC needs to operate on a network. For example, the client might receive an IP address, a subnet mask, a default gateway address, DNS addresses, and +so on. + +Suppose that an attacker could bring up a rogue DHCP server on a machine in the same subnet as that same client PC. Now when the client broadcasts its DHCP request, the rogue server could send a carefully crafted DHCP reply with its own IP address substi-tuted as the default gateway. + +When the client receives the reply, it begins using the spoofed gateway address. Packets destined for addresses outside the local subnet then go to the attacker’s machine first. The attacker can forward the packets to the correct destination, but in the meantime, it can examine every packet that it intercepts. In effect, this becomes a type of man-in-the-middle attack; the attacker is wedged into the path and the client does not realize it. + +Cisco Catalyst switches can use the DHCP snooping feature to help mitigate this type of attack. When DHCP snooping is enabled, switch ports are categorized as trusted or untrusted. Legitimate DHCP servers can be found on trusted ports, whereas all other hosts sit behind untrusted ports. + +A switch intercepts all DHCP requests coming from untrusted ports before flooding them throughout the VLAN. Any DHCP replies coming from an untrusted port are discarded because they must have come from a rogue DHCP server. In addition, the offending switch port automatically is shut down in the errdisable state. + +DHCP snooping also keeps track of the completed DHCP bindings as clients receive legitimate replies. This database contains the client MAC address, IP address offered, lease time, and so on. + +You can configure DHCP snooping first by enabling it globally on a switch with the fol-lowing configuration command: +Switch(config)# ip dhcp snooping + + + + + + + +From the Library of Outcast Outcast +452 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Next identify the VLANs where DHCP snooping should be implemented with the follow-ing command: +Switch(config)# ip dhcp snooping vlan vlan-id [vlan-id] + +You can give a single VLAN number as vlan-id or a range of VLAN numbers by giving the start and end VLAN IDs of the range. + +By default, all switch ports are assumed to be untrusted so that DHCP replies are not expected or permitted. Only trusted ports are allowed to send DHCP replies. Therefore, you should identify only the ports where known, trusted DHCP servers are located. You can do this with the following interface configuration command: + +Switch(config)# interface type member/module/number +Switch(config-if)# ip dhcp snooping trust + +For untrusted ports, an unlimited rate of DHCP requests is accepted. If you want to rate-limit DHCP traffic on an untrusted port, use the following interface configuration com-mand: + +Switch(config)# interface type member/module/number +Switch(config-if)# ip dhcp snooping limit rate rate + +The rate can be 1 to 2048 DHCP packets per second. + +You also can configure the switch to use DHCP option-82, the DHCP Relay Agent Information option, which is described in RFCs 3046 and 6607. When a DHCP request is intercepted on an untrusted port, the switch adds its own MAC address and the switch port identifier into the option-82 field of the request. The request then is forwarded nor-mally so that it can reach a trusted DHCP server. + +Adding option-82 provides more information about the actual client that generated the DHCP request. In addition, the DHCP reply (if any) echoes back the option-82 informa-tion. The switch intercepts the reply and compares the option-82 data to confirm that the request came from a valid port on itself. This feature is enabled by default. You can enable or disable option-82 globally with the following configuration command: +Switch(config)# [no] ip dhcp snooping information option + +When DHCP snooping is configured, you can display its status with the following com-mand: +Switch# show ip dhcp snooping [binding] + +You can use the binding keyword to display all the known DHCP bindings that have been overheard. The switch maintains these in its own database. Otherwise, only the switch ports that are trusted or that have rate limiting applied are listed. All other ports are considered to be untrusted with an unlimited DHCP request rate. + +As an example, interfaces Gigabit Ethernet 1/0/35 and 1/0/36 use access VLAN 104, are considered untrusted, and have DHCP rate limiting applied at three per second. A known + + + +From the Library of Outcast Outcast +Chapter 21: Preventing Spoofing Attacks 453 + +DHCP server is located on the Gigabit Ethernet 1/1/1 uplink. Example 21-1 shows the configuration for this scenario. + +Example 21-1 DHCP Snooping Configuration + +Switch(config)# ip dhcp snooping +Switch(config)# ip dhcp snooping vlan 104 +Switch(config)# interface range gigabitethernet 1/0/35 – 36 +Switch(config-if)# ip dhcp snooping limit rate 3 +Switch(config-if)# interface gigabitethernet 1/1/1 +Switch(config-if)# ip dhcp snooping trust + +Example 21-2 shows the resulting DHCP snooping status. + +Example 21-2 DHCP Snooping Status Display + +Switch# show ip dhcp snooping +Switch DHCP snooping is enabled +DHCP snooping is configured on following VLANs: +104 +Insertion of option 82 is enabled + +Interface +------------------------ +GigabitEthernet1/0/35 +GigabitEthernet1/0/36 +GigabitEthernet1/1/1 +Switch# + +Trusted +------- +no +no +yes + +Rate limit (pps) +---------------- +3 +3 +unlimited + + + +IP Source Guard + +Address spoofing is one type of attack that can be difficult to mitigate. Normally, a host is assigned an IP address and is expected to use that address in all the traffic it sends out. IP addresses are effectively used on the honor system, where hosts are trusted to behave themselves and use their own legitimate source addresses. + +A rogue or compromised host PC does not necessarily play by those rules. It can use its legitimate address, or it can begin to use spoofed addresses—borrowed from other hosts or used at random. Spoofed addresses are often used to disguise the origin of denial-of-service attacks. If the source address does not really exist, no return traffic will find its way back to the originator. + +Routers or Layer 3 devices can perform some simple tests to detect spoofed source addresses in packets passing through. For example, if the 10.10.0.0 network is known to exist on VLAN 10, packets entering from VLAN 20 should never have source addresses in that subnet. + +However, it is difficult to detect spoofed addresses when they are used inside the VLAN or subnet where they should already exist. For example, within the 10.10.0.0 network on + + + +From the Library of Outcast Outcast +454 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +VLAN 10, as shown in Figure 21-1, a rogue host begins to send packets with a spoofed source address of 10.10.10.10. The 10.10.10.10 address is certainly within the 10.10.0.0/16 subnet, so it does not stand out as an obvious spoof. Therefore, the rogue host might be very successful in attacking other hosts in its own subnet or VLAN. + +Cisco Catalyst switches can use the IP source guard feature to detect and suppress address spoofing attacks—even if they occur within the same subnet. A Layer 2 switch, and a Layer 2 port in turn, normally learns and stores MAC addresses. The switch must have a way to look up MAC addresses and find out what IP address are associated with them. + +10.10.50.50 + +Spoofed Source Address “10.10.10.10” + + +10.10.55.55 + + +VLAN 10 10.10.0.0/16 + +Figure 21-1 Using a Spoofed Address Within a Subnet + +IP Source Guard does this by making use of the DHCP snooping database and static IP source binding entries. If DHCP snooping is configured and enabled, the switch learns the MAC and IP addresses of hosts that use DHCP. Packets arriving on a switch port can be tested for one of the following conditions: + + +■ Key +Topic + + +■ + +The source IP address must be identical to the IP address learned by DHCP snoop-ing or a static entry. A dynamic port access control list (ACL) is used to filter traffic. The switch automatically creates this ACL, adds the learned source IP address to the ACL, and applies the ACL to the interface where the address is learned. + +The source MAC address must be identical to the MAC address learned on the +switch port and by DHCP snooping. Port security is used to filter traffic. + + +If the address is something other than the one learned or statically configured, the switch drops the packet. + +To configure IP Source Guard, first configure and enable DHCP snooping, as presented in the previous section. If you want IP Source Guard to detect spoofed MAC addresses, you also need to configure and enable port security. + +For the hosts that do not use DHCP, you can configure a static IP source binding with the following configuration command: +Switch(config)# ip source binding mac-address vlan vlan-id ip-address interface type member/module/number + + + + +From the Library of Outcast Outcast +Chapter 21: Preventing Spoofing Attacks 455 + +Here, the host’s MAC address is bound to a specific VLAN and IP address, and is expect-ed to be found on a specific switch interface. + +Next, enable IP source guard on one or more switch interfaces with the following con-figuration commands: + +Switch(config)# interface type member/module/number +Switch(config-if)# ip verify source [port-security] + +The ip verify source command inspects the source IP address only. You can add the port-security keyword to inspect the source MAC address, too. + +To verify the IP source guard status, you can use the following EXEC command: + +Switch# show ip verify source [interface type member/module/number] + +If you need to verify the information contained in the IP source binding database, either learned or statically configured, you can use the following EXEC command: +Switch# show ip source binding [ ip-address] [ mac-address] [dhcp-snooping | static] [interface type member/mod/num] [ vlan vlan-id] + + +Dynamic ARP Inspection + + + + + + + + + + + + + + + + + + + +Key Topic + +Hosts normally use the Address Resolution Protocol (ARP) to resolve an unknown MAC address when the IP address is known. If a MAC address is needed so that a packet can be forwarded at Layer 2, a host broadcasts an ARP request that contains the IP address of the target in question. If any other host is using that IP address, it responds with an ARP reply containing its MAC address. + +The ARP process works well among trusted and well-behaved users. However, suppose that an attacker could send its own crafted ARP reply when it overhears an ARP request being broadcast. The reply could contain its own MAC address, causing the original requester to think that it is bound to the IP address in question. The requester would add the bogus ARP entry into its own ARP cache, only to begin forwarding packets to the spoofed MAC address. + +In effect, this scheme places the attacker’s machine right in the middle of an otherwise legitimate path. Packets will be sent to the attacker instead of another host or the default gateway. The attacker can intercept packets and (perhaps) forward them on only after examining the packets’ contents. + +This attack is known as ARP poisoning or ARP spoofing, and it is considered to be a type of man-in-the-middle attack. The attacker wedges into the normal forwarding path, transparent to the end users. Cisco Catalyst switches can use the dynamic ARP inspec-tion (DAI) feature to help mitigate this type of attack. + +DAI works much like DHCP snooping. All switch ports are classified as trusted or untrusted. The switch intercepts and inspects all ARP packets that arrive on an untrusted +port; no inspection is done on trusted ports. + + + + +From the Library of Outcast Outcast +456 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +When an ARP reply is received on an untrusted port, the switch checks the MAC and IP addresses reported in the reply packet against known and trusted values. A switch can gather trusted ARP information from statically configured entries or from dynamic entries in the DHCP snooping database. In the latter case, DHCP snooping must be enabled in addition to DAI. + +If an ARP reply contains invalid information or values that conflict with entries in the trusted database, it is dropped and a log message is generated. This action prevents inval-id or spoofed ARP entries from being sent and added to other machines’ ARP caches. + +You can configure DAI by first enabling it on one or more client VLANs with the follow-ing configuration command: +Switch(config)# ip arp inspection vlan vlan-range + +The VLAN range can be a single VLAN ID, a range of VLAN IDs separated by a hyphen, or a list of VLAN IDs separated by commas. + +By default, all switch ports associated with the VLAN range are considered to be untrusted. You should identify trusted ports as those that connect to other switches. In other words, the local switch will not inspect ARP packets arriving on trusted ports; it will assume that the neighboring switch also is performing DAI on all of its ports in that VLAN. Configure a trusted port with the following interface configuration command: + +Switch(config)# interface type member/module/number +Switch(config-if)# ip arp inspection trust + +If you have hosts with statically configured IP address information, there will be no DHCP message exchange that can be inspected. Instead, you can configure an ARP access list that defines static MAC-IP address bindings that are permitted. Use the follow-ing configuration commands to define the ARP access list and one or more static entries: + +Switch(config)# arp access-list acl-name +Switch(config-acl)# permit ip host sender-ip mac host sender-mac [log] +[Repeat the previous command as needed] +Switch(config-acl)# exit + +Now the ARP access list must be applied to DAI with the following configuration com-mand: +Switch(config)# ip arp inspection filter arp-acl-name vlan vlan-range [static] + +When ARP replies are intercepted, their contents are matched against the access list entries first. If no match is found, the DHCP snooping bindings database is checked next. You can give the static keyword to prevent the DHCP bindings database from being checked at all. In effect, this creates an implicit deny statement at the end of the ARP access list; if no match is found in the access list, the ARP reply is considered invalid. + +Finally, you can specify further validations on the contents of ARP reply packets. By default, only the MAC and IP addresses contained within the ARP reply are validated. This does not take the actual MAC addresses contained in the Ethernet header of the ARP reply. + + +From the Library of Outcast Outcast +Chapter 21: Preventing Spoofing Attacks 457 + +To validate that an ARP reply packet is really coming from the address listed inside it, you can enable DAI validation with the following configuration command: +Switch(config)# ip arp inspection validate {[src-mac] [dst-mac] [ip]} + +Be sure to specify at least one of the options: + +■ src-mac: Check the source MAC address in the Ethernet header against the sender MAC address in the ARP reply. + +■ dst-mac: Check the destination MAC address in the Ethernet header against the tar-get MAC address in the ARP reply. + +■ ip: Check the sender’s IP address in all ARP requests; check the sender’s IP address against the target IP address in all ARP replies. + +Example 21-3 demonstrates where DAI is enabled for all switch ports associated with VLAN 104 on an access layer switch. The uplink to a distribution switch (Gigabit Ethernet 1/0/49) is considered to be trusted. + +Example 21-3 Configuring DAI to Validate ARP Replies + +Switch(config)# ip arp inspection vlan 104 +Switch(config)# arp access-list StaticARP +Switch(config-acl)# permit ip host 192.168.1.10 mac host 0006.5b02.a841 +Switch(config-acl)# exit +Switch(config)# ip arp inspection filter StaticARP vlan 104 +Switch(config)# interface gigabitethernet 1/0/49 +Switch(config-if)# ip arp inspection trust + +You can display DAI status information with the show ip arp inspection command. + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +458 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 21-2 lists a reference of these key topics and the page +numbers on which each is found. + + +Table 21-2 Key Topics for Chapter 21 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +List + +Paragraph + +Explains DHCP snooping 451 + +Lists IP Source Guard conditions 454 + +Describes ARP poisoning, ARP spoofing attacks, 455 and dynamic ARP inspection + + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +DHCP snooping, ARP poisoning (also known as ARP spoofing), dynamic ARP inspection (DAI) + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the configuration commands presented in this chapter, cover the right side of Tables 21-3 through 21-5 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + + + + + + + +From the Library of Outcast Outcast +Chapter 21: Preventing Spoofing Attacks 459 + + +Table 21-3 + +Task + + +DHCP Snooping Configuration Commands + +Command Syntax + + + +Globally enable DHCP snooping. + +Define a trusted interface. + +Limit the interface DHCP packet rate. + +Display DHCP snooping status. + +Switch(config)# ip dhcp snooping + +Switch(config-if)# ip dhcp snooping trust + +Switch(config-if)# ip dhcp snooping limit rate rate +Switch# show ip dhcp snooping [binding] + + + + + +Table 21-4 + +Task + + +IP Source Guard Configuration Commands + +Command Syntax + + + +Define a static IP source binding entry. + + +Enable IP source guard on an interface. + +Display IP source guard status. + +Display IP source binding database. + + +Switch(config)# ip source binding mac-address vlan vlan-id ip-address interface type member/module/number +Switch(config-if)# ip verify source [port-security] +Switch# show ip verify source [interface type member/module/number] + +Switch# show ip source binding [ip-address] [mac-address] [dhcp-snooping | static] +[interface type member/module/number] [vlan vlan-id] + + + + + +Table 21-5 + +Task + + +Dynamic ARP Inspection Configuration Commands + +Command Syntax + + + +Enable DAI on a VLAN. + +Define a trusted interface. + +Define a static ARP inspection binding. + + +Apply static ARP inspection bindings. + +Validate addresses within ARP replies. + +Display DAI status. + + +Switch(config)# ip arp inspection vlan vlan-range +Switch(config-if)# ip arp inspection trust + +Switch(config)# arp access-list acl-name permit ip host sender-ip mac host sender-mac [log] + +Switch(config)# ip arp inspection filter arp-acl-name vlan vlan-range [static] +Switch(config)# ip arp inspection validate {[src-mac] [dst-mac ] [ip]} +Switch# show ip arp inspection + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics that you need to master for the CCNP SWITCH exam: + +■ Configuring Authentication: This section describes methods you can use to authenticate users when they need to connect to and manage a switch. +■ Configuring Authorization: This section covers methods that can authorize or grant privilege to administrative users on a switch. +■ Configuring Accounting: This section discusses methods that you can use to record events that occur while an administrative user is connected to a switch. + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 22 + + + + + + +Managing Switch Users + + +Catalyst switches have a variety of methods that can secure or control user access. Users can be authenticated as they connect to or through a switch, and can be authorized to perform certain actions on a switch. User access can also be recorded as switch account-ing information. This chapter discusses methods you can use to control who has access to a switch and what they can do once they are logged in. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt based on your answers to these questions or your own assessment of your knowl-edge of the topics, read the entire chapter. Table 22-1 outlines the major headings in this chapter and the “Do I Know This Already?” quiz questions that go with them. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 22-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Configuring Authentication + +Configuring Authorization + +Configuring Accounting + +Questions Covered in This Section +1–6 + +7–9 + +10 + + + +1. The acronym AAA represents which three of the following functions? + +a. Analysis + +b. Authentication + +c. Accounting + +d. Administration + +e. Authorization + +f. Accounts + + + + +From the Library of Outcast Outcast +462 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +2. If the username command is used in a switch configuration, which one of the fol-lowing authentication methods is implied? + +a. Remote + +b. Local + +c. RADIUS + +d. TACACS+ + +3. Which two external methods of authentication do Catalyst switches support? + +a. Pre-shared key + +b. Active Directory + +c. RADIUS + +d. KERBEROS + +e. TACACS+ + +4. Which one of the following commands should be used to configure a vty line to use the myservers authentication method list? + +a. line authentication myservers + +b. authentication myservers + +c. authentication method myservers + +d. login authentication myservers + +5. A RADIUS server is located at IP address 192.168.199.10. Which one of the follow-ing commands configures a Catalyst switch to find the server? + +a. authentication radius 192.168.199.10 + +b. aaa radius 192.168.199.10 + +c. radius-server host 192.168.199.10 + +d. radius server 192.168.199.10 + +6. Suppose that the following configuration command has been entered on a Catalyst switch. Which one answer correctly identifies the authentication method that will be used first when a user tries to connect to the switch? +Switch(config)# aaa authentication login default radius tacacs+ local +a. RADIUS servers + +b. Locally defined usernames + +c. TACACS+ servers + +d. Default line passwords + +e. None of the these answers; all methods are tried simultaneously + + + +From the Library of Outcast Outcast +Chapter 22: Managing Switch Users 463 + +7. If a user needs to be in privileged EXEC or enable mode, which part of AAA must succeed? (Choose one correct answer.) + +a. Authentication + +b. Authorization + +c. Accounting + +d. Administration + +8. What happens if authorization is not configured on a switch? (Choose one correct answer.) + +a. Authenticated users cannot use any switch commands. + +b. Authenticated users must authenticate themselves to move to a higher privilege level. + +c. Authenticated users can use any switch command. + +d. Authorization cannot be disabled or omitted. + +9. Which two of the following commands will begin a configuration that will authorize users to run any switch command and to make configuration changes? + +a. aaa authorization commands ... + +b. aaa authorization exec ... + +c. aaa authorization config-commands ... + +d. aaa authorization config all ... + +e. aaa authorization any any + +10. Suppose you would like to configure AAA accounting to keep a record of switch commands that are entered by users. Which one of the following commands should you enter to accomplish your goal? +a. aaa accounting exec default start-stop mymethods + +b. aaa accounting commands 15 default start-stop mymethods + +c. aaa accounting system commands start-stop mymethods + +d. aaa accounting commands 15 default none mymethods + + + + + + + + + + + + +From the Library of Outcast Outcast +464 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Foundation Topics + + +You can manage user activity to and through a switch with authentication, authorization, and accounting (AAA) features. AAA uses standardized methods to challenge users for their credentials before access is allowed or authorized. Accounting protocols also can record user activity on a switch. + +In a nutshell, you can think of AAA in the following manner: + +■ Authentication: Who is the user? + +■ Authorization: What is the user allowed to do? + +■ Accounting: What did the user do? + +As a network administrator, you have several methods to manage users who might try to log in to one of your switches to perform some operation. At the most basic level, you could avoid any authentication other than simple passwords configured on the switch console and vty lines. Authorization can be equally simple: When users successfully log in, they are authorized for EXEC level privileges. By entering the correct enable secret password, users can be authorized for a higher privilege level. + +Under the simple scenario, if a user knows the correct password, he can connect to the switch. But who is that user? You might never know who actually logged in and changed the configuration or rebooted the switch! Instead, you could use the username command to configure individual usernames and passwords on the switch. That would solve the user anonymity problem, but your network might consist of many administrative users and many switches, requiring quite a bit of username configuration and maintenance. + +A more scalable solution is to leverage AAA functions that are centralized, standard-ized, resilient, and flexible. For example, a centralized authentication server can contain a database of all possible users and their passwords, as well as policies to authorize user activities. As users come and go, their accounts can be easily updated in one place. All switches and routers query the AAA server to get up-to-date information about a user. + +Key Cisco switches can use the following two protocols to communicate with AAA servers: Topic ■ TACACS+: A Cisco proprietary protocol that separates each of the AAA functions; +communication is secure and encrypted over TCP port 49. + +■ RADIUS: A standards-based protocol that combines authentication and authoriza-tion into a single resource; communication uses UDP ports 1812 and 1813 (account-ing), but is not completely encrypted. + +Both TACACS+ and RADIUS are arranged as a client/server model, where a switch acts as a client talking to a AAA server. Figure 22-1 shows a simplified view of the process. In the AAA client role, a switch is often called a network access device (NAD) or network access server (NAS). When a user tries to connect to a switch, the switch challenges the user for credentials, then passes the credentials along to the AAA server. In simple terms, + + + +From the Library of Outcast Outcast +Chapter 22: Managing Switch Users 465 + +if the user passes authentication, the AAA server returns an “accept” message to the switch. Otherwise, a “reject” message is returned. + +PC Switch AAA Server + + + + +1. Who are you? + + + +2. I am John Smith. + + +5. OK, connect. + +3. Is he John Smith? + + +4. Yes, accept him. + + +Figure 22-1 A Simplified View of AAA + +Cisco implements AAA services in its Identity Services Engine (ISE) and Cisco Secure Access Control Server (ACS). + +Configuring Authentication + +Switch access can be granted only after a user’s identity has been validated. User authenti-cation is commonly used on switches and routers to permit remote access to the network administration staff only. In this case, when someone uses Telnet or Secure Shell (SSH) to log in to a switch, that individual is challenged to provide a username and password. The individual’s credentials are then submitted to a device that can grant the user access. + +Key User authentication can be handled by several methods: +Topic ■ Usernames and passwords configured locally on the switch + +■ One or more external Remote Authentication Dial-In User Service (RADIUS) servers + +■ One or more external Terminal Access Controller Access Control System+ (TACACS+) servers + +Any combination of these methods can be used. In fact, authentication must be defined by grouping the desired methods into a method list. The list contains the types or proto-cols that will be used, in the sequential order that they will be tried. + +To use authentication on a Catalyst switch, you must configure several things in the fol-lowing order: +Step 1. Enable AAA on the switch.By default, AAA is disabled. Therefore, all user authentication is handled locally by configuring usernames and passwords on the switch itself. To enable AAA, use the following global configuration command: + +Switch(config)# aaa new-model + +The new-model refers to the use of method lists, by which authentication methods and sources can be grouped or organized. The new model is much + + +From the Library of Outcast Outcast +466 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +more scalable than the “old model,” in which the authentication source was explicitly configured. +Step 2. Define the source of authentication. + +You can compare user credentials against locally configured usernames and passwords, or against a database managed by external RADIUS or TACACS+ servers. + +Use locally configured usernames and passwords as a last resort, when no other authentication servers are reachable or in use on the network. To define a username, use the following global configuration command: +Switch(config)# username username password password +RADIUS or TACACS+ servers are defined in groups. First, define each server along with its secret shared password. This string is known only to the switch and the server, and provides a key for encrypting the authentication session. Use one of the following global configuration commands: + +Switch(config)# radius-server host { hostname | string] +Switch(config)# tacacs-server host {hostname | +string] + +ip-address} [ key + +ip-address} [ key + +Then define a group name that will contain a list of servers, using the follow-ing global configuration command: +Switch(config)# aaa group server {radius | tacacs+} group-name +Define each server of the group type with the following server-group con-figuration command: +Switch(config-sg)# server ip-address +You can define multiple RADIUS or TACACS+ servers by repeating the com-mands in this step. +Step 3. Define a list of authentication methods to try. + +You can list switch login authentication methods by giving the method a descriptive name or using the unnamed “default” method. List each method or protocol type in the order that it should be tried. If none of the servers for the first method responds, the switch will try the servers in the next method listed. + +Use the following global configuration command to define a method list: + +Switch(config)# aaa authentication login {default | list-name} method1 [method2 ...] +Here the methods refer to the following keywords: + + + + + + + + +From the Library of Outcast Outcast +Chapter 22: Managing Switch Users 467 + +■ tacacs+: Each of the TACACS+ servers configured on the switch is tried, in the order that it was configured. + +■ radius: Each of the RADIUS servers configured on the switch is tried, in the order that it was configured. + +■ local: The user’s credentials are compared against all the username com-mands configured on the local switch. + +■ line: The line passwords authenticate any connected user. No usernames can be used. + + +Tip Be sure to add either the local or line methods at the end of the list, as a last resort. This way, if all the RADIUS or TACACS+ servers are unavailable or the switch is complete-ly isolated from the rest of the network, a locally configured authentication method will eventually be used. Otherwise, you will never be able to access the switch until at least one of the servers comes back online. + + +Step 4. Apply a method list to a switch line. + +First, select a line (console or vty for Telnet/SSH access) using the line line command. Then trigger the user authentication on that line to use an AAA method list. Use the following line-configuration command: +Switch(config-line)# login authentication { default | list-name} +You can use the default method list only if one list is sufficient for all circum-stances on the switch. Otherwise, if you have configured named method lists, you can reference one of them here. +Step 5. After authentication is configured on a switch, it is a good idea to stay logged in on one session so that the authentication can be tested. If you exit the con-figuration session, you will not be able to log in again if the authentication is misconfigured. While you stay logged in on the original session, bring up a new Telnet session to the switch. If you can authenticate successfully, every-thing is configured properly. + +Example 22-1 lists the commands necessary to configure a switch to use two TACACS+ servers to authenticate management users. The servers are 192.168.10.10 and 192.168.10.11, also known as the AAA group named myauthservers. AAA authentica- +tion group myauth is configured to try the TACACS+ server group; if none of the servers is available, local authentication will be used instead. Notice that a username lastresort +is configured for that case. Finally, the myauth method is used to authenticate users on lines vty 0 through 15 for Telnet or SSH access. + + + + + + + + +From the Library of Outcast Outcast +468 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Example 22-1 An Example AAA Authentication Configuration + +Switch(config)# aaa new-model +Switch(config)# username lastresort password MySecretP@ssw0rd +Switch(config)# tacacs-server host 192.168.10.10 key t@c@csk3y +Switch(config)# tacacs-server host 192.168.10.11 key t@c@csk3y +Switch(config)# aaa group server tacacs+ myauthservers +Switch(config-sg)# server 192.168.10.10 +Switch(config-sg)# server 192.168.10.11 +Switch(config-sg)# exit +Switch(config)# aaa authentication login myauth group myauthservers local +Switch(config)# line vty 0 15 +Switch(config-line)# login authentication myauth + + +Configuring Authorization + +After a user is authenticated, the switch allows access to certain services or switch com-mands based on the user’s privilege level. Authenticated users are put at the EXEC level by default. + +Certain commands, such as show interface, are available at the EXEC level. Other com-mands, such as configure terminal, are accessible only if the user is able to move into the privileged EXEC or enable mode. + +Authorization provides a means of granting specific users the ability to perform certain tasks. As with authentication, authorization is performed by querying external RADIUS or TACACS+ servers. If the authorization server has an entry for a user and a service or command, the switch allows the user to perform that task. + +Configure authorization by first defining any RADIUS or TACACS+ servers that will be used. These normally are defined as part of the authentication configuration and do not need to be redefined for authorization. + +Next, define a method list of authorization methods that will be tried in sequence using the following global configuration command: + +Switch(config)# aaa authorization {commands | config-commands +| configuration | exec | network | reverse-access} { default | +list-name} method1 [ method2 ...] + +Here you specify the function or service needing authorization with one of the following keywords: + +■ commands: The server must return permission to use any switch command at any privilege level. + +■ config-commands: The server must return permission to use any switch configura-tion command. + + + + +From the Library of Outcast Outcast +Chapter 22: Managing Switch Users 469 + +■ configuration: The server must return permission to enter the switch configuration mode. + +■ exec: The server must return permission for the user to run a switch EXEC session. The server also can return the privilege level for the user so that the user immedi-ately can be put into privileged EXEC (enable) mode without having to type in the enable command. + +■ network: The server must return permission to use network-related services. + +■ reverse-access: The server must return permission for the user to access a reverse Telnet session on the switch. + +You can identify the method with a descriptive name (list-name) if you are configuring more than one list. Otherwise, a single unnamed list is called the default list. Each autho-rization method then is listed in the order it will be tried. The methods can be any of the following values: + +■ group group-name: Requests are sent to the servers in a specific group. + +■ group {radius | tacacs+}: Requests are sent to all servers of this type. + +■ if-authenticated: Requests are granted if the user already is authenticated. + +■ none: No external authorization is used; every user is authorized successfully. + + +Tip Only TACACS+ servers can authorize users with permission to use specific com-mands. RADIUS servers offer more of an all-or-nothing approach. + + +Next, you can apply an authorization method list to a specific line on the switch. Users accessing the switch through that line will be subject to authorization. Use the following line configuration command: +Switch(config-line)# authorization {commands level | exec | reverse-access} {default | list-name} + +If you do not use this command, the default group is used for all lines. To configure a switch to use AAA authorization for all lines, you enter the following: +Switch(config)# aaa authorization exec default group myauthservers none + +The AAA servers contained in the group myauthservers (configured previously in Example 22-1) are used as a default method to allow authenticated users into the EXEC mode or any other privilege level granted. + +Configuring Accounting + +Catalyst switches also support the capability to use AAA for producing accounting infor-mation of user activity. This accounting information can be collected by RADIUS and + + + +From the Library of Outcast Outcast +470 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +TACACS+ servers. Again, the RADIUS and TACACS+ servers must already be configured and grouped as part of the authentication configuration. + +As usual, you must define a method list giving a sequence of accounting methods by using the following global configuration command: +Switch(config)# aaa accounting {system | exec | commands level} { default +| list-name} { start-stop | stop-only | wait-start | none} method1 [ method2 ...] + +The function triggering the accounting can be one of the following keywords: + +■ system: Major switch events such as a reload are recorded. + +■ exec: User authentication into an EXEC session is recorded, along with information about the user’s address and the time and duration of the session. + +■ commands level: Information about any command running at a specific privilege level is recorded, along with the user who issued the command. + +You can specify that certain types of accounting records be sent to the accounting server using the following keywords: + +■ start-stop: Events are recorded when they start and stop. + +■ stop-only: Events are recorded only when they stop. + +■ none: No events are recorded. + +Next, you can apply an accounting method list to a specific line (console or vty) on the switch. Users accessing the switch through that line will have their activity recorded. Use the following line-configuration command to accomplish this: +Switch(config-line)# accounting {commands level | connection | exec} {default | list-name} + +If you do not use this command, the default group will be used for all lines. In Example 22-2, AAA accounting is configured for all lines on the switch, using the AAA servers contained in the myauthservers group (configured in Example 22-1). User EXEC sessions will be recorded as they start and stop, along with user information. Any commands that are entered while a user is in privilege level 15 (enable mode) will be recorded, too. + +Example 22-2 Configuring AAA Accounting + +Switch(config)# aaa accounting exec default start-stop group myauthservers +Switch(config)# aaa accounting commands 15 default start-stop group myauthservers + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 22: Managing Switch Users 471 + +Exam Preparation Tasks + + +Review All Key Topics + +Review the most important topics in the chapter, noted with the Key Topic icon in the outer margin of the page. Table 22-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 22-2 Key Topics for Chapter 22 Key +Topic Key Topic Element Description Page Number + +List Lists AAA protocols 464 + +List Lists authentication methods 465 + + + +Complete Tables and Lists from Memory There are no memory tables in this chapter. + +Define Key Terms + +Define the following key terms from this chapter, and check your answers in the glossary: + +AAA, NAS, RADIUS, TACACS+ + +Use Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should remember the basic keywords that are needed. + +To test your memory of the configuration commands presented in this chapter, cover the right side of Table 22-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + +Table 22-3 + +Task + + +AAA Configuration Commands + +Command Syntax + + + +Enable AAA on a switch. + +Use local authentication. + + +Switch(config)# aaa new-model + +Switch(config)# username username password password + + + + + +From the Library of Outcast Outcast +472 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +Task +Define individual authentication servers. + + + +Define a group of authentication servers. + + +Define a list of authentication methods to try. +Apply an authentication method list to a line. + +Define a list of authorization methods to try. + + + + +Apply an authorization method list to a line. + + +Define a list of accounting methods to try. + + + +Apply an accounting method list to a line. + +Command Syntax +Switch(config)# radius-server host +{hostname | ip-address} [key string] Switch(config)# tacacs-server host +{hostname | ip-address} [key string] + +Switch(config)# aaa group server {radius | tacacs+} group-name +Switch(config-sg)# server ip-address + +Switch(config)# aaa authentication login +{default | list-name} method1 [method2 ...] + +Switch(config-line)# login authentication {default | list-name } +Switch(config)# aaa authorization {commands | config-commands | +configuration | exec | network | reverse-access} { default | list-name } method1 +[method2 ...] + +Switch(config)# authorization {commands level | exec | reverse-access} { default | list-name } +Switch(config)# aaa accounting {system | exec | commands level} {default | list- name } {start-stop | stop-only | wait-start | none} method1 [method2...] +Switch(config-line)# accounting { commands level | connection | exec } { default | list-name} + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 23 + + + + + + +Final Preparation + + +The first 22 chapters of this book cover the technologies, protocols, commands, and fea-tures required to be prepared to pass the CCNP SWITCH exam. Although these chapters supply the detailed information, most people need more preparation than just reading alone. This chapter details a set of tools and a study plan to help you complete your preparation for the exam. + +This short chapter has two main sections. The first section explains how to install the exam engine and practice exams from the CD that accompanies this book. The second section lists some suggestions for a study plan, now that you have completed all the ear-lier chapters in this book. + + +Note Appendixes C, D, and E exist as soft-copy appendixes on the CD included in the back of this book. + + + +Tools for Final Preparation + +This section lists some information about exam preparation tools and how to access the tools. + +Exam Engine and Questions on the CD + +The CD in the back of the book includes the Pearson Cert Practice Test (PCPT) engine. This software presents you with a set of multiple-choice questions, covering the topics you will be likely find on the real exam. The PCPT engine lets you study the exam con-tent (using study mode) or take a simulated exam (in practice exam mode). + +The CD in the back of the book contains the exam engine. Once installed, you can then activate and download the current SWITCH practice exam from Pearson’s website. Installation of the exam engine takes place in two steps: +Step 1. Install the exam engine from the CD. + +Step 2. Activate and download the SWITCH practice exam. + + + + + +From the Library of Outcast Outcast +476 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Install the Exam Engine + +The following are the steps you should perform to install the software: + +Step 1. Insert the CD into your computer. + +Step 2. The software that automatically runs is the Cisco Press software to access and use all CD-based features, including the exam engine and the CD-only appen-dixes. From the main menu, click the option to Install the Exam Engine. +Step 3. Respond to the prompt windows as you would with any typical software installation process. + +The installation process gives you the option to activate your exam with the activation code supplied on the paper in the CD sleeve. This process requires that you establish a Pearson website login. You will need this login to activate the exam. Therefore, please register when prompted. If you already have a Pearson website login, you do not need to register again; just use your existing login. + +Activate and Download the Practice Exam + +Once the exam engine is installed, you should then activate the exam associated with this book (if you did not do so during the installation process), as follows: +Step 1. Start the PCPT software. + +Step 2. To activate and download the exam associated with this book, from the My Products or Tools tab, click the Activate button. + +Step 3. At the next screen, enter the Activation Key from the paper inside the card-board CD holder in the back of the book. Once entered, click the Activate button. +Step 4. The activation process will download the practice exam. Click Next; then click Finish. + +Once the activation process is completed, the My Products tab should list your new exam. If you do not see the exam, make sure that you selected the My Products tab on the menu. At this point, the software and practice exam are ready to use. Simply select the exam, and click the Use button. + +To update a particular exam you have already activated and downloaded, select the Tools tab, and then click the Update Products button. Updating your exams will ensure that you have the latest changes and updates to the exam data. + +If you want to check for updates to the PCPT exam engine software, select the Tools tab, and then click the Update Application button. This will ensure that you are running the latest version of the software engine. + + + + + + + +From the Library of Outcast Outcast +Chapter 23: Final Preparation 477 + +Activating Other Exams + +The exam software installation process, and the registration process, only has to happen once. Then, for each new exam, only a few steps are required. For instance, if you buy another new Cisco Press Official Cert Guide or Pearson IT Certification Cert Guide, remove the activation code from the CD sleeve in the back of that book—you do not even need the CD at this point. From there, all you have to do is start the exam engine (if not still up and running), and perform Steps 2 through 4 from the previous list. + +Premium Edition + +In addition to the free practice exam provided on the CD-ROM, you can purchase addi-tional exams with expanded functionality directly from Pearson IT Certification. The Premium Edition of this title contains an additional two full practice exams as well as an eBook (in both PDF and ePub format). In addition, the Premium Edition title also has remediation for each question to the specific part of the eBook that relates to that ques-tion. + +Because you have purchased the print version of this title, you can purchase the Premium Edition at a deep discount. You will find a coupon code in the CD sleeve that contains a one-time-use code, in addition to instructions for where you can purchase the Premium Edition. + +To view the Premium Edition product page, go to www.ciscopress.com/ title/9781587205606. + +The Cisco Learning Network + +Cisco provides a wide variety of CCNP preparation tools at a Cisco website called the Cisco Learning Network. Resources found here include sample questions, forums on each Cisco exam, learning video games, and information about each exam. + +To reach the Cisco Learning Network, go to learningnetwork.cisco.com, or just search for “Cisco Learning Network.” To access some of the features/resources, you need to use the login you created at Cisco.com. If you do not have such a login, you can register for free. To register, just go to Cisco.com, click Register at the top of the page, and supply some information. + +Memory Tables + +Like most Certification Guides from Cisco Press, this book purposefully organizes infor-mation into tables and lists for easier study and review. Rereading these tables can be very useful before the exam. However, it is easy to skim over the tables without paying atten-tion to every detail, especially when you remember having seen the table’s contents when reading the chapter. + + + + + + +From the Library of Outcast Outcast +478 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Instead of simply reading the tables in the various chapters, this book’s Appendixes C and D give you another review tool. Appendix C, “Memory Tables,” lists partially completed versions of many of the tables from the book. You can open Appendix C (a PDF on the CD that comes with this book) and print the appendix. For review, you can attempt to complete the tables. This exercise can help you focus during your review. It also exercises the memory connectors in your brain; plus it makes you think about the information without as much information, which forces a little more contemplation about the facts. + +Appendix D, “Memory Table Answer Key,” also a PDF located on the CD, lists the completed tables to check yourself. You can also just refer to the tables as printed in the book. + +Chapter-Ending Review Tools + +Chapters 1 through 22 each have several features in the “Exam Preparation Tasks” sec-tion at the end of the chapter. You might have used some or all of these tools at the end of each chapter, but it can also be useful to use these tools again as you make your final preparations for the exam. + +Study Plan + + +With plenty of resources at your disposal, you should approach studying for the CCNP SWITCH exam with a plan. Consider the following ideas as you move from reading this book to preparing for the exam. + +Recall the Facts + +As with most exams, many facts, concepts, and definitions must be recalled to do well on the test. If you do not work with every Cisco LAN switching feature on a daily basis, you might have trouble remembering everything that might appear on the CCNP SWITCH exam. + +You can refresh your memory and practice recalling information by reviewing the activi-ties in the “Exam Preparation Tasks” section at the end of each chapter. These sections will help you study key topics, memorize the definitions of important LAN switching terms, and recall the basic command syntax of configuration and verification commands. + +Practice Configurations + +The CCNP exams include an emphasis on practical knowledge. You need to be familiar with switch features and the order in which configuration steps should be implemented. You also need to know how to plan a LAN switching project and how to verify your results. + +This means that hands-on experience is going to take you over the top to confidently and accurately build or verify configurations (and pass the exam). If at all possible, try to gain access to some Cisco Catalyst switches and spend some time working with various features. + + +From the Library of Outcast Outcast +Chapter 23: Final Preparation 479 + +If you have access to a lab provided by your company, take advantage of it. You might also have some Cisco equipment in a personal lab at home. Otherwise, there are a num-ber of sources for lab access, including online rack rentals from trusted Cisco Partners and the Cisco Partner E-Learning Connection (PEC), if you work for a Partner. Nothing beats hands-on experience. + +In addition, you can review the key topics in each chapter and follow the example con-figurations in this book. At the least, you will see the command syntax and the sequence in which the configuration commands should be entered. + +Using the Exam Engine + +The PCPT engine on the CD lets you access a database of questions created specifi-cally for this book. The PCPT engine can be used either in study mode or practice exam mode, as follows: + +■ Study mode: Study mode is most useful when you want to use the questions for learning and practicing. In study mode, you can select options like randomizing the order of the questions and answers, automatically viewing answers to the questions as you go, testing on specific topics, and many other options. + +■ Practice exam mode: This mode presents questions in a timed environment, provid-ing you with a more exam-realistic experience. It also restricts your ability to see your score as you progress through the exam and view answers to questions as you are taking the exam. These timed exams not only allow you to study for the actual 300-115 SWITCH Exam, they also help you simulate the time pressure that can occur on the actual exam. + +When doing your final preparation, you can use study mode, practice exam mode, or both. However, after you have seen each question a couple of times, you will likely start to remember the questions, and the usefulness of the exam database may go down. So, consider the following options when using the exam engine: + +■ Use the question database for review. Use study mode to study the questions by chapter, just as with the other final review steps listed in this chapter. Consider upgrading to the Premium Edition of this book if you want to take additional simu-lated exams. + +■ Save the question database, not using it for review during your review of each book part. Save it until the end so that you will not have seen the questions before. Then, use practice exam mode to simulate the exam. + +To select the exam engine mode, click the My Products tab. Select the exam you want to use from the list of available exams, and then click the Use button. The engine should dis-play a window from which you can choose Study Mode or Practice Exam Mode. When in study mode, you can further choose the book chapters, limiting the questions to those explained in the specified chapters of the book. + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPENDIX A + + + + +Answers to the “Do I Know This Already?” Quizzes + + +Chapter 1 Chapter 2 1. A 1. B +2. C 2. B + +3. B 3. B + +4. C 4. C + +5. C 5. C + +6. C 6. B + +7. C 7. C + +8. D 8. D + +9. C 9. B + +10. C 10. C + +11. A, B 11. D + +12. A, C, E 12. B + +13. D + +14. A, C + +15. C, D, E + +16. B + +17. B, C + + + + + + + + + + + + +From the Library of Outcast Outcast +482 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Chapter 3 11. C + +1. C + +2. B. All forms of Ethernet share a com-mon operation at the data link layer. +3. A. All forms of Ethernet are different at the physical layer. +4. B + +5. B + +6. B + +7. C + +8. C + +9. D. Even though you will probably want to disable and reenable the port to get it back in operation, you should begin by figuring out what caused the port to become errdisabled in the first place. Otherwise, if you reenable the port, the same error condition may +cause it to fail again. + + +12. A + +13. B, C. Interface Gig1/0/33 is not listed as a member of VLAN 10, so it could be configured for a different VLAN. The interface could also be config-ured as a trunk carrying one or more VLANs. In that case, it would not be listed as a member of VLAN 10 only. +14. C. Because the interfaces begin with their default configurations, each one uses native VLAN 1. Even though +the interfaces are not configured with a consistent list of allowed VLANs, that will not prevent the trunk link from being negotiated. The real rea-son the trunk is not working is that both switches are configured with dynamic auto mode, causing neither switch to actively negotiate a trunk. Instead, each switch is waiting for the other one to ask for a trunk link. + +10. E 15. A + +11. D 16. D + +12. B 17. E + +13. B 18. A + +14. D Chapter 5 +Chapter 4 1. C 1. C 2. A +2. B 3. C 3. B 4. B 4. B 5. B +5. B 6. B, C 6. C 7. A +7. D 8. C 8. C 9. B 9. B 10. C 10. A 11. B 12. D + +From the Library of Outcast Outcast +Appendix A: Answers to the “Do I Know This Already?” Quizzes 483 + +Chapter 6 Chapter 8 1. C 1. B +2. C 2. C + +3. B 3. C + +4. B 4. B + +5. C 5. B + +6. A 6. A + +7. B 7. B + +8. D 8. B + +9. B 9. C + + +10. B + +11. C + + + + +Chapter 7 + +10. C + +11. C + +12. B + +13. B + + +Chapter 9 + +1. C 1. A 2. C 2. C 3. C 3. A 4. D 4. C 5. C 5. A 6. C 6. B 7. C 7. C 8. B 8. D 9. D 9. C 10. C 10. D 11. A 11. B 12. A 12. C 13. D +14. C + + + + + +From the Library of Outcast Outcast +484 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Chapter 10 Chapter 12 1. E 1. B +2. C 2. C + +3. C 3. A + +4. D 4. A + +5. C 5. C + +6. C 6. D + +7. A 7. B + +8. D 8. D + +9. B +10. C Chapter 13 11. C 1. E +12. C 2. D 13. C 3. C Chapter 11 4. A 1. D 5. B 2. A 6. B 3. A 7. C 4. B 8. B +5. C Chapter 14 6. C 1. A +7. C 2. C 8. D 3. D 9. C 4. C 10. C 5. B 11. C 6. D + +7. C + +8. E + + + + + + + +From the Library of Outcast Outcast +Appendix A: Answers to the “Do I Know This Already?” Quizzes 485 + +Chapter 15 3. C + +1. B. The IP SLA feature may be con-figured on Cisco switches from the CLI. A third-party platform is not +necessary, but may be used to ease + +4. B + +5. B + +6. B + + + +the configuration and analysis if you need to set up many IP SLA tests. +2. A, C + +3. D + +4. B + +5. B + +6. D + + +7. C + +8. C + +9. C + +10. B + + +Chapter 19 + +1. C + + +Chapter 16 2. D + +1. C + +2. A, B, D, E + +3. C + +4. D + +5. A + +6. B + +7. B, C + +8. B, D + +3. B + +4. B. The trick is in the maximum 3 keywords. This sets the maximum number of addresses that can be learned on a port. If only one static address is configured, two more addresses can be learned dynami-cally. +5. C + +6. A + +7. B Chapter 17 8. C + +1. C 9. 2. D +3. A + +4. C + +5. B + +6. B + +7. B + + +C. Because of the variety of user host platforms, port-based authenti-cation (802.1X) cannot be used. The problem also states that the goal is to restrict access to physical switch ports, so AAA is of no benefit. Port security can do the job by restrict-ing access according to the end +users’ MAC addresses. + +10. B, C, D Chapter 18 11. C +1. D 12. B, D + +2. D 13. C + +From the Library of Outcast Outcast +486 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Chapter 20 Chapter 22 1. C 1. B, C, E +2. D 2. B + +3. D 3. C, E + +4. A 4. D + +5. B 5. C + +6. A 6. A + +7. C 7. B + +8. A 8. B + +9. D 9. A, C. The aaa authorization com- + +10. A + +11. A + +12. C + +Chapter 21 + +mand separates the switch com-mand and configuration command functions so that each can have its own method list. The respective keywords are aaa authorization commands and aaa authorization +config-commands. + +1. B 10. B 2. B +3. C, D + +4. C + +5. B + +6. C + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPENDIX B + + + + + + +Exam Updates + + +Over time, reader feedback allows Cisco Press to gauge which topics give our readers the most problems when taking the exams. To assist readers with those topics, the authors create new materials clarifying and expanding upon those troublesome exam topics. +As mentioned in the Introduction, the additional content about the exam is contained in a PDF document on this book’s companion website, at http://www.ciscopress.com/ title/9781587205606. + +This appendix is intended to provide you with updated information if Cisco makes minor modifications to the exam upon which this book is based. When Cisco releases an entirely new exam, the changes are usually too extensive to provide in a simple update appendix. In those cases, you might need to consult the new edition of the book for the updated content. + +This appendix attempts to fill the void that occurs with any print book. In particular, this appendix does the following: + +■ Mentions technical items that might not have been mentioned elsewhere in the book + +■ Covers new topics if Cisco adds new content to the exam over time + +■ Provides a way to get up-to-the-minute current information about content for the exam + + +Always Get the Latest at the Companion Website + +You are reading the version of this appendix that was available when your book was printed. However, given that the main purpose of this appendix is to be a living, changing document, it is important that you look for the latest version online at the book’s com-panion website. To do so, follow these steps: +Step 1. Browse to http://www.ciscopress.com/title/9781587205606. + +Step 2. Select the Appendix option under the More Information box. + +Step 3. Download the latest “Appendix B” document. + + + + + + + +From the Library of Outcast Outcast +490 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + +Note Note that the downloaded document has a version number. Comparing the version of the print Appendix B (Version 1.0) with the latest online version of this appendix, you should do the following: +■ Same version: Ignore the PDF that you downloaded from the companion website. +■ Website has a later version: Ignore this Appendix B in your book and read only the lat-est version that you downloaded from the companion website. + + + +Technical Content + +The current version of this appendix does not contain any additional technical coverage. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +GLOSSARY + + + + + + + + + + +20/80 rule Network traffic pattern where 20 percent of traffic stays in a local area, while 80 percent travels to or from a remote resource. + +802.1Q A method of passing frames and their VLAN associations over a trunk link, based on the IEEE 802.1Q standard. + +AAA Authentication, authorization, and accounting services used to control user access to a switch or a switch port. + +access layer The layer of the network where end users are connected. + +active virtual forwarder (AVF) A GLBP router that takes on a virtual MAC address and forwards traffic received on that address. + +active virtual gateway (AVG) The GLBP router that answers all ARP requests for the vir-tual router address and assigns virtual MAC addresses to each router in the GLBP group. + +adjacency table A table used by CEF to collect the MAC addresses of nodes that can be reached in a single Layer 2 hop. + +alternate port In RSTP, a port other than the root port that has an alternative path to the root bridge. + +ARP poisoning Also known as ARP spoofing. An attack whereby an attacker sends spe-cially crafted ARP replies so that its own MAC address appears as the gateway or some other targeted host. From that time on, unsuspecting clients unknowingly send traffic to the attacker. +Auto-QoS An automated method to configure complex QoS parameters with a simple IOS macro command. + +autonegotiation A mechanism used by a device and a switch port to automatically negoti-ate the link speed and duplex mode. + +autonomous mode AP An access point that operates in a standalone mode, such that it is autonomous and can offer a functioning WLAN cell itself. + +BackboneFast An STP feature that can detect an indirect link failure and shorten the STP convergence time to 30 seconds by bypassing the Max Age timeout period. + +backup port In RSTP, a port that provides a redundant (but less desirable) connection to a segment where another switch port already connects. + + + +From the Library of Outcast Outcast +494 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +best effort delivery Packets are forwarded in the order in which they are received, regard-less of any policy or the packet contents. + +BPDU Bridge protocol data unit; the data message exchanged by switches participating in the Spanning Tree Protocol. + +BPDU filtering Prevents BPDUs from being sent or processed on a switch port. + +BPDU Guard An STP feature that disables a switch port if any BPDU is received there. + +bridging loop A condition where Ethernet frames are forwarded endlessly around a Layer 2 loop formed between switches. + +broadcast domain The extent of a network where a single broadcast frame or packet will be seen. + +CAM Content-addressable memory; the high-performance table used by a switch to corre-late MAC addresses with the switch interfaces where they can be found. + +CDP Cisco Discovery Protocol; a Cisco proprietary protocol used to advertise and discover directly connected devices automatically + +CEF Cisco Express Forwarding; an efficient topology-based system for forwarding IP packets. + +collapsed core A network design where the core and distribution layers are collapsed or combined into a single layer of switches. + +collision domain The extent within a network that an Ethernet collision will be noticed or experienced. + +Common Spanning Tree (CST) A single instance of STP defined in the IEEE 802.1Q standard. + +community VLAN A type of secondary private VLAN; switch ports associated with a com-munity VLAN can communicate with each other. + +Control and Provisioning Wireless Access Point (CAPWAP) A standards-based tun-neling protocol used to transport control messages and data packets between a wireless LAN controller (WLC) and a lightweight access point (LAP). CAPWAP is defined in RFC 4118. +core layer The “backbone” layer of the network where all distribution layer switches are aggregated. + +CoS marking Class of service marking; a method of marking frames with a QoS value as they cross a trunk link between two switches. + +CSMA/CA Carrier sense multiple access collision avoidance. The mechanism used in 802.11 WLANs by which clients attempt to avoid collisions. + +CSMA/CD Carrier sense multiple access collision detect. A mechanism used on Ethernet networks to detect collisions and cause transmitting devices to back off for a random time. + +delay The amount of time required for a packet to be forwarded across a network. + + + + +From the Library of Outcast Outcast +Glossary 495 + +designated port One nonroot port selected on a network segment, such that only one switch forwards traffic to and from that segment. + +DHCP Dynamic Host Configuration Protocol; a protocol used to negotiate IP address assignment between a client and a server. The client and server must reside on the same VLAN. +DHCP relay A multilayer switch that intercepts and relays DHCP negotiation messages between a client and a DHCP server, even if they exist on different VLANs. + +DHCP snooping A security feature that enables a switch to intercept all DHCP requests coming from untrusted switch ports before they are flooded to unsuspecting users. + +DHCPv6 A DHCP service that is compatible with IPv6 clients; a switch can assign IPv6 addresses and advertise DHCP-related options. + +DHCPv6 Lite A DHCP service that is compatible with IPv6 clients; IPv6 addresses are obtained through stateless autoconfiguration, but DHCP-related options are advertised through the DHCPv6 Lite server. +differentiated services (DiffServ) model Packet forwarding is handled according to local QoS policies on a per-device or per-hop basis. + +discarding state In RSTP, incoming frames are dropped and no MAC addresses are learned. + +distribution layer The layer of the network where access layer switches are aggregated and routing is performed. + +DTP Dynamic Trunking Protocol; a Cisco proprietary method of negotiating a trunk link between two switches. + +dual core A network design that has a distinct core layer made up of a redundant pair of switches. + +duplex mismatch A condition where the devices on each end of a link use conflicting duplex modes. + +duplex mode The Ethernet mode that governs how devices can transmit over a connec-tion. Half-duplex mode forces only one device to transmit at a time, as all devices share the same media. Full-duplex mode is used when only two devices share the media, such that both devices can transmit simultaneously. +Dynamic ARP inspection (DAI) A security feature that can mitigate ARP-based attacks. ARP replies received on untrusted switch ports are checked against known, good values con-tained in the DHCP snooping database. +edge port In RSTP, a port at the “edge” of the network, where only a single host connects. + +end-to-end VLAN A single VLAN that spans the entire switched network, from one end to the other. + +EtherChannel A logical link made up of bundled or aggregated physical links. + + + + +From the Library of Outcast Outcast +496 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +EtherChannel Guard A feature that can detect errors in the EtherChannel configuration on a switch. + +expedited forwarding (EF) The DSCP value used to mark time-critical packets for pre-mium QoS handling. EF is usually reserved for voice bearer traffic. + +FIB Forwarding Information Base; a CEF database that contains the current routing table. + +flooding An Ethernet frame is replicated and sent out every available switch port. + +forward delay The time interval that a switch spends in the Listening and Learning states; default 15 seconds. + +hello time The time interval between configuration BPDUs sent by the root bridge; defaults to 2 seconds. + +hierarchical network design A campus network that is usually organized into an access layer, a distribution layer, and a core layer. + +host port A switch port mapped to a private VLAN such that a connected device can com-municate with only a promiscuous port or ports within the same community VLAN. + +HSRP active router The router in a Hot Standby Router Protocol (HSRP) group that for-wards traffic sent to the virtual gateway IP and MAC address. + +HSRP standby router A router in an HSRP group that waits until the active router fails before taking over that role. + +IEEE 802.1X The standard that defines port-based authentication between a network device and a client device. + +IEEE 802.3 The standard upon which all generations of Ethernet (Ethernet, Fast Ethernet, Gigabit Ethernet, 10-Gigabit Ethernet) are based. + +inter-VLAN routing The function performed by a Layer 3 device that connects and for-wards packets between multiple VLANs. + +IP Service Level Agreement (IP SLA) A feature within Cisco IOS that can be used to test how specific types of traffic are being handled end to end across a network. + +IP SLA responder A network device that responds to and participates in IP SLA tests. + +ISL Inter-Switch Link; a Cisco proprietary method of tagging frames passing over a trunk link. + +isolated VLAN A type of secondary private VLAN; switch ports associated with an iso-lated VLAN are effectively isolated from each other. + +IST instance Internal spanning-tree instance; used by Multiple Spanning Tree (MST) to represent an entire region as a single virtual bridge to a common spanning tree. + +jitter The variation in packet delivery delay times. + +LACP Link Aggregation Control Protocol; a standards-based method for negotiating EtherChannels automatically. + + + +From the Library of Outcast Outcast +Glossary 497 + + +Layer 2 roaming same IP address. + +Layer 3 roaming + + +Movement of a WLAN client from one AP to another, while keeping its + + +Movement of a WLAN client from one AP to another, where the APs + +are located across IP subnet boundaries. + +lightweight access point (LAP) An access point that runs a lightweight code image that performs real-time 802.11 operations. An LAP cannot offer a fully functioning WLAN cell by itself; instead, it must coexist with a wireless LAN controller. +Lightweight Access Point Protocol (LWAPP) The tunneling protocol developed by Cisco that is used to transport control messages and data packets between a WLC and an LAP. +link-local address An IPv6 address used by a device for neighbor discovery; link-local addresses begin with the prefix FE80::/10 followed by an interface identifier in the EUI-64 format. Packets sent from a link-local address must stay on the local link and not be forward-ed elsewhere. +LLDP Link Layer Discovery Protocol; a standards-based protocol used to advertise and dis-cover directly connected devices. + +local SPAN A Switched Port Analyzer (SPAN) session configured to mirror traffic from a source interface or VLAN onto a different interface for monitoring or analysis purposes. + +local VLAN A single VLAN that is bounded by a small area of the network, situated locally with a group of member devices. + +Loop Guard An STP feature that disables a switch port if expected BPDUs suddenly go missing. + +Management Information Base (MIB) A collection of information and data that a net-work device maintains about itself and its operation. MIB variables can be read or written through SNMP. +Max Age time The time interval that a switch stores a BPDU before discarding it or aging it out; the default is 20 seconds. + +MST Multiple Spanning Tree protocol, used to map one or more VLANs to a single STP instance, reducing the total number of STP instances. + +MST instance (MSTI) A single instance of STP running within an MST region; multiple VLANs can be mapped to the MST instance. + +MST region A group of switches running compatible MST configurations. + +multichassis EtherChannel (MEC) An EtherChannel made up of links that are bundled across multiple switches that are organized as a single logical or virtual switch. + +native VLAN On an 802.1Q trunk link, frames associated with the native VLAN are not tagged at all. + +network access server (NAS) The function a switch performs as it intervenes between end users and AAA servers. + + + +From the Library of Outcast Outcast +498 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Network Time Protocol (NTP) A mechanism used to synchronize a device’s time clock with another, more reliable source. + +nonstop forwarding (NSF) A redundancy method that quickly rebuilds routing informa-tion after a redundant Catalyst switch supervisor takes over. + +object identifier (OID) A unique string of digits that identifies a variable or a tree of vari-ables in a MIB. + +packet loss Packets are simply dropped without delivery for some reason. + +packet rewrite Just before forwarding a packet, a multilayer switch has to change several fields in the packet to reflect the Layer 3 forwarding operation. + +PAgP Port Aggregation Protocol; a Cisco-developed method for negotiating EtherChannels automatically. + +point-to-point port In the Cisco implementation of RSTP, a full-duplex port that connects to another switch and becomes a designated port. + +PortFast An STP feature used on a host port, where a single host is connected, that short-ens the Listening and Learning states so that the host can gain quick access to the network. + +power class Categories of PoE devices based on the maximum amount of power required; power classes range from 0 to 4. + +Power over Ethernet (PoE) Electrical power supplied to a networked device over the net-work cabling itself. + +primary VLAN A normal Layer 2 VLAN used as the basis for a private VLAN when it is associated with one or more secondary VLANs. + +private VLAN A special purpose VLAN, designated as either primary or secondary, which can restrict or isolate traffic flow with other private VLANs. + +promiscuous port A switch port mapped to a private VLAN such that a connected device can communicate with any other switch port in the private VLAN. + +PVST Per-VLAN Spanning Tree; a Cisco proprietary version of STP where one instance of STP runs on each VLAN present in a Layer 2 switch. + +PVST+ Per-VLAN Spanning Tree Plus; a Cisco proprietary version of PVST that enables PVST, PVST+, and CST to interoperate on a switch. + +quality of service (QoS) The overall method used in a network to protect and prioritize time-critical or important traffic. + +Remote Authentication Dial-In User Service (RADIUS) A standards-based protocol used to communicate with AAA servers. + +root bridge The single STP device that is elected as a common frame of reference for working out a loop-free topology. + +Root Guard An STP feature that controls where candidate root bridges can be found on a switch. + + + +From the Library of Outcast Outcast +Glossary 499 + +root path cost The cumulative cost of all the links leading to the root bridge. + +root port Each switch selects one port that has the lowest root path cost leading toward the root bridge. + +Route Processor Redundancy (RPR) A redundancy mode where a redundant supervisor partially boots and waits to become active after the primary supervisor fails. + +Route Processor Redundancy Plus (RPR+) A redundancy mode where a redundant supervisor boots up and waits to begin Layer 2 or Layer 3 functions. + +RPVST+ Also known as Rapid PVST+, where RSTP is used on a per-VLAN basis; in effect, RSTP replaces traditional 802.1D STP in the PVST+ operation. + +RSPAN Also known as Remote Switched Port Analyzer, where a SPAN session is split across two independent switches and mirrored data is transported over a special purpose VLAN between them. +RSTP The Rapid Spanning Tree Protocol, based on the IEEE 802.1w standard. + +SDM Switching Database Manager: A Cisco IOS Software function that configures or tunes memory table space on a LAN switch platform + +secondary VLAN A unidirectional VLAN that can pass traffic to and from its associated primary VLAN, but not with any other secondary VLAN. + +Simple Network Management Protocol (SNMP) A protocol used between an SNMP manager and an SNMP agent to obtain data about device operation or to set configuration parameters. +SNMP agent A process that runs on the network device being monitored and uses SNMP to provide data to an SNMP manager. + +SNMP inform A message that a network device sends to alert an SNMP manager about an event or a failure. The SNMP manager must acknowledge receipt of the inform by echoing the message back to the SNMP agent in the device. +SNMP manager A network management system that uses SNMP to poll network devices for operational and configuration data. + +SNMP trap A message that a network device sends to alert an SNMP manager about an event or a failure. The SNMP manager does not need to acknowledge a trap that it receives. + +SPAN Also known as Switched Port Analyzer, where a switch mirrors traffic from a source interface or VLAN onto a different interface for monitoring or analysis purposes. + +Spanning Tree Protocol (STP) A protocol communicated between Layer 2 switches that attempts to detect a loop in the topology before it forms, thus preventing a bridging loop from occurring. +Split-MAC architecture Normal Media Access Control (MAC) operations are divided into two distinct locations, the LAP and the WLC, such that the two form a completely func-tioning WLAN cell. + + + + +From the Library of Outcast Outcast +500 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +SSID Service set identifier; a text string that identifies a service set, or a group of WLAN devices, that can communicate with each other. + +StackWise Cisco method to connect multiple switches together to form one logical switch. The switch stack is controlled by one of the member switches, while others can take over the role if needed. Member switches are connected to each other through a dual ring of StackWise cables. +stateful switchover (SSO) A redundancy mode where a redundant supervisor fully boots and initializes, allowing configurations and Layer 2 tables to be synchronized between an active supervisor and a redundant one. +sticky MAC address MAC addresses dynamically learned by the port security feature are remembered and expected to appear on the same switch ports. + +stratum A number that indicates in which layer of the NTP hierarchy a time source is located; stratum 1 represents the most authoritative and accurate time source. + +superior BPDU A received BPDU that contains a better bridge ID than the current root bridge. + +SVI Switched virtual interface; a logical interface used to assign a Layer 3 address to an entire VLAN. + +switch block A network module or building block that contains a group of access layer switches, together with the pair of distribution switches that connect them. + +switch spoofing A malicious host uses DTP to masquerade as a switch, with the goal of negotiating a trunk link and gaining access to additional VLANs. + +synchronization In RSTP, the process by which two switches exchange a proposal-agree-ment handshake to make sure neither will introduce a bridging loop. + +syslog System message logs that are generated by a switch and can be collected locally or sent to and collected on a remote server. + +syslog severity level An indicator of how important or severe a logged event is. + +TACACS+ (Terminal Access Controller Access-Control System Plus) A Cisco propri-etary protocol used to communicate with AAA servers. + +TCAM Ternary content-addressable memory; a switching table found in Catalyst switches that is used to evaluate packet forwarding decisions based on policies or access lists. TCAM evaluation is performed simultaneously with the Layer 2 or Layer 3 forwarding decisions. +TCN Topology Change Notification; a message sent out the root port of a switch when it detects a port moving into the Forwarding state or back into the Blocking state. The TCN is sent toward the root bridge, where it is reflected and propagated to every other switch in the Layer 2 network. +TLV An attribute formed by type, length, and value parameters; used in LLDP advertise-ments. + +transparent bridge A network device that isolates two physical LANs but forwards Ethernet frames between them. + + +From the Library of Outcast Outcast +Glossary 501 + +trust boundary A perimeter in a network, formed by switches and routers, where QoS decisions take place. QoS information found inside incoming traffic is evaluated at the trust boundary; either it is trusted or it is not trusted. In the latter case, the QoS information can be altered or overridden. All devices inside the trust boundary can assume that QoS informa-tion is correct and trusted, such that the QoS information already conforms to enterprise policies. +UDLD Unidirectional Link Detection; a feature that enables a switch to confirm that a link is operating bidirectionally. If not, the port can be disabled automatically. + +unknown unicast flooding The action taken by a switch when the destination MAC address cannot be found; the frame is flooded or replicated out all switch ports except the receiving port. +UplinkFast An STP feature that enables access layer switches to unblock a redundant uplink when the primary root port fails. + +VACL VLAN access control list; a filter that can control traffic passing within a VLAN. + +Virtual Switching System (VSS) Cisco method to join two separate physical switch chas-sis together as one logical switch. The two chassis are managed by one supervisor, while the other can take over if needed. The switch chassis are connected with VSS links and can be geographically separated. +VLAN Virtual LAN; a logical network existing on one or more Layer 2 switches, forming a single broadcast domain. + +VLAN hopping A malicious host sends specially crafted frames that contain extra, spoofed 802.1Q trunking tags into an access port, while the packet payloads appear on a totally dif-ferent VLAN. +VLAN number A unique index number given to a VLAN on a switch, differentiating it from other VLANs on the switch. + + +VLAN trunk tagging. + +voice VLAN voice traffic. + + +A physical link that can carry traffic on more than one VLAN through logical + + +The VLAN used between a Cisco IP Phone and a Catalyst switch to carry + + +VRRP backup router A router in a VRRP group that waits until the master router fails before taking over that role. + +VRRP master router The router in a VRRP group that forwards traffic sent to the virtual gateway IP and MAC address. + +VSPAN Also known as VLAN-based Switched Port Analyzer, where a switch mirrors traffic from a source VLAN onto a different interface for monitoring or analysis purposes. + +VTP VLAN Trunking Protocol; used to communicate VLAN configuration information among a group of switches. + + + + + +From the Library of Outcast Outcast +502 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +VTP configuration revision number An index that indicates the current version of VLAN information used in the VTP domain; a higher number is more preferable. + + +VTP domain ments. + +VTP pruning + + +A logical grouping of switches that share a common set of VLAN require- + + +VTP reduces unnecessary flooded traffic by pruning or removing VLANs + +from a trunk link, only when there are no active hosts associated with the VLANs. + +VTP synchronization problem An unexpected VTP advertisement with a higher configu-ration revision number is received, overriding valid information in a VTP domain. + +wireless LAN controller (WLC) A Cisco device that provides management functions to lightweight access points and aggregates all traffic to and from the LAPs. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + +Index + + + + + + + + +Numbers 10GBASE-CX4, 66 10GBASE-ER, 66 10GBASE-LR, 66 10GBASE-LRM, 66 10GBASE-LX4, 66 10GBASE-SR, 66 +10GE (10Gigabit Ethernet) links, 245 +10GEC (10-Gigabit Etherchannel) links, 245 +10-Gigabit Ethernet 10GBASE-CX4, 66 10GBASE-ER, 66 10GBASE-LR, 66 10GBASE-LRM, 66 10GBASE-LX4, 66 10GBASE-SR, 66 bandwidth, 60 PMD interfaces, 62 PMD types, 62 +20/80 rule, 493 +40-Gigabit Ethernet, 63 bandwidth, 60 +100-Gigabit Ethernet, 63 bandwidth, 60 +802.1.x switch port authentication example, 420-421 +configuration, 419-420 + + +802.IQ, 493 1000BASE-LX/LH, 65 1000BASE-SX, 65 1000BASE-T, 66 1000BASE-ZX, 66 + +A + +AAA (authentication, authorization, accounting), 493 +enabling, 465-466 overview, 464 servers +RADIUS protocol, 464 TACACS+ protocol, 464 +accelerated CEF (aCEF), 276 access keyword, 328 +access layer, 12, 493 independent switches, 369 switch platforms, 25 switches, 12 +access maps (VACLs), 435 access vlan command, 98 accounting +configuration, 460, 469-470 +See also AAA (authentication, authorization, accounting) +aCEF (accelerated CEF), 276 +ACK message (DHCP), 292 + + + + +From the Library of Outcast Outcast + + + + + + + + + + + +ACLs (access control lists), 36 QoS, 36, 39 +VLAN ( See VACLs (VLAN access lists)) +ACS (Access Control Server), 465 Activation Key for practice exam, 476 address keyword, 45 +addresses +gateway, HSRP, 390 leases, 294 +link-local addresses, 497 manual binding, 294-295 See also MAC addresses +adjacency table, 276-279, 493 after keyword, 341 +ageout keyword, 341 aggregation +EtherChannel, 240, 245-247 bundling ports, 247 LACP, 240, 252 +load balancing, 249-251 negotiation protocols, 251 PAgP, 240, 251-252 +traffic distribution, 247-249 +LACP (Link Aggregation Control Protocol), 240 +PAgP (Port Aggregation Protocol), 240 +aggressive keyword, 212 +alternate port, 493 + +answers to quizzes, 481-486 any keyword, 44 +APs (access points), lightweight mode, 118 +ARP inspection, 448 ARP poisoning, 493 +ASN.1 (Abstract Syntax Notation 1), 324 +auth keyword, 328-329 authentication +802.1x, 419 +example, 420-421 configuration, 460, 465-468 HSRP, 388 +MD5, 388-389 plain text, 388 +method list, 466 +port-based, Catalyst switches, 418 RADIUS, 419 +session encryption, 466 source, 466 +See also AAA (authentication, authorization, accounting) +authorization +configuration, 460, 468-469 +See also AAA (authentication, authorization, accounting) +auto keyword, 80 +autonegotiation, 64, 493 + + + +From the Library of Outcast Outcast +506 autonomous mode AP + + +autonomous mode AP, 493 Auto-QoS, 493 +AVF (active virtual forwarder), 398-400, 493 +AVG (active virtual gateway), 397-398, 493 + + +B + +Backbone Fast, 493 backup port, 493 bandwidth +Ethernet segments, 60 scaling, 245 +link bundles, 246 throwing bandwidth, 7 VTP pruning and, 139 +banner motd command, 424 best effort delivery, 494 Blocking state, 162, 223 +BPDUs (bridge protocol data units), 155, 355, 494 +BPDU Guard, 208-209, 494 Configuration BPDU, 155 +messages, 155-156 filtering, 494 +STP disabling, 213-214 Loop Guard and, 210-211 PortFast, enabling, 208-209 root bridges and, 157 +Root Guard, 207-208 RSTP and, 224-225 sudden loss, 210 suprerior, 500 +TCN (Topology Change Notification) BPDU, 155 +topology change messages, 167 + +bridging +Bridge Priority field, 156 frames and, 151-152 loops, 494 +preventing, 154-155 MAC address, 156-157 redundant, 152 +root bridges, 156-158 election example, 157 +transparent +Layer 2 and, 32-35 STP and, 151-154 switches and, 152 +broadcast domain, 494 broadcast keyword, 422 broadcast traffic, 8 +building distribution switches, 12 + + +C cabling +Fast Ethernet, 60 Gigabit Ethernet, 61 +port cables, connecting switches and devices, 65-66 +caching, route caching, multilayer switching, 37 +CAM (content-addressable memory) table, 40-41, 494 +command syntax, 41 table operation, 45-48 table size, 47-50 TCAM, 41 +example, 43-44 +port operations, 44-45 +value patterns, 42 + + + + +From the Library of Outcast Outcast +commands 507 + + +campus networks, 7 core size, 24 +CAPWAP (control and provisioning wireless access point), 494 +Catalyst switch, 28 See also switches +catalyst switches, 37 CD accompanying book +exam engine, 475-476 Memory Tables, 477-478 Premium Edition of book, 477 +CDP (Cisco Discovery Protocol), 355, 494 +connected devices, 73-75 +neighbor information display, 74-75 securing, 426 +CEF (Cisco Express Forwarding), 37, 272-273, 494 +CEF punt, 275 configuration, 280 +multilayer switching and, 264, 272 table entry updates, 275 verification, 283-284 +Cisco hierarchical design, 24-26 Cisco IP phone, 112-113 +voice VLAN trunking mode, 114 Cisco Learning Network, 477 client mode (VTP), 127 +client-identifier command, 295 clocks, synchronization, 313-315 collapsed core, 23-24, 494 collision domains, 494 +limiting size, 8 +collisions, switched Ethernet and, 59 +command-line interface, 33 + +commands access vlan, 98 +banner motd, 424 CAM tables, 41 client-identifier, 295 +debug ip dhcp server, 295 default-router, 293 enable secret, 424 +ip dhcp excluded-address, 293 ip dhcp pool, 293 +ip helper-address, 297 +ip http access-class configuration, 425 ip http server, 424 +ip sla key-chain, 339 ip sla schedule, 341 key, 389 +key chain, 389 key-string, 389 +lacp port-priority, 255 lease, 294 +line line, 467 logging host, 311 macro, 186 +monitor session filter, 358 MST configuration, 237 name, 98 +network, 293 no cdp run, 75 +no ip cef interface configuration, 280 no ip route-cache cef, 280 +no shutdown, 213 no switchport, 270 no vlan vlan-num, 98 +ntp access-group, 316 ntp associations, 315 +ntp server, 315 + + + + + +From the Library of Outcast Outcast +508 commands + + +ntp status, 315 PoE, 83 +show adjacency summary, 276 show cdp neighbors, 73 +show cef not-cef-switched, 279 show clock, 312 +show dotlx all, 420 +show etherchannel load-balance, 250 show etherchannel port-channel, 250 show etherchannel summary, 257 show interface, 72 +show interface switchport, 115 show interfaces, 71 +show interfaces status, 71 +show interfaces status err-disabled, 417 show ip arp, 278 +show ip arp inspection, 457 show ip cef, 274 +show ip dhcp binding, 294 show ip interface, 281 show ip interface brief, 282 +show ip sla configuration, 342 show lldp, 75 +show logging, 311 +show mac address-table count, 47 show mac address-table EXEC, 45 show port-security, 418 +show port-security interface, 417 show spanning-tree interface, 116, 191 show spanning-tree vlan vlan-id, 230 show vlan, 99, 281 +show vlan brief, 99 +show vlan id vlan-id EXEC, 110 show vtp status, 133, 137 +shutdown, 70, 213 + +snmp-server group, 328 snmp-server host, 327 snmp-server user, 328 snmp-server view, 328 spanning-tree mode, 231 +spanning-tree vlan vlan-id priority bridge-priority, 188 +spanning-tree vlan vlan-id root, 188 STP protection and, 214 +summer-time recurring, 313 switchport, 98 +switchport interface, 269 switchport mode, 107 switchport nonegotiate, 108 +switchport trunk allowed vlan, 106-107, 140 +switchport trunk encapsulation, 106 switchport trunk native vlan, 106 terminal monitor, 310 +track, 343 udp-jitter, 340 username, 464 +VTP configuration troubleshooting, 142 +commands keyword, 468 commands level keyword, 470 community VLAN, 494 +companion website, exam updates, 489-490 +config-commands keyword, 468 configuration +accounting, 460, 469-470 authentication, 460, 465-468 authorization, 460, 468-469 +autoconfiguration, stateless, 298 + + + + + + + +From the Library of Outcast Outcast +deployment, VLANs 509 + + +CEF (Cisco Express Forwarding), 280 EtherChannel, 253-257 +EtherChannel Guard, 255-257 LACP, 254-255 +PAgP, 253-254 inter-VLAN routing, 269 +Layer 2, 270 Layer 3, 270-271 SVI port, 271-272 +local SPAN, 354-356 +MST (Multiple Spanning Tree), 236-237 +PoE, 80-81 PVLANs, 438-439 RSPAN, 357-359 RSTP, 229-230 SNMPv1, 327 SNMPv2C, 327 SNMPv3, 328-329 static VLANs, 97-99 study plan, 478-479 switch ports +duplex mode, 69 link mode, 69 +port description, 68 port selection, 66-68 port speed, 68 +VACLs, 435-436 VLAN trunks, 106-110 voice VLANs, 113-115 VRRP, 394-395 +VTP, 132-133 example, 136-137 +management domain, 134-135 + + +modes, 135-136 version, 133-134 +Configuration BPDU, 155 message content, 155-156 +configuration keyword, 469 connections +device discovery, 73-77 +CDP (Cisco Discovery Protocol), 73-75 +LLDP, 75-77 Ethernet +Gigabit Ethernet, 65-66 port cables, 65-66 +connectivity, troubleshooting, 71 convergence, RSTP, 225 +sequence of events, 228 core layer, 10, 20-23, 494 +campus networks, 24 collapsed core, 23-24 switches, 12-13 +CoS marking, 494 +CST (Common Spanning Tree), 173, 494 + + +D + +DAI (Dynamic ARP Inspection), 495 dCEF (distributed CEF), 276 +debug ip dhcp server command, 295 default keyword, 214 +default-router command, 293 delay, 494 +delay keyword, 387 +deployment, VLANs, 99-100 + + + + + + + + +From the Library of Outcast Outcast +510 devices + + +devices connected, 54 +discovery, 73-77 +Ethernet port cables, 65-66 PoE and, detecting, 79-80 power for operation, 54 +(See also PoE (Power over Ethernet)) +DHCP (Dynamic Host Configuration Protocol), 495 +ACK message, 292 Discover message, 292 +IPv4, server configuration, 288, 293-294 +IPv6, configuration, 288 IPv6 support, 297 +DHCPv6 server, 298-299 stateless autoconfiguration, 298 +manual address binding, 294-295 MLS and, 292-293 +DHCPv6 Lite, 299-300 DHCPv6 relay agent, 300 +IPv4 server configuration, 293-294 +IPv6 operation, 300 +manual address binding, 294-295 options configuration, 296 relays, 296-297 +Offer message, 292 relay, 495 +Request message, 292 snooping, 448, 495 +DHCP relay agent, 300 DHCPv6, 298-299, 495 DHCPv6 Lite, 299-300, 495 +DiffServ model, 495 + +direct topology changes, 168-169 disable keyword, 212 +Disabled state, 162, 223 discard adjacency, 279 Discarding state, 224 discarding state, 495 +Discover message (DHCP), 292 distributed CEF (dCEF), 276 distribution layer, 12, 495 +switch platforms, 26 switches +building, 12 redundant, 14 +distribution switches, 18 +“Do I Know This Already?” Quiz answers, 481-486 +domains, collision domains, limiting size, 8 +dotlq keyword, 355 +DP (designated port), 495 +DPs (designated ports), electing, 160-162 +DRM (dual-router mode), 374 drop adjacency, 279 +DTP (Dynamic Trunking Protocol), 355, 495 +spoofing and, 441-443 dual core, 495 +duplex mismatch, 495 duplex mode, 495 duplex operation +Ethernet, 63-65 +speed/duplex mismatches, 72-73 switch ports, configuration, 69 +dynamic trunking protocol, 105-106 +dynamic VLANs, 99 + + + + + + +From the Library of Outcast Outcast +exec keyword 511 + + +E + +EAPOL (Extensible Authentication Protocol over LANs), 418-419 +edge port, 226, 495 +EF (expedited forwarding), 496 enable keyword, 212 +enable secret command, 424 +end-to-end VLANs, 100-101, 495 errdisable state, 69-70 +ports, 417-418 +re-enabling ports, 70-71 +error detection, switch ports, 69-70 error management, switch ports, 69 error recovery, 70-71 EtherChannel, 495 +aggregation, 245-247 bundling ports, 247 LACP, 252 +negotiation protocols, 251 PAgP, 251-252 +traffic distribution, 247-249 configuration, 240, 253 +EtherChannel Guard, 255-257 LACP, 254-255 +PAgP, 253-254 frame distribution, 248 +LACP (Link Aggregation Channel), 240 load balancing, 249-251 +logical switches, 369-370 Multichassis, 247 negotiation protocols, 251 +PAgP (Port Aggregation Protocol), 240 ports, bundling, 247 +traffic distribution, 247-249 +troubleshooting, 240, 257-259 + + +EtherChannel Guard, 255-257, 496 Ethernet, 54 +10-Gigabit Ethernet bandwidth, 60 PMD interfaces, 62 PMD types, 62 +40-Gigabit Ethernet, 63 bandwidth, 60 +100-Gigabit Ethernet, 63 bandwidth, 60 +duplex operation, 63-65 +Fast Ethernet, bandwidth, 60 Gigabit Ethernet +bandwidth, 60 cabling, 61 +link bundling, 62 +modular connectivity, 65-66 overview, 59 +ports, 67 scaling, 60 segments +bandwidth, 60 crowded, 59 +switches, 59 collisions, 59 +Ethernet switches, 28 exam engine, 475 +installation, 476 mode selection, 479 study plan, 479 +Exam Preparation Tasks, 478 exams +study plan, 478-479 updates, 489 +companion website, 489-490 EXEC, authenticated users, 468 +exec keyword, 469-470 + + + + +From the Library of Outcast Outcast +512 Fast EtherChannel + + +F + +Fast EtherChannel, 62 Fast Ethernet +bandwidth, 60 +cabling specifications, 60 link bundling, 61 +FE (Fast Ethernet) links, 245 +FEC (Fast EtherChannel) links, 245 +FHRP (first-hop redundancy protocols), 384 +FIB (Forwarding Information Base), 37, 496 +aCEF (accelerated CEF), 276 dCEF (distributed CEF), 276 +MLS (multilayer switching) and, 273-276 +filters, BPDU, 494 flat networks, 95 +switched networks and, 95 flooding, 496 +FM (Feature Manager), 41 forward delay, 496 +Forward Delay timer (STP), 165 forwarding packets, 384-385 Forwarding state, 163, 223-224 frames +bridging and, 151-152 EtherChannel, 248 +forwarding, MAC addresses and, 33 mirrored, 354 +Storm Control and, 421-423 +VLAN trunks, 103 + +G + +GARP (VLAN Registration Protocol), 122 +gateway addresses, HSRP, 390 gateway redundancy, verification, 405 GBIC (gigabit bidrectional link), 211 GE (Gigabit Ethernet) links, 245 +GEC (Gigabit EtherChannel) links, 245 Gigabit Ethernet +1000BASE-LX/LH, 65 1000BASE-SX, 65 1000BASE-T, 66 1000BASE-ZX, 66 bandwidth, 60 +cabling specifications, 61 link bundling, 62 +modular connectivity, 65-66 +GLBP (Gateway Load Balancing Protocol), 373, 380, 384, 397 +AVF (active virtual forwarder), 398-400 +AVG (active virtual gateway), 397-398 enabling, 400-405 +load balancing, 400 +GVRP (VLAN Registration Protocol), 122 + + +H + +half-duplex ports, 226 hello time, 496 +Hello timer (STP), 165 hierarchical design, 7-13, 496 +access layer, 12 +Cisco products, 24-26 + + + + + + +From the Library of Outcast Outcast +IP SLA (IP Service Level Agreement) 513 + + +core layer, 10 switches, 12-13 +distribution layer, 12 switches, 10 +traffic flow paths, 10 two-layer networks, 9 +host dependent balancing (GLBP), 400 host keyword, 44 +host port, 496 +HSRP (Hot Standby Router Protocol), 373, 380, 384-386 +active router, 496 election, 386-388 +conceding, 389 gateway addressing, 390 load balancing, 391-394 +MD5 authentication, 388-389 plain-text authentication, 388 standby router, 496 + +I + +ICMP (Internet Control Message Protocol), 336 +IEEE 802.1D protocol, 146 +STP (Spanning Tree Protocol), bridging loops, 151-154 +IEEE 802.1Q protocol, VLAN trunks, 104-105 +IEEE 802.1X, 496 +IEEE 802.3 standard, 496 bandwidth, 60 +Ethernet generations, 60 +IEEE (Institute of Electrical and Electronics Engineers) 802.3 standard, 59 +independent switches, access layer, 369 + + +indirect topology chages, 169-171 informational keyword, 310 informs keyword, 327 +insignificant topology changes, 171-172 +interfaces hosts +active, 46 +finding many, 46-47 inter-VLAN routing, 268-269 +internal time clock, 312-313 synchronization, 313-315 +inter-VLAN routing, 268, 496 adjacency table, 276-279 configuration, 269 +Layer 2, 270 Layer 3, 270-271 SVI port, 271-272 +connections, examples, 268 interfaces, 268-269 verification, 280-283 +IP addresses +manual binding, 294-295 +virtual terminal access security, 425 +ip dhcp excluded-address command, 293 +ip dhcp pool command, 293 +ip helper-address command, 297 +ip http access-class configuration command, 425 +ip http server command, 424 +IP SLA (IP Service Level Agreement), 336, 496 +configuration, 338-341 displaying, 342 +verification, 341 + + + + + +From the Library of Outcast Outcast +514 IP SLA (IP Service Level Agreement) + + +HSRP pairs, 344 +MD5 (message digest 5), 339 operations, defining, 339 responder, 496 +setup, 338 +statistics display, 342-343 test operations, 337 +test type, 339 parameters, 340 +UDP Jitter test, 337 +ip sla key-chain command, 339 ip sla schedule command, 341 IP Source Guard, 448 +ipa sla schedule command, 341 +IPv4 DHCP server, configuration, 293-294 +IPv6 DHCP, 297 DHCPv6, 298-299 DHCPv6 Lite, 299-300 DHCPv6 relay agent, 300 +stateless autoconfiguration, 298 verification, 300 +ISE (Identity Services Engine), 465 isl keyword, 355 +ISL (Inter-Switch Link) protocol, 103-104, 355, 496 +isolated VLAN, 496 +IST (Internal Spanning Tree), 234-235 instance, 496 + +J + +jitter, 496 + +K + +key chain command, 389 key command, 389 +key-string command, 389 keywords +access, 328 address, 45 after, 341 ageout, 341 aggressive, 212 any, 44 +auth, 328-329 auto, 80 broadcast, 422 +Cisco IP phone trunking modes, 114 commands, 468 +commands level, 470 config-commands, 468 configuration, 469 default, 214 +delay, 387 disable, 212 dotlq, 355 enable, 212 exec, 469-470 host, 44 +informational, 310 informs, 327 +isl, 355 level, 422 life, 341 line, 467 local, 467 +localtime, 317 +mac address-table, 41 + + + + + +From the Library of Outcast Outcast +load balancing 515 + + +minimum, 387 msec, 317 multicast, 422 network, 469 new-model, 419 noauth, 328 none, 470 notify, 328 now, 341 +ntp, 317 peer, 316 prefer, 315 priv, 328-329 +query-only, 316 radius, 467 read, 328 recurring, 341 reload, 388 +reverse-access, 469 ro, 327 +rw, 327 +SDM template type, 50 serve, 316 +serve-only, 316 severity level and, 310 show-timezone, 317 start-stop, 470 +start-time, 341 state, 343 stop-only, 470 system, 470 tacacs+, 467 unicast, 422 vlan, 45 +write, 328 +year, 317 + +L + +LACP (Link Aggregation Control Protocol), 240, 251-252, 496 +configuration, 254-255 +lacp port-priority command, 255 LAN PHY (PMD interface), 62-63 +LAP (lightweight access point), 494, 497 +Layer 2 roaming, 497 Layer 3 roaming, 497 layers, distribution, 495 +Learning state, 163, 223-224 lease command, 294 +level keyword, 422 life keyword, 341 line keyword, 467 +line line command, 467 link-local address, 497 links +bandwidth, scaling, 245 bundling +Fast Ethernet, 61 Gigabit Ethernet, 62 +mode, switch ports, 69 Listening state, 223 Listening state (STPs), 163 +LLDP (Link Layer Discovery Protocol), 426, 497 +connected devices, 75-77 +neighbor information display, 76-77 +LLDP-MED (LLDP Media Endpoint Device), 75 +load balancing EtherChannel, 249-251 +GLBP, 400 + + + + + +From the Library of Outcast Outcast +516 load balancing + + +HSRP, 391-394 VRRP, 395-396 local keyword, 467 +local SPAN, 352, 497 configuration, 354-356 traffic, monitoring, 352-353 +local VLANs, 101, 497 localtime keyword, 317 logging host command, 311 logical switches, 364 +building +StackWise, 371-372 +VSS (Virtual Switching System), 372 +EtherChannel, connection, 369-370 +redundant switched network architecture, 370 +Loop Guard, 210-211, 497 loops +preventing, STP and, 154-155 root bridges and, 156-158 +LWAPP (Lightweight Access Point Protocol), 497 + + +M + +MAC addresses AVG and, 397 bridging, 156-157 +frame forwarding and, 33 port security, 415-418 sticky, 500 +mac address-table keywords, 41 +MAC (Media Access Control) layer, 60 mac-address-table keywords, 41 +macro command, 186 + + +macros, defining, 67 +manual address bindings, 294-295 Max Age timer (STP), 166, 497 +MD5, authentication, HSRP and, 388-389 +MEC (multichassis EtherChannel), 497 Memory Tables, 477-478 +MIB (Management Information Base), 324, 497 +structure, 324 minimum keyword, 387 mirrored frames, 354 +MLS (multilayer switching), 28 catalyst switches, 37 +CEF (Cisco Express Forwarding) and, 264, 272-273 +configuration, 280 verification, 283-284 +DHCP and, 292-293 +IPv4 server configuration, 293-294 +IPv6 support, 297-300 +manual address binding, 294-295 options configuration, 296 relays, 296-297 +exceptions, 39-40 +FIB (Forwarding Information Base), 273-276 +inter-VLAN routing, 264 configuration, 269-272 connection examples, 268 interface types, 268-269 +L2 forwarding table, 38 L3 forwarding table, 38 +MSFC (Multilayer Switch Feature), 272 +NetFlow switching, 272 + + + + + +From the Library of Outcast Outcast +no switchport command 517 + + +overview, 272 packets, 37-39 +rewrites, 279-280 QoS ACLs, 39 +route caching, 37 +RP (route processor), 272 +RSFC (Route Switch Feature), 272 RSM (Route Switch Module), 272 SE (switching engine), 272 security ACLs, 39 +switch interface information, 282 topology based, 37 +types, 37 verification, 264 +inter-VLAN routing, 280-283 +modular connectivity, Gigabit Ethernet, 65-66 +modular network desgin, 13-16 switches, 13 +monitor session filter command, 358 msec keyword, 317 +MSFC (Multilayer Switch Feature Card), 272 +MST (Multiple Spanning Tree), 223, 497 +802.IQ, 231 configuration, 236-237 implementation, 233 PVST+, 231 +regions, 233-234, 497 spanning tree instances, 234 +MSTI (Multiple Spanning Tree instances), 235-236, 497 +MSTP (Multiple STP), 218 multicast keyword, 422 +Multichassis EtherChannel, 247 + +N + +NAD (network access device), 465 name command, 98 +NAS (network access server), 465, 497 negotiation, EtherChannel, 251 NetFlow LAN switching, 37, 272 network analyzers, 348 +See also sniffers network command, 293 network keyword, 469 networks +campus networks, 7 core size, 24 +disorganized growth, 15 flat, 95 +hierarchies +access layer, 12 +core layer, 10, 12-13 distribution layer, 12 traffic flow paths, 10 two-layer, 9 +models, predictable, 9-11 modular design, 13-16 physical size, 166 segmented, expanding, 7-8 service types, 10 +switched, flat networks and, 95 VLANS, 8 +new-model keyword, 419 no cdp run command, 75 +no ip cef interface configuration command, 280 +no ip route-cache cef command, 280 no shutdown command, 213 +no switchport command, 270 + + + + + +From the Library of Outcast Outcast +518 no vlan vlan-num command + + +no vlan vlan-num command, 98 noauth keyword, 328 +none keyword, 470 notify keyword, 328 now keyword, 341 +NSF (nonstop forwarding), 364, 498 NTP (Network Time Protocol), 498 +securing, 316 +time source synchronization, 313-315 ntp access-group command, 316 +ntp associations command, 315 ntp keyword, 317 +ntp server command, 315 ntp status command, 315 null adjacency, 278 + +O + +off mode (VTP), 128 +Offer message (DHCP), 292 OID (object identifier), 498 + +P + +packet forwarding, 384-385 packet loss, 498 +packet rewrite, 498 +packet rewrite engine, 279-280 packets +CEF and, 273 +MLS, rewrites, 279-280 multilayer switching, 37-39 +PAgP (Page Aggregation Protocol), 240, 251-252, 355, 498 +configuration, 253-254 + +passwords, secure, 424 +PCPT (Pearson Cert Practice Test) exam activation, 477 +exam engine, 475 installation, 476 mode selection, 479 +practice exam mode, 479 study mode, 479 +practice exam activating, 476 downloading, 476 +PMD (Physical Media Dependent) interfaces, 62 +10-Gigabit Ethernet, 62 transceiver types, 63 +PoE (Power over Ethernet), 77-79, 498 commands, 83 +configuration, 80-81 +detail information display, 83 device detection, 79-80 disabling on switch interface, 81 limit setting, 80-81 +methods, 79 power classes, 79 +status, switch ports, 81-82 verification, 81-83 +See also PoE (Power over Ethernet) point-to-point port, 226, 498 +port cables, connecting switches and devices, 65-66 +port operations, TCAM, 44-45 port security, 410, 415-418 +802.1X switch port, 419 errdisable state, 417-418 port status display, 417 +status summary, 418 + + + + + + +From the Library of Outcast Outcast +recovering from errors 519 + + +port-based authentication, 410 Catalyst switches, 418 +PortFast, 498 enabling, 208-209 +ports +alternate, 493 +bundling, aggregation, 247 description, 68 +designated (DPs), 495 electing, 160-162 +Discarding state, 224 edge port, 495 Ethernet type, 67 Forwarding state, 224 Learning state, 224 promiscuous, 498 +root ports, electing, 158-160 RSTP +alternate port, 224 backup port, 224 designated port, 224 Edge port, 226 +half-duplex, 226 +Point-to-point port, 226 Root port, 226 +root port, 224 synchronization, 227-229 +speed, 68 +STP disabling, 213-214 STP states, 164 +power class, 498 +power for device operation, 54 +See also PoE (Power over Ethernet) practice exam +activating, 476 +downloading, 476 + +predictable network models, 9-11 prefer keyword, 315 +Premium Edition of title, 477 primary VLAN, 498 +priv keyword, 328-329 promiscuous ports, 498 punt adjacency, 279 +PVLANs (private VLANs), 436-437, 498 +configuration, 438-439 functionality within a switch, 437 port associations, 439-440 +port configuration, 440 +PVST (Per-VLAN Spanning Tree), 146, 173, 498 +PVST+ (Per-VLAN Spanning Tree Plus), 146, 173-174, 498 +RSTP and, 223 + + +Q + +QoS (quality of service), 498 ACLs, 36, 39 + +R + +RACLs (router access lists), 435 +RADIUS (Remote Authentication Dial-In User Service), 419, 498 +protocol, 464 +server definition, 466 +server, authorization configuration, 468 +radius keyword, 467 read keyword, 328 +recovering from errors, 70-71 + + + + + +From the Library of Outcast Outcast +520 recurring keyword + + +recurring keyword, 341 redundancy, 14-15, 368 +bridging, 152 +gateway, verification, 405 +GLBP (Gateway Loading Balancing Protocol), 380 +HSRP (Hot Standby Router Protocol), 373, 380 +mode configuration, 374-376 +NSF (nonstop forwarding), 364, 377 redundant switch supervisors, 373-374 +redundant switched network architecture, 370 +RIB (Routing Information Base), 377 +RPR (route processor redundancy), 373 +RPR+ (route processor redundancy plus), 373 +SSO (stateful switchover), 364, 374 switch blocks, 18-20 +VRRP (Virtual Router Redundancy Protocol), 373, 380 +Redundant Link Convergence, 176 redundant switch supervisors, 373-374 reload keyword, 388 +Request message (DHCP), 292 reverse-access keyword, 469 ro keyword, 327 +root bridges, 156-158, 498 BPDUs and, 157 +election example, 157 STP, 176 +Root Guard, 498 alternate port, 207 blocking port, 207 +designated port, 207 + +forwarding port, 207 root port, 207 +root path cost, 158-160, 499 root port, 226, 499 +electing, 158-160 +round robin load balancing (GLBP), 400 route caching, multilayer switching, 37 +RPR (route processor redundancy), 364, 373, 499 +RPR+ (route processor redundancy plus), 364, 373, 499 +RPVST+ (Rapid PVST+), 223, 230-231, 499 +RSFC (Route Switch Feature Card), 272 +RSM (Route Switch Module), 272 RSPAN (remote SPAN), 352, 499 +configuration, 357-359 RSPAN VLAN, 357 source, 356 +traffic mirroring, multiple switches, 357 +RSTP (Rapid STP), 218, 499 alternate port, 224 +backup port, 224 BPDUs in, 224-225 configuration, 229-230 convergence, 225 +sequence of events, 228 designated port, 224 +Edge port, 226 +Point-to-point port, 226 ports +half-duplex, 226 roles, 223 +synchronization, 227-229 +PVST+ and, 223 + + + + + +From the Library of Outcast Outcast +SNMP (Simple Network Management Protocol) 521 + + +Root port, 226 root port, 224 +topology changes, 229 +RTR (Response Time Reporter), 336 RTT (round-trip transit), 336 +rw keyword, 327 + + +S + +SAA (Service Assurance Agent), 336 scaling, Ethernet, 60 +SDM (Switching Database Manager), 41, 499 +templates, 49-50 secondary VLAN, 499 +segmented networks, expanding, 7-8 server mode (VTP), 127 +SFP (small form factor pluggable) module, 211 +show adjacency summary command, 276 +show cdp neighbors command, 73 +show cef not-cef-switched command, 279 +show clock command, 312 show dotlx all command, 420 +show etherchannel load-balance command, 250 +show etherchannel port-channel command, 250 +show etherchannel summary command, 257 +show interface command, 72 +show interface switchport command, 115 +show interfaces command, 71 +show interfaces status command, 71 + + +show interfaces status err-disabled command, 417 +show ip arp command, 278 +show ip arp inspection command, 457 show ip cef command, 274 +show ip dhcp binding command, 294 show ip interface brief command, 282 show ip interface command, 281 +show ip sla configuration command, 342 +show lldp command, 75 show logging command, 311 +show mac address-table count command, 47 +show mac address-table EXEC command, 45 +show port-security command, 418 +show port-security interface command, 417 +show spanning-tree interface command, 116, 191 +show spanning-tree vlan vlan-id command, 230 +show vlan brief command, 99 show vlan command, 99, 281 +show vlan id vlan-id EXEC command, 110 +show vtp status command, 137 show-timezone keyword, 317 shutdown command, 70, 213 sniffers, 348 +SNMP (Simple Network Management Protocol), 499 +configuration SNMPv1, 327 SNMPv2C, 327 SNMPv3, 328-329 +packets, 326 + + + + + +From the Library of Outcast Outcast +522 SNMP (Simple Network Management Protocol) + + +polls, 324-325 securing access, 425 SNMP agent, 324, 499 SNMP inform, 499 +SNMP manager, 324, 499 trap, 499 +versions, 325-326 comparisons, 326 +snmp-server group command, 328 snmp-server host command, 327 snmp-server user command, 328 snmp-server view command, 328 snooping, 448 +DHCP, 495 +SNTP (Simplified Network Time Protocol), 316-317 +SPAN (Switch Port Analysis), 499 catalyst switches, 348 +local, 348, 352 configuration, 354-356 +traffic monitoring, 352-353 packets, copying, 355 +remote, 348, 352 sessions, 348 +deleting, 360 management, 359-360 numbering, 354-355 +spanning-tree mode command, 231 +spanning-tree vlan vlan-id priority bridge-priority command, 188 +spanning-tree vlan vlan-id root command, 188 +split-MAC architecture, 499 spoofing switches, 441-443 SRM (single-router mode), 374 SSH, 425 +SSID (service-set identifier), 500 + + +SSO (stateful switchover), 364, 374, 500 +StackWise, 500 +logical switches, 371-372 start-stop keyword, 470 start-time keyword, 341 state keyword, 343 +static VLANs, 96-97 configuration, 97-99 +sticky MAC address, 500 stop-only keyword, 470 Storm Control, 421-423 +enabling, 423 storm control, 410 +STP (Spanning Tree Protocol), 35, 140, 355, 499 +BPDUs (bridge-protocol data units), 155 +Configuration BPDU, 155-156 TCN BPDU, 155 +bridging loops, 151-154 convergence, +Redundant Link, 176 +CST (Common Spanning Tree), 146, 173 +customization, 176 +disabling, BPDU filtering and, 213-214 Loop Guard, 210-211 +loops, preventing, 154-155 manual computation, 165 monitoring, 176 +MSTP (Multiple STP), 218 port activity, 163 +PVST (Per-VLAN Spanning Tree), 146, 173 +PVST+ (Per-VLAN Spanning Tree Plus), 146, 173-174 + + + + + +From the Library of Outcast Outcast +switches 523 + + +root bridge, 176 +root path cost, 158-160 RSTP (Rapid STP), 218 secure operation, 426 states, 163 +Blocking, 162 Disabled, 162 Forwarding, 163 Learning, 163 Listening, 163 +port progression, 164 switch type determination, 231 timers, 165 +default values, 166 Forward Delay timer, 165 functions, 166 +Hello timer, 165 Max Age timer, 166 +topology +designated ports, 162 VLANs, 232 +troubleshooting protection, 214 UDLDs and, 211-212 +stratum, 500 +study plan, 478-479 +summer-time recurring command, 313 superior BPDU, 500 +supervisors redundant, 373-374 synchronization, 376 +SVI (switch virtual interface), 269, 500 inter-VLAN configuration, 271-272 VLAN association, 440-441 +switch blocks, 15, 500 distribution switches, 18 redundancy, 18-20 +sizing, 16-17 + + +switch console securing, 425 syslog and, 310 +switch lines, method list, 467 switch ports +Blocking state, 223 configuration, 54 +duplex mode, 69 link mode, 69 +port description, 68 port selection, 66-68 port speed, 68 +connectivity, troubleshooting, 71 Disabled state, 223 +enabling, 71 errdisable state, 69-70 +re-enabling ports, 70-71 error detection, 69-70 +error management, 69 errors, recovery, 70-71 Forwarding state, 223 Learning state, 223 Listening state, 223 PoE limit setting, 80-81 +PoE status display, 81-82 port state, 71-72 +speed/duplex mismatches, 72-73 unused, 426 +switch spoofing, 500 +switched networks, flat networks and, 95 +switches, 8-9 +access layer, 12, 25 authentication, 465-466 Catalyst switch, 28 +command-line interface, 33 + + + + +From the Library of Outcast Outcast +524 switches + + +connecting, 54 +Ethernet port cables, 65-66 distribution layer, 26 +Ethernet, 28, 59 collisions, 59 +flooding, 139 +hierarchical design and, 10 independent, access layer, 369 internal memory buffer, 310-311 Layer 2, transparent bridging, 32-35 logical ( See logical switches) +MIB database, 324 +port-based authentication, 418 redundancy and, 14-15 redundancy modes, 373-374 +securing, best practices, 410, 423-427 SNMP polls, 324 +SPAN, 348 spoofing, 441-443 +supervisors, redundant, 373-374 switch interfaces, 8 +syslog message format, 308 transparent bridging, 152 +switching +Layer 2, 28, 32 +logs, syslog messages, 308-311 multilayers, 28 +catalyst switches, 37 exceptions, 39-40 +L2 forwarding table, 38 L3 forwarding table, 38 packets, 37-39 +QoS ACLs, 39 route caching, 37 +security ACLs, 39 + + +topology based, 37 types, 37 +tables, 28 +CAM (content-addressable memory), 40-41 +CAM table operation, 45-48 sizes, managing, 49-50 +TCAM (ternary content-addressable memory), 41-45 +switchport command, 98 switchport interface command, 269 switchport mode command, 107 +switchport nonegotiate command, 108 +switchport trunk allowed vlan command, 106-107, 140 +switchport trunk encapsulation command, 106 +switchport trunk native vlan command, 106 +synchronization, 500 syslog, 500 +remote server login, 311 syslog messages +Catalyst switch +internal memory buffer, 310-311 message format, 308 +fields, 308 +severity levels, 309-310 switch console, 310 time stamps, 312, 317 +internal time clock, 312-313 syslog severity level, 500 +system banners, 424 +system keyword, 470 + + + + + + + +From the Library of Outcast Outcast +two-layer network 525 + + +T tables +CAM, size, 47-50 switches and, 28 +CAM (content-addressable memory), 40-41 +CAM table operation, 45-48 size management, 49-50 +TCAM (ternary content-addressable memory), 41-45 +TACACS+ (Terminal Access Controller Access-Control System Plus), 500 +protocol, 464 +server definition, 466 +server, authorization configuration, 468 +tacacs+ keyword, 467 +TCAM (ternary content-addressable memory), 41, 500 +example, 43-44 operation, 48 +port operations, 44-45 value patterns, 42 VLAN access lists, 435 +TCN (Topology Change Notification) BPDU, 155, 167, 500 +templates, SDM (Switching Database Manager), 49 +terminal access, virtual, securing, 425 terminal monitor command, 310 throwing bandwidth, 7 +time stamps +clock synchronization NTP, 313-315 SNTP, 316-317 +syslog messages, 312, 317 +internal time clock, 312-313 + + +timers, STP, 165 default values, 166 +Forward Delay timer, 165 functions, 166 +Hello timer, 165 Max Age timer, 166 +TLV (Type-Length-Value), 75, 500 topology +changes, 167 +direct changes, 168-169 indirect, 169-171 insignificant, 171-172 RSTP and, 229 +multilayer switching, 37 STP, VLANs, 232 +track command, 343 traffic +broadcast traffic, 8 EtherChannel, 247-249 flow paths, 10 +local SPAN, 352-353 +Storm Control and, 421-423 transparent bridging, 500 +Layer 2 and, 32-35 STP and, 151-154 switches and, 152 +transparent mode (VTP), 128 troubleshooting +EtherChannel, 257-259 STP protection, 214 +switch port connectivity, 71 VLAN trunks, 110-112 VLANs, 110-112 +trust boundary, 501 +two-layer networks, 9 + + + + +From the Library of Outcast Outcast +526 UDLD (Unidirectional Link Detection) + + +U + +UDLD (Unidirectional Link Detection), 210-213, 501 +Aggressive mode, 212 Normal mode, 212 +UDP Jitter test, 337 +udp-jitter command, 340 Unicast, flooding, 34 unicast keyword, 422 +unknown unicast flooding, 501 UplinkFast, 223, 501 username command, 464 usernames, defining, 466 + +V + +VACLs (VLAN access lists), 435, 501 access maps, 435 +configuration, 435-436 +virtual terminal access, securing, 425 vlan keyword, 45 +VLANs (virtual LANs), 8, 501 +ACLs (access lists) (See VACLs (VLAN access lists)) +community VLAN, 494 +CST (Common Spanning Tree), 173 deploying, 99-100 +dynamic, 99 +end-to-end, 100-101, 495 flat networks, 95 hopping, 443-445, 501 inter-VLAN routing, 496 isolated, 496 +listing configured, 281 +local, 101 + + +membership methods, 96 native, 497 +numbers, 501 primary, 498 +private VLANs, 430, 498 +PVLANs (private VLANs), 436-437 RSPAN, 357 +secondary, 437, 499 static, 96-97 +configuration, 97-99 STP topologies, 232 +SVI association, 440-441 switch ports, assigning, 98 switches, configuration, 110 traffic monitoring, 354 troubleshooting, 110-112 trucks, 430 +trunks, 101-103, 501 configuration, 106-110 +dynamic trunking protocol, 105-106 +frames, 103 +IEEE 802.1Q protocol, 104-105 +ISL (Inter-Switch Link) protocol, 103-104 +securing, 441-445 +switch port trunking status, 108 troubleshooting, 110-112 +voice, 112-113, 501 configuration, 113-115 verification, 115-116 +VTP (VLAN Trunking Protocol), 97 wireless, 117-118 +See also inter-VLAN routing +VMPS (VLAN Membership Policy Server), 99 + + + + + +From the Library of Outcast Outcast +year keyword 527 + + +voice VLANs, 112-113, 501 configuration, 113-115 verification, 115-116 +VRRP (Virtual Router Redundancy Protocol), 373, 380, 384, 394-396 +backup router, 501 configuration commands, 394 load balancing, 395-396 master router, 501 +multiple group status, 396 +VSPAN (VLAN-based Switched Port Analayzer), 501 +VSS (Virtual Switching System), 364, 372, 501 +VTP (VLAN Trunking Protocol), 97, 127, 355, 501 +advertisements, 128-131 client requests, 130 subset, 129 summary, 129 +configuration, 122, 132-133 example, 136-137 management domain, 134-135 modes, 135-136 +revision number, 502 VTP version, 133-134 +configuration revision number, 128 domains, 127, 502 +features supported, 134 + +modes +client, 127 off, 128 server, 127 +transparent, 128, 137-138 pruning, 122, 138-140, 502 +enabling, 140-141 status, display, 137-138 switches, attributes, 127 +synchronization, 131-132, 502 troubleshooting, 122, 141-142 +VTP (VLAN trunking protocol), 122 + + +W + +WAN PHY (PMD interface), 62-63 web interface, securing, 424-425 weighted load balancing (GLBP), 400 wireless VLANs, 117-118 +wiring. See cabling +WLC (wireless LAN controller), 494, 502 +write keyword, 328 + + +Y + +year keyword, 317 + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + +ciscopress.com: Your Cisco Certification and Networking Learning Resource + + +Subscribe to the monthly Cisco Press newsletter to be the first to learn about new releases and special promotions. + +Visit ciscopress.com/newsletters. + + +While you are visiting, check out the offerings available at your finger tips. + +–Free Podcasts from experts: • OnNetworking +• OnCertification • OnSecurity + +View them at ciscopress.com/podcasts. + +–Read the latest author articles and sample chapters at ciscopress.com/articles. + +–Bookmark the Certification Reference Guide available through our partner site at informit.com/certguide. + + + + + + + + + + + + + + +Connect with Cisco Press authors and editors via Facebook and Twitter, visit informit.com/socialconnect. + +From the Library of Outcast Outcast + + + + + + + + + +Pearson IT Certification +THE LEADER IN IT CERTIFICATION LEARNING TOOLS + + +Visit pearsonITcertification.com today to find: + +IT CERTIFICATION EXAM information and guidance for + + + +Pearson is the official publisher of Cisco Press, IBM Press, VMware Press and is a Platinum CompTIA Publishing Partner— CompTIA’s highest partnership accreditation + +EXAM TIPS AND TRICKS from Pearson IT Certification’s expert authors and industry experts, such as +• Mark Edward Soper – CompTIA + + +Articles & Chapters + +Blogs + +Books + +Cert Flash Cards Online + +eBooks + +Mobile Apps + +Newsletters + +Podcasts + +Question of the Day + +Rough Cuts + + + +• David Prowse – CompTIA • Wendell Odom – Cisco +• Kevin Wallace – Cisco and CompTIA • Shon Harris – Security +• Thomas Erl – SOACP + + +Short Cuts + +Software Downloads + +Videos + + +CONNECT WITH PEARSON IT CERTIFICATION +Be sure to create an account on pearsonITcertification.com + + + +SPECIAL OFFERS – pearsonITcertification.com/promotions + +REGISTER your Pearson IT Certification products to access additional online material and receive a coupon to be used +on your next purchase + +and receive members-only +offers and benefits + + + + + + + +From the Library of Outcast Outcast + +NEW Complete Video Courses for CCNP Routing & Switching 300 Series Exams + +These unique products include multiple types of video presentations, including: + + +• Live instructor whiteboarding • Real-world demonstrations +• Animations of network activity +• Dynamic KeyNote presentations + +• Doodle videos +• Hands-on command-line interface (CLI) demonstrations +• Review quizzes + + + +CCNP Routing and Switching v2.0 — Complete Video Course Library +Specially priced library including ALL THREE Complete Video Courses: CCNP Routing and Switching ROUTE 300-101, CCNP Routing and Switching SWITCH 300-115, +and CCNP Routing and Switching TSHOOT 300-135. + + + +9780789754493 + + + + + + +9780789753731 + + + + + + +9780789754073 + + + + + + +9780789754295 + +CCNP Routing and Switching ROUTE 300-101 — Complete Video Course 149 VIDEOS with 12+ HOURS of video instruction from best-selling author, expert +instructor, and double CCIE Kevin Wallace walk you through the full range of topics on the CCNP Routing and Switching ROUTE 300-101 exam, including fundamental routing concepts; IGP routing protocols including RIPng, EIGRP, and OSPF; route distribution and selection; BGP; IPv6 Internet connectivity; router security; and routing protocol authentication. + +CCNP Routing and Switching SWITCH 300-115 — Complete Video Course 10+ HOURS of unique video training walks you through the full range of topics on the CCNP SWITCH 300-115 exam. This complete video course takes you from the design +and architecture of switched networks through the key technologies vital to implementing a robust campus network. You will learn, step-by-step, configuration commands for configuring Cisco switches to control and scale complex switched networks. + +CCNP Routing and Switching TSHOOT 300-135 — Complete Video Course 10+ HOURS of unique video instruction from expert instructors and consultants Elan Beer and Chris Avants walks you through the full range of topics on the CCNP TSHOOT 300-135 exam. This complete video course teaches you the skills you need to plan and perform regular maintenance on complex enterprise routed and switched +networks and how to use technology-based practices and a systematic ITIL-compliant approach to perform network troubleshooting commands for configuring Cisco switches to control and scale complex switched networks. + + + +SAVE ON ALL NEW CCNP R&S 300 Series Products +www.CiscoPress.com/CCNP +From the Library of Outcast Outcast + +Where are the companion content files? + +Thank you for purchasing this Premium Edition version of: +CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + + + +The print version of this title comes with a disc of companion content. +As an eBook reader, you have access to these files by following the steps below: + +1. Go to ciscopress.com/account and log in. + +2. Click on the “Access Bonus Content” link in the Registered Products section of your account page for this product, to be taken to the page where your +downloadable content is available. + + +Please note that many of our companion content files can be very large, especially image and video files. + +If you are unable to locate the files for this title by following the steps +at left, please visit ciscopress.com/ contact and select the “Site Problems/ Comments” option. Our customer +service representatives will assist you. + + + + + + + + + +The Professional and Personal Technology Brands of Pearson + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPenDix C + + + + + + +Memory Tables + + +Chapter 5 + +Table 5-2 Additional Features Supported by VTP Version 2 + +VTP v2 Feature Description +Relay VTP messages in transparent mode without checking for version mismatches. +Check VTP and VLAN parameters entered from the command-line interface (CLI) or Simple Network Management Protocol (SNMP) to prevent errors from being propagated to other switches. +Token Ring switching and VLANs can be advertised. + +VTP messages are relayed even if they contain advertisements other than known types. This allows VTP to be extended to include new advertisement types. + + + +Table 5-3 Additional Features Supported by VTP Version 3 + +VTP v3 Feature Description +VLANs 1 through 4094 can be advertised throughout a VTPv3 domain. +Switches can authenticate with each other through a secret key that can be hidden from the configuration. +Databases other than VTP can be advertised. + +By default, all VTPv3 switches operate as secondary servers and can send updates throughout the domain. A primary server is only needed to take control of a domain. +VTPv3 can be enabled on a per-trunk port basis, rather than a switch as a whole. + + + + + + +From the Library of Outcast Outcast +4 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Table 5-4 Catalyst VTP Modes + +VTP Mode Characteristics Server +Client + +Transparent + +Off + + + +Chapter 6 + +Table 6-4 STP States and Port Activity + + +STP State + + + + +Listening + +Learning + +The Port Can... The Port Cannot... N/A + + + + + +Send and receive BPDUs, learn MAC addresses, and send and receive data + +Duration N/A +Indefinite if loop has been detected + + + +Indefinite as long as port is up and loop is not detected + + + + +Chapter 9 + + +Table 9-2 + +Task + + +MST Configuration Commands + +Command Syntax + +Set root bridge (macro). + +Set bridge priority. + +Set port cost. + +Set port priority. + +Set STP timers. + + + + + + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 5 + +Chapter 10 + +Table 10-4 EtherChannel Negotiation Protocols + + +negotiation PAgP +On + +Auto + +Desirable + +Mode negotiation Packets Sent? Characteristics LACP +On + +Passive + +Active + + + + +Table 10-5 EtherChannel Troubleshooting Commands + +Display Function Command Syntax Current EtherChannel status of each member port +Time stamps of EtherChannel changes + +Detailed status about each EtherChannel component + +Load-balancing hashing algorithm + +Load-balancing port index used by hashing algorithm + +EtherChannel neighbors on each port + +LACP system ID + + + +Chapter 13 + +Table 13-2 NTP Modes + +nTP Mode Description Server +Client + +Peer + +Broadcast/multicast + + + + + + + + + +From the Library of Outcast Outcast +6 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Chapter 14 + +Table 14-2 Comparison of SNMP Versions and Features + +Version Authentication Data Protection Unique Features SNMPv1 +SNMPv2c + +SNMPv3 + + + +Chapter 17 + +Table 17-2 Redundancy Modes and Failover Time + +Redundancy Mode Failover Time Good (> 2 minutes) +Better (> 30 seconds) + +Best (> 1 second) + + + +Chapter 18 + + +Table 18-4 + +Task + + +Gateway Redundancy Verification Commands + +Command Syntax + +HSRP and VRRP + +Display HSRP status. + +Display HSRP on an interface. + +Display VRRP status. + +Display VRRP on an interface. + +GLBP + +Display status of a GLBP group. + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPenDix D + + + + + + +Memory Table Answer Key + + +Chapter 5 + +Table 5-2 Additional Features Supported by VTP Version 2 + + +VTP v2 Feature +Version-dependent transparent mode +Consistency checks + + + +Token Ring support + +Unrecognized Type-Length-Value (TLV) support + +Description +Relay VTP messages in transparent mode without checking for version mismatches. +Check VTP and VLAN parameters entered from the command-line interface (CLI) or Simple Network Management Protocol (SNMP) to prevent errors from being propagated to other switches. +Token Ring switching and VLANs can be advertised. + +VTP messages are relayed even if they contain advertisements other than known types. This allows VTP to be extended to include new advertisement types. + + + + +Table 5-3 Additional Features Supported by VTP Version 3 + + +VTP v3 Feature Extended VLAN range + +Enhanced authentication + +Database propagation + +Primary and secondary servers + +Per-port VTP + +Description +VLANs 1 through 4094 can be advertised throughout a VTPv3 domain. +Switches can authenticate with each other through a secret key that can be hidden from the configuration. +Databases other than VTP can be advertised. + +By default, all VTPv3 switches operate as secondary servers and can send updates throughout the domain. A primary server is only needed to take control of a domain. +VTPv3 can be enabled on a per-trunk port basis, rather than a switch as a whole. + + + + + + + +From the Library of Outcast Outcast +4 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Table 5-4 Catalyst VTP Modes + + +VTP Mode Server + + +Client + + +Transparent + + +Off + +Characteristics +All VLAN and VTP configuration changes occur here. The server advertises settings and changes to all other servers and clients in a VTP domain. (This is the default mode for Catalyst switches.) +Listens to all VTP advertisements from servers in a VTP domain. Advertisements are relayed out other trunk links. No VLAN or VTP configuration changes can be made on a client. +VLAN configuration changes are made locally, independent of any VTP domain. VTP advertisements are not received but merely are relayed out other trunk links, if possible. +VLAN configuration changes are made locally; incoming VTP advertisements are not processed locally, but simply relayed instead. + + + + +Chapter 6 + +Table 6-4 STP States and Port Activity + + +STP State Disabled +Blocking + +Listening + +Learning + +Forwarding + +The Port Can... N/A +Receive BPDUs + +Send and receive BPDUs + +Send and receive BPDUs and learn MAC addresses +Send and receive BPDUs, learn MAC addresses, and send and receive data + +The Port Cannot... Send or receive data +Send or receive data or learn MAC addresses +Send or receive data or learn MAC addresses +Send or receive data + +Duration N/A +Indefinite if loop has been detected +Forward Delay timer (15 seconds) +Forward Delay timer (15 seconds) +Indefinite as long as port is up and loop is not detected + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Appendix D: Memory Table Answer Key 5 + +Chapter 9 + + +Table 9-2 + +Task + + +MST Configuration Commands + +Command Syntax + + + +Set root bridge (macro). + +Set bridge priority. + +Set port cost. + +Set port priority. + +Set STP timers. + + +Switch(config)# spanning-tree mst instance-id root {primary | secondary} [diameter diameter] + +Switch(config)# spanning-tree mst instance-id priority bridge-priority + +Switch(config)# spanning-tree mst instance-id cost cost + +Switch(config)# spanning-tree mst instance-id port-priority port-priority + +Switch(config)# spanning-tree mst hello-time seconds + +Switch(config)# spanning-tree mst forward-time seconds + +Switch(config)# spanning-tree mst max-age seconds + + + + +Chapter 10 + +Table 10-4 EtherChannel Negotiation Protocols + + +negotiation PAgP +On + +Auto + +Desirable + +Mode LACP +On + +Passive + +Active + +negotiation Packets Sent? + + +No + +Yes + +Yes + +Characteristics + + +All ports channeling + +Waits to channel until asked + +Actively asks to form a channel + + + + +Table 10-5 EtherChannel Troubleshooting Commands + + +Display Function +Current EtherChannel status of each member port + +Time stamps of EtherChannel changes + +Detailed status about each EtherChannel component + +Load-balancing hashing algorithm + +Load-balancing port index used by hashing algorithm + +EtherChannel neighbors on each port + +LACP system ID + +Command Syntax +show etherchannel summary show etherchannel port +show etherchannel port-channel + +show etherchannel detail + +show etherchannel load-balance + +show etherchannel port-channel + +show {pagp | lacp} neighbor + +show lacp sys-id + + + + +From the Library of Outcast Outcast +6 CCNP Routing and Switching SWITCH 300-115 Official Cert Guide + +Chapter 13 + +Table 13-2 NTP Modes + + +nTP Mode Server + + +Client + +Peer + +Broadcast/multicast + +Description +The device synchronizes with a source in a lower stratum and provides time synchronization with servers or clients in a higher stratum. +The device synchronizes its clock with an NTP server. + +The device exchanges time information with another peer device. + +The device operates as an NTP server, but pushes time information out to any listening device. Because the “push” is in only one direction, the time accuracy can suffer somewhat. + + + + +Chapter 14 + +Table 14-2 Comparison of SNMP Versions and Features + +Version Authentication Data Protection Unique Features SNMPv1 Community string None 32-bit counters +SNMPv2c Community string None Adds bulk request and inform request message types, 64-bit counters + +SNMPv3 Username Hash-based MAC (SHA or MD5) + +DES, 3DES, AES (128-, 192-, 256-bit) encryption + +Adds user authentication, data integrity, and encryption + +Adds restricted views + + + + +Chapter 17 + +Table 17-2 Redundancy Modes and Failover Time + + +Redundancy Mode RPR +RPR+ + +SSO + +Failover Time Good (> 2 minutes) +Better (> 30 seconds) + +Best (> 1 second) + + + + + + +From the Library of Outcast Outcast +Appendix D: Memory Table Answer Key 7 + +Chapter 18 + + +Table 18-4 + +Task + + +Gateway Redundancy Verification Commands + +Command Syntax + + + +HSRP and VRRP + +Display HSRP status. + +Display HSRP on an interface. + +Display VRRP status. + +Display VRRP on an interface. + +GLBP + +Display status of a GLBP group. + + +Switch# show standby brief + +Switch# show standby type member/ module/number +Switch# show vrrp brief all + +Switch# show vrrp interface type member/ module/number + + +Switch# show glbp [group] [brief] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + +Appendix E Study Planner +PracticeTest Reading Task + +Element Task Goal Date First Date Second Date Completed Completed +(Optional) + + + +Introduction + +1) Enterprise Campus Network Design + +1) Enterprise Campus Network Design + +2) Switch Operation + +2) Switch Operation + +3) Switch Port Configuration + +3) Switch Port Configuration + + +Part I Review + + +4) VLANs and Trunks + +4) VLANs and Trunks + +5) VLAN Trunking Protocol + +5) VLAN Trunking Protocol + + +Part II Review + + +6) Traditional Spanning Tree Protocol + +6) Traditional Spanning Tree Protocol + +7) Spanning-Tree Configuration + +7) Spanning-Tree Configuration +8) Protecting the Spanning Tree Protocol Topology +8) Protecting the Spanning Tree Protocol Topology +9) Advanced Spanning Tree Protocol + +9) Advanced Spanning Tree Protocol + +Read Introduction + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 1-3 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 4-5 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + + + + + +From the Library of Outcast Outcast +10) Aggregating Switch Links + +10) Aggregating Switch Links + + +Part III Review + + +11) Multilayer Switching + +11) Multilayer Switching + +12) Configuring DHCP + +12) Configuring DHCP + + +Part IV Review + + +13) Logging Switch Activity + +13) Logging Switch Activity + +14) Managing Switches with SNMP + +14) Managing Switches with SNMP + +15) Monitoring Performance with IP SLA + +15) Monitoring Performance with IP SLA + +16) Using Port Mirroring to Monitor Traffic + +16) Using Port Mirroring to Monitor Traffic + + +Part V Review + + +17) Understanding High Availability + +17) Understanding High Availability + +18) Layer 3 High Availability + +18) Layer 3 High Availability + + +Part VI Review + + +19) Securing Switch Access + +19) Securing Switch Access + +20) Securing VLANs + +20) Securing VLANs + +21) Preventing Spoofing Attacks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 6-10 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 11-12 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 13-16 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 17-18 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + + + + + +From the Library of Outcast Outcast +21) Preventing Spoofing Attacks + +22) Managing Switch Users + +22) Managing Switch Users + + +Part VII Review + + +23) Final Review + +23) Final Review + +23) Final Review + +23) Final Review + +23) Final Review + + + +23) Final Review + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for Chapters 19-22 in practice test software + +Read chapter +Review all Key Topics in all chapters +Complete all memory tables from Appendix C Practice CLI Skills +Take practice test in study mode for all Book Questions in practice test software +Take practice test in practice exam mode using Exam Bank #2 questions for all chapters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast diff --git a/CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide conv.txt b/CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2cb24337a5ec9b2355e73a6d7d78236f80d0445 --- /dev/null +++ b/CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide conv.txt @@ -0,0 +1,59825 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +CCNP Routing and Switching TSHOOT 300-135 +Official Cert Guide + + +Raymond Lacoste CCSI/CCNP + +Kevin Wallace CCIE No. 7945 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Cisco Press 800 East 96th Street +Indianapolis, IN 46240 + + +www.allitebooks.com From the Library of Outcast Outcast +ii CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Raymond Lacoste, CCSI/CCNP + +Kevin Wallace, CCIE No. 7945 + +Copyright© 2015 Pearson Education, Inc. + +Published by: Cisco Press +800 East 96th Street Indianapolis, IN 46240 USA + +All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review. + +Printed in the United States of America + +First Printing December 2014 + +Library of Congress Control Number: 2014950275 + +ISBN-10: 1-58720-561-0 + +ISBN-13: 978-1-58720-561-3 + + +Warning and Disclaimer +This book is designed to provide information about the 300-135 Troubleshooting and Maintaining Cisco IP Networks (TSHOOT) exam for the CCNP Routing and Switching certification. Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. + +The information is provided on an “as is” basis. The authors, Cisco Press, and Cisco Systems, Inc. shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accompany it. + +The opinions expressed in this book belong to the author and are not necessarily those of Cisco Systems, Inc. + +Trademark Acknowledgments +All terms mentioned in this book that are known to be trademarks or service marks have been appropri-ately capitalized. Cisco Press or Cisco Systems, Inc., cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +iii + +Special Sales +For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@pear-soned.com or (800) 382-3419. + +For government sales inquiries, please contact governmentsales@pearsoned.com. + +For questions about sales outside the U.S., please contact international@pearsoned.com. + + +Feedback Information +At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community. + +Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve the quality of this book, or otherwise alter it to better suit your needs, you can contact us through email at feedback@ciscopress.com. Please make sure to include the book title and ISBN in your message. + + +We greatly appreciate your assistance. + +Publisher: Paul Boger + +Associate Publisher: Dave Dusthimer + +Business Operation Manager, Cisco Press: Jan Cornelssen + +Executive Editor: Brett Bartow + +Managing Editor: Sandra Schroeder + +Development Editor: Ellie Bru + +Project Editor: Mandie Frank + + +Copy Editor: Keith Cline + +Technical Editors: Ryan Lindfield, Diane Teare + +Team Coordinator: Vanessa Evans + +Designer: Mark Shirar + +Composition: Tricia Bronkella + +Indexer: Lisa Stumpf + +Proofreader: The WordSmithery LLC + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +iv CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +About the Authors + +Raymond Lacoste is a Cisco Certified Systems Instructor (CCSI) who has dedicated his IT career to teaching others. Starting out as a mentor at Skillsoft, he helped students with their studies, explaining various Cisco, Microsoft, and industry-related concepts in ways that improved the students understanding. Now he spends his days at Skillsoft teaching the CCNA and CCNP Routing and Switching certification track. He has taught over 300 Cisco classes in addition to the countless practice labs, demonstrations, hands-on labs, and student guides he has developed. However, it is not just about teaching, it is also about learning. To date, Raymond has passed more than 100 IT certification exams as he continues to keep his learning and knowledge up-to-date. His certification wall includes various Cisco certifications, Microsoft certifications, CompTIA certifications, and the ISC2 CISSP (Certified Information Systems Security Professional) designation. He was also awarded the Cisco Sirius Top Quality Instructor award. His next goal is to achieve the CCIE designation in Routing and Switching. Raymond lives in Atlantic, Canada, with his wife, Melanie, and two children. + +Kevin Wallace, CCIEx2 (Collaboration and R/S) #7945, CCSI #20061: With Cisco experience dating back to 1989, Kevin has been a network design specialist for the Walt Disney World Resort, an instructor of Cisco courses for Skillsoft, and a network man-ager for Eastern Kentucky University. + +Kevin currently produces video courses and writes books for Cisco Press/Pearson IT Certification (http://kwtrain.com/books), and he lives in central Kentucky with his wife (Vivian) and two daughters (Stacie and Sabrina). + +Kevin can be followed on these social media platforms. + +Blog: http://kwtrain.com + +Twitter: http://twitter.com/kwallaceccie + +Facebook: http://facebook.com/kwallaceccie + +YouTube: http://youtube.com/kwallaceccie + +LinkedIn: http://linkedin.com/in/kwallaceccie + +Google+: http://google.com/+KevinWallace + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +v + +About the Technical Reviewers + +Ryan Lindfield is an instructor and technical consultant with Stormwind. On a typi-cal day he’s broadcasting official Cisco training from a video studio. When not in the virtual classroom, he can be found supporting customer networks. Ryan has nearly 20 years of technical consulting experience, and over a decade in the classroom. He has delivered training for network, security, and data center technologies around the +world. Certifications include: CCNP Routing & Switching, CCNP Security, HP Master Accredited Systems Engineer, VMware VCP, CEH, CISSP, SANS GFCA, CISSP, ECSA, CHFI, CPTE, CPTC, OSWP, and many Microsoft and CompTIA certifications. Ryan leads a 150 member Defcon user group in Tampa, FL, and has given presentations for ISC2 and B-Sides computer security events. + +Diane Teare, P.Eng, CCNP, CCDP, CCSI, PMP, is a professional in the networking, training, project management, and e-learning fields. She has more than 25 years of experience in designing, implementing, and troubleshooting network hardware and soft-ware, and has been involved in teaching, course design, and project management. She has extensive knowledge of network design and routing technologies. Diane is a Cisco Certified Systems Instructor (CCSI), and holds her Cisco Certified Network Professional (CCNP), Cisco Certified Design Professional (CCDP), and Project Management Professional (PMP) certifications. She is an instructor, and the Course Director for the CCNA and CCNP Routing and Switching curriculum, with one of the largest authorized Cisco Learning Partners. She was the director of e-learning for the same company, where she was responsible for planning and supporting all the company’s e-learning offerings in +Canada, including Cisco courses. Diane has a Bachelor’s degree in applied science in elec-trical engineering and a Master’s degree in applied science in management science. She authored or co-authored the following Cisco Press titles: the first and second editions +of Implementing Cisco IP Routing (ROUTE); the second edition of Designing Cisco Network Service Architectures (ARCH) ; Campus Network Design Fundamentals; the three editions of Authorized Self-Study Guide Building Scalable Cisco Internetworks (BSCI); and Building Scalable Cisco Networks. Diane edited the first two editions +of the Authorized Self-Study Guide Designing for Cisco Internetwork Solutions (DESGN), and also edited Designing Cisco Networks. + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +vi CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Dedications + +This book is dedicated to two very special people who supported me in my early years of IT, without whom this book would not have been possible. I will forever be grateful for the opportunity you gave me so many years ago to pursue my career. Thank you! + +Raymond Lacoste + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +vii + +Acknowledgments + +A big thank you to my wife for encouraging me to write this book and supporting me over the months that it took to complete it. Great big hugs to my two wonderful chil-dren, ages 9 and 5, who had no idea why Daddy was always sitting at the computer; for some strange reason, though, they knew that it was important and supported me in their own mysterious ways. I love you guys! + +An equally big thank you to my parents, without whom I would not be where I am or who I am today, and to my sister, Terry-Anne, who always kicked me in the right direc-tion. + +Thanks to Dan Young, my mentor and the Director of Live Learning at Skillsoft, for all the support and encouragement you have provided me all these years. + +I’d like to thank Ellie Bru, my Development Editor, for organizing and putting into action all the parts needed to develop this book (definitely not an easy task). + +Thank you to Mandie Frank, my Production Editor, for putting all the final pieces of this book together so nicely and making sure that it resembles a book. + +Thank you to Diane Teare and Ryan Lindfield for reviewing the book and making sure it’s technically sound. + +Keith Cline, thank you for making sure all i’s were “crossed” and t’s “dotted” within the book. (HaHaHa) You found some items in this book that I didn’t even know existed. Thank you! + +Thank you to Brett Bartow, my Executive Editor, for giving me the opportunity to write this detailed book. + +A big thank you to Kevin Wallace, the author of the previous edition of TSHOOT and a friend, who passed the torch on to me for this edition. Thank you. + +Lastly, thank you to the entire team at Cisco Press, their families and friends, who work extremely hard to produce high-quality training materials. + +—Raymond Lacoste + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +viii CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Contents at a Glance + +Introduction xxx + +Part I Fundamental Troubleshooting and Maintenance Concepts + +Chapter 1 Introduction to Troubleshooting and Network Maintenance 3 + +Chapter 2 Troubleshooting and Maintenance Tools 41 + +Chapter 3 Troubleshooting Device Performance 93 + +Part II Troubleshooting Cisco Catalyst Switch Features + +Chapter 4 Troubleshooting Layer 2 Trunks, VTP, and VLANs 129 + +Chapter 5 Troubleshooting STP and Layer 2 EtherChannel 169 + +Chapter 6 Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 209 + +Chapter 7 Troubleshooting Switch Security Features 247 + + +Chapter 8 + +Part III + +Troubleshooting First-Hop Redundancy Protocols 287 + +Troubleshooting Router Features + + + +Chapter 9 + +Chapter 10 + +Troubleshooting IPv4 Addressing and Addressing Technologies 335 + +Troubleshooting IPv6 Addressing and Addressing Technologies 367 + + +Chapter 11 Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 397 + +Chapter 12 Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 423 + +Chapter 13 Troubleshooting RIPv2 and RIPng 463 + +Chapter 14 Troubleshooting EIGRP 513 + +Chapter 15 Troubleshooting OSPF 587 + +Chapter 16 Troubleshooting Route Maps and Policy-Based Routing 675 + +Chapter 17 Troubleshooting Redistribution 697 + +Chapter 18 Troubleshooting BGP 749 + + +Part IV + +Chapter 19 + +Troubleshooting Management + +Troubleshooting Management Protocols and Tools 815 + + +Chapter 20 Troubleshooting Management Access 851 + + + + +www.allitebooks.com From the Library of Outcast Outcast +ix + + +Part V + +Chapter 21 + +Final Preparation + +Additional Trouble Tickets 871 + + + +Chapter 22 + +Part VI + +Final Preparation 943 + +Appendixes + + +Appendix A Answers to the “Do I Know This Already” Quizzes 951 + +Appendix B TSHOOT Exam Updates 957 + +Index 960 + +CD-Only Appendixes and Glossary + + +Appendix C + +Appendix D + +Appendix E + +Memory Tables + +Memory Tables Answer Key + +Study Planner + +Glossary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +x CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Contents + +Introduction xxx + + +Part I + +Chapter 1 + +Fundamental Troubleshooting and Maintenance Concepts + +Introduction to Troubleshooting and Network Maintenance 3 + +“Do I Know This Already?” Quiz 3 Foundation Topics 9 +Introduction to Troubleshooting 9 Defining Troubleshooting 9 +The Value of Structured Troubleshooting 11 A Structured Approach 13 +1. Problem Report 13 +2. Collect Information 14 +3. Examine Collected Information 15 4. Eliminate Potential Causes 16 +5. Propose an Hypothesis 17 6. Verify Hypothesis 18 +7. Problem Resolution 19 +Popular Troubleshooting Methods 20 The Top-Down Method 21 +The Bottom-Up Method 21 +The Divide-and-Conquer Method 22 +The Following the Traffic Path Method 23 The Comparing Configurations Method 23 The Component Swapping Method 24 +Practice Exercise: Selecting a Troubleshooting Approach 25 Introduction to Network Maintenance 26 +Defining Network Maintenance 26 +Proactive Versus Reactive Network Maintenance 27 Well-Known Network Maintenance Models 28 +Example of Adapting a Network Maintenance Model 28 Common Maintenance Procedures 29 +Routine Maintenance Tasks 29 Scheduled Maintenance 30 Managing Network Changes 30 +Maintaining Network Documentation 32 + + + + + +From the Library of Outcast Outcast +xi + +Restoring Operations After a Failure 33 Measuring Network Performance 34 +The Troubleshooting and Network Maintenance Relationship 34 Maintaining Current Network Documentation 35 Establishing a Baseline 36 +Communication 36 Change Management 37 +Exam Preparation Tasks 39 Review All Key Topics 39 Define Key Terms 39 +Chapter 2 Troubleshooting and Maintenance Tools 41 “Do I Know This Already?” Quiz 41 Foundation Topics 45 +The Troubleshooting and Network Maintenance Toolkit 45 Network Documentation Tools 46 +Basic Tools 47 CLI Tools 47 GUI Tools 48 +Recovery Tools 48 Logging Tools 53 +Network Time Protocol as a Tool 56 Advanced Tools 57 +Overview of SNMP and NetFlow 57 +Creating a Baseline with SNMP and NetFlow 58 SNMP 58 +NetFlow 59 +Cisco Support Tools 64 +Using Cisco IOS to Verify and Define the Problem 64 Ping 64 +Telnet 67 Traceroute 67 +Using Cisco IOS to Collect Information 68 Filtering the Output of show Commands 69 Redirecting show Command Output to a File 73 Troubleshooting Hardware 74 + + + + + +From the Library of Outcast Outcast +xii CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Collecting Information in Transit 75 Performing Packet Captures 75 SPAN 76 +RSPAN 78 +Using Tools to Document a Network 80 Exam Preparation Tasks 85 +Review All Key Topics 85 Define Key Terms 86 +Complete Tables and Lists from Memory 86 Command Reference to Check Your Memory 86 +Chapter 3 Troubleshooting Device Performance 93 “Do I Know This Already?” Quiz 93 Foundation Topics 96 +Troubleshooting Switch Performance Issues 96 Cisco Catalyst Switch Troubleshooting Targets 96 TCAM Troubleshooting 101 +High CPU Utilization Troubleshooting on a Switch 105 Troubleshooting Router Performance Issues 106 Excessive CPU Utilization 107 +Understanding Packet-Switching Modes (Routers and Multilayer Switches) 113 +Troubleshooting Packet-Switching Modes 116 Excessive Memory Utilization 121 +Exam Preparation Tasks 124 Review All Key Topics 124 Define Key Terms 124 +Complete Tables and Lists from Memory 125 Command Reference to Check Your Memory 125 + +Part II + +Chapter 4 + +Troubleshooting Cisco Catalyst Switch Features + +Troubleshooting Layer 2 Trunks, VTP, and VLANs 129 + +“Do I Know This Already?” Quiz 129 Foundation Topics 132 +Frame-Forwarding Process 132 Troubleshooting Trunks 140 +Encapsulation Mismatch 141 Incompatible Trunking Modes 143 + + + +From the Library of Outcast Outcast +xiii + +VTP Domain Name Mismatch 146 Native VLAN Mismatch 146 Allowed VLANs 147 +Troubleshooting VTP 148 Domain Name Mismatch 148 Version Mismatch 149 Mode Mismatch 149 Password Mismatch 151 Higher Revision Number 151 +Troubleshooting VLANs 152 Incorrect IP Addressing 152 Missing VLAN 153 +Incorrect Port Assignment 154 The MAC Address Table 155 Layer 2 Trouble Tickets 157 +Trouble Ticket 4-1 158 Trouble Ticket 4-2 160 +Exam Preparation Tasks 165 Review All Key Topics 165 Define Key Terms 165 +Complete Tables and Lists from Memory 166 Command Reference to Check Your Memory 166 +Chapter 5 Troubleshooting STP and Layer 2 EtherChannel 169 “Do I Know This Already?” Quiz 169 +Foundation Topics 172 +Spanning Tree Protocol Overview 172 Reviewing STP Operation 173 Determining Root Port 175 Determining Designated Port 176 Determining Nondesignated Port 176 +Collecting Information About an STP Topology 177 Gathering STP Information 177 +Gathering MSTP Information 179 STP Troubleshooting Issues 180 +Corruption of a Switch’s MAC Address Table 180 Broadcast Storms 181 + + + + +From the Library of Outcast Outcast +xiv CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Troubleshooting STP Features 182 PortFast 183 +BPDU Guard 184 BPDU Filter 187 Root Guard 189 Loop Guard 190 +STP Trouble Tickets 190 Trouble Ticket 5-1 191 Trouble Ticket 5-2 194 Trouble Ticket 5-3 196 +Troubleshooting Layer 2 EtherChannel 199 Reviewing Layer 2 EtherChannel 199 +EtherChannel Trouble Tickets 200 Trouble Ticket 5-4 201 Trouble Ticket 5-5 204 +Exam Preparation Tasks 206 Review All Key Topics 206 Define Key Terms 206 +Complete Tables and Lists from Memory 207 Command Reference to Check Your Memory 207 +Chapter 6 Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 209 “Do I Know This Already?” Quiz 209 +Foundation Topics 212 +Troubleshooting a Router-on-a-Trunk/Stick 212 Router-on-a-Trunk/Stick Trouble Tickets 213 +Trouble Ticket 6-1 214 Trouble Ticket 6-2 218 +Troubleshooting Switched Virtual Interfaces 221 Reviewing SVIs 221 +Troubleshooting SVIs 223 SVI Trouble Tickets 224 +Trouble Ticket 6-3 225 Trouble Ticket 6-4 230 +Troubleshooting Routed Ports 233 Routed Ports Trouble Tickets 234 +Trouble Ticket 6-5 235 + + + + +From the Library of Outcast Outcast +xv + +Troubleshooting Layer 3 EtherChannel 237 Layer 3 EtherChannel Trouble Tickets 239 +Trouble Ticket 6-6 240 Exam Preparation Tasks 244 Review All Key Topics 244 Define Key Terms 244 +Complete Tables and Lists from Memory 245 +Show Command Reference to Check Your Memory 245 + +Chapter 7 Troubleshooting Switch Security Features 247 “Do I Know This Already?” Quiz 247 +Foundation Topics 250 Troubleshooting Port Security 250 +Common Port Security Issues 250 +Port Security Configured but Not Enabled 250 Static MAC Address Not Configured Correctly 251 Maximum Number of MAC Addresses Reached 253 +Legitimate Users Being Blocked Because of Violation 254 Running Configuration Not Saved to Startup Configuration 260 +Port Security Trouble Tickets 261 Trouble Ticket 7-1 261 +Troubleshooting Spoof-Prevention Features 265 DHCP Snooping 265 +Dynamic ARP Inspection 267 IP Source Guard 268 +Spoof-Prevention Features Trouble Tickets 270 Trouble Ticket 7-2 270 +Troubleshooting Access Control 273 Protected Ports 273 +Private VLANs 275 VACLs 279 +Exam Preparation Tasks 281 Review All Key Topics 281 Define Key Terms 282 +Command Reference to Check Your Memory 282 + + + + + + + +From the Library of Outcast Outcast +xvi CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 8 Troubleshooting First-Hop Redundancy Protocols 287 “Do I Know This Already?” Quiz 287 +Foundation Topics 290 Troubleshooting HSRP 290 +Reviewing HSRP 290 +HSRP Converging After a Failure 291 +HSRP Verification and Troubleshooting 292 Virtual Router MAC Address 293 Interface Tracking 293 +Verifying First Hop 294 Debug 296 +HSRP Trouble Tickets 297 Trouble Ticket 8-1 297 Trouble Ticket 8-2 300 Trouble Ticket 8-3 302 +Troubleshooting VRRP 306 Reviewing VRRP 306 +VRRP Verification and Troubleshooting 308 Virtual Router MAC Address 309 +Object Tracking 309 Verifying First Hop 310 +VRRP Trouble Tickets 312 Trouble Ticket 8-4 312 Trouble Ticket 8-5 315 +Troubleshooting GLBP 318 Reviewing GLBP 319 +GLBP Verification and Troubleshooting 321 Virtual Router MAC Addresses 323 +GLBP Object Tracking 323 Verifying GLBP First Hop 325 +GLBP Trouble Tickets 326 Trouble Ticket 8-6 327 Trouble Ticket 8-7 329 +Comparing HSRP, VRRP, and GLBP 330 Exam Preparation Tasks 332 +Review All Key Topics 332 + + + + + +From the Library of Outcast Outcast +xvii + +Define Key Terms 333 +Complete Tables and Lists from Memory 333 Command Reference to Check Your Memory 333 +Part III Troubleshooting Router Features + +Chapter 9 Troubleshooting IPv4 Addressing and Addressing Technologies 335 “Do I Know This Already?” Quiz 335 +Foundation Topics 338 Troubleshooting IPv4 Addressing 338 +IPv4 Addressing Issues 338 +Determining IP Addresses Within a Subnet 341 Troubleshooting DHCP for IPv4 342 +Reviewing DHCP Operations 342 +Potential DHCP Troubleshooting Issues 347 DHCP Troubleshooting Commands 348 +Troubleshooting NAT 350 Reviewing NAT 350 +NAT Troubleshooting Issues 353 NAT Troubleshooting Commands 354 +IPv4 Addressing and Addressing Technologies Trouble Tickets 356 Trouble Ticket 9-1 356 +Trouble Ticket 9-2 358 Trouble Ticket 9-3 361 +Exam Preparation Tasks 364 Review All Key Topics 364 Define Key Terms 365 +Command Reference to Check Your Memory 365 + +Chapter 10 Troubleshooting IPv6 Addressing and Addressing Technologies 367 “Do I Know This Already?” Quiz 367 +Foundation Topics 370 Troubleshooting IPv6 Addressing 370 +IPv6 Addressing Review 370 +Neighbor Solicitation and Neighbor Advertisement 370 EUI-64 373 +Troubleshooting IPv6 Address Assignment 375 Stateless Address Autoconfiguration/SLAAC 375 Stateful DHCPv6 381 + + + +From the Library of Outcast Outcast +xviii CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Stateless DHCPv6 382 DHCPv6 Operation 384 DHCPv6 Relay Agent 385 +IPv6 Addressing Trouble Tickets 386 Trouble Ticket 10-1 386 +Trouble Ticket 10-2 389 Exam Preparation Tasks 394 Review All Key Topics 394 Define Key Terms 395 +Command Reference to Check Your Memory 395 + +Chapter 11 Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 397 “Do I Know This Already?” Quiz 397 +Foundation Topics 401 Troubleshooting IPv4 ACLs 401 +Reading an IPv4 ACL 401 +Using an IPv4 ACL for Filtering 403 Using a Time-Based IPv4 ACL 403 +IPv4 ACL Trouble Tickets 405 Trouble Ticket 11-1 405 +Troubleshooting IPv6 ACLs 407 Reading an IPv6 ACL 408 +Using an IPv6 ACL for Filtering 409 IPv6 ACL Trouble Tickets 410 +Trouble Ticket 11-2 410 Troubleshooting Prefix Lists 414 +Reading a Prefix List 414 Prefix List Processing 415 Prefix List Trouble Tickets 416 +Trouble Ticket 11-3 417 Exam Preparation Tasks 419 Review All Key Topics 419 Define Key Terms 419 +Command Reference to Check Your Memory 419 + + + + + + + + +From the Library of Outcast Outcast +xix + +Chapter 12 Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 423 “Do I Know This Already?” Quiz 423 +Foundation Topics 427 +Packet-Forwarding Process 427 +Reviewing Layer 3 Packet-Forwarding Process 427 Troubleshooting the Packet-Forwarding Process 431 +Troubleshooting Routing Information Sources 435 Data Structures and the Routing Table 436 Sources of Route Information 436 +Troubleshooting Static Routes 438 IPv4 Static Routes 439 +IPv6 Static Routes 443 +Static Routing Trouble Tickets 445 Trouble Ticket 12-1 445 Trouble Ticket 12-2 448 +Troubleshooting GRE Tunnels 450 Exam Preparation Tasks 459 Review All Key Topics 459 +Define Key Terms 460 +Complete Tables and Lists from Memory 460 Command Reference to Check Your Memory 460 +Chapter 13 Troubleshooting RIPv2 and RIPng 463 “Do I Know This Already?” Quiz 463 Foundation Topics 466 +Troubleshooting RIPv2 466 Missing RIPv2 Routes 466 Interface Is Shut Down 469 Wrong Subnet 469 +Bad or Missing Network Statement 470 Passive Interface 471 +Wrong Version 473 +Max Hop Count Exceeded 475 Authentication 477 +Route Filtering 479 Split Horizon 480 Autosummarization 482 +Better Source of Information 483 + + + +www.allitebooks.com From the Library of Outcast Outcast +xx CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +ACLs 485 +Load Sharing 485 Other RIP Issues 486 +Missing Default Route 486 Route Summarization 487 +Troubleshooting RIPng 492 +RIPv2 and RIPng Trouble Tickets 498 Trouble Ticket 13-1 498 +Trouble Ticket 13-2 502 Trouble Ticket 13-3 506 +Exam Preparation Tasks 509 Review All Key Topics 509 Define Key Terms 510 +Command Reference to Check Your Memory 510 + +Chapter 14 Troubleshooting EIGRP 513 +“Do I Know This Already?” Quiz 513 Foundation Topics 517 Troubleshooting EIGRP for IPv4 517 +Troubleshooting EIGRP for IPv4 Neighbor Adjacencies 517 Interface Is Down 518 +Mismatched Autonomous System Numbers 518 Incorrect Network Statement 520 +Mismatched K Values 522 Passive Interface 523 Different Subnets 524 Authentication 525 +ACLs 527 Timers 528 +Troubleshooting EIGRP for IPv4 Routes 528 Bad or Missing Network Command 529 Better Source of Information 530 +Route Filtering 534 Stub Configuration 535 +Interface Is Shut Down 537 Split-horizon 537 + + + + + +From the Library of Outcast Outcast +xxi + +Troubleshooting Miscellaneous EIGRP for IPv4 Issues 539 Feasible Successors 539 +Discontiguous Networks and Autosummarization 542 Route Summarization 543 +Load Balancing 544 +EIGRP for IPv4 Trouble Tickets 546 Trouble Ticket 14-1 546 +Trouble Ticket 14-2 553 Trouble Ticket 14-3 557 +Troubleshooting EIGRP for IPv6 561 +Troubleshooting EIGRP for IPv6 Neighbor Issues 561 Interface Is Down 561 +Mismatched Autonomous System Numbers 562 Mismatched K Values 562 +Passive Interfaces 562 Mismatched Authentication 562 Timers 563 +Interface Not Participating in Routing Process 563 ACLs 564 +Troubleshooting EIGRP for IPv6 Route 564 Interface Not Participating in Routing Process 564 Better Source of Information 565 +Route Filtering 565 Stub Configuration 565 Split-horizon 566 +EIGRP for IPv6 Trouble Tickets 567 Trouble Ticket 14-4 568 +Troubleshooting Named EIGRP Configurations 572 Named EIGRP Verification Commands 573 +Named EIGRP Trouble Tickets 577 Trouble Ticket 14-5 577 +Exam Preparation Tasks 582 Review All Key Topics 582 Define Key Terms 583 +Command Reference to Check Your Memory 583 + + + + + + +From the Library of Outcast Outcast +xxii CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 15 Troubleshooting OSPF 587 +“Do I Know This Already?” Quiz 587 Foundation Topics 590 Troubleshooting OSPFv2 590 +Troubleshooting OSPFv2 Neighbor Adjacencies 590 Interface Is Down 593 +Interface Not Running the OSPF Process 593 Mismatched Timers 594 +Mismatched Area Numbers 596 Mismatched Area Type 597 Different Subnets 598 +Passive Interface 599 +Mismatched Authentication Information 600 ACLs 601 +MTU Mismatch 602 Duplicate Router IDs 603 +Mismatched Network Types 604 Troubleshooting OSPFv2 Routes 606 Interface Not Running the OSPF Process 606 Better Source of Information 607 +Route Filtering 611 +Stub Area Configuration 613 Interface Is Shut Down 614 +Wrong Designated Router Was Elected 615 Duplicate Router IDs 619 +Troubleshooting Miscellaneous OSPFv2 Issues 620 Tracking OSPF Advertisements Through a Network 620 Route Summarization 622 +Discontiguous Areas 624 Load Balancing 626 Default Route 627 +OSPFv2 Trouble Tickets 627 Trouble Ticket 15-1 628 Trouble Ticket 15-2 635 Trouble Ticket 15-3 639 +Troubleshooting OSPFv3 for IPv6 641 OSPFv3 Troubleshooting Commands 641 + + + +From the Library of Outcast Outcast +xxiii + +OSPFv3 Trouble Tickets 647 Trouble Ticket 15-4 647 Trouble Ticket 15-5 650 +Troubleshoot OSPFv3 Address Families 655 OSPFv3 Address Family Troubleshooting 655 +OSPFv3 AF Trouble Tickets 664 Trouble Ticket 15-6 665 +Exam Preparation Tasks 669 Review All Key Topics 669 Define Key Terms 670 +Complete Tables and Lists from Memory 670 Command Reference to Check Your Memory 671 +Chapter 16 Troubleshooting Route Maps and Policy-Based Routing 675 “Do I Know This Already?” Quiz 675 +Foundation Topics 678 Troubleshooting Route Maps 678 +How to Read a Route Map 678 Troubleshooting Policy-Based Routing 681 +PBR 681 +Policy-Based Routing Trouble Tickets 684 Trouble Ticket 16-1 685 +Trouble Ticket 16-2 689 Trouble Ticket 16-3 691 +Exam Preparation Tasks 693 Review All Key Topics 693 Define Key Terms 693 +Command Reference to Check Your Memory 693 + +Chapter 17 Troubleshooting Redistribution 697 “Do I Know This Already?” Quiz 697 Foundation Topics 700 +Troubleshooting IPv4 and IPv6 Redistribution 700 Route Redistribution Overview 700 Troubleshooting Redistribution into RIP 703 Troubleshooting Redistribution into EIGRP 706 Troubleshooting Redistribution into OSPF 710 Troubleshooting Redistribution into BGP 715 +Troubleshooting Redistribution with Route Maps 718 + + + +From the Library of Outcast Outcast +xxiv CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Redistribution Trouble Tickets 718 Trouble Ticket 17-1 719 Trouble Ticket 17-2 723 Trouble Ticket 17-3 727 Trouble Ticket 17-4 733 +Troubleshooting Advanced Redistribution Issues 737 +Troubleshooting Suboptimal Routing Caused by Redistribution 737 Troubleshooting Routing Loops Caused by Redistribution 739 +Exam Preparation Tasks 745 Review All Key Topics 745 Define Key Terms 745 +Command Reference to Check Your Memory 746 + +Chapter 18 Troubleshooting BGP 749 +“Do I Know This Already?” Quiz 749 Foundation Topics 753 +Troubleshooting BGP Neighbor Adjacencies 753 Interface Is Down 754 +Layer 3 Connectivity Is Broken 754 +Path to Neighbor Is via Default Route 755 +Neighbor Does Not Have a Route to the Local Router 756 Incorrect neighbor Statement 757 +BGP Packets Sourced from Wrong IP Address 758 ACLs 759 +TTL of BGP Packet Expires 761 Mismatched Authentication 763 Misconfigured Peer Groups 764 Timers 765 +Troubleshooting BGP Routes 766 +Missing or Bad network mask Command 768 Next-Hop Router Not Reachable 770 +BGP Split-Horizon Rule 772 Better Source of Information 773 Route Filtering 775 +Troubleshooting BGP Path Selection 780 +Understanding the Best Path Decision-Making Process 781 Private Autonomous System Numbers 784 +Using debug Commands 784 + + + +From the Library of Outcast Outcast +xxv + +Troubleshooting BGP for IPv6 786 BGP Trouble Tickets 790 +Trouble Ticket 18-1 791 Trouble Ticket 18-2 796 Trouble Ticket 18-3 802 +MP-BGP Trouble Tickets 807 Trouble Ticket 18-4 807 +Exam Preparation Tasks 810 Review All Key Topics 810 Define Key Terms 811 +Command Reference to Check Your Memory 811 + +Part IV Troubleshooting Management + +Chapter 19 Troubleshooting Management Protocols and Tools 815 “Do I Know This Already?” Quiz 815 +Foundation Topics 818 +Management Protocols Troubleshooting 818 NTP Troubleshooting 818 +Syslog Troubleshooting 821 SNMP Troubleshooting 823 +Management Tools Troubleshooting 826 Cisco IOS IPSLA Troubleshooting 827 Object Tracking Troubleshooting 833 SPAN and RSPAN Troubleshooting 835 +Management Protocols and Tools Trouble Tickets 837 Trouble Ticket 19-1 838 +Exam Preparation Tasks 845 Review All Key Topics 845 Define Key Terms 846 +Command Reference to Check Your Memory 846 + +Chapter 20 Troubleshooting Management Access 851 “Do I Know This Already?” Quiz 851 Foundation Topics 854 +Console and vty Access Troubleshooting 854 Console Access Troubleshooting 854 + + + + + + +From the Library of Outcast Outcast +xxvi CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +vty Access Troubleshooting 855 Telnet 855 +SSH 857 +Password Encryption Levels 858 Cisco IOS AAA Troubleshooting 858 Management Access Trouble Tickets 861 +Trouble Ticket 20-1 862 Trouble Ticket 20-2 863 Trouble Ticket 20-3 865 +Exam Preparation Tasks 868 Review All Key Topics 868 Define Key Terms 868 +Command Reference to Check Your Memory 868 + +Part V Final Preparation + +Chapter 21 Additional Trouble Tickets 871 Introduction 871 +Trouble Ticket 1 872 Suggested Solution 875 Trouble Ticket 2 876 Suggested Solution 879 Trouble Ticket 3 880 Suggested Solution 882 Trouble Ticket 4 884 +Issue 1: Suggested Solution 891 Issue 2: Suggested Solution 897 Issue 3: Suggested Solution 897 Issue 4: Suggested Solution 898 Trouble Ticket 5 901 Suggested Solution 907 Trouble Ticket 6 910 Suggested Solution 916 Trouble Ticket 7 918 +Issue 1: Forgotten Enable Secret Password 919 Issue 1: Suggested Solution 919 + + + + + + +From the Library of Outcast Outcast +xxvii + +Issue 2: An exec-timeout Parameter Set Too Low 921 Issue 2: Suggested Solution 921 +Issue 3: ACL Misconfiguration 922 Issue 3: Suggested Solution 922 +Trouble Ticket 8 923 Suggested Solution 926 Trouble Ticket 9 926 +Issue 1: Adjacency Between Routers R1 and R2 927 Issue 1: Suggested Solution 930 +Issue 2: Adjacency Between Routers R2 and BB2 930 Issue 2: Suggested Solution 931 +Issue 3: Adjacency Between Routers BB1 and BB2 931 Issue 3: Suggested Solution 933 +Trouble Ticket 10 934 +Issue 1: Router R2 Not Load Balancing Between Routers BB1 and BB2 937 Issue 1: Suggested Solution 937 +Issue 2: Backbone Routes Not Being Suppressed 938 Issue 2: Suggested Solution 939 +Chapter 22 Final Preparation 943 +Tools for Final Preparation 943 +Exam Engine and Questions on the CD 943 Install the Exam Engine 944 +Activate and Download the Practice Exam 944 Activating Other Exams 945 +Premium Edition 945 +The Cisco Learning Network 945 Memory Tables 945 +Chapter-Ending Review Tools 946 Suggested Plan for Final Review/Study 946 +Step 1: Review Key Topics and DIKTA Questions 947 Step 3: Hands-On Practice 947 +Step 5: Subnetting Practice 948 Step 6: Use the Exam Engine 948 Summary 949 + + + + + + + +From the Library of Outcast Outcast +xxviii CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Part VI + +Appendix A + +Appendixes + +Answers to the “Do I Know This Already” Quizzes 951 + + +Appendix B TSHOOT Exam Updates 957 + +Index 960 + + +CD-Only Appendixes and Glossary + + +Appendix C + +Appendix D + +Appendix E + +Memory Tables + +Memory Tables Answer Key + +Study Planner + +Glossary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +xxix + +Icons Used in This Book + + + + +Workgroup Switch + + + + +File/ Application Server + + + + +Laptop + + + + +Phone + + + + +Serial Line + +Router + + + + + +Server + + + + + +Web Server + + + +Cisco Unified Communications Manager Server + + + +Ethernet Line + +Multilayer Switch + + + + +PC + + + + + +IP Phone + + + + +Network Cloud + + +Command Syntax Conventions + +The conventions used to present command syntax in this book are the same conventions used in the IOS Command Reference. The Command Reference describes these conven-tions as follows: + +■ Boldface indicates commands and keywords that are entered literally as shown. In actual configuration examples and output (not general command syntax), boldface indicates commands that are manually input by the user (such as a show command). + +■ Italics indicate arguments for which you supply actual values. + +■ Vertical bars (|) separate alternative, mutually exclusive elements. + +■ Square brackets [ ] indicate optional elements. + +■ Braces { } indicate a required choice. + +■ Braces within brackets [{ }] indicate a required choice within an optional element. + + + + + + +www.allitebooks.com From the Library of Outcast Outcast +xxx CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Introduction +Professional certifications have been an important part of the computing industry for many years and will continue to become more important. Many reasons exist for these certifications, but the most popularly cited reason is that of credibility. All other consid-erations held equal, the certified employee/consultant/job candidate is considered more valuable than one who is not. + +Goals and Methods + +The most important and somewhat obvious goal of this book is to help you pass the 300-135 Troubleshooting and Maintaining Cisco IP Networks (TSHOOT) exam. In fact, if the primary objective of this book were different, the book’s title would be mis-leading; however, the methods used in this book to help you pass the TSHOOT exam are designed to also make you much more knowledgeable about how to do your job. +Although this book and the accompanying CD-ROM have many exam preparation tasks and example test questions, the method in which they are used is not to simply make you memorize as many questions and answers as you possibly can. + +The methodology of this book helps you discover the exam topics about which you need more review, fully understand and remember exam topic details, and prove to yourself that you have retained your knowledge of those topics. So, this book helps you pass not by memorization, but by helping you truly learn and understand the topics. +The TSHOOT exam is typically your final journey in pursuit of the CCNP Routing and Switching certification, and the knowledge contained within is vitally important to con-sider yourself a truly skilled routing and switching expert or specialist. This book would do you a disservice if it did not attempt to help you learn the material. To that end, the book can help you pass the TSHOOT exam by using the following methods: + +■ Covering the exam topics and helping you discover which exam topics you have not mastered + +■ Providing explanations and information to fill in your knowledge gaps + +■ Supplying multiple troubleshooting case studies with diagrams and diagnostic out-put that enhance your ability to resolve trouble tickets presented in the exam envi-ronment, in addition to real-world troubleshooting issues you might encounter + +■ Providing practice exercises on exam topics, presented in each chapter and on the enclosed CD-ROM + +Who Should Read This Book? + +This book is not designed to be a general networking topics book, although it can be used for that purpose. This book is intended to tremendously increase your chances of passing the Cisco TSHOOT exam. Although other objectives can be achieved from using this book, the book is written with one goal in mind: to help you pass the exam. If you want to pass the exam, this book is for you. + + + +From the Library of Outcast Outcast +xxxi + +Strategies for Exam Preparation + +The strategy you use to prepare for the TSHOOT exam might differ slightly from strate-gies used by other readers, mainly based on the skills, knowledge, and experience you have already obtained. For example, if you have attended a TSHOOT course, you might take a different approach than someone who learned troubleshooting through on-the-job training. Regardless of the strategy you use or the background you have, this book is designed to help you gain the knowledge you need about the issues that can arise with different routing and switching technologies and get you to the point where you can apply that knowledge and pass the exam. + +Cisco Certifications and Exams + +Cisco offers four levels of routing and switching certification, each with an increasing level of proficiency: Entry, Associate, Professional, and Expert. These are commonly known by their acronyms CCENT (Cisco Certified Entry Networking Technician), CCNA (Cisco Certified Network Associate) Routing and Switching, CCNP (Cisco Certified Network Professional) Routing and Switching, and CCIE (Cisco Certified Internetworking Expert) Routing and Switching. + +For the CCNP Routing and Switching certification, you must pass exams on a series of CCNP topics, including the SWITCH, ROUTE, and TSHOOT exams. For most exams, Cisco does not publish the scores needed for passing. You need to take the exam to find that out for yourself. + +To see the most current requirements for the CCNP Routing and Switching certifica-tion, go to Cisco.com and click Training and Events. There you can find out other exam details such as exam topics and how to register for an exam. + +How This Book Is Organized + +Although this book can be read cover to cover, it is designed to be flexible and enable you to easily move between chapters to cover only the material that you need more work with. The chapters can be covered in any order, although some chapters are related and build upon each other. If you do intend to read them all, the order in the book is an excellent sequence to use. + +Each core chapter covers a subset of the topics on the CCNP TSHOOT exam. The chap-ters are organized into parts, covering the following topics: + +■ Chapter 1, “Introduction to Troubleshooting and Network Maintenance:” This chapter discusses the importance of having a structured troubleshooting approach and a solid network maintenance plan. It identifies many popular models, structures, and tasks that should be considered by all organizations. However, as you will see, there is no “one-stop shop for all your needs” when it comes to troubleshooting and network maintenance. It is more of an art that you will master over time. + + + + + +From the Library of Outcast Outcast +xxxii CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Chapter 2, “Troubleshooting and Maintenance Tools:” This chapter introduces you to a sampling of Cisco IOS tools and features designed for network maintenance and troubleshooting. The tools include ping, Telnet, traceroute, NetFlow, SNMP, SPAN, RSPAN, and CDP. + +■ Chapter 3, “Troubleshooting Device Performance:” This chapter discusses common reasons for high CPU and memory utilization on routers and switches in addition to how you can recognize them. You will examine interface statistics, as they can be an initial indication of some type of issue. You will also review the different types of packet switching modes on routers and multilayer switches. + +■ Chapter 4, “Troubleshooting Layer 2 Trunks, VTP, and VLANs:” This chapter begins by reviewing Layer 2 switch operations and builds from there with discus-sions on how to troubleshoot issues relating to trunks, VTP, and VLANs. You will also discover how important the information in the MAC address table can be while troubleshooting. + +■ Chapter 5, “Troubleshooting STP and Layer 2 EtherChannel:” This chapter reviews the operation of STP and focuses on troubleshooting STP topology issues such as root bridge selection, root port selection, designated port selection, and finally, the blocked port. You will also examine how to troubleshoot STP features such as PortFast, BPDU Guard, BPDU Filter, Root Guard, Loop Guard, and UDLD. In addition, this chapter reviews how you can combine multiple physical Layer 2 +switchports into a logical EtherChannel bundle and how you can troubleshoot issues related to them. + +■ Chapter 6, “Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels:” This chapter focuses on how you can troubleshoot issues related to different inter-VLAN routing implementations (router-on-a-trunk/stick and SVIs), issues related to routed ports, and issues related to Layer 3 EtherChannels. + +■ Chapter 7, “Troubleshooting Switch Security Features:” This chapter is dedicated to troubleshooting issues related to security features that can be implemented on switches. This includes port security, DHCP snooping, dynamic ARP inspection, IP Source Guard, protected ports, PVLANs, and VACLs. Most of the issues you will experience with these features are configuration based. Therefore, you will focus on the configuration requirements for troubleshooting purposes. + +■ Chapter 8, “Troubleshooting First-Hop Redundancy Protocols:” This chapter dis-cusses the issues that might arise when implementing FHRPs such as HSRP, VRRP, and GLBP. It identifies various elements that could cause these FHRPs not to func-tion as expected and that should be considered while you are troubleshooting. It also provides a collection of commands you can use to successfully troubleshoot issues related to each FHRP. + +■ Chapter 9, “Troubleshooting IPv4 Addressing and Addressing Technologies:” This chapter begins by reviewing IPv4 addressing and how you can identify if address-ing is the issue. This is extremely important as you do not want to waste your time troubleshooting a service or feature when the issue is related to the device having an inappropriate IPv4 address, subnet mask, or default gateway. The chapter then covers issues and troubleshooting tasks related to DHCPv4 and NAT. + + +From the Library of Outcast Outcast +xxxiii + +■ Chapter 10, “Troubleshooting IPv6 Addressing and Addressing Technologies:” This chapter covers how an IPv6-enabled device determines whether the destination is local or remote. You will also learn how MAC addresses are determined for known IPv6 address, and you will explore the various options for address assignment such as SLAAC and DHCPv6, and what to look for while troubleshooting IPv6-related issues. + +■ Chapter 11, “Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists:” This chap-ter covers the ins and outs of ACLs and prefix lists. You will learn the way they are processed, how they are read, and how you can identify issues related to them. In addition, this chapter explains how you can use ACLs for traffic filtering and how a prefix list can be used for route filtering. + +■ Chapter 12, “Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels:” This chapter covers the packet-delivery process and the various commands that enable you to troubleshoot issues related to the process. You will learn how a router choos-es which sources of routing information are more believable so that only the best routes are in the routing table. You will also learn how to recognize and troubleshoot issues related to static routing and GRE tunnels. + +■ Chapter 13, “Troubleshooting RIPv2 and RIPng:” This chapter focuses on the issues that you may have to troubleshoot in a RIPv2 and RIPng domain. This includes how you would recognize the issues based on the presented symptoms and the commands you would use to successfully verify the reason why the issue exists. + +■ Chapter 14, “Troubleshooting EIGRP:” This chapter covers troubleshooting of both EIGRP for IPv4 and EIGRP for IPv6. It breaks out the troubleshooting discussions into two different parts: troubleshooting neighbor adjacencies and troubleshoot- +ing missing routes. It also covers the troubleshooting of various issues that are not directly related to neighborships or routes that might arise with EIGRP. To wrap up the chapter, named EIGRP troubleshooting is covered. + +■ Chapter 15, “Troubleshooting OSPF:” This chapter covers troubleshooting of both OSPFv2 and OSPFv3. It breaks out the troubleshooting discussions into two differ-ent parts: troubleshooting neighbor adjacencies and troubleshooting missing routes. It also covers the troubleshooting of various issues that are not directly related to neighborships or routes that might arise with OSPF. To wrap up the chapter, OSPFv3 address family troubleshooting is covered. + +■ Chapter 16, “Troubleshooting Route Maps and Policy-Based Routing:” This chap-ter begins by examining route maps. It gives you the opportunity to review how route maps are read and the commands that you can use to verify a route map’s con-figuration. The rest of the chapter is dedicated to PBR, which allows you to override the router’s default routing behavior. Therefore, you will discover what could cause PBR not to behave as expected and how you can troubleshoot it. + + + + + + + +From the Library of Outcast Outcast +xxxiv CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Chapter 17, “Troubleshooting Redistribution:” This chapter explores the differences of redistributing into EIGRP, OSPF, RIP, and BGP for both IPv4 and IPv6. You will learn what to look out for while troubleshooting so that you can quickly solve any issues related to redistribution. In addition, you will examine what could occur in environments that have multiple points of redistribution and how you can identify the issues and solve them. + +■ Chapter 18, “Troubleshooting BGP:” This chapter examines the various issues that you may face when trying to establish an IPv4 and IPv6 eBGP and iBGP neighbor adjacency and how you can identify them and troubleshoot them. You will also examine the issues that may arise when exchanging IPv4 and IPv6 eBGP and iBGP routes and how you can recognize them and troubleshoot them successfully. You also need to be very familiar with the decision-making process that BGP uses to be an efficient troubleshooter. Therefore, you will spend time exploring this process in the chapter as well. + +■ Chapter 19, “Troubleshooting Management Protocols and Tools:” This chapter covers the issues you might encounter with management protocols such as NTP, sys-log, and SNMP. It also covers the issues that you might encouter with management tools, such as Cisco IOS IP SLA, Object Tracking, SPAN, and RSPAN. + +■ Chapter 20, “Troubleshooting Management Access:” This chapter examines the different reasons why access to the console and vty lines might fail, and how you can identify them. In addition you will explore the issues that may arise when using Cisco IOS AAA authentication. + +■ Chapter 21, “Additional Trouble Tickets:” This chapter is dedicated to showing you an additional ten trouble tickets and the various approaches that you can take to solve the problems that are presented. + +■ Chapter 22, “Final Preparation:” This chapter identifies tools for final exam prepa-ration and helps you develop an effective study plan. + +■ Appendix A, “Answers to the ‘Do I Know This Already?’ Quizzes.:” This appen-dix has the answers to the “Do I Know This Already” quizzes, and Appendix B, “TSHOOT Exam Updates,” tells you how to find any updates should there be chang-es to the exam. + +Each chapter in the book uses several features to help you make the best use of your time in that chapter. The features are as follows: + +■ Assessment: Each chapter begins with a “Do I Know This Already?” quiz that helps you determine the amount of time you need to spend studying each topic of the chapter. If you intend to read the entire chapter, you can save the quiz for later use. Questions are all multiple-choice, to give a quick assessment of your knowledge. + +■ Foundation Topics: This is the core section of each chapter that explains the pro-tocols, concepts, configuration, and troubleshooting strategies for the topics in the chapter. + + + + + +From the Library of Outcast Outcast +xxxv + +■ Exam Preparation Tasks: At the end of each chapter, this section collects key top-ics, references to memory table exercises to be completed as memorization practice, key terms to define, and a command reference that summarizes any relevant com-mands presented in the chapter. + +Finally, the companion CD-ROM contains practice CCNP Routing and Switching TSHOOT questions to reinforce your understanding of the book’s concepts. Be aware that the TSHOOT exam will primarily be made up of trouble tickets you need to resolve. Mastery of the topics covered by the CD-based questions, however, will help equip you with the tools needed to effectively troubleshoot the trouble tickets present-ed on the exam. + +The CD also contains the Memory Table exercises and answer keys as well as over 60mins of video walking you through an exam strategy. + +CCNP TSHOOT Exam Topics + +Carefully consider the exam topics Cisco has posted on its website as you study, par-ticularly for clues to how deeply you should know each topic. Also, you can develop a broader knowledge of the subject matter by reading and studying the topics presented in this book. Remember that it is in your best interest to become proficient in each of +the CCNP Routing and Switching subjects. When it is time to use what you have learned, being well rounded counts more than being well tested. + +Table I-1 shows the official exam topics for the TSHOOT exam, as posted on Cisco. com. Note that Cisco has occasionally changed exam topics without changing the exam number, so do not be alarmed if small changes in the exam topics occur over time. Also, it is possible to receive questions on the exam that are not related to any of the exam topics listed. Cisco indicates this when you view the exam topics on their web-site. Therefore, to ensure that you are well prepared for the exam, we have covered the +exam topics as well as any additional topics that we considered to be necessary for your success. For example, there is no mention of Layer 2 security, inter-VLAN routing, or FHRPs in the exam objectives. However, we have included chapters dedicated to these to make sure that you are well prepared. + +Table I-1 CCNP TSHOOT Exam Topics + + +Exam Topics +1.0 Network Principles Debug, conditional debug +Ping and trace route with extended options + +Diagnose the root cause of networking issues (analyze symptoms, identify and describe root cause) + +Design and implement valid solutions + +Verify and monitor resolution + +Chapters Where Exam Topics Are Covered + + +Chapters 1 and 2 + + + + +From the Library of Outcast Outcast +xxxvi CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Exam Topics +2.0 Layer 2 Technologies Troubleshooting switch administration +Troubleshooting Layer 2 protocols + +Troubleshoot VLANs + +Troubleshoot trunking + +Troubleshoot EtherChannels + +Troubleshoot spanning tree + +Troubleshoot other LAN switching technologies + +Troubleshoot chassis virtualization and aggregation technologies +3.0 Layer 3 Technologies + +Troubleshooting IPv4 addressing and subnetting + +Troubleshoot IPv6 addressing and subnetting + +Troubleshoot static routing + +Troubleshoot default routing + +Troubleshoot administrative distance + +Troubleshoot passive interfaces + +Troubleshoot VRF lite + +Troubleshoot filter with any protocol + +Chapters Where Exam Topics Are Covered + + +Chapters 4, 5, 19 + + + + + + + + + + + + + + +Chapters 9, 10, 12–18 + + +Troubleshoot between any routing protocols or routing sources + +Troubleshoot manual and autosummarization with any routing protocol + +Troubleshoot policy-based routing + +Troubleshoot suboptimal routing + +Troubleshoot loop prevention mechanisms + +Troubleshoot RIPv2 + +Troubleshoot EIGRP neighbor relationship and authentication + + + + + +From the Library of Outcast Outcast +xxxvii + + + +Exam Topics +Troubleshoot loop free path selection + +Troubleshoot EIGRP operations + +Troubleshoot EIGRP stubs + +Troubleshoot EIGRP load balancing + +Troubleshoot EIGRP metrics + +Troubleshoot OSPF neighbor relationship and authentication + +Troubleshoot network types, area types, and router types + +Troubleshoot OSPF path preference + +Troubleshoot OSPF operations + +Troubleshoot OSPF for IPv6 + +Troubleshoot BGP peer relationships and authentication + +Troubleshoot eBGP + +4.0 VPN Technologies + +Troubleshoot GRE + +5.0 Infrastructure Security + +Chapters Where Exam Topics Are Covered Chapters 9, 10, 12–18 + + + + + + + + + + + + + + + + + + + + +Chapter 12 + + +Troubleshoot IOS AAA using local database Chapters 11 and 20 + +Troubleshoot device access control + +Troubleshoot router security features + +6.0 Infrastructure Services + +Troubleshoot device Management Chapters 2, 9, 10, and 19 + +Troubleshoot SNMP + +Troubleshoot logging + +Troubleshoot Network Time Protocol (NTP) + +Troubleshoot IPv4 and IPv6 DHCP + +Troubleshoot IPv4 Network Address Translation (NAT) + +Troubleshoot SLA architecture + +Troubleshoot tracking objects + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Introduction to Troubleshooting: This section intro-duces you to troubleshooting and then focuses on +a structured troubleshooting approach. It also pro-vides you with some common steps to help you be more efficient. + +■ Popular Troubleshooting Methods: This section introduces you to various troubleshooting methods that can assist in narrowing your focus during your troubleshooting efforts. + +■ Introduction to Network Maintenance: This section introduces you to maintenance tasks and identifies +a few well-known network maintenance models that you can adopt. + +■ Common Maintenance Procedures: This section reviews the common network maintenance tasks that all organizations should perform. + +■ The Troubleshooting and Network Maintenance Relationship: This section identifies the importance of aligning maintenance tasks with troubleshooting goals. + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 1 + + + + +Introduction to Troubleshooting and Network Maintenance + + +Business operations, without a doubt, depend on the reliable operation of data networks (which might also carry voice and video traffic). This statement holds true regardless +of the business size. A structured and systematic maintenance approach significantly contributes to the uptime for all networks. In addition, having a sound troubleshooting methodology in place helps ensure that when issues arise you are confident and ready to fix them. + +Consider a vehicle as an example. Regular maintenance such as oil changes, joint lubrica-tion, and fluid top-offs are performed on a vehicle to ensure that problems do not arise and the life of that vehicle is maximized. However, if an issue does arise, it is taken to +a mechanic so that they may troubleshoot the issue using a structured troubleshooting process and ultimately fix the vehicle. Similarly, the number of issues in a network can be reduced by following a maintenance plan, and troubleshooting can be more effective with a structured approach in place. + +This chapter discusses the importance of having a structured troubleshooting approach and a solid network maintenance plan. It identifies many popular models, structures, and tasks that should be considered by all organizations. However, as you will see, there is no “one-stop shop for all your needs” when it comes to troubleshooting and network mainte-nance. It is more of an art that you will master over time. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 1-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 1-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Introduction to Troubleshooting + +Popular Troubleshooting Methods + +Introduction to Network Maintenance + + + +www.allitebooks.com + +Questions +1–7 + +8–9 + +10–12 + + + +From the Library of Outcast Outcast +4 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Foundation Topics Section +Identifying Common Maintenance Procedures + +The Troubleshooting and Network Maintenance Relationship + +Questions 13–16 +17–20 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Identify the three steps in a simplified troubleshooting model. + +a. Problem replication + +b. Problem diagnosis + +c. Problem resolution + +d. Problem report + +2. Which of the following is the best statement to include in a problem report? + +a. The network is broken. + +b. User A cannot reach the network. + +c. User B recently changed his PC’s operating system to Microsoft Windows 7. + +d. User C is unable to attach to an internal share resource of \\10.1.1.1\Budget, although he can print to all network printers, and he can reach the Internet. + +3. What troubleshooting step should you perform after a problem has been reported and clearly defined? + +a. Propose an hypothesis + +b. Collect information + +c. Eliminate potential causes + +d. Examine collected information + +4. What are the two primary goals of troubleshooters as they are collecting informa-tion? + +a. Eliminate potential causes from consideration + +b. Identify indicators pointing to the underlying cause of the problem + +c. Propose an hypothesis about what is most likely causing the problem + +d. Find evidence that can be used to eliminate potential causes + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 5 + +5. When performing the “eliminate potential causes” troubleshooting step, which cau-tion should the troubleshooter be aware of? + +a. The danger of drawing an invalid conclusion from the observed data + +b. The danger of troubleshooting a network component over which the trouble-shooter does not have authority + +c. The danger of causing disruptions in workflow by implementing the proposed solution + +d. The danger of creating a new problem by implementing the proposed solution + +6. A troubleshooter is hypothesizing a cause for an urgent problem, and her hypothesis involves a network device that she is not authorized to configure. The person who is authorized to configure the network device is unavailable. What should the trouble-shooter do? +a. Wait for authorized personnel to address the issue. + +b. Attempt to find a temporary workaround for the issue. + +c. Override corporate policy, based on the urgency, and configure the network device independently because authorized personnel are not currently available. + +d. Instruct the user to report the problem to the proper department that is autho-rized to resolve the issue. + +7. Experienced troubleshooters with in-depth comprehension of a particular network might skip the examine information and eliminate potential causes steps in a struc-tured troubleshooting model, instead relying on their own insight to determine the most likely cause of a problem. This illustrates what approach to network trouble-shooting? +a. Ad hoc + +b. Shoot from the hip + +c. Crystal ball + +d. Independent path + +8. Which of the following troubleshooting models requires access to a specific applica-tion? + +a. Bottom-up + +b. Divide-and-conquer + +c. Comparing configurations + +d. Top-down + + + + + + + +From the Library of Outcast Outcast +6 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +9. Based on your analysis of a problem report and the data collected, you want to use a troubleshooting model that can quickly eliminate multiple layers of the OSI model as potential sources of the reported problem. Which of the following troubleshooting methods would be most appropriate? +a. Following the traffic path + +b. Bottom-up + +c. Divide-and-conquer + +d. Component swapping + +10. Which of the following are considered network maintenance tasks? (Choose the three best answers.) + +a. Troubleshooting problem reports + +b. Attending training on emerging network technologies + +c. Planning for network expansion + +d. Hardware installation + +11. Network maintenance tasks can be categorized into one of which two categories? + +a. Recovery tasks + +b. Interrupt-driven tasks + +c. Structured tasks + +d. Installation tasks + +12. Which letter in the FCAPS acronym represents the maintenance area responsible for billing end users? + +a. F + +b. C + +c. A + +d. P + +e. S + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 7 + +13. The lists of tasks required to maintain a network can vary widely, depending on the goals and characteristics of that network. However, some network maintenance tasks are common to most networks. Which of the following would be considered a com-mon task that should be present in any network maintenance model? +a. Performing database synchronization for a network’s Microsoft Active Directory + +b. Making sure that digital certificates used for PKI are renewed in advance of their expiration + +c. Using Cisco Prime to dynamically discover network device changes + +d. Performing scheduled backups + +14. Which of the following statements is true about scheduled maintenance? + +a. Scheduled maintenance helps ensure that important maintenance tasks are not overlooked. + +b. Scheduled maintenance is not recommended for larger networks, because of the diversity of maintenance needs. + +c. Maintenance tasks should only be performed based on a scheduled maintenance schedule, to reduce unexpected workflow interruptions. + +d. Scheduled maintenance is more of a reactive approach to network maintenance, as opposed to a proactive approach. + +15. Which of the following questions are appropriate when defining your change man-agement policies? + +a. What version of operating system is currently running on the device to be upgraded? + +b. What is the return on investment (ROI) of an upgrade? + +c. What measureable criteria determine the success or failure of a network change? + +d. Who is responsible for authorizing various types of network changes? + +16. Which three of the following components would you expect to find in a set of net-work documentation? + +a. Logical topology diagram + +b. Listing of interconnections + +c. Copy of IOS image + +d. IP address assignments + + + + + + + + +From the Library of Outcast Outcast +8 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +17. What is the ideal relationship between network maintenance and troubleshooting? + +a. Networking maintenance and troubleshooting efforts should be isolated from one another. + +b. Networking maintenance and troubleshooting efforts should complement one another. + +c. Networking maintenance and troubleshooting efforts should be conducted by different personnel. + +d. Networking maintenance is a subset of network troubleshooting. + +18. Which three of the following suggestions can best help troubleshooters keep in mind the need to document their steps? + +a. Require documentation + +b. Keep documentation in a hidden folder + +c. Schedule documentation checks + +d. Automate documentation + +19. Which three troubleshooting phases require clear communication with end users? + +a. Problem report + +b. Information collection + +c. Hypothesis verification + +d. Problem resolution + +20. What are two elements of a change management system? + +a. Determine when changes can be made + +b. Determine potential causes for the problem requiring the change + +c. Determine who can authorize a change + +d. Determine what change should be made + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 9 + +Foundation Topics + + +Introduction to Troubleshooting + +Troubleshooting is a skill, and like all skills, you will get better at it the more you have to perform it. The more troubleshooting situations you are placed in, the more your skills will improve, and as a result of this, the more your confidence will grow. However, don’t start wishing for issues to happen in your organization just so that you can get more experience. Although there is no right or wrong way to troubleshoot, there is definitely a more efficient and effective way to troubleshoot that all experienced troubleshooters follow. This section begins by introducing you to troubleshooting. It then focuses on a structured troubleshooting approach that provides you with some common methods to enhance your efficiency. + +Defining Troubleshooting + +Troubleshooting at its essence is the process of responding to a problem report (some-times in the form of a trouble ticket), diagnosing the underlying cause of the problem, and resolving the problem. Although you normally think of the troubleshooting process as beginning when a user reports an issue, you need to understand that through effec-tive network monitoring you may detect a situation that could become a troubleshooting issue and resolve that situation before it impacts users. + +After an issue is reported, the first step toward resolution is clearly defining the issue. When you have a clearly defined troubleshooting target, you can begin gathering further information related to it. From this information, you should be able to better define the issue. Then based on your diagnosis, you can propose an hypothesis about what is most likely causing the issue. Then the evaluation of these likely causes leads to the identifica-tion of the suspected underlying root cause of the issue. + +After you identify a suspected underlying cause, you next define approaches to resolv-ing the issue and select what you consider to be the best approach. Sometimes the best approach to resolving an issue cannot be implemented immediately. For example, a piece of equipment might need replacing, or a business’s workflow might be disrupted by implementing such an approach during working hours. In such situations, a troubleshoot-er might use a temporary fix until a permanent fix can be put in place. + +Let’s look at an example. It is 3:00 p.m. at a luxury hotel in Las Vegas. On this day, the hotel cannot register guests or create the keycards needed for guest rooms. After fol-lowing the documented troubleshooting procedures, the network team discovers that Spanning Tree Protocol (STP) has failed on a Cisco Catalyst switch, resulting in a Layer 2 topological loop. Thus, the network is being flooded with traffic, preventing registrations and keycards from being completed because the server is not accessible. The network team now has to decide on the best course of action at this point. The permanent fix of replacing the failed equipment immediately would disrupt the network further and take a considerable amount of time, thus delaying the guest registrations further. A temporary + + + +From the Library of Outcast Outcast +10 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +fix would be to disconnect the redundant links involved in the loop so that the Layer 2 loop is broken and guests can be registered at that point. When the impact on guests and guest services is minimal, the network team can implement the permanent fix. Consider Figure 1-1, which depicts a simplified model of the troubleshooting steps previously described. + +Problem Report Problem Diagnosis Problem Resolution + +Figure 1-1 Simplified Troubleshooting Flow + +This simplified model consists of three steps: Key +Topic Step 1. Problem report + +Step 2. Problem diagnosis + +Step 3. Problem resolution + +Of these three steps, most of a troubleshooter’s efforts are spent in the problem diagno-sis step. For example, your child reports that the toaster won’t work. That is the problem report step. You have it clarified further, and your child indicates that the toaster does not get hot. So, you decide to take a look at the toaster and diagnose it. This is the problem diagnosis step, which is broken up into multiple subcomponents. Table 1-2 describes key components of this problem diagnosis step. + + +Table 1-2 Key +Topic Step + + +Steps to Diagnose a Problem + +Description + + + +Collect information + + + + +Examine collected information + + + +Eliminate potential causes + + +Propose an hypothesis + + + + +Verify hypothesis + +Because a typical problem report lacks sufficient information to give a troubleshooter insight into a problem’s underlying cause, the troubleshooter should collect additional information, perhaps using network maintenance tools or by interviewing impacted users. +After collecting sufficient information about a problem, the troubleshooter then examines that information, perhaps comparing the information against previously collected baseline information. +Based on the troubleshooter’s knowledge of the network and his interrogation of collected information, he can begin to eliminate potential causes for the problem. +After the troubleshooter eliminates multiple potential causes for the problem, he is left with one or more causes that are more likely to have resulted in the problem. The troubleshooter hypothesizes what he considers to be the most likely cause of the problem. +The troubleshooter then tests his hypothesis to confirm or refute his theory about the problem’s underlying cause. + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 11 + +After collecting, examining, and eliminating, you hypothesize that the power cable for the toaster is not plugged in. You test your hypothesis, and it is correct. Problem solved. This was a simple example, but even with a toaster, you spent the majority of your time diagnosing the problem. Once you determined that there was no electricity to the toaster, you had to figure out whether it was plugged in. If it was plugged in, you then had to consider whether the wall outlet was damaged, or the circuit breaker was off, or the toast-er was too old and it broke. All of your effort focused on the problem diagnosis step. + +By combining the three main steps with the five substeps, you get the following struc-tured troubleshooting procedure: + +Step 1. +Key +Topic Step 2. + +Step 3. + +Step 4. + +Step 5. + +Step 6. + +Step 7. + + +Problem report + +Collect information + +Examine collected information + +Eliminate potential causes + +Propose an hypothesis + +Verify hypothesis + +Problem resolution + + + +The Value of Structured Troubleshooting + +Troubleshooting skills vary from administrator to administrator, and as mentioned earlier, your skills as a troubleshooter will get better with experience. However, as a trouble-shooter, your primary goal is to be efficient. Being fast comes with experience, but it is not worth much if you are not efficient. To be efficient, you need to follow a structured troubleshooting method. A structured troubleshooting method might look like the approach depicted in Figure 1-2. + +If you do not follow a structured approach, you might find yourself moving around troubleshooting tasks in a fairly random way based on instinct. Although in one instance you might be fast at solving the issue, in the next instance you end up taking an unac-ceptable amount of time. In addition, it can become confusing to remember what you have tried and what you have not. Eventually, you find yourself repeating solutions you have already tried, hoping it works. Also, if another administrator comes to assist you, communicating to that administrator the steps you have already gone through becomes a challenge. Therefore, following a structured troubleshooting approach helps you reduce the possibility of trying the same resolution more than once and inadvertently skipping a task. It also aids in communicating to someone else possibilities that you have already eliminated. + +With experience, you will start to see similar issues. In addition, you should have excep-tional documentation on past network issues and the steps used to solve them. In such instances, spending time methodically examining information and eliminating potential causes might actually be less efficient than immediately hypothesizing a cause after you collect information about the problem and review past documents. This method, illus-trated in Figure 1-3, is often called the shoot from the hip method. + + +From the Library of Outcast Outcast +12 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +(1) Problem Report + + + + +(3) Examine Information + + + + +(5) Propose an Hypothesis + +(2) Collect Information + + + + +(4) Eliminate Potential Causes + + + + +(6) Verify Hypothesis + + + +Problem Solved +No Yes + + + +(7) Problem Resolution + + +Figure 1-2 Example of a Structured Troubleshooting Approach + + + +(1) Problem Report + + + + +(3) Examine Information + + + + +(5) Propose an Hypothesis + +(2) Collect Information + + + + +(4) Eliminate Potential Causes + + + + +(6) Verify Hypothesis + + + +Problem Solved +No Yes + + + +(7) Problem Resolution + + +Figure 1-3 Example of a Shoot from the Hip Troubleshooting Approach + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 13 + +The danger with the shoot from the hip method is that if your instincts are incorrect, and the problem is not solved, you waste valuable time. Therefore, you need to be able to revert back to the structured troubleshooting approach as needed and examine all col-lected information. + +Key A Structured Approach +Topic No single collection of troubleshooting procedures is capable of addressing all conceiv- +able network issues because there are too many variables (for example, user actions). However, having a structured troubleshooting approach helps ensure that the organiza-tion’s troubleshooting efforts are following a similar flow each time an issue arises no matter who is assigned the task. This will allow one troubleshooter to more efficiently take over for or assist another troubleshooter if required. + +This section examines each step in a structured approach in more detail as shown in Figure 1-4. + + + +(1) Problem Report + + + + +(3) Examine Information + + + + +(5) Propose an Hypothesis + +(2) Collect Information + + + + +(4) Eliminate Potential Causes + + + + +(6) Verify Hypothesis + + + +Problem Solved +No Yes + + + +(7) Problem Resolution + + +Figure 1-4 A Structured Troubleshooting Approach + + +1. Problem Report + +A problem report from a user often lacks sufficient detail for you to take that problem report and move on to the next troubleshooting process (that is, collect information). For example, a user might report, “The network is broken.” If you receive such a vague report, you probably need to contact the user and ask him exactly what aspect of the network is not functioning correctly. + + +www.allitebooks.com From the Library of Outcast Outcast +14 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +After your interview with the user, you should be able to construct a more detailed prob-lem report that includes statements such as, when the user does X, she observes Y. For example, “When the user attempts to connect to a website on the Internet, her browser reports a 404 error. However, the user can successfully navigate to websites on her com-pany’s intranet.” Or, “When the user attempts to connect to an FTP site using a web browser, the web browser reports the page can’t be displayed.” + +After you have a clear understanding of the issue, you might need to determine who is responsible for working on the hardware or software associated with that issue. For +example, perhaps your organization has one IT group tasked with managing switches and another IT group charged with managing routers. Therefore, as the initial point of con-tact, you might need to decide whether this issue is one you are authorized to address or if you need to forward the issue to someone else who is authorized. If you are not sure +at this point, start collecting information so that the picture can become clearer, and be mindful that you might have to pass this information on to another member of your IT group at some point, so accurate documentation is important. + +2. Collect Information + +When you are in possession of a clear problem report, the next step is gathering relevant information pertaining to the problem, as shown in Figure 1-5. + + +(1) Problem Report (2) Collect Information + + +Figure 1-5 A Structured Troubleshooting Approach (Collect Information) + +Efficiently and effectively gathering information involves focusing information gathering efforts on appropriate network entities (for example, routers, servers, switches, or clients) from which information should be collected. Otherwise, the troubleshooter could waste time wading through reams of irrelevant data. For example, to be efficient and effective, the troubleshooter needs to understand what is required to access the resources the end user is unable to access. With our FTP site problem report, the FTP resources are acces-sible through an FTP client. Troubleshooters not aware of that might spend hours collect-ing irrelevant data with debug, show, ping, and traceroute commands, when all they had to do was point the user to the FTP client installed on the client’s computer. + +In addition, perhaps a troubleshooter is using a troubleshooting model that follows the path of the affected traffic (as discussed in the “Popular Troubleshooting Methods” sec-tion of this chapter), and information needs to be collected from a network device over which the troubleshooter has no access. At that point, the troubleshooter might need +to work with appropriate personnel who have access to that device. Alternatively, the troubleshooter might switch troubleshooting models. For example, instead of following the traffic’s path, the troubleshooter might swap components or use a bottom-up trouble-shooting model. + + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 15 + +3. Examine Collected Information + +After collecting information about the problem report (for example, collecting output from show or debug commands, performing packet captures, using ping, or traceroute), the next structured troubleshooting step is to analyze the collected information as shown in Figure 1-6. + + +(1) Problem Report (2) Collect Information + + + + +(3) Examine Information + + +Figure 1-6 A Structured Troubleshooting Approach (Examine Information) + +A troubleshooter has two primary goals while examining the collected information: + +■ Identify indicators pointing to the underlying cause of the problem + +■ Find evidence that can be used to eliminate potential causes + +To achieve these two goals, the troubleshooter attempts to find a balance between two questions: + +■ What is occurring on the network? + +■ What should be occurring on the network? + +The delta between the responses to these questions might give the troubleshooter insight into the underlying cause of a reported problem. A challenge, however, is for the trouble-shooter to know what currently should be occurring on the network. + +If the troubleshooter is experienced with the applications and protocols being examined, the troubleshooter might be able to determine what is occurring on the network and how that differs from what should be occurring. However, if the troubleshooter lacks knowl-edge of specific protocol behavior, she still might be able to effectively examine the col-lected information by contrasting that information with baseline data or documentation. + +Baseline data might contain, for example, the output of show and debug commands issued on routers when the network was functioning properly. By contrasting this baseline data with data collected after a problem occurred, even an inexperienced troubleshooter might be able to see the difference between the data sets, thus providing a clue as to the underlying cause of the problem under investigation. This implies that as part of a routine network maintenance plan, baseline data should periodically be collected when the net-work is functioning properly. + +Documentation plays an extremely important role at this point. Accurate and up-to-date documentation can assist a troubleshooter in examining the collected data to determine whether anything has changed in relation to the setup or configuration. Going back to + + + +From the Library of Outcast Outcast +16 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +the FTP example, if the troubleshooter was not aware that an FTP client was required, a quick review of the documentation related to FTP connectivity would indicate so. This would allow the troubleshooter to move on to the next step. + +4. Eliminate Potential Causes + +Following an examination of collected data, a troubleshooter can start to form conclu-sions based on that data. Some conclusions might suggest a potential cause for the prob-lem, whereas other conclusions eliminate certain causes from consideration (see Figure +1-7 ). + + + +(1) Problem Report + + + + +(3) Examine Information + +(2) Collect Information + + + + +(4) Eliminate Potential Causes + + +Figure 1-7 A Structured Troubleshooting Approach (Eliminate Potential Causes) + +It is imperative that you not jump to conclusions at this point. Jumping to conclusions can make you less efficient as a troubleshooter as you start formulating hypotheses based on a small fraction of collected data, which leads to more work and slower overall response times to problems. As an example, a troubleshooter might jump to a conclusion based on the following scenario, which results in wasted time: + +A problem report indicates that PC A cannot communicate with server A, as shown in Figure 1-8. The troubleshooter is using a troubleshooting method that follows the path of traffic through the network. The troubleshooter examines output from the show cdp neighbor command on routers R1 and R2. Because those routers do not recognize each other as Cisco Discovery Protocol (CDP) neighbors, the trouble-shooter leaps to the conclusion that Layer 2 and Layer 1 connectivity is down between R1 and R2. The troubleshooter then runs to the physical routers to verify +physical connectivity, only to see that all is fine. Reviewing further output and docu-mentation indicates that CDP is disabled on R1 and R2 interfaces for security rea-sons. Therefore, the output of show cdp neighbors alone is insufficient to conclude that Layer 2 and 1 connectivity was the problem. + + +OSPF Area 0 + + + + +PC A Switch SW1 + +Router Router Switch Server A R1 R2 SW2 +CDP + + +Figure 1-8 Scenario Topology + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 17 + +On another note, a caution to be observed when drawing conclusions is not to read more into the data than what is actually there. As an example, a troubleshooter might reach a faulty conclusion based on the following scenario: + +A problem report indicates that PC A cannot communicate with server A, as shown in Figure 1-8. The troubleshooter is using a troubleshooting method that follows the path of traffic through the network. The troubleshooter examines output from the show cdp neighbor command on routers R1 and R2. Because those routers recog-nize each other as Cisco Discovery Protocol (CDP) neighbors, the troubleshooter leaps to the conclusion that these two routers see each other as Open Shortest Path First (OSPF) neighbors and have mutually formed OSPF adjacencies. However, the show cdp neighbor output is insufficient to conclude that OSPF adjacencies have been formed between routers R1 and R2. +In addition, if time permits, explaining the rationale for your conclusions to a coworker can often help reveal faulty conclusions. As shown by the previous examples, continuing your troubleshooting efforts based on a faulty conclusion can dramatically increase the time required to resolve a problem. + +5. Propose an Hypothesis + +By eliminating potential causes of a reported problem, as described in the previous process, troubleshooters should be left with one or a few potential causes that they can focus on. At this point, troubleshooters should rank the potential causes from most likely to least likely. Troubleshooters should then focus on the cause they believe is most likely to be the underlying one for the reported problem and propose an hypothesis, as shown in Figure 1-9. + + + +(1) Problem Report + + + + +(3) Examine Information + +(2) Collect Information + + + + +(4) Eliminate Potential Causes + + + + +(5) Propose an Hypothesis + + +Figure 1-9 A Structured Troubleshooting Approach (Propose an Hypothesis) + +After proposing an hypothesis, troubleshooters might realize that they are not authorized to access a network device that needs to be accessed to resolve the problem report. In such a situation, a troubleshooter needs to assess whether the problem can wait until authorized personnel have an opportunity to resolve the issue. If the problem is urgent and no authorized administrator is currently available, the troubleshooter might attempt + + + +From the Library of Outcast Outcast +18 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +to at least alleviate the symptoms of the problem by creating a temporary workaround. Although this approach does not solve the underlying cause, it might help business oper-ations continue until the main cause of the problem can be appropriately addressed. + +6. Verify Hypothesis + +After troubleshooters propose what they believe to be the most likely cause of a prob-lem, they need to develop a plan to address the suspected cause and implement it. Alternatively, if troubleshooters decide to implement a workaround, they need to come up with a plan and implement it while noting that a permanent solution is still needed. However, implementing a plan that resolves a network issue often causes temporary net-work outages for other users or services. Therefore, the troubleshooter must balance the urgency of the problem with the potential overall loss of productivity, which ultimately affects the financial bottom line. There should be a change management procedure in place that helps the troubleshooter determine the most appropriate time to make changes to the production network and the steps required to do so. If the impact on workflow outweighs the urgency of the problem, the troubleshooter might wait until after business hours to execute the plan. + +A key (and you should make it mandatory) component in implementing a problem solu-tion is to have the steps documented. Not only does a documented list of steps help ensure the troubleshooter does not skip any, but such a document can serve as a rollback plan if the implemented solution fails to resolve the problem. Therefore, if the problem +is not resolved after the troubleshooter implements the plan, or if the execution of the plan resulted in one or more additional problems, the troubleshooter should execute the rollback plan. After the network is returned to its previous state (that is, the state prior to deploying the proposed solution); the troubleshooter can then reevaluate her hypothesis. + +Although the troubleshooter might have successfully identified the underlying cause, perhaps the solution failed to resolve that cause. In that case, the troubleshooter could create a different plan to address that cause. Alternatively, if the troubleshooter had iden-tified other causes and ranked them during the propose an hypothesis step, she can focus her attention on the next most likely cause and create an action plan to resolve that cause and implement it. + +This process can be repeated until the troubleshooter has exhausted the list of potential causes or is unable to collect information that can point to other causes, as shown in Figure 1-10. At that point, a troubleshooter might need to gather additional information or enlist the aid of a coworker or the Cisco Technical Assistance Center (TAC). + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 19 + + + +(1) Problem Report + + + + +(3) Examine Information + + + + +(5) Propose an Hypothesis + +(2) Collect Information + + + + +(4) Eliminate Potential Causes + + + + +(6) Verify Hypothesis + + + +Problem Solved +No Yes + +Figure 1-10 A Structured Troubleshooting Approach (Verify Hypothesis) + + +7. Problem Resolution + +This is the final step of the structured approach, as shown in Figure 1-11. Although this +is one of the most important steps, it is often forgotten or overlooked. After the reported problem is resolved, the troubleshooter should make sure that the solution becomes a documented part of the network. This implies that routine network maintenance will maintain the implemented solution. For example, if the solution involves reconfiguring a Cisco IOS router, a backup of that new configuration should be made part of routine net-work maintenance practices. + +As a final task, the troubleshooter should report the problem resolution to the appropri-ate party or parties. Beyond simply notifying a user that a problem has been resolved, the troubleshooter should get user confirmation that the observed symptoms are now gone. This task confirms that the troubleshooter resolved the specific issue reported in the problem report, rather than a tangential issue. + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +20 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +(1) Problem Report + + + + +(3) Examine Information + + + + +(5) Propose an Hypothesis + +(2) Collect Information + + + + +(4) Eliminate Potential Causes + + + + +(6) Verify Hypothesis + + + +Problem Solved +No Yes + + + +(7) Problem Resolution + + +Figure 1-11 A Structured Troubleshooting Approach (Problem Resolution) + + +Popular Troubleshooting Methods + +As shown in the structured approach, the elimination of potential causes is a key step. You can use several common troubleshooting methods to narrow the field of potential causes: + +■ The top-down method +Key +Topic ■ The bottom-up method + +■ The divide-and-conquer method + +■ Following the traffic path + +■ Comparing configurations + +■ Component Swapping + +This section defines each of these methods in greater detail. However, keep in mind that there is no single best method. Depending on your situation and the issue you are trou-bleshooting, you may use one or multiple methods. + + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 21 + +The Top-Down Method + +The top-down troubleshooting method begins at the top layer of the Open Systems Interconnection (OSI) seven-layer model, as shown in Figure 1-12. The top layer is num-bered Layer 7 and is named the application layer. + +The top-down method first checks the application residing at the application layer and moves down from there. The theory is, when the troubleshooter encounters a layer that is functioning, the assumption can be made that all lower layers are also functioning. For example, if you can ping a remote IP address, because ping uses Internet Control Message Protocol (ICMP), which is a Layer 3 protocol, you can assume that Layers 1–3 are functioning properly. Otherwise, your ping would have failed. A potential downside +to this approach is that the troubleshooter needs access to the specific application experi-encing a problem to test Layer 7. + + +Layer 7: Application + +Layer 6: Presentation + +Layer 5: Session + +Layer 4: Transport + +Layer 3: Network + +Layer 2: Data Link + +Layer 1: Physical + +Figure 1-12 Top-Down Troubleshooting Method + + +The Bottom-Up Method + +The reciprocal of the top-down method is the bottom-up method, as illustrated in Figure 1-13. The bottom-up method seeks to narrow the field of potential causes by eliminating OSI layers beginning at Layer 1, the physical layer. + +Although this is a highly effective method, the bottom-up approach might not be effi-cient in larger networks because of the time required to fully test lower layers of the OSI model. Therefore, the bottom-up method is often used after employing some other method to narrow the scope of the problem. + + + + + + + + +From the Library of Outcast Outcast +22 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Layer 7: Application + +Layer 6: Presentation + +Layer 5: Session + +Layer 4: Transport + +Layer 3: Network + +Layer 2: Data Link + +Layer 1: Physical + +Figure 1-13 Bottom-Up Troubleshooting Method + +The Divide-and-Conquer Method + +After analyzing the information collected for a problem, you might not see a clear indi-cation as to whether the top-down or bottom-up approach would be most effective. In such a situation, you might select the divide-and-conquer approach, which begins in the middle of the OSI stack, as shown in Figure 1-14. + + +Layer 7: Application + +Layer 6: Presentation + +Layer 5: Session + +Layer 4: Transport +ping 10.1.2.3 Layer 3: Network + +Layer 2: Data Link + +Layer 1: Physical + +Figure 1-14 Divide-and-Conquer Troubleshooting Method + +In Figure 1-14, the network administrator issued the ping 10.1.2.3 command. If the result was successful, the administrator could conclude that Layers 1–3 were operational, and a bottom-up approach could begin from that point. However, if the ping failed, the admin-istrator could begin a top-down approach at Layer 3. + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 23 + +The Following the Traffic Path Method + +Another useful troubleshooting approach is to follow the path of the traffic experiencing a problem. For example, if the client depicted in Figure 1-15 is unable to reach its server, you could first check the link between the client and switch SW1. If everything looks good on that link, you could then check the connection between the switch SW1 and router R1. Next, you would check the link between router R1 and switch SW2, and finally the link between switch SW2 and the server. + + +Step 1 Step 2 Step 3 Step 4 + + + + + +Client Switch SW1 + +Router Switch Server R1 SW2 + + +Figure 1-15 Following the Traffic Path Troubleshooting Method + + +The Comparing Configurations Method + +Did you ever find yourself looking through a Highlights magazine as a child? This maga-zine often featured two similar pictures, and you were asked to spot the differences. This childhood skill can also prove valuable when troubleshooting some network issues. For example, imagine that you have multiple remote offices, each running the same model +of Cisco router. Clients at one of those remote offices cannot obtain an IP address via Dynamic Host Configuration Protocol (DHCP). One troubleshooting approach is to compare that site’s router configuration with the router configuration of another remote site that is working properly. You can also look at the configuration stored in a document (Word, Notepad) to see whether it is the same. This methodology is often an appropri- +ate approach for a less-experienced troubleshooter not well versed in the specifics of the network. However, the problem might be resolved without a thorough understanding of what caused the problem. Therefore, the problem is more likely to recur. In addition, what if the documentation is outdated? Now, in addition to the original issue, there are addi-tional issues introduced based on an invalid configuration. + +Can you spot the difference in the outputs of Example 1-1a and Example 1-1b? + +Example 1-1a show run + +R1#show run +...OUTPUT OMITTED... +ip dhcp excluded-address 10.8.8.1 10.8.8.10 +! +ip dhcp pool POOL-A +network 10.8.8.0 255.255.255.0 +default-router 10.8.8.11 + + + + +www.allitebooks.com From the Library of Outcast Outcast +24 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +dns-server 192.168.1.1 +netbios-name-server 192.168.1.2 +...OUTPUT OMITTED... + + +Example 1-1b more tftp://10.1.1.10/R1.cfg + +R1#more tftp://10.1.1.10/R1.cfg +...OUTPUT OMITTED... +ip dhcp excluded-address 10.8.8.1 10.8.8.10 +! +ip dhcp pool POOL-A +network 10.8.8.0 255.255.255.0 +default-router 10.8.8.1 +dns-server 192.168.1.1 +netbios-name-server 192.168.1.2 +...OUTPUT OMITTED... + +In Example 1-1a , show run is displaying the current running configuration. Example +1-1b has the more tftp://10.1.1.10/R1.cfg output displaying the archived configuration that was produced as a baseline and stored on a TFTP server. The default router has been changed from 10.8.8.1 to 10.8.8.11. + +The Component Swapping Method + +Yet another approach to narrowing the field of potential causes of a problem is to physi-cally swap out components. If a problem’s symptoms disappear after swapping out a particular component (for example, a cable or a switch), you can conclude that the old component was faulty (either in its hardware or its configuration). + +As an example, consider Figure 1-16. A problem report states that the connection between laptop A and switch SW1 is not bringing up a link light on either the laptop or the switch. + +As a first step, you might swap out the cable interconnecting these two devices with a known working cable. + +If the problem persists, you will want to undo the change you made and then move the cable from switchport 1 to switchport 2. As a next step, you could connect a different laptop to switch SW1. If the problem goes away, you could conclude that the issue is with laptop A. However, if the problem continues, you could swap out switch SW1 with another switch (SW2 in this example). As you test each component and find it is not the problem, undo the change. + +Although swapping out components in this fashion might not provide great insight into the specific problem, it could help focus your troubleshooting efforts. For example, if swapping out the switch resolved the issue, you could start to investigate the configura-tion of the original switch, checking for configuration or hardware issues. + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 25 + + + + + +Laptop A + + + +Laptop A + + + +Laptop B + + +Swap Cable + + + +Swap Switch Port + + + +Swap Laptop + +Port 1 + +Switch SW1 + +Port 2 + +Switch SW1 + +Port 1 + +Switch SW1 + + +Port 1 + + +Laptop A + +Figure 1-16 + +Swap Switch +Switch SW2 + +Component Swapping + + + +Practice Exercise: Selecting a Troubleshooting Approach + +As a troubleshooter, you might use one of the previously discussed troubleshooting methods or perhaps a combination of methods to eliminate causes. To illustrate how you might select an appropriate troubleshooting approach, consider the following problem report: + +A computer lab at a university contains 48 PCs. Currently, 24 of the PCs cannot access the Internet; the other 24 PCs can. The 24 PCs that cannot currently access the Internet were able to access the Internet yesterday. +Consider which of the previously discussed troubleshooting models might be appropriate for an issue such as the one reported. After you reach your own conclusions about which method or methods would be most appropriate, consider the following rationale: + +■ Top-down: Because the application is working on some PCs in the same location, starting at the application layer will probably not be effective. Although it is possible that 24 of the PCs have some setting in their Internet browser (for example, a proxy configuration) that prevents them from accessing the Internet, these PCs were work-ing yesterday. Therefore, it is unlikely that these 24 PCs were all recently reconfig-ured with an incorrect application configuration. + +■ Bottom-up: Based on the symptom reported, it is reasonable to guess that there might be an issue with an Ethernet switch (perhaps with a port density of 24). Therefore, a bottom-up approach stands a good chance of isolating the problem quickly. + +■ Divide-and-conquer: The problem seems to be related to a block of PCs, and the problem is probably not application related. Therefore, a divide-and-conquer +approach could be useful. Starting at Layer 3 (that is, the network layer), you could + + + + +From the Library of Outcast Outcast +26 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +issue a series of pings to determine whether a next-hop gateway is reachable. If the next-hop gateway is not reachable, you could start to troubleshoot Layer 2, checking the Cisco Catalyst switch to which these 24 PCs are attached. + +■ Following the traffic path: The symptom seems to indicate that these 24 PCs might share a common switch. Therefore, following the traffic path to the other end of the cabling (that is, to a switch) could prove useful. Perhaps the switch has lost power resulting in this connectivity issue for the 24 PCs. + +■ Comparing configurations: If a previous troubleshooting method (for example, bottom-up, divide-and-conquer, or following the traffic path) reveals that the 24 PCs that are not working are connected to one Cisco Catalyst switch, and the 24 PCs that are working are connected to another Cisco Catalyst switch, comparing the configu-ration of those two switches could prove helpful. + +■ Component swapping: Because the 24 PCs are experiencing the same problem with-in a short time frame (since yesterday), it is unlikely that swapping cables would be useful. However, if these 24 PCs connect to the same Cisco Catalyst switch, swap-ping out the switch could help isolate the problem. + +As you can see from the analysis of the different methods, each has the possibility of providing valuable information that will help you solve this issue. Therefore, you will not usually rely on just one method while you are troubleshooting. You will combine the dif-ferent methods to produce the most accurate picture possible. + +Introduction to Network Maintenance + +Network maintenance is an inherent component of a network administrator’s responsi-bilities. However, that network administrator might be performing maintenance tasks in response to a reported problem. This reactive approach is unavoidable, because unfore-seen issues do arise. However, the occurrence of these interrupt-driven maintenance tasks can be reduced by proactively performing regularly scheduled maintenance tasks. + +You could think of regularly scheduled tasks, such as performing backups and software upgrades, as important but not urgent. Spending more time on the important tasks can help reduce time spent on the urgent tasks (for example, responding to user connectivity issues or troubleshooting a network outage). + +This section begins by identifying several common network maintenance tasks that are seen in most organizations. It introduces us to standard network maintenance models; however, these off-the-shelf models might not be a perfect fit for the organization. So, this section discusses how to adapt a well-known model to individual needs. It concludes by discussing several procedures that are a must for maintenance success. + +Defining Network Maintenance + +Network maintenance, at its essence, is doing whatever is required to keep the network functioning and meeting the business needs of an organization. Therefore, you need to analyze the business needs of the organization and determine which maintenance tasks + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 27 + +are necessary for the success of the business. Time and money need to be spent wisely, and critical business processes need more attention. For example, are you going to back up each PC in the company on a nightly basis or are you going to have all users store resources on a central server and back up the central server? + +Some examples of the tasks that fall under the umbrella of network maintenance are as follows: + +■ Hardware and software installation and configuration +Key +Topic ■ Troubleshooting problem reports + +■ Monitoring and tuning network performance + +■ Planning for network expansion + +■ Documenting the network and any changes made to the network + +■ Ensuring compliance with legal regulations and corporate policies + +■ Securing the network against internal and external threats + +■ Backing up files and databases + +Obviously, this listing is only a sampling of network maintenance tasks. Also, keep in mind that the list of tasks required to maintain your network could differ significantly from the list of tasks required to maintain another network. You need to align your main-tenance tasks with your business needs. + +Proactive Versus Reactive Network Maintenance + +Network maintenance tasks can be categorized as one of the following: + +■ Interrupt-driven tasks: Involve resolving issues as they are reported + +■ Structured tasks: Performed as a predefined plan + +Interrupt-driven tasks are not planned. They result from something happening in the network that requires your attention. It may be your immediate attention, or it may be something you can put off until later. Interrupt-driven tasks can never be completely eliminated; however, you can significantly reduce their occurrence when you have a stra-tegic structured approach in place. + +Implementing a structured maintenance approach confers many benefits. It reduces total network downtime because you are aware of problems and fix them before they become a major issue. It is more cost-effective because fewer major problems occur, resulting in less resources being consumed for problem resolution. If you do have an unplanned net-work outage (interrupt-driven), you can resolve it more quickly because a predefined plan is in place to handle that type of outage. In addition, you will also know which tools are required and how to use them to solve the problem. A structured maintenance approach also includes planning for future network capacity; therefore, appropriate hardware and software purchases can be made early on, reducing obsolescence of relatively new pur-chases. + + +From the Library of Outcast Outcast +28 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +A structured approach also takes into consideration underlying business goals. Therefore, resources can be allocated that complement business drivers. Security vulnerabilities are more likely to be discovered through ongoing network monitoring, which is another com-ponent of a structured maintenance approach, as discussed later in this chapter. + +Well-Known Network Maintenance Models + +The subtleties of each network should be considered when constructing a structured net-work maintenance model. However, rather than starting from scratch, you might want to base your maintenance model on one of the well-known maintenance models and make adjustments as appropriate. + +The following is a sampling of some of the more well-known maintenance models: +Key +Topic ■ FCAPS: FCAPS (which stands for fault management, configuration management, +accounting management, performance management, and security management) is a network maintenance model defined by the International Organization for Standardization (ISO). + +■ ITIL: IT Infrastructure Library (ITIL) defines a collection of best practice recommen-dations that work together to meet IT business management goals. + +■ Cisco Lifecycle Services: The Cisco Lifecycle Services maintenance model defines distinct phases in the life of a Cisco technology in a network. These phases are pre-pare, plan, design, implement, operate, and optimize. As a result, the Cisco Lifecycle Services model is often referred to as the PPDIOO model. + + +Example of Adapting a Network Maintenance Model + +The maintenance model you use in your network should reflect business drivers, resourc-es, and expertise unique to your network. Once you choose the model, you must adapt the model to your environment. Suppose, for example, that you have selected the ISO FCAPS model as the foundation for your maintenance model. To adapt the FCAPS model for your environment, you should identify specific tasks to perform on your network for each element of the FCAPS model. Table 1-3 provides a sampling of tasks that might be categorized under each of the FCAPS management areas. + +Table 1-3 FCAPS Management Tasks + + +Type of Management +Fault management + + + +Configuration management + +Examples of Management Tasks +Use network management software to collect information from routers and switches. Send an e-mail alert when processor utilization or bandwidth utilization exceeds a threshold of 80 +percent. Respond to incoming trouble tickets from the help desk. + +Require logging of any changes made to network hardware or software configurations. Implement a change management +system to alert relevant personnel of planned network changes. + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 29 + + + +Type of Management Accounting management + + +Performance management + + + +Security management + +Examples of Management Tasks +Invoice IP telephony users for their long-distance and international calls. Keeping track of what is being done on the network and when it is being done. +Monitor network performance metrics for both LAN and WAN links. Deploy appropriate quality of service (QoS) solutions +to make the most efficient use of relatively limited WAN bandwidth, while prioritizing mission-critical traffic. +Deploy firewall, virtual private network (VPN), and intrusion prevention system (IPS) technologies to defend against malicious traffic. Create a security policy dictating rules of acceptable network use. Use an authorization, authentication, and accounting (AAA) server to validate user credentials, assign appropriate user privileges, and log user activity. + + + +By clearly outlining a maintenance methodology and defining actionable and measurable processes you can reduce network downtime and more effectively perform interrupt-driven tasks. + +Common Maintenance Procedures + +No two network maintenance models will be exactly the same, and no two organizations will implement them in exactly the same way, because of the different business drivers involved. However, there are tasks common to nearly all network maintenance models that will be implemented by all organizations regardless of the business drivers. This sec-tion discusses common maintenance tasks that all organizations should be performing. + +Routine Maintenance Tasks + +Regardless of the organization, there will be maintenance tasks in each organization that occur routinely. This routine can be hourly, daily, weekly, monthly, per quarter, or per year. As you can see, the routine can be frequent or infrequent, but it can also be regular or irregular. For example, adding users or moving users and updating the network based on the user changes is going to be different each time. We cannot have a regular schedule for these types of tasks because they are infrequent and irregular. However, backing up a server on a daily basis at 10:00 p.m. is frequent and regular. + +The key with all these tasks is that they are routine regardless of them being frequent, infrequent, regular, or irregular and should be present in a listing of procedures contained in a network maintenance model. Following is a listing of such common maintenance tasks: + +■ Configuration changes: Businesses are dynamic environments, where relocation of users from one office space to another, the addition of temporary staffers, and new hires are commonplace. In response to organizational changes, network administra- + + + +From the Library of Outcast Outcast +30 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +tors need to respond by performing appropriate reconfigurations and additions to network hardware and software. These processes are often referred to as moves, adds, and changes. + +■ Replacement of older or failed hardware: As devices age, their reliability and com-parable performance tend to deteriorate. Therefore, a common task is the replace-ment of older hardware, typically with better performing and more feature-rich devices. Occasionally, production devices fail, thus requiring immediate replacement. + +■ Scheduled backups: Recovery from a major system failure can occur much quicker if network data and device configurations have been regularly backed up. Therefore, a common network maintenance task is to schedule, monitor, and verify backups of selected data and configuration information. These backups can also be useful in recovering important data that was deleted. + +■ Updating software: Updates to operating system software (for servers, clients, and even network devices) are periodically released. The updates often address perfor-mance issues and security vulnerabilities. New features are also commonly offered in software upgrades. Therefore, performing routine software updates becomes a key network maintenance task. + +■ Monitoring network performance: The collection and interpretation of traffic sta-tistics, bandwidth utilization statistics, and resource utilization statistics for network devices are common goals of network monitoring. Through effective network moni-toring (which might involve the collection and examination of log files or the imple-mentation of a high-end network management server), you can better plan for future expansion (that is, capacity planning), anticipate potential issues before they arise, and better understand the nature of the traffic flowing through your network. + + +Scheduled Maintenance + +Take a moment and define the network maintenance tasks for your network. After doing so, rank them in order of priority. Some tasks will undoubtedly be urgent in nature and need a quick response when things go wrong (for example, replacing a failed router that connects the business to the Internet). Other tasks can be scheduled. For example, you might schedule weekly full backups of your network’s file servers, and you might have a monthly maintenance window, during which time you apply software patches. + +By having such a schedule for routine maintenance tasks, network administrators are less likely to forget an important task, because they were busy responding to urgent tasks. Also, users can be made aware of when various network services will be unavailable, due to maintenance windows, thus minimizing the impact on workflow. + +Managing Network Changes + +Making changes to a network often has the side effect of impacting the productivity of users relying on network resources. In addition, a change to one network component might create a problem for another network component. For example, perhaps a firewall + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 31 + +was installed to provide better security for a server farm. However, in addition to com-mon protocols that were allowed to pass through the firewall (for example, DNS, SMTP, POP3, HTTP, HTTPS, and IMAP), one of the servers in the server farm acted as an FTP server, and the firewall configuration did not consider that server. Therefore, the installa-tion of a firewall to better secure a server farm resulted in a troubleshooting issue, where users could no longer reach their FTP server. + +The timing of network changes should also be considered. Rather than taking a router down to upgrade its version of Cisco IOS during regular business hours, such an opera-tion should probably be performed during off hours. + +Making different organization areas aware of upcoming maintenance operations can also aid in reducing unforeseen problems associated with routine maintenance. For example, suppose that one information technology (IT) department within an organization is responsible for maintaining WAN connections that interconnect various corporate offic-es, whereas another IT department is charged with performing network backups. If the WAN IT department plans to upgrade the WAN link between a couple of offices at 2:00 a.m. next Tuesday, the IT department in charge of backups should be made aware of that planned upgrade, because a backup of remote data (that is, data accessible over the WAN link to be upgraded) might be scheduled for that same time period. + +Some organizations have a formalized change management process, where one depart-ment announces online their intention to perform a particular maintenance task during a specified time period. Other departments are then notified of this upcoming change, and determine whether the planned change will conflict with that department’s operations. If a conflict is identified, the departments can work together to accommodate one another’s needs. + +Of course, some network maintenance tasks are urgent (for example, a widespread net-work outage). Those tasks need timely responses, without going through a formalized change management notification process and allowing time for other departments to respond. + +When defining a change management system for your organization, consider the following: + +■ Who is responsible for authorizing various types of network changes? Key +Topic ■ Which tasks should only be performed during scheduled maintenance windows? + +■ What procedures should be followed prior to making a change (for example, backing up a router’s configuration prior to installing a new module in the router)? + +■ What measurable criteria determine the success or failure of a network change? + +■ How will a network change be documented, and who is responsible for the docu-mentation? + +■ How will a rollback plan be created, such that a configuration can be restored to its previous state if the changes resulted in unexpected problems? + +■ Under what circumstances can formalized change management policies be overrid-den, and what (if any) authorization is required for an override? + + + +From the Library of Outcast Outcast +32 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Maintaining Network Documentation + +Network documentation typically gets created as part of a network’s initial design and installation. However, keeping that documentation current, reflecting all changes made since the network’s installation, should be part of any network maintenance model. Keeping documentation current helps more effectively isolate problems when trouble-shooting. In addition, accurate documentation can prove to be valuable to designers who want to scale the network. + +At a basic level, network documentation could consist of physical and logical network diagrams, in addition to a listing of network components and their configurations. However, network documentation can be much more detailed, including such compo-nents as formalized change management procedures, a listing of contact information (for example, for service providers and points of contact in an organization’s various IT groups), and the rationale for each network change made. + +While the specific components in a set of network documentation can vary, just as the procedures in a network maintenance model vary, the following list outlines common ele-ments found in a set of network documentation: + + +Key ■ Topic + + + +■ + + + + +■ + + + + +■ + + + + +■ + +Logical topology diagram: A logical topology diagram shows the interconnection of network segments, the protocols used, and how end users interface with the net-work, deployed VLANs, and IP addressing, to name a few. However, this diagram is not concerned with the physical locations of network components. + +Physical topology diagram: Unlike a logical topology diagram, a physical topology diagram shows how different geographical areas (for example, floors within a build-ing, buildings, or entire sites) interconnect. The diagram reflects where various net-work components are physically located. + +Listing of interconnections: A listing of interconnections could be, for example, a spreadsheet that lists which ports on which devices are used to interconnect network components or connect out to service provider networks. Circuit IDs for service pro-vider circuits might be included in this documentation. + +Inventory of network equipment: An inventory of network equipment would include such information as the equipment’s manufacturer, model number, version of software, and modules installed, in addition to information about the licensing of the software, serial number, and an organization’s asset tag number. + +IP address assignments: An organization might use private IP address space internal-ly and use Network Address Translation (NAT) to translate those private IP address space numbers into publicly routable IP addresses. Alternatively, an organization might have public IP addresses assigned to some or all of their internal devices. A classful IP address space (either public or private) might be subdivided within an organization, resulting in subnets with a nondefault subnet mask. For IPv6 the orga-nization might be manually assigning the interface ID to each device, using EUI-64, or a combination of both. These types of IP addressing specifications would be +included in a set of network documentation. + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 33 + +■ Configuration information: When a configuration change is made, the current con-figuration should be backed up. With a copy of current configuration information, a device could be replaced quicker, in the event of an outage. Beyond having a backup of current configuration information, some network administrators also maintain archival copies of previous configurations. These older configurations could prove useful when attempting to roll back to a previous configuration state or when trying to duplicate a previous configuration in a new location. It is a good practice to name archival copies of previous configurations based on a certain format that makes sense to you. For example, some companies name their archival copies by date, oth-ers by function, and still others by a combination of both. + +■ Original design documents: Documents created during the initial design of a net-work might provide insight into why certain design decisions were made and how the original designers envisioned future network expansion. + +Larger network environments often benefit from having step-by-step guidelines for troubleshooting a given network issue. Such a structured approach to troubleshooting helps ensure that all troubleshooting personnel use a common approach. Although a net-work issue might be successfully resolved through various means, if different personnel troubleshoot using different approaches, at some point those approaches might conflict with one another, resulting in further issues. + +For example, consider one network administrator that configures IEEE 802.1Q trunk-ing on Cisco Catalyst switches by disabling Dynamic Trunking Protocol (DTP) frames +and forcing a port to act as a trunk port. Another network administrator within the same company configures 802.1Q trunking by setting a port’s trunk state to desirable, which creates a trunk connection only if it receives a DTP frame from the far end of the connec-tion. These two approaches are not compatible, and if each of these two network admin-istrators configured different ends of what they intended to be an 802.1Q trunk, the trunk connection would never come up. This example illustrates the criticality of having clear communication among IT personnel and a set of standardized procedures to ensure consistency in network configuration and troubleshooting practices. + +Restoring Operations After a Failure + +Although most modern network hardware is very reliable, failures do occur from time to time. Aside from hardware failures, environmental factors could cause a network outage. As a few examples, the failure of an air conditioner unit could cause network equipment to overheat, water leakage due to flooding or plumbing issues could cause hardware fail-ures, and a fire could render the network equipment unusable. + +Planning and provisioning hardware and software for such outages before they occur can accelerate recovery time. To efficiently replace a failed (or damaged) device, you should be in possession or have the ability to acquire relatively quickly the following: + +■ Duplicate hardware: The hardware can be stored locally or it can be attainable through a supplier that can get you the device within a certain time based on a ser-vice level agreement (SLA). + + + +www.allitebooks.com From the Library of Outcast Outcast +34 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Operating system and application software (along with any applicable licensing) for the device: Although you can get this from the manufacturer (such as Cisco), it is advisable to have an exact copy of the operating systems and application software stored locally for each device you are using in the organization. + +■ Backup of device configuration information: When a failure happens, you need to restore your device to its last known good configuration. It is ideal to have a backup of the configuration files on a server in the organization. However, if that is not pos-sible, at a minimum have the configurations documented in Notepad somewhere. You do not want to be caught in a situation where you have no information related to the configuration of a device being restored. + + +Measuring Network Performance + +Network monitoring is a proactive approach to network maintenance, enabling you to be alerted to trends and utilization statistics (as a couple of examples). These statistics can forecast future issues, allowing you to be proactive and fix problems before they affect network users. Also, if you work for a service provider, network performance monitoring can ensure that you are providing an appropriate service level to a customer. Conversely, if you are a customer of a service provider, network monitoring can confirm that the ser-vice provider is conforming to the SLA for which you are paying. + +The Troubleshooting and Network Maintenance Relationship + +A structured troubleshooting approach provides step-by-step processes that offer a repeatable consistent plan that makes the troubleshooter more efficient and effective. During our coverage of the structured approach you might have noticed that documen-tation, baselines, change control, and communication were mentioned. All of these are fundamental assets to your success as a troubleshooter. However, they do not simply appear from the ether, as you have seen from the discussion of network maintenance. For example, documentation and baselines are created at a specific point in time for a device and provide a snapshot of the health and configuration of that device at that point. As +a result, we will heavily rely on these resources when issues occur. What happens if someone neglects to update the documentation or baselines based on changes that may have occurred during scheduled maintenance or some past issue? What happens if we have difficulty communicating with others or they withhold information from us? These assets become liabilities as they are unable to address the question: What should be occurring in the network? + +As you have seen, network maintenance tasks often include troubleshooting tasks, and vice versa. For example, when installing a new network component as part of ongoing network maintenance, an installer is often required to troubleshoot the installation until the new network component is functioning properly. Also, when troubleshooting a network issue, the troubleshooter might use network documentation (for example, a physical topology diagram created as part of a network maintenance task) to help isolate a problem. + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 35 + +This interrelationship between maintenance and troubleshooting suggests that the effec-tiveness of your troubleshooting efforts is influenced by the effectiveness of your routine network management tasks. Because these tasks are so interrelated, you might want to take proactive measures to ensure your structured maintenance and troubleshooting processes complement one another. For example, both network troubleshooting and maintenance include a documentation component. Therefore, the value of a centralized repository of documentation increases as a result of its use for both maintenance and troubleshooting efforts. + +Maintaining Current Network Documentation + +A set of maintained network documentation can dramatically improve the efficiency of troubleshooting efforts. For example, if a troubleshooter is following the path that spe-cific traffic takes through a network, physical and logical topology diagrams could help identify the next network component to check. + +A danger with relying on documentation is that if the documentation is dated (not main-tained), troubleshooters could be led down an incorrect path because of their reliance on that documentation. Such a scenario is often worse than not having documentation at all, because in the absence of documentation, troubleshooters are not led down the wrong path during the troubleshooting process; they have to create their own path. + +Although few argue with the criticality of maintaining current documentation, docu-menting troubleshooting efforts, in practice, often falls by the wayside. The lack of follow-through when it comes to documenting what happened during a troubleshooting scenario is understandable. The troubleshooter’s focus is on resolving a reported issue in a timely manner (that is, an urgent task) rather than documenting what they are doing at the time (that is, an important task). Following are a few suggestions to help troubleshooters keep in mind the need to document their steps: + + +■ Key +Topic + + + + + +■ + + + +■ + +Require documentation: By making documentation a component in the trouble-shooting flow, troubleshooters know that before a problem report or a trouble ticket can be closed out, they must generate appropriate documentation. This knowledge often motivates troubleshooters to perform some level of documentation (for exam-ple, scribbling notes on the back of a piece of paper) as they are performing their tasks, as opposed to later trying to recall what they did from memory, thus increas-ing the accuracy of the documentation. + +Schedule documentation checks: A structured maintenance plan could include a component that routinely requires verification of network documentation and when it was last updated based on timestamps. + +Automate documentation: Because manual checks of documentation might not be feasible in larger environments, automated processes could be used to, for example, compare current and backup copies of device configurations. Any difference in the configurations indicates that someone failed to update the backup configuration of a device after making a configuration change to that device. To assist with the auto-mation of backups, Cisco IOS offers the Configuration Replace and Configuration +Rollback feature and the Embedded Event Manager. + + + + +From the Library of Outcast Outcast +36 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + + + + + + + +Key Topic + +Establishing a Baseline + +As previously mentioned, troubleshooting involves knowing what should be happening on the network, observing what is currently happening on the network, and determining the difference between the two. To determine what should be happening on the network, a baseline of network performance should be measured as part of a routine maintenance procedure and updated on a regular basis. + +For example, a routine network maintenance procedure might require that a show processes cpu command be periodically issued on all routers in a network, with the out-put logged and archived. As shown in Example 1-2, the show processes cpu command demonstrates the 5-second, 1-minute, and 5-minute CPU utilization averages. When troubleshooting a performance problem on a router, you could issue this command to determine how a router is currently operating. However, without a baseline as a reference before troubleshooting, you might not be able to draw a meaningful conclusion based on +the command output. + + +Example 1-2 Monitoring Router CPU Utilization + +R1# show processes cpu +cpu utilization for five seconds: 18%/18%; one minute: 22%; five minutes: 22% +PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY process + +1 0 1 +2 4 167 +3 821 188 +4 4 1 +5 43026 2180 + +0 0.00% 0.00% 0.00% +23 0.00% 0.00% 0.00% +4367 0.00% 0.13% 0.14% +4000 0.00% 0.13% 0.00% +19736 0.00% 4.09% 4.03% + +0 chunk Manager +0 Load Meter +0 Exec +0 EDDRI_MAIN +0 Check heaps + +...OUTPUT OMITTED... + + +Communication + +Each of the troubleshooting steps outlined in the structured approach requires clear com-munication. Table 1-4 describes how communication plays a role in each troubleshooting phase. + +Table 1-4 Importance of Clear Communication During Troubleshooting + + +Troubleshooting Steps +Problem report + + + +Collect information + +The Role of Communication +When a user reports a problem, clear communication with that user helps define the problem. For example, the user can be asked exactly what is not working correctly, if she made any recent changes, and when the problem started. +Some information collected might come from other parties (for example, a service provider). Clearly communicating with those other parties helps ensure collection of the proper data. + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 37 + + + +Troubleshooting Steps Examine collected information + + +Eliminate potential causes + + +Propose an Hypothesis + + + +Verify hypothesis + + + +Problem resolution + +The Role of Communication +Because a troubleshooter is often not fully aware of all aspects of a network, collaboration with other IT personnel is often necessary. +The elimination of potential causes might involve consultation with others. This consultation could provide insight leading to the elimination of a potential cause. +The consultation a troubleshooter conducts with other IT personnel when eliminating potential causes might also help the troubleshooter more accurately hypothesize a problem’s underlying cause. +Temporary network interruptions often occur when verifying an hypothesis; therefore, the nature and reason for an interruption should be communicated to the users impacted. +After a problem is resolved, the user originally reporting the problem should be informed, and the user should confirm that the problem has truly been resolved. + + + +Also, depending on the severity of an issue, multiple network administrators could be involved in troubleshooting a problem. Because these troubleshooters might be focused on different tasks at different times, it is possible that no single administrator can report on the overall status of the problem. Therefore, when managing a major outage, those involved in troubleshooting the outage should divert user inquiries to a manager who is in frequent contact with the troubleshooting personnel. As a side benefit, being able to quickly divert user requests for status reports to a manager helps minimize interruptions from users. + +Change Management + +Managing when changes can be made and by whose authority helps minimize network downtime. In fact, these two factors (that is, when a change is allowed and who can authorize it) are the distinguishing factors between making a change as part of a routine maintenance plan and making a change as part of a troubleshooting process. + +The process of change management includes using policies that dictate rules regarding how and when a change can be made and how that change is documented. Consider the following scenario, which illustrates how a maintenance change could be a clue while troubleshooting a problem report: + +Last week, a network administrator attempted to better secure a Cisco Catalyst switch by administratively shutting down any ports that were in the down/down state (that is, no physical layer connectivity to a device). This morning, a user reported that her PC could not access network resources. After clearly defining the problem, the troubleshooter asked whether anything had changed, as part of the col- + + + +From the Library of Outcast Outcast +38 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +lect information troubleshooting phase. Even though the user was unaware of any changes, she mentioned that she had just returned from vacation, thus leading the troubleshooter to wonder if any network changes had occurred while the user was on vacation. Thanks to the network’s change management system, the troubleshooter was able to find in the documentation that last week an administrator had adminis-tratively shut down this user’s switchport because it was down/down while the user was on vacation and his computer was shut off. +The previous scenario is an excellent example of how following a structured trouble-shooting approach, having accurate documentation, and a sound change management policy minimized the total time it took the troubleshooter to solve the problem. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 1: Introduction to Troubleshooting and Network Maintenance 39 + + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 1-5 lists a reference of these key topics and the page num-bers on which each is found. + +Table 1-5 Key Topics for Chapter 1 Key +Topic Key Topic Element Description Page Number + + +List + +Table 1-2 + +List + +Section + +List + +List + +List + +List + +List + +List + +Paragraph + +Outlines the simplified troubleshooting flow 10 + +Identifies the five steps used while diagnosing a 10 problem +Outlines the structured troubleshooting flow 11 + +Provides details of each step during structured 13 troubleshooting +Lists the various troubleshooting methods that can 20 be used to narrow the field of potential causes +Lists examples of network maintenance tasks 27 + +Lists examples of network maintenance models 28 + +Identifies questions that need to be addressed while 31 implementing a change management system +Outlines various types of documents that should 32 exist and be maintained within an organization +Examples of how to help troubleshooters remember 35 the importance of documenting their steps +Identifies the importance of a baseline 36 + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +interrupt-driven task, structured maintenance task, FCAPS, ITIL, Cisco Lifecycle Services, shoot from the hip, top-down method, bottom-up method, divide-and-conquer method, following the traffic path method, comparing configurations method, compo-nent swapping method, baseline, change management, documentation + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ The Troubleshooting and Network Maintenance Toolkit: This section introduces you to the essential tools for troubleshooting and maintenance tasks. + +■ Using Cisco IOS to Verify and Define the Problem: This section reviews the ping, telnet, and traceroute utilities. + +■ Using Cisco IOS to Collect Information: This sec-tion focuses on how to use the CLI to collect infor-mation for troubleshooting and maintenance. + +■ Collecting Information in Transit: This section iden-tifies how you can configure switches to send copies of frames to packet capturing devices using SPAN and RSPAN. + +■ Using CLI Tools to Document a Network: This sec-tion focuses on the steps and commands required to successfully document a network diagram. + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 2 + + + + +Troubleshooting and Maintenance Tools + + +Collecting network information is an ongoing process. There is no argument that you will be collecting network information when there is an issue. However, if that is the only time you collect network information, you are missing the necessary key element of an efficient and effective troubleshooting process. To be an efficient and effective trouble-shooter, you need network information about the good times and the bad times, and +you need it now, not later. Therefore, you need to gather baseline data on a regular basis so that you have something to compare your current issue to. In addition, the statistics related to certain network events (for example, processor utilization on a network server exceeding a specified threshold) could trigger the writing of log information (for exam-ple, to a syslog server), so you have a snapshot of the device’s health at that point in time. + +This chapter introduces you to a sampling of Cisco IOS tools and features designed for network maintenance and troubleshooting. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 2-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 2-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +The Troubleshooting and Network Maintenance Toolkit + +Using Cisco IOS to Verify and Define the Problem + +Using Cisco IOS to Collect Information + +Collecting Information in Transit + +Using CLI Tools to Document a Network + +Questions +1–6 + +7–9 + +10 + +11 + +12 + + + + + + + + +From the Library of Outcast Outcast +42 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which three of the following are components that would be most useful when recov-ering from a network equipment outage? + +a. Backup of device configuration information + +b. Physical topology + +c. Duplicate hardware + +d. Operating system and application software (along with any applicable licensing) for the device + +2. The types of information collection used in troubleshooting fall into which three broad categories? + +a. Troubleshooting information collection + +b. Baseline information collection + +c. QoS information collection + +d. Network event information collection + +3. Which of the following would be appropriate for a collaborative web-based docu-mentation solution? + +a. Blog + +b. Vlog + +c. Wiki + +d. Podcast + +4. Which command enables you to view archival copies of a router’s startup configura-tion? + +a. show backup + +b. show archive + +c. show flash: | begin backup + +d. show ftp: | begin archive + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 43 + +5. Which of the following is a Cisco IOS technology that uses a collector to take data from monitored devices and present graphs, charts, and tables to describe network traffic patterns? +a. NBAR + +b. NetFlow + +c. QDM + +d. IPS + +6. Which two of the following are characteristics of the NetFlow feature? (Choose the two best answers.) + +a. Collects detailed information about traffic flows + +b. Collects detailed information about device statistics + +c. Uses a pull model + +d. Uses a push model + +7. Which of the following is the ping response to a transmitted ICMP echo datagram that needed to be fragmented when fragmentation was not permitted? + +a. U + +b. . + +c. M + +d. D + +8. Which command can be used to determine whether transport layer connectivity is functioning? + +a. telnet + +b. ping + +c. traceroute + +d. arp -a + +9. Which command enables you to determine whether a routing loop exists? + +a. telnet + +b. ping + +c. traceroute + +d. arp -a + + + + + + + +From the Library of Outcast Outcast +44 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10. Which of the following commands displays a router’s running configuration, starting where the routing protocol configuration begins? + +a. show running-config | tee router + +b. show running-config | begin router + +c. show running-config | redirect router + +d. show running-config | append router + +11. What feature available on Cisco Catalyst switches enables you to connect a network monitor to a port on one switch to monitor traffic flowing through a port on a dif-ferent switch? +a. RSTP + +b. SPAN + +c. RSPAN + +d. SPRT + +12. What IOS command enables you to discover the Cisco devices that are directly con-nected to other Cisco devices? + +a. show ip interface brief + +b. show interface status + +c. show cdp neighbor + +d. show version + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 45 + +Foundation Topics + + +The Troubleshooting and Network Maintenance Toolkit + +As previously discussed, troubleshooting and maintenance go hand and hand. A relation-ship exists between the two. Therefore, the tools we use for troubleshooting and mainte-nance will be very similar, if not the same. + +Chapter 1, “Introduction to Troubleshooting and Network Maintenance,” introduced you to a series of steps that provide a structured troubleshooting process. Several of these steps involve the use of tools that will help gather, examine, and compare information, in addition to fixing and possibly rolling back configurations. Let’s examine four of these steps: + +■ Problem report: By proactively monitoring network devices with specialized report-ing tools, you might be alerted to impending performance issues before users are impacted and report it. + +■ Collect information: The collection of information when troubleshooting a problem can often be made more efficient through the use of specialized maintenance and troubleshooting tools. At this point, you are gathering more information that will help paint a clearer picture of the issue at hand. + +■ Examine collected information: As troubleshooters investigate the information they collected during the troubleshooting process, they need to know what normal net-work behavior looks like. They can then contrast that normal behavior against what they are observing in their collected data. Specialized maintenance tools can be used in a network to collect baseline data on an ongoing basis so that it is available and current when needed. + +■ Verify hypothesis: Specialized maintenance and troubleshooting tools help a troubleshooter implement his fix for an issue; however, he can also help roll back an attempted fix, if that fix proves unsuccessful. + +If you look closely, the information that is collected essentially falls into one of three categories: + + +■ Key +Topic + +■ + +Troubleshooting information collection: This is the information collected while troubleshooting an issue that was either reported by a user or a network manage-ment station (NMS). + +Baseline information collection: This is the information collected when the network is operating normally. This information provides a frame of reference against which +other data can be compared when we are troubleshooting an issue. + + + + + + +From the Library of Outcast Outcast +46 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Network event information collection: This is the information collected when our devices automatically generate alerts in response to specific conditions (for example, configured utilization levels on a switch, router, or server being exceeded). These alerts can be simple notification messages or emergency messages. At some point, they will come in handy. + +Because such a tight relationship exists between troubleshooting and network mainte-nance, you should identify the tools required to carry out your maintenance processes based on how well targeted they are toward your specific business processes and tasks, while helping you focus your troubleshooting efforts without having to wade through reams of irrelevant information. This section focuses on tools that are necessary for trou-bleshooting and maintenance tasks. + +Network Documentation Tools + +It is fitting that we start this chapter with a discussion on network documentation tools, because without them, all the other tools we use mean nothing if we are not document-ing their findings. Chapter 1 discussed the importance of network documentation. However, for this documentation to truly add value and be an asset, it should be easy to retrieve and, more important, be current. To keep the documentation current is a chal-lenge for most people. The big reason is time. However, you can make it less challenging and less time-consuming if it is easy to update with the proper tools. + +Many solutions are available on the market. The features you want the tool to provide will determine the overall cost. However, you do not have to purchase the most expensive tool to get the best product. Shop around and communicate with the vendors to see what they have to offer you and your business needs. Get free trials and work with them for a while. That is the only way you will be able to determine whether the product will work for you. A couple of documentation management system examples are as follows: + +■ Trouble ticket reporting system: Several software applications are available for recording, tracking, and archiving trouble reports (that is, trouble tickets). These applications are often referred to as help desk applications. However, their useful-ness extends beyond the help desk environment. + +■ Wiki: A wiki can act as a web-based collaborative documentation platform. A popu-lar example of a wiki is Wikipedia (http://www.wikipedia.com), an Internet-based encyclopedia that can be updated by users. This type of wiki technology can also be used on your local network to maintain a central repository for documentation that is both easy to access and easy to update. + +The true power of documentation is seen during the troubleshooting process, and this is especially true when you have a well-organized, searchable repository of information. During the troubleshooting process, if you have a searchable database of past issues that were solved, and guides that can be followed to resolve issues, you can leverage that information and be more efficient and effective. However, do not forget to update the documentation after you solve the ticket. Just because it was reported in the past +and already had a resolution does not mean you can skip the documentation process. At + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 47 + +some point, we may need to rely on the number of entries in a ticket reporting system to determine whether some greater issue is lurking in the shadows and causing the reoccur-rence of the same minor issues over and over. + +Basic Tools + +Troubleshooting and network maintenance tools often range in expense from free to tens of thousands of dollars. Similarly, these tools vary in their levels of complexity and usefulness for troubleshooting and maintaining specific issues. You need to select tools that balance your troubleshooting and maintenance needs while meeting your budgetary constraints. + +Regardless of budget, all Cisco troubleshooting and network maintenance toolkits will contain the command-line interface (CLI) commands that are executable from a router or switch prompt. In addition, many network devices have a graphical user interface (GUI) to assist network administrators in their configuration and monitoring tasks. External servers (for example, backup servers, logging servers, and time servers) can also collect, store, or provide valuable information for day-to-day network operations and for trouble-shooting and maintenance. + +CLI Tools + +Cisco IOS offers a wealth of CLI commands, which can prove invaluable when trouble-shooting a network issue. For example, a show command, which displays a static snap-shot of information, can display router configuration information and the routes that have been learned by a routing process. The debug command can provide real-time infor-mation about router or switch processes. The focus of this book is on those show and debug CLI commands that will assist us in solving trouble tickets. To illustrate, consider Example 2-1, which shows router R2 receiving Open Shortest Path First (OSPF) link-state updates from its OSPF neighbors as those updates occur. + +Example 2-1 Sample debug Output + +R2#debug ip ospf events +OSPF events debugging is on +R2# +*Mar 1 00:06:06.679: OSPF: Rcv LS UPD from 10.4.4.4 on Serial1/0.2 length 124 +LSA count 1 +*Mar 1 00:06:06.691: OSPF: Rcv LS UPD from 10.3.3.3 on Serial1/0.1 length 124 +LSA count 1 +*Mar 1 00:06:06.999: OSPF: Rcv LS UPD from 10.4.4.4 on Serial1/0.2 length 124 +LSA count 1 +*Mar 1 00:06:07.067: OSPF: Rcv LS UPD from 10.3.3.3 on Serial1/0.1 length 156 +LSA count 2 + +This is one of many show and debug examples you will see throughout this book. Cisco IOS also has a CLI feature that allows a router to monitor events and automatically + + + + +From the Library of Outcast Outcast +48 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +respond to a specific event (such as a defined threshold being reached) with a predefined action. This feature is called Cisco IOS Embedded Event Manager (EEM), which we cover in more detail later. + +GUI Tools + +Although Cisco has a great number of GUI tools, when it comes to router and switch configuration and troubleshooting for the CCNP Routing and Switching track, you will spend all your time in the CLI. Therefore, do not get too comfortable with GUI tools for the Routing and Switching track. However, as an example, you can use the GUI tool known as Cisco Configuration Professional (CCP) to configure and troubleshoot your Integrated Services Routers (ISRs). Figure 2-1 provides a sample of the CCP home page. + + + + + + + + + + + + + + + + + + + + + + +Figure 2-1 Cisco Configuration Professional + + +Recovery Tools + +During the recovery process, you need access to duplicate hardware and the IOS. However, you also need a backup of the failed devices configurations. External servers are often used to store archival backups of a device’s operating system (for example, a Cisco IOS image) and the configuration information. Depending on your network device, you might be able to back up your operating system and configuration information to a TFTP, FTP, HTTP, or SCP server. To illustrate, consider Example 2-2. + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 49 + +Example 2-2 Backing Up a Router’s Startup Configuration to an FTP Server +Key +Topic R1#copy startup-config ftp://cisco:cisco@192.168.1.74 +Address or name of remote host [192.168.1.74]? +Destination filename [r1-confg]? +Writing r1-confg ! +1446 bytes copied in 3.349 secs (432 bytes/sec) + +In Example 2-2, router R1’s startup configuration is being copied to an FTP server with an IP address of 192.168.1.74. Notice that the login credentials (that is, username=cisco and password=cisco) for the FTP server are specified in the copy command. In a production environment, the username and password should be stronger and not easily guessed. + +If you intend to routinely copy backups to an FTP server, you can avoid specifying the login credentials each time (for security purposes), by adding those credentials to the router’s configuration. Example 2-3 shows how to add FTP username and password cre-dentials to the router’s configuration, and Example 2-4 shows how the startup configura-tion can be copied to an FTP server without explicitly specifying those credentials in the copy command. + +Example 2-3 Adding FTP Server Login Credentials to a Router’s Configuration + +R1#configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ip ftp username cisco +R1(config)#ip ftp password cisco +R1(config)#end + + +Example 2-4 Backing Up a Router’s Startup Configuration to an FTP Server Without Specifying Login Credentials + +R1#copy startup-config ftp://192.168.1.74 +Address or name of remote host [192.168.1.74]? +Destination filename [r1-confg]? +Writing r1-confg ! +1446 bytes copied in 3.389 secs (427 bytes/sec) + +Example 2-5 shows how to add HTTP username and password credentials to the router’s configuration. Compare this to the FTP configuration commands and notice the differ-ence. + +Example 2-5 Adding HTTP Server Login Credentials to a Router’s Configuration + +R1#configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ip http client username cisco +R1(config)#ip http client password cisco +R1(config)#end + + + + + +From the Library of Outcast Outcast +50 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +The process of backing up a router’s configuration can be automated using an archiving feature, which is part of the Cisco IOS Configuration Replace and Configuration Rollback feature. Specifically, you can configure a Cisco IOS router to periodically (that is, at intervals specified in minutes) back up a copy of the configuration to a specified location (for example, the router’s flash, or an FTP server). Also, the archive feature can be configured to create an archive every time you copy a router’s running configuration to the startup configuration. + +Example 2-6 illustrates a router configured to back up the running configuration every 1440 minutes to an FTP server with an IP address of 192.168.1.74. The login creden-tials have already been configured in the router’s configuration. In addition, the write-memory command causes the router to archive a copy of the configuration whenever the router’s running configuration is copied to the startup configuration using either the write-memory or copy running-config startup-config commands. + +Example 2-6 Automatic Archive Configuration + +R1#show run +Building configuration... +...OUTPUT OMITTED... +ip ftp username cisco +ip ftp password cisco +! +archive +path ftp://192.168.1.74/R1-config +write-memory +time-period 1440 +...OUTPUT OMITTED... + +You can view the files stored in a configuration archive by issuing the show archive com-mand, as demonstrated in Example 2-7. + +Example 2-7 Viewing a Configuration Archive +Key +Topic R1#show archive +The maximum archive configurations allowed is 10. +The next archive file will be named ftp://192.168.1.74/R1-config-3 +Archive # Name +1 ftp://192.168.1.74/R1-config-1 +2 ftp://192.168.1.74/R1-config-2 <- Most Recent +3 +4 +5 +6 +7 +8 +9 +10 + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 51 + +Example 2-8 shows the execution of the copy run start command, which copies a rout-er’s running configuration to the router’s startup configuration. The show archive com-mand is then reissued, and the output confirms that an additional configuration archive (named R1-config-3) has been created on the FTP server because of the write-memory command we issued in config-archive configuration mode. + +Example 2-8 Confirming Automated Backups + +R1#copy run start +Destination filename [startup-config]? +Building configuration... +[OK] +Writing R1-config-3 ! +R1#show archive +The maximum archive configurations allowed is 10. +The next archive file will be named ftp://192.168.1.74/R1-config-4 +Archive # Name +1 ftp://192.168.1.74/R1-config-1 +2 ftp://192.168.1.74/R1-config-2 +3 ftp://192.168.1.74/R1-config-3 <- Most Recent +4 +5 +6 +7 +8 +9 +10 + +The output of show archive indicates that the maximum configurations allowed is ten. This is not entirely true. Because the path is pointing to an FTP server, we are limited only by the amount of storage space on the server. Therefore, the router will continue to create an archive of the running configuration at its scheduled interval. If the archive list on the router fills up (maximum ten), the output of show archive will erase the entry for Archive 1, move all entries up the list one spot, and add the new entry to Archive 10, as shown in Example 2-9. Note that this does not delete anything from the FTP server. Only the entry in show archive is removed to make space in the list. + +Example 2-9 Confirming Archive Configuration + +R1#copy run start +Destination filename [startup-config]? +Building configuration... +[OK] +Writing R1-config-3 ! +R1#show archive +The maximum archive configurations allowed is 10. +The next archive file will be named ftp://192.168.1.74/R1-config-4 +Archive # Name + + + +From the Library of Outcast Outcast +52 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +1 ftp://192.168.1.74/R1-config-7 +2 ftp://192.168.1.74/R1-config-8 +3 ftp://192.168.1.74/R1-config-9 +4 ftp://192.168.1.74/R1-config-10 +5 ftp://192.168.1.74/R1-config-11 +6 ftp://192.168.1.74/R1-config-12 +7 ftp://192.168.1.74/R1-config-13 +8 ftp://192.168.1.74/R1-config-14 +9 ftp://192.168.1.74/R1-config-15 +10 ftp://192.168.1.74/R1-config-16 <- Most Recent + + + + + + + +Key Topic + +However, if you are storing the archive locally in flash as an example, the older files will be deleted to make space, in addition to moving the entries listed in the show archive command output. You can change the maximum number of archives with the maximum command in config-archive configuration mode. + +Restoring a configuration backup requires copying the configuration file from its storage location to the running configuration on the router or switch. The Cisco IOS copy com-mand treats this as a merge operation instead of a copy and replace operation. This means that copying anything into the running configuration from any source might not produce the result we desire. We can witness this with the password recovery process on a Cisco router. During this process, after you have loaded the router to factory defaults, you copy the startup configuration into the running configuration, which produces a merge. This merge is easily witnessed with the interfaces. Interfaces that were enabled do not have a no shutdown command in the startup configuration, and the factory default setting of +a router interface is shutdown and includes a shutdown command. This is illustrated in +Example 2-10. + + +Example 2-10 Comparing the Running Configuration and Startup Configuration Before Issuing the copy Command + +R1#show run +...OUTPUT OMITTED... +interface FastEthernet0/0 +no ip address +shutdown +...OUTPUT OMITTED... +R1#show start +...OUTPUT OMITTED... +interface FastEthernet0/0 +ip address 192.168.1.11 255.255.255.0 +...OUTPUT OMITTED... + +Once the startup configuration is copied to (merged with) the running configuration, the shutdown command prevails in the running configuration because there is not a no shutdown in the startup configuration that will overwrite that, as shown in Example 2-11. To fix this, after you have copied the startup configuration to the running configuration, you have to issue the no shutdown command on all interfaces you want enabled. + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 53 + +Example 2-11 Witnessing a Configuration Merge + +R1#copy start run +Destination filename [running-config]? +1881 bytes copied in 1.444 secs (1303 bytes/sec) + +R1#show run +...OUTPUT OMITTED... +interface FastEthernet0/0 +ip address 192.168.1.11 255.255.255.0 +shutdown +...OUTPUT OMITTED... +R1# + + + +Key Topic + +On the bright side, you can restore a previously archived configuration using the configure replace command. Unlike the copy command, this does not merge the archived configuration with the running configuration, but rather completely replaces the running configuration with the archived configuration. Example 2-12 shows the restora-tion of an archived configuration to a router. Notice how the IOS warns you that this is a copy replace function that completely overwrites the current configuration. In this case, there was only one small difference between the running configuration and the archive, as +indicated by the statement “Total number of passes: 1.” It was the hostname. + + +Example 2-12 Restoring an Archived Configuration + +Router#configure replace ftp://192.168.1.74/R1-config-3 +This will apply all necessary additions and deletions +to replace the current running configuration with the +contents of the specified configuration file, which is +assumed to be a complete configuration, not a partial +configuration. Enter Y if you are sure you want to proceed. ? [no]: Y +Loading R1-config-3 ! +[OK - 3113/4096 bytes] + +Total number of passes: 1 +Rollback Done + +R1# + + +Logging Tools + +Device logs offer valuable information when troubleshooting a network issue. Many events that occur on a router are automatically reported to the router’s console. For exam-ple, if a router interface goes down or up, a message is written to the console. However, once in production, we are usually not staring at the console output or even connected +to the console port. In most cases, we would connect to the device when needed using Telnet or Secure Shell (SSH), and these logging messages are not displayed via Telnet or + + + +From the Library of Outcast Outcast +54 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +SSH by default. If you are connected to a router through Telnet or SSH and want to see console messages, you have to enter the command terminal monitor in privilege EXEC mode. + +A downside of solely relying on console messages is that those messages can scroll off the screen, or you might close your terminal emulator, after which those messages would no longer be visible as the session is reset. Therefore, a step beyond logging messages to the console is logging messages to a router’s buffer (the router’s RAM). To cause mes-sages to be written to a router’s buffer, you can issue the logging buffered command. As part of that command, you can specify how much of the router’s RAM can be dedicated to logging. After the buffer fills to capacity, older entries will be deleted to make room for newer entries. You can view the logging messages in the buffer by issuing the show logging command. If you need to clear the logging messages in the buffer, issue the clear logging command in privilege EXEC mode. + +Logging severity levels range from 0 to 7, with corresponding names, as shown in Table 2-2. Notice that lower severity levels are more severe than those with higher levels. By default, the console, vty lines, and buffer will log all messages with a severity level of 7 and lower. However, debugs are logged only when they are turned on with debug commands. + + +Table 2-2 Severity Levels +Key +Topic Severity Level + +0 + +1 + +2 + +3 + +4 + +5 + +6 + +7 + + + +Name +Emergencies + +Alerts + +Critical + +Errors + +Warnings + +Notifications + +Informational + +Debugging + + + +You might want to log messages of one severity level to a router’s console and messages of another severity level to the router’s buffer. This is possible by using the logging console severity_level and logging buffered severity_level commands. For example, if you want to log level 6 and lower to the console and level 7 and lower to the buffer, you enter logging console 6 and logging buffered 7 in global configuration mode. You can also specify the severity level by name instead of number. + +Another logging option is to log messages to an external syslog server. By sending log messages to an external server, you can keep a longer history of logging messages. Depending on the syslog server software, you might be able to schedule automated log archiving, configure advanced script actions, create advanced alerts, and produce statisti-cal graphs. You can direct your router’s log output to a syslog server’s IP address using + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 55 + +the logging ip_address command, and you can specify the severity level that will be sent to the syslog server by using the logging trap severity_level command. + +Example 2-13 illustrates several of the logging configurations discussed here. + +Example 2-13 Logging Configuration Key +Topic R1#show run +...OUTPUT OMITTED... +Building configuration... +! +logging buffered 4096 warnings +logging console warnings +! +logging 192.168.1.50 +logging trap 6 +...OUTPUT OMITTED... + +In Example 2-13, events with a severity level of warning (that is, 4) or less (that is, 0 to 4) are logged to the router’s buffer. This buffer can be viewed with the show logging com-mand. The router can use a maximum of 4096 bytes of RAM for the buffered logging. The console is configured for logging events of the same severity level. In addition, the router is configured to log messages with a severity of 6 or lower to a syslog server with an IP address 192.168.1.50. Figure 2-2 shows logging messages being collected by a Kiwi Syslog Server (available from http://www.kiwisyslog.com). + + + + + + + + + + + + + + + + + + + + + + + +Figure 2-2 Syslog Server + + +From the Library of Outcast Outcast +56 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +Network Time Protocol as a Tool + +Picture this scenario. You have just been assigned a trouble ticket. Users are complain-ing that the network is slow at 5:30 p.m. local time. The problem ticket indicates that this happens every day. You are browsing the logs to see whether anything abnormal is occurring on the network at that time. However, your search will be worthwhile only if the logs have time stamps. If they don’t, you will not be able to correlate the log entrees to the problem the users are reporting. Therefore, time stamps are useless if they are not accurate. For example, there may be a log entry for 2:25 p.m. that reports high network utilization. Is that really 2:25 p.m. or is it 5:30 p.m.? Time-stamp accuracy is paramount when it comes to troubleshooting. Therefore, you need to make sure the clocks are set correctly on all the devices. + +Although you could individually set the clock on each of your devices, those clocks might drift over time and not agree causing variations in the log entries. You might have heard the saying that a man with one watch always knows what time it is, whereas a man with two watches is never quite sure. This implies that devices need to have a common point of reference for their time. Such a reference point is made possible by Network Time Protocol (NTP), which allows network devices to point to a device acting as an NTP server (a time source). However, this must be a reliable time source. For example, the +U.S. Naval Observatory in Washington, D.C., is a stratum 1 time source. Stratum 1 time sources are the most reliable and accurate. In addition, because the NTP server might be referenced by devices in different time zones, each device has its own time zone configu-ration, which indicates how many hours its time zone differs from Greenwich mean time (GMT). + +Example 2-14 shows an NTP configuration entered on a router located in the eastern time zone, which is 5 hours behind GMT when daylight savings time is not in effect. The clock summer-time command defines when daylight savings time begins and ends. In this example, daylight savings time begins at 2:00 a.m. on the second Sunday in March and ends at 2:00 a.m. on the first Sunday in November. The ntp server command is used to point to an NTP server. Note that a configuration can have more than one ntp server command, for redundancy. In such cases, NTP will decide based on its protocol which is +the most reliable, or you can manually specify which is most reliable by adding the prefer +option to the ntp server command. + + +Example 2-14 Configuring a Router to Point to an NTP Server + +R1#configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#clock timezone EST -5 +R1(config)#clock summer-time EDT recurring 2 Sun Mar 2:00 1 Sun Nov 2:00 +R1(config)#ntp server 192.168.1.150 +R1(config)#ntp server 192.168.1.151 prefer +R1(config)#end + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 57 + +NTP uses a hierarchy of time servers based on stratum levels from 1 to 15. Stratum 1 is the most reliable. Because it is based on a hierarchy, you may not want all of your devices pointing to the stratum 1 time source that is connected to the Internet. In these instances, you could set up a device or two in your organization to receive their time from the stratum 1 source (making them a stratum 2 source) and then configure the other devices in your organization to receive their time from these local devices in your organization (making them a stratum 3). + +Advanced Tools + +Keeping an eye on network traffic patterns and performance metrics can help you antici-pate problems before they occur. You can then take the necessary measures to address them proactively before they become a major issue. This is in contrast to taking a reactive stance where you continually respond to problem reports as they occur. The saying “If it ain’t broke don’t fix it” does not apply in a proactive network maintenance environment. Your stance in this type of environment should be “If it appears that it will break, fix it.” To be proactive, you need more than just basic show and debug commands. You need advanced tools to proactively monitor the health of your devices and the health of your network traffic, such as SNMP, NetFlow, and EEM. + +Overview of SNMP and NetFlow + +Simple Network Management Protocol (SNMP) allows a monitored device (for example, a router or a switch) to run an SNMP agent that collects data such as utilization statistics for processors and memory. An SNMP server can then query the SNMP agent to retrieve those statistics to determine the overall health of that device. + +Cisco IOS NetFlow can provide you with tremendous insight into your network traffic patterns. Several companies market NetFlow collectors, which are software applications that can take the NetFlow information reported from a Cisco device and convert that raw data into useful graphs, charts, and tables reflecting traffic patterns. Reasons to monitor network traffic include the following: + +■ Ensuring compliance with an SLA: If you work for a service provider or are a cus-tomer of a service provider, you might want to confirm that performance levels to and from the service provider’s cloud are conforming to the agreed-upon service level agreement (SLA). + +■ Trend monitoring: Monitoring resource utilization on your network (for example, bandwidth utilization and router CPU utilization) can help you recognize trends and forecast when upgrades will be required or if users are abusing the network resourc-es. + +■ Troubleshooting performance issues: Performance issues can be difficult to trouble-shoot in the absence of a baseline. By routinely monitoring network performance, you have a reference point (that is, a baseline) against which you can compare perfor-mance metrics collected after a user reports a performance issue. + + + + +From the Library of Outcast Outcast +58 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Creating a Baseline with SNMP and NetFlow + + + +Key Topic + +SNMP and NetFlow are two technologies available on most Cisco IOS platforms that can automate the collection statistics. These statistics can be used, for example, to establish a baseline that can be used in a troubleshooting scenario or in proactive network manage- +ment and maintenance. Table 2-3 contrasts these two technologies. + + + +Table 2-3 Comparing SNMP and NetFlow + + +Technology +SNMP + + + + + +NetFlow + +Characteristics +Collects device statistics (for example, platform resource utilization, traffic counts, and error counts) + +Uses a pull model (that is, statistics pulled from a monitored device by a network management station [NMS]) + +Available on nearly all enterprise network devices + +Collects detailed information about traffic flows + +Uses a push model (that is, statistics pushed from the monitored device to a NetFlow collector) + +Available on routers and high-end switches + + + +Although both SNMP and NetFlow are useful for statistical data collection, they target different fundamental functions. For example, SNMP is primarily focused on device sta-tistics (the health of a device), whereas NetFlow is primarily focused on traffic statistics (the health of network traffic). + +SNMP + +A device being managed by SNMP runs a process called an SNMP agent, which collects statistics about the device and stores those statistics in a Management Information Base (MIB). A network management system (NMS) can then query the agent for information in the MIB, using the SNMP protocol. SNMP Version 3 (SNMPv3) supports encryption +and hashed authentication of SNMP messages. Before SNMPv3, the most popular SNMP version was SNMPv2c, which used community strings for authentication. Today, many SNMP deployments are still using version 2c because of its simplicity. Specifically, for an NMS to be allowed to read data from a device running an SNMP agent, the NMS must be configured with a community string that matches the managed device’s read-only community string. For the NMS to change the information on the managed device, the NMS must be configured with a community string that matches the managed device’s read-write community string. To enhance the security available with SNMPv2c, you can create an access list that determines valid IP addresses or network addresses for NMS servers that are allowed to manage or collect information from the MIB of the device. + +Figure 2-3 shows a topology using SNMP. In the topology, router R1 is running an SNMP agent that the NMS server can query. + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 59 + + + + +SW1 + +NMS + + +R1 +Managed Device Running an SNMP Agent + + +Figure 2-3 SNMP Sample Topology + +Example 2-15 illustrates the SNMPv2c configuration on router R1. The snmp-server community string [ro | rw] [access_list_number] commands specify a read-only (that is, ro) community string of CISCO and a read-write (that is, rw) community string of +PRESS. Only NMSs permitted in access list 10 and 11 will be able to read, or read/write, respectively, this device using SNMP. Contact and location information for the device is also specified. Finally, notice the snmp-server ifindex persist command. This command ensures that the SNMP interface index stays consistent during data collection, even if the device is rebooted. This consistency is important when data is being collected for baselin-ing purposes. + +Example 2-15 SNMP Sample Configuration + +R1#configure terminal +R1(config)#snmp-server community CISCO ro 10 +R1(config)#snmp-server community PRESS rw 11 +R1(config)#snmp-server contact demo@ciscopress.local +R1(config)#snmp-server location 3rd Floor of Lacoste Building +R1(config)#snmp-server ifindex persist + + +NetFlow + +NetFlow can distinguish between different traffic flows. A flow is a series of packets, all of which have shared header information such as source and destination IP addresses, protocol numbers, port numbers, and type of service (TOS) field information. In addi-tion, they are entering the same interface on the device. NetFlow can keep track of the number of packets and bytes observed in each flow. This information is stored in a flow cache. Flow information is removed from a flow cache if the flow is terminated, times out, or fills to capacity. + +You can use the NetFlow feature as a standalone feature on an individual router. Such a standalone configuration might prove useful for troubleshooting because you can observe flows being created as packets enter a router. However, rather than using just a standalone implementation of NetFlow, you can export the entries in a router’s flow cache to a NetFlow collector, which is a software application running on a computer/ +server in your network. After the NetFlow collector has received flow information over a period of time, analysis software running on the NetFlow collector can produce reports detailing traffic statistics. + +Figure 2-4 shows a sample topology in which NetFlow is enabled on router R4, and a NetFlow collector is configured on a PC at IP address 192.168.1.50. + + + +From the Library of Outcast Outcast +60 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +192.168.0.228 +Cisco Unified Communications Manager Server + + + + + +Web Server + + +Fa 0/1 Fa 0/0 +SW1 R4 SW2 +NetFlow Enabled Router + + +10.8.8.6 IP Phone + + +192.168.1.50 NetFlow Collector + +Figure 2-4 NetFlow Sample Topology + +Example 2-16 illustrates the NetFlow configuration on router R4. Notice that the ip flow ingress command is issued for both the Fast Ethernet 0/0 and Fast Ethernet 0/1 inter-faces. This ensures that all flows passing through the router, regardless of direction, can be monitored. Although not required, router R4 is configured to report its NetFlow infor-mation to a NetFlow collector at IP address 192.168.1.50. The ip flow-export source lo +0 command indicates that all communication between router R4 and the NetFlow collec-tor will be via interface Loopback 0. A NetFlow Version of 5 was specified. You should check the documentation for your NetFlow collector software to confirm which version to configure. Finally, the ip flow-export destination 192.168.1.50 5000 command is issued to specify that the NetFlow collector’s IP address is 192.168.1.50, and communi-cation to the NetFlow collector should be done over UDP port 5000. Because NetFlow does not have a standardized port number, check your NetFlow collector’s documenta-tion when selecting a port. + +Example 2-16 NetFlow Sample Configuration + +R4#configure terminal +R4(config)#int fa 0/0 +R4(config-if)#ip flow ingress +R4(config-if)#exit +R4(config)#int fa 0/1 +R4(config-if)#ip flow ingress + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 61 + +R4(config-if)#exit +R4(config)#ip flow-export source lo 0 +R4(config)#ip flow-export version 5 +R4(config)#ip flow-export destination 192.168.1.50 5000 +R4(config)#end + +Using your favorite search engine, search for images of “NetFlow collector” (without the quotes) to see various sample images of what a NetFlow collector can provide you. +Although an external NetFlow collector is valuable for longer-term flow analysis and can provide detailed graphs and charts, you can issue the show ip cache flow command at +a router’s CLI prompt to produce a summary of flow information, as shown in Example 2-17. A troubleshooter can look at the output displayed in Example 2-17 and be able +to confirm, for example, that traffic is flowing between IP address 10.8.8.6 (a Cisco IP Phone) and 192.168.0.228 (a Cisco Unified Communications Manager server). + +Example 2-17 Viewing NetFlow Information + +R4#show ip cache flow +...OUTPUT OMITTED... +Protocol Total Flows Packets Bytes Packets Active(Sec) Idle(Sec) + +---------- Flows /Sec /Flow +TCP-Telnet 12 0.0 50 + +/Pkt /Sec /Flow /Flow +40 0.1 15.7 14.2 + + + +TCP-WWW 12 0.0 40 +TCP-other 536 0.1 1 +UDP-TFTP 225 0.0 4 +UDP-other 122 0.0 114 +ICMP 41 0.0 13 +IP-other 1 0.0 389 +Total: 949 0.2 18 + +785 0.1 7.1 6.2 +55 0.2 0.3 10.5 +59 0.1 11.9 15.4 +284 3.0 15.9 15.4 +91 0.1 49.9 15.6 +60 0.0 1797.1 3.4 +255 3.8 9.4 12.5 + + + +SrcIf SrcIPaddress DstIf +Fa0/0 10.3.3.1 Null +Fa0/1 10.8.8.6 Fa0/0 + +DstIPaddress Pr SrcP DstP Pkts +224.0.0.10 58 0000 0000 62 +192.168.0.228 06 C2DB 07D0 2 + +Fa0/0 192.168.0.228 Fa0/1 10.8.8.6 06 07D0 C2DB 1 + +Fa0/0 192.168.1.50 Fa0/1 +Fa0/1 10.8.8.6 Fa0/0 +Fa0/0 10.1.1.2 Local + +10.8.8.6 11 6002 6BD2 9166 +192.168.1.50 11 6BD2 6002 9166 +10.3.3.2 06 38F2 0017 438 + + +Providing Notifications for Network Events +Whereas responding to problem reports from users is a reactive form of troubleshooting, monitoring network devices for significant events and responding to those events is a + + + + + + + + + +From the Library of Outcast Outcast +62 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + + + + + + + + + + + + + + + + + + +Key Topic + +proactive form of troubleshooting. For example, before a user loses connectivity with the Internet, a router that is dual-homed to the Internet might report the event of one of its Internet connections going down. The redundant link can then be repaired, in response to the notification, thus resolving the problem without users being impacted. + +Both syslog and SNMP are protocols that can report the occurrence of specific events on a network device, and NetFlow can report events related to network traffic flows. Although these protocols by themselves lack a mechanism to alert a network administra-tor (for example, via e-mail) when a network event is logged, third-party software is avail-able that can selectively alert appropriate personnel when specific events are logged. + +Earlier, this section discussed how a network device running an SNMP agent can be que-ried for information from an NMS. However, a network device running an SNMP agent can also initiate communication with an NMS. If an interface goes down, for example, the SNMP agent on a managed network device can send a message containing informa-tion about the interface state change to an NMS, and then the NMS can notify a network administrator via e-mail. These messages, from the agent to the NMS, are called traps. These traps require the NMS to interpret them because they are not in an easy, readable format. + +Example 2-18 demonstrates how to enable a router to send SNMP traps to an NMS. The snmp-server host 192.168.1.50 version 2c CISCOPRESS command points router R4 to an SNMP server (that is, an NMS) at IP address 192.168.1.50. The SNMP server is con-figured for SNMP version 2c and a community string of CISCOPRESS; therefore, we include that information on the router for communication purposes with the NMS. + +The snmp-server enable traps command is used to enable all traps on the router. If you only need to enable specific traps, you may do so by adding the individual trap keyword to the snmp-server enable traps command (for example, snmp-server enable traps bgp). +You can view the enabled traps by using the show run | include traps command. + + +Example 2-18 Enabling SNMP Traps + +R4#configure terminal +R4(config)#snmp-server host 192.168.1.150 version 2c CISCOPRESS +R4(config)#snmp-server enable traps +R4(config)#end +R4#show run | include traps +snmp-server enable traps snmp authentication linkdown linkup coldstart warmstart +snmp-server enable traps vrrp +snmp-server enable traps ds1 +snmp-server enable traps gatekeeper +snmp-server enable traps tty +snmp-server enable traps eigrp +snmp-server enable traps xgcp +snmp-server enable traps ds3 +...OUTPUT OMITTED... + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 63 + + + + + + + + + + + + + + +Key Topic + +The messages received via syslog and SNMP are predefined within Cisco IOS. Although this is a rather large collection of predefined messages and should accommodate most network management requirements, Cisco IOS also supports a feature called Embedded Event Manager (EEM) that enables you to create your own event definitions and specify custom responses to those events. An event can be defined and triggered based on a sys-log message, SNMP trap, and even the issuing of a specific Cisco IOS command, as just a few examples. In response to a defined event, EEM can perform various actions, includ-ing sending an SNMP trap to an NMS, writing a log message to a syslog server, executing specified Cisco IOS commands, capturing output of specific show commands, sending an e-mail to an appropriate party, or executing a tool command language (Tcl) script. From this short list, you can already see how powerful the EEM can be. + +To illustrate the basic configuration steps involved in configuring an EEM applet, consid-er Example 2-19. The purpose of this configuration is to create a syslog message that will be displayed on the router console when someone clears the router’s interface counters using the clear counters command. The message reminds the administrator to update the +network documentation and lists the rationale for clearing the interface counters. + + +Example 2-19 EEM Sample Configuration + +R4#configure terminal +R4(config)#event manager applet COUNTER-RESET +R4(config-applet)#event cli pattern "clear counters" sync no skip no occurs 1 +R4(config-applet)#action A syslog priority informational msg "Please update network documentation to record why the counters were reset." +R4(config-applet)#end + +The event manager applet COUNTER-RESET command creates an EEM applet named COUNTER-RESET and enters applet configuration mode. The event command specifies what you are looking for in your custom-defined event. In this example, you are looking for the CLI command clear counters. Note that the clear counters command would be detected even if a shortcut (for example, cle co) were used. The sync no parameter says that the EEM policy will run asynchronously with the CLI command. Specifically, the EEM policy will not be executed before the CLI command executes. The skip no param-eter says that the CLI command will not be skipped (that is, the CLI command will be executed). Finally, the occurs 1 parameter indicates that the EEM event is triggered by a single occurrence of the clear counters command being issued. + +The action command is then entered to indicate what should be done in response to the defined event. In Example 2-19, the action is given a locally significant name of A and is assigned a syslog priority level of informational. The specific action to be taken is +producing this informational message saying: Please update network documentation to record why the counters were reset. + +To verify the operation of the EEM configuration presented in Example 2-19, the clear counters command is executed in Example 2-20. Notice that entering the clear counters command triggers the custom-defined event, resulting in generation of a syslog message reminding an administrator to document the reason they cleared the interface counters. + + + + +From the Library of Outcast Outcast +64 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 2-20 Testing EEM Configuration + +R4#clear counters +Clear "show interface" counters on all interfaces [confirm] +R4# +%HA_EM-6-LOG: COUNTER-RESET: Please update network documentation to record why the counters were reset. +R4# + + +Cisco Support Tools + +Cisco has several other configuration, troubleshooting, and maintenance tools available on its website: + +http://www.cisco.com/en/US/support/tsd_most_requested_tools.html +Some of the tools available at this website require login credentials with appropriate privilege levels. + +Using Cisco IOS to Verify and Define the Problem + +When you receive a trouble ticket, your first couple of tasks should be to verify and define the problem. Some relatively simple tasks can confirm the issue reported and in most cases help to focus your troubleshooting efforts. Three easy-to-use tools built in to the Cisco IOS can help you verify connectivity and further define the problem. They are ping, Telnet, and traceroute. This section discusses how ping, Telnet, and traceroute can verify the problem and help focus our efforts. + + + + + +Key Topic + +Ping + +A common command, which you can use to check network connectivity, is the ping com-mand. If you recall from Chapter 1, a successful ping indicates that Layer 1, 2, and 3 of the OSI model are functioning, and so you can focus your attention on higher OSI layers. The same holds true in reverse with an unsuccessful ping. If it is unsuccessful, you focus your troubleshooting on the lower layers of the OSI model. + +A basic ping command sends Internet Control Message Protocol (ICMP) echo messages to a specified destination. For every ICMP echo reply received from that specified desti- +nation, an exclamation point appears in the output, as shown in Example 2-21. + + +Example 2-21 Basic ping Command + +R1#ping 10.4.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.4.4.4, timeout is 2 seconds: +!!!!! + +The ping command does have several options that can prove useful during troubleshoot-ing, including the following: + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 65 + +■ size: Specifies the number of bytes per datagram (defaults to 100 bytes on Cisco IOS) + +■ repeat: Specifies the number of ICMP echo messages sent (defaults to 5) + +■ timeout: Specifies the number of seconds to wait for an ICMP echo reply (defaults to 2) + +■ source: Specifies the source of the ICMP echo datagrams + +■ df-bit: Sets the do not fragment bit in the ICMP echo datagram + +Not only can a ping command indicate that a given IP address is reachable, but the response to a ping command might provide insight into the nature of a problem. For example, if the ping results indicate alternating failures and successes (that is, !.!.!), a troubleshooter might conclude that traffic is being load balanced between the source and destination IP addresses. Traffic flowing across one path is successful, whereas traffic flowing over the other path is failing. + +You can also use the ping command to create a load on the network to troubleshoot the network under heavy use. For example, you can specify a datagram size of 1500 bytes, along with a large byte count (repeat value) and a timeout of 0 seconds, as shown in Example 2-22. + +Notice that all the pings failed. These failures occurred because of the 0-second timeout. The router did not wait before considering the ping to have failed and sending another ICMP echo message. Remember, in this case, we do not care that it failed; we are doing this for the artificial load generated for testing purposes. + +Example 2-22 Creating a Heavy Load on the Network + +R1#ping 10.4.4.4 size 1500 repeat 9999 timeout 0 + +Type escape sequence to abort. +Sending 9999, 1500-byte ICMP Echos to 10.4.4.4, timeout is 0 seconds: +...................................................................... +...................................................................... +...................................................................... +...OUTPUT OMITTED... + +Perhaps you suspect that an interface has a nondefault maximum transmission unit (MTU) size, which is commonly seen with Q-n-Q tunnels, generic routing encapsulation (GRE) tunnels, and even Point-to-Point Protocol over Ethernet (PPPoE) interfaces. To ver-ify your suspicion, you could send ICMP echo messages across that interface using the df-bit and size options of the ping command to specify the size of the datagram to be sent. The df-bit option instructs a router to drop this datagram rather than fragmenting it if fragmentation is required. + +Example 2-23 shows the sending of pings with the do not fragment bit set. Notice the M in the ping responses, which indicates that fragmentation was required but could not be performed because the do not fragment bit was set. Therefore, you can conclude that a link between the source and destination is using a nonstandard MTU (that is, an MTU less than 1500 bytes). + + + +From the Library of Outcast Outcast +66 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 2-23 Pinging with the Do Not Fragment Bit Set + +R1#ping 10.4.4.4 size 1500 df-bit +Type escape sequence to abort. +Sending 5, 1500-byte ICMP Echos to 10.4.4.4, timeout is 2 seconds: +Packet sent with the DF bit set +M.M.M + +The challenge is how to determine the nondefault MTU size without multiple manual attempts. An extended ping can help with such a scenario. Consider Example 2-24, which issues the ping command without command-line parameters. This invokes the extended ping feature. The extended ping feature enables you to granularly customize your pings. For example, you could specify a range of datagram sizes to use in your pings to help determine the size of a nondefault MTU. Specifically, in Example 2-24 you could deter-mine that the MTU across at least one of the links from the source to the destination IP address was set to 1450 bytes, because the M ping responses begin after 51 ICMP echo datagrams were sent (with datagram sizes in the range of 1400 to 1450 bytes). + +Example 2-24 Extended Ping Performing a Ping Sweep + +R1#ping +Protocol [ip]: +Target IP address: 10.4.4.4 +Repeat count [5]: 1 +Datagram size [100]: +Timeout in seconds [2]: +Extended commands [n]: y +Source address or interface: +Type of service [0]: +Set DF bit in IP header? [no]: yes +Validate reply data? [no]: +Data pattern [0xABCD]: +Loose, Strict, Record, Timestamp, Verbose[none]: +Sweep range of sizes [n]: y +Sweep min size [36]: 1400 +Sweep max size [18024]: 1500 +Sweep interval [1]: +Type escape sequence to abort. +Sending 101, [1400..1500]-byte ICMP Echos to 10.4.4.4, timeout is 2 seconds: +Packet sent with the DF bit set +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!M.M.M.M.M.M.M.M.M.M +.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M. +Success rate is 50 percent (51/101 ), round-trip min/avg/max = 60/125/232 ms + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 67 + +Telnet + + + +Key Topic + +As you just read, the ping command is useful for testing Layer 3 (that is, the network layer) connectivity. The telnet command is useful for troubleshooting Layer 4 (that is, the transport layer) and Layer 7 (that is, the application layer). By default, Telnet uses TCP port 23; however, you can specify an alternate port number to see whether a particular TCP Layer 4 service is running at a destination IP address. Such an approach might prove useful if you are using a divide-and-conquer approach, starting at Layer 3 (which was determined to be operational as a result of a successful ping), or a bottom-up approach (which has also confirmed Layer 3 to be operational). At this point, you could use telnet to test the transport layer. + +To illustrate, notice the telnet 192.168.1.50 80 command issued in Example 2-25. This command causes router R1 to attempt a TCP connection with 192.168.1.50 using port 80 (the HTTP port). The response of Open indicates that 192.168.1.50 is indeed running a +service on port 80. + + +Example 2-25 Using Telnet to Test the Transport Layer (Success) + +R1#telnet 192.168.1.50 80 +Trying 192.168.1.50, 80 ... Open + +Let’s consider a situation where users indicate that they are unable to connect to the mail server at 192.168.1.51. The mail server uses SMTP port 25. The result of using Telnet to test the transport layer shows that port 25 is not responding on the mail server as shown in Example 2-26. Therefore, you may want to start by checking whether the server is operational and verifying that no access control lists (ACLs) are denying connectivity to port 25. + +Example 2-26 Using Telnet to Test the Transport Layer (Failure) + +R1#telnet 192.168.1.51 25 +Trying 192.168.1.51, 25 ... +% Connection refused by remote host + + + + + +Key Topic + +Traceroute + +The traceroute command provides valuable information during the troubleshooting process. The first is verified connectivity. If the trace completes successfully, we have verified Layer 3 connectivity, which is what the ping command provides us. The second valuable piece of information is the path that the trace took through the network. This is something that the ping command does not provide. Therefore, if we issue the command ping 10.4.4.4 and it fails, we could then issue the traceroute 10.4.4.4 command to get an idea of where the ping is failing. Example 2-27 displays the output of a successful trace +to the router that has the IP address 10.4.4.4. + + + + + + + +From the Library of Outcast Outcast +68 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 2-27 Using Traceroute + +R1#traceroute 10.4.4.4 +Type escape sequence to abort. +Tracing the route to 10.4.4.4 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.1.2 24 msec 44 msec 28 msec +2 10.1.2.2 24 msec 64 msec 36 msec +3 10.1.3.2 64 msec 52 msec 84 msec +4 10.1.4.4 100 msec * 72 msec + +Example 2-28 shows an unsuccessful ping from R1 to 10.4.4.4. We then use traceroute to get a better picture of where this ping is failing so we can focus our attention around that part of the network. + +Example 2-28 Using Traceroute to Follow The Path + +R1#ping 10.4.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.4.4.4, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) +R1#traceroute 10.4.4.4 +Type escape sequence to abort. +Tracing the route to 10.4.4.4 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.1.2 44 msec 36 msec 44 msec +2 10.1.2.2 68 msec 88 msec 88 msec +3 * * * +4 * * * +5 * * * +6 * * * +...OUTPUT OMITTED... + +If you see a repeating pattern of IP addresses in the output of traceroute (for example, 10.1.2.2, 10.1.3.2, 10.1.2.2, 10.1.3.2, 10.1.2.2, 10.1.3.2), you have a routing loop. + +Using Cisco IOS to Collect Information + +After a problem has been clearly defined, the first step in diagnosing that problem is col-lecting information, as described in Chapter 1. Because the collection of information can be one of the most time-consuming of the troubleshooting processes, the ability to quickly collect appropriate information becomes a valuable troubleshooting skill. Would you prefer to search for the needle in a haystack by moving one piece of straw at a time, or would you prefer to use the biggest strongest magnet in the world and attract the needle out of the haystack? I choose the magnet. You do not want to spend your time +looking for the needle in a haystack. Time is valuable. This section introduces basic Cisco + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 69 + +IOS commands useful in gathering information and discusses the filtering of irrelevant information from the output of those commands. Also included in this section are com-mands helpful in diagnosing connectivity and hardware issues. + +Filtering the Output of show Commands + +Cisco IOS offers multiple show commands and debug commands that are useful for gath-ering information. Throughout this book, you will be introduced to a considerable num-ber of show and debug commands. However, many of these commands produce a large quantity of output. + +Consider the output shown in Example 2-29. The output from the show processes cpu command generated approximately 180 lines of output, making it challenging to pick out a single process. + +Example 2-29 show processes cpu Command Output + +R1#show processes cpu +CPU Utilization for five seconds: 0%/0%; one minute: 0%; five minute: 0% +PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTy process + +1 4 3 +2 7245 1802 + +1333 0.00% +4020 0.08% + +0.00% 0.00% +0.08% 0.08% + +0 Chunk Manager +0 Load Meter + + + +3 56 2040 +4 4 1 + +27 0.00% +4000 0.00% + +0.00% 0.00% +0.00% 0.00% + +0 OSPF Hello 1 +0 EDDRI_MAIN + + + +5 21998 1524 +6 0 1 +7 0 2 +8 0 1 +9 0 302 +10 731 1880 + +14434 0.00% +0 0.00% +0 0.00% +0 0.00% +0 0.00% +388 0.00% + +0.32% 0.25% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% + +0 Check heaps +0 Pool Manager +0 Timers +0 Crash Writer +0 Environmental mo +0 APR Input + +...OUTPUT OMITTED... + +171 0 1 +172 4 2 +173 0 1 +174 0 1 +175 12 6 +176 12 151 +177 4 17599 +178 0 1 +179 8 314 + +0 0.00% +2000 0.00% +0 0.00% +0 0.00% +2000 0.00% +79 0.00% +0 0.00% +0 0.00% +25 0.00% + +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% +0.00% 0.00% + +0 lib_off_app +0 Voice Player +0 Media Record +0 Resource Measure +0 Session Applicat +0 RTPSPI +0 IP NAT Ager +0 IP NAT WALN +0 CEF Scanner + + +Perhaps you were only looking for CPU utilization statistics for the Check heaps process. Because you know that the content of the one line you are looking for contains the text Check heaps, you could take the output of the show processes cpu command and pipe + + + + + + +From the Library of Outcast Outcast +70 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +that output (that is, use the | character) to the include Check heaps statement. The piping of the output causes the output to be filtered to only include lines that include the text Check heaps, as demonstrated in Example 2-30. This type of filtering can help trouble-shooters more quickly find the data they are looking for. However, realize the information you are looking for is case sensitive. Therefore, check heaps is not the same as Check heaps. + +Example 2-30 Filtering the show processes cpu Command Output + +R1#show processes cpu | include Check heaps +5 24710 1708 14467 1.14% 0.26% 0.24% 0 Check heaps + +Example 2-30 gave us some interesting values; but what do they mean? If you go back to Example 2-29, you will notice column headers that were omitted in Example 2-30. Therefore, we have to tweak our command so that we can receive the column headers as shown in Example 2-31. Notice that when specifying the additional pipes (|) there is no space because it is an “or” operation. + +Example 2-31 Filtering the show processes cpu Command Output with Column Headers + +R1#show processes cpu | include Check heaps|^CPU|^ PID +CPU utilization for five seconds: 3%/100%; one minute: 4%; five minutes: 4% +PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process +5 24710 1708 14467 1.14% 0.26% 0.24% 0 Check heaps + +In Example 2-31 we modified the show processes cpu | include Check heaps command to include |^CPU|^ PID. The ^ is a regular expression that represents “begins with.” Therefore, these additions state to include any line that begins with CPU or (space)PID. Now those interesting values have meaning because the column headers are included. + +In addition, with the show processes cpu command, you can sort by 5-second, 1-minute, and 5-minute utilization with the sorted parameter. This allows you to place in descend-ing order those processes that are consuming the most CPU resources. + +Similar to piping output to the include option, you could alternatively pipe output to the exclude option. The exclude option can display all lines of the output except lines con-taining the string you specify. For example, the show ip interfaces brief command can display IP addresses and interface status information for interfaces on a router and switch, as shown in Example 2-32. + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 71 + +Example 2-32 show ip interface brief Command Output + +R1#show ip interface brief + +Interface +FastEthernet0/0 +Serial0/0 +FastEthernet0/1 +Serial0/1 +NVI0 +Loopback0 + +IP-Address OK? +192.168.1.11 YES +unassigned YES +192.168.0.11 YES +unassigned YES +unassigned YES +10.1.1.1 YES + +Method Status +NVRAM up +NVRAM administratively down +NVRAM up +NVRAM administratively down +unset up +NVRAM up + +Protocol +up +down +up +down +up +up + + +Notice in Example 2-32 that some of the interfaces have an IP address of unassigned. If you want to only view information pertaining to interfaces with assigned IP addresses, you can pipe the output of the show ip interface brief command to exclude unassigned, as illustrated in Example 2-33. + +Example 2-33 Filtering Output from the show ip interface brief Command Using exclude + +R1#show ip interface brief | exclude unassigned + +Interface +FastEthernet0/0 +FastEthernet0/1 +Loopback0 + +IP-Address OK? +192.168.1.11 YES +192.168.0.11 YES +10.1.1.1 YES + +Method Status +NVRAM up +NVRAM up +NVRAM up + +Protocal +up +up +up + + +As another example, you might be troubleshooting an OSPF routing protocol issue and want to see the section of your running configuration where the routing protocol config-uration begins. Piping the output of the show running-config command to begin router, as shown in Example 2-34, skips the initial portion of the show running-config output and begins displaying the output where the first instance of router is seen in the running configuration. + +Example 2-34 Filtering Output from the show running-config Command Using begin + +R1#show running-config | begin router +router eigrp 100 +network 10.0.0.0 +network 192.168.1.0 + +router ospf 1 +log-adjacency-changes +network 0.0.0.0 255.255.255.255 area 0 +...OUTPUT OMITTED... + + + + + + + + + +From the Library of Outcast Outcast +72 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +However, if the first instance of router appears in the running configuration before the router ospf section (as in Example 2-34), you will still have to sift through the running configuration until you get to the router ospf section. Because we are trying to find +a specific section (in this case OSPF) in the running configuration, we can pipe the output to a section. In Example 2-35, we pipe the output of the show running-config command to section router ospf and only get output from the router ospf section. As stated earlier, when piping, you need to specify the exact case and the exact spacing. For example, section GigabitEthernet0/1 works, but section GigabitEthernet 0/1, section Gigabitethernet0/1, and section Gi0/1 do not work. + +Example 2-35 Filtering Output from the show running-config Command Using section + +R1#show running-config | section router ospf +router ospf 1 +log-adjacency-changes +network 0.0.0.0 255.255.255.255 area 0 +...OUTPUT OMITTED... + +Another command that often generates a lengthy output, especially in larger environ-ments, is the show ip route command. Consider, for example, the output of show ip route presented in Example 2-36. + +Example 2-36 Sample show ip route Command Output + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/65] via 192.168.0.22, 00:50:57, FastEthernet0/1 +O 172.16.2.0 [110/65] via 192.168.0.22, 00:50:57, FastEthernet0/1 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O 10.2.2.2/32 [110/2] via 192.168.0.22, 00:50:57, FastEthernet0/1 +O 10.1.3.0/30 [110/129] via 192.168.0.22, 00:50:57, FastEthernet0/1 +O 10.3.3.3/32 [110/66] via 192.168.0.22, 00:50:57, FastEthernet0/1 +O 10.1.2.0/24 [110/75] via 192.168.0.22, 00:50:58, FastEthernet0/1 +C 10.1.1.1/32 is directly connected, Loopback0 +O 10.4.4.4/32 [110/66] via 192.168.0.22, 00:50:58, FastEthernet0/1 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 73 + +Although the output shown in Example 2-36 is relatively small, some IP routing tables contain hundreds or even thousands of entries. If you want to determine whether a route for network 172.16.1.0 is present in a routing table, for instance, you could issue the com-mand show ip route 172.16.1.0, as depicted in Example 2-37. + +Example 2-37 Specifying a Specific Route with the show ip route Command + +R1#show ip route 172.16.1.0 +Routing entry for 172.16.1.0/30 +Known via "ospf 1", distance 110, metric 65, type intra area +Last update from 192.168.0.22 on FastEthernet0/1, 00:52:08 ago +Routing Descriptor Blocks: +* 192.168.0.22, from 10.2.2.2, 00:52:08 ago, via FastEthernet0/1 +Route metric is 65, traffic share count is 1 + +Perhaps you are looking for all subnets of the 172.16.0.0/16 address space. In that event, you could specify the subnet mask and the longer-prefixes argument as part of your command. Such a command, as demonstrated in Example 2-38, shows all subnets of net-work 172.16.0.0/16. + +Example 2-38 Filtering Output from the show ip route Command with the longer-prefixes Option + +R1#show ip route 172.16.0.0 255.255.0.0 longer-prefixes +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/65] via 192.168.0.22, 00:51:39, FastEthernet0/1 +O 172.16.2.0 [110/65] via 192.168.0.22, 00:51:39, FastEthernet0/1 + + +Redirecting show Command Output to a File + +Imagine that you are working with Cisco Technical Assistance Center (TAC) to trouble-shoot an issue, and they want a file containing output from the show tech-support command issued on your router. Are you going to issue the command and then copy and paste it from your terminal window to a text editor? That is one option. However, Example 2-39 shows how you can use the | redirect option to send output from a show command to a file. In this case, it is the show tech-support command being sent to a file on a TFTP server. + + + +From the Library of Outcast Outcast +74 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Notice that directing output to a file suppresses the onscreen output, as shown in Example 2-39. If you want the show command to be displayed onscreen and stored to a file, you can pipe the output with the tee option, as demonstrated in Example 2-40. + +Example 2-39 Redirecting Output to a TFTP Server + +R1#show tech-support | redirect tftp://192.168.1.50/tshoot.txt +! +R1# + + +Example 2-40 Redirecting Output While Also Displaying the Output Onscreen + +R1#show tech-support | tee tftp://192.168.1.50/tac.txt +! + +---------------------show version--------------------- + +Cisco IOS Software, C2600 Software (C2600-IPVOICE_IVS-M), Version 12.4(3b), RELEASE SOFTWARE (fc3) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2005 by Cisco Systems, Inc. +Compiled Thu 08-Dec-05 17:35 by alnguyen +...OUTPUT OMITTED... + +In situations where you already have an output file created and you want to append the output of another show command to your existing file, you can pipe the output of your show command with the append option. Example 2-41 shows how to use the append option to add the output of the show ip interface brief command to a file named base-line.txt that was created at an earlier time and already contains information. Note that this does not overwrite the existing file; it simply adds the new information to it. + +Example 2-41 Appending Output to an Existing File + +R1#show ip interface brief | append tftp://192.168.1.50/baseline.txt +! +R1# + + +Troubleshooting Hardware + +In addition to software configurations, a network’s underlying hardware often becomes a troubleshooting target. As a reference, Table 2-4 offers a collection of Cisco IOS com-mands used to investigate hardware performance issues. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 75 + +Table 2-4 Cisco IOS Commands for Hardware Troubleshooting Key +Topic Command Description + + +show processes cpu + + +show memory + +show interfaces + +Provides 5-second, 1-minute, and 5-minute CPU utilization statistics, in addition to a listing of processes running on a platform along with each process’s utilization statistics +Displays summary information about processor and I/O memory, followed by a more comprehensive report of memory utilization +Shows Layer 1 and Layer 2 interface status, interface load information, and error statistics including the following: + +input queue drops: Indicates a router received information faster than the information could be processed by the router + +output queue drops: Indicates a router is not able to send information out the outgoing interface because of congestion (perhaps because of an input/output speed mismatch) + +input errors: Indicates frames were not received correctly (for example, a cyclic redundancy check (CRC) error occurred), perhaps indicating a cabling problem or a duplex mismatch + +output errors: Indicates frames were not transmitted correctly, perhaps due to a duplex mismatch + + +Note Prior to collecting statistics, interface counters can be reset using the clear coun-ters command. + + +show controllers + + + + +show platform + +Displays statistical information about an interface (for example, error statistics), where the information varies for different interface types (for example, the type of connected cable might be displayed for +a serial interface and whether it is the DCE side or DTE side of the cable) +Provides detailed information about a router or switch hardware platform + + + + +Collecting Information in Transit + +Information you collect while troubleshooting is not always going to be at rest. You will sometimes need to collect information while it is in transit. This section discusses how we can capture packets on the network that are flowing through our switches. + +Performing Packet Captures + +You can use dedicated appliances or PCs running packet capture software to collect and store packets flowing across a network link. When troubleshooting, analysis of captured + + + + +From the Library of Outcast Outcast +76 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +packets can provide insight into how a network is treating traffic flow. For example, a packet capture data file can show whether packets are being dropped or if sessions are being reset. You can also look inside Layer 2, 3, and 4 headers using a packet-capture application. For example, you can view a packet’s Layer 3 header to determine that packet’s Layer 3 quality of service (QoS) priority marking. An example of a popular and free packet-capture utility you can download is Wireshark (http://www.wireshark.org), as shown in Figure 2-5. + +Capturing and analyzing packets, however, presents two major obstacles. First, the vol-ume of data collected as part of a packet capture can be so large that finding what you are looking for can be a challenge. Therefore, you should understand how to use your packet capture application’s filtering features. + + + + + + + + + + + + + + + + + + + + + + + +Figure 2-5 Wireshark Packet-Capture Application + + +SPAN + + + +Key Topic + +A second challenge occurs when you want to monitor, for example, traffic flow between two network devices connected to a switch. By default, the packets traveling between those two devices will not be seen by your packet-capturing device. This is because of how the switch is designed to behave. A switch is designed to forward frames based on the destination MAC address of a frame. When a frame is received, the switch looks in the MAC address table to determine which port the frame should be forwarded out based +on the destination MAC address. Therefore, if the frame is not destined (based on the + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 77 + +MAC address) for the device with the packet-capturing software, the frame will not be sent out the port connected to that device. This behavior ensures that end-user devices do not see frames that are not intended for them. + +Fortunately, Cisco IOS supports a feature known as Switched Port Analyzer (SPAN). SPAN instructs a switch to send copies of packets seen on one port (or one VLAN) to another port where the packet capturing device is connected, as shown in Figure 2-6. + + + +Gig 0/1 Gig 0/2 + + +Gig 0/3 +Server Copy of Traffic Sent To +the Server + + +Copy of Traffic Client Sent From +the Server + + + + + +Laptop Running Packet Capture Application + +Figure 2-6 Cisco Catalyst Switch Configured for SPAN + +Notice that Figure 2-6 depicts a client (connected to Gigabit Ethernet 0/2) communicat-ing with a server (connected to Gigabit Ethernet 0/1). A troubleshooter inserts a packet capture device into Gigabit Ethernet 0/3. However, because the switch’s default behav-ior prevents frames that are flowing between the client and server from being sent out any other port, the laptop running the packet capture application will not see any of these frames. To cause port Gigabit Ethernet 0/3 to receive a copy of all frames sent or received by the server, SPAN is configured on the switch, as shown in Example 2-42. + +Notice that Example 2-42 uses the monitor session id source interface interface_type interface_number command to indicate that a SPAN monitoring session with a locally significant identifier of 1 will copy packets crossing (that is, entering and exiting) port Gigabit Ethernet 0/1. Then the monitor session id destination interface interface_type interface_number command is used to specify port Gigabit Ethernet 0/3 as the destina-tion port for those copied packets. A laptop running packet capture software connected to port Gigabit Ethernet 0/3 will now receive a copy of all traffic the server is sending or receiving. + +Example 2-42 SPAN Configuration + +SW1#conf term +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)#monitor session 1 source interface gig 0/1 +SW1(config)#monitor session 1 destination interface gig 0/3 +SW1(config)#end +SW1#show monitor + + + +From the Library of Outcast Outcast +78 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Session 1 +------------ +Type : Local Session +Source Ports : +Both : Gi0/1 + +Destination Ports +Encapsulation + +: Gi0/3 +: Native + +Ingress : Disabled + + + + + +Key Topic + +RSPAN + +In larger environments, a network capture device connected to one switch might need to capture packets flowing through a different switch. Remote SPAN (RSPAN) makes such a scenario possible. Consider Figure 2-7, where a troubleshooter has her laptop running a packet capture application connected to port Fast Ethernet 5/2 on switch SW2. The traf-fic that needs to be captured is traffic coming from and going to the server connected to port Gigabit Ethernet 0/1 on switch SW1. + +A VLAN is configured whose purpose is to carry captured traffic between the switches. Therefore, a trunk exists between switches SW1 and SW2 to carry the SPAN VLAN in addition to a VLAN carrying user data. Example 2-43 shows the configuration on switch SW1 used to create the RSPAN VLAN (that is, VLAN 20) and to specify that RSPAN should monitor port Gigabit Ethernet 0/1 and send packets sent and received on that port out of Gigabit Ethernet 0/3 on VLAN 20. (Note that the reflector-port parameter is not required on all switches [for example, a 2960].) The show monitor command is then used to verify the RSPAN source and destination. Also, note that by default the monitor session id +source command monitors both incoming and outgoing traffic on the monitored port. + + +Example 2-43 RSPAN Configuration on Switch SW1 + +SW1#conf term +SW1(config)#vlan 20 +SW1(config-vlan)#name SPAN +SW1(config-vlan)#remote-span +SW1(config-vlan)#exit +SW1(config)#monitor session 1 source interface gig 0/1 +SW1(config)#monitor session 1 destination remote vlan 20 reflector-port gig 0/3 +SW1(config)#end +SW1#show monitor +Session 1 +------------ +Type: Remote Source Session + +Source Ports: +Both : Gi0/1 + +Reflector Port: Gi0/3 +Dest RSPAN VLAN: 20 + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 79 + + + +Gig 0/1 Gig 0/2 SW1 +Server Gig 0/3 Client +Trunk Carrying +SPAN VLAN + + + +Fa 5/1 + +SW2 Fa 5/2 + + +Copy of Traffic Sent To the Server + +Copy of Traffic Sent From the Server + + + + + + +Laptop Running Packet Capture Application + +Figure 2-7 Cisco Catalyst Switch Configured for RSPAN + +Example 2-44 shows the configuration on switch SW2 used to create the RSPAN VLAN to specify that RSPAN should receive captured traffic from VLAN 20 and send it out port Fast Ethernet 5/2. + +Example 2-44 RSPAN Configuration on Switch SW2 + +SW2#conf term +SW2(config)#vlan 20 +SW2(config-vlan)#name SPAN +SW2(config-vlan)#remote-span +SW2(config-vlan)#exit +SW2(config)#monitor session 2 source remote vlan 20 +SW2(config)#monitor session 2 destination interface fa 5/2 +SW2(config)#end +SW2#show monitor +Session 2 +------------ +Type : Remote Destination Session +Source RSPAN VLAN : 20 +Destination Ports : Fa5/2 + + + + + +From the Library of Outcast Outcast +80 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + + + + + +Key Topic + +Using Tools to Document a Network + +An important undertaking for every network team is documenting the existing network. As stressed throughout this book, accurate documentation is a must. Therefore, this sec-tion covers the CLI commands that enable you to build a network diagram. + +Your network currently has no network diagram. You are connected to R1 via the console port, as shown in Figure 2-8. Your first task is to find out the types of interfaces that are up/up, and the IP addresses associated with them. To accomplish this, you issue the show +ip interface brief command, as shown in Example 2-45. + + + +R1 + + + + + + +Figure 2-8 Connected to R1 via the Console Port + +Example 2-45 Output of show ip interface brief Command on R1 + +R1#show ip interface brief + +Interface +FastEthernet0/0 + +IP-Address +192.168.1.1 + +OK? Method Status +YES manual up + +Protocol +up + +FastEthernet0/1 unassigned YES TFTP administratively down down +Serial0/0/0 172.16.1.1 YES manual up up + +Serial0/0/1 +Serial0/2/0 +Serial0/2/1 + +unassigned +unassigned +unassigned + +YES NVRAM +YES NVRAM +YES NVRAM + +administratively down down +administratively down down +administratively down down + + +You can gather from the output in Example 2-45 that R1 has Fast Ethernet 0/0 up/up with an IP address of 192.168.1.1. It also has Serial 0/0/0 up/up with an IP address of 172.16.1.1. You can add this information to your diagram, as shown in Figure 2-9. + + +FastEthernet 0/0 192.168.1.1 + +Serial 0/0/0 172.16.1.1 +R1 + + + + + + + +Figure 2-9 Discovered Ethernet and Serial Interfaces on R1 + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 81 + +Next, you want to determine which Cisco devices are connected to R1. You accomplish this using the show cdp neighbors command, as shown in Example 2-46. You can also use the IEEE standard Link Layer Discovery Protocol (LLDP) to discover neighboring Cisco and Non-Cisco devices if you have enabled it. + +Example 2-46 Output of the show cdp neighbors Command on R1 + +R1#show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + +Device ID Local Intrfce Holdtme Capability Platform Port ID +SW1 Fas 0/0 139 S I WS-C2960- Fas 0/24 +R2 Ser 0/0/0 133 S I 2811 Ser 0/0/0 + +You observe from the output in Example 2-46 that R1 is connected to a Catalyst 2960 switch named SW1 out Fast Ethernet 0/0. It also indicates that SW1 is using Fast Ethernet 0/24 to connect to R1. You also observe that R1 is connected to a 2811 series router named R2 out Serial 0/0/0 and that R2 is using Serial 0/0/0 to connect to R1. You add this information to the diagram, as shown in Figure 2-10. + + +FastEthernet 0/0 192.168.1.1 + +Serial 0/0/0 172.16.1.1 + + + +SW1 FastEthernet 0/24 2960 + +R1 Serial 0/0/0 R2 2811 + + + + + + +Figure 2-10 Adding SW1 and R2 to the Diagram + +You need to discover the IP address of Serial 0/0/0 on R2 and the management IP address on SW1. To accomplish this, you use the show cdp neighbors detail command, as shown in Example 2-47. You observe from the output that Serial 0/0/0 on R2 has the IP address 172.16.1.2 and that the management IP address on SW1 is 192.168.1.2. You add this infor-mation to the diagram, as shown in Figure 2-11. In addition, the show cdp neighbors detail command will also provide the Cisco IOS Software version that is running on the neighbor. + +Example 2-47 Output of the show cdp neighbors Command on R1 + +R1#show cdp neighbors detail +------------------------- +Device ID: SW1 +Entry address(es): +IP address: 192.168.1.2 + + + + +From the Library of Outcast Outcast +82 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Platform: cisco WS-C2960-24TT-L, Capabilities: Switch IGMP +Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/24 +Holdtime : 153 sec + +Version : +Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(2)SE, RELEASE SOFTWARE (fc1) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2012 by Cisco Systems, Inc. +Compiled Sat 28-Jul-12 00:29 by prod_rel_team + +advertisement version: 2 +Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFF FFFFF010220FF000000000000081FF34EB800FF0000 +VTP Management Domain: '' +Native VLAN: 1 +Duplex: full +------------------------- +Device ID: R2 +Entry address(es): +IP address: 172.16.1.2 +Platform: Cisco 2811, Capabilities: Switch IGMP +Interface: Serial0/0/0, Port ID (outgoing port): Serial0/0/0 +Holdtime: 127 sec + +Version : +Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 15.1(4)M5, RELEASE SOFTWARE (fc1) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2012 by Cisco Systems, Inc. +Compiled Tue 04-Sep-12 15:56 by prod_rel_team + +advertisement version: 2 +VTP Management Domain: '' + + +FastEthernet 0/0 192.168.1.1 + +Serial 0/0/0 172.16.1.1 + + + +SW1 FastEthernet 0/24 2960 +Management IP 192.168.1.2 + +R1 Serial 0/0/0 R2 172.16.1.2 2811 + + + + +Figure 2-11 Updating IPs in Diagram for SW1 and R2 + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 83 + +Finally, you need to include the type of router R1 is. You use the show version command, as shown in Example 2-48, which indicates it is also a 2811 series router. You can also verify the Cisco IOS Software version, the system bootstrap version, the number of inter-faces, and the configuration register. + +Example 2-48 Output of the show version Command on R1 + +R1#show version +Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 15.1(4)M5, RELEASE SOFTWARE (fc1) + +...output omitted... + +ROM: System Bootstrap, Version 12.4(1r) [hqluong 1r], RELEASE SOFTWARE (fc1) + +R1 uptime is 14 minutes +System returned to ROM by power-on +System image file is "flash:c2800nm-adventerprisek9-mz.151-4.M5.bin" +Last reload type: Normal Reload + +...output omitted... + +Cisco 2811 (revision 1.0) with 247808K/14336K bytes of memory. +Processor board ID FTX1023A49D +2 FastEthernet interfaces +4 Serial(sync/async) interfaces +1 Virtual Private Network (VPN) Module +DRAM configuration is 64 bits wide with parity enabled. +239K bytes of non-volatile configuration memory. +125440K bytes of ATA CompactFlash (Read/Write) + +...output omitted... + +------------------------------------------------- +Device# PID SN +------------------------------------------------- +*0 CISCO2811 ...output omitted... + +Configuration register is 0x2102 + +You add the type of router to your diagram as shown in Figure 2-12. + + + + + + + + + +From the Library of Outcast Outcast +84 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +FastEthernet 0/0 192.168.1.1 + +Serial 0/0/0 172.16.1.1 + + + +SW1 FastEthernet 0/24 2960 +Management IP 192.168.1.2 + +R1 Serial 0/0/0 R2 2811 172.16.1.2 2811 + + + + +Figure 2-12 Updating R1’s Router Type in the Diagram + +As you can see, you were able to gather quite a bit of information from just four com-mands: show ip interface brief, show cdp neighbors, show cdp neighbors detail, and show version. + +Your next step in the process of building your diagram is to connect to SW1 and R2 via their console ports or via Telnet/SSH and issue the same four commands to gather infor-mation about the devices connected to them. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 85 + + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 2-5 lists a reference of these key topics and the page numbers on which each is found. + +Table 2-5 Key Topics for Chapter 2 Key +Topic Key Topic Element Description Page Number + + +List + +Example 2-2 + +Example 2-7 + +Paragraph + +Paragraph + +Table 2-2 + +Example 2-13 + +Paragraph + +Paragraph + +Paragraph + +Paragraph + +Section + +Section + +Section + +Table 2-4 + +Identifies the three categories that collected 45 information essentially falls into +Backing up a router’s startup configuration to an 49 FTP server +Viewing a configuration archive 50 + +Reviews how copying configurations into RAM is a 52 merge operation +Identifies how the configure replace command is 53 used to restore an archived configuration +Severity levels 54 + +Logging configuration 55 + +Identifies the importance of an NTP server and how 56 to configure your device to use one +Discusses how you can use SNMP and NetFlow to 58 establish baselines +Discusses how to set a device to send SNMP traps 62 to an SNMP server +Discusses how you can use EEM to monitor and 63 maintain a device +Ping 64 + +Telnet 67 + +Traceroute 67 + +Cisco IOS commands for hardware troubleshooting 75 + + + + + + +From the Library of Outcast Outcast +86 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Key Topic Element Description Page Number +Paragraph Identifies the need for SPAN when collecting data in 76 transit through a switch + +Paragraph + +Paragraph + +Identifies the need for RSPAN when collecting data 78 in transit through multiple switches +Discuss the commands and procedures needed to 80 document a network diagram + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +CLI, wiki, GUI, TFTP, FTP, HTTP, archive, running configuration, merge, configure replace, syslog, NTP, SNMP, NetFlow, EEM, ping, Telnet, traceroute, Cisco TAC, SPAN, RSPAN, CDP + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + +Command Reference to Check Your Memory + +This section includes the most important configuration and EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every com-mand, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Tables 2-6 and 2-7 with a piece of paper, read the description on the left side, and then see how much of the com-mand you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to configure and troubleshoot routers and switches. + +Table 2-6 CLI Configuration Commands + +Task Command Syntax + +Global configuration mode command, used to enter archive configuration mode +Archive configuration mode command that specifies the IP address of an FTP server and filename prefix a router uses to write its archival configuration files + + +archive + +path ftp://IP_address/filename_prefix + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 87 + + + +Task +Archive configuration mode command that causes an archival backup of a router’s configuration to be written each time the +router’s running configuration is copied to its startup configuration +Archive configuration mode command that specifies the interval used by a router to automatically back up its configuration +Global configuration mode command used to specify an FTP username credential, which no longer necessitates the user entering the username +Global configuration mode command used to specify an FTP password credential, which no longer necessitates the user entering the password +Global configuration mode command used to specify an HTTP username credential, which no longer necessitates the user entering the username +Global configuration mode command used to specify an HTTP password credential, which no longer necessitates the user entering the password +Global configuration mode command used to log events to a router’s internal buffer, optionally with a maximum number of bytes to be used by the buffer and optionally the minimum severity level of an event to be logged +Global configuration mode command used to log events to a router’s console, optionally +with a minimum severity level of an event to be logged +Global configuration mode command used to specify the IP address of a syslog server to which a router’s log files are written +Global configuration mode command used to specify a router’s local time zone and number of hours the time zone varies from Greenwich mean time (GMT) + +Command Syntax write-memory + + + + +time-period seconds + + +ip ftp username username + + + +ip ftp password password + + + +ip http client username username + + + +ip http client password password + + + +logging buffered {max_buffer_size} {minimum_severity_level} + + + + +logging console {minimum_severity_level} + + + +logging ip_address + + +clock timezone time_zone_name {+ | -} hours + + + + + + + +From the Library of Outcast Outcast +88 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Global configuration mode command used to specify a router’s time zone when daylight savings time is in effect, and when daylight savings time begins and ends + +Global configuration mode command used to specify the IP address of an NTP server +Global configuration mode command that configures SPAN, which specifies the source or destination interface for traffic monitoring +VLAN configuration mode command that indicates a VLAN is to be used as an RSPAN VLAN + +Command Syntax +clock summer-time time_zone_name recurring {1-4} beginning_day beginning_ month time {1-4} ending_day ending_ month time + +ntp server ip_address + +monitor session id {source | destination} interface interface_type interface_number + +remote-span + +Global configuration mode command that monitor session id destination remote vlan configures RSPAN on a monitored switch, VLAN_id reflector- port port_id +where the RSPAN VLAN is specified in addition to the port identifier for the port being used to flood the monitored traffic to the monitoring switch + +Note The reflector-port parameter is not required on all switches (for example, a 2960). + + +Global configuration mode command that configures RSPAN on a monitoring switch, where the RSPAN VLAN is specified + + +monitor session id source remote vlan VLAN_id + +Global configuration mode command that snmp-server community community_ defines an SNMP server read only or read/write string {ro | rw} +community string + + +Global configuration mode command that specifies SNMP contact information +Global configuration mode command that specifies SNMP location information +Global configuration mode command that forces an SNMP interface index to stay consistent during data collection, even if a device is rebooted +Interface configuration mode command that enables NetFlow for that interface inbound or outbound. +Global configuration mode command that specifies the source interface used when communicating with an external NetFlow collector + + +snmp-server contact contact_info + +snmp-server location location + +snmp-server ifindex persist + + + +ip flow ingress | egress + + +ip flow-export source interface_type interface_number + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 89 + + + +Task +Global configuration mode command that specifies the NetFlow version used by a device +Global configuration mode command that specifies the IP address and port number of an external NetFlow collector +Global configuration mode command that specifies the IP address, SNMP version, and community string of an NMS +Global configuration mode command that enables all possible SNMP traps +Global configuration mode command that creates an embedded event manager applet and enters applet configuration mode + +Command Syntax +ip flow-export version {1 | 5 | 9} + +ip flow-export destination ip_address port + +snmp-server host ip_address version {1 | 2c | 3} community_string + +snmp-server enable traps + +event manager applet name + + + + +Table 2-7 CLI EXEC commands + +Task Command Syntax +Performs a backup of a router’s startup configuration copy startup-config +to an FTP server at the specified IP address, where the ftp ://username:password@ip_ login credentials are provided by the username and address +password parameters + +Performs a backup of a router’s startup configuration copy startup-config ftp://ip_ to an FTP server at the specified IP address, where the address +login credentials have previously been added to the router’s configuration + +Displays files contained in a router’s configuration archive +Replaces (as opposed to merges) a router’s running configuration with a specified configuration archive + +Displays 5-second, 1-minute, and 5-minute CPU utilization averages, in addition to a listing of running processes with their CPU utilization +Shows all subnets within the specified address space in the routing table + + +show archive + +configure replace ftp://ip_address/ filename +show processes cpu + + +show ip route network_address subnet_mask longer-prefixes + + + + + + + + + + + +From the Library of Outcast Outcast +90 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Sends ICMP echo packets to the specified IP address, with options that include + +size: The number of bytes in the ICMP echo packet + +repeat: The number of ICMP echo packets sent + +timeout: The number of seconds the router waits for an ICMP echo reply packet after sending an ICMP echo packet + +df-bit: Sets the do not fragment bit in the ICMP echo packet +Connects to a remote IP address via Telnet using TCP port 23 by default or optionally through a specified TCP port +Displays summary information about processor and I/O memory, followed by a more comprehensive report of memory utilization +Shows Layer 1 and Layer 2 interface status, interface load information, and error statistics, including + +input queue drops: Indicates a router received information faster than the information could be processed by the router + +output queue drops: Indicates a router is not able to send information out the outgoing interface because of congestion (perhaps because of an input/output speed mismatch) + +input errors: Indicates frames were not received correctly (for example, a CRC error occurred), perhaps indicating a cabling problem or a duplex mismatch + +output errors: Indicates frames were not transmitted +correctly, perhaps due to a duplex mismatch + +Command Syntax +ping ip_address {size bytes } { repeat number} { timeout seconds} { df-bit } + + + + + + + + + +telnet ip_address {port } + + +show memory + + +show interfaces + + +Note Prior to collecting statistics, interface counters can be reset using the clear coun-ters command. + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 2: Troubleshooting and Maintenance Tools 91 + + + +Task +Displays statistical information for an interface (for example, error statistics) where the information varies for different interface types (for example, the type +of connected cable might be displayed for a serial interface) +Provides detailed information about a router or switch hardware platform + +Command Syntax show controllers + + + + +show platform + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting Switch Performance Issues: This section identifies common reasons why a switch might not be performing as expected. + +■ Troubleshooting Router Performance Issues: This section identifies common reasons why a router might not be performing as expected. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 3 + + + + + + +Troubleshooting Device Performance + + +Switches and routers consist of many different components. For example, they contain a processor, memory (volatile such as RAM and nonvolatile such as NVRAM and flash), and various interfaces. They are also responsible for performing many different tasks, +such as routing, switching, and building all the necessary tables and structures needed to perform various tasks. + +The building of the tables and structures is done by the CPU. The storage of these tables and structures is in some form of memory. The routers and switches forward traffic from one interface to another interface based on these tables and structures. Therefore, if a router’s or switch’s CPU is constantly experiencing high utilization, the memory is over-loaded, or the interface buffers are full, these devices will experience performance issues. + +This chapter discusses common reasons for high CPU and memory utilization on rout-ers and switches, in addition to how we can recognize them. This chapter also covers interface statistics because they sometimes provide the initial indication of some type of issue. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 3-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 3-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting Switch Performance Issues + +Troubleshooting Router Performance Issues + +Questions +1–4 + +5–8 + + + + + + + + + + +From the Library of Outcast Outcast +94 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. What are the components of a switch’s control plane? (Choose two.) + +a. Backplane + +b. Memory + +c. CPU + +d. Forwarding logic + +2. What are good indications that you have a duplex mismatch? (Choose two.) + +a. The half-duplex side of the connection has a high number of FCS errors. + +b. The full-duplex side of the connection has a high number of FCS errors. + +c. The half-duplex side of the connection has a high number of late collisions. + +d. The full-duplex side of the connection has a high number of late collisions. + +3. Which of the following are situations when a switch’s TCAM would punt a packet to the switch’s CPU? (Choose the three best answers.) + +a. OSPF sends a multicast routing update. + +b. An administrator telnets to a switch. + +c. An ACL is applied to a switchport. + +d. A switch’s TCAM has reached capacity. + +4. The output of a show processes cpu command on a switch displays the following in the first line of the output: + +CPU utilization for five seconds: 10%/7%; one minute: 12%; five minutes: 6% +Based on the output, what percent of the switch’s CPU is being consumed with interrupts? +a. 10 percent + +b. 7 percent + +c. 12 percent + +d. 6 percent + + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 95 + +5. Which router process is in charge of handling interface state changes? + +a. TCP Timer process + +b. IP Background process + +c. Net Background process + +d. ARP Input process + +6. Which of the following is the least efficient (that is, the most CPU intensive) of a router’s packet-switching modes? + +a. Fast switching + +b. CEF + +c. Optimum switching + +d. Process switching + +7. What command is used to display the contents of a router’s FIB? + +a. show ip cache + +b. show processes cpu + +c. show ip route + +d. show ip cef + +8. Identify common reasons that a router displays a MALLOCFAIL error. (Choose the two best answers.) + +a. Cisco IOS bug + +b. Security issue + +c. QoS issue + +d. BGP filtering + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +96 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting Switch Performance Issues + +Switch performance issues can be tricky to troubleshoot because the problem reported is often subjective. For example, if a user reports that the network is running “slowly,” the user’s perception might mean that the network is slow compared to what he expects. However, network performance might very well be operating at a level that is hamper-ing productivity and at a level that is indeed below its normal level of operation. At +that point, as part of the troubleshooting process, you need to determine what network component is responsible for the poor performance. Rather than a switch or a router, the user’s client, server, or application could be the cause of the performance issue. + +If you do determine that the network performance is not meeting technical expectations (as opposed to user expectations), you should isolate the source of the problem and diag-nose the problem on that device. This section assumes that you have isolated the device causing the performance issue, and that device is a Cisco Catalyst switch. + +Cisco Catalyst Switch Troubleshooting Targets + +Cisco offers a variety of Catalyst switch platforms, with different port densities, differ-ent levels of performance, and different hardware. Therefore, troubleshooting switches will be platform dependent. Many similarities do exist, however. For example, all Cisco Catalyst switches include the following components: + + +■ Key +Topic +■ + + +■ + + + + +■ + +Ports: A switch’s ports physically connect the switch to other network devices. These ports (also known as interfaces) allow a switch to receive and transmit traffic. + +Forwarding logic: A switch contains hardware that makes forwarding decisions based on different tables in the data plane. + +Backplane: A switch’s backplane physically interconnects a switch’s ports. Therefore, depending on the specific switch architecture, frames flowing through a switch enter through a port (that is, the ingress port), flow across the switch’s backplane, and are forwarded out of another port (that is, an egress port). + +Control plane: A switch’s CPU and memory reside in the control plane. This control plane is responsible for running the switch’s operating system and building the neces-sary structures used to make forwarding decisions—for example, the MAC address +table and the spanning-tree topology to name a few. + + +Figure 3-1 depicts these components within a switch. Notice that the control plane does not directly participate in the frame-forwarding process. However, the forwarding logic contained in the forwarding hardware comes from the control plane. Therefore, an indirect relationship exists between frame forwarding and the control plane. As a result, a continuous load on the control plane could, over time, impact the rate at which the +switch forwards frames. Also, if the forwarding hardware is operating at maximum capac- + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 97 + +ity, the control plane begins to provide the forwarding logic. So, although the control plane does not architecturally appear to impact switch performance, it should be consid-ered when troubleshooting. + + + + + + + +Control Plane Memory CPU + + +Ingress Port + +Data Plane Egress Forwarding Hardware Port +Forwarding Logic +Backplane + + + +Figure 3-1 Cisco Catalyst Switch Hardware Components + +The following are two common troubleshooting targets to consider when diagnosing a suspected switch issue: + +■ Port errors + +■ Mismatched duplex settings + +The sections that follow evaluate these target areas in greater detail. + + +Port Errors +When troubleshooting a suspected Cisco Catalyst switch issue, a good first step is to check port statistics. For example, examining port statistics can let a troubleshooter know whether an excessive number of frames are being dropped. If a TCP application is run-ning slowly, the reason might be that TCP flows are going into TCP slow start, which causes the window size, and therefore the bandwidth efficiency, of TCP flows to be reduced. A common reason that a TCP flow enters slow start is packet drops. Similarly, packet drops for a UDP flow used for voice or video could result in noticeable quality degradation, because dropped UDP segments are not retransmitted. + +Although dropped frames are most often attributed to network congestion, another pos-sibility is that the cabling could be bad. To check port statistics, a troubleshooter could leverage the show interfaces command. Consider Example 3-1, which shows the output of the show interfaces gig 1/0/9 counters command on a Cisco Catalyst 3750-E switch. Notice that this output shows the number of inbound and outbound frames seen on the specified port. + + + + + +From the Library of Outcast Outcast +98 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 3-1 show interfaces gig 1/0/9 counters Command Output + +SW1#show interfaces gig 1/0/9 counters + +Port +Gi1/0/9 +Port +Gi1/0/9 + +InOctets +31265148 +OutOctets +18744149 + +InUcastPkts +20003 +OutUcastPkts +9126 + +InMcastPkts +3179 +OutMcastPkts +96 + +InBcastPkts +1 +OutBcastPkts +6 + + +To view errors that occurred on a port, you could add the keyword of errors after the show interfaces interface_type interface_number counters command. Example 3-2 illustrates sample output from the show interfaces gig 1/0/9 counters errors command. + +Example 3-2 show interfaces gig 1/0/9 counters errors Command Output + +SW1#show interfaces gig 1/0/9 counters errors +Port Align-Err FCS-Err Xmit-Err Rcv-Err UnderSize +Gi1/0/9 0 0 0 0 0 +Port Single-Col Multi-Col Late-Col Excess-Col Carri-Sen Runts Giants +Gi1/0/9 5603 0 5373 0 0 0 0 + +Table 3-2 provides a reference for the specific errors that might show up in the output of the show interfaces interface_type interface_number counters errors command. + +Table 3-2 Errors in the show interfaces interface_type interface_number counters errors Topic Command +Key + +Error Counter +Align-Err + + + +FCS-Err + + + +Xmit-Err + + +Rcv-Err + + + +UnderSize + +Description +An alignment error occurs when frames do not end with an even number of octets, while simultaneously having a bad cyclic redundancy check (CRC). An alignment error normally suggests a Layer 1 issue, such as cabling or port (either switchport or network interface card [NIC] port) issues. +A frame check sequence (FCS) error occurs when a frame has an invalid checksum, although the frame has no framing errors. Like the Align-Err error, an FCS-Err often points to a Layer 1 issue, but it also occurs when there is a duplex mismatch. +A transmit error (that is, Xmit-Err) occurs when a port’s transmit buffer overflows. A speed mismatch between inbound and outbound links often results in a transmit error. +A receive error (that is, Rcv-Err) occurs when a port’s receive buffer overflows. Congestion on a switch’s backplane could cause the receive buffer on a port to fill to capacity, as frames await access to the switch’s backplane. However, most likely, a Rcv-Err is indicating a duplex mismatch. +An undersize frame is a frame with a valid checksum but a size less than 64 bytes. This issue suggests that a connected host is sourcing invalid frame sizes. + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 99 + + + +Error Counter Single-Col + + + +Multi-Col + + + +Late-Col + + + +Excess-Col + + + +Carri-Sen + + + + + + +Runts + +Giants + +Description +A Single-Col error occurs when a single collision occurs before a port successfully transmits a frame. Common reasons for a Single-Col error include high bandwidth utilization on an attached link or a duplex mismatch. +A Multi-Col error occurs when more than one collision occurs before a port successfully transmits a frame. Similar to the Single-Col error, +common reasons for a Multi-Col error include high bandwidth utilization on an attached link or a duplex mismatch. +A late collision is a collision that is not detected until well after the frame has begun to be forwarded. While a Late-Col error could indicate that the connected cable is too long, this is an extremely common error seen in mismatched duplex conditions. +The Excess-Col error occurs when a frame experiences 16 successive collisions, after which the frame is dropped. This error could result from high bandwidth utilization, a duplex mismatch, or too many devices on a segment. +The Carri-Sen counter is incremented when a port wants to send data on a half-duplex link. This is normal and expected on a half-duplex port, because the port is checking the wire to make sure that no traffic is present prior to sending a frame. This operation is the carrier sense procedure described by the carrier sense multiple access with collision +detect (CSMA/CD) operation used on half-duplex connections. Full-duplex connections, however, do not use CSMA/CD. +A runt is a frame that is less than 64 bytes in size and has a bad CRC. A runt could result from a duplex mismatch or a Layer 1 issue. +A giant is a frame size greater than 1518 bytes (assuming that the frame is not a jumbo frame) that has a bad FCS. Typically, a giant is caused by a problem with the NIC in an attached host. The jumbo frame has a frame size greater than 1518 bytes, but it has a valid FCS. + + + + +Mismatched Duplex Settings +As shown in Table 3-2, duplex mismatches can cause a wide variety of port errors. Keep in mind that almost all network devices, other than shared media hubs, can run in full-duplex mode. Therefore, if you have no hubs in your network, all devices should be run-ning in full-duplex mode. + +Cisco Catalyst switchports should be configured to autonegotiate both speed and duplex, which is the default setting. Two justifications for this recommendation are as follows: + +■ If a connected device supports only half-duplex, it is better for a switchport to negotiate down to half-duplex and run properly than to be forced to run full-duplex, which would result in multiple errors. + + + +From the Library of Outcast Outcast +100 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ The automatic medium-dependent interface crossover (auto-MDIX) feature can automatically detect whether a port needs a crossover or a straight-through cable to interconnect with an attached device and adjust the port to work regardless of which cable type is connected. You can enable this feature in interface configuration mode with the mdix auto command on some models of Cisco Catalyst switches. However, the auto-MDIX feature requires that the port autonegotiate both speed and duplex. + +In a mismatched duplex configuration, a switchport at one end of a connection is config-ured for full-duplex, whereas a switchport at the other end of a connection is configured for half-duplex. Among the different errors previously listed in Table 3-2, two of the biggest indicators of a duplex mismatch are a high FCS-Err counter and a high Late-Col counter. Specifically, a high FCS-Err counter is common to find on the full-duplex end of a connection with a mismatched duplex, whereas a high Late-Col counter is common on the half-duplex end of the connection. + +To illustrate, examine Examples 3-3 and 3-4, which display output based on the topol-ogy depicted in Figure 3-2. Example 3-3 shows the half-duplex end of a connection, and Example 3-4 shows the full-duplex end of a connection. The half-duplex end sends a frame because it thinks it is safe to send based on the CSMA/CD rule. The full-duplex end sends a frame because it is always safe to send and a collision should not occur. When the collision occurs in this example, SW1 will cease to transmit the remainder of the frame (because the port is half-duplex) and will record that a late collision occurred. However, SW2 will continue to send and receive frames. The frames it receives will not be complete because SW1 did not send the entire frame. Therefore, the FCS (mathemati-cal checksum) of the frame does not match, and we have FCS errors on the full-duplex side. + + +Gig 0/9 +SW1 Half-Duplex + +Fa 5/47 +Full-Duplex SW2 + + +Figure 3-2 Topology with Duplex Mismatch + +Example 3-3 Output from the show interfaces gig 1/0/9 counters errors and the show interfaces gig 1/0/9 | include duplex Commands on a Half-Duplex Port + +SW1# show interfaces gig 1/0/9 counters errors +Port Align-Err FCS-Err Xmit-Err Rcv-Err UnderSize +Gi1/0/9 0 0 0 0 0 +Port Single-Col Multi-Col Late-Col Excess-Col Carri-Sen Runts Giants +Gi1/0/9 5603 0 5373 0 0 0 0 +SW1#show interfaces gig 1/0/9 include duplex +Half-duplex, 100Mb/s, link type is auto, media type is 10/100/1000BaseTX +SW1# + + + + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 101 + +Example 3-4 Output from the show interfaces fa 5/47 counters errors and the show interfaces fa 5/47 | include duplex Commands on a Full-Duplex Port + +SW2#show interfaces fa 5/47 counters errors + +Port Align-Err FCS-Err Xmit-Err Rcv-Err UnderSize OutDiscards +Fa5/47 0 5248 0 5603 27 0 +Port Single-Col Multi-Col Late-Col Excess-Col Carri-Sen Runts Giants +Fa5/47 0 0 0 0 0 227 0 +Port SQETest-Err Deferred-Tx IntMacTx-Err IntMacRx-Err Symbol-Err +Fa5/47 0 0 0 0 0 +SW2#show interfaces fa 5/47 include duplex +Full-duplex, 100Mb/s +SW2# + +In your troubleshooting, even if you only have access to one of the switches, if you suspect a duplex mismatch, you could change the duplex settings on the switch over which you do have control. Then, you could clear the interface counters to see whether the errors continue to increment. You could also perform the same activity (for example, performing a file transfer) that the user was performing when he noticed the performance issue. By comparing the current performance to the performance experienced by the user, you might be able to conclude that the problem has been resolved by correcting a mismatched duplex configuration. + +TCAM Troubleshooting + +As previously mentioned, the two primary components of forwarding hardware are forwarding logic and backplane. A switch’s backplane, however, is rarely the cause of a switch performance issue, because most Cisco Catalyst switches have high-capacity backplanes. However, it is conceivable that in a modular switch chassis, the backplane +will not have the throughput to support a fully populated chassis, where each card in the chassis supports the highest combination of port densities and port speeds. + +The architecture of some switches allows groups of switchports to be handled by sepa-rate hardware. Therefore, you might experience a performance gain by simply moving a cable from one switchport to another. However, to strategically take advantage of this design characteristic, you must be very familiar with the architecture of the switch with which you are working. + +A multilayer switch’s forwarding logic can impact switch performance. A switch’s forwarding logic is compiled into a special type of memory called ternary content-addressable memory (TCAM), as illustrated in Figure 3-3. TCAM works with a switch’s Cisco Express Forwarding (CEF) feature in the data plane (hardware) to provide extreme-ly fast forwarding decisions. This is accomplished because information from the control plane relating to routing processes such as unicast routing, multicast routing, and policy-based routing, as well as information related to traffic policies such as security and qual-ity of service (QoS) access control lists (ACLs), is populated into the TCAM tables at +the data plane (hardware). However, if a switch’s TCAM is unable to forward traffic (for + + + +From the Library of Outcast Outcast +102 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +example, the TCAM table is full and does not have the information needed to forward the traffic), that traffic is sent (punted) to the CPU so that it can be forwarded by the switch’s CPU, which has a limited forwarding capability. + + + + + + + +Control Plane +Routing Processes Traffic Policies + +Data Plane + +TCAM + + +Figure 3-3 Populating the TCAM + +The process of the TCAM sending packets to a switch’s CPU is called punting. Consider a few reasons why a packet might be punted from a TCAM to its CPU: + + +■ +Key Topic + + +■ + + + +■ + + + +■ + +Routing protocols, in addition to other control plane protocols such as Spanning Tree Protocol (STP), that send multicast or broadcast traffic will have that traffic sent to the CPU for processing. + +Someone connecting to a switch administratively (for example, establishing a Telnet or Secure Shell [SSH] session with the switch) will have his packets sent to the CPU for processing. + +Packets using a feature not supported in hardware (for example, packets traveling over a generic routing encapsulation [GRE] tunnel) are sent to the CPU for process-ing. + +If a switch’s TCAM has reached capacity, additional packets are punted to the CPU. A TCAM might reach capacity if it has too many installed routes or configured access control lists. This is usually the case when you attempt to use a lower-end switch in place of a higher-end switch to save money. This is not generally a good +practice. + + +From the events listed, the event most likely to cause a switch performance issue is a TCAM filling to capacity. Therefore, when troubleshooting switch performance, you might want to investigate the state of the switch’s TCAM. TCAM verification commands vary among platforms, so make sure to check the documentation for your switch model. + +On most switch platforms, TCAMs cannot be upgraded. Therefore, if you conclude that a switch’s TCAM is the source of the performance problems being reported, you could either use a switch with higher-capacity TCAMs or reduce the number of entries + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 103 + +in a switch’s TCAM. For example, you could try to optimize your ACLs by being more creative with the entries or leverage route summarization to reduce the number of route entries maintained by a switch’s TCAM. Also, some switches (for example, Cisco Catalyst 2960, 3560, or 3750 series switches) enable you to change the amount of TCAM memory allocated to different switch features. This allows you to “borrow” TCAM memory that was reserved for one feature and use it for another feature, optimizing the resources on the switch. This can be accomplished by changing the Switch Database Management (SDM) template on the switch. Refer to Example 3-5, which displays the TCAM resource utilization on a Catalyst 3750E switch. Notice how a finite amount of resources has been reserved for various services and features on the switch. There is a maximum value for unicast MAC addresses, IPv4 unicast and multicast routes, as well as QoS and security access control entries. It appears from this example that SW2 has maxed out the amount of resources that are reserved for IPv4 unicast indirectly connected routes. Therefore, if a packet needs to be forwarded and the needed information is not in the TCAM, it will be punted to the CPU. + +Example 3-5 show platform tcam utilization Command Output on a Cisco Catalyst Switch + +SW2#show platform tcam utilization + + +CAM Utilization for ASIC# 0 + + +Unicast mac addresses: +IPv4 IGMP groups + multicast routes: +IPv4 unicast directly-connected routes: +IPv4 unicast indirectly-connected routes: +IPv4 policy based routing aces: +IPv4 qos aces: +IPv4 security aces: + +Max +Masks/Values + +6364/6364 +1120/1120 +6144/6144 +2048/2048 +442/442 +512/512 +954/954 + +Used +Masks/values + +35/35 +1/1 +9/9 +2048/2048 +12/12 +21/21 +42/42 + + +Note: Allocation of TCAM entries per feature uses +a complex algorithm. The above information is meant +to provide an abstract view of the current TCAM utilization + +To reallocate more resources to IPv4 routing, you can change the SDM template. Using the show sdm prefer command on SW2, as shown in Example 3-6, indicates that the current SDM template is “desktop default,” which is the default template on a 3750E Catalyst switch. In this case, more resources need to be reserved for IPv4 routing; there-fore, the template needs to be changed. + +Example 3-6 show sdm prefer Command Output on a Cisco Catalyst Switch + +SW2#show sdm prefer +The current template is "desktop default" template. +The selected template optimizes the resources in +the switch to support this level of features for + + + +From the Library of Outcast Outcast +104 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +8 routed interfaces and 1024 VLANs. + +number of unicast mac addresses: 6K +number of IPv4 IGMP groups + multicast routes: 1K +number of IPv4 unicast routes: 8K +number of directly-connected IPv4 hosts: 6K +number of indirect IPv4 routes: 2K +number of IPv4 policy based routing aces: 0 +number of IPv4/MAC qos aces: 0.5K +number of IPv4/MAC security aces: 0.875k + +Using the global configuration command sdm prefer, as shown in Example 3-7, allows you to change the SDM template. In this case, the SDM template is being changed to routing so that more resources will be used for IPv4 unicast routing. + +Example 3-7 Changing the SDM Template on a Cisco 3750E Catalyst Switch + +SW2#config t +Enter configuration commands, one per line. End with CNTL/Z. +SW2(config)#sdm prefer ? + +access +default +dual-ipv4-and-ipv6 +indirect-ipv4-and-ipv6-routing +lanbase-routing +routing +vlan +SW2(config)#sdm prefer routing + +Access bias +Default bias +Support both IPv4 and IPv6 +Supports more V4 and V6 Indirect Routes +Supports both IPv4 and IPv6 Static Routing +Unicast bias +VLAN bias + +Changes to the running SDM preferences have been stored, but cannot take effect +until the next reload. +Use 'show sdm prefer' to see what SDM preference is currently active. +SW2(config)#exit +SW2#reload +System configuration has been modified. Save? [yes/no]: yes +Building configuration... +[OK] +Proceed with reload? [confirm] + +%SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload command. + +After the reload, notice how the SDM template is listed as “desktop routing” in Example 3-8 and that more resources are now dedicated to IPv4 indirect routes. However, also notice that while more resources are allocated to IPv4 unicast routes, fewer resources are allocated to other resources, such as unicast MAC addresses. + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 105 + +Example 3-8 Verifying That the SDM Template Was Changed After Reload + +SW2#show sdm prefer +The current template is "desktop routing" template. +The selected template optimizes the resources in +the switch to support this level of features for +8 routed interfaces and 1024 VLANs. + +number of unicast mac addresses: 3K +number of IPv4 IGMP groups + multicast routes: 1K +number of IPv4 unicast routes: 11K +number of directly-connected IPv4 hosts: 3K +number of indirect IPv4 routes: 8K +number of IPv4 policy based routing aces: 0.5K +number of IPv4/MAC qos aces: 0.5K +number of IPv4/MAC security aces: 1K + +In Example 3-9, the output of show platform tcam utilization shows that the max masks/ values are now 8144/8144 for IPv4 unicast indirectly connected routes; before, they were 2048. In addition, the used masks/values are now 3148, and therefore, the TCAM can for-ward traffic without having to punt the packets to the CPU. + +Example 3-9 Verifying the tcam utilization on the 3750E Catalyst Switch + +SW2#show platform tcam utilization + + +CAM Utilization for ASIC# 0 + + +Unicast mac addresses: +IPv4 IGMP groups + multicast routes: +IPv4 unicast directly-connected routes: +IPv4 unicast indirectly-connected routes: +IPv4 policy based routing aces: +IPv4 qos aces: +IPv4 security aces: + +Max +Masks/Values + +3292/3292 +1120/1120 +3072/3072 +8144/8144 +490/490 +474/474 +964/964 + +Used +Masks/values + +35/35 +1/1 +8/8 +3148/3148 +13/13 +21/21 +42/42 + + +Note: Allocation of TCAM entries per feature uses +a complex algorithm. The above information is meant +to provide an abstract view of the current TCAM utilization + + +High CPU Utilization Troubleshooting on a Switch + + + +Key Topic + +The load on a switch’s CPU is often low, even under high utilization, thanks to the TCAM. Because the TCAM maintains a switch’s forwarding logic at the data plane, the CPU is rarely tasked to forward traffic. The show processes cpu command can be used on a Cisco Catalyst switch to display CPU utilization levels, as demonstrated in Example +3-10. + + + +From the Library of Outcast Outcast +106 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 3-10 show processes cpu Command Output on a Cisco Catalyst Switch + +SW1#show processes cpu +CPU utilization for five seconds: 19%/15%; one minute: 20%; five minutes: 13% +PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process + +1 0 4 +2 0 610 +3 128 5 +4 2100 315 + +0 0.00% 0.00% 0.00% +0 0.00% 0.00% 0.00% +25600 0.00% 0.00% 0.00% +6666 0.00% 0.05% 0.05% + +0 Chunk Manager +0 Load Meter +0 crypto sw pk pro +0 Check heaps + +...OUTPUT OMITTED... + +Notice in the output in Example 3-10 that the switch is reporting a 19 percent CPU load, with 15 percent of the CPU load used for interrupt processing. + +Although such load utilization values might not be unusual for a router, these values might be of concern for a switch. Specifically, a typical CPU load percentage dedicated to interrupt processing is no more than 5 percent. A value as high as 10 percent is consid-ered acceptable. However, the output given in Example 3-10 shows a 15 percent utiliza-tion, which is considered high for a Catalyst switch. Such a level implies that the switch’s CPU is actively involved in forwarding packets that should normally be handled by the switch’s TCAM. Of course, this value might be normal for your organization based on baseline information, even though according to Cisco it is a cause for concern. If the interrupt percent is greater than 10, take time to look into the reason why. + +Periodic spikes in processor utilization are also not a major cause for concern if such spikes can be explained. Consider the following reasons that might cause a switch’s CPU utilization to spike: + +■ The CPU is processing routing updates. + +■ The administrator is issuing a debug command (or other processor-intensive com-mands). + +■ Simple Network Management Protocol (SNMP) is being used to poll network devices. + +If you determine that a switch’s high CPU load is primarily the result of interrupts, exam-ine the switch’s packet-switching patterns and check the TCAM utilization. If the high CPU utilization is primarily the result of processes, take the time to investigate those specific processes. + +A high CPU utilization on a switch might be a result of STP. Recall that an STP failure could lead to a broadcast storm, where Layer 2 broadcast frames endlessly circulate through a network. Therefore, when troubleshooting a performance issue, realize that a switch’s high CPU utilization might be a symptom of another issue. + +Troubleshooting Router Performance Issues + +As you have seen, a Cisco Catalyst switch’s performance can be the source of network problems. Similarly, a router performance issue can impact user data flowing through the network. + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 107 + +As an administrator, you might notice a sluggish response to Telnet sessions or SSH sessions that you attempt to establish with a router. Or, you might experience longer-than-normal ping response times from a router. Such symptoms might indicate a router performance issue. In these examples, the router’s CPU is so busy it does not have time to respond to your Telnet session or the pings you have sent. + +This section investigates three potential router issues, each of which might result in poor router performance + +■ Excessive CPU utilization + +■ The packet-switching mode of a router + +■ Excessive memory utilization + + +Excessive CPU Utilization + +A router’s processor (that is, CPU) utilization escalating to a high level but only remaining at that high level for a brief time could represent normal behavior. However, if a router’s CPU utilization continually remains at a high level, network performance issues might result. Aside from latency that users and administrators can experience, a router whose CPU is overtaxed might not send routing protocol messages to neighboring routers in a timely fashion. As a result, routing protocol adjacencies can fail, resulting in some net-works becoming unreachable. + +Processes That Commonly Cause Excessive CPU Utilization +One reason that the CPU of a router might be overloaded is that the router is running a process that is taking up an unusually high percentage of its CPU resources. Following are four such processes that can result in excessive CPU utilization: + + +■ Key +Topic + +ARP Input process: The ARP Input process is in charge of sending Address Resolution Protocol (ARP) requests. This process can consume an inordinate per-centage of CPU resources if the router has to send numerous ARP requests. One configuration that can cause such a high number of ARP requests is having a default route configured that points to an Ethernet interface. For example, perhaps a router had the ip route 0.0.0.0 0.0.0.0 fastethernet 0/1 command entered in global con-figuration mode so that all packets with no explicit route in the routing table will +be forwarded out Fa0/1. At first, this appears harmless; however, such a configura-tion should be avoided because an ARP Request has to be sent for every destination IP address in every packet that is received by the router and forwarded out Fa0/1. This is because the ip route command is stating that all IP addresses (0.0.0.0 0.0.0.0) are reachable through the directly connected interface fastethernet 0/1. Therefore, instead of ARPing for the MAC address of a next-hop IP address, you ARP for the MAC address of the destination IP address in each packet. That will result in an excessive number of ARP requests, which will cause strain on the CPU. In addition, many of the ARP requests will go unanswered and result in dropped packets. The +better option is to specify the next-hop IP address because the router will only have + + + + +From the Library of Outcast Outcast +108 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +to ARP for the MAC of the next-hop IP address when forwarding the packets out Fa0/1. + +■ Net Background process: An interface has a certain number of buffers available to store packets. These buffers are sometimes referred to as the queue of an interface. If an interface needs to store a packet in a buffer but all interface buffers are in use, the interface can pull from a main pool of buffers that the router maintains. The pro-cess that allows an interface to allocate one of these globally available buffers is Net Background. If the throttles, ignored, and overrun parameters are incrementing on an interface, the underlying cause might be the Net Background process consuming too many CPU resources. + +■ IP Background process: The IP Background process handles an interface changing its state. A state change might be an interface going from an Up state to a Down state, or vice versa. Another example of state change is an interface’s IP address changing. Therefore, anything that can cause repeated state changes, such as bad cabling, might result in the IP Background process consuming a high percentage of CPU resources. + +■ TCP Timer process: The TCP Timer process runs for each TCP router connection. Therefore, many connections can result in high CPU utilization by the TCP Timer process, whether they are established or embryonic. An established TCP connection is one that has successfully completed the three-way handshake. An embryonic con-nection occurs when the TCP three-way handshake is only two-thirds completed. For example, the client sends the SYN packet to the server, and then the server sends a SYN/ACK back. At this point, the server is in the embryonic state (waiting for an ACK from the client to complete the three-way handshake and establish the connec-tion). However, if the client does not send the ACK back, the server will sit in the embryonic state until it times out. This could be due to connectivity issues or mali-cious intent. + + +Cisco IOS Commands Used for Troubleshooting High Processor Utilization +Table 3-3 offers a collection of show commands that can be valuable when troubleshoot-ing high CPU utilization on a router. + +Table 3-3 Commands for Troubleshooting High CPU Utilization +Key +Topic Command Description + +show ip arp Displays the ARP cache for a router. If several entries are +in the Incomplete state, you might suspect a malicious scan (for example, a ping sweep) of a subnet, or you have a route pointing out an Ethernet interface as described in our ARP Input process discussion. + + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 109 + + +Command Description +show interface interface_type Displays a collection of interface statistics. If the throttles, interface_number overruns, or ignored counters continually increment, +you might suspect that the Net Background process is attempting to allocate buffer space for an interface from the main buffer pool of the router. + +show tcp statistics + + + + + + +show processes cpu + + + +show processes cpu history + +Provides information about the number of TCP segments a router sends and receives, including the number of connections initiated, accepted, established, and closed. A +high number of connections can explain why the TCP Timer process might be consuming excessive CPU resources. If you see an excessive number of embryonic connections, you might be under a denial-of-service (DoS) attack. +Displays average CPU utilization over 5-second, 1-minute, and 5-minute intervals, in addition to listing all the router processes and the percentage of CPU resources consumed by each of those processes. +Displays a graphical view of CPU utilization over the past 60 seconds, 1 hour, and 3 days. This graphical view can indicate whether an observed high CPU utilization is a temporary spike in utilization or whether the high CPU utilization is an ongoing condition. + + + +Example 3-11 shows sample output from the show ip arp command. In the output, only a single instance exists of an Incomplete ARP entry. However, a high number of such entries can suggest the scanning of network resources, which might indicate malicious reconnaissance traffic or that you have a route pointing out an Ethernet interface instead of to a next-hop IP address. + +Example 3-11 show ip arp Command Output + +R2#show ip arp + +Protocol +Internet +Internet +Internet + +Address +10.3.3.2 +10.3.3.1 +192.168.1.50 + +Age (min) +61 +- +0 + +Hardware Addr Type +0009.b7fa.d1e0 ARPA +00d0.06fe.9ea0 ARPA +Incomplete ARPA + +Interface +Ethernet0/0 +Ethernet0/0 + + +Example 3-12 shows sample output from the show interface interface_type interface_ number command. Note the throttles, overrun, and ignored counters. If these counters continue to increment, the Net Background process might be consuming excessive CPU resources while it allocates buffers from the main buffer pool of the router. + + + + + + + + +From the Library of Outcast Outcast +110 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 3-12 show interface interface_type interface_number Command Output + +R2#show interface ethernet 0/0 +Ethernet0/0 is up, line protocol is up +Hardware is AmdP2, address is 00d0.06fe.9ea0 (bia 00d0.06fe.9ea0) +Internet address is 10.3.3.1/24 +MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +ARP type: ARPA, ARP Timeout 04:00:00 +Last input 00:00:02, output 00:00:02, output hang never +Last clearing of "show interface" counters never +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo +Output queue: 0/40 (size/max) +5 minute input rate 0 bits/sec, 1 packets/sec +5 minute output rate 0 bits/sec, 0 packets/sec +2156 packets input, 164787 bytes, 0 no buffer +Received 861 broadcasts, 0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 input packets with dribble condition detected +2155 packets output, 212080 bytes, 0 underruns +0 output errors, 0 collisions, 7 interface resets +0 babbles, 0 late collision, 0 deferred +0 lost carrier, 0 no carrier +0 output buffer failures, 0 output buffers swapped out + +Example 3-13 shows sample output from the show tcp statistics command. If the output indicates numerous connections, the TCP Timer process might be consuming excessive CPU resources while simultaneously maintaining all those connections. If you have a high number of initiated connections with a low number of established connections, it indi-cates that the three-way handshake is not being completed. This might be due to a DoS attack that is attempting to consume all the TCP connection slots. + +Example 3-13 show tcp statistics Command Output + +R2#show tcp statistics +Rcvd: 689 Total, 0 no port +0 checksum error, 0 bad offset, 0 too short +474 packets (681 bytes) in sequence +0 dup packets (0 bytes) +0 partially dup packets (0 bytes) +0 out-of-order packets (0 bytes) +0 packets (0 bytes) with data after window +0 packets after close +0 window probe packets, 0 window update packets + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 111 + +1 dup ack packets, 0 ack packets with unsend data +479 ack packets (14205 bytes) +Sent: 570 Total, 0 urgent packets +1 control packets (including 0 retransmitted) +562 data packets (14206 bytes) +0 data packets (0 bytes) retransmitted +0 data packets (0 bytes) fastretransmitted +7 ack only packets (7 delayed) +0 window probe packets, 0 window update packets +0 Connections initiated, 1 connections accepted, 1 connections established +0 Connections closed (including 0 dropped, 0 embryonic dropped) +0 Total rxmt timeout, 0 connections dropped in rxmt timeout +0 Keepalive timeout, 0 keepalive probe, 0 Connections dropped in keepalive + +Example 3-14 shows sample output from the show processes cpu command. The out-put in this example indicates a 34 percent CPU utilization in the past 5 seconds, with 13 percent of CPU resources being spent on interrupts. The output also shows the 1-minute CPU utilization average as 36 percent and the 5-minute average as 32 percent. Individual processes running on the router are also shown, along with their CPU utilization levels. Note the ARP Input, Net Background, TCP Timer, and IP Background processes referred to in this section. + +Example 3-14 show processes cpu Command Output + +R2#show processes cpu +CPU utilization for five seconds: 34%/13%; one minute: 36%; five minutes: 32% +PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process +...OUTPUT OMITTED... +12 4 69 57 0.00% 0.00% 0.00% 0 ARP Input + +13 0 1 0 0.00% 0.00% 0.00% +14 0 5 0 0.00% 0.00% 0.00% +15 12 2 6000 0.00% 0.00% 0.00% +16 4 2 2000 0.00% 0.00% 0.00% +17 0 1 0 0.00% 0.00% 0.00% + +0 HC Counter Timer +0 DDR Timers +0 Entity MIB API +0 ATM Idle Timer +0 SERIAL A'detect + +18 0 3892 0 0.00% 0.00% 0.00% 0 GraphIt + +19 0 2 0 0.00% 0.00% 0.00% +20 0 1 0 0.00% 0.00% 0.00% + +0 Dialer event +0 Critical Bkgnd + +21 132 418 315 0.00% 0.00% 0.00% 0 Net Background +22 0 15 0 0.00% 0.00% 0.00% 0 Logger +...OUTPUT OMITTED... + +46 0 521 +47 84 711 + +0 0.00% 0.00% 0.00% +118 0.00% 0.00% 0.00% + +0 SSS Test Client +0 TCP Timer + + + +48 4 3 1333 0.00% 0.00% 0.00% +49 0 1 0 0.00% 0.00% 0.00% + +0 TCP Protocols +0 Socket Timers + +50 0 15 0 0.00% 0.00% 0.00% 0 HTTP CORE + +51 12 5 2400 0.00% 0.00% 0.00% +52 4 5 800 0.00% 0.00% 0.00% + +0 PPP IP Route +0 PPP IPCP + + + + +From the Library of Outcast Outcast +112 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +53 273 157 +54 0 74 + +1738 0.00% 0.00% 0.00% +0 0.00% 0.00% 0.00% + +0 IP Background +0 IP RIB Update + +...OUTPUT OMITTED... + +Example 3-15 shows sample output from the show processes cpu history command. The graphical output produced by this command is useful in determining whether a CPU spike is temporary or whether it is an ongoing condition. + +Example 3-15 show processes cpu history Command Output + +R2#show processes cpu history + + +4 11111 4444411111 11111 +944444555554444444444777775555588888888887777755555777775555 + +100 +90 +80 +70 +60 +50 * +40 * +30 * +20 * ***** + + + + + + +***** +***** +***** +********** ***** + +10 * ***** ************************************* +0....5....1....1....2....2....3....3....4....4....5....5....6 +0 5 0 5 0 5 0 5 0 5 0 +CPU% per second (last 60 seconds) + + + + +611111111112111221131111111111111121111111111111211111111111 +376577846281637117756665771573767217674374737664008927775277 +100 +90 +80 +70 +60 * +50 * +40 * * +30 * * +20 ******* * *** ************ ** *** **** * * *** * ** **** +10 ########################################################## +0....5....1....1....2....2....3....3....4....4....5....5....6 +0 5 0 5 0 5 0 5 0 5 0 + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 113 + +CPU% per minute (last 60 minutes) +* = maximum CPU% # = average CPU% + + + + +56434334644444334443442544453443 +46868692519180723579483247519306 +100 +90 +80 +70 * * +60 * * +50 *** * * * * ** * * *** +40 *************** ****** ********* +30 ********************** ********* +20 ******************************** +10 ################################ +0....5....1....1....2....2....3....3....4....4....5....5....6....6....7.. +0 5 0 5 0 5 0 5 0 5 0 5 0 +CPU% per hour (last 72 hours) +* = maximum CPU% # = average CPU% + + +Understanding Packet-Switching Modes (Routers and Multilayer Switches) + +In addition to the high CPU utilization issues previously discussed, a router’s packet-switching mode can impact router performance. Before discussing the most common switching modes, realize that the way a router handles packets (or is capable of handling packets) largely depends on the router’s architecture. Therefore, for real-world trouble-shooting, consult the documentation for your router to determine how it implements packet switching. + +In general, however, Cisco routers and multilayer switches support the following three primary modes of packet switching: + +■ Process switching Key +Topic ■ Fast switching (route caching) + +■ Cisco Express Forwarding (topology-based switching) + +Packet switching involves the router making a decision about how a packet should be for-warded and then forwarding that packet out of the appropriate router interface. + +Operation of Process Switching +When a router routes a packet (that is, performs packet switching), the router removes the packet’s Layer 2 header, examines the Layer 3 addressing, and decides how to forward + + + +From the Library of Outcast Outcast +114 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +the packet. The Layer 2 header is then rewritten (which involves changing the source and destination MAC addresses and computing a new FCS), and then the packet is forwarded out of the appropriate interface. With process switching, as illustrated in Figure 3-4, the router’s CPU becomes directly involved with packet-switching decisions. As a result, the performance of a router configured for process switching can suffer significantly. + +Incoming Packets Outgoing Packets + + + + + +Control Plane + +CPU +Packet Flow +Packet Flow + + + + + +Ingress Interface + +Egress Interface + + +Data Plane + +Figure 3-4 Data Flow with Process Switching + +An interface can be configured for process switching by disabling fast switching and CEF on that interface. The interface configuration mode command used to disable fast switch-ing and CEF at the same time is no ip route-cache. + +Operation of Fast Switching (Route Caching) +Fast switching uses a fast cache maintained in a router’s data plane. The fast cache con-tains information about how traffic from different data flows should be forwarded. As shown in Figure 3-5, the first packet in a data flow is process-switched by a router’s CPU. After the router determines how to forward the first packet of a data flow, that forward-ing information is stored in the fast cache. Subsequent packets in that same data flow are forwarded based on information in the fast cache, as opposed to being process-switched. As a result, fast switching reduces a router’s CPU utilization when compared to process switching. + +You can enable fast switching by turning off CEF in interface configuration mode with the no ip route-cache cef command. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 115 + +Incoming Packets Outgoing Packets + + + + + +Control Plane + +CPU +Packet #1 +in a Data Flow +Packet #1 +in a Data Flow +Forwarding +Information + + + + + + +Ingress Interface + +Subsequent Packets in a Data Flow + +Subsequent Packets in a +Fast Data Flow Cache + + +Egress Interface + +Data Plane + +Figure 3-5 Data Flow with Fast Switching + +Operation of Cisco Express Forwarding (Topology-Based Switching) +Cisco Express Forwarding (CEF) maintains two tables in the data plane. Specifically, the Forwarding Information Base (FIB) maintains Layer 3 forwarding information, whereas the Adjacency Table maintains Layer 2 information for next hops listed in the FIB. + +Using these tables, populated from a router’s IP routing table and ARP cache, CEF can efficiently make forwarding decisions. Unlike fast switching, CEF does not require the first packet of a data flow to be process-switched. Rather, an entire data flow can be for-warded at the data plane, as shown in Figure 3-6. + +Incoming Packets Outgoing Packets + + + + + + + +IP Routing Table + +Control Plane + +CPU ARP Cache + + + + + + +Ingress +Layer 3 Information +Interface Data Flow + +CEF Data Structures +FIB + +Adjacency Table +Data Plane + + + + +Egress Data Flow Interface +Layer 2 Information + + +Figure 3-6 Data Flow with Cisco Express Forwarding + + +From the Library of Outcast Outcast +116 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +On many router platforms, CEF is enabled by default. If it is not, you can globally enable it with the ip cef command. Alternatively, you can enable CEF for a specific interface with the interface configuration mode command ip route-cache cef. + +Date Night Example of Process-Switching Modes +Let’s pretend that my wife and I are going out to dinner and we are leaving our two chil-dren with a babysitter. If we are “Process Switching” with the babysitter, every time our children ask the babysitter for a cookie, she has to call us to ask for permission to give the children a cookie. If the children ask ten times, she has to call us ten times. If we are “Fast Switching” with the babysitter, the first time she calls us, we say yes and then create a “route cache” for the babysitter that states, “if the kids want more, just give them more without calling us.” Finally, if we are using “CEF” with the babysitter, before we leave for dinner, we take out the cookie jar, place it on the counter, and tell her to have an awesome evening with the kids. As you can see from this example, date night is better when we use CEF. + +Troubleshooting Packet-Switching Modes + +Table 3-4 provides a selection of commands that you can use when troubleshooting the packet-switching modes of a router. + +Table 3-4 Commands for Troubleshooting a Router’s Packet-Switching Modes +Key +Topic Command Description + + +show ip interface interface_type interface_ number + +show ip cache + +show processes cpu | include IP Input + + + + + +show ip cef + +show ip cef adjacency egress_interface_id next_hop_ip_address detail + +show adjacency detail + +Displays multiple interface statistics, including information about the packet-switching mode of an interface. +Displays the contents of the route cache from a router if fast switching is enabled. +Displays information about the IP input process on a router. The CPU utilization for this process might show a high value if the CPU of a router is actively engaged in +process-switching traffic because you turned off fast switching and CEF. +Displays the contents of a router’s FIB. + +Displays destinations reachable through the combination of the specified egress interface and next-hop IP address. +Provides information contained in the adjacency table of a router, including protocol and timer information. + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 117 + +Example 3-16 shows sample output from the show ip interface interface_type interface_number command. The output indicates that fast switching and CEF switching are enabled on interface Fast Ethernet 0/0. The reference to flow switching being disabled refers to the Cisco IOS NetFlow feature, which you can use to collect traffic statistics. + +Example 3-16 show ip interface interface_type interface_number Command Output + +R4#show ip interface fastethernet 0/0 +FastEthernet0/0 is up, line protocol is up +...OUTPUT OMITTED... +ICMP mask replies are never sent +IP fast switching is enabled +IP fast switching on the same interface is disabled +IP Flow switching is disabled +IP CEF switching is enabled +IP CEF Fast switching turbo vector +IP multicast fast switching is enabled +IP multicast distributed fast switching is disabled +IP route-cache flags are Fast, CEF +...OUTPUT OMITTED... + +Example 3-17 shows sample output from the show ip cache command. If fast switching is enabled and CEF is disabled, a router begins to populate its route cache. This command shows the contents of a router’s route cache. + +Example 3-17 show ip cache Command Output + +R4#show ip cache +IP routing cache 3 entries, 588 bytes +12 adds, 9 invalidates, 0 refcounts +Minimum invalidation interval 2 seconds, maximum interval 5 seconds, +quiet interval 3 seconds, threshold 0 requests +Invalidation rate 0 in last second, 0 in last 3 seconds +Last full cache invalidation occurred 04:13:57 ago + +Prefix/Length Age Interface Next Hop + +10.8.8.4/32 +10.8.8.6/32 +192.168.0.0/24 + +00:00:07 +00:00:10 +00:00:10 + +FastEthernet0/1 +FastEthernet0/1 +FastEthernet0/0 + +10.8.8.4 +10.8.8.6 +10.3.3.1 + + +Example 3-18 shows sample output from the show processes cpu | include IP Input command. In the output, the IP input process was using only 0.08 percent of its router’s CPU capacity during the last 5-second interval. However, a high percentage value might indicate that a router was performing process switching, where the CPU was directly involved in packet switching. + + + + + + +From the Library of Outcast Outcast +118 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 3-18 show processes cpu | include IP Input Command Output + +R4#show processes cpu | include IP Input +63 3178 7320 434 0.08% 0.06% 0.04% 0 IP Input + +Example 3-19 shows sample output from the show ip cef command. The output con-tains the contents of the FIB for a router. Notice that the prefix is listed, followed by the next hop that will be used to reach the prefix, and then the interface that will be used to reach it. Note that if a next hop of the network prefix is set to receive, that network/ +IP is local to the router, and any packets destined to that specific IP will be processed by the CPU of the router. Examining the output closely, you will see that the receive entries are subnet IDs, local host IP addresses, and broadcast addresses, ensuring that they are processed by the router and not forwarded. The attached next hop indicates that the net-work is a directly connected route on the router. + +Example 3-19 show ip cef Command Output + + +R4#show ip cef +Prefix +0.0.0.0/0 +0.0.0.0/32 +10.1.1.0/24 +10.1.1.2/32 +10.3.3.0/24 +10.3.3.0/32 +10.3.3.1/32 +10.3.3.2/32 +10.3.3.255/32 +10.4.4.0/24 +10.5.5.0/24 +10.7.7.0/24 +10.7.7.2/32 +10.8.8.0/24 +10.8.8.0/32 +10.8.8.1/32 +10.8.8.4/32 +10.8.8.5/32 +10.8.8.6/32 +10.8.8.7/32 +10.8.8.255/32 +192.168.0.0/24 +224.0.0.0/4 +224.0.0.0/24 +255.255.255.255/32 + + +Next Hop +drop +receive +10.3.3.1 +10.3.3.1 +attached +receive +10.3.3.1 +receive +receive +10.3.3.1 +10.3.3.1 +10.3.3.1 +10.3.3.1 +attached +receive +receive +10.8.8.4 +10.8.8.5 +10.8.8.6 +10.8.8.7 +receive +10.3.3.1 +drop +receive +receive + + +Interface +Null0 (default route handler entry) + +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + +FastEthernet0/0 + + +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/1 + + +FastEthernet0/1 +FastEthernet0/1 +FastEthernet0/1 +FastEthernet0/1 + +FastEthernet0/0 + + + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 119 + +Example 3-20 shows sample output from the show ip cef adjacency egress_interface_id next_hop_ip_address detail command. This command shows the IP addresses that the router knows how to reach using the specified combination of next-hop IP address and egress interface. In this example, 10.8.8.6 is the IP address of a host and not a router. Therefore, no other IP addresses are known to have a next-hop IP address of 10.8.8.6 with an egress interface of Fast Ethernet 0/1. + +Example 3-20 show ip cef adjacency egress-interface-id next-hop-IP-address detail Command Output + +R4#show ip cef adjacency fa 0/1 10.8.8.6 detail +IP CEF with switching (Table Version 25), flags=0x0 +25 routes, 0 reresolve, 0 unresolved (0 old, 0 new), peak 0 +25 leaves, 21 nodes, 25640 bytes, 90 inserts, 65 invalidations +0 load sharing elements, 0 bytes, 0 references +universal per-destination load sharing algorithm, id 24360DB1 +5(2) CEF resets, 1 revisions of existing leaves +Resolution Timer: Exponential (currently 1s, peak 1s) +0 in-place/0 aborted modifications +refcounts: 5702 leaf, 5632 node + +Table epoch: 0 (25 entries at this epoch) + +Adjacency Table has 5 adjacencies +10.8.8.6/32, version 10, epoch 0, cached adjacency 10.8.8.6 +0 packets, 0 bytes +via 10.8.8.6, FastEthernet0/1, 0 dependencies +next hop 10.8.8.6, FastEthernet0/1 +valid cached adjacency + +Example 3-21 shows sample output from the show adjacency detail command. When you see a particular adjacency listed in the FIB, you can issue this command to confirm that the router has information about how to reach that adjacency. In this case, if we need to send a packet to 10.3.3.1, we will send the packet out Fast Ethernet 0/0, which requires a Layer 2 frame with a source and destination MAC address. These MAC addresses are already listed in the adjacency table. The value 00D006FE9EA00009B7FAD1E00800 can be broken into three parts: + +■ 00D006FE9EA0 = Destination MAC address + +■ 0009B7FAD1E0 = Source MAC address + +■ 0800 = Well-know Ethertype value for IP + + + + + + + + + +From the Library of Outcast Outcast +120 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 3-21 show adjacency detail Command Output + +R4#show adjacency detail +Protocol Interface Address +IP FastEthernet0/0 10.3.3.1(19) +32 packets, 1920 bytes +00D006FE9EA00009B7FAD1E00800 +ARP 03:53:01 +Epoch: 0 +IP FastEthernet0/1 10.8.8.6(5) +4 packets, 264 bytes +0008A3B895C40009B7FAD1E10800 +ARP 03:53:35 +Epoch: 0 +...OUTPUT OMITTED... + +Now that you have reviewed the different packet-switching options for a router, you can better analyze how a router is forwarding specific traffic. Following is a list of trouble-shooting steps that you can follow if you suspect that network traffic is being impacted by a performance problem on one of the routers along the path from the source to the destination: + +Step 1. Key +Topic +Step 2. + + + + +Step 3. + + +Step 4. + + +Step 5. + + + + + +Step 6. + + + +Step 7. + + +Use the traceroute command to determine which router along the path is causing excessive delay. + +After you identify a router that is causing unusually high delay, use the show processes cpu command to see the CPU utilization of that router and iden-tify any processes that might be consuming an unusually high percentage of the CPU. + +Use the show ip route ip_address command to verify that the router has a route to the destination IP address. + +Use the show ip cef command to determine whether all the router interfaces are configured to use CEF. + +Use the show ip cef ip_address 255.255.255.255 command to verify that CEF has an entry in its FIB that can reach the specified IP address. Part of the output from this command will be the next-hop adjacency to which traffic should be forwarded, along with the egress interface used to send traffic to that next hop. + +Issue the show adjacency interface_type interface_number detail command to verify that CEF has an entry in its adjacency table for the egress interface identified in Step 5. + +With the show ip arp command, you can then confirm that the router knows the MAC address associated with the next-hop IP address shown in the out- +put from Step 6. + + + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 121 + +Step 8. You can then connect to the next-hop device and verify that the MAC address identified in Step 7 is indeed correct. + +You can repeat these steps on the next-hop device or on another router whose response time displayed in the output from Step 1 is suspect. + + +Excessive Memory Utilization + + + +Key Topic + +Much like a PC, router performance can suffer if it lacks sufficient available memory. For example, perhaps you install a version of Cisco IOS on a router, and that router does not have the minimum amount of memory required to support that specific Cisco IOS image. Even though the router might load the image and function, its performance might be sluggish. Assuming that a router does have the recommended amount of memory for its +installed Cisco IOS image, consider the following as potential memory utilization issues. + + + +Memory Leak +When a router starts a process, that process can allocate a block of memory. When the process completes, the process should return its allocated memory to the router’s pool of memory. If not all allocated memory is returned to the router’s main memory pool, a +memory leak occurs. Such a condition usually results from a bug in the Cisco IOS version running on the router, requiring an upgrade of the router’s Cisco IOS image. + +Example 3-22 shows sample output from the show memory allocating-process totals command. This command can help identify memory leaks. The output shows information about memory availability on a router after the Cisco IOS image of the router has been decompressed and loaded, and the total amount of memory that is being used by the various processes. + +Example 3-22 show memory allocating-process totals Command Output + +R4#show memory allocating-process totals + + +Processor +I/O + +Head +83D27480 +7C21800 + +Total(b) +67463064 +4057088 + +Used(b) +15347168 +2383016 + +Free(b) +52115896 +1674072 + +Lowest(b) +50311080 +1674072 + +Largest(b) +50127020 +1674044 + + +Allocator PC Summary for: Processor + + +PC +0x809D7A30 +0x80A7F664 +0x81CEF6A0 +0x81C04D9C +0x800902A4 + +Total +1749360 +918024 +882576 +595344 +490328 + +Count Name +180 Process Stack +10 Init +4 pak subblock chunk +54 TCL Chunks +6 MallocLite + +...OUTPUT OMITTED... + +The Head column in the output refers to the address (in hexadecimal) of the memory allocation chain. The Total column is the total amount of memory available in bytes. + + + +From the Library of Outcast Outcast +122 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +The Used column indicates how much has been used, and Free indicates how much is remaining. The Lowest column shows the lowest amount of free memory (in bytes) that has been available since the router last booted. The Largest column indicates the larg-est block of available memory. Following this summary information, the output shows +detailed memory allocation information for each process running on a router. If a process is consuming a larger-than-normal amount of memory, it is likely because of a memory leak. A memory leak occurs when a process does not free the memory that it is finished using. Therefore, the block of memory remains reserved and will be released only when the router is reloaded. Typically, memory leaks result from bugs or poor coding in the Cisco IOS Software. The best solution is to upgrade the Cisco IOS Software to a version that fixes the issue. + +Memory-Allocation Failure +A memory-allocation failure (which produces a MALLOCFAIL error message) occurs when a process attempts to allocate a block of memory and fails to do so. One com-mon cause for a MALLOCFAIL error is a security issue. For example, a virus or a worm that has infested the network can result in a MALLOCFAIL error. Alternatively, a MALLOCFAIL error might result from a bug in the router’s version of Cisco IOS. You +can use the Cisco Bug Toolkit (available from www.cisco.com/cgi-bin/Support/Bugtool/ launch_bugtool.pl) to research any such known issues with the version of Cisco IOS run-ning on a router. Personally, I have witnessed the MALLOCFAIL error message when using an Integrated Services Router (ISR) that was running Network Address Translation (NAT), and another instance when I tried to load the complete Intrusion Prevention System (IPS) Signature Definition File on another ISR when I knew it could not handle it. + +Buffer Leak +Similar to a memory leak, in which a process does not return all of its allocated memory to the router upon terminating, a buffer leak occurs when a process does not return a buffer to the router when the process has finished using the buffer. Consider the output of the show interfaces command shown in Example 3-23. + +Example 3-23 Identifying a Wedged Interface + +R4#show interfaces +...OUTPUT OMITTED... +Input queue: 76/75 /780/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo +Output queue: 0/40 (size/max) +...OUTPUT OMITTED... + +Notice the numbers 76 and 75 highlighted in the output. These values indicate that an input queue of the interface has a capacity of 75 packets and that the queue currently has 76 packets. These values indicate an oversubscription of the queue space. An interface in this condition is called a wedged interface. In such a condition, the router does not for-ward traffic coming into the wedged interface. + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 123 + +The show buffers command can also help to diagnose a buffer leak. To illustrate, consider the output of the show buffers command shown in Example 3-24. + +Example 3-24 show buffers Command Output + +R4#show buffers +Buffer elements: +1118 in free list (500 max allowed) +570 hits, 0 misses, 1119 created + +Public buffer pools: +Small buffers, 104 bytes (total 71, permanent 50, peak 71 @ 00:21:43): +53 in free list (20 min, 150 max allowed) +317 hits, 7 misses, 0 trims, 21 created +0 failures (0 no memory) +Middle buffers, 600 bytes (total 49, permanent 25, peak 49 @ 00:21:43): +5 in free list (10 min, 150 max allowed) +122 hits, 8 misses, 0 trims, 24 created +...OUTPUT OMITTED... + +This output indicates that the router has 49 middle buffers, but only 5 of those 49 buffers are available. Such a result might indicate a process allocating buffers but failing to deallocate them. Like a memory leak, a buffer leak might require updating the Cisco IOS image of a router. + +Excessive BGP Memory Use +If a router is running Border Gateway Protocol (BGP), be aware that BGP runs multiple pro-cesses and can consume significant amounts of router memory. The show processes memory | include BGP command, as shown in Example 3-25, can show you how much memory the various BGP processes of a router are consuming. If BGP is consuming a large percentage of your router memory, you might consider filtering out unneeded BGP routes, upgrading the memory on that router, or running BGP on a different platform that has more memory. + +Example 3-25 show processes memory | include BGP Command Output + +R1#show processes memory | include BGP|^ PID +PID TTY Allocated Freed Holding Getbufs Retbufs Process + +184 0 0 0 7096 0 +198 0 0 0 10096 0 +229 0 38808 0 11520 0 +231 0 0 0 10096 0 +262 0 0 0 10096 0 +284 0 0 0 7096 0 + +0 BGP Task +0 BGP Scheduler +0 BGP Router +0 BGP I/O +0 BGP Scanner +0 BGP Event + + +Depending on the router platform, your router might have multiple line cards with differ-ent amounts of memory available on each line card. The show diag command can help you isolate a specific line card that is running low on memory, perhaps because that line card is running BGP. + + +From the Library of Outcast Outcast +124 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have sev-eral choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 3-5 lists a reference of these key topics and the page numbers on which each is found. + +Table 3-5 Key Topics for Chapter 3 +Key +Topic Key Topic Element Description Page Number + + +List + +Table 3-2 + +List + +Section + +List + +Table 3-3 + +List + +Table 3-4 + +Step list + +Section + +Components in a Catalyst switch 96 + +Errors in the show interfaces interface_type 98 interface_number counters errors command +Reasons why a packet could be punted from a 102 switch’s TCAM to its CPU +High CPU utilization troubleshooting on a switch 105 + +Identifies processes that cause excessive router CPU 107 utilization +Commands for troubleshooting high CPU utilization 108 + +Three primary modes of packet switching 113 + +Commands for troubleshooting a router’s packet- 116 switching modes +Example of troubleshooting the forwarding of 120 packets +Excessive memory utilization 121 + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +backplane, control plane, forwarding logic, ingress port, egress port, half-duplex, full-duplex, TCAM, ARP Input process, Net Background process, IP Background process, TCP Timer process, process switching, fast switching, CEF, memory leak, memory-allocation failure, buffer leak + + + + +From the Library of Outcast Outcast +Chapter 3: Troubleshooting Device Performance 125 + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + +Command Reference to Check Your Memory + +This section includes the most important EXEC commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 3-6 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to verify router and switch configurations. + +Table 3-6 EXEC Commands + +Task Command Syntax + +A Cisco Catalyst 3750E series switch command that can be used to verify the maximum and used TCAM resources for various services and features on the switch. +A Cisco Catalyst switch command that can be used to display the current SDM template being used on the switch. +Displays a router’s ARP cache. (Note: If a large number of the entries are in the Incomplete state, you might suspect a malicious scan [for example, a ping sweep] of a subnet.) +Shows a collection of interface statistics. (Note: If the throttles, overruns, or ignored counters continually increment, you might suspect that the Net Background process is attempting to allocate buffer space for an interface from the router’s main buffer pool.) +Provides information about the number of TCP seg-ments a router sends and receives, including the number of connections initiated, accepted, established, and closed. (Note: A high number of connections might explain why the TCP Timer process is consuming excessive CPU resources.) + + +show platform tcam utilization + + + +show sdm prefer + + +show ip arp + + + +show interface interface_type interface_number + + + +show tcp statistics + + + + + +From the Library of Outcast Outcast +126 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Displays average CPU utilization over 5-second, 1-min-ute, and 5-minute intervals, in addition to listing all the router processes and the percentage of CPU resources consumed by each of those processes. +Shows a graphical view of CPU utilization over the past 60 seconds, 1 hour, and 3 days. (Note: This graphical view can indicate whether an observed high CPU utili-zation is a temporary spike in utilization or whether the high CPU utilization is an ongoing condition.) +Displays multiple interface statistics, including informa-tion about the packet-switching mode of an interface. + +Shows the contents of the fast cache for a router if fast switching is enabled. + +Command Syntax show processes cpu + + + +show processes cpu history + + + + +show ip interface interface_type interface_number +show ip cache + +Displays information about the IP Input process on show processes cpu | include IP a router. (Note: The CPU utilization for this process Input +might show a high value if the CPU of a router is active-ly engaged in process-switching traffic.) + +Displays the router’s Layer 3 forwarding information, in addition to multicast, broadcast, and local IP addresses. +Verifies that a valid adjacency exists for a connected host. +Displays destinations reachable through the combina-tion of the specified egress interface and next-hop IP address. + +Provides information contained in a router’s adjacency table, including protocol and timer information. +Displays information about packets forwarded by the router using a packet-switching mechanism other than CEF. +Shows information about memory availability on a router after the router’s Cisco IOS image has been decompressed and loaded. (Note: This command can help identify memory leaks.) + + +show ip cef + +show adjacency + +show ip cef adjacency egress_ interface_id next_hop_ip_address detail +show adjacency detail + +show cef not-cef-switched + + +show memory allocating-process totals + +Shows how many buffers (of various types) are current- show buffers ly free. (Note: This command can be helpful in diagnos- +ing a buffer leak.) + + +Shows how much memory is being consumed by the various BGP processes of a router. +Shows the memory available on the line cards of a router. + + +show processes memory | include bgp +show diag + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Frame-Forwarding Process: This section reviews the Layer 2 frame-forwarding process. To success-fully troubleshoot Layer 2 issues, you need to have a complete understanding of this process. + +■ Troubleshooting Trunks: This section focuses on how to troubleshoot Layer 2 trunking issues. + +■ Troubleshooting VTP: This section focuses on how to troubleshoot issues relating to VLAN Trunking Protocol. + +■ Troubleshooting VLANs: This section identi- +fies how to troubleshoot general issues relating to VLANs and end-user port assignments. + +■ The MAC address table: This section reviews how to use the MAC address table during your trouble-shooting process. + +■ Layer 2 Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 4 + + + + +Troubleshooting Layer 2 Trunks, VTP, and VLANs + + +Most enterprise LANs rely on some flavor of Ethernet technology (for example, Ethernet, Fast Ethernet, or Gigabit Ethernet). In addition, your overall campus design will deter-mine whether you need to worry about Layer 2 technologies such as trunks, Virtual Trunking Protocol (VTP), Dynamic Trunking Protocol (DTP), and virtual local-area net-works (VLANs). If your campus design has any Layer 2 links from the distribution layer to the access layer, you need to have the skills necessary to troubleshoot these Layer 2 technologies. + +However, before you master the skills for troubleshooting these Layer 2 technologies, you need to have an understanding of Ethernet switch operations at Layer 2. This chapter sets the stage by reviewing basic Layer 2 switch operations, which will factor into discus-sions in future chapters. It then moves on to troubleshooting trunks, VTP, and VLANs. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 4-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 4-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Frame-Forwarding Process + +Troubleshooting Trunks + +Troubleshooting VTP + +Troubleshooting VLANs + +The MAC Address Table + +Questions +1–3 + +4–6 + +7 + +8 + +9–10 + + + + + + + + + +From the Library of Outcast Outcast +130 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which header information is used by switches to learn which MAC address is reach-able out a specific interface? + +a. Source IP address + +b. Destination IP address + +c. Source MAC address + +d. Destination MAC address + +2. Which header information is used by switches to forward frames? + +a. Source IP address + +b. Destination IP address + +c. Source MAC address + +d. Destination MAC address + +3. What does a switch do with an unknown unicast frame? + +a. Drop it + +b. Forward it out the port it is associated with + +c. Use ARP to determine the MAC address of the IP address in the packet + +d. Flood it out all ports except the port it was received on + +4. Which two are examples of issues that could prevent a trunk from forming? + +a. Encapsulation mismatch + +b. Incompatible trunking modes + +c. Password mismatch + +d. Missing VLAN + +5. Which two of the trunk mode examples will successfully form a trunk? + +a. Access – Dynamic desirable + +b. Dynamic Auto – Dynamic auto + +c. Trunk – Dynamic auto + +d. Trunk – Trunk nonegotiate + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 131 + +6. Which command enables you to verify the administrative mode and operational mode of an interface? + +a. show interfaces trunk + +b. show run interface interface_type interface_number + +c. show interfaces interface_type interface_number switchport + +d. show interfaces + +7. Which command enables you to verify VTP configurations? + +a. show run + +b. show interfaces + +c. show vtp status + +d. show vtp configurations + +8. Which two commands enable you to verify which VLAN a port is assigned to? + +a. show vlan brief + +b. show interfaces interface_type interface_number switchport + +c. show interfaces trunk + +d. show mac address-table dynamic + +9. Which command enables you to verify which port a MAC address is being learned on? + +a. show vlan brief + +b. show interfaces interface_type interface_number switchport + +c. show interfaces trunk + +d. show mac address-table dynamic + +10. What can we confirm when examining the MAC address table of a switch? (Choose two answers.) + +a. The port a MAC address was learned on + +b. The VLAN the MAC address is associated with + +c. The administrative and operational mode of an interface + +d. The number of devices physically connected to an interface + + + + + + + + + +From the Library of Outcast Outcast +132 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Frame-Forwarding Process + + + + + + + + + +Key Topic + +To successfully troubleshoot Layer 2 forwarding issues, you need a solid understand-ing of how a switch operates. You would have learned this back in CCNA Routing and Switching. However, we spend time here reviewing switch operations because our trou-bleshooting efforts will be based on this knowledge. This section reviews how a switch populates its MAC address table and how it decides what to do with a frame based on +the information in the MAC address table. + +Unlike Ethernet hubs, which take bits in one port and send those same bits out all other ports, Ethernet switches learn about the devices connected to their ports. Therefore, when an Ethernet switch sees a frame destined for a particular MAC address, the switch can consult its MAC address table to determine which port to forward the newly arrived frame out. This behavior results in more-efficient bandwidth utilization and improved security on a LAN. In addition, it eliminates the concern of collisions. Specifically, in a hub environment, if two endpoints each transmitted a data frame at the same time, those two frames would collide, resulting in both frames being corrupted because all ports on a hub are in a common collision domain. This collision would require each endpoint to retransmit its data frame. This is not a concern with switches because every port on an Ethernet switch is in its own collision domain. + +Ethernet switches can dynamically learn the MAC addresses attached to various switch-ports by looking at the source MAC address on frames coming into a port. For example, if switchport Gigabit Ethernet 1/1 received a frame with a source MAC address of DDDD.DDDD.DDDD, the switch could conclude that MAC address DDDD.DDDD. DDDD resided off of port Gigabit Ethernet 1/1. As a result, it places an entry in the MAC address table indicating so. In the future, if the switch received a frame destined for a MAC address of DDDD.DDDD.DDDD, the switch would only send that frame out of port Gigabit Ethernet 1/1 because of the entry in the MAC address table. + +Initially, however, a switch is unaware of what MAC addresses reside off of which ports (unless MAC addresses have been statically configured). Therefore, when a switch +receives a frame destined for a MAC address not yet present in the switch’s MAC address table, the switch floods that frame out of all the switchports in the same VLAN, other than the port on which the frame was received. Similarly, broadcast frames (that is, frames with a destination MAC address of FFFF.FFFF.FFFF) are always flooded out all switchports in the same VLAN except the port on which the frame was received. The reason broadcast frames are always flooded is that no endpoint will have a MAC address of FFFF.FFFF.FFFF, meaning that the FFFF.FFFF.FFFF MAC address will never be learned dynamically in the MAC address table of a switch. In addition, if you look at the output of the MAC address table, you will notice that the all F’s MAC address is stati-cally bound to the CPU, ensuring that it can never be learned dynamically, as shown in +Example 4-1. + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 133 + +Example 4-1 show mac address-table Command Output + +SW1#show mac address-table +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +All 0100.0ccc.cccc +All 0100.0ccc.cccd +All 0180.c200.0000 +All 0180.c200.0001 +All 0180.c200.0002 +All 0180.c200.0003 +All 0180.c200.0004 +All 0180.c200.0005 +All 0180.c200.0006 +All 0180.c200.0007 +All 0180.c200.0008 +All 0180.c200.0009 +All 0180.c200.000a +All 0180.c200.000b +All 0180.c200.000c +All 0180.c200.000d +All 0180.c200.000e +All 0180.c200.000f +All 0180.c200.0010 +All ffff.ffff.ffff +10 0050.b60c.f258 +10 0800.2757.1b86 +10 0800.275d.06d6 +10 0800.27a2.ce47 +10 2893.fe3a.e301 + +Type Ports +-------- ----- +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +STATIC CPU +DYNAMIC Gi0/1 +DYNAMIC Gi0/1 +DYNAMIC Fa0/1 +DYNAMIC Fa0/2 +DYNAMIC Gi0/1 + +...output omitted... + +To illustrate how a switch’s MAC address table becomes populated, consider an endpoint named PC1 that wants to form a Telnet connection with a server, as shown in Figure 4- +1. Also, assume that PC1 and its server reside on the same subnet (that is, no routing is required to get traffic between PC1 and its server) and are therefore in the same VLAN, in this case VLAN 100. Before PC1 can send a Telnet segment to its server, PC1 needs to know the IP address (that is, the Layer 3 address) and the MAC address (that is, the Layer 2 address) of the server. The IP address of the server is typically known or is resolved +via a Domain Name System (DNS) lookup. In this example, assume that the server’s IP address is known. To properly communicate over Ethernet, PC1 needs to know the +server’s Layer 2 MAC address. If PC1 does not already have the server’s MAC address in its Address Resolution Protocol (ARP) cache, PC1 can send an ARP request to learn the server’s MAC address. + + + +From the Library of Outcast Outcast +134 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +PC2 PC4 + + + +ARP Request +Gig 0/1 + + +Gig 0/3 VLAN 100 +Gig 0/2 + + +Gig 0/3 VLAN 100 +Gig 0/1 Gig 0/2 + + + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 +Gig 0/4 Server VLAN 200 BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +Gig 0/1 + +Gig 0/2 + +MAC Addresses +Empty + +Empty + +VLAN Port +Gig 0/1 + +Gig 0/2 + +MAC Addresses +Empty + +Empty + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-1 Endpoint Sending an ARP Request + +When switch SW1 sees PC1’s ARP request enter port Gig0/1, the PC1 MAC address of AAAA.AAAA.AAAA is added to the MAC address table of switch SW1 and associ-ated with interface Gig0/1. Because Gig0/1 is a member of VLAN 100, the MAC is also associated with VLAN 100. Because the ARP request is a broadcast, its destination MAC address is FFFF.FFFF.FFFF (all F’s). As discussed earlier, frames with a destination of all F’s will be copied and flooded out all switchports except the port on which the frame was received. However, notice that port Gig0/1 on switch SW1 belongs to VLAN 100, whereas port Gig0/4 belongs to VLAN 200. This is important because frames are constrained to the VLAN from which they originated unless routed by a Layer 3 device. Therefore, the broadcast frame in this case is not flooded out Gig0/4 because Gig0/4 is a +member of a different VLAN. Port Gig0/2, however, is a trunk port, and a trunk can carry traffic for multiple VLANs. Therefore, the ARP request is flooded out of port Gig0/2 +and Gig0/3, as illustrated in Figure 4-2. Because the ARP request is for the MAC of the server, PC2 will ignore the ARP request. + +When switch SW2 receives the ARP request inbound on its Gig0/1 trunk port, the source MAC address of AAAA.AAAA.AAAA is added to switch SW2’s MAC address table, associated with Gig0/1 and VLAN 100. Also, similar to the behavior of switch SW1, switch SW2 floods the broadcast frame out of port Gig0/3 (a member of VLAN 100) and out of port Gig0/2 (also a member of VLAN 100), as depicted in Figure 4-3. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 135 + + +PC2 PC4 + + +ARP Request +ARP Request +Gig 0/1 + + + +Gig 0/3 VLAN 100 +Gig 0/2 + + + +Gig 0/3 VLAN 100 +Gig 0/1 Gig 0/2 + + + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 +Gig 0/4 +VLAN 200 + +PC3 + + +Trunk + +ARP Request + +SW2 VLAN 100 +Gig 0/4 Server VLAN 200 BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +Empty + +VLAN Port +Gig 0/1 + +Gig 0/2 + +MAC Addresses +Empty + +Empty + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-2 Switch SW1 Flooding the ARP Request + + +PC2 PC4 + + +ARP Request +ARP Request +Gig 0/1 + + + +Gig 0/3 VLAN 100 +Gig 0/2 + + + +Gig 0/3 VLAN 100 +Gig 0/1 + +ARP Request +ARP Request +Gig 0/2 + + + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 +Gig 0/4 +VLAN 200 + +PC3 + + +Trunk + +ARP Request + +SW2 VLAN 100 +Gig 0/4 Server VLAN 200 BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +Empty + +VLAN Port +100 Gig 0/1 + +Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +Empty + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-3 Switch SW2 Flooding the ARP Request + +The server receives the ARP request and responds with an ARP reply, as shown in Figure 4-4. In addition, the server updates its ARP cache with a mapping of the IP and MAC address of PC1. Unlike the ARP request, the ARP reply frame is not a broadcast frame; it is a unicast frame. The ARP reply in this case has a destination MAC address of AAAA. AAAA.AAAA and a source MAC address of BBBB.BBBB.BBBB. + + +From the Library of Outcast Outcast +136 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +PC2 + + + +Gig 0/3 +VLAN 100 Gig 0/1 Gig 0/2 + +PC4 + + +ARP Gig 0/3 Reply +VLAN 100 +Gig 0/1 Gig 0/2 + + + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 +Gig 0/4 Server +VLAN 200 BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +Empty + +VLAN Port +100 Gig 0/1 + +Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +Empty + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-4 ARP Reply Sent from the Server + +Upon receiving the ARP reply from the server, switch SW2 adds the server’s MAC address of BBBB.BBBB.BBBB to its MAC address table, as shown in Figure 4-5. Also, the ARP reply is sent out only port Gig0/1 because switch SW2 knows that the destination MAC address of AAAA.AAAA.AAAA is reachable out port Gig0/1. + +PC2 PC4 + + +ARP ARP Gig 0/3 Reply Gig 0/3 Reply VLAN 100 VLAN 100 +Gig 0/1 Gig 0/2 Gig 0/1 Gig 0/2 + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 + +VLAN 200 Server +Gig 0/4 +BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +Empty + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-5 Switch SW2 Forwarding the ARP Reply + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 137 + +When receiving the ARP reply in its Gig0/2 port, switch SW1 adds the server’s MAC address of BBBB.BBBB.BBBB to its MAC address table. Also, like switch SW2, switch SW1 now has an entry in its MAC address table for the frame’s destination MAC address of AAAA.AAAA.AAAA. Therefore, switch SW1 forwards the ARP reply out port Gig0/1 to the endpoint of PC1, as illustrated in Figure 4-6. + +PC2 PC4 + + +ARP ARP ARP Reply Gig 0/3 Reply Gig 0/3 Reply +VLAN 100 VLAN 100 +Gig 0/1 Gig 0/2 Gig 0/1 Gig 0/2 + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 +Gig 0/4 Server +VLAN 200 +BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-6 Switch SW1 Forwarding the ARP Reply + +After receiving the server’s ARP reply, PC1 now knows the MAC address of the server. Therefore, PC1 can send a properly constructed Telnet segment destined for the server, as depicted in Figure 4-7. The source MAC of the Layer 2 frame will be AAAA.AAAA. AAAA, and the destination MAC will be BBBB.BBBB.BBBB. + +Switch SW1 has the server’s MAC address of BBBB.BBBB.BBBB in its MAC address table. Therefore, when switch SW1 receives the frame from PC1, that frame is forwarded out of the Gig0/2 port of switch SW1, as shown in Figure 4-8. + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +138 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +PC2 PC4 + + + + +Telnet Gig 0/3 VLAN 100 +Gig 0/1 Gig 0/2 + +Gig 0/3 VLAN 100 +Gig 0/1 Gig 0/2 + + + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 + +VLAN 200 Server +Gig 0/4 +BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-7 PC1 Sending a Telnet Segment + + +PC2 PC4 + + + +Telnet Gig 0/3 Telnet Gig 0/3 VLAN 100 VLAN 100 +Gig 0/1 Gig 0/2 Gig 0/1 Gig 0/2 + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 +Gig 0/4 Server +VLAN 200 +BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-8 Switch SW1 Forwarding the Telnet Segment + +Similar to the behavior of switch SW1, switch SW2 forwards the frame out its Gig0/2 port. This forwarding, shown in Figure 4-9, is possible because switch SW2 has an entry for the segment’s destination MAC address of BBBB.BBBB.BBBB in its MAC address table. + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 139 + + +PC2 PC4 + + + +Telnet Gig 0/3 Telnet Gig 0/3 Telnet VLAN 100 VLAN 100 +Gig 0/1 Gig 0/2 Gig 0/1 Gig 0/2 + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 +Gig 0/4 +VLAN 200 + +PC3 + + +Trunk + +SW2 VLAN 100 +Gig 0/4 Server VLAN 200 BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-9 Switch SW2 Forwarding the Telnet Segment + +Finally, the server responds to PC1, and a bidirectional Telnet session is established between the PC and the server, as illustrated in Figure 4-10. Because PC1 learned the MAC address of the server and the server learned the MAC address of PC1, as a result of PC1’s earlier ARP request, both devices stored the MAC addresses in their local ARP caches; therefore, the transmission of subsequent Telnet segments does not require additional ARP requests. However, if unused for a period of time, entries in a devices ARP cache will time out. + +PC2 PC4 + + + +Telnet Gig 0/3 Telnet Gig 0/3 Telnet VLAN 100 VLAN 100 +Gig 0/1 Gig 0/2 Gig 0/1 Gig 0/2 + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 + +VLAN 200 Server +Gig 0/4 +BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-10 Bidirectional Telnet Session Between PC1 and the Server + + +From the Library of Outcast Outcast +140 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +When troubleshooting an issue involving Layer 2 switch communication, a thorough understanding of the preceding steps can help you identify potential problems quickly and efficiently. Take a moment and review Figure 4-10. Consider where issues might arise in the topology that would prevent PC1 and Server from communicating. The following list outlines a few potential issues that could arise: + + +■ Key +Topic +■ + +■ + +■ + + +■ + +■ + +■ + +PC1 and Server have IP addresses in different subnets because of incorrect address or subnet mask. + +Interface Gig0/1 on SW1 or Gig0/2 on SW2 are not members of the correct VLAN. + +VLAN 100 is missing on SW1 or SW2. + +The trunk between SW1 and SW2 is not passing traffic for the necessary VLANs (VLAN 100 in this case). + +The trunk is not formed between SW1 and SW2. + +A VACL is denying PC1 from communicating with Server. + +Interface Gig0/1 on SW1, Gig0/2 on SW2, or the trunk interfaces are shut down or in +the err-disabled state. + + + +Troubleshooting Trunks + +Trunks support multiple VLANs on a single physical link. A trunk can be between two switches, a switch and a router, and a switch and a server that is providing services for multiple VLANs. This section focuses on issues that prevent a trunk from being formed or passing traffic for a VLAN. Figure 4-11 serves as the topology for all of the examples. + + +PC2 + + + +Gig 0/3 +VLAN 100 Gig 0/1 Gig 0/2 + +PC4 + + + +Gig 0/3 +VLAN 100 +Gig 0/1 Gig 0/2 + + + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 + +VLAN 200 Server +Gig 0/4 +BBBB.BBBB.BBBB +PC5 + + + + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + +VLAN Port +100 Gig 0/1 + +100 Gig 0/2 + +MAC Addresses +AAAA.AAAA.AAAA + +BBBB.BBBB.BBBB + + +SW1 MAC Address Table SW2 MAC Address Table + +Figure 4-11 Troubleshooting Trunks + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 141 + +Encapsulation Mismatch + +Two types of trunking encapsulations are supported by Cisco Catalyst switches: 802.1Q, which is an IEEE standard; and ISL (Inter-Switch Link), which is Cisco proprietary. 802.1Q adds a 4-byte tag to the Ethernet frame, whereas ISL encapsulates the entire Ethernet frame, resulting in an additional 30 bytes. Not all switches support both. For example, +a Catalyst 2960 switch supports only 802.1Q, whereas a Catalyst 3560 and a Catalyst 3750-E support both. To form a trunk between two switches, the interfaces that will be forming the trunk must be using the same encapsulation type. By default, Cisco Catalyst switches that support only 802.1Q will use 802.1Q, Catalyst switches that support both 802.1Q and ISL will autonegotiate the encapsulation using DTP. Therefore, if you connect a Catalyst 2960 and a Catalyst 3750-E together, they will use 802.1Q because that is all the Catalyst 2960 can support. However, if you connect two 3750-Es together, they will negotiate the use of ISL because it is Cisco proprietary. If you are required to use 802.1Q trunks in your environment, you must manually change it from ISL to 802.1Q in that situ-ation. + +Because autonegotiation of encapsulation works very well, you will usually only have an encapsulation mismatch if someone is manually setting the trunking encapsulation. To verify the encapsulation type used on an interface, issue the show interfaces interface_ type interface_number switchport command, as shown in Examples 4-2 and 4-3. + + + +Key Topic + + + + + + + + + + + + + + + +Key Topic + +Example 4-2 Output of show interfaces switchport Command on SW1 to Verify Encapsulation + +SW1#show interfaces gigabitethernet 0/2 switchport +Name: Gi0/2 +Switchport: Enabled +Administrative Mode: trunk +Operational Mode: trunk +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: dot1q +Negotiation of Trunking: Off +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 99 (NATIVE) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +...output omitted... + + +Example 4-3 Output of show interface switchport Command on SW2 to Verify Encapsulation + +SW2#show interfaces gigabitethernet 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: trunk +Operational Mode: trunk +Administrative Trunking Encapsulation: isl + + + + + +From the Library of Outcast Outcast +142 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Operational Trunking Encapsulation: isl +Negotiation of Trunking: Off +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 99 (NATIVE) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +...output omitted... + +From the show interfaces switchport output of Example 4-2 and Example 4-3, you can see that SW1 and SW2 are not using the same trunking encapsulation. SW1 is using 802.1Q, and SW2 is using ISL. Therefore, a trunk will not successfully form in this case. + +You can also verify which trunking encapsulation is being used by looking at the output of show interfaces trunk, as shown in Example 4-4 and Example 4-5. + +Example 4-4 Output of show interfaces trunk Command on SW1 to Verify Encapsulation + +SW1#show interfaces trunk + + +Port Mode +Gi0/2 on + +Encapsulation +802.1q + +Status +trunking + +Native vlan +99 + +Port Vlans allowed on trunk +Gi0/2 1-4094 + +Port Vlans allowed and active in management domain +Gi0/2 1,100,200 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/2 1,100,200 + + +Example 4-5 Output of show interface trunk Command on SW2 to Verify Encapsulation + +SW2#show interfaces trunk + + +Port Mode +Gi0/1 on + +Encapsulation +isl + +Status +trunking + +Native vlan +99 + +Port Vlans allowed on trunk +Gi0/1 1-4094 + +Port Vlans allowed and active in management domain +Gi0/1 1,100,200 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/1 1,100,200 + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 143 + +Incompatible Trunking Modes + +There are different administrative trunking modes an interface can be configured to use when forming a trunk, as follows: + +■ Access: In this administrative mode, a switchport is manually configured to never become a trunk even if DTP messages are received. This mode is designed for ports that are connecting to, for example, end stations, servers, and printers, where a trunk should never be required because only a single VLAN is needed. This mode can be verified as shown in Example 4-6. + +■ Trunk: In this administrative mode, a switchport is manually configured to always be a trunk. This mode can be verified as shown in Example 4-7. + +■ Dynamic desirable: In this administrative mode, a switchport is aggressively try-ing to become a trunk by negotiating with the other end of the link to form a trunk using DTP. If the other end of the link agrees then a trunk is formed; if not, it remains an access port that will listen for DTP messages in addition to periodically sending DTP messages as it continues to try and form a trunk. This mode can be verified as shown in Example 4-8. + +■ Dynamic auto: In this administrative mode, a switchport is passively waiting for DTP messages to arrive asking it to form a trunk. If it receives them, it will form a trunk. If it does not receive any, it remains an access port that will listen for DTP messages. +This mode can be verified as shown in Example 4-9. + +Key Example 4-6 Verifying Trunking Administrative Mode (Access) Topic SW1#show interfaces gigabitethernet 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: static access +Operational Mode: static access +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: Off +Access Mode VLAN: 100 (VLAN100) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +...output omitted... + + +Example 4-7 Verifying Trunking Administrative Mode (Trunk) +Key +Topic SW1#show interfaces gigabitethernet 0/2 switchport +Name: Gi0/2 +Switchport: Enabled +Administrative Mode: trunk +Operational Mode: trunk +Administrative Trunking Encapsulation: dot1q + + +From the Library of Outcast Outcast +144 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Operational Trunking Encapsulation: dot1q +Negotiation of Trunking: Off +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 99 (NATIVE) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +...output omitted... + + +Example 4-8 Verifying Trunking Administrative Mode (Dynamic Desirable) + +SW1#show interfaces gigabitethernet 0/2 switchport +Name: Gi0/2 +Switchport: Enabled +Administrative Mode: dynamic desirable +Operational Mode: trunk +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: dot1q +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 99 (NATIVE) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +...output omitted... + + +Example 4-9 Verifying Trunking Administrative Mode (Dynamic Auto) + +SW1#show interfaces gigabitethernet 0/2 switchport +Name: Gi0/2 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: trunk +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: dot1q +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 99 (NATIVE) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +...output omitted... + +The default administrative mode varies by Catalyst switch model. To verify the default administrative mode on your model, issue the show interfaces interface_type interface_ number switchport command for an interface that is still using factory default settings. Example 4-10 shows that interface Gigabit Ethernet 0/1 is using factory default settings, because no other configurations have been applied to the interface, as shown in the show run interface gigabitethernet 0/1 output. The output of show interfaces gigabitethernet 0/1 switchport | include Administrative Mode indicates that the trunking administrative + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 145 + +mode is dynamic auto. Therefore, we can conclude dynamic auto is the default on this switch because there is no command in the running configuration that indicates other-wise. + +Example 4-10 Verifying Default Trunking Mode on SW2 + +SW2#show run interface gigabitethernet 0/1 +Building configuration... + +Current configuration : 50 bytes +! +interface GigabitEthernet0/1 +end + +SW2#show interfaces gig 0/1 switchport | include Administrative Mode +Administrative Mode: dynamic auto + +Some of these administrative modes are compatible with each other and will form a trunk, whereas others are not, as shown in Table 4-2. While you are looking at Table 4-12, remember that dynamic auto, dynamic desirable, and trunk all use DTP by default. + +Table 4-2 Comparing Trunking Administrative Modes + +SW1 + +Dynamic Auto + +Dynamic Trunk Desirable + +Trunk Access Nonegotiate + + + +Dynamic Access Trunk Auto + +Dynamic Trunk Trunk +SW2 Desirable +Trunk Trunk Trunk + + +Trunk Limited connectivity + +Trunk Limited connectivity + +Trunk Trunk + + +Access + +Access + +Limited connectivity + + + +Trunk Limited Nonegotiate connectivity + + +Limited Trunk Trunk connectivity + + +Limited connectivity + + + +Access Access Access Limited connectivity + + +Limited Access connectivity + + + +As you can see in Table 4-2, if both switchports are configured as dynamic auto, a trunk will not form. The switchports will remain as access ports and pass traffic for the VLAN the port is a member of. To form a trunk with a switchport that is dynamic auto, the other switchport must be using dynamic desirable or trunk (using DTP). Limited con-nectivity is a result of one side being operationally a trunk and the other side being operationally an access port. Connectivity will occur only if the access port VLAN on one switch happens to be the same as the native VLAN for the 802.1Q trunk on the other + + + +From the Library of Outcast Outcast +146 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +switch. If not, connectivity will be broken. The reason is because the access port sends the frames untagged, and once the trunk port receives them at the other end, it considers them as part of the native VLAN because of the lack of a tag. If these VLAN numbers match, the frames can be successfully forwarded without a problem. However, if the native VLAN does not match with the VLAN configured on the access port, the frames when entering or leaving the trunk port on the switch will be part of a different VLAN than the access port and the frames are no longer forwarded correctly, and connectivity is broken. Memorizing Table 4-2 will definitely prove beneficial if you ever have to trouble-shoot trunk links that are not forming. + +VTP Domain Name Mismatch + +We will cover VTP in detail shortly. However, if you are using DTP to dynamically form trunks and the VTP domain name does not match between the two switches, a trunk will not be formed, as shown in Example 4-11. + +Example 4-11 VTP Domain Name Mismatch Causes Trunk Not to Form + +SW1# +%DTP-5-DOMAINMISMATCH: Unable to perform trunk negotiation on port Gi0/2 because of VTP domain mismatch. + + +Native VLAN Mismatch + +Trunk issues with the native VLAN only surface when we are using IEEE 802.1Q trunk-ing encapsulation. The concept of a native VLAN does not exist with Cisco ISL trunking encapsulation. The native VLAN by default is VLAN 1 and is used to carry untagged traffic across an 802.1Q trunk. It is imperative that the native VLAN matches on both sides of a trunk link. If it does not, it is possible for traffic to leak from one VLAN to another, resulting in an undesired forwarding behavior and possible errors with Spanning Tree Protocol. + +With a native VLAN mismatch, the trunk forms, and syslog messages are generated, as shown in Example 4-12. From the example, you can see that Cisco Discovery Protocol (CDP) is warning you about the native VLAN mismatch; however, if CDP is not enabled, this message would not appear. Example 4-13 displays the output of show interfaces trunk on SW1 and SW2, confirming that we have a native VLAN mismatch. + + +Example 4-12 +Key +Topic SW1# + + +Result of a Native VLAN Mismatch on a Trunk + +%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/2 (1), with SW2 GigabitEthernet0/1 (99). +SW2# +%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/1 (99), with SW1 GigabitEthernet0/2 (1). + + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 147 + +Example 4-13 Confirming the Native VLAN Mismatch with the show interfaces trunk Command + +SW1#show interfaces trunk + +Port Mode +Gi0/2 desirable + +Encapsulation +n-802.1q + +Status +trunking + +Native vlan +1 + +...output omitted... + +SW2#show interfaces trunk + +Port Mode +Gi0/1 desirable + +Encapsulation +n-802.1q + +Status +trunking + +Native vlan +99 + +...output omitted... + + +Allowed VLANs + + + +Key Topic + +By default, traffic for all VLANs will be forwarded on a trunk. You can modify this behavior by identifying which VLANs are allowed on the trunk. You can accomplish this manually or dynamically. If you are using VTP to propagate VLAN configuration information, you can use the VTP pruning feature, which dynamically determines which VLANs are needed on each of the trunks. You can enable VTP pruning with the vtp pruning global configuration command. Many prefer to control the VLANs allowed on trunks manually with the switchport trunk allowed vlans vlan_id command in interface configuration mode. You can verify which VLANs are allowed on a trunk a few differ-ent ways. You can use the show interfaces trunk command, the show interface inter- +face_type interface_number switchport command, or review the interface configuration in the running configuration. Example 4-14 displays the output from these three com-mands. Focus on the highlighted text because it identifies which VLANs are allowed on the trunk. If traffic is not flowing across a trunk for a specific VLAN, make sure that the +VLAN is allowed on the trunk. + + +Example 4-14 Verifying Allowed VLANs on a Trunk + +SW1#show interfaces trunk + +Port Mode +Gi0/2 desirable + +Encapsulation +n-802.1q + +Status +trunking + +Native vlan +99 + + +Port Vlans allowed on trunk +Gi0/2 100,200 + +Port Vlans allowed and active in management domain +Gi0/2 100,200 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/2 100,200 + +SW1#show interfaces gigabitethernet 0/2 switchport +Name: Gi0/2 +Switchport: Enabled + + + +From the Library of Outcast Outcast +148 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +...output omitted... +Trunking VLANs Enabled: 100,200 +Pruning VLANs Enabled: 2-1001 +Capture Mode Disabled +...output omitted... + +SW1#show run interface gigabitethernet 0/2 +Building configuration... + +Current configuration : 167 bytes +! +interface GigabitEthernet0/2 +switchport trunk native vlan 99 +switchport trunk allowed vlan 100,200 +switchport mode dynamic desirable +end + + +Troubleshooting VTP + +Picture a network with 50 switches and 75 VLANs. You have been tasked with deploying these 75 VLANs to all 50 switches. This is a large task that is definitely prone to human error. VLAN Trunking Protocol (VTP) is designed to ease the deployment of VLAN configuration information between switches across trunk links. This section explains +the reasons why VTP might not be sharing VLAN configuration information with other switches in the domain. Figure 4-11 is used as the topology for the examples. SW1 and SW2 need to have the same VLAN database. + +Domain Name Mismatch + +Switches that will learn VLAN configuration information from each other using VTP need to be in the same VTP domain. The VTP domain is identified by a name known as the VTP domain name, and it can be anything you want it to be. However, it must match on the devices that will be exchanging VLAN configuration information. Suppose, for example, that SW1 in Figure 4-11 is using a VTP domain name of TSHOOT and SW2 is using a VTP domain name of TSHOOT. Obviously, they match. What about SW1 using TSHOOT and SW2 using TSHO0T? It looks like they match, but they do not. The VTP domain name for SW2 has a zero (0) in it instead of the letter O. Compare Examples 4-15 and 4-16, which display the output of show vtp status on SW1 and SW2. Are SW1 and +SW2 in the same VTP domain? + +Example 4-15 Verifying the VTP Domain Name on SW1 +Key +Topic SW1#show vtp status + +VTP Version capable +VTP version running +VTP Domain Name + +: 1 to 3 +: 3 +: Tshoot + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 149 + + +VTP Pruning Mode +VTP Traps Generation +Device ID +...output omitted... + +: Disabled +: Disabled +: 001c.57fe.f600 + + + +Example 4-16 Verifying the VTP Domain Name on SW2 +Key +Topic SW2#show vtp status + +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID +...output omitted... + +: 1 to 3 +: 3 +: TSHOOT +: Disabled +: Disabled +: 2893.fe3b.0100 + + +Note that case does matter for the VTP domain name. Therefore, SW1 and SW2 are in completely different VTP domains and will not share VLAN configuration information with each other. In addition, as mentioned earlier, if you are using DTP to form a trunk and you have a VTP domain name mismatch, a trunk will not form. + +Version Mismatch + +There are three versions of VTP: VTPv1, VTPv2, and VTPv3. VTPv1 is the default. If you are running VTPv1, all switches need to be using VTPv1 to successfully exchange VLAN configuration information. If you are running VTPv2 or VTPv3 the switches can be using VTPv2 or VTPv3 because they are compatible. However, to reduce the possibility of issues, it is recommended that you avoid mixing VTP versions. To verify the VTP version in use on a switch, issue the show vtp status command, as shown in Example 4-17. Also notice in the output that SW2 is capable of running all three versions of VTP. + +Example 4-17 Verifying the VTP Version on SW2 + + +SW2#show vtp status +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID +...output omitted... + + +: 1 to 3 +: 3 +: TSHOOT +: Disabled +: Disabled +: 2893.fe3b.0100 + + + +Mode Mismatch + +VTP has four modes of operation: Server, Client, Transparent, and Off. For a switch to use the VLAN configuration information in a VTP message, it must be in Server or Client mode. A switch operating in Transparent mode will ignore the information contained in + + + +From the Library of Outcast Outcast +150 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +a VTP message; however, it will still forward on the message to other switches. In Off mode, the switch behaves the same as Transparent mode, except that it will not forward on VTP messages that it receives. Therefore, if you are troubleshooting an issue that involves missing VLANs on a switch and you are using VTP, check whether the switch is in VTP Transparent mode or Off. To verify the VTP mode used on a switch, issue +the show vtp status command, as shown in Examples 4-18 and 4-19. In addition, with VTPv3, only the VTP primary server can add or delete VLANs. + +Example 4-18 Verifying the VTP Mode on SW1 + + +SW1#show vtp status +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID + +Feature VLAN: +-------------- +VTP Operating Mode +Number of existing VLANs + + +: 1 to 3 +: 3 +: SWITCH +: Disabled +: Disabled +: 2893.fe3b.0100 + + + +: Server +: 10 + +Number of existing extended VLANs : 0 +Maximum VLANs supported locally : 1005 +Configuration Revision : 3 +...output omitted... + + +Example 4-19 Verifying the VTP Mode on SW2 + + +SW2#show vtp status +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID + +Feature VLAN: +-------------- +VTP Operating Mode +Number of existing VLANs + + +: 1 to 3 +: 3 +: SWITCH +: Disabled +: Disabled +: 001c.57fe.f600 + + + +: Client +: 10 + +Number of existing extended VLANs : 0 +Maximum VLANs supported locally : 255 +Configuration Revision : 3 +...output omitted... + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 151 + +Password Mismatch + +To ensure that a switch only uses VTP configuration information from legitimate sources, it is recommended that a VTP password is set. When a switch receives a VTP message from another switch, it will verify that the attached message digest 5 (MD5) algorithm hash matches its local hash. If it matches, the VTP message is from a legitimate source and is processed. If not, the VTP message is discarded. Remember that the VTP password is case sensitive. Example 4-20 shows how you can verify the password that is configured with the show vtp password command and the hash value that will be used with the show vtp status command. + +Example 4-20 Verifying VTP Passwords + +SW1#show vtp password +VTP Password: CCNP + + +SW1#show vtp status +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID + +Feature VLAN: +-------------- +VTP Operating Mode +Number of existing VLANs + + +: 1 to 3 +: 3 +: SWITCH +: Disabled +: Disabled +: 2893.fe3b.0100 + + + +: Server +: 11 + +Number of existing extended VLANs : 0 + +Maximum VLANs supported locally +Configuration Revision +Primary ID +Primary Description +MD5 digest + +...output omitted... + +: 1005 +: 2 +: 2893.fe3a.e300 +: DSW1 +: 0x98 0x29 0xB8 0x5D 0x4D 0x48 0x71 0xE3 +0x8A 0x93 0x8E 0x82 0x2B 0xEA 0xA0 0x45 + + + +Higher Revision Number + +When a switch in VTP server mode makes a change to the VLAN database, it incre-ments the configuration revision number shown in Example 4-20. Currently it is 2, but if another VLAN were added or a modification were made that affected the VLAN data-base, VTP would increment the configuration revision number. This number is extremely important because the switch with the higher configuration revision number is consid-ered to have the most up-to-date and valid VLAN database. However, this might not always be the case. For example, suppose that you are preparing for the TSHOOT exam and you are troubleshooting VLANs. You keep adding and deleting VLANs while using + + + +From the Library of Outcast Outcast +152 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +VTPv1 to propagate your changes to the other switches in your lab pod. Now you have a really high configuration revision number. The next day a coworker plugs your lab pod into the production network, and your lab VLAN database overwrites the VLAN data- +base of the production network because you were using the same domain name and pass-word on your lab devices and the lab had a higher configuration revision number than the production network. Now you need to rebuild the production VLAN database or restore it from backup, if you have one. + +You need to prevent this from ever happening by ensuring no one uses the same VTP domain name or password on other devices and then plugs them into the produc- +tion network. However, that is hard to control. So, it is better to run all the switches in Transparent mode and only use Server or Client mode when you are building the VLAN database or making significant changes that have to be propagated to all the other switch-es. This is because Transparent mode switches will not update their VLAN information from VTP messages, protecting you from having your VLAN database overwritten. You may also want to consider having all switches in VTP Transparent mode when they are added to the domain so that their configuration revision number is 0, which it always is for Transparent mode. Your best option is to use VTPv3 because only the VTP primary server will be considered a trusted source of VTP messages within the VTP domain, and any other VTP messages will be ignored, ensuring that your database is not overwritten by a rouge switch. + +Troubleshooting VLANs + +Our discussions have led us to this important point in this chapter: Being able to identify and solve issues with VLANs. This is an important task for any troubleshooter. Some of these issues could be a result of a trunk or VTP issue, as previously discussed. This sec-tion identifies the issues that might arise with VLANs and how you can fix them. The discussion is based on Figure 4-11. + +Incorrect IP Addressing + +It all starts with the client configuration. If the IP address, subnet mask, or default gate-way are not configured correctly, frames will not flow as expected. Example 4-21 dis-plays the output of ipconfig on PC1 and Server. If you look closely, you will notice that Server is not addressed correctly, and therefore not in the same subnet. When PC1 needs to send data to Server, because they are not on the same subnet, PC1 will send the frame to its default gateway so that it can be routed to a different subnet. However, this pro-cess will fail at some point because both PC1 and Server cannot be in the same Layer 2 VLAN (as Figure 4-11 shows), within different IP networks. They need to be in the same subnet if they are in the same VLAN so that frames can be sent from PC1 directly to Server based on the Layer 2 MAC addresses. + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 153 + +Example 4-21 Verifying End-User IP Addresses + +PC1>ipconfig +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.100.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Default Gateway . . . . . . . . . : 10.1.100.1 + +Server>ipconfig +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.10.11 +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Default Gateway . . . . . . . . . : 10.1.10.1 + + +Missing VLAN + +For a switch to associate switchports with VLANs or to pass traffic over a trunk for a VLAN, the switch needs to know about the VLAN. The command show vlan brief, as +shown in Example 4-22, displays the VLANs that are known by the switch. + +Key Example 4-22 Verifying VLANs on a Switch Topic SW1#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +99 NATIVE +100 10.1.100.0/24 +200 10.1.200.0/24 + +active Gi0/5, Gi0/6, Gi0/7, Gi0/8, +Gi0/9, Gi0/10, Gi0/11, Gi0/12, +Gi0/13, Gi0/14, Gi0/15, Gi0/16, +Gi0/17, Gi0/18, Gi0/19, Gi0/20, +Gi0/21, Gi0/22, Gi0/23, Gi0/24, +Te1/0/1, Te1/0/2 +active +active Gi0/1, Gi0/3 +active Gi0/4 + + + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + + + + +From the Library of Outcast Outcast +154 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +If any VLANs are missing from the output of show vlan brief that should be there, you need to find out why. If VLANs are configured manually in your organization, the answer is one of two reasons: Someone forgot to configure the VLAN on the switch, or some-one deleted the VLAN on the switch. If the creation and deletion of VLANs is learned +by other switches though VTP, you need to troubleshoot why VTP is not propagating the VLAN information to the other switches. However, it is important to remember that if you are using VTPv1 or 2 and a switch is added to the domain with the correct pass-word, and has a higher revision number, the VLAN database in your VTP domain will be overwritten by this switch. Therefore, if you are missing VLANs, this could be the reason why. + +In Example 4-23, which displays the output of show interfaces gigabitethernet 0/1 switchport, focus on the highlighted text. Notice in brackets the name of the VLAN. It is listed as (Inactive). This is a great sign that the interface belongs to a VLAN that does not currently exist on the switch. Note that even though the port is up/up, because the VLAN does not exist, the port will not be forwarding traffic. + +Example 4-23 Identifying Missing VLANs on a Switch + +SW1#show interfaces gigabitethernet 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: static access +Operational Mode: static access +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: Off +Access Mode VLAN: 100 (Inactive) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none + + +Incorrect Port Assignment + + + +Key Topic + +Once VLANs are created, switchports need to be assigned to VLANs. The assignments should be based on which device is going to be connected to that port (based on IP address, subnet mask, and default gateway). For example, in Figure 4-11, PC1, PC2, PC4, and Server have to be in the same logical subnet because they are all connected to ports in VLAN 100. PC3 and PC5 have to be in the same subnet (but different from the other devices) because they are connected to ports in VLAN 200. If this is not done, the VLAN to switchport assignments would be incorrect, and the switch would not be able to for-ward the frames successfully between the devices within the same VLAN. Example 4-24 displays the output of show vlan brief, which identifies the VLANs ports are assigned +to. By default, all ports are assigned to VLAN 1. Gig0/1 and Gig0/3 have been statically +assigned to VLAN 100, and Gig0/4 has been statically assigned to VLAN 200. + + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 155 + +Example 4-24 Verifying Switchport Assignment + +SW1#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +99 NATIVE +100 10.1.100.0/24 +200 10.1.200.0/24 + +active Gi0/5, Gi0/6, Gi0/7, Gi0/8, +Gi0/9, Gi0/10, Gi0/11, Gi0/12, +Gi0/13, Gi0/14, Gi0/15, Gi0/16, +Gi0/17, Gi0/18, Gi0/19, Gi0/20, +Gi0/21, Gi0/22, Gi0/23, Gi0/24, +Te1/0/1, Te1/0/2 +active +active Gi0/1, Gi0/3 +active Gi0/4 + + + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +It is important to note that ports that belong to VLANs that do not exist will not be dis-played in the output of show vlan brief. As Example 4-23 displayed, they will appear as (Inactive) in the output of show interfaces switchport. In addition, trunk ports will not appear in the output of show vlan brief. Notice in Example 4-24 that Gig0/2 is missing because it is a trunk port and does not belong to any single VLAN. It is passing traffic for multiple VLANs. + +The MAC Address Table + + + + + + + + + +Key Topic + +The MAC address table is the most important table for the switch. The MAC address table is the structure that is used by the switch to make a forwarding decision. If the MAC address table is not being populated the way you expect it, you will need to figure out why. This section covers the MAC address table and its importance, using Figure 4-11 +as the reference topology. + +Example 4-25 displays the dynamically learned MAC addresses on SW1 with the com-mand show mac address-table dynamic. The structure of the table is important. It lists the VLANs, the dynamically learned MAC addresses, and the ports. This information is extremely valuable. As discussed earlier, it is populated based on the source MAC address of the frame when it arrives on a switchport. Therefore, when SW1 received a +frame inbound on Gigabit Ethernet 0/1 from PC1, it learned the MAC from the frame and +associated it with the port it arrived on and the VLAN the port is a member of. + + +Example 4-25 SW1’s MAC Address Table + +SW1#show mac address-table dynamic +Mac Address Table +------------------------------------------- + + + + +From the Library of Outcast Outcast +156 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Vlan Mac Address +---- ----------- +100 aaaa.aaaa.aaaa +100 bbbb.bbbb.bbbb +100 cccc.cccc.cccc +100 dddd.dddd.dddd +200 3333.3333.3333 +200 5555.5555.5555 + +Type Ports +-------- ----- +DYNAMIC Gi0/1 +DYNAMIC Gi0/2 +DYNAMIC Gi0/3 +DYNAMIC Gi0/2 +DYNAMIC Gi0/4 +DYNAMIC Gi0/2 + +Total Mac Addresses for this criterion: 6 + +Let’s look at an example. What can we conclude by looking at the MAC address table for SW1 displayed in Example 4-26 when comparing it to Figure 4-11? + +Example 4-26 Example of SW1’s MAC Address Table + +SW1#show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +100 bbbb.bbbb.bbbb +100 cccc.cccc.cccc +100 dddd.dddd.dddd +200 3333.3333.3333 +200 5555.5555.5555 +200 aaaa.aaaa.aaaa + +Type Ports +-------- ----- +DYNAMIC Gi0/2 +DYNAMIC Gi0/3 +DYNAMIC Gi0/2 +DYNAMIC Gi0/4 +DYNAMIC Gi0/2 +DYNAMIC Gi0/1 + +Total Mac Addresses for this criterion: 6 + +When comparing Figure 4-11 with Example 4-26, we can conclude that interface Gigabit Ethernet 0/1 is not a member of the correct VLAN. The MAC address table shows the MAC address of PC1 (AAAA.AAAA.AAAA) was learned on the correct interface, but the VLAN number is 200 instead of 100. Reviewing the output of show vlan brief and show interfaces gigabitethernet 0/1 switchport, as demonstrated in Example 4-27, con-firms this for us. Our next step is to reassign the port to the correct VLAN. + +Example 4-27 Confirming SW1’s VLAN Assignments + +SW1#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +99 NATIVE + +active Gi0/5, Gi0/6, Gi0/7, Gi0/8, +Gi0/9, Gi0/10, Gi0/11, Gi0/12, +Gi0/13, Gi0/14, Gi0/15, Gi0/16, +Gi0/17, Gi0/18, Gi0/19, Gi0/20, +Gi0/21, Gi0/22, Gi0/23, Gi0/24, +Te1/0/1, Te1/0/2 +active + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 157 + + +100 10.1.100.0/24 +200 10.1.200.0/24 + +active Gi0/3 +active Gi0/1, Gi0/4 + + + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +SW1#show interfaces gigabitethernet 0/1 switchport +Name: Gi0/1 +Switchport: Enabled +Administrative Mode: static access +Operational Mode: static access +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: Off +Access Mode VLAN: 200 (10.1.200.0/24) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +...output omitted... + +While troubleshooting, if you ever need to clear the dynamic entries in the MAC address table immediately so that they can be relearned, giving you the opportunity to confirm the correct associations, issue the clear mac address-table dynamic EXEC command. + +Layer 2 Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 4-12. + +CCCC.CCCC.CCCC PC2 PC4 DDDD.DDDD.DDDD + + +10.1.100.10 255.255.255.0 DG: 10.1.100.1 + +Gig 0/1 + + +Gig 0/3 +VLAN 100 Gig 0/2 + + +Gig 0/3 +VLAN 100 Gig 0/1 + +10.1.100.100 255.255.255.0 DG: 10.1.100.1 + +Gig 0/2 + + + +VLAN 100 + +PC1 +AAAA.AAAA.AAAA + + +SW1 Trunk Gig 0/4 +VLAN 200 + +PC3 + +SW2 VLAN 100 +Gig 0/4 Server VLAN 200 BBBB.BBBB.BBBB +PC5 + +3333.3333.3333 5555.5555.5555 + +Figure 4-12 Topology for Trouble Tickets + + + + +From the Library of Outcast Outcast +158 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Trouble Ticket 4-1 + +Problem: A user on PC1 indicates that he is not able to access a document on Server. + +This is a typical description within a trouble ticket. Therefore, the first process is to veri-fy the issue. A simple ping from PC1 will help us with this, as shown in Example 4-28. + +Example 4-28 Issuing a Ping from PC1 + +PC1>ping 10.1.100.100 + +Pinging 10.1.100.100 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.100.100: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +The output of Example 4-28 indicates that the ping failed. What did we learn from this ping? We learned that we have no connectivity from Layer 1 to Layer 3 of the OSI +model. Therefore, we can focus our troubleshooting efforts at these layers. However, let’s verify whether others are having the same issue. A ping from PC2 is successful, as shown in Example 4-29. Therefore, it is not a problem with the server or the path from PC2 to the server, which is similar to PC1. + +Example 4-29 Issuing a Ping from PC2 + +PC2>ping 10.1.100.100 + +Pinging 10.1.100.100 with 32 bytes of data: + +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.100.100: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +Let’s start by checking the IP address of PC1. Using the ipconfig command, as shown in Example 4-30, indicates that the IP address, subnet mask, and default gateway are 10.1.100.10, 255.255.255.0, and 10.1.100.1. According to Figure 4-11, these are correct. + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 159 + +Example 4-30 Verifying PC1’s Layer 3 Settings + +PC1>ipconfig +Windows IP Configuration + + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.100.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Default Gateway . . . . . . . . . : 10.1.100.1 + +The next step is to check the MAC address table on SW1 using the command show mac address-table dynamic. Example 4-31 shows that the MAC address of PC1 was learned on Gigabit Ethernet 0/1, which is correct, but it is associated with VLAN 1 instead of VLAN 100. It appears we have found the problem. However, let’s confirm this further with the show vlan brief command, as shown in Example 4-32. + +Example 4-31 Verifying PC1 in the MAC Address Table on SW1 + +SW1#show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 aaaa.aaaa.aaaa +100 bbbb.bbbb.bbbb +100 cccc.cccc.cccc +100 dddd.dddd.dddd +200 3333.3333.3333 +200 5555.5555.5555 + +Type Ports +-------- ----- +DYNAMIC Gi0/1 +DYNAMIC Gi0/2 +DYNAMIC Gi0/3 +DYNAMIC Gi0/2 +DYNAMIC Gi0/4 +DYNAMIC Gi0/2 + +Total Mac Addresses for this criterion: 6 + + +Example 4-32 Verifying VLAN Port Assignments with the show vlan brief Command + +SW1#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +99 NATIVE +100 10.1.100.0/24 + +active Gi0/1, Gi0/5, Gi0/6, Gi0/7, +Gi0/8, Gi0/9, Gi0/10, Gi0/11, +Gi0/12, Gi0/13, Gi0/14, Gi0/15, +Gi0/16, Gi0/17, Gi0/18, Gi0/19, +Gi0/20, Gi0/21, Gi0/22, Gi0/23, +Gi0/24, Te1/0/1, Te1/0/2 +active +active Gi0/3 + + + + +From the Library of Outcast Outcast +160 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +200 10.1.200.0/24 active Gi0/4 + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +To solve the problem, we change the switchport VLAN assignment with the switchport access vlan 100 interface command and verify that the problem is solved by pinging from PC1 again. Example 4-33 confirms that the problem is solved. + +Example 4-33 Confirming That the Problem Is Solved with a Successful Ping + +PC1>ping 10.1.100.100 + +Pinging 10.1.100.100 with 32 bytes of data: + +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.100.100: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 4-2 + +Problem: A user on PC2 indicates that she is not able to access a document on Server. + +As before, the first process is to verify the issue. A simple ping from PC2 will help us with this, as shown in Example 4-34. + +Example 4-34 Issuing a Ping from PC2 + +PC2>ping 10.1.100.100 + +Pinging 10.1.100.100 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.100.100: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 161 + +The output of Example 4-34 indicates that the ping failed. What did we learn from this ping? We learned that we have no connectivity from Layer 1 to Layer 3 of the OSI model. Therefore, we can focus our troubleshooting efforts at these layers. However, +let’s verify whether others are having the same issue. A ping from PC1 fails, as shown in Example 4-35. + +Example 4-35 Issuing a Ping from PC1 + +PC1>ping 10.1.100.100 + +Pinging 10.1.100.100 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.100.100: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Therefore, this is not an isolated issue, and we should be looking for causes that would affect multiple users. First thing that comes to mind is a missing VLAN on SW1. PC1 and PC2 are both members of VLAN 100. Using the command show vlan brief on SW1 will verify whether the VLAN exists and which switchports are associated with it. As you can see from Example 4-36 , VLAN 100 exists, and both switchports for PC1 and PC2 are associated with it. + +Example 4-36 Verifying That VLAN 100 Exists on SW1 with show vlan brief + +SW1#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +99 NATIVE +100 10.1.100.0/24 +200 10.1.200.0/24 + +active Gi0/5, Gi0/6, Gi0/7, Gi0/8, +Gi0/9, Gi0/10, Gi0/11, Gi0/12, +Gi0/13, Gi0/14, Gi0/15, Gi0/16, +Gi0/17, Gi0/18, Gi0/19, Gi0/20, +Gi0/21, Gi0/22, Gi0/23, Gi0/24, +Te1/0/1, Te1/0/2 +active +active Gi0/1, Gi0/3 +active Gi0/4 + + + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +However, this is not enough evidence to shift our focus just yet. The most important information comes from the MAC address table. This will truly verify that the MAC + + + +From the Library of Outcast Outcast +162 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +addresses of PC1 and PC2 are being learned on the correct interfaces and are being associated with the correct VLAN. Example 4-37 displays the output of the show mac address-table dynamic command and confirms for us that the MAC addresses are learned correctly and that the ports are associated with the correct VLANs. + +Example 4-37 Verifying the MAC Address in the MAC Address Table + +SW1#show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +100 aaaa.aaaa.aaaa +100 cccc.cccc.cccc +200 3333.3333.3333 +200 5555.5555.5555 + +Type Ports +-------- ----- +DYNAMIC Gi0/1 +DYNAMIC Gi0/3 +DYNAMIC Gi0/4 +DYNAMIC Gi0/2 + +Total Mac Addresses for this criterion: 4 + +However, look very closely at the MAC address table in Example 4-37. What is missing? Do you see any reference to the MAC address of Server? The MAC address of Server is not being learned on Gigabit Ethernet 0/2 of SW1. As a matter of fact, neither is PC4. However, PC5 is being learned. This is a good indication that traffic for VLAN 100 is not being allowed over the trunk. Let’s verify this on SW1 with the command show interfaces trunk, as shown in Example 4-38. This output shows that VLAN 100 and 200 are allowed on the trunk between SW1 and SW2. + +Example 4-38 Verifying Allowed VLANs on SW1 Trunks + +SW1#show interfaces trunk + +Port Mode +Gi0/2 desirable + +Encapsulation +n-802.1q + +Status +trunking + +Native vlan +99 + + +Port Vlans allowed on trunk +Gi0/2 100,200 + +Port Vlans allowed and active in management domain +Gi0/2 100,200 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/2 100,200 + +Let’s check the output of show interfaces trunk on SW2. As shown in Example 4-39, VLAN 200 is the only VLAN allowed on the trunk link. A further examination of the running configuration, as shown in Example 4-40, indicates that only VLAN 200 is allowed on the trunk. + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 163 + +Example 4-39 Verifying Allowed VLANs on SW2 Trunks + +SW2#show interfaces trunk + +Port Mode +Gi0/1 desirable + +Encapsulation +n-802.1q + +Status +trunking + +Native vlan +99 + + +Port Vlans allowed on trunk +Gi0/1 200 + +Port Vlans allowed and active in management domain +Gi0/2 200 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/2 200 + + +Example 4-40 Verifying Interface Configuration in the Running Configuration + +SW2#show run interface gigabitethernet 0/1 +Building configuration... + +Current configuration : 167 bytes +! +interface GigabitEthernet0/1 +switchport trunk native vlan 99 +switchport trunk allowed vlan 200 +switchport mode dynamic desirable +end + +After issuing the interface command switchport trunk allowed VLAN 100,200 on SW2 to allow both VLAN 100 and 200, you ping from PC1 and PC2 again to verify that the issue is solved. The ping is successful from PC1 and PC2, as illustrated in Example 4-41. + +Example 4-41 Verifying That the Issue Is Solved + +PC1>ping 10.1.100.100 +Pinging 10.1.100.100 with 32 bytes of data: + +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.100.100: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +PC2>ping 10.1.100.100 + + + +From the Library of Outcast Outcast +164 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Pinging 10.1.100.100 with 32 bytes of data: + +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 +Reply from 10.1.100.100: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.100.100: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 165 + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 4-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 4-3 Key Topics for Chapter 4 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +List + +Example 4-2 + +Example 4-3 + +Example 4-6 + +Example 4-7 + +Example 4-12 + +Section + +Example 4-15 + +Example 4-16 + +Example 4-22 + +Section + +A review of the frame-forwarding process 132 + +Outlines potential issues that arise with a Layer 2 140 topology +Output of show interfaces switchport command on 141 SW1 to verify encapsulation +Output of show interfaces switchport command on 141 SW2 to verify encapsulation +Verifying trunking administrative mode (access) 143 + +Verifying trunking administrative mode (trunk) 143 + +Result of native VLAN mismatch on trunk 146 + +Allowed VLANs 147 + +Verifying the VTP domain name on SW1 148 + +Verifying the VTP domain name on SW2 149 + +Verifying VLANs on a switch 153 + +Incorrect port assignment 154 + + +Paragraph Using the MAC address table during troubleshooting 155 + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +frame, MAC address table, source MAC, destination MAC, encapsulation, 802.1Q, ISL, trunk, access port, dynamic desirable, dynamic auto, native VLAN, VTP, VTP domain name, VLAN + + + +From the Library of Outcast Outcast +166 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + +Command Reference to Check Your Memory + +This section includes the most important EXEC show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 4-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot switches. + +Table 4-4 EXEC CLI show Commands + +Task Command Syntax + +Displays the contents of the MAC address table, including the MAC address associated with a port and the VLAN the port is a member of. Without the dynamic keyword, both static and dynamic entries are displayed. With the dynamic keyword, only dynamically learned entries are displayed. +Clears dynamically learned MAC addresses from the MAC address table of a switch; this can allow +a troubleshooter to determine whether a previously learned MAC address is relearned. + +Note that on some versions of Cisco IOS running on Cisco Catalyst switches, the clear mac address-table command contains a hyphen between mac and address (that is, clear mac-address-table). +Shows to which VLANs the ports of a switch belong. + +Displays which VLANs are permitted on the trunk ports of a switch and which switchports are configured as trunks. + + +show mac address-table [dynamic] + + + + + +clear mac address-table dynamic + + + + + + + +show vlan brief + +show interfaces trunk + + + + + + + + + +From the Library of Outcast Outcast +Chapter 4: Troubleshooting Layer 2 Trunks, VTP, and VLANs 167 + + + +Task +Displays VLAN and trunk information related to a switchport. You can verify the operational mode (access or trunk), in addition to the encapsulation +(802.1Q or ISL). You can also verify the access VLAN the port will be a member of if it is an access port, in addition to the native VLAN if it is a trunk port. +Displays the VTP domain name, configuration revision number, version, mode, and MD5 hash. +Displays the configured VTP password. + +Command Syntax +show interfaces interface_type interface_number switchport + + + + +show vtp status + +show vtp password + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Spanning-Tree Protocol Overview: This section reviews how STP determines the STP topology from root bridge election to which ports will be nondesig-nated. + +■ Collecting Information About an STP Topology: This section identifies the show commands required to successfully troubleshoot STP issues. + +■ STP Troubleshooting Issues: This section focuses on what could happen if STP is not behaving as expected. + +■ Troubleshooting STP Features: This section reviews STP features such as PortFast, BPDU Guard, Root Guard, and BPDU Filter. It also identifies the show commands that can help during the troubleshooting process. + +■ STP Trouble Tickets: This section provides trouble tickets that demonstrate how a structured trouble-shooting process can be used to solve a reported problem. + +■ Troubleshooting Layer 2 EtherChannel: This sec-tion reviews how Layer 2 EtherChannels are formed and identifies issues that could cause them to fail. + +■ EtherChannel Trouble Tickets: This section provides trouble tickets that demonstrate how a structured troubleshooting process can be used to solve a reported problem. + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 5 + + + + +Troubleshooting STP and Layer 2 EtherChannel + + +Maintaining high availability for today’s enterprise networks is a requirement for many applications, such as voice and e-commerce, which can impact a business’s bottom line if these applications are unavailable for even a short period. To improve availability, many enterprise networks interconnect Layer 2 switches with redundant connections, allowing a single switch or a single link to fail while still maintaining connectivity between any two network endpoints. Such a redundant topology, however, can result in Layer 2 loops, which can cause frames to endlessly circle a LAN (for example, broadcast frames creat-ing a broadcast storm). Therefore, Spanning Tree Protocol (STP) is used to logically break these Layer 2 topological loops by strategically blocking ports, while being able to detect a link failure and bring up a previously blocked switchport to restore connectivity. This chapter reviews the operation of STP and focuses on troubleshooting STP issues. + +In addition, this chapter reviews how you can combine multiple physical Layer 2 switch-ports into a logical EtherChannel bundle. This increases the total bandwidth available on uplinks and tricks STP into thinking there is only one port between the switches instead of multiple ports. As a result, all links are used for traffic forwarding instead of STP blocking them. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 5-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 5-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Spanning-Tree Protocol Overview + +Collecting Information About an STP Topology + +STP Troubleshooting Issues + +Troubleshooting STP Features + +Troubleshooting Layer 2 EtherChannel + +Questions +1–4 + +5 + +6 + +7 + +8–10 + + + + +From the Library of Outcast Outcast +170 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. What determines the switch that will be the STP root bridge for a VLAN? + +a. Lowest priority + +b. Lowest MAC address + +c. Lowest bridge ID + +d. Lowest cost + +2. What is the STP port type for all ports on a root bridge? + +a. Designated port + +b. Root port + +c. Nondesignated port + +d. Nonroot port + +3. When determining the root port of a nonroot bridge, if cost is tied, what is refer-enced next to break the tie? + +a. Downstream bridge ID + +b. Upstream bridge ID + +c. Downstream port ID + +d. Upstream port ID + +4. What is the maximum age for an STP BPDU in seconds? + +a. 2 + +b. 15 + +c. 20 + +d. 50 + +5. Which two of the following commands are most helpful in determining STP informa-tion for a Layer 2 switch? + +a. show spanning-tree vlan + +b. debug spanning-tree state + +c. show spanning-tree interface + +d. show port span + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 171 + +6. What are two common issues that could result from an STP failure? + +a. Tagged frames being sent into a native VLAN + +b. Broadcast storms + +c. MAC address table filling to capacity + +d. MAC address table corruption + +7. Which STP feature ensures that certain ports in the STP topology never become root ports, and if the port receives a superior BPDU it places it in the root inconsistent state? +a. BPDU Guard + +b. BPDU Filter + +c. Root Guard + +d. PortFast + +8. Which switch feature allows multiple physical links to be bonded into a logical link? + +a. STP + +b. EtherChannel + +c. PortFast + +d. Switch virtual interfaces + +9. What must match on physical switchports to successfully form an EtherChannel bundle? (Choose three.) + +a. Interface speed + +b. Interface mode (access/trunk) + +c. Native VLAN + +d. STP port cost + +10. What combination will successfully form a Cisco proprietary Layer 2 EtherChannel bundle? + +a. Active – Passive + +b. On – Active + +c. Desirable – Auto + +d. Desirable – Passive + + + + + + + + +From the Library of Outcast Outcast +172 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Spanning Tree Protocol Overview + +Network availability at Layer 2 of the OSI model requires redundant links between the switches in your topology as well as redundant paths through the network. However, this creates a problem known as a Layer 2 loop, as shown in Figure 5-1. Notice how traffic from SW1 can be sent on both links to SW2 and vice versa. Therefore, traffic sent from SW1 on one link to SW2 can go back to SW1 on the other link and continue indefinitely because there is no mechanism built in to a Layer 2 frame that will stop the frame from looping forever through the network, as shown with Loop1 in Figure 5-1. In addition, notice how there is a larger loop between SW1, SW3, and SW2 (Loop 2). Therefore, frames sent out any of the interfaces interconnecting these switches could loop indefi-nitely through the network as well. This is different from Layer 3 packets that have a time-to-live (TTL) field that will terminate the packet if it does not reach its destination +within a finite number of router hops. Therefore, Layer 2 loops need to be prevented by a protocol known as Spanning Tree Protocol (STP). IEEE 802.1D STP allows a network to physically have Layer 2 loops while strategically blocking data from flowing over one or more switchports to prevent the looping of traffic. + +Loop1 + + +MAC Address: AAAA.AAAA.AAAA +Priority: 32768 +SW1 +Gi1/0/1 + +Gi1/0/5 + +Gi1/0/6 + +Gi1/0/5 + +Gi1/0/6 + + +MAC Address: BBBB.BBBB.BBBB +SW2 +Priority: 32768 +Gi1/0/2 + + +Gi0/1 Gi0/2 Loop 2 + +SW3 + +MAC Address: CCCC.CCCC.CCCC Priority: 32768 + + + + + + +Figure 5-1 Layer 2 Loops + +You need to have a solid understanding of how STP makes decisions when troubleshoot-ing Layer 2 issues. Therefore, this section reviews how an STP topology is dynamically formed. In addition, this section discusses commands useful in troubleshooting STP issues. + + + + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 173 + +Reviewing STP Operation + +STP uses Bridge Protocol Data Units (BPDUs) to build the STP topology. BPDU packets contain information on ports, addresses, priorities, and costs needed to build the STP topology and ensure that the data ends up where it was intended to go. BPDU messages are exchanged every 2 seconds by default across switches to detect loops in a network topology. The loops are then removed by logically blocking selected bridge interfaces and placing them in the blocked state. + +STP prevents Layer 2 loops from occurring in a network, because such an occurrence could result in a broadcast storm or the corruption of a switch’s MAC address table. Switches in an STP topology are classified as one of the following: + + +■ Key +Topic + + + + +■ + +Root bridge: The root bridge is a switch elected to act as a reference point for a spanning tree topology. The switch with the lowest bridge ID (BID) is elected as the root bridge. The BID is made up of a priority value (default is 32768) and a MAC address (base Ethernet MAC of switch as shown in the output of the show version command.). The priority is used first; only if the priority is tied between two or more switches will the MAC address be used to break the tie. + +Nonroot bridge: All other switches in the STP topology are considered nonroot +bridges. + + +Figure 5-2 illustrates the root bridge election in a network. Notice that because all bridge priorities are 32768 (default), the switch with the lowest MAC address (that is, SW1) is elected as the root bridge. The MAC address is read left to right. Because a MAC address is based on hexadecimal, lower to higher is 0–9, then A–F. + + + + +MAC Address: AAAA.AAAA.AAAA +Priority: 32768 +SW1 +Root Gi1/0/1 Bridge + +Gi1/0/5 + +Gi1/0/6 + + +Gi0/1 Gi0/2 + +Gi1/0/5 + +Gi1/0/6 + + + +SW2 +Gi1/0/2 + + +MAC Address: BBBB.BBBB.BBBB Priority: 32768 +Non-Root Bridge + + +MAC Address: +SW3 CCCC.CCCC.CCCC Priority: 32768 +Non-Root Bridge + + + + +Figure 5-2 Root Bridge Election + +Remember the golden rule of STP: Lower is better and ties are not acceptable. Key +Topic + + + + +From the Library of Outcast Outcast +174 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Note Remembering this rule will help you during each step of the election processes. + + +Switchports in an STP topology are categorized as one of the following port roles described in Table 5-2 and illustrated in Figure 5-3. + +Table 5-2 STP Port Roles +Key +Topic Port Roles Description + + +Root port (RP) + + + + + +Designated port (DP) + +Every nonroot bridge has a single root port (this is mandatory). It is the port on the switch that is closest to the root bridge, in terms of cost, which is inversely proportional to bandwidth by default. If cost is tied, the upstream BID is used to break the tie. If the upstream BID is tied, the upstream port ID (PID) is used to break the tie. +Every network segment has a single designated port (this is mandatory). It is the port on the segment that is closest to the root bridge, in terms of cost. If cost is tied, the upstream BID is used to break the tie. If the upstream BID is tied, the upstream +port ID (PID) is used to break the tie. + + +Note Because all ports on the root bridge are as close as you could get to the root bridge, all ports on a root bridge are DPs. + +Nondesignated port (X) These are the ports blocking traffic to create a loop-free topology. + + + + + + +MAC Address: AAAA.AAAA.AAAA +SW1 +Priority: 32768 +Root Gi1/0/1 +Bridge DP + +DP Gi1/0/5 + +Gi1/0/6 DP + + + + + + +RP +Gi0/1 Gi0/2 + +RP Gi1/0/5 + +Gi1/0/6 + + + +SW2 +Gi1/0/2 DP + + +MAC Address: BBBB.BBBB.BBBB Priority: 32768 +Non-Root Bridge + + +MAC Address: +SW3 CCCC.CCCC.CCCC Priority: 32768 +Non-Root Bridge + + + + +Figure 5-3 STP Port Roles + + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 175 + +Table 5-3 shows the default port costs for various link speeds for both 802.1D STP and its successor 802.1D-2004 STP. Notice the higher the speed the lower the cost. Remember that a lower cost is better and that the cost used is the cumulative path cost. + +Key Table 5-3 Default Port Costs +Topic Link Speed 802.1D STP Port Cost 802.1D-2004 STP Port Cost + + +10 Mbps (Ethernet) 100 + +100 Mbps (Fast Ethernet) 19 + +1 Gbps (Gigabit Ethernet) 4 + +10 Gbps (Ten Gig Ethernet) 2 + +100 Gbps N/A + +1 Tbps N/A + +10 Tbps N/A + +2000000 + +200000 + +20000 + +2000 + +200 + +20 + +2 + + + + +Determining Root Port Key +Topic Being able to determine why a port has a specific role is important for troubleshooting +and tuning the STP topology. Notice the root port for switch SW2 is Gig 1/0/5 in Figure 5-3. Why was it chosen as the root port? If you are not sure, review the following steps for determining the root port on a switch: +1. Identify the port that has the lowest cumulative cost path to the root bridge. In Figure 5-3, the total cost from SW2 Gi1/0/5 to the root bridge is 4. The total cost from SW2 Gi1/0/6 to the root bridge is 4. The total cost from SW2 Gi1/0/2 to the root bridge is (4 + 4) 8. Remember, lower is better and ties are not acceptable. In this case, we have a tie for the lowest value at 4. When the path cost is tied, you use the lowest upstream BID as a tiebreaker. Proceed to Step 2. +2. Identify the SW2 port (Gi1/0/5 or Gi1/0/6) that receives a BPDU with a lower upstream BID. In this case, the BID received in the BPDUs from SW1 is tied. The priority is checked first for the BPDUs received by SW2 on Gi1/0/5 and Gi1/0/6 from SW1. In Figure 5-3, the BPDUs will have the same priority because they are sent from the same switch (SW1) with a priority of 32768. Next is to compare the MAC addresses listed in the BPDUs. Again, they are both the same because switches use the same base Ethernet MAC address for all BPDUs sent on all interfaces. Therefore, both received BPDUs from SW1 have a priority of 32768 and a MAC of AAAA. AAAA.AAAA. When the upstream BID is tied, you use the upstream PID to break the tie. Proceed to Step 3. +3. Identify the port that receives a BPDU with a lower upstream PID. When SW1 sends BPDUs, it includes a PID. This PID includes a port priority number and an inter- +face number. The priority number can be manually changed (default 128); however, + + + + +From the Library of Outcast Outcast +176 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +the interface number cannot. It is generated by the switch to identify the port. In Figure 5-3, SW1 would more than likely have a PID of 128.5 on Gi1/0/5 and 128.6 on Gi1/0/6 by default. As a result, when SW2 receives the BPDUs from SW1, the received BPDU on Gi1/0/5 has a PID attached of 128.5 and the received BPDU on Gi1/0/6 has a PID attached of 128.6. Lower is better; therefore, SW2 Gi1/0/5 is elect-ed the root port based on the PID value sent from SW1 in the BPDUs. + +Focusing on SW3 in Figure 5-3 shows a total cost of 4 to get to the root bridge using Gi0/1 and a total cost of 8 using Gi0/2. Therefore, Gi0/1 is elected as the root port. + +Key Determining Designated Port +Topic When determining the designated ports for each segment, you follow the same steps +listed in the previous section for the root port election. Remember that every port on the root bridge will be a designated port. Therefore, without performing any calculations, you already know a few designated ports in the topology. As a result, in Figure 5-3 the only link/segment remaining without a designated port is the segment between SW2 +and SW3. We can see that it is already labeled as Gi1/0/2 on SW2, but why? Let’s walk through the steps together: +1. Identify the port on the segment with the lowest cumulative cost back to the root bridge. SW2 Gi1/0/2 has a cumulative cost (including the cost of the segment itself) of (4 + 4) = 8. SW3 Gi0/2 has a cumulative cost (including the cost of the segment itself) of (4 + 4) = 8. We have a tie, so we move on to Step 2. +2. Find the upstream switch with the lowest BID. This is tricky if you do not know where to position yourself. Here is my trick. Pretend you are standing in the middle of the segment between SW2 and SW3. Point to SW2. What is the priority? 32768. Point to SW3. What is the priority? 32768. We have a tie. We then need to look at the MAC address. Still standing in the middle of the segment, point to SW2. What is the MAC address? BBBB.BBBB.BBBB. Point to SW3. What is the MAC address? CCCC.CCCC.CCCC. Which one is lower? It is the MAC address of SW2. + +Therefore, SW2’s port Gi1/0/2 is the designated port for the segment between SW2 and SW3. + +Determining Nondesignated Port + +Every other port that is not a root port or a designated port is a nondesignated port and will be blocking traffic, as depicted in Figure 5-3. Nondesignated ports do not forward traffic during normal operation but do receive BPDUs to determine the state of the STP topology. If a link in the topology goes down, the nondesignated port indirectly detects the link failure from BPDUs and determines whether it needs to transition to the forward-ing state or not to ensure network availability while preventing loops. + +If a nondesignated port does need to transition to the forwarding state, the type of STP in use will determine how long it takes to transition to the forwarding state. STP (802.1D), Common Spanning Tree (CST), and Cisco’s implementation of STP (PVST+) transition through the following states: + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 177 + + +Key ■ Topic + + + + + + +■ + + + + + +■ + + + + +■ + +Blocking: The port remains in the blocking state until it needs to transition. If it needs to transition, it will wait for 20 seconds by default. This is known as the max age time. It is essentially the time-to-live of a BPDU. A BPDU is only valid for 20 seconds. If a new BDPU is not received before the max age time expires, the switch considers the BPDU stale and transitions to the listening state. During the blocking state, a nondesignated port evaluates BPDUs in an attempt to determine its role in the spanning tree. + +Listening: The port remains in this state for 15 seconds by default (15 seconds is known as the forward delay). During this time, the port sources BPDUs, which inform adjacent switches of the port’s intent to forward data. In addition, it receives BDPUs from other switches, which will help in the building of the STP topology and determining the root ports and designated ports. + +Learning: The port moves from the listening state to the learning state and remains in this state for 15 seconds by default. During this time, the port begins to add entries to its MAC address table while still sending and receiving BPDUs to ensure that the decisions made in relation to the STP topology are still accurate. + +Forwarding: The port moves from the learning state to the forwarding state and begins to forward frames while learning MAC addresses and sending and receiving +BPDUs. Root ports and designated ports are in this state. + + +As you can see, the total time to transition from the blocking state to the forwarding state is 50 seconds with 802.1D. + +Rapid Spanning Tree Protocol (802.1w) and Multiple Spanning Tree Protocol (802.1s) use a handshaking mechanism rather than timers as their primary method of convergence. Therefore, convergence is 5 seconds or less. If the handshaking mechanism fails, 802.1w and 802.1s rely on the same timers as 802.1D as backup. In addition, if a neighboring switch is using 802.1D, timers are used with them for backward compatibility. + +Collecting Information About an STP Topology + +Cisco Catalyst switches will dynamically form a spanning-tree topology using default port costs and bridge priorities right out of the box. You do not have to do anything. However, the resulting STP topology might not be the best for your organization. For example, you might want to influence a particular switch to become a root bridge to ensure optimal traffic forwarding through a Layer 2 topology. Or, you might want traffic for one VLAN to take a certain path while traffic for other VLANs takes a different path. If you ever need to manipulate STP, which will more than likely be the case, you need +to know the current topology and how to modify it. This section identifies the various methods we can use to gather information about our STP topology. + +Gathering STP Information + +When troubleshooting an STP topology, one of the first tasks is to learn which switch is acting as the root bridge, in addition to learning the port roles on the various switches + + + +From the Library of Outcast Outcast +178 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + + + + +Key Topic + +in the topology. Not only is this information important in understanding how frames are currently flowing through the topology, but comparing the current STP state of a topol-ogy to a baseline state can also provide clues as to the underlying cause of an issue, such as suboptimal traffic forwarding. + +The show spanning-tree [vlan {vlan_id}] command can display information about the STP state of a switch. Consider Example 5-1, which shows the output from the show spanning-tree vlan 1 command. The VLAN is specified because Cisco Catalyst switches use Per-VLAN Spanning Tree + (PVST+) by default. PVST+ allows a switch to run a sepa-rate STP instance for each VLAN. The output in Example 5-1 shows that SW3 is not the root bridge for the spanning tree of VLAN 1. This is because the MAC address of the root bridge (Root ID) differs from the MAC address of SW3 (Bridge ID). In addition, there is a root port on the switch, which a root bridge cannot have, and it does not state that this switch is the root bridge. The Gig 0/1 port of switch SW3 is the root port of the switch, whereas port Gig 0/2 is a nondesignated port. (That is, it is a blocking port.) Note +that the port cost of Gig 0/1 is 4, and the port cost of Gig 0/2 is 4 as well. + + +Example 5-1 show spanning-tree vlan Command Output + +SW3#show spanning-tree vlan 1 +VLAN0001 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +32768 +aaaa.aaaa.aaaa +4 +25 (GigabitEthernet0/1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) +Address cccc.cccc.cccc +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type +----------------------------------------------------------------------- + +Gi0/1 Root FWD 4 +Gi0/2 Altn BLK 4 + +128.25 P2p +128.26 P2p + + +The show spanning-tree interface interface_type interface_number detail command, as shown in Example 5-2, displays the number of BPDUs sent and received, the port identi-fier, and the designated root and designated bridge priority and MAC address. Note that in a stable topology, root ports should only receive BPDUs, and designated ports should only send BPDUs. Therefore, if you see a high number of sent and received BPDUs on ports, you have an unstable STP topology and need to determine why this is so and fix it. + + + + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 179 + +Example 5-2 show spanning-tree interface interface_type interface_number detail Command Output + +SW3#show spanning-tree interface gig 0/1 detail +Port 25 (GigabitEthernet0/1) of VLAN0001 is root forwarding +Port path cost 4, Port priority 128, Port Identifier 128.25. +Designated root has priority 32768, address aaaa.aaaa.aaaa +Designated bridge has priority 32768, address aaaa.aaaa.aaaa +Designated port id is 128.1, designated path cost 0 +Timers: message age 2, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 +Link type is point-to-point by default +BPDU: sent 1, received 1245 + + +Gathering MSTP Information + +Multiple Spanning Tree Protocol (MSTP) allows you to group multiple VLANs into a single STP instance. This significantly improves STP in end-to-end VLAN deployments where a large number of VLANs are maintained by many switches. When you group various VLANs together into the same instance, the CPU does not have to process BPDUs for all the different VLANs. In fact, with MSTP, only MST0 (known as the IST) is used to send BPDUs, and all the other MST instances are listed in the MST0 BPDUs as M-records. This improves CPU performance. + +Consider this. If you have 100 VLANs and you only have 2 uplinks from an access layer switch to the distribution layer, you can group half the VLANs in one instance and the other half in another instance. You can then manipulate who the root bridge is so that one instance ends up using one uplink and the other instance uses the other uplink. You have just achieved load sharing and reduced the number of STP instances from 100 to 2, thus conserving CPU resources. To ensure you optimize load sharing, you need to gather statistics about the traffic flowing through the networking on a VLAN-by-VLAN basis and make sure that you do not place heavily used VLANs in the same MSTP instance or you will not achieve optimal load sharing. + +When deploying and troubleshooting MSTP, you have to remember these three very important rules for switches in the same region: + +■ The MSTP region name must match. + +■ The MSTP revision number must match. + +■ The MSTP instance to VLAN mappings must be the same on all the switches. + +If any of the items listed do not match exactly, the digest that is sent within an MSTP BPDU will be different, and the switches will consider each other to be in a different MSTP region and therefore produce different spanning-tree topologies than the admin-istrator envisioned. To verify the current region name, revision number, and VLAN to instance mappings on a switch, issue the show spanning-tree mst configuration com-mand, as shown in Example 5-3. + + + +From the Library of Outcast Outcast +180 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 5-3 show spanning-tree mst configuration Command Output + +SW3#show spanning-tree mst configuration +Name TSHOOT +Revision 10 Instances configured 2 + + +Instance +-------- +0 +1 +2 + +Vlans mapped +------------------------------------------------------- +1-9,11-19,21-99,101-199,201-4094 +10,100 +20,200 + +------------------------------------------------------------------ + + +STP Troubleshooting Issues + +If STP fails to operate correctly, Layer 2 frames can endlessly circulate through a network because of the loop created. This behavior can lead to issues such as MAC address table corruption and broadcast storms. In this section we analyze the results of an STP failure. + +Corruption of a Switch’s MAC Address Table + +Recall from Chapter 4, “Troubleshooting Layer 2 Trunks, VTP, and VLANs,” that the MAC address table determines what a switch will do with a frame. Therefore, this table needs to be accurate. A switch will dynamically learn what MAC addresses are reachable off its ports; however, in the event of an STP failure, the MAC address table of a switch can become corrupt. To illustrate, consider Figure 5-4. PC1 is transmitting traffic to PC2. When the frame sent from PC1 is transmitted on segment A, the frame is seen on the Gig 0/1 ports of switches SW1 and SW2, causing both switches to add an entry to their +MAC address tables (AAAA.AAAA.AAAA is associated with port Gig 0/1). Because STP is not functioning, both switches then forward the frame out segment B. As a result, PC2 receives two copies of the frame. Also, switch SW1 sees the frame forwarded out the Gig 0/2 port of switch SW2. Because the frame has a source MAC address of AAAA.AAAA. AAAA, switch SW1 incorrectly updates its MAC address table indicating that a MAC address of AAAA.AAAA.AAAA resides off port Gig 0/2. Similarly, switch SW2 sees the frame forwarded onto segment B by switch SW1 on its Gig 0/2 port. Therefore, switch SW2 also incorrectly updates its MAC address table. As a result of this, all frames des-tined to AAAA.AAAA.AAAA will be forwarded out Gig0/2 and never reach PC1. + +That was a simplified example of what would occur. In reality, as frames continue to propagate through the network, not only would the MAC address table be corrupt, it would be unstable. At one moment AAAA.AAAA.AAAA would be learned on Gig0/1, then Gig0/2, then back on Gig0/1, then Gig0/2. + + + + + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 181 + + +Switch SW1’s MAC Address Table + +Port MAC Addresses + +PC1 MAC Address: +AAAA.AAAA.AAAA + +Gig 0/1 AAAA.AAAA.AAAA +Gig 0/2 AAAA.AAAA.AAAA + +Segment A + + +Gig 0/1 Gig 0/1 + +SW1 SW2 Gig 0/2 Gig 0/2 + + +Segment B + +Switch SW2’s MAC Address Table + + + + +PC2 Duplicate Frames +Received + +Port MAC Addresses Gig 0/1 AAAA.AAAA.AAAA +Gig 0/2 AAAA.AAAA.AAAA + + +Figure 5-4 MAC Address Table Corruption + +You will be able to recognize this issue because syslog messages will be generated identi-fying that you have MAC addresses flapping between different ports on the same switch. The following syslog messages show that the MAC addresses are being learned on Gi0/1 and Gi0/2, and this would occur only if there were a loop allowing the same frame to be seen on multiple interfaces: + +%SW_MATM-4-MACFLAP_NOTIF: Host 0000.5e00.0114 in vlan 20 is flapping between port Gi0/1 and port Gi0/2 + +%SW_MATM-4-MACFLAP_NOTIF: Host 8049.7111.7e05 in vlan 502 is flapping between port Gi0/1 and port Gi0/2 + +%SW_MATM-4-MACFLAP_NOTIF: Host 0050.b60c.f21b in vlan 20 is flapping between port Gi0/1 and port Gi0/2 + +Broadcast Storms + +As previously mentioned, when a switch receives a broadcast frame (that is, a frame des-tined for a MAC address of FFFF.FFFF.FFFF), the switch floods the frame out all switch-ports except the port on which the frame was received. The same is true for unknown unicast and multicast frames. Because a Layer 2 frame does not have a TTL field, a broad-cast frame endlessly circulates through the Layer 2 topology, consuming resources on both switches and attached devices (for example, user PCs). + +Figure 5-5 illustrates how a broadcast storm can form in a Layer 2 topology when STP is not functioning correctly. + + + +From the Library of Outcast Outcast +182 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +PC1 + + +Broadcast frame +destined for (1) FFFF.FFFF.FFFF + +(3) Segment A + +Gig 0/1 (3) Gig 0/1 + +SW1 SW2 + +Gig 0/2 +(2) (2) + + +Gig 0/2 + + + +Segment B + + + + +PC2 + +Figure 5-5 Broadcast Storm + +1. PC1 sends a broadcast frame onto Segment A, and the frame enters each switch on port Gig 0/1. + +2. Both switches flood a copy of the broadcast frame out of their Gig 0/2 ports (that is, on to Segment B), causing PC2 to receive two copies of the broadcast frame. + +3. Both switches receive a copy of the broadcast frame on their Gig 0/2 ports (that is, from Segment B) and flood the frame out of their Gig 0/1 ports (that is, onto Segment A), causing PC1 to receive two copies of the broadcast frame. + +This behavior continues, as the broadcast frame copies continue to loop through the network. The performance of PC1 and PC2 is impacted, because they also continue to receive copies of the broadcast frame that they must process. + +A common complaint you will receive from multiple network users at the same time when there is an STP issue is, the network/Internet is really slow. This is because of the broadcast storm consuming the majority of the resources in the Layer 2 network. +Therefore, the frames going to the resources that the users need to access are not making it to the destination or are taking a really long time because the network is congested. + +Key Troubleshooting STP Features +Topic STP relies on many features to protect the topology. These features are not enabled by +default. Knowing how to troubleshoot these features is important to ensure the STP topology is functioning as it should. This section discusses these features and reviews the commands needed to troubleshoot them. + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 183 + +PortFast + +The PortFast feature is used to transition a switchport to the forwarding state as soon as the switchport is enabled. (A device is plugged in, and the switchport is not shut down.) If you are using PortFast with PVST+, RPVST+, or MSTP, when a BPDU is received on +a PortFast-enabled switchport, the switchport will immediately transition out of the PortFast state and become a normal switchport. This ensures that it transitions through the necessary states and processes before going to the forwarding state to ensure that a loop is not caused. You can enable PortFast on an interface-by-interface basis with the spanning-tree portfast interface command or globally with the spanning-tree portfast default command, which will enable it on all nontrunking switchports. Example 5-4 iden-tifies three ways to verify PortFast is enabled on an interface. + +Example 5-4 Verifying PortFast-Enabled Interfaces + +SW3#show run interface fa0/1 +Building configuration... + +Current configuration : 108 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +spanning-tree portfast +end + +SW3#show spanning-tree interface fastEthernet 0/1 portfast +VLAN0010 enabled + +SW3#show spanning-tree interface fastEthernet 0/1 detail +Port 1 (FastEthernet0/1) of VLAN0010 is designated forwarding +Port path cost 19, Port priority 128, Port Identifier 128.1. +Designated root has priority 10, address 2893.fe3a.e300 +Designated bridge has priority 32778, address 081f.f34e.b800 +Designated port id is 128.1, designated path cost 4 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 +The port is in the portfast mode +Link type is point-to-point by default +BPDU: sent 11, received 0 + +If you enabled PortFast globally, you can use another show command to verify that PortFast was enabled globally: show spanning-tree summary, as shown in Example 5-5. Notice that PortFast Default is enabled. Also notice how the output of the command show spanning-tree interface fastEthernet 0/1 detail in Example 5-5 is different when compared to Example 5-4. In Example 5-5, it states, “The port is in the portfast mode by default,” which indicates that PortFast was enabled globally. + + + +From the Library of Outcast Outcast +184 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 5-5 Verifying Globally Enabled PortFast Interfaces + +SW3#show spanning-tree summary +Switch is in rapid-pvst mode +Root bridge for: +EtherChannel misconfig guard is enabled + +Extended system ID +Portfast Default +PortFast BPDU Guard Default + +is enabled +is enabled +is disabled + +Portfast BPDU Filter Default is disabled + +Loopguard Default +UplinkFast +BackboneFast + +is disabled +is disabled +is disabled + +Configured Pathcost method used is short + +SW3#show spanning-tree interface fastEthernet 0/1 detail +Port 1 (FastEthernet0/1) of VLAN0010 is designated forwarding +Port path cost 19, Port priority 128, Port Identifier 128.1. +Designated root has priority 10, address 2893.fe3a.e300 +Designated bridge has priority 32778, address 081f.f34e.b800 +Designated port id is 128.1, designated path cost 4 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 +The port is in the portfast mode by default +Link type is point-to-point by default +Bpdu filter is enabled by default +BPDU: sent 11, received 0 + +One of the easiest ways to confirm that a switchport is indeed enabled for PortFast is to review the output of show spanning-tree. As shown in Example 5-6, Fa 0/1 is listed as an Edge port indicated that PortFast is enabled on the interface. + +Example 5-6 Using show spanning-tree to Verify PortFast Status + +SW3#show spanning-tree +...output omitted... +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- ---------------------- + +Fa0/1 Desg FWD 19 +Fa0/2 Desg FWD 19 +Gi0/1 Root FWD 4 +Gi0/2 Altn BLK 4 + +128.1 P2p Edge +128.2 P2p Edge +128.25 P2p +128.26 P2p + +...output omitted... + + +BPDU Guard + +BPDU Guard is used to enforce STP domain borders. This ensures that the STP topol-ogy remains predictable. When a BPDU is received on a switchport enabled with BPDU + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 185 + +Guard, the port will be disabled and placed in the err-disabled state. To verify which ports are in the err-disabled state, issue the command show interfaces status, as shown in Example 5-7. In this example, Fast Ethernet 0/1 is in the err-disabled state. In addition, if you are tracking syslog messages, you will receive the following: +%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Fa0/1 with BPDU Guard enabled. Disabling port. + +%PM-4-ERR_DISABLE: bpduguard error detected on Fa0/1, putting Fa0/1 in err-disable state + +%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down + +Example 5-7 show interfaces status Command Output + +SW3#show interfaces status +Port Name Status Vlan Duplex Speed Type +Fa0/1 err-disabled 10 auto auto 10/100BaseTX + +Fa0/2 connected 10 +Fa0/3 notconnect 1 +Fa0/4 notconnect 1 +Fa0/5 notconnect 1 +Fa0/6 notconnect 1 + +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX + + +Like PortFast, BPDU Guard can be enabled on an interface-by-interface basis with the spanning-tree bpduguard enable interface command or globally with the spanning-tree portfast bpduguard default global configuration command. The global command will only enable it on PortFast-enabled interfaces. + +You can verify whether BPDU Guard is enabled globally using the commands show span-ning-tree summary and show spanning-tree interface interface_type interface_number detail, as depicted in Example 5-8. + +Example 5-8 Verifying BPDU Guard Is Enabled Globally + +SW3#show spanning-tree summary +Switch is in rapid-pvst mode + +Root bridge for: +Extended system ID +Portfast Default +PortFast BPDU Guard Default + + +is enabled +is disabled +is enabled + +Portfast BPDU Filter Default is disabled +Loopguard Default is disabled +EtherChannel misconfig guard is enabled + +UplinkFast +BackboneFast + +is disabled +is disabled + +Configured Pathcost method used is short +...output omitted... + +SW3#show spanning-tree interface fastethernet 0/1 detail + + + +From the Library of Outcast Outcast +186 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Port 1 (FastEthernet0/1) of VLAN0010 is designated forwarding +Port path cost 19, Port priority 128, Port Identifier 128.1. +Designated root has priority 10, address 2893.fe3a.e300 +Designated bridge has priority 32778, address 081f.f34e.b800 +Designated port id is 128.1, designated path cost 4 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 +The port is in the portfast mode +Link type is point-to-point by default +Bpdu guard is enabled by default +BPDU: sent 11, received 0 + +You can verify if BPDU Guard has been enabled on an interface basis with the show spanning-tree interface interface_type interface_number detail command and the show run interface interface_type interface_number command, as shown in Example 5-9. + +Example 5-9 Verifying BPDU Guard Is Enabled on an Interface + +SW3#show spanning-tree interface fastethernet 0/1 detail +Port 1 (FastEthernet0/1) of VLAN0010 is designated forwarding +Port path cost 19, Port priority 128, Port Identifier 128.1. +Designated root has priority 10, address 2893.fe3a.e300 +Designated bridge has priority 32778, address 081f.f34e.b800 +Designated port id is 128.1, designated path cost 4 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 +The port is in the portfast mode +Link type is point-to-point by default +Bpdu guard is enabled +BPDU: sent 4, received 0 + +SW3#show run interface fastethernet 0/1 +Building configuration... + +Current configuration : 140 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +spanning-tree portfast +spanning-tree bpduguard enable +end + +To recover from the err-disabled state, remove the device that is sending the rogue BPDUs, and then manually disable and enable the err-disabled interface with the shut-down and then no shutdown commands. Or, you can set up an err-disable recovery feature that will attempt to automatically enable the interface at defined intervals. If the + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 187 + +rogue BPDUs are still detected, the interface will go back into the err-disabled state. If the rogue BPDUs are not detected anymore, the interface will automatically recover. To enable the err-disable recovery feature for BPDU Guard, use the errdisable recovery cause bpduguard global configuration command. + +BPDU Filter + +BPDU Filter is designed to suppress the sending and receiving of BPDUs on an interface. This would be for security reasons. For example, there is no need to send BPDUs out an interface that is connected to an end station or a router. Doing so allows the end station to collect the data in the BPDUs and potentially launch an attack against the STP topol-ogy. How you enable it determines the extent of BDPUs that will be suppressed: + +■ If you enable it globally, with the spanning-tree portfast bpdufilter default com-mand, BPDU Filter will be enabled on all PortFast-enabled interfaces and will sup-press the sending of BPDUs out an interface. However, if a BPDU is received on an interface, it will process it normally and, if necessary, transition the interface through the normal STP states/processes. + +■ If you enable BPDU Filter manually on an interface with the spanning-tree bpdufil-ter enable command, it suppresses the sending and receiving of BPDUs. This is not recommended because any received BPDUs are ignored and may result in a Layer 2 loop because the interface is automatically in the forwarding state. + +You can verify whether BPDU Filter is enabled globally with the show spanning-tree summary command and the show spanning-tree interface interface_type interface_ number detail command, as shown in Example 5-10. If it is enabled on an interface-by-interface basis, which is not recommended, you can verify BPDU Filter with the show spanning-tree interface interface_type interface_number detail command and the show run interface interface_type interface_number command, as shown in Example 5-11. + +Example 5-10 Verifying BPDU Filter Is Enabled Globally + +SW3#show spanning-tree summary +Switch is in rapid-pvst mode + +Root bridge for: +Extended system ID +Portfast Default +PortFast BPDU Guard Default + + +is enabled +is disabled +is disabled + +Portfast BPDU Filter Default is enabled +Loopguard Default is disabled +EtherChannel misconfig guard is enabled + +UplinkFast +BackboneFast + +is disabled +is disabled + +Configured Pathcost method used is short + +SW3#show spanning-tree interface fastethernet 0/1 detail +Port 1 (FastEthernet0/1) of VLAN0010 is designated forwarding + + + +From the Library of Outcast Outcast +188 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Port path cost 19, Port priority 128, Port Identifier 128.1. +Designated root has priority 10, address 2893.fe3a.e300 +Designated bridge has priority 32778, address 081f.f34e.b800 +Designated port id is 128.1, designated path cost 4 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 +The port is in the portfast mode +Link type is point-to-point by default +Bpdu guard is enabled +Bpdu filter is enabled by default +BPDU: sent 11, received 0 + + +Example 5-11 Verifying BPDU Filter Is Enabled on an Interface + +SW3#show spanning-tree interface fastethernet 0/1 +Port 1 (FastEthernet0/1) of VLAN0010 is designated forwarding +Port path cost 19, Port priority 128, Port Identifier 128.1. +Designated root has priority 10, address 2893.fe3a.e300 +Designated bridge has priority 32778, address 081f.f34e.b800 +Designated port id is 128.1, designated path cost 4 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 1 +The port is in the portfast mode +Link type is point-to-point by default +Bpdu guard is enabled +Bpdu filter is enabled +BPDU: sent 18, received 0 + +SW3#show run interface fastethernet 0/1 +Building configuration... + +Current configuration : 173 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +spanning-tree portfast +spanning-tree bpdufilter enable +spanning-tree bpduguard enable +end + +If you are experiencing a Layer 2 loop in your topology, check whether BPDUFilter was enabled on an interface. If so, it would be suppressing the sending and receiving of +BPDUs. As a result, a port within the topology is in the forwarding state causing a Layer 2 loop when it should be in the blocking state. + + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 189 + +Root Guard + +Root Guard is designed to protect the root bridge by ensuring that certain ports on non-root bridges are prevented from becoming root ports. If you recall, the root port on a switch points to the root bridge. If a rogue switch is introduced to the STP topology with a superior BID, it can become the root bridge, and root ports would change on all the other switches so that the new root ports point to the rogue root bridge. + +Root Guard stops this from happening by ignoring superior BPDUs that are received on the Root Guard-enabled ports and placing the port in the spanning-tree inconsistent state. Because Root Guard is enabled on an interface-by-interface basis with the command spanning-tree guard root, the command show spanning-tree interface interface_type interface_number detail, as shown in Example 5-12, is used to verify its configuration. You can also verify which ports are inconsistent by issuing the show spanning-tree inconsistentports command, as shown in Example 5-13. Notice how Fast Ethernet 0/1 +is in the root inconsistent state. This is a good indication that the interface is enabled for Root Guard and that it received a superior BPDU. + +Example 5-12 Verifying That RootGuard Is Enabled on an Interface + +SW3#show spanning-tree interface fastethernet 0/1 +Port 1 (FastEthernet0/1) of VLAN0010 is designated forwarding +Port path cost 19, Port priority 128, Port Identifier 128.1. +Designated root has priority 10, address 2893.fe3a.e300 +Designated bridge has priority 32778, address 081f.f34e.b800 +Designated port id is 128.1, designated path cost 4 +Timers: message age 0, forward delay 0, hold 0 +Number of transitions to forwarding state: 2 +The port is in the portfast mode +Link type is point-to-point by default +Bpdu guard is enabled +Bpdu filter is enabled by default +Root guard is enabled on the port +BPDU: sent 18, received 0 + + +Example 5-13 Verifying Inconsistent Ports on a Switch + +SW3#show spanning-tree inconsistent ports +Name Interface Inconsistency +-------------------- ------------------------ ------------------ +VLAN0010 FastEthernet0/1 Root Inconsistent + +Number of inconsistent ports (segments) in the system : 1 + +In addition, when a port goes into the root inconsistent state you will receive a syslog message indicating so as follows: + +%SPANTREE-2-ROOTGUARD_BLOCK: Root guard blocking port FastEthernet0/1 on VLAN0010. + + + +From the Library of Outcast Outcast +190 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +When a switchport is in the inconsistent state, no manual intervention is required to recover the port from the inconsistent state. All you need to do is remove the device that is sending the superior BPDUs to that switchport from the network, and once the +switchport no longer hears the superior BPDUs, the port is automatically taken out of the inconsistent state. + +Loop Guard + +Loop Guard is a feature designed to provide additional protection against Layer 2 loops. By default, if a nondesignated port ceases to receive BPDUs, it will transition to the for-warding state once the max age timer expires. However, what if the switch was not receiv-ing the BPDUs because the switch that was sending the BPDUs had a software failure preventing it from sending BPDUs? That switch, would still be able to send and receive data on the interface. This would produce a loop because the nondesignated port is now sending and receiving data, as well, instead of blocking it. This is all because the BPDUs are no longer arriving on the interface. Loop Guard ensures that the nondesignated port does not erroneously transition to the forwarding state. Instead, it places it in the loop-inconsistent blocking state and generates the following syslog message: + +%SPANTREE-2-LOOPGUARD_BLOCK: Loop guard blocking port GigabitEthernet0/2 on VLAN0010. +To verify which ports are in the loop-inconsistent state, issue the command show span-ning-tree inconsistent ports, as shown in Example 5-14. + +Example 5-14 Verifying Loop-Inconsistent Ports on a Switch + +SW3#show spanning-tree inconsistent ports +Name Interface Inconsistency +-------------------- ------------------------ ------------------ +VLAN0010 GigabitEthernet0/2 Loop Inconsistent + +Number of inconsistent ports (segments) in the system : 1 + + +STP Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 5-6 . + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 191 + + + +CORE + + + + +MAC Address: AAAA.AAAA.AAAA +Priority: 32768 +SW1 +Root Gi1/0/1 Bridge +Vlan 10 + +Gi1/0/5 + +Gi1/0/6 + + + +Gi0/1 Gi0/2 + +Gi1/0/5 + +Gi1/0/6 + + + +SW2 +Gi1/0/2 + + +MAC Address: BBBB.BBBB.BBBB Priority: 32768 +Non-Root Bridge + + + + +SW3 +Fa0/1 + +MAC Address: CCCC.CCCC.CCCC Priority: 32768 +Non-Root Bridge + + +Vlan 10 10.1.10.0/24 + +PC1 + +Figure 5-6 STP Trouble Ticket Topology + + +Trouble Ticket 5-1 + +Problem: Based on traffic analyzers, all traffic from the end stations in VLAN 10 destined to the core is flowing through SW2 when it should be flowing through SW1. + +According to the topology, SW1 should be the root bridge for VLAN 10. Therefore, all traffic for VLAN 10 should be flowing through SW1 under normal conditions. With this in mind, check the placement of the root bridge using the show spanning-tree vlan 10 command on SW1, as shown in Example 5-15. Notice that SW1 is not the root bridge for VLAN 10. According to the root ID section of the output, the switch with the MAC address bbbb.bbbb.bbbb is the root bridge. + +Example 5-15 show spanning-tree vlan 10 Command Output for SW1 + +SW1#show spanning-tree vlan 10 +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +10 +bbbb.bbbb.bbbb +4 +5 (GigabitEthernet1/0/5) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address aaaa.aaaa.aaaa + + + +From the Library of Outcast Outcast +192 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type + +Gi1/0/1 +Gi1/0/5 +Gi1/0/6 + +Desg FWD 4 +Root FWD 4 +Altn BLK 4 + +128.1 P2p +128.5 P2p +128.6 P2p + + +Next you should check which switch is the root bridge. Figure 5-6 shows that bbbb.bbbb. bbbb is the MAC of SW2. However, without the diagram, how would you figure out who the root bridge is? You would follow the path. According to the output in Example 5-15, the port on SW1 to get to the root bridge is Gigabit Ethernet 1/0/5. At the bottom of the output, you can confirm that this is the root port. Therefore, using the show cdp neigh-bors command, you can confirm that SW2 is directly connected to SW1 on port Gi1/0/5, as shown in Example 5-16. + +Example 5-16 show cdp neighbors Command Output on SW1 + +SW1#show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + +Device ID Local Intrfce Holdtme Capability Platform Port ID + +SW2 Gig 1/0/6 138 +SW2 Gig 1/0/5 138 +SW3 Gig 1/0/1 141 + +S I WS-C3750E Gig 1/0/6 +S I WS-C3750E Gig 1/0/5 +S I WS-C2960- Gig 0/1 + + +You should now verify if SW2 is the root bridge for VLAN 10 using the output of show spanning-tree vlan 10, as shown in Example 5-17. The output shows that SW2 is the root bridge for VLAN 10. It explicitly states This bridge is the root, and notice that all the ports are designated ports. + +Example 5-17 show spanning-tree vlan 10 Command Output for SW2 + +SW2#show spanning-tree vlan 10 +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +10 +bbbb.bbbb.bbbb + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 10 (priority 0 sys-id-ext 10) +Address bbbb.bbbb.bbbb +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 193 + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- ----------------------- + +Gi1/0/2 +Gi1/0/5 +Gi1/0/6 + +Desg FWD 4 +Desg FWD 4 +Desg FWD 4 + +128.2 P2p +128.5 P2p +128.6 P2p + + +Upon further analysis of Example 5-17, you will notice that the priority of SW2 is 0 plus the extended system ID (which is the VLAN number), for a total value of 10, which is lower than the priority of SW1, which is 32768 plus 10 (32778), as shown in Example 5-15. It appears that the priority of SW2 was manually lowered. Using the command show run | section spanning-tree indicates that the command spanning-tree vlan 10 priority 0 was executed on SW2, as shown in Example 5-18. + +Example 5-18 show run Command Output for SW2 + +SW2#show run | section spanning-tree +...output omitted... +spanning-tree vlan 10 priority 0 +...output omitted... + +To solve this issue, we would need to remove this command by executing the no span-ning-tree vlan 10 priority 0 command. Once done, we can verify that SW1 is now the root bridge for VLAN 10 with the show spanning-tree vlan 10 command, as shown in Example 5-19. + +Example 5-19 show spanning-tree vlan 10 Command Output for SW1 + +SW1#show spanning-tree vlan 10 +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +32778 +aaaa.aaaa.aaaa + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address aaaa.aaaa.aaaa +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- ----------------------- + +Gi1/0/1 +Gi1/0/5 +Gi1/0/6 + +Desg FWD 4 +Desg FWD 4 +Desg FWD 4 + +128.1 P2p +128.5 P2p +128.6 P2p + + + + + + + +From the Library of Outcast Outcast +194 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Trouble Ticket 5-2 + +Problem: Based on traffic analyzers, all traffic from the end stations in VLAN 10 destined to the core is flowing through SW2 when it should be flowing through SW1. + +According to the topology, SW1 should be the root bridge for VLAN 10. Therefore, all traffic for VLAN 10 should be flowing through SW1 under normal conditions. With this in mind, check the placement of the root bridge using the show spanning-tree vlan 10 command on SW1, as shown in Example 5-20. Notice that SW1 is the root bridge for VLAN 10. + +Example 5-20 show spanning-tree vlan 10 Command Output for SW1 + +SW1#show spanning-tree vlan 10 +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +32778 +aaaa.aaaa.aaaa + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address aaaa.aaaa.aaaa +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- ----------------------- + +Gi1/0/1 +Gi1/0/5 +Gi1/0/6 + +Desg FWD 4 +Desg FWD 4 +Desg FWD 4 + +128.1 P2p +128.5 P2p +128.6 P2p + + +We have confirmed that SW1 is the root bridge and this matches our diagram in Figure 5-6. If Figure 5-6 has been kept up to date, we can trust the information displayed. According to Figure 5-6, we have a Gigabit Ethernet link between SW3 and SW1 as well +as SW3 and SW2. These links should have a cost of 4 by default. Reviewing the output of show spanning-tree vlan 10 on SW3, we can see that to reach the root bridge the total cost is 8 using Gigabit Ethernet 0/2, as shown in Example 5-21. If we look at Gig0/1, it is currently an alternate port in the blocking state with a cost of 10. This cost of 10 is larger than the total cost of 8 using Gig0/2. It appears that the cost of interface Gig0/1 has been modified. + +Example 5-21 show spanning-tree vlan 10 Command Output for SW3 + +SW3#show spanning-tree vlan 10 +VLAN0010 +Spanning tree enabled protocol ieee +Root ID Priority 32778 + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 195 + + +Address +Cost +Port + +aaaa.aaaa.aaaa +8 +2 (GigabitEthernet0/2) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address cccc.cccc.cccc +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type +------------------- ---- --- --------- -------- ----------------------- + +Gi0/1 Altn BLK 10 +Gi0/2 Root FWD 4 + +128.1 P2p +128.2 P2p + + +The output of show run interface gig 0/1 confirms that the cost was modified with the spanning-tree vlan 10 cost 10 command, as shown in Example 5-22. To solve this issue, we need to execute the no spanning-tree vlan 10 cost 10 command in interface configu-ration mode. + +Example 5-22 show run interface gig 0/1 Command Output for SW3 + +SW3#show run interface gig 0/1 +...output omitted... +spanning-tree vlan 10 cost 10 +...output omitted... + +After we remove the command, we can verify that SW3 is using Gi0/1 as the root port and that it has a cost of 4 by issuing the show spanning-tree vlan 10 command shown in Example 5-23. + +Example 5-23 show spanning-tree vlan 10 Command Output for SW3 + +SW3#show spanning-tree vlan 10 +VLAN0010 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +32778 +aaaa.aaaa.aaaa +4 +1 (GigabitEthernet0/1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) +Address cccc.cccc.cccc +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 sec + +Interface Role Sts Cost Prio.Nbr Type + + + +From the Library of Outcast Outcast +196 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +------------------- ---- --- --------- -------- ----------------------- + +Gi0/1 Root FWD 4 +Gi0/2 Altn BLK 4 + +128.1 P2p +128.2 P2p + + + +Trouble Ticket 5-3 + +Problem: It is Tuesday morning, and a user has indicated that he cannot connect to the network. He also indicates that he had no issues on Monday when he left work at 5:45 p.m. + +You attempt to ping from the user’s PC to its default gateway, but it fails. You attempt to ping from the user’s PC to the Internet, but it fails. Your next task is to make sure that the PC is receiving an IP address from the Dynamic Host Configuration Protocol (DHCP) server in the network. Issuing the command ipconfig /all on the PC as depicted in Example 5-24 indicates that an Automatic Private IP Addressing (APIPA) address +(169.254.x.x/16) is being used by the PC. Therefore, they are not able to contact a DHCP server. Also note the MAC address of PC1 at this point, as it will be useful later. + +Example 5-24 ipconfig Output for PC + +PC1>ipconfig /all +Windows Ip Configuration + +Ethernet adapter Local Area Connection: + +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +Link-local IPv6 Address . . . . . : fe80::444c:23b1:6e1e:de0c%16 +Dhcp enabled. . . . . . . . . . . : Yes +Autoconfiguration enabled. . .. . : Yes +Autoconfiguration IP Address. . . : 169.254.180.166 +Subnet Mask . . . . . . . . . . . : 255.255.0.0 + + +Issuing the command show mac address-table dynamic on SW3 will indicate whether SW3 is receiving any frames from PC1. Example 5-25 is displaying the MAC address table of SW3, and there is no entry in the table with PC1’s MAC address. Therefore, something appears to be wrong at Layer 1 or Layer 2 of the OSI model. + +Example 5-25 show mac address-table dynamic Output for SW3 + +SW3#show mac address-table dynamic +Mac Address Table +---- -------------------------------- --------- ------------------------------- + +Vlan Mac Address +---- ----------- +10 0800.275d.1234 +10 0800.275d.ac47 +10 0800.275d.b3dd + +Type Ports +-------- ----- +DYNAMIC Gi0/1 +DYNAMIC Fa0/4 +DYNAMIC Fa0/3 + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 197 + + +10 0800.275d.ce47 +10 0800.275d.ed13 + +DYNAMIC Fa0/2 +DYNAMIC Gi0/1 + +Total Mac Addresses for this criterion: 6 + +You verify physical connectivity and everything is perfect. However, you notice that the LED of the switchport PC1 is connected to is amber rather than green, confirming that something is not right. According to Figure 5-6, PC1 should be in VLAN 10. Issuing the command show vlan brief will confirm this for us. Example 5-26 shows that interface Fa0/1, which is connected to PC1, is in VLAN 10. In addition, the output of show inter-faces status | include Fa0/1, as shown in Example 5-27, does not indicate that anything is wrong. + +Example 5-26 show vlan brief Output for SW3 + +SW3#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + +10 10.1.10.0/24 +20 10.1.20.0/24 + +active Fa0/5, Fa0/6, Fa0/7, Fa0/8, +Fa0/9, Fa0/10, Fa0/11, Fa0/12, +Fa0/13, Fa0/14, Fa0/15, Fa0/16, +Fa0/17, Fa0/18, Fa0/19, Fa0/20, +Fa0/21, Fa0/22, Fa0/23, Fa0/24, +active Fa0/1, Fa0/2, Fa0/3, Fa0/4, +active + + + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + + +Example 5-27 show interfaces status | include Fa0/1 Output for SW3 + +SW3#show interfaces status | include Fa0/1 + +Port Name +Fa0/1 + +Status Vlan +connected 10 + +Duplex Speed Type +a-full a-10010/100BaseTX + + +No other users at this point have indicated that they are experiencing issues. You decide to check the SW3 logs on your syslog server and notice the following entry: + +%SPANTREE-2-ROOTGUARD_BLOCK: Root guard blocking port FastEthernet0/1 on VLAN0010. +It appears that BPDUs are being received by Fast Ethernet 0/1 from PC1. Issuing the com-mand show spanning-tree inconsistentports on SW3 confirms that Fast Ethernet 0/1 is in the root-inconsistent state, as shown in Example 5-28. + + + + + + + + +From the Library of Outcast Outcast +198 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 5-28 show spanning-tree inconsistentports Output for SW3 + +SW3#show spanning-tree inconsistentports +Name Interface Inconsistency +-------------------- ---------------------- ------------------ +VLAN0010 FastEthernet0/1 Root Inconsistent + +Number of inconsistent ports (segments) in the system : 1 + +Upon further examination, beyond the scope of this book, an application was installed on PC1 after hours that mimics a switch and sends BPDUs. Further investigation will be needed to determine whether this was malicious or by accident. + +To solve this issue, we remove the offending application from PC1, and the switch will recover the port automatically, as shown in Example 5-29. + +Example 5-29 SW3 show spanning-tree inconsistenetports Output After Application Removed from PC1 + +SW3# +%SPANTREE-2-ROOTGUARD_UNBLOCK: Root guard unblocking port FastEthernet0/1 on VLAN0010. +SW3#show spanning-tree inconsistentports + +Name Interface Inconsistency +-------------------- ---------------------- ------------------ + +Number of inconsistent ports (segments) in the system : 0 + +The output of ipconfig on PC1 in Example 5-30 verifies it has an IP address and a ping to 10.1.10.1, PC1’s default gateway, is successful. + +Example 5-30 ipconfig and ping Output for PC After Issue Solved + +PC1>ipconfig +Windows IP Configuration +Ethernet adapter Local Area Connection: +Connection-specific DNS Suffix . : domain.local +Link-local IPv6 Address . . . . . : fe80::444c:23b1:6e1e:de0c%16 +IPv4 Address. . . . . . . . . . . : 10.1.10.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Default Gateway . . . . . . . . . : 10.1.10.1 + +PC1>ping 10.1.10.1 +Pinging 10.1.1.1 with 32 bytes of data: +Reply from 10.1.10.1: bytes=32 time<1ms TTL=255 +Reply from 10.1.10.1: bytes=32 time=1ms TTL=255 +Reply from 10.1.10.1: bytes=32 time=3ms TTL=255 +Reply from 10.1.10.1: bytes=32 time=1ms TTL=255 + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 199 + +Ping statistics for 10.1.10.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 3ms, Average = 1ms + + +Troubleshooting Layer 2 EtherChannel + +An exception to STP operation can be made if two switches are interconnected via mul-tiple physical links and those links are configured as an EtherChannel. An EtherChannel logically combines the bandwidth of multiple physical interfaces into a logical connec-tion between switches, as illustrated in Figure 5-7. Specifically, Figure 5-7 shows four Gigabit Ethernet links logically bonded into a single EtherChannel link. + + +Gig 0/1-4 +SW1 + +Gig 0/1-4 +SW2 + + + +Figure 5-7 Layer 2 EtherChannel + +This section reviews what is necessary to successfully form a Layer 2 EtherChannel bun-dle and the EtherChannel mode combinations that will successfully form the bundle. + +Reviewing Layer 2 EtherChannel + +When multiple ports are combined into a logical EtherChannel, STP treats the logi-cal bundle (known as a port channel) as a single port for STP calculation purposes. Following are common troubleshooting targets to consider when troubleshooting an EtherChannel issue: + + +■ +Key Topic + + + +■ + + + + + + + +■ + +Mismatched port configurations: The configurations of all ports making up an EtherChannel, on both switches, should be identical. For example, all ports should have the same speed, duplex, trunk mode, native VLAN configurations, allowed VLAN configurations, and port type (Layer 2 or Layer 3). + +Mismatched EtherChannel configuration: Both switches forming the EtherChannel should be configured with compatible modes. There are three options, Link Aggregation Control Protocol (LACP), Port Aggregation Protocol (PAgP), and ON. These modes are not compatible with each other. In addition, when using LACP or PAgP, you have to make sure that the modes within the protocol can successfully form the bundle with each other. Table 5-4 identifies which modes can be configured on each switch to successfully form an EtherChannel bundle. + +Inappropriate EtherChannel distribution algorithm: EtherChannel determines which physical link to use to transmit frames based on a hash calculation. The hash-ing approach selected should distribute the load fairly evenly across all physical +links. For example, a hash calculation might be based only on the destination MAC + + + + + + +From the Library of Outcast Outcast +200 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +address of a frame. If the frames are destined for only a few different MAC address-es, the load distribution could be uneven. To verify the load-balancing algorithm in +use, issue the show etherchannel load-balance command. + + + +Table 5-4 Key +Topic + + +EtherChannel Modes That Will Successfully Form a Bundle + +SW1 + + + +MODE PAgP Desirable + +PAgP Auto LACP Active + +LACP ON Passive + + +PAgP Yes Yes No No No Desirable + +SW2 PAgP Auto Yes No No No No + +LACP No No Active + +LACP No No Passive + +ON No No + + +Yes Yes No + +Yes No No + +No No Yes + + + + +EtherChannel Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 5-8. + + + + +SW1 +Gi1/0/1 + +Gi1/0/5 + +Gi1/0/6 + +Gi1/0/5 + +Gi1/0/6 + + + +SW2 +Gi1/0/2 + + +Gi0/1 Gi0/2 + +SW3 + + + + + +Figure 5-8 Layer 2 EtherChannel Trouble Ticket Topology + + + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 201 + +Trouble Ticket 5-4 + +Problem: A junior network administrator has approached you indicating that the EtherChannel bundle she is trying to form between SW1 and SW2 is not forming. You need to solve this issue for her. + +You start by reviewing the output of show etherchannel summary for SW1 and SW2, as shown in Example 5-31. Notice that both switches are using LACP as their protocol; +however, the ports are either standalone or suspended, and the port channel is down. This is a good indication that there is a conflict with the port configurations. + +Example 5-31 show etherchannel summary Output for SW1 and SW2 + +SW1#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(SD) LACP Gi1/0/5(I) Gi1/0/6(s) + +SW2#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(SD) LACP Gi1/0/5(I) Gi1/0/6(I) + + + +From the Library of Outcast Outcast +202 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +To verify the port configuration you issue the show run interface gigabitethernet 1/0/5 and show run interface gigabitethernet 1/0/6 command on SW1 and SW2, as shown +in Example 5-32. If you look closely, you will notice that the switchport modes do not match on the SW1 interfaces that are part of the EtherChannel bundle. To form the bun-dle, they have to match. + +Example 5-32 show run interface gigabitethernet Output for SW1 and SW2 + +SW1#show run interface gigabitethernet 1/0/5 +Building configuration... +Current configuration : 189 bytes +! +interface GigabitEthernet1/0/5 +switchport trunk encapsulation isl +switchport mode access +switchport nonegotiate +channel-group 1 mode active +end +SW1#show run interface gigabitethernet 1/0/6 +Building configuration... +Current configuration : 189 bytes +! +interface GigabitEthernet1/0/6 +switchport trunk encapsulation isl +switchport mode trunk +switchport nonegotiate +channel-group 1 mode active +end + +SW2#show run interface gigabitethernet 1/0/5 +Building configuration... +Current configuration : 151 bytes +! +interface GigabitEthernet1/0/5 +switchport trunk encapsulation isl +switchport mode trunk +switchport nonegotiate +channel-group 1 mode passive +end +SW2#show run interface gigabitethernet 1/0/6 +Building configuration... + +Current configuration : 151 bytes +! +interface GigabitEthernet1/0/6 +switchport trunk encapsulation isl +switchport mode trunk + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 203 + +switchport nonegotiate +channel-group 1 mode passive +end + +Once you change the switchport mode on SW1 Gigabit Ethernet 1/0/5 with the switch-port mode trunk command, the port channel interface should come up, as shown with the following logging messages: +%LINK-3-UPDOWN: Interface Port-channel1, changed state to up +%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up +In addition, the EtherChannel bundle should now be successfully formed. Reviewing the output of show etherchannel summary on SW1 and SW2 indicates that the ports are successfully bundled with the (P) flags and that the port channel is in use with the (U) flag, as shown in Example 5-33. + +Example 5-33 show etherchannel summary Output for SW1 and SW2 After Problem Solved + +SW1#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(SU) LACP Gi1/0/5(P) Gi1/0/6(P) + +SW2#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + + + + + +From the Library of Outcast Outcast +204 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(SU) LACP Gi1/0/5(P) Gi1/0/6(P) + + +Trouble Ticket 5-5 + +Problem: A junior network administrator has approached you indicating that the EtherChannel bundle he is trying to form between SW1 and SW2 is not forming. You need to solve this issue for him. + +You start by checking whether the port channel is up on SW1 and SW2, as shown in Example 5-34. According to the output, it is down/down. + +Example 5-34 show ip interface brief | include Port Output for SW1 and SW2 + +SW1#show ip interface brief | include Port +Port-channel1 unassigned YES unset down down + +SW2#show ip interface brief | include Port +Port-channel1 unassigned YES unset down down + +Next you check the status of the EtherChannel bundle with the show etherchannel sum-mary command, as shown in Example 5-35. Notice that the port channel is down and that all interfaces are standalone. However, if you look closer, you will see the issue. SW1 is using PAgP, and SW2 is using LACP. These EtherChannel protocols are not compatible. Therefore, to solve this issue, you will need to verify your documentation to determine which protocol should be used between SW1 and SW2 and make the appropriate adjust-ments. + +Example 5-35 show etherchannel summary Output for SW1 and SW2 + +SW1#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 205 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(SD) PAgP Gi1/0/5(I) Gi1/0/6(I) + +SW2#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(SD) LACP Gi1/0/5(I) Gi1/0/6(I) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +206 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 5-5 lists a reference of these key topics and the page +numbers on which each is found. + + +Table 5-5 Key Topics for Chapter 5 Key +Topic Key Topic Element Description Page Number + + +List + +Sentence + +Table 5-2 + +Table 5-3 + +Section + +Section + +List + +Section + +Section + +List + +Table 5-4 + +Describes root bridge election 173 + +Identifies the golden rule of STP 173 + +Identifies STP port types 174 + +Identifies STP port costs 175 + +Reviews how to determine root ports 175 + +Reviews how to determine designated ports 176 + +Identifies STP port states 177 + +Identifies show commands used for troubleshooting 178 STP +Reviews STP features and the show commands used 182 for troubleshooting +Describes issues that could prevent an EtherChannel 199 from forming +Identifies the EtherChannel modes that will 200 successfully form a bundle + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +Spanning Tree Protocol (STP), root bridge, root port, designated port, nondesig-nated port, blocking, listening, learning, forwarding, 802.1D, 802.1w, 802.1s, Layer 2 EtherChannel, PAgP, LACP + + + + +From the Library of Outcast Outcast +Chapter 5: Troubleshooting STP and Layer 2 EtherChannel 207 + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + +Command Reference to Check Your Memory + +This section includes the show commands introduced in this chapter. It does not include the show commands that were used in this chapter but introduced in previous chapters. You will need to return to the previous chapters to review information relating to those show commands. + +To test your memory of the commands, cover the right side of Table 5-6 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a networking professional. Therefore, you should be able to identify the show commands needed to successfully troubleshoot the topics covered in this chapter. + + +Table 5-6 + +Task + + +show Commands Introduced in Chapter 5 + +Command Syntax + + + +Displays STP information about all VLANs + +Displays STP information about a specific VLAN + +Displays the STP interface role, cost, port priority, and type for each VLAN on the switch +Displays detailed STP information about an interface, including the number of BPDUs sent and received and the STP features that have been enabled specifically on the interface +Displays the MST region name, revision number, and the instance to VLAN mappings +Displays ports configured with Root Guard that have received superior BPDUs and ports configured with Loop Guard that are in the loop inconsistent state +Displays which STP features have been enabled globally on the switch + +show spanning-tree + +show spanning-tree [vlan {vlan_id}] + +show spanning-tree interface interface_type interface_number +show spanning-tree interface interface_type interface_number detail + +show spanning-tree mst configuration +show spanning-tree inconsistentports + +show spanning-tree summary + +Displays the status of port-channels as well as the status show etherchannel summary of the ports within the port channel +Displays the EtherChannel load-balance algorithm show etherchannel load-balance configured on the switch + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting a Router-on-a-Trunk/Stick: This section covers how to troubleshoot inter-VLAN routing issues when using the router-on-a-trunk sce-nario. + +■ Router-on-a-Trunk/Stick Trouble Tickets: This sec-tion provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + +■ Troubleshooting Switched Virtual Interfaces: This section identifies what is necessary for an SVI to be up/up and provide inter-VLAN routing. You will also learn how to troubleshoot issues related to SVIs. + +■ SVI Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a struc-tured troubleshooting process to solve a reported problem. + +■ Troubleshooting Routed Ports: This section reviews what is necessary to convert a Layer 2 switchport into a routed port. + +■ Routed Port Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. + +■ Troubleshooting Layer 3 EtherChannel: This sec-tion focuses on the steps needed to successfully troubleshoot a Layer 3 EtherChannel that relies on routed ports. + +■ Layer 3 EtherChannel Trouble Tickets: This sec-tion provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + + + +From the Library of Outcast Outcast +CHAPTER 6 + + + + +Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels + + +Chapters 4, “Troubleshooting Layer 2 Trunks, VTP, and VLANs,” and 5, “Troubleshooting STP and Layer 2 EtherChannel,” focused on Cisco Catalyst switches as Layer 2 switches. These switches operate at Layer 2 of the OSI model, forwarding or flooding frames based on the MAC addresses in the frame. However, many Cisco Catalyst switches are Layer 3 switches. These Layer 3 switches can perform both Layer 2 and Layer 3 services. + +Of the Layer 3 services, routing is the most common that is implemented. Through the use of virtual Layer 3 interfaces (known as switched virtual interfaces [SVIs]) or by con-verting a Layer 2 switchport to a routed port, you can assign IP addresses to these inter-faces and have the Layer 3 switch route data between VLANs and subnets. In addition, you can use routed ports to create Layer 3 EtherChannels. + +This chapter focuses on how you can troubleshoot different inter-VLAN routing imple-mentations, routed ports, and Layer 3 EtherChannel. You will also be exposed to a few different troubleshooting scenarios for each. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 6-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 6-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting a Router-on-a-Trunk/Stick + +Troubleshooting Switched Virtual Interfaces + +Troubleshooting Routed Ports + +Troubleshooting Layer 3 EtherChannel + +Questions +1–2 + +3–5 + +6–7 + +8–9 + + + + + + + + +From the Library of Outcast Outcast +210 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which command enables you to associate a VLAN with a router subinterface? + +a. encapsulation + +b. interface + +c. ip address + +d. vlan + +2. Which show command enables you to verify the VLAN that has been associated with a router subinterface? + +a. show interface trunk + +b. show vlan brief + +c. show ip route + +d. show vlans + +3. What must be true for an SVI to be up/up? (Choose two answers.) + +a. The VLAN associated with the SVI must exist on the switch. + +b. The SVI must be disabled. + +c. There must be at least one interface on the switch associated with the VLAN in the spanning-tree forwarding state. + +d. IP routing must be enabled on the switch. + +4. Which show command enables you to verify the status of the SVI for VLAN 10 and the MAC address associated with it? + +a. show ip interface brief + +b. show interfaces vlan 10 + +c. show ip interface vlan 10 + +d. show svi + +5. Which command enables IPv4 unicast routing on a Layer 3 switch? + +a. routing + +b. ip route + +c. ip routing + +d. ip unicast-routing + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 211 + +6. Which command enables you to convert a Layer 2 switchport to a routed port? + +a. no switchport + +b. routed port + +c. ip address + +d. ip routing + +7. Which show command enables you to verify whether interface Gigabit Ethernet 1/0/10 is a Layer 2 switchport or a routed port? + +a. show gigabitethernet 1/0/10 switchport + +b. show interfaces gigabitethernet 1/0/10 + +c. show interfaces gigabitethernet 1/0/10 switchport + +d. show interfaces status + +8. What flags in the show etherchannel summary output indicate that the EtherChannel is Layer 3 and in use? + +a. SU + +b. SD + +c. RU + +d. RD + +9. Which EtherChannel modes will successfully form an LACP EtherChannel? + +a. Active-auto + +b. Desirable-auto + +c. Passive-desirable + +d. Active-passive + +10. Which EtherChannel flag indicates that the port is bundled in the EtherChannel bundle? + +a. R + +b. S + +c. P + +d. H + + + + + + + + + +From the Library of Outcast Outcast +212 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +Gig 0/2 +Trunk + +Foundation Topics + + +Troubleshooting a Router-on-a-Trunk/Stick + +For traffic to pass from one VLAN to another VLAN, it has to be routed. This is easy to remember if you recall that a VLAN = a subnet and to send traffic from one subnet to another you route it. Therefore, to send traffic from one VLAN to another VLAN, you also route it. + +This section reviews how you can use an external router that is trunked to a switch to perform routing between VLANs. The section also covers the various issues that could cause this implementation to not function as expected. + +Before Layer 3 switches existed, we relied on external routers to perform inter-VLAN routing. The external router was connected to the Layer 2 switch via a trunk, which cre-ated the router-on-a-stick or router-on-a-trunk topology, as shown in Figure 6-1. + + + + + + +R1 Fa 1/1/1 + +Fa 1/1/1.1 VLAN 100 VLAN 200 +Fa 1/1/1.2 + + +Fa 1/1/1 +R1 + + + + + + + + +PC1 192.168.1.10/24 VLAN 100 + +Gig 0/1 +VLAN 100 SW1 + +Gig 0/3 +VLAN 200 + + + +PC2 192.168.2.10/24 VLAN 200 + + +Figure 6-1 Router-on-a-Trunk / Router-on-a-Stick + +In Figure 6-1, router R1’s Fast Ethernet 1/1/1 interface has two subinterfaces as indicated by the period (.) in the interface identification. There is one for each VLAN, Fast Ethernet 1/1/1.1 for VLAN 100 and Fast Ethernet 1/1/1.2 for VLAN 200. Router R1 can route between VLANs 100 and 200, while simultaneously receiving and transmitting traffic over the trunk connection to the switch. Review Example 6-1 and Example 6-2, which outline the configurations needed to implement a router-on-a-trunk. + +Example 6-1 show run Command Output from R1 +Key +Topic R1#show run +...output omitted... +interface FastEthernet1/1/1.1 +encapsulation dot1Q 100 + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 213 + +ip address 192.168.1.1 255.255.255.0 +! +interface FastEthernet1/1/1.2 +encapsulation dot1Q 200 +ip address 192.168.2.1 255.255.255.0 +...output omitted... + + +Example 6-2 show run Command Output from SW1 Key +Topic SW1#show run +...output omitted... +interface GigabitEthernet0/1 +switchport mode access +switchport access vlan 100 + +interface GigabitEthernet0/2 +switchport trunk encapsulation dot1q +switchport mode trunk +switchport nonegotiate + +interface GigabitEthernet0/3 +switchport mode access +switchport access vlan 200 +...output omitted... + + + +Key Topic + +After reviewing Example 6-1 and Example 6-2, what are issues that could prevent inter- +VLAN routing from being successful? + + +■ Trunk encapsulation mismatch + +■ Incorrect VLAN assignment on routers’ subinterfaces + +■ Incorrect IP address or subnet mask on routers’ subinterfaces + +■ Incorrect IP address, subnet mask, or default gateway on PCs + +■ Switchport connected to router configured as an access port + +■ Switchport connected to router configured to use Dynamic Trunking Protocol (DTP), which is not supported by the router + +■ Switchports connected to PCs in wrong VLAN + +Being able to identify these issues and correct them is important for any troubleshooter. + + +Router-on-a-Trunk/Stick Trouble Tickets + +This section covers various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 6-2. + + +From the Library of Outcast Outcast +214 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +Fa 0/1 + + + + + + + +R1 +Fa0/1 + +192.168.1.1/24 Fa0/1.100 VLAN 100 VLAN 200 Fa0/1.200 +192.168.2.1/24 + + + + +R1 + + + +Fa0/24 802.1q +Trunk +PC1 Fa0/1 Fa0/2 PC2 + + +192.168.1.10/24 VLAN 100 DG:192.168.1.1 + +VLAN 100 SW1 VLAN 200 +192.168.2.10/24 VLAN 200 DG:192.168.2.1 + + +Figure 6-2 Router-on-a-Trunk Trouble Tickets + + +Trouble Ticket 6-1 + +Problem: PC1 is not able to access resources on PC2. + +As you dive deeper into trouble tickets, everything covered in the previous chapters still applies because the PCs are still connected to the switches, there are still VLANs, and there are trunks. As a result, having a repeatable structured troubleshooting process in place will help you maintain focus and clarity as you troubleshoot. + +The first item on the list of troubleshooting is to verify the problem. Issuing the ping command on PC1, as shown in Example 6-3, indicates that PC1 is not able to reach PC2, confirming the problem. + +Example 6-3 Failed Ping from PC1 to PC2 + +C:\PC1>ping 192.168.2.10 +Pinging 192.168.2.10 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 192.168.2.10: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next you need to verify whether PC1 can get to its default gateway. This will help you narrow down where the issue may be. Pinging PC1s default gateway, as shown in +Example 6-4, is not successful. This indicates that we have an issue between PC1 and the default gateway. + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 215 + +Example 6-4 Failed Ping from PC1 to Default Gateway + +C:\PC1>ping 192.168.1.1 +Pinging 192.168.1.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 192.168.1.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Now is an excellent time to brainstorm the likely causes of the issue based on Figure 6-2 and the fact that PC1 is not able to ping its default gateway: + +■ PC1 may have an incorrect IP address, subnet mask, or default gateway configured. + +■ SW1 switchport FA0/1 may not be associated with the correct VLAN. + +■ VLAN 100 may not exist on SW1. + +■ PC1 may physically be connected to the wrong switchport. + +■ SW1 Fa0/24 may not be configured as a trunk. + +■ SW1 Fa0/24 may not be allowing VLAN 100 traffic on the trunk. + +■ SW1 Fa0/24 may be using the wrong trunk encapsulation. + +■ R1 may not have the appropriate subinterfaces configured with the correct IP addresses or subnet masks. + +■ R1’s subinterfaces may be using the wrong trunk encapsulation. + +■ R1’s subinterfaces may be disabled. + +As you can see, the list is quite extensive, and it is not even a complete list. Let’s start fol-lowing the path from PC1 and work toward the router. Issuing ipconfig on PC1 indicates that it has the correct IP address, subnet mask, and default gateway configured, as shown in Example 6-5, when compared to Figure 6-2. + +Example 6-5 ipconfig Output on PC1 + +C:\PC1>ipconfig +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 192.168.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Default Gateway . . . . . . . . . : 192.168.1.1 + + + +From the Library of Outcast Outcast +216 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Issuing the show mac address-table dynamic command on SW1 will identify which MAC address is being learned on Fa0/1 and which VLAN it is associated with. Example 6-6 is indicating that the MAC address of 0800.275d.06d6 is being learned on Fa0/1 and +that it is associated with VLAN 100. Issuing the ipconfig /all command on PC1, as shown in Example 6-7, identifies PC1’s MAC as 0800.275d.06d6, which is the same as the one outlined in the MAC address table. We can narrow our focus now because this proves that PC1 is connected to the correct switchport, VLAN 100 exists, and Fa0/1 is in the correct VLAN. + +Example 6-6 show mac address-table dynamic Command Output on SW1 + +SW1#show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +100 0800.275d.06d6 +200 0800.27a2.ce47 + +Type Ports +-------- ----- +DYNAMIC Fa0/1 +DYNAMIC Fa0/2 + +Total Mac Addresses for this criterion: 2 + + +Example 6-7 ipconfig /all Output on PC1 + +C:\PC1>ipconfig +...output omitted... +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapter +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +Dhcp Enabled. . . . . . . . . . . : No +IP Address. . . . . . . . . . . . : 192.168.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.0 +Default Gateway . . . . . . . . . : 192.168.1.1 +...output omitted... + +Focus on Example 6-6 again. If you look closely at the MAC address table on SW1, you will notice that no MAC addresses are being learned for VLAN 100 or VLAN 200 on Fa0/24. Why would this be? The link between R1 and SW1 should be an 802.1Q trunk according to Figure 6-2. If this trunk is not configured with the correct encapsulation, or the correct trunk mode, or the trunk is pruning VLAN 100 or 200 traffic, traffic for VLANs 100 and 200 would not pass over the link. + +On SW1, start by issuing the show interfaces trunk command, as shown in Example 6-8. The output indicates that Fa0/24 is a trunk using mode on, which means the command switchport mode trunk was issued. It also indicates that Fa0/24 is using Inter-Switch Link (ISL) as the trunk encapsulation method. According to Figure 6-2, the trunk should be using 802.1Q. + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 217 + +Example 6-8 show interfaces trunk Command Output on SW1 + +SW1#show interfaces trunk + +Port Mode +Fa0/24 on + +Encapsulation +isl + +Status +trunking + +Native vlan +1 + + +Port Vlans allowed on trunk +Fa0/24 1-4094 + +Port Vlans allowed and active in management domain +Fa0/24 1,100,200 + +Port Vlans in spanning tree forwarding state and not pruned +Fa0/24 1,100,200 + +Reviewing the output of show vlans on R1 in Example 6-9 confirms that R1 is using 802.1Q for its trunk encapsulation. As a result, we have a trunk encapsulation mismatch. + +Example 6-9 show vlans Output on R1 + +R1#show vlans +...output omitted... +Virtual LAN ID: 100 (IEEE 802.1Q Encapsulation) + +vLAN Trunk Interface: FastEthernet0/1.100 + + +Protocols Configured: +IP +Other + +Address: +192.168.1.1 + +Received: +4 +0 + +Transmitted: +8 +5 + + +4 packets, 298 bytes input +13 packets, 1054 bytes output + +Virtual LAN ID: 200 (IEEE 802.1Q Encapsulation) + +vLAN Trunk Interface: FastEthernet0/1.200 + + +Protocols Configured: +IP +Other + +Address: +192.168.2.1 + +Received: +4 +0 + +Transmitted: +8 +5 + + +4 packets, 298 bytes input +13 packets, 1054 bytes output + +You need to fix SW1 so that Fa0/24 is using the correct trunk encapsulation method. On Fa0/24 of SW1, issue the switchport trunk encapsulation dot1q command. After you have implemented your solution, you need to confirm that it solved the problem by ping-ing from PC1 to PC2 again. Example 6-10 shows that the ping is successful. + + + +From the Library of Outcast Outcast +218 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 6-10 Successful Ping from PC1 to PC2 + +C:\PC1>ping 192.168.2.10 + +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.168.2.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 6-2 + +Problem: PC1 is not able to access resources on PC2. + +The problem reported in this trouble ticket is the exact same as the previous trouble tick-et. However, do not jump to the conclusion that it is the same problem and solution. You always want to follow your structured troubleshooting approach to make sure that you efficiently solve the problem and waste little effort. + +The first item on the list of troubleshooting is to verify the problem. Issuing the ping command on PC1, as shown in Example 6-11, indicates that PC1 is not able to reach PC2, confirming the problem. + +Example 6-11 Failed Ping from PC1 to PC2 + +C:\PC1>ping 192.168.2.10 +Pinging 192.168.2.10 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 192.168.2.10: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next you need to verify whether PC1 can get to its default gateway. This will help you narrow down where the issue may be. Pinging PC1’s default gateway, as shown in +Example 6-12, is successful. This indicates that we do not have an issue between PC1 and the default gateway. + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 219 + +Example 6-12 Successful Ping from PC1 to Default Gateway + +C:\PC1>ping 192.168.1.1 +Reply from 192.168.1.1: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.1: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.1: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.168.1.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +Now is a great time to check whether PC1 can ping the default gateway of VLAN 200 at 192.168.2.1. This will help you determine whether inter-VLAN routing is working on R1 between VLAN 100 and VLAN 200. The ping, as shown in Example 6-13, is successful. + +Example 6-13 Successful Ping from PC1 to Default Gateway of VLAN 200 + +C:\PC1>ping 192.168.2.1 +Reply from 192.168.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.168.2.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +It is time to shift attention to R1 and PC2 because it appears everything is fine from PC1 to R1’s subinterface Fa0/1.100. In this case, we will work our way backward from R1 to PC2. For VLAN 200 traffic to flow from R1 to PC2, the subinterface Fa0/1.200 needs to be using the correct encapsulation method (802.1Q), it needs to have the cor-rect IP address and subnet mask assigned to it (192.168.2.1/24), and it needs to have the right VLAN assigned to it (VLAN 200). Using the command show vlans on R1 will help to verify the subinterface configuration on R1, as outlined in Example 6-14. Notice that subinterface Fa0/1.200 has the appropriate IP address and that it is also using 802.1Q as the trunk encapsulation. However, it is associated with VLAN 20, not VLAN 200. This appears to be the issue. + +Example 6-14 show vlans Command Output on R1 + +R1#show vlans +...output omitted... +Virtual LAN ID: 20 (IEEE 802.1Q Encapsulation) + +vLAN Trunk Interface: FastEthernet0/1.200 + + + + +From the Library of Outcast Outcast +220 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Protocols Configured: +IP + +Address: +192.168.2.1 + +Received: +0 + +Transmitted: +0 + + +0 packets, 0 bytes input +0 packets, 0 bytes output +...output omitted... + +In subinterface configuration mode for Fa0/1.200, you execute the command encapsula-tion dot1q 200 to change the VLAN association from 20 to 200. Once done, you review the output of show vlans on R1, as shown in Example 6-15, to verify that subinterface Fa0/1.200 is associated with VLAN 200. + +Example 6-15 show vlans Command Output on R1 After Configuration Changes + +R1#show vlans +...output omitted... +Virtual LAN ID: 200 (IEEE 802.1Q Encapsulation) + +vLAN Trunk Interface: FastEthernet0/1.200 + + +Protocols Configured: +IP + +Address: +192.168.2.1 + +Received: +0 + +Transmitted: +0 + + +0 packets, 0 bytes input +0 packets, 0 bytes output + +You then confirm the issue is solved by pinging from PC1 to PC2 again. Example 6-16 shows that the ping is successful, and so you can now conclude that the problem is solved. + +Example 6-16 Successful Ping from PC1 to PC2 + +C:\PC1>ping 192.168.2.10 +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.2.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.168.2.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 221 + +Troubleshooting Switched Virtual Interfaces + +On a router, an interface has an IP address that defines the subnet the interface is part of. In addition, the IP address is usually acting as a default gateway to hosts residing off of that interface. However, if you have a Layer 3 switch with multiple ports (access or trunk) belonging to the same VLAN, as shown in Figure 6-3, which interface should the IP address be configured on? + + + + + + + + + + + +SW1 +Gig 0/7 Gig 0/10 +VLAN 100 VLAN 200 +Gig 0/8 Gig 0/9 +VLAN 100 VLAN 200 + + + + + + + +Figure 6-3 Layer 3 Switch Without IP addresses + +Since Layer 2 switchports cannot be assigned an IP address; you need to create a logi-cal Layer 3 interface known as a switched virtual interface (SVI). These SVIs can be assigned an IP address just like router interfaces. However, unlike router interfaces where an IP address is associated with one interface, the SVI represents all switchports that are part of the same VLAN the SVI is configured for. Therefore, any device connecting to +the switch that is in VLAN 100 uses SVI 100, and any device in VLAN 200 uses SVI 200, and so on. This section explains how to configure SVIs on Layer 3 switches and the items that you should look out for when troubleshooting SVIs. + +Reviewing SVIs + +Figure 6-4 shows a topology using SVIs, and Example 6-17 shows the corresponding configuration. Notice that two SVIs are created: one for each VLAN. The SVI for VLAN 100 has the IP address 192.168.1.1/24, and the SVI for VLAN 200 has the IP address 192.168.2.1/24. Notice that these are two different subnets. As a result, devices that are members of VLAN 100 need to have an IP address in the 192.168.1.0/24 network and + + + + + + +From the Library of Outcast Outcast +222 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +have their default gateway pointing to the VLAN 100 SVI IP address of 192.168.1.1. Devices that are members of VLAN 200 need to have an IP address in the 192.168.2.0/24 network and have their default gateway pointing to the VLAN 200 SVI IP address of 192.168.2.1. An IP address is assigned to an SVI by going into interface configuration mode for a VLAN. For example, the global configuration command interface vlan 10 enters interface configuration mode for SVI 10 and, if not previously created, will create SVI 10. In this example, because both SVIs are local to the switch, the switch’s routing table knows how to forward traffic between members of the two VLANs. Also, IPv4 routing is not on by default on Layer 3 switches; therefore, you need to enable it with the ip routing global configuration command. +Gig 0/7 Gig 0/10 +VLAN 100 VLAN 200 +Gig 0/8 +VLAN 100 +Gig 0/9 +VLAN 200 + + + + + + + + + +SVI: VLAN 100 +192.168.1.1/24 + +SVI: VLAN 200 +192.168.2.1/24 + + +SW1 + + + + + + + +Figure 6-4 Layer 3 Switch with SVIs + +Example 6-17 SW1 SVI Configuration Key +Topic SW1#show run +...output omitted... +! +ip routing +! +...output omitted... +! +interface GigabitEthernet0/7 +switchport access vlan 100 +switchport mode access + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 223 + +! +interface GigabitEthernet0/8 +switchport access vlan 100 +switchport mode access +! +interface GigabitEthernet0/9 +switchport access vlan 200 +switchport mode access +! +interface GigabitEthernet0/10 +switchport access vlan 200 +switchport mode access +! +...output omitted... +! +interface Vlan100 +ip address 192.168.1.1 255.255.255.0 +! +interface Vlan200 +ip address 192.168.2.1 255.255.255.0 + + +Troubleshooting SVIs + +For an SVI to function, the SVI status has to be up and the protocol has to be up. You can verify whether the SVI is up/up with a few different show commands, as shown in Example 6-18. In this case, the SVI for VLAN 100 is up/up, as shown in the output of show ip interface brief. The output of show interfaces vlan 100 also displays the SVI as being up/up, but it provides the MAC (bia) address that will be used when devices need to communicate directly with the SVI. For example, when hosts on VLAN 100 need to send a frame to the default gateway (remember the SVI will be the default gateway), they need a destination MAC address for the IP address associated for the SVI. It is this MAC that will be used in this case. The command also provides the IP address of the SVI. Lastly, the show ip interface vlan 100 command indicates that the SVI is up/up, in addi- +tion to providing us with the IP address. + +Example 6-18 Verifying the Status of an SVI Key +Topic SW1#show ip interface brief | include Vlan|Interface +Interface IP-Address OK? Method Status Protocol +Vlan1 unassigned YES NVRAM administratively down down + +Vlan100 +Vlan200 + +192.168.1.1 +192.168.2.1 + +YES manual up up +YES manual up up + + + + + + + + + +From the Library of Outcast Outcast +224 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +SW1#show interfaces vlan 100 +Vlan100 is up, line protocol is up +Hardware is EtherSVI, address is 000d.2829.0200 (bia 000d.2829.0200) +Internet address is 192.168.1.1/24 +MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec, +reliability 255/255, txload 1/255, rxload 1/255 +...output omitted... + +SW1#show ip interface vlan 100 +Vlan100 is up, line protocol is up +Internet address is 192.168.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Outgoing access list is not set +Inbound access list is not set +...output omitted... + + + +Key Topic + +To successfully troubleshoot SVIs, you need to understand the circumstances that are necessary for an SVI to be up/up. The following list outlines what is needed for an SVI to +be up/up: + + +■ The VLAN the SVI is created for needs to exist locally on the switch. + +■ The SVI has to be enabled and not administratively shut down. + +■ At a minimum, there must be one switchport (access or trunk) that is up/up and in the spanning-tree forwarding state for that specific VLAN. + + +Note To route from one SVI to another SVI, IP routing must be enabled on the Layer 3 switch with the ip routing command. + + + +SVI Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 6-5. + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 225 + + +10.1.1.10/26 + +PC1 + +Fa0/1 + + + +SVI: VLAN 10 IP: 10.1.1.1 802.1q 10.1.1.0/26 +Gig0/1 + + + +SW2 +Fa0/2 PC2 + +10.1.1.74/26 + +Gig1/0/1 + +SW1 +SVI: VLAN 20 IP: 10.1.1.65 10.1.1.64/26 + + +Figure 6-5 SVI Trouble Ticket Topology + + +Trouble Ticket 6-3 + +Problem: PC1 is not able to access resources on PC2. + +Let’s start this trouble ticket by verifying the problem. Example 6-19 verifies that PC1 cannot access resources on PC2 because the ping has failed. + +Example 6-19 Failed Ping from PC1 to PC2 + +C:\PC1>ping 10.1.1.74 +Pinging 10.1.1.74 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.1.74: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next, we ping the default gateway for PC1, and the result is not successful either, as shown in Example 6-20. This means that we have an issue from PC1 to the default gate-way. + +Example 6-20 Failed Ping from PC1 to Default Gateway + +C:\PC1>ping 10.1.1.1 +Pinging 10.1.1.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + + +From the Library of Outcast Outcast +226 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Following a structured troubleshooting approach, you would verify the IP configura-tion on PC1 as well as its MAC address using the ipconfig /all command. Example 6-21 indicates that the IP address, subnet mask, and default gateway are all correct based on Figure 6-5. It also indicates that the MAC address is 0800:275d:06d6. + +Example 6-21 Verifying PC1s Configuration with ipconfig /all + +C:\PC1>ipconfig /all +...output omitted... +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapter +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +Dhcp Enabled. . . . . . . . . . . : No +IP Address. . . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : 10.1.1.1 +...output omitted... + +Next we verify that SW2 is learning the MAC address of PC1 on the correct interface and that it is associated with the correct VLAN. Example 6-22 shows that the MAC address of PC1 (0800:275d:06d6) is associated with Fa0/1 and VLAN 10 with the com-mand show mac address-table dynamic. + +Example 6-22 Verifying SW2 Has Learned the MAC Address of PC1 on Fa0/1 and VLAN 10 + +SW2#show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +10 0800.275d.06d6 +20 0800.27a2.ce47 +20 2893.fe3a.e342 + +Type Ports +-------- ----- +DYNAMIC Fa0/1 +DYNAMIC Fa0/2 +DYNAMIC Gi0/1 + +Total Mac Addresses for this criterion: 3 + +Next we issue the show mac address-table dynamic command on SW1, as shown in Example 6-23, to verify that the MAC address of PC1 is being learned on Gig1/0/1 and is associated with VLAN 10. In this case, it is not being learned at all. In addition, reviewing the output of Example 6-22 again concludes that there are no MAC addresses for VLAN 10 being learned on the Gig0/1 interface of SW2. We should see the MAC address of the default gateway for the 10.1.1.0/26 network associated with Gig0/1, but we don’t. + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 227 + +Example 6-23 Verifying SW1 Has Learned the MAC Address of PC1 on Gig1/0/1 and VLAN 10 + +SW1#show mac address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +20 0800.27a2.ce47 + +Type +-------- +DYNAMIC + +Ports +----- +Gi1/0/1 + +Total Mac Addresses for this criterion: 1 + +Because SW1 is a Layer 3 switch, it should have an SVI for VLAN 10 with an IP address associated with it in the up/up state. Issuing the command show ip interface brief | include Vlan10, as shown in Example 6-24, indicates that the SVI exists on SW1, it has the IP address 10.1.1.1, and it is up/down. Therefore, the issue in this trouble ticket is causing MAC addresses not to be learned for VLAN 10 on SW1’s Gig1/0/1 and SW2’s Gig0/1 interfaces and is causing the SVI on SW1 to be up/down. + +Example 6-24 Verifying SVI Exists on SW1 and Its Status + +SW1#show ip interface brief | include VLAN10|Interface +Interface IP-Address OK? Method Status Protocol +Vlan10 10.1.1.1 YES NVRAM up down + +What causes an SVIs protocol state to be down? + +■ The VLAN the SVI is created for does not exist locally on the switch. + +■ The SVI is administratively shut down. + +■ There is no switchport (access or trunk) that is up/up and in the spanning-tree for-warding state for that specific VLAN. + +What would cause MAC addresses not to be learned on trunk interfaces? + +■ The trunk has mismatched encapsulations, modes, native VLANs. + +■ The trunk is manually or dynamically pruning traffic for the VLAN causing spanning tree to have no forwarding state for the VLAN. + +■ The VLAN does not exist on the switch. + +Let’s compare these two lists. What do they have in common? + +■ The VLAN does not exist. + +■ Spanning tree is not in the forwarding state for the VLAN on at least one interface. + +On SW1, the show interfaces trunk command enables you to see the spanning-tree for-warding state for each VLAN on Gig1/0/1. Example 6-25 shows the output of the com-mand show interfaces trunk on SW1 and highlights the fact that SW1 interface Gig1/0/1 + + + +From the Library of Outcast Outcast +228 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +is not in the spanning-tree forwarding state for VLAN 10, only for VLAN 1 and 20. If you look further at the output, you see that VLAN 10 is not even listed in the list of VLANs that are active in the management domain. This is a good indication that VLAN 10 does not exist on SW1. + +Example 6-25 Output of show interfaces trunk on SW1 + +SW1#show interfaces trunk + +Port Mode +Gi1/0/1 on + +Encapsulation +802.1q + +Status +trunking + +Native vlan +99 + + + +Port +Gi1/0/1 + +Port +Gi1/0/1 + +Port +Gi1/0/1 + +Vlans allowed on trunk +1-4094 + +Vlans allowed and active in management domain +1,20 + +Vlans in spanning tree forwarding state and not pruned +1,20 + + +Reviewing the output of show vlan brief on SW1 confirms that VLAN 10 does not exist, as shown in Example 6-26. Correcting this issue requires that you create the VLAN in global configuration mode using the vlan 10 command. + +Example 6-26 Output of show vlan brief on SW1 + +SW1#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + + + + +20 10.1.1.64/26 + +active Gi1/0/2, Gi1/0/3, Gi1/0/4 +Gi1/0/5, Gi1/0/6, Gi1/0/7 +Gi1/0/8, Gi1/0/9, Gi1/0/10 +Gi1/0/11, Gi1/0/12, Gi1/0/13 +Gi1/0/14, Gi1/0/15, Gi1/0/16 +Gi1/0/17, Gi1/0/18, Gi1/0/19 +Gi1/0/20, Gi1/0/21, Gi1/0/22 +Gi1/0/23, Gi1/0/24, Te1/0/1, +Te1/0/2 +active + + + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +After you have corrected the issue, you want to confirm that the VLAN exists, as shown in the show vlan brief output of Example 6-27. You want to confirm that the output of show interfaces trunk lists VLAN 10 in the active VLANs in the management domain and that it is in the spanning-tree forwarding state and not pruned for interface Gig1/0/1, + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 229 + +as shown in Example 6-28. In addition, you want to verify that the SVI for VLAN 10 is up/up by using the command show ip interface brief | include Vlan10, as shown in Example 6-29. + +Example 6-27 Output of show vlan brief on SW1 After Changes + +SW1#show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + + + + +10 10.1.1.0/26 +20 10.1.1.64/26 + +active Gi1/0/2, Gi1/0/3, Gi1/0/4 +Gi1/0/5, Gi1/0/6, Gi1/0/7 +Gi1/0/8, Gi1/0/9, Gi1/0/10 +Gi1/0/11, Gi1/0/12, Gi1/0/13 +Gi1/0/14, Gi1/0/15, Gi1/0/16 +Gi1/0/17, Gi1/0/18, Gi1/0/19 +Gi1/0/20, Gi1/0/21, Gi1/0/22 +Gi1/0/23, Gi1/0/24, Te1/0/1, +Te1/0/2 +active +active + + + +1002 fddi-default +1003 trcrf-default +1004 fddinet-default +1005 trbrf-default + +act/unsup +act/unsup +act/unsup +act/unsup + + + +Example 6-28 Output of show interfaces trunk on SW1 After Changes + +SW1#show interfaces trunk + +Port Mode +Gi1/0/1 on + +Encapsulation +802.1q + +Status +trunking + +Native vlan +99 + + + +Port +Gi1/0/1 + +Port +Gi1/0/1 +Port +Gi1/0/1 + +Vlans allowed on trunk +1-4094 + +Vlans allowed and active in management domain +1,10,20 +Vlans in spanning tree forwarding state and not pruned +1,10,20 + + + +Example 6-29 Output of show ip interface brief | include VLAN10 on SW1 After Changes + +SW1#show ip interface brief | include VLAN10|Interface +Interface IP-Address OK? Method Status Protocol +Vlan10 10.1.1.1 YES NVRAM up up + + + + + + +From the Library of Outcast Outcast +230 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Finally, you want to verify that the problem is solved by successfully pinging from PC1 to PC2. Example 6-30 shows that the problem is solved and that the ping is successful. + +Example 6-30 Successful Ping from PC1 to PC2 + +C:\PC1>ping 10.1.1.74 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.74: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 6-4 + +Problem: PC1 is not able to access resources on PC2. + +You start by verifying the problem, as shown in Example 6-31, which confirms (because the ping has failed) that PC1 is unable to access resources on PC2. Next you verify that PC1 can reach the default gateway, as shown in Example 6-32, which it can since the ping was successful. This confirms that no issue exists between PC1 and the default gateway. Next you verify that PC1 can reach the default gateway of VLAN 20, which is 10.1.1.65. Example 6-33 confirms that PC1 is able to reach the default gateway of VLAN 20 since the ping was successful as well. + +Example 6-31 Failed Ping from PC1 to PC2 + +C:\PC1>ping 10.1.1.74 +Pinging 10.1.1.74 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.1.74: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + + +Example 6-32 Successful Ping from PC1 to VLAN 10 Default Gateway + +C:\PC1>ping 10.1.1.1 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 231 + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Example 6-33 Successful Ping from PC1 to VLAN 20 Default Gateway + +PC1#ping 10.1.1.65 +Reply from 10.1.1.65: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.65: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.65: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.65: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.65: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +Because all the pings were successful, this might mean that we have a problem between SW1 and PC2. Let’s ping from SW1 to PC2 to verify this. Example 6-34 provides the result of issuing the ping 10.1.1.74 command on SW1. Notice that the ping is successful, which negates our hypothesis that a problem might exist between SW1 and PC2. + +Example 6-34 Successful Ping from SW1 to PC2 + +SW1#ping 10.1.1.74 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.1.74, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/205/1015 ms + +Let’s recap. PC1 can ping SVI 10, and PC2 can ping SVI 20. We also concluded that PC1 can ping SVI 20, which should mean that PC2 can ping SVI 10. Let’s double check by pinging from PC2 to the IP address 10.1.1.1. As shown in Example 6-35, it is successful as well. + +Example 6-35 Successful Ping from PC2 to SVI 10 + +C:\PC2>ping 10.1.1.1 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + +From the Library of Outcast Outcast +232 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +So, the pings are getting a little more than halfway to their destination. What is required for the ping from PC1 to fully reach PC2? Routing. + +Remember how the SVIs work. They are equivalent to router interfaces. Therefore, when you create an SVI, give it an IP address, and it is up/up, an entry for the network that the SVI belongs gets placed in the routing table. Issuing the command show ip inter-face brief on SW1, as shown in Example 6-36, confirms that the SVIs for VLAN 10 and +VLAN 20 exist, they have the correct IP addresses assigned to them, and they are up/up. + +Example 6-36 Output of show ip interface brief on SW1 + +SW1#show ip interface brief | include Vlan|Interface +Interface IP-Address OK? Method Status Protocol +Vlan1 unassigned YES NVRAM administratively down down + +Vlan10 10.1.1.1 +Vlan20 10.1.1.65 + +YES NVRAM up up +YES NVRAM up up + + +Let’s check the routing table on SW1 with the command show ip route. The output of show ip route, as shown in Example 6-37, does not even look like a routing table. +Therefore, SW1 cannot route traffic. It can only respond to pings that are sent to its local interfaces. The output of Example 6-37 should immediately lead you to the solution of this problem. The problem is that IP routing is not enabled on SW1. By default, on Layer 3 switches, IP routing is disabled. To enable it, you execute the ip routing command in global configuration mode. + +Example 6-37 Output of show ip route on SW1 + +SW1#show ip route +Default gateway is not set + +Host Gateway Last Use Total Uses Interface +ICMP redirect cache is empty + +After you have enabled IP routing, you can issue the show ip route command again on SW1 to verify that directly connected entries have been added to the routing table for SVI VLAN 10 and SVI VLAN 20. Example 6-38 shows a routing table that we are famil-iar with and the directly connected entries for VLAN 10 and VLAN 20. + +Example 6-38 Output of show ip route on SW1 + +SW1#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 233 + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.1.1.0/26 is directly connected, Vlan10 +L 10.1.1.1/32 is directly connected, Vlan10 +C 10.1.1.64/26 is directly connected, Vlan20 +L 10.1.1.65/32 is directly connected, Vlan20 + +Finally, we need to confirm that our solution solved the original issue, which was that PC1 could not access resources on PC2. Pinging from PC1 to PC2, as shown in Example 6-39, is successful, proving that we solved the issue. + +Example 6-39 Successful Ping from PC1 to PC2 + +C:\PC1>ping 10.1.1.74 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.74: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.74: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Troubleshooting Routed Ports + +Although SVIs can route between VLANs configured on a switch, a Layer 3 switch can be configured to act more as a router (for example, in an environment where you are replacing a router with a Layer 3 switch) by using routed ports on the switch. This sec-tion explains how to configure routed ports on Layer 3 switches so that you can identify potential problems during the troubleshooting process. + +By default, the ports on many Layer 3 Cisco Catalyst switches operate as Layer 2 switch-ports. Therefore, you have to issue the no switchport command in interface configuration mode to convert a switchport to a routed port. Figure 6-6 and Example 6-40 illustrate a Layer 3 switch with its Gigabit Ethernet 0/9 and 0/10 ports configured as routed ports. You can verify whether a port is a routed port by using the show interfaces interface_ type interface_number switchport command, as shown in Example 6-40 also. A routed port will state Switchport: Disabled. + +192.168.1.1/24 Gig0/9 Gi0/10 192.168.2.1/24 +Gig0/0 192.168.1.2/24 192.168.2.2/24 Gig0/0 R2 +SW2 SW1 + +Figure 6-6 Routed Ports on a Layer 3 Switch + + + + +From the Library of Outcast Outcast +234 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 6-40 Configuration for Routed Ports on a Layer 3 Switch +Key +Topic SW1#show run +...output omitted... +! +interface GigabitEthernet0/9 +no switchport +ip address 192.168.1.2 255.255.255.0 +! +interface GigabitEthernet0/10 +no switchport +ip address 192.168.2.2 255.255.255.0 +! +...output omitted... +SW1#show interfaces gigabitEthernet 0/10 switchport +Name: Gi0/10 +Switchport: Disabled + +The following list outlines the characteristics of routed ports: + +■ Has no association with any VLAN. + +■ Physical switchport that has Layer 3 (routing) capabilities. + +■ Does not run switchport protocols such as Spanning Tree Protocol (STP) or Dynamic Trunking Protocol (DTP). + +■ Does not support subinterfaces like a router. + +■ Useful for uplinks between Layer 3 switches or when connecting a Layer 3 switch to a router. + +■ To route from one routed port to another or a routed port to an SVI and vice versa, IP routing needs to be enabled. + + +Routed Ports Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 6-7. + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 235 + + +10.1.1.10/26 + +PC1 + +Fa0/1 + +SW2 +Fa0/2 PC2 + +10.1.1.74/26 + + + +SVI: VLAN 10 +802.1q 10.1.1.1/26 10.1.10.0/24 +Gig0/1 Gig1/0/10 .1 Internet Gig1/0/1 .2 Gig1/0 R1 + +SW1 +SVI: VLAN 20 10.1.1.65/26 + + +Figure 6-7 Routed Ports Trouble Tickets Topology + + +Trouble Ticket 6-5 + +Problem: PC1 and PC2 are not able to access resources outside their subnet. + +You must always be sure that you fully understand the problem that is being submitted. Therefore, you always need to further define the problem to make sure that it is accurate. You ping from PC1 to the Internet, and it fails. You ping from PC2 to the Internet, and it fails. You ping from PC1 to its default gateway, and it is successful. You ping from PC2 to its default gateway, and it is successful. You ping from PC1 to PC2, and it is successful. Pinging from PC1 and PC2 to R1’s Gig1/0 interface fails. Therefore, the problem statement can be changed to read as follows: + +Problem: PC1 and PC2 are not able to access resources beyond SW1. They are able to access each other. +This clarification allows us to focus our attention from SW1 onward, skipping all the Layer 2 troubleshooting between the PCs and SW1. + +On SW1, you ping 10.1.10.1, as shown in Example 6-41, and it fails. + +Example 6-41 Failed Ping from SW1 to R1 + +SW1#ping 10.1.10.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.10.1, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) + +Next you issue the show ip interface brief command on SW1, as shown in Example 6-42, to verify that the correct IP address is configured on interface Gig1/0/10 and that it is up/ up. The output shows that there is no IP address configured on Gig1/0/10 and that the interface is up/up. + + + + + + + +From the Library of Outcast Outcast +236 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 6-42 Output of show ip interface brief on SW1 + +SW1#show ip interface brief +Interface IP-Address OK? Method Status Protocol +...output omitted... + +GigabitEthernet1/0/9 +GigabitEthernet1/0/10 +GigabitEthernet1/0/11 +...output omitted... + +unassigned +unassigned +unassigned + +YES unset down down +YES unset up up +YES unset down down + + +You enter interface configuration mode for Gig1/0/10 and issue the command ip address 10.1.10.2 255.255.255.0, as shown in Example 6-43. You receive the error message dis-played in Example 6-43. + +Example 6-43 Error message on SW1 + +SW1#config t +SW1(config)#interface gig 1/0/10 +SW1(config-if)#ip address 10.1.10.2 255.255.255.0 +^ +% Invalid input detected at '^' marker. + + + +Key Topic + +As shown in Example 6-43, you are not able to configure an IP address on Gig1/0/10. This is a good indication that it is a Layer 2 switchport. You confirm this by issuing the show interface Gig1/0/10 switchport command. The output displayed in Example 6-44 indicates that it is indeed a Layer 2 switchport because the output states Switchport: +Enabled. If it stated Switchport: Disabled, this would indicate that it is a routed port. + + +Example 6-44 Output of the show interfaces gig1/0/10 switchport Command on SW1 + +SW1#show interfaces gig1/0/10 switchport +Name: Gi1/0/10 +Switchport: Enabled +Administrative Mode: dynamic auto +Operational Mode: static access +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +...output omitted... + +To assign an IP address to a switchport on a Layer 3 switch, you need to convert it to a routed port using the no switchport command in interface configuration mode, as shown in Example 6-45. Also in Example 6-45, you can see that the IP address command was successfully executed after the no switchport command was entered. + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 237 + +Example 6-45 Configuring a Routed Port on SW1 + +SW1#config t +SW1(config)#interface gig 1/0/10 +SW1(config-if)#no switchport +SW1(config-if)#ip address 10.1.10.2 255.255.255.0 + +Now the ping from SW1 to R1 is successful, as displayed in Example 6-46. Also, the pings from PC1 and PC2 to the Internet are successful (not displayed). + +Example 6-46 Successful Ping from SW1 to R1 + +SW1#ping 10.1.10.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.10.1, timeout is 2 seconds: +.!!!! +Success rate is 80 percent (4/5), round-trip min/avg/max = 9/14/17 ms + + +Troubleshooting Layer 3 EtherChannel + +Chapter 5 discussed how to troubleshoot Layer 2 EtherChannels between Layer 2 switchports on Cisco Catalyst switches. When you have multiple routed ports on Layer 3 switches, you can bundle them together to create Layer 3 EtherChannels. This section +focuses on the Layer 3 EtherChannel requirements and how you can successfully trouble-shoot issues relating to it. + +An EtherChannel logically combines the bandwidth of multiple physical interfaces into a logical connection between switches, as illustrated in Figure 6-8. Specifically, Figure +6-8 shows four Gigabit Ethernet routed ports logically bonded into a single EtherChannel link known as a port channel. + + + +Gig 0/1-4 + +Routed Ports + +Gig 0/1-4 + +Routed Ports + + +SW1 SW2 + +Figure 6-8 Layer 3 EtherChannel + + + +Key Topic + +Following are common troubleshooting targets to consider when troubleshooting a Layer +3 EtherChannel issue: + + +■ Mismatched port configurations: The configurations of all ports making up an EtherChannel, on both switches, should be identical. For example, all ports should have the same speed and duplex and port type (Layer 2 or Layer 3). With Layer 3 EtherChannel, there is no need to worry about trunk mode, native VLAN configura-tions, and allowed VLAN configurations because we use routed ports, which are Layer 3 ports that do not care about those parameters. + + + +From the Library of Outcast Outcast +238 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Port type during configuration: Creating an EtherChannel with the channel-group command before the port channel is created will automatically create the port channel with the same state as the physical ports bundled in the channel group. For example, if the physical interfaces are Layer 2 switchports, the port channel will be a Layer 2 port channel. If the physical interfaces are Layer 3 interfaces, the port chan-nel will be a Layer 3 port channel. Therefore, it is imperative that you either make the physical interfaces routed ports with the no switchport command before creat-ing the bundle or create the Layer 3 port channel with the interface port-channel interface_number command and issue the no switchport command in interface configuration mode before you configure the physical interfaces with the channel-group command. Order of operations is more important with Layer 3 EtherChannel than with Layer 2 EtherChannel. + +■ Mismatched EtherChannel configuration: Both switches forming the EtherChannel should be configured for the same EtherChannel negotiation protocol. The options are Link Aggregation Control Protocol (LACP) and Port Aggregation Protocol (PAgP). If you prefer to statically configure EtherChannel, there is the on option as well. Table 6-2 identifies which options can be configured on each switch to success-fully form an EtherChannel. + +■ Inappropriate EtherChannel distribution algorithm: EtherChannel determines which physical link to use to transmit frames based on a hash calculation. The hash-ing approach selected should distribute the load fairly evenly across all physical links. For example, a hash calculation might be based only on the destination MAC address of a frame. If the frames are destined for only a few different MAC address- +es, the load distribution could be uneven. + + + +Table 6-2 +Key Topic + + +Options for Successfully Forming an EtherChannel + +SW1 + + + +MODE PAgP Desirable + +PAgP Auto LACP Active + +LACP On Passive + +PAgP Yes Yes No No No Desirable + +SW2 PAgP Auto Yes No No No No + +LACP No No Active + +LACP No No Passive + +On No No + + +Yes Yes No + +Yes No No + +No No Yes + + + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 239 + +Verifying an EtherChannel bundle is done with the show etherchannel summary com-mand, as shown in Example 6-47. With this output, you can verify the group number, the logical port channel number for the group, the status of the port channel, the protocol that was used, the ports in the bundle, and the status of the ports. In this example, the logical port channel is port channel 1, it is a Layer 3 port channel, and it is in use (as indicated by the RU). This is what you want to see; if you see any other combination, it means that you have a misconfiguration that is preventing the port channel from going up. Link Aggregation Control Protocol (LACP) was used as the protocol in this example, and Gig1/0/5 and 1/0/6 are bundled in the port channel, as indicated by the P. Again, +you want to see P listed by the ports; if you see anything else, it means that you have a configuration issue that is preventing the port from being bundled. The only other option I would like to see beside the ports is H, which is used with LACP when you have more than eight ports in the bundle. When you have more than eight ports with LACP, the additional ports are placed in the standby state and used only if one of the main eight go down. + +Example 6-47 Output of show etherchannel summary + +SW1#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(RU) LACP Gi1/0/5(P) Gi1/0/6(P) + + +Layer 3 EtherChannel Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 6-9. + + + + + + + +From the Library of Outcast Outcast +240 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + +Core + + + + + +Gi1/0/5 +SW1 Gi1/0/6 + +Gi1/0/5 +Gi1/0/6 SW2 + +Gi1/0/1 Layer 3 EtherChannel Gi1/0/2 + + +Gi0/1 Gi0/2 + +Fa0/1 + + + + + +Figure 6-9 EtherChannel Trouble Tickets Topology + + +Trouble Ticket 6-6 + +Problem: A junior network administrator has approached you indicating that the Layer 3 EtherChannel they are trying to form between SW1 and SW2 is not forming. You need to solve this issue for them. + +Your first step is to verify the EtherChannel configuration on SW1 and SW2 using the show etherchannel summary command, as shown in Example 6-48 and Example 6-49. Reviewing the flags on SW1 in Example 6-48 indicates that the ports are in standalone and that the port channel is Layer 2 down. Reviewing the flags on SW2 in Example 6-49 indicates that ports are suspended and that the port channel is Layer 3 down. Do you see the issue? + +Example 6-48 SW1 show etherchannel summary Output + +SW1#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 241 + +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(SD ) LACP Gi1/0/5(I) Gi1/0/6(I) + + +Example 6-49 SW2 show etherchannel summary Output + +SW2#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(RD ) LACP Gi1/0/5(s) Gi1/0/6(s) + +It appears that our junior network administrator failed to create a Layer 3 EtherChannel on SW1. If you recall, to create a Layer 3 EtherChannel, the physical ports and the port channel must be routed ports. Therefore, the junior network administrator forgot the no switchport command on SW1, as shown in Example 6-50. + +Example 6-50 SW1 show run interface Output + +SW1#show run int gig 1/0/5 +! +interface GigabitEthernet1/0/5 +switchport trunk encapsulation dot1q +switchport mode trunk +switchport nonegotiate +channel-group 1 mode active +end +SW1#show run int gig 1/0/6 +! +interface GigabitEthernet1/0/6 + + + + +From the Library of Outcast Outcast +242 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +switchport trunk encapsulation dot1q +switchport mode trunk +switchport nonegotiate +channel-group 1 mode active +end +SW1#show run int port-channel 1 +! +interface Port-channel1 +end + +To solve this issue, you need to remove the port channel and channel group configura-tion from SW1, convert Gig1/0/5 and Gig1/0/6 to routed ports with the no switchport command, and then issue the channel-group mode command on Gig1/0/5 and Gig1/0/6, which will create the bundle and the Layer 3 port channel. Example 6-51 confirms that the Layer 3 EtherChannel bundle is now formed. Notice how the ports are bundled in the port channel and that the port channel is Layer 3 in use. + +Example 6-51 SW1 and SW2 show etherchannel summary Output + +SW1#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(RU) LACP Gi1/0/5(P) Gi1/0/6(P) +! +SW2#show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 243 + +Number of channel-groups in use: 1 +Number of aggregators: 1 + +Group Port-channel Protocol Ports +------+-------------+-----------+-------------------------------------- +1 Po1(RU ) LACP Gi1/0/5(P) Gi1/0/6(P) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +244 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 6-3 lists a reference of these key topics and the page +numbers on which each is found. + + +Table 6-3 Key Topics for Chapter 6 Key +Topic Key Topic Element Description Page Number + + +Example 6-1 + +Example 6-2 + +List + +Example 6-17 + +Example 6-18 + +List + +Example 6-40 + +Paragraph + +List + +Table 6-2 + +show run command output from R1 212 + +show run command output from SW1 213 + +Describes issues that prevent inter-VLAN routing 213 from functioning with the router-on-a-stick approach +SW1 SVI configuration 222 + +Verifying the status of an SVI 223 + +Identifies the elements that must be true for an SVI 224 to be up +Configuration for routed ports on a Layer 3 switch 234 + +Identifies how to verify whether the port is a Layer 2 236 switchport or a routed port +Describes the common Layer 3 EtherChannel 237 troubleshooting targets +Options for successfully forming an EtherChannel 238 + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +Layer 3 switch, router-on-a-trunk/router-on-a-stick, switched virtual interface (SVI), rout-ed port, Layer 3 EtherChannel + + + + + + + +From the Library of Outcast Outcast +Chapter 6: Troubleshooting Inter-VLAN Routing and Layer 3 EtherChannels 245 + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + +Show Command Reference to Check Your Memory + +This section includes the show commands introduced in this chapter. It does not include the show commands that were used in this chapter but introduced in previous chapters. You will need to return to the previous chapters to review information relating to those show commands. + +To test your memory of the commands, cover the right side of Table 6-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a networking professional. Therefore, you should be able to identify the show commands needed to successfully troubleshoot the topics presented in this chapter. + + +Table 6-4 + +Task + + +show Commands Introduced in Chapter 6 + +Command Syntax + + + +Displays the VLANs that are associated with a router’s subinterfaces, in addition to the trunk encapsulation method used on router’s subinterfaces. +Displays the Layer 1 and Layer 2 status of an SVI on an MLS along with the IP address, +subnet mask, and MAC address associated with it. + +show vlans + + + +show interfaces [vlan {vlan-id}] + +If IPv4 routing is enabled on a Layer 3 switch, it show ip route displays the contents of the IPv4 routing table. + +Identifies if a switchport is operating as a Layer 2 switchport or a Layer 3 routed port. + +Displays the status of port channels, in addition to the status of the ports within the port channel. + + +show interfaces interface_type interface_ number switchport +show etherchannel summary + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting Port Security: This section covers the various reasons why port security might not be performing as expected and how you can trouble-shoot them. + +■ Port Security Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. + +■ Troubleshooting Spoof-Prevention Features: This section explains the purpose of DHCP Snooping, Dynamic ARP Inspection, and IP Source Guard. In addition, you will learn what could cause these features not to perform as expected and how to troubleshoot them. + +■ Spoof-Prevention Features Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting pro-cess to solve a reported problem. + +■ Troubleshooting Layer 2 Access Control: This sec-tion examines how to troubleshoot misconfigura-tions related to protected ports, private VLANs, and VLAN Access Control Lists. + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 7 + + + + +Troubleshooting Switch Security Features + + +By default, switches are designed to provide connectivity. Therefore, out of the box, min-imal security is applied. You can improve switch security by implementing features such as port security, DHCP snooping, dynamic Address Resolution Protocol (ARP) inspec-tion, and IP Source Guard. In addition, by default, all traffic within a VLAN is free to flow between the switchports in the same VLAN. This might not be desired. Therefore, you can control the flow of traffic within the same VLAN with features such as protect-ed ports, private VLANs, and VLAN access control lists (ACLs). + +However, with these added features comes additional issues related to them that you will need to be able to troubleshoot. This chapter covers all these features and explores the various reasons why you may be experiencing issues and how you can troubleshoot them. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 7-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 7-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting Port Security + +Troubleshooting Spoof-Prevention Features + +Troubleshooting Layer 2 Access Control + +Questions +1–3 + +4–8 + +9–10 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + + + +From the Library of Outcast Outcast +248 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +1. Which command enables you to verify the port status of a port security-enabled port? + +a. show port-security + +b. show port-security interface interface_type interface_number + +c. show port-security address + +d. show running-configuration + +2. Which two of the following port security violation modes will generate a log mes-sage when a violation occurs? + +a. Protect + +b. Restrict + +c. Shutdown + +d. Disabled + +3. Which two commands identify the ports that are in the err-disabled state if the err-disable recovery feature has not been enabled for port security? + +a. show running-configuration + +b. show interfaces + +c. show interfaces status + +d. show port-security address + +4. What must be true for DHCP snooping to operate successfully? (Choose two.) + +a. It must be enabled globally. + +b. It must be enabled for specific VLANs. + +c. The ports going to end stations must be configured as trusted. + +d. The ports going to the DHCP servers need to be configured as untrusted. + +5. Which command enables you to verify the IP address that has been given to each client from the DHCP server along with the interface they are connected to and the VLAN the interface is a member of? +a. show ip dhcp snooping + +b. show ip dhcp snooping binding + +c. show ip dhcp snooping database + +d. show ip dhcp snooping statistics + + + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 249 + +6. What must be true for dynamic ARP inspection to operate successfully? (Choose two answers.) + +a. DHCP snooping must be enabled globally. + +b. DHCP snooping must be enabled for specific VLANs. + +c. IP ARP inspection must be enabled for specific VLANs. + +d. All interfaces, except for upstream interfaces, need to be configured as trusted interfaces. + +7. How does IP Source Guard learn where valid source IPs are in the network? + +a. ARP cache + +b. MAC address table + +c. DHCP snooping database + +d. Routing table + +8. Which command enables you to verify which interfaces have been configured with IP Source Guard? + +a. show ip arp + +b. show ip verify source + +c. show interfaces status + +d. show ip dhcp snooping binding + +9. Which two of the following statements are true about PVLANs? + +a. Community ports cannot communicate with other community ports in the same community. + +b. Community ports can communicate with other community ports in a different community. + +c. Community ports cannot communicate with isolated ports and vice versa. + +d. Isolated ports cannot communicate with other isolated ports. + +10. Which of the following has the ability to deny only FTP traffic between two devices in the same VLAN? + +a. IP Source Guard + +b. Protected ports + +c. Private VLANs + +d. VLAN ACL + + + + + + +From the Library of Outcast Outcast +250 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting Port Security + +The port security feature is designed to control a specific set/number of MAC addresses that will be learned on an interface. This helps to eliminate CAM table flooding attacks, where a malicious user attempts to overflow the CAM table by populating it with a +large number of bogus MAC addresses. In addition, it ensures that only specific devices (based on MAC address) can connect to certain switchports. Therefore, port security is a must for all organizations to implement. However, as with all services and features, if +something goes wrong, you will be troubleshooting. This section shows you how to iden-tify and troubleshoot port security issues. + +Common Port Security Issues + +Usually, port security will perform as expected with minimal issues. If an attack occurs, port security kicks in; if not, port security keeps waiting. Most issues arise from miscon-figurations. The following is a listing of issues that may occur when working with port +security: + +■ Port security is configured but not enabled. +Key +Topic ■ A static MAC address was not configured correctly. + +■ The maximum number of MAC addresses has been reached, preventing access. + +■ Legitimate users are being blocked because of a violation. + +■ Running configuration not saved to startup configuration. + + +Port Security Configured but Not Enabled + +Example 7-1 provides a port security configuration on interface Fast Ethernet 0/1 of an access layer switch. Notice that all commands start with switchport port-security. However, if you fail to include the command switchport port-security (which is high-lighted), port security is not enabled on the interface regardless of the rest of the con-figuration specified. + +Example 7-1 Sample Port Security Configuration + +SW1#show running-config interface fastEthernet 0/1 +Building configuration... + +Current configuration : 456 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 251 + +switchport mode access +switchport port-security maximum 2 +switchport port-security +switchport port-security violation restrict +switchport port-security mac-address sticky +switchport port-security mac-address sticky 0050.b607.657a +switchport port-security mac-address 0800.275d.06d6 + +Use the commands show port-security and show port-security interface interface_type interface_number to verify whether port security is enabled on an interface, as shown in Example 7-2. In this case, Fast Ethernet 0/1 is enabled for port security. + +Example 7-2 Verifying Port Security Is Enabled on an Interface Key +Topic SW1#show port-security + +Secure Port MaxSecureAddr +(Count) + +CurrentAddr +(Count) + +SecurityViolation Security Action +(Count) + +--------------------------------------------------------------------------- +Fa0/1 2 2 0 Restrict +--------------------------------------------------------------------------- +Total Addresses in System (excluding one mac per port) : 1 +Max Addresses limit in System (excluding one mac per port) : 8192 + +ASW1#show port-security interface fastEthernet 0/1 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-up +: Restrict +: 0 mins +: Absolute + +SecureStatic Address Aging : Disabled + +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: 2 +: 2 +: 0 +: 2 +: 0800.275d.06d6:10 +: 0 + + + +Static MAC Address Not Configured Correctly + +If you have implemented port security by defining MAC addresses statically, it is impera-tive that they are accurate. If a user complains that he cannot access the network after receiving a new computer and your network relies on static port security addresses, you more than likely forgot to change the port security static MAC address. Example 7-3 identifies the static MAC address configuration for 0800.275d.06d6. + + + + + + +From the Library of Outcast Outcast +252 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 7-3 Sample Static MAC Address Port Security Configuration + +SW1#show running-config interface fastEthernet 0/1 +Building configuration... + +Current configuration : 456 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +switchport port-security maximum 2 +switchport port-security +switchport port-security violation restrict +switchport port-security mac-address sticky +switchport port-security mac-address sticky 0050.b607.657a +switchport port-security mac-address 0800.275d.06d6 + +Using the show port-security address command reveals the static MAC address con-figured for the interfaces, as shown in Example 7-4. In this example, the MAC address 0800.275d.06d6 is a statically configured (SecureConfigured) port security MAC address for Fa0/1 and VLAN 10. You need to compare this to the MAC address of the PC con-nected to the port with the ipconfig /all command, as shown in Example 7-5. (This is where accurate documentation is helpful.) The show port-security address command will also identify the dynamically learned port security MAC addresses and the sticky secure MAC addresses. + +Example 7-4 Verifying Static Addresses Associated with Interfaces Key +Topic SW1#show port-security address +Secure Mac Address Table +----------------------------------------------------------------------------- + +Vlan Mac Address + +---- ----------- +10 0050.b607.657a +10 0800.275d.06d6 + +Type + +---- +SecureSticky +SecureConfigured + +Ports Remaining Age +(mins) +----- ------------- +Fa0/1 - +Fa0/1 - + +----------------------------------------------------------------------------- +Total Addresses in System (excluding one mac per port) : 1 +Max Addresses limit in System (excluding one mac per port) : 8192 + + +Example 7-5 Verifying MAC Address of PC. + +PC1#ipconfig /all +Windows IP Configuration + +Host Name . . . . . . . . . . . . : pc1 +Primary Dns Suffix . . . . . . . : +Node Type . . . . . . . . . . . . : Broadcast + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 253 + +IP Routing Enabled. . . . . . . . : No +WINS Proxy Enabled. . . . . . . . : No + +Ethernet adapter PC1 Lab: + +Connection-specific DNS Suffix . : +Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapter +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +Dhcp Enabled. . . . . . . . . . . : No +...output omitted... + + +Maximum Number of MAC Addresses Reached + +By default, when port security is enabled, only one MAC address will be allowed. Therefore, if you need more than one MAC address, you have to specify the number with the switchport port-security maximum number command, as shown in Example 7-6. +In this case, the maximum number was set to 2 so that two devices could communicate through the interface. + +Example 7-6 Identifying the Maximum Number of MAC Addresses Allowed + +SW1#show running-config interface fastEthernet 0/1 +Building configuration... + +Current configuration : 456 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +switchport port-security maximum 2 +switchport port-security +switchport port-security violation restrict +switchport port-security mac-address sticky +switchport port-security mac-address sticky 0050.b607.657a +switchport port-security mac-address 0800.275d.06d6 + +You can verify the maximum number of MAC addresses allowed on an interface with the show port-security and show port-security interface interface_type interface_number commands. As shown in Example 7-7, two MACs are allowed, and two have been learned. + +Example 7-7 Identifying the Maximum Number of MAC Addresses Allowed + +SW1#show port-security + +Secure Port MaxSecureAddr +(Count) + +CurrentAddr +(Count) + +SecurityViolation Security Action +(Count) + +--------------------------------------------------------------------------- +Fa0/1 2 2 0 Restrict + + + + +From the Library of Outcast Outcast +254 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +--------------------------------------------------------------------------- +Total Addresses in System (excluding one mac per port) : 1 +Max Addresses limit in System (excluding one mac per port) : 8192 + +SW1#show port-security interface fastEthernet 0/1 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-up +: Restrict +: 0 mins +: Absolute + +SecureStatic Address Aging : Disabled + +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: 2 +: 2 +: 1 +: 1 +: 0800.275d.06d6:10 +: 0 + + + +Legitimate Users Being Blocked Because of Violation + +You need to make sure that you have the correct number of MAC addresses specified. If the number is not correct, a violation will occur if more than the specified number of +MAC addresses are seen on the port. The violation will occur regardless of the additional MAC addresses being accidental or malicious. Three different violations exist: + + +■ +Key Topic + +■ + + +■ + +Protect: Any frame from the MAC addresses in violation is dropped without a noti-fication, and the violation count is not incremented. + +Restrict: Any frame from the MAC addresses in violation is dropped, and log mes-sages are generated. + +Shutdown: When a violation occurs, the port is placed in the err-disabled state, and any frame from any MAC address will be dropped. In addition, log messages will be +generated. + + + +Tip You can remember that these get more severe in alphabetic order (P/R/S) (drop/ drop&alert/shutdown&alert). + + +You can verify whether there is a violation by using the show port-security and show port-security interface interface_type interface_number commands, as shown in Example 7-8. In this case, there is currently no violation. However, if there were, the security violation count would increment, and because the violation mode is Restrict, any frame from the MAC addresses in violation is dropped, and log messages are generated. + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 255 + +Example 7-8 Identifying Security Violations + +SW1#show port-security + +Secure Port MaxSecureAddr +(Count) + +CurrentAddr +(Count) + +SecurityViolation Security Action +(Count) + +--------------------------------------------------------------------------- +Fa0/1 2 2 0 Restrict +--------------------------------------------------------------------------- +Total Addresses in System (excluding one mac per port) : 1 +Max Addresses limit in System (excluding one mac per port) : 8192 + +SW1#show port-security interface fastEthernet 0/1 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-up +: Restrict +: 0 mins +: Absolute + +SecureStatic Address Aging : Disabled + +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: 2 +: 2 +: 1 +: 1 +: 0800.275d.06d6:10 +: 0 + + +If the violation mode is set to shutdown, as shown in Example 7-9, and a violation occurs, the port status is Secure-shutdown and placed in the err-disable state, as dis-played in the following syslog messages: +%PM-4-ERR_DISABLE: psecure-violation error detected on Fa0/1, putting Fa0/1 in err-disable state + +%PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0800.27a2.ce47 on port FastEthernet0/1. + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down + +%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down + +Example 7-9 Example Port That Has Been Shut Down and Placed in the Err-Disable State + +SW1#show port-security interface fastEthernet 0/1 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-shutdown +: Shutdown +: 0 mins +: Absolute + + + + + +From the Library of Outcast Outcast +256 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +SecureStatic Address Aging : Disabled + +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: 2 +: 2 +: 1 +: 1 +: 0800.27a2.ce47:10 +: 1 + + + + +Key Topic + +To verify ports that are in the err-disabled state, use the command show interfaces status, as shown in Example 7-10. You can also use the show interface interface_type interface_number command. As you can see, Fa0/1 is in the err-disabled state. However, it does not tell you what caused the err-disabled state. Example 7-11 displays all the dif-ferent services that can cause a port to go into the err-disabled state. Notice that they are +all enabled by default and that port security is one of them (psecure-violation). + + +Example 7-10 Identifying Ports in the Err-Disabled State + +SW1#show interfaces status + +Port Name Status Vlan Duplex Speed Type +Fa0/1 err-disabled 10 auto auto 10/100BaseTX + +Fa0/2 +Fa0/3 +Fa0/4 +Fa0/5 +Fa0/6 +...output omitted... + +connected 10 +notconnect 1 +notconnect 1 +notconnect 1 +notconnect 1 + +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX + + +SW1#show interfaces fastEthernet 0/1 +FastEthernet0/1 is down, line protocol is down (err-disabled) +Hardware is Fast Ethernet, address is 081f.f34e.b801 (bia 081f.f34e.b801) + + +Example 7-11 Identifying Which Services Are Enabled for Err-Disable + + +SW1#show errdisable detect +ErrDisable Reason +----------------- +arp-inspection +bpduguard +channel-misconfig (STP) +community-limit +dhcp-rate-limit +dtp-flap +gbic-invalid +iif-reg-failure +inline-power +invalid-policy + + +Detection Mode +--------- ---- +Enabled port +Enabled port +Enabled port +Enabled port +Enabled port +Enabled port +Enabled port +Enabled port +Enabled port +Enabled port + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 257 + + +link-flap +loopback +lsgroup +mac-limit +pagp-flap +port-mode-failure +pppoe-ia-rate-limit +psecure-violation +security-violation +sfp-config-mismatch +sgacl_limitation +small-frame +storm-control +udld +vmps +psp + +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled +Enabled + +port +port +port +port +port +port +port +port/vlan +port +port +port +port +port +port +port +port + + + + +Key Topic + +The best way to determine why a port is in the err-disabled state is to review syslog mes-sages. They are listed as severity level 4, and the mnemonic is ERR-DISABLE. In this case, +the message text clearly states it was caused by a port security violation. + + +%PM-4-ERR_DISABLE: psecure-violation error detected on Fa0/1, putting Fa0/1 in err-disable state + + +Tip If for some reason you do not have access to the syslog messages, bounce (shut/ noshut) the interface that is err-disabled. By doing so, after the interface is enabled, the error will be detected again, which will generate a syslog message. Make sure that logging to the console or terminal lines is enabled, and do not forget about the terminal monitor command if you are using Telnet or Secure Shell (SSH). This process is shown in Example 7-12, and you can see that the port was err-disabled due to a port security violation. + + +Example 7-12 Bouncing the Interface to Determine Why It Is Err-Disabled + +SW1#config t +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)#interface fastEthernet 0/1 +SW1(config-if)#shut +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down +SW1(config-if)#no shut +%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up +%PM-4-ERR_DISABLE: psecure-violation error detected on Fa0/1, putting Fa0/1 in err-disable state +SW1(config-if)# +%PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address 0800.27a2.ce47 on port FastEthernet0/1. +SW1(config-if)# +%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down + + +From the Library of Outcast Outcast +258 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Key Topic + +If you are relying on the err-disable recovery feature to enable interfaces once the viola-tion is no longer detected, you can verify the status of the feature with the show errdis-able recovery command, as shown in Example 7-13. Notice that the err-disable recovery feature is disabled by default for all the different services and features. Therefore, if you +need to use it, it has to be manually enabled by you. + + +Example 7-13 Verifying the Err-Disable Recovery Feature + +SW1#show errdisable recovery + +ErrDisable Reason +----------------- +arp-inspection +bpduguard +channel-misconfig (STP) +dhcp-rate-limit +dtp-flap +gbic-invalid +inline-power +link-flap +mac-limit +loopback +pagp-flap +port-mode-failure +pppoe-ia-rate-limit +psecure-violation +security-violation +sfp-config-mismatch +small-frame +storm-control +udld +vmps +psp + +Timer Status +-------------- +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled + + +Timer interval: 300 seconds + +Interfaces that will be enabled at the next timeout: + +To enable err-disable recovery for a specific feature or service, issue the errdisable recov-ery cause service/feature global configuration command, as shown in Example 7-14. This example displays all the different options available on a Catalyst 2960 switch. + +Example 7-14 Enabling the Err-Disable Recovery Feature + +SW1(config)#errdisable recovery cause ? + +all +arp-inspection + +bpduguard + +Enable timer to recover from all error causes +Enable timer to recover from arp inspection error +disable state +Enable timer to recover from BPDU Guard error + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 259 + + +channel-misconfig (STP) +dhcp-rate-limit +dtp-flap +gbic-invalid +inline-power +link-flap +loopback +mac-limit +pagp-flap +port-mode-failure + +pppoe-ia-rate-limit + +psecure-violation +psp +security-violation +sfp-config-mismatch + +small-frame +storm-control +udld +vmps + +Enable timer to recover from channel misconfig error +Enable timer to recover from dhcp-rate-limit error +Enable timer to recover from dtp-flap error +Enable timer to recover from invalid GBIC error +Enable timer to recover from inline-power error +Enable timer to recover from link-flap error +Enable timer to recover from loopback error +Enable timer to recover from mac limit disable state +Enable timer to recover from pagp-flap error +Enable timer to recover from port mode change +failure +Enable timer to recover from PPPoE IA rate-limit +error +Enable timer to recover from psecure violation error +Enable timer to recover from psp +Enable timer to recover from 802.1x violation error +Enable timer to recover from SFP config mismatch +error +Enable timer to recover from small frame error +Enable timer to recover from storm-control error +Enable timer to recover from udld error +Enable timer to recover from vmps shutdown error + + +When using the err-disable recovery feature, you have an extra piece of information you can use. Suppose, for instance, that you enable it for port security. At the bottom of the show errdisable recovery output, information identifies what interface is err-disabled and why, as shown in Example 7-15. This makes it easier for you to troubleshoot what caused the port to be err-disabled. It also indicates how much time is left until the port is automatically enabled. If the violation still exists at that point, it will be err-disabled again. + +Example 7-15 Verifying the Err-Disable Reason + +SW1#show errdisable recovery + +ErrDisable Reason +----------------- +arp-inspection +bpduguard +channel-misconfig (STP) +dhcp-rate-limit +dtp-flap +gbic-invalid +inline-power +link-flap +mac-limit +loopback +pagp-flap + +Timer Status +-------------- +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled + + + + +From the Library of Outcast Outcast +260 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +port-mode-failure +pppoe-ia-rate-limit +psecure-violation +security-violation +sfp-config-mismatch +small-frame +storm-control +udld +vmps +psp + +Disabled +Disabled +Enabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled +Disabled + + +Timer interval: 300 seconds + +Interfaces that will be enabled at the next timeout: + + +Interface +--------- +Fa0/1 + +Errdisable reason +----------------- +psecure-violation + +Time left(sec) +-------------- +85 + + + +Running Configuration Not Saved to Startup Configuration + +This is pretty obvious: If you fail to save the running configuration to the NVRAM, the port security configuration will no longer be available when the switch reboots. However, many administrators who use the port security sticky feature forget about saving the configuration when a new PC is added. The sticky feature allows the switch to dynami-cally learn MAC addresses and then place the MAC address in the configuration just like they had been statically configured. Example 7-16 displays the port security sticky con-figuration on a switch. Notice how the sticky feature was enabled with the switchport port-security mac-address sticky command. Once the MAC address 0050.b607.657a was learned by the switch on interface Fast Ethernet 0/1, the switch placed it in the configura-tion with the switchport port-security mac-address sticky 0050.b607.657a command. You now need to save the configuration; otherwise, the sticky-learned MAC address will not be in the configuration if the switch reboots. + +Example 7-16 Port Security Sticky Configuration + +SW1#show running-config interface fastEthernet 0/1 +Building configuration... + +Current configuration : 456 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +switchport port-security maximum 2 +switchport port-security + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 261 + +switchport port-security violation restrict +switchport port-security mac-address sticky +switchport port-security mac-address sticky 0050.b607.657a +switchport port-security mac-address 0800.275d.06d6 + + +Port Security Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 7-1. + +VLAN 10 + +PC1 +Fa0/1 +Gi0/1 + +SW1 +Fa0/2 PC2 + + +Figure 7-1 Port Security Trouble Ticket Topology + + +Trouble Ticket 7-1 + +Problem: It is Monday morning, and the user on PC1 has called you indicating that she is not able to access any network resources. + +You ask her when the last time it was that she was able to access resources. She indicates that it was 2 weeks ago, before she went on vacation. This leads you to examine the change control documentation to determine whether any configuration changes were done in the past 2 weeks. You notice that port security was added to all access ports on SW1. Therefore, you decide to start your troubleshooting process by examining the port security configuration on SW1. + +According to documentation, PC1 is connected to Fa0/1. You issue the command show port-security, as shown in Example 7-17, and notice that Fa0/1 is enabled for port secu-rity and that there is a security violation count of 1. + +Example 7-17 Verifying Port Security on Fa0/1 + +SW1#show port-security + +Secure Port MaxSecureAddr +(Count) + +CurrentAddr +(Count) + +SecurityViolation Security Action +(Count) + +--------------------------------------------------------------------------- + +Fa0/1 2 2 +Fa0/2 2 2 + +1 Shutdown +0 Shutdown + + + + +From the Library of Outcast Outcast +262 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Fa0/3 2 0 +Fa0/4 2 0 +Fa0/5 2 0 +Fa0/6 2 0 +Fa0/7 2 0 +Fa0/8 2 0 +Fa0/9 2 0 +Fa0/10 2 0 +Fa0/11 2 0 +Fa0/12 2 0 +Fa0/13 2 0 +Fa0/14 2 0 +Fa0/15 2 0 +Fa0/16 2 0 +Fa0/17 2 0 +Fa0/18 2 0 +Fa0/19 2 0 +Fa0/20 2 0 +Fa0/21 2 0 +Fa0/22 2 0 +Fa0/23 2 0 +Fa0/24 2 0 + +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown +0 Shutdown + +--------------------------------------------------------------------------- +Total Addresses in System (excluding one mac per port) : 2 +Max Addresses limit in System (excluding one mac per port) : 8192 + +To verify the status of port security for Fa0/1 you issue the command show port-securi-ty interface fastEthernet 0/1, as shown in Example 7-18. Port security is enabled but it is in the Secure-shutdown state. The last MAC address that was received on the interface was 0800.275d.06d6 for VLAN 10. + +Example 7-18 Verifying Port Security Status on Fa0/1 + +SW1#show port-security interface fastEthernet 0/1 + +Port Security +Port Status +Violation Mode +Aging Time +Aging Type + +: Enabled +: Secure-shutdown +: Shutdown +: 0 mins +: Absolute + +SecureStatic Address Aging : Disabled + +Maximum MAC Addresses +Total MAC Addresses +Configured MAC Addresses +Sticky MAC Addresses +Last Source Address:Vlan +Security Violation Count + +: 2 +: 2 +: 2 +: 0 +: 0800.275d.06d6:10 +: 1 + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 263 + +Next you issue the show run interface fa0/1 command to verify the port security con-figuration on Fa0/1. As shown in Example 7-19, it has been enabled, the maximum MAC addresses is set to 2, and there are 2 MAC addresses configured (one for the phone and one for PC1). + +Example 7-19 Verifying Port Security Configuration on Fa0/1 + +SW1#show run interface fa0/1 +Building configuration... + +Current configuration : 352 bytes +! +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +switchport port-security maximum 2 +switchport port-security +switchport port-security mac-address 0050.b607.657a +switchport port-security mac-address 0800.275d.06d7 +no lldp transmit +spanning-tree portfast +spanning-tree bpduguard enable +spanning-tree guard root +end + +You decide to confirm the MAC addresses of the IP Phone and PC1. Starting with the PC, you issue the ipconfig /all command, as shown in Example 7-20. The MAC address of PC1 is 08-00-27-5D-06-D6, which happens to be the same MAC address that caused the violation shown in Example 7-18. Comparing the MAC address of PC1 to the addresses statically configured on Fa0/1, as shown in Example 7-19, confirms that PC1s MAC address is not one of the addresses configured. + +Example 7-20 Reviewing the MAC Address on PC1 + +C:\>ipconfig /all + +Windows IP Configuration + +Host Name . . . . . . . . . . . . : pc1 +Primary Dns Suffix . . . . . . . : +Node Type . . . . . . . . . . . . : Broadcast +IP Routing Enabled. . . . . . . . : No +WINS Proxy Enabled. . . . . . . . : No + +Ethernet adapter PC1 Lab: + +Connection-specific DNS Suffix . : +Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapter + + + +From the Library of Outcast Outcast +264 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +Dhcp Enabled. . . . . . . . . . . : Yes +Autoconfiguration Enabled . . . . : Yes +Autoconfiguration IP Address. . . : 169.254.180.166 +Subnet Mask . . . . . . . . . . . : 255.255.0.0 +...output omitted... + +After confirming that the IP Phone’s MAC address is 0050.b607.657a, you conclude that the command switchport port-security mac-address 0050.b607.657a is correct but that the command switchport port-security mac-address 0800.275d.06d7 is not correct. It appears that the static MAC address was misconfigured with a 7 at the end rather than a 6. + +You proceed to remove the incorrect static MAC address with the no switchport port-security mac-address 0800.275d.06d7 command and replace it with the MAC address of PC1. Example 7-21 provides the configuration that is needed to solve the issue. + +Example 7-21 Solving the Issue by Configuring the Correct Static MAC Address + +SW1#config t +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)#interface fastEthernet 0/1 +SW1(config-if)#no switchport port-security mac-address 0800.275d.06d7 +SW1(config-if)#switchport port-security mac-address 0800.275d.06d6 + +You confirm the port is still in the err-disabled state with the show interfaces status command. The output shown in Example 7-22 confirms it is. To recover from the err-disabled state, you bounce the interface by issuing the shutdown and then no shutdown commands. + +Example 7-22 Confirming Fa0/1 is in the Err-Disabled State + +SW1#show interfaces status + +Port Name Status Vlan Duplex Speed Type +Fa0/1 err-disabled 10 auto auto 10/100BaseTX + +Fa0/2 +Fa0/3 +Fa0/4 +...output omitted... + +connected 10 +notconnect 1 +notconnect 1 + +a-full a-100 10/100BaseTX +auto auto 10/100BaseTX +auto auto 10/100BaseTX + + +The interface successfully goes up/up, and you receive the following syslog messages: + +%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up +You confirm the problem is solved by accessing PC1 and pinging the default gateway at 10.1.1.1. It is successful, as shown in Example 7-23. The issue has been solved. + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 265 + +Example 7-23 Successful Ping from PC1 to Default Gateway + +C:\>ping 10.1.1.1 + +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Troubleshooting Spoof-Prevention Features + +Features such as DHCP snooping, dynamic ARP inspection, and IP Source Guard are designed to protect your network from spoofing attacks against the Dynamic Host Configuration Protocol (DHCP) service, ARP, and IP addressing. This section explains what you should look for while troubleshooting these three security features. + +DHCP Snooping + +To prevent rogue DHCP servers from handing out IP addresses in your network, you can implement DHCP snooping. With DHCP snooping, you can define which interfaces will accept all DHCP messages and which interfaces will accept only Discover and Request DHCP messages. DHCP snooping also creates a binding table that keeps track of which devices are connected to which interfaces based on the IP addresses that were handed out by the DHCP server. This comes in handy with DAI and IP Source Guard, as you will see later. + +Take a moment to examine Example 7-24, which displays a sample DHCP snooping con-figuration. What is required for DHCP snooping to operate successfully? Let’s make a list: + +■ DHCP snooping is enabled globally with the ip dhcp snooping command. +Key +Topic ■ DHCP snooping is enabled for specific VLANs with the ip dhcp snooping vlan com- +mand. + +■ Interfaces that need to accept all DHCP message types are configured as trusted with the ip dhcp snooping trust command. + +■ All other interfaces need to be untrusted, which is the default. + +■ If the DHCP server does not support option 82 it needs to be disabled on the switch with the no ip dhcp snooping information option command. + + + + + +From the Library of Outcast Outcast +266 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 7-24 Sample DHCP Snooping Configuration + +SW1#show run +...output omitted... +ip dhcp snooping vlan 10 +no ip dhcp snooping information option +ip dhcp snooping +...output omitted... +interface GigabitEthernet0/1 +ip dhcp snooping trust +interface GigabitEthernet0/2 +ip dhcp snooping trust +...output omitted... + +To verify DHCP snooping, use the show ip dhcp snooping command, as shown in Example 7-25. You can verify whether it is enabled globally with the line that states Switch DHCP snooping is enabled. You can verify which VLANs are enabled and operational for DHCP snooping. In this case, it is only VLAN 10. You can verify whether option 82 is enabled or disabled. Finally, you can verify which interfaces are trusted, which interfaces are untrusted, and which interfaces have a DHCP rate limit applied. In this case, Gigabit Ethernet 0/1 and 0/2 are trusted interfaces, and all other interfaces that are not listed are automatically untrusted. + +Example 7-25 Verifying DHCP Snooping Key +Topic SW1#show ip dhcp snooping +Switch DHCP snooping is enabled +DHCP snooping is configured on following VLANs: +10 +DHCP snooping is operational on following VLANs: +10 +DHCP snooping is configured on the following L3 Interfaces: + +Insertion of option 82 is disabled +circuit-id default format: vlan-mod-port +remote-id: 081f.f34e.b800 (MAC) +Option 82 on untrusted port is not allowed +Verification of hwaddr field is enabled +Verification of giaddr field is enabled +DHCP snooping trust/rate is configured on the following Interfaces: + + +Interface +----------------------- +GigabitEthernet0/1 +Custom circuit-ids: +GigabitEthernet0/2 +Custom circuit-ids: + +Trusted +------- +yes + +yes + +Allow option +------------ +yes + +yes + +Rate limit (pps) +---------------- +unlimited + +unlimited + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 267 + +To verify the bindings in the DHCP snooping database, issue the show ip dhcp snooping bindings command, as shown in Example 7-26. In this example, the PC with the MAC address 08:00:27:5D:06:D6 is located out Fast Ethernet 0/1, which is part of VLAN 10, and has been assigned the IP address 10.1.1.10 from a DHCP server. + +Example 7-26 Verifying DHCP Snooping Bindings Key +Topic SW1#show ip dhcp snooping binding + +MacAddress +-------------------- +08:00:27:5D:06:D6 + +IpAddress +-------------- + +10.1.1.10 + +Lease(sec) +---------- + +67720 + +Type +------------- + +dhcp-snooping + +VLAN Interface +---- -------------- + +10 FastEthernet0/1 + +Total number of bindings: 1 + + +Dynamic ARP Inspection + +Dynamic ARP inspection (DAI) is used to prevent ARP spoofing attacks. It relies on DHCP snooping and the binding table that is created by it. Because of this, you need to be able to troubleshoot DHCP snooping issues when dealing with DAI issues. In addition, you have to be able to troubleshoot the commands related to DAI. Refer to Example 7-27. For DAI to function, it needs to be enabled per VLAN with the ip arp inspection vlan command. In addition, interfaces where DAI should not be performed (where there are +no DHCP snooping bindings) need to be configured as trusted interfaces with the ip arp +inspection trust command. + +Example 7-27 Sample DAI Configuration Key +Topic SW1#show run +...output omitted... +ip dhcp snooping vlan 10 +ip arp inspection vlan 10 +no ip dhcp snooping information option +ip dhcp snooping +...output omitted... +interface GigabitEthernet0/1 +ip dhcp snooping trust +ip arp inspection trust +interface GigabitEthernet0/2 +ip dhcp snooping trust +ip arp inspection trust +...output omitted... + +When DAI detects an invalid ARP request or response on an untrusted interface it will generate syslog messages with a severity level of 4 with the mnemonic of DHCP_ SNOOPING_DENY. This is because DAI relies on the DHCP snooping binding table to identify appropriate IP address to MAC address bindings. In these syslog messages + + + + +From the Library of Outcast Outcast +268 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +a device with the IP address 10.1.1.10 and a MAC of 0050.b607.657a is being denied because its ARPs are invalid since the addresses do not match the addresses in the bind-ing table. +%SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Fa0/1, vlan 10.([0050. b607.657a/10.1.1.10/2893.fe3a.e345/10.1.1.1/18:42:55 UTC Mon Mar 1 1993]) + +%SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Res) on Fa0/1, vlan 10.([0050. b607.657a/10.1.1.10/2893.fe3a.e345/10.1.1.1/18:43:15 UTC Mon Mar 1 1993]) + +IP Source Guard + +IP Source Guard is used to prevent IP address spoofing. It relies on DHCP snooping and the binding table that is created by it. Because of this, you need to be able to trouble-shoot DHCP snooping issues when dealing with IP Source Guard issues. In addition, you have to be able to identify issues related to IP Source Guard configurations. Notice in Example 7-28 that the same DHCP snooping configuration example is listed; however, on interface Fast Ethernet 0/1 (which connects to an end station), the ip verify source com-mand has been added. This enables IP Source Guard on the interface. + +Example 7-28 Sample IP Source Guard Configuration + +SW1#show run +...output omitted... +ip dhcp snooping vlan 10 +no ip dhcp snooping information option +ip dhcp snooping +...output omitted... +interface FastEthernet0/1 +ip verify source +interface GigabitEthernet0/1 +ip dhcp snooping trust +interface GigabitEthernet0/2 +ip dhcp snooping trust +...output omitted... + + + +Key Topic + +You can verify which interfaces have IP Source Guard enabled with the show ip verify source command, as shown in Example 7-29. In this case, Fa0/1 on SW1 has been enabled with IP Source Guard, and the packets with the source IP address 10.1.1.10 are the only ones allowed inbound on interface Fa0/1. + +Notice how the Mac-address column is blank and the Filter-type is IP. With the ip verify source command, you are filtering based on IP address only. If you want to include the MAC address with the IP address when verifying the source of packets, you issue the +ip verify source port-security command. In Example 7-30, you can see that the MAC +address is included now and the filter type is ip-mac. + + + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 269 + +Example 7-29 Verifying IP Source Guard (only IP) + +SW1#show ip verify source + +Interface +--------- +Fa0/1 + +Filter-type +----------- +ip + +Filter-mode +----------- +active + +IP-address +--------------- +10.1.1.10 + +Mac-address Vlan +----------------- ---- +10 + + + +Example 7-30 Verifying IP Source Guard (IP and MAC) + +SW1#show ip verify source + +Interface +--------- +Fa0/1 + +Filter-type +----------- +ip-mac + +Filter-mode +----------- +active + +IP-address +--------------- +10.1.1.10 + +Mac-address Vlan +----------------- ---- +08:00:27:5D:06:D6 10 + + +If you are using the ip-mac filter type, you need to have port security enabled on the interface, because the secure MAC addresses are used. If port security is not enabled, the specific MAC address will not be learned, and all MAC addresses will be permitted as a result, as shown in Example 7-31. + +Example 7-31 IP MAC Filtering Without Port Security Enabled on Interface + +SW1#show ip verify source + +Interface +--------- +Fa0/1 +Fa0/2 + +Filter-type +----------- +ip-mac +ip-mac + +Filter-mode +----------- +active +active + +IP-address +--------------- +10.1.1.10 +10.1.1.20 + +Mac-address Vlan +----------------- ---- +08:00:27:5D:06:D6 10 +permit-all 10 + + +Also, remember that IP Source Guard relies on DHCP snooping. Therefore, if there is no binding in the DHCP snooping database for the port, all traffic will be blocked for all IPs, as shown in Example 7-32. In this example, there is no DHCP snooping binding for Fa0/2 because it has a static IP configured. However, IP Source Guard is enabled on the inter-face. Because IP Source Guard relies on DHCP snooping and there is no binding in the table, all ingress traffic on Fa0/2 will be denied. + +Example 7-32 Fa0/2 Sourced Traffic Denied Because There Is No Binding + +SW1#show ip verify source + +Interface +--------- +Fa0/1 +Fa0/2 + +Filter-type +----------- +ip-mac +ip-mac + +Filter-mode +----------- +active +active + +IP-address +--------------- +10.1.1.10 +deny-all + +Mac-address Vlan +----------------- ---- +08:00:27:5D:06:D6 10 +permit-all 10 + + +SW1#show ip dhcp snooping binding + +MacAddress +-------------------- +08:00:27:5D:06:D6 +net0/1 + +IpAddress +--------------- + +10.1.1.10 + +Lease(sec) +---------- + +70453 + +Type VLAN +------------- ---- + +dhcp-snooping 10 + +Interface +-------------- + +FastEther- + +Total number of bindings: 1 + + + + +From the Library of Outcast Outcast +270 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Spoof-Prevention Features Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 7-2. + + +VLAN10 - 10.1.10.0/24 +VLAN20 - 10.1.20.0/24 + + +DHCP Server for VLAN 10 and 20 + + +VLAN 10 +PC1 + +PC2 Fa0/1 Gi1/0/24 Fa0/2 Gi0/1 + +Fa0/3 ASW1 +PC3 Fa0/4 + +Gi1/0/1 +DSW1 + +SVI - VLAN10 10.1.10.1 PC4 SVI - VLAN20 10.1.20.1 + +VLAN 20 + +Figure 7-2 Spoof-Prevention Features Trouble Ticket Topology + + +Trouble Ticket 7-2 + +Problem: A junior administrator has approached you for assistance with a trouble ticket that she is having an issue with. The trouble ticket indicates that users in VLAN 10 are not able to access any resources outside their own subnet. They have verified that the clients receive their IP addressing information via a DHCP server. However, they are con-fused as to why they would be receiving the default gateway address of 10.1.10.100 when documentation shows that the default gateway should be configured as 10.1.10.1. They also indicate that they verified the DHCP pool on the DHCP server and that the default gateway address for the VLAN 10 pool is configured for 10.1.10.1. + +To assist with the issue, you decide to connect your laptop to Fast Ethernet 0/24 on ASW1. This is the port on ASW1 that is used as the Switched Port Analyzer (SPAN) destination port. You configure ASW1, as shown in Example 7-33, so that all traffic sent or received by Fa0/1 is captured and sent to Fa0/24, where your laptop is connected and running packet-capturing software. + +Example 7-33 Configuring a SPAN Session on ASW1 + +ASW1#config t +Enter configuration commands, one per line. End with CNTL/Z. +ASW1(config)#monitor session 1 source interface fastEthernet 0/1 both +ASW1(config)#monitor session 1 destination interface fastEthernet 0/24 + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 271 + +You access PC1 and issue the ipconfig /renew command to trigger the DHCP process so that you can identify who is providing the IP addressing. The DHCP packets between the server and PC1 are successfully copied by SPAN to your laptop running packet-capturing software, which is connected to Fa0/24. + +You review the DHCP offer message in your packet-capture software and notice that it is sourced from IP 10.1.10.34 and MAC 28:93:fe:3a:e3:45. Using the show mac address-table dynamic address 28:93:fe:3a:e3:45 command to follow the path, as shown in Example 7-34, you verify that the device with that MAC address is reachable out Fa0/17, +which is part of VLAN 10. You review your network documentation and trace the port to a PC that is being used for study purposes by an employee that currently enabled DHCP and just happened to use the same network that VLAN 10 is using in the production net-work. You ask the employee to disable the DHCP server, and she does. + +Example 7-34 Renewing a DHCP Address + +ASW1#show mac address-table dynamic address 28:93:fe:3a:e3:45 +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +10 28:93:fe:3a:e3:45 + +Type Ports +-------- ----- +DYNAMIC Fa0/17 + +Total Mac Addresses for this criterion: 1 + +The issue is solved. To update all the client PCs, you issue the ipconfig /renew command on all of them. They receive the correct default gateway of 10.1.10.1 now. However, you decide to dig deeper. Your network is configured with DHCP snooping, DAI, and IP Source Guard. As a result, this issue should have never happened. You decide to issue the show ip dhcp snooping command on ASW1 to verify the DHCP snooping configuration, as shown in Example 7-35. Based on the output, DHCP snooping is enabled globally, it is enabled for VLAN 20, information option 82 is disabled, and Gig0/1 is trusted. You have identified the problem. DHCP snooping has not been enabled for VLAN 10. Therefore, the DHCP server that was configured on Fa0/17 is able to hand out DHCP addresses on the network. By your enabling of DHCP snooping for VLAN 10, Fa0/17 would become an untrusted port by default and prevent DHCP Offer and Acks from being accepted inbound. + +Example 7-35 Reviewing the DHCP Snooping Configuration + +ASW1#show ip dhcp snooping +Switch DHCP snooping is enabled +DHCP snooping is configured on following VLANs: +20 +DHCP snooping is operational on following VLANs: +20 +DHCP snooping is configured on the following L3 Interfaces: + + + + + +From the Library of Outcast Outcast +272 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Insertion of option 82 is disabled +circuit-id default format: vlan-mod-port +remote-id: 001c.57fe.f600 (MAC) +Option 82 on untrusted port is not allowed +Verification of hwaddr field is enabled +Verification of giaddr field is enabled +DHCP snooping trust/rate is configured on the following Interfaces: + + +Interface +----------------------- +GigabitEthernet0/1 +Custom circuit-ids: + +Trusted +------- +yes + +Allow option +------------ +yes + +Rate limit (pps) +---------------- +unlimited + + +To fix the DHCP snooping configuration, you issue the ip dhcp snooping vlan 10 com-mand in global configuration mode, as shown in Example 7-36. + +Example 7-36 Configuring DHCP Snooping for VLAN 10 + +ASW1#config t +Enter configuration commands, one per line. End with CNTL/Z. +ASW1(config)#ip dhcp snooping vlan 10 + +You verify the configuration with the show ip dhcp snooping command again and con-firm that VLAN 10 is now enabled for DHCP snooping, as shown in Example 7-37. + +Example 7-37 Verifying DHCP Snooping Is Enabled for VLAN 10 + +ASW1#show ip dhcp snooping +Switch DHCP snooping is enabled +DHCP snooping is configured on following VLANs: +10,20 +DHCP snooping is operational on following VLANs: +10,20 +DHCP snooping is configured on the following L3 Interfaces: + +Insertion of option 82 is disabled +circuit-id default format: vlan-mod-port +remote-id: 001c.57fe.f600 (MAC) +Option 82 on untrusted port is not allowed +Verification of hwaddr field is enabled +Verification of giaddr field is enabled +DHCP snooping trust/rate is configured on the following Interfaces: + + +Interface +----------------------- +GigabitEthernet0/1 +Custom circuit-ids: + +Trusted +------- +yes + +Allow option +------------ +yes + +Rate limit (pps) +---------------- +unlimited + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 273 + +Troubleshooting Access Control + +Access control between devices within the same VLAN/subnet can be implemented using features such as protected ports, private VLANs, and VLAN access control lists (VACLs). Because the devices are in the same VLAN/subnet that you are trying to filter traffic to or from, regular router-based ACLs that are applied to router interfaces will not filter this traffic. This is because that traffic is never sent to the router interface. It stays within the local subnet/VLAN between the Layer 2 switchports. + +This section explains what is involved when troubleshooting issues related to protected ports, private VLANs, and VACLs, which are used to filter traffic between devices within the same subnet/VLAN. + + +Protected Ports + + + +Key Topic + +The purpose of a protected port is to deny all traffic from flowing between devices con-nected to two interfaces in the same VLAN on the same switch. Therefore, when trouble- +shooting protected ports, you are usually dealing with the following issues: + + +■ Traffic is flowing between two interfaces when it should not be. + +■ Traffic is not flowing between two interfaces when it should be. + +When dealing with protected ports, both these issues would be the result of a misconfig-uration. Keep in mind that a protected port can only communicate with ports that are not protected ports. If traffic arrives inbound on a protected port, it will not be forwarded if the egress port is also a protected port. Therefore, if two devices are able to communi-cate when they should not, it might be because one port is a protected port and the other is not a protected port when it should be. + +Figure 7-3 displays an access layer switch with PC1 and PC2 connected to it on Fa0/1 and Fa0/2. Both ports are members of VLAN 10. However, for security reasons, traffic is not allowed to flow between Fa0/1 and Fa0/2. Example 7-38 displays the interface configura-tion command switchport protected that is used to configure the ports as protected. + +VLAN 10 + + +PC1 + + + + +PC2 + + +Figure 7-3 + + +Fa0/1 +Gi0/1 + +SW1 Fa0/2 + + + +Protected Ports + + + + + + + +From the Library of Outcast Outcast +274 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 7-38 Sample Protected Port Configuration + +SW1#show run interface fastEthernet 0/1 +...output omitted... +interface FastEthernet0/1 +switchport access vlan 10 +switchport mode access +switchport protected +end + +SW1#show run interface fastEthernet 0/2 +...output omitted... +interface FastEthernet0/2 +switchport access vlan 10 +switchport mode access +switchport protected +end + +Besides using the running configuration to verify protected ports, you can use the com-mand show interfaces interface_type interface_number switchport to verify whether a port is configured as a protected port, as shown in Example 7-39. In the output for Fa0/1, it states Protected: true, which means Fa0/1 is a protected port. + +Example 7-39 Verifying Protected Ports + +SW1#show interfaces fastEthernet 0/1 switchport +Name: Fa0/1 +Switchport: Enabled +Administrative Mode: static access +Operational Mode: static access +Administrative Trunking Encapsulation: dot1q +Operational Trunking Encapsulation: native +Negotiation of Trunking: Off +Access Mode VLAN: 10 (10.1.1.0/26) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Administrative private-vlan trunk native VLAN: none +Administrative private-vlan trunk Native VLAN tagging: enabled +Administrative private-vlan trunk encapsulation: dot1q +Administrative private-vlan trunk normal VLANs: none +Administrative private-vlan trunk associations: none +Administrative private-vlan trunk mappings: none +Operational private-vlan: none +Trunking VLANs Enabled: ALL + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 275 + +Pruning VLANs Enabled: 2-1001 +Capture Mode Disabled +Capture VLANs Allowed: ALL + +Protected: true +Unknown unicast blocked: disabled +Unknown multicast blocked: disabled +Appliance trust: none + + +Private VLANs + +Private VLANs (PVLAN) take the protected port concept further by enabling you to con-trol which ports in the same VLAN can communicate with each other and which ports cannot. This is accomplished by grouping ports together in secondary VLANs that are members of a Private VLAN. Just like protected ports, when troubleshooting PVLANs, you are usually dealing with the following issues: + +■ Traffic is flowing between two interfaces when it should not be. + +■ Traffic is not flowing between two interfaces when it should be. + +When dealing with PVLANs, both these issues would be the result of a misconfigura-tion. Refer to Figure 7-4, which will be used for our PVLAN examples. DNS1 and DNS2 are in the secondary community VLAN of 501, which is within the primary VLAN 200. FS1 and FS2 are in the secondary isolated VLAN 502, which is within the primary VLAN 200. Therefore, based on the rules of PVLANs, the following are true: + +■ DNS1 and DNS2 are able to communicate with each other because they are mem-bers of the same community VLAN. + +■ DNS1 and DNS2 are not able to communicate with FS1 and FS2 because DNS1 and DNS2 are members of a community VLAN and FS1 and FS2 are members of an iso-lated VLAN. + +■ FS1 and FS2 are not able to communicate with each other because they are members of an Isolated VLAN. + +■ DNS1, DNS2, FS1, and FS2 are able to communicate out to the cloud because Gi1/0/10 is the promiscuous port. + + + + + + + + + + + + + +From the Library of Outcast Outcast +276 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +VLAN 200 Primary + + +DNS1 + + +Secondary Community VLAN 501 + + +DNS2 Gi1/0/x +21 Promiscuous Port + + + + +FS1 + +22 Gi1/0/10 23 Gi1/0/10 +24 SW2 SW1 + +FS2 Secondary Isolated VLAN 502 + + + +Figure 7-4 PVLANs + +To successfully troubleshoot PVLANs, you need to remember the following PVLAN rules: + + +■ Key +Topic +■ + + +■ + +■ + +■ + +Community ports can communicate with other community ports in the same com-munity. + +Community ports cannot communicate with other community ports in a different community. + +Community ports cannot communicate with isolated ports and vice versa. + +Isolated ports cannot communicate with other isolated ports. + +Community and isolated ports can communicate with the promiscuous port. + + +Example 7-40 displays the commands required to successfully implement the PVLANs in Figure 7-4. First, unless you are using Virtual Trunking Protocol (VTP) Version 3, the VTP mode has to be transparent or off. VTP Versions 1 and 2 cannot carry PVLAN information like VTPv3. The primary VLAN needs to be identified with the private-vlan primary command and associated with the secondary VLANs with the private-vlan association command. In addition, the secondary community VLAN needs to be iden-tified with the private-vlan community command, and the secondary isolated VLAN needs to be identified with the private-vlan isolated command. After the VLANs have been identified, you can associate the ports on the switch with the appropriate VLANs. In this example, Gig1/0/10 is the promiscuous port for the secondary VLANs 501 and 502 that are mapped to the primary VLAN 200, as identified by the commands switch-port private-vlan mapping 200 501-502 and switchport mode private-vlan promiscu-ous. To associate a port with a secondary VLAN, you use the switchport private-vlan host-association primary_vlan secondary_vlan command in interface configuration mode along with the command switchport mode private-vlan host. The only way to determine from this output that the interface is in the correct secondary VLAN is to examine the switchport private-vlan host-association primary_vlan secondary_vlan +command and compare the secondary VLAN ID to the VLAN configuration information. + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 277 + +For example, if you compare the secondary VLAN ID of 502 in the command switch-port private-vlan host-association 200 502 of interface Gig1/0/23 with the VLAN 502 configuration, you will notice that VLAN 502 is an isolated VLAN. + +Example 7-40 PVLAN Configuration Example +Key +Topic SW2#show run +...output omitted... +! +vtp mode transparent +! +vlan 200 +private-vlan primary +private-vlan association 501-502 +! +vlan 501 +private-vlan community +! +vlan 502 +private-vlan isolated +! +...output omitted... +! +interface GigabitEthernet1/0/10 +switchport private-vlan mapping 200 501-502 +switchport mode private-vlan promiscuous +! +...output omitted... +! +interface GigabitEthernet1/0/21 +switchport private-vlan host-association 200 501 +switchport mode private-vlan host +! +interface GigabitEthernet1/0/22 +switchport private-vlan host-association 200 501 +switchport mode private-vlan host +! +interface GigabitEthernet1/0/23 +switchport private-vlan host-association 200 502 +switchport mode private-vlan host +! +interface GigabitEthernet1/0/24 +switchport private-vlan host-association 200 502 +switchport mode private-vlan host +! +...output omitted... +end + + + +From the Library of Outcast Outcast +278 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +As you can see, with all the different parameters, it is very easy to misconfigure PVLANs. Therefore, it is imperative that you can read a PVLAN configuration, compare it to a topological diagram, and determine where the misconfiguration is that is causing traffic to be forwarded to ports it should not be forwarded to or causing traffic to not be for-warded to ports it should be forwarded to. + +In addition, you can verify the private VLANs and the ports associated with each pri-vate VLAN using the show vlan private-vlan command, as shown in Example 7-41. You can see in this output the primary VLAN 200 and its associated community VLAN 501 and isolated VLAN 502. The ports associated with the community VLAN are Gi1/0/10, Gi1/0/21, and Gi1/0/22. The ports associated with the isolated VLAN are Gi1/0/10, Gi1/0/23, and Gi1/0/24. The first port, Gi1/0/10, is the promiscuous port in both cases. + +Example 7-41 Verifying Private VLANs and Associated Ports +Key +Topic SW2#show vlan private-vlan + +Primary Secondary Type Ports +------- --------- ----------------- ------------------------------------------ + +200 501 community +200 502 isolated + +Gi1/0/10, Gi1/0/21, Gi1/0/22 +Gi1/0/10, Gi1/0/23, Gi1/0/24 + + +You can also use the command show interfaces interface_type interface_number switchport to verify the PVLAN status and configuration of a specific interface. As shown in Example 7-42, the administrative mode and operational mode is private-vlan host, indicating that it is either a member of a community vlan or isolated vlan. If it stated private-vlan promiscuous, it is the promiscuous port. The primary VLAN in this case is VLAN 200, as indicated by the line Access Mode VLAN: 200 (primary). Further down, you can see the host association, which indicates that the primary VLAN is VLAN 200 and that this specific port is a member of the secondary VLAN 501. In addition, the Operational private-vlan output states the same. + +Example 7-42 Verifying Private VLAN Information for a Specific Port + +SW2#show interfaces gigabitEthernet 1/0/22 switchport +Name: Gi1/0/22 +Switchport: Enabled +Administrative Mode: private-vlan host +Operational Mode: private-vlan host +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: Off +Access Mode VLAN: 200 (primary) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +Administrative private-vlan host-association: 200 (10.1.200.0/24) 501 (VLAN0501) +Administrative private-vlan mapping: none + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 279 + +Administrative private-vlan trunk native VLAN: none +Administrative private-vlan trunk Native VLAN tagging: enabled +Administrative private-vlan trunk encapsulation: dot1q +Administrative private-vlan trunk normal VLANs: none +Administrative private-vlan trunk associations: none +Administrative private-vlan trunk mappings: none +Operational private-vlan: +200 (10.1.200.0/24) 501 (VLAN0501) +...output omitted... + + +VACLs + +Protected ports and PVLANs are excellent features that help you control the traffic that can flow between ports in the same subnet/VLAN. However, they lack granular control. Therefore, it is all traffic or no traffic that is being forwarded between the ports. You can-not pick which type of traffic to control. If you do need to control the type of traffic that is flowing between ports in the same VLAN/subnet on a switch, you can implement VLAN access control lists (VACLs). Because you are able to control traffic on a more granular level, when troubleshooting VACLs you need to examine a few different compo- +nents that make up the VACL: + + +■ Key +Topic +■ + + + +■ + +ACLs: Used to define the traffic that will be examined by the VLAN access map (IP or MAC). Use the show access-lists command to verify the configured ACLs. + +VLAN access map: Used to define the action that will be taken on the traffic that is matched in the ACLs. Use the show run | section vlan access-map command or the show vlan access-map command to verify the configured VLAN access maps. + +VLAN filter list: Used to define which VLANs the VLAN access map will apply to. Use the show run | include vlan filter command or the show vlan filter command to +verify the configured VLAN filter list. + + +Refer to the sample VACL in Example 7-43, which was used to configure SW1 in Figure 7-5. This VACL is designed to prevent PC1 from being able to ping or telnet to PC2, which is in the same VLAN. However, PC1 will be able to access other resources and services on PC2. Notice all the different configurations that could cause the VACL to not function as expected. + + +■ +Key Topic + +■ + + + +■ + +The ACL could be misconfigured: Permit versus deny, wrong protocol, wrong addresses, wrong ports. + +The VLAN access map could be in the wrong sequence order: Just like an ACL, route map, and prefix list, it uses top-down processing, will immediately execute the actions upon a match, and there is an implicit deny all at the end. + +The VLAN access map could be misconfigured: Matching the wrong ACL, the +action could be incorrect, such as drop versus forward. + + + + + + +From the Library of Outcast Outcast +280 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ The VLAN filter could be misconfigured: The filter may be referencing the wrong VLAN access map, it could be configured with the wrong VLAN list, or it may be missing completely. + +Example 7-43 Sample VLAN ACL Configuration + +SW1#show access-lists +Extended IP access list 100 +10 permit icmp host 10.1.1.10 host 10.1.1.20 +20 permit tcp host 10.1.1.10 host 10.1.1.20 eq telnet + +SW1#show run | section vlan access-map +vlan access-map TSHOOT 10 +match ip address 100 +action drop +vlan access-map TSHOOT 20 +action forward + +SW1#show run | include vlan filter +vlan filter TSHOOT vlan-list 10 + + +VLAN 10 + + +PC1 + +10.1.1.1.0 + +10.1.1.2.0 + +PC2 + + +Figure 7-5 VACL + + +Fa0/1 +Gi0/1 + +SW1 +Fa0/2 + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 281 + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 7-2 lists a reference of these key topics and the page num- +bers on which each is found. + + +Table 7-2 Key Topics for Chapter 7 +Key +Topic Key Topic Element Description Page Number + + +List + +Example 7-2 + +Example 7-4 + +List + +Paragraph + +Paragraph + +Paragraph + +List + +Example 7-25 + +Example 7-26 + +Example 7-27 + +Paragraph + +Section + +List + +Example 7-40 + +Example 7-41 + +Identifies issues that may be the reason why port 250 security is not behaving as expected +Verifying port security 251 + +Verifying static addresses associated with interfaces 252 + +Outlines the different port security violation modes 254 + +Describes how to verify a port is in the err-disable 256 state +Describes how to determine why a port is in the err- 257 disable state and provides a valuable tip +Describes the error disable recovery feature and the 258 commands used for verification purposes +Provides a listing of items that must be true for 265 DHCP snooping to operate correctly +Verifying DHCP snooping 266 + +Verifying DHCP snooping bindings 267 + +Sample DAI configuration 267 + +Describes how to verify that IP Source Guard has 268 been configured correctly +Protected ports 273 + +Outlines the PVLAN rules that are required when 276 troubleshooting PVLANs +PVLAN configuration example 277 + +Verifying Private VLANs and associated ports 278 + + + + + +From the Library of Outcast Outcast +282 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Key Topic Element List + +List + +Description +Identifies the components involved with VACLs that you may have to troubleshoot +Identifies what could be misconfigured with a VACL that could be causing issues + +Page Number 279 + +279 + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +port security, protect violation mode, restrict violation mode, shutdown violation mode, err-disabled, sticky secure MAC address, DCHP snooping, DHCP snooping (trusted port), DHCP snooping (untrusted port), dynamic ARP inspection, IP Source Guard, protected ports, private VLANs, primary VLAN, community VLAN, isolated VLAN, promiscuous port, VLAN access control list + +Command Reference to Check Your Memory + +This section includes the most important show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 7-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully verify and troubleshoot the topics covered within this chapter. + + +Table 7-3 + +Task + + +show Commands Used for Verification and Troubleshooting + +Command Syntax + +Displays the ports that have port security show port-security enabled, the maximum number of MAC +addresses allowed, the current number learned, whether there is a security violation, and the action that is taken if a violation occurs. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 7: Troubleshooting Switch Security Features 283 + + + +Task +Displays the secure MAC addresses that have been learned on each port security enabled port. It displays the port and associated VLAN, the MAC address, and the type (SecureDynamic, SecureSticky, and SecureConfigured). +Displays detailed port security information for the interface. It identifies whether +port security is enabled or disabled, the port security status, the violation mode that is configured, and the aging type and time. It also displays the maximum max addresses allowed, the current number of MAC addresses, the number of statically configured addresses, the number of sticky addresses, and whether a violation has occurred. In addition, it displays the last seen MAC on the port, which is helpful for troubleshooting. + +Command Syntax +show port-security address + + + + + +show port-security interface interface_type interface_number + +Displays the configuration within the running show running-config interface interface_ configuration for a specific interface. You can type interface_number +verify configurations related to port security, DHCP snooping, DAI, IP Source Guard, protected ports, and PVLANs. + +Displays the Layer 1 and Layer 2 status of an interface. Also helps identify which ports are in the err-disable state. +Displays which features are able to use the error disable recovery feature on the switch and the mode they will use. +Displays which features are enabled and disabled for the error disable recovery feature, the timer that has been set, and any ports that are currently in the err-disable state (along with the reason why). + + +show interface status + + +show errdisable detect + + +show errdisable recovery + +Displays the status of DHCP snooping, show ip dhcp snooping including whether it is enabled or disabled +globally, the VLANs it is enabled for, whether option 82 is enabled or disabled, and the trusted ports. +Displays the MAC address to IP address show ip dhcp snooping binding DHCP snooping mappings, along with the +port and VLAN they are mapped to. + + + + + +From the Library of Outcast Outcast +284 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Displays the interfaces that have been enabled with IP Source Guard, the filter type being used, along with the IP address, MAC address, and VLAN number that source packets and frames will need to match. +Displays VLAN, trunking, PVLAN, and protected port information related to an interface. +Displays the primary and secondary PVLAN mappings along with the member interfaces. +Displays all access lists, including IP and MAC, that are configured on the switch. + +Command Syntax show ip verify source + + + + +show interfaces interface_type interface_ number switchport + +show vlan private-vlan + +show access-list + +Displays the VLAN access map configuration show run | section vlan access-map on the switch. show vlan access-map + +Displays the VLAN access map to VLAN mapping on the switch. + + +show run | include vlan filter + +show vlan filter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting HSRP: This section focuses on the Cisco Hot Standby Router Protocol (HSRP). It reviews the HSRP features and functions and how you can verify HSRP configurations and trouble-shoot HSRP issues. + +■ HSRP Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a struc-tured troubleshooting process to solve a reported problem. + +■ Troubleshooting VRRP: This section focuses on the industry standard Virtual Router Redundancy Protocol (VRRP). It reviews the VRRP features and functions as well as how you can verify VRRP con-figurations and troubleshoot VRRP issues. + +■ VRRP Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a struc-tured troubleshooting process to solve a reported problem. + +■ Troubleshooting GLBP: This section focuses on the Cisco Gateway Load Balancing Protocol (GLBP). It reviews the GLBP features and functions and how you can verify GLBP configurations and trouble-shoot GLBP issues. + +■ GLBP Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a struc-tured troubleshooting process to solve a reported problem. + +■ Comparing HSRP, VRRP, and GLBP: This section provides a close-up comparison of the different first-hop redundancy protocols (FHRPs) covered in the chapter. + + + + +From the Library of Outcast Outcast +CHAPTER 8 + + + + +Troubleshooting First-Hop Redundancy Protocols + + +Many devices, such as PCs, are configured with a default gateway. The default gateway parameter identifies the IP address of a next-hop router on the local-area network (LAN) that serves as the exit point for the LAN. As a result, if that router were to become unavailable, devices that relied on the default gateway’s IP address would be unable to send traffic off their local subnet. + +Fortunately, Cisco devices such as routers and Layer 3 switches offer technologies known as first-hop redundancy protocols (FHRPs) that provide next-hop gateway redundancy. These technologies include HSRP, VRRP, and GLBP, which allow clients to continue to reach their default gateway’s IP address, even if the Layer 3 switch or router that had been servicing that IP address becomes unavailable. + +This chapter reviews HSRP, VRRP, and GLBP, and provides a collection of Cisco IOS commands you can use to troubleshoot issues related to them. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 8-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 8-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting HSRP + +Troubleshooting VRRP + +Troubleshooting GLBP + +Comparing HSRP, VRRP, GLBP + +Questions +1–4 + +5–6 + +7–9 + +10 + + + + + + + + + +From the Library of Outcast Outcast +288 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. What is the default priority for an HSRP interface? + +a. 0 + +b. 100 + +c. 256 + +d. 32768 + +2. How many active forwarders can be in an HSRP group? + +a. 1 + +b. 2 + +c. 4 + +d. No limit + +3. What command enables you to verify the virtual MAC address of an HSRP group? + +a. show hsrp + +b. show hsrp brief + +c. show standby + +d. show standby brief + +4. Which two of the following are true about HSRP? + +a. Preemption is on by default. + +b. Preemption is off by default. + +c. The virtual router IP address can be an unused IP in the LAN or an IP associ-ated with a router’s LAN interface. + +d. The virtual router IP address has to be an unused IP in the LAN. + +5. What is the name for the router in a VRRP virtual router group that is actively for-warding traffic on behalf of the virtual router group? + +a. Virtual forwarder + +b. Active virtual gateway + +c. Virtual router master + +d. Active virtual forwarder + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 289 + +6. Which two of the following are true about VRRP? (Choose two answers.) + +a. Preemption is on by default. + +b. Preemption is off by default. + +c. The virtual router IP address can be an unused IP in the LAN or an IP associ-ated with a router’s LAN interface. + +d. The virtual router IP address has to be an unused IP in the LAN. + +7. Which show commands enable you to verify the virtual MAC addresses that an AVF is responsible for? (Choose two answers.) + +a. show run + +b. show arp + +c. show glbp + +d. show glbp brief + +8. Which of the following is the default GLBP method for load balancing? + +a. Weighted + +b. Host dependent + +c. Server dependent + +d. Round-robin + +9. Which of the following statements is true concerning GLBP? + +a. GLBP is an industry-standard FHRP. + +b. GLBP allows multiple routers to simultaneously forward traffic. + +c. The active virtual forwarder in a GLBP group is responsible for responding to ARP requests with different MAC addresses. + +d. A GLBP group has multiple active virtual gateways. + +10. Which of the following are Cisco proprietary FHRPs? (Choose two answers.) + +a. HSRP + +b. VRRP + +c. GLBP + +d. IRDP + + + + + + + + + +From the Library of Outcast Outcast +290 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting HSRP + +Hot Standby Router Protocol (HSRP) is a Cisco Proprietary FHRP that was designed to provide default gateway redundancy. HSRP operates on both Cisco routers and Cisco multilayer switches. When implemented, it allows multiple physical layer 3 gateways to appear as a single virtual layer 3 gateway. It is this virtual layer 3 gateway that the clients point to as their default gateway. + +As a troubleshooter you will need to have a very solid understanding of how HSRP func-tions in order to resolve any issues related to HSRP. In this section you will review the concepts of HSRP as well as how to verify and troubleshoot HSRP configurations. + +Reviewing HSRP + +HSRP uses a virtual IP address and MAC address to represent a virtual router within an HSRP group. The end-stations’ default gateway IP address is the IP address of the virtual router. When the end-stations ARP for the MAC address of the default gateway IP address, they are given the virtual MAC address. Under no circumstances should the +end-stations ever be given the real MAC address of the device that is acting as the default gateway when they are ARPing for the MAC of the virtual IP address. + +Within an HSRP group, one router is the active router. This router is responsible for forwarding data sent to the MAC address of the default gateway and responding to ARP requests asking for the MAC associated with the IP address of the default gateway. Another router in the HSRP group is known as the standby router. This router is wait-ing for the active router to fail or experience a link/reachability failure so that it can take +over the active router role and forward traffic and respond to ARP requests. You can have additional routers in an HSRP group, but they will not be active or standby. They will simply sit and wait for the active or standby to fail so they can elect a replacement among them. Figure 8-1 illustrates a basic HSRP topology. + + + +Active Router + +R1 +Fa 0/0 172.16.1.1 + +HSRP Group 10 + +Virtual Router + +Virtual +172.16.1.3 + + +Standby Router + +R2 +Et 0/0 172.16.1.2 + + + +Workstation A +Next-Hop Gateway = 172.16.1.3 + + +Figure 8-1 Basic HSRP Operation + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 291 + +Examples 8-1 and 8-2 show the HSRP configuration for routers R1 and R2. + +Example 8-1 HSRP Configuration on Router R1 + +R1#show run +...OUTPUT OMITTED... +interface FastEthernet0/0 +ip address 172.16.1.1 255.255.255.0 +standby 10 ip 172.16.1.3 +standby 10 priority 150 +standby 10 preempt +...OUTPUT OMITTED... + + +Example 8-2 HSRP Configuration on Router R2 + +R2#show run +...OUTPUT OMITTED... +interface Ethernet0/0 +ip address 172.16.1.2 255.255.255.0 +standby 10 ip 172.16.1.3 +...OUTPUT OMITTED... + + + +Key Topic + +Notice that both routers R1 and R2 have been configured with the same virtual IP address of 172.16.1.3 for an HSRP group of 10. Router R1 is configured with a higher pri-ority using the standby 10 priority 150 command. Router R2 has a default HSRP prior-ity of 100 for group 10, and with HSRP, higher priority values are more preferable. Also, notice that router R1 is configured with the standby 10 preempt command, which means that if router R1 loses its active status, perhaps because it is powered off, it will regain its +active status when it again becomes available. + + + +HSRP Converging After a Failure + +By default, HSRP sends hello messages every three seconds. Also, if the standby router does not hear a hello message within ten seconds by default, the standby router considers the active router to be down. The standby router then assumes the active role. + +Although this ten-second convergence time applies for a router becoming unavailable for a reason such as a power outage or a link failure, convergence happens more rapidly if an interface is administratively shut down. Specifically, an active router sends a resign mes-sage if its active HSRP interface is shut down. + +Also, consider the addition of another router to the network segment whose HSRP prior-ity for group 10 is higher than 150. If it were configured for preemption, the newly added router would send a coup message, to inform the active router that the newly added router was going to take on the active role. If, however, the newly added router were not configured for preemption, the currently active router would remain the active router. + + + + + +From the Library of Outcast Outcast +292 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +HSRP Verification and Troubleshooting + +When verifying an HSRP configuration or troubleshooting an HSRP issue, you should begin by determining the following information about the HSRP group under inspection: + +■ Which router is the active router? Key +Topic ■ Which routers, if any, are configured with the preempt option? + +■ What is the virtual IP address? + +■ What is the virtual MAC address? + +■ Is interface or object tracking on? + +The show standby brief command can be used to show which interface is participating in an HSRP group. It identifies the HSRP group number, the priority of the interface, and if preemption is enabled or not. Additionally, this command identifies the router that is currently the active router, the router that is currently the standby router, and the virtual IP address for the HSRP group. Examples 8-3 and 8-4 show the output from the show standby brief command issued on routers R1 and R2, where router R1 is currently the active router for group 10 with a virtual IP of 172.16.1.3. It also has a priority of 150 with preemption enabled. In this case, the router with the IP address 172.16.1.2 is the standby router, which happens to be R2, as shown in Example 8-4. + +Key Example 8-3 show standby brief Command Output on Router R1 Topic R1#show standby brief +P indicates configured to preempt. +| +Interface Grp Prio P State Active Standby Virtual IP +Fa0/0 10 150 P Active local 172.16.1.2 172.16.1.3 + + +Example 8-4 show standby brief Command Output on Router R2 + +R2#show standby brief +P indicates configured to preempt. +| +Interface Grp Prio P State Active Standby Virtual IP +Et0/0 10 100 Standby 172.16.1.1 local 172.16.1.3 + +In addition to an interface’s HSRP group number, the interface’s state, and the HSRP group’s virtual IP address, the show standby interface_type interface_number command also displays the HSRP group’s virtual MAC address, the HSRP timers, the standby rout-ers priority, and if the current local priority is different than the configured local prior-ity. Issuing this command on router R1, as shown in Example 8-5, shows that the virtual MAC address for HSRP group 10 is 0000.0c07.ac0a, the timers are default at 3 and 10, the standby routers priority is 100, and the local routers current priority is the same as the configured priority. + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 293 + +Example 8-5 show standby fastethernet 0/0 Command Output on Router R1 + +R1#show standby fastethernet 0/0 +FastEthernet0/0 - Group 10 +State is Active +1 state change, last state change 01:20:00 +Virtual IP address is 172.16.1.3 +Active virtual MAC address is 0000.0c07.ac0a +Local virtual MAC address is 0000.0c07.ac0a (v1 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 1.044 secs +Preemption enabled +Active router is local +Standby router is 172.16.1.2, priority 100 (expires in 8.321 sec) +Priority 150 (configured 150) +IP redundancy name is "hsrp-Fa0/0-10" (default) + + +Virtual Router MAC Address + +The default virtual MAC address for an HSRPv1 group, as shown in Figure 8-2, is based on the HSRP group number. Specifically, the virtual MAC address for an HSRP group begins with a vendor code of 0000.0c, followed with a well-known HSRPv1 code of 07.ac. The last two hexadecimal digits are the hexadecimal representation of the HSRP group number. Therefore, you can have up to 256 HSRPv1 groups. For example, an HSRP group of 10 yields a default virtual MAC address of 0000.0c07.ac0a, because 10 in deci-mal equates to 0a in hexadecimal. + +HSRP Group 10 +Key Topic + +0000.0c07.ac0a +Vendor Well- HSRP Code known Group +HSRP Number Code in Hex + +Figure 8-2 HSRP Virtual MAC Address + +The default virtual MAC address for an HSRPv2 group begins with a vendor code of 0000.0c, followed with a well-known HSRPv2 code of 9F.F, and then the last three hexa-decimal digits represent the HSRPv2 group. Therefore, you can have a total of 4096 HSRPv2 groups. + + +Interface Tracking + + + +Key Topic + +HSRP interface tracking is a feature that most organizations will deploy. By default, HSRP will only detect a failure of the device itself or the path that is used by the hello packets. +What about the uplinks from the routers running HSRP? If they fail, hello packets are + + + + +From the Library of Outcast Outcast +294 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +still exchanged successfully, and the active router is still available. However, if the uplink is down, packets are dropped at the active router because it cannot forward them. This is where interface tracking comes into play. Interface tracking allows you to control the priority of a router in an HSRP group based on the status of an interface. If the interface is anything but up/up, you can decrement the priority of the router to a value that is lower than the standby router, and if preemption is enabled on the standby router, it will take over as the active forwarder because it now has the higher priority. You implement +interface tracking with the standby group_number track interface_type interface_num-ber decrement_value command. You can use the show standby command to verify whether interface tracking is configured and the state of the tracked interface, as shown in Example 8-6. + +Example 8-6 show standby Command Output on Router R1 + +R1#show standby fa 0/0 +FastEthernet0/0 - Group 10 +State is Standby +2 state changes, last state change 00:02:16 +Virtual IP address is 172.16.1.3 +Active virtual MAC address is 0000.0c07.ac0a +Local virtual MAC address is 0000.0c07.ac0a (v1 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 0.784 secs +Preemption enabled +Active router is 172.16.1.2, priority 100 (expires in 9.312 sec) +Standby router is local +Priority 99 (configured 110) +Track interface FastEthernet2/0 state Down decrement 11 +Group name is "hsrp-Gi0/0-10" (default) + +In the case of Example 8-6, you can see that the tracked interface state is down. When it is down, the priority will be decremented by 11. Therefore, reviewing the configured priority of 110 and the current priority of 99 indicates why this router is not the active router at the moment. Its priority has been lowered to 99 from 110 because the interface state is down. Now you would have to troubleshoot why the interface is down, which is beyond the scope of our HSRP discussion. + +In addition to interface tracking, you can use object tracking, which allows you to track IP-related information such as a route, a group of objects, the status of a service level agreement (SLA), and the status of an interface. We discuss this type of tracking in the “Troubleshooting VRRP” section. + + + + + +Key Topic + +Verifying First Hop + +Once you know the current HSRP configuration, you might then check to see whether a host on the HSRP virtual IP address’s subnet can ping the virtual IP address. Based on the topology previously shown in Figure 8-1, Example 8-7 shows a successful ping from +Workstation A. + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 295 + +Example 8-7 Ping Test from Workstation A to the HSRP Virtual IP Address + +C:\>ping 172.16.1.3 + +Pinging 172.16.1.3 with 32 bytes of data: + +Reply from 172.16.1.3: bytes=32 time=2ms TTL=255 +Reply from 172.16.1.3: bytes=32 time=1ms TTL=255 +Reply from 172.16.1.3: bytes=32 time=1ms TTL=255 +Reply from 172.16.1.3: bytes=32 time=1ms TTL=255 + +Ping statistics for 172.16.1.3: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 1ms, Maximum = 2ms, Average = 1ms + +A client could also be used to verify the appropriate virtual MAC address learned by the client corresponding to the virtual MAC address reported by one of the HSRP routers. Example 8-8 shows Workstation A’s Address Resolution Protocol (ARP) cache entry for the HSRP virtual IP address of 172.16.1.3. Notice in the output that the MAC address learned via ARP does match the HSRP virtual MAC address reported by the active HSRP router. + +Example 8-8 Workstation A’s ARP Cache + +C:\>arp -a + +Interface: 172.16.1.4 --- 0x4 + +Internet Address +172.16.1.3 + +Physical Address +00-00-0c-07-ac-0a + +Type +dynamic + + +However, one of the best tools to use with FHRPs to verify the path is traceroute. With traceroute, you can identify the physical first-hop router that the packets are traversing. Example 8-9 displays the tracert command executed on a PC. Notice that it states that the first hop is 172.16.1.1. This is the IP address of R1’s LAN interface. Therefore, we can conclude the R1 is the active forwarder at the moment. However, suppose that a failure happened and R2 became the active forwarder. The ARP cache would still be the same on the PC. However, the output of tracert on the PC would now display that the first hop is 172.16.1.2, as shown in Example 8-10. + +Example 8-9 A Trace from Workstation A Confirming That R1 Is the First Hop (Active Forwarder) + +C:\>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 7 ms <1 ms 2 ms 172.16.1.1 +...output omitted... +Trace complete. + + + +From the Library of Outcast Outcast +296 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 8-10 A Trace from Workstation A Confirming That R2 Is the First Hop (Active Forwarder) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 3 ms 2 ms 4 ms 172.16.1.2 +...output omitted... +Trace complete. + + +Debug + +You can also use the debug standby terse command to view important HSRP changes, such as a state change. Example 8-11 shows this debug output on router R2 when router R1’s Fast Ethernet 0/0 interface is shut down; notice that router R2’s state changes from standby to active. + +Example 8-11 debug standby terse Command Output on Router R2: Changing to Active + +R2# +*Mar 1 01:25:45.930: HSRP: Et0/0 Grp 10 Standby: c/Active timer expired +(172.16.1.1) +*Mar 1 01:25:45.930: HSRP: Et0/0 Grp 10 Active router is local, was 172.16.1.1 +*Mar 1 01:25:45.930: HSRP: Et0/0 Grp 10 Standby router is unknown, was local +*Mar 1 01:25:45.930: HSRP: Et0/0 Grp 10 Standby -> Active +*Mar 1 01:25:45.930: %HSRP-6-STATECHANGE: Ethernet0/0 Grp 10 state Standby -> +Active +*Mar 1 01:25:45.930: HSRP: Et0/0 Grp 10 Redundancy "hsrp-Et0/0-10" state Standby +-> Active +*Mar 1 01:25:48.935: HSRP: Et0/0 Grp 10 Redundancy group hsrp-Et0/0-10 state +Active -> Active +*Mar 1 01:25:51.936: HSRP: Et0/0 Grp 10 Redundancy group hsrp-Et0/0-10 state +Active -> Active + +When router R1’s Fast Ethernet 0/0 interface is administratively enabled, router R1 reas-sumes its previous role as the active HSRP router for HSRP group 10, because router R1 is configured with the preempt option. The output shown in Example 8-12 demonstrates how router R2 receives a coup message, letting router R2 know that router R1 is taking back its active role. + +Example 8-12 debug standby terse Command Output on Router R2: Changing HSRP to Standby + +R2# +*Mar 1 01:27:57.979: HSRP: Et0/0 Grp 10 Coup in 172.16.1.1 Active pri 150 +vIP 172.16.1.3 +*Mar 1 01:27:57.979: HSRP: Et0/0 Grp 10 Active: j/Coup rcvd from higher pri +router (150/172.16.1.1) + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 297 + +*Mar 1 01:27:57.979: HSRP: Et0/0 Grp 10 Active router is 172.16.1.1, was local +*Mar 1 01:27:57.979: HSRP: Et0/0 Grp 10 Active -> Speak +*Mar 1 01:27:57.979: %HSRP-6-STATECHANGE: Ethernet0/0 Grp 10 state Active -> Speak +*Mar 1 01:27:57.979: HSRP: Et0/0 Grp 10 Redundancy "hsrp-Et0/0-10" state Active +-> Speak +*Mar 1 01:28:07.979: HSRP: Et0/0 Grp 10 Speak: d/Standby timer expired (unknown) +*Mar 1 01:28:07.979: HSRP: Et0/0 Grp 10 Standby router is local +*Mar 1 01:28:07.979: HSRP: Et0/0 Grp 10 Speak -> Standby +*Mar 1 01:28:07.979: HSRP: Et0/0 Grp 10 Redundancy "hsrp-Et0/0-10" state Speak +-> Standby + + +HSRP Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 8-3. + + + +192.0.2.1 + + + +Gig 1/0/10 Gig 1/0/10 + + + +Int VLAN 10 IP 10.1.1.1/26 Active + + +SW1 SW2 +HSRP GROUP 10 IP 10.1.1.62 + +Int VLAN 10 IP 10.1.1.2/26 Standby + + + +SW3 + + + +PC1 + + +IP 10.1.1.10/26 DG 10.1.1.62 + +Figure 8-3 HSRP Trouble Ticket Topology + + +Trouble Ticket 8-1 + +Problem: According to traffic statistics, all traffic for VLAN 10 is flowing through SW2 to reach the core instead of SW1. + + + +From the Library of Outcast Outcast +298 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +You start by verifying the problem from PC1 on VLAN 10. In this case, the best tool is traceroute because it will identify the router hops (real IPs) along the path. All you care about is the first hop; is it 10.1.1.1 or 10.1.1.2? This will identify whether traffic is flowing though SW1 or SW2 to reach the core. Example 8-13 indicates that SW2 is in fact the HSRP active forwarder for the 10.1.1.0/26 network because it was the first hop returned for the tracert command output. + +Example 8-13 A Trace from PC1 Confirming That SW2 Is the First Hop (Active Forwarder) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 6 ms 1 ms 2 ms 10.1.1.2 +...output omitted +Trace complete. + +Next you need to confirm that this is in fact true by reviewing the output of HSRP show commands. Example 8-14 displays the output of show standby brief on SW2. Notice that under the Active column it states local and that under the Standby column it displays 10.1.1.1, which is the IP address of the standby router, SW1. + +Example 8-14 show standby brief Command Output on SW2 + +SW2#show standby brief +P indicates configured to preempt. + + +Interface +Vl10 + +| +Grp Pri P State Active +10 100 P Active local + + +Standby +10.1.1.1 + + +Virtual IP +10.1.1.62 + + +Reviewing Figure 8-3 indicates that SW1 should be the active forwarder for group 10. Now is an excellent time to review the output of show standby brief on SW1 to see whether anything stands out that might be the issue. Example 8-15 indicates that SW1 is indeed the standby router for group 10. + +Example 8-15 show standby brief Command Output on SW1 + +SW1#show standby brief +P indicates configured to preempt. +| +Interface Grp Pri P State Active Standby Virtual IP +Vl10 10 10 P Standby 10.1.1.2 local 10.1.1.62 + +However, if you look very closely at Examples 8-14 and 8-15, you should notice that SW1 has a priority of 10, and SW2 has a priority of 100. The HSRP router that has the higher priority is the active forwarder. You should check the output of show standby on SW1 to determine whether that is the configured priority or if some tracked object is down and causing the priority to be lowered. Example 8-16 displays the output of show standby +on SW1. Notice that the priority is listed as 10 and that it states it is configured as 10. + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 299 + +It must have been mistyped. Checking your documentation indicates that the priority should be configured to 110. + +Example 8-16 show standby Command Output on SW1 + +SW1#show standby +Vlan10 - Group 10 +State is Standby +4 state changes, last state change 00:06:51 +Virtual IP address is 10.1.1.62 +Active virtual MAC address is 0000.0c07.ac0a +Local virtual MAC address is 0000.0c07.ac0a (v1 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 2.016 secs +Preemption enabled +Active router is 10.1.1.2, priority 100 (expires in 9.488 sec) +Standby router is local +Priority 10 (configured 10) +Track interface GigabitEthernet1/0/10 state Up decrement 11 +Group name is "hsrp-Vl10-10" (default) + +Example 8-17 displays the interface VLAN 10 configuration, which shows that the prior-ity was configured to 10 instead of 110. + +Example 8-17 show run interface vlan 10 Command Output on SW1 + +SW1#show run interface vlan 10 +Building configuration... + +Current configuration : 163 bytes +! +interface Vlan10 +ip address 10.1.1.1 255.255.255.192 +standby 10 ip 10.1.1.62 +standby 10 priority 10 +standby 10 preempt +standby 10 track 1 decrement 11 +end + +After fixing the issue by executing the command standby 10 priority 110 in VLAN 10 interface configuration mode on SW1, you see the following syslog message confirming that SW1 is now the active forwarder: + +%HSRP-5-STATECHANGE: Vlan10 Grp 10 state Standby -> Active +You then reissue the tracert command on PC1, as shown in Example 8-18, and confirm that SW1 is in fact the active forwarder now. + + + + + +From the Library of Outcast Outcast +300 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 8-18 A Trace from PC1 Confirming That SW1 Is the First Hop (Active Forwarder) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 7 ms <1 ms 2 ms 10.1.1.1 +...output omitted... +Trace complete. + + +Trouble Ticket 8-2 + +Problem: According to traffic statistics, all traffic for VLAN 10 is flowing through SW2 to reach the core instead of SW1. + +You start by verifying the problem from PC1 on VLAN 10. In this case, the best tool is traceroute because it will identify the router hops (real IPs) along the path. All you care about is the first hop; is it 10.1.1.1 or 10.1.1.2? This will identify whether traffic is flowing through SW1 or SW2 to reach the core. Example 8-19 indicates that SW2 is in fact the HSRP active forwarder for the 10.1.1.0/26 network because it was the first hop returned for the tracert command output. + +Example 8-19 A Trace from PC1 Confirming That SW2 Is the First Hop (Active Forwarder) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 6 ms 1 ms 2 ms 10.1.1.2 +...output omitted +Trace complete. + +Next you need to confirm that this is in fact true by reviewing the output of HSRP show commands. Example 8-20 displays the output of show standby brief on SW2. Notice that under the Active column it states local and that under the Standby column it displays 10.1.1.1, which is the IP address of the standby router, SW1. + +Example 8-20 show standby brief Command Output on SW2 + +SW2#show standby brief +P indicates configured to preempt. + + +Interface +Vl10 + +| +Grp Pri P State Active +10 100 P Active local + + +Standby +10.1.1.1 + + +Virtual IP +10.1.1.62 + + +Reviewing Figure 8-3 indicates that SW1 should be the active forwarder for group 10. Now is an excellent time to review the output of show standby brief on SW1 to see whether anything stands out that might be the issue. Example 8-21 indicates that SW1 is indeed the standby router for group 10. + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 301 + +Example 8-21 show standby brief Command Output on SW1 + +SW1#show standby brief +P indicates configured to preempt. +| +Interface Grp Pri P State Active Standby Virtual IP +Vl10 10 110 Standby 10.1.1.2 local 10.1.1.62 + +However, if you look very closely at Examples 8-20 and 8-21, you should notice that SW1 has a priority of 110 and that SW2 has a priority of 100. The HSRP router that has the higher priority should be the active forwarder. However, in this case, it is not. Taking an even closer look at Examples 8-20 and 8-21, you notice that SW1 does not have pre-emption enabled, as indicated by the missing P in the output. + +You check the output of show standby on SW1, as shown in Example 8-22, and it indi-cates that preemption is disabled. + +Example 8-22 show standby Command Output on SW1 + +SW1#show standby +Vlan10 - Group 10 +State is Standby +7 state changes, last state change 02:39:07 +Virtual IP address is 10.1.1.62 +Active virtual MAC address is 0000.0c07.ac0a +Local virtual MAC address is 0000.0c07.ac0a (v1 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 1.520 secs +Preemption disabled +Active router is 10.1.1.2, priority 100 (expires in 10.112 sec) +Standby router is local +Priority 110 (configured 110) +Track interface GigabitEthernet1/0/10 state Up decrement 11 +Group name is "hsrp-Vl10-10" (default) + +If SW1 is expected to take over as the active forwarder when it has a higher priority, pre-emption needs to be on. + +After fixing the issue by executing the command, standby 10 preempt in VLAN 10 interface configuration mode on SW1, you see the following syslog message confirming that SW1 is now the active forwarder: + +%HSRP-5-STATECHANGE: Vlan10 Grp 10 state Standby -> Active +You then reissue the tracert command on PC1, as shown in Example 8-23, and confirm that SW1 is in fact the active forwarder now. + + + + + + + +From the Library of Outcast Outcast +302 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 8-23 A Trace from PC1 Confirming That SW1 Is the First Hop (Active Forwarder) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 7 ms <1 ms 2 ms 10.1.1.1 +...output omitted... +Trace complete. + + +Trouble Ticket 8-3 + +Problem: Users in VLAN 10 are reporting that they are not able to reach any resources outside their LAN. + +You start by verifying the problem from PC1 on VLAN 10. You ping 192.0.2.1, as shown in Example 8-24, and it fails. + +Example 8-24 Failed Ping from PC1 to Destination Outside LAN + +C:\PC1>ping 192.0.2.1 +Pinging 192.0.2.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +You ping the default gateway of PC1, which is the virtual router IP address of 10.1.1.62, and it is successful, as shown in Example 8-25. + +Example 8-25 Successful Ping from PC1 to Default Gateway + +C:\PC1>ping 10.1.1.62 + +Reply from 10.1.1.62: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.62: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.62: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.62: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.62: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 303 + +So far, you have confirmed that connectivity beyond the default gateway is not possible but that connectivity to the default gateway is. You decide to use traceroute to determine which router is currently the active forwarder. Example 8-26 confirms that it is SW1 at 10.1.1.1. However, notice how no other hop is displayed and you receive a destination host unreachable message from 10.1.1.1. Keep this in mind; we will come back to it. + +Example 8-26 A Trace from PC1 Confirming That SW1 Is the First Hop (Active Forwarder) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 4 ms 2 ms 2 ms 10.1.1.1 +2 10.1.1.1 reports: Destination host unreachable. + +Trace complete. + +Next you need to confirm that SW1 is in fact the active forwarder by reviewing the out-put of HSRP show commands. Example 8-27 displays the output of show standby brief on SW1. Notice that under the Active column it states local and that under the Standby column it displays 10.1.1.2, which is the IP address of the standby router, SW2. + +Example 8-27 show standby brief Command Output on SW1 + +SW1#show standby brief +P indicates configured to preempt. + + +Interface +Vl10 + +| +Grp Pri P State Active +10 109 P Active local + + +Standby +10.1.1.2 + + +Virtual IP +10.1.1.62 + + +Review Example 8-26 again. Remember how the tracert command output is failing at SW1? This is a good indication that SW1 cannot route the packet to 192.0.2.1. You issue the show ip route command on SW1, as shown in Example 8-28. All you see are con-nected and local routes. However, there is no connected route for Gig1/0/10, nor are there any routes learned from a neighboring router in the core on Gig1/0/10. + +Example 8-28 show ip route Command Output on SW1 + +SW1#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + + + + + +From the Library of Outcast Outcast +304 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.1.0/26 is directly connected, Vlan10 +L 10.1.1.1/32 is directly connected, Vlan10 +C 10.1.1.64/26 is directly connected, Vlan20 +L 10.1.1.65/32 is directly connected, Vlan20 + +You issue the command show ip interface brief | exclude unassigned, as shown in Example 8-29, on SW1 and notice that Gig1/0/10 is down/down. There is an issue between SW1 and the core. You escalate the problem because it is beyond your control. However, you need to determine in the meantime why HSRP did not successfully fail over to SW2 as the active forwarder for group 10 in case this happens again. + +Example 8-29 show ip interface brief | exclude unassigned Command Output on SW1 + +SW1#show ip int brief | ex unassigned +Interface IP-Address OK? Method Status Protocol + +Vlan10 +Vlan20 +GigabitEthernet1/0/10 + +10.1.1.1 +10.1.1.65 +10.1.10.2 + +YES NVRAM up up +YES NVRAM up up +YES NVRAM down down + + +Interface tracking is a feature that allows an HSRP-enabled router to decrement its pri-ority by a specified value if the status of an interface goes down. This ensures that the active forwarder does not maintain the active status if it is not fit to do so. If it did, it might black hole traffic as it did in this scenario. Using the command show standby on SW1 indicates that you are tracking interface Gigabit Ethernet 1/0/10, as shown in +Example 8-30. It also shows that it is down and that the current priority is 109 instead of the configured 110. + +Example 8-30 show standby Command Output on SW1 + +SW1#show standby +Vlan10 - Group 10 +State is Active +8 state changes, last state change 00:14:11 +Virtual IP address is 10.1.1.62 +Active virtual MAC address is 0000.0c07.ac0a +Local virtual MAC address is 0000.0c07.ac0a (v1 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 0.736 secs +Preemption enabled +Active router is local +Standby router is 10.1.1.2, priority 100 (expires in 7.760 sec) +Priority 109 (configured 110) +Track interface GigabitEthernet1/0/10 state Down decrement 1 +Group name is "hsrp-Vl10-10" (default) + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 305 + +The problem in this case is clear. Interface tracking was configured incorrectly, as verified in Example 8-31, which displays the output of show run interface vlan 10. In this case, the decrement value was set to 1. It appears that whoever configured it thought that the decrement value identified what the new priority should be if the interface goes down. But in reality, it states how much to lower the configured priority by. Therefore, the con-figured priority is 110 and you minus 1, which gives you 109. + +Example 8-31 show run interface vlan 10 Command Output on SW1 + +SW1#show run interface vlan 10 +Building configuration... + +Current configuration : 163 bytes +! +interface Vlan10 +ip address 10.1.1.1 255.255.255.192 +standby 10 ip 10.1.1.62 +standby 10 priority 110 +standby 10 preempt +standby 10 track 1 decrement 1 +end + +After you solve this problem by changing the decrement value to a value of 11 or higher (so that the priority of SW1 will be 99 or lower), you will notice a syslog message on SW1 indicating that SW1 is no longer in the active state, and on SW2 you will see a sys-log message indicating that it is now in the active state. These are examples of the syslog messages: + +SW1# +%HSRP-5-STATECHANGE: Vlan10 Grp 10 state Active -> Speak SW1# +%HSRP-5-STATECHANGE: Vlan10 Grp 10 state Speak -> Standby SW1# +SW2# +%HSRP-5-STATECHANGE: Vlan10 Grp 10 state Standby -> Active SW2# +You then reissue the tracert command on PC1, as shown in Example 8-32, and confirm that SW2 is the active forwarder. + +Example 8-32 A Trace from PC1 Confirming That SW2 Is the First Hop (Active Forwarder) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 3 ms 2 ms 4 ms 10.1.1.2 + + + + +From the Library of Outcast Outcast +306 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +...output omitted... +7 48 ms 40 ms 30 ms 192.0.2.1 + +Trace complete. + +In addition, you need to ping from a client to make sure that the problem is officially solved. It is, as shown by the successful ping in Example 8-33. + +Example 8-33 Successful Ping from PC1 + +C:\PC1>ping 192.0.2.1 + +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Troubleshooting VRRP + +Virtual Router Redundancy Protocol (VRRP), is an IETF standard FHRP based on Cisco’s HSRP protocol. Therefore, your knowledge of HSRP can transfer over to VRRP. However, although they are similar, VRRP and HSRP are not compatible. In addition, as a trouble-shooter, you need to understand the differences of VRRP so that you can successfully troubleshoot issues related to it. + +This section focuses on the behavior of VRRP and how to verify and troubleshoot VRRP issues. + + + + + +Key Topic + +Reviewing VRRP + +Like HSRP, VRRP allows a collection of routers to service traffic destined for a single IP address. Unlike HSRP, the IP address serviced by a VRRP group does not have to be a unique/unused IP address. The IP address can be the address of a routers physical inter-face on the LAN. A VRRP virtual router identifier (VRID) is made up of a virtual master router and multiple routers acting as virtual router backups, as shown in Figure 8-4. (Note that the VRID is the same concept as an HSRP group.) The virtual master router is responsible for handing out the virtual MAC address associated with the LAN’s default gateway IP address and forwarding traffic sent to the default gateway. The virtual router backups are waiting for the master to fail so that one of them can take over the virtual +master router role. + + + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 307 +IP 10.1.1.1 + + + +192.0.2.1 + + + +Gig 1/0/10 Gig 1/0/10 + + + +Int VLAN 120 IP 10.1.1.65/26 +Backup + + +SW1 SW2 +VRRP GROUP 20 IP 10.1.1.66 + +Int VLAN 120 +IP 10.1.1.66/26 VRM +2/26 + + +VRM=Virtual Router Master + +SW3 + + + +PC1 + + +IP 10.1.1.74/26 DG 10.1.1.66 + +Figure 8-4 Basic VRRP Operation + +Examples 8-34 and 8-35 show the VRRP configuration for SW1 and SW2. + +Example 8-34 VRRP Configuration on Router R1 + +SW1#show run +...OUTPUT OMITTED... +interface vlan 20 +ip address 10.1.1.65 255.255.255.192 +vrrp 20 ip 10.1.1.66 +...OUTPUT OMITTED... + + +Example 8-35 VRRP Configuration on Router R2 + +SW2#show run +...OUTPUT OMITTED... +interface vlan 20 +ip address 10.1.1.66 255.255.255.192 +vrrp 20 ip 10.1.1.66 +...OUTPUT OMITTED... + +Notice in Examples 8-34 and 8-35 that the VRRP group IP address is the same as the SVI on SW2. As a result of this, SW2 will automatically be the virtual router master because it owns that IP address, regardless of what the priority is because it will give itself a pri- + + + +From the Library of Outcast Outcast +308 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +ority of 255 automatically. By default, VRRP uses a priority of 100 like HSRP. Also make note that preemption is on by default. Therefore, you do not have to manually enable it. + +VRRP Verification and Troubleshooting + +When verifying a VRRP configuration or troubleshooting a VRRP issue, you should begin by determining the following information about the VRRP group under inspection: + +■ Which router is the virtual router master? Key +Topic ■ How was the virtual router master chosen? + +■ Which routers, if any, are configured with the preempt option? (Enabled by default) + +■ What is the IP address of the virtual router? + +■ What is the virtual MAC address? + +■ Is object tracking on? + +You can use the show vrrp brief command to show which interface is participating in a VRRP group. It identifies the VRRP group number, the priority of the interface, whether it owns the IP being used as the virtual router IP, and whether preemption is enabled. In addition, this command will identify the current state of the router along with the master address and the group address. + +Examples 8-36 and 8-37 show the output from the show vrrp brief command issued on SW1 and SW2. Notice how SW2 is currently the master router for group 20. You can also see that preemption is enabled and that SW2 owns the IP address that is being used as the virtual router IP address. SW1 is in the backup state. + +Example 8-36 show vrrp brief Command Output on Router SW1 +Key +Topic SW1#show vrrp brief +Interface Grp Pri Time Own Pre State Master addr Group addr +Vl20 20 100 3609 Y Backup 10.1.1.66 10.1.1.66 + + +Example 8-37 show vrrp brief Command Output on SW2 + +SW2#show vrrp brief +Interface Grp Pri Time Own Pre State Master addr Group addr +Vl20 20 255 3003 Y Y Master 10.1.1.66 10.1.1.66 + +In Examples 8-36 and 8-37, notice how SW2 has a priority of 255. In the previous con-figuration examples, we did not configure the priority. We kept it at the default of 100. In this case, it is 255 because SW2 owns the IP that is being used as the virtual IP address. Therefore, it automatically changes its priority to 255 so that it becomes the virtual router master for the group. + +In addition to an interface’s VRRP group number, the state, the priority, and the VRRP group’s virtual IP address, the show vrrp interface interface_type interface_number command also displays the VRRP group’s virtual MAC address and the VRRP timers. + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 309 + +By default, VRRP timers are 1 second for the Advertisement interval and 3 seconds for the Master Down interval. Issuing this command on SW2, as shown in Example 8-38, shows that the virtual MAC address for VRRP group 20 is 0000.5e00.0114, the timers are default at 1 and 3, the priority is 255, and SW2 is the master router. + +Example 8-38 show vrrp interface vlan 20 Command Output on SW2 + +SW2#show vrrp interface vlan 20 +Vlan20 - Group 20 +State is Master +Virtual IP address is 10.1.1.66 +Virtual MAC address is 0000.5e00.0114 +Advertisement interval is 1.000 sec +Preemption enabled +Priority is 255 +Master Router is 10.1.1.66 (local), priority is 255 +Master Advertisement interval is 1.000 sec +Master Down interval is 3.003 sec + + +Virtual Router MAC Address + +The default virtual MAC address for a VRRP group, as shown in Figure 8-5, is based on the VRRP VRID, which is just a fancy way to identify the group number. Specifically, the virtual MAC address for a VRRP group begins with a vendor code of 0000.5e (IANA’s organizationally unique identifier [OUI]), followed with a well-known VRRP address block of 00.01. The last two hexadecimal digits are the hexadecimal representation of the VRID (group) number. For example, a VRRP group of 20 yields a default virtual MAC address of 0000.5e00.0114, because 20 in decimal equates to 14 in hexadecimal. + + + +Key Topic + +VRRP VRID 20 (Group) + +0000.5e00.0114 + +Vendor Well- VRRP Code known Group (IANA) VRRP Number +Code in Hex + +Figure 8-5 VRRP Virtual MAC Address + + +Object Tracking + + + +Key Topic + +Object tracking is a feature that most organizations will deploy when using VRRP. By default, VRRP will only detect a failure of the device itself or the path that is used by the hello packets. What about the uplinks from the routers running VRRP? If they fail, hello packets are still exchanged successfully, and the virtual master router is still available. Therefore, if the uplink is down, packets are dropped at the virtual master router because it cannot forward them. This is where object tracking comes into play. Object tracking enables you to control the priority of a router in a VRRP group based on the status of an +object. The object can be IP-related information such as a route, a group of objects, the + + + +From the Library of Outcast Outcast +310 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +status of an SLA probe, and the status of an interface. If the object is anything but up, the priority of the router can be decremented to a value that is lower than the standby router, and because preemption is enabled by default, the standby router will take over as the virtual master router because it now has the higher priority. You can use the show vrrp command to verify whether object tracking is configured, as shown in Example 8-39, and the state of the tracked object. + +Example 8-39 show vrrp Command Output on Router SW2 + +SW2#show vrrp +VLAN 20 - Group 20 +State is Backup +Virtual IP address is 10.1.1.126 +Virtual MAC address is 0000.5e00.0114 +Advertisement interval is 1.000 sec +Preemption enabled +Priority is 99 (cfgd 110) +Track object 1 state Down decrement 11 +Master Router is 10.1.1.65, priority is 100 +Master Advertisement interval is 1.000 sec +Master Down interval is 3.570 sec (expires in 3.026 sec) + +In the case of Example 8-39, you can see that the tracked object 1 is in a state of down, and when it is down, it will decrement the priority by 11. You can see the current priority is 99 and the configured priority is 110 (110 – 11 = 99). + +However, you need to find out what the tracked object is specifically so that you can trou-bleshoot further. Using the command show track you can verify what tracked object num-ber 1 is tracking. In Example 8-40, you can verify that it is the status of the line protocol on interface Gigabit Ethernet 1/0/10. It is admin-down and being tracked by VRRP group 20. + +Example 8-40 show track Command Output on Router SW2 + +SW2#show track +Track 1 +Interface GigabitEthernet1/0/10 line-protocol +Line protocol is Down (hw admin-down) +2 changes, last change 00:05:13 +Tracked by: +VRRP VLAN20 20 + +Now you would have to troubleshoot why the interface is down, which is beyond the scope of our VRRP discussion. + + +Verifying First Hop + + + +Key Topic + +Once you know the current VRRP configuration, you might then check to see whether a host on the VRRP virtual IP address’s subnet can ping the virtual IP address. Based on the +topology previously shown in Figure 8-4, Example 8-41 shows a successful ping from PC1. + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 311 + +Example 8-41 Ping Test from PC1 to the VRRP Virtual IP Address + +C:\PC1>ping 10.1.1.66 + +Pinging 10.1.1.66 with 32 bytes of data: + +Reply from 10.1.1.66: bytes=32 time=2ms TTL=255 +Reply from 10.1.1.66: bytes=32 time=1ms TTL=255 +Reply from 10.1.1.66: bytes=32 time=1ms TTL=255 +Reply from 10.1.1.66: bytes=32 time=1ms TTL=255 + +Ping statistics for 10.1.1.66: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 1ms, Maximum = 2ms, Average = 1ms + +However, that does not prove that we are using the virtual MAC address and VRRP. Therefore, from the client, you should also verify the virtual MAC address learned by the client corresponds to the virtual MAC address reported by the VRRP virtual router master. Example 8-42 shows Workstation A’s ARP cache entry for the VRRP virtual IP address of 10.1.1.66. Notice in the output that the MAC address learned via ARP does match the VRRP virtual MAC address of the master router. + +Example 8-42 PC1 ARP Cache + +C:\PC1>arp -a + +Interface: 10.1.1.74 --- 0x4 + +Internet Address +10.1.1.66 + +Physical Address +00-00-5e-00-01-14 + +Type +dynamic + + +However, as discussed with HSRP, one of the best tools to use with FHRPs to verify the path is traceroute. With traceroute, you can identify the physical first-hop router that the packets are traversing. Example 8-43 displays the tracert command executed on PC1. Notice that it states that the first hop is 10.1.1.66. This is the IP address of SW2’s VLAN 20 SVI. Therefore, you can conclude the SW2 is the virtual router master at the moment. Suppose, however, that a failure happened and SW1 became the virtual router master. The ARP cache would still be the same on PC1; however, the output of tracert on the PC would now display that the first hop is 10.1.1.65, as shown in Example 8-44. + +Example 8-43 A Trace from PC1 Confirming That SW2 Is the First Hop (Virtual Router Master) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 7 ms <1 ms 2 ms 10.1.1.66 +...output omitted... +Trace complete. + + + +From the Library of Outcast Outcast +312 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 8-44 A Trace from PC1 Confirming That SW1 Is the First Hop (Virtual Router Master) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 7 ms <1 ms 2 ms 10.1.1.65 +...output omitted... +Trace complete. + + +VRRP Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 8-6 . + + + +192.0.2.1 + + + +Gig 1/0/10 Gig 1/0/10 + + +Int VLAN 120 IPIP101.01..11..16.51/26 Backup + + +SW1 SW2 +VRRP GROUP 20 IP 10.1.1.66 + +Int VLAN 120 +IP 10.1.1.266/2/266 VRM + + +VRM=Virtual Router Master + +SW3 + + + +PC1 + + +IP 10.1.1.74/26 DG 10.1.1.66 + +Figure 8-6 VRRP Trouble Ticket Topology + + +Trouble Ticket 8-4 + +Problem: According to traffic statistics, all traffic for VLAN 20 is flowing through SW1 to reach the core instead of SW2. + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 313 + +You start by verifying the problem from PC1 on VLAN 20. In this case, the best tool is traceroute because it will identify the router hops (real IPs) along the path. All you care about is the first hop; is it 10.1.1.65 or 10.1.1.66? This will identify whether traffic is flow-ing though SW1 or SW2 to reach the core. Example 8-45 indicates that SW1 should be the VRRP virtual router master for the 10.1.1.64/26 network, because it was the first hop returned for the tracert command. + +Example 8-45 A Trace from PC1 Confirming That SW1 Is the First Hop (Master) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 2 ms 2 ms 1 ms 10.1.1.65 +...output omitted... +Trace complete. + +Next you need to confirm that this is in fact true by reviewing the output of VRRP show commands. Example 8-46 displays the output of show vrrp brief on SW1. Notice that under the State column it states Backup and the Master addr is 10.1.1.66, which is also the virtual IP address for the group. Therefore, SW1 is not the VRRP master, even though it is being used as the first hop. + +Example 8-46 show vrrp brief Command Output on SW1 + +SW1#show vrrp brief +Interface Grp Pri Time Own Pre State Master addr Group addr +Vl20 20 100 3609 Y Backup 10.1.1.66 10.1.1.66 + +Reviewing Figure 8-6 indicates that SW2 should be the virtual router master of the group, and it appears that it is. Now is an excellent time to review the output of show vrrp brief on SW2 to verify this. Example 8-47 indicates that SW2 is in the master state. + +Example 8-47 show standby brief Command Output on SW2 + +SW2#show vrrp brief +Interface Grp Pri Time Own Pre State Master addr Group addr +Vl20 20 255 3003 Y Y Master 10.1.1.66 10.1.1.66 + +What would be causing SW1 and SW2 to be in their correct states, yet the wrong device being used as the first hop? Recall that when a client makes an ARP request for the VRRP group MAC address, the virtual router master will respond with the group MAC address. In this case, it should be 0000.5e00.0114 for group 20. On PC1, you issue the arp -a com-mand, as shown in Example 8-48, to verify the MAC address being used by the client for the 10.1.1.66 address. It does not appear that the client is learning a VRRP MAC address, because none of the MAC addresses listed start with 0000.5e00.01. Also notice how the Internet address listed is 10.1.1.65, with a MAC of 28-93-fe-3a-e3-43. That is the IP and MAC address of interface VLAN 20 on SW1, as shown in Example 8-49, which displays the output of the show interface vlan 20 command. + + + + +From the Library of Outcast Outcast +314 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 8-48 Verifying PC1’s ARP Cache + +C:\PC1>arp -a + +Interface: 10.1.1.74 --- 0x2 + +Internet Address +10.1.1.65 + +Physical Address +28-93-fe-3a-e3-43 + +Type +dynamic + + + +Example 8-49 Verifying SW1’s SVI IP Address and MAC Address + +SW1#show interface vlan 20 +Vlan20 is up, line protocol is up +Hardware is EtherSVI, address is 2893.fe3a.e343 (bia 2893.fe3a.e343) +Internet address is 10.1.1.65/26 +...output omitted... + +It appears that the PCs might be configured with the wrong default gateway IP address. From the show commands you just reviewed, it seems as if they are using 10.1.1.65 as the default gateway address instead of the VRRP virtual IP of 10.1.1.66. Using the command ipconfig on PC1, you confirm that the default gateway is 10.1.1.65 and not 10.1.1.66, as shown in Example 8-50. + +Example 8-50 Verifying the Default Gateway on PCs + +C:\PC1>ipconfig +Windows IP Configuration + +Ethernet adapter PC1: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.1.74 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +IP Address. . . . . . . . . . . . : 2001:20::20 +IP Address. . . . . . . . . . . . : fe80::a00:27ff:fea2:ce47%4 +Default Gateway . . . . . . . . . : 10.1.1.65 + +You contact the administrator of the DHCP server and inform him of the issue. After the adjustments are made and the clients have the correct default gateway, as shown in +Example 8-51, you reissue the tracert command and confirm that SW2 (10.1.1.66) is being used as the first hop, as shown in Example 8-51 as well. + +Example 8-51 Verifying the Default Gateway on PCs After Adjustments + +C:\PC1>ipconfig +Windows IP Configuration + +Ethernet adapter PC1: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.1.74 + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 315 + +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +IP Address. . . . . . . . . . . . : 2001:20::20 +IP Address. . . . . . . . . . . . : fe80::a00:27ff:fea2:ce47%4 +Default Gateway . . . . . . . . . : 10.1.1.66 + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 3 ms 1 ms 2 ms 10.1.1.66 +...output omitted... +Trace complete. + +However, it is important that you confirm the correct VRRP MAC address is being used by checking the ARP cache on the PCs. In Example 8-52, you confirm with the arp -a command that the MAC address of 0000.5e00.0114 for group 20 is being used. + +Example 8-52 Verifying PC1’s ARP Cache After Adjustments + +C:\PC1>arp -a + +Interface: 10.1.1.74 --- 0x2 + +Internet Address +10.1.1.66 + +Physical Address +00-00-5e-00-01-14 + +Type +dynamic + + + +Trouble Ticket 8-5 + +Problem: According to traffic statistics, when the uplink between SW3 and SW2 goes down, all traffic for VLAN 20 is flowing through SW3, SW1, and then SW2 and routed out to the core, as shown in Figure 8-7. (Note that the default gateway IP address differs from the previous figures.) + +If the uplink between SW3 and SW2 is not available, SW1 should become the VRRP vir-tual router master so that traffic flow is optimized in the LAN. + +You start verifying the problem by shutting down the link between SW3 and SW2. You then trace the path from PC1 to an IP address outside the LAN. All you care about is the first hop; is it 10.1.1.65 or 10.1.1.66? This will identify whether traffic is flowing though SW1 or SW2 to reach the core. Example 8-53 indicates that SW2 is in fact the VRRP vir-tual router master for the 10.1.1.64/26 network, because it was the first hop returned for the tracert command. + +Example 8-53 A Trace from PC1 Confirming That SW2 Is the First Hop (Master) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 2 ms 2 ms 2 ms 10.1.1.66 +...output omitted... +Trace complete. + + + +From the Library of Outcast Outcast +316 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +192.0.2.1 + + + + +Gig 1/0/10 Gig 1/0/10 + + +Int VLAN 210 SW1 IPIP101.01..11..16.51/26 +SBtanckdubpy + + +VRRP GROUP 20 IP 10.1.1.126 + +Int VLAN 120 SW2 IP 10.1.1.26/62/626 +Gi1/0/2 VRM + + +VRM=Virtual Router Master + +SW3 + + + +PC1 + + +IP 10.1.1.74/26 DG 10.1.1.126 + +Figure 8-7 VRRP Suboptimal Traffic Flow Topology + +Next you need to confirm that this is in fact true by reviewing the output of VRRP show commands. Example 8-54 displays the output of show vrrp brief on SW2. Notice that under the State column it states Master and the Master addr is 10.1.1.66 (SW2) for the group address 10.1.1.126. All looks fine so far. + +Example 8-54 show vrrp brief Command Output on SW2 + +SW2#show vrrp brief +Interface Grp Pri Time Own Pre State Master addr Group addr +Vl20 20 100 3570 Y Master 10.1.1.66 10.1.1.126 + +Next you review the output of show vrrp, as shown in Example 8-55. In this output, you notice that SW2 is the master but that there is a problem with the priority. The config-ured priority is 110, but the current is 100. As a result, it has been decremented dynami-cally. This can be verified with the tracked object that is currently down. It indicates that the tracking object 1 is down, and when it is down, the priority will be decremented by 10 (110 – 10 = 100). + +Example 8-55 show vrrp Command Output on SW2 + +SW2#show vrrp +Vlan20 - Group 20 +State is Master + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 317 + +Virtual IP address is 10.1.1.126 +Virtual MAC address is 0000.5e00.0114 +Advertisement interval is 1.000 sec +Preemption enabled +Priority is 100 (cfgd 110) +Track object 1 state Down decrement 10 +Master Router is 10.1.1.66 (local), priority is 100 +Master Advertisement interval is 1.000 sec +Master Down interval is 3.570 sec + +What is tracking object 1? To verify, you execute the show track command on SW2. As Example 8-56 displays, the output of show track indicates that you are tracking the line protocol of Gigabit Ethernet 1/0/2 for VRRP on interface VLAN 20 for group 20. At this point in time, Gigabit Ethernet 1/0/2 is down, and as a result, VRRP decremented the pri-ority by 10, as you saw in Example 8-55. However, SW2 is still the virtual router master for group 20 even though the priority is being decremented. + +Example 8-56 show track Command Output on SW2 + +SW2#show track +Track 1 +Interface GigabitEthernet1/0/2 line-protocol +Line protocol is Down (hw down) +6 changes, last change 01:39:45 +Tracked by: +VRRP Vlan20 20 + +Next you verify the priority on SW1 with the show vrrp command, as shown in Example 8-57. The output clearly shows that the priority of SW1 is 100, which is the same as +SW2. Reviewing the output of show vrrp for SW1 and SW2 identifies that preemption is enabled. If that is the case, and the priority is tied, why is SW2 the virtual router master? When priority is tied, the IP address of the LAN interface participating in VRRP is used as the tiebreaker, just like HSRP. Because SW2 has the higher LAN IP address, it is the virtual router master. + +Example 8-57 show vrrp Command Output on SW1 + +SW1#show vrrp +Vlan20 - Group 20 +State is Backup +Virtual IP address is 10.1.1.126 +Virtual MAC address is 0000.5e00.0114 +Advertisement interval is 1.000 sec +Preemption enabled +Priority is 100 +Master Router is 10.1.1.66, priority is 100 +Master Advertisement interval is 1.000 sec +Master Down interval is 3.609 sec (expires in 3.575 sec) + + + +From the Library of Outcast Outcast +318 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +How can you make sure that SW1 takes over as the virtual router master if the uplink between SW3 and SW2 fails? In this case, make sure that the priority of SW2 is dropped below that of SW1. On SW2, you issue the vrrp track 1 decrement 11 command in interface VLAN 20 configuration mode. As soon as you do this, a syslog message is dis-played on SW2, as follows: + +%VRRP-6-STATECHANGE: Vl20 Grp 20 state Master -> Backup On SW1, the following syslog message is displayed: +%VRRP-6-STATECHANGE: Vl20 Grp 20 state Backup -> Master +You now reissue the tracert command on PC1 to verify the first hop. It is now SW1, as shown in Example 8-58. + +Example 8-58 A Trace from PC1 Confirming That SW1 Is the First Hop (Master) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 2 ms 2 ms 2 ms 10.1.1.65 +...output omitted... +Trace complete. + +Next you enable the interface between SW3 and SW2 with the no shutdown command and receive the following syslog message on SW2: + +%TRACKING-5-STATE: 1 interface Gi1/0/2 line-protocol Down->Up %VRRP-6-STATECHANGE: Vl20 Grp 20 state Backup -> Master +Because the interface is up, the tracking object is up, which means that SW2’s priority goes back to 110, and SW2 becomes the virtual router master. You then reissue the trac-ert command on PC1 to verify the first hop. It is now SW2, as shown in Example 8-59. + +Example 8-59 A Trace from PC1 Confirming That SW2 Is the First Hop (Master) + +C:\PC1>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 2 ms 2 ms 2 ms 10.1.1.66 +...output omitted... +Trace complete. + + +Troubleshooting GLBP + +Whereas HSRP can only have one active forwarder for each group, Gateway Load Balancing Protocol (GLBP) can have multiple forwarders for each group. Therefore, GLBP can load balance traffic destined for a next-hop gateway across a collection of routers within the GLBP group. + +This section explains the GLBP active virtual gateway (AVG) and active virtual forwarder (AVF) concepts and how to verify and troubleshoot issues related to GLBP. + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 319 + +Reviewing GLBP + + + +Key Topic + +With GLBP, there is one AVG and up to four AVFs in a group. The AVG is responsible for handing out the AVF MAC addresses to the hosts in the LAN. Therefore, it is responsible for replying to ARP requests for the MAC address of the default gateway. Note that the AVG is usually an AVF as well. The AVFs are responsible for processing the frames that are sent to their MAC address. + +Figure 8-8 shows a GLBP topology example. R1 is the AVG, and R1 and R2 are AVFs. The virtual router IP address that will be used as the default gateway on all the hosts is 10.1.1.62. When Workstation A sends an ARP request for the MAC address of 10.1.1.62, +R1 (AVG) responds with the MAC of 0007.b400.0a01. When Workstation B sends an ARP request for the MAC address of 10.1.1.62, R1 (AVG) responds with the MAC of 0007. b400.0a02. The next workstation that sends an ARP request will get 0007.b400.0a01 and then 0007.b400.0a02, and so on. This is the default behavior known as round-robin, which can be changed with the glbp group_id load-balancing interface configuration command. The other options are host-dependent and weighted. + +As you can see from Figure 8-8, Workstation A sends default gateway destined traffic to +R1, and Workstation B sends default gateway destined traffic to R2. + + + + + + +Active Virtual Gateway (AVG) Active Virtual Forwarder (AVF) GLBP IPAddress = 10.1.1.62 +Virtual MAC = 0007.b400.0a01 Gi3/0 + +192.0.2.1 Core + + + +AVF +GLBP IPAddress = 10.1.1.62 Virtual MAC = 0007.b400.0a02 + + + +Gi0/0 + +ARP Request + +R1 ARP Reply R2 +10.1.1.1 10.1.1.2 Gi0/0 + + +ARP Reply ARP Request + + +Next-Hop GW = 10.1.1.62 with a MAC of 0007.b400.0a01 + +Next-Hop GW = 10.1.1.62 with a MAC of 0007.b400.0a02 + + + +Workstation A 10.1.1.10 + +Workstation B 10.1.1.20 + + +Figure 8-8 Basic GLBP Operation + +Examples 8-60 and 8-61 show the possible GLBP configurations for routers R1 and R2. + +Example 8-60 Possible GLBP Configuration on Router R1 + +R1#show run interface gigabitethernet 0/0 +Building configuration... + +Current configuration : 269 bytes +! + + +From the Library of Outcast Outcast +320 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +interface GigabitEthernet0/0 +ip address 10.1.1.1 255.255.255.192 +glbp 10 ip 10.1.1.62 +glbp 10 priority 150 +glbp 10 preempt +glbp 10 weighting 110 lower 90 upper 100 +glbp 10 load-balancing weighted +end + + +Example 8-61 Possible GLBP Configuration on Router R2 + +R2#show run interface gigabitethernet 0/0 +Building configuration... + +Current configuration : 237 bytes +! +interface GigabitEthernet0/0 +ip address 10.1.1.2 255.255.255.192 +glbp 10 ip 10.1.1.62 +glbp 10 preempt +glbp 10 weighting 100 lower 80 +glbp 10 load-balancing weighted +end + +Notice that both routers R1 and R2 have been configured with the same virtual IP address of 10.1.1.62 for GLBP group 10. Router R1 is configured to be the AVG with a higher priority using the glbp 10 priority 150 command. Router R2 has a default GLBP priority of 100, and with GLBP, higher-priority values are more preferable. Also, notice that both routers are configured with the glbp 10 preempt command. This ensures that the router with the higher priority will be the AVG. Remember that preemption is not enabled by default for the AVG election process. + +The last two commands in Examples 8-60 and 8-61 relate to the AVFs and how their MAC addresses will be handed out to hosts on the LAN by the AVG, and whether they will be allowed to forward traffic. By default, the MACs will be handed out in a +round-robin fashion. However, in these examples, load balancing has been configured to weighted. This means that the initial weighting value defined in the glbp 10 weighting command will determine the ratio that will be used to hand out MAC addresses. In this case, the AVG will hand out the MAC addresses in a 110:100 ratio, or 11:10 ratio. This means that R1’s virtual MAC address will be given to clients 11 times for every 10 times that R2’s virtual MAC address will be given out. Therefore, R1 will handle more hosts on average than R2. The lower and upper values are related to when the AVF will lose its ability to forward traffic for its virtual MAC address and when it will regain its ability to forward traffic for its virtual MAC address. Referring to Example 8-60 again, notice that R1’s lower limit is 90. This means that R1 will lose its ability to forward traffic for its vir- +tual MAC address if its weighting drops below 90. It will regain its ability to forward traf-fic for its virtual MAC address if its weighting goes back above 100. The initial weighing + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 321 + +value is 110. Notice that R2 in Example 8-61 has no upper weighting, which means that it is the same as the initial weighting. + +GLBP Verification and Troubleshooting + +When verifying a GLBP configuration or troubleshooting a GLBP issue, begin by deter-mining the following information about the GLBP group under inspection: + +■ Which router is the AVG? +Key +Topic ■ Which routers are the AVFs? + +■ How was the AVG chosen? + +■ Which routers, if any, are configured with the preempt option? + +■ What is the IP address of the virtual router? + +■ What are the AVFs virtual MAC addresses? + +■ Is object tracking on? + +The show glbp brief command displays a great deal of GLBP information. Examples 8-62 and 8-63 provide samples of the show glbp brief command. The output identifies the interfaces that are participating in a GLBP group. It identifies who the AVFs are under the Fwd column. The – refers to the AVG information, and the numbers 1 and 2 refer +to the AVFs in the group. The Priority column is used to display the priority used dur-ing the AVG election process. The State column identifies the state of the device for the group. If it is the AVG row, in this case the top row, active means that it is the AVG, and standby means that it is waiting to become the AVG if the AVG fails. For the second and third rows, it is referring to the state of the AVF. In these examples, active means that the router is forwarding for the virtual MAC address in the Address column. Listen means that the router is waiting to take over the forwarding process for the virtual MAC address in the Address column if the router listed in the Active Router column is no longer able to forward traffic for the virtual MAC address. + +Example 8-62 show glbp brief Command Output on Router R1 +Key +Topic R1#show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 10 - 150 Active 10.1.1.62 local 10.1.1.2 + +Gi0/0 10 1 - Active +Gi0/0 10 2 - Listen + +0007.b400.0a01 +0007.b400.0a02 + +local - +10.1.1.2 - + + + +Example 8-63 show glbp brief Command Output on Router R2 + +R2#show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 10 - 100 Standby 10.1.1.62 10.1.1.1 local + +Gi0/0 10 1 - Listen +Gi0/0 10 2 - Active + +0007.b400.0a01 +0007.b400.0a02 + +10.1.1.1 - +local - + + + + +From the Library of Outcast Outcast +322 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +The show glbp command output provides significant details about the GLBP groups, as shown in Example 8-64. In the output, you can verify the group number and the interface associated with it. You can determine whether it is the AVG based on whether it is active or standby. The virtual IP address, the hello and hold timers, and the status of preemption is also listed. Depending on the state of the device, you will be able to verify the active +or standby routers IP address and its priority. You will also be able to see your current local priority and the configured priority. This is a great command to verify the weight-ing values, the type of load balancing being used, and the members of the group, which are identified by their physical MAC address and IP address associated with the interface participating in the GLBP group. + +Example 8-64 show glbp Command Output on Router R1 + +R1#show glbp gigabitethernet0/0 +GigabitEthernet0/0 - Group 10 +State is Active +1 state change, last state change 00:31:34 +Virtual IP address is 10.1.1.62 +Hello time 3 sec, hold time 10 sec +Next hello sent in 1.568 secs +Redirect time 600 sec, forwarder time-out 14400 sec +Preemption enabled, min delay 0 sec +Active is local +Standby is 10.1.1.2, priority 100 (expires in 9.984 sec) +Priority 150 (configured) +Weighting 110 (configured 110), thresholds: lower 90, upper 100 +Track object 1 state Up decrement 25 +Load balancing: weighted +Group members: +ca12.0854.0008 (10.1.1.2) +ca13.0854.0008 (10.1.1.1) local +There are 2 forwarders (1 active) +Forwarder 1 +State is Active +3 state changes, last state change 00:03:35 +MAC address is 0007.b400.0a01 (default) +Owner ID is ca13.0854.0008 +Redirection enabled +Preemption enabled, min delay 30 sec +Active is local, weighting 110 +Forwarder 2 +State is Listen +MAC address is 0007.b400.0a02 (learnt) +Owner ID is ca12.0854.0008 +Redirection enabled, 600.000 sec remaining (maximum 600 sec) +Time to live: 14400.000 sec (maximum 14400 sec) +Preemption enabled, min delay 30 sec +Active is 10.1.1.2 (primary), weighting 100 (expires in 11.232 sec) + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 323 + +Still referring to Example 8-64, focus on the area related to the forwarders. This informa-tion is related to the AVFs in the group. In this case, you can verify that there are two AVFs. This router is currently active for Forwarder 1, meaning that it is forwarding for the MAC address 0007.b400.0a01 that is listed. It also states who the current owner is of the virtual MAC address, based on the physical MAC address of the device. The owner is the device currently responsible for forwarding traffic for the virtual MAC address. R1 is in the listen state for Forwarder 2, meaning that it is waiting for the current owner of the virtual MAC 0007.b400.0a02 to no longer be able to forward for the MAC so that it can take over. + +Virtual Router MAC Addresses + +The default virtual MAC address for the AVFs in a GLBP group, as shown in Figure 8-9, is based on the group number and the AVF forwarder ID within the group. Specifically, the virtual MAC address for a GLBP group begins with a well-known GLBP code of 0007. b400. The next two hexadecimal digits represent the group number. The last two hexa-decimal digits represent the forwarder ID within the group. For example, a GLBP group of 43 yields a default virtual MAC address for AVF 1 of 0007.b400.2b01, because 43 in decimal equates to 2b in hexadecimal. For AVF 2, it would be 0007.b400.2b02, and for AVF 3, it would be 0007.b400.2b03. + +Key GLBP Group 43 Topic 0007.b400.2b02 + + +Well-known GLBP Code + +Figure 8-9 + +GLBP AVF Group ID +Number in Hex + +GLBP Virtual MAC Address + + + + + + +Key Topic + +GLBP Object Tracking + +As with VRRP, you can implement object tracking. By default, GLBP will only detect a failure of the device itself or the path that is used by the hello packets. That is perfectly fine for the AVG because a failure of an uplink outside the LAN will not affect the AVG because hello packets are still exchanged successfully, and the AVG is still reachable. However, what about the AVFs? If the uplinks fail, the AVF cannot forward packets for the virtual IP and MAC it owns. This is where object tracking comes into play for the AVFs. Object tracking allows you to control the weighting of an AVF in a GLBP group based on the status of an object. The object can be IP-related information such as a +route, a group of objects, the status of an SLA probe, and the status of an interface. If the object is anything but up, the weight of the router can be decremented to a value that is lower than a configured threshold so that another AVF can forward on behalf of the rout-er that cannot. You can use the show glbp command to verify whether object tracking is +configured, as shown in Example 8-65, and the state of the tracked object. + + + + + + +From the Library of Outcast Outcast +324 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 8-65 show glbp Command Output on Router R1 + +R1#show glbp +GigabitEthernet0/0 - Group 10 +State is Active +1 state change, last state change 00:31:34 +Virtual IP address is 10.1.1.62 +Hello time 3 sec, hold time 10 sec +Next hello sent in 1.568 secs +Redirect time 600 sec, forwarder time-out 14400 sec +Preemption enabled, min delay 0 sec +Active is local +Standby is 10.1.1.2, priority 100 (expires in 9.984 sec) +Priority 150 (configured) +Weighting 110 (configured 110), thresholds: lower 90, upper 100 +Track object 1 state Up decrement 25 +Load balancing: weighted +Group members: +ca12.0854.0008 (10.1.1.2) +ca13.0854.0008 (10.1.1.1) local +There are 2 forwarders (1 active) +Forwarder 1 +State is Active +3 state changes, last state change 00:03:35 +MAC address is 0007.b400.0a01 (default) +Owner ID is ca13.0854.0008 +Redirection enabled +Preemption enabled, min delay 30 sec +Active is local, weighting 110 +Forwarder 2 +State is Listen +MAC address is 0007.b400.0a02 (learnt) +Owner ID is ca12.0854.0008 +Redirection enabled, 600.000 sec remaining (maximum 600 sec) +Time to live: 14400.000 sec (maximum 14400 sec) +Preemption enabled, min delay 30 sec +Active is 10.1.1.2 (primary), weighting 100 (expires in 11.232 sec) + +In the case of Example 8-65, you can see that the tracked object 1 is in a state of up. However, if the tracked object goes down, the weighting will be decremented by 25, +and as a result, the weighting will be lower than the lower threshold of 90 and R1 will no longer be able to be the AVF for MAC 0007.b400.0a01. AVF2, which is R2, will have to forward for both MAC addresses at this point. + +However, if you need to find out what the tracked object is specifically so that you can troubleshoot further, use the command show track, as shown in Example 8-66. In this output, the line protocol of interface Gigabit Ethernet 3/0 is being tracked by GLBP. + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 325 + +Example 8-66 show track Command Output on R1 + +R1#show track +Track 1 +Interface GigabitEthernet3/0 line-protocol +Line protocol is Up +3 changes, last change 00:05:56 +Tracked by: +GLBP GigabitEthernet0/0 10 + + + + + +Key Topic + +Verifying GLBP First Hop + +Once you know the current GLBP configuration, you might then check to see whether a host on the GLBP virtual IP address’s subnet can ping the virtual IP address. Based on +the topology previously shown in Figure 8-8, Example 8-67 shows a successful ping from +Workstation A. + + +Example 8-67 Ping Test from Workstation A to the GLBP Virtual IP Address + +C:\>ping 10.1.1.62 + +Pinging 10.1.1.62 with 32 bytes of data: + +Reply from 10.1.1.62: bytes=32 time=2ms TTL=255 +Reply from 10.1.1.62: bytes=32 time=1ms TTL=255 +Reply from 10.1.1.62: bytes=32 time=1ms TTL=255 +Reply from 10.1.1.62: bytes=32 time=1ms TTL=255 + +Ping statistics for 10.1.1.62: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 1ms, Maximum = 2ms, Average = 1ms + +However, that does not prove that we are using the virtual MAC address and GLBP suc-cessfully. Therefore, from the client, you should also verify that the virtual MAC address learned by the client corresponds to the virtual MAC address reported by the GLBP AVG. Example 8-68 shows Workstation A’s ARP cache entry for the GLBP virtual IP address of 10.1.1.62. Notice in the output that the MAC address learned via ARP does match the GLBP virtual MAC address of the first AVF. + +Example 8-68 Workstation A’s ARP Cache + +C:\>arp -a + +Interface: 10.1.1.10 --- 0x4 + +Internet Address +10.1.1.62 + +Physical Address +00-07-b4-00-0a-01 + +Type +dynamic + + + + + +From the Library of Outcast Outcast +326 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +However, as discussed with HSRP and VRRP, one of the best tools to use with FHRPs to verify the path is traceroute. With traceroute, you can identify the physical first-hop router that the packets are traversing. Example 8-69 displays the tracert command +executed on Workstation A. Notice that it states that the first hop is 10.1.1.1. This is the IP address of R1’s Gig0/0 interface. Example 8-70 displays the tracert command executed on Workstation B. Notice that it states that the first hop is 10.1.1.2. This is the IP address on R2’s Gig0/0 interface. But remember in both cases they are configured to use the vir-tual IP 10.1.1.62 and are dynamically provided a virtual MAC address based on the AVG load-balancing method. + +Example 8-69 A Trace from Workstation A Confirming That R1 Is the First Hop (AVF) + +C:\>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 2 ms 2 ms 2 ms 10.1.1.1 +...output omitted... +Trace complete. + + +Example 8-70 A Trace from Workstation B Confirming That R2 Is the First Hop (AVF) + +C:\>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 2 ms 2 ms 2 ms 10.1.1.2 +...output omitted... +Trace complete. + + +GLBP Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 8-10. + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 327 + + + + + +Active Virtual Gateway (AVG) Active Virtual Forwarder (AVF) GLBP IPAddress = 10.1.1.62 Virtual MAC = 0007.b400.0a01 + +192.0.2.1 Core + + +AVF +GLBP IPAddress = 10.1.1.62 Virtual MAC = 0007.b400.0a02 + + +R1 R2 Gi0/0 10.1.1.1 10.1.1.2 Gi0/0 + + + + + +Next-Hop GW = 10.1.1.62 with a MAC of 0007.b400.0a01 + +Next-Hop GW = 10.1.1.62 with a MAC of 0007.b400.0a02 + + + +Workstation A 10.1.1.10 + +Workstation B 10.1.1.20 + + +Figure 8-10 GLBP Trouble Ticket Topology + + +Trouble Ticket 8-6 + +Problem: A junior administrator has stated that GLBP is behaving strangely. + +With a puzzled look on your face, you ask the junior admin to show you what she means. The junior admin provides the output shown in Example 8-71 and Example 8-72. You review them, and then ask the junior administrator to explain. + +Example 8-71 Output of show glbp brief on R1 + +R1#show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 10 - 150 Active 10.1.1.62 local unknown + +Gi0/0 10 1 +Gi0/0 10 2 + +- Active +- Active + +0007.b400.0a01 local - +0007.b400.0a02 local - + + + +Example 8-72 Output of show glbp brief on R2 + +R2#show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 10 - 100 Active 10.1.1.62 local unknown + +Gi0/0 10 1 +Gi0/0 10 2 + +- Active +- Active + +0007.b400.0a01 local - +0007.b400.0a02 local - + + +The junior administrator indicates that R1 and R2 are both in group 10. R1 has a priority of 150, and R2 has a priority of 100. However, they are both indicating that they are the AVG for the virtual address 10.1.1.62. In addition, R1 and R2 are both stating that they are the AVFs for the MAC addresses listed. + + +From the Library of Outcast Outcast +328 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +You then ask the junior admin, “Why would they both consider themselves as the AVG and AVFs?” The junior admin replies, “They don’t know each other is on the LAN and participating in GLBP group 10.” You grin and state, “That is correct. Now find out why!” + +The junior admin issues the command show glbp on R1 and R2, as displayed in Examples 8-73 and 8-74, and reviews them hoping to spot the difference. The output confirms +that both R1 and R2 are the AVG for group 10 because it states “State is Active” near the top. The virtual IP is the same at 10.1.1.62. The timers are the same, although they do not have to be as long as they do not cause flapping neighbor relationships. At this point, the junior admin spots the difference. Do you see it? + +Example 8-73 Output of show glbp on R1 + +R1#show glbp brief +GigabitEthernet0/0 - Group 10 +State is Active +3 state changes, last state change 00:23:29 +Virtual IP address is 10.1.1.62 +Hello time 3 sec, hold time 10 sec +Next hello sent in 0.288 secs +Redirect time 600 sec, forwarder time-out 14400 sec +Authentication text, string "TSHOOT" +Preemption enabled, min delay 0 sec +Active is local +Standby is unknown +Priority 150 (configured) +...output omitted... + + +Example 8-74 Output of show glbp on R2 + +R2#show glbp brief +GigabitEthernet0/0 - Group 10 +State is Active +8 state changes, last state change 00:21:32 +Virtual IP address is 10.1.1.62 +Hello time 3 sec, hold time 10 sec +Next hello sent in 2.592 secs +Redirect time 600 sec, forwarder time-out 14400 sec +Authentication MD5, key-string +Preemption enabled, min delay 0 sec +Active is local +Standby is unknown +Priority 100 (default) +... output omitted... + +R1 is using plain-text GLBP authentication, and R2 is using message digest 5 (MD5) GLBP authentication. They are both using authentication, but the type of authentica-tion does not match. Therefore, they know each other is there, but because they cannot + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 329 + +authenticate each other, they consider each other to be rogue GLBP devices and will not accept the GLBP information from each other. + +Your security policy states to use MD5 authentication, so you change R1 with the com-mand glbp 10 authentication md5 key-string TSHOOT in interface configuration mode. You then check the output of show glbp brief on R1 and R2, as shown in Examples 8-75 and 8-76, to verify whether the output has changed. It has. R1 is the AVG and AVF for the first MAC, and R2 is standby and the AVF for the second MAC. + +Example 8-75 Output of show glbp brief on R1 + +R1#show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 10 - 150 Active 10.1.1.62 local 10.1.1.2 + +Gi0/0 10 1 +Gi0/0 10 2 + +- Active +- Listen + +0007.b400.0a01 +0007.b400.0a02 + +local - +10.1.1.2 - + + + +Example 8-76 Output of show glbp brief on R2 + +R2#show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 10 - 100 Standby 10.1.1.62 10.1.1.1 local + +Gi0/0 10 1 +Gi0/0 10 2 + +- Listen +- Active + +0007.b400.0a01 +0007.b400.0a02 + +10.1.1.1 - +local - + + + +Trouble Ticket 8-7 + +Problem: The uplink has failed between R2 and the core; however, R2 is still the AVF for MAC 0007.b400.0a02 when it should be R1. + +Let’s shoot from the hip this time! + +Brainstorm: Uplink failed + R2 still AVF when it should not be = object tracking and weight issue? + +Let’s use the show glbp command to see what the weight of R2 is and whether object tracking is enabled. Example 8-77 displays the output of show glbp on R2, and it clearly indicates that we are tracking object 1, which is down, and when it is down, the weighting will be decremented by 20, which it has been because the configured weight is 100 and the current weight is 80. However, R2’s weighting still has not passed the lower threshold. Therefore, it will still be the AVF for the MAC address assigned to it by the AVG. + +Example 8-77 Output of show glbp on R2 + +R2#show glbp +GigabitEthernet0/0 - Group 10 +State is Standby +10 state changes, last state change 00:20:58 +Virtual IP address is 10.1.1.62 + + + + +From the Library of Outcast Outcast +330 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Hello time 3 sec, hold time 10 sec +Next hello sent in 0.736 secs +Redirect time 600 sec, forwarder time-out 14400 sec +Authentication MD5, key-string +Preemption enabled, min delay 0 sec +Active is 10.1.1.1, priority 150 (expires in 8.480 sec) +Standby is local +Priority 100 (default) +Weighting 80 (configured 100), thresholds: lower 80, upper 100 +Track object 1 state Down decrement 20 +Load balancing: weighted + +To solve this problem, you need to modify the glbp 10 weighting track 1 command so that the decrement is greater than 20 (for example, glbp 10 weighting track 1 decrement 21). When you do so, R1 will be the AVF for both MACs. On R1, you can confirm this with the show glbp brief command, as shown in Example 8-78. + +Example 8-78 Output of show glbp brief on R1 + +R1#show glbp brief +Interface Grp Fwd Pri State Address Active router Standby router +Gi0/0 10 - 150 Active 10.1.1.62 local 10.1.1.2 + +Gi0/0 10 1 +Gi0/0 10 2 + +- Active +- Active + +0007.b400.0a01 local - +0007.b400.0a02 local - + + + +Comparing HSRP, VRRP, and GLBP + +As you have witnessed in this chapter, HSRP, VRRP, and GLBP are very similar. The output provided by the show commands is similar as well. It is important to note that the issues will be similar with these FHRPs, making them easy to troubleshoot for most. +However, although HSRP, VRRP, and GLBP have commonalities, it is important for you as a troubleshooter to understand the differences to make sure that you are troubleshooting as efficiently as possible. Table 8-2 compares several characteristics of these FHRPs. + +Key Table 8-2 Comparing HSRP, VRRP, and GLBP +Topic Characteristic HSRP VRRP GLBP + + +Cisco proprietary. + +Interface IP address can act as virtual IP address. +More than one router in a group can simultaneously forward traffic for that group. +Hello timer default value. + +Yes + +No + +No + + +3 seconds + +No + +Yes + +No + + +1 second + +Yes + +No + +Yes + + +3 seconds + + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 331 + + + +Characteristic +Hold timer default value. Preemption enabled by default. + +Default priority. + +Default weight. + +Authentication supported. + +Multicast address. + +HSRP +10 seconds No + +100 + +— + +Yes + +224.0.0.2 + +VRRP +3 seconds Yes + +100 + +— + +Yes + +224.0.0.18 + +GLBP +10 seconds + +No for AVG, Yes for AVFs +100 + +100 + +Yes + +224.0.0.102 + + + +Virtual MAC address. + +(xx = group number)(yy = AVF) + +V1: 0000.0c07.acxx 0000.5e00.01xx 0007.b400.xxyy + +V2: 0000.0c9f.fxxx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +332 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 8-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 8-3 Key Topics for Chapter 8 +Key +Topic Key Topic Element Description Page Number + +Paragraph + +List + +Example 8-3 + +Figure 8-2 + +Section + +Section + +Section + +List + +Example 8-36 + +Figure 8-5 + +Section + +Section + +Section + +List + +Example 8-62 + +Figure 8-9 + +Section + +Section + +Table 8-2 + +Describes how to configure an HSRP group and 291 explains priority and preempt +Identifies HSRP parameters that should be verified 292 while troubleshooting HSRP issues +show standby brief command output on Router R1 292 + +HSRPv1 virtual MAC address 293 + +Interface tracking 293 + +Verifying first hop 294 + +Reviewing VRRP 306 + +Identifies VRRP parameters that should be verified 308 while troubleshooting issues +show vrrp brief command output on router SW1 308 + +VRRP virtual MAC address 309 + +Object tracking 309 + +Verifying first hop 310 + +Reviewing GLBP 319 + +Identifies GLBP parameters that should be verified 321 while troubleshooting HSRP issues +show glbp brief command output on router SW1 321 + +GLBP virtual MAC address 323 + +GLBP object tracking 323 + +Verifying GLBP first hop 325 + +Comparing HSRP, VRRP, and GLBP 330 + + + + +From the Library of Outcast Outcast +Chapter 8: Troubleshooting First-Hop Redundancy Protocols 333 + +Define Key Terms +Define the following key terms from this chapter and check your answers in the glossary: + +HSRP, VRRP, GLBP, priority, preempt, interface tracking, object tracking, virtual rout-er, virtual MAC address, active forwarder, standby router, virtual master router, virtual router backup, AVG, AVF, weighting + +Complete Tables and Lists from Memory +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + +Command Reference to Check Your Memory +This section includes the most important show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. +To test your memory of the commands, cover the right side of Table 8-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to troubleshoot issues related to the topics covered in this chapter. + +Table 8-4 show commands + +Task Command Syntax + +Displays a summary of the HSRP standby group configuration on a switch or router +Displays details of the HSRP standby group configuration on a switch or router interface, including timers and tracked interfaces or objects +Displays the commands configured on a router or switch interface + +Displays a summary of the VRRP group configuration on a switch or router + + +show standby brief + +show standby interface_ type interface_number + +show run interface_type interface_number +show vrrp brief + +Displays details of the VRRP group configuration on a switch show vrrp interface_type or router interface, including timers and tracked objects interface_number + + +Displays the tracking objects configured on the router or switch +Displays a summary of the GLBP group configuration on a switch or router +Displays details of the GLBP group configuration on a router interface, including timers, who the AVG is, who the AVFs are, in addition to tracked objects + + +show track + +show glbp brief + +show glbp interface_type interface_number + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting IPv4 Addressing: This section focuses on how you can verify that devices are addressed correctly in the network during your troubleshooting process. + +■ Troubleshooting DHCP for IPv4: This section reviews the DHCP for IPv4 operations and identi-fies how you can successfully troubleshoot DHCP related issues. + +■ Troubleshooting NAT: This section explains the rea-sons why NAT may not be translating addresses and how to recognize them. + +■ IPv4 Addressing and Addressing Technologies Trouble Tickets: This section provides trouble tick-ets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 9 + + + + +Troubleshooting IPv4 Addressing and Addressing Technologies + + +Although IPv6 is currently being deployed, it is being done at a slow pace. Therefore, most networks are still relying on IPv4, and many new networks and network additions are being deployed with IPv4. Therefore, as a troubleshooter, you need the skills neces-sary to successfully identify issues related to improper IPv4 addressing on devices. It might be a bad address, subnet mask, or even the address of the default gateway. + +Typically, when deploying IPv4 addresses, Dynamic Host Configuration Protocol (DHCP) will be used so that they can be dynamically assigned. However, with this dynamic pro-cess, issues may arise that prevent a device from successfully obtaining an IPv4 address from the DHCP server. Therefore, you need a solid understanding of how DHCP operates and how to identify the issues that would prevent a client from obtaining an IP address from a DHCP server. + +Because RFC 1918 addresses are not routable on the Internet, Network Address Translation (NAT) is needed to translate IPv4 private addresses to public addresses that are routable on the Internet. This adds another bit of complexity to the environment that you need to know how to troubleshoot so that devices can access resources external to the organization. + +This chapter covers the different methods that you can use to troubleshoot IPv4 address-ing issues, DHCP for IPv4-related issues, and NAT issues. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 9-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 9-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting IPv4 Addressing + +Troubleshooting DHCP for IPv4 + +Troubleshooting NAT + +Questions +1–4 + +5–7 + +8–10 + + + + +From the Library of Outcast Outcast +336 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. What will occur when a PC with the IP address 10.1.1.27/28 needs to communicate with a PC that has an IP address of 10.1.1.18? (Choose two answers.) + +a. It will send the frame to its default gateway. + +b. It will send the frame directly to the destination PC. + +c. It will ARP for the MAC address of the default gateway. + +d. It will ARP for the MAC address of the destination PC. + +2. What will occur when a PC with the IP address 10.1.1.27/29 needs to communicate with a PC that has an IP address of 10.1.1.18? (Choose two answers.) + +a. It will send the frame to its default gateway. + +b. It will send the frame directly to the destination PC. + +c. It will ARP for the MAC address of the default gateway. + +d. It will ARP for the MAC address of the destination PC. + +3. Which command enables you to verify the IP address configured on a Windows PC interface? + +a. ipconfig + +b. show ip interface + +c. arp -a + +d. show ip arp + +4. Which command enables you to verify the IP address configured on a router’s inter-face? + +a. ipconfig + +b. show ip interface + +c. arp -a + +d. show ip arp + + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 337 + +5. What is the correct order of operations for the DHCP for IPv4 process? + +a. Offer, Request, Ack, Discover + +b. Discover, Request, Ack, Offer + +c. Request, Offer, Discover, Ack + +d. Discover, Offer, Request, Ack + +6. Which command is needed on a router interface to forward DHCP Discover mes-sages to a DHCP server on a different subnet? + +a. ip address dhcp + +b. ip helper-address + +c. ip dhcp-forwarder + +d. ip dhcp server + +7. Which command will enable a router interface to obtain an IP address from a DHCP server? + +a. ip dhcp client + +b. ip dhcp server + +c. ip address dhcp + +d. ip helper-address + +8. Which parameter is necessary in the ip nat inside source command to enable PAT? + +a. pat + +b. list + +c. overload + +d. private + +9. Which command enables you to verify the interfaces that are configured for NAT? + +a. show ip nat translations + +b. show ip nat statistics + +c. show ip nat interfaces + +d. show ip nat + +10. Which column in the output of show ip nat translations displays the address that source IPs have been translated to? + +a. Inside Local + +b. Inside Global + +c. Outside Local + +d. Outside Global + + +From the Library of Outcast Outcast +338 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting IPv4 Addressing + +Just like your personal street address uniquely defines where you live, an IPv4 address uniquely defines where a device resides in a network. Your street address is made of two parts, the street name and the number of your residence; and the combination of these will be unique within your city/town. As a result, the pizza delivery person is able to drop off your pizza at your house in 30 minutes or it is free. If your house is addressed incorrectly, you may or may not get your pizza, and we do not want that to happen. + +The same is true with IPv4 addressing. If devices are addressed incorrectly, they may or may not receive the packets that are intended for them. Therefore, it is imperative that you have a solid understanding of IPv4 addressing and how to verify that devices are addressed correctly on the network. + +This section focuses on how we can troubleshoot IPv4 addressing issues. + + +IPv4 Addressing Issues + +An IPv4 address is made up of two parts: a network/subnet portion and a host portion. It is imperative that all devices in the same network/subnet share the exact same network/ subnet portion. If they are not exactly the same, the PC could end up addressing the Layer 2 frame incorrectly and sending the packet in the wrong direction. Refer to Figure 9-1, which shows a sample subnet (10.1.1.0/26) with two PCs and their default gateway, R1. + +10.1.1.0/26 + +10.1.1.10 +255.255.255.192 PC1 DG:10.1.1.1 +.1 192.0.2.1 R1 +10.1.1.20 255.255.255.192 PC2 DG:10.1.1.1 + +Figure 9-1 Correct IPv4 Addressing Example + + + +Key Topic + +When PC1 needs to communicate with PC2, it does a DNS lookup for the IP address of +PC2. The IP address 10.1.1.20 is returned. Now PC1 needs to determine whether PC2 is + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 339 + +located in the same subnet because this will determine whether the frame will have the MAC of PC2 or the MAC of the default gateway (DG). PC1 determines its network/sub-net portion by comparing its IP address to its subnet mask in binary as follows: +00001010.00000001.00000001.00001010 – PC1 IP address in binary +11111111.11111111.11111111.11000000 – PC1 subnet mask in binary +----------------------------------- +00001010.00000001.00000001.00 – PC1 network/subnet ID +(The 1s in the subnet mask identify the network portion.) + +Now PC1 compares the exact same binary bits to those binary bits in PC2’s address as follows: +00001010.00000001.00000001.00 – PC1 network/subnet ID +00001010.00000001.00000001.00010100 – PC2 IP address in binary +Because the binary bits are the same, PC1 concludes that PC2 is in the same network/ subnet; therefore, it can communicate directly with it and does not need to send the data to its default gateway. PC1 will create a frame with its own source MAC address and the MAC of PC2 as the destination. + +Consider what occurs when PC1 needs to communicate with the web server at 192.0.2.1. It does a DNS lookup for the IP address of the web server. The IP address 192.0.2.1 is returned. Now PC1 needs to determine whether the web server is located in the same net-work/subnet. This will determine whether the frame will have the MAC of the web server or the MAC of the DG. PC1 determines its network/subnet portion by comparing its IP address to its subnet mask in binary as follows: +00001010.00000001.00000001.00001010 – PC1 IP address in binary +11111111.11111111.11111111.11000000 – PC1 subnet mask in binary +----------------------------------- +00001010.00000001.00000001.00 – PC1 network/subnet ID +(The 1s in the subnet mask identify the network portion.) + +Now PC1 compares the exact same binary bits to those binary bits in the web server address as follows: +00001010.00000001.00000001.00 – PC1 network/subnet ID +11000000.00000000.00000010.00000001 – web server IP address in binary +PC1 concludes that the web server is in a different network/subnet, because the bits are not the same; therefore, to communicate with the web server, it needs to send the data to its default gateway. PC1 will create a frame with its own source MAC address and the MAC of R1 as the destination. + +As you can see, accurate IP addressing is paramount for successful communication. Let’s see what happens if PC1 is configured with the wrong subnet mask (255.255.255.240), as shown in Figure 9-2. + + + + + + + +From the Library of Outcast Outcast +340 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10.1.1.0/26 + +10.1.1.10 +255.255.255.240 PC1 DG:10.1.1.1 +.1 192.0.2.1 R1 +10.1.1.20 255.255.255.192 PC2 DG:10.1.1.1 + +Figure 9-2 Incorrect IPv4 Addressing Example + + + +Key Topic + +PC1 determines its network/subnet portion by comparing its IP address to its subnet mask in binary as follows: +00001010.00000001.00000001.00001010 – PC1 IP address in binary +11111111.11111111.11111111.11110000 – PC1 subnet mask in binary +--------------------------------------------------- +00001010.00000001.00000001.0000 – PC1 network/subnet ID +Now PC1 compares the exact same binary bits to those binary bits in PC2s address as follows: +00001010.00000001.00000001.0000 – PC1 network/subnet ID +00001010.00000001.00000001.00010100 – PC2 IP address in binary +PC1 concludes that PC2 is not in the same network/subnet, because the binary bits are not exactly the same. Therefore, it cannot communicate directly with it and will need to send the frame to the router so that the router can route the packet to the subnet PC2 is in. However, the PCs are actually connected to the same subnet, and as a result we have an IPv4 addressing and connectivity issue. + +Not only will an improper subnet mask cause issues, but an inappropriate IP address combined with the correct subnet mask will also cause issues. In addition, if the default gateway is not configured correctly on the PCs, packets will not be forwarded to the correct device when packets need to be sent to a different subnet. + +As a troubleshooter, you need to be able to recognize these issues, or eliminate them as a possible issue quickly. You can verify the IP addressing information on a Windows PC using the ipconfig command and on a router or switch using the show ip interface inter- +face_type interface_number command, as shown in Example 9-1. + + +Example 9-1 Verifying IP Addressing on a PC and on a Router +Key +Topic C:\>ipconfig +Windows IP Configuration + +Ethernet adapter PC1: + +Connection-specific DNS Suffix . : + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 341 + +IP Address. . . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +IP Address. . . . . . . . . . . . : 2001:10::10 +IP Address. . . . . . . . . . . . : fe80::a00:27ff:fe5d:6d6%4 +Default Gateway . . . . . . . . . : 10.1.1.1 + +R1#show ip interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet address is 10.1.1.1/26 +...output omitted.. + + +Determining IP Addresses Within a Subnet + +You want to be quick! Here is a quick way to determine all the IP addresses that will be in a particular subnet. Refer to Figure 9-3 as you are exploring this method. + +10.1.1.0/26 + +10.1.1.10 +255.255.255.192 PC1 DG:10.1.1.1 +.1 192.0.2.1 R1 +10.1.1.20 255.255.255.192 PC2 DG:10.1.1.1 + +Figure 9-3 Determining IP Address Within a Subnet + + + +Key Topic + +Take the subnet mask and find the most interesting octet. This is where the last binary 1 would be. In this case, 255.255.255.192 would have the last binary 1 in the fourth octet, which is 192. + +Now, take 256 and subtract 192 from it. The result is 64. The number 64 represents the block size or the total number of addresses in that subnet. Our subnet in this case is 10.1.1.0/26, and because the block size is 64, this subnet would begin at 10.1.1.0/26 and end at 10.1.1.63/26, which is a total of 64 addresses. The next subnet would be 10.1.1.64/26 to 10.1.1.127/26. The third subnet would be 10.1.1.128/26 to 10.1.1.191/26 and so on. + +Now you can compare the addresses of devices with the subnet ranges you just identi-fied. In this case, PC1, PC2, and an interface on R1 are supposed to be in the same sub-net. As a result, they better all be addressed correctly or communication will not occur correctly. For example, if you are reviewing the output of ipconfig on PC1, as shown in Example 9-2, now that you have the ranges, you can easily see that PC1 is not in the same subnet as R1 and PC2. Although they have the same subnet mask, in this case PC1 falls +in the range 10.1.1.64/26 to 10.1.1.127/26, whereas PC2 and the default gateway fall in the + + + + +From the Library of Outcast Outcast +342 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +range 10.1.1.0/26 to 10.1.1.63/26. PC1 is in a different network/subnet, when it should be in the same according to Figure 9-3. You will have to fix the address on PC1 so that it is within the correct network/subnet. + +Example 9-2 Verifying IP Addressing on PC with the ipconfig Command + +C:\>ipconfig +Windows IP Configuration + +Ethernet adapter PC1: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.1.74 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +IP Address. . . . . . . . . . . . : 2001:10::10 +IP Address. . . . . . . . . . . . : fe80::a00:27ff:fe5d:6d6%4 +Default Gateway . . . . . . . . . : 10.1.1.1 + + +Troubleshooting DHCP for IPv4 + +Dynamic Host Configuration Protocol (DHCP) serves as one of the most common meth-ods of assigning IPv4 address information to a network host. Specifically, DHCP allows a DHCP client to obtain an IP address, subnet mask, default gateway IP address, DNS server IP address, and other types of IP address information from a DHCP server. The DHCP server can be local within the subnet, in a remote subnet, or the same device that is also the default gateway. + +Because it is the most common way to deploy IPv4 addresses, you need to be well versed in the DHCP process and able to recognize issues related to DHCP. This section explains how DHCP operates and focuses on how to identify DHCP-related issues. + +Reviewing DHCP Operations + +If you have a cable modem, digital subscriber line (DSL), or fiber connection in your home, your router more than likely obtains its IP address from your service provider via DHCP. The router is also acting as a DHCP server for the devices in your home. In corpo-rate networks, when a PC boots, that PC receives its IP address configuration information from a corporate DHCP server. Figure 9-4 illustrates the exchange of messages (Discover, Offer, Request, Acknowledgment [DORA] process) that occur as a DHCP client obtains IP address information from a DHCP server. + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 343 + + + + + +DHCP Client + + + + + + + + +Figure 9-4 + +DHCP DISCOVER Step 1 +DHCP OFFER Step 2 +DHCP REQUEST Step 3 DHCP ACK Step 4 + +DHCP DORA Process + + +DHCP Server 10.1.1.2 + + + +Key Step 1. Topic + + + + + +Step 2. + + + + + + +Step 3. + + + + +Step 4. + + +When a DHCP client initially boots, it has no IP address, default gateway, or other such configuration information. Therefore, the way a DHCP cli-ent initially communicates is by sending a broadcast message (that is, a DHCPDISCOVER message) to a destination IP address of 255.255.255.255 +and a destination MAC address of FFFF:FFFF:FFFF in an attempt to discover a DHCP server. The source IP address will be 0.0.0.0, and the source MAC address will be the MAC address of the sending device. + +When a DHCP server receives a DHCPDISCOVER message, it can respond with a DHCPOFFER message with an unleased IP address, subnet mask, and default gateway information. Because the DHCPDISCOVER message is sent as a broadcast, more than one DHCP server might respond to this Discover message with a DHCPOFFER. However, the client typically selects the server that sent the first DHCPOFFER response it received. + +The DHCP client communicates with the selected server by sending a broad-casted DHCPREQUEST message indicating that it will be using the address provided in the DHCPOFFER and as a result wants the associated address leased to itself. + +Finally, the DHCP server responds to the client with a DHCPACK message indicating that the IP address is leased to the client and includes any addition- +al DHCP options that might be needed at this point. + + +Notice that in Step 1 the DHCPDISCOVER message was sent as a broadcast. The broad-cast cannot cross a router boundary. Therefore, if a client resides on a different network than the DHCP server, the default gateway of the client should be configured as a DHCP relay agent to forward the broadcast packets as unicast packets to the server. You can use the ip helper-address ip_address interface configuration mode command to configure a router to relay DHCP messages to a DHCP server in the organization. + +To illustrate, consider Figure 9-5 and Example 9-3. In the figure, the DHCP client belongs to the 172.16.1.0/24 network, whereas the DHCP server belongs to the 10.1.1.0/24 net-work. Router R1 is configured as a DHCP relay agent by using the syntax shown in Example 9-3. + + + + +From the Library of Outcast Outcast +344 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +DHCP DISCOVER +Broadcast + +DHCP DISCOVER +Unicast + +Fa 0/0 Fa 0/1 .1 R1 .1 +DHCP Client DHCP Relay DHCP Server 172.16.1.0/24 10.1.1.0/24 .2 +Agent + +Figure 9-5 DHCP Relay Agent + +Example 9-3 DHCP Relay Agent Configuration +Key +Topic R1#configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#service dhcp +R1(config)#interface fa 0/0 +R1(config-if)#ip helper-address 10.1.1.2 + +In the configuration, notice the service dhcp command. This command enables the DHCP service on the router, which must be enabled for the DHCP services to function. This command is usually not required because the DHCP service is enabled by default; however, when troubleshooting a DHCP relay agent issue, you might want to confirm that the service is enabled. Also, the ip helper-address 10.1.1.2 command specifies the IP address of the DHCP server. If the wrong IP address is specified, the DHCP messages will be relayed to the wrong device. In addition, the ip helper-address command must be configured on the interface that is receiving the DHCPDISCOVER messages from the clients. If not, the router cannot relay the DHCP messages. + +When you configure a router to act as a DHCP relay agent, realize that it relays a few other broadcast types in addition to a DHCP message. Other protocols that are forward-ed by a DHCP relay agent include the following: + +■ TFTP + +■ Domain Name System (DNS) + +■ Internet Time Service (ITS) + +■ NetBIOS name server + +■ NetBIOS datagram server + +■ BootP + +■ TACACS + +As a reference, Table 9-2 provides a comprehensive listing of DHCP message types you might encounter while troubleshooting a DHCP issue. + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 345 + +Table 9-2 DHCP Message Types + + +DHCP Message +DHCPDISCOVER + + +DHCPOFFER + +DHCPREQUEST + + +DHCPDECLINE + +DHCPACK + +DHCPNAK + + +DHCPRELEASE + + +DHCPINFORM + +Description +A client sends this message in an attempt to locate a DHCP server. This message is sent to a broadcast IP address of 255.255.255.255 using UDP port 67. +A DHCP server sends this message in response to a DHCPDISCOVER message using UDP port 68. +This broadcast message is a request from the client to the DHCP server for the IP addressing information and options that were received in the DHCP Offer message. +This message is sent from a client to a DHCP server to inform the server that an IP address is already in use on the network. +A DHCP server sends this message to a client and includes IP configuration parameters. +A DHCP server sends this message to a client and informs the client that the DHCP server declines to provide the client with the requested IP configuration information. +A client sends this message to a DHCP server and informs the DHCP server that the client has released its DHCP lease, thus allowing the DHCP server to reassign the client IP address to another client. +This message is sent from a client to a DHCP server and requests IP configuration parameters. Such a message might be sent from an access server requesting IP configuration information for a remote client attaching to the access server. + + + +In addition to acting as a DHCP relay agent, a router might act as a DHCP client. Specifically, the interface of a router might obtain its IP address from a DHCP server. Figure 9-6 shows a router acting as a DHCP client, where the router’s Fast Ethernet 0/1 interface obtains its IP address from a DHCP server. Example 9-4 provides the configura-tion for the router in the topology (that is, router R1). Notice the dhcp option used in the ip address command, instead of the usual IP address and subnet mask information. + + +Fa 0/1 +R1 DHCP DISCOVER DHCP Server + +DHCP OFFER + +DHCP REQUEST + +DHCP ACK + +Figure 9-6 Router Acting as a DHCP Client + + +From the Library of Outcast Outcast +346 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 9-4 DHCP Client Configuration +Key +Topic R1#configure terminal +R1(config)#int fa 0/1 +R1(config-if)#ip address dhcp + + + +Key Topic + +A router and multilayer switch can also act as a DHCP server. Figure 9-7 shows a router acting as a DHCP server, and Example 9-5 shows the router configuration. The ip dhcp excluded-address 10.8.8.1 10.8.8.10 command prevents DHCP from assigning those IP addresses to a client. Note that you do not have to include the IP address of the router interface in this exclusion because the router will never hand out its own interface IP address. The ip dhcp pool POOL-A command creates a DHCP pool named POOL-A. This pool can hand out IP addresses from the 10.8.8.0/24 network, with a default gateway +of 10.8.8.1, a DNS server of 192.168.1.1, and a WINS server of 192.168.1.2. + + + + + + +DHCP Client DHCPDISCOVER + +Fa 0/0 +.1 +DHCP Server + + +DHCPOFFER + +DHCPREQUEST + +DHCPACK + +Figure 9-7 Router Acting as a DHCP Server + +Example 9-5 DHCP Server Configuration + +R1#show run +...OUTPUT OMITTED... +ip dhcp excluded-address 10.8.8.1 10.8.8.10 +! +ip dhcp pool POOL-A +network 10.8.8.0 255.255.255.0 +default-router 10.8.8.1 +dns-server 192.168.1.1 +netbios-name-server 192.168.1.2 +...OUTPUT OMITTED... + +If your device is configured to receive an IP address from a DHCP server but the IP address of the client is an APIPA (Automatic Private IP Addressing) address (169.254.x.x) because of autoconfiguration, as shown in Example 9-6, you can conclude that the client was not able to obtain an IP address from the DHCP server. Do not immediately assume that DHCP is the problem. It is quite possible that you have a Layer 2 problem, such as VLANs, trunks, Spanning Tree Protocol (STP), or security, for example, that is preventing the clients DHCPDISCOVER message from reaching the DHCP server. + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 347 + +Example 9-6 Verifying DHCP-Assigned IP Address on PC + +C:\>ipconfig /all +Windows IP Configuration + +...output omitted... + +Ethernet adapter PC1 Lab: + +Connection-specific DNS Suffix . : +Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapter +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +Dhcp Enabled. . . . . . . . . . . : Yes +Autoconfiguration Enabled . . . . : Yes +Autoconfiguration IP Address. . . : 169.254.180.166 +Subnet Mask . . . . . . . . . . . : 255.255.0.0 +IP Address. . . . . . . . . . . . : 2001:10::10 +IP Address. . . . . . . . . . . . : fe80::a00:27ff:fe5d:6d6%4 +Default Gateway . . . . . . . . . : + + +Potential DHCP Troubleshooting Issues + +When troubleshooting what you suspect might be a DHCP issue, consider the following potential issues: + + +■ Key +Topic + + +■ + + +■ + + + + +■ + + + + +■ + +A router not forwarding broadcasts: By default, a router does not forward broad-casts, including DHCPDISCOVER broadcast messages. Therefore, a router needs to be explicitly configured to act as a DHCP relay agent if the DHCP client and DHCP server are on different subnets. + +DHCP pool out of IP addresses: A DHCP pool contains a finite number of address-es. Once a DCHP pool becomes depleted, new DHCP requests are rejected. + +Misconfiguration: The configuration of a DHCP server might be incorrect. For example, the range of network addresses to be given out by a particular pool might be incorrect, or the exclusion of addresses statically assigned to routers or DNS serv-ers might be incorrect. + +Duplicate IP addresses: A DHCP server might hand out an IP address to a client that is already statically assigned to another host on the network. These duplicate IP addresses can cause connectivity issues for both the DHCP client and the host that had been statically configured for the IP address. + +Redundant services not communicating: Some DHCP servers can coexist with other DHCP servers for redundancy. For this redundancy to function, these DHCP servers need to communicate with one another. If this interserver communication +fails, the DHCP servers can hand out overlapping IP addresses to their clients. + + + + + + +From the Library of Outcast Outcast +348 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ The “pull” nature of DHCP: When a DHCP client wants an IP address, it can request an IP address from a DHCP server. However, the DHCP server has no ability to initi-ate a change in the client IP address after the client obtains an IP address. In other words, the DHCP client pulls information from the DHCP server, but the DHCP server cannot push information to the DHCP client. + +■ Interface not configured with IP address in DHCP pool: A router or a multilayer switch that is acting as a DHCP server must have an interface with an IP address that is part of the pool/subnet that it is handing out IP addresses for. The router will only hand the addresses in the pool to clients reachable out that interface. This ensures that the router interface and the clients are in the same subnet. However, note that this is not the case if a relay agent is forwarding DHCP messages between the cli- +ent and the router that is the DHCP server. In that case, the DHCP server does not have to have an IP address on an interface that is part of the pool it is handing out addresses for. + +At this point in this section, you have reviewed basic DHCP operations and potential DHCP troubleshooting targets. When you begin your troubleshooting efforts, you might want to collect the following information to help you better isolate the underlying cause of the DHCP issue you are investigating: + +■ The configuration of the DHCP server: For example, confirm that the pools are correctly defined with appropriate network addresses, default gateways, and other relevant IP address information. + +■ The configuration of the DHCP relay agent: For example, ensure that the specified helper address is the correct unicast IP address and ensure that it is configured on the interface on which DHCPDISCOVER broadcasts will be received. + +■ Determine the size of a DHCP pool: Because a pool in a DHCP server accommo-dates only a limited number of IP addresses, determine how many IP addresses (if any) are still available from a given DHCP pool. + +■ Verify IP address of router interface: If the router is a DHCP server (and there is no relay agent configured to forward DHCP messages to it), verify that the router has the correct IP address assigned to the correct interface based on the pools it will be handing out addresses for. If the interface does not have an IP address that is part of a pool it is handing out addresses for, it will not hand out addresses to the clients out the interface it is receiving DHCPDISCOVER messages on. + + + + + + +Key Topic + +DHCP Troubleshooting Commands + +Example 9-7 provides sample output from the show ip dhcp conflict command. The output indicates a duplicate 172.16.1.3 IP address on the network, which the router dis-covered via a ping. You can clear the information displayed by issuing the clear ip dhcp +conflict * command after you have resolved the duplicate address issue on the network. + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 349 + +Example 9-7 show ip dhcp conflict Command Output + +R1#show ip dhcp conflict + +IP address +172.16.1.3 + +Detection method +Ping + +Detection time +Oct 15 2014 8:56 PM + + +Example 9-8 shows sample output from the show ip dhcp binding command. The output indicates that an IP address of 10.1.1.10 was assigned to a DHCP client. You can release this DHCP lease with the clear ip dhcp binding * command. + +Example 9-8 show ip dhcp binding Command Output + +R1#show ip dhcp binding +Bindings from all pools not associated with VRF: + +IP address + + +10.1.1.3 +10.1.1.10 + +Client-ID/ +Hardware address/ +User name +0100.50b6.0765.7a +0108.0027.5d06.d6 + +Lease expiration + + +Oct 17 2014 07:53 PM +Oct 17 2014 07:53 PM + +Type + + +Automatic +Automatic + + +Example 9-9 shows sample output from the debug ip dhcp server events command. The out-put shows updates to the DHCP database. + +Example 9-9 debug ip dhcp server events Command Output + +R1#debug ip dhcp server events +DHCPD: Seeing if there is an internally specified pool class: +DHCPD: htype 1 chaddr c001.0f1c.0000 +DHCPD: remote id 020a00000a01010101000000 +DHCPD: circuit id 00000000 +DHCPD: Seeing if there is an internally specified pool class: +DHCPD: htype 1 chaddr c001.0f1c.0000 +DHCPD: remote id 020a00000a01010101000000 +DHCPD: circuit id 00000000 +DHCPD: no subnet configured for 192.168.1.238. + +Example 9-10 shows sample output from the debug ip dhcp server packet command. The output shows a DHCPRELEASE message being received when a DHCP client with an IP address of 10.1.1.3 is shut down. You can also see the four-step process of a DHCP client obtaining an IP address of 10.1.1.4 with the following messages: DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, and DHCPACK. + +Example 9-10 debug ip dhcp server packet Command Output + +R1#debug ip dhcp server packet +DHCPD: DHCPRELEASE message received from client +0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.3). +DHCPD: DHCPRELEASE message received from client +0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.3). +DHCPD: Finding a relay for client + + +From the Library of Outcast Outcast +350 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 on interface FastEthernet0/1. +DHCPD: DHCPDISCOVER received from client +0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 on interface FastEthernet0/1. +DHCPD: Allocate an address without class information +(10.1.1.0) +DHCPD: Sending DHCPOFFER to client +0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.4). +DHCPD: broadcasting BOOTREPLY to client c001.0f1c.0000. +DHCPD: DHCPREQUEST received from client +0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30. +DHCPD: No default domain to append - abort update +DHCPD: Sending DHCPACK to client +0063.6973.636f.2d63.3030.312e.3066.3163.2e30.3030.302d.4661.302f.30 (10.1.1.4). +DHCPD: broadcasting BOOTREPLY to client c001.0f1c.0000. + + +Troubleshooting NAT + +In IPv4 networks, Network Address Translation (NAT) is needed for multiple reasons. However, the most common reason is to translate a private IPv4 address to a public IPv4 address. This section explains how NAT operates and identifies NAT related issues and how to troubleshoot them. + +Reviewing NAT + +Public IP addresses are routable through the public Internet, whereas private IP addresses (as defined in RFC 1918) are not, and are intended for use within an organization. Because devices within an organization using private IP addresses need to communicate outside of their local networks (Internet/public network), NAT is needed to translate the private IP addresses into Internet-routable IP addresses (that is, public IP addresses). Table +9-3 identifies three types of NAT. + + +Table 9-3 Types of NAT +Key +Topic Type of NAT Description (Based on Private to Public IPv4 Address Translations) + +Static NAT + +Dynamic NAT + +A one-to-one mapping of private internal IP addresses to public external IP addresses +A dynamic mapping of private internal IP addresses to a pool of public external IP addresses + +NAT overloading Allows multiple private internal IP addresses to use a single public or PAT external IP address by keeping track of Layer 4 port numbers, which +makes each session unique. + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 351 + +Consider Figure 9-8, which shows a basic NAT topology. In the topology, a client with a private IP address of 10.1.1.10 wants to communicate with a server on the public Internet at 192.0.2.1. Router R1 is configured for NAT. Router R1 takes packets coming from 10.1.1.10 that are destined for remote devices (such as the server) and changes the source IP address in the packet headers to 203.0.113.1, which is a publicly routable IP address. When the server at IP address 192.0.2.1 receives traffic from the client, the return traffic from the server is sent to a destination address of 203.0.113.1. When router R1 receives traffic from the outside network destined for 203.0.113.1, the router translates the des-tination IP address to 10.1.1.10 and forwards the traffic to the inside network, where the client receives the traffic. + + +Inside Source IP: 10.1.1.10 +Destination IP: 192.0.2.1 + +Fa1/0 10.1.1.1 + +Outside Source IP: 203.0.113.1 +Destination IP: 192.0.2.1 + +Gi0/0 203.0.113.6/29 + + + + + +Client 10.1.1.10 + + +R1 +NAT-Enabled Router +NAT Table + +Server 192.0.2.1 + + + +10.1.1.10 + + +Source IP: 192.0.2.1 Destination IP: 10.1.1.10 + +203.0.113.1 + + +Source IP: 192.0.2.1 Destination IP: 203.0.113.1 + + +Figure 9-8 Basic NAT Topology Example + +Note that NAT by itself does not scale well for an organization that has many privately addressed devices that need access to the public Internet all at the same time. As you can see from the example just discussed, you would need one public IP for every single +private IP you want to translate. To overcome this issue, you use Port Address Translation (PAT), which can translate multiple private IP addresses to the same public IP address +by keeping track of port numbers. PAT is simply a feature that NAT provides. Figure 9-9 displays how PAT can use port numbers and have multiple private IPs use the same public IP address. In this case, the public IP address is the same one that is used on the outside interface; however, you could also use a pool of public addresses. When the packet sourced from IP 10.1.1.10 port 65500 arrives at the PAT-enabled router, it translates it to the appropriate public IP and makes note of the port number as well as the IP address +in the NAT table. Therefore, when traffic returns from the server destined to 203.0.113.1 port 65500, the router knows it is destined for 10.1.1.10 at port 65500. The client at 10.1.1.20 will also be translated to the same outside IP address, but a different port num-ber will be used. This ensures that the router can differentiate between the different pack-ets and who they are truly sourced from and destined to. + + + + + + + +From the Library of Outcast Outcast +352 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Inside +Source IP: 10.1.1.10:65500 Destination IP: 192.0.2.1:80 + +Fa1/0 10.1.1.1 + +Outside +Source IP: 203.0.113.1:65500 Destination IP: 192.0.2.1:80 + +Gi0/0 203.0.113.1/29 + + + + + +Client 10.1.1.10 + + +R1 +NAT-Enabled Router Using PAT + +NAT Table + +Server 192.0.2.1 + + + +10.1.1.10:65500 10.1.1.20:65520 + +203.0.113.1:65500 203.0.113.1:65520 + + + +Client 10.1.1.20 + +Figure 9-9 + + +Source IP: 192.0.2.1:80 Destination IP: 10.1.1.10:65500 + +Basic PAT Topology Example + + +Source IP: 192.0.2.1:80 Destination IP: 203.0.113.1:65500 + + +To effectively troubleshoot a NAT configuration, you should be familiar with the termi-nology describing the various IP addresses involved in a translation, as outlined in Table 9-4. + + +Table 9-4 +Key +Topic NAT IPs + + +Names of NAT IP Addresses + +Definition + + + +Inside local + +Inside global + +Outside local + + + +Outside global + +The IP address of a device inside the network; this address will be translated to the inside global address. (Example: PC inside the network) +The IP address that the Inside local address is translated to. (Example: public IP address used on Internet) +The IP address of a remote device as it appears to the devices inside the network. This may or may not be the actual address of the remote device if NAT translated it. Note that usually the outside global and outside local addresses are the same. +The IP address of the device that the inside local address is trying to communicate with. This may be translated to the outside local address (but usually is not translated). (Example: web server) + + + +Based on the definitions in Table 9-4, Table 9-5 categorizes the IP addresses previously shown in Figure 9-9. + + +Table 9-5 + +NAT IPs + + +Classifying the NAT IP Addresses in Figure 9-9 + +Address + + + +Inside local + +Inside global + +10.1.1.10 + +203.0.113.1 + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 353 + + + +NAT IPs Outside local +Outside global + +Address 192.0.2.1 +192.0.2.1 + + + + +NAT Troubleshooting Issues + +Refer to Example 9-11, which displays a sample NAT/PAT configuration that uses a pool of public addresses. Notice how many different issues could arise based on a mistake in +the configuration. + + +■ +Key Topic + + +■ + + +■ + + +■ + + + +■ + + + +■ + +Interfaces not configured correctly: You need to specify which interfaces will be the outside and inside interfaces. If not configured correctly, NAT will not translate addresses properly. + +The pool may be misconfigured: The pool must specify the correct public addresses that will be translated. This pool represents the inside global addresses. + +The public addresses in the pool are not reachable: For traffic to return from the destination, the public addresses need to be reachable (advertised) to the Internet. + +The access list may not reference the correct inside devices: The ACL identifies the inside local addresses that will be translated to inside global addresses. If the ACL is incorrect, addresses will not be translated correctly. + +ACL and pool not mapped correctly: The ip nat inside source command marries the ACL and the pool together. If this mapping is incorrect, NAT will not translate addresses correctly. + +Overload keyword missing: To enable PAT, the overload keyword must be included +in the ip nat inside source command. + + +Example 9-11 Dynamic NAT with PAT Sample Configuration + +R1#show run +...OUTPUT OMITTED... +interface FastEthernet1/0 +ip address 10.1.1.1 255.255.255.0 +ip nat inside +! +interface GigabitEthernet 0/0 +ip address 203.0.113.1 255.255.255.248 +ip nat outside +! +ip nat pool OUTSIDE_POOL 203.0.113.3 203.0.113.6 netmask 255.255.255.248 +ip nat inside source list 1 pool OUTSIDE_POOL overload +! +access-list 1 permit 10.1.1.0 0.0.0.255 +...OUTPUT OMITTED... + + +From the Library of Outcast Outcast +354 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +From a troubleshooting perspective, adding NAT into a network introduces additional troubleshooting issues. Consider the following situations in which NAT might cause an issue for end users: + +■ Using NAT over a VPN: Some VPN protocols check the checksum of a packet to verify its integrity. The checksum calculated for a packet before NAT differs from a checksum calculated for that same packet after NAT (because performing NAT on a packet changes IP address information). Therefore, a virtual private network (VPN) protocol (for example, IPsec) might reject such a packet because it appears to have been altered. + +■ NAT hiding true IP address information: Because NAT translates an inside IP address to an outside IP address, tracing a data flow from end to end for trouble-shooting purposes can be challenging. You can start troubleshooting by using the show ip nat translation command to verify whether the translation does exist in the translation table. + +■ Applications that are not NAT compatible: When some applications initialize, they randomly determine what ports are going to be used for communication, which might be incompatible with how NAT handles incoming traffic. Some Voice over +IP (VoIP) protocols face such an issue, as they select the User Datagram Protocol (UDP) port numbers to be used for their Real-time Transport Protocol (RTP) media streams. Also, when setting up communication with a remote device, an applica-tion might include IP address information in the payload of a packet. If the remote device attempted to return traffic to the IP address embedded in that payload, that IP address might be unreachable because of the NAT translation. + +■ Delays experienced due to NAT’s processing: Because NAT manipulates Layer 3 information of packets, the packets are subject to a bit more delay than they would otherwise experience. This delay might become more evident on routers performing numerous NAT translations. + + + + + + +Key Topic + +NAT Troubleshooting Commands + +Example 9-12 provides sample output from the show ip nat translations command and how to clear all dynamic entries in this output with the clear ip nat translation * com-mand. Initially, the show ip nat translations command shows three statically configured NAT translations and one dynamically learned translation (which is highlighted in the output). Then, after issuing the clear ip nat translation * command, the dynamically learned NAT entry is deleted from the IP NAT table, leaving the three statically config- +ured NAT entries. + + +Example 9-12 show ip nat translations and clear ip nat translation * Command Output + +Router#show ip nat translations + +Pro Inside global +--- 192.168.1.12 + +Inside local +192.168.0.1 + +Outside local +--- + +Outside global +--- + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 355 + + +--- 192.168.1.13 +tcp 192.168.1.27:23 +--- 192.168.1.27 + +192.168.0.2 +192.168.0.27:23 +192.168.0.27 + +--- +192.168.1.50:1158 +--- + +--- +192.168.1.50:1158 +--- + +Router#clear ip nat translation * +Router#show ip nat translations + +Pro Inside global +--- 192.168.1.12 +--- 192.168.1.13 +--- 192.168.1.27 + +Inside local +192.168.0.1 +192.168.0.2 +192.168.0.27 + +Outside local +--- +--- +--- + +Outside global +--- +--- +--- + + +Example 9-13 provides sample output from the show ip nat statistics command. The output shows which interfaces are acting as the inside and outside interfaces, and it shows the current number of static and dynamic translations. + +Example 9-13 show ip nat statistics Command Output + +R1#show ip nat statistics +Total active translations: 4 (3 static, 1 dynamic ; 1 extended) +Outside interfaces: +FastEthernet0/0 +Inside interfaces: +FastEthernet0/1 +Hits: 10 Misses: 0 +CEF Translated packets: 5, CEF Punted packets: 0 +Expired translations: 0 +Dynamic mappings: +Appl doors: 0 +Normal doors: 0 +Queued Packets: 0 + +Example 9-14 provides sample output from the debug ip nat command, which you should use with caution because it can crash a router. The output shows that when a source IP address of 192.168.1.50 is attempting to communicate with a destination IP address of 192.168.1.27, the router translates the destination IP address into 192.168.0.27. Also, when a source IP address of 192.168.1.11 is attempting to communicate with a destination IP address of 192.168.1.50, the router translates the source IP address of 192.168.1.11 into an IP address of 192.168.1.27. + +Example 9-14 debug ip nat Command Output + +R1#debug ip nat +IP NAT debugging is on +NAT*: s=192.168.1.50, d=192.168.1.27->192.168.0.27 [10202] +NAT: s=192.168.1.11->192.168.1.27, d=192.168.1.50 [210] +NAT*: s=192.168.1.50, d=192.168.1.27->192.168.0.27 [10370] +NAT: s=192.168.1.11->192.168.1.27, d=192.168.1.50 [211] +NAT*: s=192.168.1.50, d=192.168.1.27->192.168.0.27 [10540] +NAT: s=192.168.1.11->192.168.1.27, d=192.168.1.50 [214] + + + +From the Library of Outcast Outcast +356 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +IPv4 Addressing and Addressing Technologies Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 9-10. + + + + +10.1.1.10 255.255.255.192 DG:10.1.1.1 + + +10.1.1.0/26 + +PC1 + +DHCP Server +172.16.1.10 + + +Gig2/0 + +Gig0/0 Gig1/0 .1 +R1 + + +192.0.2.1 + +10.1.1.20 NAT Enabled Router 255.255.255.192 PC2 +DG:10.1.1.1 + +Figure 9-10 IPv4 Addressing Trouble Tickets Topology + + +Trouble Ticket 9-1 + +Problem: PC1 is not able to access resources on the web server 192.0.2.1. + +You begin troubleshooting by verifying the issue with a ping from PC1 to 192.0.2.1. As shown in Example 9-15, the ping fails. + +Example 9-15 Failed Ping from PC1 to 192.0.2.1 + +C:\PC1>ping 192.0.2.1 +Pinging 192.0.2.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next you ping the default gateway for PC1, which is R1, at 10.1.1.1. As shown in Example 9-16, the ping is successful. + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 357 + +Example 9-16 Successful Ping from PC1 to Default Gateway + +C:\PC1>ping 10.1.1.1 + +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +You decide to see whether this is an isolated incident. You access PC2 and ping 192.0.2.1, which is successful, as shown in Example 9-17. + +Example 9-17 Successful Ping from PC2 to 192.0.2.1 + +C:\PC2>ping 192.0.2.1 + +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +At this point, you have determined that Layer 2 and Layer 3 connectivity from PC1 and PC2 to the router is fine. You also confirmed that PC2 can reach Internet resources even though PC1 cannot. There are many reasons why this situation might exist. One of the big ones is an ACL on Gig0/0 or Gig1/0 that is denying PC1 from accessing resources on the Internet. It could also be a NAT issue that is preventing 10.1.1.10 from being trans-lated. However, before we go down that path, review the basics. For example, what about the default gateway configured on PC1? If it is configured incorrectly, PC1 is sending packets that are destined to a remote subnet to the wrong default gateway. Reviewing the output of ipconfig on PC1, as shown in Example 9-18, indicates that the default gateway is configured as 10.1.1.100, which is not the IP address of R1s interface. + +Example 9-18 ipconfig Output on PC1 + +C:\PC1>ipconfig +Windows IP Configuration + +Ethernet adapter Local Area Connection: + + + + +From the Library of Outcast Outcast +358 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : 10.1.1.100 + +After you change the default gateway on R1 to 10.1.1.1, the ping to 192.0.2.1 is successful, as shown in Example 9-19. + +Example 9-19 Successful Ping from PC1 to 192.0.2.1 + +C:\PC1>ping 192.0.2.1 + +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 9-2 + +Problem: PC1 is not able to access resources on the web server 192.0.2.1. + +You begin troubleshooting by verifying the issue with a ping from PC1 to 192.0.2.1. As shown in Example 9-20, the ping fails. + +Example 9-20 Failed Ping from PC1 to 192.0.2.1 + +C:\PC1>ping 192.0.2.1 +Pinging 192.0.2.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next you ping the default gateway for PC1, which is R1, at 10.1.1.1. As shown in Example 9-21, it fails as well. + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 359 + +Example 9-21 Failed Ping from PC1 to Default Gateway + +C:\PC1>ping 10.1.1.1 +Pinging 10.1.1.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next you decide to see whether this is an isolated incident by pinging from PC2 to the IP address 192.0.2.1 and to the default gateway at 10.1.1.1. As shown in Example 9-22, both pings fail as well, indicating that it is not isolated. + +Example 9-22 Failed Ping from PC2 to 192.0.2.1 and Default Gateway + +C:\PC2>ping 192.0.2.1 +Pinging 192.0.2.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +C:\PC2>ping 10.1.1.1 +Pinging 10.1.1.1 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +At this point, you have confirmed that there is no Layer 2 or Layer 3 connectivity from PC1 or PC2 to their default gateway. As you have seen in previous chapters, this can be caused by many different reasons. For example, VLANs, VACLs, trunks, VTP, STP, are all possible reasons why this issue is occurring. However, always remember to check the basics first: IP addressing on the client. On PC1, you issue the ipconfig command, and as shown in Example 9-23, PC1 has an APIPA (Automatic Private IP Addressing) address of +169.254.180.166/16 and no default gateway. This means that PC1 cannot contact a DHCP + + + +From the Library of Outcast Outcast +360 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +server and is autoconfiguring an IP address. This still does not rule out a VLAN, trunk, VTP, STP, and so on. However, it is helping us narrow the focus. + +Example 9-23 ipconfig Output on PC1 + +C:\PC1>ipconfig +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 169.254.180.166 +Subnet Mask . . . . . . . . . . . : 255.255.0.0 +Default Gateway . . . . . . . . . : + +We can clearly see in the trouble ticket topology in Figure 9-10 that the DHCP server is located out interface Gig2/0 on R1. It is in a different subnet than the PCs. Therefore, R1 is required to forward the DHCPDISCOVER messages from the PCs to the DHCP server at 172.16.1.10. To do this, it needs the ip helper-address command configured on Gig0/0. Let’s start there so that we can eliminate this as the issue and focus elsewhere if need +be. On R1, you issue the command show run interface gig 0/0, as shown in Example 9-24 . The output indicates that the IP helper address is 172.16.1.100, which is not correct according to the network diagram. + +Example 9-24 Verifying the IP Helper Address on Gig0/0 of R1 + +R1#show run interface gigabitEthernet 0/0 +Building configuration... + +Current configuration : 193 bytes +! +interface GigabitEthernet0/0 +ip address 10.1.1.1 255.255.255.192 +ip helper-address 172.16.1.100 +ip nat inside +end + +After you fix the IP helper address with the no ip helper-address 172.16.1.100 command and issue the ip helper-address 172.16.1.10 command in interface configuration mode, PC1 successfully receives IP addressing information from the DHCP server, as shown in Example 9-25. + +Example 9-25 R1 with Correct IP Addressing After Fixing the IP Helper Address Command + +C:\PC1>ipconfig +Windows IP Configuration + +Ethernet adapter Local Area Connection: + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 361 + +Connection-specific DNS Suffix . : +IP Address. . . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : 10.1.1.1 + +After you verify the addressing information on R1, the ping to 192.0.2.1 is successful, as shown in Example 9-26. + +Example 9-26 Successful Ping from PC1 to 192.0.2.1 + +C:\PC1>ping 192.0.2.1 + +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 9-3 + +Problem: No PC in the 10.1.1.0 network can access resources on the Internet. You suspect NAT is the issue. As shown in Example 9-27, there are no translations occurring when you look at the output of show ip nat translations. + +Example 9-27 Viewing the NAT Translations on R1 + +R1#show ip nat translations +R1# + +In Example 9-28, you issue the show ip nat statistics command on R1 to verify which interfaces are participating in the NAT process. In this example, Gig0/0 and Gig1/0 are both configured to participate in NAT. However, take a moment to compare the output to Figure 9-10. Figure 9-10 shows that Gig0/0 is connected to the private network and Gig1/0 is connected to the public network. As such, Gig0/0 should be the inside interface, and Gig1/0 should be the outside interface. In the output of show ip nat statistics, this is not the case. As a result, you will need to modify the configuration so that Gig0/0 is the inside interface and Gig1/0 is the outside interface. + +Example 9-28 Viewing the NAT Statistics on R1 + +R1#show ip nat statistics +Total active translations: 0 (0 static, 0 dynamic; 0 extended) +Outside interfaces: +GigabitEthernet0/0 + + + +From the Library of Outcast Outcast +362 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Inside interfaces: +GigabitEthernet1/0 +Hits: 0 Misses: 0 +CEF Translated packets: 0, CEF Punted packets: 0 +Expired translations: 0 +Dynamic mappings: +-- Inside Source +[Id: 1] access-list 1 interface GigabitEthernet0/0 refcount 0 +nat-limit statistics: +max entry: max allowed 0, used 0, missed 0 + +In addition, if you look at the bottom of Example 9-28, you will notice that it states that IP addresses associated with access list 1 will be translated to the IP address associ-ated with Gig0/0, which is supposed to be the inside interface according to Figure 9-10. +Therefore, the ip nat inside source command needs to be modified as well. Example 9-29 shows the commands that are needed to modify the NAT configuration so that transla-tions are successful. + +Example 9-29 Modifying the NAT Configuration on R1 + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#interface gigabitEthernet 0/0 +R1(config-if)#no ip nat outside +R1(config-if)#ip nat inside +R1(config-if)#interface gigbitethernet 1/0 +R1(config-if)#no ip nat inside +R1(config-if)#ip nat outside +R1(config-if)#exit +R1(config)#ip nat inside source list 1 interface gigabitEthernet 1/0 overload +R1(config)#end + +After making the modifications, you ping from 10.1.1.10 to 192.0.2.1 and it fails. The out-put of show ip nat translations in Example 9-30 still shows no translations occurring. + +Example 9-30 Viewing the NAT Translations on R1 After the Configuration Changes + +R1#show ip nat translations +R1# + +You review the output of show ip nat statistics again, as shown in Example 9-31, and confirm that everything looks fine. However, translations are still not occurring. + +Example 9-31 Viewing the NAT Statistics on R1 After the Configuration Changes + +R1#show ip nat statistics +Total active translations: 0 (0 static, 0 dynamic; 0 extended) +Outside interfaces: +GigabitEthernet1/0 + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 363 + +Inside interfaces: +GigabitEthernet0/0 +Hits: 0 Misses: 0 +CEF Translated packets: 0, CEF Punted packets: 0 +Expired translations: 0 +Dynamic mappings: +-- Inside Source +[Id: 1] access-list 1 interface GigabitEthernet1/0 refcount 0 +nat-limit statistics: +max entry: max allowed 0, used 0, missed 0 + +One item that has not been checked yet is the access list. In this case, ACL 1 is being used to identify the private addresses that will be translated. Example 9-32 displays the output of show access-list 1. This ACL is permitting the IP addresses from 10.1.1.64 to 10.1.1.127. If you compare this range of addresses to Figure 9-10, it is incorrect. It should be 10.1.1.0 to 10.1.1.63 that is permitted. + +Example 9-32 Viewing the NAT Statistics on R1 + +R1#show access-lists 1 +Standard IP access list 1 +10 permit 10.1.1.64, wildcard bits 0.0.0.63 + +After removing the ACL with the no access-list 1 command and creating a new one with the access-list 1 permit 10.1.1.0 0.0.0.63 command, a ping from 10.1.1.10 to 192.0.2.1 is successful. In addition, as shown in Example 9-33, the output of show ip nat translations indicates that a translation has occurred. + +Example 9-33 Successful Translations on R1 + +R1#show ip nat translations +Pro Inside global Inside local Outside local Outside global +icmp 203.0.113.1:1024 10.1.1.10:512 192.0.2.1:512 192.0.2.1:1024 + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +364 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 9-6 lists a reference of these key topics and the page numbers on which each is found. + +Table 9-6 Key Topics for Chapter 9 +Key +Topic Key Topic Element Description Page Number + + +Paragraph + + +Paragraph + +Example 9-1 + +Paragraph + +Step list + +Example 9-3 + +Example 9-4 + +Paragraph + +List + +Section + +Table 9-3 + +Table 9-4 + +List + +Section + +Examines the process that is used by a device to 338 determine whether the packet will be sent to a local +or remote device + +Examines what occurs when IPv4 addressing is not 340 correct +Verifying IP addressing on PC with the ipconfig 340 command +Explores how to determine the valid usable IPv4 341 addresses within a subnet +Examines the DHCPv4 DORA process 343 + +DHCP relay agent configuration 344 + +DHCP client configuration 346 + +Describes how a router can be configured as a 346 DHCP server +Items to look out for while troubleshooting DHCP 347 related issues +DHCP troubleshooting commands 348 + +Types of NAT 350 + +Names of NAT IP addresses 352 + +Outlines the issues that you may have to 353 troubleshoot with a NAT configuration +NAT troubleshooting commands 354 + + + + + + + +From the Library of Outcast Outcast +Chapter 9: Troubleshooting IPv4 Addressing and Addressing Technologies 365 + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +DHCP, DORA, DHCPDISCOVER, DHCPOFFER, DHCPREQUEST, DHCPACK, DHCP relay agent, APIPA, NAT, PAT/NAT overloading, static NAT, dynamic NAT, inside local, inside global, outside local, outside global + +Command Reference to Check Your Memory + +This section includes the most important verification and show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 9-7 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to verify and troubleshoot the topics covered in this chapter. + +Table 9-7 Verification and show Commands + +Task Command Syntax + +Displays the IP address, subnet mask, and default gateway of a PC +Displays the IP address, subnet mask, and default gateway of a PC, in addition to DNS servers, domain name, MAC address, and whether autoconfiguration is enabled or not +Displays various IP related parameters for a router interface, including the IP address and subnet mask that have been assigned +Identifies any IP address conflicts a router configured as a DHCP server identifies, along with the method the router used to identify the conflicts (this is, via ping or gratuitous ARP) +Displays IP addresses that an IOS DHCP server assigns, their corresponding MAC addresses, and lease expirations +Used to see all entries in a router’s NAT translation table + +Used to display NAT configuration and statistical information on a router, such as inside and outside interfaces, total translations, number of expired translations, address ACL, and address pool information + + +ipconfig + +ipconfig /all + + + +show ip interface interface_type interface_number + +show ip dhcp conflict + + + +show ip dhcp binding + + +show ip nat translations + +show ip nat statistics + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting IPv6 Addressing: This section explains how IPv6 devices determine whether traf-fic is destined locally or remotely. In addition, the section covers how MAC addresses are learned with Neighbor Solicitation and Neighbor Advertisement messages when using IPv6. + +■ Troubleshooting IPv6 Address Assignment: This section identifies the different methods that you can use to assign IPv6 addresses to clients. These meth-ods include SLAAC, stateless DHCPv6, and state- +ful DHCPv6. You will also learn how to verify and troubleshoot IPv6 address assignment methods. + +■ IPv6 Addressing Trouble Tickets: This section pro-vides trouble tickets that demonstrate how a struc-tured troubleshooting process can be used to solve a reported problem. + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 10 + + + + +Troubleshooting IPv6 Addressing and Addressing Technologies + + +Most organizations are still using IPv4; however, sooner or later they will have to switch to IPv6. When comparing IPv6 to IPv4, there is a whole lot more to IPv6 than it just being a larger address space. For example, because broadcasts have been removed from IPv6, multicast addresses are used in its place for addressing functions. Therefore, you need to be aware of these multicast addresses to successfully troubleshoot IPv6 address-ing issues. + +This chapter covers how an IPv6-enabled device determines whether the destination is local or remote. You will also learn how MAC addresses are determined for known IPv6 addresses, and you will explore the various options for address assignment and what to look for while troubleshooting related issues. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 10-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 10-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting IPv6 Addressing + +Troubleshooting IPv6 Addressing Assignment + +Questions +1–4 + +5–10 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + + + + +From the Library of Outcast Outcast +368 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +1. What protocol is used with IPv6 to determine the MAC address of a device in the same local-area network? + +a. Address Resolution Protocol + +b. Inverse Address Resolution Protocol + +c. Neighbor Discovery Protocol + +d. Neighbor Solicitation + +2. What type of message is used to determine the MAC address of a known IPv6 address? + +a. Router Solicitation + +b. Router Advertisement + +c. Neighbor Solicitation + +d. Neighbor Advertisement + +3. Which of the following are true when using EUI-64? (Choose two answers.) + +a. The interface MAC address is used unmodified. + +b. The interface MAC address is used with FFFE added to the middle. + +c. The seventh bit from the left in the MAC address is flipped. + +d. The seventh bit from the right in the MAC address is flipped. + +4. What command is used on a Cisco IOS router to enable SLAAC on an interface? + +a. ipv6 address autoconfig + +b. ipv6 address dhcp + +c. ipv6 address prefix eui-64 + +d. ipv6 nd ra suppress + +5. What are requirements for stateless autoconfiguration to function? (Choose three answers.) + +a. The prefix must be a /64. + +b. The router must be sending and not suppressing RA messages. + +c. The router must be enabled for IPv6 unicast routing. + +d. The router must be sending RS messages. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 369 + +6. Which command is used on a Cisco IOS router to verify the IPv6 addresses that have been deployed to clients? + +a. show ipv6 dhcp mappings + +b. show ipv6 dhcp interface + +c. show ipv6 dhcp binding + +d. show ipv6 dhcp pool + +7. Which command is used to enable a router to inform clients that they need to get additional configuration information from a DHCPv6 server? + +a. ipv6 nd ra suppress + +b. ipv6 dhcp relay destination + +c. ipv6 address autoconfig + +d. ipv6 nd other-config-flag + +8. Which DHCPv6 message type is sent from the client as it is searching for a DHCPv6 server? + +a. ADVERTISE + +b. REPLY + +c. SOLICIT + +d. REQUEST + +9. What is needed when a DHCPv6 server resides in a different network than the clients it is providing IPv6 addresses to? + +a. Address Resolution Protocol + +b. Neighbor Discovery Protocol + +c. Relay agent + +d. Network Address Translation + +10. What command enables you to configure a router interface as a DHCPv6 relay agent? + +a. ipv6 forwarder + +b. ipv6 helper-address + +c. ipv6 dhcp relay destination + +d. ipv6 dhcp client + + + + + + + +From the Library of Outcast Outcast +370 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting IPv6 Addressing + +Just like your personal street address uniquely defines where you live, an IPv6 address uniquely defines where a device resides. Your street address is made of two parts, the street name and the number of your residence; and the combination of these will be unique. The same is true with IPv6 addresses. They are made up of two parts. The first 64 bits usually represent the subnet prefix (what network you belong to), and the last 64 bits usually represent the interface ID/host ID (who you are in the network). + +This section covers IPv6 addressing and assignment so that you are armed with the knowledge needed for troubleshooting IPv6 addressing issues. + +IPv6 Addressing Review + +As with IPv4, it is important that devices are configured with the appropriate IPv6 address based on where they reside so that packets can be successfully routed to and from them. Refer to Figure 10-1, which depicts an IPv6 network. 2001:db8:A:A::/64 rep-resents the first 64 bits of the IPv6 address, which is the subnet prefix. This is the IPv6 network the nodes reside in. Router R1 has an interface IPv6 address of 2001:db8:a:a::1 where the last 64 bits, which are ::1 in this case, represent the interface/host ID or who it is in the IPv6 network. PC1 is ::10 and PC2 is ::20. All the devices in 2001:db8:a:a::/64 are configured with a default gateway address of R1’s Gig0/0 interface, which is 2001:db8:a:a::1. + +::10 +PC1 2001:db8:a:a::/64 + + + +Default Gateway 2001:db8:a:a::1 + +::1 +Gi0/0 Gi1/0 +Gi0/0 ::2 R1 + + +2001:db8:d::1 + + +PC2 R2 + +::20 + +Figure 10-1 IPv6 Addressing Example + + +Neighbor Solicitation and Neighbor Advertisement + +Just like IPv4, when a host wants to communicate with another host, it compares its sub-net bits to the exact same bits in the destination IP address. If they match, both devices are in the same subnet; if they do not match, both devices are in different subnets. If both + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 371 + + + + + + + + + + + + +Key Topic + +devices are in the same subnet, they can communicate directly with each other, and if they are in different subnets, they will need to communicate through the default gateway. + +For example, referring to Figure 10-1 again, when PC1 needs to communicate with the server at 2001:db8:d::1, it realizes that the web server is in a different network. Therefore, PC1 has to send the frame to the default gateway using the default gateway’s MAC address. In IPv4, Address Resolution Protocol (ARP) was used to determine the MAC associated with an IPv4 address. ARP does not exist in IPv6, and neither do broadcasts. Instead, Neighbor Discovery Protocol (NDP) is used, which is based on multicasts. + +Refer to Figure 10-2. In this case, PC1 sends a Neighbor Solicitation (NS) message sourced from its own IPv6 address 2001:db8:a:a::10 and MAC address 0800:275d:06d6. However, the destination IPv6 address and MAC address are solicited node multicast addresses because broadcasts do not exist. The IPv6 address solicited node multicast looks like this FF02:0:0:0:0:1:FFXX:XXXX. The X’s are replaced with the last 24 bits (6 hex values) of the destination’s IPv6 address. In this case, the IPv6 address of R1 (the des-tination) is 2001:db8:a:a::1. Therefore, the last 24 bits in hexadecimal would be 00:0001. So, the IPv6 destination solicited node multicast address would be FF02::1:FF00:1. The destination MAC solicited node multicast address looks like this 33:33:FF:XX:XX:XX. The last 24 bits (6 hex values) are the last 6 hex values of the IPv6 address (not MAC +address). Therefore, the destination MAC address is 33:33:FF:00:00:01. + + + + +Neighbor Solicitation + +Source +::10 IPv6 2001:db8:a:a::10 +MAC 0800:275d:06d6 +PC1 + +Destination FF02::1:FF00:1 33:33:FF:00:00:01 + + + + +Default Gateway 2001:db8:a:a::1 + +::1 2001:db8:a:a::/64 Gi0/0 + +Gi0/0 ::2 + + +Gi1/0 2001:db8:d::1 +R1 + + +PC2 R2 + +::20 + +Figure 10-2 Neighbor Solicitation Example + +Why does NDP go to this length just to send an NS message? Remember, there are no broadcasts with IPv6 at Layer 2 and Layer 3. Therefore, unicast communication or multi-cast communication is needed. Because we do not know the destination MAC, unicast is out of the question until we know it. So, multicast is used. However, you do not want to multicast to everyone, you only want to multicast to those devices that need to receive the multicast packet; therefore, those devices listening to the multicast group address. So, what is the group in this case? It is R1, the default gateway! + + + + + +From the Library of Outcast Outcast +372 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +By default, all devices will create their own solicited node multicast group by appending the last 6 hex values of their IPv6 address to the IPv6 solicited node multicast address FF02:0:0:0:0:1:FF00::/104. As a result, when PC1 in our example sends the NS message, the destination is the solicited node multicast address that R1 is listening to. To verify the multicast groups that a router interface is listening to, you can use the show ipv6 interface interface_type interface_number command, as shown in Example 10-1. Notice that R1 is listening for packets destined to the multicast group FF02::1:FF00:1, as we +had discussed with Figure 10-2. In addition, you can view the global unicast addresses assigned to the interface as well as the link-local address. + +Example 10-1 Verifying IPv6 Multicast Groups a Router Interface Is Listening To +Key +Topic R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80A:4FF:FE84:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A:A::/64 +Joined group address(es): +FF02::1 +FF02::1:FF00:1 +FF02::1:FF84:8 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND NS retransmit interval is 1000 milliseconds + +After R1 receives the NS message, it responds with a Neighbor Advertisement (NA), which will be a unicast packet. Refer to Figure 10-3, which shows R1 sending the NA to PC1 with a source IPv6 address 2001:db8:a:a::1 and MAC address ca0a.0484.0008. + +Now PC1 can communicate with the server at 2001:db8:d::1 because it can send the frame to R1 and then R1 can route it. + +You can verify the IPv6 address of a PC using the ipconfig command, as shown in Example 10-2. In this example, PC1 has a link-local address of fe80::a00:27ff:fe5d:6d6 and a global unicast address of 2001:db8:a:a::10, which was statically configured. Notice the %11 at the end of the link-local address in this case. This is the interface identification number. This is needed so that the system knows which interface to send the packets out of. The reason is because you can have multiple interfaces on the same device with the same link-local address assigned to it. + + + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 373 + + + +Neighbor Advertisement + +Destination +::10 IPv6 2001:db8:a:a::10 +MAC 0800:275d:06d6 +PC1 + +Source 2001:db8:a:a::1 ca0a.0484.0008 + + + + +Default Gateway 2001:db8:a:a::1 + +::1 2001:db8:a:a::/64 Gi0/0 + +Gi0/0 ::2 + + +Gi1/0 2001:db8:d::1 +R1 + + +PC2 R2 + +::20 + +Figure 10-3 Neighbor Advertisement Example + +Example 10-2 Using ipconfig to Verify IPv6 Addressing + +C:\PC1>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IPv6 Address. . . . . . . . . . . : 2001:db8:a:a::10 +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : 2001:db8:a:a::1 +10.1.1.1 + + +EUI-64 + + + + + + + + + +Key Topic + +Recall that the IPv6 address consists of two parts: the subnet ID and the interface/host ID. The host ID is usually 64 bits long, and as a result is not something you want to be configuring manually in your organization. Although you can statically define the inter-face ID, the best approach is to allow your end devices to automatically assign their own interface ID for global unicast and link-local addresses based on the IEEE EUI-64 stan-dard. + +EUI-64 takes the clients MAC address, which is 48 bits, splits it in half, and adds the hex values FFFE in the middle. In addition, it takes the seventh bit from the left and flips it. +So, if it is a 1, it becomes a 0, and if it is a 0, it becomes a 1. Look back at Example 10-2. + + + + + + +From the Library of Outcast Outcast +374 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Notice the link-local address is fe80::a00:27ff:fe5d:6d6. The subnet ID is FE80::, and the interface ID is a00:27ff:fe5d:6d6. Let’s fill in the missing leading 0s so that the address is 0a00:27ff:fe5d:06d6. This is an EUI-64 interface ID because it has FFFE in it. Let’s see how it is derived. + +Example 10-3 displays the output of ipconfig /all on PC1. Notice that the MAC address is 08-00-27-5D-06-D6. Split it in half and add FFFE in the middle so that you get +08-00-27-FF-FE-5D-06-D6. Now group the hex values into groups of four and replace the dashes (-) with colons, like this: 0800:27FF:FE5D:06D6. This looks very close to what is listed in the link-local address, but it is not exact. The interface ID in the link-local address starts with 0a and ours starts with 08. This is because the seventh bit is flipped, as discussed earlier. Let’s flip it. 08 hex in binary is 00001000. The seventh bit from the left is a 0, so make it a 1. Now you have 00001010. Convert to hex and you get 0a. So, our interface ID is 0A00:27FF:FE5D:06D6. + +Example 10-3 Using ipconfig /all to Verify IPv6 Addressing + +C:\PC1>ipconfig /all + +Windows IP Configuration + +Host Name . . . . . . . . . . . . : PC1_Win7 +Primary Dns Suffix . . . . . . . : +Node Type . . . . . . . . . . . . : Broadcast +IP Routing Enabled. . . . . . . . : No +WINS Proxy Enabled. . . . . . . . : No + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +DHCP Enabled. . . . . . . . . . . : No +Autoconfiguration Enabled . . . . : Yes +IPv6 Address. . . . . . . . . . . : 2001:db8:a:a::10(Preferred) +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11(Preferred) +IPv4 Address. . . . . . . . . . . : 10.1.1.10(Preferred) +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : 2001:db8:a:a::1 +10.1.1.1 +DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1 +fec0:0:0:ffff::2%1 +fec0:0:0:ffff::3%1 +NetBIOS over Tcpip. . . . . . . . : Enabled + +By default, routers will use EUI-64 when generating the interface portion of the link-local address of an interface. Modern Windows PCs will randomly generate the interface + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 375 + +portion by default for both the link-local address and the global unicast address when autoconfiguring their IPv6 addresses. However, this can be changed so that EUI-64 is used instead. When statically configuring an IPv6 address on a PC, the interface portion is manually assigned. However, on a router, if you want to use EUI-64 for a statically configured global unicast address, you can use the eui-64 keyword at the end of the ipv6 address command, as shown in Example 10-4. + +Example 10-4 Using EUI-64 on a Router Interface + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#interface gigabitEthernet 0/0 +R2(config-if)#ipv6 address 2001:db8:a:a::/64 eui-64 + +You can verify the global unicast address and the EUI-64 interface ID assigned to it using the show ipv6 interface command, as shown in Example 10-5. In this case, R2’s Gig0/0 interface has a global unicast address that obtained the interface ID from the EUI-64 stan-dard. + +Example 10-5 Verifying EUI-64 on a Router Interface Key +Topic R2#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80E:15FF:FEF4:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A:C80E:15FF:FEF4:8, subnet is 2001:DB8:A:A::/64 [EUI] +Joined group address(es): +FF02::1 +FF02::1:FFF4:8 +MTU is 1500 bytes +...output omitted... + + +Troubleshooting IPv6 Address Assignment + +Assigning any IP address (IPv4 or IPv6) manually is not a scalable option. With IPv4, you had Dynamic Host Configuration Protocol (DHCP) as your dynamic option. With IPv6, you have three dynamic options to choose from: stateless address autoconfiguration (or SLAAC for short), stateful DHCPv6, or stateless DHCPv6. Let’s look at the issues that might arise for each and how we can troubleshoot these issues. + +Stateless Address Autoconfiguration/SLAAC + +Stateless address autoconfiguration (SLAAC) is designed so that devices are able to con-figure their own IPv6 address, prefix, and default gateway without a DHCPv6 server. Windows PCs are automatically enabled for SLAAC and will generate their own IPv6 addresses, as shown in Example 10-6, which displays the output of ipconfig /all on PC1. + + + +From the Library of Outcast Outcast +376 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 10-6 Using ipconfig /all to Verify IPv6 SLAAC Is Enabled + +C:\PC1>ipconfig /all + +Windows IP Configuration + +Host Name . . . . . . . . . . . . : PC1_Win7 +Primary Dns Suffix . . . . . . . : +Node Type . . . . . . . . . . . . : Broadcast +IP Routing Enabled. . . . . . . . : No +WINS Proxy Enabled. . . . . . . . : No + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : SWITCH.local +Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +DHCP Enabled. . . . . . . . . . . : Yes +Autoconfiguration Enabled . . . . : Yes +IPv6 Address. . . . . . . . . . . : 2001:db8::a00:27ff:fe5d:6d6(Preferred) +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11(Preferred) +IPv4 Address. . . . . . . . . . . : 10.1.1.10(Preferred) +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +...output omitted... + +On Cisco routers, if you want to take advantage of SLAAC, you need to enable it manu-ally on an interface with the ipv6 address autoconfig command, as shown in Example 10-7. + +Example 10-7 Enabling SLAAC on a Router Interface +Key +Topic R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#interface gigabitEthernet 0/0 +R2(config-if)#ipv6 address autoconfig + +When a Windows PC and router interface are enabled for SLAAC, they will send a Router Solicitation (RS) message to determine whether there are any routers connected to the local link. In turn, they wait for a router to send a Router Advertisement (RA) that identifies the prefix being used by the router (default gateway) connected to the same network they are on. They will then use that prefix information to generate their own IPv6 address in the same network as the router interface that generated the RA. The router will use EUI-64 for the interface portion, and the PC will randomly generate the interface portion unless it is configured to use EUI-64. In addition, the PC will use the IPv6 link-local address of the device that sent the RA as the default gateway address. + + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 377 + + + +Key Topic + +Refer to Figure 10-4, which displays the RA process. R1 sends an RA out its Gig0/0 interface. The source IPv6 address is the Gig0/0 link-local address, and the source MAC address is the MAC address of interface Gig0/0. The destination IPv6 address is the all-nodes link-local multicast IPv6 address of FF02::1. The destination MAC address is the all-nodes destination MAC address of 33:33:00:00:00:01 that is associated with the all-nodes link-local multicast IPv6 address FF02::1. By default, all IPv6-enabled interfaces +listen for packets and frames destined for these two addresses. + + + +Destination +MAC 33:33:00:00:00:01 IPv6 FF02::1 + +::10 + +Source ca0a.0e3c.0008 +FE80::C80A:EFF:FE3C:8 + + +PC1 Router Advertisement + + +Default Gateway 2001:db8:a:a::1 + +::1 2001:db8:a:a::/64 Gi0/0 + +Gi0/0 ::2 + + +Gi1/0 2001:db8:d::1 +R1 + + +PC2 R2 + +::20 + +Figure 10-4 Router Advertisement Example + +Once PC1 in Figure 10-4 receives the RA, it takes the prefix included in the RA, which is 2001:db8:a:a::/64, and in this case uses EUI-64 to create its IPv6 address. It also takes the link-local address from the source of the RA and uses it as the default gateway address, as shown in Example 10-8, which displays the output of ipconfig on PC1. + +Example 10-8 Verifying IPv6 Addresses Generated by SLAAC on a PC + +C:\PC1>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IPv6 Address. . . . . . . . . . . : 2001:db8:a:a:a00:27ff:fe5d:6d6 +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : fe80::c80a:eff:fe3c:8%11 +10.1.1.1 + + + +Key Topic + +To verify an IPv6 address generated by SLAAC on a router interface, use the show ipv6 interface command. As shown in Example 10-9, the global unicast address was generated +using SLAAC. Also notice at the bottom of the example that the default router is listed + + + + +From the Library of Outcast Outcast +378 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +as the link-local address of R1. However, note that this will occur only if IPv6 unicast routing has not been enabled on the router and as a result the router is acting as an end device. + +Example 10-9 Verifying IPv6 Addresses Generated by SLAAC on a Router Interface + +R2#show ipv6 interface gig 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80B:EFF:FE3C:8 +No Virtual link-local address(es): +Stateless address autoconfig enabled +Global unicast address(es): +2001:DB8:A:A:C80B:EFF:FE3C:8, subnet is 2001:DB8:A:A::/64 [EUI/CAL/PRE] +valid lifetime 2591816 preferred lifetime 604616 +Joined group address(es): +FF02::1 +FF02::1:FF3C:8 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND NS retransmit interval is 1000 milliseconds +Default router is FE80::C80A:EFF:FE3C:8 on GigabitEthernet0/0 + +It is important to realize that RAs are generated by default on router interfaces only if the router interface is enabled for IPv6, IPv6 unicast routing is enabled, and RAs are not being suppressed on the interface. Therefore, if SLAAC is not working, check the follow-ing: + + +Key ■ Topic + + +■ + + +■ + + + +■ + +Make sure that IPv6 unicast routing is enabled on the router that should be generat-ing RAs by using the show run | include ipv6 unicast-routing command, as shown in Example 10-10. + +Make sure that the appropriate interface is enabled for IPv6 with the show ipv6 interface command, as shown in Example 10-11. + +Make sure that the router interface advertising RAs has a /64 prefix by using the show ipv6 interface command, as shown in Example 10-11. (SLAAC works only if the router is using a /64 prefix.) + +Make sure that RAs are not being suppressed on the interface by using the show +ipv6 interface command, as shown in Example 10-12. In this example they are. + + +Example 10-10 Verifying IPv6 Unicast Routing Is Enabled on a Router + +R1#show run | include ipv6 unicast-routing +ipv6 unicast-routing + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 379 + +Example 10-11 Verifying an Interface Is Enabled for IPv6 +Key +Topic R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80A:EFF:FE3C:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A:A::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:FF00:1 +FF02::1:FF3C:8 +...output omitted... + + +Example 10-12 Verifying that RAs Are Not Suppressed Key +Topic R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80A:EFF:FE3C:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A:A::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:FF00:1 +FF02::1:FF3C:8 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND RAs are suppressed (all) +Hosts use stateless autoconfig for addresses. + +In addition, if you have more than one router on the subnet generating RAs, which is normal when you have redundant default gateways, the clients will learn about multiple default gateways from the RAs, as shown in Example 10-13. The top default gateway is R2’s link-local address, and the bottom default gateway is R1’s link-local address. Now, this might seem like a benefit; however, it is a benefit only if both default gateways can reach the same networks. Refer to Figure 10-5. If PC1 uses R2 as the default gateway, the packets to the web server will be dropped because R2 does not have a way to route pack-ets to the web server, as shown in the Example 10-14 ping, unless it redirects them back out the interface they arrived on, which is not a normal behavior. Therefore, if users are complaining that they cannot access resources, and they are connected to a network with + + + +From the Library of Outcast Outcast +380 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +multiple routers generating RAs, check the default gateways learned by SLAAC and make sure that those default gateways can route to the intended resources. + +Example 10-13 Verifying Default Gateways Configured on a PC +Key +Topic C:\PC1>#ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : +IPv6 Address. . . . . . . . . . . : 2001:db8:a:a:a00:27ff:fe5d:6d6 +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : fe80::c80b:eff:fe3c:8%11 +fe80::c80a:eff:fe3c:8%11 +10.1.1.1 + + +::10 + +PC1 + +Default Gateway 2001:db8:a:a::1 + + + + +::1 2001:db8:a:a::/64 Gi0/0 Gi1/0 +Gi0/0 ::2 R1 + + + + +2001:db8:d::1 + + +PC2 R2 + +::20 + +Figure 10-5 Redundant Default Gateways + +Example 10-14 Failed Ping from PC1 to 2001:db8:a:a::1 + +C:\PC1>ping 2001:db8:d::1 + +Pinging 2001:db8:d::1 with 32 bytes of data: +Destination net unreachable. +Destination net unreachable. +Destination net unreachable. +Destination net unreachable. + +Ping statistics for 2001:db8:d::1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 381 + +Stateful DHCPv6 + +Although a device is able to determine its IPv6 address, prefix, and default gateway using SLAAC, there is not much else the devices can obtain. In a modern-day network, the devices may also need Network Time Protocol (NTP) server information, domain name information, DNS server information, and TFTP server information to name a few. To hand out the IPv6 addressing information along with all optional information, you need to use a DHCPv6 server. Both Cisco routers and multilayer switches can act as DHCP servers. Example 10-15 provides a sample DHCPv6 configuration on R1 and the ipv6 dhcp server interface command necessary to enable the interface to use the DHCP pool for handing out IPv6 addressing information. If you are troubleshooting an issue where clients are not receiving IPv6 addressing information or wrong IPv6 addressing informa-tion from a router or multilayer switch acting as a DHCPv6 server, check the interface and +make sure that it has been associated with the correct pool. + +Example 10-15 Sample DHCPv6 Configuration on R1 +Key +Topic R1#show run | section dhcp +ipv6 dhcp pool DHCPV6POOL +address prefix 2001:DB8:A:A::/64 +dns-server 2001:DB8:B:B::1 +domain-name TSHOOT.com +R1#show run interface gigabitEthernet 0/0 +Building configuration... + +Current configuration : 173 bytes +! +interface GigabitEthernet0/0 +no ip address +ipv6 address 2001:DB8:A:A::1/64 +ipv6 dhcp server DHCPV6POOL +end + +In Example 10-16, you can see samples of the show ipv6 dhcp binding command, which displays the IPv6 addresses that are being used by clients, the show ipv6 dhcp interface command, which displays the IPv6 addresses that are being used by clients, and the show ipv6 dhcp pool command, which displays the configured pools. + +Example 10-16 Verifying DHCPv6 Information on R1 Key +Topic R1#show ipv6 dhcp binding +Client: FE80::A00:27FF:FE5D:6D6 +DUID: 000100011B101C740800275D06D6 +Username : unassigned +VRF : default +IA NA: IA ID 0x0E080027, T1 43200, T2 69120 +Address: 2001:DB8:A:A:D519:19AB:E903:F802 + + + + +From the Library of Outcast Outcast +382 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +preferred lifetime 86400, valid lifetime 172800 +expires at May 25 2014 08:37 PM (172584 seconds) + +R1#show ipv6 dhcp interface +GigabitEthernet0/0 is in server mode +Using pool: DHCPV6POOL +Preference value: 0 +Hint from client: ignored +Rapid-Commit: disabled + +R1#show ipv6 dhcp pool +DHCPv6 pool: DHCPV6POOL +Address allocation prefix: 2001:DB8:A:A::/64 valid 172800 preferred 86400 (1 in use, 0 conflicts) +DNS server: 2001:DB8:B:B::1 +Domain name: TSHOOT.com +Active clients: 0 + + +Stateless DHCPv6 + +Stateless DHCPv6 is a combination of SLAAC and DHCPv6. In this case, a router’s RA is used by the clients to automatically determine their IPv6 address, prefix, and default +gateway. Included in the RA is a flag that tells the client to get other nonaddressing infor-mation from a DHCPv6 server, such as the address of a DNS server or a TFTP server. To accomplish this you need to ensure that the ipv6 nd other-config-flag interface configu-ration command is enabled. This ensures that the RA informs the client that it must con-tact a DHCPv6 server for other information. In Example 10-17, you can see this command configured under interface Gigabit Ethernet 0/0. Also, in Example 10-17, you can see the output of show ipv6 interface gigabitEthernet 0/0, which states that hosts will obtain +IPv6 addressing from stateless autoconfig and other information from a DHCP server. + +Example 10-17 Verifying Stateless DHCPv6 +Key +Topic R1#show run int gig 0/0 +Building configuration... + +Current configuration : 171 bytes +! +interface GigabitEthernet0/0 +no ip address +media-type gbic +speed 1000 +duplex full +negotiation auto +ipv6 address 2001:DB8:A:A::1/64 + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 383 + +ipv6 nd other-config-flag +end + +R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80A:EFF:FE3C:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A:A::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:FF00:1 +FF02::1:FF3C:8 +...output omitted... +ND advertised default router preference is Medium +Hosts use stateless autoconfig for addresses. +Hosts use DHCP to obtain other configuration. + +Example 10-18 shows the ipconfig /all output on PC1 after it has used stateless autocon-fig for IPv6 addressing and then contacted a DHCPv6 server for DNS and domain name information. + +Example 10-18 Verifying IPv6 Configuration on PC1 + +C:\PC1>ipconfig /all + +Windows IP Configuration + +Host Name . . . . . . . . . . . . : PC1_Win7 +Primary Dns Suffix . . . . . . . : +Node Type . . . . . . . . . . . . : Broadcast +IP Routing Enabled. . . . . . . . : No +WINS Proxy Enabled. . . . . . . . : No +DNS Suffix Search List. . . . . . : TSHOOT.com + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : TSHOOT.com +Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter +Physical Address. . . . . . . . . : 08-00-27-5D-06-D6 +DHCP Enabled. . . . . . . . . . . : No +Autoconfiguration Enabled . . . . : Yes +IPv6 Address. . . . . . . . . . . : 2001:db8:a:a:a00:27ff:fe5d:6d6(Preferred) + +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11(Preferred) +IPv4 Address. . . . . . . . . . . : 10.1.1.10(Preferred) + + + +From the Library of Outcast Outcast +384 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : fe80::c80a:eff:fe3c:8%11 +10.1.1.1 +DHCPv6 IAID . . . . . . . . . . . : 235405351 +DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1B-10-1C-74-08-00-27-5D-06-D6 + +DNS Servers . . . . . . . . . . . : 2001:db8:b:b::10 +NetBIOS over Tcpip. . . . . . . . : Enabled +Connection-specific DNS Suffix Search List : TSHOOT.com + + +DHCPv6 Operation + +DHCPv6 has a four-way negotiation process, like IPv4. However, DHCPv6 uses the fol-lowing messages: + +Step 1. Key +Topic + +Step 2. + + +Step 3. + + +Step 4. + + +SOLICIT: A client sends this message to locate DHCPv6 servers using +the multicast address FF02::1:2, which is the all DHCPv6 servers multicast address. + +ADVERTISE: Servers respond to SOLICIT messages with a unicast ADVERTISE message offering addressing information to the client. + +REQUEST: The client sends this message to the server confirming the addresses provided and any other parameters. + +REPLY: The server finalizes the process with this message. + + +As a reference, Table 10-2 provides a comprehensive listing of DHCPv6 message types you might encounter while troubleshooting a DHCPv6 issue. + +Table 10-2 DHCP Message Types + + +DHCP Message +SOLICIT + +ADVERTISE + +REQUEST + +CONFIRM + +RENEW + +REBIND + +Description +A client sends this message in an attempt to locate a DHCPv6 server. +A DHCPv6 server sends this message in response to a SOLICIT, indicating it is available. +This message is a request for IP configuration parameters sent from a client to a specific DHCPv6 server. +Sent from client to any server to determine whether the address it was assigned is still appropriate. +Sent from client to server that assigned the address, to extend the lifetime of the addresses assigned. +When there is no response to a RENEW, a REBIND is sent from client to any server to extend the lifetime on the address assigned. + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 385 + + + +DHCP Message REPLY + + + +RELEASE + +DECLINE + +RECONFIGURE + +INFORMATION-REQUEST + + +RELAY-FORW + +RELAY-REPL + +Description +Sent from server to client containing assigned address and configuration parameters in response to a SOLICIT, REQUEST, RENEW, or REBIND message received from a client. +Sent from client to server to inform the server that the assigned address is no longer needed. +Sent from client to server to inform the server that the assigned address is already in use. +Sent from server to client when the server has new or updated information. +Sent from client to server when the client only needs additional configuration information without any IP address assignment. +Used by relay agent to forward messages to DHCP server. + +Used by DHCP server to send messages back to the relay agent. + + + + +DHCPv6 Relay Agent + +All the DHCPv6 examples so far have included the DHCP server within the same local network. However, in most networks, the DHCP server will be located in a different network, which creates an issue. If you review the multicast address of the SOLICIT message, you will notice it is a link-local scope multicast address. It starts with FF02. Therefore, the multicast will not leave the local network, and the client will not be able to reach the DHCPv6 server. + +To relay the DHCPv6 messages to a DHCPv6 server in another network, the local router interface in the network the client belongs needs to be configured as a relay agent with the ipv6 dhcp relay destination interface configuration command. Example 10-19 shows interface Gigabit Ethernet 0/0 configured with the command ipv6 dhcp relay destination 2001:db8:a:b::7, which will be used to forward SOLICIT messages to a DHCPv6 server at the address listed. + + +Example 10-19 +Key +Topic R1#config t + + +Configuring R1 as a DHCPv6 Relay Agent + +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#interface gigabitethernet0/0 +R1(config-if)#ipv6 dhcp relay destination 2001:db8:a:b::7 + + + + + + + +From the Library of Outcast Outcast +386 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +IPv6 Addressing Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 10-6 . + +2001:db8:a:b::7 +DHCP Server +::10 + +PC1 + + + +Default Gateway 2001:db8:a:a::1 + +::1 2001:db8:a:a::/64 Gi0/0 Gi1/0 +Gi0/0 ::2 R1 + + +2001:db8:d::1 + + +PC2 R2 + +::20 + +Figure 10-6 IPv6 Addressing Trouble Tickets Topology + + +Trouble Ticket 10-1 + +Problem: PC1 is not able to access resources on the web server at 2001:db8:d::1. + +Your network uses stateless autoconfiguration for IPv6 addressing and DHCPv6 for addi-tional options such as a domain name, TFTP server addresses, and DNS server addresses. + +You begin troubleshooting by verifying the issue with a ping from PC1 to 2001:db8:d::1. As shown in Example 10-20, the ping fails. + +Example 10-20 Failed Ping from PC1 to Web Server at 2001:db8:d::1 + +C:\PC1>ping 2001:db8:d::1 + +Pinging 2001:db8:d::1 with 32 bytes of data: +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. + +Ping statistics for 2001:db8:d::1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +You ping the default gateway at 2001:db8:a:a::1, but the ping fails, as shown in Example 10-21. + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 387 + +Example 10-21 Failed Ping from PC1 to Default Gateway at 2001:db8:a:a::1 + +C:\PC1>ping 2001:db8:a:a::1 + +Pinging 2001:db8:a:a::1 with 32 bytes of data: +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. + +Ping statistics for 2001:db8:a:a::1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next you verify the IPv6 addresses on PC1 using the ipconfig command. Example 10-22 indicates that PC1 is not generating its own global unicast address using stateless auto-configuration or identifying a default gateway on the network. + +Example 10-22 Verifying IPv6 Addressing on PC1 + +C:\PC1>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : TSHOOT.com +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : 10.1.1.1 + +Your phone rings, and the user at PC2 is indicating that he cannot access any of the IPv6-enabled resources. You access PC2 and issue the ipconfig command, as shown in +Example 10-23, and notice that it is not generating an IPv6 address either or identifying a default gateway. + +Example 10-23 Verifying IPv6 Addressing on PC2 + +C:\PC2>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : TSHOOT.com +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:ce47%9 +IPv4 Address. . . . . . . . . . . : 10.1.1.20 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : 10.1.1.1 + + + +From the Library of Outcast Outcast +388 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Recall that SLAAC relies on RAs. Therefore, R1’s Gig0/0 interface needs to be sending RAs on the link for PC1 and PC2 to generate their own IPv6 addresses using SLAAC. You issue the command show ipv6 interface gigabitethernet0/0 on R1, as shown in Example 10-24 . The output indicates that hosts will use SLAAC for addresses, and DHCP will be used for other configuration values. However, it also indicates that RAs are sup-pressed. Therefore, PC1 and PC2 will not be receiving RAs that provide the prefix infor-mation necessary to perform autoconfiguration. + +Example 10-24 Verifying Whether RAs Are Suppressed on R1 + +R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80A:EFF:FE3C:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A:A::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:2 +FF02::1:FF00:1 +FF02::1:FF3C:8 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND RAs are suppressed (all) +Hosts use stateless autoconfig for addresses. +Hosts use DHCP to obtain other configuration. + +You issue the command show run interface gigabitethernet0/0 to verify the configura-tion commands on the interface. As shown in Example 10-25, the interface is configured with the command ipv6 nd ra suppress all, which stops R1 from sending RAs. + +Example 10-25 Verifying Interface Configuration on R1 + +R1#show run interface gigabitEthernet 0/0 +Building configuration... + +Current configuration : 241 bytes +! +interface GigabitEthernet0/0 +no ip address +ipv6 address 2001:DB8:A:A::1/64 +ipv6 nd other-config-flag +ipv6 nd ra suppress all + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 389 + +ipv6 dhcp relay destination 2001:DB8:A:B::7 +end + +After you remove this command with the no ipv6 nd ra suppress all command, PC1 suc-cessfully generates a global IPv6 address and identifies an IPv6 default gateway, as shown in Example 10-26. + +Example 10-26 Verifying IPv6 Addressing on PC1 + +C:\PC1>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : TSHOOT.com +IPv6 Address. . . . . . . . . . . : 2001:db8:a:a:a00:27ff:fe5d:6d6 +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : fe80::c80a:eff:fe3c:8%11 +10.1.1.1 + +You confirm that IPv6 resources are accessible by pinging 2001:db8:d::1 in Example 10-27, and it is successful. You then call the user at PC2 and confirm that he can access the resources as well. He indicates that he is. + +Example 10-27 Successful Ping from PC1 to Web Server at 2001:db8:d::1 + +C:\PC1>ping 2001:db8:d::1 +Pinging 2001:db8:d::1 with 32 bytes of data: +Reply from 2001:db8:d::1: time=37ms +Reply from 2001:db8:d::1: time=35ms +Reply from 2001:db8:d::1: time=38ms +Reply from 2001:db8:d::1: time=38ms + +Ping statistics for 2001:db8:d::1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 35ms, Maximum = 38ms, Average = 36ms + + +Trouble Ticket 10-2 + +Problem: PC1 is not able to access resources on the web server at 2001:db8:d::1. + +Your network uses stateless autoconfiguration for IPv6 addressing and DHCPv6 for addi-tional options such as a domain name, TFTP server addresses, and DNS server addresses. + + + + +From the Library of Outcast Outcast +390 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +You begin troubleshooting by verifying the issue with a ping from PC1 to 2001:db8:d::1. As shown in Example 10-28, the ping fails. + +Example 10-28 Failed Ping from PC1 to Web Server at 2001:db8:d::1 + +C:\PC1>ping 2001:db8:d::1 + +Pinging 2001:db8:d::1 with 32 bytes of data: +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. + +Ping statistics for 2001:db8:d::1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +You ping the default gateway at 2001:db8:a:a::1, but the ping fails, as shown in Example 10-29. + +Example 10-29 Failed Ping from PC1 to Default Gateway at 2001:db8:a:a::1 + +C:\PC1>ping 2001:db8:a:a::1 + +Pinging 2001:db8:a:a::1 with 32 bytes of data: +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. +PING: transmit failed. General failure. + +Ping statistics for 2001:db8:a:a::1: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +Next you verify the IPv6 addresses on PC1 using the ipconfig command. Example 10-30 indicates that PC1 is not generating its own global unicast address using stateless auto-configuration; however, it is identifying a default gateway on the network at the link-local address fe80::c80a:eff:fe3c:8. + +Example 10-30 Verifying IPv6 Addressing on PC1 + +C:\PC1>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : TSHOOT.com +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 391 + +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : fe80::c80a:eff:fe3c:8%11 +10.1.1.1 + +Your phone rings, and the user at PC2 is indicating that she cannot access any of the IPv6-enabled resources. You access PC2 and issue the ipconfig command, as shown in Example 10-31, and notice that it is experiencing the same issues as PC1. + +Example 10-31 Verifying IPv6 Addressing on PC2 + +C:\PC2>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : TSHOOT.com +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:ce47%9 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : fe80::c80a:eff:fe3c:8%11 +10.1.1.1 + +Recall that SLAAC relies on RAs. Therefore, R1’s Gig0/0 interface needs to be sending RAs on the link for PC1 and PC2 to generate their own IPv6 address using SLAAC. You issue the command show ipv6 interface gigabitethernet0/0 on R1, as shown in Example 10-32. The output indicates that hosts will use SLAAC for addresses, and DHCP will be used for other configuration values. Also, there is no indication that RAs are being sup-pressed. This is also confirmed by the fact that PC1 and PC2 are identifying a default gateway. However, is it the right one? According to Examples 10-30 and 10-31, the default gateway is fe80::c80a:eff:fe3c:8. Based on Example 10-32, this is correct. Review Example 10-32 further; can you see the issue? + +Example 10-32 Verifying Whether RAs Are Suppressed on R1 + +R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C80A:EFF:FE3C:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A::/60 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:2 +FF02::1:FF00:1 +FF02::1:FF3C:8 +MTU is 1500 bytes + + + +From the Library of Outcast Outcast +392 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND advertised reachable time is 0 (unspecified) +ND advertised retransmit interval is 0 (unspecified) +ND router advertisements are sent every 200 seconds +ND router advertisements live for 1800 seconds +ND advertised default router preference is Medium +Hosts use stateless autoconfig for addresses. +Hosts use DHCP to obtain other configuration. + +If you have not spotted it, look at the global prefix assigned to interface Gig0/0: 2001:db8:a::/60. SLAAC works only if the prefix is /64. + +You issue the command show run interface gigabitethernet0/0 to verify the configura-tion commands on the interface. As shown in Example 10-33, the interface is configured with the command ipv6 address 2001:db8:a:a::1/60. RAs are still generated, but SLAAC will not work unless the prefix is a /64. + +Example 10-33 Verifying Interface Configuration on R1 + +R1#show run interface gigabitEthernet 0/0 +Building configuration... + +Current configuration : 216 bytes +! +interface GigabitEthernet0/0 +ipv6 address 2001:DB8:A:A::1/60 +ipv6 nd other-config-flag +ipv6 dhcp relay destination 2001:DB8:A:B::7 +end + +After you remove this command with the no ipv6 address 2001:db8:a:a::1/60 command, and issue the command ipv6 address 2001:db8:a:a::1/64, PC1 successfully generates a global IPv6 unicast address, as shown in Example 10-34. + +Example 10-34 Verifying IPv6 Addressing on PC1 + +C:\PC1>ipconfig + +Windows IP Configuration + +Ethernet adapter Local Area Connection: + +Connection-specific DNS Suffix . : TSHOOT.com +IPv6 Address. . . . . . . . . . . : 2001:db8:a:a:a00:27ff:fe5d:6d6 + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 393 + +Link-local IPv6 Address . . . . . : fe80::a00:27ff:fe5d:6d6%11 +IPv4 Address. . . . . . . . . . . : 10.1.1.10 +Subnet Mask . . . . . . . . . . . : 255.255.255.192 +Default Gateway . . . . . . . . . : fe80::c80a:eff:fe3c:8%11 +10.1.1.1 + +You confirm that IPv6 resources are accessible by pinging 2001:db8:d::1 in Example 10-35, and it is successful. In addition, you contact the user at PC2, and she indicates that everything is fine now. + +Example 10-35 Successful Ping from PC1 to Web Server at 2001:db8:d::1 + +C:\PC1>ping 2001:db8:d::1 +Pinging 2001:db8:d::1 with 32 bytes of data: +Reply from 2001:db8:d::1: time=37ms +Reply from 2001:db8:d::1: time=35ms +Reply from 2001:db8:d::1: time=38ms +Reply from 2001:db8:d::1: time=38ms + +Ping statistics for 2001:db8:d::1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 35ms, Maximum = 38ms, Average = 36ms + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +394 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 10-3 lists a reference of these key topics and the page +numbers on which each is found. + + +Key Table 10-3 Key Topics for Chapter 10 +Topic Key Topic Element Description Page Number + + +Paragraph + +Example 10-1 + +Paragraph + +Example 10-5 + +Example 10-7 + +Paragraph + +Paragraph + +List + +Example 10-11 + +Example 10-12 + +Example 10-13 + +Example 10-15 + +Example 10-16 + +Example 10-17 + +Step list + +Example 10-19 + +Explains the Neighbor Solicitation 371 + +Verifying IPv6 multicast groups a router interface is 372 listening to +Describes the EUI-64 process 373 + +Verifying EUI-64 on a router interface 375 + +Enabling SLAAC on a router interface 376 + +Explains the Router Advertisement process 377 + +Identifies how to verify SLAAC-generated IPv6 377 addresses +Describes issues that may occur while using SLAAC 378 + +Verifying an interface is enabled for IPv6 379 + +Verifying that RAs are not suppressed 379 + +Verifying default gateways configured on a PC 380 + +Sample DHCPv6 configuration on R1 381 + +Verifying DHCPv6 Information on R1 381 + +Verifying stateless DHCPv6 382 + +Describes the four-way negotiation process of 384 DHCPv6 +Verifying IPv6 configuration on PC1 385 + + + + + + + + + +From the Library of Outcast Outcast +Chapter 10: Troubleshooting IPv6 Addressing and Addressing Technologies 395 + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +Neighbor Solicitation, Neighbor Advertisement, Neighbor Discovery, solicited node multicast addresses, EUI-64, stateless autoconfiguration (SLAAC), stateful DHCPv6, stateless DHCPv6, router solicitation, router advertisement, link-local address, global unicast address, SOLICIT message, ADVERTISE message, REQUEST message, REPLY message, DHCPv6 relay agent + +Command Reference to Check Your Memory + +This section includes the most important show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 10-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot the topic covered in this chapter. + +Table 10-4 show Commands + +Task Command Syntax +Displays if IPv6 is enabled on an interface, displays show ipv6 interface interface_type the multicast groups the router interface is a member interface_number +of, displays the global and link-local unicast addresses associated with an interface, indicates whether EUI-64 was used or stateless autoconfiguration was used to obtain the IPv6 address for the interface, displays whether RAs are suppressed for the interface, and displays how devices connected to the same link as the interface will obtain an IPv6 address and how they will obtain other options + +Displays the IPv6 addresses that are being used by each of the DHCPv6 clients. +Displays which DHCPv6 pool is assigned to which interface on the router +Displays the configured DHCPv6 pools on the router + +show ipv6 dhcp binding + +show ipv6 dhcp interface + +show ipv6 dhcp pool + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting IPv4 ACLs: This section examines how you can read IPv4 ACLs so that you are more efficient at troubleshooting IPv4 ACL-related issues. You will also learn the commands and processes that you can use while troubleshooting IPv4 packet fil-tering with standard, extended, and time-based IPv4 ACLs. + +■ IPv4 ACL Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. + +■ Troubleshooting IPv6 ACLs: This section examines how you can read IPv6 ACLs so that you are more efficient at troubleshooting IPv6 ACL-related issues. You will also discover the commands and processes that you can use while troubleshooting IPv6 packet filtering. + +■ IPv6 ACL Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. + +■ Troubleshooting Prefix Lists: This section reviews how to efficiently examine a prefix list for trouble-shooting purposes so that when you are dealing with an issue that has a prefix list associated with it, you can determine whether the prefix list is or is not the problem. + +■ Prefix List Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. + + + + +From the Library of Outcast Outcast +CHAPTER 11 + + + + +Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists + + +Access control lists (ACLs) and prefix lists are powerful tools that you need to be com-fortable with as a troubleshooter. They enable you to classify traffic or routes, and then depending on how you apply them, take a specific action. One slight error in an ACL or prefix list will change the meaning of it and, as a result, how the service or feature that relies on it handles the route or traffic. + +Therefore, you need to be able to read ACLs and prefix lists efficiently. You need a solid understanding of the way they are processed and how the devices using them make a decision based on the entries. Without this knowledge, you cannot successfully eliminate or prove that the ACL or prefix list is the problem. + +This chapter covers the ins and outs of ACLs and prefix lists. You will learn the way they are processed, how they are read, and how you can identify issues related to them. In addition, this chapter explains how you can use ACLs for traffic filtering and how a pre-fix list can be used for route filtering. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 11-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 11-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting IPv4 ACLs + +Troubleshooting IPv6 ACLs + +Troubleshooting Prefix Lists + +Questions +1–4 + +5–7 + +8–10 + + + + + + + + + +From the Library of Outcast Outcast +398 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. What is the correct order of operations for an IPv4 ACL? + +a. Top-down processing, execute upon the longest match, implicit deny all + +b. Execute upon the longest match, top down processing, implicit deny all + +c. Implicit deny all, immediate execution upon a match, top-down processing + +d. Top-down processing, immediate execution upon a match, implicit deny all + +2. What occurs to a packet when an ACL is applied to an interface but the packet does not match any of the entries in the ACL? + +a. It is forwarded. + +b. It is flooded. + +c. It is dropped. + +d. It is buffered. + +3. What will the following ACL entry accomplish when applied to an interface: 20 per-mit tcp 10.1.1.0 0.0.0.63 host 192.0.2.1 eq 23? + +a. Permit Telnet traffic from the device with an IP address of 192.0.2.1 going to any device with an IP address from 10.1.1.0 to 10.1.1.63 + +b. Permit Telnet traffic from any device with an IP address from 10.1.1.0 to 10.1.1.63 going to the device with an IP address of 192.0.2.1 + +c. Permit SSH traffic from any device with an IP address from 10.1.1.0 to 10.1.1.63 going to the device with an IP address of 192.0.2.1 + +d. Permit SSH traffic from the device with an IP address of 192.0.2.1 going to any device with an IP address from 10.1.1.0 to 10.1.1.63 + +4. Which command will successfully filter ingress traffic using ACL 100 on an inter-face? + +a. access-group 100 in + +b. access-class 100 in + +c. ip access-group 100 in + +d. ip traffic-filter 100 in + + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 399 + +5. What is the correct order of operations for an IPv6 ACL? + +a. Immediate execution upon a match, implicit permit icmp nd, implicit deny all, top-down processing + +b. Top-down processing, immediate execution upon a match, implicit permit icmp nd, implicit deny all + +c. Top-down processing, implicit permit icmp nd, immediate execution upon a match, implicit deny all + +d. Implicit permit icmp nd, top-down processing, immediate execution upon a match, implicit deny all + +6. What will happen if you add the following entry to the end of an IPv6 ACL: deny ipv6 any any log? (Choose two answers.) + +a. All traffic will be denied and logged. + +b. All traffic that does not match an entry in the ACL will be denied and logged. + +c. ICMP Neighbor Discovery messages will still be implicitly permitted. + +d. ICMP Neighbor Discovery messages will be denied. + +7. Which command will successfully filter egress traffic using an IPv6 ACL named TSHOOT on an interface? + +a. access-group TSHOOT out + +b. access-class TSHOOT out + +c. ipv6 access-group TSHOOT out + +d. ipv6 traffic-filter TSHOOT out + +8. Which IP prefix list will match only the default route? + +a. ip prefix-list TSHOOT permit 0.0.0.0/0 le 32 + +b. ip prefix-list TSHOOT permit 0.0.0.0/0 ge 32 + +c. ip prefix-list TSHOOT permit 0.0.0.0/0 ge 1 + +d. ip prefix-list TSHOOT permit 0.0.0.0/0 + +9. Which IP prefix list will match all routes? + +a. ip prefix-list TSHOOT permit 0.0.0.0/0 le 32 + +b. ip prefix-list TSHOOT permit 0.0.0.0/0 ge 32 + +c. ip prefix-list TSHOOT permit 0.0.0.0/0 ge 1 + +d. ip prefix-list TSHOOT permit 0.0.0.0/0 + + + + + + +From the Library of Outcast Outcast +400 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10. What routes match the following prefix list: ip prefix-list TSHOOT seq 35 deny 192.168.0.0/20 ge 24 le 28? + +a. Routes with an address from 192.168.0.0 to 192.168.15.255 with a subnet mask of 24 to 28 + +b. Routes within the 192.168.0.0/20 subnet with a subnet mask greater than 24 and less than 28 + +c. Routes with the subnet ID and mask of 192.168.0.0/20 + +d. Routes with an address from 192.168.0.0 to 192.168.15.255 with a subnet mask of 24 or 28 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 401 + +Foundation Topics + + +Troubleshooting IPv4 ACLs + +The purpose of an access control list is to identify traffic based on different criteria such as source or destination IP address, source or destination port numbers, transport layer protocols, quality of service (QoS) markings, and so on. An ACL that has been created does nothing unless it is applied to a service, feature, or interface. For example, it can be used to identify the private IP addresses that will be translated to a public address with Network Address Translation (NAT) and Port Address Translation (PAT). It can also be used to control which routes will be redistributed, which packets will be policy-based routed, and which packets will be permitted or denied through the router. Therefore, as +a troubleshooter, it is imperative that you can read an ACL to determine whether it was created correctly; otherwise, the services you are applying it to will fail to produce the results you want. + +This section explains how to troubleshoot an IPv4 ACL to make sure that it is correctly created for the purpose it is intended for. The section also provides examples related to packet filtering. Other examples related to distribute lists, route maps, and policy-based routing (PBR) are covered in later chapters relating to those features. + +Reading an IPv4 ACL + +Being able to read an ACL and understand what it was created for is important for trouble-shooting. However, understanding how an ACL functions is even more important as you troubleshoot because you need to identify why you are experiencing the issues that are occurring. Following is a list of steps that IPv4 ACLs use. You want to remember these +steps because they will help you identify why an IPv4 ACL is behaving the way it is. + + +Key Step 1. Topic +Step 2. + + + + + + +Step 3. + + +Top down processing: An ACL is made up of various entries; these entries are processed from the top of the ACL to the bottom of the ACL in order. + +Immediate execution upon a match: The very first entry that matches the values in the packet that are being compared will be the entry that is used. This may be a permit entry or a deny entry and will dictate how the packet is treated based on the ACL implementation. If there is another entry later in the ACL that matches, it does not matter. Only the first entry that matches mat-ters. + +Implicit deny any: If there is no matching entry for the packet, the packet is automatically denied based on the invisible implicit deny any entry at the end +of an ACL. + + + + +Key Topic + +Refer to Example 11-1, which displays a sample standard numbered ACL that uses only source IPv4 addresses. In this example, the ACL is numbered 1 and has four entries. The +entries are listed from most specific to least specific. In earlier versions of the IOS, if you + + + + + +From the Library of Outcast Outcast +402 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +did not create the entries from most specific to least specific, you ended up with generic entries earlier in the ACL that would cause issues by dropping or permitting traffic that should not be. In newer versions of the IOS, if you attempt to create an ACL entry that is more specific than an entry that already exists, the router will prevent the entry from being created and give an error message. + +Notice how traffic sourced from 10.1.1.5 is denied in sequence 5. Even though the very next sequence of 10 permits 10.1.1.5, 10.1.1.5 will be denied because of top-down pro-cessing and then immediate execution upon a match. Likewise, even though sequence 30 permits all addresses from 10.1.1.0 through 10.1.1.255, 10.1.1.5 is denied by sequence 5, and 10.1.1.64 through 10.1.1.127 are denied by sequence 20. What about all other source IP addresses that do not match an entry in the ACL? For example, the IP address 192.168.2.1. They are all denied because of the implicit deny entry (you cannot see it) at the end of the ACL. + +Example 11-1 Sample Standard Numbered ACL + +Router#show access-lists +Standard IP access list 1 +5 deny 10.1.1.5 +10 permit 10.1.1.0, wildcard bits 0.0.0.63 (1 match) +20 deny 10.1.1.64, wildcard bits 0.0.0.63 +30 permit 10.1.1.0, wildcard bits 0.0.0.255 + + + + + + + + + +Key Topic + +Extended ACLs are a little more complicated to read and troubleshoot because they con-tain more parameters. The previous example was a standard ACL that only allows a source address to be specified. The extended ACL can take source and destination addresses, source and destination port numbers, protocols, and other parameters that give you granular control over what you are trying to match. Also remember that standard and extended IPv4 ACLs can be named instead of numbered. + +Example 11-2 provides a sample extended numbered ACL. In this example, it is numbered 100. It has four entries, listed from most specific to least specific. Notice in sequence +10 that 10.1.1.5 is denied from accessing TCP services using port 80 on 192.0.2.1. At the same time, under sequence 20, 10.1.1.5 would be permitted to telnet to 192.0.2.1, and in sequence 40, it would be permitted to any destination on any port using any protocol. Therefore, you have much more granular control over how the traffic will be matched in +an extended ACL. + + +Example 11-2 Sample Extended Numbered ACL + +R1#show access-lists 100 +Extended IP access list 100 +10 deny tcp host 10.1.1.5 host 192.0.2.1 eq www +20 permit tcp 10.1.1.0 0.0.0.63 host 192.0.2.1 eq telnet +30 deny ip 10.1.1.64 0.0.0.63 host 192.0.2.1 +40 permit ip 10.1.1.0 0.0.0.255 any + + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 403 + +Using an IPv4 ACL for Filtering + +Using an ACL for packet filtering requires you to apply the ACL to an interface. You can accomplish this with the ip access-group {acl_number|name} { in|out} command in inter-face configuration mode, as shown in Example 11-3. The direction you apply the ACL on an interface is significant. You need to consider this while you are creating the ACL. If you apply it to the wrong interface or in the wrong direction, you will not get the desired result. You can verify the ACLs that are applied to an interface using the show ip inter-face interface_type interface_number command. Example 11-3 shows how access list 1 +is applied inbound on Gig0/0 and access list 100 is applied outbound on Gig0/0. + +Example 11-3 Verifying Access Lists Applied to Interfaces +Key +Topic R1(config)#interface gigabitEthernet 0/0 +R1(config-if)#ip access-group 100 out +R1(config-if)#ip access-group 1 in +R1(config-if)#end +R1#show ip interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet address is 10.1.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is 172.16.1.10 +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.5 224.0.0.6 +Outgoing access list is 100 +Inbound access list is 1 +Proxy ARP is enabled +Local Proxy ARP is disabled + + +Using a Time-Based IPv4 ACL + +By default, an ACL you apply is active the entire time it is applied. However, that might not be your goal. For example, perhaps you want to prevent traffic from going to the Internet after hours but allow it during hours. Or give a certain service or user the abil-ity to back up files to a server from 9 p.m. to 1 a.m. Monday to Friday and prevent them from doing it any other time. + +To accomplish these goals, you need to use time-based ACLs. Review Example 11-4, which provides a sample time-based ACL. Notice that the ACL entry with a sequence number of 10 has the time-range option added. The time range is based on values con-figured in the AFTERHOURS time range. It also states that it is active, meaning that the current entry will be denying WWW traffic from host 10.1.1.5 to 192.0.2.1. Because the ACL entry is attached to a time range, when troubleshooting time-based ACLs you will also have to review the configuration of the time range itself. Example 11-5 displays the AFTERHOURS time range with the show time-range AFTERHOURS command. It has + + + +From the Library of Outcast Outcast +404 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +two weekdays entries, one from 5 p.m. to midnight and the other from midnight to 9 a.m. It also has a weekend entry that covers all day and all night. It also states that it is active and used in an ACL. When the access control entry is outside of the time range, it will display inactive. + +Example 11-4 Sample Time-Based ACL Key +Topic R1#show access-lists 100 +Extended IP access list 100 +10 deny tcp host 10.1.1.5 host 192.0.2.1 eq www time-range AFTERHOURS (active) +20 permit tcp 10.1.1.0 0.0.0.63 host 192.0.2.1 eq telnet +30 deny ip 10.1.1.64 0.0.0.63 host 192.0.2.1 +40 permit ip 10.1.1.0 0.0.0.255 any + + +Example 11-5 Sample Time Range Configured on R1 + +R1#show time-range AFTERHOURS +time-range entry: AFTERHOURS (active) +periodic weekdays 17:00 to 23:59 +periodic weekdays 0:00 to 8:59 +periodic weekend 0:00 to 23:59 +used in: IP ACL entry + +So far, you have seen that you have to troubleshoot the ACL, and the time range when dealing with issues related to time-based ACLs. However, there is one more item of trou-bleshooting: time! + +Time-based ACLs are based on the router clock. If the router clock is not correct, the time-based ACL may be active or inactive at the wrong time. Example 11-6 shows how you can verify the current time on a router with the show clock command. Notice how it is Sunday May 25, 2014, at 10:53 a.m. Therefore, the time-based ACL entry should be active because it is AFTERHOURS. We only want to permit WWW traffic Monday to Friday 9 a.m. to 5 p.m. All other times, it is denied. + +Example 11-6 Viewing the Time on a Cisco Router + +R1#show clock +*10:53:50.067 UTC Sun May 25 2014 + +But wait, are we sure it is the right time? Are we using manually set clocks, have they changed? Or are we using a Network Time Protocol (NTP) server? You will want to verify with another time source that this is in fact the right time. In addition, if you are using NTP (which you should be), you need to check your NTP settings to make sure that the clocks are synchronized and that the time is right, and do not forget to consider daylight savings time. + + + + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 405 + +IPv4 ACL Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 11-1. + + + + +10.1.1.10 255.255.255.192 DG:10.1.1.1 + + +10.1.1.0/26 + +PC1 + +DHCP Server +172.16.1.10 + + +Gig2/0 + +Gig0/0 Gig1/0 .1 +R1 + + +192.0.2.1 + +10.1.1.20 NAT Enabled Router 255.255.255.192 PC2 +DG:10.1.1.1 + +Figure 11-1 IPv4 ACL Trouble Ticket Topology + + +Trouble Ticket 11-1 + +Problem: A user at PC1 has indicated that he cannot telnet to 192.0.2.1 and he needs to. However, he can ping 192.0.2.1 and access web-enabled resources. + +You start by verifying the problem. On PC1, you attempt to telnet to 192.0.2.1, but it fails, as shown in Example 11-7. You then ping 192.0.2.1, and it is successful, as also shown in Example 11-7. + +Example 11-7 Failed Telnet and Successful Ping from PC1 to 192.0.2.1 + +C:\PC1>telnet 192.0.2.1 +Connecting To 192.0.2.1...Could not open connection to the host, on port 23: Connect failed + +C:\PC1>ping 192.0.2.1 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 +Reply from 192.0.2.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.0.2.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + + +From the Library of Outcast Outcast +406 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +At this point, you should be thinking that the issue is related to either the Telnet service being disabled on 192.0.2.1 or an ACL. Why an ACL? This is because certain types of traffic are allowed through but others are not, which is accomplished with filtering. + +First, let’s verify whether there are any ACLs configured on R1 that may filter Telnet-related traffic. In Example 11-8, the show ip access-lists command is used to verify whether any ACLs are configured on R1. In this example, there is one extended IPv4 ACL identified as number 100. You can see that there are two entries related to Telnet. One is a permit entry with a sequence number of 10, and the other is a deny entry with a sequence number of 20. Notice how the deny entry has 9 matches and the permit entry has no matches. Read sequence 10 out loud: +Sequence 10 will permit tcp traffic related to telnet from 192.0.2.1 to 10.1.1.10. + +Read it again and think about how the traffic is flowing based on this entry: + +FROM 192.0.2.1 TO 10.1.1.10 + +PC1 is trying to establish a Telnet session to 192.02.1 (not the other way around). Therefore, sequence 10 does not match the Telnet traffic from PC1 to 192.0.2.1. It match-es Telnet traffic from 192.0.2.1 to PC1. + +Sequence 20 states that TCP traffic related to Telnet from the 10.1.1.0/26 network to any destination will be denied. Therefore, using the top-down processing and immediate exe-cution upon a match flow, sequence 20 matches the Telnet traffic from PC1 to 192.0.2.1, and as a result, the traffic is denied. + +Example 11-8 Verifying ACLs Configured on R1 + +R1#show ip access-lists +Extended IP access list 100 +10 permit tcp host 192.0.2.1 host 10.1.1.10 eq telnet +20 deny tcp 10.1.1.0 0.0.0.63 any eq telnet (9 matches) +30 deny tcp 10.1.1.0 0.0.0.63 any eq ftp +40 permit tcp 10.1.1.0 0.0.0.63 any eq 22 +50 deny tcp 10.1.1.0 0.0.0.63 any eq smtp +60 permit ip any any (2 matches) + +The best way to fix this is to remove sequence 10 and replace it with the correct entry. We can use named ACL configuration mode to accomplish this. Example 11-9 displays how you can use named ACL configuration mode to edit a numbered ACL and the out-put of show ip access-lists, which verifies that the changes were made. + +Example 11-9 Using Named ACL Configuration Mode to Modify Numbered ACL + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ip access-list extended 100 +R1(config-ext-nacl)#no 10 +R1(config-ext-nacl)#10 permit tcp host 10.1.1.10 host 192.0.2.1 eq 23 + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 407 + +R1(config-ext-nacl)#end +R1# +R1#show access-lists +Extended IP access list 100 +10 permit tcp host 10.1.1.10 host 192.0.2.1 eq telnet +20 deny tcp 10.1.1.0 0.0.0.63 any eq telnet (9 matches) +30 deny tcp 10.1.1.0 0.0.0.63 any eq ftp +40 permit tcp 10.1.1.0 0.0.0.63 any eq 22 +50 deny tcp 10.1.1.0 0.0.0.63 any eq smtp +60 permit ip any any (4 matches) + +As shown in Example 11-10, you issue the telnet 192.0.2.1 command from PC1, and the connection is successful. + +Example 11-10 Successful Telnet Connection from PC1 to 192.0.2.1 + +C:\PC1>telnet 192.0.2.1 +User Access Verification +Password: + +Reviewing the output of show ip access-lists on R1, as shown in Example 11-11, reveals the matches associated with sequence 10 now. + +Example 11-11 Verifying Packet Matches For an ACL Entry + +R1#show ip access-lists +Extended IP access list 100 +10 permit tcp host 10.1.1.10 host 192.0.2.1 eq telnet (25 matches) +20 deny tcp 10.1.1.0 0.0.0.63 any eq telnet (9 matches) +30 deny tcp 10.1.1.0 0.0.0.63 any eq ftp +40 permit tcp 10.1.1.0 0.0.0.63 any eq 22 +50 deny tcp 10.1.1.0 0.0.0.63 any eq smtp +60 permit ip any any (5 matches) + + +Troubleshooting IPv6 ACLs + +IPv6 ACLs play an important role in our IPv6 networks. They allow us to classify traf-fic for many different reasons. For example, we might need to classify traffic that will be policy-based routed, or we may need to classify the traffic that will be filtered as it passes through the router. + +IPv6 traffic filtering can be done on an interface-by-interface basis with IPv6 access lists. This section explains how to read an IPv6 access list so that you can troubleshoot them efficiently and identify whether they have been applied correctly to an interface for filter-ing purposes. + + + + + + +From the Library of Outcast Outcast +408 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Reading an IPv6 ACL + +Being able to read an IPv6 ACL and understand what it was created for is important for troubleshooting. However, understanding how an IPv6 ACL functions is even more important as you troubleshoot because you need to identify why you are experiencing +the issues that are occurring. Following is a list of steps that IPv6 ACLs use; these are the same as IPv4 ACLs. You want to remember these steps because they will help you iden- +tify why an IPv6 ACL is behaving the way it is: + + +Step 1. +Key Topic +Step 2. + + + + + + +Step 3. + +Step 4. + + +Top-down processing: An ACL is made up of various entries; these entries are processed from the top of the ACL to the bottom of the ACL in order. + +Immediate execution upon a match: The very first entry that matches the values in the packet that are being compared will be the entry that is used. This may be a permit entry or a deny entry and will dictate how the packet is treated based on the ACL implementation. If there is another entry later in the ACL that matches, it does not matter. Only the first entry that matches mat-ters. + +Implicit permit icmp nd: If the packet is an NA or NS message, permit it. + +Implicit deny any: If there is no matching entry for the packet, the packet is automatically denied based on the invisible implicit deny any entry at the end +of an ACL. + + +Pause here for a moment. Did you notice the steps differ a little from IPv4? There is an added step before the implicit deny any. Recall that IPv6 relies on the Neighbor +Discovery Protocol (NDP) NA and NS messages to determine the MAC address associ-ated with an IPv6 address. Therefore, the implicit permit icmp nd entries for NA and NS messages as follows have been added before the implicit deny any, so they are not denied: +permit icmp any any nd-na +permit icmp any any nd-ns +However, because these are implicit permit statements, all statically entered commands come before them. Therefore, if you issue the deny ipv6 any any log command at the end of your IPv6 ACL like you might be accustomed to doing in IPv4, you will break the NDP process because NA and NS messages will be denied now. Therefore, when trouble-shooting NDP, an ACL might be the reason why it is not working. + +With IPv4 ACLs, a clear separation existed between standard and extended IPv4 ACLs. However, with IPv6, you have just one type, which would be similar to an IPv4 extended ACL. Therefore, within an IPv6 ACL entry, you provide as little or as much information as you need to accomplish your goal. + +Refer to Example 11-12, which provides a sample IPv6 ACL that was created on R1. The IPv6 access list is named TSHOOT, and you read it exactly like you read an IPv4 ACL. For example, sequence 20 states that TCP traffic related to Telnet will be denied from any device going to 2001:DB8:A:B::7/128. Sequence 30 states that TCP traffic related to WWW from 2001:DB8:A:A::20/128 to 2001:DB8:D::1/128 will be permitted. + + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 409 + +Example 11-12 Sample IPv6 ACL +Key +Topic R1#show ipv6 access-list +IPv6 access list TSHOOT +permit tcp host 2001:DB8:A:A::20 host 2001:DB8:A:B::7 eq telnet sequence 10 +deny tcp any host 2001:DB8:A:B::7 eq telnet sequence 20 +permit tcp host 2001:DB8:A:A::20 host 2001:DB8:D::1 eq www sequence 30 +deny ipv6 2001:DB8:A:A::/80 any sequence 40 +permit ipv6 2001:DB8:A:A::/64 any sequence 50 + +Notice how there are no wildcard masks with IPv6. Instead, you specify a prefix, as shown in sequence 40 and 50 of Example 11-12, which accomplishes the same goal as the wildcard mask (defining a range of addresses). For example, a prefix of /128 is like having the all 0s wildcard mask, which would mean this exact address or host (match all bits in the address). A /0 prefix is like having the all 255s wildcard mask (do not match any bits in the address). A /64 prefix would indicate that the first 64 bits must match and that the last 64 bits do not have to match. As a result, this would include all interface IDs within +a /64 network. What if the prefix is /80? This means the first 80 bits must match and the last 48 bits do not have to match. As a result, the prefix is defining which bits of the IPv6 address must match. + +Using an IPv6 ACL for Filtering + +Using an IPv6 ACL for packet filtering requires you to apply the IPv6 ACL to an inter-face. You can accomplish this with the ipv6 traffic-filter acl_name {in|out} command in interface configuration mode, as shown in Example 11-13. The direction you apply the IPv6 ACL on an interface is significant. It needs to be considered while you are creating the ACL. If you apply it to the wrong interface or in the wrong direction, you will not get the desired result. You can verify the IPv6 ACLs that are applied to an interface using the show ipv6 interface interface_type interface_number command. Example 11-13 shows +how the IPv6 access-list TSHOOT is applied inbound on interface Gig0/0. + +Example 11-13 Verifying IPv6 Access Lists Applied to Interfaces +Key +Topic R1(config)#interface gigabitEthernet 0/0 +R1(config-if)#ipv6 traffic-filter TSHOOT in +R1(config-if)#end +R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C808:3FF:FE78:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A:A::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:2 + + + + +From the Library of Outcast Outcast +410 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +FF02::1:FF00:1 +FF02::1:FF78:8 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +Input features: Access List +Inbound access list TSHOOT +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND advertised reachable time is 0 (unspecified) +ND advertised retransmit interval is 0 (unspecified) +ND router advertisements are sent every 200 seconds +ND router advertisements live for 1800 seconds +ND advertised default router preference is Medium +Hosts use stateless autoconfig for addresses. +Hosts use DHCP to obtain other configuration. + + +IPv6 ACL Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 11-2. + +2001:db8:a:b::7 DHCP Server + + +::10 + +PC1 + +Default Gateway 2001:db8:a:a::1 + + + + +::1 2001:db8:a:a::/64 Gi0/0 + + + +Gi2/0 +Gi1/0 2001:db8:d::1 +R1 + + + +PC2 + +::20 + +Figure 11-2 IPv6 ACL Trouble Ticket Topology + + +Trouble Ticket 11-2 + +Problem: A user at PC2 has indicated that she is not able to telnet to 2001:db8:a:b::7 and she needs to. However, she can ping 2001:db8:a:b::7 and receive DHCP-related informa-tion from the DHCP server. + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 411 + +You start by verifying the problem. On PC2, you attempt to telnet to 2001:db8:a:b::7, but it fails, as shown in Example 11-14. You then ping 2001:db8:a:b::7, and it is successful, as also show in Example 11-14. + +Example 11-14 Failed Telnet and Successful Ping from PC2 to 2001:db8:a:b::7 + +C:\PC2>telnet 2001:db8:a:b::7 +Connecting To 2001:db8:a:B::7...Could not open connection to the host, on port 23: Connect failed + +C:\PC2>ping 2001:db8:a:b::7 + +Pinging 2001:db8:a:b::7 with 32 bytes of data: +Reply from 2001:db8:a:b::7: time=46ms +Reply from 2001:db8:a:b::7: time=40ms +Reply from 2001:db8:a:b::7: time=40ms +Reply from 2001:db8:a:b::7: time=40ms + +Ping statistics for 2001:db8:a:b::7: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 40ms, Maximum = 46ms, Average = 41ms + +What could allow pings yet deny Telnet? At this point in time, you should be thinking the issue is related to either the Telnet service being disabled on 2001:db8:a:b::7 or an IPv6 ACL filtering traffic in or out of an interface. This is because certain traffic is allowed while others are denied. Most times, this is because of traffic filtering. + +First, you verify whether the Telnet service is running by using Telnet from R1 to 2001:db8:a:b::7. As shown in Example 11-15, it is successful. If it was not successful, you could then access the server or contact the users responsible for the server to see whether Telnet is enabled. + +Example 11-15 Successful Telnet from R1 to 2001:db8:a:b::7 + +R1#telnet 2001:db8:a:b::7 +Trying 2001:DB8:A:B::7 ... Open + +User Access Verification + +Password: + +Next you check whether there are any ACLs associated with interface Gi2/0 on R1 using the command show ipv6 interface gigabitethernet2/0. As shown in Example 11-16, there are no IPv6 ACLs. + + + + + + + +From the Library of Outcast Outcast +412 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 11-16 Verifying ACLs on Gig2/0 of R1 + +R1#show ipv6 interface gigabitEthernet 2/0 +GigabitEthernet2/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C808:3FF:FE78:38 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:B::1, subnet is 2001:DB8:A:B::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:FF00:1 +FF02::1:FF78:38 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND advertised reachable time is 0 (unspecified) +ND advertised retransmit interval is 0 (unspecified) +ND router advertisements are sent every 200 seconds +ND router advertisements live for 1800 seconds +ND advertised default router preference is Medium +Hosts use stateless autoconfig for addresses. + +Next you check whether there are any ACLs associated with interface Gi0/0 on R1 by using the command show ipv6 interface gigabitethernet0/0. As shown in Example 11-17, there is an inbound IPv6 ACL named TSHOOT attached to the interface. + +Example 11-17 Verifying ACLs on Gig0/0 of R1 + +R1#show ipv6 interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C808:3FF:FE78:8 +No Virtual link-local address(es): +Global unicast address(es): +2001:DB8:A:A::1, subnet is 2001:DB8:A:A::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::1:2 +FF02::1:FF00:1 +FF02::1:FF78:8 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 413 + +ICMP unreachables are sent +Input features: Access List +Inbound access list TSHOOT +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds (using 30000) +ND RAs are suppressed (all) +Hosts use stateless autoconfig for addresses. +Hosts use DHCP to obtain other configuration. + +Now you need to verify the IPv6 ACL named TSHOOT using the show ipv6 access-list TSHOOT command. Example 11-18 displays this output. Notice sequence 20. It is a per-mit statement allowing PC2 to telnet to 2001:db8:a:b::7. However, notice sequence 10. It is a deny statement preventing all devices from using Telnet to 2001:db8:a:b::7. Remember that IPv6 ACLs are processed from top down, and then once a match is found, it is imme-diately executed on. That is what is happening here. Sequence 10 matches PC2’s Telnet and denies it. + +(Notice for IPv6 that the router allowed a more specific entry to be placed after a more general entry, this differs from the behavior witnessed with IPv4 ACLs earlier.) + +Example 11-18 TSHOOT IPv6 ACL on R1 + +R1#show ipv6 access-list TSHOOT +IPv6 access list TSHOOT +deny tcp any host 2001:DB8:A:B::7 eq telnet (6 matches) sequence 10 +permit tcp host 2001:DB8:A:A::20 host 2001:DB8:A:B::7 eq telnet sequence 20 +permit tcp host 2001:DB8:A:A::20 host 2001:DB8:D::1 eq www sequence 30 +permit ipv6 2001:DB8:A:A::/64 any (67 matches) sequence 40 + +To solve this issue, you connect to R1, enter IPv6 ACL configuration mode for the ACL named TSHOOT, and then you remove sequence 20 and add the same entry with a sequence number of 5 so that it is before sequence 10, as shown in Example 11-19. In addition, you verify the changes with the show ipv6 access-list TSHOOT command. + +Example 11-19 Modifying TSHOOT IPv6 ACL on R1 + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ipv6 access-list TSHOOT +R1(config-ipv6-acl)#no sequence 20 +R1(config-ipv6-acl)#seq 5 permit tcp host 2001:DB8:A:A::20 host 2001:DB8:A:B::7 eq telnet + +R1#show ipv6 access-list TSHOOT +IPv6 access list TSHOOT +permit tcp host 2001:DB8:A:A::20 host 2001:DB8:A:B::7 eq telnet sequence 5 +deny tcp any host 2001:DB8:A:B::7 eq telnet (6 matches) sequence 10 +permit tcp host 2001:DB8:A:A::20 host 2001:DB8:D::1 eq www sequence 30 +permit ipv6 2001:DB8:A:A::/64 any (67 matches) sequence 40 + + + +From the Library of Outcast Outcast +414 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Now you go back to PC2 and attempt to telnet to 2001:db8:a:b::7. In Example 11-20, it is successful. + +Example 11-20 Successful Telnet from PC2 to 2001:db8:a:b::7 + +C:\PC2>telnet 2001:db8:a:b::7 + +User Access Verification + +Password: + + +Troubleshooting Prefix Lists + +Although an ACL can give you extreme granular control of the traffic you want to match, it lacks the ability to identify routes based on a subnet mask. Therefore, ACLs do not +give you granular control when matching routes for route filtering. This is why prefix lists exist. They allow you to define the route and prefix that you want to match. This section explains how to read a prefix list so that when you are troubleshooting features that call upon a prefix list you will have the ability to eliminate the prefix list as the cause of the issue or prove that the prefix list is the cause of the issue. + +Note that this discussion applies to both IPv4 prefix lists and IPv6 prefix lists. The only difference is that in an IPv4 prefix list you will have IPv4 addresses and masks and in an IPv6 prefix list you will have IPv6 addresses and masks. However, the same principles and concepts apply. As a result, all the examples in this section are based on IPv4. + +Reading a Prefix List + +Let’s begin with an example. Example 11-21 displays the commands used to create a sample prefix list called TSHOOT and the output of show ip prefix-list, which you can use to verify the IPv4 prefix lists configured on a router. To verify IPv6 prefix lists you use the command show ipv6 prefix-list. + +Example 11-21 Sample IPv4 Prefix List + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ip prefix-list TSHOOT seq 10 deny 10.1.1.0/26 +R1(config)#ip prefix-list TSHOOT seq 20 permit 10.1.1.0/24 le 32 +R1(config)#ip prefix-list TSHOOT seq 30 permit 0.0.0.0/0 +R1(config)#ip prefix-list TSHOOT seq 35 deny 192.168.0.0/20 ge 24 le 28 +R1(config)#end +R1#show ip prefix-list +ip prefix-list TSHOOT: 3 entries +seq 10 deny 10.1.1.0/26 +seq 20 permit 10.1.1.0/24 le 32 +seq 30 permit 0.0.0.0/0 +seq 35 deny 192.168.0.0/20 ge 24 le 28 + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 415 + + + + + + +Key Topic + +There are two different ways to read a prefix list entry. The way you read a prefix list entry is based on whether there is a le (less than or equal to) or ge (greater than or equal to) at the end of the prefix list entry or not. + +No ge or le: If the entry does not contain a ge or le, the prefix is treated as an address and a subnet mask. Refer to the entry with a sequence number of 10 in Example 11-21. There is no ge or le; therefore, the network 10.1.1.0/26 is matched exactly. For example, if you are using the prefix list to filter routing updates, the 10.1.1.0/26 network will be denied (meaning that it will be filtered and not used). +There is a ge or le: If the entry does contain a ge or le, the prefix is treated as an address and a wildcard mask. Refer to the entry with a sequence number of 20 in Example 11-21. Because there is a ge or le, the entry is defining a range of values. 10.1.1.0/24 really means 10.1.1.0 0.0.0.255 (where 0.0.0.255 is the inverse of the subnet mask), which indicates a range of addresses from 10.1.1.0 through 10.1.1.255 (just like an ACL). The le at the end means less than or equal to, and the 32 is referring to a subnet mask. Therefore, this entry is permitting any address from 10.1.1.0 through 10.1.1.255 with a subnet mask less than or equal to 32 (0 to 32). For example, if you are using the prefix list to filter routing updates, the 10.1.1.0/24, 10.1.1.64/26, and 10.1.1.128/30 networks would all be permitted because they fall within the prefix range and subnet mask range. +Refer to sequence 30 in Example 11-21. Because there is no ge or le, it will be an exact match to the address and mask listed. In this case, the address and mask are 0.0.0.0/0, which is the default route. Therefore, if this prefix list is being used to filter routing updates, the filter would permit the default route. + +Refer to sequence 35 in Example 11-21. Because there is a ge or le, the address and mask are treated as an address and wildcard mask to define a range. Therefore, 192.168.0.0/20 is 192.168.0.0 0.0.15.255, which defines a range of 192.168.0.0 through 192.168.15.255. The ge 24 le 28 values specify a subnet mask range from 24 to 28. Therefore, if this prefix entry was used to filter routes, all routes with an address from 192.168.0.0 to 192.168.15.255 with a subnet mask of 24 to 28 will be denied. + +Now it is your turn. Which routes will match the following prefix list: + + +ip prefix-list EXAMPLE permit 10.1.1.0/24 ge 26 +Before you read any further, try to determine it on your own. + +Because there is a ge, the /24 is treated as a wildcard mask of 0.0.0.255. Therefore, the range of routes are from 10.1.1.0 to 10.1.1.255. (The first 24 bits must match.) However, the ge 26 indicates that the routes also must have a subnet mask from 26 to 32. So, to sum up the prefix list, any route from 10.1.1.0 to 10.1.1.255 with a subnet mask from 26 to 32 will match this prefix list. + +Prefix List Processing + +Following is a list of steps that prefix lists use. You want to remember these steps as they will help you identify why a prefix list is behaving the way it is. + + + + +From the Library of Outcast Outcast +416 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Step 1. Key +Topic + + +Step 2. + + + + + + + + +Step 3. + + +Top -down processing: A prefix list is made up of various entries; these entries are processed from the top of the prefix list to the bottom of the prefix list in order of sequence number. In Example 11-21, sequence 10 is pro-cessed first, then 20, 30, 40. + +Immediate execution upon a match: The very first entry that matches will be the entry that is used. This may be a permit entry or a deny entry and will dictate how the information is treated. If there is another entry later +in the prefix list that matches, it does not matter. Only the first entry that matches matters. For example, even though in Example 11-21 the 10.1.1.0/26 network falls within the range defined in sequence 20, which would permit it, it is denied in sequence 10, which is processed first. Therefore, 10.1.1.0/26 is denied. + +Implicit deny any: If there is no matching entry, the information is automati-cally denied based on the invisible implicit deny any entry at the end of a pre-fix list. For example, if the prefix list in Example 11-21 is used to filter routing updates, and an update is received for 172.16.32.0/29, it is denied because it +does not match sequence 10, 20, 30, or 40. + + +Because there is an implicit deny any at the end of a prefix list, you need at least one per-mit statement in a prefix list or everything will be denied. For example, if you are creating a prefix list to deny a specific route or two (for example, 10.1.1.0/24 and 10.1.2.0/24) you would create the following entries: +ip prefix-list NAME seq 10 deny 10.1.1.0/24 +ip prefix-list NAME seq 20 deny 10.1.2.0/24 +Although this denies both prefixes, it also denies every other prefix because of the implicit deny any at the end. Therefore, to permit everything else, you need to include an entry that does so. The following entry would do just that: + + + + +Key Topic + +ip prefix-list NAME seq 30 permit 0.0.0.0/0 le 32 +Do not confuse this with the default route entry (seq 30) from Example 11-21. That did not have an le or ge. This example does. Let’s review it. Because there is an le, it means address and wildcard mask. So, 0.0.0.0/0 is really 0.0.0.0 255.255.255.255. Therefore, the range is all/any addresses. The subnet mask will be le 32, which is 0 to 32. Therefore, we +are permitting all routes in this entry. For IPv6, the equivalent permit all is as follows: + + +ipv6 prefix-list NAME seq 30 permit ::/0 le 128 + +Prefix List Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 11-3. + + + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 417 + +EIGRP AS 100 +10.1.2.0/24 + + +10.1.1.0/24 10.1.3.0/24 + +R1 10.1.12.0/24 R2 10.1.23.0/24 R3 + + +10.1.22.0/24 10.1.33.0/24 + +Figure 11-3 IPv4 Prefix List Trouble Ticket Topology + + +Trouble Ticket 11-3 + +Problem: Your junior admin has contacted you indicating that R1 is not learning any routes via Enhanced Interior Gateway Routing Protocol (EIGRP), as shown in Example 11-22. They have confirmed that neighbor relationships are being formed, interfaces are participating in the routing process, and that other routers are learning about the routes. They have come to you for help. With your extensive knowledge, you ask your junior admin if he checked for any route filters. He says no. + +Example 11-22 Verifying Routes in R1’s Routing Table + +R1#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 + +You execute the show ip protocols command on R1, as shown in Example 11-23. The output indicates that there is an inbound route filter using a prefix list called FILTER_10.1.3.0. + +Example 11-23 Verifying Whether There Are Any Route Filters on R1 + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is (prefix-list) FILTER_10.1.3.0 +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +...output omitted... + + + +From the Library of Outcast Outcast +418 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Next you issue the show ip prefix-list command on R1 to review the prefix list called FILTER_10.1.3.0, as shown in Example 11-24. In this output, you can see that the 10.1.3.0/24 prefix is being denied. Your junior admin states that this is not the problem, because 10.1.3.0/24 is supposed to be denied based on the documentation while all oth-ers are permitted. You respond by saying that you are very sure that it is the problem. You remind your junior admin about how prefix lists are processed: 1) top down, 2) immediate execution upon a match, 3) implicit deny any at the end. Therefore, this prefix list denies all prefixes not just 10.1.3.0/24. + +Example 11-24 Reviewing the Prefix List on R1 + +R1#show ip prefix-list +ip prefix-list FILTER_10.1.3.0: 1 entries +seq 5 deny 10.1.3.0/24 + +To fix this problem you create another entry for the FILTER_10.1.3.0 prefix list that per-mits all other routes as follows: + +ip prefix-list FILTER_10.1.3.0 seq 10 permit 0.0.0.0/0 le 32 +Example 11-25 displays the updated prefix list on R1, and Example 11-26 shows the updated routing table, which has all the routes except for 10.1.3.0/24, which is denied. + +Example 11-25 Reviewing the Updated Prefix List on R1 + +R1#show ip prefix-list +ip prefix-list FILTER_10.1.3.0: 2 entries +seq 5 deny 10.1.3.0/24 +seq 10 permit 0.0.0.0/0 le 32 + + +Example 11-26 Verifying Updated Routes in R1’s Routing Table + +R1#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +D 10.1.2.0/24 [90/130816] via 10.1.12.2, 00:01:32, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +D 10.1.22.0/24 [90/130816] via 10.1.12.2, 00:01:32, GigabitEthernet1/0 +D 10.1.23.0/24 [90/3072] via 10.1.12.2, 00:01:32, GigabitEthernet1/0 +D 10.1.33.0/24 [90/131072] via 10.1.12.2, 00:01:32, GigabitEthernet1/0 + + + + + + + + +From the Library of Outcast Outcast +Chapter 11: Troubleshooting IPv4 and IPv6 ACLs and Prefix Lists 419 + + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 11-2 lists a reference of these key topics and the page +numbers on which each is found. + + +Table 11-2 Key Topics for Chapter 11 +Key +Topic Key Topic Element Description Page Number + + +Step list + +Paragraph + +Paragraph + +Example 11-3 + +Example 11-4 + +Step list + +Example 11-12 + +Example 11-13 + +Paragraphs + +Step list + +Paragraphs + +Outlines the IPv4 ACL order of operations 401 + +Identifies how to read an IPv4 standard ACL 401 + +Identifies how to read an IPv4 extended ACL 402 + +Verifying access lists applied to interfaces 403 + +Sample time-based ACL 404 + +Outlines the IPv6 ACL order of operations 408 + +Sample IPv6 ACL 409 + +Verifying IPv6 access lists applied to interfaces 409 + +Reviews how to read a prefix list 415 + +Outlines the prefix list order of operations 416 + +Displays how to create an explicit permit all prefix 416 list entry + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +standard ACL, extended ACL, named ACL, time-based ACL, IPv6 ACL, implicit deny, implicit permit, prefix list, ge, le + +Command Reference to Check Your Memory + +This section includes the most important show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + + + +From the Library of Outcast Outcast +420 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +To test your memory of the commands, cover the right side of Table 11-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a networking professional. Therefore, you should be able to identify the show commands needed to verify and troubleshoot topics presented in this chapter. + +Table 11-3 show Commands + +Task Command Syntax + +Displays all the access lists configured on the device +Displays all the IPv4 access lists configured on the device +Displays all the IPv6 access lists configured on the device +Displays the inbound and outbound IPv4 access lists applied to an interface + +Displays the inbound and outbound IPv6 access lists applied to an interface + +Displays any time ranges that have been configured on the device +Displays the date and time on the device + +Displays the IPv4 prefix lists configured on the device +Displays the IPv6 prefix lists configured on the device +Displays the IPv4 routing protocols running on the router/multilayer switch and can identify whether there are any filters (such as prefix lists) applied inbound or outbound + +show access-lists + +show ip access-lists + +show ipv6 access-list + +show ip interface interface_type interface_ number + +show ipv6 interface interface_type interface_number +show time-range + +show clock + +show ip prefix-list + +show ipv6 prefix-list + +show ip protocols + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Packet-Forwarding Process: This section covers the processes that are involved during the packet-for-warding process and the commands that you can use while troubleshooting issues related to the packet-forwarding process. + +■ Troubleshooting Routing Information Sources: This section covers how a router can learn from multiple sources and how it chooses which source is the most reliable. You will also learn how you can identify the administrative distance associated with a route. + +■ Troubleshooting Static Routes: This section explains how IPv4 and IPv6 static routes are created. You will also learn the key characteristics of each and how a misconfiguration can cause suboptimal routing or routing loops. + +■ Static Routing Trouble Tickets: This section pro-vides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + +■ Troubleshooting GRE Tunnels: This section explains how to configure a GRE tunnel over an IPv4 net-work to transport IPv4 and IPv6 traffic so that you are able to troubleshoot misconfiguration issues with GRE tunnels. You will also discover the ben-efits of using IPsec with GRE tunnels for security. + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 12 + + + + +Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels + + +Before you can explore how to troubleshoot static routing or dynamic routing, you need a solid understanding of the packet-delivery process (also known as the routing process). This is the process that a router goes through when a packet arrives at an ingress interface and needs to be packet switched to an egress interface. It does not matter whether the packet is an IPv4 or IPv6 packet. The router will go through the same steps to success-fully take a packet from in ingress interface and packet switch it to the egress interface. + +As a troubleshooter, you also need to be familiar with how a router populates the rout-ing table with “the best” routes. What classifies those routes as the best? Is an Enhanced +Interior Gateway Routing Protocol (EIGRP)-learned route better than a static route? What about an Open Shortest Path First (OSPF)-learned route or a Border Gateway Protocol (BGP)-learned route? How do they compare to the other sources of routing information. When multiple sources provide the same routing information, as a troubleshooter you need to be able to identify why the router made the decision it made. + +Static routes are part of every network. However, because they are manually configured, they are prone to human error, which can produce suboptimal routing or routing loops. As a troubleshooter, you need to be able to identify issues related to static routes. + +Also, it is common to take one protocol like IPv6 and transport it over another protocol like IPv4. This is accomplished by using a tunneling protocol such as generic routing encapsulation (GRE). GRE is used to encapsulate various types of network layer packets inside a transport protocol (GRE) so that they can be transported over an IP network. Therefore, you need to be able to troubleshoot issues related to GRE tunnels. + +This chapter covers the packet-delivery process and the various commands that you can use to troubleshoot issues related to the process. You will learn how a router chooses which sources of routing information are more believable so that only the best routes are in the routing table. You will also learn how to recognize and troubleshoot issues related to static routing and GRE tunnels. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 12-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + + +From the Library of Outcast Outcast +424 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 12-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Packet-Forwarding Process + +Troubleshooting Routing Information Sources + +Troubleshooting Static Routes + +Troubleshooting GRE Tunnels + +Questions +1–3 + +4–8 + +9–10 + +11–13 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which two data structures does a router use during the packet-forwarding process? + +a. Routing table + +b. Layer 3 to Layer 2 mapping table + +c. Topology table + +d. Link-state database + +2. Which two data structures reside at the routers data plane? + +a. IP routing table + +b. ARP cache + +c. Forwarding Information Base + +d. Adjacency table + +3. Which command enables you to verify routes in the FIB? + +a. show ip route + +b. show ip arp + +c. show ip cef + +d. show adjacency detail + +4. Which are capable of populating a routing protocols data structure, such as the EIGRP topology table? (Choose three answers.) + +a. Updates from a neighbor + +b. Redistributed routes + +c. Interfaces enabled for the routing process + +d. Static routes + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 425 + +5. Which of the following has the lowest default administrative distance? + +a. OSPF + +b. EIGRP (internal) + +c. RIP + +d. eBGP + +6. What is the default administrative distance of an OSPF intra-area route? + +a. 90 + +b. 110 + +c. 115 + +d. 120 + +7. What is the default administrative distance of a static route? + +a. 0 + +b. 1 + +c. 5 + +d. 20 + +8. How can you create a floating static route? + +a. Provide the static route with a metric higher than the preferred source of the route + +b. Provide the static route with a metric lower than the preferred source of the route + +c. Provide the static route with an AD higher than the preferred source of the route + +d. Provide the static route with an AD lower than the preferred source of the route + +9. What occurs when you create an IPv4 static route with an Ethernet interface desig-nated instead of a next hop IP address? + +a. The router ARPs for the MAC address of the directly connected routers IP address. + +b. The router forwards the packet with a destination MAC address of FFFF:FFFF:FFFF. + +c. The router ARPs for the MAC address of the IP address in the source of the packet. + +d. The router ARPs for the MAC address of the IP address in the destination of the packet. + + + + + +From the Library of Outcast Outcast +426 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10. What occurs when you create an IPv6 static route with a global unicast address as the next hop? + +a. The router ARPs for the MAC address of the directly connected routers IP address. + +b. The router forwards the packet with a destination MAC address of FFFF:FFFF:FFFF. + +c. The router uses NDP to determine the MAC address associated with the global unicast address. + +d. The router uses NDP to determine the MAC address associated with the desti-nation IPv6 address in the packet. + +11. Which statements are true about GRE tunnels? + +a. The original packet is encapsulated in a GRE header only. + +b. The original packet is encapsulated in a GRE header, and then a new IP header is added. + +c. The original packet is encapsulated in an IP header, and then a GRE header is added. + +d. The original packet header is rewritten by the GRE header. + +12. When creating a virtual tunnel interface, what is the default tunnel mode? + +a. GRE/IP + +b. GRE/IPv6 + +c. IPv6/IP + +d. GRE/Multipoint + +13. Which of the following are true about IPsec transport mode? (Choose two answers.) + +a. It creates a new tunnel IP packet. + +b. It reuses the GRE IP header, which reduces overhead. + +c. It encrypts the original IP packet, the GRE header, and the GRE IP header. + +d. It encrypts the original IP packet and the GRE header only. + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 427 + +Foundation Topics + + +Packet-Forwarding Process + +When troubleshooting connectivity issues for an IP-based network, the network layer (Layer 3) of the OSI reference model is often an appropriate place to begin your trouble-shooting efforts (divide-and-conquer method). For example, if you are experiencing connectivity issues between two hosts on a network, you could check Layer 3 by pinging between the hosts. If the pings are successful, you can conclude that the issue resides at upper layers of the OSI reference model (Layers 4–7). However, if the pings fail, you can focus your troubleshooting efforts on Layers 1–3. If you ultimately determine that there is a problem at Layer 3, your efforts may be centered on the packet-forwarding process of a router. + +This section discusses the packet-forwarding process and the commands that you can use to verify the entries in the data structures that are used for this process. It also provides you with a collection of Cisco IOS Software commands that could prove to be useful when troubleshooting-related issues. + +Reviewing Layer 3 Packet-Forwarding Process + +To review basic routing processes, consider Figure 12-1. In this topology, PC1 needs to access HTTP resources on Server1. Notice that PC1 and Server1 are on different networks. So, the question becomes, how does a packet from a source IP address of 192.168.1.2 get routed to a destination IP address of 192.168.3.2? + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 Default Gateway: 192.168.1.1 + +PC1 + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + + +Server1 + + + + + + + + +SW1 Fa 0/0 R1 192.168.1.1/24 +AAAA.AAAA.AAAA + +Se 1/1 +192.168.2.1/30 Se 1/1 192.168.2.2/30 + + +R2 Fa 0/0 SW2 192.168.3.1/24 BBBB.BBBB.BBBB + + +Figure 12-1 Basic Routing Topology + + + + + + + +From the Library of Outcast Outcast +428 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Consider the following walkthrough of this process, step by step: + +Step 1. PC1 compares its IP address and subnet mask of 192.168.1.2/24 with the des-tination IP address 192.168.3.2, as discussed in Chapter 9, “Troubleshooting IPv4 Addressing and Addressing Technologies.” PC1 determines the network portion of its own IP address. It then compares these binary bits with the same binary bits of the destination address. If they are the same, the destina-tion is on the same subnet. If they differ, the destination is on a remote sub-net. PC1 concludes that the destination IP address resides on a remote subnet in this example. Therefore, PC1 needs to send the frame to its default gateway, which could have been manually configured on PC1 or dynamically learned via Dynamic Host Configuration Protocol (DHCP). In this example, PC1 has +a default gateway of 192.168.1.1 (that is, router R1). To construct a proper Layer 2 frame, PC1 needs the MAC address of the frame’s destination, which is PC1’s default gateway in this example. If the MAC address is not in PC1’s Address Resolution Protocol (ARP) cache, PC1 uses ARP to discover it. Once PC1 receives an ARP reply from router R1, PC1 adds router R1’s MAC address to its ARP cache. PC1 now sends its data destined for Server1 in a frame addressed to R1, as shown in Figure 12-2. + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 Default Gateway: 192.168.1.1 + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + +PC1’s ARP Cache +PC1 192.168.1.1 AAAA.AAAA.AAAA +Server1 + + +ARP Request + +ARP Reply + + + +SW1 Fa 0/0 R1 192.168.1.1/24 +AAAA.AAAA.AAAA +Frame from PC1 to R1 + +Se 1/1 +192.168.2.1/30 Se 1/1 R2 192.168.2.2/30 + + +Fa 0/0 SW2 192.168.3.1/24 BBBB.BBBB.BBBB + + + + +Data Transport HTTP TCP + +PC1 + +SRC IP 192.168.1.2 + +Server1 + +DST IP 192.168.3.2 + +PC1 + +SRC MAC 1111.1111.1111 + +R1 + +DST MAC AAAA.AAAA.AAAA + + + +Figure 12-2 + +Step 2. + + +Basic Routing Step 1 + +Router R1 receives the frame sent from PC1, and because the destination MAC is R1’s, R1 tears off the Layer 2 header and interrogates the IP (Layer 3) header. An IP header contains a time-to-live (TTL) field, which is decremented +once for each router hop. Therefore, router R1 decrements the packet’s TTL + + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 429 + +field. If the value in the TTL field is reduced to zero, the router discards the packet and sends a time-exceeded Internet Control Message Protocol (ICMP) message back to the source. Assuming the TTL is not decremented to zero, router R1 checks its routing table to determine the best path to reach the IP address 192.168.3.2. In this example, router R1’s routing table has an entry stating that network 192.168.3.0/24 is accessible via interface Serial 1/1. Note that ARPs are not required for serial interfaces because these interface types do not have MAC addresses. Therefore, router R1 forwards the frame out of its Serial 1/1 interface, as shown in Figure 12-3, using the PPP Layer 2 framing header. + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 Default Gateway: 192.168.1.1 + +PC1 + + +Router R1’s Route Entry + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + + +Server1 + +192.168.3.0/24 Serial 1/1 + + + + + +SW1 Fa 0/0 R1 192.168.1.1/24 +AAAA.AAAA.AAAA + +PPP +Se 1/1 +192.168.2.1/30 Se 1/1 192.168.2.2/30 + +PPP Frame R1 to R2 + + + +R2 Fa 0/0 SW2 192.168.3.1/24 BBBB.BBBB.BBBB + + + + +Data Transport HTTP TCP + +PC1 + +SRC IP 192.168.1.2 + +Server1 + +DST IP PPP L2 Header 192.168.3.2 + + + +Figure 12-3 + +Step 3. + + +Basic Routing Step 2 + +When router R2 receives the frame, it removes the PPP header, and then dec-rements the TTL in the IP header, just as router R1 did. Again, assuming the TTL did not get decremented to zero, router R2 interrogates the IP header to determine the destination network. In this case, the destination network of 192.168.3.0/24 is directly attached to router R2’s Fast Ethernet 0/0 interface. Similar to how PC1 sent out an ARP request to determine the MAC address of its default gateway, router R2 sends an ARP request to determine the MAC address of Server1 if it is not already known in the ARP cache. Once an ARP reply is received from Server1, router R2 forwards the frame out of its Fast +Ethernet 0/0 interface to Server1, as shown in Figure 12-4. + + + + + + + +From the Library of Outcast Outcast +430 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +IP Address: 192.168.1.2/24 MAC Address: 1111.1111.1111 Default Gateway: 192.168.1.1 + + +IP Address: 192.168.3.2/24 MAC Address: 2222.2222.2222 Default Gateway: 192.168.3.1 + + + +PC1 +Router R2’s Route Entry +192.168.3.0/24 FA 0/0 + + +Server1 + + +Router R2’s ARP Cache ARP Request 192.168.3.2 2222.2222.2222 ARP Reply + + + +SW1 Fa 0/0 R1 192.168.1.1/24 +AAAA.AAAA.AAAA + +Se 1/1 +192.168.2.1/30 Se 1/1 192.168.2.2/30 + + +R2 Fa 0/0 SW2 192.168.3.1/24 BBBB.BBBB.BBBB + + +Frame from R2 to Server1 + + + +Data Transport HTTP TCP + +PC1 + +SRC IP 192.168.1.2 + +Server1 + +DST IP 192.168.3.2 + +R2 + +SRC MAC BBBB.BBBB.BBBB + +Server1 + +DST MAC 2222.2222.2222 + + +Figure 12-4 Basic Routing Step 3 + +The previous steps identified two router data structures: + + +■ Key +Topic + + + + + +■ + +IP routing table: When a router needed to route an IP packet, it consulted its IP routing table to find the best match. The best match is the route that has the longest prefix. For example, suppose that a router has a routing entry for network 10.0.0.0/8, 10.1.1.0/24, and 10.1.1.0/26. Also, suppose that the router is trying to forward a pack-et with the destination IP address 10.1.1.10. The router would select the 10.1.1.0/26 route entry as the best match for 10.1.1.10 because that route entry has the longest prefix of /26 (matches the most number of bits). + +Layer 3 to Layer 2 mapping table: In the previous figure, router R2’s ARP cache contained Layer 3 to Layer 2 mapping information. Specifically, the ARP cache had a mapping that said a MAC address of 2222.2222.2222 corresponded to an IP address of 192.168.3.2. An ARP cache is the Layer 3 to Layer 2 mapping data structure used for Ethernet-based networks, but similar data structures are used for Multipoint Frame Relay networks and dynamic multipoint virtual private networks (DMVPNs). However, for point-to-point links such as PPP or HDLC, because there is only one other possible device connected to the other end of the link, no mapping informa- +tion is needed to determine the next-hop device. + + +Continually querying a router’s routing table and its Layer 3 to Layer 2 mapping data structure (for example, an ARP cache) is less than efficient. Fortunately, Cisco Express Forwarding (CEF), as introduced in Chapter 3, “Troubleshooting Device Performance,” + + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 431 + +makes lookups much more efficient. CEF gleans its information from the router’s IP rout-ing table and Layer 3 to Layer 2 mapping tables. Then, CEF’s data structures can be refer-enced when forwarding packets. The two primary CEF data structures are as follows: + + +■ Key +Topic + +■ + +Forwarding Information Base (FIB): The FIB contains Layer 3 information, similar to the information found in an IP routing table. In addition, an FIB contains informa-tion about multicast routes and directly connected hosts. + +Adjacency table: When a router is performing a route lookup using CEF, the FIB references an entry in the adjacency table. The adjacency table entry contains the frame header information required by the router to properly form a frame. Therefore, an egress interface and a next-hop MAC address would be in an adjacency entry for a multipoint interface, whereas a point-to-point interface would require only egress +interface information. + + +As a reference, Figure 12-5 shows the router data structures previously discussed. + + + + + + + +IP Routing Table + +Layer 3 to Layer 2 Mappings + +Control Plane + + +CEF Forwarding Information Base + +CEF Adjacency Table + +Data Plane + +Figure 12-5 A Router’s Data Structures + + +Troubleshooting the Packet-Forwarding Process + +When troubleshooting packet-forwarding issues, you will examine a router’s IP routing table. If the traffic’s observed behavior is not conforming to information in the IP rout-ing table, remember that the IP routing table is maintained by a router’s control plane and is used to build the tables at the data plane. CEF is operating in the data plane and uses the FIB. Therefore, you want to view the CEF data structures (that is, the FIB and the +adjacency table) that contain all the information required to make packet-forwarding deci-sions. + +Example 12-1 provides sample output from the show ip route [ip_address] command. The output shows that the next-hop IP address to reach an IP address of 192.168.1.11 is 192.168.0.11, which is accessible via interface Fast Ethernet 0/0. Because this informa-tion is coming from the control plane, it includes information about the routing protocol, which is OSPF in this case. + + + + +From the Library of Outcast Outcast +432 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 12-1 show ip route ip_address Command Output Key +Topic Router#show ip route 192.168.1.11 +Routing entry for 192.168.1.0/24 +Known via "ospf 1", distance 110, metric 11, type intra area +Last update from 192.168.0.11 on FastEthernet0/0, 00:06:45 ago +Routing Descriptor Blocks: +192.168.0.11, from 10.1.1.1, 00:06:45 ago, via FastEthernet0/0 +Route metric is 11, traffic share count is 1 + +Example 12-2 provides sample output from the show ip route ip_address subnet_mask command. The output indicates that the entire network 192.168.1.0/24 is accessible out of interface Fast Ethernet 0/0, with a next-hop IP address of 192.168.0.11. + +Example 12-2 show ip route ip_address subnet_mask Command Output + +Router#show ip route 192.168.1.0 255.255.255.0 +Routing entry for 192.168.1.0/24 +Known via "ospf 1", distance 110, metric 11, type intra area +Last update from 192.168.0.11 on FastEthernet0/0, 00:06:57 ago +Routing Descriptor Blocks: +192.168.0.11, from 10.1.1.1, 00:06:57 ago, via FastEthernet0/0 +Route metric is 11, traffic share count is 1 + +Example 12-3 provides sample output from the show ip route ip_address subnet_mask longer-prefixes command, with and without the longer-prefixes option. Notice that the router responds that the subnet 172.16.0.0 255.255.0.0 is not in the IP routing table. However, after adding the longer-prefixes option, two routes are displayed, because these routes are subnets of the 172.16.0.0/16 network. + +Example 12-3 show ip route ip_address subnet_mask longer-prefixes Command Output + +Router#show ip route 172.16.0.0 255.255.0.0 +% Subnet not in table +R2#show ip route 172.16.0.0 255.255.0.0 longer-prefixes +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +- ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 433 + +Example 12-4 provides sample output from the show ip cef ip_address command. The output indicates that, according to CEF, an IP address of 192.168.1.11 is accessible out of interface Fast Ethernet 0/0, with a next-hop IP address of 192.168.0.11. + +Example 12-4 show ip cef ip_address Command Output +Key +Topic Router#show ip cef 192.168.1.11 +192.168.1.0/24, version 42, epoch 0, cached adjacency 192.168.0.11 +0 packets, 0 bytes +via 192.168.0.11, FastEthernet0/0, 0 dependencies +next hop 192.168.0.11, FastEthernet0/0 +valid cached adjacency + +Example 12-5 provides sample output from the show ip cef ip_address subnet_mask command. The output indicates that network 192.168.1.0/24 is accessible off of interface Fast Ethernet 0/0, with a next-hop IP address of 192.168.0.11. + +Example 12-5 show ip cef ip_address subnet_mask Command Output + +Router#show ip cef 192.168.1.0 255.255.255.0 +192.168.1.0/24, version 42, epoch 0, cached adjacency 192.168.0.11 +0 packets, 0 bytes +via 192.168.0.11, FastEthernet0/0, 0 dependencies +next hop 192.168.0.11, FastEthernet0/0 +valid cached adjacency + +Example 12-6 provides sample output from the show ip cef exact-route source_address destination_address command. The output indicates that a packet sourced from an IP address of 10.2.2.2 and destined for an IP address of 192.168.1.11 will be sent out of interface Fast Ethernet 0/0 to a next-hop IP address of 192.168.0.11. + +Example 12-6 show ip cef exact-route source_address destination_address Command Output + +Router#show ip cef exact-route 10.2.2.2 192.168.1.11 +10.2.2.2 -> 192.168.1.11 : FastEthernet0/0 (next hop 192.168.0.11) + +For a multipoint interface such as point-to-multipoint Frame Relay or Ethernet, after a router knows the next-hop address for a packet, it needs appropriate Layer 2 information (for example, next-hop MAC address, or data-link connection identifier [DLCI]) to properly construct a frame. Example 12-7 provides sample output from the show ip arp command, which displays the ARP cache that is stored in the control plane on a router. The output shows the learned or configured MAC addresses along with their associated IP addresses. + +Example 12-7 show ip arp Command Output Key +Topic Router#show ip arp + +Protocol +Internet +Internet + +Address +192.168.0.11 +192.168.0.22 + +Age (min) +0 +- + +Hardware Addr Type +0009.b7fa.d1e1 ARPA +c001.0f70.0000 ARPA + +Interface +FastEthernet0/0 +FastEthernet0/0 + + + + +From the Library of Outcast Outcast +434 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 12-8 provides sample output from the show frame-relay map command. The output shows the Frame Relay interfaces, the corresponding DLCIs associated with the interfaces, and the next-hop IP address that is reachable out the interface using the per-manent virtual circuit (PVC) associated with the listed DLCI. In this case, if R2 needs to send data to the next-hop IP address 172.16.33.6, it would use the PVC associated with DLCI 406 to get there. + +Key Example 12-8 show frame-relay map Command Output Topic Router#show frame-relay map +Serial1/0 (up): ip 172.16.33.5 dlci 405(0x195,0x6450), static,broadcast, +CISCO, status defined, active +Serial1/0 (up): ip 172.16.33.6 dlci 406(0x196,0x6460), static,broadcast, +CISCO, status defined, active + +Example 12-9 provides sample output from the show ip nhrp command. This command displays the Next Hop Resolution Protocol cache that is used with DMVPNs. In this example, if a packet needs to be sent to the 192.168.255.2 next-hop IP address, the non-broadcast multiaccess (NBMA) address of 198.51.100.2 is used to reach it. + +Example 12-9 show ip nhrp Command Output + +HUBRouter#show ip nhrp +192.168.255.2/32 via 192.168.255.2 +Tunnel0 created 00:02:35, expire 01:57:25 +Type: dynamic, Flags: unique registered +NBMA address: 198.51.100.2 +192.168.255.3/32 via 192.168.255.3 +Tunnel0 created 00:02:36, expire 01:57:23 +Type: dynamic, Flags: unique registered +NBMA address: 203.0.113.2 + +Example 12-10 provides sample output from the show adjacency detail command. The output shows the CEF information used to construct frame headers needed to reach the next-hop IP addresses through the various router interfaces. Notice the value 64510800 for Serial 1/0. This is a hexadecimal representation of information that is needed by the router to successfully forward the packet to the next hop IP address 172.16.33.5, includ-ing the DLCI of 405. Notice the value CA1B01C4001CCA1C164000540800 for Fast Ethernet 3/0. This is the destination MAC, source MAC, and the EtherType code for +an Ethernet frame. The first 12 hex values are the destination MAC, the next 12 are the source MAC, and 0800 is the IPv4 EtherType code. + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 435 + +Example 12-10 show adjacency detail Command Output + +Router#show adjacency detail +Protocol Interface Address + +IP Serial1/0 + + + + + + +IP Serial1/0 + + + + + + +IP FastEthernet3/0 + +172.16.33.5(7) +0 packets, 0 bytes +epoch 0 +sourced in sev-epoch 1 +Encap length 4 +64510800 +FR-MAP +172.16.33.6(7) +0 packets, 0 bytes +epoch 0 +sourced in sev-epoch 1 +Encap length 4 +64610800 +FR-MAP +203.0.113.1(7) +0 packets, 0 bytes +epoch 0 +sourced in sev-epoch 1 +Encap length 14 +CA1B01C4001CCA1C164000540800 +L2 destination address byte offset 0 +L2 destination address byte length 6 +Link-type after encap: ip +ARP + + + +Troubleshooting Routing Information Sources + +When designing a routed network, you have many options to choose from when deter-mining what will be the source of routing information: connected, static, EIGRP, OSPF, BGP, to name a few. With all these different options, you need to be able to recognize what is more trustworthy (believable). This is extremely important when you are using multiple sources because only one source of information can be used to populate the routing table for any given route. As a result, it is important as a troubleshooter to under-stand how the best source of route information is determined and placed in the routing table. + +This section explains which sources of route information are the most believable and how the routing table interacts with various data structures to populate itself with the best information. + + + + + + + +From the Library of Outcast Outcast +436 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Data Structures and the Routing Table + +To better troubleshoot routing information sources, consider, generically, how dynamic routing protocols’ data structures interact with a router’s IP routing table. Figure 12-6 shows the interaction between the data structures of an IP routing protocol and a router’s IP rout-ing table. + +Incoming Route Information Outgoing Route Information + + + + + + + +Data Structure of IP Routing Protocol + +Interface enabled for routing process +Static Routes + +Redistributed Routes + +Directly Connected + +Route Installation + + + + + +IP Routing Table + + + +Figure 12-6 Interaction Between the IP Routing Table and a Routing Protocol Data Structure + +As a router receives route information from a neighboring router, the information is stored in the data structures of the IP routing protocol and analyzed by the routing protocol +to determine the best path based on metrics. An IP routing protocol’s data structure can also be populated by the local router. For example, a router might be configured for route redistribution, where route information is redistributed from the routing table into the IP routing protocols data structure. The router might be configured to have specific interfac-es participate in an IP routing protocol process. Therefore, the network that the interface belongs to is placed into the routing protocol data structure as well. + +However, what goes in the routing table? Reviewing Figure 12-6 again, you can see that the routing protocol data structure can populate the routing table, a directly connected route can populate the routing table, and static routes can populate the routing table. These are all known as sources of routing information. + +Sources of Route Information +Your router could conceivably receive route information from the following routing sources all at the same time: + +■ Connected interface + +■ Static route + +■ RIP + +■ EIGRP + +■ OSPF + +■ BGP + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 437 + +If the route information received from all these sources is for different destination net-works, each one will be used for its respectively learned destination networks and be placed in the routing table. However, what if the route received from RIP and OSPF were the exact same? For example, both protocols have informed the router about the 10.1.1.0/24 network. How does the router choose which is the most believable, or the best source of routing information? It cannot use both; it has to pick one and install that information in the routing table. + +Routing information sources have each been assigned an administrative distance (AD). An administrative distance of a routing information source can be thought of as the believability or trustworthiness of that routing source when comparing it to the other routing information sources. Table 12-2 lists the default ADs of routing information sources. The lower the AD, the more preferred the source of information. + +For instance, RIP has a default AD of 120, whereas OSPF has a default AD of 110. Therefore, if both RIP and OSPF have knowledge of a route to a specific network (10.1.1.0/24 as an example), the OSPF route would be injected into the router’s IP routing table because OSPF has a more believable AD. Therefore, the best route selected by an IP routing protocol’s data structure is only a candidate to be injected into the router’s IP routing table. The route is only injected into the routing table if the routing table con-cludes that it came from the best routing source. As you will see in later chapters when +you troubleshoot specific routing protocols, routes might be missing in the routing table from a specific routing protocol, or suboptimal routing may be occurring because a dif-ferent routing source with a lower AD is being used. + +Table 12-2 Default Administrative Distance of Route Sources +Key +Topic Source of Route Information AD + +Connected interface 0 + +Static route 1 + +EIGRP summary route 5 + +eBGP 20 + +EIGRP (internal) 90 + +OSPF 110 + +IS-IS 115 + +RIP 120 + +EGP 140 + +ODR 160 + +EIGRP (external) 170 + +iBGP 200 + +Unknown (not believable) 255 + + + + +From the Library of Outcast Outcast +438 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +You can verify the AD of a route in the routing table by using the show ip route ip_ address command as shown in Example 12-11. You can see in the example that the route to 10.1.1.0 has an AD of 0 and the route to 10.1.23.0 has an AD of 90. + +Example 12-11 Verifying the Administrative Distance of a Route in the Routing Table +Key +Topic R1#show ip route 10.1.1.0 +Routing entry for 10.1.1.0/26 +Known via "connected", distance 0 , metric 0 (connected, via interface) +Redistributing via eigrp 100 +Routing Descriptor Blocks: +directly connected, via GigabitEthernet1/0 +Route metric is 0, traffic share count is 1 + +R1#show ip route 10.1.23.0 +Routing entry for 10.1.23.0/24 +Known via "eigrp 100", distance 90 , metric 3072, type internal +Redistributing via eigrp 100 +Last update from 10.1.13.3 on GigabitEthernet2/0, 09:42:20 ago +Routing Descriptor Blocks: +10.1.13.3, from 10.1.13.3, 09:42:20 ago, via GigabitEthernet2/0 +Route metric is 3072, traffic share count is 1 +Total delay is 20 microseconds, minimum bandwidth is 1000000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 1 + +If you ever need to make sure that the route information or subset of route information received from a particular source is never used, you can change the AD of specific routes or all routes from that source to 255, which means “do not believe.” + +AD can also be used to manipulate path selection. For example you may have two differ-ent paths to the same destination learned from two different sources (for example, EIGRP and a static route). In this case, the static route is preferred. However, this static route may be pointing to a backup link that is slower than the EIGRP path. Therefore, you want the EIGRP path to be installed in the routing table because the static route is causing sub-optimal routing. But, you are not allowed to remove the static route. To solve this issue, you can create a floating static route. This static route has a higher AD than the preferred route. Because we want EIGRP to be preferred, we modify the static route so that it has an AD higher than EIGRP, which is 90. As a result, the EIGRP-learned route is installed +in the routing table, and the static route will be installed only if the EIGRP-learned route goes away. + +Troubleshooting Static Routes + +Static routes are manually configured by administrators, and by default are the second most trustworthy source of routing information, with an AD of 1. They allow an admin-istrator to precisely control how to route packets for a particular destination. This section + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 439 + +discusses the syntax of IPv4 and IPv6 static routes and explains what to look for while troubleshooting. + +IPv4 Static Routes + +To create an IPv4 static route, you use the ip route prefix mask {ip_address | interface_ type interface_number} [distance] command in global configuration mode. Example 12-12 displays the configuration of a static route on R1, as shown in Figure 12-7. The static route is training R1 about the 10.1.3.0/24 network. To get to the network, it is reachable via the next-hop address of 10.1.12.2, which is R2, and it has been assigned an AD of 8. (The default is 1.) + +Example 12-12 Configuring a Static Route on R1 with Next-Hop Option + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ip route 10.1.3.0 255.255.255.0 10.1.12.2 8 + +10.1.1.0/24 10.1.3.0/24 Gi1/0 +R1 10.1.12.0/24 R2 10.1.23.0/24 R3 + + +10.1.3.0/24 via 10.1.12.2 + +Figure 12-7 Configuring a Static Route on R1 with Next-Hop Option + +Example 12-13, which shows the output of show ip route static on R1, indicates that the 10.1.3.0/24 network was learned by a static route, it is reachable via the next-hop IP address of 10.1.12.2, it has an AD of 8, and the metric is 0 because there is no way to know how far the destination truly is like a dynamic routing protocol does. + +Example 12-13 Verifying a Static Route on R1 + +R1#show ip route static +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +...output omitted... + +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +S 10.1.3.0/24 [8/0] via 10.1.12.2 + +When troubleshooting IPv4 static routes, you need to be able to recognize why the static route may not be providing the results you want. For example, are the network and mask accurate? If either of these is incorrect, your static route will not route the packets you are expecting it to route. The router might drop packets because it does not match the static route or any other route. It might end up forwarding packets via the default route, which may be pointing the wrong way. In addition, if the static route includes networks that it should not, you could be routing packets the wrong way. + + + +From the Library of Outcast Outcast +440 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + + + + + +Key Topic + +Consider this: If you were to configure the following static route on R2 in Figure 12-7, ip route 10.1.3.0 255.255.255.0 10.1.12.1, packets destined to 10.1.3.0 would be sent to R1, which is the wrong way. However, notice in Example 12-13 that R1 points to R2 (10.1.12.2) for the network 10.1.3.0/24. Therefore, R1 and R2 will simply bounce packets back and forth that are destined for 10.1.3.0/24 until the TTL expires. + +As you can see, the next-hop IP address is a very important parameter for the static route. It tells the local router where to send the packet. For instance, in Example 12-13, the next hop is 10.1.12.2. Therefore, a packet destined to 10.1.3.0 has to go to 10.1.12.2 next. R1 now does a recursive lookup in the routing table for 10.1.12.2 to determine how to reach it, as shown in Example 12-14 . This example displays the output of the show ip route 10.1.12.2 command on R1. You can see that 10.1.12.2 is directly connected out Gigabit +Ethernet 1/0. + + +Example 12-14 Recursive Lookup on R1 for Next-Hop Address + +R1#show ip route 10.1.12.2 +Routing entry for 10.1.12.0/24 +Known via "connected", distance 0, metric 0 (connected, via interface) +Routing Descriptor Blocks: +directly connected, via GigabitEthernet1/0 +Route metric is 0, traffic share count is 1 + +Because the exit interface to reach 10.1.12.2 is Gigabit Ethernet 1/0, the Ethernet frame requires a source and destination MAC address. As a result, R1 looks in its ARP cache as shown in Example 12-15 and finds the MAC for 10.1.12.2 is ca08.0568.0008. + +Example 12-15 MAC Address Lookup in ARP Cache + +R1#show ip arp + +Protocol +Internet +Internet +Internet + +Address +10.1.1.1 +10.1.12.1 +10.1.12.2 + +Age (min) +- +- +71 + +Hardware Addr Type +ca07.0568.0008 ARPA +ca07.0568.001c ARPA +ca08.0568.0008 ARPA + +Interface +GigabitEthernet0/0 +GigabitEthernet1/0 +GigabitEthernet1/0 + + +As you can see in this case, the MAC address of the next-hop address is used for the Layer 2 frame. It is not the MAC address of the IP address in the packet. The benefit of this is that the router only has to find the MAC address of the next-hop once using the ARP process and then store the results in the ARP cache. Now, any packet that has to go to the next-hop of 10.1.12.2 does not require an ARP request to be sent, just a look up in the ARP cache, making the overall routing process more efficient. + +Now that we understand the next-hop IP address, there is another option we need to know about. The ip route syntax shown earlier indicated that you can specify an exit interface instead of a next hop IP address. There is a right time and a wrong time to use the exit interface. The right time is when it’s a pure point-to-point interface such as DSL, or Serial. Point-to-Point Ethernet links are not pure point-to-point, they are still multi-access, and since they are Ethernet they require a source and destination MAC address. If + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 441 + +you specify an Ethernet interface as the next-hop you will be making your router ARP for the MAC address of every destination IP address in every packet. Let’s look at this. + +You configure the following static route on R1: ip route 10.1.3.0 255.255.255.0 gigabit Ethernet 1/0. Example 12-16 displays how the static route appears in the routing table. It states 10.1.3.0/24 is directly connected to Gigabit Ethernet 1/0. But is it? Refer to Figure 12-8 to know for sure. It is clear in Figure 12-8 that 10.1.3.0/24 is not directly connected. But, the way the static route is configured, R1 thinks that it is. + +Example 12-16 Static Route with Exit Interface Specified + +R1#show ip route static +...output omitted... + +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +S 10.1.3.0/24 is directly connected, GigabitEthernet1/0 + +10.1.1.0/24 10.1.3.0/24 Gig1/0 +R1 10.1.12.0/24 R2 10.1.23.0/24 R3 + + +10.1.3.0/24 via Gig1/0 + +Figure 12-8 Configuring a Static Route on R1 with Exit Interface Option + +Imagine users in the 10.1.1.0/24 network are trying to access resources in the 10.1.3.0/24 network. Specifically, they are accessing resources on 10.1.3.1 through 10.1.3.8. R1 receives the packets, and it looks in the routing table and the longest match is the follow-ing entry: + +S 10.1.3.0/24 is directly connected, GigabitEthernet1/0 + + +Key Topic + +R1 believes the network is directly connected; therefore, the destination IP address in the packet is on the network connected to Gig1/0. However, we know better because we have shown in Figure 12-8 that it is not. So, because it is an Ethernet interface, R1 will use ARP to determine the MAC of the IP address in the destination field of the packet. (This is different from what occurred when the next-hop IP address was specified. When the next-hop was specified, the MAC of the next-hop address was used.) Review Example +12-17 now. It displays the ARP cache on R1. Notice that every destination IP address has an entry in the ARP cache. How can that be since ARPs are not forwarded by routers? +It is because of Proxy ARP, which is on by default on our routers. Proxy ARP allows a router to respond to ARP requests with its own MAC address if it has a route in the rout-ing table to the IP address in the ARP request. Notice how the MAC addresses listed are all the same. In addition, they match the MAC address of the 10.1.12.2 entry. Therefore, because R2 has a route to reach the IP address of the ARP request, it responds back with +its MAC address to use. + + + + + + +From the Library of Outcast Outcast +442 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 12-17 ARP Cache on R1 with R2 Proxy ARP Enabled + +R1#show ip arp + +Protocol +Internet +Internet +Internet +Internet +Internet +Internet +Internet +Internet +Internet +Internet +Internet + +Address +10.1.1.1 +10.1.3.1 +10.1.3.2 +10.1.3.3 +10.1.3.4 +10.1.3.5 +10.1.3.6 +10.1.3.7 +10.1.3.8 +10.1.12.1 +10.1.12.2 + +Age (min) +- +0 +0 +3 +0 +1 +0 +0 +1 +- +139 + +Hardware Addr Type +ca07.0568.0008 ARPA +ca08.0568.0008 ARPA +ca08.0568.0008 ARPA +ca08.0568.0008 ARPA +ca08.0568.0008 ARPA +ca08.0568.0008 ARPA +ca08.0568.0008 ARPA +ca08.0568.0008 ARPA +ca08.0568.0008 ARPA +ca07.0568.001c ARPA +ca08.0568.0008 ARPA + +Interface +GigabitEthernet0/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 +GigabitEthernet1/0 + + +Example 12-18 shows how you can verify whether Proxy ARP is enabled by using the show ip interfaces command. + +Example 12-18 Verifying Whether Proxy ARP Is Enabled + +R2#show ip interface gigabitEthernet 0/0 +GigabitEthernet0/0 is up, line protocol is up +Internet address is 10.1.12.2/24 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.5 224.0.0.6 +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are always sent + +If Proxy ARP was not enabled, the ARP cache on R1 would appear as shown in Example 12-19. Notice how R1 is still sending ARP requests; however, it is not getting any ARP replies. Therefore, it cannot build the Layer 2 frame, and the result is an encapsulation failure, which you would be able to see if you were debugging IP packets. + +Example 12-19 ARP Cache on R1 with R2 Proxy ARP Disabled + +R1#show ip arp + +Protocol +Internet +Internet + +Address +10.1.1.1 +10.1.3.1 + +Age (min) +- +0 + +Hardware Addr Type +ca07.0568.0008 ARPA +Incomplete ARPA + +Interface +GigabitEthernet0/0 + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 443 + + +Internet +Internet +Internet +Internet +Internet +Internet +Internet +Internet +Internet + +10.1.3.2 +10.1.3.3 +10.1.3.4 +10.1.3.5 +10.1.3.6 +10.1.3.7 +10.1.3.8 +10.1.12.1 +10.1.12.2 + +0 Incomplete ARPA +0 Incomplete ARPA +0 Incomplete ARPA +0 Incomplete ARPA +0 Incomplete ARPA +0 Incomplete ARPA +0 Incomplete ARPA +- ca07.0568.001c ARPA +139 ca08.0568.0008 ARPA + + + + + + + + +GigabitEthernet1/0 +GigabitEthernet1/0 + + +Because of the fact that R1 will use ARP to determine the MAC address of every destina-tion IP address in every packet, you should never specify an Ethernet interface in a static route. This results in an excessive use of router resources, such as processor and memory, as the control plane gets involved during the forwarding process to determine the appro-priate Layer 2 MAC address using ARP. + +As you can see, being able to recognize misconfigured static routes and the issues that arise is an important skill to have when troubleshooting because a misconfigured static route will cause traffic to be misrouted or suboptimally routed. In addition, remember that static routes have an AD of 1; therefore, they will be preferred over other sources of routing information to the same destination. + +IPv6 Static Routes + +To create an IPv6 static route, you use the ipv6 route {ipv6_prefix/prefix_length} +{ipv6_address | interface_type interface_number} [administrative_distance] [next_ hop_address] command in global configuration mode. + +Example 12-20 displays the configuration of a static route on R1, as shown in Figure 12-9. The static route is training R1 about the 2001:DB8:0:3::/64 network. To get to the net-work, it is reachable via the next-hop address of FE80::2, which is R2’s link-local address, and it has been assigned an AD of 8. (The default is 1.) Notice how the exit Ethernet interface is specified. This is mandatory when using the link-local address as the next-hop because the same link-local address can be used on multiple local router interfaces. In addition, multiple remote router interfaces can have the same link-local address as well. However, as long as the link-local addresses are unique between the devices within the same local network, then communication occurs as intended. If you are using a global unicast address as the next hop, you do not have to specify the exit interface. + +Example 12-20 Configuring an IPv6 Static Route on R1 with Next-Hop Option + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ipv6 route 2001:DB8:0:3::/64 gigabitEthernet 1/0 FE80::2 8 + + + + + + + +From the Library of Outcast Outcast +444 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +2001:DB8:0:1::/64 + +Gig1/0 +R1 R2 + +2001:DB8:0:3::/64 + + +R3 + + + +2001:DB8:0:3::/64 via FE80::2 + +Figure 12-9 Configuring an IPv6 Static Route on R1 with Next-Hop Option + +Example 12-21, which shows the output of show ipv6 route static on R1, indicates that the 2001:DB8:0:3::/64 network was learned by a static route, it is reachable via the next-hop IP address of FE80::2, it has an AD of 8, and the metric is 0 because there is no way to know how far the destination truly is like a dynamic routing protocol does. + +Example 12-21 Verifying an IPv6 Static Route on R1 + +R1#show ipv6 route static +...output omitted... +S 2001:DB8:0:3::/64 [8/0] +via FE80::2, GigabitEthernet1/0 + +Now recall that there are no broadcasts with IPv6. Therefore, IPv6 does not use ARP. It uses NDP (Neighbor Discovery Protocol), which is multicast based, to determine +a neighboring devices MAC address. In this case, if R1 needs to route packets to 2001:DB8:0:3::/64, the routing table says to use the next-hop FE80::2, which is out Gig1/0. Therefore, it consults its IPv6 neighbor table, as shown in Example 12-22, to determine whether there is a MAC address for FE80::2 out Gig 1/0. It is imperative that the table has an entry mapping the link-local address and the interface. If only one matches, it is not the correct entry. If there is no entry in the IPv6 neighbor table, a neigh-bor solicitation message is sent to discover the MAC of FE80::2 on Gig1/0. + +Example 12-22 Viewing the IPv6 Neighbor Table on R1 + +R1#show ipv6 neighbors +IPv6 Address Age Link-layer Addr State Interface +FE80::2 0 ca08.0568.0008 REACH Gi1/0 + +As you discovered earlier with IPv4, it is not acceptable to use the interface option in a static route when the interface is an Ethernet interface because of Proxy ARP consuming an excessive amount of router resources. Note that Proxy ARP does not exist in IPv6. Therefore, if you use the interface option with an Ethernet interface, it will work only if the destination IPv6 address is directly attached to the router interface specified. This is because the destination IPv6 address in the packet is used as the next-hop address and the MAC address will need to be discovered using NDP. If the destination is not in the directly connected network, ND will fail, and Layer 2 encapsulation will ultimately fail. Consider Figure 12-9 again. On R1, if you configured the following IPv6 static route (which is called a directly attached static route), what would happen? + +ipv6 route 2001:DB8:0:3::/64 gigabitEthernet 1/0 + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 445 + + + +Key Topic + +When R1 receives a packet destined for 2001:db8:0:3::3, it determines based on the static route that it is directly connected to Gig1/0 (which it is not according to the figure). Therefore, R1 sends an NS out Gig1/0 for the MAC address associated with 2001:db8:0:3::3 using the solicited-node multicast address FF02::1:FF00:3. If no device attached to Gig1/0 is using the solicited-node multicast address FF02::1:FF00:3 and the IPv6 address 2001:db8:0:3::3, the NS goes unanswered, and Layer 2 encapsulation fails. + +As you can see, being able to recognize misconfigured static routes and the issues that arise is an important skill to have when troubleshooting because a misconfigured static route will cause traffic to be misrouted or suboptimally routed. In addition, remember that static routes have an AD of 1 by default; therefore, they are preferred over other +sources of routing information to the same destination. + + + +Static Routing Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 12-10. + + +10.1.1.0/24 +2001:DB8:0:1::/64 + +10.1.3.0/24 +2001:DB8:0:3::/64 + + + +PC1 Gig1/0 Gig0/0 +R1 10.1.12.0/24 Gig0/0 2001:DB8:0:12::/64 + + +Gig1/0 Gig1/0 FTP R2 10.1.23.0/24 R3 Server +2001:DB8:0:23::/64 Gig0/0 + + + +Gig2/0 +2001:DB8:0:13::/64 + +Gig2/0 WWW Server + + +Figure 12-10 Static Routing Trouble Tickets Topology + + +Trouble Ticket 12-1 + +Problem: Users in the 10.1.1.0/24 network have indicated that they are not able to access resources on the FTP server in the 10.1.3.0/24 network. The FTP server uses a static IPv4 address of 10.1.3.10. They also indicate that they are able to access the web server at 10.1.3.5. (Note: This network only uses static routes.) + +You start your troubleshooting efforts by verifying the problem with a ping to 10.1.3.10 from PC1 in the 10.1.1.0/24 network. As shown in Example 12-23 the ping is not success-ful. R1 is responding with a destination unreachable message. This indicates that R1 does not know how to route the packet destined for 10.1.3.10. In addition, you ping 10.1.3.5 from PC1, and it is successful, as shown in Example 12-23 as well. + + + + + + + +From the Library of Outcast Outcast +446 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 12-23 Failed Ping From PC1 to 10.1.3.10 and Successful Ping to 10.1.3.5 + +C:\PC1>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data; + +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +C:\PC1>ping 10.1.3.5 + +Pinging 10.1.3.5 with 32 bytes of data: + +Reply from 10.1.3.5: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.5: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.5: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.5: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.3.5: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +Next you access R1 and issue the show ip route command on R1 to verify whether it knows how to route the packet to 10.1.3.10. In Example 12-24, the closest entry that would match 10.1.3.10 is the entry for 10.1.3.0/29. However, does 10.1.3.10 fall within that subnet? + +Example 12-24 Verifying Routing Table Entries + +R1#show ip route +...output omitted... + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +S 10.1.3.0/29 [1/0] via 10.1.12.2 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +S 10.1.23.0/24 [1/0] via 10.1.12.2 + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 447 + +The network 10.1.3.0/29 would have a range of addresses from 10.1.3.0 to 10.1.3.7. Therefore, 10.1.3.10 does not fall within that subnet, but 10.1.3.5 does. This explains why the users can reach one address and not the other in the 10.1.3.0/24 network. If you exe-cute the show ip route 10.1.3.10 and show ip route 10.1.3.5 commands on R1, the output will verify this further. As shown in Example 12-25, there is no match for 10.1.3.10, but there is one for 10.1.3.5. + +Example 12-25 Verifying Specific Routes + +R1#show ip route 10.1.3.10 +% Subnet not in table +R1#show ip route 10.1.3.5 +Routing entry for 10.1.3.0/29 +Known via "static", distance 1, metric 0 +Routing Descriptor Blocks: +10.1.12.2 +Route metric is 0, traffic share count is 1 + +Because the network in Figure 12-10 is 10.1.3.0/24, and the entry in the routing table is 10.1.3.0/29, it is possible that the static route was misconfigured. You need to verify this by examining the running configuration using the show run | include ip route command, as shown in Example 12-26. Notice the command ip route 10.1.3.0 255.255.255.248 10.1.12.2. This is the command that is producing the 10.1.3.0/29 entry in the routing table. If you look closely, you will notice that the subnet mask was not configured cor-rectly. + +Example 12-26 Examining the Static Routes on R1 in the Running Configuration + +R1#show run | include ip route +ip route 10.1.3.0 255.255.255.248 10.1.12.2 +ip route 10.1.23.0 255.255.255.0 10.1.12.2 + +To solve this issue, you need to remove the static route with the command no ip route 10.1.3.0 255.255.255.248 10.1.12.2 and create a new static route with the ip route 10.1.3.0 255.255.255.0 10.1.12.2 command. + +After you do this, you issue the show ip route command on R1 and confirm that the entry in the routing table is 10.1.3.0/24, as shown in Example 12-27. + +Example 12-27 Verifying Updated Static Route in the Routing Table on R1 + +R1#show ip route +...output omitted... + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 + + + +From the Library of Outcast Outcast +448 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +S 10.1.3.0/24 [1/0] via 10.1.12.2 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +S 10.1.23.0/24 [1/0] via 10.1.12.2 + +Next you issue the show ip route 10.1.3.10 command, as shown in Example 12-28, and notice that the IP 10.1.3.10 now matches an entry in the routing table. + +Example 12-28 Verifying an Entry Exists for 10.1.3.10 + +R1#show ip route 10.1.3.10 +Routing entry for 10.1.3.0/24 +Known via "static", distance 1, metric 0 +Routing Descriptor Blocks: +10.1.12.2 +Route metric is 0, traffic share count is 1 + +Finally, you ping from PC1 to the IP address 10.1.3.10, and the ping is successful, as shown in Example 12-29. + +Example 12-29 Successful Ping from PC1 to 10.1.3.10 + +C:\PC1>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data: + +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 12-2 + +Problem: Your proactive traffic monitoring indicates that all traffic from 2001:DB8:0:1::/64 destined to 2001:DB8:0:3::/64 is going through R2 when it should be going directly to R3 over the Gig2/0 link. R2 should only be used to forward traffic from 2001:DB8:0:1::/64 to 2001:DB8:0:3::/64 if the Gig2/0 link fails, which it has not. You need to determine why traffic is being forwarded the wrong way and fix it. (Note: This net-work only uses static routes.) + +You start by confirming the problem with a trace, as shown in Example 12-30, from PC1 to 2001:DB8:0:3::3, which is the IPv6 address of the Gig0/0 interface on R3. The trace confirms that the packets are being sent though R2. + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 449 + +Example 12-30 Trace from PC1 to R3s Gig0/0 Interface + +C:\PC1>tracert 2001:DB8:0:3::3 +Tracing route to 2001:DB8:0:3::3 over a maximum of 30 hops + + +1 6 ms 1 ms +2 5 ms 1 ms +3 5 ms 1 ms + +2 ms 2001:DB8:0:1::1 +2 ms 2001:DB8:0:12::2 +2 ms 2001:DB8:0:23::3 + + +Trace complete. + +Now you issue the show ipv6 route 2001:DB8:0:3::/64 command on R1, as shown in Example 12-31, and confirm that the next-hop IPv6 address for 2001:DB8:0:3::/64 is 2001:DB8:0:12::2, which is the IPv6 address of R2s Gig0/0 interface. The next-hop IPv6 address should be 2001:DB8:0:13::3 which is R3’s Gig2/0 interface. + +Example 12-31 Verifying the IPv6 Route to 2001:DB8:0:3::/64 on R1 + +R1#show ipv6 route 2001:DB8:0:3::/64 +Routing entry for 2001:DB8:0:3::/64 +Known via "static", distance 10, metric 0 +Backup from "static [11]" +Route count is 1/1, share count 0 +Routing paths: +2001:DB8:0:12::2 +Last updated 00:09:07 ago + +It appears that someone provided the incorrect next-hop IPv6 address in the static route. You verify the static route configured on R1 for the 2001:DB8:0:3::/64 network using the show run | include ipv6 route command, as shown in Example 12-32. You notice that there are two commands for the network 2001:DB8:0:3::/64. One has a next hop of 2001:DB8:0:12::2, and the other has a next hop of 2001:DB8:0:13::3. + +Example 12-32 Verifying the IPv6 Static Routes Configured on R1 + +R1#show run | include ipv6 route +ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:12::2 10 +ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:13::3 11 +ipv6 route 2001:DB8:0:23::/64 2001:DB8:0:12::2 + +Why is the ipv6 route command with the next hop of 2001:DB8:0:12::2 being pre-ferred over the command with a next hop of 2001:DB8:0:13::3? If you look closely at both commands in Example 12-32, you will notice that the one with a next hop of +2001:DB8:0:12::2 is configured with an AD of 10 and that the other, which has a next hop of 2001:DB8:0:13::3, is configured with an AD of 11. Because lower AD is preferred, the static route with the AD of 10 is more trustworthy and therefore used. + +To solve this issue, you need to configure the static route with the next hop of 2001:DB8:0:13::3 with a lower AD. In this case, you change the AD to 1, which is the + + + +From the Library of Outcast Outcast +450 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +default for static routes, with the ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:13::3 1 command. After the change, you revisit the routing table with the show ipv6 route 2001:DB8:0:3::/64 command to verify that the static route with the next hop of 2001:DB8:0:13::3 is now in the routing table. Example 12-33 confirms that the change was successful. + +Example 12-33 Verifying IPv6 Routing Table on R1 + +R1#show ipv6 route 2001:DB8:0:3::/64 +Routing entry for 2001:DB8:0:3::/64 +Known via "static", distance 1, metric 0 +Backup from "static [11]" +Route count is 1/1, share count 0 +Routing paths: +2001:DB8:0:13::3 +Last updated 00:01:14 ago + +Now you perform a trace from PC1 to 2001:DB8:0:3::3, as shown in Example 12-34, and it confirms that R2 is no longer being used. The traffic is now flowing across the link between R1 and R3. + +Example 12-34 Trace from PC1 to R3’s Gig0/0 Interface + +C:\PC1>tracert 2001:DB8:0:3::3 +Tracing route to 2001:DB8:0:3::3 over a maximum of 30 hops + + +1 6 ms 1 ms +2 5 ms 1 ms + +2 ms 2001:DB8:0:1::1 +2 ms 2001:DB8:0:13::3 + + +Trace complete. + + +Troubleshooting GRE Tunnels + +Generic routing encapsulation (GRE) is a tunneling protocol that is used to encapsulate various types of network layer packets inside a transport protocol (GRE) so that they can be transported over an IP network. For example, you could take IPv6 network layer pack-ets and encapsulate them in GRE so that they can be transported over an IPv4 network. Discussions related to GRE can be extensive. However, this book is focused on getting you ready for the TSHOOT certification exam. Therefore, we focus our GRE discussion on exam preparation. As a result, this section covers the benefits of using GRE for site-to-site VPNs in addition to the issues that could cause your GRE tunnels for IPv4 and IPv6 packets not to function as expected. + +With GRE, you can create virtual point-to-point links between remote Cisco routers across an IP network, as shown in Figure 12-11. HQ, which is in San Francisco, and Branch, which is in Toronto, are both connected to the Internet and are not directly con-nected to each other. However, by using a GRE tunnel, you can virtually directly connect + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 451 + +the two routers. Example 12-35 provides a sample configuration that would be used on HQ to configure the GRE tunnel, and Example 12-36 provides a sample configura-tion that would be used on Branch to configure the GRE tunnel. The tunnel IP address is 172.16.1.1 for HQ and 172.16.1.2 for Branch. HQ is using Fa3/0 as the source of the tunnel and the IP address of 203.0.113.1 as the tunnel destination. Branch is using Fa1/0 +as the source of the tunnel and the IP address of 192.0.2.1 as the tunnel destination. The tunnel mode is not listed, which means that the default tunnel mode (point-to-point GRE) is being used. For Cisco devices, the default tunnel mode is GRE/IP. If you had changed the mode and now you want to revert back to the default mode, you use the command tunnel mode gre ip in interface tunnel configuration mode. + + + + +10.1.1.0/24 .1 +HQ + +Tunnel 0 IP:172.16.1.1/30 + +192.0.2.1 +Fa3/0 + + + +Public IPv4 Network Internet +GRE Tunnel + +Tunnel 0 IP:172.16.1.2/30 + +203.0.113.1 +Fa1/0 + + + +192.168.1.0/24 .1 +Branch + +San Francisco Toronto + +Figure 12-11 GRE Tunnel Example + +Example 12-35 GRE Tunnel Configuration on HQ + +HQ#show run int tunnel 0 +Building configuration... + +Current configuration : 127 bytes +! +interface Tunnel0 +ip address 172.16.1.1 255.255.255.252 +tunnel source FastEthernet3/0 +tunnel destination 203.0.113.1 +end + + +Example 12-36 GRE Tunnel Configuration on Branch + +Branch#show run int tunnel 0 +Building configuration... + +Current configuration : 125 bytes +! +interface Tunnel0 +ip address 172.16.1.2 255.255.255.252 +tunnel source FastEthernet1/0 +tunnel destination 192.0.2.1 +end + +An advantage of using GRE in this scenario is that HQ and Branch can dynamically learn about the private IPv4 networks at each site by exchanging routing information over the + + + +From the Library of Outcast Outcast +452 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +tunnel. Without the tunnel, this would not occur because the public IPv4 network would not allow for the exchange of such information between HQ and Branch. GRE accom-plishes this by adding a GRE header (carrier protocol) to encapsulate the original packet (passenger protocol) and then adding a new IP header (transport protocol), which will be used to transport the GRE encapsulated packet over the public IPv4 network, as shown in Figure 12-12. As a result of this, users in HQ can successfully access resources in Branch (through the tunnel), and users in Branch can successfully access resources in HQ (through the tunnel), as shown in Example 12-37. + + +Carrier Protocol + +Passenger Protocol Original Packet Payload + + + +IP GRE Header Network Layer Transport Layer Data + + +Transport Protocol +New IP header for transport over the Public IPv4 Network + +Figure 12-12 GRE Encapsulated Packet + +Example 12-37 Verifying Routes via Tunnel Interface on HQ and Branch + +HQ#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +- ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 192.0.2.2 to network 0.0.0.0 + +S* 0.0.0.0/0 [1/0] via 192.0.2.2 +10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks +C 172.16.1.0/30 is directly connected, Tunnel0 +L 172.16.1.1/32 is directly connected, Tunnel0 +192.0.2.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.0.2.0/30 is directly connected, FastEthernet3/0 +L 192.0.2.1/32 is directly connected, FastEthernet3/0 +D 192.168.1.0/24 [90/26880256] via 172.16.1.2, 00:14:08, Tunnel0 + +Branch#show ip route + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 453 + +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +- ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 203.0.113.2 to network 0.0.0.0 + +S* 0.0.0.0/0 [1/0] via 203.0.113.2 +10.0.0.0/24 is subnetted, 1 subnets +D 10.1.1.0 [90/26880256] via 172.16.1.1, 00:15:29, Tunnel0 +172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks +C 172.16.1.0/30 is directly connected, Tunnel0 +L 172.16.1.2/32 is directly connected, Tunnel0 +192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks +C 192.168.1.0/24 is directly connected, GigabitEthernet0/0 +L 192.168.1.1/32 is directly connected, GigabitEthernet0/0 +203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks +C 203.0.113.0/30 is directly connected, FastEthernet1/0 +L 203.0.113.1/32 is directly connected, FastEthernet1/0 + +When troubleshooting GRE issues, you need to consider the following: + +■ Are the remote devices reachable across the public network? To form a GRE tun-nel between the two remote devices, they must be able to reach each other’s public IP address. You can verify this using the ping command on each router, as shown in Example 12-38. + +■ Are the tunnel IP addresses in the same subnet? With GRE, you are creating a vir-tual point-to-point connection between two remote devices; therefore, they need to be in the same subnet. You can verify the IP address on a tunnel interface, as shown in Example 12-39, using the show interfaces tunnel tunnel_number command or the show ip interface brief command. + +■ Are the correct tunnel source and destination IP addresses specified? The tunnel needs to know where it starts and where it ends. This is based on a source IP address and a destination IP address. These addresses need to be reachable, need to be accurate, and need to be symmetrical (source on each router must match destination on other router and vise versa). You can verify the tunnel source and destination IP addresses using the show interfaces tunnel tunnel_number command, as shown in Example 12-39. + +■ Is the correct tunnel mode specified? To transport IPv4 or IPv6 packets using GRE over an IPv4 network a tunnel mode of GRE IP is required. You can verify the tunnel mode used on a tunnel interface with the show interfaces tunnel tunnel_number command, as shown in Example 12-39. + + +From the Library of Outcast Outcast +454 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Is an access control list (ACL) blocking GRE packets? GRE uses IP protocol num-ber 47. If an ACL exists along the path between the remote devices that is denying protocol 47 or not permitting protocol 47, GRE packets will be dropped in transit. You can verify whether an ACL is applied to an interface with the show ip interface interface_type interface_number command, and you can verify the entries in an ACL with the show access-list command. + +■ Is fragmentation occurring due to insufficient maximum transmission unit (MTU)? Because the GRE header is 24 bytes, this limits the original packet payload to 1476 bytes for a total of 1500 bytes, which equals the typical MTU of an inter-face. This can become an issue if large packets (original packet payload) bigger than 1476 bytes have to cross the GRE tunnel. Because the combined GRE header and original packet payload will be larger than 1500 bytes, fragmentation will occur. This results in processing delays and high CPU usage. To overcome this issue, you have to implement a consistent MTU from end to end. You can verify the MTU on a tunnel interface by using the show interface tunnel tunnel_number command, as shown in Example 12-39. + +■ Is the recursive routing table lookup pointing back to the tunnel? If you receive the syslog message %TUN-5-RECURDOWN: Tunnel0 temporarily disabled due to recursive routing, it is indicating that the router is trying to route to the tunnel destination (the public IPv4 address on the Internet in our example) using the virtual tunnel interface instead of the physical interface connected to the Internet. This can be temporary due to a flapping route elsewhere in the network, or it could be per-manent due to a misconfiguration that is causing the router to route packets to the tunnel destination through the virtual tunnel interface. + +■ Is the routing protocol enabled on the tunnel interface? For routes to be shared dynamically over the tunnel, the tunnel interface needs to be participating in a rout-ing process (for example, RIP, EIGRP, OSPF). + +Example 12-38 Verifying Connectivity Between Remote Routers + +HQ#ping 203.0.113.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 203.0.113.1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 36/67/104 ms + +Branch#ping 192.0.2.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.0.2.1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 32/67/84 ms + + + + + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 455 + +Example 12-39 Verifying Tunnel Addresses, Mode, and MTU Key +Topic HQ#show interfaces tunnel 0 +Tunnel0 is up, line protocol is up +Hardware is Tunnel +Internet address is 172.16.1.1/30 +MTU 17916 bytes, BW 100 Kbit/sec, DLY 50000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation TUNNEL, loopback not set +Keepalive not set +Tunnel source 192.0.2.1 (FastEthernet3/0), destination 203.0.113.1 +Tunnel Subblocks: +src-track: +Tunnel0 source tracking subblock associated with FastEthernet3/0 +Set of tunnels with source FastEthernet3/0, 1 member (includes iterators), on inter-face +Tunnel protocol/transport GRE/IP +Key disabled, sequencing disabled +Checksumming of packets disabled +Tunnel TTL 255, Fast tunneling enabled +Tunnel transport MTU 1476 bytes +Tunnel transmit bandwidth 8000 (kbps) +Tunnel receive bandwidth 8000 (kbps) +...output omitted... + +HQ#show ip interface brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES unset administratively down down + +GigabitEthernet0/0 +FastEthernet3/0 +Tunnel0 + +10.1.1.1 +192.0.2.1 +172.16.1.1 + +YES manual up up +YES manual up up +YES manual up up + + +Refer to Figure 12-13; the GRE tunnel is being used to transport IPv6 packets over an IPv4 network. Examples 12-40 and 12-41 display the configurations required on HQ and Branch to accomplish this. Notice that the tunnel source and tunnel destination are IPv4 addresses and that interface Tunnel 1 is using an IPv6 address. The IPv6 address is a link-local address in this case; however, it could have been a global unicast address as well. The tunnel mode is not displayed because the default is being used. The default tunnel mode on Cisco routers is point-to-point GRE/IP. + + +Tunnel 1 IPv6:FE80::C800:17FF:FE98:6 + +Tunnel 1 IPv6:FE80::C802:1BFF:FE64:6 + + + +2001:db8:0:1::/64 .1 +HQ + + +192.0.2.1 +Fa3/0 + +IPv4 Network (Public or Private) +GRE Tunnel + + +203.0.113.1 +Fa1/0 + + +2001:db8:0:2::/64 .1 +Branch + +San Francisco Toronto + +Figure 12-13 GRE Tunnel Example (for IPv6 Traffic) + + + +From the Library of Outcast Outcast +456 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 12-40 GRE Tunnel Configuration on HQ for IPv6 + +HQ#show run interface tunnel 1 +Building configuration... + +Current configuration : 132 bytes +! +interface Tunnel1 +no ip address +ipv6 enable +ipv6 eigrp 100 +tunnel source FastEthernet3/0 +tunnel destination 203.0.113.1 +end + + +Example 12-41 GRE Tunnel Configuration on Branch for IPv6 + +Branch#show run interface tunnel 1 +Building configuration... + +Current configuration : 130 bytes +! +interface Tunnel1 +no ip address +ipv6 enable +ipv6 eigrp 100 +tunnel source FastEthernet1/0 +tunnel destination 192.0.2.1 +end + +The show interfaces tunnel 1 command is displayed in Example 12-42. You can see from this output that the GRE tunnel mode is GRE/IP even though you are transporting IPv6 packets over the IPv4 network. The tunnel source and destination are IPv4 addresses. The output of show ipv6 interface brief is displayed in Example 12-43 and allows you to verify the IPv6 addresses on an interface. + +Example 12-42 Verifying GRE Tunnel Configuration with the show interface tunnel Command + +HQ#show interface tunnel 1 +Tunnel1 is up, line protocol is up +Hardware is Tunnel +MTU 17916 bytes, BW 100 Kbit/sec, DLY 50000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation TUNNEL, loopback not set +Keepalive not set +Tunnel source 192.0.2.1 (FastEthernet3/0), destination 203.0.113.1 +Tunnel Subblocks: + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 457 + +src-track: +Tunnel1 source tracking subblock associated with FastEthernet3/0 +Set of tunnels with source FastEthernet3/0, 2 members (includes iterators), on interface +Tunnel protocol/transport GRE/IP +Key disabled, sequencing disabled +Checksumming of packets disabled +Tunnel TTL 255, Fast tunneling enabled +Tunnel transport MTU 1476 bytes +Tunnel transmit bandwidth 8000 (kbps) +Tunnel receive bandwidth 8000 (kbps) +...output omitted... + + +Example 12-43 Verifying IPv6 Addresses of Tunnel Interface + +HQ#show ipv6 interface brief + +Ethernet0/0 +unassigned +GigabitEthernet0/0 +FE80::C800:17FF:FE98:8 +2001:DB8:0:1::1 +FastEthernet3/0 +unassigned +Tunnel0 +unassigned +Tunnel1 +FE80::C800:17FF:FE98:6 + +[administratively down/down] + +[up/up] + + +[up/up] + +[up/up] + +[up/up] + + + + + + + + + + + + + + + +Key Topic + +GRE is great at tunneling, but lousy at security. Its main purpose is to provide simple yet powerful tunneling for multiple network layer protocols. It provides basic plaintext authentication between the remote devices using a tunnel key, which is not a valid secu-rity solution when using GRE over an untrusted network such as the Internet. + +When using GRE over an untrusted network, you want to provide confidentiality, authen-tication, and data integrity. You can accomplish this with IPsec. Confidentiality can be provided with symmetric algorithms, and authentication and integrity can be provided with hash message authentication codes (HMACs). + +When using IPsec with GRE, GRE encapsulates the original packet payload first, and then encryption occurs next with IPsec to protect the GRE packet. + +Two different IPsec modes exist that you can use to encapsulate the GRE packet (see Figure 12-14). IPsec tunnel mode will encapsulate and encrypt the entire GRE packet, including the Transport Protocol header. Because the Transport Protocol header is being encapsulated and encrypted, IPsec has to include a new IP header. IPsec transport mode will only encapsulate and encrypt the carrier protocol and the passenger protocol. +Therefore, the Transport Protocol header can be reused by IPsec and reduce overhead. + + + + + + +From the Library of Outcast Outcast +458 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Transport Protocol + +Carrier Protocol + +Passenger Protocol Original Packet Payload + + +GRE Packet IP GRE Header Network Layer Transport Layer Data + + + +IPSec Transport Mode IP ESP GRE Header Network Layer Transport Layer Data ESP + + +Encrypted Payload + + +IPSec Tunnel Mode IP ESP IP GRE Header Network Layer Transport Layer Data ESP + +Figure 12-14 IPsec Modes + +Benefits of using GRE and IPsec for site-to-site VPNs include the following: Key +Topic ■ In addition to supporting IPv4 as the passenger protocol, it provides support for +other Layer 3 protocols. + +■ It provides support for multicast and routing traffic across the IPsec VPN. + +■ With a hub-and-spoke topology, it reduces the management overhead needed to maintain IPsec tunnels because a minimum number of tunnels is used to provide full connectivity. + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 459 + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 12-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 12-3 Key Topics for Chapter 12 Key +Topic Key Topic Element Description Page Number + + +List + +List + +Example 12-1 + +Example 12-4 + +Example 12-7 + +Example 12-8 + +Table 12-2 + +Example 12-11 + +Paragraph + +Section + +Section + +Example 12-39 + +Paragraph + +List + +Describes the routing table and Layer 3 to Layer 2 430 mapping table +Describes the FIB and adjacency table 431 + +show ip route ip_address command output 432 + +show ip cef ip_address command output 433 + +show ip arp command output 433 + +show frame-relay map command output 434 + +Administrative distance of route sources 437 + +Verifying the administrative distance of a route in 438 the routing table +Outlines the importance of the next-hop address in 440 an IPv4 static route +Describes what occurs when an Ethernet interface is 441 used in an IPv4 static route +Describes what occurs when an Ethernet interface is 445 used in an IPv6 static route +Verifying tunnel addresses, mode, and MTU 455 + +Describes the difference between IPsec tunnel mode 457 and transport mode +Identifies the benefits of using GRE and IPsec for 458 site-to-site VPNs + + + + + + + + +From the Library of Outcast Outcast +460 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +packet forwarding, ARP, TTL, routing table, ARP cache, CEF, FIB, adjacency table, control plane, data plane, administrative distance, static route, proxy ARP, GRE tun-nel + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + +Command Reference to Check Your Memory + +This section includes the most important show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 12-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to verify and troubleshoot the topics covered in this chapter. + +Table 12-4 show Commands + +Task Command Syntax + +Displays a router’s best route to the specified IP address. +Displays only the static routes in a routers routing table. +Displays a router’s best route to the specified network if the specific route (with a matching subnet mask length) is found in the router’s IP routing table. +Displays all routes in a router’s IP routing table that are encompassed by the specified network address and subnet mask. (This command often proves useful when troubleshooting route summarization issues.) + + +show ip route ip_address + +show ip route static + +show ip route ip_address subnet_ mask + +show ip route ip_address subnet_ mask longer- prefixes + + + + + + + + +From the Library of Outcast Outcast +Chapter 12: Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels 461 + + + +Task +Displays information (for example, next-hop IP address and egress interface) required to forward a packet, similar to the output of the show ip route ip_address command. (The output of this command comes from CEF. Therefore, routing protocol information is not presented in the output.) +Displays information from a router’s FIB showing the information needed to route a packet to the specified network with the specified subnet mask. +Displays the adjacency that will be used to forward a packet from the specified source IP address to the specified destination IP address. (This command is useful if the router is load balancing across multiple adjacencies and you want to see which adjacency will be used for a certain combination of source and destination IP addresses.) +Displays the static IPv6 routes configured on a device. + +Displays the Layer 3 IPv6 address to Layer 2 MAC address mappings. +Displays a router’s ARP cache, containing IPv4 address to MAC address mappings. + +Command Syntax +show ip cef ip_address + + + + + +show ip cef ip_address subnet_ mask + +show ip cef exact-route source_ address destination_address + + + + + +show ipv6 route static + +show ipv6 neighbors + +show ip arp + +Displays Frame Relay PVC DLCIs associated with next- show frame-relay map hop IP addresses. +Displays the Layer 2 frame header information in a show adjacency detail router’s CEF adjacency table that is used to encapsulate +a frame being sent to an adjacent router. + + +Displays whether Proxy ARP is enabled on an interface as well as the IPv4 address and mask assigned to the interface. +Displays the configuration of a tunnel interface in the running configuration. + +Displays the status of a tunnel, the IP address of the tunnel, the tunnel source and destination, along with the tunnel mode and the tunnel transport MTU. + +show ip interface interface_type interface_number + +show run interface tunnel tunnel_ number + +show interfaces tunnel tunnel_ number + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting RIPv2: This section covers the dif-ferent issues that could cause routes to be missing in RIPv2 domains. You will also learn the different commands that you can use to identify and trouble-shoot these issues. + +■ Troubleshooting RIPng: This section explains the different commands that you can use to identify and troubleshoot issues related to RIPng. + +■ RIPv2 and RIPng Troubleshooting: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 13 + + + + + + +Troubleshooting RIPv2 and RIPng + + +Routing Information Protocol (RIP) is one of the oldest dynamic routing protocols. It is a distance vector routing protocol that relies on hop count as the routing metric. It is not scalable like Enhanced Interior Gateway Routing Protocol (EIGRP) and Open Shortest Path First (OSPF), and it takes a considerable amount of time to fully converge after +a topology change. Therefore, if used, it is used in small and simple routed networks. RIPv2 is designed for IPv4 routed networks, and RIP next generation (RIPng) is designed for IPv6 routed networks. + +This chapter focuses on the issues you may have to troubleshoot in a RIPv2 and RIPng domain. This includes how you would recognize the issues based on the presented symp-toms and the commands you would use to successfully verify the reason why the issue exists. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 13-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 13-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting RIPv2 + +Troubleshooting RIPng + +Questions +1–5, 10 + +6–10 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + + + + +From the Library of Outcast Outcast +464 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +1. Which command enables you to verify all RIPv2 routes learned from directly con-nected devices? + +a. show ip route + +b. show ip route rip + +c. show ip protocols + +d. show ip rip database + +2. Which command enables you to verify the interfaces that are sending and receiving RIPv2 routing updates? + +a. show ip route + +b. show ip route rip + +c. show ip protocols + +d. show ip rip database + +3. Which command will enable the RIPv2 routing process on the interface with an IP address of 10.1.1.7/28? + +a. network 10.0.0.0 + +b. network 10.1.1.7 0.0.0.0 + +c. ip rip enable + +d. ip ripv2 enable + +4. What occurs when you configure a passive interface with RIPv2? (Choose two answers.) + +a. The interface will send RIP updates. + +b. The interface will receive RIP updates. + +c. The interface will suppress the sending of RIP updates. + +d. The interface will suppress the receiving of RIP updates. + +5. What is the maximum hop count for RIPv2? + +a. 5 + +b. 10 + +c. 15 + +d. 16 + + + + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 465 + +6. Which command enables you to verify all RIPng routes learned from directly con-nected devices? + +a. show ipv6 rip + +b. show ipv6 route rip + +c. show ipv6 protocols + +d. show ipv6 rip database + +7. Which commands enable you to verify the interfaces that are participating in the RIPng routing process? (Choose two answers.) + +a. show ipv6 rip + +b. show ipv6 route rip + +c. show ipv6 protocols + +d. show ipv6 rip database + +8. Which command enables you to verify the number of paths that will be used by RIPng for load balancing? + +a. show ipv6 rip + +b. show ipv6 route rip + +c. show ipv6 protocols + +d. show ipv6 rip database + +9. Which command enables you to verify whether default routes are being generated by RIPng? + +a. show ipv6 rip + +b. show ipv6 route rip + +c. show ipv6 protocols + +d. show ipv6 rip database + +10. Which of the following are reasons why a RIP route may be missing from a router running RIPv2 or RIPng? (Choose three answers.) + +a. Bad or missing network statement + +b. Max hop count exceeded + +c. ACLs + +d. Neighbor relationship not formed + + + + + + + +From the Library of Outcast Outcast +466 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting RIPv2 + +Routing Information Protocol Version 2 (RIPv2) does not establish neighbor adjacencies; therefore, you will not have to troubleshoot neighbor-related issues like you do with Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), and Border Gateway Protocol (BGP). However, with RIPv2, you will be troubleshooting issues related to routing updates. This section covers the reasons why a RIPv2 router may not be receiving the routes that you expect it to receive. + +Missing RIPv2 Routes + +A RIPv2 route may be missing from the RIP database or the routing table for many rea-sons. As a troubleshooter, it is important that you can recognize the reasons why routes are missing and resolve the issue quickly and efficiently. + +Following is a listing of reasons as to why RIPv2 routes might be missing either in the RIP database or the routing table: + + +■ +Key Topic + +■ + + +■ + + +■ + +■ + + +■ + + +■ + + +■ + + +■ + + +■ + +Interface is shut down: The RIP-enabled interface must be up/up for the network associated with the interface to be advertised. + +Wrong subnet: The sender of RIP updates must be in the same subnet as the receiver of RIP updates; otherwise, updates are ignored. + +Bad or missing network statement: The network command enables the RIP process on an interface and injects the network the interface is part of into the RIP process. + +Passive interface: Suppresses the sending of RIP updates out an interface. + +Wrong version: The sender of RIP updates must be using the same RIP version as the receiver of RIP updates. + +Max hop count exceeded: When the maximum hop count is exceeded, the route is unreachable and not used. + +Authentication: If authentication parameters do not match, routing updates are ignored. + +Route filtering: A filter might be set up that is preventing a route from being adver-tised or learned. + +Split horizon: Loop-prevention feature that prevents a router from advertising routes out the same interface they were learned on. + +Autosummarization: Summarizes classless networks at classful boundaries, which is +problematic in discontiguous networks. + + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 467 + +■ Better source of information: If the exact same network is learned from a more reli-able source (as determined by the administrative distance), it is used instead of the RIP-learned information. + +■ ACLs: If an access control list (ACL) is denying RIP packets in an interface, routes will not be learned. + +■ Load balancing: If the maximum paths value is incorrectly set, equal metric paths for certain routes will be missing from the routing table. + + + +Key Topic + +To verify all routes that have been learned from neighboring routers and the directly con-nected routes that have been injected into the RIP process, use the show ip rip database command. This command displays the RIP database, as shown in Example 13-1. In this example, you can see two directly connected networks (10.1.1.0/24 and 10.1.12.0/24) that have been injected into the RIP process and two networks (10.1.3.0/24 and 10.1.23.0/24) that have been learned from the neighbor with an IP address of 10.1.12.2, which is also the next hop to reach those networks. The 10.1.3.0/24 network has a hop count of 2, and the 10.1.23.0/24 network has a hop count of 1. Remember that autosummarization is on by default with RIP; as a result, the router will automatically create a classful summary +route, as seen with the 10.0.0.0/8 network. + + +Example 13-1 Viewing the RIP Database with the show ip rip database Command + +R1#show ip rip database + +10.0.0.0/8 +10.1.1.0/24 +10.1.3.0/24 + +auto-summary +directly connected, GigabitEthernet0/0 + +[2] via 10.1.12.2, 00:00:03, GigabitEthernet1/0 +10.1.12.0/24 directly connected, GigabitEthernet1/0 +10.1.23.0/24 +[1] via 10.1.12.2, 00:00:03, GigabitEthernet1/0 + +To verify the RIP routes that have been installed in the routing table, use the show ip route rip command, as shown in Example 13-2. In this example, there are two RIP routes with a next-hop address of 10.1.12.2. Because they are learned via RIP, they have an administrative distance (AD) of 120 by default. The metric (hop count) for 10.1.3.0/24 is 2, as shown in the brackets, and 1 for 10.1.23.0/24. + +Example 13-2 Viewing the RIP Installed Routes in the Routing Table with the show ip Topic route rip Command +Key +R1#show ip route rip +Codes: L - local, C - connected, S - static, R - RIP , M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + + + + +From the Library of Outcast Outcast +468 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +R 10.1.3.0/24 [120/2] via 10.1.12.2, 00:00:06, GigabitEthernet1/0 +R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:06, GigabitEthernet1/0 + + + +Key Topic + +To verify various RIP parameters and settings, use the show ip protocols command, as shown in Example 13-3. With show ip protocols, you can verify route filters that have been applied, timers, redistribution, which versions of RIP are being sent and received, the status of automatic summarization, maximum paths for load balancing, the address that was used for the network command, any passive interfaces, who the router has learned routes from, and finally, the AD. You will examine most of these as we go +through examples. + + +Example 13-3 Viewing RIP Settings with the show ip protocols Command + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 21 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet1/0 + +Send Recv Triggered RIP Key-chain +2 2 + +Automatic network summarization is not in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Passive Interface(s): +Ethernet0/0 +GigabitEthernet0/0 +GigabitEthernet2/0 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +120 + +Last Update +00:00:14 + +Distance: (default is 120) + +Let’s examine each of the issues previously listed on an individual basis and identify how we can troubleshoot them. + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 469 + +Interface Is Shut Down + +For an interface to participate in the RIP routing process, it must be up/up. You can verify the status of an interface with the show ip interface brief command, as shown in Example 13-4. + +Example 13-4 Verifying the Status of an Interface + +R1#show ip interface brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES NVRAM administratively down down + +GigabitEthernet0/0 +GigabitEthernet1/0 +GigabitEthernet2/0 + +10.1.1.1 +10.1.12.1 +unassigned + +YES NVRAM up up +YES NVRAM up up +YES NVRAM up up + + + +Wrong Subnet + +RIP routers exchanging RIP updates must be in the same subnet. If they are not, they will ignore the RIP updates that they receive from each other. See Figure 13-1, which displays a sample RIP domain where the link between R1 and R2 is not addressed properly. Notice that R1’s interface connected to R2 is in the 10.1.10.0/24 network and the interface on +R2 connected to R1 is in the 10.1.12.0/24 network. When either R1 or R2 receive a RIP update from each other, they will ignore it, as shown in Example 13-5, which displays the output of debug ip rip on R1. + + +10.1.1.0/24 + +R1 + + +10.1.12.0/24 +10.1.10.0/24 R2 10.1.23.0/24 + +10.1.3.0/24 + +R3 + + +Figure 13-1 Example of Wrong Addressing Between R1 and R2 + +Example 13-5 Output of debug ip rip on R1 + +R1#debug ip rip +RIP protocol debugging is on +R1# +RIP: ignored v2 update from bad source 10.1.12.2 on GigabitEthernet1/0 + +As a result, both the IP address and the subnet mask assigned to an interface must be cor-rect. In this case, the link between R1 and R2 is the 10.1.12.0/24 network. Reviewing the output of show ip interface gigabitethernet1/0 on R1 in Example 13-6 reveals that it is configured with a 10.1.10.1/24 address and mask. Therefore, it would have to be changed so that the address is 10.1.12.1/24 by using the interface command ip address 10.1.12.1 255.255.255.0. + + + + + + + +From the Library of Outcast Outcast +470 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-6 Output of show ip interface on R1 + +R1#show ip interface gigabitethernet1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet address is 10.1.10.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.9 +...output omitted... + + +Bad or Missing Network Statement + + + + + + + + + +Key Topic + +The RIP process is enabled on interfaces using the classful network command in router RIP configuration mode. Once an interface is enabled for RIP, the network the interface is part of will be injected into the RIP routing process and advertised to directly connected routers out RIP-enabled interfaces. If the network command is missing, or is incorrect, the RIP process will not be enabled on the interface, and routes will be missing in the RIP domain. + +To verify the interfaces enabled for RIP, use the show ip protocols command, as shown in Example 13-7. In this example, interfaces Gigabit Ethernet 0/0 and Gigabit Ethernet 1/0 are participating in the RIP routing process. In addition, you will notice the Routing for Networks: area that indicates 10.0.0.0. This is really the network command that was used to enable the RIP routing process on the interfaces. It states that the RIP routing process will be enabled on any interface that has a first octet with 10 in it. Reviewing the running configuration with the command show run | section rip, as shown in Example 13-8, con-firms the network command is network 10.0.0.0. Using the command show ip interface brief, as shown in Example 13-9, indicates that Gigabit Ethernet 0/0 and Gigabit Ethernet 1/0 both have an IP address that begin with a 10 in the first octet and therefore will par- +ticipate in the RIP routing process. + + +Example 13-7 Verifying Interfaces Participating in the RIP Process With show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 28 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 +Interface Send Recv Triggered RIP Key-chain + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 471 + +GigabitEthernet0/0 2 2 +GigabitEthernet1/0 2 2 +Automatic network summarization is not in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Routing Information Sources: +Gateway Distance Last Update +Distance: (default is 120) + + +Example 13-8 Verifying RIP Configurations in the Running Configuration + +R1#show run | section router rip +router rip +version 2 +network 10.0.0.0 +no auto-summary + + +Example 13-9 Verifying Interface IP Addresses + +R1#show ip interface brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES NVRAM administratively down down + +GigabitEthernet0/0 +GigabitEthernet1/0 +GigabitEthernet2/0 + +10.1.1.1 +10.1.12.1 +unassigned + +YES NVRAM up up +YES NVRAM up up +YES NVRAM up up + + + +Passive Interface + +The passive interface feature is a must have for all routing domains. It does two things: reduces the RIP related traffic on a LAN, and improves RIP security. + +The passive interface feature for RIP will disable the sending of RIP updates out of the interface that is passive. Therefore, it eliminates the RIP-related traffic on the LAN leaving the router interface. This slightly improves the security of RIP because the router is not advertising RIP information out an interface that could be captured by a malicious user. However, the interface will still receive RIP updates and use them; as a result, it is pos-sible for rogue RIP routes to be introduced into the RIP domain. Remember that when an interface is passive, the network/subnet the interface is part of will still be injected into the RIP routing process and advertised to other RIP routers. + +Consider Figure 13-2, where Gigabit Ethernet 1/0 of R1 has been configured as a passive interface. In this case, R1 will not send RIP updates out Gig1/0 to R2; however, it will still receive RIP updates from R2. Therefore, R1 will know how to get to the 10.1.3.0/24 network, but R2 and R3 will not know how to reach the 10.1.1.0/24 network. Therefore, end-to-end routing is broken in this RIP domain because the passive interface feature was enabled on the wrong interface. + + + +From the Library of Outcast Outcast +472 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Passive Interface +10.1.1.0/24 10.1.3.0/24 Gi1/0 Gi0/0 +R1 10.1.12.0/24 R2 10.1.23.0/24 R3 Gi0/0 + +Figure 13-2 Example of Passive Interface Configured on Wrong Interface + +Example 13-10 displays the output of show ip route on R1 and R2. Notice how R2 lacks the route 10.1.1.0/24 but R1 knows about 10.1.3.0/24 and 10.1.23.0/24. + +Example 13-10 Verifying RIP Routes on R1 and R2 + +R1#show ip route +...output omitted +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +R 10.1.3.0/24 [120/2] via 10.1.12.2, 00:00:04, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:04, GigabitEthernet1/0 + +R2#show ip route +...output omitted... +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks +R 10.1.3.0/24 [120/1] via 10.1.23.3, 00:00:04, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 + +To verify whether there are any passive interfaces configured, you use show ip protocols, as shown in Example 13-11. In this case, Gigabit Ethernet 1/0 is a passive interface when it should not be. + +Key Example 13-11 Verifying RIP Passive Interfaces with show ip protocols Topic R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 6 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 +Interface Send Recv Triggered RIP Key-chain + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 473 + +GigabitEthernet0/0 2 2 +Automatic network summarization is not in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Passive Interface(s): +GigabitEthernet1/0 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +120 + +Last Update +00:00:07 + +Distance: (default is 120) + + +Wrong Version + +By default, RIPv1 is enabled when you start the RIP routing process with the router rip global configuration command. To enable RIPv2, you issue the version 2 command in router RIP configuration mode. If directly connected routers are not using the same ver-sion, they will not share routing information. See Figure 13-3, which shows that R1 is using RIPv1 and R2 is using RIPv2. + +10.1.1.0/24 10.1.3.0/24 Gi1/0 Gi0/0 + +R1 +Gi0/0 RIPv1 + +10.1.12.0/24 R2 10.1.23.0/24 R3 +RIPv2 + + +Figure 13-3 Example of Routers Using Incorrect RIP Versions + +Example 13-12 displays the output of debug ip RIP on R1 and R2. Notice that they ignore the RIP routing updates from each other as they are “illegal version.” As a result, R1 in this case will not learn any RIP routes and will only have directly connected routes in the routing table. R2 will not learn any RIP routes from R1 either. + +Example 13-12 Using debug ip rip to Determine Why Routes Are Not Received + +R1#debug ip rip +RIP: ignored v2 packet from 10.1.12.2 (illegal version) +R1#u all + +R2#debug ip rip +RIP: ignored v1 packet from 10.1.12.1 (illegal version) +R2#u all + +You can verify which version of RIP is being used on a router with the show ip protocols command. As shown in Example 13-13, RIPv1 is being used for both sent updates and received updates on R1, and RIPv2 is being used for both sent and received updates on R2. + + + + + +From the Library of Outcast Outcast +474 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-13 Verifying the Version of RIP Being Used + +R1#show ip protocols +...output omitted... +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 1, receive version 1 + +Interface +GigabitEthernet0/0 +GigabitEthernet1/0 + +Send Recv Triggered RIP Key-chain +1 1 +1 1 + +Automatic network summarization is not in effect +...output omitted... + +R2#show ip protocols +...output omitted... +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet0/0 +GigabitEthernet1/0 + +Send Recv Triggered RIP Key-chain +2 2 +2 2 + +Automatic network summarization is not in effect +...output omitted... + +Note that with RIP you can control on an interface-by-interface basis with the ip rip send version and ip rip receive version commands which version of RIP is used to send and receive updates, regardless of the version specified in router RIP configuration mode. Therefore, it is possible to have version 1 running but send v2 updates out an interface, or version 2 running and have v1 updates sent out an interface, as shown in Example 13-14. Notice that version 2 is running but Gigabit Ethernet 0/0 is using version 1 for sending and receiving updates, which in this case would align with R1 using version 1 and routes being exchanged successfully. + +Example 13-14 Controlling RIP Version on an Interface Basis + +R2#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 13 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet0/0 + +Send Recv Triggered RIP Key-chain +1 1 + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 475 + +GigabitEthernet1/0 2 2 +Automatic network summarization is in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Routing Information Sources: + +Gateway +10.1.12.1 +10.1.23.3 + +Distance +120 +120 + +Last Update +00:00:26 +00:00:12 + +Distance: (default is 120) + +Therefore, it is important to check the version being used on the router as a whole as well as the interfaces when troubleshooting RIP related issues. + +Max Hop Count Exceeded + +RIP has a maximum hop count of 15. Any routes that are 16 hops or further are considered unreachable. Therefore, they will not be installed in the routing table or shared with neigh-boring routers. Here is a listing of reasons as to why the max hop count may be exceeded: + + +■ +Key Topic + + + +■ + + + + + +■ + +The physical topology is too large: If there are too many physical routers (15 or more) from the local router to the destination network, the hop count will be +exceeded. You will need to review your network topologies and consult your docu-mentation to verify this. + +The seed metric during redistribution was set to high: When routes are redistrib-uted into RIP, you must manually set a seed metric. If you set it too high, it is pos-sible that the route will not get advertised to the furthest RIP routers in the domain because the max hop count is reached before the routers can learn about the redis-tributed route. RIP redistribution is covered in a later chapter. + +There is an offset list applied: You can use an offset list to manipulate the metric of RIP routes by adding hops before the route is advertised or once it is received. If the offset is set to high, it is possible that the route will not get advertised to the +furthest RIP routers in the domain because the max hop count is reached before the +routers can learn about the route. + + +You can verify whether an offset list is applied using show ip protocols, as shown in Example 13-15. In this example, it states that routes received inbound on Gigabit +Ethernet 1/0 that match ACL 1 will have 14 hops added to their metric. ACL 1 is shown in Example 13-16 with the show ip access-list 1 command. It matches routes that have an address of 10.1.3.0. + +Example 13-15 Verifying Applied Offset Lists + +R2#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" + + + +From the Library of Outcast Outcast +476 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Incoming routes in GigabitEthernet1/0 will have 14 added to metric if on list 1 +Sending updates every 30 seconds, next due in 11 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet0/0 +GigabitEthernet1/0 + +Send Recv Triggered RIP Key-chain +2 2 +2 2 + +Automatic network summarization is in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Routing Information Sources: + +Gateway +10.1.12.1 +10.1.23.3 + +Distance +120 +120 + +Last Update +00:00:02 +00:00:07 + +Distance: (default is 120) + + +Example 13-16 Verifying Access List 1 on R2 + +R2#show ip access-list 1 +Standard IP access list 1 +10 permit 10.1.3.0 (14 matches) + +Reviewing the output of show ip route on R2 indicates that 10.1.3.0/24 is now 15 hops away, as shown in Example 13-17. + +Example 13-17 Verifying RIP Metric for the 10.1.3.0/24 Route + +R2#show ip route +...output omitted... +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +R 10.1.1.0/24 [120/1] via 10.1.12.1, 00:00:08, GigabitEthernet0/0 +R 10.1.3.0/24 [120/15] via 10.1.23.3, 00:00:28, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 + +Now take a look at the debug ip rip output on R1 in Example 13-18. Notice that when R1 receives the RIP update from R2, 10.1.3.0/24 is 16 hops away (inaccessible). Therefore, it will not be installed in R1’s routing table. Because it is not installed in R1’s routing table, it will not be advertised out any other RIP-enabled interfaces. You can verify this in the same debug output. When the RIP update is sent out Gigabit Ethernet 0/0, the 10.1.3.0/24 network is missing. + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 477 + +Example 13-18 Reviewing debug ip rip Output on R1 + +R1#debug ip rip +RIP protocol debugging is on +RIP: received v2 update from 10.1.12.2 on GigabitEthernet1/0 +10.1.3.0/24 via 0.0.0.0 in 16 hops (inaccessible) +10.1.23.0/24 via 0.0.0.0 in 1 hops +R1# +RIP: sending v2 update to 224.0.0.9 via GigabitEthernet0/0 (10.1.1.1) +RIP: build update entries +10.1.12.0/24 via 0.0.0.0, metric 1, tag 0 +10.1.23.0/24 via 0.0.0.0, metric 2, tag 0 + + +Authentication + +When authentication is configured on a RIP-enabled interface, it will only accept RIP updates that pass authentication, which improves security. As shown in the debug ip rip output of Example 13-19, R1 is ignoring the update from 10.1.12.2 because of invalid authentication. + +Example 13-19 Ignored Update Due to Invalid Authentication + +R1#debug ip rip +RIP protocol debugging is on +RIP: ignored v2 packet from 10.1.12.2 (invalid authentication) + +When troubleshooting authentication, you need to consider all three of the following: + +■ Key chain configuration + +■ Key chain association + +■ Authentication Mode + +RIP uses key chains for authentication; therefore, you need to be able to troubleshoot key chain configurations when troubleshooting RIP authentication. Example 13-20 dis-plays the output of show key chain on R1. The key chain in this example is called RIP, it has 1 key with an ID of 1, and the key sting (text) is TSHOOT. For RIP authentication to be successful, the key ID and the key string have to match between the router interface sending the updates and the router interface receiving the updates. However, the name of the key chain does not have to match. In addition, notice the accept and send lifetime. These are used to specify when the key will be used when sending updates and when +the key will be used for received updates. By default, they are always valid (never expire). However, you can modify the lifetimes to control when keys will be used. This is impor-tant if you specify multiple keys for key rotation to enhance security. + + + + + + + +From the Library of Outcast Outcast +478 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-20 Verifying Key Chain + +R1#show key chain +Key-chain RIP: +key 1 -- text "TSHOOT" +accept lifetime (always valid) - (always valid) [valid now] +send lifetime (always valid) - (always valid) [valid now] + +To assign a key chain to an interface using RIP, you use the ip rip authentication key-chain key_chain command in interface configuration mode. To specify the mode, you type ip rip authentication mode [text|md5]. It is imperative that neighboring RIP routers are using the same keys and the same mode. Example 13-21 displays the output of show ip protocols. You can see that Gigabit Ethernet 1/0 is configured to use the key chain named RIP. Remember that the key chain name does not have to match between the directly connected RIP routers. Therefore, once you determine the key chain applied to the interface, you would have to execute the show key chain command, as shown before in Example 13-20, to review the key ID, key string, and the validity of the keys to make sure that they match. + +Example 13-21 Verifying RIP Authentication + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 15 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet1/0 + +Send Recv +2 2 + +Triggered RIP Key-chain +RIP + +Automatic network summarization is not in effect +Maximum path: 4 +...output omitted... + +So far, you have verified which key chain is applied and the settings of the key chain. However, you have yet to confirm the mode of authentication that is being used. RIP sup-ports message digest 5 (MD5) authentication and simple password authentication. You are encouraged to use MD5 authentication and avoid simple password authentication in the real world. Regardless of what you use, to verify the mode you need to review the interface configuration in the running config using the show run interface interface_type interface_number command. As shown in Example 13-22, R1 is using MD5 authentica-tion. + + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 479 + +Example 13-22 Verifying RIP Authentication Mode + +R1#show run interface gigabitethernet1/0 +Building configuration... + +Current configuration : 193 bytes +! +interface GigabitEthernet1/0 +ip address 10.1.12.1 255.255.255.0 +ip rip authentication mode md5 +ip rip authentication key-chain RIP +negotiation auto +ipv6 address 2001:DB8:0:12::1/64 +end + +The best approach when troubleshooting authentication is to compare the authentication configurations of the two devices in question and spot the difference. + +Route Filtering + +A distribute list applied to the RIP process controls which routes are advertised to neigh-bors or which routes are received from neighbors. The distribute list is applied in RIP configuration mode either inbound or outbound, and the routes sent or received are con-trolled by ACLs, prefix lists, or route maps, as specified by the distribute list. So, when troubleshooting route filtering, you need to consider the following: + +■ Is the distribute list applied in the correct direction? Key +Topic ■ Is the distribute list applied to the correct interface? + +■ If the distribute list is using an ACL, is the ACL correct? + +■ If the distribute list is using a prefix list, is the prefix list correct? + +■ If the distribute list is using a route map, is the route map correct? + +The show ip protocols command identifies whether a distribute list is applied to all inter-faces or an individual interface, as shown in Example 13-23. This example indicates that there are no outbound filters and that there is an inbound filter on Gig 1/0. + +Example 13-23 Verifying Route Filters with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +GigabitEthernet1/0 filtered by (prefix-list) TSHOOT_RIP (per-user), default is not set + + + +From the Library of Outcast Outcast +480 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Sending updates every 30 seconds, next due in 17 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet1/0 +...output omitted... + +Send Recv Triggered RIP +2 2 + +Key-chain +RIP + + +The inbound filter in Example 13-23 on Gig 1/0 is filtered by prefix list TSHOOT_RIP. To verify entries in the prefix list, you would need to issue the show ip prefix-list TSHOOT_RIP command. To verify entries in an ACL, you would need to issue the show access-lists [access_list_number | access_list_name] command. If a route map was applied, you would issue the show route-map [map_name] command. + +As displayed in Example 13-24, you can verify the command that was used to apply the distribute list in the running configuration. + +Example 13-24 Verifying the RIP Distribute List Command + +R1#show run | section router rip +router rip +version 2 +passive-interface default +no passive-interface GigabitEthernet1/0 +network 10.0.0.0 +distribute-list prefix TSHOOT_RIP in GigabitEthernet1/0 +no auto-summary + + + + + +Key Topic + +Split Horizon + +The RIP split-horizon rule states that any routes learned inbound on an interface will not be advertised out the same interface. This rule is designed to prevent routing loops. Refer to the debug ip rip output in Example 13-25, which shows how R1 only sends the 10.1.1.0/24 network to R2 and not 10.1.3.0/24, 10.1.23.0/24, or 10.1.12.0/24 as shown in +Figure 13-4. + + +Example 13-25 Verifying Advertised Routes + +R1#debug ip rip +RIP: sending v2 update to 224.0.0.9 via GigabitEthernet1/0 (10.1.12.1) +RIP: build update entries +10.1.1.0/24 via 0.0.0.0, metric 1, tag 0 +R1# + + + + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 481 + +10.1.1.0/24 10.1.3.0/24 Gi1/0 Gi0/0 + +R1 +Gi0/0 + +10.1.12.0/24 R2 10.1.23.0/24 R3 + + + +10.1.1.0/24 +10.1.12.0/24 +10.1.23.0/24 +10.1.3.0/24 + +Figure 13-4 + + + +Split Horizon Rule + + + +Sample Topology for Split-Horizon Rule + + +You can verify whether split horizon is enabled on an interface with the show ip interface interface_type interface_number command, as shown in Example 13-26. + +Example 13-26 Verifying That Split Horizon Is Enabled + +R1#show ip interface gigabitethernet1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet address is 10.1.12.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.9 +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are always sent +ICMP unreachables are always sent +ICMP mask replies are never sent + +The split-horizon rule becomes an issue in multiaccess hub-and-spoke topologies such as Frame Relay. Figure 13-5 depicts such a network. In this case, when R2 sends a RIP update about 10.1.2.0/24 to R1, R1 will not send the 10.1.2.0/24 network in its routing update out Serial 1/0 because of the split-horizon rule. Therefore, R3 never learns about 10.1.2.0/24. The same will be true about R3’s update about 10.1.3.0/24. R1 will not send 10.1.3.0/24 in the update out Serial 1/0 because of the split-horizon rule, and as a result R2 will not learn about the 10.1.3.0/24 network. You have to be able to recognize this issue based on the topology and disable the split-horizon rule for RIP on the hub rout-ers’ multiaccess interface with the no ip split-horizon interface configuration command so that the routing updates can be sent back out the same physical interface they were received on. Your other option is to use point-to-point subinterfaces. + + + + +From the Library of Outcast Outcast +482 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +R4 + +RIP Update about 10.1.2.0/24 + + + + + +R1 Se1/0 192.168.1.0/24 + + + +Hub and Spoke Frame Relay + +R2 +10.1.2.0/24 +PVC +10.1.3.0/24 + + + +Split Horizon: Do not send update about 10.1.2.0/24 + + +R3 +I have no route for 10.1.2.0/24 + + +Figure 13-5 Split-Horizon in Hub-and-Spoke Multiaccess Topology + +Autosummarization +RIP performs summarization automatically when it sends updates out interfaces that are part of a different classful network than the route it is advertising. This is an issue in RIP domains that have discontiguous networks. Figure 13-6 provides an example of a discon-tiguous network. The 172.16.0.0/16 Class B classful network is considered discontigu-ous because its subnets, 172.16.1.0/24 and 172.16.2.0/24, are separated from each other by another network, which is the Class A 10.0.0.0 network in this case. With automatic summarization turned on, when R3 advertises the 172.16.2.0/24 network to R2, it is sum-marized to 172.16.0.0/16 because it is being sent out an interface in a different network than 172.16.0.0. So, instead of 172.16.2.0/24 being sent, 172.16.0.0/16 is sent, as shown +in the debug ip rip output of Example 13-27. Likewise, the same thing happens when R1 advertises the 172.16.1.0/24 network to R2; it is advertised as 172.16.0.0/16. If you were to review R2’s routing table, it would show an entry for 172.16.0.0 with two next hops (if everything else is equal), one via R3 using Fa0/1 and the other via R1 using Fa0/0. + +Now picture a packet arriving at R2 from R4 with a destination IP of 172.16.2.5. Which way does R2 send it? You see the problem? It should send it out Fa0/1, but it could send it out Fa0/0. There is a 50/50 chance that it gets it correct. The moral of this story is this: If you have a discontiguous network, autosummarization has to be off with the no auto-summary command in router RIP configuration mode, and you must take care when per-forming manual summarization. To verify whether automatic summarization is enabled or disabled, use the show ip protocols command, as displayed in Example 13-27. + + +R4 + + + + +172.16.1.0/24 +R1 + +10.1.1.0/24 +Fa0/0 + +10.1.2.0/24 +R2 Fa0/1 + + +172.16.2.0/24 R3 + + + +172.16.0.0/16 instead of 172.16.1.0/24 + + +Routing Table 172.16.0.0/24 via Fa0/0 via Fa0/1 + +172.16.0.0/16 instead of 172.16.2.0/24 + + +Figure 13-6 Discontiguous Network Example + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 483 + +Example 13-27 Verifying Automatic Summarization + +R3#debug ip rip +RIP protocol debugging is on +R3# +RIP: sending v2 update to 224.0.0.9 via FastEthernet0/1 (10.1.2.3) +RIP: build update entries +172.16.0.0/16 via 0.0.0.0, metric 1, tag 0 +R3#u all +All possible debugging has been turned off +R3#show ip protocols +...output omitted... +GigabitEthernet0/0 2 2 +GigabitEthernet1/0 2 2 +Automatic network summarization is in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Routing Information Sources: + +Gateway +10.1.23.2 + +Distance +120 + +Last Update +00:00:12 + +Distance: (default is 120) + + +Better Source of Information + +For a RIP-learned route to be installed in the routing table, it has to be the most believ-able routing source. Recall that this is based on AD. RIP’s default AD is 120. Therefore, if there is another source that is educating the same router about the exact same network and that source has a better AD, the source with the better AD wins, and its information +will be installed in the routing table. Review Example 13-28, which is the RIP database on R2, and Example 13-29, which is the routing table of R2 displaying only the RIP installed routes on the router. Notice that there is no entry for 10.1.3.0/24, although there should be according to Figure 13-7. Also, Example 13-30 displays the debug ip rip output on R2 that clearly shows R2 is learning it from R3. + +Example 13-28 Sample show ip rip database Command Output + +R2#show ip rip database +10.0.0.0/8 auto-summary +10.1.1.0/24 +[1] via 10.1.12.1, 00:00:15, GigabitEthernet0/0 + +10.1.12.0/24 +10.1.23.0/24 + +directly connected, GigabitEthernet0/0 +directly connected, GigabitEthernet1/0 + + + + + + + + +From the Library of Outcast Outcast +484 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-29 Sample show ip route rip Command Output + +R2#show ip route rip +...output omitted... +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +R 10.1.1.0/24 [120/1] via 10.1.12.1, 00:00:11, GigabitEthernet0/0 + +Example 13-30 Sample debug ip rip Command Output + +R2#debug ip rip +RIP protocol debugging is on +R3# +RIP: received v2 update from 10.1.23.3 on GigabitEthernet1/0 +10.1.3.0/24 via 0.0.0.0 in 1 hops +R3#u all +All possible debugging has been turned off + + +10.1.1.0/24 + +Gi0/0 R1 + + +Gi1/0 Gi0/0 +10.1.12.0/24 + + +Gi1/0 Gi1/0 +R2 10.1.23.0/24 + +10.1.3.0/24 + +R3 Gi0/0 + + +Figure 13-7 Sample RIP topology + +On R2, you issue the show ip route 10.1.3.0 command, as shown in Example 13-31. The output displays that the route is learned via a static route with an AD of 1. Therefore, it is more believable than the RIP-learned route from R3 and the reason why it is not in the table as a RIP learned route. + +Example 13-31 Verifying the Source of 10.1.3.0 Route + +R2#show ip route 10.1.3.0 +Routing entry for 10.1.3.0/24 +Known via "static", distance 1, metric 0 +Routing Descriptor Blocks: +* 10.1.23.3 +Route metric is 0, traffic share count is 1 + +So, what is the issue? Because 10.1.3.0 is not being used by R2 as a RIP-learned route, it will not advertise it to R1. Therefore, R1 will not know how to reach 10.1.3.0/24. Examining R1’s routing table in Example 13-32 confirms this for us. + +Example 13-32 Verifying R1’s Routing Table + +R2#show ip route +...output omitted... +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 485 + + + + +Key Topic + +ACLs + +RIP uses destination UDP port 520 for communication and the destination multicast address 224.0.0.9. Therefore, if there is an ACL filtering traffic in an interface and it is not permitting User Datagram Protocol (UDP) port 520 traffic or the multicast address 224.0.0.9, RIP routing updates will be denied in the interface. Example 13-33 displays access list 100 applied to interface Gigabit Ethernet 1/0 inbound. Notice that there is no entry permitting UDP port 520 traffic from R2 or all IP traffic (ip any any). Therefore, RIP packets will be denied because of the implicit deny all rule. The output of show ip +route confirms that no RIP routes are learned or being used. + + +Example 13-33 Verifying R1’s Applied Access Lists and RIP Routes + +R1#show access-list +Extended IP access list 100 +10 permit ip 10.1.3.0 0.0.0.255 any +20 permit ip 10.1.23.0 0.0.0.255 any +R1#show ip interface gigabitEthernet 1/0 | include access list +Outgoing access list is not set +Inbound access list is 100 +R1#show ip route rip +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +R1# + +To solve this issue, you need to add either permit ip any any at the end of the ACL or permit udp any any eq 520 to allow the RIP packets in. However, if you want more control and security, you can specify the source address of the router you only want to receive RIPv2 packets from, which would be R2 in this case. + +Load Sharing + +By default, RIP will load balance on four equal metric paths. You can verify the maxi-mum number of paths configured for load balancing with show ip protocols, as shown in Example 13-34. If you have equal metric paths but they are not being installed in the routing table for a particular destination network, check to make sure that the maximum +paths is configured with an appropriate value for the number of paths you have. If it is set to 1, it means that no load balancing will occur. + + + +From the Library of Outcast Outcast +486 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-34 Verifying Maximum Paths for Load Balancing + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 0 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet1/0 + +Send Recv Triggered RIP Key-chain +2 2 + +Automatic network summarization is not in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Passive Interface(s): +Ethernet0/0 +GigabitEthernet0/0 +GigabitEthernet2/0 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +120 + +Last Update +00:00:02 + +Distance: (default is 120) + + +Other RIP Issues + +In addition to all the reasons why RIP routes might be missing, you may have to trouble-shoot issues related to a missing default route or to route summarization. + +Missing Default Route + +There is a very small chance that a router using RIP will be able to support all 480,000+ summarized Internet routes. Therefore, redistributing the entire BGP routing table into RIP is out of the question. Therefore, for packets sourced in the RIP domain destined to the Internet to be successfully routed, the RIP routers need to know what to do with packets that they do not have a specific match for. This is where the default route enters the picture. + +The default route will typically be configured on the edge device with a next-hop address of the Internet service provider’s (ISP) router (for example, ip route 0.0.0.0 0.0.0.0 203.0.13.1). However, this is a static default route on the edge router and still needs to +be injected into the RIP process so that it can be advertised to the other RIP routers in the domain. To inject the default route into the RIP process, use the default-information + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 487 + +originate command in router RIP configuration mode. (Note that with RIP you do not need the static route configured to generate a default route. If it is missing, RIP will still generate a default route and advertise it to the other routers after you enter the default-information originate command. However, if the static route is missing on the router on which you issued the command, it will not be able to forward the packets and will drop them.) + +If you expect a default route on routers in the RIP domain and they are not receiving one, verify the RIP configuration on the router that should be generating the default route (typically an edge router) with the show run | section router rip command, as shown in Example 13-35. In this case, you are looking for the default-information originate com-mand, which is configured in this example. + +Example 13-35 Verifying default-information originate Configuration + +Edge#show run | section router rip +show run | section router rip +router rip +version 2 +passive-interface default +no passive-interface GigabitEthernet1/0 +network 10.0.0.0 +default-information originate +no auto-summary + +You may also want to confirm the default route has been inserted into the rip database as shown in Example 13-36 with show ip rip database. Notice that it has been inserted into the RIP database and that it says redistributed. + +Example 13-36 Verifying the Default Route in the RIP Database + +Edge#show ip rip database + +0.0.0.0/0 +0.0.0.0/0 + +auto-summary +redistributed + +[1] via 0.0.0.0, + +10.0.0.0/8 +10.1.1.0/24 +10.1.3.0/24 + +auto-summary +directly connected, GigabitEthernet0/0 + +[2] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 +10.1.12.0/24 directly connected, GigabitEthernet1/0 +10.1.23.0/24 +[1] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 + + +Route Summarization + +With RIP, manual route summarization is enabled on an interface-by-interface basis with the ip summary address rip address ip_subnet_mask interface configuration mode + + + + +From the Library of Outcast Outcast +488 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +command. Therefore, when troubleshooting route summarization, you want to keep the following in mind: + +■ Did you enable route summarization on the correct interface? + +■ Did you associate the summary route with RIP? + +■ Did you create the appropriate summary route? + +You can verify manual route summarization using the show ip protocols command, as shown in Example 13-37. In this example, autosummarization is disabled, and manual summarization is enabled for RIP on interface Gigabit Ethernet 1/0 for 10.1.0.0/20. + +Example 13-37 Verifying Route Summarization with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 11 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 + +Interface +GigabitEthernet1/0 + +Send Recv Triggered RIP Key-chain +2 2 + +Automatic network summarization is not in effect +Address Summarization: +10.1.0.0/20 for GigabitEthernet1/0 +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Passive Interface(s): +Ethernet0/0 +GigabitEthernet0/0 +GigabitEthernet2/0 +Routing Information Sources: + +Gateway +Gateway +10.1.12.2 + +Distance +Distance +120 + +Last Update +Last Update +00:00:17 + +Distance: (default is 120) + +It is important to remember that a route to null0 is not automatically created with RIP. Therefore, if R1, as shown in Figure 13-8, is configured with a summary route, as shown previously in Example 13-37, and it has a default route in the routing table, as shown +in Example 13-38, a routing loop may occur, as shown in the following paragraphs and examples. + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 489 + + +10.1.1.0/24 +Gi1/0 Gi0/0 + +10.1.3.0/24 Gi1/0 Gi1/0 + +Gi0/0 R1 10.1.12.0/24 R2 10.1.23.0/24 R3 Gi0/0 + +Figure 13-8 Route Summarization Topology + +Example 13-38 Verifying the Default Route on R1 + +R1#show ip route +...output omitted... +Gateway of last resort is 10.1.12.2 to network 0.0.0.0 + +R* 0.0.0.0/0 [120/2] via 10.1.12.2, 00:00:14, GigabitEthernet1/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +R 10.1.3.0/24 [120/2] via 10.1.12.2, 00:00:14, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:14, GigabitEthernet1/0 + +Now suppose that R1 receives a packet destined for 10.1.5.2. What will it do with it? Based on the default route, it will send it to R2. However, in Example 13-37, you wit-nessed in the output of show ip protocols that a summary route for 10.1.0.0/20 was con-figured on R1. Using the command show ip rip database, as shown in Example 13-39, indicates 10.1.0.0/20 is installed in the RIP database. Also, reviewing the output of show ip route in Example 13-40 on R2 reveals that it is learning the summary route from R1. + +Example 13-39 Verifying the Summary Route in the RIP Database + +R1#show ip rip database +0.0.0.0/0 auto-summary +0.0.0.0/0 +[2] via 10.1.12.2, 00:00:27, GigabitEthernet1/0 + +10.0.0.0/8 +10.1.0.0/20 +10.1.1.0/24 +10.1.3.0/24 + +auto-summary +int-summary +directly connected, GigabitEthernet0/0 + +[2] via 10.1.12.2, 00:00:27, GigabitEthernet1/0 +10.1.12.0/24 directly connected, GigabitEthernet1/0 +10.1.23.0/24 +[1] via 10.1.12.2, 00:00:27, GigabitEthernet1/0 + + +Example 13-40 Verifying the Summary Route on R2 + +R2#show ip route +...output omitted... +Gateway of last resort is 10.1.23.3 to network 0.0.0.0 + + + +From the Library of Outcast Outcast +490 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +R* 0.0.0.0/0 [120/1] via 10.1.23.3, 00:00:20, GigabitEthernet1/0 +10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks +R 10.1.0.0/20 [120/1] via 10.1.12.1, 00:00:21, GigabitEthernet0/0 +R 10.1.1.0/24 [120/1] via 10.1.12.1, 00:01:16, GigabitEthernet0/0 +R 10.1.3.0/24 [120/1] via 10.1.23.3, 00:00:20, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 + +Because the advertised summary route includes networks that R1 truly does not know how to reach (including 10.1.5.2), a routing loop is created as packets are sent to R1, because of the summary route, and then R1 sends the packet back to R2, because of the default route. For example, R2 sends the packet destined to 10.1.5.2 back to R1, then R1 sends it back to R2, and then R2 back to R1, and so on. This is witnessed in Example 13-41 with a trace from R3 to 10.1.5.2, which loops between R2 and R1. + +Example 13-41 Verifying a Routing Loop with a Trace on R3 + +R3#trace 10.1.5.2 +Type escape sequence to abort. +Tracing the route to 10.1.5.2 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.23.2 32 msec 44 msec 44 msec +2 10.1.12.1 72 msec 88 msec 84 msec +3 10.1.12.2 88 msec 92 msec 88 msec +4 10.1.12.1 152 msec 120 msec 136 msec +5 10.1.12.2 132 msec 128 msec 116 msec +6 10.1.12.1 136 msec 136 msec 124 msec +7 10.1.12.2 160 msec 136 msec * +8 10.1.12.1 156 msec 176 msec 180 msec +9 10.1.12.2 180 msec 168 msec 200 msec +10 10.1.12.1 212 msec 192 msec 196 msec +11 10.1.12.2 232 msec 196 msec 208 msec +12 10.1.12.1 244 msec 260 msec 236 msec +13 10.1.12.2 228 msec 264 msec 228 msec +14 10.1.12.1 276 msec 296 msec 288 msec +15 10.1.12.2 260 msec 276 msec 292 msec +16 10.1.12.1 292 msec 316 msec 276 msec +17 10.1.12.2 288 msec 316 msec 268 msec +18 10.1.12.1 332 msec 312 msec 368 msec +19 10.1.12.2 308 msec 336 msec 324 msec +20 10.1.12.1 364 msec 340 msec 364 msec +21 10.1.12.2 372 msec 340 msec 372 msec +22 10.1.12.1 372 msec 384 msec 372 msec +23 10.1.12.2 416 msec 384 msec 404 msec +24 10.1.12.1 428 msec 416 msec 424 msec + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 491 + +25 10.1.12.2 420 msec 432 msec 440 msec +26 10.1.12.1 456 msec 460 msec 452 msec +27 10.1.12.2 460 msec 484 msec 460 msec +28 10.1.12.1 468 msec 484 msec 492 msec +29 10.1.12.2 488 msec 508 msec 480 msec +30 10.1.12.1 528 msec 516 msec 548 msec + +To solve this issue, you would need to create a static route to null0 on R1 for the summa-ry route or create a better summary route. This will ensure that when R1 receives a packet that falls within the summary route but that it does not know how to reach, it will drop the packet instead of sending it back to R2 because of the default route. Example 13- +42 displays the static route configuration to null0 for the same network as the summary route and the output of show ip route to verify the newly created static route. + +Example 13-42 Configuring a Static Route to Null0 + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ip route 10.1.0.0 255.255.240.0 null 0 +R1(config)#end +R1#show ip route +...output omitted... +Gateway of last resort is 10.1.12.2 to network 0.0.0.0 + +R* 0.0.0.0/0 [120/2] via 10.1.12.2, 00:00:01, GigabitEthernet1/0 +10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks +S 10.1.0.0/20 is directly connected, Null0 +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +R 10.1.3.0/24 [120/2] via 10.1.12.2, 00:00:01, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:01, GigabitEthernet1/0 + +Example 13-43 confirms that the loop no longer exists with a trace. Notice the !H that is returned. It means the host is not reachable. In this case it is because, the packet is being dropped by the Null0 route. + +Example 13-43 Confirming That the Loop No Longer Exists with a Trace + +R3#trace 10.1.5.2 +Type escape sequence to abort. +Tracing the route to 10.1.5.2 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.23.2 32 msec 44 msec 40 msec +2 10.1.12.1 68 msec 92 msec 72 msec +3 10.1.12.1 !H !H !H + + + + +From the Library of Outcast Outcast +492 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Troubleshooting RIPng + +RIPng is the next generation RIP routing protocol designed for routing IPv6 addresses and prefixes. It functions the same as RIPv2, but had to be modified to support IPv6. Some of the RIPng enhancements include the use of the all-RIP-devices multicast group of FF02::9, the removal of the network command, which was replaced by an interface configuration command, and the use of link-local addresses as the next-hop IPv6 address. + +In this section, you will learn how to troubleshoot and verify RIPng issues. + +Before you even begin troubleshooting RIPng, you need to verify that IPv6 unicast routing is enabled on the router. If it is not, it must be enabled before you proceed any further. As shown in Example 13-44, you can use the show run | include ipv6 unicast-routing command to verify if it is enabled. + +Example 13-44 Confirming That IPv6 Unicast Routing Is Enabled + +R1#show run | include ipv6 unicast-routing +ipv6 unicast-routing +R1# + +Figure 13-9 depicts a RIPng routing domain. To verify the RIPng database on R1, you use the show ipv6 rip database command, as shown in Example 13-45. In this example, you can see that 2001:DB8:0:3::/64 and 2001:DB8:0:23::/64 are installed in the rout- +ing table but that 2001:DB8:0:12::/64 is not. This is because 2001:DB8:0:3::/64 and 2001:DB8:0:23::/64 have been learned from a neighboring router, and 2001:DB8:0:12::/64 is a directly connected network. Therefore, there is a better route based on AD that can be installed in the routing table instead of this RIPng one. + + +Internet 2001:db8:f::f + + + +2001:db8:0:1::/64 +Gi1/0 + +Gi2/0 +Gi0/0 Gi1/0 + + +2001:db8:0:3::/64 Gi1/0 + +Gi0/0 R1 2001:db8:0:12::/64 R2 2001:db8:0:23::/64 R3 Gi0/0 + +Figure 13-9 RIPng Sample Topology + +Example 13-45 Sample Output of the RIPng Database +Key +Topic R1#show ipv6 rip database +RIP process "TSHOOT_RIP", local RIB +2001:DB8:0:3::/64, metric 3, installed +GigabitEthernet1/0/FE80::C801:3FF:FE9C:8, expires in 172 secs +2001:DB8:0:12::/64, metric 2 +GigabitEthernet1/0/FE80::C801:3FF:FE9C:8, expires in 172 secs +2001:DB8:0:23::/64, metric 2, installed +GigabitEthernet1/0/FE80::C801:3FF:FE9C:8, expires in 172 secs + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 493 + +To verify the RIPng routes installed in the routing table, you use the show ipv6 route rip command, as shown in Example 13-46. Notice that the RIPng routes are still represented by an R and that the AD is still 120. In addition, the hop count is still based on the num-ber of routers that have to be traversed to reach the destination network. Note that the next-hop IP address is an FE80:: link-local address. + +Example 13-46 Viewing RIPng Routes in the Routing Table + +R1#show ipv6 route rip +IPv6 Routing Table - default - 9 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +R 2001:DB8:0:3::/64 [120 /3] +via FE80::C801:3FF:FE9C:8, GigabitEthernet1/0 +R 2001:DB8:0:23::/64 [120 /2] +via FE80::C801:3FF:FE9C:8, GigabitEthernet1/0 + + + +Key Topic + +The show ipv6 protocols output, as shown in Example 13-47, is not as verbose as the show ip protocols output. Presently, it is only showing the interfaces that are enabled for the RIPng process called TSHOOT_RIP and that no redistribution is happening. If you want to verify timers, maximum paths, port number, multicast group, as well as the interfaces that are enabled for the RIPng process, you need to use the show ipv6 rip +process_name command. In Example 13-48, the output of show ipv6 rip TSHOOT_RIP is displayed. You can verify that the maximum paths is set to 16, the multicast group is FF02::9, the RIPng port number is 521, the AD is 120, split horizon is on, updates are sent every 30 seconds and will expire after 180 seconds, and interfaces Gigabit Ethernet +0/0 and 1/0 are enabled for this RIPng process. + + +Example 13-47 Viewing the Output of show ipv6 protocols + +R1#show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "rip TSHOOT_RIP" +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 +Redistribution: +None + + +Example 13-48 Viewing the Output of show ipv6 rip TSHOOT_RIP + +R1#show ipv6 rip TSHOOT_RIP +RIP process "TSHOOT_RIP", port 521, multicast-group FF02::9, pid 93 +Administrative distance is 120. Maximum paths is 16 + + +From the Library of Outcast Outcast +494 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Updates every 30 seconds, expire after 180 +Holddown lasts 0 seconds, garbage collect after 120 +Split horizon is on; poison reverse is off +Default routes are not generated +Periodic updates 79, trigger updates 8 +Full Advertisement 0, Delayed Events 0 +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 +Redistribution: +None + +If you want to verify the number of routes that a router is learning from a RIPng directly connected router, you can use the show ipv6 rip next-hops command, as shown in Example 13-49. In this case, we can reach three different networks (we have learned about three different networks) from the RIPng router at the next-hop IPv6 address of FE80::C801:3FF:FE9C:8. + +Example 13-49 Viewing the Number of IPv6 Routes Reachable via a Next-Hop Router + +R1#show ipv6 rip next-hops +RIP process "TSHOOT_RIP", Next Hops +FE80::C801:3FF:FE9C:8/GigabitEthernet1/0 [3 paths] + +If you need to verify RIPng packets in real time, you can use the debug ipv6 rip com-mand, as shown in Example 13-50. In this example, you can see the router sending RIPng updates out Gig1/0 for RIPng process TSHOOT_RIP with a link-local source address and a multicast destination of FF02::9. The prefixes are 2001:DB8:0:1::/64 and +2001:DB8:0:12::/64. The router is also receiving RIPng updates on the same interface from the device with a link-local address of FE80::C80F:1FF:FE9C:8. The routes in the update are 2001:DB8:0:12::/64, 2001:DB8:0:23::/64, and 2001:DB8:0:3::/64. + +Example 13-50 Sample RIPng debug Output + +R1#debug ipv6 rip +RIP Routing Protocol debugging is on +R1# +RIPng: Sending multicast update on GigabitEthernet1/0 for TSHOOT_RIP +src=FE80::C80E:1FF:FE9C:1C +dst=FF02::9 (GigabitEthernet1/0) +sport=521, dport=521, length=52 +command=2, version=1, mbz=0, #rte=2 +tag=0, metric=1, prefix=2001:DB8:0:1::/64 +tag=0, metric=1, prefix=2001:DB8:0:12::/64 +RIPng: Packet waiting +RIPng: response received from FE80::C80F:1FF:FE9C:8 on GigabitEthernet1/0 for TSHOOT_RIP +src=FE80::C80F:1FF:FE9C:8 (GigabitEthernet1/0) + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 495 + +dst=FF02::9 +sport=521, dport=521, length=72 +command=2, version=1, mbz=0, #rte=3 +tag=0, metric=1, prefix=2001:DB8:0:12::/64 +tag=0, metric=1, prefix=2001:DB8:0:23::/64 +tag=0, metric=2, prefix=2001:DB8:0:3::/64 +R1#u all +All possible debugging has been turned off + +By default, RIPng will load balance on 16 equal metric paths. You can verify the maximum number of paths configured for load balancing with the show ipv6 rip pro-cess_name command, as shown in Example 13-51. In this case, the maximum paths would have been changed to 11 with the maximum-paths command in ipv6 router rip process_name configuration mode. If you have equal metric paths but they are not being installed in the routing table for a particular destination network, check to make sure that the maximum paths is configured with an appropriate value for the number of paths you have. If it is set to 1, it means that no load balancing will occur. + + + +Example 13-51 Verifying Maximum Paths for Load Balancing Key +Topic R1#show ipv6 rip TSHOOT_RIP +RIP process "TSHOOT_RIP", port 521, multicast-group FF02::9, pid 276 +Administrative distance is 120. Maximum paths is 11 +Updates every 30 seconds, expire after 180 +Holddown lasts 0 seconds, garbage collect after 120 +Split horizon is on; poison reverse is off +Default routes are not generated +Periodic updates 71, trigger updates 2 +Full Advertisement 1, Delayed Events 0 +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 +Redistribution: +None + + + +Key Topic + +With RIPng, default routing is enabled on an interface-by-interface basis with the ipv6 rip process_name default-information [originate | only] command. The originate key-word is used to advertise a default route out the interface along with all the other routes that the router knows. The only keyword is used to advertise just a default route, and all other routes that would have been advertised out the interface are suppressed. You can verify whether a default route is being generated by using the show ipv6 rip process_ name command, as shown in Example 13-52. However, this does not confirm what type of default route is being generated or by which interface. You must review the interface configuration in the running configuration to verify this. Using the command show run | include interface|default, as shown in Example 13-53, displays that interface Gig1/0 is +configured to generate a default route and only advertise that specific route out Gig1/0. + + + + +From the Library of Outcast Outcast +496 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-52 Verifying Whether a Default Route Is Being Generated + +R1#show ipv6 rip TSHOOT_RIP +RIP process "TSHOOT_RIP", port 521, multicast-group FF02::9, pid 276 +Administrative distance is 120. Maximum paths is 11 +Updates every 30 seconds, expire after 180 +Holddown lasts 0 seconds, garbage collect after 120 +Split horizon is on; poison reverse is off +Default routes are generated +Periodic updates 110, trigger updates 2 +Full Advertisement 1, Delayed Events 0 +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 +Redistribution: +None + + +Example 13-53 Verifying Whether a Default Route Is Configured on an Interface + +R1#show run | include interface|default +interface Ethernet0/0 +interface GigabitEthernet0/0 +interface GigabitEthernet1/0 +ipv6 rip TSHOOT_RIP default-information only +interface GigabitEthernet2/0 + + + +Key Topic + +ACLs can be the cause of many troubleshooting efforts. You implement an ACL on an interface to protect your network from malicious traffic only to break routing in your network because you accidentally denied the routing protocol with the implicit deny all entry in the ACL. To verify whether there are any ACLs denying packets in an interface, you can issue the debug ipv6 packets command. The debug messages will indicate that the packet is being discarded by a certain ACL. However, be very careful with this com-mand because it debugs every single IPv6 packet and could overload the router’s proces-sor and grind it to a halt. + +An alternative is to issue the command show run | include interface|traffic to find any interface that might have the ipv6 traffic-filter command applied, as in Example 13-54. In this example, you see the IPv6 traffic filter called NETWORK is applied inbound +to Gig1/0. Now you issue the show ipv6 access-list NETWORK command to confirm whether this is in fact the reason why routes are not being learned. In Example 13-55, the only traffic that is permitted is traffic from 2001:DB8:0:3::/64 going to 2001:DB8:0:1::/64. Therefore, all other IPV6 traffic, except neighbor discovery traffic, is denied by the implicit deny all entry. Even the RIPng updates are denied. You will need to add an entry that permits UDP port 521 traffic for the RIPng updates (for example, permit udp any +any eq 521). + + + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 497 + +Example 13-54 Verifying ACLs Applied to Interfaces + +R1#show run | include interface|traffic +interface Ethernet0/0 +interface GigabitEthernet0/0 +interface GigabitEthernet1/0 +ipv6 traffic-filter NETWORK in +interface GigabitEthernet2/0 + + +Example 13-55 Verifying IPv6 ACLs + +R1#show ipv6 access-list NETWORK +IPv6 access list NETWORK +permit ipv6 2001:DB8:0:3::/64 2001:DB8:0:1::/64 sequence 10 + + + +Key Topic + +RIPng is enabled on an interface-by-interface basis with the ipv6 rip process_name enable interface configuration command. If the command is missing from the interface, the RIPng process will not be running on the interface, and the network the interface is part of will not be injected into the RIPng routing process. To verify which interfaces are participating in a particular RIPng process, you can use the show ipv6 protocols com- +mand or the show ipv6 rip process_name command, as shown in Example 13-56. + + +Example 13-56 Verifying RIPng-Enabled Interfaces + +R1#show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "rip TSHOOT_RIP" +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 +Redistribution: +None +R1#show ipv6 rip TSHOOT_RIP +RIP process "TSHOOT_RIP", port 521, multicast-group FF02::9, pid 93 +Administrative distance is 120. Maximum paths is 16 +Updates every 30 seconds, expire after 180 +Holddown lasts 0 seconds, garbage collect after 120 +Split horizon is on; poison reverse is off +Default routes are not generated +Periodic updates 79, trigger updates 8 +Full Advertisement 0, Delayed Events 0 +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 +Redistribution: +None + + + + +From the Library of Outcast Outcast +498 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +RIPv2 and RIPng Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 13-10. + + +Internet 192.0.2.1 2001:db8:f::f + + +2001:db8:0:1::/64 10.1.1.0/24 +Gi1/0 + + +Gi2/0 +Gi0/0 Gi1/0 + +2001:db8:0:3::/64 10.1.3.0/24 +Gi1/0 + + + +Gi0/0 R1 + + +10.1.12.0/24 +2001:db8:0:12::/64 + +R2 10.1.23.0/24 +2001:db8:0:23::/64 + +R3 Gi0/0 + +RIPv2 and RIPng domain with default route to reach internet + +Figure 13-10 RIPv2 and RIPng Trouble Ticket Topology + + +Trouble Ticket 13-1 + +Problem: Users in the 10.1.1.0/24 network indicate that they are not able to access resources in the 10.1.3.0/24 network. + +You start your troubleshooting process by confirming the issue. From a PC in the 10.1.1.0/24 network, you ping to the Gig0/0 interface on R3, which has an IP address of 10.1.3.3. In Example 13-57, the ping fails, confirming the issue. A ping to the default gate-way of 10.1.1.0/24, which is 10.1.1.1, is successful, indicating that the issue is beyond the LAN and that we can start our troubleshooting efforts on R1. + +Example 13-57 Confirming Issue with Ping + +C:\>ping 10.1.3.3 + +Pinging 10.1.3.3 with 32 bytes of data: + +Request timed out. +Request timed out. +Request timed out. +Request timed out. + +Ping statistics for 10.1.3.3: +Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), + +C:\>ping 10.1.1.1 + +Pinging 10.1.1.1 with 32 bytes of data: + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 499 + +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.1: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.1: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +On R1, you issue the show ip route 10.1.3.3 command. As shown in Example 13-58, the subnet is not in the table. This is a great indication that we are not learning about the 10.1.3.3 network. However, your network does use a default route; therefore, you issue the show ip route 0.0.0.0 command and notice that there is a default route, as shown in Example 13-59, that points to a next hop of 10.1.12.2, which is R2. As a result, R1 should be sending the traffic to R2. + +Example 13-58 Confirming Route to 10.1.3.3 + +R1#show ip route 10.1.3.3 +% Subnet not in table + + +Example 13-59 Reviewing the Default Route in the Routing Table + +R1#show ip route 0.0.0.0 +Routing entry for 0.0.0.0/0, supernet +Known via "rip", distance 120, metric 1, candidate default path +Redistributing via rip +Last update from 10.1.12.2 on GigabitEthernet1/0, 00:00:21 ago +Routing Descriptor Blocks: +* 10.1.12.2, from 10.1.12.2, 00:00:21 ago, via GigabitEthernet1/0 +Route metric is 1, traffic share count is 1 + +You issue a traceroute command to 10.1.3.3 on R1, sourcing it from 10.1.1.1, as shown in Example 13-60, and notice that the packet is going to the Internet at R2. It is time to shift your attention to R2. + +Example 13-60 Using the traceroute Command to Verify the Path + +R1#traceroute 10.1.3.3 source 10.1.1.1 +Type escape sequence to abort. +Tracing the route to 10.1.3.3 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.12.2 32 msec 44 msec 36 msec +2 203.0.113.2 64 msec 40 msec 60 msec +3 * * * +...output omitted... + + + + +From the Library of Outcast Outcast +500 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +On R2, you issue the command show ip route 10.1.3.3, and the result is the same as R1, subnet not in table, as shown in Example 13-61. It appears that R2 might not be learning about the 10.1.3.0/24 network. You issue the command show ip rip database on R2, as shown in Example 13-62, and confirm that R2 is not learning about 10.1.3.0/24 from R3. + +Example 13-61 Confirming Route in R2’s Routing Table + +R2#show ip route 10.1.3.3 +% Subnet not in table + + +Example 13-62 Viewing the RIP Database on R2 + +R2#show ip rip database + +0.0.0.0/0 +0.0.0.0/0 + +auto-summary +redistributed + +[1] via 0.0.0.0, +10.0.0.0/8 auto-summary +10.1.1.0/24 +[1] via 10.1.12.1, 00:00:14, GigabitEthernet0/0 + +10.1.12.0/24 +10.1.23.0/24 + +directly connected, GigabitEthernet0/0 +directly connected, GigabitEthernet1/0 + + +You hypothesize that interface Gig0/0 on R3 is not participating in the RIP process. To verify your hypothesis, you issue the show ip protocols command on R3, as shown in Example 13-63. According to the output, interface Gig0/0 is participating in the RIP pro-cess, and as a result the network associated with the interface should be advertised. You then notice that interface Gig1/0, which is connected to R2, is not participating in the RIP process, because it is not listed in the interface listing. However, you notice that it states lower in the output, Routing for Networks: 10.0.0.0. Interface Gig1/0 has an IP address of 10.1.23.3, as shown in the output of show ip interface brief of Example 13-64. Therefore, it is enabled for the RIP process and should be advertising the RIP updates to R2. You then notice that Gig1/0 is configured as a passive interface. When configured as a passive interface, the interface will still receive RIP updates but not send RIP updates. Therefore, R2 is not learning about 10.1.3.0/24, and as a result, R1 does not learn about it. + +Example 13-63 Viewing the Output of show ip protocols on R3 + +R3#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 27 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: rip +Default version control: send version 2, receive version 2 +Interface Send Recv Triggered RIP Key-chain + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 501 + +GigabitEthernet0/0 2 2 +Automatic network summarization is in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Passive Interface(s): +GigabitEthernet1/0 +Routing Information Sources: + +Gateway +10.1.23.2 + +Distance +120 + +Last Update +00:00:06 + +Distance: (default is 120) + + +Example 13-64 Viewing the Output of show ip interface brief on R3 + +R3#show ip int brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES NVRAM administratively down down + +GigabitEthernet0/0 +GigabitEthernet1/0 + +10.1.3.3 +10.1.23.3 + +YES NVRAM up up +YES NVRAM up up + + +You issue the command show run | section router rip and confirm that the passive-interface command is configured for interface Gig1/0, as shown in Example 13-65. You remove the command with the no passive-interface GigabitEthernet1/0 command in router RIP configuration mode. + +Example 13-65 Verifying the Passive-Interface Configuration on R3 + +R3#show run | section router rip +router rip +version 2 +passive-interface GigabitEthernet1/0 +network 10.0.0.0 +R3#config t +Enter configuration commands, one per line. End with CNTL/Z. +R3(config)#router rip +R3(config-router)#no passive-interface GigabitEthernet1/0 +R3(config-router)#end +R3# + +Now when you go back to R1 and issue the command show ip route 10.1.3.3, 10.1.3.0/24 is listed as the entry in the routing table, and the ping to 10.1.3.3 is successful, as shown in Example 13-66. + +Example 13-66 Verifying 10.1.3.0/24 Route in R1’s Routing Table and a Successful Ping + +R1#show ip route 10.1.3.3 +Routing entry for 10.1.3.0/24 +Known via "rip", distance 120, metric 2 +Redistributing via rip + + +From the Library of Outcast Outcast +502 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Last update from 10.1.12.2 on GigabitEthernet1/0, 00:00:27 ago +Routing Descriptor Blocks: +* 10.1.12.2, from 10.1.12.2, 00:00:27 ago, via GigabitEthernet1/0 +Route metric is 2, traffic share count is 1 +R1#ping 10.1.3.3 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.3.3, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 36/52/64 ms + + +Trouble Ticket 13-2 + +Problem: Users in the 2001:db8:0:1::/64 network indicate that they are not able to access any resources on the Internet or the 2001:db8:0:3::/64 network. + +You begin troubleshooting by verifying the problem with a ping to the Internet address of 2001:db8:f::f and the router address 2001:db8:0:3::3 with a source of 2001:db8:0:1::1. The results in Example 13-67 confirm the issues. + +Example 13-67 Confirming the Users’ Issues with Pings + +R1#ping 2001:db8:f::f source 2001:db8:0:1::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:1::1 +..... +Success rate is 0 percent (0/5) +R1#ping 2001:db8:0:3::3 source 2001:db8:0:1::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:3::3, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:1::1 +..... +Success rate is 0 percent (0/5) + +You then issue the show ipv6 route ip_address command on R1 to determine whether a route exists. In Example 13-68, the default route is used to reach the Internet address, and 2001:DB8:0:3::/64 is used to reach 2001:DB8:0:3::3. Therefore, R1 knows how to +reach the networks. In both cases, the next hop is out Gig1/0 with a link-local address of FE80::C80F:1FF:FE9C:8 (R2). + +Example 13-68 Verifying Routing Table Entries for Destination Networks + +R1#show ipv6 route 2001:db8:f::f +Routing entry for ::/0 +Known via "rip TSHOOT_RIP", distance 120, metric 2 +Route count is 1/1, share count 0 +Routing paths: +FE80::C80F:1FF:FE9C:8, GigabitEthernet1/0 +Last updated 01:16:36 ago + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 503 + +R1#show ipv6 route 2001:db8:0:3::3 +Routing entry for 2001:DB8:0:3::/64 +Known via "rip TSHOOT_RIP", distance 120, metric 3 +Route count is 1/1, share count 0 +Routing paths: +FE80::C80F:1FF:FE9C:8, GigabitEthernet1/0 +Last updated 12:31:48 ago + +You issue an extended IPv6 traceroute on R1 to verify the path from the 2001:db8:0:1::/64 network, and it fails immediately, as shown in Example 13-69. + +Example 13-69 Issuing a Traceroute to Verify a Path + +R1#traceroute ipv6 +Target IPv6 address: 2001:db8:f::f +Source address: 2001:db8:0:1::1 +Insert source routing header? [no]: +Numeric display? [no]: +Timeout in seconds [3]: +Probe count [3]: +Minimum Time to Live [1]: +Maximum Time to Live [30]: +Priority [0]: +Port Number [0]: +Type escape sequence to abort. +Tracing the route to 2001:DB8:F::F + +1 * * * +2 * * * +3 * * * +4 * * * +5 * * * +6 * * * +7 * * * +8 * * * +9 * * * +...output omitted... + +You issue a standard trace from R1 to 2001:db8:f::f so that the trace is generated with a source address of 2001:db8:0:12::1 and notice that it fails at R2, as shown in Example 13-70. However, we can see the !A, which indicates that an ACL is possibly the culprit +here. This gives us something to work with now as we shift our attention to R2. However, notice that based on the source address, we had different trace results, ***, or !A !A !A. + + + + + + + +From the Library of Outcast Outcast +504 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-70 Issuing a Traceroute to Verify a Path + +R1#traceroute 2001:db8:f::f +Type escape sequence to abort. +Tracing the route to 2001:DB8:F::F + +1 2001:DB8:0:12::2 !A !A !A + +On R2, you issue the show run | include interface|traffic-filter command to see whether any interfaces have an IPv6 ACL applied to them. The result of this command, as shown in Example 13-71, indicates that Gig0/0 (which is the interface connected to R1) has an ACL applied named TSHOOT. Your next step is to review the IPv6 ACL named TSHOOT, as shown in Example 13-72, with the show ipv6 access-list TSHOOT command. The ACL is permitting all IPv6-related traffic from 2001:DB8:0:1::/64 to anywhere. This explains why the traces produced different results. The trace is allowed when sourced from 2001:DB8:0:1::/64 but not when sourced from 2001:DB8:0:12::/64. This still does not explain why R1 has the routes to reach the networks but connectivity is failing. + +Example 13-71 Verifying IPv6 ACLs Applied to Interfaces + +R2#show run | include interface|traffic-filter +interface Ethernet0/0 +interface GigabitEthernet0/0 +ipv6 traffic-filter TSHOOT in +interface GigabitEthernet1/0 +interface GigabitEthernet2/0 + + +Example 13-72 Verifying IPv6 ACLs + +R2#show ipv6 access-list TSHOOT +IPv6 access list TSHOOT +permit ipv6 2001:DB8:0:1::/64 any (74 matches) sequence 10 + +Let’s review R2’s routing table in Example 13-73. Maybe R2 has routes pointing to an incorrect next hop. They appear fine, so you decide to ping to make sure. As shown in the same example, they are successful. + +Example 13-73 R2’s Routing Table and Successful Pings + +R2#show ipv6 route +...output omitted... +S ::/0 [1/0] +via 2001:DB8:0:A::A +R 2001:DB8:0:3::/64 [120/2] +via FE80::C811:17FF:FE38:1C, GigabitEthernet1/0 +C 2001:DB8:0:A::/64 [0/0] +via GigabitEthernet2/0, directly connected +...output omitted... +R2#ping 2001:db8:f::f + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 505 + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 24/28/36 ms +R2#ping 2001:db8:0:3::3 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:3::3, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 8/40/88 ms + +This narrows down the issue to being between R1 and R2. Recall that R1 knows about the routes. R2 knows about the routes. But, does R2 know how to reach R1 at +2001:db8:0:1::/64? You issue the command show ipv6 route 2001:db8:0:1::/64, as shown in Example 13-74, and notice that the default route is being used. Therefore, R2 does not know about 2001:db8:0:1::/64. Then you remember the ACL applied inbound on interface Gig0/0 of R2 from Example 13-72. It is permitting traffic from 2001:db8:0:1::/64 to any-where, but it is denying everything else because of the implicit deny all rule, including RIPng updates. + +Example 13-74 Verifying a Route to 2001:db8:0:1::/64 on R2 + +R2#show ipv6 route 2001:db8:0:1::/64 +Routing entry for ::/0 +Known via "static", distance 1, metric 0 +Route count is 1/1, share count 0 +Routing paths: +2001:DB8:0:A::A +Last updated 01:51:27 ago + +To fix this issue, you need to permit RIPng updates in the ACL as well. Example 13-75 displays how this can be accomplished in addition to how it can be verified. Notice that RIPng packets are being matched to the permit statement now. + +Example 13-75 Permitting UDP Port 521 Traffic in an IPv6 ACL + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#ipv6 access-list TSHOOT +R2(config-ipv6-acl)#permit udp any any eq 521 +R2(config-ipv6-acl)#end +R2#show ipv6 access-list TSHOOT +IPv6 access list TSHOOT +permit ipv6 2001:DB8:0:1::/64 any (74 matches) sequence 10 +permit udp any any eq 521 (8 matches) sequence 20 + +Now when you reissue the command show ipv6 route 2001:db8:0:1::/64, as shown in Example 13-76, the route is correct. + + + + +From the Library of Outcast Outcast +506 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 13-76 Verifying Routing Table Entries + +R2#show ipv6 route 2001:db8:0:1::/64 +Routing entry for 2001:DB8:0:1::/64 +Known via "rip TSHOOT_RIP", distance 120, metric 2 +Route count is 1/1, share count 0 +Routing paths: +FE80::C80E:1FF:FE9C:1C, GigabitEthernet0/0 +Last updated 00:01:45 ago + +Pinging from R1 to the Internet or the 2001:db8:0:3::/64 network is successful now, as shown in Example 13-77. + +Example 13-77 Successful Pings + +R1#ping 2001:db8:f::f source 2001:db8:0:1::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:1::1 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 20/33/48 ms +R1#ping 2001:db8:0:3::3 source 2001:db8:0:1::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:3::3, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:1::1 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 20/31/52 ms + + +Trouble Ticket 13-3 + +Problem: Users in the 2001:db8:0:1::/64 network indicate that they are not able to access resources on the Internet. + +You begin troubleshooting by verifying the problem with a ping to the Internet address of 2001:db8:f::f with a source of 2001:db8:0:1::1. The results in Example 13-78 confirm the issues. + +Example 13-77 Confirming the Users’ Issues with Pings + +R1#ping 2001:db8:f::f source 2001:db8:0:1::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:1::1 +..... +Success rate is 0 percent (0/5) + +You then issue the show ipv6 route ip_address command on R1 to determine whether a route exists for 2001:db8:f::f. In Example 13-78, there is no entry for that network. + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 507 + +Based on the network topology in Figure 13-10, a default route should exist in the RIPng domain. Example 13-78 also displays the output of show ipv6 route ::/0, and the default route is not found either. On R2, you issue the same command, and Example 13-79 dis-plays that it is known via a static route. + +Example 13-78 Verifying Routing Table Entries for Destination Networks + +R1#show ipv6 route 2001:db8:f::f +% Route not found +R1#show ipv6 route ::/0 +% Route not found + + +Example 13-79 Verifying Default Route on R2 + +R2#show ipv6 route ::/0 +Routing entry for ::/0 +Known via "static", distance 1, metric 0 +Route count is 1/1, share count 0 +Routing paths: +2001:DB8:0:A::A +Last updated 02:49:57 ago + +Next you issue the show ipv6 rip command to verify whether a default route is being generated for RIP. In Example 13-80, you can clearly see that a default route is being gen-erated. + +Example 13-80 Verifying a Default Route on R2 + +R2#show ipv6 rip +RIP process "TSHOOT_RIP", port 521, multicast-group FF02::9, pid 276 +Administrative distance is 120. Maximum paths is 16 +Updates every 30 seconds, expire after 180 +Holddown lasts 0 seconds, garbage collect after 120 +Split horizon is on; poison reverse is off +Default routes are generated +Periodic updates 2089, trigger updates 8 +Full Advertisement 1, Delayed Events 0 +Interfaces: +GigabitEthernet0/0 +GigabitEthernet1/0 +Redistribution: +None + +But wait; remember that default routes for RIPng are configured on an interface-by-interface basis. This only tells you that a default route is being generated. It does not tell you where. Therefore, you need to issue the show run | include interface|default com-mand, as shown in Example 13-81, to determine which RIPng interfaces are generating + + + + +From the Library of Outcast Outcast +508 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +a default route. In this case, only Gig1/0 is. You need to add the ipv6 rip TSHOOT_RIP default-information originate command to Gig0/0 as well. Example 13-82 displays the commands needed to fix this issue. + +Example 13-81 Verifying Which Interfaces Are Generating a Default Route for RIPng + +R2#show run | include interface|default +interface Ethernet0/0 +interface GigabitEthernet0/0 +interface GigabitEthernet1/0 +ipv6 rip TSHOOT_RIP default-information originate +interface GigabitEthernet2/0 + + +Example 13-82 Configuring a RIPng Interface to Generate a Default Route + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#interface gigabitEthernet 0/0 +R2(config-if)#ipv6 rip TSHOOT_RIP default-information originate +R2(config-if)#end +R2# + +Back on R1, you issue the show ipv6 route ::/0 command again and confirm that there is an entry in the routing table. You also issue a ping to the Internet address 2001:db8:f::f, which is successful. Example 13-83 displays the routing table and the successful ping. + +Example 13-83 Verifying the Issue is Solved + +R1#show ipv6 route ::/0 +Routing entry for ::/0 +Known via "rip TSHOOT_RIP", distance 120, metric 2 +Route count is 1/1, share count 0 +Routing paths: +FE80::C80F:1FF:FE9C:8, GigabitEthernet1/0 +Last updated 00:03:51 ago + +R1#ping 2001:db8:f::f source 2001:db8:0:1::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:1::1 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 12/28/44 ms +R1# + + + + + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 509 + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 13-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 13-2 Key Topics for Chapter 13 +Key +Topic Key Topic Element Description Page Number + + +List + +Paragraph + + +Example 13-2 + +Paragraph + +Paragraph + +Example 13-11 + +List + +List + +Section + +Paragraph + +Example 13-45 + +Paragraph + +Example 13-51 + +Outlines reasons why RIPv2 routes may be missing 466 from the RIP database or the IPv4 routing table +Identifies how to verify the routes that are received 467 from neighboring RIPv2 enabled routers with show +ip rip database + +Viewing the RIP installed routes in the routing table 467 with the show ip route rip command +Discusses how to verify various RIP parameters with 468 show ip protocols command +Describes how to verify which interfaces are 470 participating in the RIP process +Verifying RIP passive interfaces with the show ip 472 protocols command +Outlines reasons why the maximum hop count may 475 be exceeded +Identifies what to consider when troubleshooting 479 route filters and RIPv2 +Describes the split-horizon rule and how it affects 480 RIPv2 +Discusses how an ACL can affect RIP routing 485 updates +Sample output of the RIPng database 492 + +Describes how to verify various RIPng parameters 493 with the show ipv6 rip command. +Verifying maximum paths for load balancing 495 + + + + + +From the Library of Outcast Outcast +510 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Key Topic Element Paragraph + +Paragraph + +Paragraph + +Description +Describes how to troubleshoot default routing with RIPng +Discusses how an IPv6 ACL can affect RIPng routing updates +Describes how RIPng is enabled on an interface + +Page Number 495 + +496 + +497 + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +RIPv2, RIPng, network command, passive interface, hop count, split horizon, auto-summarization, maximum paths + +Command Reference to Check Your Memory + +This section includes the most important show and debug commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 13-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot the topics and concepts covered in this chapter. + +Table 13-3 show and debug commands + +Task Command Syntax + +Displays all RIPv1 and v2 routes learned from neighboring RIP-enabled routers. +Displays the RIPv1 and v2 routes that have been installed in the routing table. +Displays various parameters for the routing protocols running on the router. For RIPv1 and v2, it will display the following: outgoing and incoming update filters, timers, interfaces participating in the routing process, any key chains applied for authentication, the status of +automatic summarization, the number of paths used for load balancing, passive interfaces, routers routes have been learned from, and AD. + + +show ip rip database + +show ip route rip + +show ip protocols + + + + +From the Library of Outcast Outcast +Chapter 13: Troubleshooting RIPv2 and RIPng 511 + + +Task Command Syntax +Displays the key chains configured on the router show key chain along with the key IDs and key strings. It will +also identify when the key is valid. + +Displays various IPv4 parameters of an interface. show ip interface interface_type For RIP, it helps identify whether split horizon is interface_number +enabled, the multicast group the interface joined (224.0.0.9), and whether any ACLs are applied to an interface. + +Displays all RIPng routes learned from neighboring RIP enabled routers. +Displays the RIPng routes that have been installed in the routing table. +Displays various parameters for the RIPng routing processes running on the router. It displays the port used by RIPng, the multicast group, AD, maximum paths, timers, split horizon, whether a default route is being generated, interfaces participating in the routing process, and redistribution. +Displays the next-hop IPv6 addresses used to reach networks learned through RIPng. +Used to debug all RIPv1 and RIPv2 packets that are being sent and received by a router. +Used to debug all RIPng packets that are being sent and received by a router. + + +show ipv6 rip database + +show ipv6 route rip + +show ipv6 rip + + + + + + +show ipv6 rip next-hops + +debug ip rip + +debug ipv6 rip + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting EIGRP for IPv4: This section covers the reasons why EIGRP for IPv4 neighbor relationships are not being formed and how you can identify them. In addition, you will explore the rea-sons why EIGRP for IPv4 routes might be missing and how to determine why they are missing. + +■ EIGRP for IPv4 Trouble Tickets: This section pro-vides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + +■ Troubleshooting EIGRP for IPv6: This section covers the reasons why EIGRP for IPv6 neighbor relationships are not being formed and how you can identify them. In addition, you will explore the rea-sons why EIGRP for IPv6 routes might be missing and how to determine why they are missing. + +■ EIGRP for IPv6 Trouble Tickets: This section pro-vides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + +■ Troubleshooting Named EIGRP Configurations: In this section you discover the new show commands that you can use to troubleshoot named EIGRP con-figurations. + +■ Named EIGRP Trouble Tickets: This section pro-vides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + + + + + + + +From the Library of Outcast Outcast +CHAPTER 14 + + + + + + +Troubleshooting EIGRP + + +The Cisco Enhanced Interior Gateway Routing Protocol (EIGRP) is considered an advanced distance vector routing protocol. Specifically, EIGRP advertises routes to directly attached neighbors, like a distance vector routing protocol, while forming neigh-bor relationships, similar to a link-state routing protocol. + +EIGRP can route for both IPv4 and IPv6 protocols. This chapter focuses on troubleshoot-ing both of these protocols using the classic configurations and the newer named EIGRP configurations. + +Before any routes can be exchanged between EIGRP routers on the same LAN or across a WAN, an EIGRP neighbor relationship has to be formed. There are many reasons why a neighbor relationship will not form, and as a troubleshooter, you need to be aware of +them. This chapter dives deep into these issues and gives you the tools needed to identify them and successfully solve neighbor issues. + +Once neighbor relationships are formed, neighboring routers exchange EIGRP routes. In various cases, routes may end up missing, and you need to be able to determine why the routes are missing. This chapter discusses the various ways that routes could go missing and how you can identify them and solve any route-related issue. + +In this chapter, you also learn how to troubleshoot issues related to load balancing, sum-marization, discontiguous networks, and feasible successors. + +“Do I Know This Already?” Quiz +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 14-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 14-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting EIGRP for IPv4 + +Troubleshooting EIGRP for IPv6 + +Troubleshooting named EIGRP Configurations + +Questions +1–7 + +8–10 + +11 + + + + +From the Library of Outcast Outcast +514 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which command enables you to verify the routers that have formed an EIGRP adja-cency with the local router, how long they have been neighbors for, and the current sequence number of EIGRP packets? +a. show ip eigrp interfaces + +b. show ip eigrp neighbors + +c. show ip route eigrp + +d. show ip protocols + +2. Which three of the following are reasons EIGRP neighbor relationships might not form? + +a. Different autonomous system numbers + +b. Different K values + +c. Different timers + +d. Different authentication parameters + +3. Which command enables you to verify the configured EIGRP K values? + +a. show ip protocols + +b. show ip eigrp interfaces + +c. show ip eigrp neighbor + +d. show ip eigrp topology + +4. Which command enables you to verify EIGRP authentication, split-horizon, and con-figured EIGRP timers? + +a. show ip interfaces + +b. show ip protocols + +c. show ip eigrp interfaces detail + +d. show ip eigrp neighbor + + + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 515 + +5. Besides a neighbor relationship not being formed, which three of the following are reasons why routes might be missing in your EIGRP autonomous system? + +a. Interface not participating in the EIGRP process + +b. Filters + +c. Incorrect stub configuration + +d. Passive interface feature + +6. Which command enables you to verify whether any route filters have been applied to an EIGRP enabled interface? + +a. show ip interface brief + +b. show ip interface + +c. show ip protocols + +d. show ip eigrp interface + +7. Which command enables you to verify the maximum paths configured for load bal-ancing and whether unequal path load balancing has been enabled? + +a. show ip protocols + +b. show ip eigrp interfaces + +c. show ip eigrp neighbors + +d. show ip interfaces + +8. Which EIGRP for IPv6 command is used to verify whether any interfaces have been configured as passive interfaces? + +a. show ipv6 protocols + +b. show ipv6 eigrp interface detail + +c. show ipv6 eigrp neighbor detail + +d. show ipv6 eigrp topology + +9. Which EIGRP for IPv6 command enables you to verify whether the local router is a stub router? + +a. show ipv6 protocols + +b. show ipv6 eigrp interface detail + +c. show ipv6 eigrp neighbor detail + +d. show ipv6 eigrp topology + + + + + + + +From the Library of Outcast Outcast +516 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10. Which EIGRP for IPv6 command enables you to verify whether a neighboring router is a stub router? + +a. show ipv6 protocols + +b. show ipv6 eigrp interface detail + +c. show ipv6 eigrp neighbor detail + +d. show ipv6 eigrp topology + +11. What are two ways that you can verify which interfaces are participating in the named EIGRP IPv4 address family? + +a. show ip eigrp interfaces + +b. show eigrp address-family ipv4 interfaces + +c. show ipv6 eigrp interfaces + +d. show eigrp address-family ipv6 interfaces + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 517 + +Foundation Topics + + +Troubleshooting EIGRP for IPv4 + +EIGRP establishes neighbor relationships by sending hello packets to the multicast address 224.0.0.10 out interfaces participating in the EIGRP process. To enable the EIGRP process on an interface, you use the network ip_address wildcard_mask command in router EIGRP configuration mode. For example, the following network command enables EIGRP on all interfaces with an IP address from 10.1.1.0 through 10.1.1.255: network 10.1.1.0 0.0.0.255. The following network command enables the EIGRP process on only the interface with the IP address 10.1.1.65: network 10.1.1.65 0.0.0.0. It seems rather simple, and it is; however, there are many reasons why a neighbor relationship may not form, and you need to be aware of all of them if you plan on successfully troubleshoot-ing EIGRP-related problems. + +After establishing a neighbor relationship, an EIGRP router performs a full exchange of routing information with the newly established neighbor. After the full exchange, only updates to route information are exchanged with that neighbor. Routing informa-tion learned from EIGRP neighbors is inserted into the EIGRP topology table. If the +EIGRP information for a specific route happens to be the best source of information, it is installed in the routing table. There are various reasons as to why EIGRP routes might be missing from either the topology table or the routing table, and you need to be aware of all of them if you plan on successfully troubleshooting EIGRP route-related problems. + +This section focuses on the reasons why an EIGRP neighbor relationship might not form and how you can identify them during the troubleshooting process. In addition, we examine the reasons why EIGRP routes might be missing, and how we can determine the reason why they are missing. To wrap up the section, we troubleshoot EIGRP issues that do not fall into the neighbor relationship or route categories. + +Troubleshooting EIGRP for IPv4 Neighbor Adjacencies + +To verify EIGRP neighbors, you use the show ip eigrp neighbors command. In Example 14-1, you can see sample output of the show ip eigrp neighbors command. It lists the IPv4 address of the neighboring device’s interface that sent the hello packet, the local interface on the router used to reach that neighbor, how long the local router will con-sider the neighboring router to be a neighbor, how long the routers have been neighbors for, the amount of time it takes for the neighbors to communicate on average, the number of EIGRP packets in a queue waiting to be sent to a neighbor (which should always be zero since we want up-to-date routing information), and a sequence number to keep track of the EIGRP packets received from the neighbor to ensure that only newer packets are accepted and processed. + + + + + + +From the Library of Outcast Outcast +518 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-1 Verifying EIGRP Neighbors with show ip eigrp neighbors + +R2#show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq (sec) (ms) Cnt Num + +1 10.1.23.3 Gi1/0 +0 10.1.12.1 Gi0/0 + +14 10:01:09 72 432 0 3 +11 10:32:14 75 450 0 8 + + +Here is a listing of reasons why an EIGRP neighbor relationship might not form: + +■ Interface is down: The interface has to be up/up. +Key +Topic ■ Mismatched autonomous system numbers: Both routers need to be in the same +autonomous system. + +■ Incorrect network statement: The network statement must identify the IP address of the interface you want to include in the EIGRP process. + +■ Mismatched K values: Both routers must be using the exact same K values. + +■ Passive interface: The passive interface feature suppresses the sending and receiving of hello packets while still allowing the interfaces network to be advertised. + +■ Different subnets: The exchanging of hello packets must be done on the same sub-net; if not, the hello packets are ignored. + +■ Authentication: If authentication is being used, the key ID and key string must match, in addition to when the key is valid (if configured). + +■ ACL: An access control list (ACL) that is denying packets to the EIGRP multicast address 224.0.0.10. + +■ Timers: Timers do not have to match; however, if they are not configured correctly, your neighbor adjacencies will flap. + +When an EIGRP neighbor relationship does not form, the neighbor is not listed in the neighbor table. Therefore, you will need the assistance of an accurate network diagram and the show cdp neighbors command to verify who should be the neighbors. + +When troubleshooting EIGRP, you need to be aware of how to verify the parameters associated with each reason listed. Let’s look at them individually. + +Interface Is Down + +The interface has to be up if you plan on forming an EIGRP neighbor adjacency. As you have seen already, you can verify the status of an interface with the show ip interface brief command. + +Mismatched Autonomous System Numbers + +For an EIGRP neighbor relationship to be formed, both routers need to be in the same autonomous system. The autonomous system number is specified when you issue the + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 519 + +router eigrp autonomous_system_number command in global configuration mode. If both routers are in different autonomous systems, they will not form an EIGRP neighbor relationship. Most EIGRP show commands will display the autonomous system number in the output. However, the best one is show ip protocols, which displays an incredible amount of information for troubleshooting, as shown in Example 14-2. In this example, you can verify that R1 is participating in EIGRP autonomous system 100. Using the spot-the-difference method, you can compare the autonomous system value listed to the value on a neighboring router to determine whether it differs. + +Example 14-2 Verifying the Autonomous System Number with show ip protocols Key +Topic R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.1.1/32 +10.1.12.1/32 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +90 + +Last Update +09:54:36 + +Distance: internal 90 external 170 + +When using the debug eigrp packet command, as shown in Example 14-3, the debug output will show that the router is not receiving any hello packets from the neighbors with the mismatched autonomous system number. In this example, R1 is sending hello packets out Gig0/0 and Gig1/0. However, it is not receiving any hello packets. This could be because of an autonomous system mismatch. The local router could have the wrong autonomous system number, or the remote routers could have the wrong autonomous system number. + + + +From the Library of Outcast Outcast +520 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-3 Sample Output of debug eigrp packet When an Autonomous System Mismatch Exists + +R1#debug eigrp packets +(UPDATE, REQUEST, QUERY, REPLY, HELLO, UNKNOWN, PROBE, ACK, STUB, SIAQUERY, SIAREPLY) +EIGRP Packet debugging is on +R1# +EIGRP: Sending HELLO on Gi0/0 - paklen 20 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +R1# +EIGRP: Sending HELLO on Gi1/0 - paklen 20 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +R1# +EIGRP: Sending HELLO on Gi0/0 - paklen 20 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +R1#l +EIGRP: Sending HELLO on Gi1/0 - paklen 20 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +R1#l +EIGRP: Sending HELLO on Gi0/0 - paklen 20 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +R1#u all +All possible debugging has been turned off + + +Incorrect Network Statement + +If the network command is misconfigured, EIGRP may not be enabled on the proper interfaces, and as a result, hello packets will not be sent and neighbor relationships will not be formed. You can verify the interfaces that are participating in the EIGRP process with the command show ip eigrp interfaces, as shown in Example 14-4. In this output, you can see that two interfaces are participating in the EIGRP process for autonomous system 100. Gi0/0 does not have an EIGRP peer, and Gi1/0 does have an EIGRP peer. This is expected because there are no other routers reachable out Gi0/0. However, if you expect an EIGRP peer out the interface based on your documentation, you would need to troubleshoot why the peering/neighbor relationship is not forming. Shift your atten-tion to the Pending Routes column. Notice all interfaces are listed as 0. This is expected. Any other value in this column means that some issue on the network is preventing the interface from sending the necessary updates to the neighbor. For example, it might be congestion. + + +Note Remember that EIGRP passive interfaces do not show up in this output. + + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 521 + + + +Key Topic + +Example 14-4 Verifying EIGRP Interfaces with show ip eigrp interfaces R2#show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(100) + +Xmit Queue PeerQ Mean Pacing Time Multicast Pending +Interface Peers Un/Reliable Un/Reliable SRTT Un/Reliable Flow Timer Routes +Gi0/0 0 0/0 0/0 0 0/0 0 0 +Gi1/0 1 0/0 0/0 78 0/0 300 0 + +The output of show ip protocols displays the interfaces that are running EIGRP as a result of the network commands. It is not obvious at first unless someone tells you, like I just did. The reason it is not obvious is that it is not displayed properly. Focus on the highlighted text in Example 14-5. Notice that it states Routing for Networks. Those are not the networks we are routing for. We are routing for the networks associated with the interface EIGRP will be enabled on based on the network commands. In this case, 10.1.1.1/32 really means network 10.1.1.1 0.0.0.0 and 10.1.12.1/32 really means network 10.1.12.1 0.0.0.0. Therefore, a better option is using the show run | section router eigrp command, as displayed in Example 14-6. + +Example 14-5 Verifying Network Statements with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Default networks flagged in outgoing updates +Default networks accepted from incoming updates EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 Maximum path: 4 +Maximum hopcount 100 Maximum metric variance 1 + +Automatic Summarization: disabled Maximum path: 4 +Routing for Networks: 10.1.1.1/32 10.1.12.1/32 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +90 + +Last Update +09:54:36 + +Distance: internal 90 external 170 + + + + +From the Library of Outcast Outcast +522 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-6 Verifying network Statements with show run | section router eigrp + +R1#show run | s router eigrp +router eigrp 100 +network 10.1.1.1 0.0.0.0 +network 10.1.12.1 0.0.0.0 + +As you can see, the network statement is extremely important. If it is misconfigured, interfaces that should be participating in the EIGRP process might not be, and interfaces that should not be participating in the EIGRP process might be. So, you should be able to recognize issues related to the network statement. + +When using the debug eigrp packet command on the router with the misconfigured or missing network statement, you will notice that hello packets are not being sent out the interface that they should be. For example, if you expect hello packets to be sent out Gig1/0 but the debug eigrp packet command is not indicating so, it is possible that the interface is not participating in the EIGRP process because of a bad network statement. + +Mismatched K Values + +The K values, which are used during the metric calculation, must match between neigh-bors to form an adjacency. You can verify whether K values match with show ip proto-cols, as shown in Example 14-7. The default K values are highlighted in Example 14-7. Usually there is no need to change the K values. However, if they are changed, make them match on every router in the autonomous system. You can use the spot-the-difference method when determining whether K values do not match between routers. In addition, +if you are logging syslog messages with a severity level of 5, you will receive a message similar to the following: + +%DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 10.1.12.2 (GigabitEthernet1/0) is down: K-value mismatch + +Example 14-7 Verifying K Values with show ip protocols +Key +Topic R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 523 + +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.1.1/32 +10.1.12.1/32 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +90 + +Last Update +09:54:36 + +Distance: internal 90 external 170 + + +Passive Interface + +The passive interface feature is a must have for all organizations. It does two things: + +■ Reduces the EIGRP related traffic on a network + +■ Improves EIGRP security + +The passive interface feature turns off the sending and receiving of EIGRP packets on an interface while still allowing the interfaces network ID to be injected into the EIGRP pro-cess and advertised to other EIGRP neighbors. This ensures that rogue routers attached to the LAN will not be able to form an adjacency with your legitimate router on that interface, because it is not sending or receiving EIGRP packets on the interface. However, if you configure the wrong interface as passive, a legitimate EIGRP neighbor relationship will not be formed. As shown in the show ip protocols output of Example 14-8, Gigabit Ethernet 0/0 is a passive interface. If there are no passive interfaces, the passive interface section does not appear in the show ip protocols output. + +Key Example 14-8 Verifying Passive Interfaces with show ip protocols Topic R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Topology : 0 (base) + + + + +From the Library of Outcast Outcast +524 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.1.1/32 +10.1.12.1/32 +Passive Interface(s): +GigabitEthernet0/0 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +90 + +Last Update +11:00:14 + +Distance: internal 90 external 170 + +Remember, for EIGRP, passive interfaces will not appear in the EIGRP interface table. There-fore, before you jump to the conclusion that the wrong network command was used and the interface has not been enabled for EIGRP, check to see whether the interface is passive. + +When using the debug eigrp packet command on the router with the passive interface, you will notice that hello packets are not being sent out that interface. For example, if you expect hello packets to be sent out Gig1/0 but the debug eigrp packet command is not indicating so, it is possible that interface is participating in the EIGRP process but is configured as a passive interface. + +Different Subnets + +To form an EIGRP neighbor adjacency, the router interfaces must be on the same subnet. You can confirm this in many ways. The simplest way is to look at the interface configu-ration in the running configuration with the show run interface interface_type inter-face_number command. Example 14-9 displays the configuration of Gig1/0 on R1 and Gig0/0 on R2. Are they in the same subnet? Yes! Based on the IP address and the subnet mask, they would both be in the 10.1.12.0/24 subnet. However, if they are not in the same subnet and you have syslog setup for a severity level of 6, a message similar to the follow-ing will be displayed: + +%DUAL-6-NBRINFO: EIGRP-IPv4 100: Neighbor 10.1.21.2 (GigabitEthernet1/0) is blocked: not on common subnet (10.1.12.1/24) + +Example 14-9 Verifying IPv4 Addresses and Masks on Router Interfaces + +R1#show running-config interface gigabitEthernet 1/0 +Building configuration... + +Current configuration : 90 bytes +! + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 525 + +interface GigabitEthernet1/0 +ip address 10.1.12.1 255.255.255.0 +negotiation auto +end + +R2#show running-config interface gigabitEthernet 0/0 +Building configuration... + +Current configuration : 132 bytes +! +interface GigabitEthernet0/0 +ip address 10.1.12.2 255.255.255.0 +negotiation auto +end + + + + + +Key Topic + +Authentication + +Authentication is used to ensure that your EIGRP routers only form neighbor relation-ships with legitimate routers and that they only accept EIGRP packets from legitimate routers. Therefore, if authentication is implemented, both routers must agree on the set-tings for a neighbor relationship to form. With authentication, you can use the spot-the-difference method. Example 14-10 is displaying the output of the commands show run interface interface_type interface_number and show ip eigrp interface detail interface_ type interface_number, which will identify whether EIGRP authentication is enabled on the interface. According to the highlighted text, it is. Note that the authentication must be on the correct interface and that it must be tied to the correct autonomous system number. If you put in the wrong autonomous system number, it will not be enabled for the correct autonomous system. In addition, make sure that you specify the correct key chain that will be used for the message digest 5 (MD5) authentication hash. You can verify the key chain with the command show key chain, as shown in Example 14-11. The keys in this example do not expire. However, if you have implemented rotating keys, the +keys must be valid for authentication to be successful. + + +Example 14-10 Verifying EIGRP Authentication on an Interface + +R1#show run interface gig 1/0 +Building configuration... + +Current configuration : 178 bytes +! +interface GigabitEthernet1/0 +ip address 10.1.12.1 255.255.255.0 +ip authentication mode eigrp 100 md5 +ip authentication key-chain eigrp 100 EIGRP_AUTH +negotiation auto +end + + + + +From the Library of Outcast Outcast +526 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +R1#show ip eigrp interfaces detail gigabitEthernet 1/0 +EIGRP-IPv4 Interfaces for AS(100) + + +Interface +Gi1/0 + +Xmit Queue +Peers Un/Reliable +1 0/0 + +PeerQ +Un/Reliable +0/0 + +Mean Pacing Time +SRTT Un/Reliable +87 0/0 + +Multicast +Flow Timer +376 + +Pending +Routes +0 + +Hello-interval is 5, Hold-time is 15 +Split-horizon is enabled +Next xmit serial +Packetized sent/expedited: 2/0 +Hello's sent/expedited: 17/2 +Un/reliable mcasts: 0/3 Un/reliable ucasts: 2/2 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 +Retransmissions sent: 1 Out-of-sequence rcvd: 1 +Topology-ids on interface - 0 +Authentication mode is md5, key-chain is "EIGRP_AUTH" + + +Example 14-11 Verifying the Key Chain Used for EIGRP Authentication + +R1#show key chain +Key-chain EIGRP_AUTH: +key 1 -- text "TSHOOT" +accept lifetime (always valid) - (always valid) [valid now] +send lifetime (always valid) - (always valid) [valid now] + +Inside the key chain you find the key ID (1 in this case) and the key string (TSHOOT in this case). It is mandatory that the key ID in use and the key string in use between neigh-bors match. Therefore, if you have multiple keys and key strings in a chain, the same key and string must be used at the same time by both routers (meaning they must be valid and in use); otherwise, authentication will fail. + +When using the debug eigrp packets command for troubleshooting authentication, you will receive different output based on the authentication issue. Example 14-12 displays what message is generated when the neighbor is not configured for authentication. It ignores that packet and states “(missing authentication).” When the key IDs or the key strings do not match between the neighbors, the debug output states “(invalid authentica-tion),” as shown in Example 14-13. + +Example 14-12 Example debug Output When Authentication Is Missing on Neighbor + +R1#debug eigrp packets +(UPDATE, REQUEST, QUERY, REPLY, HELLO, UNKNOWN, PROBE, ACK, STUB, SIAQUERY, SIAREPLY) +EIGRP Packet debugging is on +R1# +EIGRP: Sending HELLO on Gi1/0 - paklen 60 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 527 + +EIGRP: Gi1/0: ignored packet from 10.1.12.2, opcode = 5 (missing authentication) +EIGRP: Sending HELLO on Gi0/0 - paklen 20 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +R1#u all +All possible debugging has been turned off + + +Example 14-13 Example Debug Output When Key IDs or Key Strings Do Not Match + +R1#debug eigrp packets +(UPDATE, REQUEST, QUERY, REPLY, HELLO, UNKNOWN, PROBE, ACK, STUB, SIAQUERY, SIAREPLY) +EIGRP Packet debugging is on +R1# +EIGRP: pkt authentication key id = 2, key not defined +EIGRP: Gi1/0: ignored packet from 10.1.12.2, opcode = 5 (invalid authentication) +EIGRP: Sending HELLO on Gi0/0 - paklen 20 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +EIGRP: Sending HELLO on Gi1/0 - paklen 60 +AS 100, Flags 0x0:(NULL), Seq 0/0 interfaceQ 0/0 iidbQ un/rely 0/0 +R1#u all +All possible debugging has been turned off + + +ACLs + +Access control lists are extremely powerful. How they are implemented will determine what they are controlling in your network. If there is an ACL applied to an interface and the ACL is denying EIGRP packets, a neighbor relationship will not form. To determine whether an ACL is applied to an interface, use the show ip interface interface_type interface_number command, as shown in Example 14-14. Notice that ACL 100 is applied inbound on interface Gig 1/0. To verify the ACL 100 entries, issue the command show access-list 100, as shown in Example 14-15. In this case, you can see that ACL 100 is denying EIGRP traffic, which would prevent a neighbor relationship from forming. + +Example 14-14 Verifying ACLs Applied to Interfaces + +R1#show ip interface gig 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet address is 10.1.12.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is 100 +Proxy ARP is enabled + + + +From the Library of Outcast Outcast +528 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled + + +Example 14-15 Verifying ACL Entries + +R1#show access-lists 100 +Extended IP access list 100 +10 deny eigrp any any (62 matches) +20 permit ip any any + + +Timers + +Although EIGRP timers do not have to match, if the timers are skewed enough, the adja-cency will flap. For example, suppose that R1 is using the default timers of 5 and 15, while R2 is sending hello packets every 20 seconds. R1’s hold time will expire before it receives another hello packet from R2 terminating the neighbor relationship. Five seconds later, the hello packet arrives, and the neighbor relationship is formed, only to be termi-nated 15 seconds later. + +Although timers do not have to match, it is important that each router sends hello packets at a rate that is faster than the hold timer. You can verify the configured timers with the show ip eigrp interfaces detail command, as shown earlier in Example 14-10. + +Troubleshooting EIGRP for IPv4 Routes + +EIGRP only learns from directly connected neighbors, making it easy to follow the path of routes when troubleshooting. For example, if R1 does not know about the route but its neighbor does, there is more than likely something wrong between the neighbors. However, if the neighbor does not know about it either, you can focus on the neighbors’ neighbor and so on. + +As we have discussed already, neighbor relationships are the foundation for EIGRP infor-mation sharing. If we have no neighbors, we will not learn any routes. So, besides the lack of a neighbor, what would be reasons for missing routes in an EIGRP network? Following is a listing of some common reasons as to why EIGRP routes might be missing either in the topology table or the routing table: + + +■ +Key Topic + + +■ + + +■ + +Bad or missing network command: The network command enables the EIGRP pro-cess on an interface and injects the network the interface is part of into the EIGRP process. + +Better source of information: If the exact same network is learned from a more reli-able source, it is used instead of the EIGRP learned information. + +Route filtering: A filter might be set up that is preventing a route from being adver- +tised or learned. + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 529 + +■ Stub configuration: If the wrong setting is chosen during the stub router configura-tion, or the wrong router is chosen as the stub router, you might prevent a network from being advertised. + +■ Interface is shut down: The EIGRP enabled interface must be up/up for the network associated with the interface to be advertised. + +■ Split-horizon: Loop-prevention feature that prevents a router from advertising routes out the same interface they were learned on. + +Let’s take a look at each of these individually and identify how to recognize them during the troubleshooting process. + +Bad or Missing Network Command + +When you use the network command, the EIGRP process is enabled on the interfaces that fall within the range of IP addresses identified by the command. EIGRP then takes the network/subnet the interface is part of and injects it into the topology table so that it can be advertised to other routers in the autonomous system. Therefore, even interfaces that will not form neighbor relationships with other routers need a valid network state-ment that will enable EIGRP on those interfaces so the networks the interfaces belong +to will be injected into the EIGRP process and advertised. If the network statement is missing or configured incorrectly, EIGRP will not be enabled on the interface, and the network the interface belongs to will not be advertised. + +As discussed in an earlier section, the output of show ip protocols displays the network statements in a nonintuitive way. Focus on the highlighted text in Example 14-16. Notice that it states Routing for Networks. Those are not the networks we are routing for. We are routing for the networks associated with the interface EIGRP will be enabled on based on the network statement. In this case, 10.1.1.1/32 really means network 10.1.1.1 0.0.0.0, and 10.1.12.1/32 really means network 10.1.12.1 0.0.0.0. + +Example 14-16 Verifying network Statements with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 + + + +From the Library of Outcast Outcast +530 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.1.1/32 +10.1.12.1/32 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +90 + +Last Update +09:54:36 + +Distance: internal 90 external 170 + +So what networks are we actually routing for then? The networks associated with the interfaces that are now enabled for EIGRP. In Example 14-17, you can see the output of the show ip interface command on R1 for Gig0/0 and Gig1/0, which was piped to only include the Internet address. Notice that they are in a /24 network. As a result, the net-work IDs would be 10.1.1.0/24 and 10.1.12.0/24. Those are the networks we are routing for. + +Example 14-17 Verifying Network IDs with show ip interface + +R1#show ip interface gi0/0 | i Internet +Internet address is 10.1.1.1/24 +R1#show ip interface gi1/0 | i Internet +Internet address is 10.1.12.1/24 + +Therefore, if you expect to route for the network 10.1.1.0/24 or 10.1.12.0/24, as in this case, you better have a network statement that enables the EIGRP process on the router interfaces in those networks. + +You can confirm which interfaces are participating in the EIGRP process with the show ip eigrp interfaces command, as shown earlier. + +Better Source of Information + +For an EIGRP-learned route to be installed in the routing table, it has to be the most trusted routing source. Recall that this is based on administrative distance (AD). EIGRP’s AD is 90 for internally learned routes (networks inside the autonomous system) and 170 for externally learned routes (networks outside the autonomous system). Therefore, if there is another source that is educating the same router about the exact same network and that source has a better AD, the source with the better AD wins, and its informa-tion will be installed in the routing table. Compare Example 14-18, which is an EIGRP topology table, and Example 14-19, which is the routing table displaying only the EIGRP installed routes on the router. Focus on the highlighted networks of the topology table. Do you see them listed as EIGRP routes in the routing table? + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 531 + +Example 14-18 Sample show ip eigrp topology Command Output + +Router#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(192.4.4.4) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 172.16.33.8/30, 2 successors, FD is 2681856 +via 172.16.33.6 (2681856/2169856), Serial1/0 +via 172.16.33.18 (2681856/2169856), Serial1/2 +P 10.1.34.0/24, 1 successors, FD is 2816 +via Connected, GigabitEthernet2/0 +P 192.7.7.7/32, 1 successors, FD is 2300416 +via 172.16.33.5 (2300416/156160), Serial1/0 +via 172.16.33.6 (2809856/2297856), Serial1/0 +via 172.16.33.18 (2809856/2297856), Serial1/2 +P 192.4.4.4/32, 1 successors, FD is 128256 +via Connected, Loopback0 +P 172.16.33.16/30, 1 successors, FD is 2169856 +via Connected, Serial1/2 +P 172.16.32.0/25, 2 successors, FD is 2172416 +via 172.16.33.6 (2172416/28160), Serial1/0 +via 172.16.33.18 (2172416/28160), Serial1/2 +P 10.1.23.0/24, 1 successors, FD is 3072 +via 10.1.34.3 (3072/2816), GigabitEthernet2/0 +P 203.0.113.0/30, 1 successors, FD is 28160 +via Connected, FastEthernet3/0 +P 192.5.5.5/32, 1 successors, FD is 2297856 +via 172.16.33.5 (2297856/128256), Serial1/0 +P 192.3.3.3/32, 1 successors, FD is 130816 +via 10.1.34.3 (130816/128256), GigabitEthernet2/0 +P 192.2.2.2/32, 1 successors, FD is 131072 +via 10.1.34.3 (131072/130816), GigabitEthernet2/0 +P 10.1.13.0/24, 1 successors, FD is 3072 +via 10.1.34.3 (3072/2816), GigabitEthernet2/0 +P 0.0.0.0/0, 1 successors, FD is 28160 +via Rstatic (28160/0) +P 192.1.1.1/32, 1 successors, FD is 131072 +via 10.1.34.3 (131072/130816), GigabitEthernet2/0 +P 172.16.32.192/29, 1 successors, FD is 2174976 +via 172.16.33.5 (2174976/30720), Serial1/0 +via 172.16.33.6 (2684416/2172416), Serial1/0 +via 172.16.33.18 (2684416/2172416), Serial1/2 +P 198.51.100.0/30, 1 successors, FD is 28416 +via 10.1.34.3 (28416/28160), GigabitEthernet2/0 +P 172.16.33.12/30, 1 successors, FD is 2172416 + + + + +From the Library of Outcast Outcast +532 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +via 172.16.33.5 (2172416/28160), Serial1/0 +P 192.6.6.6/32, 2 successors, FD is 2297856 +via 172.16.33.6 (2297856/128256), Serial1/0 +via 172.16.33.18 (2297856/128256), Serial1/2 +P 172.16.33.0/29, 1 successors, FD is 2169856 +via Connected, Serial1/0 +P 10.1.1.0/26, 1 successors, FD is 3328 +via 10.1.34.3 (3328/3072), GigabitEthernet2/0 +P 172.16.32.128/26, 1 successors, FD is 2172416 +via 172.16.33.5 (2172416/28160), Serial1/0 + + +Example 14-19 Sample show ip route eigrp Command Output + +Router#show ip route eigrp +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 203.0.113.1 to network 0.0.0.0 + +10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks +D 10.1.1.0/26 [90/3328] via 10.1.34.3, 00:49:19, GigabitEthernet2/0 +D 10.1.13.0/24 [90/3072] via 10.1.34.3, 00:49:22, GigabitEthernet2/0 +D 10.1.23.0/24 [90/3072] via 10.1.34.3, 00:49:22, GigabitEthernet2/0 +172.16.0.0/16 is variably subnetted, 9 subnets, 5 masks +D 172.16.32.0/25 [90/2172416] via 172.16.33.18, 00:49:22, Serial1/2 +[90/2172416] via 172.16.33.6, 00:49:22, Serial1/0 +D 172.16.32.128/26 [90/2172416] via 172.16.33.5, 00:49:23, Serial1/0 +D 172.16.32.192/29 [90/2174976] via 172.16.33.5, 00:49:23, Serial1/0 +D 172.16.33.8/30 [90/2681856] via 172.16.33.18, 00:49:22, Serial1/2 +[90/2681856] via 172.16.33.6, 00:49:22, Serial1/0 +D 172.16.33.12/30 [90/2172416] via 172.16.33.5, 00:49:23, Serial1/0 +192.1.1.0/32 is subnetted, 1 subnets +D 192.1.1.1 [90/131072] via 10.1.34.3, 00:49:19, GigabitEthernet2/0 +192.2.2.0/32 is subnetted, 1 subnets +D 192.2.2.2 [90/131072] via 10.1.34.3, 00:49:19, GigabitEthernet2/0 +192.3.3.0/32 is subnetted, 1 subnets +D 192.3.3.3 [90/130816] via 10.1.34.3, 00:49:22, GigabitEthernet2/0 +192.5.5.0/32 is subnetted, 1 subnets +D 192.5.5.5 [90/2297856] via 172.16.33.5, 00:49:23, Serial1/0 +192.6.6.0/32 is subnetted, 1 subnets + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 533 + +D 192.6.6.6 [90/2297856] via 172.16.33.18, 00:49:22, Serial1/2 +[90/2297856] via 172.16.33.6, 00:49:22, Serial1/0 +192.7.7.0/32 is subnetted, 1 subnets +D 192.7.7.7 [90/2300416] via 172.16.33.5, 00:49:23, Serial1/0 +198.51.100.0/30 is subnetted, 1 subnets +D 198.51.100.0 [90/28416] via 10.1.34.3, 00:49:22, GigabitEthernet2/0 + +None of the highlighted routes in Example 14-18 appear in the routing table as EIGRP routes. In this case, there is a better source for the same information. Example 14-20, which displays the output of the show ip route 172.16.33.16 255.255.255.252 com-mand, identifies that this network is directly connected and has an AD of 0. Because a directly connected network has an AD of 0 and an internal EIGRP route has an AD of 90, the directly connected source is installed in the routing table. Refer back to Example 14-18 and focus on the 0.0.0.0/0 route. Notice that it says Rstatic, which means that the route was redistributed from a static route on this router. Therefore, there is a static default route on the local router with a better AD than the EIGRP default route, which would have an AD of 170. As a result, the EIGRP 0.0.0.0/0 route would not be installed in the routing table, the static default route would be. + +Example 14-20 Sample show ip route 172.16.33.16 255.255.255.252 Command Output + +Router#show ip route 172.16.33.16 255.255.255.252 +Routing entry for 172.16.33.16/30 +Known via "connected ", distance 0 , metric 0 (connected, via interface) +...output omitted... + + + +Key Topic + +Having a better source of routing information may not cause users to complain or submit a trouble ticket because they will probably still be able to access the resources they need to. However, it may be causing suboptimal routing in your network. Review Figure 14-1, which shows a network running two different routing protocols. In this case, which path will be used to send traffic from PC1 to 10.1.1.0/24? If you said the longer EIGRP path, you are correct. Even though it is quicker to use the Open Shortest Path First (OSPF) +path, EIGRP wins by default because it has the lower AD, and suboptimal routing occurs. + + + +EIGRP + +1Gig 1Gig + +1Gig 1Gig + +10.1.1.0/24 OSPF PC1 +10 Gig + + +Figure 14-1 Using EIGRP Path Which Is Suboptimal + +Being able to recognize when a certain routing source should be used and when it should not be used is key to optimizing your network and reducing the number of troubleshoot- + + +From the Library of Outcast Outcast +534 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +ing instances related to “the network is slow.” In this case, we might want to consider increasing the AD of EIGRP or lowering the AD of OSPF to optimize routing. + +Route Filtering + +A distribute list applied to an EIGRP process controls which routes are advertised to neighbors or which routes are received from neighbors. The distribute list is applied in EIGRP configuration mode either inbound or outbound, and the routes sent or received are controlled by ACLs, prefix lists, or route maps. So, when troubleshooting route filter-ing, you need to consider the following: + +■ Is the distribute list applied in the correct direction? Key +Topic ■ Is the distribute list applied to the correct interface? + +■ If the distribute list is using an ACL, is the ACL correct? + +■ If the distribute list is using a prefix list, is the prefix list correct? + +■ If the distribute list is using a route map, is the route map correct? + +The show ip protocols command will identify whether a distribute list is applied to all interfaces or an individual interface, as shown in Example 14-21. This example indicates that there are no outbound filters and that there is an inbound filter on Gig1/0. + +Example 14-21 Verifying Route Filters with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +GigabitEthernet1/0 filtered by 10 (per-user), default is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +...output omitted... + +The inbound filter in Example 14-21 on Gig1/0 is filtering with ACL 10. To verify the entries in the ACL, you must issue the show access-lists 10 command. If a prefix list was applied, you issue the show ip prefix-list command. If a route map was applied you issue the show route-map command. + +As displayed in Example 14-22, you can verify the command that was used to apply the distribute list in the running configuration by reviewing the EIGRP configuration section. + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 535 +Query +Query + +Example 14-22 Verifying EIGRP distribute-list Command + +R1#show run | section router eigrp +router eigrp 100 +distribute-list 10 in GigabitEthernet1/0 +network 10.1.1.1 0.0.0.0 +network 10.1.12.1 0.0.0.0 +passive-interface GigabitEthernet0/0 + + + + + +Key Topic + +Stub Configuration + +The EIGRP stub feature allows you to control the scope of EIGRP queries in the net-work. Figure 14-2 shows the failure of network 192.168.1.0/24 on R1 that causes a query to be sent to R2 and then a query from R2 sent to R3 and R4. However, the query to R3 is not needed because R3 will never have alternate information about the 192.168.1.0/24 network. The query wastes resources. Configuring the EIGRP stub feature on R3 with the eigrp stub command will ensure that R2 never sends a query to R3, as shown in Figure +14-3. + + + + +R4 + + + + +R1 R2 R3 +192.168.1.0/24 +Query Query + +Figure 14-2 Query Scope Without EIGRP Stub Feature + + + +R4 + + + + +R1 R2 R3 + +192.168.1.0/24 +Query + +Do not eigrp stub query R3 + + +Figure 14-3 Query Scope with EIGRP Stub Feature + +This feature comes in handy over slow hub-and-spoke WAN links, as shown in Figure +14-4. It prevents the hub from querying the spokes, which reduces the amount of EIGRP traffic sent over the link. In addition, it reduces the chance of a route being stuck-in-active (SIA). SIA happens when a router does not receive a reply to a query that it sent. + + + +From the Library of Outcast Outcast +536 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Over WANs, this can happen due to congestion and result in the reestablishment of neighbor relationships, which causes convergence, which generates even more EIGRP traffic. Therefore, if we do not query the hubs, we do not have to worry about these issues. + + +R4 eigrp stub + +R2 +Query + + +R1 WAN +192.168.1.0/24 Do not query R2 or R3 + + + +R3 +eigrp stub + + +Figure 14-4 EIGRP Stub Feature over WAN Links + +When configuring the EIGRP stub feature, you can control the routes that the stub router will advertise to its neighbor. By default, it is connected and summary routes. However, you have the option of just connected, summary, redistributed, static, or a combination of them. The other option is to send no routes (receive-only). If the wrong option is cho-sen, the stub routers would not be advertising the correct routes to its neighbors, result-ing in missing routes on the hub and other routers in the topology. In addition, if you configure the wrong router as the stub router (for example, R1 in Figure 14-4), R1 would never fully share all routes it knows about to R4, R2, and R3, resulting in missing routes in the topology. To verify whether the router is a stub router and the routes it will adver-tise, issue the show ip protocols command, as shown in Example 14-23. + +Example 14-23 show ip protocols Command Output on R2 + +R2#show ip protocols +...output omitted... +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 192.1.1.1 +Stub, connected, summary +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +...output omitted... + +To determine whether a neighbor is a stub router and the types of routes it is advertising, issue the command show ip eigrp neighbors detail. Example 14-24 displays the output of show ip eigrp neighbors detail on R1 and indicates that the neighbor is a stub router advertising connected and summary routes. + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 537 + +Example 14-24 Verifying Whether an EIGRP Neighbor Is a Stub Router + +R1#show ip eigrp neighbors detail +EIGRP-IPv4 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.1.13.1 Se1/0 14 00:00:18 99 594 0 11 +Version 11.0/2.0, Retrans: 0, Retries: 0, Prefixes: 2 +Topology-ids from peer - 0 +Stub Peer Advertising (CONNECTED SUMMARY ) Routes +Suppressing queries +...output omitted... + + +Interface Is Shut Down + +As discussed earlier, the network command enables the routing process on an interface. Once the EIGRP process is enabled on the interface, the network the interface is part of (the directly connected entry in the routing table) is injected into the EIGRP process. If the interface is shut down, there is no directly connected entry for the network in the routing table. Therefore, the network does not exist, and there is no network that can be injected into the EIGRP process. The interface has to be up/up for routes to be advertised or for neighbor relationships to be formed. + + + + + +Key Topic + +Split-horizon + +The EIGRP split-horizon rule states that any routes learned inbound on an interface will not be advertised out the same interface. This rule is designed to prevent routing loops. However, this rule presents an issue in certain topologies. Figure 14-5 shows a nonbroad-cast multiaccess (NBMA) Frame Relay hub-and-spoke topology or a dynamic multipoint virtual private network (DMVPN), which both use multipoint interfaces on the hub. The multipoint interface (single physical interface or mGRE tunnel interface) provides con-nectivity to multiple routers in the same subnet out the single interface, like Ethernet. In this figure, R2 is sending an EIGRP update to R1 on the permanent virtual circuit (PVC) or generic routing encapsulation (GRE) tunnel. Because split-horizon is enabled on the Ser1/0 interface or the multipoint GRE tunnel interface on R1, R1 will not advertise the 10.1.2.0/24 network back out that interface. So, R3 will never learn about 10.1.2.0/24. + +To verify whether split-horizon is enabled on an interface, issue the show ip interface interface_type interface_number command, as shown in Example 14-25. In this case, +you can see that split-horizon is enabled. + + + + + + + + + + + +From the Library of Outcast Outcast +538 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +R4 +Se1/0 or mGRE + +R1 192.168.1.0/24 + +EIGRP Update about 10.1.2.0/24 + + +Hub and Spoke Frame Relay or DMVPN + + + + +R2 + +PVC or GRE + + + + + +10.1.2.0/24 + + +10.1.3.0/24 + + + +Split Horizon: Do not send update about 10.1.2.0/24 + +R3 +I have no route for 10.1.2.0/24 + + +Figure 14-5 EIGRP Split-Horizon Issue + +Example 14-25 Verifying Whether Split-horizon Is Enabled on an Interface + +R1#show ip interface tunnel 0 +Tunnel0 is up, line protocol is up +Internet address is 192.168.1.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1476 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled +ICMP redirects are never sent +...output omitted... + +To disable split-horizon on an interface completely, issue the no ip split-horizon com-mand in interface configuration mode. If you only want to disable it for the EIGRP process running on the interface, issue the command no ip split-horizon eigrp autono-mous_system_number. + +If you disable split-horizon for the EIGRP process, it will still show as enabled in the output of show ip interface, as shown in Example 14-25 earlier. To verify whether split-horizon is enabled or disabled for the EIGRP process on an interface, issue the command show ip eigrp interfaces detail interface_type interface_number. Example 14-26 shows that it is disabled for EIGRP on interface tunnel 0. + +Example 14-26 Verifying Whether Split-horizon Is Enabled for EIGRP on an Interface + +R1#show ip eigrp interfaces detail tunnel 0 +EIGRP-IPv4 Interfaces for AS(100) +Xmit Queue PeerQ Mean Pacing Time Multicast Pending + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 539 + +Interface Peers Un/Reliable Un/Reliable SRTT Un/Reliable Flow Timer Routes +Tu0 0 0/0 0/0 0 6/6 0 0 +Hello-interval is 5, Hold-time is 15 +Split-horizon is disabled +Next xmit serial +Packetized sent/expedited: 0/0 +Hello's sent/expedited: 17/1 +Un/reliable mcasts: 0/0 Un/reliable ucasts: 0/0 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 +Retransmissions sent: 0 Out-of-sequence rcvd: 0 +Topology-ids on interface - 0 +Authentication mode is not set + + +Troubleshooting Miscellaneous EIGRP for IPv4 Issues + +So far, your focus has been on troubleshooting EIGRP neighbor relationships and routes. Now your focus will be on troubleshooting issues related to feasible successors, discon-tiguous networks and autosummarization, route summarization, and equal and unequal metric load balancing. + +Feasible Successors + +The best route (lowest feasible distance [FD] metric) for a specific network in the EIGRP topology table becomes a candidate to be injected into the router’s routing table. (We use the term candidate because even though it is the best EIGRP route, there might be a better source of the same information that will be used instead.) If that route is indeed injected into the routing table, that route becomes known as the successor (best) route. This is the route that is then advertised to neighboring routers. Example 14-27 displays a sample EIGRP topology table, which you can view by issuing the show ip eigrp topol- +ogy command. Focus on the entry for 172.16.32.192/29. Notice that there are three paths to reach that network. However, based on the fact that it states 1 successors, only one +is being used as the best path. It is the one with the lowest FD of 2174976, which is the path via 172.16.33.5, reachable out interface Serial 1/0. + +Example 14-27 Sample show ip eigrp topology Command Output + +R4#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(192.4.4.4) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +...output omitted... +P 10.1.13.0/24, 1 successors, FD is 3072 +via 10.1.34.3 (3072/2816), GigabitEthernet2/0 +P 0.0.0.0/0, 1 successors, FD is 28160 +via Rstatic (28160/0) + + + + +From the Library of Outcast Outcast +540 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +P 192.1.1.1/32, 1 successors, FD is 131072 +via 10.1.34.3 (131072/130816), GigabitEthernet2/0 +P 172.16.32.192/29, 1 successors, FD is 2174976 +via 172.16.33.5 (2174976/30720), Serial1/0 +via 172.16.33.6 (2684416/2172416), Serial1/0 +via 172.16.33.18 (2684416/2172416), Serial1/2 +P 198.51.100.0/30, 1 successors, FD is 28416 +via 10.1.34.3 (28416/28160), GigabitEthernet2/0 +P 172.16.33.12/30, 1 successors, FD is 2172416 +via 172.16.33.5 (2172416/28160), Serial1/0 +...output omitted... + +In the brackets after the next-hop IP address is the FD followed by the reported distance (RD): + +■ Reported distance: The distance from the neighbor at the next-hop address to the destination network + +■ Feasible distance: The RD plus the metric to reach the neighbor at the next-hop address that is advertising the RD + +The successor is the path with the lowest FD. However, EIGRP also precalculates paths that could be used if the successor disappeared. These are known as the feasible suc-cessors. To be a feasible successor, the RD of the path to become a feasible successor must be less than the FD of the successor. Review Example 14-27 again. The path via 172.16.33.5 is the successor. However, are the paths using 172.16.33.6 and 172.16.33.18 feasible successors (backups)? To determine this, take the RD of these paths (in this case, it is the same [2172416]), and compare it to the FD of the successor (2174976). Is the RD less than the FD? Yes. Therefore, they are feasible successors. + +For troubleshooting, it is important to note that the output of show ip eigrp topology only displays the successors and feasible successors. If you need to verify the FD or RD of other paths to the same destination that are not feasible successors, you can use the show ip eigrp topology all-links command. Example 14-28 displays the output of show ip eigrp topology and show ip eigrp topology all-links. Focus on the entry for +10.1.34.0/24. Notice how in the output of show ip eigrp topology there is only one path listed and in the output of show ip eigrp topology all-links there are two. This is because the next hop of 172.16.33.13 has an RD greater than the FD of the successor and there-fore cannot be a feasible successor. + +Example 14-28 Sample show ip eigrp topology Comparison + +Router#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(172.16.33.14) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 172.16.33.8/30, 1 successors, FD is 2169856 +via Connected, Serial1/0 + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 541 + +P 10.1.34.0/24, 1 successors, FD is 2682112 +via 172.16.33.9 (2682112/2170112), Serial1/0 +P 203.0.113.0/30, 1 successors, FD is 2684416 +via 172.16.33.9 (2684416/2172416), Serial1/0 +P 172.16.32.192/29, 1 successors, FD is 28160 +via Connected, FastEthernet2/0 +P 172.16.33.12/30, 1 successors, FD is 5511936 +via Connected, Serial1/1 +P 172.16.33.0/29, 1 successors, FD is 2681856 +via 172.16.33.9 (2681856/2169856), Serial1/0 + +Router#show ip eigrp topology all-links +EIGRP-IPv4 Topology Table for AS(100)/ID(172.16.33.14) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 172.16.33.8/30, 1 successors, FD is 2169856, serno 1 +via Connected, Serial1/0 +P 10.1.34.0/24, 1 successors, FD is 2682112, serno 8 +via 172.16.33.9 (2682112/2170112), Serial1/0 +via 172.16.33.13 (6024192/3072256), Serial1/1 +P 203.0.113.0/30, 1 successors, FD is 2684416, serno 9 +via 172.16.33.9 (2684416/2172416), Serial1/0 +via 172.16.33.13 (6026496/3074560), Serial1/1 +P 172.16.32.192/29, 1 successors, FD is 28160, serno 3 +via Connected, FastEthernet2/0 +P 172.16.33.12/30, 1 successors, FD is 5511936, serno 2 +via Connected, Serial1/1 +P 172.16.33.0/29, 1 successors, FD is 2681856, serno 5 +via 172.16.33.9 (2681856/2169856), Serial1/0 +via 172.16.33.13 (6023936/3072000), Serial1/1 + +The EIGRP topology table not only contains the routes learned from other routers, but also routes that have been redistributed into the EIGRP process and the local networks whose interfaces are participating in the EIGRP process, as highlighted in Example 14-29. + +Example 14-29 Verifying Connected and Redistributed Entries in the Topology Table + +R4#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(192.4.4.4) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +...output omitted... +P 192.2.2.2/32, 1 successors, FD is 131072 +via 10.1.34.3 (131072/130816), GigabitEthernet2/0 +P 10.1.13.0/24, 1 successors, FD is 3072 + + + +From the Library of Outcast Outcast +542 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +via 10.1.34.3 (3072/2816), GigabitEthernet2/0 +P 0.0.0.0/0, 1 successors, FD is 28160 +via Rstatic (28160/0) +P 192.1.1.1/32, 1 successors, FD is 131072 +via 10.1.34.3 (131072/130816), GigabitEthernet2/0 +P 172.16.32.192/29, 1 successors, FD is 2174976 +via 172.16.33.5 (2174976/30720), Serial1/0 +via 172.16.33.6 (2684416/2172416), Serial1/0 +via 172.16.33.18 (2684416/2172416), Serial1/2 +P 198.51.100.0/30, 1 successors, FD is 28416 +via 10.1.34.3 (28416/28160), GigabitEthernet2/0 +P 172.16.33.12/30, 1 successors, FD is 2172416 +via 172.16.33.5 (2172416/28160), Serial1/0 +P 192.6.6.6/32, 2 successors, FD is 2297856 +via 172.16.33.6 (2297856/128256), Serial1/0 +via 172.16.33.18 (2297856/128256), Serial1/2 +P 172.16.33.0/29, 1 successors, FD is 2169856 +via Connected, Serial1/0 +...output omitted... + + +Discontiguous Networks and Autosummarization + +EIGRP supports variable-length subnet masking (VLSM). In earlier releases of the Cisco IOS (pre 15.0), EIGRP automatically performed route summarization at classful network boundaries. This was an issue in networks containing discontiguous networks. As a result, it was necessary when configuring EIGRP to turn off automatic summarization using the no auto-summary command in router configuration mode for an EIGRP autonomous system. However, from Cisco IOS 15.0 and onward, automatic summarization is off +by default for EIGRP. Therefore, you do not have to worry about issuing the no auto-summary command anymore. However, you should be able to recognize a discontiguous network when reviewing a network topology and understand that if someone manually enabled autosummarization in your EIGRP autonomous system, routing would be broken. + +Figure 14-6 provides an example of a discontiguous network. The 172.16.0.0/16 Class B classful network is considered discontiguous because it is subnetted as 172.16.1.0/24 and 172.16.2.0/24 and the subnets are separated from each other by a different classful +network, which is 10.0.0.0. With automatic summarization turned on, when R3 advertises the 172.16.2.0/24 network to R2, it is summarized to 172.16.0.0/16 because it is being sent out an interface in a different classful network. So, instead of 172.16.2.0/24 being sent, 172.16.0.0/16 is sent. Likewise, the same thing happens when R1 advertises the 172.16.1.0/24 network to R2; it is advertised as 172.16.0.0/16. If you reviewed R2’s rout-ing table, it would show an entry for 172.16.0.0 with two next hops (if everything else is equal), one via R3 using Fa0/1 and the other via R1 using Fa0/0. + +Now picture a packet arriving at R2 from R4 with a destination IP of 172.16.2.5. Which way does R2 send it? You see the problem? It should send it out Fa0/1, but it could send it out Fa0/0. There is a 50/50 chance it gets it correct. The moral of this story is this: If + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 543 + +you have a discontiguous network, autosummarization has to be off, and you must take care when performing manual summarization. To verify whether automatic summariza-tion is enabled or disabled, use the show ip protocols command, as shown in Example 14-30. + + +R4 + + + + +172.16.1.0/24 +R1 + +10.1.1.0/24 +Fa0/0 + +10.1.2.0/24 +R2 Fa0/1 + + +172.16.2.0/24 R3 + + + +172.16.0.0/16 instead of 172.16.1.0/24 + + +Routing Table 172.16.0.0/24 via Fa0/0 via Fa0/1 + +172.16.0.0/16 instead of 172.16.2.0/24 + + +Figure 14-6 Discontiguous Network Example + +Example 14-30 Verifying Route Summarization with show ip protocols + +Router#show ip protocols +...output omitted... +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.13.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Address Summarization: +10.1.0.0/20 for Gi2/0 +Summarizing 2 components with metric 2816 +Maximum path: 4 +Routing for Networks: +...output omitted... + + +Route Summarization + +By default with IOS 15.0 and later, autosummary is off. Therefore, you can either turn it on (not recommended), or perform manual route summarization (recommended). With EIGRP, manual route summarization is enabled on an interface-by-interface basis. + + + +From the Library of Outcast Outcast +544 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Therefore, when troubleshooting route summarization, keep the following in mind: + +Key ■ Did you enable route summarization on the correct interface? +Topic ■ Did you associate the summary route with the correct EIGRP autonomous system? + +■ Did you create the appropriate summary route? + +You can verify all of these using the show ip protocols command, as shown in Example 14-30. In this example, autosummarization is disabled, and manual summarization is enabled for EIGRP autonomous system 100 on interface Gigabit Ethernet 2/0 for 10.1.0.0/20. + +It is important that you create accurate summary routes to ensure that your router is not advertising networks in the summary route that it does not truly know how to reach. If it does, it is possible that it might receive packets to destinations that fall within the sum-mary that it really does not know how to reach. If this is the case, it means that packets will be dropped because of the route to null 0. + +When a summary route is created on a router, so is a summary route to null 0, as shown in Example 14-31. This route to null 0 is created to prevent routing loops. It is imperative that this route is in the table to ensure that if a packet is received by this router destined to a network that falls within the summary that the router does not really know how to reach, it will be dropped. If the route to null 0 did not exist, and there was a default route on the router, the router would forward the packet via the default route, and then the next-hop router would end up forwarding it back to this router, because it is using the summary route, then the local router would then forward it based on the default route, and then it would come back. This is a routing loop. + +Example 14-31 Verifying Local Summary Route to Null 0 + +Router#show ip route | include Null +D 10.1.0.0/20 is a summary, 00:12:03, Null0 + +The route to null 0 has an AD of 5, as shown in Example 14-32, to ensure that it is more trustworthy than most of the other sources of routing information. Therefore, the only way this route would not be in the routing table is if you had a source with a lower AD (for example, someone creates a static route for the same summary network and points it to a next hop IP address instead of null 0). This would cause a routing loop. + +Example 14-32 Verifying the AD of Local Summary Route to Null 0 + +Router#show ip route 10.1.0.0 +Routing entry for 10.1.0.0/20 +Known via "eigrp 100", distance 5 , metric 2816, type internal + + +Load Balancing + +By default, EIGRP will load balance on four equal metric paths. You can change this with the maximum-paths command in router configuration mode for EIGRP. However, EIGRP also supports load balancing across unequal metric paths using the variance feature. By default, the variance value for an EIGRP routing process is 1, meaning the load balancing will only occur over equal metric paths. You can issue the variance multiplier command + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 545 + +in router configuration mode to specify a range of metrics over which load balancing will occur. For example, suppose that a route had a metric of 200000, and you configured the variance 2 command for the EIGRP routing process. This would cause load balancing to occur over any route with a metric in the range of 200000 through 400000 (2 * 200000). As you can see, a route could have a metric as high as 400000 (that is, the variance multi-plier multiplied by the best metric) and still be used. + +However, even with unequal metric load balancing, you are still governed by the maxi-mum-paths command. Therefore, if you have five unequal-metric paths that you want to use and you configured the correct variance multiplier, but maximum paths is set to 2, you will only use two of the five paths. To use all five, you would also need to make sure that the maximum paths were set to 5 as well. + +Also, remember that the feasibility condition plays a huge role in unequal path load bal-ancing. If the path is not a feasible successor, it cannot be used for unequal path load bal-ancing. There is no exception to this rule. If you recall, the feasibility condition is this: To be a feasible successor, your RD must be less than the FD of the successor. + +To verify the configured maximum paths and variance, use the show ip protocols com-mand, as shown in Example 14-33. + +Key Example 14-33 Verifying Variance and Maximum Paths Topic Router#show ip protocols +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +0.0.0.0 +Routing Information Sources: + +Gateway +Gateway +10.1.12.2 + +Distance +Distance +90 + +Last Update +Last Update +10:26:36 + +Distance: internal 90 external 170 + + + +From the Library of Outcast Outcast +546 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +EIGRP for IPv4 Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 14-7. + +EIGRP AS 100 + + +10.1.1.0/24 10.1.3.0/24 + +R1 10.1.12.0/24 R2 10.1.23.0/24 R3 + +Figure 14-7 EIGRP for IPv4 Trouble Tickets Topology + + +Trouble Ticket 14-1 + +Problem: Users in the 10.1.1.0/24 network indicate that they are not able to access resources in the 10.1.3.0/24 network. + +As always, the first item on the list for troubleshooting is: verify the problem. You access a PC in the 10.1.1.0/24 network and ping an IP address in the 10.1.3.0/24 network and it is successful (0% loss), as shown in Example 14-34. However, notice that the reply is from the default gateway at 10.1.1.1 and it states: Destination host unreachable. Therefore, it was technically not successful. + +Example 14-34 Destination Unreachable Result from ping Command on PC + +C:\>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data; + +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +The result of this ping tells us two very important things: The PC can reach the default gateway, and the default gateway does not know how to get to the 10.1.3.0/24 network. Therefore, we can focus our attention on R1 and work from there. + +On R1, you issue the same ping, but it fails, as shown in Example 14-35. + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 547 + +Example 14-35 Failed Ping from R1 to 10.1.3.10 + +R1#ping 10.1.3.10 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.3.10, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) + +Next, you check R1’s routing table with the show ip route command and notice that there are only connected routes in the routing table, as shown in Example 14-36. You conclude that R1 is not learning any routes from R2. + +Example 14-36 show ip route Output on R1 + +R1#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 + +According to Figure 14-7, EIGRP is the routing protocol in use. Therefore, you issue the show ip protocols command to verify that EIGRP is running the correct autonomous system. Example, 14-37 displays the show ip protocols output and confirms that EIGRP 100 is in operation on R1. + +Example 14-37 show ip protocols Output on R1 + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + + + +From the Library of Outcast Outcast +548 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.1.1/32 +10.1.12.1/32 +Routing Information Sources: + +Gateway +10.1.12.2 + +Distance +90 + +Last Update +00:45:53 + +Distance: internal 90 external 170 + +Next you check to see whether R1 has any EIGRP neighbors. According to the topology, R2 should be a neighbor. To verify EIGRP neighbors, you issue the show ip eigrp neigh-bors command on R1, as shown in Example 14-38. According to the output, R1 has no neighbors. + +Example 14-38 show ip eigrp neighbors Output on R1 + +R1#show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(100) + +Now you verify whether there are any interfaces participating in the EIGRP process using the show ip eigrp interfaces command. Example 14-39 indicates that there are two inter-faces participating in the EIGRP process: Gig0/0 and Gig1/0. + +Example 14-39 show ip eigrp interfaces Output on R1 + +R1#show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + + + +Gi0/0 0 0/0 0/0 +Gi1/0 0 0/0 0/0 + +0 0/0 0 0 +0 0/0 304 0 + + +The output of show cdp neighbors, as shown in Example 14-40, indicates that R1 is con-nected to R2 using Gig1/0 and that R2 is using Gig0/0. Therefore, we expect a peering between the two using these interfaces. + +Example 14-40 show cdp neighbors Output on R1 + +R1#show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + + +Device ID +R2 + +Local Intrfce +Gig 1/0 + +Holdtme +172 + +Capability +R + +Platform Port ID +7206VXR Gig 0/0 + + +Now is a great time to verify whether Gig0/0 on R2 is participating in the EIGRP process. On R2, you issue the show ip eigrp interfaces command, as shown in Example 14-41. + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 549 + +Example 14-41 show ip eigrp interfaces Output on R2 + +R2#show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(100) + + +Interface Peers +Gi1/0 0 + +Xmit Queue +Un/Reliable +0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 0 + +Pacing Time +Un/Reliable +0/0 + +Multicast +Flow Timer +448 + +Pending +Routes +0 + + +Example 14-41 confirms that R2’s interface Gig0/0 is not participating in the EIGRP pro-cess. + +You review the output of show run | section router eigrp and show ip interface brief on R2, as shown in Example 14-42, and confirm that the wrong network statement was issued on R2. The network statement network 10.1.21.2 0.0.0.0 enables the EIGRP pro-cess on the interface with that IP address. According to the output of show ip interface brief, the network statement should be network 10.1.12.2 0.0.0.0. + +Example 14-42 show run | section router eigrp Output on R2 and Verifying Interface IP address + +R2#show run | section router eigrp +router eigrp 100 +network 10.1.21.2 0.0.0.0 +network 10.1.23.2 0.0.0.0 + +R2#show ip interface brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES unset administratively down down + +GigabitEthernet0/0 +GigabitEthernet1/0 + +10.1.12.2 +10.1.23.2 + +YES manual up up +YES manual up up + + +To fix this issue, on R2 you execute the no network 10.1.21.2 0.0.0.0 command and enter the network 10.1.12.2 0.0.0.0 command in router EIGRP configuration mode instead. After you have done this, the neighbor relationship forms, as shown with the fol-lowing syslog messages: + +R1# +%DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 10.1.12.2 (GigabitEthernet1/0) is up: new adjacency +R2# +%DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 10.1.12.1 (GigabitEthernet0/0) is up: new adjacency +You confirm the neighbor relationship on R1 with the show ip eigrp neighbors com-mand, as shown in Example 14-43. + + + + + + + +From the Library of Outcast Outcast +550 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-43 Verifying Neighbors with the show ip eigrp neighbors Command + +R1#show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.1.12.2 Gi1/0 14 00:02:10 75 450 0 12 + +You go back to the PC and ping the same IP address to confirm the problem is solved, and you receive the same result, as shown in Example 14-44. R1 still does not know about the 10.1.3.0/24 network. + +Example 14-44 Destination Unreachable from ping Command on PC + +C:\>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data; + +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +Back on R1, you issue the show ip route command, as shown in Example 14-45. R1 is receiving EIGRP routes because there is now an EIGRP route (D) in the routing table. However, R1 still does not know about the 10.1.3.0/24 network. + +Example 14-45 show ip route Output After Neighbor Relationship with R2 Established + +R1#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +D 10.1.23.0/24 [90/3072] via 10.1.12.2, 00:07:40, GigabitEthernet1/0 + +Does R2 know about the 10.1.3.0/24 network? Example 14-46 displays R2’s routing table, and it is missing 10.1.3.0/24 as well. + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 551 + +Example 14-46 show ip route Output on R2 + +R2#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks +D 10.1.1.0/24 [90/3072] via 10.1.12.1, 00:12:11, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 + +For R2 to learn about the network, it has to be neighbors with R3. Reviewing the R2 output of show ip eigrp neighbors in Example 14-47 indicates that R3 is not a neighbor, only R1. + +Example 14-47 show ip eigrp neighbors on R2 + +R2#show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.1.12.1 Gi0/0 11 00:17:28 65 390 0 7 + +Previously, Example 14-41 indicated that Gig1/0 on R2 was participating in the EIGRP process. Therefore, we should look at the interfaces on R3. According to the output in Example 14-48, both interfaces on R3 are participating in the EIGRP process for autono-mous system 10. + +Example 14-48 show ip eigrp interfaces on R3 + +R3#show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(10) + + +Interface Peers +Gi0/0 0 +Gi1/0 0 + +Xmit Queue +Un/Reliable +0/0 +0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 0 +0/0 0 + +Pacing Time +Un/Reliable +0/0 +0/0 + +Multicast +Flow Timer +0 +0 + +Pending +Routes +0 +0 + + +Did you spot the issue? If not, look again at Example 14-48. If you need to compare it to Example 14-47, do so. + +The autonomous system numbers do not match, and to form an EIGRP neighbor relation-ship, the autonomous system numbers must match. To solve this issue, you must enable EIGRP autonomous system 100 on R3, and then provide the correct network statements to enable EIGRP on the required interfaces for autonomous system 100. You should also remove any EIGRP configs that are not needed, such as the EIGRP autonomous system 10 configurations. Example 14-49 provides the commands needed to accomplish this. + + + + +From the Library of Outcast Outcast +552 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-49 R3 Configurations Required to Solve Issue + +R3#config t +Enter configuration commands, one per line. End with CNTL/Z. +R3(config)#no router eigrp 10 +R3(config)#router eigrp 100 +R3(config-router)#network 10.1.3.3 0.0.0.0 +R3(config-router)#network 10.1.23.3 0.0.0.0 +%DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 10.1.23.2 (GigabitEthernet1/0) is up: new adjacency +R3(config-router)# + +Notice in Example 14-49 that the neighbor relationship with R2 was successful. Now it is time to verify that all our issues are solved. On R2, you issue the show ip route com-mand, as shown in Example 14-50, and notice that the 10.1.3.0/24 network is present. You also issue the same command on R1 and notice that 10.1.3.0/24 is present, as shown in Example 14-51. You then ping from the PC again, and the ping is truly successful, as shown in Example 14-52. + +Example 14-50 show ip route Output on R2 + +R2#show ip route +...output omitted... + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +D 10.1.1.0/24 [90/3072] via 10.1.12.1, 00:37:21, GigabitEthernet0/0 +D 10.1.3.0/24 [90/3072] via 10.1.23.3, 00:06:16, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 + + +Example 14-51 show ip route Output on R1 + +R1#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 553 + +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +D 10.1.3.0/24 [90/3328] via 10.1.12.2, 00:07:08, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +D 10.1.23.0/24 [90/3072] via 10.1.12.2, 00:38:12, GigabitEthernet1/0 + + +Example 14-52 A Successful Ping from the 10.1.1.0/24 Network to the 10.1.3.0/24 Network + +C:\>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data: + +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 14-2 + +Problem: Users in the 10.1.1.0/24 network have indicated that they are not able to access resources in 10.1.3.0/24. + +To begin, you verify the problem by pinging from a PC in the 10.1.1.0/24 network to a PC in the 10.1.3.0/24 network, as shown in Example 14-53, and it fails. Notice that the reply is from the default gateway at 10.1.1.1 and it states: Destination host unreachable. Therefore, it was technically not successful. + +Example 14-53 Destination Unreachable Result from ping Command on PC + +C:\>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data; + +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + +From the Library of Outcast Outcast +554 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +The result of this ping tells us two very important things: the PC can reach the default gateway, and the default gateway does not know how to get to the 10.1.3.0/24 network. Therefore, we can focus our attention on R1 and work from there. + +On R1, you issue the same ping, but it fails, as shown in Example 14-54. + +Example 14-54 Failed Ping from R1 to 10.1.3.10 + +R1#ping 10.1.3.10 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.3.10, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) + +Next you check the routing table on R1 with the show ip route 10.1.3.0 255.255.255.0 command, as shown in Example 14-55, and it states: % Subnet not in table. + +Example 14-55 Determining Whether a Route Is in R1’s Routing Table + +R1#show ip route 10.1.3.0 255.255.255.0 +% Subnet not in table + +Does R2 know about it? You go to R2 and issue the same command, as shown in Example 14-56. The result is the same: % Subnet not in table. + +Example 14-56 Determining Whether a Route Is in R2’s Routing Table + +R2#show ip route 10.1.3.0 255.255.255.0 +% Subnet not in table + +Next you go to R3 and issue the same command. Notice that 10.1.3.0/24 is in the routing table as a connected route, as shown in Example 14-57. + +Example 14-57 Determining Whether Route Is in R3’s Routing Table + +R3#show ip route 10.1.3.0 255.255.255.0 +Routing entry for 10.1.3.0/24 +Known via "connected", distance 0, metric 0 (connected, via interface) +Redistributing via eigrp 100 +Routing Descriptor Blocks: +* directly connected, via GigabitEthernet0/0 +Route metric is 0, traffic share count is 1 + +What would prevent a connected route from being advertised via EIGRP to a neighbor? Answer: The interface is not participating in the EIGRP process. Now you check the EIGRP interface table on R3 with the show ip eigrp interfaces command. Example 14-58 indicates that only Gigabit Ethernet 1/0 is participating in the EIGRP process. + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 555 + +Example 14-58 Determining Whether an Interface Is Participating in the EIGRP Process + +R3#show ip eigrp interfaces +EIGRP-IPv4 Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Gi1/0 1 0/0 0/0 821 0/0 4080 0 + +However, do not jump to the conclusion that this interface is not participating in the EIGRP process. Remember that EIGRP passive interfaces do not appear in this output. Therefore, check the output of show ip protocols for passive interfaces. In Example 14-59, you can see that there are no passive interfaces. + +Example 14-59 Determining Whether an Interface Is Passive + +R3#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.23.3 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 + +Automatic Summarization: disabled +Maximum path: 4 +Routing for Networks: +10.1.3.0/32 +10.1.23.3/32 +Routing Information Sources: + +Gateway +10.1.23.2 + +Distance +90 + +Last Update +00:19:11 + +Distance: internal 90 external 170 + + + + + + + +From the Library of Outcast Outcast +556 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Now you need to make sure that there is a network statement that will enable the EIGRP process on the interface connected to the 10.1.3.0/24 network. In Example 14-59, the out-put of show ip protocols indicates that R3 is routing for networks 10.1.3.0/32. Remember from our discussion earlier that this really means network 10.1.3.0 0.0.0.0. As a result, EIGRP will be enabled on the interface with the IP address 10.1.3.0. Example 14-60, which displays the output of show ip interface brief, shows that there are no interfaces with that IP address. Interface Gig0/0 has an IP address of 10.1.3.3. Therefore, the net-work statement is incorrect, as shown in the output of show run | section router eigrp in Example 14-61. + +Example 14-60 Reviewing the Interface IP Addresses + +R3#show ip interface brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES NVRAM administratively down down + +GigabitEthernet0/0 +GigabitEthernet1/0 + +10.1.3.3 +10.1.23.3 + +YES NVRAM up up +YES NVRAM up up + + + +Example 14-61 Reviewing the network Statements in the Running Config + +R3#show run | section router eigrp +router eigrp 100 +network 10.1.3.0 0.0.0.0 +network 10.1.23.3 0.0.0.0 + +After fixing the issue with the no network 10.1.3.0 0.0.0.0 command and the network 10.1.3.3 0.0.0.0 command, you check R1’s routing table with the command show ip route 10.1.3.0 255.255.255.0. As shown in Example 14-62, 10.1.3.0/24 is now in the routing table and can be reached via the next hop 10.1.12.2. + +Example 14-62 Verifying 10.1.3.0/24 Is in R1’s Routing Table + +R1#show ip route 10.1.3.0 255.255.255.0 +Routing entry for 10.1.3.0/24 +Known via "eigrp 100", distance 90, metric 3328, type internal +Redistributing via eigrp 100 +Last update from 10.1.12.2 on GigabitEthernet1/0, 00:00:06 ago +Routing Descriptor Blocks: +* 10.1.12.2, from 10.1.12.2, 00:00:06 ago, via GigabitEthernet1/0 +Route metric is 3328, traffic share count is 1 +Total delay is 30 microseconds, minimum bandwidth is 1000000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 2 + +Finally, you ping from the PC again, and the ping is successful, as shown in Example 14-63. + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 557 + +Example 14-63 A Successful Ping from the 10.1.1.0/24 Network to the 10.1.3.0/24 Network + +C:\>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data: + +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 14-3 + +Problem: Users in the 10.1.1.0/24 network have indicated that they are not able to access resources in 10.1.3.0/24. + +To begin, you verify the problem by pinging from a PC in the 10.1.1.0/24 network to a PC in the 10.1.3.0/24 network, as shown in Example 14-64, and it fails. Notice that the reply is from the default gateway at 10.1.1.1 and it states: Destination host unreachable. + +Example 14-64 Destination Unreachable Result from ping Command on PC + +C:\>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data; + +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +The result of this ping tells us two very important things: The PC can reach the default gateway, and the default gateway does not know how to get to the 10.1.3.0/24 network. Therefore, we can focus our attention on R1 and work from there. + +On R1, you issue the same ping, but it fails, as shown in Example 14-65. + + + + +From the Library of Outcast Outcast +558 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-65 Failed Ping from R1 to 10.1.3.10 + +R1#ping 10.1.3.10 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.3.10, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) + +Next you check the routing table on R1 with the show ip route 10.1.3.0 255.255.255.0 command, as shown in Example 14-66, and it states: % Subnet not in table. + +Example 14-66 Determining Whether a Route Is in R1’s Routing Table + +R1#show ip route 10.1.3.0 255.255.255.0 +% Subnet not in table + +Does R2 know about it? You go to R2 and issue the same command, as shown in Example 14-67. R2 does know about it. + +Example 14-67 Determining Whether a Route Is in R2’s Routing Table + +R2#show ip route 10.1.3.0 255.255.255.0 +Routing entry for 10.1.3.0/24 +Known via "eigrp 100", distance 90, metric 3072, type internal +Redistributing via eigrp 100 +Last update from 10.1.23.3 on GigabitEthernet1/0, 00:44:37 ago +Routing Descriptor Blocks: +* 10.1.23.3, from 10.1.23.3, 00:44:37 ago, via GigabitEthernet1/0 +Route metric is 3072, traffic share count is 1 +Total delay is 20 microseconds, minimum bandwidth is 1000000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 1 + +Next you go back to R1 and issue the show ip eigrp topology command to determine whether R1 is even learning about the 10.1.3.0/24 network. Example 14-68 indicates that it is not. + +Example 14-68 Determining Whether R1 Is Learning About 10.1.3.0/24 + +R1#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(10.1.12.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.12.0/24, 1 successors, FD is 2816 +via Connected, GigabitEthernet1/0 +P 10.1.23.0/24, 1 successors, FD is 3072 +via 10.1.12.2 (3072/2816), GigabitEthernet1/0 +P 10.1.1.0/24, 1 successors, FD is 2816 +via Connected, GigabitEthernet0/0 + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 559 + +Time to hypothesize! Why would R2 know about 10.1.3.0/24 and R1 not know about it? + +■ R1 and R2 are not EIGRP neighbors. + +■ A route filter on R2 prevents it from advertising 10.1.3.0/24 to R1. + +■ A route filter on R1 prevents it from learning 10.1.3.0/24 in Gig1/0. + +On R1, you issue the show ip eigrp neighbors command, as shown in Example 14-69, and it shows that R2 is a neighbor. However, if you looked closely at the topology table of R1, you would have noticed that R1 is learning about 10.1.23.0/24 from R2, meaning that they are neighbors and that routes are being learned. Therefore, you hypothesize that there must be a filter in place. + +Example 14-69 Determining Whether R2 Is a Neighbor + +R1#show ip eigrp neighbors +EIGRP-IPv4 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.1.12.2 Gi1/0 12 01:20:27 72 432 0 18 + +Next you issue the show ip protocols command, as shown in Example 14-70, to deter-mine whether there are any route filters on R1. The output indicates that there is an inbound route filter on R1 Gigabit Ethernet 1/0. The route filter is filtering based on a prefix-list called DENY_10.1.3.0/24. + +Example 14-70 Determining Whether There Is a Route Filter on R1 + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +GigabitEthernet1/0 filtered by (prefix-list) DENY_10.1.3.0/24 (per-user), default is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 Protocol for AS(100) +...output omitted... + +Now you issue the show ip prefix-list command on R1, as shown in Example 14-71, and it indicates that 10.1.3.0/24 is being denied. + +Example 14-71 Reviewing the Prefix List + +R1#show ip prefix-list +ip prefix-list DENY_10.1.3.0/24: 2 entries +seq 5 deny 10.1.3.0/24 +seq 10 permit 0.0.0.0/0 le 32 + + + +From the Library of Outcast Outcast +560 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +In this case, you can either modify the prefix-list to allow 10.1.3.0/24 or you can remove the distribute list from the EIGRP process. It would all depend on the requirements of the organization or scenario. In this case, we remove the distribute list from R1 with the no distribute-list prefix DENY_10.1.3.0/24 in GigabitEthernet1/0 command. Because of this change, the neighbor relationship resets, as the following syslog message indicates: + +%DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 10.1.12.2 (GigabitEthernet1/0) is resync: intf route configuration changed +After fixing the issue, you check R1’s routing table with the command show ip route 10.1.3.0 255.255.255.0. As shown in Example 14-72, 10.1.3.0/24 is now in the routing table and can be reached via the next hop 10.1.12.2. + +Example 14-72 Verifying That 10.1.3.0/24 Is in R1’s Routing Table + +R1#show ip route 10.1.3.0 255.255.255.0 +Routing entry for 10.1.3.0/24 +Known via "eigrp 100", distance 90, metric 3328, type internal +Redistributing via eigrp 100 +Last update from 10.1.12.2 on GigabitEthernet1/0, 00:00:06 ago +Routing Descriptor Blocks: +* 10.1.12.2, from 10.1.12.2, 00:00:06 ago, via GigabitEthernet1/0 +Route metric is 3328, traffic share count is 1 +Total delay is 30 microseconds, minimum bandwidth is 1000000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 2 + +Finally, you ping from the PC again, and the ping is successful, as shown in Example 14-73. + +Example 14-73 A Successful Ping from the 10.1.1.0/24 Network to the 10.1.3.0/24 Network + +C:\>ping 10.1.3.10 + +Pinging 10.1.3.10 with 32 bytes of data: + +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.3.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.3.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 561 + +Troubleshooting EIGRP for IPv6 + +Because EIGRP for IPv6 is based on EIGRP for IPv4, you will be dealing with very similar issues when it comes to troubleshooting, with a few minor differences based on IPv6. This should come as a relief, knowing that you do not have to learn a large amount of new information for EIGRP for IPv6. However, you do need to know the show com-mands that will display the information you need to troubleshoot any given EIGRP for IPv6-related issue. + +This section explains the same issues presented in the previous section; however, the focus is on the show commands that are used when troubleshooting EIGRP for IPv6-related issues. + +Troubleshooting EIGRP for IPv6 Neighbor Issues + +The neighbor issues are mostly the same except for a few differences based on the way EIGRP for IPv6 is enabled on an interface. To verify EIGRP for IPv6 neighbors, use the show ipv6 eigrp neighbors command, as shown in Example 14-74. Notice how EIGRP for IPv6 neighbors are identified by their link-local address. In this case, R2 is neighbors +with two routers. One is reachable out Gig1/0, and the other is reachable out Gig0/0. + +Key Example 14-74 Verifying EIGRP for IPv6 Neighbors Topic R2#show ipv6 eigrp neighbors +EIGRP-IPv6 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +1 Link-local address: Gi1/0 10 00:17:59 320 2880 0 4 +FE80::C823:17FF:FEEC:1C +0 Link-local address: Gi0/0 12 00:18:01 148 888 0 3 +FE80::C820:17FF:FE04:1C + + +Interface Is Down + +To verify that an interface is up, you use the show ipv6 interface brief command, as shown in Example 14-75. In this example, Gig0/0 and 1/0 are up/up, and Gig2/0 is admin-istratively down/down. This indicates that Gig2/0 has been configured with the shut-down command. + +Example 14-75 Verifying the Status of IPv6 Interfaces + +R1#show ipv6 interface brief +GigabitEthernet0/0 [up/up ] +FE80::C80E:1FF:FE9C:8 +2001:DB8:0:1::1 +GigabitEthernet1/0 [up/up ] +FE80::C80E:1FF:FE9C:1C +2001:DB8:0:12::1 + + + +From the Library of Outcast Outcast +562 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +GigabitEthernet2/0 [administratively down/down] +FE80::C80E:1FF:FE9C:38 +2001:DB8:0:13::1 + + +Mismatched Autonomous System Numbers + +To verify the autonomous system number being used, you can use the show ipv6 pro-tocols command as shown in Example 14-76. In this example, the EIGRP autonomous system is 100. + +Mismatched K Values + +You can verify the EIGRP for IPv6 K values with show ipv6 protocols, as shown in Example 14-76. In this example, the K values are 1, 0, 1, 0, 0, which are the defaults. + +Passive Interfaces + +Router interfaces participating in the EIGRP for IPv6 autonomous system that are passive can be verified with the show ipv6 protocols command, as shown in Example 14-76. In this example, Gigabit Ethernet 0/0 is a passive interface. + +Example 14-76 Verifying EIGRP for IPv6 Configurations with show ipv6 protocols Key +Topic R1#show ipv6 protocols +...output omitted... +IPv6 Routing Protocol is "eigrp 100" +EIGRP-IPv6 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 16 +Maximum hopcount 100 +Maximum metric variance 1 + +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 (passive) +Redistribution: +None + + +Mismatched Authentication + +If authentication is being used, the key ID and key string must match, in addition to when the key is valid (if configured) between neighbors. Example 14-77 displays how to + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 563 + +verify whether an interface is enabled for EIGRP for IPv6 authentication with the show ipv6 eigrp interfaces detail command and how to verify the configuration of the key chain that is being used with the show key chain command. In this example, the authenti-cation mode is MD5, and the key chain of TEST is being used. + +Example 14-77 Verifying EIGRP for IPv6 Authentication + +R1#show ipv6 eigrp interfaces detail +EIGRP-IPv6 Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Gi1/0 1 0/0 0/0 72 0/0 316 0 +Hello-interval is 5, Hold-time is 15 +Split-horizon is enabled +Next xmit serial +Packetized sent/expedited: 5/0 +Hello's sent/expedited: 494/6 +Un/reliable mcasts: 0/4 Un/reliable ucasts: 4/59 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 +Retransmissions sent: 54 Out-of-sequence rcvd: 3 +Topology-ids on interface - 0 +Authentication mode is md5, key-chain is "TEST" +R1#show key chain +Key-chain TEST: +key 1 -- text "TEST" +accept lifetime (always valid) - (always valid) [valid now] +send lifetime (always valid) - (always valid) [valid now] + + +Timers + +Timers do not have to match; however, if they are not configured appropriately, neighbor relationships might flap. You can verify timers with the show ipv6 eigrp interfaces detail command, as shown in Example 14-77. In that example, the hello interval is configured as 5, and the hold interval is 15, which are the defaults. + + +Interface Not Participating in Routing Process + + + +Key Topic + +With EIGRP for IPv6, the interfaces are enabled for the routing process with the ipv6 eigrp autonomous_system_number interface configuration command. There are two show commands that you can use to verify the interfaces that are participating in the routing process, as shown in Example 14-78: show ipv6 eigrp interfaces and show ipv6 protocols. As with EIGRP for IPv4, the show ipv6 eigrp interfaces command does not +show passive interfaces. However, show ipv6 protocols does. + + + + + + + +From the Library of Outcast Outcast +564 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-78 Verifying EIGRP for IPv6 Interfaces + +R1#show ipv6 eigrp interfaces +EIGRP-IPv6 Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Gi1/0 1 0/0 0/0 282 0/0 1348 0 +R1#show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "eigrp 100" +EIGRP-IPv6 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +...output omitted... +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 (passive) +Redistribution: +None + + +ACLs + +EIGRP for IPv6 uses the IPv6 multicast address FF02::A to form neighbor adjacencies. If an IPv6 ACL is denying packets destined to the multicast address FF02::A, neighbor +adjacencies will not form. In addition, because neighbor adjacencies are formed with link-local addresses, if the link-local address range is denied based on source or destination IPv6 address in an interface with an IPv6 ACL, neighbor relationships will not form. + +Troubleshooting EIGRP for IPv6 Route + +The reasons why a route might be missing and the steps used to troubleshoot them with EIGRP for IPv6 is similar to our previous discussions based on EIGRP for IPv4. Therefore, we will identify some of the more common issues here and review the show commands that you can use to identify them. + +Interface Not Participating in Routing Process + +For a network to be advertised by the EIGRP for IPv6 process, the interface associated with that network must be participating in the routing process. As displayed earlier in Example 14-78, you can use the commands show ipv6 eigrp interfaces and show ipv6 protocols to verify the interfaces participating in the process. + + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 565 + +Better Source of Information + +If the exact same network is learned from a more reliable source, it is used instead of the EIGRP for IPv6-learned information. To verify the AD associated with the route in the routing table, you can issue the show ipv6 route ipv6_address/prefix command. In Example 14-79, the 2001:db8:0:1::/64 network has an AD of 90, and it was learned via EIGRP autonomous system 100. + +Example 14-79 Verifying AD of IPv6 Routes + +R2#show ipv6 route 2001:DB8:0:1::/64 +Routing entry for 2001:DB8:0:1::/64 +Known via "eigrp 100", distance 90 , metric 3072, type internal +Route count is 1/1, share count 0 +Routing paths: +FE80::C820:17FF:FE04:1C, GigabitEthernet0/0 +Last updated 00:25:27 ago + + +Route Filtering + +A filter might be set up that is preventing a route from being advertised or learned. With EIGRP for IPv6, the distribute-list prefix-list command is used to configure a route fil-ter. To verify the filter applied, use the show run | section ipv6 router eigrp command. In Example 14-80, a distribute list is using a prefix list called TSHOOT_EIGRP to filter routes inbound on Gigabit Ethernet 1/0. To successfully troubleshoot route filtering issues, you also need to verify the IPv6 prefix list using the show ipv6 prefix-list com-mand. + +Example 14-80 Verifying EIGRP for IPv6 Distribute List + +R1#show run | section ipv6 router eigrp +ipv6 router eigrp 100 +distribute-list prefix-list TSHOOT_EIGRP in GigabitEthernet1/0 +passive-interface default +no passive-interface GigabitEthernet1/0 + + +Stub Configuration + + + +Key Topic + +If the wrong router is configured as a stub router, or the wrong setting is chosen dur-ing the stub router configuration, you might prevent a network from being advertised that should be advertised. When troubleshooting EIGRP for IPv6 stub configurations, you can use the show ipv6 protocols command to verify whether the local router is a stub router and the networks that it is advertising, as shown in Example 14-81. On a remote router, you can issue the show ipv6 eigrp neighbors detail command, as shown in Example 14-82. In this case, R1 is a stub router advertising connected and summary +routes. + + + + + +From the Library of Outcast Outcast +566 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 14-81 Verifying EIGRP Stub Configuration on a Stub Router + +R1#show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "eigrp 100" +EIGRP-IPv6 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.12.1 +Stub, connected, summary +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 16 +Maximum hopcount 100 +Maximum metric variance 1 + +Interfaces: +GigabitEthernet1/0 +GigabitEthernet0/0 (passive) +Redistribution: +None + + +Example 14-82 Verifying EIGRP Stub Configuration of Neighbor Router + +R2#show ipv6 eigrp neighbors detail +EIGRP-IPv6 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 Link-local address: Gi0/0 11 00:03:35 68 408 0 10 +FE80::C820:17FF:FE04:1C +Version 11.0/2.0, Retrans: 0, Retries: 0, Prefixes: 2 +Topology-ids from peer - 0 +Stub Peer Advertising (CONNECTED SUMMARY ) Routes +Suppressing queries +1 Link-local address: Gi1/0 13 00:14:16 252 1512 0 7 +FE80::C823:17FF:FEEC:1C +Version 11.0/2.0, Retrans: 0, Retries: 0, Prefixes: 2 +Topology-ids from peer - 0 + + +Split-horizon + +Split-horizon is a loop-prevention feature that prevents a router from advertising routes out the same interface they were learned on. As shown in Example 14-83, you can verify whether split-horizon is enabled or disabled by using the show ipv6 eigrp interfaces detail command. + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 567 + +Example 14-83 Verifying EIGRP Stub Configuration of Neighbor Router +Key +Topic R1#show ipv6 eigrp interfaces detail +EIGRP-IPv6 Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Gi1/0 1 0/0 0/0 50 0/0 208 0 +Hello-interval is 5, Hold-time is 15 +Split-horizon is enabled +Next xmit serial +Packetized sent/expedited: 8/0 +Hello's sent/expedited: 708/3 +Un/reliable mcasts: 0/6 Un/reliable ucasts: 11/5 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 +Retransmissions sent: 1 Out-of-sequence rcvd: 0 +Topology-ids on interface - 0 +Authentication mode is md5, key-chain is "TEST" + +As with EIGRP for IPv4, split-horizon is an issue in EIGRP for IPv6 network designs that need routes to be advertised out interfaces they were learned on: an NBMA Frame Relay hub-and-spoke topology or a DMVPN, which both use multipoint interfaces on the hub. Therefore, it needs to be disabled on the hub in these networks. + +EIGRP for IPv6 Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 14-8. + + +Internet 2001:db8:f::f + +IPv6 EIGRPAS 100 + +2001:db8:0:1::/64 +Gi1/0 + +Gi2/0 +Gi0/0 Gi1/0 + + +2001:db8:0:3::/64 Gi1/0 + + + + +Gi0/0 + +R1 2001:db8:0:12::/64 R2 +Fa3/0 + +2001:db8:0:23::/64 R3 Gi0/0 + + + + +WAN 2001:db8:0:14::/64 + +Gi0/0 + +Fa1/0 BRANCH +2001:db8:0:4::/64 + + +Figure 14-8 EIGRP for IPv6 Trouble Tickets Topology + + + + + +From the Library of Outcast Outcast +568 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Trouble Ticket 14-4 + +Problem: Users in the Branch network of 2001:db8:0:4::/64 have indicated that they are not able to access the Internet. + +To verify the problem, you ping 2001:db8:f::f with a source address of 2001:db8:0:4::4, as shown in Example 14-84. The ping fails. + +Example 14-84 Verifying the Issue Using an Extended IPv6 Ping + +Branch#ping +Protocol [ip]: ipv6 +Target IPv6 address: 2001:db8:f::f +Repeat count [5]: +Datagram size [100]: +Timeout in seconds [2]: +Extended commands? [no]: y +Source address or interface: 2001:db8:0:4::4 +UDP protocol? [no]: +Verbose? [no]: +Precedence [0]: +DSCP [0]: +Include hop by hop option? [no]: +Include destination option? [no]: +Sweep range of sizes? [no]: +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +..... +Success rate is 0 percent (0/5) + +Next you issue the show ipv6 route 2001:db8:f::f command on Branch to determine whether there is a route in the IPv6 routing table to reach the address. In Example 14-85, the route is not found. + +Example 14-85 Verifying the Route to 2001:db8:f::f in the IPv6 Routing Table on Branch + +Branch#show ipv6 route 2001:db8:f::f +% Route not found + +Next you visit R1 to determine whether R1 has a route to reach 2001:db8:f::f by using the command show ipv6 route 2001:db8:f::f. In Example 14-86, you can see that the Internet address is reachable via a default route (::/0) that was learned via EIGRP. + +Example 14-86 Verifying the Route to 2001:db8:f::f in the IPv6 Routing Table on R1 + +R1#show ipv6 route 2001:db8:f::f +Routing entry for ::/0 +Known via "eigrp 100", distance 170, metric 2816, type external + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 569 + +Route count is 1/1, share count 0 +Routing paths: +FE80::C821:17FF:FE04:8, GigabitEthernet1/0 +Last updated 00:08:28 ago + +You conclude from this that Branch is not learning the default route from R1, which would be used to reach the Internet. You believe that it might be due to a neighbor rela-tionship issue. Back on Branch, you issue the show ipv6 eigrp neighbors command, as shown in Example 14-87, and the output indicates that there is a neighbor relationship with a device out Fa1/0 that has the link-local address FE80::C820:17FF:FE04:54. You are pretty sure that is R1’s link-local address on Fa3/0, but just to be sure, you issue the show ipv6 interface brief command on R1, as shown in Example 14-88. The link-local address from Example 14-87 matches the address in Example 14-88. + +Example 14-87 Verifying EIGRP for IPv6 Neighbor Adjacencies + +Branch#show ipv6 eigrp neighbors +EIGRP-IPv6 Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 Link-local address: Fa1/0 12 00:16:01 63 378 0 16 +FE80::C820:17FF:FE04:54 + + +Example 14-88 Verifying an IPv6 Link-Local Address + +R1#show ipv6 interface brief fastEthernet 3/0 +FastEthernet3/0 [up/up] +FE80::C820:17FF:FE04:54 +2001:DB8:0:14::1 + +You decide to check the EIGRP for IPv6 topology table on Branch to see whether it is learning any IPv6 routes from R1. As shown in Example 14-89, Branch is learning routes from R1. It has learned 2001:DB8:0:1::/64, and 2001:DB8:0:12::/64. You are quick to realize that those are only the connected routes on R1. You visit R1 again and issue the show ipv6 eigrp topology command and notice that R1 knows about other IPv6 routes, as shown in Example 14-90. However, it is not advertising them to Branch, as shown in Example 14-89. + +Example 14-89 Verifying Learned IPv6 Routes on Branch + +Branch#show ipv6 eigrp topology +EIGRP-IPv6 Topology Table for AS(100)/ID(4.4.4.4) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:0:4::/64, 1 successors, FD is 2816 +via Connected, GigabitEthernet0/0 +P 2001:DB8:0:1::/64, 1 successors, FD is 28416 +via FE80::C820:17FF:FE04:54 (28416/2816), FastEthernet1/0 + + + +From the Library of Outcast Outcast +570 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +P 2001:DB8:0:14::/64, 1 successors, FD is 28160 +via Connected, FastEthernet1/0 +P 2001:DB8:0:12::/64, 1 successors, FD is 28416 +via FE80::C820:17FF:FE04:54 (28416/2816), FastEthernet1/0 + + +Example 14-90 Verifying Learned IPv6 Routes on R1 + +R1#show ipv6 eigrp topology +EIGRP-IPv6 Topology Table for AS(100)/ID(10.1.12.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:0:4::/64, 1 successors, FD is 28416 +via FE80::C828:DFF:FEF4:1C (28416/2816), FastEthernet3/0 +P 2001:DB8:0:1::/64, 1 successors, FD is 2816 +via Connected, GigabitEthernet0/0 +P 2001:DB8:0:3::/64, 1 successors, FD is 3328 +via FE80::C821:17FF:FE04:8 (3328/3072), GigabitEthernet1/0 +P ::/0, 1 successors, FD is 2816 +via FE80::C821:17FF:FE04:8 (2816/256), GigabitEthernet1/0 +P 2001:DB8:0:14::/64, 1 successors, FD is 28160 +via Connected, FastEthernet3/0 +P 2001:DB8:0:12::/64, 1 successors, FD is 2816 +via Connected, GigabitEthernet1/0 +P 2001:DB8:0:23::/64, 1 successors, FD is 3072 +via FE80::C821:17FF:FE04:8 (3072/2816), GigabitEthernet1/0 + +You believe that a route filter is applied. Back on Branch, you issue the command show run | section ipv6 router eigrp, and as shown in Example 14-91, there is no distribute list (route filter) applied. You jump back to R1 and issue the same show command, as shown in Example 14-92, and there is no distribute list (route filter) applied either. + +Example 14-91 Verifying Route Filters on Branch + +Branch#show run | section ipv6 router eigrp +ipv6 router eigrp 100 +eigrp router-id 4.4.4.4 + + +Example 14-92 Verifying Route Filters on R1 + +R1#show run | section ipv6 router eigrp +ipv6 router eigrp 100 +passive-interface default +no passive-interface GigabitEthernet1/0 +no passive-interface FastEthernet3/0 +eigrp stub connected summary + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 571 + +However, you notice in the output of Example 14-92 that R1 is configured as an EIGRP stub router that is advertising only connected and summary routes. This is the problem. The wrong router was configured as a stub router. The spoke (Branch) is supposed to be the stub router, not the hub (R1) in HQ. To solve this issue, you remove the stub configu-ration on R1 with the no eigrp stub command in IPv6 router EIGRP 100 configuration mode. You then issue the command eigrp stub on Branch in IPv6 router EIGRP 100 con-figuration mode. + +To verify the problem is solved, you issue the show ipv6 route 2001:db8:f::f command on Branch to determine whether there is an entry in the routing table now. In Example 14-93, the output shows that the default route will be used. + +Example 14-93 Verifying the Route to 2001:db8:f::f in the IPv6 Routing Table on Branch + +Branch#show ipv6 route 2001:db8:f::f +Routing entry for ::/0 +Known via "eigrp 100", distance 170, metric 28416, type external +Route count is 1/1, share count 0 +Routing paths: +FE80::C820:17FF:FE04:54, FastEthernet1/0 +Last updated 00:03:09 ago + +Next you issue the extended IPv6 ping, as shown in Example 14-94, and it is successful. + +Example 14-94 Verifying the Issue Is Solved Using an Extended IPv6 Ping + +Branch#ping +Protocol [ip]: ipv6 +Target IPv6 address: 2001:db8:f::f +Repeat count [5]: +Datagram size [100]: +Timeout in seconds [2]: +Extended commands? [no]: y +Source address or interface: 2001:db8:0:4::4 +UDP protocol? [no]: +Verbose? [no]: +Precedence [0]: +DSCP [0]: +Include hop by hop option? [no]: +Include destination option? [no]: +Sweep range of sizes? [no]: +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +!!!!! +Success rate is 100 percent (5/5) + + + + + +From the Library of Outcast Outcast +572 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Troubleshooting Named EIGRP Configurations + +The purpose of EIGRP named configurations is to provide you with a central location on the local router to perform all EIGRP for IPv4 and IPv6 configurations. Example 14-95 provides a sample named EIGRP configuration called TSHOOT_EIGRP. This named EIGRP configuration includes an IPv4 unicast address family and an IPv6 unicast address family. They are both using autonomous system 100; however, that is not mandatory. + +Example 14-95 Sample Named EIGRP Configuration + +Branch#show run | section router eigrp +router eigrp TSHOOT_EIGRP +! +address-family ipv4 unicast autonomous-system 100 +! +af-interface default +passive-interface +exit-af-interface +! +af-interface FastEthernet1/0 +no passive-interface +exit-af-interface +! +topology base +exit-af-topology +network 10.1.4.4 0.0.0.0 +network 10.1.14.4 0.0.0.0 +eigrp router-id 4.4.4.4 +eigrp stub connected summary +exit-address-family +! +address-family ipv6 unicast autonomous-system 100 +! +af-interface default +passive-interface +exit-af-interface +! +af-interface FastEthernet1/0 +no passive-interface +exit-af-interface +! +topology base +maximum-paths 2 +variance 3 +exit-af-topology +eigrp router-id 44.44.44.44 +eigrp stub connected summary +exit-address-family + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 573 + +Because the configuration is the only thing that is different, all the issues already dis-cussed thus far for EIGRP for IPv4 and EIGRP for IPv6 will apply here. However, now you need to know which show commands will help you successfully troubleshoot named EIGRP deployments. + +In this section, you learn the show commands that you can use to troubleshoot named EIGRP configurations. + +Named EIGRP Verification Commands + +With named EIGRP, you can use all the same EIGRP show commands that you used for classic EIGRP for IPv4 and classic EIGRP for IPv6 that were covered in this chapter. +However, there is also a new set of show commands for named EIGRP that you may want to learn. + +The command show eigrp protocols will display both the EIGRP for IPv4 address family and the EIGRP for IPv6 address family along with the autonomous system number asso-ciated with each. It also displays the K values, the router ID, whether the router is a stub router, the AD, the maximum paths, and the variance. + +Example 14-96 Output of show eigrp protocols Key +Topic Branch#show eigrp protocols +EIGRP-IPv4 VR(TSHOOT_EIGRP) Address-Family Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 K6=0 +Metric rib-scale 128 +Metric version 64bit +NSF-aware route hold timer is 240 +Router-ID: 4.4.4.4 +Stub, connected, summary +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 4 +Maximum hopcount 100 +Maximum metric variance 1 +Total Prefix Count: 5 +Total Redist Count: 0 + +EIGRP-IPv6 VR(TSHOOT_EIGRP) Address-Family Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 K6=0 +Metric rib-scale 128 +Metric version 64bit +NSF-aware route hold timer is 240 +Router-ID: 44.44.44.44 +Stub, connected, summary +Topology : 0 (base) +Active Timer: 3 min + + + +From the Library of Outcast Outcast +574 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Distance: internal 90 external 170 +Maximum path: 2 +Maximum hopcount 100 +Maximum metric variance 3 +Total Prefix Count: 7 +Total Redist Count: 0 + +This is similar to the show ip protocols and show ipv6 protocols output. However, it is missing the interfaces that are participating in the routing process, along with the passive interfaces. Therefore, show ip protocols and show ipv6 protocols at this time are a pre-ferred option. + +To verify the interfaces that are participating in the routing process for each address family, you can issue the show eigrp address-family ipv4 interfaces command and the show eigrp address-family ipv6 interfaces command, as shown in Example 14-97. Make note that passive interfaces do not show up in this output. Based on the classic show ip protocols and show ipv6 protocols commands, we would be able to verify the passive interfaces. + +Example 14-97 Verifying Interfaces Participating in the Named EIGRP Process Key +Topic Branch#show eigrp address-family ipv4 interfaces +EIGRP-IPv4 VR(TSHOOT_EIGRP) Address-Family Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Fa1/0 1 0/0 0/0 88 0/0 50 0 +Branch#show eigrp address-family ipv6 interfaces +EIGRP-IPv6 VR(TSHOOT_EIGRP) Address-Family Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Fa1/0 1 0/0 0/0 73 0/1 304 0 + + + +Key Topic + +As shown in Example 14-98, when you add the detail keyword to the show eigrp address-family ipv4 interfaces command and the show eigrp address-family ipv6 interfaces command, you can verify additional interface parameters (for example, hello interval and hold time, whether split-horizon is enabled, whether authentication is set, and +statistics about hellos and packets). + + +Example 14-98 Verifying Details of Interfaces Participating in the Named EIGRP Process + +Branch#show eigrp address-family ipv4 interfaces detail +EIGRP-IPv4 VR(TSHOOT_EIGRP) Address-Family Interfaces for AS(100) + +Xmit Queue +Interface Peers Un/Reliable + +PeerQ Mean +Un/Reliable SRTT + +Pacing Time +Un/Reliable + +Multicast +Flow Timer + +Pending +Routes + +Fa1/0 1 0/0 0/0 88 0/0 50 0 + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 575 + +Hello-interval is 5, Hold-time is 15 +Split-horizon is enabled +Next xmit serial +Packetized sent/expedited: 1/0 +Hello's sent/expedited: 333/2 +Un/reliable mcasts: 0/1 Un/reliable ucasts: 2/2 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 +Retransmissions sent: 1 Out-of-sequence rcvd: 1 +Topology-ids on interface - 0 +Authentication mode is not set +Branch#show eigrp address-family ipv6 interfaces detail +EIGRP-IPv6 VR(TSHOOT_EIGRP) Address-Family Interfaces for AS(100) + + +Interface Peers +Fa1/0 1 + +Xmit Queue +Un/Reliable +0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 73 + +Pacing Time +Un/Reliable +0/1 + +Multicast +Flow Timer +304 + +Pending +Routes +0 + +Hello-interval is 5, Hold-time is 15 +Split-horizon is enabled +Next xmit serial +Packetized sent/expedited: 3/0 +Hello's sent/expedited: 595/3 +Un/reliable mcasts: 0/2 Un/reliable ucasts: 5/3 +Mcast exceptions: 0 CR packets: 0 ACKs suppressed: 0 +Retransmissions sent: 1 Out-of-sequence rcvd: 2 +Topology-ids on interface - 0 +Authentication mode is not set + +You can verify neighbors with the show eigrp address-family ipv4 neighbors and show eigrp address-family ipv6 neighbors commands, as shown in Example 14-99. Just like we saw with the classic commands, if you want to verify whether the neighbor is a stub router, you can add the detail keyword to the commands. + +Example 14-99 Verifying Named EIGRP Neighbors Key +Topic Branch#show eigrp address-family ipv4 neighbors +EIGRP-IPv4 VR(TSHOOT_EIGRP) Address-Family Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.1.14.1 Fa1/0 14 00:31:08 88 528 0 8 +Branch#show eigrp address-family ipv6 neighbors +EIGRP-IPv6 VR(TSHOOT_EIGRP) Address-Family Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 Link-local address: Fa1/0 14 00:50:33 73 438 0 40 +FE80::C820:17FF:FE04:54 + + + + + + +From the Library of Outcast Outcast +576 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +To display the topology table, you can use the commands show eigrp address-family ipv4 topology and show eigrp address-family ipv6 topology, as shown in Example 14-100 + +Example 14-100 Verifying Named EIGRP Topology Tables + +Branch#show eigrp address-family ipv4 topology +EIGRP-IPv4 VR(TSHOOT_EIGRP) Topology Table for AS(100)/ID(4.4.4.4) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.12.0/24, 1 successors, FD is 13762560 +via 10.1.14.1 (13762560/1310720), FastEthernet1/0 +P 10.1.14.0/24, 1 successors, FD is 13107200 +via Connected, FastEthernet1/0 +P 10.1.3.0/24, 1 successors, FD is 15073280 +via 10.1.14.1 (15073280/2621440), FastEthernet1/0 +P 10.1.23.0/24, 1 successors, FD is 14417920 +via 10.1.14.1 (14417920/1966080), FastEthernet1/0 +P 10.1.4.0/24, 1 successors, FD is 1310720 +via Connected, GigabitEthernet0/0 +P 10.1.1.0/24, 1 successors, FD is 13762560 +via 10.1.14.1 (13762560/1310720), FastEthernet1/0 + +Branch#show eigrp address-family ipv6 topology +EIGRP-IPv6 VR(TSHOOT_EIGRP) Topology Table for AS(100)/ID(44.44.44.44) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:0:4::/64, 1 successors, FD is 1310720 +via Connected, GigabitEthernet0/0 +P 2001:DB8:0:1::/64, 1 successors, FD is 13762560 +via FE80::C820:17FF:FE04:54 (13762560/1310720), FastEthernet1/0 +P 2001:DB8:0:3::/64, 1 successors, FD is 15073280 +via FE80::C820:17FF:FE04:54 (15073280/2621440), FastEthernet1/0 +P ::/0, 1 successors, FD is 13762560 +via FE80::C820:17FF:FE04:54 (13762560/1310720), FastEthernet1/0 +P 2001:DB8:0:14::/64, 1 successors, FD is 13107200 +via Connected, FastEthernet1/0 +P 2001:DB8:0:12::/64, 1 successors, FD is 13762560 +via FE80::C820:17FF:FE04:54 (13762560/1310720), FastEthernet1/0 +P 2001:DB8:0:23::/64, 1 successors, FD is 14417920 +via FE80::C820:17FF:FE04:54 (14417920/1966080), FastEthernet1/0 + + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 577 + +Named EIGRP Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 14-9. + + + + +Named EIGRP “TSHOOT_EIGRP” + +Internet 192.0.2.1 + + + +10.1.1.0/24 +Gi1/0 + +Gi2/0 +Gi0/0 Gi1/0 + + +10.1.3.0/24 Gi1/0 + + + + +Gi0/0 + +R1 10.1.12.0/24 R2 +Fa3/0 + +10.1.23.0/24 R3 Gi0/0 + + + + +WAN 10.1.14.0/24 + +Gi0/0 + +Fa1/0 BRANCH +10.1.4.0/24 + + +Figure 14-9 Named EIGRP Trouble Tickets Topology + + +Trouble Ticket 14-5 + +Problem: Users in the 10.1.4.0/24 network indicate that they are not able to access resources outside of their LAN. + +On Branch, you verify the problem by pinging a few different IP addresses and source the packets from 10.1.4.4. As shown in Example 14-101, they all fail. + +Example 14-101 Verifying the Problem + +Branch#ping 10.1.3.3 source 10.1.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.3.3, timeout is 2 seconds: +Packet sent with a source address of 10.1.4.4 +..... +Success rate is 0 percent (0/5) +Branch#ping 192.0.2.1 source 10.1.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.0.2.1, timeout is 2 seconds: +Packet sent with a source address of 10.1.4.4 +..... +Success rate is 0 percent (0/5) +Branch#ping 10.1.1.1 source 10.1.4.4 +Type escape sequence to abort. + + + + +From the Library of Outcast Outcast +578 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: +Packet sent with a source address of 10.1.4.4 +..... +Success rate is 0 percent (0/5) + +Next you issue the show ip route command to verify whether any routes are installed in the routing table. As shown in Example 14-102, only local and directly connected routes are in the routing table. + +Example 14-102 Displaying the IPv4 Routing Table on Branch + +Branch#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.4.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.4.4/32 is directly connected, GigabitEthernet0/0 +C 10.1.14.0/24 is directly connected, FastEthernet1/0 +L 10.1.14.4/32 is directly connected, FastEthernet1/0 + +You hypothesize that Branch is not a neighbor with R1 across the WAN. You issue the show eigrp address-family ipv4 neighbors command, as shown in Example 14-103, and confirm that R1 is not a neighbor. + +Example 14-103 Displaying the Named EIGRP IPv4 Neighbor Table + +Branch#show eigrp address-family ipv4 neighbors +EIGRP-IPv4 VR(TSHOOT_EIGRP) Address-Family Neighbors for AS(100) + +Next you hypothesize that Fast Ethernet 1/0 (the interface that will form an adjacency with R1) is not participating in the named EIGRP process. You issue the command show eigrp address-family ipv4 interfaces, as shown in Example 14-104, and confirm your hypothesis. + +Example 14-104 Displaying the Named EIGRP IPv4 Interface Table + +Branch#show eigrp address-family ipv4 interfaces +EIGRP-IPv4 VR(TSHOOT_EIGRP) Address-Family Interfaces for AS(100) + + +Interface +Gi0/0 + +Xmit Queue +Peers Un/Reliable +0 0/0 + +PeerQ Mean +Un/Reliable SRTT +0/0 0 + +Pacing Time +Un/Reliable +0/0 + +Multicast +Flow Timer +0 + +Pending +Routes +0 + + +As shown in Example 14-105, the output of show ip interface brief indicates that Fast Ethernet 1/0 has an IPv4 address of 10.1.14.4. Therefore, a network statement is needed that will enable the EIGRP process on that interface. + + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 579 + +Example 14-105 Displaying the IPv4 Addresses of Interfaces + +Branch#show ip interface brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES unset administratively down down + +GigabitEthernet0/0 +FastEthernet1/0 + +10.1.4.4 +10.1.14.4 + +YES manual up up +YES manual up up + + +Armed with the information you have, you issue the show run | section router eigrp command on Branch to confirm that the network statement is missing. In Example 14-106 , you see that there is a valid network statement for 10.1.14.4. It is network 10.1.14.4 0.0.0.0 and would successfully enable the EIGRP process on the interface. Therefore, your hypothesis was incorrect. + +Example 14-106 Reviewing Named EIGRP Configuration in the Running Configuration + +Branch#show running-config | section router eigrp +router eigrp TSHOOT_EIGRP +! +address-family ipv4 unicast autonomous-system 100 +! +af-interface default +passive-interface +exit-af-interface +! +af-interface GigabitEthernet0/0 +no passive-interface +exit-af-interface +! +topology base +exit-af-topology +network 10.1.4.4 0.0.0.0 +network 10.1.14.4 0.0.0.0 +eigrp router-id 4.4.4.4 +eigrp stub connected summary +exit-address-family +! +address-family ipv6 unicast autonomous-system 100 +! +af-interface default +passive-interface +exit-af-interface +! +af-interface FastEthernet1/0 +no passive-interface +exit-af-interface +! + + + +From the Library of Outcast Outcast +580 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +topology base +maximum-paths 2 +variance 3 +exit-af-topology +eigrp router-id 44.44.44.44 +eigrp stub connected summary +exit-address-family + +What could cause a neighbor relationship not to form? You list a few: authentication, passive interface, wrong subnet. + +In Example 14-106, you notice that there are no authentication configurations. However, you do spot a passive interface command on Gig0/0. It is the no passive-interface com-mand. You also notice that af-interface default has the passive-interface command and recall that all interfaces inherit configs under af-interface default. You also recall that they can be overridden with commands at the interface level. Reviewing the topology in Figure 14-9, you come to the conclusion that the wrong interface was configured with the no passive-interface command. It should have been Fast Ethernet 1/0 and not Gig0/0. + +Example 14-107 presents the commands that you can use to fix this issue. Notice that once the issue is fixed, the neighbor relationship is formed with R1 at 10.1.14.1. + +Example 14-107 Modifying the Named EIGRP Configuration + +Branch#config t +Enter configuration commands, one per line. End with CNTL/Z. +Branch(config)#router eigrp TSHOOT_EIGRP +Branch(config-router)#address-family ipv4 unicast autonomous-system 100 +Branch(config-router-af)#af-interface GigabitEthernet0/0 +Branch(config-router-af-interface)#passive-interface +Branch(config-router-af-interface)#exit +Branch(config-router-af)#af-interface fastEthernet1/0 +Branch(config-router-af-interface)#no passive-interface +%DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 10.1.14.1 (FastEthernet1/0) is up: new adjacency +Branch(config-router-af-interface)#end +Branch# + +You then review the IPv4 routing table as shown in Example 14-108 and notice all the EIGRP-learned routes. + +Example 14-108 Verifying the EIGRP-Learned Routes + +Branch#show ip route +...output omitted... +Gateway of last resort is 10.1.14.1 to network 0.0.0.0 + +D*EX 0.0.0.0/0 [170/112640] via 10.1.14.1, 00:00:34, FastEthernet1/0 +10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 581 + +D 10.1.1.0/24 [90/107520] via 10.1.14.1, 00:05:53, FastEthernet1/0 +D 10.1.3.0/24 [90/117760] via 10.1.14.1, 00:05:53, FastEthernet1/0 +C 10.1.4.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.4.4/32 is directly connected, GigabitEthernet0/0 +D 10.1.12.0/24 [90/107520] via 10.1.14.1, 00:05:53, FastEthernet1/0 +C 10.1.14.0/24 is directly connected, FastEthernet1/0 +L 10.1.14.4/32 is directly connected, FastEthernet1/0 +D 10.1.23.0/24 [90/112640] via 10.1.14.1, 00:05:53, FastEthernet1/0 + +Next you reissue the same pings that were used to confirm the problem. In Example 14-109, they are successful. + +Example 14-109 Successful Pings from Branch to Various Network IPs + +Branch#ping 10.1.1.1 source 10.1.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: +Packet sent with a source address of 10.1.4.4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 44/55/72 ms +Branch#ping 10.1.3.3 source 10.1.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.3.3, timeout is 2 seconds: +Packet sent with a source address of 10.1.4.4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 52/79/92 ms +Branch#ping 192.0.2.1 source 10.1.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.0.2.1, timeout is 2 seconds: +Packet sent with a source address of 10.1.4.4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 76/84/92 ms + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +582 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 14-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 14-2 Key Topics for Chapter 14 Key +Topic Key Topic Element Description Page Number + + +List + +Example 14-2 + +Example 14-4 + +Example 14-7 + +Example 14-8 + +Section + +List + +Paragraph + +List + +Section + +Section + +List + +Example 14-33 + +Example 14-74 + +Example 14-76 + +Section + +Identifies the possible reasons why an EIGRP 518 neighbor relationship might not form +Verifying the Autonomous System Number with 519 show ip protocols +Verifying EIGRP interfaces with show ip eigrp 521 interfaces +Verifying K values with show ip protocols 522 + +Verifying passive interfaces with show ip protocols 523 + +Authentication 525 + +Identifies the possible reasons why EIGRP for IPv4 528 routes may be missing from the routing table +Describes how a better source of routing information 533 could cause suboptimal routing +Identifies what should be considered when 534 troubleshooting route filters +Stub configuration 535 + +Split-horizon 537 + +Outlines what to keep in mind while troubleshooting 544 route summarization +Verifying variance and maximum paths 545 + +Verifying EIGRP for IPv6 Neighbors 561 + +Verifying EIGRP for IPv6 autonomous system 562 numbers with show ipv6 protocols +Interface not participating in routing process 563 + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 583 + + +Key Topic Element Description Page Number Section Stub configuration 565 +Example 14-83 Verifying EIGRP stub configuration of neighbor router 567 + + +Example 14-96 + +Example 14-97 + +Output of show eigrp protocols 573 + +Verifying interfaces participating in the named 574 EIGRP process + +Paragraph Explains how to verify EIGRP for IPv4 and EIGRP for 574 IPv6 timers, split-horizon, and authentication settings when using named EIGRP +Example 14-99 Verifying named EIGRP neighbors 575 + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +hello packet, 224.0.0.10, network command, autonomous system number, K values, passive interface, key ID, key string, key chain, stub, split-horizon, successor, feasible successor, reported distance, feasible distance, discontiguous network, autosummari-zation, classful, classless, maximum paths, variance, named EIGRP, address family + +Command Reference to Check Your Memory + +This section includes the most important show and debug commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 14-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully identify and troubleshoot the issues presented in this chapter. + +Table 14-3 EIGRP show and debug Commands + +Task Command Syntax + +Displays the IPv4 routing protocols enabled on the router. For EIGRP, it displays autonomous system number, outgoing and incoming filters, K values, router ID, maximum paths, variance, local stub configuration, routing for networks, routing information sources, administrative distance, and passive interfaces. +Shows a router’s EIGRP neighbors. + +show ip protocols + + + + + +show ip eigrp neighbors + + + + +From the Library of Outcast Outcast +584 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Shows detailed information about a router’s EIGRP neighbors, including whether the neighbor is a stub router, along with the types of networks it is advertising as a stub. +Displays all of a router’s interfaces configured to participate in an EIGRP routing process (with the exception of passive interfaces). +Displays the interfaces participating in the EIGRP for IPv4 routing process, along with EIGRP hello and hold timers, whether the split-horizon rule is enabled, and whether authentication is being used. +Displays the EIGRP configuration in the running configuration. +Displays the configuration of a specific interface in the running configuration. Valuable when trying to troubleshoot EIGRP interface commands. +Used to display the key chains and associated keys and key strings. +Displays IPv4 interface parameters. For EIGRP, you can use it to verify whether the interface has joined the correct multicast group (224.0.0.10), and whether there are any ACLs applied to the interface that might be preventing an EIGRP adjacency from forming. +Displays routes known to a router’s EIGRP routing process. These routes are contained in the EIGRP topology table. The all-links keyword displays all routes learned for each network, and without the all-links keyword, only the successors and feasible successors are displayed for each network. +Shows routes known to a router’s IP routing table that were injected by the router’s EIGRP routing process. +Shows a router’s EIGRP for IPv6 neighbors. + +Displays the IPv6 routing protocols enabled on the router. For EIGRP, it displays autonomous system number, outgoing and incoming filters, K values, router ID, maximum paths, variance, local stub configuration, interfaces participating in the routing process, routing information sources, administrative distance, and passive interfaces. +Displays all of a router’s interfaces configured to participate in an EIGRP for IPv6 routing process (with the exception of passive interfaces). + +Command Syntax +show ip eigrp neighbors detail + + + +show ip eigrp interfaces + + +show ip eigrp interfaces detail + + + +show run | section router eigrp + +show run interface interface_ type interface_number + +show key chain + +show ip interface interface_type interface_number + + + +show ip eigrp topology [all-links] + + + + + +show ip route eigrp + +show ipv6 eigrp neighbors + +show ipv6 protocols + + + + + + +show ipv6 eigrp interfaces + + + + + +From the Library of Outcast Outcast +Chapter 14: Troubleshooting EIGRP 585 + + + +Task +Displays the interfaces participating in the EIGRP for IPv6 routing process, along with EIGRP hello and hold timers, whether the split-horizon rule is enabled, and whether authentication is being used. +Displays the IPv6 EIGRP configuration in the running configuration. + +Command Syntax +show ipv6 eigrp interfaces detail + + + +show run | section ipv6 router eigrp + +Shows detailed information about a router’s EIGRP neigh- show ipv6 eigrp neighbors detail bors, including whether the neighbor is a stub router, along +with the types of networks it is advertising as a stub. + + +Shows routes known to a router’s IP routing table that were injected by the router’s EIGRP routing process. +Displays the EIGRP for IPv4 and IPv6 address families that are enabled on the router. It displays autonomous system number, K values, router ID, maximum paths, variance, local stub configuration, and administrative distance. +Displays the interfaces that are participating in the named EIGRP for IPv4 address family. +Displays the interfaces that are participating in the named EIGRP for IPv6 address family. +Displays detailed information about the interfaces participating in the named EIGRP for IPv4 address family, including hello interval and hold time, whether split-horizon is enabled, whether authentication is set, and statistics about hellos and packets. +Displays detailed information about the interfaces participating in the named EIGRP for IPv6 address family, including hello interval and hold time, whether split-horizon is enabled, whether authentication is set, and statistics about hellos and packets. +Displays the EIGRP for IPv4 neighbor relationships that have formed. +Displays the EIGRP for IPV6 neighbor relationships that have formed. +Displays the EIGRP for IPv4 topology table for the address family. +Displays the EIGRP for IPv6 topology table for the address family. +Can be used to display all EIGRP packets exchanged with a router’s EIGRP neighbors. However, the focus of the command can be narrowed to only display specific EIGRP packet types (for example, EIGRP hello packets). + +show ipv6 route eigrp + +show eigrp protocols + + + + +show eigrp address-family ipv4 interfaces +show eigrp address-family ipv6 interfaces +show eigrp address-family ipv4 interfaces detail + + + +show eigrp address-family ipv6 interfaces detail + + + +show eigrp address-family ipv4 neighbors +show eigrp address-family ipv6 neighbors +show eigrp address-family ipv4 topology +show eigrp address-family ipv6 topology +debug eigrp packets + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting OSPFv2: This section covers the reasons why OSPFv2 neighbor relationships are not being formed and how you can identify them. In addition, you will learn the reasons why OSPFv2 routes might be missing and how to determine why they are missing. +■ OSPFv2 Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. +■ Troubleshooting OSPFv3 for IPv6: In this section, you examine the different commands that you can use to troubleshoot OSPFv3 issues. +■ OSPFv3 Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. +■ Troubleshooting OSPFv3 Address Families: In this section, you discover the commands that you can use to troubleshoot issues related to OSPFv3 address family configurations. +■ OSPFv3 Address Family Trouble Tickets: This sec-tion provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 15 + + + + + + +Troubleshooting OSPF + + +The Open Shortest Path First (OSPF) dynamic routing protocol is a link-state routing protocol that uses Dijkstra’s shortest path first (SPF) algorithm. It is an extremely scalable routing protocol because of its hierarchical design implementation. OSPF can route for both IPv4 and IPv6 protocols. This chapter focuses on troubleshooting both OSPFv2 and OSPFv3 using the classic configurations and the newer OSPF address family configura-tions. + +Before any routes can be exchanged between OSPF routers on the same LAN or across a WAN, an OSPF neighbor relationship has to be formed. There are many reasons why a neighbor relationship will not form, and as a troubleshooter, you need to be aware of them. This chapter delves deeply into these reasons and gives you the tools needed to identify them and successfully solve neighbor issues. + +Once neighbor relationships are formed, neighboring routers will exchange OSPF LSAs, which contain information about routes. In various cases, routes may end up missing, and you need to be able to determine why the routes are missing. This chapter discusses the various ways that OSPF routes could go missing, how you can identify the reasons why they are missing, and how you can solve route-related issues. + +In this chapter, you will also learn how to troubleshoot issues related to load balancing, summarization, and discontiguous areas. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 15-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 15-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting OSPFv2 + +Troubleshooting OSPFv3 + +Troubleshooting OSPFv3 Address Families + +Questions +1–6 + +7–8 + +9–10 + + + + +From the Library of Outcast Outcast +588 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which three of the following are reasons why an OSPF neighbor relationship will not form? + +a. Mismatched timers + +b. Mismatched area numbers + +c. Duplicate router IDs + +d. Wrong designated router was elected + +2. In which two OSPF states are you likely to find routers that have an MTU mismatch? + +a. Init + +b. 2Way + +c. Exstart + +d. Exchange + +3. Which OSPFv2 command enables you to verify the hello interval and the dead inter-val? + +a. show ip protocols + +b. show ip ospf interface + +c. show ip ospf neighbor + +d. show ip ospf database + +4. Which OSPFv2 debug command enables you to verify whether area numbers are mismatched? + +a. debug ip ospf hello + +b. debug ip ospf adj + +c. debug ip ospf packet + +d. debug ip ospf events + +5. Which OSPF network type is the default on LAN interfaces? + +a. Broadcast + +b. NBMA + +c. Point to point + +d. Point to multipoint + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 589 + +6. Which LSA type describes routes outside the area but still within the OSPF routing domain (interarea routes)? + +a. 1 + +b. 2 + +c. 3 + +d. 5 + +7. Which IPv6 OSPFv3 command enables you to verify whether an area is a stub, total-ly stubby, NSSA, or totally NSSA area? + +a. show ipv6 protocols + +b. show ipv6 ospf + +c. show ipv6 ospf interface + +d. show ipv6 ospf neighbor + +8. Which IPv6 OSPFv3 command enables you to verify which routers the local router has formed neighbor adjacencies with? + +a. show ipv6 protocols + +b. show ipv6 ospf + +c. show ipv6 ospf interface + +d. show ipv6 ospf neighbor + +9. Which two OSPFv3 address family commands are used to verify which OSPFv3 address family an interface is participating in? + +a. show ospfv3 + +b. show ospfv3 interface brief + +c. show ospfv3 neighbors + +d. show ospfv3 database + +10. Which OSPFv3 address family debug command will identify whether there is a mis-matched stub area configuration? + +a. debug ospfv3 hello + +b. debug ospfv3 packet + +c. debug ospfv3 adj + +d. debug ospfv3 events + + + + + + + +From the Library of Outcast Outcast +590 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Foundation Topics + + +Troubleshooting OSPFv2 + +OSPF establishes neighbor relationships by sending hello packets out interfaces partici-pating in the OSPF process. To enable the OSPF process on an interface and place it in an OSPF area, you use the network ip_address wildcard_mask area area_id command in router OSPF configuration mode or the ip ospf process_id area area_id command in interface configuration mode. For example, the following network area command enables OSPF on all interfaces with an IP address from 10.1.1.0 through 10.1.1.255 and places them in area 0: network 10.1.1.0 0.0.0.255 area 0. The following interface con- +figuration command enables the OSPF process on the interface and places it in area 51: ip ospf 1 area 51. Because there are two different ways to enable OSPFv2 on an interface, you have to be very careful when troubleshooting neighbor adjacencies so that you are not led down the wrong path thinking the OSPF process was not enabled on an interface when in fact it was. This is your warning to check both places. + +OSPF routers will receive LSAs from every router within the same area, meaning they learn about routes directly from the source within the same area. As a result, it is neces-sary that the LSAs are flooded through the area. This is mandatory because every router in an area must have the exact same LSDB for that area. This makes troubleshooting miss-ing OSPF routes more difficult than distance vector routing protocols because it is harder to follow the path, especially in a multi-area OSPF domain. + +This section focuses on the reasons why an OSPF neighbor relationship might not form and how we can identify them during the troubleshooting process. In addition, we will examine the reasons why OSPF routes might be missing, and how we can determine the reason why they are missing. To wrap up the section, we will troubleshoot OSPF issues that do not fall into the neighbor relationship or route categories. + +Troubleshooting OSPFv2 Neighbor Adjacencies + +To verify OSPFv2 neighbors, you use the show ip ospf neighbor command. In Example 15-1, you see a sample output of the show ip ospf neighbor command. It lists the neigh-bor ID, which is the router ID (RID) of the neighbor, the priority of the neighbor for the designated router / backup designated router (DR/BDR) election process, the state of the neighbor (covered shortly), and whether they are a DR, BDR, or DROther. In addition, it displays the dead time, which is how long the local router will wait until it declares the neighbor down if it does not hear another hello packet within that time (default is 40 sec-onds on a LAN). You can also see the neighbor’s interface IP address that they sent the +hello packet from and the local router interface that is used to reach that neighbor. + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 591 + +Example 15-1 Verifying OSPF Neighbors with show ip ospf neighbor +Key +Topic R1#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface +10.1.23.2 1 FULL/BDR 00:00:37 10.1.12.2 GigabitEthernet1/0 + +When an OSPF neighbor adjacency is successfully formed you will receive a syslog mes-sage similar to the following: + +%OSPF-5-ADJCHG: Process 1, Nbr 10.1.23.2 on GigabitEthernet1/0 from LOADING to FULL, Loading Done +Here is a listing of reasons why an OSPFv2 neighbor relationship might not form: + +■ Interface is down: The interface has to be up/up. Key +Topic ■ Interface not running the OSPF process: If the interface is not enabled for OSPF, it +will not send hello packets or form an adjacency. + +■ Mismatched timers: Hello and dead timers have to match between neighbors. + +■ Mismatched area numbers: Both ends of a link must be in the same OSPF area. + +■ Mismatched area type: In addition to a normal OSPF area type, an area type could be either stub or not-so-stubby area (NSSA). The routers have to agree on the type of area they are in. +■ Different subnets: Neighbors have to be in the same subnet. + +■ Passive interface: The passive interface feature suppresses the sending and receiving of hello packets while still allowing the interfaces network to be advertised. + +■ Mismatched authentication information: If one OSPF interface is configured for authentication, the OSPF interface at the other end of the link has to be configured with matching authentication information. +■ ACLs: An ACL that is denying packets to the OSPF multicast address 224.0.0.5. + +■ MTU mismatch: The maximum transmission unit of neighboring interfaces must match. + +■ Duplicate router IDs: Router IDs must be unique. + +■ Mismatched network types: Based on the OSPF network type characteristics and default values, two neighbors configured with a different OSPF network type might not form an adjacency. + +Adjacencies are not established upon the immediate receipt of hello messages. Rather, an adjacency transitions through multiple states, as described in Table 15-2. + + + + + + + +From the Library of Outcast Outcast +592 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 15-2 Adjacency States +Key +Topic State Description + + +Down + +Attempt + + +Init + + + + +2Way + + + +Exstart + + + + + + + + +Exchange + + + + + +Loading + + + + + +Full + +This state indicates that no hellos have been received from a neighbor. + +This state occurs after a router sends a unicast hello (as opposed to a multicast hello) to a configured neighbor and has not yet received a hello from that neighbor. +This state occurs on a router that has received a hello message from its neighbor; however, the OSPF RID of the receiving router was not contained in the +hello message. If a router remains in this state for a long period, something is probably preventing that router from correctly receiving hello packets from the neighboring router. +This state occurs when two OSPF routers have received hello messages from each other, and each router saw its own OSPF RID in the hello message it received. The 2Way state is an acceptable state to stay in between DROthers on an Ethernet LAN. +This state occurs when the routers forming a full neighbor adjacency decide who will send their routing information first. This is accomplished using the RID. +The router with the higher RID becomes the master and the other will become the slave. The master will send the routing information first. In a multiaccess network, the DR and BDR have to be determined first before this state starts. However, the DR does not have to be the master because each master/slave election is on a per-neighbor basis. If a router remains in this state for a long period, a maximum transmission unit (MTU) mismatch could exist between the neighboring routers, or a duplicate OSPF RID might exist. +This state occurs when the two routers forming an adjacency send one another database descriptor (DBD) packets containing information about a router’s link-state database. Each router compares the DBD packets received from the other router to identify missing entries in its own database. If a router remains in this state for a long period, an MTU mismatch could exist between the neighboring routers. +Based on the missing link-state database entries identified in the Exchange state, the Loading state occurs when each neighboring router requests the other router to send those missing entries. If a router remains in this state for a long period, a packet might have been corrupted, or a router might have a memory issue. Alternatively, it is possible that such a condition could result from the neighboring routers having an MTU mismatch. +This state indicates that the neighboring OSPF routers have successfully exchanged their link-state information with one another, and an adjacency has been formed. + + + +When an OSPF neighbor relationship does not form, the neighbor is not listed in the neighbor table. Therefore, you will need the assistance of an accurate network diagram and the show cdp neighbors command to verify who should be the neighbors. + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 593 + +When troubleshooting OSPF adjacencies, you need to be aware of how to verify the parameters associated with each reason we listed earlier. Let’s look at them individually. + +Interface Is Down + +The interface has to be up if you plan on forming an OSPF neighbor adjacency. As we have seen already, we can verify the status of an interface with the show ip interface brief command. + +Interface Not Running the OSPF Process + +If the router OSPF configuration mode network ip_address wildcard_mask area area_id command or the ip ospf process_id area area_id interface command is miscon-figured, OSPF may not be enabled on the proper interfaces. As a result, hello packets will not be sent and neighbor relationships will not be formed. You also have to specify the OSPF area the interface belongs to. Therefore, if the command is correct, except for the area ID, the interface is participating in the OSPF process but in the wrong area. This will prevent a neighbor relationship from forming as well. You can verify which interfaces are participating in the OSPF process with the command show ip ospf interface brief, as shown in Example 15-2. In this example, two interfaces are participating in OSPF process 1. They are both in area 1 and are the designated router interfaces for the multiaccess networks. You can also verify the IP address and masks of the interfaces along with the number of full neighbor relationships that have been formed out the interface versus the total number of neighbors out the interface. + + +Note Remember that OSPF passive interfaces do show up in this output. + + + +Example 15-2 Verifying OSPF Interfaces with show ip ospf interface brief Key +Topic R1#show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/0 1 1 +Gi1/0 1 1 + +10.1.1.1/24 1 DR 0/0 +10.1.12.1/24 1 DR 1/1 + + +The output of show ip protocols displays the network ip_address wildcard_mask area area_id statements as well as those interfaces that were enabled for OSPF with the ip ospf process_id area area_id interface command. Focus on the highlighted text in Example 15-3. Notice that it states Routing for Networks. Those are not the networks we are routing for. We are routing for the networks associated with the interfaces OSPF will be enabled on, based on the network area statement. In this case, 10.1.1.1 0.0.0.0 area 1 really means network 10.1.1.1 0.0.0.0 area 1. Therefore, the interface with this IP address will be enabled for the OSPF process and placed in area 1. In addition, you can see which interfaces were explicitly configured to participate in the OSPF process with the ip ospf process_id area area_id interface configuration mode command. In this + + + + +From the Library of Outcast Outcast +594 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +example, it is Gigabit Ethernet 1/0 that was enabled for OSPF with the ip ospf 1 area 1 command, and Gigabit Ethernet 0/0 was enabled for OSPF with the network 10.1.1.1 0.0.0.0 area 1 router OSPF configuration mode command. + +Example 15-3 Verifying OSPF-Enabled Interfaces with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 10.1.12.1 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +Routing Information Sources: + +Gateway +10.1.23.2 + +Distance +110 + +Last Update +00:24:22 + +Distance: (default is 110) + +As you can see, the network area statement is extremely important, as is the ip ospf area command. If either are misconfigured, interfaces that should be participating in the OSPF process might not be, and interfaces that should not be participating in the OSPF process might be. In addition, it is possible that they might be participating but in the wrong area, causing neighbor relationships not to form. Therefore, you should be able to recog-nize issues related with both these commands. + + +Note If an interface is enabled for OSPF with both the network area command and the ip ospf area command, the ip ospf area command takes precedence. + + + +Mismatched Timers + +Unlike Enhanced Interior Gateway Routing Protocol (EIGRP), OSPF timers do have to match between neighbors to form a neighbor adjacency. The hello timer defaults to 10 seconds for broadcast and point-to-point network types and 30 seconds for nonbroad-cast and point-to-multipoint network types. The dead timer defaults to 40 seconds for broadcast and point-to-point network types and 120 seconds for nonbroadcast and point-to-multipoint network types. To verify the current timers associated with an OSPF interface, issue the show ip ospf interface interface_type interface_number command, + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 595 + +as shown in Example 15-4. In this example, Gigabit Ethernet 1/0 is using the default tim-ers of 10 and 40. When determining whether timers match, use the spot-the-difference method between the outputs on both routers. + +Example 15-4 Displaying OSPF Interface Timers on R1 Gigabit Ethernet 1/0 Key +Topic R1#show ip ospf interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet Address 10.1.12.1/24, Area 1, Attached via Interface Enable +Process ID 1, Router ID 10.1.12.1, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Enabled by interface config, including secondary ip addresses +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 10.1.12.1, Interface address 10.1.12.1 +Backup Designated router (ID) 10.1.23.2, Interface address 10.1.12.2 +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:04 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 1/1, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 1 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 10.1.23.2 (Backup Designated Router) +Suppress hello for 0 neighbor(s) + +Using the debug ip ospf hello command when troubleshooting adjacencies will reveal mismatched timers, as shown in Example 15-5. In this example, the packet received (R) has a dead of 44 and a hello of 11. The local device (C) has a dead of 40 and a hello of 10. + +Example 15-5 Using debug ip ospf hello to Identify Mismatched Timers + +R1#debug ip ospf hello +OSPF hello debugging is on +R1# +OSPF-1 HELLO Gi1/0: Rcv hello from 2.2.2.2 area 1 10.1.12.2 +OSPF-1 HELLO Gi1/0: Mismatched hello parameters from 10.1.12.2 +OSPF-1 HELLO Gi1/0: Dead R 44 C 40, Hello R 11 C 10 Mask R 255.255.255.0 C 255.255.255.0 +R1# + + + + + + + +From the Library of Outcast Outcast +596 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + +Key Topic + +Mismatched Area Numbers + +OSPF uses the concept of areas to make it an extremely scalable dynamic routing proto-col. For OSPF routers to form a neighbor adjacency, their neighboring interfaces must be in the same area. You can verify the area an OSPF interface is part of using the show ip ospf interface interface_type interface_number command, as shown in Example 15-6, or the show ip ospf interface brief command, as shown in Example 15-7. When deter-mining whether area IDs match, use the spot-the-difference method between the outputs +on both routers. + + +Example 15-6 Displaying OSPF Interface Area Using the show ip ospf interface inter-face_type interface_number Command + +R1#show ip ospf interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet Address 10.1.12.1/24, Area 1 , Attached via Interface Enable +Process ID 1, Router ID 10.1.12.1, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Enabled by interface config, including secondary ip addresses +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 10.1.12.1, Interface address 10.1.12.1 +Backup Designated router (ID) 10.1.23.2, Interface address 10.1.12.2 +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:04 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 1/1, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 1 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 10.1.23.2 (Backup Designated Router) +Suppress hello for 0 neighbor(s) + + +Example 15-7 Displaying OSPF Interface Area Using the show ip ospf interface brief Command + +R1#show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C +Gi1/0 1 1 10.1.12.1/24 1 DR 1/1 + +Using the debug ip ospf adj command when troubleshooting adjacencies will reveal mis-matched area numbers, as shown in Example 15-8. In this example, the packet received has an area ID of 1 and the local interface is participating in area 2. + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 597 + +Example 15-8 Using debug ip ospf adj to Identify Mismatched Area Numbers + +R1#debug ip ospf adj +OSPF adjacency debugging is on +R1# +OSPF-1 ADJ Gi1/0: Rcv pkt from 10.1.12.2, area 0.0.0.2, mismatched area 0.0.0.1 in the header +R1#u all +All possible debugging has been turned off + + +Mismatched Area Type + +The default OSPF area type is classified as a normal area. However, you can convert a normal area into a stub area or NSSA area to control the types of LSAs that will be sent into the area from an Area Border Router (ABR). For routers within an area to form adja-cencies, they must agree on the area type. Within the hello packet, there is a stub area flag that is designed to indicate the type of area the neighbor is in. You can verify the types of areas connected to the router with the show ip protocols command. However, it does not tell you which area is which type. In Example 15-9, which displays the output of show ip protocols, there is only one area (area 1); therefore, you can deduce that it is the stub area. However, if there is a router with multiple areas connected to it, you will verify the areas and their type using the show ip ospf command, as shown in Example 15-9. In this example, any interface in area 1 is in a stub area. + +Example 15-9 Determining the Type of OSPF Areas +Key +Topic R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 10.1.12.1 +Number of areas in this router is 1. 0 normal 1 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +Routing Information Sources: + +Gateway +10.1.23.2 + +Distance +110 + +Last Update +00:04:42 + +Distance: (default is 110) + +R1#show ip ospf +Routing Process "ospf 1" with ID 10.1.12.1 +Start time: 02:23:19.824, Time elapsed: 02:08:52.184 + + + + +From the Library of Outcast Outcast +598 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +...output omitted... +Reference bandwidth unit is 100 mbps +Area 1 +Number of interfaces in this area is 2 +It is a stub area +Area has no authentication +SPF algorithm last executed 00:05:46.800 ago +...output omitted... + +Using the debug ip ospf hello command when troubleshooting adjacencies will reveal mismatched area types, as shown in Example 15-10. In this example, it states that the packet received has a mismatched Stub/Transit area option bit. + +Example 15-10 Using debug ip ospf hello to Identify Mismatched Area Types + +R1#debug ip ospf hello +OSPF hello debugging is on +R1# +OSPF-1 HELLO Gi1/0: Rcv hello from 2.2.2.2 area 1 10.1.12.2 +OSPF-1 HELLO Gi1/0: Hello from 10.1.12.2 with mismatched Stub/Transit area option bit +R1# + + +Different Subnets + +To form an OSPF neighbor adjacency, the router interfaces must be on the same subnet. You can verify this in many ways. The simplest is to look at the interface configuration in the running configuration with the show run interface interface_type interface_number command. Example 15-11 displays the configuration of Gig1/0 on R1 and Gig0/0 on R2. Are they in the same subnet? Yes! Based on the IP address and the subnet mask, they would both be in the 10.1.12.0/24 subnet. + +Example 15-11 Verifying Neighboring Interfaces Are on the Same Subnet + +R1#show running-config interface gigabitEthernet 1/0 +Building configuration... + +Current configuration : 108 bytes +! +interface GigabitEthernet1/0 +ip address 10.1.12.1 255.255.255.0 +ip ospf 1 area 1 +negotiation auto +end + +R2#show running-config interface gigabitEthernet 0/0 + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 599 + +Building configuration... + +Current configuration : 132 bytes +! +interface GigabitEthernet0/0 +ip address 10.1.12.2 255.255.255.0 +negotiation auto +end + + +Passive Interface + + + + + +Key Topic + +The passive interface feature is a must have for all organizations. It does two things: 1) reduces the OSPF related traffic on a network; 2) improves OSPF security. + +The passive interface feature turns off the sending and receiving of OSPF packets on an interface while still allowing the interfaces network ID to be injected into the OSPF pro-cess and advertised to other OSPF neighbors. This ensures that rogue routers that attach to the network will not be able to form an adjacency with your legitimate router on that interface since it is not sending or receiving OSPF packets on the interface. However, if you configure the wrong interface as passive, a legitimate OSPF neighbor relationship will not be formed. As shown in the show ip protocols output of Example 15-12, Gigabit Ethernet 0/0 is a passive interface. If there are no passive interfaces, this section will not +appear in the output of show ip protocols. + + +Example 15-12 Verifying Passive Interfaces with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 10.1.12.1 +Number of areas in this router is 1. 0 normal 1 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +Passive Interface(s): +GigabitEthernet0/0 +Routing Information Sources: + +Gateway +10.1.23.2 + +Distance +110 + +Last Update +00:00:03 + +Distance: (default is 110) + + + + + +From the Library of Outcast Outcast +600 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Mismatched Authentication Information + +Authentication is used to ensure that your OSPF routers only form neighbor relation-ships with legitimate routers and they only accept OSPF packets from legitimate routers. Therefore, if authentication is implemented, both routers must agree on the settings for a neighbor relationship to form. With authentication, you can use the spot-the-difference method when troubleshooting. OSPF supports three types of authentication: + +■ Null: Known as type 0 and means no authentication + +■ Plain text: Known as type 1 and sends credentials in clear text + +■ MD5: Known as type 2 and sends a hash + +OSPF authentication can be enabled on an interface-by-interface basis or for all interfaces in the area at the same time. Knowing which commands to use to verify these different authentication configuration options is important. To verify whether authentication has been enabled for the entire area on the router, you use the show ip ospf command, as shown in Example 15-13. However, with message digest 5 (MD5) authentication, you +still have to verify the key ID that is being used on an interface-by-interface basis by using the show ip ospf interface interface_type interface_number command, as shown in Example 15-14. In addition, you must verify the case sensitive key string that is being used by using the show run interface interface_type interface_number command. + +Example 15-13 Verifying OSPF Area Authentication +Key +Topic R1#show ip ospf +Routing Process "ospf 1" with ID 10.1.12.1 +Start time: 02:23:19.824, Time elapsed: 02:46:34.488 +...output omitted... +Reference bandwidth unit is 100 mbps +Area 1 +Number of interfaces in this area is 2 +It is a stub area +Area has message digest authentication +SPF algorithm last executed 00:25:12.220 ago +...output omitted... + + +Example 15-14 Verifying OSPF Authentication Key Key +Topic R1#show ip ospf interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet Address 10.1.12.1/24, Area 1, Attached via Interface Enable +...output omitted... +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) +Message digest authentication enabled +Youngest key id is 1 + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 601 + + +Note If you configure authentication on an interface-by-interface basis, the output of show ip ospf will state Area has no authentication. Therefore, you need to make sure you check the output of show ip ospf interface as well. + + +Using the debug ip ospf adj command when troubleshooting adjacencies will reveal mismatched authentication information, as shown in Example 15-15. In this example, the packet received is using null authentication (type 0), and the local router is using plain text authentication (type 1). + +Example 15-15 Using debug ip ospf adj to Identify Mismatched Authentication Information + +R1#debug ip ospf adj +OSPF adjacency debugging is on +R1# +OSPF-1 ADJ Gi1/0: Rcv pkt from 10.1.12.2 : Mismatched Authentication type. Input packet specified type 0, we use type 1 +R1# + + +ACLs + +Access control lists (ACLs) are extremely powerful. Depending on how they are imple-mented will determine what they are controlling in your network. If an ACL is applied to an interface and the ACL is not permitting OSPF packets, a neighbor relationship will not form. To determine whether an ACL is applied to an interface, use the show ip interface interface_type interface_number command, as shown in Example 15-16. Notice that ACL 100 is applied inbound on interface Gig1/0. To verify the ACL 100 entries, issue the com-mand show access-list 100, as shown in Example 15-17. In this case, you can see that ACL 100 is denying OSPF traffic, which would prevent a neighbor relationship from forming. + +Example 15-16 Verifying ACLs Applied to Interfaces + +R1#show ip interface gig 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet address is 10.1.12.1/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is 100 +Proxy ARP is enabled +Local Proxy ARP is disabled +Security level is default +Split horizon is enabled + + + +From the Library of Outcast Outcast +602 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-17 Verifying ACLs Entries + +R1#show access-lists 100 +Extended IP access list 100 +10 deny ospf any any (62 matches) +20 permit ip any any + + + + + +Key Topic + +MTU Mismatch + +For OSPF routers to become neighbors and achieve the full adjacency state, each router’s interface forming the adjacency must have the exact same MTU. If not, the routers will see each other but get stuck in the exstart/exchange states. In Example 15-18 the output of show ip ospf neighbor indicates that R1 is stuck in the exchange state and that R2 is +stuck in the exstart state. + + +Example 15-18 Symptoms of an MTU Mismatch (Stuck in Exstart/Exchange) + +R1#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface +10.1.23.2 1 EXCHANGE/DR 00:00:38 10.1.12.2 GigabitEthernet1/0 + +R2#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface +10.1.12.1 1 EXSTART/BDR 00:00:37 10.1.12.1 GigabitEthernet0/0 + +In the output of show ip ospf interface brief, you will see the Nbrs F/C column without expected values. In Example 15-19, you see 0/1 in the Nbrs F/C column, which indicates that there is one neighbor out the interface but that there are zero full adjacencies. + +Example 15-19 Symptoms of an MTU Mismatch (Nbrs Column Values Do Not Match) + +R1#show ip ospf interface brief + +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi1/0 1 1 +Gi0/0 1 1 + +10.1.12.1/24 +10.1.1.1/24 + +1 BDR 0/1 +1 DR 0/0 + + +To verify the MTU configured on an interface, issue the show run interface interface_ type interface_number command. As shown in Example 15-20, the MTU of Gigabit Ethernet 1/0 on R1 is 1476, and because nothing is listed in the Gigabit Ethernet 0/0 con-figuration of R2, it is using the default value of 1500. + + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 603 + +Example 15-20 Verifying the MTU of an Interface + +R1#show run interface gigabitEthernet 1/0 +Building configuration... + +Current configuration : 195 bytes +! +interface GigabitEthernet1/0 +ip address 10.1.12.1 255.255.255.0 +ip mtu 1476 +ip ospf authentication-key CISCO +ip ospf message-digest-key 1 md5 CISCO +ip ospf 1 area 1 +negotiation auto +end + +R2#show run interface gigabitEthernet 0/0 +Building configuration... + +Current configuration : 211 bytes +! +interface GigabitEthernet0/0 +ip address 10.1.12.2 255.255.255.0 +ip ospf authentication message-digest +ip ospf message-digest-key 1 md5 CISCO +negotiation auto +end + +To solve this issue, you can either manually modify the MTU values of the interfaces so that they match, or you can use the ip ospf mtu-ignore interface configuration com- +mand, which will stop OSPF from comparing the MTU when trying to form an adjacency. + + +Duplicate Router IDs + +RIDs must be unique for many reasons. One of the reasons is that a neighbor relation-ship will not form between two routers if they have the same RID. When a duplicate RID exists, you will receive a syslog message similar to the following: + +%OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id 10.1.23.2 from 10.1.12.2 on interface GigabitEthernet1/0 +To verify the RID of an OSPF router use the show ip protocols command as shown in Example 15-21. However, almost all OSPF show commands display the RID in their output so you can verify it anyway you like. In this case, the RID of R1 is 10.1.23.2, as shown in the output of show ip protocols. If you manually change the RID with the router-id command in router OSPF configuration mode you must reset the OSPF process with the clear ip ospf process command before it takes affect. + + + + +From the Library of Outcast Outcast +604 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +router + +Example 15-21 Verifying OSPF RID + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 10.1.23.2 +Number of areas in this router is 1. 0 normal 1 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +Passive Interface(s): +Ethernet0/0 +GigabitEthernet0/0 +Routing Information Sources: + +Gateway +10.1.23.2 + +Distance +110 + +Last Update +00:05:31 + +Distance: (default is 110) + + +Mismatched Network Types + +OSPF supports multiple network types. Different network types have different default values. Therefore, if two OSPF routers that are trying to form a neighbor adjacency are configured with noncompatible network types, a neighbor relationship will not form. Table 15-3 shows a listing of the OSPF network types and their characteristics. + + +Table 15-3 Key +Topic Type + + +OSPF Network Types and Characteristics + +Default Neighbors DR/BDR Timers + + + +Broadcast Default on LAN interfaces + +Discovered automatically + +DR and BDR elected automatically + +Hello 10 + +Dead 40 + + + +NBMA (Nonbroadcast) + +Default on Frame Relay main and point-to-multipoint interfaces + +Statically configured + +DR must be manually Hello 30 configured on the hub Dead 120 + + + +Point-to-Point Default on point to point serial and point-to-point Frame Relay subinterfaces + +Discovered No DR or BDR automatically + +Hello 10 + +Dead 40 + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 605 + + +Type Default Neighbors DR/BDR Timers + +Point-to-Multipoint + +(Not a default) Optimal Discovered No DR or BDR for hub-and-spoke automatically +topologies (Frame-Relay) + +Hello 30 + +Dead 120 + + + +Point-to-Multipoint Nonbroadcast + +(Not a default) Optimal for hub-and-spoke topologies (Frame Relay) that do not support broadcast or multicast traffic + +Statically No DR or BDR Configured + +Hello 30 + +Dead 120 + + + +To determine the network type associated with an OSPF-enabled interface, issue the command show ip ospf interface interface_type interface_number. In Example 15-22, R1’s interface Gig1/0 is using the OSPF network type Broadcast. Use the spot-the- +difference troubleshooting method when determining whether the network types do not match. + +Example 15-22 Verifying OSPF Network Type + +R1#show ip ospf interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet Address 10.1.12.1/24, Area 1, Attached via Interface Enable +Process ID 1, Router ID 10.1.12.1, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Enabled by interface config, including secondary ip addresses +Transmit Delay is 1 sec, State BDR, Priority 1 +Designated Router (ID) 10.1.23.2, Interface address 10.1.12.2 +Backup Designated router (ID) 10.1.12.1, Interface address 10.1.12.1 +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:07 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 1/1, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 1 +Last flood scan time is 4 msec, maximum is 4 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 10.1.23.2 (Designated Router) +Suppress hello for 0 neighbor(s) +Message digest authentication enabled +Youngest key id is 1 + + + + + +From the Library of Outcast Outcast +606 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Troubleshooting OSPFv2 Routes + +As discussed already, neighbor relationships are the foundation for OSPF information sharing. If we have no neighbors, we will not learn any routes. So, besides the lack of a neighbor, what would be reasons for missing routes in an OSPF network? + +Following is a listing of some common reasons as to why OSPF routes might be missing either in the LSDB or the routing table: + + +■ Key +Topic + +■ + + +■ + + +■ + + +■ + + +■ + + +■ + +Interface not running the OSPF process: If the interface is not participating in the OSPF process, the network the interface is part of will not be injected into the OSPF process and therefore will not be advertised to neighbors. +Better source of information: If the exact same network is learned from a more reli-able source, it is used instead of the OSPF-learned information. + +Route filtering: A filter might be set up that is preventing a route from being installed in the routing table. + +Stub area configuration: If the wrong type of stub area is chosen, you might be receiving a default route instead of the actual route. + +Interface is shut down: The OSPF-enabled interface must be up/up for the network associated with the interface to be advertised. + +Wrong designated router was elected: In a hub-and-spoke environment, if the wrong router is the DR, routes will not be exchanged properly. + +Duplicate RIDs: If there are two or more routers with the same RID, routes will be missing in the topology. + + +Let’s take a look at each of these individually and identify how we can recognize them during the troubleshooting process. + +Interface Not Running the OSPF Process + +As discussed earlier, when you use the network area command or the ip ospf area inter-face command, the OSPF process is enabled on interfaces. OSPF then takes the network/ subnet the interface is part of and injects it into the link-state database (LSDB) so that it can be advertised to other routers in the autonomous system. Therefore, even interfaces that will not form neighbor relationships with other routers need to be participating in the OSPF process for the interfaces network ID to be advertised. + +As discussed in an earlier section, the output of show ip protocols displays the network area statements in addition to the interfaces that were explicitly configured with the ip ospf area interface command. Focus on the highlighted text in Example 15-23. Notice that it states Routing for Networks. Those are not the networks we are routing for. We are routing for the networks associated with the interface OSPF will be enabled on, based on the network statement. So, 10.1.1.1 0.0.0.0 area 1 means to enable OSPF on the inter-face with the IP address 10.1.1.1 and place it in area 1. We will then route for the network associated with that interface. Also, you can see that Gig1/0 was explicitly configured to + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 607 + +participate in the OSPF process; therefore, OSPF will route for the network associated with that interface as well. + +Example 15-23 Verifying OSPF-Enabled Interfaces with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 10.1.12.1 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +Passive Interface(s): +Ethernet0/0 +GigabitEthernet0/0 +Routing Information Sources: + +Gateway +10.1.23.2 +10.1.23.3 + +Distance +110 +110 + +Last Update +01:00:43 +01:00:43 + +Distance: (default is 110) + +So, what networks are we actually routing for then? The networks associated with the interfaces that are now enabled for OSPF. In Example 15-24, you can see the output of the show ip interface command on R1 for Gig0/0 and Gig1/0, which was piped to only include the Internet address. Notice that they are in a /24 network. As a result, the net-work IDs would be 10.1.1.0/24 and 10.1.12.0/24. Those are the networks we are routing for. + +Example 15-24 Verifying Network IDs with show ip interface + +R1#show ip interface gi0/0 | i Internet +Internet address is 10.1.1.1/24 +R1#show ip interface gi1/0 | i Internet +Internet address is 10.1.12.1/24 + + +Better Source of Information + +For an OSPF-learned route to be installed in the routing table, it has to be the most believable routing source. Recall that this is based on administrative distance (AD). OSPF’s AD is 110 for all learned routes: intra, inter, and external. Therefore, if there is another source that is educating the same router about the exact same network and that + + + +From the Library of Outcast Outcast +608 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +source has a better AD, the source with the better AD wins, and its information will be installed in the routing table. Example 15-25 is displaying only the OSPF-installed routes in the router. Notice that there is no OSPF entry for the network 10.1.1.0/24 and 10.1.12.0/24. + +Example 15-25 Sample show ip route ospf Command Output + +R1#show ip route ospf +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 10.1.12.2 to network 0.0.0.0 + +O*E2 0.0.0.0/0 [110/1] via 10.1.12.2, 01:15:29, GigabitEthernet1/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks +O IA 10.1.3.0/24 [110/3] via 10.1.12.2, 01:15:29, GigabitEthernet1/0 +O IA 10.1.23.0/24 [110/2] via 10.1.12.2, 01:15:29, GigabitEthernet1/0 +O IA 203.0.113.0/24 [110/3] via 10.1.12.2, 01:15:29, GigabitEthernet1/0 + +In this case, there is a better source for the 10.1.1.0/24 and 10.1.12.0/24 networks. Example 15-26 displays the output of the show ip route 10.1.1.0 255.255.255.0 com-mand. It identifies that this network is directly connected and has an AD of 0. Because a directly connected network has an AD of 0 and an OSPF route has an AD of 110, the directly connected source is installed in the routing table. + +Example 15-26 Sample show ip route 10.1.1.0 255.255.255.0 Command Output + +R1#show ip route 10.1.1.0 255.255.255.0 +Routing entry for 10.1.1.0/24 +Known via "connected", distance 0, metric 0 (connected, via interface) +Routing Descriptor Blocks: +* directly connected, via GigabitEthernet0/0 +Route metric is 0, traffic share count is 1 + +But wait, you might be questioning whether 10.1.1.0/24 is in the LSDB, because it is directly connected. Remember, when an interface is participating in the routing process, its network will be injected into the LSDB as a Type 1 (Router) LSA. You can verify this with the show ip ospf database command, as shown in Example 15-27. However, there is no listing for 10.1.1.0/24. This is because we are only looking at a summary of the LSAs in the LSDB. If you want to see the specifics of the LSA, you have to open them up. Example 15-28 displays the output of show ip ospf database router 10.1.12.1. This command opens the Type 1 Router LSA advertised by the router with the RID 10.1.12.1, + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 609 + +which is R1. It displays that 10.1.1.0/24 is in the LSDB and therefore can be advertised in the OSPF process. + +Example 15-27 Output of show ip ospf database on R1 + +R1#show ip ospf database + +OSPF Router with ID (10.1.12.1) (Process ID 1) + +Router Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum Link count + +10.1.12.1 +10.1.23.2 + +10.1.12.1 1025 +10.1.23.2 1210 + +0x80000009 0x006B41 2 +0x8000002D 0x00E7A3 1 + + +Net Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.12.2 10.1.23.2 1210 0x80000007 0x00B307 + +Summary Net Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum + +10.1.3.0 +10.1.23.0 +203.0.113.0 + +10.1.23.2 1210 +10.1.23.2 1210 +10.1.23.2 1210 + +0x80000004 0x00D72E +0x8000001A 0x00C418 +0x80000004 0x004E88 + + +Summary ASB Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.23.3 10.1.23.2 1210 0x80000003 0x00C629 + +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag +0.0.0.0 10.1.23.3 1268 0x80000003 0x00B399 1 + + +Example 15-28 Output of show ip ospf database router 10.1.12.1 on R1 + +R1#show ip ospf database router 10.1.12.1 + +OSPF Router with ID (10.1.12.1) (Process ID 1) + +Router Link States (Area 1) + +LS age: 1368 +Options: (No TOS-capability, DC) + + + +From the Library of Outcast Outcast +610 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +LS Type: Router Links +Link State ID: 10.1.12.1 +Advertising Router: 10.1.12.1 +LS Seq Number: 80000009 +Checksum: 0x6B41 +Length: 48 +Number of Links: 2 + +Link connected to: a Transit Network +(Link ID) Designated Router address: 10.1.12.2 +(Link Data) Router Interface address: 10.1.12.1 +Number of MTID metrics: 0 +TOS 0 Metrics: 1 + +Link connected to: a Stub Network +(Link ID) Network/subnet number: 10.1.1.0 +(Link Data) Network Mask: 255.255.255.0 +Number of MTID metrics: 0 +TOS 0 Metrics: 1 + +Having a better source of routing information may not cause users to complain or submit a trouble ticket, because they will probably still be able to access the resources they need to. However, it might be causing suboptimal routing in your network. Review Figure 15-1, which shows a network running two different routing protocols. In this case, which path will be used to send traffic from PC1 to 10.1.1.0/24? If you said the longer EIGRP path, you are correct. Even though it is quicker to use the OSPF path, EIGRP wins by default because it has the lower AD and suboptimal routing occurs. + + +EIGRP + +1Gig 1Gig + +1Gig 1Gig + +10.1.1.0/24 OSPF PC1 +10 Gig + + +Figure 15-1 Using an EIGRP Path, Which Is Suboptimal + +Being able to recognize when a certain routing source should be used and when it should not be used is key to optimizing your network and reducing the number of troubleshoot-ing instances related to “the network is slow.” In this case, we might want to consider increasing the AD of EIGRP or lowering the AD of OSPF to optimize routing. + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 611 + +Route Filtering + +A distribute list applied to an Open Shortest Path First (OSPF) process controls which routes are installed into the routing table from the LSDB. Realize that this differs from EIGRP, where it controls routes sent and received between neighbors. The reason this dif-ference exists is that all OSPF routers in an area must have the same LSDB. If you were able to control the routes sent to and received from neighbors, the LSDB would not be the same amongst the routers in the area, which is not permitted. + +To apply a route filter to OSPF, the distribute list is applied in OSPF configuration mode inbound (meaning into the routing table), and the routes installed are controlled by ACLs, prefix lists, or route maps. Therefore, when troubleshooting route filtering for OSPF, you need to consider the following: + +Key ■ Is the distribute list applied in the correct direction? Topic ■ If the distribute list is using an ACL, is the ACL correct? + +■ If the distribute list is using a prefix list, is the prefix list correct? + +■ If the distribute list is using a route map, is the route map correct? + +The show ip protocols command will identify whether a distribute list is applied to the OSPF process, as shown in Example 15-29. This example indicates that there are no out-bound filters and that there is an inbound filter that is referencing the prefix list called TEST. + +Example 15-29 Verifying Route Filters with show ip protocols + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is (prefix-list) TEST +Router ID 10.1.12.1 +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +Passive Interface(s): +Ethernet0/0 +GigabitEthernet0/0 +Routing Information Sources: + +Gateway +10.1.23.2 +10.1.23.3 + +Distance +110 +110 + +Last Update +00:00:20 +00:00:20 + +Distance: (default is 110) + + + +From the Library of Outcast Outcast +612 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +The inbound filter in Example 15-29 is filtered by prefix list TEST. To verify the entries in this prefix list, you issue the show ip prefix-list TEST command, as shown in Example 15-30. If an ACL were applied, you would issue the show access-list command. If a route map were applied, you would issue the show route-map command. + +As displayed in Example 15-30, you can verify the command that was used to apply the distribute list in the running configuration. + +Example 15-30 Verifying the OSPF Distribute List and Prefix List + +R1#show ip prefix-list TEST +ip prefix-list TEST: 2 entries +seq 5 deny 10.1.23.0/24 +seq 10 permit 0.0.0.0/0 le 32 + +R1#show run | section router ospf 1 +router ospf 1 +area 1 authentication message-digest +passive-interface default +no passive-interface GigabitEthernet1/0 +network 10.1.1.1 0.0.0.0 area 1 +distribute-list prefix TEST in + +Notice in Example 15-31 that the LSDB still has the 10.1.23.0/24 network listed but that it is not installed in the routing table because of the distribute list that is denying 10.1.23.0/24 from being installed. + +Example 15-31 Verifying OSPF Routes and LSDB After a Distribute List Is Applied + +R1#show ip ospf database + +OSPF Router with ID (10.1.12.1) (Process ID 1) + +Router Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum Link count + +10.1.12.1 +10.1.23.2 + +10.1.12.1 16 +10.1.23.2 13 + +0x80000011 0x005B49 2 +0x80000033 0x00DBA9 1 + + +Net Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.12.2 10.1.23.2 12 0x8000000D 0x00A70D + +Summary Net Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.3.0 10.1.23.2 16 0x80000002 0x00DB2C + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 613 + + +10.1.23.0 +203.0.113.0 + +10.1.23.2 16 +10.1.23.2 16 + +0x80000002 0x00F4FF +0x80000002 0x005286 + + +Summary ASB Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.23.3 10.1.23.2 18 0x80000001 0x00CA27 + +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag +0.0.0.0 10.1.23.3 779 0x80000005 0x00AF9B 1 + +R1#show ip route +...output omitted... + +Gateway of last resort is 10.1.12.2 to network 0.0.0.0 + +O*E2 0.0.0.0/0 [110/1] via 10.1.12.2, 00:00:02, GigabitEthernet1/0 +10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +O IA 10.1.3.0/24 [110/3] via 10.1.12.2, 00:00:02, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +O IA 203.0.113.0/24 [110/3] via 10.1.12.2, 00:00:02, GigabitEthernet1/0 + + + + + +Key Topic + +Stub Area Configuration + +Because all routers in an area need to have the same LSDB, you cannot manipulate the LSAs within an area; however, you can manipulate LSAs that are flowing between areas by using the stub and NSSA OSPF features. + +When you create stub or NSSA areas, you suppress Type 5 LSAs from entering into an area at the ABR. With totally stubby and totally NSSA areas, you suppress Type 5 and Type 3 LSAs from entering into an area at the ABR. The routes that would have been learned via the Type 5 and Type 3 LSAs in the area are now replaced by a default route. Because there is a default route, the router has lost visibility of the overall network, and this could produce suboptimal routing if not implemented correctly in highly redundant environments. + +As a result, if you are expecting a Type 5 or Type 3 LSA for a specific route but it is not showing up in the area, verify whether the area is a stub or NSSA area and determine the types of routes that are being suppressed. You can verify whether the area connected +to the router is a stub or NSSA area by using the show ip ospf command, as shown in +Example 15-32. + + + + + +From the Library of Outcast Outcast +614 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-32 Determining the Type of OSPF Areas + +R1#show ip ospf +Routing Process "ospf 1" with ID 10.1.12.1 +Start time: 02:23:19.824, Time elapsed: 02:08:52.184 +...output omitted... +Reference bandwidth unit is 100 mbps +Area 1 +Number of interfaces in this area is 2 +It is a stub area +Area has no authentication +SPF algorithm last executed 00:05:46.800 ago +...output omitted... + +However, remember that when implementing totally stub or totally NSSA areas you are only configuring the no-summary keyword on the ABR. Therefore, it is best to review the output of show ip ospf on the ABR, as shown in Example 15-33. In this example, R2 is configured to suppress Type 3 and Type 5 LSAs from entering into area 1. It will replace them with a default route with a cost of 1. + +Example 15-33 Determining the Type of OSPF Area on the ABR + +R2#show ip ospf +Routing Process "ospf 1" with ID 10.1.23.2 +Start time: 02:39:09.376, Time elapsed: 15:19:40.352 +...output omitted... +Flood list length 0 +Area 1 +Number of interfaces in this area is 1 +It is a stub area, no summary LSA in this area +Generates stub default route with cost 1 +Area has no authentication +...output omitted... + + +Interface Is Shut Down + +As discussed earlier, once the OSPF process is enabled on the interface, the network the interface is part of (the directly connected entry in the routing table) is injected into the OSPF process. If the interface is shut down, there is no directly connected entry for the network in the routing table. Therefore, the network does not exist, and no network can be injected into the OSPF process. The interface has to be up/up for routes to be adver-tised or for neighbor relationships to be formed. + + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 615 +AdjacencyAdjacency +Adjacency + +Wrong Designated Router Was Elected + +A multiaccess network can have multiple routers residing on a common network seg-ment. Rather than having all routers form a full mesh of adjacencies with one another, a designated router (DR) will be elected, and all other routers on the segment form a full adjacency with the DR, as illustrated in Figure 15-2. The rest of the routers will form a 2Way adjacency with each other, and if a BDR exists, they will form a full adjacency with the BDR as well. + +A DR is elected based on router priority, with larger priority values being more prefer-able. If routers have equal priorities, the DR is elected based on the highest OSPF RID. A BDR is also elected based on the same criteria. Routers on the multiaccess network form full adjacencies with the BDR in case the DR becomes unavailable. + +Designated Router (DR) + + +R1 + + + + + + + + +R3 + +Figure 15-2 + +Adjacency +R2 + + + + + + + + +R4 + +DR Election in an Ethernet Network + + + + + + + + + + +Key Topic + +It does not matter which router is elected as the DR in a multiaccess Ethernet topology or a full-mesh Frame Relay topology, because every router is able to reach the DR since the Layer 2 topology lines up with the Layer 3 addressing. However, over a hub-and-spoke nonbroadcast multiaccess (NBMA) network such as Frame Relay or with a Dynamic Multipoint VPN (DMVPN), it does matter who the DR is because the underlying Layer 2 topology does not line up with the Layer 3 addressing. + +Refer to Figure 15-3 which displays a hub-and-spoke Frame Relay or DMVPN network. The multipoint interface (single physical interface or mGRE [multipoint generic routing encapsulation] tunnel interface) provides connectivity to multiple routers in the same sub-net out the single interface, like Ethernet. However, in this case, the Layer 2 topology is not the same as the Layer 3 topology. The Layer 3 topology is indicating that all routers are directly reachable out the interfaces (same subnet). But the Layer 2 topology says oth- +erwise. You cannot directly reach R2 from R3 and vice versa. You have to go through R1. + + + + + + + + + + +From the Library of Outcast Outcast +616 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +R4 + + + + + +R1 Se1/0 192.168.1.0/24 mGRE + + +Hub and Spoke Frame Relay or DMVPN + +172.16.33.0/29 + +R2 + +PVC or GRE + + +R3 + + +10.1.2.0/24 + + +10.1.3.0/24 + + + +Figure 15-3 Hub and Spoke + +Figure 15-4 shows the wrong DR placement. The DR router needs to be reachable via a single hop because of how OSPF neighbor relationships are formed and how routers communicate with the DR. Hellos are established with the multicast address 224.0.0.5, +and the DR is reachable at the multicast address 224.0.0.6. Packets destined to these two multicast addresses will not be relayed by other routers. Because the DR is responsible for relaying learned routes in a multiaccess network, it needs to be centrally located. Therefore, if R2 were the DR, R3 would not be able to form an adjacency with it because R1 will not relay the hello packet. Therefore, R3 cannot communicate with the DR, mean-ing that it cannot tell the DR about the 10.1.3.0 network, and as a result, no other router will learn about the 10.1.3.0/24 network. + + +I can’t reach 10.1.3.0 R4 DR + + + + + +R1 Se1/0 192.168.1.0/24 mGRE + + +Hub and Spoke Frame Relay or DMVPN + +R2 + +PVC or GRE + + +10.1.2.0/24 + + +10.1.3.0/24 + +I can’t reach 10.1.3.0 172.16.33.0/29 +R3 +I have no route for 10.1.2.0/24 + +Figure 15-4 Wrong DR Placement + +In this case, you need to control who the DR is. It has to be R1 to ensure that all routers are able to send LSAs to it and receive LSAs from it, as shown in Figure 15-5. + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 617 + + + + +R4 DR floods LSAs out to R2 + +I can reach 10.1.3.0 +RID:2.2.2.2 + + + +DR + +R1 Se1/0 mGRE +192.168.1.0/24 RID:1.1.1.1 + + +Hub and Spoke Frame Relay or DMVPN + +R2 + +PVC or GRE + + +10.1.2.0/24 + + +10.1.3.0/24 + + + +I can reach 10.1.3.0 172.16.33.0/29 + + +Neighborship with DR LSAs sent to DR + + +R3 +RID:3.3.3.3 + + +Figure 15-5 Correct DR Placement + +To verify the DR placement, issue the command show ip ospf interface interface_type interface_number on each of the routers. Example 15-34 indicates that R1 considers the router with the RID 3.3.3.3 as the DR at interface 172.16.33.6. R2 considers itself as the DR and R1 as the BDR. R3 considers itself a DR and R1 as a BDR. Therefore, we have two DRs in this hub-and-spoke environment. As a result, routes will not be successfully learned by all routers in the topology. + +Example 15-34 Verifying the DR + +R1#show ip ospf interface ser 1/0 +Serial1/0 is up, line protocol is up +Internet Address 172.16.33.4/29, Area 0, Attached via Network Statement +Process ID 1, Router ID 1.1.1.1, Network Type NON_BROADCAST, Cost: 64 + +Topology-MTID Cost +0 64 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State BDR , Priority 1 +Designated Router (ID) 3.3.3.3, Interface address 172.16.33.6 +Backup Designated router (ID) 1.1.1.1, Interface address 172.16.33.4 +Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 +...output omitted... + +R2#show ip ospf interface ser 1/0 +Serial1/0 is up, line protocol is up +Internet Address 172.16.33.5/29, Area 0, Attached via Network Statement +Process ID 1, Router ID 2.2.2.2, Network Type NON_BROADCAST, Cost: 64 + +Topology-MTID Cost +0 64 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR , Priority 1 +Designated Router (ID) 2.2.2.2, Interface address 172.16.33.5 +Backup Designated router (ID) 1.1.1.1, Interface address 172.16.33.4 +Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 +...output omitted... + + + +From the Library of Outcast Outcast +618 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +R3#show ip ospf interface ser 1/0 +Serial1/0 is up, line protocol is up +Internet Address 172.16.33.6/29, Area 0, Attached via Network Statement +Process ID 1, Router ID 3.3.3.3, Network Type NON_BROADCAST, Cost: 64 + +Topology-MTID Cost +0 64 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR , Priority 1 +Designated Router (ID) 3.3.3.3, Interface address 172.16.33.6 +Backup Designated router (ID) 1.1.1.1, Interface address 172.16.33.4 +Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 +...output omitted... + +To fix this issue, you need to force R1 to be the DR by preventing R2 and R3 from ever wanting to be a DR. On R2 and R3, you go to interface configuration mode and set the OSPF priority to 0, as shown in Example 15-35. + +Example 15-35 Changing OSPF Priority on Spokes + +R2#config t +R2(config)#int ser 1/0 +R2(config-if)#ip ospf priority 0 + +R3#config t +R3(config)#int ser 1/0 +R3(config-if)#ip ospf priority 0 + +Now the output of show ip ospf interface ser 1/0 on R1, as shown in Example 15-36, indicates that it is the DR and that there are no BDRs, because we never want a spoke to back up the DR because it would cause the same problem we discussed earlier. + +Example 15-36 Verifying the Hub Router Is the DR + +R1#show ip ospf interface ser 1/0 +Serial1/0 is up, line protocol is up +Internet Address 172.16.33.4/29, Area 0, Attached via Network Statement +Process ID 1, Router ID 1.1.1.1, Network Type NON_BROADCAST, Cost: 64 + +Topology-MTID Cost +0 64 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 1.1.1.1, Interface address 172.16.33.4 +No backup designated router on this network +Old designated Router (ID) 3.3.3.3, Interface address 172.16.33.6 +...output omitted... + + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 619 + +Duplicate Router IDs + +The RID uniquely identifies the routers in the OSPF domain. Because the RID is used during the formation of neighbor relationships and to determine which router is advertis-ing a specific LSA, it is imperative that the RIDs are unique in the domain. If there are duplicate RIDs, the network issues can vary. For example, in the same area, the routers are going to see a Type 1 Router LSA about networks they do not know about from a RID the same as theirs. Therefore, they think they generated the LSA. A router will not use information contained in an LSA they receive that was generated by them because it means there is a loop. However, the LSA is not from itself, it just has the same RID, and as a result we have missing routes on various routers in the domain. + +In Figure 15-6, the Type 1 Router LSA from R1 is ignored by R3 because the LSA has the same RID as R3 and so R3 thinks it is its own LSA. Therefore, R3 does not learn about 10.1.1.0/24. The same is true for R1; it does not learn about 10.1.3.0/24 because it is ignor-ing the LSA that R3 sent because it has the same RID. + + +OSPF AREA 0 + +10.1.1.0/24 +Gi1/0 + +Type 1 LSA ignored by R1 because of same RID + +10.1.3.0/24 + + + +R1 +RID 1.1.1.1 + +10.1.12.0/24 R2 +RID 2.2.2.2 + +10.1.23.0/24 R3 +RID 1.1.1.1 + + +Type 1 LSA ignored by R3 because of same RID + +Figure 15-6 Duplicate RIDs in the Same Area + +What about duplicate RIDs in different areas? This would cause the physical OSPF topol-ogy to be different from what the SPF algorithm sees it as. Refer to Figure 15-7, which displays an OSPF domain with duplicate RIDs in different areas. R1 and R4 both have +a RID of 1.1.1.1. As you can see, R2 is going to see the router with the RID in both area 0 and area 1 (which to R2 is technically the same router, but in this case, physically it +is not). This can cause routing issues because some routes may not be passed between areas, causing the LSDB and the routing tables to be incomplete. + +RID 1.1.1.1 OSPF Area 0 + + + +OSPF Area 1 10.1.1.0/24 + +R4 + +10.1.3.0/24 + + + +R1 10.1.12.0/24 +RID 1.1.1.1 + +R2 10.1.23.0/24 +RID 2.2.2.2 + +R3 +RID 3.3.3.3 + + +Figure 15-7 Duplicate RIDs in Different Areas + + + + +From the Library of Outcast Outcast +620 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +R1 +SW +R2 +R3 + +If you have exhausted all possible reasons as to why routes are not appearing in the LSDB or the routing table, take a look at the RIDs of the routers using the show ip protocols command, as shown in Example 15-37. + +Example 15-37 Verifying OSPF RID + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 1.1.1.1 +Number of areas in this router is 1. 0 normal 1 stub 0 nssa +Maximum path: 4 +...output omitted... + + +Troubleshooting Miscellaneous OSPFv2 Issues + +So far, your focus has been on troubleshooting issues related to OSPFv2 neighbor rela-tionships and routes. Now your focus will be on tracking LSAs through the network, route summarization, discontiguous areas, load balancing, and default routes. + +Tracking OSPF Advertisements Through a Network + +When troubleshooting an OSPF issue, tracking the path of OSPF advertisements can be valuable in determining why certain entries are in a router’s LSDB. + +As an example, notice network 192.168.1.0/24 in the topology provided in Figure 15-8, and consider how this network is entered into the LSDB of the other OSPF routers. + +Area 1 Link-State Database Area 0 Link-State Database + + +SPF +Type 1 LSA RIB +192.168.1.0/24 + +Type 3 +LSA SSW2 +W2 +SPF +RIB + + + +R1 SW11 R2 R3 OSPF +Area 0 OSPF +Area 1 +R4 +OSPF Area 2 + + + + +SPF +RIB +Type 3 LSA +Area 2 Link-State Database + + + +SSW3 R5 SPF +RIB +W3 + + +Figure 15-8 Tracking an OSPF Advertisement + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 621 + +The following steps describe how network 192.168.1.0/24, which is directly connected to router R1, is learned by the LSDB of routers R2, R3, R4, and R5: +Step 1. Router R1 creates a Type 1 Router LSA for the 192.168.1.0/24 network in the area 1 link-state database and floods it into area 1. + +Step 2. Router R2 receives the Router LSA for 192.168.1.0/24 and places it in the area 1 link-state database. R2 runs the shortest path first (SPF) algorithm to deter-mine the best path through area 1 to reach the 192.168.1.0/24 network. The best result is placed in R2’s routing table (RIB). +Step 3. Router R2 informs area 0 routers about the network 192.168.1.0/24 by inject-ing a Type 3 LSA about the network into the link-state database of area 0 and flooding it into area 0. This LSA includes the cost to reach the 192.168.1.0/24 network, from the perspective of router R2. +Step 4. Each of the other area 0 routers (that is, routers R3 and R4) receive the Type 3 LSA and add it to their area 0 LSDB. They run the SPF algorithm to deter-mine the cost to reach router R2. This cost is then added to the cost router R2 advertised in its Type 3 LSA, and the result is stored in the RIB for routers R3 and R4. +Step 5. Router R4 informs area 2 routers about the network 192.168.1.0/24 by inject-ing a Type 3 LSA about the network into the link-state database of area 2 and flooding it into area 2. This LSA includes the cost to reach the 192.168.1.0/24 network, from the perspective of router R4. +Step 6. Each of the routers in area 2 receive the Type 3 LSA and add it to their area 2 LSDB. They run the SPF algorithm to determine the cost to reach router R4. This cost is then added to the cost router R4 advertised in its Type 3 LSA, and the result is stored in the RIB of the routers. + +To successfully troubleshoot OSPF-related issues, you should have a solid understanding of this process and the different types of OSPF LSAs. Table 15-4 lists the common LSA types you will encounter when troubleshooting a Cisco-based OSPF network. + +Table 15-4 OSPF LSAs +Key +Topic LSA Type Description + +1 All OSPF routers source Type 1 LSAs. These advertisements list information about directly connected subnets, the OSPF connection types of a router, and the known OSPF adjacencies of a router. A Type 1 LSA is not sent out of its local area. +2 The designated router on a multiaccess network sends a Type 2 LSA for that network if the network contains at least two routers. A Type 2 LSA contains a listing of routers connected to the multiaccess network and, like a Type 1 LSA, is constrained to its local area. + + + + + + +From the Library of Outcast Outcast +622 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +LSA Type 3 + + + + +4 + + +5 + + + +7 + +Description +A Type 3 LSA is sourced by an ABR. Each Type 3 LSA sent into an area contains information about a network reachable in a different area. Note that network information is exchanged only between the backbone area and a nonbackbone area, as opposed to being exchanged between two nonbackbone areas. +Similar to a Type 3 LSA, a Type 4 LSA is sourced by an ABR. However, instead of containing information about OSPF networks, a Type 4 LSA contains information stating how to reach an ASBR. +A Type 5 LSA is sourced by an ASBR and contains information about networks reachable outside the OSPF domain. A Type 5 LSA is sent to all OSPF areas, except for stub areas. Note that the ABR for a stub area sends default route information into the stub area, rather than the network-specific Type 5 LSAs. +A Type 7 LSA is sourced from an ASBR within a not-so-stubby area (NSSA). Whereas a stub area cannot connect to an external autonomous system, an NSSA can. The Type 7 LSA only exists in the NSSA; therefore, the external routes are announced by the ABR(s) of the NSSA into Area 0 using Type 5 LSAs. In addition, like a stub area, external routes known to another OSPF area are not forwarded into an NSSA since Type 5 LSAs are not permitted in an NSSA. + + + + +Route Summarization + +OSPF is strict about where route summarization can occur. With OSPF, manual route summarization is enabled on an area by area basis on an ABR to summarize routes as they enter or leave an area or on an ASBR to summarize external routes being injected into an area. Therefore, when troubleshooting route summarization you want to keep the follow-ing in mind: + +■ Did you enable route summarization on the correct router? +Key +Topic ■ Did you enable route summarization for the correct area? + +■ Did you create the appropriate summary route? + +You can verify all of these using the show ip ospf command, as shown in Example 15-38. In this example, R2 is an area border router, and there is a summary address of 10.1.0.0/16 for area 1 that is currently active and being advertised into area 0. + +Example 15-38 Verifying Interarea Route Summarization with show ip ospf + +R2#show ip ospf +Routing Process "ospf 1" with ID 2.2.2.2 +...output omitted... +Event-log enabled, Maximum number of events: 1000, Mode: cyclic +It is an area border router + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 623 + +Router is not originating router-LSAs with maximum metric +...output omitted... +Reference bandwidth unit is 100 mbps +Area BACKBONE(0) +Number of interfaces in this area is 1 +Area has no authentication +SPF algorithm last executed 00:03:27.000 ago +SPF algorithm executed 14 times +Area ranges are +Number of LSA 6. Checksum Sum 0x033162 +Number of opaque link LSA 0. Checksum Sum 0x000000 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 +Area 1 +Number of interfaces in this area is 1 +Area has no authentication +SPF algorithm last executed 00:03:27.024 ago +SPF algorithm executed 13 times +Area ranges are +10.1.0.0/16 Active(1) Advertise +Number of LSA 9. Checksum Sum 0x0555F1 +...output omitted... + +Remember that interarea summaries are created on ABRs with the area range command and that external summaries are created on ASBRs with the summary-address command. + +When a summary route is created on a router, so is a summary route to Null0, as shown in Example 15-39. This route to Null0 is created to prevent routing loops. It is imperative that this route is in the table to ensure that if a packet is received by this router destined to a network that falls within the summary that the router does not really know how to reach (longer match), it will be dropped. If the route to Null0 did not exist, and there were a default route on the router, the router would forward the packet via the default route, and then the next-hop router would end up forwarding it back to this router, because it is using the summary route, then the local router would then forward it based on the default route, and then it would come back. This is a routing loop. + +It is important that you create accurate summary routes to ensure that your router is not advertising networks in the summary route that it does not truly know how to reach. If it does, it is possible that it might receive packets to destinations that fall within the sum-mary that it really does not know how to reach. If this is the case, it means that packets will be dropped because of the route to Null0. + + + + + + + +From the Library of Outcast Outcast +624 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-39 Verifying Local Summary Route to Null0 + +R2#show ip route | include Null +O 10.1.0.0/16 is a summary, 00:16:07, Null0 + +Unlike EIGRP, which gives the route to Null0 an AD of 5, the route to Null0 gets an AD of 110 with OSPF, as shown in Example 15-40. This does not ensure that it is more +believable than most of the other sources of routing information. Therefore, it is possible that another better routing source could end up forwarding the traffic for networks that are included in the summary route to Null0. + +Example 15-40 Verifying the AD of a Local Summary Route to Null 0 + +R2#show ip route 10.1.0.0 255.255.0.0 +Routing entry for 10.1.0.0/16 +Known via "ospf 1", distance 110, metric 1, type intra area +Routing Descriptor Blocks: +* directly connected, via Null0 +Route metric is 1, traffic share count is 1 + + +Discontiguous Areas + +In a multiarea OSPF network, a backbone area (numbered area 0) must exist, and all other areas must connect to area 0. If an area is not physically adjacent to area 0, routes will not be successfully learned by all routers in the OSPF domain. To solve this issue, a virtual link can be configured to logically connect the nonadjacent area with area 0. +Figure 15-9 shows area 51 not physically connected to area 0. This results in the 10.1.4.0 network not being learned by any other router in the OSPF domain, because an ABR +is needed to send Type 3 LSAs into area 0. R4 is not an ABR in this case because the requirement for an ABR is that one interface must be in area 0 and one or more interfaces in any other area(s). In this case, R4 has no interfaces in area 0. + +OSPF Area 0 + +OSPF Area 1 +10.1.1.0/24 10.1.3.0/24 + + +R1 10.1.12.0/24 R2 +RID 2.2.2.2 + +10.1.23.0/24 R3 +RID 3.3.3.3 + + +R4 +OSPF Area 51 + +10.1.4.0/24 + +Figure 15-9 Area 51 Not Directly Connected to Area 0 + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 625 + +Now refer to Figure 15-10, which is showing a similar topology; however, area 0 is discon-tiguous. This will result in LSAs not being successfully flooded though the OSPF domain and, as a result, incomplete routing tables. + +OSPF Area 0 + +OSPF Area 1 +10.1.1.0/24 10.1.3.0/24 + + +R1 10.1.12.0/24 R2 +RID 2.2.2.2 + +10.1.23.0/24 R3 +RID 3.3.3.3 + + +R4 +OSPF Area 0 + +10.1.4.0/24 + +Figure 15-10 Discontiguous Area 0 + +You need to be able to recognize these OSPF design issues, understand how to trouble-shoot them and implement a solution. The solution is virtual links. A virtual link in both these examples is created through area 1, which will be known as the transit area because it will transit LSAs from area 51 to area 0 or from area 0 to area 0. Note that virtual links are a temporary solution for these issues. A permanent redesign/fix should be performed as soon as possible. + +The virtual link is created between the routers connected to the transit area using their RIDs and the transit area number as shown in Figure 15-11. The router OSPF configura-tion mode command on R2 is area 1 virtual-link 4.4.4.4, and the command on R4 is area 1 virtual-link 2.2.2.2. Once the virtual link is established, R4 becomes an ABR since it has an interface (virtual interface in this case) in area 0. Common issues related to failed virtual links include a misconfigured area number or RID. If you type in the area number you are trying to connect to area 0 instead of the transit area number, the virtual link will fail to form. If you use the interface IP address rather than the RID, the virtual link will fail to form. + +Example 15-41 displays the output of show ip ospf neighbor on R2. Notice how there is a new neighbor relationship with 4.4.4.4 but that the local interface is OSPF_VL0, which is referring to the virtual link interface. + +Example 15-41 Verifying a Neighbor Relationship over a Virtual Link + +R2#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface +4.4.4.4 0 FULL/ - - 10.1.14.4 OSPF_VL0 + +3.3.3.3 +1.1.1.1 + +1 FULL/BDR +1 FULL/BDR + +00:00:34 +00:00:35 + +10.1.23.3 +10.1.12.1 + +GigabitEthernet1/0 +GigabitEthernet0/0 + + + + + +From the Library of Outcast Outcast +626 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +OSPF Area 1 +10.1.1.0/24 + +OSPF Area 0 + + +10.1.3.0/24 + + + +R1 10.1.12.0/24 R2 +RID 2.2.2.2 + +10.1.23.0/24 R3 +RID 3.3.3.3 + + + + +RID 4.4.4.4 +R4 + +Virtual Link + + +OSPF Area 51 + + +10.1.4.0/24 + +Figure 15-11 LSA Flooding with Virtual Links + +Example 15-42 displays the output of show ip ospf virtual-links, which provides more details about the virtual link. It is not only important to verify that the virtual link is up but that the state is full, which verifies that LSAs have been successfully exchanged. + +Example 15-42 Verifying the Virtual Link +Key +Topic R2#show ip ospf virtual-links +Virtual Link OSPF_VL0 to router 4.4.4.4 is up +Run as demand circuit +DoNotAge LSA allowed. +Transit area 1, via interface GigabitEthernet0/0 + +Topology-MTID Cost +0 2 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State POINT_TO_POINT, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:09 +Adjacency State FULL (Hello suppressed) +Index 2/3, retransmission queue length 0, number of retransmission 0 +First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) +Last retransmission scan length is 0, maximum is 0 +Last retransmission scan time is 0 msec, maximum is 0 msec + + +Load Balancing + +OSPF only supports equal-cost load balancing. Therefore, when troubleshooting load balancing for OSPF, your two primary points of concern are the overall end-to-end cost and the maximum number of paths permitted for load balancing. To verify the maximum + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 627 + +number of equal-cost paths an OSPF router is currently configured to support, use the show ip protocols command, as shown in Example 15-43. In this example, R1 is currently using the default value of 4. + +If your topology is showing multiple paths to reach certain networks in your organization but they are not all showing up in the routing table, it is more than likely because 1) they are not equal-cost paths or 2) the maximum paths value is configured too low. + +Example 15-43 Verifying the Maximum Number of Paths for Load Balancing + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is (prefix-list) TEST +Router ID 1.1.1.1 +Number of areas in this router is 2. 2 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +...output omitted... + + +Default Route + +With OSPF, a static default route is injected into the routing process using the default-information originate command, not the redistribute static command. Therefore, if you are troubleshooting why a static default route is not being advertised in the OSPF pro-cess, use the show run | section router ospf command to verify that the default-informa-tion originate command is being used. + +OSPFv2 Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 15-12. + + + + + + + + + + + +From the Library of Outcast Outcast +628 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + +RID 4.4.4.4 + + +R4 + +192.168.1.0/24 + +Gi0/0 + +Gi1/0 + + + + +10.1.1.0/24 +Gi0/0 + + +OSPF Area 1 + +Gi1/0 Gi0/0 + +RID 3.3.3.3 +Gi3/0 10.1.3.0/24 Gi1/0 Gi1/0 Gi0/0 + + + +R1 +RID 1.1.1.1 + +10.1.12.0/24 R2 +RID 2.2.2.2 + +10.1.23.0/24 R3 +Gi2/0 + +OSPF Area 0 + + +192.0.2.1 + + +Figure 15-12 OSPFv2 Trouble Tickets Topology + + +Trouble Ticket 15-1 + +Problem: Users in the 10.1.1.0/24 network indicate that they are not able to access resources in the 192.168.1.0/24 network. + +As always, the first item on the list for troubleshooting is to verify the problem. You access a PC in the 10.1.1.0/24 network and ping an IP address in the 192.168.1.0/24 net-work and it is successful (0% loss), as shown in Example 15-44. However, notice that the reply is from the default gateway at 10.1.1.1, and it states Destination host unreachable. Therefore, it was technically not successful. + +Example 15-44 Destination Unreachable Result from a ping Command on a PC + +C:\>ping 192.168.1.10 + +Pinging 192.168.1.10 with 32 bytes of data; + +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. +Reply from 10.1.1.1: Destination host unreachable. + +Ping statistics for 192.168.1.10: +Packets: Sent = 4, Received = 4, lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +The result of this ping tells us two very important things: 1) The PC can reach the default gateway; 2) The default gateway does not know how to get to the 192.168.1.0/24 net-work. Therefore, we can focus our attention on R1 and work from there. + +On R1, you issue the same ping, but it fails, as shown in Example 15-45. + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 629 + +Example 15-45 Failed Ping from R1 to 192.168.1.10 + +R1#ping 192.168.1.10 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) + +Next, you check R1’s routing table with the show ip route command and notice that there are only connected routes in the routing table, as shown in Example 15-46. R1 is not learning any routes from R2. + +Example 15-46 show ip route Output on R1 + +R1#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 + +According to Figure 15-12, OSPF is the routing protocol in use. Therefore, you issue the show ip protocols command to verify that OSPF is running on R1. Example 15-47 dis-plays the show ip protocols output and confirms that OSPF process 1 is in operation on R1. + +Example 15-47 show ip protocols Output on R1 + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 1.1.1.1 +Number of areas in this router is 2. 2 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.1.1 0.0.0.0 area 1 +Routing on Interfaces Configured Explicitly (Area 1): +GigabitEthernet1/0 +Passive Interface(s): +Ethernet0/0 +GigabitEthernet0/0 +Routing Information Sources: + + + + +From the Library of Outcast Outcast +630 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Gateway +4.4.4.4 +2.2.2.2 +3.3.3.3 +10.1.23.2 +203.0.113.3 + +Distance +110 +110 +110 +110 +110 + +Last Update +01:20:29 +00:48:38 +01:20:29 +16:56:39 +17:10:26 + +Distance: (default is 110) + +Next you check to see whether R1 has any OSPF neighbors. According to the topology R2 should be a neighbor. To verify OSPF neighbors, you issue the show ip ospf neighbor command on R1, as shown in Example 15-48. According to the output, R1 is a neighbor with R2. + +Example 15-48 show ip ospf neighbor Output on R1 + +R1#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface +2.2.2.2 1 FULL/DR 00:00:36 10.1.12.2 GigabitEthernet1/0 + +Now is the time to be wise. What is the next best step? Some would consider trouble-shooting why the routes are missing on R1 by looking at various features and parameters associated with R1. However, the 192.168.1.0/24 network is in a different area. Who is responsible for telling R1 about 192.168.1.0/24? Is it R4? No. Is it R2? Yes. R2 sends a Type 3 Summary LSA into area 1 which tells area 1 about the 192.168.1.0/24 network. Therefore, if R2 does not know about 192.168.1.0/24 then we can stop troubleshooting on R1. This is a great example of how understanding the flow of different LSAs can save you time while troubleshooting. + +On R2, you issue the show ip route command, as shown in Example 15-49, and confirm that R2 does not know about the 192.168.1.0/24 network either. In fact, it has not learned about any networks in area 0. + +Example 15-49 show ip route Output on R2 + +R2#show ip route +...output omitted... +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O 10.1.0.0/16 is a summary, 15:15:33, Null0 +O 10.1.1.0/24 [110/2] via 10.1.12.1, 01:33:14, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 631 + +Wait! Be careful with the previous statement. Remember, with OSPF, distribute lists are used to permit or deny routes from being installed in the routing table from the LSDB. Therefore, you may be learning about them just not installing them. + +Example 15-50 shows the output of the LSDB on R2, and as you can see, there are no area 0 Type 1 Router LSAs from R3 (3.3.3.3) or R4 (4.4.4.4). Therefore, we can now offi-cially say that R2 has not been educated about the networks that are missing. + +Example 15-50 show ip ospf database Output on R2 Confirming that Routes are Missing + +R2#show ip ospf database + +OSPF Router with ID (2.2.2.2) (Process ID 1) + +Router Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum Link count +2.2.2.2 2.2.2.2 316 0x80000025 0x003B9F 1 + +Summary Net Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum +10.1.0.0 2.2.2.2 1339 0x8000001C 0x00927B + +Router Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum Link count + +1.1.1.1 +2.2.2.2 + +1.1.1.1 +2.2.2.2 + +1988 0x80000022 0x007843 2 +316 0x80000024 0x0012BA 1 + + +Net Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.12.2 2.2.2.2 1589 0x8000001C 0x007C75 + +Summary Net Link States (Area 1) + +Link ID ADV Router Age Seq# Checksum +10.1.23.0 2.2.2.2 61 0x80000020 0x008C66 + +To receive LSAs, we must have interfaces participating in the OSPF process, and we must have neighbor relationships. The output of show cdp neighbors indicates that R3 is a neighbor and that it is reachable out R2’s local Gig1/0 interface, as shown in Example 15-51. + + + + + + +From the Library of Outcast Outcast +632 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-51 Using show cdp neighbors to Verify Router Interfaces + +R2#show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + + +Device ID +R3 +R1 + +Local Intrfce +Gig 1/0 +Gig 0/0 + +Holdtme +178 +179 + +Capability +R +R + +Platform Port ID +7206VXR Gig 1/0 +7206VXR Gig 1/0 + + +Issuing the commands show ip ospf interface brief and show ip ospf neighbor, as shown in Example 15-52, shows that R2’s local Gig1/0 interface is participating in the OSPF pro-cess but does not have a neighbor on the interface. + +Example 15-52 Verifying OSPF-Enabled Interfaces and Neighbors + +R2#show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi1/0 1 0 +Gi0/0 1 1 + +10.1.23.2/24 1 DR 0/0 +10.1.12.2/24 1 DR 1/1 + +R2#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface +1.1.1.1 1 FULL/BDR 00:00:37 10.1.12.1 GigabitEthernet0/0 + +So, you can now hypothesize that the issue is related to R2 and R3 not having a neighbor adjacency. What would cause this? As our earlier discussion in this chapter indicated, many different issues could cause this. However, if you recall, the majority of them +were interface related, and we stated that using the spot-the-difference troubleshooting method would come in handy. Let’s do that by examining the output of show ip ospf interface gigabitethernet 1/0 on R2 and R3, as shown in Example 15-53. + +Example 15-53 Comparing the OSPF Interface Parameters of R2 and R3 + +R2#show ip ospf interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet Address 10.1.23.2/24, Area 0 , Attached via Network Statement +Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 2.2.2.2, Interface address 10.1.23.2 +No backup designated router on this network +Timer intervals configured, Hello 11, Dead 44, Wait 44, Retransmit 5 +oob-resync timeout 44 +Hello due in 00:00:08 +Supports Link-local Signaling (LLS) + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 633 + +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 1/2, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 0, maximum is 3 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) +Message digest authentication enabled +Youngest key id is 1 + +R3#show ip ospf interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet Address 10.1.23.3/24, Area 0 , Attached via Network Statement +Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 1 + +Topology-MTID Cost +0 1 + +Disabled +no + +Shutdown +no + +Topology Name +Base + +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 3.3.3.3, Interface address 10.1.23.3 +No backup designated router on this network +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:04 +Supports Link-local Signaling (LLS) +Cisco NSF helper support enabled +IETF NSF helper support enabled +Index 2/2, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 2 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) +Message digest authentication enabled +Youngest key id is 1 + +■ Are the interfaces up? Yes + +■ Are they in the same subnet? Yes + +■ Are they in the same area? Yes + +■ Do the routers have unique RIDs? Yes + +■ Are they using compatible Network Types? Yes + +■ Do hello and dead timers match? No (possible reason) + +■ Do authentication parameters match? Enabled and key matches, but not sure about key string unless we check the running configuration (possible reason) + + + +From the Library of Outcast Outcast +634 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +As you can see in Example 15-53, the hello and dead timers do not match, but they must. Reviewing the output of show run interface gig 1/0 on R2, as shown in Example 15-54, shows that the command ip ospf hello-interval 11 was configured. + +Example 15-54 Verifying Interface Configuration on R2 + +R2#show run interface gigabitEthernet 1/0 +Building configuration... + +Current configuration : 196 bytes +! +interface GigabitEthernet1/0 +ip address 10.1.23.2 255.255.255.0 +ip ospf authentication message-digest +ip ospf message-digest-key 1 md5 CISCO +ip ospf hello-interval 11 +negotiation auto +end + +Once you remove this command with the no ip ospf hello-interval 11 command, you receive the following syslog message on R2: + +%OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet1/0 from LOADING to FULL, Loading Done +This confirms the adjacency was formed, and reviewing the output of the routing table on R2 using the show ip route command confirms that the routes are learned, as shown in Example 15-55. + +Example 15-55 Verifying Routes in the Routing Table on R2 + +R2#show ip route +...output omitted... +Gateway of last resort is 10.1.23.3 to network 0.0.0.0 + +O*E2 0.0.0.0/0 [110/1] via 10.1.23.3, 00:01:00, GigabitEthernet1/0 +10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks +O 10.1.0.0/16 is a summary, 00:01:49, Null0 +O 10.1.1.0/24 [110/2] via 10.1.12.1, 00:01:00, GigabitEthernet0/0 +O 10.1.3.0/24 [110/2] via 10.1.23.3, 00:01:00, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 +O 10.1.34.0/24 [110/2] via 10.1.23.3, 00:01:00, GigabitEthernet1/0 +O 192.168.1.0/24 [110/3] via 10.1.23.3, 00:01:00, GigabitEthernet1/0 +O 203.0.113.0/24 [110/2] via 10.1.23.3, 00:01:00, GigabitEthernet1/0 + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 635 + +R1 also knows about the routes now, as shown in Example 15-56, which displays the out-put of show ip route on R1. + +Example 15-56 Verifying Routes in the Routing Table on R1 + +R1#show ip route +...output omitted... +Gateway of last resort is 10.1.12.2 to network 0.0.0.0 + +O*E2 0.0.0.0/0 [110/1] via 10.1.12.2, 00:00:13, GigabitEthernet1/0 +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +O IA 10.1.3.0/24 [110/3] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +O IA 10.1.23.0/24 [110/2] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 +O IA 10.1.34.0/24 [110/3] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 +O IA 192.168.1.0/24 [110/4] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 +O IA 203.0.113.0/24 [110/3] via 10.1.12.2, 00:00:19, GigabitEthernet1/0 + +Finally, you ping from the PC again, and the ping is successful, as shown in Example 15-57. + +Example 15-57 A Successful Ping from the 10.1.1.0/24 network to the 192.168.1.0/24 network + +C:\>ping 192.168.1.10 + +Pinging 192.168.1.10 with 32 bytes of data: + +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.168.1.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 15-2 + +Problem: Users in the 10.1.1.0/24 network indicate that they are not able to access resources in the 192.168.1.0/24 network. + + + + + +From the Library of Outcast Outcast +636 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +As always, the first item on the list for troubleshooting is to verify the problem. You access a PC in the 10.1.1.0/24 network and ping an IP address in the 192.168.1.0/24 net-work, and it is successful (0% loss), as shown in Example 15-58. However, notice that the reply is from 10.1.23.2 and it states TTL expired in transit. Therefore, it was technically not successful. + +Example 15-58 TTL Expired in Transit Result from ping Command on PC + +C:\>ping 192.168.1.10 + +Pinging 192.168.1.10 with 32 bytes of data: + +Reply from 10.1.23.2: TTL expired in transit. +Reply from 10.1.23.2: TTL expired in transit. +Reply from 10.1.23.2: TTL expired in transit. +Reply from 10.1.23.2: TTL expired in transit. + +Ping statistics for 192.168.1.10: +Packets: sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + +The result of this ping tells us two very important things: 1) The PC can reach the default gateway at 10.1.1.1; 2); the device at 10.1.23.2 expired the packet because the TTL reached 0 and the device sent an ICMP time exceeded message back to the PC. + +Pause for a moment and think about this! If the TTL expired in transit, it means that the packet did not reach the destination before the TTL decremented to 0. Each time a router touches the packet, it decrements the TTL by 1. Normally the TTL is set to 255 +by default. Unless it was modified, which we did not do, the packet bounced around the network and went through approximately 255 routers before the device at IP 10.1.23.2 decremented the TTL to 0 and sent the ICMP TTL expired message. Because Figure +15-12 clearly shows that there are only four routers from 10.1.1.0/24 to 192.168.1.0/24, the packet is bouncing around the network somewhere. Running a traceroute from the PC will help us identify this as shown in Example 15-59. This example shows that R3 (10.1.23.3) and R2 (10.1.23.2) are bouncing the packet back and forth. + +Example 15-59 Traceroute Showing that R2 and R3 Are Bouncing Packet Back and Forth + +C:\>tracert 192.168.1.10 + +Tracing route to 192.168.1.10 over a maximum of 30 hops + + +1 23 ms 15 ms +2 36 ms 30 ms +3 53 ms 50 ms +4 61 ms 39 ms + +10 ms 10.1.1.1 +29 ms 10.1.12.2 +39 ms 10.1.23.3 +40 ms 10.1.23.2 + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 637 + + +5 61 ms 69 ms +6 68 ms 50 ms +7 * ms 78 ms +8 87 ms 69 ms + +59 ms 10.1.23.3 +69 ms 10.1.23.2 +89 ms 10.1.23.3 +* ms 10.1.23.2 + +...output omitted... + +29 175 ms 169 ms +30 204 ms 189 ms + +179 ms 10.1.23.3 +189 ms 10.1.23.2 + + +Trace complete. + +We can deduce from this that R3 is not routing the packet correctly. It is sending the packet to R2 instead of R4. Accessing R3 and issuing the show ip ospf database router 4.4.4.4 command, as shown in Example 15-60, clearly indicates that R3 is learning about the network 192.168.1.0/24 from R4. However, instead of using R4 as a next hop, it is using R2 because it is sending the packets to R2, as shown in the earlier trace. + +Example 15-60 Verifying Whether a Route Is in an OSPF Database + +R3#show ip ospf database router 4.4.4.4 + +OSPF Router with ID (3.3.3.3) (Process ID 1) + +Router Link States (Area 0) + +LS age: 894 +Options: (No TOS-capability, DC) +LS Type: Router Links +Link State ID: 4.4.4.4 +Advertising Router: 4.4.4.4 +LS Seq Number: 80000004 +Checksum: 0xEA47 +Length: 48 +Number of Links: 2 + +Link connected to: a Transit Network +(Link ID) Designated Router address: 10.1.34.4 +(Link Data) Router Interface address: 10.1.34.4 +Number of MTID metrics: 0 +TOS 0 Metrics: 1 + +Link connected to: a Stub Network +(Link ID) Network/subnet number: 192.168.1.0 +(Link Data) Network Mask: 255.255.255.0 +Number of MTID metrics: 0 +TOS 0 Metrics: 1 + + + + + +From the Library of Outcast Outcast +638 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Let’s look at the routing table to see whether we are installing this network in the routing table. Issuing the command show ip route ospf on R3, as shown in Example 15-61, indi-cates that this OSPF-learned route is not being installed in the routing table. + +Example 15-61 Output of show ip route ospf on R3 + +R3#show ip route ospf +...output omitted... + +Gateway of last resort is 203.0.113.1 to network 0.0.0.0 + +10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks +O IA 10.1.0.0/16 [110/2] via 10.1.23.2, 01:25:02, GigabitEthernet1/0 + +Time to hypothesize! What would cause R3 to learn about the route but not install it in the routing table: route filtering, better source, to name a few. However, harness your knowledge and really focus on what is happening. + +R3 is routing packets destined to 192.168.1.0/24, which means that there must be some entry in the routing table or policy based routing is enforced. + +Issuing the command show ip route 192.168.1.0 255.255.255.0 on R3 confirms that there is an entry in the routing table on R3, as shown in Example 15-62. However, it is a static entry with an AD of 1 pointing to 10.1.23.2. It looks like we found the problem. There is a better source of routing information according to AD. + +Example 15-62 Output of show ip route 192.168.1.0 255.255.255.0 on R3 + +R3#show ip route 192.168.1.0 255.255.255.0 +Routing entry for 192.168.1.0/24 +Known via "static", distance 1, metric 0 +Routing Descriptor Blocks: +* 10.1.23.2 +Route metric is 0, traffic share count is 1 + +The command show run | include ip route, as shown in Example 15-63, confirms that a static route exists. + +Example 15-63 Output of show run | include ip route + +R3#show run | include ip route +ip route 0.0.0.0 0.0.0.0 203.0.113.1 +ip route 192.168.1.0 255.255.255.0 10.1.23.2 + +After you remove this command from R3 with the no ip route 192.168.1.0 255.255.255.0 10.1.23.2 command, pinging from the PC is successful, as shown in Example 15-64. + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 639 + +Example 15-64 A Successful Ping to the 192.168.1.0/24 Network + +C:\>ping 192.168.1.10 + +Pinging 192.168.1.10 with 32 bytes of data: + +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 +Reply from 192.168.1.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 192.168.1.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + +Trouble Ticket 15-3 + +Problem: Routers R1 and R2 are not forming a neighbor adjacency. + +The first item on the list for troubleshooting is to verify the problem. You access R1 and issue the show ip ospf neighbor command, as shown in Example 15-65, and it confirms that there is no neighbor relationship with R2. + +Example 15-65 Verifying R1’s OSPF Neighbors + +R1#show ip ospf neighbor +R1# + +We know that to have a neighbor relationship we need interfaces participating in the OSPF process. Using show cdp neighbors confirms that R2 is connected to R1’s local Gig1/0 interface, as shown in Example 15-66. Therefore, we need to enable OSPF on that interface. + +Example 15-66 Verifying R1’s CDP Neighbors + +R1#show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, +D - Remote, C - CVTA, M - Two-port Mac Relay + + +Device ID +R2 + +Local Intrfce +Gig 1/0 + +Holdtme +142 + +Capability +R + +Platform Port ID +7206VXR Gig 0/0 + + +The output of show ip ospf interface brief confirms that Gig1/0 is participating in the OSPF process as shown in Example 15-67. However, based on Figure 15-12, it is not in the correct area. It should be in area 1. + + + + + +From the Library of Outcast Outcast +640 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-67 Verifying R1’s OSPF-Enabled Interfaces + +R1#show ip ospf interface brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Gi0/0 1 1 +Gi1/0 1 51 + +10.1.1.1/24 1 DR 0/0 +10.1.12.1/24 1 DR 0/0 + + +Based on Example 15-67, Gig1/0 has an IP address of 10.1.12.1/24. Therefore, we need a network command that includes that IP address and places the interface in area 1. The output of show run | section router ospf indicates that there is a network command that will enable the routing process on Gig1/0 and put it in area 1, as shown in Example 15-68. + +Example 15-68 Verifying R1’s OSPF Configuration + +R1#show run | section router ospf +router ospf 1 +router-id 1.1.1.1 +area 1 authentication message-digest +passive-interface default +no passive-interface GigabitEthernet1/0 +network 10.1.1.1 0.0.0.0 area 1 +network 10.1.12.1 0.0.0.0 area 1 + +If you are scratching your head, you’re not the only one at this point. The running con-figuration clearly shows a command that puts Gig1/0 in area 1 yet the output of show ip interface brief clearly shows that it is in area 51. If you have not figured out why this happened, keep reading. + +Recall that there are two ways to enable OSPF on an interface: 1) with the network area command in router OSPF configuration mode; and 2) with the ip ospf area interface con-figuration mode command. + +The ip ospf area command overrides the network area command if both are configured. Let’s look at the Gig1/0 interface configuration on R1 using the show run interface gig 1/0 command, as shown in Example 15-69. + +Example 15-69 Verifying R1’s Gig1/0 Configuration + +R1#show run interface gigabitEthernet 1/0 +Building configuration... + +Current configuration : 183 bytes +! +interface GigabitEthernet1/0 +ip address 10.1.12.1 255.255.255.0 +ip ospf authentication-key CISCO +ip ospf message-digest-key 1 md5 CISCO +ip ospf 1 area 51 +negotiation auto +end + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 641 + +There is the issue. The ip ospf 1 area 51 command overrides the network 10.1.12.1 0.0.0.0 area 1 command. You will either need to change the ip ospf 1 area 51 command so that it states area 1 or remove it completely so that the network command can be used. + +Troubleshooting OSPFv3 for IPv6 + +Because OSPFv3 is based on OSPFv2, you will be dealing with similar issues when it comes to troubleshooting, with a few minor differences based on IPv6. This should come as a relief, knowing that you do not have to learn a large amount of new information for OSPFv3. However, you do need to know the show commands that will display the infor-mation you need to troubleshoot any given OSPFv3-related issue. + +This section describes show commands that you can use to troubleshoot OSPFv3 neigh-bor adjacency issues and route issues. + +OSPFv3 Troubleshooting Commands + +The show ipv6 protocols command as shown in Example 15-70 is used to verify which IPv6 routing protocols are running on you device. Specific to OSPFv3, you can verify the process ID (PID), the RID, the type of router: Area Border Router (ABR), Autonomous System Border Router (ASBR), the number of areas the router is a member of, whether any of the areas are stub or NSSA, the interfaces participating in the routing process and +the area they belong to, and whether redistribution is occurring. + +Key Example 15-70 Identifying What Can Be Verified for OSPFv3 with show ipv6 protocols Topic R2#show ipv6 protocols +...output omitted... +IPv6 Routing Protocol is "ospf 1 " +Router ID 2.2.2.2 +Area border and autonomous system boundary router +Number of areas: 2 normal, 0 stub, 0 nssa +Interfaces (Area 0): +GigabitEthernet0/0 +Interfaces (Area 23): +GigabitEthernet1/0 +Redistribution: +None + +The show ipv6 ospf command, as shown in Example 15-71, is used to display global OSPFv3 settings. For example, you can verify the OSPFv3 PID, the RID, the type of router: ABR, ASBR, various timers and statistics, the number of areas on the router and the type of area including normal, stub and NSSA, the reference bandwidth, and the parameters related to the different areas configured on the router (for example, if area authentication is enabled, if the area is a stub, totally stubby, NSSA, or totally NSSA). + + + + +From the Library of Outcast Outcast +642 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Key Example 15-71 Identifying What Can Be Verified with show ipv6 ospf Topic R1#show ipv6 ospf +Routing Process "ospfv3 1" with ID 1.1.1.1 +Supports NSSA (compatible with RFC 3101) +Event-log enabled, Maximum number of events: 1000, Mode: cyclic +It is an area border router +Router is not originating router-LSAs with maximum metric +Initial SPF schedule delay 5000 msecs +Minimum hold time between two consecutive SPFs 10000 msecs +Maximum wait time between two consecutive SPFs 10000 msecs +Minimum LSA interval 5 secs +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +Interface flood pacing timer 33 msecs +Retransmission pacing timer 66 msecs +Retransmission limit dc 24 non-dc 24 +Number of external LSA 1. Checksum Sum 0x009871 +Number of areas in this router is 2. 1 normal 1 stub 0 nssa +Graceful restart helper support enabled +Reference bandwidth unit is 100 mbps +RFC1583 compatibility enabled +Area BACKBONE(0) +Number of interfaces in this area is 2 +MD5 Authentication, SPI 257 +SPF algorithm executed 3 times +Number of LSA 11. Checksum Sum 0x06DB20 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 +Area 1 +Number of interfaces in this area is 1 +It is a stub area, no summary LSA in this area +Generates stub default route with cost 1 +SPF algorithm executed 4 times +Number of LSA 7. Checksum Sum 0x03A033 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 + + + +Key Topic + +The command show ipv6 ospf interface brief, as shown in Example 15-72, enables you to verify which interfaces are participating in the OSPFv3 process. You can also identify the PID they are attached to, the area they are participating in, the IPv6 interface ID used to represent the interface, the cost of the interface (which by default is based on the ref- +erence bandwidth divided by the interface bandwidth), the DR/BDR state, and whether + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 643 + +there are any neighbor adjacencies established out the interface. Notice that R1 has inter-faces in area 0 and area 1. Therefore, it is an ABR. + +Example 15-72 Identifying What Can Be Verified with show ipv6 ospf interface brief + +R1#show ipv6 ospf interface brief +Interface PID Area Intf ID Cost State Nbrs F/C + +Gi1/0 1 0 +Gi0/0 1 0 +Fa3/0 1 1 + +4 1 BDR 1/1 +3 1 DR 0/0 +6 1 BDR 1/1 + + + + +Key Topic + +With the show ipv6 ospf interface interface_type interface_number command, you can obtain detailed information about the interfaces participating in the OSPF process, as shown in Example 15-73. The unique information that will draw you to this command for troubleshooting includes the network type, the cost, whether authentication is enabled on the interface, the current DR/BDR state, the interface priority, the DR and BDR IDs, +and the timers (hello and dead). + + +Example 15-73 Identifying What Can Be Verified with show ipv6 ospf interface inter-face_type interface_number + +R1#show ipv6 ospf interface fastEthernet 3/0 +FastEthernet3/0 is up, line protocol is up +Link Local Address FE80::C809:13FF:FEB8:54, Interface ID 6 +Area 1, Process ID 1, Instance ID 0, Router ID 1.1.1.1 +Network Type BROADCAST, Cost: 1 +MD5 authentication SPI 256, secure socket UP (errors: 0) +Transmit Delay is 1 sec, State BDR , Priority 1 +Designated Router (ID) 4.4.4.4, local address FE80::C808:9FF:FE30:1C +Backup Designated router (ID) 1.1.1.1, local address FE80::C809:13FF:FEB8:54 +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:04 +Graceful restart helper support enabled +Index 1/1/1, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 2 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 4.4.4.4 (Designated Router) +Suppress hello for 0 neighbor(s) + +The show ipv6 ospf neighbor command enables you to verify the routers that have suc-cessfully formed a neighbor adjacency with the local router, as shown in Example 15-74. You can verify the neighbor by its RID, which is displayed in the Neighbor ID column, the priority of the neighbor’s interface used to form the neighbor adjacency, the state of the neighbor’s interface, the dead timer, the IPv6 interface ID of the neighboring device, and the local interface used to form the adjacency. + + + + +From the Library of Outcast Outcast +644 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-74 Identifying What Can Be Verified with show ipv6 ospf neighbor + +R1#show ipv6 ospf neighbor + +OSPFv3 Router with ID (1.1.1.1) (Process ID 1) + + +Neighbor ID +2.2.2.2 +4.4.4.4 + +Pri State +1 FULL/DR +1 FULL/DR + +Dead Time +00:00:36 +00:00:39 + +Interface ID +3 +4 + +Interface +GigabitEthernet1/0 +FastEthernet3/0 + + +To verify the LSAs that have been collected and placed in the LSDB, you use the show ipv6 ospf database command, as shown in Example 15-75. In this example, R1 has infor-mation for area 0 and area 1 because it is an ABR. + +Example 15-75 Displaying the OSPFv3 LSDB + +R1#show ipv6 ospf database + +OSPFv3 Router with ID (1.1.1.1) (Process ID 1) + +Router Link States (Area 0) + + +ADV Router Age +1.1.1.1 847 +2.2.2.2 748 + +Seq# +0x80000005 +0x80000007 + +Fragment ID +0 +0 + +Link count Bits +1 B +1 B E + + +Net Link States (Area 0) + + +ADV Router Age +2.2.2.2 878 + +Seq# Link ID +0x80000003 3 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 0) + + +ADV Router Age +1.1.1.1 1136 +2.2.2.2 1006 +2.2.2.2 1006 + +Seq# +0x80000001 +0x80000002 +0x80000002 + +Prefix +2001:DB8:0:14::/64 +2001:DB8:0:23::/64 +2001:DB8:0:3::/64 + + +Link (Type-8) Link States (Area 0) + + +ADV Router Age +1.1.1.1 847 +2.2.2.2 1006 +1.1.1.1 847 + +Seq# Link ID +0x80000002 4 +0x80000002 3 +0x80000002 3 + +Interface +Gi1/0 +Gi1/0 +Gi0/0 + + +Intra Area Prefix Link States (Area 0) + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 645 + + +ADV Router Age +1.1.1.1 847 +2.2.2.2 878 + +Seq# Link ID +0x80000006 0 +0x80000003 3072 + +Ref-lstype +0x2001 +0x2002 + +Ref-LSID +0 +3 + + +Router Link States (Area 1) + + +ADV Router Age +1.1.1.1 1151 +4.4.4.4 1152 + +Seq# +0x80000004 +0x80000006 + +Fragment ID +0 +0 + +Link count Bits +1 B +1 None + + +Net Link States (Area 1) + + +ADV Router Age +4.4.4.4 1147 + +Seq# Link ID +0x80000003 4 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 1) + + +ADV Router Age +1.1.1.1 847 + +Seq# Prefix +0x80000002 ::/0 + + +Link (Type-8) Link States (Area 1) + + +ADV Router Age +1.1.1.1 1105 +4.4.4.4 1158 + +Seq# Link ID +0x80000002 6 +0x80000003 4 + +Interface +Fa3/0 +Fa3/0 + + +Intra Area Prefix Link States (Area 1) + + +ADV Router Age +4.4.4.4 1147 + +Seq# Link ID +0x80000003 4096 + +Ref-lstype +0x2002 + +Ref-LSID +4 + + +Type-5 AS External Link States + + +ADV Router Age +2.2.2.2 748 + +Seq# Prefix +0x80000002 ::/0 + + +Notice in Example 15-75 that there are two new LSA types when compared to Table 15-4, the Link (Type 8) LSA and the Intra Area Prefix LSA (which is also known as Type 9). Table 15-5 defines both of these LSAs for OSPFv3. Also notice in Example 15-75 that the Type 3 LSA (Summary LSA) is now called the Inter Area Prefix LSA. + + + + + + + + + +From the Library of Outcast Outcast +646 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Table 15-5 + +LSA Type +8 + + +9 + + +Additional OSPF LSAs for OSPFv3 + +Description +This LSA type (Link) provides information to neighbors about link-local addresses and the IPv6 addresses associated with the link. Therefore, it is only flooded on the local link and will not be reflooded by other OSPF routers. +This LSA type (Intra Area Prefix) provides information for two different scenarios. 1) It will provide information about IPv6 address prefixes associated with a transit network by referencing a Network LSA. 2) It will provide information about IPv6 address prefixes associated with a router by referencing a Router LSA. Type 9 LSAs are only flooded within an area. + + + +To verify the OSPFv3 routes that have been installed in the routing table, you use the show ipv6 route ospf command, as shown in Example 15-76. In this case, R1 only knows about an external OSPFv3 route, which is the default route, and two interarea routes (routes outside the area but still within the OSPFv3 domain). + +Example 15-76 Displaying the OSPFv3 Routes in the Routing Table + +R1#show ipv6 route ospf +IPv6 Routing Table - default - 10 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +OE2 ::/0 [110/1], tag 1 +via FE80::C80A:13FF:FEB8:8, GigabitEthernet1/0 +OI 2001:DB8:0:3::/64 [110/3] +via FE80::C80A:13FF:FEB8:8, GigabitEthernet1/0 +OI 2001:DB8:0:23::/64 [110/2] +via FE80::C80A:13FF:FEB8:8, GigabitEthernet1/0 + +Use the show ipv6 interface interface_type interface_id command, as shown in Example 15-77, when troubleshooting OSPFv3 issues to verify whether the interface is listening to the multicast group addresses of FF02::5 (all OSPFv3 routers) and FF02::6 (OSPFv3 DR/ BDR). You can also verify the MTU and whether there are any IPv6 ACLs applied to the interface that might be blocking OSPFv3 packets, or packets sourced from/destined to link-local addresses. + +Example 15-77 Displaying the IPv6 Interface Parameters + +R1#show ipv6 interface fastEthernet 3/0 +FastEthernet3/0 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C809:13FF:FEB8:54 +...output omitted... + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 647 + +Joined group address(es): +FF02::1 +FF02::2 +FF02::5 +FF02::6 +FF02::1:FF00:1 +FF02::1:FFB8:54 +MTU is 1500 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled +ICMP unreachables are sent +Input features: Access List IPsec +Output features: IPsec +Inbound access list TSHOOT_ACL +ND DAD is enabled, number of DAD attempts: 1 +...output omitted... + + +OSPFv3 Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 15-13. + + + + +OSPFv3 + +2001:db8:0:1::/64 AREA 0 + +Internet 2001:db8:f::f + +Gi2/0 + + + +AREA 23 +2001:db8:0:3::/64 + +Gi1/0 Gi0/0 Gi1/0 Gi1/0 +Gi0/0 R1 2001:db8:0:12::/64 R2 2001:db8:0:23::/64 R3 Gi0/0 Fa3/0 + + + +WAN 2001:db8:0:14::/64 + +AREA 1 + + +Gi0/0 Fa1/0 BRANCH +2001:db8:0:4::/64 + + +Figure 15-13 OSPFv3 Trouble Tickets Topology + + +Trouble Ticket 15-4 + +Problem: Recently, the network was updated to reduce the number of LSAs that would cross the WAN link from R1 to the Branch site. The only LSA that would be permitted is a Type 3 LSA about a default route. However, reports indicate that there are more Type 3 LSAs that are being sent from R1 to Branch. + + +From the Library of Outcast Outcast +648 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +You begin by reviewing the configuration change documents that were created when the change was implemented. You notice that the information is very vague. It only states that Area 1 was created as a totally stubby area. It does not indicate what changes were made to which devices and the commands that were used. + +Your troubleshooting begins by verifying the problem with the show ipv6 route ospf command on Branch, as shown in Example 15-78. You confirm that there are more inter-area routes than just the default interarea route. + +Example 15-78 Displaying the IPv6 Routing Table on Branch + +Branch#show ipv6 route ospf +IPv6 Routing Table - default - 10 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +OI ::/0 [110/2] +via FE80::C801:10FF:FE20:54, FastEthernet1/0 +OI 2001:DB8:0:1::/64 [110/2] +via FE80::C801:10FF:FE20:54, FastEthernet1/0 +OI 2001:DB8:0:3::/64 [110/4] +via FE80::C801:10FF:FE20:54, FastEthernet1/0 +OI 2001:DB8:0:12::/64 [110/2] +via FE80::C801:10FF:FE20:54, FastEthernet1/0 +OI 2001:DB8:0:23::/64 [110/3] +via FE80::C801:10FF:FE20:54, FastEthernet1/0 + +Next you want to confirm if Branch is configured as a stub for area 1. You issue the com-mand show ipv6 ospf | include Area|stub as shown in Example 15-79 and confirm that it is. + +Example 15-79 Verifying Whether Area 1 Is a Stub Area on Branch + +Branch#show ipv6 ospf | include Area|stub +Number of areas in this router is 1. 0 normal 1 stub 0 nssa +Area 1 +It is a stub area + +You then issue the same command on R1, as shown in Example 15-80. The output indi-cates that area 1 is a stub area and that a default route is being injected into the area with a cost of 1. + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 649 + +Example 15-80 Verifying Whether Area 1 Is a Stub Area on R1 + +R1#show ipv6 ospf | include Area|stub +Number of areas in this router is 2. 1 normal 1 stub 0 nssa +Area BACKBONE(0) +Area 1 +It is a stub area +Generates stub default route with cost 1 + +However, you realize that this output indicates that a stub area exists, not a totally stubby area. If it were a totally stubby area, it would also state no summary LSA in this area. To confirm this, you issue the command show run | section ipv6 router ospf on both +R1 and Branch, as shown in Example 15-81. Reviewing the output, you notice that R1 is configured with area 1 stub and Branch is configured with area 1 stub no-summary. It appears that the commands were executed on the wrong routers. + +Example 15-81 Verifying IPv6 Router OSPF Configuration on R1 and Branch + +R1#show run | section ipv6 router ospf +ipv6 router ospf 1 +router-id 1.1.1.1 +area 1 stub +passive-interface GigabitEthernet0/0 + +Branch#show run | section ipv6 router ospf +ipv6 router ospf 1 +router-id 4.4.4.4 +area 1 stub no-summary +passive-interface default +no passive-interface FastEthernet1/0 + +To fix this issue, you issue the command area 1 stub no-summary on R1 and the com-mands no area 1 stub no-summary and area 1 stub on Branch. Once the change has been made, you issue the command show run | section ipv6 router ospf on both R1 and Branch to confirm the changes were made, as shown in Example 15-82. + +Example 15-82 Verifying IPv6 Router OSPF Configuration on R1 and Branch After Change + +R1#show run | section ipv6 router ospf +ipv6 router ospf 1 +router-id 1.1.1.1 +area 1 stub no-summary +passive-interface GigabitEthernet0/0 + +Branch#show run | section ipv6 router ospf +ipv6 router ospf 1 +router-id 4.4.4.4 + + + + +From the Library of Outcast Outcast +650 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +area 1 stub +passive-interface default +no passive-interface FastEthernet1/0 + +Next you issue the command show ipv6 ospf | include Area|stub on R1, as shown in Example 15-83, to verify that it states no summary LSA in this area, which means no Type 3. It does! + +Example 15-83 Verifying Area 1 Is a Stub Area With No Summary LSAs On R1 + +R1#show ipv6 ospf | include Area|stub +Number of areas in this router is 2. 1 normal 1 stub 0 nssa +Area BACKBONE(0) +Area 1 +It is a stub area, no summary LSA in this area +Generates stub default route with cost 1 + +The output of show ipv6 route ospf on Branch only contains the default route now. The issue is solved, as shown in Example 15-84. + +Example 15-84 Verifying Branch Is Only Receiving a Default Route + +Branch#show ipv6 route ospf +IPv6 Routing Table - default - 6 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +OI ::/0 [110/2] +via FE80::C801:10FF:FE20:54, FastEthernet1/0 + + +Trouble Ticket 15-5 + +Problem: Branch users are complaining that they are unable to access any resources out-side the Branch office. + +You access Branch and issue the extended ping command as shown in Example 15-85 to test connectivity and connectivity fails. + +Example 15-85 Testing Connectivity from Branch to a Remote Network + +Branch#ping +Protocol [ip]: ipv6 +Target IPv6 address: 2001:db8:0:1::1 +Repeat count [5]: +Datagram size [100]: +Timeout in seconds [2]: + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 651 + +Extended commands? [no]: yes +Source address or interface: 2001:db8:0:4::4 +UDP protocol? [no]: +Verbose? [no]: +Precedence [0]: +DSCP [0]: +Include hop by hop option? [no]: +Include destination option? [no]: +Sweep range of sizes? [no]: +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:1::1, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +..... +Success rate is 0 percent (0/5) + +You issue the show ipv6 route command on Branch and notice that there are only local and connected routes, as shown in Example 15-86. + +Example 15-86 Verifying IPv6 Routes in a Routing Table + +Branch#show ipv6 route +...output omitted... +C 2001:DB8:0:4::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:0:4::4/128 [0/0] +via GigabitEthernet0/0, receive +C 2001:DB8:0:14::/64 [0/0] +via FastEthernet1/0, directly connected +L 2001:DB8:0:14::4/128 [0/0] +via FastEthernet1/0, receive +L FF00::/8 [0/0] +via Null0, receive + +You conclude that no routes are being learned from R1. Therefore, there must be a neigh-bor issue. To confirm, you issue the command show ipv6 ospf neighbor on Branch, and as you suspected, Example 15-87 confirms that Branch is not a neighbor with R1. + +Example 15-87 Verifying IPv6 OSPF Neighbors + +Branch#show ipv6 ospf neighbor +Branch# + +You suspect that the Branch interface connected to R1 is not enabled for the OSPFv3 process. You issue the show ipv6 ospf interface brief command to verify whether the interface is participating in the process. In Example 15-88, the output indicates that Fast Ethernet 1/0 is participating in the OSPFv3 process. + + + + + +From the Library of Outcast Outcast +652 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-88 Verifying OSPFv3-Enabled Interfaces on Branch + +Branch#show ipv6 ospf interface brief +Interface PID Area Intf ID Cost State Nbrs F/C + +Gi0/0 1 1 +Fa1/0 1 1 + +3 1 DR 0/0 +4 1 BDR 1/1 + + +You decide to shift your attention to R1 and check whether the interface connected to Branch is participating in the OSPFv3 process. R1 is using Fast Ethernet 3/0 to connect to Branch. Issuing the command show ipv6 ospf interface brief on R1, as shown in Example 15-89, reveals that Fa3/0 is participating in the OSPF process as well. + +Example 15-89 Verifying OSPFv3-Enabled Interfaces on R1 + +R1#show ipv6 ospf interface brief +Interface PID Area Intf ID Cost State Nbrs F/C + +Gi1/0 1 0 +Gi0/0 1 0 +Fa3/0 1 1 + +4 1 BDR 1/1 +3 1 DR 0/0 +6 1 DR 0/0 + + +You revisit Branch and decide to issue the debug ipv6 ospf hello command to gather further information. The output displayed in Example 15-90 reveals that timers are mismatched from FE80::C801:10FF:FE20:54. You issue the show cdp neighbors detail command on Branch, as shown in Example 15-91, to confirm that R1 is using that link-local address. It is! Therefore, you conclude that the neighbor relationship is not formed because of mismatched timers. + +Example 15-90 Using debug ipv6 ospf hello to Gather Further Information + +Branch#debug ipv6 ospf hello +OSPFv3 hello events debugging is on for process 1, IPv6, Default vrf +Branch# +OSPFv3-1-IPv6 HELLO Fa1/0: Rcv hello from 1.1.1.1 area 1 from FE80::C801:10FF:FE20:54 interface ID 6 +OSPFv3-1-IPv6 HELLO Fa1/0: Mismatched hello parameters from FE80::C801:10FF:FE20:54 +OSPFv3-1-IPv6 HELLO Fa1/0: Dead R 40 C 120, Hello R 10 C 30 +Branch#u all +All possible debugging has been turned off + + +Example 15-91 Using show cdp neighbors details to Verify Neighbor IPv6 Address + +Branch#show cdp neighbors detail +------------------------- +Device ID: R1 +Entry address(es): +IP address: 10.1.14.1 +IPv6 address: 2001:DB8:0:14::1 (global unicast) +IPv6 address: FE80::C801:10FF:FE20:54 (link-local) +Platform: Cisco 7206VXR, Capabilities: Router + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 653 + +Interface: FastEthernet1/0, Port ID (outgoing port): FastEthernet3/0 +...output omitted... + +On R1, you issue the show ipv6 ospf interface fastethernet3/0 command, and on Branch you issue the show ipv6 ospf interface fastethernet1/0 command and use the spot-the-difference method, as shown in Example 15-92. + +Example 15-92 Spotting the Difference Between R1 and Branch + +R1#show ipv6 ospf interface fastEthernet 3/0 +FastEthernet3/0 is up, line protocol is up +Link Local Address FE80::C801:10FF:FE20:54, Interface ID 6 +Area 1, Process ID 1, Instance ID 0, Router ID 1.1.1.1 +Network Type BROADCAST, Cost: 1 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 1.1.1.1, local address FE80::C801:10FF:FE20:54 +No backup designated router on this network +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:09 +...output omitted... + +Branch#show ipv6 ospf interface fastEthernet 1/0 +FastEthernet1/0 is up, line protocol is up +Link Local Address FE80::C800:FFF:FE7C:1C, Interface ID 4 +Area 1, Process ID 1, Instance ID 0, Router ID 4.4.4.4 +Network Type NON_BROADCAST, Cost: 1 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 4.4.4.4, local address FE80::C800:FFF:FE7C:1C +No backup designated router on this network +Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 +Hello due in 00:00:25 +...output omitted... + +You immediately notice that the hello and dead timers do not match. However, you remember that they can be configured manually or manipulated by changing the OSPF interface network type. Therefore, you check the network type and R1 is using +BROADCAST (default for Ethernet interfaces), and Branch is using NON_BRAODCAST (not the default for Ethernet interfaces). Therefore, someone must have manually changed the network type on Branch. + +You issue the command show run interface fastethernet 1/0 on Branch, as shown in Example 15-93, and confirm that the network type was manually changed with the ipv6 ospf network non-broadcast command. + + + + + + + + +From the Library of Outcast Outcast +654 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-93 Verifying the Interface Configuration on Branch + +Branch#show run interface fastEthernet 1/0 +Building configuration... + +Current configuration : 169 bytes +! +interface FastEthernet1/0 +ip address 10.1.14.4 255.255.255.0 +duplex full +ipv6 address 2001:DB8:0:14::4/64 +ipv6 ospf 1 area 1 +ipv6 ospf network non-broadcast +end + +You remove this command with the no ipv6 ospf network non-broadcast command, which will change the network type back to the default of BROADCAST. Once that hap-pens, a syslog message is generated indicating that a neighbor relationship is successfully formed between R1 and Branch: + +%OSPFv3-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet1/0 from LOADING to FULL, Loading Done +You reissue the extended ping command on Branch, and it is successful, as shown in Example 15-94. + +Example 15-94 Testing Connectivity from Branch to a Remote Network + +Branch#ping +Protocol [ip]: ipv6 +Target IPv6 address: 2001:db8:0:1::1 +Repeat count [5]: +Datagram size [100]: +Timeout in seconds [2]: +Extended commands? [no]: yes +Source address or interface: 2001:db8:0:4::4 +UDP protocol? [no]: +Verbose? [no]: +Precedence [0]: +DSCP [0]: +Include hop by hop option? [no]: +Include destination option? [no]: +Sweep range of sizes? [no]: +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:1::1, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 16/29/52 ms + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 655 + +Troubleshoot OSPFv3 Address Families + +OSPFv3 address families (AFs) enable you to configure a single process that will sup-port both IPv4 and IPv6. In addition, a single database is maintained for IPv4 and IPv6. However, adjacencies are established individually for each AF, and settings can be config-ured on an AF-by-AF basis. + +In this section, you learn the commands that you can use to troubleshoot an OSPFv3 implementation that uses address families. + +OSPFv3 Address Family Troubleshooting + +Example 15-95 shows a sample OSPFv3 configuration with AFs. The OSPFv3 PID is 10 and is locally significant. Therefore, it does not have to match between neighbors. Any parameter configured under the main router OSPFv3 configuration mode will apply to all address families. In this example, the area 23 stub command was configured under the main router OSPFv3 configuration mode; therefore, area 23 will be a stub area for both IPv4 and IPv6 address families. Note that if there are conflicts between configura-tions in router OSPFv3 configuration mode and AF configuration mode, AF configura-tion mode wins. You still enable the OSPFv3 process on an interface-by-interface basis in interface configuration mode with the ospfv3 process_id {ipv4|ipv6} area area_id command. In addition, OSPFv3 interface parameters are still configured in interface con-figuration mode. However, remember that if you do not specify the AF (IPv4 or IPv6), the configured parameter applies to all address families. If you apply the configuration to the AF, it applies only to that AF. If a conflict exists, the AF configuration wins. Refer to the Gigabit Ethernet 0/0 configuration in Example 15-95. Notice that the hello inter-val is configured without an AF specified. Therefore, it applies to both IPv4 and IPv6. However, the hello interval is also configured for the IPv6 AF. Therefore, this configura- +tion prevails for IPv6, and a hello interval of 10 is used; IPv4 uses the hello interval of 11. + +Example 15-95 Sample OSPFv3 Configuration with Address Families +Key +Topic R2#show run | section router ospfv3 +router ospfv3 10 +area 23 stub +! +address-family ipv4 unicast +passive-interface default +no passive-interface GigabitEthernet0/0 +no passive-interface GigabitEthernet1/0 +default-information originate +router-id 2.2.2.2 +exit-address-family +! +address-family ipv6 unicast +passive-interface default +no passive-interface GigabitEthernet0/0 + + + + +From the Library of Outcast Outcast +656 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +no passive-interface GigabitEthernet1/0 +default-information originate +router-id 22.22.22.22 +exit-address-family + +R2#show run int gig 1/0 +interface GigabitEthernet1/0 +ip address 10.1.23.2 255.255.255.0 +ipv6 address 2001:DB8:0:23::2/64 +ospfv3 10 ipv6 area 23 +ospfv3 10 ipv4 area 23 +end + +R2#show run int gig 0/0 +interface GigabitEthernet0/0 +ip address 10.1.12.2 255.255.255.0 +ipv6 address 2001:DB8:0:12::2/64 +ospfv3 10 hello-interval 11 +ospfv3 10 ipv6 area 0 +ospfv3 10 ipv6 hello-interval 10 +ospfv3 10 ipv4 area 0 +end + +With OSPFv3 AFs, you can still use the show ip protocols and show ipv6 protocols commands, as shown in Example 15-96, to verify the same information previously dis-cussed in the chapter. + +Example 15-96 Using show ip protocols and show ipv6 protocols + +R2#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "ospfv3 10" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 2.2.2.2 +Area border and autonomous system boundary router +Number of areas: 1 normal, 1 stub, 0 nssa +Interfaces (Area 0): +GigabitEthernet0/0 +Interfaces (Area 23): +GigabitEthernet1/0 +Maximum path: 4 +Routing Information Sources: + +Gateway +2.2.2.2 +3.3.3.3 + +Distance +110 +110 + +Last Update +00:12:39 +00:12:39 + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 657 + +10.1.14.1 110 00:00:57 +Distance: (default is 110) + +R2#show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "static" +IPv6 Routing Protocol is "ospf 10" +Router ID 22.22.22.22 +Area border and autonomous system boundary router +Number of areas: 1 normal, 1 stub, 0 nssa +Interfaces (Area 0): +GigabitEthernet0/0 +Interfaces (Area 23): +GigabitEthernet1/0 +Redistribution: +None + +The output of show ospfv3, as shown in Example 15-97, displays the same information you would find with the show ip ospf and show ipv6 ospf commands. Notice that the IPv4 AF is listed first followed by the IPv6 AF. + +Example 15-97 Using show ospfv3 to Verify General OSPFv3 Parameters for AFs Key +Topic R2#show ospfv3 +OSPFv3 10 address-family ipv4 +Router ID 2.2.2.2 +Supports NSSA (compatible with RFC 3101) +Event-log enabled, Maximum number of events: 1000, Mode: cyclic +It is an area border and autonomous system boundary router +Redistributing External Routes from, +Originate Default Route +Router is not originating router-LSAs with maximum metric +Initial SPF schedule delay 5000 msecs +Minimum hold time between two consecutive SPFs 10000 msecs +Maximum wait time between two consecutive SPFs 10000 msecs +Minimum LSA interval 5 secs +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +Interface flood pacing timer 33 msecs +Retransmission pacing timer 66 msecs +Retransmission limit dc 24 non-dc 24 +Number of external LSA 1. Checksum Sum 0x0013EB +Number of areas in this router is 2. 1 normal 1 stub 0 nssa +Graceful restart helper support enabled +Reference bandwidth unit is 100 mbps +RFC1583 compatibility enabled + + + +From the Library of Outcast Outcast +658 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Area BACKBONE(0) +Number of interfaces in this area is 1 +SPF algorithm executed 13 times +Number of LSA 11. Checksum Sum 0x05A71D +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 +Area 23 +Number of interfaces in this area is 1 +It is a stub area +Generates stub default route with cost 1 +SPF algorithm executed 8 times +Number of LSA 12. Checksum Sum 0x064322 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 + +OSPFv3 10 address-family ipv6 +Router ID 22.22.22.22 +Supports NSSA (compatible with RFC 3101) +Event-log enabled, Maximum number of events: 1000, Mode: cyclic +It is an area border and autonomous system boundary router +Originate Default Route +Router is not originating router-LSAs with maximum metric +Initial SPF schedule delay 5000 msecs +Minimum hold time between two consecutive SPFs 10000 msecs +Maximum wait time between two consecutive SPFs 10000 msecs +Minimum LSA interval 5 secs +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +Interface flood pacing timer 33 msecs +Retransmission pacing timer 66 msecs +Retransmission limit dc 24 non-dc 24 +Number of external LSA 1. Checksum Sum 0x00B8F5 +Number of areas in this router is 2. 1 normal 1 stub 0 nssa +Graceful restart helper support enabled +Reference bandwidth unit is 100 mbps +RFC1583 compatibility enabled +Area BACKBONE(0) +Number of interfaces in this area is 1 +SPF algorithm executed 13 times +Number of LSA 11. Checksum Sum 0x0422C7 +Number of DCbitless LSA 0 +Number of indication LSA 0 + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 659 + +Number of DoNotAge LSA 0 +Flood list length 0 +Area 23 +Number of interfaces in this area is 1 +It is a stub area +Generates stub default route with cost 1 +SPF algorithm executed 11 times +Number of LSA 12. Checksum Sum 0x0591F5 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 + +Using the command show ospfv3 interface brief command will display the interfaces participating in the OSPFv3 process for each AF, as shown in Example 15-98. Notice the added column that indicates which AF the interface is participating in. + +Example 15-98 Using show ospfv3 interface brief to Verify OSPFv3 Interfaces +Key +Topic R2#show ospfv3 interface brief +Interface PID Area AF Cost State Nbrs F/C + +Gi0/0 10 0 +Gi1/0 10 23 +Gi0/0 10 0 +Gi1/0 10 23 + +ipv4 1 BDR 1/1 +ipv4 1 BDR 1/1 +ipv6 1 BDR 1/1 +ipv6 1 BDR 1/1 + + +The show ospfv3 interface command enables you to review detailed information about the interface configurations, as shown earlier in the chapter. Example 15-99 displays the IPv4 AF information at the top and the IPv6 AF information at the bottom. + +Example 15-99 Using show ospfv3 interface to Verify Details of OSPFv3 Interfaces Key +Topic R2#show ospfv3 interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Link Local Address FE80::C802:10FF:FE20:1C, Interface ID 4 +Internet Address 10.1.23.2/24 +Area 23, Process ID 10, Instance ID 64, Router ID 2.2.2.2 +Network Type BROADCAST, Cost: 1 +Transmit Delay is 1 sec, State BDR, Priority 1 +Designated Router (ID) 3.3.3.3, local address FE80::C804:10FF:FE74:1C +Backup Designated router (ID) 2.2.2.2, local address FE80::C802:10FF:FE20:1C +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:02 +Graceful restart helper support enabled +Index 1/1/2, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 4, maximum is 5 +Last flood scan time is 4 msec, maximum is 4 msec + + + +From the Library of Outcast Outcast +660 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 3.3.3.3 (Designated Router) +Suppress hello for 0 neighbor(s) +GigabitEthernet1/0 is up, line protocol is up +Link Local Address FE80::C802:10FF:FE20:1C, Interface ID 4 +Area 23, Process ID 10, Instance ID 0, Router ID 22.22.22.22 +Network Type BROADCAST, Cost: 1 +Transmit Delay is 1 sec, State BDR, Priority 1 +Designated Router (ID) 33.33.33.33, local address FE80::C804:10FF:FE74:1C +Backup Designated router (ID) 22.22.22.22, local address FE80::C802:10FF:FE20:1C +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:03 +Graceful restart helper support enabled +Index 1/1/2, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 4 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 33.33.33.33 (Designated Router) +Suppress hello for 0 neighbor(s) + +To verify the neighbor relationships that have been formed for each AF, issue the com-mand show ospfv3 neighbor, as shown in Example 15-100. Again, the output is present-ing the same information as discussed earlier in the chapter, except this time there are different sections for each AF. + +Example 15-100 Using show ospfv3 neighbor to Verify OSPFv3 Neighbors + +R2#show ospfv3 neighbor + +OSPFv3 10 address-family ipv4 (router-id 2.2.2.2) + + +Neighbor ID +10.1.14.1 +3.3.3.3 + +Pri State +1 FULL/DR +1 FULL/DR + +Dead Time +00:00:34 +00:00:36 + +Interface ID +4 +4 + +Interface +GigabitEthernet0/0 +GigabitEthernet1/0 + + +OSPFv3 10 address-family ipv6 (router-id 22.22.22.22) + + +Neighbor ID +10.1.14.1 +33.33.33.33 + +Pri State +1 FULL/DR +1 FULL/DR + +Dead Time +00:00:31 +00:00:34 + +Interface ID +4 +4 + +Interface +GigabitEthernet0/0 +GigabitEthernet1/0 + + +To verify the information in the LSDB, you issue the command show ospfv3 database. When using AFs, the OSPFv3 database contains LSAs for both IPv4 and IPv6 as shown in Example 15-101. + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 661 + +Example 15-101 Verifying the LSDB with show ospfv3 database + +R2#show ospfv3 database + +OSPFv3 10 address-family ipv4 (router-id 2.2.2.2) + +Router Link States (Area 0) + + +ADV Router Age +2.2.2.2 1456 +10.1.14.1 1457 + +Seq# +0x80000008 +0x80000007 + +Fragment ID +0 +0 + +Link count Bits +1 B E +1 B + + +Net Link States (Area 0) + + +ADV Router Age +10.1.14.1 1453 + +Seq# Link ID +0x80000003 4 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 0) + + +ADV Router Age +2.2.2.2 1618 +2.2.2.2 94 +10.1.14.1 1599 +10.1.14.1 1599 + +Seq# +0x80000003 +0x80000002 +0x80000002 +0x80000002 + +Prefix +10.1.23.0/24 +10.1.3.0/24 +10.1.14.0/24 +10.1.4.0/24 + + +Link (Type-8) Link States (Area 0) + + +ADV Router Age +2.2.2.2 1618 +10.1.14.1 1599 + +Seq# Link ID +0x80000003 3 +0x80000002 4 + +Interface +Gi0/0 +Gi0/0 + + +Intra Area Prefix Link States (Area 0) + + +ADV Router Age +10.1.14.1 1457 +10.1.14.1 1453 + +Seq# Link ID +0x80000007 0 +0x80000003 4096 + +Ref-lstype +0x2001 +0x2002 + +Ref-LSID +0 +4 + + +Router Link States (Area 23) + + +ADV Router Age +2.2.2.2 94 +3.3.3.3 248 + +Seq# +0x80000007 +0x80000009 + +Fragment ID +0 +0 + +Link count Bits +1 B +1 None + + +Net Link States (Area 23) + +ADV Router Age Seq# Link ID Rtr count + + + + +From the Library of Outcast Outcast +662 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +3.3.3.3 248 0x80000007 4 2 + +Inter Area Prefix Link States (Area 23) + + +ADV Router Age +2.2.2.2 1869 +2.2.2.2 1442 +2.2.2.2 1442 +2.2.2.2 1442 +2.2.2.2 1442 + +Seq# +0x80000002 +0x80000001 +0x80000001 +0x80000001 +0x80000001 + +Prefix +0.0.0.0/0 +10.1.1.0/24 +10.1.12.0/24 +10.1.4.0/24 +10.1.14.0/24 + + +Link (Type-8) Link States (Area 23) + + +ADV Router Age +2.2.2.2 1618 +3.3.3.3 1758 + +Seq# Link ID +0x80000004 4 +0x80000004 4 + +Interface +Gi1/0 +Gi1/0 + + +Intra Area Prefix Link States (Area 23) + + +ADV Router Age +3.3.3.3 248 +3.3.3.3 248 + +Seq# Link ID +0x80000008 0 +0x80000007 4096 + +Ref-lstype +0x2001 +0x2002 + +Ref-LSID +0 +4 + + +Type-5 AS External Link States + + +ADV Router Age +2.2.2.2 1618 + +Seq# +0x80000003 + +Prefix +0.0.0.0/0 + + +OSPFv3 10 address-family ipv6 (router-id 22.22.22.22) + +Router Link States (Area 0) + + +ADV Router Age +10.1.14.1 330 +22.22.22.22 198 + +Seq# +0x80000007 +0x8000000A + +Fragment ID +0 +0 + +Link count Bits +1 B +1 B E + + +Net Link States (Area 0) + + +ADV Router Age +10.1.14.1 330 + +Seq# Link ID +0x80000004 4 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 0) + + +ADV Router Age +10.1.14.1 1598 +10.1.14.1 1598 + +Seq# +0x80000002 +0x80000002 + +Prefix +2001:DB8:0:14::/64 +2001:DB8:0:4::/64 + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 663 + + +22.22.22.22 198 +22.22.22.22 198 + +0x80000002 +0x80000002 + +2001:DB8:0:3::/64 +2001:DB8:0:23::/64 + + +Link (Type-8) Link States (Area 0) + + +ADV Router Age +10.1.14.1 1598 +22.22.22.22 1446 + +Seq# Link ID +0x80000002 4 +0x80000003 3 + +Interface +Gi0/0 +Gi0/0 + + +Intra Area Prefix Link States (Area 0) + + +ADV Router Age +10.1.14.1 330 +10.1.14.1 330 + +Seq# Link ID +0x80000006 0 +0x80000004 4096 + +Ref-lstype +0x2001 +0x2002 + +Ref-LSID +0 +4 + + +Router Link States (Area 23) + + +ADV Router Age +22.22.22.22 198 +33.33.33.33 237 + +Seq# +0x8000000A +0x80000008 + +Fragment ID +0 +0 + +Link count Bits +1 B +1 None + + +Net Link States (Area 23) + + +ADV Router Age +33.33.33.33 237 + +Seq# Link ID +0x80000007 4 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 23) + + +ADV Router Age +22.22.22.22 198 +22.22.22.22 1961 +22.22.22.22 198 +22.22.22.22 198 +22.22.22.22 198 + +Seq# +0x80000005 +0x80000002 +0x80000002 +0x80000002 +0x80000002 + +Prefix +2001:DB8:0:12::/64 +::/0 +2001:DB8:0:1::/64 +2001:DB8:0:4::/64 +2001:DB8:0:14::/64 + + +Link (Type-8) Link States (Area 23) + + +ADV Router Age +22.22.22.22 1446 +33.33.33.33 1713 + +Seq# Link ID +0x80000004 4 +0x80000004 4 + +Interface +Gi1/0 +Gi1/0 + + +Intra Area Prefix Link States (Area 23) + + +ADV Router Age +33.33.33.33 237 +33.33.33.33 237 + +Seq# Link ID +0x8000000A 0 +0x80000007 4096 + +Ref-lstype +0x2001 +0x2002 + +Ref-LSID +0 +4 + + + + +From the Library of Outcast Outcast +664 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Type-5 AS External Link States + + +ADV Router Age +22.22.22.22 1446 + +Seq# Prefix +0x80000003 ::/0 + + +Keep in mind when troubleshooting OSPFv3 AFs that both OSPF for IPv4 and OSPF for IPv6 use IPv6 to exchange routing information. Therefore, IPv6 unicast routing must be enabled on the router. Also, classic OSPFv2 and the OSPFv3 AFs are not compatible. Therefore, a router using OSPFv3 AFs for IPv4 will not peer with a router using the clas-sic OSPFv2 configuration for IPv4 because they are not compatible. + +To verify the IPv4 OSPFv3 entries in the routing table, you can use the show ip route ospfv3 command. To verify the IPv6 OSPFv3 entries in the routing table, you can use the show ipv6 route ospf command. + +If you need to perform any debugging for OSPFv3, you can issue the debug ospfv3 com-mand followed by what you want to debug, such as events, packets, hellos, or adj. This will turn on the debug for all AFs. If you want to only turn it on for a specific AF, you need to include the AF in the command (for example debug ospfv3 ipv6 hello). In the command, ipv6 is referring to the AF. + +OSPFv3 AF Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 15-14. + + + + + +10.1.1.0/24 2001:db8:0:1::/64 + +Internet 192.0.2.1 +OSPFv3 2001:db8:f::f +AREA 0 Gi2/0 + + + + +AREA 23 10.1.3.0/24 2001:db8:0:3::/64 + +Gi1/0 Gi0/0 Gi1/0 Gi1/0 + +Gi0/0 R1 2001:db8:0:12::/64 Fa3/0 10.1.12.0/24 + + +R2 2001:db8:0:23::/64 R3 Gi0/0 10.1.23.0/24 + + + + +WAN 2001:db8:0:14::/64 10.1.14.0/24 + +AREA 1 Stub + + +Gi0/0 Fa1/0 BRANCH +2001:db8:0:4::/64 10.1.4.0/24 + + +Figure 15-14 OSPFv3 AF Trouble Tickets Topology + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 665 + +Trouble Ticket 15-6 + +Problem: Users in Branch have indicated that they are not able to access any IPv6-enabled resources on the Internet but they can access IPv4-enabled resources. + +An extended ping issued on Branch to the destination 2001:db8:f::f confirms the issue as shown in Example 15-102. In addition, you ping 192.0.2.1 and it is successful confirming connectivity to IPv4-enabled resources. + +Example 15-102 Verifying Connectivity + +Branch#ping +Protocol [ip]: ipv6 +Target IPv6 address: 2001:db8:f::f +Repeat count [5]: +Datagram size [100]: +Timeout in seconds [2]: +Extended commands? [no]: yes +Source address or interface: 2001:db8:0:4::4 +UDP protocol? [no]: +Verbose? [no]: +Precedence [0]: +DSCP [0]: +Include hop by hop option? [no]: +Include destination option? [no]: +Sweep range of sizes? [no]: +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:f::f, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +UUUUU +Success rate is 0 percent (0/5) + +Branch#ping 192.0.2.1 source 10.1.4.4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.0.2.1, timeout is 2 seconds: +Packet sent with a source address of 10.1.4.4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 80/112/152 ms + +On the Branch router, you issue the command show ipv6 route 2001:db8:f::f, and Example 15-103 indicates that the Branch router has a default route that can be used to reach the IPv6 address. This explains why the ping returned UUUUU. It indicates that the destination is not reachable by some other router. But which router is returning this mes-sage? + + + + + + + +From the Library of Outcast Outcast +666 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 15-103 Verifying Routes in the IPv6 Routing Table + +Branch#show ipv6 route 2001:db8:f::f +Routing entry for ::/0 +Known via "ospf 1", distance 110, metric 2, type inter area +Route count is 1/1, share count 0 +Routing paths: +FE80::C801:10FF:FE20:54, FastEthernet1/0 +Last updated 00:07:28 ago + +To verify this, you issue a trace to see where it fails. Example 15-104 displays the results of the command traceroute 2001:db8:f::f. The trace indicates that R1 is returning the destination unreachable message. + +Example 15-104 Tracing the Path + +Branch#traceroute 2001:db8:f::f +Type escape sequence to abort. +Tracing the route to 2001:DB8:F::F + +1 2001:DB8:0:14::1 !U !U !U + +You visit R1 and issue the show ipv6 route 2001:db8:f::f command, as shown in Example 15-105, and confirm that there is no route to reach that IPv6 address. Why would Branch have a default route but not R1? Reviewing the network diagram shows that area 1 is a stub area. Therefore, R1 is generating a default route and injecting it into the stub area. This is why the default route on Branch, as shown in Example 15-103, is of type interarea and not external. + +Example 15-105 Verifying Routes on R1 + +R1#show ipv6 route 2001:db8:f::f +% Route not found + +It seems that R2 might not be generating a default route when it should be. You access R2 and issue the show ospfv3 ipv6 command, as shown in Example 15-106, and confirm that it is not an ASBR, when it should be if it is generating a default route. + +Example 15-106 Verifying OSPFv3 Parameters on R2 + +R2#show ospfv3 ipv6 +OSPFv3 10 address-family ipv6 +Router ID 22.22.22.22 +Supports NSSA (compatible with RFC 3101) +Event-log enabled, Maximum number of events: 1000, Mode: cyclic +It is an area border router +Router is not originating router-LSAs with maximum metric +Initial SPF schedule delay 5000 msecs +Minimum hold time between two consecutive SPFs 10000 msecs + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 667 + +Maximum wait time between two consecutive SPFs 10000 msecs +Minimum LSA interval 5 secs +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +Interface flood pacing timer 33 msecs +Retransmission pacing timer 66 msecs +Retransmission limit dc 24 non-dc 24 +Number of external LSA 0. Checksum Sum 0x000000 +Number of areas in this router is 2. 1 normal 1 stub 0 nssa +Graceful restart helper support enabled +Reference bandwidth unit is 100 mbps +RFC1583 compatibility enabled +Area BACKBONE(0) +Number of interfaces in this area is 1 +SPF algorithm executed 14 times +Number of LSA 11. Checksum Sum 0x04EDE6 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 +Area 23 +Number of interfaces in this area is 1 +It is a stub area +Generates stub default route with cost 1 +SPF algorithm executed 11 times +Number of LSA 12. Checksum Sum 0x06610D +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 + +Next you issue the command show run | section router ospfv3. The output in Example 15-107 confirms that the default-information originate command is missing from IPv6 AF configuration mode. It is only configured under IPv4 AF configuration mode. + +Example 15-107 Verifying OSPFv3 Configuration on R2 + +R2#show run | section router ospfv3 +router ospfv3 10 +area 23 stub +! +address-family ipv4 unicast +passive-interface default +no passive-interface GigabitEthernet0/0 +no passive-interface GigabitEthernet1/0 +default-information originate +router-id 2.2.2.2 + + + +From the Library of Outcast Outcast +668 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +exit-address-family +! +address-family ipv6 unicast +passive-interface default +no passive-interface GigabitEthernet0/0 +no passive-interface GigabitEthernet1/0 +router-id 22.22.22.22 +exit-address-family + +You add the default-information originate command to IPv6 AF configuration mode and reissue the extended IPv6 ping on Branch, as shown in Example 15-108. The ping is suc-cessful. + +Example 15-108 Successful Ping to IPv6 Internet Resources + +Branch#ping +Protocol [ip]: ipv6 +Target IPv6 address: 2001:db8:f::f +Repeat count [5]: +Datagram size [100]: +Timeout in seconds [2]: +Extended commands? [no]: yes +Source address or interface: 2001:db8:0:4::4 +UDP protocol? [no]: +Verbose? [no]: +Precedence [0]: +DSCP [0]: +Include hop by hop option? [no]: +Include destination option? [no]: +Sweep range of sizes? [no]: +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:F::F, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 88/113/148 ms + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 669 + + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 15-6 lists a reference of these key topics and the page numbers on which each is found. + +Table 15-6 Key Topics for Chapter 15 +Key +Topic Key Topic Element Description Page Number + + +Example 15-1 + +List + +Table 15-2 + +Example 15-2 + +Example 15-4 + +Section + +Example 15-9 + +Paragraph + +Example 15-13 + +Example 15-14 + +Section + +Table 15-3 + +List + +List + +Section + +Verifying OSPF Neighbors with show ip ospf 591 neighbor +Identifies the reasons why an OSPF neighbor 591 relationship might not form +Describes adjacency states 592 + +Verifying OSPF interfaces with show ip ospf 593 interface +Displaying OSPF interface timers on R1 Gigabit 595 Ethernet 1/0 +Discusses how to identify mismatched OSPFv2 area 596 numbers +Determining the type of OSPF Areas 597 + +Discusses the passive interface feature and how to 599 troubleshoot passive interface issues +Verifying OSPF area authentication 600 + +Verifying OSPF authentication key 600 + +MTU mismatch 602 + +OSPF network types and characteristics 604 + +Identifies the reasons why an OSPF route might be 606 missing from either the LSDB or the routing table +Outlines what needs to be considered when 611 troubleshooting route filtering +Stub area configurations 613 + + + + + + +From the Library of Outcast Outcast +670 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Key Topic Element Paragraph + +Table 15-4 + +List + +Example 15-42 + +Example 15-70 + +Example 15-71 + +Paragraph + + +Paragraph + + +Example 15-95 + +Example 15-97 + +Example 15-98 + +Example 15-99 + +Description +Describes the importance of the DR election in a hub-and-spoke multiaccess network +OSPFv2 LSAs + +Outlines what needs to be considered when troubleshooting route summarization issues +Verifying the Virtual Link + +Identifying what can be verified for OSPFv3 with show ipv6 protocols +Identifying what can be verified with show ipv6 ospf +Discusses what can be verified during the troubleshooting process with the show ipv6 ospf interface brief command +Describes what can be verified during the troubleshooting process with the show ipv6 ospf interface command +Sample OSPFv3 configuration with AFs + +Using show ospfv3 to verify general OSPFv3 parameters for AFs +Using show ospfv3 interface brief to verify OSPFv3 interfaces +Using show ospfv3 interface to verify details of OSPFv3 interfaces + +Page Number 615 + +621 + +622 + +626 + +641 + +642 + +642 + + +643 + + +655 + +657 + +659 + +659 + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +OSPF interface table, OSPF neighbor table, OSPF link-state database, link-state advertisement (LSA), Dijkstra shortest path first (SPF) algorithm, OSPF area, virtual link, OSPF Area Border Router (ABR), OSPF Autonomous System Boundary Router (ASBR), OSPFv3, address families, designated router, backup designated router, stub area, totally stubby area, NSSA, totally NSSA + +Complete Tables and Lists from Memory + +Print a copy of Appendix C, “Memory Tables,” (found on the disc), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Tables Answer Key,” also on the disc, includes completed tables and lists to check your work. + + + +From the Library of Outcast Outcast +Chapter 15: Troubleshooting OSPF 671 + +Command Reference to Check Your Memory + +This section includes the most important show and debug commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 15-7 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot the different issues outlined in this chapter. + +Table 15-7 show and debug commands + +Task Command Syntax + +Displays the IPv4 routing protocols enabled on the device. For OSPFv2, it displays whether any route filters are applied, the RID, the number of areas the router is participating in, the types of areas, the maximum paths for load balancing, the network area command, the interfaces explicitly participating in the routing process, passive interfaces, routing information sources, and the AD. +Displays the IPv6 dynamic routing protocols enabled on the device. For OSPFv3, it displays the PID, the RID, the number of areas, the type of areas, the interfaces participating in the routing process, and redistribution information. +Displays general OSPF parameters, including the PID, the RID, the reference bandwidth, the areas configured on the router, the types of areas (stub, totally stubby, NSSA, and totally NSSA), and area authentication. +Displays the interfaces that are participating in the OSPF process. +Displays detailed information about the interfaces participating in the OSPF process including interface IPv4 address and mask, area ID, PID, RID, network type, cost, DR/BDR, priority, and timers. +Displays the OSPF devices that have formed a neighbor adjacency with the local router. +Displays the OSPF routes that have been installed in the IPv4/IPv6 routing table. + +show ip protocols + + + + + + + +show ipv6 protocols + + + + +show {ip | ipv6} ospf + + + +show {ip | ipv6} ospf interface brief +show {ip | ipv6} ospf interface + + + +show {ip | ipv6} ospf neighbor + +show {ip | ipv6} route {ospf | ospfv3} + + + + + + + +From the Library of Outcast Outcast +672 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Displays general OSPFv3 parameters for IPv4 and IPv6 address families, including the PID, the RID, the +reference bandwidth, the areas configured on the router, the types of areas (stub, totally stubby, NSSA, and totally NSSA), and area authentication. +Displays the interfaces that are participating in the OSPFv3 process and the AF they are participating in. +Displays detailed information about the interfaces participating in the OSPFv3 address families including interface IPv4 and IPv6 addresses, area ID, PID, RID, network type, cost, DR/BDR, priority, and timers. +Displays the OSPFv3 neighbor adjacencies that have been formed for each AF. +Displays the OSPF link-state database. + +Displays the OSPFv3 link-state database. + +Provides information about the status of OSPF virtual links that are required for areas not physically adjacent to the backbone area (that is, area 0). +Displays real-time information related to the exchange of OSPF hello packets. Useful for identifying mismatched OSPF timers and mismatched OSPF area types. +Displays the transmission and reception of OSPF packets in real time. + +Displays real-time updates about the formation of an OSPF adjacency. Useful for identifying mismatched area IDs and authentication information. + +Command Syntax show ospfv3 + + + + +show ospfv3 interface brief + +show ospfv3 interface + + + +show ospfv3 neighbor + +show {ip | ipv6} ospf database + +show ospfv3 database + +show {ip | ipv6} ospf virtual-links + + +debug {ip | ipv6} ospf hello + +debug ospfv3 {ip | ipv6} hello + + +debug {ip | ipv6} ospf packet + +debug ospfv3 {ip | ipv6} packet + +debug {ip | ipv6} ospf adj + +debug ospfv3 {ip | ipv6} adj + + + +This command shows real-time information about OSPF events, including the transmission and reception of hello messages and LSAs. This command might be useful +on a router that appears to be ignoring hello messages received from a neighboring router. + + +debug {ip | ipv6} ospf events + +debug ospfv3 {ip | ipv6} events + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting Route Maps: This section explains how to read route maps and how they operate so that you can determine whether they are or are not the issue while troubleshooting other features that have them applied. + +■ Troubleshooting Policy-Based Routing: In this section, you learn the different reasons that could cause PBR not to operate as expected. You will also learn the commands that are needed to successfully troubleshoot issues related to PBR. + +■ Policy-Based Routing Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 16 + + + + +Troubleshooting Route Maps and Policy-Based Routing + + +There are many different uses for route maps. So much so that when I hear the word route map, I think of duct tape. That’s right; I said it, duct tape! Just like duct tape, route maps can fix anything. Therefore, when you need to fix routing problems by using policy-based routing (PBR), or manipulate the attributes of individual routes as they are being redistrib-uted or learned via Border Gateway Protocol (BGP), you will use route maps. + +This chapter begins by examining route maps. It gives you the opportunity to review how route maps are read and the commands that you can use to verify a route map’s configuration. The rest of the chapter is dedicated to PBR, which allows you to override the router’s default routing behavior. Because PBR relies on route maps, it makes sense to cover PBR at this point. Therefore, you will discover what could cause PBR not to behave as expected and how you can troubleshoot it. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 16-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 16-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting Route Maps + +Troubleshooting Policy-Based Routing + +Questions +1–2 + +3–7 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + + + + +From the Library of Outcast Outcast +676 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +1. What is the correct order of processing for a route map? + +a. Top-down processing, implicit deny all at the end, immediate execution upon a match + +b. Top-down processing, immediate execution upon a match, implicit deny all at the end + +c. Immediate execution upon a match, implicit deny all at the end, top-down pro-cessing + +d. Immediate execution upon a match, top-down processing, implicit deny all at the end + +2. What will happen if none of the sequences match in a route map that is applied to redistribution? + +a. The route will not be redistributed. + +b. The route will be redistributed with default values. + +c. The route will be redistributed based on the last permit sequence. + +d. The route will be redistributed based on the values in the redistribute com-mand. + +3. What command enables you to verify the interfaces that have a PBR route map applied to them? + +a. show ip route + +b. show ip policy + +c. show route-map + +d. show ip local policy + +4. What command enables you to verify the number of packets that have been policy-based routed? + +a. show ip route + +b. show ip policy + +c. show route-map + +d. show ip local policy + +5. What command enables you to verify which PBR route map has been applied to locally generated packets? + +a. show ip route + +b. show ip policy + +c. show route-map + +d. show ip local policy + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 677 + +6. What will happen to packets that match a deny sequence in a route map that is used for PBR? + +a. The packets will be routed normally. + +b. The packets will be policy-based routed. + +c. The packets will be dropped. + +d. The packets will be routed upon approval by the admin. + +7. Which Cisco IOS command enables you to verify that PBR is sending packets on the desired path? + +a. traceroute + +b. show ip route + +c. show route-map + +d. show ip policy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +678 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting Route Maps + +Route maps are used with other services and features to provide a more granular level of control that was not available with the services or features by default. For example, when you redistribute routes from one routing protocol to another, all routes are redistributed and treated the same way. However, by attaching a route map to the redistribution pro-cess, you can treat each route or a group of routes differently when they are redistribut-ed. In addition, route maps are heavily utilized with BGP for path manipulation, and they are the driving force behind PBR. + +Therefore, when troubleshooting a service or feature that has a route map attached to it, you need to be able to troubleshoot the route map so that you can determine whether it is the cause of the issue. In this section, you learn how to read route maps. + +How to Read a Route Map + +A route map is identified by a name. Within the route map, there can be one or more sequences, which are defined by a number. Within each sequence, you can find match clauses and set clauses. Example 16-1 displays the output of show run | section route-map. It is a sample route map called TSHOOT_ROUTE_MAP. This route map is for illustrative purposes so that you can see the various options that a route map has to offer. You would not want to copy this route map for the real world because we have combined multiple features into one route map to give you various examples we will walk through. Example 16-2 displays the same route map but using the show route-map [map_name] command. + +Example 16-1 Sample Route Map + +R1#show run | section route-map +route-map TSHOOT_ROUTE_MAP permit 10 +match ip address 10 11 +set metric 500 +route-map TSHOOT_ROUTE_MAP permit 20 +match ip address prefix-list OSPF_ROUTE +set metric-type type-1 +route-map TSHOOT_ROUTE_MAP permit 25 +match interface FastEthernet3/0 +set ip next-hop 10.1.12.2 +route-map TSHOOT_ROUTE_MAP deny 30 +match tag 88 +route-map TSHOOT_ROUTE_MAP permit 100 +set local-preference 150 + + + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 679 + +Example 16-2 Output of show route-map TSHOOT_ROUTE_MAP + +R1#show route-map TSHOOT_ROUTE_MAP +route-map TSHOOT_ROUTE_MAP, permit, sequence 10 +Match clauses: +ip address (access-lists): 10 11 +Set clauses: +metric 500 +Policy routing matches: 0 packets, 0 bytes +route-map TSHOOT_ROUTE_MAP, permit, sequence 20 +Match clauses: +ip address prefix-lists: OSPF_ROUTE +Set clauses: +metric-type type-1 +Policy routing matches: 0 packets, 0 bytes +route-map TSHOOT_ROUTE_MAP, permit, sequence 25 +Match clauses: +interface FastEthernet3/0 +Set clauses: +ip next-hop 10.1.12.2 +Policy routing matches: 0 packets, 0 bytes +route-map TSHOOT_ROUTE_MAP, deny, sequence 30 +Match clauses: +tag 88 +Set clauses: +Policy routing matches: 0 packets, 0 bytes +route-map TSHOOT_ROUTE_MAP, permit, sequence 100 +Match clauses: +Set clauses: +local-preference 150 +Policy routing matches: 0 packets, 0 bytes + + + +Key Topic + + + + + + + +Key Topic + +Notice how a sequence can be permit or deny. In this case, sequence 10, 20, 25, and 100 are all permit sequences, and 30 is a deny sequence. This is usually the culprit of many troubleshooting issues that involve route maps. Admins sometimes forget to type deny and as a result the sequence defaults to permit. In addition, depending on what the route map is being used for will determine what permit or deny truly means. For redistribu-tion, permit means redistribute the route, and deny means do not redistribute the route. For PBR, permit means policy-base route the packet, and deny means route the packet normally using the routing table. + +Review sequence 10. It is a permit statement that has a single match clause that matches IP address 10 and 11. What this truly means is match the IP addresses within access con-trol list (ACL) 10 or ACL 11. When you see multiple match criteria within a single match clause, it means OR; therefore, ACL 10 OR 11. The traffic in question does not have to match both ACL 10 and 11, just 10 or 11. If the traffic in question matches sequence 10, +the metric of the traffic in question will have its metric set to 500. Metrics are usually + + + + + +From the Library of Outcast Outcast +680 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +manipulated during the redistribution process; therefore, sequence 10 is an example of a route map entry that you might use during redistribution. + +Review sequence 20. It is a permit statement that has a single match clause, which match-es a prefix list called OSPF_ROUTE. If the traffic in question matches the prefix list used in sequence 20, the metric type of the traffic in question will be changed to E1. Changing the metric type is something you can do when redistributing routes into Open Shortest Path First (OSPF). Therefore, sequence 20 is an example of a route map entry that you might use when redistributing routes into OSPF so that you can manipulate the metric type. + +Review sequence 25. It is a permit statement that has a single match clause, which is matching all packets that arrive inbound on interface Fast Ethernet 3/0. Those packets that arrive in Fa3/0 will be forwarded out the interface that reaches the next-hop IP address of 10.1.12.2. This is an example of a route map entry that you would use with PBR to manually control how packets will be forwarded. + +Review sequence 30. It is a deny statement with a single match clause. The match clause is matching routes with a tag of 88. When this type of route map is applied to redistri-bution, all routes that have a route tag of 88 will not be redistributed because a deny sequence means do not redistribute. + +Review sequence 100. This is an example of a route map that can be applied to BGP for attribute manipulation. Notice that there is no match clause. When the match clause is missing in a sequence, it means match all. Therefore, all routes in question would match sequence 100 because the match clause is missing. The set clause states that the local preference, which is a BGP attribute, will be changed to 150. + +The logic of a route map is very similar to an ACL. The following steps outline the logic of a route map: + +1. Key +Topic + +2. + + + + + + + + + +3. + + +Top-down processing: A route map is processed in order of sequence, starting with the lowest sequence in the route map to the highest sequence. In Examples 16-1 and 16-2, sequence 10 is processed first followed by 20, 25, 30, and then 100. + +Immediate execution upon a match: During processing, a match clause in a sequence is evaluated. If the match clause matches the traffic in question, the pro-cessing stops and the actions defined in the set clauses in the sequence are executed in the order they are configured. If no match is found, the next sequence is checked. Note: If multiple match criteria are specified in the same match clause in a sequence, a logical OR algorithm is applied, which means that any of the match criteria can match for it to be considered a match. If multiple match criteria are specified in dif-ferent match clauses in the same sequence, a logical AND algorithm is applied, which means that all of the match criteria must match for it to be considered a match. + +Implicit deny all: If no sequence matches the traffic in question, the traffic is treated as though it matched a deny sequence, and is processed accordingly because there is an implicit deny all sequence at the end of every route map, just like ACLs and pre- +fix lists. + + + + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 681 + +Troubleshooting Policy-Based Routing + +With PBR, you can create user-defined policies that manipulate how traffic will be rout-ed through the network. By default, traffic is routed based on the destination IP address of a packet. However, with PBR you can override this behavior and have traffic routed based on different parameters matched in an ACL, or an inbound interface, for example. As a result, you can route based on source IP address or a destination port number, to name a few. + +In this section, you learn the commands needed to troubleshoot issues related to PBR. + + +PBR + +The driving force of PBR is route maps. Therefore, if you are not able to read route maps and understand what they are doing, you cannot troubleshoot PBR. Review Example 16-3, which shows a sample PBR configuration based on Figure 16-1. Although it is a small example, notice that multiple configurations are involved with PBR that you will have +to review when troubleshooting (in this case, an ACL, a route map with match and set clauses, and the interface PBR is applied to). + +Example 16-3 Sample PBR configuration + +Branch# +access-list 100 permit ip 10.1.4.0 0.0.0.255 10.1.1.0 0.0.0.255 +! +route-map PBR_EXAMPLE permit 10 +match ip address 100 +set ip next-hop 10.1.14.1 +! +interface GigabitEthernet0/0 +ip policy route-map PBR_EXAMPLE + + +192.0.2.1 Internet + + + +10.1.1.0/24 +Gi1/0 + +203.0.113.0/29 +Gi2/0 10.1.3.0/24 Gi0/0 Gi1/0 Gi1/0 + + + +Gi0/0 R1 +Fa3/0 + +10.1.12.0/24 R2 10.1.23.0/24 R3 Gi0/0 Gi4/0 + + +WAN +10.1.14.0/24 10.1.24.0/24 + + +Fa1/0 Gi3/0 + +10.1.4.0/24 Gi0/0 BRANCH + +Figure 16-1 PBR Example Topology + + +From the Library of Outcast Outcast +682 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +When troubleshooting PBR, consider the following: + + +Key ■ Topic + + + + + + +■ + + + + + + +■ + + + + + + + + + + + + +■ + + + + + + + + + +■ + +How the policy has been applied: PBR is only applied to inbound packets on an interface or locally generated packets by the router. Therefore, you must ensure that you applied the correct PBR route map to the correct interface or the local router. You can use the show ip policy command to verify which interfaces are enabled for PBR and which route map has been applied, as shown in Example 16-4. You can use the show ip local policy command to display the route map that has been applied for local policy routing (traffic generated by the router). +How the route map is ordered: Remember that route maps are processed from low-est sequence number to highest sequence number, and once a match is found within a sequence, the processing stops and the actions within that sequence are executed. Therefore, the order of the route map is important for proper execution. Use the show route-map command to verify the order of sequences within the route map, as shown in Example 16-5. +What permit and deny means: When a PBR route map sequence is permit, it means to policy-base route the packet according to the action defined in the set clause. When a PBR route map sequence is deny, it means do not policy-base route the packet; therefore, route the packet normally. If you fail to specify permit or deny when creating the sequence, it defaults to permit. If by accident you specify permit or deny when you needed the opposite, you will have an issue because the desired results will not be achieved. Also, always remember that there is an implicit deny sequence at the end of a route map. Therefore, if the traffic in question does not match any of the explicit sequences within the route map, it ends up matching the implicit deny sequence. The implicit deny sequence within a route map for PBR means to route the traffic normally. Use the show route-map command to verify the permit and deny sequences within the route map, as shown in Example 16-5. + +What traffic is being matched: There are different methods of matching traffic for PBR within a route map. You can match ACLs, prefix lists, and inbound interfaces, to name a few. Based on the match clause, which you can verify with the show route-map command, as shown in Example 16-5, you need to verify whether the match criteria is correct using other show commands. For example, if the match clause is matching an IP ACL, you need to use the show ip access-list command to verify that the ACL is correct. If the match clause is matching an IP prefix list, you need to use the show ip prefix-list command to verify the prefix list is correct. Remember, if there is no match clause in the sequence, it means match all. + +What action will be performed: Once traffic matches a certain sequence, the action defined in the set clause is executed. When troubleshooting PBR, use the show route-map command, as shown in Example 16-5, to verify that the correct set clause +has been configured. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 683 + +Key Example 16-4 Example of the show ip policy Command Topic Branch#show ip policy + +Interface +Gi0/0 + +Route map +PBR_EXAMPLE + + + +Example 16-5 Example of the show route-map Command Key +Topic Branch#show route-map +route-map PBR_EXAMPLE, permit, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip next-hop 10.1.14.1 +Policy routing matches: 30 packets, 3420 bytes + +When troubleshooting PBR, you will want to test the path that traffic is taking. You can accomplish this using a traceroute, as shown in Example 16-6. (On a PC, use tracert, and on a Cisco IOS device, use the traceroute command.) In this example, the packets destined to 10.1.1.1 are being policy-based routed to the next hop 10.1.14.1 even though the routing table entry states to use 10.1.24.2. All other packets are using 10.1.24.2 as the next hop because they are not being policy-based routed, as shown by the traceroute +to 192.0.2.1. To verify that packets are being policy-based routed, use the show route-map command, as shown in Example 16-7. The output shows that 36 packets have been policy-based routed. + +Example 16-6 Example Traceroute to Verify the PBR Path +Key +Topic C:\>tracert 10.1.1.1 +Tracing route to 10.1.1.1 over a maximum of 30 hops + + +1 6 ms 1 ms +2 6 ms 1 ms + +2 ms 10.1.4.4 +2 ms 10.1.14.1 + +Trace complete. + +Branch#show ip route 10.1.1.1 +Routing entry for 10.1.1.0/24 +...output omitted... +Routing Descriptor Blocks: +* 10.1.24.2, from 10.1.24.2, 00:14:36 ago, via GigabitEthernet3/0 +Route metric is 20480, traffic share count is 1 +...output omitted... + +C:\>tracert 192.0.2.1 +Tracing route to 192.0.2.1 over a maximum of 30 hops + +1 6 ms 1 ms 2 ms 10.1.4.4 + + + + +From the Library of Outcast Outcast +684 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +2 6 ms 1 ms 2 ms 10.1.24.2 +...output omitted... +Trace complete. + + +Example 16-7 Using show route-map to Verify PBR Statistics Key +Topic Branch#show route-map +route-map PBR_EXAMPLE, permit, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip next-hop 10.1.14.1 +Policy routing matches: 36 packets, 3780 bytes + + + +Key Topic + +To see policy routing in real time, use the debug ip policy command, as shown in Example 16-8. In this example, the traffic sourced from 10.1.4.1 arriving inbound on Gig0/0 and destined to 10.1.1.1 has been policy matched to route map PBR_EXAMPLE sequence 10. Because it is a permit sequence, the packet is being policy-based routed +from Gig0/0 to Fa1/0 with a next-hop address of 10.1.14.1. + + +Example 16-8 Using debug ip policy to view PBR in Real Time + +Branch#debug ip policy +Policy routing debugging is on +Branch# +IP: s=10.1.4.1 (GigabitEthernet0/0), d=10.1.1.1, len 28, policy match +IP: route map PBR_EXAMPLE, item 10, permit +IP: s=10.1.4.1 (GigabitEthernet0/0), d=10.1.1.1 (FastEthernet1/0), len 28, policy routed +IP: GigabitEthernet0/0 to FastEthernet1/0 10.1.14.1 + + +Policy-Based Routing Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 16-2. + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 685 + + +192.0.2.1 Internet + + + +10.1.1.0/24 +Gi1/0 + +203.0.113.0/29 +Gi2/0 10.1.3.0/24 Gi0/0 Gi1/0 Gi1/0 + + + +Gi0/0 R1 +Fa3/0 + +10.1.12.0/24 R2 10.1.23.0/24 R3 Gi0/0 Gi4/0 + + +10.1.14.0/24 WAN 10.1.24.0/24 + + +Fa1/0 Gi3/0 + +10.1.4.0/24 Gi0/0 BRANCH + +Figure 16-2 PBR Trouble Tickets Topology + + +Trouble Ticket 16-1 + +Problem: Traffic from 10.1.4.0/24 to 10.1.1.0/24 is routed though R2 using Gi3/0 when it should be routed directly to R1 using Fa1/0. + +You begin troubleshooting by verifying the problem with a trace from a PC in 10.1.4.0/24 with a destination of 10.1.1.1. As shown in Example 16-9, the path to R2 is taken based on the hop 10.1.24.2. + +Example 16-9 Verifying the Problem with a Trace to 10.1.1.1 + +C:\>tracert 10.1.1.1 +Tracing route to 10.1.1.1 over a maximum of 30 hops + + +1 6 ms 1 ms +2 8 ms 3 ms +3 12 ms 5 ms + +2 ms 10.1.4.4 +4 ms 10.1.24.2 +8 ms 10.1.12.1 + +Trace complete. + +You access Branch and issue the show ip route command. As shown in Example 16-10, the 10.1.1.0/24 network is reachable via a next hop of 10.1.24.2. However, as shown in Example 16-11, the Enhanced Interior Gateway Protocol (EIGRP) topology table indi-cates that there is another path that can be used via 10.1.14.1. It is not being used by EIGRP because it does not have the best feasible distance (metric). Therefore, you have confirmed that both paths exist and EIGRP is making the best decision. To force the traf-fic from 10.1.4.0 to 10.1.1.0 to use the Fast Ethernet link, PBR is being used. Therefore, you shift your attention to the PBR configuration. + + + + + + +From the Library of Outcast Outcast +686 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 16-10 Verifying Routing Table Entries + +Branch#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 10.1.24.2 to network 0.0.0.0 + +D*EX 0.0.0.0/0 [170/15360] via 10.1.24.2, 01:10:05, GigabitEthernet3/0 +10.0.0.0/8 is variably subnetted, 10 subnets, 2 masks +D 10.1.1.0/24 [90/20480] via 10.1.24.2, 01:10:05, GigabitEthernet3/0 +D 10.1.3.0/24 [90/20480] via 10.1.24.2, 01:10:05, GigabitEthernet3/0 +C 10.1.4.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.4.4/32 is directly connected, GigabitEthernet0/0 +D 10.1.12.0/24 [90/15360] via 10.1.24.2, 01:10:05, GigabitEthernet3/0 +C 10.1.14.0/24 is directly connected, FastEthernet1/0 +L 10.1.14.4/32 is directly connected, FastEthernet1/0 +D 10.1.23.0/24 [90/15360] via 10.1.24.2, 01:10:05, GigabitEthernet3/0 +C 10.1.24.0/24 is directly connected, GigabitEthernet3/0 +L 10.1.24.4/32 is directly connected, GigabitEthernet3/0 +192.0.2.0/32 is subnetted, 1 subnets +D EX 192.0.2.1 [170/573440] via 10.1.24.2, 00:00:06, GigabitEthernet3/0 +203.0.113.0/29 is subnetted, 1 subnets +D 203.0.113.0 [90/15360] via 10.1.24.2, 01:10:05, GigabitEthernet3/0 + + +Example 16-11 Verifying All EIGRP Routes + +Branch#show ip eigrp topology +EIGRP-IPv4 VR(TSHOOT) Topology Table for AS(100)/ID(10.1.24.4) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.12.0/24, 1 successors, FD is 1966080 +via 10.1.24.2 (1966080/1310720), GigabitEthernet3/0 +via 10.1.14.1 (13762560/1310720), FastEthernet1/0 +P 10.1.14.0/24, 1 successors, FD is 13107200 +via Connected, FastEthernet1/0 +P 10.1.3.0/24, 1 successors, FD is 2621440 +via 10.1.24.2 (2621440/1966080), GigabitEthernet3/0 +P 10.1.23.0/24, 1 successors, FD is 1966080 +via 10.1.24.2 (1966080/1310720), GigabitEthernet3/0 + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 687 + +P 203.0.113.0/29, 1 successors, FD is 1966080 +via 10.1.24.2 (1966080/1310720), GigabitEthernet3/0 +P 10.1.4.0/24, 1 successors, FD is 1310720 +via Connected, GigabitEthernet0/0 +P 10.1.24.0/24, 1 successors, FD is 1310720 +via Connected, GigabitEthernet3/0 +P 0.0.0.0/0, 1 successors, FD is 1966080 +via 10.1.24.2 (1966080/1310720), GigabitEthernet3/0 +P 192.0.2.1/32, 1 successors, FD is 73400320, U +via 10.1.24.2 (73400320/72744960), GigabitEthernet3/0 +via 10.1.14.1 (78643200/72089600), FastEthernet1/0 +P 10.1.1.0/24, 1 successors, FD is 2621440 +via 10.1.24.2 (2621440/1966080), GigabitEthernet3/0 +via 10.1.14.1 (13762560/1310720), FastEthernet1/0 + +Because PBR is applied to ingress traffic, you start verifying that Gig0/0 on Branch has a PBR route map attached by using the show ip policy command. As shown in Example 16-12, the route map named PBR_EXAMPLE has been applied. + +Example 16-12 Verifying a PBR Route Map Is Applied to the Correct Interface + +Branch#show ip policy + +Interface +Gi0/0 + +Route map +PBR_EXAMPLE + + +Next you issue the show route-map command to verify the route map, as shown in Example 16-13. There is only a single sequence, and it is a permit sequence that states any traffic matching the addresses in ACL 100 will be policy routed to a next-hop address of 10.1.14.1 if and only if there is no specific route in the routing table. Read that sentence again. Why is it if and only if there is no specific route in the routing table? This is because the ip default next-hop command was used. When this command is used, PBR examines the routing table, and if there is a specific route in the routing table, it is used. If there is no specific route in the routing table, the packet will be policy-based routed. + +Example 16-13 Verifying Route Map Configuration + +Branch#show route-map +route-map PBR_EXAMPLE, permit, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip default next-hop 10.1.14.1 +Policy routing matches: 0 packets, 0 bytes + +Based on Example 16-10, there is a specific route in the routing table to reach 10.1.1.0/24. Therefore, the packets will not be policy-based routed. To solve this problem, you need + + + + + +From the Library of Outcast Outcast +688 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +to change the ip default next-hop command to ip next-hop. Example 16-14 provides the configuration needed to solve this issue. + +Example 16-14 Modifying Route Map Configuration + +Branch#config t +Enter configuration commands, one per line. End with CNTL/Z. +Branch(config)#route-map PBR_EXAMPLE permit 10 +Branch(config-route-map)#no set ip default next-hop 10.1.14.1 +Branch(config-route-map)#set ip next-hop 10.1.14.1 +Branch(config-route-map)#end + +After the configuration has been modified, you verify the changes with the show route-map command, as shown in Example 16-15. Now it states ip next-hop 10.1.14.1. + +Example 16-15 Verifying the New Route Map Configuration + +Branch#show route-map +route-map PBR_EXAMPLE, permit, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip next-hop 10.1.14.1 +Policy routing matches: 0 packets, 0 bytes + +You issue the same trace from the client PC that you did at the start, and the trace con-firms that packets are going across the Fast Ethernet link because of the hop with the IP 10.1.14.1, as shown in Example 16-16. To further confirm, you issue the command show route-map again on Branch, as shown in Example 16-17, and notice that packets have been successfully policy-based routed. Issue solved! + +Example 16-16 Confirming Packets Are Taking the Correct Path + +C:\>tracert 10.1.1.1 +Tracing route to 10.1.1.1 over a maximum of 30 hops + + +1 6 ms 1 ms +2 8 ms 3 ms + +2 ms 10.1.4.4 +4 ms 10.1.14.1 + +Trace complete. + + +Example 16-17 Verifying Policy Matches + +Branch#show route-map +route-map PBR_EXAMPLE, permit, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip next-hop 10.1.14.1 +Policy routing matches: 6 packets, 360 bytes + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 689 + +Trouble Ticket 16-2 + +Problem: Traffic from 10.1.4.0/24 to 10.1.1.0/24 is routed though R2 using Gi3/0 when it should be routed directly to R1 using Fa1/0. + +You begin troubleshooting by verifying the problem with a trace from a PC in 10.1.4.0/24 (Branch) with a destination of 10.1.1.1. As shown in Example 16-18, the path to R2 is used based on the hop 10.1.24.2. + +Example 16-18 Verifying the Problem with a Trace to 10.1.1.1 + +C:\>tracert 10.1.1.1 +Tracing route to 10.1.1.1 over a maximum of 30 hops + + +1 6 ms 1 ms +2 8 ms 3 ms +3 12 ms 5 ms + +2 ms 10.1.4.4 +4 ms 10.1.24.2 +8 ms 10.1.12.1 + +Trace complete. + +Because the traffic is supposed to be policy-based routed, you access Branch and issue the debug ip policy command. You then perform the traceroute on the client again and observe the output of the debug commands on Branch. As shown in Example 16-19, there is a policy match for the deny sequence of 10 in the PBR_EXAMPLE route map. The debug then states that the policy is rejected, and the packet is routed based on the routing table. + +So, even though there is a match, the packet is being routed normally. This is because it is a deny sequence that is matched. A deny sequence means do not policy-base route, route normally instead. + +Example 16-19 Observing debug ip policy output + +Branch#debug ip policy +Policy routing debugging is on +Branch# +IP: s=10.1.4.1 (GigabitEthernet0/0), d=10.1.1.1, len 28, policy match +IP: route map PBR_EXAMPLE, item 10, deny +IP: s=10.1.4.1 (GigabitEthernet0/0), d=10.1.1.1, len 28, policy rejected -- normal forwarding +Branch# + +Next you issue the show route-map command to verify the route map, as shown in Example 16-20. There is only a single sequence, and it is a deny sequence that states any traffic matching the addresses in ACL 100 will be routed normally regardless of any set clauses because it is a deny sequence. + + + + + + + + +From the Library of Outcast Outcast +690 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 16-20 Verifying Route Map Configuration + +Branch#show route-map +route-map PBR_EXAMPLE, deny, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip next-hop 10.1.14.1 +Nexthop tracking current: 0.0.0.0 +10.1.14.1, fib_nh:0,oce:0,status:0 + +Policy routing matches: 0 packets, 0 bytes + +To solve this problem, you need to change sequence 10 so that it is permit instead of deny. Example 16-21 displays the configuration needed to solve this issue. + +Example 16-21 Modifying Route Map Configuration + +Branch#config t +Enter configuration commands, one per line. End with CNTL/Z. +Branch(config)#route-map PBR_EXAMPLE permit 10 +Branch(config-route-map)#end + +After modifying the configuration, you verify the changes with the show route-map command, as shown in Example 16-22. Now sequence 10 is a permit sequence. + +Example 16-22 Verifying the New Route Map Configuration + +Branch#show route-map +route-map PBR_EXAMPLE, permit, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip next-hop 10.1.14.1 +Policy routing matches: 0 packets, 0 bytes + +You issue the same trace from the client PC that you did at the start, and the trace con-firms that packets are going across the Fast Ethernet link because of the hop with the IP 10.1.14.1, as shown in Example 16-23. To further confirm, you observe the debug commands on Branch, as shown in Example 16-24, and it states that the traffic is being policy-based routed. Issue solved! + +Example 16-23 Confirming Packets Are Taking the Correct Path + +C:\>tracert 10.1.1.1 +Tracing route to 10.1.1.1 over a maximum of 30 hops + + +1 6 ms 1 ms +2 8 ms 3 ms + +2 ms 10.1.4.4 +4 ms 10.1.14.1 + +Trace complete. + + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 691 + +Example 16-24 Verifying PBR with debug Commands + +Branch#debug ip policy +IP: s=10.1.4.1 (GigabitEthernet0/0), d=10.1.1.1, len 28, policy match +IP: route map PBR_EXAMPLE, item 10, permit +IP: s=10.1.4.1 (GigabitEthernet0/0), d=10.1.1.1 (FastEthernet1/0), len 28, policy routed +IP: GigabitEthernet0/0 to FastEthernet1/0 10.1.14.1 + + +Trouble Ticket 16-3 + +Problem: Traffic from 10.1.4.0/24 to 10.1.1.0/24 is routed though R2 using Gi3/0 when it should be routed directly to R1 using Fa1/0. + +You begin troubleshooting by verifying the problem with a trace from a PC in 10.1.4.0/24 with a destination of 10.1.1.1. As shown in Example 16-25, the path to R2 is taken based on the hop 10.1.24.2. This traffic should have been policy-based routed to the next hop IP of 10.1.14.1. + +Example 16-25 Verifying the Problem with a Trace to 10.1.1.1 + +C:\>tracert 10.1.1.1 +Tracing route to 10.1.1.1 over a maximum of 30 hops + + +1 6 ms 1 ms +2 8 ms 3 ms +3 12 ms 5 ms + +2 ms 10.1.4.4 +4 ms 10.1.24.2 +8 ms 10.1.12.1 + +Trace complete. + +Because PBR is applied to ingress traffic, you start verifying that Gig0/0 on Branch has a PBR route map attached by using the show ip policy command. As shown in Example 16-26, the route map named PBR_EXAMPLE has been applied to interface Fa0/1. There is no route map applied to Gig0/0 for PBR. However, before you conclude that the route map PBR_EXAMPLE was applied to the wrong interface, make sure that it is the route +map that is needed to accomplish the goal. It would be bad if you removed this route map from Fa1/0 and applied it to Gig0/0 when that is not the true solution to the problem. + +Example 16-26 Verifying That the PBR Route Map Is Applied to the Correct Interface + +Branch#show ip policy + +Interface +Fa1/0 + +Route map +PBR_EXAMPLE + + +Next you issue the show route-map PBR_EXAMPLE command to verify the route map, as shown in Example 16-27. There is only a single sequence, and it is a permit sequence that states any traffic matching the addresses in ACL 100 will be policy-base routed to +a next-hop address of 10.1.14.1. Now it is time to verify ACL 100 with the show access-list 100 command, as shown in Example 16-28. ACL 100 is matching traffic sourced with any address from 10.1.4.0 to 10.1.4.255 and destined to any address from 10.1.1.0 to + + + +From the Library of Outcast Outcast +692 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10.1.1.255. You have verified that this is the correct ACL, and the route map is correct as well. Therefore, the route map has been applied to the wrong interface. + +Example 16-27 Verifying Route Map Configuration + +Branch#show route-map PBR_EXAMPLE +route-map PBR_EXAMPLE, permit, sequence 10 +Match clauses: +ip address (access-lists): 100 +Set clauses: +ip next-hop 10.1.14.1 +Policy routing matches: 0 packets, 0 bytes + +Example 16-28 Verifying ACL 100 Configuration + +Branch#show access-lists 100 +Extended IP access list 100 +10 permit ip 10.1.4.0 0.0.0.255 10.1.1.0 0.0.0.255 + +To solve this problem, you need to remove the ip policy route-map command from Fa1/0 and apply it to interface Gig0/0 instead. Example 16-29 provides the configuration needed to solve this issue. + +Example 16-29 Modifying the ip policy route-map Configuration + +Branch#config t +Enter configuration commands, one per line. End with CNTL/Z. +Branch(config)#int fa1/0 +Branch(config-if)#no ip policy route-map PBR_EXAMPLE +Branch(config-if)#int gig 0/0 +Branch(config-if)#ip policy route-map PBR_EXAMPLE + +After modifying the configuration, you verify the changes with the show ip policy com-mand, as shown in Example 16-30. Now the route map PBR_EXAMPLE is applied to Gig0/0. + +Example 16-30 Verifying That the Route Map Is Applied to the Correct Interface + +Branch#show ip policy + +Interface +Gi0/0 + +Route map +PBR_EXAMPLE + + +You issue the same trace from the client PC that you did at the start, and the trace con-firms that packets are going across the Fast Ethernet link because of the hop with the IP 10.1.14.1, as shown in Example 16-31. Issued solved! + +Example 16-31 Confirming Packets Are Taking the Correct Path C:\>tracert 10.1.1.1 +Tracing route to 10.1.1.1 over a maximum of 30 hops + + +1 6 ms 1 ms +2 8 ms 3 ms + +2 ms 10.1.4.4 +4 ms 10.1.14.1 + +Trace complete. + + +From the Library of Outcast Outcast +Chapter 16: Troubleshooting Route Maps and Policy-Based Routing 693 + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 16-2 lists a reference of these key topics and the page numbers on which each is found. + +Key Table 16-2 Key Topics for Chapter 16 +Topic Key Topic Element Description Page Number + + +Paragraph + +Paragraphs + +Steps + +List + +Example 16-4 + +Example 16-5 + +Example 16-6 + +Example 16-7 + +Paragraph + +Describes the difference between a permit and deny 679 sequence +Examples of how to read route maps 679 + +Identifies the order that route maps are processed 680 and how they are executed +Outlines what you should consider when 682 troubleshooting issues related to PBR +Example of show ip policy command 683 + +Example of show route map command 683 + +Example traceroute to verify PBR path 683 + +Using show route map to verify PBR statistics 684 + +Describes how to verify PBR in real time 684 + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +route map, match, set, implicit deny all, policy-based routing (PBR) + +Command Reference to Check Your Memory + +This section includes the most important show and debug commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + + + + +From the Library of Outcast Outcast +694 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +To test your memory of the commands, cover the right side of Table 16-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot the topics and concepts covered in this chapter. + +Table 16-3 show and debug commands + +Task Command Syntax + +Displays the commands that were used to configure all route maps on the router. +Displays the route maps configured on the router. If you provide the name of the route map, it will only display that specific route map. The output provides all permit and deny sequences, the match clauses, the set clauses, and if used with PBR, it will also display the number of packets that have matched and been policy routed. +Displays the access lists configured on the device. + +Displays the PBR route maps that have been applied to the interfaces. +Displays the PBR route map that has been applied to the locally generated traffic of the device. +Displays in real time the packets that have been policy-based routed. + +show run | section route-map + +show route-map [map_name] + + + + + +show access-list + +show ip policy + +show ip local policy + +debug ip policy + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting IPv4 and IPv6 Redistribution: This section examines the issues that you should look out for when troubleshooting redistribution for IPv4 and IPv6 routing protocols such as RIP, EIGRP, OSPF, and BGP. +■ Redistribution Trouble Tickets: This section pro-vides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. +■ Troubleshooting Advanced Redistribution Issues: This section explains the issues that could arise when you redistribute at multiple points in the net-work. In addition, you will discover how to recog-nize them and solve them. + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 17 + + + + + + +Troubleshooting Redistribution + + +There are many reasons why you might need redistribution. It could be because you are performing a migration from one protocol to another, it might be because there are ser-vices or applications that need a specific routing protocol, it could be because you are in a mixed-vendor environment and only certain protocols are supported on the various devices, and it might even be because of political issues or country specific require- +ments. However, regardless of the reason, when you are using multiple routing protocols, you will more than likely be redistributing between the two so that all networks can be reached by all users in the network. As a result of this, you will more than likely experi-ence some issues that will require you to troubleshoot. + +This chapter explains the differences of redistributing into Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), Routing Information Protocol (RIP), and Border Gateway Protocol (BGP) for both IPv4 and IPv6. You will learn what to look out for so that you can quickly solve any issues related to redistribu-tion. In addition, you will examine what could occur in environments that have multiple points of redistribution and how you can identify the issues and solve them. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 17-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 17-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting IPv4 and IPv6 Redistribution + +Troubleshooting Advanced Redistribution Issues + +Questions +1–9 + +10 + + + + + + + + + +From the Library of Outcast Outcast +698 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. What must be true for a route from one routing source to be redistributed into a dif-ferent routing source? + +a. The routing sources must have a similar metric. + +b. The routing sources must have a similar administrative distance. + +c. The route must be in the routing table on the router performing redistribution. + +d. The route must be a directly connected route on the router performing redistri-bution. + +2. Which of the following routing protocols have a default seed metric of unreachable? (Choose two answers.) + +a. RIP + +b. EIGRP + +c. OSPF + +d. BGP + +3. Which of the following routing protocols have a default seed metric of 20? + +a. RIPng + +b. EIGRP for IPv6 + +c. OSPFv3 + +d. BGP + +4. When redistributing, you have four options for the seed metric: the default value, specifying it with the default-metric command, using the metric option with the redistribute command, and using a route map. If all four of these are configured with different values, which will be preferred? +a. Default values + +b. default-metric command + +c. Metric option with the redistribute command + +d. Route map attached to redistribute command + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 699 + +5. Which option is mandatory when redistributing EIGRP or OSPF routes into RIP? + +a. metric + +b. metric type + +c. subnets + +d. match + +6. Which option is mandatory when redistributing RIP or OSPF routes into EIGRP? + +a. metric + +b. metric type + +c. subnets + +d. match + +7. Which option is mandatory when redistributing classless networks into OSPF? + +a. metric + +b. metric type + +c. subnets + +d. match + +8. Which of the following are not included when redistributing from one IPv6 routing protocol into another IPv6 routing protocol? +a. A prefix + +b. A seed metric + +c. Directly connected routes participating in the routing process + +d. An administrative distance + +9. During redistribution that uses route maps, what will occur to a route that matches a deny entry in the route map? +a. It will be redistributed with default values. + +b. It will be redistributed with the values in the set clause. + +c. It will be redistributed only if there is a routing table entry for it. + +d. It will not be redistributed. + +10. Which of the following are methods that can be used to solve routing issues caused by multi-point redistribution? +a. Modify the seed metrics of the redistributed routes + +b. Modify the administrative distance of redistributed routes + +c. Tag routes as they are redistributed and then deny them from being redistributed back into the originating routing source +d. Modify the metric used to reach the boundary routers + + + +From the Library of Outcast Outcast +700 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Troubleshooting IPv4 and IPv6 Redistribution + +Route redistribution allows routes learned via one source (for example, statically config-ured, locally connected, or learned via a routing protocol) to be injected into a routing protocol. If two routing protocols are mutually redistributed, the routes learned via each routing protocol are injected into the other routing protocol. + +This section explains how to troubleshoot redistribution issues. + + +Route Redistribution Overview + +A router that connects two or more routing domains and will be the point of redistribu-tion is known as a boundary router, as illustrated in Figure 17-1. A boundary router can redistribute static routes, connected routes, and routes learned via one routing protocol into another routing protocol. + + + + +R1 R2 R3 RIP EIGRP + +Boundary Router + +Figure 17-1 Boundary Router + + + +Key Topic + +Redistribution occurs from the routing table into a routing protocols data structure (such as the EIGRP topology table, or the OSPF link-state database [LSDB]), as shown in Figure 17-2. This is a key concept for troubleshooting purposes because if the route is not in the routing table, it cannot be redistributed. Keep in mind that if it is not in the routing table, some other underlying issue needs to be troubleshot to get redistribution to work. +For example, if you are redistributing EIGRP into OSPF and the EIGRP route is not in the routing table, that is not a redistribution problem; it is an EIGRP problem that has to be solved first. + +Different routing protocols use different types of metrics, as illustrated in Figure 17-3. Therefore, when a route is redistributed into a routing protocol, a metric used by the des- +tination routing protocol needs to be associated with the route being redistributed. + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 701 + + + + + + + + +Data Structure of IP Routing Protocol EIGRP + +Data Structure of IP Routing Protocol OSPF + + +Route Installation + + + + + + +Redistributed Routes + + + + +IP Routing Table EIGRP Route + + + +Figure 17-2 Redistribution Occurs from the Routing Table into a Routing Protocols Data Structure + + + + +R1 R2 R3 RIP EIGRP + +Hop Count Bandwidth, Delay + +Figure 17-3 Differing Metrics Between Routing Protocols + +The metric assigned to a route being redistributed into another routing process is called a seed metric. The seed metric is needed to communicate relative levels of reachability between dissimilar routing protocols. A seed metric can be defined in one of three ways: + +Key ■ The default-metric command +Topic ■ The metric parameter in the redistribute command + +■ A route map configuration applied to the redistribute command + +The order of preference if multiple seed metrics are defined with the commands listed previously is 1) metric defined in route map that was applied to redistribute command; 2) metric parameter defined in redistribute command; 3) metric defined in default-metric command. + +If a seed metric is not specified, a default seed metric is used. Keep in mind that RIP and EIGRP have a default seed metric that is considered unreachable. Therefore, if you do not manually configure a seed metric when redistributing routes into RIP or EIGRP, the + + + +From the Library of Outcast Outcast +702 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +redistributed route will not be reachable and therefore not advertised to other routers in the routing domain. OSPF has a default seed metric of 20, unless it is a BGP route being redistributed, which would have a seed metric of 1. When redistributing into BGP, BGP will use the exact metric of the Interior Gateway Protocol (IGP). + + +Note For EIGRP and RIP you do not need to specify a metric when redistributing static or connected routes. In addition, for EIGRP you do not have to specify a metric when redistributing from another EIGRP autonomous system because the original metric is pre-served. + + +Some routing protocols (for example, EIGRP and OSPF) can tag routes as either internal (that is, routes locally configured or connected) or external (that is, routes learned from another routing process) and give priority to internal routes versus external routes. The capability to distinguish between internal and external routes can help prevent a potential routing loop, where two routing protocols continually redistribute the same routes into one another at multiple redistribution points. + +Before you move on to specific redistribution examples, keep the following in mind. Two prerequisites must be met for the routes of one IP routing protocol to be redistributed into another IP routing protocol: + + +■ Key +Topic +■ + +The route needs to be installed in the border routers (router performing redistribu-tion) IP routing table by the protocol being redistributed. + +The destination IP routing protocol needs a reachable metric to assign to the redis- +tributed routes. + + +Based on the previous two prerequisites, Table 17-2 lists various redistribution trouble-shooting targets and recommendations for dealing with them. + +Key Table 17-2 Troubleshooting Targets for Route Redistribution Topic Troubleshooting Target Troubleshooting Recommendation + + +Source routing protocol + + + + +Route selection + +Verify that a route to be redistributed from a routing protocol has been learned by that routing protocol. Issue appropriate show commands for the data structures of the source routing protocol to ensure that the source routing protocol has learned the route in question. +Because a route must be in a router’s IP routing table to be redistributed, ensure that the routes of the source routing protocol are indeed being injected into the router’s IP routing table. + + + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 703 + + +Troubleshooting Target Troubleshooting Recommendation + +Redistribution configuration + + + + + + +Destination routing protocol + +If a route has been injected into a router’s IP routing table from a source routing protocol but not redistributed into the destination routing protocol, check the redistribution configuration. This involves checking the metric applied to routes as they are redistributed into the destination routing protocol, checking for any route filtering that might be preventing redistribution, and checking the redistribution syntax to confirm that the correct routing process ID or autonomous system number is specified. +If a route has been successfully redistributed into a destination routing protocol but the route has not been successfully learned by neighboring routers, you should investigate the destination routing protocol. You could use traditional methods of troubleshooting a destination routing protocol; however, keep in mind that the redistributed route might be marked as an external route. Therefore, check the characteristics of the destination routing protocol to determine whether it treats external routes differently from internal ones. + + + + +Troubleshooting Redistribution into RIP + + + +Key Topic + +Your options are limited when redistributing routes into RIPv2 and RIPng. Review Example 17-1, it displays the options when redistributing OSPFv2 routes into RIPv2. This example is shown because it has the most options. When redistributing EIGRP, BGP, static or connected, you only have metric and route map as options. The most common issue you will run into when redistributing into RIPv2 is related to the metric. Remember that the seed metric by default is set to infinity (unreachable). Therefore, if you fail to manually set the metric using any of the options listed earlier in the chapter, routes will not be advertised to the other routers in the RIPv2 domain. In addition, if you configure the metric too high at the redistribution point, you could cause the route to become unreachable further in your RIPv2 domain, because RIP’s metric is based on hop count. For example, if you specify a metric of 10 during redistribution, a router that is 6 hops away from the redistribution router will not receive the redistributed routes because the routes will be further than 15 hops away (10 + 6 = 16). + +Also, if the wrong route map is applied, or there is an error within the route map, routes +will not be redistributed properly. + + +Example 17-1 RIPv2 Redistribution Options + +R1(config)#router rip +R1(config-router)#redistribute ospf 1 ? + +match +metric +route-map +vrf + + +Redistribution of OSPF routes +Metric for redistributed routes +Route map reference +VPN Routing/Forwarding Instance + + + +From the Library of Outcast Outcast +704 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +With RIP next generation (RIPng) redistribution, you can experience all the same issues that you do with RIPv2 in addition to another. By default, with RIPv2, the networks of the local interfaces participating in the routing process that is being redistributed on the border router into RIPv2 will be redistributed as well. However, with RIPng, they will not. Therefore, if you want to include the networks associated with the interfaces participat-ing in the routing process that is being redistributed into RIPng on the boundary router, you need to use the include-connected keyword, as shown in Example 17-2. + +Example 17-2 RIPng Redistribution Options + +R1(config)#ipv6 router rip +R1(config-rtr)#redistribute ospf 1 ? + +include-connected +match +metric +route-map + + +Include connected +Redistribution of OSPF routes +Metric for redistributed routes +Route map reference + + +When redistributing OSPF into RIP, you also have the match option, which allows you to match just internal, just external, just nssa-external routes, or a combination of them. If the wrong options are chosen, the wrong routes will be redistributed resulting in missing routes. + +On the boundary router, you can verify which routing protocols are being redistributed with the show ip protocols command and the routes that were redistributed with the show ip rip database command. In Example 17-3, the output of show ip protocols indi-cates that the EIGRP process with an autonomous system number of 100 is being redis-tributed into RIPv2. In Example 17-4, the output indicates that the 10.1.3.0/24 network is redistributed. + +Example 17-3 Verifying Redistribution with show ip protocols + +R2#show ip protocols +*** IP Routing is NSF aware *** +...output omitted... +Routing Protocol is "rip" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Sending updates every 30 seconds, next due in 21 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Redistributing: eigrp 100, rip +Default version control: send version 2, receive version 2 +Interface Send Recv Triggered RIP Key-chain +...output omitted... + + +Example 17-4 Verifying Redistribution with show ip rip database + +R2#show ip rip database +10.0.0.0/8 auto-summary +10.1.1.0/24 + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 705 + +[1] via 10.1.12.1, 00:00:19, GigabitEthernet0/0 +10.1.3.0/24 redistributed +[5] via 10.1.23.3, +10.1.12.0/24 directly connected, GigabitEthernet0/0 +10.1.14.0/24 +[1] via 10.1.12.1, 00:00:19, GigabitEthernet0/0 +10.1.23.0/24 directly connected, GigabitEthernet1/0 + +To verify that other RIP routers in the RIP domain are learning about the redistributed route, use the show ip route and show ip rip database commands on those routers, as shown in Example 17-5. + +Example 17-5 Verifying Redistributed Routes in the RIP Domain + +R1#show ip rip database + +10.0.0.0/8 +10.1.1.0/24 +10.1.3.0/24 + +auto-summary +directly connected, GigabitEthernet0/0 + +[5] via 10.1.12.2, 00:00:00, GigabitEthernet1/0 + +10.1.12.0/24 +10.1.14.0/24 +10.1.23.0/24 + +directly connected, GigabitEthernet1/0 +directly connected, FastEthernet3/0 + +[1] via 10.1.12.2, 00:00:00, GigabitEthernet1/0 +R1#show ip route +...output omitted... +10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +R 10.1.3.0/24 [120/5] via 10.1.12.2, 00:00:03, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +C 10.1.14.0/24 is directly connected, FastEthernet3/0 +L 10.1.14.1/32 is directly connected, FastEthernet3/0 +R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:03, GigabitEthernet1/0 + +For RIPng, the show ipv6 protocols output is more detailed for redistribution, as shown in Example 17-6. Notice how it states the protocol, the seed metric, and whether con-nected networks are included. + +Example 17-6 Verifying RIPng Redistribution with show ipv6 protocols + +R2#show ipv6 protocols +...output omitted... +IPv6 Routing Protocol is "rip TSHOOT_RIP" +Interfaces: +GigabitEthernet0/0 +Redistribution: +Redistributing protocol eigrp 100 with metric 7 include-connected +...output omitted... + + +From the Library of Outcast Outcast +706 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + + +Key Topic + +Troubleshooting Redistribution into EIGRP + +When redistributing into EIGRP for IPv4 you can apply a metric with the metric key-word or a route map with the route-map keyword. If you are redistributing OSPF into EIGRP, as shown in Example 17-7, you will also have the option to specify the match option which allows you to match just internal, just external, just nssa-external routes, or a combination of them. + +The most common issue you will run into when redistributing into EIGRP for IPv4 is related to the metric. Remember that the seed metric by default is set to infinity (unreach-able). Therefore, if you fail to manually set the metric using any of the options listed earlier in the chapter, routes will not be advertised to the other routers in the EIGRP autonomous system. Unlike RIP, you will not have to worry about configuring a metric that is too high and causing networks to be unreachable. However, you have to consider if the metrics you specify will cause suboptimal routing if you have multiple redistribu-tion points in the routing domain. + +Also, if the wrong route map is applied, or there is an error within the route map, routes +will not be redistributed properly. + + +Example 17-7 EIGRP for IPv4 Redistribution Options + +R1(config)#router eigrp 1 +R1(config-router)#redistribute ospf 1 ? + +match +metric +route-map + + +Redistribution of OSPF routes +Metric for redistributed routes +Route map reference + + +With EIGRP for IPv6 you have the same match, metric, and route-map keywords, in addition to the include-connected keyword. By default, with EIGRP for IPv4, the net-works associated with the local interfaces participating in the redistributed routing pro-cess will be redistributed as well. However, with EIGRP for IPv6 they will not. Therefore, if you want to include the networks associated with the local interfaces participating in the routing process that is being redistributed, you need to use the include-connected keyword, as shown in Example 17-8. + +Example 17-8 EIGRP for IPv6 Redistribution Options + +R1(config)#ipv6 router eigrp 1 +R1(config-rtr)#redistribute ospf 1 ? + +include-connected +match +metric +route-map + + +Include connected +Redistribution of OSPF routes +Metric for redistributed routes +Route map reference + + +On the boundary router, you can verify which protocols are being redistributed into EIGRP for IPv4 with the show ip protocols command. As shown in Example 17-9, RIP routes are being redistributed into EIGRP for IPv4. + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 707 + +Example 17-9 Verifying Protocols That Are Being Redistributed into EIGRP for IPv4 + +R2#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +Redistributing: rip +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +...output omitted... + +When reviewing the EIGRP for IPv4 topology table with the show ip eigrp topology command, you can identify the routes that have been injected into the EIGRP process via redistribution because it states via Redistributed, as shown in Example 17-10. + +Example 17-10 Verifying Routes Redistributed into EIGRP for IPv4 (Topology Table) + +R2#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(203.0.113.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.12.0/24, 1 successors, FD is 2560000256 +via Redistributed (2560000256/0) +P 10.1.14.0/24, 1 successors, FD is 2560000256 +via Redistributed (2560000256/0) +P 10.1.3.0/24, 1 successors, FD is 3072 +via 10.1.23.3 (3072/2816), GigabitEthernet1/0 +P 10.1.23.0/24, 1 successors, FD is 2816 +via Connected, GigabitEthernet1/0 +P 10.1.1.0/24, 1 successors, FD is 2560000256 +via Redistributed (2560000256/0) + +When examining a redistributed route in the routing table on the boundary router, as shown in Example 17-11, with the show ip route ip-address command, it indicates how the route is known, how it is being redistributed, and the EIGRP metric values that are being used at the redistribution point. + +Example 17-11 Verifying Routes Redistributed into EIGRP for IPv4 (Routing Table) + +R2#show ip route 10.1.1.0 +Routing entry for 10.1.1.0/24 +Known via "rip", distance 120, metric 1 +Redistributing via eigrp 100, rip + + + + +From the Library of Outcast Outcast +708 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Advertised by eigrp 100 metric 1 1 1 1 1 +Last update from 10.1.12.1 on GigabitEthernet0/0, 00:00:19 ago +Routing Descriptor Blocks: +* 10.1.12.1, from 10.1.12.1, 00:00:19 ago, via GigabitEthernet0/0 +Route metric is 1, traffic share count is 1 + +When examining the routing table on other routers (not the boundary router) in the EIGRP for IPv4 autonomous system, the redistributed routes will have an administrative distance (AD) of 170 by default and a code of D EX, as shown in Example 17-12. + +Example 17-12 Examining EIGRP for IPv4 Redistributed Routes in a Routing Table + +R3#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +D EX 10.1.1.0/24 +[170/2560000512] via 10.1.23.2, 00:04:38, GigabitEthernet1/0 +C 10.1.3.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.3.3/32 is directly connected, GigabitEthernet0/0 +D EX 10.1.12.0/24 +[170/2560000512] via 10.1.23.2, 00:04:38, GigabitEthernet1/0 +D EX 10.1.14.0/24 +[170/2560000512] via 10.1.23.2, 00:04:38, GigabitEthernet1/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.3/32 is directly connected, GigabitEthernet1/0 + +For EIGRP for IPv6, the show ipv6 protocols output is more detailed for redistribu-tion, as shown in Example 17-13. Notice how it states the protocol, the seed metric, and whether connected networks are included. + +Example 17-13 Verifying EIGRP for IPv6 Redistribution with show ipv6 protocols + +R2#show ipv6 protocols +...output omitted... +IPv6 Routing Protocol is "eigrp 100" +EIGRP-IPv6 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 709 + +Router-ID: 203.0.113.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 16 +Maximum hopcount 100 +Maximum metric variance 1 + +Interfaces: +GigabitEthernet1/0 +Redistribution: +Redistributing protocol rip TSHOOT_RIP with metric 1 1 1 1 1 include-connected + +The output of show ipv6 eigrp topology on the boundary router also indicates which routes are redistributed, as shown in Example 17-14. + +Example 17-14 Verifying EIGRP for IPv6 Redistribution with show ipv6 eigrp topology + +R2#show ipv6 eigrp topology +EIGRP-IPv6 Topology Table for AS(100)/ID(203.0.113.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:0:1::/64, 1 successors, FD is 2560000256 +via Redistributed (2560000256/0) +P 2001:DB8:0:3::/64, 1 successors, FD is 3072 +via FE80::C804:10FF:FE2C:1C (3072/2816), GigabitEthernet1/0 +P 2001:DB8:0:12::/64, 1 successors, FD is 2560000256 +via Redistributed (2560000256/0) +P 2001:DB8:0:23::/64, 1 successors, FD is 2816 +via Connected, GigabitEthernet1/0 + +When examining the routing table on other routers (not the boundary router) in the EIGRP for IPv6 autonomous system, the redistributed routes will have an administrative distance of 170 by default and a code of EX, as shown in Example 17-15. + +Example 17-15 Verifying EIGRP for IPv6 Redistributed Routes + +R3#show ipv6 route +IPv6 Routing Table - default - 7 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +EX 2001:DB8:0:1::/64 [170/2560000512] +via FE80::C802:AFF:FE88:1C, GigabitEthernet1/0 + + + +From the Library of Outcast Outcast +710 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +C 2001:DB8:0:3::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:0:3::3/128 [0/0] +via GigabitEthernet0/0, receive +EX 2001:DB8:0:12::/64 [170/2560000512] +via FE80::C802:AFF:FE88:1C, GigabitEthernet1/0 +C 2001:DB8:0:23::/64 [0/0] +via GigabitEthernet1/0, directly connected +L 2001:DB8:0:23::3/128 [0/0] +via GigabitEthernet1/0, receive +L FF00::/8 [0/0] +via Null0, receive + + + + + +Key Topic + +Troubleshooting Redistribution into OSPF +When redistributing into OSPF, you have more options than other routing protocols, as shown in Example 17-16. The metric option allows you to provide a seed metric at the redistribution point. The default seed metric is 20 with OSPF; therefore, providing a met-ric is not mandatory. If you forget to provide a metric, redistributed routes will still be advertised to other routers in the OSPF domain. The metric-type option is used to define the type of OSPF external route the redistributed route will be. By default, it will be Type 2, which is represented as E2 in the routing table. With E2, each router will preserve the seed metric for the external routes. Type 1, which is represented as E1 in the routing table, allows each router to take the seed metric and add to it all the other link costs to reach the redistribution point in the domain. Therefore, each router will have a metric that is a combination of the seed metric and the total cost to reach the redistribution router. With the nssa-only option, you can limit redistributed routes to the NSSA area only, and with the route-map option, you can reference a route map that provides more granular control over the routes that are being redistributed. The subnets keyword is an extremely important option. Without the subnets keyword, only classful networks will be redistrib-uted (for example, a Class A address with a /8 mask, a Class B address with a /16 mask, and a Class C address with a /24 mask). With the subnets keyword, all classless and class-ful networks will be redistributed. Therefore, if you have any subnets that you want to redistribute, the subnets keyword is mandatory. The tag keyword can be used to add a numeric ID (tag) to the route so the route can be referenced by the tag at a later point for +filtering or manipulation purposes. + + +Example 17-16 OSPFv2 Redistribution Options + +R1(config)#router ospf 1 +R1(config-router)#redistribute eigrp 100 ? + +metric +metric-type +nssa-only +route-map +subnets +tag + + +Metric for redistributed routes +OSPF/IS-IS exterior metric type for redistributed routes +Limit redistributed routes to NSSA areas +Route map reference +Consider subnets for redistribution into OSPF +Set tag for routes redistributed into OSPF + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 711 + +Look closely at Example 17-17, which displays the options available when redistributing into OSPFv3. What has been added and what is missing when compared to OSPFv2? The include-connected keyword has been added. By default, with OSPFv2, the networks associated with the local interfaces that are participating in the routing process that is being redistributed will be redistributed as well. However, with OSPFv3, they will not. Therefore, if you want to include the networks associated with the interfaces participat-ing in the routing protocol that is being redistributed on the ASBR, you need to use the include-connected keyword. + +The subnets keyword is not an option with OSPFv3 because the concept of classful and classless does not exist with IPv6. + +Example 17-17 OSPFv3 Redistribution Options + +R1(config)#ipv6 router ospf 1 +R1(config-rtr)#redistribute eigrp 100 ? + +include-connected +metric +metric-type +nssa-only +route-map +tag + + +Include connected +Metric for redistributed routes +OSPF/IS-IS exterior metric type for redistributed routes +Limit redistributed routes to NSSA areas +Route map reference +Set tag for routes redistributed into OSPF + + +The show ip protocols command enables you to verify which routing protocols are being redistributed into the OSPFv2 process. In Example 17-18, you can see that EIGRP 100 routes, including subnets, are being redistributed into the OSPFv2 process. + +Example 17-18 Verifying Protocols Being Redistributed into OSPFv2 + +R2#show ip protocols +...output omitted... +Routing Protocol is "ospf 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 203.0.113.1 +It is an autonomous system boundary router +Redistributing External Routes from, +eigrp 100, includes subnets in redistribution +Number of areas in this router is 1. 1 normal 0 stub 0 nssa +Maximum path: 4 +Routing for Networks: +10.1.12.2 0.0.0.0 area 0 +Routing Information Sources: + +Gateway +10.1.14.1 + +Distance +110 + +Last Update +00:19:48 + +Distance: (default is 110) + + + + +From the Library of Outcast Outcast +712 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Routes redistributed into an OSPFv2 normal area will be advertised within a Type 5 link-state advertisement (LSA). Routes redistributed into an OSPFv2 NSSA or totally NSSA area will be advertised within a Type 7 LSA and then converted to a Type 5 LSA at an Area Border Router (ABR). You can view the redistributed routes that are injected into the OSPFv2 LSDB with the show ip ospf database command, as shown in Example 17-19. In this example, the 10.1.3.0 and 10.1.23.0 networks have been redistributed into the OSPFv2 routing process. + +Example 17-19 Verifying Redistributed Routes in the OSPFv2 LSDB + +R2#show ip ospf database + +OSPF Router with ID (203.0.113.1) (Process ID 1) + +Router Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum Link count + +10.1.14.1 +203.0.113.1 + +10.1.14.1 738 +203.0.113.1 596 + +0x80000003 0x009AEA 3 +0x80000003 0x005829 1 + + +Net Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum +10.1.12.1 10.1.14.1 738 0x80000002 0x001F8F + +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +10.1.3.0 +10.1.23.0 + +203.0.113.1 596 +203.0.113.1 596 + +0x80000002 0x00EB67 0 +0x80000002 0x000F30 0 + + +When examining a redistributed route in the routing table on the boundary router (Autonomous System Boundary Router [ASBR]), as shown in Example 17-20, with the show ip route ip_address command, it indicates how the route is known, how it is being redistributed, and how it is being advertised. In this case, the route is known via EIGRP 100 and is being redistributed into the OSPF 1 process with the subnets keyword. + +Example 17-20 Verifying Redistributed Routes in the ASBR’s Routing Table + +R2#show ip route 10.1.3.0 +Routing entry for 10.1.3.0/24 +Known via "eigrp 100", distance 90, metric 3072, type internal +Redistributing via eigrp 100, ospf 1 +Advertised by ospf 1 subnets +Last update from 10.1.23.3 on GigabitEthernet1/0, 00:50:19 ago +Routing Descriptor Blocks: +* 10.1.23.3, from 10.1.23.3, 00:50:19 ago, via GigabitEthernet1/0 +Route metric is 3072, traffic share count is 1 + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 713 + +Total delay is 20 microseconds, minimum bandwidth is 1000000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 1 + +When examining the routing table on other routers (not the ASBR) in the OSPFv2 domain, by default the redistributed routes will have an AD of 110 and a code of O E2, as shown in Example 17-21. If you change the metric type to E1, they will appear with a code of E1, and if it is an NSSA or totally NSSA area they will appear as O N1 or O N2. + +Example 17-21 Examining OSPFv2 Redistributed Routes in a Routing Table + +R1#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +O E2 10.1.3.0/24 [110/20] via 10.1.12.2, 00:49:11, GigabitEthernet1/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +C 10.1.14.0/24 is directly connected, FastEthernet3/0 +L 10.1.14.1/32 is directly connected, FastEthernet3/0 +O E2 10.1.23.0/24 [110/20] via 10.1.12.2, 00:49:11, GigabitEthernet1/0 + +For OSPFv3, the show ipv6 protocols output is seen in Example 17-22. Notice how it states the protocol, the seed metric, and if connected networks are included. + +Example 17-22 Verifying OSPFv3 Redistribution with show ipv6 protocols + +R2#show ipv6 protocols +...output omitted... +IPv6 Routing Protocol is "ospf 1" +Router ID 2.2.2.2 +Autonomous system boundary router +Number of areas: 1 normal, 0 stub, 0 nssa +Interfaces (Area 0): +GigabitEthernet0/0 +Redistribution: +Redistributing protocol eigrp 100 with metric 10 include-connected + + + +From the Library of Outcast Outcast +714 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +The output of show ipv6 ospf database on the ASBR will identify the external Type 5 routes just like OSPFv2, as shown in Example 17-23. + +Example 17-23 Verifying OSPFv3 Redistribution with show ipv6 ospf database + +R2#show ipv6 ospf database + +OSPFv3 Router with ID (2.2.2.2) (Process ID 1) + +Router Link States (Area 0) + + +ADV Router Age +1.1.1.1 1429 +2.2.2.2 1446 + +Seq# +0x80000004 +0x80000003 + +Fragment ID +0 +0 + +Link count Bits +1 B +1 E + + +Net Link States (Area 0) + + +ADV Router Age +1.1.1.1 1429 + +Seq# Link ID +0x80000002 4 + +Rtr count +2 + + +Inter Area Prefix Link States (Area 0) + + +ADV Router Age +1.1.1.1 1693 + +Seq# +0x80000002 + +Prefix +2001:DB8:0:14::/64 + + +Link (Type-8) Link States (Area 0) + + +ADV Router Age +1.1.1.1 1693 +2.2.2.2 1446 + +Seq# Link ID +0x80000002 4 +0x80000002 3 + +Interface +Gi0/0 +Gi0/0 + + +Intra Area Prefix Link States (Area 0) + + +ADV Router Age +1.1.1.1 1429 +1.1.1.1 1429 + +Seq# Link ID +0x80000006 0 +0x80000002 4096 + +Ref-lstype +0x2001 +0x2002 + +Ref-LSID +0 +4 + + +Type-5 AS External Link States + + +ADV Router Age +2.2.2.2 46 +2.2.2.2 46 + +Seq# +0x80000003 +0x80000003 + +Prefix +2001:DB8:0:3::/64 +2001:DB8:0:23::/64 + + +When examining the routing table on other routers (not the ASBR) in the OSPFv3 domain, by default the redistributed routes will have an administrative distance of 110 and a code of OE2, as shown in Example 17-24. If the metric type is changed to Type 1, the code would be OE1. In an NSSA or totally NSSA area, the redistributed routes would be listed as ON1 or ON2. + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 715 + +Example 17-24 Verifying OSPFv3 Redistributed Routes + +R1#show ipv6 route +IPv6 Routing Table - default - 9 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +C 2001:DB8:0:1::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:0:1::1/128 [0/0] +via GigabitEthernet0/0, receive +OE2 2001:DB8:0:3::/64 [110/10] +via FE80::C802:AFF:FE88:8, GigabitEthernet1/0 +C 2001:DB8:0:12::/64 [0/0] +via GigabitEthernet1/0, directly connected +L 2001:DB8:0:12::1/128 [0/0] +via GigabitEthernet1/0, receive +C 2001:DB8:0:14::/64 [0/0] +via FastEthernet3/0, directly connected +L 2001:DB8:0:14::1/128 [0/0] +via FastEthernet3/0, receive +OE2 2001:DB8:0:23::/64 [110/10] +via FE80::C802:AFF:FE88:8, GigabitEthernet1/0 +L FF00::/8 [0/0] +via Null0, receive + +Note that if you are redistributing from BGP into OSPF, EIGRP, or RIP, only External BGP (eBGP) routes will be redistributed by default. If you want Internal BGP (iBGP) routes to be redistributed, in router BGP configuration mode, you must issue the bgp redistribute-internal command. + + +Troubleshooting Redistribution into BGP + + + +Key Topic + +When redistributing into BGP for IPv4, you have the same options found with RIP and EIGRP. You can apply a metric with the metric keyword or a route map with the route-map keyword. If you are redistributing OSPF into BGP, as shown in Example 17-25, you will also have the option to specify the match option, which allows you to match just internal, just external, just nssa-external routes, or a combination of them. With BGP, only internal OSPF routes will be redistributed by default. If you want external OSPF routes to be redistributed, you have to indicate so during redistribution. + +The metric keyword is not required because BGP will use the IGP metric by default. If the wrong route map is applied, or there is an error within the route map, routes will not +be redistributed properly. + + + + +From the Library of Outcast Outcast +716 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 17-25 BGP for IPv4 Redistribution Options + +R1(config)#router bgp 65001 +R1(config-router)#address-family ipv4 unicast +R1(config-router-af)#redistribute ospf 1 ? + +match +metric +route-map +vrf + + +Redistribution of OSPF routes +Metric for redistributed routes +Route map reference +VPN Routing/Forwarding Instance + + +With BGP for IPv6, you have the same match, metric, and route-map keywords, in addi-tion to the include-connected keyword. By default, with BGP for IPv4, the networks of the local interfaces participating in the routing protocol that is being redistributed on the border router will be redistributed as well. However, with BGP for IPv6, they will not. Therefore, if you want to redistribute the networks associated with the local interfaces participating in the routing process being redistributed into BGP for IPv6, you need to use the include-connected keyword, as shown in Example 17-26. + +Example 17-26 BGP for IPv6 Redistribution Options + +R1(config)#router bgp 65001 +R1(config-router)#address-family ipv6 unicast +R1(config-router-af)#redistribute ospf 1 ? + +include-connected +match +metric +route-map + + +Include connected +Redistribution of OSPF routes +Metric for redistributed routes +Route map reference + + +Using the commands show ip protocols and show ipv6 protocols, you can verify which protocols are being redistributed into the BGP routing process, as shown in Example 17-27. + +Example 17-27 Verifying Protocols Being Redistributed into BGP + +R2#show ip protocols +...output omitted... +Routing Protocol is "bgp 65500" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +IGP synchronization is disabled +Automatic route summarization is disabled +Redistributing: ospf 1 (internal) + +Neighbor(s): +Address FiltIn FiltOut DistIn DistOut Weight RouteMap +10.1.23.3 + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 717 + +Maximum path: 1 +Routing Information Sources: +Gateway Distance Last Update +Distance: external 20 internal 200 local 200 + +R2#show ipv6 protocols +...output omitted... +IPv6 Routing Protocol is "bgp 65500" +IGP synchronization is disabled +Redistribution: +Redistributing protocol ospf 1 (internal) include-connected +Neighbor(s): +Address FiltIn FiltOut Weight RoutemapIn RoutemapOut +2001:DB8:0:23::3 + +In the BGP table, redistributed routes appear with a question mark (?) under the Path col-umn, as shown in Example 17-28. + +Example 17-28 Verifying Redistributed Routes in the BGP Table + +R2#show bgp all +For address family: IPv4 Unicast + +BGP table version is 4, local router ID is 203.0.113.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 10.1.1.0/24 +*> 10.1.12.0/24 +*> 10.1.14.0/24 + +10.1.12.1 +0.0.0.0 +10.1.12.1 + +2 32768 ? +0 32768 ? +2 32768 ? + + +For address family: IPv6 Unicast + +BGP table version is 4, local router ID is 203.0.113.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path +*> 2001:DB8:0:1::/64 +:: 2 32768 ? + + + +From the Library of Outcast Outcast +718 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +*> 2001:DB8:0:12::/64 +:: +*> 2001:DB8:0:14::/64 +:: + + +0 32768 ? + +2 32768 ? + + +For address family: IPv4 Multicast + + +For address family: MVPNv4 Unicast + + +Troubleshooting Redistribution with Route Maps + +When applying a route map to the redistribution command, you have a few extra items to verify during the troubleshooting process: + +Key ■ Is the correct route map applied? +Topic ■ Is permit or deny specified for the sequence, and is it correct? A permit sequence +indicates that what is matched will be redistributed. A deny sequence indicates that what is matched will not be redistributed. + +■ If there is an access list or prefix list being used in the match statement, you need to verify that they are correct using the show {ip|ipv6} access-list command or the show { ip|ipv6 } prefix-list command. + +■ If there are set statements, you need to verify that the correct values have been spec-ified to accomplish the desired goal. + +■ If a route does not match any of the match statements in any of the sequences, it will fall into the implicit deny sequence at the end of the route map and not be redis-tributed. + +■ If a route map is attached to the redistribution command but that route map does not exist, none of the routes will be redistributed. + + +Redistribution Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 17-4. + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 719 + + + +192.0.2.1 2001:db8:f::f + +BGP AS 65500 + + + + +10.1.1.0/24 2001:db8:0:1::/64 +Gi0/0 + +Area 0 OSPFv2/v3 + +2001:db8:0:12::/64 +10.1.12.0/24 + + +Gi2/0 203.0.113.0/29 + +Gi1/0 + + + +R1 Gi1/0 +Fa3/0 + +Gi0/0 R2 10.1.23.0/24 2001:db8:0:23::/64 + + + + +WAN 10.1.14.0/24 +2001:db8:0:14::/64 + + +Gi0/0 Fa1/0 BRANCH + + + +EIGRP AS 100 (IPv4/IPv6) + +2001:db8:0:4::/64 10.1.4.0/24 + + +Figure 17-4 Redistribution Trouble Tickets Topology + + +Trouble Ticket 17-1 + +Problem: Users in the IPv4 Branch site indicate that they are not able to access any resources outside of the Branch office. + +On Branch the first thing you check (using the show ip route command) is the routing table to see which routes Branch knows, as shown in Example 17-29. The output indicates that Branch only knows about connected and local routes. + +Example 17-29 Verifying the Routing Table on Branch + +Branch#show ip route +...output omitted... +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +C 10.1.4.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.4.4/32 is directly connected, GigabitEthernet0/0 +C 10.1.14.0/24 is directly connected, FastEthernet1/0 +L 10.1.14.4/32 is directly connected, FastEthernet1/0 + +You decide that an EIGRP neighbor relationship might not have been formed with R1. Therefore, you issue the show ip eigrp neighbors command on Branch to confirm. As shown in Example 17-30, the device with an IP address of 10.1.14.1 has formed an adja-cency with branch. Using the show cdp neighbors detail command reveals that the IP address belongs to R1 as shown in the same example. + + + + + +From the Library of Outcast Outcast +720 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 17-30 Verifying EIGRP Neighbors on Branch + +Branch#show ip eigrp neighbors +EIGRP-IPv4 VR(TSHOOT) Address-Family Neighbors for AS(100) +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.1.14.1 Fa1/0 12 01:40:12 62 372 0 6 + +Branch#show cdp neighbors detail +------------------------- +Device ID: R1 +Entry address(es): +IP address: 10.1.14.1 +IPv6 address: 2001:DB8:0:14::1 (global unicast) +IPv6 address: FE80::C801:AFF:FE88:54 (link-local) +...output omitted... + +Because R1 and Branch are neighbors, but Branch is not learning any routes from R1, you decide to check whether there are any incoming route filters configured on Branch with the show ip protocols command. The output of Example 17-31 shows that there are no route filters. + +Example 17-31 Verifying Route Filters on Branch + +Branch#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +...output omitted... + +Next, you decide to check for outbound route filters on R1 using show ip protocols. As shown in Example 17-32, there are no route filters. + +Example 17-32 Verifying Route Filters on R1 + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +Redistributing: ospf 1 +EIGRP-IPv4 Protocol for AS(100) + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 721 + +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +...output omitted... + +Because Figure 17-4 shows that R1 is a boundary router performing redistribution, you shift your attention over to R1’s redistribution configuration to make sure that the OSPF routes are being redistributed into EIGRP. In Example 17-33, the output of show ip pro-tocols indicates that OSPF process 1 is being redistributed into EIGRP autonomous sys-tem 100. However, so far all your troubleshooting efforts are indicating that Branch is not learning any redistributed routes. + +Example 17-33 Verifying OSPF Is Being Redistributed into EIGRP + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "eigrp 100" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +Redistributing: ospf 1 +EIGRP-IPv4 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +...output omitted... + +You now issue the show ip eigrp topology command on R1. This will confirm if routes are truly being redistributed from OSPF into EIGRP. As shown in Example 17-34, none of the OSPF routes are being redistributed into the EIGRP autonomous system. + +Example 17-34 Verifying Redistributed Routes are in the EIGRP Topology Table + +R1#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(10.1.14.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.14.0/24, 1 successors, FD is 28160 +via Connected, FastEthernet3/0 +P 10.1.4.0/24, 1 successors, FD is 28416 +via 10.1.14.4 (28416/2816), FastEthernet3/0 + +You recall that for routes to be redistributed they have to be in the routing table. Therefore, on R1 you issue the show ip route command, as shown in Example 17-35, and confirm that there are routes in the routing table that should be redistributed. + + + + + +From the Library of Outcast Outcast +722 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 17-35 Verifying Routes to be Redistributed Are in the Routing Table + +R1#show ip route +...output omitted... +10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks +C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 +D 10.1.4.0/24 [90/28416] via 10.1.14.4, 02:05:59, FastEthernet3/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +C 10.1.14.0/24 is directly connected, FastEthernet3/0 +L 10.1.14.1/32 is directly connected, FastEthernet3/0 +O 10.1.23.0/24 [110/2] via 10.1.12.2, 02:02:11, GigabitEthernet1/0 +192.0.2.0/32 is subnetted, 1 subnets +O E2 192.0.2.1 [110/1] via 10.1.12.2, 01:03:22, GigabitEthernet1/0 + +Next you review the redistribute command configured on R1 for the EIGRP process with the show run | section router eigrp command, as shown in Example 17-36. You notice that there is the command redistribute ospf 1; however, you quickly realize that the met-ric is missing. The metric is mandatory with EIGRP. If you fail to specify one, either with the default-metric command, the metric command, or in a route map, the routes to be redistributed will be unreachable and not redistributed. You have located the issue. + +Example 17-36 Verifying the redistribute Command on R1 + +R1#show run | section router eigrp +router eigrp 100 +network 10.1.14.1 0.0.0.0 +redistribute ospf 1 +ipv6 router eigrp 100 +redistribute ospf 1 metric 100000 100 255 1 1500 include-connected + +To solve the issue, you reissue the redistribute ospf 1 command with the metric values of 100000 100 255 1 1500. You then issue the show ip eigrp topology command, as shown in Example 17-37, and confirm that routes are now redistributed. + +Example 17-37 Verifying Routes to Be Redistributed Are in the R1 Topology Table + +R1#show ip eigrp topology +EIGRP-IPv4 Topology Table for AS(100)/ID(10.1.14.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.12.0/24, 1 successors, FD is 51200 +via Redistributed (51200/0) +P 10.1.14.0/24, 1 successors, FD is 28160 +via Connected, FastEthernet3/0 +P 10.1.23.0/24, 1 successors, FD is 51200 +via Redistributed (51200/0) + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 723 + +P 10.1.4.0/24, 1 successors, FD is 28416 +via 10.1.14.4 (28416/2816), FastEthernet3/0 +P 192.0.2.1/32, 1 successors, FD is 51200 +via Redistributed (51200/0) +P 10.1.1.0/24, 1 successors, FD is 51200 +via Redistributed (51200/0) + +The show ip route command on Branch, as shown in Example 17-38, allows you to con-clude that the problem is solved, because there are now external EIGRP routes learned by Branch and users can successfully connect to resources outside of the Branch office. + +Example 17-38 Verifying Routes to Be Redistributed Are in the Branch Routing Table + +Branch#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +D EX 10.1.1.0/24 [170/614400] via 10.1.14.1, 00:02:58, FastEthernet1/0 +C 10.1.4.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.4.4/32 is directly connected, GigabitEthernet0/0 +D EX 10.1.12.0/24 [170/614400] via 10.1.14.1, 00:02:58, FastEthernet1/0 +C 10.1.14.0/24 is directly connected, FastEthernet1/0 +L 10.1.14.4/32 is directly connected, FastEthernet1/0 +D EX 10.1.23.0/24 [170/614400] via 10.1.14.1, 00:02:58, FastEthernet1/0 +192.0.2.0/32 is subnetted, 1 subnets +D EX 192.0.2.1 [170/614400] via 10.1.14.1, 00:02:58, FastEthernet1/0 + + +Trouble Ticket 17-2 + +Problem: Users in the 10.1.23.0/24 network indicate that they are not able to access resources in the 10.1.4.0/24 network. + +You begin troubleshooting by verifying the problem on R2. You issue a ping to 10.1.4.4 from 10.1.23.2, but it fails, as shown in Example 17-39. Because R2 is not able to ping the destination network, you confirm that the clients in 10.1.23.0/24 are not able to connect with resources in 10.1.4.0/24. + + + + + +From the Library of Outcast Outcast +724 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 17-39 Verifying the Problem from R2 + +R2#ping 10.1.4.4 source 10.1.23.2 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.4.4, timeout is 2 seconds: +Packet sent with a source address of 10.1.23.2 +..... +Success rate is 0 percent (0/5) + +On R2, you decide to issue a traceroute to help identify where the issue might be. The trace to 10.1.4.4 from 10.1.23.2, as shown in Example 17-40, is headed toward 203.0.113.2, which is out interface Gig2/0, as confirmed in the output of show ip interface brief in Example 17-41. + +Example 17-40 Issuing a Trace to Identify Where the Issue Might Be + +R2#traceroute 10.1.4.4 source 10.1.23.2 +Type escape sequence to abort. +Tracing the route to 10.1.4.4 +VRF info: (vrf in name/id, vrf out name/id) +1 203.0.113.2 28 msec 44 msec 32 msec +2 * * * +...output omitted... + + +Example 17-41 Verifying Interface IP Addresses + +R2#show ip interface brief +Interface IP-Address OK? Method Status Protocol +Ethernet0/0 unassigned YES NVRAM administratively down down + +GigabitEthernet0/0 +GigabitEthernet1/0 +GigabitEthernet2/0 + +10.1.12.2 +10.1.23.2 +203.0.113.1 + +YES NVRAM up up +YES NVRAM up up +YES NVRAM up up + + +Next you decide to issue the show ip route 10.1.4.4 command on R2, and the result, as shown in Example 17-42, is that the subnet is not in the table. + +Example 17-42 Verifying the Route on R2 + +R2#show ip route 10.1.4.4 +% Subnet not in table + +You shift your attention over to R1 and issue the show ip route 10.1.4.4 command, as shown in Example 17-43, and the result indicates that 10.1.4.4 is reachable using EIGRP out interface Fast Ethernet 3/0. In addition, based on the topology, it should be redistrib-uted into the OSPF process for the OSPF domain to have routes to it. Based on Example 17-43, it is being redistributed into OSPF process 1. + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 725 + +Example 17-43 Verifying the Route on R1 + +R1#show ip route 10.1.4.4 +Routing entry for 10.1.4.0/24 +Known via "eigrp 100", distance 90, metric 28416, type internal +Redistributing via eigrp 100, ospf 1 +Last update from 10.1.14.4 on FastEthernet3/0, 2d14h ago +Routing Descriptor Blocks: +* 10.1.14.4, from 10.1.14.4, 2d14h ago, via FastEthernet3/0 +Route metric is 28416, traffic share count is 1 +Total delay is 110 microseconds, minimum bandwidth is 100000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 1 + +You double-check the OSPF database on R1, as shown in Example 17-44, and notice that 10.1.4.0 is not listed as an External Type 5 LSA. This means that it is not being success-fully redistributed into the OSPF process. + +Example 17-44 Verifying the Route on R1 + +R1#show ip ospf database + +OSPF Router with ID (10.1.14.1) (Process ID 1) + +Router Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum Link count + +10.1.14.1 +203.0.113.1 + +10.1.14.1 1698 +203.0.113.1 1274 + +0x8000007D 0x0064CD 2 +0x80000084 0x005972 2 + + +Net Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum +10.1.12.2 203.0.113.1 1274 0x8000007C 0x0010FE + +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag +192.0.2.1 203.0.113.1 1274 0x8000007C 0x00FD38 0 + +You issue the show run | section router ospf command on R1 to verify the OSPF config-uration on R1. As shown in Example 17-45, the redistribute eigrp 100 command is listed in the configuration. However, as you discovered earlier, the EIGRP routes are not being redistributed. You double-check to make sure that the correct EIGRP autonomous system is being redistributed by issuing the show run | section router eigrp command, as shown in Example 17-46. This output confirms that the correct EIGRP autonomous system is being redistributed. + + + + +From the Library of Outcast Outcast +726 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 17-45 Verifying OSPF Configuration on R1 + +R1#show run | section router ospf +router ospf 1 +redistribute eigrp 100 +network 10.1.1.1 0.0.0.0 area 0 +network 10.1.12.1 0.0.0.0 area 0 +ipv6 router ospf 1 +redistribute eigrp 100 include-connected + + +Example 17-46 Verifying EIGRP Configuration on R1 + +R1#show run | section router eigrp +router eigrp 100 +network 10.1.14.1 0.0.0.0 +redistribute ospf 1 metric 100000 100 255 1 1500 +ipv6 router eigrp 100 +redistribute ospf 1 metric 100000 100 255 1 1500 include-connected + +After some thought, you realize that the 10.1.4.0/24 network is a classless network and that the current redistribute eigrp 100 command will only redistribute classful net-works. You need to add the subnets keyword to the redistribute command, as shown in Example 17-47, to redistribute classless networks. Issuing the show ip ospf database +command in Example 17-48 confirms that the OSPF database is now learning the EIGRP route 10.1.4.0/24. + +Example 17-47 Adding subnets Keyword to Redistribute Command + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#router ospf 1 +R1(config-router)#redistribute eigrp 100 subnets + + +Example 17-48 Verifying That the 10.1.4.0 Route Is in the OSPF Database on R1 + +R1#show ip ospf database + +OSPF Router with ID (10.1.14.1) (Process ID 1) + +Router Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum Link count + +10.1.14.1 +203.0.113.1 + +10.1.14.1 339 +203.0.113.1 1923 + +0x8000007E 0x0062CE 2 +0x80000084 0x005972 2 + + +Net Link States (Area 0) + +Link ID ADV Router Age Seq# Checksum + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 727 + +10.1.12.2 203.0.113.1 1923 0x8000007C 0x0010FE + +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +10.1.4.0 +10.1.14.0 +192.0.2.1 + +10.1.14.1 17 +10.1.14.1 17 +203.0.113.1 1923 + +0x80000001 0x006215 0 +0x80000001 0x00F379 0 +0x8000007C 0x00FD38 0 + + +Next you visit R2 and issue the show ip route 10.1.4.4 command and confirm that it has been added, as shown in Example 17-49. + +Example 17-49 Verifying That R2 Now Knows About the 10.1.4.0 Network + +R2#show ip route 10.1.4.4 +Routing entry for 10.1.4.0/24 +Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 1 +Redistributing via bgp 65500 +Advertised by bgp 65500 match internal external 1 & 2 +Last update from 10.1.12.1 on GigabitEthernet0/0, 00:04:52 ago +Routing Descriptor Blocks: +* 10.1.12.1, from 10.1.14.1, 00:04:52 ago, via GigabitEthernet0/0 +Route metric is 20, traffic share count is 1 + +Finally, you confirm that the problem is solved with a ping from 10.1.23.2 to 10.1.4.4, and it is successful, as shown in Example 17-50. + +Example 17-50 Successful Ping + +R2#ping 10.1.4.4 source 10.1.23.2 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.4.4, timeout is 2 seconds: +Packet sent with a source address of 10.1.23.2 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 36/55/72 ms + + +Trouble Ticket 17-3 + +Problem: IPv6 users in the 2001:db8:0:4::/64 network report that they are not able to access resources in the 2001:db8:0:1::/64 network. + +You begin troubleshooting by confirming the problem on Branch. As shown in Example 17-51, the ping from 2001:db8:0:4::4 to 2001:db8:0:1::1 fails. + +Example 17-51 Confirming the Problem with a Ping + +Branch#ping 2001:db8:0:1::1 source 2001:db8:0:4::4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:1::1, timeout is 2 seconds: + + + +From the Library of Outcast Outcast +728 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Packet sent with a source address of 2001:DB8:0:4::4 +..... +Success rate is 0 percent (0/5) + +While gathering further information, you decide to ping an IPv6 address in the 2001:db8:0:23::/64 network. As shown in Example 17-52, the ping is successful. Therefore, you conclude that only some of the routes in the IPv6 OSPF domain are being redistributed into the EIGRP for IPv6 domain. You issue the show ipv6 route command on Branch, as shown in Example 17-53, and the output confirms that only two external routes are being learned by Branch: 2001:db8:0:23::/64 and 2001:db8:f::/64. + +Example 17-52 Gathering More Information with a Ping + +Branch#ping 2001:db8:0:23::2 source 2001:db8:0:4::4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:23::2, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 8/47/120 ms + + +Example 17-53 Verifying Routes on Branch + +Branch#show ipv6 route +...output omitted... +C 2001:DB8:0:4::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:0:4::4/128 [0/0] +via GigabitEthernet0/0, receive +C 2001:DB8:0:14::/64 [0/0] +via FastEthernet1/0, directly connected +L 2001:DB8:0:14::4/128 [0/0] +via FastEthernet1/0, receive +EX 2001:DB8:0:23::/64 [170/614400] +via FE80::C801:AFF:FE88:54, FastEthernet1/0 +EX 2001:DB8:F::/64 [170/614400] +via FE80::C801:AFF:FE88:54, FastEthernet1/0 +L FF00::/8 [0/0] +via Null0, receive + +Based on the information you have gathered, you decide to check whether redistribution is being performed on R1. You issue the show ipv6 protocols command on R1, as shown in Example 17-54. In the output, you focus on the EIGRP section and review the redistribu-tion information. It clearly indicates that redistribution from OSPF process 1 into EIGRP autonomous system 100 is occurring. In addition, the metric values have been applied, which are mandatory for EIGRP, and internal and external routes are being redistributed. You think that a route map might be applied that is controlling the routes that are being redistributed. However, you notice that a route map is not listed under the Redistribution section of the show ipv6 protocols command. Therefore, that is not the issue. + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 729 + +Example 17-54 Verifying IPv6 Redistribution on R1 + +R1#show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "eigrp 100" +EIGRP-IPv6 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +NSF-aware route hold timer is 240 +Router-ID: 10.1.14.1 +Topology : 0 (base) +Active Timer: 3 min +Distance: internal 90 external 170 +Maximum path: 16 +Maximum hopcount 100 +Maximum metric variance 1 + +Interfaces: +FastEthernet3/0 +Redistribution: +Redistributing protocol ospf 1 with metric 100000 100 255 1 1500 (internal, external 1 & 2, nssa-external 1 & 2) +IPv6 Routing Protocol is "ospf 1" +Router ID 10.1.14.1 +Autonomous system boundary router +Number of areas: 1 normal, 0 stub, 0 nssa +Interfaces (Area 0): +GigabitEthernet1/0 +GigabitEthernet0/0 +Redistribution: +Redistributing protocol eigrp 100 include-connected + +On R1, you issue the show ipv6 eigrp topology command to confirm whether the routes are being redistributed into EIGRP from OSPF. As shown in Example 17-55, only the routes 2001:db8:0:1::/64 and 2001:db8:f::/64 are being redistributed. + +Example 17-55 Reviewing R1’s EIGRP Topology + +R1#show ipv6 eigrp topology +EIGRP-IPv6 Topology Table for AS(100)/ID(10.1.14.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:0:4::/64, 1 successors, FD is 28416 +via FE80::C800:CFF:FEE4:1C (28416/2816), FastEthernet3/0 +P 2001:DB8:F::/64, 1 successors, FD is 51200 +via Redistributed (51200/0) +P 2001:DB8:0:14::/64, 1 successors, FD is 28160 +via Connected, FastEthernet3/0 + + +From the Library of Outcast Outcast +730 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +P 2001:DB8:0:23::/64, 1 successors, FD is 51200 +via Redistributed (51200/0) + +You check the output of show ipv6 route on R1 and note that 2001:db8:0:1::/64 and 2001:db8:0:12::/64 are both in R1’s routing table as connected routes, as shown in Example 17-56. Therefore, for them to be redistributed, they either have to be redistrib-uted as connected routes or participating in the OSPF process, because R1 is configured to redistribute OSPF into EIGRP. Therefore, on R1, you issue the show ipv6 ospf inter-face command, as shown in Example 17-57, and confirm that both Gig0/0 and Gig1/0 are participating in the OSPF process. However, based on your information gathering so far, you have determined that the routes are still not being redistributed. + +Example 17-56 Reviewing R1’s IPv6 Routing Table + +R1#show ipv6 route +...output omitted... +C 2001:DB8:0:1::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:0:1::1/128 [0/0] +via GigabitEthernet0/0, receive +D 2001:DB8:0:4::/64 [90/28416] +via FE80::C800:CFF:FEE4:1C, FastEthernet3/0 +C 2001:DB8:0:12::/64 [0/0] +via GigabitEthernet1/0, directly connected +L 2001:DB8:0:12::1/128 [0/0] +via GigabitEthernet1/0, receive +C 2001:DB8:0:14::/64 [0/0] +via FastEthernet3/0, directly connected +L 2001:DB8:0:14::1/128 [0/0] +via FastEthernet3/0, receive +O 2001:DB8:0:23::/64 [110/2] +via FE80::C802:AFF:FE88:8, GigabitEthernet1/0 +OE2 2001:DB8:F::/64 [110/1] +via FE80::C802:AFF:FE88:8, GigabitEthernet1/0 +L FF00::/8 [0/0] +via Null0, receive + + +Example 17-57 Reviewing R1’s IPv6 OSPF Interfaces + +R1#show ipv6 ospf interface brief +Interface PID Area Intf ID Cost State Nbrs F/C + +Gi1/0 1 0 +Gi0/0 1 0 + +4 1 BDR 1/1 +3 1 DR 0/0 + + +At this point, you recall that IPv6 redistribution behaves differently than IPv4 redistribu-tion with directly connected networks. IPv6 directly connected networks are not redis-tributed by default. You need to use the include-connected keyword to force the directly + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 731 + +connected networks to be redistributed. Reviewing the Redistribution section in the show ipv6 protocols output of Example 17-54 again confirms that the include-connect-ed keyword was not included in the command. + +On R1, you issue the command redistribute ospf 1 metric 100000 100 255 1 1500 include-connected in IPv6 EIGRP configuration mode, as shown in Example 17-58, to fix the issue. + +Example 17-58 Modifying the redistribute Command + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ipv6 router eigrp 100 +R1(config-rtr)#redistribute ospf 1 metric 100000 100 255 1 1500 include-connected + +You reissue the show ipv6 protocols command and the show ipv6 eigrp topology com-mand and confirm that the directly connected routes are now being redistributed, as shown in Example 17-59. + +Example 17-59 Verifying That Routes Are Redistributed After Changes + +R1#show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "ND" +IPv6 Routing Protocol is "eigrp 100" +EIGRP-IPv6 Protocol for AS(100) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +...output omitted... +Redistribution: +Redistributing protocol ospf 1 with metric 100000 100 255 1 1500 (internal, external 1 & 2, nssa-external 1 & 2) include-connected +...output omitted... +R1#show ipv6 eigrp topology +EIGRP-IPv6 Topology Table for AS(100)/ID(10.1.14.1) +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:0:4::/64, 1 successors, FD is 28416 +via FE80::C800:CFF:FEE4:1C (28416/2816), FastEthernet3/0 +P 2001:DB8:0:1::/64, 1 successors, FD is 51200 +via Redistributed (51200/0) +P 2001:DB8:F::/64, 1 successors, FD is 51200 +via Redistributed (51200/0) +P 2001:DB8:0:14::/64, 1 successors, FD is 28160 +via Connected, FastEthernet3/0 +P 2001:DB8:0:12::/64, 1 successors, FD is 51200 +via Redistributed (51200/0) +P 2001:DB8:0:23::/64, 1 successors, FD is 51200 +via Redistributed (51200/0) + + + +From the Library of Outcast Outcast +732 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Going back to Branch, you issue the show ipv6 route command and notice that there is an entry in the routing table for 2001:db8:0:1::/64 and 2001:db8:0:12::/64 now, as shown in Example 17-60. + +Example 17-60 Verifying That Routes Are Learned By Branch + +Branch#show ipv6 route +IPv6 Routing Table - default - 9 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +EX 2001:DB8:0:1::/64 [170/614400] +via FE80::C801:AFF:FE88:54, FastEthernet1/0 +C 2001:DB8:0:4::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:0:4::4/128 [0/0] +via GigabitEthernet0/0, receive +EX 2001:DB8:0:12::/64 [170/614400] +via FE80::C801:AFF:FE88:54, FastEthernet1/0 +C 2001:DB8:0:14::/64 [0/0] +via FastEthernet1/0, directly connected +L 2001:DB8:0:14::4/128 [0/0] +via FastEthernet1/0, receive +EX 2001:DB8:0:23::/64 [170/614400] +via FE80::C801:AFF:FE88:54, FastEthernet1/0 +EX 2001:DB8:F::/64 [170/614400] +via FE80::C801:AFF:FE88:54, FastEthernet1/0 +L FF00::/8 [0/0] +via Null0, receive + +You verify that the problem is solved with a ping from Branch at 2001:db8:0:4::4 to 2001:db8:0:1::1, as shown in Example 17-61. The ping is successful, and the problem is solved. + +Example 17-61 Verifying That the Problem Is Solved with a Successful Ping + +Branch#ping 2001:db8:0:1::1 source 2001:db8:0:4::4 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2001:DB8:0:1::1, timeout is 2 seconds: +Packet sent with a source address of 2001:DB8:0:4::4 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 24/32/44 ms + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 733 + +Trouble Ticket 17-4 + +Problem: A junior administrator has approached you asking for help. He claims that users in BGP autonomous system 65500 are unable to access IPv4 resources in the EIGRP for IPv4 autonomous system 100. However, they can access resources in the OSPFv2 domain. Because you do not have access to any routers in BGP autonomous system 65500 (except for R2), he has asked you for help because he does not know what to do. + +You start by reviewing Figure 17-4 to confirm which local router is running BGP. It is R2. You issue the show bgp ipv4 unicast summary command on R2 to confirm whether R2 has any BGP neighbors. As shown in Example 17-62, 203.0.113.2 is listed as a neighbor, and because the State/PfxRcd column has a number, it is an established neighborship. +To further confirm, you issue the show bgp ipv4 unicast neighbors | include BGP com-mand, as shown in Example 17-63, and the output indicates that 203.0.113.2 is an estab-lished neighbor. + +Example 17-62 Verifying BGP Neighbors + +R2#show bgp ipv4 unicast summary +BGP router identifier 203.0.113.1, local AS number 65500 +BGP table version is 33, main routing table version 33 +4 network entries using 576 bytes of memory +4 path entries using 320 bytes of memory +3/3 BGP path/bestpath attribute entries using 408 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 1304 total bytes of memory +BGP activity 28/18 prefixes, 30/20 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +203.0.113.2 4 65500 496 500 33 0 0 07:26:42 1 + + +Example 17-63 Verifying Established BGP Neighbor + +R2#show bgp ipv4 unicast neighbors | include BGP +BGP neighbor is 203.0.113.2, remote AS 65500, internal link +BGP version 4, remote router ID 192.0.2.1 +BGP state = Established, up for 07:31:19 +BGP table version 33, neighbor version 33/0 +Last reset 07:31:29, due to BGP Notification received of session 1, header syn-chronization problems + +Next you verify whether any routes are being advertised to the neighbor at 203.0.113.2 by issuing the show bgp ipv4 unicast neighbors 203.0.113.2 advertised-routes command. In Example 17-64, you can see that three routes are being advertised to 203.0.113.2 from R2. The routes are 10.1.1.0/24, 10.1.12.0/24, and 10.1.23.0/24. Figure 17-4 indicates that the EIGRP networks are 10.1.14.0/24 and 10.1.4.0/24 and that they are not listed as routes being advertised. + + + + +From the Library of Outcast Outcast +734 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 17-64 Verifying Advertised BGP Routes + +R2#show bgp ipv4 unicast neighbors 203.0.113.2 advertised-routes +BGP table version is 33, local router ID is 203.0.113.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 10.1.1.0/24 +*> 10.1.12.0/24 +*> 10.1.23.0/24 + +10.1.12.1 +0.0.0.0 +0.0.0.0 + +2 32768 ? +0 32768 ? +0 32768 ? + + +Total number of prefixes 3 + +You issue the show ip protocols command on R2, as shown in Example 17-65, to verify the BGP configuration. You notice that there are no filters, no distribute lists, or no route maps applied to neighbor 203.0.113.2 that could be preventing routes from being adver-tised. However, you notice that only OSPF internal routes are being redistributed in the output. You issue the show ip route command on R2, as shown in Example 17-66, and confirm that 10.1.4.0/24 and 10.1.14.0/24 are both external OSPF routes. You conclude that the problem is related to BGP not redistributing OSPF external routes. + +Example 17-65 Verifying BGP Configuration with show ip protocols + +R2#show ip protocols +*** IP Routing is NSF aware *** +...output omitted... +Routing Protocol is "bgp 65500" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +IGP synchronization is disabled +Automatic route summarization is disabled +Redistributing: ospf 1 (internal) + +Neighbor(s): +Address FiltIn FiltOut DistIn DistOut Weight RouteMap +203.0.113.2 +Maximum path: 1 +Routing Information Sources: + +Gateway +203.0.113.2 + +Distance +200 + +Last Update +07:54:48 + +Distance: external 20 internal 200 local 200 + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 735 + +Example 17-66 Verifying IPv4 Routes on R2 + +R2#show ip route +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is 203.0.113.2 to network 0.0.0.0 + +S* 0.0.0.0/0 [1/0] via 203.0.113.2 +10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks +O 10.1.1.0/24 [110/2] via 10.1.12.1, 4d20h, GigabitEthernet0/0 +O E2 10.1.4.0/24 [110/20] via 10.1.12.1, 1d23h, GigabitEthernet0/0 +C 10.1.12.0/24 is directly connected, GigabitEthernet0/0 +L 10.1.12.2/32 is directly connected, GigabitEthernet0/0 +O E2 10.1.14.0/24 [110/20] via 10.1.12.1, 1d23h, GigabitEthernet0/0 +C 10.1.23.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.23.2/32 is directly connected, GigabitEthernet1/0 +192.0.2.0/32 is subnetted, 1 subnets +B 192.0.2.1 [200/0] via 203.0.113.2, 08:00:48 +203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks +C 203.0.113.0/29 is directly connected, GigabitEthernet2/0 +L 203.0.113.1/32 is directly connected, GigabitEthernet2/0 + +On R2, you issue the show run | section router bgp command, as shown in Example 17-67, to verify the BGP configuration. Under the IPv4 address family, you notice that the redistribute ospf 1 command has been issued. However, that only redistributes internal OSPF routes. It does not redistribute OSPF external routes by default. + +Example 17-67 Verifying IPv4 Routes on R2 + +R2#show run | section router bgp +router bgp 65500 +bgp log-neighbor-changes +neighbor 2001:DB8:0:A::A remote-as 65500 +neighbor 203.0.113.2 remote-as 65500 +! +address-family ipv4 +bgp redistribute-internal +redistribute ospf 1 +no neighbor 2001:DB8:0:A::A activate +neighbor 203.0.113.2 activate + + + + +From the Library of Outcast Outcast +736 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +exit-address-family +! +address-family ipv6 +redistribute ospf 1 match internal external 1 external 2 include-connected +bgp redistribute-internal +neighbor 2001:DB8:0:A::A activate +exit-address-family + +Because the routes are external Type 2 OSPF routes, you issue the command redistribute ospf 1 match internal external 2 in IPv4 BGP address family configuration mode, as shown in Example 17-68. You then issue the command show ip protocols to verify that external Type 2 routes are now being redistributed as well. As shown in Example 17-69, they are. + +Example 17-68 Modifying the redistribute Command in IPv4 Address Family Config Mode + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#router bgp 65500 +R2(config-router)#address-family ipv4 unicast +R2(config-router-af)#redistribute ospf 1 match internal external 2 + + +Example 17-69 Verifying Types of OSPF Routes Being Advertised into BGP + +R2#show ip protocols +...output omitted... +Routing Protocol is "bgp 65500" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +IGP synchronization is disabled +Automatic route summarization is disabled +Redistributing: ospf 1 (internal, external 2) + +Neighbor(s): +Address FiltIn FiltOut DistIn DistOut Weight RouteMap +203.0.113.2 +Maximum path: 1 +Routing Information Sources: + +Gateway +203.0.113.2 + +Distance +200 + +Last Update +1d07h + +Distance: external 20 internal 200 local 200 + +You then reissue the show bgp ipv4 unicast neighbors 203.0.113.2 advertised-routes command to verify that 10.1.14.0/24 and 10.1.4.0/24 are being advertised in BGP autono-mous system 65500. As shown in Example 17-70, they are. + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 737 + +Example 17-70 Verifying OSPF Routes Are Advertised to BGP Neighbor + +R2#show bgp ipv4 unicast neighbors 203.0.113.2 advertised-routes +BGP table version is 35, local router ID is 203.0.113.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 10.1.1.0/24 +*> 10.1.4.0/24 +*> 10.1.12.0/24 +*> 10.1.14.0/24 +*> 10.1.23.0/24 + +10.1.12.1 +10.1.12.1 +0.0.0.0 +10.1.12.1 +0.0.0.0 + +2 32768 ? +20 32768 ? +0 32768 ? +20 32768 ? +0 32768 ? + + +Total number of prefixes 5 + +Next you pick up the phone and call the administrator of the other routers in BGP auton-omous system 65500 and confirm that they can access the resources in EIGRP autono-mous system 100. They state that they can; therefore, you have solved the issue. + +Troubleshooting Advanced Redistribution Issues + +When route redistribution is misconfigured, it can lead to issues such as routing loops and suboptimal routing. Suboptimal routing can lead to users experiencing slow connec-tivity, and routing loops can lead to no connectivity. This section explains how you can recognize these issues and the options you have to fix them. + +Troubleshooting Suboptimal Routing Caused by Redistribution + +When redistributing routes from one routing source into another routing source, the original routing source’s information is lost when the seed metric is injected at the redis-tribution point. Therefore, overall network visibility is lost or hidden from the destina-tion routing source. This is not an issue when there is only one point of redistribution between two sources. However, if there are multiple points of redistribution between two sources, as shown in Figure 17-5, the suboptimal path may be chosen to reach routes. + +From R1 and R2, the optimal path to reach 192.168.2.0/24 is from R2 because the 1-Gbps link is much faster than the 10-Mbps link. When you perform redistribution on R1 and R2 into EIGRP, EIGRP does not know that the 10-Mbps or the 1-Gbps link exists in +the OSPF domain. Therefore, if an inappropriate seed metric is used during redistribu-tion on R1 and R2, the traffic from 10.1.1.0/24 destined for 192.168.2.0/24 may take the suboptimal path through R1. However, realize, according to the EIGRP AS, it is the +best path because all it sees is the seed metric and the 1-Gbps and 100-Mbps link in the EIGRP autonomous system. Therefore, if the seed metrics you define are the same on R1 and R2 when you redistribute into EIGRP, the 1-Gbps link in the EIGRP autonomous + + +From the Library of Outcast Outcast +738 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +system is preferred, and traffic goes to R1. Then R1 sends it across the 10-Mbps link to 192.168.2.0/24, which is suboptimal. It works, but it is suboptimal. + + + +R1 +1Gbps 10Mbps 10.1.1.0/24 + + +R3 + +100Mbps + +EIGRP AS 100 +R2 + + +R4 + +1Gbps 192.168.2.0/24 + +OSPF 1 + + +Figure 17-5 Suboptimal Routing Topology + + + + + + + +Key Topic + +You can recognize this issue from a topological diagram in addition to using the tra-ceroute command. In Figure 17-5, if the result of the traceroute from 10.1.1.0/24 to 192.168.2.0/24 goes through R1, suboptimal routing is occurring because of redistribu-tion. + +You can solve this issue by providing different seed metrics on the boundary routers (R1 and R2 in this case) that will ensure a certain path is preferred because it has a lower +overall metric. So, R2’s EIGRP seed metric would have to be significantly lower than R1’s EIGRP seed metric to ensure that R3 chooses the path through R2 even though it is a slower link between R3 and R2 than R3 and R1. The key is to make sure that the traffic avoids the 10-Mbps link. + +Going in reverse, when redistributing from EIGRP into OSPF, the redistributed routes will have a default seed metric of 20 and be classified as E2 routes; therefore, the metric will remain as 20 throughout the OSPF domain. At first, you might think that load balancing will occur from R4 to R1 and R2 when sending traffic from 192.168.2.0/24 to 10.1.1.0/24. You would be correct only if the metrics (forward metric) to reach the ASBRs are +equal as well as the E2 seed metric. In this case, the forward metrics are not equal. The 10-Mbps link has a much higher cost than the 1-Gbps link. Therefore, all the traffic from 192.168.2.0/24 to 10.1.1.0/24 will go through R2 across the 1-Gbps link (lower metric to reach ASBR) in the OSPF domain. However, if the seed metric was set higher than 20 on R2 and left at 20 on R1, R1 will be used as the path because it now has the lower seed metric, but in this case it would be the suboptimal path. Therefore, if the metric type is E2, you can simply make the preferred ASBR advertise the lowest seed metric to ensure that optimal routing is achieved. If you are using a metric type of E1, the cost of the links within the network are added to the seed metric to come up with the overall cost to reach the destination network. Therefore, if suboptimal routing is occurring, you need to determine which seed metrics are most appropriate with E2 to ensure the optimal path is chosen, or use a metric type of E1 so that internal costs are used with the seed metric to +determine the overall cost. + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 739 + +When troubleshooting suboptimal routing caused by redistribution, keep the following in mind: + + +■ Key +Topic +■ + +■ + + +■ + +Based on the topology, be able to recognize that mutual redistribution is occurring at multiple points in the network. + +Based on the connections, be able to recognize the different speeds of the links. + +Based on the routing protocols in use, be able to identify how the seed metric is determined and how it behaves for the different protocols. + +Based on the business requirements, know how to fix the suboptimal routing by manipulating the metrics on the boundary routers with the default-metric command, +the metric parameter in the redistribute command, or within a route map. + + + +Troubleshooting Routing Loops Caused by Redistribution + + + +Key Topic + +Examine Figure 17-6. The 10.1.1.0/24 network is redistributed into the EIGRP autono-mous system, and then it is redistributed into the OSPF domain on R1 and R2. This does +not appear to be an issue; however, it is because of AD. Let’s explore what happens. + + + + +R1 + +RIPv2 + + + +R3 + + +10.1.1.0/24 EIGRP AS 100 +R2 + + +R4 +192.168.2.0/24 + +OSPF 1 + + +Figure 17-6 Routing Loop Routing Topology + +When the 10.1.1.0/24 network is redistributed from RIPv2 into EIGRP autonomous sys-tem 100, it is classified as an external route in the EIGRP autonomous system. R1 and R2 place the route in the routing table with the code D EX and an AD of 170, as shown in Figure 17-7. + +When R1 and R2 redistribute the 10.1.1.0/24 network in the OSPF domain, by default, the Type 5 LSA is advertising 10.1.1.0/24 as an O E2 route, with an AD of 110, as shown in Figure 17-8. Do not forget that it is flooded through the area. Therefore, R1 will receive R2’s LSA and R2 will receive R1’s LSA, which creates the problem. Look closely at R1’s two entries for 10.1.1.0/24. Which one will be preferred? The OSPF route because it has a lower AD. Therefore, R1 points to R2 to reach 10.1.1.0/24. Look closely at R2’s two entries for 10.1.1.0/24. Which one will be preferred? The OSPF route because it has a lower AD. Therefore, R2 points to R1 to reach 10.1.1.0/24. + + + + +From the Library of Outcast Outcast +740 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +D EX 170 10.1.1.0/24 via R3 +RIPv2 + + +R1 + + + + +R3 + + +10.1.1.0/24 EIGRP AS 100 +D EX 170 10.1.1.0/24 via R3 + + +R4 +192.168.2.0/24 + +OSPF 1 + +R2 + + +Figure 17-7 Redistributing the RIPv2 Route into the EIGRP Autonomous System + + + + +D EX 170 10.1.1.0/24 via R3 +RIPv2 + +O E2 110 10.1.1.0/24 +R1 via ASBR R2 + + + +O E2 110 10.1.1.0/24 + + + +R3 + + +10.1.1.0/24 EIGRP AS 100 +D EX 170 10.1.1.0/24 via R3 + + + + + +R2 + + +R4 +O E2 110 +10.1.1.0/24 192.168.2.0/24 +OSPF 1 O E2 110 +10.1.1.0/24 via ASBR R1 + + + +Figure 17-8 Redistributing the RIPv2 Route into the OSPF Domain on R1 and R2 + +Now when traffic is sent from 192.168.2.0/24 to 10.1.1.0/24, it will bounce back and forth between R1 and R2, which is classified as a routing loop. + +However, this scenario gets worse because of how redistribution works. Remember that to redistribute a route from one routing source to another (EIGRP into OSPF), that route must be in the routing table as an entry for the routing source that you are redistributing the route from. + +With that in mind, consider Figure 17-8 again. When R1 and R2 originally learned about the network 10.1.1.0/24 from R3, it was an EIGRP external route. There was no other source of information in the routing table at the time for 10.1.1.0/24; therefore, it was considered the best source and installed in the routing table as an EIGRP route. Because redistribution is occurring from EIGRP into OSPF, the 10.1.1.0/24 network is redistrib-uted from the routing table into the OSPF process and advertised. Now, when R1 and R2 learn about the OSPF 10.1.1.0/24 route from each other, they notice that it is a better source of information because the AD is lower (110) than the one for EIGRP (170) cur-rently in the routing table. Therefore, the OSPF route replaces the EIGRP route. What + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 741 + +happens now? Well, the EIGRP route is no longer in the routing table on R1 and R2. It is still in the EIGRP topology table, but not in the routing table. Therefore, the 10.1.1.0/24 network is no longer available for redistribution into OSPF, and therefore, there are no more Type 5 LSAs to advertise. As a result of this, R1 and R2 have to notify the routers in the OSPF domain that 10.1.1.0/24 no longer exists. When this happens, R1 and R2 no longer have the 10.1.1.0/24 network that they learned via OSPF from each other in the routing table. What does this cause? The EIGRP external route 10.1.1.0/24 is reinstalled in the routing table, and because redistribution from EIGRP into OSPF is occurring, the issue repeats all over again. As you can see, the routing table is not stable, because routes +are inserted then removed and inserted and removed over and over again. You can see this happening with the debug ip routing command, which displays changes as they occur to the routing table. + +Let’s take this even further, examine Figure 17-9, which shows the 10.1.1.0/24 network being redistributed back into the EIGRP autonomous system when the OSPF route is in the routing table on R1 and R2. Now R3 thinks that 10.1.1.0/24 is reachable via the +boundary router between the RIPv2 domain and the EIGRP autonomous system, as well as R1 and R2. So now, additional CPU cycles are being used in addition to memory. + + + + +D EX 170 10.1.1.0/24 via R3 +RIPv2 + +O E2 110 10.1.1.0/24 +R1 via ASBR R2 + + + +O E2 110 10.1.1.0/24 + + + +R3 + + +10.1.1.0/24 EIGRP AS 100 +D EX 170 10.1.1.0/24 via R3 + + + + + +R2 + + +R4 +O E2 110 +10.1.1.0/24 192.168.2.0/24 +OSPF 1 O E2 110 +10.1.1.0/24 via ASBR R1 + + + +Figure 17-9 Redistributing the RIPv2 Route Back into the EIGRP Autonomous System from OSPF + +This is definitely a bad situation to be in. It is recognized through the analysis of a dia-gram. Notice how we could identify this problem without using any show commands. In addition, the symptoms are wide ranging. For example, a user might have a connection from 192.168.2.0/24 to 10.1.1.0/24 for one moment and then the connection is lost, then it is back, then lost, all because the routes are being added and removed over and over again, causing a loop, and then no loop, and so on. Therefore, you need to be able to look at the topology and identify where this type of issue might occur and implement +the necessary measures to stop it from happening. Or, if it is happening, identify why it is happening and propose how to fix it. + +Remember that this issue was caused by AD; 110 is better than 170. Therefore, you need to either lower the AD of the EIGRP routes on R1 and R2 for 10.1.1.0/24 or increase the + + + +From the Library of Outcast Outcast +742 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +AD of the OSPF learned routes on R1 and R2 for 10.1.1.0/24. Your goal is to make sure that the EIGRP learned route is the preferred route. Regardless of what you choose to do, you need to use the distance command on R1 and R2 and specify what the AD will be for the 10.1.1.0/24 network. Because you only want to affect the 10.1.1.0/24 network in this example, you could use an ACL and attach it to the distance command to single out the 10.1.1.0/24 network. If you lower the EIGRP AD, it will need to be 109 or lower, and if you decide to increase the OSPF AD, it will need to be 171 or higher. + +There is another way to solve this issue. You could attach a distribute list to the OSPF process on R1 and R2. When a distribute list is used with OSPF, it can control what routes are installed in the routing table from the OSPF database. Therefore, if you deny the 10.1.1.0/24 route in the OSPF database from being installed in the routing table with a distribute list, the EIGRP route will be installed in the routing table instead. + +And finally, you do not want the routes that are redistributed from EIGRP into OSPF to be redistributed back into the EIGRP autonomous system. This can cause routing issues such as loops, which prevent packets from being correctly delivered to their destination (in addition to wasting CPU and memory resources on various devices in the network). The most robust way to deal with this is route tags. Figure 17-10 shows how R1 and R2 can add a tag (which is just an arbitrary value that can be used to identify the route) when the route is redistributed. This is accomplished with route maps. In this example, when R1 redistributes the 10.1.1.0/24 route into the OSPF domain, it adds a tag of 10. When R2 redistributes the 10.1.1.0/24 route into the OSPF domain, it adds a tag of 20. + + + + + +RIPv2 + + + + +10.1.1.0/24 + +D EX 170 10.1.1.0/24 + + + +R3 + + +EIGRP AS 100 +D EX 170 +10.1.1.0/24 + + +R1 + + +Tag 10 + +Tag 20 R4 + + +R2 + + + + + + + +192.168.2.0/24 + +OSPF 1 + + +Figure 17-10 Adding Tags to Routes During Redistribution + +Example 17-71 displays the commands that you could use to tag the 10.1.1.0/24 routes as they are redistributed on R1 and R2. First you have to define the routes you want to +tag with an ACL or prefix list. Then you create a route map that will have a sequence that matches the ACL or prefix list created, which will then set the desired tag upon a match. In this case, R1 sets a tag of 10, and R2 sets a tag of 20. Do not forget about all the other routes you want to redistribute without a tag. That is what sequence 20 is for in the route map. If you forget it, all other routes are denied and not redistributed. You then attach the route map to the redistribution command. + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 743 + +Example 17-71 Tagging Routes as They Are Being Redistributed + +R1# +ip prefix-list TAG_10.1.1.0/24 seq 5 permit 10.1.1.0/24 +! +route-map REDIS_EIGRP_TO_OSPF permit 10 +match ip address prefix-list TAG_10.1.1.0/24 +set tag 10 +route-map REDIS_EIGRP_TO_OSPF permit 20 +! +router ospf 1 +redistribute eigrp 100 subnets route-map REDIS_EIGRP_TO_OSPF + +R2# +ip prefix-list TAG_10.1.1.0/24 seq 5 permit 10.1.1.0/24 +! +route-map REDIS_EIGRP_TO_OSPF permit 10 +match ip address prefix-list TAG_10.1.1.0/24 +set tag 20 +route-map REDIS_EIGRP_TO_OSPF permit 20 +! +router ospf 1 +redistribute eigrp 100 subnets route-map REDIS_EIGRP_TO_OSPF + +You are not done yet. To prevent R1 and R2 from redistributing the OSPF-learned 10.1.1.0/24 routes with their tags back into EIGRP, you deny the routes based on their tags. As shown in Figure 17-11, on R1 you deny the routes with a tag of 20 from being redistributed into the EIGRP autonomous system, and on R2 you deny the routes with a tag of 10 from being redistributed into the EIGRP autonomous system. + +Do not redistribute anything with a Tag of 20 + + + +D EX 170 10.1.1.0/24 + +RIPv2 + + +O E2 +R1 10.1.1.0/24 Tag 20 + +Tag 10 + + + +R3 + + +10.1.1.0/24 EIGRP AS 100 + + +R4 +Tag 20 192.168.2.0/24 + +OSPF 1 + + + +D EX 170 10.1.1.0/24 + + +R2 + + +O E2 +10.1.1.0/24 Tag 10 + + + +Do not redistribute anything with a Tag of 10 + +Figure 17-11 Deny Routes with Certain Tags During Redistribution + + +From the Library of Outcast Outcast +744 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 17-72 displays the commands that would be used to ensure that R1 and R2 do not redistribute the 10.1.1.0/24 networks back into the EIGRP autonomous system. Notice the very first sequence in this route map. In this case, it is deny, and when deny is used with redistribution, it indicates that whatever matches will not be redistributed. Therefore, R1 will not redistribute from OSPF into EIGRP any routes that have a tag of +20, as shown in sequence 10, and sequence 20 allows all other routes to be redistributed. For R2, it will not redistribute any routes with a tag of 10 from OSPF into EIGRP based on sequence 10, and all other routes will be redistributed based on sequence 20. + +Example 17-72 Using Route Tags to Prevent Routes from Being Reinjected + +R1# +route-map REDIS_OSPF_INTO_EIGRP deny 10 +match tag 20 +route-map REDIS_OSPF_INTO_EIGRP permit 20 +! +router eigrp 100 +redistribute ospf 1 metric 100000 100 255 1 1500 route-map REDIS_OSPF_INTO_EIGRP + +R2# +route-map REDIS_OSPF_INTO_EIGRP deny 10 +match tag 10 +route-map REDIS_OSPF_INTO_EIGRP permit 20 +! +router eigrp 100 +redistribute ospf 1 metric 100000 100 255 1 1500 route-map REDIS_OSPF_INTO_EIGRP + +So, to wrap up our coverage on advanced redistribution scenarios, keep these points in mind: + +■ Internal prefix information should always be preferred over external prefix informa-tion. + +■ Prefixes should never be redistributed back into a routing domain that they were originally redistributed from. + +■ A topological diagram is mandatory if you expect to solve the issues quickly and efficiently. + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 17: Troubleshooting Redistribution 745 + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 17-3 lists a reference of these key topics and the page numbers on which each is found. + +Table 17-3 Key Topics for Chapter 17 Key +Topic Key Topic Element Description Page Number + + +Paragraph + +List + +List + +Table 17-2 + +Section + +Section + +Section + +Section + +List + +Describes the redistribution process 700 + +Displays the three methods that can be used to 701 configure a seed metric +Displays the prerequisites for redistributing a route 702 + +Troubleshooting targets for route redistribution 702 + +Troubleshooting redistribution into RIP 703 + +Troubleshooting redistribution into EIGRP 706 + +Troubleshooting redistribution into OSPF 710 + +Troubleshooting redistribution into BGP 715 + +Identifies what to look out for when troubleshooting 718 redistribution that uses route maps + +Paragraph Describes how to prevent suboptimal routing caused 738 by redistribution + +List + + +Section + +Outlines what you should review when 739 troubleshooting suboptimal routing issues that were caused by redistribution +Troubleshooting routing loops caused by 739 redistribution + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +redistribution, boundary router, metric, seed metric, subnets keyword, Type 5 LSA, ASBR, routing loop, single-point redistribution, multipoint redistribution, route tag, administrative distance + + +From the Library of Outcast Outcast +746 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Command Reference to Check Your Memory + +This section includes the most important show commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 17-4 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot the topics and concepts covered in this chapter. + +Table 17-4 show commands + +Task Command Syntax + +Displays the IPv4 sources of routing information that are being redistributed into the various IPv4 routing protocols enabled on the device. +Displays the IPv6 sources of routing information that are being redistributed into the various IPv6 routing protocols enabled on the device. +For redistribution, it shows which routes have been redistributed into the RIPv2 process on the boundary router. +For redistribution, it shows which IPv4 routes have been redistributed into the EIGRP for IPv4 process on the boundary router. +For redistribution, it shows which IPv6 routes have been redistributed into the EIGRP for IPv6 process on the boundary router. + +show ip protocols + + +show ipv6 protocols + + +show ip rip database + + +show ip eigrp topology + + +show ipv6 eigrp topology + +Shows which IPv4 routes have been redistributed into the show ip ospf database OSPFv2 process. They are represented as Type 5 or Type +7 LSAs. + +Shows which IPv6 routes have been redistributed into the show ipv6 ospf database OSPFv3 process. They are represented as Type 5 or Type +7 LSAs. + +Displays the IPv4 and IPv6 BGP learned routes. Routes show bgp all originally learned via redistribution have a question mark +(?) in the Path column. + +Displays a router’s BGP router ID, autonomous system show bgp ipv4 unicast summary number, information about the BGP’s memory usage, and +summary information about IPv4 unicast BGP neighbors. + +Displays detailed information about all the IPv4 BGP show bgp ipv4 unicast neighbors neighbors of a router. + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Troubleshooting BGP Neighbor Adjacencies: This section examines issues that may prevent a BGP neighbor relationship from forming, how you can recognize them, and how you can troubleshoot them. Although it centers primarily on IPv4 unicast BGP, the same issues will arise with IPv6 unicast BGP neighbor relationships. +■ Troubleshooting BGP Routes: This section focuses on issues that may prevent BGP routes from being learned or advertised, how you can recognize them, and how you can troubleshoot them. Although it focuses mostly on IPv4 unicast BGP, the same issues will arise with IPv6 unicast BGP routes as well. +■ Troubleshooting BGP Path Selection: This section explains how BGP determines the best path to reach a destination network and the importance of under-standing how this process works for troubleshooting purposes. +■ Troubleshooting BGP for IPv6: This section dis-cusses the methods needed to successfully trouble-shoot additional issues related to BGP for IPv6 that are not seen with BGP for IPv4. +■ BGP Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a struc-tured troubleshooting process to solve a reported problem. +■ MP-BGP Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a report-ed problem. + + + + + +From the Library of Outcast Outcast +CHAPTER 18 + + + + + + +Troubleshooting BGP + + +Border Gateway Protocol (BGP) is the protocol of the Internet. It has been designed to exchange routing information between different autonomous systems (networks under different administrative control). That is why it is classified as an Exterior Gateway Protocol (EGP). It makes best path decisions based on attributes such as local prefer-ence, length of autonomous system path, and even BGP router ID (RID), instead of band-width like Open Shortest Path First (OSPF), bandwidth and delay like Enhanced Interior Gateway Routing Protocol (EIGRP), or router hops like Routing Information Protocol (RIP). BGP is the most scalable, robust, controllable protocol. However, with that comes a price. That price is mistakes that lead to issues that you have to troubleshoot. + +BGP will primarily be used by organizations to connect to their Internet service provider (ISP). If not, static routes are used. However, ISPs use BGP extensively to share Internet routes with each other. The 300-135 TSHOOT exam is not based on ISP-to-ISP BGP con-nectivity. It is based on enterprise-to-ISP connectivity. Therefore, you need to focus your efforts on troubleshooting the basics of BGP for IPv4 and IPv6 connectivity and route advertising. + +In this chapter, you learn the various issues that you may face when trying to establish an IPv4 and IPv6 External Border Gateway Protocol (eBGP) and Internal Border Gateway Protocol (iBGP) neighbor adjacency and how you can identify them and troubleshoot them. The chapter also covers issues that may arise when exchanging IPv4 and IPv6 eBGP and iBGP routes and how you can recognize them and troubleshoot them successfully. Because BGP is classified as a path vector protocol and its decisions are based on attri-butes, you need to be very familiar with the decision-making process that BGP uses to be an efficient troubleshooter. Therefore, you will spend time exploring this process in the chapter as well. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 18-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + + + + + +From the Library of Outcast Outcast +750 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 18-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Troubleshooting BGP Neighbor Adjacencies + +Troubleshooting BGP Routes + +Troubleshooting BGP Path Selection + +Troubleshooting BGP for IPv6 + +Questions +1–5 + +6–10 + +11 + +12–13 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which commands enable you to identify the IPv4 unicast BGP neighbor adjacencies that have been formed? (Choose two answers.) +a. show ip route bgp + +b. show bgp ipv4 unicast + +c. show bgp ipv4 unicast summary + +d. show bgp ipv4 unicast neighbors + +2. In the output of show bgp ipv4 unicast summary, how can you determine whether a neighbor relationship is successfully established? +a. The neighbor is listed in the output. + +b. The version column has a 4 in it. + +c. The State/PfxRcd column has a number in it. + +d. The State/PfxRcd column has the word Active in it. + +3. Which of the following are reasons as to why a BGP neighbor relationship might not form? (Choose two answers.) +a. The BGP timers are mismatched. + +b. The BGP packets are sourced from wrong IP. + +c. The neighbor is reachable via a default route. + +d. The network command is misconfigured. + +4. Which TCP port number is used to form BGP sessions? + +a. 110 + +b. 123 + +c. 179 + +d. 443 + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 751 + +5. What is the BGP state of a neighbor if a TCP session cannot be formed? + +a. Open + +b. Idle + +c. Active + +d. Established + +6. What could prevent a route from being advertised to another BGP router? (Choose three answers.) + +a. Mismatched timers + +b. Split-Horizon rule + +c. Missing network mask command + +d. Route Filtering + +7. Which command enables you to verify the IPv4 BGP routes that have been learned from all BGP neighbors? + +a. show ip route bgp + +b. show bgp ipv4 unicast + +c. show bgp ipv4 unicast summary + +d. show bgp ipv4 unicast neighbors + +8. What occurs when the next hop of a BGP-learned route is not reachable? + +a. The route is discarded. + +b. The route is placed in the BGP table and advertised to other neighbors. + +c. The route is placed in the BGP table and not marked as valid. + +d. The route is placed in the BGP table and the routing table. + +9. Which successfully describes the BGP split-horizon rule? + +a. A BGP router that receives a BGP route via an iBGP peering shall not advertise that route to another router that is an iBGP peer. + +b. A BGP router that receives a BGP route via an eBGP peering shall not advertise that route to another router that is an iBGP peer. + +c. A BGP router that receives a BGP route via an eBGP peering shall not advertise that route to another router that is an eBGP peer. + +d. A BGP router that receives a BGP route via an iBGP peering shall discard the route. + + + + + + +From the Library of Outcast Outcast +752 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10. Which administrative distances are correct? (Choose two answers.) + +a. 20 for eBGP + +b. 20 for iBGP + +c. 200 for eBGP + +d. 200 for iBGP + +11. Which of the following correctly identify the order of BGP attributes for the best path decision process? + +a. Weight, local preference, route origin, autonomous system Path, Origin Code, MED + +b. Autonomous system path, origin code, MED, weight, local preference, route ori-gin + +c. Local preference, weight, route origin, autonomous system path, origin code, MED + +d. Weight, local preference, route origin, autonomous system path, MED, origin code + +12. What must be done when using MP-BGP? (Choose two answers.) + +a. The IPv6 neighbors need to be activated in address family configuration mode. + +b. The IPv6 neighbors need to be activated in router configuration mode. + +c. The IPv6 neighbors need to be defined in router configuration mode. + +d. The IPv6 neighbors need to be defined in address family configuration mode. + +13. Which command enables you to verify the IPv6 unicast BGP routes that have been learned? + +a. show bgp ipv6 unicast + +b. show bgp ipv6 unicast summary + +c. show bgp ipv6 unicast neighbor + +d. show ipv6 route bgp + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 753 + +Foundation Topics + + +Troubleshooting BGP Neighbor Adjacencies + +BGP establishes neighbor adjacencies manually. This is unlike EIGRP and OSPF, where you enable the process on an interface and neighbor adjacencies are formed dynami-cally. As a result, BGP configuration is more prone to human error, which leads to greater efforts during the troubleshooting process. In addition, there are two flavors of BGP, Internal BGP (iBGP) and External BGP (eBGP). Being able to understand the differences between the two and recognize issues related to each is important for troubleshooting. + +This section covers how BGP neighbor relationships are formed and how to recognize issues that would prevent the neighbor relationships from forming. + +To verify IPv4 unicast BGP neighbors, you can use two show commands: show bgp ipv4 unicast summary (which is the same as using the old show ip bgp summary command), and show bgp ipv4 unicast neighbors (which is the same as using the old show ip bgp neighbors command). For initial verification of neighbors, it is best to use show bgp ipv4 unicast summary because it provides a condensed output. The output of show bgp ipv4 unicast neighbors is very verbose and is not needed for initial neighbor verification. Example 18-1, which is a sample output of the show bgp ipv4 unicast summary com-mand, indicates that R1 has two BGP neighbors. One is at IP address 10.1.12.2 and the other is at 10.1.13.3. They are both eBGP neighbors because their autonomous system number does not match the local autonomous system number. Focus your attention on the State/PfxRcd column. If there is a number in this column (as in this case), it means that we have successfully established a BGP neighbor relationship. If you see Idle or Active, there is a problem forming the neighbor relationship. + +Example 18-1 Verifying BGP Neighbors with show bgp ipv4 unicast summary +Key +Topic R1#show bgp ipv4 unicast summary +BGP router identifier 10.1.13.1, local AS number 65501 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +10.1.12.2 4 65502 16 16 +10.1.13.3 4 65502 15 12 + +1 0 0 00:11:25 0 +1 0 0 00:09:51 0 + + +In addition, when a neighbor relationship is formed, a syslog message is generated similar to the following: + +%BGP-5-ADJCHANGE: neighbor 10.1.12.2 Up +Here is a listing of reasons why a BGP neighbor relationship might not form: + +■ Interface is down: The interface has to be up/up. +Key +Topic ■ Layer 3 connectivity is broken: You need to be able to reach the IP address you are +trying to form the adjacency with. + + +From the Library of Outcast Outcast +754 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Path to neighbor is via default route: You must be able to reach the neighbor using a route other than the default route. + +■ Neighbor does not have a route to the local router: Both routers forming a BGP peering must have routes to each other. + +■ Incorrect neighbor statement: The IP address and autonomous system number in the neighbor ip_address remote-as as_number statement must be accurate. + +■ ACLs: An access control list (ACL) or a firewall is blocking TCP port 179. + +■ BGP packets sourced from wrong IP address: The source IP of an inbound BGP packet must match the local neighbor statement. + +■ TTL of BGP packet expires: Peer is further away than permitted + +■ Mismatched Authentication: Both routers must agree on authentication parameters + +■ Misconfigured Peer Group: Peer groups simplify repetitive BGP configurations; however, if not carefully implemented can prevent neighbor relationships from form-ing or routes from being learned. + +■ Timers: Timers do not have to match; however, if the minimum holddown from neighbor option is set, this could prevent a neighbor adjacency. + +When troubleshooting BGP neighbor adjacencies, you need to be able to identify these different issues and understand the reasons why they occur. Let’s look at them individu-ally. + +Interface Is Down + +The interface with the IP address that is being used to form BGP neighbor relationships must be up/up. Let’s be clear: This could be a physical or logical interface. Remember that you can use a loopback interface to source BGP packets. This practice is popular when you have redundant paths between neighbors. In such a case, if one path fails, for example a local physical interface goes down, the neighbor relationship will still be avail-able using another local physical interface since a loopback interface is the source and destination of the packets. Therefore, if you are sourcing BGP packets with the IP address of Loopback 0, the loopback interface has to be up/up as well as any physical interface that can get you to the IP address you are trying to form the neighbor relationship with. As you have seen numerous times, you can verify the status of an interface with the show ip interface brief command. + +Layer 3 Connectivity Is Broken + +You do not have to be directly connected to form a BGP neighbor relationship or in the same subnet; however, you do have to have Layer 3 connectivity. To verify Layer 3 con-nectivity, you use the ping command. If the ping is successful, you have Layer 3 connec-tivity. Note that for a router to have Layer 3 connectivity, it needs to have a route in the routing table that will point it in the right direction. If no route to the neighbor exists, a neighbor relationship cannot form. + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 755 + +When reviewing the output of show bgp ipv4 unicast summary in Example 18-2, you can see in the State/PfxRcd field it states Idle. This state occurs when the local router is not able to make a TCP connection with the neighbor. In this example, it is the router at 2.2.2.2 R5 is trying to form an adjacency with. Reviewing the routing table on R5 with the show ip route 2.2.2.2 255.255.255.255 command and pinging 2.2.2.2 from R5, as shown in Example 18-3, proves that Layer 3 connectivity does not exist. It is a good idea to specify the source when pinging. The source will be the IP address of the local device you plan on making the BGP peering with. + +Example 18-2 Verifying BGP State with show bgp ipv4 unicast summary + +R5#show bgp ipv4 unicast summary +BGP router identifier 10.1.45.5, local AS number 65502 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2.2.2.2 4 65502 0 0 1 0 0 never Idle + + +Example 18-3 Verifying Whether a Route Exists to the Neighbor and Whether a Ping Is Successful + +R5#show ip route 2.2.2.2 255.255.255.255 +% Network not in table + +R5#ping 2.2.2.2 source 5.5.5.5 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) + + +Path to Neighbor Is via Default Route + + + +Key Topic + +Continuing with the previous discussion on Layer 3 connectivity being broken, Example 18-4 shows that no route to 2.2.2.2 exists; however, the ping to 2.2.2.2 is successful. This +is because there is a default route in the routing table on R5, as shown in Example 18-5. + + +Example 18-4 No Route to Neighbor, but Ping Is Successful + +R5#show ip route 2.2.2.2 255.255.255.255 +% Network not in table + +R5#ping 2.2.2.2 source 5.5.5.5 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: +Packet sent with a source address of 5.5.5.5 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 84/91/104 ms + + + + +From the Library of Outcast Outcast +756 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 18-5 Verifying Default Route Exists in Routing Table + +R5#show ip route +...output omitted... + +Gateway of last resort is 10.1.45.4 to network 0.0.0.0 + +D*EX 0.0.0.0/0 [170/3328] via 10.1.45.4, 00:08:37, GigabitEthernet1/0 +3.0.0.0/32 is subnetted, 1 subnets +D 3.3.3.3 [90/131072] via 10.1.45.4, 00:53:34, GigabitEthernet1/0 +4.0.0.0/32 is subnetted, 1 subnets +D 4.4.4.4 [90/130816] via 10.1.45.4, 00:53:19, GigabitEthernet1/0 +...output omitted... + +Even though we can reach the neighbor via the default route, BGP does not consider it a valid route to form an adjacency. When looking at the output of show bgp ipv4 unicast summary on R5, in Example 18-6, you can see that the state is Idle, which indicates that we cannot form a TCP session. + +Example 18-6 Verifying BGP State on R5 with show bgp ipv4 unicast summary + +R5#show bgp ipv4 unicast summary +BGP router identifier 10.1.45.5, local AS number 65502 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2.2.2.2 4 65502 0 0 1 0 0 never Idle + + +Neighbor Does Not Have a Route to the Local Router + +So far, we have seen that the local router will display a state of idle when it does not have a route to the IP address they are trying to peer with. However, idle will also appear on a router when the neighbor does not have a route back to the local router. In Example 18-7, you can see that the router trying to form a BGP peering with R5 (it is R2) also displays a state of idle even though it has a route to 5.5.5.5, as shown in Example 18-7 also. The idle state is because the routers cannot form the TCP session. + +Example 18-7 Verifying BGP State on R2 and Route to 5.5.5.5 + +R2#show bgp ipv4 unicast summary +BGP router identifier 2.2.2.2, local AS number 65502 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +5.5.5.5 4 65502 0 0 +10.1.12.1 4 65501 2 2 + +1 0 0 00:00:13 Idle +1 0 0 00:00:12 0 + + +R2#show ip route 5.5.5.5 255.255.255.255 + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 757 + +Routing entry for 5.5.5.5/32 +Known via "eigrp 100", distance 90, metric 131072, type internal +Redistributing via eigrp 100 +Last update from 10.1.24.4 on GigabitEthernet2/0, 00:23:58 ago +Routing Descriptor Blocks: +* 10.1.24.4, from 10.1.24.4, 00:23:58 ago, via GigabitEthernet2/0 +Route metric is 131072, traffic share count is 1 +Total delay is 5020 microseconds, minimum bandwidth is 1000000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 2 + + +Incorrect neighbor Statement + + + +Key Topic + +To form a BGP peering, you use the neighbor ip_address remote-as as_number com-mand in BGP configuration mode. Example 18-8 displays two neighbor remote-as com-mands on R2. The neighbor 5.5.5.5 remote-as 65502 command forms an iBGP peering, and neighbor 10.1.12.1 remote-as 65501 forms an eBGP peering. The iBGP peering is established because the remote-as 65502 matches the local autonomous system number used to create the BGP process (router bgp 65502). The eBGP peering is established because the remote-as 65501 is different from the local autonomous system number +used to create the BGP process (router bgp 65502). + + +Example 18-8 Verifying neighbor remote-as Commands on R2 + +R2#show run | s router bgp +router bgp 65502 +bgp log-neighbor-changes +neighbor 5.5.5.5 remote-as 65502 +neighbor 5.5.5.5 update-source Loopback0 +neighbor 10.1.12.1 remote-as 65501 + +There are two very important parts to this command: 1) the address of the peer you will form the peering with; 2) the autonomous system that the peer is in. If you make a mis-take with either of these, you will see either the active or idle state. + +As we have discussed, if there is no route for the IP address you specify, the state will be idle. However, if a route is found and a three-way TCP handshake is complete, an open message is sent. If there is no response to the open message, the state will be active. + +If the autonomous system number specified does not match the peer’s autonomous sys-tem number, the state will toggle between idle and active. + +You can verify the state of the TCP session on the routers using the show tcp brief all command. In Example 18-9, you can see that R2 has an established TCP session with a device at 5.5.5.5 and another device at 10.1.12.1. + + + + + + +From the Library of Outcast Outcast +758 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +R2 + +Example 18-9 Verifying State of TCP Sessions + +R2#show tcp brief all + +TCB +68DD357C +68DD24DC + +Local Address +10.1.12.2.179 +2.2.2.2.179 + +Foreign Address +10.1.12.1.35780 +5.5.5.5.45723 + +(state) +ESTAB +ESTAB + + + +BGP Packets Sourced from Wrong IP Address + +In a redundant topology, a BGP router will have multiple active IP addresses configured across its various interfaces. Figure 18-1 displays two BGP autonomous systems. Notice that R2, R3, and R4 could form a BGP peering with each other using any physical inter-face because of the multiple paths. For example, R2 could form a peering with R4 over the direct connection or through the connection via R3. + + + + + + +10.1.1.0/26 10.1.1.64/26 +10.1.1.128/26 R1 10.1.1.192/26 + +Gi0/0Gi2/0Peering Peering +Gi0/0 +R4 R5 + + + + +10.1.5.0/24 + + + +R3 +BGP AS 65501 BGP AS 65502 + +Figure 18-1 Sample BGP autonomous system with redundancy + + + + + + + + + + + + + + + +Key Topic + +When you issue the neighbor ip_address remote-as as_number command on a router, the address specified is used by the router to determine whether the BGP open message came from a router it should establish a BGP peering with. The BGP open message will have a source IP address, and the source IP address is compared with the address in the local neighbor remote-as command. If they match, a BGP peering is formed, if not, no BGP peering is formed. The source address is based on the exit interface of the router sending the BGP open message. Therefore, if R2 sends the BGP open message from Gi2/0 to R4, R4 needs to have a neighbor statement with R2’s Gi2/0 IP address. Now, if the link between R2 and R4 fails, R2 and R4 can still peer using the links through R3. However, now R2 sends the BGP open message with the source IP of Gi0/0, but R4’s neighbor remote-as statement is using the Gi2/0 IP address of R2 still, and as a result, no BGP peering is formed because the BGP packets are sourced from the wrong IP address. + +To control the IP address that is used when sending BGP messages, you use the neighbor ip_address update-source interface_type interface_number command. Example 18-10 displays the output of show run | section router bgp on R2. Notice how the peering with R4 is using the address 4.4.4.4 (which is a loopback interface on R4) and all BGP messages sent to 4.4.4.4 will use the IP address of loopback 0 which is 2.2.2.2, as shown in Example +18-10 as well. + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 759 + +Example 18-10 Verifying State of TCP Sessions + +R2#show run | section router bgp +router bgp 65502 +bgp log-neighbor-changes +neighbor 4.4.4.4 remote-as 65502 +neighbor 4.4.4.4 update-source Loopback0 +neighbor 10.1.12.1 remote-as 65501 + +R2#show ip interface brief | include Loopback +Loopback0 2.2.2.2 YES manual up up + +It is imperative that R4 is configured appropriately as well. In this case, R4 would need to have a neighbor remote-as statement using R2’s address of 2.2.2.2 in addition to a neigh-bor statement with the update-source option that allows it to control the source address of BGP messages sent to R2. Example 18-11 displays the appropriate configuration on R4 to ensure that a BGP peering is successful. + +Example 18-11 Verifying that R4’s BGP Configuration Mirrors R2 + +R4#show run | section router bgp +router bgp 65502 +bgp log-neighbor-changes +neighbor 2.2.2.2 remote-as 65502 +neighbor 2.2.2.2 update-source Loopback0 + +R4#show ip interface brief | include Loopback +Loopback0 4.4.4.4 YES manual up up + + +ACLs + +BGP uses TCP port 179 to establish TCP sessions. The TCP session is then used to form the BGP peering. If there is an access control list (ACL) configured that blocks TCP +port 179 anywhere in the path between the routers attempting to form a BGP peering, the peering will not happen. In Example 18-12, R4 (refer to Figure 18-1) has ACL 100 attached to interface Gig0/0, which denies packets sourced or destined to port 179 (BGP). As a result, a BGP peering between R2 and R5 is not possible as the packets relating to BGP port 179 are being denied. At the bottom of Example 18-12, the state is idle on R5 because the TCP session cannot be established with the neighbor at 2.2.2.2 because R4 is denying TCP traffic related to port 179. + +Example 18-12 Verifying ACLs Blocking BGP Packets and the State of R5’s Neighbor Relationship + +R4#show access-lists +Extended IP access list 100 +10 deny tcp any any eq bgp +20 deny tcp any eq bgp any +30 permit ip any any + + +From the Library of Outcast Outcast +760 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +R4#show ip interface gigabitEthernet 0/0 | include access list +Outgoing access list is 100 +Inbound access list is not set + +R5#show bgp ipv4 unicast summary +BGP router identifier 10.1.45.5, local AS number 65502 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2.2.2.2 4 65502 0 0 1 0 0 00:02:24 Idle + + + +Key Topic + +In Example 18-12, the access list is denying BGP packets sourced or destined to port 179. However, what if the ACL were only blocking BGP port 179 packets in one direction? For example, the entry was only deny tcp any any eq bgp while still being applied to Gig0/0 outbound. This means that only packets destined to port 179 outbound on Gig0/0 will be blocked. What if they were sourced from 179 going outbound instead? They would no longer be blocked. So, in this case, if you could control who the server and cli-ents are for the BGP TCP sessions, you could still form the BGP TCP session. + +That’s right, BGP sessions are a server/client relationship. One router is using port 179 (server), and the other router is using an ephemeral port (client). By default, both routers will try to establish a TCP session using the three-way handshake because both routers will send a TCP syn packet sourced from an ephemeral port and destined to port 179. They both respond with a syn/ack sourced from 179 destined to the ephemeral port, and then both send an ack sourced from the ephemeral port destined to port 179. This +causes two BGP sessions between the devices when there can only be one. This situation is called a BGP connection collision, and BGP will sort it out automatically. In a nutshell, the router with the higher BGP RID becomes the server. + +If you want to avoid this issue, you can control who the server and client are right from the start by using the neighbor ip_address transport connection-mode {active | passive} command. By specifying active, you are indicating that you want the router to actively initiate the TCP session; therefore, active means client. By specifying passive, you are indicating that you want the router to passively wait for another router to initiate the TCP session; therefore, passive means server. + +Using the command show bgp ipv4 unicast neighbor will show the local and remote port numbers that are being used. If the local port is port 179 and the remote port is an ephemeral port, the local router is the server. If the remote port is 179 and the local port is an ephemeral port, the local router is the client. In Example 18-13, the command show bgp ipv4 unicast neighbors | i ^BGP neighbor|Local port|Foreign port was used to just display R2’s neighbors along with the local port number and the foreign port number. Notice how R2 is the client for the TCP sessions with R1 (1.1.1.1), R4 (4.4.4.4), and R5 (5.5.5.5) because the local port is a random port number. R2 is the server for the TCP ses- +sion with R3 because the local port is the BGP port number of 179. + + + + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 761 + +Example 18-13 Verifying Local and Foreign BGP Port Numbers + +R2#show bgp ipv4 unicast neighbors | i ^BGP neighbor|Local port|Foreign port +BGP neighbor is 1.1.1.1, remote AS 65501, external link +Local host: 2.2.2.2, Local port: 23938 +Foreign host: 1.1.1.1, Foreign port: 179 +BGP neighbor is 3.3.3.3, remote AS 65502, internal link +Local host: 2.2.2.2, Local port: 179 +Foreign host: 3.3.3.3, Foreign port: 45936 +BGP neighbor is 4.4.4.4, remote AS 65502, internal link +Local host: 2.2.2.2, Local port: 34532 +Foreign host: 4.4.4.4, Foreign port: 179 +BGP neighbor is 5.5.5.5, remote AS 65502, internal link +Local host: 2.2.2.2, Local port: 49564 +Foreign host: 5.5.5.5, Foreign port: 179 + + +TTL of BGP Packet Expires + +By default, an eBGP peering occurs between directly connected routers. This means the routers forming the eBGP peering are expected to be within one router hop of each other. With an iBGP peering, the routers can be up to 255 router hops from each other and still form a peering. Example 18-14 shows the output of show bgp ipv4 unicast neighbors | include BGP neighbor|TTL, which displays that the eBGP neighbor at 10.1.12.1 must be reachable in 1 router hop, and the iBGP neighbor at 5.5.5.5 can be up to 255 hops away. +If the neighbor is not reachable in the number of hops listed, the BGP packet expires, and no neighbor relationship is formed. + +Example 18-14 Verifying the TTLs of eBGP and iBGP Packets + +R2#show bgp ipv4 unicast neighbors | include BGP neighbor|TTL +BGP neighbor is 5.5.5.5, remote AS 65502, internal link +Minimum incoming TTL 0, Outgoing TTL 255 +BGP neighbor is 10.1.12.1, remote AS 65501, external link +Minimum incoming TTL 0, Outgoing TTL 1 + +If the TTL is not large enough to support the distance required to form a BGP peering, the packet will be discarded. For example, let’s form an eBGP peering between R1 and R2 in Figure 18-2 using their loopback interfaces. R1 has a loopback interface of 1.1.1.1, and R2 has a loopback interface of 2.2.2.2. Layer 3 connectivity has been tested with a ping, and it is successful. It is also not via a default route. + +Example 18-15 displays the configuration of R1 and R2. Notice that R1 is peering with R2 using the neighbor address 2.2.2.2 (R2 loopback) and that source address of loopback 0 (1.1.1.1). R2 is peering with R1 using the neighbor address 1.1.1.1 (R1 loopback) and source address of loopback 0 (2.2.2.2). Note that these loopback interfaces are not direct-ly connected (one hop away), and because it is an eBGP neighbor relationship, we expect the peering to fail. + + + + +From the Library of Outcast Outcast +762 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Lo:2.2.2.2 + +Gi1/0 R2 Gi2/0 + + +10.1.1.0/26 10.1.1.64/26 10.1.1.128/26 10.1.1.192/26 + + +Gi1/0 + +R1 +Lo:1.1.1.1 + +Gi0/0 + +Gi0/0 +R4 R5 +10.1.5.0/24 + + + +R3 +BGP AS 65501 BGP AS 65502 + +Figure 18-2 Forming BGP Peering Between R1 and R2 Using Loopback Interfaces + +Example 18-15 Verifying BGP Configuration on R1 and R2 + +R1#show run | s router bgp +router bgp 65501 +bgp log-neighbor-changes +neighbor 2.2.2.2 remote-as 65502 +neighbor 2.2.2.2 update-source Loopback0 +neighbor 10.1.13.3 remote-as 65502 + +R2#show run | s router bgp +router bgp 65502 +bgp log-neighbor-changes +neighbor 1.1.1.1 remote-as 65501 +neighbor 1.1.1.1 update-source Loopback0 +neighbor 5.5.5.5 remote-as 65502 +neighbor 5.5.5.5 update-source Loopback0 + +Reviewing the output of show bgp ipv4 unicast summary, as shown in Example 18-16, clearly indicates that the peering is not forming as both routers are in the idle state. This is a result of the eBGP peers addresses not being directly connected (one router hop). + +Example 18-16 Verifying BGP States on R1 and R2 + +R1#show bgp ipv4 unicast summary +BGP router identifier 10.1.13.1, local AS number 65501 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2.2.2.2 4 65502 0 0 1 0 0 never Idle +10.1.13.3 4 65502 36 35 1 0 0 00:29:49 0 + +R2#show bgp ipv4 unicast summary + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 763 + +BGP router identifier 2.2.2.2, local AS number 65502 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +1.1.1.1 4 65501 0 0 1 0 0 never Idle +5.5.5.5 4 65502 27 26 1 0 0 00:20:52 0 + + + +Key Topic + +To solve this issue with eBGP neighbors, you can modify the TTL of eBGP packets using the neighbor ip_address ebgp-multihop [TTL] command. In this case, two would be enough to solve the issue. Therefore, on R1, you can type neighbor 2.2.2.2 ebgp-multihop 2, and on R2, you can type neighbor 1.1.1.1 ebgp-multihop 2. As you can see in Example 18-17, it now states on R2 that neighbor 1.1.1.1 can be up to two hops away and that the +peering is established, as shown in the output of show bgp ipv4 unicast summary. + + +Example 18-17 Verifying Modified TTLs of eBGP Packets + +R2#show bgp ipv4 unicast neighbors | include BGP neighbor|TTL +BGP neighbor is 1.1.1.1, remote AS 65501, external link +External BGP neighbor may be up to 2 hops away. +BGP neighbor is 5.5.5.5, remote AS 65502, internal link +Minimum incoming TTL 0, Outgoing TTL 255 + +R2#show bgp ipv4 unicast summary +BGP router identifier 2.2.2.2, local AS number 65502 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +1.1.1.1 4 65501 2 4 +5.5.5.5 4 65502 38 37 + +1 0 0 00:00:04 0 +1 0 0 00:30:57 0 + + + +Mismatched Authentication + +BGP supports message digest 5 (MD5) authentication between peers. Like all discussions on authentication, if any of the parameters do not match, a peering will not form. If you have syslog messaging turned on, a BGP authentication mismatch will generate a syslog message from the TCP facility, as follows: + +%TCP-6-BADAUTH: No MD5 digest from 2.2.2.2(179) to 1.1.1.1(45577) tableid – 0 In addition, the BGP state will be idle, as shown in Example 18-18. +Example 18-18 Verifying Neighbor State With Mismatched Authentication + +R1#show bgp ipv4 unicast summary +BGP router identifier 1.1.1.1, local AS number 65501 +BGP table version is 1, main routing table version 1 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +2.2.2.2 4 65502 0 0 +10.1.13.3 4 65502 7 5 + +1 0 0 00:02:49 Idle +1 0 0 00:02:48 0 + + + +From the Library of Outcast Outcast +764 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Misconfigured Peer Groups + +When a BGP-enabled router needs to send updates, it will build a separate update for each of the neighbors it has. When a router has a large number of BGP neighbors, this can have a significant impact on the routers CPU. To conserve processing power, you can implement BGP peer groups. With BGP peer groups, the router only has to run the BGP update for the entire group instead of on a neighbor-by-neighbor basis. However, even though the update is run only once, the TCP transmission has to occur on a per-neighbor basis. In addition to saving CPU cycles, peer groups allow you to type or copy and paste less. Example 18-19 displays a sample peer group configuration. When troubleshooting peer group issues, you need to look out for a few general things: + +■ You forgot to associate the neighbor ip address with the peer group: Once the peer group is created, you need to use the neighbor ip_address peer-group peer_ group_name command to associate the neighbor with the configurations in the peer group. If you forget to do this, the neighbor IP address is not using the configs in the peer group. It will be using the BGP configs outside the peer group, which could prevent a neighbor relationship from forming. + +■ The peer group is not configured correctly: It is possible that you overlooked the fact that what works for one neighbor might not work for the other. For example, using an update source of Loopback 0 may work well for the iBGP peer but not for the eBGP peer. + +■ The route filter applied to the group is not appropriate for all the peers: The filter applied via a route map or any other means may not provide the result you expect on all the routers. Be careful with filters and make sure that they produce the desired result for all neighbors in the peer group. + +■ Order of operations produces undesired result: If there are conflicting entries between the peer group and a specific neighbor statement, the neighbor statement wins. In Example 18-19, the peer group states the update source is Loopback 0. However, for neighbor 3.3.3.3, it states specifically that Loopback 1 will be used with the command neighbor 3.3.3.3 update-source Loopback1. This specific neigh-bor statement overrides the peer group. + +Example 18-19 Peer Group Configuration Example + +R2#show run | section router bgp +router bgp 65502 +bgp log-neighbor-changes +network 10.1.5.0 mask 255.255.255.0 +neighbor TSHOOT_IBGP_NEIGHBORS peer-group +neighbor TSHOOT_IBGP_NEIGHBORS transport connection-mode passive +neighbor TSHOOT_IBGP_NEIGHBORS update-source Loopback0 +neighbor TSHOOT_IBGP_NEIGHBORS next-hop-self +neighbor TSHOOT_IBGP_NEIGHBORS route-map TSHOOT_BGP_FILTER out +neighbor 1.1.1.1 remote-as 65501 +neighbor 1.1.1.1 password CISCO + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 765 + +neighbor 1.1.1.1 ebgp-multihop 2 +neighbor 1.1.1.1 update-source Loopback0 +neighbor 3.3.3.3 remote-as 65502 +neighbor 3.3.3.3 peer-group TSHOOT_IBGP_NEIGHBORS +neighbor 3.3.3.3 update-source Loopback1 +neighbor 4.4.4.4 remote-as 65502 +neighbor 4.4.4.4 peer-group TSHOOT_IBGP_NEIGHBORS +neighbor 5.5.5.5 remote-as 65502 +neighbor 5.5.5.5 peer-group TSHOOT_IBGP_NEIGHBORS + + +Timers + + + + + + + + +Key Topic + +Let’s be clear, BGP timers do not have to match. This is because BGP will use the lowest timers set between the two neighbors. If R1 is configured with a default hello of 60 and hold time of 180 and R3 is configured with a hello of 30 and hold time of 90, a hello of 30 and hold time of 90 will be used between the two neighbors, as shown in Example +18-20. + +Notice how R3 was configured with a minimum hold-time of 90 seconds; this is done to ensure that if a neighbor is using aggressive timers, they will not be used. However, it is far worse than the timers simply not being used. The neighbor relationship will not form at all. Refer to Example 18-21. In this case, R1 has a hello interval set to 10 and hold time set to 30. R3 has the minimum hold time set to 90 seconds. Therefore, it will not agree with the 30-second hold time set by R1, and the neighbor relationship fails. You can see +in the output a BGP notification is received stating that the hold time is not acceptable. + + +Example 18-20 Verifying BGP Timers + +R1#show bgp ipv4 unicast neighbors 10.1.13.3 | include hold time|holdtime +Last read 00:00:02, last write 00:00:29, hold time is 90, keepalive interval is 30 seconds +R3#show bgp ipv4 unicast neighbors 10.1.13.1 | include hold time|holdtime +Last read 00:00:10, last write 00:00:23, hold time is 90, keepalive interval is 30 seconds +Configured hold time is 90, keepalive interval is 30 seconds +Minimum holdtime from neighbor is 90 seconds + + +Example 18-21 Modifying BGP Timers to Values That Are Not Acceptable on R1 + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#router bgp 65501 +R1(config-router)#neighbor 10.1.13.3 timers 10 30 +R1(config-router)#do clear ip bgp 10.1.13.3 +R1(config-router)# +%BGP-5-ADJCHANGE: neighbor 10.1.13.3 Down User reset +%BGP_SESSION-5-ADJCHANGE: neighbor 10.1.13.3 IPv4 Unicast topology base removed from session User reset + + + +From the Library of Outcast Outcast +766 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +%BGP-3-NOTIFICATION: received from neighbor 10.1.13.3 active 2/6 (unacceptable hold time) 0 bytes +R1(config-router)# +%BGP-5-NBR_RESET: Neighbor 10.1.13.3 active reset (BGP Notification received) +%BGP-5-ADJCHANGE: neighbor 10.1.13.3 active Down BGP Notification received +%BGP_SESSION-5-ADJCHANGE: neighbor 10.1.13.3 IPv4 Unicast topology base removed from session BGP Notification received +R1(config-router)# +%BGP-3-NOTIFICATION: received from neighbor 10.1.13.3 active 2/6 (unacceptable hold time) 0 bytes +R1# + +To summarize timers, they do not have to match, but if the minimum hold time is set, the lowest timers must not be less than the minimum; otherwise, a neighbor relationship will not form. + +Troubleshooting BGP Routes + +Once a BGP adjacency is formed, BGP routers exchange their BGP routes with each other. However, there are various reasons as to why BGP routes might be missing from either the BGP table or the routing table. This section explains those reasons and how we can identify them using our troubleshooting methods. + +As discussed already, peers are the foundation for BGP information sharing. If we have no peers, we will not learn BGP routes. So, besides the lack of peers, what would be reasons for missing routes in a BGP network? Following is a listing of some common reasons as to why BGP routes might be missing either in the BGP table or the routing table: + + +■ Key +Topic + +■ + +■ + + +■ + + +■ + +Missing or bad network mask command : An accurate network command is needed to advertise routes. + +Next-hop router not reachable: To use a BGP route, the next hop must be reachable. + +BGP split-horizon rule: A router that learns BGP routes through an iBGP peering will not share those routes with another iBGP peer. + +Better source of information: If the exact same network is learned from a more reli-able source, it is used instead of the BGP-learned information. + +Route filtering: A filter might be set up that prevents a route from being shared with neighbors or learned from neighbors. + + +To verify the IPv4 unicast BGP-learned routes or routes locally injected into the BGP table, you use the show bgp ipv4 unicast command (which is the same as the old show +ip bgp command), as shown in Example 18-22. Routes will appear in this table for the fol-lowing reasons: + +■ Another BGP router advertises them to the local router. + +■ The network mask command matches a route in the local routing table. + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 767 + +■ A redistribute command is used to import the route from another local source. + +■ The summary-address command is used to create a summary route. + +It is not easy to determine the exact sources for all of the networks by looking only at the BGP table. Reviewing the commands in the running configuration along with the out-put of the BGP table will give you the most accurate information. However, in the BGP table, a network with a next hop other than 0.0.0.0 indicates the router learned it from a peer. If the next hop is 0.0.0.0, it means that the local router originated the route. If the Path column ends in ?, you can conclude that it was redistributed into the BGP process at some point. If the Path column ends in i, it means that the route was injected with the summary-address command or the network mask command. + +Example 18-22 Examining the BGP Table +Key +Topic R1#show bgp ipv4 unicast +BGP table version is 10, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 1.1.1.1/32 +*> 10.1.1.0/26 +*> 10.1.1.0/24 +*> 10.1.1.64/26 +*> 10.1.1.128/26 +*> 10.1.1.192/26 +* 10.1.5.0/24 +*> +*> 10.1.12.0/24 +*> 10.1.13.0/24 + +0.0.0.0 +0.0.0.0 +0.0.0.0 +0.0.0.0 +0.0.0.0 +0.0.0.0 +10.1.13.3 +2.2.2.2 +0.0.0.0 +0.0.0.0 + +0 32768 ? +0 32768 i +32768 i +0 32768 i +0 32768 i +0 32768 i +3328 0 65502 i +3328 0 65502 i +0 32768 ? +0 32768 ? + + +To display the routing table, use the show ip route command. To view only the BGP routes, issue the command show ip route bgp, as shown in Example 18-23. All BGP routes appear with the code B at the beginning of the entry. + +Example 18-23 Examining the BGP Routes in the Routing Table + +R2#show ip route bgp +...output omitted... + +Gateway of last resort is 10.1.12.1 to network 0.0.0.0 + +10.0.0.0/8 is variably subnetted, 15 subnets, 3 masks +B 10.1.1.0/24 [20/0] via 1.1.1.1, 00:19:11 + + + + +From the Library of Outcast Outcast +768 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +B 10.1.1.0/26 [20/0] via 1.1.1.1, 00:41:04 +B 10.1.1.64/26 [20/0] via 1.1.1.1, 00:36:45 +B 10.1.1.128/26 [20/0] via 1.1.1.1, 00:36:15 +B 10.1.1.192/26 [20/0] via 1.1.1.1, 00:36:15 +B 10.1.13.0/24 [20/0] via 1.1.1.1, 00:20:23 + +Let’s take a look at each of the reasons individually and identify how we can recognize them during the troubleshooting process. + +Missing or Bad network mask Command + +The network mask command is used to advertise routes into BGP. If you only remember one thing about this command, remember that it is extremely picky. The following list +describes why the command is picky: + + +■ +Key Topic + +■ + +The network/prefix you want to advertise with BGP has to be in the routing table from some other source (connected, static, or some other routing protocol). + +The network mask command must be a perfect match to the network/prefix listed in +the routing table. + + +If these two requirements are not met, the prefix/network will not be advertised. Review Example 18-24 and determine whether the 10.1.1.0/26 network will be advertised. + +Example 18-24 Determining Whether the 10.1.1.0/26 Network Will Be Advertised + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#router bgp 65501 +R1(config-router)#network 10.1.1.0 mask 255.255.255.192 +R1(config-router)#end +R1#show ip route +...output omitted... + +Gateway of last resort is not set + +1.0.0.0/32 is subnetted, 1 subnets +C 1.1.1.1 is directly connected, Loopback0 +2.0.0.0/32 is subnetted, 1 subnets +S 2.2.2.2 [1/0] via 10.1.12.2 +10.0.0.0/8 is variably subnetted, 12 subnets, 3 masks +C 10.1.1.0/26 is directly connected, GigabitEthernet0/0.1 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0.1 +C 10.1.1.64/26 is directly connected, GigabitEthernet0/0.2 +L 10.1.1.65/32 is directly connected, GigabitEthernet0/0.2 +C 10.1.1.128/26 is directly connected, GigabitEthernet0/0.3 +L 10.1.1.129/32 is directly connected, GigabitEthernet0/0.3 +C 10.1.1.192/26 is directly connected, GigabitEthernet0/0.4 + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 769 + +L 10.1.1.193/32 is directly connected, GigabitEthernet0/0.4 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +C 10.1.13.0/24 is directly connected, GigabitEthernet2/0 +L 10.1.13.1/32 is directly connected, GigabitEthernet2/0 + +In Example 18-24, the 10.1.1.0/26 network will be advertised because there is an exact match of the network command in the routing table. + +Now review Example 18-25. Will the network mask command successfully advertise the route indicated? + +Example 18-25 Determining Whether the Network Will Be Advertised + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#router bgp 65501 +R1(config-router)#network 10.1.1.0 mask 255.255.255.0 +R1(config-router)#end +R1#show ip route +...output omitted... + +Gateway of last resort is not set + +1.0.0.0/32 is subnetted, 1 subnets +C 1.1.1.1 is directly connected, Loopback0 +2.0.0.0/32 is subnetted, 1 subnets +S 2.2.2.2 [1/0] via 10.1.12.2 +10.0.0.0/8 is variably subnetted, 12 subnets, 3 masks +C 10.1.1.0/26 is directly connected, GigabitEthernet0/0.1 +L 10.1.1.1/32 is directly connected, GigabitEthernet0/0.1 +C 10.1.1.64/26 is directly connected, GigabitEthernet0/0.2 +L 10.1.1.65/32 is directly connected, GigabitEthernet0/0.2 +C 10.1.1.128/26 is directly connected, GigabitEthernet0/0.3 +L 10.1.1.129/32 is directly connected, GigabitEthernet0/0.3 +C 10.1.1.192/26 is directly connected, GigabitEthernet0/0.4 +L 10.1.1.193/32 is directly connected, GigabitEthernet0/0.4 +C 10.1.12.0/24 is directly connected, GigabitEthernet1/0 +L 10.1.12.1/32 is directly connected, GigabitEthernet1/0 +C 10.1.13.0/24 is directly connected, GigabitEthernet2/0 +L 10.1.13.1/32 is directly connected, GigabitEthernet2/0 + +The network mask command in this case is 10.1.1.0/24. Although 10.1.1.0/24 as a summa-ry would include 10.1.1.0/26, 10.1.1.64/26, 10.1.1.128/26, and 10.1.1.192/26, the network mask command states advertise this network (10.1.1.0/24). Because 10.1.1.0/24 is not in the routing table, nothing is advertised. + +It is important that you are able to recognize a bad or missing network mask command as being the reason for missing routes. If a router is not learning a BGP route that it + + +From the Library of Outcast Outcast +770 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +should and you trace it all the way back to the source, review the running configuration to see whether there is a network mask command advertising the network and whether there is a matching route in the routing table. + +Next-Hop Router Not Reachable + +If you are seeing BGP routes in the BGP table, but they are not appearing in the routing table, the router might not be able to reach the next hop. For a BGP router to install a BGP route in the routing table, it must be able to reach the next-hop address listed for the network. Example 18-26 shows the output of show bgp ipv4 unicast on R5. Let’s focus on network 10.1.1.0/26. Notice how there is no > symbol after the *. The * > symbols indi-cate that it is a valid best path to reach that network and has been installed in the routing table. In this case, the path is valid but not the best, and as a result, not placed in the routing table. + +Example 18-26 Identifying BGP Next-Hop Issues + +R5#show bgp ipv4 unicast +BGP table version is 2, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +* i 1.1.1.1/32 +* i 10.1.1.0/26 +* i 10.1.1.0/24 +* i 10.1.1.64/26 +* i 10.1.1.128/26 +* i 10.1.1.192/26 +r>i 10.1.5.0/24 +* i 10.1.12.0/24 +* i 10.1.13.0/24 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +10.1.24.4 +1.1.1.1 +1.1.1.1 + +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +0 100 +0 100 + +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 65501 ? +0 65501 ? + + + + +Key Topic + +The reason why it is not being used is because the next-hop address is not reachable. In +Example 18-27, the ping 1.1.1.1 command fails proving that the next hop is not reachable. + + +Example 18-27 Verifying Next-Hop Reachability + +R5#ping 1.1.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5) + + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 771 + +Refer to Figure 18-3. Notice where the next-hop address 1.1.1.1 is compared to R5. The next hop for BGP routes outside an autonomous system is the IP address of the router advertising the route to the local autonomous system. The router receiving the advertise-ment (R2 in this case) does not change the next hop by default because BGP is based on autonomous system-by-autonomous system hops, not on router-by-router hops. Therefore, the next hop is the IP address of the router advertising the network from the next-hop autonomous system. + +Lo:2.2.2.2 +iBGP Gi1/0 R2 Gi2/0 + + +10.1.1.0/26 10.1.1.64/26 10.1.1.128/26 10.1.1.192/26 + +Gi1/0 Gi0/0 + +R1 eBGP +Lo:1.1.1.1 + + + +Gi0/0 +R4 R5 +10.1.5.0/24 + + + +R3 +BGP AS 65501 BGP AS 65502 + +Figure 18-3 Troubleshooting Next-Hop Address Behavior + +There are many different ways to solve this problem. The key is to train R5 about how to get to the next hop. The following list contains a few examples: + +■ Create a static default route on R2 and R3; advertise it into the IGP routing protocol + +■ Create a static default route on R5 + +■ Create a static route on R5 + +■ Advertise the next-hop address into the Interior Gateway Protocol (IGP) routing pro-tocol + +In addition, BGP has a built-in option you can take advantage of. It is the neighbor ip_ address next-hop-self command. This command allows, for example, R2 to change the next-hop address to its own address before advertising the route to the peer. In Example 18-28, R2 has been configured with the neighbor 5.5.5.5 next-hop-self command that changes the next hop to 2.2.2.2 when R2 advertises routes to R5. Example 18-29 displays the BGP table on R5, which now has 2.2.2.2 as the next hop for 10.1.1.0/26, and it now has a > symbol, so it is the best and installed in the routing table. + +Example 18-28 Modifying Next-Hop Address + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#router bgp 65502 +R2(config-router)#neighbor 5.5.5.5 next-hop-self + + + + +From the Library of Outcast Outcast +772 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 18-29 Verifying Next-Hop Address in BGP Table + +R5#show bgp ipv4 unicast +BGP table version is 13, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*>i 1.1.1.1/32 +*>i 10.1.1.0/26 +*>i 10.1.1.0/24 +*>i 10.1.1.64/26 +*>i 10.1.1.128/26 +*>i 10.1.1.192/26 +r>i 10.1.5.0/24 +r>i 10.1.12.0/24 +r>i 10.1.13.0/24 + +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 + +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +0 100 +0 100 + +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 65501 ? +0 65501 ? + + + +BGP Split-Horizon Rule + +The BGP split-horizon rule states that a BGP router that receives a BGP route via an iBGP peering shall not advertise that route to another router that is an iBGP peer. It is impor-tant that you commit this rule to memory. By doing so, you will be able to recognize when this is the reason for missing routes. Figure 18-4 shows the current BGP peerings. Notice that R2 has an iBGP peering with R4 and that R4 has an iBGP peering with R5. When R2 advertises the 10.1.1.0/26 network (as an example) to R4, it is via an iBGP peer-ing. Because R4 and R5 are iBGP peers, R4 will not advertise the 10.1.1.0/26 network to R5 because of the BGP split-horizon rule. + +Lo:2.2.2.2 + +Gi1/0 R2 Gi2/0 + + + +10.1.1.0/26 10.1.1.64/26 10.1.1.128/26 10.1.1.192/26 + + +Gi1/0 + +R1 +Lo:1.1.1.1 + +Gi0/0 iBGP +eBGP + +Lo:3.3.3.3 + + +Lo:4.4.4.4 Lo:5.5.5.5 +Gi0/0 +R4 R5 +iBGP 10.1.5.0/24 + + +R3 +BGP AS 65501 BGP AS 65502 + +Figure 18-4 BGP Peerings Enforcing the BGP Split-Horizon Rule + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 773 + +For R5 to learn about the 10.1.1.0/26 network, it has to be an iBGP peer with the router that learned about the route from an eBGP peer or it has to be a peer with a route reflec-tor, which is beyond the scope of this book. Figure 18-5 indicates how the iBGP peerings should be to ensure both R4 and R5 learn about 10.1.1.0/26 (as well as the other net-works). It also ensures redundancy is optimized in the BGP AS. + +Lo:2.2.2.2 +iBGP Gi1/0 R2 Gi2/0 + + + +10.1.1.0/26 10.1.1.64/26 10.1.1.128/26 10.1.1.192/26 + +Gi1/0 + +R1 +Lo:1.1.1.1 + + +iBGP + +eBGP iBGP +iBGP Lo:3.3.3.3 + + +Lo:4.4.4.4 Lo:5.5.5.5 +Gi0/0 +R4 R5 +10.1.5.0/24 + + +R3 iBGP +BGP AS 65501 BGP AS 65502 + +Figure 18-5 Proper BGP Peerings to Avoid the BGP Split-Horizon Rule + + + +Key Topic + +Using show bgp ipv4 unicast summary on all the routers to identify peerings and then drawing your peerings on paper will give you an idea if the BGP split-horizon rule is causing the missing routes, as long as you remember this: A BGP router that receives a BGP route via an iBGP peering shall not advertise that route to another router that is +an iBGP peer. + + + +Better Source of Information + +Routes learned from eBGP peers have an administrative distance of 20, and routes learned from iBGP peers have an administrative distance of 200. Why the huge difference? BGP is designed to share routes between different autonomous systems. Therefore, if you learn a route from another autonomous system via eBGP, iBGP, or EIGRP sources, you want +the eBGP-learned route to be the best source of information over all the other dynamic routing protocols. For example, refer to Figure 18-5 again. R1 advertises 10.1.1.0/26 to R2 using eBGP and R3 using eBGP. R3, because it has an iBGP peering with R2, advertises it to R2 using iBGP. In addition, let’s say on R3 we redistribute the 10.1.1.0/26 eBGP-learned route into EIGRP and that R2 learns it via an EIGRP update. Now, R2 knows about the same network from three different sources: eBGP(20), iBGP(200), and EIGRP(170). As a result, the eBGP path is chosen because it has the lower AD. If it was not for eBGP hav-ing the lower AD, we would end up with suboptimal routing as a different source is used, and traffic would have to go to R3 first before it leaves the network, instead of directly from R2 to R1. + +Example 18-30 displays the output of the IPv4 unicast BGP table on R5 using the show bgp ipv4 unicast command. In the table, you will notice that the 10.1.5.0/24, 10.1.12.0/24, and 10.1.13.0/24 networks are best (installed in routing table), as indicated by the > sym-bol; however, they are not valid. They are listed as having a RIB failure, as indicated by + + +From the Library of Outcast Outcast +774 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +the r. A RIB failure means that the BGP route was not able to be installed in the routing table; however, you can clearly see that the route is in the routing table because of the > symbol. Be careful here. In this case, the route in the routing table is from a better source. + +Example 18-30 Verifying BGP Routes + +R5#show bgp ipv4 unicast +BGP table version is 10, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +* i 1.1.1.1/32 +*>i +* i 10.1.1.0/26 +*>i +* i 10.1.1.0/24 +*>i +* i 10.1.1.64/26 +*>i +* i 10.1.1.128/26 +*>i +* i 10.1.1.192/26 +*>i +r i 10.1.5.0/24 +r>i +r i 10.1.12.0/24 +r>i +r i 10.1.13.0/24 +r>i + +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 + +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +3328 100 +0 100 +0 100 +0 100 +0 100 + +0 65501 ? +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 i +0 65501 ? +0 65501 ? +0 65501 ? +0 65501 ? + + +Using the command show ip route 10.1.5.0 255.255.255.0, as shown in Example 18-31, indicates that 10.1.5.0/24 is learned via connected. In the same example, you can also see the output of show ip route 10.1.12.0 255.255.255.0, which indicates that it was learned via EIGRP. Connected is always the most trustworthy; therefore, it is always used over other routing information. With regard to the 10.1.12.0/24 network, the output of show bgp ipv4 unicast 10.1.12.0 in Example 18-32 indicates that it was learned from R2 and R3 using iBGP (internal), which has an AD of 200, much higher than EIGRP. + +Example 18-31 Verifying AD of Routes in Routing Table + +R5#show ip route 10.1.5.0 255.255.255.0 +Routing entry for 10.1.5.0/24 +Known via "connected", distance 0, metric 0 (connected, via interface) +...output omitted... + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 775 + +R5#show ip route 10.1.12.0 255.255.255.0 +Routing entry for 10.1.12.0/24 +Known via "eigrp 100", distance 90, metric 3328, type internal +...output omitted... + + +Example 18-32 Verifying Details of BGP Routes + +R5#show bgp ipv4 unicast 10.1.12.0 +BGP routing table entry for 10.1.12.0/24, version 50 +Paths: (2 available, best #2, table default, RIB-failure(17)) +Not advertised to any peer +Refresh Epoch 2 +65501 +3.3.3.3 (metric 131072) from 3.3.3.3 (3.3.3.3) +Origin incomplete, metric 0, localpref 100, valid, internal +rx pathid: 0, tx pathid: 0 +Refresh Epoch 2 +65501 +2.2.2.2 (metric 131072) from 2.2.2.2 (2.2.2.2) +Origin incomplete, metric 0, localpref 100, valid, internal , best +rx pathid: 0, tx pathid: 0x0 + +You can verify why a route is experiencing a RIB failure with the show bgp ipv4 unicast rib-failure command, as shown in Example 18-33. In this example, all three RIB failures are due to the BGP route having a higher AD. + +Example 18-33 Verifying RIB Failures + +R5#show bgp ipv4 unicast rib-failure + +Network +10.1.5.0/24 +10.1.12.0/24 +10.1.13.0/24 + +Next Hop +2.2.2.2 +2.2.2.2 +2.2.2.2 + +RIB-failure +Higher admin distance +Higher admin distance +Higher admin distance + +RIB-NH Matches +n/a +n/a +n/a + + + +Route Filtering + +The amount of control you have over routes in BGP is incredible—so much so, that we could dedicate an entire chapter to controlling BGP routes. However, that would be +beyond the scope of the book and the TSHOOT exam. What we want to be able to do while troubleshooting missing routes is determine whether there is a route filter applied and if it is the cause of the missing routes. Example 18-34 displays the BGP table on R5 using the show bgp ipv4 unicast command. Notice that there is no entry for 10.1.13.0/24. + +Example 18-34 Verifying Missing Routes on R5 + +R5#show bgp ipv4 unicast +BGP table version is 10, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, + + + +From the Library of Outcast Outcast +776 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +* i 1.1.1.1/32 +*>i +* i 10.1.1.0/26 +*>i +* i 10.1.1.0/24 +*>i +* i 10.1.1.64/26 +*>i +* i 10.1.1.128/26 +*>i +* i 10.1.1.192/26 +*>i +r i 10.1.5.0/24 +r>i +r i 10.1.12.0/24 +r>i + +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 + +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +3328 100 +0 100 +0 100 + +0 65501 ? +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 i +0 65501 ? +0 65501 ? + + +However, let’s see whether we are receiving the route from R2 or R3 using the show bgp ipv4 unicast neighbors ip_address routes command, as shown in Example 18-35. The output clearly shows that we are not learning 10.1.13.0/24. But wait, this command displays routes learned after local filters have been applied. Therefore, let’s check to see whether R2 or R3 are advertising the 10.1.13.0/24 route before we check for filters. As +shown in Example 18-36, which displays the output of the show bgp ipv4 unicast neigh-bors ip_address advertised-routes command, R2 and R3 are advertising the 10.1.13.0/24 network to R5. + +Example 18-35 Verifying Whether Routes Are Being Received on R5 + +R5#show bgp ipv4 unicast neighbors 2.2.2.2 routes +BGP table version is 9, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*>i 1.1.1.1/32 +*>i 10.1.1.0/26 +*>i 10.1.1.0/24 +*>i 10.1.1.64/26 + +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 + +0 100 0 65501 ? +0 100 0 65501 i +0 100 0 65501 i +0 100 0 65501 i + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 777 + + +*>i 10.1.1.128/26 +*>i 10.1.1.192/26 +r>i 10.1.5.0/24 +r>i 10.1.12.0/24 + +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 + +0 100 +0 100 +3328 100 +0 100 + +0 65501 i +0 65501 i +0 i +0 65501 ? + + +Total number of prefixes 8 +R5#show bgp ipv4 unicast neighbors 3.3.3.3 routes +BGP table version is 9, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +* i 1.1.1.1/32 +* i 10.1.1.0/26 +* i 10.1.1.0/24 +* i 10.1.1.64/26 +* i 10.1.1.128/26 +* i 10.1.1.192/26 +r i 10.1.5.0/24 +r i 10.1.12.0/24 + +3.3.3.3 +3.3.3.3 +3.3.3.3 +3.3.3.3 +3.3.3.3 +3.3.3.3 +3.3.3.3 +3.3.3.3 + +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +0 100 + +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 65501 ? + + +Total number of prefixes 8 + + +Example 18-36 Verifying Whether Routes Are Being Sent to R5 + +R2#show bgp ipv4 unicast neighbors 5.5.5.5 advertised-routes +BGP table version is 10, local router ID is 2.2.2.2 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +r> 1.1.1.1/32 +*> 10.1.1.0/26 +*> 10.1.1.0/24 +*> 10.1.1.64/26 +*> 10.1.1.128/26 +*> 10.1.1.192/26 +*> 10.1.5.0/24 +r> 10.1.12.0/24 +*> 10.1.13.0/24 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 +10.1.24.4 +1.1.1.1 +1.1.1.1 + +0 0 65501 ? +0 0 65501 i +0 0 65501 i +0 0 65501 i +0 0 65501 i +0 0 65501 i +3328 32768 i +0 0 65501 ? +0 0 65501 ? + + + + + +From the Library of Outcast Outcast +778 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Total number of prefixes 9 + +R3#show bgp ipv4 unicast neighbors 5.5.5.5 advertised-routes +BGP table version is 10, local router ID is 3.3.3.3 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 1.1.1.1/32 +*> 10.1.1.0/26 +*> 10.1.1.0/24 +*> 10.1.1.64/26 +*> 10.1.1.128/26 +*> 10.1.1.192/26 +*> 10.1.5.0/24 +*> 10.1.12.0/24 +r> 10.1.13.0/24 + +10.1.13.1 +10.1.13.1 +10.1.13.1 +10.1.13.1 +10.1.13.1 +10.1.13.1 +10.1.34.4 +10.1.13.1 +10.1.13.1 + +0 0 65501 ? +0 0 65501 i +0 0 65501 i +0 0 65501 i +0 0 65501 i +0 0 65501 i +3328 32768 i +0 0 65501 ? +0 0 65501 ? + + +Total number of prefixes 9 + + + +Key Topic + +Issuing the show ip protocols command as shown in Example 18-37 displays the incom-ing filter applied to the BGP autonomous system. It is a distribute list using the prefix list called FILTER_10.1.13.0/24, as shown in Example 18-37. The prefix list, as also shown in +Example 18-37, is denying 10.1.13.0/24 and permitting all other routes. + + +Example 18-37 Verifying Whether Filters Are Applied to R5 + +R5#show ip protocols +...output omitted... + +Routing Protocol is "bgp 65502" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is (prefix-list) FILTER_10.1.13.0/24 +IGP synchronization is disabled +Automatic route summarization is disabled +Neighbor(s): +Address FiltIn FiltOut DistIn DistOut Weight RouteMap +2.2.2.2 +3.3.3.3 +Maximum path: 1 +Routing Information Sources:...output omitted... + +R5#show ip prefix-list +ip prefix-list FILTER_10.1.13.0/24: 2 entries + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 779 + +seq 5 deny 10.1.13.0/24 +seq 10 permit 0.0.0.0/0 le 32 + +R5#show run | include bgp 65502|distribute-list +router bgp 65502 +distribute-list prefix FILTER_10.1.13.0/24 in + +The example we just reviewed focused on a filter that applied to the entire BGP process. Therefore, no matter which router we receive the route 10.1.13.0/24 from, it would be denied. However, you could apply a filter directly to a neighbor using any one of the fol-lowing commands: + +■ neighbor ip_address distribute-list access_list_number {in | out} + +■ neighbor ip_address prefix-list prefix_list_name {in | out} + +■ neighbor ip_address route-map map_name {in | out} + +■ neighbor ip_address filter-list access_list_number {in | out} + +How do you verify whether a route filter is applied specifically to a neighbor? You would verify the route filters with the same show commands as before. You just have to look +in a different spot in the output. Refer to Example 18-38. In this example, an inbound distribute list is applied directly to the neighbor 2.2.2.2, as shown in the show ip proto-cols output. Notice that only the first six characters of the ACL are identified. We then review the running configuration and see that the distribute list is using the ACL named FILTER_10.1.13.0/24. Using the show ip access-list command confirms that the router is denying the 10.1.13.0/24 network from 2.2.2.2 but allowing all other networks. + +Example 18-38 Verifying a Distribute List Applied to a Neighbor + +R5#show ip protocols +...output omitted... + +Routing Protocol is "bgp 65502" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +IGP synchronization is disabled +Automatic route summarization is disabled + +Neighbor(s): +Address +2.2.2.2 +3.3.3.3 +Maximum path: 1 + + +FiltIn FiltOut DistIn DistOut Weight RouteMap +FILTER + +Routing Information Sources: +...output omitted... + +R5#show run | include bgp 65502|distribute-list +router bgp 65502 + + + +From the Library of Outcast Outcast +780 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +neighbor 2.2.2.2 distribute-list FILTER_10.1.13.0/24 in + +R5#show ip access-lists +Standard IP access list FILTER_10.1.13.0/24 +10 deny 10.1.13.0, wildcard bits 0.0.0.255 +20 permit any + +As noted earlier, you can also apply a route map, a prefix list, and a filter list directly to the neighbor command. The filter list will appear under the FiltIn and FiltOut column in show ip protocols, and the route map will appear under the RouteMap column in show ip protocols output. If the prefix list is applied directly to a neighbor statement, it does not appear in the output of show ip protocols. You will need to review the output of show bgp ipv4 unicast neighbors. However, as you recall, it is an extremely verbose out-put. Therefore, here is a shortcut that you might want to remember for troubleshooting route filters: + +show bgp ipv4 unicast neighbors ip_address | include prefix|filter|Route map +Example 18-39 shows a sample of what would appear in the output of show bgp ipv4 unicast neighbors on R5 based on different filters applied to and from neighbors R2 and R3. In the output, you can see that there is an inbound prefix list applied directly to neighbor 3.3.3.3 called FILTER_10.1.13.0/24; there is also an outbound route map called FILTER_10.1.5.0/24 for routes sent to neighbor 3.3.3.3. With regard to neighbor 2.2.2.2, +there is an inbound “network filter” (distribute list) applied to the neighbor statement that is using the ACL called FILTER_10.1.13.0/24, and also an inbound autonomous system path ACL called 25. + +Example 18-39 Verifying Filters Applied to the neighbor Statements + +R5#show bgp ipv4 unicast neighbors 3.3.3.3 | include prefix|filter|Route map +Incoming update prefix filter list is FILTER_10.1.13.0/24 +Route map for outgoing advertisements is FILTER_10.1.5.0/24 +R5#show bgp ipv4 unicast neighbors 2.2.2.2 | include prefix|filter|Route map +Incoming update network filter list is FILTER_10.1.13.0/24 +Incoming update AS path filter list is 25 + + +Troubleshooting BGP Path Selection + +Unlike OSPF and EIGRP, BGP does not consider a link’s bandwidth when making a route decision. Instead, BGP uses various attributes when deciding which path is the best. When troubleshooting BGP paths, you need to have a solid understanding of all the attri-butes to fully comprehend why BGP made the decision it made. This section discusses the BGP best path decision-making process. In addition, we examine private autonomous system numbers. + + + + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 781 + +Understanding the Best Path Decision-Making Process + +The following list presents the order that BGP reviews the attributes when deciding which path is the best: + +1. +Key +Topic 2. + +3. + +4. + +5. + +6. + +7. + +8. + +9. + + +Prefer highest weight + +Prefer highest local preference + +Prefer route originated by the local router + +Prefer shortest autonomous system path + +Prefer lowest origin code + +Prefer lowest MED (metric) + +Prefer external over internal path + +Prefer path through closest IGP neighbor + +Prefer oldest route for eBGP paths + + +10. Prefer path with the lowest neighbor BGP RID + +11. Prefer path with the lowest neighbor IP address + +As you go through the BGP best path decision-making process, refer to Figure 18-6 and the output of show bgp ipv4 unicast 10.1.1.0 on R5 in Example 18-40. + +Lo:2.2.2.2 +iBGP Gi1/0 R2 Gi2/0 + + + +10.1.1.0/26 10.1.1.64/26 10.1.1.128/26 10.1.1.192/26 + +Gi1/0 + +R1 +Lo:1.1.1.1 + + +iBGP + +eBGP iBGP +iBGP Lo:3.3.3.3 + + +Lo:4.4.4.4 Lo:5.5.5.5 +Gi0/0 +R4 R5 +10.1.5.0/24 + + +R3 iBGP +BGP AS 65501 BGP AS 65502 + +Figure 18-6 Understanding the BGP Best Path Decision Process Topology + +Example 18-40 Verifying the BGP Table on Router R5 for Network 10.1.1.0 + +R5#show bgp ipv4 unicast 10.1.1.0 +BGP routing table entry for 10.1.1.0/26, version 46 +Paths: (2 available, best #1, table default) +Not advertised to any peer +Refresh Epoch 4 +65501 +2.2.2.2 (metric 131072) from 2.2.2.2 (2.2.2.2) + + + +From the Library of Outcast Outcast +782 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Origin IGP, metric 0, localpref 100, valid, internal, best +rx pathid: 0, tx pathid: 0x0 +Refresh Epoch 1 +65501 +3.3.3.3 (metric 131072) from 3.3.3.3 (3.3.3.3) +Origin IGP, metric 0, localpref 100, valid, internal +rx pathid: 0, tx pathid: 0 + +Once BGP finds a match, it stops and uses that attribute as the reason for choosing the path as the best. It looks no further. In addition, if the next-hop IP address is not reach-able, the router does not even go through this process because it considers the next-hop inaccessible: +1. BGP first looks at weight. Higher is better. In Example 18-40, no weight is listed because both paths are using the default value of 0. Therefore, weight is tied and the next attribute is checked. +2. Local preference is checked next. Higher is better. In Example 18-40, localpref is 100 (default) for both paths; therefore, local preference is tied and the next attribute is checked. +3. The router checks whether it generated the BGP route (has a next hop of 0.0.0.0). If it did, it is preferred. In Example 18-40, the next hops are 2.2.2.2 and 3.3.3.3 on the far left of the output. Therefore, R5 did not generate any of the routes, and the next attribute is checked. +4. The autonomous system path is checked next. The shortest path is preferred. In Example 18-40, the autonomous system path is 65501 for both. Therefore, the autonomous system path is tied, and the next attribute is checked. +5. The origin code is checked next. IGP is better than EGP, which is better than incom-plete. Note that this is not related to iBGP versus eBGP, which is covered later. IGP means the route was generated with the network mask or summary-address com-mand, and incomplete means the route was redistributed into BGP. EGP means it was generated from EGP, the predecessor to BGP. In Example 18-40, the origin is IGP for both which means that the next attribute will be checked. +6. MED (metric) is next. Lower is better. In Example 18-40, the MED (metric) is the same for both (0). Therefore, the next attribute has to be checked. + +7. Now eBGP is preferred over iBGP. In Example 18-40, they are both learned via iBGP (internal). Therefore, this attribute is tied as well and the next will have to be checked. +8. The IGP path to the neighbor is compared now. In Example 18-40, the IGP path to 2.2.2.2 has a metric of 131072, and the IGP path to 3.3.3.3 has a metric of 131072. They are tied. Therefore, the next attribute has to be checked. +9. If they are eBGP paths, the age of the routes are checked. In Example 18-40, both paths are iBGP paths. Therefore, we skip this attribute and move on to the next attri-bute. + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 783 + +10. The BGP RIDs are now compared. Lower is better. In Example 18-40, neighbor 2.2.2.2 has a RID of 2.2.2.2 (as displayed in the brackets), and neighbor 3.3.3.3 has a RID of 3.3.3.3 (as displayed in the brackets). Which RID is lower? 2.2.2.2 Therefore, the route provided by the neighbor with the RID of 2.2.2.2 is considered the best path. If the RID happens to be tied, the neighbor IP address is used to break the tie. + +Now it is your turn! Try the following on your own, and then we will walk you through it. Refer to Figure 18-7 and Example 18-41 and determine which attribute R2 is using to choose the best path to reach 10.1.1.128. + +Lo:2.2.2.2 +iBGP Gi1/0 R2 Gi2/0 + + + +10.1.1.0/26 10.1.1.64/26 10.1.1.128/26 10.1.1.192/26 + +Gi1/0 + +R1 +Lo:1.1.1.1 + + +iBGP + +eBGP iBGP +iBGP Lo:3.3.3.3 + + +Lo:4.4.4.4 Lo:5.5.5.5 +Gi0/0 +R4 R5 +10.1.5.0/24 + + +R3 iBGP +BGP AS 65501 BGP AS 65502 + +Figure 18-7 Practicing the BGP Best Path Decision Process Topology + +Example 18-41 Practicing the BGP Best Path Decision Process + +R2#show bgp ipv4 unicast 10.1.1.128 +BGP routing table entry for 10.1.1.128/26, version 6 +Paths: (2 available, best #2, table default) +Advertised to update-groups: +2 +Refresh Epoch 2 +65501 +3.3.3.3 (metric 131072) from 3.3.3.3 (3.3.3.3) +Origin IGP, metric 0, localpref 100, valid, internal +rx pathid: 0, tx pathid: 0 +Refresh Epoch 3 +65501 +1.1.1.1 from 1.1.1.1 (1.1.1.1) +Origin IGP, metric 0, localpref 100, valid, external, best +rx pathid: 0, tx pathid: 0x0 + +Alright, let’s walk through it together: + +1. Prefer highest weight Tied + +2. Prefer highest local preference Tied + + + + +From the Library of Outcast Outcast +784 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +3. Prefer route originated by the local router None + +4. Prefer shortest autonomous system path Same at 65501 + +5. Prefer lowest origin code Same + +6. Prefer lowest MED (Metric) Tied at 0 + +7. Prefer external (eBGP) over internal (iBGP) path Not Tied Stop + +The path learned from neighbor 1.1.1.1 is external (eBGP) and the path learned from neighbor 3.3.3.3 is internal (iBGP). Therefore, the path learned from neighbor 1.1.1.1 is preferred because external is preferred over internal. + +If you are not getting desired paths, or the paths you expect to be used as best, you need to be able to walk through this process while troubleshooting to figure out why the cur-rent best path was chosen as such. There may have been an attribute that was modified locally or remotely at some point that is influencing the decision that is being made. You need to be able to recognize this and then manipulate the paths in your favor by modify-ing the necessary attributes. + +Private Autonomous System Numbers + +Like IPv4 addresses, BGP autonomous system numbers also have a private range. In the 2-byte autonomous system range it is 64,512 to 65,534, and for the 4-byte autonomous system range, it is 4,200,000,000 to 4,294,967,294. These autonomous system numbers can be used for networks that are single-homed or dual-homed to the same ISP, thereby preserving the public autonomous system numbers for those networks that are multi-homed to multiple ISPs. + +Although the private autonomous system numbers can be used in the customer’s net-work, it is imperative that the autonomous system number is not in the AS_PATH attri-bute when the routes are advertised to the Internet (global BGP table) because multiple autonomous systems could be using the same private autonomous system number which would then cause issues on the Internet. + +If private autonomous system numbers are being sent into the global BGP table, they need to be stopped. You can accomplish this with the neighbor ip_address remove-private-as command. + +Using debug Commands + +The majority of changes that occur with BGP will generate syslog messages in real time. Therefore, you will be notified via syslog if any neighbor issues occur. So, unless you really need to, avoid using the large number of debugs that are available because they place a large amount of pressure on the routers’ resources. Only use as a last resort! Following you will find a few debug commands that might be useful. However, up to this point, all the show commands we have covered and your knowledge can determine the same thing. + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 785 + +Example 18-42 provides sample output from the debug ip routing command. The out-put from this command shows updates to a router’s IP routing table. In this example, the Loopback 0 interface (with an IP address of 10.3.3.3) of a neighboring router was adminis- +tratively shut down and then administratively brought back up. As the 10.3.3.3/32 network became unavailable and then once again became available, you can see that the 10.3.3.3/32 route was deleted and then added to this router’s IP routing table. Notice that this output is not specific to BGP. Therefore, you can use the debug ip routing command with routing processes other than BGP. + +Example 18-42 debug ip routing Command Output + +R2#debug ip routing +IP routing debugging is on +RT: 10.3.3.3/32 gateway changed from 172.16.1.1 to 172.16.2.2 +RT: NET-RED 10.3.3.3/32 +RT: del 10.3.3.3/32 via 172.16.2.2, bgp metric [20/0] +RT: delete subnet route to 10.3.3.3/32 +RT: NET-RED 10.3.3.3/32 +RT: SET_LAST_RDB for 10.3.3.3/32 +NEW rdb: via 172.16.1.1 + +RT: add 10.3.3.3/32 via 172.16.1.1, bgp metric [20/0] +RT: NET-RED 10.3.3.3/32 + +Example 18-43 provides sample output from the debug ip bgp command. The output of this command does not show the contents of BGP updates; however, this command can be use-ful in watching real-time state changes for IPv4 BGP peering relationships. In this example, you can see a peering session being closed for the neighbor with an IP address of 172.16.1.1. + +Example 18-43 debug ip bgp Command Output + +R2#debug ip bgp +BGP debugging is on for address family: IPv4 Unicast +*Mar 1 00:23:26.535: BGP: 172.16.1.1 remote close, state CLOSEWAIT +*Mar 1 00:23:26.535: BGP: 172.16.1.1 -reset the session +*Mar 1 00:23:26.543: BGPNSF state: 172.16.1.1 went from nsf_not_active to +nsf_not_active +*Mar 1 00:23:26.547: BGP: 172.16.1.1 went from Established to Idle +*Mar 1 00:23:26.547: %BGP-5-ADJCHANGE: neighbor 172.16.1.1 Down Peer closed the +session +*Mar 1 00:23:26.547: BGP: 172.16.1.1 closing +*Mar 1 00:23:26.651: BGP: 172.16.1.1 went from Idle to Active +*Mar 1 00:23:26.663: BGP: 172.16.1.1 open active delayed 30162ms (35000ms max, +28% jitter) + +Example 18-44 provides sample output from the debug ip bgp updates command. This command produces more detailed output than the debug ip bgp command. Specifically, you can see the content of IPv4 BGP updates. In this example, you see a route of 10.3.3.3/32 being added to a router’s IP routing table. + + +From the Library of Outcast Outcast +786 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 18-44 debug ip bgp updates Command Output + +R2#debug ip bgp updates +BGP updates debugging is on for address family: IPv4 Unicast +*Mar 1 00:24:27.455: BGP(0): 172.16.1.1 NEXT_HOP part 1 net 10.3.3.3/32, next +172.16.1.1 +*Mar 1 00:24:27.455: BGP(0): 172.16.1.1 send UPDATE (format) 10.3.3.3/32, next +172.16.1.1, metric 0, path 65002 +*Mar 1 00:24:27.507: BGP(0): 172.16.1.1 rcv UPDATE about 10.3.3.3/32 — withdrawn +*Mar 1 00:24:27.515: BGP(0): Revise route installing 1 of 1 routes for +10.3.3.3/32 -> 172.16.2.2(main) to main IP table +*Mar 1 00:24:27.519: BGP(0): updgrp 1 - 172.16.1.1 updates replicated for +neighbors: 172.16.2.2 +*Mar 1 00:24:27.523: BGP(0): 172.16.1.1 send UPDATE (format) 10.3.3.3/32, next +172.16.1.2, metric 0, path 65003 65002 +*Mar 1 00:24:27.547: BGP(0): 172.16.2.2 rcvd UPDATE w/ attr: nexthop 172.16.2.2, +origin i, path 65003 65002 +*Mar 1 00:24:27.551: BGP(0): 172.16.2.2 rcvd 10.3.3.3/32...duplicate ignored +*Mar 1 00:24:27.555: BGP(0): updgrp 1 - 172.16.1.1 updates replicated for +neighbors: 172.16.2.2 +*Mar 1 00:24:27.675: BGP(0): 172.16.2.2 rcv UPDATE w/ attr: nexthop 172.16.2.2, +origin i, originator 0.0.0.0, path 65003 65001 65002, community, extended +community +*Mar 1 00:24:27.683: BGP(0): 172.16.2.2 rcv UPDATE about 10.3.3.3/32 — DENIED +due to: AS-PATH contains our own AS; +...OUTPUT OMITTED... + + +Troubleshooting BGP for IPv6 + +BGP for IPv4 and BGP for IPv6 are configured in the same BGP autonomous sys-tem configuration mode. This is known as Multiprotocol BGP, or MP-BGP for short. Implementing BGP for IPv4 and IPv6 on the same router requires the use of address +families and the activation of neighbors for those address families. This section examines the additional issues (on top of what was already covered thus far in the chapter) that you may encounter when using MP-BGP with IPv4 and IPv6 unicast routes. Refer to Figure 18-8 while reviewing this section. + + +AS 65501 + +2001:db8:0:1::/64 + +R1 + + + +IPv4 or IPv6 eBGP Neighborship + +AS 65502 + +2001:db8:0:2::/64 + +R2 + + + + +Figure 18-8 MP-BGP Topology + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 787 + +There are two different ways to exchange IPv6 routes with BGP. You can exchange them over IPv4 TCP sessions or IPv6 TCP sessions. Example 18-45 displays a sample BGP con-figuration where IPv6 routes are exchanged over an IPv4 TCP session. + +Notice how there are two address families: one for IPv4 unicast, and one for IPv6 unicast. The neighbors and remote autonomous system numbers are identified outside of the address family (AF) configuration. You then activate the neighbor within the AF with the neighbor ip_address activate command. In this example, the IPv6 AF is using an IPv4 neighbor address to establish the TCP session. Therefore, the TCP session will be IPv4 based. Reviewing the output of show bgp ipv6 unicast summary, as shown in Example 18-46, shows the IPv6 unicast AF neighbor adjacency that has been formed with router 2.2.2.2. Notice that the adjacency has been formed with an IPv4 unicast address. It also states that one IPv6 prefix has been learned from the neighbor. + +Example 18-45 MP-BGP Configuration for IPv6 Routes Over IPv4 TCP Session + +R1#show run | s router bgp +router bgp 65501 +bgp log-neighbor-changes +neighbor 2.2.2.2 remote-as 65502 +neighbor 2.2.2.2 ebgp-multihop 2 +neighbor 2.2.2.2 password CISCO +neighbor 2.2.2.2 update-source Loopback0 +! +address-family ipv4 +network 10.1.1.0 mask 255.255.255.192 +network 10.1.1.64 mask 255.255.255.192 +network 10.1.1.128 mask 255.255.255.192 +network 10.1.1.192 mask 255.255.255.192 +aggregate-address 10.1.1.0 255.255.255.0 +redistribute connected +neighbor 2.2.2.2 activate +exit-address-family +! +address-family ipv6 +network 2001:DB8:1::/64 +neighbor 2.2.2.2 activate +exit-address-family + + +Example 18-46 Verifying MP-BGP IPv6 Unicast Neighbor Adjacencies + +R1#show bgp ipv6 unicast summary +BGP router identifier 1.1.1.1, local AS number 65501 +BGP table version is 2, main routing table version 2 +2 network entries using 336 bytes of memory +2 path entries using 208 bytes of memory +2/1 BGP path/bestpath attribute entries using 272 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory + + +From the Library of Outcast Outcast +788 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 840 total bytes of memory +BGP activity 11/0 prefixes, 18/6 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2.2.2.2 4 65502 25 25 2 0 0 00:12:02 1 + + + +Key Topic + +To verify the IPv6 unicast routes that have been learned from all neighbors, you can issue the show bgp ipv6 unicast command, as shown in Example 18-47. This displays the IPv6 BGP table. The route 2001:db8:1::/64 is locally originated because of the next hop ::, and it is in the routing table as indicated by the *> at the beginning of the entry. Examine the 2001:db8:2::/64 route. This is the route that was learned from R2 (the 2.2.2.2 neighbor). +It is not installed in the routing table as indicated by the absence of the *>. The reason is because the next hop is not reachable. The address ::FFFF:2.2.2.2 is a dynamically gener-ated next hop that was created to replace the original next hop of 2.2.2.2. This occurs because an IPv6 route cannot have an IPv4 next-hop address. Why was the next hop an +IPv4 address? This is because the adjacency is an IPv4 adjacency for the IPv6 AF. + + +Example 18-47 Verifying MP-BGP IPv6 Unicast Routes in the IPv6 BGP Table + +R1#show bgp ipv6 unicast +BGP table version is 2, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2001:DB8:1::/64 +* 2001:DB8:2::/64 + +:: +::FFFF:2.2.2.2 + +0 32768 i +0 0 65502 i + + + + +Key Topic + +To solve this issue, you need to create a route map that will change the next hop to a valid IPv6 address and attach it to the neighbor statement. Now, be very careful with this. It has to be done on the router advertising the route, not receiving the route. In Example 18-48, a route map is configured on R2 that changes the next-hop address to +2001:db8:12::2. The route map is then attached to the neighbor 1.1.1.1 outbound. + + +Example 18-48 Modifying the BGP Next Hop + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#route-map CHANGE_NH permit 10 +R2(config-route-map)#set ipv6 next-hop 2001:db8:12::2 +R2(config-route-map)#exit +R2(config)#router bgp 65502 +R2(config-router)#address-family ipv6 unicast +R2(config-router-af)#neighbor 1.1.1.1 route-map CHANGE_NH out + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 789 + +When you examine the output of show bgp ipv6 unicast again in Example 18-49, the next hop is now a valid hop, and the route is installed in the table. + +Example 18-49 Verifying the BGP Next Hop + +R1#show bgp ipv6 unicast +BGP table version is 3, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2001:DB8:1::/64 +*> 2001:DB8:2::/64 + +:: +2001:DB8:12::2 + +0 32768 i +0 0 65502 i + + +When forming IPv6 TCP sessions and neighbor relationships, you do not have to worry about the issue just described. However, you have to make sure that you define the IPv6 neighbor and activate it. Take a look at Example 18-50. To form the IPv6 TCP session, you define the neighbor with the neighbor ipv6_address remote-as autonomous_sys-tem_number command outside of the AF configuration, and then you activate the neigh-bor in the IPv6 AF configuration with the neighbor ipv6_address activate command. + +Example 18-50 MP-BGP Configuration for IPv6 Routes over IPv6 TCP Session + +R1#show run | section router bgp +router bgp 65501 +bgp log-neighbor-changes +neighbor 2.2.2.2 remote-as 65502 +neighbor 2.2.2.2 ebgp-multihop 2 +neighbor 2.2.2.2 password CISCO +neighbor 2.2.2.2 update-source Loopback0 +neighbor 10.1.13.3 remote-as 65502 +neighbor 2001:DB8:12::2 remote-as 65502 +! +address-family ipv4 +network 10.1.1.0 mask 255.255.255.192 +network 10.1.1.64 mask 255.255.255.192 +network 10.1.1.128 mask 255.255.255.192 +network 10.1.1.192 mask 255.255.255.192 +aggregate-address 10.1.1.0 255.255.255.0 +redistribute connected +neighbor 2.2.2.2 activate +neighbor 10.1.13.3 activate +no neighbor 2001:DB8:12::2 activate +exit-address-family +! + + + +From the Library of Outcast Outcast +790 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +address-family ipv6 +network 2001:DB8:1::/64 +neighbor 2001:DB8:12::2 activate +exit-address-family + +The output of show bgp ipv6 unicast summary as shown in Example 18-51 shows that R1 has formed an IPv6 BGP neighbor adjacency with the device at 2001:db8:12::2 using an IPv6 TCP session, and one prefix has been received. The IPv6 BGP table, as displayed in the output of show bgp ipv6 unicast command in Example 18-52, indicates that 2001:DB8:2::/64 can be reached with a next hop of 2001:DB8:12::2 and that it is installed in the routing table, as indicated by the *>. + +Example 18-51 MP-BGP Adjacencies with IPv6 TCP Sessions + +R1#show bgp ipv6 unicast summary +BGP router identifier 1.1.1.1, local AS number 65501 +BGP table version is 5, main routing table version 5 +2 network entries using 336 bytes of memory +2 path entries using 208 bytes of memory +2/2 BGP path/bestpath attribute entries using 272 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 840 total bytes of memory +BGP activity 12/1 prefixes, 22/10 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2001:DB8:12::2 4 65502 5 5 4 0 0 00:00:05 1 + + +Example 18-52 Verifying IPv6 BGP Table + +R1#show bgp ipv6 unicast +BGP table version is 5, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 2001:DB8:1::/64 +*> 2001:DB8:2::/64 + +:: +2001:DB8:12::2 + +0 32768 i +0 0 65502 i + + + +BGP Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 791 + +when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 18-9. + +Lo:2.2.2.2 +iBGP Gi1/0 R2 Gi2/0 + + + +10.1.1.0/26 10.1.1.64/26 10.1.1.128/26 10.1.1.192/26 + +Gi1/0 + +R1 +Lo:1.1.1.1 + + +iBGP + +eBGP iBGP +iBGP Lo:3.3.3.3 + + +Lo:4.4.4.4 Lo:5.5.5.5 +Gi0/0 +R4 R5 +10.1.5.0/24 + + +R3 iBGP +BGP AS 65501 BGP AS 65502 + +Figure 18-9 BGP Trouble Tickets Topology + + +Trouble Ticket 18-1 + +Problem: You are the administrator for BGP autonomous system 65502. While you were away on vacation, the link between R1 and R2 failed. When the link between R1 and R2 fails, the link between R1 and R3 is supposed to forward traffic to BGP autonomous system 65501. However, that did not occur while you were away. Your co-worker had to +restore connectivity between R1 and R2 while complaints kept flowing in from the users in 10.1.5.0/24 about connectivity to the 10.1.1.0/24 networks being down. + +At this point, connectivity is fine. You confirm this by pinging from a PC in 10.1.5.0/24 to 10.1.1.10. In Example 18-53, the ping is successful. Because it is the middle of the day, you cannot bring down the link between R1 and R2 to re-create the issue because it will disrupt the network users. Therefore, you need to be creative with your troubleshooting efforts. + +Example 18-53 Verifying Connectivity + +C:\>ping 10.1.1.10 + +Pinging 10.1.1.10 with 32 bytes of data: + +Reply from 10.1.1.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.10: bytes=32 time 1ms TTL=128 +Reply from 10.1.1.10: bytes=32 time 1ms TTL=128 + +Ping statistics for 10.1.1.10: +Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), +Approximate round trip times in milli-seconds: +Minimum = 0ms, Maximum = 0ms, Average = 0ms + + + +From the Library of Outcast Outcast +792 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +For router R5 to know about the networks in autonomous system 65501, they have to be advertised to it. The best place to see whether R5 is learning about the routes is R5’s BGP table. Based on the network topology, R5 should be learning about the networks from R2 and R3. In Example 18-54, the output of show bgp ipv4 unicast is displayed. As you can see from the next-hop column, all valid routes to the 10.1.1.x/26 networks are via the next hop of 2.2.2.2, which is R2. There are no entries for R3 at 3.3.3.3 that are valid for those networks. + +Example 18-54 Examining R5’s BGP Table + +R5#show bgp ipv4 unicast +BGP table version is 56, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*>i 1.1.1.1/32 +*>i 10.1.1.0/26 +*>i 10.1.1.64/26 +*>i 10.1.1.128/26 +*>i 10.1.1.192/26 +r>i 10.1.5.0/24 +r i +r>i 10.1.12.0/24 +r>i 10.1.13.0/24 + +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +3.3.3.3 +2.2.2.2 +2.2.2.2 + +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +3328 100 +0 100 +0 100 + +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 i +0 65501 ? +0 65501 ? + + +Next you want to confirm whether R5 is even receiving the routes from R3. Therefore, you issue the command show bgp ipv4 unicast neighbors 2.2.2.2 routes and show bgp ipv4 unicast neighbors 3.3.3.3 routes to determine which routes are being received and to compare what is being advertised from R2 versus R3. The output in Example 18-55 clearly shows that R5 is not receiving any routes about the 10.1.1.x/26 networks from R3. This is the reason why network connectivity was lost when the link between R1 and R2 went down. R5 does not have any route information from R3. + +Example 18-55 Examining Routes Received from R2 and R3 + +R5#show bgp ipv4 unicast neighbors 2.2.2.2 routes +BGP table version is 56, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 793 + + +*>i 1.1.1.1/32 +*>i 10.1.1.0/26 +*>i 10.1.1.64/26 +*>i 10.1.1.128/26 +*>i 10.1.1.192/26 +r>i 10.1.5.0/24 +r>i 10.1.12.0/24 +r>i 10.1.13.0/24 + +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 + +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +0 100 +0 100 + +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 65501 ? +0 65501 ? + + +Total number of prefixes 8 +R5#show bgp ipv4 unicast neighbors 3.3.3.3 routes +BGP table version is 56, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path +r i 10.1.5.0/24 3.3.3.3 3328 100 0 i + +Total number of prefixes 1 + +You access R3 and issue the show bgp ipv4 unicast neighbors 5.5.5.5 advertised-routes command to determine which routes, if any, R3 is sending to R5. In Example 18-56 you can see that there are no routes related to the 10.1.1.x/26 networks being advertised to R5. So, that raises the question, does R3 even know about the networks? + +Example 18-56 Examining Routes Sent from R3 to R5 + +R3#show bgp ipv4 unicast neighbors 5.5.5.5 advertised-routes +BGP table version is 108, local router ID is 3.3.3.3 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path +*> 10.1.5.0/24 10.1.34.4 3328 32768 i + +Total number of prefixes 1 + +On R3, you issue the command show ip route 10.1.1.0 255.255.255.0 longer-prefixes, as shown in Example 18-57, and confirm that the networks are learned via BGP. However, you also notice something else that is strange. The AD is 200, which is the value associ-ated with iBGP-learned routes and the next hop is via 2.2.2.2, which is R2. The AD should be 20 for eBGP, and the next hop should be R1’s IP in this case. + + +From the Library of Outcast Outcast +794 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 18-57 Examining BGP Routes in R3’s Routing Table + +R3#show ip route 10.1.1.0 255.255.255.0 longer-prefixes +Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP ++ - replicated route, % - next hop override + +Gateway of last resort is not set + +10.0.0.0/8 is variably subnetted, 14 subnets, 3 masks +B 10.1.1.0/26 [200/0] via 2.2.2.2, 00:09:07 +B 10.1.1.64/26 [200/0] via 2.2.2.2, 00:09:07 +B 10.1.1.128/26 [200/0] via 2.2.2.2, 00:09:07 +B 10.1.1.192/26 [200/0] via 2.2.2.2, 00:09:07 + +You issue the command show bgp ipv4 unicast on R3 to check the BGP table, as shown in Example 18-58. Based on the output, only R2 and R4 are next hops for routes. R1 is not a next hop for any of them. + +Example 18-58 Examining BGP Routes in R3’s BGP Table + +R3#show bgp ipv4 unicast +BGP table version is 108, local router ID is 3.3.3.3 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*>i 1.1.1.1/32 +*>i 10.1.1.0/26 +*>i 10.1.1.0/24 +*>i 10.1.1.64/26 +*>i 10.1.1.128/26 +*>i 10.1.1.192/26 +* i 10.1.5.0/24 +*> +r>i 10.1.12.0/24 +r>i 10.1.13.0/24 + +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +2.2.2.2 +10.1.34.4 +2.2.2.2 +2.2.2.2 + +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +3328 +0 100 +0 100 + +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +32768 i +0 65501 ? +0 65501 ? + + +Issuing the show bgp ipv4 unicast neighbors 10.1.13.1 routes command on R3 confirms that no routes are being received from R1, as shown in Example 18-59. + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 795 + +Example 18-59 Verifying Routes Learned from R1 + +R3#show bgp ipv4 unicast neighbors 10.1.13.1 routes + +Total number of prefixes 0 + +Because R1 is not in your autonomous system, you cannot access it for troubleshoot-ing purposes. Therefore, you will need to call the admin in autonomous system 65501. +However, do not do that just yet. We can check many more items on R3. For example, to learn BGP routes, you need a BGP adjacency. To confirm that R3 is a neighbor with R1, you issue the show bgp ipv4 unicast summary command, as shown in Example 18-60. Based on the output, R1 and R3 are not neighbors because the state is listed as idle. You think you have found the issue. + +Example 18-60 Verifying Neighbor Adjacency Between R1 and R3 + +R3#show bgp ipv4 unicast summary +BGP router identifier 3.3.3.3, local AS number 65502 +BGP table version is 108, main routing table version 108 +9 network entries using 1296 bytes of memory +10 path entries using 800 bytes of memory +5/4 BGP path/bestpath attribute entries using 680 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 2800 total bytes of memory +BGP activity 17/8 prefixes, 71/61 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/ PfxRcd + +2.2.2.2 +4.4.4.4 +5.5.5.5 + +4 65502 34 34 +4 65502 47 48 +4 65502 5 6 + +108 0 0 00:24:29 9 +108 0 0 00:39:00 0 +108 0 0 00:00:18 0 + +10.1.13.1 4 65510 0 0 1 0 0 never Idle + +Comparing the output in Example 18-60 to your network documentation (Figure 18-9), you notice that the autonomous system number is incorrect for 10.1.13.1. It is listed as 65510 when it should be 65501. To fix the issue, you remove the current neighbor remote-as statement and add the correct one, as shown in Example 18-61. Once the changes are made, the neighbor relationship is up. + +Example 18-61 Modifying the neighbor remote-as Statement + +R3#config t +Enter configuration commands, one per line. End with CNTL/Z. +R3(config)#router bgp 65502 +R3(config-router)#no neighbor 10.1.13.1 remote-as 65510 +R3(config-router)#neighbor 10.1.13.1 remote-as 65501 +%BGP-5-ADJCHANGE: neighbor 10.1.13.1 Up +R3(config-router)# + + +From the Library of Outcast Outcast +796 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +To confirm that everything is fine, you access R5 and issue the show bgp ipv4 unicast command and confirm that routes from R2 and R3 are now listed in the BGP table, as shown in Example 18-62. Issue solved. After hours, you will bring down the link between R1 and R2 and confirm that traffic successfully flows between R3 and R1. + +Example 18-62 Confirming R5 Knows Routes from R2 and R3 + +R5#show bgp ipv4 unicast +BGP table version is 56, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +* i 1.1.1.1/32 +*>i +* i 10.1.1.0/26 +*>i +* i 10.1.1.64/26 +*>i +* i 10.1.1.128/26 +*>i +* i 10.1.1.192/26 +*>i +r i 10.1.5.0/24 +r>i + +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 + +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +0 100 +3328 100 +3328 100 + +0 65501 ? +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 i + +Network Next Hop Metric LocPrf Weight Path + +r i 10.1.12.0/24 +r>i +r i 10.1.13.0/24 +r>i + +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 + +0 100 0 65501 ? +0 100 0 65501 ? +0 100 0 65501 ? +0 100 0 65501 ? + + +With a little bit of spare time on your hands, you decide to check the log files from R3. You notice the following BGP message listed many times: + +%BGP-3-NOTIFICATION: sent to neighbor 10.1.13.1 passive 2/2 (peer in wrong AS) 2 bytes FFDD +The syslog message clearly states that the peer is in the wrong autonomous system. Never forget to check your log files before you troubleshoot. It can save you valuable time. + +Trouble Ticket 18-2 + +Problem: You are the administrator for BGP autonomous system 65501. Users in the 10.1.1.0/26 and 10.1.1.64/26 networks have indicated that they are not able to access resources located at 10.1.5.5. However, they can access resources locally. + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 797 + +You begin troubleshooting by issuing two pings on R1 to 10.1.5.5 and sourcing them from 10.1.1.1 and 10.1.1.65. As shown in Example 18-63, the pings fail. + +Example 18-63 Verifying Issue with a Ping + +R1#ping 10.1.5.5 source 10.1.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.5.5, timeout is 2 seconds: +Packet sent with a source address of 10.1.1.1 +..... +Success rate is 0 percent (0/5) +R1#ping 10.1.5.5 source 10.1.1.65 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.5.5, timeout is 2 seconds: +Packet sent with a source address of 10.1.1.65 +..... +Success rate is 0 percent (0/5) + +You confirm with the command show ip route 10.1.5.5 on R1, as shown in Example 18-64, that there is a route to 10.1.5.5 via R2 learned via BGP. + +Example 18-64 Confirming R1 Has a Route to 10.1.5.5 + +R1#show ip route 10.1.5.5 +Routing entry for 10.1.5.0/24 +Known via "bgp 65501", distance 20, metric 3328 +Tag 65502, type external +Last update from 2.2.2.2 00:12:35 ago +Routing Descriptor Blocks: +* 2.2.2.2, from 2.2.2.2, 00:12:35 ago +Route metric is 3328, traffic share count is 1 +AS Hops 1 +Route tag 65502 +MPLS label: none + +You would like to see how far the packets are traveling to get a rough idea of where they might be failing. Therefore, you decide to issue an extended traceroute to hopefully gath-er some additional information. In Example 18-65, you can see that the trace is failing at the next hop router (R2). + +Example 18-65 Identifying How Far Packets Are Traveling Before They Fail + +R1#traceroute 10.1.5.5 source 10.1.1.1 +Type escape sequence to abort. +Tracing the route to 10.1.5.5 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.12.2 40 msec 44 msec 28 msec +2 * * * +3 * * * + + + +From the Library of Outcast Outcast +798 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +4 * * * +...output omitted... +R1#traceroute 10.1.5.5 source 10.1.1.65 +Type escape sequence to abort. +Tracing the route to 10.1.5.5 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.12.2 44 msec 48 msec 36 msec +2 * * * +3 * * * +4 * * * +...output omitted... + +You are a bit confused, so you sit back and review what you know. You have confirmed that R1 knows about 10.1.5.5 via R2. Therefore, R1 can route packets toward that address. However, the trace that was executed is failing at R2. Is it possible that R2 does not know how to reach 10.1.1.0/26 or 10.1.1.64/26 to respond to the trace? Is it possible +that 10.1.5.5 does not know about the networks either and cannot respond to the ping? You decide to focus on your thoughts about R2. R2 needs to know about the routes 10.1.1.0/26 and 10.1.1.64/26 to successfully respond to the trace. Therefore, R1 needs to be advertising the networks with the BGP network mask command. On R1, you issue the command show bgp ipv4 unicast to verify whether 10.1.1.0/26 and 10.1.1.64/26 are in the BGP table. As shown in Example 18-66, they are. Because they are in the BGP table and they are listed as valid and best, they can be advertised to the neighbors. + +Example 18-66 Verifying R1’s BGP Table + +R1#show bgp ipv4 unicast +BGP table version is 10, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 1.1.1.1/32 +*> 10.1.1.0/26 +*> 10.1.1.64/26 +*> 10.1.1.128/26 +*> 10.1.1.192/26 +* 10.1.5.0/24 +*> +*> 10.1.12.0/24 +*> 10.1.13.0/24 + +0.0.0.0 +0.0.0.0 +0.0.0.0 +0.0.0.0 +0.0.0.0 +10.1.13.3 +2.2.2.2 +0.0.0.0 +0.0.0.0 + +0 32768 ? +0 32768 i +0 32768 i +0 32768 i +0 32768 i +3328 0 65502 i +3328 0 65502 i +0 32768 ? +0 32768 ? + + +You issue the command show bgp ipv4 unicast summary to verify the BGP neighbors. Based on the output in Example 18-67, you confirm that both R2 and R3 are BGP neigh-bors because there is a number in the PfxRcd column. + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 799 + +Example 18-67 Verifying R1’s BGP Neighbors + +R1#show bgp ipv4 unicast summary +BGP router identifier 1.1.1.1, local AS number 65501 +BGP table version is 10, main routing table version 10 +9 network entries using 1296 bytes of memory +10 path entries using 800 bytes of memory +4/4 BGP path/bestpath attribute entries using 544 bytes of memory +1 BGP AS-PATH entries using 24 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 2664 total bytes of memory +BGP activity 19/10 prefixes, 54/44 paths, scan interval 60 secs + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +2.2.2.2 4 65502 38 39 +10.1.13.3 4 65502 7 6 + +10 0 0 00:30:05 1 +10 0 0 00:02:06 1 + + +Next you issue the show bgp ipv4 unicast neighbors 2.2.2.2 advertised-routes com-mand and the show bgp ipv4 unicast neighbors 10.1.13.3 advertised-routes command to verify which routes are being advertised to R2 and R3. As verified in Example 18-68, no routes are being advertised to the neighbors. + +Example 18-68 Verifying R1’s Advertised Routes + +R1#show bgp ipv4 unicast neighbors 2.2.2.2 advertised-routes + +Total number of prefixes 0 +R1#show bgp ipv4 unicast neighbors 10.1.13.3 advertised-routes + +Total number of prefixes 0 + +What could prevent a route that is valid and best in the BGP table from being advertised to an eBGP neighbor? A filter? You decide to check the output of show ip protocols +to determine whether a filter is applied to the BGP autonomous system. As shown in Example 18-69, no filter is applied. + +Example 18-69 Verifying Whether R1 Has Any BGP Filters. + +R1#show ip protocols +*** IP Routing is NSF aware *** + +Routing Protocol is "bgp 65501" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +IGP synchronization is disabled +Automatic route summarization is disabled +Redistributing: connected +Unicast Aggregate Generation: + + + +From the Library of Outcast Outcast +800 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10.1.1.0/24 +Neighbor(s): +Address FiltIn FiltOut DistIn DistOut Weight RouteMap +2.2.2.2 +10.1.13.3 +Maximum path: 1 +Routing Information Sources: + +Gateway +2.2.2.2 +10.1.13.3 + +Distance +20 +20 + +Last Update +00:37:02 +21:12:13 + +Distance: external 20 internal 200 local 200 + +But wait, you remember from your TSHOOT studies that a prefix list filter does not show up in the output of show ip protocols. It shows up only in the BGP neighbor output. Therefore, you issue the command show bgp ipv4 unicast neighbors | i prefix to see whether there is any prefix list applied at all. In the output of Example 18-70, you can see the same prefix list called BGP_FILTER applied twice in the outbound direction. + +Example 18-70 Verifying Whether R1 Has Any BGP Prefix List Filters + +R1#show bgp ipv4 unicast neighbors | i prefix +Outgoing update prefix filter list is BGP_FILTER +prefix-list 27 0 +Outgoing update prefix filter list is BGP_FILTER +prefix-list 27 0 + +Now you feel like you are on the right track. Therefore, you issue the show run | section router bgp command, as shown in Example 18-71, to examine the BGP configuration on R1 and look for the culprit. You immediately notice that the prefix list BGP_FILTER is applied to neighbor 2.2.2.2 and 10.1.13.3 in the outbound direction. + +Example 18-71 Verifying BGP Configuration on R1 + +R1#show run | section router bgp +router bgp 65501 +bgp log-neighbor-changes +network 10.1.1.0 mask 255.255.255.192 +network 10.1.1.64 mask 255.255.255.192 +network 10.1.1.128 mask 255.255.255.192 +network 10.1.1.192 mask 255.255.255.192 +aggregate-address 10.1.1.0 255.255.255.0 +redistribute connected +neighbor 2.2.2.2 remote-as 65502 +neighbor 2.2.2.2 password CISCO +neighbor 2.2.2.2 ebgp-multihop 2 +neighbor 2.2.2.2 update-source Loopback0 +neighbor 2.2.2.2 prefix-list BGP_FILTER out +neighbor 10.1.13.3 remote-as 65502 +neighbor 10.1.13.3 prefix-list BGP_FILTER out + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 801 + +Now you want to examine the prefix list, so you issue the command show ip prefix-list BGP_FILTER, as shown in Example 18-72. You immediately notice that 10.1.1.128/26 and 10.1.1.192/26 are being denied. Therefore, they are not being advertised to R2 or R3. You check your documentation, and it states that 10.1.1.128/26 and 10.1.1.192/26 should not be advertised to BGP autonomous system 65502, which this prefix list accomplishes. + +Example 18-72 Verifying a Prefix List on R1 + +R1#show ip prefix-list BGP_FILTER +ip prefix-list BGP_FILTER: 2 entries +seq 5 deny 10.1.1.128/26 +seq 10 deny 10.1.1.192/26 + +You think about this issue a bit more, and then it hits you. The implicit deny all at the end of the prefix list is denying all other routes. You propose that by adding the entry ip prefix-list BGP_FILTER permit 0.0.0.0/0 le 32, as shown in Example 18-73, to R1 will permit all other routes, which in this case are 10.1.1.0/26 and 10.1.1.64/26. The command show ip prefix-list BGP_FILTER confirms that it has been added. + +Example 18-73 Modifying a Prefix List on R1 + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ip prefix-list BGP_FILTER permit 0.0.0.0/0 le 32 +R1(config)#end +%SYS-5-CONFIG_I: Configured from console by console +R1#show ip prefix-list BGP_FILTER +ip prefix-list BGP_FILTER: 3 entries +seq 5 deny 10.1.1.128/26 +seq 10 deny 10.1.1.192/26 +seq 15 permit 0.0.0.0/0 le 32 + +To force a refresh of the BGP information being sent to R1’s neighbors, you issue the clear bgp ipv4 unicast * soft out command. You then issue the commands show bgp ipv4 unicast neighbors 2.2.2.2 advertised-routes and show bgp ipv4 unicast neighbors 10.1.13.3 advertised-routes to confirm that routes are now being advertised to R1’s neighbors. The output of Example 18-74 confirms that 10.1.1.0/26 and 10.1.1.64/26 are now being advertised. + +Example 18-74 Verifying Routes Advertised to R1’s Neighbors + +R1#show bgp ipv4 unicast neighbors 2.2.2.2 advertised-routes +BGP table version is 10, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + + + + +From the Library of Outcast Outcast +802 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Network Next Hop Metric LocPrf Weight Path + +*> 1.1.1.1/32 +*> 10.1.1.0/26 +*> 10.1.1.64/26 + +0.0.0.0 +0.0.0.0 +0.0.0.0 + +0 32768 ? +0 32768 i +0 32768 i + +...output omitted... +R1#show bgp ipv4 unicast neighbors 10.1.13.3 advertised-routes +BGP table version is 10, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*> 1.1.1.1/32 +*> 10.1.1.0/26 +*> 10.1.1.64/26 + +0.0.0.0 +0.0.0.0 +0.0.0.0 + +0 32768 ? +0 32768 i +0 32768 i + +...output omitted... + +However, you still want to confirm the problem is solved. Can users in 10.1.1.0/26 and 10.1.1.64/26 reach 10.1.5.5? To confirm the problem is solved, you ping 10.1.5.5 from 10.1.1.1 and 10.1.1.65 again. As shown in Example 18-75, it is solved. + +Example 18-75 Verifying That the Problem Is Solved + +R1#ping 10.1.5.5 source 10.1.1.1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.5.5, timeout is 2 seconds: +Packet sent with a source address of 10.1.1.1 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 44/58/68 ms +R1#ping 10.1.5.5 source 10.1.1.65 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.5.5, timeout is 2 seconds: +Packet sent with a source address of 10.1.1.65 +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 20/48/80 ms + + +Trouble Ticket 18-3 + +Problem: You are the administrator for BGP autonomous system 65502. Traffic reports indicate that all traffic out of the autonomous system is flowing through R3 and across the backup link. This is undesirable unless the link between R2 and R1 fails. + +To verify the issue, you use traceroute from R5. As shown in Example 18-76, the trace to 10.1.1.1 and 10.1.1.65 goes through R3 to get to autonomous system 65501. + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 803 + +Example 18-76 Verifying the Issue + +R5#traceroute 10.1.1.1 source 10.1.5.5 +Type escape sequence to abort. +Tracing the route to 10.1.1.1 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.45.4 48 msec 40 msec 28 msec +2 10.1.34.3 64 msec 32 msec 60 msec +3 10.1.13.1 [AS 65501] 72 msec 52 msec 48 msec +R5#traceroute 10.1.1.65 source 10.1.5.5 +Type escape sequence to abort. +Tracing the route to 10.1.1.65 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.45.4 48 msec 40 msec 28 msec +2 10.1.34.3 64 msec 32 msec 60 msec +3 10.1.13.1 [AS 65501] 72 msec 52 msec 48 msec + +On R5, you issue the show ip route 10.1.1.1 command and show ip route 10.1.1.65 com-mand to verify the routes. As shown in Example 18-77, the routes were learned via iBGP and are reachable via 3.3.3.3, which is R3. + +Example 18-77 Verifying the Routes on R5 + +R5#show ip route 10.1.1.1 +Routing entry for 10.1.1.0/26 +Known via "bgp 65502", distance 200 , metric 0 +Tag 65501, type internal +Last update from 3.3.3.3 00:01:09 ago +Routing Descriptor Blocks: +* 3.3.3.3, from 3.3.3.3, 00:01:09 ago +Route metric is 0, traffic share count is 1 +AS Hops 1 +Route tag 65501 +MPLS label: none +R5#show ip route 10.1.1.65 +Routing entry for 10.1.1.64/26 +Known via "bgp 65502", distance 200 , metric 0 +Tag 65501, type internal +Last update from 3.3.3.3 00:02:10 ago +Routing Descriptor Blocks: +* 3.3.3.3, from 3.3.3.3, 00:02:10 ago +Route metric is 0, traffic share count is 1 +AS Hops 1 +Route tag 65501 +MPLS label: none + +Are the routes being learned from R2? You issue the show bgp ipv4 unicast command to examine the BGP table. According to the BGP table in Example 18-78 10.1.1.0/26 and + + + +From the Library of Outcast Outcast +804 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +10.1.1.64/26 are both learned via R2 as well. So, why is R5 preferring R3 as the best path? You must now examine the BGP path selection process between the next hops 2.2.2.2 and 3.3.3.3. + +First of all, can R5 reach 2.2.2.2 and 3.3.3.3? Obviously, 3.3.3.3 is reachable because R5 is using it at the moment. However, using the command show ip route 2.2.2.2, as shown in Example 18-79, confirms that 2.2.2.2 is reachable as well. This is important because a path will never be used if the next hop is not reachable. + +Next you examine weight as shown in Example 18-78. It is 0 for both the path via 2.2.2.2 and 3.3.3.3. Therefore, a tie means check the next attribute, which is local preference. In this case, the path via 2.2.2.2 is 50, and the path via 3.3.3.3 is 100. Local preference has a default value of 100, and higher is better. That is why 3.3.3.3 is preferred. It has the higher local preference. It appears the path via 2.2.2.2 had its local preference modified either when it was advertised by R2 or when it was received by R5. + +Example 18-78 Examining R5’s BGP Table + +R5#show bgp ipv4 unicast +BGP table version is 613, local router ID is 5.5.5.5 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path + +*>i 1.1.1.1/32 +* i +*>i 10.1.1.0/26 +* i +*>i 10.1.1.64/26 +* i +r>i 10.1.5.0/24 +r i +r>i 10.1.12.0/24 +r i +r>i 10.1.13.0/24 +r i + +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 +3.3.3.3 +2.2.2.2 + +0 100 +0 50 +0 100 +0 50 +0 100 +0 50 +3328 100 +3328 50 +0 100 +0 50 +0 100 +0 50 + +0 65501 ? +0 65501 ? +0 65501 i +0 65501 i +0 65501 i +0 65501 i +0 i +0 i +0 65501 ? +0 65501 ? +0 65501 ? +0 65501 ? + + + +Example 18-79 Confirming That 2.2.2.2 Is Reachable + +R5#show ip route 2.2.2.2 +Routing entry for 2.2.2.2/32 +Known via "eigrp 100", distance 90, metric 131072, type internal +Redistributing via eigrp 100 +Last update from 10.1.45.4 on GigabitEthernet1/0, 22:33:44 ago +Routing Descriptor Blocks: +* 10.1.45.4, from 10.1.45.4, 22:33:44 ago, via GigabitEthernet1/0 + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 805 + +Route metric is 131072, traffic share count is 1 +Total delay is 5020 microseconds, minimum bandwidth is 1000000 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 2 + +You examine R5’s BGP configuration with the show run | section router bgp command. As shown in Example 18-80, there is no indication that the local preference is being modi-fied. If there were, we would see a route map applied to the neighbor statement of 2.2.2.2. + +Example 18-80 Examining R5’s BGP Configuration + +R5#show run | section router bgp +router bgp 65502 +bgp log-neighbor-changes +neighbor 2.2.2.2 remote-as 65502 +neighbor 2.2.2.2 update-source Loopback0 +neighbor 3.3.3.3 remote-as 65502 +neighbor 3.3.3.3 update-source Loopback0 + +Next you move to R2 and issue the show run | section router bgp command. Immediately you notice a route map called TSHOOT_BGP_FILTER applied in the out-bound direction for the peer group called TSHOOT_IBGP_NEIGHBORS, as shown in Example 18-81. You also notice that R5 is part of the peer group. Therefore, the route map applies to R5. You need to dig into the route map now, so you issue the command show route-map TSHOOT_BGP_FILTER. As shown in Example 18-82, the route map is setting the local preference to 50. You examine the network documentation, and it states that the local preference should be 150. + +Example 18-81 Examining R2’s BGP Configuration + +R2#show run | section router bgp +router bgp 65502 +bgp log-neighbor-changes +network 10.1.5.0 mask 255.255.255.0 +neighbor TSHOOT_IBGP_NEIGHBORS peer-group +neighbor TSHOOT_IBGP_NEIGHBORS transport connection-mode passive +neighbor TSHOOT_IBGP_NEIGHBORS update-source Loopback0 +neighbor TSHOOT_IBGP_NEIGHBORS next-hop-self +neighbor TSHOOT_IBGP_NEIGHBORS route-map TSHOOT_BGP_FILTER out +neighbor 1.1.1.1 remote-as 65501 +neighbor 1.1.1.1 password CISCO +neighbor 1.1.1.1 ebgp-multihop 2 +neighbor 1.1.1.1 update-source Loopback0 +neighbor 3.3.3.3 remote-as 65502 +neighbor 3.3.3.3 peer-group TSHOOT_IBGP_NEIGHBORS +neighbor 4.4.4.4 remote-as 65502 +neighbor 4.4.4.4 peer-group TSHOOT_IBGP_NEIGHBORS +neighbor 5.5.5.5 remote-as 65502 +neighbor 5.5.5.5 peer-group TSHOOT_IBGP_NEIGHBORS + + +From the Library of Outcast Outcast +806 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 18-82 Examining R2’s Route Map + +R2#show route-map TSHOOT_BGP_FILTER +route-map TSHOOT_BGP_FILTER, permit, sequence 10 +Match clauses: +Set clauses: +local-preference 50 +Policy routing matches: 0 packets, 0 bytes + +You modify the route map on R2, as shown in Example 18-83, to solve the issue. You confirm the changes were applied by using the command show route-map TSHOOT_ BGP_FILTER. The local preference has been successfully modified to 150. To speed up the BGP changes, you issue the clear bgp ipv4 unicast * soft out command. + +Example 18-83 Modifying the Local Preference Value in the Route Map + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#route-map TSHOOT_BGP_FILTER 10 +R2(config-route-map)#set local-preference 150 +R2(config-route-map)#end +%SYS-5-CONFIG_I: Configured from console by console +R2#show route-map TSHOOT_BGP_FILTER +route-map TSHOOT_BGP_FILTER, permit, sequence 10 +Match clauses: +Set clauses: +local-preference 150 +Policy routing matches: 0 packets, 0 bytes + +You go back to R5 and issue a trace and confirm that the path through R2 is now being used, as shown in Example 18-84. + +Example 18-84 Confirming That the Issue Is Solved + +R5#traceroute 10.1.1.1 source 10.1.5.5 +Type escape sequence to abort. +Tracing the route to 10.1.1.1 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.45.4 28 msec 44 msec 8 msec +2 10.1.24.2 40 msec 40 msec 40 msec +3 10.1.12.1 [AS 65501] 64 msec 56 msec 100 msec +R5#traceroute 10.1.1.65 source 10.1.5.5 +Type escape sequence to abort. +Tracing the route to 10.1.1.65 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.45.4 28 msec 44 msec 24 msec +2 10.1.24.2 32 msec 56 msec 48 msec +3 10.1.12.1 [AS 65501] 68 msec 36 msec 56 msec + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 807 + +MP-BGP Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 18-10. + + +AS 65501 + +2001:db8:1::/64 eBGP Gi1/0 +Gi0/0 R1 + +AS 65502 + + +ISP Internet + + + + +2001:db8:0::/64 + +Figure 18-10 MP-BGP Trouble Tickets Topology + +Trouble Ticket 18-4 +Problem: You are an administrator of BGP autonomous system 65501. You have been asked by another administrator in your autonomous system for help. The default route from your ISP is not being learned by your router (R1) via BGP. As a result of this, no one in your autonomous system is able to reach the Internet. + +You start by confirming the issue by using the show ipv6 route command on R1. In Example 18-85, no default route is present. The default route is supposed to be learned from the ISP router via MP-eBGP. + +Example 18-85 Verifying the Problem + +R1#show ipv6 route +IPv6 Routing Table - default - 5 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +C 2001:DB8::/64 [0/0] +via GigabitEthernet1/0, directly connected +L 2001:DB8::1/128 [0/0] +via GigabitEthernet1/0, receive +C 2001:DB8:1::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:1::1/128 [0/0] +via GigabitEthernet0/0, receive +L FF00::/8 [0/0] +via Null0, receive + + +From the Library of Outcast Outcast +808 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +You issue the command show bgp ipv6 unicast to verify the contents of the IPv6 BGP table, as shown in Example 18-86. There is nothing in the IPv6 BGP table. + +Example 18-86 Viewing the IPv6 BGP Table + +R1#show bgp ipv6 unicast +R1# + +Next you verify whether there are any IPv6 unicast BGP neighbors on R1. The output of show bgp ipv6 unicast summary indicates that there are no neighbors, as shown in Example 18-87. + +Example 18-87 Viewing the IPv6 Unicast BGP Neighbors + +R1#show bgp ipv6 unicast summary +R1# + +You have a feeling that there is an error in the BGP configuration on R1. Therefore, you issue the show run | section router bgp command to verify R1’s BGP configuration. As shown in Example 18-88, the neighbor 2001:DB8::2 remote-as 65502 command is specified. The address is correct, and the remote autonomous system is correct. However, you notice the command no neighbor 2001:DB8::2 activate, which means that the neighbor is not activated in the AF. However, be careful here. This is the IPv4 AF, and we are dealing with IPv6. Therefore, we need to activate the neighbor in the IPv6 AF. Upon closer look, there is no IPv6 AF specified, and as a result, the neighbor 2001:DB8::2 is not activated. + +Example 18-88 Viewing the BGP Configuration on R1 + +R1#show run | section router bgp +router bgp 65501 +bgp router-id 1.1.1.1 +bgp log-neighbor-changes +neighbor 2001:DB8::2 remote-as 65502 +! +address-family ipv4 +no neighbor 2001:DB8::2 activate +exit-address-family + +To solve this issue, you need to activate the neighbor with the neighbor 2001:DB8::2 activate command in IPv6 AF configuration mode, as shown in Example 18-89. After you activate the neighbor, the adjacency comes up. + +Example 18-89 Activating the Neighbor in Address Family Configuration Mode + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#router bgp 65501 +R1(config-router)#address-family ipv6 unicast + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 809 + +R1(config-router-af)#neighbor 2001:db8::2 activate +R1(config-router-af)# +%BGP-5-ADJCHANGE: neighbor 2001:DB8::2 Up + +You examine the IPv6 BGP table on R1 again with the show bgp ipv6 unicast command and notice that the default route is now listed in Example 18-90. The routing table, as shown in Example 18-91, also shows the default route. Problem solved! + +Example 18-90 Verifying That the Default Route Is in the IPv6 BGP Table on R1 + +R1#show bgp ipv6 unicast +BGP table version is 4, local router ID is 1.1.1.1 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, +x best-external, a additional-path, c RIB-compressed, +Origin codes: i - IGP, e - EGP, ? - incomplete +RPKI validation codes: V valid, I invalid, N Not found + +Network Next Hop Metric LocPrf Weight Path +*> ::/0 2001:DB8::2 0 0 65502 i + + +Example 18-91 Verifying That the Default Route Is in the IPv6 Routing Table on R1 + +R1#show ipv6 route +IPv6 Routing Table - default - 6 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route +B - BGP, R - RIP, H - NHRP, I1 - ISIS L1 +I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP +EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination +NDr - Redirect, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1 +OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP +B ::/0 [20/0] +via FE80::C836:17FF:FEE8:1C, GigabitEthernet1/0 +C 2001:DB8::/64 [0/0] +via GigabitEthernet1/0, directly connected +L 2001:DB8::1/128 [0/0] +via GigabitEthernet1/0, receive +C 2001:DB8:1::/64 [0/0] +via GigabitEthernet0/0, directly connected +L 2001:DB8:1::1/128 [0/0] +via GigabitEthernet0/0, receive +L FF00::/8 [0/0] +via Null0, receive + + + + + + + + +From the Library of Outcast Outcast +810 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 18-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 18-2 Key Topics for Chapter 18 Key +Topic Key Topic Element Description Page Number + + +Example 18-1 + +List + +Section + +Section + +Paragraph + +Paragraph + + +Paragraph + +Paragraph + +List + +Example 18-22 + +List + +Paragraph + +Paragraph + +Paragraph + +Verifying BGP neighbors with show bgp ipv4 753 unicast summary +Outlines the issues you should consider when 753 troubleshooting BGP neighbor relationships +Path to neighbor is via default route 755 + +Incorrect neighbor remote-as statement 757 + +Discusses how to control the source address of BGP 758 packets +Describes how BGP TCP sessions are formed and 760 how you can control the server and client for the +TCP session + +Explains how to manipulate the TTL of an eBGP 763 packet +Describes how the minimum hold-time parameter 765 can prevent BGP neighbor relationships +Outlines the reasons why a BGP route might be 766 missing from the BGP table or the routing table +Examining the BGP table 767 + +Identifies the requirements of the BGP network 768 mask command +Discusses the BGP next-hop issue 770 + +Describes how to identify BGP split-horizon issues 773 + +Outlines how to troubleshoot filters that may be 778 preventing BGP routes from being advertised or +learned + + + + +From the Library of Outcast Outcast +Chapter 18: Troubleshooting BGP 811 + + +Key Topic Element Description Page Number + +List + +Paragraph + + +Paragraph + +Provides the steps that BGP uses to successfully 781 determine the best path to reach a given network +Describes the next-hop issue that occurs when 788 exchanging IPv6 BGP routes over IPv4 BGP TCP +sessions + +Describes how to solve the next-hop issue that 788 occurs when exchanging IPv6 BGP routes over IPv4 +BGP TCP sessions + + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +BGP, EGP, eBGP, iBGP, MP-BGP, ISP, address family, TTL, peer group, split-horizon rule (iBGP), weight, local preference, autonomous system path, MED + +Command Reference to Check Your Memory + +This section includes the most important show and debug commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 18-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully identify and troubleshoot the issues presented in this chapter. + +Table 18-3 show and debug Commands + +Task Command Syntax + +Displays a router’s BGP RID, autonomous system number, information about the BGP’s memory usage, and summary information about IPv4/IPv6 unicast BGP neighbors. +Displays detailed information about all the IPv4/IPv6 BGP neighbors of a router. +Displays the IPv4/IPv6 network prefixes present in the IPv4/IPv6 BGP table. + + +show bgp {ipv4 | ipv6} unicast summary + + + +show bgp {ipv4 | ipv6}unicast neighbors + +show bgp {ipv4 | ipv6}unicast + + + + + + +From the Library of Outcast Outcast +812 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Shows routes known to a router’s IPv4/IPv6 routing table that were learned via BGP. +Provides real-time information about BGP events, such as the establishment of a peering relationship. +Shows real-time information about BGP updates sent and received by a BGP router. +Displays updates that occur in a router’s IP routing table. Therefore, this command is not specific to BGP. + +Command Syntax +show {ipv4 | ipv6}route bgp + +debug ip bgp + + +debug ip bgp updates + +debug ip routing + + + +Note The command show ip bgp will display the same output as show bgp ipv4 uni-cast. The command show ip bgp summary will display the same output as show bgp ipv4 unicast summary. The command show ip bgp neighbors will display the same output as show bgp ipv4 unicast neighbors. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Management Protocols Troubleshooting: This sec-tion examines how to recognize and troubleshoot issues related to management protocols such as NTP, syslog, and SNMP. + +■ Management Tools Troubleshooting: This section examines how to recognize and troubleshoot issues related to management tools such as Cisco IP SLA, object tracking, SPAN, and RSPAN. + +■ Management Protocols and Tools Trouble Tickets: This section provides trouble tickets that demon-strate how you can use a structured troubleshooting process to solve a reported problem. + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 19 + + + + +Troubleshooting Management Protocols and Tools + + +During your troubleshooting endeavors, you will rely on various protocols and tools to help you solve the problems that are being presented. Some tools will be used to notify you of issues, some will be used to gather additional information, and some will even be used to help you monitor and maintain the health of the network. + +This chapter covers how to identify and troubleshoot issues related to management pro-tocols such as Network Time Protocol (NTP), which is used to keep accurate time in the network; syslog, which will notify you of changes on a device; and Simple Network Management Protocol (SNMP), which is used to monitor the health of a device. + +In addition, this chapter explains how to identify and troubleshoot issues related to management tools such as Cisco IP SLA (service level agreement), which can measure the health of your network; object tracking, which can keep track of the status of an object; and Switched Port Analyzer / Remote Switched Port Analyzer (SPAN/RSPAN), +which enables you to copy frames from one switchport on a switch to a port on the same switch or a different switch. + +Usually, you will be spending your time troubleshooting issues using these management protocols and tools. However, you might sometimes troubleshoot issues related to the protocols and tools that help you. When that time comes, you need to be ready. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 19-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 19-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Management Protocols Troubleshooting + +Management Tools Troubleshooting + +Questions +1–6 + +7–10 + + + + + + +From the Library of Outcast Outcast +816 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + +1. Which port does NTP use? + +a. 22 + +b. 23 + +c. 123 + +d. 514 + +2. Which stratum level indicates that an NTP server is not reachable? + +a. 1 + +b. 5 + +c. 10 + +d. 16 + +3. Which port is used by syslog? + +a. 22 + +b. 23 + +c. 110 + +d. 514 + +4. You have accessed a router via telnet and issued the debug ntp packets command. No debugs are being displayed in the terminal window even though the logging level to the vty lines is set to debugging. Why? +a. Debugs are not sent to the vty lines. + +b. You need to issue the terminal no monitor command. + +c. You need to issue the terminal monitor command. + +d. Debugs need to be enabled. + +5. Which command enables you to verify which SNMP group a user belongs to? + +a. show snmp user + +b. show snmp group + +c. show snmp host + +d. show snmp view + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 817 + +6. Which two commands are used to verify the OIDs that a particular group is able to access on the local device? + +a. show snmp user + +b. show snmp group + +c. show snmp host + +d. show snmp view + +7. Which command enables you to verify the number of successes and failures for an IP SLA instance? + +a. show ip sla configuration + +b. show ip sla statistics + +c. show ip sla responder + +d. show ip sla summary + +8. Which of the following statements are true? (Choose two answers.) + +a. A SPAN session copies packets from a switchport on one device to a switchport on the same device. + +b. A SPAN session copies packets from a switchport on one device to a switchport on a different device. + +c. An RSPAN session copies packets from a switchport on one device to a switch-port on the same device. + +d. An RSPAN session copies packets from a switchport on one device to a switch-port on a different device. + +9. Which two commands can be used to verify that a switchport is a destination SPAN or RSPAN monitoring port? + +a. show ip interface brief + +b. show ip interfaces + +c. show interfaces status + +d. show monitor + +10. Which three commands enable you to verify that a VLAN is an RSPAN VLAN? + +a. show vlan + +b. show vlan brief + +c. show monitor + +d. show vlan remote-span + + + + + +From the Library of Outcast Outcast +818 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Foundation Topics + + +Management Protocols Troubleshooting + +Tools such as syslog and SNMP help you monitor the health of your network devices. They are very valuable tools if they are working properly. If they have been misconfig-ured, you will not be able to gather the information you need while troubleshooting specific events, or be notified that an event has occurred. In addition, it is important that you know what time the events occurred. Therefore, you need accurate time using a pro-tocol such as NTP. However, if there is an issue with NTP, you need to be able to solve it quickly so that log messages have the appropriate time. + +This section explains how to identify and troubleshoot issues related to NTP, syslog, and SNMP. + +NTP Troubleshooting + +Network Time Protocol is used to synchronize clocks among the various network devic-es. It is a client/server protocol where NTP servers provide time to NTP clients. There are many reasons as to why a device configured as an NTP client might not be able to syn- +chronize with an NTP server. The following list details many of these reasons: + + +■ Key +Topic + + + +■ + + + + + + +■ + + + + +■ + +The time server is not reachable: To synchronize with the NTP server, you have to be able to reach it. Use the ping command to verify connectivity from the client to the server. However, be careful to test using the correct destination IP addresses and source IP addresses. For example, if your client is configured to source NTP packets from Loopback 0, you should ping with a source of Loopback 0. + +ACL blocking NTP packets: NTP uses UDP port 123. Therefore, it is important that no access control list (ACL) exists between the NTP client and server that is config-ured to deny NTP packets either on purpose or by accident. You will need to verify whether any ACLs exist on interfaces with the show ip interface interface_type interface_number command and, if you find one, verify the ACL entries with the show access-list command. + +NTP authentication mismatch: Authentication is not required, but if implemented both the server and the client need to be configured with the correct authentication key and key string. To verify the NTP authentication configuration, use the show run | section ntp command. + +The wrong server is being used: You can configure a client with multiple NTP serv-ers; by default, the protocol will choose the best server. However, this many not be the one you want it to use. Therefore, you can force a preferred NTP server with the ntp server ip_address prefer command. To verify which server is being used, use +the show ntp status command. + + + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 819 + +■ High CPU utilization: The CPU is responsible for processing NTP packets. If the CPU is under high load it will fail to process packets and synchronization will fail. You can verify CPU load with the show processes cpu command. + +■ Time offset is too high: If the offset between the clock on the server and the client is extreme, it can take a significant amount of time for the clock to synchronize, or it may not synchronize at all. Therefore, you should manually set the clock with the clock set [hh:mm:ss] [day] [month] [year] command and then allow NTP to fine- +tune the clocks. To verify the clock that is set on a device, issue the show clock com-mand. + +■ Stratum level is too high: The NTP hierarchy is based on stratum levels from 1 to 15. 1 is considered the best (most reliable), and 15 is considered the worst (least reliable). A stratum level of 16 is unreachable. Therefore, if a device is synchronizing with another device that has a stratum of 15, the synchronization will fail. + +■ Server is configured to accept NTP packets from specific IP addresses: You can configure an NTP access group on the NTP server to control which NTP packets will be responded to. If the NTP clients are sourcing NTP packets from the wrong IP address, the server will not respond to the packets as the source address of the packet does not match the ACL. + +Example 19-1 displays the output of show ntp status. With this command, you can verify whether the clock is synchronized, the stratum level, and the IP address of the time server the local device is synchronized with. You can also verify clock statistics if neces-sary. + +Example 19-1 Verifying the Status of NTP on a Client +Key +Topic SW1#show ntp status +Clock is synchronized, stratum 2 , reference is 192.168.1.3 +nominal freq is 119.2092 Hz, actual freq is 119.2116 Hz, precision is 2**17 +reference time is D77BFCDB.2A77CE72 (21:44:59.165 UTC Thu Jul 24 2014) +clock offset is -85.7435 msec, root delay is 43.18 msec +root dispersion is 105.32 msec, peer dispersion is 3.73 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is -0.000020157 s/s +system poll interval is 64, last update was 215 sec ago. + +Example 19-2 displays the output of show ntp associations, which you can use to check the status of the configured NTP servers. You can also verify which server is cur-rently being used for time synchronization and which servers are candidate time servers. Therefore, if there are multiple time servers configured on the device, all of them will be listed here. The * beside 192.168.1.3 indicates that the local device is synchronized with that server. A + beside it means that it is a candidate server for synchronization. + + + + + + + + +From the Library of Outcast Outcast +820 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 19-2 Verifying NTP Time Server Associations on the Client + +SW1#show ntp associations + +address ref clock st when poll reach delay offset disp +*~192.168.1.3 .LOCL. 1 55 64 377 44.591 -97.671 4.366 +* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured + +To obtain detailed output of the NTP server associations (including if the server is authenticated), you can issue the show ntp associations detail command, as shown in Example 19-3. + +Example 19-3 Verifying Details of the NTP Time Servers Associated with the Client +Key +Topic SW1#show ntp associations detail +192.168.1.3 configured, authenticated , our_master, sane, valid, stratum 1 +ref ID .LOCL., time D77C0219.89D511B9 (22:07:21.538 UTC Thu Jul 24 2014) +our mode client, peer mode server, our poll intvl 64, peer poll intvl 64 +root delay 0.00 msec, root disp 0.27, reach 377, sync dist 30.35 +delay 30.37 msec, offset -101.7186 msec, dispersion 3.11 +precision 2**18, version 4 +org time D77C021C.E4F5FC74 (22:07:24.894 UTC Thu Jul 24 2014) +rec time D77C021D.0A706F23 (22:07:25.040 UTC Thu Jul 24 2014) +xmt time D77C021C.FC13B398 (22:07:24.984 UTC Thu Jul 24 2014) +filtdelay = 56.03 34.00 37.55 39.02 30.37 36.97 48.39 63.59 +filtoffset = -118.38 -102.96 -98.68 -99.64 -101.71 -125.02 -105.19 -102.24 +filterror = 0.01 0.95 1.94 2.89 3.88 4.84 5.80 6.74 +minpoll = 6, maxpoll = 10 + +If your client is not synchronizing with the server, you can use the debug ntp all com-mand, as shown in Example 19-4, which will debug NTP, events, core messages, clock adjustments, reference clocks, and packets. As seen on SW1, the debug output shows that an NTP message is sent to the NTP server at 192.168.1.3. If this message does not get a response, synchronization cannot occur. In this case, an NTP message has been received from the server at 192.168.1.3 and is being processed. + +Example 19-4 Using Debugs to Troubleshoot NTP Issues + +SW1#debug ntp all +NTP events debugging is on +NTP core messages debugging is on +NTP clock adjustments debugging is on +NTP reference clocks debugging is on +NTP packets debugging is on +SW1# +NTP message sent to 192.168.1.3, from interface 'Loopback0' (192.168.1.10). +NTP message received from 192.168.1.3 on interface 'Loopback0' (192.168.1.10). +NTP Core(DEBUG): ntp_receive: message received + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 821 + +NTP Core(DEBUG): ntp_receive: peer is 0x041657A8, next action is 1. +NTP Core(DEBUG): receive: packet given to process_packet + +In Example 19-5 the debug ntp all command is displaying that an NTP message is sent to the server at 192.168.1.3 and that the server has sent a response back. However, the NTP message is being dropped because of a crypto-NAK. This means that the authentication parameters do not match between the client and the server. You will need to compare the configurations between the server and the client and make sure the authentication com-mands match. + +Example 19-5 Using debug to Verify NTP Authentication Issues + +SW1#debug ntp all +NTP message sent to 192.168.1.3, from interface 'Loopback0' (192.168.1.10). +NTP message received from 192.168.1.3 on interface 'Loopback0' (192.168.1.10). +NTP Core(DEBUG): ntp_receive: message received +NTP Core(DEBUG): ntp_receive: peer is 0x041657A8, next action is 1. +NTP Core(NOTICE): ntp_receive: dropping message: crypto-NAK. + + +Syslog Troubleshooting + + + + + + + + + + + + + +Key Topic + +To verify your syslog configuration, confirm logging is enabled, and view the syslog messages stored in the buffer, you use the command show logging, as shown in Example 19-6. When troubleshooting, you need syslog to generate the right type of messages at the right time. By default, console, monitor, and buffer logging display messages with a severity level of debugging (7) and lower. Logging to a server is disabled by default, but once enabled, all severity levels will be sent to the server. Therefore, in all cases if you are not receiving the syslog messages you expect, verify that the correct level is configured. In this example, console and monitor are configured with a level of informational, buffer is configured with a level of debugging, and the trap logging (server) is configured with a +level of warnings. + +When logging to a server the correct server IP address needs to be specified and the serv-er needs to be reachable. In addition, because syslog uses UDP port 514, it is important to make sure that no ACLs are blocking traffic destined to UDP port 514. + +The buffer will have a default size of 8192 bytes. Once the buffer fills up, the older entries are overwritten. Therefore, if you are using the buffer and experiencing a loss of syslog messages, consider increasing the size of the buffer with the logging buffered size command or sending the messages to a syslog server instead. + +Finally, if you have remotely connected to a device via Telnet or SSH, and no syslog mes- +sages are appearing, it is because the terminal monitor command has not been issued. + + + + + + + + + +From the Library of Outcast Outcast +822 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 19-6 Verifying Syslog Configuration + +R4#show logging +Syslog logging: enabled (0 messages dropped, 0 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled) + +No Active Message Discriminator. + +Inactive Message Discriminator: +OSPF severity group drops 4 + +Console logging: level informational, 116 messages logged, xml disabled, +filtering disabled +Monitor logging: level informational, 0 messages logged, xml disabled, +filtering disabled +Buffer logging: level debugging, 175 messages logged, xml disabled, +filtering disabled +Exception Logging: size (8192 bytes) +Count and timestamp logging messages: disabled +Persistent logging: disabled + +No active filter modules. + +Trap logging: level warnings, 108 message lines logged +Logging to 10.1.100.100 (udp port 514, audit disabled, +link up), +2 message lines logged, +0 message lines rate-limited, +0 message lines dropped-by-MD, +xml disabled, sequence number disabled +filtering disabled +Logging Source-Interface: VRF Name: + +Log Buffer (8192 bytes): +Jul 24 21:54:50.422: %SYS-5-CONFIG_I: Configured from console by console +Jul 24 21:57:16.070: %OSPFv3-4-ERRRCV: OSPFv3-10-IPv6 Received invalid packet: Bad Checksum from FE80::C829:FFF:FE50:54, GigabitEthernet2/0 +Jul 24 21:58:20.014: NTP message received from 192.168.1.10 on interface 'GigabitEthernet2/0' (10.1.34.4). +Jul 24 21:58:20.018: NTP Core(DEBUG): ntp_receive: message received +Jul 24 21:58:20.022: NTP Core(DEBUG): ntp_receive: peer is 0x00000000, next action is 3. +Jul 24 21:58:20.030: NTP message sent to 192.168.1.10, from interface 'GigabitEthernet2/0' (10.1.34.4). +Jul 24 21:59:25.014: NTP message received from 192.168.1.10 on interface 'GigabitEthernet2/0' (10.1.34.4). +Jul 24 21:59:25.018: NTP Core(DEBUG): ntp_receive: message received +Jul 24 21:59:25.022: NTP Core(DEBUG): ntp_receive: peer is 0x00000000, next action + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 823 + +is 3. +Jul 24 21:59:25.026: NTP message sent to 192.168.1.10, from interface 'GigabitEther-net2/0' (10.1.34.4). + +Having log messages and debug messages stamped with a time is critical for trouble-shooting. If no time stamps are included with either, it is because the no service time-stamps command has been executed. To configure time stamps, use the service time-stamps [debug | log] [datetime | uptime] command. The datetime option will include the date and time the log or debug message occurred. Therefore, it is important to have an accurate calendar and time set. Use NTP for this. The uptime option provides a time stamp based on the amount of time that has passed since the last reboot. + +SNMP Troubleshooting + +Regardless of whether you are using SNMPv2c or SNMPv3, you need to be able to ping the server from the agent. If Layer 3 connectivity does not exist, the SNMP Network Management Server cannot access the information in the Management Information Base (MIB) on the agent. In addition, SNMP uses UDP port 161 for general messages and UDP port 162 for traps and informs. Therefore, if an ACL is denying these ports, SNMP com-munication will not occur between the NMS and the agent. + +Keep the following few things in mind as you troubleshoot SNMPv2c. Refer to Example 19-7 when reviewing the following list: + + +■ Key +Topic + + +■ + + + + + +■ + +Community strings must match: For the NMS to read from or write to the agent, the read community string or the read/write community string must match between the NMS and the agent. In Example 19-7, the read-only community string specified is CISCO. + +ACLs classifying servers must be correct: If you are using ACLs to define which NMS (based on IP address) is allowed to retrieve objects from the MIB, the ACL has to accurately define the server addresses. In Example 19-7, ACL 10 is only permit-ting the NMS server with the IP address 10.1.100.100 to read from the MIB using the read-only community string CISCO. + +Correct configuration for notifications: If your agent is configured to send traps or +informs, you should verify the following: + + +1. That traps are enabled. +2. The correct host (NMS) IP address is specified. 3. The correct SNMP version is specified. +4. The correct community string is specified. +5. You specified traps or informs (default is traps ). +6. If you did not want all traps to be sent, it is imperative you specified the cor-rect ones you want to send. In Example 19-7, the snmp-server host command indicates that SNMPv2c informs will be sent to the NMS at 10.1.100.100 with a community string of CISCO. + + + + +From the Library of Outcast Outcast +824 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Indexes keep shuffling: To prevent index shuffling and guarantee index persistence during reboots or minor software upgrades, use the snmp-server ifindex persist command, which shows up as snmp ifmib ifindex persist in the running configura-tion. + +Example 19-7 SNMPv2c Configuration Sample + +R4#show run | section snmp +snmp-server community CISCO RO 10 +snmp-server enable traps cpu threshold +snmp-server host 10.1.100.100 informs version 2c CISCO +snmp ifmib ifindex persist +R4#show ip access-lists +Standard IP access list 10 +10 permit 10.1.100.100 + +SNMPv3 offers major improvements over SNMPv2c when it comes to security. It offers improved authentication and encryption. Keep the following few things in mind as you troubleshoot SNMPv3. Refer to Example 19-8 when reviewing the following list: + + +■ +Key Topic + + + + + + +■ + + + + + +■ + + + + + + +■ + + + + +■ + +Nesting of users, views, and groups: With SNMPv3, you create users with authenti-cation and encryption parameters that are nested into groups that define the servers that are allowed to read from or write to the objects within the MIB on the agent. If you fail to nest the users, views, and groups, SNMPv3 will not function as expected. In Example 19-8, the user NMSERVER is nested into the group NMSREADONLY, which allows read-only access to the object identifiers (OIDs) listed in the view MIBACCESS to the NMS with the IP address 10.1.100.100. + +Wrong security level specified: SNMPv3 supports three security levels: noAuthNo-Priv, authNoPriv, and authPriv. The security level specified for the group, the users, and for the sending of traps has to match what is used on the server. In Example +19-8, authPriv is being used extensively (with the priv parameter in the commands), which means that authentication and encryption will be used. + +Wrong hashing algorithm, encryption algorithm, or passwords defined: When authenticating, the hashing algorithm has to match along with the password; oth-erwise, authentication will fail. When performing encryption, the encryption algo-rithm and password have to match; otherwise, the NMS will not be able to decrypt the data it receives. In Example 19-8, SHA is being used as the hashing algorithm, AES256 as the encryption algorithm, and MYPASSWORD is the password. + +Wrong OIDs specified in the view: The views identify the objects within the MIB that the NMS will be able to access. If the wrong objects are defined, SNMPv3 will not produce the desired results. In Example 19-8, the objects sysUpTime, ifAdmin-Status, and ifOperStatus are defined in the MIBACCESS view. + +Correct configuration for notifications: If your agent is configured to send traps or informs you should verify that traps are enabled, the correct host (NMS) IP address +is specified, the correct SNMP version is specified, the correct security level is + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 825 + +specified, and you specified traps or informs (default is traps). If you do not want all traps to be sent, it is imperative that you specify the correct ones. You also need to specify the correct SNMPv3 username for the authentication/encryption process. In Example 19-8, the snmp-server host command indicates that SNMPv3 will send traps related to the CPU to the NMS at 10.1.100.100, with the authentication and encryption provided by the username NMSERVER. + +■ Indexes keep shuffling: To prevent index shuffling and guarantee index persistence during reboots or minor software upgrades, use the snmp-server ifindex persist command, which shows up as snmp ifmib ifindex persist in the running configura-tion. + +Example 19-8 SNMPv3 Configuration Sample + +SW2#show run | section snmp +snmp-server group NMSREADONLY v3 priv read MIBACCESS access 99 +snmp-server view MIBACCESS sysUpTime included +snmp-server view MIBACCESS ifAdminStatus included +snmp-server view MIBACCESS ifOperStatus included +snmp-server user NMSERVER NMSREADONLY v3 auth sha MYPASSWORD priv aes 256 MYPASSWORD +snmp-server host 10.1.100.100 version 3 priv NMSERVER cpu +snmp ifmib ifindex persist +SW2#show ip access-lists +Standard IP access list 99 +10 permit 10.1.100.100 + +You can verify the configured snmp groups with the show snmp group command. In Example 19-9 the group is NMSREADONLY, the security model is v3 priv (authPriv), the associated read-only view is MIBACCESS, and only servers in access list 99 will be per-mitted to read the OIDs in the view.. + + +Example 19-9 Verifying SNMP Groups Key +Topic SW2#show snmp group +groupname: NMSREADONLY +contextname: +readview : MIBACCESS + + + + +security model:v3 priv +storage-type: nonvolatile +writeview: + +notifyview: *tv.00000000.00000000.10000000.0 +row status: active access-list: 99 + +You can verify the configured SNMP users with the show snmp user command. Example 19-10 shows a user named NMSERVER that is using the SHA authentication protocol and the AES256 privacy (encryption) protocol. The user is also associated with the group NMSREADONLY. + + + + + + + +From the Library of Outcast Outcast +826 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 19-10 Verifying SNMP Users Key +Topic SW2#show snmp user + +User name: NMSERVER +Engine ID: 800000090300001C57FEF601 +storage-type: nonvolatile active +Authentication Protocol: SHA +Privacy Protocol: AES256 +Group-name: NMSREADONLY + +To verify where traps or informs (notifications) are being sent, use the show snmp host command. In Example 19-11, the notifications are being sent to the NMS at 10.1.100.100 using UDP port 162. The specific notifications are traps, and the username that will be used for authentication and encryption is NMSERVER using the security model v3 priv. + +Example 19-11 Verifying SNMP Hosts +Key +Topic SW2#show snmp host +Notification host: 10.1.100.100 udp-port: 162 type: trap +user: NMSERVER security model: v3 priv + +You can use the show snmp view command to view the OIDs that are included in each of the views. In Example 19-12, the MIBACCESS view has the OIDs sysUpTime, ifAdmin-Status, and ifOperStatus included. + +Example 19-12 Verifying SNMP Views Key +Topic SW2#show snmp view +...output omitted... +cac_view lifEntry.20 - included read-only active +cac_view cciDescriptionEntry.1 - included read-only active +MIBACCESS sysUpTime - included nonvolatile active +MIBACCESS ifAdminStatus - included nonvolatile active +MIBACCESS ifOperStatus - included nonvolatile active +v1default iso - included permanent active +v1default internet - included permanent active +...output omitted... + + +Management Tools Troubleshooting + +The performance of your network is critical. Being able to accurately measure the perfor-mance and have statistics that can be used to identify potential issues is the key to having a healthy network. One of the options that Cisco IOS IP SLA offers is the ability to mon-itor network performance. You can also use it to test reachability, and when it is attached to a tracking object, it can help maintain network availability. Being able to troubleshoot issues related to IP SLA and object tracking is essential. + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 827 + +Another set of tools at your disposal is SPAN and RSPAN. These tools enable you to capture frames as they traverse a switch and send copies to packet-capturing devices for analysis. These tools are valuable, and being able to troubleshoot issues related to them is important because you will likely be using them to troubleshoot other issues. + +This section explains how to troubleshoot issues related to IP SLA, object tracking, SPAN, and RSPAN. + +Cisco IOS IPSLA Troubleshooting + +Cisco IOS IP SLA enables you to measure network performance and test network avail-ability by generating a continuous, reliable probe (simulated traffic) in a predictable manner. The data you can collect varies greatly depending on how you set up the probe. You can collect information about packet loss, one-way latency, response times, jitter, network resource availability, application performance, server response times, and even voice quality. + +IP SLA consists of an IP SLA source (sends the probes) and IP SLA responder (replies to the probes). However, both are not needed in all cases. Only the IP SLA source is required all the time. The IP SLA responder is needed only when gathering highly accu-rate statistics for services that are not offered by any specific destination device. The +responder has the ability to respond back to the source with accurate measurements tak-ing into account its own processing time of the probe. Figure 19-1 shows a scenario with just the IP SLA source sending a ping to test connectivity. Figure 19-2 shows a scenario with an IP SLA source and IP SLA responder that is measuring jitter (interpacket delay variance). + +ICMP Echo Request File Server IP SLA Source + +R1 + +ICMP Echo Reply + +Figure 19-1 IP SLA Source Topology + + + + +IP SLA Source + +R1 + +UDP Jitter Probe + +IP SLA Responder + +R2 + + + +Probe Response + +Figure 19-2 IP SLA Source and Responder Topology + +Example 19-13 shows a sample configuration based on Figure 19-1. In this example, R1 is configured as an IP SLA source. The probe it is sending is an Internet Control + + + +From the Library of Outcast Outcast +828 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Message Protocol (ICMP) echo (ping) to 10.1.100.100 using the local source address of 192.168.1.11. This probe is being sent every 15 seconds and it will never expire. + +Example 19-13 IP SLA ICMP-ECHO Probe Configuration Sample + +R1#show run | section sla +ip sla 2 +icmp-echo 10.1.100.100 source-ip 192.168.1.11 +frequency 15 +ip sla schedule 2 life forever start-time now + +Example 19-14 shows a sample configuration based on Figure 19-2. In this example, R1 is configured as an IP SLA source. The probe it is sending is testing UDP jitter from the source address 192.168.1.11 to 10.1.34.4 using port 65051. It will send 20 probe packets for each test with a size of 160 bytes each and repeat this every 30 seconds. The probe is started and will never expire. To get measurements related to jitter, you need to have a device that can process the probes and respond accordingly. Therefore, the destination device needs to be able to support Cisco IOS IP SLA and be configured as a responder. R2 is configured as the IP SLA responder. + +Example 19-14 IP SLA UDP-JITTER Probe Configuration Sample + +R1#show run | section sla +ip sla 1 +udp-jitter 10.1.34.4 65051 source-ip 192.168.1.11 num-packets 20 +request-data-size 160 +frequency 30 +ip sla schedule 1 life forever start-time now + +R2#show run | section sla +ip sla responder + +When troubleshooting Cisco IOS IP SLA, consider the following: + + +■ +Key Topic + +■ + +■ + + +■ + +■ + +■ + +The correct operation needs to be chosen based on the metrics you intend to mea-sure. + +The destination IP address needs to be reachable and correctly defined. + +The source IP address needs to be reachable from the destination and correctly defined. + +Any necessary port numbers need to be correctly identified. + +The SLA instance needs to be started for it to work. + +If the operation needs an IP SLA responder, one has to be configured and reachable. + + +To verify which operations are supported on the platform in addition to how many opera-tions are configured and how many are currently active, use the show ip sla application command, as shown in Example 19-15. + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 829 + +Example 19-15 Output of show ip sla application + +R1#show ip sla application +IP Service Level Agreements +Version: Round Trip Time MIB 2.2.0, Infrastructure Engine-III + +Supported Operation Types: +icmpEcho, path-echo, path-jitter, udpEcho, tcpConnect, http +dns, udpJitter, dhcp, ftp, lsp Group, lspPing, lspTrace +802.1agEcho VLAN, EVC, Port, 802.1agJitter VLAN, EVC, Port +pseudowirePing, udpApp, wspApp + +Supported Features: +IPSLAs Event Publisher + +IP SLAs low memory water mark: 30919230 +Estimated system max number of entries: 22645 + +Estimated number of configurable operations: 22643 +Number of Entries configured : 2 +Number of active Entries : 2 +Number of pending Entries : 0 +Number of inactive Entries : 0 +Time of last change in whole IP SLAs: 09:29:04.789 UTC Sat Jul 26 2014 + +To verify the configuration values for each IP SLA instance as well as the default val-ues that you did not modify, use the show ip sla configuration command, as shown in Example 19-16. In this example, there are two entries (instances): number 1 and number +2. You can verify for each entry the type of operation that is being performed, the opera-tion timeout, the source and destination address, the source and destination port, type of service values, packet size, packet interval (if operation supports it), and the schedule that has been configured for the operation. In this case, both entry 1 and 2 are started, and they will never expire. + +Example 19-16 Output of show ip sla configuration + +R1#show ip sla configuration +IP SLAs Infrastructure Engine-III +Entry number: 1 +Owner: +Tag: +Operation timeout (milliseconds): 5000 +Type of operation to perform: udp-jitter +Target address/Source address: 10.1.34.4/192.168.1.11 +Target port/Source port: 65051/0 +Type Of Service parameter: 0x0 +Request size (ARR data portion): 160 + + + + +From the Library of Outcast Outcast +830 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Packet Interval (milliseconds)/Number of packets: 20/20 +Verify data: No +Vrf Name: +Control Packets: enabled +Schedule: +Operation frequency (seconds): 30 (not considered if randomly scheduled) +Next Scheduled Start Time: Start Time already passed +Group Scheduled : FALSE +Randomly Scheduled : FALSE +Life (seconds): Forever +Entry Ageout (seconds): never +Recurring (Starting Everyday): FALSE +Status of entry (SNMP RowStatus): Active +Threshold (milliseconds): 5000 +Distribution Statistics: +Number of statistic hours kept: 2 +Number of statistic distribution buckets kept: 1 +Statistic distribution interval (milliseconds): 20 +Enhanced History: + +Entry number: 2 +Owner: +Tag: +Operation timeout (milliseconds): 5000 +Type of operation to perform: icmp-echo +Target address/Source address: 10.1.100.100/192.168.1.11 +Type Of Service parameter: 0x0 +Request size (ARR data portion): 28 +Verify data: No +Vrf Name: +Schedule: +Operation frequency (seconds): 15 (not considered if randomly scheduled) +Next Scheduled Start Time: Start Time already passed +Group Scheduled : FALSE +Randomly Scheduled : FALSE +Life (seconds): Forever +Entry Ageout (seconds): never +Recurring (Starting Everyday): FALSE +Status of entry (SNMP RowStatus): Active +Threshold (milliseconds): 5000 +Distribution Statistics: +Number of statistic hours kept: 2 +Number of statistic distribution buckets kept: 1 +Statistic distribution interval (milliseconds): 20 +Enhanced History: +History Statistics: + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 831 + +Number of history Lives kept: 0 +Number of history Buckets kept: 15 +History Filter Type: None + +To display the results of the IP SLA operations and the statistics collected, use the show ip sla statistics command, as shown in Example 19-17. In the output, you can verify +the type of operation, when it last started, the latest return code, the values returned (depending on the operation), and the number of successes and failures. + +Example 19-17 Output of show ip sla statistics +Key +Topic R1#show ip sla statistics +IPSLAs Latest Operation Statistics + +IPSLA operation id: 1 +Type of operation: udp-jitter +Latest RTT: 53 milliseconds +Latest operation start time: 09:52:23 UTC Sat Jul 26 2014 +Latest operation return code: OK +RTT Values: +Number Of RTT: 17 RTT Min/Avg/Max: 46/53/66 milliseconds +Latency one-way time: +Number of Latency one-way Samples: 0 +Source to Destination Latency one way Min/Avg/Max: 0/0/0 milliseconds +Destination to Source Latency one way Min/Avg/Max: 0/0/0 milliseconds +Jitter Time: +Number of SD Jitter Samples: 14 +Number of DS Jitter Samples: 14 +Source to Destination Jitter Min/Avg/Max: 1/7/13 milliseconds +Destination to Source Jitter Min/Avg/Max: 1/6/13 milliseconds +Packet Loss Values: +Loss Source to Destination: 0 +Source to Destination Loss Periods Number: 0 +Source to Destination Loss Period Length Min/Max: 0/0 +Source to Destination Inter Loss Period Length Min/Max: 0/0 +Loss Destination to Source: 3 +Destination to Source Loss Periods Number: 2 +Destination to Source Loss Period Length Min/Max: 1/2 +Destination to Source Inter Loss Period Length Min/Max: 1/9 + +Out Of Sequence: 0 +Packet Late Arrival: 0 +Voice Score Values: + +Tail Drop: 0 +Packet Skipped: 0 + +Calculated Planning Impairment Factor (ICPIF): 0 +Mean Opinion Score (MOS): 0 +Number of successes: 61 +Number of failures: 0 + + + + +From the Library of Outcast Outcast +832 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Operation time to live: Forever + + + +IPSLA operation id: 2 +Latest RTT: 1 milliseconds +Latest operation start time: 09:52:49 UTC Sat Jul 26 2014 +Latest operation return code: OK +Number of successes: 95 +Number of failures: 1 +Operation time to live: Forever + +To verify the operation of the IP SLA responder, use the command show ip sla respond-er, as shown in Example 19-18, on the Cisco IOS device acting as the responder. You can verify the general control port number, the total number of probes received, the number of errors, and the recent sources of IP SLA probes. + +Example 19-18 Output of show ip sla responder +Key +Topic R2#show ip sla responder +General IP SLA Responder on Control port 1967 +General IP SLA Responder is: Enabled +Number of control message received: 2333 Number of errors: 0 +Recent sources: +192.168.1.11 [09:53:52.001 UTC Sat Jul 26 2014] +192.168.1.11 [09:53:22.033 UTC Sat Jul 26 2014] +192.168.1.11 [09:52:52.029 UTC Sat Jul 26 2014] +192.168.1.11 [09:52:22.049 UTC Sat Jul 26 2014] +192.168.1.11 [09:51:52.029 UTC Sat Jul 26 2014] +Recent error sources: + +Permanent Port IP SLA Responder +Permanent Port IP SLA Responder is: Disabled + +udpEcho Responder: +IP Address Port + +Example 19-19 shows real-time output of an SLA operation with the debug ip sla trace 2 command. The debug is displaying a successful trace of the IP SLA instance 2. The opera-tion is waking up, starting, sending the probe, receiving a response, and then the statistics are updated accordingly. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 833 + +Example 19-19 Debug Displaying a Successful IP SLA Operation + +R1#debug ip sla trace 2 +IPSLA-INFRA_TRACE:OPER:2 slaSchedulerEventWakeup + +IPSLA-INFRA_TRACE:OPER:2 Starting an operation + +IPSLA-OPER_TRACE:OPER:2 source IP:192.168.1.11 + +IPSLA-OPER_TRACE:OPER:2 Starting icmpecho operation - destAddr=10.1.100.100, sAddr=192.168.1.11 + +IPSLA-OPER_TRACE:OPER:2 Sending ID: 113 + +IPSLA-OPER_TRACE:OPER:2 ID:113, RTT=1 + +IPSLA-INFRA_TRACE:OPER:2 Updating result + +Example 19-20 shows real-time output of an SLA operation with the debug ip sla trace 2 command. The debug is displaying an unsuccessful trace of the IP SLA instance 2. You can see that the operation timed out between the source IP 192.168.1.11 and the destina-tion IP 10.1.100.100. The results are then updated accordingly in the SLA statistics. This confirms that the IP SLA operation was not successful. + +Example 19-20 Debug Displaying an Unsuccessful IP SLA Operation + +R1#debug ip sla trace 2 +IPSLA-INFRA_TRACE:OPER:2 slaSchedulerEventWakeup + +IPSLA-INFRA_TRACE:OPER:2 Starting an operation + +IPSLA-OPER_TRACE:OPER:2 source IP:192.168.1.11 + +IPSLA-OPER_TRACE:OPER:2 Starting icmpecho operation - destAddr=10.1.100.100, sAddr=192.168.1.11 + +IPSLA-OPER_TRACE:OPER:2 Sending ID: 205 + +IPSLA-OPER_TRACE:OPER:2 Timeout - destAddr=10.1.100.100, sAddr=192.168.1.11 + +IPSLA-INFRA_TRACE:OPER:2 Updating result + + +Object Tracking Troubleshooting + +Object tracking enables you to dynamically control what will occur if the result of the tracking object is up or down. For example, you can attach an object to a static route; if the object is up, the route is installed in the routing table. If the object is down, the route + + + + +From the Library of Outcast Outcast +834 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +will not be installed in the routing table. With first-hop redundancy protocols (FHRPs), you can decrement or increment the priority based on the status of the object. For exam-ple, if the status of the tracking object is down, the FHRP priority is decremented. + +With object tracking, you can track IP routes, IP SLA instances, interfaces, and groups of objects. For example, you can track an IP SLA instance that is using ICMP echoes. If the echo fails, the IP SLA instances fails, which brings the tracking object down. If the track-ing object is tied to an FHRP, the priority is decremented, if the tracking object is tied to a static route, the static route is removed from the routing table. + +To verify the configuration of a tracking object and the status of the tracking object, use the show track command. In Example 19-21 tracking object 1 exists on SW1. It is tracking the reachability of an IP route, 10.1.43.0/24. If the route is in the routing table, the object is up. If the route is not in the routing table, the object is down. The object is attached to (Tracked by:) HSRP Group 10. + +Example 19-21 Verifying the Configuration and Status of a Tracking Object (Up) + +SW1#show track +Track 1 +IP route 10.1.43.0 255.255.255.0 reachability +Reachability is Up (EIGRP) +1 change, last change 00:01:55 +First-hop interface is GigabitEthernet1/0/10 +Tracked by: +HSRP Vlan10 10 + +In Example 19-22, the tracking object is down because the route to 10.1.43.0/24 is no longer in the routing table. Because it is attached to HSRP Group 10, an action based on the configuration of HSRP Group 10 would occur, such as decrementing the local HSRP priority. + +Example 19-22 Verifying the Configuration and Status of a Tracking Object (Down) + +SW1# +%TRACKING-5-STATE: 1 ip route 10.1.43.0/24 reachability Up->Down +SW1#show track +Track 1 +IP route 10.1.43.0 255.255.255.0 reachability +Reachability is Down (no route ) +2 changes, last change 00:00:04 +First-hop interface is unknown +Tracked by: +HSRP Vlan10 10 + + + + + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 835 + +SPAN and RSPAN Troubleshooting + +SPAN and RSPAN enable you to take ingress/egress frames on a switchport, copy them, and send them to another port that has a management station running packet-capturing software attached. + +With SPAN, you copy traffic from a source port on one switch to a destination port on the same switch, as shown in Figure 19-3. With RSPAN, you copy traffic from a source port on one switch to the destination port on a different switch, as shown in Figure 19-4. + +Fa0/1 + +SW1 Fa0/24 +Send copy of all Fa0/1 ingress frames to sniffer + +Sniffer + + +Figure 19-3 SPAN Topology + + + + + + +PC1 Fa0/1 +SW1 + +RSPAN VLAN 100 +802.1q Trunk Sniffer SW2 Fa0/24 + + +Send copy of all Fa0/1 ingress frames to sniffer + +Figure 19-4 RSPAN Topology + +Example 19-23 displays the configuration needed to successfully configure SPAN on SW1 in Figure 19-3. Troubleshooting issues will be minor for SPAN. Consider the follow-ing while troubleshooting SPAN issues: + + +■ Key +Topic +■ + + +■ + + +■ + +The source and destination session numbers must match to be part of the same SPAN session. + +The source interface/VLAN and destination interfaces have to be correctly identi-fied. + +The direction of captured packets has to be correctly defined. (Default is both ingress and egress.) + +The interfaces have to be up/up. + + + + + + + + +From the Library of Outcast Outcast +836 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 19-23 Sample SPAN Configuration + +SW1#show run | section monitor +monitor session 1 source interface Fa0/1 rx +monitor session 1 destination interface Fa0/24 + +Example 19-24 displays the configuration needed to successfully configure RSPAN on SW1 and SW2 in Figure 19-4. Troubleshooting issues are more difficult for RSPAN. Consider the following while troubleshooting RSPAN issues: + + +■ +Key Topic + + +■ + + +■ + + +■ + +■ + +■ + +■ + +The source and destination session numbers must match locally to be part of the same RSPAN session. However, they do not have to match with the session numbers used on the remote switch. + +The source interface/VLAN and destination interface/vlan have to be correctly iden-tified. + +The direction of captured packets has to be correctly defined. (Default is both ingress and egress.) + +The interfaces have to be up/up. + +The RSPAN VLAN must be configured and identified as an RSPAN VLAN. + +The RSPAN VLAN must be allowed across the trunk link (not pruned). + +STP cannot be blocking the RSPAN VLAN. + + +Example 19-24 Sample RSPAN Configuration + +SW1#show run | section monitor +vlan 100 +name REMOTESPAN +remote-span +monitor session 1 source interface fa0/1 rx +monitor session 1 destination remote vlan 100 + +SW2#show run | section monitor +vlan 100 +name REMOTESPAN +remote-span +monitor session 1 source remote vlan 100 +monitor session 1 destination interface fa0/24 + +To verify the SPAN or RSPAN sessions, use the command show monitor, as shown in Example 19-25. In this example, SW1 has an RSPAN session with an ID of 1 capturing frames ingress only on Fa0/1 and copying them to the RSPAN VLAN 100. SW2 has an RSPAN session with an ID of 1 capturing frames on the RSPAN VLAN 100 and sending them out Fa0/24. Using the show monitor detail command will display all the configured and nonconfigured parameters. + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 837 + +Example 19-25 Verifying SPAN and RSPAN Sessions with show monitor Command + + +SW1#show monitor +Session 1 +--------- +Type +Source Ports +RX Only +Dest RSPAN VLAN + +SW2#show monitor +Session 1 +--------- +Type +Source RSPAN VLAN +Destination Ports +Encapsulation +Ingress + + + + +: Remote Source Session +: +: Fa0/1 +: 100 + + + + +: Remote Destination Session +: 100 +: Fa0/24 +: Native +: Disabled + + +To verify RSPAN VLANs, use the command show vlan remote-span, as shown in Example 19-26. In this case, the remote span VLAN is 100. + +Example 19-26 Verifying RSPAN VLANs + +SW1#show vlan remote-span + +Remote SPAN VLANs +------------------------------------------------------------------------------ +100 + +To verify whether an interface is configured as a destination SPAN port, use the com-mand show interfaces status, as shown in Example 19-27. In this output, you can see that interface Fa0/24 on SW2 is in the monitoring status; therefore, it is no longer a normal switchport, and only monitored traffic will pass through it. + +Example 19-27 Verifying Destination SPAN/RSPAN Ports + +SW2#show interfaces status | i Port|Fa0/24 + +Port Name +Fa0/24 + +Status Vlan +monitoring 1 + +Duplex Speed Type +a-full a-100 10/100BaseTX + + + +Management Protocols and Tools Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 19-5. + + + + +From the Library of Outcast Outcast +838 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +10.1.1.0/24 +.1 .1 .2 .2 + +10.1.3.0/24 +.3 .3 + +R1 10.1.12.0/24 R2 10.1.23.0/24 R3 +NTP Server 192.168.1.3 + +Figure 19-5 Management Protocols and Services Trouble Tickets Topology + + +Trouble Ticket 19-1 + +Problem: Router R1 is not synchronizing its local time with the NTP server (R3) at 192.168.1.3. + +You begin troubleshooting by verifying the problem with the show ntp status command. Example 19-28 confirms that the clock is not synchronized. The stratum is also 16, which means unreachable. + +Example 19-28 Verifying NTP Status on R1 + +R1#show ntp status +Clock is unsynchronized, stratum 16, reference is 65.85.84.72 +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18 +ntp uptime is 82600 (1/100 of seconds), resolution is 4000 +reference time is D7811765.F28B7F98 (18:39:33.947 UTC Mon Jul 28 2014) +clock offset is 0.0000 msec, root delay is 0.00 msec +root dispersion is 2.44 msec, peer dispersion is 15937.50 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is -0.000000007 s/s +system poll interval is 64, last update was 678 sec ago. + +Next you check whether the NTP server is reachable. You use the command ping 192.168.1.3, as shown in Example 19-29. In this example, the ping is successful. + +Example 19-29 Testing Connectivity to NTP Server with Ping + +R1#ping 192.168.1.3 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.168.1.3, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 36/52/64 ms + +You access R3 and issue the show ntp status command to determine whether NTP is run-ning. It is running, as shown in the output of Example 19-30. R3 is synchronized and has a stratum level of 1. It is referencing itself. + +Example 19-30 Verifying That NTP Is Operational on R3 + +R3#show ntp status +Clock is synchronized, stratum 1, reference is .LOCL. +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**16 + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 839 + +ntp uptime is 1209300 (1/100 of seconds), resolution is 4000 +reference time is D7811D8F.7696A1E4 (19:05:51.463 UTC Mon Jul 28 2014) +clock offset is 0.0000 msec, root delay is 0.00 msec +root dispersion is 0.42 msec, peer dispersion is 0.24 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000000000 s/s +system poll interval is 16, last update was 12 sec ago. + +You decide to check whether an ACL is blocking NTP port 123. Back on R1, you use an extended traceroute, as shown in Example 19-31. You source the trace from 10.1.12.1 and specify a destination of 192.168.1.3. You also include the port number 123 for NTP. The result of the trace shows that at the hop 10.1.23.3 the trace is being administratively pro-hibited. In other words, it is being blocked by an ACL. + +Example 19-31 Using a Trace to Determine Where Packets Fail + +R1#traceroute +Protocol [ip]: ip +Target IP address: 192.168.1.3 +Source address: 10.1.12.1 +Numeric display [n]: +Timeout in seconds [3]: +Probe count [3]: +Minimum Time to Live [1]: +Maximum Time to Live [30]: +Port Number [33434]: 123 +Loose, Strict, Record, Timestamp, Verbose[none]: +Type escape sequence to abort. +Tracing the route to 192.168.1.3 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.12.2 48 msec * 40 msec +2 10.1.23.3 !A !A !A + +The IP address 10.1.23.3 belongs to R3 according to Figure 19-5. Therefore, you access R3 and issue the show ip interface brief command and note that interface Gig1/0 is using that IP address, as shown in Example 19-32. + +Example 19-32 Verifying IP Address Assignment + +R3#show ip interface brief +Interface IP-Address OK? Method Status Protocol + +GigabitEthernet0/0 +GigabitEthernet1/0 +Loopback0 + +10.1.3.3 +10.1.23.3 +192.168.1.3 + +YES NVRAM up up +YES NVRAM up up +YES NVRAM up up + + +You issue the command show ip interface gigabitethernet1/0 and notice that ACL 100 is applied inbound on Gig1/0, as shown in Example 19-33. + + + + + +From the Library of Outcast Outcast +840 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 19-33 Verifying ACLs on Gig1/0 + +R3#show ip interface gigabitEthernet 1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet address is 10.1.23.3/24 +...output omitted... +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is 100 +Proxy ARP is enabled +Local Proxy ARP is disabled +...output omitted... + +Examining the output of show access-list 100 in Example 19-34 shows that ACL 100 is blocking NTP packets and permitting all other packets. + +Example 19-34 Verifying ACL 100 Configuration + +R3#show access-lists 100 +Extended IP access list 100 +10 deny udp any any eq ntp (23 matches) +20 permit ip any any (819 matches) + +Because ACL 100 is only blocking NTP packets while permitting all other packets, and you need NTP packets to be permitted, you decide to remove the ACL from the interface with the no ip access-group 100 in command in interface configuration mode on R3, as shown in 19-35. + +Example 19-35 Removing ACL from Interface and Verifying That It Is Removed + +R3#config t +Enter configuration commands, one per line. End with CNTL/Z. +R3(config)#int gig 1/0 +R3(config-if)#no ip access-group 100 in +R3(config-if)#end +R3#show ip interface gig1/0 +GigabitEthernet1/0 is up, line protocol is up +Internet address is 10.1.23.3/24 +...output omitted... +Multicast reserved groups joined: 224.0.0.10 +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +...output omitted... + +Now you go back to R1 and issue the traceroute command again, as shown in Example 19-36. In this case, it is successful. + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 841 + +Example 19-36 Using a Trace to Determine Whether Packets Still Fail + +R1#traceroute +Protocol [ip]: ip +Target IP address: 192.168.1.3 +Source address: 10.1.12.1 +Numeric display [n]: +Timeout in seconds [3]: +Probe count [3]: +Minimum Time to Live [1]: +Maximum Time to Live [30]: +Port Number [33434]: 123 +Loose, Strict, Record, Timestamp, Verbose[none]: +Type escape sequence to abort. +Tracing the route to 192.168.1.3 +VRF info: (vrf in name/id, vrf out name/id) +1 10.1.12.2 48 msec * 40 msec +2 10.1.23.3 48 msec * 40 msec + +You issue the show ntp status command again, as shown in Example 19-37, and notice that the problem is not solved. R1 is still not synchronized. + +Example 19-37 Verifying NTP Status on R1 After an ACL Is Removed + +R1#show ntp status +Clock is unsynchronized, stratum 16, reference is 65.85.84.72 +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18 +ntp uptime is 379600 (1/100 of seconds), resolution is 4000 +reference time is D7811765.F28B7F98 (18:39:33.947 UTC Mon Jul 28 2014) +clock offset is 0.0000 msec, root delay is 0.00 msec +root dispersion is 46.99 msec, peer dispersion is 15937.50 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is -0.000000007 s/s +system poll interval is 64, last update was 3648 sec ago. + +You now decide to check the NTP configuration on R1 and R3, as shown in Example 19-38. The first thing you notice is that R1 is configured with the ntp server command +and that it is pointing to the correct address but the authentication key is incorrect when compared to the ntp trusted key command or the authentication key that is being used by R3. Therefore, the key should be 13 in this case, not 12. To fix this issue, you use +the command no ntp server 192.168.1.3 key 12 and issue the command ntp server 192.168.1.3 key 13, as shown in Example 19-39. + +Example 19-38 Verifying NTP Configuration + +R1#show run | section ntp +ntp authentication-key 13 md5 030752180500 7 +ntp authenticate +ntp trusted-key 13 + + + + +From the Library of Outcast Outcast +842 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +ntp server 192.168.1.3 key 12 + +R3#show run | section ntp +ntp authentication-key 13 md5 00071A150754 7 +ntp authenticate +ntp trusted-key 13 +ntp source Loopback0 +ntp access-group serve-only 10 +ntp master 1 + + +Example 19-39 Adjusting NTP Configuration + +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#no ntp server 192.168.1.3 key 12 +R1(config)#ntp server 192.168.1.3 key 13 +R1(config)#end + +To verify that the problem is solved you issue the command show ntp status. As shown in Example 19-40, the problem is still not solved. R1 is still not synchronized. + +Example 19-40 Verifying That the Problem Is Solved + +R1#show ntp status +Clock is unsynchronized, stratum 16, reference is 73.78.73.84 +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18 +ntp uptime is 447000 (1/100 of seconds), resolution is 4000 +reference time is D7811765.F28B7F98 (18:39:33.947 UTC Mon Jul 28 2014) +clock offset is 0.0000 msec, root delay is 0.00 msec +root dispersion is 2.62 msec, peer dispersion is 15937.50 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is -0.000000007 s/s +system poll interval is 64, last update was 4322 sec ago. + +You decide to enable debugging with the debug ntp all command on R1. The debug out-put shows that NTP packets are being sent but not received in Example 19-41. You issue the same command on R3, as shown in Example 19-42. In this case, R3 is receiving them but not responding. It states, dropping message: RES_DONTSERVE restriction. This indicates that there is an NTP access group on R3. + +Example 19-41 Debugging NTP Packets on R1 + +R1#debug ntp all +NTP events debugging is on +NTP core messages debugging is on +NTP clock adjustments debugging is on +NTP reference clocks debugging is on +NTP packets debugging is on +R1# + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 843 + +.Jul 28 20:12:34.960: NTP message sent to 192.168.1.3, from interface 'GigabitEthernet1/0' (10.1.12.1). + +Example 19-42 Debugging NTP Packets on R3 + +R3#debug ntp all +NTP message received from 10.1.12.1 on interface 'Loopback0' (192.168.1.3). +NTP Core(DEBUG): ntp_receive: message received +NTP Core(NOTICE): ntp_receive: dropping message: RES_DONTSERVE restriction. + +Reviewing the NTP configuration on R1 and R3 again, as shown in Example 19-43, you notice that there is an NTP access group configured that will only respond to NTP pack-ets sourced from IP addresses listed in ACL 10. You issue the command show access-list 10 and note that only NTP packets sourced with an IP from 192.168.1.0 to 192.168.1.255 are permitted. Reviewing the configuration on R1 indicates that packets will be sourced with the IP address of the interface the packets will be sent from. Therefore, you need to include the ntp source command on R1 to control the source IP address of the packets. + +Example 19-43 Reviewing NTP Configuration + +R1#show run | section ntp +ntp authentication-key 13 md5 030752180500 7 +ntp authenticate +ntp trusted-key 13 +ntp server 192.168.1.3 key 13 + +R3#show run | section ntp +ntp authentication-key 13 md5 00071A150754 7 +ntp authenticate +ntp trusted-key 13 +ntp source Loopback0 +ntp access-group serve-only 10 +ntp master 1 + +R3#show access-lists 10 +Standard IP access list 10 +10 permit 192.168.1.0, wildcard bits 0.0.0.255 (289 matches) + +On R1, you issue the show ip interface brief command, as shown in Example 19-44, and notice that interface Loopback 0 is using the IP address 192.168.1.1. Therefore, on R1, you issue the command ntp source loopback0, as also seen in Example 19-44. + +Example 19-44 Adding the NTP Source Command to R1 + +R1#show ip interface brief +Interface IP-Address OK? Method Status Protocol +FastEthernet0/0 unassigned YES NVRAM administratively down down +GigabitEthernet0/0 10.1.1.0 YES NVRAM up up + + + + +From the Library of Outcast Outcast +844 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +GigabitEthernet1/0 10.1.12.1 YES NVRAM up up +Loopback0 192.168.1.1 YES manual up up +R1#config t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#ntp source loopback 0 + +Now you issue the command show ntp status, as shown in Example 19-45, on R1, and the clock is synchronized with the NTP server at 192.168.1.3. Using the command show ntp association detail, you confirm that authentication was successful as well. (Note that the clocks can take some time to synchronize; it is not immediate.) + +Example 19-45 Verifying the Issue Is Solved + +R1#show ntp status +Clock is synchronized, stratum 2, reference is 192.168.1.3 +nominal freq is 250.0000 Hz, actual freq is 249.9966 Hz, precision is 2**18 +ntp uptime is 549900 (1/100 of seconds), resolution is 4016 +reference time is D7812C43.F6589518 (20:08:35.962 UTC Mon Jul 28 2014) +clock offset is 74.6174 msec, root delay is 19.98 msec +root dispersion is 111.38 msec, peer dispersion is 1.49 msec +loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000013584 s/s +system poll interval is 64, last update was 9 sec ago. + +R1#show ntp associations detail +192.168.1.3 configured, ipv4, authenticated, our_master, sane, valid, stratum 1 +ref ID .LOCL., time D7812C3F.7685D321 (20:08:31.462 UTC Mon Jul 28 2014) +our mode client, peer mode server, our poll intvl 64, peer poll intvl 64 +...output omitted... + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 845 + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 19-2 lists a reference of these key topics and the page numbers on which each is found. + +Key Table 19-2 Key Topics for Chapter 19 +Topic Key Topic Element Description Page Number + + +List + +Example 19-1 + +Example 19-3 + +Paragraph + +List + +List + +Example 19-9 + +Example 19-10 + +Example 19-11 + +Example 19-12 + +List + +Example 19-17 + +Paragraph + +List + +List + +Outlines the reasons why an NTP client does not 818 synchronize with an NTP server +Verifying the status of NTP on a client 819 + +Verifying details of the NTP time servers associated 820 with the client +Discusses what to keep in mind when 821 troubleshooting issues related to syslog +Outlines the reasons why SNMPv2c may not be 823 operating as expected +Outlines the reasons why SNMPv3 may not be 824 operating as expected +Verifying SNMP groups 825 + +Verifying SNMP users 826 + +Verifying SNMP hosts 826 + +Verifying SNMP views 826 + +Outlines the issues that should be considered while 828 troubleshooting Cisco IOS IP SLA +Output of show ip sla statistics 831 + +Describes how to verify the statistics on a Cisco IOS 832 IP SLA responder +Examines the issues that you might experience with 835 SPAN +Examines the issues that you might experience with 836 RSPAN + + + + + +From the Library of Outcast Outcast +846 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +NTP, NTP server, NTP client, stratum, syslog, SNMPv2c, SNMPv3, community string, traps, informs, NMS, noAuthNoPriv, authNoPriv, authPriv, OID, SNMP view, IP SLA, IP SLA source, IP SLA responder, object tracking, SPAN, RSPAN, sniffer + +Command Reference to Check Your Memory + +This section includes the most important show and debug commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 19-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot the topics and concepts covered in this chapter. + +Table 19-3 show and debug Commands + +Task Command Syntax + +Displays the NTP configuration within the running configuration. +Displays the status of NTP on a device (including whether the device is synchronized), the stratum level, and +the IP address of the NTP server (device synchronized with). +Displays a summary of all the NTP devices the local device is associated with, including which one the local device is currently synchronized with. +Displays detailed information of all the NTP devices the local device is associated with, including who the local device is currently synchronized with, the stratum levels, and whether authentication was successful. +Displays real-time information about NTP packets sent and received as well as event changes. + + +show run | section ntp + +show ntp status + + + + +show ntp associations + + + +show ntp associations detail + + + + +debug ntp all + + + + + + + +From the Library of Outcast Outcast +Chapter 19: Troubleshooting Management Protocols and Tools 847 + + +Task Command Syntax +Displays the status of syslog on a device, show logging such as whether it is enabled or disabled, the +severity level for each logging option, and the server syslog messages will be sent to. +Displays the SNMP configuration in the show run | section snmp running configuration. +Displays the SNMP groups configured on show snmp group the local device, including the security model +associated with the group, the read-only and read-write views associated with the groups, in addition to any access lists associated with the group. + +Displays the local views and OIDs associated with each view. +Displays the SNMP users configured locally, including their authentication protocol, privacy protocol, and the group they are a member of. +Displays the parameters necessary to send SNMP traps and informs to an SNMP NMS. It includes the server IP, port number, +whether traps or informs are sent, in addition to the user information for authentication and security purposes. +Displays the IP SLA configuration in the running configuration. +Displays the IP SLA supported operation types, number of configured entries, active entries, pending entries, and inactive entries. +Displays the configuration of the IP SLA entries, including the target and source address, target and source port, ToS parameter, interval, schedule, and threshold. +Displays the results of the IP SLA operation. The type of operation will determine the statistics that are displayed. +Displays the information about the IP SLA responder such as the control port, the number of control messages received, the number of errors, and the recent sources of IP SLA probes. + + +show snmp view + +show snmp user + + + +show snmp host + + + + + +show run | section sla + +show ip sla application + + +show ip sla configuration + + + +show ip sla statistics + + +show ip sla responder + + + + + + +From the Library of Outcast Outcast +848 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Task +Displays the sending and reception of IP SLA messages in real time. +Displays the status of tracking objects, including the object being tracked, the status of the object, and the protocols or service it is attached to. +Displays the configuration of SPAN and RSPAN in the running configuration. +Displays the SPAN and RSPAN sessions configured on the device, including the source and destination ports and VLANs and the direction the packets will be captured. +Displays the RSPAN configuration VLANs. + +Command Syntax debug ip sla trace + +show track + + + +show run | section monitor + +show monitor + + + +show vlan remote-span + + +Displays the status of an interface, the VLAN show interfaces status it is associated with, in addition to the +duplex, speed, and type. For SPAN/RSPAN, the destination port is listed as Monitoring in the status column. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +■ Console and vty Access Troubleshooting: This section explains how to identify and troubleshoot issues relating to console and vty access, including Telnet and SSH. + +■ Cisco IOS AAA Troubleshooting: This section examines the AAA authentication process and the issues that you might face when using local AAA to authenticate remote access. + +■ Management Access Trouble Tickets: This section provides trouble tickets that demonstrate how you can use a structured troubleshooting process to solve a reported problem. + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 20 + + + + + + +Troubleshooting Management Access + + +To troubleshoot issues with Cisco routers and switches, you need access to them. You can access them physically using the console port or remotely with the vty lines. If you attempt to access a device for management purposes, and access fails, you will need to troubleshoot why this failure is occurring before you can troubleshoot the other issues. + +This chapter covers the different reasons why access to the console and vty lines might fail and how you can identify those reasons. In addition, you will learn the issues that may arise when using Cisco IOS AAA (authentication, authorization, and accounting) authentication. + +“Do I Know This Already?” Quiz + +The “Do I Know This Already?” quiz allows you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 20-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” + +Table 20-1 “Do I Know This Already?” Section-to-Question Mapping + + +Foundation Topics Section +Console and vty Access Troubleshooting + +Cisco IOS AAA Troubleshooting + +Questions +1–8 + +9–10 + + + +Caution The goal of self-assessment is to gauge your mastery of the topics in this chap-ter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving your-self credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security. + + + + + + + + +From the Library of Outcast Outcast +852 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +1. Which of the following are the default serial terminal settings for a Cisco router or switch? (Choose two answers.) + +a. 9600 baud + +b. 16 data bits + +c. 1 stop bit + +d. Parity + +2. What type of cable is used to connect to the console port? + +a. Straight-through + +b. Crossover + +c. Rollover + +d. Coaxial + +3. Which command enables you to define which protocols will be used for remote access to the Cisco device via the vty lines? + +a. transport input + +b. login + +c. login local + +d. exec + +4. Which command enables you to specify that SSH access will be authenticated using the local database? + +a. login + +b. login local + +c. login authentication default + +d. transport input ssh + +5. Which command enables you to filter the users that are allowed to remotely access the device via the vty lines? + +a. access-class {acl_name | acl_number} in + +b. access-class {acl_name | acl_number} out + +c. ip access-group {acl_name | acl_number} in + +d. ip access-group {acl_name | acl_number} out + + + + + + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 853 + +6. Which port is used by SSH? + +a. 21 + +b. 22 + +c. 23 + +d. 25 + +7. What does an SSH version of 1.99 represent? + +a. SSHv1 is only enabled. + +b. SSHv1.99 is only enabled. + +c. SSHv2 is only enabled. + +d. SSHv1 and v2 are enabled. + +8. Which encryption level uses SHA-256? + +a. 0 + +b. 4 + +c. 5 + +d. 7 + +9. Which command successfully configures a user-defined method list on a Cisco IOS device that uses the database on the device if the external server is not available for authentication? +a. aaa authentication login default local group radius + +b. aaa authentication login default group radius local + +c. aaa authentication login REMOTE_ACCESS local group radius + +d. aaa authentication login MANAGEMENT_ACCESS group radius local + +10. Your Cisco router is configured with the following command: aaa authentication login default group radius local + +What will occur during login if the local database does not contain any username and password when it is checked? +a. The RADIUS server will be used for authentication. + +b. Authentication will fail. + +c. The user will be granted access. + +d. The line password will be used. + + + + + + + +From the Library of Outcast Outcast +854 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Foundation Topics + + +Console and vty Access Troubleshooting + +You can access a Cisco IOS router or switch for management purposes in various ways. There is the console line, which is used when you have physical access to the device, or when you are using an access server. There are the vty lines, which provide remote con-nectivity using Telnet or Secure Shell (SSH), so device management can be done from a remote location. Regardless of the method you use for management purposes, at some point you will likely end up having to troubleshoot why you are not able to connect +to a device so that you can troubleshoot another issue that has been presented to you. Therefore, you potentially have to solve one issue to get to the next issue. + +This section explains the reasons why management access to a Cisco IOS router or switch may fail, how you can troubleshoot why it is occurring and how you can fix it. You will also learn how to troubleshoot issues related to Cisco IOS AAA authentication which can be used during the authentication process for validating management access. + +Console Access Troubleshooting + +The default out-of-the-box method of accessing Cisco routers and switches is via the console port. Here are some things you should look out for when troubleshooting con- +sole access: + + +■ Key +Topic + + +■ + + +■ + + + +■ + + + +■ + + + +■ + +Has the correct COM port been selected in the terminal program? Most times, multiple COM ports are displayed in the terminal program; however, the last one listed is usually the correct one to use. If it is not, try a different one. This is really a trial-and-error process. + +Are the terminal programs settings configured correctly? Cisco devices use the following default values: 9600 baud, 8 data bits, 1 stop bit, no parity. + +Is a line password used to authenticate to the console? If a line password is being used, the login command needs to be configured as well. The login command and a line password are not configured by default. + +Is a local username and password used to authenticate to the console? If local authentication is being used, a username and password need to exist in the local database, and the login local command is required. + +Is an AAA server used to authenticate to the console? If AAA authentication is being used, a method list needs to be defined with the login authentication {default | list_name} command in line console configuration mode. + +Are the correct cable and drivers being used to connect to the console port? +Check your device’s documentation to see what is needed. Newer devices are using a + + + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 855 + +mini USB port as the console port (drivers required on PC), whereas older devices are using the serial to RJ-45 console (rollover) cable. + + +vty Access Troubleshooting + +Most devices will be administered remotely via the vty lines, which support protocols such as Telnet and SSH for remote access. Telnet is not recommended because all traffic between the management station and the router/switch is sent in plain text. If a malicious user is able to capture the packets, that user will be able to see all the data that was trans-mitted back and forth. If you use SSH, the packets will be encrypted, ensuring that if they are captured, they will not be readable. + +Telnet + +Consider the following while troubleshooting Telnet access to a device: + + +■ Key +Topic +■ + + + + + + + +■ + + + + + +■ + + + + + +■ + +Is the IP address of the remote router/switch reachable? You can test this with the ping command. + +Are the correct transport protocols defined for the line? By default with IOS 15.0 and later, Telnet and SSH are allowed, and if other protocols are supported, they +are typically allowed as well; however, with the transport input command, you can change which transport protocols are allowed. You can verify the allowed proto-cols with the command show line vty line_number | include Allowed, as shown +in Example 20-1. In this example, Telnet and SSH are allowed for inbound and out-bound connections. + +Is the line configured to ask the user for credentials? By default, it is. The login command tells the line to prompt the user for a password, as shown in Example 20-2. However, if you need to authenticate the user via the local database, the login local command is required, and if you need to authenticate the user via AAA, the login authentication {default | list_name} command is required. + +Is a password specified? Because the login command is enabled by default, a pass-word is required. If it is not set, the error message Password required, but none set will appear. If you are using the login local command or AAA, you will be prompted for a username and password instead. However, if there is none stored in the data-base of either, your login will be invalid and fail. + +Is there an ACL defining which management stations based on IP address can access the router/switch? Example 20-3 shows ACL 1 applied to the vty lines. It only allows access from the IP address 192.168.1.11. Notice the explicit deny that was added so that we could keep track of the number of denied remote access attempts that have occurred (7 in this case). To receive a log message indicating which IP address was denied, you need to add the log keyword to the end of the explicit deny entry in the ACL. A log message appears as follows if the log keyword +is added: %SEC-6-IPACCESSLOGS: list 1 denied 10.1.12.2 1 packet. + + + + + +From the Library of Outcast Outcast +856 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +■ Are all vty lines busy? By default, there are five vty lines on Cisco routers and switches, numbered 0 to 4. Some devices have more. However, regardless of the number, if all the lines have established connections, a new connection will not be made, as shown in Example 20-4. In this case, the show users command on SW1 indicates there is one console connection and five vty connections on lines 0 to 4. The next device that tries to telnet will be refused and receive the message Password required, but none set, even though that is not technically the issue. If you need to manually clear the lines, use the clear line command followed by the line number specified before vty, as shown in Example 20-4, not the actual vty number listed after vty. + +■ Is there an ACL in the path between the client and the device blocking port 23? Telnet uses TCP port 23. If there is an ACL configured on a router or firewall block-ing port 23, you will be unable to make a successful Telnet connection. + +Example 20-1 Verifying Transport Protocols for a Line + +SW1#show line vty 0 | include Allowed +Allowed input transports are telnet ssh. +Allowed output transports are telnet ssh. + + +Example 20-2 Verifying the vty login Command + +SW1#show run | section line vty +line vty 0 4 +login + + +Example 20-3 Verifying ACLs Used to Secure Management Access + +SW1#show run | section line vty +line vty 0 4 +access-class 1 in +password cisco +login +DSW1#show ip access-lists 1 +Standard IP access list 1 +10 permit 192.168.1.11 (4 matches) +20 deny any (7 matches) + + +Example 20-4 Verifying Which Lines Are Being Used + +SW1#show users + +Line User +* 0 con 0 + +Host(s) +idle + +Idle Location +00:00:00 + + + +1 vty 0 idle +2 vty 1 idle +3 vty 2 idle +4 vty 3 idle +5 vty 4 idle + +00:00:42 10.1.1.2 +00:00:48 10.1.10.1 +00:00:55 10.1.20.1 +00:00:47 10.1.23.3 +00:00:41 10.1.43.4 + + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 857 + +SSH + +With Secure Shell (SSH), you will experience the same issues as described with Telnet, in addition to the following: + + +Key ■ Topic + + + + + + + +■ + + + + + + +■ + + + + + +■ + +Is the correct version of SSH specified? By default both version 1 and 2 are enabled. However, with the ip ssh version {1 | 2} command it can be changed to just 1 or 2. If clients are connecting with v2 and the device is configured for v1, the SSH connection will fail, and the same is true if clients are using v1 and the devices are configured for v2. To check the version of SSH running use the show ip ssh com-mand, as shown in Example 20-5. If it states version 1.99 it means version 1 and 2 are running. If it states version 1 then SSHv1 is running, and if it states version 2 then SSHv2 is running. + +Has the correct login command been specified? SSH uses a username and pass-word for authentication. Therefore, the login command will not work in this case because it only requests a password. You need to use the login local command to authenticate with the local database or the login authentication {default | list_name} command to authenticate with an AAA server. As shown in Example 20-6, the login local command has been specified. + +Has the correct size key been specified? SSHv2 uses an RSA key size of 768 or greater. If you were using a smaller key size with SSHv1 and then switched to SSHv2, you would need to create a new key with the correct size; otherwise, SSHv2 would not work. If you are using SSHv2 but accidentally specify a key size less than 768, SSHv2 connections will not be allowed. + +Is there an ACL in the path between the client and the device blocking port 22? SSH uses TCP port 22. If an ACL blocking port 22 is configured on a router or fire- +wall, you will be unable to make a successful SSH connection. + + +Example 20-5 Verifying the SSH Version + +SW1#show ip ssh +SSH Enabled - version 1.99 +Authentication timeout: 120 secs; Authentication retries: 3 +Minimum expected Diffie Hellman key size : 1024 bits +IOS Keys in SECSH format(ssh-rsa, base64 encoded): +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDtRqwdcEI+aGEXYmklh4G6pSJW1th6/Ivg4BCp19tO +BmdoW6NZahL2SxdzjKW8VIBjO1lVeaMfdmvKlpLjUlx7JDAkPs4Q39kzdPHY74MzD1/u+Fwvir8O5AQO +rUMkc5vuVEHFVc4WxQsxH4Q4Df10a6Q3UAOtnL4E0a7ez/imHw== + + +Example 20-6 Verifying the vty Line Configuration + +SW1#show run | s line vty +line vty 0 4 +password cisco +login local + + + + + +From the Library of Outcast Outcast +858 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +To verify the current SSH connections, use the show ssh command. In Example 20-7, there is an SSHv2 inbound and outbound connection with the username cisco. The session is using aes128-cbc encryption and the hashed message authentication code (HMAC) hmac-sha1. + +Example 20-7 Verifying SSH Connections + +SW1#show ssh +Connection Version Mode Encryption Hmac State Username + +0 2.0 IN +0 2.0 OUT + +aes128-cbc +aes128-cbc + +hmac-sha1 +hmac-sha1 + +Session started cisco +Session started cisco + +%No SSHv1 server connections running. + + +Password Encryption Levels + + + +Key Topic + +By default, all passwords are stored in clear text within the IOS configuration. It is recom-mended that passwords either be encrypted or hashed in the configuration for security reasons. Example 20-8 displays a sample output of the passwords stored in the running configuration. A level of 0 indicates no encryption. A level of 4 indicates that SHA256 was used. A level of 5 indicates that message digest 5 (MD5) was used. A level of 7 indi-cates that Type-7 encryption was used. The levels from strongest to weakest are 4, 5, 7, and then 0. To implement Type-7 encryption, you issue the service password-encryption command. To implement level 4 encryption, you use the secret keyword when specify-ing a password. In IOS 15.0 and later, level 4 is the default for the secret keyword. If you need to use level 5 (default on 12.4 and earlier), you will have to use the secret 5 key- +word and specify the actual MD5 hash and not the clear-text password. + + +Example 20-8 Verifying Password Security Levels + +SW1#show run | section username +username admin password 0 letmein +username administrator password 7 082D495A041C0C19 +username cisco secret 4 tnhtc92DXBhelxjYk8LWJrPV36S2i4ntXrpb4RFmfqY +username Raymond secret 5 $1$sHu.$sIjLazYcNOkRrgAjhyhxn0 + + +Cisco IOS AAA Troubleshooting + +AAA is a framework that provides authentication, authorization, and accounting to secure the management plane. The 300-135 TSHOOT exam objectives focus on AAA authentication using the local database; therefore, in this section, the troubleshooting focus centers on this. However, because most organizations use AAA servers, we include a RADIUS server in our example so that you can see what occurs when the RADIUS server is not accessible and the router or switch falls back to local authentication. + + + + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 859 + +Example 20-9 provides a sample Cisco IOS AAA configuration for management access to the console and vty lines. As you review the output, consider the following items you should keep in mind while troubleshooting Cisco IOS AAA authentication: + + +Key ■ Topic + + + + + +■ + + + + + + + + + +■ + + + + + + + +■ + +AAA needs to be enabled: AAA is disabled by default on Cisco routers and switches. To enable AAA, use the aaa new-model command. Once you do this, local authentication is immediately applied to all lines except the console line. Therefore, you will not be able to access the device remotely if no username and password exists in the local database. Console access is still capable with no username or pass-word. + +AAA relies on the local username and password database or an AAA server such as RADIUS or TACACS+: By default, AAA uses the local username and password database for authentication. If no username and password exists that can be used for remote access, authentication will fail. Therefore, if you are using local authentica-tion, a username and password needs to exist on the local device. However, if you are using an AAA server, you should still configure at least one username and pass-word in the local database that can be used for fallback purposes in case the AAA server is not available. In Example 20-9, the username admin with a password of letmein exists. + +A method list defines the authentication methods: When no method list exists, the vty lines use the local username and password database by default. However, with the method list, you can define what methods of authentication will be used and +in what order. In Example 20-9, a user-defined method list for login authentication called MANAGEMENT_ACCESS will use RADIUS servers first, and if they are not accessible, local authentication will be used. If there is no username or password in the database, authentication fails. + +AAA method lists are applied to the lines: The method list that will be used to define how authentication will occur for the vty lines or console line needs to be applied with the login authentication {default | list_name} command. In Example 20- +9, the MANAGEMENT_ACCESS method list is attached to the vty lines. + + +Example 20-9 Verifying Cisco IOS AAA Configuration + +R1#show run | section username|aaa|line vty +username admin password 0 letmein +aaa new-model +aaa authentication login MANAGEMENT_ACCESS group radius local +line vty 0 4 +password cisco +login authentication MANAGEMENT_ACCESS + +You can use the debug aaa authentication command to verify the authentication process in real time. You can use the debug radius authentication command to view the RADIUS authentication processes in real time. You can use the debug aaa protocol local com-mand to view local authentication processes in real time. + + + + +From the Library of Outcast Outcast +860 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +In Example 20-10, all three debug commands have been enabled on R1. When a user attempts to telnet from SW1 to R1, R1 invokes the method list MANAGEMENT_ ACCESS, which, based on the configuration in Example 20-9, will use RADIUS first and then local authentication if the RADIUS server is not accessible. R1 asks the user for his credentials, and then sends a RADIUS packet to the address 10.1.100.100 on port 1645. Notice how the request to the RADIUS server fails because there is no response from the RADIUS server in this example. Therefore, R1 resorts to local authentication and checks the username and password against the local database. However, the user provided the wrong username/password combination, and the process starts over again by choosing the method list MANAGEMENT_ACCESS and asking the user for his credentials again. + +Example 20-10 Debugging Cisco IOS AAA Configuration + +R1#debug aaa authentication +AAA Authentication debugging is on +R1#debug radius authentication +Radius protocol debugging is on +Radius protocol brief debugging is off +Radius protocol verbose debugging is off +Radius packet hex dump debugging is off +Radius packet protocol (authentication) debugging is on +Radius packet protocol (accounting) debugging is off +Radius elog debugging debugging is off +Radius packet retransmission debugging is off +Radius server fail-over debugging is off +Radius elog debugging debugging is off +R1#debug aaa protocol local +AAA Local debugs debugging is on +R1# +AAA/LOCAL: exec +AAA/BIND(0000004D): Bind i/f +AAA/LOCAL: new_ascii_login: tty 76EA4F4 idb 0 +AAA/AUTHEN/LOGIN (0000004D): Pick method list 'MANAGEMENT_ACCESS' +RADIUS/ENCODE(0000004D): ask "Username: " +RADIUS/ENCODE(0000004D): send packet; GET_USER +R1# +RADIUS/ENCODE(0000004D): ask "Password: " +RADIUS/ENCODE(0000004D): send packet; GET_PASSWORD +...output omitted... +RADIUS(0000004D): Sending a IPv4 Radius Packet +RADIUS(0000004D): Send Access-Request to 10.1.100.100:1645 id 1645/11, len 69 +RADIUS: authenticator 09 9E 3E A4 D9 F9 03 87 - 85 02 41 47 BD 72 8F ED + +RADIUS: +RADIUS: +RADIUS: +RADIUS: +RADIUS: + +User-Name +User-Password +NAS-Port +NAS-Port-Id +NAS-Port-Type + +[1] 7 "admin" +[2] 18 * +[5] 6 1 +[87] 6 "tty1" +[61] 6 Virtual [5] + + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 861 + +RADIUS: NAS-IP-Address [4] 6 10.1.100.1 +R1# +RADIUS(0000004D): Started 5 sec timeout +R1# +RADIUS(0000004D): Request timed out +RADIUS: Retransmit to (10.1.100.100:1645,1646) for id 1645/11 +RADIUS(0000004D): Started 5 sec timeout +R1# +RADIUS(0000004D): Request timed out +RADIUS: Retransmit to (10.1.100.100:1645,1646) for id 1645/11 +RADIUS(0000004D): Started 5 sec timeout +R1# +RADIUS(0000004D): Request timed out +RADIUS: Retransmit to (10.1.100.100:1645,1646) for id 1645/11 +RADIUS(0000004D): Started 5 sec timeout +R1# +RADIUS(0000004D): Request timed out +RADIUS: No response from (10.1.100.100:1645,1646) for id 1645/11 +RADIUS/DECODE: No response from radius-server; parse response; FAIL +RADIUS/DECODE: Case error(no response/ bad packet/ op decode);parse response; FAIL +AAA/LOCAL/LOGIN(0000004D): check username/password +AAA/LOCAL/LOGIN(0000004D): invalid username/password +R1# +AAA/AUTHEN/LOGIN (0000004D): Pick method list 'MANAGEMENT_ACCESS' +RADIUS/ENCODE(0000004D): ask "Username: " +RADIUS/ENCODE(0000004D): send packet; GET_USER +R1# + +By default, many Cisco IOS devices use ports 1645 and 1646 for RADIUS and port 49 for TACACS. In Example 20-10, you can see that R1 is attempting to communicate to the RADIUS server at 10.1.100.100 using ports 1645 and 1646. However, RADIUS ports were changed, and the current standard is to use ports 1812 and 1813. Therefore, you need +to be aware of which ports are being used on the server and configure your IOS device appropriately. Also, if RADIUS or TACACS+ communication between the authenticator (Cisco IOS device) and the authentication server (RADIUS or TACACS+ server) is not successful, you should verify that any ACLs between these devices are permitting traffic for the RADIUS or TACACS+ ports being used. + +Management Access Trouble Tickets + +This section presents various trouble tickets relating to the topics discussed earlier in the chapter. The purpose of these trouble tickets is to give a process that you can follow when troubleshooting in the real world or in an exam environment. All trouble tickets in this section are based on the topology depicted in Figure 20-1. + + + + + +From the Library of Outcast Outcast +862 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +203.0.113.1 R2 + + +SW2 R1 R4 192.0.2.1 + +R3 + +Figure 20-1 Management Access Trouble Tickets Topology + + +Trouble Ticket 20-1 + +Problem: A security audit has been done, and the report shows that R4 is accessible via Telnet and SSH when it should only be accessible via SSH. + +You commence troubleshooting by verifying the problem. In Example 20-11, you telnet to R4’s IP address 192.0.2.1, and it is successful. You then use SSHv2, and it is successful as well. + +Example 20-11 Verifying the Problem + +SW2#telnet 192.0.2.1 +Trying 192.0.2.1 ... Open + + +User Access Verification + +Username: TSHOOT +Password: +R4>exit + +[Connection to 192.0.2.1 closed by foreign host] +SW2#ssh -v 2 -l TSHOOT 192.0.2.1 +Password: +R4>exit + +[Connection to 192.0.2.1 closed by foreign host] +SW2# + +You access R4 and issue the command show line vty 0 | i Allowed input transports to verify which protocols can be used to establish a remote connection with R4. According to the output in Example 20-12, LAT, PAD, Telnet, rlogin, mop, v120, SSH, and NASI are all allowed. + +Example 20-12 Identifying Allowed Protocols + +R4#show line vty 0 | i Allowed input transports +Allowed input transports are lat pad telnet rlogin mop v120 ssh nasi. + + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 863 + +Next you issue the command show run | section line vty, as shown in Example 20-13, and notice that there is no transport input command controlling which protocols are permitted. + +Example 20-13 Verifying the vty Configuration + +R4#show run | section line vty +line vty 0 4 +password cisco +login local + +Because you only need to allow SSHv2, you issue the command transport input ssh in line vty configuration mode, as shown in Example 20-14, to prevent Telnet access. + +Example 20-14 Modifying the vty Configuration + +R4#config t +Enter configuration commands, one per line. End with CNTL/Z. +R4(config)#line vty 0 4 +R4(config-line)#transport input ssh + +To verify that the problem is solved, you attempt to telnet from SW2 to R4 again, but this time the connection is refused by R4. However, SSHv2 still works as expected. The prob-lem is solved, as shown in Example 20-15. + +Example 20-15 Verifying That the Problem Is Solved + +SW2#telnet 192.0.2.1 +Trying 192.0.2.1 ... +% Connection refused by remote host + +DSW2#ssh -v 2 -l TSHOOT 192.0.2.1 +Password: +R4>exit + +[Connection to 192.0.2.1 closed by foreign host] +SW2# + + +Trouble Ticket 20-2 + +Problem: For security reasons, when accessing R2 via Telnet, the user should be prompt-ed for a username and password. However, users are only being prompted for a password. + +You commence the troubleshooting process by verifying the problem. You attempt to Telnet from SW2 to R2 at the IP address 203.0.113.1. As you can see in the output of Example 20-16, you are only being asked for a password. You have a feeling that the login local command is missing. + + + + + +From the Library of Outcast Outcast +864 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 20-16 Verifying the Problem + +SW2#telnet 203.0.113.1 +Trying 203.0.113.1 ... Open + + +User Access Verification + +Password: +R2> + +On R2, you issue the command show run | section line vty, as shown in Example 20-17, to verify that the login local command is missing. According to the output, it is. + +Example 20-17 Verifying the vty Configuration on R2 + +R2#show run | section line vty +line vty 0 4 +password cisco + +You enter live vty mode, as shown in Example 20-18, and issue the login local command, but it fails to execute. The error message indicates that local is not a valid option. You then use syntax help, and it indicates that authentication is the only valid option. This means that AAA is in use. + +Example 20-18 Configuring Local Authentication on R2 + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#line vty 0 4 +R2(config-line)#login local +^ +% Invalid input detected at '^' marker. + +R2(config-line)# +R2(config-line)#login ? +authentication Authentication parameters. + +On R4, you issue the command show run | section aaa to verify the AAA configuration, as shown in Example 20-19. It appears that the AAA authentication method list was config-ured incorrectly. It is only using the line for authentication. If you want to use a username and password, you need to use the local database or an AAA server. In this case, you are using the local database; therefore, you need to specify local as a method instead of line. + +Example 20-19 Verifying AAA Configuration + +R2#show run | section aaa +aaa new-model +aaa authentication login default line + + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 865 + +In Example 20-20, you enter the command no aaa authentication login default line and issue the command aaa authentication login default local. + +Example 20-20 Modifying AAA Configuration + +R2#config t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#no aaa authentication login default line +R2(config)#aaa authentication login default local +R2(config)#end + +You then attempt to telnet again, and this time, as shown in Example 20-21, you are prompted for a username and password. + +Example 20-21 Verifying Issue Is Solved + +SW2#telnet 203.0.113.1 +Trying 203.0.113.1 ... Open + +User Access Verification + +Username: TSHOOT +Password: + +R2> + + +Trouble Ticket 20-3 + +Problem: A user is trying to manage R4 via an SSHv2 connection, but the connection fails. + +You begin by verifying the problem with an attempt to establish an SSHv2 connection to R4 from SW2. It fails, as shown in Example 20-22, confirming the problem. However, you are happy that you verified the problem because the error message is giving you more information. This error usually means that the remote device does not support +SSHv2. However, you know without a doubt that R4 does support SSHv2. Therefore, you hypothesize that something is misconfigured on R4. + +Example 20-22 Verifying the Problem + +SW2#ssh -v 2 -l TSHOOT 192.0.2.1 +[Connection to 192.0.2.1 aborted: error status 0] + +You access R4 and issue the command show ip ssh and confirm that version 1.5 is being used, as shown in Example 20-23. You have a feeling that the SSH RSA key is not large enough for SSHv2. However, it does not list the key size. Therefore, you decide to spot the difference with R2. On R2, as shown in Example 20-24, you issue the show ip ssh command and notice that v2 is enabled and that the SSH RSA key is significantly larger. + + + + +From the Library of Outcast Outcast +866 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 20-23 Verifying SSH Configuration on R4 + +R4#show ip ssh +SSH Enabled - version 1.5 +Authentication timeout: 120 secs; Authentication retries: 3 +Minimum expected Diffie Hellman key size : 1024 bits +IOS Keys in SECSH format(ssh-rsa, base64 encoded): +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAATADIEIKgD03hu48qw9Wy/K5JRB/Gf4YQ8mi0iEo/EKzT +VyR33bQSYBhIsgxo8AAOuU0m3wPlBSwPIdtVV1WHvN9EUDx6xlU6tL/+qEs= + + +Example 20-24 Verifying SSH Configuration on R5 + +R2#show ip ssh +SSH Enabled - version 2.0 +Authentication timeout: 120 secs; Authentication retries: 3 +Minimum expected Diffie Hellman key size : 1024 bits +IOS Keys in SECSH format(ssh-rsa, base64 encoded): +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCtMAHQGeZaB/uWXiqF17KOWL+LvjsGOsJOCLFEkg7X +carueOLHbfsxhADkThmwFOKsN9Sq9jFbd5YVpiRoP4nM8He/yRJszNDmCQAbV47IjhTYVISoznsRFh0P +/rxN/bf5ZsEdk4LVdA1nGnBjLsWTPTMO64PGOf/eVllrCMVYcw== + +You access your documentation, and it states that all SSHv2 sessions should use a key of 1024. Therefore, on R4 you issue the crypto key generate rsa modulus 1024 command to generate new cryptographic keys. As you can see in Example 20-25, the old keys are replaced with the new ones, and SSH 1.99 is enabled, which supports v1 and v2. As a result, you issue the ip ssh version 2 command to enable just SSHv2. + +Example 20-25 Creating a Local Cryptographic Key + +R4#config t +Enter configuration commands, one per line. End with CNTL/Z. +R4(config)#crypto key generate rsa modulus 1024 +% You already have RSA keys defined named R4.TSHOOT.local. +% They will be replaced. + +% The key modulus size is 1024 bits +% Generating 1024 bit RSA keys, keys will be non-exportable... +[OK] (elapsed time was 2 seconds) + +R4(config)# +%SSH-5-DISABLED: SSH 1.5 has been disabled +R4(config)# +%SSH-5-ENABLED: SSH 1.99 has been enabled +R4(config)#ip ssh version 2 + +You examine the output of show ip ssh on R4 again, as shown in Example 20-26. It shows that SSHv2 is now enabled; and if you compare the new SSH RSA key with the old one, it is much larger. + + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 867 + +Example 20-26 Verifying That SSHv2 Is Enabled + +R4#show ip ssh +SSH Enabled - version 2.0 +Authentication timeout: 120 secs; Authentication retries: 3 +Minimum expected Diffie Hellman key size : 1024 bits +IOS Keys in SECSH format(ssh-rsa, base64 encoded): +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCT6oQo7Ge64ky61+BPOJHOQwnaiUeJCPSbuDSjt610 +DB6lRa0nhCjEMRG2W1OznJNtV5kHBdL7E/880ZOoQcSe3DEyh9TD88/CZI/Tr80OrLJYaN+5Y/7ZaZkp +5AUZCBVibtbkuC/z8FokE417607dI1KgP7VsjOgKIur8FkciNQ== + +Back on SW2, you try to establish an SSHv2 session to R4, and it is successful, as shown in Example 20-27. + +Example 20-27 Verify That the Issue Is Solved + +SW2#ssh -v 2 -l TSHOOT 192.0.2.1 +Password: +R4> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +868 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exam Preparation Tasks + + +As mentioned in the section “How to Use This Book” in the Introduction, you have a couple of choices for exam preparation: the exercises here; Chapter 22, “Final Preparation;” and the exam simulation questions on the CD-ROM. + +Review All Key Topics + +Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 20-2 lists a reference of these key topics and the page numbers on which each is found. + +Table 20-2 Key Topics for Chapter 20 +Key +Topic Key Topic Element Description Page Number + +List + +List + +List + +Paragraph + +List + +Describes the items you should consider when 854 troubleshooting issues related to console port access +Outlines the items you should consider when 855 troubleshooting issues related to Telnet +Outlines the items you should consider when 857 troubleshooting issues related to SSH +Reviews the different types of password encryption 858 levels +Outlines the items you should consider when 859 troubleshooting issues related to Cisco IOS AAA authentication + + + +Define Key Terms + +Define the following key terms from this chapter and check your answers in the glossary: + +login, login local, AAA, method list, rollover cable, Telnet, SSH, line, console, port 23, port 22, level 4 encryption, level 5 encryption, level 7 encryption, RADIUS, TACACS+ + +Command Reference to Check Your Memory + +This section includes the most important show and debug commands covered in this chapter. It might not be necessary to memorize the complete syntax of every command, but you should be able to remember the basic keywords that are needed. + +To test your memory of the commands, cover the right side of Table 20-3 with a piece of paper, read the description on the left side, and then see how much of the command you can remember. + + +From the Library of Outcast Outcast +Chapter 20: Troubleshooting Management Access 869 + +The 300-135 TSHOOT exam focuses on practical, hands-on skills that are used by a net-working professional. Therefore, you should be able to identify the commands needed to successfully troubleshoot the topics and concepts covered in this chapter. + +Table 20-3 show and debug Commands + +Task Command Syntax + +Displays the ingress and egress allowed transport protocols on vty line + +Displays only the ingress allowed transport protocols on a vty line + +Displays the vty line configuration in the running configuration +Displays the lines that are currently being used for management connectivity +Displays whether SSH is enabled or disabled, the version of SSH enabled, and the SSH RSA key +Displays the SSHv1 and SSHv2 connections to the local device +Displays the configuration of the local usernames and passwords on the device, the AAA commands that have been configured, and the vty line configuration (great command for verifying AAA configuration issues) +Displays the authentication process in real time + +Displays the RADIUS authentication process in real time +Displays the local authentication process in real time + + +show line vty line_number | include Allowed + +show line vty line_number | include Allowed input transports +show run | section line vty + +show users + +show ip ssh + +show ssh + +show run | section username|aaa|line vty + + + + +debug aaa authentication + +debug radius authentication + +debug aaa protocol local + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + +This chapter covers the following topics: + +In each Trouble Ticket you are presented with a collection of show and debug commands output and challenged to resolve a series of misconfigurations. Suggested solutions are also provided. + +■ Trouble Ticket 1: This section presents you with a trou-ble ticket addressing a network experiencing STP issues. + +■ Trouble Ticket 2: This section presents you with a trouble ticket addressing a network experiencing HSRP issues. + +■ Trouble Ticket 3: This section presents you with a trouble ticket addressing a network experiencing EIGRP issues. + +■ Trouble Ticket 4: This section presents you with a trouble ticket addressing a network experiencing OSPF issues. + +■ Trouble Ticket 5: This section presents you with a trou-ble ticket addressing a network experiencing redistribu-tion issues. + +■ Trouble Ticket 6: This section presents you with a trou-ble ticket addressing a network experiencing BGP issues. + +■ Trouble Ticket 7: This section presents you with a trou-ble ticket addressing a network experiencing manage-ment access issues. + +■ Trouble Ticket 8: This section presents you with a trou-ble ticket addressing a network experiencing NAT issues. + +■ Trouble Ticket 9: This section presents you with a trou-ble ticket addressing a network experiencing OSPFv3 issues. + +■ Trouble Ticket 10: This section presents you with a trouble ticket addressing a network experiencing RIPng issues. + + +From the Library of Outcast Outcast +CHAPTER 21 + + + + + + +Additional Trouble Tickets + + +Troubleshooting routed and switched networks is an art. The more time you spend trou-bleshooting, the better you will become. However, many of us do not have the opportu-nity to troubleshoot on a regular basis or experience many of the issues that may arise in routed and switched networks. Therefore, the more issues you can see samples of, the better. + +This chapter is dedicated to showing you additional trouble tickets and the various approaches that you can take to solve the problems that are presented. Always remember that the right way to troubleshoot is the way that solves the problem for you. You and +I and the person next to you will all have different methods and approaches to trouble-shooting. What works for one might not work for the other. Someone with years of expe-rience will have a vast knowledge base in their head that they can call upon for help while the novice will have to do more research or ask for assistance at times. However, no mat-ter what, we all have the same goal. Solve the problem! Let’s see how the following issues presented in this chapter could be solved. + +Introduction + +All trouble tickets begin with a problem report and a network topology diagram. Some of the trouble tickets provide you with baseline data, and all the trouble tickets offer output from appropriate verification commands (for example, show or debug commands) that you can examine. + +After you hypothesize the underlying cause of the network issue and formulate a solu-tion, you can check the suggested solution comments to confirm your hypothesis. Realize, however, that some trouble tickets might be resolvable by more than one meth-od. Therefore, your solution might be different from the suggested solution. + + + + + + + + + + + + + +From the Library of Outcast Outcast +872 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +R2 +R +1 + +Trouble Ticket 1 + +You receive the following trouble ticket: + +Users on network 192.168.1.0/24 are experiencing latency or no connectivity when attempting to reach network 10.1.2.0/24. It appears to be STP related. + +This trouble ticket references the topology shown in Figure 21-1. + + + + + + + + +Lo 0 10.1.1.1/32 +192.168.1.0/24 + + + + + + + +Lo 0 10.2.2.2/32 + + + + +S 1/0.2 .1 +DLCI = 811 +172.16.1.0/30 +S 1/0.1 .2 +DLCI = 181 + +Lo 0 10.3.3.3/32 +Fa 0/0 .1 + +BB1 + +S 1/0.1 .1 +DLCI = 881 +10.1.3.0/30 +10.1.2.0/24 + + + +Fa 0/0 R Fa 0/1 Fa0/0 2 S 1/0.2 FRSW +.11 .22 DLCI = 182 +.1 +Gig 0/8 192.168.0.0/24 Fa 5/46 172.16.2.0/30 S1/0.2 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 Fa 0/0 +.2 + + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +Figure 21-1 Topology for Trouble Ticket 1 + +As you follow the path of the traffic from network 192.168.1.0/24 to 10.1.2.0/24, you notice high port utilization levels on switches SW1 and SW2. Therefore, you decide to investigate these switches further. + +You have previously issued show commands on these switches as part of your baseline collection process. A selection of the show command output is presented in Examples 21-1 and 21-2. + +Example 21-1 Baseline show Output from Switch SW1 + +SW1#show spanning-tree vlan 1 + +VLAN0001 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost + +32768 +0009.122e.4181 +19 + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 873 + +Port 9 (GigabitEthernet0/9) +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) +Address 000d.28e4.7c80 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type +----------------------------------------------------------------------------------- + +Gi0/8 Desg FWD 19 +Gi0/9 Root FWD 19 +Gi0/10 Altn BLK 100 + +128.8 P2p +128.9 P2p +128.10 Shr + + +SW1#show spanning-tree summary +Switch is in pvst mode +Root bridge for: none +Extended system ID is enabled +Portfast Default is disabled +PortFast BPDU Guard Default is disabled +Portfast BPDU Filter Default is disabled +Loopguard Default is disabled +EtherChannel misconfig guard is enabled +UplinkFast is disabled +BackboneFast is disabled +Configured Pathcost method used is short + +Name Blocking Listening Learning Forwarding STP Active +----------------------------------------------------------------------------- +VLAN0001 1 0 0 2 3 +----------------------------------------------------------------------------- +1 vlan 1 0 0 2 3 +SW1#show spanning-tree interface gig 0/10 detail +Port 10 (GigabitEthernet0/10) of VLAN0001 is alternate blocking +Port path cost 100, Port priority 128, Port Identifier 128.10. +Designated root has priority 32768, address 0009.122e.4181 +Designated bridge has priority 32768, address 0009.122e.4181 +Designated port id is 128.304, designated path cost 0 +Timers: message age 1, forward delay 0, hold 0 +Number of transitions to forwarding state: 0 +Link type is shared by default +BPDU: sent 1, received 276 + + + + + + + + +From the Library of Outcast Outcast +874 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 21-2 Baseline show Output from Switch SW2 + +SW2#show spanning-tree vlan 1 + +VLAN0001 +Spanning tree enabled protocol ieee + +Root ID Priority +Address + +32768 +0009.122e.4181 + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + + +Bridge ID Priority +Address + +32768 +0009.122e.4181 + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type +----------------------------------------------------------------------------------- + +Fa5/46 Desg FWD 19 +Fa5/47 Desg FWD 19 +Fa5/48 Desg FWD 100 + +128.302 Shr +128.303 P2p +128.304 Shr + + +When you connect to the console of switch SW1, you receive the console messages dis-played in Example 21-3. + +Example 21-3 Console Messages on Switch SW1 + +SW1# +00:15:45: %SW_MATM-4-MACFLAP_NOTIF: Host 0009.b7fa.d1e1 in vlan 1 is flapping +between port Gi0/8 and port Gi0/9 +SW1# +00:16:35: %SW_MATM-4-MACFLAP_NOTIF: Host 0009.b7fa.d1e1 in vlan 1 is flapping +between port Gi0/8 and port Gi0/9 +SW1# +00:16:37: %SW_MATM-4-MACFLAP_NOTIF: Host c001.0e8c.0000 in vlan 1 is flapping +between port Gi0/9 and port Gi0/10 +SW1# +00:16:41: %SW_MATM-4-MACFLAP_NOTIF: Host 0009.b7fa.d1e1 in vlan 1 is flapping +between port Gi0/8 and port Gi0/9 + +You also issue the show spanning-tree vlan 1 command on switches SW1 and SW2, as shown in Examples 21-4 and 21-5. + + + + + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 875 + +Example 21-4 show spanning-tree vlan 1 Command Output on Switch SW1 + +SW1#show spanning-tree vlan 1 + +Spanning tree instance(s) for vlan 1 does not exist. + + +Example 21-5 show spanning-tree vlan 1 Command Output on Switch SW2 + +SW2#show spanning-tree vlan 1 + +Spanning tree instance(s) for vlan 1 does not exist. + +Take a moment to look through the baseline information, the topology, and the show command output. Then hypothesize the underlying cause for the connectivity issue reported in the trouble ticket. Finally, on a separate sheet of paper, write out a proposed action plan for resolving the reported issue. + +Suggested Solution +The %SW_MATM-4-MACFLAP_NOTIF console message appearing on switch SW1 indicates that the MAC address in the MAC address table of switch SW1 is flapping between a couple of ports. This is a MAC address table corruption issue that is usually caused by STP not functioning correctly. + +This suspicion is confirmed from the output in the show spanning-tree vlan 1 com-mand, issued on switches SW1 and SW2, which indicates that there is no STP instance for VLAN 1 on either switch. Therefore, as a solution, STP should be enabled for VLAN 1 on both switches, which is depicted in Examples 21-6 and 21-7. + +Example 21-6 Enabling STP for VLAN 1 on Switch SW1 + +SW1#conf term +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)#spanning-tree vlan 1 +SW1(config)#end + + +Example 21-7 Enabling STP for VLAN 1 on Switch SW2 + +SW2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +SW2(config)#spanning-tree vlan 1 +SW2(config)#end + +After giving STP sufficient time to converge, after enabling STP for VLAN 1, the show spanning-tree vlan 1 command is once again issued on switches SW1 and SW2, as illus-trated in Examples 21-8 and 21-9. The output in these examples confirms that STP is now functioning correctly. + + + + + +From the Library of Outcast Outcast +876 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +R2 + +Example 21-8 Checking the STP Status for VLAN 1 on Switch SW1 + +SW1#show spanning-tree vlan 1 +...OUTPUT OMITTED... +Interface Role Sts Cost Prio.Nbr Type +----------------------------------------------------------------------------------- +Gi0/8 Desg FWD 19 128.8 P2p +Gi0/9 Root FWD 19 128.9 P2p +Gi0/10 Altn BLK 100 128.10 Shr + + +Example 21-9 Checking the STP Status for VLAN 1 on Switch SW2 + +SW2#show spanning-tree vlan 1 +...OUTPUT OMITTED... +Interface Role Sts Cost Prio.Nbr Type +----------------------------------------------------------------------------------- + +Fa5/46 Desg FWD 19 +Fa5/47 Desg FWD 19 +Fa5/48 Desg FWD 100 + +128.302 Shr +128.303 P2p +128.304 Shr + + + +Trouble Ticket 2 +You receive the following trouble ticket: + +A new network technician configured HSRP on routers BB1 and BB2, where BB1 is the active router. The configuration was initially working; however, now BB2 is the active router even though BB1 is operational. + +This trouble ticket references the topology shown in Figure 21-2. +Lo 0 10.3.3.3/32 +S 1/0.2 Fa 0/0 .1 .1 +DLCI = 811 BB1 +Lo 0 + + +Lo 0 10.1.1.1/32 + +10.2.2.2/32 172.16.1.X/30 +S 1/0.1 .2 +DLCI = 181 + + +S 1/0.1 .1 +DLCI = 881 +10.1.2.X/24 + + + +Fa 0/0 R1 R2 S 1/0.2 FRSW +Fa 0/1 Fa 0/0 .1 +192.168.1.X/24 +10.1.3.X/30 +.22 +.11 DLCI = 182 +192.168.0.X/24 172.16.2.X/30 +Gig 0/8 Fa 5/46 S 1/0.1 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 Fa 0/0 +.2 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 +Figure 21-2 Trouble Ticket 2 Topology + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 877 + +As you investigate this issue, you examine baseline data collected after Hot Standby Router Protocol (HSRP) was initially configured. Examples 21-10 and 21-11 provide show and debug commands output collected when HSRP was working properly. Notice that router BB1 was acting as the active HSRP router, whereas router BB2 was acting as the standby HSRP router. + +Example 21-10 Baseline Output for Router BB1 + +BB1#show standby brief +P indicates configured to preempt. +| +Interface Grp Prio P State Active Standby Virtual IP +Fa0/0 1 150 Active local 10.1.2.2 10.1.2.3 +BB1#debug standby +HSRP debugging is on +*Mar 1 01:14:21.487: HSRP: Fa0/0 Grp 1 Hello in 10.1.2.2 Standby pri 100 vIP +10.1.2.3 +*Mar 1 01:14:23.371: HSRP: Fa0/0 Grp 1 Hello out 10.1.2.1 Active pri 150 vIP +10.1.2.3 + +BB1#u all +All possible debugging has been turned off + +BB1#show standby fa 0/0 1 +FastEthernet0/0 - Group 1 +State is Active +10 state changes, last state change 00:12:40 +Virtual IP address is 10.1.2.3 +Active virtual MAC address is 0000.0c07.ac01 +Local virtual MAC address is 0000.0c07.ac01 (v1 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 1.536 secs +Preemption disabled +Active router is local +Standby router is 10.1.2.2, priority 100 (expires in 9.684 sec) +Priority 150 (configured 150) +IP redundancy name is "hsrp-Fa0/0-1" (default) + +BB1#show run +...OUTPUT OMITTED... +hostname BB1 +! +interface Loopback0 +ip address 10.3.3.3 255.255.255.255 +! +interface FastEthernet0/0 +ip address 10.1.2.1 255.255.255.0 + + + +From the Library of Outcast Outcast +878 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +standby 1 ip 10.1.2.3 +standby 1 priority 150 +! +interface FastEthernet0/1 +no ip address +! +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + + +Example 21-11 Baseline Output for Router BB2 + +BB2#show standby brief +P indicates configured to preempt. +| +Interface Grp Prio P State Active Standby Virtual IP +Fa0/0 1 100 Standby 10.1.2.1 local 10.1.2.3 +BB2#show run +...OUTPUT OMITTED... +hostname BB2 +! +interface Loopback0 +ip address 10.4.4.4 255.255.255.255 +! +interface FastEthernet0/0 +ip address 10.1.2.2 255.255.255.0 +standby 1 ip 10.1.2.3 +! +interface FastEthernet0/1 +no ip address +! +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + +As part of testing the initial configuration, a ping was sent to the virtual IP address of 10.1.2.3 from router R2 to confirm that HSRP was servicing requests for that IP address. Example 21-12 shows the output from the ping command. + +Example 21-12 Pinging the Virtual IP Address from Router R2 + +R2#ping 10.1.2.3 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.2.3, timeout is 2 seconds: +!!!!! + +As you begin to gather information about the reported problem, you reissue the show standby brief command on routers BB1 and BB2. As shown in Examples 21-13 and 21-14, router BB1 is administratively up with an HSRP priority of 150, whereas router BB2 is administratively up with a priority of 100. + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 879 + +Example 21-13 Examining the HSRP State of Router BB1’s Fast Ethernet 0/0 Interface + +BB1#show standby brief +P indicates configured to preempt. + +Interface Grp Prio P State Active Standby Virtual IP +Fa0/0 1 150 Standby 10.1.2.2 local 10.1.2.3 + + +Example 21-14 Examining the HSRP State of Router BB2’s Fast Ethernet 0/0 Interface + +BB2#show standby brief +P indicates configured to preempt. + +Interface Grp Prio P State Active Standby Virtual IP +Fa0/0 1 100 Active local 10.1.2.1 10.1.2.3 + +Take a moment to look through the baseline information, the topology, and the show command output. Then, hypothesize the underlying cause, explaining why router BB2 is currently the active HSRP router, even though router BB1 has a higher priority. Finally, on a separate sheet of paper, write out a proposed action plan for resolving the reported issue. + +Suggested Solution + +Upon examination of BB1’s output, it becomes clear that the preempt feature is not enabled for the Fast Ethernet 0/0 interface on BB1. The absence of the preempt feature explains the reported symptom. Specifically, if BB1 had at one point been the active HSRP router for HSRP group 1, and either router BB1 or its Fast Ethernet 0/0 interface became unavailable, BB2 would have become the active router. Then, if BB1 or its Fast Ethernet 0/0 interface once again became available, BB1 would assume a standby HSRP role, because BB1’s Fast Ethernet 0/0 interface was not configured for the preempt fea-ture. + +To resolve this configuration issue, the preempt feature is added to BB1’s Fast Ethernet 0/0 interface, as shown in Example 21-15. After enabling the preempt feature, notice that router BB1 regains its active HSRP role. + +Example 21-15 Enabling the Preempt Feature on Router BB1’s Fast Ethernet 0/0 Interface + +BB1#conf term +Enter configuration commands, one per line. End with CNTL/Z. +BB1(config)#int fa 0/0 +BB1(config-if)#standby 1 preempt +BB1(config-if)#end +BB1# +*Mar 1 01:17:39.607: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 1 state Standby -> +Active + + + + +From the Library of Outcast Outcast +880 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +R +R2 +1 +.1 +.22 + +BB1#show standby brief +P indicates configured to preempt. +| +Interface Grp Prio P State Active Standby Virtual IP +Fa0/0 1 150 P Active local 10.1.2.2 10.1.2.3 + + +Trouble Ticket 3 + +You receive the following trouble ticket: + +Enhanced Interior Gateway Routing Protocol (EIGRP) has just been configured as the routing protocol for the network. After configuring EIGRP on all routers and instructing all router interfaces to participate in EIGRP, router R2 does not appear to be load balanc-ing across its subinterfaces to BB1 and BB2 when sending traffic to network 10.1.2.0/24. + +This trouble ticket references the topology shown in Figure 21-3. +Lo 0 10.3.3.3/32 + + + + + +Lo 0 10.1.1.1/32 +192.168.1.0/24 + + + + + +Lo 0 10.2.2.2/32 + + +S 1/0.2 .1 +DLCI = 811 +172.16.1.0/30 +S 1/0.1 .2 +DLCI = 181 +10.1.3.0/30 + +Fa 0/0 .1 + +BB1 + +S 1/0.1 .1 +DLCI = 881 +10.1.2.0/24 + + + +Fa 0/0 RFa 0/1 Fa 0/0 2 S 1/0.2 FRSW .11 DLCI = 182 +Gig 0/8 192.168.0.0/24 Fa 5/46 172.16.2.0/30 S 1/0.2 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 Fa 0/0 +.2 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 +Figure 21-3 Trouble Ticket 3 Topology + +As you investigate this issue, you examine baseline data collected after EIGRP was ini-tially configured. Example 21-16 confirms that router R2’s IP routing table contains only a single path to get to the backbone network of 10.1.2.0/24. + +Example 21-16 Baseline IP Routing Table on Router R2 + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 881 + +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 +D 10.1.3.0/30 [90/3072000] via 172.16.2.2, 00:00:34, Serial1/0.2 +D 10.3.3.3/32 [90/2713600] via 172.16.2.2, 00:00:34, Serial1/0.2 +D 10.1.2.0/24 [90/2585600] via 172.16.2.2, 00:00:34, Serial1/0.2 +D 10.1.1.1/32 [90/409600] via 192.168.0.11, 00:00:46, FastEthernet0/0 +D 10.4.4.4/32 [90/2688000] via 172.16.2.2, 00:00:34, Serial1/0.2 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +D 192.168.1.0/24 [90/284160] via 192.168.0.11, 00:18:33, FastEthernet0/0 + +You then view the EIGRP topology table on router R2 to see whether EIGRP has learned more than one route to reach the 10.1.2.0/24 network. The output, shown in Example 21-17, indicates that the EIGRP topology table knows two routes that could be used to reach the 10.1.2.0/24 network. + +Example 21-17 EIGRP Topology Table on Router R2 + +R2#show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.2.2.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.1.3.0/30, 1 successors, FD is 3072000 +via 172.16.2.2 (3072000/2169856), Serial1/0.2 +via 172.16.1.1 (4437248/2169856), Serial1/0.1 +P 10.2.2.2/32, 1 successors, FD is 128256 +via Connected, Loopback0 +P 10.1.2.0/24, 1 successors, FD is 2585600 +via 172.16.2.2 (2585600/281600), Serial1/0.2 +via 172.16.1.1 (3950848/281600), Serial1/0.1 +P 10.3.3.3/32, 1 successors, FD is 2713600 +via 172.16.2.2 (2713600/409600), Serial1/0.2 +via 172.16.1.1 (4053248/128256), Serial1/0.1 +P 10.1.1.1/32, 1 successors, FD is 409600 +via 192.168.0.11 (409600/128256), FastEthernet0/0 +P 10.4.4.4/32, 1 successors, FD is 2688000 + + + +From the Library of Outcast Outcast +882 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +via 172.16.2.2 (2688000/128256), Serial1/0.2 +via 172.16.1.1 (4078848/409600), Serial1/0.1 +P 192.168.0.0/24, 1 successors, FD is 281600 +via Connected, FastEthernet0/0 +P 192.168.1.0/24, 1 successors, FD is 284160 +via 192.168.0.11 (284160/28160), FastEthernet0/0 +P 172.16.1.0/30, 1 successors, FD is 3925248 +via Connected, Serial1/0.1 +P 172.16.2.0/30, 1 successors, FD is 2560000 +via Connected, Serial1/0.2 + +Finally, you examine the EIGRP configuration on router R1, as presented in Example 21-18. + +Example 21-18 EIGRP Configuration on Router R2 + +R2#show run | begin router +router eigrp 1 +network 10.2.2.2 0.0.0.0 +network 172.16.1.0 0.0.0.3 +network 172.16.2.0 0.0.0.3 +network 192.168.0.0 +auto-summary + +Take a moment to look through the show command output and the topology. Then, hypothesize the underlying cause, explaining why router R2’s IP routing table only shows one route to network 10.1.2.0/24, even though the EIGRP topology table knows of two routes to that network. Finally, on a separate sheet of paper, write out a proposed action plan for resolving the reported issue. + +Suggested Solution + +Upon examination of router R2’s EIGRP topology table (as previously shown in Example 21-17), it becomes clear that the reason router R2 is only injecting one of the 10.1.2.0/24 routes into the IP routing table is that the feasible distances of the two routes are differ-ent. By default, EIGRP load balances over routes with equal metrics (that is, equal feasible distances); however, the two routes present in the EIGRP topology table have different metrics. + +Examine the two metrics (that is, 2585600 and 3950848), and notice that the metrics dif-fer by less than a factor of 2. Specifically, if you took the smallest metric of 2585600 and multiplied it by 2, the result would be 5171200, which is greater than the largest metric of 3950848. + +Because the metrics for the two routes vary by less than a factor of 2, EIGRP’s vari-ance feature could be configured to specify a variance of 2, as shown in Example 21-19. +Specifically, this configuration tells EIGRP on router R2 to not only inject the best EIGRP route into the IP routing table, but rather inject the route with the best metric in addition + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 883 + +to any route whose metric is within a factor of two of the best metric (that is, in the range 2585600 to 5171200). This allows the route with a metric of 3950848 to also be injected into the IP routing table. + +Example 21-19 Enabling the Variance Feature on Router R2 + +R2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#router eigrp 1 +R2(config-router)#variance 2 + +To confirm that router R2 can now load balance across routers BB1 and BB2 to reach the 10.1.2.0/24 network, examine the output of the show ip route command shown in Example 21-20. This output confirms that router R2 can now load balance over two unequal-cost paths to reach the 10.1.2.0/24 network. + +Example 21-20 Examining Router R2’s IP Routing Table After Enabling the Variance Feature + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 +D 10.1.3.0/30 [90/3072000] via 172.16.2.2, 00:00:03, Serial1/0.2 +[90/4437248] via 172.16.1.1, 00:00:03, Serial1/0.1 +D 10.3.3.3/32 [90/2713600] via 172.16.2.2, 00:00:03, Serial1/0.2 +[90/4053248] via 172.16.1.1, 00:00:03, Serial1/0.1 +D 10.1.2.0/24 [90/2585600] via 172.16.2.2, 00:00:03, Serial1/0.2 +[90/3950848] via 172.16.1.1, 00:00:03, Serial1/0.1 +D 10.1.1.1/32 [90/409600] via 192.168.0.11, 00:00:03, FastEthernet0/0 +D 10.4.4.4/32 [90/2688000] via 172.16.2.2, 00:00:03, Serial1/0.2 +[90/4078848] via 172.16.1.1, 00:00:03, Serial1/0.1 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +D 192.168.1.0/24 [90/284160] via 192.168.0.11, 00:00:04, FastEthernet0/0 + + + + + +From the Library of Outcast Outcast +884 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide +R +R +1 +.1 + +Trouble Ticket 4 + +You receive the following trouble ticket: + +For vendor interoperability reasons, a company changed its routing protocol from EIGRP to OSPF. The network was divided into areas, and all interfaces were instructed to partici-pate in OSPF. The configuration was initially working. However, now none of the routers have full reachability to all the subnets. + +This trouble ticket references the topology shown in Figure 21-4. + +Area 2 Area 1 Area 0 + + + + + + + + +Lo 0 10.1.1.1/32 +192.168.1.0/24 + + + + + +Lo 0 10.2.2.2/32 + +Lo 0 Fa 0/0 +10.3.3.3/32 .1 +S 1/0.2 .1 +DLCI = 811 BB1 +172.16.1.0/30 S 1/0.1 S 1/0.1 .1 +.2 DLCI = 881 DLCI = 181 +10.1.3.0/30 +10.1.2.0/24 + + + +Fa 0/0 RFa 0/1 Fa 0/0 22 S 1/0.2 FRSW .11 .22 DLCI = 182 + +Gig 0/8 192.168.0.0/24 Fa 5/46 172.16.2.0/30 S 1/0.2 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 .2 +Fa 0/0 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +Figure 21-4 Trouble Ticket 4 Topology + +As you investigate this issue, you examine baseline data collected after Open Shortest Path First (OSPF) was initially configured. Example 21-21 shows baseline data collected from router R1, when the network was fully operational. Notice that router R1 is config-ured with a virtual link because it does not physically touch area 0. + +Example 21-21 Baseline Configuration Data from Router R1 + +R1#show run | begin router +router ospf 1 +area 1 virtual-link 10.2.2.2 +network 10.1.1.1 0.0.0.0 area 1 +network 192.168.0.0 0.0.0.255 area 1 +network 192.168.1.0 0.0.0.255 area 2 + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 885 + +R1#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface + +10.2.2.2 +10.2.2.2 + +0 FULL/- +1 FULL/DR + +- +00:00:38 + +192.168.0.22 +192.168.0.22 + +OSPF_VL2 +FastEthernet0/1 + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/134] via 192.168.0.22, 01:34:44, FastEthernet0/1 +O 172.16.2.0 [110/81] via 192.168.0.22, 01:34:44, FastEthernet0/1 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O 10.2.2.2/32 [110/2] via 192.168.0.22, 02:24:31, FastEthernet0/1 +O 10.1.3.0/30 [110/145] via 192.168.0.22, 01:34:44, FastEthernet0/1 +O 10.3.3.3/32 [110/92] via 192.168.0.22, 01:34:44, FastEthernet0/1 +O 10.1.2.0/24 [110/91] via 192.168.0.22, 01:34:45, FastEthernet0/1 +C 10.1.1.1/32 is directly connected, Loopback0 +O 10.4.4.4/32 [110/82] via 192.168.0.22, 01:34:45, FastEthernet0/1 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 +R1#show ip ospf +Routing Process "ospf 1" with ID 10.1.1.1 +Supports only single TOS(TOS0) routes +Supports opaque LSA +Supports Link-local Signaling (LLS) +Supports area transit capability It is an area border router +Initial SPF schedule delay 5000 msecs +Minimum hold time between two consecutive SPFs 10000 msecs +Maximum wait time between two consecutive SPFs 10000 msecs +Incremental-SPF disabled +Minimum LSA interval 5 secs + +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +Interface flood pacing timer 33 msecs +Retransmission pacing timer 66 msecs +Number of external LSA 0. Checksum Sum 0x000000 +Number of opaque AS LSA 0. Checksum Sum 0x000000 + + + +From the Library of Outcast Outcast +886 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Number of DCbitless external and opaque AS LSA 0 +Number of DoNotAge external and opaque AS LSA 0 +Number of areas in this router is 3. 3 normal 0 stub 0 nssa +Number of areas transit capable is 1 +External flood list length 0 +Area BACKBONE(0) +Number of interfaces in this area is 1 +Area has no authentication +SPF algorithm last executed 01:35:17.308 ago +SPF algorithm executed 9 times +Area ranges are +Number of LSA 12. Checksum Sum 0x063B08 +Number of opaque link LSA 0. Checksum Sum 0x000000 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 7 +Flood list length 0 +Area 1 +Number of interfaces in this area is 2 (1 loopback) +This area has transit capability: Virtual Link Endpoint +Area has no authentication +SPF algorithm last executed 02:25:04.377 ago +SPF algorithm executed 22 times +Area ranges are +Number of LSA 10. Checksum Sum 0x059726 +Number of opaque link LSA 0. Checksum Sum 0x000000 +Number of DCbitless LSA 0 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 +Area 2 +Number of interfaces in this area is 1 +Number of indication LSA 0 +Number of DoNotAge LSA 0 +Flood list length 0 +Area has no authentication +SPF algorithm last executed 02:25:15.880 ago +SPF algorithm executed 9 times +Area ranges are +Number of LSA 10. Checksum Sum 0x05F97B +Number of opaque link LSA 0. Checksum Sum 0x000000 +Number of DCbitless LSA 0 +R1#show ip ospf interface fa0/1 +FastEthernet0/1 is up, line protocol is up +Internet Address 192.168.0.11/24, Area 1 +Process ID 1, Router ID 10.1.1.1, Network Type BROADCAST, Cost: 1 + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 887 + +Transmit Delay is 1 sec, State BDR, Priority 1 +Designated Router (ID) 10.2.2.2, Interface address 192.168.0.22 +Backup Designated router (ID) 10.1.1.1, Interface address 192.168.0.11 +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:00 +Supports Link-local Signaling (LLS) +Index 2/2, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 1 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 10.2.2.2 (Designated Router) +Suppress hello for 0 neighbor(s) + +Example 21-22 shows baseline configuration data collected from router R2. + +Example 21-22 Baseline Configuration Data from Router R2 + +R2#show run | begin router +router ospf 1 +area 1 virtual-link 10.1.1.1 +network 10.2.2.2 0.0.0.0 area 1 +network 172.16.1.0 0.0.0.3 area 0 +network 172.16.2.0 0.0.0.3 area 0 +network 192.168.0.0 0.0.0.255 area 1 + +R2#show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface + +10.4.4.4 +10.3.3.3 +10.1.1.1 +10.1.1.1 + +0 FULL/- +0 FULL/- +0 FULL/- +1 FULL/BDR + +00:00:34 +00:00:37 +- +00:00:39 + +172.16.2.2 +172.16.1.1 +192.168.0.11 +192.168.0.11 + +Serial1/0.2 +Serial1/0.1 +OSPF_VL0 +FastEthernet0/0 + + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 + + + +From the Library of Outcast Outcast +888 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 +O 10.1.3.0/30 [110/144] via 172.16.2.2, 01:34:50, Serial1/0.2 +O 10.3.3.3/32 [110/91] via 172.16.2.2, 01:34:50, Serial1/0.2 +O 10.1.2.0/24 [110/90] via 172.16.2.2, 01:34:50, Serial1/0.2 +O 10.1.1.1/32 [110/11] via 192.168.0.11, 02:24:36, FastEthernet0/0 +O 10.4.4.4/32 [110/81] via 172.16.2.2, 01:34:50, Serial1/0.2 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +O IA 192.168.1.0/24 [110/11] via 192.168.0.11, 01:34:50, FastEthernet0/0 + +Example 21-23 shows baseline configuration data collected from router BB1. + +Example 21-23 Baseline Configuration Data from Router BB1 + +BB1#show run | begin router +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + +BB1#show ip ospf neighbor + + +Neighbor ID +10.4.4.4 +10.2.2.2 +10.4.4.4 + +Pri State +1 FULL/DR +0 FULL/- +0 FULL/- + +Dead Time +00:00:38 +00:00:39 +00:00:38 + +Address +10.1.2.2 +172.16.1.2 +10.1.3.2 + +Interface +FastEthernet0/0 +Serial1/0.2 +Serial1/0.1 + +BB1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.2 +O 172.16.2.0 [110/90] via 10.1.2.2, 01:35:01, FastEthernet0/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O IA 10.2.2.2/32 [110/91] via 10.1.2.2, 01:35:01, FastEthernet0/0 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +C 10.3.3.3/32 is directly connected, Loopback0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O IA 10.1.1.1/32 [110/101] via 10.1.2.2, 01:35:01, FastEthernet0/0 +O 10.4.4.4/32 [110/11] via 10.1.2.2, 01:35:01, FastEthernet0/0 +O IA 192.168.0.0/24 [110/100] via 10.1.2.2, 01:35:01, FastEthernet0/0 +O IA 192.168.1.0/24 [110/101] via 10.1.2.2, 01:35:01, FastEthernet0/0 + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 889 + +Example 21-24 shows baseline configuration data collected from router BB2. + +Example 21-24 Baseline Configuration Data from Router BB2 + +BB2#show run | begin router +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + +BB2#show ip ospf neighbor + +Neighbor ID +10.2.2.2 +10.3.3.3 + +Pri State +0 FULL/ - +0 FULL/ - + +Dead Time +00:00:32 +00:00:39 + +Address +172.16.2.1 +10.1.3.1 + +Interface +Serial1/0.2 +Serial1/0.1 + +10.3.3.3 1 FULL/BDR 00:00:35 10.1.2.1 FastEthernet0/0 +BB2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O IA 192.168.1.0/24 [110/101] via 10.1.2.2, 01:35:01, FastEthernet0/0 +O 172.16.1.0 [110/143] via 10.1.2.1, 01:35:06, FastEthernet0/0 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O IA 10.2.2.2/32 [110/81] via 172.16.2.1, 01:35:06, Serial1/0.2 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +O 10.3.3.3/32 [110/11] via 10.1.2.1, 01:35:06, FastEthernet0/0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O IA 10.1.1.1/32 [110/91] via 172.16.2.1, 01:35:06, Serial1/0.2 +C 10.4.4.4/32 is directly connected, Loopback0 +O IA 192.168.0.0/24 [110/90] via 172.16.2.1, 01:35:06, Serial1/0.2 +O IA 192.168.1.0/24 [110/91] via 172.16.2.1, 01:35:06, Serial1/0.2 + +Now that you have seen the baseline data, the following examples present you with data collected after the trouble ticket was issued. Example 21-25 shows information collected from router R1. Notice that router R1’s routing table can no longer see the Loopback 0 IP address of router BB2 (that is, 10.4.4.4/32). Also, notice that the virtual link between area 2 and area 0 is down. + + + + + + + +From the Library of Outcast Outcast +890 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 21-25 Information Gathered from Router R1 After the Trouble Ticket Was Issued + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O IA 172.16.1.0 [110/134] via 192.168.0.22, 00:00:31, FastEthernet0/1 +O IA 172.16.2.0 [110/81] via 192.168.0.22, 00:00:31, FastEthernet0/1 +10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks +O 10.2.2.2/32 [110/2] via 192.168.0.22, 00:00:51, FastEthernet0/1 +O IA 10.1.3.0/30 [110/198] via 192.168.0.22, 00:00:31, FastEthernet0/1 +O IA 10.3.3.3/32 [110/135] via 192.168.0.22, 00:00:31, FastEthernet0/1 +O IA 10.1.2.0/24 [110/144] via 192.168.0.22, 00:00:32, FastEthernet0/1 +C 10.1.1.1/32 is directly connected, Loopback0 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 +R1#show run | begin router +router ospf 1 +log-adjacency-changes +area 2 virtual-link 10.2.2.2 +network 10.1.1.1 0.0.0.0 area 1 +network 192.168.0.0 0.0.0.255 area 1 +network 192.168.1.0 0.0.0.255 area 2 +R1#show ip ospf virtual-links +Virtual Link OSPF_VL4 to router 10.2.2.2 is down +Run as demand circuit +DoNotAge LSA allowed. +Transit area 2, Cost of using 65535 +Transmit Delay is 1 sec, State DOWN, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 + +Example 21-26 shows the IP routing table on router R2 after the trouble ticket was issued. Notice that the routing table of router R2 can no longer see the Loopback 0 IP address of router BB2 (that is, 10.4.4.4/32). Also, notice that network 192.168.1.0/24, con-nected to router R1’s Fast Ethernet 0/0 interface, is not present in router R2’s IP routing table. + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 891 + +Example 21-26 Router R2’s IP Routing Table After the Trouble Ticket Was Issued + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 +O 10.1.3.0/30 [110/197] via 172.16.1.1, 00:00:53, Serial1/0.1 +O 10.3.3.3/32 [110/134] via 172.16.1.1, 00:00:53, Serial1/0.1 +O 10.1.2.0/24 [110/143] via 172.16.1.1, 00:00:53, Serial1/0.1 +O 10.1.1.1/32 [110/11] via 192.168.0.11, 00:00:53, FastEthernet0/0 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 + +Before moving forward to investigate the remainder of the network, do you already see an issue that needs to be resolved? The fact that router R2 cannot see network 192.168.1.0/24 off of router R1 is independent of any configuration on routers BB1 or BB2. So, take a few moments to review the information collected thus far, and hypoth-esize the issue that is preventing router R2 from seeing network 192.168.1.0/24. On a separate sheet of paper, write your solution to the issue you identified. + +Issue 1: Suggested Solution + +The virtual link configuration on router R1 was incorrect. Specifically, the transit area in the area number virtual-link router_id command was configured as area 2. However, the transit area should have been area 1. Example 21-27 shows the commands used to correct this misconfiguration. + +Example 21-27 Correcting the Virtual Link Configuration of R1 + +R1#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)#router ospf 1 +R1(config-router)#no area 2 virtual-link 10.2.2.2 +R1(config-router)#area 1 virtual-link 10.2.2.2 + +After you correct the virtual link configuration on router R1, network 192.168.1.0/24 is present in router R2’s IP routing table, as illustrated in Example 21-28. Notice, however, + + +From the Library of Outcast Outcast +892 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +that the Loopback 0 IP address of router BB2 (that is, 10.4.4.4/32) is still not visible in router R2’s IP routing table. + +Example 21-28 Router R2’s IP Routing Table After Correcting the Virtual Link Configuration + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route +Gateway of last resort is not set +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 +O 10.1.3.0/30 [110/197] via 172.16.1.1, 00:00:18, Serial1/0.1 +O 10.3.3.3/32 [110/134] via 172.16.1.1, 00:00:18, Serial1/0.1 +O 10.1.2.0/24 [110/143] via 172.16.1.1, 00:00:18, Serial1/0.1 +O 10.1.1.1/32 [110/11] via 192.168.0.11, 00:00:18, FastEthernet0/0 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +O IA 192.168.1.0/24 [110/11] via 192.168.0.11, 00:00:18, FastEthernet0/0 + +With one issue now resolved, continue to collect information on router R2. Example 21-29 indicates that router R2 has not formed an adjacency with router BB2, which has an OSPF router ID of 10.4.4.4. + +Example 21-29 OSPF Neighbors of Router R2 + +R2#show ip ospf neighbor +Neighbor ID Pri State Dead Time Address Interface + +10.3.3.3 +10.1.1.1 +10.1.1.1 + +0 FULL/- +0 FULL/- +1 FULL/DR + +00:00:37 +- +00:00:39 + +172.16.1.1 +192.168.0.11 +192.168.0.11 + +Serial1/0.1 +OSPF_VL1 +FastEthernet0/0 + +R2#show run | begin router +router ospf 2 +log-adjacency-changes +area 1 virtual-link 10.1.1.1 +network 10.2.2.2 0.0.0.0 area 1 +network 172.16.1.0 0.0.0.3 area 0 +network 172.16.2.0 0.0.0.3 area 0 +network 192.168.0.0 0.0.0.255 area 1 + +Even though router R2 has not formed an adjacency with router BB2, Example 21-30 shows the output of a ping command, verifying that router R2 can reach router BB2. + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 893 + +Example 21-30 Pinging Router BB2 from Router R2 + +R2#ping 172.16.2.2 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 172.16.2.2, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 52/92/144 ms + +The topology diagram indicates that router R2 connects with router BB2 via subinterface Serial 1/0.2. Therefore, the show interface s1/0.2 command is issued on router R2. The output provided in Example 21-31 states that the subinterface is up and functional. + +Example 21-31 Serial 1/0.2 Subinterface of Router R2 + +R2#show interface s1/0.2 +Serial1/0.2 is up, line protocol is up +Hardware is M4T +Internet address is 172.16.2.1/30 +MTU 1500 bytes, BW 1250 Kbit, DLY 20000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation FRAME-RELAY +Last clearing of "show interface" counters never + +Example 21-32 confirms that router BB2 is adjacent at Layer 2 with router R2. + +Example 21-32 CDP Neighbors of Router R2 + +R2#show cdp neighbor +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater +Device ID Local Intrfce Holdtime Capability Platform Port ID + +BB1 Ser 1/0.1 152 R S I +BB2 Ser 1/0.2 143 R S I +R1 Fas 0/0 144 R S I + +2691 Ser 1/0.2 +2691 Ser 1/0.2 +2611XM Fas 0/1 + + +The output of Example 21-33 shows the OSPF status of router R2’s Serial 1/0.2 subinter-face. + +Example 21-33 OSPF Status of Router R2 on Subinterface Serial 1/0.2 + +R2#show ip ospf interface s1/0.2 +Serial1/0.2 is up, line protocol is up +Internet Address 172.16.2.1/30, Area 0 +Process ID 1, Router ID 10.2.2.2, Network Type POINT_TO_POINT, Cost: 64 +Transmit Delay is 1 sec, State POINT_TO_POINT, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:09 +Supports Link-local Signaling (LLS) + + + + +From the Library of Outcast Outcast +894 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Index 3/4, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 4 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) + +Now that data has been collected for router R2, the troubleshooting focus moves to router BB1 in Example 21-34. Notice that BB1 also lacks a route to router BB2’s Loopback 0 IP address of 10.4.4.4/32. Also, even though router BB1 has two direct connections to router BB2, router BB1 has not formed an OSPF adjacency with router BB2. Notice that router BB2 is router BB1’s Cisco Discovery Protocol (CDP) neighbor, both on interface Fast Ethernet 0/0 and on subinterface Serial 1/0.1. + +Example 21-34 Data Collected from Router BB1 After the Trouble Ticket + +BB1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route +Gateway of last resort is not set +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.2 +O 172.16.2.0 [110/213] via 172.16.1.2, 00:01:02, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks +O IA 10.2.2.2/32 [110/134] via 172.16.1.2, 00:01:02, Serial1/0.2 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +C 10.3.3.3/32 is directly connected, Loopback0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O IA 10.1.1.1/32 [110/144] via 172.16.1.2, 00:01:02, Serial1/0.2 +O IA 192.168.0.0/24 [110/143] via 172.16.1.2, 00:01:02, Serial1/0.2 +BB1#show ip ospf neighbor + + +Neighbor ID +10.2.2.2 + +Pri State +0 FULL/- + +Dead Time +00:00:30 + +Address +172.16.1.2 + +Interface +Serial1/0.2 + +BB1#show run | begin router +router ospf 1 +log-adjacency-changes +network 0.0.0.0 255.255.255.255 area 0 + +BB1#show cdp neigh +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 895 + + +Device ID +BB2 +BB2 +R2 + +Local Intrfce +Ser 1/0.1 +Fas 0/0 +Ser 1/0.2 + +Holdtime +148 +148 +130 + +Capability +R S I +R S I +R S I + +Platform +2691 +2691 +2691 + +Port ID +Ser 1/0.1 +Fas 0/0 +Ser 1/0.1 + +BB1#show run + +...OUTPUT OMITTED... +interface FastEthernet0/0 +ip address 10.1.2.1 255.255.255.0 +ip ospf network non-broadcast +duplex auto +speed auto +! +interface Serial1/0 +no ip address +encapsulation frame-relay +! +interface Serial1/0.1 point-to-point +ip address 10.1.3.1 255.255.255.252 +ip ospf hello-interval 60 +ip ospf dead-interval 200 +frame-relay interface-dlci 881 +! +interface Serial1/0.2 point-to-point +bandwidth 750 +ip address 172.16.1.1 255.255.255.252 +frame-relay interface-dlci 811 +...OUTPUT OMITTED... + +The data collection continues on router BB2. Example 21-35 provides output from several show commands. Notice that router BB2 has not learned networks via OSPF. + +Example 21-35 Data Collected from Router BB2 After the Trouble Ticket + +BB2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 1 subnets +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 3 subnets, 3 masks +C 10.1.3.0/30 is directly connected, Serial1/0.1 + + +From the Library of Outcast Outcast +896 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +C 10.4.4.4/32 is directly connected, Loopback0 + +BB2#show run | begin router +router ospf 1 +log-adjacency-changes +network 0.0.0.0 255.255.255.255 area 0 + +BB2#show ip ospf interface s1/0.1 +Serial1/0.1 is up, line protocol is up +Internet Address 10.1.3.2/30, Area 0 +Process ID 1, Router ID 10.4.4.4, Network Type POINT_TO_POINT, Cost: 64 +Transmit Delay is 1 sec, State POINT_TO_POINT, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +oob-resync timeout 40 +Hello due in 00:00:09 +Supports Link-local Signaling (LLS) +Index 2/2, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 3 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) + +BB2#show ip ospf interface s1/0.2 +Serial1/0.2 is up, line protocol is up +Internet Address 172.16.2.2/30, Area 0 +Process ID 1, Router ID 10.4.4.4, Network Type NON_BROADCAST, Cost: 80 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 10.4.4.4, Interface address 172.16.2.2 +No backup designated router on this network +Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 +oob-resync timeout 120 +Hello due in 00:00:09 +Supports Link-local Signaling (LLS) +Index 3/3, flood queue length 0 +Next 0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 1 +Last flood scan time is 0 msec, maximum is 4 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) +! +BB2#show run | begin interface +interface FastEthernet0/0 +ip address 10.1.2.2 255.255.255.0 +! + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 897 + +interface Serial1/0 +no ip address +encapsulation frame-relay +! +interface Serial1/0.1 point-to-point +ip address 10.1.3.2 255.255.255.252 +frame-relay interface-dlci 882 +! +interface Serial1/0.2 point-to-point +bandwidth 1250 +ip address 172.16.2.2 255.255.255.252 +ip ospf network non-broadcast +frame-relay interface-dlci 821 +! +...OUTPUT OMITTED... + +Based on the preceding show command output from routers R2, BB1, and BB2, hypoth-esize what you consider to be the issue or issues still impacting the network. Then, on a separate sheet of paper, write how you would solve the identified issue or issues. + +Issue 2: Suggested Solution + +Subinterface Serial 1/0.1 on router BB1 had non-default hello and dead timers, which did not match the timers at the far end of the Frame Relay link. Example 21-36 illustrates how these nondefault values were reset. + +Example 21-36 Correcting the Nondefault Timer Configuration of Router BB1 + +BB1#conf term +Enter configuration commands, one per line. End with CNTL/Z. +BB1(config)#int s1/0.1 +BB1(config-subif)#no ip ospf hello-interval 60 +BB1(config-subif)#no ip ospf dead-interval 200 + + +Issue 3: Suggested Solution + +Interface Fast Ethernet 0/0 on router BB1 was configured with an incorrect OSPF net-work type of nonbroadcast. Example 21-37 demonstrates how this OSPF interface was reset to its default OSPF network type (that is, the broadcast OSPF network type). + +Example 21-37 Correcting the Incorrect OSPF Network Type Configuration of Router BB1 + +BB1#conf term +Enter configuration commands, one per line. End with CNTL/Z. +BB1(config)#int fa 0/0 +BB1(config-if)#no ip ospf network non-broadcast + + + +From the Library of Outcast Outcast +898 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Issue 4: Suggested Solution + +Similar to the incorrect OSPF network type on router BB1’s Fast Ethernet 0/0 interface, the Serial 1/0.2 subinterface on router BB2 was configured incorrectly. A point-to-point Frame Relay subinterface defaults to an OSPF network type of point-to-point; however, Serial 1/0.2 had been configured as an OSPF network type of nonbroadcast. Example 21-38 reviews how this nondefault OSPF network type configuration was removed. + +Example 21-38 Correcting Router BB2’s Incorrect OSPF Network Type Configuration + +BB2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +BB2(config)#int s1/0.2 +BB2(config-subif)#no ip ospf network non-broadcast + +After all the previous misconfigurations are corrected, all routers in the topology once again have full reachability throughout the network. Examples 21-39, 21-40, 21-41, and 21-42 show output from the show ip route and show ip ospf neighbor commands issued on all routers, confirming the full reachability of each router. + +Example 21-39 Confirming the Full Reachability of Router R1 + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/134] via 192.168.0.22, 00:00:03, FastEthernet0/1 +O 172.16.2.0 [110/81] via 192.168.0.22, 00:00:03, FastEthernet0/1 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O 10.2.2.2/32 [110/2] via 192.168.0.22, 00:08:18, FastEthernet0/1 +O 10.1.3.0/30 [110/145] via 192.168.0.22, 00:00:03, FastEthernet0/1 +O 10.3.3.3/32 [110/92] via 192.168.0.22, 00:00:03, FastEthernet0/1 +O 10.1.2.0/24 [110/91] via 192.168.0.22, 00:00:04, FastEthernet0/1 +C 10.1.1.1/32 is directly connected, Loopback0 +O 10.4.4.4/32 [110/82] via 192.168.0.22, 00:00:04, FastEthernet0/1 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 + +R1#show ip ospf neighbor + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 899 + + +Neighbor ID +10.2.2.2 +10.2.2.2 + +Pri State +0 FULL/- +1 FULL/BDR + +Dead Time +- +00:00:34 + +Address +192.168.0.22 +192.168.0.22 + +Interface +OSPF_VL5 +FastEthernet0/1 + + + +Example 21-40 Confirming the Full Reachability of Router R2 + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 +O 10.1.3.0/30 [110/144] via 172.16.2.2, 00:00:15, Serial1/0.2 +O 10.3.3.3/32 [110/91] via 172.16.2.2, 00:00:15, Serial1/0.2 +O 10.1.2.0/24 [110/90] via 172.16.2.2, 00:00:15, Serial1/0.2 +O 10.1.1.1/32 [110/11] via 192.168.0.11, 00:08:29, FastEthernet0/0 +O 10.4.4.4/32 [110/81] via 172.16.2.2, 00:00:15, Serial1/0.2 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +O IA 192.168.1.0/24 [110/11] via 192.168.0.11, 00:00:15, FastEthernet0/0 + +R2#show ip ospf neighbor + + +Neighbor ID Pri +10.4.4.4 0 +10.3.3.3 0 +10.1.1.1 0 +10.1.1.1 1 + +State +FULL/ - +FULL/ - +FULL/ - +FULL/DR + +Dead Time +00:00:33 +00:00:38 +- +00:00:30 + +Address +172.16.2.2 +172.16.1.1 +192.168.0.11 +192.168.0.11 + +Interface +Serial1/0.2 +Serial1/0.1 +OSPF_VL1 +FastEthernet0/0 + + + +Example 21-41 Confirming the Full Reachability of Router BB1 + +BB1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + + +From the Library of Outcast Outcast +900 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.2 +O 172.16.2.0 [110/90] via 10.1.2.2, 00:00:29, FastEthernet0/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O IA 10.2.2.2/32 [110/91] via 10.1.2.2, 00:00:29, FastEthernet0/0 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +C 10.3.3.3/32 is directly connected, Loopback0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O IA 10.1.1.1/32 [110/101] via 10.1.2.2, 00:00:29, FastEthernet0/0 +O 10.4.4.4/32 [110/11] via 10.1.2.2, 00:00:29, FastEthernet0/0 +O IA 192.168.0.0/24 [110/100] via 10.1.2.2, 00:00:29, FastEthernet0/0 +O IA 192.168.1.0/24 [110/101] via 10.1.2.2, 00:00:29, FastEthernet0/0 +BB1#show ip ospf neighbor + + +Neighbor ID +10.4.4.4 + +Pri State +1 FULL/DR + +Dead Time +00:00:34 + +Address +10.1.2.2 + +Interface +FastEthernet0/ + + + +10.2.2.2 +10.4.4.4 + +0 FULL/ - +0 FULL/ - + +00:00:39 +00:00:33 + +172.16.1.2 +10.1.3.2 + +Serial1/0.2 +Serial1/0.1 + + + +Example 21-42 Confirming the Full Reachability of Router BB2 + +BB2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/143] via 10.1.2.1, 00:00:42, FastEthernet0/0 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O IA 10.2.2.2/32 [110/81] via 172.16.2.1, 00:00:42, Serial1/0.2 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +O 10.3.3.3/32 [110/11] via 10.1.2.1, 00:00:42, FastEthernet0/0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O IA 10.1.1.1/32 [110/91] via 172.16.2.1, 00:00:42, Serial1/0.2 +C 10.4.4.4/32 is directly connected, Loopback0 +O IA 192.168.0.0/24 [110/90] via 172.16.2.1, 00:00:42, Serial1/0.2 +O IA 192.168.1.0/24 [110/91] via 172.16.2.1, 00:00:42, Serial1/0.2 + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 901 +R2 +1 +.1 +.22 + +BB2#show ip ospf neighbor + + +Neighbor ID +10.2.2.2 +10.3.3.3 + +Pri State +0 FULL/ - +0 FULL/ - + +Dead Time +00:00:38 +00:00:29 + +Address +172.16.2.1 +10.1.3.1 + +Interface +Serial1/0.2 +Serial1/0.1 + +10.3.3.3 1 FULL/BDR 00:00:34 10.1.2.1 FastEthernet0/0 + + +Trouble Ticket 5 + +You receive the following trouble ticket: + +Company A has acquired company B. Company A’s network (that is, routers R1 and R2) uses EIGRP, whereas Company B’s network (that is, routers BB1 and BB2) uses OSPF. Router R2 was configured as a boundary router, and router R2’s configuration specifies that EIGRP and OSPF are mutually redistributed. The configuration was originally func-tional. However, routers R1, BB1, and BB2 do not currently see all the subnets present in the network. + +This trouble ticket references the topology shown in Figure 21-5. + +EIGRP AS 100 OSPF Area 0 +Lo 0 + + + + + + + + +Lo 0 10.1.1.1/32 +192.168.1.0/24 + + + + + +Lo 0 10.2.2.2/32 + +10.3.3.3/32 Fa 0/0 +S 1/0.2 .1 .1 +DLCI = 811 BB1 +172.16.1.0/30 S 1/0.1 +S 1/0.1 .1 +.2 DLCI = 881 DLCI = 181 +10.1.3.0/30 +10.1.2.0/24 + + + +Fa 0/0 RFa 0/1 Fa 0/0 R2 S 1/0.2 FRSW .11 DLCI = 182 +Gig 0/8 192.168.0.0/24 Fa 5/46 172.16.2.0/30 S 1/0.2 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +.2 +BB2 Fa 0/0 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +Figure 21-5 Trouble Ticket 5: Topology + + + + + +From the Library of Outcast Outcast +902 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +You begin your troubleshooting efforts by analyzing baseline information collected when the configuration was working properly. Examples 21-43, 21-44, 21-45, and 21-46 pro-vide output from the show ip route command on each router. + +Example 21-43 Baseline Output for Router R1 + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +D EX 172.16.1.0 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +D EX 172.16.2.0 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +D 10.2.2.2/32 [90/156160] via 192.168.0.22, 00:04:39, FastEthernet0/1 +D EX 10.1.3.0/30 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +D EX 10.3.3.3/32 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +D EX 10.1.2.0/24 [170/1734656] via 192.168.0.22, 00:04:40, FastEthernet0/1 +C 10.1.1.1/32 is directly connected, Loopback0 +D EX 10.4.4.4/32 [170/1734656] via 192.168.0.22, 00:04:40, FastEthernet0/1 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 + + +Example 21-44 Baseline Output for Router R2 + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP , EX - EIGRP external, O - OSPF , IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 903 + +C 10.2.2.2/32 is directly connected, Loopback0 +O 10.1.3.0/30 [110/144] via 172.16.2.2, 00:07:12, Serial1/0.2 +O 10.3.3.3/32 [110/91] via 172.16.2.2, 00:07:12, Serial1/0.2 +O 10.1.2.0/24 [110/90] via 172.16.2.2, 00:07:12, Serial1/0.2 +D 10.1.1.1/32 [90/409600] via 192.168.0.11, 00:04:46, FastEthernet0/0 +O 10.4.4.4/32 [110/81] via 172.16.2.2, 00:07:12, Serial1/0.2 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +D 192.168.1.0/24 [90/284160] via 192.168.0.11, 00:04:46, FastEthernet0/0 + + +Example 21-45 Baseline Output for Router BB1 + +BB1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.2 +O 172.16.2.0 [110/90] via 10.1.2.2, 00:07:08, FastEthernet0/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O E2 10.2.2.2/32 [110/64] via 10.1.2.2, 00:07:08, FastEthernet0/0 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +C 10.3.3.3/32 is directly connected, Loopback0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O E2 10.1.1.1/32 [110/64] via 10.1.2.2, 00:04:49, FastEthernet0/0 +O 10.4.4.4/32 [110/11] via 10.1.2.2, 00:07:08, FastEthernet0/0 +O E2 192.168.0.0/24 [110/64] via 10.1.2.2, 00:07:08, FastEthernet0/0 +O E2 192.168.1.0/24 [110/64] via 10.1.2.2, 00:04:49, FastEthernet0/0 + + +Example 21-46 Baseline Output for Router BB2 + +BB2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + + + +From the Library of Outcast Outcast +904 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/143] via 10.1.2.1, 00:08:48, FastEthernet0/0 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O E2 10.2.2.2/32 [110/64] via 172.16.2.1, 00:08:48, Serial1/0.2 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +O 10.3.3.3/32 [110/11] via 10.1.2.1, 00:08:48, FastEthernet0/0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O E2 10.1.1.1/32 [110/64] via 172.16.2.1, 00:06:30, Serial1/0.2 +C 10.4.4.4/32 is directly connected, Loopback0 +O E2 192.168.0.0/24 [110/64] via 172.16.2.1, 00:08:48, Serial1/0.2 +O E2 192.168.1.0/24 [110/64] via 172.16.2.1, 00:06:30, Serial1/0.2 + +Router R2, acting as a boundary router, had previously been configured for mutual route redistribution. Example 21-47 illustrates this route redistribution configuration. + +Example 21-47 Mutual Route Redistribution on Router R2 + +R2#show run begin router +router eigrp 100 +redistribute ospf 1 metric 1500 100 255 1 1500 +network 10.2.2.2 0.0.0.0 +network 192.168.0.0 +no auto-summary +! +router ospf 1 +redistribute eigrp 100 metric 64 subnets +network 172.16.1.0 0.0.0.3 area 0 +network 172.16.2.0 0.0.0.3 area 0 + +To begin the troubleshooting process, you issue the show ip route command on all rout-ers to determine exactly what routes are missing from the IP routing table of each router. + +Router R1’s IP routing table lacks all OSPF-learned routes, as shown in Example 21-48. + +Example 21-48 Router R1’s IP Routing Table + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +10.0.0.0/32 is subnetted, 2 subnets + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 905 + +D 10.2.2.2 [90/156160] via 192.168.0.22, 00:09:44, FastEthernet0/1 +C 10.1.1.1 is directly connected, Loopback0 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 + +Router R2, which is acting as the boundary router, is actively participating in both the EIGRP and OSPF routing processes. Therefore, all routes are visible in the IP routing table of router R2, as shown in Example 21-49. + +Example 21-49 IP Routing Table of Router R2 + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 +O 10.1.3.0/30 [110/144] via 172.16.2.2, 00:07:12, Serial1/0.2 +O 10.3.3.3/32 [110/91] via 172.16.2.2, 00:07:12, Serial1/0.2 +O 10.1.2.0/24 [110/90] via 172.16.2.2, 00:07:12, Serial1/0.2 +D 10.1.1.1/32 [90/409600] via 192.168.0.11, 00:04:46, FastEthernet0/0 +O 10.4.4.4/32 [110/81] via 172.16.2.2, 00:07:12, Serial1/0.2 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +D 192.168.1.0/24 [90/284160] via 192.168.0.11, 00:04:46, FastEthernet0/0 + +Router BB1, which is running OSPF, has some routes that originated in EIGRP. However, the 10.1.1.1/32 and the 10.2.2.2/32 networks, which are the IP addresses of the Loopback 0 interfaces on routers R1 and R2, are missing from the IP routing table of router BB1, as illustrated in Example 21-50. + +Example 21-50 IP Routing Table of Router BB1 + +BB1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 + + + +From the Library of Outcast Outcast +906 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.2 +O 172.16.2.0 [110/90] via 10.1.2.2, 00:13:00, FastEthernet0/0 +10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks +C 10.1.3.0/30 is directly connected, Serial1/0.1 +C 10.3.3.3/32 is directly connected, Loopback0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O 10.4.4.4/32 [110/11] via 10.1.2.2, 00:13:00, FastEthernet0/0 +O E2 192.168.0.0/24 [110/64] via 10.1.2.2, 00:01:14, FastEthernet0/0 +O E2 192.168.1.0/24 [110/64] via 10.1.2.2, 00:01:14, FastEthernet0/0 + +The IP routing table of router BB2, as depicted in Example 21-51, is similar to the IP rout-ing table of router BB1. + +Example 21-51 IP Routing Table of Router BB2 + +BB2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/143] via 10.1.2.1, 00:13:39, FastEthernet0/0 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks +C 10.1.3.0/30 is directly connected, Serial1/0.1 +O 10.3.3.3/32 [110/11] via 10.1.2.1, 00:13:39, FastEthernet0/0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +C 10.4.4.4/32 is directly connected, Loopback0 +O E2 192.168.0.0/24 [110/64] via 172.16.2.1, 00:01:53, Serial1/0.2 +O E2 192.168.1.0/24 [110/64] via 172.16.2.1, 00:01:53, Serial1/0.2 + +Because router R2 is acting as the boundary router, you examine its redistribution con-figuration, as shown in Example 21-52. + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 907 + +Example 21-52 Redistribution Configuration on Router R2 + +R2#show run | begin router +router eigrp 100 +redistribute ospf 1 +network 10.2.2.2 0.0.0.0 +network 192.168.0.0 +no auto-summary +! +router ospf 1 +log-adjacency-changes +redistribute eigrp 100 metric 64 +network 172.16.1.0 0.0.0.3 area 0 +network 172.16.2.0 0.0.0.3 area 0 + +Take a moment to look through the baseline configuration information, the topology, and the show command output collected after the issue was reported. Then hypothesize the underlying cause or causes of the reported issue, explaining why routers R1, BB1, and BB2 do not see all the networks in the topology, even though mutual redistribution does appear to be configured on router R2. + +Suggested Solution + +After examining the redistribution configuration on router R2, you might have noticed the following issues. + +The EIGRP routing process on router R2 lacked a default metric, which would be assigned to routes being redistributed into the EIGRP routing process. Example 21-53 shows the commands used to correct this misconfiguration. + +Example 21-53 Adding a Default Metric for Router R2’s EIGRP Routing Process + +R2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#router eigrp 100 +R2(config-router)#default-metric 1500 100 255 1 1500 +R2(config-router)#end + +The OSPF routing process lacked the subnets parameter at the end of the redistribute com-mand. The subnets parameter is required to allow classless networks (subnets) to be redis-tributed into OSPF. Example 21-54 illustrates how this configuration can be corrected. + +Example 21-54 Redistributing Subnets into Router R2’s OSPF Routing Process + +R2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#router ospf 1 +R2(config-router)#no redistribute eigrp 100 metric 64 +R2(config-router)#redistribute eigrp 100 metric 64 subnets +R2(config-router)#end + + +From the Library of Outcast Outcast +908 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +After making the suggested corrections, all routers in the topology have IP routing tables that contain all advertised networks. Examples 21-55, 21-56, 21-57, and 21-58 illustrate the IP routing tables of these routers. + +Example 21-55 IP Routing Table of Router R1 + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +D EX 172.16.1.0 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +D EX 172.16.2.0 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +D 10.2.2.2/32 [90/156160] via 192.168.0.22, 00:18:05, FastEthernet0/1 +D EX 10.1.3.0/30 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +D EX 10.3.3.3/32 [170/1734656] via 192.168.0.22, 00:04:39, FastEthernet0/1 +D EX 10.1.2.0/24 [170/1734656] via 192.168.0.22, 00:04:40, FastEthernet0/1 +C 10.1.1.1/32 is directly connected, Loopback0 +D EX 10.4.4.4/32 [170/1734656] via 192.168.0.22, 00:04:40, FastEthernet0/1 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 + + +Example 21-56 IP Routing Table of Router R2 + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 909 + +C 10.2.2.2/32 is directly connected, Loopback0 +O 10.1.3.0/30 [110/144] via 172.16.2.2, 00:21:04, Serial1/0.2 +O 10.3.3.3/32 [110/91] via 172.16.2.2, 00:21:04, Serial1/0.2 +O 10.1.2.0/24 [110/90] via 172.16.2.2, 00:21:04, Serial1/0.2 +D 10.1.1.1/32 [90/409600] via 192.168.0.11, 00:18:38, FastEthernet0/0 +O 10.4.4.4/32 [110/81] via 172.16.2.2, 00:21:04, Serial1/0.2 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +D 192.168.1.0/24 [90/284160] via 192.168.0.11, 00:18:38, FastEthernet0/0 + + +Example 21-57 IP Routing Table of Router BB1 + +BB1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.2 +O 172.16.2.0 [110/90] via 10.1.2.2, 00:21:08, FastEthernet0/0 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O E2 10.2.2.2/32 [110/64] via 10.1.2.2, 00:04:44, FastEthernet0/0 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +C 10.3.3.3/32 is directly connected, Loopback0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O E2 10.1.1.1/32 [110/64] via 10.1.2.2, 00:04:44, FastEthernet0/0 +O 10.4.4.4/32 [110/11] via 10.1.2.2, 00:21:08, FastEthernet0/0 +O E2 192.168.0.0/24 [110/64] via 10.1.2.2, 00:04:44, FastEthernet0/0 +O E2 192.168.1.0/24 [110/64] via 10.1.2.2, 00:04:44, FastEthernet0/0 + + +Example 21-58 IP Routing Table of Router BB2 + +BB2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + + + +From the Library of Outcast Outcast +910 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +172.16.0.0/30 is subnetted, 2 subnets +O 172.16.1.0 [110/143] via 10.1.2.1, 00:21:13, FastEthernet0/0 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +O E2 10.2.2.2/32 [110/64] via 172.16.2.1, 00:04:50, Serial1/0.2 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +O 10.3.3.3/32 [110/11] via 10.1.2.1, 00:21:13, FastEthernet0/0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +O E2 10.1.1.1/32 [110/64] via 172.16.2.1, 00:04:50, Serial1/0.2 +C 10.4.4.4/32 is directly connected, Loopback0 +O E2 192.168.0.0/24 [110/64] via 172.16.2.1, 00:04:50, Serial1/0.2 +O E2 192.168.1.0/24 [110/64] via 172.16.2.1, 00:04:50, Serial1/0.2 + +Trouble Ticket 6 +You receive the following trouble ticket: + +Company A (that is, routers R1 and R2) has connections to two service providers (that is, BB1 and BB2). Router R2 is running Border Gateway Protocol (BGP) and is peering with routers BB1 and BB2. The bandwidth between routers R2 and BB2 is greater than the bandwidth between routers R2 and BB1. Therefore, company A wants to use the R2-to-BB2 link as the primary link to the backbone network (that is, a default route). However, company A noticed that the R2-to-BB1 link is being used. + +This trouble ticket references the topology shown in Figure 21-6. + +AS 65002 + +Lo 0 10.3.3.3/32 + + + + + +Lo 0 10.1.1.1/32 +192.168.1.0/24 + +AS 65001 S 1/0.2 .1 +DLCI = 811 +10.2.2.2/32 S 1/0.1172.16.1.0/30 .2 +Lo 0 +64 kbps +DLCI = 181 + + +BB1 + +S 1/0.1 .1 +DLCI = 881 +10.1.3.0/30 +256 kbps + + + +Fa 0/0 R1 R2 S 1/0.2 FRSW +Fa 0/1 +Fa 0/0 +.1 +.11 .22 DLCI = 182 +Gig 0/8 192.168.0.0/24 Fa 5/46 172.16.2.0/30 S 1/0.2 +128 kbps +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +AS 65003 OSPF Area 0 +Figure 21-6 Trouble Ticket 6 Topology + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 911 + +You begin by examining the baseline data collected after company A was dual-homed to its two Internet service providers (ISPs). Example 21-59 shows the output from the show ip route command on router R1. Notice that router R1 has a default route in its IP routing table. This default route was learned via OSPF from router R2. + +Example 21-59 Baseline Output for Router R1 + +R1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 192.168.0.22 to network 0.0.0.0 + +10.0.0.0/32 is subnetted, 2 subnets +O 10.2.2.2 [110/2] via 192.168.0.22, 00:05:33, FastEthernet0/1 +C 10.1.1.1 is directly connected, Loopback0 +C 192.168.0.0/24 is directly connected, FastEthernet0/1 +C 192.168.1.0/24 is directly connected, FastEthernet0/0 +O*E2 0.0.0.0/0 [110/1] via 192.168.0.22, 00:05:33, FastEthernet0/1 + +Router R2 was configured for both OSPF and BGP, with the BGP-learned default route being injected into OSPF, and with OSPF-learned routes being redistributed into BGP. Example 21-60 shows the initial IP routing table for router R2. Notice that the next-hop router for the default route is 172.16.1.1 (that is, router BB1). + +Example 21-60 Baseline IP Routing Table on Router R2 + +R2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 172.16.1.1 to network 0.0.0.0 + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.1 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +C 10.2.2.2/32 is directly connected, Loopback0 + + + +From the Library of Outcast Outcast +912 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +B 10.1.3.0/30 [20/0] via 172.16.1.1, 00:01:40 +B 10.3.3.3/32 [20/0] via 172.16.1.1, 00:01:40 +B 10.1.2.0/24 [20/0] via 172.16.1.1, 00:01:40 +O 10.1.1.1/32 [110/11] via 192.168.0.11, 00:08:17, FastEthernet0/0 +B 10.4.4.4/32 [20/0] via 172.16.2.2, 00:01:40 +C 192.168.0.0/24 is directly connected, FastEthernet0/0 +O 192.168.1.0/24 [110/11] via 192.168.0.11, 00:08:17, FastEthernet0/0 +B* 0.0.0.0/0 [20/0] via 172.16.1.1, 00:01:40 + +Example 21-61 illustrates the initial OSPF and BGP configuration on router R2. + +Example 21-61 Initial Router Configuration on Router R2 + +R2#show run | begin router +router ospf 1 +log-adjacency-changes +network 10.2.2.2 0.0.0.0 area 0 +network 192.168.0.0 0.0.0.255 area 0 +default-information originate +! +router bgp 65001 +no synchronization +bgp log-neighbor-changes +network 172.16.1.0 mask 255.255.255.252 +network 172.16.2.0 mask 255.255.255.252 +redistribute ospf 1 +neighbor 172.16.1.1 remote-as 65002 +neighbor 172.16.2.2 remote-as 65003 +no auto-summary + +Example 21-62 shows the output of the show ip bgp summary command on router R2, which confirms that router R2 resides in BGP autonomous system 65001. The output also confirms BGP adjacencies have been formed with routers BB1 and BB2. + +Example 21-62 BGP Configuration Summary on Router R2 + +R2#show bgp ipv4 unicast summary +BGP router identifier 10.2.2.2, local AS number 65001 +BGP table version is 18, main routing table version 18 +11 network entries using 1287 bytes of memory +20 path entries using 1040 bytes of memory +8/5 BGP path/bestpath attribute entries using 992 bytes of memory +4 BGP AS-PATH entries using 96 bytes of memory +0 BGP route-map cache entries using 0 bytes of memory +0 BGP filter-list cache entries using 0 bytes of memory +BGP using 3415 total bytes of memory +BGP activity 38/27 prefixes, 75/55 paths, scan interval 60 secs + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 913 + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + +172.16.1.1 4 65002 102 97 +172.16.2.2 4 65003 100 97 + +18 0 0 00:02:47 7 +18 0 0 00:02:47 7 + + +Router BB1 is configured for BGP and is sourcing a default route advertisement. Example 21-63 shows the IP routing table of router BB1. + +Example 21-63 Initial IP Routing Table on Router BB1 + +BB1#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 0.0.0.0 to network 0.0.0.0 + +172.16.0.0/30 is subnetted, 2 subnets +C 172.16.1.0 is directly connected, Serial1/0.2 +B 172.16.2.0 [20/0] via 10.1.3.2, 00:03:01 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +B 10.2.2.2/32 [20/0] via 172.16.1.2, 00:01:59 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +C 10.3.3.3/32 is directly connected, Loopback0 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +B 10.1.1.1/32 [20/11] via 172.16.1.2, 00:01:59 +B 10.4.4.4/32 [20/0] via 10.1.3.2, 00:40:10 +B 192.168.0.0/24 [20/0] via 172.16.1.2, 00:01:59 +B 192.168.1.0/24 [20/11] via 172.16.1.2, 00:01:59 +S* 0.0.0.0/0 is directly connected, Null0 + +Router BB2’s IP routing table, as shown in Example 21-64, is similar to router BB1’s IP routing table. Notice that router BB2 is also sourcing a default route and is advertising it via BGP to router R2. Therefore, router R2 has two paths to reach a default route in its BGP table. + +Example 21-64 Initial IP Routing Table on Router BB2 + +BB2#show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + + +From the Library of Outcast Outcast +914 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Gateway of last resort is 0.0.0.0 to network 0.0.0.0 + +172.16.0.0/30 is subnetted, 2 subnets +B 172.16.1.0 [20/0] via 10.1.3.1, 00:03:11 +C 172.16.2.0 is directly connected, Serial1/0.2 +10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks +B 10.2.2.2/32 [20/0] via 172.16.2.1, 00:02:09 +C 10.1.3.0/30 is directly connected, Serial1/0.1 +B 10.3.3.3/32 [20/0] via 10.1.3.1, 00:40:10 +C 10.1.2.0/24 is directly connected, FastEthernet0/0 +B 10.1.1.1/32 [20/11] via 172.16.2.1, 00:02:09 +C 10.4.4.4/32 is directly connected, Loopback0 +B 192.168.0.0/24 [20/0] via 172.16.2.1, 00:02:09 +B 192.168.1.0/24 [20/11] via 172.16.2.1, 00:02:09 +S* 0.0.0.0/0 is directly connected, Null0 + +As shown earlier, in Example 21-60, router R2 preferred the 64-Kbps link to router BB1 to reach a default route, as opposed to the 128-Kbps link to router BB2. Therefore, the out-bound routing from router R2 is suboptimal. + +Also, the inbound routing, coming into the enterprise via router R2, is suboptimal. To illustrate this point, consider Example 21-65, which shows the BGP table on router BB1. Notice that router BB1 prefers a next-hop router of router R2 to reach the 10.1.1.1/32 network, which resides inside the enterprise network (that is, the network consisting of routers R1 and R2). Using a next-hop router of R2 would force traffic over the 64-Kbps link rather than sending traffic from router BB1 over the 256-Kbps link to router BB2, and then over the 128-Kbps link to router R2, and finally across the Fast Ethernet connection to router R1. + +Example 21-65 BGP Forwarding Table on Router BB1 + +BB1#show bgp ipv4 unicast +BGP table version is 130, local router ID is 10.3.3.3 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +* 0.0.0.0 10.1.3.2 0 0 65003 i +*> 0.0.0.0 0 32768 i +* 10.1.1.1/32 10.1.3.2 0 65003 65001 ? +*> 172.16.1.2 11 0 65001 ? +* 10.1.2.0/24 10.1.3.2 0 0 65003 i +*> 0.0.0.0 0 32768 i +* 10.1.3.0/30 10.1.3.2 0 0 65003 i +*> 0.0.0.0 0 32768 i +* 10.2.2.2/32 10.1.3.2 0 65003 65001 ? +*> 172.16.1.2 0 0 65001 ? + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 915 + +*> 10.3.3.3/32 0.0.0.0 0 32768 i +* 10.4.4.4/32 172.16.1.2 0 65001 65003 i +*> 10.1.3.2 0 0 65003 i +* 172.16.1.0/30 172.16.1.2 0 0 65001 i +*> 0.0.0.0 0 32768 i +* 172.16.2.0/30 172.16.1.2 0 0 65001 i +*> 10.1.3.2 0 0 65003 i +* 192.168.0.0 10.1.3.2 0 65003 65001 ? +*> 172.16.1.2 0 0 65001 ? +* 192.168.1.0 10.1.3.2 0 65003 65001 ? +*> 172.16.1.2 11 0 65001 + +As you formulate your solution to correct the inbound and outbound path selection issues, you should limit your configuration to router R2. The reason for this limitation is that routers BB1 and BB2 are acting as ISP routers. In a real-world environment, the administrator of an enterprise network would not have privileges to configure the ISP routers. + +BGP has multiple attributes that can be manipulated to influence path selection. The sug-gested solution, however, focuses on how the BGP local preference attribute can influ-ence the outbound path selection and how the BGP AS_PATH attribute can influence the inbound path selection. You can configure route maps to set these BGP attributes. If you choose to base your solution on local preference and AS_PATH attributes, Table 21-1 pro-vides a syntax reference that might be helpful. + + +Table 21-1 + +Command + + +Configuring AS_PATH and Local Preference BGP Attributes + +Description + +Router(config)#route-map tag [permit | deny] Creates a route map [seq-num] + +Router(config-route-map)#set local-preference local-preference +Router(config-route-map)#set as-path prepend autonomous-system-number-1 [... autonomous-system-number-n] +Router(config)#router bgp as-number + +Router(config-router)#neighbor ip-address route-map route-map-name [in | out] + +Sets the local preference BGP attribute for routes matched by a route map +Defines an autonomous system path to prepend to an autonomous system path known by the BGP forwarding table +Enables a BGP process for a specific autonomous system +Applies a specified route map to routes received from or advertised to a specified BGP neighbor + + + +Take a moment to look through the provided show command output. Then, on a separate sheet of paper, create a plan for correcting the suboptimal path selection. + + + + + +From the Library of Outcast Outcast +916 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Suggested Solution + +Local preference values can be applied to routes coming into a router. This can cause that router to make its outbound routing decisions based on those local preference values. Higher local preference values are preferred over lower local preference values. + +An autonomous system path (that is, a listing of the autonomous systems that must be transited to reach a specific destination network) advertised to a neighbor can influence the BGP path selection of that neighbor. Specifically, BGP can make routing decisions based on the smallest number of autonomous systems that must be crossed to reach a destination network. Using a route map, you can prepend one or more additional instanc-es of your local autonomous system to the AS_PATH advertised to a router’s neighbor, thereby making that path appear less attractive to your neighbor. + +Therefore, the suggested solution configures local preference values for routes advertised into router R2 from routers BB1 and BB2 to prefer routes being advertised via router BB2. Example 21-66 shows this configuration, which influences outbound path selection. + +Example 21-66 Local Preference Configuration on Router R2 + +R2(config)#route-map LOCALPREF-BB1 +R2(config-route-map)#set local-preference 100 +R2(config-route-map)#exit +R2(config)#route-map LOCALPREF-BB2 +R2(config-route-map)#set local-preference 200 +R2(config-route-map)#exit +R2(config)#router bgp 65001 +R2(config-router)#neighbor 172.16.1.1 route-map LOCALPREF-BB1 in +R2(config-router)#neighbor 172.16.2.2 route-map LOCALPREF-BB2 in +R2(config-router)#exit + +To influence inbound path selection, this suggested solution configures a route map to prepend two additional instances of autonomous system 65001 to routes being adver-tised via BGP from router R2 to router BB1. Example 21-67 shows this configuration, which causes router BB1 to use router BB2 as a next-hop router when sending traffic into the enterprise network. It does this because the path via router BB2 appears to be fewer autonomous system hops away from the enterprise networks. + +Example 21-67 AS_PATH Configuration on Router R2 + +R2(config)#route-map ASPATH 10 +R2(config-route-map)#set as-path prepend 65001 65001 +R2(config-route-map)#exit +R2(config)#router bgp 65001 +R2(config-router)#neighbor 172.16.1.1 route-map ASPATH out +R2(config-router)#end + +Example 21-68 confirms that router R2 now prefers router BB2 (that is, a next-hop IP address of 172.16.2.2) to reach the default network. + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 917 + +Example 21-68 Preferred Path of Router R2 to Backbone Networks + +R2#show bgp ipv4 unicast +BGP table version is 16, local router ID is 10.2.2.2 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + +Network Next Hop Metric LocPrf Weight Path +* 0.0.0.0 172.16.1.1 0 100 0 65002 i + +*> +*> 10.1.1.1/32 + +172.16.2.2 +192.168.0.11 + +0 200 0 65003 i +11 32768 ? + +* 10.1.2.0/24 172.16.1.1 0 100 0 65002 i +*> 172.16.2.2 0 200 0 65003 i +* 10.1.3.0/30 172.16.1.1 0 100 0 65002 i + +*> +*> 10.2.2.2/32 + +172.16.2.2 +0.0.0.0 + +0 200 0 65003 i +0 32768 ? + +* 10.3.3.3/32 172.16.1.1 0 100 0 65002 i +*> 172.16.2.2 200 0 65003 65002 i +* 10.4.4.4/32 172.16.1.1 100 0 65002 65003 i + +*> +*> 172.16.1.0/30 +* +* +*> 172.16.2.0/30 +* +* +*> 192.168.0.0 +*> 192.168.1.0 + +172.16.2.2 +0.0.0.0 +172.16.1.1 +172.16.2.2 +0.0.0.0 +172.16.1.1 +172.16.2.2 +0.0.0.0 +192.168.0.11 + +0 200 0 +0 32768 +0 100 0 +200 0 +0 32768 +100 0 +0 200 0 +0 32768 +11 32768 + +65003 i +i +65002 i +65003 65002 i +i +65002 65003 i +65003 i +? + + +Example 21-69 confirms that router BB1 will not prefer to send traffic to the enterprise network (that is, to routers R1 and R2) via router R2, but rather via router BB2. Notice from the output that more autonomous system hops appear to be required to reach enter-prise networks via router R2 (that is, 172.16.1.2) compared to router BB2 (that is, 10.1.3.2). Therefore, router BB1 prefers to send traffic into the enterprise network via router BB2, as opposed to router R2. + +Example 21-69 Preferred Path of Router BB1 to Enterprise Networks + +BB1#show bgp ipv4 unicast +BGP table version is 142, local router ID is 10.3.3.3 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, +r RIB-failure, S Stale +Origin codes: i - IGP, e - EGP, ? - incomplete + + +Network +* 0.0.0.0 + +Next Hop +172.16.1.2 + +Metric LocPrf Weight +0 + +Path +65001 65001 65001 65003 i + +* 10.1.3.2 0 0 65003 i + + + +From the Library of Outcast Outcast +918 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +*> +*> 10.1.1.1/32 +* + +0.0.0.0 0 +10.1.3.2 +172.16.1.2 11 + +32768 i +0 65003 65001 ? +0 65001 65001 65001 ? + + + +* 10.1.2.0/24 +* + +172.16.1.2 +10.1.3.2 0 + +0 65001 65001 65001 65003 i +0 65003 i + +*> 0.0.0.0 0 32768 i + +* 10.1.3.0/30 +* + +172.16.1.2 +10.1.3.2 0 + +0 65001 65001 65001 65003 i +0 65003 i + + + +*> +*> 10.2.2.2/32 +* +*> 10.3.3.3/32 + +0.0.0.0 0 +10.1.3.2 +172.16.1.2 0 +0.0.0.0 0 + +32768 i +0 65003 65001 ? +0 65001 65001 65001 ? +32768 i + +* 10.4.4.4/32 172.16.1.2 0 65001 65001 65001 65003 i +*> 10.1.3.2 0 0 65003 i +* 172.16.1.0/30 172.16.1.2 0 0 65001 65001 65001 i +*> 0.0.0.0 0 32768 i +* 172.16.2.0/30 172.16.1.2 0 0 65001 65001 65001 i + +*> +*> 192.168.0.0 +* +*> 192.168.1.0 +* + +10.1.3.2 0 +10.1.3.2 +172.16.1.2 0 +10.1.3.2 +172.16.1.2 11 + +0 65003 i +0 65003 65001 ? +0 65001 65001 65001 ? +0 65003 65001 ? +0 65001 65001 65001 + + + +Trouble Ticket 7 + +You receive the following trouble ticket: + +A new administrator for company A has forgotten the enable secret password assigned to router R1 and can no longer log in. Also, when this administrator connects to router R2 via Telnet, the connection is timed out after only 1 second. The administrator reports this short timeout does not give him sufficient time to correct the configuration. Also, the administrator configured an access list on router R2 to prevent anyone on the backbone (that is, connections coming in to router R2 via the Frame Relay network) from connect-ing to the Loopback 0 interfaces on routers R1 or R2 via Telnet. However, the access list does not seem to be working. + +This trouble ticket references the topology shown in Figure 21-7. + +The trouble ticket identified the following three issues: + +■ A forgotten enable secret password + +■ An exec-timeout parameter set too low + +■ An ACL misconfiguration + +The sections that follow address each issue individually. + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 919 +1 +.1 +.22 + +Lo 0 10.3.3.3/32 + + + + + + +Lo 0 10.1.1.1/32 +192.168.1.0/24 + + + +Lo 0 10.2.2.2/32 + +S 1/0.2 .1 +DLCI = 811 +172.16.1.0/30 +S 1/0.1 .2 +DLCI = 181 +10.1.3.0/30 + + + +BB1 + +S 1/0.1 .1 +DLCI = 881 + + + +Fa 0/0 RFa 0/1 Fa 0/0R2 S 1/0.2 FRSW .11 DLCI = 182 +Gig 0/8 192.168.0.0/24 Fa 5/46 172.16.2.0/30 S 1/0.2 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +Figure 21-7 Trouble Ticket 7 Topology + +Issue 1: Forgotten Enable Secret Password + +The first issue to be addressed by this trouble ticket is password recovery. The adminis-trator reportedly forgot the enable secret password for router R1, which is a Cisco 2900 series router. + +On a separate sheet of paper, write out the steps you would go through to perform pass-word recovery on this router. If you are not familiar with password recovery steps, you might need to research password recovery at Cisco.com. + +Issue 1: Suggested Solution + +To begin the password recovery process on router R1, the router was rebooted, and during the first few seconds of the router booting, a Break was sent from the terminal emulator to the router. The Break caused the ROM Monitor prompt (that is, rommon) to appear on router R1’s console. + +The configuration register was set to 0x2142 with the command confreg 0x2142. Setting the configuration register to this value causes the router to ignore its startup con-figuration when the router boots. The router was then rebooted by issuing the reset com-mand at the rommon prompt. + +Because the router ignored the startup configuration, after the router booted, a prompt was presented, asking the administrator whether he wanted to go through the setup dialog. A no was entered at this prompt. The enable command was entered to go into privileged configuration mode. From privileged mode, the startup configuration, stored + + +From the Library of Outcast Outcast +920 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +in the router’s NVRAM, was merged with the existing running configuration using the command copy star run. This command does not replace the running configuration with the startup configuration. Rather, these two configurations are merged. After this merger, all the physical interfaces were administratively shut down. Therefore, the no shutdown command was entered for interfaces Fast Ethernet 0/0 and Fast Ethernet 0/1. + +The enable secret password was reset to cisco using the command enable secret cisco. Next, the configuration register was set back to its normal value of 0x2102 with the command config-register 0x2102. The running configuration was copied to the startup configuration with the command copy run star. The router was then rebooted with the reload command. After the router rebooted, the administrator could access the router’s privileged mode using an enable secret password of cisco. Example 21-70 demonstrates this password-recovery procedure. + +Example 21-70 Performing Password Recovery on Router R1 + +System Bootstrap, Version 15.0(1r)M1, RELEASE SOFTWARE (fc1) +Copyright (c) 2009 by cisco Systems, Inc. +C2900 platform with 524288 Kbytes of main memory +...BREAK SEQUENCE SENT... +monitor: command "boot" aborted due to user interrupt +rommon 1 > confreg 0x2142 +You must reset or power cycle for new config to take effect +rommon 2 > reset +...OUTPUT OMITTED... +---- System Configuration Dialog ---- +Would you like to enter the initial configuration dialog? [yes/no]: no +Press RETURN to get started! +...OUTPUT OMITTED... +Router>enable +Router#copy star run +Destination filename [running-config]? +...OUTPUT OMITTED... +R1(config)#enable secret cisco +R1(config)#config-register 0x2102 +R1(config)#interface fa 0/1 +R1(config-if)#no shut +R1(config-if)#interface fa 0/0 +R1(config-if)#no shut +R1(config-if)#end +*Mar 3 12:43:26.016: %SYS-5-CONFIG_I: Configured from console by console +R1#copy run star +Destination filename [startup-config]? +Building configuration... +[OK] +R1#reload +Proceed with reload? [confirm] + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 921 + +...OUTPUT OMITTED... +Press RETURN to get started! +R1> +R1>enable +Password:cisco +R1# + + +Issue 2: An exec-timeout Parameter Set Too Low + +The second issue addressed in this trouble ticket is recovering from a misconfiguration on router R2, which causes a Telnet session to time out after only 1 second of inactivity. The challenge with such a misconfiguration is that when an administrator telnets to the router to correct the configuration, he might be logged out if he pauses for as little as a single second. + +Example 21-71 shows router R2’s misconfiguration. Note the exec-timeout 0 1 com-mand. This command causes a user that connected via a vty line to be timed out after only one second of inactivity. + +Example 21-71 Incorrect exec-timeout Configuration on Router R2 + +R2#show run | begin line vty 0 4 +line vty 0 4 +exec-timeout 0 1 +password cisco +login + +On a separate sheet of paper, write out how you would approach this seemingly paradox-ical situation, where you have to log in to the router to correct the configuration, while you will be logged out of the router with only a single second’s pause. + +Issue 2: Suggested Solution + +One fix to this issue is to continuously tap on the keyboard’s down arrow with one hand, while using the other hand to enter the commands required to correct the exec-timeout misconfiguration. Example 21-72 shows the commands entered to set the exec-timeout parameter such that a Telnet session times out after 5 minutes of inactivity. You could also attach to the console or aux port on the device and change these parameters for the telnet session. + +Example 21-72 Correcting an exec-timeout Misconfiguration + +R2#conf term +R2(config)#line vty 0 4 +R2(config-line)#exec-timeout 5 0 + + + + + + +From the Library of Outcast Outcast +922 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Issue 3: ACL Misconfiguration + +This trouble ticket’s final troubleshooting issue was an ACL misconfiguration. The goal of the ACL on router R2 was to prevent Telnet traffic coming in from the backbone (that is, coming in over subinterfaces Serial 1/0.1 or Serial 1/0.2) destined for the loopback inter-face on router R1 or R2 (that is, IP addresses 10.1.1.1 or 10.2.2.2). Example 21-73 shows the ACL configuration on router R2. + +Example 21-73 Baseline ACL Configuration on Router R2 + +R2#show run +...OUTPUT OMITTED... +interface s1/0.1 +ip access-group 100 out +! +interface s1/0.2 +ip access-group 100 out +! +access-list 100 deny tcp any host 10.1.1.1 eq telnet +access-list 100 deny tcp any host 10.2.2.2 eq telnet +access-list 100 permit ip any any + +Based on the trouble ticket and the proceeding show command output, on a separate sheet of paper, formulate your strategy for resolving the reported issue. + +Issue 3: Suggested Solution + +Upon examination, the ACL (an extended IP ACL numbered 100) on router R2 appears to be configured correctly. However, ACL 100 was applied in the outbound direction on router R2’s Frame Relay subinterfaces. ACL 100 should have been applied in the incoming direction on these subinterfaces. This suggested solution replaces the incorrect ip access-group commands, as shown in Example 21-74. + +Example 21-74 Correcting the Application of ACL 100 on Router R2 + +R2#conf term +R2(config)#interface s1/0.1 +R2(config-if)#no ip access-group 100 out +R2(config-if)#ip access-group 100 in +R2(config-if)#interface s1/0.2 +R2(config-if)#no ip access-group 100 out +R2(config-if)#ip access-group 100 in + +After making the previous update, Telnet connections destined for the Loopback inter-faces on routers R1 and R2, coming into router R2 over its Frame Relay subinterfaces are now denied. + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 923 +R2 +R +1 +.1 +.22 + +Trouble Ticket 8 + +You receive the following trouble ticket: + +Company A is dual-homed out to the Internet (that is, routers BB1 and BB2, where each router represents a different ISP). Inside IP addresses in the 192.168.0.0/24 subnet should be translated into the IP address of interface Serial 1/0.1 on router R2, whereas inside +IP addresses in the 192.168.1.0/24 subnet should be translated into the IP address of interface Serial 1/0.2 on router R2. Router R2’s Network Address Translation (NAT) table shows two active translations. The configuration, therefore, seems to be partially work-ing. However, no additional NAT translations can be set up. + +This trouble ticket references the topology shown in Figure 21-8. +Lo 0 10.3.3.3/32 + + + + + + +Lo 0 10.1.1.1/32 +192.168.1.0/24 + + + +Lo 0 10.2.2.2/32 + +NAT + +S 1/0.2 .1 +DLCI = 811 +172.16.1.0/30 +S 1/0.1 .2 +DLCI = 181 +10.1.3.0/30 + + +BB1 + +S 1/0.1 .1 +DLCI = 881 + + + +Fa 0/0 R Fa 0/1 Fa 0/0 2 S 1/0.2 FRSW .11 DLCI = 182 +Gig 0/8 192.168.0.0/24 Fa 5/46 172.16.2.0/30 S 1/0.2 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +Figure 21-8 Trouble Ticket 8 Topology + +Because router R2 is the one configured to perform NAT, the following show and debug command output collects information about the NAT configuration of router R2. Initially, notice the output of the show ip nat translations command issued on router R2, as shown in Example 21-75. + +Example 21-75 show ip nat translations Command Output on Router R2 + +R2#show ip nat translations +Pro Inside global Inside local Outside local Outside global + +icmp 172.16.1.2:7 +icmp 172.16.2.1:512 + +192.168.0.11:7 +192.168.1.50:512 + +10.4.4.4:7 +10.1.3.2:512 + +10.4.4.4:7 +10.1.3.2:512 + + + + + +From the Library of Outcast Outcast +924 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +The debug ip nat command is issued next. The output provided in Example 21-76 shows NAT translations as they occur. + +Example 21-76 debug ip nat Command Output on Router R2 + +R2#debug ip nat +IP NAT debugging is on +*Mar 1 00:34:16.651: NAT*: s=10.4.4.4, d=172.16.1.2->192.168.0.11 [4092] +*Mar 1 00:34:16.711: NAT*: s=192.168.0.11->172.16.1.2, d=10.4.4.4 [4093] +*Mar 1 00:34:16.843: NAT*: s=10.4.4.4, d=172.16.1.2->192.168.0.11 [4093] +*Mar 1 00:34:16.939: NAT*: s=192.168.0.11->172.16.1.2, d=10.4.4.4 [4094] +*Mar 1 00:34:16.963: NAT*: s=192.168.1.50->172.16.2.1, d=10.1.3.2 [13977] +*Mar 1 00:34:17.115: NAT*: s=10.4.4.4, d=172.16.1.2->192.168.0.11 [4094] +*Mar 1 00:34:17.163: NAT*: s=192.168.0.11->172.16.1.2, d=10.4.4.4 [4095] +*Mar 1 00:34:17.187: NAT*: s=10.1.3.2, d=172.16.2.1->192.168.1.50 [13977] +*Mar 1 00:34:17.315: NAT*: s=10.4.4.4, d=172.16.1.2->192.168.0.11 [4095] + +The trouble ticket indicated that no more than two active translations can be supported at any time. To verify that symptom, Example 21-77 shows an attempt to send a ping from router R1. Notice that the ping response indicates that 10.4.4.4 is unreachable. + +Example 21-77 Attempting to Ping 10.4.4.4 from Router R1 + +R1#ping 10.4.4.4 + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.4.4.4, timeout is 2 seconds: +U.U.U +Success rate is 0 percent (0/5) + +To determine whether the inability to ping 10.4.4.4 is a result of NAT or some other issue, the NAT translation table on router R2 is cleared with the clear ip nat translation * com-mand. Then, with the NAT translation table of router R2 cleared, Example 21-78 shows the result of another ping from router R1 to 10.4.4.4. This time, the ping is successful. + +Example 21-78 Reattempting to Ping 10.4.4.4 from Router R1 + +R1#ping 10.4.4.4 + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.4.4.4, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 72/137/240 ms + +Example 21-79 shows the NAT translation table of router R2 after R1 performs a ping to 10.4.4.4. + + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 925 + +Example 21-79 NAT Translation Table of Router R2 + +R2#show ip nat translations +Pro Inside global Inside local Outside local Outside global +icmp 172.16.1.2:10 192.168.0.11:10 10.4.4.4:10 10.4.4.4:10 + +The output from the previous commands confirms that router R2 is capable of support-ing only two simultaneous NAT translations. This symptom often indicates that a router’s NAT pool (or pools in this case) is depleted, perhaps because the NAT configuration did not use the overload option in the ip nat inside source command. Recall that the over-load option enables PAT, which allows multiple inside local IP addresses to share a com-mon inside global IP address. + +Example 21-80 shows the running configuration of router R2. Interestingly, both the ip nat inside source commands have the overload option, thus eliminating that as a poten-tial cause for the reported issue. + +Example 21-80 Running Configuration of Router R2 + +R2#show run +...OUTPUT OMITTED... +hostname R2 +! +interface Loopback0 +ip address 10.2.2.2 255.255.255.255 +! +interface FastEthernet0/0 +ip address 192.168.0.22 255.255.255.0 +ip nat inside +! +interface Serial1/0 +no ip address +encapsulation frame-relay +! +interface Serial1/0.1 point-to-point +ip address 172.16.1.2 255.255.255.252 +ip nat outside +frame-relay interface-dlci 181 +! +interface Serial1/0.2 point-to-point +ip address 172.16.2.1 255.255.255.252 +ip nat outside +ip virtual-reassembly +frame-relay interface-dlci 182 +! +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 +! + + + +From the Library of Outcast Outcast +926 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +ip nat translation max-entries 2 +ip nat inside source list 1 interface Serial1/0.2 overload +ip nat inside source list 2 interface Serial1/0.1 overload +! +access-list 1 permit 192.168.1.0 0.0.0.255 +access-list 2 permit 192.168.0.0 0.0.0.255 +! +...OUTPUT OMITTED... + +Based on the output of the previous show and debug commands, on a separate sheet of paper, write out what you believe to be the underlying issue and how you would resolve it. + +Suggested Solution + +In the running configuration of router R2, you might have noticed the ip nat translation max-entries 2 command. This command limits the maximum number of NAT transla-tions on router R2 to only two. + +To resolve this issue, this configuration command is removed, as shown in Example 21-81. + +Example 21-81 Removing the ip nat translation max-entries 2 Command of Router R2 + +R2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#no ip nat translation max-entries 2 +R2(config)#end + +To demonstrate that the removal of the ip nat translation max-entries 2 command did indeed resolve the reported issue, three NAT translations were established across router R2, as confirmed in Example 21-82. + +Example 21-82 Confirming That Router R2 Supports Multiple NAT Translations + +R2#show ip nat translations + +Pro Inside global +icmp 172.16.1.2:12 +icmp 172.16.2.1:13 +icmp 172.16.2.1:512 + +Inside local +192.168.0.11:12 +192.168.1.11:13 +192.168.1.50:512 + +Outside local +10.4.4.4:12 +10.3.3.3:13 +10.1.3.2:512 + +Outside global +10.4.4.4:12 +10.3.3.3:13 +10.1.3.2:512 + + + +Trouble Ticket 9 + +You receive the following trouble ticket: + +Company A recently added IPv6 addressing to its existing IPv4 addressing. OSPFv3 is the protocol being used to route the IPv6 traffic. Although the configuration was origi-nally functional, now several OSPFv3 adjacencies are not forming. Full IPv6 reachability throughout the topology needs to be established. + +This trouble ticket references the topology shown in Figure 21-9. + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 927 + +OSPF Area 1 OSPF Area 0 + + + + + + + + +Lo 0 10.1.1.1/32 +A:A:A:A::X/64 +192.168.1.0/24 + + + + + +Lo 0 10.2.2.2/32 + +Lo 0 Fa 0/0 +10.3.3.3/32 .1 +S 1/0.2 .1 +DLCI = 811 BB1 +172.16.1.0/30 +C:C:C:C::X/64 S 1/0.1 S 1/0.1 .1 +.2 DLCI = 881 DLCI = 181 +10.1.3.0/30 +E:E:E:E::X/64 +10.1.2.0/24 +F:F:F:F::X/64 + + + +Fa 0/0 R1 R2 S 1/0.2 FRSW +Fa 0/1 +Fa 0/0 +.1 +.11 B:B:B:B::X/64 .22 DLCI = 182 +Gig 0/8 192.168.0.0/24 Fa 5/46 D:D:D:D::X/640 S 1/0.2 +172.16.2.0/3 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +BB2 Fa 0/0 +.2 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +Figure 21-9 Trouble Ticket 9 Topology + +The trouble ticket indicates that several adjacencies are not being formed. So, you decide to start your troubleshooting efforts on router R1 and check its adjacency with router R2, and then check the adjacencies between R2 and BB1 and BB2. Finally, you will check the adjacencies between BB1 and BB2. + +Issue 1: Adjacency Between Routers R1 and R2 Example 21-83 shows the data collected from router R1. + +Example 21-83 Troubleshooting Data Collection on Router R1 + +R1#show ipv6 ospf neighbor + +R1#debug ipv6 ospf adj +OSPFv3 adjacency events debugging is on +R1#debug ipv6 ospf hello +OSPFv3 hello events debugging is on +R1#u all +All possible debugging has been turned off +R1#show run +...OUTPUT OMITTED... +hostname R1 + + + +From the Library of Outcast Outcast +928 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +! +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 10.1.1.1 255.255.255.255 +! +interface FastEthernet0/0 +ip address 192.168.1.11 255.255.255.0 +ipv6 address A:A:A:A::11/64 +ipv6 ospf 100 area 1 +! +interface FastEthernet0/1 +ip address 192.168.0.11 255.255.255.0 +ipv6 address B:B:B:B::11/64 +ipv6 ospf 100 area 1 +! +ipv6 router ospf 100 +! +...OUTPUT OMITTED... +R1#show ipv6 ospf interface fa 0/1 +FastEthernet0/1 is up, line protocol is up +Link Local Address FE80::209:B7FF:FEFA:D1E1, Interface ID 4 +Area 1, Process ID 100, Instance ID 0, Router ID 192.168.1.11 +Network Type BROADCAST, Cost: 1 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 192.168.1.11, local address FE80::209:B7FF:FEFA:D1E1 +No backup designated router on this network +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:03 +Index 1/2/2, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 2 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) + +Notice that router R1 has not formed an adjacency with router R2 and there are no Hello packets being exchanged between the two routers. Example 21-84 shows the data col-lected from router R2. + +Example 21-84 Troubleshooting Data Collection on Router R2 + +R2#show ipv6 ospf neighbor + +R2#debug ipv6 ospf adj +OSPFv3 adjacency events debugging is on + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 929 + +R2#u all +All possible debugging has been turned off +R2#show run +...OUTPUT OMITTED... +hostname R2 +! +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 10.2.2.2 255.255.255.255 +! +interface FastEthernet0/0 +ip address 192.168.0.22 255.255.255.0 +ipv6 address B:B:B:B::22/64 +ipv6 ospf hello-interval 60 +ipv6 ospf 1 area 1 +! +interface Serial1/0 +no ip address +encapsulation frame-relay +! +interface Serial1/0.1 point-to-point +ip address 172.16.1.2 255.255.255.252 +ipv6 address C:C:C:C::2/64 +ipv6 ospf 1 area 0 +frame-relay interface-dlci 181 +! +interface Serial1/0.2 point-to-point +ip address 172.16.2.1 255.255.255.252 +ipv6 address D:D:D:D::1/64 +ipv6 ospf network point-to-multipoint +ipv6 ospf 1 area 0 +frame-relay interface-dlci 182 +! +ipv6 router ospf 1 +passive-interface default +! +...OUTPUT OMITTED... + +Based on the output provided in Examples 21-83 and 21-84, hypothesize why routers R1 and R2 are not forming an adjacency. On a separate sheet of paper, write out your sug-gested solution to correct the issue. + + + + + + +From the Library of Outcast Outcast +930 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Issue 1: Suggested Solution + +Notice in Example 21-84 that router R2’s hello timer on the Fast Ethernet 0/0 interface was set to a nondefault value, whereas the other end of the link was still set to the default. Also, router R2 had its OSPFv3 process configured with the passive-interface default command, which prevented any of router R2’s interfaces from forming OSPFv3 adjacen-cies. Example 21-85 shows the correction of these configuration issues on router R2. + +Example 21-85 Correcting Router R2’s Hello Timer and Passive-Interface Configuration + +R2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#int fa 0/0 +R2(config-if)#no ipv6 ospf hello-interval 60 +R2(config-if)#exit +R2(config)#ipv6 router ospf 1 +R2(config-rtr)#no passive-interface default + + +Issue 2: Adjacency Between Routers R2 and BB2 + +After implementing the fix shown in Example 21-85, router R2 successfully forms OSPF adjacencies with routers R1 and BB1. However, an adjacency is not successfully formed with router BB2. Example 21-86 shows the output of the show ipv6 ospf interface s1/0.2 command issued on router BB2. This command was issued to view the OSPFv3 configu-ration of router BB2’s Serial 1/0.2 subinterface, which is the subinterface used to connect to router R2. You compare this to R2s OSPF configuration on Serial 1/0.2 in Example +21-84. + +Example 21-86 Viewing Router BB2’s OSPFv3 Configuration on Subinterface Serial 1/0.2 + +BB2#show ipv6 ospf interface s1/0.2 +Serial1/0.2 is up, line protocol is up +Link Local Address FE80::C200:8FF:FE2C:0, Interface ID 14 +Area 0, Process ID 1, Instance ID 0, Router ID 10.4.4.4 +Network Type POINT_TO_POINT, Cost: 64 +Transmit Delay is 1 sec, State POINT_TO_POINT, +...OUTPUT OMITTED... + +BB2#show ipv6 ospf neighbor + +Based on router R2’s configuration (shown in Example 21-84) and the output shown in Example 21-86, determine why an OSPF adjacency is not being formed between routers R2 and BB2. Again, on a separate sheet of paper, write out your suggested solution. + + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 931 + +Issue 2: Suggested Solution + +Router R2’s OSPF network type on subinterface Serial 1/0.2 was set to point-to-multi-point; the other end of the link was the default network type of point-to-point. Example 21-87 shows the correction of router R2’s misconfiguration. + +Example 21-87 Correcting Router R2’s OSPF Network Type + +R2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#int s1/0.2 +R2(config-subif)#no ipv6 ospf network point-to-multipoint +R2(config-subif)#exit + +At this point in the troubleshooting process, routers R1 and R2 have formed adjacencies. In addition, router R2 has formed adjacencies with routers BB1 and BB2. The output in Example 21-88 confirms the establishment of these adjacencies. + +Example 21-88 Confirming Router R2’s OSPF Adjacencies + +R2#show ipv6 ospf neighbor + + +Neighbor ID +10.4.4.4 +10.3.3.3 + +Pri State +1 FULL/ - +1 FULL/ - + +Dead Time +00:00:36 +00:00:36 + +Interface ID +14 +14 + +Interface +Serial1/0.2 +Serial1/0.1 + +192.168.1.11 1 FULL/DR 00:00:39 4 FastEthernet0/0 + + +Issue 3: Adjacency Between Routers BB1 and BB2 + +As shown in the output provided in Example 21-89, router BB1 has formed an adjacency with router BB2 over router BB1’s Fast Ethernet 0/0 interface. However, an adjacency has not been successfully formed with router BB2 over router BB1’s Serial 1/0.1 subinterface. + +Example 21-89 Determining Router BB1’s Adjacencies + +BB1#show ipv6 ospf neigh + + +Neighbor ID +10.2.2.2 +10.4.4.4 + +Pri State +1 FULL/ - +1 DOWN/ - + +Dead Time +00:00:37 +- + +Interface ID +13 +13 + +Interface +Serial1/0.2 +Serial1/0.1 + +10.4.4.4 1 FULL/DR 00:00:34 4 FastEthernet0/0 + +To investigate why an OSPF adjacency is not forming with router BB2 via router BB1’s Serial 1/0.1 subinterface, the debug ipv6 ospf adj and debug ipv6 ospf hello commands were issued on router BB1, as shown in Example 21-90. + + + + + + +From the Library of Outcast Outcast +932 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Example 21-90 Debugging OSPFv3 Adjacency and Hello Events on Router BB1 + +BB1#debug ipv6 ospf adj +OSPFv3 adjacency events debugging is on +BB1#debug ipv6 ospf hello +OSPFv3 hello events debugging is on +BB1# +*Mar 1 00:19:24.707: OSPFv3: Rcv DBD from 10.4.4.4 on Serial1/0.1 seq 0x1AEF opt +0x0013 flag 0x7 len 28 mtu 1500 state EXSTART +*Mar 1 00:19:24.707: OSPFv3: Nbr 10.4.4.4 has larger interface MTU +*Mar 1 00:19:25.015: OSPFv3: Rcv hello from 10.2.2.2 area 0 from Serial1/0.2 +FE80::C201:8FF:FE2C:0 interface ID 13 +*Mar 1 00:19:25.019: OSPFv3: End of hello processing +*Mar 1 00:19:28.583: OSPFv3: Send hello to FF02::5 area 0 on Serial1/0.2 from +FE80::C202:8FF:FE98:0 interface ID 14 +*Mar 1 00:19:28.647: OSPFv3: Rcv hello from 10.4.4.4 area 0 from Serial1/0.1 +FE80::C200:8FF:FE2C:0 interface ID 13 +*Mar 1 00:19:28.651: OSPFv3: End of hello processing +*Mar 1 00:19:28.983: OSPFv3: Send hello to FF02::5 area 0 on FastEthernet0/0 +from FE80::C202:8FF:FE98:0 interface ID 4 +*Mar 1 00:19:29.215: OSPFv3: Rcv hello from 10.4.4.4 area 0 from FastEthernet0/0 +FE80::C200:8FF:FE2C:0 interface ID 4 +*Mar 1 00:19:29.219: OSPFv3: End of hello processing +BB1# u all +All possible debugging has been turned off + +Because your troubleshooting on router BB1 is focused on BB1’s Serial 1/0.1 subinterface, the show ipv6 interface s1/0.1 command was issued, the output for which appears in Example 21-91. + +Example 21-91 Viewing the IPv6 Configuration on Router BB1’s Serial 1/0.1 Subinterface + +BB1#show ipv6 interface s1/0.1 +Serial1/0.1 is up, line protocol is up +IPv6 is enabled, link-local address is FE80::C202:8FF:FE98:0 +Global unicast address(es): +E:E:E:E::1, subnet is E:E:E:E::/64 +Joined group address(es): +FF02::1 +FF02::2 +FF02::5 +FF02::1:FF00:1 +FF02::1:FF98:0 +MTU is 1400 bytes +ICMP error messages limited to one every 100 milliseconds +ICMP redirects are enabled + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 933 + +ND DAD is enabled, number of DAD attempts: 1 +ND reachable time is 30000 milliseconds +Hosts use stateless autoconfig for addresses. + +Based on the output provided in Examples 21-90 and 21-91, determine why router BB1 is failing to form an OSPF adjacency with router BB2, via router BB1’s Serial 1/0.1 subinter-face. On a separate sheet of paper, write out your proposed solution to this issue. + +Issue 3: Suggested Solution + +The debug output shown in Example 21-90 indicates that router BB1’s neighbor (that is, 10.4.4.4) reachable over subinterface Serial 1/0.1 has a larger maximum transmission unit (MTU) than router BB1’s Serial 1/0.1 subinterface. The output in Example 21-91 indicates that router BB1’s Serial 1/0.1 subinterface has an MTU of 1400 bytes. This is less than the default value of 1500 bytes for this router. Example 21-92 shows how this MTU value was reset to its default value. + +Example 21-92 Correcting the MTU on Router BB1’s Serial 1/0.1 Subinterface + +BB1#conf term +Enter configuration commands, one per line. End with CNTL/Z. +BB1(config)#int s1/0.1 +BB1(config-subif)#ipv6 mtu 1500 +*Mar 1 00:20:00.019: %OSPFv3-5-ADJCHG: Process 1, Nbr 10.4.4.4 on Serial1/0.1 from LOADING to FULL, Loading Done +BB1(config-subif)#end + +Notice, in Example 21-92, that an adjacency with router BB2 (that is, 10.4.4.4) was formed over router BB1’s Serial 1/0.1 subinterface after setting the subinterface’s MTU size to the default of 1500 bytes. Examples 21-93 and 21-94 further confirm that routers BB1 and BB2 have formed all appropriate adjacencies with their OSPF neighbors. + +Example 21-93 Router BB1’s OSPF Adjacencies + +BB1#show ipv6 ospf neighbor +Neighbor ID Pri State Dead Time Interface ID Interface + +10.2.2.2 +10.4.4.4 +10.4.4.4 + +1 FULL / - +1 FULL / - +1 FULL /DR + +00:00:37 13 +00:00:30 13 +00:00:31 4 + +Serial1/0.2 +Serial1/0.1 +FastEthernet0/0 + + + +Example 21-94 Router BB2’s OSPF Adjacencies + +BB2#show ipv6 ospf neighbor +Neighbor ID Pri State Dead Time Interface ID Interface + +10.2.2.2 +10.3.3.3 +10.3.3.3 + +1 FULL / - +1 FULL / - +1 FULL /BDR + +00:00:37 14 +00:00:37 13 +00:00:31 4 + +Serial1/0.2 +Serial1/0.1 +FastEthernet0/0 + + + + + + +From the Library of Outcast Outcast +934 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +To confirm that full reachability has been restored in the network, a series of ping com-mands were issued from router BB2, with one ping to each router in the topology. As shown in Example 21-95, all the pings were successful. + +Example 21-95 Confirming Reachability to All Routers + +BB2#ping a:a:a:a::11 + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to A:A:A:A::11, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 88/124/164 ms +BB2#ping b:b:b:b::22 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to B:B:B:B::22, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 44/83/164 ms +BB2#ping f:f:f:f::1 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to F:F:F:F::1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 40/79/128 ms +BB2#ping e:e:e:e::2 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to E:E:E:E::2, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms + + +Trouble Ticket 10 + +You receive the following trouble ticket for your RIPng domain: + +Branch site A (that is, routers R1 and R2) has two connections to HQ. The HQ routers are BB1 and BB2. However, router R2 only sees a single path for a default route (rather than one path from each HQ router) in its IPv6 routing table. Also, router R2 is seeing other HQ advertised routes (specifically, E:E:E:E::/64 and F:F:F:F::/64) rather than just a default route in its IPv6 routing table. All routes that router R2 receives from the HQ routers, except a default route, should be suppressed. + +This trouble ticket references the topology shown in Figure 21-10. + +The show ipv6 route command was issued on router R2 to confirm that the IPv6 rout-ing table included only a single path to reach the default network of ::/0. Example 21-95 provides the output from this command, which also confirms the presence of the routes E:E:E:E::/64 and F:F:F:F::/64 in the IPv6 routing table. + + + + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 935 +R2 + + + + + + +Lo 0 10.1.1.1/32 +A:A:A:A::X/64 +192.168.1.0/24 + + + + + +Lo 0 10.2.2.2/32 + +Lo 0 Fa 0/0 +10.3.3.3/32 .1 +S 1/0.2 +.1 +DLCI = 811 BB1 +172.16.1.0/30 +C:C:C:C::X/64 S 1/0.1 S 1/0.1 .1 +.2 DLCI = 881 DLCI = 181 +10.1.3.0/30 +E:E:E:E::X/64 +10.1.2.0/24 +F:F:F:F::X/64 + + + +Fa 0/0 R1 R2 S 1/0.2 FRSW +Fa 0/1 +Fa 0/0 +.1 +.11 B:B:B:B::X/64 .22 DLCI = 182 +Gig 0/8 192.168.0.0/24 Fa 5/46 D:D:D:D::X/640 S 1/0.2 +172.16.2.0/3 +Gig 0/9 Fa 5/47 .2 100 Mbps DLCI = 821 +Gig 0/10 Fa 5/48 + + + +S 1/0.1 .2 +DLCI = 882 + + +.2 BB2 Fa 0/0 + +SW1 10 Mbps SW2 Lo 0 10.4.4.4/32 + +Figure 21-10 Trouble Ticket 10 Topology + +Example 21-95 Confirmation of Troubleshooting Issues on Router R2 + +R2#show ipv6 route +IPv6 Routing Table - 12 entries +Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP +U - Per-user Static route +I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary +O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +R ::/0 [120/2] +via FE80::C200:EFF:FE64:0, Serial1/0.2 +R A:A:A:A::/64 [120/2] +via FE80::209:B7FF:FEFA:D1E1, FastEthernet0/0 +C B:B:B:B::/64 [0/0] +via ::, FastEthernet0/0 +L B:B:B:B::22/128 [0/0] +via ::, FastEthernet0/0 +C C:C:C:C::/64 [0/0] +via ::, Serial1/0.1 +L C:C:C:C::2/128 [0/0] +via ::, Serial1/0.1 +C D:D:D:D::/64 [0/0] +via ::, Serial1/0.2 +L D:D:D:D::1/128 [0/0] +via ::, Serial1/0.2 +R E:E:E:E::/64 [120/2] +via FE80::C200:EFF:FE64:0, Serial1/0.2 + + +From the Library of Outcast Outcast +936 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +R F:F:F:F::/64 [120/2] +via FE80::C200:EFF:FE64:0, Serial1/0.2 +L FE80::/10 [0/0] +via ::, Null0 +L FF00::/8 [0/0] +via ::, Null0 + +The show ipv6 rip database command, as shown in Example 21-96, proves that router R2 received two default route advertisements; however, only one of those route advertise-ments was injected into the IPv6 routing table. + +Example 21-96 RIP Database on Router R2 + +R2#show ipv6 rip database +RIP process "PROCESS1", local RIB +A:A:A:A::/64, metric 2, installed +FastEthernet0/0/FE80::209:B7FF:FEFA:D1E1, expires in 174 secs +B:B:B:B::/64, metric 2 +FastEthernet0/0/FE80::209:B7FF:FEFA:D1E1, expires in 174 secs +D:D:D:D::/64, metric 2 +Serial1/0.2/FE80::C200:EFF:FE64:0, expires in 160 secs +E:E:E:E::/64, metric 2, installed +Serial1/0.2/FE80::C200:EFF:FE64:0, expires in 160 secs +F:F:F:F::/64, metric 2, installed +Serial1/0.2/FE80::C200:EFF:FE64:0, expires in 160 secs +::/0, metric 2, installed +Serial1/0.2/FE80::C200:EFF:FE64:0, expires in 160 secs +Serial1/0.1/FE80::C202:EFF:FEBC:0, expires in 170 secs + +Example 21-97 shows the running configuration on router R2. + +Example 21-97 Running Configuration on Router R2 + +R2#show run +...OUTPUT OMITTED... +hostname R2 +! +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +ip address 10.2.2.2 255.255.255.255 +! +interface FastEthernet0/0 +ip address 192.168.0.22 255.255.255.0 +ipv6 address B:B:B:B::22/64 +ipv6 rip PROCESS1 enable +! + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 937 + +interface Serial1/0 +no ip address +encapsulation frame-relay +serial restart-delay 0 +! +interface Serial1/0.1 point-to-point +ip address 172.16.1.2 255.255.255.252 +ipv6 address C:C:C:C::2/64 +ipv6 rip PROCESS1 enable +frame-relay interface-dlci 181 +! +interface Serial1/0.2 point-to-point +ip address 172.16.2.1 255.255.255.252 +ipv6 address D:D:D:D::1/64 +ipv6 rip PROCESS1 enable +frame-relay interface-dlci 182 +! +ipv6 router rip PROCESS1 +maximum-paths 1 +! +...OUTPUT OMITTED... + + +Issue 1: Router R2 Not Load Balancing Between Routers BB1 and BB2 + +The first issue you investigate is router R2 not load balancing between the HQ rout-ers (that is, routers BB1 and BB2). Based on the show command output presented in +Examples 21-95, 21-96, and 21-97, hypothesize why router R2’s IPv6 routing table con-tains only a single entry for a default network (rather than having two entries, one for BB1 and one for BB2). On a separate sheet of paper, write out your proposed configura-tion change to resolve this issue. + +Issue 1: Suggested Solution + +A review of router R2’s running configuration reveals the maximum-paths 1 command in router configuration mode for the RIPng routing process. This command prevents two default route paths from appearing in router R2’s IPv6 routing table. Example 21-98 shows how this command is removed from router R2’s configuration to restore load bal-ancing. + +Example 21-98 Restoring Load Balancing on Router R2 + +R2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)#ipv6 router rip PROCESS1 +R2(config-rtr)#no maximum-paths 1 + + + +From the Library of Outcast Outcast +938 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Issue 2: Backbone Routes Not Being Suppressed + +The second issue you investigate is about the specific routes (that is, E:E:E:E::/64 and F:F:F:F::/64) being advertized to Branch site A (R1 and R2). The goal is to only advertise default route information into Branch site A. + +The debug ipv6 rip command was issued on router R2 to see if router BB2 was send-ing both default route information and specific route information. The output from this command, as presented in Example 21-99, confirms that router BB2 is not suppressing specific route information. + +Example 21-99 Debugging RIPng Traffic on Router R2 + +R2#debug ipv6 rip +...OUTPUT OMITTED... +*Mar 1 00:33:30.747: RIPng: response received from FE80::C200:EFF:FE64:0 on Serial1/0.2 for PROCESS1 + +*Mar 1 00:33:30.751: +*Mar 1 00:33:30.751: +*Mar 1 00:33:30.755: +*Mar 1 00:33:30.755: +*Mar 1 00:33:30.755: +*Mar 1 00:33:30.755: +*Mar 1 00:33:30.755: +*Mar 1 00:33:30.755: + +src=FE80::C200:EFF:FE64:0 (Serial1/0.2) +dst=FF02::9 +sport=521, dport=521, length=92 +command=2, version=1, mbz=0, #rte=4 +tag=0, metric=1, prefix=F:F:F:F::/64 +tag=0, metric=1, prefix=E:E:E:E::/64 +tag=0, metric=1, prefix=D:D:D:D::/64 +tag=0, metric=1, prefix=::/0 + +...OUTPUT OMITTED... + +Examples 21-100 and 21-101 show the RIP next generation (RIPng) configuration of the Serial 1/0.2 subinterface on routers BB1 and BB2. The Serial 1/0.2 subinterface on each router is the subinterface connecting to router R2. + +Example 21-100 Viewing the RIPng Configuration on Router BB1’s Serial 1/0.2 Subinterface + +BB1#show run | begin Serial1/0.2 +interface Serial1/0.2 point-to-point +ip address 172.16.1.1 255.255.255.252 +ipv6 address C:C:C:C::1/64 +ipv6 rip PROCESS1 enable +ipv6 rip PROCESS1 default-information only +frame-relay interface-dlci 811 + + +Example 21-101 Viewing the RIPng Configuration on Router BB2’s Serial 1/0.2 Subinterface + +BB2#show run | begin Serial1/0.2 +interface Serial1/0.2 point-to-point +ip address 172.16.2.2 255.255.255.252 +ipv6 address D:D:D:D::2/64 + + + +From the Library of Outcast Outcast +Chapter 21: Additional Trouble Tickets 939 + +ipv6 rip PROCESS1 enable +ipv6 rip PROCESS1 default-information originate +frame-relay interface-dlci 821 + +Based on the debug and show commands output presented in Examples 21-99, 21-100, and 21-101, hypothesize why router R2 is receiving specific route information for net-works E:E:E:E::/64 and F:F:F:F::/64. On a separate sheet of paper, write out your pro-posed configuration change to resolve this issue. + +Issue 2: Suggested Solution + +An inspection of router BB2’s running configuration reveals the ipv6 rip PROCESS1 default-information originate command under subinterface configuration mode for Serial 1/0.2. The originate keyword in this command sources a default router advertisement, +but it does not suppress the sending of more specific routes. Example 21-102 shows how this configuration was changed to use the only parameter. The only parameter causes the interface to only originate default route information, while suppressing more specific routes. + +Example 21-102 Suppressing Specific Route Information on Router BB2’s Serial Interface + +BB2#conf term +Enter configuration commands, one per line. End with CNTL/Z. +BB2(config)#int s1/0.2 +BB2(config-subif)#ipv6 rip PROCESS1 default-information only + +After giving the E:E:E:E::/64 and F:F:F:F::/64 routes sufficient time to time out of router R2’s IPv6 routing table, the show ipv6 route was once again issued. The output, as shown in Example 21-103, confirms that the issues reported in the trouble ticket are resolved. Specifically, router R2 sees two paths across which it can load balance to reach a default route. Also, specific routes (that is, E:E:E:E::/64 and F:F:F:F::/64) do not appear in router R2’s IPv6 routing table. + +Example 21-103 Router R2’s IPv6 Routing Table After Troubleshooting + +R2#show ipv6 route +IPv6 Routing Table - 10 entries +Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP +U - Per-user Static route +I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary +O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +R ::/0 [120/2] +via FE80::C200:EFF:FE64:0, Serial1/0.2 +via FE80::C202:EFF:FEBC:0, Serial1/0.1 +R A:A:A:A::/64 [120/2] +via FE80::209:B7FF:FEFA:D1E1, FastEthernet0/0 + + + +From the Library of Outcast Outcast +940 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +C B:B:B:B::/64 [0/0] +via ::, FastEthernet0/0 +L B:B:B:B::22/128 [0/0] +via ::, FastEthernet0/0 +C C:C:C:C::/64 [0/0] +via ::, Serial1/0.1 +L C:C:C:C::2/128 [0/0] +via ::, Serial1/0.1 +C D:D:D:D::/64 [0/0] +via ::, Serial1/0.2 +L D:D:D:D::1/128 [0/0] +via ::, Serial1/0.2 +L FE80::/10 [0/0] +via ::, Null0 +L FF00::/8 [0/0] +via ::, Null0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +CHAPTER 22 + + + + + + +Final Preparation + + +The first two chapters of this book introduced you to a structured troubleshooting pro-cess and the different tools that can assist you during the different steps of the process. Chapters 3 through 20 covered the issues that may arise with the different technologies, protocols, and features deployed within a network. They also provide troubleshooting approach examples using various show and debug commands, and focus on how you can identify the cause of the issues and fix them. Chapter 21 provides an additional set of sample trouble tickets to give you more exposure to troubleshooting. + +Although these chapters supply the detailed information needed to prepare you for the 300-135 TSHOOT exam, most people need more preparation than simply reading the chapters of this book. This chapter details a set of tools and a study plan to help you complete your preparation for the exam. It has two sections. The first section lists the exam preparation tools useful at this point in the study process. The second section details a suggested study plan now that you have completed all the preceding chapters in this book. + + +Note The Glossary and Appendixes C, D, and E exist as soft-copy appendixes on the CD included in the back of this book. + + +Tools for Final Preparation + +This section lists additional information about exam preparation tools and how to access the tools. + +Exam Engine and Questions on the CD + +The CD in the back of the book includes the Pearson Cert Practice Test (PCPT) engine. This software presents you with a set of multiple-choice questions, covering the topics you will be challenged with on the real exam. The PCPT engine lets you study the exam content (using study mode) or take a simulated exam (in practice exam mode). + +The CD in the back of the book contains the exam engine. Once installed, you can then activate and download the current TSHOOT exam from Pearson’s website. Installation of the exam engine takes place in two steps: +Step 1. Install the exam engine from the CD. + +Step 2. Activate and download the TSHOOT practice exam. + + +From the Library of Outcast Outcast +944 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Install the Exam Engine + +The software installation process is routine as compared with other software installation processes. To be complete, the following steps outline the installation process: +Step 1. Insert the CD into your PC. + +Step 2. The software that automatically runs is the Cisco Press software to access and use all CD-based features, including the exam engine and the CD-only appen-dices. From the main menu, click the Install the Exam Engine option. +Step 3. Respond to prompts as with any typical software installation process. + +The installation process gives you the option to activate your exam with the activation code supplied on the paper in the CD sleeve. This process requires that you establish +a Pearson website login. You need this login to activate the exam. Therefore, please do register when prompted. If you already have a Pearson website login, you do not need to register again. Just use your existing login. + +Activate and Download the Practice Exam + +Once the exam engine is installed, you should then activate the exam associated with this book (if you did not do so during the installation process), as follows: +Step 1. Start the Pearson Cert Practice Test (PCPT) software. + +Step 2. To activate and download the exam associated with this book, from the My Products or Tools tab, click the Activate button. + +Step 3. At the next screen, enter the activation key from the paper inside the card-board CD holder in the back of the book. Once entered, click the Activate button. +Step 4. The activation process will download the practice exam. Click Next, and then click Finish. + +Once the activation process is completed, the My Products tab should list your new exam. If you do not see the exam, make sure that you selected the My Products tab on the menu. At this point, the software and practice exam are ready to use. Simply select the exam, and click the Use button. + +To update a particular exam you have already activated and downloaded, simply select the Tools tab, and select the Update Products button. Updating your exams will ensure you have the latest changes and updates to the exam data. + +If you want to check for updates to the Pearson Cert Practice Test exam engine software, simply select the Tools tab, and click the Update Application button. This will ensure you are running the latest version of the software engine. + + + + + + + +From the Library of Outcast Outcast +Chapter 22: Final Preparation 945 + +Activating Other Exams + +The exam software installation process, and the registration process, only has to happen once. Then, for each new exam, only a few steps are required. For instance, if you buy another new Cisco Press Official Cert Guide or Pearson IT Certification Cert Guide, remove the activation code from the CD sleeve in the back of that book; you do not even need the CD at this point. From there, all you have to do is start the exam engine (if not still up and running), and perform Steps 2 through 4 from the previous list. + +Premium Edition + +In addition to the free practice exam provided on the CD-ROM, you can purchase addi-tional exams with expanded functionality directly from Pearson IT Certification. The Premium Edition of this title contains an additional two full practice exams as well as an eBook (in both PDF and ePub format). In addition, the premium edition title also has +remediation for each question to the specific part of the eBook that relates to that ques-tion. + +Because you have purchased the print version of this title, you can purchase the Premium Edition at a deep discount. There is a coupon code in the CD sleeve that contains a one-time use code, as well as instructions for where you can purchase the Premium Edition. + +To view the premium edition product page, go to www.ciscopress.com/ title/9780133414363. + +The Cisco Learning Network + +Cisco provides a wide variety of CCNP Routing and Switching preparation tools at a Cisco website called the Cisco Learning Network. Resources found here include sample questions, forums on each Cisco exam, learning video games, and information about each exam. + +To reach the Cisco Learning Network, go to learningnetwork.cisco.com, or just search for “Cisco Learning Network.” To access some of the features/resources, you need to use the login you created at Cisco.com. If you don’t have such a login, you can register for free. To register, simply go to Cisco.com; click Register at the top of the page; and supply some information. + +Memory Tables + +Like most certification guides from Cisco Press, this book purposefully organizes infor-mation into tables and lists for easier study and review. Rereading these tables can be very useful before the exam. However, it is easy to skim over the tables without paying atten-tion to every detail, especially when you remember having seen the table’s contents when reading the chapter. + +Instead of simply reading the tables in the various chapters, this book’s Appendixes B and C give you another review tool. Appendix C, “Memory Tables,” lists partially completed + + + +From the Library of Outcast Outcast +946 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +versions of many of the tables from the book. You can open Appendix C (a PDF on the CD that comes with this book) and print the appendix. For review, you can attempt to complete the tables. This exercise can help you focus during your review. It also exercises the memory connectors in your brain; plus it makes you think about the information without as much information, which forces a little more contemplation about the facts. + +Appendix D, “Memory Tables Answer Key,” also a PDF located on the CD, lists the completed tables to check yourself. You can also just refer to the tables as printed in the book. + +Chapter-Ending Review Tools + +Chapters 1 through 20 each have several features in the “Exam Preparation Tasks” section at the end of the chapter. You may have used some of or all these tools at the end of each chapter. It can also be useful to use these tools again as you make your final preparations for the exam. + +Suggested Plan for Final Review/Study + +This section lists a suggested study plan from the point at which you finish reading through Chapter 21 until you take the TSHOOT exam. Certainly, you can ignore this plan; use it as is, or just take suggestions from it. + +The plan uses six steps. If following the plan verbatim, you should proceed by part through the steps. That is, starting with Part I (Fundamental Troubleshooting and Maintenance Concepts), do the following six steps. Then, for Part II (Troubleshooting Cisco Catalyst Switch Features), do the following six steps, and so on. The steps are as + +follows: + +Step 1. + + + + +Step 2. + + + +Step 3. + + + +Step 4. + + + +Review key topics and DIKTA questions: You can use the table that lists the key topics in each chapter, or just flip the pages looking for the Key Topic icons. Also, reviewing the DIKTA questions from the beginning of the chapter can be helpful for review. + +Complete memory tables: Open Appendix C on the CD and print the entire appendix, or print the tables by major part. Then complete the tables, and check your answers in Appendix D, which also appears on the CD. + +Hands-on practice: Most people practice CCNP configuration and verifica-tion before the exam. Whether you use real gear, a simulator, or an emulator, practice the configuration and verification commands. + +Build troubleshooting checklists: This is one of the most important things you can do. Start by glancing through the Table of Contents, or even the sections covered in a chapter. For each of the topics you see presented in a section, (for example, VLANs, or EIGRP adjacencies) create a listing (from memory) of all the issues that may arise and then write the solutions to the issues down. Then compare your issues and solutions to those presented in +the chapters. + + + + +From the Library of Outcast Outcast +Chapter 22: Final Preparation 947 + +Step 5. Subnetting practice: If you can no longer do subnetting well and quickly without a subnetting calculator, take some time to get better and faster before going to take the TSHOOT exam. +Step 6. Use the exam engine to practice: The exam engine on the CD can be used to study using a bank of unique exam-realistic multiple-choice questions avail-able only with this book. + +The rest of this section describes Steps 1, 3, 5, and 6 for which a little more explanation might be helpful. + +Step 1: Review Key Topics and DIKTA Questions + +This review step focuses on the core facts related to the TSHOOT exam. The exam certainly covers other topics as well, but the DIKTA questions and the Key Topic items attempt to focus attention on the more important topics in each chapter. + +As a reminder, if you follow this plan after reading the first 20 chapters, working a major part at a time helps you pull each major topic together. + +Step 3: Hands-On Practice + +Although this book gives you many troubleshooting checklists, specific configuration examples, examples of output, and explanations for the meaning of that output, there is no substitute for hands-on practice. This short section provides a few suggestions regard-ing your efforts to practice from the command-line interface (CLI). + +First, most people use one or more of the following options for hands-on skills: + +■ Real gear: Either purchased (often used), borrowed, or rented + +■ Simulators: Software that acts like real gear + +■ Emulators: Software that emulates Cisco hardware and runs Cisco IOS + +For real gear, the minimum recommended home lab configuration would have three ISR (or ISR2) routers running Cisco IOS 15.2 (or later) and 3 Catalyst switches running IOS 15.0 (or later). One switch should be a 3750 or 3560, the others can be 2960s. This would allow you to experiment with most of the routing and switching technologies discussed in this book. + +Pearson IT Certification offers an excellent simulator with nearly 400 structured labs to help you get hands-on experience. Even though the simulator targets the CCNA exam, many of its labs are appropriate for your TSHOOT studies as they will solidify the topics and concepts of routing and switching. You can learn more about the “CCNA Routing and Switching 200-120 Network Simulator” at http://bit.ly/ccnasimulator. + +As for emulators, you can purchase access to emulated routers from the Cisco Learning Network. What you are purchasing is a block of hours to access the emulated gear, along with structured labs to follow. The product is called Cisco Learning Labs, and you can find more information at http://bit.ly/route-emulator. + + +From the Library of Outcast Outcast +948 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Step 5: Subnetting Practice + +This book assumes that you have mastered subnetting and the related math. However, many people who progress through CCNA, and move on to CCNP, follow a path like this: +Step 1. Learn subnetting conceptually. + +Step 2. Get really good at doing the math quickly. + +Step 3. Pass CCNA. + +Step 4. Do not practice regularly and therefore become a lot slower at doing the sub-netting math. + +Step 5. Study for CCNP ROUTE, then SWITCH, then TSHOOT. + +Although subnetting should not be assessed as an end to itself on CCNP TSHOOT, it may be required that you understand subnetting math and do that math just as quickly as you did when you passed CCNA. If you are a little slow on doing subnetting math, before you go to the TSHOOT exam, try some of the following exercises: + +■ Practice finding the subnet number, broadcast address, and range of addresses in a subnet. To do so, pick a network address and mask; calculate the values; and use your favorite subnet calculator to check your work. + +■ Use the Cisco Subnetting Game, also at the Cisco Learning Network. You can find it at http://bit.ly/subnet-game. + +■ Practice choosing the best summary route for a range of subnets. Pick three or four addresses/masks. Calculate the subnet number and range. Then, try to choose the summary (subnet number/mask) that includes those three or four subnets, without including any more subnets than what is required. You can check your math with a subnet calculator. + +If you like performing binary/decimal conversions when you work through these prob-lems, but just need to go faster, check out the Cisco Binary game, also at the Cisco Learning Network. You can find it at http://bit.ly/binary-game. + +Step 6: Use the Exam Engine + +The PCPT engine on the CD lets you access a database of questions created specifically for this book. The PCPT engine can be used either in study mode or practice exam mode, as follows: + +■ Study mode: Study mode is most useful when you want to use the questions for learning and practicing. In study mode, you can select options like randomizing the order of the questions and answers, automatically viewing answers to the questions as you go, testing on specific topics, and many other options. + + + + + +From the Library of Outcast Outcast +Chapter 22: Final Preparation 949 + +■ Practice Exam mode: This mode presents questions in a timed environment, provid-ing you with a more exam realistic experience. It also restricts your ability to see your score as you progress through the exam and view answers to questions as you are taking the exam. These timed exams not only allow you to study for the actual 300-135 TSHOOT exam, they also help you simulate the time pressure that can occur on the actual exam. + +When doing your final preparation, you can use study mode, practice exam mode, or both. However, after you have seen each question a couple of times, you will likely start to remember the questions, and the usefulness of the exam database may go down. So, consider the following options when using the exam engine: + +■ Use the question database for review. Use study mode to study the questions by chapter, just as with the other final review steps listed in this chapter. Consider upgrading to the Premium Edition of this book if you want to take additional simu-lated exams. + +■ Save the question database, not using it for review during your review of each book part. Save it until the end; so you will not have seen the questions before. Then, use practice exam mode to simulate the exam. + +Picking the correct mode from the exam engine’s user interface is pretty obvious. The following steps show how to move to the screen from which you can select the study or practice exam mode: + +The steps are as follows: + +Step 1. Click the My Products tab if you are not already in that screen. + +Step 2. Select the exam you wish to use from the list of available exams. + +Step 3. Click the Use button. + +By taking these actions, the engine should display a window from which you can choose Study Mode or Practice Exam Mode. When in study mode, you can further choose the book chapters, limiting the questions to those explained in the specified chapters of the book. + +Summary + +The tools and suggestions listed in this chapter have been designed with one goal in mind: to help you develop the skills required to pass the TSHOOT exam. This book has been developed from the beginning to not just tell you how to troubleshoot, but also help you learn how to successfully apply your troubleshooting efforts. No matter what your experience level is leading up to when you take the exam, it is my hope that the broad range of preparation tools, and even the structure of the book, can help you pass the exam with ease. I wish you all the best in your studies and on your exam. + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPENDIX A + + + + +Answers to the “Do I Know This Already” Quizzes + + +Chapter 1 Chapter 2 + + +1. B, C, and D + +2. D + +3. B + +4. B and D + +5. A + +6. B + +7. B + +8. D + +9. C + +1. A, C, and D + +2. A, B, and D + +3. C + +4. B + +5. B + +6. A and D + +7. C + +8. A + +9. C + + + +10. A, C, and D + +11. B and C + +12. C + +13. D + +14. A + +10. B + +11. C + +12. C + + +Chapter 3 + + + +15. C and D + +16. A, B, and D + +17. B + +18. A, C, and D + +19. A, B, and D + +20. A and C + +1. B and C + +2. B and C + +3. A, B, and D + +4. B + +5. B + +6. D + +7. D + +8. A and B + + + + + + + +From the Library of Outcast Outcast +952 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 4 6. A 1. C 7. C 2. D 8. C 3. D 9. D 4. A and B 10. C + +5. C and D + +6. C + +7. C + +8. A and B + +9. D + +10. A and B + + +Chapter 7 1. B +2. B and C + +3. B and C + +4. A and B + +5. B + + +Chapter 5 6. A and B 1. C 7. C +2. A 8. B +3. B 9. C and D 4. C 10. D + +5. A and C + +6. B and D + +7. C + +8. B + +9. A, B, and C + +10. C + + +Chapter 8 1. B +2. A + +3. C + +4. B and D + +5. C + + +Chapter 6 6. A and C + +1. A + +2. D + +3. A and C + +7. C and D + +8. D + +9. B + +4. B 10. A and C + +5. C + + + + + + +From the Library of Outcast Outcast +Appendix A: Answers to the “Do I Know This Already” Quizzes 953 + +Chapter 9 7. D 1. B and D 8. D 2. A and C 9. A 3. A 10. A +4. B +5. D Chapter 12 +6. B 1. A and B 7. C 2. C and D 8. C 3. C +9. B 4. A, B, and C 10. B 5. D +6. B + +Chapter 10 7. B 1. C 8. C 2. C 9. D + +3. B and C + +4. A + +5. A, B, and C + +6. C + +10. C + +11. B + +12. A + +13. B and D + + +7. D +8. C Chapter 13 +9. C 1. D 10. C 2. C 3. A + +Chapter 11 4. B and C 1. D 5. C +2. C 6. D +3. B 7. A and C 4. C 8. A +5. B 9. A +6. B and D 10. A, B, and C + + + + +From the Library of Outcast Outcast +954 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 14 5. D 1. B 6. A 2. A, B, and D 7. A + +3. A + +4. C + +5. A, B, and C + +6. C + +7. A + +8. A + +9. A + +10. C + +11. A and B + + +Chapter 17 1. C +2. A and B + +3. C + +4. D + +5. A + +6. A + +7. C + +8. C + + +Chapter 15 9. D +1. A, B, and C 10. A, B, and C + + +2. C and D + +3. B + +4. B + +5. A + +6. C + +7. B + +8. D + +9. B and C + +10. A + + +Chapter 18 1. C and D +2. C + +3. B and C + +4. C + +5. B + +6. B, C, and D + +7. B + +8. C + + +Chapter 16 9. A +1. B 10. A and D 2. A 11. A +3. B 12. A and C 4. C 13. A + + + + + +From the Library of Outcast Outcast +Appendix A: Answers to the “Do I Know This Already” Quizzes 955 + +Chapter 19 Chapter 20 + + +1. C + +2. D + +3. D + +4. C + +5. A + +6. B and D + +7. B + +8. A and D + +9. C and D + +1. A and C + +2. C + +3. A + +4. B + +5. A + +6. B + +7. D + +8. B + +9. D + + +10. A, C, and D 10. B + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPENDIX B + + + + + + +TSHOOT Exam Updates + + +Over time, reader feedback allows Cisco Press to gauge which topics give our readers the most problems when taking the exams. To assist readers with those topics, the authors create new materials clarifying and expanding on those troublesome exam topics. As mentioned in the Introduction, the additional content about the exam is contained in +a PDF document on this book’s companion website, at http://www.ciscopress.com/ title/9781587205613. + +This appendix is intended to provide you with updated information if Cisco makes minor modifications to the exam upon which this book is based. When Cisco releases an entirely new exam, the changes are usually too extensive to provide in a simple update appendix. In those cases, you might need to consult the new edition of the book for the updated content. + +This appendix attempts to fill the void that occurs with any print book. In particular, this appendix does the following: + +■ Mentions technical items that might not have been mentioned elsewhere in the book + +■ Covers new topics if Cisco adds new content to the exam over time + +■ Provides a way to get up-to-the-minute current information about content for the exam + + +Always Get the Latest at the Companion Website + +You are reading the version of this appendix that was available when your book was printed. However, given that the main purpose of this appendix is to be a living, changing document, it is important that you look for the latest version online at the book’s com-panion website. To do so, complete these steps: +Step 1. Browse to http://www.ciscopress.com/title/9781587205613. + +Step 2. Select the Appendix option under the More Information box. + +Step 3. Download the latest Appendix B document. + + + + + + + + + +From the Library of Outcast Outcast +958 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Note Note that the downloaded document has a version number. Comparing the version of the print Appendix B (Version 1.0) with the latest online version of this appendix, you should do the following: +■ Same version: Ignore the PDF that you downloaded from the companion website. +■ Website has a later version: Ignore this Appendix B in your book and read only the lat-est version that you downloaded from the companion website. + + + +Technical Content + +The current version of this appendix does not contain any additional technical coverage. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + +This page intentionally left blank + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + +Index + + + + + + + + +Numbers !H, 491 +2Way, adjacency states, 591 802.1Q trunking, 33, 141 + +A + +AAA (Cisco IOS), 858-861 access control, 273 +protected ports, 273-275 +PVLANs (private VLANs), 275-279 +VACLs (VLAN access control lists), 279 +access trunking mode, 143 verifying, 143 +accounting management, FCAPS, 28 ACLs, 279 +BGP (Border Gateway Protocol), neighbor adjacencies, 759-761 +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 527-528 IPv6, 564 +IPv6 ACLs. See IPv6 ACLs OSPFv2, 601-602 +RIPng (RIP next generation), 496-497 RIPv2, 485 +verifying, IPv4 ACLs, 406 +activating PCPT (Pearson Cert Practice Test), 944 + + +active virtual forwarder. See AVF (active virtual forwarder) +active virtual gateway. See AVG (active virtual gateway) +AD (administrative distance), 437-438 +adapting network maintenance mod-els, 28-29 +adding +HTTP server login credentials to router configurations, 49 +login credentials, FTP servers, 49 +address families. See AFs (address families) +addressing +IPv4 addressing. See IPv4 addressing +NAT (Network Address Translation). See NAT (Network Address Translation) +adjacency states, 591 adjacency tables, 431 +administrative distance of route sources, 437 +advanced redistribution, 737 routing loops, 739-744 suboptimal routing, 737-739 +advanced tools, 57 NetFlow, 57-61 +SNMP (Simple Network Management Protocol), 57-59 +ADVERTISE, 384 +AFs (address families), OSPFv3, 655 - 664 +trouble tickets, 664-668 + + + +From the Library of Outcast Outcast + + + + + + + + + + + +Align-Err, 98 +allowed VLANs, trunks, 147-148 answers to quizzes. See Appendix A archive configuration, confirming, 51 archived configurations, restoring, 53 +area numbers, mismatched area num-bers, OSPFv2, 596-597 +area types, mismatched area types, OSPFv2, 597-598 +ARP (Address Resolution Protocol), 371 ARP cache +MAC address lookup, 440 proxy ARP enabled, 442 +ARP Input process, 107-108 ARP reply, 135-137 +ARP requests, 133-135 +ASBR (Autonomous System Boundary Router), redistribution, 712 +assignments, IPv6 addressing, 375 +stateless address autoconfiguration/ SLAAC, 375-380 +attempt, adjacency states, 591 authentication +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 525-527 IPv6, 562-563 +mismatched authentication +BGP (Border Gateway Protocol), 763-764 +OSPFv2, 600-601 +RIPv2, 477-479 + +automated backups, confirming, 51 automatic archive configuration, 50 automating documentation, 35 autonomous system numbers +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 518-520 IPv6, 562 +private autonomous system numbers, BGP path selection, 784 +autosummarization, RIPv2, 482-483 +AVF (active virtual forwarder), 318-323 +AVG (active virtual gateway), 318 + +B + +backing up router start up configura-tion +to FTP servers, 48-53 +on FTP servers without specifying login credentials, 49 +backplane, Cisco Catalyst switches, 96 +bad or missing network statements, RIPv2, 470-471 +baseline data, 15 baselines +creating +with NetFlow, 58 with SNMP, 58 +establishing, 36 + + + +From the Library of Outcast Outcast +962 basic tools + + +basic tools, 47 +best path decision-making process, BGP (Border Gateway Protocol), 780-784 +BGP (Border Gateway Protocol), 123-124, 748 +Do I Know This Already? quizzes, 748 - 752 +neighbor adjacencies, 753-754 ACLs, 759-761 +BGP packets sourced from wrong IP address, 758-759 +incorrect neighbor statement, 757 - 758 +interface is down, 754 +Layer 3 connectivity, 754-755 +misconfigured peer groups, 764 - 765 +mismatched authentication, 763 - 764 +neighbor does not have a route to local router, 756-757 +path to neighbor is via default route, 755-756 +timers, 765-766 +TTL of BGP packet expires, 761-763 +redistribution, 715-718 trouble tickets, 791, 910-918 +trouble ticket 18-1, 791-796 trouble ticket 18-2, 796-802 trouble ticket 18-3, 802-806 +BGP for IPv6, 786-790 +BGP packets sourced from wrong IP address, 758-759 +BGP path selection, 780 +best path decision-making process, 781 - 784 +debug, 784-786 +private autonomous system numbers, 784 + +BGP routes, 766-768 +missing or bad network mask com-mand, 768-770 +next-hop router not reachable, 770-772 route filtering, 775-780 +source information, 773-775 split horizon, 772-773 +blocking nondesignated port (X), 177 +Border Gateway Protocol (BGP). See BGP (Border Gateway Protocol) +bottom-up method, 21-22 BPDU Filter, 187-188 BPDU Guard, 184-187 +branch, GRE tunnel configuration, 451 +broadcast storms, STP (Spanning-Tree Protocol), 181-182 +buffer leaks, 122-123 + +C + +Carri-Sen, 98 +CEF (Cisco Express Forwarding), 115-116, 431 +change management, troubleshooting, 37-38 +Cisco Catalyst switches +mismatched duplex settings, 99-101 port errors, 97-98 +STP (Spanning-Tree Protocol) topology, 177 +troubleshooting, 96-97 +Cisco Express Forwarding (CEF), 115 - 116 , 431 +Cisco IOS, 64 AAA, 858-861 +collect information, 68-69 +filtering output of show com-mands, 69-73 + + + + +From the Library of Outcast Outcast +CPU utilization, excessive CPU utilization 963 + + +ping, 64-66 telnet, 67 traceroute, 67-68 troubleshooting +hardware, 74 +high processor utilization, 108 - 113 +Cisco IOS IP SLA, 827-833 Cisco Learning Network, 945 Cisco Lifecycle Services, 28 Cisco Support tools, 64 +clear ip nat translation, 354 +CLI (command-line interface), 47 CLI tools, 47-48 +collect information Cisco IOS, 68-69 +filtering output of show com-mands, 69-73 +STP (Spanning-Tree Protocol), 177 +gathering STP information, 177 - 179 +MSTP (Multiple Spanning Tree Protocol), 179-180 +structured troubleshooting, 14 in transit, 75 +packet captures, 75-76 +RSPAN (Remote SPAN), 78-79 +SPAN (Switched Port Analyzer), 76-78 +commands +network mask command, BGP (Border Gateway Protocol), 768-770 +OSPFv3, IPv6, 641-647 +communication, troubleshooting, 36 - 37 + + +comparing +HSRP, VRRP, and GLBP, 330 +running configuration and startup con-figuration before issuing the copy command, 52 +trunking administrative modes, 145 +comparing configurations method, 23 - 24 +component swapping method, 24-25 configuration archives, viewing, 50 +configuration changes, routine mainte-nance tasks, 29 +configuration information, documenta-tion, 33 +configuration management, FCAPS, 28 configuration merge, witnessing, 53 configuring, routed ports, SW1, 237 CONFIRM, 384 +confirming +archive configuration, 51 automated backups, 51 +console access, 854-855 console line, 854 +control plane, Cisco Catalyst switches, 96 +converging after a failure, HSRP (Hot Standby Router Protocol), 291 +copy command, comparing running con-figuration and startup configuration, 52 +corrupt switches, troubleshooting, MAC address tables, 180-181 +COUNTER_RESET command, 63 +CPU utilization, excessive CPU utiliza-tion. See excessive CPU utilization + + + + + + + + + +From the Library of Outcast Outcast +964 DAI (dynamic ARP inspection) + + +D + +DAI (dynamic ARP inspection), 267 - 268 +data structures, routing information sources, 436 +debug +BGP path selection, 784-786 +HSRP (Hot Standby Router Protocol), 296-297 +RIPng (RIP next generation), 494 +verifying, PBR (policy-based routing), 691 +debug ip bgp, 785 +debug ip bgp updates, 786 debug ip dhcp server events, 349 +debug ip dhcp server packet, 349-350 debug ip nat, 355 +debug ip ospf adj, 601 debug ip ospf hello, 598 debug ip policy, 684 +debug ip policy output, 689 debug ip rip, 469, 477 debug ip routing, 785 debug standby terse, 296 DECLINE, 384 +default gateways, verifying, 380 default port costs +STP (Spanning-Tree Protocol), 175 default routes +OSPFv2, 627 +RIPng (RIP next generation), 495-496 +default trunking mode on SW2, verify-ing, 145 +deny sequence, 679 designated ports +STP (Spanning-Tree Protocol), 176 + + +destination routing protocol, 702 device logs, 54 +device performance, quizzes, 92-95 +DHCP (Dynamic Host Configuration Protocol), 334 +IPv4 addressing, 342 +reviewing DHCP operations, 342 - 347 +troubleshooting issues, 347-348 message types, 384 +stateful DHCPv6, 381-382 stateless DHCPv6, 382-384 +DHCP (Dynamic Host Configuration Protocol) IPv4 addressing trouble-shooting commands, 348-350 +DHCP snooping, 265-267 verifying, 266 +DHCP snooping bindings, verifying, 267 DHCPv6, 384 +DHCPv6 relay agent, 385-386 diagnosing problems, 10 different subnets +EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4, 524-526 +OSPFv2, 598-599 +discontiguous areas, OSPFv2, 624-626 +discontiguous networks and autosum-marization, EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4 issues, 542-543 +displaying, OSPFv3 routes, 646 +distribute-list, EIGRP (Enhanced Interior Gateway Routing Protocol), 535 +divide-and-conquer method, 22 +Do I Know This Already? quizzes, 2-8, 128-131 +addressing, 334-337 +answers. See Appendix A + + + + + + +From the Library of Outcast Outcast +EIGRP (Enhanced Interior Gateway Routing Protocol) 965 + + +BGP (Border Gateway Protocol), 748 - 752 +device performance, 92-95 +EIGRP (Enhanced Interior Gateway Routing Protocol), 512-516 +first-hop redundancy protocols, 286-289 +Inter-VLAN routing, 208-211 +IPv4 ACLs, IPv6 ACLs, prefix lists, 396 - 400 +IPv4/IPv6 routing and GRE tunnels, 422-426 +IPv6 addressing, 366-369 maintenance tools, 40-44 management access, 850-853 management protocols, 814-817 +OSPF (Open Shortest Path First), 586 - 589 +redistribution, 696-699 +RIPng (RIP next generation), 462-465 RIPv2, 462-465 +route maps and policy-based routing, 674-677 +STP (Spanning-Tree Protocol), 168-171 switch security, 246-249 +do not fragment bit set, pinging, 65 documentation, 16 +automating, 35 +maintaining current network documen-tation, 35 +network maintenance, 32-33 +domain name mismatch, VTP domain name mismatch, 148-149 +down, adjacency states, 591 +downloading, PCPT (Pearson Cert Practice Test), 944 +DP (designated port), 174 +DR (designated router), verifying, 617 - 618 + + +duplicate router IDs OSPFv2, 603-604 OSPFv2 routes, 619-620 +dynamic ARP inspection (DAI), 267 - 268 +dynamic auto, 143 dynamic desirable, 143 +verifying, 144 + +E + +eBGP, TTLs, 761-763 +EIGRP (Enhanced Interior Gateway Routing Protocol), 462, 512 +Do I Know This Already? quizzes, 512-516 +IPv4, 517 +ACLs, 527-528 authentication, 525-527 different subnets, 524-526 +incorrect network statements, 520 - 522 +interface is down, 518 +mismatched autonomous system numbers, 518-520 +mismatched K values, 522-523 neighbor adjacencies, 517-518 passive interface feature, 523-524 redistribution, 707 +timers, 528 +trouble ticket 14-1, 546-553 trouble ticket 14-2, 553-557 trouble ticket 14-3, 557-560 trouble tickets, 546 +IPv4 issues, 539 +discontiguous networks and auto-summarization, 542-543 +load balancing, 544-545 + + + + + +From the Library of Outcast Outcast +966 EIGRP (Enhanced Interior Gateway Routing Protocol) + + +route summarization, 543-544 successors, 539-542 +IPv4 routes, 528-530 +bad or missing network com-mands, 529-530 +interface is down, 537 route filtering, 534-535 +source information, 533-534 split horizon, 537-539 +stub configuration, 535-537 IPv6, 561 +ACLs, 564 +interface is down, 561-562 +interface not participating in rout-ing process, 563-564 +mismatched authentication, 562 - 563 +mismatched autonomous system numbers, 562 +mismatched K values, 562 neighbor issues, 561 +passive interface feature, 562 redistribution, 706 +timers, 563 +trouble ticket 14-4, 568-571 trouble tickets, 567 +IPv6 route, 564 +interface not participating in rout-ing process, 564 +route filtering, 565 source information, 565 split horizon, 566-567 +stub configuration, 565-566 named EIGRP configurations, 572-573 +trouble ticket 14-5, 577-581 trouble tickets, 577 +verification commands, 573-576 + +redistribution, 706-710 trouble tickets, 880-883 +EIGRP routes, verifying, 686-687 +eliminate potential causes, structured troubleshooting, 16-17 +EMM applets, 63 +EMM configuration, testing, 63-64 +encapsulation mismatch, trunks, 141 - 142 +end-user IP addresses, verifying, 153 +Enhanced Interior Gateway Routing Protocol. See EIGRP (Enhanced Interior Gateway Routing Protocol) +entries, verifying, 448 +err-disable reason, 259-260 +err-disable recovery feature, 258-259 err-disabled state, 255-257 +error message, SW1, 236 EtherChannel +Layer 3 EtherChannel, 237-239 options for forming, 238 trouble tickets, 200 +trouble ticket 5-4, 201-204 trouble ticket 5-5, 204-205 +EtherChannel modes, 199 Ethernet switches, 132 EUI-64, 373-375 +Exam Engine, installing, 944 +examine collected information, struc-tured troubleshooting, 15-16 +exams, study plans, 946-949 Excess-Col, 98 +excessive BGP memory use, 123-124 excessive CPU utilization, 107 +processes that cause excessive CPU uti-lization, 107-113 +excessive memory utilization, router performance issues, 121 + + + + + +From the Library of Outcast Outcast +GUI tools 967 + + +exchange, adjacency states, 591 +exit interface specified, static routes, 441 +exstart, adjacency states, 591 +extended numbered ACL, IPv4 ACLs, 402 + +F + +failed pings, 214-215 fast switching, 114-115 +fault management, FCAPS, 28 FCAPS, 28 +FCS-Err, 98 +FHRPs (first-hop routing protocols), 834 +FIB (Forwarding Information Base), 431 +files, redirecting show command output to, 73-74 +filtering +IPv4 ACLs, 403 IPv6 ACLs, 409-410 +filtering output of show commands, show processes cpu, 70 +first hop, verifying +GLBP (Gateway Load Balancing Protocol), 325-326 +HSRP (Hot Standby Router Protocol), 294-296 +VRRP (Virtual Router Redundancy Protocol), 310-312 +first-hop redundancy protocols, Do I Know This Already? quizzes, +286 - 289 +first-hop routing protocols (FHRPs), 834 +following the traffic path method, 23 forwarding, nondesignated port (X), 177 +Forwarding Information Base (FIB), 431 + +forwarding logic, Cisco Catalyst switches, 96 +frame-forwarding process, 132-140 FTP servers +adding login credentials, 49 +backing up router start up configura-tion, 49 +full, adjacency states, 591 + +G + +Gateway Load Balancing Protocol. See GLBP (Gateway Load Balancing Protocol) +generic routing encapsulation. See GRE (generic routing encapsulation) +Giants, 98 +GLBP (Gateway Load Balancing Protocol), 318 +comparing to HSRP and VRRP, 330 object tracking, 323-325 +reviewing, 319-321 trouble tickets, 326 +trouble ticket 8-6, 327-329 trouble ticket 8-7, 329-330 +verifying, 321-323 first hop, 325-326 +virtual router MAC address, 323 GRE (generic routing encapsulation) +IPsec modes, 457 +troubleshooting considerations, 453 - 454 +tunnels, 450-458 IPv6 traffic, 455 +GRE tunnels, 450-458 +GUI (graphical user interface), 47 +GUI tools, 48 + + + + + +From the Library of Outcast Outcast +968 hardware + + +H hardware +troubleshooting, Cisco IOS, 74 high CPU utilization +switch performance issues, 105-106 +high processor utilization, troubleshoot-ing, 108-113 +higher revision number, VTP (VLAN Trunking Protocol), 151-152 +Hot Standby Router Protocol. See HSRP (Hot Standby Router Protocol) +HQ, GRE tunnel configuration, 451 +HSRP (Hot Standby Router Protocol), 290 +comparing to VRRP and GLBP, 330 converging after a failure, 291 debug, 296-297 +interface tracking, 293-294 reviewing, 290-291 +trouble tickets, 297, 876-880 trouble ticket 8-1, 297-300 trouble ticket 8-2, 300-302 trouble ticket 8-3, 302-306 +verifying, 292-293 first hop, 294-296 +virtual router MAC address, 293 +HTTP server login credentials to router configurations, adding, 49 +hypothesis +proposing, structured troubleshooting, 17-18 +verifying, structured troubleshooting, 18 + +I identifying +security violations, 255 wedged interfaces, 122 +inappropriate EtherChannel distribution algorithm, Layer 3 EtherChannel, 238 +incompatible trunking modes, 143-146 +incorrect IP addressing, VLANs, 152 - 153 +incorrect neighbor statement, BGP (Border Gateway Protocol), neighbor adjacencies, 757-758 +incorrect network statements, EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4, 520-522 +incorrect port assignments, VLANs, 154-155 +information collection, 45-46 INFORMATION-REQUEST, 384 init, adjacency states, 591 +inside global +NAT (Network Address Translation), 352 +inside local NAT IPs, 352 +installing Exam Engine, 944 inter-VLAN routing +Do I Know This Already? quizzes, 208 - 211 +issues that prevent, 213 +router-on-a-trunk/stick, 212-213 +SVIs (switched virtual interfaces). See SVIs (switched virtual interfaces) +interface IP addresses, verifying, 471 interface is down +BGP (Border Gateway Protocol), neigh-bor adjacencies, 754 + + + + + + +From the Library of Outcast Outcast +IPv4 addressing 969 + + +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 518 +IPv4 routes, 537 IPv6, 561-562 +OSPFv2, 593 OSPFv2 routes, 614 +interface tracking, HSRP (Hot Standby Router Protocol), 293-294 +interfaces +RIPv2, shut down interfaces, 469 +SVIs. See SVIs (switched virtual inter-faces) +interrupt-driven tasks, 27 +inventory of network equipment, docu-mentation, 32 +IP address assignments, documentation, 32 +IP addresses +determining IP addresses within sub-nets, 341-342 +verifying, end-user IP addresses, 153 IP addressing, verifying, 340-341 +IP Background process, 108 +IP helper address, verifying, 360 ip policy route-map, 692 +IP routing tables, 430 +IP Source Guard, 268-269 verifying, 269 +ipconfig, 360 PC1, 215 +verifying IP addresses, 342 ipconfig/all, 216 +IPsec modes, GRE (generic routing encapsulation), 457 + + +IPv4 +EIGRP (Enhanced Interior Gateway Routing Protocol), 517 +ACLs, 527-528 authentication, 525-527 different subnets, 524-526 +discontiguous networks and auto-summarization, 542-543 +incorrect network statements, 520 - 522 +interface is down, 518 load balancing, 544-545 +mismatched autonomous system numbers, 518-520 +mismatched K values, 522-523 neighbor adjacencies, 517-518 passive interface feature, 523-524 route summarization, 543-544 successors, 539-542 +timers, 528 +trouble ticket 14-1, 546-553 trouble ticket 14-2, 553-557 trouble ticket 14-3, 557-560 trouble tickets, 546 +prefix lists, 414 +redistribution. See redistribution IPv4 ACLs, 401 +filtering, 403 reading, 401-402 time-based, 403-404 +trouble tickets, 405-407 IPv4 addressing, 338 +determining IP addresses within sub-nets, 341-342 +DHCP (Dynamic Host Configuration Protocol), 342 +reviewing DHCP operations, 342-347 + + + + + +From the Library of Outcast Outcast +970 IPv4 addressing + + +troubleshooting commands, 348 - 350 +troubleshooting issues, 347-348 issues, 338-341 +trouble tickets, 356 +trouble ticket 9-1, 356-358 trouble ticket 9-2, 358-361 trouble ticket 9-3, 361-363 +IPv4 routes, EIGRP (Enhanced Interior Gateway Routing Protocol), 528-530 +bad or missing network commands, 529-530 +interface is down, 537 route filtering, 534-535 +source information, 533-534 split horizon, 537-539 +stub configuration, 535-537 IPv4 static routes, 439-443 IPv6, 334 +BGP for IPv6, 786-790 +EIGRP (Enhanced Interior Gateway Routing Protocol), 561 +ACLs, 564 +interface is down, 561-562 +interface not participating in rout-ing process, 563-564 +mismatched authentication, 562 - 563 +mismatched autonomous system numbers, 562 +mismatched K values, 562 neighbor issues, 561 timers, 563 +trouble ticket 14-4, 568-571 trouble tickets, 567 +OSPFv3, 641 +troubleshooting commands, 641 - 647 +redistribution. See redistribution + +IPv6 ACLs, 407 filtering, 409-410 reading, 408-409 +trouble tickets, 410-414 IPv6 addressing, 370 +assignments, 375 +stateless address autoconfigura-tion/SLAAC, 375-380 +DHCPv6, 384 +DHCPv6 relay agent, 385-386 +Do I Know This Already? quizzes, 366 - 369 +EIGRP (Enhanced Interior Gateway Routing Protocol), passive interface feature, 562 +EUI-64, 373-375 +NS (Neighbor Solicitation), 370-373 reviewing, 370 +stateful DHCPv6, 381-382 stateless DHCPv6, 382-384 trouble tickets, 386 +trouble ticket 10-1, 386-389 trouble ticket 10-2, 389-393 +tunnel interface, 457 +IPv6 route, EIGRP (Enhanced Interior Gateway Routing Protocol), 564 +interface not participating in routing process, 564 +route filtering, 565 source information, 565 split horizon, 566-567 +stub configuration, 565-566 IPv6 static routes, 443-445 +IPv6 unicast, RIPng (RIP next genera-tion), 492 +ISL (Inter-Switch Link), 141 issuing pings, from PC1, 158 +ITIL (IT Infrastructure Library), 28 + + + + +From the Library of Outcast Outcast +maintenance procedures, 29 971 + + +J-K + +K values, EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 522-523 IPv6, 562 + +L + +LACP (Link Aggregation Control Protocol), 239 +Late-Col, 98 +Layer 2 EtherChannel, 199 reviewing, 199 +Layer 2 loops, 172 +Layer 2 switch communication, trouble-shooting, 140 +Layer 2 trouble tickets, 157 trouble ticket 4-1, 158-160 trouble ticket 4-2, 160-164 +Layer 3 connectivity, BGP (Border Gateway Protocol), neighbor adjacen-cies, 754-755 +Layer 3 EtherChannel, 237-239 trouble tickets, 239-243 +Layer 3 packet-forwarding process, 427-431 +Layer 3 switch, routed ports, 233-234 Layer 3 to Layer 2 mapping table, 430 learning, nondesignated port (X), 177 +Link Aggregation Control Protocol (LACP), 239 +listening, nondesignated port (X), 177 listing of interconnections, 32 +load balancing +EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4 issues, 544 - 545 + + +OSPFv2, 626-627 +RIPng (RIP next generation), 495 load sharing, RIPv2, 485-486 loading, adjacency states, 591 logging configurations, 55 logging tools, 53-55 +severity levels, 54 +logic of route maps, 680 logical topology diagrams, 32 login credentials +adding to router configurations, 49 +HTTP servers, adding to router configu-rations, 49 +Loop Guard, 190 +LSAs (link-state advertisements), 712 OSPF (Open Shortest Path First), +LSDB, OSPFv3, 644 + +M + +MAC address lookup, ARP cache, 440 MAC address tables, 155-157 +troubleshooting corrupt switches, 180 - 181 +MAC addresses Ethernet switches, 132 +IP MAC filtering without port security, 269 +maximum number reached, 253-254 static MAC addresses, 251-253 +maintenance procedures, 29 network changes, managing, 30-31 network documentation, 32-33 +network performance, measuring, 34 restoring operations after a failure, 33-34 +routine maintenance tasks, 29-30 + + + + + + +From the Library of Outcast Outcast +972 maintenance procedures + + +scheduled maintenance, 30 troubleshooting +change management, 37-38 communication, 36-37 establishing baselines, 36 +maintenance tools advanced tools, 57 basic tools, 47 +Cisco Support tools, 64 CLI tools, 47-48 +GUI tools, 48 logging tools, 53-55 +network documentation tools, 46-47 NTP (Network Time Protocol), 56-57 recovery tools, 48-53 +management access +Cisco IOS AAA, 858-861 +Do I Know This Already? quizzes, 850 - 853 +password encryption levels, 858 SSH (Secure Shell), 857-858 Telnet, 855-857 +trouble tickets, 861, 918-922 trouble ticket 20-1, 862-863 trouble ticket 20-2, 864-865 trouble ticket 20-3, 865-867 +vty access, 855 +management access console access, 854-855 +management protocols, 818 Cisco IOS IP SLA, 827-833 +Do I Know This Already? quizzes, 814 - 817 +NTP (Network Time Protocol), 818-821 +SNMP (Simple Network Management Protocol), 823-826 +syslog, 821-823 +trouble tickets, 837-844 + + +management tools, 826-827 object tracking, 833-834 +RSPAN (Remote SPAN), 835-837 +SPAN (Switched Port Analyzer), 835 - 837 +managing network changes, 30-31 +max hop count exceeded, RIPv2, 475 - 477 +measuring, network performance, 34 memory-allocation failure, 122 +memory leaks, router performance issues, 121-122 +memory tables, 945 +message types, DHCP (Dynamic Host Configuration Protocol) , 384 +metrics, routing protocols, 701 +misconfigured peer groups, BGP (Border Gateway Protocol), neighbor adjacen-cies, 764-765 +mismatched area numbers, OSPFv2, 596-597 +mismatched area types, OSPFv2, 597 - 598 +mismatched authentication +BGP (Border Gateway Protocol), neigh-bor adjacencies, 763-764 +EIGRP (Enhanced Interior Gateway Routing Protocol), IPv6, 562-563 +OSPFv2, 600-601 +mismatched autonomous system num-bers, EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 518-520 IPv6, 562 +mismatched duplex settings, Cisco Catalyst switches, 99-101 +mismatched EtherChannel configura-tion, Layer 3 EtherChannel, 238 + + + + +From the Library of Outcast Outcast +Net Background 973 + + +mismatched K values, EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 522-523 IPv6, 562 +mismatched network types, OSPFv2, 604-605 +mismatched port configurations, Layer 3 EtherChannel, 237 +mismatched timers, OSPFv2, 594-595 missing default route, RIPv2, 486-487 missing routes, RIPv2, 466-468 missing VLANs, 153-154 +mode mismatch, VTP (VLAN Trunking Protocol), 149-150 +modifying route map configuration, 688 monitoring network performance, 30 MP-BGP, trouble tickets, 807-809 +MSTP (Multiple Spanning Tree Protocol), 179-180 +MTU (maximum transmission unit), 65 MTU mismatch, OSPFv2, 602-603 Multi-Col, 98 +Multiple Spanning Tree Protocol (MSTP), 179-180 + +N + +named ACL configuration mode, IPv4 ACLs, 406-407 +named EIGRP configurations, 572-573 trouble tickets, 577-581 +verification commands, 573-576 +NAT (Network Address Translation), 350 +names of IP addresses, 352 reviewing, 350-352 +trouble tickets, 923-926 + +troubleshooting commands, 354-355 troubleshooting issues, 353-354 +native VLAN mismatch, trunks, 146 - 147 +NDP (Neighbor Discovery Protocol), 371 +neighbor adjacencies +BGP (Border Gateway Protocol), 753 - 754 +ACLs, 759-761 +BGP packets sourced from wrong IP address, 758-759 +incorrect neighbor statement, 757-758 +interface is down, 754 +Layer 3 connectivity, 754-755 +misconfigured peer groups, 764 - 765 +mismatched authentication, 763 - 764 +neighbor does not have a route to local router, 756-757 +path to neighbor is via default route, 755-756 +timers, 765-766 +TTL of BGP packet expires, 761 - 763 +EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4, 517-518 +OSPFv2, 590-593 +neighbor advertisement, IPv6 address-ing, 370-373 +Neighbor Discovery Protocol. See NDP (Neighbor Discovery Protocol) +neighbor issues, EIGRP (Enhanced Interior Gateway Routing Protocol), IPv6, 561 +neighbor remote-as, 758 +Net Background, 108 + + + + + + +From the Library of Outcast Outcast +974 NetFlow + + +NetFlow, 57-61 baselines, creating, 58 +Network Address Translation. See NAT (Network Address Translation) +network changes, managing, 30-31 +network commands, EIGRP (Enhanced Interior Gateway Routing Protocol, IPv4 routes, 529-530 +network documentation, 32-33 +network documentation tools, 46-47, 80-84 +network events, notifications, 61-64 network maintenance, 26 +defining, 26-27 +proactive versus reactive, 27-28 troubleshooting, 34-35 +maintaining current network doc-umentation, 35 +network maintenance models, 28 adapting, 28-29 +network mask command, BGP routes, 768-770 +network performance measuring, 34 monitoring, 30 +network statements +EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4, 520-522 +RIPv2, 470-471 +Network Time Protocol. See NTP (Network Time Protocol) +network types, mismatched network types, OSPFv2, 604-605 +Next-Hop option, static routes, IPv4, 439-443 +Next Hop Resolution Protocol (NHRP), 434 +next-hop router not reachable, BGP routes, 770-772 + +NHRP (Next Hop Resolution Protocol), 434 +nondesignated port (X), 174 +STP (Spanning-Tree Protocol), 176-177 +nonroot bridges, STP (Spanning-Tree Protocol), 173 +notifications, for network events, 61-64 +NS (Neighbor Solicitation), IPv6 addressing, 370-373 +NTP (Network Time Protocol), 56-57, 818-821 +adding source command, 844 + +O + +object tracking, 833-834 +GLBP (Gateway Load Balancing Protocol), 323-325 +VRRP (Virtual Router Redundancy Protocol), 309-310 +Open Shortest Path First. See OSPF (Open Shortest Path First) +operations, STP (Spanning-Tree Protocol), 173-175 +original design documents, documenta-tion, 33 +OSPF authentication keys, verifying, 600 +OSPF distribute list command, verifying, 612 +OSPF LSAs, 621 +OSPF (Open Shortest Path First), 462, 586 +Do I Know This Already? quizzes, 586 - 589 +LSAs +for OSPF v3 redistribution, 710 +trouble tickets, 884-901 + + + + + +From the Library of Outcast Outcast +passive interface feature 975 + + +OSPFv2, 590 +ACLs (access control lists), 601-602 default routes, 627 +different subnets, 598-599 discontiguous areas, 624-626 duplicate router IDs, 603-604 interface is down, 593 +interface not running the OSPF process, 593-594 +load balancing, 626-627 mismatched area numbers, 596-597 mismatched area types, 597-598 mismatched authentication, 600-601 mismatched network types, 604-605 mismatched timers, 594-595 +MTU mismatch, 602-603 neighbor adjacencies, 590-593 passive interface feature, 599 +redistributed routes in RIP domain, 713 route summarization, 622-624 +trouble tickets, 627 +trouble ticket 15-1, 628-635 trouble ticket 15-2, 635-639 troubled ticket 15-3, 639-641 +OSPFv2 redistributed routes, 712 OSPFv2 routes, 606 +duplicate router IDs, 619-620 interface is down, 614 +interface not running the OSPF process, 606-607 +route filtering, 611-613 source information, 607-610 +stub area configuration, 613-614 +wrong designated router was elected, 615-618 +OSPFv2 tracking OSPF advertisements through a network, 620-621 + +OSPFv3 +AFs (address families), 655-664 trouble tickets, 664-668 +displaying routes, 646 IPv6, 641 +troubleshooting commands, 641 - 647 +LSDB, 644 +trouble tickets, 647, 926-934 trouble ticket 15-4, 647-650 trouble ticket 15-5, 650-654 +outside global +NAT (Network Address Translation), 352 +outside local +NAT (Network Address Translation), 352 + +P + +packet captures, collect information, 75-76 +packet-forwarding process, 427 +Layer 3 packet-forwarding process, 427-431 +troubleshooting, 431-435 +packet matches, verifying, IPv4 ACLs, 407 +packet-switching modes, 113, 116-121 commands for troubleshooting +fast switching, 114-115 process switching, 113-114 +passive interface feature +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 523-524 +IPv6, 562 + + + + + +From the Library of Outcast Outcast +976 passive interface feature + + +OSPFv2, 599 RIPv2, 471-473 +password encryption levels, 858 +password mismatch, VTP (VLAN Trunking Protocol), 151 +PBR (policy-based routing), 681-684 PBR path, verifying, 683 +PC1 +ipconfig, 215 issuing pings, 158 +PCPT (Pearson Cert Practice Test), 943 activating and downloading, 944 +Pearson Cert Practice Test (PCPT) engine, 943 +peer groups, misconfigured peer groups, BGP (Border Gateway Protocol), +764 - 765 +performance management, FCAPS, 28 permit sequence, 679 +permit statement, 679 +physical topology diagrams, 32 ping, 64-66 +ping sweeps, 66 pings +failed pings, 214-215 issuing from PC1, 158 successful pings, 218 +policy-based routing. See PBR (policy-based routing) +Do I Know This Already? quizzes, 674 - 677 +trouble tickets, 684 +trouble ticket 16-1, 685-688 trouble ticket 16-2, 689-691 trouble ticket 16-3, 691-692 +policy matches, verifying, 688 +populating, TCAM (ternary content-addressable memory), 102 + + +port errors, Cisco Catalyst switches, 97-98 +port roles, STP (Spanning-Tree Protocol), 174 +port security, 250 common issues, 250 +configured but not enabled, 250 - 251 +legitimate users being blocked because of violation, 254-260 +maximum number of MAC addresses reached, 253-254 +running configuration not saved to startup configuration, +260-261 +trouble tickets, 261-265 +port security common issues static MAC address not configured correctly, +251-253 +port type during configuration, Layer 3 EtherChannel, 238 +PortFast, 183-184 ports +Cisco Catalyst switches, 96 +incorrect port assignments, VLANs, 154-155 +protected ports, 273-275 routed ports, 233-234 +practice exercises, selecting a trouble-shooting approach, 25-26 +prefix lists, 414 processing, 415-416 reading, 414-415 trouble tickets, 416-418 +Premium Edition, 945 +private autonomous system numbers, BGP path selection, 784 +private VLANs. See PVLANs (private VLANs) + + + + + +From the Library of Outcast Outcast +recursive lookup, IPv4 static routes 977 + + +proactive network maintenance, 27-28 +problem reports, structured trouble-shooting, 13-14 +problem resolution, structured trouble-shooting, 19 +problems, diagnosing, 10 process-switching modes, 116 +process switching, packet-switching modes, 113-114 +processes that cause excessive CPU uti-lization, 107-113 +ARP Input process, 107-108 IP Background process, 108 Net Background, 108 +TCP Timer process, 108 processing, prefix lists, 415-416 processor utilization, 106 +propose an hypothesis, structured trou-bleshooting, 17-18 +protected ports, 273-275 +protocols, management protocols. See management protocols +proxy ARP enabled, 442 +punting, TCAM (ternary content-addressable memory), 102 +PVLANs (private VLANs), 275-279 + +Q quizzes +addressing, 334-337 +BGP (Border Gateway Protocol), 748-752 +device performance, 92-95 +EIGRP (Enhanced Interior Gateway Routing Protocol), 512-516 +first-hop redundancy protocols, 286 - 289 +Inter-VLAN routing, 208-211 + +IPv4 ACLs, IPv6 ACLs, prefix lists, 396 - 400 +IPv4/IPv6 routing and GRE tunnels, 422-426 +IPv6 addressing, 366-369 maintenance tools, 40-44 management access, 850-853 management protocols, 814-817 +OSPF (Open Shortest Path First), 586 - 589 +redistribution, 696-699 +RIPng (RIP next generation), 462-465 RIPv2, 462-465 +route maps and policy-based routing, 674-677 +STP (Spanning-Tree Protocol), 168-171 switch security, 246-249 + +R R1 +show cdp neighbors, 81-82 show version, 83 +show vlans, 219-220 updating routers, 83 +RAs, verifying, 379 Rcv-Err, 98 +reactive network maintenance, 27-28 reading +IPv4 ACLs, 401-402 IPv6 ACLs, 408-409 prefix lists, 414-415 route maps, 678-680 +REBIND, 384 RECONFIGURE, 384 recovery tools, 48-53 +recursive lookup, IPv4 static routes, 440 + + + + + +From the Library of Outcast Outcast +978 redirecting, show command output to files + + +redirecting, show command output to files, 73-74 +redistribution, 700 +advanced redistribution, 737 routing loops, 739-744 +BGP (Border Gateway Protocol), 715 - 718 +Do I Know This Already? quizzes, 696 - 699 +EIGRP (Enhanced Interior Gateway Routing Protocol), 706-710 +OSPF, 710-715 RIP, 703-705 route maps, 718 +route redistribution overview, 700-702 +suboptimal routing, suboptimal routing, 737-739 +trouble tickets, 718, 901-910 trouble ticket 17-1, 439-442 trouble ticket 17-2, 723-727 trouble ticket 17-3, 727-732 trouble ticket 17-4, 733-737 +redistribution configuration, 702 RELAY-FORW, 384 +RELAY-REPL, 384 RELEASE, 384 RENEW, 384 +replacement of hardware, routine main-tenance tasks, 30 +REPLY, 384 REQUEST, 384 +restoring, archived configurations, 53 +restoring operations after a failure, maintenance procedures, 33-34 +reviewing +DHCP operations, IPv4 addressing, 342-347 +GLBP (Gateway Load Balancing Protocol), 319-321 + +HSRP (Hot Standby Router Protocol), 290-291 +IPv6 addressing, 370 +NAT (Network Address Translation), 350-352 +SVIs (switched virtual interfaces), 221 - 223 +VRRP (Virtual Router Redundancy Protocol), 306-308 +RFC 1918, 334 +RIP (Routing Information Protocol), 462 redistribution, 703-705 +RIPng (RIP next generation), 462, 492 - 497 +ACLs, 496-497 debug, 494 +default routes, 495-496 +Do I Know This Already? quizzes, 462 - 465 +load balancing, 495 +trouble tickets, 498, 934-940 trouble ticket 13-1, 498-502 trouble ticket 13-2, 502-506 trouble ticket 13-3, 506-508 +verifying interfaces, 497 viewing routes, 493 +RIPv2, 466 ACLs, 485 +authentication, 477-479 autosummarization, 482-483 +bad or missing network statements, 470-471 +better source of information, 483-484 +Do I Know This Already? quizzes, 462 - 465 +interface is shut down, 469 load sharing, 485-486 +max hop count exceeded, 475-477 +missing default route, 486-487 + + + + +From the Library of Outcast Outcast +Routing Information Protocol 979 + + +missing routes, 466-468 +passive interface feature, 471-473 route filtering, 479-480 +route summarization, 487-491 split horizon, 480-481 +trouble tickets, 498 +trouble ticket 13-1, 498-502 trouble ticket 13-2, 502-506 trouble ticket 13-3, 506-508 +wrong subnets, 469-470 wrong version, 473-475 +root bridges, STP (Spanning-Tree Protocol), 173 +Root Guard, 189-190 root ports +STP (Spanning-Tree Protocol), 175-176 route caching, 114-115 +route filtering +BGP routes, 775-780 +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4 routes, 534-535 IPv6 route, 565 +OSPFv2 routes, 611-613 RIPv2, 479-480 +route filters, verifying with show ip pro-tocols, 479 +route information, sources of, 436-438 route map configuration +modifying, 688 verifying, 688 +route maps, 678 +Do I Know This Already? quizzes, 674 - 677 +logic of, 680 reading, 678-680 redistribution, 718 +route selection, 702 + + +route summarization +EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4 issues, 543 - 544 +OSPFv2, 622-624 RIPv2, 487-491 +routed ports, 233-234 configuring, on SW1, 237 trouble tickets, 234-237 +router-on-a-trunk/stick, 212-213 trouble tickets, 213 +trouble ticket 6-1, 214-218 trouble ticket 6-2, 218-220 +router performance issues, 106-107 buffer leaks, 122-123 +CEF (Cisco Express Forwarding), 115 - 116 +excessive BGP memory use, 123-124 excessive CPU utilization, 107 +processes that cause excessive CPU utilization, 107-113 +excessive memory utilization, 121 memory-allocation failure, 122 memory leaks, 121-122 +packet-switching modes, 113, 116-121 fast switching, 114-115 +process switching, 113-114 process-switching modes, 116 +router start up configuration, backing up without specifying login credentials, 49 +routers, 92 updating, R1, 83 +routes +BGP (Border Gateway Protocol). See BGP routes +missing default route, RIPv2, 486-487 +Routing Information Protocol. See RIP (Routing Information Protocol) + + + + +From the Library of Outcast Outcast +980 routing information sources + + +routing information sources +sources of route information, 436-438 troubleshooting, 435 +routing information sources data struc-tures and routing tables, 436 +routing loops redistribution, 739-744 +verifying, with trace, 490-491 routing protocols, metrics, 701 +routing table entries, verifying, 446, 686 +routing tables, routing information sources, 436 +RP (root port), 174 +RSPAN (Remote SPAN), 78-79, 835 - 837 +running configuration, comparing to startup configuration before issuing copy command, 52 +Runts, 98 + +S + +scheduled backups, routine maintenance tasks, 30 +scheduled maintenance, 30 SDM template +Cisco Catalyst switches, 104 verifying, 105 +Secure Shell (SSH), 857-858 security. See also switch security +access control. See access control +spoof-prevention features. See spoof-prevention features +security management, FCAPS, 28 security violations, identifying, 255 seed metrics, redistribution, 702 +selecting, troubleshooting methods, 25-26 + +severity levels logging tools, 54 +shoot from the hip method, 6-12 show adjacency detail, 116, 120, 435 show buffers, 123 +show cdp neighbors, 81, 548 R1, 81-82 +show commands +filtering output of, 69-73 redirecting output to files, 73-74 +show controllers, 74 +show etherchannel summary, 203-204, 239 +show frame-relay map, 434 show glbp, 322, 328 +show glbp brief, 321, 329-330 show interface interface t, 110 +show interface interface_type interface number , 108 +show interface switchport, 141-142 show interface trunk, 142 +show interface tunnel, 456-457 show interfaces, 74, 98 +show interfaces gig1/0/10 switchport, SW1, 236 +show interfaces switchport, 141 show interfaces trunk, 142, 147, 217 show ip arp, 108-109, 433 +show ip cache, 116-117 show ip cef, 116, 120 +show ip cef adjacency egress_inter-face_id next_hop_ip_address detail , 116-119 +show ip cef exact-route source_address destination_address, 433 +show ip cef ip_address, 120, 433 +show ip cef [ip_address] [subnet_mask], 433 + + + + + +From the Library of Outcast Outcast +show sdm prefer 981 + + +show ip dhcp binding, 349 show ip dhcp conflict, 349 show ip eigrp, 539 +show ip eigrp interfaces, 548-551, 721 show ip eigrp neighbors, 548-551 show ip eigrp topology, 540-541 +show ip interface, RIPv2, 470 +show ip interface brief, 71, 80, 204, 304 +SW1, 236 +show ip interface interface_type inter-face_number , 116- 117 +show ip nat statistics, 355 show ip nat translations, 354 show ip nhrp, 434 +show ip ospf database, 609 +show ip ospf database router, 609 show ip policy, 683 +show ip protocols, 547 RIP settings, 468 +verifying route filters, 479 show ip rip database, 467, 704 +show ip route, 72-73, 303, 547, 550- 551 +SWI, 232 +show ip route [ip_address], 432 show ip route ip_address, 120 +show ip route [ip_address] [subnet_ mask] , 432 +show ip route [ip_address] [subnet_ mask] [longer-prefixes] , 432 +show ip route ospf, 608 show ip route rip, 467-468 show ip sla application, 829 +show ip sla configuration, 829 show ip sla responder, 832 show ip sla statistics, 831 +show ipv6 ospf, 642 + +show ipv6 ospf database, redistribution, 714 +show ipv6 ospf interface brief, 643 show ipv6 protocols, 493, 641 +RIPng (RIP next generation) redistribu-tion, 705 +show ipv6 rip TSHOOT_RIP, 493 +show ipvt ospf interface interface_type interface_number, 643 +show ipvt ospf neighbor, 644 show ipvt protocols, 641 show mac address-table, 133 +show mac address-table dynamic, 216 show memory, 74 +show memory allocating-process totals, 121 +show ospfv3 database, 661 show ospfv3 interface, 659 show ospfv3 neighbor, 660 show platform, 74 +show platform tcam utilization, 103 +show processes cpu, 69, 74, 108, 111 - 112 , 116 - 118 +filtering output of show commands, 70 +show processes cpu history, 108, 112 - 113 +show processes memory| include, 123 show route-map, 683-684 +show route-map TSHOOT_ROUTE_ MAP, 679 +show run, 212-213 +show run interface gigabitethernet, 202 show run interface vlan 10, 305 +show run | section router eigrp, 549 show running-config, 71-72 +show sdm prefer, 103 +show spanning-tree, 184 + + + + + +From the Library of Outcast Outcast +982 show spanning-tree + + +show spanning-tree inconsistent ports, 198 +show spanning-tree interface inter-face_type interface number detail, 178-179 +show spanning-tree mst configuration, 180 +show spanning-tree vlan, 178 +show spanning-tree [vlan {vlan_id}], 178 show standby, 294, 304 +show standby brief, 292, 303 +show standby fastethernet 0/0, 293 show tcp statistics, 108-111 +show track, 310, 325 show version, R1, 83 show vlan brief, 159 show vlans, 217 +R1, 219-220 show vrrp, 310 +show vrrp brief, 308 +show vrrp interface vlan 20, 309 shut down interfaces, RIPv2, 469 simplified troubleshooting flow, 10 Single-Col, 98 +SLAAC (stateless address autoconfigu-ration), 388 +IPv6 addressing, 375-380 +SNMP (Simple Network Management Protocol), 57-59 +baselines, creating, 58 +notifications for network events, 61-64 SNMP traps, enabling, 62 +SNMPv3, 824-825 software, updating, 30 +SOLICIT, 384 + +source information BGP routes, 773-775 +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4 routes, 533-534 IPv6 route, 565 +OSPFv2 routes, 607-610 RIPv2, 483-484 +source routing protocol, 702 +SPAN (Switched Port Analyzer), 835 - 837 +collect information, 76-78 +Spanning-Tree Protocol. See STP (Spanning-Tree Protocol) +specific routes, verifying, 447 split horizon +BGP routes, 772-773 +EIGRP (Enhanced Interior Gateway Routing Protocol +IPv4 routes, 537-539 IPv6 route, 566-567 +RIPv2, 480-481 +spoof-prevention features, 265 +DAI (dynamic ARP inspection), 267 - 268 +DHCP snooping, 265-267 IP Source Guard, 268-269 trouble tickets, 270-272 +SSH (Secure Shell), 857-858 +startup configuration, comparing to running configuration before issuing copy command, 52 +stateful DHCPv6, IPv6 addressing, 381 - 382 +stateless address autoconfiguration/ SLAAC, IPv6 addressing, 375-380 +stateless DHCPv6, IPv6 addressing, 382-384 + + + + + + +From the Library of Outcast Outcast +switch performance issues 983 + + +static routes, 439 +exit interface specified, 441 IPv4, 439-443 +IPv6, 443-445 trouble tickets, 445 +trouble ticket 12-1, 445-448 trouble ticket 12-2, 448-450 +sticky features, port security, 260-261 STP (Spanning-Tree Protocol) +collect information, 177 +gathering STP information, 177 - 179 +MSTP (Multiple Spanning Tree Protocol), 179-180 +default port costs, 175 designated ports, 176 +Do I Know This Already? quizzes, 168 - 171 +nondesignated port (X), 176-177 overview, 172 +port roles, 174 +reviewing operation, 173-175 root ports, determining, 175-176 trouble tickets, 872-876 +trouble ticket 5-1, 191-193 trouble ticket 5-2, 194-196 trouble ticket 5-3, 196-199 +troubleshooting +broadcast storms, 181-182 +corruption of a switch's MAC address table, 180-181 +STP features, 182 BPDU Filter, 187-188 BPDU Guard, 184-187 Loop Guard, 190 PortFast, 183-184 Root Guard, 189-190 +structured tasks, 27 + +structured troubleshooting, 11-13 collect information, 14 +eliminate potential causes, 16-17 examine collected information, 15-16 problem reports, 13-14 +problem resolution, 19 propose an hypothesis, 17-18 value of, 11-13 +verify hypothesis, 18 +stub area configuration, OSPFv2 routes, 613-614 +stub configuration, EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4 routes, 535-537 IPv6 route, 565-566 +study plans, 946-949 subnets +different subnets, OSPFv2, 598-599 +EIGRP (Enhanced Interior Gateway Routing Protocol), IPv4, 524-526 +RIPv2, 469-470 +subnets determining IP addresses, 341 - 342 +suboptimal routing, advanced redistribu-tion, 737-739 +successful pings, 218 +successors, EIGRP (Enhanced Interior Gateway Routing Protocol, IPv4 issues, 539-542 +SVIs (switched virtual interfaces) reviewing, 221-223 +trouble tickets, 224 +trouble ticket 6-3, 225-230 trouble ticket 6-4, 230-233 +troubleshooting, 223-224 +switch performance issues, 96 + + + + +From the Library of Outcast Outcast +984 switch performance issues + + +Cisco Catalyst switches, 96-97 +mismatched duplex settings, 99 - 101 +port errors, 97-98 +high CPU utilization, 105-106 +TCAM (ternary content-addressable memory), 101-105 +switch security +Do I Know This Already? quizzes, 246 - 249 +port security. See port security +Switched Port Analyzer. See SPAN (Switched Port Analyzer) +switched virtual interfaces. See SVIs (switched virtual interfaces) +switches, 92 syslog, 821-823 + +T + +tables, adjacency tables, 431 tasks, network maintenance, 27 +TCAM (ternary content-addressable memory), 101-105 +populating, 102 punting, 102 +TCP Timer process, 108 +team utilization, verifying, 105 telnet, 67, 855 +testing, EMM configuration, 63-64 +TFTP server, redirecting output to, 73 - 74 +time-based IPv4 ACLs, 403-404 timers +BGP (Border Gateway Protocol), neigh-bor adjacencies, 765-766 + +EIGRP (Enhanced Interior Gateway Routing Protocol) +IPv4, 528 IPv6, 563 +mismatched timers, OSPFv2, 594-595 tools +maintenance tools advanced tools, 57 basic tools, 47 +Cisco Support tools, 64 CLI tools, 47-48 +GUI tools, 48 logging tools, 53-55 +network documentation tools, 46-47 +NTP (Network Time Protocol), 56-57 +recovery tools, 48 +management tools. See management tools +network documentation tools. See net-work documentation tools +top-down method, 21 +trace, verifying, routing loops, 490-491 traceroute, 67-68, 120 +tracking OSPF advertisements through a network OSPFv2, 620-621 +transit, collect information, 75 packet captures, 75-76 +RSPAN (Remote SPAN), 78-79 +SPAN (Switched Port Analyzer), 76-78 trouble ticket reporting system, 46 trouble tickets +BGP (Border Gateway Protocol), 790, 910-918 +trouble ticket 18-1, 791-796 trouble ticket 18-2, 796-802 +trouble ticket 18-3, 802-806 + + + + + +From the Library of Outcast Outcast +trouble tickets 985 + + +EIGRP (Enhanced Interior Gateway Routing Protocol), 880-883 +IPv4, 546 EtherChannel, 200 +trouble ticket 5-4, 201-204 trouble ticket 5-5, 204-205 +GLBP (Gateway Load Balancing Protocol), 326 +trouble ticket 8-6, 327-329 trouble ticket 8-7, 329-330 +HSRP (Hot Standby Router Protocol), 297, 876-880 +trouble ticket 8-1, 297-300 trouble ticket 8-2, 300-302 trouble ticket 8-3, 302-306 +IPv4 ACLs, 405-407 IPv4 addressing, 356 +trouble ticket 9-1, 356-358 trouble ticket 9-2, 358-361 trouble ticket 9-3, 361-363 +IPv6 ACLs, 410-414 IPv6 addressing, 386 +trouble ticket 10-1, 386-389 trouble ticket 10-2, 389-393 +Layer 2 trouble tickets, 157 trouble ticket 4-1, 158-160 trouble ticket 4-2, 160-164 +Layer 3 EtherChannel, 239-243 management access, 861, 918-922 +trouble ticket 20-1, 862-863 trouble ticket 20-2, 864-865 trouble ticket 20-3, 865-867 +management protocols, 837-844 MP-BGP, 807-809 +named EIGRP configurations, 577 +NAT (Network Address Translation), 923-926 +OSPF (Open Shortest Path First), 884-901 + +OSPFv2, 627 +trouble ticket 15-1, 628-635 trouble ticket 15-2, 635-639 troubled ticket 15-3, 639-641 +OSPFv3, 647, 926-934 +trouble ticket 15-4, 647-650 trouble ticket 15-5, 650-654 +policy-based routing, 684 trouble ticket 16-1, 685-688 trouble ticket 16-2, 689-691 trouble ticket 16-3, 691-692 +port security, 261-265 prefix lists, 416-418 redistribution, 718, 901-910 +trouble ticket 17-1, 439-442 trouble ticket 17-2, 723-727 trouble ticket 17-3, 727-732 trouble ticket 17-4, 733-737 +RIPng (RIP next generation), 498, 934 - 940 +trouble ticket 13-1, 498-502 trouble ticket 13-2, 502-506 trouble ticket 13-3, 506-508 +RIPv2, 498 +trouble ticket 13-1, 498-502 trouble ticket 13-2, 502-506 trouble ticket 13-3, 506-508 +routed ports, 234-237 router-on-a-trunk/stick, 213 +trouble ticket 6-1, 214-218 trouble ticket 6-2, 218-220 +spoof-prevention features, 270-272 static routes, 445 +trouble ticket 12-1, 445-448 trouble ticket 12-2, 448-450 +STP (Spanning-Tree Protocol), 872-876 trouble ticket 5-1, 191-193 trouble ticket 5-2, 194-196 +trouble ticket 5-3, 196-199 + + + +From the Library of Outcast Outcast +986 trouble tickets + + +SVIs (switched virtual interfaces), 224 trouble ticket 6-3, 225-230 trouble ticket 6-4, 230-233 +VRRP (Virtual Router Redundancy Protocol), 312 +trouble ticket 8-4, 312-315 trouble ticket 8-5, 315-318 +troubleshooting, 9 defining, 9-11 diagnosing problems, 10 GRE tunnels, 450-458 hardware, Cisco IOS, 74 maintenance procedures +change management, 37-38 communication, 36-37 establishing baselines, 36 +network maintenance, 34-35 +maintaining current network doc-umentation, 35 +packet-forwarding process, 431-435 +router performance issues. See router performance issues +routing information sources, 435 shoot from the hip method, 6-12 simplified troubleshooting flow, 10 steps of, 45 +STP features, 182 +BPDU Filter, 187-188 BPDU Guard, 184-187 Loop Guard, 190 PortFast, 183-184 Root Guard, 189-190 +STP (Spanning-Tree Protocol) broadcast storms, 181-182 +corruption of a switch's MAC address table, 180-181 + +structured troubleshooting, 11 value of, 11-13 +SVIs (switched virtual interfaces), 223-224 +switch performance issues. See switch performance issues +trunks. See trunks troubleshooting methods, 20 +bottom-up method, 21-22 +comparing configurations method, 23 - 24 +component swapping method, 24-25 divide-and-conquer method, 22 following the traffic path method, 23 selecting, 25-26 +top-down method, 21 +trunking administrative (Dynamic Auto), verifying, 144 +trunking administrative mode (Access), verifying, 143 +trunking administrative mode (Dynamic Desirable), verifying, 144 +trunking administrative mode (Trunk), verifying, 143 +trunking administrative modes, compar-ing , 145 +trunks, 140, 143 +allowed VLANs, 147-148 encapsulation mismatch, 141-142 incompatible trunking modes, 143-146 native VLAN mismatch, 146-147 verifying, 143 +VTP domain name mismatch, 146 +TTLs, BGP (Border Gateway Protocol), 761-763 + + + + + + + +From the Library of Outcast Outcast +verifying 987 + + +U UnderSize, 98 +unicast routing, IPv6 addressing, 378 updated static routes, verifying, 447 updating +routers, R1, 83 software, 30 + +V + +VACLs (VLAN access control lists), 279 +variable-length subnet masking (VLSM), 542 +verification commands, named EIGRP configurations, 573-576 +verify hypothesis, structured trouble-shooting, 18 +verifying +ACLs, IPv4 ACLs, 406 default gateways, 380 +default trunking mode on SW2, 145 DHCP snooping, 266 +DHCP snooping bindings, 267 DR (designated router), 617-618 EIGRP routes, 686-687 +end-user IP addresses, 153 entry exists, 448 +first hop, VRRP (Virtual Router Redundancy Protocol (VRRP), 310 - 312 +GLBP (Gateway Load Balancing Protocol), 321-323 +first hop, 325-326 +HSRP (Hot Standby Router Protocol), 292-293 +first hop, 294-296 interface IP addresses, 471 +IP addresses with ipconfig, 342 + + +IP addressing, 340-341 IP Source Guard, 269 +network IDs with show ip interface, 607 +OSPF authentication keys, 600 OSPF RID, 604 +packet matches, IPv4 ACLs, 407 PBR path, 683 +policy matches, 688 protected ports, 274 +PVLANs (private VLANs), 278 RAs, 379 +redistributed routes in RIP domain, 705 RIP authentication, 478-479 +RIP distribute list command, 480 RIPng (RIP next generation), 497 +route filters, with show ip protocols, 479 +route map configuration, 688 +routes, via tunnel interface on HQ and Branch, 452-453 +routing loops, with trace, 490-491 routing table entries, 446, 686 SDM template, 105 +specific routes, 447 team utilization, 105 +trunking administrative mode (Access), 143 +trunking administrative mode (Dynamic Auto), 144 +trunking administrative mode (Dynamic Desirable), 144 +trunking administrative mode (Trunk), 143 +updated static routes, 447 virtual links, 626 +VLANs, on a switch, 153 +VRRP (Virtual Router Redundancy Protocol), 308-309 + + + + +From the Library of Outcast Outcast +988 verifying + + +VTP domain name, 148 VTP version, 149 +version mismatch, VTP (VLAN Trunking Protocol), 149 +versions, wrong version, RIPv2, 473 - 475 +viewing +configuration archives, 50 NAT statistics, 353 +NAT translations, 362 +number of IPv6 routes reachable at next-hop router, RIPng, 494 +RIPng (RIP next generation) routes, 493 violations +identifying, 255 +legitimate users being blocked because of violations, 254-260 +virtual links, verifying, 626 virtual router MAC address +GLBP (Gateway Load Balancing Protocol), 323 +HSRP (Hot Standby Router Protocol), 293 +VRRP (Virtual Router Redundancy Protocol), 309 +Virtual Router Redundancy Protocol. See VRRP (Virtual Router Redundancy Protocol) +VLAN access control lists (VACLs), 279 VLAN access map, 279 +VLAN filter list, 279 +VLAN Trunking Protocol. See VTP domain name mismatch +VLANs, 152 +incorrect IP addressing, 152-153 incorrect port assignments, 154-155 missing VLANs, 153-154 +verifying on a switch, 153 + + +VLSM (variable-length subnet masking), 542 +VRRP (Virtual Router Redundancy Protocol), 306 +comparing to HSRP and GLBP, 330 object tracking, 309-310 +reviewing, 306-308 trouble tickets, 312 +trouble ticket 8-4, 312-315 trouble ticket 8-5, 315-318 +verifying, 308-309 first hop, 310-312 +virtual router MAC address, 309 VTP (VLAN Trunking Protocol), 148 +domain name mismatch, 148-149 higher revision number, 151-152 mode mismatch, 149-150 password mismatch, 151 +version mismatch, 149 +VTP domain name mismatch, trunks, 146 +VTP version, verifying, 149 vty access, 855 +vty lines, 854 vty login, 856 + +W + +wedged interfaces, identifying, 122 wiki, 46 +witnessing, configuration merge, 53 wrong subnets, RIPv2, 469-470 wrong version, RIPv2, 473-475 + +X-Y-Z + +Xmit-Err, 98 + + + + + + +From the Library of Outcast Outcast + +Where are the Companion Content Files? + +Thank you for purchasing this Premium Edition version of: +CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +The print version of this title comes with a disc of companion content. +As an eBook reader, you have access to these files by following the steps below: + +1. Go to ciscopress.com/account and log in. + +2. Click on the “Access Bonus Content” link in the Registered Products section of your account page for this product, to be taken to the page where your +downloadable content is available. + + +Please note that many of our companion content files can be very large, especially image and video files. + +If you are unable to locate the files for this title by following the steps +at left, please visit ciscopress.com/ contact and select the “Site Problems/ Comments” option. Our customer +service representatives will assist you. + + + + + + + + + +The Professional and Personal Technology Brands of Pearson + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPENDIX C + + + + + + +Memory Tables + + +Chapter 1 + + +Table 1-2 Steps to Diagnose a Problem + +Step + + + +Description +Because a typical problem report lacks sufficient information to give a troubleshooter insight into a problem’s +underlying cause, the troubleshooter should collect additional information, perhaps using network maintenance tools or by interviewing impacted users. +After collecting sufficient information about a problem, the troubleshooter then examines that information, perhaps comparing the information against previously collected baseline information. +Based on the troubleshooter’s knowledge of the network and his interrogation of collected information, he can begin to eliminate potential causes for the problem. +After the troubleshooter eliminates multiple potential causes for the problem, he is left with one or more causes that are more likely to have resulted in the problem. +The troubleshooter hypothesizes what he considers to be the most likely cause of the problem. +The troubleshooter then tests his hypothesis to confirm or refute his theory about the problem’s underlying cause. + + + + + + + + + +From the Library of Outcast Outcast +4 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 1-3 FCAPS Management Tasks + +Type of Management Examples of Management Tasks +Use network management software to collect information from routers and switches. Send an e-mail alert when processor utilization or bandwidth utilization exceeds a threshold +of 80 percent. Respond to incoming trouble tickets from the help desk. +Require logging of any changes made to network hardware or software configurations. Implement a change management system to alert relevant personnel of planned network changes. +Invoice IP telephony users for their long-distance and international calls. Keeping track of what is being done on the network and when it is being done. +Monitor network performance metrics for both LAN and WAN links. Deploy +appropriate quality of service (QoS) solutions to make the most efficient use of relatively limited WAN bandwidth, while prioritizing mission-critical traffic. +Deploy firewall, virtual private network (VPN), and intrusion prevention system (IPS) technologies to defend against malicious traf-fic. Create a security policy dictating rules of acceptable network use. Use an authorization, authentication, and accounting (AAA) server to validate user credentials, assign appropriate user privileges, and log user activity. + + + +Chapter 2 + +Table 2-2 Severity Levels + +Severity Level Name +0 + +1 + +2 + +3 + +4 + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 5 + + +Severity Level Name 5 +6 7 + + + +Table 2-3 Comparing SNMP and NetFlow + +Technology Characteristics +SNMP + + + + + + +NetFlow + + + + + + + + + +Table 2-4 Cisco IOS Commands for Hardware Troubleshooting + +Command Description +Provides 5-second, 1-minute, and 5-minute CPU utilization statistics, in addition to a list-ing of processes running on a platform along with each process’s utilization statistics +Displays summary information about processor and I/O memory, followed by a more comprehensive report of memory utilization + + + + + + + + + + + +From the Library of Outcast Outcast +6 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Command Description +Shows Layer 1 and Layer 2 interface status, interface load information, and error statistics including the following: + +input queue drops: Indicates a router received information faster than the information could be processed by the router + +output queue drops: Indicates a router is not able to send information out the outgoing interface because of congestion (perhaps because of an input/output speed mismatch) + +input errors: Indicates frames were not received correctly (for example, a cyclic redundancy check (CRC) error occurred), perhaps indicating a cabling problem or a duplex mismatch + +output errors: Indicates frames were not transmitted correctly, perhaps due to a duplex mismatch + +Note Prior to collecting statistics, interface counters can be reset using the clear coun-ters command. + +Displays statistical information about an interface (for example, error statistics), where the information varies for different interface types (for example, the type of connected cable might be displayed for a serial interface and whether it is the DCE side or DTE side of the cable) +Provides detailed information about a router or switch hardware platform + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 7 + +Chapter 3 + +Table 3-3 Commands for Troubleshooting High CPU Utilization + +Command Description +Displays the ARP cache for a router. If several entries are in the Incomplete state, you might suspect a malicious scan (for example, a ping sweep) of a subnet, or you have a route pointing out an Ethernet interface as described in our ARP Input process discussion. +Displays a collection of interface statistics. If the throttles, overruns, or ignored counters continually increment, you might suspect that the Net Background process is attempting to allocate buffer space for an interface from the main buffer pool of the router. +Provides information about the number of TCP segments a router sends and receives, including the number of connections initiated, accepted, established, and closed. A high number of connections can explain why the TCP Timer process might be consuming excessive CPU resources. If you see an excessive number of embryonic connections, you might be under a denial-of-service (DoS) attack. +Displays average CPU utilization over +5-second, 1-minute, and 5-minute intervals, in addition to listing all the router processes and the percentage of CPU resources consumed by each of those processes. +Displays a graphical view of CPU utilization over the past 60 seconds, 1 hour, and 3 days. This graphical view can indicate whether an observed high CPU utilization is a temporary spike in utilization or whether the high CPU utilization is an ongoing condition. + + + + + + + + + + +From the Library of Outcast Outcast +8 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 3-4 Commands for Troubleshooting a Router’s Packet-Switching Modes + +Command Description +Displays multiple interface statistics, including information about the packet-switching mode of an interface. +Displays the contents of the route cache from a router if fast switching is enabled. +Displays information about the IP input process on a router. The CPU utilization for this process might show a high value if the CPU of a router is actively engaged in +process-switching traffic because you turned off fast switching and CEF. +Displays the contents of a router’s FIB. + +Displays destinations reachable through the combination of the specified egress interface and next-hop IP address. +Provides information contained in the adjacency table of a router, including protocol and timer information. + + + +Chapter 4 + +Table 4-2 Comparing Trunking Administrative Modes + +SW1 + + + + + + + + +SW2 + + + +Dynamic Auto + +Dynamic Desirable + +Trunk + +Dynamic Auto + +Dynamic Trunk Desirable + +Trunk Access Nonegotiate + + +Trunk Nonegotiate + +Access + + + + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 9 + +Chapter 5 + +Table 5-2 STP Port Types + +Port Type Description +Root port (RP) + + + + +Designated port (DP) + + + + +Nondesignated port (X) + + + + + + + +Table 5-3 Default Port Costs + +Link Speed 802.1D STP Port Cost 802.1D-2004 STP Port Cost +10 Mbps (Ethernet) + +100 Mbps (Fast Ethernet) + +1 Gbps (Gigabit Ethernet) + +10 Gbps (Ten Gig Ethernet) + +100 Gbps + +1 Tbps + +10 Tbps + + + + + + + + + + + + + + +From the Library of Outcast Outcast +10 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 5-4 EtherChannel Modes That Will Successfully Form a Bundle + +SW1 + + +MODE + +PAgP Desirable + +PAgP Desirable + +PAgP Auto LACP Active + +LACP ON Passive + + +PAgP Auto SW2 + +LACP Active + +LACP Passive + +ON + + + + +Chapter 6 + +Table 6-2 Options for Successfully Forming an EtherChannel + +SW1 + + +MODE + + +PAgP Desirable + +PAgP Desirable + +PAgP Auto LACP Active + +LACP On Passive + + +PAgP Auto SW2 + +LACP Active + +LACP Passive + +On + + + + + + + + + + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 11 + +Chapter 8 + +Table 8-2 Comparing HSRP, VRRP, and GLBP + +Characteristic HSRP VRRP GLBP +Cisco proprietary. + +Interface IP address can act as virtual IP address. +More than one router in a group can +simultaneously forward traffic for that group. +Hello timer default value. +Hold timer default value. +Preemption enabled by default. +Default priority. + +Default weight. + +Authentication supported. +Multicast address. + +Virtual MAC address. + +(xx = group number) (yy = AVF) + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +12 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 9 + +Table 9-2 DHCP Message Types + +DHCP Message Description +A client sends this message in an attempt to locate a DHCP server. This message is sent to a broadcast IP address of 255.255.255.255 using UDP port 67. +A DHCP server sends this message in response to a DHCPDISCOVER message using UDP port 68. +This broadcast message is a request from the client to the DHCP server for the IP +addressing information and options that were received in the DHCP Offer message. +This message is sent from a client to a DHCP server to inform the server that an IP address is already in use on the network. +A DHCP server sends this message to a client and includes IP configuration parameters. +A DHCP server sends this message to a client and informs the client that the DHCP server declines to provide the client with the requested IP configuration information. +A client sends this message to a DHCP server and informs the DHCP server that the client has released its DHCP lease, thus allowing the DHCP server to reassign the client IP address to another client. +This message is sent from a client to a DHCP server and requests IP configuration parameters. Such a message might be +sent from an access server requesting IP configuration information for a remote client attaching to the access server. + + + + + + + + + + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 13 + +Table 9-3 Types of NAT + + +Type of NAT + +Static NAT + +Description (Based on Private to Public IPv4 Address Translations) + + + +Dynamic NAT + + +NAT overloading or PAT + + + + + + +Table 9-4 Names of NAT IP Addresses + +NAT IPs + + + +Definition +The IP address of a device inside the network; this address will be translated to the inside global address. (Example: PC inside the network) +The IP address that the Inside local address is translated to. (Example: public IP address used on Internet) +The IP address of a remote device as it appears to the devices inside the network. This may or may not be the actual address of the remote device if NAT translated it. Note that usually the outside global and outside local addresses are the same. +The IP address of the device that the inside local address is trying to communicate with. This may be translated to the outside local address (but usually is not translated). (Example: web server) + + + + + + + + + + + + + + +From the Library of Outcast Outcast +14 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 12 + +Table 12-2 Default Administrative Distance of Route Sources + +Source of Route Information AD +Connected interface + +Static route + +EIGRP summary route + +eBGP + +EIGRP (internal) + +OSPF + +IS-IS + +RIP + +EGP + +ODR + +EIGRP (external) + +iBGP + +Unknown (not believable) + + + +Chapter 15 + + +Table 15-2 Adjacency States + +State + + + +Description +This state indicates that no hellos have been received from a neighbor. +This state occurs after a router sends a unicast hello (as opposed to a multicast hello) to a configured neighbor and has not yet received a hello from that neighbor. +This state occurs on a router that has received a hello message from its neighbor; however, the OSPF RID of the receiving router was +not contained in the hello message. If a router remains in this state for a long period, something is probably preventing that router from correctly receiving hello packets from the neighboring router. + + + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 15 + + +State Description 2Way + + + + + +This state occurs when the routers forming a full neighbor adjacency decide who will send their routing information first. This +is accomplished using the RID. The router with the higher RID becomes the master and the other will become the slave. The master will send the routing information first. In a multiaccess network, the DR and BDR have to be determined first before this state starts. However, the DR does not have to be the master because each master/slave election is on a per-neighbor basis. If a router remains in this state for a long period, a maximum transmission unit (MTU) mismatch could exist between the neighboring routers, or a duplicate OSPF RID might exist. +Exchange + + + + + +Based on the missing link-state database entries identified in the Exchange state, the Loading state occurs when each neighboring router requests the other router to send those missing entries. If a router remains in this state for a long period, a packet might have been corrupted, or a router might have a memory corruption issue. Alternatively, it is possible that such a condition could result from the neighboring routers having an MTU mismatch. +Full + + + + + + + + + +From the Library of Outcast Outcast +16 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 15-3 OSPF Network Types and Characteristics + +Type Default Neighbors DR/BDR Timers +Broadcast + + +NBMA (Nonbroadcast) + +Point-to-Point + + + +Point-to-Multipoint + +Point-to-Multipoint Nonbroadcast + +(Not a default) Optimal for hub-and-spoke topologies (Frame-Relay) +(Not a default) Optimal for hub-and-spoke topologies (Frame Relay) that do +not support broadcast or multicast traffic + + + + +Table 15-4 OSPF LSAs + +LSA Type Description +1 + + +2 + + +3 + + +4 + + +5 + + +7 + + + + + + +From the Library of Outcast Outcast +Appendix C: Memory Tables 17 + + +Table 15-5 + +LSA Type +8 + + +Additional OSPF LSAs for OSPFv3 + +Description + + +9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +APPENDIX D + + + + + + +Memory Tables Answer Key + + +Chapter 1 + + +Table 1-2 + +Step + + +Steps to Diagnose a Problem + +Description + + + +Collect information + + + + +Examine collected information + + + +Eliminate potential causes + + + +Propose an hypothesis + + + + +Verify hypothesis + +Because a typical problem report lacks sufficient information to give a troubleshooter insight into a problem’s underlying cause, the troubleshooter should collect additional information, perhaps using network maintenance tools or by interviewing impacted users. +After collecting sufficient information about a problem, the troubleshooter then examines that information, perhaps comparing the information against previously collected baseline information. +Based on the troubleshooter’s knowledge of the network and his interrogation of collected information, he can begin to eliminate potential causes for the problem. +After the troubleshooter eliminates multiple potential causes for the problem, he is left with one or more causes that are more likely to have resulted in the problem. The troubleshooter hypothesizes what he considers to be the most likely cause of the problem. +The troubleshooter then tests his hypothesis to confirm or refute his theory about the problem’s underlying cause. + + + + + + + + + + + + + + +From the Library of Outcast Outcast +4 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 1-3 FCAPS Management Tasks + + +Type of Management +Fault management + + + + +Configuration management + + + +Accounting management + + +Performance management + + + +Security management + +Examples of Management Tasks +Use network management software to collect information from routers and switches. Send an e-mail alert when processor utilization or bandwidth utilization exceeds +a threshold of 80 percent. Respond to incoming trouble tickets from the help desk. +Require logging of any changes made to network hardware or software configurations. Implement a change management system to alert relevant personnel of planned network changes. +Invoice IP telephony users for their long-distance and international calls. Keeping track of what is being done on the network and when it is being done. +Monitor network performance metrics for both LAN and WAN links. Deploy appropriate quality of service (QoS) solutions to make the most efficient use of relatively limited WAN bandwidth, while prioritizing mission-critical traffic. +Deploy firewall, virtual private network (VPN), and intrusion prevention system (IPS) technologies to defend against malicious traffic. Create a security policy dictating rules of acceptable network use. Use an authorization, authentication, and accounting (AAA) server to validate user credentials, assign appropriate user privileges, and log user activity. + + + + +Chapter 2 + +Table 2-2 Severity Levels + + +Severity Level +0 + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +Name +Emergencies + +Alerts + +Critical + +Errors + +Warnings + +Notifications + +Informational + +Debugging + + + + + +From the Library of Outcast Outcast +Appendix D: Memory Tables Answer Key 5 + +Table 2-3 Comparing SNMP and NetFlow + + +Technology +SNMP + + + + + +NetFlow + +Characteristics +Collects device statistics (for example, platform resource utilization, traffic counts, and error counts) + +Uses a pull model (that is, statistics pulled from monitored device by a network management station [NMS]) + +Available on nearly all enterprise network devices + +Collects detailed information about traffic flows + +Uses a push model (that is, statistics pushed from the monitored device to a NetFlow collector) + +Available on routers and high-end switches + + + + +Table 2-4 Cisco IOS Commands for Hardware Troubleshooting + + +Command +show processes cpu + + +show memory + + +show interfaces + +Description +Provides 5-second, 1-minute, and 5-minute CPU utilization statistics, in addition to a listing of processes running on a platform along with each process’s utilization statistics +Displays summary information about processor and I/O memory, followed by a more comprehensive report of memory utilization +Shows Layer 1 and Layer 2 interface status, interface load information, and error statistics including the following: + +input queue drops: Indicates a router received information faster than the information could be processed by the router + +output queue drops: Indicates a router is not able to send information out the outgoing interface because of congestion (perhaps because of an input/output speed mismatch) + +input errors: Indicates frames were not received correctly (for example, a cyclic redundancy check (CRC) error occurred), perhaps indicating a cabling problem or a duplex mismatch + +output errors: Indicates frames were not transmitted +correctly, perhaps due to a duplex mismatch + + +Note Prior to collecting statistics, interface counters can be reset using the clear coun-ters command. + + + + + +From the Library of Outcast Outcast +6 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + + +Command show controllers + + + + +show platform + +Description +Displays statistical information about an interface (for example, error statistics), where the information varies for different interface types (for example, the type of connected cable might be displayed for a serial interface and whether it is the DCE side or DTE side of the cable) +Provides detailed information about a router or switch hardware platform + + + + +Chapter 3 + +Table 3-3 Commands for Troubleshooting High CPU Utilization + + +Command +show ip arp + + + + + +show interface interface_type interface_ number + + + + +show tcp statistics + + + + + + + + +show processes cpu + +Description +Displays the ARP cache for a router. If several entries are in the Incomplete state, you might suspect a malicious scan (for example, a ping sweep) of a subnet, or you have a route pointing out an Ethernet interface as described in our ARP Input process discussion. +Displays a collection of interface statistics. If the throttles, overruns, or ignored counters continually increment, you might suspect that the Net Background process is attempting to allocate buffer space for an interface from the main buffer pool of the router. +Provides information about the number of TCP segments a router sends and receives, including the number of connections initiated, accepted, established, and closed. A high number of connections can explain why the TCP Timer process might be consuming excessive CPU resources. If you see an excessive number of embryonic connections, you might be under a denial-of-service (DoS) attack. +Displays average CPU utilization over 5-second, 1-minute, and 5-minute intervals, in addition +to listing all the router processes and the percentage of CPU resources consumed by each of those processes. + + + + + + + + +From the Library of Outcast Outcast +Appendix D: Memory Tables Answer Key 7 + + + +Command +show processes cpu history + +Description +Displays a graphical view of CPU utilization over the past 60 seconds, 1 hour, and 3 days. This graphical view can indicate whether an observed high CPU utilization is a temporary spike in utilization or whether the high CPU utilization is an ongoing condition. + + + + +Table 3-4 Commands for Troubleshooting a Router’s Packet-Switching Modes + + +Command +show ip interface interface_type interface_ number + +show ip cache + +show processes cpu | include IP Input + + + + + +show ip cef + +show ip cef adjacency egress_interface_id next_hop_ip_address detail + +show adjacency detail + +Description +Displays multiple interface statistics, including information about the packet-switching mode of an interface. +Displays the contents of the route cache from a router if fast switching is enabled. +Displays information about the IP input process on a router. The CPU utilization for this process might show a high value if the CPU of a router is actively engaged in +process-switching traffic because you turned off fast switching and CEF. +Displays the contents of a router’s FIB. + +Displays destinations reachable through the combination of the specified egress interface and next-hop IP address. +Provides information contained in the adjacency table of a router, including protocol and timer information. + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +8 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 4 + +Table 4-2 Comparing Trunking Administrative Modes + +SW1 + + +Dynamic Auto + +Dynamic Trunk Desirable + +Trunk Access Nonegotiate + + + +Dynamic Auto + +Dynamic +Desirable +SW2 +Trunk + +Access Trunk Trunk + +Trunk Trunk Trunk + +Trunk Trunk Trunk + +Limited connectivity + +Limited connectivity + +Trunk + +Access + +Access + +Limited connectivity + + + +Trunk Limited Nonegotiate connectivity + +Limited Trunk Trunk connectivity + +Limited connectivity + + +Access Access Access Limited Limited Access connectivity connectivity + + + +Chapter 5 + +Table 5-2 STP Port Types + + +Port Type +Root port (RP) + + + + + + +Designated port (DP) + +Description +Every nonroot bridge has a single root port (this is mandatory). It is the port on the switch that is closest to the root bridge, in terms of cost, which is inversely proportional to bandwidth by default. +If cost is tied the upstream BID is used to break the tie. If the upstream BID is tied, the upstream port ID (PID) is used to break the tie. +Every network segment has a single designated port (this is mandatory). It is the port on the segment that is closest to the root bridge, in terms of cost. If cost is tied, the upstream BID is used to break the tie. If the upstream BID is tied, the upstream port ID (PID) is used to break the tie. + + +Note Because all ports on the root bridge are as close as you could get to the root bridge, all ports on a root bridge are DPs. + + + + + +From the Library of Outcast Outcast +Appendix D: Memory Tables Answer Key 9 + + + +Port Type +Nondesignated port (X) + +Description +These are the ports blocking traffic to create a loop-free topology. + + + + +Table 5-3 Default Port Costs + + +Link Speed + +10 Mbps (Ethernet) + +100 Mbps (Fast Ethernet) + +1 Gbps (Gigabit Ethernet) + +10 Gbps (Ten Gig Ethernet) + +100 Gbps + +1 Tbps + +10 Tbps + +802.1D STP Port Cost + +100 + +19 + +4 + +2 + +N/A + +N/A + +N/A + +802.1D-2004 STP Port Cost +2000000 + +200000 + +20000 + +2000 + +200 + +20 + +2 + + + + +Table 5-4 EtherChannel Modes That Will Successfully Form a Bundle + +SW1 + + +MODE PAgP Desirable + +PAgP Auto LACP Active + +LACP ON Passive + +PAgP Yes Yes No No No Desirable +SW2 PAgP Auto Yes No No No No + +LACP No No Active +LACP No No Passive +ON No No + +Yes Yes No + +Yes No No + +No No Yes + + + + + + + + + + + + + +From the Library of Outcast Outcast +10 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Chapter 6 + +Table 6-2 Options for Successfully Forming an EtherChannel + +SW1 + + +MODE PAgP Desirable + +PAgP Auto LACP Active + +LACP On Passive + +PAgP Yes Yes No No No Desirable +SW2 PAgP Auto Yes No No No No + +LACP No No Active +LACP No No Passive +On No No + +Yes Yes No + +Yes No No + +No No Yes + + + + +Chapter 8 + +Table 8-2 Comparing HSRP, VRRP, and GLBP + + +Characteristic +Cisco proprietary. + +Interface IP address can act as virtual IP address. +More than one router in a group can simultaneously forward traffic for that group. +Hello timer default value. + +Hold timer default value. + +Preemption enabled by default. + +Default priority. + +Default weight. + +Authentication supported. + +Multicast address. + +HSRP +Yes + +No + +No + + +3 seconds + +10 seconds + +No + +100 + +— + +Yes + +224.0.0.2 + +VRRP +No + +Yes + +No + + +1 second + +3 seconds + +Yes + +100 + +— + +Yes + +224.0.0.18 + +GLBP +Yes + +No + +Yes + + +3 seconds + +10 seconds + +No for AVG, Yes for AVFs +100 + +100 + +Yes + +224.0.0.102 + + +Virtual MAC address. V1: 0000.0c07.acxx 0000.5e00.01xx 0007.b400.xxyy + +(xx = group number)(yy = AVF) V2: 0000.0c9f.fxxx + + + + +From the Library of Outcast Outcast +Appendix D: Memory Tables Answer Key 11 + +Chapter 9 + +Table 9-2 DHCP Message Types + + +DHCP Message +DHCPDISCOVER + + +DHCPOFFER + +DHCPREQUEST + + +DHCPDECLINE + +DHCPACK + +DHCPNAK + + +DHCPRELEASE + + + +DHCPINFORM + +Description +A client sends this message in an attempt to locate a DHCP server. This message is sent to a broadcast IP address of 255.255.255.255 using UDP port 67. +A DHCP server sends this message in response to a DHCPDISCOVER message using UDP port 68. +This broadcast message is a request from the client to the DHCP server for the IP addressing information and options that were received in the DHCP Offer message. +This message is sent from a client to a DHCP server to inform the server that an IP address is already in use on the network. +A DHCP server sends this message to a client and includes IP configuration parameters. +A DHCP server sends this message to a client and informs the client that the DHCP server declines to provide the client with the requested IP configuration information. +A client sends this message to a DHCP server and informs the DHCP server that the client has released its DHCP lease, thus allowing the DHCP server to reassign the client IP address to another client. +This message is sent from a client to a DHCP server and requests IP configuration parameters. Such a message might be sent from an access server requesting IP configuration information for a remote client attaching to the access server. + + + + +Table 9-3 Types of NAT + + +Type of NAT + +Static NAT + +Dynamic NAT + +NAT overloading or PAT + +Description (Based on Private to Public IPv4 Address Translations) +A one-to-one mapping of private internal IP addresses to public external IP addresses +A dynamic mapping of private internal IP addresses to a pool of public external IP addresses +Allows multiple private internal IP addresses to use a single public external IP address by keeping track of Layer 4 port numbers, which make each session unique (that is, Port Address Translation [PAT]) + + + + + +From the Library of Outcast Outcast +12 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + + +Table 9-4 + +NAT IPs + + +Names of NAT IP Addresses + +Definition + + + +Inside local + +Inside global + +Outside local + + + +Outside global + +The IP address of a device inside the network; this address will be translated to the inside global address. (Example: PC inside the network) +The IP address that the Inside local address is translated to. (Example: public IP address used on Internet) +The IP address of a remote device as it appears to the devices inside the network. This may or may not be the actual address of the remote device if NAT translated it. Note that usually the outside global and outside local addresses are the same. +The IP address of the device that the inside local address is trying to communicate with. This may be translated to the outside local address (but usually is not translated). (Example: web server) + + + + +Chapter 12 + +Table 12-2 Default Administrative Distance of Route Sources + +Source of Route Information AD +Connected interface 0 + +Static route 1 + +EIGRP summary route 5 + +eBGP 20 + +EIGRP (internal) 90 + +OSPF 110 + +IS-IS 115 + +RIP 120 + +EGP 140 + +ODR 160 + +EIGRP (external) 170 + +iBGP 200 + +Unknown (not believable) 255 + + + + + + + + + +From the Library of Outcast Outcast +Appendix D: Memory Tables Answer Key 13 + +Chapter 15 + +Table 15-2 Adjacency States + + +State +Down + +Attempt + + +Init + + + + +2Way + + + +Exstart + + + + + + + + +Exchange + + + + + +Loading + + + + + +Full + +Description +This state indicates that no hellos have been received from a neighbor. + +This state occurs after a router sends a unicast hello (as opposed to a multicast hello) to a configured neighbor and has not yet received a hello from that neighbor. +This state occurs on a router that has received a hello message from its neighbor; however, the OSPF RID of the receiving router was not contained in the hello message. If a router remains in this state for a long period, something is probably preventing that router from correctly receiving hello packets from the neighboring router. +This state occurs when two OSPF routers receive hello messages from each other, and each router sees its own OSPF RID in the hello message it receives. The 2Way state is an acceptable state to stay in between DROthers on an Ethernet LAN. +This state occurs when the routers forming a full neighbor adjacency decide who will send their routing information first. This is accomplished using the RID. The router with the higher RID becomes the master and the other will become the slave. The master will send the routing information first. In a multiaccess network, the DR and BDR have to be determined first before this state starts. However, the DR does not have to be the master because each master/slave election is on a per-neighbor basis. If a router remains in this state for a long period, a maximum transmission unit (MTU) mismatch could exist between the neighboring routers, or a duplicate OSPF RID might exist. +This state occurs when the two routers forming an adjacency send one another database descriptor (DBD) packets containing information about a router’s link-state database. Each router compares the DBD packets received from the other router to identify missing entries in its own link. If a router remains in this +state for a long period, an MTU mismatch could exist between the neighboring routers. +Based on the missing link-state database entries identified in the Exchange state, the Loading state occurs when each neighboring router requests the other router to send those missing entries. If a router remains in this state for a long period, a packet might have been corrupted, or a router might have a memory corruption issue. Alternatively, it is possible that such a condition could result from the neighboring routers having an MTU mismatch. +This state indicates that the neighboring OSPF routers have successfully exchanged their link-state information with one another, and an adjacency has been formed. + + + + + + + + +From the Library of Outcast Outcast +14 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Table 15-3 OSPF Network Types and Characteristics + + +Type +Broadcast + +Default +Default on LAN interfaces + +Neighbors +Discovered automatically + +DR/BDR +DR and BDR elected +automatically + +Timers +Hello 10 + +Dead 40 + + + +NBMA (Nonbroadcast) + +Default on Frame Relay Statically main and point-to- configured multipoint interfaces + +DR must be manually configured on the hub router. + +Hello 30 + +Dead 120 + + + +Point-to-Point Default on point to point serial and point-to-point Frame Relay subinterfaces + +Discovered automatically + +No DR or BDR Hello 10 + +Dead 40 + + + +Point-to-Multipoint + + +Point-to-Multipoint Nonbroadcast + +(Not a default) Optimal Discovered for hub-and-spoke automatically topologies (Frame- +Relay) + +(Not a default) Optimal Statically for hub-and-spoke Configured topologies (Frame +Relay) that do not support broadcast or multicast traffic + +No DR or BDR + + + +No DR or BDR + +Hello 30 + +Dead 120 + + +Hello 30 + +Dead 120 + + + + + +Table 15-4 + +LSA Type +1 + + + +2 + + + +3 + + +OSPF LSAs + +Description +All OSPF routers source Type 1 LSAs. These advertisements list information about directly connected subnets, the OSPF connection types of a router, and the known OSPF adjacencies of a router. A Type 1 LSA is not sent out of its local area. +The designated router on a multiaccess network sends a Type 2 LSA for that network if the network contains at least two routers. A Type 2 LSA contains a listing of routers connected to the multiaccess network and, like a Type 1 LSA, is constrained to its local area. +A Type 3 LSA is sourced by an ABR. Each Type 3 LSA sent into an area contains information about a network reachable in a different area. Note that network information is exchanged only between the backbone area and a nonbackbone area, as opposed to being exchanged between two nonbackbone areas. + + + + + + + + +From the Library of Outcast Outcast +Appendix D: Memory Tables Answer Key 15 + + + +LSA Type 4 + + +5 + + + + +7 + + + + + + + + + +Table 15-5 + +LSA Type +8 + + + +9 + +Description +Similar to a Type 3 LSA, a Type 4 LSA is sourced by an ABR. However, instead of containing information about OSPF networks, a Type 4 LSA contains information stating how to reach an ASBR. +A Type 5 LSA is sourced by an ASBR and contains information about networks reachable outside the OSPF domain. A Type 5 LSA is sent to all OSPF areas, except for stub areas. Note that the ABR for a stub area sends default route information into the stub area, rather than the network-specific Type 5 LSAs. +A Type 7 LSA is sourced from an ASBR within a not-so-stubby area (NSSA). Whereas a stub area cannot connect to an external autonomous system, an NSSA can. The Type 7 LSA only exists in the NSSA; therefore, the external routes are announced by the ABR(s) of the NSSA into Area 0 using Type 5 LSAs. In addition, like a stub area external routes known to another OSPF area are not forwarded into an NSSA since Type 5 LSAs are not permitted in an NSSA. + + + +Additional OSPF LSAs for OSPFv3 + +Description +This LSA type (Link) provides information to neighbors about link-local addresses and the IPv6 addresses associated with the link. Therefore, it is only flooded on the local link and will not be reflooded by other OSPF routers. +This LSA type (Intra Area Prefix) provides information for two different scenarios. 1) It will provide information about IPv6 address prefixes associated with a transit network by referencing a Network LSA. 2) It will provide information about IPv6 address prefixes associated with a router by referencing a Router LSA. Type 9 LSAs are only flooded within an area. + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + +Appendix E Study Planner +Practice Test Reading Task + + +Element Task Goal Date First Date Completed + + +Second Date Completed (Optional) + + +Introduction Read Introduction +1. Introduction to Troubleshooting and Network +Maintenance Read Foundation Topics +1. Introduction to Troubleshooting and Network +Maintenance Review Key Topics +1. Introduction to Troubleshooting and Network +Maintenance Define Key Terms +1. Introduction to Troubleshooting and Network Review Command Maintenance Reference + + +2. Troubleshooting and Maintenance Tools 2. Troubleshooting and Maintenance Tools 2. Troubleshooting and Maintenance Tools + +2. Troubleshooting and Maintenance Tools + +2. Troubleshooting and Maintenance Tools + +3. Troubleshooting Device Performance 3. Troubleshooting Device Performance 3. Troubleshooting Device Performance + +3. Troubleshooting Device Performance + +3. Troubleshooting Device Performance + + +Part I Review + + +4. Troubleshooting Layer 2 Trunks, VTP, and VLANs +4. Troubleshooting Layer 2 Trunks, VTP, and VLANs +4. Troubleshooting Layer 2 Trunks, VTP, and VLANs +4. Troubleshooting Layer 2 Trunks, VTP, and VLANs +4. Troubleshooting Layer 2 Trunks, VTP, and VLANs +5. Troubleshooting STP and Layer 2 +EtherChannel + +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Memory Tables +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Memory Tables +Review Command Reference +Take practice test in study mode using Exam Bank #1 questions for chapters 1-3 in practice test software + +Read Foundation Topics + +Review Key Topics + +Define Key Terms + +Review Memory Tables + +Review Command Reference + + + + +From the Library of Outcast Outcast +5. Troubleshooting STP and Layer 2 EtherChannel +5. Troubleshooting STP and Layer 2 EtherChannel +5. Troubleshooting STP and Layer 2 EtherChannel +5. Troubleshooting STP and Layer 2 EtherChannel +6. Troubleshooting InterVLAN Routing and Layer 3 EtherChannels +6. Troubleshooting InterVLAN Routing and Layer 3 EtherChannels +6. Troubleshooting InterVLAN Routing and Layer 3 EtherChannels +6. Troubleshooting InterVLAN Routing and Layer 3 EtherChannels +6. Troubleshooting InterVLAN Routing and Layer 3 EtherChannels +7. Troubleshooting Switch Security Features 7. Troubleshooting Switch Security Features 7. Troubleshooting Switch Security Features + +7. Troubleshooting Switch Security Features + +8. Troubleshooting FHRP 8. Troubleshooting FHRP 8. Troubleshooting FHRP + +8. Troubleshooting FHRP + +8. Troubleshooting FHRP + + +Part II Review + + +9. Troubleshooting IPv4 Addressing and Addressing Technologies +9. Troubleshooting IPv4 Addressing and Addressing Technologies +9. Troubleshooting IPv4 Addressing and Addressing Technologies +9. Troubleshooting IPv4 Addressing and Addressing Technologies +9. Troubleshooting IPv4 Addressing and Addressing Technologies +10. Troubleshooting IPv6 Addressing and Addressing Technologies +10. Troubleshooting IPv6 Addressing and Addressing Technologies +10. Troubleshooting IPv6 Addressing and Addressing Technologies +10. Troubleshooting IPv6 Addressing and Addressing Technologies +11. Troubleshooting IPv4 and IPv6 ACLs and +Prefix-Lists + + +Review Key Topics + +Define Key Terms + +Review Memory Tables + +Review Command Reference +Read Foundation Topics + +Review Key Topics + +Define Key Terms + +Review Memory Tables + +Review Command Reference + +Review Key Topics Define Key Terms +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Memory Tables +Review Command Reference +Take practice test in study mode using Exam Bank #1 questions for chapters 4-8 in practice test software + +Read Foundation Topics + +Review Key Topics + +Define Key Terms + +Review Memory Tables + +Review Command Reference +Read Foundation Topics + +Review Key Topics + +Define Key Terms + +Review Command Reference +Read Foundation Topics + + + + +From the Library of Outcast Outcast +11. Troubleshooting IPv4 and IPv6 ACLs and Prefix-Lists +11. Troubleshooting IPv4 and IPv6 ACLs and Prefix-Lists +11. Troubleshooting IPv4 and IPv6 ACLs and Prefix-Lists +12. Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels +12. Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels +12. Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels +12. Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels +12. Troubleshooting Basic IPv4/IPv6 Routing and GRE Tunnels + +13. Troubleshooting RIP 13. Troubleshooting RIP 13. Troubleshooting RIP + +13. Troubleshooting RIP + +14. Troubleshooting EIGRP 14. Troubleshooting EIGRP 14. Troubleshooting EIGRP + +14. Troubleshooting EIGRP + +15. Troubleshooting OSPF 15. Troubleshooting OSPF 15. Troubleshooting OSPF + +15. Troubleshooting OSPF + +15. Troubleshooting OSPF + +16. Troubleshooting Route Maps and PBR 16. Troubleshooting Route Maps and PBR 16. Troubleshooting Route Maps and PBR + +16. Troubleshooting Route Maps and PBR + +17. Troubleshooting Redistribution 17. Troubleshooting Redistribution 17. Troubleshooting Redistribution + +17. Troubleshooting Redistribution + +18. Troubleshooting BGP 18. Troubleshooting BGP 18. Troubleshooting BGP + +18. Troubleshooting BGP + + +Review Key Topics + +Define Key Terms + +Review Command Reference +Read Foundation Topics + +Review Key Topics + +Define Key Terms + +Review Memory Tables + +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Memory Tables +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Command Reference + + + + + +From the Library of Outcast Outcast + +Part III Review + + +19. Troubleshooting Remote Connectivity 19. Troubleshooting Remote Connectivity 19. Troubleshooting Remote Connectivity + +19. Troubleshooting Remote Connectivity + +20. Troubleshooting Management Access 20. Troubleshooting Management Access 20. Troubleshooting Management Access + +20. Troubleshooting Management Access + + +Part IV Review + + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets + +21. Additional Trouble Tickets 22. Final Preparation + +22) Final Review + + +22. Final Preparation + +22. Final Preparation + +22. Final Preparation + +Take practice test in study mode using Exam Bank #1 questions for chapters 9-18 in practice test software + +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Command Reference +Read Foundation Topics + +Review Key Topics Define Key Terms +Review Command Reference +Take practice test in study mode using Exam Bank #1 questions for chapters 19-20 in practice test software +Review and resolve trouble ticket #1 Review and resolve trouble ticket #2 Review and resolve trouble ticket #3 Review and resolve trouble ticket #4 Review and resolve trouble ticket #5 Review and resolve trouble ticket #6 Review and resolve trouble ticket #7 Review and resolve trouble ticket #8 Review and resolve trouble ticket #9 Review and resolve trouble ticket #10 +Read Chapter +Take practice test in study mode for all Book Questions in practice test software +Review all Key Topics in all chapters +Complete all memory tables from appendix C Review all Command Reference Tables in all chapters + + + + + + + +From the Library of Outcast Outcast + +22. Final Preparation + +Take pracitce test in practice exam mode using Exam Bank #2 quesitons for all chapters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast +GLOSSARY + + + + + + + + + + + +224.0.0.10 The multicast IPv4 used by EIGRP routers to form a neighbor adjacency. + + +224.0.0.5 + +224.0.0.6 routers. + + +The All OSPF Routers multicast IPv4 address, listened for by all OSPF routers. + +The All OSPF DR Routers multicast IPv4 address, listened to by DR and BDR + + +2Way (OSPF) A neighbor state that signifies the other router has reached neighbor status, having passed the parameter check. + +802.1D An IEEE standard for Spanning Tree Protocol. + +802.1Q A method of passing frames and their VLAN associations over a trunk link, based on the IEEE 802.1Q standard. + +802.1s An IEEE standard for Multiple Spanning Tree Protocol. + +802.1w An IEEE standard for Rapid Spanning Tree Protocol. + +ABR See Area Border Router. + +access port Ports on a switch that typically connect to end stations that will never form a trunk. + +ACK (EIGRP) An EIGRP message that is used to acknowledge reliable EIGRP messages (namely update, query, and reply messages). ACK messages do not require acknowledgment with an ACK message. +ACL (access control list) A list containing entries configured on a router or switch that can be used to identify traffic that will have a particular action applied to it based on the ser-vice or feature that is using the list. +active (BGP state) A BGP neighbor state in which the TCP connection has successfully completed, but the BGP neighbors have not yet agreed to exchange path information. + +active (EIGRP) A state for a route in an EIGRP topology table that indicates that the router is actively sending query messages for this route, attempting to validate and learn the current best route to that subnet. +active forwarder See HSRP active forwarder. + +active virtual forwarder (AVF) A GLBP router that takes on a virtual MAC address and forwards traffic received on that address. + + + +From the Library of Outcast Outcast +4 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +active virtual gateway (AVG) The GLBP router that answers all ARP requests for the vir-tual router address and assigns virtual MAC addresses to each router in the GLBP group. + +address family (named EIGRP/OSPFv3/MP-BGP) A method of configuring IPv4 and IPv6 routing services under the same routing process. IPv4 address families are used for IPv4 routing, and IPv6 address families are used for IPv6 routing. +address families See address family. + +adjacency table A table used by CEF that stores the Layer 2 addressing for all FIB entries of next-hop devices. + +administrative distance In Cisco routers, a means for one router to choose between multiple routes to reach the same subnet when those routes are learned by different routing protocols. The lower the administrative distance, the more preferred the source of the rout-ing information. +ADVERTISE message DHCPv6 servers respond to SOLICIT messages with a unicast ADVERTISE message offering addressing information to the DHCPv6 client. + +advertised distance See reported distance. + +aggregate route Another term for summary route. + +alternate port (RSTP) A port on a switch other than the root port that has an alternative path to the root bridge. + +anycast An IPv6 address type that is used by a number of hosts in a network that are pro-viding the same service. Hosts accessing the service are routed to the nearest host in an any-cast environment based routing protocol metrics. +APIPA See Automatic Private IP Addressing. + +archive A Cisco IOS feature that is used to create automatic archives of device configura-tions. + +Area Border Router (ABR) A router that has interfaces connected to at least two differ-ent OSPF areas, one of which must be the backbone area. ABRs hold topology data for each area, and calculate routes for each area, and advertise about those routes between areas. +area A grouping of routers and router interfaces, typically contiguous. Routers in an area strive to learn all topology information about the area, and do not learn topology informa-tion about areas to which they do not connect. +ARP (Address Resolution Protocol) Defined in RFC 826, a protocol used on an Ethernet LAN by devices to determine the Layer 2 MAC address of a known Layer 3 IP address. + +ARP cache A table that Ethernet-enabled devices use to maintain the IPv4 to MAC address mappings. + +ARP input process A process in charge of sending ARP requests on a router. + +ARP poisoning Also known as ARP spoofing. An attack whereby an attacker sends spe-cially crafted ARP replies so that its own MAC address appears as the gateway or some other targeted host. From that time on, unsuspecting clients unknowingly send traffic to the attacker. + + +From the Library of Outcast Outcast +Glossary 5 + +AS_PATH access list A Cisco IOS configuration tool, using the ip as-path access-list command that defines a list of statements that match the AS_PATH BGP path attribute using regular expressions. +AS_PATH prepending This term has two BGP-related definitions. First, it is the normal process in which a router, before sending an update to an eBGP peer, adds its local ASN to the beginning of the AS_PATH path attribute. Second, it is the routing policy of purposefully adding one or more ASNs to the beginning of a route’s AS_PATH path attribute, typically to lengthen the AS_PATH and make the route less desirable in the BGP decision process. +AS_PATH A BGP path attribute that lists ASNs through which the route has been adver-tised. The AS_PATH includes four types of segments: AS_SEQ, AS_SET, AS_CONFED_SEQ, and AS_CONFED_SET. Often, this term is used synonymously with AS_SEQ. +ASBR (Autonomous System Border Router) A router using OSPF in which the router learns routes via another source, typically another routing protocol, exchanging routes that are external to OSPF with the OSPF domain. +ASBR-Summary Link-state advertisement (LSA). See Type 4 LSA. + +asymmetric routing A routing condition where packets take one path when traveling from a source device to a destination device, but return traffic takes a different path. + +authentication, authorization, and accounting (AAA) A security feature that allows a router to authenticate user credentials, determine what a user is allowed to do, and keep an audit trail of what the user did. +authentication With routing protocols, the process by which the router receiving a routing update determines whether the routing update came from a trusted router. + +authNoPriv An SNMP security model used with SNMPv3 to provide improved authentica-tion using MD5 or SHA hashing algorithms. + +authPriv An SNMP security model used with SNMPv3 to provide improved authentication using MD5 or SHA hashing algorithms and privacy using encryption algorithms such as DES, 3DES, and AES. +Automatic Private IP Addressing An IPv4 addressing method used by DHCPv4 clients when the DHCPv4 server is not available. The clients automatically assign themselves an IPv4 address in the 169.254.0.0/16 network. +autonegotiation A mechanism used by a device and a switchport to automatically negoti-ate the link speed and duplex mode. + +autonomous system In BGP, a set of routers inside a single administrative authority, grouped together for the purpose of controlling routing policies for the routes advertised by that group to the Internet. +Autonomous System Border Router See ASBR. + +autonomous system number (ASN) A number between 1 and 64,511 (public) and 64,512 and 65,535 (private) assigned to an autonomous system for the purpose of proper BGP operation. + + + +From the Library of Outcast Outcast +6 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +autosummarization A routing protocol feature in which a router that connects to more than one classful network advertises summarized routes for each entire classful network when sending updates out interfaces connected to other classful networks. +backbone area (OSPF) Area 0; the area to which all other OSPF areas must connect for OSPF to function properly. + +backbone router Any OSPF router that has at least one interface connected to the back-bone area. + +BackboneFast An STP feature that can detect an indirect link failure and shorten the STP convergence time to 30 seconds by bypassing the max age timeout period. + +backplane Physically interconnects a switch’s ports. Therefore, depending on the specific switch architecture, frames flowing through a switch enter via a port (that is, an ingress port), flow across the switch’s backplane, and are forwarded out of another port (that is, an egress port). +backup designated router (BDR) In OSPF, a router that is prepared to take over the des-ignated router. + +backup port (RSTP) A port that provides a redundant (but less desirable) connection to a segment where another switchport already connects. + +bandwidth 1) The rate at which bits are sent on an interface. 2) The Cisco IOS Software setting, per the bandwidth command, that tells the Cisco IOS the speed of the interface. + +baseline A collection of network measurements taken when the network is functioning properly. Measurements taken during a troubleshooting scenario could be contrasted with baseline information. +BDR See backup designated router. + +best path algorithm A set of rules by which BGP examines the details of multiple BGP routes for the same NLRI and chooses the single best BGP route to install in the local BGP table. +BGP decision process See best path algorithm. + +BGP hard reset The process of restarting a BGP neighbor relationship by closing the TCP connection, causing both neighboring routers to remove all paths formerly learned from that neighbor from their respective BGP tables. +BGP neighbor table Contains a listing of all BGP neighbors configured for a router, including each neighbor’s IP address, the ASN, the state of the neighbor relationship, and several other statistics. +BGP peer group In BGP, a configuration construct in which multiple neighbors’ param-eters can be configured as a group, thereby reducing the length of the configuration. In addi-tion, BGP performs routing policy logic against only one set of Updates for the entire peer group, improving convergence time. +BGP peer Another name for a BGP neighbor. A BGP neighbor is another router running BGP with which the local router has formed a BGP neighbor relationship for the purpose of exchanging BGP Updates. + + +From the Library of Outcast Outcast +Glossary 7 + +BGP soft reset The process of restarting a BGP neighbor relationship without closing the underlying TCP connection, instead resending full updates to the neighbor, and asking for the neighbor to send a full update again. +BGP synchronization In BGP, a feature in which BGP routes cannot be considered to be a best route to reach an NLRI unless that same prefix exists in the router’s IP routing table as learned via some IGP. +BGP table A table inside a router that holds the path attributes and NLRI known by the BGP implementation on that router. + +BGP update A BGP message that includes withdrawn routes, path attributes, and NLRI. + +BGP See Border Gateway Protocol. + +blocking One of four Spanning Tree Protocol (STP) states for a port. A port remains in the blocking state for 20 seconds by default. During this time, a nondesignated port evaluates bridge protocol data units (BPDUs) in an attempt to determine its role in a spanning tree. If it is determined that it must stay in the blocking state to prevent a loop, it will. +Border Gateway Protocol (BGP) An exterior routing protocol designed to exchange prefix information between different autonomous systems. The information includes a rich set of characteristics called path attributes, which in turn allows for great flexibility regarding routing choices. +bottom-up method A troubleshooting method where troubleshooting starts at the bottom (that is, Layer 1) of the OSI model and works its way up. + +boundary router A router that sits at the boundary of the routing domains and performs redistribution. + +BPDU Filter An STP feature that prevents BPDUs from being sent or processed on a switchport. + +BPDU Guard An STP feature that disables a switchport if any BPDU is received. + +BPDU Bridge protocol data unit; the data message exchanged by switches participating in the Spanning Tree Protocol. + +bridging loop A condition where Ethernet frames are forwarded endlessly around a Layer 2 loop formed between switches in a redundant topology. + +broadcast domain The extent of a network where a single broadcast frame or packet will be seen. + +buffer leak A buffer leak occurs when a process does not return a buffer to the router when the process has finished using the buffer. + +CAM Content-addressable memory; the high-performance table used by a switch to corre-late MAC addresses with the switch interfaces where they can be found. + +Carrier sense multiple access collision detect (CSMA/CD) A mechanism used on Ethernet networks to detect collisions and cause transmitting devices to back off for a ran-dom time. + + + +From the Library of Outcast Outcast +8 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Challenge Handshake Authentication Protocol (CHAP) A security feature defined by PPP that allows either or both endpoints on a link to authenticate the other device as a par-ticular authorized device. +change management The process of controlling how alterations are managed to minimize downtime within the organization. + +CHAP See Challenge Handshake Authentication Protocol. + +CIDR notation See prefix notation. + +CIDR See classless interdomain routing. + +Cisco Discovery Protocol (CDP) A Cisco proprietary protocol used to advertise and dis-cover directly connected devices automatically. + +Cisco Express Forwarding (CEF) An optimized Layer 3 forwarding path through a router or switch. CEF optimizes routing table lookup by creating a special, easily searched tree structure based on the contents of the IP routing table. The forwarding information is called the Forwarding Information Base (FIB), and the cached adjacency information is called the adjacency table. +Cisco Lifecycle Services An approach to the implementation of Cisco technologies, as defined by Cisco. + +Cisco TAC A technical assistance center (resource that requires a contract) provided by Cisco to assist you with troubleshooting issues related to their products. + +classful IP addressing A convention for discussing and thinking about IP addresses by which Class A, B, and C default network prefixes (of 8, 16, and 24 bits, respectively) are con-sidered. +classful network An IPv4 Class A, B, or C network. It is called a classful network because these networks are defined by the class rules for IPv4 addressing. + +classful routing protocol An inherent characteristic of a routing protocol. Specifically, the routing protocol does not send subnet masks in its routing updates. This requires the protocol to make assumptions about classful networks and makes it unable to support VLSM and manual route summarization. +classful routing A type of logic for how a router uses a default route. When a default route exists, and the Class A, B, or C network for the destination IP address does not exist in the routing table, the default route is used. If any part of that classful network exists in the routing table, but the packet does not match any existing subnet of that classful network, the packet does not match the default route and thus is discarded. +classless addressing A concept in IPv4 addressing that defines a subnetted IP address as having two parts: a prefix (or subnet) and a host. + +classless interdomain routing (CIDR) Defined in RFCs 1517–1520, a scheme to help reduce Internet routing table sizes by administratively allocating large blocks of consecutive classful IP network numbers to ISPs for use in different global geographies. CIDR results in large blocks of networks that can be summarized, or aggregated, into single routes. + + + +From the Library of Outcast Outcast +Glossary 9 + +classless IP addressing A convention for IP addresses in which Class A, B, and C default network prefixes (of 8, 16, and 24 bits, respectively) are ignored. + +classless routing protocol An inherent characteristic of a routing protocol. Specifically, the routing protocol sends subnet masks in its routing updates, thereby removing any need to make assumptions about the addresses in a particular subnet or network. This allows the protocol to support VLSM and manual route summarization. +CLI (command-line interface) The primary method of interacting with the Cisco IOS on routers and switches using commands. + +collision domain The extent within a network that an Ethernet collision will be noticed or experienced. + +Common Spanning Tree (CST) A single instance of STP defined in the IEEE 802.1D standard. + + +community string an SMNP agent. + +community VLAN + + +A plain-text password that is used to authenticate an SNMP NMS and + + +A type of secondary private VLAN; switchports associated with the + +same community VLAN can communicate with each other. + +comparing configurations method The comparing configurations method of trouble-shooting compares a known good configuration with a current configuration. The difference in those configurations might give the troubleshooter insight into the underlying cause of a problem. +component swapping method The component swapping method of troubleshoot-ing replaces individual network components (for example, a cable, switch, or router) in an attempt to isolate the cause of a problem. +configure replace A Cisco IOS feature that allows for the running configuration to be completely replaced with an archived configuration so a merge does not occur. + +console The physical port on Cisco IOS devices that can be used for management purposes that requires a console or rollover cable. + +contiguous network In IPv4, an internetwork design in which packets forwarded between any two subnets of a single classful network only pass through the subnets of that classful network. +control plane The control plane of operation encompasses protocols used between rout-ers and switches. These protocols include, for example, routing protocols and Spanning Tree Protocol (STP). Also, a router or switch’s processor and memory reside in the control plane. +convergence The time required for routing protocols to react to changes in the network, removing bad routes and adding new, better routes so that the current best routes are in all the routers’ routing tables. +CSU/DSU (channel service unit/data service unit) A device that connects a physical circuit installed by the telco to some CPE device, adapting between the voltages, current, framing, and connectors used on the circuit to the physical interface supported by the DTE. + + + +From the Library of Outcast Outcast +10 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +data communications equipment (DCE) From a physical layer perspective, the device providing the clocking on a WAN link, typically a CSU/DSU, is the DCE. From a packet-switching perspective, the service provider’s switch, to which a router might connect, is con-sidered the DCE. +data plane In IP routing, a term referring to a set of processes that forward packets through a router or a multilayer switch. + +Database Description (DBD) A type of OSPF packet used to exchange and acknowledge LSA headers. + +data-link connection identifier (DLCI) A Frame Relay address used in Frame Relay head-ers to identify the virtual circuit. + +DBD See Database Description. + +DCE See data communications equipment. + +dead interval With OSPF, the timer used to determine when a neighboring router has failed, based on a router not receiving any OSPF messages, including Hellos, in this timer period. Also called the dead timer. +default route A route that is used for forwarding packets when the packet does not match any more specific routes in the IP routing table. + +delay A Cisco IOS Software setting, per the delay command, that defines to the router an estimate of the time that a packet is expected to spend trying to exit a router interface. The delay command uses a unit of tens of microseconds. +designated port (STP) The port on a segment that receives and forwards frames to the root bridge. This port is the port on the segment that is closest to the root bridge based on cost. +designated router (DR) On multiaccess data links such as LANs, an OSPF router elected by the routers on that data link to perform special functions. These functions include the generation of LSAs representing the subnet and playing a key role in the database exchange process. +destination MAC address The MAC address of the recipient of a frame. + +DHCP relay agent A multilayer switch or router that intercepts and relays DHCP negotia-tion messages between a client and a DHCP server on different VLANs/subnets. + +DHCP snooping (trusted port) A port that is able to receive all types of DHCP messages and typically connects to where the DHCP server is located. + +DHCP snooping (untrusted port) A port that is not able to receive DHCP Discover or DHCP Request messages. The default for all ports when DHCP snooping is enabled. + +DHCP snooping A security feature that enables a switch to intercept all DHCP requests coming from untrusted switchports before they are flooded to unsuspecting users. + +DHCP See Dynamic Host Configuration Protocol. + +DHCPACK A DHCPv4 unicast message used by the DHCPv4 server to acknowledge that the addressing information is reserved for the client. + + +From the Library of Outcast Outcast +Glossary 11 + +DHCPDISCOVER A DHCPv4 broadcast message used by a client to locate a DHCPv4 server. + +DHCPOFFER A DHCPv4 unicast message used by a DHCPv4 server to provide a client with addressing information. + +DHCPREQUEST A DHCPv4 broadcast message used by a client to request the addressing information that was provided in the offer. + +DHCPv4 relay agent A device such as a router or multilayer switch that is able to relay DHCPv4 DISCOVER messages to a DHCPv4 server in a different IPv4 network. + +DHCPv6 relay agent A device such as a router or multilayer switch that is able to relay DHCPv6 SOLICIT messages to a DHCPv6 server in a different IPv6 network. + +DHCPv6 A DHCP service that is compatible with IPv6 clients; a switch can assign IPv6 addresses and advertise DHCP-related options. + +Diffusing Update Algorithm (DUAL) A convergence algorithm used in EIGRP that pro-vides loop-free operation at every instance throughout a route computation. Allows routers involved in a topology change to synchronize at the same time, while not involving routers that are unaffected by the change. +Dijkstra Shortest Path First (SPF) algorithm The name of the algorithm used by link-state. + +Dijkstra Alternative name for the SPF algorithm, named for its inventor, Edsger W. Dijkstra. + +discarding state (RSTP) In this state, incoming frames on a port are dropped and no MAC addresses are learned. + +discontiguous network In IPv4, an internetwork design in which packets forwarded between two subnets of a single classful network must pass through the subnets of another classful network. +distance vector The logic behind the behavior of some interior routing protocols, such as RIP and IGRP, characterized by routers sending brief information about a subnet, and a met-ric (vector) describing how far away that subnet is. Distance vector routing algorithms call for each router to send its entire routing table in each periodic update, but only to its neighbors. Distance vector routing algorithms can be prone to routing loops but are computationally simpler than link-state routing algorithms. Also called Bellman-Ford routing algorithm. +distribute list A Cisco IOS configuration tool for routing protocols by which routing updates may be filtered. + +divide-and-conquer method A method of troubleshooting where the troubleshooting begins in the middle (for example, Layer 3) of the OSI model and radiates out from that layer. +DLCI See data-link connection identifier. + +documentation The process of recording the physical and logical components of your network as well as all the adds, moves, and changes that occur in the network. + + + +From the Library of Outcast Outcast +12 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +DORA The DHCP process a client and server use to determine the appropriate IPv4 addressing information the client needs. (Discover, Offer, Request, Ack). + +DR election (OSPF) The process by which neighboring OSPF routers examine their Hello messages and elect the DR. The decision is based on priority (highest), or RID (highest) if pri-ority is a tie. +DR See designated router. + +DROther The term to describe a router that is neither the DR nor the BDR on a subnet that elects a DR and BDR. + +dual stack In IPv6, a mode of operation in which a host or router runs both IPv4 and IPv6. + +DUAL See Diffused Update Algorithm. + +duplex mismatch A condition where the devices on each end of a link use conflicting duplex modes. + +duplex mode The Ethernet mode that governs how devices can transmit over a connection. See half-duplex and full-duplex. + +duplicate address detection (DAD) An IPv6 mechanism through which a host can determine whether another active host on the same local link is trying to use the same IPv6 address. +dynamic ARP inspection (DAI) A security feature that can mitigate ARP-based attacks. ARP replies received on untrusted switchports are checked against known, good values con-tained in the DHCP snooping database. +dynamic auto An automatic trunking method that uses DTP to negotiate the formation of a trunk. This method will wait for DTP messages to arrive requesting to form a trunk. + +dynamic desirable An automatic trunking method that uses DTP to negotiate the forma-tion of a trunk. This method will attempt to form a trunk by sending DTP messages and will respond to DTP messages sent from other devices. +Dynamic Host Configuration Protocol (DHCP) A standard (RFC 2131) protocol by which a host can dynamically broadcast a request for a server to assign to it an IP address, along with other configuration settings, including a subnet mask and default gateway IP address. +Dynamic Multipoint VPN (DMVPN) A virtual private network (VPN) technology that allows a tunnel to be set up or torn down between two sites on an as-needed basis. + +Dynamic NAT (DNAT) A version of Network Address Translation (NAT), where inside local addresses are dynamically assigned an inside global address from a pool of available addresses. +Dynamic Trunking Protocol (DTP) A Cisco proprietary method of negotiating a trunk link between two switches. + +E1 route (OSPF) An OSPF external route for which internal OSPF cost is added to the cost of the route as it was redistributed into OSPF. + + + +From the Library of Outcast Outcast +Glossary 13 + +E2 route (OSPF) An OSPF external route for which internal OSPF cost is not added to the cost of the route as it was redistributed into OSPF. + +eBGP multihop A BGP feature that defines the IP TTL field value in packets sent between two eBGP peers. This feature is required when using IP addresses other than the interface IP address on the link between peers. +eBGP See External BGP. + +edge port A switchport STP mode that immediately transitions the port to the forwarding state bypassing the listening and learning states. If the link flaps, no TCNs will be generated. + +EGP See Exterior Gateway Protocol. + +egress port The port a frame will be sent out. + +EIGRP (Enhanced Interior Gateway Routing Protocol) An advanced version of IGRP developed by Cisco. Provides superior convergence properties and operating efficiency and combines the advantages of link-state protocols with those of distance-vector protocols. Uses the DUAL algorithm. +EIGRP for IPv6 An interior routing protocol for IPv6 based on the original EIGRP proto-col for IPv4. + +EIGRP stub router A router running EIGRP that limits itself in several different ways for the purpose of limiting EIGRP DUAL algorithm computations and reducing EIGRP Query scope. +Embedded Event Manager (EEM) The EEM feature can create custom event definitions on a router and specify actions the router can take in response to these events. + +encapsulation The process of adding header information and possibly trailer information at different layers of the OSI model depending on the protocol. + +end-to-end VLAN A single VLAN that spans the entire switched network, from one end to the other. + +err-disabled The status of a port when an issue has occurred that places the port in the err-disabled state. Examples of features that use this include port security, BPDU Guard, UDLD. +established A BGP neighbor state in which the BGP neighbors have stabilized and can exchange routing information using BGP Update messages. + +EtherChannel A logical link made up of bundled or aggregated Layer 2 or Layer 3 physi-cal links. + +EUI-64 A specification for the 64-bit interface ID in an IPv6 address, composed of the first half of a MAC address (with the seventh bit flipped), added hex values of FFFE, followed by the last half of the MAC address. +extended ACL An ACL that is able to match packets based on multiple criteria such as source and destination IP address, source and destination port numbers, protocols, and QoS parameters. + + + +From the Library of Outcast Outcast +14 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Exterior Gateway Protocol (EGP) A routing protocol that was designed to exchange routing information between different autonomous systems. EGP has been replaced by BGP and is no longer supported in Cisco IOS. +External BGP A term referring to how a router views a BGP peer relationship, in which the peer is in another AS. + +External LSA In OSPF, an LSA that represents a subnet that OSPF learned from another (external) routing source, typically through route redistribution by an ASBR. + +external route A characteristic of a route, as defined by a particular routing protocol, that means that the route was learned by that routing protocol through the route redistribution + +process. + +External Type 1 + +External Type 2 + + + +See E1 route. + +See E2 route. + + +fast switching A router and multilayer switch packet switching mode that makes use of a route cache maintained in a router’s data plane. The route cache contains information +about how traffic from different data flows should be forwarded. The first packet in a data flow is process switched by a router’s CPU. Once the router determines how to forward the first frame of a data flow, that forwarding information is then stored in the route cache. Subsequent packets in that same data flow are then forwarded based on information in the +route cache, as opposed to being process switched. As a result, fast switching reduces a rout-er’s CPU utilization, as compared to process switching. +FCAPS FCAPS is a network management model defined by the ISO, where the acronym FCAPS stands for fault management, configuration management, accounting management, performance management, and security management. +FD See feasible distance. + +feasibility condition With EIGRP, to be a feasible successor, the reported distance must be lower than the feasible distance of the successor. + +feasible distance The name of the EIGRP metric, which defines how far a destination network is away from the local device. Lower is better. It is a combination of the reported distance from a neighbor and the distance to reach that neighbor. +feasible successor With EIGRP, a route that is not a successor route but that meets the feasibility condition and can be used when the successor route fails, without causing loops. + +FIB See Forwarding Information Base. + +flash updates See triggered updates. + +floating static route A static route configured with an administrative distance greater than a routing protocol on that same router, resulting in the static route floating into the routing table when the routing protocol’s learned route fails. +flooding (frame) An Ethernet frame is replicated and sent out every available switchport in the same VLAN. + + + + +From the Library of Outcast Outcast +Glossary 15 + +flooding (OSPF) The process of exchanging LSA information throughout an area, by hav-ing a router send the LSAs to their neighbors who in turn send the LSAs to their neighbors, and so on. +following the traffic path method A troubleshooting method whereby the troubleshoot-ing process will check components (for example, links and devices) over which traffic flows on its way from source to destination. +forward delay The time interval that a switch spends in the Listening and Learning states; default 15 seconds. + +forwarding (STP) One of four STP states for a port. A port moves from the learning state to the forwarding state and begins to forward frames. + +Forwarding Information Base A CEF database that contains Layer 3 information, simi-lar to the information found in an IP routing table. In addition, an FIB contains information about multicast routes and directly connected hosts. +forwarding logic The process of determining how the Cisco IOS device will handle the traffic received. + +Frame Relay Inverse ARP Defined in RFC 1293, this protocol enables a Frame Relay-attached device to react to a received LMI “PVC up” message by announcing its Layer 3 addresses to the device on the other end of the PVC. +Frame Relay mapping The information that correlates, or maps, a Frame Relay DLCI to the Layer 3 address of the DTE on the other end of the VC identified by the local DLCI. + +Frame Relay An international standard data-link protocol that defines the capabilities to create a frame-switched (packet-switched) service, allowing DTE devices (typically routers) to send data to many other devices using a single physical connection to the Frame Relay service. +frame The result of encapsulating a Layer 3 packet with Layer 2 header and trailer informa-tion. + +FTP A File Transfer Protocol that can be used to copy files (such as configuration files or the IOS) from a router or switch to an FTP server. + +full mesh A network design term often used with multiaccess network such as Frame Relay, referring to the case in which a direct communications path exists between every pair of devices in the design. +full state In OSPF, a neighbor state that implies that the two routers have exchanged the complete (full) contents of their respective LSDBs. + +full-duplex This duplex mode is used when only two devices share the collision domain, as a result, both devices can transmit simultaneously. + + + + + + + + +From the Library of Outcast Outcast +16 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Gateway Load Balancing Protocol (GLBP) An FHRP that can load-balance traffic destined for a next-hop gateway across a collection of routers, known as a GLBP group. Specifically, when a client sends an Address Resolution Protocol (ARP) request, in an attempt to determine the MAC address corresponding to a known IP address, GLBP can respond with the MAC address of one member of the GLBP group. The next such request would receive a response containing the MAC address of a different member of the GLBP group. +gateway of last resort The notation in a Cisco IOS IP routing table that identifies the route used by that router as the default route. + +ge (prefix list) Used to define that the mask of a network must be greater than or equal to the specified value for it to be a match to the prefix list. + +generic routing encapsulation (GRE) A tunneling protocol that can be used to encapsu-late many different protocol types, including IPv4, IPv6, IPsec, and others, to transport them across a network. +global unicast address A type of unicast IPv6 address that has been allocated from a range of public globally unique IP addresses as registered through ICANN, its member agen-cies, and other registries or ISPs. +going active EIGRP jargon meaning that EIGRP has placed a route into active status. + +GRE tunnel A tunnel created using GRE. See generic route encapsulation. + +GRE See generic routing encapsulation. + +GUI (graphical user interface) A method of interacting with the Cisco IOS using a graph-ical interface such as a web page. + +half-duplex This duplex mode only allows one device to transmit at a time, as multiple devices exist in the same collision domain. + +Hello interval With OSPF and EIGRP, an interface timer that dictates how often the router should send Hello messages. + +hello packet (EIGRP) An EIGRP message that identifies neighbors, exchanges parameters, and is sent periodically as a keepalive function. Hellos do not require an acknowledgment. + +Hello packet (OSPF) A type of OSPF packet used to discover neighbors, check for parameter agreement, and monitor the health of another router. + +hello time (BPDU) The time interval between configuration BPDUs sent by the root bridge; defaults to 2 seconds. + +Hold timer With EIGRP, the timer used to determine when a neighboring router has failed, based on a router not receiving any EIGRP messages, including Hellos, in this timer period. + +holddown A state into which a route is placed so that routers neither advertise the route nor accept advertisements about it for a specific length of time (the holddown period). The holddown state is used to flush bad information about a route from all routers in the net-work. A route typically is placed in holddown when a link in that route fails. + + + + + +From the Library of Outcast Outcast +Glossary 17 + +hop count The metric used by RIP, RIPv2, and RIPng to identify how far a destination net-work is. It is based on the number of routers that a packet must pass through from the local router to reach the destination. +host port A switchport mapped to a private VLAN such that a connected device can com-municate with only a promiscuous port or ports within the same community VLAN. + +Hot Standby Routing Protocol (HSRP) HSRP uses virtual IP and MAC addresses. One router, known as the active forwarder, services requests destined for the virtual IP and MAC addresses. Another router, known as the standby router, can service such requests in the event the active router becomes unavailable. +HSRP active forwarder The router in an HSRP group that forwards traffic sent to the vir-tual gateway IP and MAC address. + +HSRP standby router A router in an HSRP group that waits until the active router fails before taking over that role. + +HTTP (Hypertext Transfer Protocol) A protocol that can be used to transfer files (such as configuration files or the IOS) from a router or switch to an HTTP server using hypertext. + +IEEE 802.1X An IEEE standard that, when used with EAP, provides user authentication before their connected switchport allows the device to fully use the LAN. + +IEEE 802.3 The standard upon which all generations of Ethernet (Ethernet, Fast Ethernet, Gigabit Ethernet, 10 Gigabit Ethernet) are based. + +implicit deny all An invisible entry at the end of ACLs, prefix-lists, route-maps, and VACLs, that will automatically prevent all traffic or routes that do not match any entry before. +implicit permit Special invisible permanent statements in an IPv6 ACL that come before the implicit deny to allow ND traffic. They are permit icmp any any nd-na and permit icmp any any nd-na. +InARP See Inverse ARP. + +infinity In the context of IP routing protocols, a finite metric value defined by the routing protocol that is used to represent an unusable route in a routing protocol update. + +informs See SNMP inform. + +infrastructure ACL An ACL typically configured on routers at the edge of an enterprise network, which help prevent malicious traffic from entering the network. + +ingress port The port a frame is received on. + +inside global address A NAT term referring to the IP address used for a host inside the trusted part of the network, but in packets as they traverse the global (untrusted) part of the network. +inside local address A NAT term referring to the IP address used for a host inside the trusted part of the network, but in packets as they traverse the local (trusted) part of the net-work. + + + +From the Library of Outcast Outcast +18 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +interface ID Sixty-four bits at the end of an IPv6 global address, used to uniquely identify each host in a subnet. + +interface table All the router interfaces that have been configured to participate in a rout-ing process are listed in this table. + +interface tracking (HSRP) A feature that allows an HSRP router to monitor the status of a local interface and decrement its priority if the interface is down. + +Internal BGP (iBGP) Refers to how a router views a BGP peer relationship, in which the peer is in the same autonomous system. + +Interior Gateway Protocol (IGP) A routing protocol designed to be used to exchange routing information inside a single autonomous system. + +Internal BGP (iBGP) A characteristic of a BGP neighbor relationship, specifically when the two routers are internal to the same BGP ASN. + +internal routers An OSPF router that has interfaces connected to only one area, making the router completely internal to that one area. + +Internet Assigned Numbers Authority (IANA) An organization that directs the assign-ment of IPv4 and IPv6 addresses worldwide. + +Internet service provider (ISP) A company that provides Internet connectivity. + +Interrupt-driven task A network maintenance task that arises in response to a reported network issue. + +Inter-Switch Link (ISL) The Cisco proprietary VLAN trunking protocol that predated 802.1Q by many years. ISL encapsulates the original Ethernet frame with 30-bytes of addi-tional information and defines which VLAN the frame belongs to. +Inter-VLAN routing The function performed by a Layer 3 device that connects and for-wards packets between multiple VLANs. + +Inverse ARP Defined in RFC 1293, this protocol enables a Frame Relay-attached device to react to a received LMI “PVC up” message by announcing its Layer 3 addresses to the device on the other end of the PVC. +inverse neighbor discovery An IPv6 feature on non-broadcast multiaccess (NBMA) data links such as Frame Relay, providing the ability to learn a neighbor’s Layer 3 address when the underlying Layer 2 address is known. The IPv6 equivalent of Frame Relay Inverse ARP. +IP Background process When an interface changes its state, the IP Background process handles that state change. + +IP prefix list See prefix list. + +IP service level agreement (IP SLA) A feature within Cisco IOS that can be used to test how specific types of traffic are being handled end-to-end across a network. + +IP SLA responder A network device that responds to probes and participates in IP SLA tests. + + + + +From the Library of Outcast Outcast +Glossary 19 + +IP SLA source A network device using IP SLA which sends out a probe (synthetic traffic) to test the health of traffic. + +IP Source Guard A switch security feature that prevents IP address spoofing by using the DHCP snooping database to verify that packets are sourced from the correct IP address. + +IPsec tunnel A tunnel created using IPsec protocols. + +IPsec Refers to the IP Security protocols, which is an architecture for providing encryption and authentication services, typically when creating VPN services through an IP network. + +IPv4 Version 4 of the IP protocol, which is the generally deployed version worldwide (at publication) and uses 32-bit IP addresses. + +IPv6 ACL An ACL that is used to identify IPv6 traffic based on multiple criteria such as source and destination IP address, source and destination port numbers, protocols, and QoS parameters and either allow or prevent it. +IPv6 Version 6 of the IP protocol, which uses 128-bit IP addresses. + +isolated VLAN A type of secondary private VLAN; switchports associated with an isolated VLAN are effectively isolated from all other ports in the primary VLAN except the promis-cuous port. +IST instance Internal spanning-tree instance; used by MST to represent an entire region as a single virtual bridge to a common spanning tree. + +IT Infrastructure Library (ITIL) An ITIL defines a collection of best practice recommen-dations that work together to meet business goals. + +jitter The variation in packet delivery delay times. + +keepalive (BGP) A BGP message sent to maintain an active neighbor relationship and maintain the underlying TCP connection when a router has no other BGP messages to send. + +key chain A collection of one or more keys (that is, passwords) used for authentication, where each key has an associated key ID and key string. + +key ID (key chain) The numeric value that identifies the key used for authentication. + +key string (key chain) The alphanumeric string of characters that is being used for authen-tication. This is not to be confused with the name of the key chain. + +K value EIGRP allows for the use of bandwidth, load, delay, MTU, and link reliability; the K values refer to an integer constant that includes these five possible metric components. Only bandwidth and delay are used by default, to minimize recomputation of metrics for small changes in minor metric components. +LACP Link Aggregation Control Protocol; a standards-based method for negotiating EtherChannels automatically. + + +Layer 2 EtherChannel + +Layer 3 EtherChannel + + +See EtherChannel. + +See EtherChannel. + + + + + + +From the Library of Outcast Outcast +20 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Layer 3 switch A Layer 3 switch can act as a Layer 2 switch (that is, making forwarding decisions based on MAC addresses), or it can make forwarding decisions based on Layer 3 information (for example, IP address information). +le (prefix list) Used to define that the mask of a network must be less than or equal to the specified value for it to be a match to the prefix-list. + +learning One of four Spanning Tree Protocol (STP) states for a port. A port moves from the listening state to the learning state and remains in this state for 15 seconds by default. During this time, the port begins to add entries to its MAC address table. + +level 4 encryption + +level 5 encryption + +level 7 encryption encryption. + + +On Cisco IOS devices, passwords are hashed using SHA 256. + +On Cisco IOS devices, passwords are hashed using MD5. + +On Cisco IOS devices, passwords are encrypted using a weak Type 7 + + +line A configuration mode that can be used to manage a Cisco IOS device (for example, the console line or the vty lines). + +link-local address A type of unicast IPv6 address that represents an interface on a single data link. Packets sent to a link local address cross only that particular link and are never for-warded to other subnets by a router. Used for communications that do not need to leave the local link, such as neighbor discovery. +link-state acknowledgment A type of OSPF packet used to acknowledge LSU and DBD packets. + +link-state advertisement (LSA) The name of a class of OSPF data structures that hold topology information. LSAs are held in memory in the LSDB and communicated over the network in LSU messages. +link-state database (LSDB) In OSPF, the data structure in RAM of a router that holds the various LSAs, with the collective LSAs representing the entire topology of the network. + +link-state identifier (LSID) A 32-bit number used to uniquely identify an OSPF LSA. + +link-state request (LSR) An OSPF packet used to ask a neighboring router to send a par-ticular LSA. + +link-state update (LSU) The name of the OSPF packet that holds the detailed topology information, specifically LSAs. + +link state A classification of the underlying algorithm used in some routing protocols. + +listening One of the four STP states for a port. A port moves from the blocking state to the listening state and remains in this state for 15 seconds by default. During this time, the port sources bridge protocol data units (BPDU), which inform adjacent switches of the port intent to forward data. +LLDP Link Layer Discovery Protocol; a standards-based protocol used to advertise and dis-cover directly connected devices. + +LMI See Local Management Interface. + + + +From the Library of Outcast Outcast +Glossary 21 + +load A Cisco router interface statistic that measures the percentage link utilization, with the value represented as an integer between 0 to 255, and the percentage calculated as the listed number / 255. EIGRP can use load as input to the EIGRP metric calculation. +Loading An OSPF neighbor state that occurs after the completion of database descrip-tion messages, but while the database exchange using link-state request and link-state update packets continues. +local computation An EIGRP router’s reaction to an input event, leading to the use of a feasible successor or going active on a route. + +Local Management Interface (LMI) A Frame Relay protocol used between a DTE (rout-er) and DCE (Frame Relay switch). LMI acts as a keepalive mechanism. The absence of LMI messages means that the other device has failed. It also tells the DTE about the existence of each VC and DLCI, along with its status. +local preference See LOCAL_PREF. + +local VLAN A single VLAN that is bounded by a small area of the network, situated locally with a group of member devices. + +LOCAL_PREF A BGP path attribute that is communicated throughout a single AS to sig-nify which route of multiple possible routes is the best route to be taken when leaving that AS. A larger value is considered to be better. +login local A Cisco IOS command used on lines to define that authentication is required, using the local username and password database, to access the line for management purposes. + +login A Cisco IOS command used on lines to define that authentication is required, using a line password, to access the line for management purposes. + +Loop Guard An STP feature that disables a switchport if expected BPDUs suddenly go missing to prevent a loop. + +LSA flooding The process of successive neighboring routers exchanging LSAs such that all routers have an identical LSDB for each area to which they are attached. + +LSA See link-state advertisement. + +LSAck See Link-state acknowledgment. + +LSDB See link-state database. + +LSU See link-state update. + +MAC address table A table used by switches to efficiently forward frames out the ports needed to reach devices based on their MAC address. + +Management Information Base (MIB) A collection of information and data that a net-work device maintains about itself and its operation. MIB variables can be read or written through SNMP. +management plane The management plane of operation is used to manage a router or a switch. This management involves, for example, accessing and configuring a device. + + + + +From the Library of Outcast Outcast +22 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +manually configured tunnel A type of IPV6-over-IPv4 point-to-point tunnel in which the tunnel source and destination is preconfigured. + +match (route-map) A clause that is used to define the traffic or routes that will match the route map sequence. + +max age time The time interval that a switch stores a BPDU before discarding it or aging it out; the default is 20 seconds. + +maximum transmission unit (MTU) An IP variable that defines the largest size allowed in an IP packet, including the IP header. + +maximum paths The number of paths that can be used by a router to load balance traffic. + +Media Access Control (MAC) address A MAC address is a 48-bit address assigned to various types of network hardware (for example, network interface cards in PCs). A Layer 2 switch can learn which MAC addresses reside on specific switchports and make forwarding decisions based on that information. +MED See Multi Exit Discriminator. + +memory allocation failure A memory allocation failure (which produces a MALLOCFAIL error message) occurs when a process attempts to allocate a block of memory and fails to do so. +memory leak When a router starts a process, that process can allocate a block of memory. When the process completes, the process should return its allocated memory to the router’s pool of memory. If not all the allocated memory is returned to the router’s main memory pool, a memory leak occurs. +merge A situation that occurs when copying any configurations to the running configura-tion. The merge causes the configurations to be combined together, which could result in undesired configurations. +message digest 5 (MD5) Authentication With IP routing protocols, a method of apply-ing a mathematical formula, with input including a private key, the message contents, and sometimes a shared text string, with the resulting digest being included with the message. The sender and the receiver perform the same math to allow authentication and to prove that no intermediate device changed the message contents. +method list (AAA authentication) A listing of methods, such as a RADIUS server, types of authentication, the local database, and the line passwords, that can be used to successfully authenticate. Typically listed in the sequence in which they will be performed. +metric With routing protocols, the measurement of favorability that determines which entry will be installed in a routing table if more than one router is advertising that exact net-work and mask with one routing protocol. +MIB See Management Information Base. + +MLS See multilayer switching. + +MST instance (MSTI) A single instance of STP running within an MST region; multiple VLANs can be mapped to the MST instance. + + + +From the Library of Outcast Outcast +Glossary 23 + +MST region A group of switches running compatible MST configurations. + +MST Multiple Spanning Tree Protocol, used to map one or more VLANs to a single STP instance, reducing the total number of STP instances. + +MTU Maximum transmission unit. The maximum packet size, in bytes, that a particular interface can handle. + +Multi Exit Discriminator (MED) See MULTI_EXIT_DISC. + +MULTI_EXIT_DISC (MED) A BGP path attribute that allows routers in one autonomous system to set a value and advertise it into a neighboring AS, impacting the decision process in that neighboring autonomous system. A smaller value is considered better. Also called the BGP metric. +multicast IP address range For IPv4, the multicast address range is from 224.0.0.0 through 239.255.255.255. For IPv6, multicast addresses have a prefix of ff00::/8. + +multicast IP address structure For IPv4, the first 4 bits of the first octet must be 1110. The last 28 bits are unstructured. For IPv6, multicast addresses have a prefix of ff00::/8. + +multicast MAC address A type of Ethernet MAC address meant to be used to send frames to a subset of the devices on a single broadcast domain. More specifically, as used with IPv4 multicast packets, a 48-bit address that is calculated from a Layer 3 multicast address by using 0x0100.5E as the multicast vendor code (OUI) for the first 24 bits, always binary 0 for the 25th bit, and copying the last 23 bits of the Layer 3 multicast address. +multilayer switch (Layer 3 switch) A process whereby a switch, when making a forward-ing decision, uses not only Layer 2 logic but other OSI layer equivalents as well (such as Layer 3). +multipoint GRE A virtual private network (VPN) technology that allows multiple GRE tun-nels to terminate on a single GRE tunnel interface. + +multipoint redistribution When redistribution occurs at multiple points between two dif-ferent routing protocols. + +multipoint subinterface A configuration construct in Cisco routers, typically with Frame Relay, in which one logical subinterface can be used to forward traffic to more than one remote router. +multipoint tunnel A type of tunnel in which more than one destination may be reached over a single tunnel. + +Multiprotocol BGP (MP-BGP) An updated version of BGPv4 that includes components supporting the routing of both IPv4 and IPv6 networks. + +NA See Neighbor Advertisement. + +named ACL An access list that identifies the various statements/entries in the ACL based on a name, rather than a number. + +Named EIGRP An EIGRP configuration approach that allows you to configure all EIGRP commands under a single hierarchical configuration. + + + +From the Library of Outcast Outcast +24 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +NAT overload See Port Address Translation (PAT). + +NAT Virtual Interface (NVI) A feature that allows a router interface to act as either a NAT inside or a NAT outside interface. + +NAT See Network Address Translation. + +native VLAN The one VLAN on an 802.1Q trunk for which the endpoints do not add the 4-Byte 802.1Q tag when transmitting frames in that VLAN. + +NBMA See non-broadcast multi-access (NBMA). + +NCP See Network Control Protocol. + +ND See Neighbor Discovery. + +neighbor (EIGRP) With EIGRP, a router sharing the same primary subnet, with which Hellos are exchanged, parameters match, and with which routes can be exchanged. + +neighbor (OSPF) Any other router, sharing a common data link, with which a router exchanges Hellos, and for which the parameters in the Hello pass the parameter-check pro-cess. +Neighbor Advertisement (NA) In IPv6, the Neighbor Discovery message used by an IPv6 node to send information about itself to its neighbors. + +Neighbor Discovery (ND) The protocol used in IPv6 for many functions, including address autoconfiguration; duplicate address detection; router, neighbor, and prefix discov-ery; neighbor address resolution; and parameter discovery. +Neighbor Discovery Protocol (NDP) A longer name for IPv6 Neighbor Discovery. See Neighbor Discovery. + +Neighbor Solicitation (NS) In IPv6, the Neighbor Discovery message used by an IPv6 node to request information about a neighbor or neighbors. + + +neighbor state neighbor. + +neighbor table + + +A state variable kept by a router for each known neighbor or potential + + +For OSPF and EIGRP, a listing of routers that have reached neighbor status + +with the local router. + +neighbor In routing protocols, another router with which a router decides to exchange routing information. + +neighborship A shortened version of the phrase neighbor relationship. + +net background process An interface has a certain number of buffers available to store packets. These buffers are sometimes referred to as an interface’s queue. If an interface needs to store a packet in a buffer but all the interface’s buffers are in use, the interface can pull from a main pool of buffers that its router maintains. The process that allows an interface to allocate one of these globally available buffers is the net background process. +NetFlow The NetFlow feature collects detailed information about traffic flows on routers and high-end switches. Collected information can optionally be sent to a NetFlow collector, which can produce reports about the traffic flows. + + +From the Library of Outcast Outcast +Glossary 25 + +Network Address Translation (NAT) A mechanism for reducing the need for glob-ally unique IPv4 addresses. NAT allows an organization with addresses that are not glob-ally unique to connect to the Internet by translating those addresses into globally routable address space. +network command Used to enable the RIPv2, EIGRP for IPv4, and OSPFv2 routing pro-cess on an interface. + +network layer reachability information A BGP term referring to an IP prefix and prefix length. + +Network LSA An OSPFv2 Type 2 LSA. See Type 2 LSA. + +Network Time Protocol (NTP) A protocol used to synchronize time among network devices. + +network type (OSPF) A characteristic of OSPF interfaces that determines whether a DR election is attempted, whether neighbors must be statically configured, and the default hello and dead timer settings. +Next Hop field With a routing update, or routing table entry, the portion of a route that defines the next router to which a packet should be sent to reach the destination subnet. With routing protocols, the Next Hop field may define a router other than the router send-ing the routing update. +Next Hop Resolution Protocol (NHRP) A virtual private network (VPN) technology that allows a spoke, in a hub-and-spoke topology, to query the hub for the IP address of a physi-cal interface on a different spoke that corresponds to the IP address of the far end of a tun-nel. +NEXT_HOP A BGP path attribute that lists the next-hop IP address used to reach an NLRI. + +Next-hop self A BGP configuration setting that tells the local router to change the NEXT_ HOP path attribute to refer to its own BGP update source when advertising routes to BGP neighbors. +NLRI See network layer reachability information. + +NMS See SNMP manager. + +noAuthNoPriv An SNMP security model used with all versions of SNMP that only pro-vides authentication for SNMPv1 and SNMPv2c using community strings and for SNMPv3 using a username. +nonbackbone area Any OSPF area that is not the backbone area. + +nonbroadcast multiaccess (NBMA) A characterization of a type of Layer 2 network in which more than two devices connect to the network, but the network does not allow broad-cast frames to be sent to all devices on the network. +nondesignated port Nondesignated ports in a spanning tree block traffic to create a loop-free topology. + +Non-Stop Forwarding (NSF) A redundancy method that quickly rebuilds routing infor-mation after a redundant Catalyst switch supervisor takes over. + + +From the Library of Outcast Outcast +26 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +notification (BGP) A BGP message used to inform BGP neighbors of a protocol error. + +not-so-stubby area A type of OSPF stub area, which acts like other stub areas in that ABRs inject default routes into the area, but unlike non-NSSA stub areas in that external routes can be injected into the area. +NS See Neighbor Solicitation. + +NSSA See not-so-stubby area. + +NTP See Network Time Protocol. + +NTP client A device requesting NTP (Network Time Protocol) services from an NTP server so that its clock information can be synchronized. + +NTP server A device providing NTP services. + +object identifier (OID) A unique string of digits that identifies a variable or a tree of vari-ables in a MIB. + +object tracking An IOS feature in which IOS repeatedly checks the current state of some item so that other items can then act to a change in that state. For example, object tracking can track the state of IP SLA operations, with static routes and policy routes reacting to a change in the object-tracking feature. +offset list A Cisco IOS configuration tool for RIP and EIGRP for which the list matches routes in routing updates and adds a defined value to the sent or received metric for the routes. The value added to the metric is the offset. +one-way redistribution The process of route redistribution in which one routing protocol redistributes routes into a second routing protocol, but the reverse redistribution is not con-figured. +Open Shortest Path First (OSPF) A popular link-state IGP that uses a link-state database and the shortest path first (SPF) algorithm to calculate the best routes to reach each known subnet. +Open A BGP message type used when the underlying TCP connection completes, for the purpose of exchanging parameter information to determine whether the two routers are will-ing to become BGP neighbors. +ORIGIN A BGP path attribute that implies how the route was originally injected into some router’s BGP table. + +OSPF area A group of routers and links, identified by a 32-bit area number, whose detailed topology information OSPF shares among all routers in the group. Routers inside an area learn full detailed topology information about the area; this detailed information is not advertised outside the area. +OSPF network type A characteristic of OSPF interfaces that determines whether a DR election is attempted, whether neighbors must be statically configured, and the default hello and dead timer settings. +OSPF Version 3 An interior routing protocol created for IPv6 but based on OSPF Version 2, which was designed for IPv4. + + +From the Library of Outcast Outcast +Glossary 27 + +OSPF See Open Shortest Path First. + +OSPF area border router (ABR) See Area Border Router. + +OSPF Autonomous System Boundary Router (ASBR) See ASBR (Autonomous System Border Router). + + +OSPF interface table + +OSPF neighbor table + + +See interface table. + +See neighbor table. + + +OSPF link-state database See link-state database. + +OSPFv3 An enhancement to OSPFv2 that supports the routing of IPv6 networks. + +OSPFv3 address family A newer configuration approach for OSPFv3 that supports the routing of both IPv4 and IPv6 networks with a single OSPFv3 process (as opposed to having one OSPFv2 process for the routing of IPv4 networks and one OSPFv3 process for the rout-ing of IPv6 networks). +outside global address A NAT term describing an IP address representing a host that resides outside the enterprise network, with the address being used in packets outside the enterprise network. +outside local address A NAT term describing an IP address representing a host that resides outside the enterprise network, with the address being used in packets inside the enterprise network. +overlapping subnets An (incorrect) IP subnet design condition in which one subnet’s range of addresses includes addresses in the range of another subnet. + +overloading Another term for Port Address Translation. See PAT. + +packet forwarding The process a router uses to take a packet that arrives on an interface (ingress) and forward it out the appropriate interface. + +packet forwarding The process of forwarding packets through a router. Also called IP routing. + +PAgP Port Aggregation Protocol; a Cisco-developed method for negotiating EtherChannels automatically. + +partial mesh A network topology in which more than two devices could physically com-municate, but by choice, only a subset of the pairs of devices connected to the network are allowed to communicate directly. +passive (EIGRP) A state for a route in an EIGRP topology table that indicates that the router believes that the route is stable and that it is not currently looking for any new routes to that subnet. +passive interface A routing protocol setting on an interface for which the router does not send Updates on the interface (RIP) or the router does not attempt to dynamically discover neighbors (EIGRP and OSPF), which indirectly prevents the EIGRP or OSPF router from sending updates on the interface. + + + + +From the Library of Outcast Outcast +28 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +PAT See Port Address Translation. + +path attribute Generally describes characteristics about BGP paths advertised in BGP updates. + +path control A general term, with several shades of meanings, that refers to any function that impacts how routers forward packets. These functions include routing protocols and any other feature that impacts the IP routing table, plus any feature that impacts the packet-forwarding process. +path vector A category of routing protocol that includes information about the exact path packets take to reach a specific destination network. BGP is a common example of a path-vector routing protocol. +PBR See policy-based routing. + +peer group See BGP peer group. + +periodic update With routing protocols, the concept that the routing protocol advertises routes in a routing update on a regular periodic basis. This is typical of distance-vector rout-ing protocols. +permanent virtual circuit (PVC) A preconfigured communications path between two Frame Relay DTEs, identified by a local DLCI on each Frame Relay access link, that provides the functional equivalent of a leased circuit but without a physical leased line for each VC. +permit An action taken with an ACL that implies that the matching packets will be allowed. + +ping A tool that can be used to test IPv4/IPv6 connectivity between two devices. + +point-to-point tunnel A logical path between two devices created by encapsulating pack-ets of one protocol (the passenger protocol) inside packets of another protocol (the transport protocol) specifically in cases where only two routers exist in the tunnel. +poison reverse With RIP, the advertisement of a poisoned route out an interface when that route was formerly not advertised out that interface due to split horizon rules. + +poisoned route A route in a routing protocol’s advertisement that lists a subnet with a spe-cial metric value, called an infinite metric, that designates the route as a failed route. + +policy-based routing Cisco IOS router feature by which a route map determines how to forward a packet, typically based on information in the packet other than the destination IP address. +port (multiple definitions) 1) In TCP and UDP, a number used to uniquely identify the application process that either sent (source port) or should receive (destination port) data. 2) In LAN switching, another term for switch interface. +port 22 Well-known port number used by SSH. + +port 23 Well-known port number used by Telnet. + +Port Address Translation (PAT) A NAT term describing the process of multiplexing TCP and UDP flows, based on port numbers, to a small number of public IP addresses. Also called NAT overloading. + + + +From the Library of Outcast Outcast +Glossary 29 + +port security A feature that is used to control the specific MAC addresses learned on an interface or the number of MAC addresses learned on an interface. + +PortFast An STP feature used primarily on an access port that bypasses the Listening and Learning states so that the host can gain quick access to the network. + +PPDIOO Prepare, plan, design, implement, operate, optimize. The six phases of the Cisco Lifecycle Services approach. + +preempt (HSRP/VRRP/GLBP) A feature that allows a router participating in a first-hop redundancy protocol group to take over as the active forwarder or the AVG if it has a higher priority. +prefix list A Cisco IOS configuration tool that you can use to match routing updates based on a base network address, a prefix, and a range of possible masks used inside the values defined by the base network address and prefix. +primary VLAN The main VLAN associated with a PVLAN (private VLAN) that will be divided up into secondary VLANs to control the follow of traffic between the ports in the VLAN. +priority (GLBP) A numeric value from 1 to 255 that is used to control who the AVG will be. Higher is better. + +priority (HSRP/VRRP) A numeric value from 1 to 255 that is used to control who the active forwarder will be. Higher is better. + +priority (OSPF) An administrative setting included in hellos that is the first criteria for electing a DR. The highest priority wins, with values from 1 to 255, with priority 0 meaning a router cannot become DR or BDR. +private addresses RFC 1918-defined IPv4 network numbers that are not assigned as pub-lic IP address ranges and are not routable on the Internet. Intended for use inside enterprise networks. +private autonomous system A BGP ASN whose value is between 64,512 and 65,535. These values are not assigned for use on the Internet and can be used for private purposes, typically either within confederations or by ISPs to hide the ASN used by some customers. +private ASN An autonomous system number (ASN) that falls inside the private autono-mous system range. + +private IP address See private addresses. + +private VLAN A special-purpose VLAN, designated as either primary or secondary, that can restrict or isolate traffic flows between devices in the same VLAN. + +process switching A method of switching packets from an ingress interface to an egress interface on a router or multilayer switch that requires the CPU to evaluate every packet. This is the least-efficient switching method. +promiscuous port A switchport mapped to a private VLAN that is used by ports in com-munity or isolated VLANs to access resources outside the private VLAN. + + + + +From the Library of Outcast Outcast +30 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +protect violation mode A port security violation mode that will prevent access to the devices that caused the violation based on the number of MAC addresses being exceeded. + +protected ports A global switch security feature that will prevent edge ports that are con-figured as protected ports from communicating with each other unless they are forwarded through a Layer 3 device. +protocol type A field in the IP header that identifies the type of header that follows the IP header, typically a Layer 4 header, such as TCP or UDP. ACLs can examine the protocol type to match packets with a particular value in this header field. +proxy ARP A router feature used when a router sees an ARP request searching for an IP host’s MAC, when the router believes the IP host could not be on that LAN because the host is in another subnet. If the router has a route to reach the subnet where the ARP-determined host resides, the router replies to the ARP request with the router’s MAC address. +public address space (IPv4) The nonreserved portions of the IPv4 unicast address space. + +public ASN An ASN that fits below the private ASN range, specifically from 1 through 54,511. + +public IP address See public address space. + +PVC See permanent virtual circuit. + +PVST+ Per-VLAN Spanning Tree; a Cisco proprietary version of STP where one instance of STP runs for each VLAN present in a Layer 2 switch. + +query (EIGRP) An EIGRP message that asks neighboring routers to verify their route to a particular subnet. Query messages require an acknowledgment. + +query scope (EIGRP) The characterization of how far EIGRP query messages flow away from the router that first notices a failed route and goes active for a particular subnet. + +RA See router advertisement. + +RADIUS A standards-based protocol used to communicate with AAA servers. + +RD See reported distance. + +redistribution The process on a router of taking the routes from the IP routing table, as learned by one routing protocol, and injecting routes for those same subnets into another routing protocol. +reference bandwidth In OSPF, the numerator in the calculation of interface cost. The for-mula is reference bandwidth / interface bandwidth. + +Regional Internet Registry (RIR) The generic term for one of five current organizations responsible for assigning the public, globally unique IPv4 and IPv6 address space. + +registry prefix In IPv6, the prefix that describes a block of public, globally unique IPv6 addresses assigned to a Regional Internet Registry by IANA. + +regular expression A list of interspersed alphanumeric literals and metacharacters used to apply complex matching logic to alphanumeric strings. Often used for matching AS_PATHs in Cisco routers. + + +From the Library of Outcast Outcast +Glossary 31 + +reliability A Cisco router interface statistic that measures the percentage of packet loss, with the value represented as an integer between 0 to 255, and the percentage calculated as the listed number / 255. EIGRP can use reliability as input to the EIGRP metric calculation. +Reliable Transport Protocol A protocol used for reliable multicast and unicast transmis-sions. Used by EIGRP. + +Reply (EIGRP) An EIGRP message that is used by neighbors to reply to a query. Reply messages require an acknowledgment. + +REPLY message The DHCPv6 server finalizes the DHCPv6 addressing process with this message. + +reported distance From one EIGRP router’s perspective, the metric for a destination network as calculated on a neighboring router and reported in a routing update to the first router. +REQUEST message A DHCPv6 client sends this message to the DHCPv6 server confirm-ing the addresses provided and any other parameters. + +restrict violation mode A port security violation mode that will prevent access to the devices that caused the violation based on exceeding the number of MAC addresses allowed and send log messages about the violation. +RIB failure An event that occurs when the Routing Table Manager (RTM) attempts to add a route to the IP routing table, but a problem exists with the route that prevents RTM from adding the route. +RID See router ID. + +RIP (Routing Information Protocol) An Interior Gateway Protocol (IGP) that uses dis-tance vector logic and router hop count as the metric. RIP Version 1 (RIPv1) has become unpopular. +RIP next generation (RIPng) An IPv6 Interior Routing Protocol based on RIP (for IPv4). + +RIP Version 2 (RIPv2) Provides more features than RIP, including support for VLSM. + +rollover cable (console cable) The cable needed to successfully manage a Cisco IOS device from the console port. + +root bridge The single STP device within a broadcast domain/VLAN that is elected as a common frame of reference for working out a loop-free Layer 2 topology. + +Root Guard An STP feature that controls where candidate root bridges can be found on a switch. + +root path cost The cumulative cost of all the links leading to the root bridge. + +root port Each switch selects one port that has the lowest root path cost leading toward the root bridge. + +route map A configuration tool in Cisco IOS that enables basic programming logic to be applied to a set of items. Often used for decisions about what routes to redistribute and for setting particular characteristics of those routes (for instance, metric values). + + + +From the Library of Outcast Outcast +32 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +route poisoning The process of sending an infinite-metric route in routing updates when that route fails. + +route redistribution The process of taking routes known through one routing protocol and advertising those routes with another routing protocol. + +route summarization A consolidation of advertised addresses that causes a single sum-mary. + +route tag A field within a route entry in a routing update used to associate a generic num-ber with the route. It is used when passing routes between routing protocols, allowing an intermediate routing protocol to pass information about a route that is not natively defined to that intermediate routing protocol. Often used for identifying certain routes for filtering by a downstream routing process. +route to be advertised Route was formerly not advertised out that interface due to split-horizon rules. + +routed port A Layer 3 port on a multilayer switch that behaves similar to an interface on a router and is not associated with a particular VLAN. + +routed protocol A Layer 3 protocol that defines a packet that can be routed, such as IPv4 and IPv6. + +router advertisement (RA) In IPv6, a router advertisement message used by an IPv6 rout-er to send information about itself to nodes and other routers connected to that router. + +router ID (RID) In OSPF, a 32-bit number, written in dotted decimal, that uniquely identi-fies each router. + +Router LSA Another name for an OSPF Type 1 LSA. See Type 1 LSA. + +router solicitation (RS) An IPv6 message, part of the Neighbor Discovery Protocol (NDP), used by a host to request that the routers on the same data link announce their presence, IPv6 addresses, and all prefix/length combinations using a router advertisement (RA) mes-sage. +router-on-a-trunk/router-on-a-stick A router with subinterfaces that is used to route traffic between multiple VLANs. + +Routing Information Base (RIB) A term referring to the IP routing table. + +routing loop When traffic is routed back in the direction that it came from or in a circular pattern through the network never reaching the intended destination. + +routing protocol A set of messages and processes with which routers can exchange infor-mation about routes to reach subnets in a particular network. Examples of routing protocols include Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), and Routing Information Protocol (RIP), routing protocols to analyze the LSDB and find the least-cost routes from that router to each subnet. +routing table The table a router uses to determine the most appropriate way to forward a packet. + + + + +From the Library of Outcast Outcast +Glossary 33 + +RPVST+ Also known as Rapid PVST+, where RSTP is used on a per-VLAN basis; in effect, RSTP replaces traditional 802.1D STP in the PVST+ operation. + +RSPAN Also known as Remote Switched Port Analyzer, where a SPAN session is split across two independent switches and mirrored data is transported over a special purpose VLAN between them. +RSTP The Rapid Spanning Tree Protocol, based on the IEEE 802.1w standard. + +running configuration Contains the current configuration that is running in RAM on the router or switch. + +running config See running configuration. + +SDM Switching Database Manager; a Cisco IOS Software function that configures or tunes memory table space on a LAN switch platform. + +secondary VLAN A VLAN used with PVLANs that can pass traffic to and from its associ-ated primary VLAN, but not with any other secondary VLAN associated with the same pri-mary VLAN. +Secure Hash Algorithm (SHA) An authentication algorithm, considered to be more secure than MD5, which can provide neighbor authentication for Named EIGRP and OSPFv3. +Secure Sockets Layer (SSL) A security protocol integrated into commonly used web browsers that provides encryption and authentication services between the browser and a website. +seed metric When redistributing routes, the metric set for routes injected into another routing protocol. + +segment (multiple definitions) 1) In TCP, a term used to describe a TCP header and its encapsulated data (also called an L4PDU). 2) Also in TCP, the set of bytes formed when TCP breaks a large chunk of data given to it by the application layer into smaller pieces that fit into TCP segments. 3) In Ethernet, either a single Ethernet cable or a single collision domain (no matter how many cables are used). +sequence number (OSPF) In OSPF, a number assigned to each LSA, ranging from 0x80000001 and wrapping back around to 0x7FFFFFFF, which determines which LSA is most recent. +set (route-map) A clause that defines the action that will be taken to the traffic or routes that match the match clause in the route map. + +shoot from the hip The shoot from the hip troubleshooting method occurs when a troubleshooter bypasses examined information and eliminates potential causes, based on the troubleshooter’s experience and insight. +shortest path first (SPF) The name of the algorithm OSPF uses to analyze the LSDB. The analysis determines the best (lowest cost) route for each prefix/length. Also known as Dijkstra’s SPF algorithm. +shutdown violation mode A port security violation mode that will prevent access to all devices connected to the port by placing the port in the err-disabled state. + + +From the Library of Outcast Outcast +34 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +SIA query An EIGRP hello specially used halfway through a router’s active timer for a route in which a router queries the downstream neighbor to discover if that neighbor is still working. +Simple Network Management Protocol (SNMP) A network management protocol that can allow a network management system (NMS) to query a managed device (that is, an SNMP client) for information found in the device’s Management Information Base (MIB), and can also allow a managed device to proactively send notifications (called traps) to an NMS in response to specific events. +single-point redistribution When redistribution occurs at a single point between two dif-ferent routing protocols. + +site prefix In IPv6, the prefix that describes a public globally unique IPv6 address block that has been assigned to an end-user organization (for example, an enterprise or government agency). An ISP or Internet registry typically makes the assignment. +site-to-site VPN A site-to-site VPN typically terminates in a router at a headquarters and a router at the remote site. Such an arrangement does not require clients at the remote site to have VPN client software installed. +SLA (service level agreement) operation A configuration construct used by the IP SLA feature inside router Cisco IOS that defines a type of packet to be sent, plus a set of mea-surements to be made about the packet. (Did a reply occur? What delay occurred, jitter, and so on?) +smoothed round-trip time With EIGRP, a purposefully slowly changing measurement of round-trip time between neighbors from which the EIGRP RTO is calculated. + +sniffer A device on the network that is designed to capture packets that are sent to it or passed through it so that they can be analyzed. Wireshark is an example of a packet sniffer. + +SNMP See Simple Network Management Protocol (SNMP). + +SNMP agent A process that runs on the network device being monitored and uses SNMP to provide data to an SNMP manager. + +SNMP inform A message that a network device sends to alert an SNMP manager about an event or a failure. The SNMP manager must acknowledge receipt of the inform by echoing the message back to the SNMP agent in the device. +SNMP manager A network management system that uses SNMP to poll network devices for operational and configuration data. + +SNMP trap A message that a network device sends to alert an SNMP manager about an event or a failure. The SNMP manager does not need to acknowledge a trap that it receives. + +SNMP view A grouping of objects within the MIB that defines which objects a user will be able to access. + +SNMPv2c A version of SNMP that uses community strings. + +SNMPv3 A version of SNMP that can use hashing algorithms and encryption algorithms to enhance SNMP security. + + + +From the Library of Outcast Outcast +Glossary 35 + +socket A three-tuple consisting of an IP address, port number, and transport layer proto-col. TCP connections exist between a pair of sockets. + +soft reconfiguration A BGP process by which a router reapplies routing policy configu-ration (route maps, filters, and the like) based on stored copies of sent and received BGP updates. +SOLICIT message A DHCPv6 client sends this message to locate DHCPv6 servers using the multicast address FF02::1:2 which is the all DHCPv6 servers multicast address. + +solicited node multicast address In IPv6, an address used in the Neighbor Discovery (ND) process. The format for these addresses is FF02::1:FF00:0000/104, and each IPv6 host must join the corresponding group for each of its unicast and anycast addresses. +source MAC address (source MAC) The MAC address of the sender of a frame. + +SPAN Also known as Switched Port Analyzer, where a switch mirrors traffic from a source interface or VLAN onto a different interface for monitoring or analysis purposes. + +Spanning Tree Protocol (STP) A protocol communicated between Layer 2 switches that attempts to detect a loop in the topology before it forms, thus preventing a bridging loop from occurring. +SPF calculation The process of running the SPF algorithm against the OSPF LSDB, with the result being the determination of the current best route(s) to each subnet. + +split-horizon (iBGP) A loop prevention mechanism that prevents iBGP routers from adver-tising BGP learned routes to other iBGP neighbors. + +split horizon (RIP and EIGRP) A loop prevention mechanism that prevents routers from advertising routes out the interfaces they were originally learned on. + +SSH (Secure Shell) A secure protocol that can be used to remotely manage a Cisco IOS device. + +SSL See Secure Sockets Layer. + +standard ACL A list of IOS global configuration commands that can match only a packet’s source IP address for the purpose of deciding which packets to discard and which to allow. + +standby router See HSRP standby router. + +stateful DHCPv6 A term used in IPv6 to contrast with stateless DHCP. Stateful DHCP keeps track of which clients have been assigned which IPv6 addresses (state information). + +stateless address autoconfiguration (SLAAC) A method used by an IPv6 host to deter-mine its own IP address, without DHCPv6, by using Neighbor Discovery Protocol (NDP) and the modified EUI-64 address format. See also stateful autoconfiguration. +stateless DHCPv6 A term used in IPv6 to contrast with stateful DHCP. Stateless DHCP servers don’t lease IPv6 addresses to clients. Instead, they supply other useful information, such as DNS server IP addresses, but with no need to track information about the clients (state information). +static default route A default route configured in IOS using the ip route command. + + + +From the Library of Outcast Outcast +36 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +Static NAT (SNAT) A version of Network Address Translation (NAT) where there is a static assignment of an inside global address to an inside local address. + +static route A route manually configured by an administrator using the ip route or ipv6 route command. + +sticky secure MAC address MAC addresses dynamically learned by the port security feature and entered into the running configuration like a static entry would be. + +stratum A number that indicates in which layer in the NTP hierarchy a time source is locat-ed; stratum 1 represents the most authoritative and accurate time source. + +structured maintenance task A structured maintenance task is a network maintenance task that is performed as part of a predefined plan. + +stub See EIGRP stub router. + +stub area An OSPF area into which external (Type 5) LSAs are not introduced by its ABRs; instead, the ABRs originate and inject default routes into the area. + +stub network (OSPF) A network/subnet to which only one OSPF router is connected. + +stub router (EIGRP) A router that should not be used to forward packets between other routers. Other routers will not send Query messages to a stub router. + +stub router (OSPF) A router that should either permanently or temporarily not be used as a transit router. Can wait a certain time after OSPF process starts, or after BGP notifies OSPF that BGP has converged, before ceasing to be a stub router. +stubby area The same as stub area. See stub area. + +stuck in active The condition in which a route has been in an EIGRP active state for lon-ger than the router’s active timer. + +subinterface One of the virtual interfaces on a single physical interface. + +subnet broadcast address A single address in each subnet for which packets sent to this address will be broadcast to all hosts in the subnet. It is the highest numeric value in the range of IP addresses implied by a subnet number and prefix/mask. +subnet prefix In IPv6, a term for the prefix that is assigned to each data link, acting like a subnet in IPv4. + +subnet A subdivision of a Class A, B, or C network, as configured by a network administra-tor. Subnets allow a single Class A, B, or C network to be used and still allow for a large num-ber of groups of IP addresses, as is required for efficient IP routing. +subnets keyword (OSPF) Used when redistributing into OSPF so that classful and class-less networks are redistributed. + +successor route With EIGRP, the route to each destination for which the metric is the lowest of all known routes to that network. + +successor In EIGRP, the route to reach a subnet that has the best metric and should be placed in the IP routing table. + + + +From the Library of Outcast Outcast +Glossary 37 + +Summary LSA In OSPF, a Type 3 LSA. See Type 3 LSA. + +summary route A route that is created to represent one or more smaller component routes, typically to reduce the size of routing and topology tables. + +superior BPDU A received BPDU that contains a better bridge ID than the current root bridge. + +SVI Switched virtual interface; a logical interface used to assign a Layer 3 address to an entire VLAN. + +syslog severity level An indicator of how important or severe a logged event is. + +syslog System message logs that are generated by a switch and can be collected locally or sent to and collected on a remote server. + +TACACS+ A Cisco proprietary protocol used to communicate with AAA servers. + +TCAM Ternary content-addressable memory; a switching table found in Catalyst switches that is used to evaluate packet forwarding decisions based on policies or access lists. TCAM evaluation is performed simultaneously with the Layer 2 or Layer 3 forwarding decisions. +TCN Topology Change Notification; a message sent out the root port of a switch when it detects a port moving into the forwarding state or back into the blocking state. The TCN is sent toward the root bridge to inform it of the topology change, where it is reflected and propagated to every other switch in the Layer 2 network. +TCP Timer process The TCP Timer process runs for each of the TCP connections for a router. Therefore, a router with many simultaneous TCP connections could have a high CPU utilization due to the resources being consumed by the TCP Timer. +Telnet An unsecure protocol that sends data in clear-text which can be used to remotely manage a Cisco IOS device. + +TFTP (Trivial File Transfer Protocol) A protocol that can be used to copy files (such as configuration files or the IOS) from a router or switch to a TFTP server. + +time-based ACL An access control list that can permit or deny defined traffic based on time of day and day of week. + +time-to-live (TTL) (BGP) Identifies the lifetime of a BGP message in router hops. For eBGP peers, it is set to 1 by default, and for iBGP peers it is set to 255 by default. + +time-to-live (TTL) A field in the IP header that is decremented at each pass through a Layer 3 forwarding device. + +top-down method A method of troubleshooting where troubleshooting starts at the top (that is, Layer 7) of the OSI model and works its way down. + +topology database The structured data that describes the network topology to a routing protocol. Link-state and advanced distance-vector protocols use topology tables, from which they build the entries in the routing table. +totally NSSA area A type of OSPF NSSA area for which neither External (Type 5) LSAs are introduced, nor Type 3 Summary LSAs; instead, the ABRs originate and inject default routes into the area. External routes can be injected into a totally NSSA area. + + +From the Library of Outcast Outcast +38 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +totally stubby area A type of OSPF stub area for which neither External (Type 5) LSAs are introduced, nor Type 3 Summary LSAs; instead, the ABRs originate and inject default routes into the area. External routes cannot be injected into a totally stubby area. +traceroute A tool that can be used on Cisco IOS devices to identify the path a packet is taking through the network. + +tracking object A concept in IOS that analyzes different conditions on a router that results in the object’s state either being up or down. IOS can then use different features, or not use different features, based on the current state of the tracking object. (In this book, tracking objects watch IP SLA operations and influence static routes and policy-based rout-ing.) +transit area The area over which an OSPF virtual link’s messages flow. + +transit autonomous system With BGP, an autonomous system that receives packets from one neighboring autonomous system and forwards the packet to yet another autonomous system. An enterprise typically does not want to be a transit AS. +traps See SNMP trap. + +triggered updates A routing protocol feature for which the routing protocol sends rout-ing updates immediately upon hearing about a changed route, even though it may normally only send updates on a regular update interval. +trunk (VLAN) A physical link that can carry traffic for multiple VLANs. + +TTL See time-to-live. + +tunnel interface In Cisco IOS, a software (virtual) interface used as a configuration con-struct to configure a tunnel. + +tunnel A method of taking one packet and encapsulating another packet so that the origi-nal encapsulated packet can be delivered across another network–in some cases across net-works through which the original packet could not have been forwarded. The tunnel might simply provide for packet delivery, and it might add other services such as encryption and authentication. +tunneling The process of using a tunnel. See tunnel. + +two-way redistribution With route redistribution, the process of redistributing routes from one routing protocol into a second routing protocol and vice versa. + +two-way state In OSPF, a neighbor state that implies that the router has exchanged hellos with the neighbor, and all required parameters match. + +Type 1 LSA An OSPF LSA type that describes a router. It lists the router’s OSPF ID, its interfaces, their states, and the link-state IDs of neighboring LSAs. Also called a router LSA. + +Type 2 LSA An OSPF LSA type that describes a multiaccess network on which a DR has been elected and for which at least one other router connects. The LSA represents the sub-net. Also called a network LSA. +Type 3 LSA An OSPF LSA type that describes a subnet in another area. Also called a Summary LSA. + + +From the Library of Outcast Outcast +Glossary 39 + +Type 3 LSA Filtering The process of causing an ABR to not create and flood a Type 3 LSA into another area. + +Type 4 Summary ASBR LSA An LSA type used to describe an ASBR and the cost to reach that ASBR for the purpose of allowing routers to determine the OSPF cost to reach an external subnet advertised as a Type 5 or Type 7 LSA. Also called an ASBR Summary LSA. +Type 5 LSA An LSA that represents a subnet that OSPF learned from another (external) routing source, typically through route redistribution by an ASBR. Also known as an External LSA. +Type 7 AS External LSA An LSA type that describes an external subnet as injected into an NSSA area. + +UDLD Unidirectional Link Detection; a feature that enables a switch to confirm that a link is operating bidirectionally. If not, the port can be disabled automatically. + +unequal-cost load balancing A feature of EIGRP in which EIGRP includes multiple routes for the same prefix in the IP routing table but with IOS forwarding packets propor-tionally based on the calculated integer metric for each route. +unicast MAC address Ethernet MAC address that represents a single NIC or interface. + +Unicast Reverse Path Forwarding (uRPF) A Cisco IOS feature that allows an interface to check the source IP address of an arriving packet and permit or deny that packet based on whether or not that IP address is reachable, based on the router’s FIB (and optionally based on whether the egress interface to get back to that source IP address is the same interface on which it is arriving). +unique local address A type of IPv6 unicast address meant as a replacement for IPv4 pri-vate addresses. + +unknown unicast flooding The action taken by a switch when the destination MAC address cannot be found in the MAC address table; the frame is flooded or replicated out all switchports except the receiving port. +update (EIGRP) An EIGRP message that informs neighbors about routing information. Update messages require an acknowledgment. + +update source (BGP) In BGP, a reference to the IP address used as the source address of packets that hold BGP messages. The Update source can differ from neighbor to neighbor and is important in that a BGP router may set a route’s NEXT_HOP to its update source IP address. +UplinkFast An STP feature that enables access layer switches to unblock a redundant uplink when the primary root port fails. + +VACL VLAN access control list; a filter that can control traffic passing within a VLAN. + +variance An integer setting for EIGRP. Any FS route whose metric is less than this variance multiplier times the successor’s metric is added to the routing table, within the restrictions of the maximum-paths command. +virtual circuit A logical concept that represents the path over which frames travel between DTEs. VCs are particularly useful when comparing Frame Relay to leased physical circuits. + + +From the Library of Outcast Outcast +40 CCNP Routing and Switching TSHOOT 300-135 Official Cert Guide + +virtual link With OSPF, the encapsulation of OSPF messages inside IP to a router with which no common subnet is shared for the purpose of either mending partitioned areas or providing a connection from some remote area to the backbone area. +virtual MAC address The MAC address associated with the virtual router in an HSRP/ VRRP group. + +virtual private network (VPN) A set of security protocols that, when implemented by two devices on either side of an unsecure network such as the Internet, can enable the devic-es to send data securely. VPNs provide privacy, device authentication, antireplay services, and data integrity services. +Virtual Router Redundancy Protocol (VRRP) VRRP, similar to Hot Standby Routing Protocol (HSRP), allows a collection of routers to service traffic destined for a single IP address. Unlike HSRP, the IP address serviced by a VRRP group does not have to be a virtual IP address. The IP address can be the address of a physical interface on the virtual router master, which is the router responsible for forwarding traffic destined for the IP address of the VRRP group. +virtual router The IP address of a virtual router acting as the default gateway in an HSRP/ VRRP group. + +Virtual Routing and Forwarding (VRF) A technology that allows a single physical router to run multiple virtual router instances. + +VLAN Virtual LAN; a logical network existing on one or more Layer 2 switches, forming a single broadcast domain. + +VLAN hopping A malicious host sends specially crafted frames that contain extra, spoofed 802.1Q trunking tags into an access port, while the packet payloads appear on a totally dif-ferent VLAN. +VLAN number A unique index number given to a VLAN on a switch, differentiating it from other VLANs on the switch. + +VLSM Variable-length subnet mask(ing). The ability to specify a different subnet mask for the same Class A, B, or C network number on different subnets. VLSM can help optimize available address space. +voice VLAN The VLAN used between a Cisco IP phone and a Catalyst switch to carry voice traffic. + +VPN client Software that resides on a PC, often a laptop, so that the host can implement the protocols required to be an endpoint of a VPN. + +VPN See virtual private network. + +VRF-Lite A traditional approach to configuring Virtual Routing and Forwarding (VRF) on Cisco routers. + +VRRP virtual master router The router in a VRRP group that forwards traffic sent to the virtual gateway IP and MAC address. + + + + +From the Library of Outcast Outcast +Glossary 41 + +VRRP virtual router backup A router in a VRRP group that waits until the master router fails before taking over that role. + +VTP configuration revision number An index that indicates the current version of VLAN information used in the VTP domain; a higher number is more preferable. + +VTP domain name The name used to identify each unique VTP domain. + + +VTP domain ments. + +VTP pruning + + +A logical grouping of switches that share a common set of VLAN require- + + +A VTP feature that reduces unnecessary flooded traffic by pruning or + +removing VLANs from a trunk link, only when there are no active hosts associated with the VLANs. +VTP VLAN Trunking Protocol; used to communicate VLAN configuration information among a group of switches. + +weight A local Cisco proprietary BGP attribute that is not advertised to any peers. A larger value is considered to be better. + +weighting 1) A numeric value from 0 to 255 that is used by GLBP AVFs with object track-ing to determine whether they are healthy enough to forward traffic for the GLBP virtual MAC address it has been assigned. If not healthy enough, another AVF can take over the for-warding of traffic for that virtual MAC address. 2) A numeric value from 0 to 255 assigned to AVFs that is used by the AVG to determine how the virtual MAC address will be distributed to the clients when they request the MAC address via an ARP request. +wiki A wiki (which is the Hawaiian word for fast) can act as a web-based collaborative documentation platform. + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Outcast Outcast diff --git a/CCNP-and-CCIE-Enterprise-Core-CCNP-Advanced-Routing-Portable-Command-Guide-All-ENCOR-350-401-and-ENARSI-300-410 conv.txt b/CCNP-and-CCIE-Enterprise-Core-CCNP-Advanced-Routing-Portable-Command-Guide-All-ENCOR-350-401-and-ENARSI-300-410 conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..787b73bfbceb7c524b11daa8dc2c22f9fe5d332f --- /dev/null +++ b/CCNP-and-CCIE-Enterprise-Core-CCNP-Advanced-Routing-Portable-Command-Guide-All-ENCOR-350-401-and-ENARSI-300-410 conv.txt @@ -0,0 +1,39867 @@ + +Contents 1. Cover Page + +2. About This eBook + +3. Title Page + +4. Copyright Page + +5. Reader Services + +6. Contents at a Glance + +7. Table of Contents + +8. About the Authors + +9. About the Technical Reviewer + +10. Dedications + +11. Acknowledgments + +12. Command Syntax Conventions + +13. Introduction + +1. Who Should Read This Book? + +2. Strategies for Exam Preparation + +3. How This Book Is Organized + +14. Chapter 1. VLANs + +1. Virtual LANs + +2. Layer 2 Link Aggregation + +15. Chapter 2. Spanning Tree Protocol + +1. Spanning Tree Protocol Definition + +2. Enabling Spanning Tree Protocol +3. Changing the Spanning-Tree Mode + +4. Configuring the Root Switch + +5. Configuring a Secondary Root Switch + +6. Configuring Port Priority + +7. Configuring the Path Cost + +8. Configuring the Switch Priority of a VLAN + +9. Configuring STP Timers + +10. Configuring Optional Spanning-Tree Features + +11. Configuring and Verifying Port Error Conditions + +12. Enabling Rapid Spanning Tree + +13. Rapid Spanning Tree Link Types + +14. Enabling Multiple Spanning Tree + +15. Verifying the Extended System ID + +16. Verifying STP + +17. Troubleshooting Spanning Tree Protocol + +18. Configuration Example: PVST+ + +19. Spanning-Tree Migration Example: PVST+ to Rapid-PVST+ + +16. Chapter 3. Implementing Inter-VLAN Routing + +1. Inter-VLAN Communication Using an External Router: Router-on-a-Stick + +2. Inter-VLAN Communication Tips + +3. Inter-VLAN Communication on a Multilayer Switch Through a Switch Virtual Interface + +4. Configuration Example: Inter-VLAN Communication + +5. Configuration Example: IPv6 Inter-VLAN Communication + +17. Chapter 4. EIGRP +1. Enhanced Interior Gateway Routing Protocol (EIGRP) + +2. Enabling EIGRP for IPv4 Using Classic Mode Configuration + +3. Enabling EIGRP for IPv6 Using Classic Mode Configuration + +4. EIGRP Using Named Mode Configuration + +5. EIGRP Named Mode Subconfiguration Modes + +6. Upgrading Classic Mode to Named Mode Configuration + +7. EIGRP Router ID + +8. Authentication for EIGRP + +9. Auto-Summarization for EIGRP + +10. IPv4 Manual Summarization for EIGRP + +11. IPv6 Manual Summarization for EIGRP + +12. Timers for EIGRP + +13. Passive Interfaces for EIGRP + +14. “Pseudo” Passive EIGRP Interfaces + +15. Injecting a Default Route into EIGRP: Redistribution of a Static Route + +16. Injecting a Default Route into EIGRP: ip default-network + +17. Injecting a Default Route into EIGRP: Summarize to 0.0.0.0/0 + +18. Accepting Exterior Routing Information: default-information + +19. Equal-cost Load Balancing: maximum-paths + +20. Unequal-cost Load Balancing: variance + +21. EIGRP Traffic Sharing + +22. Bandwidth Use for EIGRP + +23. Stub Routing for EIGRP + +24. EIGRP Unicast Neighbors + +25. EIGRP Wide Metrics +26. Adjusting the EIGRP Metric Weights + +27. Verifying EIGRP + +28. Troubleshooting EIGRP + +29. Configuration Example: EIGRP for IPv4 and IPv6 Using Named Mode + +18. Chapter 5. OSPF + +1. Comparing OSPFv2 and OSPFv3 + +2. Configuring OSPF + +3. Configuring Multiarea OSPF + +4. Using Wildcard Masks with OSPF Areas + +5. Configuring Traditional OSPFv3 + +6. OSPFv3 Address Families + +7. Authentication for OSPF + +8. Optimizing OSPF Parameters + +9. Propagating a Default Route + +10. Route Summarization + +11. OSPF Route Filtering + +12. OSPF Special Area Types + +13. Virtual Links + +14. Verifying OSPF Configuration + +15. Troubleshooting OSPF + +16. Configuration Example: Single-Area OSPF + +17. Configuration Example: Multiarea OSPF + +18. Configuration Example: Traditional OSPFv3 + +19. Configuration Example: OSPFv3 with Address Families + +19. Chapter 6. Redistribution and Path Control +1. Defining Seed and Default Metrics + +2. Redistributing Connected Networks + +3. Redistributing Static Routes + +4. Redistributing Subnets into OSPF + +5. Assigning E1 or E2 Routes in OSPF + +6. Redistributing OSPF Internal and External Routes + +7. Configuration Example: Route Redistribution for IPv4 + +8. Configuration Example: Route Redistribution for IPv6 + +9. Verifying Route Redistribution + +10. Route Filtering Using the distribute-list Command + +11. Route Filtering Using Prefix Lists + +12. Using Route Maps with Route Redistribution + +13. Manipulating Redistribution Using Route Tagging + +14. Changing Administrative Distance + +15. Path Control with Policy-Based Routing + +16. Verifying Policy-Based Routing + +17. Configuration Example: PBR with Route Maps + +18. Cisco IOS IP SLA + +19. PBR with Cisco IOS IP SLA + +20. Chapter 7. BGP + +1. Configuring BGP: Classic Configuration + +2. Configuring Multiprotocol BGP (MP-BGP) + +3. Configuring BGP: Address Families + +4. Configuration Example: Using MP-BGP Address Families to Exchange IPv4 and IPv6 Routes + +5. BGP Support for 4-Byte AS Numbers +6. BGP Timers + +7. BGP and update-source + +8. IBGP Next-Hop Behavior + +9. EBGP Multihop + +10. Attributes + +11. Verifying BGP + +12. Troubleshooting BGP + +13. Default Routes + +14. Route Aggregation + +15. Route Reflectors + +16. Regular Expressions + +17. Regular Expressions: Examples + +18. BGP Route Filtering Using Access Lists and Distribute Lists + +19. Configuration Example: Using Prefix Lists and AS Path Access Lists + +20. BGP Peer Groups + +21. Authentication for BGP + +21. Chapter 8. IP Services + +1. Network Address Translation (NAT) + +2. First-Hop Redundancy Protocols + +3. Dynamic Host Control Protocol (DHCP) + +22. Chapter 9. Device Management + +1. Configuring Passwords + +2. Password Encryption Algorithm Types + +3. Boot System Commands + +4. The Cisco IOS File System +5. Viewing the Cisco IOS File System + +6. Commonly Used URL Prefixes for Cisco Network Devices + +7. Deciphering IOS Image Filenames + +8. Backing Up Configurations to a TFTP Server + +9. Restoring Configurations from a TFTP Server + +10. Backing Up the Cisco IOS Software to a TFTP Server + +11. Restoring/Upgrading the Cisco IOS Software from a TFTP Server + +12. Restoring the Cisco IOS Software Using the ROM Monitor Environmental Variables and tftpdnld Command + +13. Secure Copy Protocol (SCP) + +14. Disabling Unneeded Services + +15. Useful Device Management Options + +23. Chapter 10. Infrastructure Security + +1. IPv4 Access Control Lists (ACLs) + +2. Configuring and Applying Extended IPv4 ACLs + +3. IPv6 ACLs + +4. Implementing Authentication Methods + +5. Control Plane Policing (CoPP) + +6. Unicast Reverse Path Forwarding (uRPF) + +24. Chapter 11. Network Assurance + +1. Internet Control Message Protocol Redirect Messages + +2. The ping Command + +3. Examples of Using the ping and the Extended ping Commands + +4. The traceroute Command + +5. The debug Command + +6. Conditionally Triggered Debugs +7. Configuring Secure SNMP + +8. Implementing Logging + +9. Configuring NetFlow + +10. Configuring Flexible NetFlow + +11. Verifying NetFlow + +12. Implementing Port Mirroring + +13. Configuring Network Time Protocol + +14. Tool Command Language (Tcl) + +15. Embedded Event Manager (EEM) + +25. Chapter 12. Wireless Security and Troubleshooting + +1. Authenticating Wireless Clients + +2. Troubleshooting from the Wireless LAN Controller + +3. Troubleshooting Wireless Client Connectivity + +26. Chapter 13. Overlay Tunnels and VRF + +1. Generic Routing Encapsulation (GRE) + +2. Site-to-Site GRE over IPsec + +3. Site-to-Site Virtual Tunnel Interface (VTI) over IPsec + +4. Cisco Dynamic Multipoint VPN (DMVPN) + +5. VRF-Lite + +27. Appendix A. Create Your Own Journal Here + +28. Index + +29. Code Snippets + +1. i + +2. ii + +3. iii + +4. iv +5. v + +6. vi + +7. vii + +8. viii + +9. ix + +10. x + +11. xi + +12. xii + +13. xiii + +14. xiv + +15. xv + +16. xvi + +17. xvii + +18. xviii + +19. xix + +20. xx + +21. xxi + +22. 1 + +23. 2 + +24. 3 + +25. 4 + +26. 5 + +27. 6 + +28. 7 + +29. 8 + +30. 9 +31. 10 + +32. 11 + +33. 12 + +34. 13 + +35. 14 + +36. 15 + +37. 16 + +38. 17 + +39. 18 + +40. 19 + +41. 20 + +42. 21 + +43. 22 + +44. 23 + +45. 24 + +46. 25 + +47. 26 + +48. 27 + +49. 28 + +50. 29 + +51. 30 + +52. 31 + +53. 32 + +54. 33 + +55. 34 + +56. 35 +57. 36 + +58. 37 + +59. 38 + +60. 39 + +61. 40 + +62. 41 + +63. 42 + +64. 43 + +65. 44 + +66. 45 + +67. 46 + +68. 47 + +69. 48 + +70. 49 + +71. 50 + +72. 51 + +73. 52 + +74. 53 + +75. 54 + +76. 55 + +77. 56 + +78. 57 + +79. 58 + +80. 59 + +81. 60 + +82. 61 +83. 62 + +84. 63 + +85. 64 + +86. 65 + +87. 66 + +88. 67 + +89. 68 + +90. 69 + +91. 70 + +92. 71 + +93. 72 + +94. 73 + +95. 74 + +96. 75 + +97. 76 + +98. 77 + +99. 78 + +100. 79 + +101. 80 + +102. 81 + +103. 82 + +104. 83 + +105. 84 + +106. 85 + +107. 86 + +108. 87 +109. 88 + +110. 89 + +111. 90 + +112. 91 + +113. 92 + +114. 93 + +115. 94 + +116. 95 + +117. 96 + +118. 97 + +119. 98 + +120. 99 + +121. 100 + +122. 101 + +123. 102 + +124. 103 + +125. 104 + +126. 105 + +127. 106 + +128. 107 + +129. 108 + +130. 109 + +131. 110 + +132. 111 + +133. 112 + +134. 113 +135. 114 + +136. 115 + +137. 116 + +138. 117 + +139. 118 + +140. 119 + +141. 120 + +142. 121 + +143. 122 + +144. 123 + +145. 124 + +146. 125 + +147. 126 + +148. 127 + +149. 128 + +150. 129 + +151. 130 + +152. 131 + +153. 132 + +154. 133 + +155. 134 + +156. 135 + +157. 136 + +158. 137 + +159. 138 + +160. 139 +161. 140 + +162. 141 + +163. 142 + +164. 143 + +165. 144 + +166. 145 + +167. 146 + +168. 147 + +169. 148 + +170. 149 + +171. 150 + +172. 151 + +173. 152 + +174. 153 + +175. 154 + +176. 155 + +177. 156 + +178. 157 + +179. 158 + +180. 159 + +181. 160 + +182. 161 + +183. 162 + +184. 163 + +185. 164 + +186. 165 +187. 166 + +188. 167 + +189. 168 + +190. 169 + +191. 170 + +192. 171 + +193. 172 + +194. 173 + +195. 174 + +196. 175 + +197. 176 + +198. 177 + +199. 178 + +200. 179 + +201. 180 + +202. 181 + +203. 182 + +204. 183 + +205. 184 + +206. 185 + +207. 186 + +208. 187 + +209. 188 + +210. 189 + +211. 190 + +212. 191 +213. 192 + +214. 193 + +215. 194 + +216. 195 + +217. 196 + +218. 197 + +219. 198 + +220. 199 + +221. 200 + +222. 201 + +223. 202 + +224. 203 + +225. 204 + +226. 205 + +227. 206 + +228. 207 + +229. 208 + +230. 209 + +231. 210 + +232. 211 + +233. 212 + +234. 213 + +235. 214 + +236. 215 + +237. 216 + +238. 217 +239. 218 + +240. 219 + +241. 220 + +242. 221 + +243. 222 + +244. 223 + +245. 224 + +246. 225 + +247. 226 + +248. 227 + +249. 228 + +250. 229 + +251. 230 + +252. 231 + +253. 232 + +254. 233 + +255. 234 + +256. 235 + +257. 236 + +258. 237 + +259. 238 + +260. 239 + +261. 240 + +262. 241 + +263. 242 + +264. 243 +265. 244 + +266. 245 + +267. 246 + +268. 247 + +269. 248 + +270. 249 + +271. 250 + +272. 251 + +273. 252 + +274. 253 + +275. 254 + +276. 255 + +277. 256 + +278. 257 + +279. 258 + +280. 259 + +281. 260 + +282. 261 + +283. 262 + +284. 263 + +285. 264 + +286. 265 + +287. 266 + +288. 267 + +289. 268 + +290. 269 +291. 270 + +292. 271 + +293. 272 + +294. 273 + +295. 274 + +296. 275 + +297. 276 + +298. 277 + +299. 278 + +300. 279 + +301. 280 + +302. 281 + +303. 282 + +304. 283 + +305. 284 + +306. 285 + +307. 286 + +308. 287 + +309. 288 + +310. 289 + +311. 290 + +312. 291 + +313. 292 + +314. 293 + +315. 294 + +316. 295 +317. 296 + +318. 297 + +319. 298 + +320. 299 + +321. 300 + +322. 301 + +323. 302 + +324. 303 + +325. 304 + +326. 305 + +327. 306 + +328. 307 + +329. 308 + +330. 309 + +331. 310 + +332. 311 + +333. 312 + +334. 313 + +335. 314 + +336. 315 + +337. 316 + +338. 317 + +339. 318 + +340. 319 + +341. 320 + +342. 321 +343. 322 + +344. 323 + +345. 324 + +346. 325 + +347. 326 + +348. 327 + +349. 328 + +350. 329 + +351. 330 + +352. 331 + +353. 332 + +354. 333 + +355. 334 + +356. 335 + +357. 336 + +358. 337 + +359. 338 + +360. 339 + +361. 340 + +362. 341 + +363. 342 + +364. 343 + +365. 344 + +366. 345 + +367. 346 + +368. 347 +369. 348 + +370. 349 + +371. 350 + +372. 351 + +373. 352 + +374. 353 + +375. 354 + +376. 355 + +377. 356 + +378. 357 + +379. 358 + +380. 359 + +381. 360 + +382. 361 + +383. 362 + +384. 363 + +385. 364 + +386. 365 + +387. 366 + +388. 367 + +389. 368 + +390. 369 + +391. 370 + +392. 371 + +393. 372 + +394. 373 +395. 374 + +396. 375 + +397. 376 + +398. 377 + +399. 378 + +400. 379 + +401. 380 + +402. 381 + +403. 382 + +404. 383 + +405. 384 + +406. 385 + +407. 386 + +408. 387 + +409. 388 + +410. 389 + +411. 390 + +412. 391 + +413. 392 + +414. 393 + +415. 394 +About This eBook + +ePUB is an open, industry-standard format for eBooks. However, support of ePUB and its many features varies across reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device manufacturer’s Web site. + +Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the eBook in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a “Click here to view code image” link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app. +CCNP and CCIE Enterprise Core & CCNP Enterprise Advanced Routing Portable Command Guide + +All ENCOR (350-401) and ENARSI (300-410) Commands in One Compact, Portable Resource + + + + + +Scott Empson Patrick Gargano + + + + + + +Cisco Press +CCNP and CCIE Enterprise Core & CCNP Enterprise Advanced Routing Portable Command Guide + +Scott Empson, Patrick Gargano + +Copyright© 2020 Cisco Systems, Inc. + +Published by: Cisco Press + +All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in +a review. + + +ScoutAutomatedPrintCode + +Library of Congress Control Number: 2019956928 + +ISBN-13: 978-0-13-576816-7 + +ISBN-10: 0-13-576816-0 + + +Warning and Disclaimer + +This book is designed to provide information about the CCNP and CCIE Enterprise Core (ENCOR 350-401) and CCNP Enterprise Advanced Routing (ENARSI 300-410) exams. Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. +The information is provided on an “as is” basis. The authors, Cisco Press, and Cisco Systems, Inc. shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accompany it. + +The opinions expressed in this book belong to the authors and are not necessarily those of Cisco Systems, Inc. + + +Trademark Acknowledgments + + +All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Cisco Press or Cisco Systems, Inc., cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. + + +Special Sales + + +For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@pearsoned.com or (800) 382-3419. + +For government sales inquiries, please contact governmentsales@pearsoned.com. + +For questions about sales outside the U.S., please contact intlcs@pearson.com. + +Editor-In-Chief Mark Taub +Alliances Manager, Cisco Press Arezou Gol + +Product Line Manager Brett Bartow + +Senior Editor James Manly + +Managing Editor Sandra Schroeder + +Development Editor Eleanor Bru + +Senior Project Editor Lori Lyons + +Copy Editor Bill McManus + +Technical Editor Bob Vachon + +Editorial Assistant Cindy Teeters + +Cover Designer Chuti Prasertsith + +Production Manager +Vaishnavi Venkatesan/codeMantra + +Composition codeMantra + +Indexer +Ken Johnson + +Proofreader Abigail Manheim + + +Feedback Information + + +At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community. + +Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve the quality of this book, or otherwise alter it to better suit your needs, you can contact us through email at feedback@ciscopress.com. Please make sure to include the book title and ISBN in your message. + +We greatly appreciate your assistance. + + + + + + + + +Americas Headquarters Cisco Systems, Inc. +San Jose, CA + +Asia Pacific Headquarters Cisco Systems (USA) Pte. Ltd. +Singapore + +Europe Headquarters +Cisco Systems International BV Amsterdam, +The Netherlands + + +Cisco has more than 200 offices worldwide. Addresses, phone numbers, and fax numbers are listed on the Cisco Website at www.cisco.com/go/offices. + +Cisco and the Cisco logo are trademarks or registered trademarks +of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL: www.cisco.com/go/trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1110R) +ReaderServices + + +Register your copy at www.ciscopress.com/title/9780135768167 for convenient access to downloads, updates, and corrections as they become available. To start the registration process, go to www.ciscopress.com/register and log in or create an account*. Enter the product ISBN 9780135768167 and click Submit. When the process is complete, you will find any available bonus content under Registered Products. + +*Be sure to check the box that you would like to hear from us to receive exclusive discounts on future editions of this product. +Contents at a Glance + + +About the Authors + +Introduction + + +Part I: Layer 2 Infrastructure + +CHAPTER 1 VLANs + +CHAPTER 2 Spanning Tree Protocol + +CHAPTER 3 Implementing Inter-VLAN Routing + + +Part II: Layer 3 Infrastructure + +CHAPTER 4 EIGRP + +CHAPTER 5 OSPF + +CHAPTER 6 Redistribution and Path Control + +CHAPTER 7 BGP + + +Part III: Infrastructure Services + +CHAPTER 8 IP Services + +CHAPTER 9 Device Management + + +Part IV: Infrastructure Security + +CHAPTER 10 Infrastructure Security + + +Part V: Network Assurance + +CHAPTER 11 Network Assurance +Part VI: Wireless + +CHAPTER 12 Wireless Security and Troubleshooting + + +Part VII: Overlays and Virtualization + +CHAPTER 13 Overlay Tunnels and VRF + + +Part VIII: Appendix + + +APPENDIX A Create Your Own Journal Here + + +INDEX +Tableof Contents + + +About the Authors + +Introduction + + +Part I: Layer 2 Infrastructure + +CHAPTER 1 VLANs + +Virtual LANs + +Creating Static VLANs Using VLAN Configuration Mode + +Assigning Ports to Data and Voice VLANs + +Using the range Command + +Dynamic Trunking Protocol (DTP) + +Setting the Trunk Encapsulation and Allowed VLANs + +VLAN Trunking Protocol (VTP) + +Verifying VTP + +Verifying VLAN Information + +Saving VLAN Configurations + +Erasing VLAN Configurations + +Configuration Example: VLANs + +Layer 2 Link Aggregation + +Interface Modes in EtherChannel + +Default EtherChannel Configuration +Guidelines for Configuring EtherChannel + +Configuring Layer 2 EtherChannel + +Configuring Layer 3 EtherChannel + +Configuring EtherChannel Load Balancing + +Configuring LACP Hot-Standby Ports + +Monitoring and Verifying EtherChannel + +Configuration Example: EtherChannel + +CHAPTER 2 Spanning Tree Protocol + +Spanning Tree Protocol Definition + +Enabling Spanning Tree Protocol + +Changing the Spanning-Tree Mode + +Configuring the Root Switch + +Configuring a Secondary Root Switch + +Configuring Port Priority + +Configuring the Path Cost + +Configuring the Switch Priority of a VLAN + +Configuring STP Timers + +Configuring Optional Spanning-Tree Features + +PortFast + +BPDU Guard (2xxx/older 3xxx Series) + +BPDU Guard (3650/9xxx Series) + +BPDU Filter + +UplinkFast + +BackboneFast +Root Guard + +Loop Guard + +Unidirectional Link Detection + +Configuring and Verifying Port Error Conditions + +Enabling Rapid Spanning Tree + +Rapid Spanning Tree Link Types + +Enabling Multiple Spanning Tree + +Verifying the Extended System ID + +Verifying STP + +Troubleshooting Spanning Tree Protocol + +Configuration Example: PVST+ + +Spanning-Tree Migration Example: PVST+ to Rapid-PVST+ + +CHAPTER 3 Implementing Inter-VLAN Routing + +Inter-VLAN Communication Using an External Router: Router-on-a-Stick + +Inter-VLAN Communication Tips + +Inter-VLAN Communication on a Multilayer Switch Through a Switch Virtual Interface + +Configuring Inter-VLAN Communication on an L3 Switch + +Removing L2 Switchport Capability of an Interface on an L3 Switch + +Configuration Example: Inter-VLAN Communication + +Configuration Example: IPv6 Inter-VLAN Communication +Part II: Layer 3 Infrastructure + +CHAPTER 4 EIGRP + +Enhanced Interior Gateway Routing Protocol (EIGRP) + +Enabling EIGRP for IPv4 Using Classic Mode Configuration + +Enabling EIGRP for IPv6 Using Classic Mode Configuration + +EIGRP Using Named Mode Configuration + +EIGRP Named Mode Subconfiguration Modes + +Upgrading Classic Mode to Named Mode Configuration + +EIGRP Router ID + +Authentication for EIGRP + +Configuring Authentication in Classic Mode + +Configuring Authentication in Named Mode + +Verifying and Troubleshooting EIGRP Authentication + +Auto-Summarization for EIGRP + +IPv4 Manual Summarization for EIGRP + +IPv6 Manual Summarization for EIGRP + +Timers for EIGRP + +Passive Interfaces for EIGRP + +“Pseudo” Passive EIGRP Interfaces + +Injecting a Default Route into EIGRP: Redistribution of a Static Route +Injecting a Default Route into EIGRP: ip default-network + +Injecting a Default Route into EIGRP: Summarize to 0.0.0.0/0 + +Accepting Exterior Routing Information: default-information + +Equal-cost Load Balancing: maximum-paths + +Unequal-cost Load Balancing: variance + +EIGRP Traffic Sharing + +Bandwidth Use for EIGRP + +Stub Routing for EIGRP + +EIGRP Unicast Neighbors + +EIGRP Wide Metrics + +Adjusting the EIGRP Metric Weights + +Verifying EIGRP + +Troubleshooting EIGRP + +Configuration Example: EIGRP for IPv4 and IPv6 Using Named Mode + +CHAPTER 5 OSPF + +Comparing OSPFv2 and OSPFv3 + +Configuring OSPF + +Configuring Multiarea OSPF + +Using Wildcard Masks with OSPF Areas + +Configuring Traditional OSPFv3 + +Enabling OSPF for IPv6 on an Interface +OSPFv3 and Stub/NSSA Areas + +Interarea OSPFv3 Route Summarization + +Enabling an IPv4 Router ID for OSPFv3 + +Forcing an SPF Calculation + +OSPFv3 Address Families + +Configuring the IPv6 Address Family in OSPFv3 + +Configuring the IPv4 Address Family in OSPFv3 + +Applying Parameters in Address Family Configuration Mode + +Authentication for OSPF + +Configuring OSPFv2 Authentication: Simple Password + +Configuring OSPFv2 Cryptographic Authentication: SHA-256 + +Configuring OSPFv3 Authentication and Encryption + +Verifying OSPFv2 and OSPFv3 Authentication + +Optimizing OSPF Parameters + +Loopback Interfaces + +Router ID + +DR/BDR Elections + +Passive Interfaces + +Modifying Cost Metrics + +OSPF Reference Bandwidth + +OSPF LSDB Overload Protection +Timers + +IP MTU + +Propagating a Default Route + +Route Summarization + +Interarea Route Summarization + +External Route Summarization + +OSPF Route Filtering + +Using the filter-list Command + +Using the area range not-advertise Command + +Using the distribute-list in Command + +Using the summary-address not-advertise Command + +OSPF Special Area Types + +Stub Areas + +Totally Stubby Areas + +Not-So-Stubby Areas (NSSA) + +Totally NSSA + +Virtual Links + +Configuration Example: Virtual Links + +Verifying OSPF Configuration + +Troubleshooting OSPF + +Configuration Example: Single-Area OSPF + +Configuration Example: Multiarea OSPF + +Configuration Example: Traditional OSPFv3 + +Configuration Example: OSPFv3 with Address +Families + +CHAPTER 6 Redistribution and Path Control + +Defining Seed and Default Metrics + +Redistributing Connected Networks + +Redistributing Static Routes + +Redistributing Subnets into OSPF + +Assigning E1 or E2 Routes in OSPF + +Redistributing OSPF Internal and External Routes + +Configuration Example: Route Redistribution for IPv4 + +Configuration Example: Route Redistribution for IPv6 + +Verifying Route Redistribution + +Route Filtering Using the distribute-list Command + +Configuration Example: Inbound and Outbound Distribute List Route Filters + +Configuration Example: Controlling Redistribution with Outbound Distribute Lists + +Verifying Route Filters + +Route Filtering Using Prefix Lists + +Configuration Example: Using a Distribute List That References a Prefix List to Control Redistribution + +Verifying Prefix Lists + +Using Route Maps with Route Redistribution + +Configuration Example: Route Maps + +Manipulating Redistribution Using Route Tagging +Changing Administrative Distance + +Path Control with Policy-Based Routing + +Verifying Policy-Based Routing + +Configuration Example: PBR with Route Maps + +Cisco IOS IP SLA + +Configuring Authentication for IP SLA + +Monitoring IP SLA Operations + +PBR with Cisco IOS IP SLA + +Step 1: Define Probe(s) + +Step 2: Define Tracking Object(s) + +Step 3a: Define the Action on the Tracking Object(s) + +Step 3b: Define Policy Routing Using the Tracking Object(s) + +Step 4: Verify IP SLA Operations + +CHAPTER 7 BGP + +Configuring BGP: Classic Configuration + +Configuring Multiprotocol BGP (MP-BGP) + +Configuring BGP: Address Families + +Configuration Example: Using MP-BGP Address Families to Exchange IPv4 and IPv6 Routes + +BGP Support for 4-Byte AS Numbers + +BGP Timers + +BGP and update-source + +IBGP Next-Hop Behavior +EBGP Multihop + +Attributes + +Route Selection Decision Process—The BGP Best Path Algorithm + +Weight Attribute + +Using AS Path Access Lists to Manipulate the Weight Attribute + +Using Prefix Lists and Route Maps to Manipulate the Weight Attribute + +Local Preference Attribute + +Using AS Path Access Lists with Route Maps to Manipulate the Local Preference Attribute + +AS Path Attribute Prepending + +AS Path: Removing Private Autonomous Systems + +Multi-Exit Discriminator (MED) Attribute + +Verifying BGP + +Troubleshooting BGP + +Default Routes + +Route Aggregation + +Route Reflectors + +Regular Expressions + +Regular Expressions: Examples + +BGP Route Filtering Using Access Lists and Distribute Lists + +Configuration Example: Using Prefix Lists and AS Path Access Lists +BGP Peer Groups + +Authentication for BGP + +Configuring Authentication Between BGP Peers + +Verifying BGP Authentication + + +Part III: Infrastructure Services + +CHAPTER 8 IP Services + +Network Address Translation (NAT) + +Private IP Addresses: RFC 1918 + +Configuring Static NAT + +Configuring Dynamic NAT + +Configuring Port Address Translation (PAT) + +Configuring a NAT Virtual Interface + +Verifying NAT and PAT Configurations + +Troubleshooting NAT and PAT Configurations + +Configuration Example: PAT + +Configuration Example: NAT Virtual Interfaces and Static NAT + +First-Hop Redundancy Protocols + +Hot Standby Router Protocol + +Virtual Router Redundancy Protocol + +IPv4 Configuration Example: HSRP on L3 Switch + +IPv4 Configuration Example: VRRPv2 on Router and L3 Switch with IP SLA Tracking + +IPv6 Configuration Example: HSRPv2 on Router and L3 Switch +Dynamic Host Control Protocol (DHCP) + +Implementing DHCP for IPv4 + +Implementing DHCP for IPv6 + +Configuration Example: DHCP for IPv4 + +Configuration Example: DHCP for IPv6 + +CHAPTER 9 Device Management + +Configuring Passwords + +Cleartext Password Encryption + +Password Encryption Algorithm Types + +Configuring SSH + +Verifying SSH + +Boot System Commands + +The Cisco IOS File System + +Viewing the Cisco IOS File System + +Commonly Used URL Prefixes for Cisco Network Devices + +Deciphering IOS Image Filenames + +Backing Up Configurations to a TFTP Server + +Restoring Configurations from a TFTP Server + +Backing Up the Cisco IOS Software to a TFTP Server + +Restoring/Upgrading the Cisco IOS Software from a TFTP Server + +Restoring the Cisco IOS Software Using the ROM Monitor Environmental Variables and tftpdnld Command +Secure Copy Protocol (SCP) + +Configuring an SCP Server + +Verifying and Troubleshooting SCP + +Configuration Example: SCP + +Disabling Unneeded Services + +Useful Device Management Options + + +Part IV: Infrastructure Security + +CHAPTER 10 Infrastructure Security + +IPv4 Access Control Lists (ACLs) + +Configuring and Applying Standard IPv4 ACLs + +Configuring and Applying Extended IPv4 ACLs + +Configuring and Applying Time-based ACLs + +Configuring and Applying VTY ACLs + +IPv6 ACLs + +Configuring and Applying IPv6 ACLs + +Verifying IPv4 and IPv6 ACLs + +Implementing Authentication Methods + +Simple Local Database Authentication + +AAA-based Local Database Authentication + +RADIUS Authentication + +TACACS+ Authentication + +Configuring Authorization and Accounting + +Troubleshooting AAA + +Control Plane Policing (CoPP) +Step 1: Define ACLs to Identify Permitted CoPP Traffic Flows + +Step 2: Define Class Maps for Matched Traffic + +Step 3: Define a Policy Map to Police Matched Traffic + +Step 4: Assign a Policy Map to the Control Plane + +Verifying CoPP + +Unicast Reverse Path Forwarding (uRPF) + +Configuring uRPF + +Verifying and Troubleshooting uRPF + + +Part V: Network Assurance + +CHAPTER 11 Network Assurance + +Internet Control Message Protocol Redirect Messages + +The ping Command + +Examples of Using the ping and the Extended ping Commands + +The traceroute Command + +The debug Command + +Conditionally Triggered Debugs + +Configuring Secure SNMP + +Securing SNMPv1 or SNMPv2c + +Securing SNMPv3 + +Verifying SNMP + +Implementing Logging + +Configuring Syslog +Syslog Message Format + +Syslog Severity Levels + +Syslog Message Example + +Configuring NetFlow + +Configuring Flexible NetFlow + +Step 1: Configure a Flow Record + +Step 2: Configure a Flow Exporter + +Step 3: Configure a Flow Monitor + +Step 4: Apply the Flow Monitor to an Interface + +Verifying NetFlow + +Implementing Port Mirroring + +Default SPAN and RSPAN Configuration + +Configuring Local SPAN + +Local SPAN Guidelines for Configuration + +Configuration Example: Local SPAN + +Configuring Remote SPAN + +Remote SPAN Guidelines for Configuration + +Configuration Example: Remote SPAN + +Configuring Encapsulated RSPAN (ERSPAN) + +Verifying and Troubleshooting Local and Remote SPAN + +Configuring Network Time Protocol + +NTP Configuration + +NTP Design + +Securing NTP +Verifying and Troubleshooting NTP + +Setting the Clock on a Router + +Using Time Stamps + +Configuration Example: NTP + +Tool Command Language (Tcl) + +Embedded Event Manager (EEM) + +EEM Configuration Examples + +EEM and Tcl Scripts + +Verifying EEM + + +Part VI: Wireless + +CHAPTER 12 Wireless Security and Troubleshooting + +Authenticating Wireless Clients + +Open Authentication + +Authenticating with a Pre-shared Key + +Authenticating with EAP + +Authenticating with WebAuth + +Troubleshooting from the Wireless LAN Controller + +Troubleshooting Wireless Client Connectivity + +Cisco AireOS Monitoring Dashboard GUI + +Cisco IOS XE GUI + + +Part VII: Overlays and Virtualization + +CHAPTER 13 Overlay Tunnels and VRF + +Generic Routing Encapsulation (GRE) +Configuring an IPv4 GRE Tunnel + +Configuring an IPv6 GRE Tunnel + +Verifying IPv4 and IPv6 GRE Tunnels + +Configuration Example: IPv4 and IPv6 GRE Tunnels with OSPFv3 + +Site-to-Site GRE over IPsec + +GRE/IPsec Using Crypto Maps + +GRE/IPsec Using IPsec Profiles + +Verifying GRE/IPsec + +Site-to-Site Virtual Tunnel Interface (VTI) over IPsec + +Cisco Dynamic Multipoint VPN (DMVPN) + +Configuration Example: Cisco DMVPN for IPv4 + +Verifying Cisco DMVPN + +VRF-Lite + +Configuring VRF-Lite + +Verifying VRF-Lite + + +APPENDIX A Create Your Own Journal Here + + +INDEX +About theAuthors + + +Scott Empson is an instructor in the Department of Information Systems Technology at the Northern Alberta Institute of Technology in Edmonton, Alberta, Canada, where he has taught for over 21 years. He teaches technical courses in Cisco routing and switching, along with courses in professional development and leadership. Scott created the CCNA Command Quick Reference in 2004 as a companion guide to the Cisco Networking Academy Program, and this guide became the CCNA Portable Command Guide in 2005. Other titles in the series in the areas of CCNP, Wireless, Security, Microsoft, and Linux followed beginning in 2006. Scott has a Master of Education degree along with three undergraduate degrees: a Bachelor of Arts, with a major in English; a Bachelor of Education, again with a major in English/language arts; and a Bachelor of Applied Information Systems Technology, with a major in network management. Scott lives in Edmonton, Alberta, with his wife, Trina, and two university-attending-but- +still-haven’t-moved-out-yet-but-hope-to-move-out-as-soon-as-possible-after-graduation-so-Dad-can-have-the-TV-room-back children, Zachariah and Shaelyn. + +Patrick Gargano has been an educator since 1996, a Cisco Networking Academy Instructor since 2000, and a Certified Cisco Systems Instructor (CCSI) since 2005. He is currently based in Australia, where he is a Content Development Engineer at Skyline ATS, responsible for CCNP Enterprise course development with Learning@Cisco. He previously led the Networking Academy program at Collège La Cité in Ottawa, Canada, where he taught +CCNA/CCNP-level courses, and he has also worked for Cisco Learning Partners Fast Lane UK, ARP Technologies, and NterOne. + +In 2018 Patrick was awarded the Networking Academy Above and Beyond Instructor award for leading CCNA CyberOps early adoption and instructor training in Quebec, Canada. Patrick has also twice led the Cisco Networking Academy Dream Team at Cisco Live US. + +Patrick’s previous Cisco Press publications include the CCNP Routing and Switching Portable Command Guide (2014) and 31 Days Before Your CCNA Security Exam (2016). His certifications include CCNA (R&S), CCNA Wireless, CCNA Security, CCNA CyberOps, and CCNP (R&S). He holds Bachelor of Education and Bachelor of Arts degrees from the University of Ottawa, and is completing a Master of Professional Studies in Computer Networking at Fort Hays State University (Kansas). +About theTechnical Reviewer + + +Bob Vachon is a professor in the Computer Systems Technology program at Cambrian College in Sudbury, Ontario, Canada, where he teaches networking infrastructure courses. He has worked and taught in the computer networking and information technology field since 1984. He has collaborated on various CCNA, CCNA Security, and CCNP projects for the Cisco Networking Academy as team lead, lead author, and subject matter expert. He enjoys playing the guitar and being outdoors. +Dedications + + +Scott Empson: As always, this book is dedicated to Trina, Zach, and Shae. Also, this book is dedicated to Florence Empson. I couldn’t have asked for a better mother. I love you. Cancer sucks. + +Patrick Gargano: To my wife Kathryn. I am grateful for +your love, patience, and constant support, not only during —Scott + +the writing of this book but always. Thank you for taking us on this Australian adventure. Je t’aime. + +To our son Sam. What a lovely, kind, interesting little person you are becoming. It is such a pleasure to have you in our lives and to share in your passions. Je t’aime, Samu. + + + +—Patrick +Acknowledgments + + +Anyone who has ever had anything to do with the publishing industry knows that it takes many, many people to create a book. Our names may be on the cover, but there is no way that we can take credit for all that occurred to get this book from idea to publication. Therefore, we must thank the following: + +Scott Empson: The team at Cisco Press. Once again, you amaze me with your professionalism and the ability to make me look good. James and Ellie—thank you for your continued support and belief in my little engineering journal. Thanks to the Production team: Lori, Bill, and Vaishnavi. + +To our technical reviewer, Bob Vachon, thanks for keeping us on track and making sure that what we wrote is correct and relevant. I brought you on board with me all those years ago for the CCNA Security Portable Command Guide, and I have always enjoyed working with and collaborating with you. This time has been no different. + +A big thank you goes to my co-author Patrick Gargano; you have made this a better book with your presence and your knowledge. I am truly honoured to have you as part of the Portable Command Guide family. + +Patrick Gargano: I first want to thank Mary Beth Ray for welcoming me into the Cisco Press family back in 2013. I hope you enjoy a well-deserved retirement as you embrace this new, more-relaxed chapter in your life. Namaste. +James, Ellie, Lori, and Bill at Cisco Press did a fabulous job keeping the project on the rails and looking its best. + +Bob, always a pleasure working with you. Your attention to detail and technical suggestions were truly appreciated. + +Finally, to my good friend Scott. Like the first book we worked on together, this one has been fun and engaging. Thanks for putting up with all those early-morning and late-night calls as we dealt with the 15-hour time difference between Edmonton and Perth. For the last time, no, I don’t have the winning lottery ticket numbers even though it’s already tomorrow in Australia. +CommandSyntax Conventions + + +The conventions used to present command syntax in this book are the same conventions used in the IOS Command Reference. The Command Reference describes these conventions as follows: + + +Boldface indicates commands and keywords that are entered literally as shown. In actual configuration examples and output (not general command syntax), boldface indicates commands that are manually input by the user (such as a show command). + +Italic indicates arguments for which you supply actual values. + +Vertical bars (|) separate alternative, mutually exclusive elements. + +Square brackets ([ ]) indicate an optional element. + +Braces ({ }) indicate a required choice. + +Braces within brackets ([{ }]) indicate a required choice within an optional element. +Introduction + + +Welcome to the CCNP and CCIE Enterprise Core & CCNP Enterprise Advanced Routing Portable Command Guide, a handy resource that you can use both on the job and to study for the ENCOR 350-401 and ENARSI 300-410 exams. I truly hope that a shortened name comes along for this title soon as that is a real bother to continually type out. In order to increase sales, I suggested to Cisco Press that we call this one Harry Potter and the CCNP ENCORE & ENARSI Portable Command Guide, but I was quickly vetoed—the title is still too long, I guess. Who can really understand what lawyers say, anyway? + +In June 2019, during his Cisco Live keynote address, Cisco Systems CEO Chuck Robbins made an announcement that turned the Cisco certification world completely around. The entire certification program is being reinvented—a new vision, new exams, new paths —including the DevNet pathway that focuses on programmability expertise and software skills. In response to this announcement, authors around the world jumped back into their respective home office/lab space (some would say we never truly left) and started the enormous task of updating the content needed to prepare for these new exams, scheduled to launch in February 2020. This book is one of many titles (at one point I heard that over 35 new titles were being worked on) created over the last 12 months to meet the demands of industry and academia in both the CCNP and CCIE certification space. After studying the new blueprints of all the new CCNP Enterprise exams, Patrick and I decided to combine outcomes from two certification exams into a single volume for this +latest edition of our Portable Command Guide. Enterprise Core and Enterprise Advanced Routing are very closely related, so it made sense to create this volume for you to use to prepare for the new exams, and to use as a reference to accomplish tasks you may be undertaking in your production networks. + +For those of you who have used one or more Portable Command Guides before, thank you for looking at this one. For those of you who are new to the Portable Command Guides, you are reading what is essentially a cleaned-up version of a personal engineering journal—a small notebook that can be carried around with you that contains little nuggets of information; commands that you use but then forget; IP address schemes for the parts of the network you work with only on occasion; and little reminders about concepts that you work with only once or twice a year but still need to know when those times roll around.. Having a journal of commands at your fingertips, without having to search Cisco.com (or resort to textbooks if the network is down and you are responsible for getting it back online), can be a real timesaver. + +With the creation of the new CCNP Enterprise exam objectives, there is always something new to read, a new podcast to listen to, or a slideshow from Cisco Live that you want to review. To make this guide even more practical for you to use, it includes an appendix of blank pages where you can add details that you glean from these other resources, as well as add your own configurations, commands that are not in this book but are needed in your world, and so on. You can make this book your personal engineering journal, a central repository of information that won’t weigh you down as you carry it from the office or cubicle to the server and infrastructure rooms in some remote part of the building or some branch office. +WHO SHOULD READ THIS BOOK? + +This book is for those people preparing for the CCNP and CCIE Enterprise Core (ENCOR 350-401) exam and/or the CCNP Enterprise Advanced Routing (ENARSI 300-410) exam, whether through self-study, on-the-job training and practice, study within the Cisco Academy Program, or study through the use of a Cisco Training Partner. There are also many handy notes and tips along the way to make life a bit easier for you in this endeavor. This book is also useful in the workplace. It is small enough that you will find it easy to carry around with you. Big, heavy textbooks might look impressive on your bookshelf in your office, but can you really carry them all around with you when you are working in some server room or equipment closet somewhere? + +STRATEGIES FOR EXAM PREPARATION + +The strategy you use to prepare for the ENCOR and ENARSI exams might differ from strategies used by other readers, mainly based on the skills, knowledge, and experience you already have obtained. For instance, if you have attended a course offered by a Cisco Learning Partner or through the Cisco Networking Academy, you might take a different approach than someone who learned routing via on-the-job training or through self-study. Regardless of the strategy you use or the background you have, this book is designed to help you minimize the amount of time required to get to the point where you can pass the exam. For instance, there is no need for you to practice or read about EIGRP, OSPF, WLCs, or VLANs if you fully understand the topic already. However, many people like to make sure that they truly know a topic and therefore read over material that they already know. Several book features will help you gain the confidence that you need to be convinced that you +know some material already, and to also help you know what topics you need to study more. + +HOW THIS BOOK IS ORGANIZED + +Although this book could be read cover to cover, we strongly advise against it, unless you really are having problems sleeping at night. The book is designed to be a simple listing of the commands that you need to understand to pass the ENCOR and ENARSI exams. Portable Command Guides contain very little theory; the series is designed to focus on the commands needed at this level of study. + +This book focuses primarily on the configure and troubleshoot exam topics found in the CCNP and CCIE Enterprise Core (ENCOR 350-401) and CCNP Enterprise Advanced Routing (ENARSI 300-410) exam blueprints. Although this book covers two separate exams, commands for both are grouped logically according to this structure: + +Part I: Layer 2 Infrastructure + + +Chapter 1, “VLANs”: Troubleshooting static and dynamic 802.1Q trunking protocols; troubleshooting static and dynamic EtherChannels + +Chapter 2, “Spanning Tree Protocol”: Configuring and verifying common Spanning Tree Protocols—RSPT and MST + +Chapter 3, “Implementing Inter-VLAN Routing”: Configuring inter-VLAN routing + + +Part II: Layer 3 Infrastructure + + +Chapter 4, “EIGRP”: Troubleshooting EIGRP, in both classic and named modes for IPv4 and IPv6 +Chapter 5, “OSPF”: Configuring, verifying, and troubleshooting OSPF environments, using both classic modes and address families for IPv4 and IPv6 + +Chapter 6, “Redistribution and Path Control”: Configuring, verifying, and troubleshooting route redistribution between protocols; troubleshooting network performance issues; loop prevention mechanisms + +Chapter 7, “BGP”: Configuring, verifying, and troubleshooting BGP, both internal and external, for IPv4 and IPv6 + + +Part III: Infrastructure Services + + +Chapter 8, “IP Services”: Configuring and verifying NAT and PAT; configuring and verifying first-hop redundancy protocols; troubleshooting IPv4 and IPv6 DHCP + +Chapter 9, “Device Management”: Configuring and verifying line and password protection; troubleshooting device management of console, VTY, Telnet, HTTP, SSH, TFTP, and SCP + + +Part IV: Infrastructure Security + + +Chapter 10, “Infrastructure Security”: Configuring and verifying device access control; configuring and verifying authentication/authorization using AAA; troubleshooting device security using Cisco IOS AAA; troubleshooting control plane policing + + +Part V: Network Assurance + + +Chapter 11, “Network Assurance”: Diagnosing network problems using different tools such as debug, traceroute, ping, SNMP, and syslog; configuring and verifying device monitoring; +configuring and verifying NetFlow and Flexible NetFlow; configuring and verifying NTP; constructing Tcl scripts; constructing EEM applets + + +Part VI: Wireless + + +Chapter 12, “Wireless Security and Troubleshooting”: Configuring and verifying wireless security features such as authentication; troubleshooting WLAN configurations and wireless client connectivity issues + + +Part VII: Overlays and Virtualization + + +Chapter 13, “Overlay Tunnels and VRF”: Configuring and verifying DMVPN; configuring and verifying VRF +Part I: Layer 2 Infrastructure +Chapter 1 VLANs + + + + +This chapter provides information about the following topics: + + +Virtual LANs + + +Creating static VLANs using VLAN configuration mode + +Assigning ports to data and voice VLANs + +Using the range command + +Dynamic Trunking Protocol (DTP) + +Setting the trunk encapsulation and allowed VLANs + +VLAN Trunking Protocol (VTP) + +Verifying VTP + +Verifying VLAN information + +Saving VLAN information + +Erasing VLAN information + +Configuration example: VLANs + + + +Layer 2 link aggregation + + +Interface modes in EtherChannel + +Default EtherChannel configuration + +Guidelines for configuring EtherChannel +Configuring Layer 2 EtherChannel + +Configuring Layer 3 EtherChannel + +Configuring EtherChannel load balancing + +Configuring LACP hot-standby ports + +Monitoring and verifying EtherChannel + +Configuration example: EtherChannel + + + +VIRTUAL LANS + +A VLAN is a switched network that logically segments by function, project teams, or applications, without regard to the physical locations of the users. VLANs are the Layer 2 (L2) partitioning of a physical switch into two or more virtual switches. Ports assigned to one VLAN are in a single broadcast domain and are L2 forwarded only within that broadcast domain. Each VLAN is considered its own logical network where any traffic destined for outside the logical network must be forwarded by a router. Each VLAN can support its own instance of spanning tree. VLANs can be extended across multiple interconnected switches by tagging the VLAN number on each Ethernet frame transmitted or received between them. This tagging of frames is supported by IEEE 802.1Q trunking. + +Creating Static VLANs Using VLAN Configuration Mode + +Static VLANs occur when a switch port is manually assigned by the network administrator to belong to a VLAN. Each port is associated with a specific VLAN. By default, all ports are originally assigned to VLAN 1. You create VLANs using the VLAN configuration mode. + + + +Note +VLAN database mode has been deprecated in IOS Version 15. + + + + +Switch(config)# Creates VLAN 3 and enters VLAN configuration vlan 3 mode for further definitions + + + +Switch(config- Assigns a name to the VLAN. The length of the vlan)# name name can be from 1 to 32 characters Engineering + + + +Switch(config- Applies changes, increases the VTP revision vlan)# exit number by 1, and returns to global +configuration mode + + + + + +Note + + +The VLAN is not created until you exit VLAN configuration mode + + + + + + +Switch(config)# + + + + + +Note +Use this method to add normal-range VLANs (1–1005) or extended-range VLANs (1006–4094). Configuration information for normal-range VLANs is always saved in the VLAN database, and you can displaythis information byentering the show vlan privileged EXEC command. + + + + +Note +The VLAN Trunking Protocol (VTP) revision number is increased byone each time a VLAN is created or changed. + + + + +Note +VTP Version 3 supports propagation of extended-range VLANs. VTP Versions 1 and 2 propagate onlyVLANs 1– 1005. + + + + +Note +Transparent mode does not increment the VTP revision number. + + + +Assigning Ports to Data and Voice VLANs + + +Switch(config)# interface Moves to interface configuration fastethernet 0/1 mode + + + +Switch(config-if)# Sets the port to access mode switchport mode access + + + +Switch(config-if)# Assigns this port to data VLAN 10 switchport access vlan 10 + + + +Switch(config-if)# Assigns this port to include tagged switchport voice vlan 11 voice frames in VLAN 11 + + + + + +Note +When the switchport mode access command is used, the port will operate as a nontrunking single VLAN interface that transmits and receives untagged frames. An access port can belong to onlyone VLAN. + + + + +Note +When the switchport voice command is used together with the switchport access command, a pseudo-trunk is created allowing two VLANs on the port, one for voice traffic and one for all other traffic. The voice traffic is forwarded in 802.1Q tagged frames and the remaining nonvoice VLAN has no 802.1Q tagging (native VLAN). The internal mini-switch in a Cisco VoIP phone will pass untagged frames to an attached PC and forward 802.1Q tagged VoIP traffic with a differentiated services code point (DSCP) qualityof service (QoS) value of EF (or Expedited Forwarding) to the switch port. In this special case, the switch port can belong to two VLANs, one for data and one for voice traffic. + + + +Using the range Command +Switch(config)# Enables you to set the same interface range configuration parameters on multiple fastethernet 0/1 – 9 ports at the same time + + + + + +Note + + +Depending on the model of switch, there is a space before and after the hyphen in the interface range command. Be careful with your typing + + + + + +Switch(config-if- Sets ports 1–9 as access ports range)# switchport +mode access + + + +Switch(config-if- Assigns ports 1–9 to VLAN 10 range)# switchport +access vlan 10 + + + +Switch(config-if- Assigns ports 1–9 to include tagged voice range)# switchport frames in VLAN 11 +voice vlan 11 + + + +Dynamic Trunking Protocol (DTP) + + +Switch(config)# Moves to interface configuration mode interface +fastethernet 0/1 + + + +Switch(config-if)# Makes the interface actively attempt to switchport mode convert the link to a trunk link +dynamic desirable + + + +Note + + +With the switchport mode dynamic desirable command set, the interface becomes a trunk link if the neighboring interface is set to trunk, desirable, or auto + + + + + + +Switch(config-if)# Makes the interface able to convert into a switchport mode trunk link +dynamic auto + + + + +Note + + +With the switchport mode dynamic auto command set, the interface becomes a trunk link if the neighboring interface is set to trunk or desirable + + + + + + +Switch(config-if)# switchport +nonegotiate + +Prevents the interface from generating DTP +frames + + + + + +Note + + +Use the switchport mode nonegotiate command onlywhen the interface switchport mode is access or trunk. You must manuallyconfigure the neighboring interface to establish a trunk link + + + + + +Switch(config-if)# Puts the interface into permanent trunking + +switchport mode +trunk + + +mode and negotiates to convert the link into a +trunk link +Note + + +With the switchport mode trunk command set, the interface becomes a trunk link even if the neighboring interface is not a trunk link + + + + + + + + +Note +The default mode is dependent on the platform. For the 2960/9200 series, the default mode is dynamic auto. + + + + + +Note +On a 2960/9200 series switch, the default for all ports is to be an access port. However, with the default DTP mode being dynamic auto, an access port can be converted into a trunk port if that port receives DTP information from the other side of the link and that other side is set to trunk or desirable. It is therefore recommended that you hard-code all access ports as access ports with the switchport mode access command. This way, DTP information will not inadvertentlychange an access port to a trunk port. Anyport set with the switchport mode access command ignores anyDTP requests to convert the link. + + + + +Note +VLAN Trunking Protocol (VTP) domain names must match for a DTP to negotiate a trunk. + + + +Setting the Trunk Encapsulation and Allowed VLANs + +Depending on the series of switch that you are using, you may have a choice as to what type of trunk encapsulation you want to use: the Cisco proprietary Inter-Switch Link (ISL) or IEEE 802.1Q (dot1q). + + + +Caution +Cisco ISLhas been deprecated. Depending on the age and model of your Cisco switch, you maystill be able to change the encapsulation type between dot1q and ISL. + + + + +Caution +The 2960, 2960-x, and 9200 series of switches support onlydot1q trunking. Therefore, some commands such as switchport trunk encapsulation {isl | dotq1} are not available. +Switch(config Moves to interface configuration mode )# interface +fastethernet 0/1 + + + + +Switch(config -if)# +switchport + +Puts the interface into permanent trunking mode and +negotiates to convert the link into a trunk link + +mode trunk + + + + +Switch(config -if)# switchport trunk encapsulation isl + + + +Switch(config -if)# switchport trunk encapsulation dot1q + + + +Switch(config -if)# switchport trunk encapsulation negotiate + + + +Switch(config + +Specifies ISL encapsulation on the trunk link. This command is only available on switches that support ISL + + + + + + + + +Specifies 802.1Q encapsulation on the trunk link. This command may not be required on newer switches + + + + + + + + +Specifies that the interface negotiate with the neighboring interface to become either an ISL or dot1q trunk, depending on the capabilities or configuration of the neighboring interface. This command may not be required on newer switches + + + + +Configures the list of VLANs allowed on the trunk +-if)# switchport +trunk allowed Note + +vlan 10,12,18-22 + + + + +Switch(config -if)# +switchport + + +All VLANs are allowed bydefault + + + + + + +Configures the list of VLANs to add to the existing +VLANs allowed on the trunk + +trunk allowed vlan add 44,47-49 + + + + +Switch(config -if)# +switchport + +Configures the list of VLANs to remove from the +existing VLANs allowed on the trunk + +trunk allowed + +vlan remove +44,47-49 + + +Note + + +Do not enter anyspaces between comma-separated VLAN parameters or +in hyphen-specified ranges + + + + + + + +VLAN Trunking Protocol (VTP) + +VTP is a Cisco proprietary protocol that allows for VLAN configuration (addition, deletion, or renaming of VLANs) to be consistently maintained across a common administrative domain. + + +Switc Changes the switch to VTP client mode h(con +fig)# +vtp mode clien t + + + +Switc Changes the switch to VTP server mode h(con +fig)# +vtp +mode Note + +serve Bydefault, all Catalyst switches are in server mode r + + + +Switc Changes the switch to VTP transparent mode h(con +fig)# vtp +mode trans paren t + + + +Switc Returns the switch to the default VTP server mode h(con +fig)# no +vtp mode + + + +Switc Configures the VTP domain name. The name can be from 1 to 32 h(con characters long and is case sensitive +fig)# +vtp domai n domai n-name + + + +Switc h(con fig)# vtp passw +ord passw ord + + + + + + + +Switc h(con fig)# vtp versi +on numbe +r + + + +Note + + +All switches operating in VTP server or client mode must have the same domain name to ensure communication + + + + + + + +Configures a VTP password. In Cisco IOS Software Release 12.3 and later, the password is an ASCII string from 1 to 32 characters long. If you are using a Cisco IOS Software release earlier than 12.3, the password length ranges from 8 to 64 characters long + + + + + +Note + + +To communicate with each other, all switches must have the same VTP password set + + + + + + +Sets the VTP Version to Version 1, Version 2, or Version 3 + + + + + +Note + + +VTP versions are not interoperable. All switches must use the same version (with V1 and V2). The biggest difference between Versions 1 and 2 is that Version 2 has support for Token Ring VLANs. Version 3 has added new features such as the creation of a VTP primaryserver, to prevent the accidental deletion of VLANs that occurred in V1 and V2. V3 also supports extended VLANs, private VLANs, Multiple Spanning Tree Protocol (MSTP), and the abilityto be +disabled per interface as well as globally + + + + + + + + + +Note + + +VTP Version 3 is compatible with Version 2, but not Version 1 + + +Switc h# vtp prima ry + + + +Switc h# vtp prima ry-serve r + + + + +Switc h# vtp prima ry vlan + + + +Switc h# vtp prima ry mst + + + +Switc + +Changes the operation state of a switch from a secondary server (the default state) to a primary server and advertises the configuration to the domain. If the switch password is configured as hidden, you are prompted to reenter the password. This happens only if configured in Version 2. This prompt occurs in privileged EXEC mode but not in global configuration mode + + + + + +Note + + +The vtp primary-server [vlan | mst | force] commands are onlyavailable on older model switches. On newer switches running more recent IOS/IOS-XE, use the vtp primary[vlan | mst | force] command instead + + + + + +(Optional) Configures the device as the primary VTP server for VLANs + + + + + + + + + + +(Optional) Configures the devices as the primary VTP server for the multiple spanning tree (MST) feature + + + + + + + + + + +(Optional) Configures the device to not check for conflicting +h# devices when configuring the primary server vtp +prima ry force + + + + +Switc Enables VTP pruning h(con +fig)# +vtp +pruni Note + +ng Bydefault, VTP pruning is disabled. You need to enable VTP pruning on onlyone switch in +VTP server mode + + + + + + + + +Note +OnlyVLANs included in the pruning-eligible list can be pruned. VLANs 2 through 1001 are pruning eligible by default on trunk ports. Reserved VLANs and extended-range VLANs cannot be pruned. To change which eligible VLANs can be pruned, use the interface-specific switchport trunk pruning vlan command: +Click here to view code image + + +Switch(config-if)# switchport trunk pruning vlan remove 4,20-30 +! Removes VLANs 4 and 20-30 +Switch(config-if)# switchport trunk pruning vlan except 40-50 ! All VLANs are added to the pruning list except for 40-50 + + + + + +Caution +Due to the inherent risk in having VTP servers overwrite each other and cause VLANs to disappear, Cisco recommends as a best practice deploying VTP in transparent mode. If you are going to use a client/server model, use Version 3 and the use of a VTPv3 primaryserver to prevent accidental database overwrites. + + + +Verifying VTP +Switch# show vtp status + + + +Switch# show vtp + +Displays general information about VTP configuration + + + +Displays the VTP counters for the switch + +counters + + + +Switch# show vtp Displays the VTP passwords password + + + + + +Note +If trunking has been established before VTP is set up, VTP information is propagated throughout the switch fabric almost immediately. However, because VTP information is advertised onlyevery300 seconds (5 minutes), unless a change has been made to force an update, it can take several minutes for VTP information to be propagated. + + + +Verifying VLAN Information + + + +Switch# show vlan + + + +Switch# show + +Displays VLAN information + + + + + +Displays VLAN information in brief + +vlan brief + + + +Switch# show Displays information of VLAN 2 only vlan id 2 + + + +Switch# show Displays information of VLAN named marketing vlan name only +marketing + + + +Switch# show Displays trunk ports, trunking modes, interfaces trunk encapsulation, and native and allowed VLANs +Switch# show Displays the administrative and operational + +interfaces +switchport + +status of trunks, encapsulation, private VLAN, +voice VLAN, and trunk VLAN pruning + + + + +Switch# show Displays the administrative and operational interface status of a trunking port +fastethernet 0/1 trunk + + + +Saving VLAN Configurations + +The stored configurations of VLANs 1 through 1005 are always saved in the VLAN database; the filename is vlan.dat and is stored in flash:. After creating or deleting a VLAN in VLAN configuration mode, the exit command will apply any new changes to the VLAN database. + +If you are using VTP transparent mode, the configurations are also saved in the running configuration, and can be saved to the startup configuration using the copy running-config startup-config command. + +If the VTP mode is transparent in the startup configuration, and the VLAN database and the VTP domain name from the VLAN database matches that in the startup configuration file, the VLAN database is ignored (cleared), and the VTP and VLAN configurations in the startup configuration file are used. The VLAN database revision number remains unchanged in the VLAN database. + +Erasing VLAN Configurations +Switch# delete flash:vlan.d +at + +Removes entire VLAN database from flash + + + + + +Caution + + + +Make sure that there is no space between the colon (:) and the characters vlan.dat. You can potentiallyerase the entire contents of the flash with this command if the syntaxis not correct. Make sure to read the output from the switch. If you need to cancel, press Ctrl+C to escape back to privileged mode: + + + +Switch# + +Switch# delete flash:vlan.dat + +Delete filename [vlan.dat]? + +Delete flash:vlan.dat? [confirm] + +Switch# + + + + + + + + + + +Switch(confi g)# interface fastethernet 0/5 + + + +Switch(confi + +Moves to interface configuration mode + + + + + + + + + + +Removes port from VLAN 5 and reassigns it to VLAN 1 + +g-if)# no (the default VLAN) switchport +access vlan 5 + + + +Switch(confi Moves to global configuration mode g-if)# exit +Switch(confi Removes VLAN 5 from the VLAN database g)# no vlan +5 + + + + + +Note +When you delete a VLAN from a switch that is in VTP server mode, the VLAN is removed from the VLAN database for all switches in the VTP domain. When you delete a VLAN from a switch that is in VTP transparent mode, the VLAN is deleted onlyon that specific switch. + + + + +Note +You cannot delete the default VLANs for the different media types: Ethernet VLAN 1 and FDDI or Token Ring VLANs 1002 to 1005. + + + + +Caution +When you delete a VLAN, anyports assigned to that VLAN become inactive. This “inactive” state can be seen using the show interfaces switchport command for the port or ports in question. The ports remain associated with the VLAN (and thus inactive) until you assign those ports to a defined VLAN. Therefore, it is recommended that you reassign ports to a new VLAN or the default VLAN before you delete a VLAN from the VLAN database. + + + +Configuration Example: VLANs + +Figure 1-1 shows the network topology for the configuration that follows, which demonstrates how to configure VLANs using the commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 1-1 Network Topology for VLAN Configuration Example + + + +3650 Switch + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets the host name hostname Switch3650 + + + +Switch3650(config)# Changes the switch to VTP server mode. Note vtp mode server that server is the default setting for a 3650 +switch +Switch3650(config)# Configures the VTP domain name to ENCOR vtp domain ENCOR + + + +Switch3650(config)# Sets the VTP password to Order66 vtp password +Order66 + + + +Switch3650(config)# Creates VLAN 10 and enters VLAN vlan 10 configuration mode + + + +Switch3650(config- Assigns a name to the VLAN vlan)# name Admin + + + +Switch3650(config- Increases the revision number by 1 and vlan)# exit returns to global configuration mode + + + +Switch3650(config)# Creates VLAN 20 and enters VLAN vlan 20 configuration mode + + + +Switch3650(config- Assigns a name to the VLAN vlan)# name +Accounting + + + +Switch3650(config- Creates VLAN 30 and enters VLAN +vlan)# vlan 30 configuration mode. You do not have to exit back to global configuration mode to execute this command + + + + + +Note + + +The VTP revision number would be incremented because +VLAN 20 was created + + + + + + +Switch3650(config- Assigns a name to the VLAN vlan)# name +Engineering + + + +Switch3650(config- Exiting VLAN configuration mode adds vlan)# exit VLAN 30 to the VLAN database, which +increases the revision number by 1, and returns to global configuration mode + + + +Switch3650(config)# Enables you to set the same configuration interface range parameters on multiple ports at the same + +gigabitethernet 1/0/1-8 + + + +Switch3650(config- +if-range)# + +time + + + + + +Sets ports 1–8 as access ports + +switchport mode access + + + +Switch3650(config- Assigns ports 1–8 to VLAN 10 if-range)# +switchport access vlan 10 + + + +Switch3650(config- +if-range)# + +Enables you to set the same configuration +parameters on multiple ports at the same + +interface range time gigabitethernet +1/0/9-15 +Switch3650(config- Sets ports 9–15 as access ports if-range)# +switchport mode access + + +Switch3650(config- Assigns ports 9–15 to VLAN 20 if-range)# +switchport access vlan 20 + + + +Switch3650(config- +if-range)# + +Enables you to set the same configuration +parameters on multiple ports at the same + +interface range time gigabitethernet +1/0/16-24 + + + +Switch3650(config- Sets ports 16–24 as access ports if-range)# +switchport mode access + + +Switch3650(config- Assigns ports 16–24 to VLAN 30 if-range)# +switchport access vlan 30 + + +Switch3650(config- Returns to global configuration mode if-range)# exit + + + + +Switch3650(config)# +interface + +Moves to interface configuration mode. +Using this interface will require the +gigabitethernet 1/1/1 + + + +Switch3650(config- + + +installation of a Gigabit Ethernet SFP module in the appropriate uplink port + + + +Puts the interface into permanent trunking + + + +if)# switchport +mode trunk + +mode and negotiates to convert the link into +a trunk link + + + + +Switch3650(config- Returns to global configuration mode if)# exit + + + +Switch3650(config)# Enables VTP Version 3 vtp version 3 + + + +Switch3650(config)# Enables VTP pruning on this switch vtp pruning + + + +Switch3650(config)# Returns to privileged EXEC mode end + + + +Switch3650# vtp Configures the 3650 to be the VTP primary primary vlan force server + + + +Switch3650# copy Saves the configuration in NVRAM running-config +startup-config + + + +2960 Switch + + +Switch> enable Moves to privileged EXEC mode +Switch# configure Moves to global configuration mode terminal + + + +Switch(config)# hostname Sets the host name Switch2960 + + + +Switch2960(config)# vtp Changes the switch to VTP server mode client mode + + + +Switch2960(config)# vtp Configures the VTP domain name to domain ENCOR ENCOR + + + +Switch2960(config)# vtp Sets the VTP password to Order66 password Order66 + + + +Switch2960(config)# Enables you to set the same interface range configuration parameters on multiple fastethernet 0/1 - 8 ports at the same time + + + +Switch2960(config-if- Sets ports 1–8 as access ports range)# switchport mode +access + + + +Switch2960(config-if- Assigns ports 1–8 to VLAN 10 range)# switchport access +vlan 10 + + + +Switch2960(config-if- Enables you to set the same range)# interface range configuration parameters on multiple fastethernet 0/9 - 15 ports at the same time +Switch2960(config-if- Sets ports 9–15 as access ports range)# switchport mode +access + + + + +Switch2960(config-if- Assigns ports 9–15 to VLAN 20 range)# switchport access +vlan 20 + + + +Switch2960(config-if- Enables you to set the same range)# interface range configuration parameters on multiple fastethernet 0/16 - 24 ports at the same time + + + +Switch2960(config-if- Sets ports 16–24 as access ports range)# switchport mode +access + + + +Switch2960(config-if- Assigns ports 16–24 to VLAN 30 range)# switchport access +vlan 30 + + + +Switch2960(config-if- Returns to global configuration mode range)# exit + + + +Switch2960(config)# Moves to interface configuration interface gigabitethernet mode +0/1 + + + +Switch2960(config-if)# Puts the interface into permanent switchport mode trunk trunking mode and negotiates to +convert the link into a trunk link +Switch2960(config-if)# Returns to global configuration mode exit + + + +Switch2960(config)# vtp Enables VTP Version 3 on this switch version 3 + + + + +Switch2960(config)# vtp pruning + + + +Switch2960(config)# exit + +Enables VTP pruning on this switch + + + + + +Returns to privileged EXEC mode + + + + +Switch2960# copy running- Saves the configuration in NVRAM config startup-config + + + +LAYER 2 LINK AGGREGATION + +EtherChannel provides fault-tolerant high-speed links between switches, routers, and servers. An EtherChannel consists of individual Fast Ethernet or Gigabit Ethernet links bundled into a single logical link. If a link within an EtherChannel fails, traffic previously carried over that failed link changes to the remaining links within the EtherChannel. + +Interface Modes in EtherChannel + + +M P Description o r +d ot e o +c ol +O N Forces the interface into an EtherChannel without Port +n o Aggregation Protocol (PAgP) or Link Aggregation Control +ne Protocol (LACP). Channel only exists if connected to another interface group also in On mode + + + +A P Places the interface into a passive negotiating state (will respond ut A to PAgP packets but will not initiate PAgP negotiation) +o gP (C is co ) + + + +D P Places the interface into an active negotiating state (will send es A PAgP packets to start negotiations) +ir gP a (C bl is e co +) + + + +P L Places the interface into a passive negotiating state (will respond as A to LACP packets but will not initiate LACP negotiation) +si C ve P +(I E E E) + + + +A L Places the interface into an active negotiating state (will send ct A LACP packets to start negotiations) +iv C e P +(I E E E) + + + +Default EtherChannel Configuration + + + +Feature + + + +Channel groups + + + +Port-channel logical interface + + + +PAgP mode + + + +PAgP learn method + + + +PAgP priority + + + +LACP mode + + + +LACP learn method + + + +LACP port +priority + +Default Setting + + + +None assigned + + + +None defined + + + + + +No default + + + +Aggregate-port learning on all ports + + + + + +128 on all ports + + + +No default + + + +Aggregate-port learning on all ports + + + + + +32768 on all ports +LACP system priority + + + +LACP system ID + + + + + +Load balancing + +32768 + + + + + +LACP system priority and the switch (or switch stack) MAC address + + + +Load distribution on the switch is based on the source +MAC address of the incoming packet + + + + +Guidelines for Configuring EtherChannel + + +PAgP is Cisco proprietary and not compatible with LACP + +LACP is defined in 802.3ad + +The number of supported EtherChannels varies by switch platform model. For instance, you can create up to 6 EtherChannels on a Cisco Catalyst 2960 access layer switch, 48 EtherChannels on a Catalyst 3560 L3 switch, or up to 128 EtherChannels on a Catalyst 3650 switch + +A single PAgP EtherChannel can be made by combining anywhere from two to eight parallel links + +A single LACP EtherChannel can be made by combining up to 16 Ethernet ports of the same type. Up to eight ports can be active and up to eight ports can be in standby mode + +All ports must be identical: + + +Same speed and duplex + + + +Cannot mix Fast Ethernet and Gigabit Ethernet + +Cannot mix PAgP and LACP in a single EtherChannel +Can have PAgP and LACP EtherChannels on the same switch, but each EtherChannel must be exclusively PAgP or LACP + +Must all be VLAN trunk or nontrunk operational status + + + +All links must be either Layer 2 or Layer 3 in a single channel group + +To create a channel in PAgP, sides must be set to one of the following: + + +Auto-Desirable + + + +Desirable-Desirable + + + +To create a channel in LACP, sides must be set to either: + + +Active-Active + + + +Active-Passive + + + +To create a channel without using PAgP or LACP, sides must be set to On-On + +Do not configure a GigaStack gigabit interface converter (GBIC) as part of an EtherChannel + +An interface that is already configured to be a Switched Port Analyzer (SPAN) destination port will not join an EtherChannel group until SPAN is disabled + +Do not configure a secure port as part of an EtherChannel + +When using trunk links, ensure that all trunks are in the same mode —Inter-Switch Link (ISL) or 802.1Q (dot1q) + +Interfaces with different native VLANs cannot form an EtherChannel +When a group is first created, all ports follow the parameters set for the first port to be added to the group. If you change the configuration of one of the parameters, you must also make the changes to all ports in the group: + + +Allowed-VLAN list + + + +Spanning-tree path cost for each VLAN + +Spanning-tree port priority for each VLAN + +Spanning-tree PortFast setting + + + +Do not configure a port that is an active or a not-yet-active member of an EtherChannel as an IEEE 802.1X port. If you try to enable IEEE 802.1X on an EtherChannel port, an error message will appear, and IEEE 802.1X is not enabled + +For a Layer 3 EtherChannel, assign the Layer 3 address to the port-channel logical interface, not the physical ports in the channel + + +Configuring Layer 2 EtherChannel + + +Switch(config Specifies the port-channel interface )# interface + +port-channel {number} + + + + + +Switch(config + + +Once in the interface configuration mode, you can configure additional parameters just like for any other physical interface + + + +Moves to interface range configuration mode + +)# interface range fastethernet 0/1 - 4 +Switch(config -if-range)# +channel-group + +Creates channel group 1 as an EtherChannel and assigns interfaces FastEthernet 0/1 to 0/4 as part of +it. The other end of the EtherChannel would need to + +1 mode on be configured the same way for the link to work correctly + + + + +Switch(config -if-range)# +channel-group + +Creates channel group 1 as a PAgP channel and assigns interfaces 01 to 04 as part of it. The other end +of the EtherChannel would need to be configured + +1 mode either as desirable or auto for the link to work + +desirable + + + +Switch(config -if-range)# +channel-group + + +correctly + + + +Creates channel group 1 as an LACP channel and assigns interfaces 01 to 04 as part of it. The other end +of the EtherChannel would need to be configured + +1 mode active either as active or passive for the link to work correctly + + + + + +Note +If you enter the channel-group command in the physical port interface mode without first setting a port channel command in global configuration mode, the port channel will automaticallybe created for you. + + + +Configuring Layer 3 EtherChannel + + + +L3Switch(conf ig)# interface port-channel {number} + + + +L3Switch(conf + +Creates the port-channel logical interface and moves to interface configuration mode. Valid channel numbers are 1 to 128 for a 3650 series switch. For a 2960 series switch with L3 capabilities, the valid channel numbers are 1 to 6 + + + +Puts the port channel into Layer 3 mode +ig-if)# no switchport + + +L3Switch(conf Assigns the IP address and netmask to the port ig-if)# ip channel +address 172.16.10.1 255.255.255.0 + + + +L3Switch(conf Moves to global configuration mode ig-if)# exit + + + +L3Switch(conf Moves to interface range configuration mode ig)# +interface range gigabitethern et 1/0/20-24 + + +L3Switch(conf Puts the interface into Layer 3 mode ig-if)# no +switchport + + + + +L3Switch(conf +ig-if-range)# + +Ensures that no IP addresses are assigned on the +interfaces + +no ip address + + + + +L3Switch(conf ig-if-range)# +channel-group + +Creates channel group 1 as an EtherChannel and assigns interfaces 20 to 24 as part of it. The other end +of the EtherChannel would need to be configured the + +1 mode on same way for the link to work correctly +L3Switch(conf ig-if-range)# +channel-group + +Creates channel group 1 as a PAgP channel and assigns interfaces 20 to 24 as part of it. The other end +of the EtherChannel would need to be configured + +1 mode either as desirable or auto for the link to work + +desirable + + + + +L3Switch(conf ig-if-range)# +channel-group + + +correctly + + + + +Creates channel group 1 as an LACP channel and assigns interfaces 20 to 24 as part of it. The other end +of the EtherChannel would need to be configured + +1 mode active either as active or passive for the link to work correctly + + + + + +Note + + +The channel group number must match the port channel number + + + + + + +Configuring EtherChannel Load Balancing + + +L3Switch(config Configures an EtherChannel load-balancing )# port-channel method. The default value varies between load-balance different switch models +src-mac + +Select one of the following load-distribution methods: + + + +dst-ip—Specifies destination host IP address + + + +dst-mac—Specifies destination host MAC address of the incoming packet +dst-mixed-ip-port—Specifies destination host IP address and the TCP/UDP port + + + +dst-port—Specifies destination TCP/UDP port + + + +extended—Specifies extended load-balance methods (combination of source and destination methods beyond those available with the standard command) + + + +ipv6-label—Specifies the IPv6 flow label + + + +l3-proto—Specifies the Layer 3 protocol + + + +src-dst-ip—Specifies the source and destination host IP address + + + +src-dst-mac—Specifies the source and destination host MAC address + + + +src-dst-mixed-ip-port—Specifies the source and destination host IP address and TCP/UDP port + + + +src-dst-port—Specifies the source and destination TCP/UDP port + + + +src-ip—Specifies source host IP address + + + +src-mac—Specifies source host MAC address +(this is the default setting) + + + +src-mixed-ip-port—Specifies the source host IP address and the TCP/UDP port + + + +src-port—Specifies the source TCP/UDP port + + + + +Configuring LACP Hot-Standby Ports + +When LACP is enabled, by default the software tries to configure the maximum number of LACP-compatible ports in a channel, up to a maximum of 16 ports. Only eight ports can be active at one time; the remaining eight links are placed into hot-standby mode. If one of the active links becomes inactive, a link in hot-standby mode becomes active in its place. + +You can overwrite the default behavior by specifying the maximum number of active ports in a channel, in which case the remaining ports become hot-standby ports (if you specify only 5 active ports in a channel, the remaining 11 ports become hot-standby ports). + +If you specify more than eight links for an EtherChannel group, the software automatically decides which of the hot-standby ports to make active based on LACP priority. For every link that operates in LACP, the software assigns a unique priority made up of the following (in priority order): + + +LACP system priority + +System ID (the device MAC address) + +LACP port priority +Port number + + + + +Note +Lower numbers are better. + + + + + +Switch(con fig)# interface +port- + +Enters interface configuration mode for port channel 2. +The range for port channels is 1 to 128 + +channel 2 + + + + +Switch(con +fig-if)# + +Specifies the maximum number of LACP ports in the +port-channel bundle. The range is 1 to 8 + +lacp max-bundle 3 + + + + +Switch(con fig-if)# port-channel min-links 3 + + + +Switch(con fig-if)# exit + + + +Switch(con + +Specifies the minimum number of member ports (in this example, 3) that must be in the link-up state and bundled in the EtherChannel for the port-channel interface to transition to the link-up state. The range for this command is 2 to 8 + + + + +Returns to global configuration mode + + + + + + + +Configures the LACP system priority. The range is 1 to + +fig)# lacp 65535. The default is 32768. The lower the value, the system- higher the system priority +priority +32000 + + + + +Switch(con fig)# interface gigabiteth ernet 1/0/2 + + + +Switch(con +fig-if)# + +Moves to interface configuration mode + + + + + + + + + + + + +Configures the LACP port priority. The range is 1 to +65535. The default is 32768. The lower the value, the + +lacp port- more likely that the port will be used for LACP + +priority 32000 + + + +Switch(con fig-if)# +end + + +transmission + + + + + +Returns to privileged EXEC mode + + + + +Monitoring and Verifying EtherChannel + + + +Switch# show + + + + + +Switch# show + + +running-config + + + + + +running-config + +Displays a list of what is currently running on the device + + + +Displays interface fastethernet + +interface fastethernet 0/12 0/12 information + + + +Switch# show interfaces Displays EtherChannel fastethernet 0/12 etherchannel information for specified +interface +Switch# show etherchannel Displays all EtherChannel information + + + +Switch# show etherchannel 1 Displays port channel port-channel information + + + + +Switch# show etherchannel +summary + +Displays a summary of +EtherChannel information + + + + + +Switch# show interface port- +channel 1 + +Displays the general status of +EtherChannel 1 + + + + + +Switch# show lacp + + + + + +Switch# show pagp + + +neighbor + + + + + +neighbor + +Shows LACP neighbor information + + + +Shows PAgP neighbor +information + + + + + +Switch# clear pagp + + + + + +Switch# clear lacp + + +1 counters + + + + + +1 counters + +Clears PAgP channel group 1 information + + + +Clears LACP channel group 1 +information + + + + +Configuration Example: EtherChannel + +Figure 1-2 shows the network topology for the configuration that follows, which demonstrates how to configure EtherChannel using commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + + +Figure 1-2 Network Topology for EtherChannel Configuration + + + +DLSwitch (3650) + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets the host name hostname DLSwitch + + + + +DLSwitch(config)# no ip +domain-lookup + +Turns off DNS queries so that spelling +mistakes do not slow you down + + + + +DLSwitch(config)# vtp Changes the switch to VTP server mode mode server + + + +DLSwitch(config)# vtp Configures the VTP domain name to +domain testdomain testdomain + + + + +DLSwitch(config)# vlan +10 + +Creates VLAN 10 and enters VLAN +configuration mode + + + + +DLSwitch(config-vlan)# Assigns a name to the VLAN name Accounting + + + +DLSwitch(config-vlan)# Returns to global configuration mode exit + + + + +DLSwitch(config)# vlan +20 + +Creates VLAN 20 and enters VLAN +configuration mode + + + + +DLSwitch(config-vlan)# Assigns a name to the VLAN name Marketing + + + + +DLSwitch(config-vlan)# exit + + + +DLSwitch(config)# + +Returns to global configuration mode + + + + + +Moves to interface range configuration + +interface range mode gigabitethernet 1/0/1-4 + + + +DLSwitch(config-if)# Puts the interface into permanent switchport mode trunk trunking mode and negotiates to convert +the link into a trunk link + + + +DLSwitch(config-if)# Returns to global configuration mode exit +DLSwitch(config)# Moves to interface range configuration interface range mode +gigabitethernet 1/0/1-2 + + + +DLSwitch(config-if)# Creates channel group 1 and assigns channel-group 1 mode interfaces 01 to 02 as part of it desirable + + + + +DLSwitch(config-if)# exit + + + +DLSwitch(config)# + +Moves to global configuration mode + + + + + +Moves to interface range configuration + +interface range mode gigabitethernet 1/0/3-4 + + + +DLSwitch(config-if)# Creates channel group 2 and assigns channel-group 2 mode interfaces 03 to 04 as part of it desirable + + + +DLSwitch(config-if)# Moves to global configuration mode exit + + + +DLSwitch(config)# port- Configures load balancing based on channel load-balance destination MAC address +dst-mac + + + +DLSwitch(config)# exit Moves to privileged EXEC mode + + + +DLSwitch# copy running- Saves the configuration to NVRAM config startup-config +ALSwitch1 (2960) + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets host name hostname ALSwitch1 + + + +ALSwitch1(config)# no Turns off DNS queries so that spelling ip domain-lookup mistakes do not slow you down + + + +ALSwitch1(config)# vtp Changes the switch to VTP client mode mode client + + + +ALSwitch1(config)# vtp Configures the VTP domain name to domain testdomain testdomain + + + +ALSwitch1(config)# Moves to interface range configuration interface range mode +fastethernet 0/5 – 8 + + + +ALSwitch1(config-if- Sets ports 05 to 08 as access ports range)# switchport mode +access + + + +ALSwitch1(config-if- Assigns ports to VLAN 10 range)# switchport +access vlan 10 +ALSwitch1(config-if- Moves to global configuration mode range)# exit + + + +ALSwitch1(config)# Moves to interface range configuration interface range mode +fastethernet 0/9 – 12 + + + +ALSwitch1(config-if- Sets ports 09 to 12 as access ports range)# switchport mode +access + + + +ALSwitch1(config-if- Assigns ports to VLAN 20 range)# switchport +access vlan 20 + + + +ALSwitch1(config-if- Moves to global configuration mode range)# exit + + + +ALSwitch1(config)# Moves to interface range configuration interface range mode +gigabitethernet 0/1 – 2 + + + +ALSwitch1(config-if- Puts the interface into permanent + +range)# switchport mode +trunk + +trunking mode and negotiates to convert +the link into a trunk link + + + + +ALSwitch1(config-if- Creates channel group 1 and assigns range)# channel-group 1 interfaces 01 to 02 as part of it mode desirable + + + +ALSwitch1(config-if- Moves to global configuration mode +range)# exit + + + + +ALSwitch1(config)# exit Moves to privileged EXEC mode + + + +ALSwitch1# copy Saves the configuration to NVRAM running-config startup- +config + + + +ALSwitch2 (2960) + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets host name hostname ALSwitch2 + + + +ALSwitch2(config)# Turns off DNS queries so that spelling no ip domain- mistakes do not slow you down +lookup + + + +ALSwitch2(config)# Changes the switch to VTP client mode vtp mode client + + + +ALSwitch2(config)# Configures the VTP domain name to vtp domain testdomain +testdomain + + + +ALSwitch2(config)# Moves to interface range configuration mode +interface range fastethernet 0/5 – 8 + + + +ALSwitch2(config- Sets ports 05 to 08 as access ports if-range)# +switchport mode access + + +ALSwitch2(config- Assigns ports to VLAN 10 if-range)# +switchport access vlan 10 + + +ALSwitch2(config- Moves to global configuration mode if-range)# exit + + + +ALSwitch2(config)# Moves to interface range configuration mode interface range +fastethernet 0/9 – 12 + + + +ALSwitch2(config- Sets ports 09 to 12 as access ports if-range)# +switchport mode access + + +ALSwitch2(config- Assigns ports to VLAN 20 if-range)# +switchport access vlan 20 +ALSwitch2(config- Moves to global configuration mode if-range)# exit + + + + +ALSwitch2(config)# Moves to interface range configuration mode interface range +gigabitethernet 0/1 – 2 + + + + +ALSwitch2(config- +if-range)# + +Puts the interface into permanent trunking +mode and negotiates to convert the link into a + +switchport mode trunk link trunk + + + + +ALSwitch2(config- +if-range)# + +Creates channel group 2 and assigns interfaces +01 to 02 as part of it + +channel-group 2 mode desirable + +Note + + +Although the local channel group number does not have to match the channel group number on a neighboring switch, the numbers are often chosen to be the same for ease of management and documentation purposes + + + + + +ALSwitch2(config- Moves to global configuration mode if-range)# exit + + + +ALSwitch2(config)# Moves to privileged EXEC mode exit + + + +ALSwitch2# copy Saves the configuration to NVRAM +running-config startup-config +Chapter 2 + +Spanning Tree Protocol + + + + + +This chapter provides information and commands concerning the following topics: + + +Spanning Tree Protocol definition + +Enabling Spanning Tree Protocol + +Changing the spanning-tree mode + +Configuring the root switch + +Configuring a secondary root switch + +Configuring port priority + +Configuring the path cost + +Configuring the switch priority of a VLAN + +Configuring STP timers + +Configuring optional spanning-tree features + + +PortFast + +BPDU Guard (2xxx/older 3xxx series) + +BPDU Guard (3650/9xxx series) + +BPDU Filter + +UplinkFast + +BackboneFast +Root Guard + +Loop Guard + +Unidirectional link detection + + + +Configuring and verifying port error conditions + +Enabling Rapid Spanning Tree (RSTP) + +RSTP link types + +Enabling Multiple Spanning Tree (MST) + +Verifying the extended system ID + +Verifying STP + +Troubleshooting Spanning Tree Protocol + +Configuration example: PVST+ + +Spanning Tree migration example: PVST+ to Rapid PVST+ + + + +SPANNING TREE PROTOCOL DEFINITION + +The spanning-tree standards offer the same safety that routing protocols provide in Layer 3 forwarding environments to Layer 2 bridging environments. A single best path to a main bridge is found and maintained in the Layer 2 domain, and other redundant paths are managed by selective port blocking. Appropriate blocked ports begin forwarding when primary paths to the main bridge are no longer available. + +There are several different spanning-tree modes and protocols: + + +Per VLAN Spanning Tree (PVST+): This spanning-tree mode is based on the IEEE 802.1D standard and Cisco proprietary extensions. The PVST+ runs on each VLAN on the device up to the maximum +supported, ensuring that each has a loop-free path through the network. PVST+ provides Layer 2 load balancing for the VLAN on which it runs. You can create different logical topologies by using the VLANs on your network to ensure that all of your links are used but that no one link is oversubscribed. Each instance of PVST+ on a VLAN has a single root device. This root device propagates the spanning-tree information associated with that VLAN to all other devices in the network. Because each device has the same information about the network, this process ensures that the network topology is maintained. + +Rapid PVST+: This spanning-tree mode is the same as PVST+ except that it uses a rapid convergence based on the IEEE 802.1w standard. Beginning from Cisco IOS Release 15.2(4)E, the STP default mode is Rapid PVST+. To provide rapid convergence, Rapid PVST+ immediately deletes dynamically learned MAC address entries on a per-port basis upon receiving a topology change. By contrast, PVST+ uses a short aging time for dynamically learned MAC address entries. Rapid PVST+ uses the same configuration as PVST+ and the device needs only minimal extra configuration. The benefit of Rapid PVST+ is that you can migrate a large PVST+ install base to Rapid PVST+ without having to learn the complexities of the Multiple Spanning Tree Protocol (MSTP) configuration and without having to reprovision your network. In Rapid PVST+ mode, each VLAN runs its own spanning-tree instance up to the maximum supported. + +Multiple Spanning Tree Protocol (MSTP): This spanning-tree mode is based on the IEEE 802.1s standard. You can map multiple VLANs to the same spanning-tree instance, which reduces the number of spanning-tree instances required to support a large number of VLANs. MSTP runs on top of the Rapid Spanning Tree Protocol (RSTP) (based on IEEE 802.1w), which provides for rapid convergence of the spanning tree by eliminating the forward delay and by quickly transitioning root ports and designated ports to the forwarding state. In a device stack, the cross-stack rapid transition +(CSRT) feature performs the same function as RSTP. You cannot run MSTP without RSTP or CSRT. + + + + +Note +Default spanning-tree implementation for Catalyst 2950, 2960, 3550, 3560, and 3750 switches is PVST+. This is a per-VLAN implementation of 802.1D. Beginning from Cisco IOS Release 15.2(4)E, the STP default mode is Rapid PVST+ on all switch platforms. + + + +ENABLING SPANNING TREE PROTOCOL + + + +Switch(config)# spanning-tree vlan 5 Enables STP on VLAN 5 + + + +Switch(config)# no spanning-tree Disables STP on VLAN vlan 5 5 + + + + + +Note +Manyaccess switches such as the Catalyst 2960, 3550, 3560, 3650, 9200, and 9300 support a maximum 128 spanning trees using anycombination of PVST+ or Rapid PVST+. The 2950 model supports only64 instances. AnyVLANs created in excess of 128 spanning trees cannot have a spanning-tree instance running in them. There is a possibilityof an L2 loop that could not be broken in the case where a VLAN without spanning tree is transported across a trunk. It is recommended that you use MSTP if the number of VLANs in a common topologyis high. + + + + +Caution +Spanning tree is enabled bydefault on VLAN 1 and on all newlycreated VLANs up to the spanning-tree limit. Disable spanning tree onlyif you are sure there are no loops in the network topology. When spanning tree is disabled and loops are present in the topology, excessive traffic and indefinite packet duplication can drastically reduce network performance. Networks have been known to crash in seconds due to broadcast storms created byloops. + + + +CHANGING THE SPANNING-TREE MODE + +You can configure different types of spanning trees on a Cisco switch. The options vary according to the platform. +Switch(config)# Enables PVST+. This is the default setting spanning-tree +mode pvst + + + +Switch(config)# Enters MST mode spanning-tree +mode mst + + + + +Switch(config)# spanning-tree +mst +configuration + +Enters MST subconfiguration mode + + + + + +Note + + + +Use the command no spanning-tree mst configuration to clear the MST configuration + + + + + +Switch(config)# Enables Rapid PVST+ spanning-tree +mode rapid-pvst + + + +Switch# clear If any port on the device is connected to a port on a + +spanning-tree detected- +protocols + +legacy IEEE 802.1D device, this command restarts +the protocol migration process on the entire device + + +This step is optional if the designated device detects that this device is running Rapid PVST+ + + + +CONFIGURING THE ROOT SWITCH + + + +Switch(config)# Modifies the switch priority from the default +spanning-tree 32768 to a lower value to allow the switch to vlan 5 root become the primary root switch for VLAN 5 primary + + + +Note + + +This switch sets its priorityto 24576. If anyother switch has a priorityset to below 24576 already, this switch sets its own priority to 4096 less than the lowest switch priority. If bydoing this the switch has a priorityof less than 1, this command fails + + + + + + + +Switch(config)# +spanning-tree + +Configures the switch to become the root switch +for VLAN 5 + +vlan 5 root primary + +Note + + +The maximum switch topologywidth and the hello-time can be set within this command + + + + + + + + +Tip + + +The root switch should be a backbone or distribution switch + + + + + + + +Switch(config)# +spanning-tree + +Configures the switch to be the root switch for +VLAN 5 and sets the network diameter to 6 + +vlan 5 root primary diameter +6 +Tip + + +The diameter keyword defines the maximum number of switches +between anytwo end stations. The range is from 2 to 7 switches. The default value is 7 + + + + + + + + +Tip + + +The hello-time keyword sets the hello-interval timer to any amount between 1 and 10 seconds. The default time is 2 seconds + + + + + + + +CONFIGURING A SECONDARY ROOT SWITCH + + + +Switch(config)# Configures the switch to become the spanning-tree vlan 5 root switch for VLAN 5 should the root secondary primary root switch fail + + + + + +Note + + +This switch lowers its priorityto 28672. If the root switch fails and all other switches are set to the default priorityof 32768, this becomes the new root switch + + + + + +Switch(config)# Configures the switch to be the spanning-tree vlan 5 secondary root switch for VLAN 5 and root secondary diameter sets the network diameter to 7 +7 + + + +CONFIGURING PORT PRIORITY +Switch(config) Moves to interface configuration mode # interface +gigabitetherne t 1/0/1 + + + +Switch(config- Configures the port priority for the interface that is if)# spanning- an access port +tree port-priority 64 + + + +Switch(config- Configures the VLAN port priority for an interface if)# spanning- that is a trunk port +tree vlan 5 port-priority +64 +Note + + +If a loop occurs, spanning tree uses the port prioritywhen selecting an interface to put into the forwarding state. Assign a higher priorityvalue (lower numerical number) to interfaces you want selected first and a lower priorityvalue (higher numerical number) to interfaces you want selected last + + + + + + +The number can be between 0 and 240 in increments of 16. The default port priority is 128 + + + + + +Note +The port prioritysetting supersedes the physical port number in spanning-tree calculations. + + + +CONFIGURING THE PATH COST + + + +Switch(c Moves to interface configuration mode +onfig)# interfac e gigabite thernet 1/0/1 + + + + +Switch(c onfig-if)# spanning -tree cost 100000 + + + +Switch(c onfig-if)# spanning +-tree + +Configures the cost for the interface that is an access port. The range is 1 to 200000000; the default value is derived from the media speed of the interface + + + + + + + + + + +Configures the VLAN cost for an interface that is a trunk port. The VLAN number can be specified as a single VLAN ID number, a range of VLANs separated by a hyphen, or a series of VLANs separated by a comma. The range is 1 to 4094. For +the cost, the range is 1 to 200000000; the default value is + +vlan 5 derived from the media speed of the interface cost +1500000 + + +Note + + +If a loop occurs, STP uses the path cost when trying to determine which interface to place into the forwarding state. Ahigher path cost means a lower-speed transmission + + + + + + +CONFIGURING THE SWITCH PRIORITY OF A VLAN + + + +Switch(config)# spanning-tree Configures the switch priority +vlan 5 priority 12288 of VLAN 5 to 12288 + + + + + +Note +With the prioritykeyword, the range is 0 to 61440 in increments of 4096. The default is 32768. The lower the priority, the more likelythe switch will be chosen as the root switch. Onlythe following numbers can be used as priorityvalues: + + + + + +0 4096 + + + +16384 20480 + + + +32768 36864 + + + +49152 53248 + +8192 12288 + + + +24576 28672 + + + +40960 45056 + + + +57344 61440 + + + + + + +Caution +Cisco recommends caution when using this command. Cisco further recommends that the spanning-tree vlan x root primaryor the spanning-tree vlan x root secondarycommand be used instead to modifythe switch priority. + + + +CONFIGURING STP TIMERS + + + +Switch(config)# spanning- Changes the hello-delay timer to tree vlan 5 hello-time 4 4 seconds on VLAN 5 + + + +Switch(config)# spanning- Changes the forward-delay timer tree vlan 5 forward-time 20 to 20 seconds on VLAN 5 + + + +Switch(config)# spanning- Changes the maximum-aging tree vlan 5 max-age 25 timer to 25 seconds on VLAN 5 +Note +For the hello-time command, the range is 1 to 10 seconds. The default is 2 seconds. + +For the forward-time command, the range is 4 to 30 seconds. The default is 15 seconds. + + + + +For the max-age command, the range is 6 to 40 seconds. The default is 20 seconds. + +CONFIGURING OPTIONAL SPANNING-TREE FEATURES + +Although the following commands are not mandatory for STP to work, you might find these helpful to fine-tune your network. + +PortFast + + + +Note +Bydefault, PortFast is disabled on all interfaces. + + + + + +Switch(config)# interface gigabitethernet 1/0/10 + + + +Switch(config-if)# spanning-tree portfast + + + +Switch(config-if)# +spanning-tree + +Moves to interface configuration mode + + + + + + + + + +Enables PortFast if the port is already configured as an access port + + + + +Disables PortFast for the interface + +portfast disable +Switch(config-if)# +spanning-tree + +Enables the PortFast edge feature for the +interface + +portfast edge + + + +Switch(config-if)# Enables PortFast network for the interface spanning-tree +portfast network + + +Note + + +Use this command on trunk ports to enable the Bridge Assurance feature, which protects against loops by detecting unidirectional links in the spanning-tree topology + + + + + + + + +Note + + +Bridge Assurance is enabled globallybydefault + + + + + + +Switch(config-if)# Enables PortFast on a trunk port spanning-tree +portfast trunk + + +Caution + + +Use the PortFast command onlywhen connecting a single end station to an access or trunk port. Using this command on a port connected to a switch or hub might prevent spanning tree from detecting loops + + + + + + + + +Note + + +If you enable the voice VLAN feature, PortFast is enabled +automatically. If you disable voice VLAN, PortFast is still enabled + + + + + + + +Switch(config)# +spanning-tree + +Globally enables PortFast on all +switchports that are nontrunking + +portfast default + + + + +Note + + +You can override the spanning-tree portfast default global configuration command byusing the spanning-tree portfast disable interface configuration command + + + + + +Displays PortFast information on interface Switch# show GigabitEthernet 1/0/10 +spanning-tree interface gigabitethernet 1/0/10 portfast + + + +BPDU Guard (2xxx/older 3xxx Series) + + +Switch(config)# Globally enables BPDU Guard on ports spanning-tree portfast where portfast is enabled bpduguard default + + + +Switch(config)# Enters interface range configuration interface range mode +fastethernet 0/1 - 5 + + + +Switch(config-if- Enables PortFast on all interfaces in the +range)# spanning-tree range portfast + + + +Note + + +Best practice is to enable PortFast at the same time as BPDU Guard + + + + + + +Switch(config-if- Enables BPDU Guard on the interface range)# spanning-tree +bpduguard enable + + +Note + + +Bydefault, BPDU Guard is disabled + + + + + + +Switch(config-if)# Disables BPDU Guard on the interface spanning-tree +bpduguard disable + + + +Switch(config)# Allows port to reenable itself if the cause errdisable recovery of the error is BPDU Guard by setting a cause bpduguard recovery timer + + + +Switch(config)# Sets recovery timer to 400 seconds. The errdisable recovery default is 300 seconds. The range is from interval 400 30 to 86 400 seconds + + + +Switch# show spanning- Verifies whether BPDU Guard is enabled tree summary totals or disabled +Switch# show Displays errdisable recovery timer errdisable recovery information + + + + +BPDU Guard (3650/9xxx Series) + +You can enable the BPDU Guard feature if your switch is running PVST+, Rapid PVST+, or MSTP. + +The BPDU Guard feature can be globally enabled on the switch or can be enabled per port. + +When you enable BPDU Guard at the global level on PortFast-enabled ports, spanning tree shuts down ports that are in a PortFast-operational state if any BPDU is received on them. When you enable BPDU Guard at the interface level on any port without also enabling the PortFast feature, and the port receives a BPDU, it is put in the error-disabled state. + + +Switch(config)# spanning-tree Enables BPDU Guard portfast bpduguard default globally + + + + + +Note + + +Bydefault, BPDU Guard is disabled + + + + + + +Switch(config)# +gigabitethernet + + +interface +1/0/2 + +Enters into interface +configuration mode + + + + +Switch(config-if)# spanning-tree Enables the PortFast portfast edge edge feature +Switch(config-if)# end Returns to privileged EXEC mode + + + +BPDU Filter + + +Switch(config)# spanning- Globally enables BPDU filtering on tree portfast bpdufilter PortFast-enabled port; prevents ports default in PortFast from sending or receiving +BPDUs + + + +Switch(config)# interface Enters interface range configuration range gigabitethernet mode +1/0/1-4 + + + +Switch(config-if-range)# Enables PortFast on all interfaces in spanning-tree portfast the range + + + +Switch(config-if-range)# Enables PortFast on all interfaces in spanning-tree portfast the range +edge + + + + +Note + + +This is the command for the 3650/9300 series + + + + + + +Switch(config-if-range)# Enables BPDU Filter on all interfaces + +spanning-tree bpdufilter +enable + + +in the range configured with +“PortFast” +Note + + +Bydefault, BPDU filtering is disabled. Also, BPDU Guard has no effect on an interface if BPDU filtering is enabled + + + + + + + + +Caution + + +Enabling BPDU filtering on an interface, or globally, is the same as disabling STP, which can result in spanning-tree loops being created but not detected + + + + + +Switch# show spanning- Displays global BPDU filtering tree summary totals configuration information + + + +Switch# show spanning- Displays detailed spanning-tree tree interface interface status and configuration [interface-type, information of the specified interface interface-number] detail + + + +UplinkFast + + + +Switch(config)# spanning-tree uplinkfast + + + +Switch(config)# +spanning-tree + +Enables UplinkFast. UplinkFast provides fast convergence after a direct link failure + + + + +Enables UplinkFast and sets the update packet +rate to 200 packets/second + +uplinkfast max- +update-rate 200 +Note + + +UplinkFast cannot be set on an individual VLAN. The spanning-tree uplinkfast command affects all VLANs + + + + + + + + +Note + + +For the max-update-rate argument, the range is 0 to 32,000 packets/second. The default is 150. If you set the rate to 0, station-learning frames are not generated. This will cause STP to converge more slowlyafter a loss of connectivity + + + + + +Switch# show Verifies whether UplinkFast has been enabled spanning-tree +summary + + + +Switch# show Displays spanning-tree UplinkFast status, + +spanning-tree +uplinkfast + +which includes maximum update packet rate +and participating interfaces + + + + + + +Note +UplinkFast cannot be enabled on VLANs that have been configured for switch priority. + + + + + +Note +UplinkFast is most useful in access layer switches, or switches at the edge of the network. It is not appropriate for backbone devices. + + + + +Note +You can configure the UplinkFast feature for Rapid PVST+ or for the MSTP, but the feature remains disabled (inactive) until you change the spanning-tree mode to PVST+. +BackboneFast + + + +Switch(confi g)# spanning-tree +backbonefast + +Enables BackboneFast. BackboneFast is initiated when a root port or blocked port receives an inferior BPDU +from its designated bridge + + + + +Switch# show Verifies BackboneFast has been enabled spanning- +tree summary + + + +Switch# show Displays spanning-tree BackboneFast status, which + +spanning-tree +backbonefast + +includes the number of root link query protocol data units (PDUs) sent/received and number of +BackboneFast transitions + + + + + + +Note +You can configure the BackboneFast feature for Rapid PVST+ or for the MSTP, but the feature remains disabled (inactive) until you change the spanning-tree mode to PVST+. + + + + +Note +If you use BackboneFast, you must enable it on all switches in the network. + + + +Root Guard + +You can use Root Guard to limit which switch can become the root bridge. Root Guard should be enabled on all ports where the root bridge is not anticipated, such as access ports. + + +Switch(config) Moves to interface configuration mode # interface +gigabitetherne t 1/0/1 + + +Switch(config- Enables Root Guard on the interface if)# spanning- +tree guard root + + + +Switch# show Indicates whether any ports are in a root-spanning-tree inconsistent state +inconsistentpo rts + + + +Switch# show Displays the status and configuration of the root spanning-tree bridge +root + + + + +Note + + +The show spanning-tree root command output includes root ID for all VLANs, the associated root costs, timer settings, and root ports + + + + + +Switch# show Displays detailed spanning-tree state and spanning-tree configuration for each VLAN on the switch, +including bridge and root IDs, timers, root costs, and forwarding status + + + + + +Note +You cannot enable both Root Guard and Loop Guard at the same time. +Note +Root Guard enabled on an interface applies to all VLANs to which the interface belongs. + + + + + +Note +Do not enable Root Guard on interfaces to be used bythe UplinkFast feature. + + + +Loop Guard + +Loop Guard is used to prevent alternate or root ports from becoming designated ports due to a failure that leads to a unidirectional link. Loop Guard operates only on interfaces that are considered point to point by the spanning tree. Spanning tree determines a port to be point to point or shared from the port duplex setting. You can use Loop Guard to prevent alternate or root ports from becoming designated ports because of a failure that leads to a unidirectional link. This feature is most effective when it is enabled on the entire switched network. When Loop Guard is enabled, spanning tree does not send BPDUs on root or alternate ports. + + + +Note +Both the port duplexand the spanning-tree link type can be set manually. + + + + + +Note +You cannot enable both Loop Guard and Root Guard on the same port. The Loop Guard feature is most effective when it is configured on the entire switched network. + + + + +Switch# show Shows which ports are alternate or root ports spanning-tree +active +Switch# show Shows which ports are alternate or root ports spanning-tree mst when the switch is operating in MST mode + + + +Switch# configure Moves to global configuration mode terminal + + + + +Switch(config)# +spanning-tree + +Enables Loop Guard globally on the switch for +those interfaces that the spanning tree + +loopguard default identifies as point to point + + + + +Switch(config)# interface gigabitethernet 1/0/1 + + + +Switch(config-if)# + +Moves to interface configuration mode + + + + + + + + + +Enables Loop Guard on all the VLANs + +spanning-tree guard associated with the selected interface loop + + + +Switch(config-if)# Returns to privileged EXEC mode exit + + + +Switch# show Verifies whether Loop Guard has been spanning-tree enabled +summary + + + +Switch# show Display spanning-tree link type. A link type of spanning-tree “point to point” is required for Loop Guard interface detail + + + +Unidirectional Link Detection +Switch(config) Enables unidirectional link detection (UDLD) on all # udld enable fiber-optic interfaces to determine the Layer 1 status +of the link + + + + + +Note + + +Bydefault, UDLD is disabled + + + + + + +Switch(config) Enables UDLD aggressive mode on all fiber-optic # udld interfaces +aggressive + + + +Switch(config) Moves to interface configuration mode # interface +gigabitetherne t 1/0/1 + + + +Switch(config- Enables UDLD on this interface (required for if)# udld port copper-based interfaces) in normal or aggressive [aggressive] mode + + + + + +Note + + +On a fiber-optic (FO) interface, the interface command udld port overrides the global command udld enable. Therefore, if you issue the command no udld port on an FO interface, you will still have the globally enabled udld enable command to deal with + + + + + +Switch# show Displays UDLD information +udld + + + +Switch# show Displays UDLD information for interface Gigabit udld interface Ethernet 1/0/1 + + + +gigabitetherne t 1/0/1 + + + +Switch# udld Resets all interfaces shut down by UDLD reset + + + +Note + + +You can also use the shutdown command, followed bya no shutdown command in interface configuration mode, to restart a disabled interface + + + + + + +CONFIGURING AND VERIFYING PORT ERROR CONDITIONS + +A port is “error-disabled” when the switch detects any one of a number of port violations. No traffic is sent or received when the port is in error-disabled state. The show errdisable detect command displays a list for the possible error-disabled reasons and whether enabled. + +The errdisable detect cause command allows the network device administrator to enable or disable detection of individual error-disabled causes. All causes are enabled by default. All causes, except for per-VLAN error disabling, are configured to shut down the entire port. +The errdisable recovery command enables the network device administrator to configure automatic recovery mechanism variables. This would allow the switch port to again send and receive traffic after a configured period of time if the initial error condition is no longer present. All recovery mechanisms are disabled by default. + + +Switch(config)# Enables error detection for all error-errdisable detect disabled causes +cause all + + + +Switch(config)# Enables per-VLAN error-disable for BPDU errdisable detect Guard +cause bpduguard shutdown vlan + + + +Switch(config)# Enables error detection for DHCP snooping errdisable detect +cause dhcp-rate-limit + + + +Switch(config)# Enables error detection for Dynamic Trunk errdisable detect Protocol (DTP) flapping +cause dtp-flap + + + +Switch(config)# Enables error detection for invalid Gigabit errdisable detect Interface Converter (GBIC) module. cause gbic-invalid + + + +Note + + +You can also use the shutdown command, followed bya no shutdown command in interface configuration mode, to +restart a disabled interface. This error refers to an invalid small form-factor pluggable (SFP) module on the switch + + + + + +Switch(config)# Enables error detection for inline power errdisable detect +cause inline-power + + + +Switch(config)# Enables error detection for link-state errdisable detect flapping +cause link-flap + + + +Switch(config)# Enables error detection for detected errdisable detect loopbacks +cause loopback + + + +Switch(config)# Enables error detection for the Port errdisable detect Aggregation Protocol (PAgP) flap error-cause pagp-flap disabled cause + + + +Switch(config)# Enables voice-aware 802.1X security errdisable detect +cause security-violation shutdown vlan + + + +Switch(config)# Enables error detection on an SFP errdisable detect configuration mismatch +cause sfp-config-mismatch + + + +Switch(config)# Configures errdisable recovery timer to +errdisable recovery 3600 seconds interval 3600 + + + +Note + + +The same interval is applied to all causes. The range is 30 to 86,400 seconds. The default interval is 300 seconds + + + + + + +Switch(config)# Enables the error-disabled mechanism to errdisable recovery recover from specific cause parameter. cause parameter Parameters are shown below + + + +Switch(config)# Enables the timer to recover from all error-errdisable recovery disabled causes +cause all + + + +Switch(config)# Enables the timer to recover from BPDU errdisable recovery Guard error-disabled state +cause bpduguard + + + +Switch(config)# Enable the timer to recover from the errdisable recovery EtherChannel misconfiguration error-cause channel- disabled state +misconfig + + + +Switch(config)# Enables the timer to recover from the errdisable recovery DHCP snooping error-disabled state cause dhcp-rate- +limit + + + +Switch(config)# Enables the timer to recover from the DTP- +errdisable recovery flap error-disabled state cause dtp-flap + + + +Switch(config)# Enables the timer to recover from the GBIC errdisable recovery module error-disabled state +cause gbic-invalid + + + + +Note + + +This error refers to an invalid SFP error-disabled state + + + + + + +Switch(config)# Enables the timer to recover for inline errdisable recovery power +cause inline-power + + + +Switch(config)# Enables the timer to recover from the link-errdisable recovery flap error-disabled state +cause link-flap + + + +Switch(config)# Enables the timer to recover from a errdisable recovery loopback error-disabled state cause loopback + + + +Switch(config)# Enables the timer to recover from the errdisable recovery PAgP-flap error-disabled state +cause pagp-flap + + + +Switch(config)# Enables the timer to recover from a port errdisable recovery security violation disabled state +cause psecure-violation +Switch(config)# Enables the timer to recover from an IEEE errdisable recovery 802.1X-violation disabled state +cause security-violation + + + +Switch(config)# Enables the timer to recover from an SFP errdisable recovery configuration mismatch +cause sfp-mismatch + + + +Switch# show Displays error-disabled detection status errdisable detect + + + +Switch# show Display begins with the line that matches errdisable detect | the expression +begin expression + + + +Note + + +expression is the output to use as a reference point + + + + + + +Switch# show Display excludes lines that match the errdisable detect | expression + +exclude + + + +Switch# + +expression + + + +show Display includes lines that match the + +errdisable detect | expression + + +include + + + +Switch# + +expression + + + +show Displays the error-disabled recovery timer +errdisable recovery status information + + + +Switch# show Display begins with the line that matches errdisable recovery the expression +| begin expression + + + +Switch# show Display excludes lines that match the errdisable recovery expression +| exclude expression + + + +Switch# show Display includes lines that match the errdisable recovery expression +| include expression + + + +ENABLING RAPID SPANNING TREE + + + +Switch(config)# Enables Rapid PVST+ spanning-tree mode +rapid-pvst + + + +Switch# clear Restarts the protocol migration process. With + +spanning-tree +detected-protocols + +no arguments, the command is applied to +every port of the switch + + + + +Switch# clear Restarts the protocol migration process on spanning-tree interface GigabitEthernet 1/0/1 detected-protocols +interface gigabitethernet 1/0/1 +Switch# clear Restarts the protocol migration process on spanning-tree interface port-channel 1 +detected-protocols port-channel 1 + + + +Switch# show Displays mode, root and bridge IDs, spanning-tree participating ports, and their spanning-tree +states + + + +Switch# show Summarizes configured port states, including spanning-tree spanning-tree mode +summary + + + +Switch# show Displays a detailed summary of spanning-tree + +spanning-tree +detail + +interface information, including mode, priority, system ID, MAC address, timers, and role in the spanning tree for each VLAN and +port + + + + +RAPID SPANNING TREE LINK TYPES + +The link type in RSTP can predetermine the active role that the port plays as it stands by for immediate transition to a forwarding state, if certain parameters are met. These parameters are different for edge ports and non-edge ports. An edge port is a switch port that is never intended to be connected to another switch device. It immediately transitions to the forwarding state when enabled— similar to an STP port with the PortFast featured enabled. However, an edge port that receives a BPDU immediately loses its edge port status and becomes a normal spanning-tree port. Non-edge ports are ports that are intended to be connected to another +switch device. Link type is automatically determined but can be overwritten with an explicit port configuration. There are two different link types for non-edge ports, as shown in Table 2-1. + + +Link Description Type + + + +Point- A port operating in full-duplex mode. It is assumed that the port to- is connected to a single switch device at the other end of the link point + + + +Share A port operating in half-duplex mode. It is assumed that the port d is connected to shared media where multiple switches may exist + + + +TABLE 2-1 RSTP Non-Edge Link Types + + + +Switch(config)# Enables Rapid PVST+ + + + +spanning-tree mode rapid-pvst + + + +Switch(config)# Moves to interface configuration mode + + + +interface gigabitethernet 1/0/1 + + + +Switch(config-if)# Sets the link type based on the duplex setting of the interface + +spanning-tree link-type auto +Switch(config-if)# Specifies that the interface is a point-to-point link + +spanning-tree link-type point-to-point + + + +Switch(config-if)# Specifies that the interface is a shared medium + +spanning-tree link-type shared + + + +Switch(config-if)# Returns to global configuration mode + + + +exit + + + +ENABLING MULTIPLE SPANNING TREE + + + +Switch(config)# Enters MST mode spanning-tree mode +mst + + + +Switch(config)# Enters MST configuration submode spanning-tree mst +configuration + + + +Switch(config-mst)# Maps VLAN 4 to Multiple Spanning Tree instance 1 vlan 4 (MST) instance 1 + + + +Switch(config-mst)# Maps VLANs 1–15 to MST instance 1 instance 1 vlan 1- +15 + + + +Switch(config-mst)# Maps VLANs 10, 20, and 30 to MST instance 1 instance 1 vlan +10,20,30 + + +Note + + +For the instance x vlan ycommand, the instance must be a number between 1 and 15, and the VLAN range is 1 to 4094 + + + + + +Switch(config-mst)# Specifies the name for the MST region. The name region12 default is an empty string + + + + + +Note + + +The name argument can be up to 32 characters long and is case sensitive + + + + + +Switch(config-mst)# Specifies the revision number revision 4 + + + +Note + + +The range for the revision argument is 0 to 65,535 + + + + + + + + +Note + + +For two or more bridges to be in the same MST region, they must have the identical MST name, VLAN-to-instance +mapping, and MST revision number + + + + + + +Switch(config-mst)# Displays the summary of what is currently show current configured for the MST region + + + +Switch(config-mst)# Verifies the configuration by displaying a show pending summary of what you have configured for the +MST region + + + + +Switch(config-mst)# exit + + + +Switch(config)# + +Applies all changes and returns to global configuration mode + + + +Sets the bridge priority for the spanning tree + +spanning-tree mst 1 to 4096. The priority can be a number from priority 4096 0–61440 in increments of 4096 + + + + + +Caution + + +Changing spanning-tree modes can disrupt traffic because all spanning-tree instances are stopped for the old mode and restarted in the new mode + + + + + + + + +Note + + +You cannot run both MSTP and PVST at the same time + + + + + + +Switch(config)# Configures a switch as a primary root switch spanning-tree mst 1 within MST instance 1. The primary root +root primary switch priority is 24,576 + + + +Switch(config)# Configures a switch as a secondary root spanning-tree mst 1 switch within MST instance 1. The secondary root secondary root switch priority is 28,672 + + + +Switch(config-if)# Configures an interface with a port priority of spanning-tree mst 0 for MST instance 20 +20 port-priority 0 + + + + +Note + + +The priorityrange is 0 to 240 in increments of 16, where the lower the number, the higher the priority. The default is 128. The range and increment values are platform and IOS version dependent + + + + + +Switch(config-if)# Sets the path cost to 250 for MST instance 2 spanning-tree mst 2 calculations. Path cost is 1 to 200,000,000, cost 250 with higher values meaning higher costs + + + +Switch(config-if)# Returns to privileged EXEC mode end + + + +VERIFYING THE EXTENDED SYSTEM ID + + + +Switch# show Verifies that the extended system ID is enabled spanning-tree +summary + + + +Switch# show Displays the extended system ID as part of the +spanning-tree bridge ID bridge + + + +Note + + +The 12-bit extended system ID is the VLAN number for the instance of PVST+ and PVRST+ spanning tree. In MST, these 12 bits carrythe instance number + + + + + + +VERIFYING STP + + + + +Switch# show tree + + + +Switch# show + + +spanning- + + + + + +spanning- + +Displays STP information + + + + + +Displays STP information on active + +tree active interfaces only + + + +Switch# show spanning- Displays status and configuration of this tree bridge bridge + + + +Switch# show spanning- Displays a detailed summary of interface tree detail information + + + +Switch# show spanning- Displays STP information for interface tree interface gigabitethernet 1/0/1 gigabitethernet 1/0/1 + + + +Switch# show spanning- Displays a summary of port states tree summary +Switch# show spanning- Displays the total lines of the STP section tree summary totals + + + +Switch# show spanning- Displays STP information for VLAN 5 tree vlan 5 + + + +Switch# show spanning- Displays the MST region configuration tree mst configuration + + + +Switch# show spanning- Displays the message digest 5 (MD5) tree mst configuration authentication digest included in the digest current MST configuration identifier +(MSTCI) + + + +Switch# show spanning- Displays the MST information for tree mst 1 instance 1 + + + +Switch# show spanning- Displays the MST information for tree mst interface interface GigabitEthernet 1/0/1 gigabitethernet 1/0/1 + + + +Switch# show spanning- Displays the MST information for tree mst 1 interface instance 1 on interface GigabitEthernet gigabitethernet 1/0/1 1/0/1 + + + +Switch# show spanning- Shows detailed information about MST tree mst 1 detail instance 1 + + + +TROUBLESHOOTING SPANNING TREE PROTOCOL +Switch# debug spanning- Displays all spanning-tree tree all debugging events + + + +Switch# debug spanning- Displays spanning-tree debugging tree events topology events + + + +Switch# debug spanning- Displays spanning-tree debugging tree backbonefast BackboneFast events + + + +Switch# debug spanning- Displays spanning-tree debugging tree uplinkfast UplinkFast events + + + +Switch# debug spanning- Displays all MST debugging events tree mstp all + + + +Switch# debug spanning- Displays spanning-tree port state tree switch state changes + + + +Switch# debug spanning- Displays PVST+ events tree pvst+ + + + +CONFIGURATION EXAMPLE: PVST+ + +Figure 2-1 shows the network topology for the configuration of PVST+ using commands covered in this chapter. Assume that other commands needed for connectivity have already been configured. For example, all inter-switch links in this topology are configured as 802.1Q trunks. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 2-1 Network Topology for STP Configuration Example + + + +Core Switch (3650) + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets the host name hostname Core + + + + +Core(config)# no ip +domain-lookup + +Turns off Domain Name System (DNS) +queries so that spelling mistakes do not +slow you down + + + +Core(config)# vtp Changes the switch to VTP server mode. mode server This is the default mode + + + +Core(config)# vtp Configures the VTP domain name to domain STPDEMO STPDEMO + + + +Core(config)# vlan 10 Creates VLAN 10 and enters VLAN configuration mode + + + +Core(config-vlan)# Assigns a name to the VLAN name Accounting + + + +Core(config-vlan)# Returns to global configuration mode exit + + + +Core(config)# vlan 20 Creates VLAN 20 and enters VLAN configuration mode + + + +Core(config-vlan)# Assigns a name to the VLAN name Marketing + + + + +Core(config-vlan)# exit + + + +Core(config)# + +Returns to global configuration mode + + + + + +Configures the switch to become the root + +spanning-tree vlan 1 switch for VLAN 1 root primary + + + +Returns to privileged EXEC mode +Core(config)# exit + + + +Core# copy running- Saves the configuration to NVRAM config startup-config + + + +Distribution 1 Switch (3650) + + +Switch> enable Moves to privileged EXEC mode + + + +Switch# configure terminal Moves to global configuration mode + + + +Switch(config)# hostname Sets the host name Distribution1 + + + + +Distribution1(config)# no ip +domain-lookup + +Turns off DNS queries so that spelling mistakes do not slow you +down + + + + +Distribution1(config)# vtp Configures the VTP domain name domain STPDEMO to STPDEMO + + + +Distribution1(config)# vtp Changes the switch to VTP client mode client mode + + + +Distribution1(config)# Configures the switch to become spanning-tree vlan 10 root the root switch of VLAN 10 primary + + + +Distribution1(config)# Configures the switch to become +spanning-tree vlan 10 root +secondary + + +the secondary root switch of +VLAN 20 + + + + +Distribution1(config)# exit Returns to privileged EXEC mode + + + +Distribution1# copy running- Saves the configuration to config startup-config NVRAM + + + +Distribution 2 Switch (3650) + + +Switch>enable Moves to privileged EXEC mode + + + +Switch# configure terminal Moves to global configuration mode + + + +Switch(config)# hostname Sets the host name Distribution2 + + + + +Distribution2(config)# no ip +domain-lookup + +Turns off DNS queries so that spelling mistakes do not slow you +down + + + + +Distribution2(config)# vtp Configures the VTP domain name domain STPDEMO to STPDEMO + + + +Distribution2(config)# vtp Changes the switch to VTP client mode client mode + + + +Distribution2(config)# Configures the switch to become spanning-tree vlan 20 root the root switch of VLAN 20 +primary + + + +Distribution2(config)# Configures the switch to become + +spanning-tree vlan 10 root +secondary + + +the secondary root switch of +VLAN 10 + + + + +Distribution2(config)# exit Returns to privileged EXEC mode + + + +Distribution2# copy running- Saves the configuration to config startup-config NVRAM + + + +Access 1 Switch (2960) + + +Switch> enable Moves to privileged EXEC mode + + + +Switch# configure terminal Moves to global configuration mode + + + +Switch(config)# hostname Sets the host name Access1 + + + + +Access1(config)# no ip +domain-lookup + +Turns off DNS queries so that spelling mistakes do not slow you +down + + + + + +Access1(config)# STPDEMO + + + +Access1(config)# +client + + +vtp domain + + + + + +vtp mode + +Configures the VTP domain name to STPDEMO + + + +Changes the switch to VTP client +mode +Access1(config)# interface Moves to interface range range fastethernet 0/6 - 12 configuration mode + + + +Access1(config-if-range)# Places all interfaces in switchport switchport mode access access mode + + + +Access1(config-if-range)# Assigns all interfaces to VLAN 10 switchport access vlan 10 + + + +Access1(config-if-range)# Places all ports directly into spanning-tree portfast forwarding mode + + + +Access1(config-if-range)# Enables BPDU Guard spanning-tree bpduguard +enable + + + + +Access1(config-if-range)# +end + +Moves back to privileged EXEC +mode + + + + +Access1# copy running- Saves the configuration to config startup-config NVRAM + + + +Access 2 Switch (2960) + + +Switch> enable Moves to privileged EXEC mode + + + +Switch# configure terminal Moves to global configuration mode + + + +Switch(config)# hostname Sets the host name +Access2 + + + + +Access2(config)# no ip +domain-lookup + +Turns off DNS queries so that spelling mistakes do not slow you +down + + + + + +Access2(config)# STPDEMO + + + +Access2(config)# +client + + +vtp domain + + + + + +vtp mode + +Configures the VTP domain name to STPDEMO + + + +Changes the switch to VTP client +mode + + + + +Access2(config)# interface Moves to interface range range fastethernet 0/6 - 12 configuration mode + + + +Access2(config-if-range)# Places all interfaces in switchport switchport mode access access mode + + + +Access2(config-if-range)# Assigns all interfaces to VLAN 20 switchport access vlan 20 + + + +Access2(config-if-range)# Places all ports directly into spanning-tree portfast forwarding mode + + + +Access2(config-if-range)# Enables BPDU Guard spanning-tree bpduguard +enable + + + + +Access2(config-if-range)# +exit + +Moves back to global +configuration mode +Access2(config)# spanning- Ensures this switch does not tree vlan 1,10,20 priority become the root switch for VLAN 61440 10 + + + + +Access2(config)# exit Returns to privileged EXEC mode + + + +Access2# copy running-config Saves config to NVRAM startup-config + + + +SPANNING-TREE MIGRATION EXAMPLE: PVST+ TO RAPID-PVST+ + +The topology in Figure 2-1 is used for this migration example and adds to the configuration of the previous example. + +Rapid-PVST+ uses the same BPDU format as 802.1D. This interoperability between the two spanning-tree protocols enables a longer conversion time in large networks without disrupting services. + +The spanning-tree features UplinkFast and BackboneFast in 802.1D-based PVST+ are already incorporated in the 802.1w-based Rapid-PVST+ and are disabled when you enable Rapid-PVST+. The 802.1D-based features of PVST+ such as PortFast, BPDU Guard, BPDU Filter, Root Guard, and Loop Guard are applicable in Rapid-PVST+ mode and need not be changed. + +Access 1 Switch (2960) + + +Access1> enable Moves to privileged EXEC mode + + + +Access1# configure terminal Moves to global configuration +mode + + + +Access1 (config)# spanning- Enables 802.1w-based Rapid-tree mode rapid-pvst PVST+ + + + +Access1(config)# no spanning- Removes UplinkFast +tree uplinkfast programming line if it exists + + + +Access1(config)# no spanning- Removes BackboneFast tree backbonefast programming line if it exists + + + +Access 2 Switch (2960) + + +Access2> enable Moves to privileged EXEC mode + + + +Access2# configure terminal Moves to global configuration mode + + + +Access2(config)# spanning-tree Enables 802.1w-based mode rapid-pvst Rapid-PVST+ + + + +Distribution 1 Switch (3650) + + +Distribution1> enable Moves to privileged EXEC mode + + + +Distribution1# configure terminal Moves to global configuration mode +Distribution1(config)# spanning- Enables 802.1w-based tree mode rapid-pvst Rapid-PVST+ + + + +Distribution 2 Switch (3650) + + +Distribution2> enable Moves to privileged EXEC mode + + + +Distribution2# configure terminal Moves to global configuration mode + + + +Distribution2(config)# spanning- Enables 802.1w-based tree mode rapid-pvst Rapid-PVST+ + + + +Core Switch (3650) + + +Core> enable Moves to privileged EXEC mode + + + +Core# configure terminal Moves to global configuration mode + + + + +Core(config)# spanning-tree mode +rapid-pvst + +Enables 802.1w-based +Rapid-PVST+ +Chapter 3 + +Implementing Inter-VLAN Routing + + + + + +This chapter provides information and commands concerning the following topics: + + +Inter-VLAN communication using an external router: router-on-a-stick + +Inter-VLAN communication tips + +Inter-VLAN communication on a multilayer switch through an SVI + + +Configuring inter-VLAN communication on an L3 switch + + + +Removing L2 switchport capability of an interface on an L3 switch + +Configuration example: inter-VLAN communication + +Configuration example: IPv6 inter-VLAN communication + + + +INTER-VLAN COMMUNICATION USING AN EXTERNAL ROUTER: ROUTER-ON-A-STICK + + + +Router(config)# Moves to interface configuration mode interface +fastethernet 0/0 + + + +Router(config-if)# no Enables the interface shutdown +Router(config-if)# +interface + +Creates subinterface 0/0.1 and moves to +subinterface configuration mode + +fastethernet 0/0.1 + + + + +Router(config-subif)# +description + +(Optional) Sets the locally significant +description of the subinterface + +Management VLAN 1 + + + + +Note + + +Best practices dictate that VLAN 1 should not be used for management or native traffic. Also, consider using separate VLANs for management and native traffic + + + + + +Router(config-subif)# Assigns VLAN 1 to this subinterface. VLAN + +encapsulation dot1q 1 +native + + +1 will be the native VLAN. This subinterface +uses the 802.1q tagging protocol + + + + +Router(config-subif)# Assigns the IP address and netmask ip address +192.168.1.1 255.255.255.0 + + + + +Router(config-subif)# +interface + +Creates subinterface 0/0.10 and moves to +subinterface configuration mode + +fastethernet 0/0.10 + + + + +Router(config-subif)# +description + +(Optional) Sets the locally significant +description of the subinterface + +Accounting VLAN 10 +Router(config-subif)# Assigns VLAN 10 to this subinterface. This + +encapsulation dot1q +10 + + +subinterface uses the 802.1q tagging +protocol + + + + +Router(config-subif)# Assigns the IP address and netmask ip address +192.168.10.1 255.255.255.0 + + + +Router(config-subif)# Returns to interface configuration mode end + + + + + +Note +Because the VLAN networks are directlyconnected to the router, routing between these networks does not require a dynamic routing protocol. However, if the router is configured with a dynamic routing protocol, then these networks should be advertised or redistributed to other routers. + + + + +Note +Routes to the networks associated with these VLANs appear in the routing table as directlyconnected networks. + + + + +Note +In production environments, VLAN 1 should not be used as the management VLAN because it poses a potential securityrisk; all ports are in VLAN 1 bydefault, and it is an easymistake to add a nonmanagement user to the management VLAN. + + + + +Note +Instead of creating a subinterface for the native VLAN (VLAN 1 in the preceding example), it is possible to use the physical interface for native (untagged) traffic. In other words, the physical interface (FastEthernet0/0) would get IP address 192.168.1.1 255.255.255 and it would handle all VLAN 1 native untagged traffic. You would still create a subinterface for VLAN 10 as previouslydescribed. + + + +INTER-VLAN COMMUNICATION TIPS +Although most older routers (routers running IOS 12.2 and earlier) support both ISL and dot1q, some switch models support only dot1q, such as the 2960, 2960-x, 3650, and 9200 series. Check with the version of IOS you are using to determine whether ISL or dot1q is supported. + + +ISL will probably not be an option, as it has been deprecated for quite some time. + +If you need to use ISL as your trunking protocol, use the command encapsulation isl x, where x is the number of the VLAN to be assigned to that subinterface. + + + +Recommended best practice is to use the same number as the VLAN number for the subinterface number. It is easier to troubleshoot VLAN 10 on subinterface fa0/0.10 than on fa0/0.2. + + +INTER-VLAN COMMUNICATION ON A MULTILAYER SWITCH THROUGH A SWITCH VIRTUAL INTERFACE + + + + +Note +Rather than using an external router to provide inter-VLAN communication, a multilayer switch can perform the same task through the use of a switched virtual interface (SVI). + + + +Configuring Inter-VLAN Communication on an L3 Switch + + +Switch9300(config)# Creates a virtual interface for VLAN interface vlan 1 1 and enters interface configuration +mode + + + +Switch9300(config-if)# ip Assigns an IP address and netmask address 172.16.1.1 +255.255.255.0 +Switch9300(config-if)# no Enables the interface shutdown + + + +Switch9300(config)# Creates a virtual interface for VLAN interface vlan 10 10 and enters interface +configuration mode + + + +Switch9300(config-if)# ip Assigns an IP address and netmask address 172.16.10.1 +255.255.255.0 + + + +Switch9300(config-if)# no Enables the interface shutdown + + + +Switch9300(config)# Creates a virtual interface for VLAN interface vlan 20 20 and enters interface +configuration mode + + + +Switch9300(config-if)# ip Assigns an IP address and netmask address 172.16.20.1 +255.255.255.0 + + + +Switch9300(config-if)# no Enables the interface shutdown + + + + +Switch9300(config-if)# +exit + +Returns to global configuration +mode + + + + +Switch9300(config)# ip Enables routing on the switch routing +Note +For an SVI to go to up/up and be added to the routing table, the VLAN for the SVI must be created, an IP address must be assigned, and at least one interface must support it (trunk or access). + + + +Removing L2 Switchport Capability of an Interface on an L3 Switch + + +Switch9300(config)# Moves to interface configuration interface gigabitethernet mode +0/1 + + + +Switch9300(config-if)# no Creates a Layer 3 port on the switch switchport + + + +Note + + +You can use the no switchport command on physical ports onlyon a Layer 3-capable switch + + + + + + +CONFIGURATION EXAMPLE: INTER-VLAN COMMUNICATION + +Figure 3-1 illustrates the network topology for the configuration that follows, which shows how to configure inter-VLAN communication using commands covered in this chapter. Some commands used in this configuration are from other chapters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 3-1 Network Topology for Inter-VLAN Communication Configuration + + +ISP Router + + +Router> enable Moves to privileged EXEC mode + + + +Router># configure terminal Moves to global configuration mode + + + +Router(config)# hostname ISP Sets the host name + + + +ISP(config)# interface Moves to interface +loopback 0 configuration mode + + + +ISP(config-if)# description Sets the locally significant simulated address interface description representing remote website + + + +ISP(config-if)# ip address Assigns an IP address and 198.133.219.1 255.255.255.0 netmask + + + +ISP(config-if)# interface Moves to interface serial 0/0/0 configuration mode + + + +ISP(config-if)# description Sets the locally significant WAN link to the Corporate interface description Router + + + +ISP(config-if)# ip address Assigns an IP address and 192.31.7.5 255.255.255.252 netmask + + + + +ISP(config-if)# clock rate +4000000 + +Assigns a clock rate to the interface; DCE cable is plugged +into this interface + + + + +ISP(config-if)# no shutdown Enables the interface + + + +ISP(config-if)# exit Returns to global configuration mode + + + + +ISP(config-if)# router eigrp +10 + +Creates Enhanced Interior Gateway Routing Protocol +(EIGRP) routing process 10 +ISP(config-router)# network Advertises directly connected 198.133.219.0 0.0.0.255 networks + + + +ISP(config-router)# network Advertises directly connected 192.31.7.0 0.0.0.255 networks + + + +ISP(config-router)# end Returns to privileged EXEC mode + + + +ISP# copy running-config Saves the configuration to startup-config NVRAM + + + +CORP Router + + +Router> enable Moves to privileged EXEC mode + + + +Router># configure Moves to global configuration mode terminal + + + +Router(config)# Sets the host name hostname CORP + + + + +CORP(config)# no ip +domain-lookup + +Turns off Domain Name System (DNS) resolution to avoid wait time due to +DNS lookup of spelling errors + + + + +CORP(config)# interface Moves to interface configuration mode serial 0/0/0 +CORP(config-if)# Sets the locally significant interface description link to ISP description + + + +CORP(config-if)# ip Assigns an IP address and netmask address 192.31.7.6 +255.255.255.252 + + + +CORP(config-if)# no Enables the interface shutdown + + + +CORP(config)# interface Moves to interface configuration mode fastethernet 0/1 + + + +CORP(config-if)# Sets the locally significant interface description link to description +L3Switch1 + + + +CORP(config-if)# ip Assigns an IP address and netmask address 172.31.1.5 +255.255.255.252 + + + + +CORP(config-if)# no shutdown + + + +CORP(config-if)# exit + +Enables the interface + + + + + +Returns to global configuration mode + + + + +CORP(config)# interface Enters interface configuration mode fastethernet 0/0 + + + +CORP(config-if)# no Enables the interface shutdown +CORP(config-if)# Creates a virtual subinterface and + +interface fastethernet +0/0.1 + + +moves to subinterface configuration +mode + + + + +CORP(config-subif)# Sets the locally significant interface description Management description +VLAN 1 - Native VLAN + + + +CORP(config-subif)# Assigns VLAN 1 to this subinterface. + +encapsulation dot1q 1 +native + + +VLAN 1 is the native VLAN. This +subinterface uses the 802.1q protocol + + + + +CORP(config-subif)# ip Assigns an IP address and netmask address 192.168.1.1 +255.255.255.0 + + + +CORP(config-subif)# Creates a virtual subinterface and + +interface fastethernet +0/0.10 + + +moves to subinterface configuration +mode + + + + +CORP(config-subif)# Sets the locally significant interface description Sales VLAN description +10 + + + +CORP(config-subif)# Assigns VLAN 10 to this subinterface. encapsulation dot1q 10 This subinterface uses the 802.1q +protocol + + + +CORP(config-subif)# ip Assigns an IP address and netmask address 192.168.10.1 +255.255.255.0 + + + +CORP(config-subif)# Creates a virtual subinterface and + +interface fastethernet +0/0.20 + + +moves to subinterface configuration +mode + + + + +CORP(config-subif)# Sets the locally significant interface description Engineering description +VLAN 20 + + + +CORP(config-subif)# Assigns VLAN 20 to this subinterface. encapsulation dot1q 20 This subinterface uses the 802.1q +protocol + + + +CORP(config-subif)# ip Assigns an IP address and netmask address 192.168.20.1 +255.255.255.0 + + + +CORP(config-subif)# Creates a virtual subinterface and + +interface fastethernet +0/0.30 + + +moves to subinterface configuration +mode + + + + +CORP(config-subif)# Sets the locally significant interface description Marketing description +VLAN 30 + + + +CORP(config-subif)# Assigns VLAN 30 to this subinterface. encapsulation dot1q 30 This subinterface uses the 802.1q +protocol + + + +CORP(config-subif)# ip Assigns an IP address and netmask +add 192.168.30.1 255.255.255.0 + + +CORP(config-subif)# Returns to global configuration mode exit + + + +CORP(config)# router Creates EIGRP routing process 10 and eigrp 10 moves to router configuration mode + + + +CORP(config-router)# Advertises the 192.168.1.0 network network 192.168.1.0 +0.0.0.255 + + + +CORP(config-router)# Advertises the 192.168.10.0 network network 192.168.10.0 +0.0.0.255 + + + +CORP(config-router)# Advertises the 192.168.20.0 network network 192.168.20.0 +0.0.0.255 + + + +CORP(config-router)# Advertises the 192.168.30.0 network network 192.168.30.0 +0.0.0.255 + + + +CORP(config-router)# Advertises the 172.31.0.0 network network 172.31.0.0 +0.0.255.255 + + + +CORP(config-router)# Advertises the 192.31.7.0 network network 192.31.7.0 +0.0.0.3 + + + +CORP(config-router)# Returns to privileged EXEC mode end + + + + +CORP# copy running- Saves the configuration in NVRAM config startup-config + + + +L2Switch2 (Catalyst 2960) + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets the host name hostname L2Switch2 + + + +L2Switch2(config)# Turns off DNS resolution no ip domain-lookup + + + +L2Switch2(config)# Creates VLAN 10 and enters VLAN vlan 10 configuration mode + + + +L2Switch2(config- Assigns a name to the VLAN vlan)# name Sales + + + +L2Switch2(config- Returns to global configuration mode vlan)# exit +L2Switch2(config)# Creates VLAN 20 and enters VLAN vlan 20 configuration mode + + + +L2Switch2(config- Assigns a name to the VLAN vlan)# name +Engineering + + + +L2Switch2(config- Creates VLAN 30 and enters VLAN vlan)# vlan 30 configuration mode. Note that you do not +have to exit back to global configuration mode to execute this command + + + +L2Switch2(config- Assigns a name to the VLAN vlan)# name +Marketing + + + +L2Switch2(config- Returns to global configuration mode vlan)# exit + + + +L2Switch2(config)# Enters interface range configuration mode interface range and allows you to set the same configuration + +fastethernet 0/2 - +4 + + +parameters on multiple ports at the same +time + + + + +L2Switch2(config- Sets ports 2–4 as access ports if-range)# +switchport mode access + + +L2Switch2(config- Assigns ports 2–4 to VLAN 10 if-range)# +switchport access vlan 10 + + + + +L2Switch2(config- +if-range)# + +Enters interface range configuration mode +and allows you to set the same configuration + +interface range parameters on multiple ports at the same fastethernet 0/5 - time +8 + + + +L2Switch2(config- Sets ports 5–8 as access ports if-range)# +switchport mode access + + +L2Switch2(config- Assigns ports 5–8 to VLAN 20 if-range)# +switchport access vlan 20 + + + +L2Switch2(config- +if-range)# + +Enters interface range configuration mode +and allows you to set the same configuration + +interface range parameters on multiple ports at the same fastethernet 0/9 - time +12 + + + +L2Switch2(config- Sets ports 9–12 as access ports if-range)# +switchport mode access + + +L2Switch2(config- Assigns ports 9–12 to VLAN 30 if-range)# +switchport access vlan 30 + + + +L2Switch2(config- Returns to global configuration mode if-range)# exit + + + +L2Switch2(config)# Moves to interface configuration mode interface +fastethernet 0/1 + + + +L2Switch2(config)# Sets the locally significant interface description Trunk description +Link to CORP Router + + + +L2Switch2(config- Puts the interface into trunking mode and + +if)# switchport +mode trunk + +negotiates to convert the link into a trunk +link + + + + +L2Switch2(config- Returns to global configuration mode if)# exit + + + +L2Switch2(config)# Creates a virtual interface for VLAN 1 and interface vlan 1 enters interface configuration mode + + + +L2Switch2(config- Assigns an IP address and netmask if)# ip address +192.168.1.2 255.255.255.0 + + + +L2Switch2(config- Enables the interface if)# no shutdown +L2Switch2(config- Returns to global configuration mode if)# exit + + + + +L2Switch2(config)# Assigns a default gateway address ip default-gateway +192.168.1.1 + + + +L2Switch2(config)# Returns to privileged EXEC mode exit + + + +L2Switch2# copy Saves the configuration in NVRAM running-config +startup-config + + + +L3Switch1 (Catalyst 3650) + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets the host name hostname L3Switch1 + + + +L3Switch1(config)# no Turns off DNS queries so that spelling ip domain-lookup mistakes do not slow you down + + + +L3Switch1(config)# vtp Changes the switch to VTP server mode mode server +L3Switch1(config)# vtp Configures the VTP domain name to domain testdomain testdomain + + + +L3Switch1(config)# Creates VLAN 10 and enters VLAN vlan 10 configuration mode + + + +L3Switch1(config- Assigns a name to the VLAN vlan)# name Accounting + + + +L3Switch1(config- Returns to global configuration mode vlan)# exit + + + +L3Switch1(config)# Creates VLAN 20 and enters VLAN vlan 20 configuration mode + + + +L3Switch1(config- Assigns a name to the VLAN vlan)# name Marketing + + + +L3Switch1(config- Returns to global configuration mode vlan)# exit + + + +L3Switch1(config)# Moves to interface configuration mode interface +gigabitethernet 1/0/1 + + + +L3Switch1(config-if)# Specifies 802.1Q tagging on the trunk switchport trunk link (only necessary on older model encapsulation dot1q switches like the 3560 and 3750) + + + +L3Switch1(config-if)# Puts the interface into trunking mode +switchport mode trunk and negotiates to convert the link into a trunk link + + +L3Switch1(config-if)# Returns to global configuration mode exit + + + +L3Switch1(config)# ip Enables IP routing on this device routing + + + +L3Switch1(config)# Creates a virtual interface for VLAN 1 and interface vlan 1 enters interface configuration mode + + + +L3Switch1(config-if)# Assigns an IP address and netmask ip address 172.16.1.1 +255.255.255.0 + + + +L3Switch1(config-if)# Enables the interface no shutdown + + + +L3Switch1(config-if)# Creates a virtual interface for VLAN 10 interface vlan 10 and enters interface configuration mode + + + +L3Switch1(config-if)# Assigns an IP address and mask ip address 172.16.10.1 +255.255.255.0 + + + +L3Switch1(config-if)# Enables the interface no shutdown + + + +L3Switch1(config-if)# Creates a virtual interface for VLAN 20 interface vlan 20 and enters interface configuration mode +L3Switch1(config-if)# Assigns an IP address and mask ip address 172.16.20.1 +255.255.255.0 + + + +L3Switch1(config-if)# Enables the interface no shutdown + + + + +L3Switch1(config-if)# exit + + + +L3Switch1(config)# +interface + +Returns to global configuration mode + + + + + +Enters interface configuration mode + +gigabitethernet 1/0/24 + + + +L3Switch1(config-if)# Creates a Layer 3 port on the switch no switchport + + + +L3Switch1(config-if)# Assigns an IP address and netmask ip address 172.31.1.6 +255.255.255.252 + + + + +L3Switch1(config-if)# exit + + + +L3Switch1(config)# + +Returns to global configuration mode + + + + + +Creates EIGRP routing process 10 and + +router eigrp 10 moves to router configuration mode + + + +L3Switch1(config- Advertises the 172.16.0.0 network router)# network +172.16.0.0 0.0.255.255 +L3Switch1(config- Advertises the 172.31.0.0 network router)# network +172.31.0.0 0.0.255.255 + + + +L3Switch1(config- Applies changes and returns to privileged router)# end EXEC mode + + + +L3Switch1# copy Saves configuration in NVRAM running-config +startup-config + + + +L2Switch1 (Catalyst 2960) + + + +Switch> + + + +Switch# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Switch(config)# Sets the host name hostname L2Switch1 + + + +L2Switch1(config)# Turns off DNS queries so that spelling no ip domain-lookup mistakes do not slow you down + + + +L2Switch1(config)# Configures the VTP domain name to vtp domain testdomain +testdomain + + + +L2Switch1(config)# Changes the switch to VTP client mode vtp mode client +L2Switch1(config)# Enters interface range configuration mode interface range and allows you to set the same fastethernet 0/1 - 4 configuration parameters on multiple ports +at the same time + + + +L2Switch1(config-if- Sets ports 1–4 as access ports range)# switchport +mode access + + + +L2Switch1(config-if- Assigns ports 1–4 to VLAN 10 range)# switchport +access vlan 10 + + + +L2Switch1(config-if- Enters interface range configuration mode range)# interface and allows you to set the same +range fastethernet configuration parameters on multiple ports 0/5 - 8 at the same time + + + +L2Switch1(config-if- Sets ports 5–8 as access ports range)# switchport +mode access + + + +L2Switch1(config-if- Assigns ports 5–8 to VLAN 20 range)# switchport +access vlan 20 + + + +L2Switch1(config-if- Returns to global configuration mode range)# exit + + + +L2Switch1(config)# Moves to interface configuration mode interface +gigabitethernet 0/1 + + + +L2Switch1(config- Puts the interface into trunking mode and if)# switchport mode negotiates to convert the link into a trunk + +trunk + + + +L2Switch1(config- + +link + + + +Returns to global configuration mode + +if)# exit + + + +L2Switch1(config)# Creates a virtual interface for VLAN 1 and interface vlan 1 enters interface configuration mode + + + +L2Switch1(config- Assigns an IP address and netmask if)# ip address +172.16.1.2 255.255.255.0 + + + +L2Switch1(config- Enables the interface if)# no shutdown + + + +L2Switch1(config- Returns to global configuration mode if)# exit + + + +L2Switch1(config)# Assigns the default gateway address ip default-gateway +172.16.1.1 + + + +L2Switch1(config)# Returns to privileged EXEC mode exit + + + +L2Switch1# copy Saves the configuration in NVRAM +running-config startup-config + + + +CONFIGURATION EXAMPLE: IPV6 INTER-VLAN COMMUNICATION + +Figure 3-2 shows the network topology for the configuration that follows, which demonstrates how to configure IPv6 inter-VLAN communication using commands covered in this chapter. Some commands used in this configuration are from previous chapters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 3-2 Network Topology for IPv6 Inter-VLAN Communication Configuration +Note +This configuration uses traditional OSPFv3 for routing. For more information on OSPFv3, see Chapter 5, “OSPF.” + + + +ISP Router + + +Router(config)# hostname Sets the hostname ISP + + + +ISP(config)# ipv6 Enables IPv6 routing unicast-routing + + + +ISP(config)# interface Enters interface configuration mode loopback 0 + + + +ISP(config-if)# ipv6 Assigns an IPv6 address address +2001:db8:0:a::1/64 + + + +ISP(config-if)# Enters interface configuration mode interface serial 0/0/0 + + + +ISP(config-if)# clock Assigns a clock rate to the interface; rate 4000000 DCE cable is plugged into this interface + + + +ISP(config-if)# ipv6 Assigns an IPv6 address address +2001:db8:0:8::1/64 + + + +ISP(config-if)# no Turns on this interface shutdown +ISP(config-if)# exit Exits into global configuration mode + + + +ISP(config)# ipv6 route Creates a default static route to return ::/0 serial 0/0/0 traffic from the Internet + + + + + +Note + + +Adynamic routing protocol can also be used here + + + + + + +ISP(config)# end Returns to privileged EXEC mode + + + +CORP Router + + +Router(config)# hostname Sets the hostname CORP + + + +CORP(config)# ipv6 Enables global IPv6 forwarding unicast-routing + + + +CORP(config)# ipv6 Enters OSPFv3 programming mode router ospf 1 + + + +CORP(config-rtr)# Assigns a router ID for the OSPFv3 router-id 192.168.1.1 process + + + +CORP(config-rtr)# Adds any default routing information default- information to the OSPFv3 updates +originate +CORP(config-rtr)# exit Exits to global configuration mode + + + +CORP(config)# interface Enters subinterface programming gigabitethernet 0/0.1 mode + + + +CORP(config-subif)# Assigns 802.1Q as the trunking + +encapsulation dot1q 1 +native + + +protocol and associates VLAN 1 to this +subinterface + + + + + +CORP(config-subif)# ipv6 address 2001:db8:0:2::1/64 + + + +CORP(config-subif)# ipv6 + +Assigns an IPv6 address + + + + + + + +Specifies this as an interface that will + +ospf 1 area 0 participate in OSPFv3 + + + + +CORP(config-subif)# +interface + +Enters subinterface programming +mode + +gigabitethernet 0/0.30 + + + +CORP(config-subif)# Assigns 802.1Q as the trunking encapsulation dot1q 30 protocol and associates VLAN 30 to +this subinterface + + + + +CORP(config-subif)# ipv6 address 2001:db8:0:30::1/64 + + + +CORP(config-subif)# ipv6 + +Assigns an IPv6 address + + + + + + + +Specifies this as an interface that will + +ospf 1 area 0 participate in OSPFv3 +CORP(config-subif)# +interface + +Enters subinterface programming +mode + +gigabitethernet 0/0.40 + + + +CORP(config-subif)# Assigns 802.1Q as the trunking encapsulation dot1q 40 protocol and associates VLAN 40 to +this subinterface + + + + +CORP(config-subif)# ipv6 address 2001:db8:0:40::1/64 + + + +CORP(config-subif)# ipv6 + +Assigns an IPv6 address + + + + + + + +Specifies this as an interface that will + +ospf 1 area 0 participate in OSPFv3 + + + + +CORP(config-subif)# +interface + +Enters subinterface programming +mode + +gigabitethernet 0/0.50 + + + +CORP(config-subif)# Assigns 802.1Q as the trunking encapsulation dot1q 50 protocol and associates VLAN 50 to +this subinterface + + + + +CORP(config-subif)# ipv6 address 2001:db8:0:50::1/64 + + + +CORP(config-subif)# ipv6 + +Assigns an IPv6 address + + + + + + + +Specifies this as an interface that will + +ospf 1 area 0 participate in OSPFv3 + + + +CORP(config-subif)# Enters interface programming mode +interface gigabitethernet 0/1 + + + +CORP(config-if)# ipv6 Assigns an IPv6 address address +2001:db8:0:7::2/64 + + + +CORP(config-if)# ipv6 Specifies this as an interface that will ospf 1 area 0 participate in OSPFv3 + + + +CORP(config-if)# Enters interface programming mode interface +gigabitethernet 0/0 + + + +CORP(config-if)# no Turns this interface on shutdown + + + +CORP(config-if)# Enters interface programming mode interface serial 0/0/0 + + + +CORP(config-if)# ipv6 Assigns an IPv6 address address +2001:db8:0:8::2/64 + + + + +CORP(config-if)# no shutdown + + + +CORP(config-if)# exit + +Turns this interface on + + + + + +Exits to global configuration +programming mode + + + + +CORP(config)# ipv6 route Creates a default static route pointing +::/0 serial 0/0/0 to the ISP + + + + +CORP(config)# end Returns to privileged EXEC mode + + + +L2Switch2 (Catalyst 2960) + + +Switch(config)# Sets the hostname hostname L2Switch2 + + + +L2Switch2(config)# Configures the Switching Database Manager sdm prefer dual- (SDM) on the switch to optimize memory and + +ipv4-and-ipv6 +default + + +operating system for both IPv4 and IPv6 +Layer 3 forwarding + + + + + + +Note + + +If this is a change in the SDMsettings, the switch must be reloaded for this change to take effect + + + + + +L2Switch2(config)# Creates VLANs 30, 40, and 50 vlan 30,40,50 + + + +L2Switch2(config- Exits VLAN configuration mode vlan)# exit + + + + +L2Switch2(config)# +interface + +Enters switchport interface configuration +mode + +fastethernet 0/5 +L2Switch2(config- Sets this port to trunk unconditionally if)# switchport +mode trunk + + + +L2Sw2(config-if)# Enters switchport configuration mode for a interface range range of switch ports +fastethernet 0/12 -14 + + + +L2Switch2(config- Sets these ports to be access ports if-range)# +switchport mode access + + +L2Switch2(config- Assigns these ports to VLAN 30 if-range)# +switchport access vlan 30 + + + +L2Switch2(config- +if-range)# + +Enters switchport configuration mode for a +range of switch ports + +interface range fastethernet 0/15 -18 + + + +L2Switch2(config- Sets these ports to be access ports if-range)# +switchport mode access + + +L2Switch2(config- Assigns these ports to VLAN 20 if-range)# +switchport access vlan 40 + + + + +L2Switch2(config- +if-range)# + +Enters switchport configuration mode for a +range of switchports + +interface range fastethernet 0/19 -22 + + + +L2Switch2(config- Sets these ports to be access ports if-range)# +switchport mode access + + +L2Switch2(config- Assigns these ports to VLAN 50 if-range)# +switchport access vlan 50 + + + +L2Switch2(config- +if-range)# + +Enters interface configuration mode for the +management VLAN + +interface vlan1 + + + +L2Switch2(config- Assigns an IPv6 address if)# ipv6 address +2001:db8:0:2::/64 + + + +L2Switch2(config- Turns this interface on if)# no shutdown + + + +L2Switch2(config- Exits to global configuration mode +if)# exit + + + +L2Switch2(config)# Assigns a default gateway ipv6 route ::/0 +2001:db8:0:2::1 + + + +L2Switch2(config)# Returns to privileged EXEC mode end + + + +L3Switch1 (Catalyst 3650) + + +Switch(config)# hostname Sets the hostname L3Switch1 + + + +L3Switch1(config)# ipv6 Enables IPv6 forwarding unicast-routing + + + +L3Switch1(config)# vlan 10,20 Creates VLANs 10 and 20 + + + +L3Switch1(config-vlan)# exit Exits VLAN configuration mode + + + +L3Switch1(config)# interface Enters interface configuration gigabitethernet 1/0/1 mode + + + +L3Switch1(config-if)# Sets this port to trunk switchport mode trunk unconditionally + + + +L3Switch1(config-if)# ipv6 Enters OSPFv3 configuration router ospf 1 mode +L3Switch1(config-rtr)# Assigns the OSPFv3 router ID router-id 192.168.1.2 + + + +L3Switch1(config-rtr)# exit Exits to global configuration mode + + + +L3Switch1(config)# interface Enters switchport interface gigabitethernet 1/0/24 configuration mode + + + + +L3Switch1(config-if)# no switchport + + + +L3Switch1(config-if)# ipv6 + +Changes this Layer 2 switch port to a Layer 3 routed port + + + +Assigns an IPv6 address + +address 2001:db8:0:7::1/64 + + + +L3Switch1(config-if)# ipv6 Specifies this as an interface ospf 1 area 0 that will participate in OSPFv3 + + + +L3Switch1(config-if)# Enters interface configuration interface vlan1 mode for VLAN 1 + + + +L3Switch1(config-if)# ipv6 Assigns an IPv6 address address 2001:db8:0:1::1/64 + + + +L3Switch1(config-if)# ipv6 Specifies this as an interface ospf 1 area 0 that will participate in OSPFv3 + + + +L3Switch1(config-if)# Enters interface configuration interface vlan10 mode for VLAN 10 +L3Switch1(config-if)# ipv6 Assigns an IPv6 address address 2001:db8:0:10::1/64 + + + +L3Switch1(config-if)# ipv6 Specifies this as an interface ospf 1 area 0 that will participate in OSPFv3 + + + +L3Switch1(config-if)# Enters interface configuration interface vlan20 mode for VLAN 20 + + + +L3Switch1(config-if)# ipv6 Assigns an IPv6 address address 2001:db8:0:20::1/64 + + + +L3Switch1(config-if)# ipv6 Specifies this as an interface ospf 1 area 0 that will participate in OSPFv3 + + + +L3Switch1(config-if)# end Returns to privileged EXEC mode + + + +L2Switch1 (Catalyst 2960) + + +Switch(config)# Sets the hostname hostname L2Switch1 + + + +L2Switch1(config)# Configures the Switching Database Manager sdm prefer dual- on the switch to optimize memory and + +ipv4-and-ipv6 default + + + +L2Switch1(config)# + + +operating system for both IPv4 and IPv6 Layer 3 forwarding + + + +Creates VLANs 10 and 20 + +vlan 10,20 +L2Switch1(config- Exits VLAN configuration mode vlan)# exit + + + + +L2Switch1(config)# +interface + +Enters switchport interface configuration +mode + +gigabitethernet 0/1 + + + +L2Switch1(config- Sets this port to trunk unconditionally if)# switchport mode +trunk + + + +L2Switch1(config- Enters switchport configuration mode for a if)# interface range range of switch ports +fastethernet 0/12 -14 + + + +L2Switch1(config-if- Sets these ports to be access ports range)# switchport +mode access + + + +L2Switch1(config-if- Assigns these ports to VLAN 10 range)# switchport +access vlan 10 + + + +L2Switch1(config-if- Enters switchport configuration mode for a range)# interface range of switch ports +range fastethernet 0/15 - 18 + + + +L2Switch1(config-if- Sets these ports to be access ports range)# switchport +mode access + + + +L2Switch1(config-if- Assigns these ports to VLAN 20 range)# switchport +access vlan 20 + + + +L2Switch1(config-if- Moves to interface configuration mode range)# interface +vlan1 + + + +L2Switch1(config- Assigns an IPv6 address if)# ipv6 address +2001:0:0:4::2/64 + + + +L2Switch1(config- Returns to global configuration mode if)# exit + + + +L2Switch1(config)# Assigns a default gateway ipv6 route ::/0 +2001:db8:0:1::1 + + + +L2Switch1(config)# Returns to privileged EXEC mode end +Part II: Layer 3 Infrastructure +Chapter 4 EIGRP + + + + +This chapter provides information and commands concerning the following topics: + + +Enhanced Interior Gateway Routing Protocol (EIGRP) + +Enabling EIGRP for IPv4 using classic mode configuration + +Enabling EIGRP for IPv6 using classic mode configuration + +EIGRP using named mode configuration + +EIGRP named mode subconfiguration modes + +Upgrading classic mode to named mode configuration + +EIGRP router ID + +Authentication for EIGRP + + +Configuring authentication in classic mode + +Configuring authentication in named mode + +Verifying and troubleshooting EIGRP authentication + + + +Auto-summarization for EIGRP + +IPv4 manual summarization for EIGRP + +IPv6 manual summarization for EIGRP + +Timers for EIGRP + +Passive interfaces for EIGRP +“Pseudo” passive EIGRP interfaces + +Injecting a default route into EIGRP + + +Redistribution of a static route + +IP default network + +Summarize to 0.0.0.0/0 + + + +Accepting exterior routing information: default-information + +Equal-cost load balancing: maximum-paths + +Unequal-cost load balancing: variance + +EIGRP Traffic Sharing + +Bandwidth use for EIGRP + +Stub routing for EIGRP + +EIGRP unicast neighbors + +EIGRP Wide Metrics + +Adjusting the EIGRP metric weights + +Verifying EIGRP + +Troubleshooting EIGRP + +Configuration example: EIGRP for IPv4 and IPv6 using named mode + + + +ENHANCED INTERIOR GATEWAY ROUTING PROTOCOL (EIGRP) + +The Enhanced Interior Gateway Routing Protocol (EIGRP) is an enhanced version of the Interior Gateway Routing Protocol (IGRP) developed by Cisco. The convergence properties and the operating efficiency of EIGRP have improved substantially over IGRP, and +IGRP is now obsolete. + + +The convergence technology of EIGRP is based on an algorithm called the Diffusing Update Algorithm (DUAL). The algorithm guarantees loop-free operation at every instant throughout a route computation and allows all devices involved in a topology change to synchronize. Devices that are not affected by topology changes are not involved in recomputations. + +ENABLING EIGRP FOR IPV4 USING CLASSIC MODE CONFIGURATION + +Classic mode is the original way of configuring EIGRP. In classic mode, EIGRP configurations are scattered across the router and the interface configuration modes. + + + +Router( config) # router eigrp 100 + + + + + + + +Router( config-router) # network 10.0.0. +0 + +Turns on the EIGRP process. 100 is the autonomous system (AS) number, which can be a number between 1 and 65,535 + + + + + +Note + + +All routers must use the same AS number to communicate with each other + + + + + + +Specifies which network to advertise in EIGRP +Router( config-router) # network 10.0.0. 0 0.255.2 55.255 + + + +Router( config-if)# +bandwid + +Identifies which interfaces or networks to include in EIGRP. Interfaces must be configured with addresses that fall within the wildcard mask range of the network statement. It is possible to enter a subnet mask instead of a wildcard mask; Cisco IOS is intelligent enough to recognize the difference and correct the error for you. The running configuration will only display wildcard masks + + + + + + +Sets the bandwidth of this interface to 256 kilobits to allow EIGRP to make a better metric calculation. Value ranges from +1–10 000 000 + +th 256 + + +Note + + +This command is entered at the interface command prompt (config-if) and not at the router process prompt (config-router). The setting can differ for each interface to which it is applied + + + + + + + + +Tip + + +The bandwidth command is used for metric calculations only. It does not change interface performance + + + + + +Router( Changes which neighbors will be displayed config- +router) # eigrp log- +neighbo r-changes + + + + +Router( config- +router) + +Configures the logging intervals of EIGRP neighbor warning +messages to 300 seconds. The default is 10 seconds + +# eigrp log-neighbo r-warning s 300 + + + +Router( Removes the network from the EIGRP process config- +router) # no + + + +network 10.0.0. 0 0.255.2 55.255 + + + + +Router( +config) + +Disables routing process 100 and removes the entire EIGRP +configuration from the running configuration + +# no router eigrp 100 +Tip +There is no limit to the number of network statements (that is, network commands) that you can configure on a router. + + + + +Tip +The use of a wildcard mask or network mask is optional. Wildcard masks should be used when advertising subnetted networks. + + + + +Tip +If you do not use the wildcard mask, the EIGRP process assumes that all directlyconnected networks that are part of the overall major network will participate in the EIGRP process and that EIGRP will attempt to establish neighbor relationships from each interface that is part of that Class A, B, or C major network. + + + + +Tip +If you use the network 172.16.1.0 0.0.0.255 command with a wildcard mask, the command specifies that only interfaces on the 172.16.1.0/24 subnet will participate in EIGRP. EIGRP automaticallysummarizes routes on the major network boundarywhen in a discontiguous IP address network topologywhen the auto-summary command is enabled. + + + + +Tip +Since Cisco IOS Software Release 15.0, EIGRP no longer automaticallysummarizes networks at the classful boundarybydefault. + + + +ENABLING EIGRP FOR IPV6 USING CLASSIC MODE CONFIGURATION + +No linkage exists between EIGRP for IPv4 and EIGRP for IPv6; the two are configured and managed separately. However, the commands for configuration of EIGRP for IPv4 and IPv6 using classic mode are similar, making the transition easy. + + +Router(config)# Enables the forwarding of IPv6 unicast datagrams ipv6 unicast- globally on the router. This command is required +routing before any IPv6 routing protocol can be configured +Router(config)# interface +gigabitethernet 0/0/0 + + + +Router(config- + +Moves to interface configuration mode + + + + + + + + + +Enables EIGRP for IPv6 on the interface and + +if)# ipv6 eigrp creates the IPv6 EIGRP process 100 + + + +Router(config- Enters router configuration mode and creates an if)# ipv6 EIGRP IPv6 routing process if it does not already router eigrp exist +100 + + + +Router(config)# Creates the EIGRP IPv6 process and enters router ipv6 router configuration mode +eigrp 100 + + + +Router(config- Enables the use of a fixed router ID rtr)# eigrp +router-id 10.1.1.1 + + + +Router(config- Enables the EIGRP routing process. This is only rtr)# no necessary on older routing platforms shutdown + + + +Note + + +It is possible to temporarilydisable the EIGRP process using the shutdown command +Note +The eigrp router-id w.x.y.z command is typicallyused when an IPv4 address is not defined on the router or when manual defining is desired. + + + +EIGRP USING NAMED MODE CONFIGURATION + +Named mode is the new way of configuring EIGRP; this mode allows EIGRP configurations to be entered in a hierarchical manner under the router configuration mode. Each named mode configuration can have multiple address families and autonomous system number combinations. The two most commonly used address families are IPv4 unicast and IPv6 unicast. Multicast for both IPv4 and IPv6 is also supported. The default address families for both IPv4 and IPv6 are unicast. + + +Router(config)# router Creates a named EIGRP virtual instance eigrp TEST called TEST + + + + + +Note + + +The name of the virtual instance is locallysignificant only + + + + + + + + +Note + + +The name does not need to match between neighbor routers +Note + + +This command defines a single EIGRP instance that can be used for all address families. At least one address familymust be defined + + + + + +Router(config-router)# Enables the IPv4 address family and address-family ipv4 starts EIGRP autonomous system 1. By autonomous-system 1 default, this is a unicast address family + + + +Router(config-router- Enables EIGRP for IPv4 on interfaces in af)# network the 172.16.10.0 network +172.16.10.0 0.0.0.255 + + + +Router(config-router- Enables EIGRP for IPv4 on all IPv4 af)# network 0.0.0.0 enabled interfaces + + + + + +Note + + +In address familyconfiguration mode, you can define other general parameters for EIGRP, such as router-id or eigrp stub + + + + + +Router(config-router- Moves the router into address family af)# af-interface interface configuration mode for gigabitethernet 0/0/0 interface GigabitEthernet 0/0/0 + + + +Router(config-router- Configures a summary aggregate af-interface)# summary- address +address 192.168.10.0/23 +Router(config)# router Creates a named EIGRP virtual instance eigrp TEST called TEST + + + +Router(config-router)# Enables the IPv6 address family and address-family ipv6 starts EIGRP autonomous system 1. By autonomous-system 1 default, this is a unicast address family + + + + + +Note + + +All IPv6 enabled interfaces are automaticallyincluded in the EIGRP process + + + + + +Router(config-router- Moves the router into address family af)# af-interface interface configuration mode for all + +default + + + +Router(config-router- + +interfaces + + + +Configures all IPv6 interfaces as passive + +af-interface)# passive- for EIGRP interface + + + +Router(config-router- Returns the router to address family af-interface)# exit configuration mode + + + + + +Note + + +The complete command is exit-af-interface, but the more commonlyused shortcut of exit is presented here +Router(config-router- Moves the router into address family af)# af-interface interface configuration mode for gigabitethernet 0/0/0 interface GigabitEthernet 0/0/0 + + + +Router(config-router- Removes the passive interface af-interface)# no configuration from this interface passive- interface + + + +EIGRP NAMED MODE SUBCONFIGURATION MODES + +EIGRP using named mode configuration gathers all EIGRP options and parameters under specific subconfiguration modes: + + + +Mode + + + +Address family configuration mode + + + +Router(config- +router-af)# + +Commands Used in This Mode + + + +General configuration commands: + + + +eigrp router-id + + + +eigrp stub + + + + +metric weights + + + +network + + + +Address family interface Interface-specific configuration commands: configuration mode + +authentication key-chain Router(config- +router- af- authentication mode +interface)# +bandwidth-percent + + + +hello-interval + + + +hold-time + + + +passive-interface + + + +summary-address + + + + +Address family topology configuration mode + + + +Router(config- + +Configuration commands that affect the topology table: + + + +maximum-paths + +router- af- +topology)# redistribute + + + +variance + + + +traffic-share + + + + + +Note + + +From address familyconfiguration mode, enter the topology base command to access topologyconfiguration mode + + + + + + +UPGRADING CLASSIC MODE TO NAMED MODE +CONFIGURATION + +The eigrp upgrade-cli command allows you to upgrade from classic mode to named mode without causing network or neighbor flaps or requiring the EIGRP process to restart. After conversion, the running configuration on the device will show only named mode configurations; you will be unable to see any classic mode configurations. This command is available only under EIGRP classic router configuration mode. You must use the eigrp upgrade-cli command for every classic router configuration in order to ensure that this configuration is upgraded to named mode. Therefore, if multiple classic configurations exist, you must use this command per autonomous system number. The new configurations will be present only in the running configuration; they will not be automatically saved to the startup configuration. + + +Router(config- Upgrades EIGRP configuration from classic router)# eigrp mode to named mode. EIGRP virtual instance upgrade-cli TEST is now named TEST + + + + + +Note +The eigrp upgrade-cli command allows you to convert onlyclassic mode configurations to named mode and not vice versa. To revert to classic mode configurations, you can reload the router without saving the running configurations. + + + +EIGRP ROUTER ID + + + +Router(con Enters EIGRP router configuration mode for AS 100 fig)# +router eigrp 100 +Router(con fig-router)# eigrp router-id 172.16.3.3 + + + +Router(con fig- +router)# + +Manually sets the router ID to 172.16.3.3. Can be any IPv4 address except 0.0.0.0 and 255.255.255.255. If not set, the router ID will be the highest IP address of any loopback interfaces. If no loopback interfaces are configured, the router ID will be the highest IP address of your active local interface + + + +Removes the static router ID from the configuration + +no eigrp router-id 172.16.3.3 + + + +Router(con Creates a named EIGRP virtual instance called TEST fig)# +router eigrp TEST + + + +Router(con fig-router)# address-family ipv4 +autonomous + +Enables the IPv4 address family and starts EIGRP +autonomous system 1 + +-system 1 + + + +Router(con Manually sets the router ID to 172.16.3.3 fig- +router-af)# eigrp router-id +172.16.3.3 + + + + + +Note +There is no IPv6 form of the router ID. Even if a router is using IPv6 exclusively, the router ID will still be in the format of an IPv4 address. + + + +AUTHENTICATION FOR EIGRP + +Authentication for routers using EIGRP relies on the use of predefined passwords. + + + +Note +EIGRP for IPv4 and EIGRP for IPv6 use the same commands for authentication. + + + +Configuring Authentication in Classic Mode + + + +Router(config)# key chain +romeo + +Identifies a key chain. The name must match the name configured in interface +configuration mode + + + + +Router(config-keychain)# key 1 Identifies the key number + + + + + +Note + + +The range of keys is from 0 to 2 147 483 647. The keyidentification numbers do not need to be consecutive. There must be at least one keydefined on a keychain +Router(config-keychain-key)# Identifies the key string key-string shakespeare + + + +Note + + +The string can contain from 1 to 80 uppercase and lowercase alphanumeric characters, except that the first character cannot be a number + + + + + +Router(config-keychain-key)# (Optional) Specifies the period accept-lifetime [local] start- during which the key can be time {infinite | end-time | received +duration seconds} + +local keyword specifies time in local time zone + + + + + +Note + + +After the time is entered, you have the option to add the specific day/month/year to this command + + + + + + + + +Note + + +The default start time and the earliest acceptable date is January1, 1993. The default end time is an infinite time period +Router(config-keychain-key)# (Optional) Specifies the period send-lifetime [local] start- during which the key can be time {infinite | end-time | sent +duration seconds} + +local keyword specifies time in local time zone + + + + + +Note + + +After the time is entered, you have the option to add the specific day/month/year to this command + + + + + + + + +Note + + +The default start time and the earliest acceptable date is January1, 1993. The default end time is an infinite period + + + + + + +Router(config)# +gigabitethernet + + +interface +0/0/0 + +Enters interface configuration +mode + + + + +Router(config-if)# ip Enables message digest 5 + +authentication mode eigrp 100 +md5 + +(MD5) authentication in EIGRP packets over the +interface + + + + +Router(config-if)# ip Enables authentication of authentication key-chain eigrp EIGRP packets using romeo +100 romeo as the key chain + + + +Router(config-if)# exit Returns to global configuration mode + + + + + +Note +For the start time and the end time to have relevance, ensure that the router knows the correct time. Recommended practice dictates that you run NTP or some other time-synchronization method if you intend to set lifetimes on keys. + + + +Configuring Authentication in Named Mode + + + +Note +EIGRP support for SHAwas introduced in Cisco IOS 15 together with EIGRP using named mode configuration. + + + + + +Note +Both MD5 and SHAcan be used in either IPv4 or IPv6. Not all permutations are shown in the following example. + + + + +Router(config)# router Creates a named EIGRP virtual eigrp TEST instance called TEST + + + +Router(config-router)# Enables the IPv4 address family and address-family ipv4 starts EIGRP AS 1 +autonomous-system 1 + + + +Router(config-router- Moves the router into address family af)# af-interface interface configuration mode for gigabitethernet 0/0/0 interface GigabitEthernet 0/0/0 + + + +Router(config-router-af- Identifies a key chain +interface)# authentication key-chain romeo + + + + +Router(config-router- +af-interface)# + +Enables message digest 5 (MD5) +authentication in EIGRP packets over + +authentication mode md5 the interface + + + + +Router(config-router-af- +interface)# + +Enables Hashed Message +Authentication Code (HMAC)-Secure + + + +authentication mode +hmac-sha-256 + + +Hash Algorithm (SHA-256) authentication in EIGRP packets over +the interface + + + + +Router(config-router-af- Exits from address family interface interface)# exit-af- configuration mode +interface + + + +Router(config-router- Exits address family configuration af)# exit-address-family mode + + + +Router(config-router)# Enables the IPv6 address family and address-family ipv6 starts EIGRP AS 1 +autonomous-system 1 + + + +Router(config-router- Moves the router into address family af)# af-interface interface configuration mode for gigabitethernet 0/0/0 interface GigabitEthernet 0/0/0 + + + +Router(config-router-af- Identifies a key chain interface)# +authentication key-chain romeo + + + +Router(config-router-af- +interface)# + +Enables HMAC-SHA-256 +authentication in EIGRP packets over + +authentication mode the interface hmac-sha-256 0 password1 + +7 – Indicates there is an explicit password encryption. A 0 indicates that there is no password encryption. 0 is the default + + + +The password string used is password1. The string can contain 1 to 32 characters, including white spaces; however, the first character cannot be a number + + + +Router(config-router-af- Exits from address family interface interface)# exit-af- configuration mode +interface + + + +Router(config-router- Exits address family configuration af)# exit-address-family mode + + + + +Router(config-router)# +exit + +Exits routing protocol configuration +mode + + + + +Router(config)# key Identifies a key chain. Name must chain romeo match the name configured in interface +configuration mode +Router(config-keychain)# Identifies the key number key 1 + + + +Router(config-keychain- Identifies the key string key)# key-string +shakespeare + + + +Router(config-keychain- (Optional) Specifies the period during key)# accept-lifetime which the key can be received +start-time {infinite | end-time | duration seconds} + + +Router(config-keychain- (Optional) Specifies the period during key)# send-lifetime which the key can be sent +start-time {infinite | end-time | duration seconds} + + + +Verifying and Troubleshooting EIGRP Authentication + + +Router# show Displays EIGRP neighbor table. Incorrect +ip eigrp authentication configuration will prevent neighbor neighbor relationships from forming + + + +Router# show Displays EIGRP IPv6 neighbor table. Incorrect ipv6 eigrp authentication configuration will prevent neighbor neighbor relationships from forming + + + +Router# show Displays key chains created on the router key chain +Router# debug Displays output about EIGRP packets. Incorrect key eigrp packet string configuration will cause failures, which will be +shown in this output + + + +AUTO-SUMMARIZATION FOR EIGRP + + + +Router(config- Enables auto-summarization for the EIGRP router)# auto- process +summary + + + + +Note + + +The behavior of the auto-summarycommand is disabled bydefault for Cisco IOS Software Release 15 and later. Earlier software generally has automatic summarization enabled bydefault + + + + + +Router(config- Disables the auto-summarization feature router)# no +auto-summary + + + +IPV4 MANUAL SUMMARIZATION FOR EIGRP + + + + +Router(config)# interface gigabitethernet 0/0/0 + + + +Router(config-if)# + +Enters interface configuration mode + + + + + + + + + +Enables manual summarization for EIGRP AS + +ip summary-address 100 (classic mode) on this specific interface for +eigrp 100 the given address and mask. An administrative + +10.10.0.0 +255.255.0.0 75 + + +distance of 75 is assigned to this summary +route + + + + + + +Note + + +The administrative-distance argument is optional in this command. Without it, an administrative distance of 5 is automaticallyapplied to the summaryroute + + + + + + + +Router(config-router-af-interface)# summary-address 192.168.0.0 +255.255.0.0 + +Enables manual summarization for EIGRP +using named mode configuration + + + + +IPV6 MANUAL SUMMARIZATION FOR EIGRP + + + +Router(config)# interface Moves to interface configuration serial 0/0/0 mode + + + +Router(config-if)# ipv6 Configures a summary address summary-address eigrp 100 for a specified interface using 2001:db8:0:1::/64 classic mode + + + +There is an optional administrative distance parameter for this command +This command behaves similarly to the ip summary-address eigrp command + + + +Router(config-router-af- Enables manual summarization interface)# summary-address for EIGRP using named mode 2001:db8::/48 configuration + + + +TIMERS FOR EIGRP + + + +Router(config)# Moves to interface configuration mode interface serial 0/1/0 + + + +Router(config-if)# ip Configures the EIGRP hello time hello-interval eigrp 100 interval for AS 100 to 10 seconds 10 + + + +Router(config-if)# ip Configures the EIGRP hold timer hold-time eigrp 100 30 interval for AS 100 to 30 seconds + + + + + +Note + + +Hold time should be set to three times the hello interval + + + + + +Router(config-if)# ipv6 Configures the hello interval for + +hello-interval eigrp 100 +10 + +EIGRP for IPv6 process 100 to be 10 +seconds +Router(config-if)# ipv6 Configures the hold timer for EIGRP hold-time eigrp 100 30 for IPv6 process 100 to be 30 seconds + + + +Router(config-router-af- Configures a hello interval of 3 seconds interface)# hello- for EIGRP using named mode interval 3 configuration + + + +Router(config-router-af- Configures a hold time of 9 seconds for interface)# hold-time 9 EIGRP using named mode +configuration + + + + + +Note +EIGRP hello and hold timers do not have to match between neighbors to successfullyestablish a neighbor relationship. However, the reciprocating hello interval should be within the defined hold time. + + + + +Note +The AS number in these commands must match the AS number of EIGRP on the router for these changes to take effect. + + + + +Tip +It is recommended that you match the timers between neighbors; otherwise, you mayexperience flapping neighbor relationships or network instability. + + + +PASSIVE INTERFACES FOR EIGRP + + + +Router(config)# router Starts the EIGRP routing process eigrp 110 + + + +Router(config-router)# Specifies a network to advertise in the network 10.0.0.0 EIGRP routing process +0.0.0.255 +Router(config-router)# +passive-interface + +Prevents the sending of hello packets out +the GigabitEthernet 0/0/0 interface. No + +gigabitethernet 0/0/0 neighbor adjacency is formed + + + + +Router(config-router)# passive-interface default + + + +Router(config-router)# + +Prevents the sending of hello packets out all interfaces + + + + +Enables hello packets to be sent out + +no passive-interface interface Serial 0/0/1, thereby allowing serial 0/1/0 neighbor adjacencies to form + + + +Router(config)# ipv6 Starts the EIGRP for IPv6 routing router eigrp 110 process + + + + +Router(config-rtr)# +passive-interface + +Prevents the sending of hello packets out +the GigabitEthernet 0/0/0 interface. No + +gigabitethernet 0/0/0 neighbor adjacency is formed + + + + +Router(config-rtr)# passive-interface +default + +Prevents the sending of hello packets out +all interfaces + + + + + +Router(config-rtr)# no + + + +passive-interface + +Enables hello packets to be sent out interface Serial 0/1/0, thereby allowing +neighbor adjacencies to form + + + + +serial 0/1/0 + + + +Router(config-router- Enters address-family interface +af)# af-interface configuration mode for GigabitEthernet gigabitethernet 0/0/0 0/0/0 + + + + +Router(config-router- +af-interface)# + +Prevents the sending of hello packets out +of the GigabitEthernet 0/0/0 interface + +passive- interface + + + +Router(config-router- Enters address-family default interface af)# af-interface configuration mode +default + + + + +Router(config-router- +af-interface)# + +Prevents the sending of hello packets out +all interfaces + +passive- interface + + + +“PSEUDO” PASSIVE EIGRP INTERFACES + +A passive interface cannot send EIGRP hellos, which prevents adjacency relationships with link partners. An administrator can create a “pseudo” passive EIGRP interface by using a route filter that suppresses all routes from the EIGRP routing update. A neighbor relationship will form, but no routes will be sent out a specific interface. + + +Router(config)# Starts the EIGRP routing process router eigrp +100 + + + + +Router(config-router)# network +10.0.0.0 + +Specifies a network to advertise in the EIGRP +routing process +0.0.0.255 + + + + +Router(config-router)# +distribute-list + +Creates an outgoing distribute list for interface +Serial 0/1/0 and refers to ACL 5 + +5 out serial 0/1/0 + + + +Router(config- Returns to global configuration mode router)# exit + + + +Router(config)# Matches and drops packets from any source. This access-list 5 ACL, when used in the earlier distribute-list +deny any command, will prevent EIGRP 100 routing packets from being sent out of Serial 0/1/0 + + + +INJECTING A DEFAULT ROUTE INTO EIGRP: REDISTRIBUTION OF A STATIC ROUTE + + + +Router(config)# ip Creates a static default route to send all route 0.0.0.0 0.0.0.0 traffic with a destination network not in serial 0/1/0 the routing table out interface Serial 0/1/0 + + + + + +Note + + +Adding a static route (for example, ip route 0.0.0.0 0.0.0.0 gigabitethernet 1/1) will cause the route to be inserted into the routing table onlywhen the interface is up + + + + + +Router(config)# Creates EIGRP routing process 100 +router eigrp 100 + + + +Router(config- Advertises into EIGRP any static routes router)# redistribute that are configured on the router static + + + +Router(config)# Enters EIGRP using named mode router eigrp TEST configuration + + + +Router(config- Enters the IPv4 address family for AS 10 router)# address- +family ipv4 autonomous-system 10 + + + +Router(config-router- Enters address-family topology af)# topology base subconfiguration mode + + + + +Router(config-router- +af-topology)# + +Advertises static routes into the EIGRP +process + +redistribute static + + + + + +Note +Use this method when you want to draw all traffic to unknown destinations to a default route at the core of the network. + + + + +Note +This method is effective for advertising default connections to the Internet, but it will also redistribute all static routes into EIGRP. + + + +INJECTING A DEFAULT ROUTE INTO EIGRP: IP DEFAULT-NETWORK +Router(config)# Creates EIGRP routing process 100 router eigrp 100 + + + +Router(config- Specifies which network to advertise in EIGRP router)# network +192.168.100.0 0.0.0.255 + + + +Router(config- Returns to global configuration mode router)# exit + + + +Router(config)# ip Creates a static default route to send all traffic route 0.0.0.0 with a destination network not in the routing 0.0.0.0 table to next-hop address 192.168.100.5 192.168.100.5 + + + + +Router(config)# ip default-network +192.168.100.0 + +Defines a route to the 192.168.100.0 network +as a candidate default route + + + + + + +Note +For EIGRP to propagate the route, the network specified bythe ip default-network command must be known to EIGRP. This means that the network must be an EIGRP-derived network in the routing table, or the static route used to generate the route to the network must be redistributed into EIGRP, or advertised into these protocols using the network command. + + + + +Tip +In a complextopology, manynetworks can be identified as candidate defaults. Without anydynamic protocols running, you can configure your router to choose from several candidate default routes based on whether the routing table has routes to networks other than 0.0.0.0/0. The ip default-network command enables you to configure robustness into the selection of a gatewayof last resort. Rather than configuring static routes to specific next hops, you can have the router choose a default route to a particular network bychecking in the routing table. +Tip +The network 0.0.0.0 command enables EIGRP for all interfaces on the router. + + + +INJECTING A DEFAULT ROUTE INTO EIGRP: SUMMARIZE TO 0.0.0.0/0 + + + +Router(config)# Creates EIGRP routing process 100 router eigrp 100 + + + +Router(config- Specifies which network to advertise in EIGRP router)# network +192.168.100.0 + + + +Router(config- Returns to global configuration mode router)# exit + + + +Router(config)# Enters interface configuration mode interface serial +0/1/0 + + + +Router(config- Assigns the IP address and subnet mask to the if)# ip address interface +192.168.100.1 255.255.255.0 + + + +Router(config- Enables manual summarization for EIGRP AS if)#ip summary- 100 on this specific interface for the given address eigrp address and mask. An optional administrative 100 0.0.0.0 distance of 75 is assigned to this summary route 0.0.0.0 75 +Note +Summarizing to a default route is effective onlywhen you want to provide remote sites with a default route, and not propagate the default route toward the core of your network. + + + + +Note +Because summaries are configured per interface, you do not need to worryabout using distribute lists or other mechanisms to prevent the default route from being propagated toward the core of your network. + + + +ACCEPTING EXTERIOR ROUTING INFORMATION: DEFAULT-INFORMATION + + + +Router(conf Creates routing process 100 ig)# router +eigrp 100 + + + + +Router(conf ig-router)# default-information in + + + +Router(conf +ig-router)# + +Allows exterior or default routes to be received by the EIGRP process AS 100. This is the default action; exterior routes are always accepted, and default information is passed between EIGRP processes when redistribution occurs + + + +Suppresses exterior or default routing information + +no default-information in + + + +EQUAL-COST LOAD BALANCING: MAXIMUM-PATHS + + + +Router(config)# Creates routing process 100 router eigrp 100 +Router(config- Specifies which network to advertise in router)# network EIGRP +10.0.0.0 + + + +Router(config- Sets the maximum number of parallel routes router)# maximum- that EIGRP will support to six routes +paths 6 + + + +Router(config)# Creates routing process 100 for EIGRP for ipv6 router eigrp IPv6 +100 + + + +Router(config-rtr)# Sets the maximum number of parallel routes maximum-paths 6 that EIGRP for IPv6 will support to six routes + + + + +Router(config- +router-af)# + +Enters address-family topology +subconfiguration mode for EIGRP using + +topology base named mode + + + + +Router(config- +router-af- + +Sets the maximum number of parallel routes +that EIGRP using named mode configuration + +topology)# maximum- will support to six routes paths 6 + + + + + +Note +With the maximum-paths router configuration command, up to 32 equal-cost entries can be in the routing table for the same destination. The default is 4. + + + + +Note +Setting maximum-path to 1 disables load balancing. +UNEQUAL-COST LOAD BALANCING: VARIANCE + + + +Router(config Creates EIGRP routing process for AS 100 )# router +eigrp 100 + + + + +Router(config -router)# network 10.0.0.0 0.0.0.255 + + + +Router(config +-router)# + +Specifies which network to advertise in EIGRP + + + + + + + + + + +Instructs the router to include routes with a metric +less than or equal to n times the minimum metric + +variance n route for that destination, where n is the number specified by the variance command + + + +Router(config Creates IPv6 EIGRP routing process for AS 100 )# ipv6 +router eigrp 100 + + + + +Router(config +-rtr)# + +Instructs the router to include routes with a metric +less than or equal to n times the minimum metric + +variance n route for that destination, where n is the number specified by the variance command + + + + +Router(config -router-af- +topology)# + +Sets the variance for EIGRP using named mode +configuration. + +variance n This command is entered under address family +topology subconfiguration mode + + + + + +Note +If a path is not a feasible successor, it is not used in load balancing. + + + + + +Note +EIGRP variance can be set to a number between 1 and 128. + + + +EIGRP TRAFFIC SHARING + +EIGRP not only provides unequal cost path load balancing, but also intelligent load balancing such as traffic sharing. To control how traffic is distributed among routes when there are multiple routes for the same destination network that have different costs, use the traffic-share balanced command. With the balanced keyword, the router distributes traffic proportionately to the ratios of the metrics that are associated with different routes. This is the default setting. Similarly, when you use the traffic-share command with the min keyword, the traffic is sent only across the minimum-cost path, even when there are multiple paths in the routing table. This is identical to the forwarding behavior without use of the variance command. However, if you use the traffic-share min command and the variance command, even though traffic is sent over the minimum-cost path only, all feasible routes get installed into the routing table, which decreases convergence times. + + +Router(config)# router Creates EIGRP routing process for AS eigrp 100 100 +Router(config-router)# Sets the EIGRP traffic share feature to traffic-share balanced load balance proportionately to the +ratios of the metrics. This is the default value + + + +Router(config-router)# Sets the EIGRP traffic share feature to traffic-share min only send traffic across the minimum + +across-interfaces + + + +Router(config-router- + + +cost path + + + +Sets the traffic share feature for EIGRP + +af-topology)# traffic- using named mode configuration share balanced + + + + +Router(config-router-af-topology)# traffic-share min across- +interfaces + + +Note + + +These commands are entered under address family +topologysubconfiguration mode + + + + + +BANDWIDTH USE FOR EIGRP + + + +Router(config)# Enters interface configuration mode interface serial +0/1/0 + + + +Router(config-if)# Sets the bandwidth of this interface to 256 bandwidth 256 kilobits to allow EIGRP to make a better +metric calculation + + + +Router(config-if)# Configures the percentage of bandwidth that ip bandwidth- may be used by EIGRP on an interface percent eigrp 50 +100 +50 is the EIGRP AS number + + + +100 is the percentage value + + + +100% × 256 = 256 kbps + + + +Router(config-if)# Configures the percentage of bandwidth ipv6 bandwidth- (75%) that may be used by EIGRP 100 for percent eigrp 100 IPv6 on the interface +75 + + + + +Router(config-router-af- +interface)# + +Configures the percentage of bandwidth (25%) that may be used by EIGRP under the +address-family interface subconfiguration + +bandwidth- percent mode 25 + + + + + +Note +Bydefault, EIGRP is set to use onlyup to 50 percent of the bandwidth of an interface to exchange routing information. Values greater than 100 percent can be configured. This configuration option might prove useful if the bandwidth is set artificiallylow for other reasons, such as manipulation of the routing metric or to accommodate an oversubscribed multipoint Frame Relayconfiguration. + + + + +Note +The ip bandwidth-percent command relies on the value set bythe bandwidth command. + + + +STUB ROUTING FOR EIGRP + + + +Router(config)# Creates routing process 100 router eigrp +100 + + + +Router(config- Configures the router to send updates containing router)# eigrp its connected and summary routes only +stub + + + + +Note + + +Onlythe stub router needs to have the eigrp stub command enabled + + + + + + +Router(config- Permits the EIGRP stub routing feature to send router)# eigrp only connected routes +stub connected + + + + +Note + + +If the connected routes are not covered bya network statement, it might be necessaryto redistribute connected routes with the redistribute connected command + + + + + + + + +Tip + + +The connected option is enabled bydefault + + + + + + +Router(config- Permits the EIGRP stub routing feature to send router)# eigrp static routes +stub static + + + + +Note +Without this option, EIGRP will not send static routes, including internal static routes that normallywould be automatically redistributed. It will still be necessaryto redistribute static routes with the redistribute static command + + + + + + +Router(config- Permits the EIGRP stub routing feature to send router)# eigrp summary routes +stub summary + + + + +Note + + +Summaryroutes can be created manually, or through automatic summarization at a major network boundaryif the auto-summary command is enabled + + + + + + + + +Tip + + +The summaryoption is enabled bydefault + + + + + + +Router(config- Restricts the router from sharing any of its routes router)# eigrp with any other router in that EIGRP autonomous stub receive- system +only + + + +Router(config- Advertises redistributed routes, if redistribution is + +router)# eigrp +stub + +configured on the stub router using the +redistribute command + +redistributed +Router(config)# Enters router configuration mode and creates an ipv6 router EIGRP IPv6 routing process +eigrp 100 + + + +Router(config- Configures a router as a stub using EIGRP rtr)# eigrp +stub + + + + +Router(config- +router-af)# + +Configures the router to send updates containing +its connected and summary routes only + +eigrp stub + + + + +Note + + +This command is entered under the EIGRP address familywhen using named mode configuration + + + + + + + + +Note +You can use the optional arguments (connected, redistributed, static, and summary) as part of the same command on a single line: +Click here to view code image + + +Router(config-router)# eigrp stub connected static summary redistributed + + + + +You cannot use the keyword receive-only with any other option because it prevents any type of route from being sent. + + + +Note +The same keywords in the eigrp stub command that work with EIGRP for IPv4 will also work with EIGRP for IPv6: connected | summary| static | redistributed | receive-only +EIGRP UNICAST NEIGHBORS + + + +R2(config Enables EIGRP routing for AS 100 )# router +eigrp 100 + + + + +R2(config -router)# network 192.168.1 .0 0.0.0.255 + + + +R2(config -router)# neighbor 192.168.1 .101 gigabitet hernet 0/0/0 + + + +Router(co nfig-router-af)# neighbor 172.16.1. 2 gigabitet hernet +0/0/1 + +Identifies which networks to include in EIGRP + + + + + + + + + + + + +Identifies a specific neighbor with which to exchange routing information. Instead of using multicast packets to exchange information, unicast packets will now be used on the interface on which this neighbor resides. If there are other neighbors on this same interface, neighbor statements must also be configured for them; otherwise, no EIGRP packets will be exchanged with them + + + + +When using EIGRP named mode configuration, the +neighbor command is entered under the address family +EIGRP WIDE METRICS + +The EIGRP composite metric (calculated using the bandwidth, delay, reliability, and load) is not scaled correctly for high-bandwidth interfaces or EtherChannels, resulting in incorrect or inconsistent routing behavior. The lowest delay that can be configured for an interface is 10 microseconds. As a result, high-speed interfaces, such as 10 Gigabit Ethernet (GE) interfaces, or high-speed interfaces channeled together (GE EtherChannel) will appear to EIGRP as a single GE interface. This may cause undesirable equal-metric load balancing. To resolve this issue, the EIGRP Wide Metrics feature supports 64-bit metric calculations and Routing Information Base (RIB) scaling that provide the ability to support interfaces (either directly or via channeling techniques like EtherChannels) up to approximately 4.2 terabits. + + + +Note +The 64-bit metric calculations work onlyin EIGRP using named mode configurations. EIGRP classic mode uses 32-bit metric calculations. With the calculation of larger bandwidths, EIGRP can no longer fit the computed metric into a 4-byte unsigned long value that is needed bythe Cisco RIB. To set the RIB scaling factor for EIGRP, use the metric rib-scale command. When you configure the metric rib-scale command, all EIGRP routes in the RIB are cleared and replaced with the new metric values. + + + + +Note +The EIGRP Wide Metrics feature also introduces K6 as an additional K value for future use. + + + +ADJUSTING THE EIGRP METRIC WEIGHTS + +Use the metric weights command to adjust the default behavior of EIGRP routing and metric computations. + + +Router(config)# router Enables EIGRP routing for AS 100 eigrp 100 +Router(config-router)# Changes the default K-values used metric weights tos k1 k2 k3 in metric calculation. +k4 k5 + +These are the default values: + + + +tos=0, k1=1, k2=0, k3=1, k4=0, k5=0 + + + +Router(config)# ipv6 router Enters router configuration mode eigrp 100 and creates an EIGRP IPv6 routing +process + + + +Router(config-router)# Changes the default K-values used metric weights tos k1 k2 k3 in metric calculation. +k4 k5 + +These are the default values: + + + +tos=0, k1=1, k2=0, k3=1, k4=0, k5=0 + + + +Router(config)# router Enters router configuration mode eigrp CISCO and creates an EIGRP process +using named mode + + + +Router(config-router)# Enters IPv4 unicast address family address-family ipv4 unicast mode +autonomous-system 100 + + + +Router(config-router-af)# Changes the default K-values used metric weights tos k1 k2 k3 in metric calculation. +k4 k5 k6 +These are the default values: + + + +tos=0, k1=1, k2=0, k3=1, k4=0, k5=0, k6=0 + + + +Router(config-router-af)# Sets scaling value for RIB metric rib-scale 128 installation. The default value is +128, and the range is from 1 to 255 + + + + + +Note +tos is a reference to the original Interior GatewayRouting Protocol (IGRP) intention to have IGRP perform type-of-service routing. Because this was never adopted into practice, the tos field in this command is always set to zero (0). + + + + +Note +With default settings in place, the metric of EIGRP is reduced to the slowest bandwidth plus the sum of all the delays of the exit interfaces from the local router to the destination network. + + + + +Tip +For two routers to form a neighbor relationship in EIGRP, the K-values must match. + + + + + +Caution +Unless you are veryfamiliar with what is occurring in your network, it is recommended that you do not change the K-values. + + + +VERIFYING EIGRP + + + +Router# clear ip Deletes all routes from the IPv4 routing route * table +Router# clear ip Clears this specific route from the IPv4 route 172.16.10.0 routing table + + + +Router# clear ipv6 Deletes all routes from the IPv6 routing route * table + + + + + +Note + + +Clearing all routes from the routing table will cause high CPU utilization rates as the routing table is rebuilt + + + + + + +Router# clear ipv6 +route + +Clears this specific route from the IPv6 +routing table + +2001:db8:c18:3::/64 + + + +Router# clear ipv6 Resets IPv6 traffic counters traffic + + + +Router# show ip eigrp Displays the neighbor table neighbors + + + +Router# show ip eigrp Displays a detailed neighbor table neighbors detail + + + +Tip + + +The show ip eigrp neighbors detail command will verify whether a neighbor is configured as a stub router +Router# show ip eigrp Shows info for each interface interfaces + + + +Router# show ip eigrp Shows more detailed information for each interfaces detail interface, such as timers and percent +bandwidth + + + +Router# show ip eigrp Shows info for a specific interface interface serial +0/0/0 + + + +Router# show ip eigrp Shows info for interfaces running process interface 100 100 + + + +Router# show ip eigrp Displays the topology table topology + + + +Tip + + +The show ip eigrp topologycommand shows where your feasible successors are + + + + + +Router# show ip eigrp Displays all entries in the EIGRP topology topology all-links table, including nonfeasible-successor +sources + + + + +Router# show ip eigrp +traffic + +Shows the number and type of packets +sent and received + + + + +Router# show ip Displays the status of interfaces +interface configured for IPv4 + + + +Router# show ip Displays a summarized status of interfaces interface brief configured for IPv4 + + + +Router# show ip Shows the parameters and current state of protocols the active routing protocol process + + + + +Router# show ip route + + + +Router# show ip route +eigrp + +Shows the complete routing table + + + +Shows a routing table with only EIGRP +entries + + + + +Router# show ipv6 Displays IPv6 info for each interface eigrp interfaces + + + +Router# show ipv6 Displays IPv6 info for specific interface eigrp interface +serial 0/0/0 + + + +Router# show ipv6 Displays IPv6 info for interfaces running eigrp interface 100 process 100 + + + +Router# show ipv6 Displays the EIGRP IPv6 neighbor table eigrp neighbors + + + +Router# show ipv6 Displays a detailed EIGRP IPv6 neighbor eigrp neighbors table +detail +Router# show ipv6 Displays the EIGRP IPv6 topology table eigrp topology + + +Router# show ipv6 Displays the status of interfaces interface configured for IPv6 + + + +Router# show ipv6 Displays a summarized status of interfaces interface brief configured for IPv6 + + + +Router# show ipv6 Displays IPv6 neighbor discovery cache neighbors information + + + +Router# show ipv6 Displays the parameters and current state protocols of the active IPv6 routing protocol +processes + + + + +Router# show ipv6 route + + + +Router# show ipv6 + +Displays the current IPv6 routing table + + + + + +Displays the current IPv6 routing table + +route eigrp with only EIGRP routes + + + +Router# show ipv6 Displays a summarized form of the current route summary IPv6 routing table + + + + +Router# show ipv6 routers + + + +Router# show ipv6 +traffic + +Displays IPv6 router advertisement information received from other routers + + + +Displays statistics about IPv6 traffic +TROUBLESHOOTING EIGRP + + + + +Router# debug eigrp +fsm + +Displays events/actions related to EIGRP +feasible successor metrics (FSM) + + + + + + +Note + + +FSMis sometimes referred to as the Finite State Machine + + + + + + +Router# debug eigrp packets + + + +Router# debug eigrp + +Displays events/actions related to EIGRP packets + + + +Displays events/actions related to your + +neighbors EIGRP neighbors + + + + +Router# debug ip eigrp + + + +Router# debug ip + +Displays events/actions related to EIGRP protocol packets + + + +Displays EIGRP event notifications + +eigrp notifications + + + + +Router# debug ipv6 eigrp + + + +Router# debug ipv6 + +Displays information about the EIGRP for IPv6 protocol + + + +Displays information about the specified + +neighbor EIGRP for IPv6 neighbor 2001:db8:c18:3::1 +Router# debug ipv6 Displays EIGRP for IPv6 events and neighbor notification notifications in the console of the router + + + +Router# debug ipv6 Displays a summary of EIGRP for IPv6 neighbor summary routing information + + + +Router# debug ipv6 Displays debug messages for IPv6 packets packet + + + +Tip + + +Send your debug output to a syslog server to ensure that you have a copyof it in case your router is overloaded and needs to reboot + + + + + + +Router# debug ipv6 +routing + +Displays debug messages for IPv6 routing +table updates and route cache updates + + + + +CONFIGURATION EXAMPLE: EIGRP FOR IPV4 AND IPV6 USING NAMED MODE + +Figure 4-1 shows the network topology for the configuration that follows, which shows how to configure EIGRP using commands covered in this chapter. + + + + + + + + + + + + + + + + + + + +Figure 4-1 Network Topology for EIGRP Configuration + + + +R1 Router + + + +R1> enable + + + +R1# configure + +Enters privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +R1(config)# router Creates a named EIGRP virtual instance eigrp ConfigEG called ConfigEG + + + +R1(config-router)# Enables the IPv4 address family and starts address-family ipv4 EIGRP autonomous system 1 autonomous-system 1 + + + +R1(config-router- Enables EIGRP for IPv4 on interfaces in the af)# network 198.133.219.0 network +198.133.219.0 0.0.0.255 +R1(config-router- Enables EIGRP for IPv4 on interfaces in the af)# network 192.168.0.0/24 network +192.168.0.0 0.0.0.255 + + + +R1(config-router- Enables EIGRP for IPv4 on interfaces in the af)# network 192.168.1.0/24 network +192.168.1.0 0.0.0.255 + + + +R1(config-router- Moves the router into address-family af)# af-interface interface configuration mode for interface gigabitethernet 0/0 GigabitEthernet 0/0 + + + + +R1(config-router-af-interface)# summary-address +192.168.0.0/23 + +Configures a summary aggregate address for +the two serial prefixes + + + +Note + + +The command summary-address 192.168.0.0 255.255.254.0 is also a valid entryhere + + + + + +R1(config-router- Returns to address-family configuration af-interface)# exit mode + + + +R1(config-router- Returns to EIGRP router configuration mode af)# exit + + + +Note +The complete command is exit-address-family + + + + + + +R1(config-router)# Enables the IPv6 address family and starts address-family ipv6 EIGRP autonomous system 1. All IPv6 + +autonomous- system +1 + + +enabled interfaces are included in the +EIGRPv6 process + + + + +R1(config-router- Returns to EIGRP router configuration mode af)# exit + + + +R1(config-router)# Returns to global configuration mode exit + + + +R1(config)# exit Returns to privileged EXEC mode + + + +R1# copy running- Copies the running configuration to NVRAM config startup- +config + + + +R2 Router + + + +R2> enable + + + +R2# configure + +Enters privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +R2(config)# router Creates a named EIGRP virtual instance eigrp ConfigEG called ConfigEG +R2(config-router)# Enables the IPv4 address family and starts address-family ipv4 EIGRP autonomous system 1 autonomous- system +1 + + + +R2(config-router- Enables EIGRP for IPv4 on interfaces in the af)# network 192.168.0.0 network +192.168.0.0 + + + +R2(config-router- Returns to EIGRP router configuration mode af)# exit + + + +Note + + +The complete command is exit-address-family + + + + + + +R2(config-router)# Enables the IPv6 address family and starts address-family ipv6 EIGRP autonomous system 1. All IPv6 + +autonomous- system +1 + + +enabled interfaces are included in the +EIGRPv6 process + + + + +R2(config-router- Returns to EIGRP router configuration mode af)# exit + + + +R2(config-router)# Returns to global configuration mode exit + + + +R2(config)# exit Returns to privileged EXEC mode + + + +R2# copy running- Copies the running configuration to NVRAM +config startup-config + + + +R3 Router + + + +R3> enable + + + +R3# configure + +Enters privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +R3(config)# router Creates a named EIGRP virtual-instance eigrp ConfigEG called ConfigEG + + + +R3(config-router)# Enables the IPv4 address family and starts address-family ipv4 EIGRP autonomous system 1 autonomous-system 1 + + + +R3(config-router- Enables EIGRP for IPv4 on interfaces in the af)# network 192.168.1.0 network +192.168.1.0 + + + +R3(config-router- Returns to EIGRP router configuration mode af)# exit + + + +Note + + +The complete command is exit-address-family + + + + + + +R3(config-router)# Enables the IPv6 address family and starts address-family ipv6 EIGRP autonomous system 1. All IPv6 +autonomous-system 1 enabled interfaces are included in the EIGRPv6 process + + + +R3(config-router- Returns to EIGRP router configuration mode af)# exit + + + +R3(config-router)# Returns to global configuration mode exit + + + +R3(config)# exit Returns to privileged EXEC mode + + + +R3# copy running- Copies the running configuration to NVRAM config startup- +config +Chapter 5 OSPF + + + + +This chapter provides information about the following topics: + + +Comparing OSPFv2 and OSPFv3 + +Configuring OSPFv2 + +Configuring multiarea OSPFv2 + +Using wildcard masks with OSPFv2 areas + +Configuring traditional OSPFv3 + + +Enabling OSPFv3 for IPv6 on an interface + +OSPFv3 and stub/NSSA areas + +Interarea OSPFv3 route summarization + +Enabling an IPv4 router ID for OSPFv3 + +Forcing an SPF calculation + + + +OSPFv3 address families + + +Configuring the IPv6 address family in OSPFv3 + +Configuring the IPv4 address family in OSPFv3 + +Applying parameters in address family configuration mode + + + +Authentication for OSPF +Configuring OSPFv2 authentication: simple password + +Configuring OSPFv2 cryptographic authentication: MD5 + +Configuring OSPFv2 cryptographic authentication: SHA-256 + +Configuring OSPFv3 authentication and encryption + +Verifying OSPFv2 and OSPFv3 authentication + + + +Optimizing OSPF parameters + + +Loopback interfaces + +Router ID + +DR/BDR elections + +Passive interfaces + +Modifying cost metrics + +OSPF reference bandwidth + +OSPF LSDB overload protection + +Timers + +IP MTU + + + +Propagating a default route + +Route summarization + + +Interarea route summarization + +External route summarization + + + +OSPF route filtering + + +Using the filter-list command +Using the area range not-advertise command + +Using the distribute-list in command + +Using the summary-address not-advertise command + + + +OSPF special area types + + +Stub areas + +Totally stubby areas + +Not-so-stubby areas + +Totally NSSA + + + +Virtual Links + + +Configuration example: virtual links + + + +Verifying OSPF configuration + +Troubleshooting OSPF + +Configuration example: single-area OSPF + +Configuration example: multiarea OSPF + +Configuration example: traditional OSPFv3 + +Configuration example: OSPFv3 with address families + + + +COMPARING OSPFV2 AND OSPFV3 + +Open Shortest Path First (OSPF) was developed in the 1980s and was standardized in 1989 as RFC 1131. The current version of OSPF, OSPFv2, was standardized in 1998 as RFC 2328. Now that router technology has dramatically improved, and with the arrival +of IPv6, rather than modify OSPFv2 for IPv6, it was decided to create a new version of OSPF (OSPFv3), not just for IPv6, but for other newer technologies as well. OSPFv3 was standardized in 2008 as RFC 5340. + +In most Cisco documentation, if you see something refer to OSPF, it is assumed to be referring to OSPFv2, and working with the IPv4 protocol stack. + +The earliest release of the OSPFv3 protocol worked with IPv6 exclusively; if you needed to run OSPF for both IPv4 and IPv6, you had to have OSPFv2 and OSPFv3 running concurrently. Newer updates to OSPFv3 allow for OSPFv3 to handle both IPv4 and IPv6 address families. + +CONFIGURING OSPF + + + +Router(config Starts OSPF process 123. The process ID is any )# router positive integer value between 1 and 65,535. The ospf 123 process ID is not related to the OSPF area. The +process ID merely distinguishes one process from another within the device + + + + + +Note + + +The process ID number of one router does not have to match the process ID of anyother router. Unlike Enhanced Interior GatewayRouting Protocol (EIGRP), matching this number across all routers does not ensure that network adjacencies will form + + + + + + +Router(config +-router)# + +OSPF advertises interfaces, not networks. It uses the +wildcard mask to determine which interfaces to +network 172.16.10.0 +0.0.0.255 + + +advertise. Read this line to say, “Any interface with an address of 172.16.10.x is to run OSPF and be put into +area 0” + +area 0 + + + + +Router(config -router)# log- +adjacency-changes detail + + + + + + + +Router(config + +Configures the router to send a syslog message when there is a change of state between OSPF neighbors + + + + + +Tip + + +Although the log-adjacency-changes command is on bydefault, only up/down events are reported unless you use the detail keyword + + + + +Moves to interface configuration mode + +)# interface gigabitethern et 0/0 + + + +Router(config Enables OSPF area 0 directly on this interface -if)# ip ospf +123 area 0 + + +Note + + +Because this command is configured directlyon the interface, it takes precedence over the network area command entered in router configuration mode + + + + + + + + +Caution +Running two different OSPF processes does not create multiarea OSPF; it merelycreates two separate instances of OSPF that do not communicate with each other. To create multiarea OSPF, you use two separate network statements and advertise two different links into different areas. See the following section for examples. +CONFIGURING MULTIAREA OSPF + +To create multiarea OSPF, you use two separate network statements and advertise two different links into different areas. You can also enable two different areas on two different interfaces to achieve the same result. + + +Router(config)# router Starts OSPF process 1 ospf 1 + + + +Router(config-router)# Read this line to say, “Any interface with network 172.16.10.0 an address of 172.16.10.x is to run OSPF 0.0.0.255 area 0 and be put into area 0” + + + +Router(config-router)# Read this line to say, “Any interface with network 10.10.10.1 an exact address of 10.10.10.1 is to run 0.0.0.0 area 51 OSPF and be put into area 51” + + + +Router(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Router(config-if)# ip Enables OSPF area 0 directly on this ospf 1 area 0 interface + + + + + +Note + + +Because this command is configured directlyon the interface, it takes precedence over the network area command entered in router configuration mode +Router(config-if)# Moves to interface configuration mode interface +gigabitethernet 0/1 + + + +Router(config-if)# ip Enables OSPF area 51 directly on this ospf 1 area 51 interface + + + +USING WILDCARD MASKS WITH OSPF AREAS + +When compared to an IP address, a wildcard mask identifies what addresses are matched to run OSPF and to be placed into an area: + + +A 0 (zero) in a wildcard mask means to check the corresponding bit in the address for an exact match. + +A 1 (one) in a wildcard mask means to ignore the corresponding bit in the address—can be either 1 or 0. + + +Example 1: 172.16.0.0 0.0.255.255 + + +172.16.0.0 = 10101100.00010000.00000000.00000000 + +0.0.255.255 = 00000000.00000000.11111111.11111111 + +Result = 10101100.00010000.xxxxxxxx.xxxxxxxx + +172.16.x.x (anything between 172.16.0.0 and 172.16.255.255 matches the example statement) + + + +Tip +An octet in the wildcard mask of all 0s means that the octet has to match the address exactly. An octet in the wildcard mask of all 1s means that the octet can be ignored. + + + +Example 2: 172.16.8.0 0.0.7.255 +172.16.8.0 = 10101100.00010000.00001000.00000000 + +0.0.0.7.255 = 00000000.00000000.00000111.11111111 + +Result = 10101100.00010000.00001xxx.xxxxxxxx + +00001xxx = 00001000 to 00001111 = 8–15 + +xxxxxxxx = 00000000 to 11111111 = 0–255 + +Anything between 172.16.8.0 and 172.16.15.255 matches the example statement + + +Router(config-router)# Read this line to say, “Any interface with network 172.16.10.1 an exact address of 172.16.10.1 is to run 0.0.0.0 area 0 OSPF and be put into area 0” + + + +Router(config-router)# Read this line to say, “Any interface with network 172.16.0.0 an address of 172.16.x.x is to run OSPF 0.0.255.255 area 0 and be put into area 0” + + + +Router(config-router)# Read this line to say, “Any interface with network 0.0.0.0 any address is to run OSPF and be put 255.255.255.255 area 0 into area 0” + + + + + +Tip +If you have problems determining which wildcard mask to use to place your interfaces into an OSPF area, use the ip ospf process ID area area number command directlyon the interface. + + + + + +Router(config)# +gigabitethernet + +interface +0/0 + + +Moves to interface +configuration mode + + + + +Router(config-if)# ip ospf 1 Places this interface into area area 51 51 of OSPF process 1 +Router(config-if)# interface Moves to interface gigabitethernet 0/1 configuration mode + + + +Router(config-if)# ip ospf 1 Places this interface into area area 0 0 of OSPF process 1 + + + + + +Tip +If you assign interfaces to OSPF areas without first using the router ospf x command, the router creates the router process for you, and it shows up in show running-config output. + + + +CONFIGURING TRADITIONAL OSPFV3 + +OSPFv3 is a routing protocol for IPv4 and IPv6. Much of OSPFv3 is the same as in OSPFv2. OSPFv3, which is described in RFC 5340, expands on OSPFv2 to provide support for IPv6 routing prefixes and the larger size of IPv6 addresses. OSPFv3 also supports IPv6 and IPv4 unicast address families. + +Enabling OSPF for IPv6 on an Interface + + +Router(config Enables the forwarding of IPv6 unicast datagrams )# ipv6 globally on the router +unicast-routing + +Note + + +This command is required before anyIPv6 routing protocol can be configured + + + + + +Router(config Moves to interface configuration mode +)# interface gigabitethern et 0/0 + + + +Router(config Configures a global IPv6 address on the interface and -if)# ipv6 enables IPv6 processing on the interface +address 2001:db8:0:1: :1/64 + + + +Router(config Enables traditional OSPFv3 process 1 on the interface -if)# ipv6 and places this interface into area 0 +ospf 1 area 0 + + + + +Note + + +The OSPFv3 process is created automaticallywhen OSPFv3 is enabled on an interface + + + + + + + + +Note + + +The ipv6 ospf x area y command has to be configured on each interface that will take part in OSPFv3 + + + + + + + + +Note + + +If a router ID has not been created first, the router mayreturn a “NORTRID” warning (no router ID) stating that the process could not pick a router ID. It will then tell you to manuallyconfigure a router ID +Router(config Assigns a priority number to this interface for use in -if)# ipv6 the designated router (DR) election. The priority can + +ospf priority +30 + +be a number from 0 to 255. The default is 1. A router with a priority set to 0 is ineligible to become the DR +or the backup DR (BDR) + + + + + +Router(config Assigns a cost value of 20 to this interface. The cost -if)# ipv6 value can be an integer value from 1 to 65 535 ospf cost 20 + + + +Router(config Configures a neighbor for use on nonbroadcast -if)# ipv6 multiaccess (NBMA) networks +ospf neighbor fe80::a8bb:cc +ff:fe00:c01 +Note + + +Onlylink-local addresses maybe used in this command + + + + + + +OSPFv3 and Stub/NSSA Areas + + +Router(config)# Creates the OSPFv3 process if it has not already ipv6 router ospf been created, and moves to router configuration +mode + + + +Router(config- The router is configured to be part of a stub area rtr)# area 1 stub + + + +Router(config- The router is configured to be in a totally stubby rtr)# area 1 stub area. Only the ABR requires this no-summary no-summary keyword +Router(config- The router is configured to be in an NSSA rtr)# area 1 nssa + + + +Router(config- The router is configured to be in a totally rtr)# area 1 nssa stubby, NSSA area. Only the ABR requires the no summary no summary keyword + + + +Interarea OSPFv3 Route Summarization + + +Router(config)# Creates the OSPFv3 process if it has not already + +ipv6 router ospf +1 + + +been created, and moves to router configuration +mode + + + + +Router(config- Summarizes area 1 routes to the specified + +rtr)# area 1 +range + +summary address, at an area boundary, before +injecting them into a different area + +2001:db8::/48 + + + +Enabling an IPv4 Router ID for OSPFv3 + + + +Router(c onfig)# ipv6 +router + +Creates the OSPFv3 process if it has not already been +created, and moves to router configuration mode. + +ospf 1 + + + + +Router(c onfig-rtr)# +router- + +Creates an IPv4 32-bit router ID for this router. + + + + + +Note +id 192.168. +254.255 + + +In OSPFv3 for IPv6, it is possible that no IPv4 addresses will be configured on any interface. In this case, the user must use the router-id command to configure a router ID before the OSPFv3 process will be started. If an IPv4 address does exist when OSPFv3 for IPv6 is enabled on an interface, that IPv4 address is used for the router ID. If more than one IPv4 address is available, a router ID is chosen using the same +rules as for OSPF Version 2. + + + + + + + +Forcing an SPF Calculation + + +Router# clear ipv6 The OSPF database is cleared and repopulated, ospf 1 process and then the SPF algorithm is performed. + + + +Router# clear ipv6 The OSPF database is not cleared; just an SPF ospf 1 force-spf calculation is performed. + + + + + +Caution +As with OSPFv2, clearing the OSPFv3 database and forcing a recalculation of the shortest path first (SPF) algorithm is processor intensive and should be used with caution. + + + +OSPFV3 ADDRESS FAMILIES + +The OSPFv3 address families feature is supported as of Cisco IOS Release 15.1(3)S and Cisco IOS Release 15.2(1)T. Cisco devices that run software older than these releases and third-party devices will not form neighbor relationships with devices running the address families feature for the IPv4 address family because they do not set the address family bit. Therefore, those devices will not participate in the IPv4 address family SPF calculations and will not install the IPv4 OSPFv3 routes in the IPv6 RIB. + + + +Note +Devices running OSPFv2 will not communicate with devices running OSPFv3 for IPv4. +Note +To use the IPv4 unicast address families (AFs) in OSPFv3, you must enable IPv6 on a link, although the link may not be participating in IPv6 unicast AF. + + + + +Note +With the OSPFv3 address families feature, users mayhave two processes per interface, but onlyone process per AF. If the AF is IPv4, an IPv4 address must first be configured on the interface, but IPv6 must be enabled on the interface. + + + +Configuring the IPv6 Address Family in OSPFv3 + + +Router(config)# router Enables OSPFv3 router configuration ospfv3 1 mode for the IPv4 or IPv6 address +family + + + +Router(config-router)# Enters IPv6 address family address-family ipv6 configuration mode for OSPFv3 unicast + +Notice the prompt change Router(config-router- +af)# + + + + +Router(config)# interface +gigabitethernet 0/0 + +Enters interface configuration mode +for the GigabitEthernet 0/0 interface + + + + +Router(config-if)# Places the interfaces in area 0 for the ospfv3 1 ipv6 area 0 IPv6 address family + + + +Configuring the IPv4 Address Family in OSPFv3 +Router(config)# router Enables OSPFv3 router configuration ospfv3 1 mode for the IPv4 or IPv6 address +family + + + +Router(config-router)# Enters IPv4 address family address-family ipv4 configuration mode for OSPFv3 unicast + +Notice the prompt change Router(config-router- +af)# + + + + +Router(config)# interface +gigabitethernet 0/0 + +Enters interface configuration mode +for the GigabitEthernet 0/0 interface + + + + +Router(config-if)# Places the interfaces in area 0 for the ospfv3 1 ipv4 area 0 IPv4 address family + + + +Applying Parameters in Address Family Configuration Mode + + +Router(config-router- Summarizes area 1 routes to the specified af)# area 1 range summary address, at an area boundary, + +2001:db8:0:0::0/56 + + + +Router(config-router- + +before injecting them into a different area + + + +Resets OSPFv3 area 1 parameters to their + +af)# default area 1 default values + + + +Router(config-router- Summarizes area 0 routes to specified af)# area 0 range summary address, before injecting them 172.16.0.0 into a different area +255.255.0.0 +Router(config-router- Sets default metric values for IPv4 and IPv6 + +af)# default-metric +10 + +routes redistributed into the OSPFv3 +routing protocol + + + + +Router(config-router- Sets the maximum number of equal-cost af)# maximum-paths 4 routes that a process for OSPFv3 routing +can support + + + + + + +Note + + +The maximum number of paths you can set is platform dependent + + + + + +Router(config-router- Configures an IPv6 summary prefix. This is af)# summary-prefix done on an Autonomous System Border 2001:0:0:10::/60 Router (ASBR) + + + + + +Note +Other commands that are available in AF mode include the following: + +area nssa +area stub passive-interface router-id + + + +AUTHENTICATION FOR OSPF + +Authentication for routers using OSPF relies on the use of predefined passwords. + +Configuring OSPFv2 Authentication: Simple Password +Router(config)# Starts OSPF process 1 router ospf 1 + + + +Router(config- Enables simple authentication; password will be router)# area 0 sent in clear text for the entire area authentication + + + +Router(config- Returns to global configuration mode router)# exit + + + + +Router(config)# interface gigabitethernet 0/0 + + + +Router(config- + +Moves to interface configuration mode + + + + + + + + + +Another way to enable authentication if it has not + +if)# ip ospf been set up in router configuration mode shown + +authentication + + + +Router(config- + +earlier + + + +Sets key (password) to cleartxt + +if)# ip ospf authentication- +key cleartxt +Note + + +The password can be anycontinuous string of characters that can be entered from the keyboard, up to eight characters in length. To be able to exchange OSPF information, all neighboring routers on the same network must have the same password + + + + + + +Configuring OSPFv2 Cryptographic Authentication: MD5 + + +Router(config)# Starts OSPF process 13 +router ospf 13 + + + +Router(config- Enables authentication with MD5 router)# area 0 password encryption for the entire area authentication +message-digest + + +Note + + +MD5 authentication can also be enabled directlyon the interface using the ip ospf authentication message-digest command in interface configuration mode + + + + + +Router(config- Returns to global configuration mode router)# exit + + + +Router(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Router(config-if)# ip Provides another way to enable +ospf authentication authentication if it has not been set up in message-digest router configuration mode shown earlier + + + +Router(config-if)# ip 1 is the key ID. This value must be the ospf message-digest- same as that of your neighboring router key 1 md5 secret + +md5 indicates that the MD5 hash algorithm will be used + + + +secret is the key (password) and must be the same as that of your neighboring +router + + + + + +Tip +It is recommended that you keep no more than one keyper interface. Everytime you add a new key, you should remove the old keyto prevent the local system from continuing to communicate with a hostile system that knows the old key. + + + + +Note +If the service password-encryption command is not used when configuring OSPF authentication, the keywill be stored as plain text in the router configuration. If you use the service password-encryption command, there will be an encryption type of 7 specified before the encrypted key. + + + +Configuring OSPFv2 Cryptographic Authentication: SHA-256 + +Starting with Cisco IOS Release 15.4(1)T, OSPFv2 supports SHA hashing authentication using key chains. Cisco refers to this feature as OSPFv2 Cryptographic Authentication. The feature prevents unauthorized or invalid routing updates in a network by authenticating OSPFv2 protocol packets using HMAC-SHA-256 algorithms. + + +Router(config)# key Specifies the key chain name and chain samplechain enters key-chain configuration mode + + + +Router(config-keychain)# Specifies the key identifier and enters key 1 key-chain key configuration mode. The +range is from 1 to 255 + + + +Router(config-keychain- Specifies the key string key)# key-string +ThisIsASampleKey54321 +Router(config-keychain- Configures the key with the specified key)# cryptographic- cryptographic algorithm. algorithm hmac-sha-256 + +Options for SHA are platform dependent but can include SHA-1, SHA-256, SHA-384, and SHA-512 + + + +Router(config-keychain- Sets the time period during which an key)# send-lifetime authentication key on a key chain is local 10:00:00 15 valid to be sent during key exchange October 2019 infinite with another device + + + +Router(config-keychain- Exits key-chain key configuration key)# exit mode and returns to key-chain +configuration mode + + + + +Router(config-keychain)# exit + + + + + +Router(config)# +interface + +Exits key-chain configuration mode and returns to global configuration mode + + + +Enters interface configuration mode + +gigabitethernet 0/0 + + + +Router(config-if)# ip Specifies the key chain for the ospf authentication key- interface +chain samplechain + + + +Configuring OSPFv3 Authentication and Encryption + + + +Tip +OSPFv3 requires the use of IPsec to enable authentication. Crypto images are therefore needed for authentication, as theyare the onlyimages that include the IPsec application programming interface (API) needed for use with OSPFv3. + + + + +Note +Authentication and encryption do not need to be done on both the interface and on the area, but rather onlyin one location. The following section shows both methods. + + + + +Note +RFC 7166 adds non-IPsec cryptographic authentication to OSPFv3. It is now possible to use the SHAencryption method previouslydescribed thanks to the addition of a new Authentication Trailer (AT) to OSPFv3 packets. The command to applythe keychain to an interface for use with OSPFv3 is ospfv3 x authentication key-chain. The keychain can also be applied to an entire area with the area x authentication key-chain router configuration command. + + + + + +Router(config)# +gigabitethernet + + +interface +0/0 + +Moves to interface configuration +mode + + + + +Router(config-if)# ipv6 ospf Applies authentication policy to authentication ipsec spi 500 the interface. +md5 + +1234567890abcdef1234567890ab +cdef + + +spi (security policy index) is analogous to key numbers in a key chain but is communicated via the Authentication Header (AH). The SPI is a number +between 256 and 4 294 967 295 + + + + +md5 = using the MD5 hash algorithm. SHA1 is also an option + + + + + +Note +The keystring length is precise; it must be 32 hexdigits for MD5 or 40 for SHA1 + + + + + +Router(config-if)# ospfv3 Alternative way of applying + +authentication ipsec spi 500 +md5 + +authentication policy to the +interface + +1234567890abcdef1234567890ab cdef + + + +Router(config-if)# ipv6 ospf Specifies the encryption type for encryption ipsec spi 256 esp the interface to AES-128 and the aes-cbc 128 authentication type to SHA 1234567890123456789012345678 +90AB sha1 1234567890123456789012345678 901234567890 + + + +Router(config-if)# ospfv3 Alternative way of specifying the encryption ipsec spi 257 esp encryption type for the interface. aes-cbc 128 In this example, AES-128 is 1234567890123456789012345678 enabled for encryption and MD5 90AB md5 is enabled for authentication 1234567890123456789012345678 +90AB + + + +Router(config-if)# exit Returns to global configuration mode + + + +Router(config)# router Moves to routing protocol ospfv3 1 configuration mode +Router(config-router)# area Applies authentication policy to 0 authentication ipsec spi an entire area +sha1 1234567890123456789012345678 901234567890 + + + +Router(config-router)# area Enables AES-128 encryption and 0 encryption ipsec spi 300 SHA authentication for the entire esp aes-cbc 128 area 1234567890123456789012345678 +90AB sha1 1234567890123456789012345678 901234567890 + + + +Router(config-router)# exit Returns to global configuration mode + + + +Verifying OSPFv2 and OSPFv3 Authentication + + +Router# show ip Displays OSPF neighbor table. Incorrect ospf neighbor authentication configuration will prevent +neighbor relationships from forming + + + +Router# show ip Displays the OSPF routes in the routing table. route ospf Incorrect authentication configuration will +prevent routes from being inserted into the routing table + + + +Router# show Displays the OSPFv3 neighbor table ospfv3 neighbor +Router# show ipv6 Displays the OSPFv3 routes in the routing table route ospf + + + +Router# show ip Verifies authentication setup on a specific ospf interface interface +gigabitethernet 0/0 + + + +Router# show Displays IPsec security associations on a crypto ipsec sa specific interface +interface gigabitethernet 0/0 + + + +Router# debug ip Displays information about OSPF adjacencies ospf adj and authentication for IPv4 + + + +Router# debug ipv6 Displays information about OSPF adjacencies ospf adj and authentication for IPv6 + + + +OPTIMIZING OSPF PARAMETERS + +The following sections are optional but may be required in your tuning of OSPF for your network. + +Loopback Interfaces + + +Router(config)# Creates a virtual interface named interface loopback 0 Loopback 0 and then moves the router to +interface configuration mode + + + +Router(config-if)# ip Assigns the IP address to the interface +address 192.168.100.1 255.255.255.255 +Note + + +Loopback interfaces are always “up and up” and do not go down unless manuallyshut down. This makes loopback interfaces great for use as an OSPF router ID + + + + + + +Router ID + + +Router(con Starts OSPF process 1 fig)# +router ospf 1 + + + +Router(con fig-router)# router-id 10.1.1.1 + + + +Router(con fig- +router)# + +Sets the router ID to 10.1.1.1. If this command is used on an OSPF router process that is already active (has neighbors), the new router ID is used at the next reload or at a manual OSPF process restart + + + + +Removes the static router ID from the configuration. If this command is used on an OSPF router process that is +already active (has neighbors), the old router ID behavior + + + +no router- +id + + +is used at the next reload or at a manual OSPF process +restart + +10.1.1.1 + + + + +Router(con fig- +router- +af)# + +Sets the router ID to 10.1.1.1 in address family +configuration mode +router-id 10.1.1.1 Note + +This works for either IPv4 or IPv6 address-familyconfiguration mode, and also under the global OSPFv3 process. When entered there, the command applies to both address families + + + + + + + + +Note +To choose the router ID at the time of OSPF process initialization, the router uses the following criteria in this specific order: + +1. Use the router ID specified in the router-id w.x.y.z command. + +2. Use the highest IP address of all active loopback interfaces on the router. + +3. Use the highest IP address among all active nonloopback interfaces. + + + + + +Note +To have the manuallyconfigured router ID take effect, you must clear the OSPF routing process with the clear ip ospf process command. + + + + +Note +There is no IPv6 form of router ID. All router IDs are 32-bit numbers in the form of an IPv4 address. Even if a router is running IPv6 exclusively, the router ID is still in the form of an IPv4 address. + + + +DR/BDR Elections + + +Router( Enters interface configuration mode config) +# interfa ce gigabit etherne t 0/0 +Router( Changes the OSPF interface priority to 50 config- +if)# ip +ospf +priorit Note + +y 50 The assigned prioritycan be between 0 and 255. Apriorityof 0 makes the router +ineligible to become a designated router (DR) or backup designated router (BDR). The highest prioritywins the election and becomes the DR; the second highest priority becomes the BDR. Apriorityof 255 guarantees at least a tie in the election—assuming another router is also set to 255. If all routers have the same priority, regardless of the prioritynumber, theytie. Ties are broken bythe highest router ID. The default priority setting is 1 + + + + + + + + +Tip + + +Do not assign the same priorityvalue to more than one router + + + + + + +Router( Changes the interface priority to 100 for traditional OSPFv3 config- +if)# ipv6 ospf priorit y 100 + + + + +Router( config-if)# ospfv3 1 +priorit + +Changes the interface priority to 100 for all OSPFv3 address families. It is possible to assign different priority values for +each address family (IPv4 or IPv6) + +y 100 +Passive Interfaces + + +Router(config) Starts OSPF process 1 # router ospf +1 + + + + +Router(config-router)# network +172.16.10.0 + +Read this line to say, “Any interface with an address +of 172.16.10.x is to be put into area 0” + +0.0.0.255 area 0 + + + + +Router(config-router)# passive-interface +gigabitetherne + +Disables the sending of any OSPF packets on this +interface + +t 0/0 + + + + +Router(config-router)# passive-interface default + + + +Router(config- + +Disables the sending of any OSPF packets out all interfaces + + + + + + + + +When entered following the passive interface + + + +router)# no +passive- + +default command, enables OSPF packets to be sent +out interface Serial 0/0/1, thereby allowing neighbor + +interface adjacencies to form serial 0/0/1 +Router(config-router-af)# passive-interface +gigabitetherne + +Disables the sending of any OSPF packets on this interface for a specific OSPFv3 address family. It is possible to apply the passive-interface command under the global OSPFv3 process or under each +address family + +t 0/0 + + + +Modifying Cost Metrics + + +Router(c Enters interface configuration mode onfig)# +interfac e serial 0/0/0 + + + +Router(c onfig-if)# +bandwidt + +If you change the bandwidth, OSPF will recalculate the cost +of the link + +h 128 +Note + + + + +Or + + + +Router(c onfig-if)# ip ospf cost +1564 + +The cost of a link is determined bydividing the reference bandwidth bythe interface bandwidth + + + + + + +Changes the cost to a value of 1564 + + + +The bandwidth of the interface is a number between 1 and 10 000 000. The unit of measurement is kilobits per second (Kbps). The cost is a number between 1 and 65 535. The +cost has no unit of measurement; it is just a number +Router(c onfig- +if)# + +The OSPFv3 interface cost can be modified globally for all +address families or for a specific address family + +ospfv3 1 cost 5000 + + + +OSPF Reference Bandwidth + + +Router(config)# Starts OSPF process 1 router ospf 1 + + + +Router(config- Changes the reference bandwidth that OSPF uses router)# auto- to calculate the cost of an interface +cost reference-bandwidth 1000 + +Note + + +The range of the reference bandwidth is 1 to 4 294 967 294. The default is 100. The unit of measurement is megabits per second (Mbps) + + + + + + + + +Note + + +The value set bythe ip ospf cost command overrides the cost resulting from the auto-cost command + + + + + + + + +Tip + + +If you use the command auto-cost reference-bandwidth reference-bandwidth, you need to configure all the routers to use the same +value. Failure to do so will result in routers using a different reference cost to calculate the shortest path, resulting in potential suboptimum routing paths + + + + + + +OSPF LSDB Overload Protection + + +Router(config Starts OSPF process 1 )# router +ospf 1 + + + + +Router(config +-router)# + +Limits the number of non-self-generated LSAs that +this process can receive to 12 000. This number can + +max-lsa 12000 be between 1 and 4 294 967 294 + + + + + +Note +If other routers are configured incorrectly, causing, for example, a redistribution of a large number of prefixes, large numbers of LSAs can be generated. This can drain local CPU and memoryresources. With the max-lsa x feature enabled, the router keeps count of the number of received (non-self-generated) LSAs that it keeps in its LSDB. An error message is logged when this number reaches a configured threshold number, and a notification is sent when it exceeds the threshold number. + + + +If the LSA count still exceeds the threshold after 1 minute, the OSPF process takes down all adjacencies and clears the OSPF database. This is called the ignore state. In the ignore state, no OSPF packets are sent or received by interfaces that belong to the OSPF process. The OSPF process will remain in the ignore state for the time that is defined by the ignore-time parameter. If the OSPF process remains normal for the time that is defined by the reset-time parameter, the ignore state counter is reset to 0. + +Timers +Router(config Changes the hello interval timer to 20 seconds -if)# ip ospf +hello-interval timer 20 + + + +Router(config Changes the dead interval timer to 80 seconds -if)# ip ospf +dead-interval 80 + + + +Router(config Changes the hello interval to 3 seconds for the +-if)# ospfv3 OSPFv3 IPv4 address family. It is possible to modify 1 ipv4 hello- the hello interval for the global OSPFv3 process or interval 3 for individual address families + + + +Router(config Changes the dead interval to 12 seconds for the +-if)# ospfv3 OSPFv3 IPv6 address family. It is possible to modify 1 ipv6 dead- the dead interval for the global OSPFv3 process or for interval 12 individual address families + + + + + +Note + + +Hello and dead interval timers must match for routers to become neighbors + + + + + + + + +Note +The default hello timer is 10 seconds on multiaccess and point-to-point segments. The default hello timer is 30 seconds on nonbroadcast multiaccess (NBMA) segments such as Frame Relay, X.25, or ATM. +Note +The default dead interval timer is 40 seconds on multiaccess and point-to-point segments. The default hello timer is 120 seconds on NBMAsegments such as Frame Relay, X.25, or ATM. + + + + +Note +If you change the hello interval timer, the dead interval timer will automaticallybe adjusted to four times the new hello interval timer. + + + +IP MTU + +The IP maximum transmission unit (MTU) parameter determines the maximum size of a packet that can be forwarded without fragmentation. + + +Router(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Router(config-if)# ip Changes the MTU size to 1400 bytes. The mtu 1400 range of this command is 68 to 1500 +bytes + + + + + +Caution +The MTU size must match between all OSPF neighbors on a link. If OSPF routers have mismatched MTU sizes, theywill not form a neighbor adjacency. + + + +PROPAGATING A DEFAULT ROUTE + + + +Router(config)# Creates a default route ip route 0.0.0.0 +0.0.0.0 serial 0/0/0 +Router(config)# Starts OSPF process 1 router ospf 1 + + + +Router(config- Sets the default route to be propagated to all router)# default- OSPF routers +information originate + + + +Router(config- The always option will propagate a default router)# default- “quad-0” route even if this router does not have a information default route itself +originate always + + + + +Note + + +The default-information originate command or the default-information originate always command is usuallyconfigured on the “entrance” or “gateway” router, the router that connects your network to the outside world—the Autonomous System Boundary Router (ASBR) + + + + + + +Router(config-router-af)# default-information +originate + +Sets the default route to be propagated to all OSPFv3 routers for a specific address family + + + + + +Note + + + +This works for either IPv4 or IPv6 address-familyconfiguration mode + + + + + + +Router(config- +router-af)# + +Sets the default route to be propagated to all +OSPFv3 routers for a specific address family +default- +information + + +even if this router does not have a default route +itself + +originate always + + + + +Note + + +This works for either IPv4 or IPv6 address-familyconfiguration mode + + + + + + +ROUTE SUMMARIZATION + +In OSPF, there are two different types of summarization: + + +Interarea route summarization + +External route summarization + + + +Interarea Route Summarization + + + +Note +Interarea route summarization is to be configured on an ABR only. + + + + + +Note +Bydefault, ABRs do not summarize routes between areas. + + + + +Router(config)# Starts OSPF process 1 router ospf 1 + + + +Router(config- Summarizes area 1 routes to the specified router)# area 1 summary address, before injecting them into range 192.168.64.0 a different area +255.255.224.0 + + + +Router(config- Summarizes area 1 routes to the specified router-af)# area 1 summary address, before injecting them into range 192.168.64.0 a different area using the OSPFv3 IPv4 + +255.255.224.0 + + + +Router(config- + +address family + + + +Summarizes area 1 routes to the specified + + + +router-af)# area 1 +range + +summary address, before injecting them into +a different area using the OSPFv3 IPv6 + +2001:db8:0:10::/60 address family + + + +External Route Summarization + + + +Note +External route summarization is to be configured on an ASBR only. + + + + + +Note +Bydefault, ASBRs do not summarize routes. + + + + +Router(config)# Starts OSPF process 1 router ospf 1 + + + +Router(config- Advertises a single route for all the + +router)# summary- +address + +redistributed routes that are covered by a +specified network address and netmask + +192.168.64.0 255.255.224.0 + + + +Router(config- Advertises a single route for all the +router-af)# summary-prefix 192.168.64.0 255.255.224.0 + + + +Router(config-router-af)# summary-prefix +2001:db8:0:10::/60 + +redistributed routes that are covered by a specified network address and netmask in OSPFv3 IPv4 address family configuration mode + + + +Advertises a single route for all the redistributed routes that are covered by a specified network address and netmask in OSPFv3 IPv6 address family configuration +mode + + + + +OSPF ROUTE FILTERING + +This section covers four methods of applying route filtering to OSPF: + + +Using the filter-list command + +Using the area range not-advertise command + +Using the distribute-list in command + +Using the summary-address not-advertise command + + + +Using the filter-list Command + + +ABR(config)# ip prefix- Defines a prefix list called MyPFList list MyPFList permit that permits all 172.16.0.0 prefixes with 172.16.0.0/16 le 32 a mask between /16 and /32 + + + +ABR(config)# router Enters OSPF process 202 ospf 202 + + + +ABR(config-router)# Uses a prefix list called MyPFList to +area 1 filter-list filter Type-3 LSAs coming out of area 1 prefix MyPFList out + + + +ABR(config-router)# Uses a prefix list called MyPFList to area 1 filter-list filter Type-3 LSAs going into area 1 prefix MyPFList in + + + +Using the area range not-advertise Command + + +ABR(config)# router ospf Enters OSPF process 202 202 + + + +ABR(config-router)# area 1 Filters the 10.1.1.0/24 prefix from range 10.1.1.0 being advertised out of area 1 as a 255.255.255.0 not-advertise Type-3 Summary LSA + + + +Using the distribute-list in Command + + +ABR(config)# access-list Defines an ACL that permits the 1 permit 192.168.1.0 192.168.1.0/24 prefix 0.0.0.255 + + + +ABR(config)# router ospf Enters OSPF process 202 202 + + + +ABR(config-router)# Allows the router to only learn the distribute-list 1 in 192.168.1.0/24 prefix + + + + + +Note + + +The inbound logic does not filter inbound LSAs; it +instead filters the routes that SPF chooses to add to its own local routing table + + + + + + + + +Note +It is also possible to use a prefixlist or a route map with the distribute-list command instead of an ACL. + + + +Using the summary-address not-advertise Command + + +ASBR(config)# router ospf Enters OSPF process 202 202 + + + +ASBR(config-router)# Filters the 172.17.10/24 prefix from summary-address 172.17.10 being advertised into the OSPF 255.255.255.0 not- network as a Type-5 External LSA advertise + + + +Note + + +This command is onlyapplied to an ASBR + + + + + + + + +Note +Recall that the summary-address command is replaced bythe summary-prefix command under OSPFv3. + + + +OSPF SPECIAL AREA TYPES + +This section covers four different special areas with respect to OSPF: + + +Stub areas +Totally stubby areas + +Not-so-stubby areas (NSSAs) + +Totally NSSA + + + +Stub Areas + + +ABR(config)# router Starts OSPF process 1 ospf 1 + + + +ABR(config-router)# Read this line to say, “Any interface network 172.16.10.0 with an address of 172.16.10.x is to run 0.0.0.255 area 0 OSPF and be put into area 0” + + + +ABR(config-router)# Read this line to say, “Any interface network 172.16.20.0 with an address of 172.16.20.x is to run 0.0.0.255 area 51 OSPF and be put into area 51” + + + +ABR(config-router)# Defines area 51 as a stub area area 51 stub + + + +ABR(config-router)# Defines the cost of a default route sent area 51 default-cost 10 into the stub area. Default is 1 + + + + + +Note + + +This is an optional command + + + + + + +ABR(config-router-af)# Defines area 51 as a stub area in area 51 stub OSPFv3 address-family configuration +mode + + + + + +Note + + +The command works for both IPv4 and IPv6 address families + + + + + +Internal(config)# Starts OSPF process 1 router ospf 1 + + + +Internal(config- Read this line to say, “Any interface router)# network with an address of 172.16.20.x is to run 172.16.20.0 0.0.0.255 OSPF and be put into area 51” +area 51 + + + +Internal(config- Defines area 51 as a stub area router)# area 51 stub + + + +Note + + +All routers in the stub area must be configured with the area x stub command, including the Area Border Router (ABR) + + + + + +Internal(config-router- Defines area 51 as a stub area in af)# area 51 stub OSPFv3 address-family configuration +mode + + + + + +Note +The command works for both IPv4 and IPv6 address families + + + + + + +Totally Stubby Areas + + +ABR(config)# router Starts OSPF process 1 ospf 1 + + + +ABR(config-router)# Read this line to say, “Any interface network 172.16.10.0 with an address of 172.16.10.x is to run 0.0.0.255 area 0 OSPF and be put into area 0” + + + +ABR(config-router)# Read this line to say, “Any interface network 172.16.20.0 with an address of 172.16.20.x is to run 0.0.0.255 area 51 OSPF and be put into area 51” + + + +ABR(config-router)# Defines area 51 as a totally stubby area area 51 stub no-summary + + + +ABR(config-router-af)# Defines area 51 as a totally stubby area area 51 stub no-summary in OSPFv3 address-family configuration +mode + + + + + +Note + + +The command works for both IPv4 and IPv6 address families + + + + + +Internal(config)# Starts OSPF process 1 +router ospf 1 + + + +Internal(config- Read this line to say, “Any interface router)# network with an address of 172.16.20.x is to run 172.16.20.0 0.0.0.255 OSPF and be put into area 51” +area 51 + + + +Internal(config- Defines area 51 as a stub area router)# area 51 stub + + + +Note + + +Whereas all internal routers in the area are configured with the area x stub command, the ABR is configured with the area x stub no-summary command + + + + + +Internal(config-router- Defines area 51 as a stub area in af)# area 51 stub OSPFv3 address-family configuration +mode + + + + + +Note + + +The command works for both IPv4 and IPv6 address families + + + + + + +Not-So-Stubby Areas (NSSA) + + +ABR(config)# router Starts OSPF process 1 ospf 1 +ABR(config-router)# Read this line to say, “Any interface with network 172.16.10.0 an address of 172.16.10.x is to run OSPF 0.0.0.255 area 0 and be put into area 0” + + + +ABR(config-router)# Read this line to say, “Any interface with network 172.16.20.0 an address of 172.16.20.x is to run OSPF 0.0.0.255 area 1 and be put into area 1” + + + +ABR(config-router)# Defines area 1 as an NSSA area 1 nssa + + + +ABR(config-router-af)# Defines area 1 as an NSSA in OSPFv3 area 1 nssa address-family configuration mode + + + + + +Note + + +The command works for both IPv4 and IPv6 address families + + + + + +Internal(config)# Starts OSPF process 1 router ospf 1 + + + +Internal(config- Read this line to say, “Any interface with router)# network an address of 172.16.20.x is to run OSPF 172.16.20.0 0.0.0.255 and be put into area 1” +area 1 + + + +Internal(config- Defines area 1 as an NSSA router)# area 1 nssa +Note + + +All routers in the NSSAstub area must be configured with the area x nssa command + + + + + +Internal(config-router- Defines area 1 as an NSSA in OSPFv3 af)# area 1 nssa address-family configuration mode + + + + + +Note + + +The command works for both IPv4 and IPv6 address families + + + + + + +Totally NSSA + + +ABR(config)# router Starts OSPF process 1 ospf 1 + + + +ABR(config-router)# Read this line to say, “Any interface with network 172.16.10.0 an address of 172.16.10.x is to run OSPF 0.0.0.255 area 0 and be put into area 0” + + + +ABR(config-router)# Read this line to say, “Any interface with network 172.16.20.0 an address of 172.16.20.x is to run OSPF 0.0.0.255 area 11 and be put into area 11” + + + +ABR(config-router)# Defines area 11 as a totally NSSA area 11 nssa no- +summary +ABR(config-router-af)# Defines area 11 as a totally NSSA in area 11 nssa no- OSPFv3 address-family configuration summary mode + + + + + +Note + + +The command works for both IPv4 and IPv6 address families + + + + + +Internal(config)# Starts OSPF process 1 router ospf 1 + + + +Internal(config- Read this line to say, “Any interface with router)# network an address of 172.16.20.x is to run OSPF 172.16.20.0 0.0.0.255 and be put into area 11” +area 11 + + + +Internal(config- Defines area 11 as an NSSA router)# area 11 nssa + + + +Note + + +Whereas all internal routers in the area, including the ASBR, are configured with the area x nssa command, the ABR is configured with the area x nssa no-summarycommand + + + + + +Internal(config- Defines area 11 as a totally NSSA in + +router-af)# area 11 +nssa + +OSPFv3 address-family configuration +mode +Note + + +The command works for both IPv4 and IPv6 address families + + + + + + +VIRTUAL LINKS + +In OSPF, all areas must be connected to a backbone area. If there is a break in backbone continuity, or the backbone is purposefully partitioned, you can establish a virtual link. The two endpoints of a virtual link are ABRs. The virtual link must be configured in both routers. The configuration information in each router consists of the other virtual endpoint (the other ABR) and the non-backbone area that the two routers have in common (called the transit area). A virtual link is a temporary solution to a topology problem. + + + +Note +Virtual links cannot be configured through stub areas. + + + + + +Note +One of these two routers must be connected to the backbone. + + + + + +Note +The routers establishing the virtual link do not have to be directlyconnected. + + + +Configuration Example: Virtual Links + +Figure 5-1 shows the network topology for the configuration that follows, which demonstrates how to create a virtual link. + + + + + + + +Figure 5-1 Virtual Areas: OSPF + + + + +RTA(config)# router Starts OSPF process 1 ospf 1 + + + +RTA(config-router)# Sets the router ID to 10.0.0.2 router-id 10.0.0.2 + + + +RTA(config-router)# Read this line to say, “Any interface with network 192.168.0.0 an address of 192.168.0.x is to run OSPF 0.0.0.255 area 51 and be put into area 51” + + + +RTA(config-router)# Read this line to say, “Any interface with network 192.168.1.0 an address of 192.168.1.x is to run OSPF 0.0.0.255 area 3 and be put into area 3” + + + +RTA(config-router)# Creates a virtual link with RTB area 3 virtual-link +10.0.0.1 + + + +RTB(config)# router Starts OSPF process 1 ospf 1 + + + +RTB(config-router)# Sets the router ID to 10.0.0.1 router-id 10.0.0.1 +RTB(config-router)# Read this line to say, “Any interface with network 192.168.1.0 an address of 192.168.1.x is to run OSPF 0.0.0.255 area 3 and be put into area 3” + + + +RTB(config-router)# Read this line to say, “Any interface with network 192.168.2.0 an address of 192.168.2.x is to run OSPF 0.0.0.255 area 0 and be put into area 0” + + + +RTB(config-router)# Creates a virtual link with RTA area 3 virtual-link +10.0.0.2 + + + + + +Note +According to RFC 5838, OSPFv3 onlysupports virtual links for the IPv6 address family. Virtual links are not supported for the IPv4 address family. + + + +VERIFYING OSPF CONFIGURATION + + + +Router# show ip Displays parameters for all protocols protocols running on the router + + + + +Router# show ip route + + + +Router# show ip route ospf + + + +Router# show ip route +ospfv3 + +Displays a complete IP routing table + + + +Displays the OSPF routes in the routing table + + + +Displays the OSPFv3 routes in the +routing table +Router# show ip ospf + + + + + +Router# show ip ospf + +Displays basic information about OSPF routing processes + + + +Displays border and boundary router + +border-routers information + + + +Router# show ip ospf Displays the contents of the OSPF database database + + + +Router# show ip ospf Displays Type-4 LSAs database asbr-summary + + + +Router# show ip ospf Displays Type-5 LSAs database external + + + +Router# show ip ospf Displays NSSA external link states database nssa-external + + + +Router# show ip ospf Displays network LSAs + + + +database network + + + +Router# show ip ospf Displays locally generated LSAs database router self- +originate + + + +Router# show ip ospf Displays a summary of the OSPF database summary database + + + +Router# show ip ospf Displays OSPF info as it relates to all +interface interfaces + + + +Router# show ip ospf Displays OSPF information for interface interface GigabitEthernet 0/0 gigabitethernet 0/0 + + + +Router# show ip ospf Lists all OSPF neighbors and their neighbor states + + + +Router# show ip ospf Displays a detailed list of neighbors neighbor detail + + + +Router# show ipv6 Displays the status of interfaces interface configured for IPv6 + + + +Router# show ipv6 Displays a summarized status of interface brief interfaces configured for IPv6 + + + +Router# show ipv6 Displays IPv6 neighbor discovery cache neighbors information + + + + +Router# show ipv6 ospf + + + + + +Router# show ipv6 ospf + +Displays general information about the OSPFv3 routing process + + + +Displays the internal OSPF routing table + +border-routers entries to an ABR or ASBR + + + +Router# show ipv6 ospf Displays OSPFv3-related database database information +Router# show ipv6 ospf Displays how many of each type of LSA database database- exist for each area in the database summary + + + +Router# show ipv6 ospf Displays OSPFv3-related interface interface information + + + +Router# show ipv6 ospf Displays OSPFv3-related neighbor neighbor information + + + +Router# show ipv6 ospf Displays parameters and the current virtual-links state of OSPFv3 virtual links + + + +Router# show ipv6 Displays the parameters and current protocols state of the active IPv6 routing protocol +processes + + + + +Router# show ipv6 route + + + +Router# show ipv6 route +summary + +Displays the current IPv6 routing table + + + +Displays a summarized form of the +current IPv6 routing table + + + + + +Router# show ipv6 routers + + + +Router# show ipv6 +traffic + +Displays IPv6 router advertisement information received from other routers + + + +Displays statistics about IPv6 traffic + + + + +Router# show ip ospf Displays information about virtual links virtual-links +Router# show ospfv3 Displays the OSPFv3 database database + + + + +Router# show ospfv3 Displays OSPFv3 neighbor information neighbor on a per-interface basis + + + +TROUBLESHOOTING OSPF + + + +Router# clear ip Clears the entire routing table, forcing it to route * rebuild + + + +Router# clear ip Clears a specific route to network a.b.c.d route a.b.c.d + + + +Router# clear ipv6 Deletes all routes from the IPv6 routing table route * + + + + +Router# clear ipv6 +route + +Clears this specific route from the IPv6 +routing table + +2001:db8:c18:3::/64 + + + + +Router# clear ipv6 traffic + + + +Router# clear ip + +Resets IPv6 traffic counters + + + + + +Resets OSPF counters + +ospf counters + + + +Router# clear ip Resets the entire OSPF process, forcing OSPF ospf process to re-create neighbors, database, and routing +table + + + +Router# clear ip Resets OSPF process 13, forcing OSPF to re-ospf 13 process create neighbors, database, and routing table + + + +Router# clear ipv6 Resets the entire OSPFv3 process, forcing ospf process OSPFv3 to re-create neighbors, database, and +routing table + + + +Router# clear ipv6 Resets OSPFv3 process 13, forcing OSPF to ospf 13 process re-create neighbors, database, and routing +table + + + +Router# debug ip Displays all OSPF events ospf events + + + +Router# debug ip Displays various OSPF states and DR/BDR ospf adjacency election between adjacent routers + + + +Router# debug ipv6 Displays debug messages about the OSPF ospf adjacency adjacency process + + + + +Router# debug ipv6 packet + + + +Router# debug ip + +Displays debug messages for IPv6 packets + + + + + +Displays information about each OSPF packet + +ospf packet received + + + + +Router# debug ipv6 +routing + +Displays debug messages for IPv6 routing +table updates and route cache updates +Router# undebug all Turns off all debug commands + + + + +CONFIGURATION EXAMPLE: SINGLE-AREA OSPF Figure 5-2 shows the network topology for the configuration that follows, which demonstrates how to configure single-area OSPF using the commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 5-2 Network Topology for Single-Area OSPF Configuration + + +Austin Router + + +Austin(config)# router Starts OSPF process 1 ospf 1 +Austin(config-router)# Read this line to say, “Any interface with network 172.16.10.0 an address of 172.16.10.x is to run OSPF 0.0.0.255 area 0 and be put into area 0” + + + +Austin(config-router)# Read this line to say, “Any interface with network 172.16.20.0 an address of 172.16.20.x is to run OSPF 0.0.0.255 area 0 and be put into area 0” + + + +Austin(config-router)# Returns to privileged EXEC mode z + + + +Austin# copy running- Saves the configuration to NVRAM config startup-config + + + +OR + + + +Austin(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Austin(config-if)# ip Enables OSPF area 0 on this interface ospf 1 area 0 + + + +Austin(config-if)# Moves to interface configuration mode interface serial 0/0/0 + + + +Austin(config-if)# ip Enables OSPF area 0 on this interface ospf 1 area 0 + + + +Austin(config-if)# Returns to privileged EXEC mode z +Austin# copy running- Saves the configuration to NVRAM config startup-config + + + +Houston Router + + +Houston(config)# Starts OSPF process 1 router ospf 1 + + + +Houston(config- Read this line to say, “Any interface with an router)# network address of 172.16.x.x is to run OSPF and be put + +172.16.0.0 +0.0.255.255 area 0 + +into area 0.” One statement will now advertise +all three interfaces + + + + +Houston(config- Returns to privileged EXEC mode + +router)# + + + +Houston# + + z + + + +copy Saves the configuration to NVRAM + +running-config startup-config + + + +OR + + + + +Houston(config)# interface gigabitethernet 0/0 + + + +Houston(config- + +Moves to interface configuration mode + + + + + + + + + +Enables OSPF area 0 on this interface + +if)# ip ospf 1 area 0 +Houston(config- Moves to interface configuration mode if)# interface +serial 0/0/0 + + + +Houston(config- Enables OSPF area 0 on this interface if)# ip ospf 1 +area 0 + + + +Houston(config)# Moves to interface configuration mode interface serial +0/0/1 + + + +Houston(config- Enables OSPF area 0 on this interface if)# ip ospf 1 +area 0 + + + +Houston(config- Returns to privileged EXEC mode if)# z + + + +Houston# copy Saves the configuration to NVRAM running-config +startup-config + + + +Galveston Router + + +Galveston(config)# Starts OSPF process 1 router ospf 1 + + + +Galveston(config- Read this line to say, “Any interface with router)# network an exact address of 172.16.40.2 is to run +172.16.40.2 0.0.0.0 OSPF and be put into area 0” area 0 + +This is the most precise way to place an exact address into the OSPF routing process + + + +Galveston(config- Read this line to say, “Any interface with router)# network an exact address of 172.16.50.1 is to be 172.16.50.1 0.0.0.0 put into area 0” +area 0 + + + +Galveston(config- Returns to privileged EXEC mode router)# z + + + +Galveston# copy Saves the configuration to NVRAM running-config +startup-config + + + +OR + + + +Galveston(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Galveston(config-if)# Enables OSPF area 0 on this interface ip ospf 1 area 0 + + + +Galveston(config-if)# Moves to interface configuration mode interface serial 0/0/1 + + + +Galveston(config-if)# Enables OSPF area 0 on this interface +ip ospf 1 area 0 + + + +Galveston(config-if)# Returns to privileged EXEC mode z + + + +Galveston# copy Saves the configuration to NVRAM running-config +startup-config + + + +CONFIGURATION EXAMPLE: MULTIAREA OSPF Figure 5-3 shows the network topology for the configuration that follows, which demonstrates how to configure multiarea OSPF using the commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 5-3 Network Topology for Multiarea OSPF Configuration + + +ASBR Router +Router> enable + + + +Router# configure terminal + + + +Router(config + +Moves to privileged EXEC mode + + + + + +Moves to global configuration mode + + + + + + + +Sets the router host name + +)# hostname ASBR + + + +ASBR(config)# Enters loopback interface mode interface +loopback 0 + + + +ASBR(config- Assigns an IP address and netmask if)# ip +address 192.168.1.1 255.255.255.2 55 + + + +ASBR(config- Sets a locally significant description if)# +description Router ID + + +ASBR(config- Returns to global configuration mode if)# exit + + + +ASBR(config)# Creates default route. Using both an exit interface +ip route and next-hop address on a GigabitEthernet interface 0.0.0.0 prevents recursive lookups in the routing table 0.0.0.0 +10.1.0.2 gigabitethern et 1/1 + + + +ASBR(config)# Creates a static route to a null interface. In this +ip route example, these routes represent a simulated remote + +11.0.0.0 255.0.0.0 null0 + + + +ASBR(config)# + +destination + + + + + + + +Creates a static route to a null interface. In this + +ip route example, these routes represent a simulated remote + +12.0.0.0 255.0.0.0 null0 + + + +ASBR(config)# + +destination + + + + + + + +Creates a static route to a null interface. In this + +ip route example, these routes represent a simulated remote + +13.0.0.0 255.0.0.0 null0 + + + +ASBR(config)# interface +gigabitethern + +destination + + + + + + + +Enters interface configuration mode + +et 1/0 + + + +ASBR(config- Enables OSPF area 0 on this interface. Also creates if)# ip ospf the OSPF routing process +1 area 0 + + + + +ASBR(config)# exit + + + +ASBR(config)# + +Returns to global configuration mode + + + + + +Enters OSPF configuration mode + +router ospf 1 + + + + +ASBR(config-router)# default-information originate + + + +ASBR(config-router)# redistribute static + + + + +ASBR(config- + +Sets the default route to be propagated to all OSPF routers + + + + + + + + +Redistributes static routes into the OSPF process. This turns the router into an ASBR because static routes are not part of OSPF, and the definition of an ASBR is a router that sits between OSPF and another routing process—in this case, static routing + + + +Returns to global configuration mode + +router)# exit + + + +ASBR(config)# Returns to privileged EXEC mode exit + + + +ASBR# copy Saves the configuration to NVRAM running- +config startup- +config + + + +ABR-1 Router + + + +Router> + + + +Router# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Router(config)# hostname Sets the router host name ABR-1 + + + +ABR-1(config)# interface Enters loopback interface mode loopback 0 + + + +ABR-1(config-if)# ip Assigns an IP address and netmask address 192.168.2.1 +255.255.255.255 + + + +ABR-1(config-if)# Sets a locally significant description description Router ID + + + +ABR-1(config-if)# exit Returns to global configuration mode + + + +ABR-1(config)# interface Enters interface configuration mode gigabitethernet 0/1 + + + +ABR-1(config-if)# ip Enables OSPF on this interface and ospf 1 area 0 creates the OSPF routing process +ABR-1(config-if)# ip Sets the priority for the DR/BDR ospf priority 200 election process. This router will win +and become the DR + + + +ABR-1(config-if)# exit Returns to global configuration mode + + + +ABR-1(config)# interface Enters interface configuration mode gigabitethernet 0/0 + + + +ABR-1(config-if)# ip Enables OSPF on this interface ospf 1 area 51 + + + +ABR-1(config-if)# exit Returns to global configuration mode + + + +ABR-1(config)# exit Returns to privileged EXEC mode + + + +ABR-1# copy running- Saves the configuration to NVRAM config startup-config + + + +ABR-2 Router + + + +Router> + + + +Router# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Router(config)# Sets the router host name hostname ABR-2 + + + +ABR-2(config)# Enters loopback interface mode +interface loopback 0 + + + +ABR-2(config-if)# Assigns an IP address and netmask ip address +192.168.3.1 255.255.255.255 + + + +ABR-2(config-if)# Sets a locally significant description description +Router ID + + + + +ABR-2(config-if)# exit + + + +ABR-2(config)# interface gigabitethernet 0/0 + + + +ABR-2(config-if)# + +Returns to global configuration mode + + + + + +Enters interface configuration mode + + + + + + + + + +Places this interface into OSPF area 0 and + +ip ospf 1 area 0 enables the OSPF routing process + + + +ABR-2(config-if)# Sets the priority for the DR/BDR election ip ospf priority process. This router will become the BDR to + +100 + + + +ABR-2(config)# + + +ABR-1’s DR + + + +Enters interface configuration mode + +interface serial 0/0/0 +ABR-2(config-if)# Places this interface into OSPF area 0 and ip ospf 1 area 1 enables the OSPF routing process + + + +ABR-2(config-if)# exit + + + +ABR-2(config)# + +Returns to global configuration mode + + + + + +Enters OSPF process 1 + +router ospf 1 + + + +ABR-2(config- Makes area 1 a stub area. Type-4 and Type-5 + +router)# area 1 +stub + +LSAs are blocked and not sent into area 1. A default route is injected into the stub area, +pointing to the ABR + + + + +ABR-2(config- Returns to global configuration mode router)# exit + + + +ABR-2(config)# Returns to privileged EXEC mode exit + + + +ABR-2# copy Saves the configuration to NVRAM running-config +startup-config + + + +Internal Router + + +Router> enable Moves to privileged EXEC mode + + + +Router# configure terminal Moves to global configuration mode +Router(config)# hostname Sets the router host name Internal + + + +Internal(config)# interface Enters loopback interface mode loopback 0 + + + +Internal(config-if)# ip Assigns an IP address and netmask address 192.168.4.1 +255.255.255.255 + + + +Internal(config-if)# Sets a locally significant description Router ID description + + + +Internal(config)# interface Enters interface configuration serial 0/0/0 mode + + + +Internal(config-if)# ip Places this interface into OSPF ospf 1 area 1 area 1 and enables the OSPF +routing process + + + +Internal(config)# interface Enters interface configuration gigabitethernet 0/0 mode + + + +Internal(config-if)# ip Places this interface into OSPF ospf 1 area 1 area 1 + + + +Internal(config-if)# exit Returns to global configuration mode + + + +Internal(config)# router Enters OSPF process 1 ospf 1 +Internal(config-router)# Makes area 1 a stub area area 1 stub + + + + +Internal(config-router)# +exit + +Returns to global configuration +mode + + + + +Internal(config)# exit Returns to privileged EXEC mode + + + +Internal# copy running- Saves the configuration to NVRAM config startup-config + + + +CONFIGURATION EXAMPLE: TRADITIONAL OSPFV3 + +Figure 5-4 shows the network topology for the configuration that follows, which demonstrates how to configure traditional OSPFv3 using the commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + + + + + +Figure 5-4 Network Topology for Traditional OSPFv3 Configuration +R3 Router + + +R3(config)# Enables the forwarding of IPv6 unicast datagrams ipv6 unicast- globally on the router. This command is required + +routing + + + +R3(config)# + + +before any IPv6 routing protocol can be configured + + + +Moves to OSPFv3 router configuration mode + +ipv6 router ospf 1 + + + + +R3(config-rtr)# router-id 3.3.3.3 + + + +R3(config-rtr)# exit + + + +R3(config)# interface gigabitethernet 0/0 + + + +R3(config-if)# + +Sets a manually configured router ID + + + + + + + +Returns to global configuration mode + + + + + +Moves to interface configuration mode + + + + + + + + + +Configures a global IPv6 address on the interface + +ipv6 address and enables IPv6 processing on the interface 2001:db8:0:1::3 +/64 + + + +R3(config-if)# Enables OSPFv3 on the interface and places this ipv6 ospf 1 interface into area 1 +area 1 + + + +R3(config-if)# Enables the interface +no shutdown + + + +R3(config-if)# Moves to interface configuration mode interface +loopback 0 + + + +R3(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:0:2::1 +/64 + + + +R3(config-if)# Enables OSPFv3 on the interface and places this ipv6 ospf 1 interface into area 1 +area 1 + + + + +R3(config-if)# exit + + + +R3(config)# +exit + +Moves to global configuration mode + + + + + +Moves to privileged EXEC mode + + + + +R3# copy Saves the configuration to NVRAM running-config +startup-config + + + +R2 Router + + +R2(config)# Enables the forwarding of IPv6 unicast datagrams ipv6 unicast- globally on the router. This command is required routing before any IPv6 routing protocol can be configured +R2(config)# Moves to OSPFv3 router configuration mode ipv6 router +ospf 1 + + + + +R2(config-rtr)# router-id 2.2.2.2 + + + +R2(config-rtr)# exit + + + +R2(config)# interface gigabitethernet 0/0 + + + +R2(config-if)# + +Sets a manually configured router ID + + + + + + + +Returns to global configuration mode + + + + + +Moves to interface configuration mode + + + + + + + + + +Configures a global IPv6 address on the interface + +ipv6 address and enables IPv6 processing on the interface 2001:db8:0:1::2 +/64 + + + +R2(config-if)# Enables OSPFv3 on the interface and places this ipv6 ospf 1 interface into area 1 +area 1 + + + +R2(config-if)# Enables the interface no shutdown + + + +R2(config-if)# Moves to interface configuration mode interface +loopback 0 +R2(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:0:3::1 +/64 + + + +R2(config-if)# Enables OSPFv3 on the interface and places this ipv6 ospf 1 interface into area 1 +area 1 + + + +R2(config-if)# Enables the interface no shutdown + + + + +R2(config-if)# exit + + + +R2(config)# +exit + +Moves to global configuration mode + + + + + +Moves to privileged EXEC mode + + + + +R2# copy Saves the configuration to NVRAM running-config +startup-config + + + +R1 Router + + +R1(config)# Enables the forwarding of IPv6 unicast datagrams ipv6 unicast- globally on the router. This command is required + +routing + + + +R1(config)# + + +before any IPv6 routing protocol can be configured + + + +Moves to OSPFv3 router configuration mode + +ipv6 router ospf 1 +R1(config-rtr)# router-id 1.1.1.1 + + + +R1(config-rtr)# exit + + + +R1(config)# interface gigabitethernet 0/0 + + + +R1(config-if)# + +Sets a manually configured router ID + + + + + + + +Returns to global configuration mode + + + + + +Moves to interface configuration mode + + + + + + + + + +Configures a global IPv6 address on the interface + +ipv6 address and enables IPv6 processing on the interface 2001:db8:0:1::1 +/64 + + + +R1(config-if)# Enables OSPFv3 on the interface and places this ipv6 ospf 1 interface into area 1 +area 1 + + + +R1(config-if)# Enables the interface no shutdown + + + +R1(config-if)# Moves to interface configuration mode interface +serial 0/0/0 + + + +R1(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:0:7::1 +/64 + + + +R1(config-if)# Enables OSPFv3 on the interface and places this ipv6 ospf 1 interface into area 0 +area 0 + + + +R1(config-if)# Assigns a clock rate to this interface clock rate +4000000 + + + +R1(config-if)# Enables the interface no shutdown + + + + +R1(config-if)# exit + + + +R1(config)# +exit + +Moves to global configuration mode + + + + + +Moves to privileged EXEC mode + + + + +R1# copy Saves the configuration to NVRAM running-config +startup-config + + + +R4 Router + + +R4(config)# Enables the forwarding of IPv6 unicast datagrams ipv6 unicast- globally on the router. This command is required + +routing + + + +R4(config)# + + +before any IPv6 routing protocol can be configured + + + +Moves to OSPFv3 router configuration mode + +ipv6 router +ospf 1 + + + + +R4(config-rtr)# router-id 4.4.4.4 + + + +R4(config-rtr)# exit + + + +R4(config)# +interface + +Sets a manually configured router ID + + + + + + + +Returns to global configuration mode + + + + + +Moves to interface configuration mode + +serial 0/0/0 + + + +R4(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:0:7::2 +/64 + + + +R4(config-if)# Enables OSPFv3 on the interface and places this ipv6 ospf 1 interface into area 1 +area 0 + + + +R4(config-if)# Enables the interface no shutdown + + + + +R4(config-if)# exit + + + +R4(config)# +exit + +Moves to global configuration mode + + + + + +Moves to privileged EXEC mode +R4# copy Saves the configuration to NVRAM running-config +startup-config + + + + +CONFIGURATION EXAMPLE: OSPFV3 WITH ADDRESS FAMILIES + +Figure 5-5 shows the network topology for the configuration that follows, which demonstrates how to configure OSPFv3 address families using the commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 5-5 Network Topology for OSPFv3 Address Families Configuration + + +R1 Router + + +R1(config)# ipv6 Enables the forwarding of IPv6 unicast datagrams unicast-routing globally on the router. This command is required +before any IPv6 routing protocol can be configured +R1(config)# Moves to interface configuration mode interface +loopback 0 + + + +R1(config-if)# Assigns an IP address and netmask ip address +192.168.1.1 255.255.255.0 + + + +R1(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:0:1::1/ +64 + + + + +R1(config-if)# interface gigabitethernet 0/0 + + + +R1(config-if)# + +Moves to interface configuration mode + + + + + + + + + +Assigns an IP address and netmask + +ip address 172.16.1.1 255.255.255.0 + + + +R1(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:1:1::1/ +64 + + + +R1(config-if)# Enables the interface no shutdown +R1(config-if)# exit + + + +R1(config)# + +Returns to global configuration mode + + + + + +Enables OSPFv3 router configuration mode for + +router ospfv3 1 the IPv4 or IPv6 address family + + + +R1(config- Configures the router to send a syslog message router)# log- when an OSPFv3 neighbor goes up or down adjacency- +changes + + + +R1(config- Configures a fixed router ID router)# router- +id 1.1.1.1 + + + + +R1(config- +router)# + +Enters IPv6 address family configuration mode +for OSPFv3 + +address- family ipv6 unicast + + + + +R1(config-router-af)# passive- +interface + +Prevents interface loopback 0 from exchanging +any OSPF packets, including hello packets + +loopback 0 + + + + +R1(config-router-af)# +address-family + +Enters IPv4 address family configuration mode +for OSPFv3 + +ipv4 unicast +R1(config-router-af)# passive- +interface + +Prevents interface loopback 0 from exchanging +any OSPF packets, including hello packets + +loopback 0 + + + +R1(config- Returns to OSPFv3 router configuration mode router-af)# exit + + + +R1(config- Returns to global configuration mode router)# exit + + + +R1(config)# Moves to interface configuration mode interface +loopback 0 + + + +R1(config-if)# Enables OSPFv3 instance 1 with the IPv6 address ospfv3 1 ipv6 family in area 0 +area 0 + + + +R1(config-if)# Enables OSPFv3 instance 1 with the IPv4 address ospfv3 1 ipv4 family in area 0 +area 0 + + + + +R1(config-if)# interface gigabitethernet 0/0 + + + +R1(config-if)# + +Moves to interface configuration mode + + + + + + + + + +Enables OSPFv3 instance 1 with the IPv6 address + +ospfv3 1 ipv6 family in area 0 +area 0 + + + +R1(config-if)# Enables OSPFv3 instance 1 with the IPv4 address ospfv3 1 ipv4 family in area 0 +area 0 + + + +R1(config-if)# Returns to global configuration mode exit + + + +R1(config)# exit Returns to privileged EXEC mode + + + +R1# copy Copies the running configuration to NVRAM running-config +startup-config + + + +R2 Router + + +R2(config)# ipv6 Enables the forwarding of IPv6 unicast datagrams + +unicast-routing + + + + + + + +R2(config)# +interface + +globally on the router. This command is required before any IPv6 routing protocol can be configured + + + +Moves to interface configuration mode + +loopback 0 + + + +R2(config-if)# Assigns an IP address and netmask ip address +192.168.2.1 255.255.255.0 +R2(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:0:2::1/ +64 + + + + +R2(config-if)# interface gigabitethernet 0/0 + + + +R2(config-if)# + +Moves to interface configuration mode + + + + + + + + + +Assigns an IP address and netmask + +ip address 172.16.1.2 255.255.255.0 + + + +R2(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:1:1::2/ +64 + + + +R2(config-if)# Enables the interface no shutdown + + + + +R2(config-if)# exit + + + +R2(config)# + +Returns to global configuration mode + + + + + +Enables OSPFv3 router configuration mode for + +router ospfv3 1 the IPv4 or IPv6 address family + + + +R2(config- Configures the router to send a syslog message router)# log- when an OSPFv3 neighbor goes up or down adjacency- +changes + + + + +R2(config- Configures a fixed router ID router)# router- +id 2.2.2.2 + + + + +R2(config-router)# +address-family + +Enters IPv6 address family configuration mode +for OSPFv3 + +ipv6 unicast + + + + +R2(config-router-af)# passive- +interface + +Prevents interface loopback 0 from exchanging +any OSPF packets, including hello packets + +loopback 0 + + + + +R2(config-router-af)# +address-family + +Enters IPv4 address family configuration mode +for OSPFv3 + +ipv4 unicast + + + + +R2(config-router-af)# passive- +interface + +Prevents interface loopback 0 from exchanging +any OSPF packets, including hello packets + +loopback 0 + + + +R2(config- Returns to OSPFv3 router configuration mode router-af)# exit +R2(config- Returns to global configuration mode router)# exit + + + +R2(config)# Moves to interface configuration mode interface +loopback 0 + + + +R2(config-if)# Enables OSPFv3 instance 1 with the IPv6 address ospfv3 1 ipv6 family in area 0 +area 0 + + + +R2(config-if)# Enables OSPFv3 instance 1 with the IPv4 address ospfv3 1 ipv4 family in area 0 +area 0 + + + + +R2(config-if)# interface gigabitethernet 0/0 + + + +R2(config-if)# + +Moves to interface configuration mode + + + + + + + + + +Enables OSPFv3 instance 1 with the IPv6 address + +ospfv3 1 ipv6 family in area 0 area 0 + + + +R2(config-if)# Enables OSPFv3 instance 1 with the IPv4 address ospfv3 1 ipv4 family in area 0 +area 0 + + + +R2(config-if)# Returns to global configuration mode exit +R2(config)# exit Returns to privileged EXEC mode + + + +R2# copy Copies the running configuration to NVRAM running-config +startup-config + + + +R3 Router + + +R3(config)# ipv6 Enables the forwarding of IPv6 unicast datagrams + +unicast-routing + + + + + + + +R3(config)# +interface + +globally on the router. This command is required before any IPv6 routing protocol can be configured + + + +Moves to interface configuration mode + +loopback 0 + + + +R3(config-if)# Assigns an IP address and netmask ip address +192.168.3.1 255.255.255.0 + + + +R3(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:0:3::1/ +64 + + + +R3(config-if)# Moves to interface configuration mode interface +gigabitethernet 0/0 +R3(config-if)# Assigns an IP address and netmask ip address +172.16.1.3 255.255.255.0 + + + +R3(config-if)# Configures a global IPv6 address on the interface ipv6 address and enables IPv6 processing on the interface 2001:db8:1:1::3/ +64 + + + +R3(config-if)# Enables the interface no shutdown + + + + +R3(config-if)# exit + + + +R3(config)# + +Returns to global configuration mode + + + + + +Enables OSPFv3 router configuration mode for + +router ospfv3 1 the IPv4 or IPv6 address family + + + +R3(config- Configures the router to send a syslog message router)# log- when an OSPFv3 neighbor goes up or down adjacency- +changes + + + +R3(config- Configures a fixed router ID router)# router- +id 3.3.3.3 + + + + +R3(config-router)# +address-family + +Enters IPv6 address family configuration mode +for OSPFv3 +ipv6 unicast + + + + +R3(config-router-af)# passive- +interface + +Prevents interface loopback 0 from exchanging +any OSPF packets, including hello packets + +loopback 0 + + + + +R3(config-router-af)# +address-family + +Enters IPv4 address family configuration mode +for OSPFv3 + +ipv4 unicast + + + + +R3(config-router-af)# passive- +interface + +Prevents interface loopback 0 from exchanging +any OSPF packets, including hello packets + +loopback 0 + + + +R3(config- Returns to OSPFv3 router configuration mode router-af)# exit + + + +R3(config- Returns to global configuration mode router)# exit + + + +R3(config)# Moves to interface configuration mode interface +loopback 0 + + + +R3(config-if)# Enables OSPFv3 instance 1 with the IPv6 address ospfv3 1 ipv6 family in area 0 +area 0 + + + +R3(config-if)# Enables OSPFv3 instance 1 with the IPv4 address ospfv3 1 ipv4 family in area 0 +area 0 + + + + +R3(config-if)# interface gigabitethernet 0/0 + + + +R3(config-if)# + +Moves to interface configuration mode + + + + + + + + + +Enables OSPFv3 instance 1 with the IPv6 address + +ospfv3 1 ipv6 family in area 0 area 0 + + + +R3(config-if)# Enables OSPFv3 instance 1 with the IPv4 address ospfv3 1 ipv4 family in area 0 +area 0 + + + +R3(config-if)# Returns to global configuration mode exit + + + +R3(config)# exit Returns to privileged EXEC mode + + + +R3# copy Copies the running configuration to NVRAM running-config +startup-config +Chapter 6 + +Redistribution and Path Control + + + + + +This chapter provides information about the following redistribution and path control topics: + + +Defining seed and default metrics + +Redistributing connected networks + +Redistributing static routes + +Redistributing subnets into OSPF + +Assigning E1 or E2 routes in OSPF + +Redistributing OSPF internal and external routes + +Configuration example: route redistribution for IPv4 + +Configuration example: route redistribution for IPv6 + +Verifying route redistribution + +Route filtering using the distribute-list command + + +Configuration example: inbound and outbound distribute list route filters + +Configuration example: controlling redistribution with outbound distribute lists + +Verifying route filters + + + +Route filtering using prefix lists +Configuration example: using a distribute list that references a prefix list to control redistribution + +Verifying prefix lists + + + +Using route maps with route redistribution + + +Configuration example: route maps + + + +Manipulating redistribution using route tagging + +Changing administrative distance + +Path control with policy-based routing + +Verifying policy-based routing + +Configuration example: PBR with route maps + +Cisco IOS IP SLA + + +Configuring Authentication for IP SLA + +Monitoring IP SLA Operations + + + +PBR with Cisco IOS IP SLA + + +Step 1: Define Probe(s) + +Step 2: Define Tracking Object(s) + +Step 3a: Define the Action on the Tracking Object(s) + +Step 3b: Define Policy Routing Using the Tracking Object(s) + +Step 4: Verify IP SLA Operations + + + +DEFINING SEED AND DEFAULT METRICS +Router(config)# Starts the EIGRP routing process router eigrp 100 + + + +Router(config- Specifies which network to advertise in router)# network EIGRP +172.16.0.0 + + + + +Router(config- +router)# + +Redistributes routes learned from OSPF into +EIGRP + +redistribute ospf 1 + + + +Router(config- The metrics assigned to these learned routes router)# default- will be calculated using the following metric 1000 100 250 components: +1 1500 + +1000 = Bandwidth in Kbps Or + +100 = Delay in tens of microseconds Router(config- +router)# 255 = Reliability out of 255 +redistribute ospf 1 +metric 1000 100 255 +1 1500 1 = Load out of 255 + + + +1500 = Maximum transmission unit (MTU) size + + + +The metric keyword in the second option assigns a starting EIGRP metric that is calculated using the following components: 1000, 100, 255, 1 1500 +Note +The values used in this command constitute the seed metric for these OSPF routes being redistributed into EIGRP. The seed metric is the initial value of an imported route and it must be consistent with the destination protocol. + + + + +Note +The default seed metrics are as follows: + + + + +Connected: 1 + +Static: 1 + +RIP: Infinity + +EIGRP: Infinity + +OSPF: 20 for all except for BGP, which is 1 + +BGP: BGP metric is set to IGP metric value + + + + +Note +If both the metric keyword in the redistribute command and the default- metric command are used, the value of the metric keyword in the redistribute command takes precedence. + + + + +Tip +If a value is not specified for the metric option, and no value is specified using the default-metric command, the default metric value is 0, except for OSPF, where the default cost is 20. RIP and EIGRP must have the appropriate metrics assigned to anyredistributed routes; otherwise, redistribution will not work. BGP will use the IGP metric, while both connected networks and static routes will receive an initial default value of 1. + + + + +Tip +The default-metric command is useful when routes are being redistributed from more than one source because it eliminates the need for defining the metrics separatelyfor each redistribution. + + + + +Tip +Redistributed routes between EIGRP processes do not need metrics configured. Redistributed routes are +tagged as EIGRP external routes and will appear in the routing table with a code of D EX. + + + +REDISTRIBUTING CONNECTED NETWORKS + + + +Router(config) Starts the OSPF routing process # router ospf +1 + + + + +Router(config-router)# redistribute +connected + +Redistributes all directly connected networks + + + + + + +Note + + + +It is not necessaryto redistribute networks that are alreadyconfigured under the routing protocol + + + + + + + + +Note + + +The connected keyword refers to routes that are established automaticallybyvirtue of having IP enabled on an interface. For routing protocols such as OSPF, Intermediate System-to-Intermediate System (IS-IS), and EIGRP, these routes are redistributed as external to the autonomous system + + + + + + +Router(config-router)# redistribute +connected + +Redistributes all directly connected networks and +assigns them a starting metric of 50 + +metric 50 +Note + + +The redistribute connected command is not affected bythe default-metric command + +REDISTRIBUTING STATIC ROUTES + + + +Router(config)# ip route Creates a static route for network 10.1.1.0 255.255.255.0 10.1.1.0/24 exiting out of interface serial 0/0/0 Serial 0/0/0 + + + +Router(config)# router Starts the EIGRP routing process eigrp 10 + + + +Router(config-router)# Redistributes static routes on this redistribute static router into the EIGRP routing +process + + + +REDISTRIBUTING SUBNETS INTO OSPF + + + +Router(config)# Starts the OSPF routing process router ospf 1 + + + + +Router(config-router)# +redistribute + +Redistributes routes learned from EIGRP autonomous system 10. A metric of 100 is +assigned to all routes. Subnets will also be + +eigrp 10 metric redistributed 100 subnets + + + +Note + + +Without the subnets keyword, no subnets will be redistributed into the OSPF domain. (Onlyroutes that are in the routing table with the default classful mask will be redistributed.) The subnets keyword is onlynecessaryfor OSPFv2. OSPFv3 automaticallyredistributes all +classless prefixes + + + + + + +ASSIGNING E1 OR E2 ROUTES IN OSPF + + + +Router(confi Starts the OSPF routing process g)# router +ospf 1 + + + + +Router(confi g-router)# +redistribute + +Redistributes routes learned from EIGRP autonomous +system 1. Routes will be advertised as E1 routes + +eigrp 1 + +metric-type +1 + + +Note + + +If the metric-type argument is not used, routes will be advertised bydefault in OSPF as E2 routes. E2 routes have a default fixed cost of 20 associated with them, but this value can be changed with the metric keyword. For E2 routes, the metric will not change as the route is propagated throughout the OSPF +area. E1 routes will have internal area costs added to the seed metric + + + + + + + + + +Tip +Use external type 1 (E1) routes when there are multiple Autonomous System Border Routers (ASBRs) advertising an external route to the same autonomous system to avoid suboptimal routing (see Figure 6-1). + + + + + + + + + + + + + + + + + + +Figure 6-1 Network Topologywith Two ASBRs + + + + + + +Tip +Use external type 2 (E2) routes if onlyone ASBR is advertising an external route to the AS (see Figure 6-2). + + + + + + + + + + + + + + + + + + + + + + + +Figure 6-2 Network Topologywith One ASBR + + + + + +REDISTRIBUTING OSPF INTERNAL AND EXTERNAL ROUTES +Router(config) Starts the EIGRP routing process for autonomous # router eigrp system 10 +10 + + + + +Router(config-router)# +redistribute + +Redistributes internal and external type 1 routes learned from OSPF process ID 1. Available keywords +are match internal, external 1, and external 2. + +ospf 1 match These instruct EIGRP to only redistribute internal, internal external type 1 and type 2 OSPF routes +external 1 + + + + +Note + + +The default behavior when redistributing OSPF routes is to redistribute all routes—internal, external 1, and external 2. The keywords match internal external 1 and external 2 are required onlyif router behavior is to be modified + + + + + + +CONFIGURATION EXAMPLE: ROUTE REDISTRIBUTION FOR IPV4 + +Figure 6-3 shows the network topology for the configuration that follows, which demonstrates how to implement single-point two-way basic redistribution between EIGRP and OSPF for IPv4, using the commands covered in this chapter. For this configuration example, assume that EIGRP and OSPF routing has been configured correctly on all four routers. + + + + + + + + + + + + + + + + + +Figure 6-3 Network Topology for IPv4 Route Redistribution + + + + +Montreal(config Enters EIGRP configuration mode )# router eigrp +10 + + + + +Montreal(config -router)# +redistribute + +Redistributes routes from OSPF process ID 1 into EIGRP AS 10 and assigns a seed metric to these +routes + +ospf 1 metric 1500 10 255 1 1500 + + + +Montreal(config Returns to global configuration mode -router)# exit + + + +Montreal(config Enters OSPF configuration mode )# router ospf +1 +Montreal(config -router)# +redistribute + +Redistributes classless routes from EIGRP AS 10 into OSPF process ID 1 as external type 2 (E2) with +a metric of 20, which is fixed and does not change + +eigrp 10 across the OSPF domain subnets + + + +Note + + +Omitting the subnets keyword is a common configuration error. Without this keyword, onlynetworks in the routing table with a classful mask will be redistributed. Subnets will not be redistributed + + + + + + +Montreal(config -router)# +redistribute + +Redistributes classless routes from EIGRP AS 10 into OSPF process ID 1 as external type 1 (E1). Type +1 external routes calculate the cost by adding the + +eigrp 10 external cost (20) to the internal cost of each link metric-type 1 that the packet crosses +subnets + + + +CONFIGURATION EXAMPLE: ROUTE REDISTRIBUTION FOR IPV6 + +Figure 6-4 shows the network topology for the configuration that follows, which demonstrates how to implement single-point two-way basic redistribution between EIGRP using named mode configuration and OSPFv3 for IPv6, with the commands covered in this chapter. For this configuration example, assume that EIGRP and OSPF routing for IPv6 has been configured correctly on all four routers. + + + + + + + + + + + + + + + + + + +Figure 6-4 Network Topology for IPv6 Route Redistribution + + + + +Montreal(config)# Enters EIGRP using named mode router eigrp DEMO configuration + + + +Montreal(config- Enables the IPv6 unicast address family for router)# address- AS 10 +family ipv6 unicast autonomous-system 10 + + + + +Montreal(config- +router-af)# + +Enters EIGRP address-family topology +subconfiguration mode + +topology base + + + + +Montreal(config-router-af- +topology)# + +Redistributes IPv6 routes from OSPF process ID 1 into EIGRP AS 10 and assigns a seed +metric to these routes + +redistribute ospf 1 metric 1500 10 255 +1 1500 include- Note + +connected + + + + + + + + +Montreal(config- +router-af- + + +The include-connected keywords instruct the source routing protocol to redistribute the connected interfaces if the source routing protocol is running on them + + + + + +Enters OSPFv3 process ID 1 configuration +mode + +topology)# router ospfv3 1 + + + +Montreal(config- Enters the OSPFv3 IPv6 unicast address router)# address- family +family ipv6 unicast + + + + +Montreal(config- +router-af)# + +Redistributes IPv6 routes from EIGRP AS 10 +into OSPFv3 process ID 1 as external type 2 + +redistribute eigrp (E2) with a metric of 20, which is fixed and 10 include- does not change across the OSPF domain connected + + + + +Montreal(config- +router-af)# + +Redistributes IPv6 routes from EIGRP AS 10 +into OSPFv3 process ID 1 as external type 1 + +redistribute eigrp (E1). Type 1 external routes calculate the cost 10 metric-type 1 by adding the external cost (20) to the include-connected internal cost of each link that the packet +crosses + + + + + +Note + + +The subnets keyword does not exist in OSPFv3 redistribution configuration +VERIFYING ROUTE REDISTRIBUTION + + + + +Router# show ip route + + + +Router# show ipv6 route + + + +Router# show ip + +Displays the current state of the routing table + + + + + + + + + + + +Displays the EIGRP topology table + +eigrp topology + + + +Router# show ipv6 eigrp topology + + + +Router# show ip Displays parameters and the current state of any protocols active routing process + + + +Router# show ipv6 protocols + + + +Router# show ip Displays summary address entries in the RIP rip database routing database + + + +Router# show ipv6 rip database + + + +Router# show ip Displays the link-state advertisement (LSA) ospf database types within the link-state database (LSDB) +Router# show ospfv3 database + + + +ROUTE FILTERING USING THE DISTRIBUTE-LIST COMMAND + + + +Router(config)# router Starts the EIGRP routing process for eigrp 10 autonomous system 10 + + + + + +Note + + +If using EIGRP named mode configuration with address families, the distribute-list command is entered under the topologysubconfiguration mode: Router(config-router-af-topology)# + + + + + + + + +Note + + +If using OSPFv3 with address families, the distribute-list command is entered under the specific address familyin use on the router: Router(config-router-af)# + + + + + +Router(config-router)# Creates an incoming global distribute list distribute-list 1 in that refers to access control list (ACL) 1 + + + +Router(config-router)# Creates an outgoing global distribute list distribute-list 2 out that refers to ACL 2 + + + +Router(config-router)# Creates an incoming distribute list for +distribute-list 3 in interface GigabitEthernet 0/0/0 and gigabitethernet 0/0/0 refers to ACL 3 + + + +Router(config-router)# Creates an outgoing distribute list for distribute-list 4 out interface Serial 0/2/0 and refers to ACL 4 serial 0/2/0 + + + +Router(config-router)# Filters updates redistributed from OSPF distribute-list 5 out process ID 1 into EIGRP AS 10 according ospf 1 to ACL 5 + + + +Configuration Example: Inbound and Outbound Distribute List Route Filters + +Figure 6-5 shows the network topology for the configuration that follows, which demonstrates how to configure inbound and outbound route filters to control routing updates using the commands covered in this chapter. Assume that all basic configurations and EIGRP routing have been configured correctly. + + + + + + + + + + + + +Figure 6-5 Network Topology for Inbound and Outbound Distribute List Route Filters + + + +The first objective is to prevent router Aylmer from learning the 10.0.0.0/8 network using an outbound distribute list on router Hull. +Hull(config)# access-list Creates a standard ACL number 10 10 deny 10.0.0.0 and explicitly denies the 10.0.0.0/8 0.255.255.255 network + + + +Hull(config)# access-list Adds a second line to ACL 10 which 10 permit any permits all other networks + + + +Hull(config)# router Enters EIGRP AS 1 routing process eigrp 1 + + + +Hull(config-router)# Creates an outbound global distribute-list 10 out distribute list that refers to ACL 10 + + + + +Or + + + +Hull(config-router)# + +Creates an outgoing distribute list for interface Serial 0/2/0 that refers to +ACL 10 + +distribute-list 10 out serial 0/2/0 + + +The second objective is to prevent router Ottawa from learning the 192.168.6.0/24 network using an inbound distribute list on router Ottawa. + + +Ottawa(config)# access- Creates a standard ACL number 20 list 20 deny 192.168.6.0 and explicitly denies the 0.0.0.255 192.168.6.0/24 network + + + +Ottawa(config)# access- Adds a second line to ACL 20 which list 20 permit any permits all other networks + + + +Ottawa(config)# router Enters EIGRP AS 1 routing process +eigrp 1 + + + +Ottawa(config-router)# Creates an inbound global distribute distribute-list 20 in list that refers to ACL 20 + + + + +Or + + + +Ottawa(config-router)# + +Creates an inbound distribute list for interface Serial 0/2/0 that refers to +ACL 20 + +distribute-list 20 in serial 0/2/0 + + + +Configuration Example: Controlling Redistribution with Outbound Distribute Lists + +Figure 6-6 shows the network topology for the configuration that follows, which demonstrates how to control redistribution with an outbound distribute list using the commands covered in this chapter. Assume that all basic configurations and routing have been configured correctly. This example uses OSPFv3 with address families. + + + + + + + + + + + + +Figure 6-6 Network Topology for Controlling Redistribution with Outbound Distribute Lists + + + +The objective is to prevent networks 172.16.3.0/24 and 172.16.4.0/24 from being redistributed into the OSPF domain. +Hull(config)# Creates a standard ACL number 30 and access-list 30 explicitly permits the 172.16.1.0/24 network permit 172.16.1.0 +0.0.0.255 + + + +Hull(config)# Adds a second line to ACL 30 that explicitly access-list 30 permits the 172.16.2.0/24 network +permit 172.16.2.0 0.0.0.255 + + + +Hull(config)# Enters OSPFv3 process ID 1 routing process router ospfv3 1 + + + +Hull(config- Enters the OSPFv3 IPv4 address family router)# address- +family ipv4 unicast + + + +Hull(config- Redistributes all EIGRP networks into OSPFv3 router-af)# +redistribute eigrp 10 + + + +Hull(config-router-af)# +distribute-list + +Creates an outbound distribute list to filter routes being redistributed from EIGRP into +OSPFv3 + +30 out eigrp 10 + + + + +Note + + +The implicit “denyany” statement at the end of the access list prevents routing updates about anyother network from being advertised. As a result, networks 172.16.3.0/24 and +172.16.4.0/24 will not be redistributed into OSPFv3 + + + + + + +Verifying Route Filters + + +Router# show ip Displays the parameters and current state of protocols active routing protocols + + + +Routing Protocol is "eigrp 10" +Outgoing update filter list for all +interfaces is 2 Redistributed ospf 1 +filtered by 5 Serial 0/2/0 +filtered by 4 Incoming update +filter list for all interfaces is 1 +GigabitEthernet 0/0/0 filtered by 3 + + + + + + +Note +For each interface and routing process, Cisco IOS permits the following: + + +One incoming global distribute list + +One outgoing global distribute list + +One incoming interface distribute list + +One outgoing interface distribute list + +One outgoing redistribution distribute list + + + + + + +Caution +For OSPF, route filters have no effect on LSAs or the LSDB. Abasic requirement of link-state routing protocols is that routers in an area must have identical LSDBs. +Note +OSPF routes cannot be filtered from entering the OSPF database. The distribute-list in command filters routes onlyfrom entering the routing table, but it doesn’t prevent link-state packets (LSPs) from being propagated. + + + + +Note +The command distribute-list out works onlyon the routes being redistributed bythe ASBR into OSPF. It can be applied to external type-2 and external type-1 routes but not to intra-area and interarea routes. + + + +ROUTE FILTERING USING PREFIX LISTS + +The general syntax for configuring IPv4 and IPv6 prefix lists is as follows: + +Click here to view code image + + +Router(config)# ip prefix-list list-name [seq seq-value] {deny | permit} network/len [ge ge-value] [le le-value] Router(config)# ipv6 prefix-list list-name [seq seq-value] {deny | permit} network/len [ge ge-value] [le le-value] + +The table that follows describes the parameters for this command. + + +Param Description eter + + + +list- The name of the prefix list name + + + +seq (Optional) Applies a sequence number to the entry being created or deleted + + + +seq- (Optional) Specifies the sequence number value + + + +deny Denies access to matching conditions +permit + + + +networ k/len + + + +ge + + + +ge-value + + + +le + + + +le-value + +Permits access for matching conditions + + + +(Mandatory) The IPv4 or IPv6 network number and length (in bits) of the netmask + + + +(Optional) Applies ge-value to the range specified + + + +(Optional) Specifies the lesser value of a range (the “from” portion of the range description) + + + +(Optional) Applies le-value to the range specified + + + +(Optional) Specifies the greater value of a range (the “to” +portion of the range description) + + + + + + +Tip +You must define a prefixlist before you can applyit as a route filter. + + + + + +Tip +There is an implicit denystatement at the end of each prefixlist. + + + + + +Tip +The range of sequence numbers that can be entered is from 1 to 4 294 967 294. + +If a sequence number is not entered when configuring this command, a default sequence numbering is applied to the prefixlist. The number 5 is applied to the first prefixentry, and subsequent unnumbered entries are incremented by5. + + + +A router tests for prefix list matches from the lowest sequence number to the highest. By numbering your prefix-list statements, +you can add new entries at any point in the list. + + +The following examples show how you can use the prefix-list command to filter networks using some of the more commonly used options. + + +Router(config) Creates a prefix list where the prefix length to be +# ip prefix- permitted needs to be between /8 and /24, inclusive, list ROSE and where the first octet is 192. Because no + +permit 192.0.0.0/8 le +24 + +sequence number is identified, the default number +of 5 is applied + + + + +Router(config) Creates a prefix list where the prefix length to be +# ip prefix- denied needs to be between 25 and 32, inclusive, and list ROSE deny where the first octet is 192. Because no sequence + +192.0.0.0/8 ge +25 + +number is identified, the number 10 is applied—an +increment of 5 over the previous statement + + + + + + +Note + + +This configuration will permit routes such as 192.2.0.0/16 or 192.2.20.0/24 but will denya more specific subnet such as 192.168.10.128/25 + + + + + +Router(config) Creates a prefix list that permits all prefixes that +# ip prefix- have a length between 16 and 24 bits (greater than list TOWER or equal to 16 bits, and less than or equal to 24 bits), permit and where the first octet is 10 +10.0.0.0/8 ge 16 le 24 +Router(config) Creates a prefix list and assigns a sequence number # ip prefix- of 5 to a statement that permits only the default list TEST seq route 0.0.0.0/0 +5 permit 0.0.0.0/0 + + + +Router(config) Creates a prefix list and assigns a sequence number # ip prefix- of 10 to a statement that permits any prefix with a list TEST seq length of exactly 30 bits +10 permit 0.0.0.0/0 ge 30 le 30 + + + +Router(config) Creates a prefix list and assigns a sequence number # ip prefix- of 15 to a statement that permits any address or list TEST seq subnet (permit any) +15 permit 0.0.0.0/0 le 32 + + + +Router(config) Removes sequence number 10 from the prefix list # no ip +prefix- list TEST seq 10 0.0.0.0/0 ge 30 le 30 + + + +Router(config) Creates a prefix list and assigns a sequence number # ipv6 prefix- of 5 to a statement that permits only the default list V6TEST route +seq 5 permit ::/0 +Router(config) Creates a prefix list and assigns a sequence number # ipv6 prefix- of 10 to a statement that permits any address or list V6TEST prefix length (permit any) +seq 10 permit ::/0 le 128 + + + +Configuration Example: Using a Distribute List That References a Prefix List to Control Redistribution + +Figure 6-7 shows the network topology for the configuration that follows, which demonstrates how to control redistribution with a prefix list using the commands covered in this chapter. Assume that all basic configurations and EIGRP and OSPF routing have been configured correctly. + + + + + + + + + + + + +Figure 6-7 Network Topology for Distribute List Configuration with Prefix Lists + + + +The objective is to prevent networks 172.16.3.0/24 and 172.16.4.0/24 from being redistributed into the OSPF domain. + + +Hull(config)# ip Creates a prefix list called FILTER with a first prefix-list FILTER sequence number of 5 that explicitly permits seq 5 permit the 172.16.1.0/24 network +172.16.1.0/24 +Hull(config)# ip Adds a second line to the FILTER prefix list prefix-list FILTER that explicitly permits the 172.16.2.0/24 seq 10 permit network +172.16.2.0/24 + + + +Hull(config)# Enters OSPF process ID 1 routing process router ospf 1 + + + + +Hull(config-router)# +redistribute eigrp + +Redistributes all EIGRP networks into OSPF. The subnets keyword is required for accurate +OSPFv2 redistribution of subnets learned from + +10 subnets the Aylmer router + + + + +Hull(config-router)# +distribute-list + +Creates an outbound distribute list to filter routes being redistributed from EIGRP into +OSPF that references the prefix list + +prefix FILTER out eigrp 10 + +Note + + +The implicit denyanystatement at the end of the prefixlist prevents routing updates about anyother network from being advertised. As a result, networks 172.16.3.0/24 and 172.16.4.0/24 will not be redistributed into OSPF + + + + + + + + +Tip +You can attach prefixlists to the redistribution process either via a distribute list or via a route map. + + + +Verifying Prefix Lists + + +show ip prefix- Displays information on all prefix lists. Specifying list [detail | the detail keyword includes the description and +summary] the hit count (the number of times the entry matches a route) in the display + +show ipv6 prefix-list [detail | summary] + + +clear ip Resets the hit count shown on prefix list entries prefix-list +prefix-list-name [network/length ] + + +clear ipv6 prefix-list prefix-list-name [network/length ] + + + +USING ROUTE MAPS WITH ROUTE REDISTRIBUTION + + + + +Router(config)# +route-map + +Creates a route map called MY_MAP. This route- +map statement will be used to permit + + + +MY_MAP permit +10 + +redistribution based on subsequent criteria. A +sequence number of 10 is assigned + + + + + +Router(config- +route-map)# + +Specifies the match criteria (the conditions that +should be tested); in this case, match addresses + +match ip filtered using a standard access list number 5 +address 5 + + + +Router(config- Specifies the set action (what action is to be +route-map)# set performed if the match criteria is met); in this case, metric 500 set the external metric to 500 (instead of the +default value of 20 for OSPF) + + + +Router(config- Specifies a second set action for the same match + +route-map)# set metric-type +type-1 + +criteria. In this case, set the external OSPF network +type to E1 + + + + + +Router(config-route-map)# +route-map + +Adds a second statement to the MY_MAP route map that will deny redistribution based on +subsequent criteria + +MY_MAP deny 20 + + + + +Router(config- +route-map)# + +Specifies the match criteria (the conditions that +should be tested); in this case, match addresses + +match ip filtered using a prefix list named MY_PFL address prefix- +list MY_PFL + + + + +Router(config-route-map)# +route-map + +Adds a third statement to the MY_MAP route map that will permit redistribution based on subsequent +criteria + +MY_MAP permit 30 + +Note + + +When no “match” criteria are explicitlyspecified, all other routes will be redistributed with the following “set” criteria applied +Router(config- Specifies the set action (what action is to be +route-map)# set performed if the match criteria is met); in this case, metric 5000 since no match criteria is defined, it sets the +external metric to 5000 (instead of the default value of 20) for all other routes + + + +Router(config- Specifies a second set action for the same match + +route-map)# set metric-type +type-2 + +criteria; in this case, set the external OSPF network type to E2. This is optional since the default type +for redistributed routes into OSPF is external type 2 + + + + +Router(config- Enters OSPF process ID 10 routing process route-map)# +router ospf 10 + + + + +Router(config-router)# +redistribute + +Redistributes only EIGRP routes into OSPF that +are permitted by route map MY_MAP + +eigrp 1 route-map MY_MAP subnets + + + + + +Note +When used to filter redistribution, route map permit or denystatements determine whether the route will be redistributed. Routes without a match will not be redistributed. Like an access list or prefixlist, a route map stops processing at the first match and there is also an implicit denystatement at the end. + + + +Configuration Example: Route Maps + +Figure 6-8 shows the network topology for the configuration that follows, which demonstrates how to control redistribution with a +route map using the commands covered in this chapter. Assume that all basic configurations and EIGRP and OSPF routing have been configured correctly. + + + + + + + + + + + + +Figure 6-8 Network Topology for Route Map Configuration + + + +The objective is to only redistribute networks 172.16.1.0/24 and 172.16.2.0/24 into OSPF and advertise them as external type 1 (E1) routes with an external metric of 50. + + +Hull(config)# Creates a standard ACL number 5 and explicitly access-list 5 permits the 172.16.1.0/24 network +permit 172.16.1.0 0.0.0.255 + + + +Hull(config)# Adds a second line to ACL 5 that explicitly access-list 5 permits the 172.16.2.0/24 network permit +172.16.2.0 0.0.0.255 + + + +Hull(config)# Creates a route map called FILTER. This route route-map FILTER map will permit traffic based on subsequent permit 10 criteria. A sequence number of 10 is assigned +Hull(config- +route-map)# + +Specifies the match criteria; match addresses +filtered from ACL 5 + +match ip address 5 + + + +Hull(config- Specifies the set actions (what actions are to be route-map)# set performed if the match criterion is met); in this metric 50 case, sets the external metric to 50 and sets the +type to external type 1 (E1) + +Hull(config-route-map)# set metric-type type-1 + + + +Hull(config- Enters OSPF process ID 1 routing process route-map)# +router ospf 1 + + + + +Hull(config)# +redistribute + +Redistributes only those EIGRP networks into +OSPF that match the route map + +eigrp 10 subnets route-map FILTER + +Note + + +Networks 172.16.2.0/24 and 172.16.3.0/24 will not be redistributed because of the implicit denyanyat the end of the route map + + + + + + +MANIPULATING REDISTRIBUTION USING ROUTE TAGGING + +There are several ways redistribution can be enabled, including +one-way one-point, two-way one-point, one-way multipoint, and two-way multipoint redistribution. Two-way multipoint redistribution can introduce routing loops in the network. One option to prevent redistribution of already redistributed routes is to use route tagging. In two-way multipoint redistribution scenarios, route tags must be applied and filtered in both directions and on both routers performing redistribution. + +Figure 6-9 shows the network topology for the configuration that follows, which demonstrates how to control redistribution with route tags using the commands covered in this chapter. Assume that all basic configurations and EIGRP and OSPF routing have been configured correctly. A tag number of 11 is used to identify OSPF routes, and a tag of 22 is used to identify EIGRP routes. + + + + + + + + + + + + + + + + +Figure 6-9 Network Topology for Redistribution Using Route Tagging + + + +The following configuration only shows the commands entered on the Hull router. For filtering using route tags, the following configuration would need to be entered on both the Hull and Wendover routers. + + +Hull(config)# route- Creates a route map named EIGRPtoOSPF +map EIGRPtoOSPF deny +10 + + +and denies redistribution for all routes +tagged with the value 11 + + + + +Hull(config-route-map)# match tag 11 + + + +Hull(config-route- Creates a second statement for route map map)# route-map EIGRPtoOSPF permitting all other routes to EIGRPtoOSPF permit be redistributed with a tag of 22 +20 + + + +Hull(config-route-map)# set tag 22 + + + +Hull(config-route- Creates a route map named OSPFtoEIGRP map)# route-map and denies redistribution for all routes OSPFtoEIGRP deny 10 tagged with the value 22 + + + +Hull(config-route-map)# match tag 22 + + + +Hull(config-route- Creates a second statement for route map map)# route-map OSPFtoEIGRP permitting all other routes to OSPFtoEIGRP permit be redistributed with a tag of 11 +20 + + + +Hull(config-route-map)# set tag 11 + + + +Hull(config-route- Enters OSPF configuration mode map)# router ospf 11 +Hull(config-router)# Redistributes all EIGRP routes with a tag of redistribute eigrp 22 into the OSPF domain +22 subnets route-map EIGRPtoOSPF + + + +Hull(config-router)# Enters EIGRP configuration mode router eigrp 22 + + + +Hull(config-router)# Redistributes all OSPF routes with a tag of redistribute ospf 11 11 into the EIGRP domain +metric 1500 1 255 1 1500 route-map +OSPFtoEIGRP +Note + + +The result here is to ensure that onlyroutes originating in the OSPF domain are redistributed into EIGRP, while only routes originating in the EIGRP domain are redistributed into the OSPF domain. This avoids a scenario where a route is redistributed back into the domain from which it originated + + + + + + +CHANGING ADMINISTRATIVE DISTANCE + +The commands to change the administrative distance (AD) for internal and external routes are as follows. + + +Router(config)# router ospf Starts the OSPF routing process 1 + + + +Router(config-router)# Changes the AD to 105 for intra-distance ospf intra-area area and interarea routes, and 105 inter-area 105 external changes the AD to 125 for external +125 routes + + + +Router(config)# router Starts the EIGRP routing process eigrp 100 + + + +Router(config-router)# Changes the AD to 80 for internal distance eigrp 80 105 EIGRP routes and to 105 for EIGRP +external routes + + + +Router(config)# router bgp Starts the BGP routing process 65001 + + + +Router(config-router)# Changes the AD to 30 for external distance bgp 30 200 220 BGP routes, 200 for internal BGP +routes, and 220 for local BGP routes + + +It is also possible to change the AD for certain routes learned from specific neighbors. These commands can be used for all routing protocols. + + + +Router(config- +router)# + +Sets an AD of 50 for all routes learned through a +specific routing protocol + +distance 50 + + + + +Router(config- +router)# + +Sets an AD of 255 for all routes learned through a +specific routing protocol. This instructs the router to + +distance 255 ignore all routing updates from networking devices for which an explicit distance has not been set + + + +Router(config- Sets the AD to 85 for all routes learned from +router)# neighbors on network 192.168.40.0/24 distance 85 +192.168.40.0 0.0.0.255 + + + + +Router(config- +router)# + +Sets the AD to 125 for all routes specifically from +neighbor 172.16.200.5/32 that match ACL 10 + +distance 125 172.16.200.5 0.0.0.0 10 + + + +PATH CONTROL WITH POLICY-BASED ROUTING Path control is the mechanism that changes default packet forwarding across a network. It is not quality of service (QoS) or +MPLS Traffic Engineering (MPLS-TE). Path control is a collection of tools or a set of commands that gives you more control over routing by extending and complementing the existing mechanisms provided by routing protocols. Bypassing the default packet forwarding decision may be required to obtain better resiliency, performance, or availability in your network. + +Configuring Policy Based Routing (PBR) is a two-step process. First, a route map is created that specifies the new forwarding decision to be implemented. Second, the route map is applied to an incoming interface. + + +Router(config)# Creates a route map named ISP1. This route map route-map ISP1 will permit traffic based on subsequent criteria. A permit 10 sequence number of 10 is assigned +Note + + +In route maps, the default action is to permit + + + + + + + + +Note + + +The sequence-number is used to indicate the position the route map statement is to have within the route map. Aroute map is composed of route map statements with the same route map name. If no sequence number is given, the first statement in the route map is automaticallynumbered as 10 + + + + + + + +Router(config- +route-map)# + +Specifies the match criteria (the conditions that +should be tested); in this case, match addresses + +match ip address using ACL 1 1 + + + +Router(config- Specifies the set action (what action is to be route-map)# set performed if the match criteria are met); in this ip next-hop case, output packets to the router at IP address + +209.165.201.1 + + + +Router(config- + +209.165.201.1 + + + +Specifies the set action (what action is to be + +route-map)# set performed if the match criteria are met); in this interface serial case, forward packets out interface Serial 0/2/0 0/2/0 + + + +Note + + +If no explicit route exists in the routing table for the destination network address of the packet (that is, the packet is a broadcast packet or destined to an unknown address), the set interface command has no effect and is ignored + + +Note + + +Adefault route in the routing table will not be considered an explicit route for an unknown destination address + + + + + +Router(config- Defines where to output packets that pass a match route-map)# set clause of a route map for policy routing and for +ip default next- which the router has no explicit route to the + +hop 209.165.201.1 + + + +Router(config- + +destination address + + + + + +Defines where to output packets that pass a match + + + +route-map)# set +default + +clause of a route map for policy routing and for +which the router has no explicit route to the + +interface serial destination address 0/2/0 + + + +Note + + +This is recommended for point-to-point links only + + + + + + +Router(config- Returns to global configuration mode route-map)# exit + + + +Router(config)# Moves to interface configuration mode interface +gigabitethernet 0/0/0 +Router(config- Specifies a route map to use for policy routing on if)# ip policy an incoming interface that is receiving the packets route-map ISP1 that need to be policy routed + + + +Router(config- Returns to global configuration mode if)# exit + + + +Router(config)# Specifies a route map to use for policy routing on ip local policy all packets originating on the router +route-map ISP1 + + + + + +Tip +Packets that are generated bythe router are not normallypolicyrouted. Using the ip local policyroute-map [map-name] command will make these packets adhere to a policy. For example, you maywant packets originating from the router to take a route other than the best path according to the routing table. + + + +VERIFYING POLICY-BASED ROUTING + + + + +Router# show ip +policy + +Displays route maps that are configured on the +interfaces + + + + +Router# show Displays route maps route-map [map- +name] + + + +Router# debug ip Enables the display of IP policy routing events policy + + + + +Router# +traceroute + +Enables the extended traceroute command, +which allows the specification of the source +address + + + +Router# ping Enables the extended ping command, which allows for the specification of the source address + + + +CONFIGURATION EXAMPLE: PBR WITH ROUTE MAPS Figure 6-10 shows the network topology for the configuration that follows, which demonstrates how to configure PBR with route maps using the commands covered in this chapter. + + + + + + + + + + + + + + + + + +Figure 6-10 Network Topology for PBR with Route Maps + + + +The objective is to forward Internet traffic sourced from the 10.1.1.0/24 network to ISP 1 and traffic sourced from the 10.1.2.0/24 network to ISP 2. Assume that all basic configurations and routing have been configured. + + + +R1(config)# +access-list 11 + +Creates a standard access list that matches traffic +originating from network 10.1.1.0/24. The + +permit 10.1.1.0 number 11 is used for this ACL 0.0.0.255 + + + +R1(config)# Creates a standard access list that matches traffic +access-list 12 originating from network 10.1.2.0/24. The permit 10.1.2.0 number 12 is used for this ACL 0.0.0.255 + + + +R1(config)# Creates a route map named PBR. This route map route-map PBR will permit traffic based on subsequent criteria. A permit 10 sequence number of 10 is assigned + + + +R1(config-route- Specifies the match criteria—match addresses map)# match ip permitted by ACL 11 +address 11 + + + +R1(config-route- Specifies the set action (what action is to be map)# set ip performed if the match criteria are met); in this + +next-hop 192.168.1.1 + + + +R1(config-route- + +case, forward packets to the router at 192.168.1.1 (ISP1) + + + +Adds a second statement to the PBR route map. A + +map)# route-map sequence number of 20 is assigned PBR permit 20 + + + +R1(config-route- Specifies the match criteria; match addresses map)# match ip permitted by ACL 12 +address 12 + + + +R1(config-route- Specifies the set action (what action is to be map)# set ip performed if the match criteria are met); in this + +next-hop 192.168.2.1 + + + +R1(config-route- + +case, forward packets to the router at 192.168.2.1 (ISP 2) + + + +Adds a third statement to the PBR route map. A +map)# route-map sequence number of 30 is assigned PBR permit 30 + + + +R1(config-route- Specifies that all other traffic not matching ACL map)# set 11 or ACL 12 will be sent to the Null0 interface default (traffic is dropped) +interface null0 + + + +R1(config-route- Exits the route map configuration mode map)# exit + + + + +R1(config)# interface gigabitethernet 0/0/0 + + + +R1(config-if)# + +Enters GigabitEthernet 0/0/0 interface configuration mode + + + + + + +Applies the PBR route map to the interface. This + +ip policy route- is the incoming interface receiving the packets to map PBR be policy-routed + + + +CISCO IOS IP SLA + +Cisco IOS IP service level agreements (SLAs) send data across the network to measure performance between multiple network locations or network paths. They simulate network data and IP services and collect network performance information in real time. IP SLAs can also send SNMP traps that are triggered by events such as these: + + +Connection loss + +Timeout +Round-trip time threshold + +Average jitter threshold + +One-way packet loss + +One-way jitter + +One-way mean opinion score (MOS) + +One-way latency + + + +Cisco IOS IP SLAs can also test the following services: + + +DNS + +HTTP + +DHCP + +FTP + + + + +Note +Cisco IOS IP SLAs are used to perform network performance measurements within Cisco Systems devices using active traffic monitoring. + + + + +Tip +SLAs use time-stamp information to calculate performance metrics such as jitter, latency, network and server response times, packet loss, and mean opinion score. + + + +Figure 6-11 is the network topology for the IP SLA commands. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 6-11 IP SLA Network Topology + + + + + +DLS1# configure terminal + + + +DLS1(config + +Enters global configuration mode + + + + + + + +Creates an IP SLA operation and enters IP SLA + +)# ip sla configuration mode 11 + + + + +DLS1(config -ip-sla)# +icmp-echo + +Configures the IP SLA as an ICMP echo operation and +enters ICMP echo configuration mode +10.1.2.1 source-ip 10.1.1.1 + + + + + + +DLS1(config -ip-sla- +echo)# + + + +Note + + +The ICMP echo operation does not require the IP SLAresponder to be enabled + + + + + + +Sets the rate at which the IP SLA operation repeats. Frequency is measured in seconds. The default value is +60 seconds + +frequency 5 + + + +DLS1(config Exits IP SLA configuration mode -ip-sla- +echo)# exit + + + +DLS1(config Configures the IP SLA operation scheduling parameters )# ip sla to start now and continue forever +schedule 11 + +start-time now life forever + + + + + + + + + +DLS2(config + + + + +Note + + +The start time for the SLAcan be set to a particular time and day, to be recurring, to be activated after a threshold is passed, and kept as an active process for a configurable number of seconds + + + + + +Enables IP SLA responder functionality in response to + +)# ip sla control messages from the source. This command is + +responder + + + +DLS1(config + +entered on the target device + + + +Creates an IP SLA operation and enters IP SLA + +)# ip sla configuration mode 12 +DLS1(config -ip-sla)# path-jitter 172.19.1.2 source-ip 10.1.1.1 [targetOnly +] + +Configures the IP SLA as an ICMP path-jitter operation and enters path-jitter configuration mode. ICMP path jitter provides hop-by-hop jitter, packet loss, and delay measurement statistics in an IP network. Adding the targetOnly keyword bypasses the hop-by-hop measurements and echo probes are sent to the +destination only + + + + + +Note + + +The ICMP path-jitter SLAsends 10 packets per operation with a 20-ms time interval between them bydefault. These values are configurable + + + + + + +DLS1(config -ip-sla-path- +jitter)# + +Sets the rate at which the IP SLA operation repeats. The +default value is 60 seconds + +frequency 5 + + + + +DLS1(config -ip-sla-path-jitter)# exit + + + +DLS1(config + +Exits path-jitter configuration mode + + + + + + + + + + +Configures the IP SLA operation scheduling parameters + +)# ip sla to start at 7 a.m. and continue for 1 hour every day. schedule 12 3600 seconds is the default life time for an IP SLA. The + +recurring +start-time + +switch will require accurate time and date to implement +the SLA schedule +07:00 life 3600 + + + + + +Tip +When using udp-echo, udp-jitter, or tcp-connect IP SLAoperations, you must configure the target device as an IP SLAresponder with either the udp-echo or tcp-connect commands. + + + +Configuring Authentication for IP SLA + + +Router(config)# key chain Juliet Identifies a key chain + + + +Router(config-keychain)# key 1 Identifies the key number + + + +Router(config-keychain)# key- Identifies the key string string Shakespeare + + + +Router(config-keychain)# exit Returns to global configuration mode + + + + +Router(config)# ip sla key-chain +Juliet + +Applies the key chain to the +IP SLA process + + + + + + +Note + + +This must also be done on the responder + + + + + + +Monitoring IP SLA Operations +Router# show ip sla Displays global information about Cisco application IOS IP SLAs + + + + + +Note + + +The show ip sla application command displays supported SLAoperation types and supported SLA protocols + + + + + +Router# show ip sla Displays configuration values including all configuration 11 defaults for SLA 11 + + + + + +Note + + +The use of a number in this command is optional + + + + + + +Router# show ip sla Displays current or aggregated operational statistics status and statistics + + + +PBR WITH CISCO IOS IP SLA + +Figure 6-12 shows the network topology for the configuration that follows, which shows the use of PBR with Cisco IOS IP SLA functionality for path control. Assume that all basic configurations have been configured. + + + + + + + + + + + + +Figure 6-12 Network Topology for PBR with IOS IP SLA + + + +Customer requirements: + + +Customer A is multihoming to ISP 1 and ISP 2. + +The link to ISP 1 is the primary link for all traffic. + +Customer A is using default routes to the Internet service providers (ISPs). + +Customer A is using these default routes with different administrative distances to make ISP 1 the preferred route. + + +Potential problem: If ISP 1 is having uplink connectivity problems to the Internet, Customer A will still be sending all its traffic to ISP 1, only to have that traffic get dropped by the ISP. + +Possible solutions: (1) IOS IP SLA can be used to conditionally announce the default route, or (2) the IP SLA can be used to verify availability for PBR. + +Follow these steps to configure Cisco IOS IP SLA functionality: + + +1. Define probe(s). + +2. Define tracking object(s). +3a. Define the action on the tracking object(s). + +or + +3b. Define policy routing using the tracking object(s). + +4. Verify IP SLA operations. + + + +Note +Onlythe configuration on R1 for neighbor ISP 1 is shown. Typically, in a multihoming scenario, R1 would be configured with two SLAs, two tracking objects, and two default routes (one for each ISP) with different AD values. + + + +Step 1: Define Probe(s) + + +R1(config)# ip sla 1 Begins configuration for an IP SLA operation and enters SLA configuration mode. 1 is the operation number and can be a number between 1 and 2 147 483 647 + + + +R1(config-ip-sla)# Defines an ICMP echo operation to icmp-echo 192.168.1.1 destination address 192.168.1.1 using a +source-interface source interface of GigabitEthernet 0/0/0 gigabitethernet 0/0/0 and enters ICMP echo configuration mode + + + + + +Tip + + +Typically, the address tested is farther within the ISP network instead of the next hop + + + + + +R1(config-ip-sla- Sets the rate at which the operation echo)# frequency 10 repeats. Measured in seconds from 1 to 604 +800 (7 days) +R1(config-ip-sla- Length of time the operation waits to echo)# timeout 5000 receive a response from its request packet, +in milliseconds. Range is 0 to 604 800 000 + + + + + + +Tip + + +It is recommended that the timeout value be based on the sum of both the maximum round-trip time (RTT) value for the packets and the processing time of the IP SLAs operation + + + + + +R1(config-ip-sla- Exits IP SLA ICMP echo configuration echo)# exit mode and returns to global configuration +mode + + + +R1(config)# ip sla Sets a schedule for IP SLA monitor 1. schedule 1 start-time Packets will be sent out immediately and now life forever will continue forever + + + +Step 2: Define Tracking Object(s) + + +R1(config)# track 11 ip Configures a tracking object to track sla 1 reachability the reachability of IP SLA 1 + + + +R1(config-track)# exit Returns to global configuration mode + + + +Step 3a: Define the Action on the Tracking Object(s) + + +R1(config)# ip route Adds a default route with a next hop of 0.0.0.0 0.0.0.0 192.168.1.1 with an AD of 2 to the routing +192.168.1.1 2 track 11 table if tracking object 11 is up + + + +OR + + +Step 3b: Define Policy Routing Using the Tracking Object(s) + + +R1(config)# Creates a route map that will use the tracking route-map IPSLA object. No match criteria is specified so all traffic permit 10 will be policy routed + + + +R1(config-route- Configures policy routing to verify the +map)# set ip reachability of the next hop 192.168.1.1 before next-hop verify- the router performs policy routing to that next availability hop. A sequence number of 10 is used and 192.168.1.1 10 tracking object 11 is referenced +track 11 + + + + +Note + + +The sequence number is used when tracking the availabilityof multiple addresses. Each address tracked would get its own sequence number (for example, 10, 20, 30). If the first tracking objects fails, the next one in the sequence is used. If all tracking objects fail, the policyrouting fails, and the packets are routed according to the routing table + + + + + +R1(config-route- Enters interface configuration mode map)# interface +gigabitethernet 0/0/0 + + + +R1(config-if)# ip Applies the IPSLA route map to the interface. + +policy route-map +IPSLA + +This is the incoming interface receiving the +packets to be policy routed +Step 4: Verify IP SLA Operations + + +R1# show ip sla Displays configuration values including all configuration defaults for all SLAs + + + +R1# show ip sla Displays the current operational status and statistics statistics of all SLAs + + + +R1# show track Displays information about objects that are tracked by the tracking process + + + + + +Note +Effective with Cisco IOS Releases 12.4(4)T, 12.2(33)SB, and 12.2(33)SXI, the ip sla monitor command is replaced bythe ip sla command. + + + + +Note +Effective with Cisco IOS Releases 12.4(4)T, 12.2(33)SB, and 12.2(33)SXI, the type echo protocol ipIcmpEcho command is replaced bythe icmp-echo command. + + + + +Note +Effective with Cisco IOS Releases 12.4(20)T, 12.2(33)SXI1, and 12.2(33)SRE and Cisco IOS XE Release 2.4, the track rtr command is replaced bythe track ip sla command. + + + + +Note +Effective with Cisco IOS Releases 12.4(20)T, 12.2(33)SXI1, and 12.2(33)SRE and Cisco IOS XE Release 2.4, the show ip sla monitor configuration command is replaced bythe show ip sla configuration command. + + + + +Note +Effective with Cisco IOS Releases 12.4(20)T, 12.2(33)SXI1, and 12.2(33)SRE and Cisco IOS XE Release 2.4, the show ip sla monitor statistics command is replaced bythe show ip sla statistics command. +Chapter 7 BGP + + + + +This chapter provides information about the following topics: + + +Configuring BGP: classic configuration + + + +Configuring Multiprotocol BGP (MP-BGP) + +Configuring BGP: address families + +Configuration example: using MP-BGP address families to exchange IPv4 and IPv6 routes + +BGP support for 4-byte AS numbers + +BGP timers + +BGP and update-source + +IBGP next-hop behavior + +EBGP multihop + +Attributes + + +Route selection decision process—the BGP best path algorithm + +Weight attribute + +Using AS path access lists to manipulate the weight attribute + +Using prefix lists and route maps to manipulate the weight attribute +Local preference attribute + +Using AS path access lists and route maps to manipulate the local preference attribute + +AS Path attribute prepending + +AS Path: removing private autonomous systems + +Multi-exit Discriminator (MED) attribute + + + +Verifying BGP + +Troubleshooting BGP + +Default routes + +Route aggregation + +Route reflectors + +Regular expressions + +Regular expressions: examples + +BGP route filtering using access lists and distribute lists + +Configuration example: using prefix lists and AS path access lists + +BGP peer groups + +Authentication for BGP + + +Configuring authentication between BGP peers + +Verifying BGP authentication + + + +CONFIGURING BGP: CLASSIC CONFIGURATION + + + +Router(config)# Starts BGP routing process 100 router bgp 100 +Note + + +Cisco IOS Software permits onlyone Border GatewayProtocol (BGP) process to run at a time; therefore, a router cannot belong to more than one autonomous system (AS) + + + + + + +Router(config-router)# neighbor +192.31.7.1 + +Identifies a peer router with which this router will establish a BGP session. The AS number will determine whether the neighbor router is an +external BGP (EBGP) or internal BGP (IBGP) + +remote-as 200 neighbor + + + + + +Tip + + +If the AS number configured in the router bgp command is identical to the AS number configured in the neighbor statement, BGP initiates an internal session (IBGP). If the field values differ, BGP builds an external session (EBGP) + + + + + + + + +Tip + + +neighbor statements must be symmetrical for a neighbor relationship to be established + + + + + + + +Router(config-router)# network +192.135.250.0 + +Tells the BGP process what locally learned +networks to advertise + + + +Note +The networks can be connected routes, static routes, or routes learned via a dynamic routing protocol, such as Open Shortest Path First (OSPF) + + + + + + + + +Note + + +Configuring just a network statement will not establish a BGP neighbor relationship + + + + + + + + +Note + + +The networks must also exist in the local router’s routing table; otherwise, theywill not be sent out in updates + + + + + + + +Router(config-router)# network 128.107.0.0 mask +255.255.255.0 + +Used to specify an individual subnet that must be present in the routing table or it will not be +advertised by BGP + + + + + + +Tip +Routes learned bythe BGP process are propagated bydefault but are often filtered bya routing policy. + + + + + +Caution +If you misconfigure a network command, such as the example network 192.168.1.1 mask 255.255.255.0, BGP will look for exactly192.168.1.1/24 in the routing table. It mayfind 192.168.1.0/24 or 192.168.1.1/32; however, it maynever find 192.168.1.1/24. Because there is no exact match for the 192.168.1.1/24 network, BGP does not announce it to anyneighbors. +Tip +If you issue the command network 192.168.0.0 mask 255.255.0.0 to advertise a CIDR block, BGP will look for 192.168.0.0/16 in the routing table. It mayfind 192.168.1.0/24 or 192.168.1.1/32; however, it maynever find 192.168.0.0/16. Because there is no exact match for the 192.168.0.0/16 network, BGP does not announce it to anyneighbors. In this case, you can configure a static route towards the Null interface so BGP can find an exact match in the routing table: +Click here to view code image + + +ip route 192.168.0.0 255.255.0.0 null0 + + +After finding this exact match in the routing table, BGP will announce the 192.168.0.0/16 network to any neighbors. + + + +CONFIGURING MULTIPROTOCOL BGP (MP-BGP) Original BGP was designed to carry only IPv4-specific information. A recent extension was defined to also support other protocols like IPv6. This extension is called MP-BGP (Multiprotocol BGP). MP-BGP is the supported Exterior Gateway Protocol (EGP) for IPv6. IPv6 enhancements to MP-BGP include support for IPv6 address family configuration. You can run MP-BGP over IPv4 or IPv6 transport and can exchange routes for IPv4, IPv6, or both. BGP uses TCP for peering, and this has no relevance to the routes carried inside the BGP exchanges. Both IPv4 and IPv6 can be used to transport a TCP connection on the network layer. + + +R1(config)# Enables the forwarding of IPV6 unicast datagrams ipv6 unicast- globally on the router +routing + + + +R1(config)# Starts the BGP routing process router bgp +65500 + + + +R1(config- Configures a fixed 32-bit router ID as the identifier of router)# bgp the local device running BGP +router-id 192.168.99.70 +Note + + +Configuring a router ID using the bgp router-id command resets all active BGP peering sessions, if anyare alreadyestablished + + + + + +R1(config- Disables the IPv4 unicast address family for the router)# no current BGP routing process +bgp default ipv4-unicast + +Note + + +Routing information for the IPv4 unicast address familyis advertised by default for each BGP routing session configured with the neighbor remote-as command unless you configure the no bgp default ipv4-unicast command before configuring the neighbor remote-as command. This command is optional and onlyrequired if the router is onlyrouting for IPv6 + + + + + +R1(config- Configures an IPv6 BGP neighbor router)# +neighbor 2001:0db8:12: :2 remote-as 65501 + + + + + +Note +When configuring BGP on a device that is enabled onlyfor IPv6 (that is, the device does not have an IPv4 address), you must manuallyconfigure the BGP router ID for the device. The BGP router ID, which is represented as a 32-bit value using an IPv4 address syntax, must be unique to the BGP peers of the device. + + + +CONFIGURING BGP: ADDRESS FAMILIES +Router(config)# Starts BGP routing process 100 router bgp 100 + + + + +Router(config)# neighbor +10.0.0.44 + +Adds the IPv4 address of the neighbor in the specified AS to the IPv4 multiprotocol BGP +neighbor table of the local device + +remote-as 200 + + + + +Router(config)# neighbor +2001:db8:0:cc00: + +Adds the IPv6 address of the neighbor in the specified AS to the IPv6 multiprotocol BGP +neighbor table of the local device + +:1 remote-as 200 + + + + +Router(config-router)# address-family ipv4 + + + +Router(config-router)# +address-family + +Enters into address-family configuration mode for IPv4. By default, the device is placed in configuration mode for the IPv4 unicast address family if a keyword is not specified + + + +Enters into address-family configuration mode and specifies only multicast address prefixes for +the IPv4 address family + +ipv4 multicast + + + + +Router(config-router)# +address-family + +Enters into address-family configuration mode and specifies only unicast address prefixes for the +IPv4 address family + +ipv4 unicast + + + + +Router(config-router)# +address-family + +Enters into address-family configuration mode and specifies CustomerA as the name of the VRF +instance to associate with subsequent IPv4 + +ipv4 vrf address-family configuration mode commands +CustomerA + + + +Note + + +Use this form of the command, which specifies a VRF, onlyto configure routing exchanges between provider edge (PE) and customer edge (CE) devices + + + + + + + +Router(config-router-af)# neighbor 10.0.0.44 activate + + + +Router(config- + +Enables the exchange of information with a BGP neighbor + + + + + + + + +Disables the exchange of information with the + +router-af)# no specified IPv6 neighbor neighbor +2001:db8:1:1::1 activate + + + + +Router(config-router-af)# +network + +Specifies the network to be advertised by the BGP +routing process + +10.108.0.0 mask 255.255.0.0 + + + +Router(config- Exits the IPv4 unicast address family router-af)# exit + + + + +Router(config-router)# +address-family + +Enters into address-family configuration mode for +IPv6 +ipv6 +Note + + +Bydefault, the device is placed into configuration mode for the IPv6 unicast address family. The keyword multicast is also a valid entry here, just like in IPv4 + + + + + + + +Router(config-router-af)# neighbor +2001:db8:0:cc00: + +Enables the neighbor to exchange prefixes for the +IPv6 address family with the local device + +:1 activate + + + + +Router(config-router-af)# network 2001:db8:1:1::/6 +4 + +Specifies the network to be advertised by the BGP +routing process + + + + +CONFIGURATION EXAMPLE: USING MP-BGP ADDRESS FAMILIES TO EXCHANGE IPV4 AND IPV6 ROUTES + +In this example, MP-BGP is used to exchange both IPv4 and IPv6 routes. The IPv4 routes will use an IPv4 TCP connection, and the IPv6 routes will use an IPv6 TCP connection. + +Figure 7-1 shows the network topology for the configuration that follows, which demonstrates how to configure MP-BGP using address families to exchange both IPv4 and IPv6 routes. Assume that all basic configurations are accurate. + + + +Figure 7-1 Configuring MP-BGP Using Address Families to Exchange IPv4 and IPv6 Routes + + + +R1(config)# ipv6 Enables the forwarding of IPv6 unicast unicast-routing datagrams globally on the router + + + +R1(config)# router Starts the BGP routing process bgp 65500 + + + +R1(config-router)# Configures R2 as an IPv6 BGP neighbor neighbor +2001:db8:12::2 remote-as 65501 + + + +R1(config-router)# Configures R2 as an IPv4 BGP neighbor neighbor +192.168.1.2 remote-as 65501 + + + +R1(config-router)# Enters IPv4 address-family configuration address-family ipv4 mode for unicast address prefixes unicast + + + + + +Tip + + +Unicast address prefixes are the default when IPv4 address prefixes are configured +R1(config-router- Enables the exchange of IPv4 BGP +af)# neighbor information with R2. The IPv4 neighbors will + +192.168.1.2 activate + + + +R1(config-router- + +be automatically activated, so this command is optional + + + +Advertises an IPv4 network into BGP + +af)# network 10.1.1.1 mask 255.255.255.255 + + + +R1(config-router- Exits the IPv4 address-family configuration af)# exit mode + + + +R1(config-router)# Enters IPv6 address-family configuration address-family ipv6 mode for unicast address prefixes unicast + + + +Tip + + +Unicast address prefixes are the default when IPv6 address prefixes are configured + + + + + + + +R1(config-router- Enables the exchange of IPv6 BGP af)# neighbor information with R2 2001:db8:12::2 +activate + + + +R1(config-router- Advertises an IPv6 network into BGP af)# network +2001:db8:1::1/64 + + + +R2(config)# ipv6 Enables the forwarding of IPv6 unicast unicast-routing datagrams globally on the router + + + +R2(config)# router Starts the BGP routing process bgp 65501 + + + +R2(config-router)# Configures R1 as an IPv6 BGP neighbor neighbor +2001:db8:12::1 remote-as 65500 + + + +R2(config-router)# Configures R1 as an IPv4 BGP neighbor neighbor +192.168.1.1 remote-as 65500 + + + +R2(config-router)# Enters IPv4 address-family configuration address-family ipv4 mode for unicast address prefixes unicast + + + +R2(config-router- Enables the exchange of IPv4 BGP +af)# neighbor information with R1. The IPv4 neighbors will + +192.168.1.1 activate + + + +R2(config-router- + +be automatically activated, so this command is optional + + + +Advertises an IPv4 network into BGP + +af)# network 10.2.2.2 mask 255.255.255.255 +R2(config-router- Exits the IPv4 address-family configuration af)# exit mode + + + +R2(config-router)# Enters IPv6 address-family configuration address-family ipv6 mode for unicast address prefixes unicast + + + +R2(config-router- Enables the exchange of IPv6 BGP af)# neighbor information with R1 2001:db8:12::1 +activate + + + +R2(config-router- Advertises an IPv6 network into BGP af)# network +2001:db8:2::1/64 + + + +BGP SUPPORT FOR 4-BYTE AS NUMBERS + +Prior to January 2009, BGP autonomous system (AS) numbers that were allocated to companies were two-octet numbers in the range from 1 to 65 535 as described in RFC 4271. Due to increased demand for AS numbers, the Internet Assigned Number Authority (IANA) started to allocate four-octet AS numbers in the range from 65 536 to 4 294 967 295. + +Cisco has implemented the following two methods: + + +Asplain: Decimal value notation where both 2-byte and 4-byte AS numbers are represented by their decimal value. For example, 65 526 is a 2-byte AS number and 234 567 is a 4-byte AS number. + + + +Asdot: Autonomous system dot notation where 2-byte AS numbers +are represented by their decimal value and 4-byte AS numbers are represented by a dot notation. For example, 65 526 is a 2-byte AS number and 1.169031 is a 4-byte AS number (this is dot notation for the 234 567 decimal number). + + +Cisco implementation of 4-byte autonomous system (AS) numbers uses asplain—65 538, for example—as the default regular expression match and output display format for AS numbers, but you can configure 4-byte AS numbers in both the asplain format and the asdot format as described in RFC 5396. + + + +Router(conf ig-router)# bgp asnotation +dot + +Changes the default output format of BGP 4-byte AS numbers from asplain (decimal values) to dot notation. Use the no keyword with this command to revert to the +asplain format + + + + + +Note + + +4-byte AS numbers can be configured using either asplain format or asdot format. This command affects onlythe output displayed for showcommands or the matching of regular expressions + + + + + + +Router# Clears and resets all current BGP sessions clear ip +bgp * A hard reset is performed to ensure that the 4-byte AS number format change is reflected in all BGP sessions + + + +BGP TIMERS + + + +Router(config- Sets BGP network timers. BGP keepalives will be +router)# sent every 70 seconds and the holdtime for declaring timers bgp 70 a BGP peer as dead is set to 120 seconds +120 + + + + +Note + + +Bydefault, the keepalive timer is set to 60 seconds and the holdtime timer is set to 180 seconds + + + + + + +BGP AND UPDATE-SOURCE + + + +Router(config Starts the BGP routing process )# router bgp +100 + + + + +Router(config -router)# neighbor 172.16.1.2 +update-source + +The update-source keyword informs the router to use any operational interface as the source IP address for TCP connections. The loopback interface is commonly selected because it never goes down, +which adds stability to the configuration + +loopback 0 + + + + +Tip + + +Without the neighbor update-source command, BGP will use the closest IP interface to the peer. This command provides BGP with a more robust configuration, because BGP will still operate in the event the link to the closest interface fails + + + + + + + + +Note +You can use the neighbor update-source command with either EBGP or IBGP sessions. In the case of a point-to-point EBGP session, this command is not needed because there is onlyone path for BGP to use + + + + + + +IBGP NEXT-HOP BEHAVIOR + +The EBGP next-hop attribute is the IP address that is used to reach the advertising router. For EBGP peers, the next-hop address is, in most cases, the IP address of the connection between the peers. For IBGP, the EBGP next-hop address is carried into the local AS. + +Figure 7-2 shows the network topology for the configuration that follows, which demonstrates how to configure the next-hop attribute. The objective here is to allow R3 to learn the correct next-hop address when trying to reach networks outside its AS. Assume that all basic and OSPF configurations are accurate. + + + + + + + + + + + + +Figure 7-2 IBGP Next-Hop Behavior + + + + +R2(config)# Starts the BGP routing process router bgp +64511 + + + +R2(config- Identifies R1 as an EBGP neighbor router)# +neighbor +209.165.202.1 29 remote-as 64496 + + + + +R2(config-router)# neighbor 172.16.1.2 remote-as 64511 + + + +R2(config-router)# neighbor 172.16.1.2 +update-source + +Identifies R3 as an IBGP neighbor + + + + + + + + + + + + +Informs R2 to use the Loopback 0 IP address (172.16.1.1) as the source IP address for all BGP TCP +packets sent to R3 + +loopback 0 + + + + +R2(config-router)# neighbor 172.16.1.2 +next-hop-self + +Allows R2 to advertise itself as the next hop to its IBGP neighbor for networks learned from AS 64496. R3 will then use 172.16.1.1 as the next hop to reach network 209.165.201.0/27 instead of using the EBGP +next hop of 209.165.202.129 + + + + +EBGP MULTIHOP + +By default, EBGP neighbors exchange packets with a TTL (Time To Live) set to 1. If you attempt to establish an EBGP session between loopbacks, BGP packets will be dropped due to an expired TTL. + +Figure 7-3 shows the network topology for the configuration that follows, which demonstrates how to configure EBGP multihop. Assume that all basic configurations are accurate. + + + + + + + + +Figure 7-3 EBGP Multihop + + + + + +R1(config)# ip route +10.20.20.1 + +Defines a static route to the Loopback 0 +address on R2 + +255.255.255.255 209.165.201.2 + + + +R1(config)# router bgp Starts the BGP routing process 64496 + + + +R1(config-router)# Identifies a peer router at 10.20.20.1 neighbor 10.20.20.1 +remote-as 64511 + + + +R1(config-router)# Informs R1 to use the Loopback 0 IP neighbor 10.20.20.1 address as the source IP address for all update-source loopback BGP TCP packets sent to R2 +0 + + + +R1(config-router)# Allows for two routers that are not neighbor 10.20.20.1 directly connected to establish an EBGP ebgp-multihop 2 session. A TTL value of 2 is defined + + + + +R2(config)# ip route +10.10.10.1 + +Defines a static route to the Loopback 0 +address on R1 +255.255.255.255 209.165.201.1 + + + +R2(config)# router bgp Starts the BGP routing process 64511 + + + +R2(config-router)# Identifies a peer router at 10.10.10.1 neighbor 10.10.10.1 +remote-as 64496 + + + +R2(config-router)# Informs R2 to use the Loopback 0 IP neighbor 10.10.10.1 address as the source IP address for all update-source loopback BGP TCP packets sent to R1 +0 + + + +R2(config-router)# Allows for two routers that are not neighbor 10.10.10.1 directly connected to establish an EBGP ebgp-multihop 2 session. A TTL value of 2 is defined + + + + + +Note +The ebgp-multihop keyword is a Cisco IOS option. It must be configured on each peer. The ebgp-multihop keyword is onlyused for EBGP sessions, not for IBGP. EBGP neighbors are usuallydirectlyconnected (over a WAN connection, for example) to establish an EBGP session. However, sometimes one of the directly connected routers is unable to run BGP. The ebgp-multihop keyword allows for a logical connection to be made between peer routers, even if theyare not directlyconnected. The ebgp-multihop keyword allows for an EBGP peer to be up to 255 hops awayand still create an EBGP session. + + + + +Note +If redundant links exist between two EBGP neighbors and loopback addresses are used, you must configure ebgp-multihop. Otherwise, the router decrements the TTLbefore giving the packet to the loopback interface, meaning that the normal IP forwarding logic discards the packet. + + + +ATTRIBUTES +Routes learned via BGP have associated properties that are used to determine the best route to a destination when multiple paths exist to a particular destination. These properties are referred to as BGP attributes, and an understanding of how BGP attributes influence route selection is required for the design of robust networks. After describing the route selection process, this section describes the attributes that BGP uses in the route selection process. + +Route Selection Decision Process—The BGP Best Path Algorithm + +Border Gateway Protocol routers typically receive multiple paths to the same destination. The BGP best path algorithm decides which is the best path to install in the IP routing table and to use for traffic forwarding. + +Initially, a path is not considered if its next hop cannot be reached. Afterward, the decision process for determining the best path to reach a destination is based on the following: + +1. Prefer the path with the highest weight (local to the router). + +2. If the weights are the same, prefer the path with the highest local preference (global within the AS). + +3. If the local preferences are the same, prefer the path that was originated by the local router (next hop = 0.0.0.0). + +4. If no route was originated, prefer the route that has the shortest autonomous system path. + +5. If all paths have the same AS path length, prefer the path with the lowest origin code (where IGP is lower than EGP, and EGP is lower than Incomplete). + +6. If the origin codes are the same, prefer the path with the lowest Multi-exit Discriminator (MED) attribute. +7. If the paths have the same MED, prefer the external path (EBGP) over the internal path (IBGP). + +8. If the paths are still the same, prefer the path through the lowest IGP metric to the BGP next hop. + +9. Determine if multiple paths require installation in the routing table for BGP Multipath. + +10. For EBGP paths, select the oldest route to minimize the effects of route flapping. + +11. Prefer the route with the lowest neighbor BGP router ID value. + +12. If the originator or router ID is the same for multiple paths, prefer the path with the minimum cluster list length. + +13. If the BGP router IDs are the same, prefer the router with the lowest neighbor IP address. + +Weight Attribute + +Weight is a Cisco-specific parameter. The weight is configured locally on a router and is not propagated to any other routers. This attribute applies when one router is used with multiple exit points out of an AS, as opposed to the local preference attribute, which is used when two or more routers provide multiple exit points. + +Figure 7-4 shows the network topology for the configuration that follows, which demonstrates how to configure the weight attribute. Assume that all basic configurations are accurate. + + + + + + + + + + + + + + + + + + + + + + + + +Figure 7-4 Weight Attribute + + + + +Houston(config)# router bgp Starts the BGP routing process 300 + + + +Houston(config-router)# Identifies a peer router at neighbor 192.168.7.1 remote- 192.168.7.1 +as 100 + + + +Houston(config-router)# Sets the weight of all route + +neighbor 192.168.7.1 weight +2000 + + +updates from neighbor +192.168.7.1 to 2000 + + + + +Houston(config-router)# Identifies a peer router at neighbor 192.168.219.1 192.168.219.1 +remote-as 200 +Houston(config-router)# Sets the weight of all route neighbor 192.168.219.1 updates from neighbor weight 1000 192.168.219.1 to 1000 + + +The result of this configuration will have Houston forward traffic to the 172.16.10.0 network through AS 100, because the route entering AS 300 from AS 100 has a higher weight attribute set compared to that same route advertised from AS 200. + + + +Note +The weight attribute is local to the router and not propagated to other routers. Bydefault, the weight attribute is 32 768 for paths that the router originates, and 0 for other paths. Routes with a higher weight are preferred when there are multiple routes to the same destination. + + + +Using AS Path Access Lists to Manipulate the Weight Attribute + +Refer to Figure 7-4 for the configuration that follows, which demonstrates how to configure the weight attribute using AS path access lists. + + +Houston(co Starts the BGP routing process nfig)# +router bgp 300 + + +Houston(co Identifies a peer router at 192.168.7.1 nfig- +router)# neighbor 192.168.7. 1 remote-as 100 +Houston(co nfig-router)# neighbor +192.168.7. + +Assigns a weight attribute of 2000 to updates from the neighbor at 192.168.7.1 that are permitted by access list 5. Access list 5 is defined in the ip as-path access-list 5 command listed below in global configuration mode. +Filter list 5 refers to the ip as-path access-list 5 + +1 filter- command that defines which path will be used to have list 5 this weight value assigned to it +weight 2000 + + + + +Houston(co nfig-router)# neighbor 192.168.21 9.1 remote-as 200 + + + +Houston(co nfig-router)# neighbor 192.168.21 9.1 +filter- + +Identifies a peer router at 192.168.219.1 + + + + + + + + + + + + + + + + +Assigns a weight attribute of 1000 to updates from the neighbor at 192.168.219.1 that are permitted by access list 6. Access list 6 is defined in the ip as-path access-list 5 +command listed below in global configuration mode + +list 6 weight 1000 + + + +Houston(co Returns to global configuration mode nfig- +router)# +exit + + + +Houston(co Permits updates whose AS path attribute shows the nfig)# ip update passing through AS 100 + +as-path access-list 5 permit _100_ + + + + + + + +Houston(co + + + + + + +Note + + +The _ symbol is used to form regular expressions. See the section “Regular Expressions” in this chapter (after the sections on the different attributes) for more examples + + + + + +Permits updates whose AS path attribute shows the + +nfig)# ip update passing through AS 200 as-path +access-list 6 permit _200_ + + +The result of this configuration will have Houston forward traffic for the 172.16.10.0 network through AS 100, because it has a higher weight attribute set as compared to the weight attribute set for the same update from AS 200. Adding the AS path access list allows you to filter prefixes based on (1) their originating AS, (2) the AS they pass through, or (3) the identity of the connected neighbor AS. + +Using Prefix Lists and Route Maps to Manipulate the Weight Attribute + +Refer to Figure 7-4 for the configuration that follows, which demonstrates how to configure the weight attribute using prefix lists and route maps. The objective here is for Houston to prefer the +path through Austin to reach the 172.16.10.0/24 network. + + +Houston(config)# Creates a prefix list that matches the +ip prefix-list 172.16.10.0/24 network belonging to AS 400 AS400_ROUTES +permit 172.16.10.0/24 + + + + +Houston(config)# +route-map + +Creates a route map called SETWEIGHT. This +route map will permit traffic based on the + + + +SETWEIGHT permit +10 + + +subsequent criteria. A sequence number of 10 +is assigned + + + + +Houston(config- Specifies the condition under which policy route-map)# match routing is allowed, matching the +ip address prefix- AS400_ROUTES prefix list list AS400_ROUTES + + + +Houston(config- Assigns a weight of 200 to any route update route-map)# set that meets the condition of prefix list weight 200 AS400_ROUTES + + + +Houston(config- Creates the second statement for the route map route-map)# route- named SETWEIGHT. This route map will +map SETWEIGHT permit traffic based on subsequent criteria. A permit 20 sequence number of 20 is assigned + + + +Houston(config- Assigns a weight of 100 to all other route route-map)# set updates/networks learned +weight 100 + + + +Houston(config- Returns to global configuration mode +route-map)# exit + + + +Houston(config)# Starts the BGP routing process router bgp 300 + + + +Houston(config- Uses the route map SETWEIGHT to filter all router)# neighbor routes learned from neighbor 192.168.7.1 192.168.7.1 route- +map SETWEIGHT in + + + +Local Preference Attribute + +Local preference is a BGP attribute that provides information to routers in the AS about the path that is preferred for exiting the AS. A path with a higher local preference is preferred. The local preference is an attribute that is configured on a router and exchanged among routers within the same AS only. + + +R1(config-router)# bgp Changes the default local default local-preference 150 preference value from 100 to 150 + + + + + +Note +The local preference value can be a number between 0 and 429 496 729. Higher is preferred. If a local-preference value is not set, the default is 100. + + + + +Note +The local preference attribute is local to the AS; it is exchanged between IBGP peers but not advertised to EBGP peers. Use the local preference attribute to force BGP routers to prefer one exit point over another. + + + +Using AS Path Access Lists with Route Maps to Manipulate the Local Preference Attribute +Route maps provide more flexibility than the bgp default local-preference router configuration command. + +Figure 7-5 shows the network topology for the configuration that follows, which demonstrates how to configure the local-preference attribute using AS path access lists with route maps. The objective here is to prefer Galveston as the exit point out of AS 256 for all networks originating in AS 300. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 7-5 Using AS Path Access Lists with Route Maps to Manipulate the Local Preference Attribute + + + +Galveston(config)# Starts the BGP routing process router bgp 256 +Galveston(config- Identifies a peer router at 172.17.1.1 router)# neighbor +172.17.1.1 remote-as 300 + + + +Galveston(config- Refers to a route map called SETLOCAL. All router)# neighbor network updates received from neighbor 172.17.1.1 route-map 172.17.1.1 will be processed by the route SETLOCAL in map + + + +Galveston(config- Identifies a peer router at 10.1.1.1 + +router)# 10.1.1.1 +256 + +neighbor +remote-as + + + + +Galveston(config- Returns to global configuration mode router)# exit + + + +Galveston(config)# Permits updates whose AS path attribute ip as-path access- starts with 300 (represented by the ^) and list 7 permit ^300$ ends with 300 (represented by the $) + + + +Galveston(config)# Creates a route map called SETLOCAL. This route-map SETLOCAL route map will permit traffic based on permit 10 subsequent criteria. A sequence number of +10 is assigned + + + +Galveston(config- Specifies the condition under which policy route-map)# match routing is allowed, matching the BGP ACL 7 as-path 7 +Galveston(config- Assigns a local preference of 200 to any route-map)# set update originating from AS 300, as defined local-preference 200 by ACL 7 + + + +Galveston(config- Creates the second statement of the route route-map)# route- map SETLOCAL. This instance will accept map SETLOCAL permit all other routes +20 + + + + +Note + + +Forgetting a permit statement at the end of the route map is a common mistake that prevents the router from learning anyother routes + + + + + + +AS Path Attribute Prepending + +AS paths can be manipulated by prepending AS numbers to the existing AS paths. Assuming that the values of all other attributes are the same, routers will pick the shortest AS path attribute; therefore, prepending numbers to the path will manipulate the decision as to the best path. Normally, AS path prepending is performed on outgoing EBGP updates over the undesired return path. + +Refer to Figure 7-6 for the configuration that follows, which demonstrates the commands necessary to configure the as-path prepend option. Assume that all basic configurations are accurate. + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 7-6 AS Path Attribute Prepending + + + +In this scenario, you want to use the configuration on Houston to influence the choice of paths in AS 600. Currently, the routers in AS 600 have reachability information to the 192.168.219.0/24 network via two routes: (1) via AS 100 with an AS path attribute of (100, 300), and (2) via AS 400 with an AS path attribute of (400, 200, 300). Assuming that the values of all other attributes are the same, the routers in AS 600 will pick the shortest AS path attribute: the route through AS 100. You will prepend, or add, extra AS numbers to the AS path attribute for routes that Houston advertises to AS 100 to have AS 600 select AS 400 as the preferred path of reaching the 192.168.219.0/24 network. + + +Houston(config)# Starts the BGP routing process router bgp 300 +Houston(config- Tells the BGP process what locally learned router)# network networks to advertise +192.168.219.0 + + + +Houston(config- Identifies a peer router at 192.168.220.2 router)# neighbor +192.168.220.2 remote-as 200 + + + +Houston(config- Identifies a peer router at 192.168.7.2 router)# neighbor +192.168.7.2 remote-as 100 + + + +Houston(config- Read this command to say, “All routes sent to router)# neighbor neighbor 192.168.7.2 will have to follow the 192.168.7.2 conditions laid out by the SETPATH route map” route-map SETPATH +out + + + +Houston(config- Returns to global configuration mode router)# exit + + + +Houston(config)# Creates a route map named SETPATH. This route-map SETPATH route map will permit traffic based on +permit 10 subsequent criteria. A sequence number of 10 is assigned + + + +Houston(config- Read this command to say, “The local router route-map)# set will add (prepend) the AS number 300 twice to as-path prepend the AS path attribute before sending updates +300 300 out to its neighbor at 192.168.7.2” + + + +The result of this configuration is that the AS path attribute of updates for network 192.168.219.0 that AS 600 receives via AS 100 will be (100, 300, 300, 300), which is longer than the value of the AS path attribute of updates for network 192.168.219.0 that AS 600 receives via AS 400 (400, 200, 300). + +AS 600 will choose AS 400 (400, 200, 300) as the better path. This is because BGP is a path vector routing protocol that chooses the path with the least number of ASs that it must cross. + +AS Path: Removing Private Autonomous Systems + +Private AS numbers (64,512 to 65,535) cannot be passed on to the Internet because they are not unique. Cisco has implemented a feature, remove-private-as, to strip private AS numbers out of the AS path list before the routes get propagated to the Internet. + +Figure 7-7 shows the network topology for the configuration that follows, which demonstrates the remove-private-as option. Assume that all basic configurations are accurate. + + + + + + + + + + + +Figure 7-7 AS Path: Removing Private Autonomous Systems + + + + +RTB(config)# router bgp 1 Starts the BGP routing process + + + +RTB(config-router)# neighbor Identifies a peer router at +172.16.20.2 remote-as 65001 172.16.20.2 + + + +RTB(config-router)# neighbor Identifies a peer router at 198.133.219.1 remote-as 7 198.133.219.1 + + + +RTB(config-router)# neighbor Removes private AS numbers + +198.133.219.1 remove- +private-as + +from the path in outbound +routing updates + + + + + + +Note + + +The remove-private-as command is available for EBGP neighbors only + + + + + + +Multi-Exit Discriminator (MED) Attribute + +The MED attribute, also called the BGP metric, can be used to indicate to EBGP neighbors what the preferred path is into an AS. Unlike local preference, the MED is exchanged between ASs. The MED is sent to EBGP peers. By default, a router compares the MED attribute only for paths from neighbors in the same AS. The metric command is used to configure the MED attribute. + +Figure 7-8 shows the commands necessary to configure the MED attribute. Assume that all basic configurations are accurate. The objective here is to influence Mazatlan to choose Houston as the entry point for AS 300 to reach network 192.168.100.0. + + + + + + + + + + + + + + + + + + + + + + + +Figure 7-8 MED Attribute + + + + +Mazatlan(config)# Starts the BGP routing process router bgp 100 + + + +Mazatlan(config- Identifies a peer router at 10.2.0.1 + +router)# 10.2.0.1 +300 + +neighbor +remote-as + + + + +Mazatlan(config- Identifies a peer router at 10.3.0.1 + +router)# 10.3.0.1 +300 + +neighbor +remote-as + + + + +Mazatlan(config- Identifies a peer router at 10.4.0.1 router)# neighbor +10.4.0.1 remote-as 400 + + + +Acapulco(config)# Starts the BGP routing process router bgp 400 + + + +Acapulco(config- Identifies a peer router at 10.4.0.2 + +router)# 10.4.0.2 +100 + +neighbor +remote-as + + + + +Acapulco(config- Refers to a route map named SETMEDOUT + +router)# +10.4.0.2 + +neighbor +route-map + +SETMEDOUT out + + + +Acapulco(config- Identifies a peer router at 10.5.0.2 + +router)# 10.5.0.2 +300 + +neighbor +remote-as + + + + +Acapulco(config- Returns to global configuration mode router)# exit + + + +Acapulco(config)# Creates a route map named SETMEDOUT. route-map SETMEDOUT This route map will permit traffic based on permit 10 subsequent criteria. A sequence number of +10 is assigned + + + +Acapulco(config- Sets the metric value for BGP route-map)# set +metric 50 + + + +Houston(config)# Starts the BGP routing process router bgp 300 + + + +Houston(config- Identifies a peer router at 10.2.0.1 + +router)# 10.2.0.2 +100 + +neighbor +remote-as + + + + +Houston(config- Refers to a route map named SETMEDOUT + +router)# +10.2.0.2 + +neighbor +route-map + +SETMEDOUT out + + + +Houston(config- Identifies a peer router at 10.1.0.2 + +router)# 10.1.0.2 +300 + +neighbor +remote-as + + + + +Houston(config- Returns to global configuration mode router)# exit + + + +Houston(config)# Creates a route map named SETMEDOUT. route-map SETMEDOUT This route map will permit traffic based on permit 10 subsequent criteria. A sequence number of +10 is assigned + + + +Houston(config- Sets the metric value for BGP route-map)# set +metric 120 +Galveston(config)# Starts the BGP routing process router bgp 300 + + + +Galveston(config- Identifies a peer router at 10.3.0.2 + +router)# 10.3.0.2 +100 + +neighbor +remote-as + + + + +Galveston(config- Refers to a route map named SETMEDOUT + +router)# +10.3.0.2 + +neighbor +route-map + +SETMEDOUT out + + + +Galveston(config- Identifies a peer router at 10.1.0.1 + +router)# 10.1.0.1 +300 + +neighbor +remote-as + + + + +Galveston(config- Identifies a peer router at 10.5.0.1 + +router)# 10.5.0.1 +400 + +neighbor +remote-as + + + + +Galveston(config- Returns to global configuration mode router)# exit + + + +Galveston(config)# Creates a route map named SETMEDOUT. route-map SETMEDOUT This route map will permit traffic based on permit 10 subsequent criteria. A sequence number of +10 is assigned +Galveston(config- Sets the metric value for BGP route-map)# set +metric 200 + + + + + +A lower MED value is preferred over a higher MED value. The default value of the MED is 0. It is possible to change the default value of the MED using the default-metric command under the BGP process. + + + +Unlike local preference, the MED attribute is exchanged between autonomous systems, but a MED attribute that comes into an AS does not leave the AS. + +Unless otherwise specified, the router compares MED attributes for paths from external neighbors that are in the same AS. + +If you want MED attributes from neighbors in other ASs to be compared, you must configure the bgp always-compare-med command. + + + + +Note +Bydefault, BGP compares the MED attributes of routes coming from neighbors in the same external AS (such as AS 300). Mazatlan can onlycompare the MED attribute coming from Houston (120) to the MED attribute coming from Galveston (200) even though the update coming from Acapulco has the lowest MED value. Mazatlan will choose Houston as the best path for reaching network 192.168.100.0. + + + +To force Mazatlan to include updates for network 192.168.100.0 from Acapulco in the comparison, use the bgp always-compare-med router configuration command on Mazatlan: + +Click here to view code image + + +Mazatlan(config)# router bgp 100 +Mazatlan(config-router)# neighbor 10.2.0.1 remote-as 300 Mazatlan(config-router)# neighbor 10.3.0.1 remote-as 300 Mazatlan(config-router)# neighbor 10.4.0.1 remote-as 400 Mazatlan(config-router)# bgp always-compare-med +Assuming that all other attributes are the same, Mazatlan will choose Acapulco as the best next hop for reaching network 192.168.100.0. + + + +Note +The most recent IETF decision about BGP MED assigns a value of infinityto the missing MED, making the route that is lacking the MED variable the least preferred. The default behavior of BGP routers that are running Cisco IOS Software is to treat routes without the MED attribute as having a MED of 0, making the route that is lacking the MED variable the most preferred. To configure the router to conform to the IETF standard, use the bgp bestpath missing-as-worst command. + + + +VERIFYING BGP + + + +Router# show bgp Displays routes for all address families all community belonging to a particular BGP community + + + +Router# show bgp Displays information about BGP connections all neighbors to neighbors of all address families + + + +Router# show bgp Displays entries in the IPv6 BGP routing ipv6 unicast table + + + +Router# show bgp Displays the IPv6 BGP routes that fail to ipv6 unicast rib- install in the Routing Information Base (RIB) failure table + + + + +Router# show ip bgp + + + +Router# show ip bgp + +Displays entries in the BGP table + + + +Displays information about the BGP and TCP + +neighbors connections to neighbors + + + +Router# show ip bgp Displays networks that are not installed in +rib-failure the RIB and the reason that they were not installed + + + +Router# show ip bgp +summary + +Displays the status of all IPv4 BGP +connections + + + + +Router# show bgp Displays the status of all IPv6 BGP ipv6 unicast connections +summary + + + +Router# show ip Displays the IPv4 BGP entries from the route bgp routing table + + + +Router# show ipv6 Displays the IPv6 BGP entries from the route bgp routing table + + + +TROUBLESHOOTING BGP + +Whenever the routing policy changes due to a configuration change, BGP peering sessions must be reset by using the clear ip bgp command. Cisco IOS Software supports the following three mechanisms to reset BGP peering sessions: + + +Hard reset: A hard reset tears down the specified peering sessions, including the TCP connection, and deletes routes coming from the specified peer. + + + +Soft reset: A soft reset uses stored prefix information to reconfigure and activate BGP routing tables without tearing down existing peering sessions. Soft reconfiguration can be configured for inbound or outbound sessions. +Dynamic inbound soft reset: The route refresh capability, as defined in RFC 2918, allows the local device to reset inbound routing tables dynamically by exchanging route refresh requests to supporting peers. To determine if a BGP device supports this capability, use the show ip bgp neighbors command. This is the preferred method of refreshing BGP information. + + + +Router# clear Forces BGP to clear its table and resets all BGP ip bgp * sessions + + + +Router# clear Resets BGP connections for the IPv4 unicast address ip bgp ipv4 family session for the specified autonomous-system-unicast number +autonomous-system-number + + + +Router# clear Resets BGP connections for the IPv6 unicast address ip bgp ipv6 family session for the specified autonomous-system-unicast number +autonomous-system-number + + + +Router# clear Resets the specific BGP session with the neighbor at ip bgp 10.1.1.1 +10.1.1.1 + + + +Router# clear Forces the remote router to resend all BGP +ip bgp information to the neighbor without resetting the 10.1.1.2 soft connection. Routes from this neighbor are not lost out +Tip + + +The clear ip bgp w.x.y.z soft out command is highlyrecommended when you are changing an outbound policyon the router. The soft out option does not help if you are changing an inbound policy + + + + + + + +Tip + + +The soft keyword of this command is optional; clear ip bgp out will do a soft reset for all outbound updates + + + + + + + + +Router(config-router)# +neighbor + +Causes the router to store all updates from this +neighbor in case the inbound policy is changed + +10.1.1.2 soft- + +reconfiguratio +n inbound + + +Caution + + +The soft-reconfiguration inbound command is memoryintensive + + + + + + + + +Router# clear Uses the stored information to generate new ip bgp inbound updates +10.1.1.2 soft in + + + +Router# clear Creates a dynamic soft reset of inbound BGP routing ip bgp {* | table updates. Routes are not withdrawn. Updates 10.1.1.2} are not stored locally. The connection remains [soft in | in] established. See the notes that follow for more +information on when this command can be used +Router# debug Displays all information related to BGP ip bgp + + + +Router# debug Displays all BGP event information ip bgp events + + + +Router# debug Displays information about the processing of BGP ip bgp updates update + + + +Router# debug Displays all IPv4 unicast address family information ip bgp ipv4 +unicast + + + +Router# debug Displays all IPv6 unicast address family information ip bgp ipv6 +unicast + + + + + +Note +Beginning with Cisco IOS Releases 12.0(2)S and 12.0(6)T, Cisco introduced a BGP soft reset enhancement feature known as route refresh. Route refresh is not dependent on stored routing table update information. This method requires no preconfiguration and requires less memorythan previous soft methods for inbound routing table updates. + + + + +Note +To determine whether a BGP router supports route refresh capability, use the show ip bgp neighbors command. The following message is displayed in the output when route refresh is supported: + + + +Click here to view code image + + +Received route refresh capability from peer + + + + +Note +When a BGP session is reset and soft reconfiguration is used, several commands enable you to monitor BGP routes that are received, sent, or filtered: +Click here to view code image + + +Router# show ip bgp +Router# show ip bgp neighbor address advertised Router# show ip bgp neighbor address received Router# show ip bgp neighbor address routes + + + + + +Caution +The clear ip bgp * command is both processor and memoryintensive and should be used onlyin smaller environments. Amore reasonable approach is to clear onlya specific network or a specific session with a neighbor with the clear ip bgp specific-network command. However, you can use this command whenever the following changes occur: + + + +Additions or changes to the BGP-related access lists + +Changes to BGP-related weights + +Changes to BGP-related distribution lists + +Changes in the BGP timer’s specifications + +Changes to the BGP administrative distance + + + +Changes to BGP-related route maps + + + +DEFAULT ROUTES + + + +Router(config)# router bgp Starts the BGP routing process 100 + + + +Router(config-router)# Identifies a peer router at neighbor 192.168.100.1 192.168.100.1 +remote-as 200 +Router(config-router)# States that the default route of neighbor 192.168.100.1 0.0.0.0 will only be sent to default-originate 192.168.100.1 + + + + + +Note +If you want your BGP router to advertise a default to all peers and the 0.0.0.0 route exists in the routing table, use the network command with an address of 0.0.0.0: +Click here to view code image + + +R1(config)# router bgp 100 +R1(config-router)# neighbor 172.16.20.1 remote-as 150 R1(config-router)# neighbor 172.17.1.1 remote-as 200 R1(config-router)# network 0.0.0.0 + + + + +ROUTE AGGREGATION + + + + +R1(config-router)# aggregate-address 172.16.0.0 255.255.0. 0 + + + +R1(config-router)# aggregate-address 172.16.0.0 +255.255.0. + +Creates an aggregate entry in the BGP routing table if any more-specific BGP routes are available that fall within the specified range. The aggregate route will be advertised as coming from your AS and will have the atomic aggregate attribute set. More specific routes will also be advertised unless the summary-only keyword is added at the end of the command + + + +Creates the aggregate route but also suppresses advertisements of more-specific routes to all neighbors. Specific AS path information to the individual subnets +that fall within the summary is lost + +0 summary-only +R1(config-router)# aggregate-address 172.16.0.0 +255.255.0. + +Creates an aggregate entry but the path advertised for this route will be a list of AS paths from where the individual +subnets originated + +0 as-set + + + +ROUTE REFLECTORS + +By default, a router that receives an EBGP route advertises it to its EBGP and IBGP peers. However, if it receives it through IBGP, it does not advertise it to its IBGP peers, as a loop-prevention mechanism (split horizon). Because of this behavior, the only way for all IBGP routers to receive a route after it is originated into the AS is to have a full mesh of IBGP peers. This can get complex with a large number of peers. A route reflector allows a topology to get around the IBGP limitation of having to have a full mesh. + +Figure 7-9 shows the commands necessary to configure BGP route reflectors. Assume that basic BGP configurations are accurate. The objective is to allow R2 to advertise to R1 the 209.165.201.0/27 network learned from R3. Without these commands, R1 will never learn the 209.165.201.0/27 network unless a full-mesh IBGP topology is built. +Figure 7-9 Route Reflectors + + + + + +R2(config)# router bgp +65010 + +Enters BGP routing configuration +mode + + + + +R2(config-router)# Configures the local router as a BGP neighbor 10.1.1.1 route- route reflector and the specified + +reflector-client + + + +R2(config-router)# + + +neighbor as a client + + + +Configures the local router as a BGP + +neighbor 10.3.3.3 route- route reflector and the specified reflector-client neighbor as a client + + + +REGULAR EXPRESSIONS + +A regular expression is a pattern to match against an input string, such as those listed in the following table. + + +Char Description acte +r + + + +^ Matches the beginning of the input string + + + +$ Matches the end of the input string + + + +_ Matches a space, comma, left brace, right brace, the beginning of an input string, or the ending of an input stream + + + +. Matches any single character +* Matches 0 or more single- or multiple-character patterns + + + +For example, in the case of the ip as-path access-list command, the input string is the AS path attribute. + + +Router(config Matches any AS path that includes the pattern of )# ip as-path 2150 +access-list 1 permit 2150 + + + +Router# show Matches any AS path that includes the pattern of ip bgp regexp 2150 +2150 + + + + +Note + + +In both previous commands, not onlywill AS 2150 be a match, but so will AS 12 150 or 21 507 + + + + + +Router(config Denies updates whose AS path attribute starts with )# ip as-path 200 (represented by the ^) and ends with 200 access-list 6 (represented by the $) +deny ^200$ + + + +Router(config Permits updates whose AS path attribute starts with )# ip as-path any character—represented by the period (.) symbol— access-list 1 and repeats that character—the asterisk (*) symbol permit .* means a repetition of that character + + + + + +Note +The argument of .* will match anyvalue of the AS path attribute + + + + + + +REGULAR EXPRESSIONS: EXAMPLES + +Refer to the following show ip bgp output to see how different examples of regular expressions can help filter specific patterns: + +Click here to view code image + + +R1# show ip bgp +Network Next Hop Metric LocPrf Weight Path + +* i172.16.0.0 65003 i +*>i *>i172.24.0.0 * i +65004 + +*>i172.30.0.0 * i +65004 i *>i192.168.3.3/32 + +172.20.50.1 100 + +192.168.28.1 100 172.20.50.1 100 192.168.28.1 100 + + +172.20.50.1 100 192.168.28.1 100 + +0.0.0.0 0 + +0 65005 65004 + +0 65002 65003 i 0 65005 i +0 65002 65003 + +65005 i +0 65005 65004 i 0 65002 65003 + +32768 i + + + +To find all subnets originating from AS 65004 (AS path ends with 65004): + +Click here to view code image + + +R1# show ip bgp regexp _65004$ +Network Next Hop Metric LocPrf Weight Path + +*>i172.30.0.0 * i +65004 i + +172.20.50.1 100 192.168.28.1 100 + +0 65005 65004 i 0 65002 65003 + + + +To find all subnets reachable via AS 65002 (AS path begins with 65002): + +Click here to view code image + + +R1# show ip bgp regexp ^65002_ +Network Next Hop Metric LocPrf Weight Path *>i172.16.0.0 192.168.28.1 100 0 65002 65003 i +* i172.24.0.0 65004 + +* i172.30.0.0 + +192.168.28.1 100 + + + +192.168.28.1 100 + +0 65002 65003 + +65005 i +0 65002 65003 65004 i + + + +To find all routes transiting through AS 65005: + + +Click here to view code image + + +R1# show ip bgp regexp _65005_ +Network Next Hop Metric LocPrf Weight Path + +* i172.16.0.0 + +*>i172.24.0.0 * i +65004 + +*>i172.30.0.0 + +172.20.50.1 100 + +172.20.50.1 100 192.168.28.1 100 + + +172.20.50.1 100 + +0 65005 65004 65003 i +0 65005 i +0 65002 65003 + +65005 i +0 65005 65004 + + + +To find subnets that originate from R1’s AS (AS path is blank): + + +Click here to view code image + + +R1# show ip bgp regexp ^$ +Network Next Hop Metric LocPrf Weight Path *>i192.168.3.3/32 0.0.0.0 0 32768 i + + +BGP ROUTE FILTERING USING ACCESS LISTS AND DISTRIBUTE LISTS + +Figure 7-10 shows the commands necessary to configure route filters using access lists and distribute lists. + + + + + + + + + + + + + + + + + + + + +Figure 7-10 BGP Route Filtering Using Access Lists and Distribute Lists + + + +In this scenario, we want to have Houston filter updates to Austin so that it does not include the 192.168.10.0/24 network. + + +Houston(config)# router Starts the BGP routing process bgp 3 + + + +Houston(config-router)# Identifies a peer router at 172.16.1.2 neighbor 172.16.1.2 +remote-as 3 + + + +Houston(config-router)# Identifies a peer router at 172.16.20.1 neighbor 172.16.20.1 +remote-as 1 + + + +Houston(config-router)# Applies a filter of ACL 1 to updates neighbor 172.16.20.1 sent to neighbor 172.16.20.1 +distribute-list 1 out + + + + +Houston(config-router)# +exit + +Returns to global configuration +mode + + + + +Houston(config)# access- Creates the filter to prevent the list 1 deny 192.168.10.0 192.168.10.0/24 network from being 0.0.0.255 part of the routing update + + + +Houston(config)# access- Creates the filter that allows all other list 1 permit any networks to be part of the routing +update + + + + + +Tip +Astandard ACLoffers limited functionality. If you want to advertise the aggregate address of 172.16.0.0/16 but not the individual subnet, a standard ACLwill not work. You need to use an extended ACL. +When you are using extended ACLs with BGP route filters, the extended ACLwill first match the network address and then match the subnet mask of the prefix. To do this, both the network and the netmask are paired with their own wildcard bitmask: +Click here to view code image + + +Router(config)# access-list 101 permit ip 172.16.0.0 0.0.255.255 +255.255.0.0 0.0.0.0 + + +To help overcome the confusing nature of this syntax, Cisco IOS Software introduced the ip prefix-list command in Cisco IOS Release 12.0. + + + +CONFIGURATION EXAMPLE: USING PREFIX LISTS AND AS PATH ACCESS LISTS + +Figure 7-11 shows the network topology for the configuration that follows, which demonstrates how to configure prefix lists and AS path access lists. Assume that all BGP and basic configurations are accurate. There are two objectives here. The first is to allow CE1 +and CE2 to only learn ISP routes with a mask greater than /15 (ge 16) and less than /25 (le 24). The second is to ensure that AS 65 000 does not become a transit AS for ISP1 to reach ISP2 (and vice versa). + + + + + + + + + + + + + + + + + +Figure 7-11 Configuration Example: Using Prefix Lists and AS Path Access Lists + + + +CE1(config)# ip prefix- Creates a prefix list that only permits list ISP1 permit 0.0.0.0 routes with a mask between 16 and 24 ge 16 le 24 + + + +CE1(config)# ip as-path Creates an AS path access list matching access-list 1 permit ^$ routes that originate only from within +AS 65 500 + + + +CE1(config)# router bgp Starts the BGP routing process 65000 + + + +CE1(config-router)# Assigns the ISP1 prefix list to neighbor neighbor 209.165.202.129 209.165.202.129 (ISP1) for all routes prefix-list ISP1 in learned from that neighbor +CE1(config-router)# Assigns the AS path access list to neighbor 209.165.202.129 neighbor 209.165.202.129 (ISP1) for all filter-list 1 out routes sent to that neighbor + + + +CE2(config)# ip prefix- Creates a prefix list that only permits list ISP2 permit 0.0.0.0 routes with a mask between 16 and 24 ge 16 le 24 + + + +CE2(config)# ip as-path Creates an AS path access list matching access-list 1 permit ^$ routes that originate only from within +AS 65 500 + + + +CE2(config)# router bgp Starts the BGP routing process 65000 + + + +CE2(config-router)# Assigns the ISP2 prefix list to neighbor neighbor 209.165.200.225 209.165.200.225 (ISP2) for all routes prefix-list ISP2 in learned from that neighbor + + + +CE2(config-router)# Assigns the AS path access list to neighbor 209.165.200.225 neighbor 209.165.200.225 (ISP2) for all filter-list 1 out routes sent to that neighbor + + + +BGP PEER GROUPS + +To ease the burden of configuring a large number of neighbors with identical or similar parameters (for example, route maps, filter lists, or prefix lists), the concept of peer groups was introduced. The administrator configures the peer group with all the BGP parameters that are to be applied to multiple BGP peers. Actual BGP neighbors are bound to the peer group, and the network +administrator applies the peer group configuration on each of the BGP sessions. + +Figure 7-12 shows the network topology for the configuration that follows, which demonstrates how to configure peer groups. Assume that all BGP, OSPF, and basic configurations are accurate. + + + + + + + + + + + + + + + + + + + + + + + + +Figure 7-12 BGP Peer Groups + + + + +R1(config)# router bgp 65500 Starts the BGP routing process + + + +R1(config-router)# neighbor Creates a BGP peer INTERNAL peer-group group called INTERNAL + + + +R1(config-router)# neighbor Assigns a first parameter INTERNAL remote-as 65500 to the peer group + + + +R1(config-router)# neighbor Assigns a second INTERNAL next-hop-self parameter to the peer +group + + + +R1(config-router)# neighbor Assigns a third INTERNAL update-source loopback 0 parameter to the peer +group + + + +R1(config-router)# neighbor Assigns a fourth INTERNAL route-reflector-client parameter to the peer +group + + + +R1(config-router)# neighbor Assigns the peer group to 192.168.1.2 peer-group INTERNAL neighbor R2 + + + +R1(config-router)# neighbor Assigns the peer group to 192.168.1.3 peer-group INTERNAL neighbor R3 + + + +R1(config-router)# neighbor Assigns the peer group to 192.168.1.4 peer-group INTERNAL neighbor R4 + + + +R1(config-router)# neighbor Assigns the peer group to 192.168.1.5 peer-group INTERNAL neighbor R5 + + +The result here is that all four IBGP neighbors have the same basic BGP configuration assigned to them. + + + +Tip +Apeer group can be, among others, configured to do the following: + + + + +Use the IP address of a specific interface as the source address when opening the TCP session or use the next-hop-self feature +Use, or not use, the EBGP multihop function + +Use, or not use, MD5 authentication on the BGP sessions + +Filter out any incoming or outgoing routes using a prefix list, a filter list, and a route map + + + +Assign a specific weight value to the routes that are received + + + +AUTHENTICATION FOR BGP + +Authentication for routers using BGP relies on the use of predefined passwords and uses MD5. + +Configuring Authentication Between BGP Peers + + +Router(config)# router Enters routing protocol configuration bgp 65100 mode + + + + +Router(config-router) neighbor +209.165.202.130 + +Defines a BGP peer at IP address +209.165.202.130 + +remote-as 65000 + + + + +Router(config-router)# neighbor +209.165.202.130 + +Enables MD5 authentication on a TCP connection with peer at IP address +209.165.202.130. The password is + +password P@55word P@55word + + + + +Router(config-router)# neighbor +2001:db8:0:10::1 + +Enables MD5 authentication on a TCP connection with peer at IPv6 address +2001:db8:0:10::1. The password is + +password P@55word P@55word +Note + + +To avoid losing your peer relationship, the same password must be configured on your remote peer before the hold-down timer expires, which has a default setting of 180 seconds + + + + + + +Verifying BGP Authentication + + + +Router# show ip bgp summary + + + +Router# show ip bgp + +Displays summary of BGP neighbor status + + + +Displays detailed information on TCP + +neighbors and BGP neighbor connections + + + +Router# show bgp ipv6 Displays the status of all IPv6 BGP unicast summary connections + + + +Router# show bgp ipv6 Displays information about IPv6 BGP unicast neighbors connections to neighbors +Part III: Infrastructure Services +Chapter 8 + +IP Services + + + + + +This chapter provides information and commands concerning the following topics: + + +Network Address Translation (NAT) + + +Private IP addresses: RFC 1918 + +Configuring static NAT + +Configuring dynamic NAT + +Configuring Port Address Translation (PAT) + +Configuring a NAT virtual interface + +Verifying NAT and PAT configurations + +Troubleshooting NAT and PAT configurations + +Configuration example: PAT + +Configuration example: NAT virtual interfaces and static NAT + + + +First-hop redundancy protocols + + +Hot Standby Router Protocol (HSRP) + + +Default HSRP configuration settings + +Configuring HSRP + +Verifying HSRP +HSRP optimization options + + +Preempt + +HSRP message timers + +Authentication + +Interface tracking + + + +Multiple HSRP groups + +HSRP IP SLA tracking + +HSRPv2 for IPv6 + +Debugging HSRP + + + +Virtual Router Redundancy Protocol (VRRP) + + +Configuring VRRP + +VRRP optimization options + + +Interface tracking + + + +Verifying VRRP + +Debugging VRRP + + + +IPv4 configuration example: HSRP on L3 switch + + +IP SLA tracking: switch DLS1 VLAN 10 + + + +IPv4 configuration example: VRRP on router and L3 switch with IP SLA tracking +IPv6 configuration example: HSRPv2 on router and L3 switch + + + +Dynamic Host Control Protocol (DHCP) + + +Implementing DHCP for IPv4 + + +Configuring a DHCP server on a Cisco IOS router + +Configuring DHCP manual assignment + +Configuring DHCP replay + +Configuring a DHCP client on a Cisco IOS Software Ethernet interface + +Verifying and troubleshooting DHCP configuration + + + +Implementing DHCP for IPv6 + + +Using SLAAC and configuring a router as a stateless DHCPv6 server + +Configuring a router as a stateful DHCPv6 server + +Configuring a DHCPv6 client + +Configuring a DHCPv6 relay agent + +Verifying and troubleshooting DHCPv6 + + + +Configuration example: DHCP for IPv4 + +Configuration example: DHCP for IPv6 + + + +NETWORK ADDRESS TRANSLATION (NAT) + + +Private IP Addresses: RFC 1918 +Table 8-1 lists the RFC 1918 private address ranges available to use within a private network. These will be your “inside-the-LAN” addresses that will have to be translated into public addresses that can be routed across the Internet. Any network can use these addresses; however, these addresses are not allowed to be routed onto the public Internet. + +TABLE 8-1 RFC 1918 Private Address Ranges + + + + +Internal Address Range + + + +10.0.0.0–10.255.255.255 + + + +172.16.0.0–172.31.255.255 + + + +192.168.0.0–192.168.255.255 + +CIDR Prefix + + + +10.0.0.0/8 + + + +172.16.0.0/12 + + + +192.168.0.0/16 + +Traditional Class + + + +A + + + +B + + + +C + + + + +Configuring Static NAT + +Figure 8-1 shows the network topology for the configuration that follows, which demonstrates how to configure static Network Address Translation (NAT). The objective here is to statically translate the address of the server to a public IP address. + + + + + + + + + +Figure 8-1 Configuring Static NAT + + + + +R1(config)# interface Enters GigabitEthernet 0/0/0 interface +gigabitgethernet 0/0/0 configuration mode + + + +R1(config-if)# ip Assigns a public IP address to the address 209.165.201.2 outside interface 255.255.255.248 + + + + +R1(config-if)# ip nat +outside + +Defines which interface is the outside +interface for NAT + + + + + +R1(config-if)# interface +gigabitethernet 0/0/1 + +Enters GigabitEthernet 0/0/1 interface +configuration mode + + + + +R1(config-if)# ip Assigns a private IP address to the address 192.168.1.1 inside interface +255.255.255.0 + + + + +R1(config-if)# ip nat +inside + +Defines which interface is the inside interface for NAT. You can have multiple NAT inside interfaces on a +router + + + + +R1(config-if)# exit Returns to global configuration mode + + + +R1(config)# ip nat Permanently translates the inside inside source static address of 192.168.1.10 to a public 192.168.1.10 address of 209.165.201.5 209.165.201.5 + +Use the command for each of the private IP addresses you want to statically map to a public address +Configuring Dynamic NAT + +Figure 8-2 shows the network topology for the configuration that follows, which demonstrates how to configure dynamic NAT. The objective here is to dynamically translate the addresses of the PCs to a range of public IP addresses. + + + + + + + + + + + + + + + + +Figure 8-2 Configuring Dynamic NAT + + + + +R1(config)# access- Defines an access list that identifies the list 1 permit private network that will be translated 192.168.1.0 +0.0.0.255 + + + +R1(config)# ip nat Creates a pool of eight public addresses pool R1_POOL named R1_POOL that will be used for + +209.165.201.8 209.165.201.15 netmask +255.255.255.248 + +translation + + + +On certain IOS devices, you can include the add-route keyword at the end of the command to automatically add a static route in the routing table that points to the NAT +virtual interface (NVI) +R1(config)# interface gigabitethernet +0/0/0 + +Enters GigabitEthernet 0/0/0 interface +configuration mode + + + + + +R1(config-if)# ip address +209.165.201.2 + +Assigns a public IP address to the outside +interface + +255.255.255.248 + + + +R1(config-if)# ip Defines which interface is the outside nat outside interface for NAT + + + + +R1(config-if)# interface gigabitethernet +0/0/1 + +Enters GigabitEthernet 0/0/1 interface +configuration mode + + + + +R1(config-if)# ip Assigns a private IP address to the inside address 192.168.1.1 interface +255.255.255.0 + + + +R1(config-if)# ip Defines which interface is the inside interface nat inside for NAT. There can be multiple inside +interfaces + + + +R1(config-if)# exit Returns to global configuration mode + + + +R1(config)# ip nat Enables translation of addresses permitted by inside source list ACL number 1 to the addresses in pool +1 pool R1_POOL R1_POOL +Configuring Port Address Translation (PAT) + +Figure 8-3 shows the network topology for the configuration that follows, which demonstrates how to configure NAT overload or Port Address Translation (PAT). The objective here is to translate the PC’s addresses to the address of the router’s public interface. + + + + + + + + + + + + + + + + +Figure 8-3 Configuring Port Address Translation (PAT) + + + + + +R1(config)# access-list 1 permit 192.168.1.0 +0.0.0.255 + +Defines an access list that identifies the private +network that will be translated + + + + + +R1(config)# interface +gigabitethern + +Enters GigabitEthernet 0/0/0 interface configuration +mode + +et 0/0/0 + + + +R1(config- Assigns a public IP address to the outside interface if)# ip +address 209.165.201.2 +255.255.255.2 48 + + + +R1(config- Defines which interface is the outside interface for if)# ip nat NAT +outside + + + + +R1(config-if)# interface +gigabitethern + +Enters GigabitEthernet 0/0/1 interface configuration +mode + +et 0/0/1 + + + +R1(config- Assigns a private IP address to the inside interface if)# ip +address 192.168.1.1 255.255.255.0 + + + +R1(config- Defines which interface is the inside interface for if)# ip nat NAT. There can be multiple inside interfaces inside + + + +R1(config- Returns to global configuration mode if)# exit + + + +R1(config)# Enables translation of addresses permitted by ACL ip nat inside number 1 and uses the interface GigabitEthernet source list 1 0/0/0 IP address for the NAT process. The keyword + +interface +gigabitethern + + +overload allows multiple inside devices to share a +single public IP address while keeping track of port + +et 0/0/0 numbers to ensure sessions remain unique +overload + + + + +Note +It is possible to overload a dynamic pool instead of an interface. This allows the inside private devices to share multiple public IP address instead of onlyone. Use the command ip nat inside source list acl pool pool overload to achieve this. Also, instead of a pool of multiple addresses, the pool used for overloading could be a pool of onlyone public address. For example, the command ip nat pool MyPool 203.0.113.1 203.0.113.1 netmask 255.255.255.0 creates a pool of one public address that can be overloaded. + + + +Configuring a NAT Virtual Interface + +A NAT virtual interface, or NVI, removes the requirements to configure an interface as either inside or outside. Also, because NVI performs routing, translation, and routing again, it is possible to route packets from inside to inside interfaces successfully. + + +R1(config- Allows the interface to participate in NVI translation if)# ip nat processing +enable + + + +R1# show ip Displays the list of active NVI translations nat nvi +translations + + +Note + + +LegacyNAT terminologydoes not applybecause there are no “inside” or “outside” interfaces. Instead, NVI uses the source global, source local, destination global, and destination local terminology + + + + + + +R1# show ip +nat nvi + +Displays the interfaces participating in NVI translation +processing, as well as Hit and Miss counters + +statistics +Note +NAT virtual interfaces are not supported in the Cisco IOS XE software. + + + +Verifying NAT and PAT Configurations + + +Router# show access-list Displays access lists + + + + +Router# show ip nat + + + + + +Router# show ip nat + + +translations + + + + + +statistics + +Displays the translation table + + + +Displays NAT statistics + + + + +Router# clear ip nat translation Clears a specific +inside 1.1.1.1 2.2.2.2 outside translation from the table 3.3.3.3 4.4.4.4 before it times out: + + + +1.1.1.1 = Global IP address + + + +2.2.2.2 = Local IP address + + + +3.3.3.3 = Local IP address + + + +4.4.4.4 = Global IP address + + + +Router# clear ip nat translation * Clears the entire translation table before entries time out +Note +The default timeout for a translation entryin a NAT table is 24 hours. + + + +Troubleshooting NAT and PAT Configurations + + +Router# Displays information about every packet that is debug ip nat translated + + + +CAUTION: Using this command can potentially generate a tremendous amount of output and overwhelm the router + + + +Router# Displays greater detail about packets being translated debug ip nat +detailed + + + +Configuration Example: PAT + +Figure 8-4 shows the network topology for the PAT configuration that follows using the commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + +Figure 8-4 Port Address Translation Configuration +ISP Router + + + +Router> + + + +Router# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Router(config)# Sets the host name hostname ISP + + + +ISP(config)# no ip Turns off Domain Name System (DNS) domain-lookup resolution to avoid wait time due to DNS +lookup of spelling errors + + + +ISP(config)# enable Sets the encrypted password to cisco secret cisco + + + +ISP(config)# line Moves to line console mode console 0 + + + +ISP(config-line)# Sets the console line password to class password cisco + + + + +ISP(config-line)# login + + + +ISP(config-line)# + +Requires user to log in to be able to access the console port + + + +Displays unsolicited messages and debug + +logging synchronous output on a separate line than user input. + + + +ISP(config-line)# exit Returns to global configuration mode +ISP(config)# interface Moves to interface configuration mode serial 0/0/1 + + + +ISP(config-if)# ip Assigns an IP address and netmask address 198.133.219.2 +255.255.255.252 + + + +ISP(config-if)# clock Assigns the clock rate to the DCE cable on rate 4000000 this side of the link + + + +ISP(config-if)# no Enables the interface shutdown + + + +ISP(config-if)# Creates loopback interface 0 and moves to interface loopback 0 interface configuration mode + + + +ISP(config-if)# ip Assigns an IP address and netmask address 192.31.7.1 +255.255.255.255 + + + +ISP(config-if)# exit Returns to global configuration mode + + + +ISP(config)# exit Returns to privileged EXEC mode + + + +ISP# copy running- Saves the configuration to NVRAM config startup-config + + + +Company Router + + +Router> enable Moves to privileged EXEC mode +Router# configure Moves to global configuration mode terminal + + + +Router(config)# hostname Sets the host name Company + + + + +Company(config)# no ip +domain-lookup + +Turns off DNS resolution to avoid wait time due to DNS lookup of spelling +errors + + + + +Company(config)# enable Sets the secret password to cisco secret cisco + + + +Company(config)# line Moves to line console mode console 0 + + + +Company(config-line)# Sets the console line password to class password class + + + + +Company(config-line)# login + + + +Company(config-line)# + +Requires user to log in to be able to access the console port + + + +Causes commands to be appended to a + +logging synchronous new line + + + + +Company(config-line)# exit + + + +Company(config)# +interface + +Returns to global configuration mode + + + + + +Moves to interface configuration mode +gigabitethernet 0/0 + + + +Company(config-if)# ip Assigns an IP address and netmask address 172.16.10.1 +255.255.255.0 + + + +Company(config-if)# no Enables the interface shutdown + + + +Company(config-if)# Moves to interface configuration mode interface serial 0/0/0 + + + +Company(config-if)# ip Assigns an IP address and netmask address 198.133.219.1 +255.255.255.252 + + + + +Company(config-if)# no shutdown + + + +Company(config-if)# exit + +Enables the interface + + + + + +Returns to global configuration mode + + + + +Company(config)# ip Sends all packets not defined in the route 0.0.0.0 0.0.0.0 routing table to the ISP router 198.133.219.2 + + + +Company(config)# access- Defines which addresses are permitted list 1 permit through; these addresses are those 172.16.10.0 0.0.0.255 that will be allowed to be translated +with NAT + + + +Company(config)# ip nat Creates NAT by combining list 1 with +inside source list 1 the interface Serial 0/0/0. Overloading interface serial 0/0/0 will take place +overload + + + + +Company(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Company(config-if)# ip Specifies location of private inside nat inside addresses + + + +Company(config-if)# Moves to interface configuration mode interface serial 0/0/0 + + + +Company(config-if)# ip Specifies location of public outside nat outside addresses + + + +Company(config-if)# end Returns to privileged EXEC mode + + + +Company# copy running- Saves the configuration to NVRAM config startup-config + + + +Configuration Example: NAT Virtual Interfaces and Static NAT + +Figure 8-5 shows the network topology for the configuration that follows, which demonstrates how to configure NAT virtual interfaces with dynamic NAT and static NAT, using the commands covered in this chapter. Assume that all basic configurations are accurate. Recall that this configuration example will not work on a Cisco IOS XE router. + + + + + + + + + + + + + + + + + + +Figure 8-5 Configuration Example: NAT Virtual Interfaces and Static NAT + + + +R1(config)# access-list 1 Defines an access list that permit 192.168.1.0 0.0.0.255 identifies the private network +that will be translated + + + +R1(config)# ip nat pool Creates a pool of eight public R1_POOL 209.165.201.8 addresses named R1_POOL that 209.165.201.15 netmask will be used for translation 255.255.255.248 + + + +R1(config)# ip nat source Enables translation of addresses list 1 pool R1_POOL permitted by ACL number 1 to +the addresses in pool R1_POOL + + + +R1(config)# ip nat source Permanently translates the static 172.16.1.100 inside address of 172.16.1.100 to 209.165.201.5 a public address of 209.165.201.5 +R1(config)# interface Enters FastEthernet 0/0 fastethernet 0/0 interface configuration mode + + + +R1(config-if)# ip nat enable Enables NVI processing on the interface + + + +R1(config-if)# interface Enters FastEthernet 0/1 fastethernet 0/1 interface configuration mode + + + +R1(config-if)# ip nat enable Enables NVI processing on the interface + + + +R1(config-if)# interface Enters FastEthernet 1/0 fastethernet 1/0 interface configuration mode + + + +R1(config-if)# ip nat enable Enables NVI processing on the interface + + + +FIRST-HOP REDUNDANCY PROTOCOLS + +A first-hop redundancy protocol (FHRP) is a networking protocol that is designed to protect the default gateway by allowing two or more routers or Layer 3 switches to provide backup for that address. If one first-hop device fails, the backup router will take over the address, by default, within a few seconds. FHRPs are equally at home on routers as Layer 3 (L3) switches. Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP) are implemented for both IPv4 and IPv6 environments. Platform IOS matrices should be consulted for next-hop redundancy protocol support. +Hot Standby Router Protocol + +HSRP provides network redundancy for IP networks, ensuring that user traffic immediately and transparently recovers from first-hop failures in network-edge devices or access circuits. + +When configuring HSRP on a switch platform, the specified interface must be a Layer 3 interface and Layer 3 functions must be enabled: + + +Routed port: A physical port configured as a Layer 3 port by entering the no switchport interface configuration command + + + +SVI: A VLAN interface created by using the interface vlan vlan_id global configuration command and by default a Layer 3 interface + +EtherChannel port channel in Layer 3 mode: A port-channel logical interface created by using the interface port-channel port-channel-number global configuration command and binding the Ethernet interface into the channel group + + +Default HSRP Configuration Settings + + +Feature + + +HSRP +version + +Default Setting + + +Version 1 + + + + + +Note + + +HSRPv1 and HSRPv2 have different packet structures. The same HSRP version must be configured on all devices of an HSRP group + + + + + +HSRP None configured +groups + + + + + +Standby group number + + + +Standby MAC address + + + +Standby priority + + + +Standby delay + + + +Standby track interface priority + + + +Standby hello time + + + +Standby +holdtime + +0 + + + + + + + +System assigned as 0000.0c07.acXX, where XX is the HSRP group number. For HSRPv2, the MAC address will be 0000.0c9f.fXXX + + + +100 + + + + + +0 (no delay) + + + + + +10 + + + + + + + + + +3 seconds + + + + + +10 seconds + + + + +Configuring Basic HSRP + + +Switch(config)# Moves to interface configuration mode on the +interface vlan10 switch virtual interface (SVI) + + + +Switch(config- Assigns IP address and netmask if)# ip address +172.16.0.10 255.255.255.0 + + + +Switch(config- Activates HSRP group 1 on the interface and if)# standby 1 creates a virtual IP address of 172.16.0.1 for use in ip 172.16.0.1 HSRP + + + + + +Note + + +The group number can be from 0 to 255. The default is 0 + + + + + + +Switch(config- Assigns a priority value of 120 to standby group 1 if)# standby 1 +priority 120 + + +Note + + +The priorityvalue can be from 1 to 255. The default is 100. Ahigher prioritywill result in that switch being elected the active switch. If the priorities of all switches in the group are equal, the switch with the highest IPaddress becomes the active switch + + + + + + + + +Note +HSRP configuration commands for a router are the same as HSRP configuration commands on a Layer 3 switch platform. + + + +Verifying HSRP +Switch# show standby + + + + +Switch# show standby brief + + + +Switch# show + +Displays HSRP information + + + + + + +Displays a single-line output summary of each standby group + + + +Displays HSRP information on the VLAN 1 + +standby vlan 1 group + + + +HSRP Optimization Options + +Options are available that make it possible to optimize HSRP operation in the campus network. The next sections explain four of these options: standby preempt, message timers, authentication, and interface tracking. + +Preempt + + +Switch(config)# Moves to interface configuration mode interface vlan10 + + + +Switch(config- Configures this switch to preempt, or take control if)# standby 1 of, the active switch if the local priority is higher + +preempt + + + +Switch(config- + +than the priority of the active switch + + + +Causes the local switch to postpone taking over as + +if)# standby 1 the active switch for 180 seconds since the HSRP + +preempt delay +minimum 180 + +process on that switch was last restarted or 140 +seconds since the switch was last reloaded + +reload 140 +Switch(config- Disables the preemption delay, but preemption if)# no standby itself is still enabled. Use the no standby x +1 preempt delay preempt command to eliminate preemption + + + + + +Note + + +If the preempt argument is not configured, the local switch assumes control as the active switch onlyif the local switch receives information indicating that there is no switch currentlyin the active state + + + + + + + +HSRP Message Timers + + +Switch(config)# Moves to interface configuration mode interface vlan10 + + + +Switch(config-if)# Sets the hello timer to 5 seconds and sets standby 1 timers 5 15 the hold timer to 15 seconds + + + + + +Note + + +The hold timer is normallyset to be greater than or equal to three times the hello timer + + + + + + + + +Note + + +The hello timer can be from 1 to 254; the default is 3. The hold timer can be from 1 to 255; the default is 10. The default unit of time is seconds +Switch(config-if)# Sets the hello timer to 200 milliseconds standby 1 timers msec and sets the hold timer to 600 +200 msec 600 milliseconds + + + + + +Note + + +If the msec argument is used, the timers can be an integer from 15 to 999 + + + + + + +Authentication + + +Switch(config)# key Creates an authentication key chain called chain MyHSRPChain MyHSRPChain + + + +Switch(config- Adds a first key to the key chain keychain)# key 1 + + + +Switch(config- Configures a key string of australia keychain-key)# key- +string australia + + + +Switch(config- Moves to interface configuration mode keychain-key)# +interface vlan10 + + + +Switch(config-if)# Configures canada as the plain-text standby 1 authentication string used by group 1 authentication text +canada +Switch(config-if)# Configures england as the MD5 standby 2 authentication key string used by group 2 authentication md5 +key-string england + + + + +Switch(config-if)# Configures MD5 authentication using key standby 3 chain MyHSRPChain. HSRP queries the authentication md5 key chain to obtain the current live key key-chain MyHSRPChain and key ID + + + +Interface Tracking + + + +Switch(conf ig)# interface vlan10 + + + +Switch(conf +ig-if)# + +Moves to interface configuration mode + + + + + + + + + +Causes HSRP to track the availability of interface +GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 goes + + + +standby 1 +track + + +down, the priority of the switch in group 1 will be +decremented by 25 + +gigabitethe rnet 1/0/1 +25 +Note + + +The default value of the track argument is 10 + + + + + + + + +Tip +The track argument does not assign a new priorityif the tracked interface goes down. The track argument assigns a value that the prioritywill be decreased if the tracked interface goes down. Therefore, if you are tracking GigabitEthernet 1/0/1 with a track value of 25 (standby1 track gigabitethernet 1/0/1 25) and GigabitEthernet 1/0/1 goes down, the prioritywill be decreased by25; assuming a default priorityof 100, the new prioritywill now be 75 + + + + + + +Multiple HSRP Groups + +Figure 8-6 shows the network topology for the configuration that follows, which demonstrates how to configure multiple HSRP groups using the commands covered in this chapter. Note that only the commands specific to HSRP and STP are shown in this example. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-6 Network Topology for Multigroup HSRP Configuration Example +Multigroup HSRP enables switches to simultaneously provide redundant backup and perform load sharing across different IP subnets. The objective here is to configure DLS1 as STP root and HSRP active for VLAN 10, while DLS2 is configured as STP root and HSRP active for VLAN 20. DLS1 is also configured as backup root and HSRP standby for VLAN 20, while DLS2 is configured as backup root and HSRP standby for VLAN 10. Only the configuration for DLS1 is shown here. DLS2 would be configured in the opposite way. Host H1 is in VLAN 10 and host H2 is in VLAN 20. + + +DLS1(conf Configures spanning-tree root primary for VLAN 10 ig)# +spanning-tree vlan 10 root primary + + + +DLS1(conf ig)# spanning-tree vlan 20 root secondary + + + + + + + + + + +DLS1(conf ig)# +interface + +Configures spanning-tree root secondary for VLAN 20 + + + + + +Note + + +Load balancing can be accomplished byhaving one switch be the active HSRP L3 switch forwarding for half of the VLANs and the standbyL3 switch for the remaining VLANs. The second HSRP L3 switch would be reversed in its active and standby VLANs. Care must be taken to ensure that spanning tree is forwarding to the active L3 switch for the correct VLANs bymaking that L3 switch the spanning-tree primary root for those VLANs + + + + + +Moves to interface configuration mode +vlan 10 + + + + +DLS1(conf ig-if)# ip address 10.1.10.2 255.255.2 55.0 + + + +DLS1(conf ig-if)# +standby + +Assigns IP address and netmask + + + + + + + + + + + + + + +Activates HSRP group 10 on the interface and creates a +virtual IP address of 10.1.10.1 for use in HSRP + +10 ip 10.1.10.1 + + + + +DLS1(conf ig-if)# standby 10 priority 110 + + + +DLS1(conf ig-if)# standby 10 preempt + + + +DLS1(conf ig-if)# +interface + +Assigns a priority value of 110 to standby group 10. This will be the active forwarded for VLAN 10 + + + + + + + + + + +Configures this switch to preempt, or take control of, VLAN 10 forwarding if the local priority is higher than the active switch VLAN 10 priority + + + + + + +Moves to interface configuration mode +vlan20 + + + + +DLS1(conf ig-if)# ip address 10.1.20.2 255.255.2 55.0 + + + +DLS1(conf ig-if)# +standby + +Assigns IP address and netmask + + + + + + + + + + + + + + +Activates HSRP group 20 on the interface and creates a +virtual IP address of 10.1.20.1 for use in HSRP + +20 ip 10.1.20.1 + + + + +DLS1(conf ig-if)# standby 20 priority 90 + + + +DLS1(conf ig-if)# standby 20 +preempt + +Assigns a priority value of 90 to standby group 20. This switch will be the standby device for VLAN 20 + + + + + + + + + + +Configures this switch to preempt, or take control of, VLAN 20 forwarding if the local priority is higher than the +active switch VLAN 20 priority + + + + +HSRP IP SLA Tracking + +See Chapter 6, “Redistribution and Path Control,” for a more +detailed explanation of IP service level agreement (SLA) objects. The objective here is to associate an IP SLA to the HSRP process, allowing failover to occur by decrementing the HSRP priority if the object fails. + + +Switch(config)# ip Creates SLA process 10 sla 10 + + + +Switch(config-ip- Configures the SLA as an ICMP echo sla)# icmp-echo operation to destination 172.19.10.1 + + + +172.19.10.1 + + + +Switch(config-ip- Exits SLA configuration mode sla)# exit + + + +Switch(config)# ip Configures the scheduling for SLA 10 to sla schedule 10 start now and continue forever +start-time now life forever + + + +Switch(config)# track Creates an object, 90, to track the state of 90 ip sla 10 state SLA process 10 + + + +Switch(config-track)# Moves to interface configuration mode interface vlan 10 + + + +Switch(config-if)# ip Assigns IP address and netmask address 192.168.10.1 +255.255.255.0 +Switch(config-if)# Activates HSRP group 10 on the interface standby 10 ip and creates a virtual IP address of + +192.168.10.254 + + + +Switch(config-if)# + + +192.168.10.254 for use in HSRP + + + +Assigns a priority value of 110 to standby + +standby 10 priority group 10 110 + + + +Switch(config-if)# Configures this switch to preempt, or take standby 10 preempt control of, the active switch if the local +priority is higher than the active switch + + + +Switch(config-if)# Tracks the state of object 90 and +standby 10 track 90 decrements the device priority if the object decrement 20 fails + + + +HSRPv2 for IPv6 + +HSRP Version 2 must be enabled on an interface before HSRP for IPv6 can be configured. + + +Switch(co Enables HSRPv2 on an interface nfig-if)# +standby version 2 + + + +Switch(co +nfig-if)# + +Enables HSRP for IPv6 using a virtual link-local address +that will be generated automatically from the link-local + + + +standby 1 +ipv6 + + +prefix and a modified EUI-64 format interface identifier, +where the EUI-64 interface identifier is created from the + +autoconfi relevant HSRP virtual MAC address g +Switch(co +nfig-if)# + +Enables HSRP for IPv6 using an explicitly configured link- +local address to be used as the virtual IPv6 address for + +standby 1 group 1 ipv6 +fe80::1:1 + + + + + +Switch(co +nfig-if)# + +Enables HSRP for IPv6 using a global IPv6 address as the +virtual address for group 1 + +standby 1 ipv6 2001::db8 :2/64 + + + + + +Note +All other relevant HSRP commands (preempt, priority, authentication, tracking, and so on) are identical in HSRPv1 and HSRPv2. + + + + +Note +When configuring the IPv6 virtual address, if an IPv6 global address is used, it must include an IPv6 prefix length. If a link-local address is used, it does not have a prefix. + + + +Debugging HSRP + + + +Switch# debug standby + + + + +Switch# debug +standby errors + +Displays all HSRP debugging information, including state changes and transmission/reception of HSRP packets + + + +Displays HSRP error messages +Switch# standby + + + +Switch# standby terse + + + + +Switch# standby track + + + +Switch# standby + + + +Switch# +standby + + +debug events + + + +debug events + + + + + + +debug events + + + + +debug packets + + + +debug +terse + +Displays HSRP event messages + + + + + +Displays all HSRP events except for hellos and advertisements + + + + + + +Displays all HSRP tracking events + + + + + + + +Displays HSRP packet messages + + + + + +Displays all HSRP errors, events, and packets, +except for hellos and advertisements + + + + +Virtual Router Redundancy Protocol + + + +Note +HSRP is Cisco proprietary. Virtual Router RedundancyProtocol (VRRP) is an IEEE standard. + + + + + +Note +VRRP might not be completelysupported on platforms such as the Catalyst 3750-E, 3750, 3560, or 3550. For example, the Catalyst 3560 supports VRRP for IPv4, but not for IPv6. The IPv4 implementation supports text authentication, but not message digest 5 (MD5) authentication key-chain implementation. Also, the Switch Database Management (SDM) should prefer the routing option for IPv4 or the dual-ipv4-and-ipv6 option for dual-stack or IPv6 implementations. OnlyVRRP Version 3 (VRRPv3) is supported on the Catalyst 3650 and Catalyst 9200/9300 platforms. VerifyVRRP capabilities byplatform datasheets and appropriate Cisco IOS command and configuration guides. + + + + +Note +The VRRPv3 Protocol Support feature provides the capabilityto support IPv4 and IPv6 address families, while +VRRPv2 onlysupports IPv4 addresses. To enable VRRPv3, use the fhrp version vrrp v3 command in global configuration mode. When VRRPv3 is in use, VRRPv2 is disabled bydefault. + + + +VRRP is an election protocol that dynamically assigns responsibility for one or more virtual switches to the VRRP switches on a LAN, allowing several switches on a multiaccess link to use the same virtual IP address. A VRRP switch is configured to run VRRP in conjunction with one or more other switches attached. + +Configuring VRRPv2 + + +Switch(config)# Moves to interface configuration mode interface vlan10 + + + +Switch(config-if)# Assigns IP address and netmask ip address +172.16.100.5 255.255.255.0 + + + +Switch(config-if)# Enables VRRP for group 10 on this interface vrrp 10 ip with a virtual IP address of 172.16.100.1. The 172.16.100.1 group number can be from 1 to 255 + + + + + +Note + + +VRRP supports using the real interface IP address as the virtual IP address for the group. If this is done, the router with that address becomes the master + + + + + +Switch(config-if)# Assigns a text description to the group vrrp 10 description +Engineering Group +Switch(config-if)# Sets the priority level for this VLAN. The vrrp 10 priority range is from 1 to 254. The default is 100 110 + + + +Switch(config-if)# Configures this switch to preempt, or take vrrp 10 preempt over, as the virtual switch master for group 10 +if it has a higher priority than the current virtual switch master + + + + + +Note + + +The switch that is the IP address owner will preempt, regardless of the setting of this command + + + + + + + + +Note + + +The preempt VRRP option is enabled bydefault + + + + + + +Switch(config-if)# Configures this switch to preempt, but only vrrp 10 preempt after a delay of 60 seconds +delay minimum 60 + + + + +Note + + +The default delayperiod is 0 seconds +Switch(config-if)# Configures the interval between successful vrrp 10 timers advertisements by the virtual switch master advertise 15 + + + +Note + + +The default interval value is 1 second + + + + + + + + +Note + + +All switches in a VRRP group must use the same timer values. If switches have different timer values set, the VRRP group will not communicate with each other + + + + + + + + +Note + + +The range of the advertisement timer is 1 to 255 seconds. If you use the msec argument, you change the timer to measure in milliseconds. The range in milliseconds is 50 to 999 + + + + + + + +Switch(config-if)# Configures the switch, when acting as a vrrp 10 timers virtual switch backup, to learn the + +learn + + + + + +Switch(config-if)# + + +advertisement interval used by the virtual switch master + + + +Disables VRRP on the interface, but + +vrrp 10 shutdown configuration is still retained +Switch(config-if)# Reenables the VRRP group using the previous no vrrp 10 shutdown configuration + + +Switch(config-if) Configures plain-text authentication for group vrrp 10 10 using the key ottawa +authentication text ottawa + + + +Switch(config-if)# Configures MD5 authentication for group 10 vrrp 10 using the key winnipeg +authentication md5 key-string winnipeg + + + +Configuring VRRPv3 + + +Switch(config)# Enables the ability to configure VRRPv3 fhrp version +vrrp v3 + + + +Switch(config)# Moves to interface configuration mode interface vlan +10 + + + +Switch(config- Creates a VRRP group number 10 and enters if)# vrrp 10 VRRP configuration mode for IPV4 address-family +ipv4 + + + +Switch(config- Specifies an IPv4 address for the VRRP group if-vrrp)# +address 10.0.1.10 +Switch(config- +if-vrrp)# + +Specifies the priority value of the VRRP group. +The priority of a VRRP group is 100 by default + +priority 150 + + + + +Switch(config- +if-vrrp)# + +Enables preemption of lower priority master +device with a 30 second delay + +preempt delay +minimum 30 Preemption is enabled by default + + + +Switch(config- Sets the advertisement timer to 5000 + +if-vrrp)# timers +advertise 5000 + +milliseconds. The advertisement timer is set to +1000 milliseconds by default + + + + +Switch(config- Enables support for VRRPv2 simultaneously, so if-vrrp)# vrrpv2 as to interoperate with devices that only support +VRRP v2. VRRPv2 is disabled by default + + + +VRRP Optimization Options + +Interface Tracking +VRRP does not have a native interface tracking mechanism. Instead, it has the ability to track objects. This allows the VRRP master to lose its status if a tracked object (interface, IP SLA, and so on) fails. + + +Switch(config)# track Creates a tracked object, where the +10 interface status of the uplink interface is tracked gigabitethernet 1/0/1 +line-protocol +Switch(config-track)# Moves to interface configuration mode interface vlan 10 + + + +Switch(config-if)# Configures VRRP to track the previously vrrp 1 track 10 created object and decrease the VRRP decrement 30 priority by 30 should the uplink interface +fail + + + +Verifying VRRP + + + +Note +The VRRP verification commands are the same for IPv6 and IPv4. + + + + +Switch# show vrrp Displays VRRP information + + + + +Switch# show vrrp brief + + + + + +Switch# show vrrp 10 + +Displays a brief status of all VRRP groups + + + +Displays detailed information about +VRRP group 10 + + + + +Switch# show vrrp Displays information about VRRPv2 as interface vlan10 enabled on interface VLAN 10 + + + +Switch# show vrrp Displays a brief summary about VRRPv2 interface vlan10 brief on interface VLAN 10 + + + +Switch# show vrrp ipv4 Displays information about VRRPv3 as vlan 10 enabled on interface VLAN 10 +Switch# show vrrp brief Displays a brief summary about VRRPv3 vlan 10 on interface VLAN 10 + + + +Debugging VRRP + + + +Switch# debug vrrp all + + + +Switch# debug vrrp error + + + +Switch# debug vrrp events + + + +Switch# debug vrrp packet + + + +Switch# debug vrrp +state + +Displays all VRRP messages + + + + + +Displays all VRRP error messages + + + + + +Displays all VRRP event messages + + + + + +Displays messages about packets sent and received + + + +Displays messages about state transitions + + + + +IPv4 Configuration Example: HSRP on L3 Switch + +Figure 8-7 shows the network topology for the configuration that follows, which demonstrates how to configure HSRP using the commands covered in this chapter. Note that only the commands specific to HSRP are shown in this example. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-7 Network Topology for HSRP Configuration Example + + + +The network devices are configured as follows: + + +DLS1 and DLS2 are configured as Layer 3 devices; ALS1 and ALS2 are configured as Layer 2 devices. + +Border1, Border2, DLS1, and DLS2 run Enhanced Interior Gateway Routing Protocol (EIGRP). Border1 and Border2 also provide default routing into the cloud. + +The links from DLS1 and DLS2 to Border1 and Border2 are routed links using the no switchport command on DLS1 and DLS2. +Four VLANs are configured on DLS1. DLS1 is the VTP server for DLS2, ALS1, and ALS2. + +A Layer 2 EtherChannel trunk connects DLS1 and DLS2. + +All connections towards the access layer are 802.1Q trunks. + +DLS1 is the spanning-tree primary root for VLANs 1 and 10 and DLS1 is the secondary root for VLANs 20 and 30. + +DLS2 is the spanning-tree primary root for VLANs 20 and 30 and DLS1 is the secondary root for VLANs 1 and 10. + +DLS1 is to be HSRP active for VLANs 1 and 10, and HSRP standby for VLANs 20 and 30. + +DLS2 is to be HSRP active for VLANs 20 and 30, and HSRP standby for VLANs 1 and 10. + +Interface tracking is configured to allow for HSRP failover to occur if an uplink fails. + + +Switch DLS1 + + +DLS1(config)# Moves to interface configuration mode + + + +interface vlan 1 + + + +DLS1(config- Activates HSRP group 1 on the interface and creates + +if)# standby 1 +ip + +a virtual IP address of 192.168.1.254 for use in +HSRP + +192.168.1.254 + + + +DLS1(config- Assigns a priority value of 105 to standby group 1 if)# standby 1 +priority 105 +DLS1(config- Configures this switch to preempt, or take control if)# standby 1 of, VLAN 1 forwarding if the local priority is higher + +preempt + + + +DLS1(config- + +than the active switch VLAN 1 priority + + + +HSRP will track the availability of interface + +if)# standby 1 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 + +track +gigabitethernet + +goes down, the priority of the switch in group 1 will +be decremented by 20 + +1/0/1 20 + + + +DLS1(config- HSRP will track the availability of interface if)# standby 1 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + +DLS1(config- + +goes down, the priority of the switch in group 1 will be decremented by the default value of 10 + + + + +Moves to global configuration mode + +if)# exit + + + +DLS1(config)# Moves to interface configuration mode interface vlan +10 + + + +DLS1(config- Activates HSRP group 10 on the interface and + +if)# standby 10 +ip + +creates a virtual IP address of 192.168.10.254 for +use in HSRP + +192.168.10.254 + + + +DLS1(config- Assigns a priority value of 105 to standby group 10 if)# standby 10 +priority 105 + + + +DLS1(config- Configures this switch to preempt, or take control if)# standby 10 of, VLAN 10 forwarding if the local priority is + +preempt + + + +DLS1(config- + +higher than the active switch VLAN 10 priority + + + +HSRP will track the availability of interface + +if)# standby 10 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 + +track +gigabitethernet + +goes down, the priority of the switch in group 10 +will be decremented by 20 + +1/0/1 20 + + + +DLS1(config- HSRP will track the availability of interface if)# standby 10 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + +DLS1(config- + +goes down, the priority of the switch in group 10 will be decremented by the default value of 10 + + + + +Moves to global configuration mode + +if)# exit + + + + +DLS1(config)# interface vlan20 + + + +DLS1(config- + +Moves to interface configuration mode + + + + + + + +Activates HSRP group 20 on the interface and + + + +if)# standby 20 +ip + +creates a virtual IP address of 192.168.20.254 for +use in HSRP + +192.168.20.254 + + + +DLS1(config- Assigns a priority value of 100 to standby group 20 +if)# standby 20 priority 100 + + + +DLS1(config- HSRP will track the availability of interface if)# standby 20 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 + +track +gigabitethernet + +goes down, the priority of the switch in group 20 +will be decremented by 20 + +1/0/1 20 + + + +DLS1(config- HSRP will track the availability of interface if)# standby 20 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + +DLS1(config- + +goes down, the priority of the switch in group 20 will be decremented by the default value of 10 + + + + +Moves to global configuration mode + +if)# exit + + + + +DLS1(config)# interface vlan30 + + + +DLS1(config- + +Moves to interface configuration mode + + + + + + + +Activates HSRP group 30 on the interface and + + + +if)# standby 30 +ip + +creates a virtual IP address of 192.168.30.254 for +use in HSRP + +192.168.30.254 + + + +DLS1(config- Assigns a priority value of 100 to standby group 30 if)# standby 30 +priority 100 +DLS1(config- HSRP will track the availability of interface if)# standby 30 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 + +track +gigabitethernet + +goes down, the priority of the switch in group 30 +will be decremented by 20 + +1/0/1 20 + + + +DLS1(config- HSRP will track the availability of interface if)# standby 30 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + +DLS1(config- + +goes down, the priority of the switch in group 30 will be decremented by the default value of 10 + + + + +Moves to global configuration mode + +if)# exit + + + +Switch DLS2 + + +DLS2(config)# Moves to interface configuration mode interface vlan1 + + + +DLS2(config- Activates HSRP group 1 on the interface and creates + +if)# standby 1 +ip + +a virtual IP address of 192.168.1.254 for use in +HSRP + +192.168.1.254 + + + +DLS2(config- Assigns a priority value of 100 to standby group 1 if)# standby 1 +priority 100 + + + +DLS2(config- HSRP will track the availability of interface if)# standby 1 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 +track +gigabitethernet + + +goes down, the priority of the switch in group 1 will +be decremented by 20 + +1/0/1 20 + + + +DLS2(config- HSRP will track the availability of interface if)# standby 1 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + +DLS2(config- + +goes down, the priority of the switch in group 1 will be decremented by the default value of 10 + + + + +Moves to global configuration mode + +if)# exit + + + + +DLS2(config)# interface vlan10 + + + +DLS2(config- + +Moves to interface configuration mode + + + + + + + +Activates HSRP group 10 on the interface and + + + +if)# standby 10 +ip + +creates a virtual IP address of 192.168.10.254 for +use in HSRP + +192.168.10.254 + + + +DLS2(config- Assigns a priority value of 100 to standby group 10 if)# standby 10 +priority 100 + + + +DLS2(config- HSRP will track the availability of interface if)# standby 10 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 + +track +gigabitethernet + +goes down, the priority of the switch in group 10 +will be decremented by 20 + +1/0/1 20 +DLS2(config- HSRP will track the availability of interface if)# standby 10 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + + +DLS2(config- + +goes down, the priority of the switch in group 10 will be decremented by the default value of 10 + + + + + + +Moves to global configuration mode + +if)# exit + + + + +DLS2(config)# interface vlan20 + + + +DLS2(config- + +Moves to interface configuration mode + + + + + + + +Activates HSRP group 20 on the interface and + + + +if)# standby 20 +ip + +creates a virtual IP address of 192.168.20.254 for +use in HSRP + +192.168.20.254 + + + +DLS2(config- Assigns a priority value of 105 to standby group 20 if)# standby 20 +priority 105 + + + +DLS2(config- Configures this switch to preempt, or take control if)# standby 20 of, VLAN 20 forwarding if the local priority is + +preempt + + + +DLS2(config- + +higher than the active switch VLAN 20 priority + + + +HSRP will track the availability of interface + +if)# standby 20 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 + +track +gigabitethernet + +goes down, the priority of the switch in group 20 +will be decremented by 20 + +1/0/1 20 +DLS2(config- HSRP will track the availability of interface if)# standby 20 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + + +DLS2(config- + +goes down, the priority of the switch in group 20 will be decremented by the default value of 10 + + + + + + +Moves to global configuration mode + +if)# exit + + + + +DLS2(config)# interface vlan30 + + + +DLS2(config- + +Moves to interface configuration mode + + + + + + + +Activates HSRP group 30 on the interface and + + + +if)# standby 30 +ip + +creates a virtual IP address of 192.168.30.254 for +use in HSRP + +192.168.30.254 + + + +DLS2(config- Assigns a priority value of 105 to standby group 30 if)# standby 30 +priority 105 + + + +DLS2(config- Configures this switch to preempt, or take control if)# standby 30 of, VLAN 30 forwarding if the local priority is + +preempt + + + +DLS2(config- + +higher than the active switch VLAN 30 priority + + + +HSRP will track the availability of interface + +if)# standby 30 GigabitEthernet 1/0/1. If GigabitEthernet 1/0/1 + +track +gigabitethernet + +goes down, the priority of the switch in group 30 +will be decremented by 20 +1/0/1 20 + + + +DLS2(config- HSRP will track the availability of interface if)# standby 30 GigabitEthernet 1/0/2. If GigabitEthernet 1/0/2 + +track gigabitethernet 1/0/2 + + + + +DLS2(config- + +goes down, the priority of the switch in group 30 will be decremented by the default value of 10 + + + + + + +Moves to global configuration mode + +if)# exit + + + +IP SLA Tracking: Switch DLS1 VLAN 10 + +Refer to Figure 8-7. The objective here is to probe the availability of a web server hosted in the ISP cloud at address 209.165.201.1. If the server does not respond to the IP SLA ping, the HSRP priority on interface VLAN 10 will be decremented by 20. This configuration could be applied to all other VLANs where the HSRP Active device resides (DLS1 for VLANs 1 and 10; DLS2 for VLANs 20 and 30). + + +DLS1(config)# ip sla 10 Creates SLA process 10 + + + +DLS1(config-ip-sla)# Configures the SLA as an ICMP echo icmp-echo 192.168.10.1 operation to destination 192.168.10.1 + + + +DLS1(config-ip-sla-echo)# Exits SLA configuration mode exit + + + +DLS1(config)# ip sla Configures the scheduling for SLA 10 schedule 10 start-time process to start now and continue +now life forever forever + + + +DLS1(config)# track 90 ip Creates an object, 90, to track the sla 10 state state of SLA process 10 + + + +DLS1(config-track)# exit Moves to global configuration mode + + + +DLS1(config)# interface Moves to interface configuration vlan 10 mode + + + +DLS1(config-if)# standby Tracks the state of object 90 and +10 track 90 decrement 20 decrements the device priority by 20 if the object fails + + + +DLS1(config-if)# exit Moves to global configuration mode + + + +IPv4 Configuration Example: VRRPv2 on Router and L3 Switch with IP SLA Tracking + +Figure 8-8 shows the network topology for the configuration that follows, which shows how to configure VRRPv2 using the commands covered in this chapter. Note that only the commands specific to VRRPv2 are shown in this example. Full routing and connectivity are assumed. R1 and DLS-2 are the participating devices in VRRPv2. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-8 VRRP for IPv4 Using Router and L3 Switch + + + +The network devices are configured as follows: + + +R1 and DLS-2 are VRRP partners. + + + +ALS-1 and ALS-2 are Layer 2 switches, where ALS-1 is the network switch for 10.1.10.0/24 and ALS-2 is the network switch for +10.1.11.0/24. + +R1, R2, and DLS-2 are OSPF neighbors; GigabitEthernet 1/0/5 on DLS-2 is a routed port. + +VLAN 10 is configured on ALS-1; VLAN 11 is configured on ALS-2; DLS-2 has both VLAN 10 and 11 configured. + +All lines connecting DLS-2, ALS-1, and ALS-2 are 802.1Q trunks. + +R1 is the preferred forwarder for network 10.1.10.0/24 and DLS-2 is the preferred forwarder for network 10.1.11.0/24. + + +R1 + + +R1(config)# ip sla 10 Enters SLA programming mode + + + +R1(config-ip-sla)# Has the SLA ping 10.10.10.10 icmp-echo 10.10.10.10 + + + +R1(config-ip-sla- Pings 10.10.10.10 every 5 seconds echo)# + + + +frequency 5 + + + +R1(config-ip-sla- Exits SLA programming mode echo)# exit + + + +R1(config)# ip sla Specifies the SLA start time and duration schedule 10 life +forever start-time now + + + +R1(config)# track 100 Creates tracking object 100 calling SLA 10 +ip sla 10 + + + + +R1(config)# track 2 +interface + +Creates tracking object 2 to monitor line +protocol up/down status of interface + +gigabitethernet 0/0/2 GigabitEthernet 0/0/2 line-protocol + + + +R1(config-track)# Exits tracking configuration mode exit + + + +R1(config)# interface Enters interface configuration mode for gigabitethernet 0/0/0 GigabitEthernet 0/0/0 + + + +R1(config-if)# ip Assigns the physical interface address of address 10.1.11.2 10.1.11.2/24 +255.255.255.0 + + + +R1(config-if)# vrrp Assigns the VRRP virtual IP address of 11 ip 10.1.11.1 10.1.11.1 for VRRP group 11 + + + +R1(config-if)# vrrp Uses the string CISCO123 for +11 authentication authentication between group 11 members text CISCO123 + + + +Note + + +Authentication bykeychain is not available on some L3 switch platforms + + + + + +R1(config-if)# vrrp Has VRRP group 11 watch tracking object 11 track 2 2, line protocol up/down on interface +GigabitEthernet 0/0/2 + + + +R1(config-if)# Enters interface configuration mode interface +gigabitethernet 0/0/1 + + + +R1(config-if)# ip Assigns the physical interface address of address 10.1.10.2 10.1.10.2/24 +255.255.255.0 + + + +R1(config-if)# vrrp Assigns the VRRP virtual IP address of 10 ip 10.1.10.1 10.1.10.1 for VRRP group 10 + + + +R1(config-if)# vrrp Assigns group 10 virtual forwarder priority 10 priority 105 of 105. The default is 100 + + + +R1(config-if)# vrrp Has VRRP group 10 watch tracking object 10 track 2 2, line protocol up/down on interface +GigabitEthernet 0/0/2 + + + +R1(config-if)# vrrp Has VRRP group 10 watch a second +10 track 100 tracking object. Object 100 looks for ICMP decrement 6 ping connectivity to 10.10.10.10 every 5 +seconds + + + +R1(config-if)# end Returns to privileged EXEC mode + + + +DLS-2 + + +DLS-2(config)# ip sla Enters SLA 10 programming mode 10 +DLS-2(config-ip-sla)# Has the SLA ping 10.10.10.10 icmp-echo 10.10.10.10 + + + +DLS-2(config-ip-sla- Pings 10.10.10.10 every 5 seconds echo)# + + + +frequency 5 + + + +DLS-2(config-ip-sla- Exits SLA programming mode echo)# exit + + + +DLS-2(config)# ip sla Specifies SLA 10 start time and duration schedule 10 life +forever start-time now + + + +DLS-2(config)# track Creates tracking object 100, which calls 100 ip sla 10 SLA 10 + + + + +DLS-2(config)# track 2 +interface + +Creates tracking object 2 to monitor line +protocol up/down status of interface + +gigabitethernet 1/0/5 GigabitEthernet 1/0/5 (routed port to R2) line-protocol + + + +DLS-2(config-if)# Enters interface configuration mode interface +gigabitethernet 1/0/5 + + + + +DLS-2(config-if)# no +switchport + +Changes GigabitEthernet 1/0/5 to a Layer +3 port +DLS-2(config-if)# ip Assigns IPv4 address 10.3.1.1/30 address 10.3.1.1 +255.255.255.252 + + + +DLS-2(config)# Enters interface configuration mode interface +gigabitethernet 1/0/2 + + + +DLS-2(config-if)# Forces trunk mode switchport mode trunk + + + +DLS-2(config-if)# Limits VLAN traffic on this trunk to switchport trunk VLANs 1 and 10 +allowed vlan 1,10 + + + +DLS-2(config-if)# Enters interface configuration mode interface +gigabitethernet 1/0/7 + + + +DLS-2(config-if)# Forces trunk mode switchport mode trunk + + + +DLS-2(config-if)# Limits VLAN traffic on this trunk to switchport trunk VLANs 1 and 11 +allowed vlan 1,11 + + + +DLS-2(config-if)# Enters switched virtual interface interface vlan 10 configuration mode for VLAN 10 + + + +DLS-2(config-if)# ip Assigns IPv4 address 10.1.10.3/24 address 10.1.10.3 +255.255.255.0 + + + +DLS-2(config-if)# vrrp Assigns the VRRP virtual IP address of 10 ip 10.1.10.1 10.1.10.1 for VRRP group 10 + + + +DLS-2(config-if)# vrrp Has VRRP group 10 watch tracking object 10 track 2 2, line protocol up/down on interface +GigabitEthernet 1/0/5 + + + +DLS-2(config-if)# Enters switched virtual interface interface vlan 11 configuration mode for VLAN 11 + + + +DLS-2(config-if)# ip Assigns IPv4 address 10.1.11.3/24 address 10.1.11.3 +255.255.255.0 + + + +DLS-2(config-if)# vrrp Assigns the VRRP virtual IP address of 11 ip 10.1.11.1 10.1.11.1 for VRRP group 11 + + + +DLS-2(config-if)# vrrp Assigns group 11 virtual forwarder 11 priority 105 priority of 105. The default is 100 + + + +DLS-2(config-if)# vrrp Uses the string CISCO123 for +11 authentication text authentication between group 11 CISCO123 members + + + +DLS-2(config-if)# vrrp Has VRRP group 11 watch tracking object 11 track 2 2, line protocol up/down on interface +GigabitEthernet 1/0/5 + + + +DLS-2(config-if)# vrrp Has VRRP group 11 watch a second +11 track 100 decrement +6 + + +tracking object. Object 100 looks for ICMP ping connectivity to 10.10.10.10 +every 5 seconds + + + + + +DLS-2(config-if)# exit Returns to privileged EXEC mode + + + +IPv6 Configuration Example: HSRPv2 on Router and L3 Switch + +Figure 8-9 shows the network topology for the IPv6 HSRPv2 configuration that follows. Router R1 and L3 switch DLS-2 are the HSRP pair. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-9 HSRPv2 IPv6 with Router and L3 Switch + + + +R1 + +The network devices are configured similar to those in the previous example: + + +R1 and DLS-2 are HSRPv2 partners. +ALS-1 and ALS-2 are Layer 2 switches, where ALS-1 is the network switch for 2001:0:0:5::0/64 and ALS-2 is the network switch for 2001:0:0:6::0/64. + +R1, R2, and DLS-2 are OSPFv3 neighbors; GigabitEthernet 1/0/5 on DLS-2 is a routed port. + +VLAN 10 is configured on ALS-1; VLAN 11 is configured on ALS-2; DLS-2 has both VLANs 10 and 11 configured. + +All lines connecting DLS-2, ALS-1, and ALS-2 are 802.1Q trunks. + +R1 is the preferred forwarder for network 2001:0:0:5::0/64 and DLS-2 is the preferred forwarder for network 2001:0:0:6::0/64. + + + +R1(config)# ipv6 Enables IPv6 forwarding unicast-routing + + + +R1(config)# ip sla 11 Enters SLA programming mode for process 11 + + + +R1(config-ip-sla)# Has the SLA ping 2001:0:0:8::1 icmp-echo +2001:0:0:8::1 source-interface gigabitethernet 0/0/2 + + + +R1(config-ip-sla- Pings every 5 seconds echo)# frequency 5 + + + +R1(config-ip-sla- Exits SLA programming mode echo)# exit + + + +1(config)# ip sla Defines the start and duration for SLA 11 +schedule 11 life forever start-time now + + + +R1(config)# track 111 Creates tracking object 111 that uses SLA ip sla 11 11 + + + +R1(config-track)# exit Exits tracking + + + +R1(config)# interface Enters interface configuration mode gigabitethernet 0/0/0 + + + +R1(config-if)# ipv6 Assigns IPv6 unicast address address +2001:0:0:6::2/64 + + + +R1(config-if)# standby Enables HSRPv2 version 2 + + + +Note + + +HSRPv2 is required for IPv6 implementation + + + + + + + +R1(config-if)# standby Creates IPv6 HSRP virtual address 11 ipv6 autoconfig + + + +Note + + +When you enter the standbyipv6 command, a modified EUI-64 format interface identifier is generated in which the EUI-64 interface identifier is created from the relevant HSRP virtual MAC address + + +Note + + +The standbygroup ipv6 interface command can offer different options when using different platforms. For example, a 3560 L3 switch will allow an IPv6 prefix argument, whereas a 2911G2 router will not + + + + + + +R1(config-if)# standby Configures this device to preempt, or take 11 preempt control of, the active forwarding if the +local priority is higher than any of the other members of the HSRP group + + + + + +Note + + +The same preempt command arguments are available for IPv6 as in IPv4 + + + + +R1(config-if)# standby Instructs HSRPv2 to follow the line 11 track protocol of GigabitEthernet 0/0/2 and + +gigabitethernet 0/0/2 +12 + +decrement the interface group priority by +12 when the interface goes down + + + + + + +Note + + +When the preceding tracking command is entered, the router creates the following line protocol tracking object: + + +track x interface GigabitEthernet 0/0/2 line-protocol, where x is the next available number available for a tracking object. The IOS then substitutes the tracking command standby11 track x decrement 12 at the +interface (as seen below) + + + + + + + + +R1(config-if)# standby Has HSRP group 11 watch tracking object + +11 track 1 decrement +12 + +1, line protocol up/down on interface +GigabitEthernet 0/0/2 + + + + +R1(config-if)# Enters interface configuration mode interface +gigabitethernet 0/1 + + + +R1(config-if)# ipv6 Assigns an IPv6 unicast address address +2001:0:0:5::2/64 + + + +R1(config-if)# standby Selects HSRPv2 version 2 + + + +R1(config-if)# standby Creates IPv6 HSRP virtual address 10 ipv6 autoconfig + + + +R1(config-if)# standby Sets a priority of 105 for standby group 10 10 priority 105 on this interface + + + +R1(config-if)# standby Configures this device to preempt, or take 10 preempt control of, the active forwarding if the +local priority is higher than any of the other members of the HSRP group + + + +R1(config-if)# standby Links tracking object 1 to this HSRP group +10 track 1 decrement +12 + + +and decreases this device’s priority by 12 +when tracking object 1 is asserted + + + + +R1(config-if)# standby Links a second tracking object to this + +10 track 111 decrement +7 + +HSRP group and decreases the device’s +priority by 7 when asserted + + + + +DLS-2 + + + +DLS-2(config)# ip routing + + + +DLS-2(config)# ipv6 + +Enables IOS Layer 3 functionality + + + + + +Enables IOS IPv6 Layer 3 functionality + +unicast-routing + + + +DLS-2(config)# sdm Configures the Switching Database Manager prefer dual-ipv4- on the switch to optimize memory and +and-ipv6 operating system for both IPv4 and IPv6 Layer 3 forwarding + + + + + +Caution + + +This command requires a reload of the switch to take effect and is not available on the Catalyst 3650 + + + + + +DLS-2(config)# ip Creates and enters SLA 11 sla 11 + + + +Note +The SLAs are added onlyas an illustration of capability + + + + + + + + +Note + + +There seems to be no distinction between IPv4 and IPv6 in the ip sla command + + + + +DLS-2(config-ip- Assigns 2001:0:0:8::1 as the ICMP ping sla)# icmp-echo destination for this SLA 2001:0:0:8::1 + + + +DLS-2(config-ip- Sends pings every 5 seconds sla-echo)# +frequency 5 + + + +DLS-2(config-ip- Exits SLA configuration mode sla-echo)# exit + + + +DLS-2(config)# ip Assigns the start time and duration for SLA 11 sla schedule 11 +life forever start-time now + + + +DLS-2(config)# Creates tracking object 101, which uses SLA 11 track 101 ip sla 11 + + + +DLS-2(config- Exits tracking configuration mode track)# exit +DLS-2(config)# Enters interface configuration mode interface loopback +0 + + + +DLS-2(config-if)# Assigns an IPv6 unicast address ipv6 address +2001:0:0:3::1/64 + + + + +DLS-2(config-if)# interface gigabitethernet 1/0/5 + + + +DLS-2(config-if)# + +Enters interface configuration mode + + + + + + + + + +Changes Layer 2 switch port to a Layer 3 + +no switchport routed port + + + +DLS-2(config-if)# Assigns an IPv6 address to this L3 forwarding ipv6 address port +2001:0:0:1::1/64 + + + + +DLS-2(config-if)# interface gigabitethernet 1/0/2 + + + +DLS-2(config-if)# + +Enters interface configuration mode for L2 interface + + + + + + +Permits traffic from VLANs 1 and 10 on the + +switchport trunk trunk allowed vlan 1,10 + + + +DLS-2(config-if)# Sets the port to trunk unconditionally switchport mode +trunk + + + + +DLS-2(config-if)# interface gigabitfastethernet 0/7 + + + +DLS-2(config-if)# + +Enters interface configuration mode + + + + + + + + + +Permits traffic from VLANs 1 and 11 on the + +switchport trunk trunk allowed vlan 1,11 + + + +DLS-2(config-if)# Sets the port to trunk unconditionally switchport mode +trunk + + + +DLS-2(config-if)# Enters interface programming mode for VLAN interface vlan 10 10 SVI + + + +DLS-2(config-if)# Specifies HSRPv2 standby version 2 + + + +DLS-2(config-if)# Assigns IPv6 unicast address ipv6 address +2001:0:0:5::3/64 + + + +DLS-2(config-if)# Creates IPv6 HSRP virtual address standby 10 ipv6 +autoconfig + + + +DLS-2(config-if)# Enables this group’s HSRP forwarder to standby 10 preempt become active at any time when its group +priority is the highest + + + +DLS-2(config-if)# Links tracking object 111 to this standby group standby 10 track and decreases this device’s priority by 10 +111 decrement 10 when tracking object 111 is asserted + + + + +DLS-2(config-if)# Enters interface configuration mode for VLAN interface vlan 11 11 SVI + + + +DLS-2(config-if)# Assigns IPv6 unicast address ipv6 address +2001:0:0:6::3/64 + + + +DLS-2(config-if)# Specifies HSRPv2 standby version 2 + + + +DLS-2(config-if)# Creates IPv6 HSRP virtual address standby 11 ipv6 +autoconfig + + + +DLS-2(config-if)# Sets a priority of 105 for standby group 11 on standby 11 priority this interface +105 + + + +DLS-2(config-if)# Enables this group’s HSRP forwarder to standby 11 preempt transition to active at any time when its group +priority is the highest + + + +DLS-2(config-if)# Links tracking object 111 to HSRP group 11 standby 11 track and decreases this device’s priority by 10 111 decrement 10 when tracking object 111 is asserted +Note +HSRP verification and debug commands are the same for IPv4 and IPv6. + + + +DYNAMIC HOST CONTROL PROTOCOL (DHCP) DHCP is a network management protocol used on UDP/IP networks whereby a DHCP server dynamically assigns an IP +address and other network configuration parameters to each device on a network so that the devices can communicate with other IP networks. + +Implementing DHCP for IPv4 + +DHCP was first defined in RFC 1531 in October 1993, but due to errors in the editorial process was almost immediately reissued as RFC 1541. + +Configuring a DHCP Server on a Cisco IOS Router + + +Router(config)# Creates a DHCP pool named INTERNAL. The ip dhcp pool name can be anything of your choosing INTERNAL + + + +Router(dhcp- Defines the range of addresses to be leased config)# network +172.16.10.0 255.255.255.0 + + + +Router(dhcp- Defines the address of the default router for the config) # client. One IP address is required; however, you + +default-router +172.16.10.1 + + +can specify up to eight IP addresses in the +command line, listed in order of precedence +Router(dhcp- Defines the address of the DNS server for the config)# dns- client +server 172.16.10.10 + + + + +Router(dhcp- +config)# + +Defines the address of the NetBIOS server for the +client + + + + +netbios-name-server 172.16.10.10 + + + +Router(dhcp- Defines the domain name for the client config)# + + + +domain-name fakedomainname.c om + + + +Router(dhcp- Defines the lease time to be 14 days, 12 hours, 23 config)# lease minutes +14 12 23 + + + +Router(dhcp- Sets the lease time to infinity; the default time is config)# lease 1 day +infinite + + + +Router(dhcp- Returns to global configuration mode config)# exit +Router(config)# Specifies the range of addresses not to be leased ip dhcp out to clients +excluded-address 172.16.10.1 172.16.10.10 + + + +Router(config)# Enables the DHCP service and relay features on a Cisco IOS router + +service dhcp + + + +Router(config)# Turns off the DHCP service, which is on by default in Cisco IOS Software + +no service dhcp + + + +Configuring DHCP Manual IP Assignment + +It is sometimes desirable to link a specific network device with a specific IPv4 address using a Cisco device’s DHCP service. The Cisco device uses a “client ID” to identify a DHCP client device and is programmed into the DHCP pool. + + + +Note +The DHCP client device ID can be determined using the show ip dhcp binding command after the client has successfullyobtained the next available IP address from the DHCP pool. + + + +The DHCP pool programming must also include any other required programming such as default router IP, DNS, or WINS addresses, and so on. + + + +Router(config)# ip dhcp pool +POOL1 + +Creates a DHCP pool named +POOL1 +Router(dhcp-config)# 172.22.12.88/24 + + + + + + +Router(dhcp-config)# +identifier + + +host + + + + + + + + + +client- + +Defines the single IP address for the DHCP pool in dotted decimal with subnet mask or CIDR notation + + + +Specifies the client ID of the +network device that should + +0063.6973.636f.2d30.3030.362e.6 receive the specific IP 636.3962.2e65.3331.312d.4769.30 +2f.31 + + + +Router(dhcp-config)# default- Specifies the gateway router router 172.22.12.1 for the DHCP clients + + + + +Router(dhcp-config)# dns-server +192.168.22.11 + +Specifies the IP address of +the DNS service + + + + + +Router(dhcp-config)# lease 1 0 +0 + +Specifies the DHCP lease length in “days hours +minutes” + + + + +Router(dhcp-config)# exit Leaves DHCP configuration mode + + + +Configuring DHCP Relay + +DHCP services can reside anywhere within the network. The DHCP relay service translates a client broadcast DHCP service request to a unicast DHCP request directed to the DHCP server IP address. The command is added to the Layer 3 interface on the IP segment from which the DHCP broadcast request originates. +Router(config)# interface gigabitethernet 0/0 + + + +Router(config- + +Moves to interface configuration mode + + + + + + + + + +Forwards DHCP broadcast messages as unicast + +if)# ip helper- messages to this specific address instead of address having them be dropped by the router 172.16.20.2 + + + + + +Note +The ip helper-address command forwards broadcast packets as a unicast to eight different UDP ports by default: + + +TFTP (port 69) + +DNS (port 53) + +Time service (port 37) + +NetBIOS name server (port 137) + +NetBIOS datagram server (port 138) + +Boot Protocol (BOOTP) client and server datagrams (ports 67 and 68) + +TACACS service (port 49) + + + + + +If you want to close some of these ports, use the no ip forward-protocol udp x command at the global configuration prompt, where x is the port number you want to close. Services not forwarded by ip helper-address can be added using the ip forward-protocol global command. + + +Router(config-if)# ip Forwards the DHCP traffic to the helper- address 10.1.1.1 DHCP server at 10.1.1.1 +Router(config)# no ip Prevents forwarding of traffic for forward- protocol udp 37 UDP time services using port 37 + + + +Router(config)# ip Forwards traffic for UDP services forward- protocol udp 5858 using port 5858 + + + +Configuring a DHCP Client on a Cisco IOS Software Ethernet Interface + +Figure 8-10 shows the network topology for the configuration that follows, which demonstrates how to configure provider-assigned IPv4 DHCP address. + + + + + + + + +Figure 8-10 Configure a Provider-Assigned DHCP IPv4 Address + + + +EDGE(config)# interface Enters GigabitEthernet 0/0 interface gigabitethernet 0/0 configuration mode + + + +EDGE(config-if)# ip Allows the interface to obtain an address dhcp address dynamically from the ISP + + + +EDGE(config-if)# no Enables the interface shutdown + + + + + +Note +If the default gatewayoptional parameter is contained within the DHCP replypacket, the router will install a static default route in its routing table, with the default gateway’s IP address as the next hop. The default route is installed with the administrative distance of 254, which makes it a floating static route. To disable this feature, use the interface-level command no ip dhcp client request router. +Verifying and Troubleshooting DHCP Configuration + + + +Router# show ip dhcp binding + + + +Router# show ip dhcp + +Displays a list of all bindings created + + + +Displays the bindings for a specific + +binding w.x.y.z DHCP client with an IP address of w.x.y.z + + + +Router# clear ip dhcp Clears an automatic address binding a.b.c.d binding from the DHCP server +database + + + + +Router# clear ip dhcp +binding * + +Clears all automatic DHCP +bindings + + + + +Router# show ip dhcp Displays a list of all address conflict conflicts that the DHCP server +recorded + + + +Router# clear ip dhcp Clears an address conflict from conflict a.b.c.d the database + + + +Router# clear ip dhcp Clears conflicts for all addresses conflict * + + + +Router# show ip dhcp Displays recent activity on the database DHCP database + + + +Displays information about DHCP +Router# show ip dhcp pool + + + +Router# show ip dhcp pool +name + +address pools + + + +Displays information about the +DHCP pool named name + + + + +Router# show ip dhcp Displays interface on which DHCP interface is enabled + + + +Router# show ip dhcp server Displays a list of the number of statistics messages sent and received by the +DHCP server + + + +Router# clear ip dhcp Resets all DHCP server counters server statistics to 0 + + + +Router# debug ip dhcp Displays the DHCP process of server {events | packet | addresses being leased and linkage | class} returned + + + +Router# debug ip dhcp Report address assignments, lease server events expirations, and so on + + + +Router# debug ip dhcp Decodes DHCP server message server packets receptions and transmissions + + + +Implementing DHCP for IPv6 + +DHCPv6 can deliver both stateful and stateless information. Stateful, or centrally managed, information is used to provide parameters not available through stateless address autoconfiguration (SLAAC) or neighbor discovery. SLAAC means +that the client picks their own address based on the router prefix being advertised. Additional parameters such as a DNS server address must be provided by stateless DHCPv6 services. + +DHCPv6 clients and servers are identified to each other by a DHCP unique identifier (DUID) using the lowest number interface MAC address. DHCPv6 exchanges are either normal four-message (solicit, advertise, request, reply) exchanges or the rapid commit two-message (solicit, reply) exchanges. + +The DHCPv6 server maintains a binding table in RAM that maintains configuration parameters. + + + +Note +Unlike DHCPv4, the DHCPv6 service does not give out IP addresses; instead, it gives out prefixes. The client creates the remaining bits for a valid IPv6 address. The duplicate address detection (DAD) mechanism ensures the uniqueness of the address. There is no DHCPv6 excluded-address command. + + + +There are three methods for dynamically allocating IPv6 addressing and configuration information: + +1. SLAAC (no DHCPv6 server required) + +2. SLAAC and a stateless DHCPv6 server + +3. Stateful DHCPv6 server + + +Using SLAAC and Configuring a Router as a Stateless DHCPv6 Server + +A stateless DHCPv6 server doesn’t allocate or maintain IPv6 global unicast addressing information. A stateless server only provides common network information that is available to all devices on the network, such as a list of DNS server addresses or a domain name. + +The SLAAC with stateless DHCPv6 method involves setting the Other Configuration flag (O flag) to 1. With this method the device +creates its own global unicast address (GUA) using SLAAC. It also needs to use information from other sources, such as the link MTU contained in the router advertisement (RA). In this scenario, the three RA flags are as follows: + + +A flag = 1 – Use SLAAC to create a global unicast address + +O flag = 1 – Communicate with a stateless DHCPv6 server for other addressing information + +M flag = 0 – Do not need to communicate with a stateful DHCPv6 server + + + +Router# configure Enters global configuration mode terminal + + + +Router(config)# ipv6 Creates a DHCPv6 pool named dhcp pool STATELESS STATELESS + + + +Router(config-dhcp)# Configures a domain name for a domain-name nodomain.com DHCPv6 client + + + + +Router(config-dhcp)# dns-server 2001:db8:3000:3000::42 + + + +Router(config-dhcp)# exit + + + +Router(config)# +interface + +Specifies the DNS server address for the DHCPv6 clients + + + + +Leaves DHCPv6 configuration mode + + + + + +Specifies an interface type and +number, and enters interface + +gigabitethernet 0/0 configuration mode +Router(config-if)# ipv6 Sets the router advertisement Other nd other-config-flag Configuration flag (O flag) to 1 + + + + + +Note + + +The default setting of the O flag is 0 + + + + + + + + +Note + + +To set the O flag back to the default setting of 0, use the no ipv6 nd other-config-flag command + + + + + + + + +Note + + +When the O flag is set to 1, this tells the end client device that other information is available from a stateless DHCPv6 server + + + + + +Router(config-if)# ipv6 Enables DHCPv6 on an interface for dhcp server STATELESS the appropriate IPv6 address pool + + + +Router(config-if)# end Moves to privileged EXEC mode + + + +Configuring a Router as a Stateful DHCPv6 Server + +Unlike the other methods used to assign IPv6 addresses to clients, stateful DHCPv6 does not utilize SLAAC to generate a global +unicast address. Stateful DHCPv6 is similar to the DHCP services provided for IPv4. + +A stateful DHCPv6 server provides IPv6 GUA addresses to clients and keeps track of which devices have been allocated IPv6 addresses. + +The stateful DHCPv6 method involves modifying two flags: the Managed Address Configuration flag (M flag) and the Address Autoconfiguration flag (A flag). In this scenario, the three RA flags are as follows: + + +A flag = 0 – Do not use SLAAC to create a global unicast address + +O flag = 0 – No need to communicate with a stateless DHCPv6 server + +M flag = 1 – Obtain the global unicast address and other information from a stateful DHCPv6 server + + + +Router# configure Enters global configuration mode terminal + + + +Router(config)# ipv6 Creates a DHCPv6 pool named STATEFUL-dhcp pool STATEFUL- DHCPv6 +DHCPv6 + + + +Router(config-dhcp)# Causes the router to be a stateful DHCPv6 address prefix server and to allocate addresses. The prefix + +2001:db8:cafe:1::/64 + + + + + +Router(config-dhcp)# +domain-name + + +length indicates the number of available address in the pool + + + +Configures a domain name for a DHCPv6 +client +nodomain.com + + + +Router(config-dhcp)# Specifies the DNS server address for the dns- server DHCPv6 clients 2001:db8:cafe:1::888 +8 + + + + +Router(config-dhcp)# exit + + + +Router(config)# +interface + +Leaves DHCPv6 configuration mode + + + + + +Specifies an interface type and number, and +enters interface configuration mode + +gigabitethernet 0/0 + + + +Router(config-if)# Sets the Managed Configuration flag (M ipv6 nd managed- flag) to 1 +config-flag + + + + +Note + + +The default setting of the Mflag is 0 + + + + + + + + +Note + + +To set the Mflag back to the default setting of 0, use the no ipv6 nd managed-config-flag command + + + + + +Router(config-if)# Assigns an IPv6 address to the interface ipv6 nd prefix +2001:db8:cafe:1::/64 no-autoconfig + + + + + + +Router(config-if)# + + +The no-autoconfig keyword sets the A flag to 0. This ensures that the interface won’t use SLAAC in its RA messages to clients + + + + +Enables the DHCPv6 service on the client- + +ipv6 dhcp server facing interface and associates it with the STATEFUL-DHCPv6 pool STATEFUL-DHCPv6 + + + + + +Note + + +You can add the rapid-commit keyword at the of this command to enable the use of the two-message exchange between server and client + + + + + +Router(config-if)# Moves to privileged EXEC mode end + + + +Configuring DHCPv6 Client + + +Router# configure Enters global configuration mode terminal + + + +Router(config)# Enters interface configuration mode, and interface interface- specifies the interface to configure +id + + + +Router(config-if)# Enables the interface to acquire an IPv6 ipv6 address dhcp address using the four-message exchange +from the DHCPv6 server +Router(config-if)# Enables the interface to acquire an IPv6 ipv6 address dhcp address using the two-message exchange rapid-commit from the DHCPv6 server + + + +Configuring DHCPv6 Relay Agent + + +Router# configure Enters global configuration mode terminal + + + + +Router(config)# interface +gigabitethernet 0/0 + +Specifies an interface type and number, and enters interface configuration +mode + + + + + +Router(config-if)# + + + +ipv6 dhcp relay destination +fe80::250:a2ff:febf:a05 + +Specifies a destination address to which client packets are forwarded and enables DHCPv6 relay service on the +interface + +6 gigabitethernet 0/1 + +Note + + +It is possible to use a global unicast IPv6 address as the relaydestination instead of a link-local address + + + + + +Router(config-if)# end Return to privileged EXEC mode + + + +Verifying and Troubleshooting DHCPv6 + + + +Router# show ipv6 dhcp +binding + +Displays the IPv6 to MAC address +bindings +Router# show ipv6 dhcp pool + + + +Router# show ipv6 dhcp + +Displays DHCPv6 pool statistics + + + + + +Displays interface on which DHCPv6 + +interface is enabled + + + +Router# debug ipv6 dhcp Enables DHCPv6 debugging [detail] + + + +Router# debug ipv6 dhcp +relay + +Enables DHCPv6 relay agent +debugging + + + + +Configuration Example: DHCP for IPv4 + +Figure 8-11 illustrates the network topology for the configuration that follows, which shows how to configure DHCP services on a Cisco IOS router using the commands covered in this chapter. + + + + + + + + + + + + + + + + + +Figure 8-11 Network Topology for DHCP Configuration + + + +Edmonton Router + + +Router> enable Moves to privileged EXEC mode +Router# configure Moves to global configuration mode terminal + + + +Router(config)# Sets the host name hostname Edmonton + + + + +Edmonton(config)# interface +gigabitethernet 0/0 + + + +Edmonton(config- + +Moves to interface configuration mode + + + + + + + + + +Sets the local description of the interface + +if)# description LAN Interface + + + +Edmonton(config- Assigns an IP address and netmask if)# ip address +10.0.0.1 255.0.0.0 + + + +Edmonton(config- Enables the interface if)# no shutdown + + + +Edmonton(config- Moves to interface configuration mode if)# interface +serial 0/0/0 + + + +Edmonton(config- Sets the local description of the interface if)# description +Link to Gibbons Router +Edmonton(config- Assigns an IP address and netmask if)# ip address +192.168.1.2 255.255.255.252 + + + +Edmonton(config- Assigns the clock rate to the DCE cable on this if)# clock rate side of link +4000000 + + + +Edmonton(config- Enables the interface if)# no shutdown + + + +Edmonton(config- Returns to global configuration mode if)# exit + + + +Edmonton(config)# Creates a static route to the destination network ip route +192.168.3.0 255.255.255.0 serial 0/0/0 + + + +Edmonton(config)# Verifies that the router can use DHCP services service dhcp and that DHCP is enabled. This command is +enabled by default in Cisco IOS and will not appear in the running configuration + + + +Edmonton(config)# Creates a DHCP pool called 10NETWORK ip dhcp pool +10NETWORK + + + +Edmonton(dhcp- Defines the range of addresses to be leased +config)# network 10.0.0.0 255.0.0.0 + + + +Edmonton(dhcp- Defines the address of the default router for config)# default- clients +router 10.0.0.1 + + + +Edmonton(dhcp- Defines the address of the NetBIOS server for config)# netbios- clients +name-server 10.0.0.2 + + + +Edmonton(dhcp- Defines the address of the DNS server for config)# dns- clients +server 10.0.0.3 + + + +Edmonton(dhcp- Defines the domain name for clients config)# domain- +name fakedomainname.co m + + + +Edmonton(dhcp- Sets the lease time to be 12 days, 14 hours, 30 config)# lease 12 minutes +14 30 + + + +Edmonton(dhcp- Returns to global configuration mode config)# exit + + + +Edmonton(config)# Specifies the range of addresses not to be leased +ip dhcp out to clients excluded-address +10.0.0.1 10.0.0.5 + + + +Edmonton(config)# Creates a DHCP pool called ip dhcp pool 192.168.3NETWORK +192.168.3NETWORK + + + +Edmonton(dhcp- Defines the range of addresses to be leased config)# network +192.168.3.0 255.255.255.0 + + + +Edmonton(dhcp- Defines the address of the default router for config)# default- clients +router 192.168.3.1 + + + + +Edmonton(dhcp- +config)# + +Defines the address of the NetBIOS server for +clients + + + + +netbios-name-server 10.0.0.2 + + + +Edmonton(dhcp- Defines the address of the DNS server for config)# dns- clients +server 10.0.0.3 + + + +Edmonton(dhcp- Defines the domain name for clients config)# domain- +name +fakedomainname.co m + + +Edmonton(dhcp- Sets the lease time to be 12 days, 14 hours, 30 config)# lease 12 minutes +14 30 + + + +Edmonton(dhcp- Returns to global configuration mode config)# exit + + + +Edmonton(config)# Returns to privileged EXEC mode exit + + + +Edmonton# copy Saves the configuration to NVRAM running-config +startup-config + + + +Gibbons Router + + + +Router> + + + +Router# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Router(config)# Sets the host name hostname Gibbons + + + +Gibbons(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 +Gibbons(config-if)# Sets the local description of the interface description LAN +Interface + + + +Gibbons(config-if)# Assigns an IP address and netmask ip address +192.168.3.1 255.255.255.0 + + + +Gibbons(config-if)# Forwards DHCP broadcast messages as ip helper-address unicast messages to this specific address + +192.168.1.2 + + + + + +Gibbons(config-if)# + + +instead of having them be dropped by the router + + + +Enables the interface + +no shutdown + + + +Gibbons(config-if)# Moves to interface configuration mode interface serial +0/0/1 + + + +Gibbons(config-if)# Sets the local description of the interface description Link to +Edmonton Router + + + +Gibbons(config-if)# Assigns an IP address and netmask ip address +192.168.1.1 255.255.255.252 + + + +Gibbons(config-if)# Enables the interface no shutdown +Gibbons(config-if)# Returns to global configuration mode exit + + + +Gibbons(config)# ip Creates a default static route to the route 0.0.0.0 destination network +0.0.0.0 serial 0/0/1 + + + +Gibbons(config)# Returns to privileged EXEC mode exit + + + +Gibbons# copy Saves the configuration to NVRAM running-config +startup-config + + + +Configuration Example: DHCP for IPv6 + +Figure 8-12 illustrates the network topology for the configuration that follows, which shows how to configure DHCP for IPv6 services on a Cisco IOS router using the commands covered in this chapter. For this lab, the DHCPv6 clients are simulated as IOS routers to show the interface configuration required for stateless and stateful DHCPv6 to be operational. +Figure 8-12 Network Topology for DHCPv6 Configuration + + + +Edmonton Router + + + +Router> + + + +Router# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Router(config)# Sets the host name hostname Edmonton + + + + +Edmonton(config)# ipv6 unicast-routing + + + +Edmonton(config)# ipv6 + +Enables IPv6 routing + + + + + +Creates a DHCPv6 pool for the + +dhcp pool EDMONTONLAN Edmonton LAN. Since this pool is used for stateless DHCPv6, no prefix is configured + + + +Edmonton(config- Sets the DNS server address dhcpv6)# dns-server +2001:db8:10:1::3 + + + +Edmonton(config- Sets the domain name dhcpv6)# domain-name +cisco.com + + + +Edmonton(config- Exits the EDMONTONLAN pool dhcpv6)# exit +Edmonton(config)# ipv6 Creates a DHCPv6 pool for the Gibbons dhcp pool GIBBONSLAN LAN + + + +Edmonton(config- Defines a prefix for the DHCP pool dhcpv6)# address prefix +2001:db8:192:3::/64 + + + +Edmonton(config- Sets the DNS server address dhcpv6)# dns-server +2001:db8:10:1::3 + + + +Edmonton(config- Sets the domain name dhcpv6)# domain-name +cisco.com + + + +Edmonton(config- Exits the GIBBONSLAN pool dhcpv6)# exit + + + +Edmonton(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Edmonton(config-if)# Sets the local description of the interface description LAN +Interface + + + +Edmonton(config-if)# Enables IPv6 functions ipv6 enable + + + +Edmonton(config-if)# Assigns an IPv6 address and prefix ipv6 address length +2001:db8:10:1::1/64 + + + +Edmonton(config-if)# Sets the Other Configuration flag to 1 for ipv6 nd other-config- stateless DHCPv6 +flag + + + +Edmonton(config-if)# Assigns the EDMONTONLAN pool to ipv6 dhcp server the local LAN interface EDMONTONLAN + + + +Edmonton(config-if)# no Enables the interface shutdown + + + +Edmonton(config-if)# Moves to interface configuration mode interface serial 0/0/0 + + + +Edmonton(config-if)# Sets the local description of the interface description Link to +Gibbons Router + + + +Edmonton(config-if)# Enables IPv6 functions ipv6 enable + + + +Edmonton(config-if)# Assigns an IP address and prefix length ipv6 address +2001:db8:192:1::2/64 + + + +Edmonton(config-if)# Assigns the GIBBONSLAN pool to the ipv6 dhcp server WAN interface since it will be receiving GIBBONSLAN DHCPv6 relay messages from Gibbons +Edmonton(config-if)# Assigns the clock rate to the DCE cable clock rate 4000000 on this side of link + + + +Edmonton(config-if)# no Enables the interface shutdown + + + +Edmonton(config-if)# Returns to global configuration mode exit + + + +Edmonton(config)# ipv6 Creates a static route to the Gibbons route 2001: LAN network +db8:192:3::/64 2001:db8:192:1::1 + + + +Edmonton# copy running- Saves the configuration to NVRAM config startup-config + + + +Gibbons Router + + + +Router> + + + +Router# + + +enable + + + +configure + +Moves to privileged EXEC mode + + + +Moves to global configuration mode + +terminal + + + +Router(config)# Sets the host name hostname Gibbons + + + +Gibbons(config)# ipv6 Enables IPv6 routing unicast-routing +Gibbons(config)# Moves to interface configuration mode interface +gigabitethernet 0/0 + + + +Gibbons(config-if)# Sets the local description of the interface description LAN +Interface + + + +Gibbons(config-if)# Enables IPv6 functions ipv6 enable + + + +Gibbons(config-if)# Assigns an IP address and prefix length ipv6 address +2001:db8:192:3::1/64 + + + +Gibbons(config-if)# Forwards DHCPV6 multicast messages as ipv6 dhcp relay unicast messages to this specific address + +destination 2001:db8:192:1::2 + + + +Gibbons(config-if)# + + +instead of having them be dropped by the router + + + +Sets the Managed Address Configuration + +ipv6 nd managed- flag to 1 for stateful DHCPv6 config-flag + + + +Gibbons(config-if)# Enables the interface no shutdown + + + +Gibbons(config-if)# Moves to interface configuration mode interface serial +0/0/1 +Gibbons(config-if)# Sets the local description of the interface description Link to +Edmonton Router + + + + +Gibbons(config-if)# Enables IPv6 functions ipv6 enable + + + +Gibbons(config-if)# Assigns an IP address prefix length ipv6 address +2001:db8:192:1::1/64 + + + +Gibbons(config-if)# Enables the interface no shutdown + + + +Gibbons(config-if)# Returns to global configuration mode exit + + + +Gibbons(config)# ipv6 Creates an IPv6 default static route that route ::/0 points to the Edmonton router 2001:db8:192:1::2 + + + +Gibbons(config)# exit Returns to privileged EXEC mode + + + +Gibbons# copy Saves the configuration to NVRAM running-config +startup-config + + + +EdmontonPC Stateless DHCPv6 Client (IOS Router) + + +EdmontonPC(config)# Moves to interface configuration mode +interface gigabitethernet 0/0 + + + +EdmontonPC(config- Enables IPv6 functions if)# ipv6 enable + + + +EdmontonPC(config- Sets the interface for SLAAC and installs an if)# ipv6 address IPv6 default route to the Edmonton autoconfig default GigabitEthernet 0/0 interface link-local +address + + + +EdmontonPC(config- Enables the interface if)# no shutdown + + + +EdmontonPC(config)# Returns to privileged EXEC mode exit + + + +EdmontonPC# copy Saves the configuration to NVRAM running-config +startup-config + + + +GibbonsPC Stateful DHCPv6 Client (IOS Router) + + +GibbonsPC(config)# interface Moves to interface gigabitethernet 0/0 configuration mode + + + +GibbonsPC(config-if)# ipv6 enable Enables IPv6 functions + + + +GibbonsPC(config-if)# ipv6 Sets the interface for address dhcp stateful DHCPv6 +GibbonsPC(config-if)# no shutdown Enables the interface + + + +GibbonsPC# copy running-config Saves the configuration to startup-config NVRAM +Chapter 9 + +Device Management + + + + + +This chapter provides information about the following topics: + + +Configuring passwords + + + +Cleartext password encryption + +Password encryption algorithm types + +Configuring SSH + +Verifying SSH + +Boot system commands + +The Cisco IOS File System + +Viewing the Cisco IOS File System + +Commonly used URL prefixes for Cisco network devices + +Deciphering IOS image filenames + +Backing up configurations to a TFTP server + +Restoring configurations from a TFTP server + +Backing up the Cisco IOS Software to a TFTP server + +Restoring/upgrading the Cisco IOS Software from a TFTP server + +Restoring the Cisco IOS Software using the ROM Monitor environmental variables and tftpdnld command + +Secure Copy Protocol (SCP) +Configuring an SCP server + +Verifying and troubleshooting SCP + +Configuration example: SCP + + + +Disabling unused services + +Useful device management options + + + +CONFIGURING PASSWORDS + +These commands work on both routers and switches. + + +Edmonton(config)# Sets the enable password. This password enable password cisco is stored as cleartext + + + +Edmonton(config)# Sets the enable secret password. This enable secret class password is stored using a cryptographic +hash function (MD5) + + + +Edmonton(config)# Sets the enable secret password using the enable algorithm-type SHA-256 algorithm, which is a stronger sha256 secret class hashing algorithm than MD5 + + + +Edmonton(config)# Sets the enable secret password using the enable algorithm-type scrypt algorithm, which is a stronger scrypt secret class hashing algorithm than MD5 + + + +Edmonton(config)# line Enters console line configuration mode console 0 + + + +Edmonton(config-line)# Sets the console line mode password to password cisco12345 cisco12345 +Edmonton(config-line)# login + + + +Edmonton(config-line)# + +Enables password checking at login + + + + + +Enters vty line configuration mode for all + +line vty 0 4 five vty lines + + + +Edmonton(config-line)# Sets the vty password to cisco12345 password cisco12345 + + + + +Edmonton(config-line)# login + + + +Edmonton(config-line)# + +Enables password checking at login + + + + + +Enters auxiliary line configuration mode + +line aux 0 + + + +Edmonton(config-line)# Sets the auxiliary line mode password to password backdoor backdoor + + + + +Edmonton(config-line)# login + + + +Edmonton(config-line)# + +Enables password checking at login + + + + + +Disables access to the AUX port when it is + +no exec not in use + + + + + +Caution +The enable secret password is encrypted bydefault using the MD5 cryptographic hash function. The enable password password is not; it is stored as cleartext. For this reason, recommended practice is that you never use the enable password command. Use onlythe enable secret command in a router or switch configuration. The enable secret command password takes precedence over the enable password command password. For instance, if enable secret class and enable password cisco are both configured, Cisco IOS will onlygrant privileged EXEC mode access when the enable secret password class is entered. +Tip +You can set both enable secret password and enable password password to the same password. However, doing so defeats the use of encryption. + + + + +Caution +Line passwords are stored as cleartext. Theyshould be encrypted using the service password-encryption command as a bare minimum. However, this encryption method is weak and easilyreversible. + + + + +Tip +The best place to store passwords is an external AAA(authentication, authorization, and accounting) server. + + + +Cleartext Password Encryption + + +Edmonton(config)# service Applies a Vigenère cipher (type 7) password-encryption weak encryption to passwords + + + +Edmonton(config)# no Turns off password encryption service password- +encryption + + + + + +Caution +If you have turned on service password encryption, used it, and then turned it off, anypasswords that you have encrypted will stayencrypted. New passwords will remain unencrypted. + + + + +Tip +The service password-encryption command will work on the following cleartext passwords: + + + + +Username + +Authentication key + +Console +Virtual terminal line access + +BGP neighbors + +Passwords using this encryption are shown as type 7 passwords in the router configuration: + + + + +Edmonton# show run | include secret | line con 0 | password | line vty 0 | passwor + + +no service password-encryption + + +enable secret 5 + + +Rv4kArhts7yA2xd8BD2YTVbts + + +line con 0 + + +password 7 00271A5307542A02D22842 + + +line vty 0 4 + + +password 7 00271A5307542A02D22842 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +PASSWORD ENCRYPTION ALGORITHM TYPES + +There are different algorithm types available to hash a password in Cisco IOS: + + +Type 4: Specified a SHA-256 encrypted secret string + + +Deprecated due to a software bug that allowed this password to be viewed in plaintext under certain conditions + + + +Type 5: Specifies a message digest algorithm 5 (MD5) encrypted secret +Type 8: Specifies a Password-Based Key Derivation Function 2 with SHA-256 hashed secret (PBKDF2 with SHA-256) + +Type 9: Specifies a scrypt hashed secret (SCRYPT) + + + + +Tip +MD5 is no longer considered to be secure. Therefore, it is recommended that type 8 or type 9 always be configured. + + + + +Edmonton(config)# username Either option generates demo5 secret cisco password encrypted with a +type 5 algorithm + +OR + + + +Edmonton(config)# username demo5 algorithm-type md5 secret cisco + + + +Edmonton(config)# username Generates password encrypted demo8 algorithm-type sha256 with a type 8 algorithm secret cisco + + + +Edmonton(config)# username Generates password encrypted demo9 algorithm-type scrypt with a type 9 algorithm secret cisco + + + + + +Note +Type 5, type 8, and type 9 passwords are not reversible. + + + + + +Caution +If you configure type 8 or type 9 passwords and then downgrade to a Cisco IOS Software release that does not +support type 8 and type 9 passwords, you must configure the type 5 passwords before downgrading. If not, you will be locked out of the device and a password recoveryis required. Type 8 and type 9 passwords have been supported since 15.3(3)M. + + + +Configuring SSH + +Telnet and Secure Shell (SSH) are two remote access methods to connect to a device. Although popular, Telnet is not secure because Telnet traffic is forwarded in cleartext. Therefore, its content can easily be read if intercepted. + +Secure Shell (SSH) encrypts all traffic between source and destination and is therefore the recommended remote access method. SSH should always be used if available. + + + +Caution +SSH Version 1 implementations have known securityissues. It is recommended to use SSH Version 2 whenever possible. + + + + +Note +SSH provides encryption services using private and public cryptographic keys that are created using the crypto keygenerate rsa global configuration command. However, the crypto keycommand requires that a device host name (i.e., hostname name) and a fullyqualified domain name (i.e., ip domain-name name) first be configured. SSH cannot use the default host names (e.g., Switch or Router). + + + + +Note +The Cisco implementation of SSH requires Cisco IOS Software to support Rivest, Shamir, Adleman (RSA) authentication and minimum Data Encryption Standard (DES) encryption (a cryptographic software image). + + + + + +Edmonton(co nfig)# username BabyYoda password +mandalorian + +Creates a locally significant username/password combination. These are the credentials you must enter +when connecting to the router with SSH client software +Edmonton(co nfig)# username BabyYoda +privilege + +Creates a locally significant username of BabyYoda with privilege level 15. Assigns a secret password of +mandalorian + +15 secret mandalorian + + + +Edmonton(co Creates a host domain for the router nfig)# ip +domain-name test.lab + + + + +Edmonton(co +nfig)# + +Enables the SSH server for local and remote +authentication on the router and generates an RSA key + +crypto key pair. The number of modulus bits on the command line generate is 2048 bits. The size of the key modulus is 360 to 4096 rsa modulus bits. If a crypto key already exists on the router, use the + +2048 + + + +Edmonton(co + + +crypto key zeroize rsa command to remove it + + + +Enables SSH version 2 on the device + +nfig)# ip ssh version +2 +Note + + +To work, SSH requires a local username database, a local IP domain, and an RSAkeyto be generated + + + + + +Edmonton(co Sets the maximum number of password prompts nfig)# ip provided to the user to 2. The default is 3 +ssh +authenticat ion-retries 2 + + + +Edmonton(co Sets the time interval that the router waits for the SSH nfig)# ip client to respond to 90 seconds. The default is 120 +ssh time-out 90 + + + +Edmonton(co Forces the SSH client to use the IP address of the nfig)# ip Loopback 1 interface as the source address for SSH ssh source- packets +interface loopback 1 + + + +Edmonton(co Moves to vty configuration mode for all five vty lines of nfig)# line the router +vty 0 4 + + + + +Note + + +Depending on the Cisco IOS Software release and platform, there maybe more than 5 vtylines + + + + + + +Edmonton(co +nfig-line)# + +Enables password checking on a per-user basis. +Username and password will be checked against the data + +login local entered with the username global configuration command. Ensure that a local username database has been configured before entering this command + + + +Edmonton(co Limits remote connectivity to SSH connections only +nfig-line)# +transport + +−disables Telnet. It is possible to specify other input +methods, but the most common ones are SSH and Telnet + +input ssh + + + +Verifying SSH + + +Edmonton# show ip ssh Verifies that SSH is enabled + + + +Edmonton# show ssh Checks the SSH connection to the device + + + +BOOT SYSTEM COMMANDS + + + +Router(config)# boot Loads the Cisco IOS Software with image-system flash image- name +name + + + + +Router(config)# boot +system + +Loads the Cisco IOS Software with image- +name from a TFTP server + +tftp://172.16.10.3/ima ge-name + + + +Router(config)# boot Loads the Cisco IOS Software from ROM system rom + + + +Router(config)# exit Returns to privileged EXEC mode + + + +Router# copy running- Saves the running configuration to config startup-config NVRAM. The router executes commands +in their order on the next reload +Tip +If you enter boot system flash first, that is the first place the router goes to look for the Cisco IOS Software. If you want to go to a TFTP server first, make sure that the boot system tftp command is the first command you enter. + + + + +Tip +If the configuration has no boot system commands, the router defaults to loading the first valid Cisco IOS image in flash memoryand running it. If no valid Cisco IOS image is found in flash memory, the router attempts to boot from a network TFTP server. After sixunsuccessful attempts of locating a network TFTP server, the router loads into ROMmon mode. + + + +THE CISCO IOS FILE SYSTEM + +The Cisco IOS File System (IFS) provides a single interface to all the file systems available on a routing device, including the flash memory file system; network file systems such as TFTP, remote copy protocol (rcp), and FTP; and any other endpoint for reading and writing data, such as NVRAM, or the running configuration. The Cisco IFS minimizes the required prompting for many commands. Instead of entering in an EXEC-level copy command and then having the system prompt you for more information, you can enter a single command on one line with all necessary information. + + +Cisco IOS Software IFS Commands Commands + + +copy tftp running- copy tftp: system:running-config config + + + +copy tftp startup- copy tftp: nvram:startup-config config + + + +show startup-config more nvram:startup-config +erase startup-config erase nvram: + + + +copy running-config copy system:running-config startup-config nvram:startup-config + + + +copy running-config copy system:running-config tftp tftp: + + + +show running-config more system:running-config + + + +VIEWING THE CISCO IOS FILE SYSTEM + + + + +Router# show file +systems + +Displays all the available file systems on +the device + + + + + + +Note +The Cisco IOS File System uses a URLconvention to specifyfiles on network devices and the network. Manyof the most commonlyused URLprefixes are also available in the Cisco IOS File System. + + + +COMMONLY USED URL PREFIXES FOR CISCO NETWORK DEVICES + +The URL prefix specifies the file system. The list of available file systems differs by platform and operation. Refer to your product documentation or use the show file systems command in privileged EXEC mode to determine which prefixes are available on your platform. File system prefixes are listed in Table 9-1. + +TABLE 9-1 File System Prefixes +Prefix + + + +bootflas h: + + + +flash: + + + + + +ftp: + +File System + + + +Boot Flash memory + + + + + +Flash memory. Available on all platforms. An alias for the flash: prefix is slot0 + + + +FTP and secure FTP network server + + + + +sftp: + + + +http: HTTP server + + + +https: HTTPS server + + + +null: Null destination for copies + + + + + +Note + + +You can copya remote file to null to determine its size + + + + + + +nvram: NVRAM + + + +rcp: Remote copy protocol network server + + + +scp: Secure Copy +system: + + + + + +tar: + + + +tftp: + + + +xmodem: + + + + + +ymodem: + + + + + +usbflash +0:, + +Contains system memory, including the current running configuration + + + +For creating TAR files + + + +TFTP network server + + + +Obtains the file from a network machine using the Xmodem protocol + + + +Obtains the file from a network machine using the Ymodem protocol + + + +Universal Serial Bus (USB) flash + + + + +usbflash 1:, + + + +usb0:, + + + +usb1: + + + +DECIPHERING IOS IMAGE FILENAMES + +Although it looks long and complex, there is a reason that Cisco names its IOS images the way that it does. It is important to understand the meaning behind an IOS image name so that you can correctly choose which file to work with. + +There are different parts to the image filename, as shown in the +following example and described in the table: + + +isr4300-universalk9.16.09.04.SPA.bin + + +i Indicates the platform on which the image runs. In this case, it is a s Cisco ISR 4300 series router +r 4 3 0 0 + + + +u Specifies the feature set. Universal on a 4300 would include IP Base, n Security, Unified Communication, and Data feature sets. Each router i is activated for IP Base; the others need software activation +v e +r +s Note + +a k9 in an image name means that strong encryption, such as 3DES/AES, is included l + + + +1 Identifies the version number of the software. In this case, it is major 6 release 16, minor release 9, new feature release 4 +. 0 9 . 0 4 + + + +S Indicates this software is digitally signed. There are two file extensions P possible: SPA and SSA. The first character S stands for digitally signed +A software. The second character P in SPA means that this release is meant for production. A second character S in SSA means it is a special image and has limited use or special conditions. The third character A indicates the key version used to digitally sign the image + + + +. Represents the file extension. .bin shows that this file is a binary b executable file +i n + + + + + +Note +The Cisco IOS naming conventions, meanings, content, and other details are subject to change. + + + +BACKING UP CONFIGURATIONS TO A TFTP SERVER + + + +Denver# copy running- Saves the running configuration config startup-config from DRAM to NVRAM (locally) + + + +Denver# copy running- Copies the running configuration to config tftp the remote TFTP server + + + +Address or name of remote The IP address of the TFTP server host[ ]? 192.168.119.20 + + + +Destination Filename The name to use for the file saved + +[Denver-confg]? + + + +!!!!!!!!!!!!!!! + +on the TFTP server + + + +Each bang symbol (!) = 1 datagram +of data +624 bytes copied in 7.05 secs + + +Denver# File has been transferred successfully + + + + + +Note +You can also use the preceding sequence for a copystartup-config tftp command sequence. + + + +RESTORING CONFIGURATIONS FROM A TFTP SERVER + + + + +Denver# copy tftp running- +config + +Merges the configuration file from the TFTP server with the running- +config file in DRAM + + + + +Address or name of remote The IP address of the TFTP server host[ ]? + + + +192.168.119.20 + + + +Source filename [ ]? Enter the name of the file you want Denver-confg to retrieve + + + +Destination filename Pressing the Enter key will begin +the copy process [running- config]? + + + +Accessing tftp://192.168.119.20/ +Denver-confg... + + + +Loading Denver-confg from 192.168.119.02 (via GigabitEthernet 0/0): + + + +!!!!!!!!!!!!!! + + + +[OK-624 bytes] + + + +624 bytes copied in 9.45 secs + + +Denver# File has been transferred successfully + + + + + +Note +You can also use the preceding sequence for a copytftp startup-config command sequence. + + + + + +Note +When copying a file into a configuration file, the no shutdown command does not carryover into the configuration file. You must enable the interfaces with the no shutdown command. + + + +BACKING UP THE CISCO IOS SOFTWARE TO A TFTP SERVER + + + +Denver# copy flash: tftp: Copies from flash to a remote TFTP server + + + +Source filename [ ]? Name of the Cisco IOS Software +isr4300- image universalk9.16.09.04.SPA.bin + + + +Address or name of remote Address of the TFTP server host [ ]? 192.168.119.20 + + + + +Destination filename +[isr4300- + +The destination filename is the +same as the source filename, so + +universalk9.16.09.04.SPA.bin +just press ]? + + +!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!! +!!!!!!!! + + + +8906589 bytes copied in 263.68 seconds + + + +Denver# + + + +RESTORING/UPGRADING THE CISCO IOS SOFTWARE FROM A TFTP SERVER + + + +Denver# copy tftp: flash: Copies from a remote TFTP server to flash + + + +Address or name of remote host [ ]? +192.168.119.20 + + + +Source filename [ ]? isr4300-universalk9.16.09.04.SPA.bin + + + +Destination filename [isr4300- + + +universalk9.16.09.04.SPA.bin]? + + + +Accessing tftp://192.168.119.20/ isr4300-universalk9.16.09.04.SPA.bin + + + +If flash Erase flash: before copying? [confirm] memory is + +full, erase it first + + + +Erasing the flash file system will remove all files + + +Press Ctrl-C if Continue? [confirm] you want to + +cancel + + + +Erasing device eeeeeeeeeeeeeeeeee...erased Each e represents data being erased + + + +Loading isr4300-universalk9.16.09.04.SPA.bin from +192.168.119.20 + + + +(via GigabitEthernet 0/0): Each bang + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!! + +symbol (!) = 1 datagram of +data + + + + +Verifying Check sum .................. OK + + + +[OK - 8906589 Bytes] + + + +8906589 bytes copied in 277.45 secs + + + +Denver# Success + + + +RESTORING THE CISCO IOS SOFTWARE USING THE ROM MONITOR ENVIRONMENTAL VARIABLES AND TFTPDNLD COMMAND + + + +rommon 1> Indicates the IP address for IP_ADDRESS=192.168.100.1 this unit + + + +rommon 2> Indicates the subnet mask IP_SUBNET_MASK=255.255.255.0 for this unit + + + +rommon 3> Indicates the default DEFAULT_GATEWAY=192.168.100.1 gateway for this unit + + + +rommon 4> Indicates the IP address of TFTP_SERVER=192.168.100.2 the TFTP server +rommon 5> TFTP_FILE= c2900- Indicates the filename to universalk9-mz.SPA. 152-4.M1.bin fetch from the TFTP server + + + +rommon 6> tftpdnld Starts the process + + + +...... + + + +Do you wish to continue? y/n: [n]:y + + + +...... + + + +rommon 7> i Resets the router. The i stands for initialize + + + + + +Caution +Commands and environmental variables are case sensitive, so be sure that you do not accidentallyadd spaces between variables and answers. + + + +SECURE COPY PROTOCOL (SCP) + +The Secure Copy Protocol (SCP) feature provides a secure and authenticated method for copying device configurations or device image files. SCP relies on Secure Shell (SSH). SCP allows a user with appropriate authorization to copy any file that exists in the Cisco IOS File System (IFS) to and from a device by using the copy command. + + + +Note +Before enabling SCP, you must correctlyconfigure SSH, authentication, and authorization on the device and replace Telnet with SSH on the vtyports. See the section “Configuring SSH” earlier in this chapter for the +commands needed to configure SSH. + + + + + +Note +Because SCP relies on SSH for its secure transport, the device must have a Rivest, Shamir, and Adelman (RSA) keypair. + + + +Configuring an SCP Server + + +Denver# configure Moves to global configuration mode terminal + + + + +Denver(config)# aaa new-model + + + +Denver(config)# aaa +authentication + +Sets AAA authentication at login + + + + + +Enables the AAA access control system. In +this example, authentication comes from a + +login default local local username + + + +Denver(config)# aaa Sets parameters that restrict user access to a authorization exec network. In this example, authorization default local comes from a local database + + + +Denver(config)# Creates a local username/password username superuser combination. In this example, the username privilege 15 secret is superuser, the privilege level is 15, and the superpassword MD5 password is superpassword + + + +Denver(config)# ip Enables SCP server-side functionality scp server enable + + + +Verifying and Troubleshooting SCP +Denver# show Shows the current configuration in DRAM. The IP + +running- +config + +SCP server is enabled and visible in the running +config + + + + +Denver# debug Displays output related to SCP authentication ip scp problems + + + +Configuration Example: SCP + +The following example shows the commands for using SCP to transfer a Cisco IOS image from flash to a remote host that supports SSH. + + + +Note +Your router does not need to be set up as an SCP server for this transfer to work. You onlyneed to have SSH configured. + + + + +Denver# copy flash: scp: Initiates secure copy from flash: to a remote host + + + +Source filename []? isr4300- Enter the name of the file universalk9.16.09.04.SPA.bin you want to transfer + + + +Address or name of remote host[]? The IP address of the remote host + +192.168.119.20 + + + + +Destination username [Denver]? +superuser + +The username needed for +the connection +Destination filename [isr4300- Press Enter, as the universalk9.16.09.04.SPA.bin]? filename is already +prompted + + + +Writing isr4300- Connection is being + +universalk9.16.09.04.SPA.bin + + + +Password: + + + + + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! +!!!!!! + + + +Denver# + +created and verified + + + +Enter the password when prompted + + + +Each bang symbol (!) = 1 datagram of data + + + + +File has been transferred +successfully + + + + + + +Note +As with anyuse of the copycommand, you can enter some of the specific details into the command itself: + +Click here to view code image + + +Denver# copy flash:isr4300-universalk9.16.09.04.SPA.bin scp://superuser@192.168.119.20/ + + + + +DISABLING UNNEEDED SERVICES + +Services that are not being used on a router can represent a potential security risk. If you do not need a specific service, you should disable it. + + + +Tip +If a service is off bydefault, disabling it does not appear in the running configuration. +Tip +Do not assume that a service is disabled bydefault; you should explicitlydisable all unneeded services, even if you think theyare alreadydisabled. + + + + +Tip +Depending on the Cisco IOS Software release, some services are on bydefault; some are off. Be sure to check the IOS configuration guide for your specific software release to determine the default state of the service. + + + +Table 9-2 lists the services that you should disable if you are not using them. + +TABLE 9-2 Disabling Unneeded Services + + + +Service Commands Used to Disable Service + + + +DNS name resolution Edmonton(config)# no ip domain-lookup + + + +Or + + + +Edmonton(config)# no ip domain lookup + + + +Cisco Discovery Protocol Edmonton(config)# no cdp run (CDP) (globally) + + + +CDP (on a specific interface) Edmonton(config-if)# no cdp enable + + + +Network Time Protocol (NTP) Edmonton(config-if)# ntp +disable + + + +BOOTP server Edmonton(config)# no ip bootp server + + + +DHCP Edmonton(config)# no service dhcp + + + + +Proxy Address Resolution +Protocol (ARP) + + +Edmonton(config-if)# no ip +proxy-arp + + + + +IP source routing Edmonton(config)# no ip source-route + + + +IP redirects Edmonton(config-if)# no ip redirects + + + + +HTTP service + + + + + +HTTPS service + + +Edmonton(config)# no ip http server + + + +Edmonton(config)# no ip http +secure-server + + + + +USEFUL DEVICE MANAGEMENT OPTIONS + +The following commands are useful options available when using FTP and HTTP/HTTPS for device management. + + +Perth(config)# Specifies the source IP address for FTP connections ip ftp source- +interface +loopback 1 + + + +Perth (config)# Specifies the username to be used for FTP ip ftp username connections +admin + + + +Perth (config)# Specifies the password to be used for FTP ip ftp password connections +cisco + + + +Perth (config)# Specifies the authentication method to be used for ip http login when a client connects to the HTTP server. In + +authentication +local + + +this case, the local database is used for +authentication + + + + +Perth (config)# Specifies that access list 10 should be used to allow ip http access- access to the HTTP server +class 10 + + + +Perth (config)# Sets the base HTTP path for HTML files ip http path +flash:/GUI + + + +Router(config)# Sets the maximum number of allowed concurrent ip http max- connections to the HTTP server. The default value +connections 10 is 5 +Part IV: Infrastructure Security +Chapter 10 Infrastructure Security + + + + +This chapter provides information about the following topics: + + +IPv4 access control lists (ACLs) + + +Configuring and applying standard IPv4 ACLs + +Configuring and applying extended IPv4 ACLs + +Configuring and applying time-based ACLs + +Configuring and applying vty ACLs + + + +IPv6 ACLs + + +Configuring and applying IPv6 ACLs + +Verifying IPv4 and IPv6 ACLs + + + +Implementing authentication methods + + +Simple local database authentication + +AAA-based local database authentication + +RADIUS authentication + + +Legacy configuration for RADIUS servers + +Modular configuration for RADIUS servers +TACACS+ authentication + + +Legacy configuration for TACACS+ servers + +Modular configuration for TACACS+ servers + + + +Configuring authorization and accounting + + +Authorization + +Accounting + + + +Troubleshooting AAA + + + +Control Plane Policing (CoPP) + + +Define ACLs to identify permitted CoPP traffic flows + +Define class maps for matched traffic + +Define a policy map to police matched traffic + +Assign a policy map to the control plane + +Verifying CoPP + + + +Unicast Reverse Path Forwarding (uRPF) + + +Configuring uRPF + +Verifying and troubleshooting uRPF + + + + +Caution +Your hardware platform or software release might not support all the commands documented in this chapter. Please refer to the Cisco website for specific platform and software release notes. +IPV4 ACCESS CONTROL LISTS (ACLS) + +When configuring IPv4 ACLs, many options are available. You can configure either standard (numbered or named) or extended (numbered or named) IPv4 ACLs, and you also can configure time-based or vty ACLs. These options are all explored in the following sections. + +Configuring and Applying Standard IPv4 ACLs + +It is possible to configure numbered or named standard IPv4 ACLs. Standard IPv4 ACLs, whether numbered (1 to 99 and 1300 to 1999) or named, filter packets that are based on a source address and mask, and they permit or deny the entire TCP/IP protocol suite. + + +Numbered Standard IPv4 ACL + + + +Router(config)# access- Permits traffic that matches the source list 1 permit host address 192.168.1.5 +192.168.1.5 + + + +Router(config)# access- Permits traffic that matches any source list 1 permit address that starts with 192.168.2.x 192.168.2.0 0.0.0.255 + + + +Router(config)# access- Permits traffic that matches any source list 1 permit any address + + + +Router(config)# access- Denies traffic that matches any source list 1 deny 10.0.0.0 address that starts with 10.x.x.x 0.255.255.255 + + + +Router(config)# no Removes the entire numbered ACL 1 +access-list 1 + + + + +Router(config)# Moves to interface configuration mode interface +gigabitethernet 0/0/0 + + + +Router(config-if)# ip Applies ACL 1 on the interface as an access-group 1 in inbound filter + + + +Router(config-if)# ip Applies ACL 1 on the interface as an access-group 1 out outbound filter + + + +Named Standard IPv4 ACL + + + +Router(config)# ip Creates a named standard ACL called + +access-list standard +MyFilter + +MyFilter and moves to standard named +ACL configuration mode + + + + +Router(config-std- Denies traffic that matches the source nacl)# deny host address 172.16.50.12 +172.16.50.12 + + + +Router(config-std- Permits traffic that matches any source nacl)# permit address that starts with 172.16.50.x 172.16.50.0 0.0.0.255 + + + +Router(config-std- Permits traffic that matches any source nacl)# permit any address + + + +Router(config-std- Moves to interface configuration mode +nacl)# interface gigabitethernet 0/0/0 + + + +Router(config-if)# ip Applies ACL MyFilter on the interface as access-group MyFilter an inbound filter +in + + + +Router(config-if)# ip Applies ACL MyFilter on the interface as access-group MyFilter an outbound filter +out + + + +Router(config)# no ip From global configuration mode, access-list standard removes the entire named ACL MyFilter MyFilter + + + +CONFIGURING AND APPLYING EXTENDED IPV4 ACLS It is possible to configure numbered or named extended IPv4 ACLs. Extended IPv4 ACLs, whether numbered (100 to 199, or 2000 to 2699,) or named, provide a greater range of control. In addition to verifying packet source addresses, extended ACLs also check destination addresses, protocols, and port numbers. + + +Numbered Extended IPv4 ACL + + + +Router(config)# Permits HTTP traffic that matches any source access-list 120 that starts with 192.168.1.x to any destination permit tcp +192.168.1.0 0.0.0.255 any eq www +Router(config)# Permits DNS traffic that matches any source access-list 120 address that starts with 192.168.1.x to any permit udp destination +192.168.1.0 0.0.0.255 any eq domain + + + +Router(config)# Permits all IPv4 traffic that matches any access-list 120 source address to any destination address permit ip any any + + + +Router(config)# Denies FTP traffic that matches any source access-list 120 address and is destined to address +deny tcp any host 209.165.201.1 209.165.201.1 eq +ftp + + + +Router(config)# Permits HTTPS replies from any source to any access-list 120 destination in the 10.0.0.0/24 network. The permit tcp any eq established keyword option can be used with 443 10.0.0.0 the TCP protocol only. It indicates an 0.0.0.255 established connection +established + + + +Router(config)# no Removes the entire numbered ACL 120 access-list 120 + + + +Router(config)# Moves to interface configuration mode interface +gigabitethernet 0/0/0 +Router(config-if)# Applies ACL 120 on the interface as an ip access-group 120 inbound filter +in + + + +Router(config-if)# Applies ACL 120 on the interface as an ip access-group 120 outbound filter +out + + + +Named Extended IPv4 ACL + + + + +Router(config)# ip access-list extended +MyExtFilter + +Creates a named extended ACL called MyExtFilter and moves to extended named +ACL configuration mode + + + + +Router(config-ext- Permits all IPv4 traffic that matches any nacl)# permit ip address in the 192.168.1.0/24 network to any 192.168.1.0 destination +0.0.0.255 any + + + +Router(config-ext- Permits SSH traffic that matches any source nacl)# permit tcp address to any destination +any any eq 22 + + + +Router(config-ext- Permits SNMP traffic that matches any source nacl)# permit udp address destined to 172.16.100.100 +any host 172.16.100.100 eq snmp + + + +Router(config-ext- Moves to interface configuration mode +nacl)# interface gigabitethernet 0/0/0 + + + +Router(config-if)# Applies ACL MyExtFilter on the interface as ip access-group an inbound filter +MyExtFilter in + + + +Router(config-if)# Applies ACL MyExtFilter on the interface as ip access-group an outbound filter +MyFilter out + + + +Router(config)# no From global configuration mode, removes the ip access-list entire named ACL MyExtFilter +extended MyExtFilter + + + + + +Note +You mayadd the log keyword at the end of anystandard or extended access list entry. Doing so causes an informational logging message about the packet matching the entryto be sent to the console. + + + +Configuring and Applying Time-based ACLs + +A time-based ACL permits or denies traffic based on a configurable time range. Therefore, access can be restricted selectively at different times, without any systems administrator action. Unlike most ACLs, which are always active, time-based ACLs allow the specification of periodic time ranges to enable or disable specific packet flows. + + + +Router(config)# time-range +LUNCHACCESS + +Defines a time range called +LUNCHACCESS +Router(config-time-range)# Defines a recurring period of time periodic weekdays 12:00 from 12:00 to 13:00 Monday to to 13:00 Friday (weekdays) + + + + + +Note + + +Other periodic keywords available include daily, weekends, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday + + + + + +Router(config-time-range)# Defines a recurring 48-hour period periodic Saturday 0:00 to of time from midnight Saturday to Sunday 23:59 23:59 Sunday (weekend) + + + + + +Note + + +It is also possible to use the following with the same result: periodic weekend 0:00 to 23:59 + + + + + + +Router(config-time-range)# +exit + +Exits time-range configuration +mode + + + + +Router(config)# ip access- Creates a named extended IPv4 list extended MyTimeACL access list called MyTimeACL + + + +Router(config-ext-nacl)# Permits HTTP traffic from any permit tcp any any eq 80 source to any destination according +time-range LUNCHACCESS to the predefined time ranges + + + + + +Note + + +Outside the defined time ranges, this access list entryis ignored bythe router when processing packets + + + + + + +Router(config-ext-nacl)# Denies HTTP traffic from any deny tcp any any eq 80 source to any destination + + + +Router(config-ext-nacl)# Permits all IP traffic from any permit ip any any source to any destination + + + + +Router(config-ext-nacl)# +exit + +Exits named ACL configuration +mode + + + + + +Router(config)# +gigabitethernet + + +interface +0/0/0 + +Enters interface configuration +mode + + + + +Router(config-if)# ip Applies the time-based ACL + +access-group MyTimedACL +out + +outbound on the GigabitEthernet +0/0/0 interface + + + + + + +Note +The time period is based on the router’s clock. Either manuallyset the correct time on the router or use a centralized NTP server to synchronize the router’s clock to the correct time and date. + + + +Configuring and Applying VTY ACLs +To control traffic into and out of the router (not through the router), you must protect the router virtual ports. A virtual port is called a vty. By default, the traditional virtual terminal lines are numbered vty 0 through vty 4. Note that some Cisco devices can even support up to 98 vty lines (0 to 97). The examples that follow will use the range from 0 to 4. + +Restricting vty access is primarily a technique for increasing network security and defining which addresses are allowed remote terminal access to the router EXEC process. + +Filtering Telnet or SSH traffic is typically considered an extended IP ACL function because it filters a higher-level protocol. Because you are filtering incoming or outgoing Telnet or SSH sessions by source addresses and applying the filter using the access-class command to the vty lines, you can use standard IP ACL statements to control vty access. + + +Router(config)# access- Permits any traffic with a source list 10 permit address of 172.16.100.x 172.16.100.0 0.0.0.255 + + + +Router(config)# line vty Enters vty line configuration mode 0 4 + + + +Router(config-line)# Applies the standard ACL number 10 access-class 10 in to traffic entering (in) any of the five +vty lines + + + + + +Note + + +Notice that identical restrictions have been set +on everyvtyline (0 to 4) because you cannot control on which vtyline a user will connect + + + + + + + + +Note + + +The implicit denyanystatement still applies to the ACLwhen it is used as an access class entry + + + + + + +IPV6 ACLS + +In contrast to IPv4 ACLs, all IPv6 ACLs are named and extended. Some commands are slightly different, but all the basic concepts remain the same. Note that instead of a wildcard mask, IPv6 access list entries use the prefix length. Also, the implicit deny ipv6 any any at the end of the ACL has changed to permit critical ICMPv6 Neighbor Discovery (ND) messages. IPv6 ACLs can filter packets based on source and destination address, as well as port and protocol information. Also note that you can use IPv6 ACLs for time-based or vty ACL filtering. + +Configuring and Applying IPv6 ACLs + + +Router(config)# ipv6 Creates an IPv6 ACL called v6Filter and access-list v6Filter enters IPv6 ACL configuration mode + + + +Router(config-ipv6- Permits HTTP traffic to return to the acl)# permit tcp any 2001:db8:10:1::/64 network from any +eq www source if that traffic was originally sourced 2001:db8:10:1::/64 from the 2001:db8:10:1::/64 network established +Router(config-ipv6- Permits HTTPS traffic to return to the acl)# permit tcp any 2001:db8:10:1::/64 network from any +eq 443 source if that traffic was originally sourced + +2001:db8:10:1::/64 established + + + +Router(config-ipv6- + +from the 2001:db8:10:1::/64 network + + + + + +Permits DNS responses from any source to + +acl)# permit udp any any destination eq domain any + + + +Router(config-ipv6- Permits ICMP ping responses from any acl)# permit icmp any source to any destination +any +echo-reply + + + +Router(config-ipv6- Inserts a new ACL entry at line 5 that acl)# sequence 5 deny denies all IPv6 traffic from device ipv6 host 2001:db8:10:1::100 to any destination 2001:db8:10:1::100 +any + + + +Router(config-ipv6- Returns to global configuration mode acl)# exit + + + + +Router(config)# interface +gigabitethernet 0/0/0 + +Enters GigabitEthernet 0/0/0 interface +configuration mode + + + + +Router(config-if)# Applies the IPv6 access list named v6Filter ipv6 traffic-filter to the interface in the inbound direction v6Filter in +Router(config)# no From global configuration mode, removes ipv6 access-list the entire named ACL v6Filter +v6Filter + + + + + +Note +The implicit denyipv6 anyanyrule has changed for IPv6 access lists to consider the importance of the Neighbor Discoveryprotocol. ND is to IPv6 what Address Resolution Protocol (ARP) is to IPv4, so naturallythe protocol should not be disrupted. That is the reason two additional implicit statements have been added before the implicit denyipv6 anyanystatement at the end of each IPv6 ACL. + + + +These three new implicit rules are as follows: + + +permit icmp any any nd-na permit icmp any any nd-ns deny ipv6 any any + + +It is important to understand that any explicit deny ipv6 any any statement overrides all three implicit statements, which can lead to problems because ND traffic is blocked. + +Verifying IPv4 and IPv6 ACLs + + +Router# show ip Displays any IPv4 ACL applied inbound interface interface- or outbound to an interface +type interface-number + + + +Router# show ipv6 Displays any IPv6 ACL applied inbound interface interface- or outbound to an interface +type interface-number + + + + +Router# show access- +lists + +Displays the contents of all ACLs on the router, including any matches and +sequence numbers +Router# show ip access- +lists + +Displays the contents of all IPv4 ACLs on the router, including any matches +and sequence numbers + + + + +Router# show ipv6 Displays the contents of all IPv6 ACLs access-lists on the router, including any matches +and sequence numbers + + + +Router# show access- Displays the contents of ACL 1 only lists 1 + + + + + +Tip +Sequence numbers are used to allow for easier editing of your ACLs. Each entryin an ACLis automatically given a number, unless you specifyone during configuration. Numbers start at 10 and increment by10 for each line. This allows for simple editing of ACLs. You can add or remove an entrybyreferencing its line number. This applies to standard (numbered or named) and extended (numbered or named) IPv4 ACLs, as well as to IPv6 ACLs. + + + +IMPLEMENTING AUTHENTICATION METHODS + +Authentication, authorization, and accounting (AAA) is a standards-based framework that you can implement to control who is permitted to access a network (authenticate), what they can do while they are there (authorize), and audit what actions they performed while accessing the network (accounting). AAA can be deployed in two models: local database authentication and sever-based authentication. Server-based authentication utilizes either RADIUS or TACACS+ protocols and offers a more scalable approach to network authentication. + +Simple Local Database Authentication + + +Router(config)# Creates an entry in the local database with a +username ADMIN message digest 5 (MD5) authentication secret cisco123 encrypted password + + + +Router(config)# Enters line console configuration mode line console 0 + + + +Router(config- Enables username and password checking line)# login local from the local database when a user attempts +to log into the router + + + + + +Note +The preceding example demonstrates the use of a locallydefined username database without enabling AAA. + + + +AAA-based Local Database Authentication + + +Router(config)# Creates an entry in the local database with a username ADMIN privilege level of 15 and a message digest 5 (MD5) privilege 15 authentication encrypted password +secret cisco123 + + + +Router(config)# Enables AAA access control mode aaa new-model + + + + +Router(config)# aaa authentication +login + +Defines the default authentication method list to authenticate to the case-sensitive local database first. If there are no entries, it should use the +enable password second + +default local-case enable + + + +Router(config)# Defines the authentication method list VTY-Lines +aaa +authentication + + +to authenticate to the local database first. If there +are no entries, it should use the line configured + +login VTY-Lines password local line + + + +Router(config)# Enters the vty line configuration mode line vty 0 4 + + + +Router(config- Specifies the AAA service to use the +line)# login authentication method list VTY-Lines when a + +authentication VTY-Lines + + + +Router(config- + +user logs in via the vty lines + + + + + +Returns to global configuration mode + +line)# exit + + + +Router(config)# Enters Console 0 configuration mode line console 0 + + + +Router(config- Specifies the AAA service to use the default line)# login method list when a user logs in via the console. + +authentication +default + +This command is optional because the default list +would automatically apply to the line + + + + + + +Note +Amethod list describes the sequence and authentication methods to be queried to authenticate a user. The software uses the first method listed to authenticate users; if that method fails to respond, the software selects the next authentication method in the method list. This process continues until there is successful communication with a listed authentication method or until all defined methods are exhausted. If authentication fails at anypoint in this cycle, the authentication process stops, and no other authentication methods are attempted. + + + +RADIUS Authentication +RADIUS is a fully open standard protocol (RFCs 2865 and 2866). According to the RFCs, RADIUS uses UDP port 1812 for the authentication and authorization, and port 1813 for accounting. However, Cisco implementations default to UDP ports 1645 and 1646 (authentication and accounting, respectively). + +Legacy Configuration for RADIUS Servers + +The traditional approach to configure a RADIUS server on a Cisco IOS device would be with the radius-server global configuration command. + + +Router(config)# Creates user with username admin and username admin encrypted password cisco +secret cisco + + + +Router(config)# Enables AAA access control mode aaa new-model + + + +Router(config)# Specifies a RADIUS server at 192.168.55.12 + +radius-server host +192.168.55.12 + + +with S3CR3TKEY as the authentication key +using UDP port 1812 for authentication + + + +auth-port 1812 +acct-port + + +requests and UDP port 1813 for accounting +requests + +1813 key S3CR3TKEY + + + +Router(config)# Sets login authentication for the default aaa authentication method list to authenticate to the RADIUS +login default server first, locally defined users second, and group radius local use the line password as the last resort +line + + + +Router(config)# Specifies the authentication method list +aaa authentication NO_AUTH to require no authentication login +NO_AUTH none + + + +Router(config)# Moves to vty line configuration mode line vty 0 4 + + + +Router(config- Specifies the AAA service to use the default line)# login method list when a user logs in via vty authentication +default + + + +Router(config- Specifies a vty line password on lines 0 line)# password through 4 +S3cr3Tw0Rd + + + +Router(config- Moves to console 0 configuration mode line)# line +console 0 + + + +Router(config- Specifies the AAA service to use the +line)# login authentication method list NO_AUTH when a authentication user logs in via the console port +NO_AUTH + + + + +Note + + +If authentication is not specificallyset for a line, the default is to denyaccess and no authentication is performed + + + + + + +Modular Configuration for RADIUS Servers +The legacy configuration method outlined in the previous section will soon be deprecated. The new approach brings modularity and consistency when configuring RADIUS in both IPv4 and IPv6 environments. The new method is configured in three steps: (1) set the RADIUS server parameters, (2) define the RADIUS server group, and (3) define the AAA commands that use RADIUS. + + +Router(config)# Enables AAA access control mode aaa new-model + + + +Router(config)# Specifies the name RADSRV for the RADIUS + +radius server +RADSRV + + +server configuration and enters RADIUS server +configuration mode + + + + + +Router(config- +radius-server)# + +Configures the IPv4 address for the RADIUS +server, as well as the accounting and + +address ipv4 authentication parameters 192.168.100.100 +auth-port 1812 acct-port 1813 + + + + +Router(config- +radius-server)# + +Defines the shared secret key configured on the +RADIUS server. Depending on the Cisco IOS + +key C1sc0 software release, this command might trigger a warning message: + + + +WARNING: Command has been added to the configuration using a type 0 password. However, type 0 passwords will soon be deprecated. Migrate to a supported password type. +See the Note following this table for an explanation + + + +Router(config- Returns to global configuration mode radius-server)# +exit + + + +Router(config)# ip Forces RADIUS to use the IP address of a radius source- specified interface for all outgoing RADIUS + +interface gigabitethernet 0/0/0 + + + +Router(config)# + +packets + + + + + + + +Defines a RADIUS server group called + +aaa group server RADSRVGRP radius RADSRVGRP + + + +Router(config-sg- Adds the RADIUS server RADSRV to the radius)# server RADSRVGRP group +name RADSRV + + + +Router(config-sg- Returns to global configuration mode radius)# exit + + + +Router(config)# Configures login authentication using a method aaa authentication list called RAD_LIST, which uses RADSRVGRP + +login RAD_LIST group RADSRVGRP +local + + +as the primary authentication option and local +user database as a backup + + + + +Router(config)# Moves to vty line configuration mode +line vty 0 4 + + + + +Router(config)# authentication +RAD_LIST + +Applies the RAD_LIST method list to the vty +lines + + + + + + +Note +The warning message produced bythe router appears after you enter a cleartext RADIUS or TACACS server key. This message says that at some point in the future Cisco IOS will no longer store plaintext passwords in either the running-config or startup-config. Instead, it will store onlyhashed passwords (MD5/SHA/scrypt) and securelyencrypted passwords (AES). This requires either that the password is alreadyhashed/encrypted at the time you enter it at the CLI or that the router is configured with strong password encryption so that after you enter the password in plaintext, IOS is immediatelyable to encrypt and store it in the configuration in the encrypted form. Although IOS will still accept plaintext passwords entered at the CLI, it will not store them as plaintext in the configuration. To enable strong password encryption using AES, you need to enter two commands. The first, keyconfig-keypassword-encryption [master key], allows you to configure a master keythat will be used to encrypt all other keys in the router configuration. The master keyis not stored in the router configuration and cannot be seen or obtained in anywaywhile connected to the router. The second command, password encryption aes, triggers the actual password encryption process. + + + +For more on this security feature, see “Encrypt Pre-shared Keys in Cisco IOS Router Configuration Example” at https://www.cisco.com/c/en/us/support/docs/security-vpn/ipsec-negotiation-ike-protocols/46420-pre-sh-keys-ios-rtr-cfg.html. + +TACACS+ Authentication + +TACACS+ is a Cisco proprietary protocol that is not compatible with the older versions such as TACACS or XTACACS, which are now deprecated. TACACS+ allows for greater modularity, by total separation of all three AAA functions. TACACS+ uses TCP port 49, and thus reliability is ensured by the transport protocol itself. Entire TACACS+ packets are encrypted, so communication between Network Access Server (NAS) and the TACACS+ server is completely secure. + +Legacy Configuration for TACACS+ Servers +The traditional approach to configure a TACACS+ server on a Cisco IOS device would be with the tacacs-server global configuration command. + + +Router(config)# Creates user with username admin and username admin encrypted password cisco +secret cisco + + + +Router(config)# Enables AAA access control mode aaa new-model + + + + +Router(config)# +tacacs- + +Specifies a TACACS+ server at 192.168.55.13 with +an encryption key of C1sc0. The single- + +server host connection keyword maintains a single open + +192.168.55.13 +single- + + +TCP connection between the switch and the +server + +connection key C1sc0 + + + + +Router(config)# aaa +authentication + +Sets login authentication for the TACSRV method list to authenticate to the TACACS+ +server first, and the locally defined username and + +login TACSRV password second group tacacs+ +local + + + +Router(config)# Moves to console 0 configuration mode line console 0 + + + +Router(config- Specifies the AAA service to use the TACSRV line)# login authentication method list when users connect authentication to the console port +TACSRV + + + +Modular Configuration for TACACS+ Servers + +Similar to the RADIUS modular configuration shown in the previous section, it is possible to use a modular approach when configuring TACACS+. The same three steps apply (define TACACS+ server parameters, define TACACS+ server group, and define AAA commands). + + +Router(config)# Enables AAA access control mode aaa new-model + + + +Router(config)# Specifies the name TACSRV for the TACACS+ + +tacacs server +TACSRV + + +server configuration and enters TACACS+ +server configuration mode + + + + + +Router(config- +server-tacacs)# + +Configures the IPv4 address for the TACACS+ +server + +address ipv4 192.168.100.200 + + + + +Router(config- +server-tacacs)# + +Defines the shared secret key that is configured +on the TACACS+ server + +key C1sc0 + + + + +Router(config-server-tacacs)# single-connection + + + +Router(config- +server-tacacs)# + +Enables all TACACS+ packets to be sent to the same server using a single TCP connection + + + + +Returns to global configuration mode +exit + + + +Router(config)# Defines a TACACS+ server group called aaa group server TACSRVGRP +tacacs+ TACSRVGRP + + + +Router(config-sg- Adds the TACACS+ server TACSRV to the tacacs+)# server TACSRVGRP group +name TACSRV + + + +Router(config-sg- Returns to global configuration mode tacacs+)# exit + + + + +Router(config)# aaa +authentication + +Configures login authentication using a method list called TAC_LIST, which uses TACSRVGRP +as the primary authentication option and the + +login TAC_LIST local user database as a backup group TACSRVGRP +local + + + +Router(config)# Moves to vty line configuration mode line vty 0 4 + + + +Router(config- Applies the TAC_LIST method list to the vty line)# login lines +authentication TAC_LIST + + + +Configuring Authorization and Accounting + +After AAA has been enabled on a Cisco IOS device and AAA authentication has been configured, you can optionally configure +AAA authorization and AAA accounting. + + +Authorization + +Configuring authorization is a two-step process. First define a method list, and then apply it to a corresponding interface or line. + + +Router(config)# aaa Defines the default EXEC authorization authorization exec method list, which uses the RADIUS default group radius servers first, the TACACS+ servers second, group tacacs+ local and the local user database as backup + + + +Router(config-line)# Moves to vty line configuration mode line vty 0 4 + + + +Router(config-if)# Applies the default authorization list to the authorization exec vty lines +default + + + +Accounting + +Configuring accounting is also a two-step process. First define a method list, and then apply it to a corresponding interface or line. + + +Router(config)# Defines the default EXEC accounting method list aaa accounting to send to the RADIUS server, a start accounting exec default notice at the beginning of the requested event, + +start-stop group +radius + + +and a stop accounting notice at the end of the +event + + + + +Router(config)# Moves to vty line configuration mode line vty 0 4 +Router(config- Applies the default accounting list to the vty lines line)# +accounting exec default + + + +Troubleshooting AAA + + +Router# debug aaa Enables debugging of the AAA authentication authentication process + + + +Router# debug aaa Enables debugging of the AAA authorization authorization process + + + +Router# debug aaa Enables debugging of the AAA accounting accounting process + + + +CONTROL PLANE POLICING (COPP) + +To prevent a Cisco device from denial of service (DoS) attacks to the control plane, Cisco IOS employs Control Plane Policing (CoPP). CoPP increases security on the device by protecting the system from unnecessary or DoS traffic and gives priority to important control-plane and management traffic. CoPP uses a dedicated control-plane configuration through Cisco Modular QoS CLI (MQC) to provide filtering and rate-limiting capabilities for control-plane packets. Configuring CoPP is a four-step process: + +1. Define ACLs to identify permitted CoPP traffic flows + +2. Define class maps for matched traffic + +3. Define a policy map to police matched traffic +4. Assign a policy map to the control plane + +In the CoPP configuration example that follows, routing protocols (OSPF, EIGRP, BGP), management traffic (Telnet, SSH, SNMP), and ICMP traffic destined to the router’s control plane are policed. + +Step 1: Define ACLs to Identify Permitted CoPP Traffic Flows + + +Router(config)# ip access-list Creates an extended ACL extended copp-routing-acl called copp-routing-acl + + + +Router(config-ext-nacl)# permit Permits OSPF traffic for ospf any host 224.0.0.5 CoPP inspection + + + +Router(config-ext-nacl)# permit Permits OSPF traffic for ospf any host 224.0.0.6 CoPP inspection + + + +Router(config-ext-nacl)# permit Permits EIGRP traffic for eigrp any host 224.0.0.10 CoPP inspection + + + +Router(config-ext-nacl)# permit Permits BGP traffic for CoPP tcp any any eq bgp inspection + + + +Router(config-ext-nacl)# permit Permits BGP traffic for CoPP tcp any eq bgp any inspection + + + +Router(config-ext-nacl)# exit Exits named ACL configuration mode + + + +Router(config)# ip access-list Creates an extended ACL extended copp-management-acl called copp-management-acl +Router(config-ext-nacl)# permit Permits Telnet traffic for tcp any any eq telnet CoPP inspection + + + +Router(config-ext-nacl)# permit Permits SSH traffic for CoPP tcp any any eq 22 inspection + + + +Router(config-ext-nacl)# permit Permits SNMP traffic for udp any any eq snmp CoPP inspection + + + +Router(config-ext-nacl)# exit Exits named ACL configuration mode + + + +Router(config)# ip access-list Creates an extended ACL extended copp-icmp-acl called copp-icmp-acl + + + +Router(config-ext-nacl)# permit Permits ICMP echo request icmp any any echo traffic for CoPP inspection + + + +Router(config-ext-nacl)# permit Permits ICMP echo reply icmp any any echo-reply traffic for CoPP inspection + + + +Step 2: Define Class Maps for Matched Traffic + + +Router(config)# class-map Creates a class map called copp-match-all copp-routing-map routing-map + + + +Router(config-cmap)# match Assigns the CoPP routing ACL to access-group name copp- the CoPP routing class map routing-acl +Router(config-cmap)# class- Creates a class map called copp-map match-all copp- management-map management-map + + + +Router(config-cmap)# match Assigns the CoPP management access-group name copp- ACL to the CoPP management management-acl class map + + + +Router(config-cmap)# class- Creates a class map called copp-map match-all copp-icmp-map icmp-map + + + +Router(config-cmap)# match Assigns the CoPP ICMP ACL to access-group name copp-icmp- the CoPP ICMP class map +acl + + + +Step 3: Define a Policy Map to Police Matched Traffic + + + +Router(config)# policy-map +copp-policy + +Creates a CoPP policy called copp- +policy + + + + + +Router(config-pmap)# class +copp-routing-map + +Assigns the CoPP routing class map +to the policy map + + + + +Router(config-pmap-c)# Polices up to 1 Mbps any routing police 1000000 conform- protocol traffic sent to the control + +action transmit exceed- +action drop + + +plane. Packets exceeding 1 Mbps are +dropped + + + + +Router(config-pmap-c- Assigns the CoPP management class police)# class copp- map to the policy map +management-map +Router(config-pmap-c)# Polices up to 100 Kbps any police 100000 conform- management traffic sent to the + +action transmit exceed- +action drop + + +control plane. Packets exceeding 100 +Kbps are dropped + + + + +Router(config-pmap-c- Assigns the CoPP ICMP class map to police)# class copp-icmp- the policy map +map + + + +Router(config-pmap-c)# Polices up to 50 Kbps any ICMP police 50000 conform- traffic sent to the control plane. + +action transmit exceed- +action drop + + +Packets exceeding 50 Kbps are +dropped + + + + +Router(config-pmap-c- Assigns the CoPP default class map police)# class class- to the policy map +default + + + +Router(config-pmap-c)# Polices up to 8 Kbps any ICMP police 8000 conform-action traffic sent to the control plane. + +transmit exceed-action +drop + + +Packets exceeding 8 Kbps are +dropped + + + + + + +Note +When more than one class of traffic is defined within a policymap, the order of classes is important, as traffic is compared against successive classes, top-down, until a match is recorded. Once a packet has matched a class, no further comparisons are made. If no match is found after processing all classes, packets automaticallymatch the always-defined class, class-default. The class class-default is special in MQC because it is always automaticallyplaced at the end of everypolicymap. Match criteria cannot be configured for class-default because it automaticallyincludes an implied match for all packets. Onlya traffic policycan be configured for class-default. + + + +Step 4: Assign a Policy Map to the Control Plane +Router(config)# control-plane + + + +Router(config- + +Enters control-plane configuration mode + + + + + +Assigns the CoPP policy map to the input + +cp)# service- interface of the router’s control plane policy input +copp-policy + + + +Verifying CoPP + + + +Router# show access-lists + + + +Router# show class-map + + + +Router# show policy-map + + + +Router# show policy-map control- +plane + +Displays all configured ACLs + + + + + + + + + +Displays all configured class maps + + + + + + + +Displays all configured policy maps + + + + + + + +Displays the dynamic information about the actual policy applied, including rate information and the number of bytes (and packets) that conformed to or exceeded the +configured policies + + + + +UNICAST REVERSE PATH FORWARDING (URPF) +Network administrators can deploy Unicast Reverse Path Forwarding (uRPF) as an antispoofing mechanism to help limit malicious traffic on an enterprise network. This security feature works by enabling a router to verify the reachability of the source address in packets being forwarded. This capability can limit the appearance of spoofed addresses on a network. If the source IP address is not valid, the packet is discarded. uRPF works in one of two modes: strict mode or loose mode. When administrators use uRPF in strict mode, the packet must be received on the interface that the router would use to forward the return packet. When administrators use uRPF in loose mode, the source address must appear in the routing table. + +Configuring uRPF + + + +Router(config)# +gigabitethernet + + +interface +0/0/0 + +Moves to interface configuration +mode + + + + +Router(config-if)# ip verify Enables uRPF strict mode unicast source reachable-via +rx + + + +Router(config-if)# ip verify Enables uRPF loose mode unicast source reachable-via +any + + + +Router(config-if)# ip verify Enables uRPF strict mode with unicast source reachable-via ACL applied to bypass the drop rx 120 function + + + +Router(config-if)# ip verify Enables uRPF strict mode with unicast source reachable-via permission to use a default route +rx allow-default for the uRPF check + + + + + +Note + + +It is possible to add the allow-self-ping option, but this is not recommended by Cisco. It could lead to a DoS condition on the router + + + + + + +Verifying and Troubleshooting uRPF + + +Router# debug ip cef Displays information about dropped drops rpf packets caused by uRPF + + + + +Router# show ip traffic + + + +Router# show cef + +Displays information about uRPF drops + + + + + +Shows if uRPF is configured on an + +interface interface +Part V: Network Assurance +Chapter 11 + +Network Assurance + + + + + +This chapter provides information and commands concerning the following topics: + + +Internet Control Message Protocol redirect messages + + + +The ping command + +Examples of using the ping and the extended ping commands + +The traceroute command + +The debug command + +Conditionally triggered debugs + +Configuring secure SNMP + + +Securing SNMPv1 or SNMPv2 + +Securing SNMPv3 + +Verifying SNMP + + + +Implementing logging + + +Configuring syslog + +Syslog message format + +Syslog severity levels + +Syslog message example +Configuring NetFlow + +Configuring Flexible NetFlow + +Verifying NetFlow + +Implementing port mirroring + + +Default SPAN and RSPAN configuration + +Configuring local SPAN + +Local SPAN guidelines for configuration + +Configuration example: Local SPAN + +Configuring remote SPAN + +Remote SPAN guidelines for configuration + +Configuration example: Remote SPAN + +Configuring Encapsulated RSPAN (ERSPAN) + +Verifying and troubleshooting local and remote SPAN + + + +Configuring Network Time Protocol + + +NTP configuration + +NTP design + +Securing NTP + +Verifying and troubleshooting NTP + +Setting the clock on a router + +Using time stamps + +Configuration example: NTP + + + +Tool Command Language (Tcl) +Embedded Event Manager (EEM) + + +EEM configuration examples + +EEM and Tcl scripts + +Verifying EEM + + + +INTERNET CONTROL MESSAGE PROTOCOL REDIRECT MESSAGES + +Internet Control Message Protocol (ICMP) is used to communicate to the original source the errors encountered while routing packets and to exercise control on the traffic. Routers use ICMP redirect messages to notify the hosts on the data link that a better route is available for a particular destination. + + + +Router(config-if)# no ip +redirects + +Disables ICMP redirects from this +specific interface + + + + + +Router(config-if)# ip +redirects + +Reenables ICMP redirects from this +specific interface + + + + +THE PING COMMAND + + + + +Router# ping w.x.y.z + + + +Router# ping + +Checks for Layer 3 connectivity with the device at IPv4 address w.x.y.z + + + +Checks for Layer 3 connectivity with the device + + + +aaaa:aaaa: +aaaa:aaaa:aaaa:aaa + +at IPv6 address +aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa + +a: aaaa:aaaa +Router# ping Checks for Layer 3 connectivity with the device 172.16.20.1 source at IPv4 address 172.16.20.1 with the packets loopback 1 originating from source interface loopback 1 + + + + +Router# ping +2001::1 source + +Checks for Layer 3 connectivity with the device +at IPv6 address 2001::1 with the packets + +loopback 1 originating from source interface loopback 1 + + + +Router# ping Enters extended ping mode, which provides more options + + +Table 11-1 describes the possible ping output characters. + + +TABLE 11-1 ping Output Characters + + + +Chara Description cter + + + +! Each exclamation point indicates receipt of a reply + + + +. Each period indicates that the network server timed out while waiting for a reply + + + +? Unknown error + + + +@ Unreachable for unknown reason + + + +A Administratively unreachable. Usually means that an access control list (ACL) is blocking traffic + + + +B Packet too big +H Host unreachable + + + +N Network unreachable (beyond scope) + + + +P Port unreachable + + + +R Parameter problem + + + +T Time exceeded + + + +U No route to host + + + +EXAMPLES OF USING THE PING AND THE EXTENDED PING COMMANDS + + + + +Router# ping + + + + + +Router# ping + + +172.16.20.1 + + + + + +paris + +Performs a basic Layer 3 test to IPv4 address 172.16.20.1 + + + +Same as above but through the IP +host name + + + + +Router# ping Checks for Layer 3 connectivity with 2001:db8:d1a5:c900::2 the device at IPv6 address +2001:db8:d1a5:c900::2 + + + +Router# ping Enters extended ping mode; can now change parameters of ping test +Protocol [ip]: + +Press to use ping for IP + + + +Target IP address: Enter the target IP address 172.16.20.1 + + + +Repeat count [5]: 100 Enter the number of echo requests you want to send. The default is 5 + + + +Datagram size [100]: Enter the size of datagrams being sent. The default is 100 + + + + +Timeout in seconds [2]: Enter the timeout delay between sending echo requests + + + + + +Extended commands [n]: +yes + +Allows you to configure extended +commands + + + + +Source address or Allows you to explicitly set where the interface: 10.0.10.1 pings are originating from. An +interface name may also be used here + + + +Type of Service [0] Allows you to set the TOS field in the IP header + + + +Set DF bit in IP header Allows you to set the DF bit in the IP [no] header +Validate reply data? [no] Allows you to set whether you want validation + + + + +Data Pattern [0xABCD] Allows you to change the data pattern in the data field of the ICMP echo request packet + + + +Loose, Strict, Record, Offers IP header options. This prompt Timestamp, Verbose[none]: offers more than one of the following +options to be selected: + + + +Verbose is automatically selected along with any other option + + + +Record is a very useful option because it displays the address(es) of the hops (up to nine) the packet goes through + + + +Loose allows you to influence the path by specifying the address(es) of the hop(s) you want the packet to go through + + + +Strict is used to specify the hop(s) that you want the packet to go through, but no other hop(s) are allowed to be visited + + + +Timestamp is used to measure +roundtrip time to particular hosts + + + + +Sweep range of sizes +[no]: + +Allows you to vary the sizes of the +echo packets that are sent + + + + + +Type escape sequence to abort +Sending 100, 100-byte ICMP Echos to 172.16.20.1, timeout is 2 seconds: Packet sent with a source address of 10.0.10.1 + + + + + + +!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!! +Success rate is 100 percent (100/100) round-trip min/ avg/max = 1/1/4 ms + + + + + + + +Tip +If you want to interrupt the ping operation, use the Ctrl-Shift-6 keystroke combination. This ends the operation and returns you to the prompt. + + + +THE TRACEROUTE COMMAND + +The traceroute command (or tracert in Microsoft Windows) is a utility that allows observation of the path between two hosts. + + +Router# traceroute Discovers the route taken to travel to the +172.16.20.1 IPv4 destination of 172.16.20.1 + + + + +Router# paris + + + +Router# + + +traceroute + + + + + +traceroute + +Shows command with IP host name rather than IP address + + + +Discovers the route taken to travel to the + +2001:db8:d1a5:c900:: IPv6 destination of 2001:db8:d1a5:c900::2 2 + + + +Router# trace Shows common shortcut spelling of the 172.16.20.1 traceroute command + + + + + +Note +In Microsoft Windows operating systems, the command to allow observation between two hosts is tracert: + +Click here to view code image + + +C:\Windows\system32>tracert 172.16.20.1 C:\Windows\system32>tracert 2001:db8:c:18:2::1 + + + + +THE DEBUG COMMAND + +The output from debug privileged EXEC commands provides diagnostic information that includes a variety of internetworking events related to protocol status and network activity in general. + + + +Caution +Using the debug command mayseverelyaffect router performance and might even cause the router to reboot. Always exercise caution when using the debug command, and do not leave it on. Use debug long enough to gather needed information, and then disable debugging with the undebug all or no debug all command. + + + + +Tip +Send your debug output to a syslog server to ensure that you have a copyof it in case your router is overloaded and needs to reboot. Use the no logging console command to turn off logging to the console if you have +configured a syslog server to receive debug output. + + + + +Router Turns on all possible debugging # +debug +all +Caution + + +This is just an example. Do not use this command in a production network + + + + + + +Router Turns off all possible debugging # u +all + + + +(short form of undebu g all) + + + +Router Lists what debug commands are on # show +debug + + + +Router Turns on IPv4 packet debugging that matches the criteria # defined in ACL 10 +debug ip +packet +10 Note + +The debug ip packet command helps you to better understand the IP packet forwarding process, but this command onlyproduces information on packets that are process-switched bythe router. Packets generated bya router or destined for a router are process- +switched and are therefore displayed with the debug ip packet command + + + + + + +Router Displays debug output through a Telnet/SSH (a vty line +# connection) session (default is to only send output on the termin console screen) +al monito r + + + +CONDITIONALLY TRIGGERED DEBUGS + +When the Conditionally Triggered Debugging feature is enabled, the router generates debugging messages for packets entering or leaving the router on a specified interface; the router does not generate debugging output for packets entering or leaving through a different interface. + +Use the debug condition command to restrict the debug output for some commands. + +If any debug condition commands are enabled, output is generated only for interfaces associated with the specified keyword. In addition, this command enables debugging output for conditional debugging events. Messages are displayed as different interfaces meet specific conditions. + +If multiple debug condition commands are enabled, output is displayed if at least one condition matches. All the conditions do not need to match. The no form of this command removes the debug condition specified by the condition identifier. + +The condition identifier is displayed after you use a debug +condition command or in the output of the show debug condition command. If the last condition is removed, debugging output resumes for all interfaces. You will be asked for confirmation before removing the last condition or all conditions. + +Not all debugging output is affected by the debug condition command. Some commands generate output whenever they are enabled, regardless of whether they meet any conditions. + + +Router# debug condition interface Filters output on the basis interface-type interface number of the specified interface + + + + +Router# debug + + + + + +Router# debug address + + + +Router# debug + + + + + +Router# debug + + +condition + + + + + +condition + + + + + +condition + + + + + +condition + + +ip + + + + + +mac- + + + + + +username + + + + + +vlan + +Filters output on the basis of the specified IP address + + + +Filters messages on the specified MAC address + + + +Filters output on the basis of the specified username + + + +Filters output on the basis +of the specified VLAN ID + + + + +Router# show debug condition Displays which conditional debugs are enabled + + + +CONFIGURING SECURE SNMP + +Simple Network Management Protocol (SNMP) is the most commonly used network management protocol. It is important to +restrict SNMP access to the routers on which it is enabled. + + + +Tip +If SNMP is not required on a router, you should turn it off byusing the no snmp-server global configuration command: +Click here to view code image + + +Edmonton(config)# no snmp-server + + + + + + +Note +Beginning with SNMPv3, methods to ensure the secure transmission of data between manager and agent were added. You can now define a securitypolicyper group, or limit IP addresses to which its members can belong. You now have to define encryption and hashing algorithms and passwords for each user. + + + +Table 11-2 shows the different SNMP security models. + + +TABLE 11-2 SNMP Security Models + + + + +SNMP Version + + + +SNMPv1 + + + + + +SNMPv2c + + + + + +SNMPv3 + +Access Mode + + + +noAuthNoPri v + + + +noAuthNoPri v + + + +noAuthNoPri +v + +Authentication + + + + + +Community string + + + +Community string + + + +Username + +Encryption + + + + + +No + + + + + +No + + + + + +No + + +MD5 or SHA-1 No authNoPriv + +MD5 or SHA-1 DES, 3DES, or +authPriv AES + + + + + +Tip +The SNMP securitylevels are as follows: + + + + +noAuthNoPriv: Authenticates SNMP messages using a community string. No encryption provided. + +authNoPriv: Authenticates SNMP messages using either HMAC with MD5 or SHA-1. No encryption provided. + +authPriv: Authenticates SNMP messages by using either HMAC-MD5 or SHA. Encrypts SNMP messages using DES, 3DES, or AES. + + + +priv: Does not authenticate SNMP messages. Encrypts only using either DES or AES. + + + + +Tip +SNMPv3 provides all three securitylevel options. It should be used wherever possible. + + + + + +Tip +If SNMPv3 cannot be used, then use SNMPv2c and secure it using uncommon, complexcommunitystrings and byenabling read-onlyaccess. + + + + +Tip +If communitystrings are also used for SNMP traps, theymust be different from communitystrings for get and set methods. This is considered best practice. + + + +Securing SNMPv1 or SNMPv2c + + +Edmonton(con Sets a community string named C0mpl3xAdmin. It is fig)# snmp- read-only and refers to ACL 98 to limit SNMP access +server to the authorized hosts community +C0mpl3xAdmin +ro 98 +Note + + +Anamed ACLcan be used as well + + + + + + + +Edmonton(con fig)# +access-list + +Creates an ACL that will limit the SNMP access to the +specific host of 192.168.10.3 + +98 permit host 192.168.10.3 + + + +Edmonton(con Sets the Network Management System (NMS) IP fig)# snmp- address of 192.168.10.3 and the community string of server host AdminC0mpl3x, which will be used to protect the + +192.168.10.3 +AdminC0mpl3x + +sending of the SNMP traps. The community string is +also used to connect to the host + + + + +Securing SNMPv3 + + +Edmonton(config)# Creates an ACL that will be used to limit access-list 99 SNMP access to the local device from SNMP permit 10.1.1.0 managers within the 10.1.1.0/24 subnet 0.0.0.255 + + + +Edmonton(config)# Defines an SNMP view named MGMT to snmp-server view include an OID name of sysUpTime MGMT sysUpTime +included +Edmonton(config)# Defines an SNMP view named MGMT to snmp-server view include an OID name of ifDescr +MGMT ifDescr included + + + +Edmonton(config)# Defines an SNMP view named MGMT and an snmp-server view OID name of ifAdminStatus. This OID is MGMT ifAdminStatus included in the view +included + + + +Edmonton(config)# Defines an SNMP view named MGMT and an snmp-server view OID name of ifOperStatus. This OID is +MGMT ifOperStatus included in the view included + + + +Edmonton(config)# Defines an SNMPv3 group called groupAAA snmp-server group and configures it with the authPriv security groupAAA v3 priv level. SNMP read and write access to the read MGMT write MGMT view is limited to devices defined in MGMT access 99 ACL 99 + + + +Edmonton(config)# Configures a new user called userAAA to the snmp-server user SNMPv3 group groupAAA with +userAAA groupAAA v3 authentication and encryption. + +auth sha +priv aes + +itsa5ecret +256 + + +Authentication uses SHA with a password of +itsa5ecret. Encryption uses AES-256 with a + + + +another5ecret + + + +Edmonton(config)# + + +password of another5ecret + + + +Enables SNMP traps + +snmp-server enable traps +Edmonton(config)# Defines a receiving manager for traps at IP snmp-server host address 10.1.1.50. The user userAAA is used 10.1.1.50 traps to authenticate the host. The traps sent version 3 priv relate to CPU and port security events userAAA cpu port- +security + + + +Edmonton(config)# Prevents index shuffle snmp-server ifindex +persist + + +Note + + +SNMP does not identifyobject instances bynames but by numeric indexes. Indexnumber maychange due to instance changes, such as a new interface being configured. This command will guarantee indexpersistence when changes occur + + + + + + +Verifying SNMP + + + +Edmonton# show snmp + + + + + +Edmonton# show snmp view + + + +Edmonton# show snmp group + + + +Edmonton# show snmp +user + +Provides basic information about SNMP configuration + + + +Provides information about SNMP views + + + + + +Provides information about configured SNMP groups + + + +Provides information about configured +SNMP users +IMPLEMENTING LOGGING + +It is important for network administrators to implement logging to get insight into what is occurring in their network. When a router reloads, all local logs are lost, so it is important to implement logging to an external destination. The following sections deal with the different mechanisms that you can use to configure logging to a remote location. + +Configuring Syslog + + +Edmonton(config) Enables logging to all supported destinations # logging on + + + +Edmonton(config) Sends logging messages to a syslog server host at # logging address 192.168.10.53 +192.168.10.53 + + + +Edmonton(config) Sends logging messages to a syslog server host # logging named sysadmin +sysadmin + + + +Edmonton(config) Sets the syslog server logging level to value x, # logging trap x where x is a number between 0 and 7 or a word +defining the level. Table 11-3 provides more details + + + +Edmonton(config) Stamps syslog messages with a sequence number # service +sequence-numbers + + + +Edmonton(config) Causes a time stamp to be included in syslog +# service messages timestamps log +datetime + + + +Syslog Message Format + +The general format of syslog messages generated on Cisco IOS Software is as follows: + +Click here to view code image + + +seq no:timestamp: %facility-severity-MNEMONIC:description + + + +Item in Definition Syslog +Message + + + +seq no Sequence number. Stamped only if the service sequence-numbers global configuration command is configured + + + + +timestam p + + + + +facility + + + + + +severity + + + + + +MNEMONIC + + + +descript + +Date and time of the message. Appears only if the service timestamps log datetime global configuration command is configured + + + +The facility to which the message refers (SNMP, SYS, and so on) + + + +Single-digit code from 0 to 7 that defines the severity of the message. See Table 11-3 for descriptions of the levels + + + +String of text that uniquely defines the message + + + +String of text that contains detailed information about the +ion event being reported + + + + +Syslog Severity Levels + +Table 11-3 outlines the eight levels of severity in logging messages. + + +TABLE 11-3 Syslog Severity Levels + + + + +Level # Level Name + + + +0 Emergencies + + + +1 Alerts + + + +2 Critical + + + +3 Errors + + + +4 Warnings + + + +5 Notifications + + + +6 Informational + + + +7 Debugging + +Description + + + +System is unusable + + + +Immediate action needed + + + +Critical conditions + + + +Error conditions + + + +Warning conditions + + + +Normal but significant conditions + + + +Informational messages (default level) + + + +Debugging messages + + + + +Setting a level means you will get that level and everything numerically below it; for example, setting level 6 means you will receive messages for levels 0 through 6. +Syslog Message Example + +The easiest syslog message to use as an example is the one that shows up every time you exit from global configuration mode back to privileged EXEC mode. You have just finished entering a command and you want to save your work, but after you type exit you see something like this (your output will differ depending on whether you have sequence numbers and/or time/date stamps configured): + +Click here to view code image + + +Edmonton(config)# exit Edmonton# +*Oct 23:22:45:20.878: %SYS-5-CONFIG_I: Configured from console by console +Edmonton# + + +So, what does this all mean? + + +No sequence number is part of this message + + + +The message occurred on October 23, at 22:45:20.878 (or 10:45 PM, and 20.878 seconds) + +It is a SYS message, and it is level 5 (a notification) + +It is a CONFIG message, and the configuration occurred from the console + + +CONFIGURING NETFLOW + +NetFlow is an application for collecting IP traffic information. It is used for network accounting and security auditing. + + + +Caution +NetFlow consumes additional memory. If you have limited memory, you might want to preset the size of the NetFlow cache to contain a smaller amount of entries. The default cache size depends on the platform of the +device. + + + + + +Edmonton(config)# interface +gigabitethernet 0/0/0 + + + +Edmonton(config- + +Moves to interface configuration mode + + + + + + + + + +Enables NetFlow on the interface. Captures + +if)# ip flow traffic that is being received by the interface ingress + + + +Edmonton(config- Enables NetFlow on the interface. Captures if)# ip flow traffic that is being transmitted by the interface egress + + + +Edmonton(config- Returns to global configuration mode if)# exit + + + +Edmonton(config)# Defines the IP address of the workstation to ip flow-export which you want to send the NetFlow + +destination ip_address udp_port + + + +Edmonton(config)# + +information as well as the UDP port on which the workstation is listening for the information + + + + + +Specifies the version format that the export + +ip flow-export packets used version x + + + + + +Note +NetFlow exports data in UDP in one of five formats: 1, 5, 7, 8, 9. Version 9 is the most versatile, but is not backward compatible with versions 5 or 8. The default is version 1. Version 5 is the most commonlyused +format, but version 9 is the latest format and has some advantages for keytechnologies such as security, traffic analysis, and multicast. + + + +CONFIGURING FLEXIBLE NETFLOW + +Flexible NetFlow improves on original NetFlow by adding the capability to customize the traffic analysis parameters for your specific requirements. Flexible NetFlow facilitates the creation of more complex configurations for traffic analysis and data export through the use of reusable configuration components. Flexible NetFlow is an extension of NetFlow v9. + +Configuring Flexible NetFlow is a four-step process: + + +Step 1. Configure a flow record. + +Step 2. Configure a flow exporter. + +Step 3. Configure a flow monitor. + +Step 4. Apply the flow monitor to an interface. + + +Step 1: Configure a Flow Record + + + +R1(config)# flow record R1- +FLOW-RECORD + +Creates a new flow record called +R1-FLOW-RECORD + + + + +R1(config-flow-record)# match Includes the source IPv4 ipv4 source address address to the flow record + + + +R1(config-flow-record)# match Includes the destination IPv4 ipv4 destination address address to the flow record + + + +R1(config-flow-record)# Includes statistics on the collect counter bytes number of bytes in the flow +record + + + +Step 2: Configure a Flow Exporter + + +R1(config)# flow exporter R1- Creates a flow exporter called + +FLOW-EXPORTER + + + +R1(config-flow-exporter)# + +R1-FLOW-EXPORTER + + + +Specifies the IP address of the + +destination 10.250.250.25 NetFlow collector + + + +Step 3: Configure a Flow Monitor + + +R1(config)# flow monitor R1- Creates a flow monitor called + +FLOW-MONITOR + + + +R1(config-flow-monitor)# + +R1-FLOW-MONITOR + + + +Assigns the flow exporter to + +exporter R1-FLOW-EXPORTER the flow monitor + + + +R1(config-flow-monitor)# Assigns the flow record to the record R1-FLOW-RECORD flow monitor + + + +Step 4: Apply the Flow Monitor to an Interface + + +R1(config)# interface Enters interface configuration gigabitethernet 0/0/0 mode + + + +R1(config-if)# ip flow Applies the flow monitor to the monitor R1-FLOW-MONITOR interface in the input direction input +VERIFYING NETFLOW + + + + +Edmonton# show ip +interface + +Displays information about the interface, +including NetFlow as being either ingress + +gigabitethernet or egress enabled 0/0/0 + + + +Edmonton# show ip Verifies status and statistics for NetFlow flow export accounting data export + + + +Edmonton# show ip Displays a summary of NetFlow statistics cache flow on a Cisco IOS router + + + + +Edmonton# show flow monitor + + + +Edmonton# show flow exporter + + + +Edmonton# show flow +record + +Displays a summary of the Flexible NetFlow configuration + + + +Displays information about the Flexible NetFlow exporter configuration + + + +Displays information about the configured +Flexible NetFlow records + + + + + + +Note +The show ip cache flow command is useful for seeing which protocols use the highest volume of traffic and between which hosts this traffic flows. + + + +IMPLEMENTING PORT MIRRORING + +Using a traffic sniffer can be a valuable tool to monitor and troubleshoot a network. In the modern era of switches, using the Switched Port Analyzer (SPAN) feature enables you to instruct a +switch to send copies of packets seen on one port to another port on the same switch. + +Default SPAN and RSPAN Configuration + +Table 11-4 shows the default SPAN and remote SPAN (RSPAN) settings. + +TABLE 11-4 SPAN and RSPAN Default Settings + + + +Feature + + +SPAN state (SPAN and RSPAN) + + + +Source port traffic to monitor + + + +Encapsulation type (destination port) + + + +Ingress forwarding (destination port) + + + +VLAN filtering + + + + + +RSPAN VLANs + +Default Setting + + +Disabled + + + + + +Both received and sent traffic (both SPAN and RSPAN) + + + +Native form (untagged packets) + + + + + +Disabled + + + + + +On a trunk interface used as a source port, all VLANs are monitored + + + +None configured + + + + +Configuring Local SPAN + +Local SPAN supports a SPAN session entirely within one switch; all source ports or source VLANs and destination ports are in the same +switch or switch stack. Local SPAN copies traffic from one or more source ports in any VLAN or from one or more VLANs to a destination port for analysis. + +Local SPAN Guidelines for Configuration + +When configuring SPAN, follow these guidelines: + + +For SPAN sources, you can monitor traffic for a single port or VLAN or a series or range of ports or VLANs for each session. You cannot mix source ports and source VLANs within a single SPAN session. + + + +The destination port cannot be a source port; a source port cannot be a destination port. + +You cannot have two SPAN sessions using the same destination port. + +When you configure a switch port as a SPAN destination port, it is no longer a normal switch port; only monitored traffic passes through the SPAN destination port. + +Entering SPAN configuration commands does not remove previously configured SPAN parameters. You must enter the no monitor session {session_number | all | local | remote} global configuration command to delete configured SPAN parameters. + +For local SPAN, outgoing packets through the SPAN destination port carry the original encapsulation headers (untagged or IEEE 802.1Q) if the encapsulation replicate keywords are specified. If the keywords are not specified, the packets are sent in native form. For RSPAN destination ports, outgoing packets are not tagged. + +You can configure a disabled port to be a source or destination port, but the SPAN function does not start until the destination port and at least one source port or source VLAN are enabled. + +You can limit SPAN traffic to specific VLANs by using the filter vlan keywords. If a trunk port is being monitored, only traffic on the +VLANs specified with these keywords are monitored. By default, all VLANs are monitored on a trunk port. + +You cannot mix source VLANs and filter VLANs within a single SPAN session. + + +Configuration Example: Local SPAN + +Figure 11-1 is the network topology for local SPAN commands. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 11-1 Local SPAN + + + + +Switch(config)# no monitor Removes any existing SPAN session 1 configuration on session 1. The +session number is a number between 1 and 66 + + + +Switch(config)# no monitor Removes all SPAN sessions session all +Switch(config)# no monitor Removes all local SPAN sessions session local + + + +Switch(config)# no monitor Removes all remote SPAN sessions session remote + + + +Switch(config)# monitor Sets a new SPAN session where the session 1 source interface source of the traffic will be + +gigabitethernet + + + +Switch(config)# + + +0/1 + + + +monitor + +interface GigabitEthernet 0/1 + + + +Configures session 2 to monitor + +session 2 source received traffic on interface gigabitethernet 0/2 rx GigabitEthernet 0/2 + + + +Switch(config)# monitor Options for this command include session session_number the following: +source {interface + + +interface-id | vlan vlan-id} [, | -] [both | rx | +tx] + + +session_number: Any number +between 1 and 66 + + + +interface-id: Specifies the source port to monitor. Can be any valid physical interface or port channel logical interface + + + +vlan-id: Specifies the source VLAN to monitor. The range is 1 to 4094 + + + +, | - (optional): To be used to help specify a series or ranges of +interfaces. There must be a space both before and after the comma or hyphen + + + +both (optional): Monitors both received and sent traffic. This is the default setting + + + +rx (optional): Monitors received traffic + + + +tx (optional): Monitors sent traffic + + + + + +Note + + +Asingle session can include multiple sources (ports or VLANs), defined in a series of commands, but you cannot combine source ports and source VLANs in one session + + + + + + + + +Note + + +You can use the monitor session session_number source command multiple times to configure multiple source ports + + + + + +Switch(config)# monitor Limits the SPAN source traffic to session 1 filter vlan 6 - VLANs 6 to 10 +10 +Switch(config)# monitor Options for this command include session session_number the following: +filter vlan vlan-id [, | -] + +session_number: Must match the session number used in the monitor session source command + + + +vlan-id: Specifies the source VLAN to monitor. The range is 1 to 4094 + + + +, | - (optional): To be used to help specify a series or ranges of interfaces. There must be a space both before and after the comma or hyphen + + + + +Switch(config)# monitor Sets a new SPAN session where the session 1 destination destination for the traffic will be interface gigabitethernet interface GigabitEthernet 0/24. 0/24 encapsulation The encapsulation method will be replicate retained + + + +Switch(config)# monitor Monitored traffic from session 2 session 2 destination will be sent to interface interface gigabitethernet GigabitEthernet 0/24. It will have 0/24 encapsulation the same egress encapsulation type +as the source port, and will enable + + +replicate ingress dot1q +vlan 6 + +ingress forwarding with IEEE 802.1Q encapsulation and VLAN 6 +as the default ingress VLAN +Switch(config)# monitor Options for this command include session session_number the following: +destination {interface + + +interface-id [, | -] [encapsulation {dot1q | +replicate}]} [ingress + + +session_number: Enter the session number used in the source +command earlier in this example. + +{dot1q vlan vlan-id | For local SPAN, you must use the + +untaggedvlan vlan-id | vlan + +vlan-id}]} + + +same session number for the +source and destination interfaces + + + + +interface-id: Specifies the destination port. This must be a physical port; it cannot be an EtherChannel, and it cannot be a VLAN + + + +, | - (optional): To be used to help specify a series or ranges of interfaces. There must be a space both before and after the comma or hyphen + + + +encapsulation dot1q: Specifies that the destination interface use the IEEE 802.1Q encapsulation method + + + +encapsulation replicate: Specifies that the destination interface replicate the source interface encapsulation method +Note + + +If no encapsulation method is selected, the default is to send packets in native form (untagged) + + + + + + +ingress dot1q vlan vlan-id: Accept incoming packets with IEEE 802.1Q encapsulation with the specified VLAN as the default VLAN + + + +ingress untagged vlan vlan-id: Accept incoming packets with untagged encapsulation with the specified VLAN as the default VLAN + + + +ingress vlan vlan-id: Accept incoming packets with untagged encapsulation with the specified VLAN as the default VLAN + + + + + +Note + + +You can use the monitor session session_number destination command multiple times to configure multiple destination ports +Configuring Remote SPAN + +While local SPAN supports source and destination ports only on one switch, a remote SPAN supports source and destination ports on different switches. RSPAN consists of an RSPAN VLAN, an RSPAN source session, and an RSPAN destination session. You separately configure RSPAN source sessions and destination sessions on different switches. + +Remote SPAN Guidelines for Configuration + +When configuring RSPAN, follow these guidelines: + + +All the items in the local SPAN guidelines for configuration apply to RSPAN. + + + +Because RSPAN VLANs have special properties, you should reserve a few VLANs across your network for use as RSPAN VLANs; do not assign access ports to these VLANs. + +You can apply an output access control list (ACL) to RSPAN traffic to selectively filter or monitor specific packets. Specify this ACL on the RSPAN VLAN in the RSPAN source switches. + +For RSPAN configuration, you can distribute the source ports and the destination ports across multiple switches in your network. + +RSPAN does not support bridge protocol data unit (BPDU) packet monitoring or other Layer 2 switch protocols. + +The RSPAN VLAN is configured only on trunk ports and not on access ports. To avoid unwanted traffic in RSPAN VLANs, make sure that the VLAN Remote SPAN feature is supported in all the participating switches. + +Access ports (including voice VLAN ports) on the RSPAN VLAN are put in the inactive state. +RSPAN VLANs are included as sources for port-based RSPAN sessions when source trunk ports have active RSPAN VLANs. RSPAN VLANs can also be sources in SPAN sessions. However, because the switch does not monitor spanned traffic, it does not support egress spanning of packets on any RSPAN VLAN identified as the destination of an RSPAN source session on the switch. + +You can configure any VLAN as an RSPAN VLAN as long as these conditions are met: + + +The same RSPAN VLAN is used for an RSPAN session in all the switches. + +All participating switches support RSPAN. + + + +Configure an RSPAN VLAN before you configure an RSPAN source or a destination session. + +If you enable VTP and VTP pruning, RSPAN traffic is pruned in the trunks to prevent the unwanted flooding of RSPAN traffic across the network for VLAN IDs that are lower than 1005. + + +Configuration Example: Remote SPAN + +Figure 11-2 is the network topology for remote SPAN commands. + + + + + + + + + + + + + + + + + + + + + + + +Figure 11-2 Remote SPAN + + + + +Switch1(config)# vlan 901 Creates VLAN 901 on Switch1 + + + + +Switch1(config-vlan)# remote span + + + +Switch1(config-vlan)# end + +Makes this VLAN an RSPAN VLAN + + + +Returns to global configuration +mode + + + + +Switch2(config)# vlan 901 Creates VLAN 901 on Switch2 + + + + +Switch2(config-vlan)# remote span + + + +Switch2(config-vlan)# end + +Makes this VLAN an RSPAN VLAN + + + +Returns to global configuration +mode +Note +You must create the RSPAN VLAN in all switches that will participate in RSPAN. + + + + + +Note +If the RSPAN VLAN ID is in the normal range (lower than 1005) and VTP is enabled in the network, you can create the RSPAN VLAN in one switch, and VTP propagates it to the other switches in the VTP domain. For extended-range VLANs (greater than 1005), you must configure the RSPAN VLAN on both source and destination switches and anyintermediate switches. + + + + +Tip +Use VTP pruning to get an efficient flow of RSPAN traffic, or manuallydelete the RSPAN VLAN from all trunks that do not need to carrythe RSPAN traffic. + + + + +Switch1(config)# no monitor Removes any previous session 1 configurations for session 1 + + + +Switch1(config)# monitor Configures session 1 to monitor session 1 source interface transmitted traffic on interface gigabitethernet 0/1 tx GigabitEthernet 0/1 + + + +Switch1(config)# monitor Configures session 1 to monitor session 1 source interface received traffic on interface gigabitethernet 0/2 rx GigabitEthernet 0/2 + + + +Switch1(config)# monitor Configures session 1 to have a session 1 destination remote destination of RSPAN VLAN vlan 901 901 + + + +Switch2(config)# no monitor Removes any previous session 1 configurations for session 1 +Switch2(config)# monitor Configures session 1 to have a session 1 source remote vlan source of VLAN 901 +901 + + + +Switch2(config)# monitor Configures session 1 to have a session 1 destination destination interface of interface gigabitethernet GigabitEthernet 0/24 +0/24 + + + + + +Note +The commands to configure incoming traffic on a destination port and to filter VLAN traffic are the same for remote SPAN as theyare for local SPAN. + + + +Configuring Encapsulated RSPAN (ERSPAN) + +The Cisco ERSPAN feature allows you to monitor traffic on one or more ports or one or more VLANs, and send the monitored traffic to one or more destination ports. ERSPAN sends traffic to a network analyzer such as a Switch Probe device or other Remote Monitoring (RMON) probe. ERSPAN supports source ports, source VLANs, and destination ports on different routers, which provides remote monitoring of multiple routers across a network. The traffic is encapsulated in Generic Routing Encapsulation (GRE) and is, therefore, routable across a Layer 3 network between the “source” switch and the “destination” switch. ERSPAN consists of an ERSPAN source session, routable ERSPAN GRE encapsulated traffic, and an ERSPAN destination session. + + + +Note +ERSPAN is a Cisco proprietaryfeature and is available onlyto Catalyst 6500, 7600, 9200, 9300, Nexus, and ASR 1000 platforms to date. The ASR 1000 supports ERSPAN source (monitoring) onlyon FastEthernet, GigabitEthernet, and port-channel interfaces. +ERSPAN Source Configuration + + +Router-1(config)# monitor Creates an ERSPAN source session session 1 type erspan- +source + + + +Router-1(config-mon-erspan- Assigns the GigabitEthernet 0/0/1 src)# source interface interface as the source interface gigabitethernet 0/0/1 for the ERSPAN session + + + +Router-1(config-mon-erspan- Enters ERSPAN destination src)# destination configuration mode + + + +Router-1(config-mon-erspan- Assigns an ERSPAN ID of 1 src-dst)# erspan-id 1 + + + +Router-1(config-mon-erspan- Defines the ERSPAN destination src-dst)# ip address IP address +2.2.2.2 + + + +Router-1(config-mon-erspan- Defines the ERSPAN source IP src-dst)# origin ip address address +1.1.1.1 + + + +ERSPAN Destination Configuration + + +Router-2(config)# monitor Creates an ERSPAN destination session 1 type erspan- session +destination +Router-2(config-mon-erspan- Assigns the GigabitEthernet 0/0/1 dst)# destination interface interface as the destination gigabitethernet 0/0/1 interface for the ERSPAN session + + + +Router-2(config-mon-erspan- Enters ERSPAN source dst)# source configuration mode + + + +Router-2(config-mon-erspan- Assigns an ERSPAN ID of 1 dst-src)# erspan-id 1 + + + +Router-2(config-mon-erspan- Defines the ERSPAN source IP dst-src)# ip address address +2.2.2.2 + + + +Verifying and Troubleshooting Local and Remote SPAN + + +Switch# show monitor Displays output for SPAN session 1 session 1 + + + +Note + + +On some platforms the command is show monitor + + + + + + +Switch# show Displays configuration of sessions running running-config in active memory + + + +Switch# show vlan Displays information about VLANs remote-span configured as RSPAN VLANs + + + +Switch# debug Displays all SPAN debugging messages +monitor + + + +Switch# monitor + + + +Switch# +monitor + +all + + + +debug list + + + +debug +requests + + + + + +Displays SPAN port and VLAN list tracing + + + + + +Displays SPAN requests + + + + +CONFIGURING NETWORK TIME PROTOCOL + +Most networks today are being designed with high performance and reliability in mind. Delivery of content is, in many cases, guaranteed by service level agreements (SLAs). Having your network display an accurate time is vital to ensuring that you have the best information possible when reading logging messages or troubleshooting issues. + +NTP Configuration + + +Edmonton(config Configures the Edmonton router to synchronize its )# ntp server clock to a public NTP server at address 209.165.200.254 209.165.200.254 + + + + + +Note + + +This command makes the Edmonton router an NTP client to the external NTP server + + + + + + + + +Note +ACisco IOS router can be both a client to an external NTP server and an NTP server to client devices inside its own internal network + + + + + + + + +Note + + +When NTP is enabled on a Cisco IOS router, it is enabled on all interfaces + + + + + + + + +Caution + + +NTP is slow to converge. It can take up to 5 minutes before an NTP client synchronizes with an NTP server + + + + + +Edmonton(config Specifies a preferred NTP server if multiple servers )# ntp server are configured +209.165.200.234 prefer + +Tip + + +It is recommended to configure more than one NTP server + + + + + + +Edmonton(config Disables the NTP server function on a specific -if)# ntp interface. The interface will still act as an NTP disable client + + + + + +Tip +Use this command on interfaces connected to external networks + + + + + + +Edmonton(config Configures the router to be an NTP master clock to )# ntp master which peers synchronize when no external NTP stratum source is available. The stratum is an optional +number between 1 and 15. When enabled, the default stratum is 8 + + + + + +Note + + +Areference clock (for example, an atomic clock) is said to be a +stratum-0 device. Astratum-1 server is directlyconnected to a stratum-0 device. Astratum-2 server is connected across a network path to a stratum-1 server. The larger the stratum number (moving toward 15), the less authoritative that server is and the less accuracyit will have + + + + + +Edmonton(config Configures the maximum number of NTP peer-)# ntp max- and-client associations that the router will serve. + +associations 200 + + + +Edmonton(config + +The range is 0 to 4 294 967 295. The default is 100 + + + + + +Creates an access list statement that will allow NTP + +)# access list communication for the NTP server at address + +101 permit udp + +any host + +a.b.c.d. This ACL should be placed in an inbound +direction + + +a.b.c.d eq ntp + + + + + +Note +When a local device is configured with the ntp master command, it can be identified bya syntacticallycorrect but invalid IP address. This address will be in the form of 127.127.x.x. The master will synchronize with itself and uses the 127.127.x.x address to identifyitself. This address will be displayed with the show ntp +associations command and must be permitted via an access list if you are authenticating your NTP servers. + + + +NTP Design + +You have two different options in NTP design: flat and hierarchical. In a flat design, all routers are peers to each other. Each router is both a client and a server with every other router. In a hierarchical model, there is a preferred order of routers that are servers and others that act as clients. You use the ntp peer command to determine the hierarchy. Figure 11-3 is a topology showing a hierarchical design. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 11-3 NTP Hierarchical Design + + + + +Tip +Do not use the flat model in a large network, because with manyNTP servers it can take a long time to synchronize the time. +Edmonton(confi Configures the source interface for all NTP packets g)# ntp +source-interface loopback 0 + + + +Edmonton(confi Configures an IOS device to synchronize its software g)# ntp peer clock to a peer at 172.16.21.1 +172.16.21.1 + + + +Edmonton(confi Configures an IOS device to synchronize its software g)# ntp peer clock to a peer at 172.16.21.1 using version 2 of NTP. 172.16.21.1 There are three versions of NTP (versions 2–4) version 2 + + + +Edmonton(confi Configures the options for broadcasting or +g-if)# ntp multicasting NTP traffic on a specified interface. You + +broadcast + + + + + +Edmonton(confi + +can include the authentication key and version options with this command + + + +Configures a device to receive NTP broadcast or + +g-if)# ntp multicast messages on a specified interface. You can + +broadcast +client + +include the authentication key and version options +with this command + + + + + + +Note +Although Cisco IOS recognizes three versions of NTP, versions 3 and 4 are most commonlyused. Version 4 introduces support for IPv6 and is backward compatible with version 3. NTPv4 also adds DNS support for IPv6. + + + + +Note +NTPv4 has increased securitysupport using public keycryptographyand X.509 certificates. +Note +NTPv3 uses broadcast messages. NTPv4 uses multicast messages. + + + + +Edmonton(config)# Configures an IOS device to synchronize its ntp peer software clock to a peer at 172.16.21.1. The 172.16.21.1 source source IP address is the address of interface loopback 0 Loopback 0 + + + + + +Tip + + +Choose a loopback interface as your source for NTP, because it will never go down. ACLstatements will also be easier to write as you will require onlyone line to allow or denytraffic + + + + + +Edmonton(config)# Makes this peer the preferred peer that ntp peer provides synchronization 172.16.21.1 source +loopback 0 prefer + + + +Securing NTP + +You can secure NTP operation using authentication and access lists. + +Enabling NTP Authentication + + +NTPServer(config) Defines an NTP authentication key # ntp + +authentication-key 1 md5 +NTPpa55word + + +1 = number of authentication key. Can be a +number between 1 and 4 294 967 295 +md5 = using MD5 hash. This is the only option available on Cisco devices + + + +NTPpa55word = password associated with this key + + + +NTPServer(config) Defines which keys are valid for NTP + +# ntp trusted-key +1 + +authentication. The key number here must match the key number you defined in the ntp +authentication-key command + + + + +NTPServer(config) Enables NTP authentication # ntp +authenticate + + + +NTPClient(config) Defines an NTP authentication key # ntp +authentication-key 1 md5 NTPpa55word + + + +NTPClient(config) Defines the NTP server that requires +# ntp server authentication at address 192.168.200.1 and 192.168.200.1 key identifies the peer key number as key 1 +1 + + + +NTPClient(config) Defines which keys are valid for NTP + +# ntp trusted-key +1 + +authentication. The key number here must match the key number you defined in the ntp +authentication-key command +NTPClient(config) Enables NTP authentication # ntp +authenticate + + + + + + +Note +You can configure the device to authenticate the time sources to which the local clock is synchronized. When you enable NTP authentication, the device synchronizes to a time source onlyif the source carries one of the authentication keys specified bythe ntp trusted-keycommand. The device drops anypackets that fail the authentication check and prevents them from updating the local clock. NTP authentication is disabled by default. + + + +You can also control access to NTP services by using access lists. Specifically, you can decide the types of requests that the device allows and the servers from which it accepts responses. If you do not configure any ACLs, NTP access is granted to all devices. If you configure ACLs, NTP access is granted only to the remote device whose source IP address passes the access list criteria. + + + +Note +Once a device is synchronized to an NTP source, it becomes an NTP server to anydevice that requests synchronization. + + + +Limiting NTP Access with Access Lists + + + +Edmonton(con fig)# +access-list + +Defines an access list that permits only packets with a +source address of 10.1.x.x + +1 permit 10.1.0.0 0.0.255.255 + + + +Edmonton(con Creates an access group to control NTP access and fig)# ntp applies access list 1. The peer keyword enables the +access-group device to receive time requests and NTP control queries peer 1 and to synchronize itself to servers specified in the +access list + + + +Edmonton(con Creates an access group to control NTP access and fig)# ntp applies access list 1. The serve keyword enables the access-group device to receive time requests and NTP control queries serve 1 from the servers specified in the access list but not to +synchronize itself to the specified servers + + + +Edmonton(con Creates an access group to control NTP access and fig)# ntp applies access list 1. The serve-only keyword enables access-group the device to receive only time requests from servers serve-only 1 specified in the access list + + + +Edmonton(con Creates an access group to control NTP access and fig)# ntp applies access list 1. The query-only keyword enables access-group the device to receive only NTP control queries from the query-only 1 servers specified in the access list + + + + + +Note +NTP access group options are scanned from least restrictive to most restrictive in the following order: peer, serve, serve-only, query-only. However, if NTP matches a denyACLrule in a configured peer, ACLprocessing stops and does not continue to the next access group option. + + + +Verifying and Troubleshooting NTP + + +Edmonton# show Displays the status of NTP associations ntp +associations + + + +Edmonton# show Displays detailed information about each NTP +ntp association associations +detail + + + +Edmonton# show Displays the status of the NTP configuration. This ntp status command shows whether the router’s clock has +synchronized with the external NTP server + + + +Edmonton# Checks to see whether NTP packets are received and debug ip sent +packets + + + +Edmonton# Limits debug output to ACL 1 debug ip +packet 1 + + + +Edmonton# Displays debug output for NTP clock adjustments debug ntp +adjust + + + +Edmonton# Displays all NTP debugging output debug ntp all + + + +Edmonton# Displays all NTP debugging events debug ntp +events + + + +Edmonton# Displays NTP packet debugging; lets you see the time debug ntp that the peer/server gives you in a received packet packet +Edmonton# Displays detailed NTP packet dump debug ntp +packet detail + + + +Edmonton# Displays debugging from NTP peer at address a.b.c.d debug ntp +packet peer a.b.c.d + + + +Setting the Clock on a Router + + + +Note +It is important to have your routers displaythe correct time for use with time stamps and other logging features. + + + + +If the system is synchronized by a valid outside timing mechanism, such as an NTP server, or if you have a router with a hardware clock, you do not need to set the software clock. Use the software clock if no other time sources are available. + + +Edmonton# calendar set Manually sets the system hardware + +16:30:00 23 October +2019 + +clock. Time is set using military (24-hour) format. The hardware clock runs continuously, even if the router is +powered off or rebooted + + + + +Edmonton# show calendar Displays the hardware calendar + + + + +Edmonton(config)# clock +calendar-valid + +Configures the system as an authoritative time source for a network +based on its hardware clock +Note + + +Because the hardware clock is not as accurate as other time sources (it runs off of a battery), you should use this onlywhen a more accurate time source (such as NTP) is not available + + + + + + +Edmonton# calendar + + + +Edmonton# + + +clock read- + + + + + +clock set + +Manually reads the hardware clock settings into the software clock + + + +Manually sets the system software + + + +16:30:00 23 October +2019 + +clock. Time is set using military (24- +hour) format + + + + +Edmonton(config)# clock Configures the system to automatically summer-time zone switch to summer time (daylight saving recurring [week day time) +month hh:mm week day month hh:mm [offset]] + +Note + +Edmonton(config)# clock Summer time is disabled bydefault summer-time zone date + +date month + +date month + +year hh:mm + +year hh:mm + + + +[offset] + + + +Edmonton(config)# clock + +Arguments for the command are as +follows: + +summer-time zone date zone: Name of the time zone (see + +month date + +month date + + +year hh:mm + +year hh:mm + +Tables 11-5 and 11-6 for alternative +ways to specify the time zone) + + +[offset] +recurring: Indicates that summer time should start and end on the corresponding specified days every year + + + +date: Indicates that summer time should start on the first specific date listed in the command and end on the second specific date in the command + + + +week: (Optional) Week of the month (1 to 4 or last) + + + +day: (Optional) Day of the week (Sunday, Monday, and so on) + + + +date: Date of the month (1 to 31) + + + +month: (Optional) Month (January, February, and so on) + + + +year: Year (1993 to 2035) + + + +hh:mm: (Optional) Time (military format) in hours and minutes + + + +offset: (Optional) Number of minutes to add during summer time (default is 60) + + + +Edmonton(config)# clock Configures the time zone for display +timezone zone hours- purposes. To set the time to +offset [minutes-offset] Coordinated Universal Time (UTC), use the no form of this command + + + +zone: Name of the time zone to be displayed when standard time is in effect + + + +hours-offset: Hours difference from UTC + + + +minutes-offset: (Optional) Minutes difference from UTC + + + +Edmonton(config)# clock Configures the time zone to Pacific timezone PST -8 Standard Time, which is 8 hours behind +UTC + + + +Edmonton(config)# clock Configures the time zone to +timezone NL -3 30 Newfoundland time for Newfoundland, Canada, which is 3.5 hours behind UTC + + + + +Edmonton# clock update- +calendar + +Updates the hardware clock from the +software clock + + + + + +Edmonton# show clock + + + + + +Edmonton# show clock +detail + +Displays the time and date from the system software clock + + + +Displays the clock source (NTP, hardware) and the current summer- +time setting (if any) +Table 11-5 shows the common acronyms used for setting the time zone on a router. + +TABLE 11-5 Common Time Zone Acronyms + + +Region/Acrony Time Zone Name and UTC Offset m + + +Europe + + + +GMT Greenwich Mean Time, as UTC + + + +BST British Summer Time, as UTC +1 hour + + + +IST Irish Summer Time, as UTC +1 hour + + + +WET Western Europe Time, as UTC + + + +WEST Western Europe Summer Time, as UTC +1 hour + + + +CET Central Europe Time, as UTC +1 + + + +CEST Central Europe Summer Time, as UTC +2 + + + +EET Eastern Europe Time, as UTC +2 + + + +EEST Eastern Europe Summer Time, as UTC +3 + + + +MSK Moscow Time, as UTC +3 +MSD Moscow Summer Time, as UTC +4 + + + +United States and Canada + + + +AST Atlantic Standard Time, as UTC –4 hours + + + +ADT Atlantic Daylight Time, as UTC –3 hours + + + +ET Eastern Time, either as EST or EDT, depending on place and time of year + + + +EST Eastern Standard Time, as UTC –5 hours + + + +EDT Eastern Daylight Time, as UTC –4 hours + + + +CT Central Time, either as CST or CDT, depending on place and time of year + + + +CST Central Standard Time, as UTC –6 hours + + + +CDT Central Daylight Time, as UTC –5 hours + + + +MT Mountain Time, either as MST or MDT, depending on place and time of year + + + +MST Mountain Standard Time, as UTC –7 hours + + + +MDT Mountain Daylight Time, as UTC –6 hours +PT Pacific Time, either as PST or PDT, depending on place and time of year + + + +PST Pacific Standard Time, as UTC –8 hours + + + +PDT Pacific Daylight Time, as UTC –7 hours + + + +AKST Alaska Standard Time, as UTC –9 hours + + + +AKDT Alaska Standard Daylight Time, as UTC –8 hours + + + +HST Hawaiian Standard Time, as UTC –10 hours + + + +Australia + + + +WST Western Standard Time, as UTC +8 hours + + + +CST Central Standard Time, as UTC +9.5 hours + + + +EST Eastern Standard/Summer time, as UTC +10 hours (+11 hours during summer time) + + + +Table 11-6 lists an alternative method for referring to time zones, in which single letters are used to refer to the time zone difference from UTC. Using this method, the letter Z is used to indicate the zero meridian, equivalent to UTC, and the letter J (Juliet) is used to refer to the local time zone. Using this method, the international date line is between time zones M and Y. + +TABLE 11-6 Single-Letter Time Zone Designators +Letter Designator + + +Y + + + +X + + + +W + + + +V + + + +U + + + +T + + + +S + + + +R + + + +Q + + + +P + + + +O + + + +N + + + +Z + + + +A + +Word Designator + + +Yankee + + + +X-ray + + + +Whiskey + + + +Victor + + + +Uniform + + + +Tango + + + +Sierra + + + +Romeo + + + +Quebec + + + +Papa + + + +Oscar + + + +November + + + +Zulu + + + +Alpha + +Difference from UTC + + +UTC –12 hours + + + +UTC –11 hours + + + +UTC –10 hours + + + +UTC –9 hours + + + +UTC –8 hours + + + +UTC –7 hours + + + +UTC –6 hours + + + +UTC –5 hours + + + +UTC –4 hours + + + +UTC –3 hours + + + +UTC –2 hours + + + +UTC –1 hour + + + +Same as UTC + + + +UTC +1 hour +B Bravo + + + +C Charlie + + + +D Delta + + + +E Echo + + + +F Foxtrot + + + +G Golf + + + +H Hotel + + + +I India + + + +K Kilo + + + +L Lima + + + +M Mike + +UTC +2 hours + + + +UTC +3 hours + + + +UTC +4 hours + + + +UTC +5 hours + + + +UTC +6 hours + + + +UTC +7 hours + + + +UTC +8 hours + + + +UTC +9 hours + + + +UTC +10 hours + + + +UTC +11 hours + + + +UTC +12 hours + + + + +Using Time Stamps + + + +Edmonton(config)# timestamps + + + +Edmonton(config)# + + +service + + + + + +service + +Adds a time stamp to all system logging messages + + + +Adds a time stamp to all debugging + +timestamps debug messages +Edmonton(config)# service Adds a time stamp along with the timestamps debug uptime total uptime of the router to all +debugging messages + + + +Edmonton(config)# service Adds a time stamp displaying the + +timestamps debug datetime +localtime + +local time and the date to all +debugging messages + + + + +Edmonton(config)# no Disables all time stamps service timestamps + + + +Configuration Example: NTP + +Figure 11-4 shows the network topology for the configuration that follows, which demonstrates how to configure NTP using the commands covered in this chapter. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 11-4 Network Topology for NTP Configuration + + + +Core1 Router + + +Core1(config)# ntp Configures router to synchronize its server 209.165.201.44 clock to a public NTP server at address +209.165.201.44 + + + +Core1(config)# ntp Configures router to synchronize its server 209.165.201.111 clock to a public NTP server at address +209.165.201.111 + + + +Core1(config)# ntp Configures router to synchronize its +server 209.165.201.133 clock to a public NTP server at address 209.165.201.133 + + + +Core1(config)# ntp Configures router to synchronize its server 209.165.201.222 clock to a public NTP server at address +209.165.201.222 + + + +Core1(config)# ntp Configures router to synchronize its + +server 209.165.201.233 +prefer + +clock to a public NTP server at address 209.165.201.233. This is the preferred +NTP server + + + + +Core1(config)# ntp max- Configures the maximum number of associations 200 NTP peer-and-client associations that +the router will serve + + + +Core1(config)# clock Sets time zone to Eastern Standard timezone EST -5 Time + + + +Core1(config)# clock Configures the system to automatically summer-time EDT switch to summer time and to repeat recurring 2 Sun Mar 2:00 on the same day +1 Sun Nov 2:00 + + + +Core1(config)# ntp Configures the router to serve as a master 10 master clock if the external NTP server +is not available + + + +Core1(config)# ntp Sets the source of all NTP packets to source Loopback 0 192.168.223.1, which is the address of +Loopback 0 +Core1(config)# access- Sets access 1 list to permit packets list 1 permit coming from 127.127.1.1 127.127.1.1 + + + +Core1(config)# access- Sets access list 2 to permit packets list 2 permit coming from 192.168.x.x 192.168.0.0 0.0.255.255 + + + +Core1(config)# ntp Configures Core1 to peer with any access-group peer 1 devices identified in access list 1 + + + +Core1(config)# ntp Configures Core1 to receive only time + +access-group serve-only +2 + +requests from devices specified in the +ACL + + + + +Core2 Router + + +Core2(config)# ntp Configures router to synchronize its server 209.165.201.44 clock to a public NTP server at address +209.165.201.44 + + + +Core2(config)# ntp Configures router to synchronize its server 209.165.201.111 clock to a public NTP server at address +209.165.201.111 + + + +Core2(config)# ntp Configures router to synchronize its server 209.165.201.133 clock to a public NTP server at address +209.165.201.133 + + + +Core2(config)# ntp Configures router to synchronize its server 209.165.201.222 clock to a public NTP server at address +209.165.201.222 + + + +Core2(config)# ntp Configures router to synchronize its + +server 209.165.201.233 +prefer + +clock to a public NTP server at address 209.165.201.233. This is the preferred +NTP server + + + + +Core2(config)# ntp max- Configures the maximum number of associations 200 NTP peer-and-client associations that +the router will serve + + + +Core2(config)# clock Sets time zone to Eastern Standard timezone EST -5 Time + + + +Core2(config)# clock Configures the system to automatically summer-time EDT switch to summer time and to repeat recurring 2 Sun Mar 2:00 on the same day +1 Sun Nov 2:00 + + + +Core2(config)# ntp Configures the router to serve as a master 10 master clock if the external NTP server +is not available + + + +Core2(config)# ntp Sets the source of all NTP packets to source Loopback 0 192.168.224.1, which is the address of +Loopback 0 + + + +Core2(config)# access- Sets ACL 1 to permit packets coming list 1 permit from 127.127.1.1 +127.127.1.1 +Core2(config)# access- Sets ACL 2 to permit packets coming list 2 permit from 192.168.x.x +192.168.0.0 0.0.255.255 + + + + +Core2(config)# ntp Configures Core2 to peer with any access-group peer 1 devices identified in ACL 1 + + + +Core2(config)# ntp Configures Core2 to receive only time + +access-group serve-only +2 + +requests from devices specified in the +ACL + + + + +DLSwitch1 + + +DLSwitch1(config)# ntp Sets the source of all NTP source Loopback 0 packets to 192.168.225.1, which is +the address of Loopback 0 + + + +DLSwitch1(config)# ntp Configures DLSwitch1 to server 192.168.223.1 synchronize its clock to an NTP +server at address 192.168.223.1 + + + +DLSwitch1(config)# ntp Configures DLSwitch1 to server 192.168.224.1 synchronize its clock to an NTP +server at address 192.168.224.1 + + + +DLSwitch1(config)# clock Sets time zone to Eastern timezone EST -5 Standard Time + + + +DLSwitch1(config)# clock Configures the system to summer-time EDT recurring 2 automatically switch to summer Sun Mar 2:00 1 Sun Nov 2:00 time and to repeat on the same +day + + + +DLSwitch2 + + +DLSwitch2(config)# ntp Sets the source of all NTP source Loopback 0 packets to 192.168.226.1, which is +the address of Loopback 0 + + + +DLSwitch2(config)# ntp Configures DLSwitch2 to server 192.168.223.1 synchronize its clock to an NTP +server at address 192.168.223.1 + + + +DLSwitch2(config)# ntp Configures DLSwitch2 to server 192.168.224.1 synchronize its clock to an NTP +server at address 192.168.224.1 + + + +DLSwitch2(config)# clock Sets time zone to Eastern timezone EST -5 Standard Time + + + +DLSwitch2(config)# clock Configures the system to summer-time EDT recurring 2 automatically switch to summer Sun Mar 2:00 1 Sun Nov 2:00 time and to repeat on the same +day + + + +ALSwitch1 + + +ALSwitch1(config)# ntp Sets the source of all NTP source Loopback 0 packets to 192.168.227.1, which is +the address of Loopback 0 + + + +ALSwitch1(config)# ntp Configures ALSwitch1 to +server 192.168.223.1 synchronize its clock to an NTP server at address 192.168.223.1 + + + +ALSwitch1(config)# ntp Configures ALSwitch1 to server 192.168.224.1 synchronize its clock to an NTP +server at address 192.168.224.1 + + + +ALSwitch1(config)# clock Sets time zone to Eastern timezone EST -5 Standard Time + + + +ALSwitch1(config)# clock Configures the system to summer-time EDT recurring 2 automatically switch to summer Sun Mar 2:00 1 Sun Nov 2:00 time and to repeat on the same +day + + + +ALSwitch2 + + +ALSwitch2(config)# ntp Sets the source of all NTP source Loopback 0 packets to 192.168.228.1, which +is the address of Loopback 0 + + + +ALSwitch2(config)# ntp Configures ALSwitch2 to server 192.168.223.1 synchronize its clock to an NTP +server at address 192.168.223.1 + + + +ALSwitch2(config)# ntp Configures ALSwitch2 to server 192.168.224.1 synchronize its clock to an NTP +server at address 192.168.224.1 + + + +ALSwitch2(config)# clock Sets time zone to Eastern timezone EST -5 Standard Time +ALSwitch2(config)# clock Configures the system to summer-time EDT recurring 2 automatically switch to summer Sun Mar 2:00 1 Sun Nov 2:00 time and to repeat on the same +day + + + +TOOL COMMAND LANGUAGE (TCL) + +Tcl shell is a feature that is built into Cisco routers and switches that allows engineers to interact directly with the device by using various Tcl scripts. Tcl scripting has been around for quite some time and is a very useful scripting language. Tcl provides many ways to streamline different tasks that can help with day-to-day operations and monitoring of a network. Some of the following are tasks that can be automated by using these scripts: + + +Verify IP and IPv6 reachability, using ping + +Verify IP and IPv6 reachability, using traceroute + +Check interface statistics + +Retrieve SNMP information by accessing Management Information Base (MIB) objects + +Send email messages containing CLI outputs from Tcl script + + + +Most often, basic Tcl scripts are entered line by line within the Tcl shell, although, for some of the more advanced scripting methods, you can load the script into the flash of the device you are working on and execute the script from there using a command like source flash:ping.tcl from the Tcl shell. + +A classic use case for Tcl scripting is when you need to perform network testing using ping. The following example shows the +general syntax for a Tcl script: + + + +Router# tclsh This simple Tcl script automates a ping test to Router(tcl)# the 172.16.10.1, 172.16.10.2, and 172.16.10.3 foreach address { addresses. Notice that the test executes as + ++>(tcl)# 172.16.10.1 +>(tcl)# 172.16.10.2 +>(tcl)# 172.16.10.3 +>(tcl)# } { ping +$address + +soon as you enter the closing brace + + + +The tclsh command grants you access to the Tcl shell + + + +The tclquit command returns you to +privileged EXEC mode + + ++>(tcl)# } Type escape +sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.10.1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/6 ms +Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.10.2 timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/5 ms +Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.10.3, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/6 ms Router(tcl)# tclquit +Router# + + + +EMBEDDED EVENT MANAGER (EEM) + +Embedded Event Manager is a flexible system designed to customize Cisco IOS, XR, and NX-OS. EEM allows you to automate tasks, perform minor enhancements, and create workarounds. Applets and scripting are two pieces of EEM. Applets are a collection of CLI commands, while scripts are actions coded in Tcl. Event detectors are used by EEM, and actions provide notifications of the events. EEM event detectors include SNMP object monitoring, syslog message monitoring, interface counter +monitoring, CLI event monitoring, and IP SLA and NetFlow event monitoring. + +EEM actions can include sending an email, executing a CLI command, generating an SNMP trap, reloading a device, and generating specific syslog messages. + + + +Note +The following examples assume that the first command is typed in global configuration mode. + + + +EEM Configuration Examples + +EEM Example 1 + +The first EEM example shows an applet that monitors the GigabitEthernet 0/0/0 interface. If a syslog message indicates that its state has changed to administratively down, the applet is triggered, the interface is re-enabled, and an email is sent containing a list of users currently logged into the router. + +Notice the use of the $_cli_result keyword in the email configuration. This means that the email body will include the output of any CLI commands that were issued in the applet. In this case, the output of the show users command will be included in the debug and the email message. + +Click here to view code image + + + +event manager applet interface_Shutdown +event syslog pattern "Interface GigabitEthernet 0/0/0, changed state +to administratively down" action 1.0 cli command "enable" +action 1.5 cli command "config terminal" +action 2.0 cli command "interface gigabitethernet0/0/0" action 2.5 cli command "no shutdown" +action 3.0 cli command "end" +action 3.5 cli command "show users" +action 4.0 mail server 209.165.201.1 to engineer@cisco.com from EEM@ +cisco.com subject "ISP1 Interface GigabitEthernet0/0/0 SHUT." body +"Current users $_cli_result" end + + + +EEM Example 2 + +The second EEM example shows an applet that monitors the CLI for the debug ip packet command. When this pattern is matched, the applet will skip the command so that it does not take effect. The action list first enters the enabled mode and issues the show users | append flash:Debug command. This command will append the output from the show users command to the end of a file in flash called Debug. The next action will then append the current time stamp to the end of the file in flash named Debug_clock. By matching the order of the entries in both files you will have a list of the users that tried to enter the debug command and the date and time that the user attempted it. + +Click here to view code image + + + +event manager applet Stop_Debug +event cli pattern "debug ip packet" sync no skip yes action 1.0 cli command "enable" +action 2.0 cli command "show users | append flash:Debug" action 3.0 cli command "show clock | append flash:Debug_clock" +end + + + +EEM Example 3 + +The third EEM example shows an applet that matches a CLI pattern that starts with “wr”. When a match is detected, the applet is triggered. Cisco IOS prompting is disabled and a copy of the new startup-configuration file is backed up to a TFTP server. A syslog +message is triggered confirming a successful TFTP file transfer. Notice that two environment variables were created and are used within the applet, one for the file name and one for the IP address. + +Click here to view code image + + + +event manager environment filename router.cfg +event manager environment tftpserver tftp://10.99.1.101/ event manager applet SAVE-to-TFTP +event cli pattern "wr.*" sync yes action 1.0 cli command "enable" +action 2.0 cli command "configure terminal" action 3.0 cli command "file prompt quiet" action 4.0 cli command "end" +action 5.0 cli command "copy start $tftpserver$filename" action 6.0 cli command "configure terminal" +action 7.0 cli command "no file prompt quiet" +action 8.0 syslog priority informational msg "Running-config saved +to NVRAM! TFTP backup successful." + + + +EEM Example 4 + +The final example is more complex but demonstrates how powerful EEM applets can be. This example is based on the latest version of EEM (version 4). In this scenario, an IP SLA is configured to send an ICMP echo request every 10 seconds to address 209.165.201.1. IP SLA reaction alerts are enabled, which allows the IP SLA to send an alert after three consecutive timeouts. This triggers the EEM applet and a syslog message is displayed. Notice the use of the $_ipsla_oper_id variable. This is a built-in environment variable and returns the IP SLA number, which in this case is 1. + +Click here to view code image + + + +ip sla 1 +icmp-echo 209.165.201.1 frequency 10 +ip sla schedule 1 life forever start-time now +ip sla reaction-configuration 1 react timeout threshold-type +consecutive 3 +ip sla enable reaction-alerts ! + +event manager applet IPSLA +event ipsla operation-id 1 reaction-type timeout +action 1.0 syslog priority emergencies msg "IP SLA operation $_ipsla_oper_id to ISP DNS server has timed out" + + + +EEM and Tcl Scripts + +Using an EEM applet to call Tcl scripts is another very powerful aspect of EEM. This example shows how to manually execute an EEM applet that will, in turn, execute a Tcl script that is locally stored in the device’s flash memory. It is important to understand that there are many ways to use EEM and that manually triggered applets are also a very useful tool. The following example depicts an EEM script that is configured with the event none command. This means that there is no automatic event that the applet is monitoring, and that this applet will only run when it is triggered manually. To manually run an EEM applet, the event manager run command must be used, as illustrated at the router prompt. In this example, the ping_script.tcl file is a Tcl script similar to the one described earlier in this chapter. + +Click here to view code image + + + +event manager applet myping event none +action 1.0 cli command "enable" +action 1.1 cli command "tclsh flash:/ping_script.tcl" + + + +Router# event manager run myping Router# + + + +Verifying EEM +Router# debug event Displays actual actions taking place manager action cli when an applet is running + + + +Router# show event Displays all configured applets, their manager policy triggers and actions +registered + + + +Router# show event Displays the version of EEM that is manager version supported in the Cisco IOS software +Part VI: Wireless +Chapter 12 + +Wireless Security and Troubleshooting + + + + + +This chapter provides information and commands concerning the following topics: + + +Authenticating wireless clients + + +Open authentication + +Authenticating with a pre-shared key + +Authenticating with EAP + + +Configuring EAP-based authentication with external RADIUS servers + +Configuring EAP-based authentication with local EAP + +Verifying EAP-based authentication configuration + + + +Authenticating with WebAuth + + + +Troubleshooting from the Wireless LAN Controller + + +Cisco AireOS Monitoring Dashboard GUI + +Cisco AireOS Advanced GUI + +Cisco IOS XE GUI + +Cisco AireOS/IOS XE CLI +Troubleshooting client connectivity problems + + +Cisco AireOS Monitoring Dashboard GUI + + + +Cisco IOS XE GUI + + + +AUTHENTICATING WIRELESS CLIENTS + +Before a wireless client device can communicate on your network through the access point, the client device must authenticate to the access point by using open or shared-key authentication. Networks can leverage many technologies and protocols to protect information sent wirelessly. This section explores different methods to authenticate wireless clients before they are granted access to the wireless network. Note that the figures used throughout this client authentication section are from the Cisco AireOS Advanced configuration GUI. + +Open Authentication + +Open authentication allows any device to authenticate and then attempt to communicate with the access point. Open authentication is true to its name; it offers open access to a WLAN. The only requirement is that a client must use an 802.11 authentication request before it attempts to associate with an AP. No other credentials are needed. + +To create a WLAN with open authentication, first create a new WLAN. From the Advanced Monitor Summary screen, click WLANs in the top menu bar. You will see a list of already configured WLANs. Figure 12-1 shows one WLAN already created, named CCNPPCG. Click the Go button to create a new WLAN. + + + + + + + + +Figure 12-1 Creating a New WLAN + + + +On the next screen, choose WLAN from the Type drop-down menu, enter the profile name and SSID, and choose your ID. The typical configuration, but not required, is to have the same profile name and SSID. Figure 12-2 shows this completed page, using 10 as the ID, to match with VLAN 10. Your choices for ID number range from 1 to 512. Click Apply when finished. + + + + + + + + + + + + + + +Figure 12-2 New WLAN Created + + + +The next screen shows you what you entered on the previous screen. Verify that the information is correct and ensure that the Enabled check box for this new WLAN is checked, as shown in Figure 12-3. + + + + + + + + + + + + + + + + +Figure 12-3 Enabling the New WLAN + + + + +Note +If you do not enable the WLAN, you will not be able to join the Cisco Wireless LAN Controller (WLC) from your wireless client. + + + +Next, click the Security tab to configure the WLAN security and user authentication parameters. Click the Layer 2 subtab, then choose None from the Layer 2 Security drop-down menu to configure open authentication, as shown in Figure 12-4. + + + + + + + + + + + + + + + + + + + + + +Figure 12-4 Configuring Open Authentication for a WLAN +When you are finished configuring the WLAN, click the Apply button. Return to the General tab and verify that the Security Policies field is set to None, as shown in Figure 12-5. Click the Apply button when finished. Figure 12-6 confirms that the new WLAN has been created and that there is no authentication set when showing the list of created WLANs. + + + + + + + + + + + + + + + + + + + + + +Figure 12-5 Verifying Open Authentication in the WLAN Configuration + + + + + + + + + + + + + +Figure 12-6 Verifying Open Authentication from the List of WLANs + + +Authenticating with a Pre-shared Key + +When the Wired Equivalent Privacy (WEP) standard was found to be weak and easily breakable, both the Electrical and Electronics +Engineers (IEEE) 802.11 committee and the Wi-Fi Alliance worked to replace it. Two generations of solutions emerged: Wi-Fi Protected Access (WPA) in 2003 and its successor, WPA2, in 2004. These solutions offer a security framework for authentication and encryption. In 2018, the Wi-Fi Alliance announced the release of WPA3 with several security improvements over WPA2. + +WPA2 is the current implementation of the 802.11i security standard and deprecates the use of WEP and WPA. WPA2, being 802.11i compliant, is the current standard for enterprise networks. Unlike WPA, WPA2 provides support for IEEE 802.11n/ac. WPA2 provides either 802.1X or PSK authentication, and determines two modes of wireless protected access. + +WPA2 Personal Mode + + +Uses WPA2-PSK (Pre-Shared Key) authentication; a common key is statically configured on the client and the AP. + +Designed for environments where there is no RADIUS authentication server. + +Provides inadequate security for an enterprise wireless network; if attackers break the WPA2 PSK, they can access all device data. + + +WPA2 Enterprise Mode + + +Uses IEEE 802.1X and EAP authentication; each user or device is individually authenticated. + +Incorporates a RADIUS authentication server for authentication and key management. + +Used by enterprise-class networks. +802.1X + +You can configure WPA2 Personal mode and the pre-shared key in one step. Figures 12-7 and 12-8 show the screen in which this can occur. Click the WLANs tab and either click Go to create a new WLAN, or select the WLAN ID of an existing WLAN to edit. Make sure that the parameters on the General tab are set appropriately. Click the Security tab followed by the Layer 2 subtab. Here you can choose the Layer 2 security option you require. Figure 12-7 shows WPA+WPA2 being selected for the WLAN named CCNPPCG. In the WPA+WPA2 Parameters section, WPA Policy is unchecked, leaving only WPA2 Policy and WPA2 Encryption AES selected. + + + + + + + + + + + + + + + + + + + + +Figure 12-7 Selecting WPA2 Personal Security for a WLAN + + + +The bottom portion of the Layer 2 subtab is the Authentication Key Management section. Check the Enable check box to enable PSK, and then enter the pre-shared key string in the box next to PSK Format, as shown Figure 12-8. + + + + + + + + + + + + + + + +Figure 12-8 Selecting the Authentication Key Management Options + + + + +Tip +The controller will allow you to check both the WPAPolicyand WPA2 Policycheck boxes. You should do this onlyif you have legacyequipment that requires WPAsupport. + + + +You can verify the security settings from the General tab for the WLAN. Click Apply to commit the changes. Figure 12-9 shows the Security Policies for the CCNPPCG WLAN have seen set to [WPA2] [Auth(PSK)]. This is also shown in Figure 12-10. + + + + + + + + + + + + + + + + + + + + + +Figure 12-9 Verifying PSK Authentication in WLAN +Configuration + + + + + + + + + + + +Figure 12-10 Verifying PSK Authentication in WLAN Summary Page + + +Authenticating with EAP + +Rather than build additional authentication methods into the 802.11 standard, the Extensible Authentication Protocol (EAP) offers a more flexible and scalable authentication framework. As its name implies, EAP is extensible and does not consist of any one authentication method. Instead, EAP defines a set of common functions that actual authentication methods can use to authenticate users. + +EAP has another interesting quality: It can integrate with the IEEE 802.1X port-based access control standard. When 802.1X is enabled, it limits access to a network media until a client authenticates. This means that a wireless client might be able to associate with an AP, but will not be able to pass data to any other part of the network until it successfully authenticates. + +With open and PSK authentication, wireless clients are authenticated locally at the AP without further intervention. The scenario changes with 802.1X; the client uses open authentication to associate with the AP, and then the actual client authentication process occurs at a dedicated authentication server. + +The authentication server functionality in the EAP process can be +provided by the following: + + +Locally by a Cisco Wireless LAN Controller (referred to as local EAP) + + +Local EAP can use either the local user database or a Lightweight Directory Access Protocol (LDAP) database to authenticate users. Local EAP can also be used as a backup for RADIUS authentication. This approach allows wireless clients to authenticate even if the controller loses connectivity to the RADIUS server. + + + +Globally by a RADIUS server such as: + + +Cisco Identity Services Engine (ISE) + +Microsoft Server that is configured for RADIUS-NPS + +Any RADIUS-compliant server + + + +802.1X and EAP address authentication but not encryption. 802.1X and EAP can be used with or without encryption. For 802.1X and EAP authentication, all packets must be relayed between the client and the authentication server. The content of the EAP messages is of no importance to the controller and AP, which simply relay the information. + +There are multiple types of EAP. The three current most commonly used are EAP-TLS, PEAP, and EAP-FAST. PEAP is currently the most prominently used, as it is used with Microsoft servers; however, EAP-TLS is gaining in popularity because it can be supported by Cisco ISE. + +Configuring EAP-based Authentication with External RADIUS Servers +Begin by configuring one or more external RADIUS servers on the controller. Navigate to Security > AAA > RADIUS > Authentication. Click the New button to define a new server or select the Server Index number to edit an existing server definition. In Figure 12-11, a new RADIUS server is being defined. Navigate to Security > AAA > RADIUS > Authentication and enter the appropriate information, and make sure the RADIUS port number is correct and that the Server Status is set to Enabled. Click Apply when you are finished. + + + + + + + + + + + + + + + + + + + + + + + + +Figure 12-11 Defining a RADIUS Server for WPA2 Enterprise Authentication + + + +Next, you need to enable 802.1X authentication on the WLAN. Navigate to WLANs and either click Go to create a new WLAN or click the number of an existing WLAN in the WLAN ID column to edit it. As an example, configure the WLAN security to use WPA2 Enterprise. Under the Security > Layer 2 subtab, select WPA+WPA2 and make sure that the WPA2 Policy check box is checked and that the WPA Policy check box is not checked. Beside +WPA2 Encryption, check the box next to AES to use the most robust encryption. In the Authentication Key Management section, check the Enable check box next to 802.1X to enable the Enterprise mode. Make sure that the Enable check box next to PSK is not checked so that Personal mode will remain disabled. Figures 12-12 and 12-13 illustrate the settings that are needed to configure WPA2 Enterprise mode with 802.1X authentication. + + + + + + + + + + + + + + + + + + + + +Figure 12-12 Enabling WPA2 Enterprise Mode with 802.1X Authentication + + + + + + + + + + + + + + + + + + + + + + +Figure 12-13 Enabling WPA2 Enterprise Mode with 802.1X +Authentication, Part 2 + + + +By default, a controller will use the global list of RADIUS servers in the order you have defined under Security > AAA > RADIUS > Authentication. You can override that list from the AAA Servers tab, where you can define which RADIUS servers will be used for 802.1X authentication. You can define up to six RADIUS servers that will be tried in sequential order, designated as Server 1, Server 2, and so on. Choose a predefined server by clicking the +drop-down menu next to one of the server entries. In Figure 12-14, the RADIUS server at 192.168.100.9 will be used as Server 1. After selecting your servers, you can edit other parameters or click Apply to make your configuration changes operational. + + + + + + + + + + + + + + + + + + + + +Figure 12-14 Selecting RADIUS Servers to Authenticate Clients in the WLAN + + +Configuring EAP-based Authentication with Local EAP + +If your environment is relatively small or you do not have a RADIUS server in production, you can use an authentication server that is built in to the Wireless LAN Controller. This is called local +EAP, which supports LEAP, EAP-FAST, PEAP, and EAP-TLS. + + +First, you need to define and enable the local EAP service on the controller. Navigate to Security > Local EAP > Profiles and click the New button. Enter a name for the local EAP profile, which will be used to define the authentication server methods. In Figure 12-15, a new profile called LocalEAP has been defined. Click the Apply button to create the profile. Now you should see the new profile listed, along with the authentication methods it supports, as shown in Figure 12-16. From this list, you can check or uncheck the boxes to enable or disable each method. In this example, LocalEAP has been configured to use PEAP. + + + + + + + + + + + + + + + +Figure 12-15 Defining a Local EAP Profile on a Controller + + + + + + + + + + + + + + + + + + + +Figure 12-16 Displaying Configured Local EAP Profiles +Next, you need to configure the WLAN to use the local EAP server rather than a regular external RADIUS server. Navigate to WLANs, click the WLAN’s number in the WLAN ID column, and then select the Security > Layer 2 subtab and enable WPA2, AES, and 802.1X as before. + +If you have defined any RADIUS servers in the global list under Security > AAA > RADIUS > Authentication or any specific RADIUS servers in the WLAN configuration, the controller will use those first. Local EAP will then be used as a backup method. + +To make local EAP the primary authentication method, you must make sure that no RADIUS servers are defined on the controller. Click the AAA Servers tab and make sure that all three RADIUS servers are set to None in the drop-down menus, as shown in Figure 12-17. + + + + + + + + + + + + + + + + + + + + + +Figure 12-17 Removing RADIUS Servers for Authentication + + + +On the bottom of the same screen, in the Local EAP Authentication section, check the Enabled check box to begin using the local EAP server. Select the EAP profile name that you have previously +configured. In Figure 12-18, the local EAP authentication server is enabled and will use the LocalEAP profile, which was configured for PEAP. + + + + + + + + + + + + + + + + + + + + +Figure 12-18 Enabling Local EAP Authentication for a WLAN + + + +Because the local EAP server is local to the controller, you will have to maintain a local database of users or define one or more LDAP servers on the controller. You can create users by navigating to Security > AAA > Local Net Users. In Figure 12-19, a user named testuser has been defined and authorized for access to the Support_Staff WLAN. + + + + + + + + + + + + + + +Figure 12-19 Creating a Local User for Local EAP Authentication +Verifying EAP-based Authentication Configuration + +You can verify the WLAN and its security settings from the list of WLANs by selecting WLANs > WLAN, as shown in Figure 12-20. For EAP-based authentication, the Security Policies field should display [Auth(802.1X)]. You can also verify that the WLAN status is enabled and active. + + + + + + + + + + + + + +Figure 12-20 Verifying EAP Authentication on a WLAN + + + +Authenticating with WebAuth + +WebAuth is a process that allows users, typically guests, to authenticate to the network through a web portal via a browser interface. Clients that attempt to access the WLAN using HTTP are automatically redirected to a login page where they are prompted for their credentials. Their credentials are then passed to an authentication server, which then assigns the appropriate VLAN and ACLs for guest access to the Internet. + + + +Tip +Web authentication can be handled locallyon the WLC for smaller environments through local web authentication (LWA). When there are manycontrollers providing web authentication, it makes sense to use LWA with an external database on a RADIUS server such as Cisco ISE, keeping the user database centralized. + + + +To configure WebAuth on a WLAN, first create the new WLAN and map it to the correct VLAN. Go to the General tab and enter the SSID string, apply the appropriate controller interface, and change +the status to Enabled. + + +On the Security tab, click the Layer 2 subtab to choose a wireless security scheme to be used on the WLAN. In Figure 12-21, the WLAN is named Guest_webauth, the SSID is Guest_webauth, and open authentication will be used because the None method has been selected. + + + + + + + + + + + + + + + + + + + + +Figure 12-21 Configuring Open Authentication for WebAuth + + + +Next, click the Security > Layer 3 subtab and choose the Layer 3 Security type Web Policy, as shown in Figure 12-22. When the Authentication radio button is selected (the default), web authentication will be performed locally on the WLC by prompting the user for credentials that will be checked against RADIUS, LDAP, or local EAP servers. In Figure 12-22, Passthrough has been selected, which will display web content such as an acceptable use policy to the user and prompt for acceptance. Through the other radio buttons, WebAuth can redirect the user to an external web server for content and interaction. Click the Apply button to apply the changes to the WLAN configuration. + + + + + + + + + + + + + + + + + + + +Figure 12-22 Configuring WebAuth with Passthrough Authentication + + + +You will need to configure the WLC’s local web server with content to display during a WebAuth session. Navigate to Security > Web Auth > Web Login Page, as shown in Figure 12-23. By default, internal WebAuth is used. You can enter the web content that will be displayed to the user by defining a text string to be used as the headline, as well as a block of message text. + + + + + + + + + + + + + + + + + + + + + + + +Figure 12-23 Configuring the WebAuth Page Content + + + +Figure 12-24 shows the web content that is presented to a user that attempts to connect to the WLAN. The user must click the Submit button to be granted network access. + + + + + + + + + + + + + + + + + + + +Figure 12-24 Example Web Content Presented by WebAuth Passthrough +You can verify the WebAuth security settings from the list of WLANs by selecting WLANs > WLAN. Figure 12-25 shows that WLAN 100 with SSID Guest_webauth uses the Web-Passthrough security policy. You can also verify that the WLAN status is enabled and active. + + + + + + + + + + + + + + +Figure 12-25 Verifying WebAuth Authentication on a WLAN + + + +TROUBLESHOOTING FROM THE WIRELESS LAN CONTROLLER + +The Cisco Wireless LAN Controller (WLC) interface can be accessed using either of two modes: the command-line interface (CLI) or the graphical user interface (GUI). Unless you are using a network management system, the Cisco WLC GUI is where you will typically monitor your system. Here, you have access to overall health and specific issues in your WLAN. Depending on the model of WLC that you are using, you will see different GUIs. The following sections introduce, in turn, the Cisco AireOS Monitoring Dashboard GUI, the Cisco AireOS Advanced GUI, the Cisco IOS XE GUI, and the Cisco AireOS/IOS XE CLI. + +Cisco AireOS Monitoring Dashboard GUI + +The Cisco AireOS controller GUI has a new monitoring dashboard that gives a single-window overview of the network devices that are connected to the controller. The Monitoring Dashboard screen is +the default screen when you log in to the GUI of the AireOS controller. This screen is split into sections: numerical statistics and graphical widgets, as shown in Figure 12-26 and described next. From there it is possible to access the Advanced GUI (introduced in the next section) by clicking the Advanced menu item in the top right of the Monitoring Dashboard screen, as highlighted in Figure 12-26. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 12-26 Cisco AireOS Monitoring Dashboard + + + +Numerical Statistics +The top section of the dashboard (see Figure 12-27) is where you get a quick view of what is found on the network: + + +Wireless Networks: Shows the number of WLANs enabled and disabled on this WLC + +Wired Networks: Shows the number of remote LANs and clients that are associated to the network (not displayed in Figure 12-27) +Access Points: Shows the number of active Cisco APs in the network + +Active Clients: Shows the number of 2.4- and 5-GHz clients in the network + +Rogues: Shows the number of unauthorized/unclassified APs and clients found in your network + +Interferers: Shows the number of detected interference devices on the 2.4- and 5-GHz bands + + + + + + + +Figure 12-27 Cisco WLC Network Summary Statistics + + + +Graphical Widgets +These graphical widgets (see Figure 12-28) present the numbers in the form of graphs. You can select the widgets to display from the available list: + + +Access Points + +Operating Systems + +Clients + +Applications + +Top WLANs (not displayed in Figure 12-28) + + + + + + + + + + + + + + + +Figure 12-28 Cisco WLC Network Summary Widgets + + + +From the Monitoring navigation pane along the left side of the dashboard (refer to Figure 12-26), you have the following options that are useful for troubleshooting: + + +Network Summary > Access Points: Displays the list of Cisco APs connected to the controller + +Network Summary > Clients: Displays the list of clients connected to the controller (partially shown in Figure 12-28) + + +This Monitoring Dashboard is quite limited. For further troubleshooting options, access the Cisco AireOS Advanced GUI by clicking the Advanced button. + +Cisco AireOS Advanced GUI + +The Cisco AireOS WLC Advanced GUI includes the following troubleshooting options and menus: + + +Monitor tab Summary screen (shown in Figure 12-29) + + +Controller Summary: Overall health of the WLC +Most Recent Traps: Quick view of the trap logs + +Access Point Summary: How many APs or radios are up or down + +Client Summary: How many clients (plus any issues) + + + +Wireless tab All APs screen + + +Displays the physical AP uptime and sorts by WLC associated time + +Check the bottom of the AP list for any recent AP disruptions + +Select the AP to see controller associated time (duration) + + + +Management tab + + +Message Logs: Message information on system conditions (for example, mobility group connection failure) + +Trap Logs: Show rogues, AP and channel changes, and invalid settings + +Tech Support: Information that the Cisco Technical Assistance Center (TAC) may require + + + +Monitor tab Cisco CleanAir screen + + +Check for interference devices per radio and AP (are they severe, and what is the duty cycle?) + +Examine the Worst Air Quality Report to get a quick summary + +Run the AQI report to get details on what the effect is to the WLAN + + + + + + + + + + + + + + + + + + +Figure 12-29 Cisco WLC Advanced GUI Page + + + +Cisco IOS XE GUI + +The Cisco IOS XE WLC GUI offers a new monitoring dashboard when you first log in. Like the AireOS GUI, it has a series of menus and widgets, as shown in Figure 12-30. The options available from the navigation pane on the left are as follows: + + +Dashboard: This is the home screen for the IOS XE GUI. This page offers numerical information about WLANs, APs, Clients, Rogue APs, and Interferers, as well as graphical widgets relating to APs, clients, and system statistics. This is very similar to what is found in the AireOS Monitoring Dashboard GUI. + +Monitoring: This menu includes options to view information about general controller details, network services, and wireless APs and clients. + +Configuration: This menu includes options for configuring controller interfaces, routing protocols, security, RF, network services, tags, profiles, and WLANs. + +Administration: This menu includes options for accessing the CLI, +and configuring DNS parameters, DHCP pools, licensing, software upgrades, and administrative users. + +Troubleshooting: This screen enables you to access troubleshooting tools such as syslog and debug, as well as packet capture, ping, and traceroute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 12-30 Cisco IOS XE GUI Dashboard + + + +Cisco AireOS/IOS XE CLI + +You may not always have access to the GUI of your Cisco Wireless LAN Controller, so it is good to know a few CLI commands to quickly access important troubleshooting information. + +The Wireless LAN Controller CLI show commands to monitor the WLAN are listed in the following table. When the show commands differ between AireOS and IOS XE, both commands are listed in that order. +Clients + + + +(Cisco Controller) Displays a summary of clients associated with > show client a Cisco lightweight access point +summary [ssid | ip | username | devicetype] + + + +IOSXE# show wireless client summary + + + +(Cisco Controller) Displays client information learned through > show client DNS snooping, including client username, + +detail mac-address + + + +IOSXE# show + +associated AP, SSID, IP address, supported +data rates, mobility state, security, and VLAN + +wireless client mac-address mac-address detail + + +(Cisco Controller) Displays the clients on a radio for an AP > show client ap +{802.11a | 802.11b} ap-name + + + +IOSXE# show wireless client ap name ap-name dot11 {24ghz | 5ghz} +Logs + + + +(Cisco Controller) Displays the latest SNMP trap log information > show traplog + + + +(Cisco Controller) Displays the syslog facility logging +> show logging parameters, current log severity level, and buffer contents + + + +Radios + + + +(Cisco Controller) Displays radio networking settings (status, > show {802.11a | rates, supported, power, and channel) 802.11b | 802.11h} + + + +IOSXE# show ap dot11 {24ghz | 5ghz} network + + +WLANs + + + + +(Cisco Controller) +> + +Displays WLAN information (name, security, +status, and all settings). Keywords include + + + + +IOSXE# apgroups: Displays access point group information + +show wlan {apgroups +| summary | wlan-id summary: Displays a summary of all | foreignAp | WLANs +lobby- admin- +access} wlan_id: Displays the configuration of a WLAN. The WLAN identifier range is from 1 to 512 + + + +foreignAp: Displays the configuration for support of foreign access points + + + +lobby-admin-access: Displays all WLANs that have lobby-admin-access enabled + + + + +APs + + + +(Cisco Controller) Displays AP detailed configuration settings by > show ap config radio +{802.11a | 802.11b} [summary] ap-name + + + +IOSXE# show ap dot11 {24ghz | 5ghz} summary + + +(Cisco Controller) Displays general AP configuration > show ap config information +general ap-name + + + +IOSXE# show ap name ap-name config general + + +(Cisco Controller) Displays MAC, IP address, name, and join +> show ap join status of all APs joined stats summary ap- +mac + + + + +IOSXE# show ap mac-address mac- + + + +address join stats {detailed | summary} + + + +WLC# show ap join stats summary + + + + +(Cisco Controller) +> + +Displays APs (model, MAC, IP address, +country, and number of clients) + + + + +IOSXE# + + + +show ap summary [ap-name] + + +(Cisco Controller) Displays WLAN IDs, interfaces, and BSSID > show ap wlan +{802.11a | 802.11b} ap-name + + + +IOSXE# show ap name ap-name wlan dot11 {24ghz | 5ghz } +Note +When logging output from the Wireless LAN Controller, enter the config paging disable command first to stop page breaks. + + + +Just as with routers and switches, debug commands are available on the Cisco WLC. One particular debug command that may be useful for troubleshooting wireless client connectivity is debug client mac_address. It is a macro that enables eight debug commands, plus a filter on the MAC address that is provided, so only messages that contain the specified MAC address are shown. The eight debug commands show the most important details about client association and authentication. The filter helps with situations where there are multiple wireless clients and too much output is generated, or the controller is overloaded when debugging is enabled without the filter. + +TROUBLESHOOTING WIRELESS CLIENT CONNECTIVITY + +If clients are reporting problems, a good place to start troubleshooting is at the Cisco Wireless LAN Controller. This section shows the output from two different GUIs: the Cisco AireOS Monitoring Dashboard GUI and the Cisco IOS XE GUI. + +Cisco AireOS Monitoring Dashboard GUI + +From the Monitoring pane along the left side of the AireOS Dashboard GUI, select Network Summary > Access Points to check if the APs are functioning correctly. + +The Access Point View page, shown in Figure 12-31, is displayed when an AP is selected. The AP details section provides tabs with +information on the clients, RF Troubleshooting with neighboring and rogue APs (2.4 and 5 GHz) found in the surroundings, Clean Air with active interferers, and the tool tab to restart the AP. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 12-31 Cisco AireOS WLC Access Point View Details + + + +Next, navigate to Network Summary > Clients. The Client View page is displayed when a client is selected. On this page, the client’s general details are shown. There are two infographic representations on the Client View page. The first infographic (see Figure 12-32) shows the connection stage of the client. + + + + + + + + + + + + + + + + + + + + + + +Figure 12-32 Cisco AireOS WLC Client View Details Connectivity Stage + + + +The second infographic (see Figure 12-33) shows the connectivity roadmap between the controller and the client. It also shows the types of connection and the path that is used in the network from the controller to the client. + + + + + + + + + + + + +Figure 12-33 Cisco AireOS WLC Client View Details Connectivity Roadmap + + + +The Client View page also offers the following debugging tools, as shown in Figure 12-34, to assess the connectivity from the client +with the controller: + + +Ping Test: Helps to determine the connectivity status and the latency between the two systems in a network + +Connection: Shows the connection logs for a client + +Event Log: Records the events and the option to save the logs to a spreadsheet + +Packet Capture: Provides various options to get precise information about the flow of packets to help resolve issues + + + + + + + + + + + + + + + + + + + +Figure 12-34 Cisco AireOS WLC Client Test Tools + + + +You can also go to the top right side of the Monitor Dashboard screen and click Advanced to be taken to the Monitor screen in the controller. From there you can drill down on any of the issues from that screen and menus. Click Clients from the menu on the left to display a list of all wireless clients associated with the WLC. From there, clicking a MAC address displays detailed information for that client, as shown in Figure 12-35. + + + + + + + + + + + + + + + + + + + + + +Figure 12-35 Verifying Client Details + + + +The Clients > Detail page displays the IP address, the VLAN ID, the Policy Manager State, the type of security that client is using, the AP name and WLAN profile, as well as the client Reason Code and client Status Code. + +The Policy Manager State will display one of these messages relating to the authentication state of the client: + + +START: Initializing the authentication process + +802.1X-REQD: 802.1X (L2) authentication pending + +DHCP_REQD: IP learning state + +WEBAUTH_REQD: Web (L3) Authentication pending + +RUN: Client traffic forwarding + + + +The client Reason Code can be one of the following: +no reason code (0) + + + +unspecified reason (1) + + + +previousAuthNotV alid (2) + + + +deauthenticationL eaving (3) + + + +disassociationDue ToInactivity (4) + + + +disassociationAPB usy (5) + + + +class2FrameFrom NonAuthStation (6) + + + +class2FrameFrom NonAssStation (7) + + + +disassociationSta HasLeft (8) + + + +staReqAssociation +WithoutAuth (9) + +Indicates normal operation + + + +Indicates that the client associated but is no longer authorized + + + +Indicates that the client associated but was not authorized + + + +Indicates that the AP went offline, deauthenticating the client + + + +Indicates that the client session was timeout exceeded + + + +Indicates that the AP is busy, for example, performing load balancing + + + +Indicates that the client attempted to transfer data before it was authenticated + + + + +Indicates that the client attempted to transfer data before it was associated + + + +Indicates that the operating system moved the client to another AP using nonaggressive load balancing + + + +Indicates that the client is not authorized yet and is +still attempting to associate with the AP +missingReasonCo +de (99) + +Indicates that the client is momentarily in an +unknown state + + + + +The client Status Code may be one of the following: + + + +idle (0) + + + + + +aaaPendi ng (1) + + + +authentic ated (2) + + + +associated (3) + + + +powersav e (4) + + + +disassocia ted (5) + + + +tobedelet ed (6) + + + +probing (7) + + + +disabled +(8) + +Indicates normal operation; no rejections of client association requests + + + +Indicates that a AAA transaction completed + + + + + +Indicates that 802.11 authentication completed + + + + + +Indicates that 802.11 association completed + + + + + +Indicates that the client is in power-save mode + + + + + +Indicates that the 802.11 disassociation completed + + + + + +Indicates that the client should be deleted after disassociation + + + + + +Indicates that the client is not associated or authorized yet + + + + + +Indicates that the operating system automatically disabled +the client for an operator-defined time +Cisco IOS XE GUI + +When troubleshooting client connectivity from the IOS XE controller GUI, you can use the Monitoring menu. First, navigating to Monitoring > AP Statistics will list all APs associated with the WLC. Clicking a specific AP will display general information about that AP, including AP name, IP address, model, power status, number of clients, and RF utilization, as shown in Figure 12-36. + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 12-36 Verifying AP Details in IOS XE WLC + + + +For specific client information, navigate to Monitoring > Clients and select a client from the list of all clients associated with the WLC. As shown in Figure 12-37, you can observe general client properties, AP properties, security information, and client statistics. + + + + + + + + + + + + + + + + + + + +Figure 12-37 Verifying Client Details in IOS XE WLC +Part VII: Overlays and Virtualization +Chapter 13 + +Overlay Tunnels and VRF + + + + + +This chapter provides information about the following topics: + + +Generic Routing Encapsulation (GRE) + + +Configuring an IPv4 GRE tunnel + +Configuring an IPv6 GRE tunnel + +Verifying IPv4 and IPv6 GRE tunnels + +Configuration example: IPv4 and IPv6 GRE tunnels with OSPFv3 + + + +Site-to-site GRE over IPsec + + +GRE/IPsec using crypto maps + +GRE/IPsec using tunnel IPsec profiles + +Verifying GRE/IPsec + + + +Site-to-site virtual tunnel interface (VTI) over IPsec + +Cisco Dynamic Multipoint VPN (DMVPN) + + +Configuration example: Cisco DMVPN for IPv4 + +Verifying Cisco DMVPN + + + +VRF-Lite +Configuring VRF-Lite + +Verifying VRF-Lite + + + + +Caution +Your hardware platform or software release might not support all the commands documented in this chapter. Please refer to Cisco.com for specific platform and software release notes. + + + +GENERIC ROUTING ENCAPSULATION (GRE) + +GRE, defined in RFC 2784, is a carrier protocol that can be used with a variety of underlying transport protocols and that can carry a variety of passenger protocols. RFC 2784 also covers the use of GRE with IPv4 as the transport protocol and the passenger protocol. Cisco IOS Software supports GRE as the carrier protocol with many combinations of passenger and transport protocols such as: + + +GRE over IPv4 networks: GRE is the carrier protocol, and IPv4 is the transport protocol. This is the most common type of GRE tunnel. + +GRE over IPv6 networks: GRE is the carrier protocol, and IPv6 is the transport protocol. Cisco IOS Software supports IPv4 and IPv6 as passenger protocols with GRE/IPv6. + + +Configuring an IPv4 GRE Tunnel + +Perform the following configuration steps to configure a GRE tunnel. A tunnel interface is used to transport protocol traffic across a network that does not normally support the protocol. To build a tunnel, a tunnel interface must be defined on each of two routers and the tunnel interfaces must reference each other. At each router, the tunnel interface must be configured with a Layer 3 address. The tunnel endpoints, tunnel source, and tunnel destination must be +defined, and the type of tunnel must be selected. Optional steps can be performed to customize the tunnel. + + +Router(confi Moves to interface configuration mode g)# +interface tunnel 0 + + + +Router(confi +g-if)# + +Specifies the encapsulation protocol to be used in the +tunnel. By default, the tunnel protocol is GRE and the + +tunnel mode transport protocol is IPv4; therefore entering this gre ip command is optional and won’t appear in the device’s +running configuration + + + +Router(confi Assigns an IP address and subnet mask to the tunnel g-if)# ip interface +address 192.168.1.1 255.255.255. 0 + + + + +Router(confi g-if)# tunnel source 209.165.201. 1 + + + +Or + +Identifies the local source of the tunnel. You can use either an interface name or the IP address of the interface that will transmit tunneled packets + + + + + +Note + + +The tunnel source can be a physical interface or a loopback interface + + + + +Router(confi g-if)# +tunnel source gigabitether net 0/0/0 + + + + +Router(confi g-if)# tunnel destination 198.51.100.1 + + + +Router(confi g-if)# bandwidth 8192 + + + +Router(confi +g-if)# + +Identifies the remote destination IP address + + + + + + + + + + +Defines the tunnel bandwidth for use with a routing protocol or QoS in kilobits per second. In the example, the bandwidth is set to 8192 Kbps + + + + +Sets the tunnel keepalives to 3 seconds and the number +of retries to five to ensure that bidirectional + + + +keepalive 3 +5 + + +communication exists between tunnel endpoints. The +default timer is 10 seconds, with three retries + + + + +Router(confi Set the maximum transmission unit (MTU) size of IP g-if)# ip packets sent on an interface to 1400 bytes. The default mtu 1400 MTU is 1500 bytes + + + + + +Note + + +The GRE tunnel adds a minimum of 24 bytes to the packet size + + + + + + +Configuring an IPv6 GRE Tunnel +The same process that is described for IPv4 is used to configure an IPv6 GRE tunnel. + + +Router(config) Moves to interface configuration mode # interface +tunnel 1 + + + +Router(config- Specifies the encapsulation protocol to be used in the if)# tunnel tunnel +mode gre ipv6 + + + +Router(config- Assigns an IPv6 address and subnet mask to the if)# ip tunnel interface +address 2001:db8:192:1 00::1/64 + + + +Router(config- Identifies the local source of the tunnel. You can use if)# tunnel either an interface name or the IPv6 address of the + +source 2001:db8:209:2 01::1 + + + +Or + +interface that will transmit tunneled packets + + + + + +Note + + +The tunnel source can be a physical interface or a loopback interface + + + + +Router(config-if)# tunnel source gigabitetherne t 0/0/0 +Router(config- Identifies the remote destination IPv6 address if)# tunnel +destination 2001:db8:198:5 1::1 + + + +Router(config- Defines the tunnel bandwidth for use with a routing + +if)# bandwidth +4096 + +protocol or QoS in kilobits per second. In the +example, the bandwidth is set to 4096 Kbps + + + + +Router(config- Sets the tunnel keepalives to 3 seconds and the if)# keepalive number of retries to five to ensure that bidirectional 3 5 communication exists between tunnel endpoints. +The default timer is 10 seconds, with three retries + + + +Router(config- Set the maximum transmission unit (MTU) size of + +if)# ipv6 mtu +1400 + +IPv6 packets sent on an interface to 1400 bytes. The +default MTU is 1500 bytes + + + + + + +Note + + +The GRE tunnel adds a minimum of 24 bytes to the packet size + + + + + + +Verifying IPv4 and IPv6 GRE Tunnels + + +Router# show interfaces Displays general information about tunnel number the tunnel interface + + + +Router# show ip interface Displays IPv4 information about tunnel number the tunnel interface +Router# show ipv6 Displays IPv6 information about interface tunnel number the tunnel interface + + + +Configuration Example: IPv4 and IPv6 GRE Tunnels with OSPFv3 + +Figure 13-1 shows the network topology for the configuration that follows, which demonstrates how to configure IPv4 and IPv6 GRE tunnels to allow for OSPFv3 connectivity between two customer edge routers that peer with separate ISP routers. This example assumes that ISP1 and ISP2 are configured to route traffic across the underlay network between CE1 and CE2. Tunnel 0 is used for IPv4 and Tunnel 1 is used for IPv6. + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 13-1 Network Topology for IPv4/IPv6 GRE Example + + + +The example is built following these steps: + + +Step 1. Underlay configuration (physical/logical interfaces, default routing). +Step 2. Overlay configuration (tunnel interfaces). + +Step 3. Overlay routing with OSPFv3. + + +Step 1: Underlay Configuration + + + +CE1(config)# ipv6 unicast- +routing + +Enables routing for IPv6 +packets + + + + +CE1(config)# interface Enters interface configuration gigabitethernet 0/0/0 mode + + + +CE1(config-if)# ip address Applies an IPv4 address to the 209.165.201.1 255.255.255.252 interface + + + +CE1(config-if)# ipv6 address Applies an IPv6 address to the 2001:db8:209:201::1/64 interface + + + +CE1(config-if)# no shutdown Enables the interface + + + +CE1(config-if)# exit Exits interface configuration mode + + + +CE1(config)# interface Enters interface configuration loopback 0 mode + + + +CE1(config-if)# ip address Applies an IPv4 address to the 10.1.1.1 255.255.255.0 interface + + + +CE1(config-if)# ipv6 address Applies an IPv6 address to the 2001:db8:10:1::1/64 interface +CE1(config-if)# exit Exits interface configuration mode + + + +CE1(config)# ip route 0.0.0.0 Defines an IPv4 default route 0.0.0.0 209.165.201.2 to send all packets to ISP1 + + + +CE1(config)# ipv6 route ::/0 Defines an IPv6 default route 2001:db8:209:201::2 to send all packets to ISP1 + + + + +CE2(config)# ipv6 unicast- +routing + +Enables routing for IPv6 +packets + + + + +CE2(config)# interface Enters interface configuration gigabitethernet 0/0/0 mode + + + +CE2(config-if)# ip address Applies an IPv4 address to the 198.51.100.1 255.255.255.252 interface + + + +CE2(config-if)# ipv6 address Applies an IPv6 address to the 2001:db8:198:51::1/64 interface + + + +CE2(config-if)# no shutdown Enables the interface + + + +CE2(config-if)# exit Exits interface configuration mode + + + +CE2(config)# interface Enters interface configuration loopback 0 mode + + + +CE2(config-if)# ip address Applies an IPv4 address to the +10.2.2.1 255.255.255.0 interface + + + +CE2(config-if)# ipv6 address Applies an IPv6 address to the 2001:db8:10:2::1/64 interface + + + +CE2(config-if)# exit Exits interface configuration mode + + + +CE2(config)# ip route 0.0.0.0 Defines an IPv4 default route 0.0.0.0 198.51.100.2 to send all packets to ISP1 + + + +CE2(config)# ipv6 route ::/0 Defines an IPv6 default route 2001:db8:198:51::2 to send all packets to ISP1 + + + +Step 2: Overlay Configuration + + +CE1(config)# Enters interface configuration mode interface tunnel 0 + + + +CE1(config-if)# ip Applies an IPv4 address to the interface address 192.168.1.1 +255.255.255.0 + + + +CE1(config-if)# Defines the physical source of the tunnel tunnel source +gigabitethernet 0/0/0 + + + +CE1(config-if)# Defines the tunnel destination across the tunnel destination underlay network +198.51.100.1 +CE1(config-if)# Enables GRE tunnel mode for IPv4. This is tunnel mode gre ip the default value and won’t appear in the +running configuration + + + +CE1(config-if)# ip Lowers the MTU to 1400 bytes from its mtu 1400 default of 1500 + + + +CE1(config-if)# Enables IPv6 on the interface. This is +ipv6 enable required for OSPFv3 routing in the next step since there is no IPv6 address on Tunnel 0 + + + +CE1(config-if)# Enters interface configuration mode interface tunnel 1 + + + +CE1(config-if)# Applies an IPv6 address to the interface ipv6 address +2001:db8:192:100::1 /64 + + + +CE1(config-if)# Defines the physical source of the tunnel tunnel source +gigabitethernet 0/0/0 + + + +CE1(config-if)# Defines the tunnel destination across the tunnel destination underlay network 2001:db8:198:51::1 + + + +CE1(config-if)# Enables GRE tunnel mode for IPv6 tunnel mode gre +ipv6 +CE2(config)# Enters interface configuration mode interface tunnel 0 + + + +CE2(config-if)# ip Applies an IPv4 address to the interface address 192.168.1.2 +255.255.255.0 + + + +CE2(config-if)# Defines the physical source of the tunnel tunnel source +gigabitethernet 0/0/0 + + + +CE2(config-if)# Defines the tunnel destination across the tunnel destination underlay network +209.165.201.1 + + + +CE2(config-if)# Enables GRE tunnel mode for IPv4. This is tunnel mode gre ip the default value and won’t appear in the +running configuration + + + +CE2(config-if)# ip Lowers the MTU to 1400 bytes from its mtu 1400 default of 1500 + + + +CE2(config-if)# Enables IPv6 on the interface. This is +ipv6 enable required for OSPFv3 routing in the next step since there is no IPv6 address on Tunnel 0 + + + +CE2(config-if)# Enters interface configuration mode interface tunnel 1 +CE2(config-if)# Applies an IPv6 address to the interface ipv6 address +2001:db8:192:100::2 /64 + + + +CE2(config-if)# Defines the physical source of the tunnel tunnel source +gigabitethernet 0/0/0 + + + +CE2(config-if)# Defines the tunnel destination across the tunnel destination underlay network 2001:db8:209:201::1 + + + +CE2(config-if)# Enables GRE tunnel mode for IPv6 tunnel mode gre +ipv6 + + + +Step 3: Overlay Routing with OSPFv3 + + +CE1(config)# router Starts OSPFv3 with a process ID of 1 ospfv3 1 + + + +CE1(config-router)# Creates the IPv4 unicast address address-family ipv4 family +unicast + + + +CE1(config-router-af)# Defines a router ID of 1.1.1.1 router-id 1.1.1.1 + + + +CE1(config-router-af)# Creates the IPv6 unicast address +address-family ipv6 family unicast + + + +CE1(config-router-af)# Defines a router ID of 1.1.1.1 router-id 1.1.1.1 + + + +CE1(config-router-af)# Enters interface configuration mode interface tunnel 0 + + + +CE1(config-if)# ospfv3 1 Assigns the Tunnel 0 interface to area ipv4 area 0 0 for the OSPFv3 IPv4 address family + + + +CE1(config-if)# Enters interface configuration mode interface tunnel 1 + + + +CE1(config-if)# ospfv3 1 Assigns the Tunnel 1 interface to area ipv6 area 0 0 for the OSPFv3 IPv6 address family + + + +CE1(config-router-af)# Enters interface configuration mode interface loopback 0 + + + +CE1(config-if)# ospfv3 1 Assigns the Loopback 0 interface to ipv4 area 1 area 1 for the OSPFv3 IPv4 address +family + + + +CE1(config-if)# ospfv3 1 Assigns the Loopback 0 interface to ipv6 area 1 area 1 for the OSPFv3 IPv6 address +family + + + +CE2(config)# router Starts OSPFv3 with a process ID of 1 ospfv3 1 +CE2(config-router)# Creates the IPv4 unicast address address-family ipv4 family +unicast + + + +CE2(config-router-af)# Defines a router ID of 2.2.2.2 router-id 2.2.2.2 + + + +CE2(config-router-af)# Creates the IPv6 unicast address address-family ipv6 family +unicast + + + +CE2(config-router-af)# Defines a router ID of 2.2.2.2 router-id 2.2.2.2 + + + +CE2(config-router-af)# Enters interface configuration mode interface tunnel 0 + + + +CE2(config-if)# ospfv3 1 Assigns the Tunnel 0 interface to area ipv4 area 0 0 for the OSPFv3 IPv4 address family + + + +CE2(config-if)# Enters interface configuration mode interface tunnel 1 + + + +CE2(config-if)# ospfv3 1 Assigns the Tunnel 1 interface to area ipv6 area 0 0 for the OSPFv3 IPv6 address family + + + +CE2(config-router-af)# Enters interface configuration mode interface loopback 0 + + + +CE2(config-if)# ospfv3 1 Assigns the Loopback 0 interface to +ipv4 area 1 area 1 for the OSPFv3 IPv4 address family + + + +CE2(config-if)# ospfv3 1 Assigns the Loopback 0 interface to ipv6 area 1 area 1 for the OSPFv3 IPv6 address +family + + + +SITE-TO-SITE GRE OVER IPSEC + +In GRE over IPsec (usually written GRE/IPsec for short), data packets are first encapsulated within GRE/IP, which results in a new IP packet being created inside the router. This packet is then selected for encryption (the traffic selector being GRE from local to remote endpoint IP address), and encapsulated into IPsec. Since a new IP header has already been added, IPsec transport mode is generally used to keep the overhead to a minimum. There are two different ways to encrypt traffic over a GRE tunnel: + + +Using crypto maps (old method) + +Using tunnel IPsec profiles (newer method) + + + + +Note +Even though crypto maps are no longer recommended for tunnels, theyare still widelydeployed and should be understood. + + + +The two GRE configuration scenarios that follow build on the previous GRE example but focus only on IPv4. You would configure one of the two scenarios, not both. Refer to Figure 13-1 for addressing information. + +GRE/IPsec Using Crypto Maps +After the GRE tunnel has been configured, follow these steps to enable IPsec using crypto maps: + +Step 1. Define a crypto ACL. + +Step 2. Configure an ISAKMP policy for IKE SA. + +Step 3. Configure pre-shared keys (PSKs). + +Step 4. Create a transform set. + +Step 5. Build a crypto map. + +Step 6. Apply the crypto map to the outside interface. + + +Step 1: Define a Crypto ACL + + +CE1(config)# access-list Defines the crypto ACL that +101 permit gre host identifies traffic entering the GRE + +192.168.1.1 host +192.168.1.2 + +tunnel. This traffic is encrypted by +IPsec + + + + +CE2(config)# access-list The crypto ACL on CE2 is a mirror 101 permit gre host image of the ACL on CE1 192.168.1.2 host +192.168.1.1 + + + +Step 2: Configure an ISAKMP Policy for IKE SA (repeat on CE2) + + +CE1(config)# crypto Creates an ISAKMP policy number 1. isakmp policy 1 Numbers range from 1 to 1000 + + + +CE1(config-isakmp)# Enables the use of PSKs for authentication. authentication pre- Option to use RSA signatures instead share +CE1(config-isakmp)# Enables SHA-256 for hashing. Options are hash sha256 MD5, SHA, SHA-256, SHA-384, and SHA-512 + + + +CE1(config-isakmp)# Enables AES-256 for encryption. Options are encryption aes 256 DES, 3DES, and AES (128, 192, 256 bit) + + + +CE1(config-isakmp)# Enables Diffie-Hellman group 14 for key group 14 exchange. Options are group 1, 2, 5, 14, 15, 16, +19, 20, 21, or 24 + + + +Step 3: Configure PSKs + + +CE1(config)# crypto isakmp key Defines a PSK for secretkey address 198.51.100.1 neighbor peer CE2 + + + +CE2(config)# crypto isakmp key Defines a PSK for secretkey address 209.165.201.1 neighbor peer CE1 + + + +Step 4: Create a Transform Set (repeat on CE2) + + +CE1(config)# crypto Defines an IPsec transform set called GRE-ipsec transform-set SEC that uses ESP with AES-256 for +GRE-SEC esp-aes 256 encryption and SHA-256 for + +esp-sha256-hmac + + + +CE1(cfg-crypto- + +authentication. Options are AH and MD5 + + + +Enables transport mode to avoid double + +trans)# mode encapsulation from GRE and IPsec. The transport other option available is tunnel mode + + + +Step 5: Build a Crypto Map (repeat on CE2 except for the peer configuration) +CE1(config)# crypto Creates an IPsec crypto map called +map GREMAP 1 ipsec- GREMAP with a sequence number of 1. isakmp Range is from 1 to 65535 + + + + + +Note + + +Amessage will appear at the console indicating that the crypto map will remain disabled until a peer and a valid ACLhave been configured + + + + + +CE1(config-crypto- Applies the previously configured crypto map)# match address ACL to the crypto map +101 + + + +CE1(config-crypto- Applies the previously configured map)# set transform- transform set to the crypto map set GRE-SEC + + + +CE1(config-crypto- Sets the remote peer, which in this case is map)# set peer CE2 +198.51.100.1 + + + +CE2(config-crypto- Sets the remote peer, which in this case is map)# set peer CE1 +209.165.201.1 + + + +Step 6: Apply the Crypto Map to Outside Interface (repeat on CE2) + + +CE1(config)# interface Enters interface configuration mode gigabitethernet 0/0/0 +CE1(config-if)# crypto Applies the crypto map to the outside map GREMAP interface connected to the ISP router + + + +GRE/IPsec Using IPsec Profiles + +After the GRE tunnel has been configured, follow these steps to enable IPsec using IPsec profiles: + +Step 1. Configure an ISAKMP policy for IKE SA. + +Step 2. Configure PSKs. + +Step 3. Create a transform set. + +Step 4. Create an IPsec profile. + +Step 5. Apply the IPsec profile to the tunnel interface. + + +Step 1: Configure an ISAKMP Policy for IKE SA (repeat on CE2) + + +CE1(config)# crypto Creates an ISAKMP policy number 1. isakmp policy 1 Numbers range from 1 to 1000 + + + +CE1(config-isakmp)# Enables the use of PSKs for authentication. authentication pre- Option to use RSA signatures instead share + + + +CE1(config-isakmp)# Enables SHA-256 for hashing hash sha256 + +Options are MD5, SHA, SHA-256, SHA-384, SHA-512 + + + +CE1(config-isakmp)# Enables AES-256 for encryption encryption aes 256 +Options are DES, 3DES, and AES (128, 192, 256 bit) + + + +CE1(config-isakmp)# Enables Diffie-Hellman group 14 for key group 14 exchange. Options are group 1, 2, 5, 14, 15, 16, +19, 20, 21, or 24 + + + +Step 2: Configure PSKs + + +CE1(config)# crypto isakmp key Defines a PSK for secretkey address 198.51.100.1 neighbor peer CE2 + + + +CE2(config)# crypto isakmp key Defines a PSK for secretkey address 209.165.201.1 neighbor peer CE1 + + + +Step 3: Create a Transform Set (repeat on CE2) + + +CE1(config)# crypto Defines an IPsec transform set called GRE-ipsec transform-set SEC that uses ESP with AES-256 for +GRE-SEC esp-aes 256 encryption and SHA-256 for + +esp-sha256-hmac + + + +CE1(cfg-crypto- + +authentication. Options are AH and MD5 + + + +Enables transport mode to avoid double + +trans)# mode encapsulation from GRE and IPsec. The transport other option is available is tunnel mode + + + +Step 4: Create an IPsec Profile (repeat on CE2) + + +CE1(config)# crypto ipsec Creates an IPsec profile named GRE-profile GRE-PROFILE PROFILE +CE1(ipsec-profile)# set Applies the previously configured transform-set GRE-SEC transform set to the IPsec profile + + + +Step 5: Apply the IPsec Profile to Tunnel Interface (repeat on CE2) + + +CE1(config)# interface Enters interface configuration mode tunnel 0 + + + +CE1(config-if)# tunnel Applies the IPsec profile to the tunnel protection ipsec interface, allowing IPsec to encrypt traffic profile GRE-PROFILE flowing between CE1 and CE2 + + + +Verifying GRE/IPsec + + +CE1# show crypto Displays current Internet Key Exchange (IKE) isakmp sa security associations (SAs) + + + +CE1# show crypto Displays the settings used by IPsec security ipsec sa associations + + + +SITE-TO-SITE VIRTUAL TUNNEL INTERFACE (VTI) OVER IPSEC + +The use of IPsec virtual tunnel interfaces (VTIs) simplifies the configuration process when you must provide protection for site-to-site VPN tunnels. A major benefit of IPsec VTIs is that the configuration does not require a static mapping of IPsec sessions to a physical interface. The use of IPsec VTIs simplifies the configuration process when you must provide protection for site-to-site VPN tunnels and offers a simpler alternative to the use of Generic Routing Encapsulation (GRE) tunnels for encapsulation +and crypto maps with IPsec. + + +The steps to enable a VTI over IPsec are very similar to those for GRE over IPsec configuration using IPsec profiles. The only difference is the addition of the command tunnel mode ipsec {ipv4 | ipv6} under the GRE tunnel interface to enable VTI on it and to change the packet transport mode to tunnel mode. To revert to GRE over IPsec, the command tunnel mode gre {ip | ipv6} is used. + +Assuming that the GRE tunnel is already configured for IPsec using IPsec profiles as was described in the previous configuration example, you would need to make the following changes to migrate to a VTI over IPsec site-to-site tunnel using pre-shared keys: + +CE1 + + +CE1(config)# crypto Defines an IPsec transform set called GRE-ipsec transform-set SEC that uses ESP with AES-256 for +GRE-SEC esp-aes 256 encryption and SHA-256 for + +esp-sha256-hmac + + + +CE1(cfg-crypto- + +authentication. Options are AH and MD5 + + + +Enables tunnel mode for VTI support + +trans)# mode tunnel + + + +CE1(cfg-crypto- Exits the transform set trans)# exit + + + +CE1(config)# Enters interface configuration mode interface tunnel 0 + + + +CE1(config-if)# Enables IPsec for IPv4 on the tunnel +tunnel mode ipsec interface ipv4 + + + +CE2 + + +CE2(config)# crypto Defines an IPsec transform set called GRE-ipsec transform-set SEC that uses ESP with AES-256 for +GRE-SEC esp-aes 256 encryption and SHA-256 for + +esp-sha256-hmac + + + +CE2(cfg-crypto- + +authentication. Options are AH and MD5 + + + +Enables tunnel mode for VTI support + +trans)# mode tunnel + + + +CE2(cfg-crypto- Exits the transform set trans)# exit + + + +CE2(config)# Enters interface configuration mode interface tunnel 0 + + + +CE2(config-if)# Enables IPsec for IPv4 on the tunnel tunnel mode ipsec interface +ipv4 + + + +CISCO DYNAMIC MULTIPOINT VPN (DMVPN) + +Cisco DMVPN is a solution that leverages IPsec and GRE to enable enterprises to establish a secure connection in a hub-and-spoke network or spoke-to-spoke network easily and effectively. All of the spokes in a DMVPN network are configured to connect to the hub and, when interesting traffic calls for it, each spoke can connect directly to another spoke as well. +DMVPN uses two primary technologies: + + +Multipoint GRE (mGRE) with IPsec, which allows the routers in the solution to establish multiple GRE tunnels using only one configured tunnel interface + +Next Hop Resolution Protocol (NHRP), which is similar to ARP on Ethernet + + +There are three different deployment options for DMVPN, which are called phases: + + +Phase 1: This phase can be deployed only as a hub-and-spoke tunnel deployment. In this deployment the hub is configured with an mGRE tunnel interface and the spokes have point-to-point GRE tunnel interface configurations. All traffic, including inter-spoke traffic, must traverse the hub. + +Phase 2: This phase improves on Phase 1 by establishing a mechanism for spokes to build dynamic spoke-to-spoke tunnels on demand. Spokes in this deployment type have mGRE tunnel interfaces and learn of their peer spoke addresses and specific downstream routes using a routing protocol. + +Phase 3: This phase is very similar to Phase 2, but the routing table must have the spoke address and all specific downstream routes propagated to all other spokes. This means that the hub cannot use summarization of routes in the routing protocol. The hub uses NHRP redirect messages to inform the spoke of a more effective path to the spoke’s network, and the spoke will accept the “shortcut” and build the dynamic tunnel to the peer spoke. + + +Configuration Example: Cisco DMVPN for IPv4 + +Figure 13-2 shows the network topology for the configuration that +follows, which demonstrates how to configure Cisco DMVPN for IPv4. The example shows you how to configure all three DMVPN phases and assumes that the physical interfaces are already configured with IP addresses. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 13-2 Network Topology for Cisco DMVPN for IPv4 Example + + + +When configuring Cisco DMVPN, follow these steps: + + +1. Configure an ISAKMP policy for IKE SA. + +2. Configure pre-shared keys (PSKs). + +3. Create a transform set. + +4. Create a crypto IPsec profile. + +5. Define an mGRE tunnel interface. + +6. Enable NHRP on the tunnel interface. +7. Apply the IPsec security profile to the tunnel interface. + +8. Enable dynamic routing across the tunnel interface. + + +DMVPN Phase 1: Hub Router + + +Hub(config)# Creates an ISAKMP policy with the number 10 crypto isakmp +policy 10 + + + +Hub(config- Enables AES-256 encryption isakmp)# +encryption aes 256 + + +Hub(config- Enables SHA-256 hashing isakmp)# hash +sha256 + + + + +Hub(config-isakmp)# authentication pre-share + + + +Hub(config- + +Enables PSK authentication + + + + + + + + + +Enables Diffie-Hellman group 16 (4096-bit) + +isakmp)# group 16 + + + +Hub(config- Exits the ISAKMP policy isakmp)# exit + + + +Hub(config)# Defines a PSK to be used for any ISAKMP neighbor crypto isakmp +key CiscoDMVPNKey address 0.0.0.0 + + + +Hub(config)# Creates an IPsec transform set called DMVPNset that crypto ipsec uses AES-256 and SHA-256 for ESP +transform-set DMVPNset esp-aes 256 esp-sha256-hmac + + + +Hub(cfg- Enables tunnel mode for the IPsec tunnel crypto-trans)# +mode transport + + + + +Hub(cfg-crypto-trans)# exit + + + +Hub(config)# + +Exits the transform set + + + + + + + +Creates an IPsec profile called DMVPNprofile + +crypto ipsec profile DMVPNprofile + + + +Hub(ipsec- Applies the DMVPNset transform set profile)# set +transform-set DMVPNset + + + +Hub(ipsec- Exits the IPsec profile profile)# exit +Hub(config)# Enters interface configuration mode interface +tunnel 0 + + + +Hub(config- Applies an IP address to the tunnel interface if)# ip +address 10.99.1.1 255.255.255.0 + + + +Hub(config- Disables ICMP redirects, because NHRP will be if)# no ip responsible for sending redirect messages redirects + + + +Hub(config- Reduces the IP MTU from 1500 to 1400 bytes if)# ip mtu +1400 + + + +Hub(config- Reduces the TCP maximum segment size to 1360 if)# ip tcp +adjust-mss 1360 + + + +Hub(config- Configures a password of cisco for NHRP if)# ip nhrp authentication +authentication cisco + + + +Hub(config- Allows NHRP to automatically add spoke routers to if)# ip nhrp the multicast NHRP mappings when these spoke map multicast routers initiate the mGRE tunnel and register their +dynamic + + + +Hub(config- + + +unicast NHRP mappings + + + +Defines an NHRP network ID + +if)# ip nhrp network-id 123 + + + +Hub(config- Specifies a tunnel source if)# tunnel +source gigabitetherne t 0/0/0 + + + +Hub(config- Enables mGRE on the Hub router0 if)# tunnel +mode gre multipoint + + + +Hub(config- Uniquely identifies the tunnel within the router if)# tunnel +key 12345 + + + +Hub(config- Applies the IPsec security profile to secure the if)# tunnel DMVPN packet exchange +protection ipsec profile DMVPNprofile + + + +Hub(config- Exits interface configuration mode if)# exit + + + +Hub(config)# Enables EIGRP using named mode configuration +router eigrp CISCO + + +Hub(config- Creates an IPv4 address family for AS 10 router)# +address-family ipv4 unicast autonomous-system 10 + + + +Hub(config-router-af)# network 172.16.1.1 0.0.0.0 + + + +Hub(config-router-af)# network 10.99.1.0 0.0.0.255 + + + +Hub(config-router-af)# +af-interface + +Advertises network 172.16.1.1/32 + + + + + + + + + + +Advertises network 10.99.1.0/24 (the tunnel interface network) + + + + + + + + +Enters address-family interface configuration mode +for Tunnel 0 + +tunnel 0 + + + + +Hub(config-router-af- +interface)# no + +Disables split horizon to allow the hub to retransmit routes learned from the peers to the other peers. +Because all the routes are being learned through the + +split-horizon tunnel interface, EIGRP will not by default advertise routes learned from an interface back out the same +interface + + + +DMVPN Phase 1: Spoke1 Router (similar configuration required on Spoke2) + + +Spoke1(config)# Creates an ISAKMP policy with the number crypto isakmp policy 10 +10 + + + +Spoke1(config- Enables AES-256 encryption isakmp)# encryption +aes 256 + + + +Spoke1(config- Enables SHA-256 hashing isakmp)# hash sha256 + + + +Spoke1(config- Enables PSK authentication isakmp)# +authentication pre-share + + +Spoke1(config- Enables Diffie-Hellman group 16 (4096-bit) isakmp)# group 16 + + + +Spoke1(config- Exits the ISAKMP policy isakmp)# exit + + + +Spoke1(config)# Defines a PSK to be used for any ISAKMP crypto isakmp key neighbor +CiscoDMVPNKey address 0.0.0.0 +Spoke1(config)# Creates an IPsec transform set called crypto ipsec DMVPNset that uses AES-256 and SHA-256 transform-set for ESP +DMVPNset esp-aes 256 esp-sha256-hmac + + + +Spoke1(cfg-crypto- Enables tunnel mode for the IPsec tunnel trans)# mode +transport + + + +Spoke1(cfg-crypto- Exits the transform set trans)# exit + + + +Spoke1(config)# Creates an IPsec profile called crypto ipsec profile DMVPNprofile DMVPNprofile + + + +Spoke1(ipsec- Applies the DMVPNset transform set profile)# set +transform-set DMVPNset + + + +Spoke1(ipsec- Exits the IPsec profile profile)# exit + + + +Spoke1(config)# Enters interface configuration mode interface tunnel 0 + + + +Spoke1(config-if)# Applies an IP address to the tunnel interface ip address +10.99.1.101 +255.255.255.0 + + + +Spoke1(config-if)# Disables ICMP redirects, because NHRP will no ip redirects be responsible for sending redirect messages + + + +Spoke1(config-if)# Reduces the IP MTU from 1500 to 1400 ip mtu 1400 bytes + + + +Spoke1(config-if)# Reduces the TCP maximum segment size to ip tcp adjust-mss 1360 +1360 + + + +Spoke1(config-if)# Configures a password of cisco for NHRP ip nhrp authentication +authentication cisco + + + +Spoke1(config-if)# Maps the hub tunnel interface and physical ip nhrp map interface together. This instructs the router 10.99.1.1 10.99.0.1 that NHRP messages to the Hub router +should be sent to the physical IP address + + + +Spoke1(config-if)# Maps NHRP multicast traffic to the physical ip nhrp map address of the Hub router +multicast 10.99.0.1 + + + +Spoke1(config-if)# Defines an NHRP network ID ip nhrp network-id +123 + + + +Spoke1(config-if)# Defines the NHRP server address ip nhrp nhs +10.99.1.1 + + + +Spoke1(config-if)# Specifies a tunnel source tunnel source +gigabitethernet 0/0/0 + + + +Spoke1(config-if)# Defines the Hub router’s physical address as tunnel destination the tunnel destination +10.99.0.1 + + + +Spoke1(config-if)# Enables standard GRE on the Spoke1 router tunnel mode gre ip + + + +Spoke1(config-if)# Uniquely identifies the tunnel within the tunnel key 12345 router + + + +Spoke1(config-if)# Applies the IPsec security profile to secure tunnel protection the DMVPN packet exchange +ipsec profile DMVPNprofile + + + + +Spoke1(config-if)# exit + + + +Spoke1(config)# + +Exits interface configuration mode + + + + + +Enables EIGRP using named mode + +router eigrp CISCO configuration + + + +Spoke1(config- Creates an IPv4 address family for AS 10 router)# address- +family ipv4 unicast +autonomous-system 10 + + + +Spoke1(config- Advertises network 172.16.101.1/32 router-af)# network +172.16.101.1 0.0.0.0 + + + + +SPOKE1(config- Advertises network 10.99.1.0/24 (the tunnel router-af)# network interface network) +10.99.1.0 0.0.0.255 + + + +For DMVPN Phase 2, you need to change the tunnel mode on the spokes and modify the routing configuration on the hub. Contrary to Phase 1, this configuration will allow the routers to build dynamic spoke-to-spoke tunnels based on traffic needs. The tunnel to the hub will be persistent. + +DMVPN Phase 2: Hub Router + + +Hub(config)# Enters EIGRP using named mode configuration router +eigrp CISCO + + + +Hub(config- Enters the IPv4 address family for AS 10 router)# +address-family ipv4 unicast autonomous-system 10 + + + +Hub(config- +router-af)# + +Enters address-family interface configuration mode for +Tunnel 0 +af-interface tunnel 0 + + + + +Hub(config-router-af- +interface)# + +Disables the EIGRP next-hop self feature. By default, the router will insert its IP address as the next hop on +the updates sent to the peers. In Phase 2 DMVPN the + +no next-hop- spokes must see the tunnel interface IP address of the self other spokes as the next hop for the remote networks, +instead of the hub + + + +DMVPN Phase 2: Spoke1 Router (identical configuration required on Spoke2) + + + +Spoke1(config)# interface tunnel +0 + +Enters interface +configuration mode + + + + +Spoke1(config-if)# no tunnel Removes the tunnel destination 10.99.0.1 destination command + + + +Spoke1(config-if)# tunnel mode Changes the tunnel mode to gre multipoint mGRE + + +Phase 3 DMVPN is designed for the hub to only advertise a summary address to the spokes, and only when there is a better route to the destination network will the hub tell the spoke about it. This is done using an NHRP traffic indication message to signal the spoke that a better path exists. To do this, you need to make a few configuration changes. + +DMVPN Phase 3: Hub Router + + +Hub(config)# interface Enters interface configuration mode +tunnel 0 + + + +Hub(config-if)# ip NHRP Redirect is configured on the hub, nhrp redirect instructing it to send the NHRP traffic +indication message if a better route exists + + + +Hub(config-if)# exit Exits interface configuration mode + + + +Hub(config)# router Enters EIGRP using named mode eigrp CISCO configuration + + + +Hub(config-router)# Enters the IPv4 address family for AS 10 address-family ipv4 +unicast autonomous-system 10 + + + +Hub(config-router-af)# Enters address-family interface af-interface tunnel 0 configuration mode for Tunnel 0 + + + +Hub(config-router-af- Advertises a summary address. In this interface)# summary- case the summary advertised is an address 0.0.0.0 EIGRP default route (D*) +0.0.0.0 + + + +DMVPN Phase 3: Spoke1 Router (identical configuration required on Spoke2) + + +Spoke1 Enters interface configuration mode (confi +g)# +interf ace tunnel 0 + + + +Spoke1 Enables NHRP shortcut switching on the interface. This allows (confi the spoke router to discover shorter paths to a destination +g-if)# network after receiving an NHRP redirect message from the ip hub. The spokes can then communicate directly with each nhrp other without the need for an intermediate hop +shortc ut + + + +Verifying Cisco DMVPN + + +Router# show dmvpn Displays DMVPN-specific session information + + + + +Router# show ip nhrp + + + +Router# show ip nhrp + +Displays NHRP mapping information + + + +Displays NHRP NHS information + +nhs detail + + + + +Router# debug dmvpn + + + + + +Router# debug nhrp + +Displays real-time information about DMVPN sessions + + + +Displays real-time information about +NHRP + + + + + + +Note +Running OSPF over a DMVPN network has some of the same challenges as running OSPF over other types of +networks. Because onlythe hub is in direct communication with all of the branches, it should be configured as the designated router (DR) on the DMVPN subnet. There is not typicallya backup DR (BDR) for this type of configuration. ABDR is possible if a second hub is placed on the same subnet. +In strict hub-and-spoke DMVPNs, you should include the tunnel interface in the OSPF routing process and configure the tunnel interface as a point-to-multipoint OSPF network type on the hub router, and as a point-to-point network type on the branch routers. In this case, there is no need to elect a DR on the DMVPN subnet. +To create a partiallymeshed or fullymeshed DMVPN, configure the mGRE tunnel on the hub router as an OSPF broadcast network. Each spoke router should be configured with an OSPF priorityof 0 to prevent a spoke from becoming a DR or BDR. + + + +VRF-LITE + +Virtual routing and forwarding (VRF) is a technology that creates separate virtual routers on a physical router. Router interfaces, routing tables, and forwarding tables are completely isolated between VRFs, preventing traffic from one VRF from forwarding into another VRF. All router interfaces belong to the global VRF until they are specifically assigned to a user-defined VRF. The global VRF is identical to the regular routing table of non-VRF routers. + +The use of Cisco VRF-Lite technology has the following advantages: + + +Allows for true routing and forwarding separation + +Simplifies the management and troubleshooting of the traffic belonging to the specific VRF, because separate forwarding tables are used to switch that traffic + +Enables the support for alternate default routes + + + +Configuring VRF-Lite + +Follow these steps when configuring a Cisco router for VRF-Lite support: + +Step 1. Create the VRF(s). +Step 2. Assign interface(s) to the VRF. + +Step 3. Enable routing for the VRF. + + +Step 1: Create the VRFs + + +Router(config)# ip Creates an IPv4 VRF called GUEST using vrf GUEST the old VRF CLI format + + + +Router(config-vrf)# Exits VRF configuration mode exit + + + +Router(config)# vrf Creates a VRF called STAFF using the new definition STAFF VRF CLI format + + + +Router(config-vrf)# Enables the IPv4 address family for the address-family ipv4 STAFF VRF using the new VRF CLI format + + + +Router(config-vrf- Exits the IPv4 address family af)# exit + + + +Router(config-vrf)# Enables the IPv6 address family for the address-family ipv6 STAFF VRF using the new VRF CLI format + + + +Router(config-vrf- Exits the IPv6 address family af)# exit + + + +Router(config-vrf)# Exits VRF configuration mode exit + + + +Step 2: Assign an Interface to the VRF +Router(config)# Enters interface configuration mode interface +gigabitethernet 0/0/0 + + + +Router(config-if)# ip Assigns the GigabitEthernet 0/0/0 vrf forwarding GUEST interface to the GUEST VRF using the +old CLI format + + + +Router(config-if)# Enters interface configuration mode interface +gigabitethernet 0/0/1 + + + +Router(config-if)# vrf Assigns the GigabitEthernet 0/0/1 forwarding STAFF interface to the STAFF VRF using the +new CLI format + + + +Step 3: Enable Routing for the VRF + +The following configuration examples demonstrate how IPv4 VRFs can be associated with a routing process. The same commands would apply for IPv6 VRFs. + + +Router(config)# ip route vrf Defines a default route for GUEST 0.0.0.0 0.0.0.0 172.16.16.2 the GUEST VRF + + + + +Router(config)# router ospf 1 vrf +STAFF + +Enables OSPFv2 for the +STAFF VRF + + + + +Router(config)# router ospfv3 1 Enables OSPFv3 + + + +Router(config-router)# address- Assigns the STAFF VRF to +family ipv4 unicast vrf STAFF the IPv4 unicast address family + + + + +Router(config)# router eigrp +CISCO + +Enables EIGRP using +named mode configuration + + + + +Router(config-router)# address- Assigns the GUEST VRF to family ipv4 unicast vrf GUEST the IPv4 unicast address autonomous-system 100 family for AS 100 + + + +Router(config)# router bgp 65001 Enables BGP for AS 65001 + + + +Router(config-router)# address- Assigns the STAFF VRF to family ipv4 vrf STAFF the IPv4 address family + + + +Note +Cisco IOS supports the old and new VRF CLI formats. Old Cisco IOS VRF configuration style supports IPv4 only. New multiprotocol VRF CLI now supports both IPv4 and IPv6. Cisco IOS offers a migration tool that upgrades a VRF instance or all VRFs configured on the router to support multiple address families under the same VRF. The vrf upgrade-cli multi-af-mode {common-policies | non-common-policies} [vrf vrf-name] command is issued in global configuration mode. + + + +Verifying VRF-Lite + + + +Router# show vrf + + + + + +Router# show vrf + +Displays a list of all configured VRFs, their address families, and their interfaces + + + +Provides detailed information about a specific + +detail vrf-name VRF +Part VIII: Appendix +Appendix A + +Create Your Own Journal Here + + + + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ +____________ + + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ + +______________________________________________ ____________ +Index + +NUMBERS + +0.0.0.0/0 summarization, EIGRP, 74–75 + +802.1Q (dot1q) trunking, 4–5 + +802.1x, 307–308 + + +A + +AAA (Authentication, Authorization, Accounting) + +accounting, configurations, 257 + +authentication, 251–252 + +AAA-based local database authentication, 252–253 + +RADIUS authentication, 253–255 + +simple local database authentication, 252 + +TACACS+ authentication, 255–256 + +authorization, configurations, 256–257 + +servers, password storage, 232 + +troubleshooting, 257 + +access lists + +BGP route filtering, 180–182 + +NTP security, 285 + +accounting, configurations, 257 + +ACL (Access Control Lists) + +CoPP traffic flows (permitted), 258 +IPv4 + +extended ACL configurations, 247–248 + +standard ACL configurations, 246–247 + +time-based ACL configurations, 248–249 + +verifying, 251 + +VTY ACL configurations, 249–250 + +IPv6 + +configurations, 250–251 + +verifying, 251 + +AD (Administrative Distance) + +EIGRP IPv4 manual summarization, 71 + +internal/external routes, 143–144 + +AireOS + +Advanced GUI, WLCs, troubleshooting, 318–319 + +CLI, WLCs, troubleshooting, 320–322 + +Monitoring Dashboard GUI, troubleshooting + +wireless client connectivity, 322–326 + +WLCs, 316–318 + +AF (Address Families) + +BGP, 158–160 + +configuration mode, 94–95 + +MP-BGP, 159–160 + +OSPFv3, 93 + +configurations, 120–125 +IPv4, 94 + +IPv6, 94 + +aggregating routes, BGP, 177 + +AH (Authentication Headers), spi, 97 + +allowed VLANs, 4–5 + +applets, EEM, 295, 298 + +area range not-advertise command, OSPF route filtering, 104 + +area x authentication key-chain router configuration command, 97 + +AS (Autonomous Systems) + +AS path attribute prepending (BGP), 169–170 + +path access lists, BGP, 181–182 + +local preference attribute manipulation, 167–169 + +weight attribute manipulation, 166 + +private AS removal, 171 + +ASBR (Autonomous System Border Routers) + +network topologies, 130–131 + +OSPFv3 AF, 94 + +routers, multiarea OSPF configurations, 114–115 + +Asdot, 160 + +Asplain, 160 + +attributes (BGP), 164 + +local preference attribute, 167–169 + +MED attribute, 171–174 +AS path attribute prepending, 169–170 + +weight attribute, 164–165 + +AS path access lists, 166 + +prefix lists, 166–167 + +route maps, 166–167 + +authentication, 251–252 + +802.1x, 307–308 + +AAA-based local databases, 252–253 + +AH, spi, 97 + +area x authentication key-chain router configuration command, 97 + +authentication key-chain command, 66 + +authentication mode command, 66 + +BGP + +between peers, 184 + +verifying, 184 + +EAP, 308–309 + +localEAP, 311–314 + +RADIUS servers (external), 308–309 + +EIGRP, 67 + +classic mode authentication, 67–68 + +named mode authentication, 68–70 + +troubleshooting, 70 + +verifying, 70 + +HSRP, 197 +IP SLAs, 149–150 + +MD5, 97, 233 + +EIGRP named mode authentication, 68–70 + +OSPFv2 authentication, 95–96 + +NTP, 284–285 + +OSPFv2 + +cryptographic authentication, 95–96 + +ip ospf authentication message-digest command, 95 + +MD5, 95–96 + +service password-encryption command, 96 + +SHA-256, 96 + +simple password authentication, 95 + +verifying, 98 + +OSPFv3, 97–98 + +area x authentication key-chain router configuration command, 97 + +ospfv3 x authentication key-chain command, 97 + +verifying, 98 + +pre-shared keys, 306–308 + +RADIUS, 253, 309–314 + +key config-key password-encryption command, 254–255 + +legacy authentication, 253 + +modular authentication, 253–255 + +password encryption aes command, 254–255 +RSA, 234 + +SHA, 68–70, 97 + +simple local databases, 252 + +TACACS+, 255 + +legacy authentication, 255 + +modular authentication, 255–256 + +WebAuth, 314–316 + +wireless clients, 303 + +802.1x, 307–308 + +EAP, 308–314 + +LWA, 314 + +open authentication, 304–306 + +pre-shared keys, 306–308 + +WebAuth, 314–316 + +WPA2, 306–307 + +WLANs, open authentication, 304–306 + +WPA2, 306–307 + +MD5 authentication, 97, 233 + +EIGRP named mode authentication, 68–70 + +OSPFv2 authentication, 95–96 + +authNoPriv security level, SNMP, 267 + +authorization, configurations, 256–257 + +authPriv security level, SNMP, 267 + +auto-cost command, 101 +auto-cost reference-bandwidth command, 101 + +AS (Autonomous System) numbers + +4-byte AS numbers and BGP, 160–161 + +Asdot, 160 + +Asplain, 160 + +auto-summary command, 63, 70, 78 + + +B + +BackboneFast + +PVST+, 44 + +Rapid PVST+, 31, 44 + +STP configurations, 31 + +backups + +Cisco IFS + +configurations, 238 + +to TFTP servers, 238 + +IOS software to TFTP servers, 239 + +bandwidth + +bandwidth command, 77 + +bandwidth-percent command, 66, 77 + +EIGRP, 77 + +reference bandwidth + +auto-cost command, 101 + +auto-cost reference-bandwidth command, 101 + +ip ospf cost command, 101 +OSPF, 101 + +BDR (Backup Designated Routers) + +OSPFv2, BDR elections, 99–100 + +OSPFv3 + +BDR elections, 99–100 + +enabling IPv6 on an interface, 92 + +BGP (Border Gateway Protocol) + +4-byte AS numbers, 160–161 + +access lists, 180–182 + +AS path access lists, 181–182 + +attributes, 164 + +local preference attribute, 167–169 + +MED attribute, 171–174 + +AS path attribute prepending, 169–170 + +weight attribute, 164–167 + +authentication + +between peers, 184 + +verifying, 184 + +best path algorithm, 164 + +bgp bestpath missing-as-worst command, 174 + +bgp default ipv4-unicast command, 157 + +bgp router-id command, 157 + +bgp-always-compare-med command, 173–174 + +clear ip bgp command, 175–176 +configurations + +AF, 158–159 + +classic configurations, 156–157 + +default routes, 177 + +distribute lists, 180–181 + +EBGP + +multihop, 162–163 + +next-hop behavior, 162 + +IBGP, next-hop behavior, 162 + +ip as-path access-list command, 178 + +MP-BGP + +AF, exchanging IPv4/IPv6 routes, 159–160 + +configurations, 157 + +neighbor remote-as command, 157 + +neighbor update-source command, 161–162 + +network command, 156–157, 177 + +peer groups, 182–183 + +prefix lists, 181–182 + +private AS removal, 171 + +redistribution, default metrics, defining, 128 + +regular expressions, 178–180 + +route aggregation, 177 + +route filtering, 180–181 + +route reflectors, 177–178 +route refresh, 176 + +route selection process, 164 + +router bgp command, 156 + +router IDs, 157 + +show ip bgp command, 179–180 + +show ip bgp neighbor command, 176 + +soft-reconfiguration inbound command, 175 + +timers, 161 + +troubleshooting, 175–176 + +verifying, 174 + +boot system, SSH commands, 235–236 + +bootflash, 237 + +BPDUs (Bridge Protocol Data Units) + +BPDU Filter, 30, 44 + +BPDU Guard, 29–30, 44 + +Rapid PVST+, 43 + + +C + +channel-group command, port channels, 14 + +Cisco AireOS + +Advanced GUI, troubleshooting WLCs, 318–319 + +CLI, troubleshooting WLCs, 320–322 + +Monitoring Dashboard GUI + +wireless client connectivity, troubleshooting, 322–326 + +WLCs, troubleshooting, 316–318 +Cisco IFS (IOS File System), 236 + +configurations + +backing up to TFTP servers, 238 + +copy startup-config tftp command, 238 + +copy tftp startup-config command, 239 + +no shutdown command, 239 + +restoring from TFTP servers, 238–239 + +IOS image filenames, 237–238 + +IOS software + +backing up to TFTP servers, 239 + +restoring from TFTP servers, 239–240 + +restoring using ROM monitor environmental variables, 240–241 + +upgrading from TFTP servers, 239–240 + +SCP, 241 + +configurations, 241–242 + +troubleshooting, 241 + +verifying, 241 + +show file systems command, 236 + +unneeded services, disabling, 242–243 + +URL prefixes (commonly-used), 236–237 + +viewing, 236 + +Cisco IOS + +image filenames, 237–238 + +IP SLAs, 147–149 +software + +backing up to TFTP servers, 239 + +restoring, 239–241 + +upgrading, from TFTP servers, 239–240 + +XE CLI, WLCs, troubleshooting, 320–322 + +XE GUI, troubleshooting + +wireless client connectivity, 326–327 + +WLCs, 319–320 + +class maps for matched traffic (CoPP), 258–259 + +classic mode (EIGRP) + +authentication, 67–68 + +IPv4 configurations, 62–63 + +auto-summary command, 63 + +wildcard masks, 63 + +IPv6 configurations, 63–64 + +upgrading configurations to named mode, 66–67 + +clear ip bgp command, 175, 176 + +clear ip ospf process command, 99 + +cleartext password encryption, 232–233 + +client mode (VTP), 5 + +company routers, PAT configurations, 192–193 + +conditionally triggered debugs, 266 + +configuration mode + +AF, 94–95 +static VLANs, 2 + +configuring + +accounting, 257 + +ACL + +extended ACL configurations, 247–248 + +IPv4 configurations, 246–250 + +IPv6 configurations, 250–251 + +standard ACL configurations, 246–247 + +time-based ACL configurations, 248–249 + +VTY ACL configurations, 249–250 + +authorization, 256–257 + +BackboneFast, STP configurations, 31 + +BGP + +AF, 158–159 + +classic configurations, 156–157 + +MP-BGP, 157, 159–160 + +BPDU Filter, STP configurations, 30 + +BPDU Guard, STP configurations, 29–30 + +DHCP, IPv4 configurations, 224–229 + +IOS router configurations, 217–218 + +IOS software Ethernet interfaces, 219–220 + +manual IP assignments, 218 + +relays, 219 + +troubleshooting, 220 +verifying, 220 + +DHCP, IPv6 configurations + +DHCPv6 clients, 223 + +DHCPv6 relay agents, 223 + +EdmontonPC Stateless DHCPv6 Client (IOS routers), 229 + +GibbonsPC Stateful DHCPv6 Client (IOS routers), 229 + +no ipv6 nd managed-config-flag command, 223 + +routers as stateful DHCPv6 servers, 222–223 + +routers as stateless DHCPv6 servers, 221–222 + +SLAAC, 221–222 + +troubleshooting configurations, 223 + +verifying configurations, 224 + +dynamic NAT, 188 + +EEM, 296–297 + +EIGRP + +IPv4 classic mode configurations, 62–63 + +IPv6 classic mode configurations, 63–64 + +named mode configurations, 64–65, 83 + +named mode subconfiguration modes, 66 + +upgrading classic mode configurations to named mode, 66–67 + +ERSPANs + +destination configuration, 281 + +source configuration, 280 + +EtherChannel configurations +configuration guidelines, 12–14 + +default configurations, 12 + +example of, 18 + +Layer 2 configurations, 14 + +Layer 3 configurations, 14–15 + +network topology, 18 + +Flexible NetFlow, 272–273 + +GRE + +IPv4 configurations, 330, 331–335 + +IPv6 configurations, 330–335 + +overlay configurations, 333–334 + +underlay configurations, 332–333 + +verifying, IPv4, 331 + +HSRP + +basic configurations, 195 + +settings, 195 + +IFS + +backing up configurations to TFTP servers, 238 + +copy startup-config tftp command, 238 + +copy tftp startup-config command, 239 + +no shutdown command, 239 + +restoring configurations from TFTP servers, 238–239 + +inter-VLAN routing, 47–48 + +IP SLA authentication, 149–150 +IPv4 configurations + +EIGRP classic mode configurations, 62–63 + +GRE, 331–335 + +IPv6 configurations + +EIGRP classic mode configurations, 63–64 + +GRE, 331–335 + +inter-VLAN routing, 55–60 + +ISAKMP policies, site-to-site GRE over IPsec, 336, 338 + +local SPANs configurations, 274–277 + +logging, 271 + +Loop Guard, STP configurations, 32–33 + +MP-BGP, 157, 159–160 + +multiarea OSPF configurations, 89–90, 114–117 + +NAT + +troubleshooting, 191 + +verifying, 190 + +virtual interfaces, 190, 193–194 + +NTP, 281–282 + +network topologies, 290 + +OSPFv2, 89 + +log-adjacency-changes command, 89 + +multiarea OSPF, 89–90, 114–117 + +network area command, 89 + +single-area configurations, 111–114 +verifying configurations, 109–110 + +virtual links, 108–109 + +OSPFv3, 89 + +with AF, 120–125 + +enabling IPv6 on an interface, 91–92 + +log-adjacency-changes command, 89 + +multiarea OSPF, 89–90, 114–117 + +network area command, 89 + +single-area configurations, 111–114 + +traditional configurations, 91, 117–120 + +verifying configurations, 109–110 + +virtual links, 108–109 + +passwords, 231–232 + +PAT, 189–190 + +company routers, 192–193 + +example of, 191–193 + +ISP routers, 191–192 + +troubleshooting, 191 + +verifying, 190 + +PBR with route maps, 146–147 + +port error conditions, STP configurations, 33–36 + +PortFast, STP configurations, 28–29 + +PSK, site-to-site GRE over IPsec, 337, 338 + +PVST+, 41–43 +network topologies, 40 + +Rapid PVST+, 36 + +Root Guard, STP configurations, 31–32 + +route maps, 141–142 + +RSPANs + +configuration examples, 278–280 + +configuration guidelines, 277–278 + +SCP, 241–242 + +single-area OSPF configurations, 111–114 + +SNMP, 267 + +no snmp-server global command, 267 + +security levels, 267 + +security models, 267 + +SNMPv1, 267–268 + +SNMPv2c, 267–268 + +SNMPv3, 267–269 + +SPANs + +default configurations, 273–274 + +local SPANs, 274–277, 281 + +RSPANs, 277–281 + +SSH, 234–235 + +static NAT, 187, 193–194 + +STP configurations + +BackboneFast, 31 +BPDU Filter, 30 + +BPDU Guard, 29–30 + +changing modes, 25 + +Loop Guard, 32–33 + +path costs, 27 + +port error conditions, 33–36 + +port priority, 26 + +PortFast, 28–29 + +PVST+, 40–43 + +Rapid PVST+, 36 + +Root Guard, 31–32 + +root switches, 25–26 + +secondary root switches, 26 + +timers, 27–28 + +UDLD, 33 + +UplinkFast, 30–31 + +VLAN switch priority, 27 + +Syslog, 269 + +UDLD, STP configurations, 33 + +UplinkFast, STP configurations, 30–31 + +uRPF, 260 + +virtual links, OSPF, 108–109 + +VLAN configurations + +2960 series switches, 10–11 +3650 series switches, 9–10 + +erasing, 7–8 + +example of, 8 + +network topology, 8 + +saving, 7 + +VRF-Lite, 347–348 + +VRRPv2, 201–202, 209–212 + +VRRPv3, 202–203 + +connected networks, redistributing, 129 + +connectivity (wireless clients), troubleshooting + +Cisco AireOS Monitoring Dashboard GUI, 322–326 + +Cisco IOS XE GUI, 326–327 + +CoPP (Control Plane Policing), 257 + +ACL and permitted CoPP traffic flows, 258 + +class maps for matched traffic, 258–259 + +policy maps + +control plane assignments, 259 + +policing matched traffic, 259 + +verifying, 260 + +copy startup-config tftp command, 238 + +copy tftp startup-config command, 239 + +cost metrics, OSPF, 100 + +crypto key generate rsa global configuration command, 234 + +crypto key zeroize rsa command, 234 +crypto maps, GRE/IPsec, 336–337 + +cryptographic authentication, OSPFv2 + +MD5, 95–96 + +SHA-256, 96 + +CSRT (Cross-Stack Rapid Transition), 24 + + +D + +data VLAN port assignments, 2 + +default mode, 3–4 + +DTP, 3–4 + +interface range command, 3 + +range command, 3 + +switchport mode access command, 2–4 + +switchport mode dynamic auto command, 3 + +switchport mode dynamic desirable command, 3 + +switchport mode nonegotiate command, 3 + +switchport mode trunk command, 3 + +switchport voice command, 2–3 + +database mode (VLANs), 2 + +dead interval timers, 101–102 + +debugging + +debug command, 111, 217, 265–266 + +debug condition command, 266 + +debug ip packet command, 266 + +HSRP, 200–201 +VRRP, 204 + +default information-originate always command, 102 + +default information-originate command, 102 + +default-metric command, 129 + +default metrics (redistribution), defining, 128–129 + +default routes + +BGP, 177 + +propagating, OSPF, 102–103 + +DES (Data Encryption Standard), 234 + +device management + +FTP options, 243 + +HTTP options, 243 + +HTTPS options, 243 + +IFS, 236 + +backing up configurations to TFTP servers, 238 + +copy startup-config tftp command, 238 + +copy tftp startup-config command, 239 + +disabling unneeded services, 242–243 + +IOS image filenames, 237–238 + +IOS software, backing up to TFTP servers, 239 + +IOS software, restoring from TFTP servers, 239–240 + +IOS software, restoring using ROM monitor environmental variables, 240–241 + +IOS software, upgrading from TFTP servers, 239–240 + +no shutdown command, 239 +restoring configurations from TFTP servers, 238–239 + +SCP, 241–242 + +show file systems command, 236 + +URL prefixes (commonly-used), 236–237 + +viewing, 236 + +passwords + +cleartext password encryption, 232–233 + +configurations, 231–232 + +enable secret password command, 232 + +encryption types, 233–234 + +MD5, 233 + +service password-encryption command, 232–233 + +storage, 232 + +SSH + +boot system commands, 235–236 + +configurations, 234–235 + +crypto key generate rsa global configuration command, 234 + +crypto key zeroize rsa command, 234 + +verifying, 235 + +Telnet, 234 + +unneeded services, disabling, 242–243 + +URL prefixes for Cisco network devices, 236–237 + +DHCP (Dynamic Host Configuration Protocol), 217 + +IPv4 +configuration examples, 224–229 + +IOS router configurations, 217–218 + +IOS software Ethernet interfaces, 219–220 + +ip forward-protocol command, 219 + +ip helper-address command, 219 + +manual IP assignments, 218 + +network topologies, 224, 226–227 + +no ip forward-protocol udp x command, 219 + +relays, 219 + +show ip dhcp binding command, 218 + +troubleshooting configurations, 220 + +verifying configurations, 220 + +IPv6, 221 + +DHCPv6 clients, 223 + +DHCPv6 relay agents, 223 + +no ipv6 nd managed-config-flag command, 223 + +routers as stateful DHCPv6 servers, 222–223 + +routers as stateless DHCPv6 servers, 221–222 + +SLAAC, 221–222 + +troubleshooting configurations, 224 + +verifying configurations, 224 + +no ip dhcp client request router command, 220 + +disabling unneeded services, 242–243 + +distribute lists +BGP route filtering, 180–181 + +distribute-list command, 73, 105 + +distribute-list in command, OSPF route filtering, 104–105 + +inbound distribute list route filters, 134–135 + +outbound distribute list route filters, 134–136 + +prefix lists and redistribution, 139–140 + +DMVPNs (Dynamic Multipoint VPNs), 340 + +IPv4 configurations + +hub routers, 341–343, 345–346 + +spoke1 routers, 343–346 + +OSPF, 346–347 + +verifying, 346 + +domain names, VTP, 4–5 + +DoS, (Denial of Service) attacks, CoPP, 257 + +dot1q + +encapsulation dot1q, local SPANs, 277 + +ingress dot1q vlan, local SPANs, 277 + +trunking, 4–5, 46 + +DR (Designated Routers) + +BDR, OSPFv3, enabling IPv6 on an interface, 92 + +OSPFv2, DR elections, 99–100 + +OSPFv3 + +DR elections, 99–100 + +enabling IPv6 on an interface, 92 +dst-ip load distribution method, 15 + +dst-mac load distribution method, 15 + +dst-mixed-ip-port load distribution method, 15 + +dst-port load distribution method, 15 + +DTP (Dynamic Trunking Protocol) + +VLAN port assignments, 3–4 + +VTP domain names, 4 + +DUAL (Diffusing Update Algorithm), 62 + +dynamic NAT, configurations, 188 + + +E + +E1 routes, OSPF assignments, 130–131 + +E2 routes, OSPF assignments, 130–131 + +EAP (Extensible Authentication Protocol), 308–309 + +localEAP, 311–314 + +RADIUS servers (external), 309–311 + +EBGP (External Border Gateway Protocol) + +multihop, 162–163 + +next-hop behavior, 162 + +edge ports, Rapid PVST+, 36 + +EEM (Embedded Event Manager), 295–296 + +applets, 295, 298 + +configurations, 296–297 + +event manager run command, 298 + +event none command, 298 +scripts, 295 + +TCL scripting, 298 + +verifying, 298 + +EF (Expedited Forwarding), 2–3 + +EIGRP (Enhanced Interior Gateway Protocol) + +0.0.0.0/0 summarization, 74–75 + +authentication, 67 + +authentication key-chain command, 66 + +authentication mode command, 66 + +classic mode authentication, 67–68 + +named mode authentication, 68–70 + +troubleshooting, 70 + +verifying, 70 + +auto-summarization, 70 + +auto-summary command, 63, 70, 78 + +bandwidth + +bandwidth command, 77 + +usage, 77 + +bandwidth-percent command, 66, 77 + +ip bandwidth-percent command, 77 + +classic mode + +authentication, 67–68 + +IPv4 configurations, 62–63 + +IPv6 configurations, 63–64 +upgrading configurations to named mode, 66–67 + +distribute-list command, 73 + +DUAL, 62 + +eigrp router-id command, 66 + +eigrp router-id w.x.y.z. command, 64 + +eigrp stub command, 66, 77, 79 + +eigrp upgrade-cli command, 66–67 + +exit-address-family command, 84, 85 + +exterior routing, accepting information, 75 + +hello-interval command, 66 + +hold-time command, 66 + +injecting default routes + +0.0.0.0/0 summarization, 74–75 + +ip-default networks, 74 + +static route redistribution, 73 + +ip bandwidth-percent command, 77 + +ip default-network command, 74 + +load balancing + +equal-cost, maximum paths, 75 + +unequal-cost, variance, 76 + +manual summarization + +administrative-distance, 71 + +IPv4 summarization, 70–71 + +IPv6 summarization, 71 +maximum-paths command, 66, 75 + +metric weights command, 66 + +metrics + +metric rib-scale command, 79 + +metric weights command, 80 + +weight adjustments, 80 + +Wide Metrics, 79 + +named mode + +authentication, 68–70 + +configurations, 64–65, 83 + +subconfiguration modes, 66 + +neighbor command, 79 + +network 0.0.0.0 command, 74 + +network command, 66 + +network summaries, 63 + +network topologies, 83 + +passive interfaces, 72 + +passive-interface command, 66 + +“pseudo” passive interfaces, 72–73 + +redistribution + +default metrics, defining, 128–129 + +IPv4 routes, 131–132 + +IPv4 routes, verifying, 134 + +IPv6 routes, 132–133 +IPv6 routes, verifying, 134 + +redistribute command, 66, 78 + +redistribute connected command, 78 + +redistribute static command, 78 + +route filtering, 134 + +route tagging, 142–143 + +seed metrics, defining, 128–129 + +route tagging, 142–143 + +router IDs, 67 + +SHA and named mode authentication, 68–70 + +show ip eigrp neighbors detail command, 81 + +show ip eigrp topology command, 81 + +static route redistribution, 73 + +stub routing, 77–79 + +summary-address command, 66, 84 + +timers, 71 + +topology base command, 66 + +traffic sharing, 76–77 + +traffic-share command, 66, 76–77 + +troubleshooting, 82–83 + +unicast neighbors, 79 + +variance + +load balancing, 76 + +variance command, 66, 76 +verifying, 80–82 + +Wide Metrics, 79 + +wildcard masks, 63 + +enable secret password command, 232 + +encapsulation dot1q, local SPANs, 277 + +encapsulation isl x command, 46 + +encapsulation replicate, local SPANs, 277 + +encryption + +cleartext password encryption, 232–233 + +DES, 234 + +key config-key password-encryption command, 254–255 + +OSPFv3, 97–98 + +passwords + +password encryption aes command, 254–255 + +types of encryption, 233–234 + +SSH + +boot system commands, 235–236 + +configurations, 234–235 + +crypto key generate rsa global configuration command, 234 + +crypto key zeroize rsa command, 234 + +verifying, 235 + +enterprise mode (WPA2), 307 + +equal-cost load balancing, EIGRP, 75 + +erasing VLAN configurations, 7–8 +ERSPANs (Encapsulated RSPANs), 280 + +destination configuration, 281 + +source configuration, 280 + +EtherChannel, 11–12 + +configurations + +default configurations, 12 + +example of, 18 + +guidelines, 12–14 + +Layer 2 configurations, 14 + +Layer 3 configurations, 14–15 + +network topology, 18 + +GBIC, 13 + +LACP, 12–13, 16–17 + +load balancing, 12, 15–16 + +monitoring, 17 + +PAgP, 12–13 + +port channel in Layer 3 mode, HSRP, 194 + +SPANs, 13 + +verifying, 17 + +VLANs, 13 + +Ethernet interfaces (IOS software), DHCP and IPv4 configurations, 219–220 + +event manager run command, 298 + +event none command, 298 + +exit command, VLAN configurations, 7 +exit-address-family command, 84–85 + +extended ACL configurations, 247–248 + +extended load distribution method, 15 + +extended ping commands, 263–264 + +extended system ID (STP), verifying, 39 + +extended-range VLANs, 2 + +external routers, inter-VLAN routing, 45–46 + +external routes + +AD, changing, 143–144 + +OSPF + +redistribution, 131 + +summarization, 103–104 + + +F + +FHRP (First-Hop Redundancy Protocol), 194 + +fhrp version vrrp v3 command, 201 + +HSRP, 194 + +authentication, 197 + +basic configurations, 195 + +configuration settings, 195 + +debugging, 200–201, 217 + +EtherChannel port channel in Layer 3 mode, 194 + +HSRPv2 for IPv6, 200, 212–217 + +interface port channel global configuration command, 194 + +interface tracking, 197 +interface vlan vlan_id global configuration command, 194 + +IP SLA tracking, 199–200, 208–209 + +IPv4, Layer 3 switches, 204–209 + +message timers, 196 + +multiple HSRP groups, 197–199 + +no switchport interface configuration command, 194 + +optimization options, 196–197 + +preempt, 196 + +routed ports, 194 + +SVIs, 194 + +verifying, 195, 217 + +VRRP, 201 + +debugging, 204 + +fhrp version vrrp v3 command, 201 + +interface tracking, 203 + +optimization options, 203 + +verifying, 203 + +VRRPv2 configurations, 201–202, 209–212 + +VRRPv3, 201–203 + +filenames (image), Cisco IOS, 237–238 + +filtering (route) + +BGP, 180–181 + +EIGRP, 134 + +inbound distribute list route filters, 134–135 +LSAs, 137 + +LSDBs, 137 + +OSPF, 104, 137 + +distribute-list command, 105 + +distribute-list in command, 104–105 + +filter-list command, 104 + +summary-address not-advertise command, 105 + +outbound distribute list route filters, 134–136 + +prefix lists, 137–140 + +verifying, 136–137 + +flash, 237 + +Flexible NetFlow + +configurations, 272–273 + +flow exporter, 272 + +flow monitors, 272–273 + +flow records, 272 + +flow exporter, Flexible NetFlow, 272 + +flow monitors, Flexible NetFlow, 272–273 + +flow records, Flexible NetFlow, 272 + +forwarding VRF-Lite, 347 + +configurations, 347–348 + +verifying, 349 + +forward-time command, 27, 28 + +FTP (File Transfer Protocol), 237, 243 +G + +GBIC (Gigabit Interface Converters), EtherChannel, 13 + +GRE(Generic Route Encapsulation), 329 + +configurations + +overlay configurations, 333–334 + +underlay configurations, 332–333 + +DMVPNs, 340 + +IPv4 configurations, 341–346 + +OSPF, 346–347 + +verifying, 346 + +IPv4 + +configurations, 330 + +configurations with OSPFv3, 331–335 + +verifying, 331 + +IPv6 + +configurations, 330–331 + +configurations with OSPFv3, 331–335 + +verifying, 331 + +site-to-site GRE over IPsec, 335 + +crypto maps, 336–337 + +IPsec profiles, 337–339 + +verifying, 339 + +site-to-site VTI over IPsec, 339 + + +H +hello-interval command, 66 + +hello-time command, 27–28 + +hello timers + +EIGRP, 71 + +OSPF, 101–102 + +hold-time command, 66 + +hold timers, EIGRP, 71 + +hot-standby ports, LACP, 16–17 + +HSRP (Hot Standby Router Protocol), 194 + +authentication, 197 + +configurations + +basic configurations, 195 + +IPv4, Layer 3 switches, 204–209 + +settings, 195 + +debugging, 200–201, 217 + +EtherChannel port channel in Layer 3 mode, 194 + +HSRPv2 for IPv6, 200, 212–217 + +interface port channel global configuration command, 194 + +interface tracking, 197 + +interface vlan vlan_id global configuration command, 194 + +IP SLA tracking, 199–200, 208–209 + +message timers, 196 + +multiple HSRP groups, 197–199 + +no switchport interface configuration command, 194 +optimization options, 196–197 + +preempt, 196 + +routed ports, 194 + +SVIs, 194 + +verifying, 195, 217 + +HTTP (Hypertext Transfer Protocol), 237, 243 + +HTTPS (HTTP Secure), 237, 243 + + +I + +IBGP (Internal Border Gateway Protocol), next-hop behavior, 162 + +ICMP (Internet Control Message Protocol) + +icmp-echo command, 153 + +redirect messages, 262 + +IFS (IOS File System), 236 + +configurations + +backing up to TFTP servers, 238 + +copy startup-config tftp command, 238 + +copy tftp startup-config command, 239 + +no shutdown command, 239 + +restoring from TFTP servers, 238–239 + +IOS image filenames, 237–238 + +IOS software + +backing up to TFTP servers, 239 + +restoring from TFTP servers, 239–240 +restoring using ROM monitor environmental variables, 240–241 + +upgrading from TFTP servers, 239–240 + +SCP, 241 + +configurations, 241–242 + +troubleshooting, 241 + +verifying, 241 + +show file systems command, 236 + +unneeded services, disabling, 242–243 + +URL prefixes (commonly-used), 236–237 + +viewing, 236 + +ignore state, OSPF, 101 + +IGRP (Interior Gateway Routing Protocol), 80 + +IKE SAs (Internet Key Exchange, Security Associations), ISAKMP policies and site-to-site GRE over IPsec, 336, 338 + +image filenames, Cisco IOS, 237–238 + +inbound distribute list route filters, 134–135 + +infrastructure security + +AAA + +configurations, 256–257 + +troubleshooting, 257 + +accounting, configurations, 257 + +ACL + +CoPP traffic flows (permitted), 258 +extended ACL configurations, 247–248 + +IPv4, verifying, 251 + +IPv4 configurations, 246–250 + +IPv6, verifying, 251 + +IPv6 configurations, 250–251 + +standard ACL configurations, 246–247 + +time-based ACL configurations, 248–249 + +VTY ACL configurations, 249–250 + +authentication, 251–252 + +AAA-based local database authentication, 252–253 + +RADIUS authentication, 253–255 + +simple local database authentication, 252 + +TACACS+ authentication, 255–256 + +authorization, configurations, 256–257 + +CoPP, 257 + +ACL and permitted CoPP traffic flows, 258 + +class maps for matched traffic, 258–259 + +policy maps, control plane assignments, 259 + +policy maps, policing matched traffic, 259 + +verifying, 260 + +uRPF + +configurations, 260 + +loose mode, 260 + +strict mode, 260 +troubleshooting, 260 + +verifying, 260 + +ingress dot1q vlan, local SPANs, 277 + +ingress untagged vlan, local SPANs, 277 + +ingress vlan, local SPANs, 277 + +interarea route summarization, OSPF, 103 + +interface modes, EtherChannel, 12 + +interface port channel global configuration command, 194 + +interface range command, 3 + +interface tracking + +HSRP, 197 + +VRRP, 203 + +interface vlan vlan_id global configuration command, 194 + +internal routers, multiarea OSPF configurations, 117 + +internal routes + +AD, changing, 143–144 + +OSPF redistribution, 131 + +inter-VLAN routing + +best practices, 46 + +configurations, 47–48 + +encapsulation isl x command, 46 + +IPv6 configurations, 55 + +Layer 3 switches, 46–47 + +multilayer switches, 46–47 +network topologies, 47–48 + +routers-on-a-stick, 45–46 + +switch virtual interfaces, 46–47 + +IOS software + +backing up to TFTP servers, 239 + +Ethernet interfaces, DHCP, IPv4 configurations, 219–220 + +restoring + +from TFTP servers, 239–240 + +using ROM monitor environmental variables, 240–241 + +upgrading, from TFTP servers, 239–240 + +IOS XE CLI, troubleshooting WLCs, 320–322 + +IOS XE GUI, troubleshooting + +wireless client connectivity, 326–327 + +WLCs, 319–320 + +ip as-path access-list command, BGP regular expressions, 178 + +ip bandwidth-percent command, 77 + +ip-default networks + +EIGRP, 74 + +ip default-network command, 74 + +ip helper-address command, 219 + +ip local policy route-map command, 145 + +IP MTU (Internet Protocol Maximum Transmission Units), OSPF, 102 + +ip ospf authentication message-digest command, 95 +ip ospf cost command, 101 + +ip ospf process id area area number command, 91 + +IPSec (IP Security) + +DMVPNs, 340 + +IPv4 configurations, 341–346 + +OSPF, 346–347 + +verifying, 346 + +site-to-site GRE over IPsec, 335 + +crypto maps, 336–337 + +IPsec profiles, 337–339 + +verifying, 339 + +site-to-site VTI over IPsec, 339–340 + +IP SLAs (Internet Protocol Service Layer Agreements) + +authentication, 149–150 + +Cisco IOS IP SLAs, 147–149 + +HSRP IP SLA tracking, 199–200, 208–209 + +icmp-echo command, 153 + +ip sla command, 150 + +ip sla monitor command, 150 + +monitoring, 150 + +network topologies, 148 + +PBR with IP SLAs, 150–151 + +probes, 151 + +tracking objects, 152 +verifying, 152–153 + +show ip sla application command, 150 + +show ip sla configuration command, 153 + +show ip sla monitor configuration command, 153 + +show ip sla monitor statistics command, 153 + +show ip sla statistics command, 153 + +tcp-connect command, 149 + +track ip sla command, 153 + +track rtr command, 153 + +type echo protocol ipIcmpEcho command, 153 + +upd-echo command, 149 + +verifying, 152–153 + +VRRPv2 IP SLA tracking, routers/L3 switches, 209–212 + +ISAKMP (Internet Security Association and Key Management Protocol) policies, site-to-site GRE over IPsec, 336, 338 + +ISL (Inter-Switch Linking), 4 + +ISP (Internet Service Provider) routers + +inter-VLAN routing, 48–49, 56 + +PAT configurations, 191–192 + + +J - K + +keepalive timers, BGP, 161 + +K-values, EIGRP metric weight adjustments, 80 + + +L +LACP (Link Aggregation Control Protocol), 12–13, 16–17 + +Layer 3 mode, EtherChannel port channel in, 194 + +Layer 3 switches + +inter-VLAN routing, 46–47 + +L2 switchport capability, removing, 47 + +VRRPv2 IP SLA tracking, 209–212 + +legacy RADIUS authentication, 253 + +legacy TACACS+ authentication, 255 + +load balancing + +EIGRP + +equal-cost, maximum paths, 75 + +unequal-cost, variance, 76 + +EtherChannel, 12, 15–16 + +local database authentication + +AAA-based authentication, 252–253 + +simple authentication, 252 + +local preference attribute (BGP), 167–169 + +local SPANs + +configurations + +example of, 274–277 + +guidelines, 274 + +encapsulation dot1q, 277 + +encapsulation replicate, 277 + +ingress dot1q vlan, 277 +ingress untagged vlan, 277 + +ingress vlan, 277 + +monitor session destination command, 277 + +monitor session source command, 276–277 + +no monitor session global configuration command, 274 + +show ip cache flow command, 273 + +troubleshooting, 281 + +verifying, 281 + +localEAP, 311–314 + +log-adjacency-changes command, 89 + +logging + +EEM, 295–296 + +applets, 295, 298 + +configurations, 296–297 + +event manager run command, 298 + +event none command, 298 + +TCL scripting, 295, 298 + +verifying, 298 + +Flexible NetFlow + +flow exporter, 272 + +flow monitors, 272–273 + +flow records, 272 + +NetFlow + +Flexible NetFlow configurations, 272–273 +verifying, 273 + +NTP + +configurations, 281–282, 290–294 + +design, 282–284 + +ntp authentication-key command, 284 + +ntp master command, 282 + +ntp peer command, 282 + +ntp trusted-key command, 285 + +NTPv3, 283–284 + +NTPv4, 283–284 + +security, 284–285 + +setting router clocks, 286–289 + +show ntp associations command, 282 + +time stamps, 290 + +troubleshooting, 286 + +verifying, 286 + +Syslog + +configurations, 269 + +message example, 270–271 + +message format, 269–270 + +security levels, 270 + +TCL scripting, 294–295 + +Loop Guard + +PVST+, 44 +Rapid PVST+, 44 + +STP configurations, 32–33 + +loopback addresses, OSPF, 98 + +loose mode (uRPF), 260 + +loose option, ping command, 264 + +LSAs (Link-State Advertisements) + +LSDB overload protection, 101 + +route filtering, 137 + +LSDBs (Link-State Databases) + +overload protection, OSPF, 101 + +route filtering, 137 + +LWA (Local Web Authentication), 314 + + +M + +manual summarization, EIGRP + +IPv4, 70–71 + +IPv6, 71 + +max-age command, 27, 28 + +maximum-paths command, 66, 75 + +MD5 authentication, 97, 233 + +EIGRP named mode authentication, 68–70 + +OSPFv2 authentication, 95–96 + +MED (Multi-Exit Discriminator) attribute, BGP, 171–174 + +message timers, HSRP, 196 + +metrics +default metrics (redistribution), defining, 128–129 + +default-metric command, 129 + +EIGRP + +weight adjustments, 80 + +Wide Metrics, 79 + +metric command, MED attribute (BGP), 171 + +metric rib-scale command, 79 + +metric weights command, 66, 80 + +seed metrics (redistribution), defining, 128–129 + +migrating from PVST+ to Rapid PVST+, 43–44 + +modular RADIUS authentication, 253–255 + +modular TACACS+ authentication, 255–256 + +monitor session destination command, 277 + +monitor session source command, 276–277 + +monitoring + +EtherChannel, 17 + +IP SLAs, 150 + +MP-BGP (Multiprotocol-BGP), 157, 159–160 + +MST (Multiple Spanning Tree), 6 + +MSTP (Multiple Spanning Tree Protocol), 24–25 + +BackboneFast, 31 + +enabling, 37–38 + +UplinkFast, 31 + +multiarea OSPF configurations, 89–90 114 +multicast addressing + +IPv4, 64 + +IPv6, 64 + +multihop, EBGP, 162–163 + +multilayer switches, inter-VLAN routing, 46–47 + + +N + +named mode (EIGRP) + +authentication, 68–70 + +configurations, 64–66, 83 + +NAT (Network Address Translation) + +configurations + +troubleshooting, 191 + +verifying, 190 + +dynamic NAT, 188 + +RFC 1918 private address ranges, 186–187 + +static NAT, 187, 193–194 + +virtual interfaces, 190, 193–194 + +native VLANs, 2–3 + +NBMA (Nonbroadcast Multiaccess) networks + +hello timers, 102 + +OSPFv3, enabling IPv6 on an interface, 92 + +neighbor command, 79 + +neighbor remote-as command, 157 + +neighbor update-source command, BGP, 161–162 +NetFlow + +configurations, 271 + +Flexible NetFlow configurations, 272–273 + +verifying, 273 + +network 0.0.0.0 command, 74 + +network area command, 89–90 + +network assurance + +conditionally triggered debugs, 266 + +debug command, 265–266 + +EEM, 295–296 + +applets, 295, 298 + +configurations, 296–297 + +event manager run command, 298 + +event none command, 298 + +TCL scripting, 295, 298 + +verifying, 298 + +Flexible NetFlow + +flow exporter, 272 + +flow monitors, 272–273 + +flow records, 272 + +ICMP redirect messages, 262 + +logging, configurations, 271 + +NetFlow + +Flexible NetFlow configurations, 272–273 +verifying, 273 + +NTP + +configurations, 281–282, 290–294 + +design, 282–284 + +ntp authentication-key command, 284 + +ntp master command, 282 + +ntp peer command, 282 + +ntp trusted-key command, 285 + +NTPv3, 283–284 + +NTPv4, 283–284 + +security, 284–285 + +setting router clocks, 286–289 + +show ntp associations command, 282 + +time stamps, 290 + +troubleshooting, 286 + +verifying, 286 + +ping command, 262 + +examples, 262 + +extended ping commands, 262 + +interrupting ping operations, 264 + +loose option, 264 + +output characters, 263 + +record option, 264 + +strict option, 264 +timestamp option, 264 + +verbose option, 264 + +port mirroring + +ERSPANs, 280–281 + +local SPANs, 274–277, 281 + +RSPANs, 273–274, 277–281 + +SPANs, 273–277 + +SNMP + +no snmp-server global command, 267 + +security levels, 267 + +security models, 267 + +SNMPv1, 267–268 + +SNMPv2c, 267–268 + +SNMPv3, 267–269 + +verifying, 269 + +Syslog + +configurations, 269 + +message example, 270–271 + +message format, 269–270 + +security levels, 270 + +TCL scripting, 294–295 + +traceroute command, 265 + +network command + +BGP +configurations, 156–157 + +default routes, 177 + +EIGRP named mode configurations, 66 + +network topologies + +ASBR, 130–131 + +DHCP, IPv4, 224, 226–227 + +EIGRP, 83 + +EtherChannel configurations, 18 + +inbound distribute list route filters, 134–135 + +inter-VLAN routing configurations, 47–48, 55 + +IP SLAs, 148 + +IPv4 route redistribution, 131–132 + +IPv6 route redistribution, 132–133 + +NTP configurations, 290 + +OSPF + +with AF, 120–121 + +multiarea OSPF configurations, 114 + +single-area OSPF configurations, 108 + +traditional OSPF configurations, 117–118 + +virtual links, 108 + +outbound distribute list route filters, 134–136 + +PBR with route maps, 146 + +PVST+, 40 + +route tagging and redistribution, 142 +VLAN configurations, 8 + +networks + +connected networks, redistributing, 129 + +DMVPNs, 340 + +IPv4 configurations, 341–346 + +OSPF, 346–347 + +verifying, 346 + +ip-default networks, EIGRP, 74 + +NBMA networks + +hello timers, 102 + +OSPFv3, enabling IPv6 on an interface, 92 + +summaries, EIGRP, IPv4 classic mode configurations, 63 + +timers, BGP, 161 + +WLANs + +EAP, 312–314 + +open authentication, 304–306 + +WebAuth, 314–316 + +next-hop behavior + +EBGP, 162 + +IBGP, 162 + +no debug all command, 265 + +no ip dhcp client request router command, 220 + +no ip forward-protocol udp x command, 219 + +no ipv6 nd managed-config-flag command, 223 +no logging console command, 265 + +no monitor session global configuration command, 274 + +no shutdown command, 33, 239 + +no snmp-server global command, 267 + +no switchport interface configuration command, 194 + +noAuthNoPriv security level, SNMP, 267 + +non-edge link types, Rapid PVST+, 37 + +non-edge ports, Rapid PVST+, 36 + +normal-range VLANs, 2 + +NORTRID (No Router ID) warnings, 92 + +NSSA (Not-So-Stubby-Areas) + +OSPF, 106–107 + +OSPFv3, 92 + +totally NSSA, 107–108 + +NTP (Network Time Protocol) + +configurations, 281–282 + +network topologies, 290 + +design, 282–284 + +ntp authentication-key command, 284 + +ntp master command, 282 + +ntp peer command, 282 + +ntp trusted-key command, 285 + +NTPv3, 283–284 + +NTPv4, 283–284 +router clocks, setting, 286–287 + +time zone acronyms, 288–289 + +time zone designators, 289 + +security + +access lists, 285 + +authentication, 284–285 + +show ntp associations command, 282 + +time stamps, 290 + +troubleshooting, 286 + +verifying, 286 + + +O + +OSPFv2 (Open Shortest Path First version 2) + +authentication + +cryptographic authentication, 95–96 + +ip ospf authentication message-digest command, 95 + +MD5, 95–96 + +service password-encryption command, 96 + +SHA-256, 96 + +simple password authentication, 95 + +verifying, 98 + +auto-cost command, 101 + +auto-cost reference-bandwidth command, 101 + +BDR elections, 99–100 + +configurations, 89 +log-adjacency-changes command, 89 + +multiarea OSPF, 89–90 + +multiarea OSPF configurations, 114–117 + +network area command, 89–90 + +single-area configurations, 111–114 + +verifying, 109–110 + +virtual links, 108–109 + +cost metrics, 100 + +DMVPNs, 346–347 + +DR elections, 99–100 + +E1 route assignments, 130–131 + +E2 route assignments, 130–131 + +ignore state, 101 + +IP MTU, 102 + +ip ospf cost command, 101 + +ip ospf process id area area number command, 91 + +IPv4, 89 + +IPv6, 89 + +loopback addresses, 98 + +LSDB overload protection, 101 + +multiarea OSPF, 89–90 + +network topologies + +multiarea OSPF configurations, 114 + +single-area OSPF configurations, 108 +traditional OSPF configurations, 117–118 + +virtual links, 108 + +OSPFv3 comparisons, 88–89 + +passive interfaces, 100 + +redistribution + +connected networks, 129 + +default metrics, defining, 128–129 + +external routes, 131 + +internal routes, 131 + +IPv4 routes, 131–132, 134 + +IPv6 routes, 132–134 + +route tagging, 142–143 + +seed metrics, defining, 128–129 + +subnets, 130 + +reference bandwidth, 101 + +route filtering, 104, 137, 142–143 + +area range not-advertise command, 104 + +distribute-list command, 105 + +distribute-list in command, 104–105 + +filter-list command, 104 + +summary-address not-advertise command, 105 + +route summarization + +external route summarization, 103–104 + +interarea route summarization, 103 +router IDs, 99 + +router ospf x command, 91 + +router-id w.x.y.z. command, 99 + +routing, propagating default routes, 102–103 + +stub areas, 105–106 + +NSSA, 106–107 + +totally NSSA, 107–108 + +totally stubby areas, 106 + +timers, 101–102 + +troubleshooting, 111 + +virtual links, 108–109 + +wildcard masks, 90–91 + +OSPFv3 (Open Shortest Path First version 3) + +AF, 93 + +IPv4, 94 + +IPv6, 94 + +parameters in configuration mode, 94–95 + +authentication, 97–98 + +area x authentication key-chain router configuration command, 97 + +ospfv3 x authentication key-chain command, 97 + +verifying, 98 + +auto-cost command, 101 + +auto-cost reference-bandwidth command, 101 + +BDR elections, 99–100 +configurations, 89 + +with AF, 120–125 + +enabling IPv6 on an interface, 91–92 + +log-adjacency-changes command, 89 + +multiarea OSPF, 89–90 + +multiarea OSPF configurations, 114–117 + +network area command, 89–90 + +single-area configurations, 111–114 + +traditional configurations, 91, 117–120 + +verifying, 109–110 + +virtual links, 108–109 + +cost metrics, 100 + +DMVPNs, 346–347 + +DR elections, 99–100 + +E1 route assignments, 130–131 + +E2 route assignments, 130–131 + +encryption, 97–98 + +ignore state, 101 + +interarea route summarization, 92 + +IP MTU, 102 + +ip ospf cost command, 101 + +ip ospf process id area area number command, 91 + +IPv4, 89 + +AF, 94 +router IDs, 93 + +tunneling configurations, 331–335 + +IPv6, 88–89 + +AF, 94 + +ipv6 ospf x area y command, 92 + +traditional configurations, 91–92 + +tunneling configurations, 331–335 + +loopback addresses, 98 + +LSDB overload protection, 101 + +multiarea OSPF, 89–90 + +network topologies + +multiarea OSPF configurations, 114 + +OSPF with AF, 120–121 + +single-area OSPF configurations, 108 + +traditional OSPF configurations, 117–118 + +virtual links, 108 + +NSSA areas, 92 + +OSPFv2 comparisons, 88–89 + +ospfv3 x authentication key-chain command, 97 + +passive interfaces, 100 + +redistribution + +connected networks, 129 + +default metrics, defining, 128–129 + +external routes, 131 +internal routes, 131 + +IPv4 routes, 131–132 + +IPv4 routes, verifying, 134 + +IPv6 routes, 132–133 + +IPv6 routes, verifying, 134 + +route tagging, 142–143 + +seed metrics, defining, 128–129 + +subnets, 130 + +reference bandwidth, 101 + +RFC 5838, 109 + +route filtering, 104, 137 + +area range not-advertise command, 104 + +distribute-list command, 105 + +distribute-list in command, 104–105 + +filter-list command, 104 + +summary-address not-advertise command, 105 + +route summarization + +external route summarization, 103–104 + +interarea route summarization, 103 + +route tagging, 142–143 + +router IDs, 99 + +router ospf x command, 91 + +router-id w.x.y.z. command, 99 + +routing, propagating default routes, 102–103 +SPF calculations, 93 + +stub areas, 92, 105–106 + +NSSA, 106–107 + +totally NSSA, 107–108 + +totally stubby areas, 106 + +summary-address command, 105 + +summary-prefix command, 105 + +timers, 101–102 + +troubleshooting, 111 + +virtual links, 108–109 + +wildcard masks, 90–91 + +outbound distribute list route filters, 134–136 + +overlay tunnels + +GRE, 329 + +DMVPNs, 340–347 + +IPv4 configurations, 330–335 + +IPv6 configurations, 330–335 + +overlay configurations, 333–334 + +site-to-site GRE over IPsec, 335–339 + +site-to-site VTI over IPsec, 339–340 + +underlay configurations, 332–333 + +verifying, IPv4, 331 + +VTI, site-to-site VTI over IPsec, 339–340 + +overload protection (LSDBs), OSPF, 101 +P + +PAgP (Port Aggregation Protocol), 12, 13 + +passive interfaces + +EIGRP, 72 + +OSPF, 100 + +passive interface default command, 100 + +passive-interface command, 66, 100 + +passwords + +cleartext password encryption, 232–233 + +configurations, 231–232 + +enable secret password command, 232 + +encryption types, 233–234 + +key config-key password-encryption command, 254–255 + +MD5, 233 + +OSPFv2 authentication, 95 + +password encryption aes command, 254–255 + +service password-encryption command, 232–233 + +storage, 232 + +VTP, 5, 6 + +PAT (Port Address Translation), configurations, 189–190 + +example of, 191–193 + +troubleshooting, 191 + +verifying, 190 + +path access lists (AS), BGP, 181–182 +local preference attribute manipulation, 167–169 + +weight attribute manipulation, 166 + +path control + +defined, 144 + +PBR, 144–145 + +IP SLAs, 150–153 + +route maps, 146–147 + +verifying, 145–146 + +set interface command, 145 + +path costs, STP configurations, 27 + +PBR (Policy-Based Routing) + +IP SLAs, 150–151 + +probes, 151 + +tracking objects, 152 + +verifying, 152–153 + +path control, 144–145 + +configurations, 146–147 + +network topologies, 146 + +route maps, 146–147 + +verifying, 145–146 + +peer groups, BGP, 182–183 + +personal mode (WPA2), 306 + +ping command, 262 + +examples, 262 +extended ping commands, 262 + +interrupting ping operations, 264 + +loose option, 264 + +output characters, 263 + +record option, 264 + +strict option, 264 + +TCL scripting, 295 + +timestamp option, 264 + +verbose option, 264 + +point-to-point links, Rapid PVST+, 37 + +policy maps (CoPP) + +control plane assignments, 259 + +policing matched traffic, 259 + +port mirroring + +ERSPANs, 280 + +destination configuration, 281 + +source configuration, 280 + +local SPANs, 273–277, 281 + +RSPANs, default configurations, 273–274, 277–281 + +PortFast + +PVST+, 44 + +Rapid PVST+, 44 + +STP configurations, 28–29 + +ports +channel-group command, 14 + +edge ports, Rapid PVST+, 36 + +EF values, 2–3 + +error conditions, STP configurations, 33–36 + +EtherChannel port channel in Layer 3 mode, 194 + +LACP, hot-standby ports, 16–17 + +non-edge ports, Rapid PVST+, 36 + +PAgP, 12–13 + +port channel command, 14 + +priority, STP configurations, 26 + +routed ports, HSRP, 194 + +SPANs, EtherChannel, 13 + +VLANs + +data VLAN port assignments, 2–4 + +voice VLAN port assignments, 2–4 + +preempt, HSRP, 196 + +prefix lists + +BGP, 166–167, 181–182 + +route filtering, 137–140 + +verifying, 140 + +pre-shared keys, authentication, wireless clients, 306–308 + +primary servers, VTP, 6 + +priv security level, SNMP, 267 + +private AS (Autonomous Systems), removing, 171 +private IP addresses, 186–187 + +probes, PBR with IP SLAs, 151 + +pruning VTP, 6 + +“pseudo” passive interfaces, EIGRP, 72–73 + +PSK (Pre-Shared Key) configurations, site-to-site GRE over IPsec, 337–338 + +PVST+(Per VLAN Spanning Tree Plus), 24–25 + +BackboneFast, 44 + +BPDU Filter, 44 + +BPDU Guard, 44 + +configurations + +network topologies, 40 + +Loop Guard, 44 + +migrating to Rapid PVST+, 43–44 + +PortFast, 44 + +Rapid PVST+, 24, 25 + +Root Guard, 44 + +UplinkFast, 44 + + +Q - R + +RADIUS authentication, 253, 309–314 + +key config-key password-encryption command, 254–255 + +legacy authentication, 253 + +modular RADIUS authentication, 253–255 + +password encryption aes command, 254–255 +range command, 3 + +Rapid PVST+, 24–25 + +BackboneFast, 31, 44 + +BPDUs, 43 + +BPDU Filter, 44 + +BPDU Guard, 44 + +edge ports, 36 + +enabling, 36 + +Loop Guard, 44 + +non-edge link types, 37 + +non-edge ports, 36 + +point-to-point links, 37 + +PortFast, 44 + +PVST+ migration to, 43–44 + +Root Guard, 44 + +shared links, 37 + +UplinkFast, 31, 44 + +rcp (Remote Copy Protocol), 237 + +record option, ping command, 264 + +redirect messages (ICMP), 262 + +redistribution + +AD, changing, 143–144 + +BGP, default metrics, defining, 128 + +connected networks, 129 +default metrics, defining, 128–129 + +distribute lists, route filtering, 139–140 + +E1 routes, OSPF assignments, 130–131 + +E2 routes, OSPF assignments, 130–131 + +EIGRP + +default metrics, defining, 128–129 + +IPv4 routes, 131–132 + +IPv4 routes, verifying, 134 + +IPv6 routes, 132–133 + +IPv6 routes, verifying, 134 + +route filtering, 134 + +seed metrics, defining, 128–129 + +IPv4 routes, 131–132, 134 + +IPv6 routes, 132–134 + +OSPF + +connected networks, 129 + +default metrics, defining, 128–129 + +E1 route assignments, 130–131 + +E2 route assignments, 130–131 + +external routes, 131 + +internal routes, 131 + +IPv4 routes, 131–132, 134 + +IPv4 routes, verifying, + +IPv6 routes, 132–134 +seed metrics, defining, 128–129 + +subnets, 130 + +prefix lists + +route filtering, 137–140 + +verifying, 140 + +redistribute command, 66, 78, 129 + +redistribute connected command, 78, 129 + +redistribute static command, 78 + +RIP, default metrics, defining, 128 + +route filtering + +EIGRP, 134 + +inbound distribute list route filters, 134–135 + +outbound distribute list route filters, 134–136 + +prefix lists, 137–140 + +verifying, 136–137 + +route maps, 140–142 + +route tagging, 142–143 + +seed metrics, defining, 128–129 + +static routes, 129 + +subnets into OSPF, 130 + +reference bandwidth + +auto-cost command, 101 + +auto-cost reference-bandwidth command, 101 + +ip ospf cost command, 101 +OSPF, 101 + +regular expressions, BGP, 178–180 + +relays (DHCP), 219 + +remove-private-as command, 171 + +restoring + +IFS configurations from TFTP servers, 238–239 + +IOS software + +from TFTP servers, 239–240 + +using ROM monitor environmental variables, 240–241 + +RFC 1918, 186–187 + +RFC 2784, 329 + +RFC 5340, 88 + +RFC 5838, 109 + +RIP (Routing Information Protocol), redistribution, 128 + +ROM monitor environmental variables, restoring IO software, 240–241 + +Root Guard + +PVST+, 44 + +Rapid PVST+, 44 + +STP configurations, 31–32 + +UplinkFast, 32 + +VLANs, 32 + +root switches, STP configurations, 25–26 + +RSA authentication, 234 + +RSPANs (Remote SPANs) +configurations + +default configurations, 273–274 + +example of, 278–280 + +guidelines, 277–278 + +ERSPANs, 280 + +destination configuration, 281 + +source configuration, 280 + +show monitor command, 281 + +troubleshooting, 281 + +verifying, 281 + +RSTP (Rapid Spanning Tree Protocol), 24 + + +S + +saving VLAN configurations, 7 + +SCP (Secure Copy Protocol), 237, 241 + +configurations, 241–242 + +troubleshooting, 241 + +verifying, 241 + +seed metrics (redistribution), defining, 128–129 + +sequence numbers, route maps, 144 + +server mode (VTP), 5 + +servers + +AAA servers, password storage, 232 + +primary servers, VTP, 6 + +RADIUS server authentication, 253 +key config-key password-encryption command, 254–255 + +legacy authentication, 253 + +modular authentication, 253–255 + +password encryption aes command, 254–255 + +SCP servers, configurations, 241, 242 + +TACACS+ server authentication, 255 + +legacy authentication, 255 + +modular authentication, 255–256 + +TFTP servers + +backing up IFS configurations to TFTP servers, 238 + +backing up IOS software, 239 + +copy startup-config tftp command, 238 + +copy tftp startup-config command, 239 + +restoring IFS configurations from TFTP servers, 238–239 + +restoring IOS software, 239–240 + +upgrading IOS software, 239–240 + +VTP servers, overwriting, 6 + +service password-encryption command, 96, 232–233 + +set interface command, 145 + +sftp (Secure FTP), 237 + +SHA (Secure Hash Algorithm) + +EIGRP named mode authentication, 68–70 + +SHA1, 97 + +SHA-256, OSPFv2 authentication, 96 +shared links, Rapid PVST+, 37 + +show debug condition command, 266 + +show file systems command, 236 + +show ip bgp command, BGP regular expressions, 179–180 + +show ip bgp neighbor command, 176 + +show ip cache flow command, 273 + +show ip dhcp binding command, 218 + +show ip eigrp neighbors detail command, 81 + +show ip eigrp topology command, 81 + +show ip sla application command, 150 + +show ip sla configuration command, 153 + +show ip sla monitor configuration command, 153 + +show ip sla monitor statistics command, 153 + +show ip sla statistics command, 153 + +show monitor command, 281 + +show ntp associations command, 282 + +show vlan privileged EXEC command, 2 + +shutdown command, UDLD, 33 + +simple local database authentication, 252 + +simple password authentication, OSPFv2, 95 + +single-area OSPF configurations, 111–112 + +site-to-site GRE over IPsec, IPSec, 335–337 + +site-to-site VTI over IPsec, 339–340 + +SLAAC (Stateless Autoconfiguration), DHCP and IPv6 configurations, 221–222 +SLAs (Service Level Agreements), IP SLAs + +authentication, 149–150 + +Cisco IOS IP SLAs, 147–149 + +icmp-echo command, 153 + +ip sla command, 150 + +ip sla monitor command, 150 + +monitoring, 150 + +PBR with IP SLAs, 150–153 + +show ip sla application command, 150 + +show ip sla configuration command, 153 + +show ip sla monitor configuration command, 153 + +show ip sla monitor statistics command, 153 + +show ip sla statistics command, 153 + +tcp-connect command, 149 + +track ip sla command, 153 + +track rtr command, 153 + +type echo protocol ipIcmpEcho command, 153 + +upd-echo command, 149 + +verifying, 152–153 + +SNMP (Simple Network Management Protocol), 267 + +no snmp-server global command, 267 + +security levels, 267 + +security models, 267 + +SNMPv1, 267–268 +SNMPv2c, 267–268 + +SNMPv3, 267–269 + +verifying, 269 + +soft-reconfiguration inbound command, 175 + +software (IOS) + +ROM monitor environmental variables, restoring using, 240–241 + +TFTP servers + +backing up to, 239 + +restoring from, 239–240 + +upgrading from, 239–240 + +source flash:ping.tcl command, 294 + +SPANs (Switched Port Analyzers) + +configurations + +default configurations, 273–274 + +local SPANs, 274–277, 281 + +RSPANs, 277–281 + +ERSPANs, 280 + +destination configuration, 281 + +source configuration, 280 + +EtherChannel, 13 + +local SPANs + +configuration examples, 274–277 + +configuration guidelines, 274 + +encapsulation dot1q, 277 +encapsulation replicate, 277 + +ingress dot1q vlan, 277 + +ingress untagged vlan, 277 + +ingress vlan, 277 + +monitor session destination command, 277 + +monitor session source command, 276, 277 + +no monitor session global configuration command, 274 + +show ip cache flow command, 273 + +troubleshooting, 281 + +verifying, 281 + +RSPANs + +configuration example, 278–280 + +configuration guidelines, 277–278 + +show monitor command, 281 + +troubleshooting, 281 + +verifying, 281 + +SPF (Shortest Path First) calculations, OSPFv3, 93 + +spi (Security Policy Index), 97 + +src-dst-ip load distribution method, 16 + +src-dst-mac load distribution method, 16 + +src-dst-mixed-ip-port load distribution method, 16 + +src-dst-port load distribution method, 16 + +src-ip load distribution method, 16 + +src-mac load distribution method, 16 +src-mixed-ip-port load distribution method, 16 + +src-port load distribution method, 16 + +SSH (Secure Shell) + +boot system commands, 235–236 + +configurations, 234–235 + +crypto key generate rsa global configuration command, 234 + +crypto key zeroize rsa command, 234 + +verifying, 235 + +standard ACL configurations, 246–247 + +static NAT configurations, 187, 193–194 + +static route redistribution, 73, 129 + +static VLANs, creating, 2 + +storage, passwords, 232 + +STP (Spanning Tree Protocol) + +changing modes, 25 + +configurations + +BackboneFast, 31 + +BPDU Filter, 30 + +BPDU Guard, 29–30 + +changing modes, 25 + +Loop Guard, 32–33 + +path costs, 27 + +port error conditions, 33–36 + +port priority, 26 +PortFast, 28–29 + +Rapid PVST+, 36 + +Root Guard, 31–32 + +root switches, 25–26 + +secondary root switches, 26 + +timers, 27–28 + +UDLD, 33 + +UplinkFast, 30–31 + +VLAN switch priority, 27 + +defined, 24 + +enabling, 24–25 + +extended system ID, verifying, 39 + +forward-time command, 27–28 + +hello-time command, 27–28 + +max-age command, 27–28 + +MSTP, 24–25 + +BackboneFast, 31 + +enabling, 37–38 + +UplinkFast, 31 + +PVST+, 24–25 + +BackboneFast, 44 + +BPDU Filter, 44 + +BPDU Guard, 44 + +configurations, 40–43 +Loop Guard, 44 + +migrating to Rapid PVST+, 43–44 + +PortFast, 44 + +Root Guard, 44 + +UplinkFast, 44 + +Rapid PVST+, 24–25 + +BackboneFast, 31, 44 + +BPDUs, 43 + +BPDU Filter, 44 + +BPDU Guard, 44 + +edge ports, 36 + +enabling, 36 + +Loop Guard, 44 + +non-edge link types, 37 + +non-edge ports, 36 + +point-to-point links, 37 + +PortFast, 44 + +PVST+ migration to, 43–44 + +Root Guard, 44 + +shared links, 37 + +UplinkFast, 31, 44 + +RSTP, 24 + +timers, 27–28 + +troubleshooting, 40 +verifying, 39 + +VLANs, 25 + +strict mode (uRPF), 260 + +strict option, ping command, 264 + +stub areas, 105–106 + +NSSA, 106–107 + +OSPFv3, 92 + +totally NSSA 107–108 + +totally stubby areas, OSPF, 106 + +stub routing, EIGRP, 77–79 + +subnets, redistribution into OSPF, 130 + +summarization + +EIGRP + +auto-summarization, 70 + +manual summarization, 70–71 + +OSPF + +external route summarization, 103–104 + +interarea route summarization, 103 + +summary-address command, 66, 84, 105 + +summary-address not-advertise command, OSPF route filtering, 105 + +summary-prefix command, 105 + +SVIs (Switch Virtual Interfaces), HSRP, 194 + +switchport mode access command, 2–4 + +switchport mode dynamic auto command, 3 +switchport mode dynamic desirable command, 3 + +switchport mode nonegotiate command, 3 + +switchport mode trunk command, 3 + +switchport mode trunk encapsulation command, 4 + +switchport voice command, 2–3 + +Syslog + +configurations, 269 + +logging, configurations, 271 + +message example, 270–271 + +message format, 269–270 + +security levels, 270 + +system (URL prefix), 237 + + +T + +TACACS+ authentication, 255 + +legacy authentication, 255 + +modular authentication, 255–256 + +tar, 237 + +TCL scripting, 294–295, 298 + +tclquit command, 295 + +tclsh command, 295 + +tcp-connect command, 149 + +Telnet, 234 + +tftp, 237 + +TFTP servers +Cisco IFS + +backing up configurations to TFTP servers, 238 + +restoring configurations from TFTP servers, 238–239 + +copy startup-config tftp command, 238 + +copy tftp startup-config command, 239 + +IOS software + +backing up, 239 + +restoring, 239–240 + +upgrading, 239–240 + +time stamps + +NTP, 290 + +timestamp option, ping command, 264 + +time zones, router clock setups + +time zone acronyms, 288–289 + +time zone designators, 289 + +time-based ACL configurations, 248–249 + +timers + +BGP, 161 + +dead interval timers, 101–102 + +EIGRP, 71 + +forward-time command, 27–28 + +hello timers, 101–102 + +hello-time command, 27–28 + +keepalive timers, BGP, 161 +max-age command, 27–28 + +message timers, HSRP, 196 + +network timers, BGP, 161 + +OSPF, 101–102 + +STP configurations, 27–28 + +tos, EIGRP metric weight adjustments, 80 + +totally NSSA, OSPF, 107–108 + +totally stubby areas, OSPF, 106 + +traceroute command, 265 + +track ip sla command, 153 + +track rtr command, 153 + +tracking + +interface tracking + +HSRP, 197 + +VRRP, 203 + +IP SLA tracking, HSRP, 199–200 + +objects, PBR with IP SLAs, 152 + +traffic-share command, 66, 76–77 + +transform sets, site-to-site GRE over IPsec, 337, 338 + +transparent mode + +VLANs, 2 + +VTP, 5, 6, 7 + +troubleshooting + +AAA, 256–257 +BGP, 175–176 + +debug commands, 111 + +DHCP + +IPv4 configurations, 220 + +IPv6 configurations, 223 + +EIGRP, 70, 82–83 + +local SPANs, 281 + +NAT configurations, 191 + +NTP, 286 + +OSPF, 111 + +PAT configurations, 191 + +RSPANs, 281 + +SCP, 241 + +STP, 40 + +uRPF, 260 + +wireless client connectivity + +Cisco AireOS Monitoring Dashboard GUI, 322–326 + +Cisco IOS XE GUI, 326–327 + +WLCs, 316 + +Cisco AireOS Advanced GUI, 318–319 + +Cisco AireOS CLI, 320–322 + +Cisco AireOS Monitoring Dashboard GUI, 316–318 + +Cisco IOS XE CLI, 320–322 + +Cisco IOS XE GUI, 319–320 +trunking + +dot1q trunking, 4–5, 46 + +DTP + +VLAN port assignments, 3–4 + +VTP domain names, 4 + +VLANs + +dot1q trunking, 4–5 + +DTP, 3–4 + +port assignments, 3–4 + +trunk encapsulation, 4–5 + +VTP, 2, 4, 5–6 + +VTP, 2 + +client mode, 5 + +domain names, 4–5 + +DTP trunk negotiations, 4 + +overwriting servers, 6 + +passwords, 5–6 + +primary servers, 6 + +pruning, 6 + +server mode, 5 + +transparent mode, 5 + +verifying, 6 + +versions, 5 + +VLAN configuration, 5–6 +VTP primary server command, 6 + +tunneling + +GRE, 329 + +DMVPNs, 340–347 + +IPv4 configurations, 330 + +IPv4 configurations with OSPFv3, 331–335 + +IPv6 configurations, 330–331 + +IPv6 configurations with OSPFv3, 331–335 + +overlay configurations, 333–334 + +site-to-site GRE over IPsec, 335–339 + +site-to-site VTI over IPsec, 339–340 + +underlay configurations, 332–333 + +verifying, IPv4, 331 + +VTI, site-to-site VTI over IPsec, 339–340 + + +U + +UDLD (Unidirectional Link Detection) + +no shutdown command, 33 + +shutdown command, 33 + +STP configurations, 33 + +undebug all command, 265 + +underlay configurations, GRE, 332–333 + +unequal-cost load balancing, EIGRP, 76 + +unicast addressing + +EIGRP unicast neighbors, 79 +IPv4, 64 + +IPv6, 64 + +universal IOS image filename, 237 + +unneeded IFS services, disabling, 242–243 + +upd-echo command, 149 + +upgrading + +EIGRP + +eigrp upgrade-cli command, 66–67 + +upgrading classic mode configurations to named mode, 66–67 + +IOS software from TFTP servers, 239–240 + +UplinkFast + +PVST+, 44 + +Rapid PVST+, 31, 44 + +Root Guard, 32 + +STP configurations, 30–31 + +URL prefixes for Cisco network devices, 236–237 + +uRPF (Unicast Reverse Path Forwarding) + +configurations, 260 + +loose mode, 260 + +strict mode, 260 + +troubleshooting, 260 + +verifying, 260 + + +V +variance + +EIGRP load balancing, 76 + +variance command, 66, 76 + +verbose option, ping command, 264 + +verifying + +ACL + +IPv4, 251 + +IPv6, 251 + +BGP, 174, 184 + +CoPP, 260 + +DHCP + +IPv4 configurations, 220 + +IPv6 configurations, 224 + +DMVPNs, 346 + +EEM, 298 + +EIGRP, 70, 80–82 + +EtherChannel, 17 + +extended system ID (STP), 39 + +GRE, 331, 339 + +HSRP, 195, 217 + +IP SLAs, 152–153 + +IPSec, site-to-site GRE over IPsec, 339 + +IPv4 route redistribution, 134 + +IPv6 route redistribution, 134 +local SPANs, 281 + +NAT configurations, 190 + +NetFlow, 273 + +NTP, 286 + +OSPF, 109–110 + +OSPFv2 authentication, 98 + +OSPFv3 authentication, 98 + +PAT configurations, 190 + +PBR, path control, 145–146 + +port error conditions, STP configurations, 33–36 + +prefix lists, 140 + +route filtering, 136–137 + +RSPANs, 281 + +SCP, 241 + +SNMP, 269 + +SPANs + +local SPANs, 281 + +RSPANs, 281 + +STP, 39 + +uRPF, 260 + +VLAN information, 7 + +VRF-Lite, 349 + +VRRP, 203 + +VTP, 6 +virtual interfaces + +NAT interfaces, configurations, 190, 193–194 + +switch virtual interfaces, inter-VLAN routing, 46–47 + +virtual links, OSPF, 108–109 + +VLANs (Virtual Local Area Networks) + +2960 series switches, 10–11 + +3650 series switches, 9–10 + +allowed VLANs, 4–5 + +configuration mode, static VLANs, 2 + +configurations + +2960 series switches, 10–11 + +3650 series switches, 9–10 + +erasing, 7–8 + +example of, 8 + +network topology, 8 + +saving, 7 + +copy running-config startup-config command, 7 + +creating, 2 + +data VLANs, port assignments, 2–4 + +database mode, 2 + +defined, 1–2 + +dot1q trunking, 4–5 + +DTP, 3–4 + +EtherChannel configurations, 13 +exit command, 7 + +extended-range VLANs, 2 + +ingress dot1q vlan, local SPANs, 277 + +ingress untagged vlan, local SPANs, 277 + +ingress vlan, local SPANs, 277 + +interface range command, 3 + +inter-VLAN routing + +best practices, 46 + +configurations, 47–48 + +encapsulation isl x command, 46 + +external routers, 45–46 + +IPv6 configurations, 55–60 + +multilayer switches, 46–47 + +network topologies, 47–48 + +routers-on-a-stick, 45–46 + +switch virtual interfaces, 46–47 + +MSTP, 24 + +native VLANs, 2–3 + +normal-range VLANs, 2 + +port assignments + +data VLANs, 2–4 + +voice VLANs, 2–4 + +PVST+, 24 + +range command, 3 +Root Guard, 32 + +show vlan privileged EXEC command, 2 + +SPANs + +local SPANs, 274–277 + +RSPANs, 278–280 + +static VLANs, creating, 2 + +STP, 25 + +path costs, 27 + +switch priority, 27 + +timers, 27–28 + +switchport mode access command, 2–4 + +switchport mode dynamic auto command, 3 + +switchport mode dynamic desirable command, 3 + +switchport mode nonegotiate command, 3 + +switchport mode trunk command, 3 + +switchport mode trunk encapsulation command, 4 + +switchport voice command, 2–3 + +transparent mode, 2 + +trunk encapsulation, 4–5 + +verifying information, 7 + +voice VLANs + +port assignments, 2–4 + +switchport voice command, 2–3 + +VTP, 2, 5–6 +client mode, 5 + +domain names, 4–5 + +DTP trunk negotiations, 4 + +overwriting servers, 6 + +passwords, 5–6 + +primary servers, 6 + +pruning, 6 + +server mode, 5 + +transparent mode, 5–7 + +verifying, 6 + +versions, 5 + +VTP primary server command, 6 + +VPNs (Virtual Private Networks), DMVPNs, 340 + +IPv4 configurations, 341–346 + +OSPF, 346–347 + +verifying, 346 + +vrf upgrade-cli multi-af-mode command, 348 + +VRF-Lite, 347 + +configurations, 347–348 + +verifying, 349 + +VRF + +creating, 347–348 + +interface assignments, 347–348 + +routing, 348 +VRRP (Virtual Router Redundancy Protocol), 201 + +debugging, 204 + +fhrp version vrrp v3 command, 201 + +interface tracking, 203 + +optimization options, 203 + +verifying, 203 + +VRRPv2 + +configurations, 201–202 + +routers/L3 switches with IP SLA tracking, 209–212 + +VRRPv3, 201, 202–203 + +VTI (Virtual Tunnel Interface), site-to-site VTI over IPsec, 339–340 + +VTY ACL configurations, 249–250 + + +W + +WebAuth, 314–316 + +weight attribute (BGP), 164–165 + +AS path access lists, 166 + +prefix lists, 166–167 + +route maps, 166–167 + +WEP (Wired Equivalent Privacy) standard, 306 + +Wide Metrics (EIGRP), 79 + +wildcard masks + +EIGRP IPv4 classic mode configurations, 63 + +OSPF, 90–91 +wireless clients + +authentication, 303 + +802.1x, 307–308 + +EAP, 308–314 + +LWA, 314 + +open authentication, 304–306 + +pre-shared keys, 306–308 + +WebAuth, 314–316 + +WPA2, 306–307 + +connectivity, troubleshooting + +Cisco AireOS Monitoring Dashboard GUI, 322–326 + +Cisco IOS XE GUI, 326–327 + +WLCs, troubleshooting, 316 + +Cisco AireOS Advanced GUI, 318–319 + +Cisco AireOS CLI, 320–322 + +Cisco AireOS Monitoring Dashboard GUI, 316–318 + +Cisco IOS XE CLI, 320–322 + +Cisco IOS XE GUI, 319–320 + +wireless security, 307–308 + +WEP standard, 306 + +wireless client authentication, 303 + +802.1x, 307–308 + +EAP, 308–314 + +LWA, 314 +open authentication, 304–306 + +pre-shared keys, 306–308 + +WebAuth, 314–316 + +WPA2, 306–307 + +WLANs (Wireless Local Area Networks) + +EAP, 312–314 + +open authentication, 304–306 + +WebAuth, 314–316 + +WLCs (Wireless LAN Controllers), troubleshooting, 316 + +Cisco AireOS + +Advanced GUI, 318–319 + +CLI, 320–322 + +Monitoring Dashboard GUI, 316–318 + +Cisco IOS XE + +CLI, 320–322 + +GUI, 319–320 + +WPA2 (Wired Protected Access 2), 306 + +enterprise mode, 307 + +personal mode, 306 + + +X - Y - Z + +xmodem, 237 + +ymodem, 237 +Code Snippets + +Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the eBook in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a “Click here to view code image” link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app. diff --git a/C_Book_2nd conv.txt b/C_Book_2nd conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a9dd45c09db0cf8e7b7069d66524f68223950b0 --- /dev/null +++ b/C_Book_2nd conv.txt @@ -0,0 +1,6914 @@ +2 + +Preface....................................................................................................................................6 Preface to the first edition........................................................................................................8 Chapter 1 - A Tutorial Introduction.........................................................................................9 1.1 Getting Started..............................................................................................................9 1.2 Variables and Arithmetic Expressions..........................................................................11 1.3 The for statement.........................................................................................................15 1.4 Symbolic Constants......................................................................................................17 1.5 Character Input and Output.........................................................................................17 1.5.1 File Copying..........................................................................................................18 1.5.2 Character Counting...............................................................................................19 1.5.3 Line Counting.......................................................................................................20 1.5.4 Word Counting.....................................................................................................21 +1.6 Arrays..........................................................................................................................23 1.7 Functions.....................................................................................................................25 1.8 Arguments - Call by Value...........................................................................................28 1.9 Character Arrays..........................................................................................................29 1.10 External Variables and Scope.....................................................................................31 Chapter 2 - Types, Operators and Expressions.......................................................................35 2.1 Variable Names............................................................................................................35 2.2 Data Types and Sizes...................................................................................................35 2.3 Constants.....................................................................................................................36 2.4 Declarations.................................................................................................................38 2.5 Arithmetic Operators...................................................................................................39 2.6 Relational and Logical Operators.................................................................................39 2.7 Type Conversions........................................................................................................40 2.8 Increment and Decrement Operators............................................................................43 2.9 Bitwise Operators........................................................................................................45 2.10 Assignment Operators and Expressions......................................................................46 2.11 Conditional Expressions.............................................................................................47 2.12 Precedence and Order of Evaluation..........................................................................48 Chapter 3 - Control Flow.......................................................................................................50 3.1 Statements and Blocks.................................................................................................50 3.2 If-Else..........................................................................................................................50 3.3 Else-If..........................................................................................................................51 3.4 Switch..........................................................................................................................52 3.5 Loops - While and For.................................................................................................53 3.6 Loops - Do-While........................................................................................................56 3.7 Break and Continue.....................................................................................................57 3.8 Goto and labels............................................................................................................57 Chapter 4 - Functions and Program Structure........................................................................59 4.1 Basics of Functions......................................................................................................59 4.2 Functions Returning Non-integers................................................................................61 4.3 External Variables........................................................................................................63 4.4 Scope Rules.................................................................................................................68 4.5 Header Files.................................................................................................................69 4.6 Static Variables............................................................................................................70 4.7 Register Variables........................................................................................................71 4.8 Block Structure............................................................................................................71 4.9 Initialization.................................................................................................................72 4.10 Recursion...................................................................................................................73 4.11 The C Preprocessor....................................................................................................74 4.11.1 File Inclusion.......................................................................................................75 4.11.2 Macro Substitution..............................................................................................75 +3 + +4.11.3 Conditional Inclusion..........................................................................................77 Chapter 5 - Pointers and Arrays.............................................................................................78 5.1 Pointers and Addresses................................................................................................78 5.2 Pointers and Function Arguments.................................................................................79 5.3 Pointers and Arrays......................................................................................................81 5.4 Address Arithmetic......................................................................................................84 5.5 Character Pointers and Functions.................................................................................87 5.6 Pointer Arrays; Pointers to Pointers.............................................................................89 5.7 Multi-dimensional Arrays.............................................................................................92 5.8 Initialization of Pointer Arrays.....................................................................................93 5.9 Pointers vs. Multi-dimensional Arrays..........................................................................94 5.10 Command-line Arguments..........................................................................................95 5.11 Pointers to Functions.................................................................................................98 5.12 Complicated Declarations.........................................................................................100 Chapter 6 - Structures..........................................................................................................105 6.1 Basics of Structures...................................................................................................105 6.2 Structures and Functions............................................................................................107 6.3 Arrays of Structures...................................................................................................109 6.4 Pointers to Structures.................................................................................................112 6.5 Self-referential Structures...........................................................................................113 6.6 Table Lookup............................................................................................................117 6.7 Typedef......................................................................................................................119 6.8 Unions.......................................................................................................................120 6.9 Bit-fields....................................................................................................................121 Chapter 7 - Input and Output...............................................................................................124 7.1 Standard Input and Output.........................................................................................124 7.2 Formatted Output - printf...........................................................................................125 7.3 Variable-length Argument Lists..................................................................................127 7.4 Formatted Input - Scanf.............................................................................................128 7.5 File Access.................................................................................................................130 7.6 Error Handling - Stderr and Exit................................................................................132 7.7 Line Input and Output................................................................................................134 7.8 Miscellaneous Functions............................................................................................135 7.8.1 String Operations................................................................................................135 7.8.2 Character Class Testing and Conversion..............................................................135 7.8.3 Ungetc................................................................................................................135 7.8.4 Command Execution...........................................................................................135 7.8.5 Storage Management..........................................................................................136 7.8.6 Mathematical Functions.......................................................................................136 7.8.7 Random Number generation................................................................................136 Chapter 8 - The UNIX System Interface..............................................................................138 8.1 File Descriptors..........................................................................................................138 8.2 Low Level I/O - Read and Write................................................................................139 8.3 Open, Creat, Close, Unlink........................................................................................140 8.4 Random Access - Lseek.............................................................................................142 8.5 Example - An implementation of Fopen and Getc.......................................................142 8.6 Example - Listing Directories.....................................................................................145 8.7 Example - A Storage Allocator..................................................................................149 Appendix A - Reference Manual..........................................................................................154 A.1 Introduction..............................................................................................................154 A.2 Lexical Conventions..................................................................................................154 A.2.1 Tokens...............................................................................................................154 A.2.2 Comments..........................................................................................................154 +4 + +A.2.3 Identifiers...........................................................................................................154 A.2.4 Keywords...........................................................................................................154 A.2.5 Constants...........................................................................................................155 A.2.6 String Literals.....................................................................................................156 A.3 Syntax Notation........................................................................................................156 A.4 Meaning of Identifiers...............................................................................................157 A.4.1 Storage Class.....................................................................................................157 A.4.2 Basic Types........................................................................................................157 A.4.3 Derived types.....................................................................................................158 A.4.4 Type Qualifiers...................................................................................................158 A.5 Objects and Lvalues..................................................................................................158 A.6 Conversions..............................................................................................................159 A.6.1 Integral Promotion.............................................................................................159 A.6.2 Integral Conversions...........................................................................................159 A.6.3 Integer and Floating...........................................................................................159 A.6.4 Floating Types....................................................................................................159 A.6.5 Arithmetic Conversions......................................................................................159 A.6.6 Pointers and Integers..........................................................................................160 A.6.7 Void...................................................................................................................160 A.6.8 Pointers to Void.................................................................................................161 A.7 Expressions...............................................................................................................161 A.7.1 Pointer Conversion.............................................................................................161 A.7.2 Primary Expressions...........................................................................................161 A.7.3 Postfix Expressions............................................................................................162 A.7.4 Unary Operators.................................................................................................164 A.7.5 Casts..................................................................................................................165 A.7.6 Multiplicative Operators.....................................................................................165 A.7.7 Additive Operators.............................................................................................166 A.7.8 Shift Operators...................................................................................................166 A.7.9 Relational Operators...........................................................................................167 A.7.10 Equality Operators...........................................................................................167 A.7.11 Bitwise AND Operator.....................................................................................167 A.7.12 Bitwise Exclusive OR Operator........................................................................167 A.7.13 Bitwise Inclusive OR Operator.........................................................................168 A.7.14 Logical AND Operator.....................................................................................168 A.7.15 Logical OR Operator........................................................................................168 A.7.16 Conditional Operator........................................................................................168 A.7.17 Assignment Expressions...................................................................................169 A.7.18 Comma Operator..............................................................................................169 A.7.19 Constant Expressions.......................................................................................169 A.8 Declarations..............................................................................................................170 A.8.1 Storage Class Specifiers.....................................................................................170 A.8.2 Type Specifiers...................................................................................................171 A.8.3 Structure and Union Declarations.......................................................................172 A.8.4 Enumerations.....................................................................................................174 A.8.5 Declarators.........................................................................................................175 A.8.6 Meaning of Declarators......................................................................................176 A.8.7 Initialization.......................................................................................................178 A.8.8 Type names........................................................................................................180 A.8.9 Typedef..............................................................................................................181 A.8.10 Type Equivalence.............................................................................................181 A.9 Statements................................................................................................................181 A.9.1 Labeled Statements.............................................................................................182 +5 + +A.9.2 Expression Statement.........................................................................................182 A.9.3 Compound Statement.........................................................................................182 A.9.4 Selection Statements..........................................................................................183 A.9.5 Iteration Statements...........................................................................................183 A.9.6 Jump statements.................................................................................................184 A.10 External Declarations..............................................................................................184 A.10.1 Function Definitions.........................................................................................185 A.10.2 External Declarations.......................................................................................186 A.11 Scope and Linkage..................................................................................................186 A.11.1 Lexical Scope...................................................................................................187 A.11.2 Linkage............................................................................................................187 A.12 Preprocessing..........................................................................................................187 A.12.1 Trigraph Sequences..........................................................................................188 A.12.2 Line Splicing....................................................................................................188 A.12.3 Macro Definition and Expansion.......................................................................188 A.12.4 File Inclusion....................................................................................................190 A.12.5 Conditional Compilation...................................................................................191 A.12.6 Line Control.....................................................................................................192 A.12.7 Error Generation..............................................................................................192 A.12.8 Pragmas............................................................................................................192 A.12.9 Null directive....................................................................................................192 A.12.10 Predefined names............................................................................................192 A.13 Grammar.................................................................................................................193 Appendix B - Standard Library............................................................................................199 B.1 Input and Output: ......................................................................................199 B.1.1 File Operations...................................................................................................199 B.1.2 Formatted Output...............................................................................................200 B.1.3 Formatted Input..................................................................................................202 B.1.4 Character Input and Output Functions................................................................203 B.1.5 Direct Input and Output Functions......................................................................204 B.1.6 File Positioning Functions...................................................................................204 B.1.7 Error Functions..................................................................................................205 +B.2 Character Class Tests: ...............................................................................205 B.3 String Functions: ......................................................................................205 B.4 Mathematical Functions: ............................................................................206 B.5 Utility Functions: ......................................................................................207 B.6 Diagnostics: ..............................................................................................209 B.7 Variable Argument Lists: .........................................................................209 B.8 Non-local Jumps: ....................................................................................210 B.9 Signals: ....................................................................................................210 B.10 Date and Time Functions: .........................................................................210 B.11 Implementation-defined Limits: and .........................................212 Appendix C - Summary of Changes.....................................................................................214 +6 + + +Preface +The computing world has undergone a revolution since the publication of The C Programming Language in 1978. Big computers are much bigger, and personal computers have capabilities that rival mainframes of a decade ago. During this time, C has changed too, although only modestly, and it has spread far beyond its origins as the language of the UNIX operating system. +The growing popularity of C, the changes in the language over the years, and the creation of compilers by groups not involved in its design, combined to demonstrate a need for a more precise and more contemporary definition of the language than the first edition of this book provided. In 1983, the American National Standards Institute (ANSI) established a committee whose goal was to produce ``an unambiguous and machine-independent definition of the language C'', while still retaining its spirit. The result is the ANSI standard for C. + +The standard formalizes constructions that were hinted but not described in the first edition, particularly structure assignment and enumerations. It provides a new form of function declaration that permits cross-checking of definition with use. It specifies a standard library, with an extensive set of functions for performing input and output, memory management, string manipulation, and similar tasks. It makes precise the behavior of features that were not spelled out in the original definition, and at the same time states explicitly which aspects of the language remain machine-dependent. + +This Second Edition of The C Programming Language describes C as defined by the ANSI standard. Although we have noted the places where the language has evolved, we have chosen to write exclusively in the new form. For the most part, this makes no significant difference; the most visible change is the new form of function declaration and definition. Modern compilers already support most features of the standard. + +We have tried to retain the brevity of the first edition. C is not a big language, and it is not well served by a big book. We have improved the exposition of critical features, such as pointers, that are central to C programming. We have refined the original examples, and have added new examples in several chapters. For instance, the treatment of complicated declarations is augmented by programs that convert declarations into words and vice versa. As before, all examples have been tested directly from the text, which is in machine-readable form. + +Appendix A, the reference manual, is not the standard, but our attempt to convey the essentials of the standard in a smaller space. It is meant for easy comprehension by programmers, but not as a definition for compiler writers -- that role properly belongs to the standard itself. Appendix B is a summary of the facilities of the standard library. It too is meant for reference by programmers, not implementers. Appendix C is a concise summary of the changes from the original version. + +As we said in the preface to the first edition, C ``wears well as one's experience with it grows''. With a decade more experience, we still feel that way. We hope that this book will help you learn C and use it well. + +We are deeply indebted to friends who helped us to produce this second edition. Jon Bently, Doug Gwyn, Doug McIlroy, Peter Nelson, and Rob Pike gave us perceptive comments on almost every page of draft manuscripts. We are grateful for careful reading by Al Aho, Dennis Allison, Joe Campbell, G.R. Emlin, Karen Fortgang, Allen Holub, Andrew Hume, Dave Kristol, John Linderman, Dave Prosser, Gene Spafford, and Chris van Wyk. We also received helpful suggestions from Bill Cheswick, Mark Kernighan, Andy Koenig, Robin Lake, Tom +7 + +London, Jim Reeds, Clovis Tondo, and Peter Weinberger. Dave Prosser answered many detailed questions about the ANSI standard. We used Bjarne Stroustrup's C++ translator extensively for local testing of our programs, and Dave Kristol provided us with an ANSI C compiler for final testing. Rich Drechsler helped greatly with typesetting. + + + +Our sincere thanks to all. + +Brian W. Kernighan Dennis M. Ritchie +8 + + +Preface to the first edition +C is a general-purpose programming language with features economy of expression, modern flow control and data structures, and a rich set of operators. C is not a ``very high level'' language, nor a ``big'' one, and is not specialized to any particular area of application. But its absence of restrictions and its generality make it more convenient and effective for many tasks than supposedly more powerful languages. +C was originally designed for and implemented on the UNIX operating system on the DEC PDP-11, by Dennis Ritchie. The operating system, the C compiler, and essentially all UNIX applications programs (including all of the software used to prepare this book) are written in C. Production compilers also exist for several other machines, including the IBM System/370, the Honeywell 6000, and the Interdata 8/32. C is not tied to any particular hardware or system, however, and it is easy to write programs that will run without change on any machine that supports C. + +This book is meant to help the reader learn how to program in C. It contains a tutorial introduction to get new users started as soon as possible, separate chapters on each major feature, and a reference manual. Most of the treatment is based on reading, writing and revising examples, rather than on mere statements of rules. For the most part, the examples are complete, real programs rather than isolated fragments. All examples have been tested directly from the text, which is in machine-readable form. Besides showing how to make effective use of the language, we have also tried where possible to illustrate useful algorithms and principles of good style and sound design. + +The book is not an introductory programming manual; it assumes some familiarity with basic programming concepts like variables, assignment statements, loops, and functions. Nonetheless, a novice programmer should be able to read along and pick up the language, although access to more knowledgeable colleague will help. + +In our experience, C has proven to be a pleasant, expressive and versatile language for a wide variety of programs. It is easy to learn, and it wears well as on's experience with it grows. We hope that this book will help you to use it well. + +The thoughtful criticisms and suggestions of many friends and colleagues have added greatly to this book and to our pleasure in writing it. In particular, Mike Bianchi, Jim Blue, Stu Feldman, Doug McIlroy Bill Roome, Bob Rosin and Larry Rosler all read multiple volumes with care. We are also indebted to Al Aho, Steve Bourne, Dan Dvorak, Chuck Haley, Debbie Haley, Marion Harris, Rick Holt, Steve Johnson, John Mashey, Bob Mitze, Ralph Muha, Peter Nelson, Elliot Pinson, Bill Plauger, Jerry Spivack, Ken Thompson, and Peter Weinberger for helpful comments at various stages, and to Mile Lesk and Joe Ossanna for invaluable assistance with typesetting. + + + +Brian W. Kernighan Dennis M. Ritchie +9 + + +Chapter 1 - A Tutorial Introduction +Let us begin with a quick introduction in C. Our aim is to show the essential elements of the language in real programs, but without getting bogged down in details, rules, and exceptions. At this point, we are not trying to be complete or even precise (save that the examples are meant to be correct). We want to get you as quickly as possible to the point where you can write useful programs, and to do that we have to concentrate on the basics: variables and constants, arithmetic, control flow, functions, and the rudiments of input and output. We are intentionally leaving out of this chapter features of C that are important for writing bigger programs. These include pointers, structures, most of C's rich set of operators, several control-flow statements, and the standard library. +This approach and its drawbacks. Most notable is that the complete story on any particular feature is not found here, and the tutorial, by being brief, may also be misleading. And because the examples do not use the full power of C, they are not as concise and elegant as they might be. We have tried to minimize these effects, but be warned. Another drawback is that later chapters will necessarily repeat some of this chapter. We hope that the repetition will help you more than it annoys. + +In any case, experienced programmers should be able to extrapolate from the material in this chapter to their own programming needs. Beginners should supplement it by writing small, similar programs of their own. Both groups can use it as a framework on which to hang the more detailed descriptions that begin in Chapter 2. + +1.1 Getting Started +The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages: +Print the words +hello, world +This is a big hurdle; to leap over it you have to be able to create the program text somewhere, compile it successfully, load it, run it, and find out where your output went. With these mechanical details mastered, everything else is comparatively easy. + +In C, the program to print ``hello, world'' is + +#include + +main() { +printf("hello, world\n"); } + +Just how to run this program depends on the system you are using. As a specific example, on the UNIX operating system you must create the program in a file whose name ends in ``.c'', such as hello.c, then compile it with the command + +cc hello.c + +If you haven't botched anything, such as omitting a character or misspelling something, the compilation will proceed silently, and make an executable file called a.out. If you run a.out by typing the command + +a.out it will print +10 + + +hello, world +On other systems, the rules will be different; check with a local expert. +Now, for some explanations about the program itself. A C program, whatever its size, consists of functions and variables. A function contains statements that specify the computing operations to be done, and variables store values used during the computation. C functions are like the subroutines and functions in Fortran or the procedures and functions of Pascal. Our example is a function named main. Normally you are at liberty to give functions whatever names you like, but ``main'' is special - your program begins executing at the beginning of main. This means that every program must have a main somewhere. + +mainwill usually call other functions to help perform its job, some that you wrote, and others from libraries that are provided for you. The first line of the program, + +#include +tells the compiler to include information about the standard input/output library; the line appears at the beginning of many C source files. The standard library is described in Chapter 7 and Appendix B. +One method of communicating data between functions is for the calling function to provide a list of values, called arguments, to the function it calls. The parentheses after the function name surround the argument list. In this example, mainis defined to be a function that expects no arguments, which is indicated by the empty list ( ). + + + + +#include library +main() + +{ +printf("hello, world\n"); + +} + +include information about standard + +define a function called main that received no argument values +statements of main are enclosed in braces main calls library function printf +to print this sequence of characters \n represents the newline character + +The first C program + + +The statements of a function are enclosed in braces { }. The function maincontains only one statement, + +printf("hello, world\n"); +A function is called by naming it, followed by a parenthesized list of arguments, so this calls the function printfwith the argument "hello, world\n". printfis a library function that prints output, in this case the string of characters between the quotes. +A sequence of characters in double quotes, like "hello, world\n", is called a character string or string constant. For the moment our only use of character strings will be as arguments for printf and other functions. + +The sequence \n in the string is C notation for the newline character, which when printed advances the output to the left margin on the next line. If you leave out the \n(a worthwhile experiment), you will find that there is no line advance after the output is printed. You must use \n to include a newline character in the printf argument; if you try something like + +printf("hello, world "); +11 + +the C compiler will produce an error message. +printfnever supplies a newline character automatically, so several calls may be used to build up an output line in stages. Our first program could just as well have been written + +#include + +main() { +printf("hello, "); printf("world"); printf("\n"); +} +to produce identical output. +Notice that \n represents only a single character. An escape sequence like \n provides a general and extensible mechanism for representing hard-to-type or invisible characters. Among the others that C provides are \tfor tab, \bfor backspace, \"for the double quote and \\for the backslash itself. There is a complete list in Section 2.3. + +Exercise 1-1. Run the ``hello, world'' program on your system. Experiment with leaving out parts of the program, to see what error messages you get. + +Exercise 1-2. Experiment to find out what happens when prints's argument string contains \c, where c is some character not listed above. + +1.2 Variables and Arithmetic Expressions +The next program uses the formula oC=(5/9)(oF-32) to print the following table of Fahrenheit temperatures and their centigrade or Celsius equivalents: +12 + + +1 -17 20 -6 40 4 60 15 80 26 100 37 120 48 140 60 160 71 180 82 200 93 220 104 240 115 260 126 280 137 300 148 +The program itself still consists of the definition of a single function named main. It is longer than the one that printed ``hello, world'', but not complicated. It introduces several new ideas, including comments, declarations, variables, arithmetic expressions, loops , and formatted output. + +#include + +/* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */ +main() { +int fahr, celsius; +int lower, upper, step; + + +lower = 0; upper = 300; step = 20; + +/* lower limit of temperature scale */ /* upper limit */ +/* step size */ + + +fahr = lower; +while (fahr <= upper) { +celsius = 5 * (fahr-32) / 9; printf("%d\t%d\n", fahr, celsius); fahr = fahr + step; +} } +The two lines + +/* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */ +are a comment, which in this case explains briefly what the program does. Any characters between /*and */are ignored by the compiler; they may be used freely to make a program easier to understand. Comments may appear anywhere where a blank, tab or newline can. +In C, all variables must be declared before they are used, usually at the beginning of the function before any executable statements. A declaration announces the properties of variables; it consists of a name and a list of variables, such as + +int fahr, celsius; +int lower, upper, step; +The type intmeans that the variables listed are integers; by contrast with float, which means floating point, i.e., numbers that may have a fractional part. The range of both intand float depends on the machine you are using; 16-bits ints, which lie between -32768 and +32767, are common, as are 32-bit ints. A floatnumber is typically a 32-bit quantity, with at least six significant digits and magnitude generally between about 10-38 and 1038. +C provides several other data types besides int and float, including: +13 + +char character - a single byte short short integer +long long integer +double double-precision floating point + +The size of these objects is also machine-dependent. There are also arrays, structures and unions of these basic types, pointers to them, and functions that return them, all of which we will meet in due course. + +Computation in the temperature conversion program begins with the assignment statements + +lower = 0; upper = 300; step = 20; +which set the variables to their initial values. Individual statements are terminated by semicolons. +Each line of the table is computed the same way, so we use a loop that repeats once per output line; this is the purpose of the while loop + + +while (fahr <= upper) { ... +} +The whileloop operates as follows: The condition in parentheses is tested. If it is true (fahr is less than or equal to upper), the body of the loop (the three statements enclosed in braces) is executed. Then the condition is re-tested, and if true, the body is executed again. When the test becomes false (fahrexceeds upper) the loop ends, and execution continues at the statement that follows the loop. There are no further statements in this program, so it terminates. +The body of a whilecan be one or more statements enclosed in braces, as in the temperature converter, or a single statement without braces, as in + +while (i < j) i = 2 * i; +In either case, we will always indent the statements controlled by the whileby one tab stop (which we have shown as four spaces) so you can see at a glance which statements are inside the loop. The indentation emphasizes the logical structure of the program. Although C compilers do not care about how a program looks, proper indentation and spacing are critical in making programs easy for people to read. We recommend writing only one statement per line, and using blanks around operators to clarify grouping. The position of braces is less important, although people hold passionate beliefs. We have chosen one of several popular styles. Pick a style that suits you, then use it consistently. +Most of the work gets done in the body of the loop. The Celsius temperature is computed and assigned to the variable celsius by the statement + +celsius = 5 * (fahr-32) / 9; +The reason for multiplying by 5 and dividing by 9 instead of just multiplying by 5/9is that in C, as in many other languages, integer division truncates: any fractional part is discarded. Since 5and 9are integers. 5/9would be truncated to zero and so all the Celsius temperatures would be reported as zero. +This example also shows a bit more of how printf works. printf is a general-purpose output formatting function, which we will describe in detail in Chapter 7. Its first argument is a string of characters to be printed, with each %indicating where one of the other (second, third, +14 + +...) arguments is to be substituted, and in what form it is to be printed. For instance, %d specifies an integer argument, so the statement + +printf("%d\t%d\n", fahr, celsius); +causes the values of the two integers fahrand celsiusto be printed, with a tab (\t) between them. +Each %construction in the first argument of printfis paired with the corresponding second argument, third argument, etc.; they must match up properly by number and type, or you will get wrong answers. + +By the way, printfis not part of the C language; there is no input or output defined in C itself. printfis just a useful function from the standard library of functions that are normally accessible to C programs. The behaviour of printfis defined in the ANSI standard, however, so its properties should be the same with any compiler and library that conforms to the standard. + +In order to concentrate on C itself, we don't talk much about input and output until chapter 7. In particular, we will defer formatted input until then. If you have to input numbers, read the discussion of the function scanf in Section 7.4. scanfis like printf, except that it reads input instead of writing output. + +There are a couple of problems with the temperature conversion program. The simpler one is that the output isn't very pretty because the numbers are not right-justified. That's easy to fix; if we augment each %din the printfstatement with a width, the numbers printed will be right-justified in their fields. For instance, we might say + +printf("%3d %6d\n", fahr, celsius); +to print the first number of each line in a field three digits wide, and the second in a field six digits wide, like this: + +0 -17 20 -6 40 4 60 15 80 26 100 37 +... +The more serious problem is that because we have used integer arithmetic, the Celsius temperatures are not very accurate; for instance, 0oF is actually about -17.8oC, not -17. To get more accurate answers, we should use floating-point arithmetic instead of integer. This requires some changes in the program. Here is the second version: + +#include + +/* print Fahrenheit-Celsius table +for fahr = 0, 20, ..., 300; floating-point version */ main() +{ +float fahr, celsius; float lower, upper, step; + + +lower = 0; upper = 300; step = 20; + +/* lower limit of temperatuire scale */ /* upper limit */ +/* step size */ + + +fahr = lower; +while (fahr <= upper) { +celsius = (5.0/9.0) * (fahr-32.0); printf("%3.0f %6.1f\n", fahr, celsius); +15 + +fahr = fahr + step; } +} +This is much the same as before, except that fahrand celsiusare declared to be floatand the formula for conversion is written in a more natural way. We were unable to use 5/9in the previous version because integer division would truncate it to zero. A decimal point in a constant indicates that it is floating point, however, so 5.0/9.0is not truncated because it is the ratio of two floating-point values. +If an arithmetic operator has integer operands, an integer operation is performed. If an arithmetic operator has one floating-point operand and one integer operand, however, the integer will be converted to floating point before the operation is done. If we had written (fahr-32), the 32would be automatically converted to floating point. Nevertheless, writing floating-point constants with explicit decimal points even when they have integral values emphasizes their floating-point nature for human readers. + +The detailed rules for when integers are converted to floating point are in Chapter 2. For now, notice that the assignment + +fahr = lower; and the test + +while (fahr <= upper) +also work in the natural way - the int is converted to float before the operation is done. +The printfconversion specification %3.0fsays that a floating-point number (here fahr) is to be printed at least three characters wide, with no decimal point and no fraction digits. %6.1f describes another number (celsius) that is to be printed at least six characters wide, with 1 digit after the decimal point. The output looks like this: +0 -17.8 20 -6.7 40 4.4 +... +Width and precision may be omitted from a specification: %6fsays that the number is to be at least six characters wide; %.2fspecifies two characters after the decimal point, but the width is not constrained; and %f merely says to print the number as floating point. +%d print as decimal integer +%6d print as decimal integer, at least 6 characters wide %f print as floating point +%6f print as floating point, at least 6 characters wide +%.2f print as floating point, 2 characters after decimal point +%6.2f print as floating point, at least 6 wide and 2 after decimal point + +Among others, printfalso recognizes %ofor octal, %xfor hexadecimal, %cfor character, %s for character string and %% for itself. + +Exercise 1-3. Modify the temperature conversion program to print a heading above the table. + +Exercise 1-4. Write a program to print the corresponding Celsius to Fahrenheit table. + +1.3 The for statement +There are plenty of different ways to write a program for a particular task. Let's try a variation on the temperature converter. + +#include +16 + +/* print Fahrenheit-Celsius table */ main() +{ +int fahr; + +for (fahr = 0; fahr <= 300; fahr = fahr + 20) printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32)); +} +This produces the same answers, but it certainly looks different. One major change is the elimination of most of the variables; only fahr remains, and we have made it an int. The lower and upper limits and the step size appear only as constants in the forstatement, itself a new construction, and the expression that computes the Celsius temperature now appears as the third argument of printf instead of a separate assignment statement. +This last change is an instance of a general rule - in any context where it is permissible to use the value of some type, you can use a more complicated expression of that type. Since the third argument of printf must be a floating-point value to match the %6.1f, any floating-point expression can occur here. + +The forstatement is a loop, a generalization of the while. If you compare it to the earlier while, its operation should be clear. Within the parentheses, there are three parts, separated by semicolons. The first part, the initialization + +fahr = 0 +17 + +is done once, before the loop proper is entered. The second part is the test or condition that controls the loop: + +fahr <= 300 +This condition is evaluated; if it is true, the body of the loop (here a single ptintf) is executed. Then the increment step + +fahr = fahr + 20 +is executed, and the condition re-evaluated. The loop terminates if the condition has become false. As with the while, the body of the loop can be a single statement or a group of statements enclosed in braces. The initialization, condition and increment can be any expressions. +The choice between whileand for is arbitrary, based on which seems clearer. The for is usually appropriate for loops in which the initialization and increment are single statements and logically related, since it is more compact than whileand it keeps the loop control statements together in one place. + +Exercise 1-5. Modify the temperature conversion program to print the table in reverse order, that is, from 300 degrees to 0. + +1.4 Symbolic Constants +A final observation before we leave temperature conversion forever. It's bad practice to bury ``magic numbers'' like 300 and 20 in a program; they convey little information to someone who might have to read the program later, and they are hard to change in a systematic way. One way to deal with magic numbers is to give them meaningful names. A #defineline defines a symbolic name or symbolic constant to be a particular string of characters: +#definename replacement list + +Thereafter, any occurrence of name (not in quotes and not part of another name) will be replaced by the corresponding replacement text. The name has the same form as a variable name: a sequence of letters and digits that begins with a letter. The replacement text can be any sequence of characters; it is not limited to numbers. + +#include + + +#define LOWER 0 #define UPPER 300 #define STEP 20 + +/* lower limit of table */ /* upper limit */ +/* step size */ + + +/* print Fahrenheit-Celsius table */ main() +{ +int fahr; + +for (fahr = LOWER; fahr <= UPPER; fahr = fahr + STEP) printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32)); +} +The quantities LOWER, UPPERand STEPare symbolic constants, not variables, so they do not appear in declarations. Symbolic constant names are conventionally written in upper case so they can ber readily distinguished from lower case variable names. Notice that there is no semicolon at the end of a #define line. +1.5 Character Input and Output +We are going to consider a family of related programs for processing character data. You will find that many programs are just expanded versions of the prototypes that we discuss here. +18 + +The model of input and output supported by the standard library is very simple. Text input or output, regardless of where it originates or where it goes to, is dealt with as streams of characters. A text stream is a sequence of characters divided into lines; each line consists of zero or more characters followed by a newline character. It is the responsibility of the library to make each input or output stream confirm this model; the C programmer using the library need not worry about how lines are represented outside the program. + +The standard library provides several functions for reading or writing one character at a time, of which getcharand putcharare the simplest. Each time it is called, getcharreads the next input character from a text stream and returns that as its value. That is, after + +c = getchar(); +the variable ccontains the next character of input. The characters normally come from the keyboard; input from files is discussed in Chapter 7. +The function putchar prints a character each time it is called: + +putchar(c); +prints the contents of the integer variable c as a character, usually on the screen. Calls to putcharand printfmay be interleaved; the output will appear in the order in which the calls are made. +1.5.1 File Copying +Given getchar and putchar, you can write a surprising amount of useful code without knowing anything more about input and output. The simplest example is a program that copies its input to its output one character at a time: + +read a character +while (charater is not end-of-file indicator) output the character just read +read a character Converting this into C gives: + +#include + +/* copy input to output; 1st version */ main() +{ +int c; + +c = getchar(); while (c != EOF) { +putchar(c); +c = getchar(); } +} +The relational operator != means ``not equal to''. +What appears to be a character on the keyboard or screen is of course, like everything else, stored internally just as a bit pattern. The type char is specifically meant for storing such character data, but any integer type can be used. We used int for a subtle but important reason. + +The problem is distinguishing the end of input from valid data. The solution is that getchar returns a distinctive value when there is no more input, a value that cannot be confused with any real character. This value is called EOF, for ``end of file''. We must declare cto be a type big enough to hold any value that getcharreturns. We can't use charsince cmust be big enough to hold EOF in addition to any possible char. Therefore we use int. +19 + +EOFis an integer defined in , but the specific numeric value doesn't matter as long as it is not the same as any char value. By using the symbolic constant, we are assured that nothing in the program depends on the specific numeric value. + +The program for copying would be written more concisely by experienced C programmers. In C, any assignment, such as + +c = getchar(); +is an expression and has a value, which is the value of the left hand side after the assignment. This means that a assignment can appear as part of a larger expression. If the assignment of a character to cis put inside the test part of a whileloop, the copy program can be written this way: + +#include + +/* copy input to output; 2nd version */ main() +{ +int c; + +while ((c = getchar()) != EOF) putchar(c); +} +The whilegets a character, assigns it to c, and then tests whether the character was the end-of-file signal. If it was not, the body of the whileis executed, printing the character. The whilethen repeats. When the end of the input is finally reached, the whileterminates and so does main. +This version centralizes the input - there is now only one reference to getchar- and shrinks the program. The resulting program is more compact, and, once the idiom is mastered, easier to read. You'll see this style often. (It's possible to get carried away and create impenetrable code, however, a tendency that we will try to curb.) + +The parentheses around the assignment, within the condition are necessary. The precedence of != is higher than that of =, which means that in the absence of parentheses the relational test != would be done before the assignment =. So the statement + +c = getchar() != EOF is equivalent to + +c = (getchar() != EOF) +This has the undesired effect of setting cto 0 or 1, depending on whether or not the call of getchar returned end of file. (More on this in Chapter 2.) +Exercsise 1-6. Verify that the expression getchar() != EOF is 0 or 1. + +Exercise 1-7. Write a program to print the value of EOF. + +1.5.2 Character Counting +The next program counts characters; it is similar to the copy program. + +#include + +/* count characters in input; 1st version */ main() +{ +long nc; + +nc = 0; +while (getchar() != EOF) +20 + +++nc; printf("%ld\n", nc); +} +The statement + +++nc; +presents a new operator, ++, which means increment by one. You could instead write nc = nc + 1 but ++nc is more concise and often more efficient. There is a corresponding operator -- to decrement by 1. The operators ++ and -- can be either prefix operators (++nc) or postfix operators (nc++); these two forms have different values in expressions, as will be shown in Chapter 2, but ++ncand nc++both increment nc. For the moment we will will stick to the prefix form. +The character counting program accumulates its count in a long variable instead of an int. long integers are at least 32 bits. Although on some machines, int and long are the same size, on others an intis 16 bits, with a maximum value of 32767, and it would take relatively little input to overflow an int counter. The conversion specification %ld tells printf that the corresponding argument is a long integer. + +It may be possible to cope with even bigger numbers by using a double (double precision float). We will also use a forstatement instead of a while, to illustrate another way to write the loop. + +#include + +/* count characters in input; 2nd version */ main() +{ +double nc; + +for (nc = 0; gechar() != EOF; ++nc) ; +printf("%.0f\n", nc); } +printfuses %ffor both floatand double; %.0fsuppresses the printing of the decimal point and the fraction part, which is zero. +The body of this forloop is empty, because all the work is done in the test and increment parts. But the grammatical rules of C require that a forstatement have a body. The isolated semicolon, called a null statement, is there to satisfy that requirement. We put it on a separate line to make it visible. + +Before we leave the character counting program, observe that if the input contains no characters, the while or for test fails on the very first call to getchar, and the program produces zero, the right answer. This is important. One of the nice things about whileand for is that they test at the top of the loop, before proceeding with the body. If there is nothing to do, nothing is done, even if that means never going through the loop body. Programs should act intelligently when given zero-length input. The whileand forstatements help ensure that programs do reasonable things with boundary conditions. + +1.5.3 Line Counting +The next program counts input lines. As we mentioned above, the standard library ensures that an input text stream appears as a sequence of lines, each terminated by a newline. Hence, counting lines is just counting newlines: + +#include + +/* count lines in input */ main() +21 + +{ +int c, nl; + +nl = 0; +while ((c = getchar()) != EOF) if (c == '\n') +++nl; printf("%d\n", nl); +} +The body of the whilenow consists of an if, which in turn controls the increment ++nl. The if statement tests the parenthesized condition, and if the condition is true, executes the statement (or group of statements in braces) that follows. We have again indented to show what is controlled by what. +The double equals sign ==is the C notation for ``is equal to'' (like Pascal's single =or Fortran's .EQ.). This symbol is used to distinguish the equality test from the single =that C uses for assignment. A word of caution: newcomers to C occasionally write =when they mean ==. As we will see in Chapter 2, the result is usually a legal expression, so you will get no warning. + +A character written between single quotes represents an integer value equal to the numerical value of the character in the machine's character set. This is called a character constant, although it is just another way to write a small integer. So, for example, 'A'is a character constant; in the ASCII character set its value is 65, the internal representation of the character A. Of course, 'A'is to be preferred over 65: its meaning is obvious, and it is independent of a particular character set. + +The escape sequences used in string constants are also legal in character constants, so '\n' stands for the value of the newline character, which is 10 in ASCII. You should note carefully that '\n'is a single character, and in expressions is just an integer; on the other hand, '\n'is a string constant that happens to contain only one character. The topic of strings versus characters is discussed further in Chapter 2. + +Exercise 1-8. Write a program to count blanks, tabs, and newlines. + +Exercise 1-9. Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank. + +Exercise 1-10. Write a program to copy its input to its output, replacing each tab by \t, each backspace by \b, and each backslash by \\. This makes tabs and backspaces visible in an unambiguous way. + +1.5.4 Word Counting +The fourth in our series of useful programs counts lines, words, and characters, with the loose definition that a word is any sequence of characters that does not contain a blank, tab or newline. This is a bare-bones version of the UNIX program wc. + +#include + + +#define IN 1 #define OUT 0 + +/* inside a word */ /* outside a word */ + + +/* count lines, words, and characters in input */ main() +{ +int c, nl, nw, nc, state; + +state = OUT; +nl = nw = nc = 0; +while ((c = getchar()) != EOF) { +22 + +++nc; +if (c == '\n') ++nl; +if (c == ' ' || c == '\n' || c = '\t') state = OUT; +else if (state == OUT) { state = IN; +++nw; } +} +printf("%d %d %d\n", nl, nw, nc); } +Every time the program encounters the first character of a word, it counts one more word. The variable staterecords whether the program is currently in a word or not; initially it is ``not in a word'', which is assigned the value OUT. We prefer the symbolic constants INand OUTto the literal values 1 and 0 because they make the program more readable. In a program as tiny as this, it makes little difference, but in larger programs, the increase in clarity is well worth the modest extra effort to write it this way from the beginning. You'll also find that it's easier to make extensive changes in programs where magic numbers appear only as symbolic constants. +23 + +The line + +nl = nw = nc = 0; +sets all three variables to zero. This is not a special case, but a consequence of the fact that an assignment is an expression with the value and assignments associated from right to left. It's as if we had written + +nl = (nw = (nc = 0)); +The operator || means OR, so the line + +if (c == ' ' || c == '\n' || c = '\t') +says ``if cis a blank or cis a newline or cis a tab''. (Recall that the escape sequence \tis a visible representation of the tab character.) There is a corresponding operator &&for AND; its precedence is just higher than ||. Expressions connected by && or || are evaluated left to right, and it is guaranteed that evaluation will stop as soon as the truth or falsehood is known. If cis a blank, there is no need to test whether it is a newline or tab, so these tests are not made. This isn't particularly important here, but is significant in more complicated situations, as we will soon see. +The example also shows an else, which specifies an alternative action if the condition part of an if statement is false. The general form is + +if (expression) statement1 +else statement2 +One and only one of the two statements associated with an if-else is performed. If the expression is true, statement1 is executed; if not, statement2 is executed. Each statement can be a single statement or several in braces. In the word count program, the one after the elseis an if that controls two statements in braces. +Exercise 1-11. How would you test the word count program? What kinds of input are most likely to uncover bugs if there are any? + +Exercise 1-12. Write a program that prints its input one word per line. + +1.6 Arrays +Let is write a program to count the number of occurrences of each digit, of white space characters (blank, tab, newline), and of all other characters. This is artificial, but it permits us to illustrate several aspects of C in one program. +There are twelve categories of input, so it is convenient to use an array to hold the number of occurrences of each digit, rather than ten individual variables. Here is one version of the program: +24 + + +#include + +/* count digits, white space, others */ main() +{ +int c, i, nwhite, nother; int ndigit[10]; + +nwhite = nother = 0; for (i = 0; i < 10; ++i) +ndigit[i] = 0; + +while ((c = getchar()) != EOF) if (c >= '0' && c <= '9') +++ndigit[c-'0']; +else if (c == ' ' || c == '\n' || c == '\t') ++nwhite; +else ++nother; + +printf("digits ="); +for (i = 0; i < 10; ++i) printf(" %d", ndigit[i]); +printf(", white space = %d, other = %d\n", nwhite, nother); +} +The output of this program on itself is + +digits = 9 3 0 0 0 0 0 0 0 1, white space = 123, other = 345 The declaration + +int ndigit[10]; +declares ndigitto be an array of 10 integers. Array subscripts always start at zero in C, so the elements are ndigit[0], ndigit[1], ..., ndigit[9]. This is reflected in the forloops that initialize and print the array. +A subscript can be any integer expression, which includes integer variables like i, and integer constants. + +This particular program relies on the properties of the character representation of the digits. For example, the test + +if (c >= '0' && c <= '9') +determines whether the character in c is a digit. If it is, the numeric value of that digit is + +c - '0' +This works only if '0', '1', ..., '9'have consecutive increasing values. Fortunately, this is true for all character sets. +By definition, chars are just small integers, so charvariables and constants are identical to ints in arithmetic expressions. This is natural and convenient; for example c-'0'is an integer expression with a value between 0 and 9 corresponding to the character '0' to '9' stored in c, and thus a valid subscript for the array ndigit. + +The decision as to whether a character is a digit, white space, or something else is made with the sequence + +if (c >= '0' && c <= '9') ++ndigit[c-'0']; +else if (c == ' ' || c == '\n' || c == '\t') ++nwhite; +25 + +else ++nother; +The pattern + +if (condition1) statement1 +else if (condition2) statement2 +... ... +else statementn +occurs frequently in programs as a way to express a multi-way decision. The conditions are evaluated in order from the top until some condition is satisfied; at that point the corresponding statement part is executed, and the entire construction is finished. (Any statement can be several statements enclosed in braces.) If none of the conditions is satisfied, the statement after the final elseis executed if it is present. If the final elseand statement are omitted, as in the word count program, no action takes place. There can be any number of +else if(condition) statement + +groups between the initial if and the final else. + +As a matter of style, it is advisable to format this construction as we have shown; if each if were indented past the previous else, a long sequence of decisions would march off the right side of the page. + +The switchstatement, to be discussed in Chapter 4, provides another way to write a multi-way branch that is particulary suitable when the condition is whether some integer or character expression matches one of a set of constants. For contrast, we will present a switchversion of this program in Section 3.4. + +Exercise 1-13. Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging. + +Exercise 1-14. Write a program to print a histogram of the frequencies of different characters in its input. + +1.7 Functions +In C, a function is equivalent to a subroutine or function in Fortran, or a procedure or function in Pascal. A function provides a convenient way to encapsulate some computation, which can then be used without worrying about its implementation. With properly designed functions, it is possible to ignore how a job is done; knowing what is done is sufficient. C makes the sue of functions easy, convinient and efficient; you will often see a short function defined and called only once, just because it clarifies some piece of code. +So far we have used only functions like printf, getchar and putchar that have been provided for us; now it's time to write a few of our own. Since C has no exponentiation operator like the **of Fortran, let us illustrate the mechanics of function definition by writing a function power(m,n)to raise an integer mto a positive integer power n. That is, the value of power(2,5)is 32. This function is not a practical exponentiation routine, since it handles only positive powers of small integers, but it's good enough for illustration.(The standard library contains a function pow(x,y) that computes xy.) + +Here is the function power and a main program to exercise it, so you can see the whole structure at once. +26 + + +#include + +int power(int m, int n); + +/* test power function */ main() +{ +int i; + +for (i = 0; i < 10; ++i) +printf("%d %d %d\n", i, power(2,i), power(-3,i)); return 0; +} + +/* power: raise base to n-th power; n >= 0 */ int power(int base, int n) +{ +int i, p; + +p = 1; +for (i = 1; i <= n; ++i) p = p * base; +return p; } +A function definition has this form: + +return-type function-name(parameter declarations, if any) { +declarations statements +} +Function definitions can appear in any order, and in one source file or several, although no function can be split between files. If the source program appears in several files, you may have to say more to compile and load it than if it all appears in one, but that is an operating system matter, not a language attribute. For the moment, we will assume that both functions are in the same file, so whatever you have learned about running C programs will still work. +The function power is called twice by main, in the line + +printf("%d %d %d\n", i, power(2,i), power(-3,i)); +Each call passes two arguments to power, which each time returns an integer to be formatted and printed. In an expression, power(2,i)is an integer just as 2and iare. (Not all functions produce an integer value; we will take this up in Chapter 4.) +The first line of power itself, + +int power(int base, int n) +declares the parameter types and names, and the type of the result that the function returns. The names used by powerfor its parameters are local to power, and are not visible to any other function: other routines can use the same names without conflict. This is also true of the variables i and p: the i in power is unrelated to the i in main. +We will generally use parameter for a variable named in the parenthesized list in a function. The terms formal argument and actual argument are sometimes used for the same distinction. + +The value that powercomputes is returned to mainby the return: statement. Any expression may follow return: + +return expression; +A function need not return a value; a return statement with no expression causes control, but no useful value, to be returned to the caller, as does ``falling off the end'' of a function by +27 + +reaching the terminating right brace. And the calling function can ignore a value returned by a function. +You may have noticed that there is a returnstatement at the end of main. Since mainis a function like any other, it may return a value to its caller, which is in effect the environment in which the program was executed. Typically, a return value of zero implies normal termination; non-zero values signal unusual or erroneous termination conditions. In the interests of simplicity, we have omitted returnstatements from our mainfunctions up to this point, but we will include them hereafter, as a reminder that programs should return status to their environment. + +The declaration + +int power(int base, int n); +just before mainsays that poweris a function that expects two intarguments and returns an int. This declaration, which is called a function prototype, has to agree with the definition and uses of power. It is an error if the definition of a function or any uses of it do not agree with its prototype. +parameter names need not agree. Indeed, parameter names are optional in a function prototype, so for the prototype we could have written + +int power(int, int); +Well-chosen names are good documentation however, so we will often use them. +A note of history: the biggest change between ANSI C and earlier versions is how functions are declared and defined. In the original definition of C, the powerfunction would have been written like this: +28 + + +/* power: raise base to n-th power; n >= 0 */ /* (old-style version) */ +power(base, n) int base, n; { +int i, p; + +p = 1; +for (i = 1; i <= n; ++i) p = p * base; +return p; } +The parameters are named between the parentheses, and their types are declared before opening the left brace; undeclared parameters are taken as int. (The body of the function is the same as before.) +The declaration of power at the beginning of the program would have looked like this: + +int power(); +No parameter list was permitted, so the compiler could not readily check that powerwas being called correctly. Indeed, since by default power would have been assumed to return an int, the entire declaration might well have been omitted. +The new syntax of function prototypes makes it much easier for a compiler to detect errors in the number of arguments or their types. The old style of declaration and definition still works in ANSI C, at least for a transition period, but we strongly recommend that you use the new form when you have a compiler that supports it. + +Exercise 1.15. Rewrite the temperature conversion program of Section 1.2 to use a function for conversion. + +1.8 Arguments - Call by Value +One aspect of C functions may be unfamiliar to programmers who are used to some other languages, particulary Fortran. In C, all function arguments are passed ``by value.'' This means that the called function is given the values of its arguments in temporary variables rather than the originals. This leads to some different properties than are seen with ``call by reference'' languages like Fortran or with varparameters in Pascal, in which the called routine has access to the original argument, not a local copy. +Call by value is an asset, however, not a liability. It usually leads to more compact programs with fewer extraneous variables, because parameters can be treated as conveniently initialized local variables in the called routine. For example, here is a version of powerthat makes use of this property. +/* power: raise base to n-th power; n >= 0; version 2 */ int power(int base, int n) +{ +int p; + +for (p = 1; n > 0; --n) p = p * base; +return p; } +The parameter nis used as a temporary variable, and is counted down (a forloop that runs backwards) until it becomes zero; there is no longer a need for the variable i. Whatever is done to n inside power has no effect on the argument that power was originally called with. +When necessary, it is possible to arrange for a function to modify a variable in a calling routine. The caller must provide the address of the variable to be set (technically a pointer to the +29 + +variable), and the called function must declare the parameter to be a pointer and access the variable indirectly through it. We will cover pointers in Chapter 5. + +The story is different for arrays. When the name of an array is used as an argument, the value passed to the function is the location or address of the beginning of the array - there is no copying of array elements. By subscripting this value, the function can access and alter any argument of the array. This is the topic of the next section. + +1.9 Character Arrays +The most common type of array in C is the array of characters. To illustrate the use of character arrays and functions to manipulate them, let's write a program that reads a set of text lines and prints the longest. The outline is simple enough: + +while (there's another line) +if (it's longer than the previous longest) (save it) +(save its length) print longest line +This outline makes it clear that the program divides naturally into pieces. One piece gets a new line, another saves it, and the rest controls the process. +Since things divide so nicely, it would be well to write them that way too. Accordingly, let us first write a separate function getlineto fetch the next line of input. We will try to make the function useful in other contexts. At the minimum, getline has to return a signal about possible end of file; a more useful design would be to return the length of the line, or zero if end of file is encountered. Zero is an acceptable end-of-file return because it is never a valid line length. Every text line has at least one character; even a line containing only a newline has length 1. + +When we find a line that is longer than the previous longest line, it must be saved somewhere. This suggests a second function, copy, to copy the new line to a safe place. + +Finally, we need a main program to control getline and copy. Here is the result. +30 + +#include +#define MAXLINE 1000 /* maximum input line length */ + +int getline(char line[], int maxline); void copy(char to[], char from[]); + +/* print the longest input line */ main() +{ +int len; /* current line length */ +int max; /* maximum length seen so far */ char line[MAXLINE]; /* current input line */ +char longest[MAXLINE]; /* longest line saved here */ + +max = 0; +while ((len = getline(line, MAXLINE)) > 0) if (len > max) { +max = len; copy(longest, line); +} +if (max > 0) /* there was a line */ printf("%s", longest); +return 0; } + +/* getline: read a line into s, return length */ int getline(char s[],int lim) +{ +int c, i; + +for (i=0; i < lim-1 && (c=getchar())!=EOF && c!='\n'; ++i) s[i] = c; +if (c == '\n') { s[i] = c; ++i; +} +s[i] = '\0'; return i; +} + +/* copy: copy 'from' into 'to'; assume to is big enough */ void copy(char to[], char from[]) +{ +int i; + +i = 0; +while ((to[i] = from[i]) != '\0') ++i; +} +The functions getline and copy are declared at the beginning of the program, which we assume is contained in one file. +main and getline communicate through a pair of arguments and a returned value. In getline, the arguments are declared by the line + +int getline(char s[], int lim); +which specifies that the first argument, s, is an array, and the second, lim, is an integer. The purpose of supplying the size of an array in a declaration is to set aside storage. The length of an array sis not necessary in getlinesince its size is set in main. getlineuses returnto send a value back to the caller, just as the function powerdid. This line also declares that getline returns an int; since int is the default return type, it could be omitted. +Some functions return a useful value; others, like copy, are used only for their effect and return no value. The return type of copy is void, which states explicitly that no value is returned. +31 + +getlineputs the character '\0'(the null character, whose value is zero) at the end of the array it is creating, to mark the end of the string of characters. This conversion is also used by the C language: when a string constant like + +"hello\n" +appears in a C program, it is stored as an array of characters containing the characters in the string and terminated with a '\0' to mark the end. + + + + + +The %s format specification in printf expects the corresponding argument to be a string represented in this form. copyalso relies on the fact that its input argument is terminated with a '\0', and copies this character into the output. + +It is worth mentioning in passing that even a program as small as this one presents some sticky design problems. For example, what should maindo if it encounters a line which is bigger than its limit? getlineworks safely, in that it stops collecting when the array is full, even if no newline has been seen. By testing the length and the last character returned, main can determine whether the line was too long, and then cope as it wishes. In the interests of brevity, we have ignored this issue. + +There is no way for a user of getlineto know in advance how long an input line might be, so getlinechecks for overflow. On the other hand, the user of copyalready knows (or can find out) how big the strings are, so we have chosen not to add error checking to it. + +Exercise 1-16. Revise the main routine of the longest-line program so it will correctly print the length of arbitrary long input lines, and as much as possible of the text. + +Exercise 1-17. Write a program to print all input lines that are longer than 80 characters. + +Exercise 1-18. Write a program to remove trailing blanks and tabs from each line of input, and to delete entirely blank lines. + +Exercise 1-19. Write a function reverse(s)that reverses the character string s. Use it to write a program that reverses its input a line at a time. + +1.10 External Variables and Scope +The variables in main, such as line, longest, etc., are private or local to main. Because they are declared within main, no other function can have direct access to them. The same is true of the variables in other functions; for example, the variable iin getlineis unrelated to the iin copy. Each local variable in a function comes into existence only when the function is called, and disappears when the function is exited. This is why such variables are usually known as automatic variables, following terminology in other languages. We will use the term automatic henceforth to refer to these local variables. (Chapter 4 discusses the staticstorage class, in which local variables do retain their values between calls.) +Because automatic variables come and go with function invocation, they do not retain their values from one call to the next, and must be explicitly set upon each entry. If they are not set, they will contain garbage. + +As an alternative to automatic variables, it is possible to define variables that are external to all functions, that is, variables that can be accessed by name by any function. (This mechanism is rather like Fortran COMMON or Pascal variables declared in the outermost block.) Because +32 + +external variables are globally accessible, they can be used instead of argument lists to communicate data between functions. Furthermore, because external variables remain in existence permanently, rather than appearing and disappearing as functions are called and exited, they retain their values even after the functions that set them have returned. + +An external variable must be defined, exactly once, outside of any function; this sets aside storage for it. The variable must also be declared in each function that wants to access it; this states the type of the variable. The declaration may be an explicit externstatement or may be implicit from context. To make the discussion concrete, let us rewrite the longest-line program with line, longest, and max as external variables. This requires changing the calls, declarations, and bodies of all three functions. + +#include + + +#define MAXLINE 1000 + +int max; +char line[MAXLINE]; char longest[MAXLINE]; + +/* maximum input line size */ + +/* maximum length seen so far */ /* current input line */ +/* longest line saved here */ + + +int getline(void); void copy(void); + +/* print longest input line; specialized version */ main() +{ +int len; +extern int max; +extern char longest[]; + +max = 0; +while ((len = getline()) > 0) if (len > max) { +max = len; copy(); +} +if (max > 0) /* there was a line */ printf("%s", longest); +return 0; } +33 + + +/* getline: specialized version */ int getline(void) +{ +int c, i; +extern char line[]; + +for (i = 0; i < MAXLINE - 1 +&& (c=getchar)) != EOF && c != '\n'; ++i) line[i] = c; +if (c == '\n') { line[i] = c; ++i; +} +line[i] = '\0'; return i; +} + +/* copy: specialized version */ void copy(void) +{ +int i; +extern char line[], longest[]; + +i = 0; +while ((longest[i] = line[i]) != '\0') ++i; +} +The external variables in main, getlineand copyare defined by the first lines of the example above, which state their type and cause storage to be allocated for them. Syntactically, external definitions are just like definitions of local variables, but since they occur outside of functions, the variables are external. Before a function can use an external variable, the name of the variable must be made known to the function; the declaration is the same as before except for the added keyword extern. +In certain circumstances, the extern declaration can be omitted. If the definition of the external variable occurs in the source file before its use in a particular function, then there is no need for an externdeclaration in the function. The externdeclarations in main, getlineand copy are thus redundant. In fact, common practice is to place definitions of all external variables at the beginning of the source file, and then omit all extern declarations. + +If the program is in several source files, and a variable is defined in file1 and used in file2 and file3, then externdeclarations are needed in file2 and file3 to connect the occurrences of the variable. The usual practice is to collect externdeclarations of variables and functions in a separate file, historically called a header, that is included by #include at the front of each source file. The suffix .h is conventional for header names. The functions of the standard library, for example, are declared in headers like . This topic is discussed at length in Chapter 4, and the library itself in Chapter 7 and Appendix B. + +Since the specialized versions of getlineand copyhave no arguments, logic would suggest that their prototypes at the beginning of the file should be getline()and copy(). But for compatibility with older C programs the standard takes an empty list as an old-style declaration, and turns off all argument list checking; the word void must be used for an explicitly empty list. We will discuss this further in Chapter 4. + +You should note that we are using the words definition and declaration carefully when we refer to external variables in this section.``Definition'' refers to the place where the variable is created or assigned storage; ``declaration'' refers to places where the nature of the variable is stated but no storage is allocated. +34 + +By the way, there is a tendency to make everything in sight an extern variable because it appears to simplify communications - argument lists are short and variables are always there when you want them. But external variables are always there even when you don't want them. Relying too heavily on external variables is fraught with peril since it leads to programs whose data connections are not all obvious - variables can be changed in unexpected and even inadvertent ways, and the program is hard to modify. The second version of the longest-line program is inferior to the first, partly for these reasons, and partly because it destroys the generality of two useful functions by writing into them the names of the variables they manipulate. + +At this point we have covered what might be called the conventional core of C. With this handful of building blocks, it's possible to write useful programs of considerable size, and it would probably be a good idea if you paused long enough to do so. These exercises suggest programs of somewhat greater complexity than the ones earlier in this chapter. + +Exercise 1-20. Write a program detabthat replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns. Should n be a variable or a symbolic parameter? + +Exercise 1-21. Write a program entabthat replaces strings of blanks by the minimum number of tabs and blanks to achieve the same spacing. Use the same tab stops as for detab. When either a tab or a single blank would suffice to reach a tab stop, which should be given preference? + +Exercise 1-22. Write a program to ``fold'' long input lines into two or more shorter lines after the last non-blank character that occurs before the n-th column of input. Make sure your program does something intelligent with very long lines, and if there are no blanks or tabs before the specified column. + +Exercise 1-23. Write a program to remove all comments from a C program. Don't forget to handle quoted strings and character constants properly. C comments don't nest. + +Exercise 1-24. Write a program to check a C program for rudimentary syntax errors like unmatched parentheses, brackets and braces. Don't forget about quotes, both single and double, escape sequences, and comments. (This program is hard if you do it in full generality.) +35 + + +Chapter 2 - Types, Operators and Expressions +Variables and constants are the basic data objects manipulated in a program. Declarations list the variables to be used, and state what type they have and perhaps what their initial values are. Operators specify what is to be done to them. Expressions combine variables and constants to produce new values. The type of an object determines the set of values it can have and what operations can be performed on it. These building blocks are the topics of this chapter. +The ANSI standard has made many small changes and additions to basic types and expressions. There are now signedand unsignedforms of all integer types, and notations for unsigned constants and hexadecimal character constants. Floating-point operations may be done in single precision; there is also a longdouble type for extended precision. String constants may be concatenated at compile time. Enumerations have become part of the language, formalizing a feature of long standing. Objects may be declared const, which prevents them from being changed. The rules for automatic coercions among arithmetic types have been augmented to handle the richer set of types. + +2.1 Variable Names +Although we didn't say so in Chapter 1, there are some restrictions on the names of variables and symbolic constants. Names are made up of letters and digits; the first character must be a letter. The underscore ``_'' counts as a letter; it is sometimes useful for improving the readability of long variable names. Don't begin variable names with underscore, however, since library routines often use such names. Upper and lower case letters are distinct, so xand Xare two different names. Traditional C practice is to use lower case for variable names, and all upper case for symbolic constants. +At least the first 31 characters of an internal name are significant. For function names and external variables, the number may be less than 31, because external names may be used by assemblers and loaders over which the language has no control. For external names, the standard guarantees uniqueness only for 6 characters and a single case. Keywords like if, else, int, float, etc., are reserved: you can't use them as variable names. They must be in lower case. + +It's wise to choose variable names that are related to the purpose of the variable, and that are unlikely to get mixed up typographically. We tend to use short names for local variables, especially loop indices, and longer names for external variables. + +2.2 Data Types and Sizes +There are only a few basic data types in C: +char a single byte, capable of holding one character in the local character set +int an integer, typically reflecting the natural size of integers on the host machine float single-precision floating point +double double-precision floating point +In addition, there are a number of qualifiers that can be applied to these basic types. shortand long apply to integers: + +short int sh; long int counter; +The word int can be omitted in such declarations, and typically it is. +36 + +The intent is that shortand longshould provide different lengths of integers where practical; intwill normally be the natural size for a particular machine. shortis often 16 bits long, and int either 16 or 32 bits. Each compiler is free to choose appropriate sizes for its own hardware, subject only to the the restriction that shorts and ints are at least 16 bits, longs are at least 32 bits, and short is no longer than int, which is no longer than long. + +The qualifier signedor unsignedmay be applied to charor any integer. unsignednumbers are always positive or zero, and obey the laws of arithmetic modulo 2n, where n is the number of bits in the type. So, for instance, if chars are 8 bits, unsigned charvariables have values between 0 and 255, while signed chars have values between -128 and 127 (in a two's complement machine.) Whether plain chars are signed or unsigned is machine-dependent, but printable characters are always positive. + +The type long doublespecifies extended-precision floating point. As with integers, the sizes of floating-point objects are implementation-defined; float, doubleand long doublecould represent one, two or three distinct sizes. + +The standard headers and contain symbolic constants for all of these sizes, along with other properties of the machine and compiler. These are discussed in Appendix B. + +Exercise 2-1. Write a program to determine the ranges of char, short, int, and long variables, both signedand unsigned, by printing appropriate values from standard headers and by direct computation. Harder if you compute them: determine the ranges of the various floating-point types. + +2.3 Constants +An integer constant like 1234is an int. A longconstant is written with a terminal l(ell) or L, as in 123456789L; an integer constant too big to fit into an intwill also be taken as a long. Unsigned constants are written with a terminal u or U, and the suffix ul or UL indicates unsigned long. +Floating-point constants contain a decimal point (123.4) or an exponent (1e-2) or both; their type is double, unless suffixed. The suffixes for Findicate a floatconstant; lor Lindicate a long double. + +The value of an integer can be specified in octal or hexadecimal instead of decimal. A leading 0 (zero) on an integer constant means octal; a leading 0xor 0Xmeans hexadecimal. For example, decimal 31 can be written as 037in octal and 0x1for 0x1F in hex. Octal and hexadecimal constants may also be followed by Lto make them longand Uto make them unsigned: 0XFUL is an unsigned long constant with value 15 decimal. + +A character constantis an integer, written as one character within single quotes, such as 'x'. The value of a character constant is the numeric value of the character in the machine's character set. For example, in the ASCII character set the character constant '0'has the value 48, which is unrelated to the numeric value 0. If we write '0'instead of a numeric value like 48 that depends on the character set, the program is independent of the particular value and easier to read. Character constants participate in numeric operations just as any other integers, although they are most often used in comparisons with other characters. + +Certain characters can be represented in character and string constants by escape sequences like \n (newline); these sequences look like two characters, but represent only one. In addition, an arbitrary byte-sized bit pattern can be specified by + +'\ooo' +37 + +where ooo is one to three octal digits (0...7) or by + +'\xhh' +where hh is one or more hexadecimal digits (0...9, a...f, A...F). So we might write + + +#define VTAB '\013' #define BELL '\007' +or, in hexadecimal, + +/* ASCII vertical tab */ /* ASCII bell character */ + + +#define VTAB '\xb' /* ASCII vertical tab */ #define BELL '\x7' /* ASCII bell character */ +The complete set of escape sequences is + +\a alert (bell) character \b backspace +\f formfeed \n newline +\r carriage return \t horizontal tab +\v vertical tab + +\\ backslash +\? question mark \' single quote +\" double quote \ooo octal number +\xhh hexadecimal number + + +The character constant '\0'represents the character with value zero, the null character. '\0' is often written instead of 0to emphasize the character nature of some expression, but the numeric value is just 0. + +A constant expression is an expression that involves only constants. Such expressions may be evaluated at during compilation rather than run-time, and accordingly may be used in any place that a constant can occur, as in + +#define MAXLINE 1000 char line[MAXLINE+1]; +or + +#define LEAP 1 /* in leap years */ +int days[31+28+LEAP+31+30+31+30+31+31+30+31+30+31]; +A string constant, or string literal, is a sequence of zero or more characters surrounded by double quotes, as in + +"I am a string" or + +"" /* the empty string */ +The quotes are not part of the string, but serve only to delimit it. The same escape sequences used in character constants apply in strings; \"represents the double-quote character. String constants can be concatenated at compile time: + +"hello, " "world" is equivalent to + +"hello, world" +This is useful for splitting up long strings across several source lines. +Technically, a string constant is an array of characters. The internal representation of a string has a null character '\0' at the end, so the physical storage required is one more than the number of characters written between the quotes. This representation means that there is no limit to how long a string can be, but programs must scan a string completely to determine its length. The standard library function strlen(s) returns the length of its character string argument s, excluding the terminal '\0'. Here is our version: +38 + + +/* strlen: return length of s */ int strlen(char s[]) +{ +int i; + +while (s[i] != '\0') ++i; +return i; } +strlen and other string functions are declared in the standard header . +Be careful to distinguish between a character constant and a string that contains a single character: 'x'is not the same as "x". The former is an integer, used to produce the numeric value of the letter x in the machine's character set. The latter is an array of characters that contains one character (the letter x) and a '\0'. + +There is one other kind of constant, the enumeration constant. An enumeration is a list of constant integer values, as in + +enum boolean { NO, YES }; +The first name in an enum has value 0, the next 1, and so on, unless explicit values are specified. If not all values are specified, unspecified values continue the progression from the last specified value, as the second of these examples: + +enum escapes { BELL = '\a', BACKSPACE = '\b', TAB = '\t', NEWLINE = '\n', VTAB = '\v', RETURN = '\r' }; + +enum months { JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC }; +/* FEB = 2, MAR = 3, etc. */ +Names in different enumerations must be distinct. Values need not be distinct in the same enumeration. +Enumerations provide a convenient way to associate constant values with names, an alternative to #definewith the advantage that the values can be generated for you. Although variables of enumtypes may be declared, compilers need not check that what you store in such a variable is a valid value for the enumeration. Nevertheless, enumeration variables offer the chance of checking and so are often better than #defines. In addition, a debugger may be able to print values of enumeration variables in their symbolic form. + +2.4 Declarations +All variables must be declared before use, although certain declarations can be made implicitly by content. A declaration specifies a type, and contains a list of one or more variables of that type, as in + +int lower, upper, step; char c, line[1000]; +Variables can be distributed among declarations in any fashion; the lists above could well be written as + +int lower; int upper; int step; char c; +char line[1000]; +The latter form takes more space, but is convenient for adding a comment to each declaration for subsequent modifications. +39 + +A variable may also be initialized in its declaration. If the name is followed by an equals sign and an expression, the expression serves as an initializer, as in + +char esc = '\\'; int i = 0; +int limit = MAXLINE+1; float eps = 1.0e-5; +If the variable in question is not automatic, the initialization is done once only, conceptionally before the program starts executing, and the initializer must be a constant expression. An explicitly initialized automatic variable is initialized each time the function or block it is in is entered; the initializer may be any expression. External and static variables are initialized to zero by default. Automatic variables for which is no explicit initializer have undefined (i.e., garbage) values. +The qualifier constcan be applied to the declaration of any variable to specify that its value will not be changed. For an array, the const qualifier says that the elements will not be altered. + +const double e = 2.71828182845905; const char msg[] = "warning: "; +The const declaration can also be used with array arguments, to indicate that the function does not change that array: + +int strlen(const char[]); +The result is implementation-defined if an attempt is made to change a const. +2.5 Arithmetic Operators +The binary arithmetic operators are +, -, *, /, and the modulus operator %. Integer division truncates any fractional part. The expression + +x % y +produces the remainder when xis divided by y, and thus is zero when ydivides xexactly. For example, a year is a leap year if it is divisible by 4 but not by 100, except that years divisible by 400 are leap years. Therefore + +if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) printf("%d is a leap year\n", year); +else +printf("%d is not a leap year\n", year); +The %operator cannot be applied to a floator double. The direction of truncation for /and the sign of the result for %are machine-dependent for negative operands, as is the action taken on overflow or underflow. +The binary +and -operators have the same precedence, which is lower than the precedence of *, /and %, which is in turn lower than unary +and -. Arithmetic operators associate left to right. + +Table 2.1 at the end of this chapter summarizes precedence and associativity for all operators. + +2.6 Relational and Logical Operators The relational operators are + +> >= < <= +They all have the same precedence. Just below them in precedence are the equality operators: + +== != +Relational operators have lower precedence than arithmetic operators, so an expression like i < lim-1 is taken as i < (lim-1), as would be expected. +40 + +More interesting are the logical operators &&and ||. Expressions connected by &&or ||are evaluated left to right, and evaluation stops as soon as the truth or falsehood of the result is known. Most C programs rely on these properties. For example, here is a loop from the input function getline that we wrote in Chapter 1: + +for (i=0; i < lim-1 && (c=getchar()) != '\n' && c != EOF; ++i) s[i] = c; +Before reading a new character it is necessary to check that there is room to store it in the array s, so the test i < lim-1must be made first. Moreover, if this test fails, we must not go on and read another character. +Similarly, it would be unfortunate if c were tested against EOF before getchar is called; therefore the call and assignment must occur before the character in c is tested. + +The precedence of &&is higher than that of ||, and both are lower than relational and equality operators, so expressions like + +i < lim-1 && (c=getchar()) != '\n' && c != EOF +need no extra parentheses. But since the precedence of != is higher than assignment, parentheses are needed in + +(c=getchar()) != '\n' +to achieve the desired result of assignment to c and then comparison with '\n'. +By definition, the numeric value of a relational or logical expression is 1 if the relation is true, and 0 if the relation is false. + +The unary negation operator !converts a non-zero operand into 0, and a zero operand in 1. A common use of ! is in constructions like + +if (!valid) rather than + +if (valid == 0) +It's hard to generalize about which form is better. Constructions like !validread nicely (``if not valid''), but more complicated ones can be hard to understand. +Exercise 2-2. Write a loop equivalent to the for loop above without using && or ||. + +2.7 Type Conversions +When an operator has operands of different types, they are converted to a common type according to a small number of rules. In general, the only automatic conversions are those that convert a ``narrower'' operand into a ``wider'' one without losing information, such as converting an integer into floating point in an expression like f + i. Expressions that don't make sense, like using a float as a subscript, are disallowed. Expressions that might lose information, like assigning a longer integer type to a shorter, or a floating-point type to an integer, may draw a warning, but they are not illegal. +A char is just a small integer, so chars may be freely used in arithmetic expressions. This permits considerable flexibility in certain kinds of character transformations. One is exemplified by this naive implementation of the function atoi, which converts a string of digits into its numeric equivalent. + +/* atoi: convert s to integer */ int atoi(char s[]) +{ +int i, n; +41 + + +n = 0; +for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i) n = 10 * n + (s[i] - '0'); +return n; } +As we discussed in Chapter 1, the expression + +s[i] - '0' +gives the numeric value of the character stored in s[i], because the values of '0', '1', etc., form a contiguous increasing sequence. +Another example of char to int conversion is the function lower, which maps a single character to lower case for the ASCII character set. If the character is not an upper case letter, lower returns it unchanged. + +/* lower: convert c to lower case; ASCII only */ int lower(int c) +{ +if (c >= 'A' && c <= 'Z') return c + 'a' - 'A'; +else +return c; } +This works for ASCII because corresponding upper case and lower case letters are a fixed distance apart as numeric values and each alphabet is contiguous -- there is nothing but letters between Aand Z. This latter observation is not true of the EBCDIC character set, however, so this code would convert more than just letters in EBCDIC. +The standard header , described in Appendix B, defines a family of functions that provide tests and conversions that are independent of character set. For example, the function tolower is a portable replacement for the function lower shown above. Similarly, the test + +c >= '0' && c <= '9' can be replaced by + +isdigit(c) +We will use the functions from now on. +There is one subtle point about the conversion of characters to integers. The language does not specify whether variables of type char are signed or unsigned quantities. When a char is converted to an int, can it ever produce a negative integer? The answer varies from machine to machine, reflecting differences in architecture. On some machines a charwhose leftmost bit is 1 will be converted to a negative integer (``sign extension''). On others, a charis promoted to an int by adding zeros at the left end, and thus is always positive. + +The definition of C guarantees that any character in the machine's standard printing character set will never be negative, so these characters will always be positive quantities in expressions. But arbitrary bit patterns stored in character variables may appear to be negative on some machines, yet positive on others. For portability, specify signedor unsignedif non-character data is to be stored in char variables. + +Relational expressions like i > jand logical expressions connected by &&and ||are defined to have value 1 if true, and 0 if false. Thus the assignment + +d = c >= '0' && c <= '9' +sets dto 1 if cis a digit, and 0 if not. However, functions like isdigitmay return any non-zero value for true. In the test part of if, while, for, etc., ``true'' just means ``non-zero'', so this makes no difference. +42 + +Implicit arithmetic conversions work much as expected. In general, if an operator like +or * that takes two operands (a binary operator) has operands of different types, the ``lower'' type is promoted to the ``higher'' type before the operation proceeds. The result is of the integer type. Section 6 of Appendix A states the conversion rules precisely. If there are no unsigned operands, however, the following informal set of rules will suffice: + +· If either operand is long double, convert the other to long double. + +· Otherwise, if either operand is double, convert the other to double. + +· Otherwise, if either operand is float, convert the other to float. + +· Otherwise, convert char and short to int. + +· Then, if either operand is long, convert the other to long. +Notice that floats in an expression are not automatically converted to double; this is a change from the original definition. In general, mathematical functions like those in will use double precision. The main reason for using floatis to save storage in large arrays, or, less often, to save time on machines where double-precision arithmetic is particularly expensive. +Conversion rules are more complicated when unsignedoperands are involved. The problem is that comparisons between signed and unsigned values are machine-dependent, because they depend on the sizes of the various integer types. For example, suppose that intis 16 bits and longis 32 bits. Then -1L < 1U, because 1U, which is an unsigned int, is promoted to a signed long. But -1L > 1ULbecause -1Lis promoted to unsigned longand thus appears to be a large positive number. + +Conversions take place across assignments; the value of the right side is converted to the type of the left, which is the type of the result. + +A character is converted to an integer, either by sign extension or not, as described above. + +Longer integers are converted to shorter ones or to chars by dropping the excess high-order bits. Thus in + +int i; char c; + +i = c; c = i; +the value of cis unchanged. This is true whether or not sign extension is involved. Reversing the order of assignments might lose information, however. +If x is float and i is int, then x = i and i = x both cause conversions; float to int causes truncation of any fractional part. When a doubleis converted to float, whether the value is rounded or truncated is implementation dependent. + +Since an argument of a function call is an expression, type conversion also takes place when arguments are passed to functions. In the absence of a function prototype, charand short become int, and floatbecomes double. This is why we have declared function arguments to be int and double even when the function is called with char and float. + +Finally, explicit type conversions can be forced (``coerced'') in any expression, with a unary operator called a cast. In the construction + +(type name) expression +43 + +the expression is converted to the named type by the conversion rules above. The precise meaning of a cast is as if the expression were assigned to a variable of the specified type, which is then used in place of the whole construction. For example, the library routine sqrtexpects a doubleargument, and will produce nonsense if inadvertently handled something else. (sqrtis declared in .) So if n is an integer, we can use + +sqrt((double) n) +to convert the value of nto doublebefore passing it to sqrt. Note that the cast produces the value of n in the proper type; n itself is not altered. The cast operator has the same high precedence as other unary operators, as summarized in the table at the end of this chapter. +If arguments are declared by a function prototype, as the normally should be, the declaration causes automatic coercion of any arguments when the function is called. Thus, given a function prototype for sqrt: + +double sqrt(double) the call + +root2 = sqrt(2) +coerces the integer 2 into the double value 2.0 without any need for a cast. +The standard library includes a portable implementation of a pseudo-random number generator and a function for initializing the seed; the former illustrates a cast: + +unsigned long int next = 1; + +/* rand: return pseudo-random integer on 0..32767 */ int rand(void) +{ +next = next * 1103515245 + 12345; +return (unsigned int)(next/65536) % 32768; } + +/* srand: set seed for rand() */ void srand(unsigned int seed) +{ +next = seed; } +Exercise 2-3. Write a function htoi(s), which converts a string of hexadecimal digits (including an optional 0xor 0X) into its equivalent integer value. The allowable digits are 0 through 9, a through f, and A through F. +2.8 Increment and Decrement Operators +C provides two unusual operators for incrementing and decrementing variables. The increment operator ++ adds 1 to its operand, while the decrement operator -- subtracts 1. We have frequently used ++ to increment variables, as in + +if (c == '\n') ++nl; +The unusual aspect is that ++ and -- may be used either as prefix operators (before the variable, as in ++n), or postfix operators (after the variable: n++). In both cases, the effect is to increment n. But the expression ++n increments n before its value is used, while n++ increments nafter its value has been used. This means that in a context where the value is being used, not just the effect, ++n and n++ are different. If n is 5, then + +x = n++; sets x to 5, but + +x = ++n; +44 + +sets xto 6. In both cases, nbecomes 6. The increment and decrement operators can only be applied to variables; an expression like (i+j)++ is illegal. +In a context where no value is wanted, just the incrementing effect, as in + +if (c == '\n') nl++; +prefix and postfix are the same. But there are situations where one or the other is specifically called for. For instance, consider the function squeeze(s,c), which removes all occurrences of the character c from the string s. + +/* squeeze: delete all c from s */ void squeeze(char s[], int c) +{ +int i, j; + +for (i = j = 0; s[i] != '\0'; i++) if (s[i] != c) +s[j++] = s[i]; s[j] = '\0'; +} +Each time a non-c occurs, it is copied into the current j position, and only then is j incremented to be ready for the next character. This is exactly equivalent to + +if (s[i] != c) { s[j] = s[i]; j++; +} +Another example of a similar construction comes from the getlinefunction that we wrote in Chapter 1, where we can replace + +if (c == '\n') { s[i] = c; ++i; +} +by the more compact + +if (c == '\n') s[i++] = c; +As a third example, consider the standard function strcat(s,t), which concatenates the string tto the end of string s. strcatassumes that there is enough space in sto hold the combination. As we have written it, strcat returns no value; the standard library version returns a pointer to the resulting string. + +/* strcat: concatenate t to end of s; s must be big enough */ void strcat(char s[], char t[]) +{ +int i, j; + +i = j = 0; +while (s[i] != '\0') /* find end of s */ i++; +while ((s[i++] = t[j++]) != '\0') /* copy t */ ; +} +As each member is copied from tto s, the postfix ++is applied to both iand jto make sure that they are in position for the next pass through the loop. +Exercise 2-4. Write an alternative version of squeeze(s1,s2)that deletes each character in s1 that matches any character in the string s2. +45 + +Exercise 2-5. Write the function any(s1,s2), which returns the first location in a string s1 where any character from the string s2occurs, or -1if s1contains no characters from s2. (The standard library function strpbrk does the same job but returns a pointer to the location.) + +2.9 Bitwise Operators +C provides six operators for bit manipulation; these may only be applied to integral operands, that is, char, short, int, and long, whether signed or unsigned. +& bitwise AND +| bitwise inclusive OR ^ bitwise exclusive OR << left shift +>> right shift +~ one's complement (unary) +The bitwise AND operator & is often used to mask off some set of bits, for example + +n = n & 0177; +sets to zero all but the low-order 7 bits of n. +The bitwise OR operator | is used to turn bits on: + +x = x | SET_ON; +sets to one in x the bits that are set to one in SET_ON. +The bitwise exclusive OR operator ^sets a one in each bit position where its operands have different bits, and zero where they are the same. + +One must distinguish the bitwise operators & and | from the logical operators && and ||, which imply left-to-right evaluation of a truth value. For example, if xis 1 and yis 2, then x & yis zero while x && y is one. + +The shift operators <>perform left and right shifts of their left operand by the number of bit positions given by the right operand, which must be non-negative. Thus x << 2shifts the value of x by two positions, filling vacated bits with zero; this is equivalent to multiplication by 4. Right shifting an unsignedquantity always fits the vacated bits with zero. Right shifting a signed quantity will fill with bit signs (``arithmetic shift'') on some machines and with 0-bits (``logical shift'') on others. + +The unary operator ~yields the one's complement of an integer; that is, it converts each 1-bit into a 0-bit and vice versa. For example + +x = x & ~077 +sets the last six bits of xto zero. Note that x & ~077is independent of word length, and is thus preferable to, for example, x & 0177700, which assumes that xis a 16-bit quantity. The portable form involves no extra cost, since ~077is a constant expression that can be evaluated at compile time. +As an illustration of some of the bit operators, consider the function getbits(x,p,n)that returns the (right adjusted) n-bit field of x that begins at position p. We assume that bit position 0 is at the right end and that n and p are sensible positive values. For example, getbits(x,4,3) returns the three bits in positions 4, 3 and 2, right-adjusted. + +/* getbits: get n bits from position p */ unsigned getbits(unsigned x, int p, int n) { +46 + +return (x >> (p+1-n)) & ~(~0 << n); } +The expression x >> (p+1-n)moves the desired field to the right end of the word. ~0is all 1-bits; shifting it left npositions with ~0<> & ^ | If expr1 and expr2 are expressions, then + +expr1 op= expr2 is equivalent to + +expr1 = (expr1) op (expr2) +except that expr1 is computed only once. Notice the parentheses around expr2: + +x *= y + 1 means + +x = x * (y + 1) rather than + +x = x * y + 1 +As an example, the function bitcount counts the number of 1-bits in its integer argument. + +/* bitcount: count 1 bits in x */ int bitcount(unsigned x) +{ +int b; + +for (b = 0; x != 0; x >>= 1) if (x & 01) +b++; return b; +} +Declaring the argument xto be an unsignedensures that when it is right-shifted, vacated bits will be filled with zeros, not sign bits, regardless of the machine the program is run on. +47 + +Quite apart from conciseness, assignment operators have the advantage that they correspond better to the way people think. We say ``add 2 to i'' or ``increment iby 2'', not ``take i, add 2, then put the result back in i''. Thus the expression i += 2 is preferable to i = i+2. In addition, for a complicated expression like + +yyval[yypv[p3+p4] + yypv[p1]] += 2 +the assignment operator makes the code easier to understand, since the reader doesn't have to check painstakingly that two long expressions are indeed the same, or to wonder why they're not. And an assignment operator may even help a compiler to produce efficient code. +We have already seen that the assignment statement has a value and can occur in expressions; the most common example is + +while ((c = getchar()) != EOF) ... +The other assignment operators (+=, -=, etc.) can also occur in expressions, although this is less frequent. +In all such expressions, the type of an assignment expression is the type of its left operand, and the value is the value after the assignment. + +Exercise 2-9. In a two's complement number system, x &= (x-1)deletes the rightmost 1-bit in x. Explain why. Use this observation to write a faster version of bitcount. + +2.11 Conditional Expressions The statements + +if (a > b) z = a; +else +z = b; +compute in zthe maximum of aand b. The conditional expression, written with the ternary operator ``?:'', provides an alternate way to write this and similar constructions. In the expression + +expr1 ? expr2 : expr3 +the expression expr1 is evaluated first. If it is non-zero (true), then the expression expr2 is evaluated, and that is the value of the conditional expression. Otherwise expr3 is evaluated, and that is the value. Only one of expr2 and expr3 is evaluated. Thus to set zto the maximum of a and b, + +z = (a > b) ? a : b; /* z = max(a, b) */ +It should be noted that the conditional expression is indeed an expression, and it can be used wherever any other expression can be. If expr2 and expr3 are of different types, the type of the result is determined by the conversion rules discussed earlier in this chapter. For example, if f is a float and n an int, then the expression + +(n > 0) ? f : n +is of type float regardless of whether n is positive. +Parentheses are not necessary around the first expression of a conditional expression, since the precedence of ?: is very low, just above assignment. They are advisable anyway, however, since they make the condition part of the expression easier to see. + +The conditional expression often leads to succinct code. For example, this loop prints n elements of an array, 10 per line, with each column separated by one blank, and with each line (including the last) terminated by a newline. +48 + + +for (i = 0; i < n; i++) +printf("%6d%c", a[i], (i%10==9 || i==n-1) ? '\n' : ' '); +A newline is printed after every tenth element, and after the n-th. All other elements are followed by one blank. This might look tricky, but it's more compact than the equivalent if-else. Another good example is + +printf("You have %d items%s.\n", n, n==1 ? "" : "s"); +Exercise 2-10. Rewrite the function lower, which converts upper case letters to lower case, with a conditional expression instead of if-else. +2.12 Precedence and Order of Evaluation +Table 2.1 summarizes the rules for precedence and associativity of all operators, including those that we have not yet discussed. Operators on the same line have the same precedence; rows are in order of decreasing precedence, so, for example, *, /, and %all have the same precedence, which is higher than that of binary +and -. The ``operator'' ()refers to function call. The operators ->and .are used to access members of structures; they will be covered in Chapter 6, along with sizeof(size of an object). Chapter 5 discusses *(indirection through a pointer) and & (address of an object), and Chapter 3 discusses the comma operator. + +Operators +() [] -> . + +Associativity +left to right + + + +! ~ ++ -- + - * (type) sizeof * / % ++ - + +right to left left to right +left to right + +<< >> left to right + +< <= > >= == != +& ^ | && || ?: += += -= *= /= %= &= ^= |= <<= >>= +, + +left to right left to right left to right left to right left to right left to right left to right right to left right to left +left to right + + +Unary & +, -, and * have higher precedence than the binary forms. + +Table 2.1: Precedence and Associativity of Operators + +Note that the precedence of the bitwise operators &, ^, and |falls below == and !=. This implies that bit-testing expressions like + +if ((x & MASK) == 0) ... +must be fully parenthesized to give proper results. +C, like most languages, does not specify the order in which the operands of an operator are evaluated. (The exceptions are &&, ||, ?:, and `,'.) For example, in a statement like + +x = f() + g(); +49 + +fmay be evaluated before gor vice versa; thus if either for galters a variable on which the other depends, xcan depend on the order of evaluation. Intermediate results can be stored in temporary variables to ensure a particular sequence. +Similarly, the order in which function arguments are evaluated is not specified, so the statement + +printf("%d %d\n", ++n, power(2, n)); /* WRONG */ +can produce different results with different compilers, depending on whether nis incremented before power is called. The solution, of course, is to write + +++n; +printf("%d %d\n", n, power(2, n)); +Function calls, nested assignment statements, and increment and decrement operators cause ``side effects'' - some variable is changed as a by-product of the evaluation of an expression. In any expression involving side effects, there can be subtle dependencies on the order in which variables taking part in the expression are updated. One unhappy situation is typified by the statement + +a[i] = i++; +The question is whether the subscript is the old value of ior the new. Compilers can interpret this in different ways, and generate different answers depending on their interpretation. The standard intentionally leaves most such matters unspecified. When side effects (assignment to variables) take place within an expression is left to the discretion of the compiler, since the best order depends strongly on machine architecture. (The standard does specify that all side effects on arguments take effect before a function is called, but that would not help in the call to printf above.) +The moral is that writing code that depends on order of evaluation is a bad programming practice in any language. Naturally, it is necessary to know what things to avoid, but if you don't know how they are done on various machines, you won't be tempted to take advantage of a particular implementation. +50 + + +Chapter 3 - Control Flow +The control-flow of a language specify the order in which computations are performed. We have already met the most common control-flow constructions in earlier examples; here we will complete the set, and be more precise about the ones discussed before. +3.1 Statements and Blocks +An expression such as x = 0or i++or printf(...)becomes a statement when it is followed by a semicolon, as in + +x = 0; i++; +printf(...); +In C, the semicolon is a statement terminator, rather than a separator as it is in languages like Pascal. +Braces { and } are used to group declarations and statements together into a compound statement, or block, so that they are syntactically equivalent to a single statement. The braces that surround the statements of a function are one obvious example; braces around multiple statements after an if, else, while, or forare another. (Variables can be declared inside any block; we will talk about this in Chapter 4.) There is no semicolon after the right brace that ends a block. + +3.2 If-Else +The if-else statement is used to express decisions. Formally the syntax is + +if (expression) statement1 +else statement2 +where the elsepart is optional. The expression is evaluated; if it is true (that is, if expression has a non-zero value), statement1 is executed. If it is false (expression is zero) and if there is an else part, statement2 is executed instead. +Since an iftests the numeric value of an expression, certain coding shortcuts are possible. The most obvious is writing + +if (expression) instead of + +if (expression != 0) +Sometimes this is natural and clear; at other times it can be cryptic. +Because the elsepart of an if-elseis optional,there is an ambiguity when an else if omitted from a nested ifsequence. This is resolved by associating the elsewith the closest previous else-less if. For example, in + +if (n > 0) +if (a > b) z = a; +else +z = b; +the elsegoes to the inner if, as we have shown by indentation. If that isn't what you want, braces must be used to force the proper association: +51 + +if (n > 0) { if (a > b) +z = a; } +else +z = b; +The ambiguity is especially pernicious in situations like this: + +if (n > 0) +for (i = 0; i < n; i++) if (s[i] > 0) { +printf("..."); return i; +} +else /* WRONG */ +printf("error -- n is negative\n"); +The indentation shows unequivocally what you want, but the compiler doesn't get the message, and associates the elsewith the inner if. This kind of bug can be hard to find; it's a good idea to use braces when there are nested ifs. +By the way, notice that there is a semicolon after z = a in + +if (a > b) z = a; +else +z = b; +This is because grammatically, a statement follows the if, and an expression statement like ``z = a;'' is always terminated by a semicolon. +3.3 Else-If The construction + +if (expression) statement +else if (expression) statement +else if (expression) statement +else if (expression) statement +else statement +occurs so often that it is worth a brief separate discussion. This sequence of ifstatements is the most general way of writing a multi-way decision. The expressions are evaluated in order; if an expression is true, the statement associated with it is executed, and this terminates the whole chain. As always, the code for each statement is either a single statement, or a group of them in braces. +The last elsepart handles the ``none of the above'' or default case where none of the other conditions is satisfied. Sometimes there is no explicit action for the default; in that case the trailing + +else statement +can be omitted, or it may be used for error checking to catch an ``impossible'' condition. +To illustrate a three-way decision, here is a binary search function that decides if a particular value x occurs in the sorted array v. The elements of v must be in increasing order. The function returns the position (a number between 0 and n-1) if x occurs in v, and -1 if not. +52 + +Binary search first compares the input value xto the middle element of the array v. If xis less than the middle value, searching focuses on the lower half of the table, otherwise on the upper half. In either case, the next step is to compare xto the middle element of the selected half. This process of dividing the range in two continues until the value is found or the range is empty. + +/* binsearch: find x in v[0] <= v[1] <= ... <= v[n-1] */ int binsearch(int x, int v[], int n) +{ +int low, high, mid; + +low = 0; +high = n - 1; +while (low <= high) { mid = (low+high)/2; if (x < v[mid]) +high = mid + 1; else if (x > v[mid]) +low = mid + 1; +else /* found match */ return mid; +} +return -1; /* no match */ } +The fundamental decision is whether xis less than, greater than, or equal to the middle element v[mid] at each step; this is a natural for else-if. +Exercise 3-1. Our binary search makes two tests inside the loop, when one would suffice (at the price of more tests outside.) Write a version with only one test inside the loop and measure the difference in run-time. + +3.4 Switch +The switchstatement is a multi-way decision that tests whether an expression matches one of a number of constant integer values, and branches accordingly. + +switch (expression) { +case const-expr: statements case const-expr: statements default: statements +} +Each case is labeled by one or more integer-valued constants or constant expressions. If a case matches the expression value, execution starts at that case. All case expressions must be different. The case labeled default is executed if none of the other cases are satisfied. A defaultis optional; if it isn't there and if none of the cases match, no action at all takes place. Cases and the default clause can occur in any order. +In Chapter 1 we wrote a program to count the occurrences of each digit, white space, and all other characters, using a sequence of if ... else if ... else. Here is the same program with a switch: + +#include + +main() /* count digits, white space, others */ { +int c, i, nwhite, nother, ndigit[10]; + +nwhite = nother = 0; for (i = 0; i < 10; i++) +ndigit[i] = 0; +while ((c = getchar()) != EOF) { +53 + +switch (c) { +case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': +ndigit[c-'0']++; break; +case ' ': case '\n': case '\t': +nwhite++; break; +default: nother++; break; +} } +printf("digits ="); +for (i = 0; i < 10; i++) printf(" %d", ndigit[i]); +printf(", white space = %d, other = %d\n", nwhite, nother); +return 0; } +The breakstatement causes an immediate exit from the switch. Because cases serve just as labels, after the code for one case is done, execution falls through to the next unless you take explicit action to escape. breakand returnare the most common ways to leave a switch. A breakstatement can also be used to force an immediate exit from while, for, and doloops, as will be discussed later in this chapter. +Falling through cases is a mixed blessing. On the positive side, it allows several cases to be attached to a single action, as with the digits in this example. But it also implies that normally each case must end with a breakto prevent falling through to the next. Falling through from one case to another is not robust, being prone to disintegration when the program is modified. With the exception of multiple labels for a single computation, fall-throughs should be used sparingly, and commented. + +As a matter of good form, put a breakafter the last case (the defaulthere) even though it's logically unnecessary. Some day when another case gets added at the end, this bit of defensive programming will save you. + +Exercise 3-2. Write a function escape(s,t)that converts characters like newline and tab into visible escape sequences like \nand \tas it copies the string tto s. Use a switch. Write a function for the other direction as well, converting escape sequences into the real characters. + +3.5 Loops - While and For +We have already encountered the while and for loops. In + +while (expression) statement +the expression is evaluated. If it is non-zero, statement is executed and expression is re-evaluated. This cycle continues until expression becomes zero, at which point execution resumes after statement. +The for statement + +for (expr1; expr2; expr3) statement +is equivalent to + +expr1; +while (expr2) { +54 + +statement expr3; +} +except for the behaviour of continue, which is described in Section 3.7. +Grammatically, the three components of a forloop are expressions. Most commonly, expr1 and expr3 are assignments or function calls and expr2 is a relational expression. Any of the three parts can be omitted, although the semicolons must remain. If expr1 or expr3 is omitted, it is simply dropped from the expansion. If the test, expr2, is not present, it is taken as permanently true, so + +for (;;) { ... +} +is an ``infinite'' loop, presumably to be broken by other means, such as a break or return. +Whether to use while or for is largely a matter of personal preference. For example, in + +while ((c = getchar()) == ' ' || c == '\n' || c = '\t') ; /* skip white space characters */ +there is no initialization or re-initialization, so the while is most natural. +The foris preferable when there is a simple initialization and increment since it keeps the loop control statements close together and visible at the top of the loop. This is most obvious in + +for (i = 0; i < n; i++) ... +which is the C idiom for processing the first nelements of an array, the analog of the Fortran DO loop or the Pascal for. The analogy is not perfect, however, since the index variable i retains its value when the loop terminates for any reason. Because the components of the for are arbitrary expressions, forloops are not restricted to arithmetic progressions. Nonetheless, it is bad style to force unrelated computations into the initialization and increment of a for, which are better reserved for loop control operations. +As a larger example, here is another version of atoi for converting a string to its numeric equivalent. This one is slightly more general than the one in Chapter 2; it copes with optional leading white space and an optional +or -sign. (Chapter 4 shows atof, which does the same conversion for floating-point numbers.) + +The structure of the program reflects the form of the input: + +skip white space, if any get sign, if any +get integer part and convert it + +Each step does its part, and leaves things in a clean state for the next. The whole process terminates on the first character that could not be part of a number. + +#include + +/* atoi: convert s to integer; version 2 */ int atoi(char s[]) +{ +int i, n, sign; + + +for (i = 0; isspace(s[i]); i++) ; +sign = (s[i] == '-') ? -1 : 1; if (s[i] == '+' || s[i] == '-') +i++; + +/* skip white space */ + + +/* skip sign */ +55 + +for (n = 0; isdigit(s[i]); i++) n = 10 * n + (s[i] - '0'); +return sign * n; } +The standard library provides a more elaborate function strtolfor conversion of strings to long integers; see Section 5 of Appendix B. +The advantages of keeping loop control centralized are even more obvious when there are several nested loops. The following function is a Shell sort for sorting an array of integers. The basic idea of this sorting algorithm, which was invented in 1959 by D. L. Shell, is that in early stages, far-apart elements are compared, rather than adjacent ones as in simpler interchange sorts. This tends to eliminate large amounts of disorder quickly, so later stages have less work to do. The interval between compared elements is gradually decreased to one, at which point the sort effectively becomes an adjacent interchange method. + +/* shellsort: sort v[0]...v[n-1] into increasing order */ void shellsort(int v[], int n) +{ +int gap, i, j, temp; + +for (gap = n/2; gap > 0; gap /= 2) for (i = gap; i < n; i++) +for (j=i-gap; j>=0 && v[j]>v[j+gap]; j-=gap) { temp = v[j]; +v[j] = v[j+gap]; v[j+gap] = temp; +} } +There are three nested loops. The outermost controls the gap between compared elements, shrinking it from n/2by a factor of two each pass until it becomes zero. The middle loop steps along the elements. The innermost loop compares each pair of elements that is separated by gapand reverses any that are out of order. Since gapis eventually reduced to one, all elements are eventually ordered correctly. Notice how the generality of the formakes the outer loop fit in the same form as the others, even though it is not an arithmetic progression. +One final C operator is the comma ``,'', which most often finds use in the forstatement. A pair of expressions separated by a comma is evaluated left to right, and the type and value of the result are the type and value of the right operand. Thus in a for statement, it is possible to place multiple expressions in the various parts, for example to process two indices in parallel. This is illustrated in the function reverse(s), which reverses the string s in place. + +#include + +/* reverse: reverse string s in place */ void reverse(char s[]) +{ +int c, i, j; + +for (i = 0, j = strlen(s)-1; i < j; i++, j--) { c = s[i]; +s[i] = s[j]; s[j] = c; +} } +The commas that separate function arguments, variables in declarations, etc., are not comma operators, and do not guarantee left to right evaluation. +Comma operators should be used sparingly. The most suitable uses are for constructs strongly related to each other, as in the for loop in reverse, and in macros where a multistep computation has to be a single expression. A comma expression might also be appropriate for + + +the exchange of elements in reverse, operation: + +56 + +where the exchange can be thought of a single + + +for (i = 0, j = strlen(s)-1; i < j; i++, j--) c = s[i], s[i] = s[j], s[j] = c; +Exercise 3-3. Write a function expand(s1,s2)that expands shorthand notations like a-zin the string s1into the equivalent complete list abc...xyzin s2. Allow for letters of either case and digits, and be prepared to handle cases like a-b-cand a-z0-9and -a-z. Arrange that a leading or trailing - is taken literally. +3.6 Loops - Do-While +As we discussed in Chapter 1, the whileand forloops test the termination condition at the top. By contrast, the third loop in C, the do-while, tests at the bottom after making each pass through the loop body; the body is always executed at least once. +The syntax of the do is + +do +statement +while (expression); +The statement is executed, then expression is evaluated. If it is true, statement is evaluated again, and so on. When the expression becomes false, the loop terminates. Except for the sense of the test, do-while is equivalent to the Pascal repeat-until statement. +Experience shows that do-whileis much less used than whileand for. Nonetheless, from time to time it is valuable, as in the following function itoa, which converts a number to a character string (the inverse of atoi). The job is slightly more complicated than might be thought at first, because the easy methods of generating the digits generate them in the wrong order. We have chosen to generate the string backwards, then reverse it. + +/* itoa: convert n to characters in s */ void itoa(int n, char s[]) +{ +int i, sign; + +if ((sign = n) < 0) /* record sign */ +n = -n; /* make n positive */ i = 0; +do { /* generate digits in reverse order */ s[i++] = n % 10 + '0'; /* get next digit */ +} while ((n /= 10) > 0); /* delete it */ if (sign < 0) +s[i++] = '-'; s[i] = '\0'; reverse(s); +} +The do-while is necessary, or at least convenient, since at least one character must be installed in the array s, even if nis zero. We also used braces around the single statement that makes up the body of the do-while, even though they are unnecessary, so the hasty reader will not mistake the while part for the beginning of a while loop. +Exercise 3-4. In a two's complement number representation, our version of itoa does not handle the largest negative number, that is, the value of nequal to -(2wordsize-1). Explain why not. Modify it to print that value correctly, regardless of the machine on which it runs. + +Exercise 3-5. Write the function itob(n,s,b) that converts the integer n into a base b character representation in the string s. In particular, itob(n,s,16) formats s as a hexadecimal integer in s. +57 + +Exercise 3-6. Write a version of itoathat accepts three arguments instead of two. The third argument is a minimum field width; the converted number must be padded with blanks on the left if necessary to make it wide enough. + +3.7 Break and Continue +It is sometimes convenient to be able to exit from a loop other than by testing at the top or bottom. The breakstatement provides an early exit from for, while, and do, just as from switch. A break causes the innermost enclosing loop or switch to be exited immediately. +The following function, trim, removes trailing blanks, tabs and newlines from the end of a string, using a breakto exit from a loop when the rightmost non-blank, non-tab, non-newline is found. + +/* trim: remove trailing blanks, tabs, newlines */ int trim(char s[]) +{ +int n; + +for (n = strlen(s)-1; n >= 0; n--) +if (s[n] != ' ' && s[n] != '\t' && s[n] != '\n') break; +s[n+1] = '\0'; return n; +} +strlenreturns the length of the string. The forloop starts at the end and scans backwards looking for the first character that is not a blank or tab or newline. The loop is broken when one is found, or when nbecomes negative (that is, when the entire string has been scanned). You should verify that this is correct behavior even when the string is empty or contains only white space characters. +The continuestatement is related to break, but less often used; it causes the next iteration of the enclosing for, while, or doloop to begin. In the whileand do, this means that the test part is executed immediately; in the for, control passes to the increment step. The continue statement applies only to loops, not to switch. A continue inside a switch inside a loop causes the next loop iteration. + +As an example, this fragment processes only the non-negative elements in the array a; negative values are skipped. + +for (i = 0; i < n; i++) +if (a[i] < 0) /* skip negative elements */ continue; +... /* do positive elements */ +The continue statement is often used when the part of the loop that follows is complicated, so that reversing a test and indenting another level would nest the program too deeply. +3.8 Goto and labels +C provides the infinitely-abusable gotostatement, and labels to branch to. Formally, the goto statement is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. +Nevertheless, there are a few situations where gotos may find a place. The most common is to abandon processing in some deeply nested structure, such as breaking out of two or more loops at once. The break statement cannot be used directly since it only exits from the innermost loop. Thus: + +for ( ... ) +58 + +for ( ... ) { ... +if (disaster) goto error; +} ... +error: +/* clean up the mess */ +This organization is handy if the error-handling code is non-trivial, and if errors can occur in several places. +A label has the same form as a variable name, and is followed by a colon. It can be attached to any statement in the same function as the goto. The scope of a label is the entire function. + +As another example, consider the problem of determining whether two arrays aand bhave an element in common. One possibility is + +for (i = 0; i < n; i++) for (j = 0; j < m; j++) +if (a[i] == b[j]) goto found; +/* didn't find any common element */ ... +found: +/* got one: a[i] == b[j] */ ... +Code involving a gotocan always be written without one, though perhaps at the price of some repeated tests or an extra variable. For example, the array search becomes + +found = 0; +for (i = 0; i < n && !found; i++) for (j = 0; j < m && !found; j++) +if (a[i] == b[j]) found = 1; +if (found) +/* got one: a[i-1] == b[j-1] */ ... +else +/* didn't find any common element */ ... +With a few exceptions like those cited here, code that relies on gotostatements is generally harder to understand and to maintain than code without gotos. Although we are not dogmatic about the matter, it does seem that goto statements should be used rarely, if at all. +59 + + +Chapter 4 - Functions and Program Structure +Functions break large computing tasks into smaller ones, and enable people to build on what others have done instead of starting over from scratch. Appropriate functions hide details of operation from parts of the program that don't need to know about them, thus clarifying the whole, and easing the pain of making changes. +C has been designed to make functions efficient and easy to use; C programs generally consist of many small functions rather than a few big ones. A program may reside in one or more source files. Source files may be compiled separately and loaded together, along with previously compiled functions from libraries. We will not go into that process here, however, since the details vary from system to system. + +Function declaration and definition is the area where the ANSI standard has made the most changes to C. As we saw first in Chapter 1, it is now possible to declare the type of arguments when a function is declared. The syntax of function declaration also changes, so that declarations and definitions match. This makes it possible for a compiler to detect many more errors than it could before. Furthermore, when arguments are properly declared, appropriate type coercions are performed automatically. + +The standard clarifies the rules on the scope of names; in particular, it requires that there be only one definition of each external object. Initialization is more general: automatic arrays and structures may now be initialized. + +The C preprocessor has also been enhanced. New preprocessor facilities include a more complete set of conditional compilation directives, a way to create quoted strings from macro arguments, and better control over the macro expansion process. + +4.1 Basics of Functions +To begin with, let us design and write a program to print each line of its input that contains a particular ``pattern'' or string of characters. (This is a special case of the UNIX program grep.) For example, searching for the pattern of letters ``ould'' in the set of lines + +Ah Love! could you and I with Fate conspire To grasp this sorry Scheme of Things entire, Would not we shatter it to bits -- and then Re-mould it nearer to the Heart's Desire! +will produce the output + +Ah Love! could you and I with Fate conspire Would not we shatter it to bits -- and then Re-mould it nearer to the Heart's Desire! +The job falls neatly into three pieces: + +while (there's another line) +if (the line contains the pattern) print it +Although it's certainly possible to put the code for all of this in main, a better way is to use the structure to advantage by making each part a separate function. Three small pieces are better to deal with than one big one, because irrelevant details can be buried in the functions, and the chance of unwanted interactions is minimized. And the pieces may even be useful in other programs. +60 + +``While there's another line'' is getline, a function that we wrote in Chapter 1, and ``print it'' is printf, which someone has already provided for us. This means we need only write a routine to decide whether the line contains an occurrence of the pattern. + +We can solve that problem by writing a function strindex(s,t)that returns the position or index in the string swhere the string tbegins, or -1if sdoes not contain t. Because C arrays begin at position zero, indexes will be zero or positive, and so a negative value like -1 is convenient for signaling failure. When we later need more sophisticated pattern matching, we only have to replace strindex; the rest of the code can remain the same. (The standard library provides a function strstrthat is similar to strindex, except that it returns a pointer instead of an index.) + +Given this much design, filling in the details of the program is straightforward. Here is the whole thing, so you can see how the pieces fit together. For now, the pattern to be searched for is a literal string, which is not the most general of mechanisms. We will return shortly to a discussion of how to initialize character arrays, and in Chapter 5 will show how to make the pattern a parameter that is set when the program is run. There is also a slightly different version of getline; you might find it instructive to compare it to the one in Chapter 1. + +#include +#define MAXLINE 1000 /* maximum input line length */ + +int getline(char line[], int max) +int strindex(char source[], char searchfor[]); + +char pattern[] = "ould"; /* pattern to search for */ + +/* find all lines matching pattern */ main() +{ +char line[MAXLINE]; int found = 0; + +while (getline(line, MAXLINE) > 0) +if (strindex(line, pattern) >= 0) { printf("%s", line); +found++; } +return found; } + +/* getline: get line into s, return length */ int getline(char s[], int lim) +{ +int c, i; + +i = 0; +while (--lim > 0 && (c=getchar()) != EOF && c != '\n') s[i++] = c; +if (c == '\n') s[i++] = c; +s[i] = '\0'; return i; +} + +/* strindex: return index of t in s, -1 if none */ int strindex(char s[], char t[]) +{ +int i, j, k; + +for (i = 0; s[i] != '\0'; i++) { +for (j=i, k=0; t[k]!='\0' && s[j]==t[k]; j++, k++) +61 + +; +if (k > 0 && t[k] == '\0') return i; +} +return -1; } +Each function definition has the form + +return-type function-name(argument declarations) { +declarations and statements } +Various parts may be absent; a minimal function is + +dummy() {} +which does nothing and returns nothing. A do-nothing function like this is sometimes useful as a place holder during program development. If the return type is omitted, int is assumed. +A program is just a set of definitions of variables and functions. Communication between the functions is by arguments and values returned by the functions, and through external variables. The functions can occur in any order in the source file, and the source program can be split into multiple files, so long as no function is split. + +The returnstatement is the mechanism for returning a value from the called function to its caller. Any expression can follow return: + +return expression; +The expression will be converted to the return type of the function if necessary. Parentheses are often used around the expression, but they are optional. +The calling function is free to ignore the returned value. Furthermore, there need to be no expression after return; in that case, no value is returned to the caller. Control also returns to the caller with no value when execution ``falls off the end'' of the function by reaching the closing right brace. It is not illegal, but probably a sign of trouble, if a function returns a value from one place and no value from another. In any case, if a function fails to return a value, its ``value'' is certain to be garbage. + +The pattern-searching program returns a status from main, the number of matches found. This value is available for use by the environment that called the program + +The mechanics of how to compile and load a C program that resides on multiple source files vary from one system to the next. On the UNIX system, for example, the cc command mentioned in Chapter 1 does the job. Suppose that the three functions are stored in three files called main.c, getline.c, and strindex.c. Then the command + +cc main.c getline.c strindex.c +compiles the three files, placing the resulting object code in files main.o, getline.o, and strindex.o, then loads them all into an executable file called a.out. If there is an error, say in main.c, the file can be recompiled by itself and the result loaded with the previous object files, with the command + +cc main.c getline.o strindex.o +The cc command uses the ``.c'' versus ``.o'' naming convention to distinguish source files from object files. +Exercise 4-1. Write the function strindex(s,t)which returns the position of the rightmost occurrence of t in s, or -1 if there is none. +62 + +4.2 Functions Returning Non-integers +So far our examples of functions have returned either no value (void) or an int. What if a function must return some other type? many numerical functions like sqrt, sin, and cos return double; other specialized functions return other types. To illustrate how to deal with this, let us write and use the function atof(s), which converts the string s to its double-precision floating-point equivalent. atofif an extension of atoi, which we showed versions of in Chapters 2 and 3. It handles an optional sign and decimal point, and the presence or absence of either part or fractional part. Our version is not a high-quality input conversion routine; that would take more space than we care to use. The standard library includes an atof; the header declares it. +First, atofitself must declare the type of value it returns, since it is not int. The type name precedes the function name: + +#include + +/* atof: convert string s to double */ double atof(char s[]) +{ +double val, power; int i, sign; + +for (i = 0; isspace(s[i]); i++) /* skip white space */ ; +sign = (s[i] == '-') ? -1 : 1; if (s[i] == '+' || s[i] == '-') +i++; +for (val = 0.0; isdigit(s[i]); i++) val = 10.0 * val + (s[i] - '0'); +if (s[i] == '.') i++; +for (power = 1.0; isdigit(s[i]); i++) { val = 10.0 * val + (s[i] - '0'); power *= 10; +} +return sign * val / power; } +Second, and just as important, the calling routine must know that atofreturns a non-int value. One way to ensure this is to declare atofexplicitly in the calling routine. The declaration is shown in this primitive calculator (barely adequate for check-book balancing), which reads one number per line, optionally preceded with a sign, and adds them up, printing the running sum after each input: + +#include + +#define MAXLINE 100 + +/* rudimentary calculator */ main() +{ +double sum, atof(char []); char line[MAXLINE]; +int getline(char line[], int max); + +sum = 0; +while (getline(line, MAXLINE) > 0) printf("\t%g\n", sum += atof(line)); +return 0; } +The declaration +63 + +double sum, atof(char []); +says that sumis a doublevariable, and that atofis a function that takes one char[]argument and returns a double. +The function atofmust be declared and defined consistently. If atofitself and the call to it in mainhave inconsistent types in the same source file, the error will be detected by the compiler. But if (as is more likely) atofwere compiled separately, the mismatch would not be detected, atofwould return a doublethat mainwould treat as an int, and meaningless answers would result. + +In the light of what we have said about how declarations must match definitions, this might seem surprising. The reason a mismatch can happen is that if there is no function prototype, a function is implicitly declared by its first appearance in an expression, such as + +sum += atof(line) +If a name that has not been previously declared occurs in an expression and is followed by a left parentheses, it is declared by context to be a function name, the function is assumed to return an int, and nothing is assumed about its arguments. Furthermore, if a function declaration does not include arguments, as in + +double atof(); +that too is taken to mean that nothing is to be assumed about the arguments of atof; all parameter checking is turned off. This special meaning of the empty argument list is intended to permit older C programs to compile with new compilers. But it's a bad idea to use it with new C programs. If the function takes arguments, declare them; if it takes no arguments, use void. +Given atof, properly declared, we could write atoi (convert a string to int) in terms of it: + +/* atoi: convert string s to integer using atof */ int atoi(char s[]) +{ +double atof(char s[]); + +return (int) atof(s); } +Notice the structure of the declarations and the return statement. The value of the expression in + +return expression; +is converted to the type of the function before the return is taken. Therefore, the value of atof, a double, is converted automatically to intwhen it appears in this return, since the function atoireturns an int. This operation does potentionally discard information, however, so some compilers warn of it. The cast states explicitly that the operation is intended, and suppresses any warning. +Exercise 4-2. Extend atof to handle scientific notation of the form + +123.45e-6 +where a floating-point number may be followed by e or E and an optionally signed exponent. +4.3 External Variables +A C program consists of a set of external objects, which are either variables or functions. The adjective ``external'' is used in contrast to ``internal'', which describes the arguments and variables defined inside functions. External variables are defined outside of any function, and are thus potentionally available to many functions. Functions themselves are always external, because C does not allow functions to be defined inside other functions. By default, external +64 + +variables and functions have the property that all references to them by the same name, even from functions compiled separately, are references to the same thing. (The standard calls this property external linkage.) In this sense, external variables are analogous to Fortran COMMON blocks or variables in the outermost block in Pascal. We will see later how to define external variables and functions that are visible only within a single source file. Because external variables are globally accessible, they provide an alternative to function arguments and return values for communicating data between functions. Any function may access an external variable by referring to it by name, if the name has been declared somehow. +If a large number of variables must be shared among functions, external variables are more convenient and efficient than long argument lists. As pointed out in Chapter 1, however, this reasoning should be applied with some caution, for it can have a bad effect on program structure, and lead to programs with too many data connections between functions. + +External variables are also useful because of their greater scope and lifetime. Automatic variables are internal to a function; they come into existence when the function is entered, and disappear when it is left. External variables, on the other hand, are permanent, so they can retain values from one function invocation to the next. Thus if two functions must share some data, yet neither calls the other, it is often most convenient if the shared data is kept in external variables rather than being passed in and out via arguments. + +Let us examine this issue with a larger example. The problem is to write a calculator program that provides the operators +, -, *and /. Because it is easier to implement, the calculator will use reverse Polish notation instead of infix. (Reverse Polish notation is used by some pocket calculators, and in languages like Forth and Postscript.) + +In reverse Polish notation, each operator follows its operands; an infix expression like + +(1 - 2) * (4 + 5) is entered as + +1 2 - 4 5 + * +Parentheses are not needed; the notation is unambiguous as long as we know how many operands each operator expects. +The implementation is simple. Each operand is pushed onto a stack; when an operator arrives, the proper number of operands (two for binary operators) is popped, the operator is applied to them, and the result is pushed back onto the stack. In the example above, for instance, 1 and 2 are pushed, then replaced by their difference, -1. Next, 4 and 5 are pushed and then replaced by their sum, 9. The product of -1 and 9, which is -9, replaces them on the stack. The value on the top of the stack is popped and printed when the end of the input line is encountered. + +The structure of the program is thus a loop that performs the proper operation on each operator and operand as it appears: + +while (next operator or operand is not end-of-file indicator) if (number) +push it +else if (operator) pop operands do operation push result +else if (newline) +pop and print top of stack else +error +65 + +The operation of pushing and popping a stack are trivial, but by the time error detection and recovery are added, they are long enough that it is better to put each in a separate function than to repeat the code throughout the whole program. And there should be a separate function for fetching the next input operator or operand. +The main design decision that has not yet been discussed is where the stack is, that is, which routines access it directly. On possibility is to keep it in main, and pass the stack and the current stack position to the routines that push and pop it. But main doesn't need to know about the variables that control the stack; it only does push and pop operations. So we have decided to store the stack and its associated information in external variables accessible to the push and pop functions but not to main. + +Translating this outline into code is easy enough. If for now we think of the program as existing in one source file, it will look like this: + +#includes #defines + +function declarations for main + +main() { ... } + +external variables for pushand pop + +void push( double f) { ... } double pop(void) { ... } + +int getop(char s[]) { ... } routines called by getop +Later we will discuss how this might be split into two or more source files. + +The function mainis a loop containing a big switchon the type of operator or operand; this is a more typical use of switch than the one shown in Section 3.4. + +#include +#include /* for atof() */ + + +#define MAXOP 100 #define NUMBER '0' + +/* max size of operand or operator */ /* signal that a number was found */ + + +int getop(char []); void push(double); double pop(void); + +/* reverse Polish calculator */ main() +{ +int type; double op2; char s[MAXOP]; + +while ((type = getop(s)) != EOF) { switch (type) { +case NUMBER: push(atof(s)); break; +case '+': +push(pop() + pop()); break; +case '*': +push(pop() * pop()); +66 + +break; case '-': +op2 = pop(); push(pop() - op2); break; +case '/': +op2 = pop(); if (op2 != 0.0) +push(pop() / op2); else +printf("error: zero divisor\n"); break; +case '\n': +printf("\t%.8g\n", pop()); break; +default: +printf("error: unknown command %s\n", s); break; +} } +return 0; } +Because + and * are commutative operators, the order in which the popped operands are combined is irrelevant, but for - and / the left and right operand must be distinguished. In + +push(pop() - pop()); /* WRONG */ +the order in which the two calls of popare evaluated is not defined. To guarantee the right order, it is necessary to pop the first value into a temporary variable as we did in main. + +#define MAXVAL 100 /* maximum depth of val stack */ + + +int sp = 0; +double val[MAXVAL]; + +/* next free stack position */ /* value stack */ + + +/* push: push f onto value stack */ void push(double f) +{ +if (sp < MAXVAL) val[sp++] = f; +else +printf("error: stack full, can't push %g\n", f); } + +/* pop: pop and return top value from stack */ double pop(void) +{ +if (sp > 0) +return val[--sp]; else { +printf("error: stack empty\n"); return 0.0; +} } +A variable is external if it is defined outside of any function. Thus the stack and stack index that must be shared by pushand popare defined outside these functions. But mainitself does not refer to the stack or stack position - the representation can be hidden. +Let us now turn to the implementation of getop, the function that fetches the next operator or operand. The task is easy. Skip blanks and tabs. If the next character is not a digit or a hexadecimal point, return it. Otherwise, collect a string of digits (which might include a decimal point), and return NUMBER, the signal that a number has been collected. + +#include +67 + +int getch(void); void ungetch(int); + +/* getop: get next character or numeric operand */ int getop(char s[]) +{ +int i, c; + +while ((s[0] = c = getch()) == ' ' || c == '\t') ; +s[1] = '\0'; +if (!isdigit(c) && c != '.') +return c; /* not a number */ i = 0; +if (isdigit(c)) /* collect integer part */ while (isdigit(s[++i] = c = getch())) +; +if (c == '.') /* collect fraction part */ while (isdigit(s[++i] = c = getch())) +; s[i] = '\0'; if (c != EOF) +ungetch(c); return NUMBER; +} +What are getchand ungetch? It is often the case that a program cannot determine that it has read enough input until it has read too much. One instance is collecting characters that make up a number: until the first non-digit is seen, the number is not complete. But then the program has read one character too far, a character that it is not prepared for. +The problem would be solved if it were possible to ``un-read'' the unwanted character. Then, every time the program reads one character too many, it could push it back on the input, so the rest of the code could behave as if it had never been read. Fortunately, it's easy to simulate un-getting a character, by writing a pair of cooperating functions. getchdelivers the next input character to be considered; ungetch will return them before reading new input. + +How they work together is simple. ungetch puts the pushed-back characters into a shared buffer -- a character array. getch reads from the buffer if there is anything else, and calls getcharif the buffer is empty. There must also be an index variable that records the position of the current character in the buffer. + +Since the buffer and the index are shared by getchand ungetchand must retain their values between calls, they must be external to both routines. Thus we can write getch, ungetch, and their shared variables as: + +#define BUFSIZE 100 + + +char buf[BUFSIZE]; int bufp = 0; + +/* buffer for ungetch */ +/* next free position in buf */ + + +int getch(void) /* get a (possibly pushed-back) character */ { +return (bufp > 0) ? buf[--bufp] : getchar(); } + +void ungetch(int c) /* push character back on input */ { +if (bufp >= BUFSIZE) +printf("ungetch: too many characters\n"); else +buf[bufp++] = c; } +68 + +The standard library includes a function ungetchthat provides one character of pushback; we will discuss it in Chapter 7. We have used an array for the pushback, rather than a single character, to illustrate a more general approach. +Exercise 4-3. Given the basic framework, it's straightforward to extend the calculator. Add the modulus (%) operator and provisions for negative numbers. + +Exercise 4-4. Add the commands to print the top elements of the stack without popping, to duplicate it, and to swap the top two elements. Add a command to clear the stack. + +Exercise 4-5. Add access to library functions like sin, exp, and pow. See in Appendix B, Section 4. + +Exercise 4-6. Add commands for handling variables. (It's easy to provide twenty-six variables with single-letter names.) Add a variable for the most recently printed value. + +Exercise 4-7. Write a routine ungets(s)that will push back an entire string onto the input. Should ungets know about buf and bufp, or should it just use ungetch? + +Exercise 4-8. Suppose that there will never be more than one character of pushback. Modify getch and ungetch accordingly. + +Exercise 4-9. Our getchand ungetch do not handle a pushed-back EOF correctly. Decide what their properties ought to be if an EOF is pushed back, then implement your design. + +Exercise 4-10. An alternate organization uses getlineto read an entire input line; this makes getch and ungetch unnecessary. Revise the calculator to use this approach. + +4.4 Scope Rules +The functions and external variables that make up a C program need not all be compiled at the same time; the source text of the program may be kept in several files, and previously compiled routines may be loaded from libraries. Among the questions of interest are +· How are declarations written so that variables are properly declared during compilation? + +· How are declarations arranged so that all the pieces will be properly connected when the program is loaded? + +· How are declarations organized so there is only one copy? + +· How are external variables initialized? +Let us discuss these topics by reorganizing the calculator program into several files. As a practical matter, the calculator is too small to be worth splitting, but it is a fine illustration of the issues that arise in larger programs. +The scope of a name is the part of the program within which the name can be used. For an automatic variable declared at the beginning of a function, the scope is the function in which the name is declared. Local variables of the same name in different functions are unrelated. The same is true of the parameters of the function, which are in effect local variables. + +The scope of an external variable or a function lasts from the point at which it is declared to the end of the file being compiled. For example, if main, sp, val, push, and popare defined in one file, in the order shown above, that is, + +main() { ... } +69 + +int sp = 0; +double val[MAXVAL]; + +void push(double f) { ... } + +double pop(void) { ... } +then the variables spand valmay be used in pushand popsimply by naming them; no further declarations are needed. But these names are not visible in main, nor are push and pop themselves. +On the other hand, if an external variable is to be referred to before it is defined, or if it is defined in a different source file from the one where it is being used, then an extern declaration is mandatory. + +It is important to distinguish between the declaration of an external variable and its definition. A declaration announces the properties of a variable (primarily its type); a definition also causes storage to be set aside. If the lines + +int sp; +double val[MAXVAL]; +appear outside of any function, they define the external variables spand val, cause storage to be set aside, and also serve as the declarations for the rest of that source file. On the other hand, the lines + +extern int sp; extern double val[]; +declare for the rest of the source file that spis an intand that valis a doublearray (whose size is determined elsewhere), but they do not create the variables or reserve storage for them. +There must be only one definition of an external variable among all the files that make up the source program; other files may contain externdeclarations to access it. (There may also be externdeclarations in the file containing the definition.) Array sizes must be specified with the definition, but are optional with an extern declaration. + +Initialization of an external variable goes only with the definition. + +Although it is not a likely organization for this program, the functions pushand popcould be defined in one file, and the variables valand spdefined and initialized in another. Then these definitions and declarations would be necessary to tie them together: + +in file1: + +extern int sp; extern double val[]; + +void push(double f) { ... } + +double pop(void) { ... } in file2: + +int sp = 0; +double val[MAXVAL]; +Because the externdeclarations in file1 lie ahead of and outside the function definitions, they apply to all functions; one set of declarations suffices for all of file1. This same organization would also bee needed if the definition of sp and val followed their use in one file. +4.5 Header Files +Let is now consider dividing the calculator program into several source files, as it might be is each of the components were substantially bigger. The main function would go in one file, +70 + +which we will call main.c; push, pop, and their variables go into a second file, stack.c; getopgoes into a third, getop.c. Finally, getchand ungetchgo into a fourth file, getch.c; we separate them from the others because they would come from a separately-compiled library in a realistic program. +There is one more thing to worry about - the definitions and declarations shared among files. As much as possible, we want to centralize this, so that there is only one copy to get and keep right as the program evolves. Accordingly, we will place this common material in a header file, calc.h, which will be included as necessary. (The #includeline is described in Section 4.11.) The resulting program then looks like this: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +There is a tradeoff between the desire that each file have access only to the information it needs for its job and the practical reality that it is harder to maintain more header files. Up to some moderate program size, it is probably best to have one header file that contains everything that is to be shared between any two parts of the program; that is the decision we made here. For a much larger program, more organization and more headers would be needed. + +4.6 Static Variables +71 + +The variables spand valin stack.c, and bufand bufpin getch.c, are for the private use of the functions in their respective source files, and are not meant to be accessed by anything else. The staticdeclaration, applied to an external variable or function, limits the scope of that object to the rest of the source file being compiled. External staticthus provides a way to hide names like bufand bufpin the getch-ungetchcombination, which must be external so they can be shared, yet which should not be visible to users of getch and ungetch. +Static storage is specified by prefixing the normal declaration with the word static. If the two routines and the two variables are compiled in one file, as in + + +static char buf[BUFSIZE]; static int bufp = 0; + +/* buffer for ungetch */ +/* next free position in buf */ + + +int getch(void) { ... } + +void ungetch(int c) { ... } +then no other routine will be able to access bufand bufp, and those names will not conflict with the same names in other files of the same program. In the same way, the variables that push and pop use for stack manipulation can be hidden, by declaring sp and val to be static. +The external static declaration is most often used for variables, but it can be applied to functions as well. Normally, function names are global, visible to any part of the entire program. If a function is declared static, however, its name is invisible outside of the file in which it is declared. + +The staticdeclaration can also be applied to internal variables. Internal staticvariables are local to a particular function just as automatic variables are, but unlike automatics, they remain in existence rather than coming and going each time the function is activated. This means that internal static variables provide private, permanent storage within a single function. + +Exercise 4-11. Modify getopso that it doesn't need to use ungetch. Hint: use an internal static variable. + +4.7 Register Variables +A registerdeclaration advises the compiler that the variable in question will be heavily used. The idea is that registervariables are to be placed in machine registers, which may result in smaller and faster programs. But compilers are free to ignore the advice. +The register declaration looks like + +register int x; register char c; +and so on. The register declaration can only be applied to automatic variables and to the formal parameters of a function. In this later case, it looks like + +f(register unsigned m, register long n) { +register int i; ... +} +In practice, there are restrictions on register variables, reflecting the realities of underlying hardware. Only a few variables in each function may be kept in registers, and only certain types are allowed. Excess register declarations are harmless, however, since the word registeris ignored for excess or disallowed declarations. And it is not possible to take the address of a register variable (a topic covered in Chapter 5), regardless of whether the variable is actually placed in a register. The specific restrictions on number and types of register variables vary from machine to machine. +72 + +4.8 Block Structure +C is not a block-structured language in the sense of Pascal or similar languages, because functions may not be defined within other functions. On the other hand, variables can be defined in a block-structured fashion within a function. Declarations of variables (including initializations) may follow the left brace that introduces any compound statement, not just the one that begins a function. Variables declared in this way hide any identically named variables in outer blocks, and remain in existence until the matching right brace. For example, in + +if (n > 0) { +int i; /* declare a new i */ + +for (i = 0; i < n; i++) ... +} +the scope of the variable iis the ``true'' branch of the if; this iis unrelated to any ioutside the block. An automatic variable declared and initialized in a block is initialized each time the block is entered. +Automatic variables, including formal parameters, also hide external variables and functions of the same name. Given the declarations + +int x; int y; + +f(double x) { +double y; } +then within the function f, occurrences of xrefer to the parameter, which is a double; outside f, they refer to the external int. The same is true of the variable y. +As a matter of style, it's best to avoid variable names that conceal names in an outer scope; the potential for confusion and error is too great. + +4.9 Initialization +Initialization has been mentioned in passing many times so far, but always peripherally to some other topic. This section summarizes some of the rules, now that we have discussed the various storage classes. +In the absence of explicit initialization, external and static variables are guaranteed to be initialized to zero; automatic and register variables have undefined (i.e., garbage) initial values. + +Scalar variables may be initialized when they are defined, by following the name with an equals sign and an expression: + +int x = 1; +char squota = '\''; +long day = 1000L * 60L * 60L * 24L; /* milliseconds/day */ +For external and static variables, the initializer must be a constant expression; the initialization is done once, conceptionally before the program begins execution. For automatic and register variables, the initializer is not restricted to being a constant: it may be any expression involving previously defined values, even function calls. For example, the initialization of the binary search program in Section 3.3 could be written as + +int binsearch(int x, int v[], int n) { +int low = 0; +int high = n - 1; +73 + +int mid; ... +} instead of + +int low, high, mid; + +low = 0; +high = n - 1; +In effect, initialization of automatic variables are just shorthand for assignment statements. Which form to prefer is largely a matter of taste. We have generally used explicit assignments, because initializers in declarations are harder to see and further away from the point of use. +An array may be initialized by following its declaration with a list of initializers enclosed in braces and separated by commas. For example, to initialize an array dayswith the number of days in each month: + +int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } +When the size of the array is omitted, the compiler will compute the length by counting the initializers, of which there are 12 in this case. +If there are fewer initializers for an array than the specified size, the others will be zero for external, static and automatic variables. It is an error to have too many initializers. There is no way to specify repetition of an initializer, nor to initialize an element in the middle of an array without supplying all the preceding values as well. + +Character arrays are a special case of initialization; a string may be used instead of the braces and commas notation: + +char pattern = "ould"; +is a shorthand for the longer but equivalent + +char pattern[] = { 'o', 'u', 'l', 'd', '\0' }; +In this case, the array size is five (four characters plus the terminating '\0'). +4.10 Recursion +C functions may be used recursively; that is, a function may call itself either directly or indirectly. Consider printing a number as a character string. As we mentioned before, the digits are generated in the wrong order: low-order digits are available before high-order digits, but they have to be printed the other way around. +There are two solutions to this problem. On is to store the digits in an array as they are generated, then print them in the reverse order, as we did with itoa in section 3.6. The alternative is a recursive solution, in which printdfirst calls itself to cope with any leading digits, then prints the trailing digit. Again, this version can fail on the largest negative number. + +#include + +/* printd: print n in decimal */ void printd(int n) +{ +if (n < 0) { putchar('-'); n = -n; +} +if (n / 10) printd(n / 10); +putchar(n % 10 + '0'); } +74 + +When a function calls itself recursively, each invocation gets a fresh set of all the automatic variables, independent of the previous set. This in printd(123)the first printdreceives the argument n = 123. It passes 12to a second printd, which in turn passes 1to a third. The third-level printdprints 1, then returns to the second level. That printdprints 2, then returns to the first level. That one prints 3 and terminates. +Another good example of recursion is quicksort, a sorting algorithm developed by C.A.R. Hoare in 1962. Given an array, one element is chosen and the others partitioned in two subsets - those less than the partition element and those greater than or equal to it. The same process is then applied recursively to the two subsets. When a subset has fewer than two elements, it doesn't need any sorting; this stops the recursion. + +Our version of quicksort is not the fastest possible, but it's one of the simplest. We use the middle element of each subarray for partitioning. + +/* qsort: sort v[left]...v[right] into increasing order */ void qsort(int v[], int left, int right) +{ +int i, last; +void swap(int v[], int i, int j); + +if (left >= right) /* do nothing if array contains */ return; /* fewer than two elements */ +swap(v, left, (left + right)/2); /* move partition elem */ last = left; /* to v[0] */ +for (i = left + 1; i <= right; i++) /* partition */ if (v[i] < v[left]) +swap(v, ++last, i); +swap(v, left, last); /* restore partition elem */ qsort(v, left, last-1); +qsort(v, last+1, right); } +We moved the swapping operation into a separate function swapbecause it occurs three times in qsort. + +/* swap: interchange v[i] and v[j] */ void swap(int v[], int i, int j) +{ +int temp; + +temp = v[i]; v[i] = v[j]; v[j] = temp; +} +The standard library includes a version of qsort that can sort objects of any type. +Recursion may provide no saving in storage, since somewhere a stack of the values being processed must be maintained. Nor will it be faster. But recursive code is more compact, and often much easier to write and understand than the non-recursive equivalent. Recursion is especially convenient for recursively defined data structures like trees, we will see a nice example in Section 6.6. + +Exercise 4-12. Adapt the ideas of printdto write a recursive version of itoa; that is, convert an integer into a string by calling a recursive routine. + +Exercise 4-13. Write a recursive version of the function reverse(s), which reverses the string s in place. + +4.11 The C Preprocessor +75 + +C provides certain language facilities by means of a preprocessor, which is conceptionally a separate first step in compilation. The two most frequently used features are #include, to include the contents of a file during compilation, and #define, to replace a token by an arbitrary sequence of characters. Other features described in this section include conditional compilation and macros with arguments. +4.11.1 File Inclusion +File inclusion makes it easy to handle collections of #defines and declarations (among other things). Any source line of the form + +#include "filename" or + +#include +is replaced by the contents of the file filename. If the filename is quoted, searching for the file typically begins where the source program was found; if it is not found there, or if the name is enclosed in < and >, searching follows an implementation-defined rule to find the file. An included file may itself contain #include lines. +There are often several #includelines at the beginning of a source file, to include common #definestatements and externdeclarations, or to access the function prototype declarations for library functions from headers like . (Strictly speaking, these need not be files; the details of how headers are accessed are implementation-dependent.) + +#include is the preferred way to tie the declarations together for a large program. It guarantees that all the source files will be supplied with the same definitions and variable declarations, and thus eliminates a particularly nasty kind of bug. Naturally, when an included file is changed, all files that depend on it must be recompiled. + +4.11.2 Macro Substitution A definition has the form + +#define name replacement text +It calls for a macro substitution of the simplest kind - subsequent occurrences of the token namewill be replaced by the replacement text. The name in a #definehas the same form as a variable name; the replacement text is arbitrary. Normally the replacement text is the rest of the line, but a long definition may be continued onto several lines by placing a \at the end of each line to be continued. The scope of a name defined with #defineis from its point of definition to the end of the source file being compiled. A definition may use previous definitions. Substitutions are made only for tokens, and do not take place within quoted strings. For example, if YES is a defined name, there would be no substitution in printf("YES") or in YESMAN. +Any name may be defined with any replacement text. For example + +#define forever for (;;) /* infinite loop */ defines a new word, forever, for an infinite loop. +It is also possible to define macros with arguments, so the replacement text can be different for different calls of the macro. As an example, define a macro called max: + +#define max(A, B) ((A) > (B) ? (A) : (B)) +Although it looks like a function call, a use of maxexpands into in-line code. Each occurrence of a formal parameter (here Aor B) will be replaced by the corresponding actual argument. Thus the line +76 + +x = max(p+q, r+s); will be replaced by the line + +x = ((p+q) > (r+s) ? (p+q) : (r+s)); +So long as the arguments are treated consistently, this macro will serve for any data type; there is no need for different kinds of max for different data types, as there would be with functions. +If you examine the expansion of max, you will notice some pitfalls. The expressions are evaluated twice; this is bad if they involve side effects like increment operators or input and output. For instance + +max(i++, j++) /* WRONG */ +will increment the larger twice. Some care also has to be taken with parentheses to make sure the order of evaluation is preserved; consider what happens when the macro + +#define square(x) x * x /* WRONG */ is invoked as square(z+1). +Nonetheless, macros are valuable. One practical example comes from , in which getchar and putchar are often defined as macros to avoid the run-time overhead of a function call per character processed. The functions in are also usually implemented as macros. + +Names may be undefined with #undef, usually to ensure that a routine is really a function, not a macro: + +#undef getchar + +int getchar(void) { ... } +Formal parameters are not replaced within quoted strings. If, however, a parameter name is preceded by a #in the replacement text, the combination will be expanded into a quoted string with the parameter replaced by the actual argument. This can be combined with string concatenation to make, for example, a debugging print macro: + +#define dprint(expr) printf(#expr " = %g\n", expr) When this is invoked, as in + +dprint(x/y) +the macro is expanded into + +printf("x/y" " = &g\n", x/y); +and the strings are concatenated, so the effect is + +printf("x/y = &g\n", x/y); +Within the actual argument, each "is replaced by \"and each \by \\, so the result is a legal string constant. +The preprocessor operator ##provides a way to concatenate actual arguments during macro expansion. If a parameter in the replacement text is adjacent to a ##, the parameter is replaced by the actual argument, the ##and surrounding white space are removed, and the result is re-scanned. For example, the macro paste concatenates its two arguments: + +#define paste(front, back) front ## back so paste(name, 1) creates the token name1. +The rules for nested uses of ## are arcane; further details may be found in Appendix A. + +Exercise 4-14. Define a macro swap(t,x,y) that interchanges two arguments of type t. (Block structure will help.) +77 + +4.11.3 Conditional Inclusion +It is possible to control preprocessing itself with conditional statements that are evaluated during preprocessing. This provides a way to include code selectively, depending on the value of conditions evaluated during compilation. +The #ifline evaluates a constant integer expression (which may not include sizeof, casts, or enumconstants). If the expression is non-zero, subsequent lines until an #endifor #elifor #else are included. (The preprocessor statement #elif is like else-if.) The expression defined(name) in a #if is 1 if the name has been defined, and 0 otherwise. + +For example, to make sure that the contents of a file hdr.h are included only once, the contents of the file are surrounded with a conditional like this: + +#if !defined(HDR) #define HDR + +/* contents of hdr.h go here */ + +#endif +The first inclusion of hdr.hdefines the name HDR; subsequent inclusions will find the name defined and skip down to the #endif. A similar style can be used to avoid including files multiple times. If this style is used consistently, then each header can itself include any other headers on which it depends, without the user of the header having to deal with the interdependence. +This sequence tests the name SYSTEM to decide which version of a header to include: + +#if SYSTEM == SYSV #define HDR "sysv.h" +#elif SYSTEM == BSD #define HDR "bsd.h" +#elif SYSTEM == MSDOS #define HDR "msdos.h" +#else +#define HDR "default.h" #endif +#include HDR +The #ifdefand #ifndeflines are specialized forms that test whether a name is defined. The first example of #if above could have been written + +#ifndef HDR #define HDR + +/* contents of hdr.h go here */ + +#endif +78 + + +Chapter 5 - Pointers and Arrays +A pointer is a variable that contains the address of a variable. Pointers are much used in C, partly because they are sometimes the only way to express a computation, and partly because they usually lead to more compact and efficient code than can be obtained in other ways. Pointers and arrays are closely related; this chapter also explores this relationship and shows how to exploit it. +Pointers have been lumped with the gotostatement as a marvelous way to create impossible-to-understand programs. This is certainly true when they are used carelessly, and it is easy to create pointers that point somewhere unexpected. With discipline, however, pointers can also be used to achieve clarity and simplicity. This is the aspect that we will try to illustrate. + +The main change in ANSI C is to make explicit the rules about how pointers can be manipulated, in effect mandating what good programmers already practice and good compilers already enforce. In addition, the type void *(pointer to void) replaces char *as the proper type for a generic pointer. + +5.1 Pointers and Addresses +Let us begin with a simplified picture of how memory is organized. A typical machine has an array of consecutively numbered or addressed memory cells that may be manipulated individually or in contiguous groups. One common situation is that any byte can be a char, a pair of one-byte cells can be treated as a short integer, and four adjacent bytes form a long. A pointer is a group of cells (often two or four) that can hold an address. So if cis a charand p is a pointer that points to it, we could represent the situation this way: + + + + + + + + +The unary operator & gives the address of an object, so the statement + +p = &c; +assigns the address of cto the variable p, and pis said to ``point to'' c. The &operator only applies to objects in memory: variables and array elements. It cannot be applied to expressions, constants, or register variables. +The unary operator *is the indirection or dereferencing operator; when applied to a pointer, it accesses the object the pointer points to. Suppose that xand yare integers and ipis a pointer to int. This artificial sequence shows how to declare a pointer and how to use & and *: + +int x = 1, y = 2, z[10]; +int *ip; /* ip is a pointer to int */ + +ip = &x; /* ip now points to x */ y = *ip; /* y is now 1 */ +*ip = 0; /* x is now 0 */ +ip = &z[0]; /* ip now points to z[0] */ +The declaration of x, y, and z are what we've seen all along. The declaration of the pointer ip, + +int *ip; +79 + +is intended as a mnemonic; it says that the expression *ip is an int. The syntax of the declaration for a variable mimics the syntax of expressions in which the variable might appear. This reasoning applies to function declarations as well. For example, + +double *dp, atof(char *); +says that in an expression *dpand atof(s)have values of double, and that the argument of atof is a pointer to char. +You should also note the implication that a pointer is constrained to point to a particular kind of object: every pointer points to a specific data type. (There is one exception: a ``pointer to void'' is used to hold any type of pointer but cannot be dereferenced itself. We'll come back to it in Section 5.11.) + +If ip points to the integer x, then *ip can occur in any context where x could, so + +*ip = *ip + 10; increments *ip by 10. +The unary operators * and & bind more tightly than arithmetic operators, so the assignment + +y = *ip + 1 +takes whatever ip points at, adds 1, and assigns the result to y, while + +*ip += 1 +increments what ip points to, as do + +++*ip and + +(*ip)++ +The parentheses are necessary in this last example; without them, the expression would increment ipinstead of what it points to, because unary operators like *and ++associate right to left. +Finally, since pointers are variables, they can be used without dereferencing. For example, if iq is another pointer to int, + +iq = ip +copies the contents of ip into iq, thus making iq point to whatever ip pointed to. +5.2 Pointers and Function Arguments +Since C passes arguments to functions by value, there is no direct way for the called function to alter a variable in the calling function. For instance, a sorting routine might exchange two out-of-order arguments with a function called swap. It is not enough to write + +swap(a, b); +where the swap function is defined as + +void swap(int x, int y) /* WRONG */ { +int temp; + +temp = x; x = y; +y = temp; } +Because of call by value, swapcan't affect the arguments aand bin the routine that called it. The function above swaps copies of a and b. +80 + +The way to obtain the desired effect is for the calling program to pass pointers to the values to be changed: + +swap(&a, &b); +Since the operator &produces the address of a variable, &ais a pointer to a. In swapitself, the parameters are declared as pointers, and the operands are accessed indirectly through them. + +void swap(int *px, int *py) /* interchange *px and *py */ { +int temp; + +temp = *px; *px = *py; *py = temp; +} Pictorially: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Pointer arguments enable a function to access and change objects in the function that called it. As an example, consider a function getint that performs free-format input conversion by breaking a stream of characters into integer values, one integer per call. getinthas to return the value it found and also signal end of file when there is no more input. These values have to be passed back by separate paths, for no matter what value is used for EOF, that could also be the value of an input integer. + +One solution is to have getintreturn the end of file status as its function value, while using a pointer argument to store the converted integer back in the calling function. This is the scheme used by scanf as well; see Section 7.4. + +The following loop fills an array with integers by calls to getint: +81 + +int n, array[SIZE], getint(int *); + +for (n = 0; n < SIZE && getint(&array[n]) != EOF; n++) ; +Each call sets array[n]to the next integer found in the input and increments n. Notice that it is essential to pass the address of array[n]to getint. Otherwise there is no way for getint to communicate the converted integer back to the caller. +Our version of getintreturns EOFfor end of file, zero if the next input is not a number, and a positive value if the input contains a valid number. + +#include + +int getch(void); void ungetch(int); + +/* getint: get next integer from input into *pn */ int getint(int *pn) +{ +int c, sign; + +while (isspace(c = getch())) /* skip white space */ ; +if (!isdigit(c) && c != EOF && c != '+' && c != '-') { ungetch(c); /* it is not a number */ +return 0; } +sign = (c == '-') ? -1 : 1; if (c == '+' || c == '-') +c = getch(); +for (*pn = 0; isdigit(c), c = getch()) *pn = 10 * *pn + (c - '0'); +*pn *= sign; if (c != EOF) +ungetch(c); return c; +} +Throughout getint, *pnis used as an ordinary intvariable. We have also used getchand ungetch(described in Section 4.3) so the one extra character that must be read can be pushed back onto the input. +Exercise 5-1. As written, getint treats a + or - not followed by a digit as a valid representation of zero. Fix it to push such a character back on the input. + +Exercise 5-2. Write getfloat, the floating-point analog of getint. What type does getfloat return as its function value? + +5.3 Pointers and Arrays +In C, there is a strong relationship between pointers and arrays, strong enough that pointers and arrays should be discussed simultaneously. Any operation that can be achieved by array subscripting can also be done with pointers. The pointer version will in general be faster but, at least to the uninitiated, somewhat harder to understand. +The declaration + +int a[10]; +defines an array of size 10, that is, a block of 10 consecutive objects named a[0], a[1], ...,a[9]. +82 + + + + + + + + + + +The notation a[i] refers to the i-th element of the array. If pa is a pointer to an integer, declared as + +int *pa; +then the assignment + +pa = &a[0]; +sets pa to point to element zero of a; that is, pa contains the address of a[0]. + + + + + + + + + + + + + + +Now the assignment + +x = *pa; +will copy the contents of a[0] into x. +If pa points to a particular element of an array, then by definition pa+1 points to the next element, pa+i points i elements after pa, and pa-i points i elements before. Thus, if pa points to a[0], + +*(pa+1) +refers to the contents of a[1], pa+iis the address of a[i], and *(pa+i)is the contents of a[i]. +83 + +These remarks are true regardless of the type or size of the variables in the array a. The meaning of ``adding 1 to a pointer,'' and by extension, all pointer arithmetic, is that pa+1points to the next object, and pa+i points to the i-th object beyond pa. + +The correspondence between indexing and pointer arithmetic is very close. By definition, the value of a variable or expression of type array is the address of element zero of the array. Thus after the assignment + +pa = &a[0]; +paand ahave identical values. Since the name of an array is a synonym for the location of the initial element, the assignment pa=&a[0] can also be written as + +pa = a; +Rather more surprising, at first sight, is the fact that a reference to a[i]can also be written as *(a+i). In evaluating a[i], C converts it to *(a+i) immediately; the two forms are equivalent. Applying the operator &to both parts of this equivalence, it follows that &a[i]and a+iare also identical: a+iis the address of the i-th element beyond a. As the other side of this coin, if pa is a pointer, expressions might use it with a subscript; pa[i] is identical to *(pa+i). In short, an array-and-index expression is equivalent to one written as a pointer and offset. +There is one difference between an array name and a pointer that must be kept in mind. A pointer is a variable, so pa=a and pa++ are legal. But an array name is not a variable; constructions like a=pa and a++ are illegal. + +When an array name is passed to a function, what is passed is the location of the initial element. Within the called function, this argument is a local variable, and so an array name parameter is a pointer, that is, a variable containing an address. We can use this fact to write another version of strlen, which computes the length of a string. + +/* strlen: return length of string s */ int strlen(char *s) +{ +int n; + +for (n = 0; *s != '\0', s++) n++; +return n; } +Since sis a pointer, incrementing it is perfectly legal; s++has no effect on the character string in the function that called strlen, but merely increments strlen's private copy of the pointer. That means that calls like + + +strlen("hello, world"); strlen(array); strlen(ptr); +all work. + +/* string constant */ /* char array[100]; */ /* char *ptr; */ + +As formal parameters in a function definition, + +char s[]; and + +char *s; +are equivalent; we prefer the latter because it says more explicitly that the variable is a pointer. When an array name is passed to a function, the function can at its convenience believe that it has been handed either an array or a pointer, and manipulate it accordingly. It can even use both notations if it seems appropriate and clear. +84 + +It is possible to pass part of an array to a function, by passing a pointer to the beginning of the subarray. For example, if a is an array, + +f(&a[2]) and + +f(a+2) +both pass to the function f the address of the subarray that starts at a[2]. Within f, the parameter declaration can read + +f(int arr[]) { ... } or + +f(int *arr) { ... } +So as far as fis concerned, the fact that the parameter refers to part of a larger array is of no consequence. +If one is sure that the elements exist, it is also possible to index backwards in an array; p[-1], p[-2], and so on are syntactically legal, and refer to the elements that immediately precede p[0]. Of course, it is illegal to refer to objects that are not within the array bounds. + +5.4 Address Arithmetic +If p is a pointer to some element of an array, then p++ increments p to point to the next element, and p+=iincrements it to point ielements beyond where it currently does. These and similar constructions are the simples forms of pointer or address arithmetic. +C is consistent and regular in its approach to address arithmetic; its integration of pointers, arrays, and address arithmetic is one of the strengths of the language. Let us illustrate by writing a rudimentary storage allocator. There are two routines. The first, alloc(n), returns a pointer to nconsecutive character positions, which can be used by the caller of alloc for storing characters. The second, afree(p), releases the storage thus acquired so it can be re-used later. The routines are ``rudimentary'' because the calls to afreemust be made in the opposite order to the calls made on alloc. That is, the storage managed by allocand afree is a stack, or last-in, first-out. The standard library provides analogous functions called malloc and free that have no such restrictions; in Section 8.7 we will show how they can be implemented. + +The easiest implementation is to have allochand out pieces of a large character array that we will call allocbuf. This array is private to allocand afree. Since they deal in pointers, not array indices, no other routine need know the name of the array, which can be declared static in the source file containing allocand afree, and thus be invisible outside it. In practical implementations, the array may well not even have a name; it might instead be obtained by calling malloc or by asking the operating system for a pointer to some unnamed block of storage. + +The other information needed is how much of allocbuf has been used. We use a pointer, called allocp, that points to the next free element. When allocis asked for ncharacters, it checks to see if there is enough room left in allocbuf. If so, allocreturns the current value of allocp(i.e., the beginning of the free block), then increments it by nto point to the next free area. If there is no room, allocreturns zero. afree(p)merely sets allocpto pif pis inside allocbuf. +85 + + + + + + + + + + + + + + + + + + +#define ALLOCSIZE 10000 /* size of available space */ + +static char allocbuf[ALLOCSIZE]; /* storage for alloc */ static char *allocp = allocbuf; /* next free position */ + +char *alloc(int n) /* return pointer to n characters */ { +if (allocbuf + ALLOCSIZE - allocp >= n) { /* it fits */ allocp += n; +return allocp - n; /* old p */ } else /* not enough room */ +return 0; } + +void afree(char *p) /* free storage pointed to by p */ { +if (p >= allocbuf && p < allocbuf + ALLOCSIZE) allocp = p; +} +In general a pointer can be initialized just as any other variable can, though normally the only meaningful values are zero or an expression involving the address of previously defined data of appropriate type. The declaration + +static char *allocp = allocbuf; +defines allocp to be a character pointer and initializes it to point to the beginning of allocbuf, which is the next free position when the program starts. This could also have been written + +static char *allocp = &allocbuf[0]; +since the array name is the address of the zeroth element. +The test + +if (allocbuf + ALLOCSIZE - allocp >= n) { /* it fits */ +checks if there's enough room to satisfy a request for ncharacters. If there is, the new value of allocpwould be at most one beyond the end of allocbuf. If the request can be satisfied, allocreturns a pointer to the beginning of a block of characters (notice the declaration of the function itself). If not, allocmust return some signal that there is no space left. C guarantees that zero is never a valid address for data, so a return value of zero can be used to signal an abnormal event, in this case no space. +Pointers and integers are not interchangeable. Zero is the sole exception: the constant zero may be assigned to a pointer, and a pointer may be compared with the constant zero. The symbolic +86 + +constant NULLis often used in place of zero, as a mnemonic to indicate more clearly that this is a special value for a pointer. NULL is defined in . We will use NULL henceforth. + +Tests like + +if (allocbuf + ALLOCSIZE - allocp >= n) { /* it fits */ and + +if (p >= allocbuf && p < allocbuf + ALLOCSIZE) +show several important facets of pointer arithmetic. First, pointers may be compared under certain circumstances. If p and q point to members of the same array, then relations like ==, !=, <, >=, etc., work properly. For example, + +p < q +is true if p points to an earlier element of the array than q does. Any pointer can be meaningfully compared for equality or inequality with zero. But the behavior is undefined for arithmetic or comparisons with pointers that do not point to members of the same array. (There is one exception: the address of the first element past the end of an array can be used in pointer arithmetic.) +Second, we have already observed that a pointer and an integer may be added or subtracted. The construction + +p + n +means the address of the n-th object beyond the one p currently points to. This is true regardless of the kind of object ppoints to; nis scaled according to the size of the objects p points to, which is determined by the declaration of p. If an intis four bytes, for example, the int will be scaled by four. +Pointer subtraction is also valid: if pand qpoint to elements of the same array, and p defines a type ptrdiff_t that is large enough to hold the signed difference of two pointer values. If we were being cautious, however, we would use size_tfor the return value of strlen, to match the standard library version. size_t is the unsigned integer type returned by the sizeof operator. +Pointer arithmetic is consistent: if we had been dealing with floats, which occupy more storage that chars, and if pwere a pointer to float, p++would advance to the next float. Thus we could write another version of allocthat maintains floats instead of chars, merely by changing char to float throughout alloc and afree. All the pointer manipulations automatically take into account the size of the objects pointed to. +87 + +The valid pointer operations are assignment of pointers of the same type, adding or subtracting a pointer and an integer, subtracting or comparing two pointers to members of the same array, and assigning or comparing to zero. All other pointer arithmetic is illegal. It is not legal to add two pointers, or to multiply or divide or shift or mask them, or to add floator doubleto them, or even, except for void *, to assign a pointer of one type to a pointer of another type without a cast. + +5.5 Character Pointers and Functions A string constant, written as + +"I am a string" +is an array of characters. In the internal representation, the array is terminated with the null character '\0'so that programs can find the end. The length in storage is thus one more than the number of characters between the double quotes. +Perhaps the most common occurrence of string constants is as arguments to functions, as in + +printf("hello, world\n"); +When a character string like this appears in a program, access to it is through a character pointer; printf receives a pointer to the beginning of the character array. That is, a string constant is accessed by a pointer to its first element. +String constants need not be function arguments. If pmessage is declared as + +char *pmessage; then the statement + +pmessage = "now is the time"; +assigns to pmessagea pointer to the character array. This is not a string copy; only pointers are involved. C does not provide any operators for processing an entire string of characters as a unit. +There is an important difference between these definitions: + +char amessage[] = "now is the time"; /* an array */ char *pmessage = "now is the time"; /* a pointer */ +amessage is an array, just big enough to hold the sequence of characters and '\0' that initializes it. Individual characters within the array may be changed but amessagewill always refer to the same storage. On the other hand, pmessageis a pointer, initialized to point to a string constant; the pointer may subsequently be modified to point elsewhere, but the result is undefined if you try to modify the string contents. + + + + + + + + + + +We will illustrate more aspects of pointers and arrays by studying versions of two useful functions adapted from the standard library. The first function is strcpy(s,t), which copies the string tto the string s. It would be nice just to say s=tbut this copies the pointer, not the characters. To copy the characters, we need a loop. The array version first: +88 + +/* strcpy: copy t to s; array subscript version */ void strcpy(char *s, char *t) +{ +int i; + +i = 0; +while ((s[i] = t[i]) != '\0') i++; +} +For contrast, here is a version of strcpy with pointers: + +/* strcpy: copy t to s; pointer version */ void strcpy(char *s, char *t) +{ +int i; + +i = 0; +while ((*s = *t) != '\0') { s++; +t++; } +} +Because arguments are passed by value, strcpycan use the parameters sand tin any way it pleases. Here they are conveniently initialized pointers, which are marched along the arrays a character at a time, until the '\0' that terminates t has been copied into s. +In practice, strcpywould not be written as we showed it above. Experienced C programmers would prefer + +/* strcpy: copy t to s; pointer version 2 */ void strcpy(char *s, char *t) +{ +while ((*s++ = *t++) != '\0') ; +} +This moves the increment of sand tinto the test part of the loop. The value of *t++is the character that tpointed to before twas incremented; the postfix ++ doesn't change tuntil after this character has been fetched. In the same way, the character is stored into the old s position before sis incremented. This character is also the value that is compared against '\0' to control the loop. The net effect is that characters are copied from tto s, up and including the terminating '\0'. +As the final abbreviation, observe that a comparison against '\0' is redundant, since the question is merely whether the expression is zero. So the function would likely be written as + +/* strcpy: copy t to s; pointer version 3 */ void strcpy(char *s, char *t) +{ +while (*s++ = *t++) ; +} +Although this may seem cryptic at first sight, the notational convenience is considerable, and the idiom should be mastered, because you will see it frequently in C programs. +The strcpy in the standard library () returns the target string as its function value. + +The second routine that we will examine is strcmp(s,t), which compares the character strings sand t, and returns negative, zero or positive if sis lexicographically less than, equal to, or greater than t. The value is obtained by subtracting the characters at the first position where s and t disagree. + +/* strcmp: return <0 if s0 if s>t */ +89 + +int strcmp(char *s, char *t) { +int i; + +for (i = 0; s[i] == t[i]; i++) if (s[i] == '\0') +return 0; return s[i] - t[i]; +} +The pointer version of strcmp: + +/* strcmp: return <0 if s0 if s>t */ int strcmp(char *s, char *t) +{ +for ( ; *s == *t; s++, t++) if (*s == '\0') +return 0; return *s - *t; +} +Since ++and --are either prefix or postfix operators, other combinations of *and ++and --occur, although less frequently. For example, + +*--p +decrements p before fetching the character that p points to. In fact, the pair of expressions + +*p++ = val; /* push val onto stack */ +val = *--p; /* pop top of stack into val */ +are the standard idiom for pushing and popping a stack; see Section 4.3. +The header contains declarations for the functions mentioned in this section, plus a variety of other string-handling functions from the standard library. + +Exercise 5-3. Write a pointer version of the function strcatthat we showed in Chapter 2: strcat(s,t) copies the string t to the end of s. + +Exercise 5-4. Write the function strend(s,t), which returns 1 if the string toccurs at the end of the string s, and zero otherwise. + +Exercise 5-5. Write versions of the library functions strncpy, strncat, and strncmp, which operate on at most the first n characters of their argument strings. For example, strncpy(s,t,n) copies at most n characters of t to s. Full descriptions are in Appendix B. + +Exercise 5-6. Rewrite appropriate programs from earlier chapters and exercises with pointers instead of array indexing. Good possibilities include getline(Chapters 1 and 4), atoi, itoa, and their variants (Chapters 2, 3, and 4), reverse (Chapter 3), and strindex and getop (Chapter 4). + +5.6 Pointer Arrays; Pointers to Pointers +Since pointers are variables themselves, they can be stored in arrays just as other variables can. Let us illustrate by writing a program that will sort a set of text lines into alphabetic order, a stripped-down version of the UNIX program sort. +In Chapter 3, we presented a Shell sort function that would sort an array of integers, and in Chapter 4 we improved on it with a quicksort. The same algorithms will work, except that now we have to deal with lines of text, which are of different lengths, and which, unlike integers, can't be compared or moved in a single operation. We need a data representation that will cope efficiently and conveniently with variable-length text lines. + +This is where the array of pointers enters. If the lines to be sorted are stored end-to-end in one long character array, then each line can be accessed by a pointer to its first character. The +90 + +pointers themselves can bee stored in an array. Two lines can be compared by passing their pointers to strcmp. When two out-of-order lines have to be exchanged, the pointers in the pointer array are exchanged, not the text lines themselves. + + + + + + + + + +This eliminates the twin problems of complicated storage management and high overhead that would go with moving the lines themselves. + +The sorting process has three steps: + +read all the lines of input sort them +print them in order + +As usual, it's best to divide the program into functions that match this natural division, with the main routine controlling the other functions. Let us defer the sorting step for a moment, and concentrate on the data structure and the input and output. + +The input routine has to collect and save the characters of each line, and build an array of pointers to the lines. It will also have to count the number of input lines, since that information is needed for sorting and printing. Since the input function can only cope with a finite number of input lines, it can return some illegal count like -1 if too much input is presented. + +The output routine only has to print the lines in the order in which they appear in the array of pointers. + +#include #include + + +#define MAXLINES 5000 + +char *lineptr[MAXLINES]; + +/* max #lines to be sorted */ + +/* pointers to text lines */ + + +int readlines(char *lineptr[], int nlines); void writelines(char *lineptr[], int nlines); + +void qsort(char *lineptr[], int left, int right); + +/* sort input lines */ main() +{ +int nlines; /* number of input lines read */ + +if ((nlines = readlines(lineptr, MAXLINES)) >= 0) { qsort(lineptr, 0, nlines-1); writelines(lineptr, nlines); +return 0; } else { +printf("error: input too big to sort\n"); return 1; +} } + +#define MAXLEN 1000 /* max length of any input line */ int getline(char *, int); +91 + +char *alloc(int); + +/* readlines: read input lines */ +int readlines(char *lineptr[], int maxlines) { +int len, nlines; +char *p, line[MAXLEN]; + +nlines = 0; +while ((len = getline(line, MAXLEN)) > 0) +if (nlines >= maxlines || p = alloc(len) == NULL) return -1; +else { +line[len-1] = '\0'; /* delete newline */ strcpy(p, line); +lineptr[nlines++] = p; } +return nlines; } + +/* writelines: write output lines */ +void writelines(char *lineptr[], int nlines) { +int i; + +for (i = 0; i < nlines; i++) printf("%s\n", lineptr[i]); +} +The function getline is from Section 1.9. +The main new thing is the declaration for lineptr: + +char *lineptr[MAXLINES] +says that lineptris an array of MAXLINESelements, each element of which is a pointer to a char. That is, lineptr[i]is a character pointer, and *lineptr[i]is the character it points to, the first character of the i-th saved text line. +Since lineptris itself the name of an array, it can be treated as a pointer in the same manner as in our earlier examples, and writelines can be written instead as + +/* writelines: write output lines */ +void writelines(char *lineptr[], int nlines) { +while (nlines-- > 0) printf("%s\n", *lineptr++); +} +Initially, *lineptrpoints to the first line; each element advances it to the next line pointer while nlines is counted down. +With input and output under control, we can proceed to sorting. The quicksort from Chapter 4 needs minor changes: the declarations have to be modified, and the comparison operation must be done by calling strcmp. The algorithm remains the same, which gives us some confidence that it will still work. + +/* qsort: sort v[left]...v[right] into increasing order */ void qsort(char *v[], int left, int right) +{ +int i, last; +void swap(char *v[], int i, int j); + +if (left >= right) /* do nothing if array contains */ return; /* fewer than two elements */ +swap(v, left, (left + right)/2); last = left; +92 + +for (i = left+1; i <= right; i++) if (strcmp(v[i], v[left]) < 0) +swap(v, ++last, i); swap(v, left, last); qsort(v, left, last-1); qsort(v, last+1, right); +} +Similarly, the swap routine needs only trivial changes: + +/* swap: interchange v[i] and v[j] */ void swap(char *v[], int i, int j) +{ +char *temp; + +temp = v[i]; v[i] = v[j]; v[j] = temp; +} +Since any individual element of v(alias lineptr) is a character pointer, tempmust be also, so one can be copied to the other. +Exercise 5-7. Rewrite readlines to store lines in an array supplied by main, rather than calling alloc to maintain storage. How much faster is the program? + +5.7 Multi-dimensional Arrays +C provides rectangular multi-dimensional arrays, although in practice they are much less used than arrays of pointers. In this section, we will show some of their properties. +Consider the problem of date conversion, from day of the month to day of the year and vice versa. For example, March 1 is the 60th day of a non-leap year, and the 61st day of a leap year. Let us define two functions to do the conversions: day_of_yearconverts the month and day into the day of the year, and month_dayconverts the day of the year into the month and day. Since this latter function computes two values, the month and day arguments will be pointers: + +month_day(1988, 60, &m, &d) sets m to 2 and d to 29 (February 29th). +These functions both need the same information, a table of the number of days in each month (``thirty days hath September ...''). Since the number of days per month differs for leap years and non-leap years, it's easier to separate them into two rows of a two-dimensional array than to keep track of what happens to February during computation. The array and the functions for performing the transformations are as follows: + +static char daytab[2][13] = { +{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} +}; + +/* day_of_year: set day of year from month & day */ int day_of_year(int year, int month, int day) +{ +int i, leap; +leap = year%4 == 0 && year%100 != 0 || year%400 == 0; for (i = 1; i < month; i++) +day += daytab[leap][i]; return day; +} + +/* month_day: set month, day from day of year */ +void month_day(int year, int yearday, int *pmonth, int *pday) { +int i, leap; +93 + + +leap = year%4 == 0 && year%100 != 0 || year%400 == 0; for (i = 1; yearday > daytab[leap][i]; i++) +yearday -= daytab[leap][i]; *pmonth = i; +*pday = yearday; } +Recall that the arithmetic value of a logical expression, such as the one for leap, is either zero (false) or one (true), so it can be used as a subscript of the array daytab. +The array daytabhas to be external to both day_of_yearand month_day, so they can both use it. We made it charto illustrate a legitimate use of charfor storing small non-character integers. + +daytabis the first two-dimensional array we have dealt with. In C, a two-dimensional array is really a one-dimensional array, each of whose elements is an array. Hence subscripts are written as + +daytab[i][j] /* [row][col] */ rather than + +daytab[i,j] /* WRONG */ +Other than this notational distinction, a two-dimensional array can be treated in much the same way as in other languages. Elements are stored by rows, so the rightmost subscript, or column, varies fastest as elements are accessed in storage order. +An array is initialized by a list of initializers in braces; each row of a two-dimensional array is initialized by a corresponding sub-list. We started the array daytabwith a column of zero so that month numbers can run from the natural 1 to 12 instead of 0 to 11. Since space is not at a premium here, this is clearer than adjusting the indices. + +If a two-dimensional array is to be passed to a function, the parameter declaration in the function must include the number of columns; the number of rows is irrelevant, since what is passed is, as before, a pointer to an array of rows, where each row is an array of 13 ints. In this particular case, it is a pointer to objects that are arrays of 13 ints. Thus if the array daytab is to be passed to a function f, the declaration of f would be: + +f(int daytab[2][13]) { ... } It could also be + +f(int daytab[][13]) { ... } +since the number of rows is irrelevant, or it could be + +f(int (*daytab)[13]) { ... } +which says that the parameter is a pointer to an array of 13 integers. The parentheses are necessary since brackets [] have higher precedence than *. Without parentheses, the declaration + +int *daytab[13] +is an array of 13 pointers to integers. More generally, only the first dimension (subscript) of an array is free; all the others have to be specified. +Section 5.12 has a further discussion of complicated declarations. + +Exercise 5-8. There is no error checking in day_of_year or month_day. Remedy this defect. + +5.8 Initialization of Pointer Arrays +94 + +Consider the problem of writing a function month_name(n), which returns a pointer to a character string containing the name of the n-th month. This is an ideal application for an internal staticarray. month_namecontains a private array of character strings, and returns a pointer to the proper one when called. This section shows how that array of names is initialized. +The syntax is similar to previous initializations: + +/* month_name: return name of n-th month */ char *month_name(int n) +{ +static char *name[] = { "Illegal month", +"January", "February", "March", "April", "May", "June", +"July", "August", "September", "October", "November", "December" +}; + +return (n < 1 || n > 12) ? name[0] : name[n]; } +The declaration of name, which is an array of character pointers, is the same as lineptrin the sorting example. The initializer is a list of character strings; each is assigned to the corresponding position in the array. The characters of the i-th string are placed somewhere, and a pointer to them is stored in name[i]. Since the size of the array nameis not specified, the compiler counts the initializers and fills in the correct number. +5.9 Pointers vs. Multi-dimensional Arrays +Newcomers to C are sometimes confused about the difference between a two-dimensional array and an array of pointers, such as name in the example above. Given the definitions + +int a[10][20]; int *b[10]; +then a[3][4]and b[3][4]are both syntactically legal references to a single int. But ais a true two-dimensional array: 200 int-sized locations have been set aside, and the conventional rectangular subscript calculation 20 * row +col is used to find the element a[row,col]. For b, however, the definition only allocates 10 pointers and does not initialize them; initialization must be done explicitly, either statically or with code. Assuming that each element of bdoes point to a twenty-element array, then there will be 200 ints set aside, plus ten cells for the pointers. The important advantage of the pointer array is that the rows of the array may be of different lengths. That is, each element of bneed not point to a twenty-element vector; some may point to two elements, some to fifty, and some to none at all. +Although we have phrased this discussion in terms of integers, by far the most frequent use of arrays of pointers is to store character strings of diverse lengths, as in the function month_name. Compare the declaration and picture for an array of pointers: + +char *name[] = { "Illegal month", "Jan", "Feb", "Mar" }; +95 + +with those for a two-dimensional array: + +char aname[][15] = { "Illegal month", "Jan", "Feb", "Mar" }; + + + + + + +Exercise 5-9. Rewrite the routines day_of_year and month_day with pointers instead of indexing. + +5.10 Command-line Arguments +In environments that support C, there is a way to pass command-line arguments or parameters to a program when it begins executing. When mainis called, it is called with two arguments. The first (conventionally called argc, for argument count) is the number of command-line arguments the program was invoked with; the second (argv, for argument vector) is a pointer to an array of character strings that contain the arguments, one per string. We customarily use multiple levels of pointers to manipulate these character strings. +The simplest illustration is the program echo, which echoes its command-line arguments on a single line, separated by blanks. That is, the command + +echo hello, world prints the output + +hello, world +By convention, argv[0]is the name by which the program was invoked, so argcis at least 1. If argcis 1, there are no command-line arguments after the program name. In the example above, argcis 3, and argv[0], argv[1], and argv[2]are "echo", "hello,", and "world" respectively. The first optional argument is argv[1] and the last is argv[argc-1]; additionally, the standard requires that argv[argc] be a null pointer. + + + + + + + + + + + + + +The first version of echo treats argv as an array of character pointers: + +#include + +/* echo command-line arguments; 1st version */ main(int argc, char *argv[]) +{ +int i; + +for (i = 1; i < argc; i++) +printf("%s%s", argv[i], (i < argc-1) ? " " : ""); printf("\n"); +return 0; +96 + +} +Since argvis a pointer to an array of pointers, we can manipulate the pointer rather than index the array. This next variant is based on incrementing argv, which is a pointer to pointer to char, while argc is counted down: + +#include + +/* echo command-line arguments; 2nd version */ main(int argc, char *argv[]) +{ +while (--argc > 0) +printf("%s%s", *++argv, (argc > 1) ? " " : ""); printf("\n"); +return 0; } +Since argvis a pointer to the beginning of the array of argument strings, incrementing it by 1 (++argv) makes it point at the original argv[1] instead of argv[0]. Each successive increment moves it along to the next argument; *argvis then the pointer to that argument. At the same time, argc is decremented; when it becomes zero, there are no arguments left to print. +Alternatively, we could write the printf statement as + +printf((argc > 1) ? "%s " : "%s", *++argv); +This shows that the format argument of printf can be an expression too. +As a second example, let us make some enhancements to the pattern-finding program from Section 4.1. If you recall, we wired the search pattern deep into the program, an obviously unsatisfactory arrangement. Following the lead of the UNIX program grep, let us enhance the program so the pattern to be matched is specified by the first argument on the command line. + +#include #include #define MAXLINE 1000 + +int getline(char *line, int max); + +/* find: print lines that match pattern from 1st arg */ main(int argc, char *argv[]) +{ +char line[MAXLINE]; int found = 0; + +if (argc != 2) +printf("Usage: find pattern\n"); else +while (getline(line, MAXLINE) > 0) +if (strstr(line, argv[1]) != NULL) { printf("%s", line); +found++; } +return found; } +The standard library function strstr(s,t) returns a pointer to the first occurrence of the string t in the string s, or NULL if there is none. It is declared in . +The model can now be elaborated to illustrate further pointer constructions. Suppose we want to allow two optional arguments. One says ``print all the lines except those that match the pattern;'' the second says ``precede each printed line by its line number.'' +97 + +A common convention for C programs on UNIX systems is that an argument that begins with a minus sign introduces an optional flag or parameter. If we choose -x(for ``except'') to signal the inversion, and -n (``number'') to request line numbering, then the command + +find -x -npattern +will print each line that doesn't match the pattern, preceded by its line number. +Optional arguments should be permitted in any order, and the rest of the program should be independent of the number of arguments that we present. Furthermore, it is convenient for users if option arguments can be combined, as in + +find -nx pattern Here is the program: + +#include #include #define MAXLINE 1000 + +int getline(char *line, int max); + +/* find: print lines that match pattern from 1st arg */ main(int argc, char *argv[]) +{ +char line[MAXLINE]; long lineno = 0; +int c, except = 0, number = 0, found = 0; + +while (--argc > 0 && (*++argv)[0] == '-') while (c = *++argv[0]) +switch (c) { case 'x': +except = 1; break; +case 'n': number = 1; break; +default: +printf("find: illegal option %c\n", c); argc = 0; +found = -1; break; +} +if (argc != 1) +printf("Usage: find -x -n pattern\n"); else +while (getline(line, MAXLINE) > 0) { lineno++; +if ((strstr(line, *argv) != NULL) != except) { if (number) +printf("%ld:", lineno); printf("%s", line); found++; +} } +return found; } +argcis decremented and argvis incremented before each optional argument. At the end of the loop, if there are no errors, argc tells how many arguments remain unprocessed and argv points to the first of these. Thus argc should be 1 and *argv should point at the pattern. Notice that *++argvis a pointer to an argument string, so (*++argv)[0]is its first character. (An alternate valid form would be **++argv.) Because [] binds tighter than *and ++, the parentheses are necessary; without them the expression would be taken as *++(argv[0]). In +98 + +fact, that is what we have used in the inner loop, where the task is to walk along a specific argument string. In the inner loop, the expression *++argv[0] increments the pointer argv[0]! +It is rare that one uses pointer expressions more complicated than these; in such cases, breaking them into two or three steps will be more intuitive. + +Exercise 5-10. Write the program expr, which evaluates a reverse Polish expression from the command line, where each operator or operand is a separate argument. For example, + +expr 2 3 4 + * evaluates 2 * (3+4). +Exercise 5-11. Modify the program entaband detab(written as exercises in Chapter 1) to accept a list of tab stops as arguments. Use the default tab settings if there are no arguments. + +Exercise 5-12. Extend entab and detab to accept the shorthand + +entab -m +n +to mean tab stops every n columns, starting at column m. Choose convenient (for the user) default behavior. +Exercise 5-13. Write the program tail, which prints the last n lines of its input. By default, n is set to 10, let us say, but it can be changed by an optional argument so that + +tail -n +prints the last n lines. The program should behave rationally no matter how unreasonable the input or the value of n. Write the program so it makes the best use of available storage; lines should be stored as in the sorting program of Section 5.6, not in a two-dimensional array of fixed size. +5.11 Pointers to Functions +In C, a function itself is not a variable, but it is possible to define pointers to functions, which can be assigned, placed in arrays, passed to functions, returned by functions, and so on. We will illustrate this by modifying the sorting procedure written earlier in this chapter so that if the optional argument -n is given, it will sort the input lines numerically instead of lexicographically. +A sort often consists of three parts - a comparison that determines the ordering of any pair of objects, an exchange that reverses their order, and a sorting algorithm that makes comparisons and exchanges until the objects are in order. The sorting algorithm is independent of the comparison and exchange operations, so by passing different comparison and exchange functions to it, we can arrange to sort by different criteria. This is the approach taken in our new sort. + +Lexicographic comparison of two lines is done by strcmp, as before; we will also need a routine numcmpthat compares two lines on the basis of numeric value and returns the same kind of condition indication as strcmpdoes. These functions are declared ahead of mainand a pointer to the appropriate one is passed to qsort. We have skimped on error processing for arguments, so as to concentrate on the main issues. + +#include #include + + +#define MAXLINES 5000 char *lineptr[MAXLINES]; + +/* max #lines to be sorted */ /* pointers to text lines */ +99 + +int readlines(char *lineptr[], int nlines); void writelines(char *lineptr[], int nlines); + +void qsort(void *lineptr[], int left, int right, int (*comp)(void *, void *)); +int numcmp(char *, char *); + +/* sort input lines */ main(int argc, char *argv[]) { +int nlines; /* number of input lines read */ int numeric = 0; /* 1 if numeric sort */ + +if (argc > 1 && strcmp(argv[1], "-n") == 0) numeric = 1; +if ((nlines = readlines(lineptr, MAXLINES)) >= 0) { qsort((void**) lineptr, 0, nlines-1, +(int (*)(void*,void*))(numeric ? numcmp : strcmp)); writelines(lineptr, nlines); +return 0; } else { +printf("input too big to sort\n"); return 1; +} } +In the call to qsort, strcmpand numcmpare addresses of functions. Since they are known to be functions, the & is not necessary, in the same way that it is not needed before an array name. +We have written qsortso it can process any data type, not just character strings. As indicated by the function prototype, qsortexpects an array of pointers, two integers, and a function with two pointer arguments. The generic pointer type void * is used for the pointer arguments. Any pointer can be cast to void *and back again without loss of information, so we can call qsort by casting arguments to void *. The elaborate cast of the function argument casts the arguments of the comparison function. These will generally have no effect on actual representation, but assure the compiler that all is well. + +/* qsort: sort v[left]...v[right] into increasing order */ void qsort(void *v[], int left, int right, +int (*comp)(void *, void *)) { +int i, last; + +void swap(void *v[], int, int); + +if (left >= right) /* do nothing if array contains */ return; /* fewer than two elements */ +swap(v, left, (left + right)/2); last = left; +for (i = left+1; i <= right; i++) if ((*comp)(v[i], v[left]) < 0) +swap(v, ++last, i); swap(v, left, last); qsort(v, left, last-1, comp); +qsort(v, last+1, right, comp); } +The declarations should be studied with some care. The fourth parameter of qsort is + +int (*comp)(void *, void *) +which says that compis a pointer to a function that has two void *arguments and returns an int. +The use of comp in the line + +if ((*comp)(v[i], v[left]) < 0) +100 + +is consistent with the declaration: comp is a pointer to a function, *comp is the function, and + +(*comp)(v[i], v[left]) +is the call to it. The parentheses are needed so the components are correctly associated; without them, + +int *comp(void *, void *) /* WRONG */ +says that comp is a function returning a pointer to an int, which is very different. +We have already shown strcmp, which compares two strings. Here is numcmp, which compares two strings on a leading numeric value, computed by calling atof: + +#include + +/* numcmp: compare s1 and s2 numerically */ int numcmp(char *s1, char *s2) +{ +double v1, v2; + +v1 = atof(s1); v2 = atof(s2); if (v1 < v2) +return -1; else if (v1 > v2) +return 1; else +return 0; } +The swapfunction, which exchanges two pointers, is identical to what we presented earlier in the chapter, except that the declarations are changed to void *. + +void swap(void *v[], int i, int j;) { +void *temp; + +temp = v[i]; v[i] = v[j]; v[j] = temp; +} +A variety of other options can be added to the sorting program; some make challenging exercises. +Exercise 5-14. Modify the sort program to handle a -rflag, which indicates sorting in reverse (decreasing) order. Be sure that -r works with -n. + +Exercise 5-15. Add the option -f to fold upper and lower case together, so that case distinctions are not made during sorting; for example, a and A compare equal. + +Exercise 5-16. Add the -d (``directory order'') option, which makes comparisons only on letters, numbers and blanks. Make sure it works in conjunction with -f. + +Exercise 5-17. Add a field-searching capability, so sorting may bee done on fields within lines, each field sorted according to an independent set of options. (The index for this book was sorted with -df for the index category and -n for the page numbers.) + +5.12 Complicated Declarations +C is sometimes castigated for the syntax of its declarations, particularly ones that involve pointers to functions. The syntax is an attempt to make the declaration and the use agree; it works well for simple cases, but it can be confusing for the harder ones, because declarations cannot be read left to right, and because parentheses are over-used. The difference between +101 + + +int *f(); /* f: function returning pointer to int */ and + +int (*pf)(); /* pf: pointer to function returning int */ +illustrates the problem: * is a prefix operator and it has lower precedence than (), so parentheses are necessary to force the proper association. +Although truly complicated declarations rarely arise in practice, it is important to know how to understand them, and, if necessary, how to create them. One good way to synthesize declarations is in small steps with typedef, which is discussed in Section 6.7. As an alternative, in this section we will present a pair of programs that convert from valid C to a word description and back again. The word description reads left to right. + +The first, dcl, is the more complex. It converts a C declaration into a word description, as in these examples: + +char **argv +argv: pointer to char int (*daytab)[13] +daytab: pointer to array[13] of int int *daytab[13] +daytab: array[13] of pointer to int void *comp() +comp: function returning pointer to void void (*comp)() +comp: pointer to function returning void char (*(*x())[])() +x: function returning pointer to array[] of pointer to function returning char +char (*(*x[3])())[5] +x: array[3] of pointer to function returning pointer to array[5] of char +dcl is based on the grammar that specifies a declarator, which is spelled out precisely in Appendix A, Section 8.5; this is a simplified form: + + +dcl: optional *'s direct-dcl direct-dcl name +(dcl) direct-dcl() +direct-dcl[optional size] + +In words, a dcl is a direct-dcl, perhaps preceded by *'s. A direct-dcl is a name, or a parenthesized dcl, or a direct-dcl followed by parentheses, or a direct-dcl followed by brackets with an optional size. +This grammar can be used to parse functions. For instance, consider this declarator: + +(*pfa[])() +pfawill be identified as a name and thus as a direct-dcl. Then pfa[]is also a direct-dcl. Then *pfa[]is recognized as a dcl, so (*pfa[])is a direct-dcl. Then (*pfa[])()is a direct-dcl and thus a dcl. We can also illustrate the parse with a tree like this (where direct-dcl has been abbreviated to dir-dcl): +102 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The heart of the dclprogram is a pair of functions, dcland dirdcl, that parse a declaration according to this grammar. Because the grammar is recursively defined, the functions call each other recursively as they recognize pieces of a declaration; the program is called a recursive-descent parser. + +/* dcl: parse a declarator */ void dcl(void) +{ +int ns; + +for (ns = 0; gettoken() == '*'; ) /* count *'s */ ns++; +dirdcl(); +while (ns-- > 0) +strcat(out, " pointer to"); } + +/* dirdcl: parse a direct declarator */ void dirdcl(void) +{ +int type; + +if (tokentype == '(') { /* ( dcl ) */ dcl(); +if (tokentype != ')') printf("error: missing )\n"); +} else if (tokentype == NAME) /* variable name */ strcpy(name, token); +else +printf("error: expected name or (dcl)\n"); +while ((type=gettoken()) == PARENS || type == BRACKETS) +103 + +if (type == PARENS) +strcat(out, " function returning"); else { +strcat(out, " array"); strcat(out, token); strcat(out, " of"); +} } +Since the programs are intended to be illustrative, not bullet-proof, there are significant restrictions on dcl. It can only handle a simple data type line charor int. It does not handle argument types in functions, or qualifiers like const. Spurious blanks confuse it. It doesn't do much error recovery, so invalid declarations will also confuse it. These improvements are left as exercises. +Here are the global variables and the main routine: + +#include #include #include + +#define MAXTOKEN 100 + +enum { NAME, PARENS, BRACKETS }; + +void dcl(void); void dirdcl(void); + +int gettoken(void); +int tokentype; /* type of last token */ char token[MAXTOKEN]; /* last token string */ char name[MAXTOKEN]; /* identifier name */ +char datatype[MAXTOKEN]; /* data type = char, int, etc. */ char out[1000]; + +main() /* convert declaration to words */ { +while (gettoken() != EOF) { /* 1st token on line */ strcpy(datatype, token); /* is the datatype */ out[0] = '\0'; +dcl(); /* parse rest of line */ if (tokentype != '\n') +printf("syntax error\n"); +printf("%s: %s %s\n", name, out, datatype); } +return 0; } +The function gettokenskips blanks and tabs, then finds the next token in the input; a ``token'' is a name, a pair of parentheses, a pair of brackets perhaps including a number, or any other single character. + +int gettoken(void) /* return next token */ { +int c, getch(void); void ungetch(int); char *p = token; + +while ((c = getch()) == ' ' || c == '\t') ; +if (c == '(') { +if ((c = getch()) == ')') { strcpy(token, "()"); return tokentype = PARENS; +} else { ungetch(c); +return tokentype = '('; +104 + +} +} else if (c == '[') { +for (*p++ = c; (*p++ = getch()) != ']'; ) ; +*p = '\0'; +return tokentype = BRACKETS; } else if (isalpha(c)) { +for (*p++ = c; isalnum(c = getch()); ) *p++ = c; +*p = '\0'; ungetch(c); +return tokentype = NAME; } else +return tokentype = c; + +} +getch and ungetch are discussed in Chapter 4. +Going in the other direction is easier, especially if we do not worry about generating redundant parentheses. The program undclconverts a word description like ``xis a function returning a pointer to an array of pointers to functions returning char,'' which we will express as + +x () * [] * () char to + +char (*(*x())[])() +The abbreviated input syntax lets us reuse the gettokenfunction. undclalso uses the same external variables as dcl does. + +/* undcl: convert word descriptions to declarations */ main() +{ +int type; +char temp[MAXTOKEN]; + +while (gettoken() != EOF) { strcpy(out, token); +while ((type = gettoken()) != '\n') +if (type == PARENS || type == BRACKETS) strcat(out, token); +else if (type == '*') { sprintf(temp, "(*%s)", out); strcpy(out, temp); +} else if (type == NAME) { sprintf(temp, "%s %s", token, out); strcpy(out, temp); +} else +printf("invalid input at %s\n", token); } +return 0; } +Exercise 5-18. Make dcl recover from input errors. +Exercise 5-19. Modify undcl so that it does not add redundant parentheses to declarations. + +Exercise 5-20. Expand dclto handle declarations with function argument types, qualifiers like const, and so on. +105 + + +Chapter 6 - Structures +A structure is a collection of one or more variables, possibly of different types, grouped together under a single name for convenient handling. (Structures are called ``records'' in some languages, notably Pascal.) Structures help to organize complicated data, particularly in large programs, because they permit a group of related variables to be treated as a unit instead of as separate entities. +One traditional example of a structure is the payroll record: an employee is described by a set of attributes such as name, address, social security number, salary, etc. Some of these in turn could be structures: a name has several components, as does an address and even a salary. Another example, more typical for C, comes from graphics: a point is a pair of coordinate, a rectangle is a pair of points, and so on. + +The main change made by the ANSI standard is to define structure assignment - structures may be copied and assigned to, passed to functions, and returned by functions. This has been supported by most compilers for many years, but the properties are now precisely defined. Automatic structures and arrays may now also be initialized. + +6.1 Basics of Structures +Let us create a few structures suitable for graphics. The basic object is a point, which we will assume has an x coordinate and a y coordinate, both integers. + + + + + + + + + + + + + + +The two components can be placed in a structure declared like this: + +struct point { int x; int y; +}; +The keyword struct introduces a structure declaration, which is a list of declarations enclosed in braces. An optional name called a structure tag may follow the word struct(as with point here). The tag names this kind of structure, and can be used subsequently as a shorthand for the part of the declaration in braces. +The variables named in a structure are called members. A structure member or tag and an ordinary (i.e., non-member) variable can have the same name without conflict, since they can always be distinguished by context. Furthermore, the same member names may occur in different structures, although as a matter of style one would normally use the same names only for closely related objects. + +A structdeclaration defines a type. The right brace that terminates the list of members may be followed by a list of variables, just as for any basic type. That is, +106 + + +struct { ... } x, y, z; is syntactically analogous to + +int x, y, z; +in the sense that each statement declares x, yand zto be variables of the named type and causes space to be set aside for them. +A structure declaration that is not followed by a list of variables reserves no storage; it merely describes a template or shape of a structure. If the declaration is tagged, however, the tag can be used later in definitions of instances of the structure. For example, given the declaration of point above, + +struct point pt; +defines a variable ptwhich is a structure of type struct point. A structure can be initialized by following its definition with a list of initializers, each a constant expression, for the members: + +struct maxpt = { 320, 200 }; +An automatic structure may also be initialized by assignment or by calling a function that returns a structure of the right type. +A member of a particular structure is referred to in an expression by a construction of the form + +structure-name.member + +The structure member operator ``.'' connects the structure name and the member name. To print the coordinates of the point pt, for instance, + +printf("%d,%d", pt.x, pt.y); +or to compute the distance from the origin (0,0) to pt, + +double dist, sqrt(double); + +dist = sqrt((double)pt.x * pt.x + (double)pt.y * pt.y); +Structures can be nested. One representation of a rectangle is a pair of points that denote the diagonally opposite corners: + + + + + + + + + + + + + +struct rect { +struct point pt1; struct point pt2; +}; +The rect structure contains two point structures. If we declare screen as + +struct rect screen; then + +screen.pt1.x +107 + +refers to the x coordinate of the pt1 member of screen. 6.2 Structures and Functions +The only legal operations on a structure are copying it or assigning to it as a unit, taking its address with &, and accessing its members. Copy and assignment include passing arguments to functions and returning values from functions as well. Structures may not be compared. A structure may be initialized by a list of constant member values; an automatic structure may also be initialized by an assignment. +Let us investigate structures by writing some functions to manipulate points and rectangles. There are at least three possible approaches: pass components separately, pass an entire structure, or pass a pointer to it. Each has its good points and bad points. + +The first function, makepoint, will take two integers and return a point structure: + +/* makepoint: make a point from x and y components */ struct point makepoint(int x, int y) +{ +struct point temp; + +temp.x = x; temp.y = y; return temp; +} +Notice that there is no conflict between the argument name and the member with the same name; indeed the re-use of the names stresses the relationship. +makepoint can now be used to initialize any structure dynamically, or to provide structure arguments to a function: + +struct rect screen; struct point middle; +struct point makepoint(int, int); + +screen.pt1 = makepoint(0,0); screen.pt2 = makepoint(XMAX, YMAX); +middle = makepoint((screen.pt1.x + screen.pt2.x)/2, (screen.pt1.y + screen.pt2.y)/2); +The next step is a set of functions to do arithmetic on points. For instance, + +/* addpoints: add two points */ +struct addpoint(struct point p1, struct point p2) { +p1.x += p2.x; p1.y += p2.y; return p1; +} +Here both the arguments and the return value are structures. We incremented the components in p1rather than using an explicit temporary variable to emphasize that structure parameters are passed by value like any others. +As another example, the function ptinrecttests whether a point is inside a rectangle, where we have adopted the convention that a rectangle includes its left and bottom sides but not its top and right sides: + +/* ptinrect: return 1 if p in r, 0 if not */ int ptinrect(struct point p, struct rect r) { +return p.x >= r.pt1.x && p.x < r.pt2.x && p.y >= r.pt1.y && p.y < r.pt2.y; +} +108 + +This assumes that the rectangle is presented in a standard form where the pt1coordinates are less than the pt2coordinates. The following function returns a rectangle guaranteed to be in canonical form: + +#define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) + +/* canonrect: canonicalize coordinates of rectangle */ struct rect canonrect(struct rect r) +{ +struct rect temp; + +temp.pt1.x = min(r.pt1.x, r.pt2.x); temp.pt1.y = min(r.pt1.y, r.pt2.y); temp.pt2.x = max(r.pt1.x, r.pt2.x); temp.pt2.y = max(r.pt1.y, r.pt2.y); return temp; +} +If a large structure is to be passed to a function, it is generally more efficient to pass a pointer than to copy the whole structure. Structure pointers are just like pointers to ordinary variables. The declaration + +struct point *pp; +says that pp is a pointer to a structure of type struct point. If pp points to a point structure, *ppis the structure, and (*pp).xand (*pp).yare the members. To use pp, we might write, for example, + +struct point origin, *pp; + +pp = &origin; +printf("origin is (%d,%d)\n", (*pp).x, (*pp).y); +The parentheses are necessary in (*pp).x because the precedence of the structure member operator . is higher then *. The expression *pp.x means *(pp.x), which is illegal here because x is not a pointer. +Pointers to structures are so frequently used that an alternative notation is provided as a shorthand. If p is a pointer to a structure, then + +p->member-of-structure +refers to the particular member. So we could write instead + +printf("origin is (%d,%d)\n", pp->x, pp->y); Both . and -> associate from left to right, so if we have + +struct rect r, *rp = &r; +then these four expressions are equivalent: + +r.pt1.x rp->pt1.x (r.pt1).x +(rp->pt1).x +The structure operators .and ->, together with ()for function calls and []for subscripts, are at the top of the precedence hierarchy and thus bind very tightly. For example, given the declaration + +struct { int len; +char *str; } *p; +then +109 + +++p->len +increments len, not p, because the implied parenthesization is ++(p->len). Parentheses can be used to alter binding: (++p)->len increments p before accessing len, and (p++)->len increments p afterward. (This last set of parentheses is unnecessary.) +In the same way, *p->strfetches whatever strpoints to; *p->str++increments strafter accessing whatever it points to (just like *s++); (*p->str)++increments whatever strpoints to; and *p++->str increments p after accessing whatever str points to. + +6.3 Arrays of Structures +Consider writing a program to count the occurrences of each C keyword. We need an array of character strings to hold the names, and an array of integers for the counts. One possibility is to use two parallel arrays, keyword and keycount, as in + +char *keyword[NKEYS]; int keycount[NKEYS]; +But the very fact that the arrays are parallel suggests a different organization, an array of structures. Each keyword is a pair: + +char *word; int cout; +and there is an array of pairs. The structure declaration + +struct key { char *word; int count; +} keytab[NKEYS]; +declares a structure type key, defines an array keytabof structures of this type, and sets aside storage for them. Each element of the array is a structure. This could also be written + +struct key { char *word; int count; +}; + +struct key keytab[NKEYS]; +Since the structure keytabcontains a constant set of names, it is easiest to make it an external variable and initialize it once and for all when it is defined. The structure initialization is analogous to earlier ones - the definition is followed by a list of initializers enclosed in braces: + +struct key { char *word; int count; +} keytab[] = { "auto", 0, "break", 0, "case", 0, "char", 0, "const", 0, "continue", 0, "default", 0, /* ... */ "unsigned", 0, "void", 0, "volatile", 0, "while", 0 +}; +The initializers are listed in pairs corresponding to the structure members. It would be more precise to enclose the initializers for each "row" or structure in braces, as in + +{ "auto", 0 }, +110 + +{ "break", 0 }, { "case", 0 }, ... +but inner braces are not necessary when the initializers are simple variables or character strings, and when all are present. As usual, the number of entries in the array keytabwill be computed if the initializers are present and the [] is left empty. +The keyword counting program begins with the definition of keytab. The main routine reads the input by repeatedly calling a function getwordthat fetches one word at a time. Each word is looked up in keytabwith a version of the binary search function that we wrote in Chapter 3. The list of keywords must be sorted in increasing order in the table. + +#include #include #include + +#define MAXWORD 100 + +int getword(char *, int); +int binsearch(char *, struct key *, int); + +/* count C keywords */ main() +{ +int n; +char word[MAXWORD]; + +while (getword(word, MAXWORD) != EOF) if (isalpha(word[0])) +if ((n = binsearch(word, keytab, NKEYS)) >= 0) keytab[n].count++; +for (n = 0; n < NKEYS; n++) if (keytab[n].count > 0) +printf("%4d %s\n", +keytab[n].count, keytab[n].word); return 0; +} + +/* binsearch: find word in tab[0]...tab[n-1] */ int binsearch(char *word, struct key tab[], int n) { +int cond; +int low, high, mid; + +low = 0; +high = n - 1; +while (low <= high) { mid = (low+high) / 2; +if ((cond = strcmp(word, tab[mid].word)) < 0) high = mid - 1; +else if (cond > 0) low = mid + 1; +else +return mid; } +return -1; } +We will show the function getwordin a moment; for now it suffices to say that each call to getword finds a word, which is copied into the array named as its first argument. +The quantity NKEYSis the number of keywords in keytab. Although we could count this by hand, it's a lot easier and safer to do it by machine, especially if the list is subject to change. One possibility would be to terminate the list of initializers with a null pointer, then loop along keytab until the end is found. +111 + +But this is more than is needed, since the size of the array is completely determined at compile time. The size of the array is the size of one entry times the number of entries, so the number of entries is just + +size of keytab / size of struct key + +C provides a compile-time unary operator called sizeofthat can be used to compute the size of any object. The expressions + +sizeof object and + +sizeof (type name) +yield an integer equal to the size of the specified object or type in bytes. (Strictly, sizeof produces an unsigned integer value whose type, size_t, is defined in the header .) An object can be a variable or array or structure. A type name can be the name of a basic type like int or double, or a derived type like a structure or a pointer. +In our case, the number of keywords is the size of the array divided by the size of one element. This computation is used in a #define statement to set the value of NKEYS: + +#define NKEYS (sizeof keytab / sizeof(struct key)) +Another way to write this is to divide the array size by the size of a specific element: + +#define NKEYS (sizeof keytab / sizeof(keytab[0])) +This has the advantage that it does not need to be changed if the type changes. +A sizeofcan not be used in a #ifline, because the preprocessor does not parse type names. But the expression in the #defineis not evaluated by the preprocessor, so the code here is legal. + +Now for the function getword. We have written a more general getwordthan is necessary for this program, but it is not complicated. getword fetches the next ``word'' from the input, where a word is either a string of letters and digits beginning with a letter, or a single non-white space character. The function value is the first character of the word, or EOFfor end of file, or the character itself if it is not alphabetic. + +/* getword: get next word or character from input */ int getword(char *word, int lim) +{ +int c, getch(void); void ungetch(int); char *w = word; + +while (isspace(c = getch())) ; +if (c != EOF) *w++ = c; +if (!isalpha(c)) { *w = '\0'; return c; +} +for ( ; --lim > 0; w++) +if (!isalnum(*w = getch())) { ungetch(*w); +break; } +*w = '\0'; return word[0]; +} +112 + +getworduses the getchand ungetchthat we wrote in Chapter 4. When the collection of an alphanumeric token stops, getword has gone one character too far. The call to ungetch pushes that character back on the input for the next call. getwordalso uses isspaceto skip whitespace, isalphato identify letters, and isalnumto identify letters and digits; all are from the standard header . +Exercise 6-1. Our version of getworddoes not properly handle underscores, string constants, comments, or preprocessor control lines. Write a better version. + +6.4 Pointers to Structures +To illustrate some of the considerations involved with pointers to and arrays of structures, let us write the keyword-counting program again, this time using pointers instead of array indices. +The external declaration of keytab need not change, but main and binsearch do need modification. + +#include #include #include #define MAXWORD 100 + +int getword(char *, int); +struct key *binsearch(char *, struct key *, int); + +/* count C keywords; pointer version */ main() +{ +char word[MAXWORD]; struct key *p; + +while (getword(word, MAXWORD) != EOF) if (isalpha(word[0])) +if ((p=binsearch(word, keytab, NKEYS)) != NULL) p->count++; +for (p = keytab; p < keytab + NKEYS; p++) if (p->count > 0) +printf("%4d %s\n", p->count, p->word); return 0; +} + +/* binsearch: find word in tab[0]...tab[n-1] */ +struct key *binsearch(char *word, struck key *tab, int n) { +int cond; +struct key *low = &tab[0]; struct key *high = &tab[n]; struct key *mid; + +while (low < high) { +mid = low + (high-low) / 2; +if ((cond = strcmp(word, mid->word)) < 0) high = mid; +else if (cond > 0) low = mid + 1; +else +return mid; } +return NULL; } +There are several things worthy of note here. First, the declaration of binsearchmust indicate that it returns a pointer to struct key instead of an integer; this is declared both in the +113 + +function prototype and in binsearch. If binsearchfinds the word, it returns a pointer to it; if it fails, it returns NULL. +Second, the elements of keytab are now accessed by pointers. This requires significant changes in binsearch. + +The initializers for lowand highare now pointers to the beginning and just past the end of the table. + +The computation of the middle element can no longer be simply + +mid = (low+high) / 2 /* WRONG */ +because the addition of pointers is illegal. Subtraction is legal, however, so high-lowis the number of elements, and thus + +mid = low + (high-low) / 2 +sets mid to the element halfway between low and high. +The most important change is to adjust the algorithm to make sure that it does not generate an illegal pointer or attempt to access an element outside the array. The problem is that &tab[-1] and &tab[n]are both outside the limits of the array tab. The former is strictly illegal, and it is illegal to dereference the latter. The language definition does guarantee, however, that pointer arithmetic that involves the first element beyond the end of an array (that is, &tab[n]) will work correctly. + +In main we wrote + +for (p = keytab; p < keytab + NKEYS; p++) +If pis a pointer to a structure, arithmetic on ptakes into account the size of the structure, so p++increments pby the correct amount to get the next element of the array of structures, and the test stops the loop at the right time. +Don't assume, however, that the size of a structure is the sum of the sizes of its members. Because of alignment requirements for different objects, there may be unnamed ``holes'' in a structure. Thus, for instance, if a char is one byte and an int four bytes, the structure + +struct { char c; int i; +}; +might well require eight bytes, not five. The sizeof operator returns the proper value. +Finally, an aside on program format: when a function returns a complicated type like a structure pointer, as in + +struct key *binsearch(char *word, struct key *tab, int n) +the function name can be hard to see, and to find with a text editor. Accordingly an alternate style is sometimes used: + +struct key * +binsearch(char *word, struct key *tab, int n) +This is a matter of personal taste; pick the form you like and hold to it. +6.5 Self-referential Structures +Suppose we want to handle the more general problem of counting the occurrences of all the words in some input. Since the list of words isn't known in advance, we can't conveniently sort it and use a binary search. Yet we can't do a linear search for each word as it arrives, to see if it's already been seen; the program would take too long. (More precisely, its running time is +114 + +likely to grow quadratically with the number of input words.) How can we organize the data to copy efficiently with a list or arbitrary words? +One solution is to keep the set of words seen so far sorted at all times, by placing each word into its proper position in the order as it arrives. This shouldn't be done by shifting words in a linear array, though - that also takes too long. Instead we will use a data structure called a binary tree. + +The tree contains one ``node'' per distinct word; each node contains + +· A pointer to the text of the word, + +· A count of the number of occurrences, + +· A pointer to the left child node, + +· A pointer to the right child node. +No node may have more than two children; it might have only zero or one. +The nodes are maintained so that at any node the left subtree contains only words that are lexicographically less than the word at the node, and the right subtree contains only words that are greater. This is the tree for the sentence ``now is the time for all good men to come to the aid of their party'', as built by inserting each word as it is encountered: + + + + + + + + + + + + + + + + +To find out whether a new word is already in the tree, start at the root and compare the new word to the word stored at that node. If they match, the question is answered affirmatively. If the new record is less than the tree word, continue searching at the left child, otherwise at the right child. If there is no child in the required direction, the new word is not in the tree, and in fact the empty slot is the proper place to add the new word. This process is recursive, since the search from any node uses a search from one of its children. Accordingly, recursive routines for insertion and printing will be most natural. + +Going back to the description of a node, it is most conveniently represented as a structure with four components: + +struct tnode { /* the tree node: */ +char *word; /* points to the text */ int count; /* number of occurrences */ struct tnode *left; /* left child */ +struct tnode *right; /* right child */ }; +This recursive declaration of a node might look chancy, but it's correct. It is illegal for a structure to contain an instance of itself, but +115 + +struct tnode *left; +declares left to be a pointer to a tnode, not a tnode itself. +Occasionally, one needs a variation of self-referential structures: two structures that refer to each other. The way to handle this is: + +struct t { ... +struct s *p; /* p points to an s */ }; +struct s { ... +struct t *q; /* q points to a t */ }; +The code for the whole program is surprisingly small, given a handful of supporting routines like getwordthat we have already written. The main routine reads words with getwordand installs them in the tree with addtree. + +#include #include #include + +#define MAXWORD 100 +struct tnode *addtree(struct tnode *, char *); void treeprint(struct tnode *); +int getword(char *, int); + +/* word frequency count */ main() +{ +struct tnode *root; char word[MAXWORD]; + +root = NULL; +while (getword(word, MAXWORD) != EOF) if (isalpha(word[0])) +root = addtree(root, word); treeprint(root); +return 0; } +The function addtreeis recursive. A word is presented by mainto the top level (the root) of the tree. At each stage, that word is compared to the word already stored at the node, and is percolated down to either the left or right subtree by a recursive call to adtree. Eventually, the word either matches something already in the tree (in which case the count is incremented), or a null pointer is encountered, indicating that a node must be created and added to the tree. If a new node is created, addtree returns a pointer to it, which is installed in the parent node. + +struct tnode *talloc(void); char *strdup(char *); + +/* addtree: add a node with w, at or below p */ struct treenode *addtree(struct tnode *p, char *w) { +int cond; + +if (p == NULL) { /* a new word has arrived */ p = talloc(); /* make a new node */ +p->word = strdup(w); p->count = 1; +p->left = p->right = NULL; +} else if ((cond = strcmp(w, p->word)) == 0) p->count++; /* repeated word */ +else if (cond < 0) /* less than into left subtree */ p->left = addtree(p->left, w); +116 + +else /* greater than into right subtree */ p->right = addtree(p->right, w); +return p; } +Storage for the new node is fetched by a routine talloc, which returns a pointer to a free space suitable for holding a tree node, and the new word is copied into a hidden space by strdup. (We will discuss these routines in a moment.) The count is initialized, and the two children are made null. This part of the code is executed only at the leaves of the tree, when a new node is being added. We have (unwisely) omitted error checking on the values returned by strdup and talloc. +treeprintprints the tree in sorted order; at each node, it prints the left subtree (all the words less than this word), then the word itself, then the right subtree (all the words greater). If you feel shaky about how recursion works, simulate treeprintas it operates on the tree shown above. + +/* treeprint: in-order print of tree p */ void treeprint(struct tnode *p) +{ +if (p != NULL) { treeprint(p->left); +printf("%4d %s\n", p->count, p->word); treeprint(p->right); +} } +A practical note: if the tree becomes ``unbalanced'' because the words don't arrive in random order, the running time of the program can grow too much. As a worst case, if the words are already in order, this program does an expensive simulation of linear search. There are generalizations of the binary tree that do not suffer from this worst-case behavior, but we will not describe them here. +Before leaving this example, it is also worth a brief digression on a problem related to storage allocators. Clearly it's desirable that there be only one storage allocator in a program, even though it allocates different kinds of objects. But if one allocator is to process requests for, say, pointers to chars and pointers to struct tnodes, two questions arise. First, how does it meet the requirement of most real machines that objects of certain types must satisfy alignment restrictions (for example, integers often must be located at even addresses)? Second, what declarations can cope with the fact that an allocator must necessarily return different kinds of pointers? + +Alignment requirements can generally be satisfied easily, at the cost of some wasted space, by ensuring that the allocator always returns a pointer that meets all alignment restrictions. The allocof Chapter 5 does not guarantee any particular alignment, so we will use the standard library function malloc, which does. In Chapter 8 we will show one way to implement malloc. + +The question of the type declaration for a function like malloc is a vexing one for any language that takes its type-checking seriously. In C, the proper method is to declare that mallocreturns a pointer to void, then explicitly coerce the pointer into the desired type with a cast. malloc and related routines are declared in the standard header . Thus talloc can be written as + +#include + +/* talloc: make a tnode */ struct tnode *talloc(void) { +return (struct tnode *) malloc(sizeof(struct tnode)); +117 + +} +strdup merely copies the string given by its argument into a safe place, obtained by a call on malloc: + +char *strdup(char *s) /* make a duplicate of s */ { +char *p; + +p = (char *) malloc(strlen(s)+1); /* +1 for '\0' */ if (p != NULL) +strcpy(p, s); return p; +} +malloc returns NULL if no space is available; strdup passes that value on, leaving error-handling to its caller. +Storage obtained by calling mallocmay be freed for re-use by calling free; see Chapters 8 and 7. + +Exercise 6-2. Write a program that reads a C program and prints in alphabetical order each group of variable names that are identical in the first 6 characters, but different somewhere thereafter. Don't count words within strings and comments. Make 6 a parameter that can be set from the command line. + +Exercise 6-3. Write a cross-referencer that prints a list of all words in a document, and for each word, a list of the line numbers on which it occurs. Remove noise words like ``the,'' ``and,'' and so on. + +Exercise 6-4. Write a program that prints the distinct words in its input sorted into decreasing order of frequency of occurrence. Precede each word by its count. + +6.6 Table Lookup +In this section we will write the innards of a table-lookup package, to illustrate more aspects of structures. This code is typical of what might be found in the symbol table management routines of a macro processor or a compiler. For example, consider the #definestatement. When a line like + +#define IN 1 +is encountered, the name INand the replacement text 1are stored in a table. Later, when the name IN appears in a statement like + +state = IN; +it must be replaced by 1. +There are two routines that manipulate the names and replacement texts. install(s,t) records the name sand the replacement text tin a table; sand tare just character strings. lookup(s) searches for s in the table, and returns a pointer to the place where it was found, or NULL if it wasn't there. + +The algorithm is a hash-search - the incoming name is converted into a small non-negative integer, which is then used to index into an array of pointers. An array element points to the beginning of a linked list of blocks describing names that have that hash value. It is NULLif no names have hashed to that value. +118 + + + + + + + + + + + + + +A block in the list is a structure containing pointers to the name, the replacement text, and the next block in the list. A null next-pointer marks the end of the list. + +struct nlist { /* table entry: */ +struct nlist *next; /* next entry in chain */ char *name; /* defined name */ +char *defn; /* replacement text */ }; +The pointer array is just + +#define HASHSIZE 101 + +static struct nlist *hashtab[HASHSIZE]; /* pointer table */ +The hashing function, which is used by both lookup and install, adds each character value in the string to a scrambled combination of the previous ones and returns the remainder modulo the array size. This is not the best possible hash function, but it is short and effective. + +/* hash: form hash value for string s */ unsigned hash(char *s) +{ +unsigned hashval; + +for (hashval = 0; *s != '\0'; s++) hashval = *s + 31 * hashval; +return hashval % HASHSIZE; } +Unsigned arithmetic ensures that the hash value is non-negative. +The hashing process produces a starting index in the array hashtab; if the string is to be found anywhere, it will be in the list of blocks beginning there. The search is performed by lookup. If lookup finds the entry already present, it returns a pointer to it; if not, it returns NULL. + +/* lookup: look for s in hashtab */ struct nlist *lookup(char *s) +{ +struct nlist *np; + +for (np = hashtab[hash(s)]; np != NULL; np = np->next) if (strcmp(s, np->name) == 0) +return np; /* found */ return NULL; /* not found */ +} +The for loop in lookup is the standard idiom for walking along a linked list: + +for (ptr = head; ptr != NULL; ptr = ptr->next) ... +installuses lookupto determine whether the name being installed is already present; if so, the new definition will supersede the old one. Otherwise, a new entry is created. install returns NULL if for any reason there is no room for a new entry. +119 + + +struct nlist *lookup(char *); char *strdup(char *); + +/* install: put (name, defn) in hashtab */ struct nlist *install(char *name, char *defn) { +struct nlist *np; unsigned hashval; + +if ((np = lookup(name)) == NULL) { /* not found */ np = (struct nlist *) malloc(sizeof(*np)); +if (np == NULL || (np->name = strdup(name)) == NULL) return NULL; +hashval = hash(name); +np->next = hashtab[hashval]; hashtab[hashval] = np; +} else /* already there */ +free((void *) np->defn); /*free previous defn */ if ((np->defn = strdup(defn)) == NULL) +return NULL; return np; +} +Exercise 6-5. Write a function undefthat will remove a name and definition from the table maintained by lookup and install. +Exercise 6-6. Implement a simple version of the #define processor (i.e., no arguments) suitable for use with C programs, based on the routines of this section. You may also find getch and ungetch helpful. + +6.7 Typedef +C provides a facility called typedef for creating new data type names. For example, the declaration + +typedef int Length; +makes the name Length a synonym for int. The type Length can be used in declarations, casts, etc., in exactly the same ways that the int type can be: + +Length len, maxlen; Length *lengths[]; +Similarly, the declaration + +typedef char *String; +makes String a synonym for char * or character pointer, which may then be used in declarations and casts: + +String p, lineptr[MAXLINES], alloc(int); int strcmp(String, String); +p = (String) malloc(100); +Notice that the type being declared in a typedefappears in the position of a variable name, not right after the word typedef. Syntactically, typedefis like the storage classes extern, static, etc. We have used capitalized names for typedefs, to make them stand out. +As a more complicated example, we could make typedefs for the tree nodes shown earlier in this chapter: + +typedef struct tnode *Treeptr; + +typedef struct tnode { /* the tree node: */ +char *word; /* points to the text */ int count; /* number of occurrences */ struct tnode *left; /* left child */ +120 + +struct tnode *right; /* right child */ } Treenode; +This creates two new type keywords called Treenode(a structure) and Treeptr(a pointer to the structure). Then the routine talloc could become + +Treeptr talloc(void) { +return (Treeptr) malloc(sizeof(Treenode)); } +It must be emphasized that a typedefdeclaration does not create a new type in any sense; it merely adds a new name for some existing type. Nor are there any new semantics: variables declared this way have exactly the same properties as variables whose declarations are spelled out explicitly. In effect, typedef is like #define, except that since it is interpreted by the compiler, it can cope with textual substitutions that are beyond the capabilities of the preprocessor. For example, + +typedef int (*PFI)(char *, char *); +creates the type PFI, for ``pointer to function (of two char * arguments) returning int,'' which can be used in contexts like + +PFI strcmp, numcmp; +in the sort program of Chapter 5. +Besides purely aesthetic issues, there are two main reasons for using typedefs. The first is to parameterize a program against portability problems. If typedefs are used for data types that may be machine-dependent, only the typedefs need change when the program is moved. One common situation is to use typedef names for various integer quantities, then make an appropriate set of choices of short, int, and longfor each host machine. Types like size_t and ptrdiff_t from the standard library are examples. + +The second purpose of typedefs is to provide better documentation for a program - a type called Treeptr may be easier to understand than one declared only as a pointer to a complicated structure. + +6.8 Unions +A union is a variable that may hold (at different times) objects of different types and sizes, with the compiler keeping track of size and alignment requirements. Unions provide a way to manipulate different kinds of data in a single area of storage, without embedding any machine-dependent information in the program. They are analogous to variant records in pascal. +As an example such as might be found in a compiler symbol table manager, suppose that a constant may be an int, a float, or a character pointer. The value of a particular constant must be stored in a variable of the proper type, yet it is most convenient for table management if the value occupies the same amount of storage and is stored in the same place regardless of its type. This is the purpose of a union - a single variable that can legitimately hold any of one of several types. The syntax is based on structures: + +union u_tag { int ival; float fval; char *sval; +} u; +The variable uwill be large enough to hold the largest of the three types; the specific size is implementation-dependent. Any of these types may be assigned to u and then used in expressions, so long as the usage is consistent: the type retrieved must be the type most recently stored. It is the programmer's responsibility to keep track of which type is currently +121 + +stored in a union; the results are implementation-dependent if something is stored as one type and extracted as another. +Syntactically, members of a union are accessed as + +union-name.member + +or + +union-pointer->member + +just as for structures. If the variable utypeis used to keep track of the current type stored in u, then one might see code such as + +if (utype == INT) printf("%d\n", u.ival); +if (utype == FLOAT) printf("%f\n", u.fval); +if (utype == STRING) printf("%s\n", u.sval); +else +printf("bad type %d in utype\n", utype); +Unions may occur within structures and arrays, and vice versa. The notation for accessing a member of a union in a structure (or vice versa) is identical to that for nested structures. For example, in the structure array defined by + +struct { +char *name; int flags; int utype; union { +int ival; float fval; char *sval; +} u; +} symtab[NSYM]; +the member ival is referred to as + +symtab[i].u.ival +and the first character of the string sval by either of + +*symtab[i].u.sval + +symtab[i].u.sval[0] +In effect, a union is a structure in which all members have offset zero from the base, the structure is big enough to hold the ``widest'' member, and the alignment is appropriate for all of the types in the union. The same operations are permitted on unions as on structures: assignment to or copying as a unit, taking the address, and accessing a member. +A union may only be initialized with a value of the type of its first member; thus union u described above can only be initialized with an integer value. + +The storage allocator in Chapter 8 shows how a union can be used to force a variable to be aligned on a particular kind of storage boundary. + +6.9 Bit-fields +When storage space is at a premium, it may be necessary to pack several objects into a single machine word; one common use is a set of single-bit flags in applications like compiler symbol tables. Externally-imposed data formats, such as interfaces to hardware devices, also often require the ability to get at pieces of a word. +122 + +Imagine a fragment of a compiler that manipulates a symbol table. Each identifier in a program has certain information associated with it, for example, whether or not it is a keyword, whether or not it is external and/or static, and so on. The most compact way to encode such information is a set of one-bit flags in a single char or int. + +The usual way this is done is to define a set of ``masks'' corresponding to the relevant bit positions, as in + +#define KEYWORD 01 #define EXTRENAL 02 #define STATIC 04 +or + +enum { KEYWORD = 01, EXTERNAL = 02, STATIC = 04 }; +The numbers must be powers of two. Then accessing the bits becomes a matter of ``bit-fiddling'' with the shifting, masking, and complementing operators that were described in Chapter 2. +Certain idioms appear frequently: + +flags |= EXTERNAL | STATIC; +turns on the EXTERNAL and STATIC bits in flags, while + +flags &= ~(EXTERNAL | STATIC); turns them off, and + +if ((flags & (EXTERNAL | STATIC)) == 0) ... is true if both bits are off. +Although these idioms are readily mastered, as an alternative C offers the capability of defining and accessing fields within a word directly rather than by bitwise logical operators. A bit-field, or field for short, is a set of adjacent bits within a single implementation-defined storage unit that we will call a ``word.'' For example, the symbol table #defines above could be replaced by the definition of three fields: + +struct { +unsigned int is_keyword : 1; unsigned int is_extern : 1; unsigned int is_static : 1; +} flags; +This defines a variable table called flagsthat contains three 1-bit fields. The number following the colon represents the field width in bits. The fields are declared unsigned intto ensure that they are unsigned quantities. +Individual fields are referenced in the same way as other structure members: flags.is_keyword, flags.is_extern, etc. Fields behave like small integers, and may participate in arithmetic expressions just like other integers. Thus the previous examples may be written more naturally as + +flags.is_extern = flags.is_static = 1; to turn the bits on; + +flags.is_extern = flags.is_static = 0; to turn them off; and + +if (flags.is_extern == 0 && flags.is_static == 0) ... +to test them. +123 + +Almost everything about fields is implementation-dependent. Whether a field may overlap a word boundary is implementation-defined. Fields need not be names; unnamed fields (a colon and width only) are used for padding. The special width 0 may be used to force alignment at the next word boundary. + +Fields are assigned left to right on some machines and right to left on others. This means that although fields are useful for maintaining internally-defined data structures, the question of which end comes first has to be carefully considered when picking apart externally-defined data; programs that depend on such things are not portable. Fields may be declared only as ints; for portability, specify signedor unsignedexplicitly. They are not arrays and they do not have addresses, so the & operator cannot be applied on them. +124 + + +Chapter 7 - Input and Output +Input and output are not part of the C language itself, so we have not emphasized them in our presentation thus far. Nonetheless, programs interact with their environment in much more complicated ways than those we have shown before. In this chapter we will describe the standard library, a set of functions that provide input and output, string handling, storage management, mathematical routines, and a variety of other services for C programs. We will concentrate on input and output +The ANSI standard defines these library functions precisely, so that they can exist in compatible form on any system where C exists. Programs that confine their system interactions to facilities provided by the standard library can be moved from one system to another without change. + +The properties of library functions are specified in more than a dozen headers; we have already seen several of these, including , , and . We will not present the entire library here, since we are more interested in writing C programs that use it. The library is described in detail in Appendix B. + +7.1 Standard Input and Output +As we said in Chapter 1, the library implements a simple model of text input and output. A text stream consists of a sequence of lines; each line ends with a newline character. If the system doesn't operate that way, the library does whatever necessary to make it appear as if it does. For instance, the library might convert carriage return and linefeed to newline on input and back again on output. +The simplest input mechanism is to read one character at a time from the standard input, normally the keyboard, with getchar: + +int getchar(void) +getcharreturns the next input character each time it is called, or EOFwhen it encounters end of file. The symbolic constant EOFis defined in . The value is typically -1, bus tests should be written in terms of EOF so as to be independent of the specific value. +In many environments, a file may be substituted for the keyboard by using the < convention for input redirection: if a program prog uses getchar, then the command line + +prog filename: if prog uses putchar, +125 + +prog >outfile +will write the standard output to outfile instead. If pipes are supported, + +prog | anotherprog +puts the standard output of prog into the standard input of anotherprog. +Output produced by printfalso finds its way to the standard output. Calls to putcharand printf may be interleaved - output happens in the order in which the calls are made. + +Each source file that refers to an input/output library function must contain the line + +#include +before the first reference. When the name is bracketed by < and > a search is made for the header in a standard set of places (for example, on UNIX systems, typically in the directory /usr/include). +Many programs read only one input stream and write only one output stream; for such programs, input and output with getchar, putchar, and printf may be entirely adequate, and is certainly enough to get started. This is particularly true if redirection is used to connect the output of one program to the input of the next. For example, consider the program lower, which converts its input to lower case: + +#include #include + +main() /* lower: convert input to lower case*/ { +int c + +while ((c = getchar()) != EOF) putchar(tolower(c)); +return 0; } +The function toloweris defined in ; it converts an upper case letter to lower case, and returns other characters untouched. As we mentioned earlier, ``functions'' like getchar and putcharin and tolowerin are often macros, thus avoiding the overhead of a function call per character. We will show how this is done in Section 8.5. Regardless of how the functions are implemented on a given machine, programs that use them are shielded from knowledge of the character set. +Exercise 7-1. Write a program that converts upper case to lower or lower case to upper, depending on the name it is invoked with, as found in argv[0]. + +7.2 Formatted Output - printf +The output function printf translates internal values to characters. We have used printf informally in previous chapters. The description here covers most typical uses but is not complete; for the full story, see Appendix B. + +int printf(char *format, arg1, arg2, ...); +printfconverts, formats, and prints its arguments on the standard output under control of the format. It returns the number of characters printed. +The format string contains two types of objects: ordinary characters, which are copied to the output stream, and conversion specifications, each of which causes conversion and printing of the next successive argument to printf. Each conversion specification begins with a % and ends with a conversion character. Between the % and the conversion character there may be, in order: +126 + +· A minus sign, which specifies left adjustment of the converted argument. + +· A number that specifies the minimum field width. The converted argument will be printed in a field at least this wide. If necessary it will be padded on the left (or right, if left adjustment is called for) to make up the field width. + +· A period, which separates the field width from the precision. + +· A number, the precision, that specifies the maximum number of characters to be printed from a string, or the number of digits after the decimal point of a floating-point value, or the minimum number of digits for an integer. + +· An h if the integer is to be printed as a short, or l (letter ell) if as a long. +Conversion characters are shown in Table 7.1. If the character after the % is not a conversion specification, the behavior is undefined. +Table 7.1 Basic Printf Conversions + +Character Argument type; Printed As + +d,i + +o + +x,X + +u c +s + + +f + + +e,E + + +g,G + + +p +% + +int; decimal number +int; unsigned octal number (without a leading zero) +int; unsigned hexadecimal number (without a leading 0x or 0X), using abcdef or ABCDEF for 10, ...,15. +int; unsigned decimal number int; single character +char *; print characters from the string until a '\0' or the number of characters given by the precision. +double; [-]m.dddddd, where the number of d's is given by the precision (default 6). +double; [-]m.dddddde+/-xx or [-]m.ddddddE+/-xx, where the number of d's is given by the precision (default 6). +double; use %e or %E if the exponent is less than -4 or greater than or equal to the precision; otherwise use %f. Trailing zeros and a trailing decimal point are not printed. +void *; pointer (implementation-dependent representation). +no argument is converted; print a % + + +A width or precision may be specified as *, in which case the value is computed by converting the next argument (which must be an int). For example, to print at most maxcharacters from a string s, + +printf("%.*s", max, s); +Most of the format conversions have been illustrated in earlier chapters. One exception is the precision as it relates to strings. The following table shows the effect of a variety of specifications in printing ``hello, world'' (12 characters). We have put colons around each field so you can see it extent. + + +:%s: :%10s: :%.10s: :%-10s: :%.15s: :%-15s: :%15.10s: :%-15.10s: + +:hello, world: :hello, world: :hello, wor: :hello, world: :hello, world: :hello, world : : hello, wor: :hello, wor : +127 + +A warning: printf uses its first argument to decide how many arguments follow and what their type is. It will get confused, and you will get wrong answers, if there are not enough arguments of if they are the wrong type. You should also be aware of the difference between these two calls: + +printf(s); /* FAILS if s contains % */ printf("%s", s); /* SAFE */ +The function sprintfdoes the same conversions as printfdoes, but stores the output in a string: + +int sprintf(char *string, char *format, arg1, arg2, ...); +sprintfformats the arguments in arg1, arg2, etc., according to formatas before, but places the result in stringinstead of the standard output; stringmust be big enough to receive the result. +Exercise 7-2. Write a program that will print arbitrary input in a sensible way. As a minimum, it should print non-graphic characters in octal or hexadecimal according to local custom, and break long text lines. + +7.3 Variable-length Argument Lists +This section contains an implementation of a minimal version of printf, to show how to write a function that processes a variable-length argument list in a portable way. Since we are mainly interested in the argument processing, minprintfwill process the format string and arguments but will call the real printf to do the format conversions. +The proper declaration for printf is + +int printf(char *fmt, ...) +where the declaration ...means that the number and types of these arguments may vary. The declaration ... can only appear at the end of an argument list. Our minprintf is declared as + +void minprintf(char *fmt, ...) +since we will not return the character count that printf does. +The tricky bit is how minprintfwalks along the argument list when the list doesn't even have a name. The standard header contains a set of macro definitions that define how to step through an argument list. The implementation of this header will vary from machine to machine, but the interface it presents is uniform. + +The type va_list is used to declare a variable that will refer to each argument in turn; in minprintf, this variable is called ap, for ``argument pointer.'' The macro va_startinitializes ap to point to the first unnamed argument. It must be called once before apis used. There must be at least one named argument; the final named argument is used by va_startto get started. + +Each call of va_argreturns one argument and steps apto the next; va_arguses a type name to determine what type to return and how big a step to take. Finally, va_enddoes whatever cleanup is necessary. It must be called before the program returns. + +These properties form the basis of our simplified printf: + +#include + +/* minprintf: minimal printf with variable argument list */ void minprintf(char *fmt, ...) +{ +va_list ap; /* points to each unnamed arg in turn */ char *p, *sval; +128 + +int ival; double dval; + +va_start(ap, fmt); /* make ap point to 1st unnamed arg */ for (p = fmt; *p; p++) { +if (*p != '%') { putchar(*p); continue; +} +switch (*++p) { case 'd': +ival = va_arg(ap, int); printf("%d", ival); break; +case 'f': +dval = va_arg(ap, double); printf("%f", dval); +break; case 's': +for (sval = va_arg(ap, char *); *sval; sval++) putchar(*sval); +break; default: +putchar(*p); break; +} } +va_end(ap); /* clean up when done */ } +Exercise 7-3. Revise minprintf to handle more of the other facilities of printf. +7.4 Formatted Input - Scanf +The function scanfis the input analog of printf, providing many of the same conversion facilities in the opposite direction. + +int scanf(char *format, ...) +scanfreads characters from the standard input, interprets them according to the specification in format, and stores the results through the remaining arguments. The format argument is described below; the other arguments, each of which must be a pointer, indicate where the corresponding converted input should be stored. As with printf, this section is a summary of the most useful features, not an exhaustive list. +scanfstops when it exhausts its format string, or when some input fails to match the control specification. It returns as its value the number of successfully matched and assigned input items. This can be used to decide how many items were found. On the end of file, EOF is returned; note that this is different from 0, which means that the next input character does not match the first specification in the format string. The next call to scanfresumes searching immediately after the last character already converted. + +There is also a function sscanf that reads from a string instead of the standard input: + +int sscanf(char *string, char *format, arg1, arg2, ...) +It scans the stringaccording to the format in formatand stores the resulting values through arg1, arg2, etc. These arguments must be pointers. +The format string usually contains conversion specifications, which are used to control conversion of input. The format string may contain: + +· Blanks or tabs, which are not ignored. +129 + +· Ordinary characters (not %), which are expected to match the next non-white space character of the input stream. + +· Conversion specifications, consisting of the character %, an optional assignment suppression character *, an optional number specifying a maximum field width, an optional h, l or L indicating the width of the target, and a conversion character. +A conversion specification directs the conversion of the next input field. Normally the result is places in the variable pointed to by the corresponding argument. If assignment suppression is indicated by the * character, however, the input field is skipped; no assignment is made. An input field is defined as a string of non-white space characters; it extends either to the next white space character or until the field width, is specified, is exhausted. This implies that scanf will read across boundaries to find its input, since newlines are white space. (White space characters are blank, tab, newline, carriage return, vertical tab, and formfeed.) +The conversion character indicates the interpretation of the input field. The corresponding argument must be a pointer, as required by the call-by-value semantics of C. Conversion characters are shown in Table 7.2. + +Table 7.2: Basic Scanf Conversions + +Character Input Data; Argument type + +d + +i + +o u x + +c + + +s + + +e,f,g + +% + +decimal integer; int * +integer; int *. The integer may be in octal (leading 0) or hexadecimal (leading 0x or 0X). +octal integer (with or without leading zero); int * unsigned decimal integer; unsigned int * +hexadecimal integer (with or without leading 0x or 0X); int * +characters; char *. The next input characters (default 1) are placed at the indicated spot. The normal skip-over white space is suppressed; to read the next non-white space character, use %1s +character string (not quoted); char *, pointing to an array of characters long enough for the string and a terminating '\0' that will be added. +floating-point number with optional sign, optional decimal point and optional exponent; float * +literal %; no assignment is made. + + +The conversion characters d, i, o, u, and xmay be preceded by hto indicate that a pointer to shortrather than intappears in the argument list, or by l(letter ell) to indicate that a pointer to long appears in the argument list. + +As a first example, the rudimentary calculator of Chapter 4 can be written with scanfto do the input conversion: + +#include + +main() /* rudimentary calculator */ { +double sum, v; + +sum = 0; +while (scanf("%lf", &v) == 1) printf("\t%.2f\n", sum += v); +return 0; } +Suppose we want to read input lines that contain dates of the form +130 + + +25 Dec 1988 +The scanf statement is + +int day, year; +char monthname[20]; + +scanf("%d %s %d", &day, monthname, &year); +No & is used with monthname, since an array name is a pointer. +Literal characters can appear in the scanfformat string; they must match the same characters in the input. So we could read dates of the form mm/dd/yy with the scanf statement: + +int day, month, year; + +scanf("%d/%d/%d", &month, &day, &year); +scanf ignores blanks and tabs in its format string. Furthermore, it skips over white space (blanks, tabs, newlines, etc.) as it looks for input values. To read input whose format is not fixed, it is often best to read a line at a time, then pick it apart with scanf. For example, suppose we want to read lines that might contain a date in either of the forms above. Then we could write + +while (getline(line, sizeof(line)) > 0) { +if (sscanf(line, "%d %s %d", &day, monthname, &year) == 3) printf("valid: %s\n", line); /* 25 Dec 1988 form */ +else if (sscanf(line, "%d/%d/%d", &month, &day, &year) == 3) printf("valid: %s\n", line); /* mm/dd/yy form */ +else +printf("invalid: %s\n", line); /* invalid form */ } +Calls to scanfcan be mixed with calls to other input functions. The next call to any input function will begin by reading the first character not read by scanf. +A final warning: the arguments to scanf and sscanf must be pointers. By far the most common error is writing + +scanf("%d", n); instead of + +scanf("%d", &n); +This error is not generally detected at compile time. +Exercise 7-4. Write a private version of scanfanalogous to minprintf from the previous section. + +Exercise 5-5. Rewrite the postfix calculator of Chapter 4 to use scanfand/or sscanfto do the input and number conversion. + +7.5 File Access +The examples so far have all read the standard input and written the standard output, which are automatically defined for a program by the local operating system. +The next step is to write a program that accesses a file that is not already connected to the program. One program that illustrates the need for such operations is cat, which concatenates a set of named files into the standard output. catis used for printing files on the screen, and as a general-purpose input collector for programs that do not have the capability of accessing files by name. For example, the command + +cat x.c y.c +131 + +prints the contents of the files x.c and y.c (and nothing else) on the standard output. +The question is how to arrange for the named files to be read - that is, how to connect the external names that a user thinks of to the statements that read the data. + +The rules are simple. Before it can be read or written, a file has to be opened by the library function fopen. fopentakes an external name like x.cor y.c, does some housekeeping and negotiation with the operating system (details of which needn't concern us), and returns a pointer to be used in subsequent reads or writes of the file. + +This pointer, called the file pointer, points to a structure that contains information about the file, such as the location of a buffer, the current character position in the buffer, whether the file is being read or written, and whether errors or end of file have occurred. Users don't need to know the details, because the definitions obtained from include a structure declaration called FILE. The only declaration needed for a file pointer is exemplified by + +FILE *fp; +FILE *fopen(char *name, char *mode); +This says that fpis a pointer to a FILE, and fopenreturns a pointer to a FILE. Notice that FILEis a type name, like int, not a structure tag; it is defined with a typedef. (Details of how fopen can be implemented on the UNIX system are given in Section 8.5.) +The call to fopen in a program is + +fp = fopen(name, mode); +The first argument of fopenis a character string containing the name of the file. The second argument is the mode, also a character string, which indicates how one intends to use the file. Allowable modes include read ("r"), write ("w"), and append ("a"). Some systems distinguish between text and binary files; for the latter, a "b" must be appended to the mode string. +If a file that does not exist is opened for writing or appending, it is created if possible. Opening an existing file for writing causes the old contents to be discarded, while opening for appending preserves them. Trying to read a file that does not exist is an error, and there may be other causes of error as well, like trying to read a file when you don't have permission. If there is any error, fopenwill return NULL. (The error can be identified more precisely; see the discussion of error-handling functions at the end of Section 1 in Appendix B.) + +The next thing needed is a way to read or write the file once it is open. getcreturns the next character from a file; it needs the file pointer to tell it which file. + +int getc(FILE *fp) +getcreturns the next character from the stream referred to by fp; it returns EOFfor end of file or error. +putc is an output function: + +int putc(int c, FILE *fp) +putcwrites the character cto the file fpand returns the character written, or EOF if an error occurs. Like getchar and putchar, getc and putc may be macros instead of functions. +When a C program is started, the operating system environment is responsible for opening three files and providing pointers for them. These files are the standard input, the standard output, and the standard error; the corresponding file pointers are called stdin, stdout, and stderr, and are declared in . Normally stdinis connected to the keyboard and stdoutand stderrare connected to the screen, but stdinand stdoutmay be redirected to files or pipes as described in Section 7.1. +132 + +getchar and putchar can be defined in terms of getc, putc, stdin, and stdout as follows: + +#define getchar() getc(stdin) #define putchar(c) putc((c), stdout) +For formatted input or output of files, the functions fscanfand fprintfmay be used. These are identical to scanfand printf, except that the first argument is a file pointer that specifies the file to be read or written; the format string is the second argument. + +int fscanf(FILE *fp, char *format, ...) int fprintf(FILE *fp, char *format, ...) +With these preliminaries out of the way, we are now in a position to write the program catto concatenate files. The design is one that has been found convenient for many programs. If there are command-line arguments, they are interpreted as filenames, and processed in order. If there are no arguments, the standard input is processed. + +#include + +/* cat: concatenate files, version 1 */ main(int argc, char *argv[]) +{ +FILE *fp; +void filecopy(FILE *, FILE *) + +if (argc == 1) /* no args; copy standard input */ filecopy(stdin, stdout); +else +while(--argc > 0) +if ((fp = fopen(*++argv, "r")) == NULL) { printf("cat: can't open %s\n, *argv); return 1; +} else { +filecopy(fp, stdout); fclose(fp); +} return 0; +} + +/* filecopy: copy file ifp to file ofp */ void filecopy(FILE *ifp, FILE *ofp) +{ +int c; + +while ((c = getc(ifp)) != EOF) putc(c, ofp); +} +The file pointers stdinand stdoutare objects of type FILE *. They are constants, however, not variables, so it is not possible to assign to them. +The function + +int fclose(FILE *fp) +is the inverse of fopen, it breaks the connection between the file pointer and the external name that was established by fopen, freeing the file pointer for another file. Since most operating systems have some limit on the number of files that a program may have open simultaneously, it's a good idea to free the file pointers when they are no longer needed, as we did in cat. There is also another reason for fcloseon an output file - it flushes the buffer in which putc is collecting output. fclose is called automatically for each open file when a program terminates normally. (You can close stdinand stdoutif they are not needed. They can also be reassigned by the library function freopen.) +7.6 Error Handling - Stderr and Exit +133 + +The treatment of errors in cat is not ideal. The trouble is that if one of the files can't be accessed for some reason, the diagnostic is printed at the end of the concatenated output. That might be acceptable if the output is going to a screen, but not if it's going into a file or into another program via a pipeline. +To handle this situation better, a second output stream, called stderr, is assigned to a program in the same way that stdinand stdout are. Output written on stderr normally appears on the screen even if the standard output is redirected. + +Let us revise cat to write its error messages on the standard error. + +#include + +/* cat: concatenate files, version 2 */ main(int argc, char *argv[]) +{ +FILE *fp; +void filecopy(FILE *, FILE *); +char *prog = argv[0]; /* program name for errors */ + +if (argc == 1 ) /* no args; copy standard input */ filecopy(stdin, stdout); +else +while (--argc > 0) +if ((fp = fopen(*++argv, "r")) == NULL) { fprintf(stderr, "%s: can't open %s\n", +prog, *argv); exit(1); +} else { +filecopy(fp, stdout); fclose(fp); +} +if (ferror(stdout)) { +fprintf(stderr, "%s: error writing stdout\n", prog); exit(2); +} exit(0); +} +The program signals errors in two ways. First, the diagnostic output produced by fprintf goes to stderr, so it finds its way to the screen instead of disappearing down a pipeline or into an output file. We included the program name, from argv[0], in the message, so if this program is used with others, the source of an error is identified. +Second, the program uses the standard library function exit, which terminates program execution when it is called. The argument of exitis available to whatever process called this one, so the success or failure of the program can be tested by another program that uses this one as a sub-process. Conventionally, a return value of 0 signals that all is well; non-zero values usually signal abnormal situations. exitcalls fclosefor each open output file, to flush out any buffered output. + +Within main, returnexpr is equivalent to exit(expr). exithas the advantage that it can be called from other functions, and that calls to it can be found with a pattern-searching program like those in Chapter 5. + +The function ferror returns non-zero if an error occurred on the stream fp. + +int ferror(FILE *fp) +Although output errors are rare, they do occur (for example, if a disk fills up), so a production program should check this as well. +134 + +The function feof(FILE *) is analogous to ferror; it returns non-zero if end of file has occurred on the specified file. + +int feof(FILE *fp) +We have generally not worried about exit status in our small illustrative programs, but any serious program should take care to return sensible, useful status values. +7.7 Line Input and Output +The standard library provides an input and output routine fgetsthat is similar to the getline function that we have used in earlier chapters: + +char *fgets(char *line, int maxline, FILE *fp) +fgetsreads the next input line (including the newline) from file fpinto the character array line; at most maxline-1characters will be read. The resulting line is terminated with '\0'. Normally fgetsreturns line; on end of file or error it returns NULL. (Our getlinereturns the line length, which is a more useful value; zero means end of file.) +For output, the function fputs writes a string (which need not contain a newline) to a file: + +int fputs(char *line, FILE *fp) +It returns EOF if an error occurs, and non-negative otherwise. +The library functions getsand putsare similar to fgetsand fputs, but operate on stdin and stdout. Confusingly, gets deletes the terminating '\n', and puts adds it. + +To show that there is nothing special about functions like fgetsand fputs, here they are, copied from the standard library on our system: + +/* fgets: get at most n chars from iop */ char *fgets(char *s, int n, FILE *iop) +{ +register int c; register char *cs; + +cs = s; +while (--n > 0 && (c = getc(iop)) != EOF) if ((*cs++ = c) == '\n') +break; *cs = '\0'; +return (c == EOF && cs == s) ? NULL : s; } + +/* fputs: put string s on file iop */ int fputs(char *s, FILE *iop) +{ +int c; + +while (c = *s++) putc(c, iop); +return ferror(iop) ? EOF : 0; } +For no obvious reason, the standard specifies different return values for ferror and fputs. +It is easy to implement our getline from fgets: + +/* getline: read a line, return length */ int getline(char *line, int max) +{ +if (fgets(line, max, stdin) == NULL) return 0; +else +135 + +return strlen(line); } +Exercise 7-6. Write a program to compare two files, printing the first line where they differ. +Exercise 7-7. Modify the pattern finding program of Chapter 5 to take its input from a set of named files or, if no files are named as arguments, from the standard input. Should the file name be printed when a matching line is found? + +Exercise 7-8. Write a program to print a set of files, starting each new one on a new page, with a title and a running page count for each file. + +7.8 Miscellaneous Functions +The standard library provides a wide variety of functions. This section is a brief synopsis of the most useful. More details and many other functions can be found in Appendix B. +7.8.1 String Operations +We have already mentioned the string functions strlen, strcpy, strcat, and strcmp, found in . In the following, s and t are char *'s, and c and n are ints. +strcat(s,t) concatenate t to end of s strncat(s,t,n) concatenate n characters of t to end of s +strcmp(s,t) return negative, zero, or positive for s < t, s == t, s > t strncmp(s,t,n) same as strcmp but only in first n characters +strcpy(s,t) copy t to s +strncpy(s,t,n) copy at most n characters of t to s strlen(s) return length of s +strchr(s,c) return pointer to first c in s, or NULL if not present strrchr(s,c) return pointer to last c in s, or NULL if not present +7.8.2 Character Class Testing and Conversion +Several functions from perform character tests and conversions. In the following, c is an int that can be represented as an unsigned char or EOF. The function returns int. +isalpha(c) non-zero if c is alphabetic, 0 if not isupper(c) non-zero if c is upper case, 0 if not islower(c) non-zero if c is lower case, 0 if not isdigit(c) non-zero if c is digit, 0 if not +isalnum(c) non-zero if isalpha(c) or isdigit(c), 0 if not +isspace(c) non-zero if c is blank, tab, newline, return, formfeed, vertical tab toupper(c) return c converted to upper case +tolower(c) return c converted to lower case +7.8.3 Ungetc +The standard library provides a rather restricted version of the function ungetchthat we wrote in Chapter 4; it is called ungetc. + +int ungetc(int c, FILE *fp) +pushes the character cback onto file fp, and returns either c, or EOFfor an error. Only one character of pushback is guaranteed per file. ungetc may be used with any of the input functions like scanf, getc, or getchar. +7.8.4 Command Execution +The function system(char *s) executes the command contained in the character string s, then resumes execution of the current program. The contents of sdepend strongly on the local operating system. As a trivial example, on UNIX systems, the statement + +system("date"); +136 + +causes the program dateto be run; it prints the date and time of day on the standard output. systemreturns a system-dependent integer status from the command executed. In the UNIX system, the status return is the value returned by exit. +7.8.5 Storage Management +The functions malloc and calloc obtain blocks of memory dynamically. + +void *malloc(size_t n) +returns a pointer to n bytes of uninitialized storage, or NULL if the request cannot be satisfied. + +void *calloc(size_t n, size_t size) +returns a pointer to enough free space for an array of nobjects of the specified size, or NULLif the request cannot be satisfied. The storage is initialized to zero. +The pointer returned by mallocor callochas the proper alignment for the object in question, but it must be cast into the appropriate type, as in + +int *ip; + +ip = (int *) calloc(n, sizeof(int)); +free(p)frees the space pointed to by p, where pwas originally obtained by a call to malloc or calloc. There are no restrictions on the order in which space is freed, but it is a ghastly error to free something not obtained by calling malloc or calloc. +It is also an error to use something after it has been freed. A typical but incorrect piece of code is this loop that frees items from a list: + +for (p = head; p != NULL; p = p->next) /* WRONG */ free(p); +The right way is to save whatever is needed before freeing: + +for (p = head; p != NULL; p = q) { q = p->next; +free(p); } +Section 8.7 shows the implementation of a storage allocator like malloc, in which allocated blocks may be freed in any order. +7.8.6 Mathematical Functions +There are more than twenty mathematical functions declared in ; here are some of the more frequently used. Each takes one or two double arguments and returns a double. +sin(x) sine of x, x in radians cos(x) cosine of x, x in radians atan2(y,x) arctangent of y/x, in radians exp(x) exponential function ex +log(x) natural (base e) logarithm of x (x>0) log10(x) common (base 10) logarithm of x (x>0) pow(x,y) xy +sqrt(x) square root of x (x>0) fabs(x) absolute value of x +7.8.7 Random Number generation +The function rand() computes a sequence of pseudo-random integers in the range zero to RAND_MAX, which is defined in . One way to produce random floating-point numbers greater than or equal to zero but less than one is + +#define frand() ((double) rand() / (RAND_MAX+1.0)) +137 + +(If your library already provides a function for floating-point random numbers, it is likely to have better statistical properties than this one.) +The function srand(unsigned)sets the seed for rand. The portable implementation of rand and srand suggested by the standard appears in Section 2.7. + +Exercise 7-9. Functions like isupper can be implemented to save space or to save time. Explore both possibilities. +138 + + +Chapter 8 - The UNIX System Interface +The UNIX operating system provides its services through a set of system calls, which are in effect functions within the operating system that may be called by user programs. This chapter describes how to use some of the most important system calls from C programs. If you use UNIX, this should be directly helpful, for it is sometimes necessary to employ system calls for maximum efficiency, or to access some facility that is not in the library. Even if you use C on a different operating system, however, you should be able to glean insight into C programming from studying these examples; although details vary, similar code will be found on any system. Since the ANSI C library is in many cases modeled on UNIX facilities, this code may help your understanding of the library as well. +This chapter is divided into three major parts: input/output, file system, and storage allocation. The first two parts assume a modest familiarity with the external characteristics of UNIX systems. + +Chapter 7 was concerned with an input/output interface that is uniform across operating systems. On any particular system the routines of the standard library have to be written in terms of the facilities provided by the host system. In the next few sections we will describe the UNIX system calls for input and output, and show how parts of the standard library can be implemented with them. + +8.1 File Descriptors +In the UNIX operating system, all input and output is done by reading or writing files, because all peripheral devices, even keyboard and screen, are files in the file system. This means that a single homogeneous interface handles all communication between a program and peripheral devices. +In the most general case, before you read and write a file, you must inform the system of your intent to do so, a process called opening the file. If you are going to write on a file it may also be necessary to create it or to discard its previous contents. The system checks your right to do so (Does the file exist? Do you have permission to access it?) and if all is well, returns to the program a small non-negative integer called a file descriptor. Whenever input or output is to be done on the file, the file descriptor is used instead of the name to identify the file. (A file descriptor is analogous to the file pointer used by the standard library, or to the file handle of MS-DOS.) All information about an open file is maintained by the system; the user program refers to the file only by the file descriptor. + +Since input and output involving keyboard and screen is so common, special arrangements exist to make this convenient. When the command interpreter (the ``shell'') runs a program, three files are open, with file descriptors 0, 1, and 2, called the standard input, the standard output, and the standard error. If a program reads 0 and writes 1 and 2, it can do input and output without worrying about opening files. + +The user of a program can redirect I/O to and from files with < and >: + +prog outfile +In this case, the shell changes the default assignments for the file descriptors 0 and 1 to the named files. Normally file descriptor 2 remains attached to the screen, so error messages can go there. Similar observations hold for input or output associated with a pipe. In all cases, the file assignments are changed by the shell, not by the program. The program does not know where its input comes from nor where its output goes, so long as it uses file 0 for input and 1 and 2 for output. +139 + +8.2 Low Level I/O - Read and Write +Input and output uses the readand writesystem calls, which are accessed from C programs through two functions called readand write. For both, the first argument is a file descriptor. The second argument is a character array in your program where the data is to go to or to come from. The third argument is the number is the number of bytes to be transferred. + +int n_read = read(int fd, char *buf, int n); +int n_written = write(int fd, char *buf, int n); +Each call returns a count of the number of bytes transferred. On reading, the number of bytes returned may be less than the number requested. A return value of zero bytes implies end of file, and -1indicates an error of some sort. For writing, the return value is the number of bytes written; an error has occurred if this isn't equal to the number requested. +Any number of bytes can be read or written in one call. The most common values are 1, which means one character at a time (``unbuffered''), and a number like 1024 or 4096 that corresponds to a physical block size on a peripheral device. Larger sizes will be more efficient because fewer system calls will be made. + +Putting these facts together, we can write a simple program to copy its input to its output, the equivalent of the file copying program written for Chapter 1. This program will copy anything to anything, since the input and output can be redirected to any file or device. + +#include "syscalls.h" + +main() /* copy input to output */ { +char buf[BUFSIZ]; int n; + +while ((n = read(0, buf, BUFSIZ)) > 0) write(1, buf, n); +return 0; } +We have collected function prototypes for the system calls into a file called syscalls.hso we can include it in the programs of this chapter. This name is not standard, however. +The parameter BUFSIZis also defined in syscalls.h; its value is a good size for the local system. If the file size is not a multiple of BUFSIZ, some readwill return a smaller number of bytes to be written by write; the next call to read after that will return zero. + +It is instructive to see how readand writecan be used to construct higher-level routines like getchar, putchar, etc. For example, here is a version of getcharthat does unbuffered input, by reading the standard input one character at a time. + +#include "syscalls.h" + +/* getchar: unbuffered single character input */ int getchar(void) +{ +char c; + +return (read(0, &c, 1) == 1) ? (unsigned char) c : EOF; } +cmust be a char, because readneeds a character pointer. Casting cto unsigned charin the return statement eliminates any problem of sign extension. +The second version of getchardoes input in big chunks, and hands out the characters one at a time. +140 + +#include "syscalls.h" + +/* getchar: simple buffered version */ int getchar(void) +{ +static char buf[BUFSIZ]; static char *bufp = buf; static int n = 0; + +if (n == 0) { /* buffer is empty */ n = read(0, buf, sizeof buf); bufp = buf; +} +return (--n >= 0) ? (unsigned char) *bufp++ : EOF; } +If these versions of getchar were to be compiled with included, it would be necessary to #undef the name getchar in case it is implemented as a macro. +8.3 Open, Creat, Close, Unlink +Other than the default standard input, output and error, you must explicitly open files in order to read or write them. There are two system calls for this, open and creat [sic]. +open is rather like the fopendiscussed in Chapter 7, except that instead of returning a file pointer, it returns a file descriptor, which is just an int. open returns -1 if any error occurs. + +#include + +int fd; +int open(char *name, int flags, int perms); + +fd = open(name, flags, perms); +As with fopen, the nameargument is a character string containing the filename. The second argument, flags, is an int that specifies how the file is to be opened; the main values are +O_RDONLY open for reading only O_WRONLY open for writing only +O_RDWR open for both reading and writing +These constants are defined in on System V UNIX systems, and in on Berkeley (BSD) versions. + +To open an existing file for reading, + +fd = open(name, O_RDONLY,0); +The perms argument is always zero for the uses of open that we will discuss. +It is an error to try to open a file that does not exist. The system call creatis provided to create new files, or to re-write old ones. + +int creat(char *name, int perms); + +fd = creat(name, perms); +returns a file descriptor if it was able to create the file, and -1if not. If the file already exists, creatwill truncate it to zero length, thereby discarding its previous contents; it is not an error to creat a file that already exists. +If the file does not already exist, creatcreates it with the permissions specified by the perms argument. In the UNIX file system, there are nine bits of permission information associated with a file that control read, write and execute access for the owner of the file, for the owner's group, and for all others. Thus a three-digit octal number is convenient for specifying the +141 + +permissions. For example, 0775specifies read, write and execute permission for the owner, and read and execute permission for the group and everyone else. + +To illustrate, here is a simplified version of the UNIX program cp, which copies one file to another. Our version copies only one file, it does not permit the second argument to be a directory, and it invents permissions instead of copying them. + +#include #include #include "syscalls.h" +#define PERMS 0666 /* RW for owner, group, others */ + +void error(char *, ...); + +/* cp: copy f1 to f2 */ main(int argc, char *argv[]) { +int f1, f2, n; char buf[BUFSIZ]; + +if (argc != 3) +error("Usage: cp from to"); +if ((f1 = open(argv[1], O_RDONLY, 0)) == -1) error("cp: can't open %s", argv[1]); +if ((f2 = creat(argv[2], PERMS)) == -1) error("cp: can't create %s, mode %03o", +argv[2], PERMS); +while ((n = read(f1, buf, BUFSIZ)) > 0) if (write(f2, buf, n) != n) +error("cp: write error on file %s", argv[2]); return 0; +} +This program creates the output file with fixed permissions of 0666. With the stat system call, described in Section 8.6, we can determine the mode of an existing file and thus give the same mode to the copy. +Notice that the function erroris called with variable argument lists much like printf. The implementation of error illustrates how to use another member of the printf family. The standard library function vprintf is like printf except that the variable argument list is replaced by a single argument that has been initialized by calling the va_start macro. Similarly, vfprintf and vsprintf match fprintf and sprintf. + +#include #include + +/* error: print an error message and die */ void error(char *fmt, ...) +{ +va_list args; + +va_start(args, fmt); fprintf(stderr, "error: "); vprintf(stderr, fmt, args); fprintf(stderr, "\n"); va_end(args); +exit(1); } +There is a limit (often about 20) on the number of files that a program may open simultaneously. Accordingly, any program that intends to process many files must be prepared to re-use file descriptors. The function close(int fd)breaks the connection between a file descriptor and an open file, and frees the file descriptor for use with some other file; it +142 + +corresponds to fclose in the standard library except that there is no buffer to flush. Termination of a program via exit or return from the main program closes all open files. +The function unlink(char *name)removes the file namefrom the file system. It corresponds to the standard library function remove. + +Exercise 8-1. Rewrite the program catfrom Chapter 7 using read, write, open, and close instead of their standard library equivalents. Perform experiments to determine the relative speeds of the two versions. + +8.4 Random Access - Lseek +Input and output are normally sequential: each reador writetakes place at a position in the file right after the previous one. When necessary, however, a file can be read or written in any arbitrary order. The system call lseekprovides a way to move around in a file without reading or writing any data: + +long lseek(int fd, long offset, int origin); +sets the current position in the file whose descriptor is fdto offset, which is taken relative to the location specified by origin. Subsequent reading or writing will begin at that position. origincan be 0, 1, or 2 to specify that offsetis to be measured from the beginning, from the current position, or from the end of the file respectively. For example, to append to a file (the redirection >> in the UNIX shell, or "a" for fopen), seek to the end before writing: + +lseek(fd, 0L, 2); +To get back to the beginning (``rewind''), + +lseek(fd, 0L, 0); +Notice the 0Largument; it could also be written as (long) 0or just as 0if lseekis properly declared. +With lseek, it is possible to treat files more or less like arrays, at the price of slower access. For example, the following function reads any number of bytes from any arbitrary place in a file. It returns the number read, or -1 on error. + +#include "syscalls.h" + +/*get: read n bytes from position pos */ int get(int fd, long pos, char *buf, int n) { +if (lseek(fd, pos, 0) >= 0) /* get to pos */ return read(fd, buf, n); +else +return -1; } +The return value from lseekis a long that gives the new position in the file, or -1if an error occurs. The standard library function fseekis similar to lseekexcept that the first argument is a FILE * and the return is non-zero if an error occurred. +8.5 Example - An implementation of Fopen and Getc +Let us illustrate how some of these pieces fit together by showing an implementation of the standard library routines fopen and getc. +Recall that files in the standard library are described by file pointers rather than file descriptors. A file pointer is a pointer to a structure that contains several pieces of information about the file: a pointer to a buffer, so the file can be read in large chunks; a count of the number of characters left in the buffer; a pointer to the next character position in the buffer; the file descriptor; and flags describing read/write mode, error status, etc. +143 + +The data structure that describes a file is contained in , which must be included (by #include) in any source file that uses routines from the standard input/output library. It is also included by functions in that library. In the following excerpt from a typical , names that are intended for use only by functions of the library begin with an underscore so they are less likely to collide with names in a user's program. This convention is used by all standard library routines. + +#define NULL 0 #define EOF (-1) #define BUFSIZ 1024 +#define OPEN_MAX 20 /* max #files open at once */ + +typedef struct _iobuf { +int cnt; /* characters left */ +char *ptr; /* next character position */ char *base; /* location of buffer */ +int flag; /* mode of file access */ int fd; /* file descriptor */ +} FILE; +extern FILE _iob[OPEN_MAX]; + + +#define stdin #define stdout #define stderr + +(&_iob[0]) (&_iob[1]) (&_iob[2]) + + + +enum _flags { _READ = 01, _WRITE = 02, _UNBUF = 04, _EOF = 010, _ERR = 020 +}; + + +/* file open for reading */ /* file open for writing */ /* file is unbuffered */ +/* EOF has occurred on this file */ /* error occurred on this file */ + + +int _fillbuf(FILE *); +int _flushbuf(int, FILE *); + + +#define feof(p) #define ferror(p) #define fileno(p) + +((p)->flag & _EOF) != 0) ((p)->flag & _ERR) != 0) ((p)->fd) + + +#define getc(p) (--(p)->cnt >= 0 \ +? (unsigned char) *(p)->ptr++ : _fillbuf(p)) #define putc(x,p) (--(p)->cnt >= 0 \ +? *(p)->ptr++ = (x) : _flushbuf((x),p)) + +#define getchar() getc(stdin) #define putcher(x) putc((x), stdout) +The getc macro normally decrements the count, advances the pointer, and returns the character. (Recall that a long #define is continued with a backslash.) If the count goes negative, however, getccalls the function _fillbufto replenish the buffer, re-initialize the structure contents, and return a character. The characters are returned unsigned, which ensures that all characters will be positive. +Although we will not discuss any details, we have included the definition of putcto show that it operates in much the same way as getc, calling a function _flushbufwhen its buffer is full. We have also included macros for accessing the error and end-of-file status and the file descriptor. + +The function fopen can now be written. Most of fopen is concerned with getting the file opened and positioned at the right place, and setting the flag bits to indicate the proper state. fopen does not allocate any buffer space; this is done by _fillbuf when the file is first read. +144 + +#include #include "syscalls.h" +#define PERMS 0666 /* RW for owner, group, others */ + +FILE *fopen(char *name, char *mode) { +int fd; FILE *fp; + +if (*mode != 'r' && *mode != 'w' && *mode != 'a') return NULL; +for (fp = _iob; fp < _iob + OPEN_MAX; fp++) if ((fp->flag & (_READ | _WRITE)) == 0) break; /* found free slot */ +if (fp >= _iob + OPEN_MAX) /* no free slots */ return NULL; + +if (*mode == 'w') +fd = creat(name, PERMS); else if (*mode == 'a') { +if ((fd = open(name, O_WRONLY, 0)) == -1) fd = creat(name, PERMS); +lseek(fd, 0L, 2); } else +fd = open(name, O_RDONLY, 0); +if (fd == -1) /* couldn't access name */ return NULL; +fp->fd = fd; fp->cnt = 0; +fp->base = NULL; +fp->flag = (*mode == 'r') ? _READ : _WRITE; return fp; +} +This version of fopendoes not handle all of the access mode possibilities of the standard, though adding them would not take much code. In particular, our fopendoes not recognize the ``b'' that signals binary access, since that is meaningless on UNIX systems, nor the ``+'' that permits both reading and writing. +The first call to getc for a particular file finds a count of zero, which forces a call of _fillbuf. If _fillbuffinds that the file is not open for reading, it returns EOFimmediately. Otherwise, it tries to allocate a buffer (if reading is to be buffered). + +Once the buffer is established, _fillbufcalls readto fill it, sets the count and pointers, and returns the character at the beginning of the buffer. Subsequent calls to _fillbufwill find a buffer allocated. + +#include "syscalls.h" + +/* _fillbuf: allocate and fill input buffer */ int _fillbuf(FILE *fp) +{ +int bufsize; + +if ((fp->flag&(_READ|_EOF_ERR)) != _READ) return EOF; +bufsize = (fp->flag & _UNBUF) ? 1 : BUFSIZ; if (fp->base == NULL) /* no buffer yet */ +if ((fp->base = (char *) malloc(bufsize)) == NULL) return EOF; /* can't get buffer */ +fp->ptr = fp->base; +fp->cnt = read(fp->fd, fp->ptr, bufsize); if (--fp->cnt < 0) { +if (fp->cnt == -1) fp->flag |= _EOF; +145 + +else +fp->flag |= _ERR; fp->cnt = 0; +return EOF; } +return (unsigned char) *fp->ptr++; } +The only remaining loose end is how everything gets started. The array _iobmust be defined and initialized for stdin, stdout and stderr: + +FILE _iob[OPEN_MAX] = { /* stdin, stdout, stderr */ { 0, (char *) 0, (char *) 0, _READ, 0 }, +{ 0, (char *) 0, (char *) 0, _WRITE, 1 }, +{ 0, (char *) 0, (char *) 0, _WRITE, | _UNBUF, 2 } }; +The initialization of the flagpart of the structure shows that stdinis to be read, stdoutis to be written, and stderr is to be written unbuffered. +Exercise 8-2. Rewrite fopen and _fillbuf with fields instead of explicit bit operations. Compare code size and execution speed. + +Exercise 8-3. Design and write _flushbuf, fflush, and fclose. + +Exercise 8-4. The standard library function + +int fseek(FILE *fp, long offset, int origin) +is identical to lseekexcept that fpis a file pointer instead of a file descriptor and return value is an intstatus, not a position. Write fseek. Make sure that your fseekcoordinates properly with the buffering done for the other functions of the library. +8.6 Example - Listing Directories +A different kind of file system interaction is sometimes called for - determining information about a file, not what it contains. A directory-listing program such as the UNIX command ls is an example - it prints the names of files in a directory, and, optionally, other information, such as sizes, permissions, and so on. The MS-DOS dir command is analogous. +Since a UNIX directory is just a file, lsneed only read it to retrieve the filenames. But is is necessary to use a system call to access other information about a file, such as its size. On other systems, a system call may be needed even to access filenames; this is the case on MS-DOS for instance. What we want is provide access to the information in a relatively system-independent way, even though the implementation may be highly system-dependent. + +We will illustrate some of this by writing a program called fsize. fsizeis a special form of lsthat prints the sizes of all files named in its commandline argument list. If one of the files is a directory, fsizeapplies itself recursively to that directory. If there are no arguments at all, it processes the current directory. + +Let us begin with a short review of UNIX file system structure. A directory is a file that contains a list of filenames and some indication of where they are located. The ``location'' is an index into another table called the ``inode list.'' The inode for a file is where all information about the file except its name is kept. A directory entry generally consists of only two items, the filename and an inode number. + +Regrettably, the format and precise contents of a directory are not the same on all versions of the system. So we will divide the task into two pieces to try to isolate the non-portable parts. The outer level defines a structure called a Direntand three routines opendir, readdir, and closedirto provide system-independent access to the name and inode number in a directory entry. We will write fsizewith this interface. Then we will show how to implement these on +146 + +systems that use the same directory structure as Version 7 and System V UNIX; variants are left as exercises. + +The Dirent structure contains the inode number and the name. The maximum length of a filename component is NAME_MAX, which is a system-dependent value. opendir returns a pointer to a structure called DIR, analogous to FILE, which is used by readdirand closedir. This information is collected into a file called dirent.h. + +#define NAME_MAX 14 /* longest filename component; */ /* system-dependent */ + +typedef struct { /* portable directory entry */ long ino; /* inode number */ +char name[NAME_MAX+1]; /* name + '\0' terminator */ } Dirent; + + +typedef struct { int fd; Dirent d; +} DIR; + +/* minimal DIR: no buffering, etc. */ +/* file descriptor for the directory */ /* the directory entry */ + + +DIR *opendir(char *dirname); Dirent *readdir(DIR *dfd); void closedir(DIR *dfd); +The system call stattakes a filename and returns all of the information in the inode for that file, or -1 if there is an error. That is, + +char *name; struct stat stbuf; +int stat(char *, struct stat *); + +stat(name, &stbuf); +fills the structure stbufwith the inode information for the file name. The structure describing the value returned by stat is in , and typically looks like this: + +struct stat /* inode information returned by stat */ { +dev_t st_dev; /* device of inode */ ino_t st_ino; /* inode number */ short st_mode; /* mode bits */ +short st_nlink; /* number of links to file */ short st_uid; /* owners user id */ +short st_gid; /* owners group id */ dev_t st_rdev; /* for special files */ +off_t st_size; /* file size in characters */ time_t st_atime; /* time last accessed */ time_t st_mtime; /* time last modified */ time_t st_ctime; /* time originally created */ +}; +Most of these values are explained by the comment fields. The types like dev_tand ino_tare defined in , which must be included too. +The st_mode entry contains a set of flags describing the file. The flag definitions are also included in ; we need only the part that deals with file type: + + +#define S_IFMT #define S_IFDIR #define S_IFCHR #define S_IFBLK #define S_IFREG /* ... */ + +0160000 0040000 0020000 0060000 0010000 + +/* type of file: */ /* directory */ +/* character special */ /* block special */ +/* regular */ +147 + +Now we are ready to write the program fsize. If the mode obtained from statindicates that a file is not a directory, then the size is at hand and can be printed directly. If the name is a directory, however, then we have to process that directory one file at a time; it may in turn contain sub-directories, so the process is recursive. +The main routine deals with command-line arguments; it hands each argument to the function fsize. + + +#include #include #include "syscalls.h" #include #include #include #include "dirent.h" + + + + +/* flags for read and write */ /* typedefs */ +/* structure returned by stat */ + + +void fsize(char *) + +/* print file name */ main(int argc, char **argv) { +if (argc == 1) /* default: current directory */ fsize("."); +else +while (--argc > 0) fsize(*++argv); +return 0; } +The function fsizeprints the size of the file. If the file is a directory, however, fsizefirst calls dirwalkto handle all the files in it. Note how the flag names S_IFMTand S_IFDIRare used to decide if the file is a directory. Parenthesization matters, because the precedence of &is lower than that of ==. + +int stat(char *, struct stat *); +void dirwalk(char *, void (*fcn)(char *)); + +/* fsize: print the name of file "name" */ void fsize(char *name) +{ +struct stat stbuf; + +if (stat(name, &stbuf) == -1) { +fprintf(stderr, "fsize: can't access %s\n", name); return; +} +if ((stbuf.st_mode & S_IFMT) == S_IFDIR) dirwalk(name, fsize); +printf("%8ld %s\n", stbuf.st_size, name); } +The function dirwalkis a general routine that applies a function to each file in a directory. It opens the directory, loops through the files in it, calling the function on each, then closes the directory and returns. Since fsize calls dirwalk on each directory, the two functions call each other recursively. + +#define MAX_PATH 1024 + +/* dirwalk: apply fcn to all files in dir */ void dirwalk(char *dir, void (*fcn)(char *)) { +char name[MAX_PATH]; Dirent *dp; +DIR *dfd; +148 + +if ((dfd = opendir(dir)) == NULL) { +fprintf(stderr, "dirwalk: can't open %s\n", dir); return; +} +while ((dp = readdir(dfd)) != NULL) { if (strcmp(dp->name, ".") == 0 +|| strcmp(dp->name, "..")) +continue; /* skip self and parent */ +if (strlen(dir)+strlen(dp->name)+2 > sizeof(name)) fprintf(stderr, "dirwalk: name %s %s too long\n", +dir, dp->name); else { +sprintf(name, "%s/%s", dir, dp->name); (*fcn)(name); +} } +closedir(dfd); } +Each call to readdirreturns a pointer to information for the next file, or NULLwhen there are no files left. Each directory always contains entries for itself, called ".", and its parent, ".."; these must be skipped, or the program will loop forever. +Down to this last level, the code is independent of how directories are formatted. The next step is to present minimal versions of opendir, readdir, and closedirfor a specific system. The following routines are for Version 7 and System V UNIX systems; they use the directory information in the header , which looks like this: + +#ifndef DIRSIZ #define DIRSIZ 14 #endif +struct direct { /* directory entry */ ino_t d_ino; /* inode number */ +char d_name[DIRSIZ]; /* long name does not have '\0' */ }; +Some versions of the system permit much longer names and have a more complicated directory structure. +The type ino_t is a typedef that describes the index into the inode list. It happens to be unsigned shorton the systems we use regularly, but this is not the sort of information to embed in a program; it might be different on a different system, so the typedefis better. A complete set of ``system'' types is found in . + +opendiropens the directory, verifies that the file is a directory (this time by the system call fstat, which is like stat except that it applies to a file descriptor), allocates a directory structure, and records the information: + +int fstat(int fd, struct stat *); + +/* opendir: open a directory for readdir calls */ DIR *opendir(char *dirname) +{ +int fd; +struct stat stbuf; DIR *dp; + +if ((fd = open(dirname, O_RDONLY, 0)) == -1 || fstat(fd, &stbuf) == -1 +|| (stbuf.st_mode & S_IFMT) != S_IFDIR +|| (dp = (DIR *) malloc(sizeof(DIR))) == NULL) return NULL; +dp->fd = fd; return dp; +} +149 + +closedir closes the directory file and frees the space: + +/* closedir: close directory opened by opendir */ void closedir(DIR *dp) +{ +if (dp) { +close(dp->fd); free(dp); +} } +Finally, readdiruses readto read each directory entry. If a directory slot is not currently in use (because a file has been removed), the inode number is zero, and this position is skipped. Otherwise, the inode number and name are placed in a static structure and a pointer to that is returned to the user. Each call overwrites the information from the previous one. + +#include /* local directory structure */ + +/* readdir: read directory entries in sequence */ Dirent *readdir(DIR *dp) +{ +struct direct dirbuf; /* local directory structure */ static Dirent d; /* return: portable structure */ + +while (read(dp->fd, (char *) &dirbuf, sizeof(dirbuf)) == sizeof(dirbuf)) { +if (dirbuf.d_ino == 0) /* slot not in use */ continue; +d.ino = dirbuf.d_ino; +strncpy(d.name, dirbuf.d_name, DIRSIZ); d.name[DIRSIZ] = '\0'; /* ensure termination */ return &d; +} +return NULL; } +Although the fsize program is rather specialized, it does illustrate a couple of important ideas. First, many programs are not ``system programs''; they merely use information that is maintained by the operating system. For such programs, it is crucial that the representation of the information appear only in standard headers, and that programs include those headers instead of embedding the declarations in themselves. The second observation is that with care it is possible to create an interface to system-dependent objects that is itself relatively system-independent. The functions of the standard library are good examples. +Exercise 8-5. Modify the fsizeprogram to print the other information contained in the inode entry. + +8.7 Example - A Storage Allocator +In Chapter 5, we presented a vary limited stack-oriented storage allocator. The version that we will now write is unrestricted. Calls to mallocand freemay occur in any order; malloccalls upon the operating system to obtain more memory as necessary. These routines illustrate some of the considerations involved in writing machine-dependent code in a relatively machine-independent way, and also show a real-life application of structures, unions and typedef. +Rather than allocating from a compiled-in fixed-size array, mallocwill request space from the operating system as needed. Since other activities in the program may also request space without calling this allocator, the space that mallocmanages may not be contiguous. Thus its free storage is kept as a list of free blocks. Each block contains a size, a pointer to the next block, and the space itself. The blocks are kept in order of increasing storage address, and the last block (highest address) points to the first. +150 + + + + + + + + + + + + + + + +When a request is made, the free list is scanned until a big-enough block is found. This algorithm is called ``first fit,'' by contrast with ``best fit,'' which looks for the smallest block that will satisfy the request. If the block is exactly the size requested it is unlinked from the list and returned to the user. If the block is too big, it is split, and the proper amount is returned to the user while the residue remains on the free list. If no big-enough block is found, another large chunk is obtained by the operating system and linked into the free list. + +Freeing also causes a search of the free list, to find the proper place to insert the block being freed. If the block being freed is adjacent to a free block on either side, it is coalesced with it into a single bigger block, so storage does not become too fragmented. Determining the adjacency is easy because the free list is maintained in order of decreasing address. + +One problem, which we alluded to in Chapter 5, is to ensure that the storage returned by mallocis aligned properly for the objects that will be stored in it. Although machines vary, for each machine there is a most restrictive type: if the most restrictive type can be stored at a particular address, all other types may be also. On some machines, the most restrictive type is a double; on others, int or long suffices. + +A free block contains a pointer to the next block in the chain, a record of the size of the block, and then the free space itself; the control information at the beginning is called the ``header.'' To simplify alignment, all blocks are multiples of the header size, and the header is aligned properly. This is achieved by a union that contains the desired header structure and an instance of the most restrictive alignment type, which we have arbitrarily made a long: + +typedef long Align; /* for alignment to long boundary */ + +union header { /* block header */ struct { +union header *ptr; /* next block if on free list */ unsigned size; /* size of this block */ +} s; +Align x; /* force alignment of blocks */ }; + +typedef union header Header; +The Align field is never used; it just forces each header to be aligned on a worst-case boundary. +In malloc, the requested size in characters is rounded up to the proper number of header-sized units; the block that will be allocated contains one more unit, for the header itself, and this is the value recorded in the sizefield of the header. The pointer returned by mallocpoints at the free space, not at the header itself. The user can do anything with the space requested, but if anything is written outside of the allocated space the list is likely to be scrambled. +151 + + + + + + + + + + + + + + +The size field is necessary because the blocks controlled by mallocneed not be contiguous - it is not possible to compute sizes by pointer arithmetic. + +The variable baseis used to get started. If freepis NULL, as it is at the first call of malloc, then a degenerate free list is created; it contains one block of size zero, and points to itself. In any case, the free list is then searched. The search for a free block of adequate size begins at the point (freep) where the last block was found; this strategy helps keep the list homogeneous. If a too-big block is found, the tail end is returned to the user; in this way the header of the original needs only to have its size adjusted. In all cases, the pointer returned to the user points to the free space within the block, which begins one unit beyond the header. + +static Header base; /* empty list to get started */ static Header *freep = NULL; /* start of free list */ + +/* malloc: general-purpose storage allocator */ void *malloc(unsigned nbytes) +{ +Header *p, *prevp; +Header *moreroce(unsigned); unsigned nunits; + +nunits = (nbytes+sizeof(Header)-1)/sizeof(header) + 1; if ((prevp = freep) == NULL) { /* no free list yet */ +base.s.ptr = freeptr = prevptr = &base; base.s.size = 0; +} +for (p = prevp->s.ptr; ; prevp = p, p = p->s.ptr) { if (p->s.size >= nunits) { /* big enough */ +if (p->s.size == nunits) /* exactly */ prevp->s.ptr = p->s.ptr; +else { /* allocate tail end */ p->s.size -= nunits; +p += p->s.size; +p->s.size = nunits; } +freep = prevp; +return (void *)(p+1); } +if (p == freep) /* wrapped around free list */ if ((p = morecore(nunits)) == NULL) +return NULL; /* none left */ } +} +The function morecoreobtains storage from the operating system. The details of how it does this vary from system to system. Since asking the system for memory is a comparatively expensive operation. we don't want to do that on every call to malloc, so morecorerequests al least NALLOCunits; this larger block will be chopped up as needed. After setting the size field, morecore inserts the additional memory into the arena by calling free. +152 + +The UNIX system call sbrk(n)returns a pointer to nmore bytes of storage. sbrkreturns -1 if there was no space, even though NULLcould have been a better design. The -1must be cast to char * so it can be compared with the return value. Again, casts make the function relatively immune to the details of pointer representation on different machines. There is still one assumption, however, that pointers to different blocks returned by sbrk can be meaningfully compared. This is not guaranteed by the standard, which permits pointer comparisons only within an array. Thus this version of malloc is portable only among machines for which general pointer comparison is meaningful. + +#define NALLOC 1024 /* minimum #units to request */ + +/* morecore: ask system for more memory */ static Header *morecore(unsigned nu) +{ +char *cp, *sbrk(int); Header *up; + +if (nu < NALLOC) nu = NALLOC; +cp = sbrk(nu * sizeof(Header)); +if (cp == (char *) -1) /* no space at all */ return NULL; +up = (Header *) cp; up->s.size = nu; free((void *)(up+1)); return freep; +} +freeitself is the last thing. It scans the free list, starting at freep, looking for the place to insert the free block. This is either between two existing blocks or at the end of the list. In any case, if the block being freed is adjacent to either neighbor, the adjacent blocks are combined. The only troubles are keeping the pointers pointing to the right things and the sizes correct. + +/* free: put block ap in free list */ void free(void *ap) +{ +Header *bp, *p; + +bp = (Header *)ap - 1; /* point to block header */ for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) +if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; /* freed block at start or end of arena */ + +if (bp + bp->size == p->s.ptr) { /* join to upper nbr */ bp->s.size += p->s.ptr->s.size; +bp->s.ptr = p->s.ptr->s.ptr; } else +bp->s.ptr = p->s.ptr; +if (p + p->size == bp) { /* join to lower nbr */ p->s.size += bp->s.size; +p->s.ptr = bp->s.ptr; } else +p->s.ptr = bp; freep = p; +} +Although storage allocation is intrinsically machine-dependent, the code above illustrates how the machine dependencies can be controlled and confined to a very small part of the program. The use of typedef and unionhandles alignment (given that sbrk supplies an appropriate pointer). Casts arrange that pointer conversions are made explicit, and even cope with a badly-designed system interface. Even though the details here are related to storage allocation, the general approach is applicable to other situations as well. +153 + +Exercise 8-6. The standard library function calloc(n,size)returns a pointer to nobjects of size size, with the storage initialized to zero. Write calloc, by calling malloc or by modifying it. + +Exercise 8-7. malloc accepts a size request without checking its plausibility; free believes that the block it is asked to free contains a valid size field. Improve these routines so they make more pains with error checking. + +Exercise 8-8. Write a routine bfree(p,n)that will free any arbitrary block pof ncharacters into the free list maintained by mallocand free. By using bfree, a user can add a static or external array to the free list at any time. +154 + + +AppendixA- Reference Manual A.1 Introduction +This manual describes the C language specified by the draft submitted to ANSI on 31 October, 1988, for approval as ``American Standard for Information Systems - programming Language C, X3.159-1989.'' The manual is an interpretation of the proposed standard, not the standard itself, although care has been taken to make it a reliable guide to the language. +For the most part, this document follows the broad outline of the standard, which in turn follows that of the first edition of this book, although the organization differs in detail. Except for renaming a few productions, and not formalizing the definitions of the lexical tokens or the preprocessor, the grammar given here for the language proper is equivalent to that of the standard. +Throughout this manual, commentary material is indented and written in smaller type, as this is. Most often these comments highlight ways in which ANSI Standard C differs from the language defined by the first edition of this book, or from refinements subsequently introduced in various compilers. +A.2 Lexical Conventions +A program consists of one or more translation units stored in files. It is translated in several phases, which are described in Par.A.12. The first phases do low-level lexical transformations, carry out directives introduced by the lines beginning with the # character, and perform macro definition and expansion. When the preprocessing of Par.A.12 is complete, the program has been reduced to a sequence of tokens. +A.2.1 Tokens +There are six classes of tokens: identifiers, keywords, constants, string literals, operators, and other separators. Blanks, horizontal and vertical tabs, newlines, formfeeds and comments as described below (collectively, ``white space'') are ignored except as they separate tokens. Some white space is required to separate otherwise adjacent identifiers, keywords, and constants. +If the input stream has been separated into tokens up to a given character, the next token is the longest string of characters that could constitute a token. + +A.2.2 Comments +The characters /*introduce a comment, which terminates with the characters */. Comments do not nest, and they do not occur within a string or character literals. +A.2.3 Identifiers +An identifier is a sequence of letters and digits. The first character must be a letter; the underscore _counts as a letter. Upper and lower case letters are different. Identifiers may have any length, and for internal identifiers, at least the first 31 characters are significant; some implementations may take more characters significant. Internal identifiers include preprocessor macro names and all other names that do not have external linkage (Par.A.11.2). Identifiers with external linkage are more restricted: implementations may make as few as the first six characters significant, and may ignore case distinctions. +A.2.4 Keywords +The following identifiers are reserved for the use as keywords, and may not be used otherwise: + +auto double int struct break else long switch +155 + +case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while +Some implementations also reserve the words fortran and asm. +The keywords const, signed, and volatileare new with the ANSI standard; enumand void are new since the first edition, but in common use; entry, formerly reserved but never used, is no longer reserved. +A.2.5 Constants +There are several kinds of constants. Each has a data type; Par.A.4.2 discusses the basic types: +constant: +integer-constant character-constant floating-constant enumeration-constant + +A.2.5.1 Integer Constants +An integer constant consisting of a sequence of digits is taken to be octal if it begins with 0 (digit zero), decimal otherwise. Octal constants do not contain the digits 8or 9. A sequence of digits preceded by 0xor 0X(digit zero) is taken to be a hexadecimal integer. The hexadecimal digits include a or A through f or F with values 10 through 15. +An integer constant may be suffixed by the letter uor U, to specify that it is unsigned. It may also be suffixed by the letter l or L to specify that it is long. + +The type of an integer constant depends on its form, value and suffix. (See Par.A.4 for a discussion of types). If it is unsuffixed and decimal, it has the first of these types in which its value can be represented: int, long int, unsigned long int. If it is unsuffixed, octal or hexadecimal, it has the first possible of these types: int, unsigned int, long int, unsigned long int. If it is suffixed by u or U, then unsigned int, unsigned long int. If it is suffixed by lor L, then long int, unsigned long int. If an integer constant is suffixed by UL, it is unsigned long. +The elaboration of the types of integer constants goes considerably beyond the first edition, which merely caused large integer constants to be long. The U suffixes are new. +A.2.5.2 Character Constants +A character constant is a sequence of one or more characters enclosed in single quotes as in 'x'. The value of a character constant with only one character is the numeric value of the character in the machine's character set at execution time. The value of a multi-character constant is implementation-defined. +Character constants do not contain the 'character or newlines; in order to represent them, and certain other characters, the following escape sequences may be used: + +newline NL (LF) \n backslash \ \\ horizontal tab HT \t question mark ? \? + +vertical tab VT +backspace BS + +\v single quote ' \' +\b double quote " \" + +carriage return CR \r octal number ooo\ooo + +formfeed FF +audible alert BEL + +\f hex number hh \xhh +\a +156 + +The escape \oooconsists of the backslash followed by 1, 2, or 3 octal digits, which are taken to specify the value of the desired character. A common example of this construction is \0(not followed by a digit), which specifies the character NUL. The escape \xhh consists of the backslash, followed by x, followed by hexadecimal digits, which are taken to specify the value of the desired character. There is no limit on the number of digits, but the behavior is undefined if the resulting character value exceeds that of the largest character. For either octal or hexadecimal escape characters, if the implementation treats the chartype as signed, the value is sign-extended as if cast to chartype. If the character following the \ is not one of those specified, the behavior is undefined. + +In some implementations, there is an extended set of characters that cannot be represented in the chartype. A constant in this extended set is written with a preceding L, for example L'x', and is called a wide character constant. Such a constant has type wchar_t, an integral type defined in the standard header . As with ordinary character constants, hexadecimal escapes may be used; the effect is undefined if the specified value exceeds that representable with wchar_t. +Some of these escape sequences are new, in particular the hexadecimal character representation. Extended characters are also new. The character sets commonly used in the Americas and western Europe can be encoded to fit in the char type; the main intent in adding wchar_t was to accommodate Asian languages. +A.2.5.3 Floating Constants +A floating constant consists of an integer part, a decimal part, a fraction part, an eor E, an optionally signed integer exponent and an optional type suffix, one of f, F, l, or L. The integer and fraction parts both consist of a sequence of digits. Either the integer part, or the fraction part (not both) may be missing; either the decimal point or the eand the exponent (not both) may be missing. The type is determined by the suffix; For fmakes it float, Lor lmakes it long double, otherwise it is double. +A2.5.4 Enumeration Constants +Identifiers declared as enumerators (see Par.A.8.4) are constants of type int. A.2.6 String Literals +A string literal, also called a string constant, is a sequence of characters surrounded by double quotes as in "...". A string has type ``array of characters'' and storage class static (see Par.A.3 below) and is initialized with the given characters. Whether identical string literals are distinct is implementation-defined, and the behavior of a program that attempts to alter a string literal is undefined. +Adjacent string literals are concatenated into a single string. After any concatenation, a null byte \0is appended to the string so that programs that scan the string can find its end. String literals do not contain newline or double-quote characters; in order to represent them, the same escape sequences as for character constants are available. + +As with character constants, string literals in an extended character set are written with a preceding L, as in L"...". Wide-character string literals have type ``array of wchar_t.'' Concatenation of ordinary and wide string literals is undefined. +The specification that string literals need not be distinct, and the prohibition against modifying them, are new in the ANSI standard, as is the concatenation of adjacent string literals. Wide-character string literals are new. +A.3 Syntax Notation +In the syntax notation used in this manual, syntactic categories are indicated by italic type, and literal words and characters in typewriterstyle. Alternative categories are usually listed on separate lines; in a few cases, a long set of narrow alternatives is presented on one line, marked +157 + +by the phrase ``one of.'' An optional terminal or nonterminal symbol carries the subscript ``opt,'' so that, for example, +{ expressionopt } + +means an optional expression, enclosed in braces. The syntax is summarized in Par.A.13. +Unlike the grammar given in the first edition of this book, the one given here makes precedence and associativity of expression operators explicit. +A.4 Meaning of Identifiers +Identifiers, or names, refer to a variety of things: functions; tags of structures, unions, and enumerations; members of structures or unions; enumeration constants; typedef names; and objects. An object, sometimes called a variable, is a location in storage, and its interpretation depends on two main attributes: its storage class and its type. The storage class determines the lifetime of the storage associated with the identified object; the type determines the meaning of the values found in the identified object. A name also has a scope, which is the region of the program in which it is known, and a linkage, which determines whether the same name in another scope refers to the same object or function. Scope and linkage are discussed in Par.A.11. +A.4.1 Storage Class +There are two storage classes: automatic and static. Several keywords, together with the context of an object's declaration, specify its storage class. Automatic objects are local to a block (Par.9.3), and are discarded on exit from the block. Declarations within a block create automatic objects if no storage class specification is mentioned, or if the autospecifier is used. Objects declared registerare automatic, and are (if possible) stored in fast registers of the machine. +Static objects may be local to a block or external to all blocks, but in either case retain their values across exit from and reentry to functions and blocks. Within a block, including a block that provides the code for a function, static objects are declared with the keyword static. The objects declared outside all blocks, at the same level as function definitions, are always static. They may be made local to a particular translation unit by use of the statickeyword; this gives them internal linkage. They become global to an entire program by omitting an explicit storage class, or by using the keyword extern; this gives them external linkage. + +A.4.2 Basic Types +There are several fundamental types. The standard header described in Appendix B defines the largest and smallest values of each type in the local implementation. The numbers given in Appendix B show the smallest acceptable magnitudes. +Objects declared as characters (char) are large enough to store any member of the execution character set. If a genuine character from that set is stored in a char object, its value is equivalent to the integer code for the character, and is non-negative. Other quantities may be stored into char variables, but the available range of values, and especially whether the value is signed, is implementation-dependent. + +Unsigned characters declared unsigned char consume the same amount of space as plain characters, but always appear non-negative; explicitly signed characters declared signed char likewise take the same space as plain characters. +unsigned chartype does not appear in the first edition of this book, but is in common use. signed char is new. +Besides the chartypes, up to three sizes of integer, declared short int, int, and long int, are available. Plain int objects have the natural size suggested by the host machine +158 + +architecture; the other sizes are provided to meet special needs. Longer integers provide at least as much storage as shorter ones, but the implementation may make plain integers equivalent to either short integers, or long integers. The inttypes all represent signed values unless specified otherwise. + +Unsigned integers, declared using the keyword unsigned, obey the laws of arithmetic modulo 2n where n is the number of bits in the representation, and thus arithmetic on unsigned quantities can never overflow. The set of non-negative values that can be stored in a signed object is a subset of the values that can be stored in the corresponding unsigned object, and the representation for the overlapping values is the same. + +Any of single precision floating point (float), double precision floating point (double), and extra precision floating point (long double) may be synonymous, but the ones later in the list are at least as precise as those before. +long doubleis new. The first edition made long floatequivalent to double; the locution has been withdrawn. +Enumerations are unique types that have integral values; associated with each enumeration is a set of named constants (Par.A.8.4). Enumerations behave like integers, but it is common for a compiler to issue a warning when an object of a particular enumeration is assigned something other than one of its constants, or an expression of its type. + +Because objects of these types can be interpreted as numbers, they will be referred to as arithmetic types. Types char, and int of all sizes, each with or without sign, and also enumeration types, will collectively be called integral types. The types float, double, and long double will be called floating types. + +The voidtype specifies an empty set of values. It is used as the type returned by functions that generate no value. + +A.4.3 Derived types +Beside the basic types, there is a conceptually infinite class of derived types constructed from the fundamental types in the following ways: +arrays of objects of a given type; functions returning objects of a given type; pointers to objects of a given type; +structures containing a sequence of objects of various types; +unions capable of containing any of one of several objects of various types. + +In general these methods of constructing objects can be applied recursively. + +A.4.4 Type Qualifiers +An object's type may have additional qualifiers. Declaring an object constannounces that its value will not be changed; declaring it volatile announces that it has special properties relevant to optimization. Neither qualifier affects the range of values or arithmetic properties of the object. Qualifiers are discussed in Par.A.8.2. +A.5 Objects and Lvalues +An Object is a named region of storage; an lvalue is an expression referring to an object. An obvious example of an lvalue expression is an identifier with suitable type and storage class. There are operators that yield lvalues, if Eis an expression of pointer type, then *Eis an lvalue expression referring to the object to which E points. The name ``lvalue'' comes from the assignment expression E1 = E2in which the left operand E1must be an lvalue expression. The +159 + +discussion of each operator specifies whether it expects lvalue operands and whether it yields an lvalue. +A.6 Conversions +Some operators may, depending on their operands, cause conversion of the value of an operand from one type to another. This section explains the result to be expected from such conversions. Par.6.5 summarizes the conversions demanded by most ordinary operators; it will be supplemented as required by the discussion of each operator. +A.6.1 Integral Promotion +A character, a short integer, or an integer bit-field, all either signed or not, or an object of enumeration type, may be used in an expression wherever an integer may be used. If an int can represent all the values of the original type, then the value is converted to int; otherwise the value is converted to unsigned int. This process is called integral promotion. +A.6.2 Integral Conversions +Any integer is converted to a given unsigned type by finding the smallest non-negative value that is congruent to that integer, modulo one more than the largest value that can be represented in the unsigned type. In a two's complement representation, this is equivalent to left-truncation if the bit pattern of the unsigned type is narrower, and to zero-filling unsigned values and sign-extending signed values if the unsigned type is wider. +When any integer is converted to a signed type, the value is unchanged if it can be represented in the new type and is implementation-defined otherwise. + +A.6.3 Integer and Floating +When a value of floating type is converted to integral type, the fractional part is discarded; if the resulting value cannot be represented in the integral type, the behavior is undefined. In particular, the result of converting negative floating values to unsigned integral types is not specified. +When a value of integral type is converted to floating, and the value is in the representable range but is not exactly representable, then the result may be either the next higher or next lower representable value. If the result is out of range, the behavior is undefined. + +A.6.4 Floating Types +When a less precise floating value is converted to an equally or more precise floating type, the value is unchanged. When a more precise floating value is converted to a less precise floating type, and the value is within representable range, the result may be either the next higher or the next lower representable value. If the result is out of range, the behavior is undefined. +A.6.5 Arithmetic Conversions +Many operators cause conversions and yield result types in a similar way. The effect is to bring operands into a common type, which is also the type of the result. This pattern is called the usual arithmetic conversions. +· First, if either operand is long double, the other is converted to long double. + +· Otherwise, if either operand is double, the other is converted to double. + +· Otherwise, if either operand is float, the other is converted to float. + +· Otherwise, the integral promotions are performed on both operands; then, if either operand is unsigned long int, the other is converted to unsigned long int. +160 + +· Otherwise, if one operand is long int and the other is unsigned int, the effect depends on whether a long intcan represent all values of an unsigned int; if so, the unsigned intoperand is converted to long int; if not, both are converted to unsigned long int. + +· Otherwise, if one operand is long int, the other is converted to long int. + +· Otherwise, if either operand is unsigned int, the other is converted to unsigned int. + +· Otherwise, both operands have type int. +There are two changes here. First, arithmetic on floatoperands may be done in single precision, rather than double; the first edition specified that all floating arithmetic was double precision. Second, shorter unsigned types, when combined with a larger signed type, do not propagate the unsigned property to the result type; in the first edition, the unsigned always dominated. The new rules are slightly more complicated, but reduce somewhat the surprises that may occur when an unsigned quantity meets signed. Unexpected results may still occur when an unsigned expression is compared to a signed expression of the same size. +A.6.6 Pointers and Integers +An expression of integral type may be added to or subtracted from a pointer; in such a case the integral expression is converted as specified in the discussion of the addition operator (Par.A.7.7). +Two pointers to objects of the same type, in the same array, may be subtracted; the result is converted to an integer as specified in the discussion of the subtraction operator (Par.A.7.7). + +An integral constant expression with value 0, or such an expression cast to type void *, may be converted, by a cast, by assignment, or by comparison, to a pointer of any type. This produces a null pointer that is equal to another null pointer of the same type, but unequal to any pointer to a function or object. + +Certain other conversions involving pointers are permitted, but have implementation-defined aspects. They must be specified by an explicit type-conversion operator, or cast (Pars.A.7.5 and A.8.8). + +A pointer may be converted to an integral type large enough to hold it; the required size is implementation-dependent. The mapping function is also implementation-dependent. + +A pointer to one type may be converted to a pointer to another type. The resulting pointer may cause addressing exceptions if the subject pointer does not refer to an object suitably aligned in storage. It is guaranteed that a pointer to an object may be converted to a pointer to an object whose type requires less or equally strict storage alignment and back again without change; the notion of ``alignment'' is implementation-dependent, but objects of the chartypes have least strict alignment requirements. As described in Par.A.6.8, a pointer may also be converted to type void * and back again without change. + +A pointer may be converted to another pointer whose type is the same except for the addition or removal of qualifiers (Pars.A.4.4, A.8.2) of the object type to which the pointer refers. If qualifiers are added, the new pointer is equivalent to the old except for restrictions implied by the new qualifiers. If qualifiers are removed, operations on the underlying object remain subject to the qualifiers in its actual declaration. + +Finally, a pointer to a function may be converted to a pointer to another function type. Calling the function specified by the converted pointer is implementation-dependent; however, if the converted pointer is reconverted to its original type, the result is identical to the original pointer. +161 + +A.6.7 Void +The (nonexistent) value of a voidobject may not be used in any way, and neither explicit nor implicit conversion to any non-void type may be applied. Because a void expression denotes a nonexistent value, such an expression may be used only where the value is not required, for example as an expression statement (Par.A.9.2) or as the left operand of a comma operator (Par.A.7.18). +An expression may be converted to type voidby a cast. For example, a void cast documents the discarding of the value of a function call used as an expression statement. +void did not appear in the first edition of this book, but has become common since. A.6.8 Pointers to Void +Any pointer to an object may be converted to type void *without loss of information. If the result is converted back to the original pointer type, the original pointer is recovered. Unlike the pointer-to-pointer conversions discussed in Par.A.6.6, which generally require an explicit cast, pointers may be assigned to and from pointers of type void *, and may be compared with them. +This interpretation of void *pointers is new; previously, char *pointers played the role of generic pointer. The ANSI standard specifically blesses the meeting of void *pointers with object pointers in assignments and relationals, while requiring explicit casts for other pointer mixtures. +A.7 Expressions +The precedence of expression operators is the same as the order of the major subsections of this section, highest precedence first. Thus, for example, the expressions referred to as the operands of + (Par.A.7.7) are those expressions defined in Pars.A.7.1-A.7.6. Within each subsection, the operators have the same precedence. Left- or right-associativity is specified in each subsection for the operators discussed therein. The grammar given in Par.13 incorporates the precedence and associativity of the operators. +The precedence and associativity of operators is fully specified, but the order of evaluation of expressions is, with certain exceptions, undefined, even if the subexpressions involve side effects. That is, unless the definition of the operator guarantees that its operands are evaluated in a particular order, the implementation is free to evaluate operands in any order, or even to interleave their evaluation. However, each operator combines the values produced by its operands in a way compatible with the parsing of the expression in which it appears. +This rule revokes the previous freedom to reorder expressions with operators that are mathematically commutative and associative, but can fail to be computationally associative. The change affects only floating-point computations near the limits of their accuracy, and situations where overflow is possible. +The handling of overflow, divide check, and other exceptions in expression evaluation is not defined by the language. Most existing implementations of C ignore overflow in evaluation of signed integral expressions and assignments, but this behavior is not guaranteed. Treatment of division by 0, and all floating-point exceptions, varies among implementations; sometimes it is adjustable by a non-standard library function. + +A.7.1 Pointer Conversion +If the type of an expression or subexpression is ``array of T,'' for some type T, then the value of the expression is a pointer to the first object in the array, and the type of the expression is altered to ``pointer to T.'' This conversion does not take place if the expression is in the operand of the unary &operator, or of ++, --, sizeof, or as the left operand of an assignment operator or the . operator. Similarly, an expression of type ``function returning T,'' except when used as the operand of the & operator, is converted to ``pointer to function returning T.'' +A.7.2 Primary Expressions +162 + +Primary expressions are identifiers, constants, strings, or expressions in parentheses. +primary-expression identifier constant +string (expression) + +An identifier is a primary expression, provided it has been suitably declared as discussed below. Its type is specified by its declaration. An identifier is an lvalue if it refers to an object (Par.A.5) and if its type is arithmetic, structure, union, or pointer. + +A constant is a primary expression. Its type depends on its form as discussed in Par.A.2.5. + +A string literal is a primary expression. Its type is originally ``array of char'' (for wide-char strings, ``array of wchar_t''), but following the rule given in Par.A.7.1, this is usually modified to ``pointer to char'' (wchar_t) and the result is a pointer to the first character in the string. The conversion also does not occur in certain initializers; see Par.A.8.7. + +A parenthesized expression is a primary expression whose type and value are identical to those of the unadorned expression. The precedence of parentheses does not affect whether the expression is an lvalue. + +A.7.3 Postfix Expressions +The operators in postfix expressions group left to right. +postfix-expression: primary-expression +postfix-expression[expression] +postfix-expression(argument-expression-listopt) postfix-expression.identifier +postfix-expression->identifier postfix-expression++ +postfix-expression-- + +argument-expression-list: assignment-expression +assignment-expression-list , assignment-expression + +A.7.3.1 Array References +A postfix expression followed by an expression in square brackets is a postfix expression denoting a subscripted array reference. One of the two expressions must have type ``pointer to T'', where T is some type, and the other must have integral type; the type of the subscript expression is T. The expression E1[E2] is identical (by definition) to *((E1)+(E2)). See Par.A.8.6.2 for further discussion. +A.7.3.2 Function Calls +A function call is a postfix expression, called the function designator, followed by parentheses containing a possibly empty, comma-separated list of assignment expressions (Par.A7.17), which constitute the arguments to the function. If the postfix expression consists of an identifier for which no declaration exists in the current scope, the identifier is implicitly declared as if the declaration +extern intidentifier(); +163 + +had been given in the innermost block containing the function call. The postfix expression (after possible explicit declaration and pointer generation, Par.A7.1) must be of type ``pointer to function returning T,'' for some type T, and the value of the function call has type T. +In the first edition, the type was restricted to ``function,'' and an explicit *operator was required to call through pointers to functions. The ANSI standard blesses the practice of some existing compilers by permitting the same syntax for calls to functions and to functions specified by pointers. The older syntax is still usable. +The term argument is used for an expression passed by a function call; the term parameter is used for an input object (or its identifier) received by a function definition, or described in a function declaration. The terms ``actual argument (parameter)'' and ``formal argument (parameter)'' respectively are sometimes used for the same distinction. + +In preparing for the call to a function, a copy is made of each argument; all argument-passing is strictly by value. A function may change the values of its parameter objects, which are copies of the argument expressions, but these changes cannot affect the values of the arguments. However, it is possible to pass a pointer on the understanding that the function may change the value of the object to which the pointer points. + +There are two styles in which functions may be declared. In the new style, the types of parameters are explicit and are part of the type of the function; such a declaration os also called a function prototype. In the old style, parameter types are not specified. Function declaration is issued in Pars.A.8.6.3 and A.10.1. + +If the function declaration in scope for a call is old-style, then default argument promotion is applied to each argument as follows: integral promotion (Par.A.6.1) is performed on each argument of integral type, and each floatargument is converted to double. The effect of the call is undefined if the number of arguments disagrees with the number of parameters in the definition of the function, or if the type of an argument after promotion disagrees with that of the corresponding parameter. Type agreement depends on whether the function's definition is new-style or old-style. If it is old-style, then the comparison is between the promoted type of the arguments of the call, and the promoted type of the parameter, if the definition is new-style, the promoted type of the argument must be that of the parameter itself, without promotion. + +If the function declaration in scope for a call is new-style, then the arguments are converted, as if by assignment, to the types of the corresponding parameters of the function's prototype. The number of arguments must be the same as the number of explicitly described parameters, unless the declaration's parameter list ends with the ellipsis notation (, ...). In that case, the number of arguments must equal or exceed the number of parameters; trailing arguments beyond the explicitly typed parameters suffer default argument promotion as described in the preceding paragraph. If the definition of the function is old-style, then the type of each parameter in the definition, after the definition parameter's type has undergone argument promotion. +These rules are especially complicated because they must cater to a mixture of old- and new-style functions. Mixtures are to be avoided if possible. +The order of evaluation of arguments is unspecified; take note that various compilers differ. However, the arguments and the function designator are completely evaluated, including all side effects, before the function is entered. Recursive calls to any function are permitted. + +A.7.3.3 Structure References +A postfix expression followed by a dot followed by an identifier is a postfix expression. The first operand expression must be a structure or a union, and the identifier must name a member of the structure or union. The value is the named member of the structure or union, and its +164 + +type is the type of the member. The expression is an lvalue if the first expression is an lvalue, and if the type of the second expression is not an array type. +A postfix expression followed by an arrow (built from -and >) followed by an identifier is a postfix expression. The first operand expression must be a pointer to a structure or union, and the identifier must name a member of the structure or union. The result refers to the named member of the structure or union to which the pointer expression points, and the type is the type of the member; the result is an lvalue if the type is not an array type. + +Thus the expression E1->MOS is the same as (*E1).MOS. Structures and unions are discussed in Par.A.8.3. +In the first edition of this book, it was already the rule that a member name in such an expression had to belong to the structure or union mentioned in the postfix expression; however, a note admitted that this rule was not firmly enforced. Recent compilers, and ANSI, do enforce it. +A.7.3.4 Postfix Incrementation +A postfix expression followed by a ++or --operator is a postfix expression. The value of the expression is the value of the operand. After the value is noted, the operand is incremented ++ or decremented -- by 1. The operand must be an lvalue; see the discussion of additive operators (Par.A.7.7) and assignment (Par.A.7.17) for further constraints on the operand and details of the operation. The result is not an lvalue. +A.7.4 Unary Operators +Expressions with unary operators group right-to-left. +unary-expression: postfix expression ++unary expression --unary expression +unary-operator cast-expression sizeofunary-expression sizeof(type-name) + +unary operator: one of & * + - ~ ! + +A.7.4.1 Prefix Incrementation Operators +A unary expression followed by a ++ or -- operator is a unary expression. The operand is incremented ++ or decremented -- by 1. The value of the expression is the value after the incrementation (decrementation). The operand must be an lvalue; see the discussion of additive operators (Par.A.7.7) and assignment (Par.A.7.17) for further constraints on the operands and details of the operation. The result is not an lvalue. +A.7.4.2 Address Operator +The unary operator &takes the address of its operand. The operand must be an lvalue referring neither to a bit-field nor to an object declared as register, or must be of function type. The result is a pointer to the object or function referred to by the lvalue. If the type of the operand is T, the type of the result is ``pointer to T.'' +A.7.4.3 Indirection Operator +The unary * operator denotes indirection, and returns the object or function to which its operand points. It is an lvalue if the operand is a pointer to an object of arithmetic, structure, union, or pointer type. If the type of the expression is ``pointer to T,'' the type of the result is T. +A.7.4.4 Unary Plus Operator +165 + +The operand of the unary +operator must have arithmetic type, and the result is the value of the operand. An integral operand undergoes integral promotion. The type of the result is the type of the promoted operand. +The unary + is new with the ANSI standard. It was added for symmetry with the unary -. +A.7.4.5 Unary Minus Operator +The operand of the unary -operator must have arithmetic type, and the result is the negative of its operand. An integral operand undergoes integral promotion. The negative of an unsigned quantity is computed by subtracting the promoted value from the largest value of the promoted type and adding one; but negative zero is zero. The type of the result is the type of the promoted operand. +A.7.4.6 One's Complement Operator +The operand of the ~operator must have integral type, and the result is the one's complement of its operand. The integral promotions are performed. If the operand is unsigned, the result is computed by subtracting the value from the largest value of the promoted type. If the operand is signed, the result is computed by converting the promoted operand to the corresponding unsigned type, applying ~, and converting back to the signed type. The type of the result is the type of the promoted operand. +A.7.4.7 Logical Negation Operator +The operand of the !operator must have arithmetic type or be a pointer, and the result is 1 if the value of its operand compares equal to 0, and 0 otherwise. The type of the result is int. +A.7.4.8 Sizeof Operator +The sizeofoperator yields the number of bytes required to store an object of the type of its operand. The operand is either an expression, which is not evaluated, or a parenthesized type name. When sizeofis applied to a char, the result is 1; when applied to an array, the result is the total number of bytes in the array. When applied to a structure or union, the result is the number of bytes in the object, including any padding required to make the object tile an array: the size of an array of n elements is n times the size of one element. The operator may not be applied to an operand of function type, or of incomplete type, or to a bit-field. The result is an unsigned integral constant; the particular type is implementation-defined. The standard header (See appendix B) defines this type as size_t. +A.7.5 Casts +A unary expression preceded by the parenthesized name of a type causes conversion of the value of the expression to the named type. +cast-expression: unary expression +(type-name) cast-expression + +This construction is called a cast. The names are described in Par.A.8.8. The effects of conversions are described in Par.A.6. An expression with a cast is not an lvalue. + +A.7.6 Multiplicative Operators +The multiplicative operators *, /, and % group left-to-right. +multiplicative-expression: +multiplicative-expression *cast-expression multiplicative-expression /cast-expression multiplicative-expression %cast-expression +166 + +The operands of *and /must have arithmetic type; the operands of %must have integral type. The usual arithmetic conversions are performed on the operands, and predict the type of the result. + +The binary * operator denotes multiplication. + +The binary /operator yields the quotient, and the %operator the remainder, of the division of the first operand by the second; if the second operand is 0, the result is undefined. Otherwise, it is always true that (a/b)*b + a%bis equal to a. If both operands are non-negative, then the remainder is non-negative and smaller than the divisor, if not, it is guaranteed only that the absolute value of the remainder is smaller than the absolute value of the divisor. + +A.7.7 Additive Operators +The additive operators +and -group left-to-right. If the operands have arithmetic type, the usual arithmetic conversions are performed. There are some additional type possibilities for each operator. +additive-expression: multiplicative-expression +additive-expression +multiplicative-expression additive-expression -multiplicative-expression + +The result of the +operator is the sum of the operands. A pointer to an object in an array and a value of any integral type may be added. The latter is converted to an address offset by multiplying it by the size of the object to which the pointer points. The sum is a pointer of the same type as the original pointer, and points to another object in the same array, appropriately offset from the original object. Thus if Pis a pointer to an object in an array, the expression P+1is a pointer to the next object in the array. If the sum pointer points outside the bounds of the array, except at the first location beyond the high end, the result is undefined. +The provision for pointers just beyond the end of an array is new. It legitimizes a common idiom for looping over the elements of an array. +The result of the -operator is the difference of the operands. A value of any integral type may be subtracted from a pointer, and then the same conversions and conditions as for addition apply. + +If two pointers to objects of the same type are subtracted, the result is a signed integral value representing the displacement between the pointed-to objects; pointers to successive objects differ by 1. The type of the result is defined as ptrdiff_tin the standard header . The value is undefined unless the pointers point to objects within the same array; however, if P points to the last member of an array, then (P+1)-P has value 1. + +A.7.8 Shift Operators +The shift operators <>group left-to-right. For both operators, each operand must be integral, and is subject to integral the promotions. The type of the result is that of the promoted left operand. The result is undefined if the right operand is negative, or greater than or equal to the number of bits in the left expression's type. +shift-expression: additive-expression +shift-expression <>additive-expression + +The value of E1<>E2is E1right-shifted E2 +167 + +bit positions. The right shift is equivalent to division by 2E2 if E1is unsigned or it has a non-negative value; otherwise the result is implementation-defined. + +A.7.9 Relational Operators +The relational operators group left-to-right, but this fact is not useful; ashift-expression relational-expression <=shift-expression relational-expression >=shift-expression + +The operators <(less), >(greater), <=(less or equal) and >=(greater or equal) all yield 0 if the specified relation is false and 1 if it is true. The type of the result is int. The usual arithmetic conversions are performed on arithmetic operands. Pointers to objects of the same type (ignoring any qualifiers) may be compared; the result depends on the relative locations in the address space of the pointed-to objects. Pointer comparison is defined only for parts of the same object; if two pointers point to the same simple object, they compare equal; if the pointers are to members of the same structure, pointers to objects declared later in the structure compare higher; if the pointers refer to members of an array, the comparison is equivalent to comparison of the the corresponding subscripts. If Ppoints to the last member of an array, then P+1 compares higher than P, even though P+1 points outside the array. Otherwise, pointer comparison is undefined. +These rules slightly liberalize the restrictions stated in the first edition, by permitting comparison of pointers to different members of a structure or union. They also legalize comparison with a pointer just off the end of an array. +A.7.10 Equality Operators +equality-expression: relational-expression +equality-expression ==relational-expression equality-expression !=relational-expression +The ==(equal to) and the !=(not equal to) operators are analogous to the relational operators except for their lower precedence. (Thus a>= &= ^= |= + +All require an lvalue as left operand, and the lvalue must be modifiable: it must not be an array, and must not have an incomplete type, or be a function. Also, its type must not be qualified with const; if it is a structure or union, it must not have any member or, recursively, submember qualified with const. The type of an assignment expression is that of its left operand, and the value is the value stored in the left operand after the assignment has taken place. + +In the simple assignment with =, the value of the expression replaces that of the object referred to by the lvalue. One of the following must be true: both operands have arithmetic type, in which case the right operand is converted to the type of the left by the assignment; or both operands are structures or unions of the same type; or one operand is a pointer and the other is a pointer to void, or the left operand is a pointer and the right operand is a constant expression with value 0; or both operands are pointers to functions or objects whose types are the same except for the possible absence of const or volatile in the right operand. + +An expression of the form E1 op= E2is equivalent to E1 = E1 op (E2)except that E1is evaluated only once. + +A.7.18 Comma Operator +expression: +assignment-expression +expression ,assignment-expression +A pair of expressions separated by a comma is evaluated left-to-right, and the value of the left expression is discarded. The type and value of the result are the type and value of the right operand. All side effects from the evaluation of the left-operand are completed before beginning the evaluation of the right operand. In contexts where comma is given a special meaning, for example in lists of function arguments (Par.A.7.3.2) and lists of initializers (Par.A.8.7), the required syntactic unit is an assignment expression, so the comma operator appears only in a parenthetical grouping, for example, + +f(a, (t=3, t+2), c) +has three arguments, the second of which has the value 5. +A.7.19 Constant Expressions +Syntactically, a constant expression is an expression restricted to a subset of operators: +constant-expression: conditional-expression +170 + +Expressions that evaluate to a constant are required in several contexts: after case, as array bounds and bit-field lengths, as the value of an enumeration constant, in initializers, and in certain preprocessor expressions. + +Constant expressions may not contain assignments, increment or decrement operators, function calls, or comma operators; except in an operand of sizeof. If the constant expression is required to be integral, its operands must consist of integer, enumeration, character, and floating constants; casts must specify an integral type, and any floating constants must be cast to integer. This necessarily rules out arrays, indirection, address-of, and structure member operations. (However, any operand is permitted for sizeof.) + +More latitude is permitted for the constant expressions of initializers; the operands may be any type of constant, and the unary &operator may be applied to external or static objects, and to external and static arrays subscripted with a constant expression. The unary &operator can also be applied implicitly by appearance of unsubscripted arrays and functions. Initializers must evaluate either to a constant or to the address of a previously declared external or static object plus or minus a constant. + +Less latitude is allowed for the integral constant expressions after #if; sizeofexpressions, enumeration constants, and casts are not permitted. See Par.A.12.5. + +A.8 Declarations +Declarations specify the interpretation given to each identifier; they do not necessarily reserve storage associated with the identifier. Declarations that reserve storage are called definitions. Declarations have the form +declaration: +declaration-specifiers init-declarator-listopt; + +The declarators in the init-declarator list contain the identifiers being declared; the declaration-specifiers consist of a sequence of type and storage class specifiers. + +declaration-specifiers: +storage-class-specifier declaration-specifiersopt type-specifier declaration-specifiersopt +type-qualifier declaration-specifiersopt + +init-declarator-list: init-declarator +init-declarator-list ,init-declarator + +init-declarator: declarator +declarator =initializer + +Declarators will be discussed later (Par.A.8.5); they contain the names being declared. A declaration must have at least one declarator, or its type specifier must declare a structure tag, a union tag, or the members of an enumeration; empty declarations are not permitted. + +A.8.1 Storage Class Specifiers The storage class specifiers are: +storage-class specifier: auto +register +171 + +static extern typedef + +The meaning of the storage classes were discussed in Par.A.4.4. + +The autoand registerspecifiers give the declared objects automatic storage class, and may be used only within functions. Such declarations also serve as definitions and cause storage to be reserved. A registerdeclaration is equivalent to an autodeclaration, but hints that the declared objects will be accessed frequently. Only a few objects are actually placed into registers, and only certain types are eligible; the restrictions are implementation-dependent. However, if an object is declared register, the unary &operator may not be applied to it, explicitly or implicitly. +The rule that it is illegal to calculate the address of an object declared register, but actually taken to be auto, is new. +The staticspecifier gives the declared objects static storage class, and may be used either inside or outside functions. Inside a function, this specifier causes storage to be allocated, and serves as a definition; for its effect outside a function, see Par.A.11.2. + +A declaration with extern, used inside a function, specifies that the storage for the declared objects is defined elsewhere; for its effects outside a function, see Par.A.11.2. + +The typedefspecifier does not reserve storage and is called a storage class specifier only for syntactic convenience; it is discussed in Par.A.8.9. + +At most one storage class specifier may be given in a declaration. If none is given, these rules are used: objects declared inside a function are taken to be auto; functions declared within a function are taken to be extern; objects and functions declared outside a function are taken to be static, with external linkage. See Pars. A.10-A.11. + +A.8.2 Type Specifiers The type-specifiers are +type specifier: void +char short int long float double signed +unsigned +struct-or-union-specifier enum-specifier +typedef-name + +At most one of the words longor shortmay be specified together with int; the meaning is the same if intis not mentioned. The word longmay be specified together with double. At most one of signedor unsignedmay be specified together with intor any of its shortor longvarieties, or with char. Either may appear alone in which case intis understood. The signed specifier is useful for forcing char objects to carry a sign; it is permissible but redundant with other integral types. +172 + +Otherwise, at most one type-specifier may be given in a declaration. If the type-specifier is missing from a declaration, it is taken to be int. + +Types may also be qualified, to indicate special properties of the objects being declared. + +type-qualifier: const volatile + +Type qualifiers may appear with any type specifier. A constobject may be initialized, but not thereafter assigned to. There are no implementation-dependent semantics for volatile objects. +The constand volatileproperties are new with the ANSI standard. The purpose of constis to announce objects that may be placed in read-only memory, and perhaps to increase opportunities for optimization. The purpose of volatileis to force an implementation to suppress optimization that could otherwise occur. For example, for a machine with memory-mapped input/output, a pointer to a device register might be declared as a pointer to volatile, in order to prevent the compiler from removing apparently redundant references through the pointer. Except that it should diagnose explicit attempts to change const objects, a compiler may ignore these qualifiers. +A.8.3 Structure and Union Declarations +A structure is an object consisting of a sequence of named members of various types. A union is an object that contains, at different times, any of several members of various types. Structure and union specifiers have the same form. +struct-or-union-specifier: +struct-or-union identifieropt{struct-declaration-list } struct-or-union identifier + +struct-or-union: struct union + +A struct-declaration-list is a sequence of declarations for the members of the structure or union: + +struct-declaration-list: struct declaration +struct-declaration-list struct declaration + +struct-declaration: specifier-qualifier-list struct-declarator-list; + +specifier-qualifier-list: +type-specifier specifier-qualifier-listopt type-qualifier specifier-qualifier-listopt + +struct-declarator-list: struct-declarator +struct-declarator-list ,struct-declarator + +Usually, a struct-declarator is just a declarator for a member of a structure or union. A structure member may also consist of a specified number of bits. Such a member is also called a bit-field; its length is set off from the declarator for the field name by a colon. + +struct-declarator: +declarator declaratoropt :constant-expression +173 + +A type specifier of the form + +struct-or-union identifier {struct-declaration-list } + +declares the identifier to be the tag of the structure or union specified by the list. A subsequent declaration in the same or an inner scope may refer to the same type by using the tag in a specifier without the list: + +struct-or-union identifier + +If a specifier with a tag but without a list appears when the tag is not declared, an incomplete type is specified. Objects with an incomplete structure or union type may be mentioned in contexts where their size is not needed, for example in declarations (not definitions), for specifying a pointer, or for creating a typedef, but not otherwise. The type becomes complete on occurrence of a subsequent specifier with that tag, and containing a declaration list. Even in specifiers with a list, the structure or union type being declared is incomplete within the list, and becomes complete only at the } terminating the specifier. + +A structure may not contain a member of incomplete type. Therefore, it is impossible to declare a structure or union containing an instance of itself. However, besides giving a name to the structure or union type, tags allow definition of self-referential structures; a structure or union may contain a pointer to an instance of itself, because pointers to incomplete types may be declared. + +A very special rule applies to declarations of the form + +struct-or-union identifier; + +that declare a structure or union, but have no declaration list and no declarators. Even if the identifier is a structure or union tag already declared in an outer scope (Par.A.11.1), this declaration makes the identifier the tag of a new, incompletely-typed structure or union in the current scope. +This recondite is new with ANSI. It is intended to deal with mutually-recursive structures declared in an inner scope, but whose tags might already be declared in the outer scope. +A structure or union specifier with a list but no tag creates a unique type; it can be referred to directly only in the declaration of which it is a part. + +The names of members and tags do not conflict with each other or with ordinary variables. A member name may not appear twice in the same structure or union, but the same member name may be used in different structures or unions. +In the first edition of this book, the names of structure and union members were not associated with their parent. However, this association became common in compilers well before the ANSI standard. +A non-field member of a structure or union may have any object type. A field member (which need not have a declarator and thus may be unnamed) has type int, unsigned int, or signed int, and is interpreted as an object of integral type of the specified length in bits; whether an int field is treated as signed is implementation-dependent. Adjacent field members of structures are packed into implementation-dependent storage units in an implementation-dependent direction. When a field following another field will not fit into a partially-filled storage unit, it may be split between units, or the unit may be padded. An unnamed field with width 0 forces this padding, so that the next field will begin at the edge of the next allocation unit. +The ANSI standard makes fields even more implementation-dependent than did the first edition. It is advisable to read the language rules for storing bit-fields as ``implementation-dependent'' without qualification. Structures with bit-fields may be used as a portable way of attempting to reduce the storage required for a structure (with the probable cost of increasing the instruction space, and time, +174 + +needed to access the fields), or as a non-portable way to describe a storage layout known at the bit-level. In the second case, it is necessary to understand the rules of the local implementation. +The members of a structure have addresses increasing in the order of their declarations. A non-field member of a structure is aligned at an addressing boundary depending on its type; therefore, there may be unnamed holes in a structure. If a pointer to a structure is cast to the type of a pointer to its first member, the result refers to the first member. + +A union may be thought of as a structure all of whose members begin at offset 0 and whose size is sufficient to contain any of its members. At most one of the members can be stored in a union at any time. If a pointr to a union is cast to the type of a pointer to a member, the result refers to that member. + +A simple example of a structure declaration is + +struct tnode { +char tword[20]; int count; +struct tnode *left; struct tnode *right; +} +which contains an array of 20 characters, an integer, and two pointers to similar structures. Once this declaration has bene given, the declaration + +struct tnode s, *sp; +declares sto be a structure of the given sort, and spto be a pointer to a structure of the given sort. With these declarations, the expression + +sp->count +refers to the count field of the structure to which sp points; + +s.left +refers to the left subtree pointer of the structure s, and + +s.right->tword[0] +refers to the first character of the tword member of the right subtree of s. +In general, a member of a union may not be inspected unless the value of the union has been assigned using the same member. However, one special guarantee simplifies the use of unions: if a union contains several structures that share a common initial sequence, and the union currently contains one of these structures, it is permitted to refer to the common initial part of any of the contained structures. For example, the following is a legal fragment: + +union { struct { +int type; } n; +struct { +int type; int intnode; +} ni; struct { +int type; +float floatnode; } nf; +} u; ... +u.nf.type = FLOAT; u.nf.floatnode = 3.14; ... +if (u.n.type == FLOAT) +175 + +... sin(u.nf.floatnode) ... A.8.4 Enumerations +Enumerations are unique types with values ranging over a set of named constants called enumerators. The form of an enumeration specifier borrows from that of structures and unions. +enum-specifier: +enumidentifieropt {enumerator-list } enumidentifier + +enumerator-list: enumerator +enumerator-list ,enumerator + +enumerator: identifier +identifier =constant-expression + +The identifiers in an enumerator list are declared as constants of type int, and may appear wherever constants are required. If no enumerations with = appear, then the values of the corresponding constants begin at 0 and increase by 1 as the declaration is read from left to right. An enumerator with = gives the associated identifier the value specified; subsequent identifiers continue the progression from the assigned value. + +Enumerator names in the same scope must all be distinct from each other and from ordinary variable names, but the values need not be distinct. + +The role of the identifier in the enum-specifier is analogous to that of the structure tag in a struct-specifier; it names a particular enumeration. The rules for enum-specifiers with and without tags and lists are the same as those for structure or union specifiers, except that incomplete enumeration types do not exist; the tag of an enum-specifier without an enumerator list must refer to an in-scope specifier with a list. +Enumerations are new since the first edition of this book, but have been part of the language for some years. +A.8.5 Declarators Declarators have the syntax: +declarator: +pointeropt direct-declarator + +direct-declarator: identifier (declarator) +direct-declarator [constant-expressionopt ] direct-declarator (parameter-type-list ) direct-declarator (identifier-listopt ) + +pointer: +*type-qualifier-listopt +*type-qualifier-listopt pointer + +type-qualifier-list: type-qualifier +type-qualifier-list type-qualifier +176 + +The structure of declarators resembles that of indirection, function, and array expressions; the grouping is the same. + +A.8.6 Meaning of Declarators +A list of declarators appears after a sequence of type and storage class specifiers. Each declarator declares a unique main identifier, the one that appears as the first alternative of the production for direct-declarator. The storage class specifiers apply directly to this identifier, but its type depends on the form of its declarator. A declarator is read as an assertion that when its identifier appears in an expression of the same form as the declarator, it yields an object of the specified type. +Considering only the type parts of the declaration specifiers (Par. A.8.2) and a particular declarator, a declaration has the form ``T D,'' where Tis a type and Dis a declarator. The type attributed to the identifier in the various forms of declarator is described inductively using this notation. + +In a declaration T D where D is an unadored identifier, the type of the identifier is T. + +In a declaration T D where D has the form + +( D1 ) +then the type of the identifier in D1is the same as that of D. The parentheses do not alter the type, but may change the binding of complex declarators. +A.8.6.1 Pointer Declarators +In a declaration T D where D has the form *type-qualifier-listopt D1 +and the type of the identifier in the declaration T D1 is ``type-modifier T,'' the type of the identifier of Dis ``type-modifier type-qualifier-list pointer to T.'' Qualifiers following *apply to pointer itself, rather than to the object to which the pointer points. + +For example, consider the declaration + +int *ap[]; +Here, ap[]plays the role of D1; a declaration ``int ap[]'' (below) would give apthe type ``array of int,'' the type-qualifier list is empty, and the type-modifier is ``array of.'' Hence the actual declaration gives ap the type ``array to pointers to int.'' +As other examples, the declarations + +int i, *pi, *const cpi = &i; const int ci = 3, *pci; +declare an integer iand a pointer to an integer pi. The value of the constant pointer cpimay not be changed; it will always point to the same location, although the value to which it refers may be altered. The integer ci is constant, and may not be changed (though it may be initialized, as here.) The type of pciis ``pointer to const int,'' and pciitself may be changed to point to another place, but the value to which it points may not be altered by assigning through pci. +A.8.6.2 Array Declarators +In a declaration T D where D has the form D1 [constant-expressionopt] +177 + +and the type of the identifier in the declaration T D1 is ``type-modifier T,'' the type of the identifier of Dis ``type-modifier array of T.'' If the constant-expression is present, it must have integral type, and value greater than 0. If the constant expression specifying the bound is missing, the array has an incomplete type. + +An array may be constructed from an arithmetic type, from a pointer, from a structure or union, or from another array (to generate a multi-dimensional array). Any type from which an array is constructed must be complete; it must not be an array of structure of incomplete type. This implies that for a multi-dimensional array, only the first dimension may be missing. The type of an object of incomplete aray type is completed by another, complete, declaration for the object (Par.A.10.2), or by initializing it (Par.A.8.7). For example, + +float fa[17], *afp[17]; +declares an array of float numbers and an array of pointers to float numbers. Also, + +static int x3d[3][5][7]; +declares a static three-dimensional array of integers, with rank 3 X5 X7. In complete detail, x3dis an array of three items: each item is an array of five arrays; each of the latter arrays is an array of seven integers. Any of the expressions x3d, x3d[i], x3d[i][j], x3d[i][j][k]may reasonably appear in an expression. The first three have type ``array,'', the last has type int. More specifically, x3d[i][j]is an array of 7 integers, and x3d[i]is an array of 5 arrays of 7 integers. +The array subscripting operation is defined so that E1[E2]is identical to *(E1+E2). Therefore, despite its asymmetric appearance, subscripting is a commutative operation. Because of the conversion rules that apply to +and to arrays (Pars.A6.6, A.7.1, A.7.7), if E1is an array and E2 an integer, then E1[E2] refers to the E2-th member of E1. + +In the example, x3d[i][j][k]is equivalent to *(x3d[i][j] + k). The first subexpression x3d[i][j]is converted by Par.A.7.1 to type ``pointer to array of integers,'' by Par.A.7.7, the addition involves multiplication by the size of an integer. It follows from the rules that arrays are stored by rows (last subscript varies fastest) and that the first subscript in the declaration helps determine the amount of storage consumed by an array, but plays no other part in subscript calculations. + +A.8.6.3 Function Declarators +In a new-style function declaration T D where D has the form D1 (parameter-type-list) +and the type of the identifier in the declaration T D1 is ``type-modifier T,'' the type of the identifier of D is ``type-modifier function with arguments parameter-type-list returning T.'' + +The syntax of the parameters is + +parameter-type-list: parameter-list parameter-list , ... + +parameter-list: parameter-declaration +parameter-list ,parameter-declaration + +parameter-declaration: declaration-specifiers declarator +declaration-specifiers abstract-declaratoropt +178 + +In the new-style declaration, the parameter list specifies the types of the parameters. As a special case, the declarator for a new-style function with no parameters has a parameter list consisting soley of the keyword void. If the parameter list ends with an ellipsis ``, ...'', then the function may accept more arguments than the number of parameters explicitly described, see Par.A.7.3.2. + +The types of parameters that are arrays or functions are altered to pointers, in accordance with the rules for parameter conversions; see Par.A.10.1. The only storage class specifier permitted in a parameter's declaration is register, and this specifier is ignored unless the function declarator heads a function definition. Similarly, if the declarators in the parameter declarations contain identifiers and the function declarator does not head a function definition, the identifiers go out of scope immediately. Abstract declarators, which do not mention the identifiers, are discussed in Par.A.8.8. + +In an old-style function declaration T D where D has the form + +D1(identifier-listopt) + +and the type of the identifier in the declaration T D1 is ``type-modifier T,'' the type of the identifier of D is ``type-modifier function of unspecified arguments returning T.'' The parameters (if present) have the form + +identifier-list: identifier +identifier-list ,identifier + +In the old-style declarator, the identifier list must be absent unless the declarator is used in the head of a function definition (Par.A.10.1). No information about the types of the parameters is supplied by the declaration. + +For example, the declaration + +int f(), *fpi(), (*pfi)(); +declares a function freturning an integer, a function fpireturning a pointer to an integer, and a pointer pfi to a function returning an integer. In none of these are the parameter types specified; they are old-style. +In the new-style declaration + +int strcpy(char *dest, const char *source), rand(void); +strcpyis a function returning int, with two arguments, the first a character pointer, and the second a pointer to constant characters. The parameter names are effectively comments. The second function rand takes no arguments and returns int. +Function declarators with parameter prototypes are, by far, the most important language change introduced by the ANSI standard. They offer an advantage over the ``old-style'' declarators of the first edition by providing error-detection and coercion of arguments across function calls, but at a cost: turmoil and confusion during their introduction, and the necessity of accomodating both forms. Some syntactic ugliness was required for the sake of compatibility, namely voidas an explicit marker of new-style functions without parameters. +The ellipsis notation ``, ...'' for variadic functions is also new, and, together with the macros in the standard header , formalizes a mechanism that was officially forbidden but unofficially condoned in the first edition. + +These notations were adapted from the C++ language. + +A.8.7 Initialization +179 + +When an object is declared, its init-declarator may specify an initial value for the identifier being declared. The initializer is preceded by =, and is either an expression, or a list of initializers nested in braces. A list may end with a comma, a nicety for neat formatting. +initializer: +assignment-expression {initializer-list } {initializer-list , } + +initializer-list: initializer +initializer-list ,initializer + +All the expressions in the initializer for a static object or array must be constant expressions as described in Par.A.7.19. The expressions in the initializer for an autoor registerobject or array must likewise be constant expressions if the initializer is a brace-enclosed list. However, if the initializer for an automatic object is a single expression, it need not be a constant expression, but must merely have appropriate type for assignment to the object. +The first edition did not countenance initialization of automatic structures, unions, or arrays. The ANSI standard allows it, but only by constant constructions unless the initializer can be expressed by a simple expression. +A static object not explicitly initialized is initialized as if it (or its members) were assigned the constant 0. The initial value of an automatic object not explicitly intialized is undefined. + +The initializer for a pointer or an object of arithmetic type is a single expression, perhaps in braces. The expression is assigned to the object. + +The initializer for a structure is either an expression of the same type, or a brace-enclosed list of initializers for its members in order. Unnamed bit-field members are ignored, and are not initialized. If there are fewer initializers in the list than members of the structure, the trailing members are initialized with 0. There may not be more initializers than members. Unnamed bit-field members are ignored,and are not initialized. + +The initializer for an array is a brace-enclosed list of initializers for its members. If the array has unknown size, the number of initializers determines the size of the array, and its type becomes complete. If the array has fixed size, the number of initializers may not exceed the number of members of the array; if there are fewer, the trailing members are initialized with 0. + +As a special case, a character array may be initialized by a string literal; successive characters of the string initialize successive members of the array. Similarly, a wide character literal (Par.A.2.6) may initialize an array of type wchar_t. If the array has unknown size, the number of characters in the string, including the terminating null character, determines its size; if its size is fixed, the number of characters in the string, not counting the terminating null character, must not exceed the size of the array. + +The initializer for a union is either a single expression of the same type, or a brace-enclosed initializer for the first member of the union. +The first edition did not allow initialization of unions. The ``first-member'' rule is clumsy, but is hard to generalize without new syntax. Besides allowing unions to be explicitly initialized in at least a primitive way, this ANSI rule makes definite the semantics of static unions not explicitly initialized. +An aggregate is a structure or array. If an aggregate contains members of aggregate type, the initialization rules apply recursively. Braces may be elided in the initialization as follows: if the initializer for an aggregate's member that itself is an aggregate begins with a left brace, then the succeding comma-separated list of initializers initializes the members of the subaggregate; it is erroneous for there to be more initializers than members. If, however, the initializer for a +180 + +subaggregate does not begin with a left brace, then only enough elements from the list are taken into account for the members of the subaggregate; any remaining members are left to initialize the next member of the aggregate of which the subaggregate is a part. + +For example, + +int x[] = { 1, 3, 5 }; +declares and initializes x as a 1-dimensional array with three members, since no size was specified and there are three initializers. + +float y[4][3] = { { 1, 3, 5 }, { 2, 4, 6 }, { 3, 5, 7 }, +}; +is a completely-bracketed initialization: 1, 3 and 5 initialize the first row of the array y[0], namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1]and y[2]. The initializer ends early, and therefore the elements of y[3]are initialized with 0. Precisely the same effect could have been achieved by + +float y[4][3] = { +1, 3, 5, 2, 4, 6, 3, 5, 7 }; +The initializer for y begins with a left brace, but that for y[0] does not; therefore three elements from the list are used. Likewise the next three are taken successively for y[1]and for y[2]. Also, + +float y[4][3] = { +{ 1 }, { 2 }, { 3 }, { 4 } }; +initializes the first column of y (regarded as a two-dimensional array) and leaves the rest 0. +Finally, + +char msg[] = "Syntax error on line %s\n"; +shows a character array whose members are initialized with a string; its size includes the terminating null character. +A.8.8 Type names +In several contexts (to specify type conversions explicitly with a cast, to declare parameter types in function declarators, and as argument of sizeof) it is necessary to supply the name of a data type. This is accomplished using a type name, which is syntactically a declaration for an object of that type omitting the name of the object. +type-name: +specifier-qualifier-list abstract-declaratoropt + +abstract-declarator: pointer +pointeropt direct-abstract-declarator + +direct-abstract-declarator: ( abstract-declarator ) +direct-abstract-declaratoropt [constant-expressionopt] direct-abstract-declaratoropt (parameter-type-listopt) +181 + +It is possible to identify uniquely the location in the abstract-declarator where the identifier would appear if the construction were a declarator in a declaration. The named type is then the same as the type of the hypothetical identifier. For example, + +int int * +int *[3] int (*)[] int *() +int (*[])(void) +name respectively the types ``integer,'' ``pointer to integer,'' ``array of 3 pointers to integers,'' ``pointer to an unspecified number of integers,'' ``function of unspecified parameters returning pointer to integer,'' and ``array, of unspecified size, of pointers to functions with no parameters each returning an integer.'' +A.8.9 Typedef +Declarations whose storage class specifier is typedef do not declare objects; instead they define identifiers that name types. These identifiers are called typedef names. +typedef-name: identifier + +A typedefdeclaration attributes a type to each name among its declarators in the usual way (see Par.A.8.6). Thereafter, each such typedef name is syntactically equivalent to a type specifier keyword for the associated type. + +For example, after + +typedef long Blockno, *Blockptr; +typedef struct { double r, theta; } Complex; the constructions + +Blockno b; +extern Blockptr bp; Complex z, *zp; +are legal declarations. The type of bis long, that of bpis ``pointer to long,'' and that of zis the specified structure; zp is a pointer to such a structure. +typedef does not introduce new types, only synonyms for types that could be specified in another way. In the example, b has the same type as any long object. + +Typedef names may be redeclared in an inner scope, but a non-empty set of type specifiers must be given. For example, + +extern Blockno; +does not redeclare Blockno, but + +extern int Blockno; does. +A.8.10 Type Equivalence +Two type specifier lists are equivalent if they contain the same set of type specifiers, taking into account that some specifiers can be implied by others (for example, longalone implies long int). Structures, unions, and enumerations with different tags are distinct, and a tagless union, structure, or enumeration specifies a unique type. +182 + +Two types are the same if their abstract declarators (Par.A.8.8), after expanding any typedef types, and deleting any function parameter specifiers, are the same up to the equivalence of type specifier lists. Array sizes and function parameter types are significant. + +A.9 Statements +Except as described, statements are executed in sequence. Statements are executed for their effect, and do not have values. They fall into several groups. +statement: +labeled-statement expression-statement compound-statement selection-statement iteration-statement jump-statement + +A.9.1 Labeled Statements Statements may carry label prefixes. +labeled-statement: identifier :statement +caseconstant-expression :statement default :statement + +A label consisting of an identifier declares the identifier. The only use of an identifier label is as a target of goto. The scope of the identifier is the current function. Because labels have their own name space, they do not interfere with other identifiers and cannot be redeclared. See Par.A.11.1. + +Case labels and default labels are used with the switchstatement (Par.A.9.4). The constant expression of case must have integral type. + +Labels themselves do not alter the flow of control. + +A.9.2 Expression Statement +Most statements are expression statements, which have the form +expression-statement: expressionopt; + +Most expression statements are assignments or function calls. All side effects from the expression are completed before the next statement is executed. If the expression is missing, the construction is called a null statement; it is often used to supply an empty body to an iteration statement to place a label. + +A.9.3 Compound Statement +So that several statements can be used where one is expected, the compound statement (also called ``block'') is provided. The body of a function definition is a compound statement. +compound-statement: +{declaration-listopt statement-listopt } + +declaration-list: declaration +declaration-list declaration +183 + +statement-list: statement +statement-list statement + +If an identifier in the declaration-list was in scope outside the block, the outer declaration is suspended within the block (see Par.A.11.1), after which it resumes its force. An identifier may be declared only once in the same block. These rules apply to identifiers in the same name space (Par.A.11); identifiers in different name spaces are treated as distinct. + +Initialization of automatic objects is performed each time the block is entered at the top, and proceeds in the order of the declarators. If a jump into the block is executed, these initializations are not performed. Initialization of static objects are performed only once, before the program begins execution. + +A.9.4 Selection Statements +Selection statements choose one of several flows of control. +selection-statement: +if (expression) statement +if (expression) statement elsestatement switch (expression) statement + +In both forms of the ifstatement, the expression, which must have arithmetic or pointer type, is evaluated, including all side effects, and if it compares unequal to 0, the first substatement is executed. In the second form, the second substatement is executed if the expression is 0. The elseambiguity is resolved by connecting an elsewith the last encountered else-less ifat the same block nesting level. + +The switchstatement causes control to be transferred to one of several statements depending on the value of an expression, which must have integral type. The substatement controlled by a switchis typically compound. Any statement within the substatement may be labeled with one or more case labels (Par.A.9.1). The controlling expression undergoes integral promotion (Par.A.6.1), and the case constants are converted to the promoted type. No two of these case constants associated with the same switch may have the same value after conversion. There may also be at most one defaultlabel associated with a switch. Switches may be nested; a case or default label is associated with the smallest switch that contains it. + +When the switchstatement is executed, its expression is evaluated, including all side effects, and compared with each case constant. If one of the case constants is equal to the value of the expression, control passes to the statement of the matched case label. If no case constant matches the expression, and if there is a defaultlabel, control passes to the labeled statement. If no case matches, and if there is no default, then none of the substatements of the swtich is executed. +In the first edition of this book, the controlling expression of switch, and the case constants, were required to have int type. +A.9.5 Iteration Statements Iteration statements specify looping. +iteration-statement: +while (expression) statement dostatement while (expression); +for (expressionopt;expressionopt;expressionopt) statement +184 + +In the whileand dostatements, the substatement is executed repeatedly so long as the value of the expression remains unequal to 0; the expression must have arithmetic or pointer type. With while, the test, including all side effects from the expression, occurs before each execution of the statement; with do, the test follows each iteration. + +In the forstatement, the first expression is evaluated once, and thus specifies initialization for the loop. There is no restriction on its type. The second expression must have arithmetic or pointer type; it is evaluated before each iteration, and if it becomes equal to 0, the for is terminated. The third expression is evaluated after each iteration, and thus specifies a re-initialization for the loop. There is no restriction on its type. Side-effects from each expression are completed immediately after its evaluation. If the substatement does not contain continue, a statement + +for (expression1;expression2;expression3) statement + +is equivalent to + +expression1; +while (expression2) { statement expression3; +} +Any of the three expressions may be dropped. A missing second expression makes the implied test equivalent to testing a non-zero element. +A.9.6 Jump statements +Jump statements transfer control unconditionally. +jump-statement: gotoidentifier; +continue; +break; returnexpressionopt; + +In the gotostatement, the identifier must be a label (Par.A.9.1) located in the current function. Control transfers to the labeled statement. + +A continuestatement may appear only within an iteration statement. It causes control to pass to the loop-continuation portion of the smallest enclosing such statement. More precisely, within each of the statements + +while (...) { do { for (...) { ... ... ... +contin: ; contin: ; contin: ; } } while (...); } +a continue not contained in a smaller iteration statement is the same as goto contin. +A break statement may appear only in an iteration statement or a switch statement, and terminates execution of the smallest enclosing such statement; control passes to the statement following the terminated statement. + +A function returns to its caller by the return statement. When return is followed by an expression, the value is returned to the caller of the function. The expression is converted, as by assignment, to the type returned by the function in which it appears. + +Flowing off the end of a function is equivalent to a return with no expression. In either case, the returned value is undefined. +185 + +A.10 External Declarations +The unit of input provided to the C compiler is called a translation unit; it consists of a sequence of external declarations, which are either declarations or function definitions. +translation-unit: external-declaration +translation-unit external-declaration + +external-declaration: function-definition declaration + +The scope of external declarations persists to the end of the translation unit in which they are declared, just as the effect of declarations within the blocks persists to the end of the block. The syntax of external declarations is the same as that of all declarations, except that only at this level may the code for functions be given. + +A.10.1 Function Definitions Function definitions have the form +function-definition: +declaration-specifiersopt declarator declaration-listopt compound-statement + +The only storage-class specifiers allowed among the declaration specifiers are extern or static; see Par.A.11.2 for the distinction between them. + +A function may return an arithmetic type, a structure, a union, a pointer, or void, but not a function or an array. The declarator in a function declaration must specify explicitly that the declared identifier has function type; that is, it must contain one of the forms (see Par.A.8.6.3). + +direct-declarator ( parameter-type-list ) direct-declarator ( identifier-listopt ) + +where the direct-declarator is an identifier or a parenthesized identifier. In particular, it must not achieve function type by means of a typedef. + +In the first form, the definition is a new-style function, and its parameters, together with their types, are declared in its parameter type list; the declaration-list following the function's declarator must be absent. Unless the parameter type list consists solely of void, showing that the function takes no parameters, each declarator in the parameter type list must contain an identifier. If the parameter type list ends with ``, ...'' then the function may be called with more arguments than parameters; the va_argmacro mechanism defined in the standard header and described in Appendix B must be used to refer to the extra arguments. Variadic functions must have at least one named parameter. + +In the second form, the definition is old-style: the identifier list names the parameters, while the declaration list attributes types to them. If no declaration is given for a parameter, its type is taken to be int. The declaration list must declare only parameters named in the list, initialization is not permitted, and the only storage-class specifier possible is register. + +In both styles of function definition, the parameters are understood to be declared just after the beginning of the compound statement constituting the function's body, and thus the same identifiers must not be redeclared there (although they may, like other identifiers, be redeclared in inner blocks). If a parameter is declared to have type ``array of type,'' the declaration is adjusted to read ``pointer to type;'' similarly, if a parameter is declared to have type ``function +186 + +returning type,'' the declaration is adjusted to read ``pointer to function returning type.'' During the call to a function, the arguments are converted as necessary and assigned to the parameters; see Par.A.7.3.2. +New-style function definitions are new with the ANSI standard. There is also a small change in the details of promotion; the first edition specified that the declarations of float parameters were adjusted to read double. The difference becomes noticable when a pointer to a parameter is generated within a function. +A complete example of a new-style function definition is + +int max(int a, int b, int c) { +int m; + +m = (a > b) ? a : b; return (m > c) ? m : c; +} +Here int is the declaration specifier; max(int a, int b, int c) is the function's declarator, and { ... } is the block giving the code for the function. The corresponding old-style definition would be + +int max(a, b, c) int a, b, c; +{ +/* ... */ } +where now int max(a, b, c)is the declarator, and int a, b, c;is the declaration list for the parameters. +A.10.2 External Declarations +External declarations specify the characteristics of objects, functions and other identifiers. The term ``external'' refers to their location outside functions, and is not directly connected with the externkeyword; the storage class for an externally-declared object may be left empty, or it may be specified as extern or static. +Several external declarations for the same identifier may exist within the same translation unit if they agree in type and linkage, and if there is at most one definition for the identifier. + +Two declarations for an object or function are deemed to agree in type under the rule discussed in Par.A.8.10. In addition, if the declarations differ because one type is an incomplete structure, union, or enumeration type (Par.A.8.3) and the other is the corresponding completed type with the same tag, the types are taken to agree. Moreover, if one type is an incomplete array type (Par.A.8.6.2) and the other is a completed array type, the types, if otherwise identical, are also taken to agree. Finally, if one type specifies an old-style function, and the other an otherwise identical new-style function, with parameter declarations, the types are taken to agree. + +If the first external declarator for a function or object includes the static specifier, the identifier has internal linkage; otherwise it has external linkage. Linkage is discussed in Par.11.2. + +An external declaration for an object is a definition if it has an initializer. An external object declaration that does not have an initializer, and does not contain the externspecifier, is a tentative definition. If a definition for an object appears in a translation unit, any tentative definitions are treated merely as redundant declarations. If no definition for the object appears in the translation unit, all its tentative definitions become a single definition with initializer 0. +187 + +Each object must have exactly one definition. For objects with internal linkage, this rule applies separately to each translation unit, because internally-linked objects are unique to a translation unit. For objects with external linkage, it applies to the entire program. +Although the one-definition rule is formulated somewhat differently in the first edition of this book, it is in effect identical to the one stated here. Some implementations relax it by generalizing the notion of tentative definition. In the alternate formulation, which is usual in UNIX systems and recognized as a common extension by the Standard, all the tentative definitions for an externally linked object, throughout all the translation units of the program, are considered together instead of in each translation unit separately. If a definition occurs somewhere in the program, then the tentative definitions become merely declarations, but if no definition appears, then all its tentative definitions become a definition with initializer 0. +A.11 Scope and Linkage +A program need not all be compiled at one time: the source text may be kept in several files containing translation units, and precompiled routines may be loaded from libraries. Communication among the functions of a program may be carried out both through calls and through manipulation of external data. +Therefore, there are two kinds of scope to consider: first, the lexical scope of an identifier which is the region of the program text within which the identifier's characteristics are understood; and second, the scope associated with objects and functions with external linkage, which determines the connections between identifiers in separately compiled translation units. + +A.11.1 Lexical Scope +Identifiers fall into several name spaces that do not interfere with one another; the same identifier may be used for different purposes, even in the same scope, if the uses are in different name spaces. These classes are: objects, functions, typedef names, and enumconstants; labels; tags of structures or unions, and enumerations; and members of each structure or union individually. +These rules differ in several ways from those described in the first edition of this manual. Labels did not previously have their own name space; tags of structures and unions each had a separate space, and in some implementations enumerations tags did as well; putting different kinds of tags into the same space is a new restriction. The most important departure from the first edition is that each structure or union creates a separate name space for its members, so that the same name may appear in several different structures. This rule has been common practice for several years. +The lexical scope of an object or function identifier in an external declaration begins at the end of its declarator and persists to the end of the translation unit in which it appears. The scope of a parameter of a function definition begins at the start of the block defining the function, and persists through the function; the scope of a parameter in a function declaration ends at the end of the declarator. The scope of an identifier declared at the head of a block begins at the end of its declarator, and persists to the end of the block. The scope of a label is the whole of the function in which it appears. The scope of a structure, union, or enumeration tag, or an enumeration constant, begins at its appearance in a type specifier, and persists to the end of a translation unit (for declarations at the external level) or to the end of the block (for declarations within a function). + +If an identifier is explicitly declared at the head of a block, including the block constituting a function, any declaration of the identifier outside the block is suspended until the end of the block. + +A.11.2 Linkage +Within a translation unit, all declarations of the same object or function identifier with internal linkage refer to the same thing, and the object or function is unique to that translation unit. All +188 + +declarations for the same object or function identifier with external linkage refer to the same thing, and the object or function is shared by the entire program. +As discussed in Par.A.10.2, the first external declaration for an identifier gives the identifier internal linkage if the staticspecifier is used, external linkage otherwise. If a declaration for an identifier within a block does not include the externspecifier, then the identifier has no linkage and is unique to the function. If it does include extern, and an external declaration for is active in the scope surrounding the block, then the identifier has the same linkage as the external declaration, and refers to the same object or function; but if no external declaration is visible, its linkage is external. + +A.12 Preprocessing +A preprocessor performs macro substitution, conditional compilation, and inclusion of named files. Lines beginning with #, perhaps preceded by white space, communicate with this preprocessor. The syntax of these lines is independent of the rest of the language; they may appear anywhere and have effect that lasts (independent of scope) until the end of the translation unit. Line boundaries are significant; each line is analyzed individually (bus see Par.A.12.2 for how to adjoin lines). To the preprocessor, a token is any language token, or a character sequence giving a file name as in the #includedirective (Par.A.12.4); in addition, any character not otherwise defined is taken as a token. However, the effect of white spaces other than space and horizontal tab is undefined within preprocessor lines. +Preprocessing itself takes place in several logically successive phases that may, in a particular implementation, be condensed. + +1. First, trigraph sequences as described in Par.A.12.1 are replaced by their equivalents. Should the operating system environment require it, newline characters are introduced between the lines of the source file. + +2. Each occurrence of a backslash character \ followed by a newline is deleted, this splicing lines (Par.A.12.2). + +3. The program is split into tokens separated by white-space characters; comments are replaced by a single space. Then preprocessing directives are obeyed, and macros (Pars.A.12.3-A.12.10) are expanded. + +4. Escape sequences in character constants and string literals (Pars. A.2.5.2, A.2.6) are replaced by their equivalents; then adjacent string literals are concatenated. + +5. The result is translated, then linked together with other programs and libraries, by collecting the necessary programs and data, and connecting external functions and object references to their definitions. + +A.12.1 Trigraph Sequences +The character set of C source programs is contained within seven-bit ASCII, but is a superset of the ISO 646-1983 Invariant Code Set. In order to enable programs to be represented in the reduced set, all occurrences of the following trigraph sequences are replaced by the corresponding single character. This replacement occurs before any other processing. + +??= # ??( [ ??< { ??/ \ ??) ] ??> } ??' ^ ??! | ??- ~ +No other such replacements occur. +Trigraph sequences are new with the ANSI standard. +A.12.2 Line Splicing +189 + +Lines that end with the backslash character \ are folded by deleting the backslash and the following newline character. This occurs before division into tokens. +A.12.3 Macro Definition and Expansion A control line of the form +# defineidentifier token-sequence + +causes the preprocessor to replace subsequent instances of the identifier with the given sequence of tokens; leading and trailing white space around the token sequence is discarded. A second #define for the same identifier is erroneous unless the second token sequence is identical to the first, where all white space separations are taken to be equivalent. + +A line of the form + +# defineidentifier (identifier-list) token-sequence + +where there is no space between the first identifier and the (, is a macro definition with parameters given by the identifier list. As with the first form, leading and trailing white space arround the token sequence is discarded, and the macro may be redefined only with a definition in which the number and spelling of parameters, and the token sequence, is identical. + +A control line of the form + +# undefidentifier + +causes the identifier's preprocessor definition to be forgotten. It is not erroneous to apply #undef to an unknown identifier. + +When a macro has been defined in the second form, subsequent textual instances of the macro identifier followed by optional white space, and then by (, a sequence of tokens separated by commas, and a ) constitute a call of the macro. The arguments of the call are the comma-separated token sequences; commas that are quoted or protected by nested parentheses do not separate arguments. During collection, arguments are not macro-expanded. The number of arguments in the call must match the number of parameters in the definition. After the arguments are isolated, leading and trailing white space is removed from them. Then the token sequence resulting from each argument is substituted for each unquoted occurrence of the corresponding parameter's identifier in the replacement token sequence of the macro. Unless the parameter in the replacement sequence is preceded by #, or preceded or followed by ##, the argument tokens are examined for macro calls, and expanded as necessary, just before insertion. + +Two special operators influence the replacement process. First, if an occurrence of a parameter in the replacement token sequence is immediately preceded by #, string quotes (") are placed around the corresponding parameter, and then both the # and the parameter identifier are replaced by the quoted argument. A \character is inserted before each "or \character that appears surrounding, or inside, a string literal or character constant in the argument. + +Second, if the definition token sequence for either kind of macro contains a ##operator, then just after replacement of the parameters, each ##is deleted, together with any white space on either side, so as to concatenate the adjacent tokens and form a new token. The effect is undefined if invalid tokens are produced, or if the result depends on the order of processing of the ## operators. Also, ## may not appear at the beginning or end of a replacement token sequence. +190 + +In both kinds of macro, the replacement token sequence is repeatedly rescanned for more defined identifiers. However, once a given identifier has been replaced in a given expansion, it is not replaced if it turns up again during rescanning; instead it is left unchanged. + +Even if the final value of a macro expansion begins with with #, it is not taken to be a preprocessing directive. +The details of the macro-expansion process are described more precisely in the ANSI standard than in the first edition. The most important change is the addition of the #and ##operators, which make quotation and concatenation admissible. Some of the new rules, especially those involving concatenation, are bizarre. (See example below.) +For example, this facility may be used for ``manifest-constants,'' as in + +#define TABSIZE 100 int table[TABSIZE]; +The definition + +#define ABSDIFF(a, b) ((a)>(b) ? (a)-(b) : (b)-(a)) +defines a macro to return the absolute value of the difference between its arguments. Unlike a function to do the same thing, the arguments and returned value may have any arithmetic type or even be pointers. Also, the arguments, which might have side effects, are evaluated twice, once for the test and once to produce the value. +Given the definition + +#define tempfile(dir) #dir "%s" the macro call tempfile(/usr/tmp) yields + +"/usr/tmp" "%s" +which will subsequently be catenated into a single string. After + +#define cat(x, y) x ## y +the call cat(var, 123)yields var123. However, the call cat(cat(1,2),3)is undefined: the presence of ##prevents the arguments of the outer call from being expanded. Thus it produces the token string + +cat ( 1 , 2 )3 +and )3(the catenation of the last token of the first argument with the first token of the second) is not a legal token. If a second level of macro definition is introduced, + +#define xcat(x, y) cat(x,y) +things work more smoothly; xcat(xcat(1, 2), 3)does produce 123, because the expansion of xcat itself does not involve the ## operator. +Likewise, ABSDIFF(ABSDIFF(a,b),c) produces the expected, fully-expanded result. + +A.12.4 File Inclusion A control line of the form +# include + +causes the replacement of that line by the entire contents of the file filename. The characters in the name filename must not include >or newline, and the effect is undefined if it contains any of ", ', \, or /*. The named file is searched for in a sequence of implementation-defined places. + +Similarly, a control line of the form + +# include "filename" +191 + +searches first in association with the original source file (a deliberately implementation-dependent phrase), and if that search fails, then as in the first form. The effect of using ', \, or /* in the filename remains undefined, but > is permitted. + +Finally, a directive of the form + +# includetoken-sequence + +not matching one of the previous forms is interpreted by expanding the token sequence as for normal text; one of the two forms with <...>or "..."must result, and is then treated as previously described. + +#include files may be nested. + +A.12.5 Conditional Compilation +Parts of a program may be compiled conditionally, according to the following schematic syntax. +preprocessor-conditional: +if-line text elif-parts else-partopt #endif + +if-line: +# ifconstant-expression # ifdefidentifier +# ifndefidentifier + +elif-parts: elif-line text elif-partsopt + +elif-line: +# elifconstant-expression + +else-part: else-line text + +else-line: #else + +Each of the directives (if-line, elif-line, else-line, and #endif) appears alone on a line. The constant expressions in #if and subsequent #elif lines are evaluated in order until an expression with a non-zero value is found; text following a line with a zero value is discarded. The text following the successful directive line is treated normally. ``Text'' here refers to any material, including preprocessor lines, that is not part of the conditional structure; it may be empty. Once a successful #ifor #elifline has been found and its text processed, succeeding #elifand #elselines, together with their text, are discarded. If all the expressions are zero, and there is an #else, the text following the #elseis treated normally. Text controlled by inactive arms of the conditional is ignored except for checking the nesting of conditionals. + +The constant expression in #if and #elif is subject to ordinary macro replacement. Moreover, any expressions of the form + +definedidentifier + +or + +defined (identifier) +192 + +are replaced, before scanning for macros, by 1Lif the identifier is defined in the preprocessor, and by 0Lif not. Any identifiers remaining after macro expansion are replaced by 0L. Finally, each integer constant is considered to be suffixed with L, so that all arithmetic is taken to be long or unsigned long. + +The resulting constant expression (Par.A.7.19) is restricted: it must be integral, and may not contain sizeof, a cast, or an enumeration constant. + +The control lines + +#ifdefidentifier #ifndefidentifier + +are equivalent to + +# if definedidentifier +# if ! definedidentifier + +respectively. +#elif is new since the first edition, although it has been available is some preprocessors. The defined preprocessor operator is also new. +A.12.6 Line Control +For the benefit of other preprocessors that generate C programs, a line in one of the forms +# lineconstant "filename" # lineconstant + +causes the compiler to believe, for purposes of error diagnostics, that the line number of the next source line is given by the decimal integer constant and the current input file is named by the identifier. If the quoted filename is absent, the remembered name does not change. Macros in the line are expanded before it is interpreted. + +A.12.7 Error Generation A preprocessor line of the form +# errortoken-sequenceopt + +causes the preprocessor to write a diagnostic message that includes the token sequence. + +A.12.8 Pragmas +A control line of the form +# pragmatoken-sequenceopt + +causes the preprocessor to perform an implementation-dependent action. An unrecognized pragma is ignored. + +A.12.9 Null directive A control line of the form +# + +has no effect. + +A.12.10 Predefined names +193 + +Several identifiers are predefined, and expand to produce special information. They, and also the preprocessor expansion operator defined, may not be undefined or redefined. __LINE__A decimal constant containing the current source line number. +__FILE__A string literal containing the name of the file being compiled. +__DATE__A string literal containing the date of compilation, in the form "Mmmm dd yyyy" __TIME__A string literal containing the time of compilation, in the form "hh:mm:ss" +The constant 1. It is intended that this identifier be defined to be 1 only in standard-conforming implementations. +__STDC__ +#errorand #pragmaare new with the ANSI standard; the predefined preprocessor macros are new, but some of them have been available in some implementations. +A.13 Grammar +Below is a recapitulation of the grammar that was given throughout the earlier part of this appendix. It has exactly the same content, but is in different order. +The grammar has undefined terminal symbols integer-constant, character-constant, floating-constant, identifier, string, and enumeration-constant; the typewriter style words and symbols are terminals given literally. This grammar can be transformed mechanically into input acceptable for an automatic parser-generator. Besides adding whatever syntactic marking is used to indicate alternatives in productions, it is necessary to expand the ``one of'' constructions, and (depending on the rules of the parser-generator) to duplicate each production with an opt symbol, once with the symbol and once without. With one further change, namely deleting the production typedef-name: identifier and making typedef-name a terminal symbol, this grammar is acceptable to the YACC parser-generator. It has only one conflict, generated by the if-else ambiguity. + +translation-unit: external-declaration +translation-unit external-declaration + +external-declaration: function-definition declaration + +function-definition: +declaration-specifiersopt declarator declaration-listopt compound-statement + +declaration: +declaration-specifiers init-declarator-listopt; + +declaration-list: declaration +declaration-list declaration + +declaration-specifiers: +storage-class-specifier declaration-specifiersopt type-specifier declaration-specifiersopt +type-qualifier declaration-specifiersopt + +storage-class specifier: one of +auto register static extern typedef + +type specifier: one of +void char short int long float double signed unsignedstruct-or-union-specifier enum-specifier typedef-name +194 + +type-qualifier: one of const volatile + +struct-or-union-specifier: +struct-or-union identifieropt {struct-declaration-list } struct-or-union identifier + +struct-or-union: one of struct union + +struct-declaration-list: struct declaration +struct-declaration-list struct declaration + +init-declarator-list: init-declarator +init-declarator-list,init-declarator + +init-declarator: declarator +declarator =initializer + +struct-declaration: +specifier-qualifier-list struct-declarator-list; + +specifier-qualifier-list: +type-specifier specifier-qualifier-listopt type-qualifier specifier-qualifier-listopt + +struct-declarator-list: struct-declarator +struct-declarator-list ,struct-declarator + +struct-declarator: declarator +declaratoropt :constant-expression + +enum-specifier: +enumidentifieropt {enumerator-list } enumidentifier + +enumerator-list: enumerator +enumerator-list ,enumerator + +enumerator: identifier +identifier =constant-expression + +declarator: +pointeropt direct-declarator + +direct-declarator: identifier (declarator) +direct-declarator [constant-expressionopt ] +195 + +direct-declarator (parameter-type-list ) direct-declarator (identifier-listopt ) + +pointer: +*type-qualifier-listopt +*type-qualifier-listopt pointer + +type-qualifier-list: type-qualifier +type-qualifier-list type-qualifier + +parameter-type-list: parameter-list parameter-list , ... + +parameter-list: parameter-declaration +parameter-list ,parameter-declaration + +parameter-declaration: declaration-specifiers declarator +declaration-specifiers abstract-declaratoropt + +identifier-list: identifier +identifier-list ,identifier + +initializer: +assignment-expression {initializer-list } {initializer-list , } + +initializer-list: initializer +initializer-list ,initializer + +type-name: +specifier-qualifier-list abstract-declaratoropt + +abstract-declarator: pointer +pointeropt direct-abstract-declarator + +direct-abstract-declarator: ( abstract-declarator ) +direct-abstract-declaratoropt [constant-expressionopt] direct-abstract-declaratoropt (parameter-type-listopt) + +typedef-name: identifier + +statement: +labeled-statement expression-statement compound-statement selection-statement +196 + +iteration-statement jump-statement + +labeled-statement: identifier :statement +caseconstant-expression :statement default :statement + +expression-statement: expressionopt; + +compound-statement: +{declaration-listopt statement-listopt } + +statement-list: statement +statement-list statement + +selection-statement: +if (expression) statement +if (expression) statement elsestatement switch (expression) statement + +iteration-statement: +while (expression) statement dostatement while (expression); +for (expressionopt;expressionopt;expressionopt) statement + +jump-statement: gotoidentifier; +continue; +break; returnexpressionopt; + +expression: +assignment-expression +expression ,assignment-expression + +assignment-expression: conditional-expression +unary-expression assignment-operator assignment-expression + +assignment-operator: one of += *= /= %= += -= <<= >>= &= ^= |= + +conditional-expression: logical-OR-expression +logical-OR-expression ?expression :conditional-expression + +constant-expression: conditional-expression + +logical-OR-expression: logical-AND-expression +logical-OR-expression ||logical-AND-expression +197 + +logical-AND-expression: inclusive-OR-expression +logical-AND-expression &&inclusive-OR-expression + +inclusive-OR-expression: exclusive-OR-expression +inclusive-OR-expression |exclusive-OR-expression + +exclusive-OR-expression: AND-expression +exclusive-OR-expression ^AND-expression + +AND-expression: equality-expression +AND-expression &equality-expression + +equality-expression: relational-expression +equality-expression ==relational-expression equality-expression !=relational-expression + +relational-expression: shift-expression +relational-expression shift-expression relational-expression <=shift-expression relational-expression >=shift-expression + +shift-expression: additive-expression +shift-expression <>additive-expression + +additive-expression: multiplicative-expression +additive-expression +multiplicative-expression additive-expression -multiplicative-expression + +multiplicative-expression: +multiplicative-expression *cast-expression multiplicative-expression /cast-expression multiplicative-expression %cast-expression + +cast-expression: unary expression +(type-name) cast-expression + +unary-expression: postfix expression ++unary expression --unary expression +unary-operator cast-expression sizeofunary-expression sizeof (type-name) +198 + +unary operator: one of & * + - ~ ! + +postfix-expression: primary-expression +postfix-expression[expression] +postfix-expression(argument-expression-listopt) postfix-expression.identifier +postfix-expression->+identifier postfix-expression++ +postfix-expression-- + +primary-expression: identifier +constant string (expression) + +argument-expression-list: assignment-expression +assignment-expression-list ,assignment-expression + +constant: +integer-constant character-constant floating-constant enumeration-constant + +The following grammar for the preprocessor summarizes the structure of control lines, but is not suitable for mechanized parsing. It includes the symbol text, which means ordinary program text, non-conditional preprocessor control lines, or complete preprocessor conditional instructions. + +control-line: +# defineidentifier token-sequence +# defineidentifier(identifier, ... , identifier) token-sequence # undefidentifier +# include # include "filename" +# lineconstant "filename" # lineconstant +# errortoken-sequenceopt # pragmatoken-sequenceopt +# +preprocessor-conditional + +preprocessor-conditional: +if-line text elif-parts else-partopt #endif + +if-line: +# ifconstant-expression # ifdefidentifier +# ifndefidentifier +199 + +elif-parts: elif-line text elif-partsopt + +elif-line: +# elifconstant-expression + +else-part: else-line text + +else-line: #else +200 + + +Appendix B - Standard Library +This appendix is a summary of the library defined by the ANSI standard. The standard library is not part of the C language proper, but an environment that supports standard C will provide the function declarations and type and macro definitions of this library. We have omitted a few functions that are of limited utility or easily synthesized from others; we have omitted multi-byte characters; and we have omitted discussion of locale issues; that is, properties that depend on local language, nationality, or culture. +The functions, types and macros of the standard library are declared in standard headers: + + + +A header can be accessed by +#include
+ + + + + + + + +Headers may be included in any order and any number of times. A header must be included outside of any external declaration or definition and before any use of anything it declares. A header need not be a source file. + +External identifiers that begin with an underscore are reserved for use by the library, as are all other identifiers that begin with an underscore and an upper-case letter or another underscore. + +B.1 Input and Output: +The input and output functions, types, and macros defined in represent nearly one third of the library. +A stream is a source or destination of data that may be associated with a disk or other peripheral. The library supports text streams and binary streams, although on some systems, notably UNIX, these are identical. A text stream is a sequence of lines; each line has zero or more characters and is terminated by '\n'. An environment may need to convert a text stream to or from some other representation (such as mapping '\n'to carriage return and linefeed). A binary stream is a sequence of unprocessed bytes that record internal data, with the property that if it is written, then read back on the same system, it will compare equal. + +A stream is connected to a file or device by opening it; the connection is broken by closing the stream. Opening a file returns a pointer to an object of type FILE, which records whatever information is necessary to control the stream. We will use ``file pointer'' and ``stream'' interchangeably when there is no ambiguity. + +When a program begins execution, the three streams stdin, stdout, and stderrare already open. + +B.1.1 File Operations +The following functions deal with operations on files. The type size_tis the unsigned integral type produced by the sizeof operator. +FILE *fopen(const char *filename, const char *mode) +fopenopens the named file, and returns a stream, or NULLif the attempt fails. Legal values for mode include: +"r" open text file for reading +"w" create text file for writing; discard previous contents if any "a" append; open or create text file for writing at end of file +201 + +"r+" open text file for update (i.e., reading and writing) +"w+" create text file for update, discard previous contents if any "a+" append; open or create text file for update, writing at end +Update mode permits reading and writing the same file; fflushor a file-positioning function must be called between a read and a write or vice versa. If the mode includes b after the initial letter, as in "rb"or "w+b", that indicates a binary file. Filenames are limited to FILENAME_MAX characters. At most FOPEN_MAX files may be open at once. +FILE *freopen(const char *filename, const char *mode, FILE *stream) +freopen opens the file with the specified mode and associates the stream with it. It returns stream, or NULLif an error occurs. freopenis normally used to change the files associated with stdin, stdout, or stderr. +int fflush(FILE *stream) +On an output stream, fflushcauses any buffered but unwritten data to be written; on an input stream, the effect is undefined. It returns EOF for a write error, and zero otherwise. fflush(NULL) flushes all output streams. +int fclose(FILE *stream) +fclose flushes any unwritten data for stream, discards any unread buffered input, frees any automatically allocated buffer, then closes the stream. It returns EOFif any errors occurred, and zero otherwise. +int remove(const char *filename) +remove removes the named file, so that a subsequent attempt to open it will fail. It returns non-zero if the attempt fails. +int rename(const char *oldname, const char *newname) +rename changes the name of a file; it returns non-zero if the attempt fails. +FILE *tmpfile(void) +tmpfilecreates a temporary file of mode "wb+"that will be automatically removed when closed or when the program terminates normally. tmpfilereturns a stream, or NULL if it could not create the file. +char *tmpnam(char s[L_tmpnam]) +tmpnam(NULL)creates a string that is not the name of an existing file, and returns a pointer to an internal static array. tmpnam(s)stores the string in sas well as returning it as the function value; smust have room for at least L_tmpnamcharacters. tmpnam generates a different name each time it is called; at most TMP_MAXdifferent names are guaranteed during execution of the program. Note that tmpnamcreates a name, not a file. +int setvbuf(FILE *stream, char *buf, int mode, size_t size) +setvbufcontrols buffering for the stream; it must be called before reading, writing or any other operation. A modeof _IOFBFcauses full buffering, _IOLBFline buffering of text files, and _IONBFno buffering. If bufis not NULL, it will be used as the buffer, otherwise a buffer will be allocated. sizedetermines the buffer size. setvbufreturns non-zero for any error. +void setbuf(FILE *stream, char *buf) +If bufis NULL, buffering is turned off for the stream. Otherwise, setbufis equivalent to (void) setvbuf(stream, buf, _IOFBF, BUFSIZ). +B.1.2 Formatted Output +The printf functions provide formatted output conversion. + +int fprintf(FILE *stream, const char *format, ...) +fprintfconverts and writes output to streamunder the control of format. The return value is the number of characters written, or negative if an error occurred. +The format string contains two types of objects: ordinary characters, which are copied to the output stream, and conversion specifications, each of which causes conversion and printing of +202 + +the next successive argument to fprintf. Each conversion specification begins with the character %and ends with a conversion character. Between the %and the conversion character there may be, in order: + +· Flags (in any order), which modify the specification: + +o -, which specifies left adjustment of the converted argument in its field. + +o +, which specifies that the number will always be printed with a sign. + +o space: if the first character is not a sign, a space will be prefixed. + +o 0: for numeric conversions, specifies padding to the field width with leading zeros. + +o #, which specifies an alternate output form. For o, the first digit will become zero. For xor X, 0xor 0Xwill be prefixed to a non-zero result. For e, E, f, g, and G, the output will always have a decimal point; for gand G, trailing zeros will not be removed. + +· A number specifying a minimum field width. The converted argument will be printed in a field at least this wide, and wider if necessary. If the converted argument has fewer characters than the field width it will be padded on the left (or right, if left adjustment has been requested) to make up the field width. The padding character is normally space, but is 0 if the zero padding flag is present. + +· A period, which separates the field width from the precision. + +· A number, the precision, that specifies the maximum number of characters to be printed from a string, or the number of digits to be printed after the decimal point for e, E, or f conversions, or the number of significant digits for gor Gconversion, or the number of digits to be printed for an integer (leading 0s will be added to make up the necessary width). + +· A length modifier h, l(letter ell), or L. ``h'' indicates that the corresponding argument is to be printed as a shortor unsigned short; ``l'' indicates that the argument is a long or unsigned long, ``L'' indicates that the argument is a long double. + +Width or precision or both may be specified as *, in which case the value is computed by converting the next argument(s), which must be int. + +The conversion characters and their meanings are shown in Table B.1. If the character after the % is not a conversion character, the behavior is undefined. + +Table B.1 Printf Conversions + +Character Argument type; Printed As + +d,i o + +x,X + +u c + +s + +int; signed decimal notation. +int; unsigned octal notation (without a leading zero). +unsigned int; unsigned hexadecimal notation (without a leading 0x or 0X), using abcdef for 0x or ABCDEF for 0X. +int; unsigned decimal notation. +int; single character, after conversion to unsigned char +char *; characters from the string are printed until a '\0' is reached or until the number of characters indicated by the precision have been printed. + + + +f + + + +e,E + + + +g,G + + +p + +n + +% + +203 + +double; decimal notation of the form [-]mmm.ddd, where the number of d's is given by the precision. The default precision is 6; a precision of 0 suppresses the decimal point. +double; decimal notation of the form [-]m.dddddde+/-xx or [-]m.ddddddE+/-xx, where the number of d's is specified by the precision. The default precision is 6; a precision of 0 suppresses the decimal point. +double; %e or %E is used if the exponent is less than -4 or greater than or equal to the precision; otherwise %f is used. Trailing zeros and a trailing decimal point are not printed. +void *; print as a pointer (implementation-dependent representation). +int *; the number of characters written so far by this call to printf is written into the argument. No argument is converted. +no argument is converted; print a % + +int printf(const char *format, ...) +printf(...) is equivalent to fprintf(stdout, ...). +int sprintf(char *s, const char *format, ...) +sprintf is the same as printf except that the output is written into the string s, terminated with '\0'. smust be big enough to hold the result. The return count does not include the '\0'. +int vprintf(const char *format, va_list arg) +int vfprintf(FILE *stream, const char *format, va_list arg) +int vsprintf(char *s, const char *format, va_list arg) +The functions vprintf, vfprintf, and vsprintfare equivalent to the corresponding printffunctions, except that the variable argument list is replaced by arg, which has been initialized by the va_startmacro and perhaps va_argcalls. See the discussion of in Section B.7. +B.1.3 Formatted Input +The scanf function deals with formatted input conversion. + +int fscanf(FILE *stream, const char *format, ...) +fscanf reads from stream under control of format, and assigns converted values through subsequent arguments, each of which must be a pointer. It returns when formatis exhausted. fscanfreturns EOFif end of file or an error occurs before any conversion; otherwise it returns the number of input items converted and assigned. +The format string usually contains conversion specifications, which are used to direct interpretation of input. The format string may contain: + +· Blanks or tabs, which are not ignored. + +· Ordinary characters (not %), which are expected to match the next non-white space character of the input stream. + +· Conversion specifications, consisting of a %, an optional assignment suppression character *, an optional number specifying a maximum field width, an optional h, l, or L indicating the width of the target, and a conversion character. +A conversion specification determines the conversion of the next input field. Normally the result is placed in the variable pointed to by the corresponding argument. If assignment suppression is indicated by *, as in %*s, however, the input field is simply skipped; no assignment is made. An input field is defined as a string of non-white space characters; it extends either to the next white space character or until the field width, if specified, is exhausted. This implies that scanf will read across line boundaries to find its input, since +204 + +newlines are white space. (White space characters are blank, tab, newline, carriage return, vertical tab, and formfeed.) +The conversion character indicates the interpretation of the input field. The corresponding argument must be a pointer. The legal conversion characters are shown in Table B.2. + +The conversion characters d, i, n, o, u, and x may be preceded by h if the argument is a pointer to shortrather than int, or by l(letter ell) if the argument is a pointer to long. The conversion characters e, f, and gmay be preceded by lif a pointer to double rather than float is in the argument list, and by L if a pointer to a long double. + +Table B.2 Scanf Conversions + +Character Input Data; Argument type + +d + +i + +o u x + + +c + + + +s + + + +e,f,g + + +p + +n + + +[...] + + +[^...] + +% + +decimal integer; int* +integer; int*. The integer may be in octal (leading 0) or hexadecimal (leading 0x or 0X). +octal integer (with or without leading zero); int *. unsigned decimal integer; unsigned int *. +hexadecimal integer (with or without leading 0x or 0X); int*. +characters; char*. The next input characters are placed in the indicated array, up to the number given by the width field; the default is 1. No '\0' is added. The normal skip over white space characters is suppressed in this case; to read the next non-white space character, use %1s. +string of non-white space characters (not quoted); char *, pointing to an array of characters large enough to hold the string and a terminating '\0' that will be added. +floating-point number; float *. The input format for float's is an optional sign, a string of numbers possibly containing a decimal point, and an optional exponent field containing an E or e followed by a possibly signed integer. +pointer value as printed by printf("%p");, void *. +writes into the argument the number of characters read so far by this call; int *. No input is read. The converted item count is not incremented. +matches the longest non-empty string of input characters from the set between brackets; char *. A '\0' is added. []...] includes ] in the set. +matches the longest non-empty string of input characters not from the set between brackets; char *. A '\0' is added. [^]...] includes ] in the set. +literal %; no assignment is made. + +int scanf(const char *format, ...) +scanf(...) is identical to fscanf(stdin, ...). +int sscanf(const char *s, const char *format, ...) +sscanf(s, ...) is equivalent to scanf(...) except that the input characters are taken from the string s. +B.1.4 Character Input and Output Functions + +int fgetc(FILE *stream) +fgetc returns the next character of stream as an unsigned char (converted to an int), or EOF if end of file or error occurs. +char *fgets(char *s, int n, FILE *stream) +fgetsreads at most the next n-1characters into the array s, stopping if a newline is encountered; the newline is included in the array, which is terminated by '\0'. fgets returns s, or NULL if end of file or error occurs. +205 + +int fputc(int c, FILE *stream) +fputcwrites the character c(converted to an unsigend char) on stream. It returns the character written, or EOF for error. +int fputs(const char *s, FILE *stream) +fputs writes the string s (which need not contain \n) on stream; it returns non-negative, or EOF for an error. +int getc(FILE *stream) +getcis equivalent to fgetcexcept that if it is a macro, it may evaluate streammore than once. +int getchar(void) +getchar is equivalent to getc(stdin). +char *gets(char *s) +getsreads the next input line into the array s; it replaces the terminating newline with '\0'. It returns s, or NULL if end of file or error occurs. +int putc(int c, FILE *stream) +putcis equivalent to fputcexcept that if it is a macro, it may evaluate streammore than once. +int putchar(int c) +putchar(c) is equivalent to putc(c,stdout). +int puts(const char *s) +puts writes the string sand a newline to stdout. It returns EOF if an error occurs, non-negative otherwise. +int ungetc(int c, FILE *stream) +ungetcpushes c(converted to an unsigned char) back onto stream, where it will be returned on the next read. Only one character of pushback per stream is guaranteed. EOF may not be pushed back. ungetcreturns the character pushed back, or EOFfor error. +B.1.5 Direct Input and Output Functions + +size_t fread(void *ptr, size_t size, size_t nobj, FILE *stream) +freadreads from streaminto the array ptrat most nobjobjects of size size. fread returns the number of objects read; this may be less than the number requested. feof and ferror must be used to determine status. +size_t fwrite(const void *ptr, size_t size, size_t nobj, FILE *stream) fwritewrites, from the array ptr, nobjobjects of size sizeon stream. It returns the number of objects written, which is less than nobj on error. +B.1.6 File Positioning Functions + +int fseek(FILE *stream, long offset, int origin) +fseek sets the file position for stream; a subsequent read or write will access data beginning at the new position. For a binary file, the position is set to offsetcharacters from origin, which may be SEEK_SET (beginning), SEEK_CUR (current position), or SEEK_END(end of file). For a text stream, offsetmust be zero, or a value returned by ftell (in which case origin must be SEEK_SET). fseek returns non-zero on error. +long ftell(FILE *stream) +ftell returns the current file position for stream, or -1 on error. +void rewind(FILE *stream) +rewind(fp) is equivalent to fseek(fp, 0L, SEEK_SET); clearerr(fp). +int fgetpos(FILE *stream, fpos_t *ptr) +fgetpos records the current position in stream in *ptr, for subsequent use by fsetpos. The type fpos_tis suitable for recording such values. fgetposreturns non-zero on error. +int fsetpos(FILE *stream, const fpos_t *ptr) +206 + +fsetpos positions stream at the position recorded by fgetpos in *ptr. fsetpos returns non-zero on error. +B.1.7 Error Functions +Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly. In addition, the integer expression errno(declared in ) may contain an error number that gives further information about the most recent error. +void clearerr(FILE *stream) +clearerr clears the end of file and error indicators for stream. +int feof(FILE *stream) +feof returns non-zero if the end of file indicator for stream is set. +int ferror(FILE *stream) +ferror returns non-zero if the error indicator for stream is set. +void perror(const char *s) +perror(s)prints sand an implementation-defined error message corresponding to the integer in errno, as if by +fprintf(stderr, "%s: %s\n", s, "error message"); See strerror in Section B.3. +B.2 Character Class Tests: +The header declares functions for testing characters. For each function, the argument list is an int, whose value must be EOFor representable as an unsigned char, and the return value is an int. The functions return non-zero (true) if the argument csatisfies the condition described, and zero if not. +isalnum(c) isalpha(c) or isdigit(c) is true isalpha(c) isupper(c) or islower(c) is true iscntrl(c) control character +isdigit(c) decimal digit +isgraph(c) printing character except space islower(c) lower-case letter +isprint(c) printing character including space +ispunct(c) printing character except space or letter or digit isspace(c) space, formfeed, newline, carriage return, tab, vertical tab isupper(c) upper-case letter +isxdigit(c) hexadecimal digit +In the seven-bit ASCII character set, the printing characters are 0x20 (' ')to 0x7E ('-'); the control characters are 0 NUL to 0x1F (US), and 0x7F (DEL). + +In addition, there are two functions that convert the case of letters: +int tolower(c) convert c to lower case int toupper(c) convert c to upper case +If c is an upper-case letter, tolower(c) returns the corresponding lower-case letter, toupper(c) returns the corresponding upper-case letter; otherwise it returns c. + +B.3 String Functions: +There are two groups of string functions defined in the header . The first have names beginning with str; the second have names beginning with mem. Except for memmove, the behavior is undefined if copying takes place between overlapping objects. Comparison functions treat arguments as unsigned char arrays. +207 + +In the following table, variables sand tare of type char *; csand ctare of type const char *; n is of type size_t; and c is an int converted to char. +char *strcpy(s,ct) copy string ct to string s, including '\0'; return s. +char copy at most n characters of string ct to s; return s. Pad with '\0''s *strncpy(s,ct,n) if ct has fewer than n characters. +char *strcat(s,ct) concatenate string ct to end of string s; return s. +char concatenate at most n characters of string ct to string s, terminate s *strncat(s,ct,n) with '\0'; return s. +int strcmp(cs,ct) compare string cs to string ct, return <0 if cs0 +if +. +cs>ct +int compare at most n characters of string cs to string ct; return <0 if strncmp(cs,ct,n) cs0 if cs>ct. +char *strchr(cs,c) return pointer to first occurrence of c in cs or NULL if not present. char *strrchr(cs,c)return pointer to last occurrence of c in cs or NULL if not present. +size_t +strspn(cs,ct) return length of prefix of cs consisting of characters in ct. +size_t +strcspn(cs,ct) return length of prefix of cs consisting of characters not in ct. char return pointer to first occurrence in string cs of any character string *strpbrk(cs,ct) ct, or NULL if not present. +char *strstr(cs,ct)return pointer to first occurrence of string ct in cs, or NULL if not +present. + +size_t strlen(cs) return length of cs. +char *strerror(n) return pointer to implementation-defined string corresponding to +error +. +n +char *strtok(s,ct) strtok searches s for tokens delimited by characters from ct; see +below. + +A sequence of calls of strtok(s,ct)splits sinto tokens, each delimited by a character from ct. The first call in a sequence has a non-NULL s, it finds the first token in sconsisting of characters not in ct; it terminates that by overwriting the next character of swith '\0'and returns a pointer to the token. Each subsequent call, indicated by a NULLvalue of s, returns the next such token, searching from just past the end of the previous one. strtokreturns NULL when no further token is found. The string ct may be different on each call. + +The mem...functions are meant for manipulating objects as character arrays; the intent is an interface to efficient routines. In the following table, sand tare of type void *; csand ctare of type const void *; n is of type size_t; and c is an int converted to an unsigned char. + +*memcpy(s,ct,n) copy n characters from ct to s, and return s. +void +void +*memmove(s,ct,n) same as memcpy except that it works even if the objects overlap. int memcmp(cs,ct,n)compare the first n characters of cs with ct; return as with strcmp. void return pointer to first occurrence of character c in cs, or NULL if not *memchr(cs,c,n) present among the first n characters. +void *memset(s,c,n)place character c into first n characters of s, return s. +B.4 Mathematical Functions: The header declares mathematical functions and macros. +The macros EDOMand ERANGE(found in ) are non-zero integral constants that are used to signal domain and range errors for the functions; HUGE_VALis a positive doublevalue. A domain error occurs if an argument is outside the domain over which the function is defined. On a domain error, errnois set to EDOM; the return value is implementation-defined. A range error occurs if the result of the function cannot be represented as a double. If the +208 + +result overflows, the function returns HUGE_VAL with the right sign, and errno is set to ERANGE. If the result underflows, the function returns zero; whether errnois set to ERANGEis implementation-defined. + +In the following table, x and y are of type double, n is an int, and all functions return double. Angles for trigonometric functions are expressed in radians. +sin(x) sine of x cos(x) cosine of x tan(x) tangent of x +asin(x) sin-1(x) in range [-pi/2,pi/2], x in [-1,1]. acos(x) cos-1(x) in range [0,pi], x in [-1,1]. atan(x) tan-1(x) in range [-pi/2,pi/2]. atan2(y,x) tan-1(y/x) in range [-pi,pi]. +sinh(x) hyperbolic sine of x cosh(x) hyperbolic cosine of x tanh(x) hyperbolic tangent of x exp(x) exponential function ex log(x) natural logarithm ln(x), x>0. +log10(x) base 10 logarithm log10(x), x>0. +pow(x,y) xy. A domain error occurs if x=0 and y<=0, or if x<0 and y is not an +integer. + +sqrt(x) sqare root of x, x>=0. +ceil(x) smallest integer not less than x, as a double. floor(x) largest integer not greater than x, as a double. fabs(x) absolute value |x| +ldexp(x,n) x*2n +splits x into a normalized fraction in the interval [1/2,1) which is returned, and a power of 2, which is stored in *exp. If x is zero, both parts of the result are zero. +frexp(x, int +*ip) +modf(x, doublesplits x into integral and fractional parts, each with the same sign as x. It *ip) stores the integral part in *ip, and returns the fractional part. +floating-point remainder of x/y, with the same sign as x. If y is zero, the result is implementation-defined. +fmod(x,y) +B.5 Utility Functions: +The header declares functions for number conversion, storage allocation, and similar tasks. double atof(const char *s) +atof converts s to double; it is equivalent to strtod(s, (char**)NULL). +int atoi(const char *s) +converts s to int; it is equivalent to (int)strtol(s, (char**)NULL, 10). +long atol(const char *s) +converts s to long; it is equivalent to strtol(s, (char**)NULL, 10). +double strtod(const char *s, char **endp) +strtodconverts the prefix of sto double, ignoring leading white space; it stores a pointer to any unconverted suffix in *endpunless endpis NULL. If the answer would overflow, HUGE_VALis returned with the proper sign; if the answer would underflow, zero is returned. In either case errno is set to ERANGE. +long strtol(const char *s, char **endp, int base) +strtol converts the prefix of s to long, ignoring leading white space; it stores a pointer to any unconverted suffix in *endpunless endpis NULL. If baseis between 2 and 36, conversion is done assuming that the input is written in that base. If baseis zero, the base is 8, 10, or 16; leading 0 implies octal and leading 0xor 0Xhexadecimal. +209 + +Letters in either case represent digits from 10 to base-1; a leading 0x or 0X is permitted in base 16. If the answer would overflow, LONG_MAX or LONG_MIN is returned, depending on the sign of the result, and errno is set to ERANGE. +unsigned long strtoul(const char *s, char **endp, int base) +strtoulis the same as strtolexcept that the result is unsigned longand the error value is ULONG_MAX. +int rand(void) +rand returns a pseudo-random integer in the range 0 to RAND_MAX, which is at least 32767. +void srand(unsigned int seed) +srand uses seed as the seed for a new sequence of pseudo-random numbers. The initial seed is 1. +void *calloc(size_t nobj, size_t size) +callocreturns a pointer to space for an array of nobjobjects, each of size size, or NULL if the request cannot be satisfied. The space is initialized to zero bytes. +void *malloc(size_t size) +mallocreturns a pointer to space for an object of size size, or NULLif the request cannot be satisfied. The space is uninitialized. +void *realloc(void *p, size_t size) +reallocchanges the size of the object pointed to by pto size. The contents will be unchanged up to the minimum of the old and new sizes. If the new size is larger, the new space is uninitialized. reallocreturns a pointer to the new space, or NULLif the request cannot be satisfied, in which case *p is unchanged. +void free(void *p) +freedeallocates the space pointed to by p; it does nothing if pis NULL. pmust be a pointer to space previously allocated by calloc, malloc, or realloc. +void abort(void) +abort causes the program to terminate abnormally, as if by raise(SIGABRT). +void exit(int status) +exitcauses normal program termination. atexitfunctions are called in reverse order of registration, open files are flushed, open streams are closed, and control is returned to the environment. How status is returned to the environment is implementation-dependent, but zero is taken as successful termination. The values EXIT_SUCCESSand EXIT_FAILURE may also be used. +int atexit(void (*fcn)(void)) +atexitregisters the function fcnto be called when the program terminates normally; it returns non-zero if the registration cannot be made. +int system(const char *s) +system passes the string s to the environment for execution. If s is NULL, system returns non-zero if there is a command processor. If sis not NULL, the return value is implementation-dependent. +char *getenv(const char *name) +getenv returns the environment string associated with name, or NULL if no string exists. Details are implementation-dependent. + +void *bsearch(const void *key, const void *base, size_t n, size_t size, +int (*cmp)(const void *keyval, const void *datum)) bsearchsearches base[0]...base[n-1]for an item that matches *key. The function cmpmust return negative if its first argument (the search key) is less than its second (a table entry), zero if equal, and positive if greater. Items in the array basemust be in ascending order. bsearch returns a pointer to a matching item, or NULL if none exists. + +void qsort(void *base, size_t n, size_t size, +210 + +int (*cmp)(const void *, const void *)) +qsort sorts into ascending order an array base[0]...base[n-1]of objects of size size. The comparison function cmp is as in bsearch. +int abs(int n) +abs returns the absolute value of its int argument. +long labs(long n) +labs returns the absolute value of its long argument. +div_t div(int num, int denom) +divcomputes the quotient and remainder of num/denom. The results are stored in the int members quot and rem of a structure of type div_t. +ldiv_t ldiv(long num, long denom) +ldivcomputes the quotient and remainder of num/denom. The results are stored in the long members quot and rem of a structure of type ldiv_t. +B.6 Diagnostics: +The assert macro is used to add diagnostics to programs: + +void assert(int expression) + +If expression is zero when + +assert(expression) + +is executed, the assert macro will print on stderr a message, such as + +Assertion failed:expression, filefilename, linennn + +It then calls abortto terminate execution. The source filename and line number come from the preprocessor macros __FILE__ and __LINE__. + +If NDEBUG is defined at the time is included, the assert macro is ignored. + +B.7 Variable Argument Lists: +The header provides facilities for stepping through a list of function arguments of unknown number and type. +Suppose lastarg is the last named parameter of a function f with a variable number of arguments. Then declare within fa variable of type va_listthat will point to each argument in turn: + +va_list ap; +ap must be initialized once with the macro va_start before any unnamed argument is accessed: +va_start(va_list ap, lastarg); + +Thereafter, each execution of the macro va_arg will produce a value that has the type and value of the next unnamed argument, and will also modify ap so the next use of va_arg returns the next argument: + +type va_arg(va_list ap, type); + +The macro + +void va_end(va_list ap); +must be called once after the arguments have been processed but before f is exited. +211 + +B.8 Non-local Jumps: +The declarations in provide a way to avoid the normal function call and return sequence, typically to permit an immediate return from a deeply nested function call. +int setjmp(jmp_buf env) +The macro setjmpsaves state information in envfor use by longjmp. The return is zero from a direct call of setjmp, and non-zero from a subsequent call of longjmp. A call to setjmpcan only occur in certain contexts, basically the test of if, switch, and loops, and only in simple relational expressions. + +if (setjmp(env) == 0) +/* get here on direct call */ else +/* get here by calling longjmp */ +void longjmp(jmp_buf env, int val) +longjmp restores the state saved by the most recent call to setjmp, using the information saved in env, and execution resumes as if the setjmp function had just executed and returned the non-zero value val. The function containing the setjmp must not have terminated. Accessible objects have the values they had at the time longjmp was called, except that non-volatile automatic variables in the function calling setjmp become undefined if they were changed after the setjmp call. +B.9 Signals: +The header provides facilities for handling exceptional conditions that arise during execution, such as an interrupt signal from an external source or an error in execution. + +void (*signal(int sig, void (*handler)(int)))(int) +signal determines how subsequent signals will be handled. If handler is SIG_DFL, the implementation-defined default behavior is used, if it is SIG_IGN, the signal is ignored; otherwise, the function pointed to by handlerwill be called, with the argument of the type of signal. Valid signals include +SIGABRT abnormal termination, e.g., from abort SIGFPE arithmetic error, e.g., zero divide or overflow SIGILL illegal function image, e.g., illegal instruction SIGINT interactive attention, e.g., interrupt +SIGSEGV illegal storage access, e.g., access outside memory limits SIGTERM termination request sent to this program + + +signalreturns the previous value of handlerfor the specific signal, or SIG_ERRif an error occurs. + +When a signal sigsubsequently occurs, the signal is restored to its default behavior; then the signal-handler function is called, as if by (*handler)(sig). If the handler returns, execution will resume where it was when the signal occurred. + +The initial state of signals is implementation-defined. + +int raise(int sig) +raise sends the signal sig to the program; it returns non-zero if unsuccessful. +B.10 Date and Time Functions: +The header declares types and functions for manipulating date and time. Some functions process local time, which may differ from calendar time, for example because of time +212 + +zone. clock_tand time_tare arithmetic types representing times, and struct tmholds the components of a calendar time: +int tm_sec; seconds after the minute (0,61) int tm_min; minutes after the hour (0,59) int tm_hour; hours since midnight (0,23) int tm_mday; day of the month (1,31) +int tm_mon; months since January (0,11) int tm_year; years since 1900 +int tm_wday; days since Sunday (0,6) +int tm_yday; days since January 1 (0,365) int tm_isdst; Daylight Saving Time flag +tm_isdst is positive if Daylight Saving Time is in effect, zero if not, and negative if the information is not available. + +clock_t clock(void) +clock returns the processor time used by the program since the beginning of execution, or -1 if unavailable. clock()/CLK_PER_SEC is a time in seconds. +time_t time(time_t *tp) +timereturns the current calendar time or -1if the time is not available. If tpis not NULL, the return value is also assigned to *tp. +double difftime(time_t time2, time_t time1) difftime returns time2-time1 expressed in seconds. +time_t mktime(struct tm *tp) +mktime converts the local time in the structure *tp into calendar time in the same representation used by time. The components will have values in the ranges shown. mktime returns the calendar time or -1 if it cannot be represented. +The next four functions return pointers to static objects that may be overwritten by other calls. +char *asctime(const struct tm *tp) +asctime and +The header defines constants for the sizes of integral types. The values below are acceptable minimum magnitudes; larger values may be used. +CHAR_BIT 8 bits in a char CHAR_MAX UCHAR_MAX or maximum value of char +SCHAR_MAX +CHAR_MIN 0or SCHAR_MIN maximum value of char INT_MAX 32767 maximum value of int INT_MIN -32767 minimum value of int LONG_MAX 2147483647 maximum value of long LONG_MIN -2147483647 minimum value of long +SCHAR_MAX +127 maximum value of signed char SCHAR_MIN -127 minimum value of signed char SHRT_MAX +32767 maximum value of short SHRT_MIN -32767 minimum value of short UCHAR_MAX 255 maximum value of unsigned char UINT_MAX 65535 maximum value of unsigned int ULONG_MAX 4294967295 maximum value of unsigned long USHRT_MAX 65535 maximum value of unsigned +short +The names in the table below, a subset of , are constants related to floating-point arithmetic. When a value is given, it represents the minimum magnitude for the corresponding quantity. Each implementation defines appropriate values. +FLT_RADIX 2 radix of exponent, representation, e.g., 2, 16 FLT_ROUNDS floating-point rounding mode for addition FLT_DIG 6 decimal digits of precision +FLT_EPSILON 1E-5 smallest number x such that 1.0+x != 1.0 FLT_MANT_DIG number of base FLT_RADIX in mantissa FLT_MAX 1E+37 maximum floating-point number +FLT_MAX_EXP maximum n such that FLT_RADIXn-1 is representable FLT_MIN 1E-37 minimum normalized floating-point number FLT_MIN_EXP minimum n such that 10n is a normalized number DBL_DIG 10 decimal digits of precision +DBL_EPSILON 1E-9 smallest number x such that 1.0+x != 1.0 DBL_MANT_DIG number of base FLT_RADIX in mantissa + + +DBL_MAX DBL_MAX_EXP DBL_MIN +DBL_MIN_EXP + +214 + +1E+37 maximum double floating-point number +maximum n such that FLT_RADIXn-1 is representable 1E-37 minimum normalized double floating-point number +minimum n such that 10n is a normalized number +215 + + +Appendix C - Summary of Changes +Since the publication of the first edition of this book, the definition of the C language has undergone changes. Almost all were extensions of the original language, and were carefully designed to remain compatible with existing practice; some repaired ambiguities in the original description; and some represent modifications that change existing practice. Many of the new facilities were announced in the documents accompanying compilers available from AT&T, and have subsequently been adopted by other suppliers of C compilers. More recently, the ANSI committee standardizing the language incorporated most of the changes, and also introduced other significant modifications. Their report was in part participated by some commercial compilers even before issuance of the formal C standard. +This Appendix summarizes the differences between the language defined by the first edition of this book, and that expected to be defined by the final standard. It treats only the language itself, not its environment and library; although these are an important part of the standard, there is little to compare with, because the first edition did not attempt to prescribe an environment or library. + +· Preprocessing is more carefully defined in the Standard than in the first edition, and is extended: it is explicitly token based; there are new operators for concatenation of tokens (##), and creation of strings (#); there are new control lines like #elif and #pragma; redeclaration of macros by the same token sequence is explicitly permitted; parameters inside strings are no longer replaced. Splicing of lines by \ is permitted everywhere, not just in strings and macro definitions. See Par.A.12. + +· The minimum significance of all internal identifiers increased to 31 characters; the smallest mandated significance of identifiers with external linkage remains 6 monocase letters. (Many implementations provide more.) + +· Trigraph sequences introduced by ?? allow representation of characters lacking in some character sets. Escapes for #\^[]{}|~are defined, see Par.A.12.1. Observe that the introduction of trigraphs may change the meaning of strings containing the sequence ??. + +· New keywords (void, const, volatile, signed, enum) are introduced. The stillborn entry keyword is withdrawn. + +· New escape sequences, for use within character constants and string literals, are defined. The effect of following \ by a character not part of an approved escape sequence is undefined. See Par.A.2.5.2. + +· Everyone's favorite trivial change: 8 and 9 are not octal digits. + +· The standard introduces a larger set of suffixes to make the type of constants explicit: U or Lfor integers, For Lfor floating. It also refines the rules for the type of unsiffixed constants (Par.A.2.5). + +· Adjacent string literals are concatenated. + +· There is a notation for wide-character string literals and character constants; see Par.A.2.6. + +· Characters as well as other types, may be explicitly declared to carry, or not to carry, a sign by using the keywords signed or unsigned. The locution long float as a +216 + +synonym for doubleis withdrawn, but long doublemay be used to declare an extra-precision floating quantity. + +· For some time, type unsigned charhas been available. The standard introduces the signed keyword to make signedness explicit for char and other integral objects. + +· The void type has been available in most implementations for some years. The Standard introduces the use of the void *type as a generic pointer type; previously char *played this role. At the same time, explicit rules are enacted against mixing pointers and integers, and pointers of different type, without the use of casts. + +· The Standard places explicit minima on the ranges of the arithmetic types, and mandates headers ( and ) giving the characteristics of each particular implementation. + +· Enumerations are new since the first edition of this book. + +· The Standard adopts from C++ the notion of type qualifier, for example const (Par.A.8.2). + +· Strings are no longer modifiable, and so may be placed in read-only memory. + +· The ``usual arithmetic conversions'' are changed, essentially from ``for integers, unsigned always wins; for floating point, always use double'' to ``promote to the smallest capacious-enough type.'' See Par.A.6.5. + +· The old assignment operators like =+are truly gone. Also, assignment operators are now single tokens; in the first edition, they were pairs, and could be separated by white space. + +· A compiler's license to treat mathematically associative operators as computationally associative is revoked. + +· A unary + operator is introduced for symmetry with unary -. + +· A pointer to a function may be used as a function designator without an explicit * operator. See Par.A.7.3.2. + +· Structures may be assigned, passed to functions, and returned by functions. + +· Applying the address-of operator to arrays is permitted, and the result is a pointer to the array. + +· The sizeof operator, in the first edition, yielded type int; subsequently, many implementations made it unsigned. The Standard makes its type explicitly implementation-dependent, but requires the type, size_t, to be defined in a standard header (). A similar change occurs in the type (ptrdiff_t) of the difference between pointers. See Par.A.7.4.8 and Par.A.7.7. + +· The address-of operator &may not be applied to an object declared register, even if the implementation chooses not to keep the object in a register. + +· The type of a shift expression is that of the left operand; the right operand can't promote the result. See Par.A.7.8. + +· The Standard legalizes the creation of a pointer just beyond the end of an array, and allows arithmetic and relations on it; see Par.A.7.7. +217 + +· The Standard introduces (borrowing from C++) the notion of a function prototype declaration that incorporates the types of the parameters, and includes an explicit recognition of variadic functions together with an approved way of dealing with them. See Pars. A.7.3.2, A.8.6.3, B.7. The older style is still accepted, with restrictions. + +· Empty declarations, which have no declarators and don't declare at least a structure, union, or enumeration, are forbidden by the Standard. On the other hand, a declaration with just a structure or union tag redeclares that tag even if it was declared in an outer scope. + +· External data declarations without any specifiers or qualifiers (just a naked declarator) are forbidden. + +· Some implementations, when presented with an externdeclaration in an inner block, would export the declaration to the rest of the file. The Standard makes it clear that the scope of such a declaration is just the block. + +· The scope of parameters is injected into a function's compound statement, so that variable declarations at the top level of the function cannot hide the parameters. + +· The name spaces of identifiers are somewhat different. The Standard puts all tags in a single name space, and also introduces a separate name space for labels; see Par.A.11.1. Also, member names are associated with the structure or union of which they are a part. (This has been common practice from some time.) + +· Unions may be initialized; the initializer refers to the first member. + +· Automatic structures, unions, and arrays may be initialized, albeit in a restricted way. + +· Character arrays with an explicit size may be initialized by a string literal with exactly that many characters (the \0 is quietly squeezed out). + +· The controlling expression, and the case labels, of a switch may have any integral type. diff --git a/Cisco Press CCIE Routing and Switching v5.0 Official Cert Guide Volume 1 Fifth Edition August 2014 conv.txt b/Cisco Press CCIE Routing and Switching v5.0 Official Cert Guide Volume 1 Fifth Edition August 2014 conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..c00246e4c5b1d11664b993ec1ec464ea38489b8b --- /dev/null +++ b/Cisco Press CCIE Routing and Switching v5.0 Official Cert Guide Volume 1 Fifth Edition August 2014 conv.txt @@ -0,0 +1,46087 @@ +CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 +Fifth Edition + + +Narbik Kocharians, CCIE No. 12410 Peter Palúch, CCIE No. 23527 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Cisco Press 800 East 96th Street +Indianapolis, IN 46240 +CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1, Fifth Edition + +Narbik Kocharians, CCIE No. 12410 + +Peter Palúch, CCIE No. 23527 + +Copyright© 2015 Pearson Education, Inc. + +Published by: Cisco Press +800 East 96th Street Indianapolis, IN 46240 USA + +All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without written permission from the publisher, except for the inclusion of brief quotations in a review. + +Printed in the United States of America + +First Printing August 2014 + +Library of Congress Control Number: 2014944345 + +ISBN-13: 978-1-58714-396-0 + +ISBN-10: 1-58714-396-8 + + +Warning and Disclaimer +This book is designed to provide information about Cisco CCIE Routing and Switching Written Exam, No. 400-101. Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. + +The information is provided on an “as is” basis. The authors, Cisco Press, and Cisco Systems, Inc. shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the discs or programs that may accom-pany it. + +The opinions expressed in this book belong to the authors and are not necessarily those of Cisco Systems, Inc. +Trademark Acknowledgments +All terms mentioned in this book that are known to be trademarks or service marks have been appropri-ately capitalized. Cisco Press or Cisco Systems, Inc., cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. + +Special Sales +For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@pearsoned.com or (800) 382-3419. + +For government sales inquiries, please contact governmentsales@pearsoned.com. + +For questions about sales outside the U.S., please contact international@pearsoned.com. + + +Feedback Information +At Cisco Press, our goal is to create in-depth technical books of the highest quality and value. Each book is crafted with care and precision, undergoing rigorous development that involves the unique expertise of members from the professional technical community. + +Readers’ feedback is a natural continuation of this process. If you have any comments regarding how we could improve the quality of this book, or otherwise alter it to better suit your needs, you can contact us through email at feedback@ciscopress.com. Please make sure to include the book title and ISBN in your message. + + +We greatly appreciate your assistance. + +Publisher: Paul Boger + +Associate Publisher: Dave Dusthimer + +Business Operation Manager, Cisco Press: Jan Cornelssen + +Executive Editor: Brett Bartow + +Managing Editor: Sandra Schroeder + +Senior Development Editor: Christopher Cleveland + +Senior Project Editor: Tonya Simpson + + +Copy Editor: John Edwards + +Technical Editors: Paul Negron, Sean Wilkins + +Editorial Assistant: Vanessa Evans + +Cover Designer: Mark Shirar + +Composition: Tricia Bronkella + +Indexer: Tim Wright + +Proofreader: Chuck Hutchinson +iv CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +About the Authors + +Narbik Kocharians, CCIE No. 12410 (Routing and Switching, Security, SP), is a Triple CCIE with more than 32 years of experience in the IT industry. He has designed, implemented, and supported numerous enterprise networks. Narbik is the president of Micronics Training Inc. (www.micronicstraining.com), where he teaches CCIE R&S and SP boot camps. + +Peter Palúch, CCIE No. 23527 (Routing and Switching), is an assistant professor, Cisco Networking Academy instructor, and instructor trainer at the Faculty of Management Science and Informatics, University of Zilina, Slovakia. Peter has cooperated in various educational activities in Slovakia and abroad, focusing on networking and Linux-based network server systems. He is also active at the Cisco Support Community, holding the Cisco Designated VIP award in LAN & WAN Routing and Switching areas since the award program inception in 2011. Upon invitation by Cisco in 2012, Peter joined two Job Task Analysis groups that assisted defining the upcoming CCIE R&S and CCNP R&S cer-tification exam topics. Peter holds an M.Sc. degree in Applied Informatics and a doctoral degree in the area of VoIP quality degradation factors. Together with his students, Peter has started the project of implementing the EIGRP routing protocol into the Quagga open-source routing software suite, and has been driving the effort since its inception in 2013. +v + +About the Technical Reviewers + +Paul Negron, CCIE No. 14856, CCSI No. 22752, has been affiliated with networking technologies for 17 years and has been involved with the design of core network ser-vices for a number of service providers, such as Comcast, Qwest, British Telecom, and Savvis to name a few. He currently instructs all the CCNP Service Provider–level courses, including Advanced BGP, MPLS, and the QoS course. Paul has six years of experience with satellite communications as well as ten years of experience with Cisco platforms. + +Sean Wilkins is an accomplished networking consultant for SR-W Consulting +(www.sr-wconsulting.com) and has been in the field of IT since the mid 1990s, working with companies such as Cisco, Lucent, Verizon, and AT&T as well as several other private companies. Sean currently holds certifications with Cisco (CCNP/CCDP), Microsoft (MCSE), and CompTIA (A+ and Network+). He also has a Master of Science in informa-tion technology with a focus in network architecture and design, a Master of Science +in organizational management, a Master’s Certificate in network security, a Bachelor of Science in computer networking, and Associates of Applied Science in computer infor-mation systems. In addition to working as a consultant, Sean spends most of his time as a technical writer and editor for various companies; check out this work at his author web-site: www.infodispersion.com. +vi CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Dedications + +From Narbik Kocharians: + +I would like to dedicate this book to my wife, Janet, for her love, encouragement, and continuous support, and to my dad for his words of wisdom. + +From Peter Palúch: + +To my family, students, colleagues, and friends. +vii + +Acknowledgments From Narbik Kocharians: +First, I would like to thank God for giving me the opportunity and ability to write, teach, and do what I truly enjoy doing. Also, I would like to thank my family, especially my wife of 29 years, Janet, for her constant encouragement and help. She does such an amaz-ing job of interacting with students and handling all the logistics of organizing classes as I focus on teaching. I also would like to thank my children, Chris, Patrick, Alexandra, and my little one, Daniel, for their patience. + +A special thanks goes to Mr. Brett Bartow for his patience and our constant changing of the deadlines. It goes without saying that the technical editors and reviewers did a +phenomenal job; thank you very much. Finally, I would like to thank all my students who inspire me every day, and you, for reading this book. + +From Peter Palúch: + +The opportunity to cooperate on the new edition of this book has been an honor and privilege beyond words for me. Wendell Odom, who has so gracefully and generously passed the torch to us, was the key person in introducing me to the Cisco Press repre-sentatives as a possible author, and I will be forever indebted to him for all the trust he has blessed us with. I have strived very much to live up to the unparalelled high level of content all previous authors have maintained throughout all editions of this book, and I would like to sincerely thank all of them for authoring such a great book that has signifi-cantly helped me achieve my certification in the first place. + +My next immense thank you goes to Brett Bartow, the executive editor for this book. Brett’s inviting and forthcoming attitude throughout the time of editing the book, com-pounded with his patience and understanding for my ever-moving (and constantly missed) deadlines, is second to none. He has done all in his power to help us, the authors, without compromising the quality of the work. + +I would not have been able to complete my work on this volume without the endless sup-port of my family. They have encouraged me, supported me, and gone out of their way to accommodate my needs. Words are not enough to express my gratitude. + +Psalm 127, whose musical setting in works of Monteverdi, Handel, or Vivaldi I have come to admire, begins with words “Unless the Lord build the house, they labor in vain who build.” Indeed, if it was not first and foremost the Lord’s blessing and help through-out, this work would not have been finished successfully. To my Lord and Savior, Jesus Christ—thank you! +viii CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Contents at a Glance Introduction xxiv +Part I LAN Switching Chapter 1 Ethernet Basics 3 +Chapter 2 Virtual LANs and VLAN Trunking 47 + + +Chapter 3 + +Part II + +Spanning Tree Protocol 103 + +IP Networking + +Chapter 4 IP Addressing 183 + +Chapter 5 IP Services 227 + + +Part III +Chapter 6 + +IP IGP Routing +IP Forwarding (Routing) 267 + + +Chapter 7 RIPv2 and RIPng 313 + + +Chapter 8 + +Chapter 9 + +EIGRP 347 + +OSPF 453 + + +Chapter 10 IS-IS 563 + + +Chapter 11 + + +Part IV + +IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 633 + +Final Preparation + + + +Chapter 12 + +Part V + +Final Preparation 701 + +Appendixes + +Appendix A Answers to the “Do I Know This Already?” Quizzes 707 + +Appendix B CCIE Exam Updates 713 + +Index 714 + +CD-Only + +Appendix C + +Appendix D + +Appendix E + +Appendix F + +Appendix G + +Decimal to Binary Conversion Table + +IP Addressing Practice + +Key Tables for CCIE Study + +Solutions for Key Tables for CCIE Study + +Study Planner + + +Glossary +ix + +Contents Introduction xxiv + + +Part I + +Chapter 1 + +LAN Switching + +Ethernet Basics 3 + +“Do I Know This Already?” Quiz 3 Foundation Topics 8 +Ethernet Layer 1: Wiring, Speed, and Duplex 8 RJ-45 Pinouts and Category 5 Wiring 8 Autonegotiation, Speed, and Duplex 9 CSMA/CD 10 +Collision Domains and Switch Buffering 10 Basic Switch Port Configuration 11 +Ethernet Layer 2: Framing and Addressing 14 Types of Ethernet Addresses 16 +Ethernet Address Formats 17 +Protocol Types and the 802.3 Length Field 18 Switching and Bridging Logic 19 +SPAN, RSPAN, and ERSPAN 22 +Core Concepts of SPAN, RSPAN, and ERSPAN 23 Restrictions and Conditions 24 +Basic SPAN Configuration 26 Complex SPAN Configuration 26 RSPAN Configuration 26 ERSPAN Configuration 27 +Virtual Switch System 28 Virtual Switching System 29 +VSS Active and VSS Standby Switch 30 Virtual Switch Link 30 +Multichassis EtherChannel (MEC) 31 Basic VSS Configuration 31 +VSS Verification Procedures 35 IOS-XE 38 +Foundation Summary 41 +x CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Memory Builders 44 +Fill In Key Tables from Memory 44 Definitions 44 +Further Reading 45 + +Chapter 2 Virtual LANs and VLAN Trunking 47 “Do I Know This Already?” Quiz 47 Foundation Topics 51 +Virtual LANs 51 +VLAN Configuration 51 +Using VLAN Database Mode to Create VLANs 52 +Using Configuration Mode to Put Interfaces into VLANs 55 Using Configuration Mode to Create VLANs 56 +Modifying the Operational State of VLANs 57 Private VLANs 60 +VLAN Trunking: ISL and 802.1Q 69 ISL and 802.1Q Concepts 69 +ISL and 802.1Q Configuration 71 Allowed, Active, and Pruned VLANs 76 Trunk Configuration Compatibility 76 Configuring Trunking on Routers 77 802.1Q-in-Q Tunneling 79 +VLAN Trunking Protocol 83 +VTP Process and Revision Numbers 86 VTP Configuration 89 +Normal-Range and Extended-Range VLANs 94 Storing VLAN Configuration 94 +Configuring PPPoE 96 Foundation Summary 99 Memory Builders 101 +Fill In Key Tables from Memory 101 Definitions 101 +Further Reading 101 +xi + +Chapter 3 Spanning Tree Protocol 103 +“Do I Know This Already?” Quiz 103 Foundation Topics 107 +802.1D Spanning Tree Protocol and Improvements 107 +Choosing Which Ports Forward: Choosing Root Ports and Designated Ports 109 +Electing a Root Switch 110 Determining the Root Port 111 Determining the Designated Port 113 Converging to a New STP Topology 115 +Topology Change Notification and Updating the CAM 117 Transitioning from Blocking to Forwarding 119 +Per-VLAN Spanning Tree and STP over Trunks 119 STP Configuration and Analysis 124 +Rapid Spanning Tree Protocol 128 +New Port Roles, States and Types, and New Link Types 128 Changes to BPDU Format and Handling 132 Proposal/Agreement Process in RSTP 133 +Topology Change Handling in RSTP 136 +Rapid Per-VLAN Spanning Tree Plus (RPVST+) 137 Multiple Spanning Trees: IEEE 802.1s 137 +MST Principles of Operation 138 +Interoperability Between MST and Other STP Versions 141 MST Configuration 144 +Protecting and Optimizing STP 148 PortFast Ports 148 +Root Guard, BPDU Guard, and BPDU Filter: Protecting Access Ports 149 Protecting Against Unidirectional Link Issues 151 +Configuring and Troubleshooting EtherChannels 154 Load Balancing Across Port-Channels 154 +Port-Channel Discovery and Configuration 157 Troubleshooting Complex Layer 2 Issues 161 +Layer 2 Troubleshooting Process 162 +Layer 2 Protocol Troubleshooting and Commands 163 Troubleshooting Using Cisco Discovery Protocol 163 Troubleshooting Using Link Layer Discovery Protocol 165 Troubleshooting Using Basic Interface Statistics 167 +xii CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Troubleshooting Spanning Tree Protocol 170 Troubleshooting Trunking 171 Troubleshooting VTP 172 Troubleshooting EtherChannels 174 Approaches to Resolving Layer 2 Issues 175 +Foundation Summary 177 Memory Builders 179 +Fill in Key Tables from Memory 179 Definitions 179 +Further Reading 179 + +Part II IP Networking + +Chapter 4 IP Addressing 183 +“Do I Know This Already?” Quiz 183 Foundation Topics 187 +IP Operation 187 TCP Operation 187 UDP Operation 188 +IP Addressing and Subnetting 188 +IP Addressing and Subnetting Review 188 Subnetting a Classful Network Number 189 Comments on Classless Addressing 191 Subnetting Math 192 +Dissecting the Component Parts of an IP Address 192 +Finding Subnet Numbers and Valid Range of IP Addresses— Binary 193 +Decimal Shortcuts to Find the Subnet Number and Valid Range of IP Addresses 194 +Determining All Subnets of a Network—Binary 196 Determining All Subnets of a Network—Decimal 198 VLSM Subnet Allocation 200 +Route Summarization Concepts 201 +Finding Inclusive Summary Routes—Binary 202 Finding Inclusive Summary Routes—Decimal 203 Finding Exclusive Summary Routes—Binary 204 +CIDR, Private Addresses, and NAT 205 Classless Interdomain Routing 206 Private Addressing 207 +xiii + +Network Address Translation 207 Static NAT 209 +Dynamic NAT Without PAT 210 +Overloading NAT with Port Address Translation 211 Dynamic NAT and PAT Configuration 212 +IPv6 214 +IPv6 Address Format 215 Network Prefix 215 +IPv6 Address Types 216 +Address Management and Assignment 216 Static Configuration 217 +Stateless Address Autoconfiguration 217 Stateful DHCPv6 217 +Stateless DHCP 218 +IPv6 Transition Technologies 218 Dual Stack 218 +Tunneling 219 Translation 220 +Foundation Summary 221 Memory Builders 225 +Fill in Key Tables from Memory 225 Definitions 225 +Further Reading 225 + +Chapter 5 IP Services 227 +“Do I Know This Already?” Quiz 227 Foundation Topics 232 +ARP, Proxy ARP, Reverse ARP, BOOTP, and DHCP 232 ARP and Proxy ARP 232 +RARP, BOOTP, and DHCP 233 DHCP 234 +HSRP, VRRP, and GLBP 236 Network Time Protocol 240 SNMP 241 +SNMP Protocol Messages 243 SNMP MIBs 244 +SNMP Security 245 Syslog 245 +xiv CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Web Cache Communication Protocol 246 +Implementing the Cisco IOS IP Service Level Agreement (IP SLA) Feature 249 +Implementing NetFlow 250 +Implementing Router IP Traffic Export 252 Implementing Cisco IOS Embedded Event Manager 253 Implementing Remote Monitoring 254 +Implementing and Using FTP on a Router 255 Implementing a TFTP Server on a Router 256 Implementing Secure Copy Protocol 257 Implementing HTTP and HTTPS Access 257 Implementing Telnet Access 258 Implementing SSH Access 258 +Foundation Summary 259 Memory Builders 264 +Fill In Key Tables from Memory 264 Definitions 264 +Further Reading 264 + +Part III IP IGP Routing + +Chapter 6 IP Forwarding (Routing) 267 +“Do I Know This Already?” Quiz 267 Foundation Topics 271 +IP Forwarding 271 +Process Switching, Fast Switching, and Cisco Express Forwarding 272 Load Sharing with CEF and Related Issues 282 +Multilayer Switching 286 MLS Logic 286 +Using Routed Ports and Port-channels with MLS 287 MLS Configuration 291 +Policy Routing 296 +Routing Protocol Changes and Migration 299 Planning the Migration Strategy 300 +Activating New IGP While Keeping the Current IGP Intact 300 Verifying New IGP Adjacencies and Working Database Contents 301 Deactivating Current IGP 301 +Removing New IGP’s Temporary Settings 303 +Specifics of Distance-Vector Protocols in IGP Migration 303 +xv + +Foundation Summary 309 Memory Builders 310 +Fill In Key Tables from Memory 310 Definitions 310 +Further Reading 310 + +Chapter 7 RIPv2 and RIPng 313 +“Do I Know This Already?” Quiz 313 Foundation Topics 316 +Introduction to Dynamic Routing 316 RIPv2 Basics 318 +RIPv2 Convergence and Loop Prevention 320 Converged Steady-State Operation 327 +Triggered (Flash) Updates and Poisoned Routes 328 RIPv2 Convergence When Routing Updates Cease 331 Convergence Extras 334 +RIPv2 Configuration 334 +Enabling RIPv2 and the Effects of Autosummarization 335 RIPv2 Authentication 337 +RIPv2 Next-Hop Feature and Split Horizon 338 RIPv2 Offset Lists 338 +Route Filtering with Distribute Lists and Prefix Lists 338 RIPng for IPv6 339 +Foundation Summary 342 Memory Builders 345 +Definitions 345 Further Reading 345 +Chapter 8 EIGRP 347 +“Do I Know This Already?” Quiz 347 Foundation Topics 356 +EIGRP Basics and Evolution 356 +EIGRP Roots: Interior Gateway Routing Protocol 357 Moving from IGRP to Enhanced IGRP 358 +EIGRP Metrics, Packets, and Adjacencies 360 EIGRP Classic Metrics 360 +Bandwidth Metric Component 361 Delay Metric Component 361 +xvi CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Reliability Metric Component 362 Load Metric Component 362 MTU Metric Component 363 +Hop Count Metric Component 363 Calculating the Composite Metric 363 EIGRP Wide Metrics 364 +Tweaking Interface Metrics to Influence Path Selection 368 EIGRP Packet Format 368 +EIGRP Packets 371 +EIGRP Packets in Action 371 Hello Packets 372 Acknowledgment Packets 372 Update Packets 373 +Query Packet 374 Reply Packets 374 +SIA-Query and SIA-Reply Packets 374 Reliable Transport Protocol 374 +Router Adjacencies 376 Diffusing Update Algorithm 380 +Topology Table 380 +Computed, Reported, and Feasible Distances, and Feasibility Condition 384 +Local and Diffusing Computations in EIGRP 391 DUAL FSM 397 +Stuck-In-Active State 402 EIGRP Named Mode 410 +Address Family Section 414 +Per-AF-Interface Configuration Section 415 Per-AF-Topology Configuration Section 416 +Additional and Advanced EIGRP Features 417 Router ID 417 +Unequal-Cost Load Balancing 420 Add-Path Support 421 +Stub Routing 423 +Route Summarization 427 Passive Interfaces 431 Graceful Shutdown 432 +xvii + +Securing EIGRP with Authentication 432 Default Routing Using EIGRP 435 +Split Horizon 436 EIGRP Over the ToP 437 +EIGRP Logging and Reporting 443 EIGRP Route Filtering 443 +EIGRP Offset Lists 444 +Clearing the IP Routing Table 444 Foundation Summary 445 +Memory Builders 450 +Fill In Key Tables from Memory 450 Definitions 450 +Further Reading 450 + +Chapter 9 OSPF 453 +“Do I Know This Already?” Quiz 453 Foundation Topics 460 +OSPF Database Exchange 460 OSPF Router IDs 460 +Becoming Neighbors, Exchanging Databases, and Becoming Adjacent 461 OSPF Neighbor States 462 +Becoming Neighbors: The Hello Process 464 Transmitting LSA Headers to Neighbors 466 +Database Description Exchange: Master/Slave Relationship 466 Requesting, Getting, and Acknowledging LSAs 468 +Designated Routers on LANs 469 +Designated Router Optimization on LANs 470 DR Election on LANs 471 +Designated Routers on WANs and OSPF Network Types 472 +Caveats Regarding OSPF Network Types over NBMA Networks 474 Example of OSPF Network Types and NBMA 474 +SPF Calculation 479 +Steady-State Operation 480 OSPF Design and LSAs 480 +OSPF Design Terms 480 +OSPF Path Selection Process 482 LSA Types 482 +LSA Types 1 and 2 484 +LSA Type 3 and Inter-Area Costs 488 +xviii CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +LSA Types 4 and 5, and External Route Types 1 and 2 492 OSPF Design in Light of LSA Types 496 +Stubby Areas 496 +OSPF Path Choices That Do Not Use Cost 502 Choosing the Best Type of Path 502 +Best-Path Side Effects of ABR Loop Prevention 502 OSPF Configuration 505 +OSPF Costs and Clearing the OSPF Process 507 Alternatives to the OSPF network Command 510 OSPF Filtering 510 +Filtering Routes Using the distribute-list Command 511 OSPF ABR LSA Type 3 Filtering 513 +Filtering Type 3 LSAs with the area range Command 514 Virtual Link Configuration 515 +Configuring Classic OSPF Authentication 517 +Configuring Extended Cryptographic OSPF Authentication 520 Protecting OSPF Routers with TTL Security Check 522 +Tuning OSPF Performance 523 +Tuning the SPF Scheduling with SPF Throttling 524 Tuning the LSA Origination with LSA Throttling 526 Incremental SPF 527 +OSPFv2 Prefix Suppression 528 OSPF Stub Router Configuration 529 OSPF Graceful Restart 530 +OSPF Graceful Shutdown 532 OSPFv3 533 +Differences Between OSPFv2 and OSPFv3 533 +Virtual Links, Address Summarization, and Other OSPFv3 Features 534 OSPFv3 LSA Types 534 +OSPFv3 in NBMA Networks 536 Configuring OSPFv3 over Frame Relay 537 Enabling and Configuring OSPFv3 537 OSPFv3 Authentication and Encryption 546 OSPFv3 Address Family Support 548 OSPFv3 Prefix Suppression 552 +OSPFv3 Graceful Shutdown 552 Foundation Summary 553 +xix + +Memory Builders 560 +Fill in Key Tables from Memory 560 Definitions 560 +Further Reading 561 + +Chapter 10 IS-IS 563 +“Do I Know This Already?” Quiz 563 Foundation Topics 571 +OSI Network Layer and Addressing 572 Levels of Routing in OSI Networks 576 +IS-IS Metrics, Levels, and Adjacencies 577 IS-IS Packet Types 579 +Hello Packets 579 Link State PDUs 580 +Complete and Partial Sequence Numbers PDUs 585 IS-IS Operation over Different Network Types 586 +IS-IS Operation over Point-to-Point Links 587 IS-IS Operation over Broadcast Links 592 +Areas in IS-IS 598 Authentication in IS-IS 608 IPv6 Support in IS-IS 610 Configuring IS-IS 613 Foundation Summary 625 Memory Builders 629 +Fill In Key Tables from Memory 630 Definitions 630 +Further Reading 630 + +Chapter 11 IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 633 +“Do I Know This Already?” Quiz 633 Foundation Topics 638 +Route Maps, Prefix Lists, and Administrative Distance 638 Configuring Route Maps with the route-map Command 638 Route Map match Commands for Route Redistribution 640 Route Map set Commands for Route Redistribution 641 +IP Prefix Lists 641 Administrative Distance 644 +xx CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Route Redistribution 645 +Mechanics of the redistribute Command 645 Redistribution Using Default Settings 646 Setting Metrics, Metric Types, and Tags 649 +Redistributing a Subset of Routes Using a Route Map 650 Mutual Redistribution at Multiple Routers 654 +Preventing Suboptimal Routes by Setting the Administrative Distance 656 +Preventing Suboptimal Routes by Using Route Tags 659 +Using Metrics and Metric Types to Influence Redistributed Routes 661 Route Summarization 663 +EIGRP Route Summarization 664 OSPF Route Summarization 665 +Default Routes 665 +Using Static Routes to 0.0.0.0, with redistribute static 667 Using the default-information originate Command 669 Using the ip default-network Command 670 +Using Route Summarization to Create Default Routes 671 Performance Routing (PfR) 672 +Performance Routing Operational Phases 673 Performance Routing Concepts 674 Authentication 674 +Performance Routing Operational Roles 675 Master Controller (MC) 675 +Border Router 676 +PfR Basic Configuration 677 +Configuration of the Master Controller 677 Configuration of the Border Router 681 Task Completion on R3 682 +Troubleshooting Complex Layer 3 Issues 683 Layer 3 Troubleshooting Process 684 +Layer 3 Protocol Troubleshooting and Commands 686 IP Routing Processes 686 +Approaches to Resolving Layer 3 Issues 695 Foundation Summary 696 +xxi + +Memory Builders 698 +Fill In Key Tables from Memory 698 Definitions 698 + + + +Part IV + +Chapter 12 + +Further Reading 698 + +Final Preparation + +Final Preparation 701 + +Tools for Final Preparation 701 +Pearson Cert Practice Test Engine and Questions on the CD 701 Install the Software from the CD 701 +Activate and Download the Practice Exam 702 Activating Other Exams 702 +Premium Edition 703 +The Cisco Learning Network 703 Memory Tables 703 +Chapter-Ending Review Tools 704 Suggested Plan for Final Review/Study 704 +Using the Exam Engine 704 Summary 705 + +Part V + +Appendix A + +Appendixes + +Answers to the “Do I Know This Already?” Quizzes 707 + + +Appendix B CCIE Exam Updates 713 + +Index 714 + +CD-Only + + +Appendix C + +Appendix D + +Appendix E + +Appendix F + +Appendix G + +Decimal to Binary Conversion Table + +IP Addressing Practice + +Key Tables for CCIE Study + +Solutions for Key Tables for CCIE Study + +Study Planner + +Glossary +xxii CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Icons Used in This Book + + + + + +Communication Server + + + + +Headquarters + +PC + + + + + +Terminal + +PC with Software + + + + +File Server + +Sun Workstation + + + + +Web Server + +Macintosh + + + + + +Cisco Works Workstation + +Branch Office + + + + +House, Regular + + + + + + +Printer Laptop IBM Mainframe + + +Label Switch Router + +Cluster Controller + + + + +Gateway Router Bridge Hub ATM router Cisco MDS 9500 + + + + + +Catalyst Switch + + + + + +Cisco MDS 9500 + +Multilayer Switch + + + + + +Optical Services Router + +ATM Switch + + + + + +Enterprise Fibre Channel disk + + +Route/Switch Processor + + + + + +Fibre Channel JBOD + + +LAN2LAN Switch + + + + + +ONS 15540 + + + + +Network Cloud Line: Ethernet Line: Serial Line: Switched Serial +xxiii + +Command Syntax Conventions +The conventions used to present command syntax in this book are the same conventions used in the IOS Command Reference. The Command Reference describes these conventions as follows: + +■ Boldface indicates commands and keywords that are entered literally as shown. In actual configuration examples and output (not general command syntax), boldface indicates commands that are manually input by the user (such as a show command). + +■ Italic indicates arguments for which you supply actual values. + +■ Vertical bars (|) separate alternative, mutually exclusive elements. + +■ Square brackets ([ ]) indicate an optional element. + +■ Braces ({ }) indicate a required choice. + +■ Braces within brackets ([{ }]) indicate a required choice within an optional element. +xxiv CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Introduction + +The Cisco Certified Internetwork Expert (CCIE) certification might be the most chal-lenging and prestigious of all networking certifications. It has received numerous awards and certainly has built a reputation as one of the most difficult certifications to earn in all of the technology world. Having a CCIE certification opens doors professionally and typically results in higher pay and looks great on a resume. + +Cisco currently offers several CCIE certifications. This book covers the version 5.0 exam blueprint topics of the written exam for the CCIE Routing and Switching certification. The following list details the currently available CCIE certifications at the time of this book’s publication; check www.cisco.com/go/ccie for the latest information. The certifi-cations are listed in the order in which they appear on the web page: + +■ CCDE + +■ CCIE Collaboration + +■ CCIE Data Center + +■ CCIE Routing & Switching + +■ CCIE Security + +■ CCIE Service Provider + +■ CCIE Service Provider Operations + +■ CCIE Wireless + +Each of the CCDE and CCIE certifications requires the candidate to pass both a written exam and a one-day, hands-on lab exam. The written exam is intended to test your knowl-edge of theory, protocols, and configuration concepts that follow good design practices. The lab exam proves that you can configure and troubleshoot actual gear. + +Why Should I Take the CCIE Routing and Switching Written Exam? + +The first and most obvious reason to take the CCIE Routing and Switching written exam is that it is the first step toward obtaining the CCIE Routing and Switching certification. Also, you cannot schedule a CCIE lab exam until you pass the corresponding written exam. In short, if you want all the professional benefits of a CCIE Routing and Switching certification, you start by passing the written exam. + +The benefits of getting a CCIE certification are varied and include the following: + +■ Better pay + +■ Career-advancement opportunities +xxv + +■ Applies to certain minimum requirements for Cisco Silver and Gold Channel Partners, as well as those seeking Master Specialization, making you more valuable to Channel Partners + +■ Better movement through the problem-resolution process when calling the Cisco TAC + +■ Prestige + +■ Credibility for consultants and customer engineers, including the use of the Cisco CCIE logo + +The other big reason to take the CCIE Routing and Switching written exam is that it recertifies an individual’s associate-, professional-, and expert-level Cisco certifications, regardless of his or her technology track. Recertification requirements do change, so please verify the requirements at www.cisco.com/go/certifications. + +CCIE Routing and Switching Written Exam 400-101 + +The CCIE Routing and Switching written exam, at the time of this writing, consists of a two-hour exam administered at a proctored exam facility affiliated with Pearson VUE (www.vue.com/cisco). The exam typically includes approximately 100 multiple-choice questions. No simulation questions are currently part of the written exam. + +As with most exams, everyone wants to know what is on the exam. Cisco provides gen-eral guidance as to topics on the exam in the CCIE Routing and Switching written exam blueprint, the most recent copy of which can be accessed from www.cisco.com/go/ccie. + +Cisco changes both the CCIE written and lab blueprints over time, but Cisco seldom, if ever, changes the exam numbers. However, exactly this change occurred when the CCIE Routing and Switching blueprint was refreshed for v5.0. The previous written exam for v4.0 was numbered 350-001; the v5.0 written exam is identified by 400-101. + +Table I-1 lists the CCIE Routing and Switching written exam blueprint 5.0 at press time. Table I-1 also lists the chapters that cover each topic. + + +Table I-1 CCIE Routing and Switching Written Exam Blueprint + +Topics + + + +Book Book Volume Chapter + +1.0 Network Principles + +1.1 Network theory + +1.1.a Describe basic software architecture differences between IOS and IOS XE +1.1.a (i) Control plane and Forwarding plane 1 1 + +1.1.a (ii) Impact on troubleshooting and performance 1 1 + +1.1.a (iii) Excluding a specific platform’s architecture 1 1 +xxvi CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Topics + +1.1.b Identify Cisco Express Forwarding concepts + +1.1.b (i) RIB, FIB, LFIB, Adjacency table + +1.1.b (ii) Load-balancing hash + +1.1.b (iii) Polarization concept and avoidance + +1.1.c Explain general network challenges + +1.1.c (i) Unicast flooding + +1.1.c (ii) Out-of-order packets + +1.1.c (iii) Asymmetric routing + +1.1.c (iv) Impact of micro burst + +1.1.d Explain IP operations + +1.1.d (i) ICMP unreachable, redirect + +1.1.d (ii) IPv4 options, IPv6 extension headers + +1.1.d (iii) IPv4 and IPv6 fragmentation + +1.1.d (iv) TTL + +1.1.d (v) IP MTU + +1.1.e Explain TCP operations + +1.1.e (i) IPv4 and IPv6 PMTU + +1.1.e (ii) MSS + +1.1.e (iii) Latency + +1.1.e (iv) Windowing + +1.1.e (v) Bandwidth delay product + +1.1.e (vi) Global synchronization + +1.1.e (vii) Options + +1.1.f Explain UDP operations + +1.1.f (i) Starvation + +1.1.f (ii) Latency + +1.1.f (iii) RTP/RTCP concepts + +1.2 Network implementation and operation + +1.2.a Evaluate proposed changes to a network + +1.2.a (i) Changes to routing protocol parameters + +1.2.a (ii) Migrate parts of a network to IPv6 + +Book Book Volume Chapter + + +1 6 + +1 6 + +1 6 + + +1 4 + +1 4 + +1 4 + +1 4 + + +1 4 + +1 4 + +1 4 + +1 4 + +1 4 + + +1 4 + +1 4 + +1 4 + +1 4 + +1 4 + +1 4 + +1 4 + + +1 4 + +1 4 + +1 4 + + + +1 7–10 + +1 4 +xxvii + + + +Topics + +1.2.a (iii) Routing protocol migration + +1.2.a (iv) Adding multicast support + +1.2.a (v) Migrate Spanning Tree Protocol + +1.2.a (vi) Evaluate impact of new traffic on existing QoS design + +1.3 Network troubleshooting + +1.3.a Use IOS troubleshooting tools + +1.3.a (i) debug, conditional debug + +1.3.a (ii) ping, traceroute with extended options + +1.3.a (iii) Embedded packet capture + +1.3.a (iv) Performance monitor + +1.3.b Apply troubleshooting methodologies + +1.3.b (i) Diagnose the root cause of networking issues (analyze symptoms, identify and describe root cause) +1.3.b (ii) Design and implement valid solutions according to constraints +1.3.b (iii) Verify and monitor resolution + +1.3.c Interpret packet capture + +1.3.c (i) Using Wireshark trace analyzer + +1.3.c (ii) Using IOS embedded packet capture + +2.0 Layer 2 Technologies + +2.1 LAN switching technologies + +2.1.a Implement and troubleshoot switch administration + +2.1.a (i) Managing the MAC address table + +2.1.a (ii) errdisable recovery + +2.1.a (iii) L2 MTU + +2.1.b Implement and troubleshoot Layer 2 protocols + +2.1.b (i) CDP, LLDP + +2.1.b (ii) UDLD + +2.1.c Implement and troubleshoot VLAN + +2.1.c (i) Access ports + +2.1.c (ii) VLAN database + +2.1.c (iii) Normal, extended VLAN, voice VLAN + +Book Book Volume Chapter +1 6 + +2 8 + +1 3 + +2 3, 4, 5 + + + +1 4 + +1 4 + +2 9 + +1 5 + + +1 11 + +1 11 + +1 11 + + +2 9 + +2 9 + + + + + +1 1 + +1 3 + +1 1 + + +1 3 + +1 3 + + +1 2 + +1 2 + +1 2 +xxviii CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Topics + +2.1.d Implement and troubleshoot trunking + +2.1.d (i) VTPv1, VTPv2, VTPv3, VTP pruning + +2.1.d (ii) dot1Q + +2.1.d (iii) Native VLAN + +2.1.d (iv) Manual pruning + +2.1.e Implement and troubleshoot EtherChannel + +2.1.e (i) LACP, PAgP, manual + +2.1.e (ii) Layer 2, Layer 3 + +2.1.e (iii) Load balancing + +2.1.e (iv) EtherChannel misconfiguration guard + +2.1.f Implement and troubleshoot spanning tree + +2.1.f (i) PVST+/RPVST+/MST + +2.1.f (ii) Switch priority, port priority, path cost, STP timers + +2.1.f (iii) PortFast, BPDU Guard, BPDU Filter + +2.1.f (iv) Loop Guard, Root Guard + +2.1.g Implement and troubleshoot other LAN switching technologies + +2.1.g (i) SPAN, RSPAN, ERSPAN + +2.1.h Describe chassis virtualization and aggregation technologies + +2.1.h (i) Multichassis + +2.1.h (ii) VSS concepts + +2.1.h (iii) Alternatives to STP + +2.1.h (iv) Stackwise + +2.1.h (v) Excluding specific platform implementation + +2.1.i Describe spanning-tree concepts + +2.1.i (i) Compatibility between MST and RSTP + +2.1.i (ii) STP dispute, STP Bridge Assurance + +2.2 Layer 2 multicast + +2.2.a Implement and troubleshoot IGMP + +2.2.a (i) IGMPv1, IGMPv2, IGMPv3 + +2.2.a (ii) IGMP snooping + +2.2.a (iii) IGMP querier + +Book Book Volume Chapter + + +1 2 + +1 2 + +1 2 + +1 2 + + +1 3 + +1 3 + +1 3 + +1 3 + + +1 3 + +1 3 + +1 3 + +1 3 + + +1 1 + + +1 1 + +1 1 + +1 1 + +1 1 + +1 1 + + +1 3 + +1 3 + + + +2 7 + +2 7 + +2 7 +xxix + + + +Topics + +2.2.a (iv) IGMP filter + +2.2.a (v) IGMP proxy + +2.2.b Explain MLD + +2.2.c Explain PIM snooping + +2.3 Layer 2 WAN circuit technologies + +2.3.a Implement and troubleshoot HDLC + +2.3.b Implement and troubleshoot PPP + +2.3.b (i) Authentication (PAP, CHAP) + +2.3.b (ii) PPPoE + +2.3.b (iii) MLPPP + +2.3.c Describe WAN rate-based Ethernet circuits + +2.3.c (i) Metro and WAN Ethernet topologies + +2.3.c (ii) Use of rate-limited WAN Ethernet services + +3.0 Layer 3 Technologies + +3.1 Addressing technologies + +3.1.a Identify, implement, and troubleshoot IPv4 addressing and subnetting +3.1.a (i) Address types, VLSM + +3.1.a (ii) ARP + +3.1.b Identify, implement, and troubleshoot IPv6 addressing and subnetting +3.1.b (i) Unicast, multicast + +3.1.b (ii) EUI-64 + +3.1.b (iii) ND, RS/RA + +3.1.b (iv) Autoconfig/SLAAC, temporary addresses (RFC 4941) + +3.1.b (v) Global prefix configuration feature + +3.1.b (vi) DHCP protocol operations + +3.1.b (vii) SLAAC/DHCPv6 interaction + +3.1.b (viii) Stateful, stateless DHCPv6 + +3.1.b (ix) DHCPv6 prefix delegation + +3.2 Layer 3 multicast + +3.2.a Troubleshoot reverse path forwarding + +Book Book Volume Chapter +2 7 + +2 7 + +2 8 + +2 8 + + +2 6 + + +2 6 + +2 6 + +2 6 + + +2 6 + +2 6 + + + + + + +1 4 + +1 4 + + + +1 4 + +1 4 + +1 4 + +1 4 + +1 4 + +1 4 + +2 10 + +1 4 + +1 4 +xxx CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Topics Book Volume +3.2.a (i) RPF failure 2 + +3.2.a (ii) RPF failure with tunnel interface 2 + +3.2.b Implement and troubleshoot IPv4 protocol independent multicast +3.2.b (i) PIM dense mode, sparse mode, sparse-dense mode 2 + +3.2.b (ii) Static RP, auto-RP, BSR 2 + +3.2.b (iii) Bidirectional PIM 2 + +3.2.b (iv) Source-specific multicast 2 + +3.2.b (v) Group-to-RP mapping 2 + +3.2.b (vi) Multicast boundary 2 + +3.2.c Implement and troubleshoot multicast source discovery protocol + +3.2.c (i) Intra-domain MSDP (anycast RP) 2 + +3.2.c (ii) SA filter 2 + +3.2.d Describe IPv6 multicast + +3.2.d (i) IPv6 multicast addresses 2 + +3.2.d (ii) PIMv6 2 + +3.3 Fundamental routing concepts + +3.3.a Implement and troubleshoot static routing 1 + +3.3.b Implement and troubleshoot default routing 1 + +3.3.c Compare routing protocol types + +3.3.c (i) Distance vector 1 + +3.3.c (ii) Link state 1 + +3.3.c (iii) Path vector 1 + +3.3.d Implement, optimize, and troubleshoot administrative distance 1 + +3.3.e Implement and troubleshoot passive interface 1 + +3.3.f Implement and troubleshoot VRF lite 2 + +3.3.g Implement, optimize, and troubleshoot filtering with any routing 1 protocol +3.3.h Implement, optimize, and troubleshoot redistribution between 1 any routing protocols +3.3.i Implement, optimize, and troubleshoot manual and auto 1 summarization with any routing protocol + +Book Chapter +8 + +8 + + + +8 + +8 + +8 + +8 + +8 + +8 + + +8 + +8 + + +7 + +8 + + +6 + +7–11 + + +7 + +7 + +7 + +11 + +7–10 + +11 + +11 + +11 + +7–10 +xxxi + + + +Topics + +3.3.j Implement, optimize, and troubleshoot policy-based routing + +3.3.k Identify and troubleshoot suboptimal routing + +3.3.l Implement and troubleshoot bidirectional forwarding detection + +3.3.m Implement and troubleshoot loop prevention mechanisms + +3.3.m (i) Route tagging, filtering + +3.3.m (ii) Split horizon + +3.3.m (iii) Route poisoning + +3.3.n Implement and troubleshoot routing protocol authentication + +3.3.n (i) MD5 + +3.3.n (ii) Key-chain + +3.3.n (iii) EIGRP HMAC SHA2-256bit + +3.3.n (iv) OSPFv2 SHA1-196bit + +3.3.n (v) OSPFv3 IPsec authentication + +3.4 RIP (v2 and v6) + +3.4.a Implement and troubleshoot RIPv2 + +3.4.b Describe RIPv6 (RIPng) + +3.5 EIGRP (for IPv4 and IPv6) + +3.5.a Describe packet types + +3.5.a (i) Packet types (hello, query, update, and so on) + +3.5.a (ii) Route types (internal, external) + +3.5.b Implement and troubleshoot neighbor relationship + +3.5.b (i) Multicast, unicast EIGRP peering + +3.5.b (ii) OTP point-to-point peering + +3.5.b (iii) OTP route-reflector peering + +3.5.b (iv) OTP multiple service providers scenario + +3.5.c Implement and troubleshoot loop-free path selection + +3.5.c (i) RD, FD, FC, successor, feasible successor + +3.5.c (ii) Classic metric + +3.5.c (iii) Wide metric + +3.5.d Implement and troubleshoot operations + +3.5.d (i) General operations + +Book Book Volume Chapter +1 6 + +1 11 + +1 11 + + +1 11 + +1 7 + +1 7 + + +1 7–10 + +1 7–10 + +1 8 + +1 9 + +1 9 + + +1 7 + +1 7 + + + +1 8 + +1 8 + + +1 8 + +1 8 + +1 8 + +1 8 + + +1 8 + +1 8 + +1 8 + + +1 8 +xxxii CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Topics + +3.5.d (ii) Topology table, update, query, active, passive + +3.5.d (iii) Stuck in active + +3.5.d (iv) Graceful shutdown + +3.5.e Implement and troubleshoot EIGRP stub + +3.5.e (i) Stub + +3.5.e (ii) Leak-map + +3.5.f Implement and troubleshoot load balancing + +3.5.f (i) equal-cost + +3.5.f (ii) unequal-cost + +3.5.f (iii) add-path + +3.5.g Implement EIGRP (multiaddress) named mode + +3.5.g (i) Types of families + +3.5.g (ii) IPv4 address-family + +3.5.g (iii) IPv6 address-family + +3.5.h Implement, troubleshoot, and optimize EIGRP convergence and scalability +3.5.h (i) Describe fast convergence requirements + +3.5.h (ii) Control query boundaries + +3.5.h (iii) IP FRR/fast reroute (single hop) + +3.5.h (iv) Summary leak-map + +3.5.h (v) Summary metric + +3.6 OSPF (v2 and v3) + +3.6.a Describe packet types + +3.6.a (i) LSA types (1, 2, 3, 4, 5, 7, 9) + +3.6.a (ii) Route types (N1, N2, E1, E2) + +3.6.b Implement and troubleshoot neighbor relationship + +3.6.c Implement and troubleshoot OSPFv3 address-family support + +3.6.c (i) IPv4 address-family + +3.6.c (ii) IPv6 address-family + +3.6.d Implement and troubleshoot network types, area types, and router types +3.6.d (i) Point-to-point, multipoint, broadcast, nonbroadcast + +Book Book Volume Chapter +1 8 + +1 8 + +1 8 + + +1 8 + +1 8 + + +1 8 + +1 8 + +1 8 + + +1 8 + +1 8 + +1 8 + + + +1 8 + +1 8 + +1 8 + +1 8 + +1 8 + + + +1 9 + +1 9 + +1 9 + + +1 9 + +1 9 + + + +1 9 +xxxiii + + + +Topics Book Volume +3.6.d (ii) LSA types, area type: backbone, normal, transit, stub, NSSA, 1 totally stub +3.6.d (iii) Internal router, ABR, ASBR 1 + +3.6.d (iv) Virtual link 1 + +3.6.e Implement and troubleshoot path preference 1 + +3.6.f Implement and troubleshoot operations + +3.6.f (i) General operations 1 + +3.6.f (ii) Graceful shutdown 1 + +3.6.f (iii) GTSM (Generic TTL Security Mechanism) 1 + +3.6.g Implement, troubleshoot, and optimize OSPF convergence and scalability +3.6.g (i) Metrics 1 + +3.6.g (ii) LSA throttling, SPF tuning, fast hello 1 + +3.6.g (iii) LSA propagation control (area types, ISPF) 1 + +3.6.g (iv) IP FRR/fast reroute (single hop) 1 + +3.6.g (v) LFA/loop-free alternative (multihop) 1 + +3.6.g (vi) OSPFv3 prefix suppression 1 + +3.7 BGP + +3.7.a Describe, implement, and troubleshoot peer relationships + +3.7.a (i) Peer-group, template 2 + +3.7.a (ii) Active, passive 2 + +3.7.a (iii) States, timers 2 + +3.7.a (iv) Dynamic neighbors 2 + +3.7.b Implement and troubleshoot IBGP and EBGP + +3.7.b (i) EBGP, IBGP 2 + +3.7.b (ii) 4-byte AS number 2 + +3.7.b (iii) Private AS 2 + +3.7.c Explain attributes and best-path selection 2 + +3.7.d Implement, optimize, and troubleshoot routing policies + +3.7.d (i) Attribute manipulation 2 + +3.7.d (ii) Conditional advertisement 2 + +3.7.d (iii) Outbound route filtering 2 + +Book Chapter +9 + +9 + +9 + +9 + + +9 + +9 + +9 + + + +9 + +9 + +9 + +9 + +9 + +9 + + + +1 + +1 + +1 + +1 + + +1 + +1 + +1 + +1 + + +2 + +2 + +2 +xxxiv CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Topics + +3.7.d (iv) Communities, extended communities + +3.7.d (v) Multihoming + +3.7.e Implement and troubleshoot scalability + +3.7.e (i) Route-reflector, cluster + +3.7.e (ii) Confederations + +3.7.e (iii) Aggregation, AS set + +3.7.f Implement and troubleshoot multiprotocol BGP + +3.7.f (i) IPv4, IPv6, VPN address-family + +3.7.g Implement and troubleshoot AS path manipulations + +3.7.g (i) Local AS, allow AS in, remove private AS + +3.7.g (ii) Prepend + +3.7.g (iii) Regexp + +3.7.h Implement and troubleshoot other features + +3.7.h (i) Multipath + +3.7.h (ii) BGP synchronization + +3.7.h (iii) Soft reconfiguration, route refresh + +3.7.i Describe BGP fast convergence features + +3.7.i (i) Prefix independent convergence + +3.7.i (ii) Add-path + +3.7.i (iii) Next-hop address tracking + +3.8 IS-IS (for IPv4 and IPv6) + +3.8.a Describe basic IS-IS network + +3.8.a (i) Single area, single topology + +3.8.b Describe neighbor relationship + +3.8.c Describe network types, levels, and router types + +3.8.c (i) NSAP addressing + +3.8.c (ii) Point-to-point, broadcast + +3.8.d Describe operations + +3.8.e Describe optimization features + +3.8.e (i) Metrics, wide metric + +4.0 VPN Technologies + +Book Book Volume Chapter +2 2 + +2 2 + + +2 2 + +2 2 + +2 2 + + +2 2 + + +2 2 + +2 2 + +2 2 + + +2 2 + +2 2 + +2 2 + + +2 2 + +2 2 + +2 2 + + + +1 10 + +1 10 + + +1 10 + +1 10 + +1 10 + + +1 10 +xxxv + + + +Topics + +4.1 Tunneling + +4.1.a Implement and troubleshoot MPLS operations + +4.1.a (i) Label stack, LSR, LSP + +4.1.a (ii) LDP + +4.1.a (iii) MPLS ping, MPLS traceroute + +4.1.b Implement and troubleshoot basic MPLS L3VPN + +4.1.b (i) L3VPN, CE, PE, P + +4.1.b (ii) Extranet (route leaking) + +4.1.c Implement and troubleshoot encapsulation + +4.1.c (i) GRE + +4.1.c (ii) Dynamic GRE + +4.1.c (iii) LISP encapsulation principles supporting EIGRP OTP + +4.1.d Implement and troubleshoot DMVPN (single hub) + +4.1.d (i) NHRP + +4.1.d (ii) DMVPN with IPsec using preshared key + +4.1.d (iii) QoS profile + +4.1.d (iv) Pre-classify + +4.1.e Describe IPv6 tunneling techniques + +4.1.e (i) 6in4, 6to4 + +4.1.e (ii) ISATAP + +4.1.e (iii) 6RD + +4.1.e (iv) 6PE/6VPE + +4.1.g Describe basic Layer 2 VPN—wireline + +4.1.g (i) L2TPv3 general principles + +4.1.g (ii) ATOM general principles + +4.1.h Describe basic L2VPN—LAN services + +4.1.h (i) MPLS-VPLS general principles + +4.1.h (ii) OTV general principles + +4.2 Encryption + +4.2.a Implement and troubleshoot IPsec with preshared key + +4.2.a (i) IPv4 site to IPv4 site + +Book Book Volume Chapter + + + +2 11 + +2 11 + +2 11 + + +2 11 + +2 11 + + +2 10 + +2 10 + +1 8 + + +2 10 + +2 10 + +2 10 + +2 10 + + +2 8 + +2 8 + +2 8 + +2 8 + + +2 10 + +2 11 + + +2 10 + +2 10 + + + +2 10 +xxxvi CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Topics + +4.2.a (ii) IPv6 in IPv4 tunnels + +4.2.a (iii) Virtual tunneling Interface (VTI) + +4.2.b Describe GET VPN + +5.0 Infrastructure Security + +5.1 Device security + +5.1.a Implement and troubleshoot IOS AAA using local database + +5.1.b Implement and troubleshoot device access control + +5.1.b (i) Lines (VTY, AUX, console) + +5.1.b (ii) SNMP + +5.1.b (iii) Management plane protection + +5.1.b (iv) Password encryption + +5.1.c Implement and troubleshoot control plane policing + +5.1.d Describe device security using IOS AAA with TACACS+ and RADIUS +5.1.d (i) AAA with TACACS+ and RADIUS + +5.1.d (ii) Local privilege authorization fallback + +5.2 Network security + +5.2.a Implement and troubleshoot switch security features + +5.2.a (i) VACL, PACL + +5.2.a (ii) Stormcontrol + +5.2.a (iii) DHCP snooping + +5.2.a (iv) IP source-guard + +5.2.a (v) Dynamic ARP inspection + +5.2.a (vi) port-security + +5.2.a (vii) Private VLAN + +5.2.b Implement and troubleshoot router security features + +5.2.b (i) IPv4 access control lists (standard, extended, time-based) + +5.2.b (ii) IPv6 traffic filter + +5.2.b (iii) Unicast reverse path forwarding + +5.2.c Implement and troubleshoot IPv6 first-hop security + +5.2.c (i) RA guard + +Book Book Volume Chapter +2 10 + +2 10 + +2 10 + + + +2 9 + + +1 5 + +1 5 + +2 9 + +1 5 + +2 9 + + + +2 9 + +2 9 + + + +2 9 + +2 9 + +2 9 + +2 9 + +2 9 + +2 9 + +1 2 + + +2 9 + +2 9 + +2 9 + + +2 9 +xxxvii + + + +Topics + +5.2.c (ii) DHCP guard + +5.2.c (iii) Binding table + +5.2.c (iv) Device tracking + +5.2.c (v) ND inspection/snooping + +5.2.c (vii) Source guard + +5.2.c (viii) PACL + +5.2.d Describe 802.1x + +5.2.d (i) 802.1x, EAP, RADIUS + +5.2.d (ii) MAC authentication bypass + +6.0 Infrastructure Services + +6.1 System management + +6.1.a Implement and troubleshoot device management + +6.1.a (i) Console and VTY + +6.1.a (ii) Telnet, HTTP, HTTPS, SSH, SCP + +6.1.a (iii) (T)FTP + +6.1.b Implement and troubleshoot SNMP + +6.1.b (i) v2c, v3 + +6.1.c Implement and troubleshoot logging + +6.1.c (i) Local logging, syslog, debug, conditional debug + +6.1.c (ii) Timestamp + +6.2 Quality of service + +6.2.a Implement and troubleshoot end-to-end QoS + +6.2.a (i) CoS and DSCP mapping + +6.2.b Implement, optimize, and troubleshoot QoS using MQC + +6.2.b (i) Classification + +6.2.b (ii) Network-based application recognition (NBAR) + +6.2.b (iii) Marking using IP precedence, DSCP, CoS, ECN + +6.2.b (iv) Policing, shaping + +6.2.b (v) Congestion management (queuing) + +6.2.b (vi) HQoS, subrate Ethernet link + +6.2.b (vii) Congestion avoidance (WRED) + +Book Book Volume Chapter +2 9 + +2 9 + +2 9 + +2 9 + +2 9 + +2 9 + + +2 9 + +2 9 + + + + + +1 5 + +1 5 + +1 5 + + +1 5 + + +1 5 + +2 6 + + + +2 3 + + +2 3 + +2 3 + +2 3 + +2 5 + +2 4 + +2 3, 4, 5 + +2 4 +xxxviii CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Topics + +6.2.c Describe Layer 2 QoS + +6.2.c (i) Queuing, scheduling + +6.2.c (ii) Classification, marking + +6.3 Network services + +6.3.a Implement and troubleshoot first-hop redundancy protocols + +6.3.a (i) HSRP, GLBP, VRRP + +6.3.a (ii) Redundancy using IPv6 RS/RA + +6.3.b Implement and troubleshoot Network Time Protocol + +6.3.b (i) NTP master, client, version 3, version 4 + +6.3.b (ii) NTP Authentication + +6.3.c Implement and troubleshoot IPv4 and IPv6 DHCP + +6.3.c (i) DHCP client, IOS DHCP server, DHCP relay + +6.3.c (ii) DHCP options + +6.3.c (iii) DHCP protocol operations + +6.3.c (iv) SLAAC/DHCPv6 interaction + +6.3.c (v) Stateful, stateless DHCPv6 + +6.3.c (vi) DHCPv6 prefix delegation + +6.3.d Implement and troubleshoot IPv4 Network Address Translation + +6.3.d (i) Static NAT, dynamic NAT, policy-based NAT, PAT + +6.3.d (ii) NAT ALG + +6.3.e Describe IPv6 Network Address Translation + +6.3.e (i) NAT64 + +6.3.e (ii) NPTv6 + +6.4 Network optimization + +6.4.a Implement and troubleshoot IP SLA + +6.4.a (i) ICMP, UDP, jitter, VoIP + +6.4.b Implement and troubleshoot tracking object + +6.4.b (i) Tracking object, tracking list + +6.4.b (ii) Tracking different entities (for example, interfaces, routes, IPSLA, and so on) +6.4.c Implement and troubleshoot NetFlow + +Book Book Volume Chapter + + +2 4 + +2 2 + + + +1 5 + +1 5 + + +1 5 + +1 5 + + +1 5 + +1 5 + +1 5 + +1 4 + +1 4 + +1 4 + + +1 5 + +2 10 + + +2 10 + +2 10 + + + +1 5 + + +1 5 + +1 5 +xxxix + + + +Topics + +6.4.c (i) NetFlow v5, v9 + +6.4.c (ii) Local retrieval + +6.4.c (iii) Export (configuration only) + +6.4.d Implement and troubleshoot embedded event manager + +6.4.d (i) EEM policy using applet + +6.4.e Identify performance routing (PfR) + +6.4.e (i) Basic load balancing + +6.4.e (ii) Voice optimization + +Book Book Volume Chapter +1 5 + +1 5 + +1 5 + + +1 5 + + +1 11 + +1 11 + + + +To give you practice on these topics, and pull the topics together, Edition 5 of the CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 includes a large set of CD questions that mirror the types of questions expected for the Version 5.0 blueprint. By their very nature, these topics require the application of the knowledge listed throughout the book. This special section of questions provides a means to learn and practice these skills with a proportionally larger set of questions added specifically for this purpose. + +These questions will be available to you in the practice test engine database, whether you take full exams or choose questions by category. + +About the CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1, Fifth Edition + +This section provides a brief insight into the contents of the book, the major goals, and some of the book features that you will encounter when using this book. + +Book Organization + +This volume contains four major parts. Beyond the chapters in these parts of the book, you will find several useful appendixes gathered in Part V. + +Following is a description of each part’s coverage: + +■ Part I, “LAN Switching” (Chapters 1–3) + +This part focuses on LAN Layer 2 features, specifically Ethernet (Chapter 1), VLANs and trunking (Chapter 2), and Spanning Tree Protocol (Chapter 3). + +■ Part II, “IP Networking” (Chapters 4 –5) + +This part covers details across the spectrum of the TCP/IP protocol stack. It includes Layer 3 basics (Chapter 4) and IP services such as DHCP and ARP (Chapter 5). +xl CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ Part III, “IP IGP Routing” (Chapters 6–11) + +This part covers some of the more important topics on the exam and is easily the largest part of this volume. It covers Layer 3 forwarding concepts (Chapter 6), fol-lowed by three routing protocol chapters, one each about RIPv2, EIGRP, OSPF, and IS-IS (Chapters 7 through 10, respectively), and concludes with a discussion of IGP redistribution and routing information optimization (Chapter 11). + +■ Part IV, “Final Preparation” + +Chapter 12, “Final Preparation,” contains instructions about using the testing soft-ware on the CD to verify your knowledge, presents suggestions on approaching your studies, and includes hints about further expanding your knowledge by participating in the Cisco Learning Network. + +■ Part V, “Appendixes” + +■ Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes”—This appen-dix lists answers and explanations for the questions at the beginning of each chapter. +■ Appendix B, “Exam Updates”—As of the first printing of the book, this appen-dix contains only a few words that reference the web page for this book, at www.ciscopress.com/title/9781587143960. As the blueprint evolves over time, the authors will post new materials at the website. Any future printings of the book will include the latest newly added materials in printed form in Appendix B. If Cisco releases a major exam update, changes to the book will be available only in a new edition of the book and not on this site. + + +Note Appendixes C, D, E, F, and G and the Glossary are in printable, PDF format on the CD. + + +■ Appendix C, “Decimal to Binary Conversion Table” (CD-only)—This appendix lists the decimal values 0 through 255, with their binary equivalents. +■ Appendix D, “IP Addressing Practice” (CD-only)—This appendix lists several practice problems for IP subnetting and finding summary routes. The explana-tions to the answers use the shortcuts described in the book. +■ Appendix E, “Key Tables for CCIE Study” (CD-only)—This appendix lists the most important tables from the core chapters of the book. The tables have much of the content removed so that you can use them as an exercise. You can print the PDF file and then fill in the table from memory, checking your answers against the completed tables in Appendix F. +■ Appendix G, “Study Planner” (CD-only)—This appendix is a spreadsheet with major study milestones, where you can track your progress through your study. +■ Glossary (CD-only)—The Glossary contains the key terms listed in the book. +xli + +Book Features + +The core chapters of this book have several features that help you make the best use of your time: + +■ “Do I Know This Already?” Quizzes: Each chapter begins with a quiz that helps you to determine the amount of time you need to spend studying that chapter. If you score yourself strictly, and you miss only one question, you might want to skip the core of the chapter and move on to the “Foundation Summary” section at the end of the chapter, which lets you review facts and spend time on other topics. If you miss more than one, you might want to spend some time reading the chapter or at least reading sections that cover topics about which you know you are weaker. + +■ Foundation Topics: These are the core sections of each chapter. They explain the protocols, concepts, and configuration for the topics in that chapter. + +■ Foundation Summary: The “Foundation Summary” section of this book departs from the typical features of the “Foundation Summary” section of other Cisco Press Exam Certification Guides. This section does not repeat any details from the “Foundation Topics” section; instead, it simply summarizes and lists facts related to the chapter but for which a longer or more detailed explanation is not warranted. + +■ Key topics: Throughout the “Foundation Topics” section, a Key Topic icon has been placed beside the most important areas for review. After reading a chapter, when doing your final preparation for the exam, take the time to flip through the chapters, looking for the Key Topic icons, and review those paragraphs, tables, figures, and lists. + +■ Fill In Key Tables from Memory: The more important tables from the chapters have been copied to PDF files available on the CD as Appendix E. The tables have most of the information removed. After printing these mostly empty tables, you can use them to improve your memory of the facts in the table by trying to fill them out. This tool should be useful for memorizing key facts. That same CD-only appendix contains the completed tables so that you can check your work. + +■ CD-based practice exam: The companion CD contains multiple-choice questions and a testing engine. The CD includes 200 questions unique to the CD. As part of your final preparation, you should practice with these questions to help you get used to the exam-taking process, as well as to help refine and prove your knowledge of the exam topics. + +■ Key terms and Glossary: The more important terms mentioned in each chapter are listed at the end of each chapter under the heading “Definitions.” The Glossary, found on the CD that comes with this book, lists all the terms from the chapters. When studying each chapter, you should review the key terms, and for those terms about which you are unsure of the definition, you can review the short definitions from the Glossary. + +■ Further Reading: Most chapters include a suggested set of books and websites for additional study on the same topics covered in that chapter. Often, these references will be useful tools for preparation for the CCIE Routing and Switching lab exam. + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Ethernet + +■ Speed + +■ Duplex + +■ Fast Ethernet + +■ Gigabit Ethernet + +■ SPAN, RSPAN, and ERSPAN + +■ Virtual Switch System (VSS) + +■ IOS-XE +CHAPTER 1 + + + + + + +Ethernet Basics + + +Ethernet has been the mainstay LAN protocol for years, and that is not anticipated to change anytime soon. More often than not, most people studying network and net-work fundamentals are very familiar with the protocol operations, its limitations, and its +strengths. This level of familiarity often makes us complacent when it comes to determin-ing a solid starting point for teaching technology. But when we consider how many tech-nologies owe their capacity and capabilities to Ethernet, it becomes clear that this is the best place to start any discussion about networking. Ethernet is so established and use-ful that its role is expanding constantly. In fact, today it has even found its way into the WAN. Ethernet WAN technologies like Metro-Ethernet have changed the way we build geographically dispersed infrastructure and have paved the way for greater throughput in what was traditionally a slow and restrictive mode of transport. + +So with the understanding that the majority of readers are probably very familiar with Ethernet based on working with it on a day-to-day basis, we still need to ensure that we pay proper due diligence to the technology simply because it is so fundamental to the creation of both the most basic and the most complex network environments, and even though we are for the most part very knowledgeable about its operation, we might have forgotten some of the nuisances of its operation. So in this chapter, the intention is to outline those operations as clearly and succinctly as possible. + +For exam preparation, it is typically useful to use all the refresher tools: Take the “Do I Know This Already?” quiz, complete the definitions of the terms listed at the end of the chapter, print and complete the tables in Appendix E, “Key Tables for CCIE Study,” and certainly answer all the CD-ROM questions concerning Ethernet. + +“Do I Know This Already?” Quiz + +Table 1-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. +4 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 1-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section + +Ethernet Layer 1: Wiring, Speed, and Duplex + +Ethernet Layer 2: Framing and Addressing + +Switching and Bridging Logic + +SPAN, RSPAN, and ERSPAN + +Virtual Switch System + +IOS Modernization + +Total Score + +Questions Covered in This Score Section +1–4 + +5–6 + +7 + +8–9 + +10–11 + +12 + + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. Which of the following denotes the correct usage of pins on the RJ-45 connectors at the opposite ends of an Ethernet crossover cable? + +a. 1 to 1 + +b. 1 to 2 + +c. 1 to 3 + +d. 6 to 1 + +e. 6 to 2 + +f. 6 to 3 + +2. Which of the following denotes the correct usage of pins on the RJ-45 connectors at the opposite ends of an Ethernet straight-through cable? + +a. 1 to 1 + +b. 1 to 2 + +c. 1 to 3 + +d. 6 to 1 + +e. 6 to 2 + +f. 6 to 3 +Chapter 1: Ethernet Basics 5 + +3. Which of the following commands must be configured on a Cisco IOS switch inter-face to disable Ethernet autonegotiation? +a. no auto-negotiate + +b. no auto + +c. Both speed and duplex + +d. duplex + +e. speed + +4. Consider an Ethernet crossover cable between two 10/100 ports on Cisco switches. One switch has been configured for 100-Mbps full duplex. Which of the following is true about the other switch? +a. It will use a speed of 10 Mbps. + +b. It will use a speed of 100 Mbps. + +c. It will use a duplex setting of half duplex. + +d. It will use a duplex setting of full duplex. + +5. Which of the following Ethernet header type fields is a 2-byte field? + +a. DSAP + +b. Type (in SNAP header) + +c. Type (in Ethernet V2 header) + +d. LLC Control + +6. Which of the following standards defines a Fast Ethernet standard? + +a. IEEE 802.1Q + +b. IEEE 802.3U + +c. IEEE 802.1X + +d. IEEE 802.3Z + +e. IEEE 802.3AB + +f. IEEE 802.1AD + +7. Suppose a brand-new Cisco IOS–based switch has just been taken out of the box and cabled to several devices. One of the devices sends a frame. For which of the following destinations would a switch flood the frames out all ports (except the port upon which the frame was received)? +a. Broadcasts + +b. Unknown unicasts + +c. Known unicasts + +d. Multicasts +6 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +8. Which of the following configuration issues will keep a SPAN session from becom-ing active? + +a. Misconfigured destination port + +b. Destination port configured as a trunk + +c. Destination port shutdown + +d. Source port configured as a trunk + +9. Which of the following are rules for SPAN configuration? + +a. SPAN source and destination ports must be configured for the same speed and duplex. + +b. If the SPAN source port is configured for 100 Mbps, the destination port must be configured for 100 Mbps or more. + +c. In a SPAN session, sources must consist of either physical interfaces or VLANs, but not a mix of these. + +d. Remote SPAN VLANs must be in the range of VLAN 1–66. + +e. Only three SPAN sessions can be configured on one switch. + +10. What tool is available to reduce the complexity of a modern network infrastructure that has direct impact on both Layer 2 and Layer 3 design? + +a. Spanning Tree Protocol + +b. Bridge Assurance + +c. Virtual Switch Design + +d. Virtual Switching System + +e. IOS-XR + +11. In a Virtual Switch System configuration, what operational component is used to transport Control, Management, and Data Plane traffic between peers? + +a. VPC-Link + +b. Sham-Link + +c. Virtual Switch Link + +d. Port-Channel + +e. Ether-Channel +Chapter 1: Ethernet Basics 7 + +12. Cisco IOS was expanded so that it could support modern enterprise deployments by moving away from a monolithic architecture to a more modular design model. What is this current version of IOS? +a. CUOS + +b. IOS-NG + +c. LINUX + +d. IOS-XE + +e. IOS-version 2.0 +8 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Foundation Topics + + +Ethernet Layer 1: Wiring, Speed, and Duplex + +Before you make an Ethernet LAN functional, end-user devices, routers, and switches must be cabled correctly. To run with fewer transmission errors at higher speeds, and to support longer cable distances, variations of copper and optical cabling can be used. The different Ethernet specifications, cable types, and cable lengths per the various specifica-tions are important for the exam, and are listed in the “Foundation Summary” section, later in this chapter. + +RJ-45 Pinouts and Category 5 Wiring + +You should know the details of crossover and straight-through Category 5 (Cat 5), Cat 5e, or Cat 6 cabling for almost any networking job. The EIA/TIA defines the cabling specifications for Ethernet LANs (www.eia.org and http://www.tiaonline.org), including the pinouts for the RJ-45 connects, as shown in Figure 1-1. + + +Key Topic + + + + + + + + + +Figure 1-1 RJ-45 Pinouts with Four-Pair UTP Cabling + +The most popular Ethernet standards (10BASE-T and 100BASE-TX) each use two twisted pairs (specifically pairs 2 and 3 shown in Figure 1-1), with one pair used for transmission in each direction. Depending on which pair a device uses to transmit and receive, either a straight-through or crossover cable is required. Table 1-2 summarizes how the cabling and pinouts work. + +Table 1-2 Ethernet Cabling Types Key +Topic Type of Cable Pinouts Key Pins Connected + + +Straight-through + +Crossover + +T568A (both ends) or T568B (both ends) + +T568A on one end, and T568B on the other + +1–1; 2–2; 3–3; 6–6 + +1–3; 2–6; 3–1; 6–2 +Chapter 1: Ethernet Basics 9 + +Many Ethernet standards use two twisted pairs, with one pair being used for transmis-sion in each direction. For example, a PC network interface card (NIC) transmits on pair 1,2 and receives on pair 3,6; switch ports do the opposite. So, a straight-through cable works well, connecting pair 1,2 on the PC (PC transmit pair) to the switch port’s pair 1,2, on which the switch receives. When the two devices on the ends of the cable both +transmit using the same pins, a crossover cable is required. For example, if two connected switches send using the pair at pins 3,6 and receive on pins 1,2, the cable needs to con-nect the pair at 3,6 on one end to pins 1,2 at the other end, and vice versa. + + +Note Crossover cables can also be used between a pair of PCs, swapping the transmit pair on one end (1,2) with the receive pins at the other end (3,6). + + +Cisco also supports a switch feature that lets the switch figure out whether the wrong cable is installed: Auto-MDIX (automatic medium-dependent interface crossover) detects the wrong cable and causes the switch to swap the pair it uses for transmitting and receiving, which solves the cabling problem. (As of publication, this feature is not sup-ported on all Cisco switch models.) + +Autonegotiation, Speed, and Duplex + +By default, each Cisco switch port uses Ethernet autonegotiation to determine the speed and duplex setting (half or full). The switches can also set their duplex setting with the duplex interface subcommand, and their speed with—you guessed it—the speed interface subcommand. + +Switches can dynamically detect the speed setting on a particular Ethernet segment by using a few different methods. Cisco switches (and many other devices) can sense the speed using the Fast Link Pulses (FLP) of the autonegotiation process. However, if auto-negotiation is disabled on either end of the cable, the switch detects the speed anyway based on the incoming electrical signal. You can force a speed mismatch by statically configuring different speeds on both ends of the cable, causing the link to no longer function. + +Switches detect duplex settings through autonegotiation only. If both ends have auto-negotiation enabled, the duplex is negotiated. However, if either device on the cable disables autonegotiation, the devices without a configured duplex setting must assume a default. Cisco switches use a default duplex setting of half duplex (HDX) (for 10-Mbps and 100-Mbps interfaces) or full duplex (FDX) (for 1000-Mbps interfaces). To disable autonegotiation on a Cisco switch port, you simply need to statically configure the speed and the duplex settings. + +Ethernet devices can use FDX only when collisions cannot occur on the attached cable; a collision-free link can be guaranteed only when a shared hub is not in use. The next few topics review how Ethernet deals with collisions when they do occur, as well as what is different with Ethernet logic in cases where collisions cannot occur and FDX is allowed. +10 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +CSMA/CD + +The original Ethernet specifications expected collisions to occur on the LAN. The media were shared, creating a literal electrical bus. Any electrical signal induced onto the wire could collide with a signal induced by another device. When two or more Ethernet frames overlap on the transmission medium at the same instant in time, a collision occurs; the collision results in bit errors and lost frames. + +The original Ethernet specifications defined the Carrier Sense Multiple Access with Collision Detection (CSMA/CD) algorithm to deal with the inevitable collisions. CSMA/CD minimizes the number of collisions, but when they occur, CSMA/CD defines how the sending stations can recognize the collisions and retransmit the frame. The fol-lowing list outlines the steps in the CSMA/CD process: + +1. Key +Topic +2. + +3. + +4. + + +5. + + + +6. + + +A device with a frame to send listens until the Ethernet is not busy (in other words, the device cannot sense a carrier signal on the Ethernet segment). + +When the Ethernet is not busy, the sender begins sending the frame. + +The sender listens to make sure that no collision occurred. + +If there was a collision, all stations that sent a frame send a jamming signal to ensure that all stations recognize the collision. + +After the jamming is complete, each sender of one of the original collided frames randomizes a timer and waits that long before resending. (Other stations that did not create the collision do not have to wait to send.) + +After all timers expire, the original senders can begin again with Step 1. + + + +Collision Domains and Switch Buffering + +A collision domain is a set of devices that can send frames that collide with frames sent by another device in that same set of devices. Before the advent of LAN switches, Ethernets were either physically shared (10BASE2 and 10BASE5) or shared by virtue of +shared hubs and their Layer 1 “repeat out all other ports” logic. Ethernet switches greatly reduce the number of possible collisions, both through frame buffering and through their more complete Layer 2 logic. + +By definition of the term, Ethernet hubs + +Key ■ Operate solely at Ethernet Layer 1 +Topic ■ Repeat (regenerate) electrical signals to improve cabling distances + +■ Forward signals received on a port out all other ports (no buffering) + +As a result of a hub’s logic, a hub creates a single collision domain. Switches, however, create a different collision domain per switch port, as shown in Figure 1-2. +Chapter 1: Ethernet Basics 11 + + + +Key Topic + +1 Collision Domain 10BASE-T, using Shared hub + +Multiple Collision Domain 10BASE-T, using Switch + + +Archie Archie + + + + +Larry Hub1 Larry SW1 + +Bob Solid Lines Represent Bob Twisted Pair Cabling + +Figure 1-2 Collision Domains with Hubs and Switches + +Switches have the same cabling and signal regeneration benefits as hubs, but switches do a lot more—including sometimes reducing or even eliminating collisions by buffering frames. When switches receive multiple frames on different switch ports, they store the frames in memory buffers to prevent collisions. + +For example, imagine that a switch receives three frames at the same time, entering three different ports, and they all must exit the same switch port. The switch simply stores two of the frames in memory, forwarding the frames sequentially. As a result, in Figure 1-2, the switch prevents any frame sent by Larry from colliding with a frame sent by Archie or Bob—which by definition puts each of the PCs attached to the switch in Figure 1-2 in different collision domains. + +When a switch port connects through cable to a single other nonhub device—for exam-ple, like the three PCs in Figure 1-2—no collisions can possibly occur. The only devices that could create a collision are the switch port and the one connected device—and they each have a separate twisted pair on which to transmit. Because collisions cannot occur, such segments can use full-duplex logic. + + +Note NICs operating in HDX mode use loopback circuitry when transmitting a frame. This circuitry loops the transmitted frame back to the receive side of the NIC so that when the NIC receives a frame over the cable, the combined looped-back signal and received sig-nal allows the NIC to notice that a collision has occurred. + + + +Basic Switch Port Configuration + +The three key configuration elements on a Cisco switch port are autonegotiation, speed, and duplex. Cisco switches use autonegotiation by default; it is then disabled if both the speed and duplex are manually configured. You can set the speed using the speed {auto | 10 | 100 | 1000} interface subcommand, assuming that the interface supports multiple +12 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +speeds. You configure the duplex setting using the duplex { auto | half | full} interface sub-command. + +Example 1-1 shows the manual configuration of the speed and duplex on the link between Switch1 and Switch4 from Figure 1-3, and the results of having mismatched duplex settings. (The book refers to specific switch commands used on IOS-based switches, referred to as “Catalyst IOS” by the Cisco CCIE blueprint.) + + +0200.3333.3333 R3 + + + + +0200.4444.4444 +R4 + +0/3 +SW1 0/13 +000a.b7dc.b78d + +000f.2343.87cd 0/13 +0/4 +SW4 0/6 + + + +0010.a49b.6111 + +PC1 + + +Figure 1-3 Simple Switched Network with Trunk + +Example 1-1 Manual Setting for Duplex and Speed, with Mismatched Duplex + +switch1# show interface fa 0/13 +FastEthernet0/13 is up, line protocol is up +Hardware is Fast Ethernet, address is 000a.b7dc.b78d (bia 000a.b7dc.b78d) +MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +Full-duplex, 100Mb/s +! remaining lines omitted for brevity +! Below, Switch1's interface connecting to Switch4 is configured for 100 Mbps, +! HDX. Note that IOS rejects the first duplex command; you cannot set duplex until +! the speed is manually configured. +switch1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +switch1(config)# int fa 0/13 +switch1(config-if)# duplex half +Duplex will not be set until speed is set to non-auto value +switch1(config-if)# speed 100 +05:08:41: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/13, changed state þto down +Chapter 1: Ethernet Basics 13 + +05:08:46: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/13, changed state þto up +switch1(config-if)# duplex half +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! NOT SHOWN: Configuration for 100/half on Switch4's int fa 0/13. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! Now with both switches manually configured for speed and duplex, neither will be +! using Ethernet auto-negotiation. As a result, below the duplex setting on Switch1 +! can be changed to FDX with Switch4 remaining configured to use HDX. +switch1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +switch1(config)# int fa 0/13 +switch1(config-if)# duplex full +05:13:03: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/13, changed state to down +05:13:08: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/13, changed state to up +switch1(config-if)# ^Z +switch1# sh int fa 0/13 +FastEthernet0/13 is up, line protocol is up +! Lines omitted for brevity +Full-duplex, 100Mb/s +! remaining lines omitted for brevity +! Below, Switch4 is shown to be HDX. Note +! the collisions counters at the end of the show interface command. +switch4# sh int fa 0/13 +FastEthernet0/13 is up, line protocol is up (connected) +Hardware is Fast Ethernet, address is 000f.2343.87cd (bia 000f.2343.87cd) +MTU 1500 bytes, BW 100000 Kbit, DLY 1000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +Half-duplex, 100Mb/s +! Lines omitted for brevity +5 minute output rate 583000 bits/sec, 117 packets/sec +25654 packets input, 19935915 bytes, 0 no buffer +Received 173 broadcasts (0 multicast) +0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 watchdog, 173 multicast, 0 pause input +0 input packets with dribble condition detected +26151 packets output, 19608901 bytes, 0 underruns +54 output errors, 5 collisions, 0 interface resets +0 babbles, 54 late collision, 59 deferred +0 lost carrier, 0 no carrier, 0 PAUSE output +0 output buffer failures, 0 output buffers swapped out +14 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + +02:40:49: %CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on FastEthernet0/13 +(not full duplex), with Switch1 FastEthernet0/13 (full duplex). +! Above, CDP messages have been exchanged over the link between switches. CDP +! exchanges information about Duplex on the link, and can notice (but not fix) +! the mismatch. + + +The statistics on Switch4 near the end of the example show collisions (detected in the time during which the first 64 bytes were being transmitted) and late collisions (after the first 64 bytes were transmitted). In an Ethernet that follows cabling length restric-tions, collisions should be detected while the first 64 bytes are being transmitted. In this +case, Switch1 is using FDX logic, meaning that it sends frames anytime—including when Switch4 is sending frames. As a result, Switch4 receives frames anytime, and if sending at the time, it believes a collision has occurred. Switch4 has deferred 59 frames, meaning that it chose to wait before sending frames because it was currently receiving a frame. Also, the retransmission of the frames that Switch4 thought were destroyed because of a collision, but might not have been, causes duplicate frames to be received, occasionally causing application connections to fail and routers to lose neighbor relationships. + +Ethernet Layer 2: Framing and Addressing + +In this book, as in many Cisco courses and documents, the word frame refers to the bits and bytes that include the Layer 2 header and trailer, along with the data encapsulated by that header and trailer. The term packet is most often used to describe the Layer 3 header and data, without a Layer 2 header or trailer. Ethernet’s Layer 2 specifications relate to the creation, forwarding, reception, and interpretation of Ethernet frames. + +The original Ethernet specifications were owned by the combination of Digital Equipment Corp., Intel, and Xerox—hence the name “Ethernet (DIX).” Later, in the early 1980s, the IEEE standardized Ethernet, defining parts (Layer 1 and some of Layer 2) in the 802.3 Media Access Control (MAC) standard, and other parts of Layer 2 in the 802.2 Logical Link Control (LLC) standard. Later, the IEEE realized that the 1-byte +Destination Service Access Point (DSAP) field in the 802.2 LLC header was too small. As a result, the IEEE introduced a new frame format with a Sub-Network Access Protocol (SNAP) header after the 802.2 header, as shown in the third style of header in Figure +1-4. Finally, in 1997, the IEEE added the original DIX V2 framing to the 802.3 standard as well, as shown in the top frame in Figure 1-4. + +Table 1-3 lists the header fields, along with a brief explanation. The more important fields are explained in more detail after the table. +Chapter 1: Ethernet Basics 15 +Source +Dest. + +Ethernet (DIX) and Revised (1997) IEEE 802.3 +Key 8 6 6 2 Variable 4 +Topic + +Preamble Address Address + +Type/ Length + + +Data FCS + + + +Original IEEE Ethernet (802.3) +7 1 6 6 2 1 1 1-2 Variable 4 + +D +Preamble SFD address address Length A +Source +Dest. +S +P + +S S A P + + +Control Data FCS + + +802.3 802.2 802.3 + +IEEE 802.3 with SNAP Header +7 1 6 6 2 1 1 1-2 3 2 Variable 4 + +D +Preamble SFD address address Length A +Source +Dest. +S +P + +S S A P + + +Control OUI TYPE Data FCS + + +802.3 802.2 SNAP 802.3 + +Figure 1-4 Ethernet Framing Options + + +Table 1-3 Key +Topic Field + + +Ethernet Header Fields + +Description + + + +Preamble (DIX) + + +Preamble and Start of Frame Delimiter (802.3) + +Type (or Protocol Type) (DIX) + +Length (802.3) + + +Destination Service Access Point (802.2) + +Source Service Access Point (802.2) +Control (802.2) + +Provides synchronization and signal transitions to allow proper clocking of the transmitted signal. Consists of 62 alternating 1s and 0s, and ends with a pair of 1s. +Same purpose and binary value as DIX preamble; 802.3 simply renames the 8-byte DIX preamble as a 7-byte preamble and a 1-byte Start of Frame Delimiter (SFD). +2-byte field that identifies the type of protocol or protocol header that follows the header. Allows the receiver of the frame to know how to process a received frame. +Describes the length, in bytes, of the data following the Length field, up to the Ethernet trailer. Allows an Ethernet receiver to predict the end of the received frame. +DSAP; 1-byte protocol type field. The size limitations, along with other uses of the low-order bits, required the later addition of SNAP headers. +SSAP; 1-byte protocol type field that describes the upper-layer protocol that created the frame. +1- or 2-byte field that provides mechanisms for both connectionless and connection-oriented operation. Generally used only for connectionless operation by modern protocols, with a 1-byte value of 0x03. +16 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Field +Organizationally Unique Identifier (SNAP) + +Type (SNAP) + +Description +OUI; 3-byte field, generally unused today, providing a place for the sender of the frame to code the OUI representing the manufacturer of the Ethernet NIC. +2-byte Type field, using same values as the DIX Type field, overcoming deficiencies with size and use of the DSAP field. + + + + +Types of Ethernet Addresses + +Ethernet addresses, also frequently called MAC addresses, are 6 bytes in length, typically listed in hexadecimal form. There are three main types of Ethernet address, as listed in Table 1-4. + +Table 1-4 Three Types of Ethernet/MAC Address + +Key Topic + + +Type of Ethernet/ MAC Address +Unicast + +Broadcast + +Multicast + + +Description and Notes + +Fancy term for an address that represents a single LAN interface. The I/G bit, the least significant bit in the most significant byte, is set to 0. +An address that means “all devices that reside on this LAN right now.” Always a value of hex FFFFFFFFFFFF. +A MAC address that implies some subset of all devices currently on the LAN. By definition, the I/G bit is set to 1. + + + +Most engineers instinctively know how unicast and broadcast addresses are used in a typical network. When an Ethernet NIC needs to send a frame, it puts its own unicast address in the Source Address field of the header. If it wants to send the frame to a particular device on the LAN, the sender puts the other device’s MAC address in the Ethernet header’s Destination Address field. If the sender wants to send the frame to every device on the LAN, it sends the frame to the FFFF.FFFF.FFFF broadcast destina-tion address. (A frame sent to the broadcast address is named a broadcast or broadcast frame, and frames sent to unicast MAC addresses are called unicasts or unicast frames.) + +Multicast Ethernet frames are used to communicate with a possibly dynamic subset of the devices on a LAN. The most common use for Ethernet multicast addresses involves the use of IP multicast. For example, if only 3 of 100 users on a LAN want to +watch the same video stream using an IP multicast–based video application, the applica-tion can send a single multicast frame. The three interested devices prepare by listening for frames sent to a particular multicast Ethernet address, processing frames destined for that address. Other devices might receive the frame, but they ignore its contents. Because the concept of Ethernet multicast is most often used today with IP multicast, most of the rest of the details of Ethernet multicast are covered in Volume 2, Chapter 7, “Introduction to IP Multicasting.” +Chapter 1: Ethernet Basics 17 + +Ethernet Address Formats + +The IEEE intends for unicast addresses to be unique in the universe by administer-ing the assignment of MAC addresses. The IEEE assigns each vendor a code to use as the first 3 bytes of its MAC addresses; that first half of the addresses is called the +Organizationally Unique Identifier (OUI). The IEEE expects each manufacturer to use its OUI for the first 3 bytes of the MAC assigned to any Ethernet product created by that vendor. The vendor then assigns a unique value in the low-order 3 bytes for each Ethernet card that it manufactures—thereby ensuring global uniqueness of MAC addresses. Figure 1-5 shows the basic Ethernet address format, along with some additional details. + + +Most +Key Significant Byte Topic + +Least Significant Byte + + +1st Byte 2nd Byte 3rd Byte 4th Byte 5th Byte 6th Byte + + +OUI Vendor-Assigned + + +U/L I/G Bit Bit + + +1st Byte + + + +Most Significant Bit + +Least Significant Bit + + +Figure 1-5 Ethernet Address Format + +Note that Figure 1-5 shows the location of the most significant byte and least significant bit in each byte. IEEE documentation lists Ethernet addresses with the most significant byte on the left. However, inside each byte, the leftmost bit is the most significant bit, and the rightmost bit is the least significant bit. Many documents refer to the bit order as canonical. Regardless of the term, the bit order inside each byte is important for under-standing the meaning of the two most significant bits in an Ethernet address: + +■ The Individual/Group (I/G) bit + +■ The Universal/Local (U/L) bit + +Table 1-5 summarizes the meaning of each bit. +18 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 1-5 I/G and U/L Bits Key +Topic Field Meaning + +I/G Binary 0 means that the address is a unicast; Binary 1 means that the address is a multicast or broadcast. +U/L Binary 0 means that the address is vendor assigned; Binary 1 means that the address has been administratively assigned, overriding the vendor-assigned address. + + +The I/G bit signifies whether the address represents an individual device or a group of devices, and the U/L bit identifies locally configured addresses. For example, the Ethernet multicast addresses used by IP multicast implementations always start with +0x01005E. Hex 01 (the first byte of the address) converts to binary 00000001, with the least significant bit being 1, confirming the use of the I/G bit. + + +Note Often, when overriding the MAC address to use a local address, the device or device driver does not enforce the setting of the U/L bit to a value of 1. + + + +Protocol Types and the 802.3 Length Field + +Each of the three types of Ethernet header shown in Figure 1-4 has a field identifying the format of the Data field in the frame. Generically called a Type field, these fields allow the receiver of an Ethernet frame to know how to interpret the data in the received frame. For example, a router might want to know whether the frame contains an IP packet, an IPX packet, and so on. + +DIX and the revised IEEE framing use the Type field, also called the Protocol Type field. The originally defined IEEE framing uses those same 2 bytes as a Length field. To distin-guish the style of Ethernet header, the Ethernet Type field values begin at 1536, and the length of the Data field in an IEEE frame is limited to decimal 1500 or less. That way, an Ethernet NIC can easily determine whether the frame follows the DIX or original IEEE format. + +The original IEEE frame used a 1-byte Protocol Type field (DSAP) for the 802.2 LLC standard type field. It also reserved the high-order 2 bits for other uses, similar to the I/G and U/L bits in MAC addresses. As a result, there were not enough possible combinations in the DSAP field for the needs of the market—so the IEEE had to define yet another type field, this one inside an additional IEEE SNAP header. Table 1-6 summarizes the meaning of the three main Type field options with Ethernet. +Chapter 1: Ethernet Basics 19 + +Table 1-6 Ethernet Type Fields Key +Topic Type Field Description + + +Protocol Type + +DSAP + +SNAP + +DIX V2 Type field; 2 bytes; registered values now administered by the IEEE +802.2 LLC; 1 byte, with 2 high-order bits reserved for other purposes; registered values now administered by the IEEE +SNAP header; 2 bytes; uses same values as Ethernet Protocol Type; signified by an 802.2 DSAP of 0xAA + + + + +Switching and Bridging Logic + +In this chapter so far, you have been reminded about the cabling details for Ethernet along with the formats and meanings of the fields inside Ethernet frames. A switch’s ulti-mate goal is to deliver those frames to the appropriate destination(s) based on the destina-tion MAC address in the frame header. Table 1-7 summarizes the logic used by switches when forwarding frames, which differs based on the type of destination Ethernet address and on whether the destination address has been added to its MAC address table. + +Table 1-7 LAN Switch Forwarding Behavior + +Key Topic + + +Type of Address +Known unicast + +Unknown unicast + +Broadcast + +Multicast + + +Switch Action +Forwards frame out the single interface associated with the destination address +Floods frame out all interfaces, except the interface on which the frame was received +Floods frame identically to unknown unicasts + +Floods frame identically to unknown unicasts, unless multicast optimizations are configured + + + +For unicast forwarding to work most efficiently, switches need to know about all the unicast MAC addresses and out which interface the switch should forward frames sent to each MAC address. Switches learn MAC addresses, and the port to associate with them, by reading the source MAC address of received frames. You can see the learning process in Example 1-2, along with several other details of switch operation. Figure 1-6 lists the devices in the network associated with Example 1-2, along with their MAC addresses. +20 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +0200.3333.3333 0/3 R3 + + + + + +0200.4444.4444 0/4 +R4 + +VLAN 1: +IP Address 10.1.1.1 +SW1 MAC Address 000a.b7dc.b780 0/13 +000a.b7dc.b78d + + +000f.2343.87cd +0/13 VLAN 1: +IP Address 10.1.1.4 +SW4 MAC Address 000f.2343.87c0 0/6 + + + +0010.a49b.6111 + +PC1 + + +Figure 1-6 Sample Network with MAC Addresses Shown + +Example 1-2 Command Output Showing MAC Address Table Learning (Continued) + +Switch1# show mac-address-table dynamic +Mac Address Table +------------------------------------------ + + +Vlan Mac Address +---- ----------- +1 000f.2343.87cd +1 0200.3333.3333 +1 0200.4444.4444 + +Type Ports +---- ----- +DYNAMIC Fa0/13 +DYNAMIC Fa0/3 +DYNAMIC Fa0/13 + +Total Mac Addresses for this criterion: 3 +! Above, Switch1's MAC address table lists three dynamically learned addresses, +! including Switch4's FA 0/13 MAC. +! Below, Switch1 pings Switch4's management IP address. +Switch1# ping 10.1.1.4 + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.1.1.4, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms +! Below Switch1 now knows the MAC address associated with Switch4's management IP +! address. Each switch has a range of reserved MAC addresses, with the first MAC +! being used by the switch IP address, and the rest being assigned in sequence to +! the switch interfaces – note 0xcd (last byte of 2nd address in the table above) +! is for Switch4's FA 0/13 interface, and is 13 (decimal) larger than Switch4's +! base MAC address. +Chapter 1: Ethernet Basics 21 + +Switch1# show mac-address-table dynamic +Mac Address Table +------------------------------------------ + + +Vlan Mac Address +---- ----------- +1 000f.2343.87c0 +1 000f.2343.87cd +1 0200.3333.3333 +1 0200.4444.4444 + +Type Ports +---- ----- +DYNAMIC Fa0/13 +DYNAMIC Fa0/13 +DYNAMIC Fa0/3 +DYNAMIC Fa0/13 + +Total Mac Addresses for this criterion: 4 +! Not shown: PC1 ping 10.1.1.23 (R3) PC1's MAC in its MAC address table +------------------------------------------ + + +Vlan Mac Address +---- ----------- +1 000f.2343.87c0 +1 000f.2343.87cd +1 0010.a49b.6111 +1 0200.3333.3333 +1 0200.4444.4444 + +Type Ports +---- ----- +DYNAMIC Fa0/13 +DYNAMIC Fa0/13 +DYNAMIC Fa0/13 +DYNAMIC Fa0/3 +DYNAMIC Fa0/13 + +Total Mac Addresses for this criterion: 5 +! Above, Switch1 learned the PC's MAC address, associated with FA 0/13, +! because the frames sent by the PC came into Switch1 over its FA 0/13. +! Below, Switch4's MAC address table shows PC1's MAC off its FA 0/6 +switch4# show mac-address-table dynamic +Mac Address Table +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 000a.b7dc.b780 +1 000a.b7dc.b78d +1 0010.a49b.6111 +1 0200.3333.3333 +1 0200.4444.4444 + +Type Ports +-------- ----- +DYNAMIC Fa0/13 +DYNAMIC Fa0/13 +DYNAMIC Fa0/6 +DYNAMIC Fa0/13 +DYNAMIC Fa0/4 + +Total Mac Addresses for this criterion: 5 +! Below, for example, the aging timeout (default 300 seconds) is shown, followed +! by a command just listing the mac address table entry for a single address. +switch4# show mac-address-table aging-time +Vlan Aging Time +---- ---------- +1 300 +switch4# show mac-address-table address 0200.3333.3333 +Mac Address Table +22 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +------------------------------------------- + + +Vlan Mac Address +---- ----------- +1 0200.3333.3333 + +Type Ports +-------- ----- +DYNAMIC Fa0/13 + +Total Mac Addresses for this criterion: 1 + + +SPAN, RSPAN, and ERSPAN + +Cisco Catalyst switches support a method of directing all traffic from a source port or source VLAN to a single port. This feature, called SPAN (for Switch Port Analyzer) in the Cisco documentation and sometimes referred to as session monitoring because of the commands used to configure it, is useful for many applications. These include monitor-ing traffic for compliance reasons, for data collection purposes, or to support a particu-lar application. For example, all traffic from a voice VLAN can be delivered to a single switch port to facilitate call recording in a VoIP network. Another common use of this feature is to support intrusion detection/prevention system (IDS/IPS) security solutions. + +SPAN sessions can be sourced from a port or ports, or from a VLAN. This provides great flexibility in collecting or monitoring traffic from a particular source device or an entire VLAN. + +The destination port for a SPAN session can be on the local switch, as in SPAN opera-tion. Or it can be a port on another switch in the network. This mode is known as Remote SPAN, or RSPAN. In RSPAN, a specific VLAN must be configured across the entire switching path from the source port or VLAN to the RSPAN destination port. This requires that the RSPAN VLAN be included in any trunks in that path, too. See Figure +1-7 for the topology of SPAN, Figure 1-8 for that of RSPAN, and Figure 1-9 for that of Encapsulated Remote SPAN (ERSPAN). + + + + +Egress Traffic + + + +Sniffer Ingress Switch +Traffic + + +Source Span Ports + +Figure 1-7 SPAN Topology + + +Destination Span Port +Chapter 1: Ethernet Basics 23 + + + +Switch S1 +6/1 + + +ISL TRUNK + +Switch S2 +5/1 5/2 Sniffer + + + + + +A + + +Figure 1-8 RSPAN Topology + + + +Host B + +SPAN Source +Device + + +GRE-Encapsulated Monitored Traffic + +Device + + + + + +Host A +IP/MPLS Cloud + + +SPAN Destination + + +Network Analyzer + +Figure 1-9 ERSPAN Topology + +The information in this section applies specifically to the Cisco 3560 switching platform; the Cisco 3750 and many other platforms use identical or similar rules and configuration commands. + +Core Concepts of SPAN, RSPAN, and ERSPAN + +To understand SPAN, RSPAN, and ERSPAN, it helps to break them down into their fun-damental elements. This also helps you understand how to configure these features. + +In SPAN, you create a SPAN source that consists of at least one port or at least one VLAN on a switch. On the same switch, you configure a destination port. The SPAN source data is then gathered and delivered to the SPAN destination. + +In RSPAN, you create the same source type—at least one port or at least one VLAN. The destination for this session is the RSPAN VLAN, rather than a single port on the switch. At the switch that contains an RSPAN destination port, the RSPAN VLAN data is deliv-ered to the RSPAN port. +24 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + +Key Topic + +In ERSPAN, we are actually encapsulating the Remote SPAN information. Encapsulated Remote SPAN (ERSPAN), as the name implies, creates a generic routing encapsulation (GRE) tunnel for all captured traffic and allows it to be extended across Layer 3 domains. This feature is an operational enhancement brought to us by IOS-XE and can be found +in current platforms like the ASR 1000, but keep in mind that ERSPAN is also supported by the Catalyst 6500, 7600, as well as the Nexus platforms. Viable monitoring sources include Fast Ethernet, Gigabit Ethernet, and Port-Channel interfaces. + +Regardless of the type of SPAN we are running, a SPAN source port can be any type of port—a routed port, a physical switch port, an access port, a trunk port, an EtherChannel port (either one physical port or the entire port-channel interface), and so on. On a SPAN source VLAN, all active ports in that VLAN are monitored. As you add or remove ports from that VLAN, the sources are dynamically updated to include new ports or exclude removed ports. Also, a port configured as a SPAN destination cannot be part of a SPAN +source VLAN. + + + +Restrictions and Conditions + +Destination ports in SPAN, RSPAN, and ERSPAN have multiple restrictions. The key restrictions include the following: + +■ When you configure a destination port, its original configuration is overwritten. If the SPAN configuration is removed, the original configuration on that port is restored. + +■ When you configure a destination port, the port is removed from any EtherChannel bundle if it were part of one. If it were a routed port, the SPAN destination configu-ration overrides the routed port configuration. + +■ Destination ports do not support port security, 802.1x authentication, or private VLANs. In general, SPAN/RSPAN and 802.1x are incompatible. + +■ Destination ports do not support any Layer 2 protocols, including CDP, Spanning Tree, VTP, DTP, and so on. + + + + + + +Key Topic + +A set of similar restrictions for RSPAN destination VLANs also exists. See the references in the “Further Reading” section at the end of this chapter for more information about those restrictions. + +SPAN, RSPAN, and ERSPAN require compliance with a number of specific conditions to +work. For SPAN, the key restrictions include the following: + + +■ The source can be either one or more ports or a VLAN, but not a mix of these. + +■ Up to 64 SPAN destination ports can be configured on a switch. + +■ Switched or routed ports can be configured as SPAN source ports or SPAN destina-tion ports. +Chapter 1: Ethernet Basics 25 + +■ Be careful to avoid overloading the SPAN destination port. A 100-Mbps source port can easily overload a 10-Mbps destination port; it’s even easier to overload a 100-Mbps destination port when the source is a VLAN. + +■ Within a single SPAN session, you cannot deliver traffic to a destination port when it is sourced by a mix of SPAN, RSPAN, or ERSPAN source ports or VLANs. This restriction comes into play when you want to mirror traffic to both a local port on a switch (in SPAN) and a remote port on another switch (in RSPAN or ERSPAN mode). + +■ A SPAN destination port cannot be a source port, and a source port cannot be a des-tination port. + +■ Only one SPAN/RSPAN/ERSPAN session can send traffic to a single destination port. + +■ A SPAN destination port ceases to act as a normal switch port. That is, it passes only SPAN-related traffic. + +■ It’s possible to configure a trunk port as the source of a SPAN or RSPAN session. In this case, all VLANs on the trunk are monitored by default; the filter vlan command option can be configured to limit the VLANs being monitored in this situation. + +■ Traffic that is routed from another VLAN to a source VLAN cannot be monitored with SPAN. An easy way to understand this concept is that only traffic that enters or exits the switch in a source port or VLAN is forwarded in a SPAN session. In other words, if the traffic comes from another source within the switch (by routing from another VLAN, for example), that traffic isn’t forwarded through SPAN. + +SPAN, RSPAN, and ERSPAN support three types of traffic: transmitted, received, and both. By default, SPAN is enabled for traffic both entering and exiting the source port or VLAN. However, SPAN can be configured to monitor just transmitted traffic or just received traffic. Some additional conditions apply to these traffic types, as detailed in this list: + + +■ Key +Topic + + +■ + + + + + + +■ + +For Receive (RX) SPAN, the goal is to deliver all traffic received to the SPAN destina-tion. As a result, each frame to be transported across a SPAN connection is copied and sent before any modification (for example, VACL or ACL filtering, QoS modifi-cation, or even ingress or egress policing). + +For Transmit (TX) SPAN, all relevant filtering or modification by ACLs, VACLs, QoS, or policing actions are taken before the switch forwards the traffic to the SPAN/ RSPAN destination. As a result, not all transmit traffic necessarily makes it to a SPAN destination. Also, the frames that are delivered do not necessarily match the original frames exactly, depending on policies applied before they are forwarded to the SPAN destination. + +A special case applies to certain types of Layer 2 frames. SPAN/RSPAN usually ignores CDP, spanning-tree BPDUs, VTP, DTP, and PAgP frames. However, these traf-fic types can be forwarded along with the normal SPAN traffic if the encapsulation +replicate command is configured. +26 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Basic SPAN Configuration + +The goal for the configuration in Example 1-3 is to mirror traffic sent to or received from interface fa0/12 to interface fa0/24. All traffic sent or received on fa0/12 is sent to fa0/24. This configuration is typical of a basic traffic-monitoring application. + +Example 1-3 Basic SPAN Configuration Example + +MDF-ROC1# configure terminal +MDF-ROC1(config)# monitor session 1 source interface fa0/12 +MDF-ROC1(config)# monitor session 1 destination interface fa0/24 + + +Complex SPAN Configuration + +In Example 1-4, we configure a switch to send the following traffic to interface fa0/24, preserving the encapsulation from the sources: + +■ Received on interface fa0/18 + +■ Sent on interface fa0/9 + +■ Sent and received on interface fa0/19 (which is a trunk) + +We also filter (remove) VLANs 1, 2, 3, and 229 from the traffic coming from the fa0/19 trunk port. + +Example 1-4 Complex SPAN Configuration Example + +MDF-ROC3# config term +MDF-ROC3(config)# monitor session 11 source interface fa0/18 rx +MDF-ROC3(config)# monitor session 11 source interface fa0/9 tx +MDF-ROC3(config)# monitor session 11 source interface fa0/19 +MDF-ROC3(config)# monitor session 11 filter vlan 1 - 3 , 229 +MDF-ROC3(config)# monitor session 11 destination interface fa0/24 encapsulation replicate + + +RSPAN Configuration + +In Example 1-5, we configure two switches, IDF-SYR1 and IDF-SYR2, to send traffic to RSPAN VLAN 199, which is delivered to port fa0/24 on switch MDF-SYR9 as follows: + +■ From IDF-SYR1, all traffic received on VLANs 66–68 + +■ From IDF-SYR2, all traffic received on VLAN 9 + +■ From IDF-SYR2, all traffic sent and received on VLAN 11 + +Note that all three switches use a different session ID, which is permissible in RSPAN. The only limitation on session numbering is that the session number must be 1 to 66. +Chapter 1: Ethernet Basics 27 + +Example 1-5 RSPAN Configuration Example + +IDF-SYR1# config term +IDF-SYR1(config)# vlan 199 +IDF-SYR1(config-vlan)# remote span +IDF-SYR1(config-vlan)# exit +IDF-SYR1(config)# monitor session 3 source vlan 66 – 68 rx +IDF-SYR1(config)# monitor session 3 destination remote vlan 199 +!Now moving to IDF-SYR2: +IDF-SYR2# config term +IDF-SYR2(config)# vlan 199 +IDF-SYR2(config-vlan)# remote span +IDF-SYR2(config-vlan)# exit +IDF-SYR2(config)# monitor session 23 source vlan 9 rx +IDF-SYR2(config)# monitor session 23 source vlan 11 +IDF-SYR2(config)# monitor session 23 destination remote vlan 199 +!Now moving to MDF-SYR9 +MDF-SYR9# config term +MDF-SYR9(config)# vlan 199 +MDF-SYR9(config-vlan)# remote span +MDF-SYR9(config-vlan)# exit +MDF-SYR9(config)# monitor session 63 source remote vlan 199 +MDF-SYR9(config)# monitor session 63 destination interface fa0/24 +MDF-SYR9(config)# end + + +ERSPAN Configuration + +In Example 1-6, we will configure ASR 1002 to capture received traffic and send to it to Catalyst 6509 Gig2/2/1. This traffic will simply be captured, encapsulated in GRE by ASR 1002 natively, and routed over to the Catalyst 6509. A sniffing station on the 6500 attached to GE2/2/1 will see the complete Ethernet frame (L2 to L7) information. + +Example 1-6 ERSPAN Configuration Example + +ASR1002(config)# monitor session 1 type erspan-source +ASR1002(config-mon-erspan-src)# source interface gig0/1/0 rx +ASR1002(config-mon-erspan-src)# no shutdown +ASR1002(config-mon-erspan-src)# destination +ASR1002(config-mon-erspan-src-dst)# erspan-id 101 +ASR1002(config-mon-erspan-src-dst)# ip address 10.1.1.1 +ASR1002(config-mon-erspan-src-dst)# origin ip address 172.16.1.1 +!Now for the configuration of the Catalyst 6500 +SW6509(config)# monitor session 2 type erspan-destination +SW6509(config-mon-erspan-dst)# destination interface gigabitEthernet2/2/1 +SW6509(config-mon-erspan-dst)# no shutdown +SW6509(config-mon-erspan-dst)# source +SW6509(config-mon-erspan-dst-src)# erspan-id 101 +SW6509(config-mon-erspan-dst-src)# ip address 10.1.1.1 +28 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + +You can verify SPAN, RSPAN, or ERSPAN operation using the show monitor session +command, as illustrated in Example 1-7. + + +Example 1-7 ERSPAN Verification Example + +ASR1002# show monitor session 1 + +Session 1 +--------- +Type +Status +Source Ports +RX Only + + + +: ERSPAN Source Session +: Admin Enabled +: +: Gi0/1/0 + +Destination IP Address : 10.1.1.1 +MTU : 1464 +Destination ERSPAN ID : 101 +Origin IP Address : 172.16.1.1 + +From a troubleshooting standpoint, it’s important to note that if the destination port is shut down, the SPAN instance won’t come up. When you bring the port up, the SPAN session will follow. + +Virtual Switch System + +In any modern network, we find it essential to create topologies that support high availability and reliability of devices, connections, and services. The typical approach employed by network operators is to configure these features and capabilities by creating redundant Layer 2 switch fabric such that it will support multipathing through the use of redundant pairs or links. Figure 1-10 shows a typical switch network configuration. + +Observe that the application and configuration of these redundant network elements and links we are describing can very quickly increase the complexity of our network design and operation. One method of overcoming this complication is to employ virtual switch-ing. This technology actually simplifies the network by reducing the number of network elements, and this eliminates or masks the complexity of managing redundant switches and links. This feature exists in Cisco Catalyst 6500 and 4500 Series switches running IOS-XE (discussed in further detail in the section, “IOS-XE,” later in this chapter). + +For the purposes of our discussions, we will look at a Virtual Switch System (VSS) that combines a pair of Catalyst 4500 or 4500-X Series switches into a single network ele-ment. The VSS manages the redundant links in such a fashion that they will be seen by external devices as a single Port-channel. + +This approach simplifies network configuration and operation by reducing the total num-ber of Layer 3 routing neighbors and by simultaneously providing a loop-free Layer 2 topology. +Chapter 1: Ethernet Basics 29 + + + + + + + +Core + + + + + +Distribution + + + + +Access + +Figure 1-10 Typical Switch Network Design + +Virtual Switching System + +The fundamental reason for employing a VSS is to logically combine a pair of switches into a single network element, as already described. To better understand this process, we need to look closely at what this feature does for the logical topology. For example, a VSS in the distribution layer of the network interacts with the access and core networks above and below it as if it were a single switch, as illustrated in Figure 1-11. + + +Physical View + +Virtual Distribution Switch + + + + + + + + +Access + +Logical View + +Virtual Distribution Switch + + + + + + + + +Access + + +Figure 1-11 VSS in the Distribution Network + +Notice that a switch in the access layer connects to both switches of the VSS using one logical port channel because the VSS is perceived as being a single switch to external devices—a logical switch if you will. Special adaptations are incorporated into the VSS +30 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +devices such that they can manage redundancy and load balancing on the port channel to ensure managed operation of the link, even though it is physically connected to two devices. The inclination here would be to describe these switches inside the VSS con-figuration as independent devices; however, this is not accurate. Though the switches are physically separate entities, it must be understood that from an operation and control plane level, they are acting as one unit. This adaptation enables a loop-free Layer 2 net-work topology. The VSS also simplifies the Layer 3 network topology by reducing the number of routing peers in the network, thus extending network simplification into the data plane itself. + +VSS Active and VSS Standby Switch + +The adoption that we have been discussing regarding the operation of each device in a VSS extends to specialized “role based” behaviors. Now in the context of the VSS, we will find that each individual switch will first contend for specific operational roles inside the VSS process itself and then behave according to those roles. Each time that we create or restart a VSS, the peer switches will negotiate their roles. The ultimate outcome will be that one device will become the VSS active switch, and the other will become the VSS standby. + +The VSS active switch controls the VSS, running the Layer 2 and Layer 3 control proto-cols for the switching modules on both switches. The VSS active switch also provides management functions for the VSS, such as module online insertion and removal (OIR) and the console interface. + +The VSS active and standby switches perform packet forwarding for ingress data traffic on their locally hosted interfaces. However, the VSS standby switch sends all control traf-fic to the VSS active switch for processing. + +Virtual Switch Link + +As mentioned previously, for the two switches of the VSS to act as one network element, they need to share control information and data traffic, and the manner in which they perform this sharing extends to the roles that they have assumed and many special-purpose mechanisms. Of these special-purpose constructs, none are more important that the virtual switch link that connects the two VSS devices. + +The virtual switch link (VSL) is a special link that carries control and data traffic between the two switches of a VSS, as shown in Figure 1-12. The VSL is typically implemented as an EtherChannel, and as such, can support up to eight links incorporated into the bundle. Not only is this special-purpose link designed to provide an avenue of communication between the VSS peers, but it is also optimized to provide control and management plane traffic higher priority than data traffic in an effort to ensure that control and management messages are never discarded. Data traffic is load balanced among the VSL links by either the default or the configured EtherChannel load-balancing algorithm. +Chapter 1: Ethernet Basics 31 + +Virtual Switch + + + +Chassis 1 + + + + +Figure 1-12 + +Chassis 2 + + +Virtual Switch Link (VSL) + +Virtual Switch Link + + + +Multichassis EtherChannel (MEC) + +Note that we have been speaking significantly about the idea of EtherChannel. EtherChannel (also known as a port channel) is a collection of two or more physical links that combine to form one logical link. Layer 2 protocols operate on the EtherChannel +as a single logical entity. This extends to protocols like Spanning Tree Protocol, which would normally serve to block redundant links between devices in an effort to prevent the formation of switching loops. But the notion that we are describing is a special kind of Port-channel that can exist not between two physical devices, but between multiple chassis. This affords us a hardware or device failover capability that does not exist in normal EtherChannel deployments. This is because VSS enables the creation of +Multichassis EtherChannel (MEC), which is an EtherChannel whose member ports can be distributed across the member switches in a VSS. Because non-VSS switches connected to a VSS view the MEC as a standard EtherChannel, non-VSS switches can connect in +a dual-homed manner. Traffic traversing the MEC can be load balanced locally within a VSS member switch much like that of standard EtherChannels. Cisco MEC supports dynamic EtherChannel protocols, to include the industry-standard Link Aggregation Control Protocol (LACP) and the Cisco-proprietary Port Aggregation Protocol (PAgP), as well as static EtherChannel configuration. In total, a VSS can support a maximum of 256 EtherChannels. This limit applies to the total number of regular EtherChannels and MECs. + +Basic VSS Configuration + +To create the most basic configuration needed to support VSS, first you have to create the same virtual switch domain on both sides of the VSS. This switch domain will be ref-erenced as a number used on both switches of the VSS; this number must fall between 1 and 255. After assigning the domain number, you must configure one switch to be switch number 1 and the other switch to be switch number 2, as illustrated in Example 1-8. +32 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 1-8 Assigning Virtual Switch Domain and Switch Numbers + +SW1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +SW1(config)# switch virtual domain 10 +Domain ID 10 config will take effect only +after the exec command 'switch convert mode virtual' is issued +SW1(config-vs-domain)# switch 1 +SW1(config-vs-domain)# exit +SW1(config)# + +SW2# conf t +Enter configuration commands, one per line. End with CNTL/Z. +SW2(config)# switch virtual domain 10 +Domain ID 10 config will take effect only +after the exec command 'switch convert mode virtual' is issued +SW2(config-vs-domain)# switch 2 +SW2(config-vs-domain)# exit +SW2(config)# + +Next, we will need to create the VSL, which requires a unique port channel on each switch, as shown in Example 1-9. During the configuration, both port channels are set up on the VSS active switch. If the VSS standby switch VSL port channel number has been configured previously for another use, the VSS will come up in route processor redun-dancy mode. To avoid this situation, check that both port channel numbers are available on both of the peer switches. + +Example 1-9 Configuring VSL Port Channel + +SW1(config)# int port-channel 5 +SW1(config-if)# switchport +SW1(config-if)# switch virtual link 1 +SW1(config-if)# no shut +SW1(config-if)# exit +*Jan 24 05:19:57.092: %SPANTREE-6-PORTDEL_ALL_VLANS: Port-channel5 deleted from all Vlans + +SW2(config)# int port-channel 10 +SW2(config-if)# switchport +SW2(config-if)# switch virtual link 2 +SW2(config-if)# no shut +SW2(config-if)# exit +SW2(config)# +*Jan 24 05:14:17.273: %SPANTREE-6-PORTDEL_ALL_VLANS: Port-channel10 deleted from all Vlans +Chapter 1: Ethernet Basics 33 + +Now that we have created the Port-channel interfaces, it is necessary to add VSL physi-cal member ports to the appropriate Port-channel. In Example 1-10, interfaces Gigabit Ethernet 7/3 and 7/4 on Switch 1 are going to be connected to interfaces Gigabit Ethernet 4/45 and 4/46 on Switch 2. + +Example 1-10 Configuring VSL Ports + +SW1(config)# int range gig7/3 - 4 +SW1(config-if-range)# switchport mode trunk +SW1(config-if-range)# channel-group 5 mode on +WARNING: Interface GigabitEthernet7/3 placed in restricted config mode. All extraneous configs removed! +WARNING: Interface GigabitEthernet7/4 placed in restricted config mode. All extraneous configs removed! +SW1(config-if-range)# exit + +SW2(config)# int range gig4/45 - 46 +SW2(config-if-range)# switchport mode trunk +SW2(config-if-range)# channel-group 10 mode on +WARNING: Interface GigabitEthernet4/45 placed in restricted config mode. All extraneous configs removed! +WARNING: Interface GigabitEthernet4/46 placed in restricted config mode. All extraneous configs removed! +SW2(config-if-range)# exit + + +Note After the interfaces are put into a VSL Port-channel with the channel-group com-mand, the interfaces go into “notconnect” status. Interface status will show “up,” but the line protocol will be “down.” The interface will be in up/down (not connect) status until the switch is rebooted. + + +Now we will need to complete the switch conversion process by implementing the switch convert mode virtual command on Switch 1. The system will prompt to confirm the action. Enter yes, as illustrated in Example 1-11. This will allow the system to create a converted configuration file that will be stored in the system bootflash. + +Example 1-11 Converting the Switch to Virtual Switch Mode + +SW1# switch convert mode virtual + +This command will convert all interface names +to naming convention "interface-type switch-number/slot/port", +save the running config to startup-config and + +reload the switch. +Do you want to proceed? [yes/no]: yes +Converting interface names +34 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Building configuration... +Compressed configuration from 6551 bytes to 2893 bytes[OK] +Saving converted configuration to bootflash: ... +Destination filename [startup-config.converted_vs-20130124-062921]? +Please stand by while rebooting the system... +Restarting system. + +Rommon (G) Signature verification PASSED +Rommon (P) Signature verification PASSED +FPGA (P) Signature verification PASSED + +Similarly you need to enter the "switch convert mode virtual" command on Switch 2 for converting to Virtual Switch Mode. + +SW2# switch convert mode virtual + +This command will convert all interface names +to naming convention "interface-type switch-number/slot/port", +save the running config to startup-config and +reload the switch. +Do you want to proceed? [yes/no]: yes +Converting interface names +Building configuration... +Compressed configuration from 6027 bytes to 2774 bytes[OK] +Saving converted configuration to bootflash: ... +Destination filename [startup-config.converted_vs-20130124-052526]? +Please stand by while rebooting the system... +Restarting system. + +Rommon (G) Signature verification PASSED +Rommon (P) Signature verification PASSED +FPGA (P) Signature verification PASSED + + + +************************************************************ +* * +* Welcome to Rom Monitor for WS-X45-SUP7-E System. * +* Copyright (c) 2008-2012 by Cisco Systems, Inc. * +* All rights reserved. * +* * +************************************************************ + +After confirmation is completed on each switch, the running configuration will be saved as the startup configuration and the switch will reboot. After the reboot, the switch will be in virtual switch mode. +Chapter 1: Ethernet Basics 35 + +VSS Verification Procedures + +A handful of simple show commands can be used to display specifics associated with the VSS configuration of a particular VSS pair. The virtual switch domain number, and the switch number and role for each of the switches, can be found through the show switch virtual command, as illustrated in Example 1-12. + +Example 1-12 Display the Virtual Switch Domain Number + +SW1# sh switch virtual + +Executing the command on VSS member switch role = VSS Active, id = 1 + +Switch mode : Virtual Switch +Virtual switch domain number : 10 +Local switch number : 1 +Local switch operational role: Virtual Switch Active +Peer switch number : 2 +Peer switch operational role : Virtual Switch Standby + +Executing the command on VSS member switch role = VSS Standby, id = 2 + +Switch mode : Virtual Switch +Virtual switch domain number : 10 +Local switch number : 2 +Local switch operational role: Virtual Switch Standby +Peer switch number : 1 +Peer switch operational role : Virtual Switch Active + +One of the most important operational requirements of a VSS is to ensure that one switch in the cluster is the active switch and the other is the standby. The console of the standby switch should appear as illustrated in Example 1-13. + +Example 1-13 Console of the Standby Switch + +SW2-standby> +Standby console disabled + +As we described in the theoretical portion of our discussion, there are a number of roles and configurational requirements associated with VSS. To see these variables for each of the switches in the VSS, use the show switch virtual role command. Example 1-14 shows the type and detail that this command can generate. +36 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 1-14 Virtual Role Assignment and Priority + +SW1# sh switch virtual role +Executing the command on VSS member switch role = VSS Active, id = 1 +RRP information for Instance 1 +-------------------------------------------------------------------- +Valid Flags Peer Preferred Reserved +Count Peer Peer +-------------------------------------------------------------------- +TRUE V 1 1 1 +Switch Switch Status Preempt Priority Role Local Remote +Number Oper(Conf) Oper(Conf) SID SID +-------------------------------------------------------------------- +LOCAL 1 UP FALSE(N ) 100(100) ACTIVE 0 0 +REMOTE 2 UP FALSE(N ) 100(100) STANDBY 6834 6152 + +Peer 0 represents the local switch + +Flags : V - Valid +In dual-active recovery mode: No + +Executing the command on VSS member switch role = VSS Standby, id = 2 + +RRP information for Instance 2 + +-------------------------------------------------------------------- +Valid Flags Peer Preferred Reserved +Count Peer Peer + +-------------------------------------------------------------------- +TRUE V 1 1 1 + +Switch Switch Status Preempt Priority Role Local Remote +Number Oper(Conf) Oper(Conf) SID SID +-------------------------------------------------------------------- + +LOCAL 2 UP +REMOTE 1 UP + +FALSE(N ) +FALSE(N ) + +100(100) STANDBY 0 0 +100(100) ACTIVE 6152 6834 + + +Peer 0 represents the local switch + +Flags : V - Valid +In dual-active recovery mode: No + +To display information about the VSL, use the show switch virtual link command, as shown in Example 1-15. +Chapter 1: Ethernet Basics 37 + +Example 1-15 Virtual Switch Link Details + +SW1# sh switch virtual link + +Executing the command on VSS member switch role = VSS Active, id = 1 + +VSL Status : UP +VSL Uptime : 3 minutes +VSL Control Link : Gi1/7/4 + +Executing the command on VSS member switch role = VSS Standby, id = 2 + +VSL Status : UP +VSL Uptime : 3 minutes +VSL Control Link : Gi2/4/45 + +Additionally, Example 1-16 illustrates how to verify information about the VSL port channel configuration using the show switch virtual link port-channel command. + +Example 1-16 Display the Virtual Switch Domain Number + +SW1# sh switch virtual link port-channel + +Executing the command on VSS member switch role = VSS Active, id = 1 + +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +N - not in use, no aggregation + +f - failed to allocate aggregator + +M - not in use, no aggregation due to minimum links not met +m - not in use, port not aggregated due to minimum links not met +u - unsuitable for bundling +d - default port + +w - waiting to be aggregated + +Group Port-channel Protocol Ports +------+-------------+-----------+------------------- + +5 Po5(SU) +10 Po10(SU) + +- Gi1/7/3(P) Gi1/7/4(P) +- Gi2/4/45(P) Gi2/4/46(P) + + +Executing the command on VSS member switch role = VSS Standby, id = 2 + +Flags: D - down P - bundled in port-channel +38 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +N - not in use, no aggregation + +f - failed to allocate aggregator + +M - not in use, no aggregation due to minimum links not met +m - not in use, port not aggregated due to minimum links not met +u - unsuitable for bundling +d - default port + +w - waiting to be aggregated + +Group Port-channel Protocol Ports +------+-------------+-----------+------------------- + +5 Po5(SU) +10 Po10(SU) + +- Gi1/7/3(P) Gi1/7/4(P) +- Gi2/4/45(P) Gi2/4/46(P) + + +SW1# + + +IOS-XE + +In the twenty-first century, we find ourselves dealing with the ever-evolving needs of a modern network, meaning a network with the capacity to support varied and intelligent management tools as well as software-defined network mechanisms that rapidly exceed the capacity of the traditional Internetworking Operating System (IOS). This has resulted largely because of the monolithic nature of IOS itself. + +We first have to recognize that IOS has served us well over the years, but now the demands of networks have forced us to relook at how we support the operational process of typical protocols like OSPF, EIGRP, MPLS, BGP, and IPv6, to name a few. So it should come as no surprise that in an effort to expand the serviceability and survivability of IOS, it was necessary for it to evolve as well. In fact, IOS has evolved into three primary operating systems that each service and fulfill different purposes in the grand scheme of the network. These operation systems include variants like NX-OS, IOS-XR, and IOS-XE. Of these, the one we will concern ourselves with is IOS-XE. + +It should go without saying that IOS-XE was designed for routers, switches, and appli-ances, and as such, it embraces all the field-tested capabilities and features of IOS, while adding new functionality and benefits traditionally found in a portable operating system interface (POSIX) environment. This was the most logical approach available to integrate network-aware applications into modern routing devices. As a result, IOS-XE seamlessly integrates a generic approach to network management into every function, borrowing heavily from the equally reliable POSIX operating system. Furthermore, through the incorporation of a series of well-defined application programming interfaces (API), Cisco has improved IOS portability. Specifically, we are making reference to the operation of +Chapter 1: Ethernet Basics 39 + +IOS across platforms as well as extending capabilities outside of IOS. This final compo-nent to IOS-XE creates a future where application integration will be simplified, integral, and commonplace. + +IOS has been the center point for network expansion, configuration, and operation for decades, and this same functionality is now integrated into IOS-XE, thus preserving all the advantages of traditional IOS and its unparalleled history for delivering functionality for business-critical applications. All of this is done while retaining the same look and feel of IOS, but doing it while ensuring enhanced “future-proof” functionality. + +How is all this possible? IOS-XE runs a modern Linux operating system that employs a single daemon; the additional functionality we have been discussing will be run as iso-lated processes within the OS of the host. This means that we have all the capabilities we had in IOS with enhanced operations and functionality that will not require retraining. + +At first glance, this might not seem to be that big of an improvement, but if we keep in mind that running IOS and these other applications as separate processes, it becomes apparent that we can now leverage symmetrical multiprocessing. This in itself means that we can garner the benefits of load balancing across multiple-core CPUs by binding pro-cesses to different cores. Thus, we create an operational environment where it is possible to support multithreading and multicore CPUs. This capability, coupled with how +IOS-XE separates the control plane from the forwarding plane, ensures a level of manage-ment and control that could not possibly exist in the context of the traditional mono-lithic IOS. + +Today, the IOS that runs on routers runs all the necessary modules to perform network operations in the same memory space. This is problematic if something were to happen to the routing engine because the result would be that the entire IOS kernel could crash. As early as five years ago, this might have been a tenable situation, but in the modern enterprise this is catastrophic, because today’s business networks running virtualization-enabled infrastructures consolidated on single platforms cannot allow a single process to bring down an entire assembly. + +By moving the software architecture to a system daemon running on a “Linux platform,” we now have the multiple levels of abstraction. The overall result is now inside of IOS-XE individual system functions that have been isolated from the primary operation kernel by placing them into separate processes. This means that should one of these isolated pro-cesses fail, it will not affect the kernel. So the idea of symmetrical multiprocessing gets taken one step further now by creating individual threads for each underlying process we have on our routing devices. + +It is through this isolated operation model that application designers will have the ability to build drivers for new data plane ASICs and have them interoperate with sets of stan-dard APIs. It is these APIs that will then create control plane and data plane processing separation. + +It has been customary for some time to describe the operation mechanism of a router as falling into one or more different categories. Specifically, we are referring to the control plane, the data plane, and the input/output plane. The capability of an operating system to isolate the operation mechanisms of these three planes has a direct impact on device uptime as it relates to planned or unplanned outages. +40 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + +As a result of the modular architecture that we have attributed to IOS-XE, we see both a logical and a physical isolation of the control and data planes themselves. This at first might seem to be a subtle difference, but in fact, this has far-reaching benefits. Now we have physical separation of the three planes through modular blades that are installed into the chassis, each having dedicated hardware resources. IOS-XE also maintains logi-cal separation as an abstraction layer. We get even more capabilities to reduce failure domains within the routing system, as well as the capability to isolate operation loads +between planes. An example of this would be heavy stress caused by forwarding massive amounts of traffic in the data plane, which would have no impact on the control plane running on the same chassis. This is made possible by the fact that IOS-XE runs a sepa-rate driver instance for each bay or blade slot in the chassis; therefore, one drive failing will have no impact on the other bays or the chassis as a whole. The outcome is that all the other processes will continue to forward traffic. In addition to this, we can actually patch individual drivers without bringing down the entire chassis. + +This separation is achieved through the Forwarding and Feature Manager (FFM) and the Forwarding Engine Driver (FED). + +The FFM provides a set of APIs used to manage the control plane processes. The result-ing outcome is that the FFM programs the data plane through the FED and maintains all forwarding states for the system. It is the FED that allows the drivers to affect the data +plane, and it is provided by the platform. +Chapter 1: Ethernet Basics 41 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 1-8 lists the different types of Ethernet and some distinguishing characteristics of each type. + +Table 1-8 Ethernet Standards + + +Type of Ethernet +10BASE5 + +10BASE2 + +10BASE-T + +DIX Ethernet Version 2 +IEEE 802.3 + + +IEEE 802.2 + + +IEEE 802.3u + +IEEE 802.3z + +IEEE 802.3ab + +General Description +Commonly called “Thicknet”; uses coaxial cabling + +Commonly called “Thinnet”; uses coaxial cabling + +First type of Ethernet to use twisted-pair cabling + +Layer 1 and Layer 2 specifications for original Ethernet, from Digital/ Intel/Xerox; typically called DIX V2 +Called MAC because of the name of the IEEE committee (Media Access Control); original Layer 1 and 2 specifications, standardized using DIX V2 as a basis +Called LLC because of the name of the IEEE committee (Logical Link Control); Layer 2 specification for headers common to multiple IEEE LAN specifications +IEEE standard for Fast Ethernet (100 Mbps) over copper and optical cabling; typically called FastE +Gigabit Ethernet over optical cabling; typically called GigE + +Gigabit Ethernet over copper cabling + + + +Switches forward frames when necessary, and do not forward when there is no need to do so, thus reducing overhead. To accomplish this, switches perform three actions: + +■ Learn MAC addresses by examining the source MAC address of each received frame + +■ Decide when to forward a frame or when to filter (not forward) a frame, based on the destination MAC address + +■ Create a loop-free environment with other bridges by using the Spanning Tree Protocol + +The internal processing algorithms used by switches vary among models and vendors; regardless, the internal processing can be categorized as one of the methods listed in Table 1-9. +42 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 1-9 Switch Internal Processing + + +Switching Method +Store-and-forward + + + +Cut-through + + + + + +Fragment-free + +Description + +The switch fully receives all bits in the frame (store) before forwarding the frame (forward). This allows the switch to check the frame check sequence (FCS) before forwarding the frame, thus ensuring that errored frames are not forwarded. +The switch performs the address table lookup as soon as the Destination Address field in the header is received. The first bits in the frame can be sent out the outbound port before the final bits in the incoming frame are received. This does not allow the switch to discard frames that fail the FCS check, but the forwarding action is faster, resulting in lower latency. +This performs like cut-through switching, but the switch waits for 64 bytes to be received before forwarding the first bytes of the outgoing frame. According to Ethernet specifications, collisions should be detected during the first 64 bytes of the frame, so frames that are in error because of a collision will not be forwarded. + + + +Table 1-10 lists some of the most popular Cisco IOS commands related to the topics in this chapter. + + +Table 1-10 + +Command + + +Catalyst IOS Commands for Catalyst Switch Configuration + +Description + + + +interface vlan 1 + +interface fastethernet 0/x + +duplex {auto | full | half} + +speed {10 | 100 | 1000 | auto | nonegotiate } + +Global command; moves user to interface configuration mode for a VLAN interface +Puts user in interface configuration mode for that interface +Used in interface configuration mode; sets duplex mode for the interface +Used in interface configuration mode; sets speed for the interface + +show mac address-table [aging-time | Displays the MAC address table; the security count | dynamic | static] [address hw-addr ] option displays information about the +[interface interface-id ] [vlan vlan-id] restricted or static settings + + +show interface fastethernet 0/x + +show interface vlan 1 + +remote span + +Displays interface status for a physical 10/100 interface +Displays IP address configuration for a VLAN + +In VLAN configuration mode, specifies that the VLAN is configured as a remote SPAN destination VLAN +Chapter 1: Ethernet Basics 43 + + + +Command +monitor session 1-66 source [vlan vlan-id | interface interface-id] [rx | tx | both] + + + +monitor session 1-66 destination [remote vlan vlan-id] | interface interface-id ] + +monitor session 1-66 filter vlan [vlan | vlan-range ] + +show monitor session session-id + +Description +Configures a SPAN or RSPAN source, which can include one or more physical interfaces or one or more VLANs; optionally specifies traffic entering (Rx) or leaving (Tx), or both, with respect to the specified source +Configures the destination of a SPAN or RSPAN session to be either a physical interface or a remote VLAN +Removes traffic from the specified VLAN or VLAN range from the monitored traffic stream + +Displays the status of a SPAN session + + + +Table 1-11 outlines the types of UTP cabling. + + +Table 1-11 UTP Cabling Reference + + +UTP Category +1 + +2 + +3 + +4 + +5 + +5e + +6 + +Max Speed Rating +— + +4 Mbps + +10 Mbps + +16 Mbps + +1 Gbps + +1 Gbps + +1 Gbps+ + +Description + +Used for telephones and not for data + +Originally intended to support Token Ring over UTP + +Can be used for telephones as well; popular option for Ethernet in years past, if Cat 3 cabling for phones was already in place +Intended for the fast Token Ring speed option + +Very popular for cabling to the desktop + +Added mainly for the support of copper cabling for Gigabit Ethernet +Intended as a replacement for Cat 5e, with capabilities to support multigigabit speeds + + + +Table 1-12 lists the pertinent details of the Ethernet standards and the related cabling. +44 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Table 1-12 + +Standard +10BASE5 + +10BASE2 + +10BASE-T + + +Ethernet Types and Cabling Standards + +Cabling +Thick coaxial + +Thin coaxial + +UTP Cat 3, 4, 5, 5e, 6 + + + +Maximum Single Cable Length +500 m + +185 m + +100 m + + + +100BASE-FX + +100BASE-T + +100BASE-T4 + +100BASE-TX + +1000BASE-LX + + +1000BASE-SX + +1000BASE-ZX + +1000BASE-CS + +1000BASE-T + +Two strands, multimode + +UTP Cat 3, 4, 5, 5e, 6, 2 pair + +UTP Cat 3, 4, 5, 5e, 6, 4 pair + +UTP Cat 3, 4, 5, 5e, 6, or STP, 2 pair + +Long-wavelength laser, MM or SM fiber + +Short-wavelength laser, MM fiber + +Extended wavelength, SM fiber + +STP, 2 pair + +UTP Cat 5, 5e, 6, 4 pair + +400 m + +100 m + +100 m + +100 m + +10 km (SM) + +3 km (MM) + +220 m with 62.5-micron fiber; 550 m with 50-micron fiber +100 km + +25 m + +100 m + + + + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +Autonegotiation, half duplex, full duplex, crossover cable, straight-through cable, unicast address, multicast address, broadcast address, loopback circuitry, I/G bit, U/L bit, CSMA/CD, SPAN, RSPAN, ERSPAN, remote VLAN, monitor session, VLAN filtering, encapsulation replication, VSS, VSL, FED, FFM +Refer to the glossary to check your answers. +Chapter 1: Ethernet Basics 45 + +Further Reading + +For a good reference for more information on the actual FLPs used by autonegotia-tion, refer to the Fast Ethernet web page of the University of New Hampshire Research +Computing Center’s InterOperability Laboratory, at www.iol.unh.edu/services/testing/fe/ training/. + +For information about configuring SPAN and RSPAN, and for a full set of restrictions (specific to the 3560 and 3750), see www.ciscosystems.com/en/US/docs/switches/lan/ catalyst3560/software/release/12.2_50_se/configuration/guide/swspan.html. + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ VLANs + +■ VLAN Trunking + +■ VLAN Trunking Protocol (VTP) + +■ PPP over Ethernet (PPPoE) +CHAPTER 2 + + + + + + +Virtual LANs and VLAN Trunking + + +This chapter continues with the coverage of some of the most fundamental and impor-tant LAN topics with coverage of VLANs and VLAN trunking. As usual, for those of you current in your knowledge of the topics in this chapter, review the items next to the Key Topic icons spread throughout the chapter, plus the “Foundation Summary” and “Memory Builders” sections at the end of the chapter. + +“Do I Know This Already?” Quiz + +Table 2-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 2-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Virtual LANs + +VLAN Trunking Protocol + +VLAN Trunking: ISL and 802.1Q + +Configuring PPPoE + +Total Score + +Questions Covered in This Section Score +1–2 + +3–5 + +6–9 + +10 + + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. Assume that VLAN 28 does not yet exist on Switch1. Which of the following com-mands, issued in the global configuration mode (reached with the configure terminal command) or any of its submodes would cause the VLAN to be created? +a. vlan 28 + +b. vlan 28 name fred + +c. switchport vlan 28 + +d. switchport access vlan 28 + +e. switchport access 28 +48 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +2. Which of the following are advantages of using Private VLANs? + +a. Better LAN security + +b. IP subnet conservation + +c. Better consistency in VLAN configuration details + +d. Reducing the impact of broadcasts on end-user devices + +e. Reducing the unnecessary flow of frames to switches that do not have any ports in the VLAN to which the frame belongs + +3. Which of the following VLANs can be pruned by VTP on an 802.1Q trunk? + +a. 1–1023 + +b. 1–1001 + +c. 2–1001 + +d. 1–1005 + +e. 2–1005 + +4. An existing switched network has ten switches, with Switch1 and Switch2 being the only VTPv2 servers in the network. The other switches are all VTPv2 clients and have successfully learned about the VLANs from the VTPv2 servers. The only con-figured VTP parameter on all switches is the VTP domain name (Larry). The VTP revision number is 201. What happens when a new, already-running VTPv2 client switch, named Switch11, with domain name Larry and revision number 301, con-nects through a trunk to any of the other ten switches? +a. No VLAN information changes; Switch11 ignores the VTP updates sent from the two existing VTP servers until the revision number reaches 302. + +b. The original ten switches replace their old VLAN configuration with the con-figuration in Switch11. + +c. Switch11 replaces its own VLAN configuration with the configuration sent to it by one of the original VTP servers. + +d. Switch11 merges its existing VLAN database with the database learned from the VTP servers, because Switch11 had a higher revision number. +Chapter 2: Virtual LANs and VLAN Trunking 49 + +5. An existing switched network has ten switches, with Switch1 and Switch2 being the only VTPv3 servers in the network, and Switch1 being the primary server. The +other switches are all VTPv3 clients, and have successfully learned about the VLANs from the VTP server. The only configured VTP parameter is the VTP domain name (Larry). The VTP revision number is 201. What happens when an already-running VTPv3 server switch, named Switch11, with domain name Larry and revision number 301, connects through a trunk to any of the other ten switches? +a. No VLAN information changes; all VTP updates between the original VTP domain and the new switch are ignored. + +b. The original ten switches replace their old VLAN configuration with the con-figuration in Switch11. + +c. Switch11 replaces its old VLAN configuration with the configuration sent to it by one of the original VTP servers. + +d. Switch11 merges its existing VLAN database with the database learned from the VTP servers, because Switch11 had a higher revision number. + +e. None of the other answers is correct. + +6. Assume that two brand-new Cisco switches were removed from their cardboard boxes. PC1 was attached to one switch, PC2 was attached to the other, and the two switches were connected with a cross-over cable. The switch connection dynamically formed an 802.1Q trunk. When PC1 sends a frame to PC2, how many additional bytes of header are added to the frame before it passes over the trunk? +a. 0 + +b. 4 + +c. 8 + +d. 26 + +7. Assume that two brand-new Cisco Catalyst 3560 switches were connected with a cross-over cable. Before the cable was attached, one switch interface was config-ured with the switchport trunk encapsulation dot1q, switchport mode trunk, and switchport nonegotiate subcommands. Which of the following must be configured on the other switch before trunking will work between the switches? +a. switchport trunk encapsulation dot1q + +b. switchport mode trunk + +c. switchport nonegotiate + +d. No configuration is required. +50 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +8. When configuring trunking on a Cisco router Fa0/1 interface, under which configu-ration modes could the IP address associated with the native VLAN (VLAN 1 in this case) be configured? +a. Interface Fa0/1 configuration mode + +b. Interface Fa0/1.1 configuration mode + +c. Interface Fa0/1.2 configuration mode + +d. None of the other answers is correct. + +9. Which of the following about 802.1Q are false? + +a. Encapsulates the entire frame inside an 802.1Q header and trailer + +b. Has a concept of a native VLAN + +c. Allows VTP to operate only on extended-range VLANs + +d. Is chosen over ISL by DTP + +10. Which command enables PPPoE client functionality on the outside Ethernet inter-face on a Cisco router? + +a. pppoe enable + +b. pppoe-client enable + +c. pppoe-client dialer-pool-number + +d. pppoe-client dialer-number +Chapter 2: Virtual LANs and VLAN Trunking 51 + + +Foundation Topics + + +Virtual LANs + + + + + + + + + + + + + + + + + +Key Topic + +In an Ethernet LAN, a set of devices that receive a broadcast sent by any one of the devices in the same set is called a broadcast domain. On switches that have no con-cept of virtual LANs (VLAN), a switch simply forwards all broadcasts out all interfaces, except the interface on which it received the frame. As a result, all the interfaces on an individual switch are in the same broadcast domain. Also, if the switch connects to other switches and hubs, the interfaces on those switches and hubs are also in the same broad-cast domain. + +A VLAN is simply an administratively defined subset of switch ports that are in the same broadcast domain. Ports can be grouped into different VLANs on a single switch, and on multiple interconnected switches as well. By creating multiple VLANs, the switches cre-ate multiple, yet contained, broadcast domains. By doing so, a broadcast sent by a device in one VLAN is forwarded to the other devices in that same VLAN; however, the broad-cast is not forwarded to devices in the other VLANs. + +With VLANs and IP, best practices dictate a one-to-one relationship between VLANs and IP subnets. Simply put, the devices in a single VLAN are typically also in the same single IP subnet. Alternately, it is possible to put multiple subnets in one VLAN, and use secondary IP addresses on routers to route between the VLANs and subnets. Ultimately, the CCIE written exams tend to focus more on the best use of technologies, so this book will assume that one subnet sits on one VLAN, unless otherwise stated. + +Layer 2 switches forward frames between devices in the same VLAN, but they do not forward frames between two devices in different VLANs. To forward data between two VLANs, a multilayer switch (MLS) or router is needed. Chapter 6, “IP Forwarding +(Routing),” covers the details of MLS. + + + +VLAN Configuration + +On Cisco IOS–based switches, a VLAN is primarily identified by its numerical ID, which is the only mandatory argument when creating, modifying, or deleting a VLAN. A VLAN can be assigned a verbal name for better orientation, but only a very few places in the CLI allow substituting the VLAN name for its ID. Also, a VLAN has an operational state: It can either be active, which is the default state, or it can be suspended. A suspended VLAN is hibernated—while it exists, it does not operate. Access ports in a suspended VLAN are unable to communicate and drop all frames, similar to ports put into a nonex-istent VLAN. Putting a suspended VLAN back into the active state also reinstates normal communication on all ports in that VLAN. +52 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Configuring VLANs in a network of Cisco switches requires just a few simple steps: + +Step 1. Create the VLAN itself, optionally configuring its name and state. + +Step 2. Associate the correct ports with that VLAN. + +The challenge relates to how some background tasks differ depending on how the Cisco VLAN Trunking Protocol (VTP) is configured, and whether normal-range or extended-range VLANs are being used. We will discuss VTP and VLAN ranges in more detail later in this chapter. + +Using VLAN Database Mode to Create VLANs + +To begin, consider Example 2-1, which shows some of the basic mechanics of VLAN creation in VLAN database configuration mode. While this configuration mode is considered obsolete on recent switches and might not be supported at all, it might still be used on older Catalyst platforms and on ISR and ISR G2 routers with switching mod-ules installed. VLAN database configuration mode allows the creation of VLANs, basic administrative settings for each VLAN, and verification of VTP configuration informa-tion. Only normal-range (VLANs 1–1005) VLANs can be configured in this mode, and the VLAN configuration is stored in a Flash file called vlan.dat. In general, the VLAN database configuration mode should be avoided if possible, and hopefully you will not need to use it anymore; however, there are still switches and even relatively recent routers deployed in networks that do not support the newer way of configuring VLANs in global configuration mode. + +Example 2-1 demonstrates VLAN database configuration mode, showing the configura-tion on Switch3 from Figure 2-1. The example shows VLANs 21 and 22 being created. + + +VLAN 21 +Subnet 10.1.21.x/24 + +Fa0/0 Fa0/1 Gi0/1 + +VLAN 22 +Subnet 10.1.22.x/24 + +Fa0/2 + +R1 SW1 SW2 R2 + + + + +Fa0/3 +R3 + +Fa0/12 Fa0/24 + +SW3 SW4 Fa0/7 Fa0/5 + + + + +PC1 R4 + + +Figure 2-1 Simple Access and Distribution +Chapter 2: Virtual LANs and VLAN Trunking 53 + +Example 2-1 VLAN Creation in VLAN Database Mode – Switch3 Key +Topic ! Below, note that Fa0/12 and Fa0/24 are missing from the list, because they have +! dynamically become trunks, supporting multiple VLANs. + +Switch3# show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 +Fa0/5, Fa0/6, Fa0/7, Fa0/8 +Fa0/9, Fa0/10, Fa0/11, Fa0/13 +Fa0/14, Fa0/15, Fa0/16, Fa0/17 +Fa0/18, Fa0/19, Fa0/20, Fa0/21 +Fa0/22, Fa0/23 + +! Below, "unsup" means that this 2950 switch does not support FDDI and TR + + +1002 fddi-default +1003 token-ring-default +1004 fddinet-default +1005 trnet-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +! Below, vlan database moves user to VLAN database configuration mode. +! The vlan 21 command defines the VLAN, as seen in the next command output +! ( show current), VLAN 21 is not in the "current" VLAN list. + +Switch3# vlan database +Switch3(vlan)# vlan 21 +VLAN 21 added: +Name: VLAN0021 + +! The show current command lists the VLANs available to the IOS when the switch +! is in VTP Server mode. The command lists the VLANs in numeric order, with +! VLAN 21 missing. + +Switch3(vlan)# show current +VLAN ISL Id: 1 +Name: default +Media Type: Ethernet +VLAN 802.10 Id: 100001 +State: Operational +MTU: 1500 +Backup CRF Mode: Disabled +Remote SPAN VLAN: No +54 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! Lines omitted for brevity +! Next, note that show proposed lists VLAN 21. The vlan 21 command +! creates the definition, but it must be "applied" before it is "current". + +Switch3(vlan)# show proposed +VLAN ISL Id: 1 +Name: default +Media Type: Ethernet +VLAN 802.10 Id: 100001 +State: Operational +MTU: 1500 +Backup CRF Mode: Disabled +Remote SPAN VLAN: No + +VLAN ISL Id: 21 +Name: VLAN0021 +Media Type: Ethernet +VLAN 802.10 Id: 100021 +State: Operational +MTU: 1500 +Backup CRF Mode: Disabled +Remote SPAN VLAN: No + +! Lines omitted for brevity +! Next, you could apply to complete the addition of VLAN 21, +! abort to not make the changes and exit VLAN database mode, or +! reset to not make the changes but stay in VLAN database mode. + +Switch3(vlan)# ? +VLAN database editing buffer manipulation commands: +abort Exit mode without applying the changes +apply Apply current changes and bump revision number +exit Apply changes, bump revision number, and exit mode +no Negate a command or set its defaults +reset Abandon current changes and reread current database +show Show database information +vlan Add, delete, or modify values associated with a single VLAN +vtp Perform VTP administrative functions. + +! The apply command was used, making the addition of VLAN 21 complete. + +Switch3(vlan)# apply +APPLY completed. +Chapter 2: Virtual LANs and VLAN Trunking 55 + +! A show current now would list VLAN 21. + +Switch3(vlan)# vlan 22 name ccie-vlan-22 +VLAN 22 added: +Name: ccie-vlan-22 + +! Above and below, some variations on commands are shown, along with the +! creation of VLAN 22, with name ccie-vlan-22. +! Below, the vlan 22 option is used on show current and show proposed +! detailing the fact that the apply has not been done yet. + +Switch3(vlan)# show current 22 +VLAN 22 does not exist in current database +Switch3(vlan)# show proposed 22 +VLAN ISL Id: 22 + +! Lines omitted for brevity +! Finally, the user exits VLAN database mode using CTRL-Z, which does +! not inherently apply the change. CTRL-Z actually executes an abort. + +Switch3(vlan)# ^Z + + +Using Configuration Mode to Put Interfaces into VLANs + +To put a VLAN to use, the VLAN must be created, and then switch ports must be assigned to the VLAN. Example 2-2 shows how to associate the interfaces with the cor-rect VLANs, once again on Switch3. + + +Note At the end of Example 2-1, VLAN 22 had not been successfully created. The assumption for Example 2-2, however, is that VLAN 22 has been successfully created. + + +Example 2-2 Assigning Interfaces to VLANs – Switch3 +Key +Topic ! First, the switchport mode access command configures respective interfaces for ! static access mode, and the switchport access vlan command assigns them into +! respective VLANs. + +Switch3# conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch3(config)# int fa 0/3 +Switch3(config-if)# switchport mode access +Switch3(config-if)# switchport access vlan 22 +56 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Switch3(config-if)# int fa 0/7 +Switch3(config-if)# switchport mode access +Switch3(config-if)# switchport access vlan 21 +Switch3(config-if)# ^Z + +! Below, show vlan brief lists these same two interfaces as now being in +! VLANs 21 and 22, respectively. + +Switch3# show vlan brief + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + +21 VLAN0021 +22 ccie-vlan-22 + +active Fa0/1, Fa0/2, Fa0/4, Fa0/5 +Fa0/6, Fa0/8, Fa0/9, Fa0/10 +Fa0/11, Fa0/13, Fa0/14, Fa0/15 +Fa0/16, Fa0/17, Fa0/18, Fa0/19 +Fa0/20, Fa0/21, Fa0/22, Fa0/23 +active Fa0/7 +active Fa0/3 + + +! Lines omitted for brevity +! While the VLAN configuration is not shown in the running-config at this point, +! the switchport access command that assigns the VLAN for the interface is in the +! configuration, as seen with the show run int fa 0/3 command. + +Switch3# show run int fa 0/3 +interface FastEthernet0/3 +switchport access vlan 22 +switchport mode access + + +Using Configuration Mode to Create VLANs + +At this point, the two new VLANs (21 and 22) have been created on Switch3, and the two interfaces are now in the correct VLANs. However, all recent Cisco IOS–based switches support a different way to create VLANs, using configuration mode, as shown in Example 2-3. This is the preferred mode for configuring VLANs whenever supported, and is the only mode that can be used to configure extended-range and Private VLANs. All VLAN settings are performed in the vlan vlan-id mode accessed from global con-figuration level. Configuration changes apply only after exiting the vlan mode; this is one of the few IOS CLI contexts in which changes are not applied immediately after entering individual commands. +Chapter 2: Virtual LANs and VLAN Trunking 57 + +Example 2-3 Creating VLANs in Configuration Mode – Switch3 Key +Topic ! First, VLAN 31 did not exist when the switchport access vlan 31 command was +! issued. As a result, the switch both created the VLAN and put interface fa0/8 +! into that VLAN. Then, the vlan 32 global command was used to create a +! VLAN from configuration mode, and the name subcommand was used to assign a +! non-default name. + +Switch3# conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch3(config)# int fa 0/8 +Switch3(config-if)# switchport mode access +Switch3(config-if)# switchport access vlan 31 +% Access VLAN does not exist. Creating vlan 31 +Switch3(config-if)# exit +Switch3(config)# vlan 32 +Switch3(config-vlan)# name ccie-vlan-32 +Switch3(config-vlan)# ^Z +Switch3# show vlan brief + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + +21 VLAN0021 +22 ccie-vlan-22 +31 VLAN0031 +32 ccie-vlan-32 + +active Fa0/1, Fa0/2, Fa0/4, Fa0/5 +Fa0/6, Fa0/9, Fa0/10, Fa0/11 +Fa0/13, Fa0/14, Fa0/15, Fa0/16 +Fa0/17, Fa0/18, Fa0/19, Fa0/20 +Fa0/21, Fa0/22, Fa0/23 +active Fa0/7 +active Fa0/3 +active Fa0/8 +active + + +! Portions omitted for brevity + +Example 2-3 shows how the switchport access vlan subcommand creates the VLAN, as needed, and assigns the interface to that VLAN. Note that in Example 2-3, the show vlan brief output lists Fa0/8 as being in VLAN 31. Because no ports have been assigned to VLAN 32 as of yet, the final line in Example 2-3 simply does not list any interfaces. + +Modifying the Operational State of VLANs + +The state of a VLAN—active or suspended—can be manipulated both in vlan database and in configuration mode. A VLAN can be suspended in two ways: globally in the entire VTP domain and locally on a single switch without influencing its state through +58 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +VTP on other switches. The state suspend command, valid both in vlan database and in configuration mode, is used to globally suspend a VLAN. Suspending a VLAN locally, also called “locally shutting down the VLAN,” is accomplished using the shutdown com-mand, and is supported only in the configuration mode in the VLAN context. Do not confuse the shutdown command in the VLAN context with the same command avail-able under interface Vlan mode, which has a different and unrelated meaning (shutting down an SVI without further impairing the operation of the corresponding VLAN itself). Global and local VLAN states can be configured independently, but for a VLAN to be operational on a switch, it must be both globally and locally activated. Manipulating +the operational state of VLANs and the use of corresponding commands are shown in greater detail in Example 2-4. + +Example 2-4 Modifying the Operational State of VLANs + +! First, put the VLAN 21 to global suspended state in vlan database mode. The state +! will be propagated by VTP to all switches in the VTP domain if VTP is used. + +Switch3# vlan database +Switch3(vlan)# vlan 21 state ? + +active +suspend + +VLAN Active State +VLAN Suspended State + +Switch3(vlan)# vlan 21 state suspend +VLAN 31 modified: +State SUSPENDED +Switch3(vlan)# exit +APPLY completed. +Exiting.... + +! VLAN 21 will now be listed as suspended + +Switch3# show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +1 default active Fa0/1, Fa0/2, Fa0/4, Fa0/5 +Fa0/6, Fa0/9, Fa0/10, Fa0/11 +Fa0/13, Fa0/14, Fa0/15, Fa0/16 +Fa0/17, Fa0/18, Fa0/19, Fa0/20 +Fa0/21, Fa0/22, Fa0/23 +21 VLAN0021 suspended Fa0/7 + +! Portions omitted for brevity + +! Now use the configuration mode to reactivate the VLAN +Chapter 2: Virtual LANs and VLAN Trunking 59 + + +Switch3# conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch3(config)# vlan 21 +Switch3(config-vlan)# state active +Switch3(config-vlan)# exit +Switch3(config)# do show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + +21 VLAN0021 + +active Fa0/1, Fa0/2, Fa0/4, Fa0/5 +Fa0/6, Fa0/9, Fa0/10, Fa0/11 +Fa0/13, Fa0/14, Fa0/15, Fa0/16 +Fa0/17, Fa0/18, Fa0/19, Fa0/20 +Fa0/21, Fa0/22, Fa0/23 +active Fa0/7 + + +! Portions omitted for brevity + +! To locally suspend a VLAN, enter its configuration context and issue +! the shutdown command, then exit. Alternatively, you may also use the +! shutdown vlan global level configuration command that has exactly +! the same effect. In the VLAN listing, the VLAN 21 will be reported as +! active in the VTP domain on other switches, yet locally shutdown. +! It is also possible to both use the state suspend to suspend the VLAN +! via VTP globally, and shutdown to also have it locally shut down. + +Switch3(config)# vlan 21 +Switch3(config-vlan)# shutdown +Switch3(config-vlan)# exit +Switch3(config)# do show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- +1 default active Fa0/1, Fa0/2, Fa0/4, Fa0/5 +Fa0/6, Fa0/9, Fa0/10, Fa0/11 +Fa0/13, Fa0/14, Fa0/15, Fa0/16 +Fa0/17, Fa0/18, Fa0/19, Fa0/20 +Fa0/21, Fa0/22, Fa0/23 +21 VLAN0021 act/lshut Fa0/7 + +! Portions omitted for brevity + +! To reactivate the locally shut VLAN, enter the no shutdown command in vlan 21 +! context, or more straightforward, enter the no shutdown vlan 21 command + +Switch3(config)# no shutdown vlan 21 +Switch3(config)# do show vlan brief +60 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + +21 VLAN0021 + +active Fa0/1, Fa0/2, Fa0/4, Fa0/5 +Fa0/6, Fa0/9, Fa0/10, Fa0/11 +Fa0/13, Fa0/14, Fa0/15, Fa0/16 +Fa0/17, Fa0/18, Fa0/19, Fa0/20 +Fa0/21, Fa0/22, Fa0/23 +active Fa0/7 + + +! Portions omitted for brevity + +The VLAN creation process is simple but laborious in a large network. If many VLANs exist, and they exist on multiple switches, instead of manually configuring the VLANs on each switch, you can use VTP to distribute the VLAN configuration of a VLAN to the rest of the switches. VTP will be discussed later in the chapter. + +Private VLANs + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +Engineers can design VLANs with many goals in mind. In many cases today, devices end up in the same VLAN just based on the physical locations of the wiring drops. Security is another motivating factor in VLAN design: Devices in different VLANs do +not overhear each other’s broadcasts and possibly other communication. Additionally, the separation of hosts into different VLANs and subnets requires an intervening router or multilayer switch between the subnets, and these types of devices typically provide more robust security features. + +Regardless of the design motivations behind grouping devices into VLANs, good design practices typically call for the use of a single IP subnet per VLAN. In some cases, how-ever, the need to increase security by separating devices into many small VLANs con-flicts with the design goal of conserving the use of the available IP subnets. The Cisco Private VLAN feature described in RFC 5517 addresses this issue. Private VLANs allow a switch to separate ports as if they were on different VLANs, while consuming only a single subnet. + +A common place to implement Private VLANs is in the multitenant offerings of a service provider (SP). The SP can install a single router and a single switch. Then, the SP attaches devices from multiple customers to the switch. Private VLANs then allow the SP to use only a single subnet for the entire building, separating different customers’ switch ports so that they cannot communicate directly, while supporting all customers with a single router and switch. + +Conceptually, a Private VLAN is a mechanism that partitions a given VLAN into an arbitrary number of nonoverlapping sub-VLANs, or secondary VLANs. This partition-ing is invisible to the outside world that continues to see only the original VLAN, in this context called the primary VLAN. An important consequence of this private partition-ing is that from outside, the primary VLAN continues to use the same VLAN ID and IP subnet as the original VLAN. Internally, all secondary VLANs will share this common IP +subnet, although each of them has a different, unique VLAN ID that is associated with +Chapter 2: Virtual LANs and VLAN Trunking 61 + +the primary VLAN. Hence, a Private VLAN can be described as a cluster of one or more secondary VLANs, represented to the outside by a single primary VLAN, not unlike a BGP confederation, where multiple internal sub-ASes are represented to external peers as a single AS. Consider the topology in Figure 2-2 for an overview. + +Promiscuous +Port Trunk +R1 192.168.100.254/24 SW1 SW2 + + + + + + + + +Community VLAN 101 + + +Community VLAN 102 + + +Community VLAN 103 + +Isolated VLAN 199 + + + +Primary VLAN 100 192.168.100.0/24 + +Figure 2-2 Switched Network Utilizing Private VLANs + +Let us first consider the behavior of Private VLANs on a single switch. We will later dis-cuss how the Private VLAN functionality extends to multiple switches over trunks. + +Secondary VLANs can be of two types: community VLANs and isolated VLANs. Ports assigned to the same community VLAN can communicate with each other directly, but they are not allowed to communicate with ports in any other VLAN. This behavior is similar to ordinary VLANs. A single primary VLAN can be associated with multiple community VLANs, each of them representing a group of devices that can talk directly to each other but that are separated from any other similar groups. + +On the other hand, ports assigned to an isolated VLAN can neither communicate with each other nor with ports in any other VLAN. A single primary VLAN can be associated with at most one isolated VLAN, as having multiple isolated VLANs under a single pri-mary VLAN would make no sense. + +A single primary VLAN can be associated with zero or more community VLANs and with at most one isolated VLAN. A secondary VLAN, either a community or an isolated VLAN, must be associated with exactly one primary VLAN. + +As an example, consider a block of flats that needs to be fully networked, with you being the person responsible for configuring the networking equipment. A simple approach would be to connect all flats to a switch and assign all ports to a single VLAN, say, VLAN 100 utilizing the IP subnet 192.168.100.0/24. All stations in this VLAN share this IP space and can communicate with each other directly, and use a gateway IP address from the same subnet, for example, 192.168.100.254, to reach other networks. However, +62 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +this network has an obvious security issue—users in individual flats are not controlled and cannot be trusted. A single misbehaving or infected computer in one flat can wreak havoc throughout the entire VLAN. Therefore, it is natural to require that individual flats be isolated from each other but still continue to use the former VLAN 100, the same IP subnet, and the same default gateway. This can be accomplished by creating a new sec-ondary isolated VLAN, for example, VLAN 199, associating it with the original VLAN 100 (thereby making the VLAN 100 a primary VLAN) and assigning all access ports toward flats to the isolated VLAN 199. As a result, individual flats will be isolated from each other, yet they will continue to use the same IP address space and default gateway. The outside world will not see any difference. + +Life is seldom that simple, though. Selected users can start coming to you after a while and request direct visibility with other selected users because they want to mutually share files, stream a video, or play network games. There can be many similar groups of users that want to have mutual visibility, yet remain isolated from all other users. As an example, consider that three separate groups of users requesting mutual connectivity have formed in the block. Obviously, these groups form three communities, with mem-bers of each single community requesting full visibility with each other, yet keeping the separation between communities and from users that do not belong to any particular community. + +A comfortable way of solving this task is by creating three secondary community VLANs, one for each community, and assigning each member of a single community to the same community VLAN. In this example, the first group can be assigned to com-munity VLAN 101, the second group can be assigned to community VLAN 102, and the remaining group can be put into community VLAN 103. These secondary community VLANs 101–103 will be associated with the primary VLAN 100, again sharing its IP address space and default gateway. All other flats will remain in isolated VLAN 199 and will keep their total isolation. + +Depending on what secondary VLAN type a switch port is assigned to, we call these ports either community ports or isolated ports. In the preceding example, switch ports configured with VLANs 101–103 would be called community ports, while switch ports configured with VLAN 199 would be called isolated ports. Note that none of the ports mentioned so far is assigned to the primary VLAN 100. Both community and isolated ports behave as normal access ports—they technically belong to a single VLAN and they do not tag frames. + +According to communication rules described so far, hosts in a particular community VLAN can only talk to other hosts in the same community VLAN and no one else; hosts in a particular isolated VLAN can talk to no one at all. There is, so far, no possibility of communicating with the world outside the given Private VLAN, nor a way of accessing common shared resources, such as network printers, storage, or servers. Clearly, the use-fulness of such VLANs would be questionable at best. Therefore, there must be a way of defining a special port that is allowed to communicate with any member of any second-ary VLAN under a particular primary VLAN. A device attached to such a port—a router, server, NAS, printer, and so on—would then be accessible by any host in any secondary +VLAN under a particular primary VLAN, regardless of the type of the secondary VLAN. +Chapter 2: Virtual LANs and VLAN Trunking 63 + + + + + + + + + + + + + + + + + +Key Topic + +In Private VLAN terminology, such ports are called promiscuous ports. A promiscu-ous port is not associated with any particular secondary VLAN. Instead, it is associated with the corresponding primary VLAN itself. A device connected to a promiscuous port can communicate with devices in all secondary VLANs associated with this primary +VLAN and vice versa. A device in a secondary VLAN that is associated with a particular primary VLAN can communicate with any promiscuous port in that primary VLAN. If there are multiple promiscuous ports in the primary VLAN, they can also communicate with each other. Promiscuous ports also behave as access ports in the sense they do not use tagging. + +In the preceding example, if the default gateway 192.168.100.254 is an external router, it would be connected to a promiscuous port on the switch that implements the Private VLAN. This setup would allow hosts in VLANs 101–103 and 199 to communicate with other networks through this router. + +If Private VLANs are in use, the rules of communication on a single switch can be sum- +marized as follows: + + +■ A port in a particular community VLAN (that is, a community port) can communi-cate with all other ports in the same community VLAN and with all promiscuous ports in the corresponding primary VLAN. + +■ A port in a particular isolated VLAN (that is, an isolated port) can communicate with all promiscuous ports in the corresponding primary VLAN. + +■ A port in a particular primary VLAN (that is, a promiscuous port) can communicate with all other promiscuous ports in the same primary VLAN and with all ports in all secondary VLANs associated with this primary VLAN. + +Extending the operation of Private VLANs over a set of switches is fairly simple. The basic goal is to increase the span of Private VLANs while keeping their defined behavior and containment. A port in a particular community VLAN shall be able to communicate with other ports in the same community VLAN and with all promiscuous ports in the corresponding primary VLAN on any switch. Similarly, a port in a particular isolated VLAN shall be able to communicate with all promiscuous ports in the corresponding primary VLAN on any switch. A promiscuous port in a particular primary VLAN shall be able to communicate with all other promiscuous ports in that primary VLAN and with all ports in all associated secondary VLANs on all switches. Because these requirements implicitly assume that a frame received on a port in a primary or secondary VLAN can be forwarded through trunk ports to other switches, yet another communication rule is hereby established: A frame received on a promiscuous, community, or isolated port can always be forwarded through a trunk port. + +Obviously, if all primary/secondary VLANs, their IDs, types, and associations are config-ured identically on all switches (provided they support the Private VLAN feature), each switch will give frames the same consistent treatment as soon as their membership in a particular VLAN is established. As frames between switches are carried by trunk ports, it is important to see how the tagging of frames received on a Private VLAN port is per-formed. +64 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +If a frame is received on a community or isolated port and is forwarded through a trunk, the switch will tag the frame using the VLAN ID of the corresponding secondary VLAN. The receiving switch will then forward the received frame further according to the type of the secondary VLAN. + +If a frame is received on a promiscuous port and is forwarded through a trunk, the switch will tag the frame using the VLAN ID of the corresponding primary VLAN. The receiv-ing switch will then forward the frame further as a frame coming from a promiscuous port. + +To summarize the communication and tagging rules in Private VLANs: +Key +Topic ■ A port in a particular community VLAN (that is, a community port) can communi- +cate with all other ports in the same community VLAN, with all promiscuous ports in the corresponding primary VLAN, and with all trunks. + +■ A port in a particular isolated VLAN (that is, an isolated port) can communicate with all promiscuous ports in the corresponding primary VLAN, and with all trunks. + +■ A port in a particular primary VLAN (that is, a promiscuous port) can communicate with all other promiscuous ports in the same primary VLAN, with all ports in all sec-ondary VLANs associated with this primary VLAN, and with all trunks. + +■ A frame received on a community or isolated port will be tagged with the ID of the corresponding secondary VLAN when forwarded out a trunk. + +■ A frame received on a promiscuous port will be tagged with the ID of the corre-sponding primary VLAN when forwarded out a trunk. + +■ A frame received on a trunk tagged with a community or isolated VLAN ID will be forwarded as if it was received on a local community or isolated port in the corre-sponding secondary VLAN. + +■ A frame received on a trunk tagged with a primary VLAN ID will be forwarded as if it was received on a local promiscuous port in the corresponding primary VLAN. + +■ Community VLANs can be seen as VLANs carrying “upstream” traffic from a host to other hosts of the same community VLAN and to promiscuous ports in the corresponding primary VLAN. Isolated VLANs can be seen as VLANs carrying “upstream” traffic from hosts to promiscuous ports in the corresponding primary VLAN. A Primary VLAN can be seen as a VLAN carrying “downstream” traffic from promiscuous ports to other promiscuous ports and hosts in all associated sec-ondary VLANs. + +Table 2-2 summarizes the communication rules between various ports. +Chapter 2: Virtual LANs and VLAN Trunking 65 + + +Table 2-2 Private VLAN Communications Between Ports Key +Topic Description of Who Can Talk to Whom Primary Community VLAN Ports VLAN Ports1 + + + +Isolated VLAN Ports1 + +Talk to ports in primary VLAN Yes Yes Yes (promiscuous ports) +Talk to ports in the same secondary VLAN N/A2 Yes No (host ports) +Talk to ports in another secondary VLAN N/A2 No No + +Talk to trunks Yes Yes Yes + +1 Community and isolated VLANs are secondary VLANs. + +2 Promiscuous ports, by definition in the primary VLAN, can talk to all other ports. + +There are two common misconceptions regarding the Private VLAN operation on trunks. The first misconception relates to the tagging. It is often incorrectly believed that Private VLANs use double tagging on trunks. This belief is supported by the apparent nesting of secondary VLANs inside their associated primary VLAN. In reality, secondary VLANs do not exist “inside” their primary VLAN; rather, they are only associated with it. This association merely indicates that a frame received in a secondary VLAN can be for-warded out promiscuous ports in the associated primary VLAN and vice versa. + +The second misconception is related to trunk port types. We have so far described normal trunks (switchport mode trunk) that can be used both for ordinary and Private VLANs. There are, however, two special types of trunk ports with respect to Private VLANs. These special trunk port types are called Promiscuous PVLAN Trunk and Isolated PVLAN Trunk ports. Both these types shall not be used in ordinary Private VLAN deployments between switches supporting Private VLANs; rather, their usage +is limited to a set of special scenarios. To understand better, consider Figure 2-3, which contains a slightly modified topology, with VLAN 100 being the primary VLAN, VLANs 101 and 102 being community VLANs, and VLAN 199 being an isolated VLAN. In addition, there is VLAN 999, which spans the router and both switches and serves the purpose of a management VLAN. The SW1 switch is assumed to support Private VLANs while SW2 does not support them. + +The first special trunk type is the Promiscuous PVLAN Trunk. Whenever a frame from a secondary VLAN is going to be sent out such a trunk, its VLAN tag will be rewritten with the appropriate primary VLAN ID. This rewriting is necessary when a trunk car-rying a set of VLANs including Private VLANs is to be connected to an external device that does not support Private VLANs, yet which shall be reachable from the Private VLANs as if connected to a promiscuous port. If, for example, a router-on-stick like R1 in Figure 2-3 is used to route between several VLANs including a primary VLAN, the external router does not understand that multiple secondary VLANs actually map to a single primary VLAN. The Promiscuous PVLAN Trunk port will translate all secondary VLAN IDs into the corresponding primary VLAN ID so that the external router always sees only the primary VLAN. +66 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +VLAN 100: Primary VLAN “Users” VLAN 999: Management VLAN + + + +R1 + +Promiscuous PVLAN Trunk + + +SW1 + +Isolated PVLAN Trunk + + +SW2 + + + + + + + + + +Community VLAN 101 + + +Community VLAN 102 + +Isolated VLAN 199 + + + +Primary VLAN 100 192.168.100.0/24 + +Figure 2-3 Switched Topology Utilizing Special Trunk Types + +The second special type of a trunk is the Isolated PVLAN Trunk. This trunk type trans-lates a primary VLAN ID into the ID of the isolated VLAN that is associated with the primary VLAN. This is used to extend the isolated VLAN over a trunk carrying multiple VLANs to a switch that does not support Private VLANs but is capable of isolating its own ports. To illustrate, entry-level Catalyst switches do not support Private VLANs +but they support so-called protected ports (this feature is sometimes called the Private VLAN Edge). On these switches, a protected port can be configured using the switch-port protected command. Protected ports configured with this command are prohibited from ever communicating with each other—in essence, they act just like isolated ports. If a frame is received on a promiscuous port in the primary PVLAN and is about to be sent out the Isolated PVLAN Trunk port, its VLAN tag currently carrying the primary VLAN ID will be rewritten to the isolated VLAN ID. If the neighboring switch has its protected ports assigned to the isolated VLAN (although the VLAN is not configured as isolated on that switch because it does not support Private VLANs), it will be able to forward +the frame to the appropriate host. In Figure 2-3, the Isolated PVLAN Trunk is used to extend the isolated PVLAN 199 from SW1 to SW2 that does not support PVLANs, yet is capable of locally isolating its ports in VLAN 199. SW2 will not allow these ports to communicate together while allowing them to communicate with the trunk toward SW1. SW1 will make sure that a frame received on another isolated port in VLAN 199 will not be forwarded out the isolated PVLAN trunk toward SW2, and that a frame tagged with VLAN 199 coming through the isolated PVLAN trunk from SW2 will not be forwarded out any other isolated port in the same secondary VLAN. This way, the isolated second-ary VLAN is extended to SW2 without losing any of its isolated properties. Should, how-ever, R1 or any other device on a promiscuous port send a packet to a station on SW2, this packet would ordinarily be tagged with primary VLAN 100. On the isolated PVLAN +Chapter 2: Virtual LANs and VLAN Trunking 67 + +trunk on SW1, however, the tag 100 will be rewritten to 199 and forwarded to SW2, allowing the R1 on the promiscuous trunk to communicate with stations on SW2. + +So, in essence, the special nature of these trunks lies in the tag rewriting they perform: Key +Topic ■ A Promiscuous PVLAN Trunk port rewrites the secondary VLAN ID into the primary +PVLAN ID upon sending a frame. When a frame is received, no tag manipulation is performed. Also, no tag manipulation is performed for frames in ordinary VLANs. + +■ An Isolated PVLAN Trunk port rewrites the primary VLAN ID into the isolated sec-ondary VLAN ID upon sending a frame. When a frame is received, no tag manipu-lation is performed. Also, no tag manipulation is performed for frames in ordinary VLANs. + +Special Private VLAN Trunk types are supported only on selected higher-level Catalyst switches. + +Example 2-5 shows the configuration of a switch with Private VLANs. Configuration of ordinary trunks is not shown, as there is nothing specific regarding it. + +Example 2-5 Configuring Private VLANs +Key +Topic ! If not running VTPv3, a switch must be put into VTP Transparent mode before +! configuring Private VLANs + +AccessSw(config)# vtp mode transparent +Setting device to VTP Transparent mode for VLANS. + +! One isolated secondary VLAN and three community secondary VLANs will now be +! created. Afterwards, they will be associated with the primary VLAN 100. + +AccessSw(config)# vlan 199 +AccessSw(config-vlan)# name Isolated +AccessSw(config-vlan)# private-vlan isolated +AccessSw(config-vlan)# vlan 101 +AccessSw(config-vlan)# name Community1 +AccessSw(config-vlan)# private-vlan community +AccessSw(config-vlan)# vlan 102 +AccessSw(config-vlan)# name Community2 +AccessSw(config-vlan)# private-vlan community +AccessSw(config-vlan)# vlan 103 +AccessSw(config-vlan)# name Community3 +AccessSw(config-vlan)# private-vlan community +AccessSw(config-vlan)# vlan 100 +AccessSw(config-vlan)# name Primary1 +AccessSw(config-vlan)# private-vlan primary +AccessSw(config-vlan)# private-vlan association 101-103,199 +AccessSw(config-vlan)# exit +68 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! The show vlan private-vlan command is useful to verify the types and associations +! of private VLANs and their member ports. At this moment, there are no ports +! assigned to these VLANs yet. + +AccessSw(config)# do show vlan private-vlan + +Primary Secondary Type Ports +------- --------- ----------------- ------------------------------------------ +100 101 community +100 102 community +100 103 community +100 199 isolated + +! Now, ports will be assigned to these VLANs: + +! Fa0/1 - 3: +! Fa0/4 - 5: +! Fa0/6 - 8: + +Secondary community VLAN 101 +Secondary community VLAN 102 +Secondary community VLAN 103 + +! Fa0/9 - 12: Secondary isolated VLAN 199 +! Fa0/13: Promiscuous port in primary VLAN 100 +! For brevity purposes, only the configuration of Fa0/1 - 3 will be shown, as all +! other ports in secondary VLANs, isolated or community, are configured similarly +! Afterwards, show vlan private-vlan is issued to verify the port assignment. +! As Fa0/13 is a promiscuous port, it will be shown in all associated secondary ! VLANs + +AccessSw(config)# interface range fa0/1 - 3 +AccessSw(config-if-range)# switchport mode private-vlan host +AccessSw(config-if-range)# switchport private-vlan host-association 100 101 +AccessSw(config-if-range)# interface fa0/13 +AccessSw(config-if)# switchport mode private-vlan promiscuous +AccessSw(config-if)# switchport private-vlan mapping 100 101-103,199 +AccessSw(config-if)# do show vlan private-vlan + +Primary Secondary Type Ports +------- --------- ----------------- ------------------------------------------ + +100 101 community +100 102 community +100 103 community +100 199 isolated + +Fa0/1, Fa0/2, Fa0/3, Fa0/13 +Fa0/4, Fa0/5, Fa0/13 +Fa0/6, Fa0/7, Fa0/8, Fa0/13 +Fa0/9, Fa0/10, Fa0/11, Fa0/12, Fa0/13 + + +! If a SVI is used as a gateway for devices associated with the primary VLAN 100, +! it must also be configured as promiscuous + +AccessSw(config-if)# interface Vlan100 +AccessSw(config-if)# private-vlan mapping 101-103,199 +AccessSw(config-if)# ip address 192.168.100.254 255.255.255.0 +Chapter 2: Virtual LANs and VLAN Trunking 69 +1 + +VLAN Trunking: ISL and 802.1Q + +VLAN trunking allows switches, routers, and even PCs with the appropriate network interface cards (NIC) and/or software drivers to send traffic for multiple VLANs across a single link. To know to which VLAN a frame belongs, the sending switch, router, or PC adds a header to the original Ethernet frame, with that header having a field in which to place the VLAN ID of the associated VLAN. This section describes the protocol details for the two trunking protocols, followed by the details of how to configure trunking. + +ISL and 802.1Q Concepts + +If two devices are to perform trunking, they must agree to use either Inter-Switch Link (ISL) or 802.1Q, because there are several differences between the two, as summarized in Table 2-3. + + +Table 2-3 Key +Topic Feature + + +Comparing ISL and 802.1Q + +ISL 802.1Q + + + +VLANs supported + +Protocol defined by + +Encapsulates original frame or inserts tag +Has a concept of native VLAN + +Normal and extended range + +Cisco + +Encapsulates + +No + +Normal and extended range + +IEEE + +Inserts tag + +Yes + + +1 ISL originally supported only normal-range VLANs, but was later improved to support extended-range VLANs as well. + +ISL and 802.1Q differ in how they add a header to the Ethernet frame before sending it over a trunk. ISL adds a new 26-byte header, plus a new trailer (to allow for the new FCS value), encapsulating the entire original frame. This encapsulating header uses the source address (listed as SA in Figure 2-4) of the device doing the trunking, instead of the source MAC of the original frame. ISL uses a multicast destination address (listed as DA in Figure 2-4) of either 0100.0C00.0000 or 0300.0C00.0000. Overall, though, an ISL frame is technically a SNAP-encapsulated frame. + +802.1Q inserts a 4-byte header, called a tag, into the original frame (right after the Source Address field). The original frame’s addresses are left intact. Normally, an Ethernet con-troller would expect to find either an Ethernet Type field or 802.3 Length field right after the Source Address field. With an 802.1Q tag, the first 2 bytes after the Address fields hold a registered Ethernet type value of 0x8100, which implies that the frame includes an 802.1Q header. Because 802.1Q does not actually encapsulate the original frame, it is often called frame tagging. Figure 2-4 shows the contents of the headers used by both ISL and 802.1Q. +70 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 +SL Heade CRC + + + +Key Topic + +I 26 bytes r Encapsulated Ethernet Frame 4 bytes + + +DA Type User SA LEN AAAA03 HSA VLAN BPDU INDEX RES + + +VLAN BPDU + + + +Dest Src Len/Etype Data FCS + +Original Frame + + + + +Dest Src Etype Tag Len/Etype Data FCS + +Tagged Frame + + + + +Priority VLAN-ID + +Figure 2-4 ISL and 802.1Q Frame Marking Methods + +Finally, the last row from Table 2-3 refers to the native VLAN. On trunks, 802.1Q does not tag frames sent inside the native VLAN, and assigns all received untagged frames to the native VLAN. The native VLAN feature allows a switch to attempt to use 802.1Q trunking on an interface, but if the other device does not support trunking, the traffic for that one native VLAN can still be sent over the link. By default, the native VLAN is +VLAN 1, which is also the default access VLAN. It is absolutely necessary that the native VLANs on both ends of a trunk link match; otherwise a native VLAN mismatch occurs, causing the two VLANs to effectively merge. To detect and possibly avoid any ill effects of a native VLAN mismatch, Cisco switches implement a proprietary extension to PVST+ and Rapid PVST+ that allows them to detect and block the mismatched native VLANs +on the trunk. This extension is described in more detail in Chapter 3, “Spanning Tree Protocol.” Also, Cisco Discovery Protocol (CDP) will detect and report a native VLAN mismatch. As a best practice, on each trunk, its native VLAN should be changed from VLAN 1 to a different VLAN, and this VLAN should not be used for any other purpose except being configured as a native VLAN. This prevents users from attempting a VLAN hopping attack by sending double-tagged frames that would be detagged on trunks if the top tag matches the trunk’s native VLAN. + +Detailed information about the ISL and 802.1Q tagging as implemented by Cisco can be found at Cisco.com published as a technote document called “Inter-Switch Link and IEEE 802.1Q Frame Format,” Document ID: 17056. +Chapter 2: Virtual LANs and VLAN Trunking 71 + +ISL and 802.1Q Configuration + +Cisco switches use the Dynamic Trunk Protocol (DTP) to dynamically learn whether the device on the other end of the cable wants to perform trunking and, if so, which trunk-ing protocol to use. It is meant both to ease the initial deployment of a switched network and to minimize configuration errors that result from mismatched port configuration on an interconnection between two switches. + +DTP learns whether to trunk based on the DTP mode defined for an interface. The indi-vidual DTP modes are + +■ dynamic auto: The port will negotiate the mode automatically; however, it prefers to be an access port. + +■ dynamic desirable: The port will negotiate the mode automatically; however, it pre-fers to be a trunk port. + +Out of these modes, dynamic desirable has a higher priority—if both ports are dynamic but one is configured as auto and the other as desirable, the resulting operating mode will be trunk. DTP also negotiates the type of encapsulation on the trunk should either of the two devices support both ISL and 802.1Q. If both devices support both trunk types, they will choose ISL. Should the DTP negotiation fail, any port in dynamic mode, either desirable or auto, will be operating as an access port. An upcoming section, “Trunk Configuration Compatibility,” covers the different DTP modes and their combinations in closer detail. + +Different types of Cisco switches have different default DTP modes. For example, earlier Catalyst 2950 and 3550 models default to dynamic desirable mode. Later Catalyst mod-els, such as 2960, 3560 or 3750, default to dynamic auto mode. Authoritative information pertaining to the particular switch platform and IOS version can be found in the appropri-ate Command Reference. + +While DTP and VTP are independent protocols, DTP carries the VTP domain name in its messages. Switches will successfully negotiate the link operating mode only if the +VTP domain name on both switches is the same, or one switch has no VTP domain name configured yet (that is, it uses a NULL domain name). The reason behind tying the DTP negotiation to the VTP domain name is that in different VTP domains, there might be dif-ferent sets of VLANs, and identically numbered VLANs might be used for different pur-poses (that is why the network was split into several VTP domains in the first place—to keep the VLAN databases separate and independent). As a result, switches should not try to bring up the link as a trunk, as extending VLANs from one VTP domain to another can have undesired consequences. + +With the DTP mode set to desirable, switches can simply be connected, and they should dynamically form a trunk. You can, however, configure trunking details and verify the results with show commands. Table 2-4 lists some of the key Catalyst IOS commands related to trunking. +72 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 2-4 VLAN Trunking–Related Commands Key +Topic Command Function + + +switchport | no switchport + +switchport mode ... + +switchport trunk ... + +switchport access ... + +show interfaces trunk + +show interfaces type number trunk + +show interfaces type number switchport + +Toggle defining whether to treat the interface as a switch interface (switchport) or as a routed interface (no switchport) +Sets DTP negotiation parameters + +Sets trunking parameters if the interface is trunking + +Sets nontrunking-related parameters if the interface is not trunking +Summary of trunk-related information + +Lists trunking details for a particular interface + +Lists both trunking and nontrunking details for a particular interface + + + +Figure 2-5 lists several details regarding Switch1’s trunking configuration and status, as shown in Example 2-6. R1 is not configured to trunk, so Switch1 will fail to negotiate trunking. Switch2 is a Catalyst 3550, which supports both ISL and 802.1Q, so they will negotiate trunking and use ISL. Switch3 and Switch4 are Catalyst 2950s, which support only 802.1Q; as a result, Switch1 negotiates trunking, but picks 802.1Q as the trunking protocol. While both Catalyst 3550 and 2950 are End-of-Life at the time of writing, their default port settings of dynamic desirable serve a useful example of how simply intercon-necting them results in links dynamically becoming trunks. With recent Catalyst models, such as 2960, 3560, 3750, or 3850 Series, the default setting is dynamic auto, so the same topology in Figure 2-5 equipped with any of these platforms would negotiate all connected ports to operate in access mode. + +Not Configured to Trunk + +Fa0/1 +R1 SW1 Fa0/12 + +Gi0/1 +Fa0/24 SW2 + + +Defaults to DTP Desirable Supports ISL or .1Q + + + + + +Defaults to DTP Desirable +Does Not Support ISL (2950) SW3 + +Defaults to DTP Desirable SW4 Does Not Support ISL (2950) + + +Figure 2-5 Trunking Configuration Reference for Example 2-6 +Chapter 2: Virtual LANs and VLAN Trunking 73 + +Example 2-6 Trunking Configuration and show Command Example – Switch1 + +! The administrative mode of dynamic desirable (trunking) and negotiate (trunking +! encapsulation) means that Switch1 attempted to negotiate to trunk, but the +! operational mode of static access means that trunking negotiation failed. +! The reference to "operational trunking encapsulation" of native means that +! no tagging occurs. + +Switch1# show int fa 0/1 switchport +Name: Fa0/1 +Switchport: Enabled +Administrative Mode: dynamic desirable +Operational Mode: static access +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 1 (default) +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Operational private-vlan: none +Trunking VLANs Enabled: ALL +Pruning VLANs Enabled: 2-1001 + +Protected: false +Unknown unicast blocked: disabled +Unknown multicast blocked: disabled + +Voice VLAN: none (Inactive) +Appliance trust: none + +! Next, the show int gig 0/1 trunk command shows the configured mode +! (desirable), and the current status (n-isl), meaning negotiated ISL. Note +! that the trunk supports the extended VLAN range as well. + +Switch1# show int gig 0/1 trunk + +Port Mode +Gi0/1 desirable + +Encapsulation +n-isl + +Status +trunking + +Native vlan +1 + + +Port Vlans allowed on trunk +Gi0/1 1-4094 + +Port Vlans allowed and active in management domain +Gi0/1 1,21-22 +74 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Port Vlans in spanning tree forwarding state and not pruned +Gi0/1 1,21-22 + +! Next, Switch1 lists all three trunks - the segments connecting to the other +! three switches - along with the type of encapsulation. + +Switch1# show int trunk + +Port Mode +Fa0/12 desirable +Fa0/24 desirable +Gi0/1 desirable + +Encapsulation +n-802.1q +n-802.1q +n-isl + +Status +trunking +trunking +trunking + +Native vlan +1 +1 +1 + + +Port Vlans allowed on trunk +Fa0/12 1-4094 +Fa0/24 1-4094 +Gi0/1 1-4094 + +Port Vlans allowed and active in management domain +Fa0/12 1,21-22 +Fa0/24 1,21-22 +Gi0/1 1,21-22 + +Port Vlans in spanning tree forwarding state and not pruned +Fa0/12 1,21-22 +Fa0/24 1,21-22 +Gi0/1 1,21-22 + +The possibility to configure the port to negotiate its operating mode dynamically also explains why there can be both switchport access and switchport trunk commands present on a single interface. Though confusing at first sight, these commands merely define how a port would behave if it was operating either as an access or a trunk port. Commands related to a currently unused operating mode of a port might be present but they are ignored. + +As shown in Example 2-7, on newer Catalyst platforms, the show dtp commands display the operating state of DTP globally and on individual ports. + +Example 2-7 show dtp Command Output on SW1 + +SW1# show dtp +Global DTP information +Sending DTP Hello packets every 30 seconds +Dynamic Trunk timeout is 300 seconds +12 interfaces using DTP +Chapter 2: Virtual LANs and VLAN Trunking 75 + +! The TOS/TAS/TNS stand for Trunk Operating/Administrative/Negotiation Status +! The TOT/TAT/TNT stand for Trunk Operating/Administrative/Negotiation Type +! In the following output, Fa0/12 is configured as dynamic desirable + + +SW1# show dtp interface fa0/12 +DTP information for FastEthernet0/12: +TOS/TAS/TNS: +TOT/TAT/TNT: +Neighbor address 1: +Neighbor address 2: +Hello timer expiration (sec/state): +Access timer expiration (sec/state): + + + +TRUNK/DESIRABLE/TRUNK +ISL/NEGOTIATE/ISL +00179446B30E +000000000000 +19/RUNNING +289/RUNNING + +Negotiation timer expiration (sec/state): never/STOPPED + +Multidrop timer expiration (sec/state): +FSM state: +# times multi & trunk +Enabled: +In STP: + +never/STOPPED +S6:TRUNK +0 +yes +no + + +Statistics +---------- +3 packets received (3 good) +0 packets dropped +0 nonegotiate, 0 bad version, 0 domain mismatches, +0 bad TLVs, 0 bad TAS, 0 bad TAT, 0 bad TOT, 0 other +6 packets output (6 good) +3 native, 3 software encap isl, 0 isl hardware native +0 output errors +0 trunk timeouts +2 link ups, last link up on Mon Mar 01 1993, 00:14:09 +2 link downs, last link down on Mon Mar 01 1993, 00:14:02 + + +Note Without any configuration, the default port settings on recent Catalyst switch series such as 2960, 3560, 3750, 3650, and 3850 are as follows: mode set to dynamic auto, native VLAN set to 1, access VLAN set to 1, trunk encapsulation set to auto (if both ISL and dot1q supported) or dot1q, all VLANs allowed, and VLANs 2–1001 eligible for prun-ing. On older 2950 and 3550 models, the default mode was dynamic desirable. +76 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Allowed, Active, and Pruned VLANs + +Although a trunk can support VLANs 1–4094, several mechanisms reduce the actual number of VLANs whose traffic flows over the trunk. First, VLANs can be administra-tively forbidden from existing over the trunk using the switchport trunk allowed inter-face subcommand. Also, any allowed VLANs must be configured on the switch before they are considered active on the trunk. Finally, VTP can prune VLANs from the trunk, with the switch simply ceasing to forward frames from that VLAN over the trunk. + +The show interface trunk command lists the VLANs that fall into each category, as shown in the last command in Example 2-6. The categories are summarized as follows: + + +Key ■ Topic + + +■ + + + + + +■ + +Allowed VLANs: Each trunk allows all VLANs by default. However, VLANs can be removed or added to the list of allowed VLANs by using the switchport trunk allowed command. + +Allowed and active: To be active, a VLAN must be in the allowed list for the trunk (based on trunk configuration), the VLAN must exist in the VLAN configuration on the switch, and it must be in the active state (not suspended or locally shutdown). With PVST+, an STP instance is actively running on this trunk for the VLANs in this list. + +Active and not pruned: This list is a subset of the “allowed and active” list, with any VTP-pruned VLANs and VLANs for which PVST+ considers the port Blocking +removed. + + + +Trunk Configuration Compatibility + +In most production networks, switch trunks are configured using the same standard throughout the network. For example, rather than allow DTP to negotiate trunking, many engineers configure trunk interfaces to always trunk (switchport mode trunk) and dis-able DTP on ports that should not trunk. IOS includes several commands that impact whether a particular segment becomes a trunk. Because many enterprises use a typical standard, it is easy to forget the nuances of how the related commands work. This section covers those small details. + +Two IOS configuration commands impact if and when two switches form a trunk. The switchport mode and switchport nonegotiate interface subcommands define whether DTP even attempts to negotiate a trunk, and what rules it uses when the attempt is made. Additionally, the settings on the switch ports on either side of the segment dictate wheth-er a trunk forms or not. + +Table 2-5 summarizes the trunk configuration options. The first column suggests the con-figuration on one switch, with the last column listing the configuration options on the other switch that would result in a working trunk between the two switches. +Chapter 2: Virtual LANs and VLAN Trunking 77 + +Table 2-5 Trunking Configuration Options That Lead to a Working Trunk Key +Topic Configuration Short Name Meaning To Trunk, Command on Other Side One Side Must Be +1 + +switchport mode trunk + +switchport mode trunk; switchport nonegotiate + +switchport mode dynamic desirable + + +switchport mode dynamic auto + +switchport mode access + + + +switchport mode access; switchport nonegotiate + +Trunk + + +Nonegotiate + + + +Desirable + + + +Auto + + +Access + + + + +Access (with nonegotiate) + +Always trunks on this end; sends DTP to help other side choose to trunk +Always trunks on this end; does not send nor process DTP messages (good when other switch is a non-Cisco switch) +Sends DTP messages indicating dynamic mode with preferred trunking, and trunks if negotiation succeeds +Sends DTP messages indicating dynamic mode with preferred access, and trunks if negotiation succeeds +Never trunks; can send a single DTP message when entering the access mode to help other side reach same conclusion, ceases to send and process DTP messages afterward +Never trunks; does not send or process DTP messages + +On, desirable, auto + +On + + + +On, desirable, auto + + +On, desirable + + +(Never trunks) + + + + +(Never trunks) + + +1 When the switchport nonegotiate command is not listed in the first column, the default (DTP negotia-tion is active) is assumed. + + +Note If an interface trunks, the type of trunking (ISL or 802.1Q) is controlled by the setting on the switchport trunk encapsulation command if the switch supports multiple trunk encapsulations. This command includes an option for dynamically negotiating the type (using DTP) or configuring one of the two types. +Also, for DTP negotiation to succeed, both switches must either be configured with the same VTP domain name, or at least one switch must have its VTP domain name unconfig-ured (that is, NULL). + + + +Configuring Trunking on Routers + +VLAN trunking can be used on routers and hosts as well as on switches. However, rout-ers do not support DTP, so you must manually configure them to support trunking. Additionally, you must manually configure a switch on the other end of the segment to trunk, because the router does not participate in DTP. +78 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The majority of router trunking configurations use subinterfaces, with each subinter-face being associated with one VLAN. The subinterface number does not have to match the VLAN ID; rather, the encapsulation command sits under each subinterface, with the associated VLAN ID being part of the encapsulation command. Use subinterface numbers starting with 1; the subinterface number 0 is the physical interface itself (for example, interface Fa0/0.0 is the Fa0/0 itself). Also, because good design calls for one IP subnet per VLAN, if the router wants to forward IP packets between the VLANs, the router needs to have an IP address associated with each trunking subinterface. + +You can configure 802.1Q native VLANs under a subinterface or under the physical inter-face on a router. If they are configured under a subinterface, you use the encapsulation dot1q vlan-id native subcommand, with the inclusion of the native keyword meaning that frames exiting this subinterface should not be tagged, and incoming untagged frames shall be processed by this subinterface. As with other router trunking configurations, +the associated IP address would be configured on that same subinterface. Alternately, if not configured on a subinterface, the router assumes that the native VLAN is associated with the physical interface. In this case, the encapsulation command is not needed nor supported under the physical interface; the associated IP address, however, would need to be configured under the physical interface. Configuring an (understandably distinct) IP address on both physical interface and a subinterface under the same physical interface using encapsulation dot1q vlan-id native, thereby technically resulting in two differ- +ent interfaces for the native VLAN, is not supported. All incoming untagged frames will be processed by the subinterface configuration only. A notable exception to this rule can be seen on ISR G1 routers equipped with 10-Mbps Ethernet built-in interfaces. On these router platforms, settings for the native VLAN shall be configured on the physical Ethernet interface directly. While the router will accept the configuration of a subinter-face with the encapsulation dot1q vlan-id native command, incoming untagged frames will be processed by the configuration of the physical interface. This exception applies only to ISR platforms with 10-Mbps Ethernet interfaces, and is not present on platforms with Fast Ethernet or faster interfaces. + +If the router supports native VLAN configuration on a subinterface, it is recommended to use subinterfaces instead of putting the native VLAN configuration on a physical port. Aside from keeping the configuration more consistent (all configuration being placed +on subinterfaces), this configuration allows the router to correctly process frames that, despite being originated in the native VLAN, carry an 802.1Q tag. Tagging such frames is done when using the CoS field inside an 802.1Q tag. If the native VLAN configuration was done on a physical interface, the router would not be able to recognize that a frame carrying an 802.1Q tag with a nonzero VLAN ID is really a CoS-marked frame in the native VLAN. When using subinterfaces, the encapsulation dot1q vlan-id native com-mand allows the router to recognize that both untagged frames and CoS-marked frames tagged with the particular vlan-id should be processed as frames in the native VLAN. + +Example 2-8 shows an example configuration for Router1 in Figure 2-1, both for ISL and 802.1Q. In this case, Router1 needs to forward packets between the subnets on VLANs 21 and 22. The first part of the example shows ISL configuration, with no native VLANs, and therefore only a subinterface being used for each VLAN. The second part of the example shows an alternative 802.1Q configuration, using the option of placing the native VLAN (VLAN 21) configuration on the physical interface. +Chapter 2: Virtual LANs and VLAN Trunking 79 + +Example 2-8 Trunking Configuration on Router1 Key +Topic ! Note the subinterface on the Fa0/0 interface, with the encapsulation +! command noting the type of trunking, as well as the VLAN number. The subinterface +! number does not have to match the VLAN ID. Also note the IP addresses for +! each interface, allowing Router1 to route between VLANs. +! The encapsulation command must be entered on a subinterface before entering any +! other IP-related commands, such as configuring an IP address. + +Router1(config)# interface fa0/0 +Router1(config-if)# no shutdown +Router1(config-if)# interface fa0/0.1 +Router1(config-subif)# encapsulation isl 21 +Router1(config-subif)# ip address 10.1.21.1 255.255.255.0 +Router1(config-subif)# interface fa0/0.2 +Router1(config-subif)# encapsulation isl 22 +Router1(config-subif)# ip address 10.1.22.1 255.255.255.0 + +! Next, an alternative 802.1Q configuration is shown. Note that this configuration +! places the IP address for VLAN 21 on the physical interface; the router simply +! associates the physical interface with the native VLAN. Alternatively, +! a subinterface could be used, with the encapsulation dot1q 21 native command +! specifying that the router should treat this VLAN as the native VLAN. + +Router1(config)# interface fa0/0 +Router1(config-if)# ip address 10.1.21.1 255.255.255.0 +Router1(config-if)# no shutdown +Router1(config-if)# interface fa0/0.2 +Router1(config-subif)# encapsulation dot1q 22 +Router1(config-subif)# ip address 10.1.22.1 255.255.255.0 + +Note also that the router does not have an explicitly defined allowed VLAN list on an interface. However, the allowed VLAN list is implied based on the configured VLANs. For example, in this example, when using ISL, Router1 allows VLANs 21 and 22, while when using 802.1Q, it allows the native VLAN and VLAN 22. + +802.1Q-in-Q Tunneling + +Traditionally, VLANs have not extended beyond the WAN boundary. VLANs in one cam-pus extend to a WAN edge router, but VLAN protocols are not used on the WAN. + +Today, several emerging alternatives exist for the passage of VLAN traffic across a WAN, including 802.1Q-in-Q, its standardized version 802.1ad called Provider Bridges, another standard 802.1ah called Provider Backbone Bridges, Layer2 Tunneling Protocol (L2TPv3), +80 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Ethernet over MPLS (EoMPLS), and VLAN Private LAN Services (VPLS). While these topics are more applicable to the CCIE Service Provider certification, you should at least know the concept of 802.1 Q-in-Q tunneling. + +Also known as Q-in-Q on Catalyst switches, 802.1Q-in-Q allows an SP to preserve 802.1Q VLAN tags across a WAN service. By doing so, VLANs actually span multiple geographically dispersed sites. Figure 2-6 shows the basic idea. + + + + + +Eth. VLAN Header ID 100 + + + + + +Data + +SP: +Customer1: VLAN 5 Customer2: VLAN 6 + +Eth. VLAN Header ID 100 + + + + + +Data + + + + + +C1-SW1 +VLANs 100-199 + +Eth. VLAN VLAN Header ID 5 ID 100 + + +Data +C1-SW2 + +SP-SW1 SP-SW2 + + + +C2-SW1 +VLANs 100-500 + +Eth. VLAN VLAN Header ID 6 ID 100 + + +Data C2-SW2 + + + +Eth. VLAN Header ID 100 + + +Data + +Eth. VLAN Header ID 100 + + +Data + + +Figure 2-6 Q-in-Q: Basic Operation + +The ingress SP switch takes the 802.1Q frame, and then tags each frame entering the interface with an additional 802.1Q header, called the S-tag (the original customer tags are called C-tags and are not modified nor processed). In this case, all of Customer1’s frames are tagged as VLAN 5 as they pass over the WAN; Customer2’s frames are tagged with VLAN 6. After removing the S-tag at egress, the customer switch sees the original 802.1Q frame with the C-tag intact, and can interpret the VLAN ID correctly. The receiv- +ing SP switch (SP-SW2 in this case) can keep the various customers’ traffic separate based on the additional VLAN S-tags. + +Notice that if the trunk between SP-SW1 and SP-SW2 used VLAN 5 as the native VLAN, frames coming from Customer1 would not have an S-tag added on this trunk. As a result, they would be received by SP-SW2 tagged only with the C-tag, and would be processed in the VLAN indicated in the C-tag instead of VLAN 5. This could result in Customer1’s traffic leaking out to another customer, or to be otherwise misforwarded or blackholed. To prevent this, SP’s switches are usually configured with vlan dot1q tag native command to essentially deactivate the concept of native VLAN, and to tag all frames on trunks regardless of the native VLAN setting. +Chapter 2: Virtual LANs and VLAN Trunking 81 + +Using Q-in-Q, an SP can offer VLAN services, even when the customers use overlapping VLAN IDs. Customers get more flexibility for network design options, particularly with metro Ethernet services. Plus, CDP and VTP traffic can be configured to pass transpar-ently over the Q-in-Q service. + +On Catalyst switches, the Q-in-Q is supported on 3550 and higher platforms. Example 2-9 shows the configuration, which is relatively straightforward. + +Key Example 2-9 Q-in-Q Configuration Example on a Catalyst 3560 +Topic ! It is assumed that C1-SW1 and C1-SW2 have their ports towards SP-SW1 configured +! as ordinary 802.1Q trunks. On SP-SW1, the vlan dot1q tag native is used to +! force tagging on all VLANs including native VLAN on trunks. Also, because +! a customer's C-tagged frame may already contain 1500 bytes in its payload, this +! payload including the C-tag is considered a new payload in the S-tagged frame, +! and thus may grow up to 1504 bytes. Therefore, the MTU of the resulting frames +! is increased to 1504 bytes using the system mtu commands. Their use must also +! be carefully matched by neighboring devices. + +SP-SW1(config)# vlan dot1q tag native +SP-SW1(config)# system mtu 1504 ! Applies to 100Mbps interfaces +SP-SW1(config)# system mtu jumbo 1504 ! Applies to 1Gbps and 10Gbps interfaces +! +SP-SW1(config)# vlan 5 +SP-SW1(config-vlan)# name Customer1 +SP-SW1(config-vlan)# exit +SP-SW1(config)# vlan 6 +SP-SW1(config-vlan)# name Customer2 +SP-SW1(config-vlan)# exit + +! The Fa0/24 interface connects to SP-SW2. This interface is configured as an +! ordinary trunk port + +SP-SW1(config)# interface FastEthernet0/24 +SP-SW1(config-if)# switchport trunk encapsulation dot1q +SP-SW1(config-if)# switchport mode trunk + +! The Fa0/1 interface connects to C1-SW1. Here, apart from 802.1Q-in-Q tunneling, +! the switch is also configured to tunnel selected Layer2 management protocols. +! To assign all Customer1's traffic to SP's VLAN 5, switchport access vlan 5 is ! used. + +SP-SW1(config)# interface FastEthernet0/1 +SP-SW1(config-if)# switchport mode dot1q-tunnel +SP-SW1(config-if)# switchport access vlan 5 +82 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +SP-SW1(config-if)# l2protocol-tunnel cdp +SP-SW1(config-if)# l2protocol-tunnel lldp +SP-SW1(config-if)# l2protocol-tunnel stp +SP-SW1(config-if)# l2protocol-tunnel vtp + +! The Fa0/2 interface connects to C2-SW1. This is the basic 802.1Q-in-Q tunneling +! configuration without any Layer2 management protocol tunneling + +SP-SW1(config)# interface FastEthernet0/2 +SP-SW1(config-if)# switchport mode dot1q-tunnel +SP-SW1(config-if)# switchport access vlan 6 + +! The show interfaces Fa0/1 switchport shows that the interface is operating +! in QinQ tunneling mode. The show vlan (not shown here for brevity) would display +! the Fa0/1 in the Customer1 VLAN just like an ordinary access port. + +SP-SW1# show interfaces fa0/1 switchport +Name: Fa0/1 +Switchport: Enabled +Administrative Mode: tunnel +Operational Mode: tunnel +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: Off +Access Mode VLAN: 5 (Customer1) +Trunking Native Mode VLAN: 1 (default) +Administrative Native VLAN tagging: enabled +Voice VLAN: none +Administrative private-vlan host-association: none +Administrative private-vlan mapping: none +Administrative private-vlan trunk native VLAN: none +Administrative private-vlan trunk Native VLAN tagging: enabled +Administrative private-vlan trunk encapsulation: dot1q +Administrative private-vlan trunk normal VLANs: none +Administrative private-vlan trunk associations: none +Administrative private-vlan trunk mappings: none +Operational private-vlan: none +Trunking VLANs Enabled: ALL +Pruning VLANs Enabled: 2-1001 +Capture Mode Disabled +Capture VLANs Allowed: ALL + +Protected: false +Unknown unicast blocked: disabled +Chapter 2: Virtual LANs and VLAN Trunking 83 + +Unknown multicast blocked: disabled +Appliance trust: none +SP-SW1# + + +VLAN Trunking Protocol + +VTP advertises VLAN configuration information to neighboring switches so that the VLAN configuration can be made on one switch, with all the other switches in the domain learning the VLAN information dynamically. VTP advertises the VLAN ID, VLAN name, and VLAN type and state for each VLAN. However, VTP does not adver-tise any information about which ports (interfaces) should be in each VLAN, so the con-figuration to associate a switch interface with a particular VLAN (using the switchport access vlan command) must still be configured on each individual switch. + +The VTP protocol exists in three versions. VTPv1 and VTPv2 are widely supported across the CatOS and IOS-based switching platforms. VTPv3 support on IOS-based switches is, at the time of writing, relatively new. On entry-level Catalyst switches, VTPv3 is supported starting with IOS Release 12.2(52)SE. + +VTPv1 is the default VTP version supported and active on enterprise IOS-based switches. It supports disseminating of normal-range VLANs only. + +VTPv2 enhancements include the following: + +■ Support for Token Ring Concentrator Relay Function and Bridge Relay Function (TrCRF and TrBRF) type VLANs: These VLANs were used to segment a Token Ring network into multiple logical rings and interconnecting bridges. There is no use for them in Ethernet-based networks. + +■ Support for unknown Type-Length-Value (TLV) records: VTP messages can con-tain additional information elements stored as TLV records. A switch running VTPv1 would drop all unrecognized TLVs from received messages, not propagating them farther to neighboring switches. VTPv2-enabled switches keep all TLVs in propa-gated messages even if they are not recognized. + +■ Optimized VLAN database consistency checking: In VTPv1, VLAN database consistency checks are performed whenever the VLAN database is modified, either through CLI, SNMP, or VTP. In VTPv2, these consistency checks are skipped if the change was caused by a received VTP message, as the message itself was originated as a result of a CLI or SNMP action that must already have been sanitized. This is really just an implementation optimization. + +There is ongoing confusion regarding the VTP transparent mode. The IOS documenta-tion for earlier Catalyst series appeared to suggest that VTPv1 switches in transparent mode forward VTP messages only if their version and domain match the settings on the transparent switch, while VTPv2 transparent switches allegedly forward VTP messages regardless of their domain and version. Documentation to recent Catalyst switches is less +84 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +clear, but it states that both VTPv1 and VTPv2 transparent switches check the domain and only forward the message if its domain matches the domain configured on the trans-parent switch. + +In reality, experiments performed on multiple Catalyst switch types that supported both VTPv1 and VTPv2 show that, regardless of the activated VTP version, a transparent switch whose VTP domain was NULL (that is, unconfigured) forwarded all VTP messages happily. A transparent switch with a configured domain forwarded VTP messages only if their domain matched. + +VTPv3 differs from VTPv2 in the following aspects: + +■ The server role has been modified: There are two server types in VTPv3: primary and secondary. A primary server is allowed to modify VTP domain contents, and there can be at most one primary server per VTP domain at any time. A secondary server (often called just a server) is not allowed to modify VTP domain contents, but it can be promoted to the role of primary server, retaking the role from the existing primary server if it exists. Ownership of the primary server role is a runtime state that is not stored in the configuration; instead, it is requested in the privileged EXEC mode if necessary. This modification significantly reduces the probability of unin-tended modification of the VLAN database, as it is not possible to modify the data-base contents without the concerted effort of making a switch the primary server. + +■ VTPv3 password storage and usage has been improved: The VTP password can be stored in an encrypted form that cannot be displayed back as plaintext. While this encrypted string can be carried over to a different switch to make it a valid member of the domain, the promotion of a secondary server into the primary server role will require entering the password in its plaintext form. + +■ VTPv3 is capable of distributing information about the full range of VLANs including Private VLANs: With VTPv3, it is not necessary to use Transparent mode when using extended-range VLANs and Private VLANs. Pruning, however, still applies only to normal-range VLANs, even in VTPv3. + +■ VTPv3 supports the off mode in which the switch does not participate in VTPv3 operations and drops all received VTP messages: It is also possible to deactivate VTP on a per-trunk basis. + +■ VTPv3 is a generalized mechanism for distributing contents of an arbitrary database, and is not limited to synchronizing VLAN information over a set of switches: As an example, VTPv3 is also capable of distributing and synchronizing the MST region configuration among all switches in a VTP domain. + +Each Cisco switch uses one of four VTP modes, as outlined in Table 2-6. +Chapter 2: Virtual LANs and VLAN Trunking 85 + + +Table 2-6 VTP Modes and Features Key +Topic Function + + + +Server Client Mode Mode + + + +Transparent Off Mode Mode* + +Originates VTP advertisements Yes Yes No No + +Processes received advertisements to update Yes Yes No No its VLAN configuration +Forwards received VTP advertisements Yes Yes Yes No + +Saves VLAN configuration in NVRAM or Yes Yes Yes Yes vlan.dat +Can create, modify, or delete VLANs using Yes No Yes Yes configuration commands + +* The Off mode is supported only with VTPv3. + +VTPv1 and VTPv2 use four types of messages: Key +Topic ■ Summary Advertisement: This message is originated by VTP Server and Client +switches every 5 minutes and, in addition, after each modification to the VLAN database. This message carries information about VTP domain name, revision num-ber, identity of the last updater, time stamp of the last update, MD5 sum computed over the contents of the VLAN database and the VTP password (if configured), and the number of Subset Advertisement messages that optionally follow this Summary Advertisement. Summary Advertisement messages do not carry VLAN database contents. + +■ Subset Advertisement: This message is originated by VTP Server and Client switch-es after modifying the VLAN database. Subset Advertisements carry full contents of the VLAN database. One Subset Advertisement can hold multiple VLAN database entries. However, multiple Subset Advertisements might be required if the VLAN database is large. + +■ Advertisement Request: This message is originated by VTP Server and Client switches to request their neighbors send the complete VLAN database or a part of it. Advertisement requests are sent when a VTP Client switch is restarted, when a switch enters the Client mode, or when a Server or Client switch receives a Summary Advertisement with a higher revision number than its own. + +■ Join: This message is originated by each VTP Server and Client switch periodically every 6 seconds if VTP Pruning is active. Join messages contain a bit field that, for each VLAN in the normal range, indicates whether it is active or unused (that is, pruned). + +At press time, the details about VTPv3 message types were not made public. +86 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Note In any VTP version, VTP messages are transmitted and accepted only on trunk ports. Access ports neither send nor accept VTP messages. For two switches to communi-cate in VTP, they must first be interconnected through a working trunk link. + + + +VTP Process and Revision Numbers + +Let us first have a look at the VTPv1 and VTPv2 update process. Differences in VTPv3 will be explained later. + +In VTPv1 and VTPv2, the update process begins when a switch administrator, from a VTP server switch, adds, deletes, or updates the configuration for a VLAN. When the new configuration occurs, the VTP server increments the old VTP revision number by 1 and advertises the entire VLAN configuration database along with the new revision number. + +The VTP revision number concept allows switches to know when VLAN database chang-es have occurred. Upon receiving a VTP update, if the revision number in a received VTP update is larger than a switch’s current revision number, it believes that there is a new ver-sion of the VLAN database. Figure 2-7 shows an example in which the old VTP revision number was 3; the server adds a new VLAN (incrementing the revision number to 4), and then propagates the VTP database to the other switches. + + + +Key Topic + +1 Add New VLAN +2 Rev 3 Rev 4 + + + + + + +3 Send VTP Advertisement VTP Server + +VTP client + +4 Rev 3 Rev 4 +5 Sync New VLAN Info + +3 Send VTP Advertisement + +VTP Client + +4 Rev 3 Rev 4 +5 Sync New VLAN Info + + +Figure 2-7 VTP Revision Number Basic Operation + +Cisco switches default to use VTP server mode, but they do not start sending VTP updates until the switch has been configured with a VTP domain name. At that point, +the server begins to send its VTP updates, with an updated database and revision number each time its VLAN configuration changes. However, the VTP clients in Figure 2-7 actu-ally do not have to have the VTP domain name configured. If not configured yet, the cli-ent will assume that it should use the VTP domain name in the first received VTP update. However, the client does need one small bit of configuration, namely, the VTP mode, as configured with the vtp mode global configuration command. As a side note, switches +Chapter 2: Virtual LANs and VLAN Trunking 87 + +must of course be interconnected with trunk links, as VTP messages are exchanged only over trunks. + +VTP clients and servers alike will accept VTP updates from other VTP server and client switches. For better availability, a switched network using VTP needs at least two VTP server switches. Under normal operations, a VLAN change could be made on one server switch, and the other VTP server (plus all the clients) would learn about the changes to the VLAN database. Once learned, both VTP servers and clients store the VLAN con-figuration in their respective vlan.dat files in flash memory; they do not store the VLAN configuration in NVRAM. + +With multiple VTP servers installed in a LAN, it is possible to accidentally overwrite the VTP configuration in the network. If trunks fail and then changes are made on more than one VTP server, the VTP configuration databases could differ, with different configura-tion revision numbers. When the formerly separated parts of the LAN reconnect using trunks, the VTP database with a higher revision number is propagated throughout the VTP domain, replacing some switches’ VTP databases. Note also that because VTP cli-ents can actually originate VTP updates, under the right circumstances, a VTP client can update the VTP database on another VTP client or server. In summary, for a newly con-nected VTP server or client to change another switch’s VTP database, the following must be true: + +■ The new link connecting the new switch is trunking. + +■ The new switch has the same VTP domain name as the other switches. + +■ The new switch’s revision number is higher than that of the existing switches. + +■ The new switch must have the same password, if configured on the existing switches. + +To protect a VTP domain from being joined by unauthorized switches, use VTP pass-words. VTP Summary Advertisements carry an MD5 hash computed over the VLAN database contents and the VTP password if configured. After receiving an update to the VLAN database in the form of a Summary Advertisement and at least one Subset Advertisement, the receiving switch computes its own MD5 hash over the contents of the VLAN database reconstituted from these messages and its own VTP password, and compares it to the MD5 hash value indicated in the Summary Advertisement. For these MD5 hash values to match, the sending and receiving switch must be using the same VTP password and the messages must be genuine (that is, not changed or tampered with during transit). Contrary to the popular belief, the MD5 hash present in Summary Advertisements is not computed from the VTP password alone. Also, the MD5 hash— being present only in Summary Advertisements—is not used to protect VTP messages themselves. Some installations simply use VTP transparent or off mode on all switches, which prevents switches from ever listening to other switches’ VTP updates and errone-ously modifying their VLAN configuration databases. +88 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + + + + + + + + + + + + + + + + + + +Key Topic + +VTPv3 addresses the problem of inadvertent (or intentional) rewrite of a VLAN database by introducing the concept of a primary server. A primary server is the only switch +in a VTPv3 domain whose VLAN database can be propagated throughout the domain. VTPv3 servers and clients will share their VLAN database only if they agree both on the domain name and on the identity of a primary server (given by its base MAC address). Also, a primary server is the only switch that allows an administrator to perform modifi-cations to the VLAN database. + +Other VTPv3 switches configured as servers are called secondary servers. Unlike VTPv1/VTPv2 servers, secondary servers in VTPv3 do not permit an administrator to modify the VLAN database; rather, they are only eligible to be promoted to the role of a primary server, taking over this role from the existing primary server if present. Clients in VTPv3 neither allow an administrator to modify the VLAN database nor are eligible to be promoted to the primary server role. Both secondary servers and clients store a +copy of the primary server’s VLAN database and will share it with their neighboring serv-ers and clients that agree on the identity of the primary server. This means that even in VTPv3, a secondary server or a client switch with a higher revision number can overwrite a neighbor’s VLAN database, but for this to occur, these switches must first match on the domain name, primary server’s identity, and VTP password. + +The state of two or more server or client switches in a VTPv3 domain having different opinions about the identity of a primary server is called a conflict. Conflicting switches do not synchronize their VLAN databases even if all other VTP parameters match. This concept of a conflict is at the core of VTPv3’s improved resiliency against inadvertent VLAN database overwrites. Because changes to the VLAN database can only be per-formed on a primary server, switches that agree on the primary server’s identity also immediately share the primary server’s database. If a switch is disconnected from the network, unless it is the primary server itself, its VLAN database can be modified only if that switch is promoted to a primary server while disconnected. After this switch is con-nected back to the network, its idea of the primary server’s identity does not match its neighbors’ knowledge about the primary server; that is, a conflict exists. Therefore, even if its revision number is higher, its VLAN database will not be accepted by its neighbors. This way, the possibility of inadvertent VLAN database overwrites is greatly reduced, though not completely avoided. + +There can be at most one primary server in a VTPv3 domain. Only switches configured as VTPv3 servers can be promoted to the role of a primary server, and the promotion is always performed in the privileged EXEC mode by invoking the vtp primary command. The state of a primary server is therefore a volatile runtime state that cannot be perma-nently stored in the configuration. After a primary server is reloaded, it comes back only as a secondary server again. A switch newly promoted to the role of a primary server using the vtp primary command will flood its VLAN database to its neighbors, and they will install and flood it further even if the new primary server’s revision number is lower. This way, the new primary server’s database is asserted over the VTP domain. + +With VTPv3, it is no longer possible to reset the configuration revision number to 0 by setting the switch to the transparent mode and back. The revision number will be reset to +0 only by modifying the VTP domain name or by configuring a VTP password. +Chapter 2: Virtual LANs and VLAN Trunking 89 + +If a VTPv3 switch detects an older switch running VTPv1 or VTPv2 on its port, it will revert to VTPv2 operation on that port, forcing the older switch to operate in VTPv2 mode. Cooperation between VTPv3 and VTPv1-only switches is not supported. + +VTP Configuration + +VTP sends updates out all active trunk interfaces (ISL or 802.1Q) by default. However, with all default settings from Cisco, switches are in server mode, with no VTP domain name configured, and they do not send any VTP updates. Before any switches can learn VLAN information from another switch, a working trunk must interconnect them, and at least one switch must have a bare-minimum VTP server configuration—specifically, a domain name. + +Example 2-10 shows Switch3 configuring a VTP domain name to become a VTP server and advertise the VLANs it has configured. The example also lists several key VTP show commands. (Note that the example begins with VLANs 21 and 22 configured on Switch3, and all default settings for VTP on all four switches. Also keep in mind that the output of various show commands can differ from this example depending on your IOS version and VTP version supported/activated.) + +Example 2-10 VTP Configuration and show Command Example + +! First, Switch3 is configured with a VTP domain ID of CCIE-domain. + +Switch3# conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch3(config)# vtp domain CCIE-domain +Changing VTP domain name from NULL to CCIE-domain + +! Next, on Switch1, the VTP status shows the same revision as Switch3, and it +! learned the VTP domain name CCIE-domain. Note that Switch1 has no VTP-related +! configuration, so it is a VTP server; it learned the VTP domain name from ! Switch3. + + +Switch1# show vtp status +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID + + +: 1 to 3 +: 1 +: CCIE-domain +: Disabled +: Disabled +: 0023.ea41.ca00 + +Configuration last modified by 10.1.1.3 at 9-9-13 13:31:46 +Local updater ID is 10.1.1.1 on interface Vl1 (lowest numbered VLAN interface found) +90 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Feature VLAN: +-------------- +VTP Operating Mode +Maximum VLANs supported locally +Number of existing VLANs +Configuration Revision +MD5 digest + + + +: Server +: 1005 +: 7 +: 2 +: 0x0E 0x07 0x9D 0x9A 0x27 0x10 0x6C 0x0B +0x0E 0x35 0x98 0x1E 0x2F 0xEE 0x88 0x88 + + +! The show vlan brief command lists the VLANs learned from Switch3. + +Switch1# show vlan brief +VLAN Name Status Ports +---- -------------------------------- --------- ------------------------------- + +1 default + + + + + +21 VLAN0021 +22 ccie-vlan-22 + +active Fa0/1, Fa0/2, Fa0/3, Fa0/4 +Fa0/5, Fa0/6, Fa0/7, Fa0/10 +Fa0/11, Fa0/13, Fa0/14, Fa0/15 +Fa0/16, Fa0/17, Fa0/18, Fa0/19 +Fa0/20, Fa0/21, Fa0/22, Fa0/23 +Gi0/2 +active +active + + + +1002 fddi-default +1003 token-ring-default +1004 fddinet-default +1005 trnet-default + +act/unsup +act/unsup +act/unsup +act/unsup + + +Example 2-11 shows examples of a few VTP configuration options. Table 2-7 provides a list of the most used options, along with explanations. + +Table 2-7 VTP Global Configuration Options +Key +Topic Option Meaning + +domain + + +password + +Sets the name of the VTP domain. Received VTP messages are ignored if the domain name indicated in these messages does not match the receiving switch’s domain name. A switch can be a member of a single domain only. +Sets the password to prevent unauthorized switches from joining the domain. The password is taken into account when generating the MD5 hash of the VLAN database. Received VTP updates are ignored if the passwords on the sending +and receiving switch do not match. If VTPv3 is used, the password can also be specified as hidden, meaning that the password will never be displayed in plaintext in the show vtp password output. The secret keyword is used when entering the password in an already encrypted form. +Chapter 2: Virtual LANs and VLAN Trunking 91 + + + +Option mode + +version + + +pruning + + +interface + +Meaning +Sets server, client, or transparent mode on the switch. If VTPv3 is supported, it is also possible to set the off mode, effectively disabling VTP on the switch. +Sets VTP version. Configuring the version 1 or 2 on a server switch applies to all switches in the domain. VTPv3 has to be configured manually on each switch. Prior to activating version 3, the switch must use a non-NULL domain name. +Enables VTP pruning, which prevents flooding on a per-VLAN basis to switches that do not have any ports configured as members of that VLAN. Regardless of the VTP version, the pruning applies only to normal-range VLANs. +Specifies the interface whose IP address is used to identify this switch as an updater in VTP updates. By default, a configured IP address from the lowest numbered VLAN SVI interface will be used. + + + +Example 2-11 shows the use of VTPv3. Differences in running VTPv3 are most visible in the need of designating a selected switch as the primary server using the vtp primary command before changes to the VLAN database can be performed on it, and in the way VTP passwords are used. While not shown in the following example, VTPv3 can also be deactivated either globally on the switch using the vtp mode off command, or on a per-interface basis using the simple no vtp command (the status of VTP on individual inter-faces can be conveniently verified using the show vtp interface command). It is worth +noting that after changing the VTP mode from off to any other mode, all existing VLANs except those hardwired into IOS (1, 1002–1005) will be deleted. + +Example 2-11 Use of VTPv3 Example + +! To use VTPv3, each switch has to be configured individually for version 3 opera- +! tion. It is assumed that all four switches have been converted to VTPv3. Switches +! 1 and 2 are configured as VTP servers, switches 3 and 4 are configured as VTP +! clients. Only the Switch3 configuration is shown here for brevity purposes. + +Switch3(config)# vtp version 3 +Switch3(config)# +Sep 9 15:49:34.493: %SW_VLAN-6-OLD_CONFIG_FILE_READ: Old version 2 VLAN configura-tion file detected and read OK. Version 3 +files will be written in the future. +Switch3(config)# vtp mode client +Setting device to VTP Client mode for VLANS. + +! An attempt to create a new VLAN on Switch1 will fail, as the Switch1 has not yet +! been promoted to the role of primary server. The example also shows how to +! promote it, and subsequently create the VLAN without further obstacles. The "No +92 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! conflicting VTP3 devices found." statement means that all switches in the VTP +! domain agree on the identity of the current primary server and thus share its +! VLAN database. + +Switch1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch1(config)# vlan 23 +VTP VLAN configuration not allowed when device is not the primary server for vlan database. +Switch1(config)# do vtp primary +This system is becoming primary server for feature vlan +No conflicting VTP3 devices found. +Do you want to continue? [confirm] +Switch1(config)# +Sep 9 17:06:59.332: %SW_VLAN-4-VTP_PRIMARY_SERVER_CHG: 0023.ea41.ca00 has become the primary server for the VLAN VTP feature +Switch1(config)# vlan 23 +Switch1(config-vlan)# name ccie-vlan-23 +Switch1(config-vlan)# exit + +! On Switch3, the show vtp status shows: + +Switch3(config)# do show vtp status + +VTP Version capable +VTP version running +VTP Domain Name +VTP Pruning Mode +VTP Traps Generation +Device ID + +Feature VLAN: +-------------- +VTP Operating Mode +Number of existing VLANs + +: 1 to 3 +: 3 +: CCIE-domain +: Disabled +: Disabled +: 0023.ea93.8e80 + + + +: Client +: 8 + +Number of existing extended VLANs : 0 + +Maximum VLANs supported locally +Configuration Revision +Primary ID +Primary Description +MD5 digest + + + +Feature MST: +-------------- +VTP Operating Mode + +: 255 +: 2 +: 0023.ea41.ca00 +: Switch1 +: 0x2A 0x42 0xC5 0x50 0x4B 0x9C 0xB6 0xDE +0x17 0x8E 0xE0 0xB6 0x2E 0x67 0xA4 0x9C + + + + +: Transparent +Chapter 2: Virtual LANs and VLAN Trunking 93 + +Feature UNKNOWN: +-------------- +VTP Operating Mode : Transparent + +! Trying to promote the Switch3 to the role of primary server would fail, as it is +! configured to operate as a client: + +Switch3(config)# do vtp primary +System can become primary server for Vlan feature only when configured as a server + +! The password handling in VTPv3 has been improved. The password can be configured +! as being hidden, in which case it will never be displayed again in plaintext: + +Switch1(config)# vtp password S3cr3tP4ssw0rd hidden +Setting device VTP password +Switch1(config)# do show vtp password +VTP Password: 8C70EFBABDD6EC0300A57BE402409C48 + +! This string can be used to populate the password setting on other switches +! without ever knowing the plaintext form, e.g.: + +Switch2(config)# vtp password 8C70EFBABDD6EC0300A57BE402409C48 secret +Setting device VTP password + +! After the password is configured in the secret form (or originally configured in +! the plain form and marked hidden), any attempt to promote a switch to the primary +! server role will require entering the password in the plaintext form into the +! CLI. Without knowing the plaintext form of the password, it is not possible to +! designate a switch as a primary server: + +Switch2(config)# do vtp primary +This system is becoming primary server for feature vlan +Enter VTP Password: +Password mismatch +Switch2(config)# do vtp primary +This system is becoming primary server for feature vlan +Enter VTP Password: +No conflicting VTP3 devices found. +Do you want to continue? [confirm] +Switch2(config)# +Sep 9 17:10:42.215: %SW_VLAN-4-VTP_PRIMARY_SERVER_CHG: 0017.9446.b300 has become the primary server for the VLAN VTP feature +94 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Normal-Range and Extended-Range VLANs + +Because of historical reasons, some VLAN numbers are considered to be normal, where-as some others are considered to be extended. Normal-range VLANs are VLANs 1–1005, and can be advertised through VTP versions 1 and 2. These VLANs can be configured both in VLAN database mode and in global configuration mode, with the details being stored in the vlan.dat file in Flash. + +Extended-range VLANs range from 1006–4094, inclusive. However, if using VTPv1 or VTPv2, these additional VLANs cannot be configured in VLAN database mode, nor stored in the vlan.dat file, nor advertised through VTP. In fact, to configure them, the switch must be in VTP transparent mode. (Also, you should take care to avoid using VLANs 1006–1024 for compatibility with CatOS-based switches.) VTPv3 removes these limitations: Both normal- and extended-range VLANs can be advertised by VTPv3. Also, with VTPv3, information about all VLANs is again stored in the vlan.dat file in Flash. + +Both ISL and 802.1Q support extended-range VLANs today. Originally, ISL began life only supporting normal-range VLANs, using only 10 of the 15 bits reserved in the ISL header to identify the VLAN ID. The later-defined 802.1Q used a 12-bit VLAN ID field, thereby allowing support of the extended range. Following that, Cisco changed ISL to use 12 of its reserved 15 bits in the VLAN ID field, thereby supporting the extended range. + +Table 2-8 summarizes VLAN numbers and provides some additional notes. + + + +Table 2-8 +Key +Topic VLAN Number + + +Valid VLAN Numbers, Normal and Extended + +Normal or Can Be Advertised Comments Extended? and Pruned by VTP +Versions 1 and 2? + + + +0 + +1 + + +2–1001 + +1002–1005 + +1006–4094 + +4095 + +Reserved — + +Normal No + + +Normal Yes + +Normal No + +Extended No + +Reserved No + +Not available for use + +On Cisco switches, the default VLAN for all access ports; cannot be deleted or changed +— + +Defined specifically for use with FDDI and TR translational bridging +— + +Not available for use + + + + +Storing VLAN Configuration + +Catalyst IOS stores VLAN and VTP configuration in one of two places—either in a Flash file called vlan.dat or in the running configuration. (Remember that the term “Catalyst +Chapter 2: Virtual LANs and VLAN Trunking 95 + +IOS” refers to a switch that uses IOS, not the Catalyst OS, which is often called CatOS.) IOS chooses the storage location in part based on the VTP version and mode, and in part based on whether the VLANs are normal-range VLANs or extended-range VLANs. Table 2-9 describes what happens based on what configuration mode is used to configure +the VLANs, the VTP mode, and the VLAN range. (Note that VTPv1/VTPv2 clients also store the VLAN configuration in vlan.dat, and they do not understand extended-range VLANs.) + + +Table 2-9 Key +Topic Function + + +VLAN Configuration and Storage for VTPv1 and VTPv2 + +When in VTP Server Mode When in VTP Transparent Mode + + + +Normal-range VLANs can be configured from +Extended-range VLANs can be configured from +VTP and normal-range VLAN configuration commands are stored in +Extended-range VLAN configuration commands are stored in + +Both VLAN database and configuration modes +Nowhere—cannot be configured +vlan.dat in Flash + + +Nowhere—extended range not allowed in VTP server mode + +Both VLAN database and configuration modes +Configuration mode only + +Both vlan.dat in Flash and running configuration +1 + +Running configuration only + + +1 When a switch reloads, if the VTP mode or domain name in the vlan.dat file and the startup config file differs, the switch uses only the vlan.dat file’s contents for VLAN configuration. + + +Note The configuration characteristics referenced in Table 2-9 do not include the inter-face configuration command switchport access vlan; they include the commands that cre-ate a VLAN (vlan command) and VTP configuration commands. + + +For VTPv3, the situation is greatly simplified: Regardless of the mode (server, client, transparent, or off), both normal- and extended-range VLANs are stored in the vlan.dat file. If transparent or off mode is selected, VLANs are also present in the running-config. + +Of particular interest for those of you stronger with CatOS configuration skills is that when you erase the startup-config file and reload the Cisco IOS switch, you do not actu-ally erase the normal-range VLAN and VTP configuration information. To erase the VLAN and VTP configuration, you must use the delete flash:vlan.dat EXEC command. Also note that if multiple switches are in VTP server mode, if you delete vlan.dat on one switch and then reload it, as soon as the switch comes back up and brings up a trunk, it learns the old VLAN database through a VTP update from the other VTP server. +96 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Configuring PPPoE + +Although it might seem out of place in this chapter on VLANs and VLAN trunk- +ing, Point-to-Point Protocol over Ethernet (PPPoE) fits best here. Somewhat similar to VLANs that virtualize Ethernet switched infrastructure into multiple isolated multiaccess switched environments, PPPoE virtualizes Ethernet into multiple point-to-point sessions between client hosts and an access concentrator, turning the broadcast Ethernet into a point-to-multipoint environment. PPP itself is a great Layer2 protocol for point-to-point links, with capabilities very well suited to a service provider’s needs, such as per-user authentication (and resulting billing), negotiation of allowed higher protocols carried over the PPP link including their settings (such as endpoint IP addresses), negotiation of compression, link bundling (also called multilink), and so on. PPPoE described in RFC +2516 was originally conceived as a method for carrying PPP-based sessions over Ethernet access networks often used in service provider networks, with the PPPoE software client running on a PC equipped with an ordinary Ethernet card. With the advent of Digital Subscriber Line (DSL) technology, the use of PPPoE with DSL allowed for a simple deployment. Client PCs continued to run PPPoE software clients, while a DSL modem connected to a common LAN with the client PCs simply took the Ethernet frames con-taining PPP datagrams and transmitted them inside a series of ATM cells over the DSL interface, essentially bridging them over the ATM-based DSL network to the Broadband Remote Access Server (BRAS). In the opposite direction, the modem received Ethernet frames encapsulated in series of ATM cells, reconstructed them and forwarded them onto the LAN. As the features of routers improved, the PPPoE client functionality moved from PCs to the router connected to the DSL network itself. + +The PPPoE client feature permits a Cisco IOS router, rather than an endpoint host, to serve as the client in a network. This permits entire LANs to connect to the Internet over a single PPPoE connection terminated at the single router. + +In a DSL environment, PPP interface IP addresses are derived from an upstream DHCP server using IP Configuration Protocol (IPCP), a subprotocol of PPP. Therefore, IP address negotiation must be enabled on the router’s dialer interface. This is done using the ip address negotiated command in the dialer interface configuration. + +Because PPPoE introduces an 8-byte overhead (2 bytes for the PPP header and 6 bytes for PPPoE), the MTU for PPPoE is usually decreased to 1492 bytes so that the entire encapsulated frame fits within the 1500-byte Ethernet frame. Additionally, for TCP ses-sions, the negotiated Maximum Segment Size is clamped down to 1452 bytes, allowing for 40 bytes in TCP and IP headers and 8 bytes in the PPPoE, totaling 1500 bytes that must fit into an ordinary Ethernet frame. A maximum transmission unit (MTU) mismatch can prevent a PPPoE connection from coming up or from properly carrying large data-grams. Checking the MTU setting is a good first step when troubleshooting PPPoE con-nections. + +Those familiar with ISDN BRI configuration will recognize the dialer interface configura-tion and related commands in Example 2-11. The key difference between ISDN BRI con-figuration and PPPoE is the pppoe-client dial-pool-number command. +Chapter 2: Virtual LANs and VLAN Trunking 97 + +Configuring an Ethernet edge router for PPPoE Client mode is the focus of this section. This task requires configuring the Ethernet interface (physical or subinterface) and a cor-responding dialer interface. + +Figure 2-8 shows the topology. Example 2-12 shows the configuration steps. The first step is to configure the outside Ethernet interface as a PPPoE client and assign it to a dialer interface. The second step is to configure the corresponding dialer interface. Additional steps, including Network Address Translation (NAT) configuration, are also shown. + +DSL CPE + +Fa0/0 Fa0/1 +LAN +EdgeRouter + +Workstations +ATM Network + + + + +DSL Access Multiplexer + +Access Concentrator + + +Figure 2-8 PPPoE Topology for Example 2-12 + +Example 2-12 Configuring PPPoE on EdgeRouter + +EdgeRouter# conf t +EdgeRouter(config)# interface fa0/0 +EdgeRouter(config-if)# no shutdown +EdgeRouter(config-if)# ip address 192.168.100.1 255.255.255.0 +EdgeRouter(config-if)# ip nat inside +EdgeRouter(config)# interface fa0/1 +EdgeRouter(config-if)# no shutdown +EdgeRouter(config-if)# pppoe-client dial-pool-number 1 +EdgeRouter(config-if)# exit +EdgeRouter(config)# interface dialer1 +EdgeRouter(config-if)# mtu 1492 +EdgeRouter(config-if)# ip tcp adjust-mss 1452 +EdgeRouter(config-if)# encapsulation ppp +EdgeRouter(config-if)# ip address negotiated +EdgeRouter(config-if)# ppp chap hostname Username@ISP +EdgeRouter(config-if)# ppp chap password Password4ISP +EdgeRouter(config-if)# ip nat outside +98 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +EdgeRouter(config-if)# dialer pool 1 +EdgeRouter(config-if)# exit +EdgeRouter(config)# ip nat inside source list 1 interface dialer1 overload +EdgeRouter(config)# access-list 1 permit 192.168.100.0 0.0.0.255 +EdgeRouter(config)# ip route 0.0.0.0 0.0.0.0 dialer1 + +You can verify PPPoE connectivity using the show pppoe session command. Cisco IOS includes debug functionality for PPPoE through the debug pppoe [data | errors | events | packets] command. +Chapter 2: Virtual LANs and VLAN Trunking 99 + + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter as well as review items noted with a Key Topic icon. + +Table 2-10 lists some of the most popular IOS commands related to the topics in this chapter. (The command syntax was retaken from the Catalyst 3560 Multilayer Switch Command Reference, 15.0(2)SE. Note that some switch platforms might have differences in the command syntax.) + + +Table 2-10 + +Command + + +Catalyst IOS Commands Related to Chapter 2 + +Description + + + +show mac address-table [aging-time | count | dynamic | static ] [address hw-addr] [interface interface-id] [vlan vlan-id] + +show interfaces [interface-id] switchport | trunk] + +Displays the MAC address table; the security option displays information about the restricted or static settings +Displays detailed information about an interface operating as an access port or a trunk + +show vlan [brief | id vlan-id | internal usage | EXEC command that lists information about name vlan-name | private-vlan | summary] the VLAN + + +show vtp status + +switchport mode {access | dot1q-tunnel | dynamic {auto | desirable} | private-vlan {host | promiscuous} | trunk} + +switchport nonegotiate + +Lists VTP configuration and status information +Configuration command setting nontrunking (access, private-vlan), tunneling (dot1q-tunnel) trunking (trunk), and dynamic trunking (auto and desirable) parameters +Interface subcommand that disables DTP messages; interface must not be configured as a dynamic port + +switchport trunk {allowed vlan vlan-list} Interface subcommand used to set +| {encapsulation {dot1q | isl | negotiate}} | parameters used when the port is trunking {native vlan vlan-id} | {pruning vlan vlan-list} +switchport access vlan vlan-id Interface subcommand that statically configures the interface as a member of that one VLAN +100 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 2-11 lists the commands related to VLAN creation—both the VLAN database mode configuration commands (reached with the vlan database privileged mode com-mand) and the normal configuration mode commands. + + +Note Some command parameters might not be listed in Table 2-11. + + + +Table 2-11 VLAN Database and Configuration Mode Command List and Comparison + + +VLAN Database +vtp {domain domain-name | password password | pruning | v2-mode | {server | client | transparent}} + +vlan vlan-id [name vlan-name ] [state {active | suspend}] +show {current | proposed | difference} + +apply | abort | reset + +Configuration +vtp { domain domain-name | file filename | interface name | mode {client | server | transparent | off } | password password [ +hidden | secret] | pruning | version number } + +vlan vlan-id + +No equivalent + +No equivalent + + + + + +Table 2-12 + +Command + + +Cisco IOS PPPoE Client Commands + +Description + + + +pppoe-client dial-pool-number number + +debug pppoe [data | errors | events | packets] + +Configures the outside Ethernet interface on a router for PPPoE operation and assigns the PPPoE client into a dialer pool to be used later by a dialer interface +Enables debugging for PPPoE troubleshooting +Chapter 2: Virtual LANs and VLAN Trunking 101 + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +VLAN, broadcast domain, DTP, VTP pruning, 802.1Q, ISL, native VLAN, encapsula-tion, Private VLAN, promiscuous port, community VLAN, isolated VLAN, promis-cuous port, community port, isolated port, 802.1Q-in-Q, Layer 2 protocol tunneling, PPPoE, DSL. +Refer to the glossary to check your answers. + + +Further Reading + +The topics in this chapter tend to be covered in slightly more detail in CCNP Switching exam preparation books. For more details on these topics, refer to the Cisco Press CCNP preparation books found at www.ciscopress.com/ccnp. + +Cisco LAN Switching, by Kennedy Clark and Kevin Hamilton, is an excellent reference for LAN-related topics in general, and certainly very useful for CCIE written and lab exam preparation. + +DTP protocol details are not covered in official Cisco documentation; however, DTP has been filed as U.S. Patent No. 6,445,715, which is publicly available at www.google.com/?tbm=pts. + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Spanning Tree Protocol + +■ 802.1D STP + +■ 802.1w RSTP + +■ 802.1s MST + +■ Loop Guard + +■ Root Guard + +■ EtherChannel Misconfiguration Guard + +■ BPDU Guard and BPDU Filter + +■ UDLD + +■ Bridge Assurance + +■ EtherChannel + +■ Troubleshooting Complex Layer 2 Issues +CHAPTER 3 + + + + + + +Spanning Tree Protocol + + +Spanning Tree Protocol (STP) is probably one of the most widely known protocols cov-ered on the CCIE Routing and Switching written exam. STP has been around for a long time, is used in most every campus network today, and is covered extensively on the CCNP SWITCH exam. This chapter covers a broad range of topics related to STP. + +“Do I Know This Already?” Quiz + +Table 3-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 3-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section + +802.1D Spanning Tree Protocol and Improvements + +Protecting and Optimizing Spanning Tree + +Configuring and Troubleshooting EtherChannels + +Troubleshooting Complex Layer 2 Issues + +Total Score + +Questions Covered in This Score Section +1–8 + +9 + +10 + +11 + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. Assume that a nonroot 802.1D switch has ceased to receive Hello BPDUs. Which STP setting determines how long a nonroot switch waits before trying to choose a new Root Port? +a. Hello timer setting on the Root + +b. MaxAge timer setting on the Root + +c. ForwardDelay timer setting on the Root + +d. Hello timer setting on the nonroot switch + +e. MaxAge timer setting on the nonroot switch + +f. ForwardDelay timer setting on the nonroot switch +104 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +2. Assume that a nonroot 802.1D switch receives a Hello BPDU with the TCN flag set. Which STP setting determines how long the nonroot switch waits before timing out inactive CAM entries? +a. Hello timer setting on the Root + +b. MaxAge timer setting on the Root + +c. ForwardDelay timer setting on the Root + +d. Hello timer setting on the nonroot switch + +e. MaxAge timer setting on the nonroot switch + +f. ForwardDelay timer setting on the nonroot switch + +3. Assume that a nonroot Switch1 (SW1) is Discarding on an 802.1Q trunk connected to Switch2 (SW2). Both switches are in the same MST region. SW1 ceases to receive Hellos from SW2. What timers have an impact on how long Switch1 takes to both become the Designated Port on that link and reach the Forwarding state? +a. Hello timer setting on the Root + +b. MaxAge timer setting on the Root + +c. ForwardDelay timer on the Root + +d. Hello timer setting on SW1 + +e. MaxAge timer setting on SW1 + +f. ForwardDelay timer on SW1 + +4. Which of the following statements are true regarding support of multiple spanning trees over an 802.1Q trunk? + +a. Only one common spanning tree can be supported. + +b. Cisco PVST+ supports multiple spanning trees if the switches are Cisco switches. + +c. 802.1Q supports multiple spanning trees when using IEEE 802.1s MST. + +d. Two PVST+ domains can pass over a region of non-Cisco switches using 802.1Q trunks by encapsulating non-native VLAN Hellos inside the native VLAN Hellos. +5. When a switch notices a failure, and the failure requires STP convergence, it notifies the Root by sending a TCN BPDU. Which of the following best describes why the notification is needed? +a. To speed STP convergence by having the Root converge quickly. + +b. To allow the Root to keep accurate count of the number of topology changes. + +c. To trigger the process that causes all switches to use a short timer to help flush the CAM. + +d. There is no need for TCN today; it is a holdover from DEC’s STP specification. +Chapter 3: Spanning Tree Protocol 105 + +6. Two switches have four parallel Ethernet segments, none of which forms into an EtherChannel. Assuming that 802.1D is in use, what is the maximum number of the eight ports (four on each switch) that stabilize into a Forwarding state? +a. 1 + +b. 3 + +c. 4 + +d. 5 + +e. 7 + +7. IEEE 802.1w does not use the exact same port states as does 802.1D. Which of the following are valid 802.1w port states? + +a. Blocking + +b. Listening + +c. Learning + +d. Forwarding + +e. Disabled + +f. Discarding + +8. What STP tools or protocols supply a “MaxAge optimization,” allowing a switch to bypass the wait for MaxAge to expire when its Root Port stops receiving Hellos? + +a. Loop Guard + +b. UDLD + +c. BPDU Guard + +d. Bridge Assurance + +e. IEEE 802.1w + +9. A trunk between switches lost its physical transmit path in one direction only. Which of the following features protect against the STP problems caused by such an event? +a. Loop Guard + +b. UDLD + +c. Dispute + +d. PortFast +106 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +10. A switch has four Ethernet segments toward its neighbor, with the intention of using them in an EtherChannel. Some settings on the physical ports on this switch might be different and yet these ports will be allowed to be bundled in a single EtherChannel. Which settings do not have to match? +a. DTP negotiation settings (auto/desirable/on) + +b. Allowed VLAN list + +c. STP per-VLAN port cost on the ports on a single switch + +d. If 802.1Q, native VLAN + +11. A computer’s NIC is hardcoded to 1000 Mbps and full-duplex, and it is connected to a switch whose Fast Ethernet interface is set to autonegotiate speed and duplex. What speed and duplex will the switch use if the autonegotiation on the computer’s NIC is deactivated as a result of hardcoding the speed and duplex? +a. 100 Mbps and full-duplex + +b. 100 Mbps and half-duplex + +c. 1000 Mbps and full-duplex + +d. 1000 Mbps and half-duplex + +e. The link will be inactive. +Chapter 3: Spanning Tree Protocol 107 + +Foundation Topics + + +802.1D Spanning Tree Protocol and Improvements + +Although many CCIE candidates already know STP well, the details are easily forgotten. For example, you can install a campus LAN, possibly turn on a few STP optimizations and security features out of habit, and have a working LAN using STP—without ever really contemplating how STP does what it does. And in a network that makes good use of Layer 3 switching, each STP instance might span only three to four switches, making the STP issues much more manageable—but more forgettable in terms of helping you remember things you need to know for the exam. This chapter reviews the details of IEEE 802.1D STP, and then goes on to related topics—802.1w RSTP, multiple spanning trees, STP optimizations, and STP security features. STP terminology refers to bridges in many places; in the following sections, the words bridge and switch will be used interchangeably with respect to STP. While the upcoming sections about various STP versions might appear lengthy and reiterate on many known facts, be sure to read them very carefully in their entirety. It is always tiresome to read an in-depth discussion about a protocol as notorious as STP—but as we know, it’s details that matter, especially for a CCIE. This chapter tries to put several details about STP straight, cleaning up numerous +misconceptions that have crept in the common understanding of STP over the years of its existence. + +Before diving into STP internals, it is worthwhile to comment on a possible naming con-fusion regarding various STP versions. The first IEEE-standardized STP, also often called the “legacy” STP, was originally described in 802.1D. Its improvements were subsequently published in so-called amendments: The Rapid STP (RSTP) was standardized in amend-ment 802.1w, while Multiple STP (MSTP) was covered in amendment 802.1s. Since then, the amendments have been integrated into existing standards. The latest 802.1D-2004 standard no longer includes the legacy STP at all (which is considered obsolete), and instead, it covers the RSTP originally found in 802.1w. The 802.1s MSTP is integrated into 802.1Q-2005 and later revisions. With current standards, therefore, RSTP is covered in 802.1D while MSTP is covered in 802.1Q, and legacy STP has been dropped. Still, many people are used to the old naming, with 802.1D referring to STP, 802.1w referring to RSTP, and 802.1s referring to MSTP. + +STP uses messaging between switches to stabilize the network into a logical loop-free topology. To do so, STP causes some interfaces (popularly called ports when discussing STP) to simply not forward or receive traffic—in other words, the ports are in a Blocking state. The remaining ports, in an STP Forwarding state, together provide a loop-free path to every Ethernet segment in the network. + +STP protocol messages are called Bridge Protocol Data Units (BPDU), the basic structure for which is shown in Figure 3-1. +108 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Configuration BPDU Topology Change Notification BPDU + + +BPDU Field + +Protocol Identifier + +Protocol Version + +BPDU Type + +Flags + +Root Bridge ID + +Root Path Cost + +Sending Bridge ID + +Sending Port ID + +Message Age + +Max Age + +Hello Time + +Forward Delay + +Length in Octets + +2 + +1 + +1 + +1 + +8 + +4 + +8 + +2 + +2 + +2 + +2 + +2 + +BPDU Field + +Protocol Identifier + +Protocol Version + +BPDU Type + +Length in Octets + +2 + +1 + +1 + + +Figure 3-1 Format of STP Bridge Protocol Data Units + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +For STP, the Protocol Identifier value is set to 0x0000 and the Protocol Version is also set to 0x00. The BPDU Type field identifies two kinds of STP BPDUs: Configuration BPDUs (type 0x00) and Topology Change Notification BPDUs (type 0x80). The Flags field uses 2 bits out of 8 to handle topology change events: the Topology Change Acknowledgment flag and the Topology Change flag. Following the Flags, there is a series of fields identify- +ing the root bridge, distance of the BPDU’s sender from the root bridge, the sender bridge’s own identifier, and the identifier of the port on the sender bridge that forwarded this BPDU. The MessageAge field is an estimation of the BPDU’s age since it was originated by the root bridge. At the root bridge, it is set to 0. Any other switch will increment this value, usually by 1, before forwarding the BPDU further. The remaining lifetime of a BPDU after being received by a switch is MaxAge-MessageAge. Finally, the remaining fields carry the values of STP timers: MaxAge, HelloTime, ForwardDelay. These timer values always reflect the timer settings on the root switch. Timers configured on a nonroot switch are not used and would become effective only if the switch itself became the root switch. + +Bridges and ports are identified by their IDs in BPDUs. Without discussing the exact for-mat at this point, an object in STP that is called “identifier,” or ID, always has a configu-rable part called the priority, and a fixed part that cannot be modified by management. Both bridges and ports have IDs with configurable priorities. + +STP operation is based on the ability to compare any two arbitrary Configuration BPDUs and determine which one of them is better, or superior. The other BPDU is called infe-rior. To determine which BPDU out of a pair of BPDUs is superior, they are compared in +the following sequence of values, looking for the first occurrence of a lower value: + + +■ Root Bridge ID (RBID) + +■ Root Path Cost (RPC) +Chapter 3: Spanning Tree Protocol 109 + +■ Sender Bridge ID (SBID) + +■ Sender Port ID (SPID) + +■ Receiver Port ID (RPID; not included in the BPDU, evaluated locally) + + + + + + + + + + + + + + + + + + + + + +Key Topic + +First, the RBID value in both BPDUs is compared. If one of the BPDUs contains a lower RBID value, this BPDU is declared superior and the comparison process stops. Otherwise, both BPDUs carry the same RBID value and the RPC is compared. Again, if +one of the BPDUs carries a lower RPC value, this BPDU is declared superior. In case both BPDUs carry an identical RPC value, the comparison process moves to the SBID. Should the SBID value be also found identical, the SPID will be compared. If even the SPID values in both BPDUs are the same, RPIDs of ports that received the same BPDU are compared. This very last step is very uncommon and would be seen in situations where +a single BPDU was received by multiple ports of a single switch, possibly because of multiple connections to a hub or a non-STP switch being placed somewhere in between. In any case, precisely this capability of selecting a single superior BPDU out of a set of BPDUs is at the core of STP’s capability to choose exactly one root bridge per a switched environment, exactly one Root Port on a nonroot bridge, and exactly one Designated Port for each connected network segment, as each of these roles is derived from the con-cept of a superior BPDU. Only Configuration BPDUs are compared; Topology Change Notification BPDUs do not convey information used to build a loop-free topology and are not compared. Therefore, whenever a comparison of BPDUs is discussed, it is implied that the BPDUs in question are Configuration BPDUs. + +Additionally, an important fact to remember is that each port in STP stores (that is, remembers) the superior BPDU it has either sent or received. As you will see later, Root Ports and Blocking ports store the received BPDU sent by the “upstream” designated switch (because that BPDU is superior to the one that would be sent out from this port), while Designated Ports store their own sent BPDU (because that one is superior to any received BPDU). Essentially, each port stores the Designated Port’s BPDU—whether it is the port itself that is Designated or it is a neighbor’s port. Should a port store a received BPDU, it must be received again within a time interval of MaxAge-MessageAge seconds; otherwise it will expire after this period. This expiry is always driven by the timers in the BPDU, that is, according to timers of the root switch. + +In the following sections, Configuration BPDUs will also be called simply Hello BPDUs +or Hellos, as their origination is driven by the Hello timer. + + + +Choosing Which Ports Forward: Choosing Root Ports and Designated Ports + +To determine which ports forward and block, STP follows a three-step process, as listed in Table 3-2. Following the table, each of the three steps is explained in more detail. +110 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 3-2 Three Major 802.1D STP Process Steps Key +Topic Major Step Description + +Elect the root switch The switch with the lowest bridge ID; the standard bridge ID is +2-byte priority followed by a MAC address unique to that switch. + +Determine each switch’s The one port on each nonroot switch that receives the superior Root Port resulting BPDU from among all received BPDUs on all its ports. + +Determine the Designated Port for each segment + +When multiple switches connect to the same segment, this is the switch that forwards the superior BPDU from among all forwarded BPDUs onto that segment. + + + + +Electing a Root Switch + +Only one switch can be the root of the spanning tree; to select the root, the switches hold an election. Each switch begins its STP logic by creating and sending an STP Hello bridge protocol data unit (BPDU) message, claiming itself to be the root switch. If a switch hears a superior Hello to its own Hello—namely, a Hello with a lower bridge +ID—it stops claiming to be root by ceasing to originate and send Hellos. Instead, the switch starts forwarding the superior Hellos received from the superior candidate. Eventually, all switches except the switch with the lowest bridge ID cease to originate Hellos; that one switch wins the election and becomes the root switch. + +The original IEEE 802.1D bridge ID held two fields: + +■ The 2-byte Priority field, which was designed to be configured on the various switches to affect the results of the STP election process. + +■ A 6-byte MAC Address field, which was included as a tiebreaker, because each switch’s bridge ID includes a MAC address value that should be unique to each switch. As a result, some switch must win the root election. + +The format of the original 802.1D bridge ID has been redefined in amendment 802.1t and since then integrated into 802.1D-2004. Figure 3-2 shows the original and new format of the bridge IDs. + + +Key 2 Bytes Topic Priority +(0 – 65,535) + +6 Bytes + +System ID (MAC Address) + + +Original Format Bridge ID + + + + + +Priority Multiple of 4096 +4 Bits + + +System ID Extension (Typically Holds VLAN ID) + +12 Bits + + +System ID (MAC Address) + +6 Bytes + +System ID Extension (MAC Address Reduction) + + +Figure 3-2 IEEE 802.1D STP Bridge ID Formats +Chapter 3: Spanning Tree Protocol 111 + +The format was changed mainly because of the advent of multiple spanning trees as sup-ported by Per VLAN Spanning Tree Plus (PVST+) and IEEE 802.1s Multiple Spanning Trees (MST). With the old-style bridge ID format, a switch’s bridge ID for each STP instance (possibly one per VLAN) was identical if the switch used a single MAC address when building the bridge ID. Because VLANs cause a single physical switch to behave as multiple logical switches, having multiple STP instances with the same bridge ID was in violation of the 802.1D that required a distinct bridge ID for each switch. Vendors such as Cisco used a different MAC address for each VLAN when creating the old-style bridge IDs. This provided a different bridge ID per VLAN, but it consumed a large number of reserved MAC addresses in each switch. + +The System ID Extension, originally described in IEEE 802.1t, allows a network to use multiple instances of STP, even one per VLAN, but without the need to consume a separate MAC address on each switch for each STP instance. The System ID Extension field allows the VLAN ID to be placed into what was formerly the last 12 bits of the Priority field. A switch can use a single MAC address to build bridge IDs and, with the VLAN number in the System ID Extension field, still have a unique bridge ID in each VLAN. The use of the System ID Extension field is also called MAC address reduction, because of the need for many fewer reserved MAC addresses on each switch. The use +of the System ID Extension on a switch is indicated by the presence of the spanning-tree extend system-id command in global configuration mode. Older switches equipped with a larger reserve of MAC addresses allow this command to be removed, reverting +to the old-style bridge IDs. Recent switches, however, do not allow this command to be removed even though it is displayed in the running config, and always use the System ID Extension. + +Determining the Root Port + +After the root switch is elected, the rest of the switches now need to determine their Root Port (RP). The process proceeds as described in the following list: + +Key 1. Topic + +2. + + + +3. + + + + +4. + + +The root switch creates and sends a Hello every Hello timer (2 seconds by default). This Hello contains the RBID and SBID fields set to the ID of the root, RPC set to 0, and SPID set to the identifier of the egress port. + +Each nonroot switch receiving a BPDU on a particular port adds that port’s cost to the RPC value in the received BPDU, yielding a resulting BPDU. Subsequently, the switch declares the port receiving the superior resulting BPDU as its Root Port. + +Hellos received on the Root Port of a nonroot switch are forwarded through its remaining designated ports after updating the RPC, SBID, SPID, and MessageAge fields accordingly. Hellos received on other ports of a nonroot switch are processed but they are not forwarded. + +Switches do not forward Hellos out Root Ports and ports that stabilize into a Blocking state. Hellos forwarded out these ports would be inferior (and therefore uninteresting) to Hellos originated by some neighboring switch’s Designated Port on +those segments. +112 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The result of this process is that each nonroot switch chooses exactly one port as its Root Port, as there is always only a single received Hello that is superior over all other received Hellos. According to the sequence of compared fields in received Hellos when selecting a superior BPDU, a Root Port always provides the least-cost path toward the switch with the lowest Bridge ID (that is, the root switch). If there are multiple equal-cost paths, additional tiebreakers (SBID, SPID, RPID) will allow the receiving switch to always choose exactly one path in a deterministic fashion: first, port toward the neighbor with the lowest Bridge ID; then, if there are multiple links toward that neighbor, port con-nected to the neighbor’s port with the lowest Port ID; and finally, if the same BPDU is received on multiple ports at once, the receiving port with the lowest Port ID. + +In this sense, the STP operation is quite similar to the operation of the Routing Information Protocol (RIP), the simplest distance-vector routing protocol. Just like RIP, STP tries to find the least-cost path toward a particular destination, in this case, the root bridge, and has additional criteria to select a single path if there are multiple least-cost paths available. Hellos can be likened to RIP Update messages with RBID identifying the destination, RPC expressing the next hop’s metric to the destination, SBID being the next-hop identifier, and SPID identifying the next hop’s interface. Each time a Hello is received, the receiving switch can be thought to reevaluate its choice of a Root Port and updates the choice if necessary, just like a RIP router receives updates every 30 seconds and reevaluates its choice of least-cost paths to individual destinations. In fact, STP can be seen as a special case of a timer-driven distance-vector routing protocol, selecting exactly one path to exactly one particular destination, the root bridge. This makes STP similar to, though of course not entirely analogous to, RIP. + +A switch must examine the RPC value in each Hello, plus the switch’s STP port costs, to determine its least-cost path to reach the root. To do so, the switch adds the cost listed in the Hello message to the switch’s port cost of the port on which the Hello was received. For example, Figure 3-3 shows the loop network design and details several STP cost cal-culations. + +Loop Design – All Port Costs 19 Unless Shown + + +Root Hello Cost 0 +Cost 19 +SW1 DP RP SW2 + + +Adding my incoming cost setting fields for forwarder’s bridge ID, port priority, and port number. + + + +DP Cost 1 +Hello Cost 0 + + +DP +Hello Cost 19 + + + + + +Fa0/1 +Cost 100 BL + +Cost out fa0/1 = 0 + 100 = 100; cost out fa0/4 = 38 + 19 = 57! + +RP + + + +RP Cost 19 +DP + + + +SW3 + +Fa0/4 Cost 19 + + +SW4 +Hello Cost 38 + + +Figure 3-3 Calculating STP Costs to Determine RPs +Chapter 3: Spanning Tree Protocol 113 + +In Figure 3-3, SW1 happened to become root, and is originating Hellos of cost 0. SW3 receives two Hellos, one with cost 0 and one with cost 38. However, SW3 must then cal-culate its cost to reach the root, which is the advertised cost (0 and 38, respectively) plus SW3’s port costs (100 and 19, respectively). As a result, although SW3 has a direct link to SW1, the calculated cost is lower out interface Fa0/4 (cost 57) than it is out interface Fa0/1 (cost 100), so SW3 chooses its Fa0/4 interface as its RP. + + +Note Many people think of STP costs as being associated with a segment; however, the cost is actually associated with interfaces. Good design practices dictate using the same STP cost on each end of a point-to-point Ethernet segment, but the values can be different. + + + + +Key Topic + +While the costs shown in Figure 3-3 might seem a bit contrived, the same result would happen with default port costs if the link from SW1 to SW3 were Fast Ethernet (default cost 19), and the other links were Gigabit Ethernet (default cost 4). Table 3-3 lists the default port costs according to various revisions of the IEEE 802.1D standard. Before 802.1D-1998, IEEE did not specify any recommended STP port cost values for differ-ent link speeds in their standard. Speeds shown in Table 3-3 were chosen by Cisco and used in its STP implementations of that time. The 802.1D-1998 revision of the standard +provided a table of recommended values, but as the speeds of Ethernet links continued to increase dramatically, IEEE revised these recommended values again in its 802.1D-2004 revision of the standard. On recent Catalyst switches, the default costs correspond to the 802.1D-1998 version of the standard if PVST or Rapid PVST is used, and to the 802.1D-2004 version if MSTP is used. With PVST and Rapid PVST, the 802.1D-2004 costs can be activated using the spanning-tree pathcost method long global configuration command. By default, spanning-tree pathcost method short is configured, causing the switch to +use the older revision of the costs. + + + +Table 3-3 Default Port Costs + + +Port speed + +10 Mbps + +100 Mbps + +1 Gbps + +10 Gbps + +Pre-802.1D-1998 Cost +100 + +10 + +1 + +1 + +802.1D-1998 Cost +100 + +19 + +4 + +2 + +802.1D-2004 Cost +2000000 + +200000 + +20000 + +2000 + + + + +Determining the Designated Port + +A converged STP topology results in only one switch forwarding Hellos onto each LAN segment. The switch that forwards Hellos onto a LAN segment is called the designated switch for that segment, and the port that it uses to forward frames onto that segment is +114 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + +Key Topic + + + + + + + + + + + + + + + + + + + +Key Topic + +called the Designated Port (DP). All remaining ports on a switch that have been deter-mined as neither Root nor Designated will be moved to Blocking state. In the following text, they will be labeled as Non-Designated ports. + +To win the right to be the DP, a switch must send superior Hellos onto the segment. For example, consider the segment between SW3 and SW4 in Figure 3-3 before the DP has been determined on that segment. SW3 would get Hellos directly from SW1, compute its cost to the root over that path, and then forward the Hello out its Fa0/4 interface to +SW4, with RPC set to 100. Similarly, SW4 will forward a Hello with RPC of 38, as shown in Figure 3-3. SW4’s port on this segment becomes the DP, as it sends superior Hellos because of their lower RPC value. Even after SW3 selects its Fa0/4 as the Root Port (as it receives superior resulting BPDUs from among all ports on SW3), any Hellos sent from SW3’s Fa0/4 port would indicate the RPC of 57, still being inferior to SW4’s Hellos. + +Only the DP forwards Hellos onto a LAN segment. In the same example, SW4 keeps sending the Hellos with an RPC of 38 out the port, but SW3 stops sending its inferior Hellos. There would be no harm if SW3 continued to send its inferior BPDUs out its Fa0/1 and Fa0/4 ports, but because STP always cares only for superior BPDUs, this would be a waste of effort. Therefore, neither Root Ports nor ports in the Blocking state send BPDUs. + +The tiebreakers during DP selection are the same as before: first, the switch with the +least-cost path to the root identified by the lowest Bridge ID; then the neighboring switch with the lowest Bridge ID; and finally the port on the neighbor with the lowest Bridge ID with the lowest Port ID. + +To sum up the rules: + +■ The root switch is the switch that has the lowest Bridge ID in the topology. + + +■ On each nonroot switch, a Root Port is the port receiving the best (that is, superior) resulting BPDUs from all received BPDUs on all ports. The adjective “resulting” refers to the addition of the port’s cost to the BPDU’s RPC value before comparing the received BPDUs. + +■ On each connected segment, a Designated Port is the port sending the best (that is, superior) BPDUs on the segment. No modifications to the BPDUs are performed; BPDUs are compared immediately. + +■ All ports that are neither Root Ports nor Designated Ports are superfluous in an active topology and will be put into the Blocking state. + +■ Configuration BPDUs are sent out only from Designated Ports. Root and Non-Designated ports do not emit Configuration BPDUs because they would be inferior to BPDUs of a Designated Port on this segment and hence ignored. +Chapter 3: Spanning Tree Protocol 115 + +■ Each port stores the best (that is, superior) BPDU it has received or sent itself. Designated Ports store the BPDU they send; Root and Blocking ports store the best BPDU they receive. The stored BPDU determines the role of the port and is used for comparisons. + +■ Received superior stored BPDUs will expire in MaxAge-MessageAge seconds if not received within this time period. + + +Converging to a New STP Topology + +Although STP is very illustratively described in the three steps discussed earlier, this approach also gives an impression that after the three steps are completed, STP effec-tively goes dormant until a topology change occurs. Such impression would be incorrect, though. In reality, STP never stops working. With each received BPDU, a switch reevalu-ates its own choice of the root switch, Root Port, and Designated/Non-Designated Ports, effectively performing all three steps all over again. In a stable topology, received BPDUs do not change, and therefore, processing them yields the same results again and again. This is similar to the operation of the RIP that also never stops running—it’s just that in +a stable network which has converged, processing periodic received updates produces the same set of best paths, which gives off an impression that the protocol has done its job and has stopped. In reality, both STP and RIP continue running indefinitely, only in a stable and converged topology, each run produces the same results. + +Of course, a topology in which STP runs can change over time, and STP has to react appropriately. In precise terms, for STP, a topology change is an event that occurs when + +Key ■ A Topology Change Notification BPDU is received by a Designated Port of a switch Topic ■ A port moves to the Forwarding state and the switch has at least one Designated +Port (meaning that it is not a standalone switch with just a Root Port connected to an upstream switch and no other connected ports) + +■ A port moves from Learning or Forwarding to Blocking + +■ A switch becomes the root switch + +When a change to the topology occurs, the elementary reaction of switches that detect the topology change is to start originating BPDUs with appropriately updated contents, propagating the information to their neighbors. These neighbors will process the updated BPDUs, reevaluating their choice of the root switch, Root Port, and Designated/Non-Designated Ports with each received BPDU as usual, and forwarding the BPDU farther according to usual STP rules. + +For an example, consider Figure 3-4, which shows the same loop network as in Figure 3-3. In this case, however, the link from SW1 to SW2 has just failed. +116 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 +1 + +Loop Design – All Port Costs 19 Unless Shown + +MAC 0200.1111.1111 1 + + + +R1 + +Root + +SW1 Disabled +Cost 1 + + + +Disabled SW2 +Fa0/4 + + +My RP failed. I am receiving no other Hellos. I must be the root now! + + + +Hello Root = Sw1 Cost 0 + + +Fa0/1 Cost 100 + + +SW1’s bridge ID is better. So I’m sending the superior Hello on this segment. I am now DP! + +Hello Root = Sw2 Cost 0 + + +Fa0/2 + + +2 + +Fa0/3 +SW3 Fa0/4 SW4 Cost 19 + +4 + +Hello Root = Sw1 Cost 100 + +Hello Root = Sw2 Cost 19 + + +3 + + +Figure 3-4 Reacting to the Loss of Link Between SW1 and SW2 + +The following list describes some of the key steps from Figure 3-4: + +1. SW2’s Root Port goes down. On SW2, the loss of a Root Port causes it to reelect its Root Port by choosing the port receiving superior resulting BPDUs. However, as the only remaining port is Fa0/4 connected to SW4, and SW4 did not send any BPDUs to SW2 from its Root Port Fa0/2, SW2 has no received BPDUs to choose from, and it will start considering itself a root switch, flooding its own Hellos through all its connected ports. +2. SW4 notices that the latest Hellos indicate a new root switch. However, these Hellos from SW2 received on SW4’s Fa0/2 port, its current Root Port, are inferior to the BPDU stored on that port. When the link between SW1 and SW2 still worked, BPDUs arriving at SW4’s Fa0/4 contained the SW1’s Bridge ID as the RBID. After the link between SW1 and SW2 went down and SW2 started considering itself as the root bridge, its BPDUs arriving at SW4’s Fa0/2 port contained SW2’s Bridge ID as the RBID. However, SW2 has a higher Bridge ID than SW1; otherwise, it would be the root switch right away. Therefore, BPDUs claiming that SW2 is the root bridge are inferior to the BPDU stored on SW4’s Fa0/2 that claims SW1 is the root bridge, and as a result, they are ignored until the BPDU stored on SW4’s Fa0/2 expires. This expiry will take MaxAge-MessageAge, or 20−1=19 seconds. Until then, SW4 does not forward any BPDUs to SW3. +3. During the time SW4 receives inferior BPDUs from SW2 on its Fa0/2 port, it does not forward any BPDUs to SW3. As a result, SW3 ceases to receive BPDUs on +its Fa0/4 port, which is its current Root Port. The BPDU stored on SW3’s Fa0/4 port expires in MaxAge-MessageAge, or 20–2=18 seconds. After it expires, Fa0/4 becomes a Designated Port and moves to the Listening state. SW3 then searches for a new Root Port by looking for the superior received resulting BPDU, ultimately choosing Fa0/1 as its new port. Afterward, it will forward SW1’s Hello out its Fa0/4 port after updating the necessary fields. +Chapter 3: Spanning Tree Protocol 117 + +4. In the meantime, SW4 might have the BPDU expired from its Fa0/2, started accept-ing BPDUs from SW2, declared the Fa0/2 as its Root Port toward SW2, and started relaying the Hellos from SW2 to SW3. Even if that was the case, SW3 would treat these Hellos from SW4 as inferior because Hellos sent out from SW3’s Fa0/4 claim that the root switch is SW1 having a lower Bridge ID than SW2. After SW4 receives the relayed Hello from SW3, it will learn about a better root switch than SW2, namely, SW1, and will choose its Fa0/3 as the Root Port. Afterward, it will forward the Hello out its Fa0/2 port. +5. After SW2 receives the forwarded Hello from SW4, it will also learn about SW1 being a better root switch than itself. Therefore, SW2 will stop considering itself as a root switch and will instead declare its Fa0/4 port as the Root Port, finally converg-ing on the new loop-free topology. + +Topology Change Notification and Updating the CAM + +Simply updating the active topology by processing new BPDUs is not sufficient. When STP reconverges on a new active topology, some Content Addressable Memory (CAM) entries might be invalid (CAM is the Cisco term for what is more generically called +the MAC address table, switching table, or bridging table on a switch). For example, before the link failure shown in Figure 3-4, SW3’s CAM might have had an entry for 0200.1111.1111 (Router1’s MAC address) pointing out Fa0/4 to SW4. Remember, at the beginning of the scenario described in Figure 3-4, SW3 was Blocking on its Fa0/1 inter-face back to SW1. When the link between SW1 and SW2 failed, SW3 would need to change its CAM entry for 0200.1111.111 to point out port Fa0/1. + +STP is not a protocol that tries to find shortest paths toward individual MAC addresses, so it cannot be expected to fill the CAM tables with new correct entries. All STP can do is to instruct switches to age out unused entries prematurely, assuming that the unused entries are exactly those that need updating. Even if good entries are flushed from CAM tables, this does not impair basic connectivity—switches will flood frames to unknown destinations rather than dropping them. + +To update the CAMs, two things need to occur: + +■ All switches need to be notified to time out their apparently unused CAM entries. + +■ Each switch needs to use a short timer, equivalent to the Forward Delay timer (default 15 seconds), to time out the CAM entries. + +A topology change can start as a highly localized event—a port becoming Forwarding or transitioning from Learning or Forwarding to Blocking on a particular single switch. The information about this change must nevertheless be propagated to all switches in the +topology. Therefore, a switch that detects a topology change must notify the root switch, and the root switch in turn can notify all switches in the topology. (Recall that it is the root switch’s Hello that is propagated throughout the network to all switches; a nonroot switch has no way of sending its own Configuration BPDU to all remaining switches in +a topology because that BPDU would be inferior, and thus ignored, by possibly many switches.) To do so, a switch detecting a topology change notifies the root switch using +118 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +a Topology Change Notification (TCN) BPDU. The TCN goes up the tree to the root. After that, the root notifies all the rest of the switches. The process is illustrated in Figure 3-5 and runs as follows: + + + +6 +TCN +BPDU +4 + + +RB + + +TCA 5 Conf. +BPDU 2 +TCN BPDU + +TCA Conf. BPDU +3 + + + + +TC 1 + +Figure 3-5 Propagating Information About Topology Change + + +Key 1. Topic 2. + + +3. + + + +4. + + + +5. + + + + +6. + + +A topology change event occurs on a port of a switch. + +After detecting the event, the switch sends a TCN BPDU out its Root Port; it repeats this message every Hello time until it is acknowledged. + +The next designated switch receiving that TCN BPDU sends back an acknowledg-ment through its next forwarded Hello BPDU by marking the Topology Change Acknowledgment (TCA) bit in the Flags field of the Hello. + +The designated switch on the segment in the second step repeats the first two steps, sending a TCN BPDU out its Root Port, and awaits acknowledgment from the desig-nated switch on that segment. + +After the TCN arrives at the root switch, it also acknowledges its arrival through sending a BPDU with the Topology Change Acknowledgment bit set through the port through which the TCN BPDU came in. At this point, the root switch has been informed about a topology change that occurred somewhere in the network. + +For the next MaxAge+ForwardDelay seconds, the root switch will originate BPDUs with the Topology Change (TC) bit set, instructing all switches to shorten the aging +time for CAM entries to ForwardDelay seconds. +Chapter 3: Spanning Tree Protocol 119 + +By each successive switch repeating Steps 2 and 3, eventually the root receives a TCN BPDU. After it is received, the root sets the Topology Change (TC) flag on the next sev-eral Hellos (during the next MaxAge+ForwardDelay seconds), which are forwarded to all switches in the network, notifying them that a change has occurred. A switch receiving +a Hello BPDU with the TC flag set uses the short (ForwardDelay time derived from the value in the received BPDU, set by the root switch) timer to time out unused entries in the CAM. + +Transitioning from Blocking to Forwarding + +When STP reconverges to a new, stable topology, some ports that were Blocking might have been designated as DP or RP, so these ports need to be in a Forwarding state. However, the transition from Blocking to Forwarding state cannot be made immediately without the risk of causing loops. + +To transition to Forwarding state but also prevent temporary loops, a switch first puts a formerly Blocking port into Listening state, and then into Learning state, with each state lasting for the length of time defined by the ForwardDelay timer (by default, 15 seconds). Table 3-4 summarizes the key points about all the 802.1D STP port states. + + +Key Table 3-4 Topic State + + +IEEE 802.1D Spanning Tree Interface States + +Forwards Data Learns Source MACs Frames? of Received Frames? + + + +Transitory or Stable State? + + + +Blocking No No + +Listening No No + +Learning No Yes + +Forwarding Yes Yes + +Disabled No No + +Stable + +Transitory + +Transitory + +Stable + +Stable + + + +In summary, when STP logic senses a change in the topology, it converges, possibly pick-ing different ports as RP, DP, or neither. Any switch changing its RPs or DPs sends a TCN BPDU to the root at this point. For the ports newly designated as RP or DP, 802.1D STP first uses the Listening and Learning states before reaching the Forwarding state. (The transition from Forwarding to Blocking can be made immediately.) + +Per-VLAN Spanning Tree and STP over Trunks + +If only one instance of STP was used for a switched network with redundant links but with multiple VLANs, several ports would be in a Blocking state, unused under stable conditions. The redundant links would essentially be used for backup purposes. +120 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The Cisco Per VLAN Spanning Tree Plus (PVST+) feature creates an STP instance for each VLAN. By tuning STP configuration per VLAN, each STP instance can use a dif-ferent root switch and have different interfaces block. As a result, the traffic load can be balanced across the available links. For example, in the common building design with distribution and access links in Figure 3-6, focus on the left side of the figure. In this case, the access layer switches block on different ports on VLANs 1 and 2, with different root switches. Support for PVST+ implies the capability of trunk ports to be selectively blocked or forwarding for individual VLANs. + + + +3560 +Root +VLAN1 .1Q +.1Q + +ISL 3560 +Root .1Q VLAN2 +.1Q + + + +FWD +VLAN1 FWD 2960 VLAN2 + +FWD FWD VLAN2 VLAN1 2960 + + +Figure 3-6 Operation of PVST+ for Better Load Balancing + + + + + + + + + + + + + + +Key Topic + +With different root switches and with default port costs, the access layer switches end up sending VLAN1 traffic over one uplink and VLAN2 traffic over another uplink. + +Using 802.1Q VLANs with IEEE 802.1D STP requires some extra thought as to how it works. Non-Cisco switches that follow exclusively the IEEE standard support only a so-called Common Spanning Tree (CST). Here, only one instance of STP runs in the net-work (not even being tied to a specific VLAN because basic STP does not know anything about VLANs), and that one STP topology is used for all VLANs, hence being called as “common.” Although using only one STP instance reduces the STP messaging overhead, it does not allow load balancing by using multiple STP instances, as was shown with PVST+ in Figure 3-6. + +When building networks using a mix of Cisco and non-Cisco switches, along with 802.1Q trunking, you can still take advantage of multiple STP instances in the Cisco portion +of the network, but we need to look closer at the rules that govern the interoperation between the 802.1D STP and PVST+, and the cooperation of PVST+ regions intercon-nected by CST regions. + +Cisco PVST+ running on trunks uses a VLAN 1 STP instance to communicate with non-Cisco switches and their STP. VLAN 1’s STP instance in PVST+ regions interoperates and merges with the STP in CST regions. As a result, the entire switched network computes a single loop-free topology. In CST regions, the active loop-free topology is binding for all VLANs; inside PVST+ regions, the active loop-free topology applies to VLAN 1 only. Other VLANs inside PVST+ regions have their own PVST+ instances. + +PVST+ instances for VLANs other that VLAN 1 in PVST+ regions treat CST regions +simply as loop-free shared segments. This is done by encapsulating the PVST+ BPDUs on +Chapter 3: Spanning Tree Protocol 121 + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +trunks differently than ordinary BPDUs: Their destination MAC address is set to the mul-ticast address 0100.0CCC.CCCD (ordinary STP BPDUs are destined to 0180.C200.0000), they are tagged with the corresponding VLAN (ordinary STP BPDUs are untagged), and by using SNAP encapsulation (ordinary STP BPDUs use LLC encapsulation without SNAP). In addition, each PVST+ BPDU has a special TLV record placed at its end that carries the VLAN number in which the PVST+ BPDU was originated. We will call this TLV the Port VLAN ID TLV, or a PVID TLV. This TLV is analyzed by PVST+ switches and compared to the VLAN in which the BPDU is received to detect native VLAN mis-matches. As a result, PVST+ BPDUs are tunneled across CST regions, with CST switches flooding them as ordinary multicasts without processing them. To non-VLAN 1 PVST+ instances, the entire switched network appears as PVST+ regions interconnected by shared segments. By tunneling PVST+ BPDUs across CST regions, PVST+ STP instances for VLANs 2–4094 in individual PVST+ regions cooperate together to form a single spanning tree for each corresponding VLAN inside all PVST+ regions, with CST regions merely serving the purpose of loop-free shared segments connecting the PVST+ regions together. + +VLAN 1 on PVST+ trunks is actually handled specially: Both standard STP BPDUs and PVST+ BPDUs are sent for VLAN 1. However, only the STP BPDU is used both by CST and PVST+ switches in VLAN 1 to compute the spanning tree. PVST+ BPDU for VLAN 1 is used to detect native VLAN mismatches and is otherwise ignored upon arrival. + +To summarize the sending and processing of PVST+ and ordinary IEEE BPDUs on ports, when sending BPDUs, access ports send only IEEE BPDUs relevant to their access +VLAN. Trunk ports always send a set of BPDUs: + + +■ IEEE-formatted BPDUs for VLAN1, always untagged. + +■ PVST+ BPDUs (also called SSTP BPDUs in Cisco documents) for all existing and allowed VLANs including VLAN1, tagged accordingly to the native VLAN of the trunk; that is, BPDUs for the native VLAN won’t be tagged and all others will. Each of these PVST+ BPDUs carries the PVID TLV. + +When processing received BPDUs, an access port must receive only IEEE BPDUs; oth-erwise a Type Inconsistent state is declared. These IEEE BPDUs will be processed by the STP instance for the access VLAN of the port. On trunk ports, the processing is a little more complex: + +■ IEEE-formatted BPDUs will be immediately processed by the VLAN1 STP instance. + +■ PVST+ BPDUs are processed according to this sequence of steps: + +1. Assign the BPDU to the appropriate VLAN by looking at its 802.1Q tag. If the tag is present, the BPDU is assigned to the VLAN indicated by the tag. If the tag is not present, the BPDU is assigned to the native VLAN. +2. Check the PVID TLV in the BPDU. If the VLAN stored in the PVID TLV does not match the VLAN to which the BPDU was assigned, drop the BPDU and declare the PVID_Inconsistent state for the offending pair of VLANs. This is the native VLAN mismatch check. +122 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +3. BPDUs whose PVID TLV VLAN matches the assigned VLAN will be processed by STP in their appropriate VLANs except BPDUs for VLAN1. Because the information for VLAN1 is duplicated in the IEEE BPDUs and PVST+ BPDUs and the IEEE BPDUs always have to be processed, the PVST+ BPDU for VLAN1 served only the purpose of protection against native VLAN mismatch in VLAN1, and can be dropped afterward. +Figure 3-7 shows a network in which three CST regions of non-Cisco switches connect to two regions of Cisco PVST+ supporting switches. + + +CST Region 1 + + + +Non-Cisco + + +Non-Cisco +.1Q CST Region 2 + + + +.1Q Common Non-Cisco Spanning Tree + + +Non-Cisco + + + + +STP only in Non-Cisco Non-Cisco VLAN 1 + + +PVST+ Region + +3560 ISL 3560 + +Non-native VLAN STP BPDUs trunked, sent to 0100.0CCC.CCCD + + +PVST+ Region + +3560 ISL 3560 + + +.1Q .1Q .1Q .1Q .1Q .1Q .1Q .1Q + +2960 2960 2960 2960 + +Non-native VLAN STP BPDUs trunked, sent to 0100.0CCC.CCCD + +Non-Cisco Non-Cisco + +CST Region 3 + +Non-Cisco + +Figure 3-7 Combining Standard IEEE 802.1Q and CST with PVST+ + +The topology in Figure 3-7 consists of three CST and two PVST+ regions. CST regions use ordinary STP with no per-VLAN semantics. PVST+ regions run STP independently in each VLAN, and on PVST+ boundaries, they use the VLAN 1 STP instance to interact and interoperate with CST regions. +Chapter 3: Spanning Tree Protocol 123 + +As CST and PVST+ VLAN 1 STP instances will interact and cooperate with each other, the result of this interaction is a tree that spans through the entire network. In CST regions, the loop-free topology will be shared by all VLANs; in PVST+ regions, the loop-free topology will be applied to VLAN 1 only. Assuming that the topmost switch in CST Region 2 is the root switch and all links have the same STP cost, the resulting loop-free topology in CST regions and in VLAN 1 in PVST+ regions is shown in Figure 3-8. + + +CST Region 1 + + + +Non-Cisco +.1Q + + + +Non-Cisco + + +Non-Cisco + + + + +CST Region 2 + + +Non-Cisco + + + + +Non-Cisco Non-Cisco + + +PVST+ Region PVST+ Region + +3560 ISL 3560 3560 ISL 3560 + +.1Q .1Q .1Q +.1Q + +2960 2960 2960 2960 + + + +Non-Cisco Non-Cisco + +CST Region 3 +Non-Cisco + +Figure 3-8 Resulting Spanning Tree in CST Regions and in VLAN 1 in PVST+ Regions + +In simple terms, the result of CST and VLAN 1 STP interaction can be easily visualized simply by considering all switches to run a single STP instance and computing the span-ning tree, ignoring all VLANs for the moment, then taking into consideration that in CST regions, this spanning tree will be shared by all VLANs, while in PVST+ regions, only VLAN 1 will be affected. Also, any CST region that interconnects two or more PVST+ regions is internally loop free and either continuous (as in CST Region 2; this region pro-vides a transit connectivity between PVST+ regions) or partitioned (as in CST Region 3; this region does not provide transit connectivity to PVST+ regions). +124 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +This observation about CST regions being internally loop free is important to understand the operation of remaining non-VLAN 1 STP instances in PVST+ regions. After loops have been eliminated from CST regions, the resulting network as seen by PVST+ STP instances can be seen in Figure 3-9. + + + + +PVST+ Region + +3560 ISL 3560 + +Non-native VLAN STP BPDUs trunked, sent to 0100.0CCC.CCCD + + +PVST+ Region + +3560 ISL 3560 + + + +.1Q +.1Q + +.1Q .1Q .1Q .1Q + +.1Q .1Q + +2960 2960 2960 2960 + + + +Figure 3-9 Network as Perceived by Non-VLAN 1 PVST+ STP Instances + +As PVST+ BPDUs are effectively tunneled across CST regions, the CST regions simply appear as shared segments to non-VLAN 1 PVST+ STP instances. These shared segments are internally loop free and either interconnect PVST+ regions, in which case PVST+ will take care of eliminating any remaining possible loops between PVST+ regions, or do not even provide transit connectivity. PVST+ BPDUs will be flooded across the CST region without being processed. When forwarded PVST+ BPDUs reach the first Cisco PVST+ switch in the other PVST+ region, the switch, listening for multicasts to 0100.0CCC. CCCD, reads and interprets the BPDU. + + +Note Along with 802.1s Multiple Spanning Tree Protocol (MSTP), 802.1Q allows 802.1Q trunks for supporting multiple STP instances. MST is covered later in this chapter. + + + +STP Configuration and Analysis + +Example 3-1, based on Figure 3-10, shows some of the basic STP configuration and show commands. Take care to note that many of the upcoming commands allow the parameters to be set for all VLANs by omitting the VLAN parameter, or set per VLAN by includ- +ing a VLAN parameter. Example 3-1 begins with SW1 coincidentally becoming the root switch. After that, SW2 is configured to become root, and SW3 changes its Root Port as a result of a configured port cost in VLAN 1. +Chapter 3: Spanning Tree Protocol 125 + +Core Design + + + +SW1 +Fa0/3 + +Fa0/2 Fa0/1 + +Fa0/4 Fa0/3 + + +SW2 +Fa0/4 + + + + +Fa0/2 Fa0/1 +Fa0/1 Fa0/2 + +SW3 Fa0/4 Fa0/3 SW4 + +Figure 3-10 Network Used with Example 3-1 + +Example 3-1 STP Basic Configuration and show Commands +Key +Topic ! First, note the Root ID column lists the root's bridge ID as two parts, +! first the priority, followed by the MAC address of the root. The root cost of +! 0 implies that SW1 (where the command is executed) is the root. + +SW1# sh spanning-tree root +Root Hello Max Fwd +Vlan Root ID Cost Time Age Dly Root Port +---------------- -------------------- --------- ----- --- --- ------------ + +VLAN0001 +VLAN0011 +VLAN0012 +VLAN0021 +VLAN0022 + +32769 000a.b7dc.b780 0 2 20 15 +32779 000a.b7dc.b780 0 2 20 15 +32780 000a.b7dc.b780 0 2 20 15 +32789 000a.b7dc.b780 0 2 20 15 +32790 000a.b7dc.b780 0 2 20 15 + + +! The next command confirms that SW1 believes that it is the root of VLAN 1. + +SW1# sh spanning-tree vlan 1 root detail + +Root ID Priority +Address + +32769 +000a.b7dc.b780 + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +! Next, SW2 is configured with a lower (better) priority than SW1, +! so it becomes the root. Note that because SW2 is defaulting to use +! the System ID Extension, the actual priority must be configured as a +! multiple of 4096. +126 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +SW2# conf t +Enter configuration commands, one per line. End with CNTL/Z. +SW2(config)# spanning-tree vlan 1 priority ? +<0-61440> bridge priority in increments of 4096 + +SW2(config)# spanning-tree vlan 1 priority 28672 +SW2(config)# ^Z +SW2# sh spanning-tree vlan 1 root detail + +VLAN0001 +Root ID + + +Priority +Address + + +28673 +0011.92b0.f500 + +This bridge is the root +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +! The System ID Extension field of the bridge ID is implied next. The output +! does not separate the 4-bit Priority field from the System ID field. The output +! actually shows the first 2 bytes of the bridge ID, in decimal. For VLAN1, +! the priority is 28,673, which is the configured 28,672 plus the VLAN ID, +! because the VLAN ID value is used in the System ID field in order to implement +! the MAC address reduction feature. The other VLANs have a base priority +! of 32768, plus the VLAN ID - for example, VLAN11 has priority 32779, +! (priority 32,768 plus VLAN 11), VLAN12 has 32780, and so on. + +SW2# sh spanning-tree root priority +VLAN0001 28673 +VLAN0011 32779 +VLAN0012 32780 +VLAN0021 32789 +VLAN0022 32790 + +! Below, SW3 shows a Root Port of Fa0/2, with cost 19. SW3 gets Hellos +! directly from the root (SW2) with cost 0, and adds its default cost (19). +! This next command also details the breakdown of the priority and system ID. + +SW3# sh spanning-tree vlan 1 +VLAN0001 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +28673 +0011.92b0.f500 +19 +2 (FastEthernet0/2) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Chapter 3: Spanning Tree Protocol 127 + +Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) +Address 000e.837b.3100 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 300 + +Interface Role Sts Cost Prio.Nbr Type +---------------- ---- --- --------- -------- -------------------------------- + +Fa0/1 Altn BLK 19 +Fa0/2 Root FWD 19 +Fa0/4 Desg FWD 19 +Fa0/13 Desg FWD 100 + +128.1 P2p +128.2 P2p +128.4 P2p +128.13 Shr + + +! Above, the port state of BLK and FWD for each port is shown, as well as the +! Root Port and the Designated Ports. +! Below, Switch3's VLAN 1 port cost is changed on its Root Port (Fa0/2), +! causing SW3 to reconverge, and pick a new RP. + +SW3# conf t +Enter configuration commands, one per line. End with CNTL/Z. +SW3(config)# int fa 0/2 +SW3(config-if)# spanning-tree vlan 1 cost 100 +SW3(config-if)# ^Z + +! The next command was done immediately after changing the port cost on +! SW3. Note the state listed as "LIS," meaning Listening. STP has already +! chosen Fa0/1 as the new RP, but it must now transition through Listening +! and Learning states. + +SW3# sh spanning-tree vlan 1 +VLAN0001 +Spanning tree enabled protocol ieee + +Root ID Priority +Address +Cost +Port + +28673 +0011.92b0.f500 +38 +1 (FastEthernet0/1) + +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec + +Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) +Address 000e.837b.3100 +Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec +Aging Time 15 +128 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Interface Role Sts Cost Prio.Nbr Type +---------------- ---- --- --------- -------- -------------------------------- + +Fa0/1 Root LIS 19 +Fa0/2 Altn BLK 100 +Fa0/4 Desg FWD 19 +Fa0/13 Desg FWD 100 + +128.1 P2p +128.2 P2p +128.4 P2p +128.13 Shr + + +The preceding example shows one way to configure the priority to a lower value to become the root. Optionally, the spanning-tree vlan vlan-id root {primary | secondary} [diameter diameter] command could be used. This command causes the switch to set the priority lower. The optional diameter parameter causes this command to lower the Hello, ForwardDelay, and MaxAge timers. (This command does not get placed into the configu-ration, but rather it acts as a macro, being expanded into the commands to set priority and the timers.) + + +Note When using the primary option, the spanning-tree vlan command sets the prior-ity to 24,576 if the current root has a priority larger than 24,576 or its priority is 24,576 and its MAC address is higher than the current switch’s MAC (that is, if setting the priority of 24,576 allows the current switch to become the root). Otherwise, this command sets this switch’s priority to 4096 less than the current root. With the secondary keyword, +this switch’s priority is always set to 28,672. Also note that this logic applies to when the configuration command is executed; it does not dynamically change the priority if another switch later advertises a better priority. + + + +Rapid Spanning Tree Protocol + +IEEE 802.1w Rapid Spanning Tree Protocol (RSTP) enhances the 802.1D standard with one goal in mind: improving STP convergence. Updates to the entire protocol operation are multifold and result in a dramatic increase of its convergence speed—well below 1 second in properly designed networks. + +New Port Roles, States and Types, and New Link Types + +RSTP has significantly reworked the classification of port and link properties to stream-line and optimize its operation. Properties of ports include port states, port roles, and port types. In addition, links interconnecting RSTP switches also have their types . + +The number of port states has been reduced from five to three: While 802.1D STP defines Disabled, Blocking, Listening, Learning, and Forwarding states, 802.1w RSTP defines only Discarding, Learning, and Forwarding states. Discarding and Forwarding states are stable states; Learning is a transitory state. This cleanup relates to the fact that a port can either be in stable state, that is, Forwarding or Discarding, for an unlimited time in the absence of any topological changes, or can be in a transitory Learning state, going +Chapter 3: Spanning Tree Protocol 129 + +from Discarding to Forwarding over a limited time period. Table 3-5 compares the port states defined by each protocol. + +Table 3-5 RSTP and STP Port States +Key +Topic Administrative State STP State (802.1D) RSTP State (802.1w) + +Disabled + +Enabled + +Enabled + +Enabled + +Enabled + +Disabled + +Blocking + +Listening + +Learning + +Forwarding + +Discarding + +Discarding + +Discarding + +Learning + +Forwarding + + + + + + + + + + + + + +Key Topic + +In RSTP, a Discarding state means that the port does not forward data frames, receive data frames, or learn source MAC addresses, regardless of whether the port was shut down, failed, or simply does not have a reason to forward frames. Note that even a Discarding port, similarly to the Blocking state in legacy STP, continues to process received BPDUs; send BPDUs (depending on its role); and send and receive frames of +inter-switch signaling protocols such as DTP, VTP, CDP, LLDP, PAgP, LACP, or LOOP. The Discarding is also the default state of a port that has newly come alive (with the excep-tion of an Edge port whose default state is Forwarding). + +RSTP decouples the state of the port from its purpose, or a role, in a topology, and +defines four separate port roles: + + +■ Root Port (maintains its usual meaning) + +■ Designated Port (maintains its usual meaning) + +■ Alternate Port (a prospective replacement for the switch’s own Root Port) + +■ Backup Port (a prospective replacement for the switch’s own Designated Port into a shared segment) + +This decoupling allows for better definition of what function a port fulfills in a topology without inferring its role purely from its state. Also, this split underlines the fact that dur-ing transitory periods, Root and Designated Ports can be put into Discarding or Learning states, or—as is in the case of the Proposal/Agreement process—these can be skipped. Table 3-6 lists individual RSTP port roles, how they are determined, and their purpose. +130 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 3-6 RSTP Port Roles + + +RSTP Role +Root Port + +Designated Port + +Alternate Port + + + + + + +Backup Port + +Definition +Same as 802.1D Root Port. + +Same as 802.1D Designated Port. + +A replacement Root Port. Alternate Ports are ports receiving BPDUs from other switches but not meeting requirements to become Root or Designated. Such a port is attached to a neighboring switch and provides a possible alternate path toward the root. Upon the loss of the current Root Port, the Alternate Port receiving the best resulting BPDUs will be rapidly promoted to the role of Root Port and moved to the Forwarding state. +A replacement Designated Port. Backup Ports are ports receiving BPDUs from the same switch but not meeting requirements to become Designated. Such a port is attached to the same link as another port on the same switch, but the other port is Designated for that segment. The +Backup Port is ready to take over if the DP fails; however, this takeover is not rapid. Rather, it is driven by timers. + + + +The Alternate Port concept offers protection against the loss of a switch’s Root Port, also called a direct link failure, by keeping track of the Alternate Ports with a path to the root. If the current Root Port fails, RSTP will simply compare the resulting BPDUs (BPDUs stored on ports after incrementing the Root Path Cost by the receiving port’s +cost) on Alternate Ports and choose the port with the superior resulting BPDU as the new Root Port. This port will be immediately declared Root Forwarding. Figure 3-11 illus-trates this process. + + +Root Sec. Root + + + +Root Alternate Port Port + + +Figure 3-11 Use of Alternate Port to Replace Lost Root Port (Direct Link Failure) + +The Backup Port role provides protection against losing the Designated Port attached to a shared link when the switch has another physical port attached to the same shared LAN. As this is a shared link, there is no rapid convergence. After the Designated Port fails, all Backup Ports for the same link become Designated Discarding after missing three BPDUs in a row from the former Designated Port (expiry of Rapid Spanning Tree [RST] BPDUs will be described in the next section). Out of them, only a single port will remain Designated Discarding; the others will again revert to Backup Discarding after receiving the BPDU from the newly elected Designated Port. This new Designated Port +Chapter 3: Spanning Tree Protocol 131 + + + + + + + + +Key Topic + +will gradually move from Discarding through Learning to Forwarding. As Proposals are not sent on ports connected to shared links, there is no way of safely moving a Backup Port to Designated rapidly. + +The default role for a port that has newly come alive is Designated. + +Finally, in RSTP, ports have types: A port can be either an Edge or a Non-Edge port. This property is already well known thanks to the Cisco PortFast feature. An Edge Port immediately becomes Designated Forwarding after coming up. It still sends BPDUs but it expects not to receive any. Should a BPDU be received by an Edge port, this port will revert to the Non-Edge type and start operating as a common RSTP port. No commands will be removed from the configuration; only the runtime operational type of the port will change. The port will again become an Edge port after it goes down and comes up again, either through disconnect/reconnect or through shutting it down and reactivating. There is no reliable way of automatically detecting whether a port is an Edge or a Non-Edge port. The default port type on Cisco Catalyst switches is Non-Edge. + +Regarding links, RSTP recognizes two link types: + + +■ Point-to-point link: A link that connects an RSTP switch to at most one neighboring RSTP switch. + +■ Shared link: A link that connects an RSTP switch to two or more neighboring switches. + +In most modern LAN designs with no hubs or non-STP switches that create a shared communication environment from RSTP’s viewpoint, all links would be of the point-to-point type. Most of RSTP’s improvements in its reaction speed are usable only on point-to-point links. On shared links, RSTP reverts to slow operation driven by timers similar to STP. There is no reliable way of detecting whether a link is point-to-point or shared. However, Catalyst switches try to be somewhat smart in this aspect: If a port negotiates half-duplex operation with its connected neighbor, the switch assumes that the neighbor is a hub (as hubs are incapable of supporting full-duplex), and it will consider the link type to be shared. If a port negotiates full-duplex operation, the switch will assume that +the neighbor is a switch running RSTP, and will treat the link as point-to-point. Obviously, this decision process is just a guess and there are easily presentable situations where this logic fails (for example, running half-duplex on a point-to-point link between two switch-es because of some technical difficulties or peculiarities of the link, or having three or more RSTP switches interconnected by an unmanaged switch together that do not run STP). There is no one-to-one correspondence between the duplex mode and the link type. In cases this heuristic fails, the link type can be configured on a per-port basis using the spanning-tree link-type { point-to-point | shared } command. + + +Note The default port role and port state are Designated Discarding—this is the combi-nation of roles and states applied to a port at the moment it becomes live. The default port type is Non-Edge. The default link type depends on the duplex mode of the port—for full-duplex, it is point-to-point; for half-duplex, it is shared. +132 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Changes to BPDU Format and Handling + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + +Key Topic + +In RSTP, there is only a single type of BPDU used both for building a loop-free topology and for topology change notification purposes. TCN BPDUs are not used by RSTP. For RSTP, the Protocol Version field is set to 2 (legacy STP uses Version 0; Version 1 was an STP variant for Remote MAC Bridging according to the 802.1G standard but was never widely deployed). + +The Flags field has been updated. In 802.1D STP BPDUs, only 2 bits out of 8 are used: TC (Topology Change) and TCA (Topology Change Acknowledgment). RSTP uses the 6 remaining bits as well to encode additional information: Proposal bit, Port Role bits, +Learning bit, Forwarding bit, and Agreement bit. The TCA bit is not used by RSTP. This change allows implementing the Proposal/Agreement mechanism and also allows a BPDU to carry information about the originating port’s role and state, forming the basis of RSTP’s Dispute mechanism, protecting against issues caused by unidirectional links. + +In STP, Configuration BPDUs are originated by the root switch only. A nonroot switch does not originate its own Configuration BPDUs; rather, it waits for a BPDU to arrive on its Root Port to relay it farther out its own Designated Ports after updating its contents. This delays an appropriate reaction to a sudden loss of received BPDUs on a port—their lack only indicates a problem somewhere between the root switch and the current switch. The switch needs to wait for MaxAge-MessageAge seconds for the BPDU stored on the Root Port to expire. In RSTP, each switch originates BPDUs on its own, with their con-tents nevertheless based on the information from the BPDU stored on the switch’s Root Port. RSTP BPDUs therefore become more similar to a Hello mechanism known from routing protocols. If a switch ceases to receive RSTP BPDUs on its port, it is certain that the problem is contained on the link between this switch and its neighbor. This allows RSTP switches to age out BPDUs much sooner—in a 3x Hello interval. Three missing Hellos in a row cause a port to age out the stored BPDU. The MessageAge field value no longer has an influence on BPDU’s expiry. Instead, it serves the role of a hop count. Any BPDU whose MessageAge is equal to or higher than its MaxAge will be discarded upon arrival. + +RSTP improves handling of inferior BPDUs sent by the designated switch on a segment. In STP, if a designated switch (that is, a switch having a Designated Port on a segment) suddenly started sending BPDUs that are inferior to the BPDUs sent earlier, remain- +ing switches on the segment would ignore them until the superior BPDU expired from their ports, which is after MessageAge-MaxAge seconds (values taken from the superior BPDU). In RSTP, an inferior BPDU originated by a designated switch on a segment is accepted right away, immediately replacing previously stored BPDUs on receiving ports of attached switches. In other words, if a designated switch on a segment suddenly sends an inferior BPDU, other switches on the segment will immediately accept it as if the superior stored BPDU expired just when the inferior BPDU arrived, and reevaluate their own port roles and states on the segment according to usual rules. This behavior allows a switch to rapidly react to a situation where the neighboring switch experiences a disrup-tive change in its own connectivity toward the root switch (this is called an indirect link +failure). Consider the situation in Figure 3-12. +Chapter 3: Spanning Tree Protocol 133 + + + + + +1 + +Link fails. + +Root + + +Root Port + +AccessSw + +2 + +My RP failed. I am receiving no other Hellos. +Root I must be the root now! +Port +4 Sec. Root +I am receiving Hellos with superior root BID. +Designated +Port +I am no longer root, and Alternate this is my root port. +Port + +3 + +I am suddenly receiving worse Hellos from my designated switch. Accepting them right away. They are inferior to even my own Hellos on this port. +I am now designated on this segment! + + +Figure 3-12 Accepting Inferior BPDUs from Designated Switch (Indirect Link Failure) + +To better understand the need for this improvement, it is important to realize that if an inferior BPDU arrives from the designated switch, the designated switch or its own +upstream switches must have encountered a change for the worse to their connectivity toward the root switch—the root path cost might have increased, or the Root Bridge ID itself might have changed to a higher value. If the root path cost has increased, the neighboring switch might no longer be using the shortest available path toward the root +switch, and possibly, the next shortest path to the root switch might be through the cur-rent switch. If the Root Bridge ID has increased, the neighboring switch believes that the root switch has changed, but the true root switch might be different. In both cases, this inferior information has to be processed immediately to find out whether the neighboring switch has to be updated about the root switch’s identity or about a better path toward it. This is accomplished by accepting and processing the inferior BPDU, and running the usual sequence of steps: reevaluating the role of the switch (whether it should become the root switch itself), reevaluating the choice of a Root Port, and reevaluating roles of remaining ports. If the port toward the neighbor becomes Designated (before the change, it could only have been Root or Alternate), it will start sending BPDUs, thereby updating the neighbor about the root switch and the available root path cost. + +Proposal/Agreement Process in RSTP + +Improvements described so far allow a switch or its neighbors to rapidly recover from a lost connectivity to the root switch. However, a connectivity disruption can also be +caused by adding a new link into the topology that causes one of the switches to reelect its Root Port and place it on the added link (that is, the added link provides a better path to the root switch). RSTP uses the Proposal/Agreement process on a point-to-point link to rapidly put such a link into operation without causing a temporary switching loop or significant interruptions in the communication. +134 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +If a newly added point-to-point link causes one of the attached switches to place its Root Port on this new link, the roles of remaining ports on this switch can move from Root +or Alternate to Designated (the root path cost of this switch can decrease below the costs of its neighbors). As the neighboring switches might not yet be informed about the changes on this switch, they might still have some of their ports toward this switch in the Designated role, too. This would cause a switching loop. Therefore, a loop has to be pre-vented locally on the switch that is performing its Root Port changeover. In addition, after the neighboring switches are informed about the potentially decreased root path cost of this switch, they might also decide to change their Root Ports to point toward this switch, causing them to face the very same task as the current switch. An addition of a new link to the topology can therefore have a cascading effect of several switches updating their Root Ports, and this needs to be handled rapidly and in a loop-free manner. + +Preventing a switch from creating a switching loop by rapidly changing and activating its Root Port can be done by having this switch put all its Non-Edge Designated ports into Discarding state before the new Root Port is put into Forwarding state. Note that the Non-Edge Designated ports include those ports that have moved from old Root and Alternate roles to Designated after a superior resulting BPDU was received on the new Root Port and the switch reevaluated the roles of all ports. + +This procedure alone would allow a switch to rapidly change its Root Port while main-taining a loop-free topology, but at the same time, it would cause a major disruption in the communication because the switch is effectively isolated from the network: While its new Root Port might be made Forwarding, the upstream neighbor’s Designated Port on the added link is still in the Discarding or Learning state. In addition, all Non-Edge +Designated ports on this switch have been put into the Discarding state as well to prevent a possible loop. To avoid waiting twice for the ForwardDelay timer, an explicit signaling scheme between the switches needs to be used, allowing them to confirm that it is safe to put a Designated Port into the Forwarding state. + +This signaling scheme is called Proposal/Agreement. The Proposal signifies the will-ingness of a port to become Designated Forwarding, while the Agreement stands for permission to do so immediately. After a new link point-to-point link is added between two switches, ports on both ends will come up as Designated Discarding, the default role and state for a Non-Edge port. Any Designated Port in a Discarding or Learning state sends BPDUs with the Proposal bit set. Both switches will therefore attempt to exchange BPDUs with the Proposal bit set (or simply a Proposal), assuming that they have the +right to be Designated. However, if one of the ports receiving a Proposal discovers that the Proposal constitutes the best received resulting BPDU, its role will change from Designated to Root (the state will remain Discarding yet). Other port roles on that switch will also be updated accordingly. Furthermore, a switch receiving a Proposal on its Root Port will immediately put all its Non-Edge Designated ports into a Discarding state. This operation is called Sync. A switch in Sync state is now isolated from the network, pre-venting any switching loop from passing through it: Its Root Port is still in the Discarding state (and even if it was Forwarding, the neighboring Designated Port is still Discarding or Learning), and its own Designated Ports are intentionally moved to the Discarding state. Now it is safe to move the new Root Port to the Forwarding state and inform the +upstream switch that it is now allowed to move its Designated Discarding or Learning +Chapter 3: Spanning Tree Protocol 135 + +port to the Forwarding state. This is accomplished by a switch sending a BPDU with the Agreement bit set (or simply an Agreement) through its Root Port after performing the Sync. Upon receiving an Agreement on its Designated Discarding or Learning port, the upstream switch will immediately move that port into the Forwarding state, completing the Proposal/Agreement exchange between two switches. + +As a result of the Proposal/Agreement and Sync operation, all Non-Edge Designated ports on the switch with the new Root Port have been moved to the Discarding state. Because all Designated Discarding and Designated Learning ports send Proposals, the Proposal/Agreement exchange has effectively moved from “above” the switch to “beneath” it (with respect to the root switch being at the “top” of the spanning tree), +constituting the cascading effect of switches pairwise reevaluating their choice of Root Ports, expressing their willingness to have their Designated Ports made Forwarding rap-idly (Proposals), and eventually receiving approvals to do so (Agreements). This process is illustrated in Figure 3-13, showing a wave-like sending of Proposals, performing Sync and generating Agreements in turn while pushing the Proposal/Agreement exchange down-stream. + + +1 1 +Proposal +Agreement +Proposal + +3 3 +Agreement +2 Sync 2 Sync + + +4 4 4 4 +Proposal +Agreement +Agreement +Proposal +Proposal +Agreement +Agreement +Proposal + + +6 6 + +5 Sync 5 Sync + + +6 6 + +5 Sync 5 Sync + + + + +Figure 3-13 Proposal/Agreement Mechanism in RSTP + + +Note Outages in a switched network can be caused by direct link failures (a switch los-ing its Root Port), indirect link failures (a neighbor losing its Root Port), adding a new root link, or a root switch changeover. RSTP has reaction mechanisms for each of these events: Direct link failures are handled by the best Alternate Port becoming a new Root Port, indi-rect link failures are handled by the concept of accepting inferior BPDUs from designated switches, adding a new root link is handled by the Proposal/Agreement mechanism, and the changeover of a root switch is handled by the combination of the mechanisms above. +136 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Note During the Proposal/Agreement exchange, all Non-Edge Designated ports will be moved to Discarding state (the Sync operation). If ports toward end hosts are not explic-itly configured as Edge ports using the spanning-tree portfast port level command or the spanning-tree portfast default global level command (both have an effect on access ports only), they will become Discarding during Sync. Because end hosts are incapable of send-ing RSTP Agreements, these ports will require twice the ForwardDelay interval to become Forwarding again, and the end hosts will experience major connectivity outages. In RSTP, it is of crucial importance to configure ports toward end hosts as Edge ports; otherwise the performance of the network might be perceived as being even worse than with 802.1D STP. + + + +Topology Change Handling in RSTP +Key +Topic As opposed to STP, which recognizes four distinct events as topology change events, RSTP simplifies this concept: Only a transition of a Non-Edge port from a non-Forward-ing state to the Forwarding state is considered a topology change event in RSTP. The rea-son is that a port that has newly become Forwarding can provide a better path to a set of MAC addresses than was previously available, and the CAM tables need to be updated. The loss of a Forwarding port is not a cause for topology change event anymore, as the set of MAC addresses previously learned on that port is definitely inaccessible unless some other port in the topology becomes Forwarding (which is handled as a topology change anyway) and possibly provides an alternate path toward them. + +The way of propagating topology change information has also changed. Instead of for-warding the information about a topology change using TCN BPDUs in a hop-by-hop fashion to the root switch and causing the root switch to send BPDUs with the TC flag set, RSTP switches immediately flood BPDUs with TC flag set. More precisely, a switch that detects a topology change on a port (that is, one of its own Non-Edge ports transi-tions into the Forwarding state) or learns about a topology change on a port (a BPDU with the TC flag set is received on its Root or Designated Port) will do the following: + + +■ +Key Topic + + +■ + +■ + +Set a so-called tcWhile timer to the value of the Hello time plus one second (older revisions of RSTP set this value to twice the Hello time) on all remaining Non-Edge Designated ports and Root Port if any, except the port on which the topology change was detected or learned. + +Immediately flush all MAC addresses learned on these ports. + +Send BPDUs with the TC flag set on these ports every Hello seconds until the +tcWhile timer expires. + + +This way, information about a topology change is rapidly flooded along the spanning tree in the form of BPDUs with the TC flag set, and causes switches to immediately flush their CAM tables for all ports except those ports on which the topology change was detected or learned, as they point in the direction of the topology change where a set of MAC addresses might have become reachable through a new or improved path. +Chapter 3: Spanning Tree Protocol 137 + +Edge ports never cause a topology change event, and MAC addresses learned on them are not flushed during topology change event handling. + +Rapid Per-VLAN Spanning Tree Plus (RPVST+) + + + + + + + + + +Key Topic + +RPVST+ is a form of running RSTP on a per-VLAN basis, analogous to PVST+. This provides the subsecond convergence of RSTP with the advantages of PVST+ described in the previous section. Thus, RPVST+ and RSTP share the same characteristics such as convergence time, Hello behavior, the election process, port states, and so on. RPVST+ is backwardly compatible with PVST+. Also the rules of interoperation of RPVST+ with CST regions running RSTP are the same. + +Configuring RPVST+ is straightforward. In global configuration mode, issue the spanning-tree mode rapid-pvst command. Also, it is very important to configure ports toward end hosts as Edge ports—either on a per-port basis using the spanning- +tree portfast command or globally using the spanning-tree portfast default com-mand. Both these commands have an effect only on ports operating in access mode. +Additionally, as explained earlier, most RSTP improvements are applicable only on point-to-point links. If the physical connections between switches are of the point-to-point nature but operate in half-duplex (abnormal for a correct point-to-point interconnection!), Cisco switches will treat these links as shared, as also evidenced by the acronym Shr in the show spanning-tree output. In these rare cases, if the link is truly point-to-point, the link type can be overridden using the spanning-tree link-type point-to-point interface level command. Apart from these specific configurations, all other configuration com-mands are of the same meaning as in PVST+. See the “Further Reading” section, later in +this chapter, for a source of more information on RPVST+. + + + +Note For RSTP and consequently RPVST+ to provide rapid reaction to changes in the net-work topology, all switches must run RSTP or RPVST+, all inter-switch links must be proper-ly installed and recognized as point-to-point links, and all ports toward end stations must be properly identified as edge ports. Failure to meet these three requirements will degrade the RSTP and RPVST+ performance, voiding its advantages. Ports toward legacy switches will revert to legacy 802.1D STP or PVST+ operation. On shared links, RSTP and RPVST+ revert to timers. On non-edge ports, RSTP and RPVST+ rely on the Proposal/Agreement procedure to provide rapid reaction, and if the neighboring device does not speak RSTP or RPVST+, it will not be able to send an Agreement in response to a Proposal. + + + +Multiple Spanning Trees: IEEE 802.1s + +IEEE 802.1s Multiple Spanning Trees (MST), sometimes referred to as Multiple STP (MSTP), defines a standards-based way to use multiple instances of STP in a network that uses 802.1Q VLANs. The following are some of the main benefits of 802.1s: + +■ Like PVST+, it allows the tuning of STP parameters on a per-instance basis so that while some port blocks for one set of VLANs, the same port can forward in another set of VLANs. +138 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ As opposed to PVST+, it does not run a separate STP instance for each and every VLAN because that is largely unnecessary: Usually only a handful of different span-ning trees is required and configured in a network. Running a separate STP instance for each VLAN in PVST+ merely results in multiple instances creating exactly the same spanning tree while consuming multifold system resources. Instead, MST +runs in instances whose existence is not directly related to any particular VLAN. Instances are created by configuration, and VLANs are subsequently mapped onto them. Spanning tree created by an MST instance is shared by all VLANs mapped onto that instance. + +■ Use 802.1w RSTP for rapid convergence in each instance, inheriting all its rapid convergence properties. The following advantages have been retained: general RSTP rules about BPDU expiry in a 3x Hello interval, acceptances of inferior BPDUs from designated switches, port roles/states/types, link types, Proposal/Agreement, and so on. + +■ At press time, various Catalyst platforms have a limit on the maximum number of concurrent STP instances. The 2960, 3560, and 3750 platforms, for example, sup-port at most 128 STP instances. If more than 128 VLANs are created and active on ports, some VLANs will not have any STP instance running and will not be protected against switching loops. If decreasing the number of active VLANs is not an option, neither PVST+ nor RPVST+ can be used, and MST is the only choice. + +■ MST is the only standards-based and interoperable version of STP supporting VLANs and suitable in multivendor switched environments. + + +MST Principles of Operation + + + +Key Topic + +MST organizes the network into one or more regions. An MST region is a group of switches that together use MST in a consistent way—they run the same number of MST instances and map the same sets of VLANs onto these instances, among other things. For example, in Figure 3-14, an MST region has been defined, along with connections to non-MST switches. Focusing on the left side of the figure, inside the MST region, you really need only two instances of STP—one each for roughly half of the VLANs. With two instances, the access layer switches will forward on their links to SW1 for one set of VLANs using one MST instance, and forward on their links to SW2 for the other set of VLANs using the second MST instance. + +One of the key benefits of MST over PVST+ is that it requires only one MST instance for a group of VLANs. If this MST region had hundreds of VLANs, and used PVST+, hun-dreds of sets of STP messages would be used. With MST, only one set of STP messages +is needed for each MST instance. +Chapter 3: Spanning Tree Protocol 139 + + +Non-MST Region Non-MST Region + + +Non-Cisco .1Q Non-Cisco Non-Cisco Non-Cisco + + +.1Q .1Q + +MST Region + +CST Topology + + + +3560 ISL +Root +Instance1 +.1Q .1Q .1Q +FWD +Instance1 FWD 2960 Instance2 Instance1 +FWD + +3560 +Root Instance2 + +.1Q +FWD Instance2 + +2960 + + +3560 + +MST appears as a single switch to the outside world + + + + +Figure 3-14 MST Operations + + + + +Key Topic + + + + + + + + + + + + + + +Key Topic + +MST reuses the concept of System ID Extension from IEEE 802.1t to embed the instance number into the Bridge ID. As the System ID Extension field contains 12 bits, the range of MST instance numbers is in the range of 0–4095, though at the time of this writ- +ing, different Catalyst platforms supported different ranges: 0–15 on Catalyst 2950, and 0–4094 on Catalyst 2960 and 3560. Furthermore, the MST standard allows for at most 65 active MST instances (instance 0 plus at most 64 user-definable instances). Apart from being higher than any reasonable network would require, this limit is also moti-vated by the fact that MST uses a single BPDU to carry information about all instances, and it must fit into a single Ethernet frame. While a typical Ethernet MTU of 1500B would allow for approximately 88 MST instances in total, the limit of 64 user-definable instances is sufficient for any practical needs and fits well into an ordinary Ethernet frame. In MST, a port sends BPDUs if it is Designated for at least one MST instance. As MST uses a single BPDU for all instances, it is possible to see both switches on a point-to-point link to send BPDUs to each other if each of these switches is Designated in a different MST instance. + +Out of all MST instances, the instance 0 has a special meaning. This instance is also called the Internal Spanning Tree, or IST, and serves several purposes. First, this instance always exists even if no other MST instances are created, providing a loop-free environ-ment to VLANs mapped onto it within a region. Without any additional configuration, all VLANs are mapped onto the IST. Second, the IST is the only instance that interacts with STP run on switches outside the MST region. Whatever port role and state are deter-mined by the interaction of IST on a region boundary with a neighboring switch, this +role and state will be inherited by all existing VLANs on that port, not just by VLANs +140 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +mapped onto the IST. This is a part of overall MST operations that makes the region appear as a single switch to other regions and non-MST switches. + +If the network consists of several MST regions, each of them can be visualized as a single switch. The view of the entire topology consisting of several MST regions can thus be simplified—instead of a region, imagine a single switch in its place while keeping the links interconnecting different regions in place. Obviously, the resulting network after this simplification can still contain loops if the regions are interconnected by redundant links. MST blocks these loops by building a so-called Common Spanning Tree (CST). This CST is simply a result of the interaction of individual ISTs on region boundaries, and con-stitutes a spanning tree between individual regions, consisting purely of links between MST regions. Also, if there was a non-MST (either STP or RSTP) part of the network, it would become an integral part of the CST. This CST has no per-VLAN semantics—it is a spanning tree interconnecting MST region boundaries and optionally spanning non-MST regions, shared by all VLANs. CST has two main purposes: + +■ It determines loop-free paths between regions. An important consequence is that loops between regions are blocked on inter-region links and not inside regions, just like loops between switches would be blocked on the inter-switch links, not +somewhere “inside” those switches. This behavior is consistent with the simplifying notion that from outside, an MST region can be perceived as just a single switch. + +■ CST is the only spanning tree that can be understood and participated in by non-MST (that is, STP and RSTP) switches, facilitating the interoperation between MST and its predecessors. In mixed environments with MST and STP/RSTP, STP/RSTP switches unknowingly participate in CST. Costs in CST reflect only the costs of links between regions and in non-MST parts of the network. These costs are called exter-nal costs by MST. + + + +Key Topic + +In each MST region, the CST on the region’s boundary merges with the IST inside the region. The resulting tree consists of a loop-free interconnection between MST regions “glued together” with loop-free interconnection inside each MST region, and is called the Common and Internal Spanning Tree, or CIST. This tree is the union of CST between regions and ISTs inside individual regions, and is a single spanning tree that spans the entire switched topology. As each MST region has its own IST root, CIST—consisting +of ISTs inside regions and CST between regions—can have multiple root switches as a result. These switches are recognized as the CIST Root Switch (exactly one for the entire CIST) and CIST Regional Root Switches (exactly one for the IST inside each region). CIST Regional Root Switch is simply a different name for an IST root switch inside a particular region. + +The CIST Root Switch is elected by the lowest Bridge ID from all switches that par-ticipate in CIST, that is, from all MST switches across all regions according to their IST Bridge IDs (composed of IST priority, instance number 0, and their base MAC address), and from all STP/RSTP switches, if present, according to the only Bridge IDs they have. If running a pure MST-based network, the CIST Root Switch will be the switch whose IST priority is the lowest (numerically), and in the case of a tie, the switch with the low- +est base MAC address. This switch will also become the root of IST inside its own MST +Chapter 3: Spanning Tree Protocol 141 + +region; that is, it will also be the CIST Regional Root Switch. As the CIST Root Switch has the lowest known Bridge ID in the CST, it is automatically the CST Root as well, although this observation would be important only in cases of mixed MST and non-MST environments. + +In other MST regions that do not contain the CIST Root Switch, only MST switches at the region boundary (that is, having links to other regions) are allowed to assert them-selves as IST root switches. This is done by allowing the CIST Regional Root ID to be set either to the Bridge ID of the switch itself if and only if the switch is also the CIST Root, or in all other cases, to the Bridge ID of an MST boundary switch that receives BPDUs from a different region. Remaining internal switches have therefore no way of participat-ing in IST root elections. From boundary switches, IST root switches are elected first by their lowest external root path cost to the CIST Root Switch. The external root path cost is the sum of costs of inter-region links to reach the region with the CIST Root Switch, or in other words, the CST cost of reaching the region with the CIST Root Switch; costs of links inside regions are not taken into account. In case of a tie, the lowest IST Bridge ID of boundary switches is used. Note that these rules significantly depart from the usual concept of the root switch having the lowest Bridge ID. In MST regions that do not con-tain the CIST Root Switch, the regional IST root switches might not necessarily be the ones with the lowest Bridge IDs. + +A CIST Regional Root Switch has a particular importance for a region: Its own CIST Root Port, that is, the Root Port to reach the CIST Root Switch outside the region, is called +the Master port (this is an added port role in MST), and provides connectivity from the region toward the CIST Root for all MST instances inside the region. + +Interoperability Between MST and Other STP Versions + +To understand the interoperation between MST and other STP versions, we first need to have a look at the way MST interoperates with non-MST switches running pure IEEE 802.1D STP or 802.1w RSTP without any per-VLAN semantics (let us call them simply non-MST switches). These non-MST switches run a single STP instance for all VLANs and so all VLANs share the same single spanning tree in the non-MST part of the network. Whatever role and state a non-MST switch puts a port into, this role and state are shared by all VLANs on that port. If a non-MST switch is to interoperate with one or more neighboring MST switches, these MST switches must give the impression of running a single STP or RSTP to non-MST switches. Also, because STP and RSTP do not understand nor see into the workings of MST in individual instances inside an MST region, the entire MST region is a single “black box” to STP and RSTP. It is quite logical, then, to treat this single “black box” as a single huge switch. This single switch +must speak a single instance of STP or RSTP on its boundary ports toward its non-MST neighbors, and whatever decisions are made about port roles and states on this boundary, they must apply to all VLANs. The non-MST switches accomplish this trivially by the very way they run IEEE STP/RSTP; the MST switches do this by speaking exclusively the MST instance 0, also called the IST, on boundary ports, formatted into ordinary STP or RSTP BPDUs, and applying the negotiated port roles and states on boundary ports to all +142 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +VLANs on those ports. The MST instance 0 has a key role here—it speaks to non-MST neighbors and it processes BPDUs received from them. + +The interoperation between an MST region and an older IEEE STP variant is relatively straightforward. The non-MST region speaks a single STP/RSTP instance. The MST region uses the IST to speak on behalf of the entire region to non-MST neighbors on boundary ports. The resulting boundary port roles and states derived from the interaction of IEEE STP/RSTP and IST are binding for all VLANs. + +Interaction between MSTP and Cisco’s PVST+ is significantly more complex to under-stand. PVST+ regions by definition run one STP or RSTP instance for each active VLAN. It might be tempting at first to have each received PVST+ BPDU processed by the particular MST instance to which the respective VLAN is mapped. This idea is futile, however. There can be two or more VLANs mapped to the same MST instance that have completely different root bridges, root path costs, and so on in the PVST+ region. Which root bridge IDs, root path costs, and other STP attributes shall be taken into account by this MST instance, then? Clearly, the idea of doing any “smart” mapping between PVST+ and MST instances is not the way to go. + +Instead, the idea of interoperation between MST and PVST+ stems from the basic idea of interoperation between MST and IEEE STP/RSTP. For both MST and PVST+ regions, a single representative is chosen to speak on behalf of the entire region, and the interac-tion between these two representatives determines the boundary port roles and states for all VLANs. Doing this is trickier than it seems, though. While the role and state of an +MST boundary will be unconditionally imposed on all VLANs active on that port (that is how MST boundary ports work), PVST+ ports have independent roles and states for each VLAN. If a single representative MST instance is chosen to speak on behalf of an MST region, its information must be delivered to PVST+ switches in such a way that every PVST+ instance receives the same information to make an identical, consistent choice. The word consistent becomes very important—it describes a process where both MST and PVST+ in all their instances arrive at the same port role and state determination even though only a single MST instance and a single PVST+ instance directly interact with each other. The purpose of the PVST Simulation mechanism is to allow for a consistent interoperation between MST and PVST+ regions. + +In the MST-to-PVST+ direction, the MST region again chooses the IST as the represen-tative, with the goal of speaking IST information to all PVST+ instances using PVST+ BPDUs. To allow the PVST+ region to make an identical, consistent decision based on IST’s attributes for all known VLANs, all PVST+ instances must receive the same IST information formatted in PVST+ BPDUs. Therefore, MST boundary ports replicate the IST’s BPDUs into PVST+ BPDUs for all active VLANs. This way, the MST supplies PVST+ neighbors with consistent information in all VLANs. A PVST+ neighbor receiving these BPDUs on any single port will therefore make an identical, consistent choice of that port’s role and state for all VLANs. + +In the opposite direction, MST takes the VLAN 1 as the representative of the entire PVST+ region, and processes the information received in VLAN 1’s BPDUs in IST. The boundary port’s role and state will be binding for all VLANs active on that port. +However, MST must make sure that the boundary’s port role and state as determined by +Chapter 3: Spanning Tree Protocol 143 + +interaction with VLAN 1’s STP instance truly represent the choice that all other PVST+ instances would also make; that is, it must ascertain whether the result of IST’s interaction with VLAN 1’s STP instance is consistent with the state of STP instances run in other VLANs. + +Let us analyze this in closer detail. The interaction of IST run on an MST boundary port and VLAN 1 PVST+ can basically result in three possible roles of the port: Designated, Root, or Non-Designated (whether that is Alternate or Backup is not relevant at this point). + +An MST boundary port will become a Designated Port if the BPDUs it sends out (car-rying IST data) are superior to incoming VLAN 1 PVST+ BPDUs. A Designated bound-ary port will unconditionally become Forwarding for all VLANs, not just for VLAN 1. Therefore, to make sure that the other PVST+ instances make a consistent decision, the boundary port must verify whether other PVST+ instances would also consider it to be a Designated Port. This is trivially accomplished by listening to all incoming PVST+ BPDUs and making sure that each of them is inferior to the boundary port’s own BPDUs. This forms our first PVST Simulation consistency criterion: + +PVST+ BPDUs for all VLANs arriving at a Designated boundary port must be inferior to its own BPDUs derived from IST. +Conversely, an MST boundary port will become a Root Port toward the CIST root bridge if the incoming VLAN 1 PVST+ BPDUs are so superior that they not only beat the boundary port’s own BPDUs but also are the best VLAN 1 PVST+ BPDUs received on any of the boundary ports. Obviously, this situation implies that the CIST Root is located in the PVST+ region and it is the root switch for VLAN 1. A root boundary port will unconditionally become forwarding for all VLANs. Therefore, to make sure that the other PVST+ instances make a consistent decision, the boundary port must also act like a Root Port toward root bridges in all remaining VLANs. This in turn implies that the root bridges for these VLANs must also be located in the PVST+ region and the Root Port toward them is exactly this particular boundary port. A simple, yet sufficient condition to make this happen is to verify whether incoming PVST+ BPDUs for VLANs other than 1 are identical or even superior to incoming PVST+ BPDUs for VLAN 1. This forms our second consistency PVST Simulation criterion: + +PVST+ BPDUs for VLANs other than VLAN 1 arriving at a root boundary port must be identical or superior to PVST+ BPDUs for VLAN 1. +Note that if System ID Extension is used, PVST+ BPDUs for different VLANs cannot be identical, and in fact, with the same priority on a PVST+ root switch for multiple VLANs, PVST+ BPDU for VLAN x is inferior to BPDU for VLAN y if x>y. Therefore, to meet the second consistency criterion, priorities for PVST+ root switches in VLANs other than VLAN 1 must be lower by at least 4096 from the priority of the PVST+ VLAN 1 root switch. + +In both these cases, if the criterion for a particular port role is not met, the PVST Simulation process will declare a PVST Simulation inconsistency and will keep the port in the blocked state until the consistency criterion for the port’s role is met again. Older switches report the offending port as Root Inconsistent; recent switches use the PVST Simulation Inconsistent designation instead. +144 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Finally, an MST boundary port will become a Non-Designated port if the incoming VLAN 1 PVST+ BPDUs are superior to its own BPDUs but not that superior to make this port a Root Port. A Non-Designated boundary port will unconditionally become Blocking for all VLANs. Therefore, to make sure that the other PVST+ instances make a consistent decision, the boundary port should verify whether also other PVST+ instances would consider it to be a Non-Designated port. This could be trivially accomplished +by listening to all incoming PVST+ BPDUs and making sure that each of them is supe-rior to the boundary port’s own BPDU; however, Cisco appears to have implemented a slight optimization here. If indeed this criterion was met, all PVST+ instances would consistently consider this port to be a Non-Designated port and the port would be blocked according to its Non-Designated role. If, however, this criterion was not met, +that is, at least one non-VLAN1 PVST+ BPDU was inferior to this port’s BPDU, the PVST Simulation inconsistency would be declared, and the port would be kept blocked. So in any case, the port will be blocked. Hence, for Non-Designated ports, there are no consis-tency checks performed because the port is blocked regardless. + +If it is necessary to operate a mixed MST and PVST+ network, it is recommended to make sure that the MST region appears as a root switch to all PVST+ instances by lower-ing its IST root’s priority below the priorities of all PVST+ switches in all VLANs. + +It is noteworthy to mention that if a Cisco MST switch faces a pure 802.1D STP or 802.1w RSTP switch, it will revert to the appropriate STP version on the interconnect-ing port, that is, STP or RSTP, according to the neighbor type. However, if a Cisco MST switch is connected to a PVST+ or RPVST+ switch, it will always revert to PVST+. In other words, Cisco MST interoperates with RPVST+ regions using only PVST+, revert-ing to PVST+ operation on a region boundary. This is an implementor’s decision made to +simplify the interworking between MST and RPVST+ regions—it requires less state to be stored and processed, particularly with respect to the Proposal/Agreement mechanism. + + +Note PVST Simulation consistency criteria require that for an MST Boundary port toward a PVST+ region to be Forwarding, one of the following conditions must be met: + +■ Either the boundary port’s own IST BPDUs are superior to all received PVST+ BPDUs regardless of their VLAN (in this case, the port becomes Designated; “if be Designated Port for VLAN 1, then be Designated Port for all VLANs”) + +■ Or the boundary port’s own IST BPDUs are inferior to received PVST+ BPDUs for VLAN 1, and they are in turn identical or inferior to received PVST+ BPDUs for other VLANs (in this case, the port becomes Root Port; “if be Root Port for VLAN 1, then be Root Port for all VLANs”) + + + +MST Configuration + +Configuring MST requires a certain degree of prior planning. First, it is necessary to decide whether multiple regions shall be used and where their boundaries shall be placed. Multiple regions allow having independent numbers of MST instances, VLAN-to-instance +Chapter 3: Spanning Tree Protocol 145 + +mappings, and individual instance roots in each region. The overall network operation can become more complex to understand and maintain, though. Each region must be subsequently assigned its name, configuration revision number, and VLAN-to-instance mapping table. The name, revision number, and VLAN-to-instance mappings are three mandatory elements of MST configuration and must match on all switches of a single region. The name and configuration revision number are carried in MST BPDUs in their plain form. Instead of transmitting the entire VLAN-to-instance mapping table, an MD5 hash is performed over it and its value is carried in MST BPDUs. The region name, revi-sion number, and the MD5 hash of the VLAN-to-instance mapping table are compared upon BPDU arrival and must match for two switches to consider themselves being in the same region. The hash value can be displayed using the show spanning-tree mst configuration digest EXEC command. On older switches, the digest keyword might be hidden but nevertheless accepted if typed in its entirety. + +A modification to the MST region configuration (name, revision, mapping of VLANs onto instances) on a single switch causes the switch to create its own region and trig-ger a topology change, possibly causing a transient network outage. Upgrading an MST region to a new configuration will therefore require a maintenance window. As changes +to VLAN-to-instance mappings are most common, it is recommended to premap VLANs into instances even before the VLANs are created. Creating (or deleting) a VLAN after it is mapped to an instance will not cause any topology change event with respect to MST. + +If it is necessary to operate a mixed MST and PVST+ network, it is recommended to make sure that the MST region becomes the region containing the CIST Root Switch. This can be accomplished by lowering the IST root switch’s priority (that is, the priority of the existing root of instance 0 in the MST region) below the priorities of all PVST+ switches in all VLANs. + +Finally, older Cisco switches have implemented a prestandard version of MST that differs in the BPDU format and some other details. A quick test to verify whether the switch supports the standard or prestandard MST version is to issue the show spanning-tree mst configuration digest command. If there is only a single MD5 digest displayed in the out-put, the switch supports prestandard MST only. If there are two MD5 digests displayed, the switch supports standard MST and also the prestandard MST for backward compat-ibility. If a switch implementing standard MST is to be connected to a switch running prestandard MST, the port toward the prestandard switch must be configured with the spanning-tree mst pre-standard command; otherwise, permanent switching loops can ensue or the switch will keep the port blocking until configured with this command. + +Configuration of MST can be accomplished by following these steps: + +Step 1. Enter MST configuration mode by using the spanning-tree mst configura-tion command. + +Step 2. From MST configuration mode, create an MST region name (up to 32 charac-ters) by using the name subcommand. + +Step 3. From MST configuration mode, define an MST revision number by using the revision command. +146 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Step 4. From MST configuration mode, map VLANs to an MST STP instance by using the instance command. + +Step 5. From MST configuration mode, after reviewing the MST configuration before performing the changes using the show current command and after the changes using the show pending command, you can either apply the changes using the exit command or cancel the changes using the abort command. Both commands will exit from the MST configuration mode. +Step 6. Globally enable MST using the spanning-tree mode mst command. + +Example 3-2 demonstrates configuring a switch with an MST region. + +Example 3-2 MST Configuration and show Commands Key +Topic ! First, the MST region configuration is entered, defining the name of the region +! to be CCIE, the configuration revision to 1, and creating four instances +! with different VLANs mapped onto them. Note that the VLANs do not need to be +! created at all; they can be pre-mapped into MST instances and created later. +! The show current shows the current (empty at the moment) MST configuration, +! the show pending shows the modified but still unapplied configuration. + +SW1(config)# spanning-tree mst configuration +SW1(config-mst)# name CCIE +SW1(config-mst)# revision 1 +SW1(config-mst)# instance 1 vlan 1-500 +SW1(config-mst)# instance 2 vlan 501-1000 +SW1(config-mst)# instance 3 vlan 1001-2047 +SW1(config-mst)# instance 4 vlan 2048-4094 +SW1(config-mst)# show current +Current MST configuration +Name [] +Revision 0 Instances configured 1 + + +Instance +-------- +0 + +Vlans mapped +--------------------------------------------------------------------- +1-4094 + +------------------------------------------------------------------------------- + +SW1(config-mst)# show pending +Pending MST configuration +Name [CCIE] +Revision 1 Instances configured 5 + + +Instance +-------- +0 +1 + +Vlans mapped +--------------------------------------------------------------------- +none +1-500 +Chapter 3: Spanning Tree Protocol 147 + +2 501-1000 +3 1001-2047 +4 2048-4094 +------------------------------------------------------------------------------- +SW1(config-mst)# exit +SW1(config)# spanning-tree mode mst + +! To modify the switch's priority, spanning-tree mst instance priority command +! must be used instead of spanning-tree vlan vlan-id priority. Also, modifying +! a port's cost or priority is accomplished using spanning-tree cost mst and +! spanning-tree port-priority mst commands instead of their counterparts utilizing +! the vlan keyword. They have no effect in MST mode. + +SW1(config)# spanning-tree mst 0 priority 0 +SW1(config)# spanning-tree mst 1 priority 4096 +SW1(config)# spanning-tree mst 2 priority 8192 + +! If switches in the region support VTPv3 then VTPv3 can be used to synchronize +! the MST region configuration across all switches in the VTP domain. As all +! switches in the VTP domain will share the same MST region configuration, they +! will all become members of the same MST region. Hence, there is a 1:1 relation +! between a VTPv3 domain and the MST region. + +SW1(config)# vtp domain CCIE +Changing VTP domain name from NULL to CCIE +*Mar 12 16:12:14.697: %SW_VLAN-6-VTP_DOMAIN_NAME_CHG: VTP domain name changed to CCIE. +SW1(config)# vtp version 3 +SW1(config)# +*Mar 12 16:12:18.606: %SW_VLAN-6-OLD_CONFIG_FILE_READ: Old version 2 VLAN configuration file detected and read OK. Version 3 +files will be written in the future. +SW1(config)# vtp mode server mst +Setting device to VTP Server mode for MST. +SW1(config)# do vtp primary mst +This system is becoming primary server for feature mst +No conflicting VTP3 devices found. +Do you want to continue? [confirm] +*Mar 12 16:12:46.422: %SW_VLAN-4-VTP_PRIMARY_SERVER_CHG: 0023.ea41.ca00 has become the primary server for the MST VTP feature +SW1(config)# + +! From this moment on, the entire spanning-tree mst configuration section will be +! synchronized across the entire VTPv3 domain, and changes to its contents on SW1 +148 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! as the primary server switch will be propagated to all switches in the domain. +! Note that MST region configuration revision is independent of VTPv3 revision +! number and will not be incremented by VTP automatically. VTP uses its own +! revision number which will be incremented. + + +Protecting and Optimizing STP + +This section covers several switch configuration tools that protect STP from different types of problems or attacks, depending on whether a port is a trunk or an access port. + +The previous edition of this book covered Cisco-proprietary extensions to legacy STP— the UplinkFast and BackboneFast features. These additions have been dropped from the current exam blueprint, and in addition, their core ideas (tracking Alternate Ports, accept-ing inferior BPDUs from designated switches) have been leveraged in RSTP and MST, becoming an integral part of their design. + +PortFast Ports + + + +Key Topic + +The PortFast is a well-known improvement in legacy STP and PVST+, and is a standard-ized enhancement in RSTP and MST. Essentially, it defines an Edge port. We will use both Edge port and PortFast port terms interchangeably. An Edge port becomes for-warding immediately after coming up, does not generate topology change events, does not flush MAC addresses from the CAM table as a result of topology change handling, and is not influenced by the Sync step in the Proposal/Agreement procedure. An Edge port sends BPDUs but it expects not to receive any BPDUs back. If a BPDU does arrive at a PortFast port, the operational PortFast status will be disabled on the port until it goes down and back up. + +The use of PortFast on ports toward end hosts is important for several reasons. First and foremost, it accelerates the port’s transition into the Forwarding state. Apart from saving twice the ForwardDelay time, it also remediates problems with overly sensitive DHCP clients on end hosts that report an error if no response from a DHCP server is received within a couple of seconds. Second, a somewhat less obvious but far more grave rea- +son to use PortFast is that in RSTP and MST, it prevents a port from being put into the Discarding state during Proposal/Agreement handling. Not taking care to configure Edge ports in a network running RSTP or MST will result in intermittent connectivity during topology changes, and while the network itself will reconverge in seconds at most (and usually much sooner), end hosts will suffer an outage for twice the ForwardDelay time. + +PortFast ports can be configured either directly on ports using the spanning-tree portfast command or on a global level using the spanning-tree portfast default com-mand. Both of these commands apply only to ports operating in access mode (that is, static access or dynamic mode that negotiated an access link). This behavior simply fol- +lows the logic that end hosts are usually connected to access ports while links to other +Chapter 3: Spanning Tree Protocol 149 + +switches operate as trunks. If PortFast is enabled globally, but some access port is nev-ertheless connected to another switch, PortFast can be explicitly disabled on that port using the spanning-tree portfast disable command. + +If a trunk port is connected to an end device, such as a router or a server, it can be forced into PortFast mode using the spanning-tree portfast trunk interface level command. Be sure, however, to never activate PortFast on ports toward other switches. RSTP and MST will take care of their rapid handling if the other switch also speaks RSTP or MST. + +Root Guard, BPDU Guard, and BPDU Filter: Protecting Access Ports + +Network designers probably do not intend for end users to connect a switch to an access port that is intended for attaching end-user devices. However, it happens—for example, someone just might need a few more ports in the meeting room down the hall, so he fig-ures that he could just plug a small, cheap switch into the wall socket. + +The STP topology can be changed based on one of these unexpected and undesired switches being added to the network. For example, this newly added and unexpected switch might have the lowest Bridge ID and become the root. To prevent such problems, BPDU Guard and Root Guard can be enabled on these access ports to monitor for incom-ing BPDUs—BPDUs that should not enter those ports, because they are intended for single end-user devices. Both features can be used together. Their base operations are as follows: + +■ BPDU Guard: Enabled per port or globally per PortFast-enabled ports; error disables the port immediately upon receipt of any BPDU. + +■ Root Guard: Enabled per port; ignores any received superior BPDUs to prevent this port from becoming the Root Port. Upon receipt of superior BPDUs, this switch puts the port in a root-inconsistent blocking state, ceasing forwarding and receiving data frames until the superior BPDUs cease. + + + +Key Topic + +The BPDU Guard can either be activated unconditionally on a per-port basis using the spanning-tree bpduguard enable interface command or globally using the spanning-tree portfast bpduguard default command. The global command, however, activates the BPDU Guard only on ports that operate as PortFast ports (it does not matter how the port was configured for PortFast operation). Again, in the case where BPDU Guard is enabled globally but it needs to be deactivated on a particular PortFast port, the spanning-tree bpduguard disable interface command can be used. + +There is often confusion regarding the relation of PortFast and BPDU Guard to each other. In reality, the only dependence between these mechanisms is concerned with con-figuring the BPDU Guard on a global level. In this case, it will be automatically activated on those ports on which PortFast is also active; in other words, the global activation of +BPDU Guard will activate it on all Edge ports. Besides this particular configurational +150 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + +Key Topic + +dependency, PortFast and BPDU Guard are completely independent. On a port, BPDU Guard can be configured regardless of PortFast. PortFast, either per-port or globally, can be configured regardless of BPDU Guard. + +Regardless of how the BPDU Guard is activated on an interface, when a BPDU is received on such a port, it will be immediately err-disabled. + +Root Guard can be activated only on a per-port basis using the spanning-tree guard root interface command. + +With BPDU Guard, the port does not recover from the err-disabled state unless addi-tional configuration is added. You can tell the switch to change from the err-disabled state back to an up state after a certain amount of time. With Root Guard, the port recov-ers automatically when the undesired superior BPDUs are no longer received for the usual MaxAge-Message age in STP, or 3x Hello in RSTP (effectively, when they expire). + +The BPDU Filter feature is concerned with stopping the transmission, and optionally the reception as well, of BPDUs on a port. Its behavior differs depending on how it is +activated: + + + +■ +Key Topic + + + + + + + + + + + + +■ + +If configured globally using spanning-tree portfast bpdufilter default, it applies only to Edge ports (that is, to ports on which PortFast is active). After these ports are connected to, they will start sending BPDUs each Hello interval; however, if dur-ing the next ten Hello intervals, no BPDU is received from the connected device, the port will stop sending BPDUs itself. As a result, the port will send only 11 BPDUs (one immediately after the port comes up, and then ten more during the ten Hello intervals) and then cease sending BPDUs. The port is still prepared to process any incoming BPDUs. If a BPDU arrives at any time, during the first ten Hello intervals or anytime after, BPDU Filter will be operationally deactivated on that port, and +the port will start sending and receiving BPDUs according to usual STP rules. BPDU Filter operation on this port will be reinstated after the port is disconnected and reconnected. As usual, if the global configuration of BPDU Filter applies to an Edge port on which you do not want BPDU Filter to be activated, you can exempt the port using the spanning-tree bpdufilter disable command. + +If configured locally on a port using the spanning-tree bpdufilter enable com-mand, BPDU Filter will cause the port to unconditionally stop sending and receiving +BPDUs altogether. + + +The use of BPDU Filter depends on how it is configured. The global BPDU Filter configu-ration causes Edge ports to stop sending BPDUs after a certain time, assuming that it is not useful to send BPDUs to end devices as they do not speak STP. If it is discovered that such a port is actually connected to a switch by receiving a BPDU, the BPDU Filter will be deactivated on the port until the port goes down and comes back up (through discon-nect/reconnect, or through shutting it down and activating it again). This can be consid-ered an optimization in networks with many access ports toward end devices. +Chapter 3: Spanning Tree Protocol 151 + +BPDU Filter configured directly on a port causes the port to stop sending and processing received BPDUs. No BPDUs will be sent; received BPDUs will be silently dropped. This configuration prevents STP from participating with any other switch on the port. Usually, this feature is used to split a network into separate independent STP domains. Because in this case, STP does not operate over these ports, it is unable to prevent a switching loop if the STP domains are redundantly interconnected. It is the responsibility of the adminis-trator, then, to make sure that there are no physical loops between the STP domains. + +Again, there is often confusion regarding the dependence of PortFast and BPDU Filter. Their true dependence is practically identical to that of BPDU Guard and PortFast. The only situation where BPDU Filter and PortFast are configurationally dependent is when BPDU Filter is configured on a global level, because in that case it automatically applies to all Edge ports (that is, ports with active PortFast). If a port on which BPDU Filter +is active because global configuration (meaning that it must have been an Edge port) receives a BPDU, it will lose its Edge status, and because the global BPDU Filter configu-ration applies to Edge ports, BPDU Filter on this port will be deactivated as well. Apart from this, no other dependency between BPDU Filter and BPDU Guard exists. + +It is possible to combine globally configured BPDU Filter with BPDU Guard (the BPDU Guard can be also configured globally or per-port in this case). Should a port protected both with global BPDU Filter and BPDU Guard receive a BPDU, it will be automatically err-disabled. + +On the other hand, it does not make sense to combine port-level BPDU Filter with BPDU Guard. As the port drops all received BPDUs, the BPDU Guard will never see them, meaning that it will never be able to put the port into an err-disabled state. + +Protecting Against Unidirectional Link Issues + +Unidirectional links are links for which one of the two transmission paths on the link has failed, but not both. This can happen as a result of miscabling, cutting one fiber cable, unplugging one fiber, GBIC problems, or other reasons. Because STP monitors incoming BPDUs to know when to reconverge the network, adjacent switches on a unidirectional link could both become Forwarding, causing a loop, as shown in Figure 3-15. + +Figure 3-15 shows the fiber link between SW1 and SW2 with both cables. SW2 starts in a Blocking state, but as a result of the failure on SW1’s transmit path, SW2 ceases to hear Hellos from SW1. SW2 then transitions to the Forwarding state, and now all trunks on all switches are Forwarding. Even with the failure of SW1’s transmit fiber, frames will now loop counterclockwise in the network. + +On Catalyst switches, there are several mechanisms available to detect and avoid issues caused by unidirectional links. These mechanisms include UDLD, STP Loop Guard, Bridge Assurance, and the RSTP/MST Dispute mechanism. + +Unidirectional Link Detection (UDLD), a Cisco-proprietary Layer 2 messaging protocol, serves as an echo mechanism between a pair of devices. Using UDLD messages, each switch advertises its identity and port identifier pair as the message originator, and a list +152 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +of all neighboring switch/port pairs heard on the same segment. Using this information, a unidirectional link can be detected by looking for one of the following symptoms: + + +■ +Key Topic + +UDLD messages arriving from a neighbor do not contain the exact switch/port pair matching the receiving switch and its port in the list of detected neighbors. This suggests that the neighbor either does not hear this switch at all (for example, a cut fiber) or the neighbor’s port sending these UDLD messages is different from that neighbor’s port receiving this switch’s own UDLD messages (for example, a Tx fiber +plugged into a different port than the Rx fiber). + + +One Trunk, Two Fiber Cables + + + + +SW1 RP FWD + + +DP FWD +Tx + +Rx + + +2 Hello Cost 19 + + +1 +Non-DP BLK + +SW2 RP FWD + +3 +No more Hellos. I must be the DP. Let me transition to forwarding! + + + + +DP FWD +Root SW3 + + +DP FWD + + +Figure 3-15 STP Problems with Unidirectional Links + +■ UDLD messages arriving from a neighbor contain the same switch/port originator pair as used by the receiving switch. This suggests a self-looped port. + +■ A switch has detected only a single neighbor but that neighbor’s UDLD messages contain more than one switch/port pair in the list of detected neighbors. This sug-gests a shared media interconnection with an issue in its capability to provide full visibility between all connected devices. + + + + + + + + + + + + + +Key Topic + +If any of these symptoms are detected, UDLD will declare the link as unidirectional and will err-disable the port. + +In addition, a unidirectional link can under circumstances also manifest itself by sudden loss of all incoming UDLD messages without the port going down. This symptom is not always a reliable indication of a unidirectional link, though. Assume, for example, two switches interconnected by a link utilizing a pair of metallic/optical media converters. If one switch is turned off, the other switch will not experience a link down event; just the UDLD messages stop arriving. Assuming that the link has become unidirectional would be presumptuous in this case. + +UDLD therefore has two modes of operation with the particular respect to the sudden loss of arriving UDLD messages. In the normal mode, if UDLD messages cease being +received, a switch will try to reconnect with its neighbors (eight times), but if this attempt +Chapter 3: Spanning Tree Protocol 153 + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + +Key Topic + +fails, UDLD takes absolutely no action. In particular, the port that stopped receiving UDLD messages will remain up. In the aggressive mode, after UDLD messages stop arriving, a switch will try eight times to reconnect with its neighbors, and if this attempt fails, UDLD will err-disable the port. The difference between the normal and aggressive mode therefore lies in the reaction to the sudden loss of incoming UDLD messages, that is, to an implicit indication of a possible unidirectional link condition. Note that both normal and aggressive modes will err-disable the port if the unidirectional link is explic-itly detected by the three symptoms described earlier. + +UDLD can be activated either on a global level or on a per-port basis, and needs to be activated on both interconnected devices. Global UDLD configuration applies only to fiber ports; per-port UDLD configuration activates it regardless of the underlying media type. On the global level, UDLD is activated with the udld { enable | aggressive } com-mand, the enable keyword referring to the normal mode and aggressive referring to the aggressive mode. On a port, UDLD is activated using the udld port [ aggressive ] com-mand. If the aggressive keyword is omitted, normal mode is used. Operational status +of UDLD including port information and detected neighbors and their states can be displayed using show udld and show udld neighbors commands. If UDLD err-disables a port after detecting a unidirectional link condition, apart from shutting it down and bringing it back up to reactivate it, a port can also be reset from the privileged EXEC mode using the udld reset command. + +STP Loop Guard is an added logic related to receiving BPDUs on Root and Alternate Ports on point-to-point links. In the case of a unidirectional link, these ports could move from Root or Alternate to Designated, thereby creating a switching loop. STP Loop Guard assumes that after BPDUs were being received on Root and Alternate Ports, it is not possible in a correctly working network for these ports to suddenly stop receiving BPDUs without them actually going down. A sudden loss of incoming BPDUs on Root and Alternate Ports therefore suggests that a unidirectional link condition might have occurred. + +Following this logic, STP Loop Guard prevents Root and Alternate Ports from becoming Designated as a result of total loss of incoming BPDUs. If BPDUs cease being received on these ports and their stored BPDUs expire, Loop Guard will put them into a loop-inconsistent blocking state. They will be brought out of this state automatically after they start receiving BPDUs again. + +Loop Guard can be activated either globally or on a per-port basis, and is a local protec-tion mechanism (that is, it does not require other switches to be also configured with Loop Guard to work properly). If activated globally using the spanning-tree loopguard default command, it automatically protects all Root and Alternate Ports on STP point-to-point link types on the switch. Global Loop Guard does not protect ports on shared type links. It can also be configured on a per-port basis using the spanning-tree guard loop command, in which case it applies even to ports on shared links. + +The Bridge Assurance, applicable only with RPVST+ and MST and only on point-to-point links, is a further extension of the idea used by Loop Guard. Bridge Assurance modi- +fies the rules for sending BPDUs. With Bridge Assurance activated on a port, this port +154 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + +Key Topic + +always sends BPDUs each Hello interval, whether it is Root, Designated, Alternate, or Backup. BPDUs thus essentially become a Hello mechanism between pairs of intercon-nected switches. A Bridge Assurance–protected port is absolutely required to receive BPDUs. If no BPDUs are received, the port will be but into a BA-inconsistent block-ing state until it starts receiving BPDUs again. Apart from unidirectional links, Bridge +Assurance also protects against loops caused by malfunctioning switches that completely stop participating in RPVST+/MST (entirely ceasing to process and send BPDUs) while opening all their ports. At the time of this writing, Bridge Assurance was supported on selected Catalyst 6500 and Nexus 7000 platforms. Configuring it on Catalyst 6500 Series requires activating it both globally using spanning-tree bridge assurance and on ports on STP point-to-point link types toward other switches using the spanning-tree portfast network interface command. The neighboring device must also be configured for Bridge Assurance. + +The Dispute mechanism is yet another and standardized means to detect a unidirectional link. Its functionality is based on the information encoded in the Flags field of RST and MST BPDUs, namely, the role and state of the port forwarding the BPDU. The principle of operation is very simple: If a port receives an inferior BPDU from a port that claims to be Designated Learning or Forwarding, it will itself move to the Discarding state. Cisco has also implemented the Dispute mechanism into its RPVST+. The Dispute mechanism is not available with legacy STP/PVST+, as these STP versions do not encode the port role and state into BPDUs. The Dispute mechanism is an integral part of RSTP/MST and +requires no configuration. + + + +Configuring and Troubleshooting EtherChannels + +EtherChannel, also known as Link Aggregation, is a widely supported and deployed tech-nology used to bundle several physical Ethernet links interconnecting a pair of devices into a single logical communication channel with increased total throughput. After an EtherChannel is established, it is represented to the devices as a single logical interface (called Port-channel in Cisco parlance), utilizing the bandwidth of all its member links. This allows for traffic load sharing between the member links, taking advantage of their combined bandwidth. Also, should a link in an EtherChannel bundle fail, the traffic will be spread over remaining working links without further influencing the state of the logi-cal interface. Control plane protocols that see only the logical Port-channel interface and not its underlying physical members, such as STP, will only notice a change in the inter-face’s bandwidth parameter (if not configured statically using the bandwidth command). The reaction to a failure or addition of a member link is therefore significantly more graceful than a reaction to a loss or reestablishment of a standalone link. + +Key Load Balancing Across Port-Channels +Topic EtherChannel increases the available bandwidth by carrying multiple frames over +multiple links. A single Ethernet frame is always transmitted over a single link in an EtherChannel bundle. A hashing function performed over selected frames’ address fields produces a number identifying the physical link in the bundle over which the frame will +Chapter 3: Spanning Tree Protocol 155 + +be forwarded. The sequence of frames having an identical value in a particular address field (or a set of fields) fed into the hashing function is called a conversation or simply a flow. This hashing function is deterministic, meaning that all frames in a single flow produce the same hash value, and are therefore forwarded over the same physical link. Hence, the increase in the available bandwidth is never experienced by a single flow; rather, multiple flows have a chance of being distributed over multiple links, achieving higher aggregated throughput. The fact that a single flow is carried by a single link and +thus does not benefit from a bandwidth increase can be considered a disadvantage; how-ever, this approach also prevents frames from being reordered. This property is crucial, as EtherChannel—being a transparent technology—must not introduce impairments that would not be seen on plain Ethernet. + +Load-balancing methods differ depending on the model of switch and software revision. Generally, load balancing is based on the contents of the Layer 2, 3, and/or 4 headers. +If load balancing is based on only one header field in the frame, that single field is fed into the hashing function. If more than one header field is used, first, an XOR operation between the selected fields is used and only the result of this XOR is fed into the hashing function. The details of hashing functions in use are not public and can vary between dif-ferent switch platforms. + +For the best balancing effect, the header fields on which balancing is based need to vary among the mix of frames sent over the Port-channel. For example, for a Layer 2 Port-channel connected to an access layer switch, most of the traffic going from the access layer switch to the distribution layer switch is probably going from clients to the default router. So most of the frames have different source MAC addresses but the same destina-tion MAC address. For packets coming back from a distribution switch toward the access layer switch, many of the frames might have a source address of that same router, with differing destination MAC addresses. So, you could balance based on source MAC at the access layer switch and based on destination MAC at the distribution layer switch—or balance based on both fields on both switches. The goal is simply to use a balancing method for which the fields in the frames vary. + +The port-channel load-balance type global level command sets the type of load balanc-ing. The type options include using source and destination MAC, IP addresses, and TCP and UDP ports—either a single field or both the source and destination. Because this command is global, it influences the operation of all EtherChannel bundles on a switch. Devices on opposite ends of an EtherChannel bundle can, and often do, use different load-balancing algorithms. + +The maximum number of active member links in an EtherChannel bundle is eight. This limit is reasonable, considering that Ethernet variants differ in speed by orders of tens (10 Mbps, 100 Mbps, 1 Gbps, 10 Gbps, 100 Gbps). More than eight links in an EtherChannel bundle is simply closing in on the next faster Ethernet variant, so it is reasonable to con-sider using a faster Ethernet variant in such cases instead. On many Catalyst switch plat-forms, the hashing function therefore produces a 3-bit result in the range of 0–7 whose values are assigned to the individual member links. With eight physical links in a bundle, +156 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +each link is assigned exactly one value from this range. If there are fewer physical links, some of the links will be assigned multiple values from this range, and as a result, some of the links will carry more traffic than the others. Table 3-7 describes the traffic amount ratios (Pn denotes the nth port in a bundle). + +Table 3-7 Load Spread Ratios with Different Port Numbers in EtherChannel + + +Number of Ports in the EtherChannel +8 + +7 + +6 + +5 + +4 + +3 + +2 + +Load-Balancing Ratios + +P1:P2:P3:P4:P5:P6:P7:P8 → 1:1:1:1:1:1:1:1 +P1:P2:P3:P4:P5:P6:P7:P1 → 2:1:1:1:1:1:1 +P1:P2:P3:P4:P5:P6:P1:P2 → 2:2:1:1:1:1 +P1:P2:P3:P4:P5:P1:P2:P3 → 2:2:2:1:1 +P1:P2:P3:P4:P1:P2:P3:P4 → 2:2:2:2 +P1:P2:P3:P1:P2:P3:P1:P2 → 3:3:2 +P1:P2:P1:P2:P1:P2:P1:P2 → 4:4 + + + +Under ideal conditions, the traffic distribution across member links will be equal only if the number of links is eight, four, or two. With the eight resulting values from a 3-bit +hash function, each value represents 1/8=12.5% of the traffic. The spread of the traffic by multiples of 12.5% is quite coarse. The indicated ratios can also be computed by using DIV and MOD operations: For example, with three links in a bundle, each link will be assigned 8 DIV 3 = 2 resulting hash values, plus 8 MOD 3 = 2 links will be handling an additional hash result value, yielding a ratio of (2+1):(2+1):2 = 3:3:2, or 37.5% : 37.5% : 25%. + +On other Cisco switch platforms, an 8-bit hash result is used although the EtherChannel is still limited to a maximum of eight links. Because the hash value allows for 256 pos-sible results, each value represents a mere 1/256 = 0.390625% of the traffic. The spread of the traffic across links in a bundle is thus much more fine-grained. With three links, each of them would be assigned 256 DIV 3 = 85 resulting hash values, plus a 256 MOD 3 = 1 link would be handling an additional hash result value. So the traffic split ratio would be 86:85:85, or approximately 33.6% : 33.2% : 33.2%, much more balanced than 3:2:2. + +It is sometimes incorrectly stated that a Port-channel can only operate with two, four, or eight links. That is incorrect—a Port-channel can operate with any number of links between one and eight, inclusive. The spreading of total traffic across links can be uneven, however, if the number of links is not a power of 2, as previously explained. +Chapter 3: Spanning Tree Protocol 157 + +Port-Channel Discovery and Configuration + +When you are adding multiple ports to a particular Port-channel on a single switch, sev-eral configuration items must be identical, as follows: + +Key ■ Same speed and duplex settings. +Topic ■ Same operating mode (trunk, access, dynamic). + +■ If not trunking, same access VLAN. + +■ If trunking, same trunk type, allowed VLANs, and native VLAN. + +■ On a single switch, each port in a Port-channel must have the same STP cost per VLAN on all links in the Port-channel. + +■ No ports can have SPAN configured. + +Some of these limitations can change over time—it is recommended to consult the Configuration Guide for your particular switch platform and IOS version to stay up to date. + +When a new Port-channel is created, an interface Port-channel is automatically added to the configuration. This interface inherits the configuration of the first physical interface added to the Port-channel, and the configuration of all other physical interfaces added to the same Port-channel will be compared to the interface Port-channel configuration. If they differ, the physical interface will be considered as suspended from the Port-channel, and it will not become a working member until its configuration is made identical to that of the Port-channel interface. Configuration changes performed on the interface Port-channel apply only to nonsuspended member ports; that is, commands applied to the Port-channel interface are pushed down only to those physical member ports whose con-figuration matched the interface Port-channel configuration before making the change. Therefore, reentering the configuration on the Port-channel interface in hopes of unifying the configuration of all member ports will not have an effect on those ports whose cur-rent configuration differs from that of the Port-channel interface. It is therefore recom-mended to adhere to the following guidelines when configuring Port-channels: + + +Key ■ Topic + +■ + + + +■ + + +■ + +Do not create the interface Port-channel manually before bundling the physical ports under it. Let the switch create it and populate its configuration automatically. + +On the other hand, when removing a Port-channel, make sure to manually remove the interface Port-channel from the running config so that its configuration does not cause issues when a Port-channel with the same number is re-created later. + +Be sure to make the configuration of physical ports identical before adding them to the same Port-channel. + +If a physical port’s configuration differs from the interface Port-channel configura-tion, correct the physical port’s configuration first. Only then proceed to perform +changes to the Port-channel interface configuration. +158 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ A Port-channel interface can either be Layer 2 (switched) or Layer 3 (routed), depending on whether the physical bundled ports are configured as Layer 2 +(switchport) or Layer 3 (no switchport). After a Port-channel has been created with a particular operating level, it is not possible to change it to the other mode with-out re-creating it. If it is necessary to change between Layer 2 and Layer 3 levels of +operation, the Port-channel must be removed from configuration and re-created after the physical ports are reconfigured for the required level of operation. It is possible, though, to combine the Layer 2 Port-channel on one switch with the Layer 3 Port-channel on another, although not necessarily a best practice. + +■ Whenever resolving an issue with err-disabled ports under a Port-channel interface, be sure to shut down both the physical interfaces and the interface Port-channel itself. Only then try to reactivate them. If the problem persists, it is recommended to remove the Port-channel altogether from the configuration, unbundling the ports as a result, and re-create the Port-channel. + +You can statically configure interfaces to be in a Port-channel by using the channel-group number mode on interface subcommand. You would simply put the same com-mand under each of the physical interfaces inside the Port-channel, using the same Port-channel number. This configuration forces the ports to become members of the same Port-channel without negotiating with the neighboring switch. This way of creating a Port-channel is strongly discouraged, though. If one switch considers multiple physical ports to be bundled under a single Port-channel while the neighboring switch still treats them as individual or assigns them into several bundles, permanent switching loops can occur. Also, this static Port-channel configuration is not capable of detecting whether the bundled ports are all connected to the same neighboring device. Having individual ports in a single Port-channel connect to different neighboring switches can again lead to per-manent switching loops. To understand how the switch loop ensues, consider the topol-ogy shown in Figure 3-16. + + +Designated Port +Root + +Root Port +Sec. Root + + + +Designated Port + +Designated +Port +Alternate Root Port +Port Designated +Port +AccessSw + + +Figure 3-16 Permanent Switching Loop in a Misconfigured EtherChannel + +In this topology, the ports on the Secondary Root switch toward AccessSw have already been bundled in a Port-channel using mode on, and the switch uses them as a single EtherChannel right away, without negotiating with AccessSw. However, AccessSw is not yet configured for Port-channel on these ports, and treats them as individual links. +Chapter 3: Spanning Tree Protocol 159 + + + +Key Topic + +Because Port-channel interfaces are treated as single ports by STP, only a single BPDU is sent for the entire Port-channel interface, regardless of how many physical links are bundled. This BPDU is also subject to the hashing function and forwarded over a single link in the entire Port-channel bundle. Assuming that the Secondary Root has the sec-ond-lowest priority in this network and that the BPDUs are forwarded over the left link +toward AccessSw, the corresponding port on AccessSw is Alternate Discarding. However, the AccessSw port on the right link is not receiving any BPDUs and becomes Designated Forwarding as a result. Even though such a port sends BPDUs, they will be ignored by the Secondary Root switch because they are inferior to its own BPDUs. Hence, a perma-nent switching loop is created. This is also the reason why a switch shuts down all physi-cal ports when no interface Port-channel is issued—to prevent switching loops when Port-channel configuration is being removed. + +Note that if using RSTP/MST, the Dispute mechanism would detect this problem and put the Port-channel on the Secondary Root switch to the Discarding state, preventing this loop. In addition, Cisco has implemented yet another prevention mechanism called STP EtherChannel Misconfig Guard on its switches. This mechanism makes an assumption that if multiple ports are correctly bundled into a Port-channel at the neighbor side, all BPDUs received over links in this Port-channel must have the same source MAC address in their Ethernet header, as the Port-channel interface inherits the MAC address of one of its physical member ports. If BPDUs sourced from different MAC addresses are received on a Port-channel interface, it is an indication that the neighbor is still treating the links as individual, and the entire Port-channel will be err-disabled. Note that the detection +abilities of the EtherChannel Misconfig Guard are limited. In the topology in Figure 3-16, this mechanism will not help because the Secondary Switch receives just a single BPDU from AccessSw over the right link, and has no other BPDU to compare the source MAC address to. The mechanism would be able to detect a problem if, for example, there were three or more links between Secondary Root and AccessSw, or if the two existing links were bundled at the AccessSw instead of Secondary Root. The EtherChannel Misconfig Guard is active by default and can be deactivated using the no spanning-tree etherchan-nel guard misconfig global configuration command. + +It is therefore strongly recommended to use a dynamic negotiation protocol to allow switches to negotiate the creation of a Port-channel and verify whether the links are eli-gible for bundling. Those protocols are the Cisco-proprietary Port Aggregation Protocol (PAgP) and the open IEEE 802.1AX (formerly 802.3ad) Link Aggregation Control Protocol (LACP). Both protocols offer relatively similar features though they are mutu-ally incompatible. On a common Port-channel, both switches must use the same negotia-tion protocol; different Port-channel interfaces can use different negotiation protocols. Using LACP is generally preferred because of its open nature and widespread support. + +PAgP allows a maximum of eight links in a Port-channel. A switch will refuse to add more than eight links to a PAgP Port-channel. On current Catalyst switches, PAgP has no user-configurable parameters apart from the frequency of sending PAgP messages. This frequency is configurable on a per-port basis using the pagp timer { normal | fast } com- +mand; normal frequency is 30 seconds after the Port-channel is established, and fast is a +160 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +1-second frequency. Other available commands related to PAgP have no effect on the for-warding behavior of the switch, and are kept only for backward compatibility with very old switches. + +With LACP, a maximum of 16 links can be placed into a Port-channel. Out of these links, at most eight links will be active members of the Port-channel. Remaining links will be put into a so-called Standby (sometimes also called Hot-Standby) mode. If an active link fails, one of the Standby links will be used to replace it. A single switch is in charge of selecting which Standby link will be promoted to the active state—it is the switch with the lower LACP System ID that consists of a configurable priority and the switch MAC address (the same concept as in STP). If there are multiple Standby links, the switch in control will choose the link with the lowest Port ID that again consists of a configurable priority and the port number. LACP priority of a switch can be globally configured using the lacp system-priority command, and the priority of a port can be set up using the lacp port-priority command. Both priorities can be configured in the range of 0–65535. + +To dynamically form a Port-channel using PAgP, you still use the channel-group com-mand, with a mode of auto or desirable. To use LACP to dynamically create a Port-channel, use a mode of active or passive. Table 3-8 lists and describes the modes and their meanings. + +Table 3-8 PAgP and LACP Configuration Settings and Recommendations Key +Topic PAgP Setting LACP 802.1AX Setting Action + + +auto + +desirable + +passive + +active + +Uses PAgP or LACP, but waits on the other side to send the first PAgP or LACP message +Uses PAgP or LACP and initiates the negotiation + + + +Note Using auto (PAgP) or passive (LACP) on both switches prevents a Port-channel from forming dynamically. Cisco recommends the use of desirable mode (PAgP) or active mode (LACP) on ports that you intend to be part of a Port-channel on both devices. + + +As remembering the mode keywords and the protocol they refer to (desirable/auto for PAgP; active/passive for LACP) can be awkward, Cisco implemented the helper com-mand channel-protocol { pagp | lacp } that can be used on physical interfaces to limit the accepted mode keywords to the stated negotiation protocol. In other words, entering channel-protocol pagp will allow the subsequent use of desirable or auto modes only; +the active, passive, and on modes will be rejected. Similarly, using channel-protocol lacp will only permit the subsequent use of active or passive modes; the desirable, auto, and on modes will be rejected. +Chapter 3: Spanning Tree Protocol 161 + + +Note A common misunderstanding is that the channel-protocol command can be used in combination with the on mode to start a particular negotiation protocol. This is incorrect. The channel-protocol command only causes the CLI to refuse any mode keywords that do not imply running the chosen negotiation protocol. + + +When PAgP or LACP negotiate to form a Port-channel, the messages include the exchange of key information that allows detecting whether all links to be bundled under a single Port-channel are connected to the same neighbor and whether the neighbor is also willing to bundle them under a single Port-channel. These values include system IDs of both interconnected devices, identifiers of physical ports, and aggregation groups these ports fall under. It is sometimes believed that PAgP and LACP carry detailed information about individual port settings; that is incorrect. While PAgP and LACP make sure that +the links to be bundled are all connected to the same neighboring switch and that both switches are willing to bundle them into a common Port-channel, they are neither capable nor supposed to verify whether ports on opposite sides of bundled links are otherwise identically configured. + + +Note PAgP and LACP verify only whether the links to be bundled are consistently con-nected to the same neighboring device and are to be bundled into the same link aggrega-tion group. However, neither of these protocols performs checks on whether the ports on this switch and its neighbor are configured identically with respect to their operating mode, allowed VLANs, native VLAN, encapsulation, and so on. + + +When PAgP or LACP completes the process, a new Port-channel interface exists and is used as if it were a single port for STP purposes, with balancing taking place based on the global load-balancing method configured on each switch. + +Troubleshooting Complex Layer 2 Issues + +Troubleshooting is one of the most challenging aspects of CCIE study. The truth is, we can’t teach you to troubleshoot in the pages of a book; only time and experience bring strong troubleshooting skills. We can, however, provide you with two things that are indispensable in learning to troubleshoot effectively and efficiently: process and tools. The focus of this section is to provide you with a set of Cisco IOS–based tools, beyond the more common ones that you already know, as well as some guidance on the trouble-shooting process for Layer 2 issues that you might encounter. + +In the CCIE Routing and Switching lab exam, you will encounter an array of trouble-shooting situations that require you to have mastered fast, efficient, and thorough trou-bleshooting skills. In the written exam, you’ll need a different set of skills—mainly, the knowledge of troubleshooting techniques that are specific to Cisco routers and switches, and the ability to interpret the output of various show commands and possibly debug output. You can also expect to be given an example along with a problem statement. You +162 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +will need to quickly narrow the question down to possible solutions and then pinpoint the final solution. This requires a different set of skills than what the lab exam requires, but spending time on fundamentals as you prepare for the qualification exam will provide a good foundation for the lab exam environment. + +As in all CCIE exams, you should expect that the easiest or most direct ways to a solu-tion might be unavailable to you. In troubleshooting, perhaps the easiest way to the source of most problems is through the show run command or variations on it. Therefore, we’ll institute a simple “no show run” rule in this section that will force you to use your knowledge of more in-depth troubleshooting commands in the Cisco IOS portion of this section. + +In addition, you can expect that the issues you’ll face in this part of the written exam will need more than one command or step to isolate and resolve. + +Layer 2 Troubleshooting Process + +From the standpoint of troubleshooting techniques, two basic stack-based approaches come into play depending on what type of issue you’re facing. The first of these is the climb-the-stack (or bottom-up) approach, where you begin at Layer 1 and work your way up until you find the problem. Alternatively, you can start at Layer 7 and work your way down in a top-down approach; however, in the context of the CCIE Routing and Switching exams, the climb-the-stack approach generally makes more sense. + +Another approach is often referred to as the divide-and-conquer method. With this tech-nique, you start in the middle of the stack (usually where you see the problem) and work your way down or up the stack from there until you find the problem. In the interest of time, which is paramount in an exam environment, the divide-and-conquer approach usu-ally provides the best results. Because this section deals with Layer 2 issues, it starts at the bottom and works up. + +Some lower-level issues that might affect Layer 2 connectivity include the following: + + +■ Key +Topic + + + + + + +■ + + + +■ + +Cabling: Check the physical soundness of the cable as well as the use of a cor-rectly pinned cable. If the switch does not support Automatic Medium-Dependent Interface Crossover (Auto-MDIX), the correct choice of either crossover or straight- +through cable must be made. On many Catalyst platforms (not all, though), configur-ing both speed and duplex statically on a port results in autonegotiation including Auto-MDIX to be deactivated on that port. That can lead both to duplex mis-matches and to a link going down if the cable required the port to perform automatic crossover. + +Speed or duplex mismatch: Most Cisco devices will correctly sense speed and duplex when both sides of the link are set to Auto, but a mismatch can cause the line protocol on the link to stay down. + +Device physical interface: It is possible for a physical port to break. +Chapter 3: Spanning Tree Protocol 163 + +Layer 2 Protocol Troubleshooting and Commands + +In addition to the protocol-specific troubleshooting commands that you have learned so far, this section addresses commands that can help you isolate problems through a solid understanding of the information they present. We will use a variety of examples of com-mand output to illustrate the key parameters you should understand. + +Troubleshooting Using Cisco Discovery Protocol + +Cisco Discovery Protocol (CDP) is a proprietary protocol that is used to help adminis-trators collect information about neighboring Cisco devices. CDP makes it possible to gather hardware and protocol information about neighbor devices, which is useful infor-mation for troubleshooting or network discovery. + +CDP messages are generated every 60 seconds as Layer 2 multicast messages on each of a device’s active interfaces. The information shared in a CDP packet about a device includes, but is not limited to, the following: + +■ Name of the device configured with the hostname command + +■ IOS software version + +■ Hardware capabilities, such as routing, switching, and/or bridging + +■ Hardware platform, such as 2800, 2960, or 1900 + +■ The Layer 3 address(es) of the device + +■ The interface that the CDP update was generated on + +■ Duplex setting of the interface that CDP was generated on + +■ VTP domain of the device if relevant + +■ Native VLAN of the sending port if relevant + +CDP enables devices to share basic configuration information without even configuring any protocol-specific information and is enabled by default on all common interfaces (CDP might be deactivated on less typical interfaces such as Virtual-Template or multi-point Frame Relay). CDP is a Data Link Layer utility found in IOS that resides at Layer 2 of the OSI model; as such, CDP is not routable and can only operate over directly con-nected interfaces. As a general rule, CDP is active by default on devices. + +CDP updates are generated every 60 seconds with a hold-down period of 180 seconds for a missing neighbor. The no cdp run command globally disables CDP, while the no cdp enable command disables CDP on an interface. Disabling CDP globally and enabling it on individual interfaces is not possible. We can use the show cdp neighbors command to list any directly connected Cisco neighboring devices. Additionally, we can use the detail keyword to display detailed information about the neighbor, including its Layer 3 addressing. +164 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 3-3 shows the CDP timer, which is how often CDP packets are sent, and the CDP holdtime, which is the amount of time that the device will hold packets from neigh-bor devices. + +Example 3-3 CDP Timers + +Router_2# show cdp +Global CDP information: +Sending CDP packets every 60 seconds +Sending a holdtime value of 180 seconds + +Example 3-4 shows how we can use the following commands to set CDP timer and hold-time values to something other than the defaults. + +Example 3-4 Adjusting CDP Timers + +Router_2# conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router_2(config)# cdp timer 90 +Router_2(config)# cdp holdtime 360 + +CDP can be disabled with the no cdp run command in global configuration mode. + +Because a device stores the CDP information in its runtime memory, you can view it with a show command. It will only show information about directly connected devices because CDP packets are not passed through Cisco devices. Example 3-5 shows such output. + +Example 3-5 CDP Verification Commands + +Router_2# show cdp neighbors +Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge +S - Switch, H - Host, I - IGMP, r - Repeater + + +Device ID +Router3 +Router1 +Switch1 + +Local Intrfce +Ser 1 +Eth 1 +Eth 0 + +Holdtme +120 +180 +240 + +Capability +R +R +S + +Platform Port ID +2500 Ser 0 +2500 Eth 0 +1900 2 + + +! CDP Neighbor Information includes +! Neighbor's device ID +! Local port type and number +! Holdtime value (in seconds) +! Neighbor's network device capability +! Neighbor's hardware platform +! Neighbor's remote port type and number + +! In addition to this we can employ the show cdp entry device-id +! command to show more information about a specified neighbor. +Chapter 3: Spanning Tree Protocol 165 + + +Router_2# show cdp entry Router1 +------------------------- + +Device ID: Router1 +Entry address(es): +IP address: 192.168.1.2 +Platform: cisco 2500, Capabilities: Router +Interface: Ethernet1, Port ID (outgoing port): Ethernet0 +Holdtime : 180 sec + +Version: +Cisco Internetwork Operating System Software +IOS (tm) 2500 Software (2500-JS-L), Version 11.2(15) +RELEASED SOFTWARE (fcl) +Copyright (c) 1986-1998 by Cisco Systems, Inc. +Compiled Mon 06-Jul-98 22:22 by tmullins + +! The following is a sample output for one neighbor from the show cdp neighbors +! detail command. Additional detail is shown about neighbors, including network +! address, enabled protocols, and software version. + +Router_2# show cdp neighbors detail + +Device ID: 008024 1EEB00 (milan-sw-1-cat9k) +Entry address(es): +IP address: 1.15.28.10 +Platform: CAT5000, Capabilities: Switch +Interface: Ethernet1/0, Port ID (outgoing port): 2/7 +Holdtime : 162 sec + +Version : +Cisco Catalyst 5000 +Duplex Mode: full +Native VLAN: 42 +VTP Management Domain: 'Accounting Group' + + +Troubleshooting Using Link Layer Discovery Protocol + +Where Cisco Discovery Protocol (CDP) is a device discovery protocol that runs over Layer 2 on all Cisco-manufactured devices (routers, bridges, access servers, and switches) that allows network management applications to automatically discover and learn about other Cisco devices connected to the network, we have to ask the question, “What hap-pens if we have to work with non-Cisco equipment?” +166 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +To support non-Cisco devices and to allow for interoperability between other devices, IOS also supports the IEEE 802.1AB Link Layer Discovery Protocol (LLDP). LLDP is a neighbor discovery protocol similar to CDP that is used for network devices to advertise information about themselves to other devices on the network. This protocol runs over the Data Link Layer, which allows two systems running different network layer protocols to learn about each other. + +LLDP supports a set of attributes that it uses to discover neighbor devices. These attri-butes contain type, length, and value descriptions and are referred to as TLVs. LLDP-supported devices can use TLVs to receive and send information to their neighbors. This protocol can advertise details such as configuration information, device capabilities, and device identity. + +The switch supports these basic management TLVs. These are mandatory LLDP TLVs: + +■ Port description TLV + +■ System name TLV + +■ System description TLV + +■ System capabilities TLV + +■ Management address TLV + +Similar to CDP, configuration on a Cisco device can be made in the global or interface mode. + +Example 3-6 shows how to globally enable LLDP and to manipulate its configuration. + +Example 3-6 LLDP Configuration and Verification + +! This example shows how to enable LLDP. First, LLDP must be +! activated globally. Then, instead of having a single +! enable keyword similar to cdp enable, LLDP has lldp transmit and lldp receive +! commands. By default, they are both set, so a port automatically sends and +! receives LLDP messages. The following example shows the use of the commands. + +Switch# configure terminal +Switch(config)# lldp run +Switch(config)# interface fa0/1 +Switch(config-if)# lldp transmit +Switch(config-if)# lldp receive +Switch(config-if)# end + +! You can configure the frequency of LLDP updates, the amount of time to hold the +! information before discarding it, and the initialization delay time. +Chapter 3: Spanning Tree Protocol 167 + +Switch# configure terminal +Switch(config)# lldp holdtime 120 +Switch(config)# lldp reinit 2 +Switch(config)# lldp timer 30 +Switch(config)# end + + +Troubleshooting Using Basic Interface Statistics + +The show interfaces command is a good place to start troubleshooting interface issues. It will tell you whether the interface has a physical connection and whether it was able to form a logical connection. The link duplex and bandwidth are shown, along with errors and collisions. Example 3-7 shows output from this command, with important statistics highlighted. + +Example 3-7 Troubleshooting with the show interface Command + +! Shows a physical and logical connection + +SW4# show int fa0/21 +FastEthernet0/21 is up, line protocol is up (connected) +Hardware is Fast Ethernet, address is 001b.d4b3.8717 (bia 001b.d4b3.8717) +MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keep alive set (10 sec) + +! Negotiated or configured speed and duplex + +Full-duplex, 100Mb/s, media type is 10/100BaseTX +input flow-control is off, output flow-control is unsupported +ARP type: ARPA, ARP Timeout 04:00:00 +Last input 00:00:01, output 00:00:08, output hang never +Last clearing of "show interface" counters never +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo +Output queue: 0/40 (size/max) +5 minute input rate 0 bits/sec, 0 packets/sec +5 minute output rate 0 bits/sec, 0 packets/sec +16206564 packets input, 1124307496 bytes, 0 no buffer +Received 14953512 broadcasts (7428112 multicasts) + +! CRC errors, runts, frames, collisions or late collisions +! may indicate a duplex mismatch + +0 runts, 0 giants, 0 throttles +168 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +0 watchdog, 7428112 multicast, 0 pause input +0 input packets with dribble condition detected +2296477 packets output, 228824856 bytes, 0 underruns +0 output errors, 0 collisions, 1 interface resets +0 babbles, 0 late collision, 0 deferred +0 lost carrier, 0 no carrier, 0 PAUSE output +0 output buffer failures, 0 output buffers swapped out + +If an interface shows as up/up, you know that a physical and logical connection has been made, and you can move on up the stack in troubleshooting. If it shows as up/ down, you have some Layer 2 troubleshooting to do. An interface status of err-disable could be caused by many different problems, some of which are discussed in this chap-ter. Common causes include a security violation or detection of a unidirectional link. Occasionally, a duplex mismatch will cause this state. + +Chapter 1, “Ethernet Basics,” showed examples of a duplex mismatch, but the topic is important enough to include here. Duplex mismatch might be caused by hard-coding one side of the link to full duplex but leaving the other side to autonegotiate duplex. A 10/100 interface will default to half duplex if the other side is 10/100 and does not nego-tiate. It could also be caused by an incorrect manual configuration on both sides of the link. A duplex mismatch usually does not bring the link down; it just creates suboptimal performance by causing collisions. + +You would suspect a duplex mismatch if you saw collisions on a link that should be capa-ble of full duplex, because a full-duplex link should by definition never have collisions. +A link that is half duplex on both sides will show some interface errors. But more than about 1 percent to 2 percent of the total traffic is cause for a second look. Watch for the following types of errors: + + +■ +Key +Topic ■ + + +■ + +■ + +■ + + + +■ + +Runts: Runts are frames smaller than 64 bytes. + +CRC errors: The frame’s cyclic redundancy checksum value does not match the one calculated by the switch or router. + +Frames: Frame errors have a CRC error and contain a noninteger number of octets. + +Alignment: Alignment errors have a CRC error and an odd number of octets. + +Collisions: Look for collisions on a full-duplex interface (meaning that the interface operated in half-duplex mode at some point in the past), or excessive collisions on a half-duplex interface. + +Late collisions on a half-duplex interface: A late collision occurs after the first 64 +bytes of a frame. +Chapter 3: Spanning Tree Protocol 169 + +Another command to display helpful interface statistics is show controllers, shown in Example 3-8. The very long output from this command is another place to find the num-ber of frames with bad frame checks, CRC errors, collisions, and late collisions. In addi-tion, it tells you the size breakdown of frames received and transmitted. A preponderance of one-size frames on an interface that is performing poorly can be a clue to the applica-tion sending the frames. Another useful source of information is the interface autonegoti-ation status and the speed/duplex capabilities of it and its neighbor, shown at the bottom of Example3-8. + +Example 3-8 Troubleshooting with the show controllers Command + +R1# show controllers fastEthernet 0/0 +Interface FastEthernet0/0 +Hardware is MV96340 +HWIDB: 46F92948, INSTANCE: 46F939F0, FASTSEND: 4374CB14, MCI_INDEX: 0 + +Aggregate MIB Counters +---------------------- +Rx Good Bytes: 27658728 +Rx Bad Bytes: 0 +Rx Broadcast Frames: 185810 +Tx Good Bytes: 3869662 +Tx Broadcast Frames: 0 +Rx+Tx Min-64B Frames: 412313 +Rx+Tx 128-255B Frames: 0 +Rx+Tx 512-1023B Frames: 0 +Rx Unrecog MAC Ctrl Frames: 0 +Rx Good FC Frames: 0 +Rx Undersize Frames: 0 +Rx Oversize Frames: 0 +Rx MAC Errors: 0 +Tx Collisions: 0 + + + +Rx Good Frames: 398637 +Rx Bad Frames: 0 +Rx Multicast Frames: 181353 +Tx Good Frames: 36667 +Tx Multicast Frames: 5684 +Rx+Tx 65-127B Frames: 12658 +Rx+Tx 256-511B Frames: 10333 +Rx+Tx 1024-MaxB Frames: 0 + +Rx Bad FC Frames: 0 +Rx Fragment Frames: 0 +Rx Jabber Frames: 0 +Rx Bad CRCs: 0 +Tx Late Collisions: 0 + + +! [output omitted] + +AUTONEG_EN +PHY Status (0x01): +AUTONEG_DONE LINK_UP +Auto-Negotiation Advertisement (0x04): +100FD 100HD 10FD 10HD +Link Partner Ability (0x05): +100FD 100HD 10FD 10HD + +! output omitted +170 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Troubleshooting Spanning Tree Protocol + +Spanning-tree issues are possible in a network that has not been properly configured. Previous sections of this chapter discussed ways to secure STP. One common STP prob-lem is a change in the root bridge. If the root bridge is not deterministically configured, a change in the root can affect network connectivity. To lessen the chance of this, use Rapid STP and all the tools necessary to secure the root and user ports. Example 3-1 showed commands to check the root bridge and other STP parameters, including the fol-lowing: +show spanning-tree [ vlan number ] root [ detail | priority [ system-id ] ] + +Keep in mind that when BPDU Guard is enabled, a port is error-disabled if it receives a BPDU. You can check this with the show interfaces status err-disabled command. In addition, switching loops can result if the spanning-tree portfast trunk command is enabled on a trunk port toward another switch, or an interface has a duplex mismatch. One symptom of a loop is flapping MAC addresses. A port protected by Root Guard is put in a root-inconsistent state if it tries to become a Root Port: a Root and Alternate Port with Loop Guard configured is put in a loop-inconsistent state if it stops receiving BPDUs. You can check this with the show spanning-tree inconsistent ports command. +Whether an interface is error-disabled or put into an inconsistent state, the port is effec-tively shut down to user traffic. + +Cisco STP implementation recognizes many kinds of port inconsistencies. Table 3-9 sum-marizes them and the reasons causing them. + +Table 3-9 Types of STP Inconsistencies and Their Causes +Key +Topic Inconsistency Type Description and Probable Cause of Inconsistency + + +Type (*TYPE_Inc) +Port VLAN ID (*PVID_Inc) +PVST Simulation (*PVST_Inc) +Loop (*LOOP_Inc) +Root (*ROOT_Inc) + + +Bridge Assurance (*BA_Inc) + +PVST+ BPDUs are received on a non-802.1Q port. Usually caused by interconnecting access and trunk ports. +PVST+ BPDUs are received in a different VLAN than they were originated in. Usually caused by native VLAN mismatch on a trunk. +PVST+ BPDUs received on an MST boundary port do not meet the PVST Simulation consistency criteria. +A Root or Alternate Port tried to become Designated after BPDUs stopped arriving. Seen only on Loop Guard–protected ports. +A port tried to become a Root Port after receiving superior BPDUs. Seen only on Root Guard-protected ports. Also, on older switches, this state was displayed in place of the PVST_Inc state if PVST Simulation Inconsistency was encountered on a port. +A port stopped receiving BPDUs. Seen only on Bridge Assurance– protected ports. +Chapter 3: Spanning Tree Protocol 171 + +Troubleshooting Trunking + +Trunks that fail to form can result from several causes. With an 802.1Q trunk, a native VLAN mismatch is usually the first thing troubleshooters look at. You should addition-ally check the Dynamic Trunking Protocol (DTP) negotiation mode of each side of the trunk. Table 2-9 in Chapter 2, “Virtual LANs and VLAN Trunking,” lists the combinations of DTP configurations that will lead to successful trunking. + +A VLAN Trunking Protocol (VTP) domain mismatch has been known to prevent trunk formation, even in switches that are in VTP Transparent mode, because the VTP domain name is carried in DTP messages. The switch’s logging output will help you greatly. This is shown in Example 3-9, along with some commands that will help you troubleshoot trunking problems. In Example 3-9, two switches are configured with 802.1Q native VLANs 10 and 99, and DTP mode desirable. Both are VTP transparent and have different VTP domain names. Some output irrelevant to the example is omitted. + +Example 3-9 Troubleshooting Trunking + +! These errors messages were logged by the switch + +%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet1/0/21 (10), with sw4 FastEthernet0/21 (99) +%SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 99 on FastEthernet1/0/21 VLAN10 +%DTP-5-DOMAINMISMATCH: Unable to perform trunk negotiation on port Fa1/0/21 because of VTP domain mismatch. + +! This command shows that the port is configured to trunk +! (Administrative Mode) but is not performing as a trunk +! (Operational Mode) + +SW2# show int fa 1/0/1 switchport +Name: Fa1/0/1 +Switchport: Enabled +Administrative Mode: dynamic desirable +Operational Mode: static access +Administrative Trunking Encapsulation: negotiate +Operational Trunking Encapsulation: native +Negotiation of Trunking: On +Access Mode VLAN: 1 (default) +Trunking Native Mode VLAN: 10 (NATIVE_10) +Administrative Native VLAN tagging: enabled +! output omitted + +! Trunking VLANs Enabled: 3,99 + +! The port is shown as inconsistent due to native VLAN mismatch +172 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +SW4# show spanning-tree inconsistentports +Name Interface Inconsistency +------------ ------------------------ ------------------ +VLAN0099 FastEthernet0/21 Port VLAN ID Mismatch +Number of inconsistent ports (segments) in the system : 1 + +! Once the errors are corrected, the interface shows as a trunk + +SW4# show interfaces trunk + +Port Mode +Fa0/21 desirable + +Encapsulation +802.1q + +Status +trunking + +Native vlan +99 + +! Output omitted + +If your trunks are connected and operating, but user connectivity is not working, check the VLANs allowed on each trunk. Make sure that the allowed VLANs match on each side of the trunk, and that the users’ VLAN is on the allowed list (assuming that it should be). Either look at the interface configuration or use the show interfaces trunk and show interfaces switchport commands shown in Example 3-9 to find that information. + +Troubleshooting VTP + +If you choose to use anything other than VTP Transparent mode in your network, you should be aware of the ways to break it. VTP will fail to negotiate a neighbor status if the following items do not match: + +■ VTP version + +■ VTP domain + +■ VTP password + +In addition, recall that VTP runs over trunk links only, so you must have an operational trunk before expecting VTP to act. To prevent your VLAN database from being altered when adding a VTPv1 or VTPv2 switch to the VTP domain, follow these steps: +Step 1. Change the VTP mode to Transparent, which will reset the configuration revi-sion number to 0. + +Step 2. Configure the remaining appropriate VTP parameters. + +Step 3. Configure trunking. + +Step 4. Connect the switch to the network. + +VTPv3 prevents a switch, even with a higher revision number, from asserting its database over other switches if its idea of who is the primary server differs from that of its neighbors. + +The first part of Example 3-10 shows a VTP client with a password that doesn’t match its neighbor (note the error message). The switch does not show an IP address in the last +Chapter 3: Spanning Tree Protocol 173 + +line because it has not been able to negotiate a VTP relationship with its neighbor. In the second part of the example, the configuration has been corrected. Now the neighbor’s IP address is listed as the VTP updater. + +Example 3-10 Troubleshooting VTP + +! Wrong password is configured + + +SW4# show vtp status +VTP Version +Configuration Revision + + +: running VTP1 (VTP2 capable) +: 0 + +Maximum VLANs supported locally : 1005 + +Number of existing VLANs +VTP Operating Mode +VTP Domain Name +VTP Pruning Mode +VTP V2 Mode +VTP Traps Generation +MD5 digest + +: 5 +: Client +: CCIE +: Disabled +: Disabled +: Disabled +: 0xA1 0x7C 0xE8 0x7E 0x4C 0xF5 0xE3 0xC8 + +*** MD5 digest checksum mismatch on trunk: Fa0/23 *** +*** MD5 digest checksum mismatch on trunk: Fa0/24 *** +Configuration last modified by 0.0.0.0 at 7-24-09 03:12:27 + +! On some IOS versions, a message about MD5 digest failing is not displayed. +! In these cases, using debug sw-vlan vtp events may be helpful - look for output +! similar to this: + +*Jul 24 11:01:42.558: VTP LOG RUNTIME: MD5 digest failing +calculated = D7 17 28 01 4E 1D E6 65 67 0A 9D 73 71 EA 5A 5C +transmitted = C2 93 A7 15 E5 0C 0B 9D DD 24 BB ED 18 4C 97 45 + +! Command output after the misconfiguration was corrected + + +SW4# show vtp status +VTP Version +Configuration Revision + + +: running VTP2 +: 5 + +Maximum VLANs supported locally : 1005 + +Number of existing VLANs +VTP Operating Mode +VTP Domain Name +VTP Pruning Mode +VTP V2 Mode +VTP Traps Generation +MD5 digest + +: 9 +: Client +: CCIE +: Disabled +: Enabled +: Disabled +: 0xDD 0x6C 0x64 0xF5 0xD2 0xFE 0x9B 0x62 + +Configuration last modified by 192.168.250.254 at 7-24-09 11:02:43 +174 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Troubleshooting EtherChannels + +Table 3-8 listed the LACP and PAgP settings. If your EtherChannel is not coming up, check these settings. If you are using LACP, at least one side of each link must be set to active. If you are using PAgP, at least one side of the link must be set to desirable. If you are not using a channel negotiation protocol, make sure that both sides of the links are set to on. + +Remember that the following rules apply to all ports within an EtherChannel: + +■ Speed and duplex must match. + +■ Interface type—access, trunk, or routed—must match. + +■ Trunk configuration—encapsulation, allowed VLANs, native VLAN, and DTP mode—must match. + +■ If a Layer 2 EtherChannel is not a trunk, all ports must be assigned to the same VLAN. + +■ No port in the EtherChannel can be a Switched Port Analyzer (SPAN) port. + +■ On a Layer 3 EtherChannel, the IP address must be on the Port-channel interface, not a physical interface. + +To troubleshoot an EtherChannel problem, check all the parameters in the preceding list. Example 3-11 shows some commands to verify the logical and physical port configura-tion for an EtherChannel. QoS configuration must match and must be configured on the physical ports, not the logical one. + +Example 3-11 Troubleshooting EtherChannels + +! The show etherchannel summary command gives an overview of the +! channels configured, whether they are Layer 2 or Layer 3, the +! interfaces assigned to each, and the protocol used if any + +L3SW4# show etherchannel summary +Flags: D - down P - bundled in port-channel +I - stand-alone s - suspended +H - Hot-standby (LACP only) + +R - Layer3 +U - in use + +S - Layer2 +f - failed to allocate aggregator + +M - not in use, minimum links not met +u - unsuitable for bundling +w - waiting to be aggregated +d - default port +Number of channel-groups in use: 3 +Chapter 3: Spanning Tree Protocol 175 + +Number of aggregators: 3 +Group Port-channel Protocol Ports +------+-------------+---------+------------------------------------------- + +14 Po14(SU) +24 Po24(RU) +34 Po34(RU) + +LACP Fa0/3(P) +- Fa0/7(P) +PAgP Fa0/1(P) + + +Fa0/8(P) Fa0/9(P) Fa0/10(P) +Fa0/2(P) + + +! The show interface etherchannel command lets you verify that the +! interface is configured with the right channel group and +! protocol settings + +L3SW3# show int fa0/1 etherchannel +Port state = Up Mstr In-Bndl +Channel group = 34 Mode = On Gcchange = - +Port-channel = Po34 GC = - Pseudo port-channel = Po34 +Port index = 0 Load = 0x00 Protocol = PAgP +Age of the port in the current state: 1d:07h:28m:19s + +! The show interface portchannel command produces output similar +! to a physical interface. It allows you to verify the ports +! assigned to the channel and the type of QoS used + +L3SW3# show int port-channel 23 +Port-channel23 is up, line protocol is up (connected) +Hardware is EtherChannel, address is 001f.2721.8643 (bia 001f.2721.8643) +Internet address is 10.1.253.13/30 +MTU 1500 bytes, BW 200000 Kbit, DLY 100 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +Full-duplex, 100Mb/s, link type is auto, media type is unknown +input flow-control is off, output flow-control is unsupported +Members in this channel: Fa0/3 Fa0/4 +ARP type: ARPA, ARP Timeout 04:00:00 +Last input 00:00:02, output 00:00:00, output hang never +Last clearing of "show interface" counters never +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +Queueing strategy: fifo + + +Approaches to Resolving Layer 2 Issues + +Table 3-10 presents some generalized types of Layer 2 issues and ways of approaching them, including the relevant Cisco IOS commands. +176 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 3-10 Layer 2 Troubleshooting Approach and Commands + +Problem Approach Helpful IOS Commands + +Lack of reachability to devices in the same VLAN + +Eliminate Layer 1 issues with show interface show interface commands. show vlan +Verify that the VLAN exists show interface switchport +on the switch. + + + +Verify that the interface is assigned to the correct VLAN. + +Verify that the VLAN is allowed on the trunk. + +traceroute mac source-mac destination-mac + +show interface trunk + + + +Intermittent reachability to devices in the same VLAN + +Check for excessive interface show interface traffic. show spanning-tree +Check for unidirectional show spanning-tree root +links. + + + + + + + + +No connectivity between switches + + + + + + +Poor performance across a link + + +Check for spanning-tree problems such as BPDU floods or flapping MAC addresses. +Check for interfaces that are shut down. + +Verify that trunk links and EtherChannels are active. + +Verify that BPDU Guard is not enabled on a trunk interface. +Check for a duplex mismatch. + +show mac address-table + + + + +show interfaces status err-disabled + +show interfaces trunk + +show etherchannel summary + +show spanning-tree detail + + +show interface + + + +In summary, when troubleshooting Layer 2 issues, check for interface physical problems or configuration mismatches. Verify that STP is working as expected. If you are using VTP, make sure that it is configured properly on each switch. For trunking problems, check native VLAN and DTP configuration. When troubleshooting port channels, verify that the interface parameters are the same on both sides. +Chapter 3: Spanning Tree Protocol 177 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 3-11 lists the protocols mentioned in this chapter and their respective standards documents. + + +Table 3-11 + +Name +RSTP + +MST + +STP + +LACP + + +Protocols and Standards for Chapter 3 + +Standards Body +IEEE 802.1D (formerly 802.1w) + +IEEE 802.1Q (formerly 802.1s) + +Formerly IEEE 802.1D + +IEEE 802.1AX (formerly 802.3AD) + + + +Dot1Q trunking + +PVST+ + +RPVST+ + +PAgP + +IEEE 802.1Q + +Cisco + +Cisco + +Cisco + + + +Table 3-12 lists the three key timers that impact STP convergence. + + +Table 3-12 IEEE 802.1D STP Timers + + +Timer Default +Hello 2 sec + +Purpose +Interval at which the root sends Configuration BPDUs + + +Forward Delay 15 sec Time that switch leaves a port in the Listening state and the Learning state; also used as the short CAM timeout timer +MaxAge 20 sec Time without hearing a Hello before expiring the stored BPDU + + +Table 3-13 lists some of the key IOS commands related to the topics in this chapter. The command syntax for switch commands was taken from the Catalyst 3560 Switch Command Reference, 15.0(2)SE. +178 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Table 3-13 + +Command + + +Command Reference for Chapter 3 + +Description + + + +spanning-tree mode {mst | pvst | rapid-pvst } + +[no] spanning-tree vlan vlan-id + +spanning-tree vlan vlan-id {forward-time seconds | hello-time seconds | max-age seconds | priority priority | {root +{primary | secondary} [diameter net-diameter [hello-time seconds ]]}} + +spanning-tree [ vlan x | mst x ] cost y + + + +spanning-tree [ vlan x | mst x ] port-priority y + + +channel-group channel-group-number mode {auto [non-silent] | desirable +[non-silent] | on | active | passive} + +channel-protocol {lacp | pagp} + + +interface port-channel port-channel-number +spanning-tree portfast [ trunk ] + +spanning-tree bpduguard {enable | disable} + +spanning-tree mst instance-id priority priority +spanning-tree mst configuration + +show spanning-tree bridge | root | brief | summary +show interfaces + +show interfaces trunk + +show etherchannel [summary] + +Global config command that sets the STP mode. + +Enables or disables STP inside a particular VLAN when using PVST+ or RPVST+. +Global config command to set a variety of STP parameters when using PVST+ or RPVST+. + + + +Interface subcommand used to set interface costs, per VLAN. If the vlan or mst keyword is omitted, applies to all unspecified VLANs or MST instances. +Interface subcommand used to set port priority, per VLAN. If the vlan or mst keyword is omitted, applies to all unspecified VLANs or MST instances. +Interface subcommand that places the interface into a Port-channel, and sets the negotiation parameters. + +Interface subcommand to define which protocol to allow to configure for EtherChannel negotiation. +Global command that allows entering the logical interface representing the Port-channel bundle. + +Interface subcommand that enables PortFast on the interface. +Interface command that enables or disables BPDU Guard on the interface. +Global command used to set the priority of an MST instance. + +Global command that puts the user in MST configuration mode. +EXEC command to show various details about STP operation. +Displays Layer 1 and 2 information about an interface. +Displays the interface trunk configuration. + +Lists EtherChannels configured and their status. +Chapter 3: Spanning Tree Protocol 179 + + + +Command +show interfaces switchport + +show vtp status + +show controllers + +Description +Displays the interface trunking and VLAN configuration. +Displays the VTP configuration. + +Displays physical interface characteristics as well as traffic and error types. + + + + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill in Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +CST, CIST, STP, MST, RSTP, Hello timer, MaxAge timer, ForwardDelay timer, Blocking state, Forwarding state, Listening state, Learning state, Disabled state, Alternate role, Discarding state, Backup role, Root Port, Designated Port, superior BPDU, inferior BPDU, PVST+, RPVST+, PortFast, Root Guard, BPDU Guard, UDLD, Loop Guard, LACP, PAgP +Refer to the glossary to check your answers. + + +Further Reading + +The topics in this chapter tend to be covered in slightly more detail in CCNP Switching exam preparation books. For more details on these topics, refer to the Cisco Press CCNP preparation books found at www.ciscopress.com/ccnp. + +Cisco LAN Switching, by Kennedy Clark and Kevin Hamilton, covers STP logic and operations in detail. + +More details about UDLD can be found in RFC 5171 and in U.S. Patent No. 7,480,251. +180 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Cisco.com has an unusually extensive set of high-quality documents covering selected topics from this chapter. Instead of posting the URLs that can change over time, fol-lowing is Table 3-14 of selected documents’ names and Document ID numbers you can use in the Search function to locate the appropriate document. So, for example, when looking for “Understanding Spanning Tree Protocol Topology Changes,” type the string “Document ID 12013” in the Search box on the Cisco website. If “PDF” is indicated instead of a numerical Document ID, the document has no Document ID and must be searched for only using its name. Some of the documents cover topics that are outdated and/or have been dropped from the current exam blueprint but which are nevertheless worth reading to reinforce your understanding. Most of the indicated documents are a must-read, though. + +Table 3-14 Recommended Further Reading at Cisco.com + + +Document Name +Understanding Spanning-Tree Protocol Topology Changes + +VLAN Load Balancing Between Trunks Using the Spanning-Tree Protocol Port Priority +Understanding and Tuning Spanning Tree Protocol Timers + +Understanding and Configuring the Cisco UplinkFast Feature + +Understanding and Configuring Backbone Fast on Catalyst Switches +Understanding Rapid Spanning Tree Protocol (802.1w) + +Understanding Multiple Spanning Tree Protocol (802.1s) + +PVST Simulation on MST Switches + +Using PortFast and Other Commands to Fix Workstation Startup Connectivity Delays +Spanning Tree PortFast BPDU Guard Enhancement + +Spanning Tree Protocol Root Guard Enhancement + +Spanning-Tree Protocol Enhancements using Loop Guard and BPDU Skew Detection Features +Understanding and Configuring the Unidirectional Link Detection Protocol Feature +Spanning Tree from PVST+ to Rapid-PVST Migration Configuration Example +Configuration Example to Migrate Spanning Tree from PVST+ to MST +Cisco AVVID Network Infrastructure: Implementing 802.1w and 802.1s in Campus Networks + +Document ID +12013 + +10555 + +19120 + +10575 + +12014 + +24062 + +24248 + +116464 + +10553 + +10586 + +10588 + +10596 + +10591 + +72836 + +72844 + +PDF +Chapter 3: Spanning Tree Protocol 181 + + + +Document Name +Best Practices for Catalyst 6500/6000 Series and Catalyst 4500/4000 Series Switches Running Cisco IOS Software +Troubleshooting Transparent Bridging Environments + +Troubleshooting LAN Switching Environments + +Spanning Tree Protocol Problems and Related Design Considerations +Troubleshooting STP on Catalyst Switches Running Cisco IOS System Software +Troubleshooting Spanning Tree PVID- and Type-Inconsistencies + +Document ID 24330 + +10543 + +12006 + +10556 + +28943 + +24063 + + +Understanding EtherChannel Load Balancing and Redundancy on 12023 Catalyst Switches +Understanding EtherChannel Inconsistency Detection 20625 + +Catalyst 6500, 4500, and 3750 Series Switches EtherChannel 116385 Load-Balancing +Errdisable Port State Recovery on the Cisco IOS Platforms 69980 + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ IP Operation + +■ TCP Operation + +■ UDP Operation + +■ IPv4 Addressing + +■ IPv4 Subnetting + +■ IPv4 VLSM + +■ Route Summarization + +■ NAT + +■ IPv6 Addressing + +■ IPv6 Subnetting + +■ Migrating from IPv4 to IPv6 +CHAPTER 4 + + + + + + +IP Addressing + + +Complete mastery of IP addressing and subnetting is required for any candidate to have a reasonable chance at passing both the CCIE written and lab exam. In fact, even the CCNA exam has fairly rigorous coverage of IP addressing and the related protocols. For the CCIE exam, understanding these topics is required to answer much deeper questions. For example, a question might ask for the interpretation of the output of a show ip bgp command and a configuration snippet to decide what routes would be summarized into +a new prefix. To answer such questions, you must be familiar with the basic concepts and math behind subnetting. + +“Do I Know This Already?” Quiz + +Table 4-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 4-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +IP Addressing and Subnetting + +CIDR, Private Addresses, and NAT + +IPv6 Addressing and Tunneling + +Total Score + +Questions Covered in This Section Score +1–4 + +5–8 + +9–11 + + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. In what subnet does address 192.168.23.197/27 reside? + +a. 192.168.23.0 + +b. 192.168.23.128 + +c. 192.168.23.160 + +d. 192.168.23.192 + +e. 192.168.23.196 +184 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +2. Router1 has four LAN interfaces, with IP addresses 10.1.1.1/24, 10.1.2.1/24, 10.1.3.1/24, and 10.1.4.1/24. What is the smallest summary route that could be adver-tised out a WAN link connecting Router1 to the rest of the network, if subnets not listed here were allowed to be included in the summary? +a. 10.1.2.0/22 + +b. 10.1.0.0/22 + +c. 10.1.0.0/21 + +d. 10.1.0.0/16 + +3. Router1 has four LAN interfaces, with IP addresses 10.22.14.1/23, 10.22.18.1/23, 10.22.12.1/23, and 10.22.16.1/23. Which one of the answers lists the smallest sum-mary route(s) that could be advertised by Router1 without also including subnets not listed in this question? +a. 10.22.12.0/21 + +b. 10.22.8.0/21 + +c. 10.22.8.0/21 and 10.22.16.0/21 + +d. 10.22.12.0/22 and 10.22.16.0/22 + +4. Which two of the following VLSM subnets, when taken as a pair, overlap? + +a. 10.22.21.128/26 + +b. 10.22.22.128/26 + +c. 10.22.22.0/27 + +d. 10.22.20.0/23 + +e. 10.22.16.0/22 + +5. Which of the following protocols or tools includes a feature like route summariza-tion, plus administrative rules for global address assignment, with a goal of reducing the size of Internet routing tables? +a. Classless interdomain routing + +b. Route summarization + +c. Supernetting + +d. Private IP addressing +Chapter 4: IP Addressing 185 + +6. Which of the following terms refer to a NAT feature that allows for significantly fewer IP addresses in the enterprise network as compared with the required public registered IP addresses? +a. Static NAT + +b. Dynamic NAT + +c. Dynamic NAT with overloading + +d. PAT + +e. VAT + +7. Consider an enterprise network using private class A network 10.0.0.0, and using NAT to translate to IP addresses in registered class C network 205.1.1.0. Host 10.1.1.1 has an open www session to Internet web server 198.133.219.25. Which of the fol-lowing terms refers to the destination address of a packet, sent by the web server back to the client, when the packet has not yet made it back to the enterprise’s NAT router? +a. Inside Local + +b. Inside Global + +c. Outside Local + +d. Outside Global + +8. Router1 has its fa0/0 interface, address 10.1.2.3/24, connected to an enterprise net-work. Router1’s S0/1 interface connects to an ISP, with the interface using a publicly registered IP address of 171.1.1.1/30. Which of the following commands could be part of a valid NAT overload configuration, with 171.1.1.1 used as the public IP address? +a. ip nat inside source list 1 int s0/1 overload + +b. ip nat inside source list 1 pool fred overload + +c. ip nat inside source list 1 171.1.1.1 overload + +d. None of the answers are correct. + +9. What feature is built into the IPv6 protocol to facilitate intranet-wide address man-agement that enables a large number of IP hosts to easily discover the network and get new and globally unique IPv6 addresses associated with their location? +a. ISATAP + +b. Address autoconfiguration + +c. Interface Overload + +d. None of the answers are correct. +186 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +10. What IPv6 transition strategy involves configuring devices to be able to run IPv4 and IPv6 simultaneously? + +a. ISATAP + +b. IPv4-in-IPv6 Tunnels + +c. Dual Stack + +d. 6to4 Tunnels + +11. If you use static configuration, all autoconfiguration features provided by IPv6 will be disabled. + +a. True + +b. False +Chapter 4: IP Addressing 187 + +Foundation Topics + + +IP Operation + +IP is a protocol, and a protocol is best described as a series of rules governing how things work in a certain technologies, the ultimate goal being an operational standardization. When put into a network communication context, a protocol is the set of rules govern-ing how packets are transmitted over a network. When you have a protocol, you are sure that all machines on a network (or in the world, when it comes to the Internet) speak +the “same language” and can integrate into a holistic framework. IP is probably the most common protocol over the Internet. It is the set of rules governing how packets are trans-mitted over the Internet. + +The IP protocol standardizes the way that machines over the Internet or any IP network forward or route their packets based on their IP addresses. The most fundamental and basic operation we observe in IP is the ability to perform routing. The routing of IP packets and its unique addressing scheme is one of the main functions of the IP protocol. Routing consists of forwarding IP packets from source to destination machines over a network, based on their IP addresses. IP is probably the most common and widely used protocol in existence as a result of its ease and use, but IP on its own is not sufficient +to every task that we might have in networking. It must be noted that the operation of IP is also governed by the manner in which we deliver what to packets. Yes, the routing protocol allows the delivery, but without certain additional components, IP will not, for +example, provide reliable packet delivery. To meet this goal of adding features like reliable transport and acknowledgment, we need to rely on another feature known as Transport Control Protocol (TCP). + +TCP Operation + +When TCP couples with IP, you get a traffic controller that manages reliable exchange. TCP and IP work together to transmit data over the Internet, but at different levels. As we mentioned previously, IP does not guarantee reliable packet delivery over a network, and it is TCP that takes charge of making packet exchange reliable. + +TCP is the protocol that ensures reliability in a transmission with minimal loss of packets. Additional duties in the operation of TCP include assuring that packets maintain the right order, and that any delay is kept to an acceptable level. Also, it is TCP that prevents the possibility of packet duplication. All this is to ensure that the data received is consistent, in order, complete, and smooth. + +TCP operates in the protocol stack at the transport layer of the Open Systems Interconnection (OSI) model, which means that during data transmission, TCP works just before IP. TCP bundles data into TCP packets before sending these to IP, which in turn encapsulates these into IP packets. +188 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +An IP packet is a packet of data that carries a data payload and an IP header. Any piece of data is broken into bits and placed into these packets and transmitted over the net-work. When the packets reach their destination, they are reassembled into the original data. + +UDP Operation + +The previous section discussed the nature of reliable transport that is provided by TCP, but there are instances in many networks where you either do not need reliable packet delivery or where you cannot afford to pay the associated costs of reliable delivery. Reliable packet delivery is slow, and many applications that can be deployed on a mod-ern network find TCP too slow. A perfect example is voice and video traffic. But a more general explanation would be that TCP traffic is considered to be connection-oriented, whereas User Datagram Protocol (UDP) traffic is connectionless. This means that UDP packets do not contain anywhere near the amount of information as a TCP packet and thus they are smaller. This small size, coupled with their speed, makes them ideal for applications that are sensitive to the packet loss or delay such as IP voice or video solu-tions. + +But no matter the transport method, TCP or UDP, your IP packets are delivered and man-aged in the context of IOS through their unique logical addressing and the ability to par-tition sections of addresses into usable networks. + +IP Addressing and Subnetting + +You need a postal address to receive letters; similarly, computers must use an IP address to be able to send and receive data using the TCP/IP protocols. Just as the postal service dictates the format and meaning of a postal address to aid the efficient delivery of mail, the TCP/IP protocol suite imposes some rules about IP address assignment so that rout-ers can efficiently forward packets between IP hosts. This chapter begins with coverage of the format and meaning of IP addresses, with required consideration for how they are grouped to aid the routing process. + +IP Addressing and Subnetting Review + +First, here’s a quick review of some of the core facts about IPv4 addresses that should be fairly familiar to you: + +■ A 32-bit binary number. + +■ Written in “dotted decimal” notation (for example, 1.2.3.4), with each decimal octet representing 8 bits. + +■ Addresses are assigned to network interfaces, so computers or routers with multiple interfaces have multiple IP addresses. + +■ A computer with an IP address assigned to an interface is an IP host. +Chapter 4: IP Addressing 189 + +■ A group of IP hosts that are not separated from each other by an IP router are in the same grouping. + +■ These groupings are called networks, subnets, or prefixes, depending on the con-text. + +■ IP hosts separated from another set of IP hosts by a router must be in separate groupings (network/subnet/prefix). + +IP addresses can be analyzed using classful or classless logic, depending on the situa-tion. Classful logic simply means that the main class A, B, and C rules from RFC 791 are considered. The next several pages present a classful view of IP addresses, as reviewed in Table 4-2. + +With classful addressing, class A, B, and C networks can be identified as such by their first several bits (shown in the last column of Table 4-2) or by the range of decimal values for their first octets. Also, each class A, B, or C address has two parts (when not sub-netted): a network part and a host part. The size of each is implied by the class, and can be stated explicitly using the default mask for that class of network. For example, mask 255.0.0.0, the default mask for class A networks, has 8 binary 1s and 24 binary 0s, repre-senting the size of the network and host parts, respectively. + + +Table 4-2 Classful Network Review Key +Topic Class of Size of Network and Range of First Default Mask for Address Host Parts of the Octet Values Each Class of +Addresses Network + + + +Identifying Bits at Beginning of Address + + + +A 8/24 1–126 + +B 16/16 128–191 + +C 24/8 192–223 + +D — 224–239 + +E — 240–255 + +255.0.0.0 0 + +255.255.0.0 10 + +255.255.255.0 110 + +— 1110 + +— 1111 + + + + +Subnetting a Classful Network Number + +With classful addressing, and no subnetting, an entire class A, B, or C network is needed on each individual instance of a data link. For example, Figure 4-1 shows a sample inter-network, with dashed-line circles representing the set of hosts that must be in the same IP network—in this case requiring three networks. Figure 4-1 shows two options for how IP addresses can be assigned and grouped together for this internetwork topology. +190 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Option 1: Use Classful Networks for Each Group + + +Network 172.31.0.0 Network 130.2.0.0 Network 8.0.0.0 + +Client3 + + +E0/0 R3 R1 SW1 172.31.103.41 + + + +Subnet 172.31.103.0 255.255.255.0 + +Subnet 172.31.13.0 255.255.255.0 + +Subnet 172.31.11.0 255.255.255.0 + + + +Option 2: Use Subnets of One Classful Network + +Figure 4-1 Sample Internetwork with Two Alternatives for Address Assignment— Without and With Subnetting + +Option 1 uses three classful networks; however, it wastes a lot of IP addresses. For example, all hosts in class A network 8.0.0.0 must reside on the LAN on the right side of the figure. + +Of course, the much more reasonable alternative is to reserve one classful IP network number and use subnetting to subdivide that network into at least three subdivisions, called subnets. Option 2 (bottom of Figure 4-1) shows how to subdivide a class A, B, or C network into subnets. + +To create subnets, the IP addresses must have three fields instead of just two—the net-work, subnet, and host. When using classful logic to interpret IP addresses, the size of the network part is still defined by classful rules—either 8, 16, or 24 bits based on class. To create the subnet field, the host field is shortened, as shown in Figure 4-2. + + + +Key Topic + +8 24 – x Network Subnet +16 16 – x +Network Subnet + +x +Host Class A + +x +Host Class B + + +24 8 – x x +Network SubnetHost Class C + +Figure 4-2 Formats of IP Addresses when Subnetting +Chapter 4: IP Addressing 191 + + +Note The term internetwork refers to a collection of computers and networking hard-ware; because TCP/IP discussions frequently use the term network to refer to a classful class A, B, or C IP network, this book uses the term internetwork to refer to an entire net-work topology, as shown in Figure 4-1. + + +To determine the size of each field in a subnetted IP address, you can follow the three easy steps shown in Table 4-3. Note that Figure 4-1 also showed alternative addressing for using subnets, with the last column in Table 4-3 showing the size of each field for that particular example, which used class B network 172.31.0.0, mask 255.255.255.0. + +Table 4-3 Finding the Size of the Network, Subnet, and Host Fields in an IP Address +Key +Topic Name of Part of Process to Find Its Size Size per Figure 4-1 the Address Example + +Network + +Subnet + +Host + +8, 16, or 24 bits based on class rules 16 + +32 minus network and host bits 8 + +Equal to the number of binary 0s in the mask 8 + + + + +Comments on Classless Addressing + +The terms classless and classful can be applied to three popular topics that are all related to IP. This chapter explains classful and classless IP addressing, which are relatively simple concepts. Two other chapters explain the other uses of the terms classless and classful: Chapter 6, “IP Forwarding (Routing),” describes classless/classful routing, and Chapter 7, “RIPv2 and RIPng,” covers classless/classful routing protocols. + +Classless IP addressing, simply put, means that class A, B, and C rules are ignored. Each address is viewed as a two-part address, formally called the prefix and the host parts of the address. The prefix simply states how many of the beginning bits of an IP address identify or define the group. It is the same idea as using the combined network and sub-net parts of an address to identify a subnet. All the hosts with identical prefixes are in effect in the same group, which can be called a subnet or a prefix. + +Just as a classful subnet must be listed with the subnet mask to know exactly which addresses are in the subnet, a prefix must be listed with its prefix length. The prefix itself is a dotted-decimal number. It is typically followed by a / symbol, after which the prefix length is listed. The prefix length is a decimal number that denotes the length (in bits) of the prefix. For example, 172.31.13.0/24 means a prefix of 172.31.13.0 and a prefix length of 24 bits. Also, the prefix can be implied by a subnet mask, with the number of 1s in the binary version of the mask implying the prefix length. + +Classless and classful addressing are mainly just two ways to think about IP address for-mats. For the exam, make sure to understand both perspectives and the terminology used by each. +192 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Subnetting Math + +Knowing how to interpret the meaning of addresses and masks, routes and masks in the routing table, and addresses and masks in access control lists (ACL) and how to configure route filtering are all very important topics for the CCIE Routing and Switching written and lab exams. This section covers the binary math briefly, with coverage of some tricks to do the math quickly without binary math. Several subsequent chapters cover the con-figuration details of features that require this math. + +Dissecting the Component Parts of an IP Address + +First, deducing the size of the three parts (classful view) or two parts (classless view) of an IP address is important, because it allows you to analyze information about that sub-net and other subnets. Every internetwork requires some number of subnets, and some number of hosts per subnet. Analyzing the format of an existing address, based on the mask or prefix length, enables you to determine whether enough hosts per subnet exist, or whether enough subnets exist to support the number of hosts. The following list sum-marizes some of the common math facts about subnetting related to the format of IP addresses: + + +■ Key +Topic + +■ + + + +■ + + + +■ + + + +■ + +If a subnet has been defined with y host bits, there are 2y – 2 valid usable IP addresses in the subnet, because two numeric values are reserved. + +One reserved IP address in each subnet is the subnet number itself. This number, by definition, has binary 0s for all host bits. This number represents the subnet, and is typically seen in routing tables. + +The other reserved IP address in the subnet is the subnet broadcast address, which by definition has binary 1s for all host bits. This number can be used as a destination IP address to send a packet to all hosts in the subnet. + +When you are thinking classfully, if the mask implies x subnet bits, then 2x possible subnets exist for that classful network, assuming that the same mask is used through-out the network. + +Although there are no truly reserved values for the subnet numbers, two (lowest and +highest values) can be discouraged from use in some cases: + + +■ Zero subnet: The subnet field is all binary 0s; in decimal, each zero subnet is the exact same dotted-decimal number as the classful network number, potentially causing confusion. +■ Broadcast subnet: The subnet field is all binary 1s; in decimal, this subnet’s broadcast address is the same as the network-wide broadcast address, potentially causing confusion. + +In Cisco routers, by default, zero subnets and broadcast subnets work fine. You can dis-able the use of the zero subnet with the no ip subnet-zero global command. The only time that using the zero subnet typically causes problems is when classful routing proto-cols are used. +Chapter 4: IP Addressing 193 + +Finding Subnet Numbers and Valid Range of IP Addresses—Binary + +When examining an IP address and mask, the process of finding the subnet number, the broadcast address, and the range of valid IP addresses is as fundamental to networking as is addition and subtraction for advanced math. Possibly more so for the CCIE Routing and Switching lab exam, mastery of the math behind subnetting, which is the same basic math behind route summarization and filtering, will improve your speed in completing complex configurations on the exam. + +The range of valid IP addresses in a subnet begins with the number that is 1 larger than the subnet number, and ends with the address that is 1 smaller than the broadcast address for the subnet. So, to determine the range of valid addresses, just calculate the subnet number and broadcast address, which can be done as follows: + + +■ Key +Topic +■ + +To derive the subnet number: Perform a bitwise Boolean AND between the IP address and mask. + +To derive the broadcast address: Change all host bits in the subnet number from 0s +to 1s. + + +A bitwise Boolean AND means that you place two long binary numbers on top of each other, and then AND the two bits that line up vertically. (A Boolean AND results in a binary 1 only if both bits are 1; otherwise, the result is 0.) Table 4-4 shows an easy exam-ple based on subnet 172.31.103.0/24 from Figure 4-1. + +Table 4-4 Binary Math to Calculate the Subnet Number and Broadcast Address + + +Address + +Mask + +Subnet Number (Result of AND) + +172.31.103.41 + +255.255.255.0 + +172.31.103.0 + + +1010 1100 0001 1111 0110 0111 0010 1001 + +1111 1111 1111 1111 1111 1111 0000 0000 + +1010 1100 0001 1111 0110 0111 0000 0000 + +Broadcast 172.31.103.255 1010 1100 0001 1111 0110 0111 1111 1111 + + +Probably almost everyone reading this already knew that the decimal subnet number and broadcast addresses shown in Table 4-4 were correct, even without looking at the binary math. The important part is to recall the binary process, and practice until you can con-fidently and consistently find the answer without using any binary math. The only parts of the math that typically trip people up are the binary-to-decimal and decimal-to-binary conversions. When working in binary, keep in mind that you will not have a calculator for the written exam, and that when converting to decimal, you always convert 8 bits +at a time—even if an octet contains some prefix bits and some host bits. (Appendix C, “Decimal-to-Binary Conversion Table,” contains a conversion table for your reference.) +194 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Decimal Shortcuts to Find the Subnet Number and Valid Range of IP Addresses + +Many of the IP addressing and routing related problems on the exam come back to the ability to solve a couple of classic basic problems. One of those problems runs as follows: + +Given an IP address and mask (or prefix length), determine the subnet number/prefix, broadcast address, and range of valid IP addresses. +If you can already solve such problems with only a few seconds’ thought, even with tricky masks, you can skip this section of the chapter. If you cannot solve such questions easily and quickly, this section can help you learn some math shortcuts that allow you to find the answers without needing to use any Boolean math. + + +Note The next several pages of this chapter describe some algorithms that you can use to find many important details related to IP addressing, without needing to convert to and from binary. In my experience, some people simply work better performing the math in binary until the answers simply start popping into their heads. Others find that the decimal shortcuts are more effective. +If you use the decimal shortcuts, it is best to practice them until you no longer really use the exact steps listed in this book; rather, the processes should become second nature. To that end, CD-only Appendix D, “IP Addressing Practice,” lists several practice problems for each of the algorithms presented in this chapter. + + +To solve the “find the subnet/broadcast/range of addresses” type of problem, at least three of the four octets should have pretty simple math. For example, with a nice, easy mask like 255.255.255.0, the logic used to find the subnet number and broadcast address is intuitive to most people. The more challenging cases occur when the mask or prefix does not divide the host field at a byte boundary. For example, the same IP address 172.31.103.41, with mask 255.255.252.0 (prefix /22), is actually in subnet 172.31.100.0. Working with the third octet in this example is the hard part, because the mask value for that octet is not 0 or 255; for the upcoming process, this octet is called the interesting octet. The following process finds the subnet number, using decimal math, even with a challenging mask: +Step 1. Find the mask octets of value 255; copy the same octets from the IP address. + +Step 2. Find the mask octets of value 0; write down 0s for the same octets. + +Step 3. If one octet has not yet been filled in, that octet is the interesting octet. Find the subnet mask’s value in the interesting octet and subtract it from 256. Call this number the “magic number.” +Step 4. Find the integer multiple of the magic number that is closest to, but not larger than, the interesting octet’s value. +Chapter 4: IP Addressing 195 + +An example certainly helps, as shown in Table 4-5, with 172.31.103.41, mask 255.255.252.0. The table separates the address into its four component octets. In this example, the first, second, and fourth octets of the subnet number are easily found from Steps 1 and 2 in the process. Because the interesting octet is the third octet, the magic number is 256 – 252, or 4. The integer multiple of 4, closest to 103 but not exceeding 103, is 100—making 100 the subnet number’s value in the third octet. (Note that you can use this same process even with an easy mask, and Steps 1 and 2 will give you the com-plete subnet number.) + +Table 4-5 Quick Math to Find the Subnet Number—172.31.103.41, 255.255.252.0 + +Octet Comments + + +1 2 3 4 +Address 172 31 103 41 + +Mask 255 255 252 0 + +Subnet number results after 172 31 0 Steps 1 and 2 +Subnet number after complet- 172 31 100 0 ing the interesting octet + + + + +Equivalent to /22. + +Magic number will be 256 – 252 = 4. +100 is the multiple of 4 closest to, but not exceeding, 103. + + + +A similar process can be used to determine the subnet broadcast address. This process assumes that the mask is tricky. The detailed steps are as follows: +Step 1. Start with the subnet number. + +Step 2. Decide which octet is interesting, based on which octet of the mask does not have a 0 or 255. + +Step 3. For octets to the left of the interesting octet, copy the subnet number’s values into the place where you are writing down the broadcast address. + +Step 4. For any octets to the right of the interesting octet, write 255 for the broadcast address. + +Step 5. Calculate the magic number: Find the subnet mask’s value in the interesting octet and subtract it from 256. + +Step 6. Take the subnet number’s interesting octet value, add the magic number to it, and subtract 1. Fill in the broadcast address’s interesting octet with this num-ber. + +Table 4-6 shows the 172.31.103.41/22 example again, using this process to find the sub-net broadcast address. +196 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 4-6 Quick Math to Find the Broadcast Address—172.31.103.41, 255.255.252.0 + +Octet Comments + + +1 +Subnet number (per Step 1) 172 + +Mask (for reference) 255 + +2 3 4 +31 100 0 + +255 252 0 Equivalent to /22 + + + +Results after Steps 1 to 4 172 31 + +Subnet number after 172 31 completing the empty octet + +255 Magic number will be 256 – 252 = 4 + +103 255 Subnet’s third octet (100), plus magic number (4), minus 1 is 103 + + + +Note If you have read the last few pages to improve your speed at dissecting a subnet without requiring binary math, it is probably a good time to pull out the CD in the back of the book. CD-only Appendix D, “IP Addressing Practice,” contains several practice prob-lems for finding the subnet and broadcast address, as well as for many other math issues related to IP addressing. + + + +Determining All Subnets of a Network—Binary + +Another common question, typically simply a portion of a more challenging question on the CCIE written exam, relates to finding all subnets of a network. The base underlying question might be as follows: + +Given a particular class A, B, or C network, and a mask/prefix length used on all sub-nets of that network, what are the actual subnet numbers? +The answers can be found using binary or using a simple decimal algorithm. This section first shows how to answer the question using binary, using the following steps. Note that the steps include details that are not really necessary for the math part of the problem; these steps are mainly helpful for practicing the process. + +Key Step 1. Topic +Step 2. + + +Step 3. + + +Step 4. + + +Step 5. + + +Step 6. + + +Write the binary version of the classful network number; that value is actually the zero subnet as well. + +Draw two vertical lines through the number, one separating the network and subnet parts of the number, the other separating the subnet and host part. + +Calculate the number of subnets, including the zero and broadcast subnet, based on 2y, where y is the number of subnet bits. + +Write y−1 copies of the binary network number below the first one, but leave the subnet field blank. + +Using the subnet field as a binary counter, write the values, top to bottom, in which the next value is 1 greater than the previous. + +Convert the binary numbers, 8 bits at a time, back to decimal. +Chapter 4: IP Addressing 197 + +This process takes advantage of a couple of facts about the binary form of IP subnet numbers: + +■ All subnets of a classful network have the same value in the network portion of the subnet number. + +■ All subnets of any classful network have binary 0s in the host portion of the subnet number. + +Step 4 in the process simply makes you write the network and host parts of each subnet number, because those values are easily predicted. To find the different subnet numbers, you then just need to discover all possible different combinations of binary digits in the subnet field, because that is the only part of the subnet numbers that differs from subnet to subnet. + +For example, consider the same class B network 172.31.0.0, with static length subnet masking (SLSM) assumed, and a mask of 255.255.224.0. Note that this example uses 3 subnet bits, so there will be 23 subnets. Table 4-7 lists the example. + +Table 4-7 Binary Method to Find All Subnets—Steps 1 Through 4 + +Octet + +Subnet 1 2 3 4 + +Network number/zero subnet + +2nd subnet + +3rd subnet + +4th subnet + +5th subnet + +6th subnet + +7th subnet + +8th subnet (2y = 8); broadcast subnet + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 00000 00000000 + +00000 00000000 + +00000 00000000 + +00000 00000000 + +00000 00000000 + +00000 00000000 + +00000 00000000 + +00000 00000000 + + + +At this point, you have the zero subnet recorded at the top, and you are ready to use the subnet field (the missing bits in the table) as a counter to find all possible values. Table +4-8 completes the process. +198 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 4-8 Binary Method to Find All Subnets—Step 5 + +Octet + + +Subnet +Network number/zero subnet + +2nd subnet + +3rd subnet + +4th subnet + +5th subnet + +6th subnet + +7th subnet + +8th subnet (2y = 8); broadcast subnet + +1 +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +2 +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +3 +000 00000 + +001 00000 + +010 00000 + +011 00000 + +100 00000 + +101 00000 + +110 00000 + +111 00000 + +4 +00000000 + +00000000 + +00000000 + +00000000 + +00000000 + +00000000 + +00000000 + +00000000 + + + +The final step to determine all subnets is simply to convert the values back to decimal. Take care to always convert 8 bits at a time. In this case, you end up with the follow- +ing subnets: 172.31.0.0, 172.31.32.0, 172.31.64.0, 172.31.96.0, 172.31.128.0, 172.31.160.0, 172.31.192.0, and 172.31.224.0. + +Determining All Subnets of a Network—Decimal + +You might have noticed the trend in the third octet values in the subnets listed in the pre-vious paragraph. When assuming SLSM, the subnet numbers in decimal do have a regu-lar increment value, which turns out to be the value of the magic number. For example, instead of the binary math in the previous section, you could have thought the following: + +■ The interesting octet is the third octet. + +■ The magic number is 256 – 224 = 32. + +■ 172.31.0.0 is the zero subnet, because it is the same number as the network number. + +■ The other subnet numbers are increments of the magic number inside the interesting octet. + +If that logic already clicks in your head, you can skip to the next section in this chapter. If not, the rest of this section outlines a decimal algorithm that takes a little longer pass at the same general logic. First, the question and the algorithm assume that the same subnet mask is used on all subnets of this one classful network—a feature sometimes called stat-ic length subnet masking (SLSM). In contrast, variable length subnet masking (VLSM) means that different masks are used in the same classful network. The algorithm assumes a subnet field of 8 bits or less just to keep the steps uncluttered; for longer subnet fields, the algorithm can be easily extrapolated. +Chapter 4: IP Addressing 199 + + +Step 1. Key +Topic Step 2. + + +Step 3. + + + +Step 4. + + +Step 5. + + +Step 6. + + + +Step 7. + + +Write the classful network number in decimal. + +For the first (lowest numeric) subnet number, copy the entire network num-ber. That is the first subnet number, and is also the zero subnet. + +Decide which octet contains the entire subnet field; call this octet the inter-esting octet. (Remember, this algorithm assumes 8 subnet bits or less, so the entire subnet field will be in a single interesting octet.) + +Calculate the magic number by subtracting the mask’s interesting octet value from 256. + +Copy the previous subnet number’s noninteresting octets onto the next line as the next subnet number; only one octet is missing at this point. + +Add the magic number to the previous subnet’s interesting octet, and write that as the next subnet number’s interesting octet, completing the next subnet number. + +Repeat Steps 5 and 6 until the new interesting octet is 256. That subnet is not valid. The previously calculated subnet is the last valid subnet, and also the +broadcast subnet. + + +For example, consider the same class B network 172.31.0.0, with SLSM assumed, and a mask of 255.255.224.0. Table 4-9 lists the example. + +Table 4-9 Subnet List Chart—172.31.0.0/255.255.224.0 + +Octet Comments + + + +Network number + +Mask + +Subnet zero + +First subnet + +Next subnet + +Next subnet + +Next subnet + +Next subnet + +Next subnet + +Last subnet (broadcast) + +Invalid; easy-to-recognize stopping point + +1 2 3 4 +172 31 0 0 + +255 255 224 0 + +172 31 0 0 + +172 31 32 0 + +172 31 64 0 + +172 31 96 0 + +172 31 128 0 + +172 31 160 0 + +172 31 192 0 + +172 31 224 0 + +172 31 256 0 + + +Step 1 from the process. + +Magic number is 256 – 224 = 32. + +Step 2 from the process. + +Steps 5 and 6; previous interesting octet 0, plus magic number (32). +32 plus magic number is 64. + +64 plus magic number is 96. + +96 plus magic number is 128. + +128 plus magic number is 160. + +160 plus magic number is 192. + +The broadcast subnet in this case. + +256 is out of range; when writing this one, note that it is invalid, and that the previous one is the last valid subnet. +200 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +You can use this process repeatedly as needed until the answers start jumping out at you without the table and step-wise algorithm. For more practice, refer to CD-only Appendix D. + +VLSM Subnet Allocation + +So far in this chapter, most of the discussion has been about examining existing ad-dresses and subnets. Before deploying new networks, or new parts of a network, you must give some thought to the ranges of IP addresses to be allocated. Also, when assign-ing subnets for different locations, you should assign the subnets with thought for how routes could then be summarized. This section covers some of the key concepts related to subnet allocation and summarization. (This section focuses on the concepts behind summarization; the configuration of route summarization is routing protocol–specific and thus is covered in the individual chapters covering routing protocols.) + +Many organizations purposefully use SLSM to simplify operations. Additionally, many internetworks also use private IP network 10.0.0.0, with an SLSM prefix length of /24, and use NAT for connecting to the Internet. Operations and troubleshooting can be a lot easier when you use SLSM, particularly with a nice, easy prefix like /24. + +In some cases, VLSM is required or preferred when allocating addresses. VLSM is typi-cally chosen when the address space is constrained to some degree. The VLSM subnet assignment strategy covered here complies with the strategy you might remember from the Cisco BSCI course or from reading the Cisco Press CCNP Routing certification books. + +Similar to when assigning subnets with SLSM, you should use an easily summarized block of addresses for a new part of the network. Because VLSM network addresses are likely constrained to some degree, you should choose the specific subnets wisely. The general rules for choosing wisely are as follows: + +Step 1. Key +Topic +Step 2. + + +Step 3. + + + +Step 4. + + + +Step 5. + + +Determine the shortest prefix length (in other words, the largest block) required. + +Divide the available address block into equal-sized prefixes based on the shortest prefix from Step 1. + +Allocate the largest required subnets/prefixes from the beginning of the IP address block, leaving some equal-sized unallocated address blocks at the end of the original large address block. + +Choose an unallocated block that you will further subdivide by repeating the first three steps, using the shortest required prefix length (largest address block) for the remaining subnets. + +When allocating very small address blocks for use on links between routers, consider using subnets at the end of the address range. This leaves the largest +consecutive blocks available in case future requirements change. + + +For example, imagine that a network engineer plans a new site installation. He allocates the 172.31.28.0/23 address block for the new site, expecting to use the block as a single summarized route. When planning, the engineer then subdivides 172.31.28.0/23 per the +Chapter 4: IP Addressing 201 + +subnet requirements for the new installation, as shown in Figure 4-3. The figure shows three iterations through the VLSM subnet assignment process, because the requirements call for three different subnet sizes. Each iteration divides a remaining block into equal sizes, based on the prefix requirements of the subnets allocated at that step. Note that the small /30 prefixes were allocated from the end of the address range, leaving the largest possible consecutive address range for future growth. + +172.31.28.0/23 (172.31.28.0 Through 172.31.29.255) +Key Requirements: Topic 3 /25’s +2 /27’s 3 /30’s + + +Pass 1: /25 prefixes Block 172.31.28.0/23 +Allocated +172.31.28.0/25 +172.31.28.1 – 172.31.28.126 + + + +Allocated +172.31.28.128/25 +172.31.28.129 – 172.31.28.254 + + + +Allocated +172.31.29.0/25 +172.31.29.1 – 172.31.29.126 + + + +Unallocated +172.31.29.128/25 +172.31.29.129 – 172.31.29.254 + + + + +Pass 2: /27 prefixes Block 172.31.29.128/25 + +Allocated Allocated Unallocated Unallocated +172.31.29.128/27 172.31.29.160/27 172.31.29.192/27 172.31.29.224/27 + + + + +Step 3: /30 prefixes Unallocated Allocated Allocate High End: +172.31.29.252/30, 172.31.29.248/30, 172.31.29.244/30 + +Figure 4-3 Example of VLSM Subnet Allocation Process + + +Route Summarization Concepts + +The ability to recognize and define how to most efficiently summarize existing address ranges is an important skill on both the written and lab exams. For the written exam, the question might not be as straightforward as, “What is the most efficient summarization of the following subnets?” Rather, the math required for such a question might simply be part of a larger question. Certainly, such math is required for the lab exam. This section looks at the math behind finding the best summarization; other chapters cover specific configuration commands. + +Good IP address assignment practices should always consider the capabilities for route summarization. For example, if a division of a company needs 15 subnets, an engineer needs to allocate those 15 subnets from the unused portions of the address block avail-able to that internetwork. However, assigning subnets 10.1.101.0/24 through 10.1.115.0/24 would be a poor choice, because those do not easily summarize. Rather, allocate a range of addresses that can be easily summarized into a single route. For example, subnets +202 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +10.1.96.0/24 through 10.1.111.0/24 can be summarized as a single 10.1.96.0/20 route, mak-ing those routes a better choice. + +There are two main ways to think of the word best when you are looking for the “best summarization”: + +■ Inclusive summary routes: A single summarized route that is as small a range of addresses as possible, while including all routes/subnets shown, and possibly includ-ing subnets that do not currently exist. + +■ Exclusive summary routes: As few as possible summarized routes that include all to-be-summarized address ranges, but excluding all other routes/subnets. + + +Note The terms inclusive summary, exclusive summary, and candidate summary are simply terms I invented for this book and will continue to use later in the chapter. + + +For example, with the VLSM example in Figure 4-3, the network engineer purposefully planned so that an inclusive summary of 172.31.28.0/23 could be used. Even though not all subnets are yet allocated from that address range, the engineer is likely saving the rest of that address range for future subnets at that site, so summarizing using an inclusive summary is reasonable. In other cases, typically when trying to summarize routes in an internetwork for which summarization was not planned, the summarization must exclude routes that are not explicitly listed, because those address ranges can actually be used in another part of the internetwork. + +Finding Inclusive Summary Routes—Binary + +Finding the best inclusive summary lends itself to a formal binary process, as well as to a formal decimal process. The binary process runs as follows: +Step 1. Write the binary version of each component subnet, one on top of the other. + +Step 2. Inspect the binary values to find how many consecutive bits have the exact same value in all component subnets. That number of bits is the prefix length. + +Step 3. Write a new 32-bit number at the bottom of the list by copying y bits from the prior number, y being the prefix length. Write binary 0s for the remaining bits. This is the inclusive summary. +Step 4. Convert the new number to decimal, 8 bits at a time. + +Table 4-10 shows an example of this process, using four routes, 172.31.20.0, .21.0, .22.0, and .23.0, all with prefix /24. +Chapter 4: IP Addressing 203 + +Table 4-10 Example of Finding the Best Inclusive Summary—Binary + + + +172.31.20.0/24 + +172.31.21.0/24 + +172.31.22.0/24 + +172.31.23.0/24 + +Prefix length: 22 + +Inclusive summary + +Octet 1 +10101100 + +10101100 + +10101100 + +10101100 + + +10101100 + +Octet 2 +00011111 + +00011111 + +00011111 + +00011111 + + +00011111 + +Octet 3 +000101 00 + +000101 01 + +000101 10 + +000101 11 + + +000101 00 + +Octet 4 +00000000 + +00000000 + +00000000 + +00000000 + + +00000000 + + + +The trickiest part is Step 2, in which you have to simply look at the binary values and find the point at which the bits are no longer equal. You can shorten the process by, in this case, noticing that all component subnets begin with 172.31, meaning that the first 16 bits will certainly have the same values. + +Finding Inclusive Summary Routes—Decimal + +To find the same inclusive summary using only decimal math, use the following process. The process works just fine with variable prefix lengths and nonconsecutive subnets. +Step 1. Count the number of subnets; then, find the smallest value of y, such that 2y => that number of subnets. + +Step 2. For the next step, use a prefix length based on the longest prefix length of the component subnets, minus y. + +Step 3. Pretend that the lowest numeric subnet number in the list of component sub-nets is an IP address. Using the new, smaller prefix from Step 2, calculate the subnet number in which this pretend address resides. +Step 4. Repeat Step 3 for the largest numeric component subnet number and the same prefix. If it is the same subnet derived as in Step 3, the resulting subnet is the best summarized route, using the new prefix. +Step 5. If Steps 3 and 4 do not yield the same resulting subnet, repeat Steps 3 and 4 with another new prefix length of 1 less than the last prefix length. + +Table 4-11 shows two examples of the process. The first example has four routes, 172.31.20.0, .21.0, .22.0, and .23.0, all with prefix /24. The second example adds 172.31.24.0 to that same list. +204 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 4-11 Example of Finding the Best Summarizations + + +Step Range of .20.0, .21.0, .22.0, and .23.0, /24 +Step 1 22 = 4, y = 2 + +Step 2 24 – 2 = 22 + +Step 3 Smallest subnet 172.31.20.0, with /22, yields 172.31.20.0/22 +Step 4 Largest subnet 172.31.23.0, with /22, yields 172.31.20.0/22 +Step 5 — + +Same Range, Plus 172.31.24.0 + +23 = 8, y = 3 + +24 – 3 = 21 + +Smallest subnet 172.31.20.0, with /21, yields 172.31.16.0/21 +Largest subnet 172.31.24.0, with /21, yields 172.31.24.0/21 +21 – 1 = 20; new prefix + + +Step 3, 2nd time — 172.31.16.0/20 + + +Step 4, 2nd — time + +172.31.16.0/20; the same as prior step, so that is the answer + + + +With the first example, Steps 3 and 4 yielded the same answer, which means that the best inclusive summary had been found. With the second example, a second pass through the process was required. CD-only Appendix D contains several practice problems to help you develop speed and make this process second nature. + +Finding Exclusive Summary Routes—Binary + +A similar process, listed next, can be used to find the exclusive summary. Keep in mind that the best exclusive summary can be composed of multiple summary routes. Once again, to keep it simple, the process assumes SLSM. +Step 1. Find the best exclusive summary route; call it a candidate exclusive sum-mary route. + +Step 2. Determine whether the candidate summary includes any address ranges it should not. To do so, compare the summary’s implied address range with the implied address ranges of the component subnets. +Step 3. If the candidate summary only includes addresses in the ranges implied by the component subnets, the candidate summary is part of the best exclusive summarization of the original component subnets. +Step 4. If instead the candidate summary includes some addresses that match the can-didate summary routes and some addresses that do not, split the current can-didate summary in half, into two new candidate summary routes, each with a prefix 1 longer than before. +Step 5. If the candidate summary only includes addresses outside the ranges implied by the component subnets, the candidate summary is not part of the best exclusive summarization, and it should not be split further. +Chapter 4: IP Addressing 205 + +Step 6. Repeat Steps 2 through 4 for each of the two possible candidate summary routes created at Step 4. + +For example, take the same five subnets used with the inclusive example—172.31.20.0/24, .21.0, .22.0, .23.0, and .24.0. The best inclusive summary is 172.31.16.0/20, which implies an address range of 172.31.16.0 to 172.31.31.255—clearly, it includes more addresses than the original five subnets. So, repeat the process of splitting the summary in half, and repeating, until summaries are found that do not include any unnecessary address ranges. Figure 4-4 shows the idea behind the logic. + + +Routes to Summarize: 172.31.20.0/24 (20.0 thru 20.255) 172.31.21.0/24 (21.0 thru 21.255) 172.31.22.0/24 (22.0 thru 22.255) 172.31.23.0/24 (23.0 thru 23.255) 172.31.24.0/24 (24.0 thru 24.255) + + + +172.31.16.0/20: 16.0 Thru 31.255 +Too Inclusive: Split! + + + +172.31.16.0/21: 16.0 thru 23.255 +Too Inclusive: Split! + +172.31.24.0/21: 24.0 thru 31.255 +Too Inclusive: Split! + + + +172.31.16.0/22: 16.0 Thru 19.255 +Range completely outside range to be summarized; stop splitting. + +172.31.20.0/22: 20.0 Thru 23.255 +Range is exclusively from target range – keep this as part of best exclusive summary! + +172.31.24.0/22: 24.0 Thru 27.255 +Too inclusive: keep splitting! (Details not shown.) + +172.31.28.0/22: 28.0 Thru 31.255 +Range completely outside range to be summarized; stop splitting. + + +Figure 4-4 Example of Process to Find Exclusive Summary Routes + +The process starts with one candidate summary. If it includes some addresses that need to be summarized and some addresses it should not summarize, split it in half and try again with each half. Eventually, the best exclusive summary routes are found, or the splitting keeps happening until you get back to the original routes. In fact, in this case, after a few more splits (not shown), the process ends up splitting to 172.31.24.0/24, which is one of the original routes—meaning that 172.31.24.0/24 cannot be summarized any further in this example. + +CIDR, Private Addresses, and NAT + +The sky was falling in the early 1990s in that the commercialization of the Internet was rapidly depleting the IP version 4 address space. Also, Internet routers’ routing tables were doubling annually (at least). Without some changes, the incredible growth of the Internet in the 1990s would have been stifled. + +To solve the problems associated with this rapid growth, several short-term solutions were created, as well as an ultimate long-term solution. The short-term solutions included classless interdomain routing (CIDR), which helps reduce the size of routing tables by aggregating routes, and Network Address Translation (NAT), which reduces the number +206 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +of required public IP addresses used by each organization or company. This section cov-ers the details of CIDR and NAT, plus a few related features. + +Classless Interdomain Routing + +CIDR is a convention defined in RFCs 1517 through 1520 that calls for aggregating routes for multiple classful network numbers into a single routing table entry. The pri-mary goal of CIDR is to improve the scalability of Internet routers’ routing tables. Imagine the implications of an Internet router being burdened by carrying a route to every class A, B, and C network on the planet! + +CIDR uses both technical tools and administrative strategies to reduce the size of the Internet routing tables. Technically, CIDR uses route summarization, but with Internet scale in mind. For example, CIDR might be used to allow a large ISP to control a range of IP addresses from 198.0.0.0 to 198.255.255.255, with the improvements to routing shown in Figure 4-5. + + + +Route to 198.0.0.0 Mask 255.0.0.0 Points to ISP #1 + + + +Route to 198.0.0.0 Mask 255.0.0.0 Points to ISP #1 + + + +Route to 198.0.0.0 Mask 255.0.0.0 Points to ISP #1 + + +ISP #2 + + + +ISP #1 ISP #3 198.0.0.0 - +198.255.255.0 + + + +ISP #4 + + + +Customer #1 198.8.3.0/24 + + + +Customer #2 198.4.2.0/24 198.4.3.0/24 + + +Customer #3 198.1.0.0 + +Figure 4-5 Typical Use of CIDR + + + + + + + + + +Key Topic + +ISPs 2, 3, and 4 need only one route (198.0.0.0/8) in their routing tables to be able to for-ward packets to all destinations that begin with 198. Note that this summary actually summarizes multiple class C networks—a typical feature of CIDR. ISP 1’s routers contain more detailed routing entries for addresses beginning with 198, based on where they allo-cate IP addresses for their customers. ISP 1 would reduce its routing tables similarly with large ranges used by the other ISPs. + +CIDR attacks the problem of large routing tables through administrative means as well. As shown in Figure 4-5, ISPs are assigned contiguous blocks of addresses to use when assigning addresses for their customers. Likewise, regional authorities are assigned large address blocks, so when individual companies ask for registered public IP addresses, they ask their regional registry to assign them an address block. As a result, addresses assigned by the regional agency will at least be aggregatable into one large geographic region of +the world. For example, the Latin American and Caribbean Internet Addresses Registry +Chapter 4: IP Addressing 207 + +(LACNIC, www.lacnic.net) administers the IP address space of the Latin American and Caribbean region (LAC) on behalf of the Internet community. + +In some cases, the term CIDR is used a little more generally than the original intent of the RFCs. Some texts use the term CIDR synonymously with the term route summariza-tion. Others use the term CIDR to refer to the process of summarizing multiple classful networks together. In other cases, when an ISP assigns subsets of a classful network to a customer who does not need an entire class C network, the ISP is essentially performing subnetting; once again, this idea sometimes gets categorized as CIDR. But CIDR itself refers to the administrative assignment of large address blocks, and the related summa-rized routes, for the purpose of reducing the size of the Internet routing tables. + + +Note Because CIDR defines how to combine routes for multiple classful networks into a single route, some people think of this process as being the opposite of subnetting. As a result, many people refer to CIDR’s summarization results as supernetting. + + + +Private Addressing + +One of the issues with Internet growth was the assignment of all possible network num-bers to a small number of companies or organizations. Private IP addressing helps to mitigate this problem by allowing computers that will never be directly connected to the Internet to not use public, Internet-routable addresses. For IP hosts that will purposefully have no direct Internet connectivity, you can use several reserved network numbers, as defined in RFC 1918 and listed in Table 4-12. + +Table 4-12 RFC 1918 Private Address Space Key +Topic Range of IP Addresses Class of Networks Number of Networks + +10.0.0.0 to 10.255.255.255 A 1 + +172.16.0.0 to 172.31.255.255 B 16 + +192.168.0.0 to 192.168.255.255 C 256 + + +In other words, any organization can use these network numbers. However, no organi-zation is allowed to advertise these networks using a routing protocol on the Internet. Furthermore, all Internet routers should be configured to reject these routes. + +Network Address Translation + +NAT, defined in RFC 1631, enables a host that does not have a valid registered IP address to communicate with other hosts on the Internet. NAT has gained such widespread accep-tance that the majority of enterprise IP networks today use private IP addresses for most +208 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +hosts on the network and use a small block of public IP addresses, with NAT translating between the two. + +NAT translates, or changes, one or both IP addresses inside a packet as it passes through a router. (Many firewalls also perform NAT; for the CCIE Routing and Switching exam, you do not need to know NAT implementation details on firewalls.) In most cases, NAT changes the (typically private range) addresses used inside an enterprise network into addresses from the public IP address space. For example, Figure 4-6 shows static NAT +in operation; the enterprise has registered class C network 200.1.1.0/24, and uses private class A network 10.0.0.0/8 for the hosts inside its network. + + +SA 10.1.1.1 SA 200.1.1.1 + + + + + +10.1.1.1 e0/0 +s0/0 Internet NAT + +Server + + +170.1.1.1 + + + +10.1.1.2 +Inside Outside DA 10.1.1.1 DA 200.1.1.1 + + +Inside Local 10.1.1.1 10.1.1.2 + +Inside Global 200.1.1.1 200.1.1.2 + + +Figure 4-6 Basic NAT Concept + +Beginning with the packets sent from a PC on the left to the server on the right, the pri-vate IP source address 10.1.1.1 is translated to a public IP address of 200.1.1.1. The client sends a packet with source address 10.1.1.1, but the NAT router changes the source to 200.1.1.1—a registered public IP address. When the server receives a packet with source IP address 200.1.1.1, the server thinks it is talking to host 200.1.1.1, so it replies with +a packet sent to destination 200.1.1.1. The NAT router then translates the destination address (200.1.1.1) back to 10.1.1.1. + +Figure 4-6 provides a good backdrop for the introduction of a couple of key terms, Inside Local and Inside Global. Both terms take the perspective of the owner of the enterprise network. In Figure 4-6, address 10.1.1.1 is the Inside Local address, and 200.1.1.1 is the Inside Global address. Both addresses represent the client PC on the left, which is inside the enterprise network. Address 10.1.1.1 is from the enterprise’s IP address space, which is only locally routable inside the enterprise—hence the term +Inside Local. Address 200.1.1.1 represents the local host, but the address is from the glob-ally routable public IP address space—hence the name Inside Global. Table 4-13 lists and describes the four main NAT address terms. +Chapter 4: IP Addressing 209 + + +Table 4-13 Key +Topic Name + + +NAT Terminology + +Location of Host Represented by Address + + + +IP Address Space in Which Address Exists + + + +Inside Local address Inside the enterprise network + +Part of the enterprise IP address space; typically a private IP address + + + +Inside Global address +Outside Local address + +Outside Global address + +Inside the enterprise network +In the public Internet; +or, outside the enterprise network +In the public Internet; +or, outside the enterprise network + +Part of the public IP address space + +Part of the enterprise IP address space; typically a private IP address + +Part of the public IP address space + + + + +Static NAT + +Static NAT works just like the example in Figure 4-6, but with the IP addresses statically mapped to each other through configuration commands. With static NAT + +■ A particular Inside Local address always maps to the same Inside Global (public) IP address. + +■ If used, each Outside Local address always maps to the same Outside Global (public) IP address. + +■ Static NAT does not conserve public IP addresses. + +Although static NAT does not help with IP address conservation, static NAT does allow an engineer to make an inside server host available to clients on the Internet, because the inside server will always use the same public IP address. + +Example 4-1 shows a basic static NAT configuration based on Figure 4-6. Conceptually, the NAT router has to identify which interfaces are inside (attach to the enterprise’s +IP address space) or outside (attach to the public IP address space). Also, the mapping between each Inside Local and Inside Global IP address must be made. (Although not needed for this example, outside addresses can also be statically mapped.) + +Example 4-1 Static NAT Configuration +Key +Topic !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! E0/0 attaches to the internal Private IP space, so it is configured as an inside +! interface. +interface Ethernet0/0 +ip address 10.1.1.3 255.255.255.0 +210 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +ip nat inside +! S0/0 is attached to the public Internet, so it is defined as an outside +! interface. +interface Serial0/0 +ip address 200.1.1.251 255.255.255.0 +ip nat outside +! Next, two inside addresses are mapped, with the first address stating the +! Inside Local address, and the next stating the Inside Global address. +ip nat inside source static 10.1.1.2 200.1.1.2 +ip nat inside source static 10.1.1.1 200.1.1.1 +! Below, the NAT table lists the permanent static entries from the configuration. +NAT# show ip nat translations + +Pro Inside global +--- 200.1.1.1 +--- 200.1.1.2 + +Inside local +10.1.1.1 +10.1.1.2 + +Outside local +--- +--- + +Outside global +-- +--- + + +The router is performing NAT only for inside addresses. As a result, the router processes packets entering E0/0—packets that could be sent by inside hosts—by examining the source IP address. Any packets with a source IP address listed in the Inside Local column of the show ip nat translations command output (10.1.1.1 or 10.1.1.2) will be translated to source address 200.1.1.1 or 200.1.1.2, respectively, per the NAT table. Likewise, the router examines the destination IP address of packets entering S0/0, because those packets would be destined for inside hosts. Any such packets with a destination of 200.1.1.1 or .2 will be translated to 10.1.1.1 or .2, respectively. + +In cases with static outside addresses being configured, the router also looks at the desti-nation IP address of packets sent from the inside to the outside interfaces, and the source IP address of packets sent from outside interfaces to inside interfaces. + +Dynamic NAT Without PAT + +Dynamic NAT (without PAT), like static NAT, creates a one-to-one mapping between an Inside Local and Inside Global address. However, unlike static NAT, it does so by defin-ing a set or pool of Inside Local and Inside Global addresses, and dynamically mapping pairs of addresses as needed. For example, Figure 4-7 shows a pool of five Inside Global IP addresses—200.1.1.1 through 200.1.1.5. NAT has also been configured to translate any Inside Local addresses whose address starts with 10.1.1. +Chapter 4: IP Addressing 211 + + +1 Key +Topic SA 10.1.1.2 +Inside + + +4 + +SA 200.1.1.1 +Outside + + + + +10.1.1.1 + +Internet NAT +NAT + +Server + + +170.1.1.1 + + + +10.1.1.2 + + + +Criteria for Hosts to NAT: 10.1.1.0 - 10.1.1.255 +2 + +NAT Table Before First Packet Inside Local Inside Global + +NAT Table After First Packet 3 +Inside Local Inside Global 10.1.1.2 200.1.1.1 + + +NAT Pool: 200.1.1.1 200.1.1.2 200.1.1.3 200.1.1.4 200.1.1.5 + + +Figure 4-7 Dynamic NAT + +The numbers 1, 2, and 3 in Figure 4-7 refer to the following sequence of events: + +1. Host 10.1.1.2 starts by sending its first packet to the server at 170.1.1.1. + +2. As the packet enters the NAT router, the router applies some matching logic to decide whether the packet should have NAT applied. Because the logic has been con-figured to mean “translate Inside Local addresses that start with 10.1.1,” the router dynamically adds an entry in the NAT table for 10.1.1.2 as an Inside Local address. +3. The NAT router needs to allocate a corresponding IP address from the pool of valid Inside Global addresses. It picks the first one available (200.1.1.1 in this case) and adds it to the NAT table to complete the entry. + +With the completion of Step 3, the NAT router can actually translate the source IP address and forward the packet. Note that as long as the dynamic NAT entry exists in the NAT table, only host 10.1.1.2 can use Inside Global IP address 200.1.1.1. + +Overloading NAT with Port Address Translation + +As mentioned earlier, NAT is one of the key features that helped to reduce the speed at which the IPv4 address space was being depleted. NAT overloading, also known as Port Address Translation (PAT), is the NAT feature that actually provides the significant sav-ings of IP addresses. The key to understanding how PAT works is to consider the follow-ing: From a server’s perspective, there is no significant difference between 100 different TCP connections, each from a different host, and 100 different TCP connections all from the same host. +212 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +PAT works by making large numbers of TCP or UDP flows from many Inside Local hosts appear to be the same number of large flows from one (or a few) host’s Inside Global addresses. With PAT, instead of just translating the IP address, NAT also translates the port numbers as necessary. And because the port number fields are 16 bits in length, each Inside Global IP address can support over 65,000 concurrent TCP and UDP flows. For example, in a network with 1000 hosts, a single public IP address used as the only Inside Global address could handle an average of six concurrent flows from each host to and from hosts on the Internet. + +Dynamic NAT and PAT Configuration + +Like static NAT, dynamic NAT configuration begins with identifying the inside and out-side interfaces. Additionally, the set of Inside Local addresses is configured with the ip nat inside global command. If you are using a pool of public Inside Global addresses, the set of addresses is defined by the ip nat pool command. Example 4-2 shows a dynamic NAT configuration based on the internetwork shown in Figure 4-7. The example defines 256 Inside Local addresses and two Inside Global addresses. + +Example 4-2 Dynamic NAT Configuration +Key +Topic ! First, the ip nat pool fred command lists a range of IP addresses. The ip nat +! inside source list 1 pool fred command points to ACL 1 as the list of Inside +! Local addresses, with a cross-reference to the pool name. +interface Ethernet0/0 +ip address 10.1.1.3 255.255.255.0 +ip nat inside +! +interface Serial0/0 +ip address 200.1.1.251 255.255.255.0 +ip nat outside +! +ip nat pool fred 200.1.1.1 200.1.1.2 netmask 255.255.255.252 +ip nat inside source list 1 pool fred +! +access-list 1 permit 10.1.1.0 0.0.0.255 +! Next, the NAT table begins as an empty table, because no dynamic entries had +! been created at that point. +NAT# show ip nat translations + +! The NAT statistics show that no hits or misses have occurred. Hits occur when +! NAT looks for a mapping, and finds one. Misses occur when NAT looks for a NAT +! table entry, does not find one, and then needs to dynamically add one. +NAT# show ip nat statistics +Total active translations: 0 (0 static, 0 dynamic; 0 extended) +Chapter 4: IP Addressing 213 + +Outside interfaces: +Serial0/0 +Inside interfaces: +Ethernet0/0 +Hits: 0 Misses: 0 +Expired translations: 0 +Dynamic mappings: +-- Inside Source +access-list 1 pool fred refcount 0 +pool fred: netmask 255.255.255.252 +start 200.1.1.1 end 200.1.1.2 +type generic, total addresses 2, allocated 0 (0%), misses 0 +! At this point, a Telnet session from 10.1.1.1 to 170.1.1.1 started. +! Below, the 1 "miss" means that the first packet from 10.1.1.2 did not have a +! matching entry in the table, but that packet triggered NAT to add an entry to the +! NAT table. Host 10.1.1.2 has then sent 69 more packets, noted as "hits" because +! there was an entry in the table. +NAT# show ip nat statistics +Total active translations: 1 (0 static, 1 dynamic; 0 extended) +Outside interfaces: +Serial0/0 +Inside interfaces: +Ethernet0/0 +Hits: 69 Misses: 1 +Expired translations: 0 +Dynamic mappings: +-- Inside Source +access-list 1 pool fred refcount 1 +pool fred: netmask 255.255.255.252 +start 200.1.1.1 end 200.1.1.2 +type generic, total addresses 2, allocated 1 (50%), misses 0 +! The dynamic NAT entry is now displayed in the table. +NAT# show ip nat translations + +Pro Inside global +--- 200.1.1.1 + +Inside local +10.1.1.2 + +Outside local +--- + +Outside global +--- + +! Below, the configuration uses PAT via the overload parameter. Could have used the +! ip nat inside source list 1 int s0/0 overload command instead, using a single +! IP Inside Global IP address. +NAT(config)# no ip nat inside source list 1 pool fred +NAT(config)# ip nat inside source list 1 pool fred overload +! To test, the dynamic NAT entries were cleared after changing the NAT +! configuration. Before the next command was issued, host 10.1.1.1 had created two +! Telnet connections, and host 10.1.1.2 created 1 more TCP connection. +214 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +NAT# clear ip nat translations * +NAT# show ip nat translations + +Pro Inside global +tcp 200.1.1.1:3212 +tcp 200.1.1.1:3213 +tcp 200.1.1.1:38913 + +Inside local +10.1.1.1:3212 +10.1.1.1:3213 +10.1.1.2:38913 + +Outside local +170.1.1.1:23 +170.1.1.1:23 +170.1.1.1:23 + +Outside global +170.1.1.1:23 +170.1.1.1:23 +170.1.1.1:23 + + + +IPv6 + +In the TCP/IP stack, IP is where packet sorting and delivery take place. At this layer, each incoming or outgoing packet is referred to as a datagram. Each IP datagram bears the source IP address of the sender and the destination IP address of the intended recipient. Unlike MAC addresses, IP addresses in a datagram remain the same throughout a packet’s journey across an internetwork. + +As we have discussed before, the operation of IP is central to the TCP/IP stack—all other TCP/IP protocols use IP—and all data passes through it. IP is a connectionless proto- +col and has some limitations. If IP attempts packet delivery and in the process a packet is lost, delivered out of sequence, duplicated, or delayed, neither sender nor receiver is informed. Packet acknowledgment is handled by a higher-layer transport protocol, such as TCP, which we have discussed previously. + +IP is responsible for addressing and routing packets between hosts, and determines whether fragmentation is necessary. Fragmentation involves breaking a datagram into smaller pieces for optimized routing. The IP protocol will fragment packets prior to send-ing them and will also reassemble them when they reach their destination. + +The issue with IP in the modern internetwork has more to do with capacity constraints rather than operational issues. In short, we can best describe the Achilles heel of IP by pointing out the fact that the Internet has grown so significantly over the decades that there are not enough IP addresses to go around. We obviously are talking about IPv4 addresses. The version 4 address space, as discussed previously, is composed of ad-dresses defined by a series of 32 bits broken up into four separate octets through the use of “dotted decimal” notation. This means that we have a very finite number of addresses available to use at the onset, and this limitation is further compounded by the fact that many addresses in this total range have either been “reserved” for special operations or “wasted” with regard to being inefficiently issued to users. + +In short, we need another solution. That solution is the next generation IP that is being widely adopted across the globe as we speak: IPv6. IP version 6 is considered to be the best fit for the modern network because of the fact that it supports a substantially larger address space to begin with. Whereas IPv4 addresses were 32 bits long, an IPv6 address is 128 bits long. This means that the older IPv4 only supports a maximum of 232 IP addresses, which translates to roughly 4.29 billion total addresses. IPv6, because it uti-lizes 128 bits, supports a maximum of 2128 available addresses: + +340,282,366,920,938,463,463,374,607,431,768,211,456 +Chapter 4: IP Addressing 215 + +For those who care to know, that number would be read as 340 undecillion, 282 decil-lion, 366 nonillion, 920 octillion, 938 septillion, 463 sextillion, 463 quintillion, 374 qua-drillion, 607 trillion, 431 billion, 768 million, 211 thousand, and 456. For the rest of us, we can just say it’s a very big number. + +IPv6 introduces some new concepts with regard to how we annotate addresses and how we implement and categorize address assignment. + +IPv6 Address Format + +IPv6 uses 16-byte hexadecimal number fields separated by colons (:) to represent the 128-bit addressing format that makes the address representation less cumbersome and error-prone. Here is an example of a valid IPv6 address: + +2001:db8:130F:0000:0000:09C0:876A:130B +Additionally, to shorten the IPv6 address and make the address easier to represent, IPv6 uses the following conventions: + +■ Leading 0s in the address field are optional and can be compressed. + +For example: The following hexadecimal numbers can be represented as shown in a compressed format: + +■ Example 1: 0000 = 0 (compressed form) +■ Example 2: 2001:db8:130F:0000:0000:09C0:876A:130B = 2001:db8:130F:0:0:9C0:876A:130B (compressed form) + +■ A pair of colons (::) represents successive fields of 0. However, the pair of colons is allowed just once in a valid IPv6 address. + +■ Example 1: 2001:db8:130F:0:0:9C0:876A:130B = 2001:db8:130F::9C0:876A:130B (compressed form) +■ Example 2: FF01:0:0:0:0:0:1 = FF01::1 (compressed form) + +An address parser can easily identify the number of missing 0s in an IPv6 address by separating the two parts of the address and filling in the 0s until the 128-bit address is complete. However, if two pairs of colons are placed in the same address, there is no way to identify the size of each block of 0s. The use of the :: makes many IPv6 addresses very small. + +Network Prefix + +In IPv6, there are references to prefixes that, in IPv4 terms, loosely equate to subnets. The IPv6 prefix is made up of the leftmost bits and acts as the network identifier. The IPv6 prefix is represented using the IPv6-prefix or prefix-length format just like an IPv4 address is represented in the classless interdomain routing (CIDR) notation. +216 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The / prefix-length variable is a decimal value that indicates the number of high-order contiguous bits of the address that form the prefix, which is the network portion of the address. For example, 2001:db8:8086:6502::/64 is an acceptable IPv6 prefix. If the address ends in a double colon, the trailing double colon can be omitted. So the same +address can be written as 2001:db8:8086:6502/64. In either case, the prefix length is writ-ten as a decimal number 64 and represents the leftmost bits of the IPv6 address. A similar address in IPv4 would be xxx.xxx.xxx.xxx/16. + +IPv6 Address Types + +There is a major difference in the IP address requirements between an IPv4 host and an IPv6 host. An IPv4 host typically uses one IP address, but an IPv6 host can have more than one IP address. + +There are three major types of IPv6 addresses: + +■ Unicast: An address for a single interface. A packet that is sent to a unicast address is delivered to the interface identified by that address. + +■ Anycast: An address for a set of interfaces that typically belong to different nodes. A packet sent to an anycast address is delivered to the closest interface, as defined by the routing protocols in use and identified by the anycast address. + +■ Multicast: An address for a set of interfaces (in a given scope) that typically belong to different nodes. A packet sent to a multicast address is delivered to all interfaces identified by the multicast address (in a given scope). + +Note that in the context of IPv6, there is no concept of Broadcast. + + +Address Management and Assignment + +There are four ways to configure a host address in IPv6: + +■ Static Configuration: Similar to IPv4, the host address, mask, and gateway address are manually defined. + +■ Stateless Address Autoconfiguration (SLAAC): In this case, the host autonomously configures its own address. Router solicitation messages are sent by booting nodes to request Router Advertisements (RA) for configuring the interfaces (RFC 2462). + +■ Stateful DHCPv6: The host uses Dynamic Host Configuration Protocol (DHCP) to get its IPv6 address. This addressing management is similar to IPv4 behavior (RFC 3315). + +■ Stateless DHCP: The host uses SLAAC and also DHCP to get additional parameters such as TFTP Server, WINS, and so on. + +The configuration choice relies on Router Advertisement (RA) flags sent by the router on the LAN. The sections that follow take a cursory look at each of these methods. +Chapter 4: IP Addressing 217 + +Static Configuration + +As in IPv4, the host address can be statically defined. In this case, the IPv6 address, mask, and gateway address are all manually defined on the host. + +Static address configuration is typically used for router interface configuration but is not likely to be used for hosts in IPv6. Keep in mind that using static configuration means that all autoconfiguration features provided by IPv6 will be disabled. + +Stateless Address Autoconfiguration + +Nodes can use IPv6 Stateless Address Autoconfiguration to generate addresses without the necessity of a DHCP server. IPv6 addresses are formed by combining network pre-fixes with an interface identifier. On interfaces with embedded Institute of Electrical and Electronics Engineers (IEEE) identifiers, the interface identifier is typically derived from the IEEE identifier. + +The address autoconfiguration feature is built into the IPv6 protocol to facilitate intranet-wide address management that enables a large number of IP hosts to easily discover the network and get new and globally unique IPv6 addresses associated with their location. The autoconfiguration feature enables plug-and-play Internet deployment of new con-sumer devices, such as cell phones, wireless devices, home appliances, and so on. As a result, network devices can connect to the network without manual configuration and without any servers, such as DHCP servers. We need to take a slightly closer look at the principles behind this feature. + +A router on a local link sends network-type information through RA messages, such as the prefix of the local link and the default route in its router advertisements. The router provides this information to all the nodes on the local link. + +A host can then build its address by appending a host identifier to the /64 prefix received from the router. As a result, Ethernet hosts can autoconfigure themselves by appending their 48-bit link-layer address (MAC address) in an extended universal identifier EUI-64-bit format to the 64 bits of the local link prefix advertised by the router. + +Another hugely beneficial aspect to this approach is the ease with which address renum-bering can be implemented. In IPv6 networks, the autoconfiguration feature makes renumbering an existing network simple and relatively easy compared to IPv4. The router sends the new prefix from the new upstream provider in its router announcements. The hosts in the network automatically pick the new prefix from the router advertisements and then use it to create their new addresses. As a result, the transition from provider A to B becomes manageable for network operators. + +Stateful DHCPv6 + +Many enterprises currently use DHCP to distribute addresses to their hosts. IPv6 can be deployed with the same DHCP mechanism. +218 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The process for acquiring configuration data for a client in IPv6 is similar to that in IPv4. However, DHCPv6 uses multicast for many of its messages. Initially, the client must first detect the presence of routers on the link using neighbor discovery messages. If a router is found, the client examines the router advertisements to determine whether DHCP should be used. If the router advertisements enable the use of DHCP on that link (dis-abling the Autoconfiguration flag and enabling the Managed flag in RA messages allows a host to use DHCPv6 to obtain an IPv6 address), the client starts a DHCP solicitation phase to find a DHCP server. + +Using DHCPv6 provides the following benefits: + +■ More control than serverless/stateless autoconfiguration. + +■ It can be used concurrently with stateless autoconfiguration. + +■ It can be used for renumbering. + +■ It can be used for automatic domain name registration of hosts using dynamic DNS. + +■ It can be used to delegate the IPv6 prefix to leaf customer premises equipment (CPE) routers. + + +Stateless DHCP + +Stateless DHCPv6 normally combines stateless autoconfiguration for address assignment with DHCPv6 exchange for all other configuration settings. In this case, DHCPv6 is only used for the host to acquire additional parameters, such as a TFTP server, a DNS server, and so on. + +A host builds its address by appending a host identifier to the /64 prefix received from the router and then issues a DHCP solicit message to the DHCP server. + +IPv6 Transition Technologies + +The success of IPv6 originally was thought to depend on the new applications that run over it. However, it is becoming very clear that the exhaustion of IPv4 will ultimately end up being the driver for IPv6 adoption. A key part of any good IPv6 design is its ability to integrate into and coexist with existing IPv4 networks. IPv4 and IPv6 hosts need to coex-ist for a substantial length of time during the steady migration from IPv4 to IPv6, and the development of transition strategies, tools, and mechanisms has been part of the basic IPv6 design from the start. + +There are three IPv6 transition technologies: dual stack, tunneling, and translation. + + +Dual Stack + +Dual stack is the basic strategy to use for large agencies that are adopting IPv6. It involves configuring devices to be able to run IPv4 and IPv6 simultaneously. IPv4 communication uses the IPv4 protocol stack, and IPv6 communication uses the IPv6 protocol stack. +Chapter 4: IP Addressing 219 + +Applications choose between using IPv4 or IPv6 based on the response to DNS requests. The application selects the correct address based on the type of IP traffic. Because dual stack allows hosts to simultaneously reach existing IPv4 content and IPv6 content as it becomes available, dual stack offers a very flexible adoption strategy. However, because IPv4 addresses are still required, dual stack is not a long-term solution to address exhaustion. + +Dual stack also avoids the need to translate between protocol stacks. Translation is a valid adoption mechanism, but it introduces operational complexity and lower performance. Because a host automatically selects the right transport to use to reach a destination based on DNS information, there should not be a need to translate between an IPv6 host and an IPv4 server. + +Tunneling + +Tunnels encapsulate IPv6 traffic within IPv4 packets, and are primarily used for com-munication between IPv6 (or dual stack) sites or for connection to remote IPv6 networks or hosts over an IPv4 backbone. There are many different tunneling techniques, including 6to4, ISATAP, Teredo, 6PE, 6VPE, and mGRE v6 over v4. Tunnels can be manually con-figured or automatically configured. Most modern operating systems include support for tunneling in addition to dual stack. + +Example 4-3 presents a simple 6to4 tunnel configuration. + +Example 4-3 Dynamic 6to4 Tunnel Configuration + +On R2 + +R2(config)# int tunnel 23 +R2(config-if)# ipv6 addr 23::2/64 +R2(config-if)# tunnel source lo0 +R2(config-if)# tunnel destination 3.3.3.3 +R2(config-if)# tunnel mode ipv6ip + +You should see the following console message stating that the tunnel interface is UP: + +%LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel23, changed state +to up +On R3 + +R3(config)# int tunnel 32 +R3(config-if)# ipv6 addr 23::3/64 +R3(config-if)# tunnel source lo0 +R3(config-if)# tunnel destination 2.2.2.2 +R3(config-if)# tunnel mode ipv6ip +220 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +You should see the following console message stating that the tunnel interface is UP: + +%LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel32, changed state +to up +On R2 + +R2# Ping 23::3 + +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 23::3, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 56/58/60 ms + + +Translation + +Address Family Translation (AFT) is the process of translating addresses from one address family to another. During the adoption phase, AFT is primarily used to translate between IPv6 hosts and IPv4 content. AFT can be stateless, where reserved portions +of the IPv6 address space are automatically mapped to IPv4, or it can be stateful, with addresses from a configured range used to map packets between address families. + +Nearly all enterprise deployments of IPv6 use dual stack internally. Dual stack offers a nondisruptive way to learn about and gain operational experience with a new address family, which is an important part of successfully managing the transition. + +Pilots and trials depend on specific requirements. +Chapter 4: IP Addressing 221 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 4-14 lists and briefly explains several variations on NAT. + + + +Table 4-14 Key +Topic Name + +Static NAT + + +Variations on NAT + +Function +Statically correlates the same public IP address for use by the same local host every time. Does not conserve IP addresses. + + + +Dynamic NAT + + +Dynamic NAT with overload (PAT) + +NAT for overlapping address + +Pools the available public IP addresses, shared among a group of local hosts, but with only one local host at a time using a public IP address. Does not conserve IP addresses. +Like dynamic NAT, but multiple local hosts share a single public IP address by multiplexing using TCP and UDP port numbers. Conserves IP addresses. +Can be done with any of the first three types. Translates both source and destination addresses, instead of just the source (for packets going from enterprise to the Internet). + + + +Table 4-15 lists the protocols mentioned in this chapter and their respective standards documents. + + +Table 4-15 Protocols and Standards for Chapter 4 +Key +Topic Name + +IP + +Subnetting + +NAT + + + +Standardized In +RFC 791 + +RFC 950 + +RFC 1631 + + + +Private addressing + +CIDR + +DHCPv6 + +Internet Protocol version 6 (IPv6) Addressing Architecture + +IPv6 Global Unicast Address Format + +RFC 1918 + +RFCs 1517–1520 + +RFC 3315 + +RFC 3513 + +RFC 3587 +222 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 4-16 lists and describes some of the most commonly used IOS commands related to the topics in this chapter. + + +Table 4-16 + +Command + + +Command Reference for Chapter 4 + +Description + + + +ip address ip-address mask [secondary] + +ip nat {inside | outside} + +ip nat inside source {list {access-list-number | access-list-name} | route-map name} {interface type number | pool pool-name} [overload] + +ip nat inside destination list {access-list-number | name} pool name + +ip nat outside source {list {access-list-number | access-list-name} | route-map name} pool pool-name [add-route] + +ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length } +[type rotary] + +show ip nat statistics + + +show ip nat translations [verbose ] + +Interface subcommand to assign an IPv4 address +Interface subcommand; identifies inside or outside part of network +Global command that defines the set of inside addresses for which NAT will be performed, and corresponding outside addresses + +Global command used with destination NAT + +Global command used with both destination and dynamic NAT + +Global command to create a pool of addresses for dynamic NAT + +Lists counters for packets and for NAT table entries, as well as basic configuration information +Displays the NAT table + + +clear ip nat translation {* | [inside global-ip Clears all or some of the dynamic entries in local-ip] [outside local-ip global-ip]} the NAT table, depending on which parameters +are used + + +debug ip nat + +show ip interface [type number ] [brief] + +Issues log messages describing each packet whose IP address is translated with NAT +Lists information about IPv4 on interfaces + + + +Figure 4-8 shows the IP header format. + +Global Routing Prefix Subnet ID Interface ID + +1st 3 bytes of MAC + + +FFFE + +2nd 3 bytes of MAC + +48 bits 16 bits +64 bits, EUI-64 format + + +Begins with binary 001, meaning the initial hex digit is 2 or 3 + +Inverts bit 7 of MAC when creating the IPv6 address + + +Figure 4-8 IP Header +Chapter 4: IP Addressing 223 + +Table 4-17 lists the terms and meanings of the fields inside the IP header. + + + +Table 4-17 Key +Topic Field + +Version + + +IP Header Fields + +Meaning +Version of the IP protocol. Most networks use IPv4 today, with IPv6 becoming more popular. The header format reflects IPv4. + + + +Header Length + + +DS Field + + + +Packet Length + +Identification + + +Flags + +Defines the length of the IP header, including optional fields. Because the length of the IP header must always be a multiple of 4, the IP header length (IHL) is multiplied by 4 to give the actual number of bytes. +Differentiated Services Field. This byte was originally called the Type of Service (ToS) byte, but was redefined by RFC 2474 as the DS Field. It is used for marking packets for the purpose of applying different quality of service (QoS) levels to different packets. +Identifies the entire length of the IP packet, including the data. + +Used by the IP packet fragmentation process. If a single packet is fragmented into multiple packets, all fragments of the original packet contain the same identifier so that the original packet can be reassembled. +3 bits used by the IP packet fragmentation process. + + +Fragment Offset A number set in a fragment of a larger packet that identifies the fragment’s location in the larger original packet. + +Time to Live (TTL) + +Protocol + + +Header Checksum + +Source IP Address +Destination IP Address + +A value used to prevent routing loops. Routers decrement this field by 1 each time the packet is forwarded; when it decrements to 0, the packet is discarded. +A field that identifies the contents of the data portion of the IP packet. For example, protocol 6 implies that a TCP header is the first thing in the IP packet data field. +A value used to store a frame check sequence (FCS) value, whose purpose is to determine whether any bit errors occurred in the IP header (not the data) during transmission. +The 32-bit IP address of the sender of the packet. + +The 32-bit IP address of the intended recipient of the packet. + +Optional Header IP supports additional header fields for future expansion through optional Fields and headers. Also, if these optional headers do not use a multiple of 4 bytes, Padding padding bytes are added, composed of all binary 0s, so that the header is +a multiple of 4 bytes in length. + + + +Table 4-18 lists some of the more common IP protocol field values. +224 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 4-18 IP Protocol Field Values Key +Topic Protocol Name Protocol Number + +ICMP 1 + +TCP 6 + +UDP 17 + +EIGRP 88 + +OSPF 89 + +PIM 103 + + +Figure 4-9 Illustrates an IPv6 header. + + +Version ToS Length Byte + + +Len ID Offset TTL Proto FCS IP SA IP DA Data + +IPv4 Packet + +7 6 5 4 3 2 1 0 +IP Precedence Unused Standard IPv4 + +DiffServ Code Point (DSCP) Flow Ctrl DiffServ Extensions + +Figure 4-9 IPv6 Header + +Table 4-19 lists the terms and meanings for the fields in the header illustration. + + + +Table 4-19 + +Field +Version + + +IPv6 Header Fields + +Meaning +4 bits. IPv6 version number. + + + +Traffic Class + +Flow Label + +Payload Length + +Next Header + +Hop Limit + + + +Source Address + +Destination Address + +8 bits. Internet traffic priority delivery value. + +20 bits. Used for specifying special router handling from the source to the destination(s) for a sequence of packets. +16 bits. Specifies the length of the data in the packet. When cleared to 0, the option is a hop-by-hop Jumbo payload. +8 bits. Specifies the next encapsulated protocol. The values are compatible with those specified for the IPv4 protocol field. +8 bits. For each router that forwards the packet, the hop limit is decremented by 1. When the hop limit field reaches 0, the packet is discarded. This replaces the TTL field in the IPv4 header that was originally intended to be used as a time-based hop limit. +16 bytes. The IPv6 address of the sending node. + +16 bytes. The IPv6 address of the destination node. +Chapter 4: IP Addressing 225 + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill in Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write the definitions for the following terms: + +subnet, prefix, classless IP addressing, classful IP addressing, CIDR, NAT, IPv4, subnet broadcast address, subnet number, subnet zero, broadcast subnet, subnet mask, private addresses, SLSM, VLSM, Inside Local address, Inside Global address, Outside Local address, Outside Global address, PAT, overloading, quartet, IPv6, 6to4 Tunnel, ISATAP, DHCPv6, AFT +Refer to the glossary to check your answers. + + +Further Reading + +All topics in this chapter are covered in varying depth for the CCNP Routing exam. For more details on these topics, look for the CCNP routing study guides at www.ciscopress.com/ccnp. + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their con-text within the blueprint. + +■ Hot Standby Router Protocol (HSRP) +■ Gateway Load Balancing Protocol (GLBP) +■ Virtual Router Redundancy Protocol (VRRP) +■ Dynamic Host Configuration Protocol (DHCP) +■ Network Time Protocol (NTP) +■ Web Cache Communication Protocol (WCCP) +■ Network Management +■ Logging and Syslog +■ Troubleshoot Network Services +■ Implement IP Service Level Agreement (IP SLA) +■ Object Tracking +■ Implement NetFlow +■ Implement Router IP Traffic Export (RITE) +■ Implement SNMP +■ Implement Cisco IOS Embedded Event Manager (EEM) +■ Implement Remote Monitoring (RMON) +■ Implement FTP +■ Implement TFTP +■ Implement TFTP Server on Router +■ Implement Secure Copy Protocol (SCP) +■ Implement HTTP and HTTPS +■ Implement Telnet +■ Implement SSH +CHAPTER 5 + + + + + + +IP Services + + +IP relies on several protocols to perform a variety of tasks related to the process of rout-ing packets. This chapter provides a reference for the most popular of these protocols. In addition, this chapter covers a number of management-related protocols and other blue-print topics related to IP services. + +“Do I Know This Already?” Quiz + +Table 5-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 5-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section + +ARP, Proxy ARP, Reverse ARP, BOOTP, and DHCP + +HSRP, VRRP, and GLBP + +Network Time Protocol + +SNMP + +Web Cache Communication Protocol + +Implement SSH + +Implement SSH, HTTPS, FTP, SCP, TFTP + +Implement RMON + +Implement IP SLA, NetFlow, RITE, EEM + +Total Score + +Questions Covered in Score This Section +1–3 + +4–6 + +7 + +8–9 + +10–11 + +12 + +13 + +14 + +15 +228 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. Two hosts, named PC1 and PC2, sit on subnet 172.16.1.0/24, along with Router R1. A web server sits on subnet 172.16.2.0/24, which is connected to another interface of R1. At some point, both PC1 and PC2 send an ARP request before they successfully send packets to the web server. With PC1, R1 makes a normal ARP reply, but for PC2, R1 uses a proxy ARP reply. Which two of the following answers could be true given the stated behavior in this network? +a. PC2 set the proxy flag in the ARP request. + +b. PC2 encapsulated the ARP request inside an IP packet. + +c. PC2’s ARP broadcast implied that PC2 was looking for the web server’s MAC address. + +d. PC2 has a subnet mask of 255.255.0.0. + +e. R1’s proxy ARP reply contains the web server’s MAC address. + +2. Host PC3 is using DHCP to discover its IP address. Only one router attaches to PC3’s subnet, using its fa0/0 interface, with an ip helper-address 10.5.5.5 com-mand on that same interface. That same router interface has an ip address 10.4.5.6 255.255.252.0 command configured as well. Which of the following are true about PC3’s DHCP request? +a. The destination IP address of the DHCP request packet is set to 10.5.5.5 by the router. + +b. The DHCP request packet’s source IP address is unchanged by the router. + +c. The DHCP request is encapsulated inside a new IP packet, with source IP address 10.4.5.6 and destination 10.5.5.5. + +d. The DHCP request’s source IP address is changed to 10.4.5.255. + +e. The DHCP request’s source IP address is changed to 10.4.7.255. + +3. Which of the following statements are true about BOOTP, but not true about RARP? + +a. The client can be assigned a different IP address on different occasions, because the server can allocate a pool of IP addresses for allocation to a set of clients. + +b. The server can be on a different subnet from the client. + +c. The client’s MAC address must be configured on the server, with a one-to-one mapping to the IP address to be assigned to the client with that MAC address. + +d. The client can discover its IP address, subnet mask, and default gateway IP address. +Chapter 5: IP Services 229 + +4. R1 is HSRP active for virtual IP address 172.16.1.1, with HSRP priority set to 115. R1 is tracking three separate interfaces. An engineer configures the same HSRP group on R2, also connected to the same subnet, only using the standby 1 ip 172.16.1.1 command, and no other HSRP-related commands. Which of the following would cause R2 to take over as HSRP active? +a. R1 experiences failures on tracked interfaces, totaling 16 or more lost points. + +b. R1 experiences failures on tracked interfaces, totaling 15 or more lost points. + +c. R2 could configure a priority of 116 or greater. + +d. R1’s fa0/0 interface fails. + +e. R2 would take over immediately. + +5. Which Cisco IOS feature does HSRP, GLBP, and VRRP use to determine when an interface fails for active switching purposes? + +a. Each protocol has a built-in method of tracking interfaces. + +b. When a physical interface goes down, the redundancy protocol uses this auto-matically as a basis for switching. + +c. Each protocol uses its own hello mechanism for determining which interfaces are up or down. + +d. The Cisco IOS object tracking feature. + +6. Which is the correct term for using more than one HSRP group to provide load bal-ancing for HSRP? + +a. LBHSRP + +b. LSHSRP + +c. RHSRP + +d. MHSRP + +e. None of these is correct. HSRP does not support load balancing. + +7. Which of the following NTP modes in a Cisco router requires a predefinition of the IP address of an NTP server? + +a. Server mode + +b. Static client mode + +c. Broadcast client mode + +d. Symmetric active mode +230 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +8. Which of the following are true about SNMP security? + +a. SNMP Version 1 calls for the use of community strings that are passed as clear text. + +b. SNMP Version 2c calls for the use of community strings that are passed as MD5 message digests generated with private keys. + +c. SNMP Version 3 allows for authentication using MD5 message digests gener-ated with private keys. + +d. SNMP Version 3 authentication also requires concurrent use of encryption, typically done with DES. + +9. Which of the following statements are true regarding features of SNMP based on the SNMP version? + +a. SNMP Version 2 added the GetNext protocol message to SNMP. + +b. SNMP Version 3 added the Inform protocol message to SNMP. + +c. SNMP Version 2 added the Inform protocol message to SNMP. + +d. SNMP Version 3 expanded the SNMP Response protocol message so that it must be used by managers in response to Traps sent by agents. + +e. SNMP Version 3 enhanced SNMP Version 2 security features but not other features. + +10. WCCP uses what protocol and port for communication between content engines and WCCP routers? + +a. UDP 2048 + +b. TCP 2048 + +c. UDP 4082 + +d. TCP 4082 + +11. In a WCCP cluster, which content engine becomes the lead engine after the cluster stabilizes? + +a. The content engine with the lowest IP address. + +b. The content engine with the highest IP address. + +c. There is no such thing as a lead content engine; the correct term is designated content engine. + +d. All content engines have equal precedence for redundancy and the fastest pos-sible load sharing. +Chapter 5: IP Services 231 + +12. Which configuration commands are required to enable SSH on a router? + +a. hostname + +b. ip domain-name + +c. ip ssh + +d. crypto key generate rsa + +e. http secure-server + +13. Which protocol is the most secure choice, natively, for transferring files from a router? + +a. SSH + +b. HTTPS + +c. FTP + +d. TFTP + +e. SCP + +14. In RMON, which type of configured option includes rising and falling thresholds, either relative or absolute, and is monitored by another type of RMON option? + +a. Event + +b. Alert + +c. Notification + +d. Port + +e. Probe + +15. Which Cisco IOS feature permits end-to-end network performance monitoring with configuration on devices at each end of the network? + +a. Flexible NetFlow + +b. IP SLA + +c. EEM + +d. RITE +232 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Foundation Topics + + +ARP, Proxy ARP, Reverse ARP, BOOTP, and DHCP + +The heading for this section might seem like a laundry list of a lot of different protocols. However, these five protocols do have one central theme, namely, that they help a host learn information so that it can successfully send and receive IP packets. Specifically, Address Resolution Protocol (ARP) and proxy ARP define methods for a host to learn another host’s MAC address, whereas the core functions of Reverse ARP (RARP), Bootstrap Protocol (BOOTP), and DHCP define how a host can discover its own IP address, plus additional related information. + +ARP and Proxy ARP + +You would imagine that anyone getting this far in his CCIE study would already have a solid understanding of the Address Resolution Protocol (ARP, RFC 826). However, proxy ARP (RFC 1027) is often ignored, in part because of its lack of use today. To see how they both work, Figure 5-1 shows an example of each, with Fred and Barney both trying to reach the web server at IP address 10.1.2.200. + + +Fred: 10.1.1.101 Mask: /24 +GW = 10.1.1.1 + +ARP Request Target = 10.1.1.1 + +ARP Reply +Source = R1-E1-MAC + + + + +Interface: E1 MAC: R1-E1-MAC 10.1.1.1/24 + + + + +Web Server: 10.1.2.200/24 GW = 10.1.2.1 + + + + + + + +Barney: 10.1.1.102 Mask: /8 +GW = 10.1.1.1 + + + + +ARP Request Target = 10.1.2.200 + +ARP Reply +Source = R1-E1-MAC + + + + + + +Proxy logic used by R1! + +R1 +Interface: E2 MAC: R1-E2-MAC +10.1.2.1/24 + + +DHCP Server: 10.1.2.202/24 + + +DNS Server: 10.1.2.203/24 + + +Figure 5-1 Comparing ARP and Proxy ARP + +Fred follows a normal ARP process, broadcasting an ARP request, with R1’s E1 IP address as the target. The ARP message has a Target field of all 0s for the MAC address that needs to be learned, and a target IP address of the IP address whose MAC address it is searching, namely, 10.1.1.1 in this case. The ARP reply lists the MAC address associated with the IP address, in this case, the MAC address of R1’s E1 interface. +Chapter 5: IP Services 233 + + +Note The ARP message itself does not include an IP header, although it does have des-tination and source IP addresses in the same relative position as an IP header. The ARP request lists an IP destination of 255.255.255.255. The ARP Ethernet protocol type is 0x0806, whereas IP packets have an Ethernet protocol type of 0x0800. + + +Proxy ARP uses the exact same ARP message as ARP, but the ARP request is actually requesting a MAC address that is not on the local subnet. Because the ARP request is broadcast on the local subnet, it will not be heard by the target host—so if a router can route packets to that target host, the router issues a proxy ARP reply on behalf of that target. + +For example, Barney places the web server’s IP address (10.1.2.200) in the Target field, because Barney thinks that he is on the same subnet as the web server because of Barney’s mask of 255.0.0.0. The ARP request is a LAN broadcast, so R1, being a well-behaved router, does not forward the ARP broadcast. However, knowing that the ARP request will never get to the subnet where 10.1.2.200 resides, R1 saves the day by replying to the ARP on behalf of the web server. R1 takes the web server’s place in the ARP pro-cess, hence the name proxy ARP. Also, note that R1’s ARP reply contains R1’s E1 MAC address, so that Barney will forward frames to R1 when Barney wants to send a packet to the web server. + +Before the advent of DHCP, many networks relied on proxy ARP, configuring hosts to use the default masks in their respective networks. Regardless of whether the proxy ver-sion is used, the end result is that the host learns a router’s MAC address to forward pack-ets to another subnet. + +RARP, BOOTP, and DHCP + +The ARP and proxy ARP processes both occur after a host knows its IP address and subnet mask. RARP, BOOTP, and DHCP represent the evolution of protocols defined to help a host dynamically learn its IP address. All three protocols require the client host to send a broadcast to begin discovery, and all three rely on a server to hear the request and supply an IP address to the client. Figure 5-2 shows the basic processes with RARP and BOOTP. + +A RARP request is a host’s attempt to find its own IP address. So RARP uses the same old ARP message, but the ARP request lists a MAC address target of its own MAC address and a target IP address of 0.0.0.0. A preconfigured RARP server, which must be on the same subnet as the client, receives the request and performs a table lookup in its configuration. If that target MAC address listed in the ARP request is configured on the RARP server, the RARP server sends an ARP reply, after entering the configured IP address in the Source IP address field. +234 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + + +1 RARP Broadcast +2 RARP Reply +1 + +RARP +Hannah RARP Server + +IP: ?.?.?.? +MAC: 0200.1111.1111 +2 + + +Configuration MAC IP +0200.1111.1111 10.1.1.1 0200.1234.5678 10.1.1.2 0200.5432.1111 10.1.1.3 + + + +Hey Everybody! My MAC Address Is 0200.1111.1111. If You Are a RARP Server, Please Tell Me My IPAddress! + +BOOTP + + +Your IPAddress Is 10.1.1.1 + + +Configuration + + + + +1 BOOTP Broadcast +2 BOOTP Reply +1 + + +Hannah +BOOTP Server + +IP: ?.?.?.? +MAC: 0200.1111.1111 +2 + +MAC IP Gateway 0200.1111.1111 10.1.1.1 10.1.1.200 0200.1234.5678 10.1.1.2 10.1.1.200 0200.5432.1111 10.1.1.3 10.1.1.200 + +10.1.1.200 + + + +Hey Everybody! My MAC Address Is 0200.1111.1111. If You Are a BOOTP Server, Please Tell Me My IPAddress! + + +Your IPAddress Is 10.1.1.1 +Your Default Gateway Is 10.1.1.200 +… + + +R1 + + +Figure 5-2 RARP and BOOTP—Basic Processes + + + +Key Topic + +BOOTP was defined in part to improve IP address assignment features of RARP. BOOTP uses a completely different set of messages, defined by RFC 951, with the commands encapsulated inside an IP and UDP header. With the correct router configuration, a router can forward the BOOTP packets to other subnets—allowing the deployment of a centrally located BOOTP server. Also, BOOTP supports the assignment of many other tidbits of information, including the subnet mask, default gateway, DNS addresses, and its namesake, the IP address of a boot (or image) server. However, BOOTP does not solve the configuration burden of RARP, still requiring that the server be preconfigured with +the MAC addresses and IP addresses of each client. + + + +DHCP + +DHCP represents the next step in the evolution of dynamic IP address assignment. Building on the format of BOOTP protocols, DHCP focuses on dynamically assigning a variety of information and provides flexible messaging to allow for future changes, without requiring predefinition of MAC addresses for each client. DHCP also includes +temporary leasing of IP addresses, enabling address reclamation, pooling of IP addresses, and, recently, dynamic registration of client Domain Name System (DNS) fully qualified domain names (FQDN). (See www.ietf.org for more information on FQDN registration.) + +DHCP servers typically reside in a centralized location, with remote routers forwarding the LAN-broadcast DHCP requests to the DHCP server by changing the request’s desti-nation address to match the DHCP server. This feature is called DHCP relay agent. For example, in Figure 5-1, if Fred and Barney were to use DHCP, with the DHCP server at 10.1.2.202, R1 would change Fred’s DHCP request from a destination of 255.255.255.255 to a destination of 10.1.2.202. R1 would also list its own IP address in the message, in the gateway IP address (giaddr) field, notifying the DHCP server of the IP address to which +Chapter 5: IP Services 235 + +the response should be sent. After receiving the next DHCP message from the server, R1 would change the destination IP address to a LAN broadcast, and forward the packet onto the client’s LAN. The only configuration requirement on the router is an ip helper-address 10.1.2.202 interface subcommand on its E1 interface. + +Alternatively, R1 could be configured as a DHCP server—a feature that is not often con-figured on routers in production networks but is certainly fair game for the CCIE written and lab exams. Configuring DHCP on a router consists of several required steps: +Step 1. Configure a DHCP pool. + +Step 2. Configure the router to exclude its own IP address from the DHCP pool. + +Step 3. Disable DHCP conflict logging or configure a DHCP database agent. + +The DHCP pool includes key items such as the subnet (using the network command within DHCP pool configuration), default gateway (default-router), and the length of time for which the DHCP lease is valid (lease). Other items, including the DNS domain name and any DHCP options, are also defined within the DHCP pool. + +Although not strictly necessary in DHCP configuration, it is certainly a best practice to configure the router to make its own IP address in the DHCP pool subnet unavailable for allocation through DHCP. The same is true for any other static IP addresses within the DHCP pool range, such as those of servers and other routers. Exclude host IP addresses from the DHCP process using the ip dhcp excluded-address command. + + +Note The ip dhcp excluded-address command is one of the relatively few Cisco IOS ip commands that is a global configuration command rather than an interface command. + + +The Cisco IOS DHCP server also provides a mechanism for logging DHCP address con-flicts to a central server called a DHCP database agent. IOS requires that you either dis-able conflict logging by using the no ip dhcp conflict-logging command or configure a DHCP database agent on a server by using the ip dhcp database command. Example 5-1 shows R1’s configuration for a DHCP relay agent, as well as an alternative for R1 to pro-vide DNS services for subnet 10.1.1.0/24. + +Example 5-1 DHCP Configuration Options—R1, Figure 5-1 + +! UDP broadcasts coming in E0 will be forwarded as unicasts to 10.1.2.202. +! The source IP will be changed to 10.1.1.255, so that the reply packets will be +! broadcast back out E0. +interface Ethernet1 +ip address 10.1.1.1 255.255.255.0 +ip helper-address 10.1.2.202 +! Below, an alternative configuration, with R1 as the DHCP server. R1 assigns IP +! addresses other than the excluded first 20 IP addresses in the subnet, and +! informs the clients of their IP addresses, mask, DNS, and default router. Leases +236 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! are for 0 days, 0 hours, and 20 minutes. +ip dhcp excluded-address 10.1.1.0 10.1.1.20 +! +ip dhcp pool subnet1 +network 10.1.1.0 255.255.255.0 +dns-server 10.1.2.203 +default-router 10.1.1.1 +lease 0 0 20 + +Table 5-2 summarizes some of the key comparison points with RARP, BOOTP, and DHCP. + +Table 5-2 Comparing RARP, BOOTP, and DHCP +Key +Topic Feature RARP BOOTP DHCP + +Relies on server to allocate IP addresses Yes Yes Yes + +Encapsulates messages inside IP and UDP so that they can be No Yes Yes forwarded to a remote server +Client can discover its own mask, gateway, DNS, and No Yes Yes download server +Dynamic address assignment from a pool of IP addresses, No No Yes without requiring knowledge of client MACs +Allows temporary lease of IP address No No Yes + +Includes extensions for registering client’s FQDN with a DNS No No Yes + + + +HSRP, VRRP, and GLBP + +IP hosts can use several methods of deciding which default router or default gateway to use—DHCP, BOOTP, ICMP Router Discovery Protocol (IRDP), manual configuration, or even by running a routing protocol (although having hosts run a routing protocol +is not common today). The most typical methods—using DHCP or manual configura-tion—result in the host knowing a single IP address of its default gateway. Hot Standby Router Protocol (HSRP), Virtual Router Redundancy Protocol (VRRP), and Gateway Load Balancing Protocol (GLBP) represent a chronological list of some of the best tools for overcoming the issues related to a host knowing a single IP address as its path to get outside the subnet. +Chapter 5: IP Services 237 + + + +Key Topic + +HSRP allows multiple routers to share a virtual IP and MAC address so that the end-user +hosts do not realize when a failure occurs. Some of the key HSRP features are as follows: + + +■ Virtual IP address and virtual MAC are active on the HSRP Active router. + +■ Standby routers listen for Hellos from the Active router, defaulting to a 3-second hello interval and 10-second dead interval. + +■ Highest priority (IOS default 100, range 1–255) determines the Active router, with preemption disabled by default. + +■ Supports tracking, whereby a router’s priority is decreased when a tracked object (interface or route) fails. + +■ Up to 255 HSRP groups per interface, enabling an administrative form of load bal-ancing. + +■ Virtual MAC of 0000.0C07.ACxx, where xx is the hex HSRP group. + +■ Virtual IP address must be in the same subnet as the routers’ interfaces on the same LAN. + +■ Virtual IP address must be different from any of the routers’ individual interface IP addresses. + +■ Supports clear-text and MD5 authentication (through a key chain). + +Example 5-2 shows a typical HSRP configuration, with two groups configured. Routers R1 and R2 are attached to the same subnet, 10.1.1.0/24, both with WAN links (S0/0.1) connecting them to the rest of an enterprise network. Cisco IOS provides the tracking mechanism shown in Example 5-2 to permit many processes, including HSRP, VRRP, and GLBP, to track interface states. A tracking object can track based on the line protocol (shown here) or the IP routing table. The example contains the details and explanation of the configuration. + +Example 5-2 HSRP Configuration +Key +Topic ! First, on Router R1, a tracking object must be configured so that +! HSRP can track the interface state. +track 13 interface Serial0/0.1 line-protocol +! Next, on Router R1, two HSRP groups are configured. R1 has a higher priority +! in group 21, with R2 having a higher priority in group 22. R1 is set to preempt +! in group 21, as well as to track interface s0/0.1 for both groups. +interface FastEthernet0/0 +ip address 10.1.1.1 255.255.255.0 +standby 21 ip 10.1.1.21 +continues +standby 21 priority 105 +standby 21 preempt +standby 21 track 13 +standby 22 ip 10.1.1.22 +238 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +standby 22 track 13 +! Next, R2 is configured with a higher priority for HSRP group 22, and with +! HSRP tracking enabled in both groups. The tracking "decrement" used by R2, +! when S0/0.1 fails, is set to 9 (instead of the default of 10). +! A tracking object must be configured first, as on R1. +track 23 interface Serial0/0.1 line-protocol +interface FastEthernet0/0 +ip address 10.1.1.2 255.255.255.0 +standby 21 ip 10.1.1.21 +standby 21 track 23 +standby 22 ip 10.1.1.22 +standby 22 priority 105 +standby 22 track 23 decrement 9 +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! On R1 below, for group 21, the output shows that R1 is active, with R2 +! (10.1.1.2) as standby. +! R1 is tracking s0/0.1, with a default "decrement" of 10, meaning that the +! configured priority of 105 will be decremented by 10 if s0/0.1 fails. +Router1# sh standby fa0/0 +FastEthernet0/0 - Group 21 +State is Active +2 state changes, last state change 00:00:45 +Virtual IP address is 10.1.1.21 +Active virtual MAC address is 0000.0c07.ac15 +Local virtual MAC address is 0000.0c07.ac15 (v1 default) +Hello time 3 sec, hold time 10 sec +Next hello sent in 2.900 secs +Preemption enabled +Active router is local +Standby router is 10.1.1.2, priority 100 (expires in 7.897 sec) +Priority 105 (configured 105) +Track object 13 state Up decrement 10 +IP redundancy name is "hsrp-Fa0/0-21" (default) +! output omitted +! NOT SHOWN—R1 shuts down S0.0.1, lowering its priority in group 21 by 10. +! The debug below shows the reduced priority value. However, R2 does not become +! active, because R2's configuration did not include a standby 21 preempt command. +Router1# debug standby +*Mar 1 00:24:04.122: HSRP: Fa0/0 Grp 21 Hello out 10.1.1.1 Active pri 95 vIP 10.1.1.21 +Chapter 5: IP Services 239 + + + +Key Topic + +Because HSRP uses only one Active router at a time, any other HSRP routers are idle. To provide load sharing in an HSRP configuration, the concept of Multiple HSRP, or MHSRP, was developed. In MHSRP, two or more HSRP groups are configured on each HSRP LAN interface, where the configured priority determines which router will be active for each HSRP group. + +MHSRP requires that each DHCP client and statically configured host are issued a default gateway corresponding to one of the HSRP groups and requires that they’re distributed appropriately. Thus, in an MHSRP configuration with two routers and two groups, all other things being equal, half of the hosts should have one HSRP group address as its default gateway, and the other half of the hosts should use the other HSRP group address. If you now revisit Example 5-2, you will see that it is an MHSRP configu-ration. + +HSRP is Cisco proprietary, has been out a long time, and is widely popular. VRRP (RFC 3768) provides a standardized protocol to perform almost the exact same function. The Cisco VRRP implementation has the same goals in mind as HSRP but with these differ- +ences: + + + +■ Key +Topic +■ + + +■ + + +■ + +■ + +VRRP uses a multicast virtual MAC address (0000.5E00.01xx, where xx is the hex VRRP group number). + +VRRP uses the IOS object tracking feature, rather than its own internal tracking mechanism, to track interface states for failover purposes. + +VRRP defaults to use preemption, but HSRP defaults to not use preemption. Both can be configured to either use preemption or not. + +The VRRP term Master means the same thing as the HSRP term Active. + +In VRRP, the VRRP group IP address is the interface IP address of one of the VRRP +routers. + + +GLBP is a newer Cisco-proprietary tool that adds load-balancing features in addition to gateway-redundancy features. Hosts still point to a default gateway IP address, but +GLBP causes different hosts to send their traffic to one of up to four routers in a GLBP group. To do so, the GLBP Active Virtual Gateway (AVG) assigns each router in the group a unique virtual MAC address, following the format 0007.B400.xxyy, where xx is the GLBP group number and yy is a different number for each router (01, 02, 03, or +04). When a client ARPs for the (virtual) IP address of its default gateway, the GLBP AVG replies with one of the four possible virtual MACs. By replying to ARP requests with dif-ferent virtual MACs, the hosts in that subnet will in effect balance the traffic across the routers, rather than send all traffic to the one active router. + +Cisco IOS devices with GLBP support permit configuring up to 1024 GLBP groups per physical interface and up to four hosts per GLBP group. +240 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Network Time Protocol + +NTP Version 3 (RFC 1305) allows IP hosts to synchronize their time-of-day clocks with a common source clock. For example, routers and switches can synchronize their clocks to make event correlation from an SNMP management station more meaningful, by ensuring that any events and traps have accurate time stamps. + +By design, most routers and switches use NTP client mode, adjusting their clocks based on the time as known by an NTP server. NTP defines the messages that flow between cli-ent and server, and the algorithms a client uses to adjust its clock. Routers and switches can also be configured as NTP servers, as well as using NTP symmetric active mode —a mode in which the router or switch mutually synchronizes with another NTP host. + +NTP servers can reference other NTP servers to obtain a more accurate clock source as defined by the stratum level of the ultimate source clock. For example, atomic clocks and Global Positioning System (GPS) satellite transmissions provide a source of stratum 1 (lowest/best possible stratum level). For an enterprise network, the routers and switches can refer to a low-stratum NTP source on the Internet, or purpose-built rack-mounted NTP servers, with built-in GPS capabilities, can be deployed. + +Example 5-3 shows a sample NTP configuration on four routers, all sharing the same 10.1.1.0/24 Ethernet subnet. Router R1 will be configured as an NTP server. R2 acts as an NTP static client by virtue of the static configuration referencing R1’s IP address. R3 acts as an NTP broadcast client by listening for R1’s NTP broadcasts on the Ethernet. Finally, R4 acts in NTP symmetric active mode, configured with the ntp peer command. + +Example 5-3 NTP Configuration Key +Topic !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! First, R1's configuration, the ntp broadcast command under interface fa0/0 +! causes NTP to broadcast NTP updates on that interface. The first three of the +! four global NTP commands configure authentication; these commands are identical +! on all the routers. +R1# show running-config +interface FastEthernet0/0 +ntp broadcast +! +ntp authentication-key 1 md5 1514190900 7 +ntp authenticate +ntp trusted-key 1 +ntp master 7 +! Below, the "127.127.7.1" notation implies that this router is the NTP clock +! source. The clock is synchronized, with stratum level 7, as configured on the +! ntp master 7 command above. +R1# show ntp associations +Chapter 5: IP Services 241 + +address ref clock st when poll reach delay offset disp +*~127.127.7.1 127.127.7.1 6 22 64 377 0.0 0.00 0.0 +* master (synced), # master (unsynced), + selected, - candidate, ~ configured +R1# show ntp status +Clock is synchronized, stratum 7, reference is 127.127.7.1 +nominal freq is 249.5901 Hz, actual freq is 249.5901 Hz, precision is 2**16 +reference time is C54483CC.E26EE853 (13:49:00.884 UTC Tue Nov 16 2004) +clock offset is 0.0000 msec, root delay is 0.00 msec +root dispersion is 0.02 msec, peer dispersion is 0.02 msec +! R2 is configured below as an NTP static client. Note that the ntp clock-period +! command is automatically generated as part of the synchronization process, and +! should not be added to the configuration manually. +R2# show run | begin ntp +ntp authentication-key 1 md5 1514190900 7 +ntp authenticate +ntp trusted-key 1 +ntp clock-period 17208144 +ntp server 10.1.1.1 +end +! Next, R3 has been configured as an NTP broadcast client. The ntp broadcast client +! command on R3 tells it to listen for the broadcasts from R1. This configuration +! relies on the ntp broadcast subcommand on R1's Fa0/0 interface, as shown at the +! beginning of this example. +R3# show run +interface Ethernet0/0 +ntp broadcast client +! R4's configuration is listed, with the ntp peer +! command implying the use of symmetric active mode. +R4# show run | beg ntp +ntp authentication-key 1 md5 0002010300 7 +ntp authenticate +ntp trusted-key 1 +ntp clock-period 17208233 +ntp peer 10.1.1.1 + + +SNMP + +This section of the chapter summarizes some of the core Simple Network Management Protocol (SNMP) concepts and details, particularly with regard to features of differ-ent SNMP versions. SNMP or, more formally, the Internet Standard Management Framework, uses a structure in which the device being managed (the SNMP agent) +has information that the management software (the SNMP manager) wants to dis-play to someone operating the network. Each SNMP agent keeps a database, called +242 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +a Management Information Base (MIB), that holds a large variety of data about the operation of the device on which the agent resides. The manager collects the data by using SNMP. + +SNMP has been defined with four major functional areas to support the core function of allowing managers to manage agents: + +■ Data Definition: The syntax conventions for how to define the data to an agent or manager. These specifications are called the Structure of Management Information (SMI). + +■ MIBs: More than 100 Internet standards define different MIBs, each for a different technology area, with countless vendor-proprietary MIBs as well. The MIB defini-tions conform to the appropriate SMI version. + +■ Protocols: The messages used by agents and managers to exchange management data. + +■ Security and Administration: Definitions for how to secure the exchange of data between agents and managers. + +Interestingly, by separating SNMP into these major functional areas, each part has been improved and expanded independently over the years. However, it is important to know a few of the main features added for each official SNMP version, as well as for a pseudo-version called SNMPv2c, as summarized in Table 5-3. + +Table 5-3 SNMP Version Summaries +Key +Topic SNMP Description Version +1 Uses SMIv1, simple authentication with communities, but used MIB-I originally. + +2 Uses SMIv2, removed requirement for communities, added GetBulk and Inform messages, but began with MIB-II originally. +2c Pseudo-release (RFC 1905) that allowed SNMPv1-style communities with SNMPv2; otherwise, equivalent to SNMPv2. +3 Mostly identical to SNMPv2, but adds significantly better security, although it supports communities for backward compatibility. Uses MIB-II. + + +Table 5-3 hits the highlights of the comparison points between the various SNMP ver-sions. As you might expect, each release builds on the previous one. For example, SNMPv1 defined community strings for use as simple clear-text passwords. SNMPv2 removed the requirement for community strings—however, backward compatibility for SNMP communities was defined through an optional RFC (1901). Even SNMPv3, with much better security, supports communities to allow backward compatibility. +Chapter 5: IP Services 243 + + +Note The use of SNMPv1 communities with SNMPv2, based on RFC 1901, has popu-larly been called SNMP Version 2c, with c referring to “communities,” although it is argu-ably not a legitimate full version of SNMP. + + +The next few sections provide a bit more depth about the SNMP protocol, with addi-tional details about some of the version differences. + +SNMP Protocol Messages + +The SNMPv1 and SNMPv2 protocol messages (RFC 3416) define how a manager and agent, or even two managers, can communicate information. For example, a manager can use three different messages to get MIB variable data from agents, with an SNMP +Response message returned by the agent to the manager supplying the MIB data. SNMP uses UDP exclusively for transport, using the SNMP Response message to both acknowl-edge receipt of other protocol messages and supply SNMP information. + +Table 5-4 summarizes the key information about each of the SNMP protocol messages, including the SNMP version in which the message first appeared. + + +Table 5-4 +Key +Topic Message + + +SNMP Protocol Messages (RFCs 1157 and 1905) + +Initial Response Typically Main Purpose Version Message Sent By + + + +Get 1 + +GetNext 1 + +GetBulk 2 + + + +Response 1 + +Set 1 + + +Trap 1 + + + +Inform 2 + +Response + +Response + +Response + + + +None + +Response + + +None + + + +Response + +Manager + +Manager + +Manager + + + +Agent + +Manager + + +Agent + + + +Manager + +A request for a single variable’s value. + +A request for the next single MIB leaf variable in the MIB tree. +A request for multiple consecutive MIB variables with one request. Useful for getting complex structures, for example, an IP routing table. +Used to respond with the information in Get and Set requests. +Sent by a manager to an agent to tell the agent to set a variable to a particular value. The agent replies with a Response message. +Allows agents to send unsolicited information to an SNMP manager. The manager does not reply with any SNMP message. +A message used between SNMP managers to allow MIB data to be exchanged. +244 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The three variations of the SNMP Get message, and the SNMP Response message, are typically used when someone is actively using an SNMP manager. When a user of the SNMP manager asks for information, the manager sends one of the three types of Get commands to the agent. The agent replies with an SNMP Response message. The differ-ent variations of the Get command are useful, particularly when the manager wants to view large portions of the MIB. An agent’s entire MIB—whose structure can vary from agent to agent—can be discovered with successive GetNext requests, or with GetBulk requests, using a process called a MIB walk. + +The SNMP Set command allows the manager to change something on the agent. For example, the user of the management software can specify that a router interface should be shut down; the management station can then issue a Set command for a MIB variable on the agent. The agent sets the variable, which tells Cisco IOS Software to shut down the interface. + +SNMP Traps are unsolicited messages sent by the agent to the management station. For example, when an interface fails, a router’s SNMP agent could send a Trap to the SNMP manager. The management software could then highlight the failure information on a screen, email first-level support personnel, page support, and so on. Also of note, there is no specific message in response to the receipt of a Trap; technically, of the messages in Table 5-4, only the Trap and Response messages do not expect to receive any kind of acknowledging message. + +Finally, the Inform message allows two SNMP managers to exchange MIB information about agents that they both manage. + +SNMP MIBs + +SNMP Versions 1 and 2 included a standard generic MIB, with initial MIB-I (version 1, RFC 1156) and MIB-II (version 2, RFC 1213). MIB-II was actually created in between the release of SNMPv1 and v2, with SNMPv1 supporting MIB-II as well. After the creation of the MIB-II specification, the IETF SNMP working group changed the strategy for MIB definition. Instead of the SNMP working group creating standard MIBs, other work-ing groups, in many different technology areas, were tasked with creating MIB definitions for their respective technologies. As a result, hundreds of standardized MIBs are defined. Additionally, vendors create their own vendor-proprietary MIBs. + +The Remote Monitoring MIB (RMON, RFC 2819) is a particularly important stan-dardized MIB outside MIB-II. An SNMP agent that supports the RMON MIB can be programmed, through SNMP Set commands, to capture packets, calculate statistics, monitor thresholds for specific MIB variables, report back to the management station when thresholds are reached, and perform other tasks. With RMON, a network can be populated with a number of monitoring probes, with SNMP messaging used to gather the information as needed. +Chapter 5: IP Services 245 + +SNMP Security + +SNMPv3 added solid security to the existing SNMPv2 and SNMPv2c specifications. SNMPv3 adds two main branches of security to SNMPv2: authentication and encryp-tion. SNMPv3 specifies the use of message digest algorithm 5 (MD5) and secure hash algorithm (SHA) to create a message digest for each SNMPv3 protocol message. Doing so enables authentication of endpoints and prevents data modification and masquerade types of attacks. Additionally, SNMPv3 managers and agents can use Digital Encryption Standard (DES) to encrypt the messages, providing better privacy. (SNMPv3 suggests future support of Advanced Encryption Standard [AES] as well, but that is not a part of the original SNMPv3 specifications.) The encryption feature remains separate because of the U.S. government export restrictions on DES technology. + +Example 5-4 shows a typical SNMP configuration with the following goals: + +■ Enable SNMP and send traps to 192.168.1.100. + +■ Send traps for a variety of events to the SNMP manager. + +■ Set optional information to identify the router chassis, contact information, and location. + +■ Set read-write access to the router from the 192.168.1.0/24 subnet (filtered by access list 33). + +Example 5-4 Configuring SNMP + +access-list 33 permit 192.168.1.0 0.0.0.255 +snmp-server community public RW 33 +snmp-server location B1 +snmp-server contact routerhelpdesk@mail.local +snmp-server chassis-id 2511_AccessServer_Canadice +snmp-server enable traps snmp +snmp-server enable traps hsrp +snmp-server enable traps config +snmp-server enable traps entity +snmp-server enable traps bgp +snmp-server enable traps rsvp +snmp-server enable traps frame-relay +snmp-server enable traps rtr +snmp-server host 192.168.1.100 public + + +Syslog + +Event logging is nothing new to most CCIE candidates. Routers and switches, among other devices, maintain event logs that reveal a great deal about the operating conditions of that device, along with valuable time-stamp information to help troubleshoot problems or chains of events that take place. +246 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +By default, Cisco routers and switches do not log events to nonvolatile memory. They can be configured to do so using the logging buffered command, with an additional argu-ment to specify the size of the log buffer. Configuring a router, for example, for SNMP management provides a means of passing critical events from the event log, as they occur, to a network management station in the form of traps. SNMP is, however, fairly involved to configure. Furthermore, if it’s not secured properly, SNMP also opens attack vectors to the device. However, disabling SNMP and watching event logs manually is at best tedious, and this approach simply does not scale. + +Syslog, described in RFC 5424, is a lightweight event-notification protocol that provides a middle ground between manually monitoring event logs and a full-blown SNMP imple-mentation. It provides real-time event notification by sending messages that enter the event log to a Syslog server that you specify. Syslog uses UDP port 514 by default. + +Cisco IOS devices configured for Syslog, by default, send all events that enter the event log to the Syslog server. You can also configure Syslog to send only specific classes of events to the server. + +Syslog is a clear-text protocol that provides event notifications without requiring dif-ficult, time-intensive configuration or opening attack vectors. In fact, it’s quite simple to configure basic Syslog operation: +Step 1. Install a Syslog server on a workstation with a fixed IP address. + +Step 2. Configure the logging process to send events to the Syslog server’s IP address using the logging host command. + +Step 3. Configure any options, such as which severity levels (0–7) you want to send to the Syslog server using the logging trap command. + +Web Cache Communication Protocol + +To ease pressure on congested WAN links in networks with many hosts, Cisco developed WCCP to coordinate the work of edge routers and content engines (also known as cache engines). Content engines collect frequently accessed data, usually HTTP traffic, locally, so that when hosts access the same pages, the content can be delivered from the cache engine rather than crossing the WAN. WCCP differs from web proxy operation in that the hosts accessing the content have no knowledge that the content engine is involved in a given transaction. + +WCCP works by allowing edge routers to communicate with content engines to make each aware of the other’s presence and to permit the router to redirect traffic to the con-tent engine as appropriate. Figure 5-3 shows how WCCP functions between a router and a content engine when a user requests a web object using HTTP. +Chapter 5: IP Services 247 + + +Fred: 10.1.1.101 Mask: /24 +GW = 10.1.1.1 +Key +Topic + +ARP Request Target = 10.1.1.1 + +ARP Reply +Source = R1-E1-MAC + + + + +Interface: E1 MAC: R1-E1-MAC 10.1.1.1/24 + + + + +Web Server: 10.1.2.200/24 GW = 10.1.2.1 + + + + + + + +Barney: 10.1.1.102 Mask: /8 +GW = 10.1.1.1 + + + + +ARP Request Target = 10.1.2.200 + +ARP Reply +Source = R1-E1-MAC + + + + + + +Proxy logic used by R1! + +R1 +Interface: E2 MAC: R1-E2-MAC +10.1.2.1/24 + + +DHCP Server: 10.1.2.202/24 + + +DNS Server: 10.1.2.203/24 + + +Figure 5-3 WCCP Operations Between a Router and a Content Engine + +The figure shows the following steps, with the main decision point on the content engine coming at Step 4: + +Step 1. + + +Step 2. + + +Step 3. + + +Step 4A. + + +Step. 4B + + +Step 5. + + +The client sends an HTTP Get request with a destination address of the web server, as normal. + +The router’s WCCP function notices the HTTP Get request and redirects the packet to the content engine. + +The content engine looks at its disk storage cache to discover whether the requested object is cached. + +If the object is cached, the content engine sends an HTTP response, which includes the object, back to the client. + +If the object is not cached, the content engine sends the original HTTP Get request on to the original server. + +If Step 4B was taken, the server replies to the client, with no knowledge that +the packet was ever redirected to a content engine. + + + + + + + + + + + + + + +Key Topic + +Using WCCP, which uses UDP port 2048, a router and a content engine, or a pool of content engines (known as a cluster), become aware of each other. In a cluster of content engines, the content engines also communicate with each other using WCCP. Up to 32 content engines can communicate with a single router using WCCPv1. If more than one content engine is present, the one with the lowest IP address is elected as the lead engine. + +WCCP also provides a means for content engines within a cluster to become aware of each other. Content engines request information on the cluster members from the WCCP router, which replies with a list. This permits the lead content engine to determine how traffic should be distributed to the cluster. + +In WCCPv1, only one router can redirect traffic to a content engine or a cluster of con-tent engines. In WCCPv2, multiple routers and multiple content engines can be config-ured as a WCCP service group. This expansion permits much better scalability in content +caching. Furthermore, WCCPv1 supports only HTTP traffic (TCP port 80, specifically). +248 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +WCCPv2 supports several other traffic types and has other benefits compared to WCCPv1: + + +■ +Key Topic + + +■ + + + +■ + +■ + + + +■ + + +■ + +■ + +Supports TCP and UDP traffic other than TCP port 80, including FTP caching, FTP proxy handling, web caching for ports other than 80, Real Audio, video, and tele-phony. + +Permits segmenting caching services provided by a caching cluster to a particular protocol or protocols, and uses a priority system for deciding which cluster to use for a particular cached protocol. + +Supports multicast to simplify configuration. + +Supports multiple routers (up to 32 per cluster) for redundancy and load distribution. (All content engines in a cluster must be configured to communicate with all routers in that cluster.) + +Provides for MD5 security in WCCP communication using the global configuration command ip wccp password password . + +Provides load distribution. + +Supports transparent error handling. + + +When you enable WCCP globally on a router, the default version used is WCCPv2. Because the WCCP version is configured globally for a router, the version number affects all interfaces. However, multiple services can run on a router at the same time. Routers and content engines can also simultaneously participate in more than one service group. These WCCP settings are configured on a per-interface basis. + +Configuring WCCP on a router is not difficult because a lot of the configuration in a caching scenario takes place on the content engines; the routers need only minimal con-figuration. Example 5-5 shows a WCCPv2 configuration using MD5 authentication and multicast for WCCP communication. + +Example 5-5 WCCP Configuration Example +Key +Topic ! First we enable WCCP globally on the router, +! specifying a service (web caching), a multicast address for +! the WCCP communication, and an MD5 password: +ip wccp web-cache group-address 239.128.1.100 password cisco +! Next we configure an interface to redirect WCCP web-cache +! traffic outbound to a content engine: +int fa0/0 +ip wccp web-cache redirect out +! Finally, inbound traffic on interface fa0/1 is excluded from redirection: +int fa0/1 +ip wccp redirect exclude in +Chapter 5: IP Services 249 + +Finally, WCCP can make use of access lists to filter traffic only for certain clients (or to exclude WCCP use for certain clients) using the ip wccp web-cache redirect-list access-list global command. WCCP can also use ACLs to determine which types of redirected traffic the router should accept from content engines, using the global command ip wccp web-cache group-list access-list . + +Implementing the Cisco IOS IP Service Level Agreement (IP SLA) Feature + +The Cisco IOS IP SLA feature, formerly known as the Service Assurance Agent (SAA), and prior to that simply the Response Time Reporter (RTR) feature, is designed to pro-vide a means of actively probing a network to gather performance information from it. Whereas most of the tools described in the following sections are designed to monitor and collect information, IP SLA is based on the concept of generating traffic at a speci-fied interval, with specifically configured options, and measuring the results. It is built around a source-responder model, where one device (the source) generates traffic and either waits for a response from another device (the responder) or another device config-ured as a responder captures the sender’s traffic and does something with it. This model provides the ability to analyze actual network performance over time, under very specific conditions, to measure performance, avert outages, evaluate quality of service (QoS) performance, identify problems, verify SLAs, and reduce network outages. The IP SLA feature is extensively documented at www.cisco.com/go/ipsla. + +The IP SLA feature allows measuring the following parameters in network performance: + +■ Delay (one-way and round-trip) + +■ Jitter (directional) + +■ Packet loss (directional) + +■ Packet sequencing + +■ Path (per hop) + +■ Connectivity (through the UDP Echo, ICMP Echo, ICMP Path Echo, and TCP Connect functions) + +■ Server or website download time + +■ Voice-quality metrics (MOS) + +Implementing the IP SLA feature requires these steps: + +Step 1. Configure the SLA operation type, including any required options. + +Step 2. Configure any desired threshold conditions. + +Step 3. Configure the responder(s), if appropriate. +250 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Step 4. Schedule or start the operation and monitor the results for a sufficient period of time to meet your requirements. + +Step 5. Review and interpret the results. You can use the Cisco IOS CLI or an SNMP manager to do this. + +After IP SLA monitors have been configured, they cannot be edited or modified. You must delete an existing IP SLA monitor to reconfigure any of its options. Also, when you delete an IP SLA monitor to reconfigure it, the associated schedule for that IP SLA moni-tor is deleted, too. + +IP SLAs can use MD5 authentication. These are configured using the ip sla key-chain command. + +Example 5-6 shows a basic IP SLA configuration with the UDP Echo function. On the responding router, the only required command is global config ip sla monitor responder. On the originating router, the configuration shown in the example sets the source router to send UDP echo packets every 5 seconds for one day to 200.1.200.9 on port 1330. + +Example 5-6 IP SLA Basic Configuration + +SLAdemo# config term +SLAdemo(config)# ip sla monitor 1 +SLAdemo(config-sla-monitor)# type udpEcho dest-ipaddr 200.1.200.9 dest-port 1330 +SLAdemo(config-sla-monitor)# frequency 5 +SLAdemo(config-sla-monitor)# exit +SLAdemo(config)# ip sla monitor schedule 1 life 86400 start-time now + +A number of show commands come in handy in verifying IP SLA performance. On the source router, the most useful commands are show ip sla monitor statistics and show ip sla monitor configuration. Here’s a sample of the show ip sla monitor statistics com-mand for the sending router in the configuration in Example 5-6: +SLAdemo# show ip sla monitor statistics Round trip time (RTT) Index 1 +Latest RTT: 26 ms +Latest operation start time: 19:42:44.799 EDT Tue Jun 9 2009 Latest operation return code: OK +Number of successes: 228 Number of failures: 0 +Operation time to live: 78863 sec + +Implementing NetFlow + +NetFlow is a software feature set in Cisco IOS that is designed to provide network administrators information about what is happening in the network, so that those respon-sible for the network can make appropriate design and configuration changes and moni-tor for network attacks. NetFlow has been included in Cisco IOS for a long time, and +Chapter 5: IP Services 251 + +has evolved through several versions (currently version 9). Cisco has renamed the feature Cisco Flexible NetFlow. It is more than just a renaming, however. The original NetFlow implementation included a fixed seven tuples that identified a flow. Flexible NetFlow allows a user to configure the number of tuples to more specifically target a particular flow to monitor. + +The components of NetFlow are + +■ Records: A set of predefined and user-defined key fields (such as source IP address, destination IP address, source port, and so on) for network monitoring. + +■ Flow monitors: Applied to an interface, flow monitors include records, a cache, and optionally a flow exporter. The flow monitor cache collects information about flows. + +■ Flow exporters: These export the cached flow information to outside systems (typi-cally a server running a NetFlow collector). + +■ Flow samplers: Designed to reduce the load on NetFlow-enabled devices, flow sam-plers allow specifying the sample size of traffic, NetFlow analyzes to a ratio of 1:2 through 1:32768 packets. That is, the number of packets analyzed is configurable from 1/2 to 1/32768 of the packets flowing across the interface. + +Configuring NetFlow in its most basic form uses predefined flow records, configured for collection by a flow monitor, and at least one flow exporter. Example 5-7 shows a basic NetFlow configuration for collecting information and statistics on IPv4 traffic using the predefined IPv4 record, and for configuring some timer settings to show their structure. An exporter is configured to send the collected information to a server at 192.168.1.110 on UDP port 1333, and with a Differentiated Services Code Point (DSCP) of 8 on the exported packets. The process consists of three steps: configuring the NetFlow monitor, applying it to an interface, and configuring an exporter. + +Example 5-7 Basic NetFlow Monitor and Exporter Configuration + +EastEdge# show run | begin flow +flow exporter ipv4flowexport +destination 192.168.1.110 +dscp 8 +transport udp 1333 +! +flow monitor ipv4flow +description Monitors all IPv4 traffic +record netflow ipv4 original-input +cache timeout inactive 600 +cache timeout active 180 +cache entries 5000 +statistics packet protocol +! +252 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +interface FastEthernet0/0 +ip address 192.168.39.9 255.255.255.0 +ip flow monitor ipv4flow input +! output omitted + +You can verify NetFlow configuration using these commands: + +■ show flow record + +■ show flow monitor + +■ show flow exporter + +■ show flow interface + + +Implementing Router IP Traffic Export + +IP Traffic Export, or Router IP Traffic Export (RITE), exports IP packets to a VLAN or LAN interface for analysis. RITE does this only for traffic received on multiple WAN or LAN interfaces simultaneously as would typically take place only if the device were +being targeted in a denial of service attack. The primary application for RITE is in intru-sion detection system (IDS) implementations, where duplicated traffic can indicate +an attack on the network or device. In case of actual attacks where identical traffic is received simultaneously on multiple ports of a router, it’s useful to have the router send that traffic to an IDS for alerting and analysis—that’s what RITE does. + +When configuring RITE, you enable it and configure it to direct copied packets to the MAC address of the IDS host or protocol analyzer. You can configure forwarding of inbound traffic (the default), outbound traffic, or both, and filtering on the number of packets forwarded. Filtering can be performed with access lists and based on one-in-n packets. + +In Example 5-8, a router is configured with a RITE profile that’s applied to the fa0/0 inter-face and exports traffic to a host with the MAC address 0018.0fad.df30. The router is configured for bidirectional RITE, and to send one in every 20 inbound packets and one in every 100 outbound packets to this MAC address. The egress interface (toward the IDS host) is fa0/1. For simplicity, Example 5-8 shows only one ingress interface. Configuration for other ingress interfaces uses the same steps shown here for the fa0/0 interface. + +Example 5-8 Router IP Traffic Export Example + +Edge# config term +Edge(config)# ip traffic-export profile export-this +Edge(config-rite)# interface fa0/0 +Edge(config-rite)# bidirectional +Edge(config-rite)# mac-address 0018.0fad.df30 +Edge(config-rite)# incoming sample one-in-every 20 +Edge(config-rite)# outgoing sample one-in-every 100 +Chapter 5: IP Services 253 + +Edge(config-rite)# exit +Edge(config)# interface fa0/1 +Edge(config-if)# ip traffic-export apply export-this +Edge(config-if)# end +Edge# +%RITE-5-ACTIVATE: Activated IP traffic export on interface FastEthernet 0/1. + + +Implementing Cisco IOS Embedded Event Manager + +The Embedded Event Manager is a software component of Cisco IOS that is designed to make life easier for administrators by tracking and classifying events that take place on a router and providing notification options for those events. The Cisco motivation for including EEM was to reduce downtime, thus improving availability, by reducing the mean time to recover from various system events that previously required a manual troubleshooting and remediation process. + +In some ways, EEM overlaps with RMON functionality, but EEM is considerably more powerful and flexible. EEM uses event detectors and actions to provide notifications of those events. Event detectors that EEM supports include the following: + +■ Monitoring SNMP objects + +■ Screening Syslog messages for a pattern match (using regular expressions) + +■ Monitoring counters + +■ Timers (absolute time-of-day, countdown, watchdog, and CRON) + +■ Screening CLI input for a regular expression match + +■ Hardware insertion and removal + +■ Routing table changes + +■ IP SLA and NetFlow events + +■ Generic On-Line Diagnostics (GOLD) events + +■ Many others, including redundant switchover events, inbound SNMP messages, and others + +Event actions that EEM provides include the following: + +■ Generating prioritized Syslog messages + +■ Reloading the router + +■ Switching to a secondary processor in a redundant platform + +■ Generating SNMP traps +254 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ Setting or modifying a counter + +■ Executing a Cisco IOS command + +■ Sending a brief email message + +■ Requesting system information when an event occurs + +■ Reading or setting the state of a tracked object + +EEM policies can be written using either the Cisco IOS CLI or using the Tcl command interpreter language. For the purposes of the CCIE Routing and Switching qualification exam, you’re more likely to encounter CLI-related configuration than Tcl, but both are very well documented at www.cisco.com/go/eem. Example 5-9 is a brief example con-figuration that shows the CLI configuration of an EEM event that detects and then sends a notification that a console user has issued the wr command, as well as the associated console output when the command is issued. + +Example 5-9 EEM Configuration Example + +R9(config)# event manager applet CLI-cp-run-st +R9(config-applet)# event cli pattern "wr" sync yes +R9(config-applet)# action 1.0 syslog msg "$_cli_msg Command Executed" +R9(config-applet)# set 2.0 _exit_status 1 +R9(config-applet)# end +R9# wr +Jun 9 19:23:21.989: %HA_EM-6-LOG: CLI-cp-run-st: write Command Executed + +The Cisco IOS EEM has such vast capability that an entire book on the subject is easily conceivable, but considering the scope of the CCIE Routing and Switching qualifying exam, these fundamental concepts should provide you with enough working knowledge to interpret questions you might encounter. + +Implementing Remote Monitoring + +Remote Monitoring, or RMON, is an event-notification extension of the SNMP capabil-ity on a Cisco router or switch. RMON enables you to configure thresholds for alerting based on SNMP objects, so that you can monitor device performance and take appropri-ate action to any deviations from the normal range of performance indications. + +RMON is divided into two classes: alarms and events. An event is a numbered, user-configured threshold for a particular SNMP object. You configure events to track, for example, CPU utilization or errors on a particular interface, or anything else you can do with an SNMP object. You set the rising and falling thresholds for these events, and then tell RMON which RMON alarm to trigger when those rising or falling thresholds are crossed. For example, you might want to have the router watch CPU utilization and trigger an SNMP trap or log an event when the CPU utilization rises faster than, say, 20 percent per minute. Or you might configure it to trigger an alarm when the CPU utiliza- +tion rises to some absolute level, such as 80 percent. Both types of thresholds (relative, or +Chapter 5: IP Services 255 + +“delta,” and absolute) are supported. Then, you can configure a different alarm notifica-tion as the CPU utilization falls, again at some delta or to an absolute level you specify. + +The alarm that corresponds to each event is also configurable in terms of what it does (logs the event or sends a trap). If you configure an RMON alarm to send a trap, you also need to supply the SNMP community string for the SNMP server. + +Event and alarm numbering are locally significant. Alarm numbering provides a pointer to the corresponding event. That is, the configured events each point to specific alarm num-bers, which you must also define. + +Example 5-10 shows the configuration required to identify two pairs of events, and the four corresponding alarm notifications. The events being monitored are the interface error counter on the FastEthernet 0/0 interface (SNMP object ifInErrors.1) and the Serial 0/0 interface (SNMP object ifInErrors.2). In the first case, the RMON event looks for a delta (relative) rise in interface errors in a 60-second period, and a falling threshold of five errors per 60 seconds. In the second case, the numbers are different and the thresh-olds are absolute, but the idea is the same. In each case, the RMON events drive RMON alarms 1, 2, 3, or 4, depending on which threshold is crossed. + +Example 5-10 RMON Configuration Example + +rmon event 1 log trap public description Fa0.0RisingErrors owner config +rmon event 2 log trap public description Fa0.0FallingErrors owner config +rmon event 3 log trap public description Se0.0RisingErrors owner config +rmon event 4 log trap public description Se0.0FallingErrors owner config +rmon alarm 11 ifInErrors.1 60 delta rising-threshold 10 1 falling-threshold 5 2 owner config +rmon alarm 20 ifInErrors.2 60 absolute rising-threshold 20 3 falling-threshold 10 4 owner config + +To monitor RMON activity and to see the configured alarms and events, use the show rmon alarm and show rmon event commands. Here’s an example of the console events that take place when the previously configured events trigger the corresponding alarms: + +Jun 9 12:54:14.787: %RMON-5-FALLINGTRAP: Falling trap is generated because the value of ifInErrors.1 has fallen below the falling-threshold value 5 +Jun 9 12:55:40.732: %RMON-5-FALLINGTRAP: Falling trap is generated because the value of ifInErrors.2 has fallen below the falling-threshold value 10 + + +Implementing and Using FTP on a Router + +You can use the Cisco IOS FTP client to send or receive files from the CLI. Cisco IOS does not support configuration as an FTP server, but you can configure a TFTP server (see the next section of this chapter for details). +256 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +To transfer files using FTP from the CLI, use the ip ftp command with the appropriate options. You can specify the username and password to use for an FTP transfer using the ip ftp username and ip ftp password commands. You can also specify the source inter-face used for FTP transfers using the ip ftp source-interface command. + +To initiate an FTP transfer, use the copy command with the ftp keyword in either the source or destination argument. For example, to send the startup configuration file on a router to an FTP server at 10.10.200.1, where it will be stored as r8-startup-config, the transaction is shown in Example 5-11. + +Example 5-11 Using FTP to Copy a Configuration File + +R8# copy startup-config ftp: +Address or name of remote host []? 10.10.200.1 +Destination filename [r8-confg]? r8-startup-config +Writing r8-startup-config ! +3525 bytes copied in 0.732 secs + +FTP can also be used to send an exception dump to an FTP server in the event of a crash. Example 5-12 shows a router configured to send an exception dump of 65,536 bytes to 172.30.19.63 using the username JoeAdmin and password c1sco. + +Example 5-12 Using FTP to Send an Exception Dump + +ip ftp username JoeAdmin +ip ftp password c1sco +! +exception protocol ftp +exception region-size 65536 +exception dump 172.30.19.63 + +Finally, you can set the router for passive-mode FTP connections by configuring the ip ftp passive command. + +Implementing a TFTP Server on a Router + +TFTP is commonly used for IOS and configuration file transfers on routers and switches. Cisco IOS supports configuring a TFTP server on a router, and the process is straight-forward. It should be noted that TFTP is a tool that allows files to be “pulled” from one device to another. + +To enable TFTP, issue the tftp-server command, which has several arguments. You can specify the memory region where the file resides (typically flash, but other regions are supported), the filename, and an access list for controlling which hosts can access the +Chapter 5: IP Services 257 + +file. Here’s an example that shows the commands to permit TFTP access to flash:c1700-advipservicesk9-mz.124-23.bin to hosts that are identified by access list 11. This example also shows how the alias command-line option can be used to make the file available with a name other than the one that it has natively in flash, specifically supersecretfile.bin: +tftp-server flash:c1700-advipservicesk9-mz.124-23.bin alias supersecretfile.bin 11 + + +Implementing Secure Copy Protocol + +Secure Copy Protocol (SCP) is a service you can enable on a Cisco IOS router or switch to provide file copy services. SCP uses Secure Shell (SSH) (TCP port 22) for its transport protocol. It enables file transfer using the IOS copy command. + +SCP requires authentication, authorization, and accounting (AAA) for user authentication and authorization. Therefore, you must enable AAA before turning on SCP. In particular, because copy is an exec command, you must configure the aaa authorization command with the exec option. After you’ve enabled AAA, use the ip scp server enable command to turn on the SCP server. + +Implementing HTTP and HTTPS Access + +Cisco IOS routers and switches support web access for administration, through both HTTP and HTTPS. Enabling HTTP access requires the ip http server global configura-tion command. HTTP access defaults to TCP port 80. You can change the port used for HTTP by configuring the ip http port command. You can restrict HTTP access to a rout-er using the ip http access-class command, which applies an extended access list to con-nection requests. You can also specify a unique username and password for HTTP access using the ip http client username and ip http client password commands. If you choose, you can also configure HTTP access to use a variety of other access-control methods, including AAA, using ip http authentication [aaa | local | enable | tacacs]. + +You can also configure a Cisco IOS router or switch for Secure Sockets Layer (SSL) access. By default, HTTPS uses TCP port 443, and the port is configurable in much the same way as it is with HTTP access. Enabling HTTPS access requires the ip http secure-server command. When you configure HTTPS access in most IOS Release 12.4 ver-sions, the router or switch automatically disables HTTP access, if it has been configured. However, you should disable it manually if the router does not do it for you. + +HTTPS router access also gives you the option of specifying the cipher suite of your choice. This is the combination of encryption methods that the router will enable for HTTPS access. By default, all methods are enabled, as shown in the sample show command output of Example 5-13. +258 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 5-13 HTTPS Configuration Output on a Router + +R8# sh ip http server secure status +HTTP secure server status: Enabled +HTTP secure server port: 443 +HTTP secure server ciphersuite: 3des-ede-cbc-sha des-cbc-sha rc4-128-md5 rc4-128-sha +HTTP secure server client authentication: Disabled +HTTP secure server trustpoint: +HTTP secure server active session modules: ALL +R8# + + +Implementing Telnet Access + +Telnet is such a ubiquitous method of access on Cisco IOS routers and switches that it needs little coverage here. Still, a few basic points are in order. + +Telnet requires a few configuration specifics to work. On the vty lines, the login com-mand (or a variation of it such as login local) must be configured. If a login command is not configured, the router or switch will refuse all Telnet connection attempts. + +By default, Telnet uses TCP port 23. However, you can configure the vty lines to use rotary groups, also known as rotaries, to open access on other ports. If you configure this option, you should use an extended access list to enforce connection on the desired ports. By default, rotaries support connections on a number of ports. For example, if you configure rotary 33 on the vty lines, the router will accept Telnet connections on ports 3033, 5033, and 7033. Therefore, filtering undesired ports is prudent. Remember that applying access lists to vty lines requires the access-class list in command. + +Implementing SSH Access + +Secure Shell (SSH) is much more secure than Telnet because it uses SSL rather than clear text. Therefore, today, nearly all Cisco router and switch deployments use SSH rather than Telnet for secure access. Enabling SSH on a Cisco router is a four-step process. This is because SSH requires a couple of items to be configured before you can enable SSH itself, and those prerequisites are not intuitive. The steps in configuring SSH are as fol-lows: +Step 1. Configure a host name using the hostname command. + +Step 2. Configure a domain name using the ip domain-name command. + +Step 3. Configure RSA keys using the crypto key generate rsa command. + +Step 4. Configure the terminal lines to permit SSH access using the transport input ssh command. + +SSH supports rotaries on vty lines just as Telnet does, so you can use rotaries to specify the port or ports on which SSH access is permitted on vty lines. +Chapter 5: IP Services 259 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 5-5 lists the protocols mentioned in this chapter and their respective standards documents. + + +Table 5-5 +Key +Topic Name + +ARP + + +Protocols and Standards for Chapter 5 + +Standardized In +RFC 826 + + + +Proxy ARP + +RARP + +BOOTP + +DHCP + +DHCP FQDN option + +HSRP + +VRRP + +GLBP + +CDP + +NTP + +Syslog + +SNMP Version 1 + +SNMP Version 2 + +SNMP Version 2c + +SNMP Version 3 + +Good Starting Point: + +RFC 1027 + +RFC 903 + +RFC 951 + +RFC 2131 + +Internet-Draft + +Cisco proprietary + +RFC 3768 + +Cisco proprietary + +Cisco proprietary + +RFC 1305 + +RFC 5424 + +RFCs 1155, 1156, 1157, 1212, 1213, 1215 + +RFCs 1902–1907, 3416 + +RFC 1901 + +RFCs 2578–2580, 3410–3415 + +RFC 3410 + + + +Table 5-6 lists some of the most popular Cisco IOS commands related to the topics in this chapter. +260 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 5-6 Command Reference for Chapter 5 + + +Command +ip dhcp pool name + +default-router address [address2... address8] + +Description +Creates DHCP pool. + +DHCP pool subcommand to list the gateways. + +dns-server address [address2... address8 ] DHCP pool subcommand to list DNS servers. + + +lease {days [hours][minutes] | infinite} + +network network-number [mask | prefix-length] + +ip dhcp excluded-address [low-address high-address] + +host address [mask | prefix-length] + + +hardware-address hardware-address type + +show ip dhcp binding [ip-address] + +show ip dhcp server statistics + +standby [group-number ] ip [ip-address [secondary ]] + +track object-number interface type-number {line-protocol | ip routing} + +standby [group-number ] preempt [delay {minimum delay | reload delay | sync delay}] + +show track [object-number [brief] | interface [brief] | ip route [brief] | resolution | timers] + +standby [group-number ] priority priority + +standby [group-number ] timers [msec] hellotime [msec] holdtime + +standby [group-number ] track object-number + +DHCP pool subcommand to define the lease length. +DHCP pool subcommand to define IP addresses that can be assigned. + +Global command to disallow these addresses from being assigned. + +DHCP pool subcommand, used with hardware-address or client-identifier, to predefine a single host’s IP address. +DHCP pool subcommand to define MAC address; works with the host command. + +Lists addresses allocated by DHCP. + +Lists stats for DHCP server operations. + +Interface subcommand to enable an HSRP group and define the virtual IP address. + +Configures a tracking object that can be used by HSRP, VRRP, or GLBP to track the status of an interface. +Interface subcommand to enable preemption and set delay timers. + +Displays status of tracked objects. + + +Interface subcommand to set the HSRP group priority for this router. + +Interface subcommand to set HSRP group timers. + +Interface subcommand to enable HSRP to track defined objects, usually for the purpose of switching active routers on an event related to that object. +Chapter 5: IP Services 261 + + + +Command +show standby [type number [group]] [brief | all ] + +ntp peer ip-address [version number ] [key keyid] [source interface ] [prefer] + +ntp server ip-address [version number ] [key keyid] [source interface ] [prefer] + +ntp broadcast [version number] + +ntp broadcast client + +ntp master [stratum ] + +show ntp associations + +show ntp status + +logging trap level + + + + +logging host {{ip-address | hostname } | {ipv6 ipv6-address | hostname}} +[transport {udp [port port-number] | tcp [port port-number ]}] [alarm [severity]] + +ip wccp {web-cache | service-number } [service-list service-access-list] +[mode {open | closed}] [group-address multicast-address] [redirect-list access-list] [group-list access-list] [password +[0-7 ] password ] + +ip wccp {web-cache | service-number } redirect {in | out} + +show ip wccp + +snmp-server enable traps + +Description +Lists HSRP statistics. + +Global command to enable symmetric active mode NTP. + +Global command to enable static client mode NTP. + +Interface subcommand on an NTP server to cause NTP broadcasts on the interface. +Interface subcommand on an NTP client to cause it to listen for NTP broadcasts. +Global command to enable NTP server. + +Lists associations with other NTP servers and clients. +Displays synchronization status, stratum level, and other basic information. +Sets the severity level for syslog messages; arguments are 0–7, where 0=emergencies, 1=alerts, 2=critical, 3=errors, 4=warnings, 5=notifications, 6=informational, 7=debugging (default). +Configures the IP or IPv6 address or host name to which to send syslog messages and permits setting the transport protocol and port number. + +Enables WCCP and configures filtering and service parameters. + + + + +Interface configuration command to enable WCCP and configure it for outbound or inbound service. +Displays WCCP configuration settings and statistics. +Enables sending of all types of traps available on the router or switch. +262 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +snmp-server host {hostname | +ip-address} [vrf vrf-name] [traps | informs] [version {1 | 2c | 3 [auth | noauth | priv]}] community-string [udp-port port] [notification-type] + + +snmp-server community string [view view-name ] [ro | rw ] [access-list-number] + + +show snmp mib ifmib ifindex interface-id + +ip sla monitor operation-index + +type [jitter | udp-echo | echo protocol icmpecho | dns | ftp operation | http operation | mpls ping ipv4 | pathecho | pathjitter | tcpconnect | voip delay post-dial | udp-jitter | udp-jitter codec] + +ip sla key-chain key-chain-name + +ip sla monitor schedule operation-number [life {forever | seconds }] [start-time {hh:mm [:ss] [month day | day month] | pending | now | after hh: mm:ss}] [ageout seconds ] [recurring ] +ip sla monitor responder + +Description +Configures the SNMP server to send traps or informs to a particular host, along with options for setting the SNMP version for traps and the UDP port (default is 162). The notification-type field specifies the types of traps to send; if no types are specified, all available categories of traps will be sent. +Sets the read-only or read-write community string and access list for host filtering for access to SNMP reads and writes on the router or switch. +Shows the router’s interface ID for a particular interface. Particularly useful for RMON configuration. +Enters IP SLA monitor configuration mode for an individual monitor function. +Configures the IP SLA monitor type with options (not shown) including source and destination IP address and source and destination port number, plus other relevant options to the particular type. +Configures a key chain for MD5 authentication of IP SLA operations. +Configures the schedule for a particular IP SLA monitor. If the IP SLA monitor is deleted from the configuration, the schedule is also deleted. + + +Enables the IP SLA responder function globally. More specific options for this command can be configured for specific responder types, ports, and so on. + +show ip sla monitor statistics [operation] Shows the statistics for a specified IP SLA detail operation or all configured IP SLA operations. + + +show ip sla responder + + +ip ssh [timeout seconds | authentication-retries integer] +crypto key generate rsa + +Shows currently configured IP SLA responders and recent activity (source IP address, and so on). +Sets SSH access crypto key. + +Generates RSA keys. Required for SSH configuration. +Chapter 5: IP Services 263 + + + +Command transport input ssh + +ip http server + +ip http secure-server + +ip traffic-export profile profile-name + +ip traffic-export apply profile-name + +Description +In vty configuration mode, permits SSH connections. +Enables HTTP server. + +Enables HTTPS server. + +Enables and enters configuration mode for a RITE profile. +Applies a RITE profile to an interface. + + +event manager applet applet-name [class Enters EEM applet configuration mode. class-options ] [trap] + +event cli pattern regular-expression {[default] [enter] [questionmark] [tab]} [sync {yes | no skip {yes | no}] [mode variable] [occurs num-occurrences] +[period period-value ] [maxrun maxruntime-number ] +ip flow-top-talkers + +flow monitor flow-name + +flow exporter exporter-name + + +rmon event + + +rmon alarm + +Copy + +tftp-server flash [partition-number: ] filename1 [alias filename2 ] [access-list-number ] +aaa new-model + +aaa authentication + +aaa authorization + +ip scp server enable + +Configures EEM to match a CLI command string. + + + + +NetFlow aggregator. Aggregates traffic for unclassified top talkers. +Enters configuration mode for a NetFlow monitor. +Configures a NetFlow exporter and the destination server to which to send NetFlow information for a particular flow monitor. +Configures an RMON event to monitor a particular SNMP object, along with rising and falling thresholds. +Configures an alarm action for an RMON event’s rising or falling threshold. +With FTP option in the source or destination field, copies a file to or from an FTP server. +Configures a TFTP server on the router to serve a file, optionally with an alias, and optionally through an ACL. + +Enables AAA on the router. + +Configures AAA authentication methods. + +Configures AAA authorization methods. + +Enables the SCP server on the router. Requires AAA authentication and AAA authorization to be configured. +264 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +HSRP, VRRP, GLBP, ARP, RARP, proxy ARP, BOOTP, DHCP, NTP symmetric active mode, NTP server mode, NTP client mode, NTP, virtual IP address, VRRP Master router, SNMP agent, SNMP manager, Get, GetNext, GetBulk, MIB-I, MIB-II, Response, Trap, Set, Inform, SMI, MIB, MIB walk, lead content engine +Refer to the glossary to check your answers. + + +Further Reading + +More information about several of the topics in this chapter can be easily found in a large number of books and online documentation. The RFCs listed in Table 5-5 of the “Foundation Summary” section also provide a great deal of background information for this chapter. Here are a few references for more information about some of the less popu-lar topics covered in this chapter: + +■ Proxy ARP: www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note-09186a0080094adb.shtml. + +■ GLBP: www.cisco.com/en/US/docs/ios/12_2t/12_2t15/feature/guide/ft_glbp.html. + +■ VRRP: www.cisco.com/en/US/docs/ios/12_0st/12_0st18/feature/guide/ st_vrrpx.html. + +■ SNMP: Any further reading of SNMP-related RFCs should begin with RFC 3410, which provides a great overview of the releases and points to the more important of the vast number of SNMP-related RFCs. + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Cisco Express Forwarding Concepts + +■ Routing Protocol Migration + +■ Policy-Based Routing +CHAPTER 6 + + + + + + +IP Forwarding (Routing) + + +This chapter begins with coverage of the details of the forwarding plane—the actual for-warding of IP packets. This process of forwarding IP packets is often called IP routing, or simply routing. Also, many people also refer to IP routing as the data plane, meaning the plane (topic) related to the end-user data. + +Chapters 7 through 11 cover the details of the IP control plane. In contrast to the term data plane, the control plane relates to the communication of control information—in short, routing protocols like OSPF and BGP. These chapters cover the routing protocols on the exam, plus an additional chapter on redistribution and route summarization. + +“Do I Know This Already?” Quiz + +Table 6-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 6-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +IP Forwarding + +Multilayer Switching + +Policy Routing + +Total Score + +Questions Covered in This Section Score +1–6 + +7–9 + +10–11 + + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. What command is used to enable CEF globally for IPv4 packets? + +a. enable cef + +b. ip enable cef + +c. ip cef + +d. cef enable + +e. cef enable ip + +f. cef ip +268 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +2. What command is used to enable CEF globally for IPv6 packets? + +a. enable cef6 + +b. ipv6 enable cef + +c. ipv6 cef + +d. ip cef (the command automatically enables CEF for IPv4 and IPv6) + +3. Can CEF for IPv6 be enabled independently of CEF for IPv4? + +a. Yes + +b. No + +4. Which of the following triggers an update to a CEF FIB? + +a. Receipt of an ICMPv6 Neighbor Advertisement message with previously unknown information + +b. Receipt of a LAN ARP reply message with previously unknown information + +c. Addition of a new route to the IP routing table by EIGRP + +d. Addition of a new route to the IP routing table by adding an ip route command + +e. The removal of a route from the IP routing table by EIGRP + +5. Which of the following triggers an update to a CEF adjacency table? + +a. Receipt of a CDP multicast on the PVC connected to Router1 + +b. Receipt of an ARP response with previously unknown information + +c. Receipt of a packet that needs to be routed to another router over a point-to-point interface + +d. Receipt of an ICMPv6 Neighbor Advertisement with previously unknown infor-mation + +6. Which of the following packet-switching paths is considered to be the slowest? + +a. Process Switching + +b. Fast Switching + +c. Route Cache + +d. Cisco Express Forwarding + +7. Which of the following commands is used on a Cisco IOS Layer 3 switch to use the interface as a routed interface instead of a switched interface? + +a. ip routing or ipv6 unicast-routing global command + +b. ip routing or ipv6 unicast -routing interface subcommand + +c. ip address interface subcommand + +d. switchport mode routed interface subcommand + +e. no switchport interface subcommand +Chapter 6: IP Forwarding (Routing) 269 + +8. On a Cisco Catalyst 3560 switch, the first line of the output of a show interface vlan 55 command lists the state as “Vlan 55 is down, line protocol is down.” Which of the following might be causing that state to occur? +a. VLAN interface has not been no shut yet. + +b. The ip routing global command is missing from the configuration. + +c. On at least one interface in the VLAN, a cable that was previously plugged in has been unplugged. + +d. VTP mode is set to transparent. + +e. The VLAN has not yet been created on this switch, or is not in the active state. + +9. On a Cisco Catalyst 3560 switch, the first line of the output of a show interface vlan 55 command lists the state as “Vlan 55 is up, line protocol is down.” Which of the following might be causing that state to occur? +a. VLAN interface has not been no shut yet. + +b. The ip routing global command is missing from the configuration. + +c. There is no switch port on the switch with this VLAN allowed and in the STP forwarding state. + +d. STP has been administratively deactivated for this VLAN. + +e. The VLAN has not yet been created on this switch, or is not in the active state. + +10. Imagine a route map used for policy routing, in which the route map has a set default interface serial0/0 command. Serial0/0 is a point-to-point link to another router. A packet arrives at this router, and the packet matches the policy routing route-map clause whose only set command is the one just mentioned. Which of the following general characterizations is true? +a. The packet will be routed out interface s0/0; if s0/0 is down, it will be routed using the default route from the routing table. + +b. The packet will be routed using the default route in the routing table; if there is no default, the packet will be routed out s0/0. + +c. The packet will be routed using the best match of the destination address with the routing table; if no match is found, the packet will be routed out s0/0. + +d. The packet will be routed out interface s0/0; if s0/0 is down, the packet will be discarded. +270 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +11. Router1 has an fa0/0 interface and two point-to-point WAN links back to the core of the network (s0/0 and s0/1, respectively). Router1 accepts routing information only over s0/0, which Router1 uses as its primary link. When s0/0 fails, Router1 uses policy routing to forward the traffic out the relatively slower s0/1 link. Which of the following set commands in Router1’s policy routing route map could have been used to achieve this function? +a. set ip default next-hop + +b. set ip next-hop + +c. set default interface + +d. set interface +Chapter 6: IP Forwarding (Routing) 271 + + +Foundation Topics + + +IP Forwarding + +IP forwarding, or IP routing, is the process of receiving an IP packet, making a deci-sion of where to send the packet next, and then forwarding the packet. The forwarding process needs to be relatively simple, or at least streamlined, for a router to forward large volumes of packets. Ignoring the details of several Cisco optimizations to the forwarding process for a moment, the internal forwarding logic in a router works basically as shown in Figure 6-1. + + + +Key Client 3 Topic + +172.31.0.0, /24 Prefixes + + +103.3 S0/0.3333 13.1 + + + +Telnet Server – 172.31.11.201 + + + + + +Solid lines show packet flow + +5 Is the TTL > 1? + + +GW is E0/0 103.3 + +6 Compare packet destination with +routing table + +R3 R1 + +IP Routing Table 172.31.103.0/24 Connected E0/0 172.31.13.0/24 Connected S0/0.3333 172.31.11.0/24 172.31.13.1 S0/0.3333 +7 + + + +Is the router itself +the packet’s destination? +4 +3 Verify header checksum IP Packet + + +8 Update TTL and +Header Checksum + + +Adjacency Information +IP Packet 172.31.13.1 DLCI 100 + + + +Type = 0x0800 + +2 + +Header IP Packet Trailer +Eth. +Eth. + + +9 Insert into Header + +Header IP Packet Trailer +FR +FR + + +1 Passed FCS + +Header IP Packet Trailer +Eth. +Eth. + +Figure 6-1 Forwarding Process at Router3, Destination Telnet Server + +The following list summarizes the key steps shown in Figure 6-1: + + +1. Key +Topic + +2. + + +3. + + +A router receives the frame and checks the received frame check sequence (FCS); if errors occurred, the frame is discarded. The router makes no attempt to recover the lost packet. + +If no errors occurred, the router checks the Ethernet Type field for the packet type and extracts the packet. The Data Link header and trailer can now be discarded. + +Assuming an IPv4 packet, its header checksum is first verified. In case of mismatch, the packet is discarded. With IPv6 packets, this check is skipped, as IPv6 headers do +not contain a checksum. +272 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +4. If the header checksum passed, the router checks whether the destination IP address is one of the addresses configured on the router itself. If it does, the packet has just arrived at its destination. The router analyzes the Protocol field in the IP header, identifying the upper-layer protocol, and hands the packet’s payload over to the appropriate upper-protocol driver. +5. If the destination IP address does not match any of the router’s configured address-es, the packet must be routed. The router first verifies whether the TTL of the packet is greater than 1. If not, the packet is dropped and an ICMP Time Exceeded message is sent to the packet’s sender. +6. The router checks its IP routing table for the most specific prefix match of the pack-et’s destination IP address. + +7. The matched routing table entry includes the outgoing interface and next-hop router. This information is used by the router to look up the next-hop router’s Layer 2 address in the appropriate mapping table, such as ARP, IP/DLCI, IP/VPI-VCI, dialer maps, and so on. This lookup is needed to build a new Data Link frame and option-ally dial the proper number. +8. Before creating a new frame, the router updates the IP header TTL or Hop Count field, requiring a recomputation of the IPv4 header checksum. + +9. The router encapsulates the IP packet in a new Data Link header (including the desti-nation address) and trailer (including a new FCS) to create a new frame. + +The preceding list is a generic view of the process. Next, a few words on how Cisco rout-ers can optimize the routing process by using Cisco Express Forwarding (CEF). + +Process Switching, Fast Switching, and Cisco Express Forwarding + +Steps 6 and 7 from the generic routing logic shown in the preceding section are the most computation-intensive tasks in the routing process. A router must find the best route to use for every packet, requiring some form of table lookup of routing information. Also, a new Data Link header and trailer must be created, and the information to put in the header (like the destination Data Link address) must be found in another table. + +Cisco has created several different methods to optimize the forwarding processing inside routers, termed switching paths. This section examines the two most likely methods to exist in Cisco router networks today: fast switching and CEF. + +With fast switching, the first packet to a specific destination IP address is process switched, meaning that it follows the same general algorithm as shown in Figure 6-1. With the first packet, the router adds the results of this daunting lookup to the fast-switching cache, sometimes called the route cache, organized for fast lookups. The cache contains the destination IP address, the next-hop information, and the data-link header information that needs to be added to the packet before forwarding (as in Step 6 in Figure 6-1). Future packets to the same destination address match the cache entry, so it takes the router less time to process and forward the packet, as all results are already stored in the cache. This approach is also sometimes termed route once, forward many times. +Chapter 6: IP Forwarding (Routing) 273 + + + + + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + + +Key Topic + +Although it is much better than process switching, fast switching has significant draw-backs. The first packet must be process switched, because an entry can be added to the cache only when a packet is routed and the results of its routing (next hop, egress inter-face, Layer 2 rewrite information) are computed. A huge inflow of packets to destinations that are not yet recorded in the route cache can have a detrimental effect on the CPU +and the router’s performance, as they all need to be process switched. The cache entries are timed out relatively quickly, because otherwise the cache could get overly large as it has an entry per each destination address, not per destination subnet/prefix. If the rout-ing table or Layer 3–to–Layer 2 tables change, parts of the route cache must be invali-dated rather than updated, causing packets for affected destinations to become process switched again. Also, load balancing can only occur per destination with fast switching. Overall, fast switching was a great improvement at the time it was invented, but since that time, better switching mechanisms have been developed. One of them, Cisco Express Forwarding (CEF), has become the major packet-forwarding mechanism in all current Cisco IP routing implementations, with fast switching becoming practically unused. The support for unicast fast switching has therefore been discontinued and removed from IOS Releases 12.2(25)S and 12.4(20)T onward. + +To learn the basic idea behind CEF as an efficient mechanism to perform routing deci-sions, it is important to understand that the crucial part of routing a packet through a router is finding out how to construct the Layer 2 frame header to allow the packet to be properly encapsulated toward its next hop, and forward the packet out the correct interface. Often, this operation is called a Layer 2 frame rewrite because that is what it resembles: A packet arrives at a router, and the router rewrites the Layer 2 frame, encap- +sulating the packet appropriately, and sends the packet toward the next hop. The packet’s header does not change significantly—in IPv4, only the TTL and checksum are modi-fied; with IPv6, only the Hop Count is decremented. An efficient routing mechanism should therefore focus on speeding up the construction of Layer 2 rewrite information and egress interface lookup. The process switching is highly inefficient in this aspect: The routing table lookup is relatively slow and might need recursive iterations until the direct-ly attached next hop and egress interface are identified. The next-hop information must then be translated in ARP or other Layer 3–to–Layer 2 mapping tables to the appropriate Layer 2 address and the frame header must be constructed, and only then the packet can be encapsulated and forwarded. With each subsequent packet, this process repeats from the beginning. + +One important observation is that while the routing table can hold tens of thousands of destination networks (prefixes), a router typically has only a handful of neighbors—the next hops toward all the known destinations. All destinations reachable through a par-ticular next hop are using the same Layer 2 rewrite information. To reach any of the networks behind a particular adjacent next hop, the packets will be encapsulated into frames having the same Layer 2 header addresses and sent out the same egress interface. It makes sense, then, to trade memory for speed: Preconstruct the Layer 2 frame headers and egress interface information for each neighbor, and keep them ready in an adjacency table stored in the router’s memory. This adjacency table can be constructed immediately as the routing table is populated, using IP addresses of next hops in the routing table +and utilizing ARP or other Layer 3–to–Layer 2 mapping tables to translate next-hop +274 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +IP addresses into their corresponding Layer 2 addresses. A packet that is to be routed through a particular next hop will then simply use the preconstructed Layer 2 frame header for that next hop, without needing to visit the ARP or similar tables over and over again. The process of routing a packet will then transform itself to the process of decid-ing which entry from the adjacency table should be used to encapsulate and forward the packet. After the proper entry is selected, encapsulating the packet and forwarding it out the egress interface can be done in an extremely rapid way, as all necessary data is readily available. + +Another important observation is that the routing table itself is not truly optimized for rapid lookups. It contains lots of information crucial to its construction but not that important for routing lookups, such as origin and administrative distances of routes, their metrics, age, and so on. Entries in the routing table can require recursive lookups: After matching a destination network entry, the next-hop information might contain only the IP address of the next hop but not the egress interface, so the next hop’s IP address has to be looked up in the routing table in the next iteration—and the depth of this recursion is theoretically unlimited. Even after matching the ultimate entry in the routing table that finally identifies the egress interface, it does not really say anything about the Layer 2 rewrite that is necessary to forward the packet. The last found next-hop IP address dur-ing this lookup process has to be further matched in the ARP or similar mapping tables for the egress interface to find out how to construct the Layer 2 frame header. All these shortcomings can be improved, though: The destination prefixes alone from the routing table can be stored in a separate data structure called the Forwarding Information Base, or FIB, optimized for rapid lookups (usually, tree-based data structures meet this require-ment). Instead of carrying the plain next hop’s IP address from the routing table over into the FIB, each entry in the FIB that represents a destination prefix can instead contain +a pointer toward the particular entry in the adjacency table that stores the appropriate rewrite information: Layer 2 frame header and egress interface indication. Any necessary recursion in the routing table is resolved while creating the FIB entries and setting up the pointers toward appropriate adjacency table entries. No other information needs to be carried over from the routing table into the FIB. In effect, the FIB stores only destination prefixes alone. The forwarding information itself is stored as Layer 2 rewrite information in the adjacency table, and entries in the FIB point toward appropriate entries in the adja-cency table. All FIB entries that describe networks reachable through a particular next hop point to the same adjacency table entry that contains prepared Layer 2 header and egress information toward that next hop. + +After the FIB and adjacency table are created, the routing table is not used anymore to route packets for which all forwarding information is found in the FIB/adjacency table. With FIB-based routers, the routing table can be used for packets that require more com-plex processing not available through straightforward Layer 2 rewrite; however, for plain packet routing, only the FIB and the adjacency table are used. The routing table therefore becomes more of a source of routing data to build the FIB and adjacency table contents +but is not necessarily used to route packets anymore. Therefore, such a routing table is +Chapter 6: IP Forwarding (Routing) 275 + +called the Routing Information Base (RIB)—it is the master copy of routing information from which the FIB and other structures are populated, but it is not necessarily used to route packets itself. Note that many routing protocols including Open Shortest Path First (OSPF) and Border Gateway Protocol (BGP) construct their own internal routing tables that are also called RIBs. These per-protocol RIBs are usually separate from the router’s routing table and shall not be confused with the RIB discussed in this chapter. + +Advantages of this approach should be immediately obvious. The FIB contains only the essential information to match a packet’s destination address to a known prefix. A single lookup in the FIB immediately produces a pointer toward complete Layer 2 rewrite infor-mation for the packet to be forwarded. If the next hop for a destination changes, only +the pointer in the respective FIB entry needs to be updated to point toward the new adja-cency table entry; the FIB entry itself that represents the destination prefix is unchanged. Both FIB and adjacency tables can be readily constructed from the routing table and the available Layer 3–to–Layer 2 mapping tables, without requiring any packet flows as was the case in fast switching. To those readers familiar with database systems, the FIB can be seen as an index over the adjacency table, with IP prefixes being the lookup keys and the indexed data being the Layer 2 rewrite entries in the adjacency table. + +These ideas are at the core of Cisco Express Forwarding, or CEF. Conceptually, CEF con-sists of two parts—the Forwarding Information Base and the adjacency table. The FIB contains all known destination prefixes from the routing table, plus additional specific entries, organized as a so-called mtrie or a multiway prefix tree. The adjacency table contains a Layer 2 frame header prepared for each known next hop or directly attached destination. + +The CEF as just described can be implemented in a relatively straightforward way in software, and this is exactly what all software-based Cisco routers do: They implement CEF purely in software, as part of the operating system they run. Both FIB and adjacency tables are maintained in router’s memory, and lookups in these structures are done by the CPU as part of interrupt handler executed when a packet is received. Figure 6-2, reused from the Cisco document “How to Choose the Best Router Switching Path for Your Network,” Document ID 13706 available on the Cisco website, illustrates the concept. + +Multilayer switches and high-end Cisco router platforms go even further, and instead of software-based FIB, they use specialized circuits (specifically, Ternary Content Addressable Memory [TCAM]) to store the FIB contents and perform even faster look- +ups. Using a TCAM, an address lookup is performed in an extremely short time that does not depend on the number of FIB entries, as the TCAM performs the matching on its entire contents in parallel. On these platforms, the CEF structures are distributed to indi-vidual linecards if present, and stored in TCAMs and forwarding ASICs. +276 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +root +CEF Table + +0 2 4 6 8 252 254 +1 3 5 7 9 ... 253 255 +10 + + +0 2 4 252 254 +1 3 ... 253 255 + + + +0 2 4 252 254 +1 3 ... 253 255 + +Forwarding Information Base (FIB Tree) + + + + + +0 2 4 252 254 + +1 3 ... 253 255 + + + + + + + +Forwarding Information Forwarding Information Forwarding Information +Forwarding Information + + + +Adjacency Table + + + +Adjacency Table + +Figure 6-2 Cisco Express Forwarding Basic Architecture + +To illustrate the CEF in action, consider the network in Figure 6-3 and related Example 6-1. + +In this network, Router R1 is connected to two other routers and one multilayer switch. The Data Link Layer technologies interconnecting the devices are diverse: Between +R1 and R2, HDLC is used; R1 and R3 are connected over a PPP link; R1 and MLS4 are using Ethernet interconnection in two VLANs—native VLAN and VLAN 2. OSPF is the routing protocol in use. R2 advertises networks 10.2.0.0/24 through 10.2.3.0/24 and FD00:2::/64 through FD00:2:3::/64. In a similar fashion, R3 advertises networks +10.3.4.0/24 through 10.3.7.0/24 and FD00:3:4::/64 through FD00:3:7::/64. MLS4 adver-tises networks 10.4.8.0/24 and 10.4.9.0/24, and FD00:4:8::/64 and FD00:4:9::/64, over both VLANs. Multiple interface encapsulations and multiple networks reachable over a single next hop are used in this example to show how potentially numerous destination prefixes map to a single adjacent next hop and how the Layer 2 rewrite information is built depending on the Data Link Layer technology. CEF is activated for both IPv4 and IPv6 using the ip cef and ipv6 cef global configuration commands on R1. +Chapter 6: IP Forwarding (Routing) 277 + + + + +Serial0/0/0: HDLC 192.168.12.0/24 FD00:12::/64 + +10.2.<0–3>.0/24 R2 FD00:2:<0–3>::/64 + + + +Serial0/0/1: PPP 192.168.13.0/24 FD00:13::/64 +R1 R3 + + + +10.3.<4–7>.0/24 FD00:3:<4–7>::/64 + + + +Fa0/0: Native VLAN 192.168.14.0/24 FD00:14::/64 + +Fa0/0.2: VLAN 2 192.168.24.0/24 FD00:24::/64 + + + + +10.4.<8–9>.0/24 FD00:4:<8–9>::/64 + +MLS4 + + +Figure 6-3 Example Network Showcasing CEF Operation + +Example 6-1 CEF FIB and Adjacency Table + +! On R1, show ip route ospf shows a portion of the RIB + +R1# show ip route ospf +10.0.0.0/8 is variably subnetted, 12 subnets, 2 masks +O 10.2.0.0/24 [110/782] via 192.168.12.2, 00:07:06, Serial0/0/0 +O 10.2.1.0/24 [110/782] via 192.168.12.2, 00:07:06, Serial0/0/0 +O 10.2.2.0/24 [110/782] via 192.168.12.2, 00:07:06, Serial0/0/0 +O 10.2.3.0/24 [110/782] via 192.168.12.2, 00:07:06, Serial0/0/0 +O 10.3.4.1/32 [110/782] via 192.168.13.3, 00:07:06, Serial0/0/1 +O 10.3.5.0/24 [110/782] via 192.168.13.3, 00:07:06, Serial0/0/1 +O 10.3.6.0/24 [110/782] via 192.168.13.3, 00:07:06, Serial0/0/1 +O 10.3.7.0/24 [110/782] via 192.168.13.3, 00:07:06, Serial0/0/1 +O 10.4.8.0/24 [110/2] via 192.168.24.4, 00:07:06, FastEthernet0/0.2 +[110/2] via 192.168.14.4, 00:07:06, FastEthernet0/0 +O 10.4.9.0/24 [110/2] via 192.168.24.4, 00:07:06, FastEthernet0/0.2 +[110/2] via 192.168.14.4, 00:07:06, FastEthernet0/0 + +! Another crucial part of information is the ARP table that resolves +! next hop IP addresses of hosts connected via Ethernet to MAC addresses +! Serial interface technologies in this example are point-to-point and +! hence require no Layer 3-to-Layer 2 mapping tables. This information will +! be used in construction of adjacency table entries + +R1# show ip arp + +Protocol +Internet + +Address +192.168.14.4 + +Age (min) +41 + +Hardware Addr Type +0017.9446.b340 ARPA + +Interface +FastEthernet0/0 +278 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Internet +Internet +Internet + +192.168.14.1 +192.168.24.1 +192.168.24.4 + +- 0019.e87f.38e4 ARPA +- 0019.e87f.38e4 ARPA +41 0017.9446.b341 ARPA + +FastEthernet0/0 +FastEthernet0/0.2 +FastEthernet0/0.2 + + +! show ip cef shows the FIB contents. In the following output, only routes +! learned via OSPF are shown for brevity reasons. Note how a set of prefixes +! resolves through a particular adjacency (next hop IP and egress interface). + +R1# show ip cef 10.0.0.0 255.0.0.0 longer-prefixes + +Prefix +10.2.0.0/24 +10.2.1.0/24 +10.2.2.0/24 +10.2.3.0/24 +10.3.4.1/32 +10.3.5.0/24 +10.3.6.0/24 +10.3.7.0/24 +10.4.8.0/24 + +10.4.9.0/24 + +Next Hop +192.168.12.2 +192.168.12.2 +192.168.12.2 +192.168.12.2 +192.168.13.3 +192.168.13.3 +192.168.13.3 +192.168.13.3 +192.168.24.4 +192.168.14.4 +192.168.24.4 +192.168.14.4 + +Interface +Serial0/0/0 +Serial0/0/0 +Serial0/0/0 +Serial0/0/0 +Serial0/0/1 +Serial0/0/1 +Serial0/0/1 +Serial0/0/1 +FastEthernet0/0.2 +FastEthernet0/0 +FastEthernet0/0.2 +FastEthernet0/0 + + +! Similarly, for IPv6, the relevant outputs are: + +R1# show ipv6 route ospf +! Output shortened and reformatted for brevity +O FD00:2::/64 [110/782] via FE80::2, Serial0/0/0 +O FD00:2:1::/64 [110/782] via FE80::2, Serial0/0/0 +O FD00:2:2::/64 [110/782] via FE80::2, Serial0/0/0 +O FD00:2:3::/64 [110/782] via FE80::2, Serial0/0/0 +O FD00:3:4::/64 [110/782] via FE80::3, Serial0/0/1 +O FD00:3:5::/64 [110/782] via FE80::3, Serial0/0/1 +O FD00:3:6::/64 [110/782] via FE80::3, Serial0/0/1 +O FD00:3:7::/64 [110/782] via FE80::3, Serial0/0/1 + +O FD00:4:8::/64 [110/2] + +O FD00:4:9::/64 [110/2] + +via FE80:24::4, FastEthernet0/0.2 +via FE80:14::4, FastEthernet0/0 +via FE80:24::4, FastEthernet0/0.2 +via FE80:14::4, FastEthernet0/0 + + +R1# show ipv6 neighbors +IPv6 Address Age Link-layer Addr State Interface + +FD00:14::4 +FD00:24::4 +FE80::3 +FE80:14::4 + +1 0017.9446.b340 +1 0017.9446.b341 +- - +2 0017.9446.b340 + +STALE Fa0/0 +STALE Fa0/0.2 +REACH Se0/0/1 +STALE Fa0/0 +Chapter 6: IP Forwarding (Routing) 279 + +FE80:24::4 1 0017.9446.b341 STALE Fa0/0.2 + +R1# show ipv6 cef +! Output shortened and reformatted for brevity +FD00:2::/64 nexthop FE80::2 Serial0/0/0 +FD00:2:1::/64 nexthop FE80::2 Serial0/0/0 +FD00:2:2::/64 nexthop FE80::2 Serial0/0/0 +FD00:2:3::/64 nexthop FE80::2 Serial0/0/0 +FD00:3:4::/64 nexthop FE80::3 Serial0/0/1 +FD00:3:5::/64 nexthop FE80::3 Serial0/0/1 +FD00:3:6::/64 nexthop FE80::3 Serial0/0/1 +FD00:3:7::/64 nexthop FE80::3 Serial0/0/1 +FD00:4:8::/64 nexthop FE80:24::4 FastEthernet0/0.2 +nexthop FE80:14::4 FastEthernet0/0 +FD00:4:9::/64 nexthop FE80:24::4 FastEthernet0/0.2 +nexthop FE80:14::4 FastEthernet0/0 + +! The show adjacency shows an abbreviated list of adjacency table entries +! Note that separate entries are created for IPv4 and IPv6 adjacencies, +! as the Protocol or EtherType field value in pre-constructed frame headers +! is different for IPv4 and IPv6 + +R1# show adjacency +Protocol Interface Address + +IPV6 Serial0/0/0 +IP Serial0/0/0 +IPV6 Serial0/0/1 +IP Serial0/0/1 +IPV6 FastEthernet0/0.2 +IP FastEthernet0/0 +IPV6 FastEthernet0/0 +IP FastEthernet0/0.2 +IPV6 Serial0/0/1 +IPV6 FastEthernet0/0.2 +IPV6 FastEthernet0/0 + +point2point(12) +point2point(13) +point2point(10) +point2point(15) +FE80:24::4(12) +192.168.14.4(23) +FE80:14::4(12) +192.168.24.4(23) +point2point(4) +FD00:24::4(5) +FD00:14::4(7) + + +! Now focus on the adjacency table details. There are adjacencies via multiple +! interfaces. Serial0/0/0 is running HDLC. Note in the show adjacency detail +! command output the prepared HDLC header for all IPv6 prefixes (0F0086DD) +! and IP prefixes (0F000800) resolving through this adjacency. + +R1# show adjacency s0/0/0 detail +Protocol Interface Address +IPV6 Serial0/0/0 point2point(12) +0 packets, 0 bytes +0F0086DD +280 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +IPv6 CEF never +Epoch: 2 +IP Serial0/0/0 point2point(13) +0 packets, 0 bytes +0F000800 +CEF expires: 00:02:43 +refresh: 00:00:43 +Epoch: 2 + +! Similar output can be achieved for Serial0/0/1 that runs PPP. In the following +! output, note the prepared PPP headers for IPv6 (FF030057) and IPv4 (FF030021) +! prefixes resolving through these adjacencies. There are two IPv6 adjacencies +! present as IPV6CP specifically installs an adjacency towards the neighbor's link +! local address. + +R1# show adjacency s0/0/1 detail +Protocol Interface Address +IPV6 Serial0/0/1 point2point(10) +0 packets, 0 bytes +FF030057 +IPv6 CEF never +Epoch: 2 +IP Serial0/0/1 point2point(15) +0 packets, 0 bytes +FF030021 +CEF expires: 00:02:30 +refresh: 00:00:30 +Epoch: 2 +IPV6 Serial0/0/1 point2point(4) +0 packets, 0 bytes +FF030057 +IPv6 ND never +IPv6 ND never +Epoch: 2 + +! Adjacencies on Fa0/0 show preconstructed Ethernet headers for the neighbors +! 192.168.14.4, FE80:14::4 and FD00:14::4 - destination MAC, source MAC, EtherType. +! Compare the MAC addresses with contents of ARP and IPv6 ND tables above. + +R1# show adjacency fa0/0 detail +Protocol Interface Address +IP FastEthernet0/0 192.168.14.4(23) +0 packets, 0 bytes +00179446B3400019E87F38E40800 +ARP 02:29:07 +Epoch: 2 +Chapter 6: IP Forwarding (Routing) 281 + +IPV6 FastEthernet0/0 FE80:14::4(12) +0 packets, 0 bytes +00179446B3400019E87F38E486DD +IPv6 ND never +Epoch: 2 +IPV6 FastEthernet0/0 FD00:14::4(7) +0 packets, 0 bytes +00179446B3400019E87F38E486DD +IPv6 ND never +Epoch: 2 + +! Finally, adjacencies on Fa0/0.2 show preconstructed Ethernet headers for +! neighbors 192.168.24.4, FE80:24::4 and FD00:24::4 - destination MAC, source MAC, +! 802.1Q VLAN tag, EtherType. Compare the MAC addresses with contents of ARP and +! IPv6 ND tables. + + +R1# show adjacency fa0/0.2 detail +Protocol Interface Address +IPV6 FastEthernet0/0.2 FE80:24::4(12) +0 packets, 0 bytes +00179446B3410019E87F38E481000002 +86DD +IPv6 ND never +Epoch: 2 +IP FastEthernet0/0.2 192.168.24.4(23) +0 packets, 0 bytes +00179446B3410019E87F38E481000002 +0800 +ARP 02:26:57 +Epoch: 2 +IPV6 FastEthernet0/0.2 FD00:24::4(5) +0 packets, 0 bytes +00179446B3410019E87F38E481000002 +86DD +IPv6 ND never +Epoch: 2 + +Table 6-2 summarizes a few key points about the three main options for router switching paths. +282 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 6-2 Matching Logic and Load-Balancing Options for Each Switching Path Key +Topic Switching Path Structures That Hold the Forwarding Load-Balancing Method Information + +Process switching + +Fast switching + +CEF + +Routing table + +Fast-switching cache (per flow route cache) +FIB tree and adjacency table + +Per packet + +Per destination IP address + +Per a hash of the packet source and destination, or per packet + + + +The ip cef global configuration command enables CEF for all interfaces on a Cisco router. For IPv6, the ipv6 cef command is used to activate CEF support. Note that it is possible to run IPv4 CEF without IPv6 CEF, but the converse is not true: To run IPv6 CEF, IPv4 CEF must be active. The no ip route-cache cef interface subcommand can then be used to selectively disable CEF on an interface. + +Load Sharing with CEF and Related Issues + +One of major advantages of CEF is its native support for different load-sharing mecha-nisms, allowing the use of multiple paths toward a destination network if present in the FIB. CEF supports two modes of load sharing: per-packet and per-destination. With +per-packet load sharing, packets destined to a destination network are distributed across multiple paths in a packet-by-packet fashion. With the per-destination mode, the CEF actually takes the source and destination IP address and optionally other data to produce a hash value that identifies the particular path to carry the packet. In effect, for a particu-lar source and destination pair, all packets flow through a single path. Other particular source/destination address combinations toward the same destination network can produce a different hash and thus be forwarded over a different path. In fact, the per-destination load-sharing mode in CEF would be better called per-flow load sharing. +The per-destination load-sharing mode is the default (hardware-based CEF implementa-tions might not support the per-packet load sharing mode), and in general, it is preferred because it avoids packet reordering within a single conversation. + +Per-destination load sharing in CEF is technically achieved by placing a so-called load-share table between the FIB and the adjacency table. This loadshare table contains up to 16 pointers to entries in the adjacency table, and the individual loadshare entries are populated so that the counts of loadshare pointers to particular adjacency entries are +proportional to the costs of parallel routes toward the same destination. (That is, if there are two equal-cost paths to the same destination, eight loadshare entries will point to one next-hop adjacency entry while another eight loadshare entries will point to another next-hop adjacency entry. If there are three equal cost paths, only 15 loadshare entries will be populated, with each five loadshare entries pointing to one of the three next-hop adja-cency entries.) When a packet arrives, the router performs a hashing operation over the packet’s source and destination address fields, and uses the hash result value as an index +Chapter 6: IP Forwarding (Routing) 283 + +into the loadshare table to select one of the possible paths toward the destination. This concept is illustrated in Figure 6-4, also taken from the Cisco document “How to Choose the Best Router Switching Path for Your Network,” Document ID 13706. + +root +CEF Table + +0 2 4 6 8 252 254 +1 3 5 7 9 ... 253 255 +10 + + +0 2 4 252 254 +1 3 ... 253 255 + + +0 2 4 252 254 +1 3 ... 253 255 + + + + +0 2 4 252 254 + +1 3 ... 253 255 + + + + + + + + +Hash + +Forwarding Information Forwarding Information Forwarding Information Forwarding Information + + +Loadshare Table Adjacency Table + +Figure 6-4 CEF Load Balancing + +The particular method of per-packet or per-destination load sharing can be activated on egress interfaces of a router using the ip load-share { per-destination | per-packet } +interface-level command. The availability of this command might be limited depending on the hardware capabilities of the device. Often, multilayer switches performing hardware-accelerated switching do not support this command while software-based ISR routers do. + +With the hashing performed over fixed packet and/or segment address fields, a single hash function produces the same result for all packets in a flow. While this is desirable on a single router to always select a single path for a flow, it leads to unpleasant conse-quences in a network where multiple routers down a path to a destination have multiple routes toward it. +284 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Consider the network shown in the Figure 6-5. + + + +Key Topic + + +64 Flows + + + + +R1 + + + +32 Flows 32 Flows R2 + +32 Flows +R3 32 Flows + + + +R4 R5 R6 R7 + + + +10.0.0.0/24 + +Figure 6-5 CEF Polarization + + + +Key Topic + +Router R1 has two neighbors, R2 and R3, toward the destination network 10.0.0.0/24. Let’s assume that it is receiving 64 different flows destined to stations inside the network 10.0.0.0/24. Under ideal conditions, 32 flows will be forwarded from R1 through R2 and 32 other flows will be forwarded through R3. On R2, we now expect that it again bal-ances the 32 received flows across its neighbors, forwarding 16 flows through R4 and another 16 flows through R5. However, if R2 is using the same hashing function as R1, this is no longer the case. All 32 flows received by R2 have produced the same hashing value on R1—that is why R2 is receiving all of them in the first place. Running the same hashing function over these 32 flows will again produce the same value for all of them, and as a result, R2 will no longer load-share them; rather, all 32 flows will be forwarded from R2 through a single path to the destination. Thus, no load sharing will occur farther down the path below R1. Quite the same fate will meet the remaining 32 flows on R3. This phenomenon is called CEF polarization, and will cause the advantage of load sharing to be lost quickly. + +To avoid this, the basic CEF load-sharing mechanism has been enhanced. Each router chooses a random 4B-long number called a Universal ID (details of its selection are not public). This Universal ID is used as a seed in the hashing function used by CEF. Because with high probability, different routers will have unique Universal IDs, they will also produce different hashing results for a particular packet flow. As a result, a set of flows producing a single hashing value on one router might produce a set of different hashing values on another router, enabling the set of flows to be load-balanced again across mul- +tiple paths. +Chapter 6: IP Forwarding (Routing) 285 + +In recent IOSs, there are multiple variations of the CEF load-sharing algorithm: + +■ Original algorithm: As the name suggests, this is the original unseeded implementa-tion prone to CEF polarization. + +■ Universal algorithm: An improved algorithm using the Universal ID to avoid the CEF polarization. + +■ Tunnel algorithm: A further improvement on the Universal algorithm especially suit-able to environments where tunnels are extensively deployed, possibly resulting in a relatively small number of outer source/destination pairs. Avoids the CEF polariza-tion. Might not be available for IPv6 CEF. + +■ L4 port algorithm: Based on the Universal algorithm while also taking the L4 source and/or destination ports into account. Avoids the CEF polarization. + +Except from the Original algorithm, all other algorithms listed here avoid the CEF polar-ization issue by seeding the hash function using the Universal ID. This ID can be speci-fied for these algorithms in the ip cef load-sharing algorithm and ipv6 cef load-sharing algorithm global configuration commands manually if necessary. This command is also used to select the particular load-sharing algorithm as described in the preceding list. To verify the current load-sharing mechanism and Universal ID value, the output of show cef state, show ip cef summary, or show ip cef detail, especially the heading, shall be examined (the output of these commands differs on different platforms). + +The Catalyst 6500 platform (and some others that are directly derived from it, such as selected 7600 Series supervisors and linecards), enjoying a long history of existence dur-ing the time the details of CEF were fleshed out and perfected in software-based IOSs, has its own set of workarounds about the CEF polarization problem. On this platform, instead of the ip cef load-sharing algorithm command, the mls ip cef load-sharing com-mand is used to select the load-sharing algorithm. The individual options are as follows: + +■ Default (default mls ip cef load-sharing): Uses source and destination IP, plus the Universal ID if supported by the hardware. Avoids CEF polarization. + +■ Full (mls ip cef load-sharing full): Uses source IP, destination IP, source L4 port, and destination L4 port. Does not use Universal ID. Prone to CEF polarization. However, to alleviate its impact, this load-balancing algorithm causes the traffic to split equally among multiple paths only if the number of paths is odd. With an even number of parallel paths, the ratio of traffic split will not be uniform. + +■ Simple (mls ip cef load-sharing simple): Uses source and destination IP only. Does not use Universal ID. Prone to CEF polarization. + +■ Full Simple (mls ip cef load-sharing full simple): Uses source IP, destination IP, source L4 port, and destination L4 port. Does not use Universal ID. Prone to CEF polarization. The difference from Full mode is that all parallel paths receive an equal weight, and fewer adjacency entries in hardware are used. This mode avoids unequal traffic split seen with Full mode. +286 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Multilayer Switching + +Multilayer Switching (MLS) refers to the process by which a LAN switch, which oper-ates at least at Layer 2, also uses logic and protocols from layers other than Layer 2 to forward data. The term Layer 3 switching refers specifically to the use of the Layer 3 destination address, compared to the routing table (or equivalent), to make the forward-ing decision. (The latest switch hardware and software from Cisco uses CEF switching to optimize the forwarding of packets at Layer 3.) + +MLS Logic + +Layer 3 switching configuration works similarly to router configuration—IP addresses are assigned to interfaces, and routing protocols are defined. The routing protocol con-figuration works just like a router. However, the interface configuration on MLS switches differs slightly from routers, using VLAN interfaces, routed interfaces, and Port-channel Layer 3 interfaces. + +VLAN interfaces give a Layer 3 switch a Layer 3 interface attached to a VLAN. Cisco often refers to these interfaces as switched virtual interfaces (SVI). To route between VLANs, a switch simply needs a virtual interface attached to each VLAN, and each VLAN interface needs an IP address in the respective subnets used on those VLANs. + + +Note Although it is not a requirement, the devices in a VLAN are typically configured in the same single IP subnet. However, you can use secondary IP addresses on VLAN inter-faces to configure multiple subnets in one VLAN, just like on other router interfaces. + + + + +Key Topic + +The operational state of SVI interfaces deserves a word on its own. For an MLS, an SVI is the Layer 3 interface that interconnects the internal “router” inside the MLS with the particular VLAN, much like an interface on a real router connects it to a particular net-work. An MLS can directly send packets to or through a particular VLAN by forwarding them over the corresponding SVI. These SVIs will be present in an MLS’s routing table as egress interfaces for packets delivered into or through particular VLANs. The operational state of an SVI should therefore reflect the true ability of the MLS to directly forward packets into the corresponding VLAN. The SVI—despite being a virtual interface—must not be in the “up, line protocol up” state if the MLS is not truly capable of forwarding packets into the corresponding VLAN. In other words, the state of SVIs must mimic the behavior of ordinary routers. If an interface is not in the “up, line protocol up” state, the +configured directly connected network on that interface and all routes formerly reachable over it must be removed from the routing table, and can be put back only if the interface becomes fully operational again. + +There are two primary reasons why an MLS might be unable to forward packets into a particular VLAN: Either that VLAN is not created and active on the MLS, or the VLAN exists and is active but there is no physical Layer 2 interface on the switch allowing it to forward frames into that VLAN. Consequently, the state of an SVI can be one of the +following: +Chapter 6: IP Forwarding (Routing) 287 + +■ Administratively down, line protocol down: The SVI interface is shut down. Key +Topic ■ Down, line protocol down: The corresponding VLAN does not exist, or is not in an +active state (the state suspend or shutdown commands were issued in the VLAN’s configuration). + +■ Up, line protocol down: The corresponding VLAN exists, but it is not allowed and in an STP forwarding state on any Layer 2 switch port (access or trunk). + +■ Up, line protocol up: The VLAN is created and the MLS is capable of forwarding frames (and hence packets) into that VLAN. + + + +Key Topic + +To avoid the “up, line protocol down,” at least one of the following conditions must be +true: + + +■ At least one physical trunk that is itself in the “up, line protocol up” state must have this VLAN allowed, not VTP pruned, and in the STP forwarding state. This can be verified, for example, using the show interfaces trunk command (check the bottom-most section labeled with “Vlans in spanning tree forwarding state and not pruned”). + +■ At least one physical switch port that is itself in the “up, line protocol up” state must have this VLAN configured as an access or voice VLAN and in the STP forwarding state. This can be verified, for example, using show vlan and show spanning-tree commands. + +When using VLAN interfaces, the switch must take one noticeable but simple additional step when routing a packet. Like typical routers, MLS makes a routing decision to for-ward a packet. As with routers, the routes in an MLS routing table entry list an outgoing interface (a VLAN interface in this case), as well as a next-hop Layer 3 address. The adja-cency information (for example, the IP ARP table or the CEF adjacency table) lists the VLAN number and the next-hop device’s MAC address to which the packet should be forwarded—again, typical of normal router operation. + +At this point, a true router would know everything it needs to know to forward the pack-et. An MLS switch, however, then also needs to use Layer 2 logic to decide which physi-cal interface to physically forward the packet already encapsulated in a Layer 2 frame. The switch will simply find the next-hop device’s MAC address in the CAM and forward the frame to that address based on the CAM. + +Using Routed Ports and Port-channels with MLS + +In some point-to-point topologies, VLAN interfaces are not required. For example, when an MLS switch connects to a router using a cable from a switch interface to a router’s LAN interface, and the only two devices in that subnet are the router and that one physi-cal interface on the MLS switch, the MLS switch can be configured to treat that one interface as a routed port. (Another typical topology for using router ports is when two MLS switches connect for the purpose of routing between the switches, again creating a case with only two devices in the VLAN/subnet.) +288 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +A routed port on an MLS switch has the following characteristics: + +■ The interface is not placed into any user-defined VLAN (internally in an MLS switch, an internal usage VLAN is created for each individual routed port). + +■ On most Catalyst platforms, a routed port cannot be configured with subinterfaces. + +■ The switch does not keep any Layer 2 switching table information for the interface. + +■ Layer 3 settings, such as the IP address, are configured under the physical interface, just like a router. + +■ The adjacency table lists the outgoing physical interface or Port-channel, which means that Layer 2 switching logic is not required in these cases. + + + +Key Topic + +The internal usage VLAN created on behalf of a routed port deserves a special mention. For a VLAN-aware MLS, all operations are performed within the context of a VLAN +in which the frame or packet is processed. The most natural way for these switches to implement a routed port is in fact to create a hidden, standalone, and dedicated VLAN for each separate routed port, and deactivate the typical Layer 2 control plane protocols on it. These dedicated VLANs are called internal usage VLANs. On Catalyst switches supporting an extended VLAN range, these internal usage VLANs are allocated from the extended range, depending on the setting of the vlan internal allocation policy { ascend-ing | descending } global configuration command. If the ascending option is used, inter-nal usage VLANs are allocated from VLAN ID 1006 upward. Conversely, if the descend-ing option is used, internal usage VLANs are allocated from VLAN ID 4094 downward. On lower-end Catalyst platforms, this command is present in the configuration with the ascending option but cannot be modified. + +The current allocation of internal usage VLANs can be displayed only using the show vlan internal usage command; they do not appear in common show vlan output. As an +example, observe the output in the Example 6-2. + + +Example 6-2 Internal Usage VLANs Created for Routed Ports + +! On this 3560G switch, ports GigabitEthernet0/12 and GigabitEthernet0/13 will +! be configured as routed ports, and the internal usage VLANs will be observed. +! The switch is configured with vlan internal allocation policy ascending + +Switch(config)# do show vlan internal usage + +VLAN Usage +---- -------------------- + +Switch(config)# interface gi0/12 +Switch(config-if)# no switchport +Switch (config-if)# do show vlan internal usage +Chapter 6: IP Forwarding (Routing) 289 + +VLAN Usage +---- -------------------- +1006 GigabitEthernet0/12 + +Switch(config-if)# exit +Switch(config)# interface gi0/13 +Switch(config-if)# no switchport +Switch(config-if)# do show vlan internal usage + +VLAN Usage +---- -------------------- +1006 GigabitEthernet0/12 +1007 GigabitEthernet0/13 + +Internal usage VLANs are internal to the switch, and regardless of the VTP mode, they are not stored in the VLAN database and are not advertised to any other switch in the VTP domain. The assignment of internal usage VLANs to routed ports is therefore only done at runtime and can differ between restarts of a switch, depending on the order that the routed ports are configured and on the unused extended VLAN IDs. + +Because of the relatively discreet nature of internal usage VLANs (they are not visible in ordinary show vlan output), conflicts can ensue if an administrator tries to create an extended VLAN whose ID is—unknowingly to the administrator—already used by an internal usage VLAN, as shown in the Example 6-3. + +Example 6-3 Possible Internal Usage VLAN Conflict While Creating Extended VLANs + +! Building on the previous example, internal usage VLANs 1006 and 1007 exist +! on this switch. An administrator is not aware about their existence, though, +! and tries to create VLAN 1006 for its own use. Notice how the switch refuses +! to add the VLAN only after exiting the VLAN configuration. + +Switch(config)# do show vlan internal usage + +VLAN Usage +---- -------------------- +1006 GigabitEthernet0/12 +1007 GigabitEthernet0/13 + +Switch(config)# vlan 1006 +Switch(config-vlan)# name SomeExtendedVLAN +Switch(config-vlan)# exit +% Failed to create VLANs 1006 +VLAN(s) not available in Port Manager. +%Failed to commit extended VLAN(s) changes. +290 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + +Key Topic + +This problem can become especially unpleasant if VTPv3 is used that is capable of han-dling extended VLAN IDs. If the administrator creates an extended range VLAN on a VTP Primary Server switch, and the particular VLAN ID is already used by an internal usage VLAN on some other switch in the domain, VTP will fail to create this VLAN +on that switch, resulting in connectivity issues. The conflict will be logged only on the switch experiencing the VLAN ID collision and so can elude the administrator’s attention. + +It is therefore generally recommended that if extended VLANs are used, they should be allocated from the end of the extended VLAN range that is opposite to the current inter-nal VLAN allocation policy, to minimize the risk of creating VLAN ID collisions. + +Keeping all these facts in mind, a routed port is practically equivalent to a switch port placed into a dedicated VLAN, with the Layer 2 control plane protocols deactivated on that port. From this viewpoint, a routed port is a syntactical device in the configuration to make the configuration quick and convenient, while the switch continues to handle the port internally as a switch port with a slightly modified operation. + +The following two configuration snippets in Example 6-4 are practically equivalent; just +the routed port is simpler to configure. + + +Example 6-4 Routed Port and Its Internal Treatment by a Multilayer Switch + +! Following the previous example, assume the Gi0/12 is configured as follows: + +Switch(config)# int gi0/12 +Switch(config-if)# no switchport +Switch(config-if)# ip address 192.168.12.1 255.255.255.0 +Switch(config-if)# do show vlan internal usage + +VLAN Usage +---- -------------------- +1006 GigabitEthernet0/12 +! The above configuration is effectively equivalent to the following configuration: + +Switch(config)# vlan 1006 +Switch(config-vlan)# exit +Switch(config)# no spanning-tree vlan 1006 +Switch(config)# no mac address-table learning vlan 1006 +Switch(config)# interface GigabitEthernet0/12 +Switch(config-if)# switchport mode access +Switch(config-if)# switchport access vlan 1006 +Switch(config-if)# switchport nonegotiate +Switch(config-if)# no vtp +Switch(config-if)# exit +Switch(config)# interface Vlan1006 +Switch(config-if)# ip address 192.168.12.1 255.255.255.0 +Chapter 6: IP Forwarding (Routing) 291 + +Ethernet Port-channels can be used as routed interfaces as well. To do so, physical inter-faces must be configured with the no switchport command before adding them to a channel group. The automatically created Port-channel interface inherits the configura-tion of the first physical interface added to the channel group; if that interface is config-ured as a routed interface, the entire Port-channel will be working as a routed port. An existing Layer 2 Port-channel cannot be changed from Layer 2 to Layer 3 operation and vice versa. If such a modification is necessary, it is first required to completely delete the entire Port-channel, unbundle the physical ports, reconfigure them into the desired mode of operation, and then add them into a channel group again, re-creating the Port-channel interface in the process. Also, when using a Port-channel as a routed interface, Port-channel load balancing should be based on Layer 3 addresses because the Layer 2 addresses will mostly be the MAC addresses of the two MLS switches on either end of the Port-channel. Port-channels can also be used as Layer 2 interfaces when doing MLS. In that case, VLAN interfaces would be configured with an IP address, and the Port-channel would simply act as any other Layer 2 interface. + +Table 6-3 lists some of the specifics about each type of Layer 3 interface. + + + +Table 6-3 Key +Topic Interface + + +MLS Layer 3 Interfaces + +Forwarding to Adjacent Configuration Requirements Device + + + +VLAN interface + + +Physical (routed) interface +Port-channel (switched) interface + +Port-channel (routed) interface + +Uses Layer 2 logic and Layer 2 MAC address table +Forwards out physical interface +Not applicable; just used as another Layer 2 forwarding path +Balances across links in Port-channel + +Create VLAN interface; VLAN must also exist + +Use the no switchport command to create a routed interface +No special configuration; useful with VLAN interfaces + +Needs the no switchport command to be used as a routed interface; optionally change load-balancing method + + + + +MLS Configuration + +The upcoming MLS configuration example is designed to show all the configuration options. The network design is shown in Figures 6-6 and 6-7. In Figure 6-6, the physical topology is shown, with routed ports, VLAN trunks, a routed Port-channel, and access links. Figure 6-7 shows the same network, with a Layer 3 view of the subnets used in the network. +292 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Server 1 + + + +FA0/1 MLS VLAN 11 Server 4 FA0/0 R T +R1 SW1 T SW3 VLAN 12 T +R +T + + +FA0/0 R +R2 SW2 T SW4 MLS VLAN 12 + + +VLAN 11 + +Server 3 + + + +T — Trunk (also a switchport) +R — Routed Port Server 2 + +Figure 6-6 Physical Topology: Example Using MLS + +Server 1 + + + + + +MLS V11 172.31.21.0/24 +R1 SW1 V12 + +Server 3 +VLAN 11 172.31.11.0/24 + + +172.31.23.0/24 +V11 + + +172.31.22.0/24 +R2 SW2 V12 MLS + +VLAN 12 172.31.12.0/24 + +Server 4 + + + +Vx — VLAN Interface x + +Server 2 + +Figure 6-7 Layer 3 Topology View: Example Using MLS + +A few design points bear discussion before jumping into the configuration. First, SW1 and SW2 need Layer 2 connectivity to support traffic in VLANs 11 and 12. In this particular example, a trunk is used between SW1 and SW2 as well as between SW1/ SW2 and SW3/SW4. Focusing on the Layer 2 portions of the network, SW1 and SW2, both distribution MLS switches, connect to SW3 and SW4, which are access layer +Chapter 6: IP Forwarding (Routing) 293 + +switches. SW1 and SW2 are responsible for providing full connectivity in VLANs 11 and 12. Having full Layer 2 connectivity between switches in a topology is the traditional approach. In newer deployments, a new approach is favored in which SW1 and SW2 are interconnected through a routed port (Layer 3 link) only, and the connections toward access layer switches are Layer 2 or even Layer 3. This allows for shrinking the size of Layer 2 domain and the resulting scope of STP operation. If only a routed link was left between SW1 and SW2, the Layer 2 topology between SW1/SW2 and SW3/SW4 would be physically loop-free and there would be no ports blocked by STP, requiring little or no reaction of STP if a link is added or removed. + +Additionally, this design uses SW1 and SW2 as Layer 3 switches, so the hosts in VLANs 11 and 12 will use SW1 or SW2 as their default gateway. For better availability, the two switches should use HSRP, VRRP, or GLBP. Regardless of which protocol is used, both SW1 and SW2 need to be in VLANs 11 and 12, with connectivity in those VLANs, to be effective as default gateways. + +In addition to a Layer 2 trunk between SW1 and SW2, to provide effective routing, it makes sense for SW1 and SW2 to have a routed path between each other as well. +Certainly, SW1 needs to be able to route packets to Router R1, and SW2 needs to be able to route packets to Router R2. However, routing between SW1 and SW2 allows for easy convergence if R1 or R2 fails. + +Figure 6-6 shows two alternatives for routed connectivity between SW1 and SW2, and one option for Layer 2 connectivity. For Layer 2 connectivity, a VLAN trunk needs to be used between the two switches. Figure 6-6 shows a pair of trunks between SW1 and +SW2 (labeled with a circled T) as a Layer 2 Port-channel. The Port-channel would support the VLAN 11 and 12 traffic. + +To support routed traffic, the figure shows two alternatives: Simply route over the Layer 2 Port-channel using VLAN interfaces or use a separate routed Port-channel. First, to use the Layer 2 Port-channel, SW1 and SW2 could simply configure VLAN interfaces in VLANs 11 and 12. The alternative configuration uses a second Port-channel that will +be used as a routed Port-channel. However, the routed Port-channel does not function as a Layer 2 path between the switches, so the original Layer 2 Port-channel must still be used for Layer 2 connectivity. Upcoming Example 6-5 shows both configurations. + +Finally, a quick comment about Port-channels is needed. This design uses Port-channels between the switches, but they are not required. Most links between switches today use at least two links in a Port-channel, for the typical reasons—better availability, better convergence, and less STP overhead. This design includes the Port-channel to point out a small difference between the routed interface configuration and the routed Port-channel configuration. + +Example 6-5 shows the configuration for SW1, with some details on SW2. +294 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 6-5 MLS-Related Configuration on Switch1 + +! Below, note that the switch is in VTP transparent mode, and VLANs 11 and 12 are +! configured, as required. Also note the ip routing global command, without which +! the switch will not perform Layer 3 switching of IP packets. + +vlan 11 +! +vlan 12 + +! The ip routing global command is required before the MLS will perform +! Layer 3 forwarding. Similarly, ipv6 unicast-routing is required for +! IPv6 routing to be enabled. On selected Catalyst platforms, the use of +! distributed keyword is required, as the CEF operates in distributed mode +! on these switches - over multiple ASICs or line cards. + +ip routing +ipv6 unicast-routing distributed +! +vtp domain CCIE-domain +vtp mode transparent + +! Next, the configuration shows basic Port-channel creation commands, with the +! no switchport command being required before bundling physical ports into +! a Port-channel. Note the Port-channel interface will be created automatically. + +interface GigabitEthernet0/1 +no switchport +no ip address +channel-group 1 mode desirable +! +interface GigabitEthernet0/2 +no switchport +no ip address +channel-group 1 mode desirable + + +! Next, the Port-channel interface is assigned an IP address. + +interface Port-channel1 +ip address 172.31.23.201 255.255.255.0 + +! Below, similar configuration on the interface connected to Router1. +Chapter 6: IP Forwarding (Routing) 295 + +interface FastEthernet0/1 +no switchport +ip address 172.31.21.201 255.255.255.0 + +! Next, interface Vlan 11 gives Switch1 an IP presence in VLAN11. Devices in VLAN +! 11 can use 172.31.11.201 as their default gateway. However, using HSRP is +! better, so Switch1 has been configured to be HSRP primary in VLAN11, and Switch2 +! to be primary in VLAN12, with tracking so that if Switch1 loses its connection +! to Router1, HSRP will fail over to Switch2. + +interface Vlan11 +ip address 172.31.11.201 255.255.255.0 +standby 11 ip 172.31.11.254 +standby 11 priority 90 +standby 11 preempt +standby 11 track FastEthernet0/1 + +! Below, VLAN12 has similar configuration settings, but with a higher (better) +! HSRP priority than Switch2's VLAN 12 interface. + +interface Vlan12 +ip address 172.31.12.201 255.255.255.0 +standby 12 ip 172.31.12.254 +standby 12 priority 110 +standby 12 preempt +standby 12 track FastEthernet0/1 + + +Note For MLS switches to route using VLAN interfaces, the ip routing global command must be configured. MLS switches will not perform Layer 3 routing without the ip routing command, which is not enabled by default. Similar comments apply to IPv6 routing that needs to be enabled by ipv6 unicast-routing. + + +As stated earlier, the routed Port-channel is not required in this topology. It was included to show an example of the configuration, and to provide a backdrop from which to dis-cuss the differences. However, as configured, SW1 and SW2 are Layer 3 adjacent over the routed Port-channel as well as through their VLAN 11 and 12 interfaces. So, they could exchange interior gateway protocol (IGP) routing updates over three separate subnets. In such a design, the routed Port-channel was probably added so that it would be the normal Layer 3 path between SW1 and SW2. Care should be taken to tune the IGP implementa-tion so that this route is chosen instead of the routes over the VLAN interfaces. +296 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Policy Routing + +All the options for IP forwarding (routing) in this chapter had one thing in common: The destination IP address in the packet header was the only thing in the packet that was used to determine how the packet was forwarded. Policy routing (or Policy-Based Routing [PBR]) allows a router to make routing decisions based on information besides the desti-nation IP address. + +Policy routing’s logic begins, depending on IPv4 or IPv6 in use, with the ip policy or ipv6 policy command on an interface. This command tells the IOS to process incoming packets on that interface with different logic before the normal forwarding logic takes place. (To be specific, policy routing intercepts the packet after Step 4, but before Step 5, in the routing process shown in Figure 6-1.) The IOS compares the received packets using the route-map referenced in the ip policy or ipv6 policy command. Figure 6-8 shows the basic logic. + + + +Policy Routing Enabled? + + +Yes + + +Match 1st Clause? + + +Yes + + +No No + + +Match 2nd Clause? + + +Yes + + +Permit or Deny? + + +Permit Route Based on set Command + + +No Deny + + + + +Match Last Clause? + + +Yes + + +Destination Based Routing (Normal) + + +No + + +Figure 6-8 Basic Policy Routing Logic + +Specifying the matching criteria for policy routing is relatively simple compared to defin-ing the routing instructions using the set command. The route maps used by policy rout-ing must match either based on referring to an ACL (numbered or named IPv4/IPv6 ACL, using the match ip address or match ipv6 address command) or based on packet length (using the match length command). To specify the routing instructions—in other words, where to forward the packet next—use the set command. Table 6-4 lists the set com-mands and provides some insight into their differences. +Chapter 6: IP Forwarding (Routing) 297 + +Table 6-4 Policy Routing Instructions (set Commands) Key +Topic Command Comments + + +set ip next-hop ip-address [.... ip-address] + +set ipv6 next-hop ipv6-address [ ... ipv6-address ] + +set ip default next-hop ip-address[.... ip-address] + +set ipv6 default next-hop ipv6-address [... ipv6-address ] + + + + + +set interface interface-type interface-number [.... interface-type interface-number ] + + +set default interface interface-type interface-number [. . . interface-type interface-number ] + + + + + + + + +set ip df number + +set ip precedence number | name + +set ipv6 precedence number + +set ip tos number | name + +Next-hop addresses must be in a connected subnet; forwards to the first address in the list for which the associated interface is up. Supported for both IPv4 and IPv6. +Same logic as previous command, except policy routing first attempts to route based on the routing table, and only if no match is found in the routing table, the packet will be handled +by PBR. Default route in the routing table is ignored; that is, if the packet’s destination is matched only by the default route, the packet will be handled by PBR. Supported for both IPv4 and IPv6. +Forwards packets using the first interface in the list that is up. Recommended only for point- +to-point interfaces; strongly discouraged for multiaccess interfaces. Supported for both IPv4 and IPv6. +Same logic as previous command, except policy routing first attempts to route based on the routing table, and only if no match is found in the routing table, the packet will be handled +by PBR. Default route in the routing table is ignored, that is, if the packet’s destination is matched only by the default route, the packet will be handled by PBR. Recommended +only for point-to-point interfaces; strongly discouraged for multiaccess interfaces. Supported for both IPv4 and IPv6. +Sets the IP DF bit; can be either 0 or 1. Supported only for IPv4. +Sets IP precedence bits; can be a decimal value in the range 0–7 or a textual name (IPv4 only). Supported for both IPv4 and IPv6. +Sets the ToS bits (delay, throughput, reliability, monetary cost); can be decimal value or ASCII name. Supported for IPv4 only. + + + +The first four set commands in Table 6-4 are the most important ones to consider. Essentially, you set either the next-hop IP address or the outgoing interface. Use the out-going interface option only when it is of point-to-point technology type—for example, do not refer to a LAN interface or multipoint Frame Relay subinterface. This will almost +298 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +certainly cause the policy-based routing to fail or act unexpectedly; details will be dis-cussed later. Most importantly, note the behavior of the default keyword in the set com-mands. Use of the default keyword essentially means that policy routing tries the default (destination-based) routing first, and resorts to using the set command details only when the router finds no matching route in the routing table. Note that a default route is not considered a matching route by the default keyword. If a packet’s destination is matched only by the default route, PBR treats this as if no match occurred, and the packet is eli-gible to be forwarded according to the set commands using the default keyword. + +The remaining set commands set the bits inside the ToS byte of the packet; refer to Chapter 5, “Classification and Marking,” in Volume II for more information about the ToS byte and QoS settings. Note that you can have multiple set commands in the same route-map clause. For example, you might want to define the next-hop IP address and mark the packet’s ToS at the same time. A single route map entry can even contain mul-tiple set statements specifying where the packet shall be forwarded. In such cases, the set statements are evaluated in the following order: + + +Key Topic + +1. set ip next-hop / set ipv6 next-hop + +2. set interface + +3. set ip default next-hop / set ipv6 default next-hop + +4. set default interface + + +The use of set interface and set default interface is strongly recommended only with point-to-point interfaces. Using multiaccess interfaces in these commands will lead to PBR failing in most cases. IPv6 PBR using set [ default ] interface with a multiaccess interface fails outright; differences in very selected cases have been observed under dif-ferent IOS versions. IPv4 PBR under the same circumstances might appear to work but the background processes are unintuitive: The router first performs a normal routing table lookup for the packet’s destination IP address to look for the connected next-hop address, and then tries to translate this next-hop address into the appropriate Layer +2 address on the multiaccess interface specified in the set [ default ] interface com-mand. This can fail for obvious reasons: The routing table might provide no match for the packet’s destination and thus the set [ default ] interface is skipped, or the next hop itself might be connected to a different interface. Even Proxy ARP, if applicable, is not going to help much—Cisco routers perform a validity check on received ARP responses +similar to a unicast reverse path forwarding check. A router verifies using its routing table whether the sender IPv4 address in the ARP response’s body (the address whose MAC address is being asked for) is reachable through the interface the ARP response came in. If this check fails, the router will drop the ARP response, claiming that it arrived over the “wrong cable” in the debug arp output. Once again, the use of set [ default ] interface +is appropriate only with point-to-point interfaces. IOS Releases 15.x display an explicit warning if the command is used with multiaccess interface types. + +The IPv6 PBR with set interface in particular has one more peculiarity: In some IOS ver-sions, the router checks whether there is a matching route (ignoring the default route) for the packet’s destination even if the packet is to be handled by PBR. If there is no match-ing route in the routing table, the set interface command is ignored. It is also noteworthy +Chapter 6: IP Forwarding (Routing) 299 + + + + + + +Key Topic + +to mention that on some platforms, this behavior also depends on the state IPv6 CEF. The particular behavior of the IOS in question should therefore be verified using debug ipv6 policy . + +If PBR is required on a multilayer switch, many lower-end switches, such as Catalyst 3550, 3560, or 3750, require that the TCAM in the switch is repartitioned in a different way, providing TCAM space for PBR entries while taking away space from entries of other types. On these platforms, the size of TCAM regions for individual applications cannot be configured individually; instead, a set of templates is prepared for typical switch deployments. A switch should be configured with an appropriate TCAM parti-tioning template that allocates the most space to the types of entries most required in the particular switch’s mode of deployment. A template that provides space for PBR entries must be active before the PBR can be configured. These templates are called Switch Database Management templates, or SDM templates for short. Current SDM templates can be shown using the show sdm prefer command, also displaying an approximate space for different TCAM entry types. This command can be also used to view the TCAM allocation policy for different templates if the show sdm prefer template-name form is used. To allow for PBR usage on the switch models mentioned previously, either the routing, access, or dual-ipv4-and-ipv6 routing (if supported) SDM template needs to be used. On Catalyst 3650 and 3850 Series, the advanced SDM template is required. To activate a particular template, the sdm prefer template-name global configuration level command is used. After you issue this command, the switch must be reloaded. It is strongly recommended to consult the appropriate switch model documentation for the list of supported SDM templates and the individual features they activate. + +Apart from PBR, changing the SDM template on an MLS might also be required if rout-ing or IPv6 support are to be activated. One of indications that an inappropriate SDM template is currently active is very visible: The IOS CLI appears to lack the commands necessary to configure routing, PBR, or IPv6, even though the IOS should support these +features and the appropriate licenses are in place. + + + +Routing Protocol Changes and Migration + +The proper selection of a routing protocol for a network is always a sensitive (and under-standably difficult) task. Many factors need to be taken into consideration, ranging from the protocol’s scalability and speed of convergence through advanced features, ending with compatibility issues especially in multivendor environments; all of these are related to the network’s design and requirements. As the network evolves, it might become nec-essary to reevaluate the choice of a particular routing protocol, and if it is found to be inappropriate, it might need to be replaced. + +Migrating from one routing protocol to another is always a disruptive change to the net-work. It requires careful planning to minimize the outages, and even then, they are inevi-table, although their duration can be kept very low. Therefore, a routing protocol migra-tion always requires a maintenance window. +300 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Routing protocol migration is usually accomplished with the following steps: + +Step 1. Plan the migration strategy. + +Step 2. Activate the new routing protocol on all routers in the topology, raising its administrative distance (AD) above the ADs of the current IGP. If the new IGP is Routing Information Protocol (RIP) or Enhanced Interior Gateway Routing Protocol (EIGRP), redistribution from the current into the new IGP has to be configured on each router as well. The current IGP is left intact. +Step 3. Verify the new IGP’s adjacencies and optionally the working database contents. + +Step 4. Deactivate the current IGP in a gradual fashion. + +Step 5. Remove the temporary settings from the new IGP. + +We describe each of these steps in closer detail. + + +Planning the Migration Strategy + +The deployment of a new routing protocol should be preplanned for the entire network, including the division of network into separate areas if and when a link-state IGP is to be used. Additionally, protocol features such as prefix summarization/filtration, stub features, and external information redistribution can further isolate areas of the network from one another. This planning should also involve the order in which routers will be migrated over from the current IGP to the new one. Ideally, routers should be migrated so that they form a contiguous, ever-growing part of the network running the new IGP, gradually shrinking the contiguous remainder of the network in which both the current and new IGP are run. If the current IGP is a link-state protocol, it is advisable to perform the migration in a per-area fashion. The backbone routers should be the last ones to migrate. + + +Activating New IGP While Keeping the Current IGP Intact + + + +Key Topic + +According to the planning in the previous step, the new IGP should be activated on the routers in the network, first setting its administrative distance (AD) to a higher value than the current IGP’s AD, and only then adding interfaces and networks to the new IGP and activating selected features. The current IGP is left running and its configuration is unchanged throughout this entire step. If the current IGP uses various ADs for different network types (for example, EIGRP uses 90 and 170 for internal and external routes, respectively), the new IGP’s AD should be reconfigured to be higher than the highest AD used by the existing IGP. As an example, if the current IGP is OSPF and the new IGP should be EIGRP, the ADs of EIGRP should, for the duration of the migration, be recon-figured to, say, 210 and 220 for internal and external EIGRP routes, respectively. This +way, the new IGP can be deployed across the network, creating adjacencies between rout-ers as usual but not influencing the routing tables and routing just yet. If the current IGP configuration includes redistribution from other sources (static routes, directly connected +networks, and so on), the new IGP shall be configured similarly. +Chapter 6: IP Forwarding (Routing) 301 + +If the new IGP is a distance-vector routing protocol (RIP or EIGRP), each router must also be configured with redistribution from the current IGP into the new IGP. Reasons for this are explained later in the chapter. + +Verifying New IGP Adjacencies and Working Database Contents + + + + + + + + + +Key Topic + +After the new IGP has been configured across the entire network, it should have created adjacencies in the usual fashion though the routing tables are not populated by its routes yet. These adjacencies should be verified to make sure that they are complete. After the current IGP is deactivated, these adjacencies are the only routing protocol adjacencies left between migrated routers, and so must be working as expected before the current IGP starts being removed. + +It is often recommended to verify the contents of the working databases in the new IGP to check whether all expected networks are present, even though not placed into rout-ing tables because of higher ADs. This step might be difficult to accomplish, though, because of two reasons. First, the amount and format of the data can be overwhelming to a human, requiring some kind of automated processing. The second reason is relevant only if the new IGP is a distance-vector protocol, that is, either RIP or EIGRP. These protocols advertise a learned route only if it is also installed in the routing table by the same protocol. This additional advertisement logic in distance-vector routing protocols is based on the fact that a router should not advertise a route it is not using itself. Because the AD of the new IGP has been configured to be higher than the current IGP’s AD, routes learned by the new IGP will not be placed into the router’s routing table as long as the current IGP is still running on the router, and hence will not be advertised further. As a result, if the new IGP is RIP or EIGRP, its working databases will contain only partial contents until the migration starts, making the verification before migration impossible. This behavior of distance-vector IGPs will be discussed in closer detail later in the chap-ter. Note that this additional advertisement logic does not apply to link-state IGPs such as OSPF and IS-IS, as the nature of routing information they generate and the flooding mechanism are strongly different from distance-vector IGPs and do not allow for such +additional checks. + + + +Deactivating Current IGP + +The next step in the routing protocol migration involves the actual removal of the cur-rent IGP from a contiguous set of routers, one router at a time, allowing the new routing protocol to populate the routing table instead, and then proceeding to the next router. Alternatively, instead of plainly deleting the current IGP configuration from the router, it can be configured using the passive-interface default command that will effectively shut it down. In recent IOS versions, selected routing protocols even support the protocol shutdown or shutdown command. The obvious advantage of this approach is that the configuration of the current IGP is preserved, should it ever be necessary to activate it again quickly. + +The removal or deactivation of the current IGP should be done in such a way that the network always consists of at most two regions. In one, both routing protocols are run +302 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + +Key Topic + +(the unmigrated part of network), and in the other, only the new protocol is running (the migrated part of the network) and both regions are contiguous. + +During a properly executed migration, the network consists of a contiguous region that runs both IGPs and of a contiguous region that runs the new IGP only. Traffic crossing the network enters either an unmigrated or a migrated router, and is destined to a net-work that is directly connected to a router that is again either migrated or unmigrated yet. These options have an impact on which IGPs carry the information about the destination and thus what source of routing information is used by routers along the way. + +If traffic enters an unmigrated router and is destined to a network connected to an unmigrated router, the destination network is advertised in both IGPs but the new IGP has been configured with a higher AD, so it has no impact on the routing table contents. Consequently, the traffic completely follows the path provided by the current IGP, as if no migration was taking place. + +If traffic enters a migrated router and is destined to a network connected to a migrated router, the destination network is advertised only in the new IGP, as the current IGP has been removed from the destination router. The current IGP does not advertise this net-work anymore and does not compete about this particular network with the new IGP (recall that it would otherwise be resolved in favor of the current IGP thanks to its lower AD). Consequently, all routers, both migrated and unmigrated, know about this destina-tion only through the new IGP, and follow the path provided by the new IGP. + +If traffic enters an unmigrated router and is destined to a network connected to a migrated router, the situation is very similar. As the current IGP has been removed from the destination router, the destination network is advertised only in the new IGP. All rout-ers therefore know about this network through the new IGP only and follow the path provided by the new IGP. + +Finally, if traffic enters a migrated router and is destined to a network connected to an unmigrated router, the situation is slightly more complex. The destination router adver-tises the network through both IGPs. Other unmigrated routers know the destination net-work through both IGPs and prefer the current IGP, while migrated routers, including the ingress router, know the network through the new IGP only. In the migrated path of the network, the traffic will be routed according to the new IGP until it is forwarded to the first unmigrated router. Starting with this router, all other routers on the path toward the destination still prefer the path provided by the current IGP. Therefore, beginning with this router, the traffic will be routed according to the current IGP. + +This analysis shows that during a properly executed migration, the network remains fully connected and destinations should remain fully reachable. Transient outages can occur at the moment when the current IGP is removed from a router, as the routes provided by the current IGP will need to be flushed from the routing table and replaced by routes learned +through the new IGP. +Chapter 6: IP Forwarding (Routing) 303 + +Removing New IGP’s Temporary Settings + +After the network has been completely migrated to the new IGP and the previous IGP has been completely removed from all routers, the new IGP still contains temporary set-tings that were necessary for a seamless migration, especially the modified AD values, leftovers from redistribution of the previous IGP into the new IGP, and so on. These set-tings should be removed as the last step of the migration procedure. In link-state routing protocols, removing the temporary settings should not cause any additional interruptions in network service. However, in EIGRP, modifying the AD values causes the router to drop and reestablish its EIGRP adjacencies with neighboring routers, causing a transient disruption in network connectivity. These changes must therefore be also performed dur-ing a maintenance window. + +Specifics of Distance-Vector Protocols in IGP Migration + +Ideally, migrating to a different routing protocol should not involve any route redistribu-tion between the current and the new IGP, as the redistribution involves additional com-plexity to the migration process. However, if the new IGP is a distance-vector protocol (such as RIP or EIGRP), a temporary redistribution is inevitable. The reason lies in the advertisement logic of these routing protocols: A learned route will be advertised further only if the router has placed that very learned route into the routing table as well. In other words, a learned route is advertised through the same routing protocol only if the router is using that route itself. As the migration process involves temporarily configuring the new IGP’s administrative distance (AD) to be higher than the AD of the current IGP, none of the learned routes through the new IGP are going to be placed into the routing table if the current IGP is still running. If the new IGP happens to be RIP or EIGRP, any route learned through that protocol won’t make it into the router’s routing table and will not be advertised further as a result. To illustrate this concept, consider the network in Figure 6-9 (split horizon rules in EIGRP have been omitted for simplicity). + + +10.12.0.0/24 + +R1 + +10.23.0.0/24 + +R2 + + +10.34.0.0/24 + +R3 R4 + + + + +10.1.0.0/24 10.2.0.0/24 10.3.0.0/24 10.4.0.0/24 + + +EIGRP R1 R2 R3 R4 + +Advertises 10.1.0.0/24 10.12.0.0/23 + +10.12.0.0/24 10.2.0.0/24 10.23.0.0/24 + +10.23.0.0/24 10.3.0.0/24 10.34.0.0/24 + +10.34.0.0/24 10.4.0.0/24 + + + +Learns 10.2.0.0/24 10.23.0.0/24 + +10.1.0.0/24 10.3.0.0/24 10.34.0.0/24 + +10.12.0.0/24 10.2.0.0/24 10.4.0.0/24 + +10.23.0.0/24 10.3.0.0/24 + + +Figure 6-9 Example Network Topology for Routing Protocol Migration +304 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +OSPF is the current routing protocol in this network, and the network is planned to be migrated to EIGRP. All four routers are therefore configured with EIGRP as well, the EIGRP AD is set to 210 for internal and 220 for external routes, and all interfaces are added to EIGRP on all routers. OSPF’s operation is not influenced in any way, and because its AD remains at 110, routes still keep OSPF-learned routes in their routing table. If we focus on R1’s operation and on the 10.1.0.0/24 network in particular, R1 advertises its directly connected networks, including 10.1.0.0/24 to R2 through EIGRP. +R2 will have this route in its EIGRP topology table but will be unable to install it into the routing table because of EIGRP’s modified AD of 210. As a result, R2 will not propagate the EIGRP-learned route 10.1.0.0/24 through EIGRP to R3, so neither R3 nor R4 will learn about this network through EIGRP. This limited propagation of networks in EIGRP will take place on each router in this topology: Each router will advertise its directly con-nected networks in EIGRP to its immediate neighbors, but these neighbors are prevented from advertising them further, as shown in Figure 6-9. Looking into EIGRP topology tables of all routers confirms this, as shown in Example 6-6. + +Example 6-6 Contents of EIGRP Topology Tables in Figure 6-9 Topology + +! On all routers in the topology from Figure 6-9, EIGRP is configured identically: + +router eigrp 1 +network 10.0.0.0 +distance eigrp 210 220 +no auto-summary + +! It is assumed that OSPF is also running on all four routers. + +! show ip eigrp topology on R1: + +R1# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.12.0.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.12.0.0/24, 1 successors, FD is 832000 +via Connected, Serial0/0/0 +P 10.2.0.0/24, 0 successors, FD is Inaccessible +via 10.12.0.2 (857600/281600), Serial0/0/0 +P 10.1.0.0/24, 1 successors, FD is 281600 +via Connected, FastEthernet0/0 +P 10.23.0.0/24, 0 successors, FD is Inaccessible +via 10.12.0.2 (1344000/832000), Serial0/0/0 + +! show ip eigrp topology on R2: + +R2# show ip eigrp topology +Chapter 6: IP Forwarding (Routing) 305 + +IP-EIGRP Topology Table for AS(1)/ID(10.23.0.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.12.0.0/24, 1 successors, FD is 832000 +via Connected, Serial0/0/1 +P 10.2.0.0/24, 1 successors, FD is 281600 +via Connected, FastEthernet0/0 +P 10.3.0.0/24, 0 successors, FD is Inaccessible +via 10.23.0.3 (857600/281600), Serial0/0/0 +P 10.1.0.0/24, 0 successors, FD is Inaccessible +via 10.12.0.1 (857600/281600), Serial0/0/1 +P 10.23.0.0/24, 1 successors, FD is 832000 +via Connected, Serial0/0/0 +P 10.34.0.0/24, 0 successors, FD is Inaccessible +via 10.23.0.3 (1344000/832000), Serial0/0/0 + +! show ip eigrp topology on R3: + +R3# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.34.0.3) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 10.12.0.0/24, 0 successors, FD is Inaccessible +via 10.23.0.2 (1344000/832000), Serial0/0/1 +P 10.2.0.0/24, 0 successors, FD is Inaccessible +via 10.23.0.2 (857600/281600), Serial0/0/1 +P 10.3.0.0/24, 1 successors, FD is 281600 +via Connected, FastEthernet0/0 +P 10.4.0.0/24, 0 successors, FD is Inaccessible +via 10.34.0.4 (857600/281600), Serial0/0/0 +P 10.23.0.0/24, 1 successors, FD is 832000 +via Connected, Serial0/0/1 +P 10.34.0.0/24, 1 successors, FD is 832000 +via Connected, Serial0/0/0 + +! show ip eigrp topology on R4: + +R4# show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.34.0.4) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status +306 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +P 10.3.0.0/24, 0 successors, FD is Inaccessible +via 10.34.0.3 (857600/281600), Serial0/0/1 +P 10.4.0.0/24, 1 successors, FD is 281600 +via Connected, FastEthernet0/0 +P 10.23.0.0/24, 0 successors, FD is Inaccessible +via 10.34.0.3 (1344000/832000), Serial0/0/1 +P 10.34.0.0/24, 1 successors, FD is 832000 +via Connected, Serial0/0/1 + +Note that on each router, only directly connected networks of its immediate neighbors are learned through EIGRP, and all these networks are marked with a “0 successors, FD is Inaccessible” indication in their heading, preventing them from being advertised further. + +After OSPF is removed from R4’s configuration as a step in the migration procedure, the OSPF-learned 10.1.0.0/24 will be removed from R4’s routing table without being replaced by an EIGRP-learned route, as R2 is still running OSPF and does not advertise this route through EIGRP. This will cause connectivity outages: R4 will learn only about directly connected networks from R3 through EIGRP, missing all other networks, and R3—still running OSPF—will be unable to forward EIGRP-learned routes from R4 back to R2. Clearly, full connectivity in this network will be restored only after OSPF is completely removed. + +The solution to this problem is to configure route redistribution from the current IGP into the new IGP on each router in the topology. In the example network, the situation will +be significantly different, then: Because each router knows about all networks through OSPF, redistributing them from OSPF into EIGRP allows each router to advertise them all to each directly connected neighbor. While the neighbor will not be allowed to advertise them further if still running OSPF, its EIGRP topology database will nonetheless be pop-ulated with the full set of networks from its own neighbors. When OSPF is deactivated on a router, EIGRP-learned routes will take over—they will get installed into the routing table, and the router will be able to forward them further. + +If the new IGP is a link-state protocol, this redistribution is unnecessary and shall not be configured. Flooding of topological information in link-state protocols is not constrained by routing table contents. Routers will always flood the routing information in a link-state protocol, regardless of whether routes derived from that information are installed into routing tables or not. + +To analyze how this approach works, assume that the migration of the network in Figure 6-9 continues by gradual deactivation of OSPF, starting on R4 and proceeding router by router toward R1. Table 6-5 summarizes how the individual networks are visible in the routing tables of individual routers. Only the first two octets of each prefix are listed for brevity. Prefixes in the O row are learned by OSPF; prefixes in the D row are learned by EIGRP. Directly connected networks are not listed, as they are not influenced by changes in routing protocols. +Chapter 6: IP Forwarding (Routing) 307 + +Table 6-5 Contents of Routing Tables in Different Migration Stages + + +OSPF Run On +R1 to R4 O + + + + + + +D + +R1 to R3 O + + + + + +D + + + + + + +R1 to R2 O + + +D + + + + + + +R1 only O + +D + +R1 +10.2/24 + +10.23/24 + +10.3/24 + +10.34/24 + +10.4/24 + +None + +10.2/24 + +10.23/24 + +10.3/24 + +10.34/24 + +10.4/24 + + + + + + +10.2/24 + +10.23/24 + +10.3/24 + +10.34/24 + +10.4/24 + + + +None + +10.2/24 + +10.23/24 + +10.3/24 + +10.34/24 + +10.4/24 + +R2 +10.1/24 + +10.3/24 + +10.34/24 + +10.4/24 + + +None + +10.1/24 + +10.3/24 + +10.34/24 + + +10.4/24 + + + + + + +10.1/24 + + +10.3/24 + +10.34/24 + +10.4/24 + + + +None + +10.1/24 + +10.3/24 + +10.34/24 + +10.4/24 + +R3 +10.1/24 + +10.12/24 + +10.2/24 + +10.4/24 + + +None + +10.1/24 + +10.12/24 + +10.2/24 + + +10.4/24 + + + + + + +None + + +10.1/24 (EX) + +10.12/24 + +10.2/24 + +10.4/24 + + +None + +10.1/24 + +10.12/24 + +10.2/24 + +10.4/24 + +R4 +10.1/24 + +10.12/24 + +10.2/24 + +10.23/24 + +10.3/24 + +None + +None + + + + + +10.1/24 (EX) + +10.12/24 (EX) + +10.2/24 (EX) + +10.23/24 + +10.3/24 + +None + + +10.1/24 (EX) + +10.12/24 + +10.2/24 + +10.23/24 + +10.3/24 + +None + +10.1/24 + +10.12/24 + +10.2/24 + +10.23/24 + +10.3/24 +308 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Key observations about this table are as follows: + +■ Prefixes advertised from routers running both the original and new routing protocol are learned by the original routing protocol on all routers still running it. + +■ Prefixes advertised from routers running only the new routing protocol are learned by the new routing protocol across the entire network. + +■ At all times, all routers know about all prefixes. + +■ Traffic entering a router running both routing protocols and destined to a network on a router running both protocols is routed completely according to the original routing protocol without changes. This is because the network is advertised in both protocols and the new routing protocol’s AD has been intentionally raised above the original protocol’s AD. + +■ Traffic entering a router running the new routing protocol and destined to a network on a router running the new protocol is routed completely according to the new rout-ing protocol. This is because the network in question is not injected into the original routing protocol anymore, so the only source of the information is the new protocol. + +■ Traffic entering a router running both routing protocols and destined to a network on a router running the new routing protocol is routed completely according to the new routing protocol. The reason is the same as in the previous item. + +■ Traffic entering a router running the new routing protocol and destined to a net-work on a router running both routing protocols will be routed according to the new routing protocol until it hits the first router that still runs both routing proto-cols. Afterward, it will be routed according to the original routing protocol. This is +because in the migrated part of the network, routers run only the new routing proto-col, while in the remaining part of network running both protocols, the original rout-ing protocol is preferred. + +The last four items are valid if the migration is performed in such a way that the network always consists of at most two contiguous regions. In one, both routing protocols are run (the unmigrated part of network), and in the other, only the new protocol is running (the migrated part of the network). Also, if this rule is maintained throughout the migration process, the boundary between the new and original routing protocol as described in the last item is crossed only once. +Chapter 6: IP Forwarding (Routing) 309 + + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 6-6 lists the protocols mentioned in or pertinent to this chapter and their respective standards documents. + + +Table 6-6 + +Name + + +Protocols and Standards for Chapter 6 + +Standardized In + + + +Address Resolution Protocol (ARP) + +IPv6 Neighbor Discovery + +Differentiated Services Code Point (DSCP) + +RFC 826 + +RFC 4861, RFC 5942 + +RFC 2474 + + + +Table 6-7 lists some of the key IOS commands related to the topics in this chapter. (The command syntax for switch commands was taken from the Catalyst 3560 Multilayer Switch Command Reference, 15.0(2)SE. Router-specific commands were taken from the IOS Release 15 mainline Command Reference.) + +Table 6-7 Command Reference for Chapter 6 + + +Command +show ip arp + +show ipv6 neighbors + +[no] switchport + + +[no] ip route-cache cef + +[no] ip cef + +[no] ipv6 cef + +Description +EXEC command that displays the contents of the IP ARP cache. +EXEC command that displays the contents of the IPv6 neighbor cache. +Switch interface subcommand that toggles an interface between a Layer 2 switched function (switchport) and a routed port (no switchport). +Interface subcommand that enables or disables CEF switching on an interface. +Global configuration command to enable (or disable) CEF on all interfaces. +Global configuration command to enable (or disable) CEF for IPv6 on all interfaces. For IPv6 CEF to be activated, ip cef must also be present. +310 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +[no] ip routing + +[no] ipv6 unicast-routing + +ip policy route-map map-tag + +ipv6 policy route-map map-tag + +Description +Enables IP routing; defaults to no ip routing and no ipv6 unicast-routing on a multilayer switch. + +Router interface subcommand that enables policy routing for the packets entering the interface. + + + +Refer to Table 6-4 for the list of set commands related to policy routing. + + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +policy routing, process switching, CEF, polarization, MLS, ARP, Proxy ARP, routed interface, fast switching, TTL, RIB, FIB, adjacency table, control plane, switched interface, data plane, IP routing, IP forwarding +Refer to the glossary to check your answers. + + +Further Reading + +For a great overview of router switching paths, refer to www.cisco.com/en/US/tech/ tk827/tk831/technologies_white_paper09186a00800a62d9.shtml. + +For a good reference on load balancing with CEF, refer to http://cisco.com/en/US/tech/ tk827/tk831/technologies_tech_note09186a0080094806.shtml. + +Details on implementing and troubleshooting static routing can be found in numerous documents on the Cisco website. Recommended documents include "Specifying a Next Hop IP Address for Static Routes" (Document ID 27082), "Route Selection in Cisco Routers" (Document ID 8651), and "IOS Configuration Guide," in particular, the "IP Routing: Protocol-Independent Configuration Guide" section. + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Introduction to dynamic routing protocols + +■ Routing Information Protocol v.2 + +■ Routing Information Protocol for IPv6 +CHAPTER 7 + + + + + + +RIPv2 and RIPng + + +This chapter covers Routing Information Protocol version 2 (RIPv2) and Routing Information Protocol next generation (RIPng) for IPv6, including most of the features, concepts, and commands. Chapter 11, “IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting,” covers some RIP details, in particular, route redis-tribution between RIP and other routing protocols, and route summarization. + +“Do I Know This Already?” Quiz + +Table 7-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 7-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +RIPv2 Basics + +RIPv2 Convergence and Loop Prevention + +RIPv2 Configuration + +Total Score + +Questions Covered in This Section Score +1–2 + +3–5 + +6–7 + + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. Which of the following items are true of RIP version 2? + +a. Supports VLSM + +b. Sends Hellos to 224.0.0.9 + +c. Allows for route tagging + +d. Defines infinity as 255 hops + +e. Authentication allows the use of 3DES +314 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +2. In an internetwork that solely uses RIPv2, after the network is stable and converged, which of the following is true? + +a. Routers send updates every 30 seconds. + +b. Routers send updates every 90 seconds. + +c. Routers send Hellos every 10 seconds, and send updates only when routes change. + +d. A routing update sent out a router’s Fa0/0 interface includes all RIPv2 routes in the IP routing table. + +e. A RIPv2 update’s routes list the same metric as is shown in that router’s IP rout-ing table. + +3. R1 previously had heard about only one route to 10.1.1.0/24, metric 3, through an update received on its S0/0 interface, so it put that route in its routing table. R1 gets an update from that same neighboring router, but the same route now has metric 16. R1 immediately sends a RIP update out all its interfaces that advertises a metric 16 route for that same subnet. Which of the following are true for this scenario? +a. Split Horizon must have been disabled on R1’s S0/0 interface. + +b. R1’s update is a triggered update. + +c. R1’s metric 16 route advertisement is an example of a route poisoning. + +d. The incoming metric 16 route was the result of a counting-to-infinity problem. + +4. R1 is in a network that uses RIPv2 exclusively, and RIP has learned dozens of sub-nets through several neighbors. Which of the following commands displays the cur-rent value of at least one route’s age? +a. show ip route + +b. show ip rip database + +c. debug ip rip + +d. debug ip rip event +Chapter 7: RIPv2 and RIPng 315 + +5. R1 is in a network that uses RIPv2 exclusively, and RIP has learned dozens of sub-nets through several neighbors. From privileged EXEC mode, the network engineer types in the command clear ip route *. What happens? +a. R1 removes all routes from its IP routing table and tries to repopulate it. + +b. R1 removes only RIP routes from its IP routing table. + +c. After the command, R1 will relearn its routes when the neighboring router’s Update timers cause them to send their next updates. + +d. R1 immediately sends updates on all interfaces, poisoning all routes, so that all neighbors immediately send triggered updates—which allow R1 to immediately relearn its routes. +e. R1 will relearn its routes immediately by sending RIP requests out all its RIP-enabled nonpassive interfaces. + +f. None of the other answers is correct. + +6. R1 has been configured for RIPv2 using only version 2, network statements and no auto-summary. The configuration includes a network 10.0.0.0 command. Which of the following statements are true about R1’s RIP behavior? +a. R1 will send advertisements out any of its nonpassive interfaces in network 10.0.0.0. + +b. R1 will process received advertisements in any of its interfaces in network 10.0.0.0, including passive interfaces. + +c. R1 will send updates only after receiving a RIP Hello message from a neighbor-ing router. + +d. R1 can disable the sending of routing updates on an interface using the passive-interface interface subcommand. + +e. R1 will advertise the subnets of any of its interfaces connected to subnets of network 10.0.0.0. + +7. Which of the following represents a default setting for the Cisco IOS implementation of RIPv2? + +a. Split Horizon is enabled on all types of interfaces. + +b. Split Horizon is disabled on Frame Relay physical interfaces and multipoint sub-interfaces. + +c. The default authentication mode, normally set with the ip rip authentication mode interface subcommand, is MD5 authentication. + +d. RIP will send triggered updates when a route changes. +316 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Foundation Topics + + +Introduction to Dynamic Routing + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +Chapter 6, “IP Forwarding (Routing),” focused on the processes concerned with using a router’s routing table contents after it has been populated. Creating the contents of a +routing table and sharing it among routers, however, is one of the largest—and arguably the most interesting—aspects of router operation. Apart from static routing, which is the elementary approach to populating a routing table, dynamic routing protocols are used in the majority of cases to fill routing tables on routers with correct information about +reachable networks and appropriate routes to them. Dynamic routing protocols constitute messages exchanged between routers to detect their mutual presence and convey infor-mation about the existing networks in the topology, and algorithms necessary to process this information and advertise it throughout the network. + +Each dynamic routing protocol covered on the CCIE Routing and Switching exam will be devoted a separate chapter in this book. The general characteristics of all routing proto-cols given in this particular section should therefore be taken as an introduction into the subject matter, establishing the basic terminology and concepts. Although the chapter focuses on an archetypal distance-vector routing protocol, RIP, this section also intro-duces path-vector and link-state paradigms and compares them to the distance-vector approach, so that the similarities and differences between the individual routing protocol principles can be highlighted in one place. + +Cisco routers and multilayer switches support a number of routing protocols, including RIPv2, EIGRP, OSPF, IS-IS, and BGP. Each of these can be categorized by different cri-teria. However, one of the most common—and most discerning—is the underlying prin-ciple and nature of information the routing protocol uses to construct the routing table contents: distance-vector and link-state. + +Distance-vector-type routing protocols are principally founded on the exchange of dis-tance vectors; that is, arrays of distances to known networks. The term vector here refers to a unidimensional array; in computer science, terms vector and unidimensional array are synonyms. The term distance refers to the measure of feasibility, or a metric, of reaching a particular network. Indeed, in distance-vector routing protocols, key messages exchanged between routers contain arrays, with each element containing information about one particular network known to the router originating the message, and that rout-er’s distance to this network. A router learns about the existence of a network by receiv-ing a message from its neighboring router that advertises the network. This neighbor then becomes the next hop toward this network. If there are multiple neighbors that advertise the same network, the router will choose that neighbor which provides the least total metric to the network. If there are multiple such routers available, all of them can be used as next hops (equal-cost multipath). After a router learns about a network from one or more of its neighbors, chooses a next hop, and installs the route into its routing table, it advertises the route itself, announcing its own distance from the destination. As a conse- +quence, each router advertises its own directly connected networks added to the routing +Chapter 7: RIPv2 and RIPng 317 + + + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + +Key Topic + +protocol, plus all routes learned by that protocol that have been placed into the routing table. (This is a sanity check performed by all distance-vector routing protocols on Cisco routers: A route learned by a routing protocol will be further advertised only if it is also placed into the router’s routing table; a router advertises only those routes used by itself.) + +In distance-vector routing protocols, routers by definition exchange only lists of known networks and their distances. They do not exchange information about the network’s topology. Information present in any router’s working database does not allow recon-structing the topology of the network. Processing the exchanged information is, from the viewpoint of memory and algorithmic complexity, relatively simple. However, the simplicity and limited nature of the information also makes these protocols generally prone to the creation of routing loops. Various methods have been implemented to avoid +the creation of routing loops; however, only Enhanced Interior Gateway Routing Protocol (EIGRP), using its advanced properties, is guaranteed to provide loop-free routing at every instant. Both RIPv2 and EIGRP are distance-vector routing protocols. + +An extension of the distance-vector principle is the path-vector routing protocol. The path-vector paradigm is fundamentally the same as with distance-vector routing proto-cols. Routers exchange messages about known networks and their distances, but in addi-tion, each network is also accompanied by a list of path elements describing the path toward the network. These path elements can be theoretically anything—router IDs of individual routers, area numbers, and so on. In Border Gateway Protocol (BGP), the most widely used path-vector routing protocol, these path elements are autonomous system numbers: the list of autonomous systems the packet must traverse to reach its destination. This path description can be used as a part of a best-path selection algorithm, but its primary purpose is different: to allow routing loop avoidance. A router will not accept an advertisement about a network whose path description already includes the identifier the router would put into that advertisement itself. This prevents routing loops from occur-ring. BGP is the only common routing protocol of the path-vector type. Some sources even consider BGP simply as a distance-vector protocol. + +In contrast to the distance-vector and path-vector paradigm, a link-state routing protocol exchanges information about individual objects in the topology and their mutual inter-connection. These objects include routers, multiaccess networks, routers on borders of areas or entire autonomous systems, and networks from other areas or from outside the autonomous system. In fact, the primary objects of interest in the link-state routing pro-tocol are the routers themselves, and their links—interfaces connecting them together. IP prefixes are often treated only as attributes, or properties, of these objects. After a router has generated a message in which it describes itself and its links to immediately neighbor-ing objects, this message is flooded without any modification to every other router in an area. As a result, every router has exact information about the entire area’s topology: It knows every router, every network, and every link. This detailed information about each object in an area then allows the router to construct a so-called directed graph of the topology (in essence a map of the topology) and use one of possibly many algorithms that computes a tree of shortest paths (also called a shortest path tree) on this graph to find all reachable destinations and least-cost paths toward them. Usually, the Shortest +Path First (SPF) algorithm invented by Edsger W. Dijkstra is used. +318 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +Link-state routing protocols operate over a very detailed representation of the network. Dijkstra’s algorithm by its very nature does not construct routes containing loops. Therefore, link-state routing protocols are significantly less prone to, though not guar-anteed to avoid, routing loop creation. Temporary routing loops, or microloops, can still occur when routers do not compute shortest paths using the same information—usu-ally during network convergence. A single router’s detailed knowledge about the net-work topology allows running network applications not possible with distance-vector approaches, such as MPLS Traffic Engineering and MPLS Fast Re-Route (note that these particular technologies are indicated as examples; they are not part of the CCIE Routing & Switching blueprint). + +It is often perceived that the downside to the link-state approach is the amount and complexity of data that needs to be maintained in a router’s working database, as each router has complete knowledge of the network topology. It is true that link-state routing protocols require a router to hold more information, and processing the information into a shortest-path tree is more CPU intensive in comparison to the distance-vector approach. However, with the amounts of RAM and CPU power in modern routers, this argument has become moot, and so have the rules of thumb that recommend no more than 50 rout-ers in a single area. + +What is, however, a fundamental property of link-state routing protocols—one that can indeed be considered a downside—is their inability to perform route summarization, filtering, or applying offset-lists in arbitrary places in network. This is because the topo-logical information can only be modified by its originating router, and must not be other-wise altered or filtered by any other router. Route summarization, filtering, and applying offset-lists, on the other hand, constitute just that: modifying information that was pos-sibly originated by a different router. Within an area, therefore, none of these operations is available. If route summarization or filtering is required, it can be accomplished only +on area border routers, as these routers are in charge of carrying (that is, re-originating) information in a distance-vector fashion from one area to another. Multiarea design with link-state protocols in modern network deployments is therefore driven more by the requirement to perform route summarization, filtering, and failure domain containment rather than saving memory or CPU cycles. + +As with all other mechanisms, there is no perfect routing protocol that suits each and every purpose. The choice of a routing protocol is always an iterative task taking multiple variables into account, and any particular choice might possibly require revisiting as the +network evolves and requirements change. + + + +RIPv2 Basics + +CCIE candidates might already know many of the features and configuration options of RIPv2. Although RIPv2 is among the simplest routing protocols, it is clearly helpful to review its operations to strengthen your grasp on interior gateway protocols (IGP) in general and the differences between distance-vector and link-state protocols. This chap-ter summarizes RIPv2’s protocol features and concepts. Table 7-2 provides a high-level +overview of RIPv2’s operation. We completely omit the details about RIPv1, though; the classful nature of this protocol makes it unsuitable for today’s networks. +Chapter 7: RIPv2 and RIPng 319 + + +Table 7-2 Key +Topic Function + + +RIPv2 Feature Summary + +Description + + + +General characteristic +Transport protocol + +Metric + +Hello interval + +Update destination + +Update interval + +Full or partial updates + +Triggered updates + +Authentication + +Route tags + +Next Hop field + +Classless, distance-vector, timer-driven routing protocol + +User Datagram Protocol (UDP), port 520 + +Hop count, with 15 as the maximum usable metric, and 16 considered to be infinite +None; RIPv2 relies on the regular full routing updates instead + +224.0.0.9 multicast for RIPv2 + +30 seconds + +Full updates each interval. For on-demand circuits, allows RIPv2 to send full updates once, and then remain silent until changes occur, per RFC 2091 +Yes, when routes change + +Allows both plain-text and MD5 authentication + +Allows RIPv2 to tag routes as they are redistributed into RIPv2 + +Supports the assignment of a next-hop IP address for a route, allowing a router to advertise a next-hop router that is different from itself + + + +RIPv2 exchanges routes by sending RIPv2 updates on each RIPv2-enabled interface based on the Update timer (update interval). A RIPv2 router advertises its connected routes, as well as other RIPv2-learned routes that are in the router’s IP routing table. RIPv2 routers do not form neighbor relationships, nor do they use a Hello protocol. Each router simply sends updates, with destination address 224.0.0.9. RIPv2 routers can also be configured to use the 255.255.255.255 broadcast IP address using the ip rip v2-broadcast per-interface command, although this is not commonly done. + +RIPv2 actually uses two types of messages: Requests and Responses. The message for-mat for both message types is identical and is shown in Figure 7-1. + +RIPv2 Message + +Octet 1 Octet 2 Octet 3 Octet 4 +Command Version Must Be Zero Message Header Address Family ID Route Tag + +IP Address +Subnet Mask +Next Hop +Metric + + +Route Entry, Up to 25 +in a Single RIP Message + + +Figure 7-1 RIPv2 Message Format +320 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +A RIP message consists of a 4B-long header containing the command field (set to 1 for Request, 2 for Response) and the version field (2 for RIPv2). The remaining two octets are unused. The remainder of the message consists of routing entries, with each routing entry occupying 20 octets in total. At most 25 routing entries can be placed into a single RIP message. Each routing entry contains the address family identifier identifying the format of the address information carried in the routing entry (only the value 2, IPv4— also known as AF_INET—is commonly supported), route tag, and the route itself—its address, netmask, recommended next hop, and metric. + +A Request message is used to ask a neighbor to send a partial or a full RIP update imme-diately, rather than waiting for the Update timer to expire, speeding the convergence. A full RIP update is requested by a Request message containing exactly one routing entry with the address family ID set to 0 and metric set to 16. Otherwise, if a Request message lists one or more particular networks, only the update on these networks is requested. On Cisco routers, Request messages for full updates are sent when the RIP process is being started, a RIP-enabled interface comes up, or when the clear ip route * command is used to clear the routing table. Partial requests do not appear to be used. + +RIPv2 uses the hop-count metric, counting the number of routers that need to be tra-versed till the destination network is reached, with 15 being the largest valid metric, and 16 considered to be infinity. Interestingly, a RIPv2 router does not put its own metric +in the route of a sent routing update; rather, it first adds 1 to each metric when build- +ing the update. For example, if a router has a route with metric 2, it advertises that route with metric 3. In essence, RIPv2 increments the metric when sending updates; RIPng and EIGRP increment metrics when receiving updates. + +When Cisco RIPv2 routers learn multiple routes to the same subnet, the lowest-metric route is chosen, of course. If multiple equal-hop routes exist, the router (by default) installs up to 4 such routes in its routing table by default, or between 1 and 16 or even 32 of such routes, based on the maximum-paths setting under the router rip section. The actual upper limit depends on the IOS version and router platform, and is not in fact related to RIPv2 or any other protocol. + +RIPv2 Convergence and Loop Prevention + +The most interesting and complicated part of RIPv2—if there is anything truly compli-cated in RIPv2—relates to loop-prevention methods used during convergence after a route has failed. Some protocols, like OSPF, IS-IS, and EIGRP, include loop prevention as a side effect of their underlying route computations. However, RIPv2, being a relatively naïve distance vector protocol, uses several supplementary loop-prevention tools, most of which constitute an added intelligence about where and when a route shall be adver-tised and when a learned route shall be accepted, but which do not really change the underlying fundamental nature of RIPv2’s best-path selection. Unfortunately, these loop-prevention tools can also significantly increase convergence time—a fact that is among the biggest negative features of RIPv2. Table 7-3 summarizes some of the key features and terms related to RIPv2 convergence, with further explanations following the table. +Chapter 7: RIPv2 and RIPng 321 + + +Table 7-3 Key +Topic Function + + +RIPv2 Features Related to Convergence and Loop Prevention + +Description + + + +Counting to Infinity + + + + +Split Horizon + + +Split Horizon with Poisoned Reverse + +Route poisoning + + +Triggered update + + + + +Update timer + +Invalid after timer + + + + + +Holddown timer + + + + + +Flushed after timer + +If the next hop to a particular destination network advertises that network with a suddenly increased metric, accept +the advertisement immediately and update our metric accordingly. If the updated metric reaches infinity, stop using that next hop. +Instead of advertising all routes out a particular interface, RIPv2 omits the routes whose outgoing interface field matches the interface out which the update would be sent. +A stronger variant of Split Horizon: All routes whose outgoing interface matches the interface out which the update would be sent are advertised with an infinite metric. +The process of sending an infinite-metric route in routing updates when that route fails, prompting its rapid removal from routing tables. +The immediate sending of a new update when routing information changes, instead of waiting for the Update timer to expire. Only the changed network is sent in the triggered update. Complete updates continue to be sent in regular intervals. +The timer that specifies the time interval over which updates are sent, defaulting to 30 seconds. +A per-route timer (default 180 seconds) that is reset and begins after an update about a route has been received from its next hop. If the updates about the route from its next hop cease to be received and the Invalid after timer reaches its limit, the route is declared invalid and the Holddown timer starts for this route. +A per-route timer (default 180 seconds) that begins after a route has been declared invalid (that is, after the Invalid +after timer expires). The router starts advertising that route as unreachable, does not accept any updated information, and does not modify the routing table entry for that route until the Holddown timer for that route expires. +A per-route timer (default 240 seconds) that is reset and begins after an update about a route has been received from its next hop. If the updates about the route from its next hop cease to be received and the Flushed after timer reaches its limit, the router removes the route from the routing table entirely. +322 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + + + + +Key Topic + +Several of these mechanisms are surprisingly misunderstood and even poorly docu-mented. A few words about each of them are therefore in order. + +The basic working principle of distance-vector routing protocols states that routers exchange lists (that is, vectors) of known networks and their distances. For each network, a router chooses the neighbor providing the least total metric as the next hop toward that network, and installs the network through that particular neighbor into its routing table. All other routers advertising the same network with a higher total distance are ignored. There is only one crucial exception to this rule: If the next-hop router for a destination network suddenly advertises a higher distance than the last time, this advertisement is not ignored but rather accepted immediately. The receiving router will update the total dis-tance to the network in its routing table, and it will advertise the increased total distance itself but it will otherwise keep the network and its current next hop in the routing table. Only a subsequent arrival of an update from a different neighbor providing a lower total metric would cause the router to change the next hop. While perhaps slightly surprising, the logic here is straightforward: If a next hop has become more distant from the desti-nation than it was before, so have become all routers that still traverse through this next hop. + +This logic immediately leads to the existence of the mechanism known as Counting to Infinity. If, for some reason (usually caused by deactivated Split Horizon and race condi-tions in timing), two neighboring routers start mutually considering themselves as next hops toward the same destination network, each of them will derive its own metric from the metric of its neighbor. Assume two neighbors, routers X and Y, pointing to each other in a tight routing loop for a destination network N. If X advertises the network N with a metric of 1, Y will advertise this network with a metric of 2. Because Y is X’s next hop, X will accept this update right away and increase its own metric to 3. After advertising +it, Y will also accept this update immediately, as X is Y’s next hop, and increase its own metric to 4. After Y sends another advertisement to X, the metric on X will increase to 5, after which X will advertise this network to Y, causing it to raise its distance to 7, and so on. This process will—theoretically—continue ad infinitum, hence the name Counting to Infinity. Because distance-vector routing protocols have a concept of an infinite metric— a metric whose value represents an unreachable network—after one of routers X or Y reaches this metric, it will drop the route from its routing table, finally breaking the loop. This is how the Counting to Infinity mechanism leads to gradual, albeit slow, elimination of routing loops after they have occurred. It is noteworthy to mention that Counting to Infinity is not an additional enhancement to the distance-vector principle but simply a consequence of it. + +The Split Horizon is a well-known principle, stating that a network should never be advertised back over the interface that is used to reach that network, because that interface leads back to the next hop toward that route and we do not want to risk a situ-ation where the next hop suddenly loses the route while we inadvertently trick it into believing we are providing a backup path. In the Cisco RIPv2 implementation, Split Horizon is by default activated on most interfaces, notable exceptions being physical Frame Relay and ATM interfaces. The state of RIPv2 Split Horizon can be verified in the +show ip interface command output. +Chapter 7: RIPv2 and RIPng 323 + + + +Key Topic + + + + + + + +Key Topic + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +An augmented version of Split Horizon is the addition of the Poisoned Reverse mecha-nism, resulting in Split Horizon with Poisoned Reverse. This principle states that a net-work should always be explicitly advertised as unreachable over the interface that is used to reach that network. This version of Split Horizon is stronger than its basic ver-sion: Instead of simply not advertising the route back toward its next hop, silently hoping the next hop has never considered us a possible backup for this path, we explicitly force the next-hop router to avoid and ignore us when choosing the best path to the network. While more effective, it is not implemented in the Cisco RIPv2. + +Route Poisoning is a mechanism used to rapidly flush a route that has become unreach-able. Doing this is accomplished by advertising this route with the metric set to infinity. A router that receives an update about a network from its next hop with an infinite metric will immediately remove the route to the network through that particular next hop from its routing table. If this was the only route to the network, the router will itself advertise that network as being unreachable to its neighbors. As a result, the information about the unreachability will propagate toward and through all routers whose old path to the (now unreachable) network traversed through the failure point. Routers that receive an update about an unreachable network from different neighbors than their respective next hops are not influenced (the message is indistinguishable from a Split Horizon with Poisoned Reverse advertisement—they process it accordingly but it has no effect on their routing tables). Hence, routers on the affected route expire the old route rapidly, allowing it to converge on a backup path significantly faster. + +Even though a route is removed from the routing table during a Route Poisoning proce-dure, RIP will still keep the route in its internal database (see the show ip rip database command), marked as possibly down. This is done to allow the route to be repeatedly advertised as unreachable, as a single advertisement can get lost (keep in mind that RIP is UDP-based and has no acknowledgments). The unreachable route will be flushed from the RIP internal database after Flushed after – Invalid after seconds. These timers will be discussed in more detail further in the chapter. + +It is important to distinguish between the relatively similar terms Poisoned Reverse and Route Poisoning. They both refer to an action of advertising a network with an infinite metric. What makes the two terms different is the purpose of advertising a network as unreachable: Poisoned Reverse is an extension to the Split Horizon principle that adver-tises a route as unreachable back to its next hop to prevent it from creating a routing loop, while Route Poisoning advertises a truly unreachable route to quickly flush it from routing tables and to allow a backup path to take over. + +Triggered updates are updates in RIPv2 that are sent in the moment of detecting a change in reachability of a network, rather than waiting for the full Update interval to expire. Connecting or learning about a new network, disconnecting it or learning about its unreachability, or a change to its metric will cause a router to immediately send an adver-tisement with the updated information. This update commonly carries only the changed network, without listing all other known networks. They continue to be advertised, along with the changed information, in regular intervals driven by the Update timer. In debugs and Cisco documents, these triggered updates are also called flash updates . Triggered +updates in RIPv2 shall not be confused with Triggered Extensions to RIPv2 covered in +324 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + +Key Topic + +RFC 2091, which are a different mechanism (adaptation of RIPv2 for on-demand circuits so that the updates are sent only in moments of topology change to avoid keeping the on-demand circuit permanently up). + +The Holddown mechanism is frequently misunderstood. Its main purpose is to delay processing updates about a network whose reachability has become questionable, as the received updates might not yet contain up-to-date information. To understand this mechanism better, assume that a router suddenly stopped receiving updates about a particular network from its only next hop toward that network. This network has not been declared unreachable by the next hop. Rather, updates (if any) received from that next hop simply do not list that network anymore. This can happen for various reasons, +including the following: + + +■ Update might have been lost in transit or dropped (ACLs, rate limit, and so on). + +■ Next-hop router might have been turned off or crashed without the link going down. + +■ Next-hop router might have started considering us as its own next hop and uses plain Split Horizon. + +■ RIPv2 process on the next-hop router might have been removed. + +■ Summarization, route filtering, or passive interface might have been activated. + +■ Next-hop router might be running a RIPv2 implementation that does not support Route Poisoning, so when a network truly goes down, it simply stops being adver-tised. + +In any case, the ongoing lack of any information about a network from its next hop is tolerable for a limited time period (to account for UDP’s lack of reliability), but if its absence exceeds a reasonable time, it is clear that “something happened.” Unfortunately, it is not clear what exactly has occurred, and it is even less clear whether the non-next-hop neighbors that claim reachability to this network already know about this possible outage and use a different route. Therefore, the router that has detected a sudden loss of reachability information for a network must not immediately accept the updates from its neighbors; rather, it must give them certain time to learn about the outage and converge to a different path. Only after this time, updates from other routers regarding the missing network can be accepted as trustworthy again. + +To accomplish this, Cisco routers implement two independent RIPv2 timers: the Invalid after timer and the Holddown timer. The Invalid after timer is reset every time an update about a network from its next hop arrives, and is incremented each second. A route is considered perfectly usable if an update about it has been received within the last 180 seconds, which is the default upper limit for the Invalid after timer. If, however, the Invalid after timer has reached the upper limit and an update about this network has not been received, the network is considered invalid. In such case, the following happens: + +■ Router declares the network invalid—to be of questionable reachability. This is vis-ible in the show ip route output by a comment of “is possibly down.” The Invalid after timer is stopped for this network. +Chapter 7: RIPv2 and RIPng 325 + +■ Router starts the Holddown timer for this network. While the timer runs (180 sec-onds by default), the router itself advertises the network with infinite metric (Route Poisoning) to force its neighbors to find an alternative route if possible. Additionally, the router locks the routing entry in its routing table, still pointing toward the former next hop. Absolutely no updates whatsoever are accepted until the Holddown timer expires, regardless of who sends them and what metric they claim. + +■ After the Holddown timer expires, the router unlocks the routing entry in its rout-ing table and converges through a neighbor that offers the lowest metric route to the network. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +There are a number of noteworthy facts about this entire procedure. First, the procedure is not triggered by the arrival of an update that advertises an unreachable network. Such an update would be nothing else than Route Poisoning that would cause the route to be dropped from the routing table immediately (even though it would be kept in the RIP internal database for Flushed after – Invalid after seconds as described earlier, to allow the route to be advertised as unreachable for a period of time). Rather, this procedure is invoked after the reachability of a network can be neither confirmed nor refuted for a period of time. + +Second, after a router puts a route into the invalid state, it advertises that route as unreachable itself. This action is very natural—it is like saying: “I know there is some problem in reaching this network, although I do not know what exactly happened. Whoever uses me as a next hop, stop doing that, and try to find another route that bypasses me.” As a result, after a router has put a route into the invalid state, it forces its neighbors to find a detour if any exists. If a neighbor still advertises the network some time after it has been told it is not reachable through us anymore, it must know a differ-ent path to it. + +Third, a router never updates an invalid route while the Holddown timer runs. Before it was declared invalid, it pointed toward a next hop. After the next hop stopped advertis-ing that network altogether and the Invalid after timer expired, the route was declared invalid and started being advertised as unreachable, but the router still keeps it locked in the routing table, pointing toward the former next hop, until the Holddown timer +expires. The general idea here is that it is better to blackhole the traffic rather than create a routing loop by prematurely trusting a different neighbor that claims to have a route toward the failed network. + +Fourth, the last bullet in the previous holddown procedure assumes that there is an alter-native route to the destination. If there truly is a detour path, the router will learn about it after the Holddown timer expires and the routing entry is unlocked. However, the failed route might have been the only path to the destination, and there might be no alternative path available, so no neighbor will advertise it. That would cause the routing entry to lin-ger in the routing table indefinitely, still pointing toward the previous next hop. + +Therefore, to prevent a route that has stopped being advertised from lingering in rout-ing tables indefinitely, yet another timer is present: the Flushed after timer. Similarly to +Invalid after, the Flushed after timer is reset every time an update about a network from +its next hop arrives, and is incremented each second. If the Flushed after timer reaches +326 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +its upper limit, the route is immediately flushed from the routing table. If this was the last instance of the route toward a particular network, the network will be also advertised as unreachable along with its removal. That will conclude its existence in routing tables. + +The default setting of RIPv2 timers on Cisco routers is 30 seconds for Update, 180 sec-onds for Invalid after and Holddown, and 240 seconds for Flushed after. The default timer setting actually does not allow the Holddown timer to completely expire. If a net-work stops being advertised by its next hop, it will be put into an invalid state 180 sec-onds after the last update about it arrived from the next hop. The Holddown timer then starts, but after 60 seconds, the Flushed after timer that starts in tandem with the Invalid after timer will expire, and the router will remove the route entirely along with all associ-ated timers. As a result, the effective Holddown period is only 60 seconds. + +It turns out that in Cisco implementation, the Flushed after timer’s value is verified only after the route has been moved to invalid state (that is, after the Invalid after timer +expires). As an example, if the Invalid after was set to 180 seconds but the Flushed after was set just to 120 seconds, both timers would be reset and increasing simultaneously after the last update, but if the updates ceased, the route would be kept in the routing table until the Invalid after timer fired, that is, the next 180 seconds. At that moment, the router would also check the Flushed after timer and find out the route should have been removed 60 seconds ago, so it would remove it within a few seconds. In other words, the Flushed after timer has no effect on a route that is still considered valid (that is, its age is less than the upper limit of Invalid after). If you perform an experiment to verify this behavior in a lab, you might find that the reaction to the Flushed after timer is delayed by roughly 10 seconds, probably caused by the timing granularity used by IOS. + +The rest of this section shows examples of the convergence features, using RIP show and debug command output to show examples of their use. Figure 7-2 shows the sample internetwork that is used in these examples of the various loop-prevention tools. + +Network 172.31.0.0 + +Falling Interfaces + + + +103.3/24 E0/0 + + + + +103.4/24 +E0/0 + +13.2/30 R3 S0/0.1 + + + + +24.1/30 R4 S0/0.2 + +13.1/30 S0/0.3 + + + + +24.2 S0/0.4 + + +11.1/24 R1 Fa0/0 + + + + +11.2/24 +R2 Fa0/0 + + + +Figure 7-2 Sample Internetwork Used for Loop-Prevention Examples +Chapter 7: RIPv2 and RIPng 327 + +Converged Steady-State Operation + +Example 7-1 shows a few details of R1’s operation while all interfaces in Figure 7-2 are up and working. The example lists the basic (and identical) RIPv2 configuration on all four routers; configuration will be covered in more detail later in the chapter. As configured, all four routers are using only RIPv2, on all interfaces shown in Figure 7-2. Read the com-ments in Example 7-1 for explanations of the output. In a stable network, no triggered updates need to be sent, and all routers send their updates each Update interval seconds, which is 30 by default. + +Example 7-1 Steady-State RIPv2 Operation in Figure 7-2 + +! All routers use the same three lines of RIPv2 configuration. + +router rip +network 172.31.0.0 +version 2 + +! Below, the show ip protocols command lists many of RIPv2's operational settings, +! including RIPv2 timers, version used, and neighbors from which RIPv2 updates have +! been received (listed as "Routing Information Sources"). + +R1# show ip protocols +Routing Protocol is "rip" +Sending updates every 30 seconds, next due in 24 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Redistributing: RIPv2 +Default version control: send version 2, receive version 2 + +Interface +FastEthernet0/0 +Serial0/0.3 + +Send Recv Triggered RIP Key-chain +2 2 +2 2 + +Automatic network summarization is in effect +Maximum path: 4 +Routing for Networks: +172.31.0.0 +Routing Information Sources: + +Gateway +172.31.11.2 +172.31.13.2 + +Distance +120 +120 + +Last Update +00:00:15 +00:00:08 + +Distance: (default is 120) + +! Below, the current age is listed by each RIP route. Note that it took +! about 3 seconds between the above show ip protocols command and the upcoming +! show ip route command, so the last update from 172.31.13.2 (above) +! was 8 seconds; 3 seconds later, the age for a route learned from +328 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! 172.31.13.2 is now 11 seconds. + +R1# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set +172.31.0.0/16 is variably subnetted, 4 subnets, 2 masks +R 172.31.24.0/30 [120/1] via 172.31.11.2, 00:00:18, FastEthernet0/0 +C 172.31.11.0/24 is directly connected, FastEthernet0/0 +C 172.31.13.0/30 is directly connected, Serial0/0.3 +R 172.31.103.0/24 [120/1] via 172.31.13.2, 00:00:11, Serial0/0.3 + +! Below, the show ip rip database command lists information for each route +! considered by RIP. + +R1# show ip rip database +172.31.0.0/16 auto-summary +172.31.11.0/24 directly connected, FastEthernet0/0 +172.31.13.0/30 directly connected, Serial0/0.3 +172.31.24.0/30 +[1] via 172.31.11.2, 00:00:01, FastEthernet0/0 +172.31.103.0/24 +[1] via 172.31.13.2, 00:00:23, Serial0/0.3 + + +Note The show ip rip database command lists all RIP learned routes and all connected routes that RIP is advertising. + + + +Triggered (Flash) Updates and Poisoned Routes + +When RIPv2 knows for sure that a route to a subnet has failed, RIPv2 can converge to an alternate route relatively quickly. Example 7-2 details the steps behind one such example, using Figure 7-2, with the steps outlined in the following list (the comments in Example 7-2 refer to these steps by number): +1. RIPv2 debug messages show R1’s RIPv2 updates, including R1’s use of split horizon. + +2. R3’s E0/0 interface is shut down, simulating a failure. +Chapter 7: RIPv2 and RIPng 329 + +3. R3 immediately sends a triggered update (also called a flash update), because R3 knows for sure that the route has failed. R3’s behavior combines a triggered update with route poisoning, as R3’s advertised route is a poisoned route to now unreach-able network 172.31.103.0/24. +4. R1 immediately (because of triggered updates) sends a triggered update out all its interfaces, advertising a poisoned route for 172.31.103.0/24. + +5. R1 removes its route to 172.31.103.0/24 from its routing table. + +6. R1 waits for R2’s next update, sent based on R2’s Update timer on its Fa0/0 interface. That update includes a route to 172.31.103.0/24. R1 adds that route to its routing table. + +Example 7-2 R1’s Convergence for 172.31.103.0/24 Upon R3’s E0/0 Interface Failure + +! First, the debug ip RIPv2 command enables RIPv2 debugging. This command will show +! messages that show every route in the sent and received updates. + +R1# debug ip RIPv2 +RIPv2 protocol debugging is on + +! (Step 1) Below, the output exhibits split horizon - for example, 172.31.103.0/24 +! is not advertised out s0/0.3, but it is advertised out Fa0/0. + +*Mar 3 22:44:08.176: RIPv2: sending v2 update to 224.0.0.9 via S0/0.3 (172.31.13.1) +*Mar 3 22:44:08.176: RIPv2: build update entries + +*Mar 3 22:44:08.176: +*Mar 3 22:44:08.176: + +172.31.11.0/24 via 0.0.0.0, metric 1, tag 0 +172.31.24.0/30 via 0.0.0.0, metric 2, tag 0 + +*Mar 3 22:44:12.575: RIPv2: sending v2 update to 224.0.0.9 via Fa0/0 (172.31.11.1) +*Mar 3 22:44:12.575: RIPv2: build update entries + +*Mar 3 22:44:12.575: +*Mar 3 22:44:12.575: + +172.31.13.0/30 via 0.0.0.0, metric 1, tag 0 +172.31.103.0/24 via 0.0.0.0, metric 2, tag 0 + + +! Next, R1 receives a RIPv2 update from R3. The metric 1 route in the update below +! is R1's best route, and is placed into R1's routing table. Note that the metric +! in the received update is R1's actual metric to reach the route. + +*Mar 3 22:44:21.265: RIPv2: received v2 update from 172.31.13.2 on S0/0.3 + +*Mar 3 22:44:21.269: +*Mar 3 22:44:21.269: + +172.31.24.0/30 via 0.0.0.0 in 2 hops +172.31.103.0/24 via 0.0.0.0 in 1 hops + + +! (Step 2) R3's E0/0 interface is shut down at this point. (Not shown). +! (Step 3) Below, R1 receives a triggered update, with two poisoned routes from +! R3 - the same two routes that R3 advertised in the previous routing update above. +! Note that the triggered update only includes changed routes, with full updates +! continuing on the same update interval. +330 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +*Mar 3 22:44:46.338: RIPv2: received v2 update from 172.31.13.2 on S0/0.3 + +*Mar 3 22:44:46.338: +*Mar 3 22:44:46.338: + +172.31.24.0/30 via 0.0.0.0 in 16 hops (inaccessible) +172.31.103.0/24 via 0.0.0.0 in 16 hops (inaccessible) + + +! (Step 4) Above, R1 reacts to its receipt of poisoned routes, sending a triggered +! update out its Fa0/0 interface. Note that the debug refers to the triggered +! update as a flash update. + +*Mar 3 22:44:48.341: RIPv2: sending v2 flash update to 224.0.0.9 via Fa0/0 (172.31.11.1) +*Mar 3 22:44:48.341: RIPv2: build flash update entries +*Mar 3 22:44:48.341: 172.31.103.0/24 via 0.0.0.0, metric 16, tag 0 + +! (Step 4) R1 also sends a triggered update out S0/0.3 to R3, which includes +! a poison reverse route to 172.31.103.0/24, back to R3. R1 does not send back a +! poison route to 172.31.24.0, because R1's route to 172.31.24.0 was +! pointing towards R2, not R3 - so R1's route to 172.31.24.0/24 did not fail. + +*Mar 3 22:44:48.345: RIPv2: sending v2 flash update to 224.0.0.9 via S0/0.3 (172.31.13.1) +*Mar 3 22:44:48.345: RIPv2: build flash update entries +*Mar 3 22:44:48.345: 172.31.103.0/24 via 0.0.0.0, metric 16, tag 0 + +! (Step 5) Below, note the absence of a route to 103.0/24 in R1's routing table. + +R1# show ip route 172.31.103.0 255.255.255.0 +% Subnet not in table + +! (Step 6) Below, 23 seconds since the previous message, R2's next routing +! update arrives at R1, advertising 172.31.103.0/24. Following that, R1 now has +! a 2-hop route, through R2, to 172.31.103.0/24. + +*Mar 3 22:45:11.271: RIPv2: received v2 update from 172.31.11.2 on Fa0/0 + +*Mar 3 22:45:11.271: +*Mar 3 22:45:11.271: + +172.31.24.0/30 via 0.0.0.0 in 1 hops +172.31.103.0/24 via 0.0.0.0 in 2 hops + + +R1# show ip route 172.31.103.0 255.255.255.0 +Routing entry for 172.31.103.0/24 +Known via "RIPv2", distance 120, metric 2 +Redistributing via RIPv2 +Last update from 172.31.11.2 on FastEthernet0/0, 00:00:01 ago +Routing Descriptor Blocks: +* 172.31.11.2, from 172.31.11.2, 00:00:01 ago, via FastEthernet0/0 +Route metric is 2, traffic share count is 1 +Chapter 7: RIPv2 and RIPng 331 + +If you examine the debug message time stamps in Example 7-2, you will see that between 25 and 45 seconds passed from when R1 heard the poisoned routes until R1 heard R2’s new routing update with a now-best route to 172.31.103.0/24. While not on par with EIGRP or OSPF, this convergence is reasonably fast for RIPv2. + + +Note Do not confuse the term triggered update with the term triggered extensions to RIPv2. RFC 2091 defines how RIPv2 can choose to send full updates only once, and then be silent, to support demand circuits. The feature is enabled per interface by the ip rip triggered interface subcommand. + + + +RIPv2 Convergence When Routing Updates Cease + +When a router ceases to receive routing updates, RIPv2 must wait for some timers to expire before it decides that routes previously learned from the now-silent router can be considered to be failed routes. To deal with such cases, RIPv2 uses its Invalid after, Flushed after, and Holddown timers to prevent loops. Coincidentally, RIPv2’s conver-gence time increases to several minutes as a result. + +Example 7-3 details just such a case, where R1 simply ceases to hear RIPv2 updates from R3. (To create the failure, R3’s s0/0.1 subinterface was configured as passive, emulating a silent passing away of the router without the interface actually going down.) The example uses the internetwork illustrated in Figure 7-2 again, and begins with all interfaces up, and all four routes known in each of the four routers. The example follows this sequence (the comments in Example 7-3 refer to these steps by number): +1. R3’s s0/0.1 subinterface fails, but R1’s subinterface stays up, so R1 must use its timers to detect route failures. + +2. R1’s Invalid after and Flushed after timers for route 172.31.103.0/24 grow because R1 does not hear any further updates from R3. + +3. After the Invalid after timer expires (180 seconds) for R1’s route to 172.31.103.0/24, R1 starts a Holddown timer for the route. Holddown starts at (default) 180 seconds and counts down. +4. The Flushed after timer expires after a total of 240 seconds, or 60 seconds past the Invalid after timer. As a result, R1 flushes the route to 172.31.103.0/24 from its rout-ing table, which also removes the Holddown timer for the route. + +Example 7-3 R1 Ceases to Hear R3’s Updates: Invalid After, Flushed After, Holddown Timers + +! First, the debug ip ripv2 event command is used which displays messages when +! updates are sent and received, but does not display the contents of the updates. + +R1# debug ip ripv2 event +RIPv2 event debugging is on +332 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! (Step 1) Not Shown: R3's S0/0.1 subinterface is made passive. +! (Step 2) Below, the age for 172.31.103.0/24 has reached 35 seconds, meaning +! that 35 seconds have passed since the last received update from which this route +! was learned. An age of a RIPv2-learned route over 30 seconds means that at least +! one RIPv2 update was not received. + +R1# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is not set + +172.31.0.0/16 is variably subnetted, 4 subnets, 2 masks +R 172.31.24.0/30 [120/1] via 172.31.11.2, 00:00:09, FastEthernet0/0 +C 172.31.11.0/24 is directly connected, FastEthernet0/0 +C 172.31.13.0/30 is directly connected, Serial0/0.3 +R 172.31.103.0/24 [120/1] via 172.31.13.2, 00:00:35, Serial0/0.3 + +! Below, one example set of debug messages are shown. (Many more debug messages +! occurred while waiting for convergence, but those were omitted.) The messages +! about R1's received updates from R2 occur every 30 seconds or so. The contents +! include a 2-hop route to 172.31.103.0/24, which R1 ignores until the Flushed +! after timer expires. + +*Mar 3 21:59:58.921: RIPv2: received v2 update from 172.31.11.2 on FastEthernet0/0 +*Mar 3 21:59:58.921: RIPv2: Update contains 2 routes + +! (Step 3) Below, the Invalid after timer expires, roughly 3 minutes after the +! failure. Note that the route is listed as "possibly down," which occurs when the +! Invalid after timer has expired but the Flushed after timer has not. + +R1# show ip route 172.31.103.0 255.255.255.0 +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route +Chapter 7: RIPv2 and RIPng 333 + +Gateway of last resort is not set + +172.31.0.0/16 is variably subnetted, 4 subnets, 2 masks +R 172.31.24.0/30 [120/1] via 172.31.11.2, 00:00:20, FastEthernet0/0 +C 172.31.11.0/24 is directly connected, FastEthernet0/0 +C 172.31.13.0/30 is directly connected, Serial0/0.3 +R 172.31.103.0/24 is possibly down, +routing via 172.31.13.2, Serial0/0.3 + +! (Step 3) Next, the command shows the metric as inaccessible, meaning an +! infinite metric, as well as the current age timer (3:23), which counts up. +! While not shown in this example, R1 itself advertises the route with infinite +! metric as the Invalid after timer expired and the route has been declared +! invalid. Also, the Holddown timer for this route has started (at 180 seconds), +! with 159 seconds in its countdown. The Holddown timer prevents R1 from using +! the route heard from R2. + +R1# show ip route 172.31.103.0 255.255.255.0 +Routing entry for 172.31.103.0/24 +Known via "RIPv2", distance 120, metric 4294967295 (inaccessible) +Redistributing via RIPv2 +Last update from 172.31.13.2 on Serial0/0.3, 00:03:23 ago +Hold down timer expires in 159 secs + +! (Step 4) Below, just after 4 minutes has passed, the Flushed after timer has +! expired, and the route to 172.31.103.0/24 has been flushed from the routing ! table. + +R1# show ip route 172.31.103.0 255.255.255.0 +% Subnet not in table + +At the end of the example, the only remaining step for convergence is for R1 to receive R2’s next regular full routing update, which includes a two-hop route to 172.31.103.0/24. R2 will send that update based on R2’s regular Update interval. R1 would place that route in its routing table, completing convergence. + +Note that either the Flushed after timer or the Holddown timer must expire before new routing information would be used in this case. Here, the Flushed after timer for route 172.31.103.0/24 expired first, resulting in the route being removed from R1’s rout-ing table. When the route is flushed (removed), any associated timers are also removed, +including the Holddown timer. Had the Holddown timer been smaller, and had it expired before the Flushed after timer, R1 would have been able to use the route advertised by R2 at that point in time. +334 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Convergence Extras + +Convergence in Example 7-3 took a little over 4 minutes, but it could be improved in some cases. The RIPv2 timers can be tuned with the timers basic update invalid hold-down flush subcommand under router rip, although care should be taken when changing these timers. The timers should be consistent across routers, and smaller values increase the chance of transient routing loops being formed during convergence. + +The clear ip route * command also speeds convergence by removing all routes (not just RIP-learned) from the routing table, along with any per-route timers. In Example 7-3, the clear ip route 172.31.103.0 command would have worked as well, just deleting that one route. Because the clear command bypasses loop-prevention features by deleting the route and timers, it can be risky, but it certainly speeds convergence. Also, after the clear ip route * command, R1 would immediately issue RIPv2 request packets, which cause the neighboring routers to send full routing updates to R1, instead of waiting on their next update time. + +RIPv2 Configuration + +This chapter does not go into detail on configuring RIPv2. However, make sure to review the list of RIPv2 configuration commands, and command syntax, listed in Table 7-6 of the “Foundation Summary” section for this chapter. + +Figure 7-3 shows the internetwork that will be used to illustrate RIPv2 configuration concepts in Example 7-4. Note that most of the subnets are part of network 172.31.0.0, except where noted. + +Network 172.31.0.0, Except where Shown + + + +103.3/24 E0/0 + + + +104.144/26 +E0/0 + + +13.2/30 R3 +23.1/30 + +14.2/30 + +R4 24.1/30 + + +13.1/30 14.1/30 +16.1/24 + + +11.1/24 R1 +Fa0/0 RIP + + + +S1 +11.201/24 + +211.202/24 212.202/24 +213.202/24 + + + +FR + +VLAN 1 +172.31.11.0/24 + + + +105.5/24 25.1/30 +E0/0 R5 23.2/30 + + + +10.1.106/24 +E0/0 + + +16.6/24 + +R6 10.1.26.6/24 + + +24.2/30 +25.2/30 +10.1.26.6/24 R2 + +OSPF +11.2/24 11.202/24 +S2 Fa0/0 + + +221.202/24 222.202/24 +223.202/24 + + +Figure 7-3 Sample Internetwork Used for RIPv2 Configuration Examples +Chapter 7: RIPv2 and RIPng 335 + +Enabling RIPv2 and the Effects of Autosummarization + +Example 7-4 covers basic RIPv2 configuration, the meaning and implication of the RIPv2 network command, and the effects of the default setting for autosummarization. To examine just those functions, Example 7-4 shows the related RIPv2 configuration on R1, R2, and R6, along with some command output. + +Example 7-4 Basic RIPv2 Configuration on R1, R2, R4, and S1 + +! First, the three lines of configuration are the same on R1 and S1 +! (Point 1): the version 2 command tells R1 to send and receive only RIPv2 +! updates, and to ignore RIPv1 updates. The network command always recomputes +! its argument (the network address) into a classful representation. + +router rip +version 2 +network 172.31.0.0 + +! Next, the configuration for R2 and R6 is shown, which includes a network 10.0.0.0 +! command, enabling RIPv2 on their interfaces in network 10.0.0.0/8. + +router rip +version 2 +network 10.0.0.0 +network 172.31.0.0 + +! Below, R1 shows that only v2 updates are being sent and received, and that +! autosummarization is in effect. + +R1# show ip protocols +Routing Protocol is "RIPv2" +Sending updates every 30 seconds, next due in 26 seconds +Invalid after 180 seconds, hold down 180, flushed after 240 +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Redistributing: RIPv2 +Default version control: send version 2, receive version 2 + +Interface +FastEthernet0/0 +Serial0/0.3 + +Send Recv +2 2 +2 2 + +Triggered RIPv2 Key-chain +carkeys + + + +Serial0/0.4 +Serial0/0.6 + +2 2 anothersetofkeys +2 2 + +Automatic network summarization is in effect + +! Lines omitted for brevity +! Below, the show ip route 10.0.0.0 command lists all of R1's known routes to +! network 10.0.0.0; the only route is for 10.0.0.0/8, because R2 and R6 +336 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! automatically summarize (by default) at the classful network boundary. + +R1# show ip route 10.0.0.0 +Routing entry for 10.0.0.0/8 +Known via "RIPv2", distance 120, metric 1 +Redistributing via RIPv2 +Last update from 172.31.11.2 on FastEthernet0/0, 00:00:01 ago +Routing Descriptor Blocks: +172.31.16.6, from 172.31.16.6, 00:00:08 ago, via Serial0/0.6 +Route metric is 1, traffic share count is 1 +* 172.31.11.2, from 172.31.11.2, 00:00:01 ago, via FastEthernet0/0 +Route metric is 1, traffic share count is 1 + +A couple of points from this example need a little more explanation. The RIPv2 network command only allows for a classful network as a parameter, which in turn enables RIPv2 on all of that router’s interfaces that are part of that network. Even if a subnetwork address is entered as the network command’s parameter, the router will automatically compute the corresponding classful network’s address and store it in the configuration. Enabling RIPv2 on an interface makes the router begin sending RIPv2 updates, listening for RIPv2 updates (UDP port 520), and advertising that interface’s connected subnet. + +Because the RIPv2 network command has no way to simply match one interface at a time, a RIPv2 configuration might enable these three functions on an interface for which some or all of these functions are not required. The three RIPv2 functions can be indi-vidually disabled on an interface with some effort. Table 7-4 lists these three functions, along with how to disable each feature. + +Key Table 7-4 RIPv2 Per-Interface Actions, and How to Disable Them When Enabled Topic RIPv2 Function How to Disable + +Sending RIPv2 updates Make the interface passive: configure router rip, followed by passive-interface type number +Listening for RIPv2 updates Filter all incoming routes using a distribute list, or filter incoming RIPv2 packets using a per-interface ACL + +Advertising the connected subnet + +Filter outbound advertisements on other interfaces using distribute lists, filtering an interface’s connected subnet + + + +Another way that you can limit advertisements on multiaccess networks is to use the neighbor ip-address RIP subcommand. This command tells RIP to send unicast RIP updates to that neighbor. For example, when using a multipoint Frame Relay subinterface, there might be four routers reachable using that subinterface. If you want to send RIP updates to only one of them, make the interface passive, and then use the neighbor com-mand to cause RIP to send updates, but only to that particular neighbor. + +RIPv2 uses autosummarization at classful network boundaries by default. To reiterate, automatic summarization applies whenever a router intends to advertise a subnetwork of +Chapter 7: RIPv2 and RIPng 337 + +a particular classful network X (also called major network) out an interface that is itself in a different classful network Y. In that case, the router will advertise only the class- +ful network X instead of the individual subnet. In Example 7-4, R2 and R6 connect to parts of classful networks 10.0.0.0/8 and network 172.31.0.0/16. Advertisements sent out interfaces in network 172.31.0.0/16 advertise a summarized route of the complete class A network 10.0.0.0/8. In the example, R2 and R6 both advertise a summarized network 10.0.0.0/8 to R1. As a result, as seen with the show ip route 10.0.0.0 command on R1, R1 knows two equal-cost routes to classful network 10.0.0.0. In this case, R1 would send some packets meant for subnet 10.1.106.0/24 through R2 first, a seemingly poor choice. To advertise the subnets of network 10.0.0.0, R2 and R6 could be configured with the no auto-summary command under router rip. Disabling the automatic summarization should be considered a mandatory part of any RIPv2 configuration. + +Note that RIPv2 allows for discontiguous networks, but autosummarization must be dis-abled for a design using discontiguous networks to work. + +RIPv2 Authentication + + + + + + + + + + + + + + + +Key Topic + +RIPv2 authentication, much like EIGRP and OSPF authentication, requires the creation of keys and requires authentication to be enabled on an interface. The keys are used either as clear-text passwords or as the secret (private) key used in an MD5 calculation. + +Multiple keys are allowed, and are grouped together using a construct called a key chain. A key chain is simply a set of related keys, each of which has a different number and might be restricted to a time period. By allowing multiple related keys in a key chain, with each key valid during specified time periods, the engineer can easily plan for migra-tion to new keys in the future. (NTP is recommended when keys are restricted by time ranges. Beware of a chicken-and-egg problem, though, when keys are not considered usable until correct time is set on a router, and a correct time cannot be obtained from a remote NTP server because the routing requires the use of correct keys.) + +Cisco IOS enables the RIPv2 (and EIGRP) authentication process on a per-interface basis, referring to the key chain that holds the keys with the ip rip authentication key-chain name interface subcommand. The router looks in the key chain and selects the key(s) valid at that particular time. If multiple keys are valid for signing outgoing RIPv2 packets, the key with the lowest sequence number will be used. With RIPv2, the type of authen-tication (clear-text password or MD5 digest) is chosen per interface as well, using the ip rip authentication mode {text | md5} interface subcommand. If this command is omitted, the authentication type defaults to text, meaning that the key is used as a clear-text password. + +When authentication is enabled, the maximum number of prefixes that can be advertised in a RIPv2 message is reduced by 1 to a value of 24. The first route entry in each RIPv2 message would be carrying 20 bytes of authentication data. If cryptographic authentica-tion methods are used, further authentication data is placed after the entire RIPv2 mes-sage. As a single RIPv2 message can carry at most 25 route entries, the first one would be occupied by authentication data, the remaining 24 entries would carry routing informa- +tion, and the remaining authentication data would be placed after the 25th entry. +338 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +RIPv2 Next-Hop Feature and Split Horizon + +This section covers the split horizon and next-hop features of RIPv2. These two features do not typically need to be considered at the same time, but in some cases they do. + +First, Cisco IOS controls the split horizon setting per interface, using the [no] ip split-horizon interface subcommand. Split Horizon is on by default, except for cases in which Frame Relay or ATM is configured with the IP address on the physical interface. + +The RIPv2 next-hop feature allows a RIPv2 router to advertise a different next-hop router than the advertising router. Although this is not a common requirement, this little-known feature permits a RIPv2 router to point to a different next hop on the same segment +than itself, potentially eliminating an extra hop. The original motivation for the next-hop feature is described in RFC 2453 Appendix A. On Cisco routers, this feature is not con-figurable, though, and is almost unused. In fact, the only instance in which the next-hop field was seen to be set to a nonzero address is when RIPv2 is run over Non Broadcast Multiple Access (NBMA) interfaces, facilitating direct spoke-to-spoke routing (and pos-sibly causing issues if direct spoke-to-spoke communication is not available). + + +RIPv2 Offset Lists + + + +Key Topic + +RIPv2 offset lists allow RIPv2 to add to a route’s metric, either before sending an update, or for routes received in an update. The offset list refers to an ACL (standard, extended, or named) to match the routes; the router then adds the specified offset, or extra metric, to any matching routes. Any routes not matched by the offset list are unchanged. The offset list also specifies which routing updates to examine by referring to a direction (in or out) and, optionally, an interface. If the interface is omitted from the command, all +updates for the defined direction are examined. + + + +Route Filtering with Distribute Lists and Prefix Lists + + + +Key Topic + +Outbound and inbound RIPv2 updates can be filtered at any interface, or for the entire RIPv2 process. To filter the routes, the distribute-list command is used under router rip, referencing an IP ACL or an IP prefix list. Any subnets matched with a permit clause in the ACL make it through; any that match with a deny action are filtered. The distribution list filtering can be performed for either direction of flow (in or out) and, optionally, for a particular interface. If the interface option is omitted, all updates coming into or out of +the RIPv2 process are filtered. (Routes can also be filtered at redistribution points, a topic covered in Chapter 11.) + +The generic command, when creating a RIPv2 distribution list that uses an ACL, is + +distribute-list { access-list-number | name } { in | out } [interface-type interface-number] + + +A RIPv2 distribute list might refer to a prefix list instead of an ACL to match routes. Prefix lists are designed to match a range of subnets, as well as a range of subnet masks associated with the subnets. The distribute list must still define the direction of the updates to be examined (in or out), and optionally an interface. +Chapter 7: RIPv2 and RIPng 339 + +Chapter 11 includes a more complete discussion of the syntax and formatting of prefix lists; this chapter focuses on how to call and use a prefix list for RIPv2. Use of prefix lists is generally recommended. To reference a prefix list, use the following router rip subcom-mand: +distribute-list prefix prefix-list-name { in | out } [ interface-type interface-number] + + +RIPng for IPv6 + + + + + + + +Key Topic + +While RIP is in many aspects an inferior protocol to EIGRP, OSPF, or IS-IS, its simplicity nonetheless makes it suitable for small office/home office (SOHO) routers and simple net-works. Its wide adoption and support over a wide range of routers from multiple vendors prompted the creation of the IPv6 version of RIP named RIP next generation (RIPng). + +Although the name RIPng suggests major reworking, RIPng is in fact just a straightfor-ward adaptation of RIPv2 for IPv6 operation with practically no changes to underly-ing protocol mechanisms. RIPng remains a plain distance-vector protocol utilizing User Datagram Protocol (UDP) as its transport protocol, using port 521 instead of 520 to avoid clashes with existing RIPv1/RIPv2 implementations. The destination IPv6 address for multicasted RIPng messages is FF02::9. Metric is again based on hop count, with 15 +being the maximum usable metric and 16 representing infinity. RIPng differs, though, in its metric handling: The metric is incremented by the receiver of a RIPng advertisement, not by the advertisement sender anymore. All loop avoidance techniques described in previous sections are used by RIPng in precisely the same way. + +Figure 7-4 shows the RIPng message format—similar to RIPv2 messages. + + +RIPng Message + +Octet 1 Octet 2 Octet 3 Octet 4 +Command Version Must Be Zero Message Header + + +IPv6 Prefix Route Entry, as Many Entries as Permitted by Link MTU + +Route Tag Prefix Len Metric + +Figure 7-4 RIPng Message Format + +Similar to RIPv2, the RIPng message starts with a header containing a Command field (value 1 for Request, 2 for Response) and a Version field (currently set to 1). After the header, a variable number of route entries follows. The number of route entries in a RIPng message is limited only by the IPv6 MTU on the link, and the protocol itself poses no limitations on their count. Route entry fields are self-explanatory. Two facts are worth mentioning: + +■ As RIPng does not assume any multiprotocol capability, the address family ID field has been omitted. +340 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ Because the next-hop field was relatively unused in RIPv2, keeping a per-prefix next-hop field in a route entry would uselessly occupy quite a significant space (128 bits). Therefore, the next hop field—if necessary—is specified by a separate route entry containing the IPv6 next-hop address (a link-local address) in the IPv6 prefix field, the metric value set to 255, and route tag and prefix length fields set to 0. All subse-quent route entries are to be processed with this particular next hop until another next-hop route entry is encountered in the RIPng message. A route entry with the IPv6 next-hop address set to :: (all-zero) will revert to the sender of the message being the next hop. + +Authentication is not handled by RIPng anymore; rather, similar to OSPFv3, these func-tions are offloaded to IPsec. RIPng implementation in current Cisco IOS is relatively simple and lacks several features supported by RIPv2: + +■ Authentication or encryption by IPsec is not supported. + +■ Split Horizon can be activated or deactivated only on a per-process basis, not on individual interfaces. + +■ Passive interfaces are not supported. + +■ Static (manual) neighbors cannot be configured (no neighbor command). + +■ Per-process offset lists are not supported. + +Still, there are management improvements over RIPv2 implemented in the Cisco RIPng: + +■ Multiple RIPng processes can be run on a router; however, at the time of writing, at most four simultaneously running RIPng processes were supported on IOS-based routers. Individual processes are distinguished by an alphanumeric name that is local to the router and does not need to match between different routers. + +■ Route Poisoning, as an enhancement of the Split Horizon mechanism, can be acti-vated on a per-process basis. + +■ Interfaces can be configured with a metric-offset value that is added to the metric in all received advertisements over that interface, effectively allowing RIPng to operate with link costs rather than hop counts. + +■ The default route can be originated on a per-interface basis, including an option of suppressing all other updates over that interface. + +Example 7-5 shows a simple configuration of RIPng on a router with two interfaces. + +Example 7-5 Basic RIPng Configuration on a Router + +! First, IPv6 unicast routing support must be activated, and IPv6 CEF is activated +! as well + +ipv6 unicast-routing +ipv6 cef +Chapter 7: RIPv2 and RIPng 341 + +! Fa0/0 interface is connected to a stub router. Only default route needs to be ! sent. + +R1(config)# interface FastEthernet0/0 +R1(config-if)# ipv6 address 2001:DB8:1::1/64 +R1(config-if)# ipv6 rip 1 enable +R1(config-if)# ipv6 rip 1 default-information only + +! S0/0/0 interface simply connects to another router. However, the metric of this +! interface is increased to 3 from 1 + +R1(config)# interface Serial0/0/0 +R1(config-if)# ipv6 address 2001:DB8:2::1/64 +R1(config-if)# ipv6 rip 1 enable +R1(config-if)# ipv6 rip 1 metric-offset 3 + +! In global IPv6 RIPng process 1, Poison Reverse is activated and settings are +! verified afterwards using show ipv6 rip command + +R1(config)# ipv6 router rip 1 +R1(config-rtr)# poison-reverse +R1(config-rtr)# do show ipv6 rip +RIP process "1", port 521, multicast-group FF02::9, pid 246 +Administrative distance is 120. Maximum paths is 16 +Updates every 30 seconds, expire after 180 +Holddown lasts 0 seconds, garbage collect after 120 +Split horizon is on; poison reverse is on +Default routes are generated +Periodic updates 18, trigger updates 2 +Full Advertisement 2, Delayed Events 0 +Interfaces: +Serial0/0/0 +FastEthernet0/0 +Redistribution: +None +342 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 7-5 lists the protocols mentioned in this chapter and their respective standards documents. + +Table 7-5 Protocols and Standards for Chapter 7 + + +Protocol or Feature +RIPv2 (RIP version 2) + +RIPv2 Cryptographic Authentication + +RIPv2 Triggered Extensions for On-Demand Circuits + +RIPng for IPv6 + +Standard +RFC 2453 + +RFC 4822 + +RFC 2091 + +RFC 2080 + + + +Table 7-6 lists some of the most significant Cisco IOS commands related to the topics in this chapter. + +Table 7-6 Command Reference for Chapter 7 + + +Command +router rip + +network ip-address + + +[ no ] auto-summary + + + + +distribute-list [access-list-number | name | prefix name] | {in | out} +[interface-type interface-number ] + +[ no ] ip split-horizon + +ip summary-address rip address netmask + +Command Mode and Description +Global config; puts user in RIP configuration mode. +RIP config mode; defines classful network, with all interfaces in that network sending and able to receive RIP advertisements. +RIP config mode; activates or deactivates automatic network summarization on classful boundaries whenever a prefix from one major network is advertised out an interface in a different major network. +RIP config mode; defines ACL or prefix list to filter RIP updates. + +Interface mode; enables or disables split horizon. + +Interface mode; defines manual network summarization. +Chapter 7: RIPv2 and RIPng 343 + + + +Command +passive-interface [default] {interface-type interface-number} + +timers basic update invalid holddown flush +version {1 | 2} + +offset-list {access-list-number | access-list-name} {in | out} offset [interface -type interface-number] + +neighbor ip-address + +show ip route rip + +show ip rip database + + +debug ip rip + +show ip protocols + + +clear ip route {network [mask] | *} + + +show ip interface [type number ] [brief] + +key chain name-of-chain + +key key-id + +key-string string + +send-lifetime [start-time {infinite | end-time | duration seconds}] + +accept-lifetime [start-time {infinite | end-time | duration seconds}] + +ip rip authentication key-chain name-of-chain +ip rip authentication mode {text | md5} + +Command Mode and Description +RIP config mode; causes RIP to stop sending updates on the specified interface. + +RIP config mode; sets the values for RIP timers. + +RIP config mode; sets the RIP version to version 1 or version 2. +RIP config mode; defines rules for RIP to add to the metrics of particular routes. + +RIP config mode; identifies a neighbor to which unicast RIP updates will be sent. +User mode; displays all routes in the IP routing table learned by RIP. +User mode; lists all routes learned by RIP even if a route is not in the routing table because of a route with lower administrative distance. +Enable mode; displays details of RIP processing + +User mode; lists RIP timer settings, current protocol status, autosummarization actions, and update sources. +Enable mode; clears the routing table entry, and with RIP, sends RIP requests, quickly rebuilding the routing table. +User mode; lists many interface settings, including split horizon. +Global config; defines name of key chain for routing protocol authentication. +Key config mode; identifies a key by number. + +Key config mode; defines the text of the key. + +Key config mode; defines when the key is valid to be used for sent updates. + +Key config mode; defines when the key is valid for received updates. + +Interface mode; enables RIPv2 authentication on the interface. + +Interface mode; defines RIPv2 authentication as clear text (default) or MD5. +344 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +ipv6 router rip word + + +distribute-list prefix name { in | out} [interface-type interface-number ] +split-horizon + +poison-reverse + + + +port port multicast-group group + + + + +timers update timeout holddown garbage-collection + + + + + + + +ipv6 rip word enable + + + +ipv6 rip word default-information { only | originate } [ metric metric ] + +ipv6 rip word metric-offset offset + + +ipv6 rip word summary-address ipv6-prefix/prefix-length + +Command Mode and Description +Global config; puts user in RIPng configuration mode. The word is the name of the RIPng instance. +RIPng config mode; defines an IPv6 prefix list to filter RIPng updates. + +RIPng config mode; activates simple Split Horizon. +RIPng config mode; activates Split Horizon with Poisoned Reverse. If both split-horizon and poison-reverse are configured, poison-reverse takes precedence. +RIPng config mode; defines the UDP port and multicast address to send and listen for RIPng packets. Used if multiple processes are to communicate over a single interface, as multiple processes cannot listen on the same UDP port. +RIPng config mode; defines the RIPng timers. Update is the time between RIPng update messages, Timeout is equivalent to the Invalid after timer, Holddown is the hold down timer, and the Garbage Collection timer is similar to Flushed after with a notable difference: The Garbage Collection timer starts only after the Timeout timer expired. The default values of these timers are 30, 180, 0, 120, respectively. +Interface mode; activates a RIPng instance identified by the word on the interface. All unicast prefixes of this interface except the link-local address will be advertised by RIPng. +Interface mode; advertises the default route out the interface. If the only keyword is used, all other prefixes are suppressed. +Interface mode; defines the offset by which the metric in received RIPng updates is incremented. By default, the offset value is 1. +Interface mode; defines manual prefix summarization. +Chapter 7: RIPv2 and RIPng 345 + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +Holddown timer, Invalid after timer, Flushed after timer, authentication, Update timer, triggered updates, flash updates, split horizon, route poisoning, poison reverse, counting to infinity, hello interval, full update, partial update, Route Tag field, Next Hop field, Triggered Extensions to RIPv2 for On-Demand Circuits, MD5, offset list, prefix list, distribution list, distance vector, metric +Refer to the glossary to check your answers. + + +Further Reading + +This chapter focuses on TCP/IP protocols; much more information can be found in the RFCs mentioned throughout the chapter. + +The RIP RFCs listed in Table 7-5 provide good references for RIPv2 concepts. + +Jeff Doyle’s Routing TCP/IP, Volume I, Second Edition (Cisco Press), has several excel-lent configuration examples and provides a complete explanation of RIPv2 concepts. + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Describe Packet Types + +■ Implement and Troubleshoot Neighbor Relationship + +■ Implement and Troubleshoot Loop-Free Path Selection + +■ Implement and Troubleshoot Operations + +■ Implement and Troubleshoot EIGRP Stub + +■ Implement and Troubleshoot Load Balancing + +■ Implement EIGRP Named Mode + +■ Implement, Troubleshoot, and Optimize EIGRP Convergence and Scalability +CHAPTER 8 + + + + + + +EIGRP + + +This chapter covers most of the features, concepts, and commands related to Enhanced Interior Gateway Routing Protocol (EIGRP). Chapter 11, “IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting,” covers a few other details of EIGRP—in particular, route redistribution, route filtering when redistributing, and route summarization. + +“Do I Know This Already?” Quiz + +Table 8-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 8-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +EIGRP Metrics, Packets, and Adjacencies + +Diffusing Update Algorithm + +EIGRP Named Mode + +Additional and Advanced EIGRP Features + +Total Score + +Questions Covered in This Section Score +1–11 + +12–25 + +26 + +27–31 + + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. Which of the following items are true of EIGRP? + +a. Authentication can be done using MD5 or clear text. + +b. Uses UDP port 88. + +c. Sends full or partial updates as needed. + +d. Multicasts updates to 224.0.0.10 or FF02::A. +348 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +2. What classic metric components can be used by EIGRP for metric computation and best path selection? + +a. Bandwidth + +b. Cost + +c. Delay + +d. Hop count + +e. Load + +f. Expense + +g. MTU + +h. Reliability + +3. Which of the following accurately describe the manipulation with the component metrics? + +a. Reliability is maximized. + +b. Delay is summed. + +c. Load is minimized. + +d. Reliability is minimized. + +e. Bandwidth is summed. + +f. Load is maximized. + +g. Bandwidth is minimized. + +4. Which statement is true regarding EIGRP’s use of Reliability and Load metric com-ponents on regular interfaces such as Ethernet or PPP? + +a. EIGRP sends updates and recalculates the composite metric immediately whenever the Reliability and Load values on an interface change, regardless of K-value settings. +b. EIGRP sends updates and recalculates the composite metric immediately whenever the Reliability and Load values on an interface change but only when K-values are configured to take these components into account. +c. EIGRP samples the Reliability and Load in regular intervals and sends updates along with recalculating the composite metric when the sampled Reliability and Load values change. +d. EIGRP takes a snapshot of the interface Reliability and Load values in the moment of advertising a network, but changes to their values do not trigger sending further updates. +Chapter 8: EIGRP 349 + +5. What are the shortcomings solved by Wide Metrics? + +a. Gradual loss of resolution caused by repetitive descaling and scaling of Bandwidth and Delay components in integer arithmetics + +b. Inability to use Reliability and Load without incurring routing table instabilities + +c. Loss of resolution for interfaces with speeds over 1 Gbps + +d. Inability to extend the metrics with additional future factors + +6. What are the component metrics used in Wide Metrics that can be used for best path selection? + +a. Throughput + +b. Latency + +c. Reliability + +d. Load + +e. MTU + +f. Hop Count + +g. Extended Metrics + +7. Which of the following EIGRP packets are considered reliable packets? + +a. Hello + +b. Ack + +c. Update + +d. Query + +e. Reply + +f. SIA-Query + +g. SIA-Reply + +8. Which of the following EIGRP packets can be sent as multicasts? + +a. Hello + +b. Ack + +c. Update + +d. Query + +e. Reply + +f. SIA-Query + +g. SIA-Reply +350 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +9. Which statements are true about Hello packets? + +a. Hello packets must be confirmed. + +b. Hello packets sent by a router contain a list of all detected neighbors on the interface. + +c. Hello packets are usually sent as multicasts. + +d. Default interval between Hello packets is 5 seconds on all interfaces. + +e. Hello packets do not contain routing information. + +10. Which EIGRP packet types are acknowledged? + +a. Hello + +b. Ack + +c. Update + +d. Query + +e. Reply + +f. SIA-Query + +g. SIA-Reply + +11. Which EIGRP packet types can themselves act as acknowledgments? + +a. Hello + +b. Ack + +c. Update + +d. Query + +e. Reply + +f. SIA-Query + +g. SIA-Reply + +12. What is the Computed Distance for a destination? + +a. The current total distance to the destination computed over a particular neigh-bor router + +b. The lowest known distance to the destination since the last time the destination transitioned from Active to Passive state + +c. The current distance of a particular neighbor to the destination + +d. The lowest known distance of a particular neighbor to the destination since the last time the destination transitioned from Active to Passive state +Chapter 8: EIGRP 351 + +13. How many Computed Distances for a destination exist? + +a. Only one, not bound to any particular neighbor + +b. One per each neighbor that advertises the destination + +c. One per each Successor + +d. One per each Feasible Successor + +14. What is the Reported Distance for a destination? + +a. The current total distance to the destination computed over a particular neigh-bor router + +b. The lowest known distance to the destination since the last time the destination transitioned from Active to Passive state + +c. The current distance of a particular neighbor to the destination + +d. The lowest known distance of a particular neighbor to the destination since the last time the destination transitioned from Active to Passive state + +15. How many Reported Distances for a destination exist? + +a. Only one, not bound to any particular neighbor + +b. One per each neighbor that advertises the destination + +c. One per each Successor + +d. One per each Feasible Successor + +16. What is the Feasible Distance for a destination? + +a. The current total distance to the destination computed over a particular neigh-bor router + +b. The lowest known distance to the destination since the last time the destination transitioned from Active to Passive state + +c. The current distance of a particular neighbor to the destination + +d. The lowest known distance of a particular neighbor to the destination since the last time the destination transitioned from Active to Passive state + +17. How many Feasible Distances for a destination exist? + +a. Only one, not bound to any particular neighbor + +b. One per each neighbor that advertises the destination + +c. One per each Successor + +d. One per each Feasible Successor +352 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +18. Which statement correctly constitutes the Feasibility Condition in EIGRP? + +a. The neighbor must be closer to the destination than I have ever been since the last time the destination became Passive. + +b. The neighbor must be closer to the destination than I am. + +c. The neighbor must be farther from the destination than I am. + +d. The neighbor must be farther from the destination than I have ever been. + +19. What statements correctly apply to a Successor? + +a. It is a route over a particular neighbor. + +b. It is a particular neighbor. + +c. It must provide a loop-free path. + +d. The Computed Distance over the Successor must be the lowest available. + +e. The Computed Distance over the Successor does not need to be the lowest available. + +f. In a connected network, there is always at least one Successor to a destination. + +20. What statements correctly apply to a Feasible Successor? + +a. It is a route over a particular neighbor. + +b. It is a particular neighbor. + +c. It must provide a loop-free path. + +d. The Computed Distance over the Feasible Successor must be the lowest available. + +e. The Computed Distance over the Feasible Successor does not need to be the lowest available. + +f. There is always at least one Feasible Successor to a destination. + +21. What is a local computation? + +a. The process of local processing of all received Updates and Replies + +b. The process of reevaluating and possibly changing a next hop to a destination locally that does not require the router to send Queries and wait for Replies before making its own decision +c. The process of computing the composite metric from individual components + +d. The process of coordinating a change in the next hop to a destination by send-ing out Queries and waiting for Replies before making its own next-hop selection +Chapter 8: EIGRP 353 + +22. What is a diffusing computation? + +a. The process of local processing of all received Updates and Replies + +b. The process of reevaluating and possibly changing a next hop to a destination locally that does not require the router to send Queries and wait for Replies before making its own decision +c. The process of computing the composite metric from individual components + +d. The process of coordinating a change in the next hop to a destination by send-ing out Queries and waiting for Replies before making its own next-hop selection +23. Is the following statement true? “If a router has a Feasible Successor for a destina-tion identified in its topology table, it will always be used in place of the current Successor if the Successor fails.” +a. Yes + +b. No + +24. How long at most will a diffusing computation run by default on a router before being terminated forcibly? + +a. Indefinitely + +b. 3 minutes + +c. 3 minutes if the SIA-Query and SIA-Reply messages are not supported; 6 min-utes if the SIA-Query and SIA-Reply are supported + +d. 15 seconds + +25. What are some of the factors contributing to the occurrence of SIA states? + +a. The use of route filtering and summarization + +b. Excessive redundancy in the network + +c. The use of the EIGRP Stub feature + +d. Excessive network diameter + +e. Large amount of routing information + +f. The use of the EIGRP Add-Path feature +354 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +26. What statements are true about running EIGRP Named Mode? + +a. Verbal names of EIGRP processes on neighboring routers must match for the routers to establish adjacencies. + +b. Multiple autonomous system instances for a single address family can be run in a single EIGRP named process. + +c. Multiple autonomous system instances for different address families can be run in a single EIGRP named process. + +d. Both classic and named mode can be used on a router as long as they do not conflict on the address family and the autonomous system number. + +e. The use of named mode still permits that per-interface commands can be applied to interfaces to maintain backward compatibility. + +f. The named mode contains a superset of all commands from the classic mode. + +27. What statements are true about EIGRP RID? + +a. EIGRP has no concept of a RID. + +b. The RID is equal to the autonomous system number. + +c. The RID is advertised with all external and, in recent IOS releases, also with all internal routes. + +d. The RID indicates the immediate neighbor advertising a route. + +e. The RID indicates the originator of the routing information. + +28. What statements are true about unequal cost load balancing in EIGRP? + +a. Feasible Successors are required for this feature. + +b. Multiple unequal cost paths can be advertised by a router to its neighbors. + +c. Each unequal-cost path will be assigned a share of traffic in inverse proportion to how many times worse it is than the current best path. + +d. EIGRP allows using any worse-cost path as long as the neighbor advertising this path is closer to the destination than this router. + +29. What statements are true about the EIGRP Stub Router feature? + +a. No Queries are sent by a stub router. + +b. No Queries are usually sent to a stub router. + +c. All Queries sent to a stub router are responded to by Replies indicating unreach-ability. + +d. Depending on what routes the stub router is allowed to advertise, some Queries can be responded to normally while others will elicit a Reply indicating unreach-ability. +e. Neighbors of a stub router must be configured to treat that router as a stub. + +f. A router is capable of advertising itself as a stub. +Chapter 8: EIGRP 355 + +30. What statements are true about EIGRP authentication? + +a. In recent IOS versions, SHA-2 with 256-bit digests is supported. + +b. MD5 digest is always supported. + +c. Key chains or passwords can be used for SHA-2 authentication. + +d. Key chains or passwords can be used for MD5 authentication. + +e. IPv6 EIGRP uses IPsec for authentication purposes. + +31. What of the following are true regarding the default route injection into EIGRP? + +a. The network 0.0.0.0 command is the preferred way of injecting the default route into EIGRP. + +b. A default route can be injected into EIGRP by redistribution. + +c. A default route can be injected into EIGRP by summarization. + +d. Neighbors of stub routers send a default route to stub routers automatically. +356 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Foundation Topics + + +EIGRP Basics and Evolution + +Many CCIE candidates have already learned the majority of the details of EIGRP opera-tion and configuration. Because of its former proprietary nature, however, there are many misconceptions and misunderstandings about various fundamental details of EIGRP operation. With that in mind, this chapter strives to review the key terms and concepts in depth, and then get to specific examples that detail EIGRP operation on a Cisco router. + +It is noteworthy to mention that in 2013, Cisco decided to open up the EIGRP specifica-tion and publish it as an IETF Internet Draft, a precursor to an RFC; the document name is draft-savage-eigrp. Basic EIGRP is thus no longer a closed, proprietary protocol. An open source EIGRP implementation based on the Quagga routing platform already exists and is being actively developed. + +Table 8-2 lists the selected key features related to EIGRP. + + + +Table 8-2 + +Feature +Transport + + +Metric + + +EIGRP Feature Summary + +Description +IP, protocol type 88 (does not use UDP or TCP). Implements its own Reliable Transport Protocol, providing reliable unicast and multicast packet delivery. +Based on constrained bandwidth and cumulative delay by default, and optionally load reliability, and extended metrics. + + + +Hello interval + +Hold timer + + +Update destination address + +Full or partial updates + +Authentication + +VLSM/classless + +Route Tags + +Next-hop field + +Interval at which a router sends EIGRP Hello messages on an interface. +Timer used to determine when a neighboring router has failed, based on a router not receiving any EIGRP messages, including Hellos, in this timer period. +Normally sent to 224.0.0.10 or FF02::A, with retransmissions being sent to each neighbor’s unicast IP address. +Full updates are used when new neighbors are discovered; otherwise, partial updates are used. +Supports MD5 and SHA-based authentication. + +EIGRP includes the mask with each route, also allowing it to support discontiguous networks and VLSM. +Enables EIGRP to tag and filter internal and external routes using distribute-lists and route-maps. +Supports the advertisement of routes with a different next-hop router than the advertising router. +Chapter 8: EIGRP 357 + + + +Feature +Manual route summarization + +Multiprotocol + +Description +Allows route summarization at any point in the EIGRP network. +Supports the advertisement of IPv4 and IPv6. Former implementations also supported IPX and AppleTalk routes. + + + + +EIGRP Roots: Interior Gateway Routing Protocol + +To understand EIGRP roots better, we start our discussion with a brief look into the past, focusing on a dead protocol that was an immediate predecessor to EIGRP. + +In the mid-1980s, Cisco developed the Interior Gateway Routing Protocol (IGRP), an alternative protocol to Routing Information Protocol version 1 (RIPv1). The most signifi-cant goal was to eliminate RIP’s working but naïve hop count metric and the hop network diameter limitation of 15 hops. IGRP relied on a composite metric made up of a variety of route variables and even went so far as to provide a way for the weighting of specific variables over others so that the protocol could reflect the specific characteristics and needs of a diverse array of networks. + +Benefits that IGRP offered over RIP included + +■ Wider network diameter, up to 255 hops + +■ Complex multivariate metric + +■ Unequal-cost load sharing + +■ An update period of 90 seconds, three times longer than RIP’s + +■ A more efficient update packet format + +IGRP was designed to interoperate with multiple routed protocols including IPv4, ISO Connectionless Network Protocol (CLNP), Novell IPX, or AppleTalk. Like RIP, IGRP broadcasted a Request packet out all IGRP-enabled interfaces at startup and performed a sanity check on received Update packets to verify that the source address of the packet belonged to the same subnet on which the Update was received. Update packets them-selves were sent periodically each 90 seconds. + +IGRP was also like RIPv1 in that it was a classful distance-vector protocol that periodically broadcasted its entire gathered knowledge. The protocol also relied on Split Horizon, trig-gered updates, Invalid after, and Holddown and Flushed after timers for functional stability; IGRP summarized advertised addresses at network boundaries. + +Overall, IGRP was better than RIP for larger networks but it still had many of the funda-mental limitations found in RIP that had an adverse impact on its scalability and speed of convergence. +358 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Moving from IGRP to Enhanced IGRP + +Most significant IGRP weaknesses and detractors include + +■ Sending full routing updates periodically + +■ The lack of variable-length subnet mask (VLSM) support + +■ Slow convergence + +■ The lack of adequate loop-prevention mechanisms + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + +Key Topic + +Making changes to the metric calculation did not remove the fundamental shortcomings of the basic distance-vector routing protocol paradigm; a new approach was necessary. + +To address these specific issues, Cisco created an “Enhanced” version of IGRP. Enhanced Interior Gateway Routing Protocol (EIGRP) is a protocol that is significantly more capa-ble than its predecessor, containing numerous improvements over IGRP. In fact, EIGRP +is so much different that simply calling it an “Enhanced IGRP” is somewhat of an under-statement. There is in fact very little left of the original IGRP in EIGRP—even though EIGRP still is a distance-vector routing protocol, albeit an advanced one. + +IGRP was based on timers, and similarly to RIP, it advertised its entire database of known networks on each Update interval expiry. In both RIP and IGRP, the periodic origination of Update packets served multiple purposes: detecting neighbors, verifying their continu-ous presence, learning new routes, and refreshing or withdrawing existing learned routes. In fact, these periodic Updates provide two separate and unrelated functions—first, detecting neighbors and their liveliness, and second, carrying routing information. To allow EIGRP to become an incremental, event-based protocol, it was first necessary to decouple building and maintaining adjacencies from exchanging routing information. The first task is accomplished in EIGRP by using a Hello protocol. Thanks to the Hello proto-col, it is no longer necessary to periodically send Update packets to announce a router’s continuous presence on a network; instead, the Hello protocol takes over this responsibil-ity. EIGRP routers use the Hello protocol to build and maintain neighbor adjacencies in +a way that’s similar to Open Shortest Path First (OSPF) and other protocols. The Hello protocol keeps the periodic nature of former Update packets without carrying the rout-ing information. + +To advertise routing information whenever there is a change, without requiring routers to advertise it periodically, EIGRP implements the Reliable Transport Protocol (RTP; do not confuse it with the Real-time Transport Protocol, which is a different and unre-lated protocol used in media-streaming applications), a Layer 3–independent transport +protocol capable of reliable unicast and multicast delivery. The use of RTP allows routers to initially exchange the complete routing information when synchronizing for the first time, and afterward, advertise changed routes only. RTP makes sure that all updates—if any—are delivered reliably. The lack of updates therefore does not indicate a connectivity issue but rather simply a stable network state in which the routing information does not change. The use of Hellos to establish and maintain router adjacencies and RTP to carry all updates reliably allows EIGRP to completely abandon the periodic updating process +and operate in an event-driven, incremental fashion. +Chapter 8: EIGRP 359 + + + +Key Topic + + + + + + + +Key Topic + + + + + + + + + + + + + +Key Topic + +IGRP as a distance-vector routing protocol was prone to the creation of temporary rout-ing loops during network convergence. To maintain a loop-free operation at every instant, EIGRP uses a so-called Feasibility Condition criterion to identify neighbors, providing guaranteed loop-free paths to a given destination. This criterion allows an EIGRP router to avoid forwarding packets to a neighbor that could, even possibly, form a routing loop. Considering the fact that EIGRP is still a distance-vector protocol and carries the same detail of information about the network as IGRP in its messages, the importance of the Feasibility Condition is paramount. + +Another important addition working in tandem with the Feasibility Condition is the use of the so-called diffusing computations. Under circumstances, a router detecting a topology change can be adversely affected by this change, meaning that the Feasibility Condition can cause its neighbor providing the current least-cost path to be considered ineligible. In this case, an EIGRP router can actively query all its neighbors to update their own best-path selection with respect to the topology change that triggered this event, and reply with their updated distances. Neighbors that are not adversely affected will simply respond right away with a (possibly updated) distance; neighbors that are +adversely affected will propagate the query further and can respond only after receiving all replies and making a choice themselves. In a sense, the task of searching for a replace-ment path to a destination diffuses into the affected part of the network, hence the name diffusing computations. This way, EIGRP actively involves the affected part of the net-work into updating the best-path selection in a highly coordinated manner. The use of diffusing computations is at the core of EIGRP’s rapid convergence. + +To handle multiple topology changes during a single diffusing computation, EIGRP implements a finite state machine called Diffusing Update Algorithm (DUAL) that con-trols the run of a diffusing computation, processing the replies and eventually inserting the gathered information into the routing table or commencing an additional diffusing computation. The DUAL is not the diffusing computation algorithm itself; it is a control mechanism on top of diffusing computations that decides when it is necessary to start a diffusing computation and how the results should be processed. + +EIGRP was designed as a successive version of IGRP to allow for an easy migration path. While the mechanisms used in IGRP and EIGRP strongly differ, many of the ideas that worked very well for IGRP were applied to EIGRP. As an example, EIGRP has a default hop-count limitation of 100; however, this value can be manually adjusted using the com- +mand illustrated in Example 8-1. + + +Example 8-1 Adjusting Hop-Count Limitation + +Router(config-router)# metric maximum-hops ? +<1-255> Hop count + +Another area of similarity is the choice of metric components. EIGRP basically reuses the metric computation first used by IGRP, including the component metrics of bandwidth, delay, and optionally reliability and load. This similarity will be discussed in further detail in the upcoming sections. +360 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +EIGRP makes a distinction between internal and external routes. Internal routes are those injected into EIGRP by the network command. External routes are redistributed into EIGRP from a different routing source. EIGRP internal and external routes can be distin-guished within the routing table by their default administrative distance (AD). Internal prefixes will have an AD of 90, and external will be 170 by default. Example 8-2 demon-strates how these default values can be changed under the routing protocol. + +Example 8-2 Adjusting Administrative Distance Based on Route Type + +Router(config-router)# distance eigrp ? +<1-255> Distance for internal routes +Router(config-router)# distance eigrp 90 ? +<1-255> Distance for external routes +Router(config-router)# distance eigrp 90 100 + +After this fleeting overview of what enhancements EIGRP has over other distance-vector routing protocols, it is time to take an even closer look at the protocol’s operation and features. + +EIGRP Metrics, Packets, and Adjacencies + +Many people are tempted to overlook or browse past this type of content. Reading through a topic that appears to be all too familiar can be tiring at first, but we nonethe-less encourage you to read the following sections very carefully. There are lots of hidden details about EIGRP that we have strived to uncover. Also, it will make concepts like fil-tration, summarization, and stub routing (to name a few) easier for you to understand. + +EIGRP Classic Metrics + +EIGRP uses several types of metrics, also called component metrics or metric compo-nents, to describe selected technical properties of a route. These component metrics are bandwidth, delay, reliability, load, MTU, and hop count. Out of these six components, the first four are combined together using a well-known formula to produce a single num-ber that we will call the composite metric or, where there is no risk of confusion, sim- +ply as metric, distance, or cost. This single composite metric is then used by EIGRP to choose the best path toward a destination. Originally, the idea of combining several tech-nical measures of a route into a single number came in IGRP that strived to be “smarter” than RIP and cover more properties of a route in a single metric value. When EIGRP was developed, to serve as a drop-in replacement for IGRP, it retook its system of metric cal-culation. + +The component metrics as described in this section are also called Classic Metrics and are the standard set of metrics supported by all current EIGRP implementations. EIGRP shipped with recent IOS versions also supports so-called Wide Metrics, which expand the allowable range of existing Classic Metrics. These Wide Metrics will be described in the next section. +Chapter 8: EIGRP 361 + +Let us now have a closer look at the individual Classic Metric components and how EIGRP uses them. + +Bandwidth Metric Component +Key +Topic The bandwidth is a static metric assigned to each router interface using the bandwidth +interface level command. The meaning of this metric component is obvious: It describes the transmission speed of an interface. The bandwidth command expresses the interface bandwidth in terms of kilobits per second. If no bandwidth command is configured explicitly, IOS assigns an implicit bandwidth value to each interface, depending on its hardware type and operational characteristics. With selected interface types, as with Ethernet interfaces, the implicit bandwidth value reflects the true speed negotiated by the interface with its link partner. On other interface types, the value has no realistic rela-tion to the interface capabilities (common with Serial or Tunnel interfaces, for example). + +When calculating the composite metric to a destination, EIGRP takes the minimal band-width along the route into account. This is done by comparing the bandwidth as adver-tised by a neighboring router to the bandwidth of the interface toward the advertising neighbor, and taking the lower value of these two. + +With Classic Metrics, EIGRP is capable of describing the bandwidth in the range of 1 kbps up to 10 Gbps. + +Delay Metric Component +Key +Topic The delay is a static metric assigned to each interface using the delay interface command. +This metric component estimates the serialization delay incurred by the interface. Of course, in real life, the serialization delay would depend both on the interface transmis-sion speed as well as the serialized packet’s size. Being a static value not related to any true characteristic of an interface, the delay metric component of an interface can be seen more like an average delay incurred by the interface for typical traffic. + +The delay command expresses the delay in somewhat inconvenient units—tens of micro-seconds. Configuring a delay of 123 on an interface defines its delay to be 1230 micro-seconds. The show interface command output already reports interface delay directly in microseconds. This difference between the units used in show interface output and in the delay command is subtle but significant. The show interface output will always display a value ten times higher than the configured value. If the delay is not configured explicitly, IOS assigns an implicit delay value to each interface, depending on the interface hardware type. + +When calculating the composite metric to a destination, EIGRP takes the total delay into account. This is done by taking the delay as advertised by a neighboring router and sum-ming it with the delay of the interface toward the advertising neighbor. + +With Classic Metrics, EIGRP is capable of describing the delay in the range of 10 to 167,772,140 microseconds (1 to 16,777,214 tens of microseconds). A delay of 16,777,215 tens of microseconds is used to indicate an infinite distance and is the key to the abil- +ity of advertising an unreachable network. Split Horizon with Poisoned Reverse, Route +362 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Poisoning, withdrawing a route—all these techniques in EIGRP use the maximum delay as an indication of an unreachable route. + +Reliability Metric Component Key +Topic The reliability is a dynamically estimated metric of an interface that evaluates its reliabil-ity, or the ratio between the count of successfully received and the count of all received frames. This ratio is expressed as a fraction of 255. To illustrate, a reliability of 255 expresses a 100 percent reliability, a reliability of 230 expresses a 90 percent reliability, and a reliability of 26 expresses a 10 percent reliability. The reliability metric is dynami-cally updated by IOS. +When calculating the composite metric to a destination, EIGRP takes the minimal reli-ability into account. This is done by comparing the reliability as advertised by a neigh-boring router to the reliability of the interface toward the advertising neighbor, and taking the lower value of these two. + +There is an important fact regarding the EIGRP’s handling of reliability metric. While EIGRP does advertise the information about the path reliability and optionally factors it into the composite metric (this depends on K-value settings described later in this section), EIGRP does not send updates when an interface’s reliability changes. In other +words, a change in interface reliability value does not trigger sending EIGRP updates. The reliability metric of a route is just a snapshot of its then-current reliability when it was last advertised. + +To understand this, recall that EIGRP metrics are retaken from IGRP, which was a timer-driven protocol. EIGRP, on the other hand, is an event-driven protocol. If the reliability metric change was a trigger event for EIGRP, it could potentially induce a routing table oscillation into the network, bringing the traffic on and off the unreliable link and aggra-vating the swings in the reliability metric more and more, creating a feedback loop. In fact, the reliability metric component was retaken into EIGRP primarily to facilitate the smooth transition from IGRP. As a result, in EIGRP, the reliability metric component is currently just a relic carried over from its predecessor, with no particular usability. + +Key Load Metric Component +Topic The load is a dynamically estimated metric of an interface that measures the amount of +traffic flowing through the interface in relation to its maximum capacity. Similar to reli-ability, the load is also expressed as a fraction of 255, with the load of 1 representing an empty interface and the load of 255 representing a fully utilized interface. To account for large differences in the momentary load caused by bursty traffic, IOS actually computes an exponentially weighted average over the momentary load that smooths out short-lived load swings. Because an interface can be differently utilized in the ingress and egress data flow direction, IOS maintains two independent load metric counters, the Txload for outgoing traffic and Rxload for incoming traffic. +Chapter 8: EIGRP 363 + +When calculating the composite metric to a destination, EIGRP takes the maximal Txload into account. This is done by comparing the load as advertised by a neighbor-ing router to the Txload of the interface toward the advertising neighbor, and taking the higher value of these two. + +EIGRP’s handling of the load metric component is the same as with reliability: While advertised and optionally factored into the composite metric, the changes in the Txload values on interfaces do not trigger EIGRP updates. The load metric of a route is just a snapshot of its then-current load when it was last advertised. The load, along with the reliability, is a relic from IGRP with no particular usability in EIGRP. + +MTU Metric Component Key +Topic There is widespread confusion regarding the maximum transmission unit (MTU) metric component in EIGRP and its use. Similar to bandwidth and reliability, EIGRP advertises the minimum MTU along the route to the destination. However, even though carried in EIGRP messages, the MTU is completely unused in the best-path selection process. It is not factored into the composite metric, nor is it used as any kind of a tiebreaker. Simply put, the use of the MTU in EIGRP’s best-path selection algorithm has never been imple-mented. + +Hop Count Metric Component +Key +Topic The hop count metric component is simply a counter of routers (hops) in the path toward +the destination. It is just a fallback security measure: EIGRP routers can be configured to advertise each route having its hop count over a predefined threshold as unreachable, +thereby breaking any potential routing loops. By default, this limit is 100, and can be con-figured in the range of 1 to 255. The hop count is not factored into the composite metric calculation and does not impact the best-path selection in any way. + +Calculating the Composite Metric + +Because EIGRP treats each metric component differently (delay is summed, bandwidth and reliability are minimized, load is maximized), EIGRP routers exchange these compo-nent metrics as separate values. To arrive at a single composite metric value, each router must independently compute the resulting composite metric on its own. This composite metric is used locally on a router, and is never advertised as a single number in EIGRP messages. The only exception to this rule is when a route is redistributed from one EIGRP process to another. Even in this case, however, the composite metric of the redistributed route is retaken only for diagnostic purposes and carried separately from the seed com-ponent metrics specified in the redistribute command that activates the redistribution and defines the starting component metrics for redistributed routes. + +Using the bandwidth, delay, reliability, and load, each EIGRP router computes a compos-ite metric value using the formula shown in Figure 8-1. +364 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +CM = K1 • BWs 1 K2 • + +BWs 256 2 LoMax + + +1 K3 • Ds • + + +K5 +K4 1 RMin + + + + + +BWs = + +256 • 107 +BandwidthMin + + +Ds = 256 • DelaySummed + +Figure 8-1 Classic Composite Metric Computation Formula + +The constants K1 through K5, commonly called K-values, are weight constants in the range 0–255 that can be tweaked to influence the impact of individual metric components on the +overall composite metric. It is crucial that all EIGRP routers in an autonomous system com-pute the composite metric in the same way. Therefore, K-values on all routers must match. If K-values on two neighboring routers differ, the routers will be unable to establish an adja- +cency. By default, K1 and K3 are set to 1, and all other K-values are set to 0, causing EIGRP to take only bandwidth and delay into account. If K5 is 0 (which it is by default), the entire term in the right parentheses, that is, K5/(K4 + RMin), is not used in the metric computation. +The BWScaled term is in effect telling how many times the minimal bandwidth along the path is smaller than a 107-Kbps = 10-Gbps link, multiplied by 256. The DScaled term is a sum of all interface delays along the path to the destination in tens of microseconds, mul- +tiplied by 256. The multiplication by 256 in both terms is the result of expanding the for- +mer IGRP 24-bit metric into a 32-bit metric used by EIGRP. The remaining terms—LoMax standing for maximum load and R Min standing for minimum reliability—are taken without further modification. + +Note once again that neither MTU nor hop count is a part of the composite metric for-mula. The hop count only causes a route reaching the predefined hop count limit to be advertised as unreachable; the MTU is unused. Neither of these metric components influ-ences the choice of best path. + +Key EIGRP Wide Metrics +Topic With the speeds of interfaces ever increasing, the EIGRP Classic Metrics faced issues +with interfaces faster than 1 Gbps. The Bandwidth component itself is unable to differen-tiate between a 10-Gbps and faster interfaces. In addition, the default Delay component metric is already set to the lowest value of 1 (10 microseconds) on 1-Gbps interfaces +and cannot be made smaller on faster interfaces. Also, the bandwidth and delay metric components are carried in EIGRP packets in their scaled form. This requires each router +to descale them first to obtain the BandwidthMin and DelaySummed values to perform the necessary minimization of bandwidth and summing the delay, and then scale them again +when computing the composite metric and advertising the route to its neighbors. Because Cisco routers perform integer arithmetic, the round-off errors during this repetitive scal-ing and descaling can introduce a gradual loss of resolution. + +These reasons prompted EIGRP developers to design an improved set of metrics that allow for a greater range of key parameters and that are carried in EIGRP packets in their +Chapter 8: EIGRP 365 + +raw form, avoiding the loss of precision. These metrics are amply named Wide Metrics. To see whether your router supports Wide Metrics, check out the output of selected show eigrp commands, as shown in Example 8-3. + +Example 8-3 Confirming the Presence of EIGRP Wide Metrics Support + +! In the show eigrp plugins command output, check whether the version +! of eigrp-release plugin is at least 8.00.00. In this output, +! the eigrp-release plugin is of version 12.00.00. + +Router# show eigrp plugins +EIGRP feature plugins::: + +eigrp-release + +parser +igrp2 + +: 12.00.00 : Portable EIGRP Release +: 2.00.09 : Source Component Release(rel12) +: 2.02.00 : EIGRP Parser Support +: 2.00.00 : Reliable Transport/Dual Database + +[ ... output omitted ... ] + +! Alternatively, check out the output of show eigrp tech-support command +! and look for Wide Metrics support claimed explicitly + +Router# show eigrp tech-support +EIGRP feature plugins::: + +eigrp-release + + +parser +igrp2 + +: 12.00.00 : Portable EIGRP Release +: 2.00.09 : Source Component Release(rel12) ++ HMAC-SHA-256 Authentication +: 2.02.00 : EIGRP Parser Support +: 2.00.00 : Reliable Transport/Dual Database ++ Wide Metrics + +[ ... output omitted ... ] + +! Yet another easy way of detecting the support of Wide Metrics is the +! show ip protocols output. Note the presence of the K6 constant, +! the rib-scale of 128 and 64-bit metric version – all these indicate +! that Wide Metrics are supported. + +Router# show ip protocols +Routing Protocol is "eigrp 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP-IPv4 VR(Test) Address-Family Protocol for AS(1) +Metric weight K1=0, K2=0, K3=1, K4=0, K5=0 K6=0 +Metric rib-scale 128 +Metric version 64bit +[ ... output omitted ... ] +366 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +With Wide Metrics, the general philosophy of EIGRP metrics is maintained; however, the metric components whose range has been extended carry a new name to distinguish them from their classic counterparts. + +EIGRP Wide Metrics consist of following components: + + +■ Key +Topic + + +■ + +Throughput: This metric is analogous to the classic Bandwidth component. The throughput metric of an interface is calculated as 65536´107/Interface Bandwidth, with the interface bandwidth expressed in kbps. The throughput component effec-tively tells how many times slower the interface is than a 655.36-Tbps link. + +Latency: This metric is analogous to the classic Delay component. The latency metric of an interface is calculated as 65536´Interface Delay/106, with the interface delay expressed in picoseconds. Because the delay metrics have sensible defaults only on interfaces with physical bandwidths up to 1 Gbps, the computation of per-interface delay metric differs based on its physical capability and configuration, +making it somewhat counterintuitive. + + +■ On interfaces physically operating on speeds of 1 Gbps and lower without band-width and delay commands, the interface delay is simply its IOS-based default delay converted to picoseconds. +■ On interfaces physically operating on speeds over 1 Gbps without bandwidth and delay commands, the interface delay is computed as 1013 / interface default bandwidth. +■ On interfaces configured with the explicit bandwidth command and without the delay command, regardless of their physical operating speed, the interface delay is the IOS-based default delay converted to picoseconds. +■ On interfaces configured with explicit delay command, regardless of their physi-cal operating speed and the bandwidth setting, the interface delay is computed as its specified delay value converted to picoseconds, that is, 107´value of the delay command (recall that the delay command defines the delay in tens of microseconds). +■ Reliability: This metric is identical to the classic Reliability component and has not changed in Wide Metrics. + +■ Load: This metric is identical to the classic Load metric component and has not changed in Wide Metrics. + +■ MTU: This metric is identical to the classic MTU metric component, and just like in Classic Metrics, it is advertised but unused. + +■ Hop Count: This metric is identical to the classic Hop Count metric component, and just like in Classic Metrics, it is advertised but unused in path selection; it only pre-vents potential routing loops. + +■ Extended Metrics: These metric components are considered as placeholders for future extensions to the composite metric computation. As of this writing, three extended metrics were defined: Jitter, Energy, and Quiescent Energy. To incorporate +Chapter 8: EIGRP 367 + +these components into the composite metric, the K6 constant was introduced. These metric components are not usually used or supported. + +Using the throughput, latency, reliability, load, and extended metrics, each EIGRP router computes a wide composite metric value using the formula shown in Figure 8-2. + + + +WM = K1 • TMin 1 K2 • + +1 K6 • ExtM • + +TMin +256 2 LoMax +K5 +K4 1 RMin + + +1 K3 • LaSummed + + + + +TMin = + +65536 • 107 +BandwidthMin + + + + +LaSummed = S + +65536 • DelayInterface +106 + +DefaultDelayInterface [picosec] for interfaces ≤ 1 Gbps +or where bandwidth is configured, + + +DelayInterface = 1013 DefaultBandwidthInterface + +107 • ConfiguredDelayInterface + + +for interfaces > 1 Gbps, + + +where delay is configured + + +Figure 8-2 Wide Composite Metric Computation Formula + + + + + + + + + + + + + + + + + +Key Topic + +In this formula, TMin is the throughput computed using the least bandwidth along the path to the destination, LaSummed is the sum of latencies for each interface along the path to the destination, LoMax is the maximum load on the path, RMin is the minimum reliabil-ity on the path, and ExtM are the extended metrics. + +The Wide Metric support is available when EIGRP is configured in named mode as described later in the chapter, and is automatically activated—there is no command to control the activation of Wide Metrics. EIGRP routers supporting Wide Metrics auto-matically detect whether their neighbors also support Wide Metrics, and use the appro-priate metric type when talking to them. Wide Metrics are preferred; if all neighbors on an interface support Wide Metrics, they will be used automatically instead of Classic Metrics. In the case of mixed neighbors on a common interface, EIGRP routers support-ing Wide Metrics will use both metric formats in their messages, allowing each neighbor to process the metric format it supports. + +Because the Wide Metrics composite value can well result in a number wider than 32 bits while the routing table (Routing Information Base, RIB) is capable of handling only 32-bit metrics, the Wide Metrics composite value has to be downscaled before the route +can be passed down to the RIB in IOS. This is done by dividing the Wide Metrics +368 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +composite value by a factor configured in the metric rib-scale EIGRP command. The default value is 128 and can be configured in the range 1–255. Note that this downscaled value is not used by EIGRP in any way. EIGRP makes all its path selections based on the Wide Metrics composite value; only after a best path toward a destination is selected, its composite metric value is downscaled as the route is installed to the RIB. + +Key Tweaking Interface Metrics to Influence Path Selection +Topic As should be obvious from the discussion about EIGRP metric components so far, the +only EIGRP metric components that can be manually influenced are the Bandwidth and Delay. It might be tempting to use the bandwidth command to force EIGRP to use or not to use a particular path. The answer to this idea, however, is a resolute and resounding no. Following is an adapted quotation from the public EIGRP Internet Draft document draft-savage-eigrp that considers this issue to be grave enough to warrant a special mention: + +When trying to manually influence EIGRP path selection through interface band-width/delay configuration, the modification of bandwidth is discouraged for follow-ing reasons: + +■ The change will only affect the path selection if the configured value is the low-est bandwidth over the entire path. Changing the bandwidth can have impact beyond affecting the EIGRP metrics. For example, quality of service (QoS) also looks at the bandwidth on an interface. + +■ EIGRP by default throttles to use 50 percent of the configured bandwidth. Lowering the bandwidth can cause problems like starving EIGRP neighbors from getting packets because of the throttling back. Configuring an excessively high bandwidth can lead EIGRP to consume more bandwidth than physically avail-able, leading to packet drops. + +■ Changing the delay does not impact other protocols nor does it cause EIGRP to throttle back, and because, as it’s the sum of all delays, has a direct effect on path selection. + +In other words, the bandwidth parameter of an interface should always be configured to the true bandwidth of the interface and should never be used to influence EIGRP’s path selection. Instead, the delay is a parameter that has absolutely no impact on any other IOS subsystem and even to EIGRP; it constitutes only a constant to be summed together with the existing path delay to compute the total path delay. Being the only cumulative parameter in EIGRP’s metric computation, the delay is the right metric that can be manu-ally modified to affect the best-path selection. + +EIGRP Packet Format + +EIGRP packets are carried directly in IP packets, using protocol number 88. The maxi-mum length of an EIGRP packet is derived from the maximum IP MTU on the particu-lar interface—typically 1500 bytes for the entire IP packet, leaving 1480 bytes for the EIGRP packet itself. +Chapter 8: EIGRP 369 + + + +Key Topic + +Figure 8-3 and Table 8-3 explain the generic format of an EIGRP packet. Each EIGRP packet carries a 20-byte header, followed by a variably sized body indicated in Figure +8-3 as TLVs, standing for Type-Length-Value triplets. These TLVs carry diverse informa-tion including EIGRP and TLV versions, K-values, Hold timers, control information to facilitate reliable multicasting, and most importantly, route reachability information. With respect to RTP, there is no clearly delineated RTP header. Instead, the Flags, Sequence number, and Acknowledgment number fields are the ones that provide most of the RTP functionality in EIGRP; some others are implemented using specific TLVs. With a certain degree of simplification, the entire EIGRP packet header can also be considered an RTP +header. + + +32 Bit + + +VERSION=2 OPCODE CHECKSUM +FLAGS +SEQUENCE NUMBER +ACKNOWLEDGMENT NUMBER + +VIRTUAL ROUTER ID AUTONOMOUS SYSTEM NUMBER + +TLVs +… +… + +… + +Figure 8-3 Basic EIGRP Packet Format + + + +Table 8-3 + +Field + + +EIGRP Packet Format Details + +Description + + + +Version Field + + +Opcode + + + + +Checksum + +Flags + +4-bit field used to indicate the protocol version of the originating EIGRP process. The version of the EIGRP protocol itself has not changed since its release and is set to 2. +4-bit field that specifies the EIGRP packet type. Relevant types are 1 = Update, 3 = Query, 4 = Reply, 5 = Hello/Ack, 10 = SIA Query, 11 = SIA Reply. Other types have been allocated for different, mostly unimplemented purposes, or are obsolete; only the indicated packet types are used. +24-bit field that is used to run a sanity check on the EIGRP packet. This field is based on the entire EIGRP packet excluding the IP header. +32-bit field indicating specific flags: 0x1 = Init (used during initial adjacency buildup), 0x2 = Conditional Receive (used by RTP to allow this message to be received only by a subset of receivers), 0x4 = Restart (indicates that a router has restarted), 0x8 = End-of-Table (indicates that the transmission of the entire EIGRP database is complete). +370 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Field Sequence + +Acknowledgment + + + + + +Virtual Router ID + + + +Autonomous System Number +Type-Length-Value + +Description +32-bit field that contains a sequence number used by RTP. This facilitates orderly delivery of reliable packets. +32-bit field used by RTP that contains the sequence number of the last packet heard from the neighbor to which this packet is being sent. A Hello packet with a nonzero ACK field will be treated as an ACK packet rather than as a Hello. Note that an ACK field will only be nonzero if the packet itself is unicast because acknowledgments are never multicasted. +16-bit field identifying the virtual router this packet is associated with. Currently used values are 0x1 = Unicast Address Family, 0x2 = Multicast Address Family, 0x8000 = Unicast Service Address Family (in Service Advertisement Framework). +16-bit field that identifies the number of the EIGRP domain. + +Field used to carry route entries as well as provide EIGRP DUAL information. EIGRP supports several different types of TLVs: + +0x0001 EIGRP Parameters (General TLV Types) + +0x0002 Authentication Type (General TLV Types) + +0x0003 Sequence (General TLV Types) + +0x0004 Software Version (General TLV Types) + +0x0005 Next Multicast Sequence (General TLV Types) + +0x0102 IPv4 Internal Routes (IP-Specific TLV Types ) + +0x0103 IPv4 External Routes (IP-Specific TLV Types ) + +0x0402 IPv6 Internal Routes (IP-Specific TLV Types ) + +0x0403 IPv6 External Routes (IP-Specific TLV Types ) + +0x0602 Multi Protocol Internal Routes (AFI-Specific TLV Types ) + +0x0603 Multi Protocol External Routes (AFI-Specific TLV Types ) + + + +TLVs (Type-Length-Values) are a particular format of storing and transmitting different types of information in a single datagram; each TLV contains a particular piece of infor-mation that the sender wants to advertise. TLVs are not only found within EIGRP packets; they are also common in other protocols like IS-IS, CDP, and LLDP as well. + +As the name suggests, TLVs are formatted as triplets containing Type, Length, and Value fields. The Type and Length fields are fixed in size (typically 1–4 bytes), and the Value field is of variable size. + +■ Type: A numeric code that indicates the kind of information stored in the Value field. +Chapter 8: EIGRP 371 + +■ Length: The total size of Type, Length, and Value fields. Note that some other pro-tocols (not EIGRP) store only the length of the Value field in the Length. + +■ Value: Variable-sized series of bytes that contain the actual information. + +Each Internal and External Route TLV contains a single route entry. The Update, Query, Reply, SIA-Query, and SIA-Reply packets contain at least one such TLV to advertise a particular network or to query for it. The list, or the array (the vector), of Internal and External Route TLVs in these packets is what constitutes the distance-vector nature of EIGRP. Each TLV advertises a particular network and a distance toward it, with multiple TLVs constituting a vector of such distances. + +Details about the format and use of individual TLVs in EIGRP can be found in the EIGRP Internet Draft published on the Internet Engineering Task Force (IETF) web page, at the time of this writing named draft-savage-eigrp . + +EIGRP Packets + +EIGRP uses seven different packet types when communicating with its neighboring routers: + +■ Hello packets + +■ Acknowledgment packets + +■ Update packets + +■ Query packets + +■ Reply packets + +■ SIA-Query packets + +■ SIA-Reply packets + +The Update, Query, Reply, SIA-Query, and SIA-Reply packets are also called reliable packets because EIGRP makes sure that they are all delivered and in proper order. + +EIGRP Packets in Action + +Statistics about all sent and received EIGRP packets can be obtained using the show ip eigrp traffic command, as illustrated in Example 8-4. + +Example 8-4 EIGRP Traffic Counters + +R1# show ip eigrp traffic +EIGRP-IPv4 VR(CCIE) Address-Family Traffic Statistics for AS(1) +Hellos sent/received: 1132/6090 +Updates sent/received: 169/428 +Queries sent/received: 0/0 +Replies sent/received: 0/0 +Acks sent/received: 74/191 +372 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +SIA-Queries sent/received: 0/0 +SIA-Replies sent/received: 0/0 +Hello Process ID: 246 +PDM Process ID: 244 +Socket Queue: 0/10000/7/0 (current/max/highest/drops) +Input Queue: 0/2000/7/0 (current/max/highest/drops) + +The sections that follow describe all these packets in more detail. + + + + +Key Topic + + + + + + + + + + + + +Key Topic + + + + + + + + + +Key Topic + +Hello Packets + +EIGRP sends periodic Hello packets once it has been enabled on a router for a particu-lar interface. These Hello messages are used to identify neighbors, verify whether these neighbors are compatibly configured (residing on a common IP subnet, using the same AS number, K-values, and authentication if configured), and serve as a keepalive mecha-nism between neighbors. EIGRP Hello packets are sent to the link-local multicast group address 224.0.0.10 in IPv4, and FF02::A in IPv6. If static neighbors are configured, Hello packets are sent as unicasts to the neighbor’s explicitly configured address. The default Hello interval is 5 seconds; on NBMA interfaces with the bandwidth setting of 1544 kbps and less, the default Hello interval is 60 seconds. EIGRP Hello packets have an Opcode of 5 and are not acknowledged. + +Acknowledgment Packets + +An EIGRP Acknowledgment (ACK) packet is used to acknowledge selected received EIGRP packets to facilitate their reliable delivery. ACKs are sent in response to Update, Query, Reply, SIA-Query, and SIA-Reply packets, and are always unicasted to the sender of the acknowledged packet. With respect to the packet format, EIGRP ACK is essen-tially a Hello packet with an empty body (that is, no TLVs), carrying only the common EIGRP packet header as shown in Figure 8-3, and having a non-zero Acknowledgment number field whose value is set to the Sequence number of the reliable packet being acknowledged. The ACK uses the same Opcode as the Hello packet, that is, 5. + +Note in Figure 8-3 that the header of each EIGRP packet carries an Acknowledgment number field. In EIGRP, it is allowed to use any unicast reliable packet to also carry an acknowledgment number. If a router has both a unicast reliable packet to send to a +neighbor and also needs to acknowledge a previously received reliable packet from that neighbor, the sequence number of the received reliable packet can be sent along with the outbound reliable packet in its Acknowledgment number field. It is not necessary to send a standalone ACK in this case; the unicast reliable packet carrying a nonzero Acknowledgment number field will be processed by its recipient both by its true type and as an ACK. + +EIGRP’s use of the Acknowledgment number field is very similar to that of TCP: After a TCP session is established, each TCP segment can both contain data in its payload and +carry an acknowledgment in its Acknowledgment number header field. If a sender of a +Chapter 8: EIGRP 373 + +TCP segment has any data to send to its peer, it will send it along with the acknowledg-ment of the last received octet (plus 1). If there is no data to be sent to the peer, only a TCP segment header with an empty body is sent, carrying the proper acknowledgment. In EIGRP, it is quite the same: If both an ACK and a reliable packet are waiting to be sent to the same neighbor, EIGRP can put the acknowledgment number into the reliable pack-et’s Acknowledgment number field, saving the need to send a standalone ACK. If there is no reliable packet waiting to be sent to a neighbor, just an acknowledgment is outstand-ing, EIGRP chooses the packet type for which it makes most sense to have an empty body, which is obviously a Hello packet, to carry the acknowledgment number, hence the standalone ACK—in reality a Hello with no TLVs and just its Acknowledgment number field set. Noting that the ACK essentially consists of just the EIGRP packet header, the similarity to TCP’s use of segment headers with empty payloads to carry acknowledg-ments is striking. + +Keep in mind that out of reliable packets, only those that are unicasted can be also used to carry acknowledgment numbers. It would not make sense to put acknowledgment numbers into multicast reliable packets as they are received by multiple routers while the acknowledgment is itself always relevant only to a single packet from a single neighbor. + +Update Packets +Key +Topic EIGRP Update packets contain routing information updates and are used to convey the +reachability of destinations. Update packets can be both unicasted and multicasted. Regarding the use of multicast or unicast to send Update packets, the rules can be sum-marized as follows: + +■ During a new adjacency buildup, Update packets are unicasted between the newly discovered neighbors. In specific cases, when multiple new neighbors are detected on a single multiaccess interface in a short time span, EIGRP might choose to syn-chronize to them using multicasts for efficiency reasons (for example, when a hub router in a Dynamic Multipoint VPN [DMVPN] network starts and detects tens or hundreds of spoke routers). Details on the choice process of unicast or multicast Update packets during adjacency buildup are proprietary. The particular choice only impacts the efficiency of the initial synchronization process, and has no influence on the actual contents of exchanged information. + +■ After routers have fully synchronized, further Updates are sent as multicasts. + +■ If a neighbor does not acknowledge the arrival of an Update packet, EIGRP will retransmit the Update as unicast to the unresponsive neighbor. + +■ On point-to-point interfaces and for statically configured neighbors, EIGRP always uses unicast to send Updates. + +Update packets are delivered reliably, meaning that they are always acknowledged and retransmitted if no acknowledgment is heard in a certain time. Update packets are assigned an Opcode of 1. +374 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Key Query Packet +Topic EIGRP Query packets are used to involve neighbors in the task of searching for the best +route toward a destination. Similarly to Updates, Queries are also delivered reliably. Queries can be both unicasted and multicasted; by default, on multiaccess interfaces with only dynamic neighbors, Queries are sent as multicasts. If not acknowledged in proper time by a neighbor, a Query is retransmitted to the unresponsive neighbor as unicast. On point-to-point interfaces and toward statically configured neighbors, Queries are always sent as unicasts. Note that while each received Query must be acknowledged by send- +ing an ACK, this ACK does not constitute a response to the Query message, only an acknowledgment that the Query has been received. The following packet type, the Reply, is used for that purpose. EIGRP Query packets are assigned an Opcode of 3. + +Key Reply Packets +Topic EIGRP Reply packets are sent in response to Query packets and carry their sender’s +current distance to the destination after taking into account the topology change that prompted the Query. Reply packets are always unicasted to the originator of the Query and delivered reliably. The EIGRP Reply packets are assigned an Opcode of 4. + +Key SIA-Query and SIA-Reply Packets +Topic These two packet types are used during a prolonged diffusing computation to verify +whether a neighbor that has not yet sent a Reply to a Query is truly reachable and still engaged in the corresponding diffusing computation. The SIA-Query packet is used to ask a particular neighbor to confirm that it is still working on the original Query. If the neighbor is reachable and is still engaged in the diffusing computation for the destination specified in the SIA-Query, it will immediately respond with an SIA-Reply packet. As a result, the timer that governs the maximum time a diffusing computation is allowed to run is reset, giving the computation extra time to finish. Both SIA-Query and SIA-Reply packets are unicast and reliably delivered. SIA-Query uses an Opcode of 10, and SIA-Reply uses an Opcode of 11. + +Key Reliable Transport Protocol +Topic The Reliable Transport Protocol (RTP) manages the delivery and reception of EIGRP +packets. Reliable delivery means that delivery is guaranteed and that packets will be delivered in order. This is accomplished by means of a Cisco-invented algorithm known as reliable multicast. Packet types that are to be delivered reliably are Update, Query, Reply, SIA-Query, and SIA-Reply, regardless of whether they are unicasted or multi-casted (SIA-Query, Reply, and SIA-Reply are only unicasted, of course). Each of these packets carries a nonzero Sequence number in its header. The Sequence number is a global value maintained per each EIGRP process instance on a router and is incremented whenever one of these packets is originated by the instance, regardless of which EIGRP-enabled interface the packet is going to be sent from. Each neighbor receiving an Update, Query, Reply, SIA-Query, or SIA-Reply is required to send back an ACK packet with the +Chapter 8: EIGRP 375 + +Acknowledgment number set to the Sequence number of the packet to be acknowledged. A neighbor can also acknowledge a reliable packet by “piggybacking” the acknowledg-ment onto its own reliable packet (if it has any to send to this router) by appropriately set-ting the Acknowledgment number field in the packet’s header, as explained earlier in the “Acknowledgment Packets” section. If an acknowledgment is not received within a certain time period, the packet is retransmitted as unicast to the unresponsive neighbor. + +Packets that are not to be delivered reliably (Hello and ACK packets) set their Sequence number to zero and do not cause the global Sequence number to increase. + +With a naïve reliable multicast, each recipient of a multicasted message must acknowl-edge its arrival before the sender can move on to transmit another message. If some recip-ient does not acknowledge the message, the sender has to postpone further sending of multicast packets and retransmit the missing message to the intended recipient as unicast until the recipient successfully acknowledges its arrival. Obviously, a single misbehaving, overloaded, or poorly connected recipient can negatively impact the performance of the entire reliable multicast streaming. A natural solution would be to continue sending the multicast packets while, in parallel, retransmitting the unacknowledged and subsequent delayed packets in their proper order to the “lagging” recipient as unicasts to allow it to eventually catch up. This poses a problem, however: The lagging neighbor is still a mem-ber of the multicast group, and if it by chance received the next multicast packet without first receiving the packet it has missed before, it would be processing the streamed mes-sages out of correct order. + +To cope with this situation, RTP has an additional distinctive feature called Conditional Receive. This feature allows EIGRP to partition all its neighbors on a multiaccess interface into two groups: a group of well-behaved neighbors that have been able to acknowledge all multicast messages sent so far and a group of “lagging” routers that have failed to acknowledge at least one transmitted reliable EIGRP packet and that must be handled individually. If EIGRP wants to continue sending the multicast packets in parallel with retransmitting the unacknowledged packets to the lagging routers as unicasts, it has to send the in-order multicast packets with a special flag saying “this packet is only for those routers that have received all multicast packets so far.” + +This is accomplished by the sender first transmitting a Hello packet with two specific TLVs called the Sequence TLV and the Next Multicast Sequence TLV, often called a Sequenced Hello. The Next Multicast Sequence TLV contains the upcoming sequence number of the next reliable multicasted message. The Sequence TLV contains a list of all lagging neighbors by their IP address, in effect saying “whoever finds himself in this +list, ignore the next multicast message with the indicated sequence number.” A neighbor receiving this Sequenced Hello packet and not finding itself in the Sequence TLV will know that it is expected to receive the upcoming multicast packet, and will put itself into a so-called Conditional Receive mode (CR-mode). A neighbor receiving this Sequenced Hello packet and finding itself in the Sequence TLV, or a neighbor not receiving this Hello packet at all for whatever reason will not put itself into the CR-mode. Afterward, the sending router will send the next multicast packet with the CR flag set in its Flags field. Routers in CR-mode will process this packet as usual and then exit the CR-mode; routers not in CR-mode will ignore it. As a result, the router is able to continue using multicast +376 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +with those routers that have no issues receiving and acknowledging it, while making sure that the lagging neighbors won’t process the multicasts until they are able to catch up. Each lagging neighbor that has not acknowledged one or more multicast packets will be sent these packets as unicasts in their proper sequence. + +The time to wait for an ACK before declaring a neighbor as lagging and switching from multicast to unicast is specified by the multicast flow timer. The time between the sub-sequent unicasts is specified by the retransmission timeout (RTO). Both the multicast flow timer and the RTO are calculated for each neighbor from the smooth round-trip time (SRTT). The SRTT is the average elapsed time, measured in milliseconds, between the transmission of a reliable packet to the neighbor and the receipt of an acknowledg-ment. The formulas for calculating the exact values of the SRTT, the RTO, and the multi-cast flow timer are beyond the scope of this book. + + + + + + + + + + + + + + + +Key Topic + +Router Adjacencies + +EIGRP routers establish and maintain neighbor adjacencies. EIGRP by default discovers neighboring routers dynamically, or it can discover neighbors through manual administra-tor configuration (static). + +Dynamic neighbor discovery is performed by sending EIGRP Hello packets to the desti-nation multicast group address 224.0.0.10 or FF02::A. This is performed as soon as EIGRP is activated on an interface. Static EIGRP neighbor relationships require manual neighbor configuration on the router. When static EIGRP neighbors are configured, the local router uses the unicast neighbor address to send packets to these routers. You would typically use static neighbor configuration when being deployed across media that does not native-ly support broadcast or multicast packets, such as Frame Relay. + +After a static neighbor is defined, all EIGRP multicasts on the interface through which the neighbor is reachable will be disabled. As a result, EIGRP-enabled routers will not establish an adjacency if one router is configured to use unicast (static) while another uses multicast (dynamic) on the same link. Here’s another way of putting this rule: Either all neighbors on a common network segment are statically configured for each other, or none of them are. + +It is important to understand that simply enabling EIGRP between two or more routers does not guarantee that a neighbor relationship will be established. An EIGRP neighbor +relationship requires that neighbors agree on all the following parameters: + + +■ EIGRP Authentication Parameters (if configured) +Key +Topic ■ EIGRP K-Values + +■ EIGRP Autonomous System (AS) Number + +■ Use of primary addresses for EIGRP neighbor relationships + +■ Use of the common IP network address on a single subnet + +If two routers differ in any of these parameters, they will not become EIGRP neighbors. +Chapter 8: EIGRP 377 + +Note that the timers (that is, Hello and Hold) do not need to match between neighbors. The default Hello interval (60 seconds on nonbroadcast multiaccess [NBMA] interfaces with the configured bandwidth equal to T1 or slower, and 5 seconds on all other inter-faces) can be changed with the interface command illustrated in Example 8-5. + +Example 8-5 Adjusting EIGRP Hello Intervals + +Router(config-if)# ip hello-interval eigrp 100 ? +<1-65535> Seconds between hello transmissions + +The Hold time tells the router the maximum time it should wait to receive subsequent valid EIGRP packets from a neighbor. If the Hold timer expires before any acceptable EIGRP packet is received, the neighbor is declared unreachable and DUAL is informed of the loss of a neighbor. By default, the Hold time is three times the Hello, equaling either 15 or 180 seconds, depending on the interface type. Be aware, however, that changing the Hello interval does not result in automatic recalculation of the Hold time. This can, under certain circumstances, result in problems with flapping adjacencies if the Hello interval +is manually configured to be close or even higher than the default Hold time, without changing the Hold timer itself. + +As detailed in Example 8-6, these defaults can be changed at the interface level. + +Example 8-6 Adjusting EIGRP Hold Time + +Router(config-if)# ip hold-time eigrp 100 ? +<1-65535> Seconds before neighbor is considered down + +The process of establishing adjacency in EIGRP is illustrated in Figure 8-4. + + + +R1 +Hello + + +Hello +R1 Puts R2 to Pending + +R2 + +R2 Puts R1 to Pending + + + + +Init Received from R2 + + + + +Ack Received from R2 R1 Puts R2 to Up + +Null Update with Init, Seq=x + +Null Update with Init, Seq=y, Ack=x + +Acknowledgment, Ack=y + + + + +Init and Ack Received from R1 R2 Puts R1 to Up + + +Database Synchronization Using Updates and Acks + + +Figure 8-4 Adjacency Creation Between EIGRP Neighbors +378 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + + + + + + + + + + + + + + + + + + + +Key Topic + + + + + + +Key Topic + +The process starts by a router discovering its new neighbor by receiving a Hello packet from it. In Figure 8-4, R2 receives a Hello packet from R1. R2 will expedite sending its own Hello packet onto the interface, allowing R1 to quickly discover it as well. As soon as a new neighbor is discovered through a Hello packet, it is put into a so-called Pending state. The purpose of this Pending state is to defer sending and accepting any EIGRP mes-sages containing routing information between these neighbors until their bidirectional connectivity has been confirmed. + +Continuing the process, R2 sends R1 an empty Update packet, also called a null Update, with the Init flag set. This null Update carries a nonzero sequence number but contains no routing information. The Init flag is an indication to the neighbor that this adjacency is starting over from scratch and the neighbor is requested to send its full database after the bidirectional visibility is confirmed. R1 is required to acknowledge the arrival of this null Update, thereby confirming the bidirectional connectivity, and it must also send R2 its own null Update packet with the Init flag set, acknowledging that the neighbor also considers this adjacency to be starting over from scratch. R2 finally acknowledges R1’s null Update, completing the initial exchange. The acknowledgments in this procedure can either be sent as standalone ACK packets, or they can be carried in the null Update pack-ets by setting the Acknowledgment Number field in their header to the sequence number of the other router’s null Update packet—either of these options is valid. + +While in Pending state, the only packets that can be exchanged in both directions with the neighbor are the unreliable packets (Hello, Ack) and reliable packets with the Init flag set that indicate the startup of an adjacency. In addition, because the bidirectional con-nectivity with a neighbor in the Pending state has not yet been confirmed, it makes no sense to send or process reliable packets containing meaningful routing information. As a result, the only sensible reliable packet that can be exchanged with a neighbor in the Pending state is exactly the null Update packet. + +A neighbor is moved from the Pending to the Up state if and only if it acknowledges the null Update received from the router and sends its own null Update with the Init flag set to this router (in any order). In other words, the router must receive an acknowledgment for its own null Update to the neighbor and must receive an Init-flagged packet from the neighbor to move the neighbor from the Pending to the Up state. In a sense, this proce-dure can be likened to the process of opening a TCP session. The Init flag is similar to the SYN flag in TCP. The first null Update+Init from R2 toward R1 is similar to a TCP SYN segment, R1’s null Update+Init with the piggybacked acknowledgment is similar to a TCP SYN/ACK segment, and R2’s Ack packet confirming the R1’s null Update+Init is similar to a TCP ACK segment. + +After this initial three-way handshake, the routers will exchange complete routing infor-mation using Update packets. After the synchronization is completed, EIGRP neighbors will send only incremental updates to advise neighbors of status or routing changes and will not send their full databases again unless restarted or resynchronization is manually invoked. + +Information about each neighbor is recorded in a neighbor table. To see the contents of the neighbor table, use the show ip eigrp neighbors command in accordance with +Example 8-7. +Chapter 8: EIGRP 379 + +Example 8-7 EIGRP Neighbor Table + +R1# show ip eigrp neighbors +IP-EIGRP neighbors for process 1 +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +1 10.10.10.3 Fa0/0 11 00:00:08 87 522 0 6 +0 10.10.10.2 Fa0/0 14 00:01:54 1300 5000 0 3 + +The neighbor table records information about each detected neighbor with whom this router has established an adjacency. The H (Handle) column shows the internal number that EIGRP assigns to each neighbor. The handle number is used in EIGRP to internally identify neighbors in an address-family independent way. The Address and Interface col-umns hold the neighbor’s IP address and this router’s interface toward the neighbor. The Hold time is derived from the value advertised by the neighbor and decremented each second; it is reset every time any acceptable EIGRP packet from the neighbor is received. The Uptime shows the time the neighbor has been up for the last time. + +The SRTT, the Smooth Round Trip Time, estimates the turnover time between sending a reliable packet to the neighbor and receiving an appropriate acknowledgment. The RTO, or Retransmit Time Out, is the time that the router will wait for an acknowledgment of a retransmitted unicast packet after its previous delivery was not acknowledged. If the RTO expires before an ACK is received, another copy of the queued packet is sent. Both these timers are shown in milliseconds. + +The Q Cnt indicates the number of enqueued reliable packets, that is, packets that have been prepared for sending and even possibly sent but for which no ACK has been +received yet from the neighbor. In a stable network, the Q Cnt value must be zero; non-zero values are normal during initial router database synchronization or during network convergence. If the Q Cnt value remains nonzero for prolonged periods of time, however, it indicates a communication problem with the neighbor. + +Finally, the Sequence number shows the sequence number of the last reliable packet (Update, Query, Reply, SIA-Query, or SIA-Reply) received from the neighbor. RTP tracks these sequence numbers to ensure that reliable packets from the neighbor are processed in ascending order. Note that the Sequence number in EIGRP is a per-process variable incremented each time a new reliable packet is originated and transmitted. If a neighbor is involved in a reliable communication on one of its interfaces and then needs to send another reliable packet to this router, the sequence number in this column might incre-ment by more than 1. It is thus normal to see sequence numbers increasing by different increments as long as they form an ascending series. + +Table 8-4 summarizes the fields you see in the neighbor table. +380 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Table 8-4 + +Field +H + +Address + +Interface + +Hold + +Uptime + +SRTT + +RTO + + +Q Cnt + +Seq Num + + +EIGRP Neighbor Table Columns + +Description +Internal reference to a neighbor, also called a neighbor handle, starting at 0. + +The IP address of the neighbor. + +The interface toward the neighbor. + +The Hold timer for the neighbor. If it decreases to 0, the neighbor is considered down. +Timer for how long the neighbor relationship has been up. + +This is the Smooth Round Trip Time, which is the time it takes to send a reliable EIGRP packet and receive an acknowledgment. +This is the Retransmission Time Out, which is the amount of time the router will wait between retransmitting an EIGRP reliable packet if an Ack is not received. +This is the number of EIGRP reliable packets sent and waiting to be sent to the neighbor but not acknowledged yet. +This is the sequence number of the last EIGRP reliable packet received from the neighbor. This is to ensure that packets from the neighbor are processed in the correct order. + + + + +Diffusing Update Algorithm + +The Diffusing Update Algorithm (DUAL) is a convergence algorithm that replaces the Bellman-Ford algorithm used by other distance-vector protocols. Routing loops, even those that might come into existence temporarily as our protocols fully converge, are det-rimental to the performance of a network. To prevent the possibility of loop formation, DUAL uses a concept of diffusing computations to perform distributed shortest-path computation while maintaining freedom from loops during those calculations. DUAL is at the center of the EIGRP routing protocol. + +Topology Table + +The central data store of an EIGRP process is the topology table. The choice of this name is perhaps not particularly fortunate, as EIGRP, being a distance-vector routing pro-tocol, has no information about the network’s topology per se. Nonetheless, the topology table is the place where EIGRP stores its entire routing information including + +■ The prefix of each known destination network (address/netmask) +Key +Topic ■ Feasible Distance of the destination network + +■ Address of each neighboring router that advertised the destination network, includ-ing the egress interface toward the neighbor +Chapter 8: EIGRP 381 + +■ Metrics of the destination network as advertised by each neighbor, and the resulting metrics of the path to the destination network through that neighbor + +■ State of the destination network + +■ Additional information about the network (various internal flags, network type and origin, and others) + +The topology table is populated and updated by locally injected networks (directly connected interfaces added to EIGRP, routes redistributed locally) and by contents of received EIGRP Update, Query, Reply, SIA-Query, and SIA-Reply messages. For each remote network learned through EIGRP and stored in the topology table, EIGRP will look up the neighbor that provides the least total cost path to the destination and verify that the neighbor provides a loop-free path, and if so, install the network through that neighbor into the routing table. An important fact to remember is that a remote network must first be present in the topology table before being installed in the routing table. + +Each network recorded in the topology table has a state associated with it. This state can be either Passive, meaning that the shortest path to the network has already been +found and EIGRP is satisfied with it, or it can be Active, meaning that EIGRP is currently actively involved in a search for a new shortest path. In a stable topology, all routes shall be in the Passive state. The Active state is always related to the router sending Query packets, asking its neighbors for cooperation in the search for a new path. While in an Active state, the router is prohibited from modifying the routing table entry for this net-work, meaning that the route must not be removed or its next hop changed. The Active state can be successfully terminated only by this router receiving a Reply from all its neighbors. Only then can the route enter the Passive state again and the router can make a new shortest-path selection, finally updating the routing table. As already stated, EIGRP is designed to avoid routing loops at every instant. Keeping the formerly usable (and +loop-free) route unchanged in the routing table during the Active state makes sure that the router stays with the former route—it might be suboptimal or cause traffic blackhol-ing but is still loop-free. After the computation terminates, the router can choose a new loop-free best path and start using it. EIGRP essentially behaves in a transactional way, always moving from a loop-free path to another loop-free path, with no intermediary states of transient routing loops ever possible. The exact rules of entering the Active state will be explained later in the “Local and Diffusing Computations in EIGRP” section; at this point, they can be summarized as follows: + +■ Whenever a router needs to select a new shortest path and the neighbor providing that path can be proven not to create a routing loop, the route stays in the Passive state because the router already has all the information to make a correct choice. + +■ If the neighbor providing the least-cost path can be guaranteed not to create a rout-ing loop, or if no such neighbor exists, the route will need to enter the Active state. + +Example 8-8 shows the contents of an EIGRP topology table of a router. Outputs in this example were taken from Router R1 shown in Figure 8-5 in the following section. This network runs IPv6 EIGRP, with the serial links between R1 and all other routers config-ured using only IPv6 link-local addresses in the form of FE80::. The +382 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +LAN at the right side of Figure 8-5 is configured as a passive network (R2, R3, and R4 have their interfaces into the LAN configured as passive; hence, no EIGRP adjacencies are established over it), and it is assigned a global IPv6 prefix of 2001:DB8:CC1E::/64. R4 also redistributes a static route toward 2001:DB8:FFFF::/48 into EIGRP. To simplify met-ric calculations, EIGRP in this network is configured to take only the delay metric com-ponent into account (K3=1, all other K-values are set to 0). Delays on individual interfaces are configured to the values shown in the figure. IPv6 is chosen for this example because it allows operating this network with most interconnections configured with link-local addresses only. This makes the outputs of various show and debug commands much more readable. Also, for simplicity, this example was created on routers using the Classic Metrics. Keep in mind that EIGRP multiplies the calculated classic metric by 256. Take care to read the comments in the example carefully. + +Key Example 8-8 EIGRP Topology Table Contents +Topic ! The show ipv6 eigrp topology output shows the AS number of the EIGRP process, +! its Router ID, and the collected knowledge of all networks locally injected +! into EIGRP or learned from other EIGRP neighbors. Towards 2001:DB8:CC1E::/64, +! only next hops FE80::2 (R2) and FE80::3 (R3) are displayed, as R4 currently +! does not meet the Feasibility Condition to be considered a prospective next hop. +! The show ipv6 eigrp topology is one of very few commands in EIGRP that actually +! shows the Router ID of the EIGRP process. + +R1# show ipv6 eigrp topology +IPv6-EIGRP Topology Table for AS(1)/ID(10.255.255.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:FFFF::/48, 1 successors, FD is 1024 +via FE80::4 (1024/1), Serial1/2 +P 2001:DB8:CC1E::/64, 1 successors, FD is 2560 +via FE80::2 (2560/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 + +! Using the all-links keyword, all neighbors advertising a network, including +! those who fail to meet the Feasibility Condition check, are displayed. +! The reason there is just a single neighbor for the 2001:DB8:FFFF::/48 +! displayed even with all-links is the Split Horizon with Poisoned Reverse +! used by EIGRP. As routers R2 and R3 are using R1 as their next hop towards +! 2001:DB8:FFFF::/48, they advertise it back to R1 with an infinite metric. + +R1# show ipv6 eigrp topology all-links +IPv6-EIGRP Topology Table for AS(1)/ID(10.255.255.1) +Chapter 8: EIGRP 383 + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:FFFF::/48, 1 successors, FD is 1024, serno 3 +via FE80::4 (1024/1), Serial1/2 +P 2001:DB8:CC1E::/64, 1 successors, FD is 2560, serno 2 +via FE80::2 (2560/256), Serial1/0 +via FE80::4 (4096/3072), Serial1/2 +via FE80::3 (5120/1280), Serial1/1 + +! By referencing a particular network, detailed information about it can be +! displayed. Notice the individual information stored about the network: +! State, Number of Successors, Feasible Distance, per-neighbor information +! covering the route type, individual metric components of the path over +! the neighbor, and resulting composite calculated metrics. + +R1# show ipv6 eigrp topology 2001:DB8:CC1E::/64 +IPv6-EIGRP (AS 1): Topology entry for 2001:DB8:CC1E::/64 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2560 +Routing Descriptor Blocks: +FE80::2 (Serial1/0), from FE80::2, Send flag is 0x0 +Composite metric is (2560/256), Route is Internal +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 100 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +FE80::4 (Serial1/2), from FE80::4, Send flag is 0x0 +Composite metric is (4096/3072), Route is Internal +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 160 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +FE80::3 (Serial1/1), from FE80::3, Send flag is 0x0 +Composite metric is (5120/1280), Route is Internal +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 200 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +384 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! If detailed information about an external (redistributed) network is +! pulled from the topology table, apart from the obvious information, +! external networks also carry information about the router that performs +! the redistribution, and about the origins of the redistributed route +! such as what is its original type, AS number, or metric. + +R1# show ipv6 eigrp topology 2001:DB8:FFFF::/48 +IPv6-EIGRP (AS 1): Topology entry for 2001:DB8:FFFF::/48 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 1024 +Routing Descriptor Blocks: +FE80::4 (Serial1/2), from FE80::4, Send flag is 0x0 +Composite metric is (1024/1), Route is External +Vector metric: +Minimum bandwidth is 1544 Kbit +Total delay is 40 microseconds +Reliability is 0/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +External data: +Originating router is 10.255.255.4 +AS number of route is 0 +External protocol is Static, external metric is 0 +Administrator tag is 0 (0x00000000) + + +Computed, Reported, and Feasible Distances, and Feasibility Condition + +Toward a particular destination network, EIGRP keeps track of various distances as a part of its operation. Unfortunately, the details about these distances, and their purpose and operation, are often poorly explained and understood. A correct in-depth understand- +ing of EIGRP therefore requires that we revisit these concepts in detail. EIGRP uses a composite metric; however, for simplicity, the remainder of this section assumes that the EIGRP metric is a single dimensionless number, as it makes no difference to the opera-tion of underlying mechanisms. As explained in the “EIGRP Classic Metrics” and “EIGRP Wide Metrics” sections, earlier in the chapter, the metric components are combined into a single number; the words distance and cost used interchangeably in this section refer +to this combined value. Also, for simplicity, throughout this section, EIGRP routers are assumed to operate without Split Horizon. + +Consider the topology shown in Figure 8-5. +Chapter 8: EIGRP 385 + + +Delay = 1 + +Delay = 9 R2 + + + +Delay = 15 + +R1 + + +Delay = 5 2001:DB8:CC1E::/64 R3 + + + +Delay = 4 Delay = 12 + +R4 + +Figure 8-5 Sample Network Operating EIGRP in IPv6 Mode + +Assuming that the network has been properly configured and EIGRP has converged, Example 8-9 shows the output of selected show commands issued on R1 that we will analyze in greater detail. Throughout this discussion, we focus on R1’s behavior toward destination network 2001:DB8:CC1E::/64. The redistribution on R4 has been removed. + +Example 8-9 EIGRP Topology Table on R1 + +R1# show ipv6 route eigrp +IPv6 Routing Table - 2 entries +Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP +U - Per-user Static route, M - MIPv6 +I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary +O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +D - EIGRP, EX - EIGRP external +D 2001:DB8:CC1E::/64 [90/2560] +via FE80::2, Serial1/0 + +R1# show ipv6 eigrp topology +IPv6-EIGRP Topology Table for AS(1)/ID(10.255.255.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:CC1E::/64, 1 successors, FD is 2560 +via FE80::2 (2560/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 + +R1# show ipv6 eigrp topology all-links +IPv6-EIGRP Topology Table for AS(1)/ID(10.255.255.1) +386 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +P 2001:DB8:CC1E::/64, 1 successors, FD is 2560, serno 4 +via FE80::2 (2560/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 +via FE80::4 (4096/3072), Serial1/2 + + + +Key Topic + + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + +Key Topic + +The show ip eigrp topology all-links command is of particular interest. The 2001:DB8:CC1E::/64 network is shown here with three possible next hops: Routers R2, R3, and R4. Each of the “via” lines describes a possible route to the destination through a particular neighbor and contains, besides the next hop’s IPv6 address and egress inter-face, two numbers enclosed in parentheses. The number after the slash sign is called the Reported Distance (RD) and corresponds to the current best distance of the particular +neighbor to the destination. In other words, the RD is the neighbor’s distance to the desti-nation as reported in an EIGRP packet received from that neighbor. R1 learns about these distances by receiving an EIGRP message from these neighbors that carries routing infor-mation—an Update, Query, Reply, SIA-Query, or SIA-Reply. In some sources, RD is also called an Advertised Distance, but because this term (and its acronym AD) is easily con-fused with Administrative Distance, we will avoid using it. The RD values for routers R2, R3, and R4 shown in Example 8-9 correspond to their delay values indicated in Figure 8-5 multiplied by 256 (256 = 1 × 256, 1280 = 5 × 256, 3072 = 12 × 256). + +The number in parentheses before the slash sign is called the Computed Distance (CD) and shows the total metric of reaching the destination over the particular neighbor. The CD is computed as the RD of the neighbor plus the cost of the link between R1 and the neighbor. Current values in Example 8-9 correspond to the total sum of delays from R1 through each particular neighbor multiplied by 256 (2560 = 10 × 256, 5120 = 20 × 256, 4096 = 16 × 256). + +For each destination network, there is exactly one CD and one RD per each neighbor. These distances are displayed in the “via” lines of the show ip eigrp topology output in the form of (CD/RD). + +Just as with any other routing protocol, EIGRP’s goal is to identify paths with the least metric to the destination. To accomplish this, EIGRP chooses the path with the low-est CD and installs it, after verifying that the path is not looped, into the routing table. Example 8-9 shows that currently, the smallest distance to the destination network is +through R2 with the CD of 2560. This route is also installed into R1’s routing table, using this CD as the route metric. + +Both CD and RD correspond to the current distance, that is, the momentary total dis-tance of this router to the destination through a particular neighbor (CD), and the neigh-bor’s own distance to that destination as known by this router (RD). EIGRP also main-tains a record of yet another distance for each destination: the Feasible Distance (FD). The FD is one of the most misunderstood and poorly explained concepts in EIGRP. For +each destination, FD is a record of the lowest known distance since the last transition +Chapter 8: EIGRP 387 + +from the Active to Passive state. In other words, FD is a historical record, or a histori-cal copy, of the smallest known CD toward a particular destination, with the history starting anew with the last Active-to-Passive transition. Being a record of the smallest known CD since the route entered the Passive state for the last time, FD is not necessar-ily equal to the current best CD to a destination. By its definition, in the Passive state, after the FD has been initialized, it can only decrease (if the current best CD happens to fall below the current value of FD) or remain at its current value (if the current best CD rises but the route remains Passive). There is exactly one FD per each destination, regard-less of the number of neighbors. It is important to note that the FD is an internal variable maintained for each network known to EIGRP whose value is never advertised to another router. + +To better illustrate the behavior of FD, consider Example 8-10, with comments inserted directly into the output. Keep in mind that all metric modifications in this example are carefully chosen to avoid violating the Feasibility Condition and causing the route toward 2001:DB8:CC1E::/64 entering the Active state. This example shows the behavior of the FD while the route is kept in the Passive state. + +Example 8-10 Feasible Distance Behavior in EIGRP +Key +Topic ! Before performing any changes to the network, it is in the state shown +! in Figure 8-5 and Example 8-9. Now assume that the delay of link between +! R1 and R2 has increased from 9 to 11. Note in the following output that +! while the CD via R2 has changed from 2560 to 3072 and so has the metric +! in the routing table, FD indicated in the network heading remained at its +! current value of 2560. At this moment, the value of FD says that "at some +! point in the past, R1 was as close as 2560 units to the destination", even +! though the current best CD is different. R2's RD did not change, either, +! because R2's best path to the destination has not been influenced in any way. + +R1# show ipv6 eigrp topology all-links +! Legend removed for brevity +P 2001:DB8:CC1E::/64, 1 successors, FD is 2560, serno 5 +via FE80::2 (3072/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 +via FE80::4 (4096/3072), Serial1/2 + +R1# show ipv6 route eigrp +! Legend removed for brevity +D 2001:DB8:CC1E::/64 [90/3072] +via FE80::2, Serial1/0 + +! Further assume that subsequently, R2's LAN interface's delay increases +! from 1 to 3. Now, both R2's RD and CD through R2 change: R2's RD increases +! to 768 and CD via R2 increases to 3584 but again, the FD remains at its +! former value of 2560, as at some point in the past, our best CD was 2560. +388 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +R1# show ipv6 eigrp topology all-links +! Legend removed for brevity +P 2001:DB8:CC1E::/64, 1 successors, FD is 2560, serno 6 +via FE80::2 (3584/768), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 +via FE80::4 (4096/3072), Serial1/2 + +R1# show ipv6 route eigrp +! Legend removed for brevity +D 2001:DB8:CC1E::/64 [90/3584] +via FE80::2, Serial1/0 + +! Now, assume that R2's LAN interface's delay returns back to 1, and moreover, +! the delay of R1-R2 link decreases to 7. Because the total delay of 8 is now +! better than any experienced so far, not only the R2's RD and CD via R2 change, +! but also the FD as the record of the smallest known CD changes from 2560 to 2048. + +R1# show ipv6 eigrp topology all-links +! Legend removed for brevity +P 2001:DB8:CC1E::/64, 1 successors, FD is 2048, serno 8 +via FE80::2 (2048/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 +via FE80::4 (4096/3072), Serial1/2 + +R1# show ipv6 route eigrp +! Legend removed for brevity +D 2001:DB8:CC1E::/64 [90/2048] +via FE80::2, Serial1/0 + +! Now when the delay of the R1-R2 link increases back to 9, the CD via R2 +! increases and the best distance returns to the former value of 2560. However, +! FD will now keep its value of 2048 as this distance has become the new +! historical minimum of the distance towards 2001:DB8:CC1E::/64. At the end +! of this example, the delays on network interfaces have completely returned +! back to the original state from Figure 8-5; yet, because of its properties, +! the FD has changed from 2560 to 2048 although the CD of the current best +! route via FE80::2 is back to the original value of 2560. + +R1# show ipv6 eigrp topology all-links +! Legend removed for brevity +P 2001:DB8:CC1E::/64, 1 successors, FD is 2048, serno 9 +via FE80::2 (2560/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 +via FE80::4 (4096/3072), Serial1/2 +Chapter 8: EIGRP 389 + +R1# show ipv6 route eigrp +! Legend removed for brevity +D 2001:DB8:CC1E::/64 [90/2560] +via FE80::2, Serial1/0 + +Note how, in several cases in Example 8-10, FD was different from the actual lowest CD that was also visible in the show ipv6 route output. When advertising its distance to the 2001:DB8:CC1E::/64, R1 would advertise its actual distance instead of FD. Once again, FD is an internal value that is used by EIGRP to select loop-free paths, but its value is never advertised in any EIGRP packets. + +To explain the motivation behind the FD as previously described, consider the scenario in Figure 8-6. This topology is similar to Figure 8-5, with a change: R4 is only connected to R1 and is not connected to the LAN. The delay on the R1–R4 link is configured to 2. As a result, R4 points to R1 to reach 2001:DB8:CC1E::/64, and R4’s total metric to this network will be (2+9+1) × 256 = 12 × 256 = 3072, identical to the original situation in Figure 8-5. + +Delay = 1 + +Delay = 9 R2 + + + +Delay = 15 + +R1 + + +Delay = 5 2001:DB8:CC1E::/64 R3 + + + +Delay = 2 + +R4 + +Figure 8-6 Modified Sample Network Operating EIGRP in IPv6 Mode + + + + + + + + + + + +Key Topic + +Assume now that the R1–R2 link suddenly fails. At the exact moment of the failure, R1 and R2 are the only routers that are aware of the topology change. Neither R3 nor R4 knows about the change yet. If R1 immediately proceeded to choose a replacement next hop toward the destination, it would choose R4 because with R2 unreachable, R4 appar-ently provides the next least-cost path with the metric of (2+12) × 256 = 3584. However, this would cause a routing loop because at the moment the R1–R2 link failed and R1 tried to find another next hop, R4 was not yet updated about the topology change, and therefore its RD of 12 × 256 = 3072 was outdated. Trusting it blindly would be a mistake. + +This is where FD comes in. With the FD set to 2560, R1 knows that at some point in the past, it had a workable, loop-free path to the destination with the distance as low as 2560. Naturally, by virtue of all links in the topology having positive (that is, non-negative and nonzero) costs, neighbors that provided this path must have been even closer, meaning that their RDs must have been strictly less than 2560. At that point in the past, any neigh-bor whose distance was less than 2560 was safe to be used by R1, as that neighbor would +never forward packets back to R1, neither directly nor over any chain of multiple routers +390 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + + + +Key Topic + +looping back to R1: If the neighbor’s own distance was less than R1’s, why would it for-ward packets over a path whose distance was higher than its own? + +Now if R1’s actual distance increases over time, it is one more reason for these neighbors with their distances less than 2560 to avoid using R1 to reach the network because, just as before, why should they forward packets through R1 whose distance was higher than their own and even grew further? Note that in this logic, the neighbors do not even need to know that R1’s distance has increased from 2560 to a higher value, so to make this fea-sibility check, it is not even important they have up-to-date information from R1—which is exactly what we need! + +This idea forms the basis of Feasible Distance and the related Feasibility Condition check. FD, being the record of the smallest known distance to a destination since the last time the route went Passive, is a value that describes the metric of the best path to the destination this router has known. Any neighbor whose current distance is lower would never pass packets back to this router, and it would even less consider passing packets back if it knew that this router’s distance has increased for whatever reasons. Therefore, any neighbor that is closer to the destination than this router has been since the last time the destination became Passive cannot form a routing loop, or more technically, any neighbor whose Reported Distance is strictly smaller than this router’s Feasible Distance cannot form a routing loop. Both these formulations constitute the Feasibility Condition, one of several sufficient conditions for loop freedom that were proposed and mathematically proven by Dr. J. J. Garcia-Luna-Aceves in the late 1980s and early 1990s. This particular Feasibility Condition, stating that every neighbor satisfying the inequality RD < FD provides a loop-free path, is also sometimes called the Source Node Condition. + +Note that the FC is a sufficient condition, not a necessary condition for loop freedom; this means that every neighbor satisfying the FC provides a loop-free path. However, not every loop-free path satisfies the FC. Compare Figures 8-5 and 8-6 to see why this is the case. In both figures, R4’s distance to the destination 2001:DB8:CC1E::/64 as reported to R1 is 12 × 256 = 3072. In Figure 8-5, R4 is directly connected to the destination network and forwards packets to this network directly. If R4 received packets from R1 toward the LAN, it would forward them onto the LAN without causing any routing loop. In Figure 8-6, however, R4 uses R1 as its next hop toward the LAN network, and if R1 tried to route packets to the LAN through R4, it would receive them back in a routing loop. In other words, if a neighbor’s RD is equal to or higher than R1’s FD, it might (Figure 8-6) or might not (Figure 8-5) cause a routing loop; in the distance-vector approach, R1 has no further information to verify that. However, it is certain and guaranteed that if a neigh-bor’s RD is lower than R1’s FD (that is, if the neighbor is closer to the destination than R1 has ever been since the last time the destination became Passive), it will not cause a rout-ing loop. The FC basically splits all neighbors of a router into two groups: neighbors that +are guaranteed to provide a loop-free path and all other neighbors about which the router +cannot be sure. +Chapter 8: EIGRP 391 + + + +Key Topic + +For a destination, all neighbors that pass the FC and thus are safe to use as next hops are called Feasible Successors. In other words, a Feasible Successor is a neighbor that is +guaranteed to provide a loop-free path toward a destination; Feasible Successors are iden-tified by passing the FC check. Among these Feasible Successors, one or more provide the least CD to the destination; these are called Successors. Both Feasible Successors and Successors must meet the FC and thus are guaranteed to provide a loop-free +path; Successors must in addition provide the shortest path available. Technically, each Successor is also a Feasible Successor because it meets the FC. However, in common language, the term Feasible Successor is used to denote only the neighbor that provides a loop-free, yet not the shortest, path available. All Successors and Feasible Successors to a destination can be seen in the show ip eigrp topology output. Neighbors that do not meet the FC are not displayed in this output; to display them as well, the show ip eigrp topology all-links command must be used. + +In Figure 8-6, using the FC will prevent R1 from creating a routing loop through R4 when the R1–R2 link fails. Because R4’s RD is 3584 while R1’s FD is 2560, R1 assumes that R4 might be using it as its own next hop to the LAN. Therefore, R4 does not pass the FC check and is not considered a Feasible Successor. In the precise moment of R1–R2 link failure, when only R1 and R2 are aware of the failure, R1 now knows that even though R4 appears to provide the next least-cost path, it cannot be trusted. This prevents R1 from pointing toward R4, creating a temporary routing loop. + +An EIGRP router is always allowed to use any Successor and Feasible Successor to reach the destination, without any further coordination with them. Using a Successor will make the packets flow to the destination through the shortest loop-free path; using a Feasible Successor will cause the packets to go over a longer but still loop-free path. While the route is in the Passive state, there is usually no reason to route packets through Feasible Successors because that would make them flow over suboptimal paths, yet this is exactly +the idea of unequal-cost load balancing that EIGRP is capable of. + + + +Local and Diffusing Computations in EIGRP + +After having explained the concepts of Reported Distance, Computed Distance, Feasible Distance, and Feasibility Condition, describing the handling of topology changes in EIGRP is relatively straightforward. A topology change occurs whenever the distance +to a network changes or a new neighbor comes online that advertises the network. The distance change can be detected either through receiving an Update, Query, Reply, SIA-Query, or SIA-Reply packet from a neighbor that carries updated metric information about the network, or because a local interface metric has changed. Also, the event of a neighbor going down is processed by setting the CD/RD of all networks reachable through that neighbor to infinity. Whatever the reason for the topology change is, the router can immediately verify in its topology table whether the new shortest path is +392 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +provided by a router passing the FC check, that is, a Feasible Successor. If it is, the router performs the following steps: + +1. Key +Topic 2. + + +3. + +4. + + +The Feasible Successor providing the least CD is made the new Successor. + +If the CD over the new Successor is less than the current FD, the FD will be updated to the new CD; otherwise it stays at its current value. + +The routing table is updated to point toward the new Successor. + +If the current distance to the destination has changed as a result of switching to a new Successor, an Update packet is sent to all neighbors, advertising the router’s +updated distance to the destination. + + +This action is called a local computation in EIGRP, performed solely by using informa-tion already stored in the router’s topology table, without needing to coordinate with the neighboring routers. Throughout this procedure, the route has remained in the Passive state. + +If, however, after detecting a topology change, the router finds out that the new short-est path is provided by a neighbor that is not a Feasible Successor, the router cannot use such a neighbor right away because it could cause a routing loop. Therefore, the router commences a diffusing computation by performing the following steps: + +1. +Key Topic + +2. + + + + +3. + + +The entry in the routing table, still pointing to the current unchanged Successor, is locked: It must not be removed nor its next hop changed until the diffusing compu-tation is finished and the route has been moved to the Passive state again. + +The FD is set to the current (possibly increased) CD through the current unchanged Successor. Also, if this router ever needs to advertise its distance to the network while in the Active state, it will also use the value of the current CD through the Successor. + +The network is put into the Active state and the router sends out a Query packet to all its neighbors. This Query packet contains the Active network’s prefix and the +router’s current CD toward it. + + +Each neighbor receiving a Query packet will process it by updating its own topology table using the distance information advertised in the Query and reevaluating its own choice of Successors and Feasible Successors. Two possibilities now exist: Either the neighbor still has its own Feasible Successor or a Successor that provides it with the least-cost loop-free path, or the information contained in the Query causes the neighbor to stop considering the path through its current Successor the shortest available and none of its own neighbors that offer the shortest path are a Feasible Successor. + +In the first case, when the neighbor still has a Successor, it will simply send back a Reply packet, indicating the neighbor’s current distance to the destination (performing its own local computation if necessary). The neighbor did not become engaged in the diffusing computation as it did not need to put the network into the Active state itself. Thanks to this, the diffusing computation was bounded by this neighbor and did not propagate further. +Chapter 8: EIGRP 393 + +In the second case, the neighbor will itself join the diffusing computation, send out its own Query packet, and advertise its own current distance through its current Successor. As a result, the wave of Query messages propagates through the part of the network that is affected by the change. Other parts of the network that are not affected will not engage in the diffusing computation. This fact explains the somewhat more marketing than technical claims about EIGRP using “partial, bounded updates”: any EIGRP signal-ing that by its nature covers only the changed information (partial) and is propagated only into the affected part of the network (bounded). + +After a router becomes Active for a destination and sends out Query packets to its neigh-bors, it must wait for a Reply packet from each of its neighbors to come back. Until then, the route remains in the Active state, and its routing table is unchanged. Only after all Reply packets are received, the router can put the route back to the Passive state, simply choose the neighbor offering the shortest path available while skipping the FC check, and reinitialize the FD to the CD offered by the selected neighbor. Now the routing table entry can finally be updated. If this router itself became Active by receiving a Query, +it now starts sending its own Reply and possibly Update packets, as only now its own distance to the destination has been determined; otherwise, the router sends out Update packets only. + +It is noteworthy to mention that the crucial information carried in Update, Query, Reply, SIA-Query, and SIA-Reply packets is always simply the sender’s current distance to a particular destination, informing its receiver about the packet originator’s distance to the destination and optionally requesting a response (in the case of Query and SIA-Query packets). Whether any of these packets causes its receiver to go Active for a destination depends exclusively on how the information in the message impacts the receiver’s choice of the shortest path and FC check performed over its neighbor offering the shortest path. + +It is a widespread belief about EIGRP that if the current Successor fails, a Feasible Successor (if one exists) will always be promoted to the Successor role. This statement is not entirely correct, however. Consider again the topology in Figure 8-5 in the state we have left it at the end of Example 8-10. On R1, the FD of the LAN remained at 2048, and the best path currently goes through R2, the Successor, its CD being 2560. R3 is identi-fied as the Feasible Successor as its RD is 1280, less than the FD (2048), and the CD through R3 is 5120. Note that R4 actually provides a better path than R3 with the CD of 4096, but because of R4’s RD of 3072, R4 does not pass the FC and R1 does not con-sider it to be a Feasible Successor. + +If the link between R1 and R2 fails, the common belief is that R1 would first check whether it has a Feasible Successor available—and it does indeed; it is R3—so it would be promoted to the Successor role and R1 would install a route to the LAN through R3. This would not be correct, however. If R1 was simply satisfied with R3, it would be using a workable but not necessarily the shortest available path, and would never explore the possibility of using a shorter path. What really happens in EIGRP is the following: + + +■ +Key Topic + +Whenever EIGRP detects a topology change, it first records the change into the topology table and updates the RD and CD of the neighbor that advertised the change (in case of a received EIGRP message) or was influenced by it (in case of a +link metric change). +394 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ From among all neighbors that advertise the network, EIGRP identifies the one that provides the least CD, taking into account the updated CDs. Note that the FC is not invoked at this step. + +■ Only after identifying the neighbor offering the least CD, EIGRP verifies whether this neighbor meets the FC and is therefore a Feasible Successor. If it is, EIGRP will promote it to the Successor and start using it right away. If, however, that neighbor does not meet the FC, EIGRP will put the route into the Active state and send out Queries, asking its neighbors to assist in locating the best route. + +In other words, EIGRP—just like any other routing protocol—always tries to choose the shortest path toward a destination, but before using it, EIGRP verifies whether it meets the FC to be loop-free. If it does, EIGRP will use it. If it does not, EIGRP puts the desti-nation into the Active state. + +Consider Example 8-11, which explains how the network in Figure 8-5 would react if the R1–R2 link was shut down. Read the comments in the example carefully. + +Example 8-11 Use of a Neighbor Failing the FC and Providing the Next Least Distance + +! The IPv6 routing table shows the LAN network routed via R2 + +R1# show ipv6 route eigrp +! Legend removed for brevity +D 2001:DB8:CC1E::/64 [90/2560] +via FE80::2, Serial1/0 + +! In the EIGRP topology table, R2 is identified as the Successor, and R3 +! is identified as the Feasible Successor. R4 is not displayed here, as +! it does not meet the FC. Note the FD remained at 2048 after the changes +! performed in the Example 8-10; the delays on links have nonetheless been +! configured back to the values shown in Figure 8-5. + +R1# show ipv6 eigrp topology +! Legend removed for brevity +P 2001:DB8:CC1E::/64, 1 successors, FD is 2048 +via FE80::2 (2560/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 + +! Using the all-links keyword, R4 can be displayed as well but it is clear +! from the (CD/RD) values that R4's RD of 3072 is not strictly less than +! the FD of 2048. R2 and R3 pass this check, however. + +R1# show ipv6 eigrp topology all-links +! Legend removed for brevity +P 2001:DB8:CC1E::/64, 1 successors, FD is 2048, serno 9 +via FE80::2 (2560/256), Serial1/0 +via FE80::3 (5120/1280), Serial1/1 +via FE80::4 (4096/3072), Serial1/2 +Chapter 8: EIGRP 395 + +! The debug eigrp fsm is used to display EIGRP's DUAL FSM actions. + +R1# debug eigrp fsm +EIGRP FSM Events/Actions debugging is on + + +R1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# int s1/0 +R1(config-if)# shutdown +*Mar 1 12:20:35.380: %DUAL-5-NBRCHANGE: IPv6-EIGRP(0) 1: Neighbor FE80::2 (Serial1/0) is down: interface down +*Mar 1 12:20:35.384: DUAL: linkdown: start - FE80::2 via Serial1/0 + +! After the Serial1/0 interface is shut down, note that the loss of R2 +! is represented in the topology table as if R2 advertised an infinite metric. +! R1 evaluates all neighbor entries for the destination in the topology table +! and determines that while the minimum available distance (Dmin) is 4096, +! obviously via R4, this router does not meet the FC – that is the reason +! of the "not found" comment in the debug output; the "not found" does not +! really relate to the FE80::4 line on which it is printed out (the debug +! output is just wrapped confusingly). + +*Mar 1 12:20:35.384: DUAL: Destination 2001:DB8:CC1E::/64 +*Mar 1 12:20:35.384: DUAL: Find FS for dest 2001:DB8:CC1E::/64. FD is 2048, RD is 2560 + +*Mar 1 12:20:35.384: DUAL: +*Mar 1 12:20:35.384: DUAL: +*Mar 1 12:20:35.384: DUAL: + +FE80::2 metric 4294967295/4294967295 +FE80::3 metric 5120/1280 +FE80::4 metric 4096/3072 not found Dmin is 4096 + +*Mar 1 12:20:35.384: DUAL: Peer total 2 stub 0 template 2 + +! Because the neighbor providing the least cost path does not meet the FC, +! R1 enters the Active state, sends out Queries, and expects Replies. + +*Mar 1 12:20:35.384: DUAL: Dest 2001:DB8:CC1E::/64 entering active state. +*Mar 1 12:20:35.384: DUAL: Set reply-status table. Count is 2. +*Mar 1 12:20:35.384: DUAL: Not doing split horizon +*Mar 1 12:20:35.384: DUAL: linkdown: finish + +! R3 responds; it is not influenced by the failure of the R1/R2 link, so +! the CD/RD are the same as already stored. + +*Mar 1 12:20:35.440: DUAL: rcvreply: 2001:DB8:CC1E::/64 via FE80::3 metric 5120/1280 +*Mar 1 12:20:35.440: DUAL: reply count is 2 +*Mar 1 12:20:35.440: DUAL: Clearing handle 2, count now 1 +396 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! R4 responds; it is not influenced by the failure of the R1/R2 link, so +! the CD/RD are the same as already stored. + +*Mar 1 12:20:35.440: DUAL: rcvreply: 2001:DB8:CC1E::/64 via FE80::4 metric 4096/3072 +*Mar 1 12:20:35.440: DUAL: reply count is 1 +*Mar 1 12:20:35.440: DUAL: Clearing handle 1, count now 0 +*Mar 1 12:20:35.440: DUAL: Freeing reply status table + +! Now that all replies have been received, R1 is free to reset the FD +! and choose any neighbor that provides the least CD. Obviously, it is R4. +! The "RT installed" shows the route and the next hop that are installed +! into the routing table. + +*Mar 1 12:20:35.444: DUAL: Find FS for dest 2001:DB8:CC1E::/64. FD is 4294967295, RD is 4294967295 found +*Mar 1 12:20:35.444: DUAL: Removing dest 2001:DB8:CC1E::/64, nexthop FE80::2, infosource FE80::2 +*Mar 1 12:20:35.448: DUAL: RT installed 2001:DB8:CC1E::/64 via FE80::4 +*Mar 1 12:20:35.448: DUAL: Send update about 2001:DB8:CC1E::/64. Reason: metric chg +*Mar 1 12:20:35.448: DUAL: Send update about 2001:DB8:CC1E::/64. Reason: new if +*Mar 1 12:20:37.308: %LINK-5-CHANGED: Interface Serial1/0, changed state to administratively down +*Mar 1 12:20:38.308: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down + +! The outputs below now show that the FD has been reset and updated to the new +! least CD available – 4096 via R4. The route via R4 is also installed into +! the IPv6 routing table. Note that R3 was, and has remained, a Feasible Successor +! without being ever promoted to the Successor role. + +R1(config-if)# do show ipv6 eigrp topology +! Legend removed for brevity +P 2001:DB8:CC1E::/64, 1 successors, FD is 4096 +via FE80::4 (4096/3072), Serial1/2 +via FE80::3 (5120/1280), Serial1/1 + +R1(config-if)# do show ipv6 route eigrp +! Legend removed for brevity +D 2001:DB8:CC1E::/64 [90/4096] +via FE80::4, Serial1/2 +Chapter 8: EIGRP 397 + +DUAL FSM + +The mechanisms described so far—the concept of Feasible Distance, Successors and Feasible Successors, local computations, and diffusing computations that grow by send-ing Queries and shrink by receiving Replies—allow a router to efficiently compute a new path to a destination, assuming that over the entire duration of the diffusing computa-tion, no other topological changes take place. However, this is a very strong assumption. Therefore, on top of all these mechanisms, EIGRP uses a control mechanism called the Diffusing Update Algorithm, or DUAL, that takes care of handling multiple topology changes occurring during a single diffusing computation. Figure 8-7 shows the DUAL Finite State Machine (FSM). + +FC Satisfied + + +P + + + + + + +Query from S +Last Reply, FC +Satisfied with Current FD +Last Reply, Set FD = ∞ +Input Event Other han QueryInput Event Other Than Query +from Successor, FC not Satisfiedfrom Successor, FC Not Satisfied +Query from Successor, +FC Not Satisfied +Last Reply, Set FD = ∞ +Last Reply, FC Satisfied +with Current FD + + + +Last Reply, FC Not +A0 Satisfied with FD A1 Query from S +Increase in D + +Last Reply, FC Not +A2 Satisfied with FD A3 +Increase in D + + + +Input Event Other Than Input Event Other Than Last Reply, Last Reply or Query from S Increase in D or Query from S + +Input Event Other Than Last Reply + +Input Event Other +Than Last Reply or Increase in D + + +Figure 8-7 Diffusing Update Algorithm Finite State Machine + +In Figure 8-7, the acronyms D, S, FC, and FD stand for Distance, Successor, Feasible Condition, and Feasible Distance, respectively. The DUAL FSM has one passive and four +active states denoted as P and A0 through A3. These Active states also have names by which we will refer to them later in the section, and the names refer to the origin of the +diffusing computation—which router appears to have started it: + +■ A0: Local Origin with Distance Increase +■ A1: Local Origin +■ A2: Multiple Origins +■ A3: Successor Origin +398 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Comments by the arrows explain events that the DUAL FSM reacts to, and the arrows describe the state transitions caused by these events. Explaining the DUAL FSM in depth is beyond the scope of this book; however, its basic behavior can be summarized in these rules (all rules always focusing on a single particular destination at a time): + +■ Unless a change in distance occurs such that the neighbor providing the least Computed Distance fails to meet the Feasibility Condition, the route remains passive. + +■ If a Query is received from the current Successor and, after processing the distance indicated in this Query, the neighbor that provides the least Computed Distance +fails to meet the Feasibility Condition, the route will enter the A3 active state, also called the Successor Origin Active State. The router will send out Queries and wait +for Replies. If no further distance increase is detected while waiting for the Replies, the last Reply allows the router to transition back to the Passive state, reinitialize the Feasible Distance, and choose any neighbor that provides the least Computed Distance as the new Successor. + +■ If a distance change caused by other means than a Query from a Successor is detected (this can be caused by receiving an Update, changing an interface metric, or losing a neighbor) and after processing the change, the neighbor that provides the least Computed Distance fails to meet the Feasibility Condition, the route will +enter the A1 active state, also called the Local Origin Active State. The router will send out Queries and wait for Replies. If no further distance increase or Query from +the current Successor is received while waiting for the Replies, the last Reply allows the router to transition back to the Passive state, reinitialize the Feasible Distance, and choose any neighbor that provides the least Computed Distance as the new Successor. + +■ If during the stay in the A3 (Successor Origin) or A1 (Local Origin) active states, another distance increase caused by other means than the Successor’s Query is +detected, another topology change during the diffusing computation has occurred. Because the router cannot advertise this updated distance while it is in the Active state, other routers might not be informed about it and their Replies might not +take this new increased distance into account. Therefore, extra scrutiny is applied to the received Replies instead of simply choosing the neighbor that provides the +least Computed Distance. This is accomplished first by changing the state from A3 (Successor Origin) to A2 (called Multiple Origins), or from A1 (Local Origin) to +A0 (no official name; we will call it Local Origin with Distance Increase) states. In A2 or A0 states, the router waits to receive all remaining Replies. When the last Reply arrives, the router will first check whether the neighbor providing the least +Computed Distance passes the Feasible Condition check using the Feasibility Distance value set when the route entered the Active state (recall that it was set to the increased distance through the current Successor at the moment of transition-ing to the Active state). This extra check essentially mimics a situation in which the router is actually using the path through the current Successor and has just detected the distance increase, so it uses the current value of Feasibility Distance to verify whether the neighbor providing the least Computed Distance passes the Feasibility +Chapter 8: EIGRP 399 + +Condition. If it does, the route becomes Passive again, and the neighbor is chosen +as the Successor. If it does not, however, the route will return from A0 (Local Origin with Distance Increase) to A1 (Local Origin) or from A2 (Multiple Origins) to A3 (Successor Origin) and the router will commence another diffusing computation by +again sending a Query. + +■ If during the stay in A1 (Local Origin) or A0 (Local Origin with Distance Increase) active states a Query from the Successor is received, another topology change dur- +ing the diffusing computation has occurred. Because the router cannot advertise this updated distance while it is in the Active state, other routers might not be informed about it and their Replies might not take this new increased distance into account. Therefore, extra scrutiny is applied to the received Replies. This is accomplished by +changing the state to A2 (Multiple Origins) and then proceeding from that state just like in the previous case. + +The number of the Active state, that is, 0 to 3, is stored in a so-called query origin flag that is visible in the EIGRP topology table during the Active state. Consult Example 8-12 for more information. Routers in this example are running IPv4 EIGRP and have again been configured to take only the Delay metric component into account. The routers in this topology have been daisy-chained (RouterX is connected to RouterY; RouterY is con-nected to RouterZ and not shown in the example). To elicit long-lasting Active states, the Hold timers on interfaces have been configured to 10000 seconds and the timers active-time disabled command was used on all routers to allow the diffusing computation to run indefinitely. In addition, an access list dropping all inbound packets was placed on the RouterY interface toward RouterX before causing a topology change; this ACL prevented Queries and Replies from being exchanged between RouterX and RouterY, causing the diffusing computation to stall. Topology changes were caused by shutting down loop-back interfaces whose networks were advertised in EIGRP, and optionally increasing the Delay metrics on interfaces during the diffusing computation. + +Example 8-12 Active States of an EIGRP Route + +! In this example, a local loopback interface has been shut down, prompting +! the router to start a diffusing computation. The following outputs show +! that the origin of the query is the local router. In the output of +! show ip eigrp topology active command, the query-origin is shown as +! "Local origin", and the detailed output on the 10.255.255.1/32 entry +! claims the Query origin flag to be 1, hinting at the A1 state. + +RouterX(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +A 10.255.255.1/32, 1 successors, FD is Inaccessible, Q +1 replies, active never, query-origin: Local origin +via Connected (Infinity/Infinity), Loopback0 +400 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Remaining replies: +via 10.0.12.2, r, Serial1/0 + +RouterX(config-if)# do show ip eigrp topology 10.255.255.1/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.1/32 +State is Active, Query origin flag is 1, 1 Successor(s), FD is 4294967295 +Waiting for 1 replies +Routing Descriptor Blocks: +0.0.0.0 (Loopback0), from Connected, Send flag is 0x0 +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 0 Kbit +Total delay is 167772159 microseconds +Reliability is 0/255 +Load is 0/255 +Minimum MTU is 1514 +Hop count is 0 + +! In the next output, an entry is shown for which the router received a Query +! from its Successor. The query-origin is indicated as "Successor Origin", +! and the Query origin flag having the value of 3, hinting at the A3 state. + +RouterY(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +A 10.255.255.3/32, 1 successors, FD is Inaccessible, Q +1 replies, active never, query-origin: Successor Origin +via 10.0.23.3 (Infinity/Infinity), Serial1/0 +Remaining replies: +via 10.0.12.1, r, Serial1/1 + +RouterY(config-if)# do show ip eigrp topology 10.255.255.3/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.3/32 +State is Active, Query origin flag is 3, 1 Successor(s), FD is 4294967295 +Waiting for 1 replies +Routing Descriptor Blocks: +10.0.23.3 (Serial1/0), from 10.0.23.3, Send flag is 0x0 +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 0 Kbit +Total delay is 167772159 microseconds +Reliability is 0/255 +Load is 0/255 +Chapter 8: EIGRP 401 + +Minimum MTU is 1514 +Hop count is 0 + +! The following output shows a router that received an Update from its Successor +! that forced it to enter the A1 state, and detecting another distance increase ! during the diffusing computation, moving it to the A0 state. Note that the +! verbose name of the query-origin is displayed as "Clear", having no meaning. +! The numerical value of the Query origin flag is 0, hinting at the A0 state. + +RouterY(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +A 10.255.255.4/32, 1 successors, FD is 256256, Q +1 replies, active never, query-origin: Clear +via 10.0.23.3 (512000/256000), Serial1/0 +Remaining replies: +via 10.0.12.1, r, Serial1/1 + +RouterY(config-if)# do show ip eigrp topo 10.255.255.4/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.4/32 +State is Active, Query origin flag is 0, 1 Successor(s), FD is 256256 +Waiting for 1 replies +Routing Descriptor Blocks: +10.0.23.3 (Serial1/0), from 10.0.23.3, Send flag is 0x0 +Composite metric is (512000/256000), Route is Internal +Vector metric: +Minimum bandwidth is 1000 Kbit +Total delay is 20000 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 + +! Finally, the next output shows a router that, during the diffusing computation, +! detected a distance increase and received a Query from its Successor. Note +! the Query origin being displayed as "Multiple Origins" and the value of the +! Query origin flag is 2, hinting at the A2 state. + +RouterY(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status +402 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +A 10.255.255.5/32, 1 successors, FD is 256256, Q +1 replies, active never, query-origin: Multiple Origins +via 10.0.23.3 (Infinity/Infinity), Serial1/0 +Remaining replies: +via 10.0.12.1, r, Serial1/1 + +RouterY(config-if)# do show ip eigrp topology 10.255.255.5/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.5/32 +State is Active, Query origin flag is 2, 1 Successor(s), FD is 256256 +Waiting for 1 replies +Routing Descriptor Blocks: +10.0.23.3 (Serial1/0), from 10.0.23.3, Send flag is 0x0 +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 0 Kbit +Total delay is 167772159 microseconds +Reliability is 0/255 +Load is 0/255 +Minimum MTU is 1514 +Hop count is 0 + + +Stuck-In-Active State + +If a router joins the diffusing computation for a particular destination by putting it into the Active state and sending out Queries, it must first wait for all its neighbors to send back a Reply before it can conclude the diffusing computation itself, make a new best-path selection, and start sending its own Replies. Consequently, if a router sends a Query and that Query causes at least one of its directly connected neighbors to also become Active, the router will now become dependent not only on its Active neighbor but also on that neighbor’s own neighbors. If they fail to respond, the router’s neighbor cannot conclude the diffusing computation and send a final Reply back to the router, meaning that the router cannot conclude the diffusing computation either. By simple extension, a router in the Active state is dependent on the entire chained sequence of routers that have become Active as a result of this router’s Query. Any single misbehaving router up this chain that is unable to send a Reply for whatever reason will cause all the routers depend-ing on it to stall, possibly never being allowed to conclude the diffusing computation and converge. + +There are several reasons why the EIGRP neighbor router(s) might not respond to the Query. Common reasons for this include the following: + + +■ Key +Topic +■ + +■ + +The neighbor router’s CPU is overloaded and the router either cannot respond in time or is even unable to process all incoming packets including the EIGRP packets. + +Quality issues on the link are causing packets to be lost. + +Low-bandwidth links are congested and packets are being delayed or dropped. +Chapter 8: EIGRP 403 + +■ The network topology is excessively large or complex, either requiring the Query to propagate to a significant depth or causing an inordinate number of prefixes to be impacted by a single link or node failure. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +This chained dependency of routers in the Active state is somewhat of EIGRP’s Achilles heel. Therefore, EIGRP implements multiple mechanisms to cope with this situation. + +When a Query is first sent out by a router, a timer called the Active timer for the route is started. The default value of the Active timers is 3 minutes and it can be set to any value between 1 and 65535 minutes or set to infinity using the timers active-time command in the router eigrp context. If all expected Replies are not received before the Active timer expires, the route in question will be designated as Stuck-In-Active (SIA). The neighbor or neighbors that did not reply will be removed from the neighbor table and their adja-cencies torn down, and the diffusing computation will consider these neighbors to have responded with an infinite metric. + +SIA states in EIGRP are extremely unpleasant and generally difficult to diagnose. In the worst case, an unresponsive router can prevent a significant portion of the network from ever converging in the time allotted by the Active timer. In addition, dropping an adja-cency to a neighbor as a consequence of the SIA state can introduce further instability to the network, as all networks learned from that neighbor will be flushed and possibly learned again after the neighbor comes back up within the Hello interval time. + +The difficulty in solving the SIA states in first EIGRP implementations was aggravated by the fact that if a neighbor did not send a Reply until the Active timer expired, the router would drop the adjacency toward that neighbor even though the neighbor itself was not the root cause of the SIA. Clearly, doing so unlocked the SIA state, but at the same time, it penalized a router that might have been innocent and provided no hint as to where the real cause of the problem was located. To at least partially contain and localize the true place where a difficulty in the Query/Reply message exchange causes the diffusing com-putation to stall, more recent EIGRP implementations use the SIA-Query and SIA-Reply messages. + +If a neighbor does not respond to a Query message with its Reply within half of the Active timer time, the router will send the neighbor a SIA-Query message. The SIA-Query stands for a message saying “Are you still working on my Query?” If the neigh-bor is able to receive and process this SIA-Query, it will immediately respond with the SIA-Reply message. The contents of the SIA-Reply can either say “Yes, I still expect my own neighbors to send me the Replies I’ve asked them for” or “No, the computation +is finished; this is my current metric to the destination.” In any case, the SIA-Reply is sent immediately as a response to the SIA-Query message; there is nothing to wait for. Receiving an SIA-Reply allows the Active timer to be reset, giving the diffusing computa-tion an additional time to complete. At most three SIA-Queries can be sent, each after half of the Active timer. If the diffusing computation is not finished by the time the third SIA-Query was replied to by an SIA-Reply and the half of the Active timer expired again, the adjacency to the neighbor will be dropped. The same will happen if an SIA-Query +is not responded to by an SIA-Reply within the next half of the Active timer. With the +default setting of the Active timer to 180 seconds, three consecutive SIA-Query packets +404 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +allow extending the diffusing computation to a maximum of 4 × 90 = 360 seconds (90 seconds to the first SIA-Query, plus each SIA-Query buying another 90 seconds). + +As a result, if two neighbors can communicate without issues, an SIA-Query will be responded to by an SIA-Reply almost instantly. If, however, two routers have issues talking to each other, it is also probably the place where the normal Query and Reply messages are lost, and there is a good chance of the SIA-Query also going unanswered. Hence, the adjacency will be dropped between the routers that are likely to be the cause of the SIA state. + +Example 8-13 shows an SIA situation. Similar to Example 8-12, three routers in a row, RouterX, RouterY, and RouterZ (not shown in the topology) are connected, running IPv4 EIGRP. The Active timer is at its default setting of 3 minutes. The Hold interval is increased to 10000 seconds on each interface in the topology, and an ACL dropping all packets is placed in the inbound direction on the RouterY interface toward RouterZ. On RouterX, the local loopback is shut down. RouterX sends a Query to RouterY, which in +turn sends a Query to RouterZ. However, because of the ACL, the Reply from RouterZ is not received by RouterY, leading to an SIA state. The following example documents the EIGRP’s handling of the issue. Read the comments in the example carefully. + +Example 8-13 Handling of Stuck-In-Active State + +! Right after the loopback is shut down on RouterX, it sends out a Query to +! its neighbor RouterY. Note the origin of the Query is Local. +! The lowercase 'r' flag shown in the "Remaining replies" section indicates +! a Reply packet is expected from 10.0.12.2 (RouterY) but has not arrived yet. +! Until a SIA-Query has been sent, the output of show ip eigrp topology and +! show ip eigrp topology active is entirely identical, with the active keyword +! automatically limiting output just to active entries. + +RouterX(config-if)# do show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +! Lines omitted for brevity + +A 10.255.255.1/32, 1 successors, FD is Inaccessible +1 replies, active 00:00:10, query-origin: Local origin +Remaining replies: +via 10.0.12.2, r, Serial1/0 + +RouterX(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status +Chapter 8: EIGRP 405 + +A 10.255.255.1/32, 1 successors, FD is Inaccessible +1 replies, active 00:00:10, query-origin: Local origin +via Connected (Infinity/Infinity), Loopback0 +Remaining replies: +via 10.0.12.2, r, Serial1/0 + +R1(config-if)# do show ip eigrp topology 10.255.255.1/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.1/32 +State is Active, Query origin flag is 1, 1 Successor(s), FD is 4294967295 +Waiting for 1 replies +Routing Descriptor Blocks: +0.0.0.0 (Loopback0), from Connected, Send flag is 0x0 +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 0 Kbit +Total delay is 167772159 microseconds +Reliability is 0/255 +Load is 0/255 +Minimum MTU is 1514 +Hop count is 0 + +! On RouterY, the route is reported with the Query origin of Successor Origin. +! Also here notice the 'r' flag in the "Remaining replies" section, indicating +! a Reply packet is expected from 10.0.23.3 (RouterZ) but has not arrived yet. +! This Reply will never arrive due to the ACL between RouterY and RouterZ. +! The 'Q' flag in the entry heading indicates that a Query has been sent for +! this route but it has not been acknowledged yet (also due to the ACL). + +RouterY(config-if)# do show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +! Lines omitted for brevity + +A 10.255.255.1/32, 1 successors, FD is Inaccessible, Q +1 replies, active 00:00:16, query-origin: Successor Origin +Remaining replies: +via 10.0.23.3, r, Serial1/0 + +RouterY(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status +406 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +A 10.255.255.1/32, 1 successors, FD is Inaccessible, Q +1 replies, active 00:00:16, query-origin: Successor Origin +via 10.0.12.1 (Infinity/Infinity), Serial1/1 +Remaining replies: +via 10.0.23.3, r, Serial1/0 + +RouterY(config-if)# do show ip eigrp topology 10.255.255.1/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.1/32 +State is Active, Query origin flag is 3, 1 Successor(s), FD is 4294967295 +Waiting for 1 replies +Routing Descriptor Blocks: +10.0.12.1 (Serial1/1), from 10.0.12.1, Send flag is 0x0 +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 0 Kbit +Total delay is 167772159 microseconds +Reliability is 0/255 +Load is 0/255 +Minimum MTU is 1514 +Hop count is 0 + + +! After the half of the Active timer elapses, both RouterX and RouterY will +! try to find out whether their neighbors that have not responded yet are +! still working on the Query. To accomplish this, both RouterX and RouterY +! will send a SIA-Query to their unresponsive neighbors. + +! The "retries(1)" on RouterX shows that it has sent one SIA-Query to +! RouterY and has received a SIA-Reply response. This is visible in a number +! of places: a topology table entry of Infinity/Infinity via 10.0.12.2 +! has been added in the show ip eigrp active output as a result of receiving +! the SIA-Reply, and this entry has an 'r' flag indicating that a regular +! Reply is still being expected but has no 's' flag that would indicate +! that no SIA-Reply was received. Compare this output later to the output of +! RouterY below. + +RouterX(config-if)# do show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +! Lines omitted for brevity + +A 10.255.255.1/32, 1 successors, FD is Inaccessible +1 replies, active 00:01:41, query-origin: Local origin, retries(1) +Chapter 8: EIGRP 407 + +Remaining replies: +via 10.0.12.2, r, Serial1/0 + +RouterX(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.1) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +A 10.255.255.1/32, 1 successors, FD is Inaccessible +1 replies, active 00:01:41, query-origin: Local origin, retries(1) +via Connected (Infinity/Infinity), Loopback0 +via 10.0.12.2 (Infinity/Infinity), r, Serial1/0, serno 20 + +RouterX(config-if)# do show ip eigrp topology 10.255.255.1/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.1/32 +State is Active, Query origin flag is 1, 1 Successor(s), FD is 4294967295 +Waiting for 1 replies +Routing Descriptor Blocks: +0.0.0.0 (Loopback0), from Connected, Send flag is 0x0 +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 0 Kbit +Total delay is 167772159 microseconds +Reliability is 0/255 +Load is 0/255 +Minimum MTU is 1514 +Hop count is 0 +10.0.12.2 (Serial1/0), from 10.0.12.2, Send flag is 0x0, outstanding reply +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 1000 Kbit +Total delay is 167772159 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 0 + +! On RouterY, it is also visible that a SIA-Query has been sent to RouterZ. +! However, this SIA-Query has not been responded to. In the basic +! show ip eigrp topology command output, the RouterZ (10.0.23.3) is marked +! as SIA-Stuck. In the show ip eigrp topology active output, the topology +! table entry for RouterZ (10.0.23.3) shows that not only a Reply is still +! expected (the 'r' flag) but also that a SIA-Reply is expected (the 's' flag) +! but has not arrived yet. The 'q' flag indicates that a SIA-Query was sent +! to the neighbor but no ACK was received yet (because of the ACL). +408 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! +! Eventually, after next half Active timer interval with no SIA-Reply arriving, +! RouterY decides to drop the adjacency to RouterZ. + +RouterY(config-if)# do show ip eigrp topology +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +! Lines omitted for brevity + +A 10.255.255.1/32, 1 successors, FD is Inaccessible, Qqr +1 replies, active 00:01:46, query-origin: Successor Origin, retries(1) +Remaining replies: +via 10.0.23.3, r, Serial1/0 +SIA-Stuck: 1 peers +Peers: +via 10.0.23.3, s, Serial1/0 + +RouterY(config-if)# do show ip eigrp topology active +IP-EIGRP Topology Table for AS(1)/ID(10.255.255.2) + +Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, +r - reply Status, s - sia Status + +A 10.255.255.1/32, 1 successors, FD is Inaccessible, Qqr +1 replies, active 00:01:47, query-origin: Successor Origin, retries(1) +via 10.0.12.1 (Infinity/Infinity), Serial1/1, serno 24 +via 10.0.23.3 (Infinity/Infinity), rs, q, Serial1/0, serno 23, anchored + +RouterY(config-if)# do show ip eigrp topology 10.255.255.1/32 +IP-EIGRP (AS 1): Topology entry for 10.255.255.1/32 +State is Active, Query origin flag is 3, 1 Successor(s), FD is 4294967295 +Waiting for 1 replies +Routing Descriptor Blocks: +10.0.12.1 (Serial1/1), from 10.0.12.1, Send flag is 0x0 +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 0 Kbit +Total delay is 167772159 microseconds +Reliability is 0/255 +Load is 0/255 +Minimum MTU is 1514 +Hop count is 0 +10.0.23.3 (Serial1/0), from 10.0.23.3, Send flag is 0x40, outstanding reply +Chapter 8: EIGRP 409 + +Composite metric is (4294967295/4294967295), Route is Internal +Vector metric: +Minimum bandwidth is 1000 Kbit +Total delay is 167772159 microseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 0 +R2(config-if)# + +*Mar 1 00:14:35.919: %DUAL-3-SIA: Route 10.255.255.1/32 stuck-in-active state in IP-EIGRP(0) 1. Cleaning up +*Mar 1 00:14:35.927: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 10.0.23.3 (Serial1/0) is down: stuck in active + +Note that it is possible for a router to receive a Query for a destination while it is Active for that destination. Assume the topology shown in Figure 8-8. + + +Delay = 9 R2 + + + +Delay = 90 R1 + + +Delay = 1 +Delay = 9 +R3 + +Figure 8-8 Active State in a Network with Physical Loops + +The situation would be as follows: + +■ R1 has a LAN network directly connected. + +■ Both R2 and R3 will choose R1 as their next hop toward the LAN, with the Computed Distance of 10. + +■ Neither R2 nor R3 considers itself to be a Feasible Successor for the route toward the R1 LAN. + +■ After the LAN interface on R1 is shut down, R1 will send out a Query for this net-work to all its neighbors, indicating an infinite distance. Assume, however, that there are significant delays in the delivery of the Query packet to R1’s neighbors, and R2 is the first router to receive this Query. + +■ Because the Query causes R2 to stop considering R1 as the Successor (it no longer passes the FC check on R2) and R2 has no Feasible Successors, it will go Active and send its own Query to R3. +410 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ Meanwhile, assume that R1’s Query arrived at R3. For R3, the situation is identical. R3 will also become Active and send a Query to R2, while R2’s Query is already being transmitted down the R2/R3 link. + +■ As a result, R2 and R3 have sent a Query to each other, causing each of them to receive a Query for a destination while already being in the Active state for that des-tination. + + + +Key Topic + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +Some sources state that precisely this situation causes the SIA states, as they assume that this causes a deadlock. A router in an Active state for a destination has not concluded its computation yet and cannot send Replies, causing the two or more routers to mutually wait for themselves and never receive the expected Reply to each other. In reality, this +is a gross misunderstanding. Such situations never cause SIA states to occur. Recall that when a router enters the Active state for a destination, it sends out a Query indicating its current distance to the destination after the topology change that triggered the transition to the Active state. If, during the Active state, the router receives another Query for this destination, it simply sends back a Reply packet immediately, claiming exactly the same distance as originally advertised in its own Query packet. In other words, the router sim-ply restates the same distance it has already advertised in its own Query. Any deadlock scenario is thereby averted. + +With respect to Figure 8-8, after R2 and R3 send a Query to each other while already in the Active state, they will simply send a Reply to each other right away with the same distance they already indicated in their Query packets, that is, infinity. After this, R2 and R3 receive all Replies they wait for, so they both conclude the diffusing computation, arrive at the conclusion that no backup path exists, and send a Reply indicating an infi-nite distance back to R1, terminating the diffusing computation entirely. + +To avoid SIA states, proper network design that limits the depth of Query propagation and the number of prefixes impacted by a link or node failure is crucial. Proper hierarchi-cal network design coupled with judicious use of passive interfaces, appropriate route fil-tering and/or summarization, and the EIGRP Stub feature are the key tools that help limit the probability of an SIA state occurrence to an absolute minimum. + +EIGRP Named Mode + +Starting with IOS Release 15.0(1)M, an EIGRP process on a router can be configured using a so-called named mode. The common way of configuring EIGRP processes di-rectly by their autonomous system numbers separately for IPv4 and IPv6 was retroactive-ly named the classic mode, sometimes also called the autonomous system mode . The named mode is the preferred mode of configuring EIGRP after the IOS supports it, and all commands for new features in EIGRP will be made available in the named mode only. The classic mode remains to provide backward compatibility with older configurations but it will not be enhanced with new commands. On a single router, you can run mul-tiple EIGRP processes, some configured using the classic mode and others configured in +named mode. +Chapter 8: EIGRP 411 + +Reasons for EIGRP developers to move to named mode were motivated primarily by the fact that many new features were added both to IPv4 and IPv6 EIGRP. It was becoming clear that this called for a better unified, more consistent configuration interface, ulti-mately provided by the named configuration mode. Readers knowledgeable with Border Gateway Protocol (BGP) configuration will find the EIGRP named mode actually famil-iar: a single EIGRP process configuration that consists of one or more address family sections, each of them specifying details of EIGRP operation for the particular address family. The unification in the named mode configuration even went as far as providing commands to configure every aspect of EIGRP operation including former per-interface commands (timers, authentication, next hop handling, Split Horizon, summarization, and others) within the context of the named mode. With named mode, the entire EIGRP con-figuration is located in a single place. If an EIGRP instance is configured in named mode, all EIGRP-related commands outside the named mode (such as per-interface commands) will be ignored if configured. + +It is very important to stress that the classic and named mode are just two different ways of how EIGRP is configured. They do not constitute two different versions of EIGRP. There is no difference to EIGRP packet format or operation, except (of course) the new configurable features for which the commands are available only in the named mode. + +As the named mode is best explained in a real configuration, Example 8-14 contains a fairly typical named mode configuration for an IPv4/IPv6 EIGRP on a router. Three building blocks of a named EIGRP configuration can be discerned: + +■ Address Family (AF) section: Created using the address-family command, this is a mandatory section directly inside router eigrp name configuration that specifies the particular address family for which an EIGRP instance shall be started. The autono-mous system number is a part of the AF section definition. + +■ Per-AF-interface section: This optional section configured by the af-interface com-mand and located inside a particular AF holds EIGRP settings pertaining to the specified interface and AF. One per-AF-interface section can be created for each routed interface or subinterface. In addition, a per-AF-interface section is configured using af-interface default holds settings that will be applied to all interfaces enabled for EIGRP. In the case both af-interface default and an interface-specific af-interface section define the same setting, the interface-specific section is preferred. + +■ Per-AF-topology section: This is a section present inside a particular AF, related to the support of Multi Topology Routing (MTR) in EIGRP. The topology base per-AF-topology section will always be present in the configuration, even if the IOS has no support for multiple routing topologies. + +Read the comments in the example carefully. +412 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 8-14 EIGRP Named Mode Configuration + +! Named mode is entered for both IPv4 and IPv6 EIGRP using the router eigrp +! command and referring to an arbitrary name. + +router eigrp CCIE + +! Here, IPv4 EIGRP address family for AS number 1 is enabled. + +address-family ipv4 unicast autonomous-system 1 + +! Within the AF section, a number of per-AF-interface sections is created. +! The af-interface default section contains timer settings that apply to +! all EIGRP-enabled interfaces. The af-interface Loopback0 section defines +! the Lo0 interface to be passive. + +af-interface default +hello-interval 1 +hold-time 3 +exit-af-interface +! +af-interface Loopback0 +passive-interface +exit-af-interface + +! The topology base section defines EIGRP behavior related to the base routing +! topology. On routers without Multi Topology Routing support, this will be +! the only per-AF-topology section present. Here, the variance is configured +! and the number of parallel paths to the same destination is increased. + +topology base +maximum-paths 6 +variance 4 +exit-af-topology + +! The network commands to enable EIGRP on selected interfaces are placed +! in the AF section itself. + +network 10.0.0.1 0.0.0.0 +network 10.255.255.1 0.0.0.0 +exit-address-family + +! In the same EIGRP process, an IPv6 address family for AS number 1 is enabled. + +address-family ipv6 unicast autonomous-system 1 +Chapter 8: EIGRP 413 + +! Somewhat surprisingly, each interface on which IPv6 is enabled is automatically +! added to IPv6 EIGRP. In other words, as soon as the IPv6 EIGRP address family +! is configured, it immediately runs on all IPv6-enabled interfaces. +! The following af-interface default section therefore stops this EIGRP instance +! from automatically running on all IPv6-enabled interfaces. Selected interfaces +! are then added to this instance in their specific af-interface sections. + +af-interface default +shutdown +exit-af-interface +! +af-interface Loopback0 +no shutdown +exit-af-interface +! +af-interface FastEthernet0/0 +no shutdown +exit-af-interface + +! Here, the Active timer defining the maximum time for a diffusing computation +! is shortened to one minute. + +topology base +timers active-time 1 +exit-af-topology +exit-address-family + +After briefly getting used to the new location of familiar commands, the named mode configuration comes off as a very natural way of configuring EIGRP and all related set-tings in a single place. + +A few notes about the named mode are in order. The named mode is entered using the router eigrp name global configuration command, where name is an arbitrary text name, also called a virtual instance name, of the EIGRP process. Multiple-name EIGRP pro-cesses can be started on a single router as long as their names are unique. The process name is not sent in EIGRP messages; it is a locally significant value and is never compared to process names on other routers. + +Each named EIGRP process can hold only a single instance for an address family. In other words, it is not allowed to run two or more instances for the same address family inside +a single named EIGRP process. If it is necessary to run, say, two IPv4 EIGRP instances, one for AS number 1 and the other for AS number 64512, each of them must be placed into a separate EIGRP process with a unique name. Also, two or more distinct named EIGRP processes cannot run the same address family instance with the same AS number. Simply put, there is a one-to-one correspondence between an EIGRP named process and an address family instance with a particular AS number. +414 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +On the other hand, running several different address families under a single named EIGRP process is perfectly allowed, as shown in Example 8-14. In this case, the AS numbers of EIGRP instances for individual address families in the same EIGRP process do not even need to match (meaning that you can run an IPv4 instance for AS number 1 and an IPv6 instance in the same process for AS number 2), but such a configuration is confusing at best, so it is not recommended. + +Readers familiar with the classic mode configuration of IPv6 EIGRP surely remember the fact that an IPv6 EIGRP process was shut down by default after configuring it, and a no shutdown command was necessary to actually start it. In the named configuration mode, this is no longer true. In fact, there is an opposite extreme already described in Example 8-14: As soon as you configure an IPv6 address family, it automatically adopts all interfaces on which IPv6 has been enabled (even a link-local address is sufficient) and starts running on them. As this is usually not the desired behavior for production net-works, Example 8-14 shows how to use the af-interface default section to first keep the IPv6 address family instance off all interfaces, and only activate it on selected interfaces later. Note the difference between deactivating an EIGRP address family instance on an interface using the shutdown command and declaring an interface as passive using the +passive-interface command (both used in an af-interface section): No EIGRP adjacencies will be formed over a passive interface, but its global prefixes will still be advertised over other interfaces. Deactivating an EIGRP address family instance makes the EIGRP com-pletely ignore the interface, not forming any adjacencies over it and also not advertising any of its prefixes. + +Let us now have a closer look at the commands available in each of the three AF-related sections of named EIGRP configuration. + +Key Address Family Section +Topic This section is where any configurations specific to the EIGRP process itself are applied. +Commonly used commands include network and neighbor statements, or a manual EIGRP Router ID specification. It is also the section that holds the per-AF-interface and per-AF-topology sections. Example 8-15 shows the first-order commands available in the IPv4 Address Family section. + +Example 8-15 EIGRP Address Family Configuration Mode + +R1(config-router-af)# ? +Address Family configuration commands: + +af-interface +default +eigrp +exit-address-family +help +maximum-prefix +metric +neighbor +network + +Enter Address Family interface configuration +Set a command to its defaults +EIGRP Address Family specific commands +Exit Address Family configuration mode +Description of the interactive help system +Maximum number of prefixes acceptable in aggregate +Modify metrics and parameters for advertisement +Specify an IPv4 neighbor router +Enable routing on an IP network +Chapter 8: EIGRP 415 + + +no +shutdown +timers +topology + +Negate a command or set its defaults +Shutdown address family +Adjust peering based timers +Topology configuration mode + + + +Per-AF-Interface Configuration Section +Key +Topic This configuration section is where all EIGRP interface-specific commands are applied. +Except non-EIGRP-specific commands such as bandwidth and delay (although arguably, the delay is used only by EIGRP), every other EIGRP-related command can now be con-figured in this section. This includes, but is not limited to, features such as EIGRP authen-tication, Split Horizon, and manual summarization. Example 8-16 shows the list of all first-order commands available in a per-AF-interface section for a selected interface. Note that the list of commands for the af-interface default section would omit the summary-address command; otherwise the list of supported commands would be identical. + +Example 8-16 EIGRP Address-Family Interface Configuration Mode + +R1(config-router-af-interface)# ? +Address Family Interfaces configuration commands: + +add-paths +authentication +bandwidth-percent +bfd +dampening-change +dampening-interval +default +exit-af-interface +hello-interval +hold-time +next-hop-self +no +passive-interface +shutdown +split-horizon +summary-address + +Advertise add paths +authentication subcommands +Set percentage of bandwidth percentage limit +Enable Bidirectional Forwarding Detection +Percent interface metric must change to cause update +Time in seconds to check interface metrics +Set a command to its defaults +Exit from Address Family Interface configuration mode +Configures hello interval +Configures hold time +Configures EIGRP next-hop-self +Negate a command or set its defaults +Suppress address updates on an interface +Disable Address-Family on interface +Perform split horizon +Perform address summarization + + +One of the neat consequences of having all EIGRP-related interface commands central-ized in the af-interface section is that there is no longer a requirement for the eigrp key-word in any of these commands. This globalizes the EIGRP commands against the format used through any of the other routing protocols, and simultaneously provides a place for all configurations that affect the operation, implementation, and regulation of EIGRP as a whole. +416 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Key Per-AF-Topology Configuration Section +Topic This configuration mode relates to the support of multiple routing topologies in EIGRP. +While multiple routing topologies are outside the scope of CCIE Routing and Switching certification, a few words are certainly useful as the named EIGRP mode always presents us with the topology base configuration section. + +Within the context of Multi Topology Routing, a topology is defined as a subset of rout-ers and links in a network for which a separate set of routes is calculated. The entire net-work itself, for which the usual set of routes is calculated, is known as the base topology . The base topology is the default routing environment that exists prior to enabling MTR. Any additional topologies are known as class-specific topologies and are a subset of the base topology. Each class-specific topology carries a class of traffic and is characterized by an independent set of Network Layer Reachability Information (NLRI) that is used to maintain separate routing tables and FIB databases. This design allows the router to per-form independent route calculation and forwarding for each topology. Multiple topolo-gies can be used to segregate different classes of traffic, such as data, voice, and video, and carry them over different links in the same physical network, or to keep separate and independent topologies for IPv4 and IPv6 routing. Multiple topologies are not equivalent to Virtual Routing and Forwarding (VRF) tables because they share the common address space, and they are not intended to provide address conservation or reuse. + +EIGRP is capable of keeping separate routing information for different topologies, and its behavior per specific topology within an address family can be configured in the per-AF-topology section. On routers without MTR support, only the topology base command will be available; on routers supporting MTR, the topology command will allow referenc-ing a particular separate topology table definition by its name. + +Example 8-17 shows the first-order commands available in the topology base section. Note that these commands comprise the most commands related to route and metric handling. + +Example 8-17 EIGRP Address-Family Topology Configuration Mode + +R1(config-router-af-topology)# ? +Address Family Topology configuration commands: + +auto-summary +default +default-information +default-metric +distance +distribute-list +eigrp +exit-af-topology +maximum-paths +metric +no +offset-list +redistribute + +Enable automatic network number summarization +Set a command to its defaults +Control distribution of default information +Set metric of redistributed routes +Define an administrative distance +Filter entries in eigrp updates +EIGRP specific commands +Exit from Address Family Topology configuration mode +Forward packets over multiple paths +Modify metrics and parameters for advertisement +Negate a command or set its defaults +Add or subtract offset from EIGRP metrics +Redistribute IPv4 routes from another routing protocol +Chapter 8: EIGRP 417 + + +snmp +summary-metric +timers +traffic-share +variance + +Modify snmp parameters +Specify summary to apply metric/filtering +Adjust topology specific timers +How to compute traffic share over alternate paths +Control load balancing variance + + +To sum up the EIGRP named mode configuration, as you might have learned by now, everything you know about EIGRP classic mode configuration still applies in the EIGRP named mode. The only slight inconvenience is related to relearning the placement of the well-known commands into individual per-AF sections. + +Together with the named mode, related show commands have also been updated. Instead of show ip eigrp ... the new show eigrp address-family ipv4 ... syntax is used. Similarly, instead of show ipv6 eigrp ... the new show eigrp address-family ipv6 ... syntax is used. The older show commands will still be accepted, though, even if EIGRP is configured +in the named mode. Be aware, though, that for new EIGRP features, relevant show com-mands might be only available in the new command syntax. + +Additional and Advanced EIGRP Features This section covers selected advanced EIGRP features. + +Key Router ID +Topic As with many protocols, EIGRP also uses a concept of a Router ID (RID), a single 4-byte +number representing a particular router instance. Each address family instance has its own independent RID. It is however allowed for multiple EIGRP processes and address family instances on the same router to use the same RID. + +Originally, the primary use of the EIGRP RID has been to prevent routing loops in EIGRP environments using redistribution. The RID identifies the originating router for external routes injected into the EIGRP domain. Each external route was attached the RID of the router that redistributed it into EIGRP. If an external route is received with the same RID as the local router, the route is discarded. This feature is designed to reduce the possibil-ity of routing loops in networks where route redistribution is being performed on more than one router. EIGRP RID was not originally advertised with internal routes. + +With recent IOS releases, however, the EIGRP RID is also advertised with internal routes. As a result, each route advertised in EIGRP, internal or external, carries the RID of the router that injected it into EIGRP. The logic of using the RID remains the same—a router will discard every received route carrying the router’s own RID. Example 8-18 shows the EIGRP RID carried along with advertised routes. +418 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 8-18 EIGRP Router ID + +! The 10.0.2.0/24 is reported as internal, yet the route carries the RID +! of the advertising router – it is 10.255.255.2. + +R1# show eigrp address-family ipv4 topology 10.0.2.0/24 +EIGRP-IPv4 VR(CCIE) Topology Entry for AS(1)/ID(10.255.255.1) for 10.0.2.0/24 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 13189120, RIB is 103040 +Descriptor Blocks: +10.0.0.2 (FastEthernet0/0), from 10.0.0.2, Send flag is 0x0 +Composite metric is (13189120/163840), route is Internal +Vector metric: +Minimum bandwidth is 100000 Kbit +Total delay is 101250000 picoseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +Originating router is 10.255.255.2 + +! The next output shows a redistributed route 192.0.2.0/24 also carrying +! the originating router's ID. It is 10.255.255.2, also originated by the same +! router as before. + +R1# show eigrp address-family ipv4 topology 192.0.2.0/24 +EIGRP-IPv4 VR(CCIE) Topology Entry for AS(1)/ID(10.255.255.1) for 192.0.2.0/24 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 13172736, RIB is 102912 +Descriptor Blocks: +10.0.0.2 (FastEthernet0/0), from 10.0.0.2, Send flag is 0x0 +Composite metric is (13762560/7208960), route is External +Vector metric: +Minimum bandwidth is 100000 Kbit +Total delay is 110000000 picoseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 1 +Originating router is 10.255.255.2 +External data: +AS number of route is 0 +External protocol is Static, external metric is 0 +Administrator tag is 0 (0x00000000) +Chapter 8: EIGRP 419 + +The rules of RID value selection are the same as with OSPF. First, the eigrp router-id command in EIGRP configuration is preferred. If not configured, the highest IP address among nonshutdown loopback interfaces is chosen as the RID. If no loopback interfaces are configured or active, the highest IP address among all other nonshutdown interfaces is used as the RID. After it is chosen, the RID will not be reinitialized until the EIGRP process is removed, the RID is manually configured, or a manually configured RID is removed. If you are configuring RID manually using the eigrp router-id command, +the values 0.0.0.0 and 255.255.255.255 are disallowed. Any other RID value is valid and usable. If a router’s RID changes, it drops and reestablishes its adjacencies; a brief connec-tivity outage might therefore ensue. + +When you are changing interface addresses of a running router without restarting it, the EIGRP RID will remain unchanged. This can cause unpleasant issues when a new router is introduced into the network, retaking other routers’ addresses and tasks, while the old router is renumbered without restarting it. As a result, it is possible that these two rout-ers have the same EIGRP RID and they will not learn routes injected into EIGRP by each other. There is no logging message to point to this phenomenon, apart from a relatively obscure logging message in the EIGRP event log, as shown in Example 8-19. + +Example 8-19 Message in EIGRP Event Log If Route Is Denied Because of Duplicate RID + +! The 172.16.1.0/24 route is ignored in a received update because the RID +! of the router that injected the route into EIGRP matches this router's RID. + +R7# show eigrp address-family ipv4 events +Event information for AS 1: +1 19:15:07.806 Ignored route, metric: 172.16.1.0/24 metric(3283435520) +2 19:15:07.802 Ignored route, dup routerid int: 10.255.255.1 +! Output omitted + +Finding out the current RID value was originally somewhat cumbersome. In older IOS revisions, the only place that displayed the router’s RID was the heading of the show ip eigrp topology and show ipv6 eigrp topology command output, as shown in Example 8-18. Starting with IOS Release 15.0(1)M, there is a new show eigrp protocols command that also contains information about the EIGRP RID. In newer IOS revisions, the EIGRP RID is displayed in the show ip protocols command output as well. + +Example 8-20 demonstrates the ways of displaying the RID. The router on which this output was captured is the R1 router configured according to Example 8-14. Its RID is initialized from a loopback interface 10.255.255.1/32. + +Example 8-20 EIGRP Router ID + +! The following two commands all display the same output, as for both IPv4 +! and IPv6, this router uses the same RID. In place of these commands, +! the new show eigrp address-family ipv4 topology +! and show eigrp address-family ipv6 topology commands can be used. +420 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +R1# show ip eigrp topology | i Topology +EIGRP-IPv4 VR(CCIE) Topology Table for AS(1)/ID(10.255.255.1) +R1# show ipv6 eigrp topology | i Topology +EIGRP-IPv6 VR(CCIE) Topology Table for AS(1)/ID(10.255.255.1) + +! The show eigrp protocols command covers all configured processes and address +! family instances in a single output. RID is displayed in the Router-ID line. + +R1# show eigrp protocols +EIGRP-IPv4 VR(CCIE) Address-Family Protocol for AS(1) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 K6=0 +Metric rib-scale 128 +Metric version 64bit +NSF-aware route hold timer is 240 +Router-ID: 10.255.255.1 +Topology : 0 (base) +! Lines omitted for brevity + +EIGRP-IPv6 VR(CCIE) Address-Family Protocol for AS(1) +Metric weight K1=1, K2=0, K3=1, K4=0, K5=0 K6=0 +Metric rib-scale 128 +Metric version 64bit +NSF-aware route hold timer is 240 +Router-ID: 10.255.255.1 +Topology : 0 (base) +! Lines omitted for brevity + + +Unequal-Cost Load Balancing + +Unlike most internal routing protocols, EIGRP has a feature that allows you to distribute the load of your traffic across multiple unequal-cost paths and not just over paths provid-ing the least distance to a destination. This feature is amply named unequal-cost load balancing . + +The key to unequal-cost load balancing is the presence of Feasible Successors. These routers provide a guaranteed loop-free path to the destination, although not necessarily the shortest one. Precisely this fact can be leveraged by EIGRP: Paths through Feasible Successors can be installed to the routing table and used along with the best available path even when the route is in the Passive state. + +Unequal-cost load balancing is enabled through the variance multiplier command. In named mode, the variance is configured in the topology base section. The multiplier value essentially defines how many times worse than the best path a route through a Feasible Successor can be to be still used by EIGRP for unequal-cost load balancing. More precisely, if the variance is set to the value V, for each destination individually, the +Chapter 8: EIGRP 421 + + + + +Key Topic + +router checks whether any path over a Feasible Successor meets the following condition (CD stands for Computed Distance): +CD via Successor < CD via Feasible Successor in question < V ´ CD via Successor +If it does, it will be installed into the routing table through the corresponding Feasible Successor. + +A multiplier of 1, which is the default, implies that no unequal-cost load balancing is being performed. The current value of the variance multiplier can always be verified in the show ip protocols command output. + +If multiple unequal-cost paths to a destination are installed into the routing table, the router will forward proportionally less traffic over the worse paths, and vice versa. The amount of traffic flowing over a particular path can be computed as this ratio: + +Highest Installed Path Metric / Path Metric +As an example, if there are four paths over Successors and Feasible Successors to a desti-nation with metrics 1100, 1100, 2000, and 4000, the amounts of traffic over these paths would be 4000/1100 = 3, 4000/1100 = 3, 4000/2000 = 2, and 4000/4000 = 1, so the true traffic share ratio would be 3:3:2:1 (recall that IOS routers perform integer division). + +It is once again important to realize that the key to performing unequal-cost load balanc-ing is first to have Feasible Successors toward a destination identified in the topology table. Routers that do not meet the Feasibility Condition and thus are not considered Feasible Successors are not considered in the unequal-cost load balancing, either. To uti-lize several neighbors as Feasible Successors, you might need to perform judicious metric tweaking so that the neighbors pass the Feasibility Condition check. + +Keep in mind that the unequal-cost paths installed into the routing table also count toward the maximum number of parallel paths to a destination configured using the maximum-paths command. Depending on your network topology and requirements, it +might be necessary to modify this setting. + + + +Add-Path Support + + + + + + + + + + + +Key Topic + +In certain scenarios, such as Dynamic Multipoint VPN (DMVPN) deployments in which multiple branch offices are dual homed, hub routers usually have information about both routes to a particular dual-homed branch office, and can perform equal-cost load balanc-ing on their end. However, without an additional mechanism, a hub is unable to advertise these equal-cost routes to other spoke routers. As a result, the other spokes only see a single route to the dual-homed branch office without an ability to perform load balancing over multiple paths, and if the single route they know about fails, they need to go over the usual reconvergence process in EIGRP to learn about the other route. + +To support these scenarios, starting with IOS Release 15.3(2)T, EIGRP was extended with a so-called Add-Path support, allowing a hub to advertise multiple equal-cost routes to the same destination. The prerequisite for a hub router to be able to advertise multiple equal-cost routes is to first have them installed in its routing table. This might require tun- +ing the metrics and the maximum-paths command value first. Also, the hub router must +422 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +have the Split Horizon deactivated on the multipoint tunnel interface toward individual spokes. + +The Add-Path feature can be configured only in the named mode, and is controlled on a per-interface basis using the add-paths path-count command in the af-interface section. The add-paths command allows advertising additional path-count equal-cost routes in addition to the route that would be advertised nonetheless. The path-count is a manda-tory argument in the range of 1 to 4. Using the Add-Path feature, therefore, at most four additional equal-cost paths to any destination can be advertised from a hub router, in total allowing the spokes to learn about five different equal paths to a particular des-tination. + +Spoke routers do not need to be specifically configured for the Add-Path feature, apart from possible tuning of the maximum-paths command to be allowed to insert multiple equal-cost paths into their routing tables. + +The Variance (Unequal Cost Load Balancing) and Add-Path features are not compatible with each other. When using the Add-Path, always be sure to set the variance to 1. + +Example 8-21 shows the use of the Add-Path feature. + +Example 8-21 Configuring the EIGRP Add-Path Feature + +! First, the variance is deactivated, and the maximum-paths is set to 6. +! Then, on the Tunnel0 interface, split horizon is deactivated (a mandatory +! step; otherwise, multiple equal cost paths cannot be advertised to spokes). +! In addition, the next-hop-self setting must be deactivated, allowing the R1-Hub +! to retain the original next hop value instead of asserting itself as the +! next hop. Finally, the add-paths 4 allows advertising additional 4 equal-cost +! routes to a destination if the hub knows about them via the same EIGRP process +! instance and has them installed in its own routing table. + +R1-Hub(config)# router eigrp CCIE +R1-Hub(config-router)# address-family ipv4 unicast autonomous-system 1 +R1-Hub(config-router-af)# topology base +R1-Hub(config-router-af-topology)# variance 1 +R1-Hub(config-router-af-topology)# maximum-paths 6 +R1-Hub(config-router-af-topology)# exit +R1-Hub(config-router-af)# af-interface Tunnel0 +R1-Hub(config-router-af-interface)# no split-horizon +R1-Hub(config-router-af-interface)# no next-hop-self +R1-Hub(config-router-af-interface)# add-paths 4 + +The no next-hop-self command has an additional no-ecmp-mode keyword not included in Example 8-21. To understand what this keyword does, first assume a topology in which a DMVPN hub is dual homed itself, using two ISPs and two different multipoint tunnel interfaces to reach the spoke routers. It is now possible for the hub to learn about equal-cost paths to a spoke site over each tunnel interface, for example, two equal-cost paths over Tunnel1 and next hops N11 and N12, and two more equal-cost paths over +Chapter 8: EIGRP 423 + +Tunnel2 and next hops N21 and N22. When using the next-hop-self command on these tunnel interfaces, EIGRP internally optimizes its work: It takes only the first entry in the +topology table (obviously pointing to a Successor) and verifies whether the Successor is reachable over the tunnel interface through which the route is going to be readvertised (thanks to deactivated Split Horizon), and if it is, the hub will keep the Successor address in the advertisement, not asserting itself as the next hop. Additional entries in the topol-ogy table are not subject to this test. This can lead to the no next-hop-self setting on an interface being ignored for an advertised route, causing the hub router to impose itself +as the next hop even though it is not supposed to. For example, if the first entry in the +topology table is learned over Tunnel1 and next hop N11, this route will be advertised over the Tunnel2 interface with the hub imposing itself as the next hop. The fact that +the same route with the same cost is also learned over Tunnel2 and next hops N21 and +N 22 reachable on this interface, and should in fact be subject to no next-hop-self, will be ignored. + +The no-ecmp-mode command deactivates this internal optimization and forces EIGRP to always walk over all equal-cost paths to a destination recorded in the topology table, making sure that if any of these routes’ Successors can be reached over the interface +on which the route is going to be readvertised, the no next-hop-self command will be honored and the Successor’s address will be retained in the advertisement. The use of no-ecmp-mode is recommended with the Add-Path feature if the hub uses multiple tunnel interfaces to reach the spoke sites. + +Stub Routing + +Stub routing is an EIGRP feature primarily designed to improve network scalability and stability. The stub routing feature is most commonly used in hub-and-spoke networks. This feature is configured only on spoke routers. When configured on a spoke router, the router announces its stub router status using an additional TLV in its EIGRP Hello mes-sages. The results of configuring a router as a stub are multifold: + + +■ Key +Topic + + + +■ + + + +■ + +A stub router does not propagate routes learned through EIGRP to its neighbors, with the exception of EIGRP-learned routes that are explicitly selected using a so-called leak-map construct. This prevents a stub router from ever being considered a Feasible Successor for remote networks by its neighbors and possibly becoming a transit router at some point in the future. + +A stub router advertises only a subset of its own EIGRP-enabled networks to its neighbors. This subset can be defined in the eigrp stub command using the sum-mary, connected, static, redistributed, and receive-only keywords. + +Neighbors of a stub router aware of its stub status (thanks to the specific TLV in the stub router’s Hello packets) will never send a Query packet to a stub router. This pre-vents the neighbors from converging through a stub router to reach networks that are +remote to the stub router. +424 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +There is a slight misunderstanding related to how a stub router itself handles Queries. Several sources, including documents on the Cisco website, insist that a stub router sum-marily responds to every received Query immediately with a Reply indicating infinite distance. This is not entirely true. The following rules summarize the stub router behavior with respect to handling Query packets: + + +■ Key +Topic +■ + +Originating Query packets is not modified in any way. Rules for entering the Active state and sending Queries are precisely the same. + +Processing received Query packets depends on what network was queried for. If the network in the received Query is a network the stub router is allowed to adver-tise, meaning that it falls under the configured category of summary, connected, static, or redistributed, the router will process the Query normally (even possi-bly causing the stub router to become Active itself) and send back an appropriate +Reply. The same is valid for an EIGRP-learned network that is allowed to be further advertised using a leak-map—a Query for such a network would be processed and responded to in the usual way. If the Query contains a network that the stub router knows about but is not allowed to advertise (the network does not fall under the configured category, or is learned through EIGRP but not allowed for further adver-tisement by a leak-map), it will be processed in the usual way as described earlier, but the Reply will always indicate infinite distance, regardless of what the stub router truly knows about the network. Receiving a Query for an unknown network will immediately cause the router to respond with a Reply and an infinite distance; how- +ever, this is regular EIGRP behavior not related to the stub feature. + + +At this point, you might ask why a stub router would receive a Query, as its stub status should instruct its neighbors to avoid sending Queries to it. There are two primary rea-sons why even a stub router might receive a Query. First, a stub router’s neighbor might be running an old IOS that does not recognize the stub TLV yet. Such a neighbor will cre-ate an adjacency to a stub router just fine, but it will also happily send Queries to it, not knowing that the router is a stub router. Second, if there are multiple routers on a com-mon segment and all of them are configured as stub routers, if any of these stub routers need to send a Query, it will also send it to all its stub neighbors. This is done to support multihomed branch offices that usually have two branch routers configured as stubs. Each of these branch routers is connected to the headquarters through its own uplink, and they are also connected together by a common intra-site link. If the uplink on one of the branch routers fails, the affected router needs to converge through its neighbor branch router, and this might require a permission to send Queries to its fellow stub neighbor. Therefore, on a common segment with all routers configured as stubs, Queries are sent as usual. + +In case of multiaccess segments with mixed neighbors (stub and nonstub), EIGRP solves the problem of sending Queries only to nonstub neighbors in two ways: Either it sends the Queries as unicasts to the nonstub neighbors or it uses the Conditional Receive mode in RTP to send multicast Queries in such a way that only nonstub routers will process them. The choice of a particular mechanism depends on the number of nonstub neighbors. While mixing stub and nonstub routers on a common segment is not a recom-mended practice, it is inevitable, for example, in cases where the hubs and spokes are interconnected by a DMVPN or a VPLS service. +Chapter 8: EIGRP 425 + +The EIGRP stub routing feature provides important advantages when implemented in hub-and-spoke networks: + +■ It prevents suboptimal routing from occurring within hub-and-spoke networks. + +■ It prevents stub routers with low-speed links from being used as transit routers. + +■ It significantly limits the number of Query packets and the depth of their propaga-tion, allowing the EIGRP network to convergence faster and avoid the SIA states. + +The advantage of limiting the propagation of a Query packet should be immediately obvious. Assume a network with 100 branch office routers, each of these branch office routers being connected through a pair of point-to-point links to hub routers at the headquarters (dual-hub design). Any Query originating at the headquarters can possibly propagate to any branch office router through both links, and if a branch router is unable to respond, it might need to originate a Query itself. The number of Queries and Replies expected grows easily to orders of hundreds. A single misbehaving router, or an over-loaded or faulty link, can cause major trouble and the diffusing computation will have difficulties terminating, again risking the SIA state. With the stub feature, these issues are eliminated easily. + +Stub routing is enabled with the router process command demonstrated in Example 8-22. In named mode, the eigrp stub command is used in the particular address family section. + +Example 8-22 EIGRP Stub Router Configuration + +Router(config-router)# eigrp stub ? + +connected +leak-map +receive-only +redistributed +static +summary + + +Do advertise connected routes +Allow dynamic prefixes based on the leak-map +Set IP-EIGRP as receive only neighbor +Do advertise redistributed routes +Do advertise static routes +Do advertise summary routes + + +The receive-only keyword configures the router as a receive-only router. In other words, when this keyword is used, the stub router does not advertise any prefixes. It only receives prefixes advertised to it by its neighbors. Obviously, either static routing on its neighbors or NAT/PAT on the stub router is required in this case to allow the networks behind the stub router to communicate with the outside world. This keyword cannot be used with any other keywords when configuring stub routing. + +The leak-map name keyword configures the stub router to advertise selected EIGRP-learned routes that would not be ordinarily advertised. The name references a route-map that matches one or more ACLs or prefix lists that permit the matched subnets or addresses to be leaked. This leaking is crucial in scenarios where a branch office uses a pair of interconnected routers configured as stub routers. If these routers are to provide backup connectivity to each other, they must be allowed to readvertise EIGRP-learned routes to each other, even in stub mode. Route leaking accomplishes that. +426 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The connected keyword configures the stub router to advertise connected subnets. These are subnets on any interface directly connected to the router. Note that the directly con-nected interfaces will not be advertised automatically; it is still necessary to add them to EIGRP using the usual network command. + +The static keyword configures the stub router to advertise static routes. The static routes need to be redistributed into EIGRP to be advertised. + +The summary keyword configures the stub router to advertise summary routes if config-ured on interfaces. + +The redistributed keyword configures the stub router to advertise routes that have been redistributed into EIGRP from other route sources. + +By default, when this command is enabled without additional keywords, both connected and summary are assumed. + +To check the current stub settings, inspect the show ip protocols output, as shown in Example 8-23. The current stub mode, if any, will be indicated in the output. Also, if it is necessary to verify whether any neighbor is configured as a stub, use the show ip eigrp neighbors detail command. If a neighbor is configured as a stub router, this command will reveal it along with the information about which route categories it is advertising. Keep in mind that activating, deactivating, or modifying the stub feature settings on a router will cause it to drop and reestablish adjacencies with its neighbors. + +Example 8-23 EIGRP Stub Status as Advertised in show Commands + +! On R2, EIGRP Stub is configured. The show ip protocols shows that both +! connected and summary networks will be advertised. + +R2# show ip protocols +Routing Protocol is "eigrp 1" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0 +EIGRP maximum hopcount 100 +EIGRP maximum metric variance 1 +EIGRP stub, connected, summary +Redistributing: eigrp 1 +EIGRP NSF-aware route hold timer is 240s +Automatic network summarization is not in effect +Maximum path: 4 +Routing for Networks: +10.0.0.0 +Routing Information Sources: +Gateway Distance Last Update +Chapter 8: EIGRP 427 + +10.0.12.1 90 00:00:07 +Distance: internal 90 external 170 + +! On R1 which is R2's direct neighbor, the show ip eigrp neighbors detail reveals +! that R2 is a stub connected+summary router, and R1 will not send Queries to R2. + +R1# show ip eigrp neighbors detail +IP-EIGRP neighbors for process 1 +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 10.0.12.2 Se1/0 10 00:03:50 26 300 0 3 +Version 12.4/1.2, Retrans: 1, Retries: 0, Prefixes: 1 +Stub Peer Advertising ( CONNECTED SUMMARY ) Routes +Suppressing queries + +Note that the stub router feature has no impact on what routes the hub router will adver-tise to its stub spokes. Without an additional configuration on the hub router, the spokes will be populated with full routing tables. Considering the fact that in a hub-and-spoke network, any other network beyond the branch networks is reachable through the hub, having full routing tables on spoke routers with most of their entries pointing toward the hub router is not particularly useful. Therefore, in these networks, the stub feature on spokes is usually combined with route filtering and summarization on the hub router. The hub router can be configured to advertise only the default route to the spoke router(s), filtering out all other more specific route entries, effectively reducing the routing table on the spoke to a single EIGRP-learned default route entry. + +Route Summarization + + + + + + + + + +Key Topic + +Already a well-known concept to all CCIE Routing and Switching candidates, route summarization reduces the amount of routing information that routers must exchange, process, and maintain, which allows for faster convergence and less router load within the network. Summarization also restricts the size of an area that is affected by network +changes by hiding the changes in the individual networks behind a single advertised sum-mary route. + +With particular respect to EIGRP, summarization is also a powerful tool to create a boundary for Query propagation: If a router receives a Query for a network it does not have in its topology table, it will immediately send back a Reply indicating an unreachable destination, without itself going active and propagating the Query further. With summa-rization, this is a natural scenario. Neighbors of a router performing route summarization do not know the individual component routes. Queries originated inside the summarized part of network, including those for component routes, will be propagated according +to the usual rules; a router performing route summarization does not modify the Query contents nor influence its flooding scope. However, when a Query asking for a particular component route is forwarded to the summarizing router’s neighbor, this neighbor has no +knowledge of the component, so it immediately responds with a Reply containing infinite +428 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +distance. As a result, summarization causes the propagation of Queries to be bounded by directly connected neighbors of routers that perform route summarization. + +Historically, EIGRP supports two types of route summarization: automatic summariza-tion and manual summarization. Automatic summarization is a concept originally utilized in classful routing protocols, whereby a subnet of a particular major network is advertised as the major network itself if the subnet is to be advertised out an interface that lies in a different major network. In EIGRP, automatic summarization does not apply to external routes unless there is also an internal network that belongs to the same major network as the external routes. EIGRP is a classless protocol, though, and the automatic summariza-tion was implemented in it mostly to provide a smooth transition from classful protocols to EIGRP. However, the concept of automatic summarization is practically unusable in today’s networks, and in fact, starting with IOS Release 15.0(1)M, it is deactivated by default; for older IOS releases, the no auto-summary command should be used in the EIGRP configuration to deactivate it. + +Manual summarization allows summarizing routes at any chosen router and its interface in the network. As opposed to RIP implementation in IOS that does not allow supernet-ting in summarization (using a shorter-than-classful netmask), EIGRP poses no limitations on the particular manual summary address/netmask combination. If it suits you, you can summarize even into a default route. Furthermore, configuring multiple overlapping sum-mary addresses on an interface is also supported—in that case, EIGRP will advertise each configured summary address for which at least one component route exists. This allows for a sort of traffic engineering in which a part of a network with multiple border routers advertises the same summary route covering the entire contained address range from each border router (for example, 172.20.32.0/19), plus each of the border routers also advertis-ing a different, more specific summary route covering only a portion of the contained address range (for example, one border router advertising 172.20.32.0/20 and the other advertising 172.20.48.0/20). Routers in other parts of the network will learn both the less specific summary route from all border routers, thereby knowing that each border router can be used to reach this prefix, and the more specific summaries, each advertised from +a different border router. Thanks to the longest prefix match paradigm in IP routing, traf-fic to different destinations in the summarized part of the network will first follow the path through the border router that advertised the more specific summary route matching the destination. Only if that border router is unavailable or does not advertise the more specific summary, traffic will follow the shortest route toward the less specific summary through the nearest border router. + +In EIGRP, manual summarization is configured on a per-interface basis. If you are using the classic configuration mode, summarization is configured directly on an interface using the ip summary-address eigrp autonomous-system address netmask [ distance ] [ leak-map name ] command. In named mode, summarization is configured in the cor- +responding af-interface section using the summary-address address netmask [ leak-map name ] command. The optional leak-map argument allows referring to a route-map to allow more specific components of the summary route to be selectively advertised as unsummarized along with the summary route. This is used in certain scenarios where leaking a particular component route helps to avoid suboptimal routing toward it. +Chapter 8: EIGRP 429 + + + +Key Topic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + + + +Key Topic + +Whenever a summary route is advertised, the router performing the summarization auto-matically installs a so-called discard route for this summary route into its routing table. The network and netmask in this discard route are identical to the network and netmask of the advertised summary, and the outgoing interface is set to Null0. The discard route prevents suboptimal routing or routing loops in situations when a router advertises a summary route but has no knowledge of a more specific matching subnet for incoming traffic. By virtue of the longest prefix match rule, any known component routes of a summary route would be matched in the routing table before hitting the corresponding discard route, and hence routed normally. For any presently unknown destinations within an advertised summary, the discard route makes sure that the traffic is dropped rather than routed over a possibly unrelated route, such as a default route. + +A discard route’s administrative distance is 5 by default. In most scenarios, it is not nec-essary to modify it. However, there are situations in which the summarizing router is configured to advertise a manual summary route exactly matching a route that is already learned by the router from another source. In that case, adding the corresponding discard route can possibly replace the learned route in the routing table, rendering it unreachable. For example, when summarizing into the default route, the router will attempt to install +a discard route to 0.0.0.0/0 into its routing table. If there already is a default route in the routing table with its administrative distance higher than 5, the discard route will replace it, causing the router to lose connectivity provided by the former default route. In such cases, it is necessary to raise the discard route’s administrative distance above that of the learned route. This can be accomplished using either the admin-distance optional argu-ment in the ip summary-address eigrp per-interface command when using classic con-figuration mode, or in the named mode by entering the topology base section and using the summary-metric address netmask distance admin-distance command. In recent IOS releases that support the named EIGRP configuration mode, the admin-distance argument is removed from the ip summary-address eigrp command, and the summary-metric command in the topology base mode must be used to change the administrative distance. + +Be careful about setting the discard route’s administrative distance to 255. In earlier IOS releases, this prevented the discard route from being installed into the routing table, but the summary address was nonetheless advertised. In more recent IOS releases, setting the administrative distance of a discard route to 255 not only prevents the router from install-ing the discard route into its routing table, but it also causes it to stop advertising the summary route altogether. In other words, neither the summary route nor the component routes will be advertised to neighbors, and the discard route will not be installed into the routing table. This is similar to the OSPF area range address mask not-advertise com-mand, which essentially prevents all routes falling under the defined address and mask from being advertised, not even advertising the summarized route or installing a discard route. + +By default, when an EIGRP router originates a summary route, it looks up the lowest met-ric from among all known component routes that are covered by this summary, and uses this metric as the metric of the summary route itself. This means, however, that whenever the lowest metric from among all known component routes changes, EIGRP has to select +the new lowest metric and advertise the summary route again with an updated metric. +430 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +In scenarios when multiple hundreds or thousands of component routes are summarized into a single summary route, walking through this number of routes and identifying the new lowest metric each time a component route is updated (added, removed, its metric changed) can be CPU intensive, and at the same time, not worth the effort: The summary route itself does not change; only its metric is updated. Therefore, the summary-metric command in the topology base section can also be used to define a static metric for a particular summary route. The summary route will then always be advertised with the configured metric, relieving the router of the need to walk the topology table to identify the least metric of covered components. + +Example 8-24 shows the use of summarization commands in named mode, and selected commands to verify whether the summarization has been configured properly. + +Example 8-24 Summarization Configuration and Verification in Named Mode + +! A prefix list and a route-map for route leaking are configured, allowing +! the 172.20.63.0/24 prefix to be leaked unsummarized + +R2(config)# ip prefix-list LeakPrefixes permit 172.20.63.0/24 +R2(config)# route-map EIGRPLeak permit 10 +R2(config-route-map)# match ip address prefix-list LeakPrefixes + +! In the EIGRP process, manual summarization is configured on the Fa0/0 interface +! to advertise a summary network of 172.20.32.0/19. Notice that the CIDR notation +! is also accepted in the command. A route-map is referenced in the leak-map +! optional keyword, allowing the prefixes permitted by the route-map to be +! advertised unsummarized along with the summary route. + +R2(config-route-map)# router eigrp CCIE +R2(config-router)# address-family ipv4 unicast autonomous-system 1 +R2(config-router-af)# af-interface FastEthernet0/0 +R2(config-router-af-interface)# summary-address 172.20.32.0/19 leak-map EIGRPLeak +R2(config-router-af-interface)# exit-af-interface + +! For this summary address, a static metric is configured in standard EIGRP +! component form, specifying the bandwidth of 1000000, delay of 1, reliability +! of 255, load of 1, and MTU of 1500. Setting the metric of the summary route +! statically allows the router to save CPU cycles by alleviating it from +! the need to traverse the topology table and search for the minimum metric +! among all covered component routes. Also, the administrative distance of the +! discard route is set to 10. For typographical reasons, the command keywords +! have been truncated; summary-m stands for summary-metric, dist stands for distance + +R2(config-router-af)# topology base +R2(config-router-af-topology)# summary-m 172.20.32.0/19 1000000 1 255 1 1500 dist 10 +R2(config-router-af-topology)# exit-af-topology +Chapter 8: EIGRP 431 + +! There are several ways to verify the configured summarization. Following are +! selected ways of checking whether the summarization is configured and active. +! The show ip protocols command will list all configured summaries and interfaces +! they are placed on, including the advertised computed metric. In show ip route +! the corresponding discard route will be shown if the summary is being advertised, +! and the EIGRP topology table will contain the advertised summary route with +! the Null0 as the next hop interface. + +R2(config-router-af)# do show ip protocols | section Summ +Automatic Summarization: disabled +Address Summarization: +172.20.32.0/19 for Fa0/0 +Summarizing 32 components with metric 1310720 + +R2(config-router-af)# do show ip route eigrp | i Null +D 172.20.32.0/19 is a summary, 00:31:34, Null0 + +R2(config-router-af)# do show eigrp address-family ipv4 topology 172.20.32.0/19 +EIGRP-IPv4 VR(CCIE) Topology Entry for AS(1)/ID(10.255.255.2) for 172.20.32.0/19 +State is Passive, Query origin flag is 1, 1 Successor(s), FD is 1310720, RIB is 10240 +Descriptor Blocks: +0.0.0.0 (Null0), from 0.0.0.0, Send flag is 0x0 +Composite metric is (1310720/0), route is Internal +Vector metric: +Minimum bandwidth is 1000000 Kbit +Total delay is 10000000 picoseconds +Reliability is 255/255 +Load is 1/255 +Minimum MTU is 1500 +Hop count is 0 +Originating router is 10.255.255.2 +R2(config-router)# + + +Passive Interfaces + +When EIGRP is enabled for a network, the router begins to send out Hello packets and process incoming EIGRP packets on all interfaces that fall within the specified network range. This allows EIGRP to dynamically discover neighbors and establish network rela-tionships, as we have previously discussed. This is desired on interfaces that are actually connected toward neighboring routers. However, this default behavior also results in an unnecessary waste of router resources on logical interfaces, such as loopback interfaces, that will never have any other device connected or have an EIGRP neighbor relationship form. Also, it is useless, even dangerous, to send and process EIGRP packets on interfaces connected to networks with end hosts where no further routers are intended to be. +432 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + + + + + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +To prevent this type of squandering of router resources, you can use the passive-interface command. A passive interface does not send or process received EIGRP pack-ets, but the network configured on the interface is still advertised. In the classic configu-ration mode, the passive-interface command accepts an interface name or the default keyword, causing all interfaces to be considered passive; in that case, the no passive-interface command can subsequently be used to make selected interfaces active again. In the named configuration mode, the passive-interface command is used in the corre-sponding af-interface sections, as already shown in Example 8-24. To make all interfaces +passive by default, use the passive-interface command in the af-interface default section, and no passive-interface in the specific af-interface sections for those interfaces that you want to keep active. + +Graceful Shutdown + +Graceful Shutdown in EIGRP is a long-implemented feature that cannot in fact be con-trolled—it is only used, mostly not even knowing it is there. The Graceful Shutdown allows a router to advertise that it is being deactivated, either on an interface, for a partic-ular address family, or as the entire process, thereby allowing its neighbors to react imme-diately, rather than wait for the Hold timer to expire. Technically, the Graceful Shutdown is accomplished by means of a Goodbye message, which is really a normal Hello packet having all K-values set to 255. + +Classic EIGRP configuration mode allows you to gracefully shut down an EIGRP instance only for IPv6 EIGRP using the shutdown command. IPv4 EIGRP has no direct shutdown command. In the classic mode, the Goodbye message was usually sent when shutting down interfaces, configuring them as passive, removing the related network or ipv6 eigrp commands, or removing the entire EIGRP process or restarting the router. + +In the named mode, the shutdown command can be used in various places: + +■ Directly in the router eigrp mode, causing all configured address family instances +under that process name to be deactivated + + +■ In the particular address family mode, causing the entire particular address family instance to be deactivated + +■ In the particular af-interface section in the address family mode, causing the EIGRP to cease all operations on that interface for the particular address family, effectively ignoring the interface altogether + + +Key Securing EIGRP with Authentication +Topic Since its inception, EIGRP supports Message Digest 5 (MD5) hashing to ensure the integ- +rity of EIGRP messages and to prevent the injection of false routing information into the EIGRP domain. In addition, starting with IOS Releases 15.1(2)S and 15.2(1)T, EIGRP authentication support has been extended with the second-generation Secure Hash Algorithm, also known as SHA-2, in particular, with its 256-bit variant. MD5 authentica- +tion can be configured both in classic and named mode; SHA authentication can only be configured in the named mode. +Chapter 8: EIGRP 433 + +The configuration of EIGRP authentication is fairly straightforward and consists of con-figuring at least one key chain to hold the used keys along with their numbers (also called key IDs), key strings, and optionally the validity time ranges, and activating the authenti-cation on selected interfaces. As with all key chain–based authentication schemes, for the authentication between two neighbors to succeed, they must match on the key ID and key string used to authenticate exchanged packets. The key chain names themselves are used only locally in the configuration and do not need to match. + +With SHA authentication, there is also an option of configuring passwords directly in the interface configuration, without creating key chains. This approach might be slightly simpler to configure; however, it will prevent you from performing a seamless rollover to a new key, as there can always be only a single per-interface key configured. + +If using the classic mode, the per-interface commands to activate MD5 EIGRP authenti-cation are the ip authentication mode eigrp and ip authentication key-chain eigrp com-mands. There is no way to configure EIGRP authentication for all interfaces at once; each EIGRP-enabled interface has to be configured individually. In named mode, per-interface configuration steps are accomplished in the af-interface section using the authentication mode and authentication key-chain commands. If used in the af-interface default sec-tion, the authentication settings will apply automatically to all EIGRP-enabled interfaces; these can be overridden later on selected interfaces using the appropriate af-interface section. + +Example 8-25 shows a process of configuring various types of authentication in EIGRP named mode. Read the comments in the example carefully. + +Example 8-25 EIGRP Authentication + +! Key chain EIGRPKeys with a single key is configured + +R1(config)# key chain EIGRPKeys +R1(config-keychain)# key 1 +R1(config-keychain-key)# key-string EIGRPRocks + +! MD5 authentication is configured on all EIGRP-enabled interfaces, +! using the EIGRPKeys key chain + +R1(config)# router eigrp CCIE +R1(config-router)# address-family ipv4 autonomous-system 1 +R1(config-router-af)# af-interface default +R1(config-router-af-interface)# authentication mode md5 +R1(config-router-af-interface)# authentication key-chain EIGRPKeys +R1(config-router-af-interface)# exit + +! On Fa0/0, the authentication type is overridden to SHA-256, using the key +! configured in the EIGRPKeys key chain. Note a particular peculiarity: +! At the time of writing, the authentication mode hmac-sha-256 command +! required that a password was specified even if a key chain was being used. +434 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! In such case, both will be used for authentication. Also notice that the use of +! the EIGRPKeys key chain is already specified in the af-interface default +! section. Referring to the same key chain in the section for Fa0/0 is +! therefore not required, and the authentication key-chain EIGRPKeys command +! would in fact not appear in the af-interface Fa0/0 section. Nevertheless, +! always specifying it explicitly when SHA-256 authentication with a key chain +! is to be used can be considered a best practice. + +R1(config-router-af)# af-interface FastEthernet0/0 +R1(config-router-af-interface)# authentication mode hmac-sha-256 SomePhonyPass +R1(config-router-af-interface)# authentication key-chain EIGRPKeys +R1(config-router-af-interface)# exit + +! On Fa0/1, the authentication type is overridden to SHA-256, using +! a per-interface configured password. Notice that to specifically stop +! using the EIGRPKeys key chain defined for all EIGRP-enabled interfaces +! in the af-interface default section, the no authentication key-chain command +! is used. Again, always stating it explicitly when a SHA-256 with a per-interface +! password authentication is to be used can be considered a best practice. If no +! default key chain is configured, the command will not appear in the config. + +R1(config-router-af)# af-interface FastEthernet0/1 +R1(config-router-af-interface)# authentication mode hmac-sha-256 BigP4ssw0rd +R1(config-router-af-interface)# no authentication key-chain +R1(config-router-af-interface)# exit + +! Finally, the Serial1/0 interface is entirely exempted from authentication +! that would otherwise apply to it because of the af-interface default section. + +R1(config-router-af)# af-interface Serial1/0 +R1(config-router-af-interface)# no authentication mode +R1(config-router-af-interface)# exit + +! Apart from verifying the configuration using show run | section router eigrp +! the authentication, if any, can be checked for a particular interface by +! the show eigrp address-family ... interfaces detail command. + +R1(config-router-af)# do show eigrp address-family ipv4 int detail fa0/0 +! Lines omitted for brevity +Authentication mode is HMAC-SHA-256, key-chain is "EIGRPKeys" + +R1(config-router-af)# do show eigrp address-family ipv4 int detail fa0/1 +! Lines omitted for brevity +Authentication mode is HMAC-SHA-256, key-chain is not set +Chapter 8: EIGRP 435 + +R1(config-router-af)# do show eigrp address-family ipv4 int detail s1/1 +! Lines omitted for brevity +Authentication mode is md5, key-chain is "EIGRPKeys" + +R1(config-router-af)# do show eigrp address-family ipv4 int detail s1/0 +! Lines omitted for brevity +Authentication mode is not set + +When using key chains, each key can be time limited in its usability to sign sent packets (by the send-lifetime per-key command) and to authenticate received packets (by the accept-lifetime per-key command). If multiple keys in the key chain are eligible to sign egress packets, the key with the lowest key ID will be used. To authenticate received packets, EIGRP will try to use the key indicated by its ID in the received packet if the key is still valid. This behavior allows for a seamless key rollover procedure: + +■ On all routers, add the new key with a higher key ID into the key chain. While the key chain will now hold both the old and the new key, the old key (assuming that it has a lower key ID than the new key) will continue to be used both to sign outgoing packets and authenticate incoming packets. + +■ After the new key has been added to all routers, configure the old key on all routers with a send-lifetime that is already in the past. This will cause each router to stop using the old key and migrate to using the new key. Note that regardless of which key (the old or the new) a router uses to sign outgoing packets, its neighbors will accept them because the particular key ID used to sign a packet is carried in the packet, and both old and new keys are still valid to authenticate received packets. + +■ After the send-lifetime has been set to a past time for the old key on all routers, the entire network now uses the new key both to sign sent and authenticate received packets. The old key can now be removed completely from key chains, completing the migration. + + +Default Routing Using EIGRP + +EIGRP has no dedicated command to inject a default route into an EIGRP domain. Instead, it uses other well-known techniques to advertise a default route: + + +■ Key +Topic +■ + +Redistributing the default route from other routing source into EIGRP, often the most straightforward method. + +Using manual summarization to summarize all advertised routes into a default route. +Often used in hub-and-spoke scenarios, this requires a suitable topology. + + +EIGRP formerly also supported the use of the ip default-network command, originally retaken from IGRP, to flag a specific advertised route as a so-called candidate default network. This network, however, had to be a classful network and had to be advertised in EIGRP in addition to being flagged as a candidate default. The overall configuration required to advertise this classful network into EIGRP and flagging it as a candidate +436 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + +Key Topic + +default network was of the same complexity, if not higher, as redistributing the default route directly. As a result, this approach was seldom feasible, and in recent IOS versions, EIGRP no longer appears to honor the candidate default flag. It is best to avoid using this command altogether. + +Many sources claim that the network 0.0.0.0 command causes EIGRP to generate and inject the default route into the routing domain. Such claims are based on a somewhat confusing behavior of EIGRP: If a static route is configured using only the egress inter-face and not the next-hop IP address, IOS treats this route also as being directly con-nected. As a result, the network command can be used to advertise such a directly +connected static route in EIGRP much like any other directly connected network. If the default route happens to be configured as a static route out an interface, for example, ip route 0.0.0.0 0.0.0.0 Dialer0, using the network 0.0.0.0 command in EIGRP seemingly does the right thing—it makes EIGRP advertise this default route. In reality, however, +configuring network 0.0.0.0 is almost never a good idea: + + +■ It will cause all IPv4-enabled interfaces on the router to be enabled for EIGRP. In other words, EIGRP will start advertising all directly connected IPv4 networks on the router, and it will try to establish adjacencies over any IPv4 interface. + +■ If the default route on the router is not configured specifically as a directly con-nected static route, the network 0.0.0.0 command has no effect on it and will not cause it to be advertised, defeating the entire purpose of configuring it in the first place. + + +Split Horizon + +Split Horizon is a generic distance-vector protocol feature that mandates that a route must not be advertised over an interface used to reach it. This prevents the “re-advertising” +of routing information back to the next hop from which it is learned in the first place. EIGRP in particular uses the Split Horizon with Poisoned Reverse, advertising each learned network out the interface toward its Successor with an infinite metric. + +While Split Horizon with Poisoned Reverse is a powerful loop-prevention mechanism, it is sometimes necessary to deactivate it. This is particularly important in hub-and-spoke networks, where multiple spoke routers are reachable over a single interface on a hub. Examples include neighbors reachable over Frame Relay or ATM multipoint interfaces, or spoke routers reachable through multipoint GRE tunnels in DMVPN deployments. With the Split Horizon with Poisoned Reverse in place, a hub learns about networks from each spoke but is forced to advertise each of these networks as unreachable out the same inter-face toward other spokes. As a result, neither spoke will learn about networks on other spokes. + +If the topology and requirements permit it, the most scalable solution to this issue is to advertise a default route to all spokes, making the hub attract all spoke-to-spoke traffic for which the spokes have no more specific routes. The spoke-to-spoke traffic will then naturally flow through the hub. In cases where this approach is not usable, EIGRP can be configured to deactivate the Split Horizon with Poisoned Reverse on a per-interface basis. +Chapter 8: EIGRP 437 + +In the classic mode, the no { ip | ipv6 } split-horizon eigrp interface command can be used to deactivate the Split Horizon. In the named mode, the corresponding no split-horizon command in an af-interface section can be used. + +EIGRP Over the ToP + + + + + + + + + + + + + + + + + + + + + + +Key Topic + +A fairly recent addition to the EIGRP feature collection is the so-called Over the ToP, or OTP. This feature allows creating overlay multipoint VPNs between customer edge rout-ers running EIGRP without any special cooperation with the service provider that oper-ates the network interconnecting the edge routers, greatly simplifying many issues that usually arise with operating a possibly multihomed Layer 3 VPN over a service provider’s network. + +The key to the OTP functionality is the Locator/Identifier Separation Protocol, or LISP. While LISP is beyond the scope of the CCIE Routing and Switching exam, it is necessary to explain its basic principles very briefly to understand how EIGRP and OTP make use of it. + +In traditional understanding, an IP address consists of two parts: the network prefix and the host suffix (the network ID and the host ID). In essence, the network prefix identifies the location of the particular host, while the host suffix identifies the host itself. When the host moves to a different network, its entire IP address changes (possibly both in network and host parts) even though the host is still the same; just its location has changed. Also, because the location and identity are tied together in a single address of a particular type (either IPv4 or IPv6), a single address also implies—and limits—communication with the particular host to the corresponding protocol only. + +The Locator/Identifier Separation Protocol (LISP) aims at decoupling the location of a host from its identity, allowing the host to retain its identity regardless of its location in a network. The general idea in LISP is to separate the identity and location into two inde- +pendent entities, each of them represented by a complete address, and provide a mapping service so that the address representing the identity of a host can be resolved into the address that represents its location. A tunneling mechanism is then used to encapsulate packets between end hosts addressed using end host identities into new packets that are destined to the addresses representing end host locations. This allows a host to change its location while retaining its identity and all open sessions without losing connectivity, and it also allows for interesting IPv4/IPv6 migration scenarios in which the location of a host (say, IPv6) is different from its location (reachable over an IPv4 network). + +More precisely, in LISP, a host has an Endpoint ID, or EID, that identifies its identity that never needs to change. This EID can be an IPv4 address, an IPv6 address, or any other address format as needed, although at the time of this writing, IPv4 and IPv6 were the only supported formats. In Figure 8-9, all hosts at the LISP Site 1 have an EID in the space 10.0.1.0/24, while all hosts at the LISP Site 2 have an EID in the space 10.0.2.0/24. To reach any host at these sites from outside, packets must be tunneled to the router behind which this host is currently located. The outside address of this router effec-tively represents the location of the EID and is denoted as Routing Locator, or RLOC. +Many EIDs can be located behind a single RLOC. In Figure 8-9, the RLOC for all EIDs +438 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +in the space 10.0.1.0/24 is the R1 address 192.0.2.31. The RLOC for all EIDs in the space 10.0.2.0/24 is the R2 address 198.51.100.62. Traffic flowing from the source 10.0.1.11 at LISP Site 1 to the destination 10.0.2.12 at LISP Site 2 will be encapsulated by R1 into new packets and destined to the RLOC of 198.51.100.62, the R2’s address. Responses flowing back to 10.0.1.11 will be encapsulated by R2 and sent to the RLOC of 192.0.2.31, the R1’s address. These routers perform ingress and egress tunneling of traffic that flows between the LISP sites, and are also responsible for making all necessary EID-to-RLOC registra-tion and resolution to allow the LISP sites to communicate successfully. + + +LISP Site 1 + +R1 EID-prefix 10.0.1.0/24 + + +RLOC 192.0.2.31 + +LISP Site 2 + + +EID-prefix 10.0.2.0/24 + + +R2 +10.0.1.11 RLOC 10.0.2.12 198.51.100.62 + +Figure 8-9 Location and Identifier Separation in LISP + + + + + + + + + +Key Topic + +LISP hence has both a control and a data plane. The control plane in LISP comprises the registration protocol and procedures by which the tunnel routers R1 and R2 register the EIDs they are responsible for along with their RLOCs in a LISP-mapping service, and using these registrations they map EIDs into RLOCs. The data plane defines the actual tunnel encapsulation used between Routers R1 and R2 when two hosts from each LISP sites communicate. + +In OTP, EIGRP serves as the replacement for LISP control plane protocols. Instead of doing dynamic EID-to-RLOC mappings in native LISP-mapping services, EIGRP routers running OTP over a service provider cloud create targeted sessions, use the IP addresses provided by the service provider as RLOCs, and exchange routes as EIDs. Consider Figure 8-9 again. If R1 and R2 ran OTP to each other, R1 would learn about the network 10.0.2.0/24 from R2 through EIGRP, treat the prefix 10.0.2.0/24 as an EID prefix, and take the advertising next hop 198.51.100.62 as the RLOC for this EID prefix. Similarly, R2 would learn from R1 about the network 10.0.1.0/24 through EIGRP, treat the prefix 10.0.1.0/24 as an EID prefix, and take the advertising next hop 192.0.2.31 as the RLOC +for this EID prefix. On both routers, this information would be used to populate the LISP mapping tables. Whenever a packet from 10.0.1.0/24 to 10.0.2.0/24 would arrive at R1, it would use its LISP mapping tables just like in ordinary LISP to discover that the packet has to be LISP encapsulated and tunneled toward 198.51.100.62, and vice versa. The LISP data plane is reused in OTP and does not change; however, the native LISP mapping and resolving mechanisms are replaced by EIGRP. + +OTP is based on creating targeted EIGRP sessions between customer edge routers, and using the routing information carried by EIGRP to populate both routing tables and LISP mapping tables. The edge routers do not exchange any routing information with the ser-vice provider routers. Thus, this solution is fully controlled by a customer and requires no +cooperation with the service provider, apart from providing full IP connectivity between +Chapter 8: EIGRP 439 + +customer routers. In many ways, the resulting connectivity between customer sites close-ly resembles a Dynamic Multipoint VPN (DMVPN). The key differences are + +■ DMVPN uses multipoint GRE tunnels, encapsulating both data and control plane traffic. As a result, certain priming in DMVPN is necessary for it to start, such as creating tunnel interfaces on all member routers, assigning addresses to these tun-nels, and manually mapping the tunnel address of the hub router to its real address on each spoke. OTP uses LISP UDP-based encapsulation for data plane traffic while running EIGRP natively, without additional encapsulation, between the customer edge routers. No tunnel interface configuration is required, and the only mandatory static configuration is specifying the remote static neighbor in EIGRP configuration. Optionally, the entire OTP traffic (both control and data plane) can be protected using Group Encrypted Transport Virtual Private Network (GETVPN). + +■ Apart from running a routing protocol such as EIGRP, DMVPN also depends on run-ning the Next Hop Resolution Protocol (NHRP) to provide mappings between mul-tipoint tunnel interfaces and real router addresses. In OTP, EIGRP itself serves as the mapping mechanism. No other control plane protocol is required. + +Configuring two or more routers for direct EIGRP OTP peerings is as simple as configur-ing static EIGRP neighbors; see Example 8-26 and included comments. + +Example 8-26 EIGRP Over the ToP Configuration and Verification for a Pair of Routers + +! On R1, Gi0/0 is the interface toward the service provider. Basic IP +! configuration is performed, followed by LISP and EIGRP configuration. +! Configuring the LISP0 interface is not required; however, the default +! bandwidth setting on the LISP0 interface is 56 Kbps, causing EIGRP to +! compute very high metric values, therefore, the setting was updated. +! The OTP is started by the neighbor command referring to the remote neighbor +! 198.51.100.62 reachable over the Gi0/0 interface, specifying a hop count +! of 100 and the lisp-encap activating the LISP-based OTP functionality. +! At the time of writing, it was required to add the Gi0/0 interface +! to EIGRP, otherwise no static neighborships would form over it, +! hence the network 192.0.2.31 0.0.0.0 command. This was conformant to +! the usual EIGRP behavior that static neighborships form only over interfaces +! added to EIGRP. This limitation may be lifted in future. Also, a local +! network 10.0.1.0/24 is advertised in EIGRP. + +interface LISP0 +bandwidth 1000000 +! +interface GigabitEthernet0/0 +ip address 192.0.2.31 255.255.255.0 +! +ip route 0.0.0.0 0.0.0.0 192.0.2.2 +! +router eigrp CCIE +440 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! +address-family ipv4 unicast autonomous-system 64512 +! +topology base +exit-af-topology +neighbor 198.51.100.62 GigabitEthernet0/0 remote 100 lisp-encap +network 10.0.1.0 0.0.0.255 +network 192.0.2.31 0.0.0.0 + +! On R2, the configuration is very similar: + +interface LISP0 +bandwidth 1000000 +! +interface GigabitEthernet0/1 +ip address 198.51.100.62 255.255.255.0 +! +ip route 0.0.0.0 0.0.0.0 198.51.100.1 +! +router eigrp CCIE +! +address-family ipv4 unicast autonomous-system 64512 +! +topology base +exit-af-topology +neighbor 192.0.2.31 GigabitEthernet0/1 remote 100 lisp-encap +network 10.0.2.0 0.0.0.255 +network 198.51.100.62 0.0.0.0 + +! On R1, show ip route and show eigrp address-family ipv4 neighbor commands +! produce a fairly common output, showing that the remote network 10.0.2.0/24 +! is reachable over LISP0 interface while the remote neighbor itself can be +! reached through Gi0/0 interface (recall that control plane traffic in OTP is +! sent natively while data plane traffic is LISP-encapsulated). The show ip cef +! command shows that the traffic for 10.0.2.0/24 will be LISP-encapsulated +! and forwarded over the current default route next hop 192.0.2.2 to the other +! tunnel endpoint 198.51.100.62. + +R1# show ip route eigrp +! Lines omitted for brevity +10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks +D 10.0.2.0/24 [90/2570880] via 198.51.100.62, 00:36:24, LISP0 + +R1# show eigrp addr ipv4 nei +EIGRP-IPv4 VR(CCIE) Address-Family Neighbors for AS(64512) +Chapter 8: EIGRP 441 + +H Address Interface Hold Uptime SRTT RTO Q Seq +(sec) (ms) Cnt Num +0 198.51.100.62 Gi0/0 13 00:36:55 11 100 0 6 + +R1# show ip cef 10.0.2.0/24 internal +10.0.2.0/24, epoch 0, RIB[I], refcnt 5, per-destination sharing +sources: RIB +feature space: +IPRM: 0x00028000 +ifnums: +LISP0(17): 198.51.100.62 +path list 1381A4AC, 3 locks, per-destination, flags 0x49 [shble, rif, hwcn] +path 12BED5A0, share 1/1, type attached nexthop, for IPv4 +nexthop 198.51.100.62 LISP0, IP midchain out of LISP0, addr 198.51.100.62 13C2AD00 +output chain: +IP midchain out of LISP0, addr 198.51.100.62 13C2AD00 +IP adj out of GigabitEthernet0/0, addr 192.0.2.2 1289B118 + + + + + + + + + + + + + + + + + +Key Topic + +Running OTP between remote routers does not even require that a route toward the remote neighbor (including a default route) is configured on the router. Because the neighbor command specifies the interface toward the remote neighbor, EIGRP in fact places its packets on the interface queue directly, bypassing the routing table and caus-ing the IP driver to simply do its job after it has a packet enqueued: Do the encapsulation of the packet into a data link layer frame, using the packet’s destination IP address to look up the particular destination Layer 2 address to put into the frame. If the interface is a point-to-point interface, the task of encapsulating the EIGRP packet into a frame is simple. If the interface is an Ethernet interface, however, this will cause the router to send ARP requests for the static remote neighbor’s IP address out the interface to the service provider, effectively relying on the Proxy ARP feature activated on the service provider’s edge router. Note that this is an unintuitive fact, and if the service provider disables Proxy ARP on its edge router, the OTP peering will not come up until static ARP map-pings are configured on the OTP router. + +With just a few OTP routers, configuring a full mesh of static neighbors is relatively easy. However, if the OTP network grows, this would not be a scalable approach. Therefore, OTP also introduces a special router role, a so-called route reflector. This router role borrows heavily from BGP, and in fact, it provides the same functionality to EIGRP: It allows collapsing the full mesh of OTP neighbors to a hub-and-spoke model of neighbor configuration, with the route reflector collecting learned networks from its clients and readvertising them back to individual clients, optionally maintaining the original next-hop value. With route reflectors, all clients of a route reflector are configured similarly to Router R2, as shown in Example 8-26, with the route reflector being their only statically defined OTP neighbor; there is otherwise no change to their configuration. The configu-ration of the route reflector router is shown in Example 8-27, now assuming that R1 is the +route reflector. +442 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 8-27 EIGRP Over the ToP Route Reflector Configuration + +! The basic IP configuration is similar to the Example 8-26. + +interface LISP0 +bandwidth 1000000 +! +interface GigabitEthernet0/0 +ip address 192.0.2.31 255.255.255.0 +! +ip route 0.0.0.0 0.0.0.0 192.0.2.2 + +! Instead of configuring neighbors on the route reflector statically, +! the remote-neighbors command is used, identifying the interface whose +! IP address is used by remote neighbors to reach this route reflector +! (meaning that this interface's IP address is used in the neighbor command +! on the remote neighbors) and that will be used by R1 to speak to remote +! neighbors. Usually, the physical interface toward the service provider +! network or a loopback will be used here. Just as before, this interface +! also must be added to EIGRP using the corresponding network command. +! In addition, the af-interface section for this interface specifies two +! commands: no split-horizon to allow learned routes to be reflected to other +! neighbors, accomplishing the very task of R1 as a route reflector, +! and no next-hop-self, facilitating direct spoke-to-spoke communication. If +! all traffic is intended to flow over the route reflector as in hub-and-spoke +! scenarios, the no next-hop-self can be omitted. The no split-horizon, however, +! must always be present. + +router eigrp CCIE +! +address-family ipv4 unicast autonomous-system 64512 +! +af-interface GigabitEthernet0/0 +no next-hop-self +no split-horizon +exit-af-interface +! +topology base +exit-af-topology +remote-neighbors source GigabitEthernet0/0 unicast-listen lisp-encap +network 10.0.1.1 0.0.0.0 +network 192.0.2.31 0.0.0.0 + +The remote-neighbors command also allows you to refer to a named ACL using the optional allow-list acl-name keyword, narrowing the source addresses of permitted route reflector clients. +Chapter 8: EIGRP 443 + +EIGRP Logging and Reporting + +EIGRP event logging configuration parameters are configured in router configuration mode, as demonstrated in Example 8-28. If named mode is used, these commands are located in the address family section. + +Example 8-28 EIGRP Logging and Reporting + +Router(config-router)# eigrp ? + +event-log-size +event-logging +log-neighbor-changes +log-neighbor-warnings + +Set EIGRP maximum event log entries +Log IP-EIGRP routing events +Enable/Disable IP-EIGRP neighbor logging +Enable/Disable IP-EIGRP neighbor warnings + + +The eigrp event-logging configuration command is the default. This EIGRP command enables the router to store a log of EIGRP events. The contents of the EIGRP log can be viewed by issuing the show eigrp address-family { ipv4 | ipv6 } events command. By default, the EIGRP event log stores up to 500 lines of events. This default behavior can be changed by running the command, under router processor, event-log-size <0-443604>. The eigrp log-neighbor-changes router configuration command allows the router to log EIGRP neighbor relationship changes. This command is enabled by default. The eigrp +log-neighbor-warnings [seconds] router configuration command is also enabled by default. This command logs EIGRP neighbor warning messages at 10-second intervals. + +EIGRP Route Filtering + +Outbound and inbound EIGRP updates can be filtered at any interface, or for the entire EIGRP address family instance, in either direction. To filter the routes, the distribute-list command is used. In classic mode, the command is applied directly in the EIGRP process configuration. In named mode, distribute-list is configured under topology base in the particular address family. + +EIGRP allows ACLs, prefix lists, and route-maps to be used for route filtering in a distribute-list command. Depending on the filtering mechanism, there are multiple vari-ants of this command available: + +■ ACLs: distribute-list acl-number | acl-name { in | out } [ interface ] + +■ Prefix lists: distribute-list prefix prefix-list-name { in | out } [ interface ] + +■ Route maps: distribute-list route-map route-map-name { in | out } [ interface ] + +In general, the use of prefix lists is recommended, as they are specifically designed to match ranges of networks and netmasks. + +Interestingly enough, distribute lists do not directly limit the propagation of Queries. Instead, what they do is more involved: + +■ For distribute lists in the out direction: All outgoing Updates, Queries, Replies, SIA-Queries, and SIA-Replies will indicate the correct metric for permitted prefixes and infinite metric for denied prefixes. +444 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ For distribute lists in the in direction: In all incoming Updates, Replies, and SIA-Replies, permitted prefixes are processed normally while denied prefixes are ignored. Received Queries and SIA-Queries are not influenced by the distribute list and are processed without modification. + + +EIGRP Offset Lists + +EIGRP offset lists allow EIGRP to add to a route’s metric, either before sending an update or for routes received in an update. The offset list refers to an ACL (standard, extended, or named) to match the routes; any matched routes have the specified offset, or extra metric, added to their Delay metric component. Any routes not matched by the offset list are unchanged. The offset list also specifies which routing updates to examine by speci-fying a direction (in or out) and, optionally, an interface. If the interface is omitted from the command, all updates for the defined direction will be examined. + +Offset lists are much more applicable to RIP than EIGRP because RIP has such a limited metric range. With EIGRP, because of the metric’s complexity, it is doubtful that you would manipulate EIGRP metrics this way. Because several other filtering methods and ways to influence EIGRP metrics are available, offset lists see limited use in EIGRP and are therefore not covered in more detail in this chapter. + +Clearing the IP Routing Table + +The clear ip route * command clears the IP routing table. However, because EIGRP keeps all possible routes in its topology table, a clear ip route * command does not cause EIGRP to send any messages or learn any new topology information; the router simply refills the IP routing table with the best routes from the existing topology table. + +The clear eigrp address-family { ipv4 | ipv6 } neighbors command can be used to clear all neighbor relationships and have the router reestablish them from scratch. An optional soft keyword allows for a graceful restart, in which the topology databases between the router and its neighbors are resynchronized but the adjacencies are not torn down. +Chapter 8: EIGRP 445 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 8-5 lists some of the most popular Cisco IOS commands related to the topics in this chapter. + +Table 8-5 Command Reference for Chapter 8 + + +Command +[ipv6] router eigrp as-number + +router eigrp name + + +eigrp upgrade-cli name + + + +address-family { ipv4 | ipv6 } [ vrf vrf-name ] autonomous-system as-number + +af-interface { default | interface-type interface-number } + +topology { base | topology-name tid number } + +eigrp router-id + +eigrp stub [receive-only] | { [ leak-map name ] [connected] [static] [summary] [redistributed] } + +network ip-address [wildcard-mask ] + + + + +ipv6 eigrp as-number + +Command Mode and Description +Global config; puts user in EIGRP classic configuration mode (first command) or in named configuration mode (second command). +EIGRP classic mode. Automatically converts the classic configuration to the named configuration using the entered name as the process name. +Named EIGRP mode, creates an instance for a particular address family and configures it with an autonomous system number. +Named EIGRP mode, address family instance. Holds per-interface EIGRP settings. + +Named EIGRP mode, address family instance. Holds EIGRP settings for a particular routing topology. +EIGRP classic config mode or address family named mode. Configures RID manually. +EIGRP classic config mode or address family named mode. Designates the router as a stub router. +EIGRP classic config mode or IPv4 address family named mode; defines matching parameters, compared to interface IP addresses, to pick interfaces on which to enable EIGRP. +Interface subcommand; activates interface for IPv6 EIGRP. Used only in classic mode config. +446 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +[no] {ip | ipv6} split-horizon eigrp autonomous-system + +[no] split-horizon + + +[no] passive-interface [default] {interface-type interface-number } + +[no] passive-interface + + + +[no] shutdown + + + + +{ip | ipv6} hello-interval eigrp as-number seconds + +hello-interval seconds + + +{ip | ipv6} hold-time eigrp as-number seconds + +hold-time seconds + + + + +[no] auto-summary + + + +{ip | ipv6} summary-address eigrp +as-number prefix [admin-distance] [ leak-map name ] + +summary-address prefix [ admin-distance [ leak-map name ] ] + +summary-metric prefix { Bandwidth Delay Reliability Load MTU [ distance administrative-distance ] | distance administrative-distance } + +Command Mode and Description +Interface subcommand; enables or disables Split Horizon. The first form is used in the classic mode configuration. The second form is used in the af-interface section in named mode. +EIGRP config mode; causes EIGRP to stop sending and processing EIGRP packets on the specified interface, or enables them again. The first form is used in the classic mode configuration. The second form is used in the af-interface section in named mode. +EIGRP named mode, valid in the router eigrp section, particularly the address family section or af-interface section. Deactivates or activates the EIGRP operation within the defined scope. +Interface subcommand; sets the interval for periodic Hellos sent by this interface. The first form is used in the classic mode +configuration. The second form is used in the af-interface section in named mode. +Interface subcommand; sets the countdown timer to be used by a router’s neighbor when monitoring for incoming EIGRP messages from this interface. The first form is used in the classic mode configuration. The second form is used in the af-interface section in named mode. +EIGRP classic config mode or per-AF-topology named mode; enables or disables automatic summarization at classful network boundaries. +Interface subcommand; configures the manual summarization and optional route leaking. The first form is used in the classic mode configuration. The second form is used in the af-interface section in named mode. + +Named EIGRP mode, per-AF-topology section. Defines a constant advertised metric for an advertised summary route, optionally also modifying the corresponding discard route’s administrative distance. +Chapter 8: EIGRP 447 + + + +Command +metric weights 0 k1 k2 k3 k4 k5 [ k6 ] + + + + +metric rib-scale scale-value + + + +{ip | ipv6} bandwidth-percent eigrp as-number percent + +bandwidth-percent percent + + + +{ip | ipv6} authentication mode eigrp as-number md5 + +authentication mode { md5 | hmac-sha-256 password } + + + + +{ip | ipv6} authentication key-chain eigrp as-number key-chain-name + +authentication key-chain key-chain-name + + +[no] {ip | ipv6} split-horizon eigrp as-number + +[no] split-horizon + + +[no] {ip | ipv6} next-hop-self eigrp as-number + +[no] next-hop-self + + + +add-paths path-count + +Command Mode and Description +EIGRP classic config mode or per-AF-topology named mode; defines the per-ToS K-values to be used in EIGRP metric calculations; however, only ToS 0 is supported. +EIGRP address family named mode. Defines a scaling value to downscale the computed wide metrics into a metric value offered to RIB. +Interface subcommand; defines the maximum percentage of interface bandwidth to be used for EIGRP messages. The first form is used in the classic mode configuration. The second form is used in the af-interface section in named mode. +Enables authentication of EIGRP packets. The first form is used directly on an interface for classic configuration mode, and allows only for MD5 authentication. The second form is used in the af-interface section +in named mode, and allows choosing the hashing algorithm. The password for SHA-256 is used only if no key chain is specified. +Specifies the authentication key chain for EIGRP. The first form is used directly on an interface for classic configuration mode. The second form is used in af-interface section in named mode. +Interface subcommand; allows activating or deactivating the Split Horizon mechanism. The first form is used in the classic mode configuration. The second form is used in the af-interface section in named mode. +Interface subcommand; allows or prevents the router from asserting itself as the next hop in routes readvertised over the interface. The first form is used in the classic mode configuration. The second form is used in the af-interface section in named mode. +Named EIGRP mode, af-interface section. Allows the router to advertise up to four additional equal-cost paths. +448 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +variance multiplier + + + + +neighbor { ip-address | ipv6-address } interface-type interface-number [ remote maximum-hops [ lisp-encap [ lisp-id ] ] ] + +Command Mode and Description +EIGRP classic config mode or per-AF-topology named mode. Allows the router to use worse paths over Feasible Successors +whose metric is up to multiplier times worse than the current best-path metric. +EIGRP classic config mode or address family named mode. Specifies a static neighbor. OTP-related keywords are available only in named mode. + +remote-neighbors source interface-type EIGRP address family named mode. Defines interface-number { multicast-group group- dynamic remote neighbor discovery, required address | unicast-listen lisp-encap [ lisp-top- for OTP route reflector functionality. +id ] } [ allow-list access-list-name ] [ max-neighbor max-remote-peers ] + +distribute-list {access-list-number | name } { in | out } [ interface-type interface-number ] + + +distribute-list prefix prefix-list-name {in | out} [ interface-type interface-number ] + + +timers active-time [time-limit | disabled] + + + +show {ip | ipv6} eigrp topology [ vrf vrf-name | as-number | network [ mask ] | prefix | active | all-links | detail-links | frr | name | pending | summary | zero-successors ] + +show eigrp address-family { ipv4 | ipv6 } [ vrf vrf-name ] [ as-number ] [multicast] +interfaces [detail] [ interface-type interface-number ] + +show ip eigrp [ vrf vrf-name ] [ as-number ] interfaces [ detail ] [ type number ] + +show eigrp address-family { ipv4 | ipv6 } [ vrf vrf-name ] [ as-number ] [multicast] +interfaces [detail] [ interface-type interface-number ] + +EIGRP classic config mode or per-AF-topology named mode. Specifies an access list for filtering routing updates to/from the EIGRP topology table. +EIGRP classic config mode or per-AF-topology named mode. Specifies a prefix list for filtering routing updates to/from the EIGRP topology table. +EIGRP classic config mode or per-AF-topology named mode; sets the time limit for how long a route is in the active state before becoming stuck-in-active. +User mode; lists different parts of the EIGRP topology table, depending on the options used. + + + + + + +User mode; lists EIGRP protocol timers and statistics per interface. +Chapter 8: EIGRP 449 + + + +Command +show {ip | ipv6} eigrp traffic [as-number ] + +show eigrp address-family { ipv4 | ipv6 } [ vrf vrf-name ] [ as-number ] [multicast] traffic +show {ip | ipv6} protocols + +Command Mode and Description +User mode; displays EIGRP traffic statistics. + + + + +User mode; lists EIGRP timer settings, current protocol status, automatic summarization actions, and update sources. + +show {ip | ipv6} eigrp [as-number] neighbors User mode; lists EIGRP neighbors. + + +show eigrp address-family { ipv4 | ipv6 } [ vrf vrf-name ] [ as-number ] [multicast] neighbors [static] [detail] [ interface-type interface-number ] + +clear ip eigrp [ vrf vrf-name [as-number] | as-number ] neighbors [ ip-address | interface-type interface-number ] [soft] + + + +show ip interface [type number ] + + + + + +Privileged mode; drops current neighbor adjacencies, removing topology table entries associated with each neighbor. The soft keyword causes the router to perform resynchronization with neighbors without dropping adjacencies. +User mode; lists many interface settings, including Split Horizon. + + + +Table 8-6 summarizes the types of EIGRP packets and their purposes. + + +Table 8-6 EIGRP Message Summary + + +EIGRP Packet +Hello + +Ack + +Update + +Query + + +Reply + + +SIA-Query + +SIA-Reply + +Purpose +Identifies neighbors, exchanges parameters, and is sent periodically as a keepalive function +Acknowledges Update, Query, Reply, SIA-Query, and SIA-Reply packets + +Informs neighbors about updated routing information + +Asks neighboring routers to update their routing tables in a coordinated fashion and respond with their actual distance after having their routing tables updated +Sent by neighbors to reply to a Query, informing the router about the actual neighbor’s distance to the destination after processing the information in the Query +Asks a particular neighbor whose Reply to a Query packet is outstanding for a prolonged time to confirm whether it is still working on this router’s Query +Sent by a neighbor as a response to an SIA-Query to ascertain its state +450 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD, to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +hello interval, full update, partial update, MD5, DUAL, Hold timer, K-value, neigh-bor, adjacency, RTP, SRTT, RTO, Update, Ack, Query, Reply, Hello, Goodbye, RD, FD, feasibility condition, successor route, Feasible Successor, input event, local computation, active, passive, going active, stuck-in-active, query scope, EIGRP stub router, limiting query scope, variance, Named Mode +Refer to the glossary to check your answers. + + +Further Reading + +Jeff Doyle’s Routing TCP/IP, Volume I, Second Edition (Cisco Press), has several excel-lent examples of configuration, as well as several examples of the DUAL algorithm and the Active Query process. + +EIGRP Network Design Solutions, by Ivan Pepelnjak, contains wonderfully complete coverage of EIGRP. It also has great, detailed examples of the Query process. + +draft-savage-eigrp, an Internet draft available through Internet Engineering Task Force web pages, documents the open parts of the protocol. + +The CCIE Routing and Switching v5.0 exam blueprint also mentions the EIGRP IP Fast Reroute feature. More information about it can be found on the Cisco website in the IP Routing EIGRP Configuration Guide for Cisco IOS Release 15S, specifically in the “EIGRP Loop-Free Alternate Fast Reroute” section. Also, many Cisco Live! ses-sions cover this feature, including “IP LFA (Loop-Free-Alternative): Architecture and +Troubleshooting” (BRKRST-3020) and “Routed Fast Convergence” (BRKRST-3363), avail-able at www.ciscolive365.com. At the time of writing, this feature was supported only on service provider IOS, IOS-XE, and IOS-XR image builds and will not be present on the Lab exam. The Written exam might cover general properties of this feature. + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Packet Types + +■ LSA Types + +■ Route Types + +■ Neighbor Relationship and Database Synchronization + +■ Network Types, Area Types, and Router Types + +■ Path Preference + +■ Metrics + +■ SPF Tuning +CHAPTER 9 + + + + + + +OSPF + + +This chapter covers Open Shortest Path First (OSPF), one of the two link-state routing protocols covered by the CCIE Routing and Switching exam blueprint. As with the other routing protocol chapters, this chapter includes most of the features, concepts, and com-mands related to OSPF. Chapter 11, “IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting,” covers a few other details of OSPF, in particular, route redistribution, route filtering in redistribution, and route summarization. + +“Do I Know This Already?” Quiz + +Table 9-1 outlines the major sections in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 9-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section + +OSPF Database Exchange + +OSPF Design and LSAs + +OSPF Configuration + +OSPFv3 + +Total Score + +Questions Covered in This Score Section +1–5 + +6–9 + +10–12 + +13–16 + + + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. R1 has received an OSPF LSU from R2. Which of the following methods can be used by R1 to acknowledge receipt of the LSU from R2? + +a. TCP on R1 acknowledges using the TCP Acknowledgment field. + +b. R1 sends back an identical copy of the LSU. + +c. R1 sends back an LSAck to R2. + +d. R1 sends back a DD packet with LSA headers whose sequence numbers match the sequence numbers in the LSU. +454 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +2. Fredsco has an enterprise network with one core Frame Relay connected router, with a hub-and-spoke network of PVCs connecting to ten remote offices. The network uses OSPF exclusively. The core router (R-core) has all ten PVCs defined under mul-tipoint subinterface s0/0.1. Each remote router also uses a multipoint subinterface. Fred, the engineer, configures an ip ospf network non-broadcast command under the subinterface on R-core and on the subinterfaces of the ten remote routers. Fred also assigns an IP address to each router from subnet 10.3.4.0/24, with R-core using the .100 address, and the remote offices using .1 through .10. Assuming that all other related options are using defaults, which of the following would be true about this network? +a. The OSPF hello interval would be 30 seconds. + +b. The OSPF dead interval would be 40 seconds. + +c. The remote routers could learn all routes to other remote routers’ subnets, but only if R-core became the designated router. + +d. No designated router will be elected in subnet 10.3.4.0/24. + +3. Which of the following interface subcommands, used on a multipoint Frame Relay subinterface, creates a requirement for a DR to be elected for the attached subnet? + +a. ip ospf network point-to-multipoint + +b. ip ospf network point-to-multipoint non-broadcast + +c. ip ospf network non-broadcast + +d. None of these answers is correct. + +4. The following routers share the same LAN segment and have the stated OSPF set-tings: R1: RID 1.1.1.1, hello 10, priority 3; R2: RID 2.2.2.2, hello 9, priority 4; R3, RID 3.3.3.3, priority 3; and R4: RID 4.4.4.4, hello 10, priority 2. The LAN switch fails +and recovers, and all routers attempt to elect an OSPF DR and form neighbor rela-tionships at the same time. No other OSPF-related parameters were specifically set. Which of the following are true about negotiations and elections on this LAN? +a. R1, R3, and R4 will expect Hellos from R2 every 9 seconds. + +b. R2 will become the DR but have no neighbors. + +c. R3 will become the BDR. + +d. R4’s dead interval will be 40 seconds. + +e. All routers will use R2’s hello interval of 9 after R2 becomes the designated router. +Chapter 9: OSPF 455 + +5. Which of the following must be true for two OSPF routers that share the same LAN data link to be able to become OSPF neighbors? + +a. Must be in the same area + +b. Must have the same LSRefresh setting + +c. Must have differing OSPF priorities + +d. Must have the same Hello timer, but can have different dead intervals + +6. R1 is an OSPF ASBR that injects an E1 route for network 200.1.1.0/24 into the OSPF backbone area. R2 is an ABR connected to area 0 and to area 1. R2 also has an Ethernet interface in area 0, IP address 10.1.1.1/24, for which it is the designated router, and has established OSPF adjacencies over this interface with other rout- +ers. R3 is a router internal to area 1. Enough links are up and working for the OSPF design to be working properly. Which of the following are true regarding this topol-ogy? (Assume that no other routing protocols are running, and that area 1 is not a stub area.) +a. R1 creates a type 7 LSA and floods it throughout area 0. + +b. R3 will not have a specific route to 200.1.1.0/24. + +c. R2 forwards the LSA that R1 created for 200.1.1.0/24 into area 1. + +d. R2 will create a type 2 LSA for subnet 10.1.1.0/24 and flood it throughout area 0. + +7. R1 is an OSPF ASBR that injects an E1 route for network 200.1.1.0/24 into the OSPF backbone area. R2 is an ABR connected to area 0 and to area 1. R2 also has an Ethernet interface in area 0, IP address 10.1.1.1/24, for which it is the designated router but there are no other OSPF routers on the segment. R3 is a router internal to +area 1. Enough links are up and working for the OSPF design to be working properly. Which of the following are true regarding this topology? (Assume that no other routing protocols are running, and that area 1 is a totally NSSA.) +a. R3 could inject external routes into the OSPF domain. + +b. R3 will not have a specific route to 200.1.1.0/24. + +c. R2 forwards the LSA that R1 created for 200.1.1.0/24 into area 1. + +d. R2 will create a type 2 LSA for subnet 10.1.1.0/24 and flood it throughout area 0. +456 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +8. The routers in area 55 all have the area 55 stub no-summary command configured under the router ospf command. OSPF has converged, with all routers in area 55 holding an identical link-state database for area 55. All IP addresses inside the area come from the range 10.55.0.0/16; no other links outside area 55 use addresses in this range. R11 is the only ABR for the area. Which of the following is true about this design? +a. The area is a stubby area. + +b. The area is a totally stubby area. + +c. The area is an NSSA. + +d. ABR R11 is not allowed to summarize the type 1 and 2 LSAs in area 55 into the 10.55.0.0/16 prefix because of the no-summary keyword. + +e. Routers internal to area 55 can have routes to specific subnets inside area 0. + +f. Routers internal to area 55 can have routes to E1, but not E2, OSPF routes. + +9. R1 is an OSPF ASBR that injects an E1 route for network 200.1.1.0/24 into the OSPF backbone area. R2 is an ABR connected to area 0 and to area 1. R2 also has an Ethernet interface in area 0, IP address 10.1.1.1/24, for which it is the designated router. R3 is a router internal to area 1. Enough links are up and working for the OSPF design to be working properly. Which of the following are true regarding this topology? (Assume that no other routing protocols are running, and that area 1 is not a stubby area.) +a. R3’s cost for the route to 200.1.1.0 will be the cost of the route as it was injected into the OSPF domain by R1, without considering any internal cost. + +b. R3’s cost for the route to 200.1.1.0 will be the cost of reaching R1, plus the external cost listed in the LSA. + +c. R3’s cost for the route to 10.1.1.0/24 will be the same as its cost to reach ABR R2. + +d. R3’s cost for the route to 10.1.1.0/24 will be the sum of its cost to reach ABR R2 plus the cost listed in the type 3 LSA created for 10.1.1.0/24 by ABR R2. + +e. It is impossible to characterize R3’s cost to 10.1.1.0/24 because R3 uses a sum-mary type 3 LSA, which hides some of the costs. +Chapter 9: OSPF 457 + +10. R1 and R2 each connect through Fast Ethernet interfaces to the same LAN, which should be in area 0. R1’s IP address is 10.1.1.1/24, and R2’s is 10.1.1.2/24. The only OSPF-related configuration is as follows: +hostname R1 +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 +auto-cost reference-bandwidth 1000 +! +hostname R2 +router ospf 2 +network 10.0.0.0 0.0.0.255 area 0 +Which of the following statements are true about the configuration? + +a. The network command on R2 does not match IP address 10.1.1.2, so R2 will not attempt to send Hellos or discover neighbors on the LAN. + +b. The different process IDs in the router ospf command will prevent the two rout-ers from becoming neighbors on the LAN. + +c. R2 will become the DR as a result of having a cost of 1 associated with its Fast Ethernet interface. + +d. R1 and R2 could never become neighbors because of the difference in cost values. + +e. R1’s OSPF cost for its Fast Ethernet interface would be 10. + +11. Which of the following are true about setting timers with OSPF? + +a. The ip ospf dead-interval minimal hello-multiplier 4 interface subcommand sets the hello interval to 4 ms. + +b. The ip ospf dead-interval minimal hello-multiplier 4 interface subcommand sets the dead interval to 4 seconds. + +c. The ip ospf dead-interval minimal hello-multiplier 4 interface subcommand sets the hello interval to 250 ms. + +d. On all interfaces, the ip ospf hello-interval 30 interface subcommand changes the hello interval from 10 to 30. + +e. The ip ospf hello-multiplier 5 interface subcommand sets the dead interval to five times the then-current hello interval. + +f. Cisco IOS defaults the hello and dead intervals to 30/120 on interfaces using the OSPF nonbroadcast network type. +458 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +12. R1 has been configured for OSPF authentication on its Fa0/0 interface as shown here. Which of the following is true about the configuration? + +interface Fa0/0 +ip ospf authentication-key hannah +ip ospf authentication +ip ospf message-digest-key 2 md5 jessie +router ospf 2 +area 0 authentication message-digest +a. R1 will attempt simple-text authentication on the LAN with key hannah. + +b. R1 will attempt MD5 authentication on the LAN with key jessie. + +c. R1 will attempt OSPF type 2 authentication on Fa0/0. + +d. R1 will attempt OSPF type 3 authentication on Fa0/0. + +13. Which of the following statements about OSPFv3 are true? + +a. Type 1 and 2 LSAs do not carry addressing information. + +b. OSPFv3 messages are encapsulated directly into Layer 2 frames. + +c. OSPFv3 uses 128-bit Router IDs. + +d. There are three flooding scopes defined for OSPFv3 LSAs: link, area, and AS. + +e. Multiple OSPFv3 instances can run over a single link. + +f. OSPFv3 implements its own authentication mechanisms. + +14. Which statements are true about Link LSA and Intra-Area-Prefix LSA in OSPFv3? + +a. Link LSAs have AS flooding scope. + +b. Intra-Area-Prefix LSAs have area flooding scope. + +c. Link LSAs carry information about link-local addresses. + +d. Intra-Area-Prefix LSAs carry information about global prefixes. + +e. When an updated Link or Intra-Area-Prefix LSA is flooded, a router is required to schedule a full SPF run. + +f. Link and Intra-Area-Prefix LSAs have entirely replaced the Router and Network LSAs. + +15. How does OSPFv3 handle authentication? + +a. OSPFv3 implements its own authentication and encryption mechanisms. + +b. SSL/TLS is used by OSPFv3 to provide authentication and encryption. + +c. OSPFv3 relies on IPsec to authenticate and encrypt its packets. + +d. OSPFv3 makes use of ISAKMP/IKE protocols to negotiate authentication and encryption parameters between routers. + +e. The use of AH and ESP is mutually exclusive in OSPFv3. +Chapter 9: OSPF 459 + +16. Which statements are true about address family support in OSPFv3? + +a. When running multiple address families, a single link-state database on a router holds information from all address families. + +b. Each address family is run as a separate OSPFv3 instance, keeping all its data and state separate. + +c. Multiple address families are distinguished by separate OSPFv3 process IDs. + +d. Running IPv4 and IPv6 address families simultaneously under a single OSPFv3 process will result in a significantly smaller memory footprint than running a separate IPv4 OSPFv2 and IPv6 OSPFv3 process. +e. Type 8 and 9 LSAs are reused to carry both IPv4 and IPv6 prefixes. + +f. Even if running OSPFv3 for IPv4 address family, interfaces must be configured for IPv6 connectivity. +460 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Foundation Topics + + +Link-state routing protocols define the content and structure of data that describes net-work topology, and define the processes by which routers exchange that detailed topol-ogy information. The name “link state” refers to the fact that the topology information includes information about each data link, along with each link’s current operational state. All the topological data together comprises the link-state database (LSDB) . Each link-state router applies the Dijkstra algorithm to the database to calculate the current best routes to each subnet. + +This chapter breaks down the OSPF coverage into three major sections. The first section details how the topology data is exchanged. The second section covers OSPF design and the contents of the LSDB, which comprises different types of link-state advertise-ments (LSA). (The second section covers both design and the LSDB because the design choices directly impact which types of LSAs are forwarded into the differing parts of an OSPF network.) The third section covers the majority of the OSPF configuration details +of OSPF for this chapter, although a few configuration topics are interspersed in the first two sections. + +OSPF Database Exchange + +OSPF defines five different messages that routers can use to establish adjacencies and exchange routing information. The process by which LSAs are exchanged does not change whether a single area or multiple areas are used, so this section will use a single OSPF area (area 0). + +OSPF Router IDs + +Before an OSPF router can send any OSPF messages, it must choose a unique 32-bit iden-tifier called the OSPF router identifier (RID). Cisco routers use the following sequence to choose their OSPF RID, only moving on to the next step in this list if the previous step did not supply the OSPF RID: + +1. +Key +Topic 2. + + +3. + + +Use the router ID configured in the router-id id subcommand under router ospf. + +Use the highest numeric IP address on any currently nonshutdown loopback inter-face that has not yet been allocated as a RID by any other OSPF process. + +Use the highest numeric IP address on any currently nonshutdown, nonloopback +interface that has not yet been allocated as a RID by any other OSPF process. + + +The sequence and logic are very simple, but some details are hidden in the sequence: + +■ Multiple OSPF processes running on a single router try to choose unique RIDs. Each of the OSPF processes performs the same three steps to choose a RID, skipping IP addresses that have already been used as RIDs by other OSPF processes running on the router. +Chapter 9: OSPF 461 + +■ The interface from which the RID is taken does not have to be matched by an OSPF network command. + +■ It is sufficient for the interface to be in the down/down state to be considered by OSPF as a prospective interface for RID selection. + +■ OSPF does not have to advertise a route to reach the RID’s subnet. + +■ The RID does not have to be reachable per the IP routing table. + +■ Steps 2 and 3 look at the then-current interface state to choose the RID when the OSPF process is started. + +■ Routers consider changing the OSPF RID when the OSPF process is restarted, or when the RID is changed through configuration. + +■ If a router’s RID changes, the rest of the routers in the same area will have to perform a new SPF calculation, even if the network topology has not changed. The reason is that a RID change is indistinguishable from a process of replacing one router with another. + +■ If the RID is configured with the router-id command, and the command remains unchanged, that router’s RID will never change. + +For these reasons, many people set their RIDs with the router-id command and use an obvious numbering scheme to make it easy to identify a router by its RID. + +Becoming Neighbors, Exchanging Databases, and Becoming Adjacent + +OSPF directly encapsulates the five different types of OSPF messages inside IP packets, using IP protocol 89, as listed in Table 9-2. + + +Table 9-2 OSPF Messages Key +Topic Message + +Hello + + + +Description +Used to discover neighbors, bring a neighbor relationship to a 2-Way state, and monitor a neighbor’s continuous liveliness + + + +Database Description (DD or DBD) + + +Link-State Request (LSR) + + +Link-State Update (LSU) + + +Link-State Acknowledgment (LSAck) + +Used to exchange LSA headers during the initial topology exchange, so that a router knows a list of that neighbor’s LSAs including their versions +A packet that identifies one or more LSAs about which the sending router would like the neighbor to supply full details about the LSAs +A packet that contains fully detailed LSAs, sent in response to an LSR message or in the event of a topological change +Sent to confirm receipt of an LSU message +462 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +These messages together allow routers to discover each other’s presence (Hello), learn which LSAs are missing from their LSDBs (DD), request and reliably exchange the LSAs (LSR/LSU/LSAck), and monitor their neighbors for any changes in the topology (Hello). Note that the LSAs themselves are not OSPF messages. An LSA is a data structure, held inside a router’s LSDB and exchanged inside LSU messages. + +When a particular data link first comes up, OSPF routers first become neighbors using the Hello message. At that point, they exchange topology information using the other four OSPF messages. Figure 9-1 outlines the overall process between two routers. + + +Neighbor State +Down + +Neighbor State Down + +(R1 to R2 Link comes up ...) + +RID 1.1.1.1 Init Init RID 2.2.2.2 Hello, Seen [null], RID 1.1.1.1 + +R1 +Hello, Seen [1.1.1.1], RID 2.2.2.2 + +2-way Hello, Seen [1.1.1.1, 2.2.2.2], RID 1.1.1.1 + +2-way R2 + + + +DR Election, +if needed ExStart + + + +Exchange + + + +Loading + +Full + + +Hello, DR=z.z.z.z + +DD (LSA Headers) + +DD (LSA Headers) + +DD (LSA Headers) . . +. + +LSR, LSU, LSAck (Full LSAs) . +. +. + +DR Election, if needed + +ExStart + +Exchange + + + +Loading + +Full + + +Figure 9-1 Overview of OSPF LSDB Exchange + +Figure 9-1 shows the overall message flow, along with the neighbor state on each router. An OSPF router keeps a state machine for each neighbor, listing the current neighbor state in the output of the show ip ospf neighbor command. These neighbor states change as the neighbors progress through their messaging; in this example, the neighbors settle into a full state, meaning fully adjacent, when the process is completed. + +The “Foundation Summary” section at the end of this chapter includes a reference table (Table 9-14) listing the neighbor states and their meanings. The next few sections explain the details behind the process shown in Figure 9-1. + +OSPF Neighbor States + +OSPF routers go through a series of adjacency states when establishing a relation. Some of these states are transitory, reflecting different stages of building an adjacency, while +Chapter 9: OSPF 463 + +some of them are stable states in which routers can, in the absence of topological changes, remain for an unlimited period of time. The knowledge of these states is crucial for proper understanding of OSPF adjacency buildup and troubleshooting. + +Before diving into the details, it is important to note that these states are in fact neighbor states—they indicate how a router treats its particular neighbor. Although sometimes popularly described as adjacency states, these states do not reflect the state of the entire adjacency but rather a state of a particular router’s neighbor in this adjacency. Two routers building an adjacency can temporarily, though validly, consider each other to be in a dif-ferent state (for example, one router might consider the other to be in the Loading state while the other might consider the first one to be already in the Full state). Ultimately, however, both routers must arrive at the same state. + + +■ Key +Topic + + + + +■ + + + + + +■ + + + + +■ + + + + + +■ + + + + + + + +■ + +Down: This is the initial state for a neighbor. This state is mostly seen when a work-ing adjacency to a neighbor is torn down (for example, because no valid OSPF packets have been received during the Dead interval), or when a manually configured neighbor does not respond to our initial Hello packets. Note that having a neighbor in the Down state implies that the router already knows about this neighbor’s IP address. + +Attempt: This state is valid only on nonbroadcast multiaccess (NBMA) and point- +to-multipoint nonbroadcast networks. On these networks, a neighbor is immediately placed into the Attempt state and contacted by Hello packets sent at usual intervals. If, however, the neighbor does not respond within the Dead interval, it will be placed back into the Down state, and contacted at a (possibly) reduced rate. + +Init: A neighbor is placed into the Init state if a valid Hello packet has been received from it but the list of seen routers in this Hello packet does not contain the receiving router’s RID. This means that this router can hear the other router but it is not certain whether the other router can hear this router. + +2-Way: A neighbor is placed into the 2-Way state if a valid Hello packet has been received from it and the list of seen routers in this Hello packet includes the receiving router’s RID. This state confirms a bidirectional visibility between the two routers. The 2-Way is a stable state between routers on multiaccess networks that do not intend to become fully adjacent. + +ExStart: A neighbor is moved from Init or 2-Way into the ExStart state if the bidi-rectional visibility has been confirmed and it is decided that this router shall become fully adjacent to it. The purpose of the ExStart state is to establish the Master/Slave relationship. In the ExStart state, routers exchange empty Database Description packets to compare their Router IDs, determine the Master and Slave roles for each router, and agree on a common starting sequence number used to acknowledge sub-sequent Database Description packets used in the Exchange state. + +Exchange: A neighbor is moved from ExStart to Exchange state after the Master/ Slave relationship has been established. During the Exchange state, Database Description packets are exchanged between the routers carrying the list of link-state +database elements (that is, LSAs) known by each router. During the Exchange state, +464 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +each router builds a list of LSAs to be subsequently downloaded from the other router. + +■ Loading: A neighbor is moved from the Exchange to Loading state after it has adver-tised the complete list of LSAs and this router needs to download some of the LSAs from the neighbor. The neighbor is kept in the Loading state during the LSA down-load. + +■ Full: A neighbor is moved from the Exchange or Loading state to the Full state when all required LSAs have been downloaded from the neighbor, so all missing or out-dated LSAs have been acquired. The Full state is a stable state between routers that have become fully adjacent. + + +Becoming Neighbors: The Hello Process + +Hello messages perform four major functions: + +■ Discover other OSPF-speaking routers on common subnets + +■ Check for agreement on selected configuration parameters + +■ Verify bidirectional visibility between routers + +■ Monitor health of the neighbors to react if the neighbor fails + +To discover neighbors, Cisco OSPF routers listen for multicast Hello messages sent to 224.0.0.5—the All OSPF Routers multicast address—on any interfaces that have been enabled for OSPF. The Hellos are sourced from that router’s primary IP address on the interface; in other words, Hellos are not sourced from secondary IP addresses. (OSPF routers will advertise secondary IP addresses, but they will not send Hellos from those IP addresses, and never form neighbor relationships using secondary addresses. This holds for EIGRP and RIP as well.) Furthermore, OSPF neighbors will become fully adja-cent if one or both of the neighbors are using unnumbered interfaces for the connection between them. + +After two routers discover each other by receiving Hellos from the other router, the rout-ers perform the following parameter checks based on the receive Hellos: + +■ Must pass the authentication process Key +Topic ■ Must be in the same primary subnet, including the same subnet mask + +■ Must be in the same OSPF area + +■ Must be of the same area type (regular, stub, not-so-stubby area [NSSA]) + +■ Must not have duplicate RIDs + +■ OSPF Hello and Dead timers must be equal + +If any of these items do not match, the two routers simply do not form a neighbor relationship. Also of note is one important item that does not have to match: the OSPF +Chapter 9: OSPF 465 + +process ID (PID), as configured in the router ospf process-id command. Be aware of the fact that the maximum transmission unit (MTU) must be equal for the DD packets to be successfully processed between neighbors, but this parameter check is technically not part of the Hello process. The MTU mismatch would negatively affect the database syn-chronization process in the ExStart and Exchange phases, but it would not prevent rout-ers from becoming successful neighbors up to and including the 2-Way state. + +The third function of Hello packets is to verify bidirectional visibility between routers on the same segment. Each Hello packet contains a list of neighbors from whom the sending router received valid and acceptable Hellos. This list of variable size is located in the trail-ing part of each Hello and contains RIDs of routers whose Hellos were seen and accepted by the router originating this Hello. If a router finds its own RID in the list of seen routers in a Hello received from a neighbor, it can be sure that they can hear each other. + +Finally, the fourth important function for a Hello is to maintain a heartbeat function between neighbors. The neighbors send Hellos every hello interval; failure to receive a Hello within the longer dead interval causes a router to believe that its neighbor has +failed. The hello interval defaults to 10 seconds on interfaces with an OSPF broadcast or point-to-point network type, and 30 seconds on interfaces with an OSPF nonbroadcast or point-to-multipoint network type; the dead interval defaults to four times the hello interval. + +Example 9-1 lists some basic OSPF command output related to the neighbor establish-ment with Hellos, and the hello and dead intervals. + +Example 9-1 Hello Mismatches and Basic Neighbor Parameters + +! Below, debug messages show that this router disagrees with the hello and dead +! intervals on router 10.1.111.4; The "C" and "R" mean "configured" and "received," +! respectively, meaning that this router uses 30/120 for hello/dead, and the other +! router is trying to use 10/40. + +R1# debug ip ospf hello +OSPF hello events debugging is on +Jan 12 06:41:20.940: OSPF: Mismatched hello parameters from 10.1.111.4 +Jan 12 06:41:20.940: OSPF: Dead R 40 C 120, Hello R 10 C 30 Mask R 255.255.255.0 C +255.255.255.0 + +! Below, R1's hello and dead intervals are listed for the same interface. + +R1# show ip ospf int s 0/0.100 +Serial0/0.100 is up, line protocol is up +Internet Address 10.1.111.1/24, Area 0 +Process ID 1, Router ID 1.1.1.1, Network Type NON_BROADCAST, Cost: 64 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 1.1.1.1, Interface address 10.1.111.1 +No backup designated router on this network +466 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 +! Lines omitted for brevity + +! Below, R1 shows a neighbor on S0/0.100, in the full state, meaning the routers +! have completed LSDB exchange. Note the current Dead timer counts down, in this +! case from 2 minutes; the value of 1:58 means R1 last received a Hello from +! neighbor 10.1.111.6 two seconds ago. + +R1# sh ip ospf neighbor 6.6.6.6 +Neighbor 6.6.6.6, interface address 10.1.111.6 +In the area 0 via interface Serial0/0.100 +Neighbor priority is 0, State is FULL, 8 state changes +DR is 10.1.111.1 BDR is 0.0.0.0 +Poll interval 120 +Options is 0x42 +Dead timer due in 00:01:58 +Neighbor is up for 00:17:22 +! Lines omitted for brevity + + +Transmitting LSA Headers to Neighbors + +When two routers hear Hellos, and the parameter check passes, they do not immedi-ately send packets holding the LSAs. Instead, each router creates and sends Database Description (DD, or sometimes called DBD) packets, which contain the headers of each LSA. The headers include just enough information to uniquely identify each LSA and its revision without transmitting its body. Essentially, the routers exchange an index list of all the LSAs they each know about; the next step in the process is letting a router request a new copy of only those LSAs it does not have or which are less recent. + +The DD messages use an OSPF-defined simple error-recovery process. Each DD packet, which can contain several LSA headers, has a sequence number assigned. The receiver acknowledges a received DD packet by sending a DD packet with the identical sequence number back to the sender. The sender uses a window size of one packet and then waits for the acknowledgment before sending the next DD packet. + +Database Description Exchange: Master/Slave Relationship + +As a neighbor relationship forms between two routers (specifically, at the ExStart stage of the neighborship), the neighbors determine which router is to be the master and which is to be the slave during the database exchange between them. The roles of master and slave define the responsibilities of routers during the exchange of DD packets. Only the mas-ter is allowed to send DD packets on its own accord as well as to set and increase their sequence numbers. A slave is allowed to send a DD packet only as a response to a DD packet received from master router, and must use the same sequence number. In effect, a slave is polled by the master and only responds to it. +Chapter 9: OSPF 467 + +Among other fields, a DD packet header contains three flags: + +■ Master (MS) flag: Set in all DD packets sent by the master, and cleared in all packets sent by the slave + +■ More (M) flag: Set when a router intends to send an additional DD packet after this one + +■ Init (I) flag: Indicates that this is the initial DD packet that starts the exchange, and subsequent DD packets, either from master or slave, have the I flag cleared + +The M flag requires further explanation. Before two routers synchronize their link-state databases, the count of LSAs in their databases can considerably differ. One router might hold hundreds or more LSAs in its database while the other might have just a handful of them. During the DD packet exchange, one router might need to send many DD packets while the other might be able to list all its known LSAs in a single DD packet. There are, however, two rules to sending DD packets that must be observed at all times: +1. Each DD packet sent from the master must be replied to by the slave (that is, the number of DD packets sent from master to slave must match the number of DD packets sent from slave to master). +2. A slave can send a DD packet only as a response to receiving a master’s DD packet (that is, without receiving a DD packet from master, a slave is not allowed to send a DD packet on its own). + +How shall these rules be obeyed if the routers have different counts of DD packets to send? + +Satisfying the first rule is actually very simple: If a router has no more LSA headers to advertise but its peer requires it to send more DD packets, the router will simply send empty DD packets. + +Satisfying the second rule is really concerned about the slave letting the master know whether it has more DD packets to send. If it does, the master must continue polling the slave, even if it has no more LSAs to advertise itself. This is accomplished by the slave set-ting the M flag in its DD packet sent in response to the master’s DD packet. If the master receives a DD packet from the slave with the M flag set, it knows that the slave has at least one more DD packet to send, so it must poll it again. A master will stop send send-ing DD packets to a slave when it has no more LSA headers to advertise, and the slave’s last received DD packet has the M flag cleared, indicating that the slave itself has adver-tised its entire LSA list. + +Apart from the slave setting the M flag to ask the master to poll it again, both master and slave appropriately set the M flag in their DD packets to indicate when they have com-pleted advertising their entire link-state database. This knowledge is necessary to move the neighbor to the appropriate state, either Loading or Full, when the complete list of LSAs in the neighbor’s database is known. +468 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + +In the beginning of the exchange, each router places the other into the ExStart state. Each of them considers itself to be the master, and sends an empty DD packet to the other router, containing a randomly chosen sequence number, and MS (Master), M (More), and I (Init) flags set to 1. After receiving the neighbor’s DD packet, however, the router with the lower RID will change its role to slave, and it will respond with a DD packet with +MS and I flags cleared and the sequence number set to the sequence number of master’s DD packet. This accomplishes the master/slave selection, and both routers move to the Exchange state. The master will then send a DD packet with the sequence number incre-mented by 1, optionally containing one or more LSA headers, and the slave will respond with a DD packet reusing the same sequence number from the received packet, option-ally advertising its own LSA headers. The exchange continues in the same fashion, with the master incrementing the sequence number of each subsequent DD packet, until both routers have advertised all known all LSA headers (the master will stop sending DD pack-ets when it has advertised all LSA headers itself and the last DD response from the slave +has the M flag cleared). + + + +Requesting, Getting, and Acknowledging LSAs + +After all LSA headers have been exchanged using DD packets, each neighboring router has a list of LSAs known by the neighbor. Using that knowledge, a router needs to request a full copy of each LSA that is missing from its own LSDB. + +To know whether a neighbor has a more recent copy of a particular LSA, a router looks at the sequence number of the LSA in its LSDB and compares it to the sequence number of that same LSA learned from the DD packet. Each LSA’s sequence number is incremented every time the LSA changes or is reoriginated. So, if a router received (through a DD packet) an LSA header with a later sequence number for a particular LSA (as compared with the LSA in the LSDB), that router knows that the neighbor has a more recent LSA. For example, R1 sent R2 an LSA header for the type 1 LSA that describes R1 itself, +with sequence number 0x80000004. If R2’s database already held that LSA, but with a sequence number of 0x80000003, R2 would know that it needs to ask R1 to send the lat-est copy (sequence number 0x80000004) of that LSA. + + + +Key Topic + +Note In OSPF, LSA sequence numbers form a space of linearly ordered signed 32-bit integers going from –231+1 to 231–1, or from –2,147,483,647 to 2,147,483,647. The value 231 is reserved to detect when the LSA numbers wrap, and is not used as a sequence number. Because in most computer systems, negative integers are stored in two’s comple-ment, printing out the value of the two’s complement of a negative number in hexadecimal form yields values 0x80000001 (corresponds to –231+1) through 0xFFFFFFFF (cor-responds to –1). Hence, when printed out in hexadecimal, LSA sequence numbers start with 0x80000001 (–231+1); increase through 0xFFFFFFFF (–1), 0x00000000 (0), and 0x00000001 (1); and finish at 0x7FFFFFFF (231–1). If the sequence number of an LSA was to be increased to 0x80000000, this LSA would need to be flushed from the LSDB and then reoriginated with the sequence number starting again at 0x80000001. The sequence +number 0x80000000 never appears on the wire. +Chapter 9: OSPF 469 + +Routers use Link-State Request (LSR) packets to request one or more LSAs from a neighbor. The neighboring router replies with Link-State Update (LSU) packets, which hold one or more full LSAs. As shown in Figure 9-1, both routers sit in a Loading state while the LSR/LSA process continues. After the process is complete, they settle into a Full state, which means that the two routers should have fully exchanged their databases, resulting in identical copies of the LSDB entries for that area on both routers. + +The LSR/LSA process uses a reliable protocol that has two options for acknowledging packets. First, an LSU can be acknowledged by the receiver of the LSU simply repeating the exact same LSU back to the sender. Alternatively, a router can send back an LSAck packet to acknowledge the packet, which contains a list of acknowledged LSA headers. + +At the end of the process outlined in Figure 9-1, two neighbors have exchanged their LSDBs. As a result, their LSDBs should be identical. At this point, they can each indepen-dently run the Dijkstra’s Shortest Path First (SPF) algorithm to calculate the best routes from their own perspectives. + +Designated Routers on LANs + +OSPF optimizes the LSA flooding process on multiaccess data links by using the con-cept of a designated router (DR). Without the concept of a DR, each pair of routers that share a data link would become fully adjacent neighbors. Each pair of routers would directly exchange their LSDBs with each other, as shown in Figure 9-1. On a LAN with only six routers, without a DR, 15 different pairs of routers would exist, and 15 differ-ent instances of full database flooding would occur. OSPF uses a DR (and a backup DR, or BDR) on a LAN or other multiaccess network. The flooding occurs through the DR, reducing the unnecessary exchange of redundant LSAs. + + +Note The true optimization of flooding provided by the DR depends on the situation that prompts the flooding. If a router on a common segment needs to advertise an update, the concept of a DR requires that the update is actually flooded twice: first from the router that advertises the update to the DR/BDR, and second, from the DR to all routers on the segment. This double flooding can hardly be considered an optimization. However, when a new multiaccess segment with multiple routers boots up, or if a new router is connected to such a segment, the presence of a DR/BDR allows the routers to synchronize only to a DR and BDR, alleviating the need of synchronizing to each other, possibly flooding the same set of LSAs multiple times. Hence, the optimization provided by the DR/BDR is most vis-ible during the initial synchronization of router databases. +In reality, DRs have a different crucial and the only truly irreplaceable function: They cre-ate a type 2 LSA that represents the multiaccess network segment. LSA types are covered in the next major section, “OSPF Design and LSAs.” + + +The next section goes through the basics of the DR/BDR process on LANs, which is fol-lowed by coverage of options of OSPF network types and how they impact OSPF flood-ing on Frame Relay links. +470 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Designated Router Optimization on LANs + +The basic rule about exchanging LSDB contents states that only routers in the Full state are allowed to exchange LSAs. On a multiaccess segment, every router is in the Full state only with DR and BDR routers. The DR and BDR are in the Full state with all routers +on the segment and with each other as well. If the DR or BDR needs to send an update, it simply does it directly by sending an LSU packet containing the updated LSA to the multicast IP address 224.0.0.5, the All OSPF Routers group. Every other OSPF router on the multiaccess segment will receive this LSU and acknowledge its arrival by sending a unicast LSAck packet to the router that sourced the LSU. + +A router on a multiaccess segment that is neither DR nor BDR is in the Full state only with the DR and BDR. If it needs to send an update, it sends an LSU packet to the mul-ticast IP address 224.0.0.6, the All OSPF DR Routers group that contains only the DR and BDR. Both the DR and BDR will store the updated LSA from the LSU in their LSDB. The DR then floods a new LSU packet containing the same updated LSA to all OSPF routers on the segment using the multicast IP address 224.0.0.5. Neither the DR nor BDR acknowledge the original LSU with an LSAck—while they could, and it would be a valid acknowledgment, it is not necessary. Instead, the LSU flooded by the DR serves as an implicit acknowledgment to the original router that sent the update. Other routers on the segment including the BDR, except the original router, will acknowledge the DR’s LSU with a unicast LSAck sent to the DR. + + +Note In topologies without a DR, the LSU packets are typically sent to the 224.0.0.5 All OSPF Routers multicast IP address. + + +Example 9-2 shows the output of a show ip ospf neighbor command issued on Router R1 connected to a common Fast Ethernet segment with three other routers. According to this output, the router with the OSPF RID of 8.8.8.8 is the DR, the router with the OSPF RID of 7.7.7.7 is the BDR, and both these neighbors have reached the Full state with respect to R1. Another router on the segment with the OSPF RID of 2.2.2.2 is neither the DR nor the BDR. Because R1 is obviously not a DR or BDR itself, Routers R1 and 2.2.2.2 remain in the 2-Way state. + +Example 9-2 show ip ospf neighbor Command + +R1# sh ip ospf neighbor fa 0/0 + +Neighbor ID +2.2.2.2 +7.7.7.7 +8.8.8.8 + +Pri State +1 2WAY/DROTHER +1 FULL/BDR +1 FULL/DR + +Dead Time +00:00:35 +00:00:38 +00:00:34 + +Address +10.1.1.2 +10.1.1.3 +10.1.1.4 + +Interface +FastEthernet0/0 +FastEthernet0/0 +FastEthernet0/0 + + +When a DR is used on a link, routers end up as DR, BDR, or neither; a router that is neither a DR or a BDR is called a DROther router. The DR and BDR form full adjacen-cies with all other neighbors on the link, so they reach a Full state when the database exchange process is complete. However, two neighbors that are both DROthers do not +Chapter 9: OSPF 471 + +become fully adjacent; they stop at the 2-Way state, as shown in Example 9-2. Stopping at the 2-Way state between two DROther routers is normal. It simply means that the Hello parameter match and bidirectional visibility check worked, but the neighbors do not need to proceed to the point of synchronizing their LSDBs directly, because they do not need to when a DR is present. + +To describe the fact that some neighbors do not directly exchange DD and LSU packets, OSPF makes a distinction between the terms neighbors and adjacent, as follows: + +■ Neighbors: Two routers that share a common data link and that exchange Hello mes-sages, and the Hellos must match for certain parameters. + +■ Adjacent (fully adjacent): Two neighbors that have completed the process of fully exchanging DD and LSU packets directly between each other. + +Note that although DROther routers do not exchange DD and LSU packets directly with each other, like R1 and R2 in Figure 9-2, the DROther routers do end up with an identical copy of the LSDB entries by exchanging them with the DR. + +DR Election on LANs + +As noted in Figure 9-1, if a DR is elected, the election occurs after the routers have become neighbors, but before they send DD packets and reach the ExStart neighbor state. When an OSPF router reaches the 2-Way state with the first neighbor on an inter-face, it has already received at least one Hello from that neighbor and has found its RID in the list of seen routers in the received Hello. If the Hello messages state a DR of 0.0.0.0— meaning that none have been elected—the router waits before attempting to elect a DR. This typically occurs after a failure on the LAN. OSPF routers wait with the goal of giv-ing all the routers on that subnet a chance to finish initializing after a failure so that all the routers can participate in the DR election; otherwise, the first router to become active would always become the DR. (The time period is called the OSPF wait time, which is set to the same value as the Dead timer.) + +However, if the received Hellos already list the DR’s RID, the router does not have to wait before beginning the election process. This typically occurs when one router lost its con-nection to the LAN, but other routers remained and continued to work. In this case, the newly connected router does not attempt to elect a new DR, assuming that the DR listed in the received Hello is indeed the current DR. + +The election process allows for the possibility of many different scenarios for which rout-ers might and might not become the DR or BDR. Generally speaking, the following rules govern the DR/BDR election process: + + +■ Key +Topic +■ + +Any router with its OSPF priority set to 1–255 inclusive is eligible to become a DR or BDR. A router with its OSPF priority set to 0 is ignored in DR/BDR elections. + +Each router performs the elections locally based on the collected data from other neighbors on the segment; however, the algorithm makes sure that all routers ulti- +mately arrive at the same conclusion. +472 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ During the wait interval, whose length is automatically set to the Dead interval on the interface, each router collects the priorities and RIDs of other neighbors on the segment by listening to received Hellos, adding its own RID and priority to the list as well. However, a router does not assert itself as the DR or BDR during the wait interval, and all Hellos it sends indicate that the DR and BDR are not yet elected (the IP addresses in the DR and BDR fields in Hellos are set to 0.0.0.0). + +■ If, during the wait interval, a Hello packet arrives from a neighbor that claims itself to be the BDR (meaning both DR and BDR have already been elected and the BDR is alive), or if a neighbor that claims to be the DR and no BDR address is indicated in +the Hello (meaning that the DR has already been elected and there is no BDR present on the network), the router immediately proceeds to the DR/BDR election process. Otherwise, the full wait interval period on the interface needs to expire. + +■ The election is performed only for those roles that are not yet claimed in neighbor Hellos (either both DR and BDR, or just BDR). A router examines the list of priorities and RIDs it has collected over the wait interval, choosing the router with the highest priority as the DR (if the role is not taken already) and the router with the second-highest priority as the BDR (if the role is not taken already). If multiple routers adver-tise the same highest or second-highest priority, still competing for the role of DR or BDR, the higher RID is used to break the tie. + +■ After the election has completed, if a new router arrives or an existing router improves its priority, it cannot preempt the existing DR and take over as DR (or as BDR). + +■ When a DR is elected and the DR fails, the BDR becomes the DR, and a new election is held for a new BDR. + +In certain scenarios, two or more routers might temporarily arrive at a different result of DR/BDR elections. This can happen if, for example, two or more routers are connected to a switched network that undergoes an STP topology change that requires 50 seconds to heal (for example, an indirect link failure). While the network is partitioned, routers arrive at different results of DR/BDR elections, as each network partition will elect its own DR and BDR. After the network becomes connected again, different routers will claim dif-ferent DRs/BDRs in their Hellos. When this happens, the rule about DR/BDR elections being nonpreemptive is ignored (upholding it would prevent the routers from arriving at a single DR/BDR), and the contending routers enter the election phase again. + +Designated Routers on WANs and OSPF Network Types + +Using a DR makes good sense on a LAN because it might improve LSA flooding efficiency. Likewise, not using a DR on a point-to-point WAN link also makes sense, because with only two routers on the subnet, there is no inefficiency upon which to improve. However, on nonbroadcast multiaccess (NBMA) networks, arguments can be made regarding whether a DR is helpful. So, OSPF includes several options that include a choice of whether to use a DR on WAN interfaces. +Chapter 9: OSPF 473 + +Cisco router interfaces can be configured to use, or not use, a DR, plus a couple of other key behaviors, based on the OSPF network type for each interface. The OSPF network type determines that router’s behavior regarding the following: + +■ Whether the router tries to elect a DR on that interface Key +Topic ■ Whether the router must statically configure a neighbor (with the neighbor com- +mand), or find neighbors using the typical multicast Hello packets + +■ Whether more than two neighbors should be allowed on the same subnet + +For example, LAN interfaces default to use an OSPF network type of broadcast . OSPF broadcast networks elect a DR, use Hellos to dynamically find neighbors, and allow more than two routers to be in the same subnet on that LAN. For High-Level Data Link Control (HDLC) and Point-to-Point Protocol (PPP) links, OSPF uses a network type of point-to-point, meaning that no DR is elected, only two IP addresses are in the subnet, and neighbors can be found through Hellos. + +Table 9-3 summarizes the OSPF interface types and their meanings. Note that the inter-face type values can be set with the ip ospf network type interface subcommand; the first column in the table not only describes the interface type but also lists the exact key-word for the type argument. Also, for cases in which a DR is not elected, all routers that become neighbors also attempt to become adjacent by the direct exchange of DD, LSR, and LSU packets. + + +Table 9-3 OSPF Network Types +Key +Topic Interface Type Uses DR/ BDR? + + + +Default Hello Interval + + + +Requires +a neighbor Command? + + + +More Than Two Hosts Allowed in the Subnet? + +Broadcast Yes 10 No Yes + +Point-to-point No 10 No No +1 + +Non-broadcast2 (NBMA) Yes 30 Yes Yes + +Point-to-multipoint No 30 No Yes + +Point-to-multipoint No 30 Yes Yes nonbroadcast +Loopback3 No – – No + +1 Default on Frame Relay point-to-point subinterfaces. + +2 Default on Frame Relay physical and multipoint subinterfaces. + +3 Cannot be configured manually—used on loopback interfaces automatically. +474 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Caveats Regarding OSPF Network Types over NBMA Networks + +When configuring OSPF over Frame Relay, the OSPF network type concept can become a bit troublesome. In fact, many CCIE Routing and Switching lab preparation texts and lab books focus on the variety of combinations of OSPF network types used with Frame Relay for various interfaces/subinterfaces. The following list contains many of the key items you should check when looking at an OSPF configuration over Frame Relay, when the OSPF network types used on the various routers do not match: + +■ Make sure that the default Hello/Dead timers do not cause the Hello parameter check to fail. (See Table 9-3 for the defaults for each OSPF network type.) + +■ If one router expects a DR to be elected, and the other does not, the neighbors might come up and full LSAs be communicated. However, show command output might show odd information, and next-hop routers might not be reachable. So, make sure that all routers in the same NBMA subnet use an OSPF network type that either uses a DR or does not. + +■ If a DR is used, the DR and BDR must have a permanent virtual circuit (PVC) to every other router in the subnet. If not, routers will not be able to learn routes, because the DR must forward the LSU packets to each of the other routers, and in addition, the type 2 LSA originated by the DR for the common subnet will contain incomplete information. Routers that do not have a PVC to every other router must not be permitted to become a DR/BDR. + +■ If neighbors need to be configured statically, configuring the neighbor command on a single router is sufficient to bring up the OSPF adjacency with the configured neighbor. For clarity and stability, however, it is better to configure neighbor com-mands on both routers. + +Two simple options exist for making OSPF work over Frame Relay—both of which do not require a DR and do not require neighbor commands. If the design allows for the use of point-to-point subinterfaces, use those and take the default OSPF network type of point-to-point, and no additional work is required. If multipoint subinterfaces are needed, or if the configuration must not use subinterfaces, adding the ip ospf network point- +to-multipoint command on all the routers works, without requiring additional effort to manually define neighbors or worry about which router becomes the DR. + +Example of OSPF Network Types and NBMA + +On NBMA networks with an OSPF network type that requires that a DR be elected, you must take care to make sure that the correct DR is elected. The reason is that the DR and BDR must each have a PVC connecting them to all the DROther routers and to +each other. Otherwise, appropriate LSA flooding will not be possible and the type 2 LSA generated for the NBMA network might contain incomplete information, or there might even be multiple conflicting type 2 LSAs. So, with partial meshes, the election should be influenced by configuring the routers’ priority and RIDs such that the hub site of a hub-and-spoke partial mesh becomes the DR. Figure 9-2 shows an example network for which R1 should be the only router allowed to become the DR or BDR. +Chapter 9: OSPF 475 + + +10.3.1.3/23 E0/0 + +10.3.1.4/23 +E0/0 + + +R3 S0/0.1 Mpt + + +R4 S0/0.1 P-P + + + + +10.1.111.0/24 FR +RID 1.1.1.1 + + + + +10.5.1.5/24 +E0/0 R5 S0.1 Mpt + +R1 S0/0 +Phy. + + + + + +10.6.1.6/24 E0/0 + +Figure 9-2 + +S0.1 Mpt +R6 + +Network Used in the Frame Relay Priority and Network Type Example + + +Example 9-3 depicts the following scenarios relating to DR election in Figure 9-2: + +■ The R1, R3, and R5 configuration is correct for operating with the default OSPF net-work type nonbroadcast in a partial mesh. + +■ R6 has omitted the ip ospf priority interface subcommand, causing it to inadvisably become the DR. + +■ R4 will be used as an example of what not to do, in part to point out some interest-ing facts about OSPF show commands. + + +Note Figure 9-2 and Example 9-3 do not depict a suggested design for Frame Relay and OSPF. With this topology, using point-to-point subinterfaces in all cases, using four small (/30) subnets, and defaulting to OSPF network type point-to-point would work well. Such a design, however, would not require any thought regarding the OSPF network type. So, this example is purposefully designed to provide a backdrop from which to show how the OSPF network types work. + + +Example 9-3 shows only the nondefault OSPF configuration settings; also, the routers have an obvious RID numbering scheme (1.1.1.1 for R1, 2.2.2.2 for R2, and so on). + +Example 9-3 Setting Priority on NBMA Networks + +! R1 configuration – the neighbor commands default to a priority value of 0, +! meaning R1's perception of that neighbor is priority 0. + +router ospf 1 +log-adjacency-changes detail +network 0.0.0.0 255.255.255.255 area 0 +neighbor 10.1.111.3 +476 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +neighbor 10.1.111.4 +neighbor 10.1.111.5 +neighbor 10.1.111.6 + +! R3 configuration – R3's interface priority is set to 0; R1 will use the higher +! of R3's announced priority 0 (based on R3's ip ospf priority interface +! subcommand) and the priority value on R1's neighbor command, which defaulted +! to 0. So, R3 will not ever become a DR/BDR. + +interface Serial0/0.1 multipoint +ip address 10.1.111.3 255.255.255.0 +ip ospf priority 0 +frame-relay interface-dlci 100 + +! R4 configuration – note from Figure 9-2 that R4 is using a point-to-point +! subinterface, with all defaults. This is not a typical use of a point-to-point +! subinterface, and is shown to make a few points later in the example. + +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + +! R5's configuration is equivalent to R3 in relation to the OSPF network type +! and its implications. + +interface Serial0.1 multipoint +ip address 10.1.111.5 255.255.255.0 +ip ospf priority 0 +frame-relay interface-dlci 100 +! +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + +! R6 configuration – R6 forgot to set the interface priority with the +! ip ospf priority 0 command, defaulting to priority 1. + +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 + +! Below, the results of R6's default interface priority of 1 – R6, with RID +! 6.6.6.6, and an announced priority of 1, wins the DR election. Note that the +! command is issued on R1. + +R1# show ip ospf neighbor + +Neighbor ID +6.6.6.6 +3.3.3.3 + +Pri State +1 FULL/DR +0 FULL/DROTHER + +Dead Time +00:01:52 +00:01:46 + +Address +10.1.111.6 +10.1.111.3 + +Interface +Serial0/0 +Serial0/0 +Chapter 9: OSPF 477 + +N/A 0 ATTEMPT/DROTHER – 10.1.111.4 Serial0/0 +5.5.5.5 0 FULL/DROTHER 00:01:47 10.1.111.5 Serial0/0 + +! Next, R1's neighbor command was automatically changed to "priority 1" based on +! the Hello, with priority 1, that R1 received from R6. To prevent this dynamic +! reconfiguration, you could add an ip ospf priority 0 command under R6's s0/0.1 +! interface. + +R1# show run | beg router ospf 1 +router ospf 1 +network 0.0.0.0 255.255.255.255 area 0 +neighbor 10.1.111.6 priority 1 +neighbor 10.1.111.3 +neighbor 10.1.111.4 +neighbor 10.1.111.5 +! Lines omitted for brevity + +! Below, R4 is OSPF network type "point to point," with Hello/dead of 10/40. +! R1's settings, based on Table 9-3, would be nonbroadcast, 30/120. + +R4# show ip ospf int s 0/0.1 +Serial0/0.1 is up, line protocol is up +Internet Address 10.1.111.4/24, Area 0 +Process ID 1, Router ID 4.4.4.4, Network Type POINT_TO_POINT, Cost: 1562 +Transmit Delay is 1 sec, State POINT_TO_POINT, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +! Lines omitted for brevity + +! Below, R4 changes its network type to yet a different value, one that expects +! neighbor commands, but does not expect a DR to be used. + +R4# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R4(config)# int s 0/0.1 +R4(config-subif)# ip ospf network point-to-multipoint non-broadcast + +! Next, R1 and R4 become neighbors now that the Hello parameters match. Note that +! R1 believes that R4 is DROther. + +R1# show ip ospf neighbor + +Neighbor ID Pri State Dead Time Address Interface +! Lines omitted for brevity +4.4.4.4 1 FULL/DROTHER 00:01:56 10.1.111.4 Serial0/0 + +! Below, R4 agrees it is in a full state with R1, but does not list R1 as DR, +478 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! because R4 is not using the concept of a DR at all due to R4's network type. + +R4# sh ip ospf neigh + +Neighbor ID +1.1.1.1 + +Pri State +0 FULL/ – + +Dead Time +00:01:42 + +Address +10.1.111.1 + +Interface +Serial0/0.1 + + + + + + + + +Key Topic + +In the following text, it is assumed that all neighbor statements define neighbors reach-able over a single interface. If there are static neighbors configured that are reachable over different interfaces, the following text applies individually to each group of static neigh-bors reachable over a particular interface. + +One of the important points from Example 9-3 is the use of the priority setting in the neighbor command. There is much confusion regarding its use. Somewhat surprisingly, the priority specified in the neighbor command is never used in DR/BDR elections. For that purpose, exclusively the interface priority configured by the ip ospf priority inter-face command is taken into account. However, if there are multiple neighbor statements configured and at least one of them has a nonzero priority specified in the statement (the default neighbor priority setting is 0 when unspecified), the router will first send Hello packets only to those neighbors with a nonzero priority. Only after DR/BDR elec-tions have completed between these routers, the router will start sending Hello packets to all remaining neighbors. In consequence, if the priority setting in the neighbor com-mand matches the interface priority of the neighbor, the router will first engage in DR/ BDR elections with only those neighbors that have a chance of becoming DR/BDR. This +optimization increases the chances that the DR and BDR roles will be taken up by appro-priate routers, and prevents routers from competing in DR/BDR elections with neighbors that are not entitled to these roles. + +The priorities specified in the neighbor commands do not need to match the real priori-ties of these neighbors, but if they differ, the router can engage in DR/BDR elections with neighbors not entitled to become a DR/BDR. In any case, though, real priorities of these neighbors as seen in their Hello packets will be used to complete the DR/BDR elec-tions. Some IOS versions might even automatically update the priority in the neighbor statements in case a mismatch is detected; however, in recent IOS versions, the configura-tion is not updated automatically. + +If all neighbor statements omit the priority setting, this optimization is not used, and all neighbors are contacted immediately. Also, if the neighbors are reachable over an inter-face whose priority has been set to 0 using the ip ospf priority command, the router will automatically remove all corresponding neighbor statements from the configuration. This behavior prevents the router from participating in any way in the DR/BDR elections (even though an advertised priority of 0 would suffice alone to prevent the router from ever becoming a DR or BDR), and it forces the router to wait for its neighbors to contact it. In this case, the router knows about no neighbors on its own, and is dependent on the DR and BDR contacting it thanks to their own neighbor statements. + +Also note that, although neighbors must be statically configured for some network types, the neighbor command needs to be configured on only one router. R3 and R5, with cor- +rect working configurations, did not actually need a neighbor command. +Chapter 9: OSPF 479 + +Finally, it might seem that all is now fine between R1 and R4 by the end of the example, but even though the neighbors are fully adjacent, R4 cannot route packets to R3, R5, or R6 over the Frame Relay network. For example, R5 could have some routes that point to 10.1.111.4 (R4’s Frame Relay IP address) as the next hop. However, because R5 is using +a multipoint subinterface, R5 will not know what PVC to use to reach 10.1.111.4. In this case, the routers with multipoint subinterfaces would need to add frame-relay map com-mands. For example, R5 would need a frame-relay map ip 10.1.111.4 100 broadcast command, causing packets to next-hop 10.1.111.4 to go over DLCI 100 to R1, which would then route the packet on to R4. Keep in mind that R4’s configuration is not a rec-ommended configuration. + +SPF Calculation + +So far, this chapter has covered a lot of ground related to the exchange of LSAs. Regardless of the OSPF network type and whether DRs are used, after a router has new or different information in its LSDB, it uses the Dijkstra SPF algorithm to examine the LSAs in the LSDB and derive the new tree of shortest paths to available destinations. The LSAs in the LSDB contain information to create a math equivalent of a figure of a net-work. This mathematical model has routers, links, costs for each link, and the current (up/ down) status of each link. Figure 9-3 represents the SPF model of a sample network. + + +Route S2 – R1 – R5 : Cost 1 + 100 + 10 = 111 Route S2 – R2 – R5 : Cost 1 + 64 + 10 = 75 +C 100 + +10.5.15.0/24 + + +R1 +C 1 + + +10.1.1.0/24 + + + +C 100 C 1 C 1 VLAN 1 10.5.1.0/24 10.5.25.0/24 +C 10 R5 C 50 C 64 R2 S2 + +Figure 9-3 Single-Area SPF Calculation: Conceptual View + +In this simple network, humans can easily see the conclusion that the SPF algorithm will reach, even though the algorithm itself requires a couple of steps to arrive at the same conclusion. SPF on a router constructs least-cost paths from this router to all possible destinations, summing the costs for each outgoing interface along a path to a destination and picking the path with the lowest total cost. Found destinations and corresponding next hops on the least-cost paths toward these destinations are then placed into the rout-ing table. For example, S2 calculates two possible routes to subnet 10.5.1.0/24, with the better route being out S2’s VLAN 1 interface, with R2 as the next-hop router. Also note in Figure 9-3 that the cost values are per interface, and it is each outgoing interface’s cost that SPF adds to come up with the total cost of the route. +480 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Steady-State Operation + +Even after a network has stabilized, all routers in the same area have the exact same LSAs, and each router has chosen its best routes using SPF, the following is still true of routers running OSPF: + +■ Each router sends Hellos, based on per-interface hello intervals. + +■ Each router expects to receive Hellos from neighbors within the dead interval on each interface; if not, the neighbor is considered to have failed. + +■ Each router originally advertising an LSA refloods each LSA (after incrementing its sequence number by 1) based on a per-LSA Link-State Refresh (LSRefresh) interval (default 30 minutes). + +■ Each router expects to have its LSA refreshed within each LSA’s MaxAge timer (default 60 minutes). + + +OSPF Design and LSAs This section covers two major topics: + +■ OSPF design + +■ OSPF LSA types + +Although these might seem to be separate concepts, most OSPF design choices directly impact the LSA types in a network and impose restrictions on which neighbors can exchange those LSAs. This section starts with an OSPF design and terminology review, and then moves on to LSA types. Toward the end of the section, OSPF area types are covered, including how each variation changes how LSAs flow through the different types of OSPF stubby areas. + +OSPF Design Terms + +OSPF design calls for grouping links into contiguous areas. Routers that connect to links in different areas are Area Border Routers (ABR). ABRs must connect to area 0, the backbone area, and to one or more other areas as well. It is noteworthy to mention that RFC 2328 defines an ABR simply as a router “attached to multiple areas.” While it +does not explicitly state that one of these areas must be the backbone area 0, it nonethe-less implicitly assumes it throughout its contents. This slight ambiguity has led different vendors to implement ABR functionality in slightly different ways. It is therefore strongly recommended to become familiar with RFC 3509, “Alternative Implementations of OSPF Area Border Routers,” which explains in detail the Cisco approach to implementing ABR functionality. The key takeaway is that in the Cisco implementation, only a router that is actively attached to multiple areas (that is, has at least one active interface in these areas), including the backbone area, considers itself an ABR and performs the appropriate func-tions. A router actively attached to multiple areas but not to the backbone area does not consider itself an ABR and does not act like one. +Chapter 9: OSPF 481 + +Autonomous System Boundary Routers (ASBR) inject routes external to OSPF into the OSPF domain, having learned those routes from wide-ranging sources from the Border Gateway Protocol (BGP) on down to simple redistribution of static routes. Figure 9-4 shows the terms in the context of a simple OSPF design. + + +Area x + +Stub Network Internal Router + +R1 + +Transit Network + + +Area Border Router + +ABR1 + + + +Backbone Router + +BB1 + + +Autonomous System Border Router + +ASBR1 + + + + +Another Routing Protocol + + +R2 + +Area 0 +R3 Backbone Area + +Area y BB2 + + +R4 + +ABR2 +Area Border R5 Router + +Backbone Router + + + +Figure 9-4 OSPF Design Terminology + + + +Key Topic + +Conceptually, an OSPF router keeps an independent and separate LSDB for each area to which it is connected. An internal router to an area has a single LSDB; an ABR has multi-ple separate LSDBs, one for each connected area (one of them must be the backbone area 0). By default, the contents of per-area LSDBs are completely isolated; that is, one LSDB does not leak into another. It is only the ABR role that is entitled to translate and carry information in a controlled way between LSDBs and thus between areas. When com-puting a routing table, SPF is run in each LSDB separately, and the results are combined in a single routing table subject to OSPF path preference rules. While this chapter uses the LSDB as a term to describe the entire link-state information maintained by the OSPF process (that is, the union of all per-area LSDBs) for simplicity reasons, it is important +to keep in mind that in multiarea OSPF, ABRs maintain separate per-area LSDBs and run SPF in each of them independently, and then combine the results and use them to popu-late per-area LSDBs with condensed information about other areas. + +Networks can use a single OSPF area, but using OSPF areas helps speed convergence and +reduce overhead in an OSPF network. Using areas provides the following benefits: + + + +■ +Key +Topic ■ + +■ + +Generally smaller per-area LSDBs, requiring less memory. + +Faster SPF computation thanks to the sparser LSDB. + +A link failure in one area only requires a partial SPF computation in other areas. +482 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ Routes can be summarized and filtered only at ABRs (and ASBRs). Having areas permits summarization, again shrinking the LSDB and improving SPF calculation performance. + +When comparing the use of one area versus using many areas, the number of routers or subnets does not shrink, but the size of the LSDB on most routers should shrink. The LSDB shrinks because an ABR does not pass denser and more detailed type 1 and 2 LSAs from one area to another—instead, it passes type 3 summary LSAs. LSA types 1 and +2 can be thought of as the detailed topology information that causes most of the com-puting-intensive parts of the SPF algorithm. By representing these detailed type 1 and 2 LSAs in a different way in other areas, OSPF achieves its goal of reducing the effects +of SPF. + + +OSPF Path Selection Process + +OSPF has specific rules for selecting a path that crosses areas. Before studying the details of OSPF LSAs, it might help at this point to understand those rules: + +■ OSPF always chooses an intra-area route over an inter-area route for the same prefix, regardless of metric. + +■ ABRs ignore type 3 LSAs learned in a nonbackbone area during SPF calculation, which prevents an ABR from choosing a route that goes into a nonbackbone area and then back into the backbone. + +Note that these conditions can result in both asymmetric routing and suboptimal routing across multiarea OSPF networks. An example will be given in the section “Best-Path Side Effects of ABR Loop Prevention,” later in this chapter. This fact must be considered in both the design and troubleshooting of OSPF networks. + +LSA Types + +Table 9-4 lists the LSA types and their descriptions for reference; following the table, each type is explained in more detail, in the context of a working network. An important fact concerning all LSA types is that only a router that has originated a particular LSA +is allowed to modify it or withdraw it. Other routers must process and flood this LSA within its defined flooding scope if they recognize the LSA’s type and contents, but they must not ever change its contents, block it, or drop it before its maximum lifetime has expired. In other words, LSAs created by other routers are intangible and must be pro-cessed and forwarded unmodified. This requirement makes sure that all routers in an area have the same LSDB contents and have a consistent view of the network. It also brings along a strong limitation typical for all link-state routing protocols: Summarization and route filtering can be done in a very limited fashion, unlike in distance vector protocols, where summarization and route filtering can be performed at any point in the network. +Chapter 9: OSPF 483 + +Table 9-4 OSPF LSA Types Key +Topic LSA Type Common Name Description + + +1 Router + + +2 Network + + + +3 Net Summary + + + + +4 ASBR Summary + + +5 AS External + +6 Group Membership + +7 NSSA External + + +8 External Attributes + + +9–11 Opaque + +One per router per area, listing the router’s RID and all interface IP addresses in that area. Represents stub +networks as well. Flooded only within its area of origin. + +One per transit network. Created by the DR on the subnet, and represents the subnet and the router interfaces connected to the subnet. Flooded only within its area of origin. +Created by ABRs to represent networks present in one area when being advertised into another area. Defines the subnets in the origin area, and cost, but no topology data. Flooded only within its area of origin; reoriginated on ABRs. +Like a type 3 LSA, except it advertises a host route used to reach an ASBR. Flooded only within its area of origin; reoriginated on ABRs. +Created by ASBRs for external routes injected into OSPF. Flooded to all regular areas. +Defined for MOSPF; not supported by Cisco IOS. + +Created by ASBRs inside an NSSA, instead of a type 5 LSA. Flooded only within its area of origin; converted to type 5 LSA on an ABR toward other areas. +Created by ASBRs during BGP-to-OSPF redistribution to preserve BGP attributes of redistributed networks. Not implemented in Cisco routers. +Used as generic LSAs to allow for easy future extension of OSPF; for example, type 10 has been adapted for MPLS traffic engineering. These LSAs have different flooding scope: Type 9 has link-local flooding scope, type 10 has area-local flooding scope, type 11 has autonomous system flooding scope equivalent to the flooding scope of type 5 LSAs (not flooded into stubby areas and NSSAs). + + + +Before diving into the coverage of LSA types, two more definitions are needed: + +■ Transit network: A network over which two or more OSPF routers have become neighbors and elected a DR so that traffic can transit from one to the other. An exception to this rule is a point-to-point interconnection between two routers: This interconnection is treated by OSPF as a combination of a point-to-point link and a +484 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +stub IP network on this link. This is done to facilitate using unnumbered point-to-point links. + +■ Stub network: A subnet on which a router has not formed any neighbor relationships. + +Now on to the LSA types! + + +LSA Types 1 and 2 + +Each router creates and floods a type 1 LSA for itself. These LSAs describe the router, its interfaces (in that area), and a list of neighboring routers (in that area) on each interface. The LSA itself is identified by a link-state ID (LSID) equal to that router’s RID. + +Type 2 LSAs represent a transit subnet for which a DR has been elected. The LSID is the DR’s interface IP address on that subnet. Note that type 2 LSAs are not created for sub-nets on which no DR has been elected. + +Armed with an LSDB with all the type 1 and 2 LSAs inside an area, a router’s SPF algo-rithm is able to create a topological graph of the network, calculate the possible routes, and finally choose the best routes. For example, Figure 9-5 shows a sample internetwork that is used in several upcoming examples. Switches S1 and S2 in the figure are multilayer switches running OSPF, so for OSPF purposes, they are indistinguishable from routers. Figure 9-6 shows a graphical view of the type 1 and type 2 LSAs created in area 3. + +Stub 10.3.2.0/23 Area 3 RID 10.3.3.33 C 1 + + +R33 +C 1 Transit, with DR 10.3.0.0/23 + + + +Area 4 + + +RID 3.3.3.3 +C 64 E0/0 +R3 +C 10 + +RID 4.4.4.4 + + + +Transit, no DR 10.3.13.0/24 + +C 64 + + + + +RID 1.1.1.1 + + + +10.4.1.4/23 +E0/0 R4 + +10.4.14.0/24 +C 1562 + + + + + +Area 5 + +10.5.1.5/24 + + +R1 + +10.5.15.0/24 C 100 + +C 100 +10.5.25.0/24 + +S1 +ASBR RID +10.1.1.0/24 7.7.7.7 +RID 8.8.8.8 + + + +Externals: 192.168.1.0/24 (E1) 192.168.2.0/24 (E2) + + + +E0/0 R5 C 50 RID 5.5.5.5 + + +C 64 R2 RID +2.2.2.2 + +S2 +Area 0 + + +Figure 9-5 Network Used in LSA Examples +Chapter 9: OSPF 485 + + +E0/0 +Stub 10.3.2.33/23 Cost 1 + + + +LSA Type 1 RID 10.3.3.33 + +Represents R33 + + + +E0/0 10.3.1.33 +To Transit with DR 10.3.1.3 Cost 1 + + +To RID 10.3.3.33 Interface 10.3.1.33 +S0/0.1 +Stub 10.3.13.3/24 +LSA Type 2 To RID 3.3.3.3 To RID 1.1.1.1 +DR 10.3.1.3 Interface 10.3.1.3 LSA Type 1 Cost 64 LSA Type 1 +Subnet E0/0 RID 3.3.3.3 S0/0.3 RID 1.1.1.1 10.3.0.0/23 10.3.1.3 Stub 10.3.13.1/24 +Transit with DR 10.3.1.3 To RID 3.3.3.3 +Represents Transit Cost 10 Represents R3 Cost 64 Represents R1 Net 10.3.0.0/23 + +Figure 9-6 Graph of Type 1 and 2 LSAs for Area 3 + +For subnets without a DR, the type 1 LSAs hold enough information for the SPF algo-rithm to create the math model of the topology. For example, R1 and R3 use point-to-point subinterfaces and the OSPF point-to-point network type. SPF can match up the information shown in the type 1 LSAs for R1 and R3 in Figure 9-6 to know that the two routers are connected. + +For transit networks with DRs, OSPF uses a type 2 LSA to model the subnet as a node in the SPF mathematical model. Because the SPF process treats the type 2 LSA as a node +in the graph, this LSA is sometimes called a pseudonode. The type 2 LSA includes references to the RIDs of all routers that are currently neighbors of the DR on that sub-net. That information, combined with the type 1 LSAs for each router connected to the subnet represented by the type 2 LSA, allows SPF to construct an accurate picture of the network. + +Example 9-4 shows the LSAs in area 3 (Figures 9-5 and 9-6) through show commands. Be aware of a long-term glitch in the show ip ospf database output: The Link ID col-umn is a misnomer; correctly, it should say Link State ID. This seemingly subtle differ-ence is serious enough to warrant a mention: While Link State ID is a unique identifier of an entire LSA, a Link ID is a particular entry specifically in a type 1 LSA body that +describes an adjacency to a neighboring object of a router. A single type 1 LSA identified by a single Link State ID can describe several adjacencies represented by several Link ID entries. These two terms are not interchangeable. +486 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 9-4 LSA Types 1 and 2 in Area 3 + +! R3's LSDB is shown, with type 1 LSAs listed as "Router Link States" and type 2 +! LSAs as "Net Link States." The command output shows a section for each LSA type, +! in sequential order. The Link ID column should correctly spell Link State ID. + +R3# show ip ospf database +OSPF Router with ID (3.3.3.3) (Process ID 1) +Router Link States (Area 3) + + +Link ID ADV Router Age Seq# Checksum Link count + +1.1.1.1 +3.3.3.3 +10.3.3.33 + +1.1.1.1 1203 +3.3.3.3 779 +10.3.3.33 899 + +0x80000025 0x0072C3 2 +0x80000027 0x003FB0 3 +0x80000020 0x002929 2 + + +Net Link States (Area 3) +Link ID ADV Router Age Seq# Checksum +10.3.1.3 3.3.3.3 1290 0x8000001F 0x00249E +! Lines omitted for brevity + +! Next, the specific LSA's link ID is included in the show command, listing detail +! for the one LSA type 2 inside area 3. Note that the "Link ID" is the DR's +! interface address on the subnet. The network keyword refers to the network LSAs +! (type 2 LSAs). + +R3# show ip ospf database network 10.3.1.3 +OSPF Router with ID (3.3.3.3) (Process ID 1) +Net Link States (Area 3) + +Routing Bit Set on this LSA +LS age: 1304 +Options: (No TOS-capability, DC) +LS Type: Network Links +Link State ID: 10.3.1.3 (address of Designated Router) +Advertising Router: 3.3.3.3 +LS Seq Number: 8000001F +Checksum: 0x249E +Length: 32 +Network Mask: /23 +Attached Router: 3.3.3.3 +Attached Router: 10.3.3.33 + +! Next, the type 1 LSA for R3 is listed. The link ID is the RID of R3. Note that +! the LSA includes reference to each stub and transit link connected to R3. The +Chapter 9: OSPF 487 + +! router keyword refers to the router LSAs (type 1 LSAs). + +R3# show ip ospf database router 3.3.3.3 +OSPF Router with ID (3.3.3.3) (Process ID 1) +Router Link States (Area 3) + +LS age: 804 +Options: (No TOS-capability, DC) +LS Type: Router Links +Link State ID: 3.3.3.3 +Advertising Router: 3.3.3.3 +LS Seq Number: 80000027 +Checksum: 0x3FB0 +Length: 60 +Number of Links: 3 + +! Note how each network object adjacent to R3 is described by a separate +! entry, each now being correctly labeled as Link ID. + +Link connected to: another Router (point-to-point) +(Link ID) Neighboring Router ID: 1.1.1.1 +(Link Data) Router Interface address: 10.3.13.3 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 +Link connected to: a Stub Network +(Link ID) Network/subnet number: 10.3.13.0 +(Link Data) Network Mask: 255.255.255.0 +Number of TOS metrics: 0 +TOS 0 Metrics: 64 + +! Note that R3's LSA refers to a transit network next, based on its DR IP address; +! these lines allow OSPF to know that this router (R3) connects to the transit +! network whose type 2 LSA has LSID 10.3.1.3, derived from DR's IP address +! in that network. + +Link connected to: a Transit Network +(Link ID) Designated Router address: 10.3.1.3 +(Link Data) Router Interface address: 10.3.1.3 +Number of TOS metrics: 0 +TOS 0 Metrics: 10 + +! Below, the routes from R3 and R1 to 10.3.2.0/23 are shown. Note the cost values +! for each reflect the cumulative costs of the outgoing interfaces used to reach +! the subnet – for instance, R3's cost is the sum of its outgoing interface cost +! (10) plus R33's outgoing interface cost (1). R1's cost is based on three outgoing +! links: R1 (cost 64), R3 (cost 10), and R33 (cost 1), for a total of 75. Also +488 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! note that the time listed in the route is the time since this LSA first arrived +! at the router, even if the LSA has been refreshed due to the LSRefresh interval. + +R3# show ip route ospf 1 | include 10.3.2.0 +O 10.3.2.0/23 [110/11] via 10.3.1.33, 17:08:33, Ethernet0/0 +R1# show ip route ospf | include 10.3.2.0 +O 10.3.2.0/23 [110/75] via 10.3.13.3, 17:10:15, Serial0/0.3 + +The show ip ospf database command lists the LSAs in that router’s LSDB, with LSA type 1 LSAs (router LSAs) first, then type 2 (network link states), continuing sequentially through the LSA types. Also note that the LSDB for area 3 should be identical on R33, R3, and R1. However, on R1, the show ip ospf database command lists all of R1’s LSDB entries, including LSAs from other areas, so using an internal router to look at the LSDB might be the best place to begin troubleshooting a problem. Also note the costs for the routes on R3 and R1 at the end of the example—the SPF algorithm simply added the out-going costs along the routes, from each router’s perspective. + + +Note To signify a network that is down, the appropriate type 1 or 2 LSA is either reorigi-nated and the disconnected network is removed from that LSA, or the entire LSA is pre-maturely aged by setting its age to 3600 seconds and flooding it, causing it to immediately expire from all LSDBs. + + + +LSA Type 3 and Inter-Area Costs + +ABRs do not forward type 1 and 2 LSAs from one area to another. Instead, ABRs adver-tise type 3 LSAs into one area to represent subnets described in both the type 1 and 2 LSAs in another area. Each type 3 summary LSA describes a simple inter-area destina-tion—the subnet, the mask, and the ABR’s cost to reach that subnet, as shown in +Figure 9-7. + + + + + + +R1 + + +Area 0 + +R2’s Three Type 3 LSAs: +Subnet 10.3.2.0/23, Cost 75 Subnet 10.3.0.0/23, Cost 74 Subnet 10.3.13.0/24, Cost 64 + +Add: My cost to reach R1 (cost 1) to Type 3 LSA’s costs + + +S2 + +Routing Table: +10.3.2.0/23: Cost 76 10.3.0.0/23: Cost 75 10.3.13.0/24: Cost 65 + + +Figure 9-7 Representation of Area 3 Subnets as Type 3 LSAs in Area 0 + +Example 9-5 focuses on the three subnets inside area 3, looking at the type 3 summary LSAs created for those subnets by ABR R1. Note the example show commands on S2; S2 has identical area 0 LSDB entries as compared with R1. +Chapter 9: OSPF 489 + +Example 9-5 LSA Type 3 Created by R1 for Area 3’s Subnets + +! S2, internal to area 0, does not have the type 1 and 2 LSAs seen by R3 back in +! Example 9-4. However, type 3 LSAs (listed as "Summary Net Links") show all +! three subnets inside area 3. R1 is listed as the advertising router because it +! created the type 3 LSAs. + +S2# show ip ospf database +! Lines omitted for brevity +Summary Net Link States (Area 0) +Link ID ADV Router Age Seq# Checksum + +10.3.0.0 +10.3.2.0 +10.3.13.0 + +1.1.1.1 257 +1.1.1.1 257 +1.1.1.1 261 + +0x80000001 0x00A63C +0x80000001 0x009A45 +0x80000021 0x007747 + +! Lines omitted for brevity + +! Below, note that the summary keyword is used to view type 3 LSAs. The metric +! reflects R1's cost to reach the subnet inside area 3. + +S2# show ip ospf database summary 10.3.0.0 +OSPF Router with ID (8.8.8.8) (Process ID 1) +Summary Net Link States (Area 0) + +Routing Bit Set on this LSA +LS age: 341 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(Network) +Link State ID: 10.3.0.0 (summary Network Number) +Advertising Router: 1.1.1.1 +LS Seq Number: 80000001 +Checksum: 0xA63C +Length: 28 +Network Mask: /23 +TOS: 0 Metric: 74 + +! Next, S2's routes to all three subnets are listed. S2 calculates its cost +! based on its cost to reach R1, plus the cost listed in the type 3 LSA. For +! example, the cost (above) in the type 3 LSA for 10.3.0.0/23 is 74; S2 adds +! that to S2's cost to reach ABR R1 (cost 1), for a metric of 75. + +S2# show ip route ospf | include 10.3 +O IA 10.3.13.0/24 [110/65] via 10.1.1.1, 00:16:04, Vlan1 +O IA 10.3.0.0/23 [110/75] via 10.1.1.1, 00:05:08, Vlan1 +O IA 10.3.2.0/23 [110/76] via 10.1.1.1, 00:05:12, Vlan1 +490 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! Next, S2's cost to reach RID 1.1.1.1 is listed as cost 1. + +S2# show ip ospf border-routers +OSPF Process 1 internal Routing Table +Codes: i – Intra-area route, I – Inter-area route + +i 1.1.1.1 [1] via 10.1.1.1, Vlan1, ABR, Area 0, SPF 18 +i 2.2.2.2 [1] via 10.1.1.2, Vlan1, ABR, Area 0, SPF 18 +i 7.7.7.7 [1] via 10.1.1.3, Vlan1, ASBR, Area 0, SPF 18 + +! Below, the show ip ospf statistics command lists the number of SPF calculations. + +R1# show ip ospf stat +OSPF process ID 1 +------------------------------------------ +Area 0: SPF algorithm executed 6 times +Area 3: SPF algorithm executed 15 times +Area 4: SPF algorithm executed 6 times +Area 5: SPF algorithm executed 5 times +! Lines omitted for brevity + +Example 9-5 shows how S2 calculated its cost to the area 3 subnets. Routers calculate the cost for a route to a subnet defined in a type 3 LSA by adding the following items: + +■ The calculated cost to reach the ABR that created and advertised the type 3 LSA Key +Topic ■ The cost as listed in the type 3 LSA + +You can see the cost of the type 3 LSA with the show ip ospf database summary link-id command, and the cost to reach the advertising ABR with the show ip ospf border-routers command, as shown in Example 9-5. + +The beauty of this two-step cost calculation process is that it allows a significant reduc-tion in the number of SPF calculations. When a type 1 or 2 LSA changes in some way that affects the underlying routes—for example, a link failure—each router in the area runs SPF, but routers inside other areas do not. They only perform minor modification to their already computed shortest path trees—a process called a partial run, partial SPF , or partial route calculation . + +For example, imagine that in Figure 9-5, R33’s LAN interface cost increases from 1 to 10. R33 will originate a new type 1 LSA and flood it. All routers in area 3 will run a full SPF and will update the metric of the path toward the network 10.3.2.0/23. R1, being an ABR, will then flood an updated type 3 LSA regarding the network 10.3.2.0/23 into areas 0, 4, and 5, indicating the new cost of 84. All other routers in area 0 will install the updated LSA into their LSDB, add the indicated cost of 84 to their cost of reaching R1 as the ABR advertising the LSA, and use the updated cost as the total cost of reaching the 10.3.2.0/23 through R1. No full SPF run was required on any of the routers in area 0. The same would be valid for areas 4 and 5. +Chapter 9: OSPF 491 + +For a more complex scenario, imagine that R3’s LAN interface fails. This event consti-tutes two topological changes to OSPF: R3’s link to the transit network 10.3.0.0/23 is down, and because R3 was the DR in this network, the type 2 LSA it had originated is no longer valid because the interface on which it was DR became inoperable. R3 will therefore flood two updates. First, it will create and flood an updated type 1 LSA with an incremented sequence number that describes all R3’s currently working links in area 3, leaving out the former link to the transit network that is no longer operable. Second, +it will withdraw the type 2 LSA describing the transit network by setting its age to 3600 seconds without incrementing the sequence number and flooding it. + +Upon receiving these updates, R1 will install the updated type 1 LSA from R3 into its area 3 LSDB and will flush the type 2 LSA regarding the transit network 10.3.0.0/23. After running the SPF in area 3 over the updated area 3 LSDB, R1 finds out that the net-work 10.3.0.0/23 no longer exists, and while the R33’s type 1 LSA still exists in the LSDB, it is not reachable: There is no continuous sequence of type 1 and 2 LSAs pointing one to another that can be traversed to reach R33 from R1. As a result, networks 10.3.0.0/23 and 10.3.2.0/23 will be removed from the routing table on R1, so R1 will withdraw the type 3 LSAs about these two networks from areas 0, 4, and 5. Withdrawal of type 3 LSAs does not require a full SPF run. Instead, routers in these areas simply check whether there is another type 3 LSA concerning the same networks providing a backup path, and when they find there is none, they simply remove the affected networks from their routing tables. + +Instead of flushing type 3 LSAs to indicate that the inter-area network is not reachable anymore, it is also possible to advertise an updated type 3 LSA regarding that network with the metric set to 224–1, or 16,777,215. This metric value represents an infinite path cost, and routers will ignore such path. This approach is seldom used, however. RFC 2328 prefers premature aging instead. + +Of particular importance is that partial calculations happen without any route summari-zation. With OSPF, route summarization does help reduce the overall number of routes that require SPF calculations, but route summarization is not required for partial calcula-tions to occur. + +Type 3 summary LSAs are flooded only within the area into which they were originated by ABRs. They do not cross area boundaries. Instead, ABRs compute an internal OSPF routing table for the backbone area using all types of LSAs received in the backbone area, and for each intra-area and inter-area route, they originate a new type 3 LSA to be flooded to their attached nonbackbone areas. For example, in Figure 9-5, R1 creates and floods a type 3 LSA on behalf of the network 10.3.2.0/23 in area 3 into the backbone area. R2 computes its internal routing table for the backbone area using all LSAs received through the backbone, including R1’s summary LSA, and installs an inter-area route to 10.3.2.0/23 through R1. Subsequently, for all intra-area and inter-area routes, including the 10.3.2.0/23 in the backbone area, R2 will create and flood a separate type 3 LSA to its attached nonbackbone area 5. +492 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The following are two important rules about originating and processing type 3 LSAs: + + +■ Key +Topic + + +■ + +An ABR uses only those type 3 LSAs that are received over a backbone area in its SPF calculation. Type 3 LSAs received over nonbackbone areas will be skipped during the ABR’s SPF computation, though they are stored in the ABR’s LSDB and flooded within that nonbackbone area as usual. + +When an ABR creates and floods type 3 LSAs to advertise networks from one area to another, only intra-area routes from nonbackbone areas are advertised into the backbone; both intra-area and inter-area routes are advertised from the backbone +into nonbackbone areas. + + +The second rule is in fact only a direct consequence of the first rule. Because an ABR must not use type 3 LSAs received over a nonbackbone area when running SPF over the associated per-area LSDB, the SPF computation produces no inter-area routes related to that nonbackbone area. Consequently, no inter-area routes from a nonbackbone area can be advertised to the backbone because there are none. Nevertheless, these rules are often stated independently. + +LSA Types 4 and 5, and External Route Types 1 and 2 + + + +Key Topic + +OSPF allows for two types of external routes, aptly named types 1 and 2. The type determines whether only the external metric is considered by SPF when picking the best routes (external type 2, or E2), or whether both the external and internal metrics are added together to compute the metric (external type 1, or E1). The choice of external metric types is always done by a network administrator, depending on the requirements. By default, Cisco routers use the E2 metric type in redistribution. + +When an ASBR injects an external route, it creates a type 5 LSA for the subnet. The LSA lists the metric and the metric type. The ASBR then floods the type 5 LSA throughout all regular areas. Other routers process the LSA depending on the metric type. If the LSA con-tains the E1 metric, the total cost of reaching the external network is computed as the cost of reaching the ASBR, plus the E1 cost of the external network carried in the LSA. In other words, the E1 metric is added to the metric of the path between the calculating router and the ASBR to produce the total metric of the path. If there are multiple paths of reaching the same E1 external network, the path with the least total cost is used. If there are still mul-tiple paths to the same network having the same least cost, all of them will be used. + +If the LSA contains the E2 metric, this metric is used exactly as it is indicated in the LSA. No additional costs are ever summed with the E2 metric. This is because the E2 metric is considered to be orders of magnitude larger than any path cost inside the OSPF domain, or in other words, costs of paths inside the OSPF domain are considered to be negligible (that is, practically zero) in comparison to the E2 metric. If there are multiple paths of reaching the same E2 external network, the path with the lowest E2 metric is used. If there are still multiple paths to the same network with the same lowest E2 metric, the path through the closest ASBR is used. In case there are still multiple paths to the net-work, it follows that they must have the same lowest E2 metric and the same lowest met- +ric of reaching the corresponding ASBRs, and all of them will be used. +Chapter 9: OSPF 493 + +Hence, the total cost of E1 external routes is computed as the cost of reaching the ASBR advertising the network, plus the E1 cost of the external network. The path with the least total cost is used; if there are multiple such paths, use them all. The total cost of +E2 external routes is immediately the E2 cost of the external network. The path with the least E2 cost is used, and in case of a tie, the path having the least cost to an advertising ASBR is used; if there are still multiple paths, use them all. If there are both E1 and E2 routes to the same external network available, the E1 is always preferred to E2. + +Both with E1 and E2 metric types, it is necessary to compute the metric to the ASBR advertising an external network. Within the same area where the ASBR resides, this is simply the least-cost path from the computing router to the ASBR that can be comfort-ably computed using type 1 and 2 LSAs. This topological information is not present in other areas, however, so without additional help, routers in other areas would not be able to compute their metric to reach the ASBR. Fortunately, what routers in other areas really need to know is only what ABR can be used to reach the ASBR, and what is the path cost between them. Therefore, when an ABR then floods the type 5 LSA into another area, the ABR creates a type 4 LSA, containing the ASBR’s RID and the ABR’s metric to reach the ASBR that created the type 5 LSA. Routers in other areas use the type 4 LSA to know what ASBRs in other areas exist, what ABRs can be used to reach them, and what +is the distance of each ABR to a particular ASBR. For a router in a different area than an ASBR’s, the total cost of reaching the ASBR through an ABR is then the sum of the cost between the router and an ABR in the router’s area, plus the cost indicated in the type 4 LSA advertised by the ABR toward a particular ASBR. Whenever a cost of reaching an ASBR is therefore required, if the ASBR is in the same area as the computing router, it is computed using the type 1 and 2 LSAs in that area. If the ASBR is in a different area, the cost of reaching it is computed using the type 1 and 2 LSAs in the computing router’s area toward an ABR, plus the cost from the ABR’s type 4 LSA toward the ASBR. Rules concerning the evaluation of E1 and E2 routes explained earlier therefore hold for routers in all areas. + +Note that a type 4 LSA concerning a particular ASBR is not required in the area where the ASBR resides. It is therefore never flooded into it. Only other areas require the type 4 LSA to be able to compute their metrics toward ASBRs and external networks behind them. + +Figure 9-8 outlines the mechanics of how the LSAs are propagated, and how the metrics are calculated. + +E1 routes by definition include the cost as assigned when the ASBR injected the route into OSPF, plus any cost inside the OSPF domain. To calculate the cost for the E1 route, a router inside a different area than the ASBR must use two steps to calculate the internal cost to ASBR, and a third step to add the external cost. For example, when R3, internal to area 3, calculates the cost to reach 192.168.1.0/24 (an E1 route), R3 adds the following: + +■ R3’s calculated area 3 cost to reach ABR R1 (RID 1.1.1.1). + +■ R1’s cost to reach the ASBR that advertised the route (S1, RID 7.7.7.7). R1 announces this cost in the LSA type 4 that describes R1’s cost to reach ASBR 7.7.7.7. + +■ The external metric for the route, as listed in the type 5 LSA created by the ASBR. +494 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key +Topic Internal +Router + +R3 + +Area 3 + +ABR RID 1.1.1.1 + +R1 + + + + +ASBR Area 0 RID 7.7.7.7 + + + + +Externals: 192.168.1.0/24 (E1) 192.168.2.0/24 (E2) + + + +3 • Cost to E2 Route: Metric in +LSAType 5 2 • Create/Flood Type 4: +• Cost to E1 Route: Add: List R1’s Metric to Reach My Cost to ABR R1, Plus the ASBR +the LSA Type 4’s Cost, Plus • Flood Type 5’s, Metric the LSA Type 5’s Cost Unchanged + +S1 1 +• Create/Flood Type 5’s, Metric 20 + + + +Note: Arrows Show Propagation of LSAs. + +Figure 9-8 LSA Types 4 and 5 Propagation and the Effect on Type 1 External Routes + +Example 9-6 shows the components of the metrics and LSAs for two external routes: 192.168.1.0/24 E1 with metric 20, and 192.168.2.0/24 E2, also with metric 20. + +Example 9-6 Calculating the Metric for External Types 1 and 2 + +! R3 has learned the two type 5 LSAs. + +R3# show ip ospf database | begin Type-5 +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +192.168.1.0 +192.168.2.0 + +7.7.7.7 +7.7.7.7 + +1916 0x8000002B 0x0080EF 0 +1916 0x80000028 0x00FEF2 0 + + +! Next, the detail for E2 192.168.2.0 is listed, with "metric type" referring +! to the external route type E2. (192.168.1.0, not shown, is type 1.) + +R3# show ip ospf database external 192.168.2.0 +OSPF Router with ID (3.3.3.3) (Process ID 1) +Type-5 AS External Link States + +Routing Bit Set on this LSA +LS age: 1969 +Options: (No TOS-capability, DC) +LS Type: AS External Link +Link State ID: 192.168.2.0 (External Network Number) +Advertising Router: 7.7.7.7 +LS Seq Number: 80000028 +Checksum: 0xFEF2 +Length: 36 +Chapter 9: OSPF 495 + +Network Mask: /24 +Metric Type: 2 (Larger than any link state path) +TOS: 0 +Metric: 20 +Forward Address: 0.0.0.0 +External Route Tag: 0 + +! Next, R1's advertised cost of 1 between itself and the ASBR is listed. Note +! that S1's RID (7.7.7.7) is listed, with the ABR that forwarded the LSA into +! area 3, R1 (RID 1.1.1.1) also listed. + +R3# show ip ospf database asbr-summary +OSPF Router with ID (3.3.3.3) (Process ID 1) +Summary ASB Link States (Area 3) + + +Routing Bit Set on this LSA +LS age: 923 +Options: (No TOS-capability, DC, Upward) +LS Type: Summary Links(AS Boundary Router) +Link State ID: 7.7.7.7 (AS Boundary Router address) +Advertising Router: 1.1.1.1 +LS Seq Number: 8000000A +Checksum: 0x12FF +Length: 28 +Network Mask: /0 +TOS: 0 Metric: 1 + +! Below, R3's calculated cost to R1 (64) and then to S1 (7.7.7.7) are listed. Note +! that the total of 65 is the cost 64 to reach the ABR, plus the cost 1 for the +! ABR to reach the ASBR. + +R3# show ip ospf border-routers +OSPF Process 1 internal Routing Table +Codes: i – Intra-area route, I – Inter-area route + +i 1.1.1.1 [64] via 10.3.13.1, Serial0/0.1, ABR, Area 3, SPF 30 +I 7.7.7.7 [65] via 10.3.13.1, Serial0/0.1, ASBR, Area 3, SPF 30 + +! Below, each route is noted as E1 or E2, with the E1 route's metric including +! the external cost (20), plus cost to reach the ASBR (65). + +R3# show ip route | include 192.168 +O E1 192.168.1.0/24 [110/85] via 10.3.13.1, 00:50:34, Serial0/0.1 +O E2 192.168.2.0/24 [110/20] via 10.3.13.1, 00:50:34, Serial0/0.1 +496 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +OSPF Design in Light of LSA Types + +OSPF’s main design trade-offs consist of choosing links for particular areas, with the goal of speeding convergence, reducing memory and computing resources, and keeping rout-ing tables small through route summarization. For example, by using a larger number of areas, and the implied conversion of dense types 1 and 2 LSAs into sparser type 3 LSAs, the OSPF LSDBs can be made smaller. Also, link flaps in one area require SPF calculations only in that area, thanks to the partial calculation feature. Additionally, ABRs and ASBRs can be configured to summarize routes, reducing the number of Type 3 and Type 5 LSAs introduced into other areas as well. (Route summarization is covered in Chapter 11.) + +The OSPF design goals to reduce convergence time, reduce overhead processing, and improve network stability can be reached using the core OSPF protocols and features covered so far. Another key OSPF design tool, stubby areas, will be covered next. + + +Note Before we move on, a comment is in order about the relative use of the word sum-mary in OSPF. The typical uses within OSPF include the following: +■ Type 3 and 4 LSAs are called summary LSAs in the OSPF RFCs. + +■ The term LSA summary refers to the LSA headers that identify LSAs and are sent inside DD packets. + +The term summary can also be used to refer to summary routes created with the area range and summary-address commands. + + + +Stubby Areas + +The areas described so far allow OSPF to limit the complexity of the information stored in the LSDB, simplify and thus accelerate its processing, and optionally perform summa-rization. The visibility of networks (intra-area, inter-area, external) was not affected. Such areas that do not perform any automatic filtering on the type of accepted information are called regular areas. All areas described so far were regular areas. + +OSPF can further reduce overhead by treating each area with one of several variations of rules, based on a concept called a stubby area. Stubby areas take advantage of the fact that, depending on the actual network topology, not all areas need to have knowledge about individual external networks. In particular, if a nonbackbone area does not contain any ASBRs and does not inject any external routes into the OSPF domain, any informa-tion about external networks (if present) must have come in through ABRs from other areas. + +Knowing the particular external networks one by one, then, is useful only to a limited degree: + +■ Because to reach the external networks, a packet must still be routed through an ABR toward the area where the ASBR is located. +Chapter 9: OSPF 497 + +■ Because there is no ASBR in the current area, there can never be a possibility of the local ASBR providing a better path to any external network. + +This is what forms the concept of a stubby area—an area that does not contain an ASBR and thus does not mediate an external connectivity to the entire OSPF domain. Such +an area does not really benefit from knowing about individual external networks. The advantage of knowing the external networks one by one in an area without its own ASBR would be visible if there were multiple ABRs in the current area and multiple ASBRs in other areas. In this case, the knowledge of individual external networks would allow for choosing the least total cost path to each of the networks individually. In most other cases, however, the connectivity to external networks can be equivalently provided to a stubby area by replacing the list of external networks with a simple default route injected by the area’s ABRs. + +Therefore, if an area is configured as a stubby area, ABRs will stop advertising type 4 and 5 LSAs into this area. In addition, every internal router in a stubby area will ignore any received type 5 LSAs, and will not originate any such LSAs itself. As a result, no external networks or ASBRs will be known by any internal router in a stubby area. In addition, ABRs in a stubby area will automatically inject a default route into the area as a type 3 LSA. The connectivity to external networks reachable through other areas will be main-tained thanks to the default routes through ABRs. As a result, internal routers will still +be able to reach the external networks but their LSDBs will be sparser. The visibility of intra-area and inter-area networks in a stubby area is not affected in any way. + +RFC 2328 is vague on the point of whether type 4 LSAs are also ignored upon arrival, but common sense dictates that type 4 LSAs are usable only in conjunction with type 5 LSAs, and because stubby areas explicitly prohibit the use of type 5 LSAs, the type 4 LSAs are useless in such areas and should be treated in the same way as type 5 LSAs. + +To sum up, a stubby area is an area that does not contain an ASBR and is not intended to. Such an area can benefit from filtering out type 4 and 5 LSAs, replacing the list of all external networks with a default route. A stubby area can contain one or more ABRs. For example, the only way out of area 3 in Figure 9-5 is through the only ABR, R1. So, R1 could advertise a default route into area 3 instead of advertising any external type 5 LSAs. + +Also in Figure 9-5, area 5 has two ABRs. If area 5 were a stubby area, both ABRs would inject default routes into the area. This configuration would work, but it might result in suboptimal routing. This is not really a limitation of OSPF. Replacing a set of routes with a default route is a form of route summarization, and route summarization always goes hand in hand with a certain loss of granularity in the available choices. + +OSPF defines several different types of stubby areas. By definition, all stubby areas stop type 4 (ASBR summary) and type 5 (external) LSAs from being injected into them by the ABRs. However, depending on the variation, a stubby area might also prevent type 3 LSAs from being injected, causing the area to stop seeing individual inter-area routes as well. The other variation includes whether a router inside the stubby area can redistribute routes into OSPF, thereby injecting an external route. Table 9-5 lists the variations on stubby areas, and their names. +498 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Note in Table 9-5 that all four stub area types stop type 4 and 5 LSAs from entering the area. When the name includes “totally,” type 3 LSAs are also not passed into the area by ABRs except a type 3 LSA carrying the default route, significantly reducing the size of the LSDB. If the name includes “NSSA,” it means that external routes can be redistrib-uted into OSPF by routers inside the stubby area; note that the LSAs for these external routes would be type 7 because type 5 LSAs are still prohibited in such areas. + + +Table 9-5 OSPF Stubby Area Types +Key +Topic Area Type Stops Injection of Type 4/5 LSAs? + + + +Stops Injection of Type 3 LSAs? + + + +Allows Creation of Type 7 LSAs Inside the Area? + +Stubby Yes No No + +Totally stubby (TS) Yes Yes No + +Not-so-stubby area Yes No Yes (NSSA) +Totally NSSA Yes Yes Yes (NSSA-TS) + + +To configure stubby areas, all routers attached to the area must be configured with the exact same command for each stubby area type, as listed in Table 9-6. However, in areas that are totally stubby, non-ABRs should omit the no-summary keyword because the additional type 3 LSA filtering is performed only on ABRs. + +Table 9-6 Stub Area Configuration Options Key +Topic Stub Type Router OSPF Subcommand + + +NSSA + +Totally NSSA + +Stubby + +Totally stubby + + +area area-id nssa + +area area-id nssa no-summary + +area area-id stub + +area area-id stub no-summary + + + +NSSAs require a few comments. The motivation for NSSAs comes from the fact that while an area might not require knowing the full list of external networks reachable through other areas, it is nevertheless often necessary to inject a couple of external net-works into the OSPF domain in such areas. If such an area was configured as a stubby area, external networks known in other areas would indeed not be advertised into it. However, because any external network is strictly prohibited in a stubby area, it would not be possible to configure route redistribution to inject the external routes. The NSSA type lifts the second limitation. An NSSA is still a stubby area in the sense that external routes from other areas are not advertised to it. However, an NSSA can hold an ASBR and perform external route injection. This external information is carried in type 7 LSAs +Chapter 9: OSPF 499 + +to distinguish it from normal external routes in type 5 LSAs, which are still prohibited even in NSSAs. In addition, the ABR with the highest RID will perform a translation from type 7 LSA to type 5 LSA and thereby inject the external route to other areas. An NSSA is therefore a sensible compromise: It is allowed to inject external routing information and “upload” it to backbone and other regular areas, and yet it still does not “download” external routing information from the backbone or other areas, keeping its LSBD rela-tively small. The NSSA is also the only nonregular type of area into which a default route is not advertised automatically. To advertise a default route into an NSSA, ABRs must be configured with the area area-id nssa default-information-originate command. All other nonregular area types will inject a default route automatically, including totally NSSA (NSSA-TS). + +Example 9-7, based on Figure 9-5, shows the results of the following configuration: + +■ Area 3 is configured as a totally NSSA. + +■ R3 will inject an external route to 192.168.21.0/24 as a type 7 LSA. + +■ Area 4 is configured as a totally stubby area. + +■ Area 5 is configured as simply stubby. + +Example 9-7 Stub Area Example + +! R3, in a totally NSSA area, knows intra-area routes (denoted with an "IA" +! near the front of the output line from show ip route), but the only +! inter-area route is the default route created and sent by R1, the ABR. + +R3# show ip route ospf +10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +O 10.3.2.0/23 [110/11] via 10.3.1.33, 00:00:00, Ethernet0/0 +O*IA 0.0.0.0/0 [110/65] via 10.3.13.1, 00:00:00, Serial0/0.1 + +! Still on R3, the LSA type 3 summary, created by ABR R1, is shown first. +! Next, the External NSSA LSA type 7 LSA created by R3 is listed. + +R3# show ip ospf database | begin Summary +Summary Net Link States (Area 3) + +Link ID ADV Router Age Seq# Checksum +0.0.0.0 1.1.1.1 704 0x80000004 0x00151A + +Type-7 AS External Link States (Area 3) + +Link ID ADV Router Age Seq# Checksum Tag +192.168.21.0 3.3.3.3 17 0x80000003 0x00C12B 0 +500 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! R1, because it is attached to area 3, also has the R3-generated NSSA external +! LSA. Note the advertising router is R3, and it is an E2 external route. + +R1# show ip ospf database nssa-external +OSPF Router with ID (1.1.1.1) (Process ID 1) +Type-7 AS External Link States (Area 3) + +Routing Bit Set on this LSA +LS age: 188 +Options: (No TOS-capability, Type 7/5 translation, DC) +LS Type: AS External Link +Link State ID: 192.168.21.0 (External Network Number) +Advertising Router: 3.3.3.3 +LS Seq Number: 80000003 +Checksum: 0xC12B +Length: 36 +Network Mask: /24 +Metric Type: 2 (Larger than any link state path) +TOS: 0 +Metric: 20 +Forward Address: 10.3.13.3 +External Route Tag: 0 + +! Below, the same command on R2, not in area 3, shows no type 7 LSAs. ABRs +! convert type 7 LSAs to type 5 LSAs before forwarding them into another area. + +R2# show ip ospf database nssa-external + +OSPF Router with ID (2.2.2.2) (Process ID 2) + +! Next, R2 does have a type 5 LSA for the subnet; R1 converts the type 7 to a type +! 5 before flooding it into other areas. + +R2# show ip ospf database | begin Type-5 +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +192.168.1.0 +192.168.2.0 +192.168.21.0 + +7.7.7.7 +7.7.7.7 +1.1.1.1 + +521 0x80000050 0x003615 0 +521 0x8000004D 0x00B418 0 +1778 0x80000019 0x006682 0 + + +! Below, R4 is in a totally stubby area, with only one inter-area route. + +R4# show ip route ospf +O*IA 0.0.0.0/0 [110/1563] via 10.4.14.1, 00:11:59, Serial0/0.1 +Chapter 9: OSPF 501 + +! R5, in a stubby area, has several inter-area routes, but none of the +! external routes (e.g. 192.168.1.0). R5's default points to R2. + +R5# show ip route ospf +10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks +O IA 10.3.13.0/24 [110/115] via 10.5.25.2, 13:45:49, Serial0.2 +O IA 10.3.0.0/23 [110/125] via 10.5.25.2, 13:37:55, Serial0.2 +O IA 10.1.1.0/24 [110/51] via 10.5.25.2, 13:45:49, Serial0.2 +O IA 10.4.0.0/16 [110/1613] via 10.5.25.2, 13:45:49, Serial0.2 +O*IA 0.0.0.0/0 [110/51] via 10.5.25.2, 13:45:49, Serial0.2 + +! Below, R5's costs on its interfaces are shown. Note that +! the default route's metric (51) comes from the 50 below, plus an advertised +! cost of 1 in the summary (type 3) for default 0.0.0.0/0 generated by R2. R5 +! simply chose to use the default route with the lower metric. + +R5# sh ip ospf int brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Se0.1 1 5 +Se0.2 1 5 +Et0 1 5 + +10.5.15.5/24 +10.5.25.5/24 +10.5.1.5/24 + +64 P2P 1/1 +50 P2P 1/1 +10 DR 0/0 + + +! Next, R2 changes the cost of its advertised summary from 1 to 15. + +R2# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)# router ospf 2 +R2(config-router)# area 5 default-cost 15 + +! Below, R5's metrics to both R1's and R2's default routes tie, +! so both are now in the routing table. + +R5# show ip route ospf +! Lines omitted for brevity +O*IA 0.0.0.0/0 [110/65] via 10.5.25.2, 00:00:44, Serial0.2 +[110/65] via 10.5.15.1, 00:00:44, Serial0.1 + +The legend in the top of the output of a show ip route command lists several identifiers that pertain to OSPF. For example, the acronym “IA” refers to inter-area OSPF routes, E1 refers to external type 1 routes, and E2 refers to external type 2 routes. If using NSSAs, N1 refers to NSSA-external type 1 routes in NSSAs, and N2 refers to NSSA-external type 2. The differences are equivalent to differences between E1 and E2 routes. +502 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +OSPF Path Choices That Do Not Use Cost + +Under most circumstances, when an OSPF router runs the SPF algorithm and finds more than one possible route to reach a particular subnet, the router chooses the route with the least cost. However, OSPF does consider a few conditions other than cost when mak-ing this best-path decision. This short section explains the remaining factors that impact which route, or path, is considered best by the SPF algorithm. + +Choosing the Best Type of Path + +As mentioned earlier, some routes are considered to be intra-area routes, some are inter-area routes, and two are types of external routes (E1/N1 and E2/N2). It is possible for a router to find multiple routes to reach a given subnet where the type of route (intra-area, inter-area, E1/N1, or E2/N2) is different. In these cases, RFC 2328 specifies that the router should ignore the costs and instead chooses the best route based on the following order of preference: + +1. +Key +Topic 2. + +3. + +4. + + +Intra-area routes + +Inter-area routes + +E1/N1 routes (the E1 and N1 routes are considered equivalent) + +E2/N2 routes (the E2 and N2 routes are considered equivalent) + + +For example, if a router using OSPF finds one intra-area route for subnet 1 and one inter-area route to reach that same subnet, the router ignores the costs and simply chooses +the intra-area route. Similarly, if a router finds one inter-area route, one E1/N1 route, and one E2/N2 route to reach the same subnet, that router chooses the inter-area route, again regardless of the cost for each route. + +Best-Path Side Effects of ABR Loop Prevention + +The other item that affects OSPF best-path selection relates to some OSPF loop-avoidance features. Inside an area, OSPF uses Link State logic, but between areas, OSPF acts as a Distance Vector (DV) protocol. For example, the advertisement of a type 3 LSA from one area to another hides the topology in the original area from the second area, just listing a destination subnet, metric (cost), and the ABR through which the subnet can be reached—all DV concepts. + +OSPF does not use all the traditional DV loop-avoidance features, but it does use some of the same underlying concepts, including Split Horizon. In OSPF’s case, it applies Split Horizon for several types of LSAs so that information from an LSA is not advertised into one nonbackbone area and then advertised back into the backbone area. Figure 9-9 shows an example in which ABR1 and ABR2 both advertise type 3 LSAs into area 1, but then they both choose to not originate a type 3 LSA containing the same network back into area 0. This corresponds to one of the rules about type 3 LSA origination described ear-lier: From a nonbackbone area, only internal routes can be advertised into the backbone. +Chapter 9: OSPF 503 + + +Subnet 1 Area 2 Cost 1 + +ABR3 + +Area 0 Cost 1 Cost 100 + + +Type 3 LSAs +ABR1 ABR2 Cost 1 + + +Area 1 Cost 1 Cost 1 + + +R1 R2 + + +Figure 9-9 Split Horizon per Area with OSPF + +The figure shows the propagation of some of the LSAs for subnet 1. ABR3 generates a type 3 LSA for subnet 1 and floods that LSA within area 0. ABR1 computes its routing table in area 0 and floods its own type 3 LSA for subnet 1 into area 1. However, when ABR2 gets this LSA from ABR1, ABR2 does not use it in its SPF computation because the only type 3 LSAs used in SPF by ABRs are those received over the backbone. In addi-tion, no inter-area routes from nonbackbone areas can be advertised to backbone. These two rules prevent ABR2 from processing this LSA and advertising the contained network back into the backbone area. (To reduce clutter, the figure does not include arrowed lines for the opposite direction, in which ABR2 floods a type 3 LSA into area 1, and then ABR1 chooses not to flood a corresponding type 3 LSA back into area 0.) + +Let’s restate once again the rules regarding originating and processing type 3 LSAs on ABRs. First, when an ABR originates type 3 LSAs on behalf of known routes, it translates only intra-area routes from a nonbackbone area into type 3 LSAs and floods them into the backbone, and it translates both intra-area and inter-area routes from the backbone area into type 3 LSAs and floods them into nonbackbone areas. Second, when an ABR runs the SPF algorithm, it ignores all type 3 LSAs received over nonbackbone areas. + +The first rule essentially makes sure that the only valid way of one area learning about routes in another area is through the backbone, and that the backbone is never fed a route that must have already traversed the backbone. An internal route begins its life as an intra-area route in some area. If that area is a nonbackbone area, an ABR will create a type 3 LSA on behalf of this network and flood it into the backbone. Other ABRs in the backbone will use these type 3 LSAs along with others to compute their routing tables, and they will create their own type 3 LSAs for both intra-area (internal to backbone) and +inter-area (behind backbone) routes and flood them into their own attached nonbackbone areas. +504 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The second rule makes sure that an ABR does not traverse a nonbackbone area to reach a network that is located in the backbone or in some other nonbackbone area. In other words, an ABR never uses a nonbackbone area to reach an inter-area network. Especially when a nonbackbone area has multiple ABRs and their mutual distance in the nonback-bone area is smaller than their distance in the backbone, one ABR could choose an inter-area path over the nonbackbone area rather than through the backbone. The second rule prevents this. However, the consequences of this rule can be rather surprising. + +For example, without this second rule, in the internetwork of Figure 9-10, router ABR2 would calculate a cost 3 path to subnet 1: from ABR2 to ABR1 inside area 1 and then from ABR1 to ABR3 in area 0. ABR2 would also calculate a cost 101 path to subnet 1, going from ABR2 through area 0 to ABR3. Clearly, the first of these two paths, with cost 3, is the least-cost path. However, ABRs use this additional loop-prevention rule, mean-ing that ABR2 ignores the type 3 LSA advertised by ABR1 for subnet 1. This behavior prevents ABR2 from choosing the path through ABR1, so in actual practice, ABR2 would find only one possible path to subnet 1: the path directly from ABR2 to ABR3. + +Subnet 1 Area 2 +Cost 1 + + + +Cost 3 path +Area 0 + +ABR3 +Cost 101 path +Cost 1 Cost 100 + + + + +ABR1 Cost 1 ABR2 + + + +Area 1 Cost 1 Cost 1 + + +R1 R2 + + +Figure 9-10 Effect of ABR2 Ignoring Path to Subnet 1 Through Area 1 + +It is important to notice that the link between ABR1 and ABR2 is squarely inside non-backbone area 1. If this link were in area 0, ABR2 would pick the best route to reach ABR3 as being ABR2 – ABR1 – ABR3, choosing the lower-cost route. + +This loop-prevention rule has some even more interesting side effects for internal routers. Again in Figure 9-10, consider the routes calculated by internal Router R2 to reach subnet 1. R2 learns a type 3 LSA for subnet 1 from ABR1, with the cost listed as 2. To calculate the total cost for using ABR1 to reach subnet 1, R2 adds its cost to reach ABR1 (cost 2), totaling cost 4. Likewise, R2 learns a type 3 LSA for subnet 1 from ABR2, with cost 101. +Chapter 9: OSPF 505 + +R2 calculates its cost to reach ABR2 (cost 1) and adds that to 101 to arrive at cost 102 for this alternative route. As a result, R2 picks the route through ABR1 as the best route. + +However, the story gets even more interesting with the topology shown in Figure 9-10. R2’s next-hop router for the R2 – ABR2 – ABR1 – ABR3 path is ABR2. So, R2 forwards packets destined to subnet 1 to ABR2 next. However, as noted just a few paragraphs ago, ABR2’s route to reach subnet 1 points directly to ABR3. As a result, packets sent by R2, destined to subnet 1, actually take the path from R2 – ABR2 – ABR3. As you can see, these decisions can result in arguably suboptimal routes, and even asymmetric routes, as would be the case in this particular example. + +OSPF Configuration + +This section covers the core OSPF configuration commands, along with the OSPF con-figuration topics not already covered previously in the chapter. (If you happened to skip the earlier parts of this chapter, planning to review OSPF configuration, make sure to go back and look at the earlier examples in the chapter. These examples cover OSPF stubby area configuration, OSPF network types, plus OSPF neighbor and priority commands.) + +Example 9-8 shows configuration for the routers in Figure 9-5, with the following design goals in mind: + + +■ Key +Topic +■ + + +■ + +■ + +■ + +Proving that OSPF process IDs do not have to match on separate routers, though best practice recommends using the same process IDs across the network + +Using the network command to match interfaces, thereby triggering neighbor dis-covery inside network 10.0.0.0 + +Configuring S1’s RID as 7.7.7.7 + +Setting priorities on the backbone LAN to favor S1 and S2 to become the DR/BDR + +Configuring a minimal dead interval of 1 second, with hello multiplier of 4, yielding +a 250-ms hello interval on the backbone LAN + + +Example 9-8 OSPF Configuration Basics and OSPF Costs + +! R1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! R1 has been configured for a (minimal) 1-second dead interval, and 1/4-second +! (250 ms) hello interval based on 4 Hellos per 1-second dead interval. + +interface FastEthernet0/0 +ip address 10.1.1.1 255.255.255.0 +ip ospf dead-interval minimal hello-multiplier 4 + +! R1 uses the same stub area configuration as in Example 9-7, with network +! commands matching based on the first two octets. Note that the network commands +! place each interface into the correct area. + +router ospf 1 +506 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +area 3 nssa no-summary +area 4 stub no-summary +area 5 stub +network 10.1.0.0 0.0.255.255 area 0 +network 10.3.0.0 0.0.255.255 area 3 +network 10.4.0.0 0.0.255.255 area 4 +network 10.5.0.0 0.0.255.255 area 5 + +! R2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! The R2 configuration also uses the Fast Hello feature, otherwise it +! would not match hello and dead intervals with R1. Also, OSPF on R2 is activated +! directly on interfaces using ip ospf process-id area area-id command that +! replaces +! the use of network commands. It is assumed that all interfaces are configured +! using this command so the router ospf section contains no network commands + +interface FastEthernet0/0 +ip address 10.1.1.2 255.255.255.0 +ip ospf dead-interval minimal hello-multiplier 4 +ip ospf 2 area 0 + +! Below, R2 uses a different PID than R1, but the PID is only used locally. +! R1 and R2 will become neighbors. Also, all routers in a stubby area must be +! configured to be that type of stubby area; R2 does that for area 5 below. + +router ospf 2 +area 5 stub + +! R3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! Note that R3's area 3 nssa no-summary command matches R1's area command. +! However, R3 should omit the no-summary keyword, because R3 is not an ABR. + +router ospf 1 +area 3 nssa no-summary +network 10.0.0.0 0.255.255.255 area 3 + +! R4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +router ospf 1 +area 4 stub no-summary +network 10.0.0.0 0.255.255.255 area 4 + +! S1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! S1 matches hello and dead intervals on the LAN. Also, it sets its OSPF +! priority to 255, the maximum value, hoping to become the DR. +Chapter 9: OSPF 507 + +interface Vlan1 +ip address 10.1.1.3 255.255.255.0 +ip ospf dead-interval minimal hello-multiplier 4 +ip ospf priority 255 + +! Below, S1 sets its RID manually, removing any reliance on an interface address. + +router ospf 1 +router-id 7.7.7.7 +network 10.1.0.0 0.0.255.255 area 0 + +! S2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! Below, S2 also matches timers, and sets its priority to 1 less than S1, hoping +! to be the BDR. + +interface Vlan1 +ip address 10.1.1.4 255.255.255.0 +ip ospf dead-interval minimal hello-multiplier 4 +ip ospf priority 254 +! +router ospf 1 +network 10.0.0.0 0.255.255.255 area 0 + +Note that R3 and R4 do not need the no-summary option on the area command; this parameter is only needed at the ABR, in this case R1. The parameters are shown here to stress the variations of stubby areas. + +OSPF Costs and Clearing the OSPF Process + +Example 9-9 highlights a few details about clearing (restarting) the OSPF process, and looks at changes to OSPF costs. This example shows the following sequence: +1. R3’s OSPF process is cleared, causing all neighbors to fail and restart. + +2. R3’s log-adjacency-changes detail configuration command (under router ospf) causes more detailed neighbor state change messages to appear. + +3. R5 has tuned its cost settings with the ip ospf cost 50 interface subcommand under S0.2 to prefer R2 over R1 for reaching the core. + +4. R2 is configured to use a new reference bandwidth, changing its cost calculation per interface. +508 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 9-9 Changing RIDs, Clearing OSPF, and Modifying Cost Settings + +R3# clear ip ospf process +Reset ALL OSPF processes? [no]: y + +! Above, all OSPF processes are cleared on R3. R3 has the log-adjacency-changes +! detail command configured, so that a message is generated at each state +! change, as shown below for neighbor R33 (RID 192.168.1.1). (Messages for +! other routers are omitted.) + +00:02:46: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Ethernet0/0 from FULL to +DOWN, Neighbor Down: Interface down or detached +00:02:53: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Ethernet0/0 from DOWN to +INIT, Received Hello +00:02:53: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Ethernet0/0 from INIT to +2WAY, 2-Way Received +00:02:53: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Ethernet0/0 from 2WAY to +EXSTART, AdjOK? +00:02:53: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Ethernet0/0 from EXSTART +to EXCHANGE, Negotiation Done +00:02:53: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Ethernet0/0 from EXCHANGE +to LOADING, Exchange Done +00:02:53: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Ethernet0/0 from LOADING to +FULL, Loading Done + +! Next R5 has costs of 50 and 64, respectively, on interfaces s0.2 and s0.1. + +R5# show ip ospf int brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Se0.2 1 5 +Se0.1 1 5 +Et0 1 5 + +10.5.25.5/24 +10.5.15.5/24 +10.5.1.5/24 + +50 P2P 1/1 +64 P2P 1/1 +10 DR 0/0 + + +! Below, S0.1's cost was based on bandwidth of 1544 Kbps, using the formula +! 100,000 Kbps / bandwidth with bandwidth in Kbps. + +R5# sh int s 0.1 +Serial0.1 is up, line protocol is up +Hardware is HD64570 +Internet address is 10.5.15.5/24 +MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +Encapsulation FRAME-RELAY +Last clearing of "show interface" counters never + +! Next, R2's interface costs are shown, including the minimum cost 1 on Fa0/0. +Chapter 9: OSPF 509 + +R2# sho ip ospf int brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Fa0/0 2 0 +Se0/0.5 2 5 + +10.1.1.2/24 +10.5.25.2/24 + +1 BDR 3/3 +64 P2P 1/1 + + +! Below, R2 changes its reference bandwidth from the default of 100 Mbps to +! 10,000 Mbps. That in turn changes R2's calculated cost values to be 100 times +! larger than before. Note that IOS allows this setting to differ on the routers, +! but recommends against it. + +R2# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R2(config)# router ospf 2 +R2(config-router)# auto-cost reference-bandwidth 10000 +% OSPF: Reference bandwidth is changed. +Please ensure reference bandwidth is consistent across all routers. +R2# show ip ospf int brief +Interface PID Area IP Address/Mask Cost State Nbrs F/C + +Fa0/0 2 0 +Se0/0.5 2 5 + +10.1.1.2/24 +10.5.25.2/24 + +100 BDR 3/3 +6476 P2P 1/1 + + +While Examples 9-8 and 9-9 show some details, the following list summarizes how IOS chooses OSPF interface costs: +1. Set the cost per neighbor using the neighbor neighbor cost value command. (This is valid only on OSPF point-to-multipoint nonbroadcast network types.) + +2. Set the cost per interface using the ip ospf cost value interface subcommand. + +3. Allow the cost to default based on interface bandwidth and the OSPF Reference Bandwidth (Ref-BW) (default 105 Kbps). The formula is Ref-BW / bandwidth (Kbps). + +4. Default based on bandwidth, but change Ref-BW using the auto-cost reference-bandwidth value command within the OSPF process. + +The only slightly tricky part of the cost calculation math is to keep the units straight, because the IOS interface bandwidth is kept in Kbps and the auto-cost reference-bandwidth command’s units are Mbps. For example, on R5 in Example 9-9, the cost is calculated as 100 Mbps divided by 1544 Kbps, where 1544 Kbps is equal to 1.544 Mbps. The result is rounded down to the nearest integer, 64 in this case. On R2’s Fa0/0 interface, the bandwidth is 100,000 Kbps, or 100 Mbps, making the calculation yield a cost of 1. After changing the reference bandwidth to 10,000, which means 10,000 Mbps, R2’s calcu-lated costs were 100 times larger. +510 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Note When choosing the best routes to reach a subnet, OSPF also considers whether a route is an intra-area route, inter-area route, E1/N1 route, or E2/N2 route. OSPF prefers intra-area over all the rest, then inter-area, then E1/N1, and finally E2/N2 routes. Under normal circumstances, routes to a single subnet should all be the same type; however, it is possible to have multiple route paths to reach a single subnet in the OSPF SPF tree, but with some of these routes being a different type. Example 11-7 in Chapter 11 demon-strates this. + + + +Alternatives to the OSPF network Command + + + + + + + + + + + + + + +Key Topic + +As of Cisco IOS Software Release 12.3(11)T, OSPF configuration can completely omit the network command, instead relying on the ip ospf process-id area area-id interface sub-command. This new command enables OSPF on the interface and selects the area. + +The network and ip ospf area commands have some minor differences when second-ary IP addresses are used. With the network command, OSPF advertises stub networks for any secondary IP subnets that are matched by the command. (“Secondary subnet” +is jargon that refers to the subnet in which a secondary IP address resides.) The ip ospf area interface subcommand causes any and all secondary subnets on the interface to be advertised as stub networks—unless the optional secondaries none parameter is included at the end of the command. + +Regardless of the network or ip ospf area command, OSPF will always establish adjacen-cies over an interface only using the primary IP address. OSPF will never use secondary +addresses to establish an adjacency. + + + +OSPF Filtering + +Intra-routing protocol filtering presents some special challenges with link-state routing protocols like OSPF. Link-state protocols do not advertise routes—they advertise topol-ogy information. Also, SPF loop prevention relies on each router in the same area hav-ing an identical copy of the LSDB for that area. As mentioned in the section about LSA types, only the router that has originated an LSA is ever allowed to modify its contents. +Filtering or changing LSA contents in transit could conceivably make the LSDBs differ on different routers, causing routing irregularities. + +IOS supports three variations of what could loosely be categorized as OSPF route filter-ing. These three major types of OSPF filtering are as follows: + +■ Filtering routes, not LSAs: Using the distribute-list in command, a router can fil-ter the routes that its SPF process is attempting to add to its routing table, without affecting the LSDB. + +■ ABR type 3 LSA filtering: A process of preventing an ABR from creating particular type 3 summary LSAs. +Chapter 9: OSPF 511 + +■ Using the area range no-advertise option: Another process to prevent an ABR from creating specific type 3 summary LSAs. + +Each of these three topics is discussed in sequence in the next few sections. + + +Filtering Routes Using the distribute-list Command + +For RIP and EIGRP, the distribute-list command can be used to filter incoming and out-going routing updates. The process is straightforward, with the distribute-list command referring to ACLs or prefix lists. With OSPF, the distribute-list in command filters what ends up in the IP routing table, and only on the router on which the distribute-list in command is configured. + + +Note The redistribute command, when used for route distribution between OSPF and other routing protocols, does control what enters and leaves the LSDB. Chapter 11 covers more on route redistribution. + + +The following rules govern the use of distribute lists for OSPF: + +■ The distribute list in the inbound direction applies to results of SPF—the routes to be installed into the router’s routing table. + +■ The distribute list in the outbound direction applies only to redistributed routes and only on an ASBR; it selects which redistributed routes shall be advertised. + +■ The inbound logic does not filter inbound LSAs; it instead filters the routes that SPF chooses to add to that one router’s routing table. + +■ If the distribute list includes the incoming interface parameter, the incoming interface is checked as if it were the outgoing interface of the route. + +That last bullet could use a little clarification. For example, if R2 learns routes through RIP or EIGRP updates that enter R2’s s0/0 interface, those routes typically use R2’s s0/0 interface as the outgoing interface of the routes. The OSPF LSAs might have been flood-ed into a router on several interfaces, so an OSPF router checks the outgoing interface of the route as if it had learned about the routes through updates coming in that interface. + +Example 9-10 shows an example of two distribute lists on R5 from Figure 9-5. The exam-ple shows two options to achieve the same goal. In this case, R5 will filter the route to 10.4.8.0/24 through R5’s S0.2 subinterface (to R2). Later, it uses a route-map command to achieve the same result. +512 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 9-10 Filtering Routes with OSPF distribute-list Commands on R5 + +! R5 has a route to 10.4.8.0/24 through R2 (10.5.25.2, s0.2) + +R5# sh ip route ospf | incl 10.4.8.0 +O IA 10.4.8.0/24 [110/1623] via 10.5.25.2, 00:00:28, Serial0.2 + +! Next, the distribute-list command refers to a prefix list that denies 10.4.8.0/24 + +ip prefix-list prefix-10-4-8-0 seq 5 deny 10.4.8.0/24 +ip prefix-list prefix-10-4-8-0 seq 10 permit 0.0.0.0/0 le 32 +! +router ospf 1 +distribute-list prefix prefix-10-4-8-0 in Serial0.2 + +! Below, note that R5's route through R2 is gone, but the LSDB is unchanged! + +R5# sh ip route ospf | incl 10.4.8.0 + +! Not shown: the earlier distribute-list command is removed. +! Below, note that the distribute-list command with the route-map option does not +! have an option to refer to an interface, so the route-map itself has been +! configured to refer to the advertising router's RID (2.2.2.2). + +router ospf 1 +distribute-list route-map lose-10-4-8-0 in + +! Next, ACL 48 matches the 10.4.8.0/24 prefix, with ACL 51 matching R2's RID. + +access-list 48 permit 10.4.8.0 +access-list 51 permit 2.2.2.2 + +! Below, the route map matches the prefix (based on ACL 48) and the advertising +! RID (ACL 51, matching R2's 2.2.2.2 RID). Clause 20 permits all other prefixes. + +route-map lose-10-4-8-0 deny 10 +match ip address 48 +match ip route-source 51 +route-map lose-10-4-8-0 permit 20 + +! Above, note the same results as the previous distribute list. +R5# sh ip route ospf | incl 10.4.8.0 + +Example 9-10 shows only two ways to filter the routes. The distribute-list route-map option allows a much greater variety of matching parameters, and much more detailed logic with route maps. For example, this example showed matching a prefix as well as the +Chapter 9: OSPF 513 + +RID that advertised the LSA to R5, namely 2.2.2.2 (R2). Refer to Chapter 11 for a more complete review of route maps and the match command. + + +Note Some earlier IOS releases allowed the router to not only filter the route as shown in Example 9-10 but also to replace the route with the next best route. Testing at Release 12.4 and beyond shows the behavior as shown in the example, with IOS simply not adding the route to the IP routing table. + + + +OSPF ABR LSA Type 3 Filtering + +ABRs do not forward type 1 and 2 LSAs from one area into another, but instead create type 3 LSAs for each subnet defined in the type 1 and 2 LSAs. Type 3 LSAs do not con-tain detailed information about the topology of the originating area; instead, each type 3 LSA represents a subnet, and a cost from the ABR to that subnet. The earlier section “LSA Type 3 and Inter-Area Costs” covers the details and provides an example. + +The OSPF ABR type 3 LSA filtering feature allows an ABR to filter type 3 LSAs at the point where the LSAs would normally be created. By filtering at the ABR, before the type 3 LSA is injected into another area, the requirement for identical LSDBs inside the area can be met, while still filtering LSAs. + +To configure type 3 LSA filtering, you use the area number filter-list prefix name in | out command under router ospf. The referenced prefix-list is used to match the subnets and masks to be filtered. The area number and the in | out option of the area filter-list command work together, as follows: + +■ When in is configured, IOS filters prefixes going into the configured area. + +■ When out is configured, IOS filters prefixes coming out of the configured area. + +Example 9-11 should clarify the basic operation. ABR R1 will use two alternative area filter-list commands, both to filter subnet 10.3.2.0/23, a subnet connected to R33 in Figure 9-5. Remember that R1 is connected to areas 0, 3, 4, and 5. The first area filter-list command shows filtering the LSA as it goes out of area 3; as a result, R1 will not inject the LSA into any of the other areas. The second case shows the same subnet being fil-tered going into area 0, meaning that the type 3 LSA for that subnet still gets into the area 4 and 5 LSDBs. + +Example 9-11 Type 3 LSA Filtering on R1 with the area filter-list Command + +! The command lists three lines of extracted output. One line is for the +! type 3 LSA in area 0, one is for area 4, and one is for area 5. + +R1# show ip ospf data summary | include 10.3.2.0 +Link State ID: 10.3.2.0 (summary Network Number) +Link State ID: 10.3.2.0 (summary Network Number) +Link State ID: 10.3.2.0 (summary Network Number) +514 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! Below, the two-line prefix list denies subnet 10.3.2.0/23, and then permits +! all others. + +ip prefix-list filter-type3-10-3-2-0 seq 5 deny 10.3.2.0/23 +ip prefix-list filter-type3-10-3-2-0 seq 10 permit 0.0.0.0/0 le 32 + +! Next, the area filter-list command filters type 3 LSAs going out of area 3. + +R1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# router ospf 1 +R1(config-router)# area 3 filter-list prefix filter-type3-10-3-2-0 out +R1(config-router)# ^Z + +! Below, R1 no longer has any type 3 LSAs, in areas 0, 4, and 5. For +! comparison, this command was issued a few commands ago, listing 1 line +! of output for each of the other 3 areas besides area 3. + +R1# show ip ospf data | include 10.3.2.0 + +! Below, the previous area filter-list command is replaced by the next command +! below, which filters type 3 LSAs going into area 0, with the same prefix list. + +area 0 filter-list prefix filter-type3-10-3-2-0 in + +! Next, only 2 type 3 LSAs for 10.3.2.0 are shown – the ones in areas 4 and 5. + +R1# show ip ospf data | include 10.3.2.0 +Link State ID: 10.3.2.0 (summary Network Number) +Link State ID: 10.3.2.0 (summary Network Number) + +! Below, the configuration for filtering type 3 LSAs with the area range command, +! which is explained following this example. The existing area filter-list +! commands from earlier in this chapter have been removed at this point. + +R1(config-router)# area 3 range 10.3.2.0 255.255.254.0 not-advertise +R1# show ip ospf data summary | include 10.3.2.0 +R1# + + +Filtering Type 3 LSAs with the area range Command + +The third method to filter OSPF routes is to filter type 3 LSAs at an ABR using the area range command. The area range command performs route summarization at ABRs, tell-ing a router to cease advertising smaller subnets in a particular address range, instead cre-ating a single type 3 LSA whose address and prefix encompass the smaller subnets. +Chapter 9: OSPF 515 + +When the area range command includes the not-advertise keyword, not only are the smaller component subnets not advertised as type 3 LSAs, but the summary route is also not advertised as a type 3 LSA either. As a result, this command has the same effect as the area filter-list command with the out keyword, filtering the LSA from going out to any other areas. An example area range command is shown at the end of Example 9-11. + +Virtual Link Configuration + +OSPF requires that each nonbackbone area be connected to the backbone area (area 0). OSPF also requires that the routers in each area have a contiguous intra-area path to the other routers in the same area, because without that path, LSA flooding inside the area would fail. However, in some designs, meeting these requirements might be a challenge. You can use OSPF virtual links to overcome these problems. + +For example, in the top part of Figure 9-11, area 33 connects only to area 3, and not to area 0. + +Virtual Link – Transit Area 3 + + + +R33 Area 33 R3 Area 3 R1 + + + + +Area 4’s Failed Links R5 +have a on them Area 0 + +R6 R4 S1 + +Area 4 Virtual Link + + + +R7 R8 + +Figure 9-11 Need for Virtual Links + + + +Key Topic + +One straightforward solution to area 33’s lack of connection to the backbone area would be to combine areas 3 and 33 into a single area, but OSPF virtual links could solve the problem as well. An OSPF virtual link allows a pair of possibly remote routers to create a targeted OSPF session across the IP network. A virtual link between R3 and R1 gives area 33 a connection to area 0. Also note that R3 becomes an ABR, with a full copy of area 0’s LSDB entries. A virtual link is not a tunnel for data packets; rather, it is a targeted session that allows two remote routers within a single area to become fully adjacent and synchro-nize their LSDBs. The virtual link is internally represented as an unnumbered point-to- +point link between the two endpoint routers and exists in the backbone area, regardless +516 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +of the area through which it is created. The area through which the virtual link is created is called a transit area and it must be a regular area: As no tunneling is involved, packets routed through this transit area are forwarded based on their true destination addresses, requiring the transit area to know all networks in the OSPF domain, intra-area, inter-area, and external. While the top part of Figure 9-11 simply shows a possibly poor OSPF area design, the lower part shows what could happen just because of a particular set of link failures. The figure shows several failed links that result in a partitioned area 4. As a result of the failures, R7 and R8 have no area 4 links connecting to the other three rout-ers in area 4. A virtual link can be used to connect R4 and R8—the requirement being that both R4 and R8 connect to a common and working area—recombining the partitions through the virtual link. (A better solution than the virtual link in this particular topology might be to trunk on R4 and R8, create a small subnet through the LAN switch, and put it in area 4.) + +Example 9-12 demonstrates a virtual link configuration between R33 and R1, as shown in Figure 9-11. Note that the virtual link cannot pass through a transit area that is a stubby area, so area 3 has been changed to no longer be a stubby area. + +Example 9-12 Virtual Link Between R3 and R1 + +! R1 has not learned subnet 10.3.2.0 yet, because area 33 has no link to area 0. + +R1# show ip route ospf | incl 10.3.2.0 +R1# +! The area virtual link commands point to the other router's RID, and the +! transit area over which the virtual link exists – area 3 in this case. Note that +! timers can be set on the area virtual-link command, as well as authentication. +! It is important when authenticating virtual links to remember that +! the virtual links themselves are in area 0. + +! R1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +router ospf 1 +area 3 virtual-link 3.3.3.3 + +! R3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +router ospf 1 +area 3 virtual-link 1.1.1.1 + +! Below, the status of the virtual link is listed. + +R1# show ip ospf virtual-links +Virtual Link OSPF_VL0 to router 3.3.3.3 is up +Run as demand circuit +DoNotAge LSA allowed. +Transit area 3, via interface Serial0/0.3, Cost of using 64 +Chapter 9: OSPF 517 + +Transmit Delay is 1 sec, State POINT_TO_POINT, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:02 +Adjacency State FULL (Hello suppressed) +Index 3/6, retransmission queue length 0, number of retransmission 1 +First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) +Last retransmission scan length is 1, maximum is 1 +Last retransmission scan time is 0 msec, maximum is 0 msec + +! Because R1 and R3 are also sharing the same link, there is a neighbor +! relationship in area 3 that has been seen in the other examples, listed off +! interface s0/0.3. The new virtual link neighbor relationship is shown as well, +! with interface VL0 listed. + +R1# show ip ospf nei +! Lines omitted for brevity + +Neighbor ID +3.3.3.3 +3.3.3.3 + +Pri State +0 FULL/ – +0 FULL/ – + +Dead Time +– +00:00:10 + +Address +10.3.13.3 +10.3.13.3 + +Interface +OSPF_VL0 +Serial0/0.3 + +! Below, subnet 10.3.2.0/23, now in area 33, is learned by R1 over the Vlink. +R1# show ip route ospf | incl 10.3.2.0 +O IA 10.3.2.0/23 [110/75] via 10.3.13.3, 00:00:10, Serial0/0.3 + + +Configuring Classic OSPF Authentication + +OSPF traditionally supported three authentication types: none, clear text, and MD5-based authentication. With the recent addition of SHA-1 to the list of supported hashes, the way to configure OSPF authentication differs based on what hashing function you intend to use. This section describes the classic way of configuring OSPF authentication that allows only the use of none, plain text, and MD5 authentication. The newer style of configuring OSPF authentication is described in the next section. + +One of the keys to keeping classic OSPF authentication configuration straight is to remember that it differs significantly with RIPv2 and EIGRP, although some of the con-cepts are very similar. The basic rules for configuring OSPF authentication are as follows: + +■ Three types are available: type 0 (none), type 1 (clear text), and type 2 (MD5). +Key +Topic ■ Authentication is enabled per interface using the ip ospf authentication interface +subcommand. + +■ The default authentication is type 0 (no authentication). + +■ The default can be redefined using the area authentication subcommand under router ospf. + +■ The keys are always configured as interface subcommands. +518 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ Multiple MD5 keys with different key IDs are allowed per interface. This allows for graceful key migration where a new key can be added without disrupting the adja-cencies. OSPF does it in a simple way: To sign sent packets, it always uses the key that was added as the last one to the interface (regardless of the key number). To authenticate the received packet, it uses the key ID that is indicated in the packet. If a neighbor is detected on an interface that uses a different key number than this +router, OSPF enters a key migration phase in which it sends all packets as many times as how many keys are configured on the interface, and each packet is signed with +a different key. The migration phase ends when all neighbors have migrated to the same key as the one used to sign sent packets by this router. This procedure is also called the OSPF key rollover procedure. Because plaintext passwords do not have key numbers, the key rollover is not available for plaintext authentication. + +Table 9-7 lists the three OSPF authentication types, along with the commands to enable each type and the commands to define the authentication keys. Note that the three authentication types can be seen in the messages generated by the debug ip ospf adj command. + + +Table 9-7 OSPF Authentication Types +Key +Topic Type Meaning Enabling Interface Subcommand + + + +Authentication Key Configuration Interface Subcommand + + + +0 None + +1 Clear text + +2 MD5 + + +ip ospf authentication null +ip ospf authentication + +ip ospf authentication message-digest + +— + +ip ospf authentication-key key-value + +ip ospf message-digest-key key-number md5 key-value + + + +Example 9-13 (again based on Figure 9-5) shows examples of type 1 and type 2 authen-tication configuration on Routers R1 and R2. (Note that S1 and S2 have been shut down for this example, but they would need the same configuration as shown on R1 and R2.) In this example, both R1 and R2 use their Fa0/0 interfaces, so their authentication configu-ration will be identical. As such, the example shows only the configuration on R1. + +Example 9-13 OSPF Authentication Using Only Interface Subcommands + +! The two ip ospf commands are the same on R1 and R2. The first enables +! type 1 authentication, and the other defines the simple text key. + +interface FastEthernet0/0 +ip ospf authentication +ip ospf authentication-key key-t1 + +! Below, the neighbor relationship formed, proving that authentication works. +Chapter 9: OSPF 519 + +R1# show ip ospf neighbor fa 0/0 + +Neighbor ID +2.2.2.2 + +Pri State +1 FULL/BDR + +Dead Time +00:00:37 + +Address +10.1.1.2 + +Interface +FastEthernet0/0 + + +! Next, each interface's OSPF authentication type can be seen in the last line +! or two in the output of the show ip ospf interface command. + +R1# show ip ospf int fa 0/0 +! Lines omitted for brevity +Simple password authentication enabled + +! Below, both R1 and R2 change to use type 2 authentication. Note that the key +! must be defined with the "ip ospf message-digest-key" interface subcommand. Key +! chains are not supported. + +interface FastEthernet0/0 +ip ospf authentication message-digest +ip ospf message-digest-key 1 md5 key-t2 + +! Below, the command confirms type 2 (MD5) authentication, key number 1. + +R1# show ip ospf int fa 0/0 | begin auth +! Lines omitted for brevity +Message digest authentication enabled +Youngest key id is 1 + +Example 9-13 shows two working examples of OSPF authentication, neither of which uses the area area-id authentication command under router ospf. Some texts imply that the area authentication command is required—in fact, it was required prior to Cisco IOS Software Release 12.0. In later IOS releases, the area authentication command simply tells the router to change that router’s default OSPF authentication type for all interfaces in that area. Table 9-8 summarizes the effects and syntax of the area authentication router subcommand. + +Table 9-8 Effect of the area authentication Command on OSPF Interface Authentication Topic Settings +Key + +area authentication Command + + +area area-id authentication + +area area-id authentication message-digest + +Interfaces in That Area Default to Use +Type 0 + +Type 1 + +Type 2 + + + +The keys themselves are kept in clear text in the configuration, unless you add the service password-encryption global command to the configuration. +520 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The last piece of authentication configuration relates to OSPF virtual links. Because virtual links have no underlying interface on which to configure authentication, authen-tication is configured on the area virtual-link command itself. Table 9-9 shows the varia-tions of the command options for configuring authentication on virtual links. Note that beyond the base area area-id virtual-link router-id command, the parameters use similar keywords as compared with the equivalent interface subcommands. + +Table 9-9 Configuring OSPF Authentication on Virtual Links +Key +Topic Type Command Syntax for Virtual Links + +0 area area-id virtual-link router-id authentication null + +1 area area-id virtual-link router-id authentication authentication-key key-value + +2 area area-id virtual-link router-id authentication message-digest message-digest-key key-num md5 key-value + + + +Configuring Extended Cryptographic OSPF Authentication + +Starting with IOS Release 15.4(1)T, OSPF also supports the extended Secure Hash Algorithm Hash Message Authentication Code (SHA-HMAC) authentication as described in RFC 5709. The introduction of this feature brings along a change in how OSPF authentication is configured. To utilize the SHA-HMAC authentication, OSPF uses key chains similarly to EIGRP or RIPv2. In addition, the key chain definition has been enhanced to select a particular cryptographic algorithm for a particular key. + +A number of facts to watch out for: + +■ Each key in the key chain must have a cryptographic algorithm configured using a per-key cryptographic-algorithm command. Failure to do so will result in OSPF not using that key. + +■ Each key in a key chain can be configured with the send-lifetime and accept-life-time keywords to limit its usability to a particular timeframe. If multiple keys in the key chain are eligible to sign egress packets, the key with the highest key ID will be used. Be aware that this behavior differs from RIPv2 and EIGRP that select the key with the lowest key ID. + +■ The key rollover procedure as used by classic OSPF is not used with key chains. To sign egress packets, OSPF will always use the valid key with the highest key ID in the key chain. To authenticate ingress packets, OSPF will try to use the key indi-cated in the received packet. There is no key migration phase of sending multiple OSPF packets signed with different valid keys. + +■ The extended cryptographic authentication is enabled per interface using the ip ospf authentication key-chain key-chain-name interface subcommand using its extended syntax, referring to a particular key chain. Configuring the extended cryptographic authentication using the area OSPF process level command is not supported. +Chapter 9: OSPF 521 + +■ Using the extended cryptographic authentication on virtual links is accomplished using the area area-id virtual-link router-id key-chain key-chain-name OSPF-level command. + +■ MD5 authentication is one of the supported cryptographic algorithms in key chains. An OSPF router configured for MD5 authentication using the classic commands +will be able to interoperate with a router configured using the new key chain style, provided the cryptographic algorithm for the keys in the key chain is MD5. When the new key chain style configuration is used, passwords configured with the ip ospf message-digest-key commands will be ignored. + +Example 9-14 shows the configuration of an OSPF router for extended cryptographic authentication. + +Example 9-14 Configuring Extended Cryptographic Authentication in OSPF + +! First the key chain OSPF is configured with a single key ID 1 and key-string +! set to CC1E. Note the added cryptographic-algorithm command and the set +! of available algorithms to choose from. + +R1(config)# key chain OSPF +R1(config-keychain)# key 1 +R1(config-keychain-key)# cryptographic-algorithm ? + +hmac-sha-1 +hmac-sha-256 +hmac-sha-384 +hmac-sha-512 +md5 + +HMAC-SHA-1 authentication algorithm +HMAC-SHA-256 authentication algorithm +HMAC-SHA-384 authentication algorithm +HMAC-SHA-512 authentication algorithm +MD5 authentication algorithm + + +R1(config-keychain-key)# cryptographic-algorithm hmac-sha-256 +R1(config-keychain-key)# key-string CC1E +R1(config-keychain-key)# exit +R1(config-keychain)# exit + +! On a particular interface, the ip ospf authentication command is enhanced +! with the key-chain keyword, allowing to reference a key chain. + +R1(config)# interface gi0/0 +R1(config-if)# ip ospf authentication ? + +key-chain +message-digest +null + + +Use a key-chain for cryptographic authentication keys +Use message-digest authentication +Use no authentication + +R1(config-if)# ip ospf authentication key-chain OSPF + +! The show ip ospf interface command shows the extended cryptographic +! authentication active on the interface at the end of the output. +522 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +R1(config-if)# do show ip ospf interface gi0/0 +GigabitEthernet0/0 is up, line protocol is up +! Lines omitted for brevity. +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 10.0.12.2 (Backup Designated Router) +Suppress hello for 0 neighbor(s) +Cryptographic authentication enabled +Sending SA: Key 1, Algorithm HMAC-SHA-256 - key chain OSPF + + +Note OSPF authentication is a good place for tricky CCIE lab questions—ones that can be solved in a few minutes if you know all the intricacies. + + + +Protecting OSPF Routers with TTL Security Check + +In addition to protecting OSPF communication with authentication, recent IOS imple-mentations also offer protection against remote attacks by sending unicast-addressed OSPF packets possibly across the network to a victim router. Such packets can easily be generated on a common PC with appropriate software and targeted toward any router +in the network. This type of attack can lead to, apart from other obvious results, greatly increased CPU load and subsequent denial of service if the attacker is sending an intense flow of OSPF packets with the goal of overloading the router’s control plane. The TTL Security Check feature provides protection against this type of attack. + +The idea behind the TTL Security Check is simple. If an IP packet is routed, its TTL head-er value is decremented. If all OSPF routers sent their packets with TTL set to 255, receiv-ing an OSPF packet with its TTL less than 255 would be a clear indication that the packet originated outside the network segment over which it was received. Because OSPF com-munication is, with the notable exception of virtual links and sham links, always based +on direct router-to-router communication, receiving an OSPF packet outside a virtual link or a sham link with its TTL less than 255 is a possible indication of a malicious activity. Such packets can be dropped. + +TTL Security Check can be activated either on a per-interface basis using the ip ospf ttl-security interface level command, or globally for all interfaces in a particular OSPF +process using the ttl-security all-interfaces command. If the TTL Security Check is acti-vated on a per-process basis, individual interfaces can be exempted from TTL Security Check using the ip ospf ttl-security disable interface level command. When the TTL Security Check is active on a particular interface, all OSPF packets sourced by that inter-face have their TTL set to 255, and only packets received with a TTL of 255 are accepted. + +Both these commands have an optional hops hop-count argument that allows relaxing the TTL Security Check. The hop-count is a value in the range of 1–254. Setting the +hop-count to a particular value makes the TTL Security Check accept OSPF packets with their TTL in the range from 255 down to 255 minus hop-count. For example, using the ttl-security all-interface hops 100 command enables OSPF to accept all packets with +Chapter 9: OSPF 523 + +their TTL in the range from 255 down to 155, inclusive. Setting the hop-count to 254 effectively disables the TTL Security check; this can be used when gradually migrating to TTL Security Check. If the hops keyword is not specified, the value of 1 is automatically assumed. Using the hops hop-count command influences what OSPF packets will be accepted; it has no impact on the TTL of OSPF packets originated by the router, which will remain at 255. + +The minimum hop-count value of 1 might be surprising, considering that OSPF packets sourced by directly connected neighbors will have their TTL set to 255, and there is no reason to allow OSPF packets with a TTL of 254. However, IOS-based Cisco routers exhibit a peculiar behavior in that they appear to decrement the TTL of received OSPF packets before handing them over to the OSPF process. For example, an OSPF packet received with a TTL of 255 will be processed by the OSPF process as having the TTL of 254. Similarly, an OSPF packet received with a TTL of 2 will be processed by the OSPF process having a TTL of 1. An exception applies to OSPF packets received with their TTL already set to 1—these are handed over to the OSPF process with their TTL unchanged. This behavior can be seen in the output of debug ip ospf adj when TTL Security Check drops a packet. The reason for this behavior was not known at the time of writing. A packet’s TTL should not be checked or decremented if the packet is not to be routed and forwarded to another host (RFC 1812 Section 4.2.2.9 and contained refer- +ences provide more information). In any case, this IOS behavior at least explains why the minimum allowed (and default) value of the hop-count argument is 1: The OSPF process will see the TTL to be 1 less than the original packet’s TTL, so to accept OSPF packets from directly connected neighbors, the TTL Security Check must be instructed to accept packets with their apparent TTL of 254. To sum things up, whenever an OSPF packet is received by a router, its TTL is first decremented by 1 (this decrement is skipped if the packet’s TTL is equal to 1), and the packet is then passed to OSPF and to TTL Security Check, which will act based on this decremented TTL value. + +Neither the ttl-security all-interface nor the ip ospf ttl-security command has any impact on configured virtual or sham links. If virtual or sham links are also to be pro-tected by TTL Security Check, the protection can be activated in the area virtual-link ttl-security hops or the area sham-link ttl-security hops command; in these commands, the hop-count argument is mandatory. Obviously, its value should be based on the lon-gest possible intra-area path (in terms of number of routers) between the link endpoints. + +When migrating to TTL Security Check, it is recommended to first activate it with an explicit hop-count of 254. This will make sure that the router’s OSPF packets are +already sent out with their TTL set to 255, without dropping neighbors’ packets if they are not sent with a TTL of 255 yet. Interfaces toward routers that do not support the TTL Security Check shall be configured with the ip ospf ttl-security disable command. Afterward, the hop-count shall be set to the default value of 1. + +Tuning OSPF Performance + +Apart from interface timers that define the Hello and Dead intervals, OSPF can be signifi-cantly tuned in several other aspects. This section covers selected features in OSPF that can be used to improve its performance. +524 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Tuning the SPF Scheduling with SPF Throttling + +After a router receives an updated LSA, it needs to schedule its SPF to process the update. Because a topology change very often affects multiple routers, it is quite pru-dent to wait some time for more updated LSAs to arrive, and run the SPF only after this waiting period is over. This allows the SPF to process multiple updates in a single run. However, if the topology change is caused by a repetitive fault, such as a flapping link because of faulty connectors, frequently running SPF would put an unnecessary burden on the router. Therefore, if a router continuously keeps receiving updated LSAs, the delay before the upcoming SPF run should progressively grow to dampen the negative impact of the flapping in network. By default, Cisco routers will schedule an SPF run 5 seconds after receiving an updated LSA, and if an updated LSA arrives after this SPF run, the sub-sequent delay will grow up to 10 seconds. + +The scheduling of SPF runs can be controlled by a feature called SPF Throttling. This feature defines a variable-length wait interval between two consecutive SPF runs. There are three parameters controlling this feature called spf-start , spf-hold, and spf-max-wait . The spf-start parameter defines the initial wait interval before an SPF computation, if the network has been stable for a prolonged period of time. The spf-hold parameter defines +a wait time between subsequent SPF runs, and its value doubles for each consecutive SPF run. The spf-max-wait parameter is the maximum time between two SPF runs (that is, doubling the spf-hold value is capped at spf-max-wait), and also defines a period during which the network must be stable for the wait interval to be set back to spf-start and the spf-hold to its preconfigured value. If the network has been stable for the last spf-hold period but not for the entire spf-max-wait since the last SPF run, the wait interval returns to the spf-start value but the subsequent wait will still be set to twice the previous spf-hold value. + +Instead of talking in general terms, let us demonstrate the behavior of SPF Throttling in a scenario. Assume that spf-start is set to 10 sec, spf-hold is 15 sec, and spf-max-wait is set to 100 sec. The network is assumed to have been stable for more than 100 seconds before the first update arrived. + +■ An updated LSA arrives at time T. The router schedules the nearest SPF run at T+10 and waits until this period expires. + +■ Another updated LSA arrives at time T+2. The router stores it in its LSDB and con-tinues waiting. + +■ At T+10, the router runs the SPF and sets the next wait interval to 15 secs, the initial spf-hold value, meaning that if another updated LSA arrives within 15 secs since this SPF run, the nearest SPF will be run at T+25. The network will be considered stable if no topology change is detected within 100 seconds since this SPF run, that is, until T+110. + +■ One or more updated LSAs indeed arrive between T+10 and T+25. The router stores them in its LSDB and continues waiting. + +■ At T+25, the router runs the SPF and sets the next wait interval to twice the previous spf-hold value, that is, 30 sec. If another updated LSA arrives within 30 secs since +Chapter 9: OSPF 525 + +this SPF run, the nearest SPF will be run at T+55. The network will be considered stable if no topology change is detected within 100 seconds since this SPF run, that is, until T+125. + +■ During the next 30 secs, no updated LSA arrives. The wait interval is reset back to spf-start, that is, 10 sec. The network is not considered stable, though, because 100 seconds since the last SPF have not elapsed yet; therefore, spf-hold remains at 30 secs. + +■ At T+80, an updated LSA arrives. The router schedules the nearest SPF run at T+90 and waits until this period expires. + +■ At T+90, the router runs the SPF and sets the next wait interval to twice the previous spf-hold value, that is, 60 sec. If another updated LSA arrives within 60 secs since this SPF run, the nearest SPF will be run at T+150. The network will be considered stable if no topology change is detected within 100 seconds since this SPF run, that is, until T+190. + +■ During the next 60 secs, no updated LSA arrives. The wait interval is reset back to spf-start, that is, 10 sec. The network is not considered stable, though, because 100 seconds since the last SPF have not elapsed yet; therefore, spf-hold remains at 60 secs. + +■ No updated LSA arrives till T+190. As a result, the network is considered stable and the spf-hold is set to its initial value of 15 secs. Any topology change detected after this moment will be handled equivalently to the beginning of this scenario. + +The SPF Throttling feature is configured by a single timers throttle spf spf-start spf-hold spf-max-wait command in the router ospf section. All arguments are indicated in milliseconds. Current values can be also verified in the show ip ospf output, as indicated in Example 9-15. Although not shown, the debug ip ospf spf statistic command can be used to verify the current and next wait intervals. + +Example 9-15 Configuring and Verifying SPF Throttling + +! First, the default values of SPF Throttling are displayed, then they are +! modified to match the description above, and their setting is verified again + +R2(config)# do show ip ospf | i SPF +Initial SPF schedule delay 5000 msecs +Minimum hold time between two consecutive SPFs 10000 msecs +Maximum wait time between two consecutive SPFs 10000 msecs +R2(config)# router ospf 2 +R2(config-router)# timers throttle spf 10000 15000 100000 +R2(config-router)# do show ip ospf | i SPF +Initial SPF schedule delay 10000 msecs +Minimum hold time between two consecutive SPFs 15000 msecs +Maximum wait time between two consecutive SPFs 100000 msecs +526 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Tuning the LSA Origination with LSA Throttling + +Another way to both speed OSPF convergence and prevent creating an excessive burden on the routers’ CPUs is to control the rate at which a particular LSA might be reorigi-nated by its originating router. For this purpose, we will use the term “same LSA” to denote an LSA instance that has the same link-state ID, type, and originating router, but possibly updated contents. In Cisco IOS, this feature is called LSA Throttling. + +The idea behind LSA Throttling is precisely the same as with SPF Throttling, together with the handling of the waiting interval. The mechanism is again driven by three values: start-interval, hold-interval, and max-interval. After a particular LSA has not been updated for more than max-interval and a need arises to create an updated version, it will be created and flooded after start-interval, and the next wait interval is set to the value of hold-interval. If the same LSA needs to be updated again within the wait inter-val since its last reorigination, its true origination and flooding will be postponed until the current wait interval expires, and after creating and flooding the updated LSA, the hold-interval is doubled and used as the next wait interval. This behavior will repeat itself during the next wait interval. The same LSA needs to be updated at least once, each time doubling the hold-interval and the resulting next wait interval in the process (the hold-interval is capped at max-interval if it grows over that value). If, during the next wait interval, the LSA does not need to be updated, the wait interval is set back to the start-interval; however, the hold-interval is still set to its potentially increased value. If the same LSA needs to be updated after the current wait interval has elapsed but before the max-interval elapses, its reorigination and flooding will be scheduled after start-interval but the next wait interval will be set to twice the previous hold-time value, effectively continuing with the exponentially growing hold times. The hold-time will be reset to its configured value only if the LSA was not required to be updated for the entire max-interval since its last update. Hence, the behavior of the wait interval is precisely the same as in the SPF Throttling and the scenario explained in the SPF Throttling would perfectly match the LSA Throttling behavior as well. + +By default, Cisco routers are configured to originate an updated LSA immediately and delay its subsequent origination by 5 seconds and not to progressively increase this inter-val. That is, start-interval is 0, and hold-interval and max-interval are set to 5000 mil-liseconds. + +The LSA Throttling feature is configured using a single timers throttle lsa all start-interval hold-interval max-interval command in OSPF configuration. The parameters are again expressed in milliseconds. Example 9-16 shows the use of this command along with the verification of its settings. Should a need arise to verify the LSA Throttling wait intervals, the debug ip ospf database-timer rate-limit command can be used. + +Example 9-16 Configuring and Verifying LSA Throttling + +! First, the default values of LSA origination are displayed, then the LSA +! Throttling is configured and the setting is verified again + +R1(config)# do show ip ospf | i LSA +Chapter 9: OSPF 527 + +! Output omitted +Minimum LSA interval 5 secs +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +! Output omitted +R1(config)# router ospf 1 +R1(config-router)# timers throttle lsa all 10000 15000 100000 +R1(config-router)# do show ip ospf | i LSA +! Output omitted +Initial LSA throttle delay 10000 msecs +Minimum hold time for LSA throttle 15000 msecs +Maximum wait time for LSA throttle 100000 msecs +Minimum LSA arrival 1000 msecs +LSA group pacing timer 240 secs +! Output omitted + +Apart from throttling the LSA origination, a router can also be configured to ignore the same LSA upon arrival if it appears to arrive too often. This throttling of arriving LSAs is configured using the timers lsa arrival milliseconds OSPF command. If two or more same LSAs arrive less than milliseconds apart, only the first one is accepted and the remaining LSAs are dropped. In effect, the same LSA is accepted only if it arrives more than milliseconds after the previous accepted one. The default setting is 1000 millisec-onds and can be seen in the show ip ospf output in Example 9-16. Obviously, the value of the minimum LSA arrival interval should be smaller than the neighbors’ initial hold interval in LSA Throttling. Otherwise, a neighbor would be allowed to send an updated LSA sooner than this router would be willing to accept it. + +Incremental SPF + +Running full SPF every time a topology change is encountered always produces correct results. However, depending on the location of the topology change, the SPF recomputes even those parts of the shortest-path tree that have not been affected by the change. This can unnecessarily increase the CPU load and prolong convergence time. At the expense of maintaining more information in the shortest-path tree about transit nodes’ parent and neighbor nodes (and slightly increased memory footprint as a consequence), the SPF cal-culation can be augmented so that after a topology change, only the affected part of the shortest-path tree is recalculated. This improvement to SPF is called incremental SPF and can be activated using the simple ispf command in the OSPF configuration, as shown in Example 9-17. There are no additional arguments or parameters to it, and the feature can be activated or deactivated on routers in the network individually. The benefit of incre-mental SPF computation varies. It is difficult to predict how significantly it speeds the SPF computation as that depends on the network topology and nature of the topology change. However, in general, the farther the topology change occurs from the computing router, the better the gain. +528 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 9-17 Configuring Incremental SPF + +! The state of Incremental SPF is displayed in the show ip ospf output + +R1(config)# do show ip ospf | i Incremental +Incremental-SPF disabled +R1(config)# router ospf 1 +R1(config-router)# ispf +R1(config-router)# do show ip ospf | i Incremental +Incremental-SPF enabled +R1(config-router)# + + +OSPFv2 Prefix Suppression + +In large and densely interconnected networks, a significant amount of space in LSDBs and resulting routing tables is occupied by transit link prefixes—that is, IP networks on inter-router links without end hosts. Most communication, however, occurs between end hosts located in nontransit networks. Also, for remote management purposes, network devices such as routers, switches, or access points are either assigned a loopback address that is subsequently advertised in OSPF, or they are located in a standalone manage-ment or other dedicated LAN/VLAN that can also be considered a nontransit network. Therefore, maintaining the transit link prefixes in LSDBs and routing tables is, at least from the connectivity standpoint, largely useless. Not advertising these prefixes can pos-sibly save a significant amount of memory and CPU cycles without impairing the net-work connectivity. + +RFC 6860 defines a method of hiding, or suppressing, the transit link prefixes in OSPF. Because OSPFv2 combines topology and addressing information in type 1 and 2 LSAs, meaning that some of the addressing information must be maintained in these LSAs (otherwise it would be impossible to construct them), the means of suppressing transit link prefixes are different for type 1 and for type 2 LSAs. Keep in mind that the goal of this mechanism is to suppress transit link prefixes, that is, the IP network addresses used on these links, not the transit links themselves. Transit links describe the connections between routers and must continue to be advertised; otherwise, SPF would be unable to construct the shortest-path tree. + +Recall that a type 1 LSA describes a router and its adjacencies (links) to its neighboring objects. There are four possible link types that can be described by a type 1 LSA: + +■ Point-to-point link to another router: This is a transit link pointing toward the other router’s RID. It contains no addressing information and will not be influenced by the prefix suppression mechanism. + +■ Link to a transit network: This is a transit link pointing toward the transit network’s DR IP address. While it refers to an IP address of the DR, it contains no further addressing information such as network mask, and will not be influenced by the pre-fix suppression mechanism. +Chapter 9: OSPF 529 + +■ Stub network: This entry describes the IP prefix used either in a true stub network or a prefix used on a point-to-point link to another router. A router can suppress all stub network entries in a type 1 LSA that correspond to IP prefixes used on point-to-point links. + +■ Virtual link: This is a virtual transit point-to-point link pointing toward a virtually adjacent router’s RID. It contains no addressing information and will not be influ-enced by the prefix suppression mechanism. + +Therefore, in type 1 LSAs, suppressing the transit link prefixes is accomplished by omitting stub network entries that contain prefixes on point-to-point interfaces to other routers. + +Type 2 LSAs are somewhat more cumbersome to tweak. These LSAs describe a transit multiaccess network and all connected routers, and they include information from which the IP prefix used in this network can be calculated. Specifically, the Link State ID of a type 2 LSA is set to the IP address of the DR in the network, and the LSA body contains, among others, the network subnet mask. The IP prefix of the network can be computed by bitwise ANDing the Link State ID of the LSA and the netmask carried in its payload. Neither of these two fields can be removed from the type 2 LSA without making its format incompatible. Therefore, RFC 6860 uses a different approach: It suggests setting the netmask field to the value of 255.255.255.255—clearly an invalid mask for a multi-access transit network. To routers that implement RFC 6860, a type 2 LSA advertising the netmask of 255.255.255.255 is a signal that the LSA contains no IP prefix information. Routers not implementing this RFC will install a host route toward that network’s DR. While the advantage of saving routing table space is lost on such routers, no interoper-ability issues will be introduced. The support for prefix suppression can therefore be introduced gradually. + +OSPFv3 has different LSA semantics; therefore, the prefix suppression in OSPFv3 works in a different manner, yet the results are identical. The differences will be explained later in the section “OSPFv3.” + +For OSPFv2, the prefix suppression can be activated for the entire router very easily by simply entering the prefix-suppression command in router ospf mode. This command will cause the router to suppress all prefixes on all its OSPF-enabled interfaces except loopbacks, secondary IP addresses, and prefixes on passive interfaces. Such prefixes are considered nontransit prefixes. The prefix suppression can also be configured on a per-interface basis using the ip ospf prefix-suppression interface command. Should a partic-ular interface prefix be advertised even if the prefix suppression is activated globally, the interface can be exempted by using the ip ospf prefix-suppression disable command. + +OSPF Stub Router Configuration + +First defined in RFC 3137 (now obsoleted by RFC 6987), and supported since Cisco IOS Software Release 12.2(4)T onward, the OSPF stub router feature (not to be confused with stubby areas) allows a router to either temporarily or permanently be prevented from becoming a transit router. In this context, a transit router is simply one to which packets +530 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +are forwarded, with the expectation that the transit router will forward the packet to yet another router. Conversely, nontransit routers only forward packets to and from locally attached subnets. + +Figure 9-12 shows one typical case in which a stub router might be useful. + +2 ASBR1 Come Up: +OSPF Convergence: 1 minute BGP Convergence: 5 minutes + + + + + +ABR1 + +Default Routes + +BGP +ASBR1 +Internet + + +BGP +ABR2 ASBR2 + + +1 OSPF and BGP Already Converged + +Figure 9-12 OSPF Stub Router + +Both ASBR1 and ASBR2 advertise defaults into the network, expecting to have the capa-bility to route to the Internet through BGP-learned routes. In this case, ASBR2 is already up and fully converged. However, if ASBR1 reloads, when it comes back up, OSPF is likely to converge faster than BGP. As a result, ASBR1 will advertise its default route, +and OSPF routers might send packets to ASBR1, but ASBR1 will end up discarding or misrouting the packets until BGP converges. + +Using the stub router feature on the ASBRs solves the problem by making them adver-tise their own type 1 LSAs with an infinite metric (cost 16,777,215) for all transit-type adjacencies (point-to-point links, transit network links, virtual links); stub network adjacencies will continue to be advertised with their real interface metrics. This infinite metric can be advertised either for a configured time period or until BGP convergence is complete. To do so, under router ospf, the ASBRs would use either the max-metric +router-lsa on-startup announce-time command or the max-metric router-lsa on-startup wait-for-bgp command. With the first version, the actual time period (in seconds) can be set. With the second, OSPF waits until BGP signals that convergence is complete or until 10 minutes pass, whichever comes first. + +OSPF Graceful Restart + +In steady-state operation, OSPF can react to changes in the routing domain and recon-verge quickly. This is one of OSPF’s strengths as an interior gateway protocol (IGP). However, what happens when something goes really wrong is just as important as how things work under relatively stable conditions. +Chapter 9: OSPF 531 + + + + + + + + + + + + + + + +Key Topic + +One of those “really wrong” things that sometimes happens is that a router requires a restart to its OSPF software process. Problems arising from this restart range from tempo-rary outages in network connectivity to temporary routing loops. Considering that cer-tain router platforms can continue to forward packets even while they restart, RFC 3623 describes a technique called Graceful OSPF Restart (GR) that allows a router to restart while its neighbors continue to forward packets to the restarting router as if it was up and running. This approach is sometimes called “routing through a failure,” as opposed to “routing around a failure,” which would be the usual OSPF’s response to a router going down. Cisco implemented its own version of graceful restart in Cisco IOS prior to RFC 3623 that is called Non Stop Forwarding (NSF); as a result, Cisco IOS supports both NSF and GR versions of this feature. Nonetheless, to keep the differences in the CLI minimal, both NSF and GR are configured using nsf commands. + +Two classes of devices are involved in GR/NSF. The router undergoing the graceful restart is said to be in the graceful restart mode (or simply in the restarting mode). Its directly connected neighbors are said to be in the helper mode during the graceful restart. Helper neighbors have important responsibilities during a router’s graceful restart: In the absence of other changes to the LSDB, they must ignore its lack of Hellos for an indicated grace period, continue to consider it fully adjacent and report it as fully adjacent in their type 1 and 2 LSAs, and continue to consider it a DR for the segment if it was elected as the DR before the graceful restart. In a way, helper neighbors assist in pretending that the router undergoing a graceful restart is up and running. Every router can act as a helper provided that the support is available in the IOS. However, only routers with specific hardware support can perform the graceful restart themselves because of the obvious need to have forwarding hardware autonomous and independent from the main CPU. Therefore, Cisco uses two specific terms when talking about GR/NSF support: NSF-aware devices, which can act only as helper devices, and NSF-capable devices, which can act both as helpers and can also perform a graceful restart themselves. The NSF awareness is generally avail-able across many IOS versions, even on low-end routers. NSF-capable devices are plat-forms such as Catalyst 6500 switches; router Series 7200, 7300, 7600, 10000, and 12000; ASR; and CRS. + +Graceful restart takes advantage of the fact that modern router architectures use separate control and forwarding planes. It is possible to continue forwarding without loops while +the routing process restarts, assuming that the following conditions are true: + + +■ The router’s hardware construction allows the control element, such as the CPU, the supervisor, or the route processor, to restart while the line cards continue to forward packets based on the last version of their forwarding database. + +■ The router whose OSPF process is restarting must notify its neighbors that the restart is going to take place by sending a “grace LSA,” which is a type 9 opaque LSA with link-local flooding scope, containing the estimated duration of restart (the grace period), the reason of the restart, and on multiaccess networks, the IP address of the restarting router. + +■ The LSA database remains stable during the restart. + +■ All the neighbors support, and are configured for, graceful restart helper mode. +532 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ The restart takes place within a specific grace period. + +■ During restart, the neighboring fully adjacent routers must operate in helper mode. + +In Cisco devices, Cisco Express Forwarding (CEF), especially its hardware embodiment in multilayer switches and high-end routers, handles forwarding during graceful restart while OSPF rebuilds the RIB tables, provided that the preceding conditions are met. Both Cisco and IETF NSF awareness are enabled by default in Cisco IOS. Disabling it requires a routing process command for each NSF version, nsf [cisco | ietf] helper disable. + +OSPF Graceful Shutdown + +In certain situations, it is necessary to take a router out of service while causing as little disruption as possible. This can be accomplished by a feature called Graceful Shutdown. The Graceful Shutdown feature allows an OSPF process to update the neighbors that the router is going down. Using a simple shutdown command in the router ospf mode, the router will immediately + +■ Drop all OSPF adjacencies + +■ Flush all LSAs it has originated (flood them with the age set to 3600 seconds) + +■ Send out Hello packets to its neighbors with the DR/BDR fields set to 0.0.0.0 and an empty neighbor list, prompting the neighbors’ adjacency states to fall back to the Init state + +■ Stop sending and receiving OSPF packets + +The Graceful Shutdown feature can also be configured on a per-interface basis using the ip ospf shutdown command. In that case, the procedure is slightly modified—the router will immediately + +■ Drop all OSPF adjacencies over that particular interface + +■ Flood updated LSAs that no longer include that particular interface and adjacencies through other interfaces, if any + +■ Send out Hellos over that particular interface to its neighbors with the DR/BDR fields set to 0.0.0.0 and an empty neighbor list, prompting the neighbors’ adjacency states to fall back to the Init state + +■ Stop sending and receiving OSPF packets over that particular interface + +Reverting to Graceful Shutdown can be accomplished by removing the shutdown or the ip ospf shutdown command from the configuration. + +At the time of this writing, selected IOS versions have the shutdown command avail-able in the router ospf configuration mode, but the command appears to be ineffective. When experimenting with this feature, make sure to use a recent IOS. +Chapter 9: OSPF 533 + +OSPFv3 + +The good news about OSPFv3 is that OSPFv2 was a mature routing protocol when devel-opment began on OSPFv3. The bad news about OSPFv3 is that it is more complex in some ways than OSPFv2. But mostly the two protocols are simply different because of the differences in the underlying Layer 3 protocol. Fortunately, RFC 5340, which defines OSPFv3, goes into quite a bit of detail in describing these differences. (And this RFC +is well worth a read to gain a better understanding of OSPFv3 than this chapter can provide.) + +Differences Between OSPFv2 and OSPFv3 + +OSPFv2 and OSPFv3 share many key concepts, including most of their basic operations and the concepts of neighbor relationships, areas, interface types, virtual links, metric cal-culations, and many others. However, you should understand the significant differences as well. + +Key differences between OSPFv2 and OSPFv3 include the following: + + +■ Key +Topic + + + +■ + + +■ + + + + + +■ + +Configured using interface commands: Cisco IOS enables OSPFv3 using interface subcommands, instead of using the OSPFv2 method (using the network command in router configuration mode). To enable OSPFv3 process ID (PID) 1 and area 2 on a given interface, the basic command is simply ipv6 ospf 1 area 2. Issuing this com-mand also creates the ipv6 router ospf 1 command in global configuration mode. + +Advertising multiple networks on an interface: If multiple IPv6 addresses are con-figured on an interface, OSPFv3 advertises all the corresponding networks. + +OSPFv3 RID must be set: OSPFv3 can automatically set its 32-bit RID based on the configured IPv4 addresses, using the same rules for OSPFv2. If no IPv4 addresses are configured, however, OSPFv3 cannot automatically choose its RID. You must manu-ally configure the RID before OSPFv3 will start. By comparison, an OSPFv2 RID is created automatically if any IP interfaces are configured on a router. + +Flooding scope: The scope for flooding LSAs is one of three specific types in +OSPFv3: + + + +■ +Key +Topic ■ + + +■ + +Link-local scope: Used by the new LSA type, Link LSA. +Area scope: For LSAs flooded throughout a single OSPFv3 area. Used by Router, Network, Inter-Area Prefix, Inter-Area Router, and Intra-Area Prefix LSA types. +AS scope: LSAs of this type are flooded throughout the routing domain; this is +used for AS External LSAs. + +■ Multiple instances per link: OSPFv3 supports multiple instances on a link. For example, suppose that you have four routers on an Ethernet segment: Routers A, +B, 1, and 2. You want Routers A and B to form adjacencies (become neighbors), and Routers 1 and 2 to become neighbors, but you do not want Routers A and B to form +534 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +neighborships with Routers 1 and 2. OSPFv3 supports this type of adjacency scop-ing. The range of instance numbers is 0–255, and the command format on the inter-face is, for example, ipv6 ospf 1 area 0 instance 33. The instance must match on all routers that are to become adjacent on a link. + +■ Terminology: OSPFv3 uses the term link for what OSPFv2 calls a network. + +■ Sources packets from link-local addresses: With the exception of virtual links, OSPFv3 uses link-local addresses for all communications between neighbors and sources packets from link-local addresses. On virtual links, OSPFv3 sources packets from a globally scoped IPv6 address. + +■ Authentication: OSPFv2 natively supports three authentication types: null, simple password, and MD5. OSPFv3, however, does not itself provide authentication, because IPv6 covers this requirement with its internal support for AH and ESP pro-tocols, as described in more detail later in this chapter. + +■ Networks in LSAs: Whereas OSPFv2 expresses networks in LSAs as [address, mask], OSPFv3 expresses networks in LSAs as [prefix, prefix length]. The default route is expressed with a prefix length of 0. + + +Virtual Links, Address Summarization, and Other OSPFv3 Features + +Many OSPFv3 features are conceptually identical to OSPFv2 and differ only slightly in their configuration. Some of these features include the following: + +■ Virtual links (which point to router IDs) + +■ Address summarization by area + +■ Address summarization in the routing process + +■ Stub area configuration + +■ NSSA configuration + +■ Advertising, or not advertising, a summary using the area range [advertise | not-advertise] command + +■ OSPF network types and interface configuration + +■ Router priority configuration for multiaccess networks, to influence DR and BDR elections + +■ Most OSPF show commands + + +OSPFv3 LSA Types + +Most LSA functionality in OSPFv3 is the same as that in OSPFv2, with a few changes in the LSA names. In addition, OSPFv3 has two additional LSA types. Table 9-10 briefly describes each of the LSA types in OSPFv3. Compare this table to Table 9-4 for a bet-ter perspective on how OSPFv2 and OSPFv3 LSA types are similar to and different from +Chapter 9: OSPF 535 + +each other. Note that OSPFv3 LSA types are basically the same as OSPFv2 LSAs, except for their slightly different names and the additions of type 8 and 9 LSAs to OSPFv3. + + +Table 9-10 OSPFv3 LSA Types +Key +Topic LSA Common Name Description Type + + + +Flooding Scope + + + +1 Router LSA + +2 Network LSA + + +3 Inter-Area Prefix LSA + +4 Inter-Area Router LSA +5 Autonomous System External LSA + +7 NSSA LSA + + +8 Link LSA + +Describes a router and its links to its neighboring objects within one area. +Generated by a DR to represent the multiaccess transit network and its connection to member routers. +Originated by ABRs to describe inter-area networks in other areas. +Originated by ABRs to advertise the existence of ASBRs in other areas. +Originated by an ASBR in a regular area to describe networks learned from other protocols (redistributed routes). +Originated by an ASBR in an NSSA to describe networks learned from other protocols (redistributed routes). +Advertises link-local address and prefix(es) of a router to all other routers on the link, as well as option information. Sent only if more than one router is present on a link. + +Area + +Area + + +Area + +Area + +Autonomous System + +Area + + +Link + +9 Intra-Area-Prefix LSA Performs one of two functions: Area +■ Associates a list of IPv6 prefixes with a transit network by pointing to a Network LSA. +■ Associates a list of IPv6 prefixes with a router by pointing to a Router LSA. + + +LSA types 8 and 9 require a closer discussion. In OSPFv2, type 1 and 2 LSAs combine together topology and address semantics—a single LSA both describes a part of the topology (what is connected to whom) and the addresses being used in that part of the topology. If an address changes on a router, new type 1 and possibly type 2 LSAs have to be flooded. To other routers, these updated LSAs are indistinguishable from a topology change in which the router with the previous addresses “went away” and a new router with the new addresses “came in.” As a result, all other routers will recompute the short-est-path tree, even though the network has stayed the same and the shortest-path tree has +536 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +not changed; just the addressing was modified. OSPFv2 does not provide for clear separa-tion of addressing and topology information, and as a result, the SPF is run more often than actually necessary. + +OSPFv3 creators took their lesson and as they designed the new protocol, they decided to take the addressing information out from type 1 and 2 LSAs and move it to new, sepa-rate LSA types. This is how type 8 and 9 LSAs came to be. In OSPFv3, the type 1 and +2 LSAs no longer carry any addressing information. They only carry a description of topology adjacencies—what other object is a router or a multiaccess network connected to, using router RIDs as an address-independent way of referring to a neighboring object. IPv6 prefixes on individual interfaces of a router are carried in a type 9 LSA (Intra-Area-Prefix LSA) with the area flooding scope. Moreover, as IPv6 unicast routing uses link-local addresses as next-hop addresses, each router advertises its link-local address in a type 8 LSA (Link LSA) sent out the particular interface. Type 8 LSAs have the link flood-ing scope and are never flooded beyond the receiving neighbor on the link. Carrying the interface link-local addresses in type 9 LSAs would expose them to all routers in an area; while not harmful, it would be a waste of resources. + +With this separation of topology and addressing information, OSPFv3 is significantly more efficient when it comes to scheduling an SPF run. If an interface address changes, only an updated Link LSA and Intra-Area-Prefix LSA will be originated and flooded. Because there is no change to the topology itself, type 1 and 2 LSAs will not change. Therefore, routers do not need to schedule a new SPF run but merely update the prefixes located in an already computed shortest-path tree. Only updated type 1 or 2 LSAs will trigger a new SPF. + +OSPFv3 in NBMA Networks + +OSPFv3 operates in NBMA networks almost exactly like OSPFv2. In particular, each interface has an OSPF network type, with that network type dictating whether OSPFv3 needs to use a DR/BDR and whether at least one router needs to have an OSPF neighbor command configured. For example, when configuring Frame Relay with the IPv6 address on a physical interface or multipoint subinterface, the OSPF network type defaults to “nonbroadcast,” which requires the use of a per-interface ipv6 ospf neighbor command: +R1(config-if)# ipv6 ospf neighbor fe80::1 + +Note that the address in the command must be a link-local address of the neighbor; other addresses will be rejected. + +OSPFv3 neighbor relationships over NBMA networks take a relatively long time to form (a minute or two), even on high-speed media, as they do in OSPFv2. This delay can lead to confusion and can cause you to spend time troubleshooting a nonproblem. + +Invariably, at some point in your studies (or lab exams), you will configure OSPFv2 or v3 over an NBMA network and forget to include a neighbor statement. As a result, neigh-bors will not form and you will have to troubleshoot the problem. A useful crutch you can use to help you remember that NBMA OSPF peers require neighbor statements is the saying, “nonbroadcast needs neighbors.” +Chapter 9: OSPF 537 + +For completeness, you should be aware that it is possible to get OSPF neighbors to form over an NBMA network without neighbor statements, if you change the interfaces’ net-work types from their defaults. This is done using the ipv6 ospf network interface com-mand, as it is in IPv4. The same rules apply for IPv6. + + +Configuring OSPFv3 over Frame Relay + + + +Key Topic + +In IPv4 Frame Relay networks, you are likely to be familiar with mapping IP addresses to data-link connection identifier (DLCI) numbers. The configuration of frame-relay map statements is much the same in IPv6, but there are a couple of twists: First, there is no InverseARP for IPv6. All IPv6/DLCI mappings therefore have to be configured manually. Second, the mappings must be created both for the link-local and the global addresses of the neighbor’s interface. Only the link-local mapping statement requires the broadcast keyword, though (and if a nonbroadcast or point-to-multipoint nonbroadcast network type is used, the broadcast keyword is not necessary). In Example 9-18, the far-end interface’s IPv6 unicast address is 2001::207:85FF:FE80:7208 and its link-local address is +FE80::207:85FF:FE80:7208. The DLCI number is 708. + + +Example 9-18 Frame Relay Mapping for IPv6 + +R1(config-if)# frame-relay map ipv6 FE80::207:85FF:FE80:7208 708 broadcast +R1(config-if)# frame-relay map ipv6 2001::207:85FF:FE80:7208 708 + +If you configure only the link-local mapping, OSPFv3 will be happy. The neighbors will come up, the routers will become fully adjacent, and their routing tables will fully popu-late, and even routing across the Frame Relay cloud will work, as the next hop is the +link-local address of the appropriate neighbor. However, if you tried to contact the global IPv6 address of a neighbor, it would fail because of Frame Relay encapsulation failures. + +As default link-local addresses derived by a modified EUI-64 procedure are strongly inconvenient to use, you might want to consider redefining the link-local addresses on the serial interfaces to some simple values, that is, FE80::1, FE80::2, and so on for individual routers using the ipv6 address link-local-address link-local interface command, and using them instead. During the Lab Exam, however, make sure that this modification is permitted. + +Enabling and Configuring OSPFv3 + +Enabling OSPFv3 on a Cisco router is straightforward if you have a good grasp of OSPFv2. After basic IPv6 addressing and reachability are configured and working, the OSPFv3 configuration process includes these steps: +Step 1. Identify the desired links connected to each OSPFv3 router. + +Step 2. Determine the OSPF area design and the area to which each router link (inter-face) should belong. + +Step 3. Identify any special OSPF routing requirements, such as stub areas, address summarization, LSA filtering, and virtual links. +538 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Step 4. Configure OSPF on the interfaces. + +Step 5. Configure routing process commands, including a router ID on IPv6-only routers. + +Step 6. Verify OSPF configuration, routing tables, and reachability. + +Figure 9-13 shows the network layout for this basic OSPFv3 routing example. Configuration details follow in Examples 9-19 and 9-20. + + + +Se0/0 Area 66 2001::/64 + + +Lo2 3001:0:3:2::/64 + + +Lo4 3001:0:3:4::/64 + + + + +Lo0 3001:0:4:0::/64 + +R4C + + + +Fa0/0 2001:0:4:0::/64 + +Area 77 + + + +DLCI 708 Lo2 3001:0:4:2::/64 + + +Frame DLCI 807 Relay + + + +Area 0 + + + +Se0/0 2001::/64 + + +R3 +Lo0 3001:0:3:0::/64 + +Fa0/0 + +Area 704 + + +Figure 9-13 Topology for Basic OSPFv3 Routing Configuration Examples 9-19 and 9-20 + +Example 9-19 Configuring OSPFv3 on Router R3 + +R3# show run +Building configuration... +! Lines omitted for brevity +! +! IPv6 unicast routing must be enabled to configure IPv6 features: + +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +no ip address + +! IPv6 addresses are assigned to each OSPFv3 interface: + +ipv6 address 3001:0:3::/64 eui-64 + +! Next OSPFv3 is enabled on the interface and the interface is assigned to an area: + +ipv6 ospf 1 area 704 + +! IPv6 OSPFv3 draws its router ID from the IPv4 loopback address on +! interface Loopback 1: + +interface Loopback1 +Chapter 9: OSPF 539 + +ip address 10.3.3.6 255.255.255.0 +! +interface Loopback2 +no ip address +ipv6 address 3001:0:3:2::/64 eui-64 + +! Like IPv4, setting the network type of a loopback address to point-to-point +! makes the route to this loopback appear in R4C's routing table as a /64 +! network rather than as a /128 network (a host route): + +ipv6 ospf network point-to-point +ipv6 ospf 1 area 0 + +! Note that interface Loopback 4 will be added later. Its use will be covered +! in another example later in this chapter. + +interface FastEthernet0/0 +no ip address +speed auto + +! Assign an IPv6 address and perform OSPFv3 configuration on the interface: + +ipv6 address 2001:0:3::/64 eui-64 +ipv6 ospf 1 area 704 +! +interface Serial0/0 +bandwidth 128 +no ip address +encapsulation frame-relay + +! On the serial interface, first configure the IPv6 address: +ipv6 address 2001::/64 eui-64 + +! Next must specify a neighbor, because the interface is +! NBMA (Frame Relay in this case). +! Like OSPFv2, OSPFv3 in Cisco IOS requires a neighbor statement at +! only one end of the link: + +ipv6 ospf neighbor FE80::207:85FF:FE80:71B8 +ipv6 ospf 1 area 0 +clock rate 128000 +no fair-queue +cdp enable +540 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! Because this is a frame-relay interface, map the link-local address of +! the next hop. This allows OSPFv3 neighbors to form: + +frame-relay map ipv6 FE80::207:85FF:FE80:71B8 807 broadcast + +! Next, add a frame-relay map statement to the unicast address of +! the next hop on the serial link so that unicast IPv6 packets will +! reach their destination: + +frame-relay map ipv6 2001::207:85FF:FE80:71B8 807 + +! The ipv6 router ospf 1 global commands are created when OSPFv3 is +! enabled on the first interface: + +ipv6 router ospf 1 +log-adjacency-changes +! Lines omitted for brevity +R3# + + +Example 9-20 Configuring OSPFv3 on Router R4C + +R4C# show run +Building configuration... +! Lines omitted for brevity +ipv6 unicast-routing +ipv6 cef +! +interface Loopback0 +no ip address +ipv6 address 3001:0:4::/64 eui-64 +ipv6 ospf 1 area 66 +! +interface Loopback2 +no ip address +ipv6 address 3001:0:4:2::/64 eui-64 + +! Like IPv4, setting the network type of a loopback address to point-to-point +! makes the route to this loopback appear in R3's routing table as a /64 +! network rather than as a /128 network (a host route): + +ipv6 ospf network point-to-point +ipv6 ospf 1 area 0 +! +interface FastEthernet0/0 +no ip address +speed 100 +Chapter 9: OSPF 541 + +full-duplex +ipv6 address 2001:0:4::/64 eui-64 +ipv6 ospf 1 area 77 +! +interface Serial0/0 +bandwidth 128 +no ip address +encapsulation frame-relay + +! Because the other neighbor has the neighbor statement, this side doesn't need +! one. + +ipv6 address 2001::/64 eui-64 +ipv6 ospf 1 area 0 +clock rate 128000 +no fair-queue +cdp enable + +! Here again, two frame-relay map statements are required: + +frame-relay map ipv6 FE80::207:85FF:FE80:7208 708 broadcast +frame-relay map ipv6 2001::207:85FF:FE80:7208 708 +! +ipv6 router ospf 1 +! Here, we must specify the OSPFv3 router ID, because this router +! has no IPv4 interfaces: + +router-id 99.99.99.99 +log-adjacency-changes +! Lines omitted for brevity +R4C# + +Note that this example configures several OSPF areas, so both intra-area and inter-area routes appear in the OSPFv3 routing tables. Routes with different network sizes and met-rics will also be present. Example 9-21 confirms the OSPFv3 routing configuration by using show commands and ping tests. + +Example 9-21 Verifying OSPFv3 Configuration and Reachability + +! The show ipv6 interface brief command displays both +! the unicast and link-local addresses, +! which is useful during ping and traceroute testing: + +R3# show ipv6 interface brief +FastEthernet0/0 [up/up] +FE80::207:85FF:FE80:7208 +2001:0:3:0:207:85FF:FE80:7208 +542 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Serial0/0 [up/up] +FE80::207:85FF:FE80:7208 +2001::207:85FF:FE80:7208 +Loopback0 [up/up] +FE80::207:85FF:FE80:7208 +3001:0:3:0:207:85FF:FE80:7208 + +Loopback1 +Loopback2 + +[up/up] +[up/up] + +FE80::207:85FF:FE80:7208 +3001:0:3:2:207:85FF:FE80:7208 +Loopback4 [up/up] +FE80::207:85FF:FE80:7208 +3001:0:3:4:207:85FF:FE80:7208 +R3# + +! The show ipv6 protocols command gives the best summary of +! OSPFv3 configuration by interface and OSPF area: + +R3# show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "static" +IPv6 Routing Protocol is "ospf 1" +Interfaces (Area 0): +Loopback2 +Serial0/0 +Interfaces (Area 704): +Loopback0 +FastEthernet0/0 +R3# + +! Next we'll look at the OSPFv3 interfaces in more +! detail to view the corresponding settings: + +R3# show ipv6 ospf interface +Loopback2 is up, line protocol is up +Link Local Address FE80::207:85FF:FE80:7208, Interface ID 10 +Area 0, Process ID 1, Instance ID 0, Router ID 10.3.3.6 +Network Type POINT_TO_POINT, Cost: 1 +Transmit Delay is 1 sec, State POINT_TO_POINT, +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Index 1/1/4, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 0, maximum is 0 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) +Chapter 9: OSPF 543 + +Serial0/0 is up, line protocol is up +Link Local Address FE80::207:85FF:FE80:7208, Interface ID 3 +Area 0, Process ID 1, Instance ID 0, Router ID 10.3.3.6 +Network Type NON_BROADCAST, Cost: 781 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 10.3.3.6, local address FE80::207:85FF:FE80:7208 +Backup Designated router (ID) 99.99.99.99, local address +FE80::207:85FF:FE80:71B8 +Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 +Hello due in 00:00:05 +Index 1/3/3, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 1, maximum is 6 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 1, Adjacent neighbor count is 1 +Adjacent with neighbor 99.99.99.99 (Backup Designated Router) +Suppress hello for 0 neighbor(s) +Loopback0 is up, line protocol is up +Link Local Address FE80::207:85FF:FE80:7208, Interface ID 8 +Area 704, Process ID 1, Instance ID 0, Router ID 10.3.3.6 +Network Type LOOPBACK, Cost: 1 +Loopback interface is treated as a stub Host +FastEthernet0/0 is up, line protocol is up +Link Local Address FE80::207:85FF:FE80:7208, Interface ID 2 +Area 704, Process ID 1, Instance ID 0, Router ID 10.3.3.6 +Network Type BROADCAST, Cost: 1 +Transmit Delay is 1 sec, State DR, Priority 1 +Designated Router (ID) 10.3.3.6, local address FE80::207:85FF:FE80:7208 +No backup designated router on this network +Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 +Hello due in 00:00:06 +Index 1/1/1, flood queue length 0 +Next 0x0(0)/0x0(0)/0x0(0) +Last flood scan length is 0, maximum is 0 +Last flood scan time is 0 msec, maximum is 0 msec +Neighbor Count is 0, Adjacent neighbor count is 0 +Suppress hello for 0 neighbor(s) +R3# + +! Now let's take a look at the IPv6 routing table's OSPF routes. +! Note the presence of two inter-area routes and one intra-area route. +! The intra-area route points to Loopback 0 on R4C, which is a /128 (host) +! route because Lo0 has the default network type for a loopback interface. +! The others are /64 routes because of their network types. + +R3# show ipv6 route ospf +544 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +IPv6 Routing Table - 15 entries +Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP +U - Per-user Static route +I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary +O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +D - EIGRP, EX - EIGRP external +OI 2001:0:4::/64 [110/782] +via FE80::207:85FF:FE80:71B8, Serial0/0 +OI 3001:0:4::/64 [110/782] +via FE80::207:85FF:FE80:71B8, Serial0/0 +O 3001:0:4:2:207:85FF:FE80:71B8/128 [110/781] +via FE80::207:85FF:FE80:71B8, Serial0/0 +R3# + +! A ping test proves reachability to an address on an inter-area route: + +R3# ping 3001:0:4:2:207:85FF:FE80:71B8 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 3001:0:4:2:207:85FF:FE80:71B8, +timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 28/29/32 ms +R3# + +Next, Example 9-22 shows redistributing a new loopback interface into OSPFv3 on R3, filtered through a route map, to see the effect on R4C’s routing table. Note the similarity in command syntax and output to OSPFv2. + +Example 9-22 Redistributing a Connected Interface into OSPFv3 + +! First create the Loopback 4 interface on R3: + +R3# conf t +R3(config)# interface Loopback4 +R3(config-if)# ipv6 address 3001:0:3:4::/64 eui-64 + +! Next, create a route map to select only this new +! loopback interface for redistribution: + +R3(config-if)# route-map Con2OSPFv3 +R3(config-route-map)# route-map Con2OSPFv3 permit 10 +R3(config-route-map)# match interface loopback 4 +R3(config-route-map)# exit +R3(config)# ipv6 router ospf 1 +R3(config-rtr)# redistribute connected route-map Con2OSPFv3 +R3(config-rtr)# end +Chapter 9: OSPF 545 + +R3# show ipv6 protocols +IPv6 Routing Protocol is "connected" +IPv6 Routing Protocol is "static" +IPv6 Routing Protocol is "ospf 1" +Interfaces (Area 0): +Loopback2 +Serial0/0 +Interfaces (Area 704): +Loopback0 +FastEthernet0/0 +Redistribution: +Redistributing protocol connected route-map Con2OSPFv3 +R3# + +! On R4 the new redistributed route on R3 appears as an OE2 route, because +! type E2 is the default for redistributed routes, and the default +! metric is 20, as in OSPFv2. + +R4C# show ipv6 route ospf +IPv6 Routing Table - 14 entries +Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP +U - Per-user Static route +I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary +O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +D - EIGRP, EX - EIGRP external +OI 2001:0:3::/64 [110/782] +via FE80::207:85FF:FE80:7208, Serial0/0 +OI 3001:0:3:0:207:85FF:FE80:7208/128 [110/781] +via FE80::207:85FF:FE80:7208, Serial0/0 +O 3001:0:3:2::/64 [110/782] +via FE80::207:85FF:FE80:7208, Serial0/0 +OE2 3001:0:3:4::/64 [110/20] +via FE80::207:85FF:FE80:7208, Serial0/0 +R4C# + +! Finally, verify reachability to the redistributed loopback interface: + +R4C# ping 3001:0:3:4:207:85FF:FE80:7208 +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 30001:0:3:4:207:85FF:FE80:7208, timeout is 2 +seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 28/29/33 ms +R4C# +546 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +OSPFv3 Authentication and Encryption + + + +Key Topic + + + + + + + + + + + + + +Key Topic + +One area in which OSPFv3 is arguably simpler than OSPFv2, at the protocol operation level, is that it uses IPv6’s native authentication support rather than implementing its own authentication mechanisms. OSPFv3 uses Authentication Header (AH), beginning with Cisco IOS Release 12.3(4)T, and Encapsulating Security Payload (ESP) protocols for +authentication, beginning with Cisco IOS Release 12.4(9)T. Both of these features require a Crypto feature set in the router. + +To enable IPv6 OSPF authentication using AH, issue the ipv6 ospf authentication com-mand. To enable encryption using ESP, issue the ipv6 ospf encryption command. These are interface configuration commands. While regular IPsec allows combining AH and ESP, the use of authentication and encryption is mutually exclusive with OSPFv3 on a single interface—if you configure ipv6 ospf authentication, you cannot add ipv6 ospf encryption and vice versa. Note that ESP provides both encryption and authentication, so use of ESP is generally preferred. + +Configuring OSPFv3 authentication or encryption requires selecting cryptographic algo-rithms for hashing or encryption, and supplying keys of appropriate length that are used during hashing (IPsec uses keyed hashing) and encryption. Together, the selected mode of operation plus the cryptographic algorithms and keys form a so-called security asso-ciation that defines how packets should be protected by IPsec. A security association is identified by a number called the Security Parameter Index (SPI). Each OSPFv3 packet protected by IPsec carries the SPI number of the security association used to protect it, and the receiving router uses the SPI to identify the security association to process the packet to decrypt and authenticate it. While in common IPsec deployments, security associations are negotiated by the ISAKMP/IKE protocol, with OSPFv3, all these param-eters must be specified manually and must match on all routers that mutually authen-ticate themselves or encrypt OSPFv3 packets sent to each other. In the Example 9-23, use of per-area and per-interface commands to configure encryption or authentication is +shown; the authentication or encryption configured on an interface overrides the per-area +configuration. + + +Example 9-23 Configuring IPsec Protection of OSPFv3 + +! It is assumed that IPv6 and OSPFv3 have already been correctly configured on this +! router, therefore only the IPsec-related configuration is shown in this example +! +! The FastEthernet0/0 interface is configured with AH-based authentication + +interface FastEthernet0/0 +ipv6 ospf auth ipsec spi 1000 sha1 8E63C2FF7E2997D7D26FD80E047C43A7FEEA9833 + +! The Serial1/0 interface is configured with ESP-based encryption and +! authentication. Because of the length of encryption and hashing keys, the command +! line is broken into two but in the configuration, it would be a single command +Chapter 9: OSPF 547 + +interface Serial1/0 +ipv6 ospf encryption ipsec spi 1001 esp aes-cbc 128 +DE7EC1FDF5BDC3367DB071BF090FFA2A sha1 6D8583145994287B6088A2D674E412A5F862DD5B + +! Per-area configurations in OSPFv3 process 1: area 1 uses authentication, +! area 2 uses encryption and authentication. Line for area 2 is again broken into +! two + +ipv6 router ospf 1 +area 1 authentication ipsec spi 1002 md5 7F0A8F0AE30CC9AB6F12E87C36D595C6 +area 2 encryption ipsec spi 1003 esp 3des +0BEA0DDE40603346B44184599202BE5CAEE674CF26EA22C3 md5 F93BBBB0A02512EA0565361947D0EAA1 + +It is noteworthy to mention that RFC 7166, “Supporting Authentication Trailer for OSPFv3,” comes with an alternative approach to OSPFv3 authentication in a way similar to the OSPFv2 authentication, using an authentication trailer in OSPFv3 messages and not relying on IPsec infrastructure to provide authentication and encryption services. The support for this extension has been added in IOS Release 15.4(2)T and is called OSPF3 Authentication Trailer. The feature is configured in a way similar to OSPFv2 Extended Cryptographic Authentication, by defining a key chain with keys and explicit cryptographic algorithms and then referring to this key chain using the ospfv3 authen-tication key-chain key-chain-name interface command. The syntax of this command stems from the OSPFv3 address family mode described in the next section, but it can be used to secure OSPFv3 configured either for basic IPv6 or for address family operation. Obviously, this authentication mechanism does not provide encryption services and is not compatible with OSPFv3 IPsec-based authentication or encryption. + +Here are key things to know about OSPFv3 authentication and encryption: + +■ OSPFv3 can use AH for authentication. Key +Topic ■ OSPFv3 can use ESP for authentication and encryption. + +■ OSPFv3 can use authentication trailer for authentication. + +■ OSPFv3 IPsec-based authentication and encryption can be applied per area or per link (interface); per-link configuration is more secure because it creates more layers of security. + +■ Routers that directly exchange IPsec-protected OSPFv3 packets must use the same SPI number, AH or ESP mode, cryptographic algorithms, and keys for the encryp-tion/decryption and authentication to succeed. + +■ Routers that directly exchange authentication trailer–protected OSPFv3 pack- +ets must use the same cryptographic algorithms, key IDs, and key strings for the authentication to succeed. +548 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +OSPFv3 Address Family Support + +The support of address families—a move toward OSPFv3 as a multiprotocol IGP—is a relatively new addition to OSPFv3 described in RFC 5838. When OSPFv3 was first spec-ified, its authors made two important changes to its design in which OSPFv3 differs from OSPFv2 that ultimately made the address family support possible. First, the addressing information has been moved out from type 1 and 2 LSAs to separate LSA types 8 and +9 whose format is more flexible to carry different address formats, even though not in a single LSA because they lack an internal address family identifier. LSA types 3 (inter-area routes) and 5/7 (external routes) are also formatted similarly. Second, OSPFv3 was aug-mented with an instance ID that allows multiple OSPFv3 processes to communicate over the same link while remaining separate. + +Authors of RFC 5838 suggested that the entire range of instance IDs can be effectively split into several categories for different address families. Table 9-11 documents this assignment. + +Table 9-11 Mapping of Instance IDs to Address Families + + +Instance ID Number +0 + +1–31 + +32 + +33–63 + +64 + +65–95 + +96 + +97–127 + +128–191 + +192–255 + +Address Family +Base IPv6 Unicast + +IPv6 Unicast dependent on local policy + +Base IPv6 Multicast + +IPv6 Multicast dependent on local policy + +Base IPv4 Unicast + +IPv4 Unicast dependent on local policy + +Base IPv4 Multicast + +IPv4 Multicast dependent on local policy + +Unassigned + +Reserved for private use + + + +In effect, instance IDs have become address family identifiers. By reserving a range of instance IDs for particular address families, OSPFv3 can run in several instances in paral-lel while the instance ID will help distinguish the instances and the types of addresses that each instance advertises in its type 8 and 9 LSAs. + +Multiple address family support in OSPFv3 works by OSPFv3 running a completely separate instance for each configured address family. If not specified explicitly, these instances will choose their base instance IDs automatically (0 for IPv6, 64 for IPv4), and will exchange packets, establish adjacencies, originate and flood LSAs, compute shortest-path trees, and populate routing tables completely independently of each other. There +is no information shared between individual instances, even if they run under a single +Chapter 9: OSPF 549 + +OSPFv3 process. The instance ID carried in OSPFv3 packet headers will not only keep these two instances separate but will also serve as an identifier of the address family as none of the LSA types contains an internal indication of the address format. + +In addition, the Options bitfield present in OSPFv3 Hellos, DD packets, and LSAs has a new AF-bit defined. This bit is set if the sending router supports the address family exten-sion and the particular instance is not an IPv6 unicast instance according to Table 9-11. In other words, an OSPFv3 router supporting address families will keep this bit cleared for example IDs 0–31 that indicate IPv6 unicast address families, and will set it for all other instance IDs. If a router that sets the AF-bit for a particular (non-IPv6-unicast) instance receives an OSPFv3 packet in the same instance from a neighbor in which the AF-bit is cleared, it is an indication that the neighbor does not support address families and treats the instance just as a plain IPv6 unicast instance. As a result, the router will drop such packets and never establish an adjacency in that instance with the neighbor. Summing up this behavior, routers supporting address families will nicely establish adjacencies for an IPv6 unicast address family with non-AF-compliant neighbors running instance IDs 0–31. Beyond this range, only neighbors that mutually support address families will be able to establish an adjacency. This prevents possible traffic blackholing. + +The encapsulation of OSPFv3 packets does not change with the introduction of address families. OSPFv3 packets are always encapsulated into IPv6 packets. To run OSPFv3, with or without address families, network interfaces must be configured for IPv6 operation. This is true even if running OSPFv3 in IPv4 address family mode only, advertising only IPv4 prefixes. Although LSAs will carry IPv4 prefixes, resulting OSPFv3 packets will still be encapsulated in IPv6. Also, because of the same reasons, a virtual link requires end-to-end IPv6 connectivity, which is by definition not available in non-IPv6 address families. Therefore, OSPFv3 with address families supports virtual links only for IPv6 unicast address families. + +To the OSPFv3 protocol itself, the support for address families is a fairly simple extension without significantly changing any of the underlying protocol workings. The changed CLI in IOS only reflects the fact that while running a single OSPFv3 process, separate +AF-related instances are started for each address family. Overall, the configuration is very similar to plain OSPFv3. Instead of an ipv6 router ospf section, the router ospfv3 and appropriate address-family inside the router ospfv3 section is configured. Interfaces are added by the ospfv3 process-id { ipv4 | ipv6 } area area-id command instead of ipv6 ospf process-id area area-id. The following two examples are designed to show the dif-ferences between configuring a plain IPv4 and IPv6 OSPF (Example 9-24) and using a single OSPFv3 process with address families to accomplish the same (Example 9-25). + +Example 9-24 Dual OSPFv2 and OSPFv3 Configuration on a Router + +! This router has a number of interfaces configured with both IPv4 and IPv6. + +! The usual loopback interface for OSPF RID and remote management + +interface Loopback0 +ipv6 address 2001:DB8:0:FFFF::1/128 +550 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +ip address 10.255.255.1 255.255.255.255 +ipv6 ospf 1 area 0 +ip ospf 1 area 0 + +! An interface connected in a point-to-point fashion to a single neighboring +! router. OSPF network type is changed to point-to-point to avoid DR/BDR elections +! and LSA2 generation, saving resources and 40 seconds of waiting on link coming +! up. + +interface FastEthernet0/0 +ipv6 address 2001:DB8:1:1::1/64 +ip address 10.1.1.1 255.255.255.0 +ipv6 ospf network point-to-point +ip ospf network point-to-point +ipv6 ospf 1 area 1 +ip ospf 1 area 1 + +! Another interface towards a router in the backbone area with shortened timers + +interface Serial0/0/0 +ipv6 address 2001:DB8:0:1::1/64 +ip address 10.0.1.1 255.255.255.0 +ipv6 ospf hello-interval 1 +ip ospf hello-interval 1 +ipv6 ospf 1 area 0 +ip ospf 1 area 0 + +! Summarization for inter-area IPv4 routes + +router ospf 1 +area 1 range 10.1.0.0 255.255.0.0 + +! Summarization for inter-area IPv6 routes + +ipv6 router ospf 1 +area 1 range 2001:DB8:1::/48 + + +Example 9-25 Router Configured with OSPFv3 Using Address Families + +! The same router configured with OSPFv3 and address family support + +! The usual loopback interface for OSPF RID and remote management + +interface Loopback0 +ipv6 address 2001:DB8:0:FFFF::1/128 +ip address 10.255.255.1 255.255.255.255 +Chapter 9: OSPF 551 + +ospfv3 1 ipv6 area 0 +ospfv3 1 ipv4 area 0 + +! An interface connected in a point-to-point fashion to a single neighboring +! router. OSPF network type is changed to point-to-point to avoid DR/BDR elections +! and LSA2 generation, saving resources and 40 seconds of waiting on link coming +! up. + +interface FastEthernet0/0 +ipv6 address 2001:DB8:1:1::1/64 +ip address 10.1.1.1 255.255.255.0 +ospfv3 network point-to-point ! Applies both to IPv4 and IPv6 AF +ospfv3 1 ipv6 area 1 +ospfv3 1 ipv4 area 1 + +! Another interface towards a router in the backbone area with shortened timers + +interface Serial0/0/0 +ipv6 address 2001:DB8:0:1::1/64 +ip address 10.0.1.1 255.255.255.0 +ospfv3 hello-interval 1 ! Applies both to IPv4 and IPv6 AF +ospfv3 1 ipv6 area 0 +ospfv3 1 ipv4 area 0 + +! Summarization for inter-area IPv4 and IPv6 routes + +router ospfv3 1 +address-family ipv4 +area 1 range 10.1.0.0 255.255.0.0 +! +address-family ipv6 +area 1 range 2001:DB8:1::/48 + +Keep in mind that although the configuration gives off an impression of running a single OSPFv3 process for both address families, in reality, there are two separate instances run-ning under the single OSPFv3 process 1—one for IPv6 AF and the other for IPv4. Each of them has its own independent LSDB, exchanges its own set of packets, establishes its own adjacencies, and performs its own computations. By most measures, the memory and CPU footprint are similar to running a separate OSPFv2 and OSPFv3 process. What makes things different, though, is the fact that here, both IPv6 and IPv4 address families are handled by OSPFv3 mechanisms. +552 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +OSPFv3 Prefix Suppression + +The idea behind the need for a prefix suppression feature was described in the section “OSPFv2 Prefix Suppression,” earlier in this chapter, along with the description of how the mechanism works in OSPFv2. There is a similar mechanism for OSPFv3 as well, described in the same RFC 6860 as for OSPFv2, although its operation is much more simplified thanks to the type 8 and 9 LSAs that carry addressing information instead of LSA types 1 and 2. In OSPFv3, the prefix suppression works simply by omitting the sup-pressed transit link prefixes from type 8 and 9 LSAs. + +For OSPFv3, the transit link prefix suppression is configured either on a per-process basis using the prefix-suppression command, or on per-interface basis using either the ipv6 ospf prefix-suppression or ospfv3 prefix-suppression command, depending on whether OSPFv3 is running in plain or in address family mode. If OSPFv3 address family mode is used, the prefix suppression can either be configured outside the address family, in which case it influences all address families, or it can be configured for a particular address fam-ily only. Just like in OSPFv2, prefix suppression applies to all configured interfaces except for loopbacks, passive interfaces, and secondary IP addresses in an IPv4 address family. + +OSPFv3 Graceful Shutdown + +The Graceful Shutdown feature in OSPFv3 accomplishes the same goal as in OSPFv2, but the process is slightly modified. When an OSPFv3 process is gracefully shut down using the shutdown command, the router will + +■ Start sending out Hello packets with the router priority set to 0, dropping its DR/BDR role where applicable + +■ Stop accepting received Hello packets + +■ Flush all LSAs it has originated except a type 1 LSA + +■ Flood its type 1 LSA with all links in that LSA having the maximum cost of 65,535 + +■ After the Dead interval expires and all neighbors are considered dead, flush its own type 1 LSA + +■ Stop sending and processing OSPFv3 packets + +As opposed to the Graceful Shutdown procedure in OSPFv2, where the shutdown is practically immediate, OSPFv3 will perform the shutdown over the Dead interval until all neighbors are declared down. The shutdown is carried out in a more gradual fashion, by dropping the DR/BDR roles, withdrawing all attached, inter-area and redistributed pre-fixes, declaring the router as a stub router (by setting the costs of all links to 65,535), and finally flushing the router’s own type 1 LSA entirely after all neighbors have gone down thanks to the Hello packets from neighbors being ignored as a part of the procedure. +Chapter 9: OSPF 553 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 9-12 lists some of the key protocols regarding OSPF. + + + +Table 9-12 + +Name + + +Protocols and Corresponding Standards for Chapter 9 + +Standard + + + +OSPF Version 2 + +Alternative Implementations of OSPF Area Border Routers + +The OSPF Opaque LSA Option + +The OSPF Not-So-Stubby Area (NSSA) Option + +OSPF Stub Router Advertisement + +Traffic Engineering (TE) Extensions to OSPF Version 2 + +Graceful OSPF Restart + +OSPFv2 HMAC-SHA Cryptographic Authentication + +OSPF for IPv6 + +OSPFv3 Graceful Restart + +Hiding Transit-Only Networks in OSPF + +Support of Address Families in OSPFv3 + +Supporting Authentication Trailer for OSPFv3 + +RFC 2328 + +RFC 3509 + +RFC 5250 + +RFC 3101 + +RFC 6987 + +RFC 3630 + +RFC 3623 + +RFC 5709 + +RFC 5340 + +RFC 5187 + +RFC 6860 + +RFC 5838 + +RFC 7166 + + + +Table 9-13 lists some of the most popular IOS commands related to the topics in this chapter. Also, refer to Tables 9-7 through 9-9 for references to OSPF authentication commands. +554 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Table 9-13 + +Command + + +Command Reference for Chapter 9 + +Command Mode and Description + + + +router ospf process-id + +ipv6 router ospf process-id + +router ospfv3 process-id + +network ip-address [wildcard-mask ] area area + +Global config; puts user in OSPF configuration mode for that PID. +Global config; puts user in IPv6 OSPFv3 configuration mode for that PID. +Global config; puts user in OSPFv3 address family configuration mode for that PID. +OSPF config mode; defines matching parameters, compared to interface IP addresses, to pick interfaces on which to enable OSPF. + +ip ospf process-id area area-id [secondaries Interface config mode; alternative to the none] network command for enabling OSPF on an +interface. + + +ipv6 ospf process-id area area-id + +ospfv3 process-id { ipv4 | ipv6 } area area-id + +Interface config mode; enables IPv6 OSPFv3 on an interface. +Interface config mode; enable OSPFv3 in selected address family on an interface. + +neighbor ip-address [priority number ] [poll- OSPF config mode; used when neighbors interval seconds ] [cost number ] [database- must be defined statically, it identifies the filter all] neighbor’s IP address, priority, cost, and poll +interval. + + +ipv6 ospf neighbor ipv6-address [priority number ] [poll-interval seconds] [cost number ] [database-filter all] + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] neighbor ipv6-address [priority number ] [poll-interval seconds ] [cost number ] [database-filter all] + +auto-cost reference-bandwidth ref-bw + + +router-id ip-address + +log-adjacency-changes [detail] + +Interface config mode; used when neighbors must be defined statically for IPv6 OSPFv3, it identifies the neighbor’s IPv6 address, priority, cost, and poll interval. +Interface config mode; used when neighbors must be defined statically for OSPFv3 +in address family mode, it identifies the neighbor’s IPv6 address, priority, cost, and poll interval. +OSPF config mode; changes the numerator in the formula to calculate the interface cost for all OSPF interfaces on that router. +OSPF config mode; statically sets the router ID. +OSPF subcommand; displays log messages when neighbor status changes. On by default. +Chapter 9: OSPF 555 + + + +Command +passive-interface [default] {interface-type interface-number } + + +area area-id stub [no-summary] + +area area-id nssa [no-redistribution ] +[default-information-originate [metric] [metric-type ]] [no-summary] + +area area-id default-cost cost + + +area area-id nssa translate type7 suppress-fa + +area area-id range ip-address mask [advertise | not-advertise] [cost cost] + +area {area-id} filter-list prefix {prefix-list-name in | out} + +distribute-list [ACL] | [route-map map-tag ] in [int-type | int-number] + +area area-id virtual-link router-id +[authentication [message-digest | null | key-chain key-chain-name ] ] [ hello-interval seconds ] [retransmit-interval seconds] +[transmit-delay seconds] [dead-interval seconds ] [[authentication-key key] | +[message-digest-key key-id md5 key ]] + +ip ospf authentication [ key-chain name | message-digest | null ] + +ip ospf authentication-key password + +ip ospf message-digest-key key-id md5 key + +Command Mode and Description +OSPF config mode; causes OSPF to stop sending Hellos on the specified interface. OSPF will still advertise the subnet as a stub network. +OSPF config mode; sets the area type to stub or totally stubby. +OSPF config mode; sets the area type to NSSA or totally NSSA. + +OSPF config mode; sets the cost of the default route created by ABRs and sent into stubby areas. +OSPF config mode; sets an NSSA ABR to set the forwarding address to 0.0.0.0 for the type 5 LSAs it translates from type 7. +OSPF config mode; summarizes routes into a larger prefix at ABRs. Optionally filters type 3 LSAs (not-advertise option). +OSPF config mode; filters type 3 LSA creation at ABR. + +OSPF config mode; defines ACL or prefix list to filter what OSPF puts into the routing table. +OSPF config mode; creates a virtual link, with typical interface configuration settings to overcome the fact that the link is virtual. + + + + +Interface subcommand; sets the authentication mode or refers to a key chain for extended cryptographic authentication. +Interface subcommand; sets the password for the classic plaintext authentication. +Interface subcommand; sets the password for the classic MD5 authentication. +556 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +ipv6 ospf authentication { null | ipsec spi spi authentication-algorithm key } + +ospfv3 authentication { null | ipsec spi spi authentication-algorithm key | key-chain key-chain-name} + +ipv6 ospf encryption { null | ipsec spi spi esp { encryption-algorithm key | null } authentication-algorithm key } + +ospfv3 encryption { null | ipsec spi spi esp { encryption-algorithm key | null } authentication-algorithm key } + +ip ospf hello-interval seconds + +ipv6 ospf hello-interval seconds + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] hello-interval seconds + +ip ospf dead-interval {seconds | minimal hello-multiplier multiplier} + +ipv6 ospf dead-interval seconds + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] dead-interval seconds +ip ospf name-lookup + +ipv6 ospf name-lookup + +ip ospf cost interface-cost + +ipv6 ospf cost interface-cost + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] cost interface-cost +ip ospf mtu-ignore + +ipv6 ospf mtu-ignore + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] mtu-ignore + +Command Mode and Description +Interface subcommand; sets the IPsec AH authentication algorithm and key for OSPFv3, or refers to a key chain for +authentication trailer-based authentication. + + +Interface subcommand; sets the IPsec ESP encryption and authentication algorithms and key for OSPFv3. + + + + +Interface subcommand; sets the interval for periodic Hellos. + + + +Interface subcommand; defines the dead interval, or optionally the minimal dead interval of 1 second (not supported for OSPFv3). + + +Global command; causes the router to use DNS to correlate RIDs to host names for show command output. +Interface subcommand; sets the cost. + + + + +Interface subcommand; tells the router to ignore the check for equal MTUs that occurs when sending DD packets. +Chapter 9: OSPF 557 + + +Command Command Mode and Description +ip ospf network {broadcast | non-broadcast | Interface subcommand; sets the OSPF {point-to-multipoint [non-broadcast] | point- network type on an interface. +to-point}} + + +ipv6 ospf network {broadcast | non-broadcast | {point-to-multipoint [non-broadcast] | point-to-point}} + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] network {broadcast | non-broadcast | {point-to-multipoint [non-broadcast] | point-to-point}} + +ip ospf priority number-value + +ipv6 ospf priority number-value + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] priority number-value + +ip ospf retransmit-interval seconds + +ipv6 ospf retransmit-interval seconds + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] retransmit-interval seconds + +ip ospf transmit-delay seconds + +ipv6 ospf transmit-delay seconds + + + + + + + +Interface subcommand; sets the OSPF priority on an interface. + + + +Interface subcommand; sets the time between LSA transmissions for adjacencies belonging to an interface. + + +Interface subcommand; defines the estimated time expected for the transmission of an LSU. + +ospfv3 [ process-id [ ipv4 | ipv6 ] ] transmit-delay seconds + +max-metric router-lsa [on-startup {announce-time | wait-for-bgp}] + +show { ip ospf | ipv6 ospf | ospfv3 } border-routers +show { ip ospf | ipv6 ospf | ospfv3 } [process-id [area-id]] database +show { ip ospf | ipv6 ospf | ospfv3 } neighbor [interface-type interface-number ] [neighbor-id] [detail] +show { ip ospf | ipv6 ospf | ospfv3 } [process-id ] summary-address +show { ip ospf | ipv6 ospf | ospfv3 } virtual-links +show { ip ospf | ipv6 ospf | ospfv3 } ospf + +OSPF config mode; configures a stub router, delaying the point at which it can become a transit router. +User mode; displays hidden routes for ABRs and ASBRs. +User mode; has many options not shown here. Displays the OSPF LSDB. +User mode; lists information about OSPF neighbors. + +User mode; lists information about route summaries in OSPF. +User mode; displays status and info about virtual links. +User mode; displays all OSPF routes in the IP routing table. +558 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +show { ip ospf | ipv6 ospf | ospfv3 } interface [interface-type interface-number ] [brief ] +show { ip ospf | ipv6 ospf | ospfv3 } statistics [detail] + +Command Mode and Description +User mode; lists OSPF protocol timers and statistics per interface. + +User mode; displays OSPF SPF calculation statistics. + +clear { ip ospf | ipv6 ospf | ospfv3 } [pid] Enable mode; restarts the OSPF process, +{process | redistribution | counters [neighbor clears redistributed routes, or clears OSPF [neighbor-interface] [neighbor-id ]]} counters. + + +debug { ip ospf | ipv6 ospf | ospfv3 } hello + + +debug { ip ospf | ipv6 ospf | ospfv3 } adj + +Enable mode; displays messages regarding Hellos, including Hello parameter mismatches. +Enable mode; displays messages regarding adjacency changes. + + + +Table 9-14 summarizes many OSPF timers and their meaning. + + + +Table 9-14 + +Timer +MaxAge + + +LSRefresh + + +Hello + + +Dead + + +Wait + + +OSPF Timer Summary + +Meaning +The maximum time an LSA can be in a router’s LSDB, without receiving a newer copy of the LSA, before the LSA is removed. Default is 3600 seconds. +The timer interval per LSA on which a router refloods an identical LSA, except for a 1-larger sequence number, to prevent the expiration of MaxAge. Default is 1800 seconds. +Per interface; time interval between Hellos. Default is 10 or 30 seconds, depending on interface type. Broadcast and point-to-point use 10 seconds; NBMA and point-to-multipoint use 30 seconds. +Per interface; time interval in which a Hello should be received from a neighbor. If not received, the neighbor is considered to have failed. Default is four times Hello. +Per interface; set to the same number as the dead interval. Defines the time a router will wait to get a Hello asserting a DR after reaching a 2-Way state with that neighbor. + +Retransmission Per interface; the time between sending an LSU, not receiving an acknowledgment, and then resending the LSU. Default is 5 seconds. +Chapter 9: OSPF 559 + + + +Timer Inactivity + + + +Poll Interval + +Flood (Pacing) + +Retransmission (Pacing) +Lsa-group (Pacing) + +Meaning +Countdown timer, per neighbor, used to detect when a neighbor has not been heard from for a complete dead interval. It starts equal to the dead interval, counts down, and is reset to be equal to the dead interval when each Hello is received. +On NBMA networks, the period at which Hellos are sent to a neighbor when the neighbor is down. Default is 60 seconds. +Per interface; defines the interval between successive LSUs when flooding LSAs. Default is 33 ms. +Per interface; defines the interval between retransmitted packets as part of a single retransmission event. Default is 66 ms. +Per OSPF process. LSA’s LSRefresh intervals time out independently. This timer improves LSU reflooding efficiency by waiting, collecting several LSAs whose LSRefresh timers expire, and flooding all these LSAs together. Default is 240 seconds. + + + +Table 9-15 lists OSPF neighbor states and their meaning. + + +Table 9-15 OSPF Neighbor States + + +State +Down + +Attempt + +Init + +2-Way + +ExStart + +Exchange + +Loading + +Full + +Meaning +No Hellos have been received from this neighbor for more than the dead interval. +This router is sending Hellos to a manually configured neighbor. + +A Hello has been received from the neighbor, but it did not have the receiving router’s RID in it. +A Hello has been received from the neighbor, and it has the receiving router’s RID in it. This is a stable state for pairs of DROther neighbors. +Currently negotiating the DD sequence numbers and master/slave logic used for DD packets. +Finished negotiating and currently exchanging DD packets. + +All DD packets exchanged, and currently pulling the complete LSDB entries with LSU packets. +Neighbors are adjacent (fully adjacent), and should have identical LSDB entries for the area in which the link resides. Routing table calculations begin. +560 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 9-16 lists several key OSPF numeric values. + + +Table 9-16 OSPF Numeric Ranges + +Setting Range of Values + +Single interface cost + +Complete route cost + +Infinite route cost + +Reference bandwidth (units: Mbps) + +OSPF PID + +LSA Age + +1 to 65,535 (216 – 1) + +1 to 16,777,215 (224 – 1) + +16,777,215 (224 – 1) + +1 to 4,294,967 + +1 to 65,535 (216 – 1) + +1 to 3600 seconds + + + + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +LSDB, Dijkstra, link-state routing protocol, LSA, LSU, DD, Hello, LSAck, RID, neigh-bor state, neighbor, adjacent, fully adjacent, 2-Way, 224.0.0.5, 224.0.0.6, area, stub area type, network type, external route, E1 route, E2 route, Hello timer, dead time/ interval, sequence number, DR, BDR, DROther, priority, LSA flooding, DR election, SPF calculation, partial SPF calculation, full SPF calculation, LSRefresh, hello time/ interval, MaxAge, ABR, ASBR, internal router, backbone area, transit network, stub network, LSA type, stub area, NSSA, totally stubby area, totally NSSA area, vir- +tual link, stub router, transit router, SPF algorithm, All OSPF DR Routers, All OSPF Routers, graceful restart, prefix suppression, address family, instance ID, graceful shutdown, flooding scope +Refer to the glossary to check your answers. +Chapter 9: OSPF 561 + +Further Reading + +Jeff Doyle’s Routing TCP/IP, Volume I, Second Edition—every word a must for CCIE Routing and Switching. + +Cisco OSPF Command and Configuration Handbook, by Dr. William Parkhurst, covers every OSPF-related command available in Cisco IOS at the time of that book’s publica-tion, with examples of each one. + +The CCIE Routing and Switching v5.0 exam blueprint also mentions the OSPF IP Fast Reroute features. More information about them can be found on the Cisco website in the IP Routing: OSPF Configuration Guide for Cisco IOS Release 15S, specifically in the "OSPFv2 Loop-Free Alternate Fast Reroute" and "OSPF IPv4 Remote Loop-Free Alternate IP Fast Reroute" sections. Also, many Cisco Live! sessions cover these features, including "IP LFA (Loop-Free-Alternative): Architecture and Troubleshooting" (BRKRST-3020) and "Routed Fast Convergence" (BRKRST-3363), available at www.ciscolive365.com. At the time of writing, these features were supported only on service provider IOS, IOS-XE, and IOS-XR image builds and will not be present on the Lab exam. The Written exam might cover general properties of these features. + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Describe a Basic IS-IS Network in a Single Area and a Single Topology + +■ Describe Neighbor Relationships + +■ Describe Network Types, Routing Levels, and Router Types + +■ Describe IS-IS Operations + +■ Describe Metrics and Wide Metrics +CHAPTER 10 + + + + + + +IS-IS + + +This chapter covers IS-IS, the other link-state routing protocol covered by the CCIE Routing and Switching exam. Inclusion of the Intermediate System–to–Intermediate System (IS-IS) into the Routing and Switching track might be surprising, as IS-IS is more associated with service provider environments. Still, with the ever-increasing prolifera-tion of IPv6, TRILL, and FabricPath, compounded with the intrinsic OSPFv3 complex-ity, IS-IS, with its inherent multiprotocol capability, simplicity, and general flexibility, is becoming more interesting, even for enterprise deployments. + +“Do I Know This Already?” Quiz + +Table 10-1 outlines the major sections in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 10-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section + +OSI Network Layer and Addressing + +Levels of Routing in OSI Networks + +IS-IS Metrics, Levels, and Adjacencies + +IS-IS Packet Types + +IS-IS Operation over Different Network Types + +Areas in IS-IS + +Authentication in IS-IS + +IPv6 Support in IS-IS + +Configuring IS-IS + +Total Score + +Questions Covered in This Score Section +1–4 + +5–7 + +8–10 + +11–15 + +16–20 + +21–24 + +25–27 + +28–29 + +30–33 +564 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” In all items, try to select all correct answers. +1. How many NSAP addresses are usually configured on a router? + +a. One per every active (up/up) interface with IS-IS configured + +b. One per every interface with IS-IS configured + +c. One per area + +d. One per node + +2. What is the size of an NSAP address? + +a. Fixed length of 20 octets + +b. Fixed length of 32 octets + +c. Variable length ranging from 8 to 20 octets + +d. Variable length ranging from 16 to 32 octets + +3. What is the common length of the System ID field? + +a. 8 octets + +b. 6 octets + +c. 4 octets + +d. 1 octet + +e. 4 bits + +4. In the NSAP 49.0001.FF11.2233.4455.6600, what is the value of the System ID field? + +a. 49.0001 + +b. FF11.2233 + +c. FF11.2233.4455 + +d. FF11.2233.4455.6600 + +e. 2233.4455 + +f. 2233.4455.6600 + +g. 1122.3344.5566 + +5. In OSI terminology, intra-area routing is also called which of the following? + +a. L0 routing + +b. L1 routing + +c. L2 routing + +d. L3 routing +Chapter 10: IS-IS 565 + +6. In OSI terminology, inter-area routing within a domain is also called which of the following? + +a. L0 routing + +b. L1 routing + +c. L2 routing + +d. L3 routing + +7. In OSI terminology, interdomain routing is also called which of the following? + +a. L0 routing + +b. L1 routing + +c. L2 routing + +d. L3 routing + +8. What is the range of metrics defined by the original IS-IS standard? + +a. 6 bits for interface metric, 10 bits for total metric + +b. 8 bits for interface metric, 16 bits for total metric + +c. 16 bits for interface metric, 32 bits for total metric + +d. 24 bits for interface metric, 32 bits for total metric + +9. What is the width of metrics if wide metrics are activated? + +a. 24 bits for interface metric, 32 bits for total metric + +b. 16 bits for interface metric, 24 bits for total metric + +c. 32 bits for interface metric, 32 bits for total metric + +d. There is no concept of wide metrics in IS-IS. + +10. Select the correct answer about the established adjacency type, assuming that the routers are directly connected. + +a. R1: L1L2, R2: L2, both in the same area. L2 adjacency will be created. + +b. R1: L1L2, R2: L2, both in the same area. L1 and L2 adjacencies will be created. + +c. R1: L1L2, R2: L1L2, each in a different area. L1 and L2 adjacencies will be created. + +d. R1: L1L2, R2: L1L2, each in a different area. L2 adjacency will be created. + +e. R1: L1, R2: L1L2, both in the same area. L1 and L2 adjacencies will be created. + +f. R1: L1, R2: L1L2, both in the same area. L1 adjacency will be created. + +g. R1: L1 R2: L1, each in a different area. No adjacency will be created. + +h. R1: L2 R2: L2, each in a different area. L2 adjacency will be created. +566 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +11. How many IIH types are sent in default configuration over a broadcast link? + +a. One; L1 IIH + +b. One; L2 IIH + +c. One; L1L2 IIH + +d. Two, L1 and L2 IIHs + +12. Do the timers on neighboring IS-IS routers need to match? + +a. Yes + +b. Only on point-to-point links + +c. Only on broadcast links + +d. No + +13. Which of the following fields can be used to identify an LSP? + +a. Area ID + +b. System ID + +c. NSEL + +d. Pseudonode ID + +e. Fragment + +f. SNPA + +14. Can an LSP be fragmented? + +a. Yes. Any router can fragment any LSP according to its interface MTU. + +b. Yes, but only the originator of an LSP can fragment it. + +c. Yes, but only backbone routers can fragment an LSP (regardless of its origi-nator). + +d. No. LSP packets cannot be fragmented. + +15. Which packets are used to request or acknowledge an LSP? + +a. IIH + +b. SNPA + +c. CSNP + +d. PSNP +Chapter 10: IS-IS 567 + +16. Which of the following states are valid adjacency states in IS-IS? + +a. Down + +b. Init + +c. 2Way + +d. Exchange + +e. Full + +f. Up + +17. How is a Backup DIS elected in IS-IS? + +a. By its priority + +b. By its SNPA + +c. By its System ID + +d. There is no Backup DIS in IS-IS. + +18. What is the DIS election based on? + +a. Interface priority + +b. Uptime + +c. System ID + +d. SNPA + +e. IP address + +19. Does the IS priority of 0 have any special significance? + +a. No + +b. Yes. The router will not participate in DIS elections. + +c. Yes. The router will not be considered by others during their SPF run. + +d. Yes. The router will act as an area boundary router. + +20. How many DISs are going to be elected on a common broadcast segment with ten routers in default IS-IS configuration if the router adjacencies have been fully estab-lished? +a. Only one. A DIS function is shared between L1 and L2. + +b. Two, one for L1 and one for L2, each level having a different router as the DIS. + +c. Two, one for L1 and one for L2, with the same router winning DIS in both levels. + +d. None. IS-IS treats all links as point-to-point by default. +568 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +21. It is possible to renumber, merge, or split areas in IS-IS without network disruption. + +a. False + +b. True + +22. What IPv4/IPv6 prefixes are advertised in an L1 LSP? + +a. Directly attached networks + +b. Networks from a router’s own area + +c. Networks from other areas + +d. Redistributed networks if redistribution into L1 is configured + +23. What IPv4/IPv6 prefixes are advertised in an L2 LSP? + +a. Directly attached networks + +b. Networks from a router’s own area + +c. Networks from other areas + +d. Redistributed networks + +24. In what mode must a backbone router operate if all other routers in its own area are L1-only routers? + +a. L1-only + +b. L1L2 + +c. L2-only + +d. As the area is a totally stubby area, the level setting on the backbone router is irrelevant. + +25. Which statements are true about authentication in IS-IS? + +a. All packet types are always authenticated by a common password. + +b. P2P IIH packets can be authenticated independently for each level. + +c. LAN IIH packets can be authenticated independently for each level. + +d. Each of LSP, CSNP, and PSNP packet types can be authenticated by an inde-pendent password. + +e. IIH packets can be authenticated independently from LSP+CSNP+PSNP packets. + +f. If authentication is configured, LSP+CSNP+PSNP packets are authenticated by a common password for both levels. + +g. If authentication is configured, LSP+CSNP+PSNP packets can be authenticated in each level independently. +Chapter 10: IS-IS 569 + +26. What authentication mechanisms are currently available for IS-IS? + +a. Plaintext + +b. AES + +c. 3DES + +d. MD5 + +27. Which statements are true about authentication in IS-IS? + +a. If using key chains, key numbers must match, even with the plaintext authenti-cation method. + +b. If using key chains, key numbers do not need to match, even with the MD5 authentication method. + +c. Authentication password for L1 LSP+CSNP+PSNP must match only between directly connected neighbors. + +d. Authentication password for L1 LSP+CSNP+PSNP must match across the area. + +e. Authentication password for L1 LSP+CSNP+PSNP must match across the domain. + +f. Authentication password for L2 LSP+CSNP+PSNP must match only between directly connected neighbors. + +g. Authentication password for L2 LSP+CSNP+PSNP must match across the area. + +h. Authentication password for L2 LSP+CSNP+PSNP must match across the domain. + +28. Which statements are true about IPv6 support in IS-IS? + +a. When IPv6 support is activated, IS-IS packets are sent to the FF02::2 multicast IPv6 address. + +b. Separate LSPs are generated for IPv4 and IPv6 prefixes. + +c. IPv4 and IPv6 prefixes can coexist in a single LSP. + +d. Separate NSAP/NET addresses have to be configured for IPv4 and IPv6 IS-IS instances. + +e. A single IS-IS process advertises both IPv4 and IPv6 routes. + +f. The System ID of an IS-IS router has to be derived from its IPv6 loopback address. +570 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +29. Which statements are true regarding advertising a local interface’s IPv6 prefix in IS-IS? + +a. The address-family ipv6 section must be created in router isis mode before IS-IS can start advertising IPv6 prefixes. + +b. The ip router isis command in interface configuration mode applies both to IPv4 and IPv6 prefixes configured on the interface. + +c. The prefix command in the address-family ipv6 section of the router isis mode can be used to advertise locally connected prefixes. + +d. The ipv6 router isis command in interface configuration mode is used to adver-tise that interface’s IPv6 prefixes. + +30. Which values can be used to manually derive a System ID for an IS-IS router? + +a. Any arbitrary value as long as it is unique + +b. Any router’s MAC address + +c. Any router’s IP address after an appropriate transliteration + +d. None of these answers applies; Cisco routers derive a System ID automatically. + +31. How can the logging of neighbor state changes be activated for an IS-IS process? + +a. The logging is activated automatically; no action is necessary. + +b. log-adjacency-changes all command in router isis mode + +c. isis log-neighbor-changes command in global configuration mode + +d. isis neighbor log-changes command in interface configuration mode + +32. How can a local interface’s IPv4 prefix be advertised in IS-IS? + +a. Using the network command in router isis mode + +b. Using the ip router isis command in interface configuration mode + +c. Using the passive-interface command in router isis mode + +d. No command is necessary; IS-IS automatically advertises IPv4 prefixes of all local interfaces on a router. + +33. How can summarization be configured in IS-IS? + +a. Using the summary-address command in router isis mode for IPv4 prefixes + +b. Using the summary-prefix command in the address-family ipv6 section of the router isis mode for IPv6 prefixes + +c. Using the isis summary command in interface mode for both IPv4 and IPv6 prefixes + +d. IS-IS does not support summarization. +Chapter 10: IS-IS 571 + +Foundation Topics + + +IS-IS is covered in this chapter in more depth than the CCIE Routing and Switching exam blueprint officially requires. Considering, however, the perceived “otherworldliness” of IS-IS, we felt it was necessary to provide a significantly larger overview of Open Systems Interconnection (OSI) protocol operations with particular focus on IS-IS, to put things into perspective, and to show you that some ideas from OSI networks on which IS-IS is +also based can be found, in a certain modification, in our TCP/IP environments. It is natu-ral for us humans to treat a nonmainstream, different approach to things with a reserved attitude, and if you are relatively new to IS-IS, you will very probably have this feeling +of “why did they do it so differently?” more often than not. Nevertheless, try to keep an open, unbiased mind. Discovering and learning about different ways to do things can be extremely enlightening. + +IS-IS is a link-state routing protocol originally specified in ISO/IEC standard 10589:2002, and initially created for OSI networks. Internally, it uses the same Dijkstra Shortest Path First (SPF) algorithm as Open Shortest Path First (OSPF). The true dependence of IS-IS on OSI protocols and principles is remarkably low, though. IS-IS uses so-called Network Service Access Point (NSAP) addressing, described in the following section, to iden- +tify individual routers, their area memberships, and their adjacencies, and is designed to provide Level 1 (intra-area) and Level 2 (inter-area) routing according to OSI rout-ing hierarchies. Apart from that, however, there is little OSI-specific left. IS-IS does not run over any network layer protocol; instead, it encapsulates its messages directly into +data-link frames. Adjacency and addressing information in IS-IS messages is encoded as Type-Length-Value (TLV) records, thereby providing excellent flexibility and extendabil-ity. Enhancing IS-IS for a new address family is a matter of defining new TLVs to carry the desired addressing information along the existing topology information, without requiring any changes to the underlying protocol operations or message formats. Based on these characteristics, IS-IS is best described as being protocol-agnostic. RFC 1195 specified how the original IS-IS for OSI networks can be extended to support IP routing along with OSI routing in a single IS-IS instance, coining the term Integrated IS-IS. Since then, IS-IS development and further extensions have been strongly driven by the IETF in numerous RFCs. + +The chapter begins with a light introduction into OSI networks and focuses on NSAP addressing in these networks that is retained by IS-IS. After discussing the routing levels, IS-IS is introduced in greater detail, its packet types are discussed, and link-state database is explained. We then have a look at the IS-IS operation on point-to-point and broad- +cast links; discuss the multiarea routing in IS-IS, authentication, and IPv6 support; and end with a commented configuration example. The chapter predominantly focuses on explaining the principles and fundamentals of IS-IS. Its configuration is relatively simple, and while shown in a relatively extensive way, the CCIE Routing and Switching blueprint itself focuses more on the “Describe” aspect of IS-IS, rather than “Configure, Maintain, Operate, and Troubleshoot.” +572 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Originally, IS-IS started as a routing protocol for ISO OSI networks and is naturally influ-enced in its fundamental aspects by the OSI approach to networking. Therefore, to under-stand IS-IS well, it is important to review the key concepts of OSI networks first. + +OSI Network Layer and Addressing + + + + + + + + + + + + + + + + + + +Key Topic + +Whenever the OSI acronym is mentioned, a person working in networking immedi-ately thinks of the OSI Reference Model developed by the International Standards Organization. The OSI Reference Model is common knowledge among networkers, and no doubt every well-prepared CCIE candidate could talk about it even in his sleep. It is +somewhat less known, however, that ISO also created protocol specifications for individ-ual layers of this reference model, and many of those protocols are actually implemented and in use. While they have never been anywhere near TCP/IP’s popularity and adoption (for several reasons not to be discussed here), ISO OSI protocols have been nonetheless widely implemented, for example, in telecommunications equipment and networks and +in aviation. The OSI Reference Model and related protocols were developed indepen-dently of the TCP/IP protocol suite, and TCP/IP creators never intended to follow the OSI Reference Model. As a result, many aspects of OSI networks are foreign to network pro-fessionals who have been in touch only with TCP/IP networks. While it might be tempt-ing to approach these differences with distrust or contempt, it is best to keep an open mind without biases or preconceptions. + +ISO OSI terminology is significantly different. In ISO-speak, as many authors call it, there are no hosts or routers. Instead, the term End System (ES) is used for a host, and the term Intermediate System (IS) is used for a router. The term System alone describes a network node. Also, the term Circuit stands for interface, and the term Domain stands for autonomous system. Hence, an end-to-end communication between two End Systems (hosts) in a Domain (autonomous system) involves zero or more Intermediate Systems (routers) interconnected by Circuits (interfaces). We will introduce a couple of other terms later in the chapter. + +The network layer specification of the OSI Reference Model that is concerned with end-to-end communication between two ES entities calls for two basic services: connection-less-mode and connection-mode network layer communication. The connectionless mode of operation is identical to the way that IP operates, as a pure datagram service without any prior session establishments. In OSI networks, the Layer 3 network protocol that provides a connectionless communication between ES entities is called ConnectionLess-mode Network Protocol (CLNP) and is specified in ISO/IEC 8473-1:1998. The ITU-T republished its specification in the X.233 recommendation. The CLNP protocol is to OSI networks what IPv4/IPv6 are to TCP/IP networks. The set of services provided by CLNP is called ConnectionLess Network Services, or simply CLNS. We will be seeing a number of commands, mostly of the show clns... format, that refer to a router’s operation in OSI connectionless mode, including IS-IS. For connection-oriented mode in OSI networks, an adaptation of the X.25 protocol is used. There is no analogous connection-oriented net- +work layer protocol in TCP/IP networks. +Chapter 10: IS-IS 573 + + + + + + + + + + + +Key Topic + +End-to-end communication requires addressing on the network layer. The addressing used in OSI networks, both in connectionless and connection-oriented mode, is called NSAP addressing, with the acronym standing for Network Service Access Point repre-senting an address of a particular network service on a particular network node in the network. This form of addressing is defined in its basic form in ISO/IEC 8348, and the ITU-T republished this standard in its X.213 recommendation. Further details of NSAP addressing are specified in the IS-IS ISO/IEC 10589:2002 standard. This chapter explains the NSAP addressing by combining knowledge from both standards. + +NSAP addressing bears many differences to addressing in TCP/IP networks. An NSAP address is assigned to the entire network node, not to its individual interfaces. A single node requires only one NSAP address in a common setup, regardless of how many net-work interfaces it uses. As a result, NSAP addressing does not have the notion of per-interface subnets similar to IP subnets. An approximate analogy can be created in an IPv6 network by assigning each node a global IPv6 address to its loopback interface only, leav-ing all physical network interfaces running only with IPv6 link-local addresses, and run-ning a routing protocol over all loopbacks and physical links to allow all nodes to learn +about each other’s global address and the path toward it. + + +Figure 10-1 shows the basic format of an NSAP address. + +Key IDP DSP Topic +AFI IDI HO-DSP System ID SEL + +Figure 10-1 NSAP Address Format + +At a high level, an NSAP address consists of two parts: + +■ The Initial Domain Part (IDP) + +■ The Domain Specific Part (DSP) + +The internal format and length of these two parts are variable to a large extent and depend on the actual application in which the NSAP addressing is used. As a result, an NSAP address has a variable length. + +The IDP itself consists of two fields: the Authority and Format Identifier (AFI) and the Initial Domain Identifier (IDI). The AFI value (1 octet in the range of 00 to FF) indicates the format of the remaining address fields. The IDI field has a variable length depending on the address format indicated by AFI and might even be omitted. Together, the AFI and IDI indicate the routing domain (the autonomous system) in which the node is located. + +The format of DSP is again dependent on the particular address format. However, at least in a general approach, the DSP consists of a variable-length High-Order Domain Specific Part (HO-DSP) that identifies the part (or an area) of the domain in which the node is located. This field can be further structured into subfields. The System ID is the unique identifier of the node itself. While NSAP allows this field to be from 1 to 8 octets long, all current implementations fix the length of the System ID field to 6 octets. Finally, the +574 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +SEL field, also called an NSAP Selector or NSEL, is a 1-octet-long field that identifies the particular service in or above the network layer on the destination node that should process the datagram. A rough analogy in the IP world would be the particular protocol above IP, or the transport port. + +Table 10-2 lists some of the most often used NSAP address formats. + + +Table 10-2 Selected NSAP Address Formats + + +AFI Meaning + +39 Use of Data Country Code (ISO 3166) + +IDI Length and Contents + +2 octets; numeric country code according to ISO 3166 + +HO-DSP Length and Contents +10 octets; area number + + + +45 Use of international phone 8 octets; international phone numbers (ITU-T E.164) number according to E.164 + +4 octets; area number + + + +47 Use of International Code Designator (ISO 6523) +49 Locally defined format (private addressing; free format) + +2 octets; international organization code according to ISO 6523 +Formally not present + +10 octets; area number +Between 0 and 12 octets; area number + + + +In each of these AFI types, the HO-DSP (the area number) can be further internally structured; however, these details are not relevant at this point. In typical IS-IS deploy-ments, the addressing uses the AFI of 49 in which the length and meaning of the +HO-DSP field are entirely up to the administrator. While this system of addressing might be perceived as complex and possibly cumbersome, it is nonetheless very flexible and adaptable to various enumeration approaches. + +The minimum size of an NSAP address is 8 octets—with only AFI, System ID, and SEL fields present. The maximum NSAP address size is 20 octets. + +The SEL octet deserves a special mention. As mentioned earlier, it is used to address the datagram to a particular service at the destination node. As an example, the SEL value of 22 or 1D indicates the OSI TP4 transport layer protocol (different vendors appear +to use different SEL values); the value of 2F indicates a GRE IP-over-CLNP tunneling. Specifically, if the value of the SEL octet is 0, no particular service is being addressed, and the entire NSAP address simply identifies the destination node itself without refer-ring to any particular service on that node. An NSAP address in which the SEL octet is set to 0 is called a Network Entity Title (NET), and this is the address that is configured on the node. Configuration of NETs will be a mandatory part of IS-IS configuration. + +To summarize, NSAP addresses can be thought to contain, in a single instance, informa-tion about the destination’s autonomous system, area, unique identifier, and even the requested upper-layer service. +Chapter 10: IS-IS 575 + + + +Key Topic + +The written format of NSAP addresses uses hexadecimal digits separated into groups of one or more octets by a dot. Usually, the AFI value (1 octet; 2 hexadecimal digits) is immediately separated by a dot for better readability, with the remainder of the NSAP address simply written in two-octet groups, for example, 49.0001.1234.5678.3333.00. In this address, the AFI is 49, signifying a local address; the 0001 is the area number; the 1234.5678.3333 is the System ID of the node; and the trailing 00 is the SEL value, mak-ing this NSAP address also a NET. The use of the dot, however, is arbitrary, as long as it separates groups of integer octet length. Therefore, all the following notations represent the same address: + +49.0001.1234.5678.3333.00 4900.0112.3456.7833.3300 49.00.01.12.34.56.78.33.33.00 49000112.34.5678.33.3300 49000112345678333300 +Whenever any of these NSAP addresses is configured on a Cisco router, it rewrites the address into the notation used in the first line. + +An NSAP address is often easier to read from right to left. In the NSAP address 49.0001.1234.5678.3333.00, the rightmost octet is the SEL value (00), the following six octets are the System ID (1234.5678.3333), followed by other HO-DSP octets (0001), IDI (not present in this NSAP) and ending with the leftmost octet, the AFI (49). + +To visualize a network using NSAP addressing, consider the topology shown in Figure +10-2. + + + +49.0001.FFFF.0000.0001.00 + +R1 + + + + + +49.0001.1234.5678.3333.00 + +49.0001.90AB.CDEF.2222.00 + +49.0001.0000.0000.1111.00 + +49.0001.FFFF.0000.0002.00 + +R2 + + + + + +49.0001.DEAD.BEEF.4444.00 + + +49.0001.600D.CAFE.5555.00 + + +Figure 10-2 Network with NSAP Addressing + +Addressing in Figure 10-2 again uses the local NSAP space, indicated by the AFI value of 49. For better readability, the System ID portion of the NSAP address has been under-lined in the figure. Note that all nodes in the network are in the same area, 0001. Each node has a unique System ID. As there is no concept of a subnet, routing between the two networks is accomplished by each IS assembling a list of all attached ES nodes and advertising it to its neighbors. +576 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Individual interfaces are not assigned their own addresses at the network layer. However, their Layer 2 addresses are used in the same way as TCP/IP networks use them: When a packet is routed, it is encapsulated into a frame addressed to the next directly attached hop identified by its Layer 2 address. In OSI networks, a Layer 2 address of an interface is called a Sub Network Point of Attachment (SNPA). + +Finally, for purposes of distinguishing between interfaces of the same node, an IS enu-merates its interfaces by a locally significant 1-octet number called the Local Circuit ID, which increments by 1 with every interface added to the IS-IS instance beginning with 0 on Cisco routers. + +Levels of Routing in OSI Networks + +Routing in OSI networks has a concept of hierarchies, or levels, depending on the net-work scope in which the routing is performed. Four levels of routing are defined: + + +■ +Key Topic + +■ + +■ + +■ + +Level 0 routing: Routing between two ES nodes on the same link, or between an ES node and its nearest IS + +Level 1 routing: Routing between ES nodes in a single area of a domain + +Level 2 routing: Routing between ES nodes in different areas of a domain + +Level 3 routing: Routing between ES nodes in different domains + + +Level 0 routing is concerned with the way that an ES (end node) discovers its nearest IS (gateway), and conversely, how an IS knows which ES nodes are connected to it. This is accomplished by both ES and IS sending a periodic Hello message advertising their exis-tence. Aptly named, Hellos sent by ES nodes are called ES Hello (ESH), while Hellos sent by IS nodes are called IS Hello (ISH). Level 0 routing is also referred to as ES-IS routing (the ES-IS protocol is covered in publicly available standard ISO 9542). In IPv6-based networks, Level 0 routing is vaguely similar to routers sending Router Advertisement messages, allowing stations to detect their presence, and hosts sending Neighbor Advertisements, although the Neighbor Advertisements are not sent periodically. + +Level 1 routing is concerned with intra-area routing, that is, routing between ES nodes that are members of the same area. An area is understood in the usual meaning: It is an administrative partitioning of a domain, and in terms of link-state routing, IS nodes in an area will have a detailed and complete visibility of the entire area’s topology. On Level 1, IS nodes collect lists of all ES nodes directly attached to them, and advertise these lists to each other to learn the placement of all ES nodes. + +Level 2 routing is concerned with inter-area routing within the same domain, that is, rout-ing between ES nodes that reside in different areas of the same domain. On Level 2, IS nodes do not advertise the list of connected ES nodes anymore. Instead, in this level, IS nodes exchange area prefixes to learn how to reach particular areas. If a Level 1 IS deter-mines that the packet’s destination ES is in a different area, it will forward the packet toward the nearest IS capable of Level 2 routing, regardless of the destination area. The packet will then be forwarded by Level 2–capable IS nodes until it reaches the area with +Chapter 10: IS-IS 577 + +the destination ES where it will again be forwarded by Level 1 IS nodes. Hence, Level 1 routing can be described as routing by System ID, while Level 2 routing can be described as routing by area prefix. Level 2 routing constitutes the backbone of a domain, providing communication between individual areas of the domain. Level 1 and Level 2 routing are provided by the IS-IS routing protocol (ISO 10589), which is the focus of this chapter. + +Level 3 routing is concerned with interdomain routing. In a TCP/IP world, this is a fairly direct analogy of inter-autonomous system routing provided by Border Gateway Protocol (BGP). In OSI networks, the original intended routing protocol was Inter Domain Routing Protocol (IDRP, ISO 10747). However, with BGP being a multiprotocol interdomain rout-ing protocol also capable of carrying information about NSAP addresses, today’s OSI networks are replacing IDRP with BGP. + +IS-IS provides Level 1 and Level 2 routing. Level 0 and Level 3 routing are provided by different mechanisms and are not relevant for TCP/IP networks. + +IS-IS Metrics, Levels, and Adjacencies + +IS-IS metrics are assigned to individual interfaces (links). The original IS-IS specification defines four types of metrics: + + +■ +Key Topic + +■ + +■ + +■ + +Default: Required to be supported by all IS-IS implementations; usually relates to the bandwidth of the link (higher value represents a slower link) + +Delay: Relates to the transit delay on the link + +Expense: Relates to the monetary cost of carrying data through the link + +Error: Relates to the residual bit error rate of the link + + + + + + + + + + + + + + + +Key Topic + +Each of these metrics is intended to be evaluated independently in the SPF calculation, effectively resulting in four independent shortest-path trees (and thus routing tables), each one computed according to a particular metric. Most IS-IS implementations today support only the default metric. + +Cisco IS-IS implementation assigns all interfaces the default metric of 10, regardless of their bandwidth. Contrary to OSPF implementation, Cisco IOS does not automatically recalculate an interface’s bandwidth into its IS-IS metric. It is up to the administrator to configure different interface metrics if necessary using the isis metric metric [ level ] per-interface command. Other types of metrics can be configured but are advertised as unsupported in IS-IS advertisements. + +The original IS-IS specification and RFC 1195 define any single interface (link) and attached network metric to be 6 bits wide, resulting in the range of 1–63, and the com-plete path metric as 10 bits wide in the range of 1–1023. At the time IS-IS was defined, these metric widths were considered adequate. Today’s requirements, however, call for a much wider range of metrics. Therefore, in RFC 3784 (now RFC 5305), so-called wide metrics were introduced, allowing for a 24-bit width for the interface metric and a 32-bit width for the entire path metric. The same RFC also defines a set of information elements +augmenting the wide metrics for use in MPLS Traffic Engineering applications. The +578 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +original metrics were retroactively named narrow metrics. It is strongly recommended to use wide metrics whenever available and supported; however, all routers in an area must use the same type of metrics. + +IS-IS routers operate on each routing level independently. For each routing level, be it Level 1 or Level 2, an IS-IS router establishes separate adjacencies with its neighbors running on the same level, and maintains a separate link-state database. A router config-ured for Level 1 routing establishes adjacencies only with those neighbors that are also configured for Level 1 routing. Similarly, a router configured for Level 2 routing creates adjacencies only with neighbors also configured for Level 2 routing. A Level 1–only router will not establish an adjacency to a Level 2–only router. Two neighboring routers configured for both Level 1 and Level 2 routing will create two independent adjacencies, one for each level. In addition, as each router belongs to a single area (recall that only +a single NET is usually configured on a router, and the NET carries the area identifier), Level 1 adjacencies are created only between routers with the same area identifier. Table 10-3 documents the resulting adjacency for different combinations of neighboring rout-ers’ levels. + +Table 10-3 Adjacencies Between Routers Key +Topic 1st Neighbor’s Level 2nd Neighbor’s Level Resulting Adjacency + + +Level 1 only + +Level 1 only + +Level 1 only + +Level 1 + 2 + + +Level 1 + 2 + +Level 2 only + +Level 1 only + +Level 1 + 2 + +Level 2 only + +Level 1 + 2 + + +Level 2 only + +Level 2 only + +Level 1 if area matches + +Level 1 if area matches + +No adjacency + +Level 1 if area matches + +Level 2 + +Level 2 + +Level 2 + + + +IS-IS routers maintain a separate link-state database for each routing level they operate on. For each enabled level, a router originates and floods a Link State PDU (LSP; not to be confused with Label Switched Path, which is an unrelated term from MPLS using the same acronym). An LSP is similar to an OSPF Link State Update packet with one or more Link State Advertisements. IS-IS routers use Level 1 and Level 2 LSPs to describe their adjacencies on that particular level. As a result, a Level 1 link-state database contains only Level 1 LSPs describing only Level 1 adjacencies of their respective originating routers. Similarly, a Level 2 link-state database contains only Level 2 LSPs describing only Level +2 adjacencies of their originating routers. Contents of a Level 1 link-state database are exchanged only over Level 1 adjacencies, and Level 2 link-state database contents are exchanged over Level 2 adjacencies only. Illustratively, albeit slightly imprecisely, IS-IS can be thought as running a separate instance (or a process) on each routing level. While individual LSPs never leak between Level 1 and Level 2 databases, routing information +Chapter 10: IS-IS 579 + +computed using a particular link-state database can be injected in a very controlled way into the other database. Rules of doing that will be discussed further in the chapter. + +IS-IS Packet Types + +IS-IS defines four basic types of packets: + +■ Hello packet + +■ Link State PDU + +■ Complete Sequence Numbers PDU + +■ Partial Sequence Numbers PDU + +To ease the understanding, we will often be comparing IS-IS packet types to OSPF packet types, drawing on their similarities and differences, assuming that the reader is already well-acquainted with OSPF packets, their purpose, and contents. However, OSPF and +IS-IS have been developed independently, and any comparisons here are used only to highlight similarities and differences, and should not suggest in any way that one proto-col tries to mimic, more or less successfully, the other. + + +Hello Packets + + + +Key Topic + +Hello packets, also denoted as IIH (IS-IS Hello), are used to perform the usual task of detecting neighboring routers (and also their loss), verifying bidirectional visibility, establishing and maintaining adjacencies, and electing a Designated IS (DIS—similar to a Designated Router in OSPF). On broadcast-type interfaces, IS-IS routers use separate Hello packet types for L1 and L2 adjacencies. On point-to-point type interfaces, for efficiency reasons, a single L1L2 Hello, also called a point-to-point Hello, is used. Each +router sends Hello packets every 10 seconds by default; the interval can be configured in the range of 1 to 65535 seconds using a per-interface isis hello-interval seconds [ level ] command for a particular routing level. Instead of defining a Hold timer directly, a Hello multiplier value is used to compute the Hold time as the Hello value multiplied by the Hello multiplier value. The default Hello multiplier value is 3, resulting in a Hold time of 30 seconds. The multiplier value can be changed by a per-interface isis hello-multiplier multiplier [ level ] command. As opposed to OSPF, timers do not need to match on neighboring routers. + +On a DIS, the individual timers are always one-third of the configured timers (with default settings)—a DIS sends Hellos every 10/3=3.333 seconds, and the Hold interval is 30/3=10 seconds. With settings changed to a Hello time of 6 seconds and a Hello mul-tiplier of 4, for example, a DIS would then send Hello packets every 6/3=2 seconds, and advertise a Hold interval of 24/3=8 seconds. This is done to detect a DIS or its outage +more readily. +580 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Note There are three types of Hello: Level 1 Hello, Level 2 Hello (both used on broad-cast networks), and L1L2 Hello (used on point-to-point interfaces). Hellos are sent every 10 seconds by default. The hold time is 30 seconds by default, and is computed using the Hello timer and Hello multiplier value as Hello time ´ Hello multiplier. On a DIS, timers are always set to one-third of the configured values. Timers do not need to match between routers. + + + +Link State PDUs + + + + + + + + + + + + + + +Key Topic + +A Link State Protocol Data Unit (LSP) is used to advertise the routing information. An LSP is vaguely similar to an OSPF Link State Update packet containing one or more Link State Advertisements. There are, however, notable differences between OSPF LSU/LSA and IS-IS LSP. + +In OSPF, the smallest standalone element of the link-state database is an LSA (note that LSA is not a packet itself). There are several types of LSAs in OSPF, each one of which describes a different type of a network object. In IS-IS, the smallest standalone ele-ment of the link-state database is an entire LSP. There are no different types of LSPs to +describe different network objects; instead, these are described by distinct Type-Length-Value (TLV) records inside an LSP’s variably sized payload. + +Similar to OSPF LSAs that are uniquely identified by their type and Link-State ID, IS-IS +LSPs are also uniquely identified by a number that consists of three parts: + + +■ System ID of the router that originated this LSP (6 octets; taken from the router’s NET address) + +■ Pseudonode ID that differentiates between the LSP describing the router itself and the LSPs for multiaccess networks in which the router is a Designated IS (1 octet) + +■ LSP Number denoting the fragment number of this LSP (1 octet). The LSP Number is also called simply the Fragment Number or Fragment for short. + + + + + + + + +Key Topic + +We will denote this triplet of System ID + Pseudonode ID + LSP Number as LSPID. For LSPs that describe routers themselves, the Pseudonode ID is always set to 0. The meaning of Pseudonode LSP and Pseudonode IDs will be explained later in the chapter. For each routing level, a router originates a standalone LSP, that is, separate LSPs are originated for Level 1 and for Level 2, depending on what levels the router operates at. + +To distinguish between various versions of the same LSP, each LSP has a sequence num-ber—a 32-bit unsigned integer starting at 0x00000001 and ending at 0xFFFFFFFF. Each modification to an LSP is accompanied by incrementing its sequence number. If two LSPs with the same LSPID have a different sequence number, the LSP with the higher sequence number is more recent. This is similar to LSA sequence numbers in OSPF, although LSA sequence numbers start at 0x80000001 (–231+1) and end at 0x7FFFFFFF (231–1). In con-trast to OSPF, which is able to handle the wrapover of the sequence number gracefully, +IS-IS has no such facility. If the sequence number of an LSP reaches the maximum value, +Chapter 10: IS-IS 581 + + + + + + + + + +Key Topic + + + + + + + + + + +Key Topic + +the originating router must be turned off for enough time to allow the LSP to expire, or its System ID must be changed. While this might sound like a serious flaw, even if a new version of an LSP was originated every second, it would take more than 136 years to reach the maximum sequence number—clearly a time that is beyond any reasonable router lifespan. IS-IS implementations also throttle down the LSP origination to avoid rapid increases of the sequence number. + +Each LSP has a Remaining Lifetime value associated with it. When originated, the Remaining Lifetime is set to 1200 seconds (20 minutes), and is decreased. IS-IS rout-ers refresh their self-originated LSPs every 15 minutes. If the LSP’s Remaining Lifetime decreases to 0, the router will delete the LSP’s body from the link-state database, keep only its header, and advertise the empty LSP with the Remaining Lifetime set to 0. Flooding an empty LSP with the Remaining Lifetime set to 0 is called an LSP purge . +Router purging an LSP will not flush the LSP from its link-state database just yet, though. The expired LSP can be purged from the link-state database after an additional time called ZeroAgeLifetime set to 60 seconds. This is done to ensure that the LSP’s header is retained until the purged LSP has been safely propagated to all neighbors. Cisco routers, however, appear to hold the empty LSP header for another 20 minutes. + +Because IS-IS messages are encapsulated directly into Layer 2 frames whose maximum payload size—the Maximum Transmission Unit (MTU)—is limited, IS-IS must implement its own fragmentation functions for LSPs whose size exceeds the MTU. This fragmenta-tion is accomplished in a relatively straightforward way. Each LSP consists of a fixed-size header and a variable-size body that contains one or more TLV records that carry the actual addressing and topological information. If putting all TLV records into a single LSP would cause it to exceed the MTU, the router will simply create multiple LSPs. Each of them will carry a particular subset of the TLV records to be advertised so that the MTU is not exceeded. These LSPs are identified with the same System and Pseudonode ID, and with an increasing LSP Number as the fragment number, starting from 0. An important fact is that this fragmentation is performed only by the router that originates the LSP. After the LSP is flooded, it must not be modified by any other router, and also not be defragmented and/or refragmented. A consequence of this rule is that across the entire flooding scope of the LSP (an area for a Level 1 LSP, or all Level 2 routers and their inter-connections for a Level 2 LSP), the MTU on interfaces must be identical. If this require-ment cannot be met, IS-IS routers must be manually configured to keep each LSP not bigger than the smallest MTU. + +To illustrate the facts about LSPs, consider the topology shown in Figure 10-3. + + +49.0001.0000.0000.0001.00 49.0001.0000.0000.0002.00 + + +192.168.0.0/24 192.168.0.0/24 +… R1 +192.168.255.0 + + +10.0.12.0/24 172.16.2.0/24 +R2 + + + +Figure 10-3 Sample Network Requiring LSP Fragmentation +582 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Two routers, R1 and R2, are interconnected by a serial point-to-point link. R1 is connect-ed to 256 different LANs, and R2 is connected to a single LAN. Example 10-1 shows and explains the output of several show commands on R1. + +Example 10-1 Link-State Database Contents and LSPs on R1 +Key +Topic ! The show isis hostname on R1 displays the numerical System ID and the related +! hostname of the router with that ID. This mapping of hostnames to their +! System IDs is carried in LSPs along with addressing and adjacency information. + +R1# show isis hostname +Level System ID Dynamic Hostname (notag) +* 0000.0000.0001 R1 +1 0000.0000.0002 R2 + +! The show isis database shows the contents of the link-state database. +! Because both routers have been configured as Level 1 routers, only a single +! database for Level 1 is displayed. Notice that in the output, the router +! automatically substitutes the numerical System ID for the router's hostname +! to make the output easily readable. + +R1# show isis database + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 +R1.00-01 +R1.00-02 +R2.00-00 + +LSP Seq Num +* 0x00000002 +* 0x00000002 +* 0x00000003 +0x00000003 + +LSP Checksum +0x4BD3 +0xF403 +0xF86B +0x449C + +LSP Holdtime +676 +708 +643 +574 + +ATT/P/OL +0/0/0 +0/0/0 +0/0/0 +0/0/0 + + +! According to the output above, there are four LSPs in R1's link-state database, +! three originated by R1 and carrying information about R1, the other originated +! by R2. Each LSP is identified by the triplet SystemID.PseudonodeID-Fragment +! in the LSPID column. Also notice the sequence number and holdtime of each LSP. +! For LSPs that describe routers, the Pseudonode ID is always 0. Because R1 has +! a high number of directly connected networks to advertise, it needs to create +! three fragments of its LSP. On R2, all information it needs to advertise about +! itself fits into a single LSP. Entries in the show isis database output marked +! with the asterisk sign are the LSPs the router has originated itself. + +! To see the LSP contents, we will check the show isis database detail output. +! R1's LSPs will be significantly abbreviated. Note the individual entries +! contained in LSPs: Information about the area the router is in, Network Layer +! Protocol ID field specifying the list of supported Layer3 protocols, Hostname, +! Router management IP address, directly connected IP networks, and neighboring IS +Chapter 10: IS-IS 583 + +R1# show isis database detail + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 + +LSP Seq Num +* 0x00000003 + +LSP Checksum +0x49D4 + +LSP Holdtime +957 + +ATT/P/OL +0/0/0 + +Area Address: 49.0001 + +NLPID: +Hostname: R1 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +192.168.0.1 +IP 10.0.12.0 255.255.255.0 +IP 192.168.0.0 255.255.255.0 +IP 192.168.1.0 255.255.255.0 + + + + +Metric: 10 +Metric: 10 + + +IP 192.168.116.0 255.255.255.0 +IP 192.168.117.0 255.255.255.0 + +R1.00-01 * 0x00000003 0xF204 950 0/0/0 + +Metric: 10 +Metric: 10 + +Metric: 10 +Metric: 10 + +IP 192.168.118.0 255.255.255.0 +IP 192.168.119.0 255.255.255.0 + +IP 192.168.236.0 255.255.255.0 +IP 192.168.237.0 255.255.255.0 + +R1.00-02 * 0x00000004 0xF66C 872 0/0/0 + +Metric: 10 +Metric: 10 + +Metric: 10 +Metric: 10 +Metric: 10 + +IP 192.168.238.0 255.255.255.0 +IP 192.168.239.0 255.255.255.0 + +IP 192.168.254.0 255.255.255.0 +IP 192.168.255.0 255.255.255.0 +IS R2.00 + +R2.00-00 0x00000004 0x429D 872 0/0/0 +Area Address: 49.0001 + +NLPID: +Hostname: R2 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +172.16.2.1 +IP 10.0.12.0 255.255.255.0 +IP 172.16.2.0 255.255.255.0 +IS R1.00 + + + +! Note the straightforward readability of the LSPs. A directly connected network +! is marked by an "IP" label. A neighboring router is marked by an "IS" label +! and identified by its System ID and Pseudonode ID. All metrics default to 10. +584 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +In OSPF, a router originates possibly numerous LSAs of different types: + +■ One type 1 LSA describing the router itself + +■ One type 2 LSA for each multiaccess network in which this router is a designated router (DR) + +■ One type 3 LSA for each inter-area prefix + +■ One type 4 LSA for each autonomous system boundary router (ASBR) located in a different area if this router is an area border router (ABR) + +■ One type 5 or type 7 LSA for each redistributed network if the router is an ASBR + +Each of these LSA instances has its type, unique ID, sequence number, and age, and must be uniquely identified, flooded, acknowledged, refreshed, aged, and flushed. In IS-IS, a router on a particular routing level generates only a single (although possibly fragmented) LSP containing all relevant information related to that router in one place: + +■ Adjacencies to neighboring routers or networks (similar to type 1 LSAs) + +■ Intra-area and inter-area prefixes (similar to prefix information collected from type 1, 2, and 3 LSAs) + +■ External prefixes (similar to type 5/7 LSAs) + +Type 4 LSA is not mentioned here, as there is no similar type of information present in IS-IS LSPs. + +Regarding type 2 LSA, in OSPF, this LSA carries two vital pieces of information: + +■ The address and netmask of a multiaccess network (address information) + +■ A list of connected routers to this network (topological information) + +In IS-IS, the address information about all networks, both point-to-point and multiaccess, is contained in the LSP of each router connected to that network. The topological infor-mation about the network itself and the list of connected routers are contained in a so-called Pseudonode LSP generated by the DIS on the multiaccess network. An IS-IS router on a particular routing level therefore generates one LSP describing itself and all relevant topological information, plus one more Pseudonode LSP for each network it is a DIS in. Behavior of IS-IS on broadcast networks will be described in further detail in the section “IS-IS Operation over Broadcast Links,” later in this chapter. + +An LSP has a unique identifier as a whole, and can only be flooded, requested, acknowl-edged, refreshed, aged, and flushed as a whole. Therefore, with any topological or addressing change, affected routers regenerate their entire LSPs and flood them. While the reorigination and flooding of an entire LSP, even if only one TLV record needs to +be changed, can be perceived as inefficient, the maintenance of the link-state database is significantly more simple: While in OSPF, each router needs to age and refresh each +LSA it has originated (possibly many), each IS-IS router originates only a single LSP (plus Pseudonode LSPs if it is a DIS), and has therefore only a single or a few self-originated +Chapter 10: IS-IS 585 + +LSPs to age and refresh. This saving is especially visible on inter-area and external prefix information, for which there can be hundreds or thousands of LSAs, one for each prefix. Additionally, the link-state database in IS-IS is more compact, as instead of individual LSAs, all information is grouped into LSPs. + +Another difference between LSUs/LSAs and LSPs concerns their internal format with particular regard to extensibility. In OSPF, individual LSA types are strongly optimized toward the particular type of information they carry. That allows for efficient memory usage and their optimized processing. At the same time, however, it complicates adding new types of information, such as new address families, into existing LSA types. One of the reasons for the creation of OSPFv3, a new version of OSPF for IPv6, was the inabil-ity to carry IPv6 information in any of the basic OSPFv2 LSA types. While new types of information can be advertised using OSPFv2 Opaque LSAs (type 9, 10, and 11), an OSPFv2 router must nonetheless advertise its capability to store and forward Opaque LSAs to be sent these LSAs. OSPFv3 has been made more flexible in this aspect, as a +router accepts even those LSAs whose type is unknown for possible further flooding. On the other hand, IS-IS encodes all topological and addressing information in Type-Length-Value records (the specification of IS-IS uses the term Code instead of Type). While slightly less efficient in terms of memory and processing, this approach allows extensi-bility from day zero: A router will process those TLV records it recognizes and ignore +the records it does not support. The inclusion of the Length field allows a router to skip those records whose Type (and thus its content size) is not recognized. + + +Note LSP packets are used to carry topological and addressing information in IS-IS. An LSP describes its originator, its adjacencies to neighboring network objects, and related addressing. Each LSP is uniquely identified by the SystemID.PseudonodeID-LSPNumber. Each LSP has a sequence number, starting at 0x00000001 and ending at 0xFFFFFFFF. The lifespan of an LSP is limited by its Remaining Lifetime timer set to 1200 seconds +and decreasing. After this timer expires, a router is required to wait at least another ZeroAgeLifetime (60 seconds) before flushing the LSP. LSPs are refreshed by default every 900 seconds. Separate LSPs are originated for Level 1 and Level 2. + + + +Complete and Partial Sequence Numbers PDUs + + + + + + + + +Key Topic + +Complete Sequence Numbers PDU (CSNP) and Partial Sequence Numbers PDU (PSNP) packets are used to synchronize link-state databases. The sequence numbers term in names of these messages refers to the range of LSPID values, that is, about a set of LSPs these packets carry information about, and has no relation to the sequence numbers in individual LSP packets. + +CSNP packets are very similar in their function to OSPF Database Description Packets. The purpose of CSNP packets is to advertise a complete list of LSPs in the sender’s link-state database. Receivers of CSNP packets can compare their link-state database contents to the list of LSPs in the CSNP and perform appropriate action—flood a newer or miss- +ing LSP if they have one, or request an LSP if they find it missing in their own database. +586 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + + + + + + + + + + + + + + + + + + +Key Topic + +If the sender’s link-state database contains so many LSPs that listing them all in a single CSNP packet would cause it to exceed the MTU, multiple CSNPs are sent. For this purpose, the individual LSPIDs to be advertised are first sorted as integer numbers in ascending order. Each CSNP contains information about the Start LSPID and End LSPID that is described by this CSNP. The full range of possible LSPIDs starts with the value of 0000.0000.0000.00-00 (the bold part is the System ID, the following octet is the Pseudonode ID, and the octet following the dash is the LSP Number ID), and ends with the value of FFFF.FFFF.FFFF.FF-FF. If all LSPs can be listed in a single CSNP, the Start and End LSPIDs will use these respective values. If it is necessary to send more CSNPs, the first CSNP will have the 0000.0000.0000.00-00 as the Start LSPID, and the End LSPID will be set to the LSPID of the last entry in this CSNP. In the following CSNPs, the Start and End LSPIDs will be set to the respective LSPIDs of the first and last entry, sorted in ascending order. The last CSNP will have the value of FFFF.FFFF.FFFF .FF-FF as the End LSPID. This sorting of LSPIDs into ascending number and CSNPs sequen-tially listing all LSPIDs from the allowable range are the reasons for calling these PDUs Sequence Numbers PDUs. Note that CSNPs list only LSPIDs, but they do not contain LSP bodies. + +On point-to-point links, CSNP packets are exchanged usually only during initial adja-cency buildup; on broadcast networks, CSNP packets are originated periodically by the DIS. + +PSNP packets are functionally similar to OSPF Link State Request and Link State Acknowledgment packets. Using PSNP, a router can either request a particular LSP or acknowledge its arrival. A single PSNP can request or acknowledge multiple LSPs. As a PSNP is intended to request or acknowledge individual LSPs by their LSPIDs, there are no Start or End LSPID fields present in PSNPs. As we will learn later, PSNP on point-to-point links are used both to request an LSP and acknowledge it. On broadcast networks, PSNP packets are used only to request an LSP. Acknowledgments on broadcast networks +are accomplished by CSNP messages sent by Designated ISs. + + + +Note CSNP and PSNP packets are used to facilitate link-state database synchronization. CSNP packets contain a list of all LSPs in a sender’s link-state database, allowing the recipi-ent to compare this list to the index of its own link-state database. PSNP packets are used to request an LSP or acknowledge its successful arrival. + + + +IS-IS Operation over Different Network Types + +Contrary to OSPF, which recognizes several network types, IS-IS natively supports only broadcast and point-to-point network types. Running IS-IS over Ethernet networks, as well as over HDLC, PPP, GRE tunnels, and point-to-point Frame Relay or ATM subinter-faces, works right out of the box. However, IS-IS has no special provisions to correctly operate over partially meshed data link layer technologies such as hub-and-spoke Frame Relay. Running IS-IS over such networks can result in partial visibility and incomplete routing tables. Recommended practice dictates that you configure such networks using point-to-point subinterfaces and run IS-IS over these point-to-point links. +Chapter 10: IS-IS 587 + +It is noteworthy to mention that what IS-IS calls broadcast links should much better be called multiaccess links. The reason is that IS-IS is not really concerned about the capa-bility of the data link layer technology to replicate broadcasts and multicasts but rather to create a communication environment in which multiple neighbors can be reached over the same interface, and each router can talk to each other router on the link. While we will adhere to the terminology specified in the IS-IS standard by using the term broadcast , the true meaning is more relevant to the term multiaccess . + +IS-IS is much simpler in terms of adjacency states than OSPF with its eight states. In IS-IS, there are only three possible adjacency states: + + +■ +Key +Topic ■ + + +■ + +Down: The initial state. No IIHs have been received from the neighbor. + +Initializing: IIHs have been received from the neighbor, but it is not certain that the neighbor is properly receiving this router’s IIHs. + +Up: IIHs have been received from the neighbor, and it is certain that the neighbor is +properly receiving this router’s IIHs. + + +The way of verifying whether the two adjacent routers can hear each other differs on point-to-point and broadcast links. Also, the synchronization and flooding procedure is different on these two network types. The sections that follow examine these behaviors more closely. + +IS-IS Operation over Point-to-Point Links + +On point-to-point interfaces, IS-IS expects to detect a single neighbor, bring up an adja-cency, and then synchronize link-state databases. + +The original IS-IS specification assumed that an adjacency could be brought up as soon as a point-to-point IIH was received from the neighbor. There was no verification of a bidirectional visibility between the two routers. This naïve approach led to problems if the point-to-point link was not capable of successfully carrying packets in both direc-tions between the same pair of routers and their interfaces. Therefore, in RFC 3373 (now RFC 5303), a three-way handshake method for IS-IS adjacencies over point-to-point links was defined, and this method has now been universally adopted by major IS-IS imple-mentors. + +Before exploring the three-way handshake in closer detail, first recall from the section about OSI addressing that each router assigns a locally significant single octet number to each interface, and this number is called the Local Circuit ID. Local Circuit IDs on point-to-point interfaces appear only in IIH packets and are only used for detection of a change in identity at the other end of a link. On a broadcast link, the Local Circuit ID is used as the Pseudonode ID if the router acts as a DIS on that interface. Hence, the Local +Circuit ID is required to be truly unique only for broadcast interfaces on which the router is a DIS, as this number is advertised in LSPs as the Pseudonode ID. Local Circuit IDs of broadcast and point-to-point interfaces do not clash; therefore, the same number can be reused both for broadcast and point-to-point interfaces. Example 10-2 shows how these IDs are displayed on point-to-point interfaces. Being a 1-octet quantity, it would appear +588 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +that the Local Circuit ID limits a router to at most 256 interfaces. To support more than 256 point-to-point interfaces, the three-way handshake also introduces an Extended Local Circuit ID that is 4 octets long. Similar to a Local Circuit ID, it is assigned auto-matically to all interfaces on a router, and is used exclusively in the three-way handshake procedure. + +Example 10-2 Local Circuit ID and Extended Local Circuit ID + +! The show clns interface on R2 displays vital information used by IS-IS +! in its operation. The clns keyword refers to Connection Less Network Services, +! the namespace in which CLNP would operate. The following output show Serial0/0/1 +! interface before activating the three-way handshake utilizing Extended Local +! Circuit ID. + +R2# show clns interface s0/0/1 +Serial0/0/1 is up, line protocol is up +Checksums enabled, MTU 1500, Encapsulation HDLC +ERPDUs enabled, min. interval 10 msec. +CLNS fast switching enabled +CLNS SSE switching disabled +DEC compatibility mode OFF for this interface +Next ESH/ISH in 32 seconds +Routing Protocol: IS-IS +Circuit Type: level-1-2 +Interface number 0x2, local circuit ID 0x101 +Neighbor System-ID: R1 +Level-1 Metric: 10, Priority: 64, Circuit ID: R2.01 +Level-1 IPv6 Metric: 10 +Number of active level-1 adjacencies: 1 +Next IS-IS Hello in 4 seconds +if state UP + +! The Local Circuit ID here is set to 0x101. While this number is actually wider +! than 1 octet, this is just Cisco's internal implementation that enumerates +! point-to-point interfaces with Local Circuit IDs starting with 256 (0x100) while +! broadcast interfaces are enumerated starting with 0x0. While on wire, only the +! least significant octet of the ID is advertised, thereby apparently reusing the +! same number for broadcast and point-to-point interfaces, this approach allows +! a router to keep unique internal IDs internally. + +! After activating the three-way handshake using isis three-way-handshake ietf +! command, the show clns interface also indicates the Extended Local Circuit ID: + +R2# show clns interface s0/0/1 +Serial0/0/1 is up, line protocol is up +Checksums enabled, MTU 1500, Encapsulation HDLC +ERPDUs enabled, min. interval 10 msec. +Chapter 10: IS-IS 589 + +CLNS fast switching enabled +CLNS SSE switching disabled +DEC compatibility mode OFF for this interface +Next ESH/ISH in 19 seconds +Routing Protocol: IS-IS +Circuit Type: level-1-2 +Interface number 0x2, local circuit ID 0x101 +Neighbor Extended Local Circuit ID: 0x0 +Neighbor System-ID: R1 +Level-1 Metric: 10, Priority: 64, Circuit ID: R2.01 +Level-1 IPv6 Metric: 10 +Number of active level-1 adjacencies: 1 +Next IS-IS Hello in 7 seconds +if state UP + +The three-way-handshake method is based on each router on a point-to-point link adver-tising an adjacency state TLV in its IIH packets that contains the following fields: + +■ Adjacency Three Way State: This is the state of adjacency as seen by the sending router. + +■ Extended Local Circuit ID: This is the ID of the sending router’s interface. + +■ Neighbor System ID: This value is set to the ID of the neighboring router whose IIHs have been successfully received. + +■ Neighbor Extended Local Circuit ID: This value is set to the Extended Local Circuit ID field value from the neighbor’s IIH packets. + +Early implementations of the three-way handshake included only the Adjacency Three Way State field in the adjacency state TLV, and omitted all other fields described here. The logic of the three-way handshake was very simple. Consider two routers, Router A and Router B, both assumed to have not received an IIH from each other yet, and both treating the adjacency to be in the Down state: + +Key 1. Topic + + +2. + + + + + +3. + + +If Router A receives an IIH from Router B with the Adjacency Three Way State set to Down, it is clear that Router A can hear Router B. It is not certain, though, whether Router B can hear Router A. Router A will start sending its IIH with the Adjacency Three Way State set to Initializing to tell Router B it can hear it. + +When Router B receives an IIH from Router A with the Adjacency Three Way State set to Initializing, it knows that these IIHs are effectively sent in response to its own IIH, and that Router A is in fact telling Router B it can hear it. Router B is now cer-tain that bidirectional communication is possible. Therefore, it starts sending its IIH with the Adjacency Three Way State set to Up. + +When Router A receives an IIH from Router B with the Adjacency Three Way State set to Up, it knows Router B can hear it. Router A is now also certain that bidirec-tional communication is possible and starts sending its IIH with the Adjacency Three +Way State set to Up, concluding the three-way handshake. +590 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +A slight variant of this sequence of steps would occur if both routers transmitted IIHs with the Adjacency Three Way State set to Down at the same time, both replied to each other with the State set to Initialize, and both arrived at the Up state simultaneously. + +This simple method is in fact the default three-way handshake method used by Cisco on point-to-point interfaces, and can be configured using the isis three-way-handshake cisco interface command. + +The simple approach is effective and works nicely in well-behaved cases; however, +there are a few types of network failures in which the simple mechanism falls short. For example, if the transmission is running over a Frame Relay or ATM virtual circuit, it is possible to reconfigure the virtual circuit to be switched toward a different neighbor than before, without the actual (sub)interface going down and up. Other physical and data +link layer technologies can exhibit the same behavior. Effectively, the change in the con-nectivity will go unnoticed if both routers continue to advertise that the adjacency state is Up. Another mode of failure is concerned with technologies in which the Rx and Tx directions are independent, such as in fiber technologies. In case of miswiring, it is pos-sible that the Tx fiber connects to a different router than the Rx fiber. In certain topolo-gies, this can lead to routers arriving to the Up state but sending packets to a different router than the one they hear the IIH from. Also, if a point-to-point link to a neighbor was moved from one of its interfaces to another, under certain circumstances, this change could go unnoticed. + +Therefore, the adjacency state TLV was augmented with the Extended Local Circuit ID, Neighbor System ID, and Neighbor Extended Local Circuit ID fields to carry additional information about the neighbor’s identity and interface. Their usage is fairly straightfor-ward. Again, consider Router A and Router B connected with a point-to-point link. If no IIH from Router B has been received yet, Router A will be sending its IIH with only the Extended Local Circuit ID present, set to Router A’s outgoing interface ID. The remaining Neighbor fields will not be present. When an IIH from Router B arrives and is accepted, Router A will put Router B’s System ID into the Neighbor System ID field, put Router +B’s Extended Local Circuit ID into the Neighbor Extended Local Circuit ID field, and continue sending IIHs to Router B using these values. Using this information, Router B can verify whether Router A indeed hears B on the link (by comparing the indicated +Neighbor System ID from the received IIH with its own System ID) and whether Router B can speak to Router A over the same interface it hears Router A on (by comparing the indicated Neighbor Extended Local Circuit ID from the received IIH with the ingress interface ID). + +With these fields in place, an IIH that carries a three-way adjacency state TLV is accepted only if one of the following conditions is met: + + +Key ■ Topic + + +■ + +The Neighbor System ID and Neighbor Extended Local Circuit ID are not present (typical at the beginning of the adjacency buildup, or the neighbor implements only the early version of the three-way handshake). + +The Neighbor System ID matches the receiving router’s System ID and the Neighbor +Extended Local Circuit ID matches the receiving interface’s ID. +Chapter 10: IS-IS 591 + + + + + + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + + + + + + + + +Key Topic + +If these conditions are not met, the incoming IIH is silently dropped. Hence, these rules form an IIH acceptance check (in fact, one of many in IS-IS). + +The operation of the three-way handshake with these additional fields is precisely the same as with the early implementation described previously—with the addition that every received IIH is subject to the acceptance check described previously. If the IIH does not pass the check, it is silently dropped, as if it never arrived. Therefore, the three-way handshake logic as described in the three previous steps changes simply by replacing all occurrences of “receives IIH” with “receives and accepts IIH.” + +This three-way handshake method can be configured using the isis three-way-handshake ietf interface command. It is noteworthy to mention that because the IETF three-way handshake method also accepts IIH packets with the adjacency TLV containing only the Adjacency Three Way State field without the other fields, it is also backward compat- +ible with the Cisco early implementation. Hence, each router on a point-to-point link can use a different method and still successfully negotiate the adjacency with its neighbor. Naturally, using the same method on both routers is preferred, and if both routers sup-port the IETF three-way handshake method, it should be used instead of the earlier implementation. + +After the adjacency is declared as Up, routers will attempt to synchronize their link-state databases. This is accomplished in a somewhat heavyweight way: Both routers will mark all their LSPs for flooding over the point-to-point link; plus they send CSNP packets +to each other. Because the IS-IS standard assumes that the actual transmission of LSPs marked for flooding is driven by a periodically scheduled process, it is possible that the CSNP packets are exchanged before the LSP transmission takes place. If a router learns from the received CSNP that its neighbor already has an LSP that is scheduled to be sent, the router will unmark the LSP, removing it from the set of LSPs to be flooded. This way, only the LSPs missing from the neighbor’s database will be sent to it. In addition, +if a router learns from the received CSNP that the neighbor has LSPs that are newer or unknown, it will request them using a PSNP packet. Note that neither of these is neces-sary, as both routers nonetheless initially set up all their LSPs to be flooded across the link, without the aid of CSNP or PSNP packets. The initial sending of CSNPs to com-pare the link-state databases and PSNPs to request missing or updated entries increases the resiliency of the synchronization process but is not strictly necessary: Without these packets, routers will simply exchange the full link-state database. + +Importantly, though, every LSP sent over a point-to-point link, whether during the ini-tial database synchronization or anytime later when it is updated or purged, must be acknowledged, and this is done using PSNP or CSNP packets. Because the IS-IS speci-fication says that CSNP packets are not periodically exchanged on point-to-point links, each sent LSP must be acknowledged by a corresponding PSNP from the neighbor. Interestingly, though, if the neighbor was also sending periodic CSNPs (which the IS-IS +specification does not explicitly prohibit!), they would be also accepted as valid acknowl-edgments. Some vendors implement periodic CSNPs even on point-to-point links to fur-ther increase the reliability of the flooding process. Cisco routers by default do not use +periodic CSNPs on point-to-point interfaces, but if required, they can be activated using +592 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +the isis csnp-interval interval [ level ] interface command with a nonzero interval value for a particular routing level. + +IS-IS Operation over Broadcast Links + +On broadcast links, IS-IS shares many traits with OSPF. The basic operation is similar: Routers must create adjacencies, synchronize their databases, and keep them synchro-nized. + +On Ethernet networks, IS-IS packets are encapsulated into IEEE 802.2 Logical Link Control (LLC) formatted frames with Destination Service Access Point (DSAP) and Source Service Access Point (SSAP) fields set to 0xFE. All Level 1 IS-IS packets are sent to the multicast MAC address 0180.c200.0014, while all Level 2 IS-IS packets use the 0180.c200.0015 as their destination MAC address. + +Detecting neighbors is again performed by IIH packets. In a fashion similar to OSPF, an IS-IS router lists the MAC addresses (or better said, SNPAs) of all neighboring routers it hears on a broadcast interface in its IIH packet sent through that interface. If a router receives an IIH from a neighbor and finds its own SNPA indicated in the IIH, it knows that the routers can see each other, and can move the adjacency to the Up state. If IIH +packets from a neighbor do not contain the receiving router’s SNPA, the adjacency is kept in the Initializing state. OSPF performs a similar operation, but it lists Router IDs of heard routers in its Hello packets. + +Similar to OSPF, which elects a designated router (DR) and a backup designated router (BDR) on each broadcast network, IS-IS also elects one Designated IS for each broadcast network. IS-IS has no concept of a backup DIS, and in fact, it does not need it, as we shall see later. A DIS is elected based on these criteria: + +Key ■ The router with the highest interface priority. Topic ■ In case of a tie, the router with the highest SNPA. + +■ In case the SNPAs are not comparable, the router with the highest System ID. This rule is used on Frame Relay and ATM physical interfaces and multipoint subinter-faces, which are treated as broadcast interfaces by IS-IS. On these interfaces, each router can see itself and a particular neighbor on the same virtual circuit (VC) identi-fied by the same Data Link Connection Identifier (DLCI) or Virtual Path Identifier/ Virtual Channel Identifier (VPI/VCI) (that is, this router’s and the neighbor’s SNPA appear to be the same), and in addition, there can be multiple VCs terminated under a single interface, so it is ambiguous which VC ID should be used as the SNPA. + +The interface priority is a number in the range of 0 to 127 configurable using a per-interface isis priority priority [ level ] command. The entire range is usable; no number in this range has a special meaning. 0 is a valid priority as well, and it does exclude a router from participating in DIS elections. In addition, DIS elections in IS-IS are preemp-tive: Whenever a router is connected that has a higher priority than the current DIS, or the same priority and higher SNPA (or in case the SNPA is not comparable as described before, the same priority and higher System ID), it will take over the DIS role. The DIS +Chapter 10: IS-IS 593 + +elections are effectively performed with each received IIH. Thus, the DIS role is not influ-enced by the order that routers were started or connected to a segment, and is determin-istic. + +As mentioned previously, two routers on a broadcast segment become adjacent as soon as it is verified that they can hear each other, and the adjacency state is put into the Up state. Note that in this process, there is no distinction whether any of these routers is the DIS. In other words, in IS-IS, all routers on a common broadcast segment become fully adjacent, regardless of which is the DIS. This is different from OSPF, in which only the DR and BDR become fully adjacent to all other routers on a broadcast segment. In IS-IS, every router can send an LSP on the broadcast link and all others are allowed to accept it. In OSPF, a DRother router can send an LSU/LSA only to the DR and BDR, and the DR will in turn forward it back to remaining routers on the segment, effectively working as +a relay. As the DIS is not doing any similar relaying, you might wonder—what it the pur-pose of DIS, then? + +A DIS is responsible for two important operations: + +■ Helping routers on a broadcast segment to synchronize + +■ Representing the broadcast segment in the link-state database as a standalone object—the Pseudonode + + + +Key Topic + +Synchronization of IS-IS routers on a broadcast network is surprisingly simple. The DIS creates and sends a CSNP packet in regular intervals (10 seconds by default) on the seg-ment. This CSNP packet lists all LSPs present in the DIS’s link-state database. Other rout-ers on the segment receive this CSNP and compare it to the index of their own link-state database. Possible results of this comparison are as follows (the term router here refers to +any other router on the segment that receives and processes a CSNP packet from DIS): + + +■ The router has an LSP with the same LSPID in its link-state database, with the same sequence number. No action needs to be performed; this is a confirmation that both the router and the DIS have the same LSP. + +■ The router does not have an LSP with the indicated LSPID in its link-state database, or the LSP’s sequence number on DIS is higher. The router needs to download the LSP from the DIS by creating a PSNP requesting the LSP in question and forwarding it onto the segment. The DIS will receive the PSNP and flood the requested LSP. + +■ The router has an LSP with the same LSPID in its link-state database but its sequence number on the DIS is lower, or the DIS does not advertise this LSPID. The router needs to update the DIS simply by flooding the LSP on the network right away. + + + +Key Topic + +Note the simplicity of this mechanism. The DIS is not a relay of LSPs; rather, it is a ref-erence point of comparison. If a router misses an LSP known by the DIS, or if the LSP is older than the one known by the DIS, the router will request the newer LSP through PSNP and the DIS will flood it. If the PSNP or the LSP gets lost during transmission, the process will simply repeat itself. Conversely, if a router knows about a newer LSP than the one known by the DIS, or if the DIS seems to miss it completely, the router will +simply flood the LSP onto the network. No explicit acknowledgment by the DIS is sent. +594 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +If the LSP has arrived, the DIS will advertise it in its next periodic CSNP, and this CSNP serves as an implicit acknowledgment. If the DIS does not advertise the LSP even after the router has flooded it, it must have been lost in transit, and the router will simply flood it again. If a router learns about a new LSP, it will flood it onto the segment, and will expect the DIS to advertise this LSP in its subsequent CSNPs (if not, it refloods the LSP). If another router on the segment did not receive this LSP, it will learn about it from CSNPs and will request it from the DIS. PSNPs are used on broadcast networks only +to request LSPs, not to acknowledge them. This way, full synchronization is achieved between all routers on a broadcast segment by a mechanism considerably simpler than in OSPF. + +Another responsibility of the DIS is to represent the broadcast network in the link-state database so that the topological model of the network is simpler. Consider Figure 10-4. + + +R1 + +R2 R6 + + + +Without +R1 R2 R3 Pseudonode + + +R3 R5 + +R4 + + +With +Pseudonode R1 + +R4 R5 R6 R2 R6 + +PSN + +R3 R5 + +R4 + +Figure 10-4 Use of Pseudonode in IS-IS + +Without a pseudonode, this network of six routers on a broadcast segment would be represented in the link-state database as the “dense” fully meshed topology on the upper right. Each of the six routers would need to create five entries in its LSP, point-ing toward each other router on the segment. The link-state database would, just for this single network, contain 6*5=30 links. Generally, with N routers on a single broadcast network, there would be N(N–1) links, their count growing quadratically with the num-ber of routers. That would cause an increased memory footprint and a possibly slower SPF computation.With a pseudonode, the broadcast network itself is represented as a node—more specifically, a pseudonode—in the topology, as shown in the lower right. The resulting topological model is much more simple and natural: Each router claims it +is connected to the broadcast network represented by the pseudonode (which it truly is), +Chapter 10: IS-IS 595 + + + + + + +Key Topic + +and the network also claims connectivity to every attached router. In this model, there are only 6*2=12 links (each router advertising a link to the network; the network advertising a link to each router). This is exactly what OSPF accomplishes with its LSA2. + +To exist as a pseudonode in a link-state database, a broadcast network must have its own LSP. It is the responsibility of the DIS to originate and flood the Pseudonode LSP on behalf of the broadcast network. Recall that each LSP is identified by a triplet of System ID, Pseudonode ID, and LSP Fragment Number. Also recall that an IS-IS router internally enumerates its interfaces using a 1-octet value called the Local Circuit ID. In case of rout-er LSPs, the System ID carries the ID of the router and the Pseudonode ID is set to 0. In case of network LSPs (that is, Pseudonode LSPs), the System ID is the ID of the DIS, and the Pseudonode ID is set to the Local Circuit ID of the DIS’s interface in the network. +Refer to Figure 10-5 and Example 10-3. + + + +49.0001.0000.0000.0001.00 + + +192.168.1.0/24 +R1 + +49.0001.0000.0000.0002.00 + + +192.168.2.0/24 +R2 + + + +Priority 100 + + + +Priority 40 + +Priority 64 10.0.0.0/24 + + +Priority 20 + + + +192.168.3.0/24 +R3 + +192.168.4.0/24 R4 + + +49.0001.0000.0000.0003.00 49.0001.0000.0000.0004.00 + +Figure 10-5 DIS Elections on a Broadcast Segment + +Example 10-3 DIS, Pseudonode LSP, and Its Contents +Key +Topic ! On R1, show isis hostname is used to check the mapping of hostnames to System IDs + +R1# show isis hostname +Level System ID Dynamic Hostname (notag) +* 0000.0000.0001 R1 +1 0000.0000.0002 R2 +1 0000.0000.0003 R3 +1 0000.0000.0004 R4 + +! To verify IS-IS neighbor adjacencies, show isis neighbors is useful + +R1# show isis neighbors +596 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +System Id Type Interface IP Address State Holdtime Circuit Id + +R4 L1 Fa0/0 +R3 L1 Fa0/0 +R2 L1 Fa0/0 + +10.0.0.4 +10.0.0.3 +10.0.0.2 + +UP 26 R1.02 +UP 29 R1.02 +UP 27 R1.02 + + +! Using show isis neighbors detail would also show information about each router's +! SNPA and configured priority. We omit the output for brevity purposes. + +! According to Figure 10-5, R1 has the highest configured priority using +! isis priority 100 command on its Fa0/0 interface, and so should become +! the DIS. This can be confirmed in the show clns interface fa0/0 output. +! Note the DR ID indeed says that it is R1. Also note that the Local Circuit ID +! is set to 0x2, and it becomes the Pseudonode ID + +R1# show clns interface fa0/0 +FastEthernet0/0 is up, line protocol is up +Checksums enabled, MTU 1497, Encapsulation SAP +ERPDUs enabled, min. interval 10 msec. +CLNS fast switching enabled +CLNS SSE switching disabled +DEC compatibility mode OFF for this interface +Next ESH/ISH in 7 seconds +Routing Protocol: IS-IS +Circuit Type: level-1-2 +Interface number 0x1, local circuit ID 0x2 +Level-1 Metric: 10, Priority: 100, Circuit ID: R1.02 +DR ID: R1.02 +Level-1 IPv6 Metric: 10 +Number of active level-1 adjacencies: 3 +Next IS-IS LAN Level-1 Hello in 1 seconds + +! The show isis database on R1 lists 5 LSPs – one for each router, plus one +! Pseudonode LSP that is recognizable by its Pseudonode ID being non-zero: +! it is R1.02-00. Notice that as explained earlier, its LSPID consists of +! System ID set to that of DIS, in this case, R1; Pseudonode ID set to the +! Local Circuit ID of DIS's interface, in this case, 0x2; and the Fragment 0. + +R1# show isis database + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 +R1.02-00 +R2.00-00 +R3.00-00 +R4.00-00 + +LSP Seq Num +* 0x00000003 +* 0x00000003 +0x00000002 +0x00000002 +0x00000002 + +LSP Checksum +0x1481 +0x67C9 +0x583A +0x9AF3 +0xDCAD + +LSP Holdtime +624 +729 +626 +678 +730 + +ATT/P/OL +0/0/0 +0/0/0 +0/0/0 +0/0/0 +0/0/0 +Chapter 10: IS-IS 597 + +! To see the contents of LSPs, show isis database detail is issued. +! Note that each router advertises the common network 10.0.0.0/24 in its LSP, +! and also, that each router advertises a connectivity to the common network +! by referencing only the Pseudonode LSP R1.02 as an "IS", and not each other's +! LSP. The Pseudonode LSP only contains the list of routers connected to the network. + +R1# show isis database detail + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 + +LSP Seq Num +* 0x00000003 + +LSP Checksum +0x1481 + +LSP Holdtime +527 + +ATT/P/OL +0/0/0 + +Area Address: 49.0001 + +NLPID: +Hostname: R1 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +192.168.1.1 +IP 10.0.0.0 255.255.255.0 +IP 192.168.1.0 255.255.255.0 +IS R1.02 + + + +R1.02-00 +Metric: 0 +Metric: 0 +Metric: 0 +Metric: 0 +R2.00-00 + +* 0x00000003 0x67C9 632 0/0/0 +IS R1.00 +IS R4.00 +IS R3.00 +IS R2.00 +0x00000002 0x583A 528 0/0/0 + +Area Address: 49.0001 + +NLPID: +Hostname: R2 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +192.168.2.1 +IP 10.0.0.0 255.255.255.0 +IP 192.168.2.0 255.255.255.0 +IS R1.02 + +R3.00-00 0x00000002 0x9AF3 580 0/0/0 +Area Address: 49.0001 + +NLPID: +Hostname: R3 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +192.168.3.1 +IP 10.0.0.0 255.255.255.0 +IP 192.168.3.0 255.255.255.0 +IS R1.02 + +R4.00-00 0x00000002 0xDCAD 631 0/0/0 +Area Address: 49.0001 + +NLPID: +Hostname: R4 +IP Address: + +0xCC + +192.168.4.1 +598 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Metric: 10 +Metric: 10 +Metric: 10 + +IP 10.0.0.0 255.255.255.0 +IP 192.168.4.0 255.255.255.0 +IS R1.02 + + +Finally, the router acting as a DIS shortens its own Hello and Hold time to just one-third of the configured values. This is done to allow other routers to detect its failure more rap-idly. If a DIS fails, another router will be elected in its place, but because there is no addi-tional adjacency buildup necessary (all routers on the segment are already fully adjacent), a DIS switchover is merely related to replacing the old Pseudonode LSP originated by the previous DIS with a new LSP from the newly elected DIS and remaining routers updating their LSPs to point toward the new Pseudonode LSP. Relative simplicity of this process is the reason why IS-IS does not have a concept of a backup DIS—it does not really need it. + +Areas in IS-IS + +The concept of routing levels in OSI networks is crucial to understanding inter-area rout-ing in IS-IS, so it is worth revisiting. + +Figure 10-6 shows the structure of an NSAP address, this time with added information about how IS-IS interprets it. Because only a single NSAP address is assigned to a node, and the NSAP address contains the domain and area identifier, the entire node with all its interfaces belongs only to a single area. + +IDP DSP + +AFI IDI HO-DSP System ID SEL + +Used by IS-IS as Area ID Node ID + +Figure 10-6 NSAP Address as Interpreted by IS-IS + +Because routers are also usually assigned a single NSAP address, they also belong to a single area only. It is in fact possible to configure up to three different NSAP addresses on an IS-IS router in a single IS-IS instance, provided that the System ID in all NSAP addresses is identical and the NSAP addresses differ only in their Area ID. A router with multiple NSAP addresses will nonetheless maintain only a single link-state database, caus-ing all configured areas to merge together. This behavior is useful when splitting, joining, or renumbering areas. For example, when you are renumbering an area, all routers are first added a second NSAP address with the new Area ID and then the old NSAP address is removed—without causing any adjacencies between routers to flap. Similarly, when you are joining two areas, routers in an annexed area are given the new NSAP with the same Area ID as the area into which they are being joined, and afterward, the old NSAP is removed. Splitting an area again uses a similar approach—first add the new NSAP address to all routers, and afterward, remove the former NSAP address. These changes can be done without disruptions to network operation, which is an obvious advantage. +Chapter 10: IS-IS 599 + + + + + + + + + + + + + + + + +Key Topic + + + + + + + + +Key Topic + +Multiple NSAP addresses on an IS-IS instance are nonetheless used only during network changes, and in stable operation, there should be only a single NSAP address configured per IS-IS process. Necessarily, area boundaries are then placed on links. It is important to mention that IS-IS uses the entire high-order part of the NSAP address up to the start of System ID as the area identifier, although it covers much more information. This is logi-cal, though: Nodes in a single area must obviously be addressed using the same NSAP format, the same initial domain identifier, and the same internal area number (high-order domain specific part). Any difference in these octets would signify that the addressing format is different (and hence incomparable to any other), or the domain (that is, the autonomous system) is different, or the internal area numbering differs. To provide the necessary isolation of information between areas, IS-IS routers maintain separate and independent Level 1 (L1 in short) and Level 2 (L2 in short) link-state databases, and do not allow LSPs from one database to ever leak into the other. + +L1 routing is a process of intra-area routing, that is, delivering packets between stations located in the same area. If OSI protocols such as CLNP were in use, routers would col-lect NSAP addresses of their directly attached end hosts and advertise them in their rout-ing updates simply as other adjacencies. With IP protocols, each L1 router advertises its directly connected IP networks in its L1 LSP. A very important fact is that two intercon-nected neighboring L1 routers configured with different areas will never establish an adja-cency. Compounded with the fact that L1 and L2 link-state databases do not leak LSPs to each other, these rules together make sure that L1 routers keep the intra-area information contained and never leak it to another area. + +L2 routing is a process of inter-area routing, that is, delivering packets between stations located in different areas. If OSI protocols were in use, routers would not collect nor advertise end host NSAP addresses. Instead, routers would only advertise their area IDs in their L2 LSPs. Because to reach an end host with a particular NSAP, the area described in the NSAP must first be reached; therefore, L2 routing in OSI networks would be con-cerned only with area IDs. L2 routers therefore form a backbone of a multiarea domain, and for this backbone to operate correctly, it must be contiguous and pervade all areas within the domain. Sometimes, the backbone as the set of L2 routers is also called an L2 subdomain. With IP protocols, IP addresses do not carry embedded area information like NSAP addresses. Therefore, the logic of populating L2 LSPs with IP networks is slightly different. Each L2 router advertises its directly connected IP networks to achieve contig-uous IP connectivity in the backbone, plus all other L1 routes from its own area with appropriate metrics, to advertise IP networks present in particular areas. Thus, while LSPs are never leaked between L1 and L2 link-state databases, on L2 routers, IP rout- +ing information computed from the router’s L1 link-state database is injected into its L2 LSP. In other words, IP routing information flows from L1 into L2. There is no opposite flow of routing information; that is, no IP networks are injected from L2 into L1 unless specifically configured. L2 routers establish adjacencies regardless of their areas. Thus, the entire L2 subdomain becomes aware of all IP networks in the domain, forming a true +backbone between areas. +600 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + + + + + + + + +Key Topic + +Areas in OSPF cannot be directly likened to IS-IS areas, because the visibility and behav-ior of IS-IS routers within an area depend on the routing level enabled on those routers. L1 routers in an area have no L2 link-state database and therefore have no information about other areas that is carried by L2 routers. From this viewpoint, L1 routers in an area have a visibility identical to routers in an OSPF Totally Stubby Area—they see their own area but nothing more. Yet, an L1 router can still perform redistribution from external sources, and these redistributed networks will be visible both in that area and uptaken by L2 routers into the backbone. Therefore, L1 routers in an area behave more as if they were in an OSPF Not So Stubby-Totally Stubby (NSSA-TS) area. + +L2 routers disrespect area boundaries when it comes to creating adjacencies and flooding link-state database contents. They create adjacencies with other L2 routers regardless of the area ID, and share all information present in their L2 link-state databases. Therefore, the entire L2 subdomain across all areas in the entire domain can be likened to a single OSPF backbone area. + +IS-IS on Cisco routers defaults to L1L2 operation, meaning that both L1 and L2 routing are enabled by default. + +Figure 10-7 presents an example network containing three areas. Each router emulates +a LAN on its loopback interface, using an address in the form 10...1/24; for example, R4 is located in area 49.0002, and its loopback is thus 10.2.4.1/24. Links between routers inside an area are addressed as 10...0/24; for example, a link between R6 and R7 in area 49.0003 is addressed using 10.3.67.0/24. Addresses +on inter-area links are shown in the figure. Importantly, Routers R2 – R3 – R4 – R6 are configured as L1L2 routers and form a contiguous backbone that crosses all areas in the domain. Note that because R5 is not an L2-enabled router, if the link between R3 and R4 failed, the backbone would become discontiguous. R5, even though physically intercon-necting R3 and R4, has no information from the L2 subdomain (the backbone), and is not capable of routing packets between different areas because it does not know about other +areas. + + + + +R5 + +10.12.23.0/24 10.23.46.0/24 + + +R3 49.0002 R4 10.2.0.0/16 +R2 R6 + + +49.0001 R1 10.1.0.0/16 + + +R2 – R3 – R4 – R6: L1L2 Routers R1, R5, R7: L1-Only Routers + +49.0003 10.3.0.0/16 R7 + + + +Figure 10-7 Multiarea Network Design +Chapter 10: IS-IS 601 + +Example 10-4 shows R1’s IS-IS link-state database and routing table. Note the default administrative distance of 115 for all IS-IS-learned routes. + +Example 10-4 R1’s Link-State Database in a Multiarea Network +Key +Topic ! Area 49.0001 contains two routers, R1 and R2. R1 is configured as L1-only router. +! On R1, show isis database displays only two L1 LSPs, one for each router. Also +! note that because R1 is limited to L1 operation, it does not maintain any L2 +! LSPs, either originated by itself or downloaded from R2. + +R1# show isis database + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 +R2.00-00 + +LSP Seq Num +* 0x00000020 +0x00000020 + +LSP Checksum +0x2207 +0xCC8A + +LSP Holdtime +841 +506 + +ATT/P/OL +0/0/0 +1/0/0 + + +! Notice that in the last column denoted ATT/P/OL, the ATT flag of R2 is set to 1. +! This means R2 is actively attached to backbone, and is therefore a prospective +! area border router to handle traffic destined to other areas. Details will +! be described later. + +! The show isis database detail shows us the contents of L1 LSPs. Note that each +! L1 LSP contains IP addresses of networks directly attached to the router that +! originated the LSP. In R2's LSP, the inter-area link is also advertised. + +R1# show isis database detail + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 + +LSP Seq Num +* 0x00000020 + +LSP Checksum +0x2207 + +LSP Holdtime +828 + +ATT/P/OL +0/0/0 + +Area Address: 49.0001 + +NLPID: +Hostname: R1 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +10.1.1.1 +IP 10.1.12.0 255.255.255.0 +IP 10.1.1.0 255.255.255.0 +IS R2.00 + +R2.00-00 0x00000020 0xCC8A 493 1/0/0 +Area Address: 49.0001 + +NLPID: +Hostname: R2 +IP Address: +Metric: 10 +Metric: 10 + +0xCC + +10.1.2.1 +IP 10.12.23.0 255.255.255.0 +IP 10.1.12.0 255.255.255.0 +602 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Metric: 10 +Metric: 10 + +IP 10.1.2.0 255.255.255.0 +IS R1.00 + + +! The routing table on R1 shows the usual list of directly connected networks, +! plus the list of other networks in area 49.0001, all listed as L1. Note that +! R1 installed a default route towards R2, though in R2's LSP, there is no +! explicit default route advertised. + +R1# show ip route +Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP +D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area +N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 +E1 - OSPF external type 1, E2 - OSPF external type 2 +i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 10.1.12.2 to network 0.0.0.0 + +10.0.0.0/24 is subnetted, 4 subnets +C 10.1.12.0 is directly connected, Serial0/0/0 +i L1 10.1.2.0 [115/20] via 10.1.12.2, Serial0/0/0 +C 10.1.1.0 is directly connected, Loopback0 +i L1 10.12.23.0 [115/20] via 10.1.12.2, Serial0/0/0 +i*L1 0.0.0.0/0 [115/10] via 10.1.12.2, Serial0/0/0 + + + + +Key Topic + +A couple of facts from this example deserve mention. We have not yet discussed the rightmost column in show isis database output, where three flags, ATT, P, and OL, are displayed. These flags are called ATTached, Partition repair, and Overload flags. The ATT flag is especially relevant to inter-area routing. When an L1L2 router performs its L2 SPF calculation and determines that it can reach other areas besides its own (note that LSPs also carry the area ID of their originating routers), it sets the ATT flag in its L1 LSP, effec-tively saying “I have a working attachment to other areas, so I can do inter-area routing.” L1-only routers in the area can use any router whose ATT bit is set in its L1 LSP to reach other areas. Because no IP addressing information flows down from L2 into L1, L1-only routers have no knowledge about prefixes in other areas. Reaching them can therefore be accomplished by means of a default route, and this is exactly what L1-only routers do: They automatically install a default route toward their nearest L1L2 router whose ATT bit is set into their routing table. Note in Example 10-4, R1 installed a default route toward R2, although L2 does not advertise such a route in its LSP. What R1 did was to look at other routers’ LSPs, and from the available routers advertising their ATT bit set, choose the closest one and inject a default route toward that router into its routing table. If R2 loses connection to R3 and, as a result, its L2 SPF computation shows that the only L2 routers it can reach are from its own area, it clears the ATT bit and floods the updated L1 LSP. That will cause R1 to remove the default route pointing toward R2 from its routing +table. +Chapter 10: IS-IS 603 + + + + + + + +Key Topic + +The Partition repair bit indicates whether the router is capable of an optional feature +that allows healing a partitioned area over the L2 subdomain—functionality similar to an OSPF virtual link. The Partition repair function was never widely implemented, and Cisco routers do not support it; hence they always set the P bit to 0. + +Finally, the Overload bit was originally intended to signal that the router is, for whatever reason, unable to store all LSPs in its memory, and that its link-state database is overload-ed. Running SPF over an incomplete link-state database will produce an incomplete rout-ing table, and routing packets over this router to distant networks could result in routing loops or traffic blackholing. Therefore, if a router’s LSP has the O bit set, the SPF com-putation on other routers will ignore this router when computing shortest paths to other routers and their networks. However, the SPF will still take the directly attached networks of this router into account because these continue to be reachable. In other words, if the O bit set is on an LSP, the SPF calculation will ignore all “IS” adjacencies indicated in the LSP, but it will continue to process the end system adjacencies, such as “IP,” that denote directly attached networks. The router will thus not be used as a transit router to other routers, but it still will be considered as a router usable to reach its own directly con-nected networks. + +Today, the use cases of the O bit have evolved beyond its original meaning and intention. As it can also be set or cleared by a configuration command, it is very useful when, say, a router needs to be taken out of service for maintenance without causing major disrup-tion to the network. Instead of simply shutting the router down, setting the O bit first will make other routers immediately recalculate their routing tables, computing alternate paths (if such paths exist) that do not traverse this router. The network converges on alternate paths much sooner than it would take if the router was simply taken offline and other routers needed to wait for its Hold timer to expire. Also, the O bit is very useful if a new router is to be attached to a network, its routing table populated by IS-IS and its +behavior verified, without actually having the network route the packets through the new router. When you set the O bit, the new router can be plugged into the network and have its IS-IS converge, without actually altering paths in the network. Yet another important application of the O bit is to allow the router to settle its adjacencies after reboot and wait for some time to stabilize while already running IS-IS and populating its routing table, before becoming a transit router. This feature is especially important with BGP that can converge significantly slower than IS-IS, and routing packets through a router right after it has rebooted and converged in IS-IS—without waiting for its BGP peerings to come up and synchronize with the peers—could again result in temporary traffic black holes. It is possible to configure the router so that after a reboot, it sets the O bit and clears it either after a predefined time period, or when BGP signals it has converged. This +particular use of the O bit is documented nicely in RFC 3277. + + +Now check R2. Example 10-5 shows a series of outputs. +604 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 10-5 R2’s Link-State Database in a Multiarea Network Key +Topic ! First, show ip route isis is issued on R2, showing a series of L1 and L2 routes. +! As an L1L2 router, R2 knows about all networks in the domain, both internal and +! inter-area. + +R2# show ip route isis +10.0.0.0/24 is subnetted, 14 subnets +i L1 10.1.1.0 [115/20] via 10.1.12.1, Serial0/0/1 +i L2 10.2.3.0 [115/20] via 10.12.23.3, Serial0/0/0 +i L2 10.2.4.0 [115/30] via 10.12.23.3, Serial0/0/0 +i L2 10.2.5.0 [115/30] via 10.12.23.3, Serial0/0/0 +i L2 10.3.7.0 [115/50] via 10.12.23.3, Serial0/0/0 +i L2 10.3.6.0 [115/40] via 10.12.23.3, Serial0/0/0 +i L2 10.2.45.0 [115/30] via 10.12.23.3, Serial0/0/0 +i L2 10.2.34.0 [115/20] via 10.12.23.3, Serial0/0/0 +i L2 10.2.35.0 [115/20] via 10.12.23.3, Serial0/0/0 +i L2 10.23.46.0 [115/30] via 10.12.23.3, Serial0/0/0 +i L2 10.3.67.0 [115/40] via 10.12.23.3, Serial0/0/0 + +! Issuing the show isis database on R2 will reveal that R2 maintains two link-state +! databases, one for L1 and another for L2. The L1 database contents are identical +! to the L1 database on R1 shown in Example 10-4 so no further comments are needed. +! In its L2 database, R2 keeps an LSP from each L2-enabled router in the domain. + +R2# show isis database + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 +R2.00-00 + +LSP Seq Num +0x00000034 +* 0x00000039 + +LSP Checksum +0xF91B +0x9AA3 + +LSP Holdtime +584 +1193 + +ATT/P/OL +0/0/0 +1/0/0 + +IS-IS Level-2 Link State Database: + +LSPID +R2.00-00 +R3.00-00 +R4.00-00 +R6.00-00 + +LSP Seq Num +* 0x00000036 +0x00000044 +0x0000003B +0x00000035 + +LSP Checksum +0xF6A2 +0x98F1 +0xD3B9 +0x4BD4 + +LSP Holdtime +823 +539 +899 +918 + +ATT/P/OL +0/0/0 +0/0/0 +0/0/0 +0/0/0 + + +! To see the contents of L2 database, the show isis database l2 detail command +! is used. Note in the following output that each the L2 LSP of each router +! contains both its directly connected networks along with all L1 networks +! in that router's area. For example, R2 advertises the network 10.1.1.0/24 +! even though that network is an L1 network learned from R1 (see the routing table +! above) but which is nonetheless a network internal to R2's area. The metric +! of each L1 network advertised in L2 LSPs corresponds to the router's L1 total +! metric towards that network. Each L2-enabled router becomes a representative +Chapter 10: IS-IS 605 + +! for its area, advertising all its internal networks. This is nicely seen +! on R3's and R4's LSPs. + +R2# show isis database l2 detail + +IS-IS Level-2 Link State Database: + +LSPID +R2.00-00 + +LSP Seq Num +* 0x00000036 + +LSP Checksum +0xF6A2 + +LSP Holdtime +800 + +ATT/P/OL +0/0/0 + +Area Address: 49.0001 + +NLPID: +Hostname: R2 +IP Address: +Metric: 10 +Metric: 20 +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +10.1.2.1 +IS R3.00 +IP 10.1.1.0 255.255.255.0 +IP 10.1.2.0 255.255.255.0 +IP 10.1.12.0 255.255.255.0 +IP 10.12.23.0 255.255.255.0 + +R3.00-00 0x00000044 0x98F1 516 0/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R3 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 20 +Metric: 20 +Metric: 10 +Metric: 10 +Metric: 20 +Metric: 10 +Metric: 20 + +0xCC + +10.2.3.1 +IS R2.00 +IS R4.00 +IP 10.2.3.0 255.255.255.0 +IP 10.2.4.0 255.255.255.0 +IP 10.2.5.0 255.255.255.0 +IP 10.2.34.0 255.255.255.0 +IP 10.2.35.0 255.255.255.0 +IP 10.2.45.0 255.255.255.0 +IP 10.12.23.0 255.255.255.0 +IP 10.23.46.0 255.255.255.0 + +R4.00-00 0x0000003B 0xD3B9 875 0/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R4 +IP Address: +Metric: 10 +Metric: 10 +Metric: 20 +Metric: 10 +Metric: 20 +Metric: 10 +Metric: 20 +Metric: 10 +Metric: 20 + +0xCC + +10.2.4.1 +IS R3.00 +IS R6.00 +IP 10.2.3.0 255.255.255.0 +IP 10.2.4.0 255.255.255.0 +IP 10.2.5.0 255.255.255.0 +IP 10.2.34.0 255.255.255.0 +IP 10.2.35.0 255.255.255.0 +IP 10.2.45.0 255.255.255.0 +IP 10.12.23.0 255.255.255.0 +606 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Metric: 10 IP 10.23.46.0 255.255.255.0 +R6.00-00 0x00000035 0x4BD4 893 0/0/0 +Area Address: 49.0003 + +NLPID: +Hostname: R6 +IP Address: +Metric: 10 +Metric: 10 +Metric: 20 +Metric: 10 +Metric: 10 + +0xCC + +10.3.6.1 +IS R4.00 +IP 10.3.6.0 255.255.255.0 +IP 10.3.7.0 255.255.255.0 +IP 10.3.67.0 255.255.255.0 +IP 10.23.46.0 255.255.255.0 + + +Identical L2 link-state database contents would be displayed on any L2-enabled router in this network. Example 10-5 shows how the IP routing information flow between routing levels works. An L1 router advertises only its directly connected networks in its L1 LSP. An L2 router advertises both its directly connected networks and all L1 networks (that is, networks internal to the router’s area) in its L2 LSP. In fact, looking at any L2 LSP in isola-tion, you do not even know which prefix is directly connected to the router and which one is an L1 prefix “uptaken” into L2—they are both advertised in the same manner. + +Checking any L1L2 router’s L2 link-state database would produce the same results as shown previously, and checking R7 would be very similar to what we have already seen on R1. The only slightly more interesting router is R5, which is the focus on Example 10-6. + +Example 10-6 R5’s Link-State Database in a Multiarea Network + +! R5 being an L1-only router has only L1 link-state database containing 3 LSPs, +! one for each router in area 49.0002. Notice that on R3's and R4's LSP, the ATT +! bit is set because both R3 and R4 can reach other areas than 49.0002 after +! running their L2 SPF calculation. The detailed LSP listing shows the ordinary L1 +! LSP contents, each router advertising its directly connected networks. + +R5# show isis database + +IS-IS Level-1 Link State Database: + +LSPID +R3.00-00 +R4.00-00 +R5.00-00 + +LSP Seq Num +0x00000042 +0x00000039 +* 0x0000003A + +LSP Checksum +0xDBD5 +0x0586 +0xBDB9 + +LSP Holdtime +555 +829 +1154 + +ATT/P/OL +1/0/0 +1/0/0 +0/0/0 + + +R5# show isis database detail + +IS-IS Level-1 Link State Database: + +LSPID +R3.00-00 + +LSP Seq Num +0x00000042 + +LSP Checksum +0xDBD5 + +LSP Holdtime +543 + +ATT/P/OL +1/0/0 + +Area Address: 49.0002 +Chapter 10: IS-IS 607 + + +NLPID: +Hostname: R3 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +10.2.3.1 +IP 10.2.34.0 255.255.255.0 +IP 10.12.23.0 255.255.255.0 +IP 10.2.35.0 255.255.255.0 +IP 10.2.3.0 255.255.255.0 +IS R5.00 +IS R4.00 + +R4.00-00 0x00000039 0x0586 816 1/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R4 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +10.2.4.1 +IP 10.2.45.0 255.255.255.0 +IP 10.2.34.0 255.255.255.0 +IP 10.23.46.0 255.255.255.0 +IP 10.2.4.0 255.255.255.0 +IS R3.00 +IS R5.00 + +R5.00-00 * 0x0000003A 0xBDB9 1140 0/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R5 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +10.2.5.1 +IP 10.2.35.0 255.255.255.0 +IP 10.2.45.0 255.255.255.0 +IP 10.2.5.0 255.255.255.0 +IS R3.00 +IS R4.00 + + +! Because both R3 and R4 indicate the ATT bit and R5 is equally distant from both +! of them, it installs a default route towards both R3 and R4. Note once again +! that the default route is not advertised explicitly; the ATT bit serves as an +! implicit advertisement instead. + +R5# show ip route isis +10.0.0.0/24 is subnetted, 8 subnets +i L1 10.2.3.0 [115/20] via 10.2.35.3, Serial0/0/0 +i L1 10.2.4.0 [115/20] via 10.2.45.4, Serial0/0/1 +i L1 10.12.23.0 [115/20] via 10.2.35.3, Serial0/0/0 +i L1 10.2.34.0 [115/20] via 10.2.45.4, Serial0/0/1 +[115/20] via 10.2.35.3, Serial0/0/0 +i L1 10.23.46.0 [115/20] via 10.2.45.4, Serial0/0/1 +i*L1 0.0.0.0/0 [115/10] via 10.2.45.4, Serial0/0/1 +[115/10] via 10.2.35.3, Serial0/0/0 +608 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +R5’s behavior is strongly reminiscent of the OSPF Totally Stubby Area. Such an area has no information about external (redistributed) and inter-area networks. All networks outside the area are reachable through a default route advertised by the ABRs. If the area 49.0002 was running OSPF, the routing table on R5 would be very similar; in par-ticular, there would be two default routes, one through R3 and the other through R4. Because, however, R5 can be configured to redistribute external networks into an IS-IS L1 link-state database, its behavior ultimately resembles an OSPF NSSA-TS area opera-tion. Regarding redistribution, external networks are by default injected into L2 but can be configured to be injected into L1 or both L1 and L2 on a router. If an external route is redistributed to L1, all other routers in the same area will see the route as an L1 IS-IS route. Each L1L2 backbone router in that area will add this route along with other +L1 routes into its L2 LSP. In other words, when “uptaking” L1 routes into L2 on backbone routers, they do not discriminate between internal L1 networks and external networks in the area that have been redistributed as L1 routes. + +Multiple areas in a domain are nowadays created primarily for the purpose of address summarization. In OSPF, summarization of networks in an area would be configured on ABRs. In case of IS-IS, area summarization should be configured on each L1L2 router in the area. While configuration examples will be shown later, it is worthy to mention that in IS-IS, area summarization is configured simply by the summary-address command inside the router isis section, and this command applies equally when summarizing intra-area networks during their L1-to-L2 “uptake” and to redistributed routes. + +Authentication in IS-IS + + + +Key Topic + +IS-IS authentication is configured in a somewhat peculiar way: IIH packets are authenti-cated independently of LSP, CSNP, and PSNP packets. While somewhat surprising, this is a result of how IS-IS operates. Authentication information is added to IS-IS packets as an additional TLV record containing the authentication information. In particular with LSPs, recall the general rule in link-state routing protocols that LSP packets originated by one router must not be modified by any other router. The consequence is that for L1 LSPs, +all routers within the area must use the same area password —the level-1 authentica-tion password, while for L2 LSPs, all L2-enabled routers within the L2 subdomain must use the same domain password —the level-2 authentication password, to authenticate LSPs. If a single area or domain password was used to authenticate all packets, however, all routers in the area or in the backbone would be using the same password, which can be considered a security drawback. Therefore, to authenticate adjacencies themselves, +IS-IS allows you to separately authenticate IIH packets. + +Table 10-4 explains how individual packets are authenticated in IS-IS depending on their type and level, and what commands can be used to activate this authentication. The table uses an abbreviation—the auth keyword is a shorthand of authentication, to save space. Nevertheless, all commands will be accepted exactly as shown, with the auth expanding to its full spelling. Also, because the authentication support has evolved in IOS over time, some IS-IS deployments might still be using an old, deprecated form of authentication +commands. They are indicated as well but should not be used anymore. +Chapter 10: IS-IS 609 + +Table 10-4 Authentication of IS-IS Packets + + +Packet Level +LAN IIH Level 1 + + + +LAN IIH Level 2 + + + +P2P IIH N/A + + + +LSP Level 1 + +CSNP + +PSNP + +LSP Level 2 + +CSNP + +PSNP + +Command +Interface: + +isis auth mode { text | md5 } level-1 + +isis auth key-chain name level-1 + +Interface: + +isis auth mode { text | md5 } level-2 + +isis auth key-chain name level-2 + +Interface: + +isis auth mode { text | md5 } + +isis auth key-chain name + +IS-IS process: + +auth mode { text | md5 } level-1 + +auth key-chain name level-1 + +IS-IS process: + +auth mode { text | md5 } level-2 + +auth key-chain name level-2 + +Old Command +Interface: + +isis password text level-1 + +Interface: + +isis password text level-2 + +Interface: + +isis password text + + +IS-IS process: + +area-password text + + +IS-IS process: + +domain-password text + + + + + + + + + + + + + + + + + + + +Key Topic + +In all indicated commands in Table 10-4, if the level-1 or level-2 keyword is omitted from a command where it is currently indicated, the corresponding authentication type will be activated for both levels. + +Authentication in IS-IS can be activated independently for IIH and independently for non-IIH (LSP, CSNP, PSNP) packets. IIH authentication is configured on interfaces and applies only to IIH packets exchanged with directly connected neighbors. Therefore, dif-ferent interfaces of a router can use different IIH passwords. However, if non-IIH packets are to be authenticated, the same type of authentication and the same password must be +configured on all routers in an area if L1 non-IIH authentication is used, or on all L2 rout-ers in the domain if L2 non-IIH authentication is used. This behavior is unique to IS-IS: While IIH can be authenticated on each interface independently, authentication of non-IIH packets must be consistent across the entire area for L1, and across the entire domain for L2. + +It is important to understand the consequences of failed authentication independently for IIH and non-IIH packets. If IIH packets received from a neighboring router fail authen-tication, no adjacency will be created between this router and the neighbor. As a result, these routers will not accept LSP, CSNP, or PSNP packets from each other, as these pack-ets are accepted only from routers in the Up adjacency state. In other words, if IIH pack- +ets fail authentication, the routers will be completely prevented from communicating in +610 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +IS-IS even if the non-IIH packets themselves passed the authentication or did not require the authentication. + +If IIH packets pass the authentication but the non-IIH packets fail it, the routers will be in the Up adjacency state but they will not be able to synchronize their link-state databases. + +Understandably, the best course of action is to either authenticate all IS-IS packets on a given level or to not authenticate any of them. If configuration simplicity is required, +both IIH and non-IIH packets can be authenticated using the same password. If security is a major concern, different passwords for L1 IIH, L2 IIH, L1 non-IIH, and L2 non-IIH packets can be configured. (Mind the scope: The same password must be used in the entire area for L1 non-IIH packets and in the entire domain for L2 non-IIH packets; IIH packets can use different passwords on a per-interface and per-level basis.) + +The original IS-IS standard specifies only plaintext authentication. RFC 3567 (now RFC 5304) defines a cryptographic authentication for IS-IS, currently using the MD5 hash. Somewhat surprisingly, though, even if the MD5 hash is used and the authentication is configured using key chains, the key IDs (key numbers) are not carried along with the authentication information in IS-IS packets. This is different from RIP, EIGRP, or OSPF, where the number of the key used to sign the packet is indicated in the packet so that the same key can be used by the receiving router to verify the packet’s authentication. In IS-IS, key numbers are not advertised and can differ between routers. If the key strings match, regardless of the key number, the authentication will succeed. Of course, in the case of the MD5 hash, the MD5 is computed over the entire packet, not just over the +password, so the packet itself must not be altered during transit if the authentication is to be successful. + +IPv6 Support in IS-IS + +IS-IS is a true multiprotocol routing protocol in the sense that it does not require any par-ticular Layer 3 protocol to carry its packets, and in a single instance, it can carry infor-mation about destinations described by different address families. Previous examples +of link-state database contents have shown that the LSPs advertise adjacencies to other routers along with adjacencies to directly connected networks—in other words, the LSPs already contain descriptions of adjacencies of different types. In the same way, IPv6 pre-fixes can be advertised in a similar way along with IPv4 addresses. Rules about advertis-ing IPv6 prefixes in L1 and L2 LSPs are identical to those for IPv4: In an L1 LSP, a router advertises all its directly connected IPv6 networks. In an L2 LSP, a router advertises all its directly connected IPv6 networks, all L1 IPv6 networks from within its own area (internal or redistributed into L1), and all networks it redistributes itself, possibly summarizing them if summarization is configured. It is not necessary to start an additional IS-IS pro-cess to carry IPv6 routes along with IPv4. Instead, the existing IS-IS process is simply instructed to advertise IPv6 routes along with other information it is already advertising. This makes IS-IS a very interesting protocol for those networks that do not run IS-IS yet and need to migrate to a new routing protocol to support their newly deployed IPv6. As they need to start a new routing protocol for IPv6, IS-IS comes into consideration just like OSPFv3 or EIGRP for IPv6. And because IS-IS is actually capable of handling both +Chapter 10: IS-IS 611 + +IPv4 and IPv6 in the same instance, without running two independent processes, moving to IS-IS altogether might be an option worth considering. + +Consider the network back in Figure 10-7, with Routers R3, R4, and R5 configured with IPv6 addresses. Links between routers in area 49.0002 will be using the IPv6 addressing convention 2001:DB8:2:::/64, and loopbacks will be using the +2001:DB8:2:::/64 convention. After activating IS-IS for IPv6 as well, R5’s L1 link-state database and routing table are examined in Example 10-7. + +Example 10-7 R5’s Link-State Database in a Multiarea Network with IPv4 and IPv6 +Key +Topic ! After configuring IPv6 on all three routers in area 49.0002 and activating IS-IS +! to also carry IPv6 prefixes, the show isis database does not show any visible +! change. There are still only 3 LSPs. + +R5# show isis database + +IS-IS Level-1 Link State Database: + +LSPID +R3.00-00 +R4.00-00 +R5.00-00 + +LSP Seq Num +0x0000005B +0x0000004F +* 0x00000052 + +LSP Checksum +0x14F1 +0x7C54 +0x288F + +LSP Holdtime +1003 +1003 +1009 + +ATT/P/OL +1/0/0 +1/0/0 +0/0/0 + + +! Looking into the LSP details, the change is immediately visible. The NLPID field +! that lists the supported Layer3 protocols on the originating router now contains +! two values: 0xCC (IPv4) and 0x8E (IPv6). Furthermore, LSPs now contain all +! directly connected IPv4 networks along with IPv6 networks and adjacent routers. + +R5# show isis database detail + +IS-IS Level-1 Link State Database: + +LSPID +R3.00-00 + +LSP Seq Num +0x0000005B + +LSP Checksum +0x14F1 + +LSP Holdtime +997 + +ATT/P/OL +1/0/0 + +Area Address: 49.0002 + +NLPID: +Hostname: R3 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC 0x8E + +10.2.3.1 +IP 10.2.34.0 255.255.255.0 +IP 10.12.23.0 255.255.255.0 +IP 10.2.35.0 255.255.255.0 +IP 10.2.3.0 255.255.255.0 + +IPv6 Address: 2001:DB8:2:3::1 + +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +IPv6 2001:DB8:2:34::/64 +IPv6 2001:DB8:2:35::/64 +IPv6 2001:DB8:2:3::/64 +IS R5.00 +IS R4.00 +612 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +R4.00-00 0x0000004F 0x7C54 998 1/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R4 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC 0x8E + +10.2.4.1 +IP 10.2.45.0 255.255.255.0 +IP 10.2.34.0 255.255.255.0 +IP 10.23.46.0 255.255.255.0 +IP 10.2.4.0 255.255.255.0 + +IPv6 Address: 2001:DB8:2:4::1 + +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +IPv6 2001:DB8:2:45::/64 +IPv6 2001:DB8:2:34::/64 +IPv6 2001:DB8:2:4::/64 +IS R5.00 +IS R3.00 + +R5.00-00 * 0x00000052 0x288F 1002 0/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R5 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC 0x8E + +10.2.5.1 +IP 10.2.35.0 255.255.255.0 +IP 10.2.45.0 255.255.255.0 +IP 10.2.5.0 255.255.255.0 + +IPv6 Address: 2001:DB8:2:5::1 + +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +IPv6 2001:DB8:2:35::/64 +IPv6 2001:DB8:2:45::/64 +IPv6 2001:DB8:2:5::/64 +IS R4.00 +IS R3.00 + + +! The routing table on R5 is populated as usual. Note that the default route +! has been injected towards routers with the ATT bit set in the same way IPv4 +! default route was injected in previous examples. + +R5# show ipv6 route isis +IPv6 Routing Table - 11 entries +Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP +U - Per-user Static route, M - MIPv6 +I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary +O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 +ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 +D - EIGRP, EX - EIGRP external +I1 ::/0 [115/10] +via FE80::3, Serial0/0/0 +via FE80::4, Serial0/0/1 +Chapter 10: IS-IS 613 + +I1 2001:DB8:2:3::/64 [115/20] +via FE80::3, Serial0/0/0 +I1 2001:DB8:2:4::/64 [115/20] +via FE80::4, Serial0/0/1 +I1 2001:DB8:2:34::/64 [115/20] +via FE80::3, Serial0/0/0 +via FE80::4, Serial0/0/1 + + +Configuring IS-IS + +Using the topology shown previously in Figure 10-7, the following examples will show the configuration of selected individual routers. Only the relevant configuration parts will be shown along with specific comments. + +There are a few general comments about the configuration. The NET, that is, an NSAP address with the SEL octet set to 0, is constructed using AFI=49; HO-DSP of 0001, 0002, or 0003 depending on the area; and System ID equal to 0000.0000.000 depend-ing on the router, thereby making it unique. Because the System ID is 6 octets long, it would be also possible to use one of the MAC addresses of the router as the System +ID, ensuring its uniqueness. Another way of deriving a unique System ID is taking an IP address, preferably a loopback address, and performing the following transliteration (the address is just an example): +10.1.255.42 → 010.001.255.042 → 010001255042 → 0100.0125.5042 +Any approach of creating a System ID is viable as long as the resulting System IDs are unique. Recall that a System ID of an L1-only router must be unique within its area; the System ID of an L2-enabled router must be unique in the entire domain. Ideally, the System IDs should be unique across the domain, regardless of the enabled routing level. + +Each router in the following examples is configured using metric-style wide; this is the recommended setting for all new deployments. Also, on all routers, the log-adjacency-changes all command is added to have IOS print logging messages about an IS-IS router coming up or down. This command is not added automatically. + +First, Example 10-8 shows the configuration and IS-IS operation on R1. + +Example 10-8 R1 Configuration and Verification + +! On R1, IS-IS adjacency to R2 will be authenticated. This is the key chain. + +key chain ISISAuth +key 1 +key-string S3cretP4ss + +! Interfaces are configured with IPv4 addresses, and ip router isis is used +! to add them to IS-IS. There is no network command in IS-IS. + +interface Loopback0 +614 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +ip address 10.1.1.1 255.255.255.0 +ip router isis + +! On S0/0/0 interface, MD5 authentication of IIH is configured, and IETF three-way +! handshake method is activated. Note that the authentication configured on an +! interface affects only the IIH packets. Non-IIH packet authentication must be +! configured in the router isis section. + +interface Serial0/0/0 +description => To R2 <= +ip address 10.1.12.1 255.255.255.0 +ip router isis +isis authentication mode md5 +isis authentication key-chain ISISAuth +isis three-way-handshake ietf + +! In IS-IS configuration, the NET is configured, and the router is put into L1-only +! mode. Authentication of non-IIH packets is configured, and wide metrics are used. + +router isis +net 49.0001.0000.0000.0001.00 +is-type level-1 +authentication mode md5 +authentication key-chain ISISAuth +metric-style wide +log-adjacency-changes all + +! In the show isis database detail, note that the use of wide metrics is indicated +! adjacencies to other routers denoted as IS-Extended instead of just IS. Also +! note that LSPs also carry authentication information (its presence is indicated +! by the Auth: entries). + +R1# show isis database detail + +IS-IS Level-1 Link State Database: + +LSPID +R1.00-00 +Auth: + +LSP Seq Num +* 0x0000000E +Length: 17 + +LSP Checksum +0x7A4E + +LSP Holdtime +551 + +ATT/P/OL +0/0/0 + +Area Address: 49.0001 + +NLPID: +Hostname: R1 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC + +10.1.1.1 +IP 10.1.12.0/24 +IP 10.1.1.0/24 +IS-Extended R2.00 + +R2.00-00 0x00000013 0x1E24 1123 1/0/0 +Chapter 10: IS-IS 615 + +Auth: Length: 17 +Area Address: 49.0001 + +NLPID: +Hostname: R2 +IP Address: +Metric: 10 +Metric: 0 +Metric: 10 + +0xCC + +10.1.2.1 +IP 10.1.12.0/24 +IP 10.1.2.0/24 +IS-Extended R1.00 + + + + +Key Topic + +As seen from Example 10-8, interfaces are added to IS-IS directly by configuring them with the ip router isis command. IS-IS has no network command; therefore, per-interface configuration is the way of adding networks and interfaces into IS-IS. Because R1 is a purely internal router not intended to be a part of backbone, only Level 1 routing opera-tion is configured; by default, Cisco routers operate as L1L2 routers. + +Example 10-9 shows the configuration of R2. + + +Example 10-9 R2 Configuration and Verification + +! On R2, IS-IS adjacency to R1 will be authenticated. This is the key chain. + +key chain ISISAuth +key 1 +key-string S3cretP4ss + +! The Lo0 interface does not have any IS-IS related command but in router isis, +! it is declared as passive. This will cause the network from Lo0 to be advertised +! in IS-IS but the interface will be passive (no adjacencies will be established +! over it). + +interface Loopback0 +ip address 10.1.2.1 255.255.255.0 + +! Interface towards R3 is an inter-area link, therefore, it does not make sense +! to even try to establish L1 adjacency over it. Therefore, the isis circuit-type +! command is used to allow only L2 packets to be sent over it. Also, in L2, metric +! of this interface set to 100. + +interface Serial0/0/0 +description => To R3 <= +ip address 10.12.23.2 255.255.255.0 +ip router isis +isis circuit-type level-2-only +isis metric 100 level-2 + +! Interface towards R1 is configured with IIH authentication and IETF three-way +! handshake. +616 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +interface Serial0/0/1 +description => To R1 <= +ip address 10.1.12.2 255.255.255.0 +ip router isis +isis authentication mode md5 +isis authentication key-chain ISISAuth +isis three-way-handshake ietf + +! In IS-IS configuration, the NET is configured, followed by authentication +! activated only for L1 non-IIH packets. Non-IIH packets in L2 adjacencies will +! not be authenticated. Because no isis is-type command is used, R2 acts as L1L2 +! router which is the default setting on Cisco routers. The summary-address command +! is used to summarize L1 networks when injecting them into L2. + +router isis +net 49.0001.0000.0000.0002.00 +authentication mode md5 level-1 +authentication key-chain ISISAuth level-1 +metric-style wide +log-adjacency-changes all +summary-address 10.1.0.0 255.255.0.0 +passive-interface Loopback0 + +! Of particular notice on R2 is its L2 database. Note that thanks to summarization +! configured on R2 (and on other L2-enabled routers as well), the L2 LSPs contain +! only the summarized prefixes. L2 LSPs received from R3 and R4 also contain +! summarized IPv6 prefixes, although R2 does not process these IPv6 prefixes +! as it is not configured for IPv6 operation. + +R2# show isis database l2 detail + +IS-IS Level-2 Link State Database: + +LSPID +R2.00-00 + +LSP Seq Num +* 0x0000005C + +LSP Checksum +0x5694 + +LSP Holdtime +1160 + +ATT/P/OL +0/0/0 + +Area Address: 49.0001 + +NLPID: +Hostname: R2 +IP Address: +Metric: 100 +Metric: 100 +Metric: 0 + +0xCC + +10.1.2.1 +IP 10.12.23.0/24 +IS-Extended R3.00 +IP 10.1.0.0/16 + +R3.00-00 0x0000007A 0xF333 416 0/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R3 +IP Address: + +0xCC 0x8E + +10.2.3.1 +Chapter 10: IS-IS 617 + +Metric: 100 IP 10.12.23.0/24 +IPv6 Address: 2001:DB8:2:3::1 + +Metric: 100 +Metric: 10 +Metric: 10 +Metric: 10 + +IS-Extended R2.00 +IS-Extended R4.00 +IP 10.2.0.0/16 +IPv6 2001:DB8::/32 + +R4.00-00 0x00000065 0x1AF8 426 0/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R4 +IP Address: +Metric: 100 + +0xCC 0x8E + +10.2.4.1 +IP 10.23.46.0/24 + +IPv6 Address: 2001:DB8:2:4::1 + +Metric: 100 +Metric: 10 +Metric: 10 +Metric: 10 + +IS-Extended R6.00 +IS-Extended R3.00 +IP 10.2.0.0/16 +IPv6 2001:DB8::/32 + +R6.00-00 0x00000057 0x664A 579 0/0/0 +Area Address: 49.0003 + +NLPID: +Hostname: R6 +IP Address: +Metric: 100 +Metric: 100 +Metric: 10 + +0xCC + +10.3.6.1 +IP 10.23.46.0/24 +IS-Extended R4.00 +IP 10.3.0.0/16 + + +! Finally, the tidy IPv4 routing table on R2. Note the discard route to Null0 +! installed for the summarized 10.1.0.0/16 prefix. + +R2# show ip route isis +10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks +i L2 10.2.0.0/16 [115/110] via 10.12.23.3, Serial0/0/0 +i L2 10.3.0.0/16 [115/220] via 10.12.23.3, Serial0/0/0 +i L1 10.1.1.0/24 [115/20] via 10.1.12.1, Serial0/0/1 +i su 10.1.0.0/16 [115/0] via 0.0.0.0, Null0 +i L2 10.23.46.0/24 [115/210] via 10.12.23.3, Serial0/0/0 + + + +Key Topic + +On R2, the routing level of the entire router was not modified, causing this router to operate as an L1L2 router. This setting is crucial. If the router was limited to L1 operation only, it would be unable to establish L2 adjacency to R3, which is in a different area. On the other hand, if R2 was configured for L2 operation only, R1 operating as an L1-only router would be unable to establish adjacency with R2. Therefore, R2 must operate as an L1L2 router, and this is a general rule for all backbone (that is, L2-enabled) routers: If they are to provide inter-area routing services to other L1-only routers in their area, they must +operate in L1L2 mode. +618 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The behavior of passive-interface to actually advertise the Lo0’s network without using the ip router isis command on Lo0 in Example 10-9 might be surprising, but there is a logic to it. If an interface should not be added to IS-IS, the entire IS-IS configuration will simply not refer to it in any place, neither by ip router isis on that interface nor in the router isis section by declaring it as passive. If the network from the interface shall be advertised but the interface should remain passive, simply referring to it by the passive-interface command is signal enough to IS-IS to know that the interface’s network should be advertised even though the interface itself should disallow creating any adjacencies over it. And finally, if the interface is intended to operate as an active interface, it shall be configured with the ip router isis command. This behavior is also shared by EIGRP for IPv6. It is important to mention that configuring passive-interface default will cause all local interfaces’ networks to be advertised in IS-IS. + +The use of isis circuit-type command in the Serial0/0/0 interface deserves a mention. If a router is configured for L1L2 operation, it will by default try to establish both L1 and L2 adjacencies over all active IS-IS interfaces. Recall that an IS-IS router originates sepa-rate LSP, CSNP, and PSNP packets independently for L1 and L2, and if the interface is a broadcast interface, also separate L1 and L2 IIHs will be originated. If it is known that an +interface should be used to establish only L1 or only L2 adjacencies, it is possible to limit its operation only to the selected level. That will prevent the router from sending and pro-cessing packets of a different routing level over that interface. In Example 10-9, the inter-face Serial0/0/0 is connected to a router in a different area; therefore, it makes no sense to even attempt establishing L1 adjacencies. Therefore, the isis circuit-type level-2-only command was used on the Serial0/0/0 interface to limit its operation to Level 2 only. + +Regarding authentication, older Cisco CLIs supported only a plaintext authentication using the per-interface isis password command for IIH authentication, and area-pass-word and domain-password commands in router isis configuration to activate authenti-cation for L1 (area) and L2 (domain) non-IIH packets. Passwords were specified directly on the command line, and key chains were not supported. These commands are obsolete and should not be used anymore. The per-interface isis authentication and per-process authentication commands support optional level-1 and level-2 keywords to specify the desired level for which the authentication should be activated. If not specified, both lev-els are authenticated. + +Example 10-10 shows the configuration of R3. + +Example 10-10 R3 Configuration + +! The Lo0 interface is configured with IPv4 and IPv6 addresses, and IS-IS is +! activated for both IPv4 and IPv6 using ip router isis and ipv6 router isis + +ipv6 unicast-routing +! +interface Loopback0 +ip address 10.2.3.1 255.255.255.0 +ip router isis +Chapter 10: IS-IS 619 + +ipv6 address 2001:DB8:2:3::1/64 +ipv6 router isis + +! Interfaces S0/0/0, S0/0/1, and S0/1/0 are configured similarly. To aid, +! readability the link-local IPv6 address on the interface is also modified. The +! S0/0/1 interface connects to R2 in a different area, therefore IS-IS is +! configured to operate only in L2 mode on this interface. + +interface Serial0/0/0 +description => To R4 <= +ip address 10.2.34.3 255.255.255.0 +ip router isis +ipv6 address FE80::3 link-local +ipv6 address 2001:DB8:2:34::3/64 +ipv6 router isis +! +interface Serial0/0/1 +description => To R2 <= +ip address 10.12.23.3 255.255.255.0 +ip router isis +isis circuit-type level-2-only +isis metric 100 level-2 +! +interface Serial0/1/0 +description => To R5 <= +ip address 10.2.35.3 255.255.255.0 +ip router isis +ipv6 address FE80::3 link-local +ipv6 address 2001:DB8:2:35::3/64 +ipv6 router isis + +! The IS-IS configuration on R3 should be, for the most part, fairly obvious. +! The only new section is the address-family ipv6 section in which specific +! settings for IPv6 operation are configured. Here, area summarization is +! configured. You do not need to create this section just to make IS-IS work for IPv6. + +router isis +net 49.0002.0000.0000.0003.00 +metric-style wide +log-adjacency-changes all +summary-address 10.2.0.0 255.255.0.0 +! +address-family ipv6 +summary-prefix 2001:DB8:2::/32 +620 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +exit-address-family + +! We omit the view into R3's link-state database at this point, as the L2 database +! contents are identical to the contents already displayed for R2. + +Note that unlike other IGP protocols, IS-IS does not use a separate process configuration section for its IPv6 operation. The router isis section is universal for all address families supported by IS-IS. If IS-IS shall advertise an interface’s IPv6 address, that interface shall be configured with the ipv6 router isis command. The address-family ipv6 subsection in the IS-IS configuration has been specifically created in this example to configure IPv6-specific operations of IS-IS—in this case, intra-area prefix summarization when advertis-ing the networks into L2. + +Example 10-11 shows a selected set of diagnostic commands on R3 that are useful to verify the IS-IS operation on an L1L2 router. + +Example 10-11 IS-IS Diagnostic Commands on R3 + +! The show clns command shows a brief but useful information about this router's +! NET and mode of Integrated IS-IS operation + +R3# show clns +Global CLNS Information: +4 Interfaces Enabled for CLNS +NET: 49.0002.0000.0000.0003.00 +Configuration Timer: 60, Default Holding Timer: 300, Packet Lifetime 64 +ERPDU's requested on locally generated packets +Running IS-IS in IP/IPv6-only mode (CLNS forwarding not allowed) + +! There is a series of commands to display neighbors – most of these commands +! in fact display the same information, just formatted differently. +! show clns is-neighbors show information about neighboring routers running IS-IS. +! The optional detail keyword provides more detailed information. + +R3# show clns is-neighbors + +System Id Interface State Type Priority Circuit Id Format +R2 Se0/0/1 Up L2 0 00 Phase V +R5 Se0/1/0 Up L1 0 00 Phase V +R4 Se0/0/0 Up L1L2 0 /0 01 Phase V + +R3# show clns is-neighbors detail + +System Id Interface State Type Priority Circuit Id Format +R2 Se0/0/1 Up L2 0 00 Phase V +Area Address(es): 49.0001 +IP Address(es): 10.12.23.2* +Chapter 10: IS-IS 621 + +Uptime: 01:07:59 +NSF capable +R5 Se0/1/0 Up L1 0 00 Phase V +Area Address(es): 49.0002 +IP Address(es): 10.2.35.5* +IPv6 Address(es): FE80::5 +Uptime: 01:51:39 +NSF capable +R4 Se0/0/0 Up L1L2 0 /0 01 Phase V +Area Address(es): 49.0002 +IP Address(es): 10.2.34.4* +IPv6 Address(es): FE80::4 +Uptime: 05:15:33 +NSF capable + +! The show clns neighbors is very similar. This command is capable of displaying +! the SNPA of the neighbor; for HDLC and PPP, only a textual description is shown, +! as these protocols do not have a concept of a SNPA. This command also supports +! the optional detail keyword (not shown here). + +R3# show clns neighbors + +System Id Interface SNPA State Holdtime Type Protocol + +R2 Se0/0/1 *HDLC* +R5 Se0/1/0 *HDLC* + +Up 26 L2 IS-IS +Up 23 L1 IS-IS + +R4 Se0/0/0 *HDLC* Up 24 L1L2 IS-IS + +! Details about IS-IS operation on an interface can be shown using +! show clns interface command. + +R3# show clns interface s0/0/0 +Serial0/0/0 is up, line protocol is up +Checksums enabled, MTU 1500, Encapsulation HDLC +ERPDUs enabled, min. interval 10 msec. +CLNS fast switching enabled +CLNS SSE switching disabled +DEC compatibility mode OFF for this interface +Next ESH/ISH in 14 seconds +Routing Protocol: IS-IS +Circuit Type: level-1-2 +Interface number 0x1, local circuit ID 0x100 +Neighbor System-ID: R4 +Level-1 Metric: 10, Priority: 64, Circuit ID: R4.01 +Level-1 IPv6 Metric: 10 +Number of active level-1 adjacencies: 1 +Level-2 Metric: 10, Priority: 64, Circuit ID: R3.00 +622 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Level-2 IPv6 Metric: 10 +Number of active level-2 adjacencies: 1 +Next IS-IS Hello in 526 milliseconds +if state UP + +! Finally, the show isis neighbors shows the usual list of IS-IS neighbors. +! You may find this command superfluous; in fact, it did not exist for quite +! some time, and show clns commands shown above were used instead. This command +! also supports the optional detail keyword (not shown here). + +R3# show isis neighbors + +System Id Type Interface IP Address State Holdtime Circuit Id + +R2 L2 Se0/0/1 +R5 L1 Se0/1/0 + +10.12.23.2 UP 22 00 +10.2.35.5 UP 24 00 + +R4 L1L2 Se0/0/0 10.2.34.4 UP 27 01 + +Finally, Example 10-12 shows the configuration of R5. It is not necessary to show other routers. R4 is similar to R3, R6 is similar to R2, and R7 is similar to R1. + +Example 10-12 R5 Configuration and Verification + +! The Lo0 interface is configured with IPv4 and IPv6 addresses, and IS-IS is +! activated for both IPv4 and IPv6 using ip router isis and ipv6 router isis + +ipv6 unicast-routing +! +interface Loopback0 +ip address 10.2.5.1 255.255.255.0 +ip router isis +ipv6 address 2001:DB8:2:5::1/64 +ipv6 router isis +! +interface Serial0/0/0 +description => To R3 <= +ip address 10.2.35.5 255.255.255.0 +ip router isis +ipv6 address FE80::5 link-local +ipv6 address 2001:DB8:2:35::5/64 +ipv6 router isis +! +interface Serial0/0/1 +description => To R4 <= +ip address 10.2.45.5 255.255.255.0 +ip router isis +ipv6 address FE80::5 link-local +ipv6 address 2001:DB8:2:45::5/64 +Chapter 10: IS-IS 623 + +ipv6 router isis +! +router isis +net 49.0002.0000.0000.0005.00 +is-type level-1 +metric-style wide +log-adjacency-changes all + +! Following is a couple of diagnostic commands. By this moment, you should be +! able to read all displayed information without further comments. + +R5# show isis database detail + +IS-IS Level-1 Link State Database: + +LSPID +R3.00-00 + +LSP Seq Num +0x00000084 + +LSP Checksum +0xF1E0 + +LSP Holdtime +562 + +ATT/P/OL +1/0/0 + +Area Address: 49.0002 + +NLPID: +Hostname: R3 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC 0x8E + +10.2.3.1 +IP 10.2.34.0/24 +IP 10.2.35.0/24 +IP 10.2.3.0/24 + +IPv6 Address: 2001:DB8:2:3::1 + +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +IPv6 2001:DB8:2:34::/64 +IPv6 2001:DB8:2:35::/64 +IPv6 2001:DB8:2:3::/64 +IS-Extended R5.00 +IS-Extended R4.00 + +R4.00-00 0x00000078 0xB00F 961 1/0/0 +Area Address: 49.0002 + +NLPID: +Hostname: R4 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + +0xCC 0x8E + +10.2.4.1 +IP 10.2.45.0/24 +IP 10.2.34.0/24 +IP 10.2.4.0/24 + +IPv6 Address: 2001:DB8:2:4::1 + +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +IPv6 2001:DB8:2:45::/64 +IPv6 2001:DB8:2:34::/64 +IPv6 2001:DB8:2:4::/64 +IS-Extended R5.00 +IS-Extended R3.00 + +R5.00-00 * 0x00000083 0xCEE8 921 0/0/0 +Area Address: 49.0002 +NLPID: 0xCC 0x8E +624 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Hostname: R5 +IP Address: +Metric: 10 +Metric: 10 +Metric: 10 + + +10.2.5.1 +IP 10.2.35.0/24 +IP 10.2.45.0/24 +IP 10.2.5.0/24 + +IPv6 Address: 2001:DB8:2:5::1 + +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 +Metric: 10 + +IPv6 2001:DB8:2:35::/64 +IPv6 2001:DB8:2:45::/64 +IPv6 2001:DB8:2:5::/64 +IS-Extended R3.00 +IS-Extended R4.00 + + +R5# show ip route isis +10.0.0.0/24 is subnetted, 6 subnets +i L1 10.2.3.0 [115/20] via 10.2.35.3, Serial0/0/0 +i L1 10.2.4.0 [115/20] via 10.2.45.4, Serial0/0/1 +i L1 10.2.34.0 [115/20] via 10.2.45.4, Serial0/0/1 +[115/20] via 10.2.35.3, Serial0/0/0 +i*L1 0.0.0.0/0 [115/10] via 10.2.45.4, Serial0/0/1 +[115/10] via 10.2.35.3, Serial0/0/0 + +R5# show ipv6 route isis +I1 ::/0 [115/10] +via FE80::4, Serial0/0/1 +via FE80::3, Serial0/0/0 +I1 2001:DB8:2:3::/64 [115/20] +via FE80::3, Serial0/0/0 +I1 2001:DB8:2:4::/64 [115/20] +via FE80::4, Serial0/0/1 +I1 2001:DB8:2:34::/64 [115/20] +via FE80::4, Serial0/0/1 +via FE80::3, Serial0/0/0 +Chapter 10: IS-IS 625 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 10-5 lists some of the key protocols regarding IS-IS. + + + +Table 10-5 + +Name + + +Protocols and Corresponding Standards for Chapter 10 + +Standard + + + +Information technology—Telecommunications and information exchange between systems—Intermediate System–to–Intermediate System intra-domain routeing information exchange protocol for use in conjunction with the protocol for providing the connectionless-mode network service +Use of OSI IS-IS for Routing in TCP/IP and Dual Environments + +Intermediate System–to–Intermediate System (IS-IS) Transient Blackhole Avoidance +Recommendations for Interoperable Networks using Intermediate System to Intermediate System (IS-IS) +Recommendations for Interoperable IP Networks using Intermediate System–to–Intermediate System (IS-IS) +Dynamic Hostname Exchange Mechanism for IS-IS + +Three-Way Handshake for IS-IS Point-to-Point Adjacencies + +IS-IS Cryptographic Authentication + +IS-IS Extensions for Traffic Engineering + +Routing IPv6 with IS-IS + +ISO/IEC 10589:2002 + + + +RFC 1195 + +RFC 3277 + +RFC 3719 + +RFC 3787 + +RFC 5301 + +RFC 5303 + +RFC 5304 + +RFC 5305 + +RFC 5308 + + + +Table 10-6 lists some of the most popular IOS commands related to the topics in this chapter. + + +Table 10-6 + +Command + + +Command Reference for Chapter 10v + +Command Mode and Description + +router isis [ area-tag ] Global config; starts the IS-IS process and puts the user into its configuration. The optional area-tag is a process ID used when running multiple IS-IS processes, and is not related to area ID in NSAP/NET. +626 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +net network-entity-title + + + + +is-type { level-1 | level-1-2 | level-2-only } +authentication mode { text | md5 } [ level-1 | level-2 ] + +authentication key-chain key-chain-name [ level-1 | level-2 ] +metric-style { narrow | transition | wide } [ level-1 | level-1-2 | level-2 ] + +passive-interface interface-type interface-number | default + +summary-address ip-address mask [ level-1 | level-1-2 | level-2 ] [ metric metric ] +address-family ipv6 + +Command Mode and Description +IS-IS config mode; defines Network Entity Title for the IS-IS process. A maximum of three NETs can be defined, one on a line, for purposes of area renumbering, splitting, +or joining. If multiple NET commands are configured, their System ID parts must match. +IS-IS config mode; limits the router to a selected routing level operation. If omitted, level-1-2 is assumed. +IS-IS config mode; configures the authentication mode for non-IIH packets. If no level is specified, authentication applies to both levels. +IS-IS config mode; defines the key chain to be used to authenticate non-IIH packets. If no level is specified, authentication applies to both levels. +IS-IS config mode; configures the metric type used in a particular routing level. The transition option is used when transitioning between narrow and wide metrics. If omitted, narrow metrics for both levels are used. +IS-IS config mode; defines an interface as passive and automatically advertises its connected network. + +IS-IS config mode; defines summarization of IPv4 networks during their injection into a particular routing level. If not specified, level-2 and metric 0 are used. + +IS-IS config mode; enters a submode for IPv6 settings. + + +summary-prefix ipv6-prefix/ IS-IS IPv6 AF submode; defines summarization of IPv6 prefix-length [ level-1 | level- networks during their injection into a particular routing 1-2 | level-2 ] level. If not specified, level-2 is used. + + +protocol shutdown + + +ip router isis [ area-tag ] + + +ipv6 router isis [ area-tag ] + + +isis circuit-type { level-1 | level-1-2 | level-2-only } + +isis metric metric [ level-1 | level-2 ] + +IS-IS config mode; allows you to stop the IS-IS process entirely without removing it from the configuration. The process can be started again by removing this command. +Interface subcommand; activates an interface in IS-IS and advertises the connected IPv4 subnet. The optional area-tag selects the particular IS-IS process. +Interface subcommand; activates an interface in IS-IS and advertises the connected IPv6 subnet. The optional area-tag selects the particular IS-IS process. +Interface subcommand; limits the IS-IS operation on the interface to the specified routing level. +Interface subcommand; defines the interface metric. If the level is omitted, applies to both levels. +Chapter 10: IS-IS 627 + + + +Command +isis hello-interval seconds [ level-1 | level-2 ] + + +isis hello-multiplier multiplier [ level-1 | level-2 ] + + + +isis priority priority [ level-1 | level-2 ] + +isis authentication mode +{ text | md5 } [ level-1 | level-2 ] +isis authentication key-chain key-chain-name +[ level-1 | level-2 ] + +isis three-way-handshake { cisco | ietf } + + +isis network point-to-point + + + +isis protocol shutdown + +show clns + +show clns neighbors [ detail ] + +show clns is-neighbors [ detail ] + +Command Mode and Description +Interface subcommand; defines the hello interval in range of 1 to 65535. If the level is omitted, applies to both levels. On point-to-point interfaces, configuring the level has no effect because a single IIH is used for both levels. +Interface subcommand; defines the multiplier to compute the resulting Hold time, in the range 3 to 1000. If the level is omitted, applies to both levels. On point-to-point interfaces, configuring the level has no effect because a single IIH is used for both levels. +Interface subcommand; defines the priority for DIS elections in the range 0 to 127. If the level is omitted, applies to both levels. +Interface subcommand; configures the authentication mode for IIH packets. If no level is specified, authentication applies to both levels. +Interface subcommand; defines the key chain to be used to authenticate IIH packets. If no level is specified, authentication applies to both levels. +Interface subcommand; activates the three-way handshake on point-to-point interfaces. The cisco method is default (does not carry information about the neighbor identity); ietf is preferred. +Interface subcommand; allows treating a broadcast link with just two routers (that is, a fiber Ethernet between two routers) as a point-to-point link, bypassing the DIS election and pseudonode origination. +Interface subcommand; allows deactivating IS-IS on the interface without deconfiguring it. +Displays CLNS-related information about the router, including NET and IS-IS mode of operation. +Displays all CLNS neighbors, ES and IS, and related information. +Displays CLNS IS neighbors and related information. + +show clns interface interface- Displays CLNS-related interface information. name interface-type +show isis neighbors [ detail ] Displays IS-IS neighbors and related information. +628 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 10-7 summarizes important IS-IS timers and their meanings. + + + +Table 10-7 + +Timer + + +IS-IS Timer Summary + +Meaning + + + +MaxAge, a.k.a. RemainingLifetime + +ZeroAgeLifetime + + +Hello + +Hold + + +CSNP Interval + +The maximum remaining lifetime of an LSP without receiving a newer copy of the LSP, before the LSP expires. Default is 1200 seconds. +The minimum time an LSP must be retained in the link-state database after expiring or initiating an LSP purge. Default is 60 seconds. +Per interface; time interval between Hellos. Default is 10 seconds. Independent for L1 and L2 Hellos on broadcast interfaces. +Per interface; time interval in which a Hello should be received from a neighbor. If not received, the neighbor is considered to have failed. Default is three times Hello. +Per interface; defines the time interval between sending consecutive CSNP packets if the router is a DIS on that interface. Defaults to 10 seconds. + + + +Table 10-8 lists IS-IS neighbor states and their meanings. + + +Table 10-8 IS Neighbor States + +State Meaning +Down The initial state. No IIHs have been received from the neighbor. + +Init IIHs have been received from the neighbor, but it is not certain that the neighbor is properly receiving this router’s IIH. +Up IIHs have been received from the neighbor, and it is certain that the neighbor is properly receiving this router’s IIH. + + +Table 10-9 lists OSI acronyms and their meanings. + + + +Table 10-9 + +Term +System + + +OSI Terminology + +Meaning +Network node. + + + +End System (ES) + +Intermediate System (IS) + +Domain + +End node; host. + +Intermediate node; router. + +Autonomous system. +Chapter 10: IS-IS 629 + + + +Term Circuit + +Local Circuit ID + +Extended Local Circuit ID + +Network Service Access Point (NSAP) +Network Entity Title + + +Initial Domain Part (IDP) + +Domain Specific Part (DSP) + + +Authority and Format ID (AFI) + +Initial Domain ID (IDI) + +High-Order Domain Specific Part (HO-DSP) +System ID + +NSAP Selector (NSEL, SEL) + +Sub Network Point of Attachment (SNPA) +Designated IS (DIS) + +Network Layer Protocol ID (NLPID) + +Meaning +Interface; working interconnection to another host or a router. +Internal enumeration of circuits by a router, 1 octet. + +Internal enumeration of point-to-point circuits for three-way handshaking purpose, 4 octets. +Layer 3 address of a node. + +NSAP address in which the SEL octet is set to 0; identifies the node itself without addressing any particular network service. +High-order octets of an NSAP address identifying its format and the domain in which the node is located. +Low-order octets of an NSAP address identifying the area, individual host, and network service that is being addressed. +The most significant octet of NSAP address; identifies the format of the address. +A part of the NSAP address following the AFI identifying the domain. +A part of the NSAP address following the IDI (if any) identifying the internal partitioning of the domain. +Identifier of the network node, 6 octets. + +Identifier of the network service on the node, 1 octet. + +Layer 2 address relevant to an interface (if any). + +Designated router on a broadcast segment. + +Supported Layer 3 protocol (address family) on a router. + + + + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. +630 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +ES, IS, domain, circuit, NLPID, SNPA, NSAP, NET, IDP, DSP, AFI, IDI, HO-DSP, SEL, TLV, Level 1 routing, Level 2 routing, IIH, ISH, LSP, CSNP, PSNP, LSP fragmen-tation, three-way handshake, pseudonode, DIS, area, Level 2 subdomain, backbone, ATTached bit, Overload bit +Refer to the glossary to check your answers. + + +Further Reading + +Jeff Doyle’s Routing TCP/IP, Volume I, Second Edition; every word a must for CCIE Routing and Switching. + +Jeff Doyle’s OSPF and IS-IS: Choosing an IGP for Large-Scale Networks is yet another book specifically devoted to these two routing protocols, and—as can be expected—it is a great book to read. + +IS-IS and OSPF: A Comparative Anatomy: A presentation available online by Dave Katz under this title is a great introduction into both protocols and a very nice compari-son of their common and different features. + +Another in-depth comparison of OSPF and IS-IS can be found in an Internet draft avail-able online with the filename draft-bhatia-manral-diff-isis-ospf-01.txt . + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + +Blueprint topics covered in this chapter: + +This chapter covers the following subtopics from the Cisco CCIE Routing and Switching written exam blueprint. Refer to the full blueprint in Table I-1 in the Introduction for more details on the topics covered in each chapter and their context within the blueprint. + +■ Manual Summarization and Autosummarization + +■ Route Redistribution + +■ Default Routing + +■ Performance Routing + +■ Troubleshooting Complex Layer 3 Problems +CHAPTER 11 + + +IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting + + +This chapter covers several topics related to the use of multiple internal gateway protocol (IGP) routing protocols. IGPs can use default routes to pull packets toward a small set of routers, with those routers having learned routes from some external source. IGPs can use route summarization with a single routing protocol, but it is often used at redistribution points between IGPs as well. Route redistribution by definition involves moving routes from one routing source to another. This chapter takes a look at each topic. + +New to the qualification exam blueprint are a number of troubleshooting topics. One of them, troubleshooting complex Layer 3 problems, is covered in this chapter. The goal is to provide you with a process and tools to troubleshoot these types of problems. + +For perspective, note that this chapter includes coverage of Routing Information Protocol version 2 (RIPv2) redistribution topics. Even though RIPv2 has been removed from the CCIE Routing and Switching qualifying exam blueprint, you might still see exam ques-tions on redistribution involving RIPv2. Therefore, this chapter includes coverage of that topic. + +“Do I Know This Already?” Quiz + +Table 11-1 outlines the major headings in this chapter and the corresponding “Do I Know This Already?” quiz questions. + +Table 11-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping + + +Foundation Topics Section +Route Maps, Prefix Lists, and Administrative Distance +Route Redistribution + +Route Summarization + +Default Routes + +Troubleshooting Layer 3 Problems + +Performance Routing + +Total Score + +Questions Covered in This Section Score +1–2 + +3–6 + +7 + +8 + +9–10 + +11–12 +634 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +To best use this pre-chapter assessment, remember to score yourself strictly. You can find the answers in Appendix A , “Answers to the ‘Do I Know This Already?’ Quizzes.” +1. A route map has several clauses. A route map’s first clause has a permit action con-figured. The match command for this clause refers to an ACL that matches route 10.1.1.0/24 with a permit action, and matches route 10.1.2.0/24 with a deny action. If this route map is used for route redistribution, which of the following are true? +a. The route map will attempt to redistribute 10.1.1.0/24. + +b. The question does not supply enough information to determine whether 10.1.1.0/24 is redistributed. + +c. The route map will not attempt to redistribute 10.1.2.0/24. + +d. The question does not supply enough information to determine whether 10.1.2.0/24 is redistributed. + +2. Which of the following routes would be matched by this prefix list command: ip prefix-list fred permit 10.128.0.0/9 ge 20? + +a. 10.1.1.0 255.255.255.0 + +b. 10.127.1.0 255.255.255.0 + +c. 10.200.200.192 255.255.255.252 + +d. 10.128.0.0 255.255.240.0 + +e. None of these answers is correct. + +3. A router is using the following configuration to redistribute routes. This router has several working interfaces with IP addresses in network 10.0.0.0, and has learned some network 10 routes with EIGRP and some with OSPF. Which of the following is true about the redistribution configuration? +router eigrp 1 +network 10.0.0.0 +redistribute ospf 2 +! +router ospf 2 +network 10.0.0.0 0.255.255.255 area 3 +redistribute eigrp 1 subnets + +R1# show ip route 10.0.0.0 +Routing entry for 10.0.0.0/24, 5 known subnets +Attached (2 connections) +Redistributing via eigrp 1 + +O E1 10.6.11.0 [110/84] via 10.1.6.6, 00:21:52, Serial0/0/0.6 +O E2 10.6.12.0 [110/20] via 10.1.6.6, 00:21:52, Serial0/0/0.6 +C 10.1.6.0 is directly connected, Serial0/0/0.6 +O IA 10.1.2.0 [110/65] via 10.1.1.5, 00:21:52, Serial0/0/0.5 +C 10.1.1.0 is directly connected, Serial0/0/0.5 +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 635 + +a. EIGRP will not advertise any additional routes because of redistribution. + +b. OSPF will not advertise any additional routes because of redistribution. + +c. Routes redistributed into OSPF will be advertised as E1 routes. + +d. The redistribute ospf 2 command would be rejected because of missing parameters. + +4. Examine the following router configuration and excerpt from its IP routing table. Which routes could be redistributed into OSPF? + +router eigrp 1 +network 12.0.0.0 +router ospf 2 +redistribute eigrp 1 subnets +network 13.0.0.0 0.255.255.255 area 3 +An excerpt from the routing table is shown next: +C 12.1.6.0 is directly connected, Serial0/0/0.6 +D 12.0.0.0/8 [90/2172416] via 13.1.1.1, 00:01:30, Serial0/0/0.5 +C 13.1.1.0 is directly connected, Serial0/0/0.5 +a. 12.1.6.0 + +b. 12.0.0.0 + +c. 13.1.1.0 + +d. None of these answers is correct. + +5. Two corporations merged. The network engineers decided to redistribute between one company’s EIGRP network and the other company’s OSPF network, using two mutually redistributing routers (R1 and R2) for redundancy. Assume that as many defaults as is possible are used for the redistribution configuration. Assume that one of the subnets in the OSPF domain is 10.1.1.0/24. Which of the following is true about a possible suboptimal route to 10.1.1.0/24 on R1—a route that sends packets through the EIGRP domain, and through R2 into the OSPF domain? +a. The suboptimal routes will occur unless the configuration filters routes at R1. + +b. R1’s administrative distance must be manipulated, such that OSPF routes have an administrative distance less than EIGRP’s default of 90. + +c. EIGRP prevents the suboptimal routes by default. + +d. Using route tags is the only way to prevent the suboptimal routes. +636 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +6. Which of the following statements is true about the type of routes created when redistributing routes? + +a. Routes redistributed into OSPF default to be external type 2. + +b. Routes redistributed into EIGRP default to external, but can be set to internal with a route map. + +c. Routes redistributed into RIP are external by default. + +d. Routes redistributed into OSPF by a router in an NSSA area default to be exter-nal type 1. + +7. Which of the following is not true about route summarization? + +a. The advertised summary is assigned the same metric as the lowest-metric com-ponent subnet. + +b. The router does not advertise the summary when its routing table does not have any of the component subnets. + +c. The router does not advertise the component subnets. + +d. Summarization, when used with redistribution, prevents all cases of suboptimal routes. + +8. Which of the following is/are true regarding the default-information originate router subcommand? + +a. It is not supported by EIGRP. + +b. It causes OSPF to advertise a default route, but only if a static route to 0.0.0.0/0 is in that router’s routing table. + +c. The always keyword in the default-information originate command, when used for OSPF, means that OSPF will originate a default route even if no default route exists in its own IP routing table. +d. None of the other answers is correct. + +9. An EIGRP router is showing intermittent reachability to 172.30.8.32/27. Which command(s) reveals the source by which this prefix is being advertised to the local router? +a. show ip protocols + +b. show ip route eigrp + +c. show ip eigrp neighbor + +d. show ip eigrp topology 172.30.8.32 + +e. show ip route 172.30.8.32 +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 637 + +10. You suspect that a routing loop exists in your network because a subnet is intermit-tently reachable. What is the most specific way to determine that a routing loop is the cause? +a. ping + +b. traceroute + +c. debug ip packet detail + +d. debug ip routing + +e. show ip protocols + +11. What routing optimization feature exists to change existing routing parameters of an IGP such that it will add new prefixes and manipulate overall data forwarding at the network’s edge? +a. Overlay transport virtualization + +b. OSPFv3 + +c. Enhanced traffic selection + +d. Performance Routing (PfR) + +12. What solution is used to ensure that rogue devices cannot be used to poison the manipulation of route optimization through adding dynamic static routes to the rout-ing information base of a given border router? +a. MD5 + +b. Key chains + +c. Clear text password + +d. SHA1 +638 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Foundation Topics + + +Route Maps, Prefix Lists, and Administrative Distance + +Route maps, IP prefix lists, and administrative distance (AD) must be well understood to do well with route redistribution topics on the CCIE Routing and Switching written +exam. This section focuses on the tools themselves, followed by coverage of route redis-tribution. + +Configuring Route Maps with the route-map Command + +Route maps provide programming logic similar to the If/Then/Else logic seen in other programming languages. A single route map has one or more route-map commands in it, and routers process route-map commands in sequential order based on sequence num-bers. Each route-map command has underlying matching parameters, configured with the aptly named match command. (To match all packets, the route-map clause simply omits the match command.) Each route-map command also has one or more optional set com-mands that you can use to manipulate information—for example, to set the metric for some redistributed routes. The general rules for route maps are as follows: + +■ Each route-map command must have an explicitly configured name, with all com-mands that use the same name being part of the same route map. + +■ Each route-map command has an action (permit or deny). + +■ Each route-map command in the same route map has a unique sequence number, allowing deletion and insertion of single route-map commands. + +■ When a route map is used for redistribution, the route map processes routes taken from the then-current routing table. + +■ The route map is processed sequentially based on the sequence numbers. + +■ After a particular route is matched by the route map, it is not processed beyond that matching route-map command (specific to route redistribution). + +■ When a route is matched in a route-map statement, if the route-map command has a permit parameter, the route is redistributed (specific to route redistribution). + +■ When a route is matched in a route-map statement, if the route-map statement has a deny parameter, the route is not redistributed (specific to route redistribution). + +Route maps can be confusing at times, especially when using the deny option on the route-map command. To help make sure that the logic is clear before getting into redis-tribution, Figure 11-1 shows a logic diagram for an example route map. (This example is contrived to demonstrate some nuances of route map logic; a better, more efficient route map could be created to achieve the same results.) In the figure, R1 has eight loopback interfaces configured to be in class A networks 32 through 39. Figure 11-1 shows how the contrived route-map picky would process the routes. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 639 + + + +A The set of routes to redistribute +B Routes for which no decision has been made yet +C The set of routes that are not redistributed +Matched 32 +ACL 32: +32 +A +Permits Network 32 Default Deny Any at End + + +Matched 37 +ACL d-36-p-37: +Denies Network 36 A 32, 37 Permits Network 37 +Default Deny Any at End + + + +ACL d-38-p-39: +Denies Network 38 A 32, 37 +Permits Network 39 Default Deny Any at End + + + +ACL 33: +Permits Network 33 A 32, 37 Default Deny Any at End + + +B 32, 33, 34, 35, 36, 37, 38, 39 + + +Permit route-map picky permit 10 match ip address 32 + +Not Matched +B 33, 34, 35, 36, 37, 38, 39 + + +Permit route-map picky permit 25 match ip address d-36-p-37 + +Not Matched +B 33, 34, 35, 36, 38, 39 + + +route-map picky deny 33 match ip address d-38-p39 + +Not Matched +B 33, 34, 35, 36, 38 + + +route-map picky deny 40 match ip address 33 + +Not Matched B 34, 35, 36, 38 + +End of List: implied deny all + + + + + + + +C null + + + + + +C null + + +Deny + +Matched 39 + +C 39 + + +Deny + +Matched 33 + +C 33, 39 + +Deny + + +A 32, 37 B Null C 33, 34, 35, 36, 38, 39 + +Figure 11-1 Route Map Logic Example + +First, a few clarifications about the meaning of Figure 11-1 are in order. The top of the figure begins with the set of connected networks (32 through 39), labeled with a “B,” which is the set of routes still being considered for redistribution. Moving down the fig-ure, four separate route-map commands sit inside this single route map. Each route-map clause (the clause includes the underlying match and set commands) in turn moves routes from the list of possible routes (“B”) to either the list of routes to redistribute (“A”) or the list to not redistribute (“C”). By the bottom of the figure, all routes will be noted as either to be redistributed or not to be redistributed. + +The route map chooses to redistribute a route only if the route-map command has a permit option; the only time a route-map clause chooses to not redistribute a route is when the clause has a deny option. Ignoring the matching logic for a moment, the first two route-map commands (sequence numbers 10 and 25) use the permit option. As a result of those clauses, routes are either added to the list of routes to redistribute (“A”) or left in the list of candidate routes (“B”). The third and fourth clauses (sequence numbers 33 and 40) use the deny option, so those clauses cause routes to be either added to the list of routes to not redistribute (“C”) or left in the list of candidate routes (“B”). In effect, after a +640 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +route-map clause has matched a route, that route is flagged either as to be redistributed or as not to be redistributed, and the route is no longer processed by the route map. + +One point that can sometimes be confused is that if a route is denied by an access con-trol list (ACL) used by a match command, it does not mean that the route is prevented from being redistributed. For example, the match ip address 32 command in clause 10 refers to ACL 32, which has one explicit access control entry (ACE) that matches net-work 32, with a permit action. Of course, ACL 32 has an implied deny all at the end, so ACL 32 permits network 32, and denies 33 through 39. However, denying networks 33 through 39 in the ACL does not mean that those routes are not redistributed—it simply means that those routes do not match route-map clause 10, so those routes are eligible for consideration by a later route-map clause. + +The following list summarizes the key points about route map logic when used for redis-tribution: + + +■ +Key Topic + +■ + + +■ + + + +■ + +route-map commands with the permit option either cause a route to be redistrib-uted or leave the route in the list of routes to be examined by the next route-map clause. + +route-map commands with the deny option either filter the route or leave the route in the list of routes to be examined by the next route-map clause. + +If a clause’s match commands use an ACL, an ACL match with the deny action does not cause the route to be filtered. Instead, it just means that route does not match that particular route-map clause. + +The route-map command includes an implied deny all clause at the end; to configure a permit all, use the route-map command, with a permit action, but without a match +command. + + + +Route Map match Commands for Route Redistribution + +Route maps use the match command to define the fields and values used for matching the routes being processed. If more than one match command is configured in a single route-map clause, a route is matched only if all the match commands’ parameters match the route. The logic in each match command itself is relatively straightforward. Table 11-2 lists the match command options when used for IGP route redistribution. + +Table 11-2 match Command Options for IGP Redistribution + + +match Command + +match interface interface-type interface-number [... interface-type interface-number ] + +*match ip address {[access-list-number | access-list-name] | prefix-list prefix-list-name} + +Description +Looks at outgoing interface of routes + + +Examines route prefix and prefix length +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 641 + + + +match Command +*match ip next-hop {access-list-number | access-list-name} + +*match ip route-source {access-list-number | access-list-name} + +match metric metric-value [+ – deviation ] + + +match route-type {internal | external [type-1 | type-2] | level-1 | level-2} + +match tag tag-value [...tag-value ] + +Description +Examines route’s next-hop address + +Matches advertising router’s IP address + +Matches route’s metric exactly, or optionally a range of metrics (plus/minus the configured deviation) +Matches route type + +Tag must have been set earlier + + +*Can reference multiple numbered and named ACLs on a single command. + + +Route Map set Commands for Route Redistribution + +When used for redistribution, route maps have an implied action—either to allow the route to be redistributed or to filter the route so that it is not redistributed. As described earlier in this chapter, that choice is implied by the permit or deny option in the route-map command. Route maps can also change information about the redistributed routes by using the set command. Table 11-3 lists the set command options when used for IGP route redistribution. + +Table 11-3 set Command Options for IGP Redistribution + + +set Command +set level {level-1 | level-2 | level-1-2 | stub-area | backbone} + +set metric metric-value + +set metric bandwidth delay reliability loading mtu +set metric-type {internal | external | type-1 | type-2} + +set tag tag-value + +Description +Defines database(s) into which the route is redistributed +Sets the route’s metric for OSPF, RIP, and IS-IS + +Sets the IGRP/EIGRP route’s metric values + +Sets the type of route for IS-IS and OSPF + +Sets the unitless tag value in the route + + + + +IP Prefix Lists + +IP prefix lists provide mechanisms to match two components of an IP route: + +■ The route prefix (the subnet number) + +■ The prefix length (the subnet mask) +642 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The redistribute command cannot directly reference a prefix list, but a route map can refer to a prefix list by using the match command. + +A prefix list itself has similar characteristics to a route map. The list consists of one or more statements with the same text name. Each statement has a sequence number to allow deletion of individual commands, and insertion of commands into a particular sequence position. Each command has a permit or deny action—but because it is used only for matching packets, the permit or deny keyword just implies whether a route is matched (permit) or not (deny). The generic command syntax is as follows: +ip prefix-list list-name [seq seq-value] {deny network/length | permit network/length}[ge ge-value] [le le-value] + +The sometimes tricky and interesting part of working with prefix lists is that the mean-ing of the network/length, ge-value, and le-value parameters changes depending on the syntax. The network/length parameters define the values to use to match the route prefix. For example, a network/length of 10.0.0.0/8 means “any route that begins with a 10 in the first octet and has a /8 mask.” The ge and le options are used for comparison +to the prefix length—in other words, to the number of binary 1s in the subnet mask. For example, ge 20 le 22 matches only routes whose masks are /20, /21, or /22. So, prefix list logic can be summarized into a two-step comparison process for each route: +1. The route’s prefix must be within the range of addresses implied by the prefix-list command’s network/length parameters. + +2. The route’s prefix length must match the range of prefixes implied by the prefix-list command. + +The potentially tricky part of the logic relates to knowing the range of prefix lengths checked by this logic. The range is defined by the ge-value and le-value parameters, which stand for greater-than-or-equal-to and less-than-or-equal-to . Table 11-4 formal-izes the logic, including the default values for ge-value and le-value. In the table, note that conf-length refers to the prefix length configured in the network/prefix (required) parameter, and route-length refers to the prefix length of a route being examined by the prefix list. + +Table 11-4 LE and GE Parameters on IP Prefix List, and the Implied Range of Prefix Lengths + + +Prefix List Parameters +Neither + +Only le + +Only ge + +Both ge and le + +Range of Prefix Lengths + +conf-length = route-length + +conf-length <= route-length <= le-value + +ge-value <= route-length <= 32 + +ge-value <= route-length <= le-value +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 643 + +Several examples can really help nail down prefix list logic. The following routes will be examined by a variety of prefix lists, with the routes numbered for easier reference: +1. 10.0.0.0/8 + +2. 10.128.0.0/9 + +3. 10.1.1.0/24 + +4. 10.1.2.0/24 + +5. 10.128.10.4/30 + +6. 10.128.10.8/30 + +Next, Table 11-5 shows the results of seven different one-line prefix lists applied to these six example routes. The table lists the matching parameters in the prefix-list commands, omitting the first part of the commands. The table explains which of the six routes would match the listed prefix list and why. + +Table 11-5 Example Prefix Lists Applied to the List of Routes + + +prefix-list Command Parameters +10.0.0.0/8 + +10.128.0.0/9 + + + +10.0.0.0/8 ge 9 + + + +10.0.0.0/8 ge 24 le 24 + + +10.0.0.0/8 le 28 + +0.0.0.0/0 + + + +0.0.0.0/0 le 32 + +Routes Matched +1 + +2 + + + +2–6 + + + +3, 4 + + +1–4 + +None + + + +All + +Results + +Without ge or le configured, both the prefix (10.0.0.0) and length (8) must be an exact match. +Without ge or le configured, the prefix (10.128.0.0) and length (9) must be an exact match; only the second route in the list is matched by this prefix list. +The 10.0.0.0/8 means “all routes whose first octet is 10,” effectively representing an address range. The prefix length must be between 9 and 32, inclusive. +The 10.0.0.0/8 means “all routes whose first octet is 10,” and the prefix range is 24 to 24—meaning only routes with prefix length 24. +The prefix length needs to be between 8 and 28, inclusive. +0.0.0.0/0 means “match all prefixes, with prefix length of exactly 0.” So, it would match all routes’ prefixes but none of their prefix lengths. Only a default route would match this prefix list. +The range implied by 0.0.0.0/0 is all IPv4 addresses. The le 32 then implies any prefix length between 0 and 32, inclusive. This is the syntax for “match all” prefix list logic. +644 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Administrative Distance + +A single router can learn routes using multiple IP routing protocols, as well as through connected and static routes. When a router learns a particular route from multiple sources, the router cannot use the metrics to determine the best route, because the metrics are based on different units. So, the router uses each route’s administrative distance (AD) to determine which is best, with the lower number being better. Table 11-6 lists the default AD values for the various routing sources. + +Table 11-6 Administrative Distances Key +Topic Route Type Administrative Distance + +Connected 0 + +Static 1 + +EIGRP summary route 5 + +EBGP 20 + +EIGRP (internal) 90 + +IGRP 100 + +OSPF 110 + +IS-IS 115 + +RIP 120 + +EIGRP (external) 170 + +iBGP 200 + +Unreachable 255 + + +The defaults can be changed by using the distance command. The command differs among all three IGPs covered in this book. The generic versions of the distance router subcommand for RIP, Enhanced Interior Gateway Routing Protocol (EIGRP), and Open Shortest Path First (OSPF), respectively, are as follows: + +distance distance +distance eigrp internal-distance external-distance +distance ospf {[ intra-area dist1] [inter-area dist2] [external dist3]} + +As you can see, EIGRP and OSPF can set a different AD depending on the type of route as well, whereas RIP cannot. You can also use the distance command to set a router’s view of the AD per route, as is covered later in this chapter. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 645 + +Route Redistribution + +Although using a single routing protocol throughout an enterprise might be preferred, many enterprises use multiple routing protocols because of business mergers and acqui-sitions, organizational history, or in some cases for technical reasons. Route redistribu-tion allows one or more routers to take routes learned through one routing protocol and advertise those routes through another routing protocol so that all parts of the internet-work can be reached. + +To perform redistribution, one or more routers run both routing protocols, with each routing protocol placing routes into that router’s routing table. Then, each routing pro-tocol can take all or some of the other routing protocol’s routes from the routing table and advertise those routes. This section begins by looking at the mechanics of how to perform simple redistribution on a single router, and ends with a discussion of tools and issues that matter most when redistributing on multiple routers. + +Mechanics of the redistribute Command + +The redistribute router subcommand tells one routing protocol to take routes from another routing protocol. This command can simply redistribute all routes or, by using matching logic, redistribute only a subset of the routes. The redistribute command also supports actions for setting some parameters about the redistributed routes—for exam-ple, the metric. + +The full syntax of the redistribute command is as follows: + +redistribute protocol [process-id] [level-1 | level-1-2 | level-2] [as-number] +[metric metric-value] [metric-type type-value] [match {internal | external 1 | external 2}] [ tag tag-value] [route-map map-tag] [subnets] +The redistribute command identifies the routing source from which routes are taken, and the router command identifies the routing process into which the routes are advertised. For example, the redistribute eigrp 1 command tells the router to take routes from EIGRP process 1; if that command were under router rip, the routes would be redistrib-uted into RIP, enabling other RIP routers in the network to see some or all routes coming from EIGRP AS 1. + +The redistribute command has a lot of other parameters as well, most of which will be described in upcoming examples. The first few examples use the network shown in +Figure 11-2. In this network, each IGP uses a different class A network just to make the results of redistribution more obvious. Also note that the numbering convention is such that each of R1’s connected WAN subnets has 1 as the third octet, and each LAN subnet off R3, R4, and R5 has 2 as the third octet. +646 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 +R1 + + +RIP +Network 13.0.0.0 + +OSPF 1 (Two Areas, with R5 as ABR) Network 15.0.0.0 +RID 5.5.5.5 + + + +13.1.2.3/24 Fa0/0 + + +R3 .3 13.1.1.0/24 +0/0/0.1 .1 + + +15.1.1.0/24 +.1 + +15.1.2.5/24 .5 R5 Fa0/0 0/0.1 + + + + +14.1.2.4/24 +Fa0/0 R4 + +.1 RID +.4 14.1.1.0/24 1.1.1.1 0/0/0.1 + + +EIGRP 1 Network 14.0.0.0 + +Figure 11-2 Sample Network for Default Route Examples + + +Redistribution Using Default Settings + +The first example configuration meets the following design goals: + +■ R1 redistributes between each pair of IGPs—RIP, EIGRP, and OSPF. + +■ Default metrics are used whenever possible; when required, the metrics are config-ured on the redistribute command. + +■ Redistribution into OSPF uses the nondefault subnets parameter, which causes sub-nets to be advertised into OSPF. + +■ All other settings use default values. + +Example 11-1 shows R1’s configuration for each routing protocol, along with show com-mands from all four routers to highlight the results of the redistribution. + +Example 11-1 Route Redistribution with Minimal Options + +! EIGRP redistributes from OSPF (process ID 1) and RIP. EIGRP must +! set the metric, as it has no default values. It also uses the +! no auto-summary command so that subnets will be redistributed into +! EIGRP. +router eigrp 1 +redistribute ospf 1 metric 1544 5 255 1 1500 +redistribute rip metric 1544 5 255 1 +network 14.0.0.0 +no auto-summary +! OSPF redistributes from EIGRP (ASN 1) and RIP. OSPF defaults the +! metric to 20 for redistributed IGP routes. It must also use the +! subnets option in order to redistribute subnets. +router ospf 1 +router-id 1.1.1.1 +redistribute eigrp 1 subnets +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 647 + +redistribute rip subnets +network 15.0.0.0 0.255.255.255 area 0 +! RIP redistributes from OSPF (process ID 1) and EIGRP (ASN 1). RIP +! must set the metric, as it has no default values. It also uses the +! no auto-summary command so that subnets will be redistributed into +! EIGRP. +router rip +version 2 +redistribute eigrp 1 metric 2 +redistribute ospf 1 metric 3 +network 13.0.0.0 +no auto-summary +! R1 has a connected route (x.x.1.0) in networks 13, 14, and 15, as well as +! an IGP-learned route (x.x.2.0). +R1# show ip route +! lines omitted for brevity +10.0.0.0/24 is subnetted, 1 subnets +C 10.1.1.0 is directly connected, FastEthernet0/0 +13.0.0.0/24 is subnetted, 2 subnets +C 13.1.1.0 is directly connected, Serial0/0/0.3 +R 13.1.2.0 [120/1] via 13.1.1.3, 00:00:07, Serial0/0/0.3 +14.0.0.0/24 is subnetted, 2 subnets +D 14.1.2.0 [90/2172416] via 14.1.1.4, 00:58:20, Serial0/0/0.4 +C 14.1.1.0 is directly connected, Serial0/0/0.4 +15.0.0.0/24 is subnetted, 2 subnets +O IA 15.1.2.0 [110/65] via 15.1.1.5, 00:04:25, Serial0/0/0.5 +C 15.1.1.0 is directly connected, Serial0/0/0.5 +! R3 learned two routes each from nets 14 and 15. +! Compare the metrics set on R1's RIP redistribute command to the metrics below. +R3# show ip route rip +14.0.0.0/24 is subnetted, 2 subnets +R 14.1.2.0 [120/2] via 13.1.1.1, 00:00:19, Serial0/0/0.1 +R 14.1.1.0 [120/2] via 13.1.1.1, 00:00:19, Serial0/0/0.1 +15.0.0.0/24 is subnetted, 2 subnets +R 15.1.2.0 [120/3] via 13.1.1.1, 00:00:19, Serial0/0/0.1 +R 15.1.1.0 [120/3] via 13.1.1.1, 00:00:19, Serial0/0/0.1 +! R4 learned two routes each from nets 13 and 15. +! EIGRP injected the routes as external (EX), which are considered AD 170. +R4# show ip route eigrp +13.0.0.0/24 is subnetted, 2 subnets +D EX 13.1.1.0 [170/2171136] via 14.1.1.1, 00:09:57, Serial0/0/0.1 +D EX 13.1.2.0 [170/2171136] via 14.1.1.1, 00:09:57, Serial0/0/0.1 +15.0.0.0/24 is subnetted, 2 subnets +D EX 15.1.2.0 [170/2171136] via 14.1.1.1, 01:00:27, Serial0/0/0.1 +D EX 15.1.1.0 [170/2171136] via 14.1.1.1, 01:00:27, Serial0/0/0.1 +! R5 learned two routes each from nets 13 and 14. +648 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! OSPF by default injected the routes as external type 2, cost 20. +R5# show ip route ospf +13.0.0.0/24 is subnetted, 2 subnets +O E2 13.1.1.0 [110/20] via 15.1.1.1, 00:36:12, Serial0/0.1 +O E2 13.1.2.0 [110/20] via 15.1.1.1, 00:36:12, Serial0/0.1 +14.0.0.0/24 is subnetted, 2 subnets +O E2 14.1.2.0 [110/20] via 15.1.1.1, 00:29:56, Serial0/0.1 +O E2 14.1.1.0 [110/20] via 15.1.1.1, 00:36:12, Serial0/0.1 +! As a backbone router, OSPF on R1 created type 5 LSAs for the four E2 subnets. +! If R1 had been inside an NSSA stub area, it would have created type 7 LSAs. +R5# show ip ospf data | begin Type-5 +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +13.1.1.0 +13.1.2.0 +14.1.1.0 +14.1.2.0 + +1.1.1.1 +1.1.1.1 +1.1.1.1 +1.1.1.1 + +1444 0x80000002 0x000785 0 +1444 0x80000002 0x00FB8F 0 +1444 0x80000002 0x00F991 0 +1444 0x80000002 0x00EE9B 0 + + +Metrics must be set through configuration when redistributing into RIP and EIGRP, whereas OSPF uses default values. In the example, the two redistribute commands under router rip used hop counts of 2 and 3 just so that the metrics could be easily seen in the show ip route command output on R3. The EIGRP metric in the redistribute command must include all five metric components, even if the last three are ignored by EIGRP’s metric calculation (as they are by default). The redistribute rip metric 1544 5 255 1 1500 command lists EIGRP metric components of bandwidth, delay, reliability, load, and MTU, in order. OSPF defaults to cost 20 when redistributing from an IGP, and 1 when redistributing from BGP. + +The redistribute command redistributes only routes in that router’s current IP routing table. When redistributing from a given routing protocol, the redistribute command takes routes listed in the IP routing table as being learned from that routing protocol. Interestingly, the redistribute command can also pick up connected routes. For example, R1 has an OSPF route to 15.1.2.0/24, and a connected route to 15.1.1.0/24. However, R3 (RIP) and R4 (EIGRP) redistribute both of these routes—the OSPF-learned route and one connected route—as a result of their respective redistribute ospf commands. As it turns out, the redistribute command causes the router to use the following logic to choose which routes to redistribute from a particular IGP protocol: + +1. +Key Topic +2. + + +Take all routes in my routing table that were learned by the routing protocol from which routes are being redistributed. + +Take all connected subnets matched by that routing protocol’s network commands. + + +Example 11-1 shows several instances of exactly how this two-part logic works. For example, R3 (RIP) learns about connected subnet 14.1.1.0/24, because RIP redistributes from EIGRP, and R1’s EIGRP network 14.0.0.0 command matches that subnet. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 649 + +The redistribute command includes a subnets option, but only OSPF needs to use it. By default, when redistributing into OSPF, OSPF redistributes only routes for classful net-works, ignoring subnets. By including the subnets option, OSPF redistributes subnets as well. The other IGPs redistribute subnets automatically; however, if at a network bound-ary, the RIP or EIGRP auto-summary setting would still cause summarization to use the classful network. In Example 11-1, if either RIP or EIGRP had used auto-summary, each redistributed network would show just the classful networks. For example, if RIP had configured auto-summary in Example 11-1, R3 would have a route to networks 14.0.0.0/8 and 15.0.0.0/8, but no routes to subnets inside those class A networks. + +Setting Metrics, Metric Types, and Tags + +Cisco IOS provides three mechanisms for setting the metrics of redistributed routes, as follows: + +1. Key +Topic +2. + + +3. + + +Call a route map from the redistribute command, with the route map using the set metric command. This method allows different metrics for different routes. + +Use the metric option on the redistribute command. This sets the same metric for all routes redistributed by that redistribute command. + +Use the default-metric command under the router command. This command sets the metric for all redistributed routes whose metric was not set by either of the other +two methods. + + +The list implies the order of precedence if more than one method defines a metric. For example, if a route’s metric is set by all three methods, the route map’s metric is used. If the metric is set on the redistribute command and there is a default-metric command as well, the setting on the redistribute command takes precedence. + +The redistribute command also allows a setting for the metric-type option, which really refers to the route type. For example, routes redistributed into OSPF must be OSPF external routes, but they can be either external type 1 (E1) or type 2 (E2) routes. Table 11-7 summarizes the defaults for metrics and metric types. + +Table 11-7 Default Metrics and Route Metric Types in IGP Route Redistribution +Key +Topic IGP into Which Routes Are Default Default (and Possible) Metric Types Redistributed Metric + +RIP None + +EIGRP None + +OSPF 20/1* + +IS-IS 0 + +RIP has no concept of external routes + +External + +E2 (E1 or E2) + +L1 (L1, L2, L1/L2, or external) + + +* OSPF uses cost 20 when redistributing from an IGP, and cost 1 when redistributing from BGP. +650 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Redistributing a Subset of Routes Using a Route Map + +Route maps can be referenced by any redistribute command. The route map can actually let all the routes through, setting different route attributes (for example, metrics) for dif-ferent routes. Or it might match some routes with a deny clause, which prevents the route from being redistributed. (Refer to Figure 11-1 for a review of route map logic.) + +Figure 11-3 and Example 11-2 show an example of mutual redistribution between EIGRP and OSPF, with some routes being either filtered or changed using route maps. + +15.0.0.0 on the Right (OSPF) + +14.0.0.0 on the Left (EIGRP) Tagged 5 + +Subnet 15.1.2.0/24 + + + +14.1.1.4/24 +Fa0/0 R4 + +15.1.1.5 +RID 1.1.1.1 15.1.1.0/24 R5 + +15.1.2.5/24 Fa0/0 + + +R1 RID 6.6.6.6 + +From Other EIGRP Routers: 14.2.16.0/23 14.2.18.0/23 14.2.20.0/24 14.2.21.0/24 14.2.22.4/30 14.2.22.8/30 + +14.3.8.0/24 Tagged 99 14.3.9.0/24 Tagged 99 + +15.1.6.0/24 + + + + +Tagged 6 + + +R6 Fa0/0 + + +Externals: 15.6.11.0/24 (E1) 15.6.12.0/24 (E2) + + + +Figure 11-3 OSPF and EIGRP Mutual Redistribution Using Route Maps + +The following list details the requirements for redistribution from OSPF into EIGRP. These requirements use R1’s perspective, because it is the router doing the redistribution. + +■ Routes with next-hop address 15.1.1.5 (R5) should be redistributed, with route tag 5. + +■ E1 routes sourced by R6 (RID 6.6.6.6) should be redistributed, and assigned a route tag of 6. + +■ No other routes should be redistributed. + +The requirements for redistributing routes from EIGRP into OSPF are as follows, again from R1’s perspective: + +■ Routes beginning with 14.2, and with masks /23 and /24, should be redistributed, with metric set to 300. + +■ Other routes beginning with 14.2 should not be redistributed. + +■ Routes beginning with 14.3 should be redistributed, with route tag 99. + +■ No other routes should be redistributed. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 651 + +Most of the explanation of the configuration is provided in the comments in Example 11-2, with a few additional comments following the example. + +Example 11-2 Route Redistribution Using Route Maps + +! No metrics are set on the redistribute commands; either the default metric +! is used, or the route maps set the metrics. The default-metric command +! sets the unused EIGRP metric parameters to "1" because something must be +! configured, but the values are unimportant. +router eigrp 1 +redistribute ospf 1 route-map ospf-into-eigrp +network 14.0.0.0 +default-metric 1544 5 1 1 1 +no auto-summary +! While this configuration strives to use other options besides the options +! directly on the redistribute command, when used by OSPF, you must still +! include the subnets keyword for OSPF to learn subnets from other IGPs. +router ospf 1 +router-id 1.1.1.1 +redistribute eigrp 1 subnets route-map eigrp-into-ospf +network 15.0.0.0 0.255.255.255 area 0 +! ACL A-14-3-x-x matches all addresses that begin 14.3. ACL A-15-1-1-5 matches +! exactly IP address 15.1.1.5. ACL A-6-6-6-6 matches exactly address 6.6.6.6. +ip access-list standard A-14-3-x-x +permit 14.3.0.0 0.0.255.255 +ip access-list standard A-15-1-1-5 +permit 15.1.1.5 +ip access-list standard A-6-6-6-6 +permit 6.6.6.6 +! The prefix lists matches prefixes in the range 14.2.0.0 through 14.2.255.255, +! with prefix length 23 or 24. +ip prefix-list e-into-o seq 5 permit 14.2.0.0/16 ge 23 le 24 +! route-map ospf-into-eigrp was called by the redistribute command under router +! eigrp, meaning that it controls redistribution from OSPF into EIGRP. +! Clause 10 matches OSPF routes whose next hop is 15.1.1.5, which is R5's serial +! IP address. R1's only route that meets this criteria is 15.1.2.0/24. This route +! will be redistributed because the route-map clause 10 has a permit action. +! The route tag is also set to 5. +route-map ospf-into-eigrp permit 10 +match ip next-hop A-15-1-1-5 +set tag 5 +! Clause 15 matches OSPF routes whose LSAs are sourced by router with RID 6.6.6.6, +! namely R6, and also have metric type E1. R6 sources two external routes, but +! only 15.6.11.0/24 is E1. The route is tagged 6. +route-map ospf-into-eigrp permit 15 +match ip route-source A-6-6-6-6 +match route-type external type-1 +652 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +set tag 6 +! route-map eigrp-into-ospf was called by the redistribute command under router +! ospf, meaning that it controls redistribution from EIGRP into OSPF. +! Clause 10 matches using a prefix list, which in turn matches prefixes that begin +! with 14.2, and which have either a /23 or /24 prefix length. By implication, it +! does not match prefix length /30. The metric is set to 300 for these routes. +route-map eigrp-into-ospf permit 10 +match ip address prefix-list e-into-o +set metric 300 +! Clause 18 matches routes that begin 14.3. They are tagged with a 99. +route-map eigrp-into-ospf permit 18 +match ip address A-14-3-x-x +set tag 99 +! Next, the example shows the routes that could be redistributed, and then +! shows the results of the redistribution, pointing out which routes were +! redistributed. First, the example shows, on R1, all routes that R1 could +! try to redistribute into EIGRP. +R1# show ip route 15.0.0.0 +Routing entry for 15.0.0.0/24, 5 known subnets +Attached (2 connections) +Redistributing via eigrp 1 + +O E1 15.6.11.0 [110/84] via 15.1.6.6, 00:21:52, Serial0/0/0.6 +O E2 15.6.12.0 [110/20] via 15.1.6.6, 00:21:52, Serial0/0/0.6 +C 15.1.6.0 is directly connected, Serial0/0/0.6 +O IA 15.1.2.0 [110/65] via 15.1.1.5, 00:21:52, Serial0/0/0.5 +C 15.1.1.0 is directly connected, Serial0/0/0.5 +! R4 sees only two of the five routes from 15.0.0.0, because only two matched +! either of +! the route-map clauses. The other three routes matched the default deny clause. +R4# show ip route 15.0.0.0 +Routing entry for 15.0.0.0/24, 2 known subnets +Redistributing via eigrp 1 +D EX 15.6.11.0 [170/2171136] via 14.1.1.1, 00:22:21, Serial0/0/0.1 +D EX 15.1.2.0 [170/2171136] via 14.1.1.1, 00:22:21, Serial0/0/0.1 +! Still on R4, the show ip eigrp topology command displays the tag. This command +! filters the output so that just one line of output lists the tag values. +R4# sho ip eigrp topo 15.1.2.0 255.255.255.0 | incl tag +Administrator tag is 5 (0x00000005) +R4# sho ip eigrp topo 15.6.11.0 255.255.255.0 | incl tag +Administrator tag is 6 (0x00000006) +! Next, the example shows the possible routes that could be redistributed from +! EIGRP into OSPF. +! The next command (R1) lists all routes that could be redistributed into OSPF. +R1# show ip route 14.0.0.0 +Routing entry for 14.0.0.0/8, 10 known subnets +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 653 + +Attached (1 connections) +Variably subnetted with 3 masks +Redistributing via eigrp 1, ospf 1 + +D 14.3.9.0/24 [90/2297856] via 14.1.1.4, 00:34:48, Serial0/0/0.4 +D 14.3.8.0/24 [90/2297856] via 14.1.1.4, 00:34:52, Serial0/0/0.4 +D 14.1.2.0/24 [90/2172416] via 14.1.1.4, 00:39:27, Serial0/0/0.4 +C 14.1.1.0/24 is directly connected, Serial0/0/0.4 +D 14.2.22.8/30 [90/2297856] via 14.1.1.4, 00:35:49, Serial0/0/0.4 +D 14.2.20.0/24 [90/2297856] via 14.1.1.4, 00:36:12, Serial0/0/0.4 +D 14.2.21.0/24 [90/2297856] via 14.1.1.4, 00:36:08, Serial0/0/0.4 +D 14.2.16.0/23 [90/2297856] via 14.1.1.4, 00:36:34, Serial0/0/0.4 +D 14.2.22.4/30 [90/2297856] via 14.1.1.4, 00:35:53, Serial0/0/0.4 +D 14.2.18.0/23 [90/2297856] via 14.1.1.4, 00:36:23, Serial0/0/0.4 +! Next, on R5, note that the two /30 routes beginning with 14.2 were correctly +! prevented from getting into OSPF. It also filtered the redistribution of the +! two routes that begin with 14.1. As a result, R5 knows only 6 routes in +! network 14.0.0.0, whereas R1 had 10 subnets of that network it could have +! redistributed. Also below, note that the /23 and /24 routes inside 14.2 have +! metric 300. +R5# show ip route 14.0.0.0 +Routing entry for 14.0.0.0/8, 6 known subnets +Variably subnetted with 2 masks + +O E2 14.3.9.0/24 [110/20] via 15.1.1.1, 00:22:41, Serial0/0.1 +O E2 14.3.8.0/24 [110/20] via 15.1.1.1, 00:22:41, Serial0/0.1 +O E2 14.2.20.0/24 [110/300] via 15.1.1.1, 00:22:41, Serial0/0.1 +O E2 14.2.21.0/24 [110/300] via 15.1.1.1, 00:22:41, Serial0/0.1 +O E2 14.2.16.0/23 [110/300] via 15.1.1.1, 00:22:41, Serial0/0.1 +O E2 14.2.18.0/23 [110/300] via 15.1.1.1, 00:22:41, Serial0/0.1 +! The show ip ospf database command confirms that the route tag was set +! correctly. +R5# show ip ospf data external 14.3.8.0 | incl Tag +External Route Tag: 99 + + +Note Route maps have an implied deny clause at the end of the route map. This implied deny clause matches all packets. As a result, any routes not matched in the explicitly configured route-map clauses match the implied deny clause, and are filtered. Both route maps in the example used the implied deny clause to actually filter the routes. +654 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Mutual Redistribution at Multiple Routers + +When multiple routers redistribute between the same two routing protocol domains, several potential problems can occur. One type of problem occurs on the redistributing routers, because those routers will learn a route to most subnets through both routing protocols. That router uses the AD to determine the best route when comparing the best routes from each of the two routing protocols; this typically results in some routes using suboptimal paths. For example, Figure 11-4 shows a sample network, with R3 choosing its AD 110 OSPF route to 10.1.2.0/24 over the probably better AD 120 RIP route. + + +RIP – AD 120 +10.1.3.0/24 + +Possible routes to 10.1.2.0/24: RIP 1 hop through R2, AD 120 +OSPF cost 244 through R4, AD 110 + + +OSPF Area 0 – AD 110 + + +S0/0/0.2 R3 + +10.1.23.0/24 + +S0/0/0.3 10.1.34.0/24 +10.1.4.0/24 + + + +10.1.2.0/24 + +R2 + +R4 RID +4.4.4.4 +10.1.45.0/24 + + + +R1 Redistributes RIP into OSPF + +10.1.12.0/24 + +Fa0/0 + + +10.1.15.0/24 R1 S0/0/0.5 + +10.1.1.0/24 + + + +R5 +10.1.5.0/24 + + + +Figure 11-4 OSPF and RIP Redistribution + + +Note The OSPF configuration for this network matches only the interfaces implied by the OSPF box in Figure 11-4. RIP does not have a wildcard-mask option in the network command, so R1’s and R3’s network commands will match all of their interfaces, as all are in network 10.0.0.0. + + +In Figure 11-4, R3 learns of subnet 10.1.2.0/24 through RIP updates from R2. Also, R1 learns of the subnet with RIP and redistributes the route into OSPF, and then R3 learns of a route to 10.1.2.0/24 through OSPF. R3 chooses the route with the lower administrative distance; with all default settings, OSPF’s AD of 110 is better that RIP’s 120. + +If both R1 and R3 mutually redistribute between RIP and OSPF, the suboptimal route problem would occur on either R1 or R3 for each RIP subnet, all depending on timing. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 655 + +Example 11-3 shows the redistribution configuration, along with R3 having the subop-timal route shown in Figure 11-4. However, after R1’s fa0/0 interface flaps, R1 now has a suboptimal route to 10.1.2.0/24, but R3 has an optimal route. + +Example 11-3 Suboptimal Routing at Different Redistribution Points + +! R1's related configuration follows: +router ospf 1 +router-id 1.1.1.1 +redistribute rip subnets +network 10.1.15.1 0.0.0.0 area 0 +! +router rip +redistribute ospf 1 +network 10.0.0.0 +default-metric 1 +! R3's related configuration follows: +router ospf 1 +router-id 3.3.3.3 +redistribute rip subnets +network 10.1.34.3 0.0.0.0 area 0 +! +router rip +redistribute ospf 1 +network 10.0.0.0 +default-metric 1 +! R3 begins with an AD 110 OSPF route, and not a RIP route, to 10.1.2.0/24. +R3# sh ip route | incl 10.1.2.0 +O E2 10.1.2.0 [110/20] via 10.1.34.4, 00:02:01, Serial0/0/0.4 +! R1 has a RIP route to 10.1.2.0/24, and redistributes it into OSPF, causing R3 +! to learn an OSPF route to 10.1.2.0/24. +R1# sh ip route | incl 10.1.2.0 +R 10.1.2.0 [120/1] via 10.1.12.2, 00:00:08, FastEthernet0/0 +! Next, R1 loses its RIP route to 10.1.2.0/24, causing R3 to lose its OSPF route. +R1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# int fa 0/0 +R1(config-if)# shut +! R3 loses its OSPF route, but can then insert the RIP route into its table. +R3# sh ip route | incl 10.1.2.0 +R 10.1.2.0 [120/1] via 10.1.23.2, 00:00:12, Serial0/0/0.2 +! Not shown: R1 brings up its fa0/0 again +! However, R1 now has the suboptimal route to 10.1.2.0/24, through OSPF. +R1# sh ip route | incl 10.1.2.0 +O E2 10.1.2.0 [110/20] via 10.1.15.5, 00:00:09, Serial0/0/0.5 +656 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The key concept behind this seemingly odd example is that a redistributing router pro-cesses only the current contents of its IP routing table. When this network first came up, R1 learned its RIP route to 10.1.2.0/24, and redistributed into OSPF, before R3 could do the same. So, R3 was faced with the choice of putting the AD 110 (OSPF) or AD 120 (RIP) route into its routing table, and R3 chose the lower AD OSPF route. Because R3 never had the RIP route to 10.1.2.0/24 in its routing table, R3 could not redistribute that RIP route into OSPF. + +Later, when R1’s fa0/0 failed (as shown in Example 11-3), R3 had time to remove the OSPF route and add the RIP route for 10.1.2.0/24 to its routing table—which then allowed R3 to redistribute that RIP route into OSPF, causing R1 to have the suboptimal route. + +To solve this type of problem, the redistributing routers must have some awareness of which routes came from the other routing domain. In particular, the lower-AD routing protocol needs to decide which routes came from the higher-AD routing protocol, and either use a different AD for those routes or filter the routes. The next few sections show a few different methods of preventing this type of problem. + +Preventing Suboptimal Routes by Setting the Administrative Distance + +One simple and elegant solution to the problem of suboptimal routes on redistributing routers is to flag the redistributed routes with a higher AD. A route’s AD is not advertised by the routing protocol. However, a single router can be configured such that it assigns different AD values to different routes, which then impacts that one router’s choice of which routes end up in that router’s routing table. For example, back in Figure 11-4 and Example 11-3, R3 could have assigned the OSPF-learned route to 10.1.2.0/24, an AD higher than 120, thereby preventing the original problem. + +Figure 11-5 shows a more complete example, with a route from the RIP domain (10.1.2.0/24) and another from the OSPF domain (10.1.4.0/24). Redistributing Router R3 will learn the two routes both from RIP and OSPF. When you configure R3’s logic to treat OSPF internal routes with default AD 110, and OSPF external routes with AD 180 (or any other value larger than RIP’s default of 120), R3 will choose the optimal path for both RIP and OSPF routes. + +Example 11-4 shows how to configure both R1 and R3 to use a different AD for external routes by using the distance ospf external 180 command, under the router ospf process. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 657 + + +• For 10.1.2.0/24: Pick AD 120 RIP route over AD 180 OSPF route +• For 10.1.4.0/24: Pick AD 110 OSPF route over AD 120 RIP +RIP – AD 120 route + + + +OSPF: Internal AD 110 External AD 180 + + + + +R3 10.1.4.0/24 +RIP + + +10.1.4.0/24 OSPF Int. + + + +10.1.2.0/24 10.1.2.0/24 RIP + +10.1.2.0/24 +OSPF E2 10.1.4.0/24 + + + +R2 10.1.2.0/24 RIP + + +R4 10.1.2.0/24 +OSPF E2 + + + +10.1.4.0/24 RIP + +10.1.4.0/24 OSPF Int. + + +R1 + + +Routing Info for 10.1.2.0/24 Routing Info for 10.1.4.0/24 + +Figure 11-5 Effect of Differing ADs for Internal and External Routes + +Example 11-4 Preventing Suboptimal Routes with the distance Router Subcommand + +! Both R1's and R3's configurations look like they do in Example 11-3's, but with +! the addition of the distance command. +router ospf 1 +distance ospf external 180 +! R3 has a more optimal RIP route to 10.1.2.0/24, as does R1. +R3# sh ip route | incl 10.1.2.0 +R 10.1.2.0 [120/1] via 10.1.23.2, 00:00:19, Serial0/0/0.2 +! R1 next... +R1# show ip route | incl 10.1.2.0_ +R 10.1.2.0 [120/1] via 10.1.12.2, 00:00:11, FastEthernet0/0 +! R1 loses its next-hop interface for the RIP route, so now its OSPF route, with +! AD 180, is its only and best route to 10.1.2.0/24. +R1# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R1(config)# int fa 0/0 +R1(config-if)# shut +R1(config-if)# do sh ip route | incl 10.1.2.0 +O E2 10.1.2.0 [180/20] via 10.1.15.5, 00:00:05, Serial0/0/0.5 +658 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +EIGRP supports the exact same concept by default, using AD 170 for external routes and 90 for internal routes. In fact, if EIGRP were used instead of OSPF in this example, neither R1 nor R3 would have experienced any of the suboptimal routing. You can reset EIGRP’s distance for internal and external routes by using the distance eigrp router sub-command. (At the time of this writing, neither the Intermediate System–to–Intermediate System [IS-IS] nor RIP distance commands support setting external route ADs and inter-nal route ADs to different values.) + +In some cases, the requirements might not allow for setting all external routes’ ADs to another value. For example, if R4 injected some legitimate external routes into OSPF, the configuration in Example 11-4 would result in either R1 or R3 having a suboptimal route to those external routes that pointed through the RIP domain. In those cases, the dis-tance router subcommand can be used in a different way, influencing some of or all the routes that come from a particular router. The syntax is as follows: +distance { distance-value ip-address {wildcard-mask} [ip-standard-list] [ip-extended-list] + +This command sets three key pieces of information: the AD to be set, the IP address of the router advertising the routes, and optionally, an ACL with which to match routes. With RIP, EIGRP, and IS-IS, this command identifies a neighboring router’s interface address using the ip-address wildcard-mask parameters. With OSPF, those same param-eters identify the RID of the router owning (creating) the link-state advertisement (LSA) for the route. The optional ACL then identifies the subset of routes for which the AD will be set. The logic boils down to something like this: + +Set this AD value for all routes, learned from a router that is defined by the IP address and wildcard mask, and for which the ACL permits the route. +Example 11-5 shows how the command could be used to solve the same suboptimal route problem on R1 and R3, while not causing suboptimal routing for other external routes. The design goals are summarized as follows: + +■ Set a router’s local AD for its OSPF routes for subnets in the RIP domain to a value of 179, thereby making the RIP routes to those subnets better than the OSPF routes to those same subnets. + +■ Do not set the AD for any other routes. + +Example 11-5 Using the distance Command to Reset Particular Routes’ ADs + +! R1 config. Note that the command refers to 3.3.3.3, which is R3's RID. Other +! commands not related to resetting the AD are omitted. Of particular importance, +! the distance command on R1 refers to R3's OSPF RID, because R3 created the OSPF +! LSAs that we are trying to match--the LSAs created when R3 injected the +! routes redistributed from RIP. +router ospf 1 +distance 179 3.3.3.3 0.0.0.0 only-rip-routes +! +ip access-list standard only-rip-routes +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 659 + +permit 10.1.12.0 +permit 10.1.3.0 +permit 10.1.2.0 +permit 10.1.23.0 +! R3 config. Note that the command refers to 1.1.1.1, which is R1's RID. Other +! commands not related to resetting the AD are omitted. Also, the only-rip-routes +! ACL is identical to R1's only-rip-routes ACL. +router ospf 1 +distance 179 1.1.1.1 0.0.0.0 only-rip-routes + + +Preventing Suboptimal Routes by Using Route Tags + +Another method of preventing suboptimal routing on the redistributing routers is to sim-ply filter the problematic routes. Using subnet 10.1.2.0/24 as an example again, R3 could use an incoming distribute-list command to filter the OSPF route to 10.1.2.0/24, allowing R3 to use its RIP route to 10.1.2.0/24. R1 would need to perform similar route filtering as well to prevent its suboptimal route. + +Performing simple route filtering based on IP subnet number works, but the redistributing routers will need to be reconfigured every time subnets change in the higher-AD rout- +ing domain. The administrative effort can be improved by adding route tagging to the process. When you tag all routes taken from the higher-AD domain and advertised into the lower-AD domain, the distribute-list command can make a simple check for that tag. Figure 11-6 shows the use of this idea for subnet 10.1.2.0/24. + + + + +RIP – AD 120 + +Filter incoming OSPF routes: Don’t put routes tagged 9999 in +my routing table! OSPF: AD 110 Filtering Routes with Tag 9999 + + + + + +10.1.2.0/24 RIP + +10.1.2.0/24 + +R3 + +10.1.2.0/24 Tag 9999 +10.1.4.0/24 + + + +R2 + + +10.1.2.0/24 RIP + +R4 + +10.1.2.0/24 Tag 9999 + + +R1 + +When injecting RIP routes into OSPF, tag them with 9999 + +Figure 11-6 Filtering with Reliance on Route Tags +660 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Route tags are simply unitless integer values in the data structure of a route. These tags, typically either 16 or 32 bits long depending on the routing protocol, allow a router to imply something about a route that was redistributed from another routing protocol. For example, R1 can tag its OSPF-advertised route to 10.1.2.0/24 with a tag—say, 9999. OSPF does not define what a tag of 9999 means, but the OSPF protocol includes the tag field in the LSA so that it can be used for administrative purposes. Later, R3 can filter routes based on their tag, solving the suboptimal route problem. + +Figure 11-6 and Example 11-6 depict an example of route tagging and route filtering, used to solve the same old problem with suboptimal routes. R1 and R3 tag all redistrib-uted RIP routes with tag 9999 as they enter the OSPF domain, and then R1 and R3 filter incoming OSPF routes based on the tags. This design works well because R1 can tag all redistributed RIP routes, thereby removing the need to change the configuration every time a new subnet is added to the RIP domain. (Note that both R1 and R3 will tag routes injected from RIP into OSPF as 9999, and both will then filter OSPF-learned routes with tag 9999. Figure 11-6 just shows one direction to keep the figure less cluttered.) + +Example 11-6 Using Route Tags and Distribute Lists to Prevent Suboptimal Routes at Redistributing Routers + +! R1 config. The redistribute command calls the route map that tags routes taken +! from RIP as 9999. distribute-list looks at routes learned in OSPF that were +! earlier tagged by R3. +router ospf 1 +redistribute rip subnets route-map tag-rip-9999 +network 10.1.15.1 0.0.0.0 area 0 +distribute-list route-map check-tag-9999 in +! Clause 10, a deny clause, matches all tagged 9999 routes--so those +! routes are filtered. Clause 20 permits all other routes, because with no match +! subcommand, the clause is considered to "match all." +route-map check-tag-9999 deny 10 +match tag 9999 +! +route-map check-tag-9999 permit 20 +! tag-rip-9999 matches all routes (it has no match command), and then +! tags them all with tag 9999. This route-map is used only for routes taken from +! RIP into OSPF. +route-map tag-rip-9999 permit 10 +set tag 9999 +! R3 Config +! The R3 configuration does not have to use the same names for route maps, but +! the essential elements are identical, so the route maps are not repeated here. +router ospf 1 +redistribute rip subnets route-map tag-rip-9999 +network 10.1.34.3 0.0.0.0 area 0 +distribute-list route-map check-tag-9999 in +! R3 (shown) and R1 have RIP routes to 10.1.2.0, as well as other routes from the +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 661 + +! RIP domain. Also, note that the OSPF LSDB shows the tagged values on the routes. +R3# show ip route | incl 10.1.2.0 +R 10.1.2.0 [120/1] via 10.1.23.2, 00:00:26, Serial0/0/0.2 +R3# sh ip ospf data | begin Type-5 +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag + +10.1.1.0 +10.1.1.0 +10.1.2.0 +10.1.2.0 + +1.1.1.1 834 +3.3.3.3 458 +1.1.1.1 834 +3.3.3.3 458 + +0x80000006 0x00CE86 9999 +0x80000003 0x0098B7 9999 +0x80000006 0x00C390 9999 +0x80000003 0x008DC1 9999 + +! lines omitted for brevity +! Next, the unfortunate side effect of filtering the routes--R3 does not have an +! alternative route to RIP subnets, although OSPF internal routers (like R4 +! in Figure 11-6) will. +R3# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R3(config)# int s0/0/0.2 +R3(config-subif)# shut +R3(config-subif)# ^Z +R3# sh ip route | incl 10.1.2.0 +R3# + +The last few lines of the example show the largest negative of using route filtering to pre-vent the suboptimal routes. When R3 loses connectivity to R2, R3 does not use the alter-nate route through the OSPF domain. R3’s filtering of those routes occurs regardless of whether R3’s RIP routes are available or not. As a result, using a solution that manipulates the AD might ultimately be the better solution to this suboptimal-routing problem. + +Using Metrics and Metric Types to Influence Redistributed Routes + +A different set of issues can occur for a router that is internal to a single routing domain, like R4 and R5 in Figure 11-4. The issue is simple—with multiple redistributing routers, an internal router learns multiple routes to the same subnet, so it must pick the best route. As covered earlier in the chapter, the redistributing routers can set the metrics; by setting those metrics with meaningful values, the internal routers can be influenced to use a par-ticular redistribution point. + +Interestingly, internal routers might not use metric as their first consideration when choosing the best route. For example, an OSPF internal router will first take an intra-area route over an inter-area route, regardless of their metrics. Table 11-8 lists the criteria an internal router will use when picking the best route, before considering the metrics of the different routes. +662 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Key Topic + +Table 11-8 IGP Order of Precedence for Choosing Routes Before Considering the Metric + +IGP Order of Precedence of Metric +RIP No other considerations + +EIGRP Internal, then external + +OSPF Intra-area, inter-area, E1, then E2* + +IS-IS L1, L2, external + +* For E2 routes whose metric ties, OSPF also checks the cost to the advertising ASBR. + +To illustrate some of these details, Example 11-7 focuses on R4 and its routes to 10.1.2.0/24 and 10.1.5.0/24 from Figure 11-4. The example shows the following, in order: +1. R1 and R3 advertise 10.1.2.0/24 as an E2 route, metric 20. R4 uses the route through R3, because R4’s cost to reach ASBR R3 is lower than its cost to reach ASBR R1. + +2. After changing R1 to advertise redistributed routes into OSPF as E1 routes, R4 uses the E1 routes through R1, even though the metric is larger than the E2 route through R3. +3. R4 uses it higher-metric intra-area route to 10.1.5.0/24 through R5. Then, the R4-R5 link fails, causing R4 to use the OSPF external E2 route to 10.1.5.0/24—the route that leads through the RIP domain and back into OSPF through the R3-R2-R1-R5 path. + +Example 11-7 Demonstration of the Other Decision Criteria for Choosing the Best Routes + +! R4 has E2 routes to all the subnets in the RIP domain, and they all point to R3. +R4# sh ip route ospf +10.0.0.0/24 is subnetted, 10 subnets +O 10.1.15.0 [110/128] via 10.1.45.5, 00:03:23, Serial0/0/0.5 +O E2 10.1.12.0 [110/20] via 10.1.34.3, 00:03:23, Serial0/0/0.3 +O E2 10.1.3.0 [110/20] via 10.1.34.3, 00:03:23, Serial0/0/0.3 +O E2 10.1.2.0 [110/20] via 10.1.34.3, 00:03:23, Serial0/0/0.3 +O E2 10.1.1.0 [110/20] via 10.1.34.3, 00:03:23, Serial0/0/0.3 +O 10.1.5.0 [110/65] via 10.1.45.5, 00:03:23, Serial0/0/0.5 +O E2 10.1.23.0 [110/20] via 10.1.34.3, 00:03:23, Serial0/0/0.3 +! R4 chose the routes through R3 instead of R1 due to the lower cost to R3. +R4# show ip ospf border-routers +OSPF Process 1 internal Routing Table +Codes: i - Intra-area route, I - Inter-area route + +i 1.1.1.1 [128] via 10.1.45.5, Serial0/0/0.5, ASBR, Area 0, SPF 13 +i 3.3.3.3 [64] via 10.1.34.3, Serial0/0/0.3, ASBR, Area 0, SPF 13 +! (Not Shown): R1 is changed to redistribute RIP routes as E1 routes by +! adding the metric-type 1 option on the redistribute command on R1. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 663 + +! R4 picks routes through R1 because they are E1 routes, even though the metric +! (148) is higher than the routes through R3 (cost 20) +R4# show ip route ospf +10.0.0.0/24 is subnetted, 10 subnets +O E1 10.1.2.0 [110/148] via 10.1.45.5, 00:00:11, Serial0/0/0.5 +! lines omitted for brevity +! R4's route to 10.1.5.0/24 below is intra-area, metric 65 +R4# show ip route | incl 10.1.5.0 +O 10.1.5.0 [110/65] via 10.1.45.5, 00:04:48, Serial0/0/0.5 +! (Not Shown): R4 shuts down link to R5 +! R4's new route to 10.1.5.0/24 is E2, learned from R3, with metric 20 +R4# show ip route | incl 10.1.5.0\ +O E2 10.1.5.0 [110/20] via 10.1.34.3, 00:10:52, Serial0/0/0.3 + + +Route Summarization + +Route summarization creates a single route whose numeric range, as implied by the pre-fix/prefix length, is larger than the one or more smaller component routes. For example, 10.1.0.0/16 is a summary route that includes component subnets 10.1.1.0/24, 10.1.4.132/30, and any other subnets with the range 10.1.0.0 through 10.1.255.255. + + +Note I use the term component route to refer to a route whose range of IP addresses is a subset of the range specified by a summary route; however, I have not seen this term in other reference materials from Cisco. + + +The following list details some of the key features that the three IGPs covered in this book have in common with regard to how route summarization works (by default): + +■ The advertised summary is assigned the same metric as the currently lowest-metric component subnet. + +■ The router does not advertise the component subnets. + +■ The router does not advertise the summary when its routing table does not have any of the component subnets. + +■ The summarizing router creates a local route to the summary, with destination null0, to prevent routing loops. + +■ Summary routes reduce the size of routing tables and topology databases, indirectly improving convergence. + +■ Summary routes decrease the amount of specific information in routing tables, sometimes causing suboptimal routing. + +Figure 11-7 depicts the suboptimal-routing side effect when using route summarization. It also depicts the effect of using a summary to null0 on the summarizing router. +664 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 +route to Null0 – Discard + + + +R3 Routing Table: 10.1.1.0/24… 10.1.2.0/24… 10.2.2.0/24… 10.0.0.0/8, to null0 + +• Packet to 10.3.3.1 matches Both packets match my • Packet to 10.2.2.1 matches best route to 10.0.0.0/8, +specific route – Forward +which points to R3 +Summary 10.0.0.0/8 + +Packet to 10.3.3.1 + + +R3 Packet to 10.2.2.1 R4 + +Subnets That All Begin with 10.1 + + + + + +Subnets That All Begin with 10.2 +Subnet 10.2.2.0/24 + + + + +Summary 10.0.0.0/8 + + + + + +R1 + + + +R4 Routing Table: 10.0.0.0/8, to R3 + + + +Represents Routing Updates Represents Example Packets + +Figure 11-7 Route Summarization Suboptimal Routing and Routing to Null0 + +In Figure 11-7, R4 learned two paths to summary route 10.0.0.0/8, and picked the route through R3 based on the metric. Because R4 does not have a route for 10.2.2.0/24, R4 then sends any packets to that subnet based on its route to network 10.0.0.0/8, through R3. So, although subnets like 10.2.2.0/24 might be topologically closer to R4 through R1, R4 sends the packets through the scenic, suboptimal route through R3. + +Also note that R4’s summary route to 10.0.0.0/8 matches packets for which the compo-nent subnet does not exist anywhere in the network. In that case, routers like R4 forward the packets based on the larger summary, but when the packet reaches the router that cre-ated the summary, the packet is discarded by the summarizing router because of its null route. For example, Figure 11-7 shows R4 forwarding a packet destined to 10.3.3.1 to R3. R3 does not have a more specific route than its route to 10.0.0.0/8, with next-hop inter-face null0. As a result, R3 discards the packet. + +The sections that follow provide a few details about summarization with each routing protocol. + +EIGRP Route Summarization + +EIGRP provides the easiest and most straightforward rules for summarizing routes as compared with RIPv2, OSPF, and IS-IS. To summarize routes, the ip summary-address eigrp as-number network-address subnet-mask [admin-distance] command is placed under an interface. If any of the component routes are in that router’s routing table, EIGRP advertises the summary route out that interface. The summary is defined by the network-address subnet-mask parameters. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 665 + +One of the more interesting features of the EIGRP summary is the ability to set the AD of the summary route. The AD is not advertised with the route. The summarizing router, however, uses the configured AD to determine whether the null route for the summary should be put into its routing table. The EIGRP AD for summary routes defaults to 5. + +OSPF Route Summarization + +All OSPF routers in the same area must have identical link-state databases (LSDB) after flooding is complete. As a result, all routers in the same OSPF area must have the same summary routes, and must be missing the same component subnets of each summary. To make that happen, OSPF allows route summarization only as routes are injected into an area, either by an Area Border Router ABR (inter-area routes) or by an Autonomous System Boundary Router ASBR (external routes). + +OSPF uses two different configuration commands to create the summary routes, depend-ing on whether the summary is for inter-area or external routes. Table 11-9 lists the two commands. Both commands are configured under router ospf. + +Table 11-9 OSPF Route Summarization Commands Key +Topic Where Used Command + +ASBR summary-address {{ip-address mask} | {prefix mask}} [not-advertise] [tag tag] + +ABR area area-id range ip-address mask [advertise | not-advertise] [cost cost] + + +The commands have a couple of important attributes. First, the area range command specifies an area; this area is the area in which the component subnets reside, with the summary being advertised into all other areas. Also, the area range command can set the cost for the summary route, instead of using the lowest cost of all component routes. Also, the not-advertise keyword can essentially be used to filter the subnets implied by the summary, as covered in Chapter 9, “OSPF.” + +The summary-address command summarizes external routes as they are injected into OSPF as an ASBR. The cost can be assigned, and the routes can be filtered using the not-advertise keyword. + +Default Routes + +Routers forward packets using a default route when there are no specific routes that match a packet’s destination IP address in the IP routing table. Routing protocols can advertise default routes, with each router choosing the best default route to list as that router’s gateway of last resort. This section covers how a router can create a default route and then cause an IGP to advertise the default route. + +In addition to the advertisement of default routes, each router can use one of two options for how the default route is used. As described in Chapter 6, “IP Forwarding (Routing),” +666 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +each router’s configuration includes either the (default) ip classless command or the no ip classless command. With ip classless, if a packet’s destination does not match a specific route in the IP routing table, the router uses the default route. With no ip classless, the router first checks to see whether any part of the destination address’s classful network +is in the routing table. If so, that router will not use the default route for forwarding that packet. + + +Note The topic of default routing requires discussion of the configuration on one router, plus configuration of the other routers using the same IGP. For this section, I will call the router with the default routing configuration the “local” router and other routers using the same IGP “other” routers. + + +Cisco IOS supports five basic methods of advertising default routes with IGPs, four of which are covered here. One method for advertising a default route is for one routing pro-tocol to redistribute another routing protocol’s default route. Because route redistribution has already been covered heavily, this section of the chapter covers other methods. Of the other four methods, not all are supported by all IGPs, as you can see in Table 11-10. + +Table 11-10 Four Methods for Learning Default Routes +Key +Topic Feature RIP EIGRP OSPF + +Static route to 0.0.0.0, with the redistribute static command Yes Yes No + +The default-information originate command Yes No Yes + +The ip default-network command Yes Yes No + +Using summary routes No Yes No + + +Interestingly, when a router learns of multiple default routes, using any of these methods, it will use the usual process for choosing the best route: administrative distance, route type (per Table 11-8, earlier in this chapter), and lowest metric, in that order. + + +Note Table 11-10 has details that might be difficult to memorize. To make it easier, you could start by ignoring the use of summary static routes, because it is not recommended by Cisco. Then, note that RIP supports the other three methods, whereas EIGRP supports two methods and OSPF supports only one—with EIGRP and OSPF not supporting any of the same options. + + +Figure 11-8 shows a sample network used with all the default route examples, in which R1 is the local router that configures the default routing commands. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 667 + + +RIP +Network 13.0.0.0 + +OSPF 1 (Two Areas, with R5 as ABR) Network 15.0.0.0 +RID 5.5.5.5 + + + +13.1.2.3/24 +Fa0/0 R3 + + +13.1.1.0/24 15.1.1.0/24 +.3 RID 1.1.1.1 +.1 .1 +0/0/0.1 + +15.1.2.5/24 .5 R5 Fa0/0 0/0.1 + + + + +14.1.2.4/24 +Fa0/0 R4 + + +.1 +14.1.1.0/24 +.4 0/0/0.1 + +R1 .1 +Fa0/0 +17.1.1.0/24 + + +.7 17.1.2.7/24 R7 Fa0/0 + + + +EIGRP 1 Network 14.0.0.0 + +IS-IS (Both Routers Are L2) 10.1.1.102/24 Network 17.0.0.0 + + +R9 + +Figure 11-8 Sample Network for Default Route Examples + + +Using Static Routes to 0.0.0.0, with redistribute static + +Routers consider a route to 0.0.0.0/0 as a default route. RIP and EIGRP support redistribu-tion of static routes, including such a default static route. The rules and conditions for redistributing static defaults into RIP and EIGRP are as follows: + + +■ +Key Topic + +■ + + +■ + + +■ + +■ + +The static ip route 0.0.0.0 0.0.0.0 and redistribute static commands need to be con-figured on the same local router. + +The metric must be defaulted or set, using the same methods covered earlier in this chapter. + +The redistribute command can refer to a route map, which examines all static routes (not just the default). + +EIGRP treats the default route as an external route by default, with default AD 170. + +This method is not supported by OSPF. + + +Example 11-8 shows how R1 can inject defaults through RIP to R3 and through EIGRP to R4. The EIGRP configuration refers to a route map that examines all static routes, match-ing only static default routes. If other static routes existed, EIGRP would not advertise those routes based on the route map. + +Example 11-8 Static Default Route with Route Redistribution + +! R1 Config--note that ip classless is configured, but it does not impact the +! advertisement of the static route at all. +router eigrp 1 +redistribute static route-map just-default +network 10.0.0.0 +network 14.0.0.0 +default-metric 1544 10 1 1 1 +668 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +! +router rip +version 2 +redistribute static +network 13.0.0.0 +default-metric 1 +! +ip classless +! The static route is configured next, followed by the prefix list that matches +! the default route, and the route map that refers to the prefix list. +ip route 0.0.0.0 0.0.0.0 10.1.1.102 +! +ip prefix-list zero-prefix seq 5 permit 0.0.0.0/0 +! +route-map just-default permit 10 +match ip address prefix-list zero-prefix +! +route-map just-default deny 20 +! Next, R3, the RIP router, lists R1 (13.1.1.1) as its gateway of last resort, +! based on the RIP route to 0.0.0.0/0, next hop 13.1.1.1. +R3# sh ip route +! Lines omitted for brevity +Gateway of last resort is 13.1.1.1 to network 0.0.0.0 + +13.0.0.0/24 is subnetted, 2 subnets +C 13.1.1.0 is directly connected, Serial0/0/0.1 +C 13.1.2.0 is directly connected, FastEthernet0/0 +R* 0.0.0.0/0 [120/1] via 13.1.1.1, 00:00:12, Serial0/0/0.1 +! Next, R4, the EIGRP router, lists R1 (14.1.1.1) as its gateway of last resort, +! based on the EIGRP route to 0.0.0.0/0, next hop 14.1.1.1. Note that the default +! points to 0.0.0.0/0, AD 170, as it is an external route, due to the EX listed +! in the output of the show ip route command. +R4# sh ip route +! lines omitted for brevity +Gateway of last resort is 14.1.1.1 to network 0.0.0.0 + +D 10.0.0.0/8 [90/2172416] via 14.1.1.1, 00:01:30, Serial0/0/0.1 +14.0.0.0/24 is subnetted, 2 subnets +C 14.1.2.0 is directly connected, FastEthernet0/0 +C 14.1.1.0 is directly connected, Serial0/0/0.1 +D*EX 0.0.0.0/0 [170/2172416] via 14.1.1.1, 00:01:30, Serial0/0/0.1 +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 669 + +Using the default-information originate Command + +OSPF does not support redistribution of statically defined default routes. Instead, OSPF requires the default-information originate router subcommand, which essentially tells OSPF to redistribute any default routes found in the routing table, either static routes or routes from another routing protocol. The following list summarizes the default routing features when using the default-information originate command with OSPF: + +■ Redistributes any default route (0.0.0.0/0) in the routing table. +Key +Topic ■ The command can set the metric and metric type directly, with OSPF defaulting to cost 1 and type E2. + +■ OSPF allows the use of the always keyword, which means that a default is sourced regardless of whether a default route is in the routing table. + +■ Not supported by EIGRP. + +■ Supported by RIP, with some differences. (Refer to the text following Example 11-9 for an explanation of the differences.) + +Example 11-9 shows an example of using the default-information originate command with OSPF. In this case, R1 has learned a route to 0.0.0.0/0 through BGP from R9 in Figure 11-8. + +Example 11-9 Static Default Route with Route Redistribution + +router ospf 1 +network 15.0.0.0 0.255.255.255 area 0 +default-information originate +! R5 has a default route, defaulting to type E2, cost 1. It as advertised as a +! type 5 LSA. +R5# show ip route ospf +O*E2 0.0.0.0/0 [110/1] via 15.1.1.1, 00:18:07, Serial0/0.1 +R5# sh ip ospf data | begin Type-5 +Type-5 AS External Link States + +Link ID ADV Router Age Seq# Checksum Tag +0.0.0.0 1.1.1.1 1257 0x80000001 0x008C12 1 + +As mentioned earlier, RIP does support the default-information originate command; however, the command behaves slightly differently in RIP than it does in OSPF. With RIP, this command creates and advertises a default route if either no default route exists or a default route was learned from another routing protocol. However, if a static route to 0.0.0.0/0 is in the local routing table, the default-information originate command does +not cause RIP to inject a default. The reason behind this behavior is that RIP already sup-ports redistribution of static routes, so redistribute static should be used in that case. +670 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Using the ip default-network Command + +RIP and EIGRP can inject default routes by using the ip default-network command. To do so, the following must be true on the local router: + +■ The local router must configure the ip default-network net-number command, with net-number being a classful network number. + +■ The classful network must be in the local router’s IP routing table, through any means. + +■ For EIGRP only, the classful network must be advertised by the local router into EIGRP, again through any means. + +■ This method is not supported by OSPF. + +When using the ip default-network command, RIP and EIGRP differ in how they adver-tise the default. RIP advertises a route to 0.0.0.0/0, but EIGRP flags its route to the class-ful network as a candidate default route. Because EIGRP flags these routes as candidates, EIGRP must then also be advertising those classful networks. However, because RIP does not flag the classful network as a candidate default route, RIP does not actually have to advertise the classful network referenced in the ip default-network command. + +Example 11-10 shows the key difference between RIP and EIGRP with regard to the ip default-network command. In this case, R1 will advertise about classful network 10.0.0.0 using EIGRP because of the auto-summary command. + +Example 11-10 Static Default Route with Route Redistribution + +! EIGRP will advertise classful network 10.0.0.0/8 due to its network command, +! matching R1's fa0/0 interface, and the auto-summary command. Also, R1 must have +! a route to classful network 10.0.0.0/8, in this case due to a static route. +! RIP will not advertise classful network 10.0.0.0/8, but it will still be able +! to inject a default route based on the ip default-network command. +router eigrp 1 +network 10.0.0.0 +network 14.0.0.0 +auto-summary +! +router rip +version 2 +network 13.0.0.0 +! +ip classless +ip default-network 10.0.0.0 +ip route 10.0.0.0 255.0.0.0 10.1.1.102 +! On R3, RIP learns a route to 0.0.0.0/0 as its default. +R3# show ip route rip +R* 0.0.0.0/0 [120/1] via 13.1.1.1, 00:00:19, Serial0/0/0.1 +! On R4, note that EIGRP learned a route to 10.0.0.0/8, shown with a * that +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 671 + +! flags the route as a candidate default route. +R4# show ip route +! lines omitted for brevity +ia - IS-IS inter area, * - candidate default, U - per-user static route +o - ODR, P - periodic downloaded static route + +Gateway of last resort is 14.1.1.1 to network 10.0.0.0 + +D* 10.0.0.0/8 [90/2172416] via 14.1.1.1, 00:05:35, Serial0/0/0.1 +14.0.0.0/24 is subnetted, 2 subnets +C 14.1.2.0 is directly connected, FastEthernet0/0 +C 14.1.1.0 is directly connected, Serial0/0/0.1 + + +Using Route Summarization to Create Default Routes + +Generally speaking, route summarization combines smaller address ranges into a small number of larger address ranges. From that perspective, 0.0.0.0/0 is the largest possible summary, because it includes all possible IPv4 addresses. And, as it turns out, EIGRP route summarization supports summarizing the 0.0.0.0/0 supernet, effectively creating a default route. + +Because route summarization causes a null route to be created for the summary, some Cisco documentation advises against using route summarization to create a default route. For example, in Figure 11-8, imagine that R9 is owned by this network’s ISP, and R1 learns a default route (0.0.0.0/0) through EBGP from R9. However, when R1 configures +an EIGRP default route using route summarization, R1 will also create a local route to 0.0.0.0/0 as well, but with destination null0. The EBGP route has a higher AD (20) than the EIGRP summary route to null0 (AD 5), so R1 will now replace its BGP-learned default route with the summary route to null0—preventing R1 from being able to send packets to the Internet. + +Route summarization can still be used to create default routes with the proper precau-tions. The following list details a few of the requirements and options: + +■ The local router creates a local summary route, destination null0, using AD 5 (EIGRP), when deciding whether its route is the best one to add to the local routing table. + +■ EIGRP advertises the summary to other routers as AD 90 (internal). + +■ This method is not supported by RIP and OSPF. + +■ To overcome the caveat of EIGRP’s default route being set to null by having a low AD, set the AD higher (as needed) with the ip summary-address command. + +Example 11-11 lists a sample configuration on R1 again, this time creating summary routes to 0.0.0.0/0 for EIGRP. +672 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 11-11 EIGRP Configuration for Creating Default Summary Routes + +! EIGRP route summarization is done under s0/0/0.4, the subnet connected to R4. In +! this example, the AD was changed to 7 (default 5) just to show how to change the +! AD. To avoid the problem with the default route to null0 on R1, the AD should +! have been set higher than the default learned via BGP. +interface Serial0/0/0.4 point-to-point +ip address 14.1.1.1 255.255.255.0 +ip summary-address eigrp 1 0.0.0.0 0.0.0.0 7 +! In this example, R1 has two sources for a local route to 0.0.0.0/0: EIGRP +! (AD 7, per the ip summary-address command), and BGP from R9 +! (AD 20). R1 installs the EIGRP route based on the lowest AD. +R1# show ip route eigrp +14.0.0.0/8 is variably subnetted, 3 subnets, 2 masks +D 14.1.2.0/24 [90/2172416] via 14.1.1.4, 00:01:03, Serial0/0/0.4 +D 14.0.0.0/8 is a summary, 05:53:19, Null0 +D* 0.0.0.0/0 is a summary, 00:01:08, Null0 +! Next, R4's EIGRP route shows AD 90, instead of the AD 7 configured at R1. AD is +! a local parameter--R4 uses its default AD of 90 for internal routes. +R4# show ip route eigrp +D* 0.0.0.0/0 [90/2172416] via 14.1.1.1, 00:01:14, Serial0/0/0.1 + + +Performance Routing (PfR) + +Cisco Systems began experimenting with routing protocols that could make best route selection based on variable parameters like load and bandwidth as early as the 1980s. The Cisco-proprietary routing protocol EIGRP was the first attempt at this approach, expanding route selection criteria. EIGRP gave us the “K Values” that we could select to make dynamic changes to the selection process. The problem with this approach was that the dynamic nature of the circuits connecting neighbors resulted in what could only be described as unstable links and adjacencies based on network load and traffic utilization. So the advised best practice became to simply turn off the K values that impacted net-work stability. + +Not satisfied with this, Cisco continued to research other protocol enhancements. These efforts ultimately culminated in the creation of Optimized Edge Routing (OER). This technology gave us the capability to perform prefix-based route optimizations. Now this is not to be confused with what is currently referred to as Performance Routing (PfR). We will start at the beginning and work our way forward to PfR. + +OER promised many things; among those promises was the ability to extend the capabili-ties of routers to more optimally route traffic. In OER, the network performance criteria use to manipulate traffic was limited. Specifically, OER relied on packet loss, response time, path availability, and traffic load distribution to make its decisions. Each of these criteria was a significant deviation from how typical routing protocols operate and could +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 673 + +be used to significantly enhance network performance. But we have to realize that as technology advances, so do the needs of modern networks. Herein lay the Achilles heel of OER. + +Modern networks benefited greatly from the more granular control that OER brought to the table, but one element was missing from OER. Keep in mind that we described opti-mized edge routing as a “Prefix-based Route Optimization” enhancement. But modern networks needed something even more capable, something that would take application-specific needs into account, not just route and prefix information. Thus, Performance Routing was introduced. + +PfR was built on OER’s foundation and extended its capabilities to include route opti-mization criteria that could be based on application type, application performance requirements, as well as the traditional network performance criteria available in OER. In light of this fundamental enhancement to the protocol, the decision to change the name from OER (a “Prefix-based Route Optimization” protocol) to Performance Routing (an “Application Path Optimization” protocol) made perfect sense. Despite these feature enhancements and the expanded deployment options we now have available to us, the fundamental operation of PfR is still identical to OER. By this we are referring to what is commonly called the OER Phases wheel. + +Performance Routing Operational Phases + +Cisco created the idea of the Phases Wheel to help illustrate and explain the operation of OER/PfR. The problem with this notion is the fact that in operation these phases are not so easy to identify, and the lines between them become somewhat blurred and +hard to recognize. What we will do in this section is look at each of the five phases and attempt to quantify what the goal of each is. I personally feel that this is the best method for using this multiphased approach to describe this technology and how it operates. However, after the configurations have been applied and we begin to look at what is hap-pening in a working deployment, we will make reference to these different phases in a loose context. The key point to remember at this juncture of our discussion is the fact that each of these phases makes a repeating cycle, thus the term “phases wheel,” that will run constantly after OER has been configured and enabled on our network devices. + +■ Profile Phase: Learn flows that have high latency and throughput sometimes referred to as the “Learning” phase. Traffic that is being “profiled or learned” is referred to as a traffic class. The list of all monitored traffic classes (MTC) is referred to as an MTC list. + +■ Measure Phase: Collect and compute performance metrics for the traffic identified in the MTC list. + +■ Apply Policy Phase: Create low and high thresholds to define in-policy and out-of-policy (OOP) performance categories. + +■ Control Phase: Influence traffic by manipulating routing or by using policy-based routing (PBR). +674 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +■ Verify Phase: After controls have been introduced, OER will verify OOP event per-formance and make necessary adjustments to bring back in-policy performance. + +When we understand that each of these phases constantly repeats, we clearly see that the process is designed to be constantly adjusting. In a way, this is no different than the finite state machine (FSM) process that runs between adjacent neighbors like those found in OSPF or EIGRP, but instead of a neighbor peering status, we are checking to see whether the network needs optimizing or whether a decision to optimize made previously is still valid. + +The “phases wheel” is not the only logical construct that we have to get our minds around when it comes to understanding PfR. There are a number of classifications, capabilities, and roles that need to be discussed before we move on. + +Performance Routing Concepts + +There are three primary interface types that we will need to understand to configure PfR. These interface types are defined based on their roles in the PfR environment. These roles are used to identify whether interfaces are used to forward packets out of the network +or into the network. Each of these interface types is required in a topology to correctly deploy PfR: + +■ Internal Interfaces: These interfaces are used to connect to the internal network and will always be the interfaces used for communication with the device in the infra-structure that is designated as the control plane manager for the performance rout-ing environment. This device is known as the Master Controller. We will cover this device in greater detail in a subsequent section. + +■ External Interfaces: These are the physical interfaces that are used to transmit pack-ets out of the local network. There must be at least two interfaces identified as exter-nal interfaces to successfully deploy OER. These are the interfaces where prefixes and exit link performance will be monitored. + +■ Local Interfaces: These are interfaces that are used in the formation of the control plane mechanism that drives the OER process. Specifically, this interface defines the source interface that will be used to communicate to the Master Controller we men-tioned earlier. + + +Authentication + +The next section discusses the physical and logical roles associated with the component elements found in a typical PfR deployment. Suffice it to say that the component devices, one of which is the Master Controller we have alluded to and the routers it controls, all work in concert to optimize network performance. We have to realize that these commu-nications all serve to change existing routing parameters, add new prefixes, and manipu-late overall network performance at the network’s edge. This translates into handing over +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 675 + +network control to the Master Controller. For our discussions, a Master Controller will be a router that will manage all optimization decisions. Simply put, it will control what happens at the periphery of the local domain. However, handing over control to a device brings with it some level of risk. The foremost risk is that the newly created control plane mechanism could be leveraged by an unauthorized party or parties. + +In an effort to mitigate this level of risk, Performance Routing incorporates mandatory authentication. Specifically, communication between the Master Controller and its slave devices is protected by key-chain authentication. This authentication key must be con-figured on all devices involved in the process before communications can be established. The key chain is created under the global configuration mode on each device to include the Master Controller. Thus far, we have been careful to avoid discussing device roles, because it is more important for us to understand the fundamental concepts at this junc-ture rather than the actual operational roles fulfilled by each device. Now that we have +a firm grasp of these concepts, we will move into a more detailed discussion about how OER accomplishes optimization and what specific tasks are accomplished by devices assuming different operational roles. + +Performance Routing Operational Roles + +Cisco PfR requires two primary components—a Master Controller and one or more bor-der routers. The Master Controller is the decision maker, whereas the border routers are network edge devices with exit interfaces. These exit interfaces can be used to connect with the Internet or as outbound links to other network resources. + +Master Controller (MC) + +In any PfR environment, there will be a single device that manages all aspects of PfR operations. The job of the MC is to maintain communication and authenticate the ses-sions with the border routers. The Master Controller will monitor outbound traffic flows and then apply policies to optimize routing for network prefixes and exit links. Even though the MC manages all aspects of PfR, it must be noted that it is not necessary for the MC to be in the forwarding path taken by the network traffic, but it must be reach-able by the border routers. A single MC can support up to ten individual border routers or up to 20 managed exit interfaces (external interfaces). + +This device can be configured in multiple fashions based on network size. + +The simplest configuration is where the MC and the border router are running on a single device. This configuration is used most often in small office or home office networks that have multihomed connectivity to the Internet. In these environments, it must be noted that authentication is still required for PfR to function. Another very common topology employed in branch office networks is to have the master control coreside on one of mul-tiple border routers. Figure 11-9 illustrates these MC deployments. +676 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +MC/BR1 + + +MC/BR + +BR2 + + +SOHO + +Figure 11-9 + +Small Business + +Colocated MC/BR Deployments + + +Figure 11-10 illustrates that the third method of deployment for an MC is a standalone MC. This design is the most common, because it distributes CPU and resource utilization more evenly and can be found in medium to large enterprises. The benefits of being able to spread the control aspects of Performance Routing to multiple devices along the edge of the local network is where most organizations see a real return when using a technol-ogy like PfR. + + +BR1 + +MC + +BR2 + +Headquarters/Data Center + +Figure 11-10 Sample Network for Standalone MC Deployment + + +Border Router + +In the context of PfR, a border router is a router with one or more interfaces serving as exit links to either ISP, in the case of multihoming, or to other attached networks. The border router is where all policy decisions and routing changes will be enforced. It is the border router, under the control of the MC, that participates in prefix monitoring. It is the individual border routers that report prefix and transit link measurements back to the MC, where policy decisions are made. The MC will then instruct the appropriate border router to enforce any selected policy changes by injecting a preferred route to alter the course of packet flow in the network. Remember that the border router process we are describing can be, and often will be, enabled on the same router running the Master Controller process in small environments. + +At this juncture in our discussion about performance routing, we have only really dis-cussed the fundamental theory behind how it operates. We have been careful to avoid getting very detailed about device roles and how they are to be assigned. In the next section, we will begin to narrow our focus and start using our new understanding of the +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 677 +3 + +basic elements we have discussed thus far to practice PfR deployment while expanding our knowledge of the operation of the protocol to critical observation and testing. + +PfR Basic Configuration + +Figure 11-11 illustrates the topology that we are going to work with in this section. We will perform all the basic tasks necessary to configure a working PfR topology. In this section, however, our primary focus will be to simply create the MC and BRs illustrated in Figure 11-11. In doing so, we will explore the commands necessary to establish the peering and exchange of communication that we have discussed; now we will start mak-ing the theoretical concepts tangible. + +6.6.6.6/24 Lo0 + +R6 +.6 F0/0 + +10.1.200.0/24 + +F0/0 .2 F0/0 .3 +BR BR + +R2 .2 + +S0/0.21 S0/0.31 R .3 + + + + +201 +10.1.12.0/24 102 + +301 +10.1.13.0/24 103 + + + + +S0/0.12 S0/0.13 .1 .1 + + + +OSPF Area 0 + +R1 F0/0 .1 +10.1.14.0/24 F0/0 .4 + + +R4 MC + +Figure 11-11 Sample Network for Basic PfR Configuration + + +Configuration of the Master Controller + +First we will look at the most basic configuration commands necessary to create a Master Controller. Note that the majority of the Performance Routing configuration is actually done on this particular component. +678 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Step 1. Create the authentication key chain. + +As we mentioned in the previous section, PfR requires authentication before it will even operate, and the method employed by the protocol to do this is the MD5 key chain/key-string approach. This configuration is made under the global configuration context of all devices that will fulfill operational roles +as they are defined in PfR; this includes the MC and all BRs. We will wait to configure the key chains on the BRs in our topology until we reach the border router subtopic in this section. In our topology, R4 is our MC, so it is on that device that we will be working. The following example shows the MC con-figuration: +R4# conf t +R4(config)# key chain PFR_AUTH +R4(config-keychain)# key 1 + +R4(config-keychain-key)# key-string CISCO +R4(config-keychain-key)# end +! +!We can see the detail about the key chain we just configured via the !show key chain !command. +! +R4# show key chain +Key-chain PFR_AUTH: +key 1 -- text "CISCO" +accept lifetime (always valid) - (always valid) [valid now] +send lifetime (always valid) - (always valid) [valid now] +Now that we have the key chain configured, we can move to the next step of the Master Controller configuration process. +Step 2. Enable the PfR process. + +This is accomplished with one simple command; however, there are several available configuration options available: +R4# conf t +R4(config)# pfr master +R4(config-pfr-mc)# +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +!Observe that we are now inside the PfR master controller !configuration context. At this point it is worthwhile for us to !explore the array of commands that we have available to us in this !mode. We can do that simply by using "?". +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +R4(config-pfr-mc)# ? +PFR master controller configuration commands: +active-probe Manually create an active probe for a known target +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 679 + + +api +application +backoff +border + +default +delay +exit + +holddown +jitter +keepalive +learn + +logging +loss +max +max-range-utilization + +mode +mos +no +periodic +policy-rules +port +resolve +shutdown +traceroute +unreachable + +OER API related configuration +Define application +Specify backoff timer parameters +Enter OER managed border router configuration submode +Set a command to its defaults +Specify delay parameters +Exit from OER master controller configuration submode +Specify hold-down timer parameter +Specify jitter parameters +Specify keepalive interval +Enter prefix and traffic class learning submode +Event Logging +Specify loss parameters +Specify the upper limit +Configure the maximum range for utilization of all exits +Specify OER operating mode settings +Specify mos parameters +Negate a command or set its defaults +Specify periodic rotation timer value +Name of oer-map defining OER policy +Specify tcp port number for OER communication +Specify OER policy resolver settings +Disable OER master controller functionality +Configure Traceroute global parameters +Specify unreachable parameters + +There are only 26 commands available under this configuration context, and +3 of them are “exit,” “shutdown,” and “no.” That leaves 23 commands relevant to the configuration of the Master Controller. Before we have finished this example, we will have discussed each and every one of these commands, to include what role they play, and to describe how they can be manipulated to obtain desired outcomes or performances. The point we are trying to make here is that there is not only a finite range of commands, but also the true point of fact is that there are only a handful of commands. To be honest, +there are about as many commands to be found in PfR as there are in RIP. This should help to alleviate any concerns regarding the operational complexity of this protocol. + +Thus far, we have created the authentication key chain and enabled PfR, but without border routers and internal and external interfaces, our MC is +worthless. So we need to move on to the next step of our configuration and discussion. +680 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Step 3. Designate internal/external interfaces. + +The MC needs something to control, and based on our discussions these con-trolled devices are referred to as border routers. It is the border routers that host the internal and external interfaces. The interesting point that we need to make at this point is that even though the interfaces exist on the discreet BR, we must designate which interfaces are which on the MC. Yes, it is the MC that tells the BR which of its interfaces are considered internal or external. This configuration is made on the MC under the “config-pfr-mc” configura-tion context. To do this, we will first use the border command on the MC to enter the Master Controller border router configuration mode. We will use the loopback 0 addresses of our border routers to identify them, and remem-ber we are required to use the key chain we created. We will start with the BR 2.2.2.2 (R2) as seen here: +R4(config-pfr-mc)# border 2.2.2.2 key-chain PFR_AUTH +R4(config-pfr-mc-br)# +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +!!It is under this context that we will specify and designate the !!interface roles for R2. This is done via the interface command: +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +! +R4(config-pfr-mc-br)# interface Serial0/0.21 internal +R4(config-pfr-mc-br)# interface FastEthernet0/0 external +R4(config-pfr-mc-br-if)# exit +R4(config-pfr-mc-br)# exit +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +!!Now we know that we have two BRs R2 and R3 so this configuration will +!!need to be repeated for R3 on the MC. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +! +R4(config-pfr-mc)# border 3.3.3.3 key-chain OER_AUTH +R4(config-pfr-mc-br)# interface Serial0/0.31 internal +R4(config-pfr-mc-br)# interface FastEthernet0/0 external +R4(config-pfr-mc-br-if)# exit +R4(config-pfr-mc-br)# exit +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +!!This has created the master border configuration on R4. +!!We know that we have not made +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 681 + +!!any configuration on the border routers so we should not expect this +!!to create a working configuration. We can however still use the show +!!oer master border command on +!!R4 to look at the status of the MC to BR relationship. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +! +R4(config-pfr-mc)# do show oer master border +Border Status UP/DOWN AuthFail Version + +3.3.3.3 +2.2.2.2 + +INACTIVE DOWN 0 0.0 +INACTIVE DOWN 0 0.0 + +R4(config-pfr-mc)# + +Configuration of the Border Router + +We will move now to R2 and create the basic configuration necessary to enable it as a BR in our topology. +Step 1. Create the authentication key chain. + +As we mentioned in the previous section, PfR requires authentication before it will even operate, and the method employed by the protocol to do this is the MD5 key chain/key-string approach. We will make this configuration under the global configuration context of R2 as seen here: +R4(config-pfr-mc)# border 2.2.2.2 key-chain PFR_AUTH +R4(config-pfr-mc-br)# +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +!!It is under this context that we will specify and designate the !!interface roles for +!!R2. This is done via the interface command: +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +! +R4(config-pfr-mc-br)# interface Serial0/0.21 internal +R4(config-pfr-mc-br)# interface FastEthernet0/0 external +R4(config-pfr-mc-br-if)# exit +R4(config-pfr-mc-br)# exit +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +!!Now we know that we have two BRs R2 and R3 so this configuration +!! will need to be repeated for R3 on the MC. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! +! +R4(config-pfr-mc)# border 3.3.3.3 key-chain PFR_AUTH +682 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Step 2. Enable the PfR process. + +In this instance, we are going to enable the PfR process on R2, but we will actually be activating the BR process as seen here: +R2# conf t +R2(config)# pfr border +R2(config-pfr-br)# master 4.4.4.4 key-chain OER_AUTH +R2(config-pfr-br)# +Step 3. Specify the local interface. + +We employed the use of the loopback 0 addresses for BRs when we made the configuration on the MC. We will need to ensure that the BRs source their TCP sessions to the MC using these addresses as well. This is where we will specify the local interface. The local interface is the interface used by the BRs to communicate to the MC; this process is demonstrated here: +R2(config-pfr-br)# local loopback0 +R2(config-pfr-br)# + +Task Completion on R3 + +We will need to configure the same setup parameters on R3 to have two working BRs +in our topology. Remember, we need one MC and at least two external interfaces. These interfaces can be on a single BR or distributed across multiple BRs. Rather than apply these configurations in a stage approach, we will simply get R3 up and running as a BR, as illustrated in the configuration that follows and move to the MC to conduct verifica-tions: +R3# conf t +Enter configuration commands, one per line. End with CNTL/Z. +R3(config)# key chain PFR_AUTH +R3(config-keychain)# key 1 +R3(config-keychain-key)# key-string CISCO +R3(config-keychain-key)# exit +R3(config-keychain)# exit +R3(config)# +R3(config)# pfr border +R3(config-pfr-br)# master 4.4.4.4 key-chain OER_AUTH +R3(config-pfr-br)# local loopback0 +R3(config-pfr-br)# logging +R3(config-pfr-br)# port 3950 +R3(config-pfr-br)# end +R3# +%OER_BR-5-NOTICE: MC 4.4.4.4 UP +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 683 + +The following output on R4 is provided to the console by the logging feature under the PfR process we enabled: +R4# +%PFR_MC-5-NOTICE: BR 2.2.2.2 UP +%PFR_MC-5-NOTICE: BR 2.2.2.2 IF Fa0/0 UP +%PFR_MC-5-NOTICE: BR 2.2.2.2 IF Se0/0.21 UP +%PFR_MC-5-NOTICE: BR 2.2.2.2 Active +R4# +%PFR_MC-5-NOTICE: BR 3.3.3.3 UP +%PFR_MC-5-NOTICE: BR 3.3.3.3 IF Fa0/0 UP +%PFR_MC-5-NOTICE: BR 3.3.3.3 IF Se0/0.31 UP +%PFR_MC-5-NOTICE: BR 3.3.3.3 Active + +The behavior we are observing is very important. Note that, as we have discussed previ-ously, we need two external interfaces before the MC process will become active. We can see the MC process come “up” on R4 after we have two external interfaces. Observe that this requires both BRs to be operational in our topology. +%PFR_MC-5-NOTICE: MC Active + + +Troubleshooting Complex Layer 3 Issues + +In troubleshooting, perhaps the easiest way to find the source of most problems is through the show run command or variations of it. Therefore, as in Chapter 3, “Spanning Tree Protocol,” we’ll institute a simple “no show run” rule in this section that will force you to use your knowledge of more in-depth troubleshooting commands in the Cisco IOS portion of this section. + +In addition, you can expect that the issues that you’ll face in this part of the written exam will need more than one command or step to isolate and resolve. You will need strong mastery of the commands associated with the Layer 3 protocols tested in the CCIE Routing & Switching track, and especially of OSPF, EIGRP, and BGP troubleshooting commands. Those topics are addressed in other chapters in this book, and you should know them well before going into the exam. + +In this section, focus on the process first and then on specific techniques. We also pro-vide a table of several of the more subtle types of Layer 3 problems that you’re likely to encounter and describe ways of isolating those problems using Cisco IOS commands. Because there are so many possible causes of trouble at Layer 3, we won’t spend these pages on specific examples. Although you might become good at solving specific prob-lems through examples, this section focuses more on the approach than on specific examples because the approach and tools will get you through many more situations than a few specific examples would. +684 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Layer 3 Troubleshooting Process + +You can expect that many difficulties that appear at Layer 3 are not really Layer 3 prob-lems at all, but rather are the result of troubles in other layers of the protocol stack. Here are some examples of issues at other layers that can impact Layer 3 protocols in subtle or misleading ways: + +■ An MTU mismatch on a link + +■ A unidirectional link + +■ A duplex mismatch + +■ A link with a high error rate in one or both directions + +■ Layer 2 configuration issues + +■ Access list (ACL or VACL) filtering with unintended consequences (don’t forget that implicit deny!) + +■ Security policy that blocks required traffic + +■ A TTL setting that’s too low for Layer 3 protocol operation + +■ Two or more Layer 3 subnets configured in the same VLAN, which is especially problematic with Layer 3 protocols that use broadcast or multicast traffic to form adjacencies + +From the standpoint of troubleshooting techniques, two basic stack-based approaches come into play, depending on what type of issue you’re facing. The first is the climb- +the-stack approach, where you begin at Layer 1 and work your way up until you find the problem. Alternatively, you can start at Layer 7 and work your way down; however, in the context of the CCIE Routing and Switching exams, the climb-the-stack approach gener-ally makes more sense. + +The second approach is often referred to as the divide-and-conquer method. With this technique, you start in the middle of the stack (usually where you see the problem; in this case we’ll assume Layer 3) and work your way down or up the stack from there until you find the problem. In the interest of time, which is paramount in an exam environment, +the divide-and-conquer approach usually provides the best results. In that vein, let’s start by looking at some basic Layer 3 configuration items that can break routing protocols if they’re incorrectly configured. + +First, consider any field in the IP packet header that has configuration options. Some fields in the IP header to check are these: + +■ Mismatched subnet masks within a subnet. + +■ A too-short TTL can cause some routing protocol adjacencies (specifically eBGP) to fail to form, or stop IP communications from taking place across a path with mul-tiple Layer 3 hops. + +■ An MTU too low on a link can cause large packets to be dropped. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 685 + +■ An MTU mismatch on a link can cause large packets to be dropped on the low-MTU end when they arrive. + +■ Multicast traffic is not supported, disabled, or rate-limited on one or more links. + +■ An overloaded link can result in packet loss, long latency, and jitter. + +■ QoS configuration can cause packet loss, especially of keepalives. + +After you’ve gotten past these core IP issues, you can begin to look for more in-depth issues at Layer 3. These are likely to be specific to routing protocol configuration or operation. However, in keeping with the scope of this section, we won’t consider simpler, one-command issues such as adjacencies failing to form or authentication failures. These issues are covered in the earlier chapters of this book. Some of the common sources of problems in routing include the following: + +■ Incorrect split-horizon configuration. This is challenging to find quickly because the result is usually that most routes are propagated correctly, but some are not propa-gated. + +■ Incorrect redistribution configuration, especially with multiple points of redistribu-tion or mutual redistribution. Incorrectly configured filtering or a lack of filtering can cause routing loops. + +■ Protocols not advertising routes when they appear to be configured to do so. + +■ Protocols not redistributing routes when they appear to be configured to do so. + +■ Incorrect route filtering because of incorrect masks applied in an access list or prefix list. + +■ EIGRP stuck-in-active (SIA) issues. + +■ Incorrect summarization. + +■ Administrative distance manipulation causing fundamental routing rules to be super-seded. + +■ Metric calculations configured differently on different routers (particularly affecting metric calculations in OSPF or mismatched EIGRP k values). + +■ Metric manipulation on a router. + +■ NAT configuration with unintended consequences. + +■ Policy-based routing configuration issues or unintended consequences. + +■ Interface damping activity causing intermittent or flapping operation. + +■ Mismatched timer settings, which sometimes result in adjacencies flapping. + +When you’re troubleshooting Layer 3 issues, it’s a good idea to start with the basics: Verify reachability, verify that the correct path is being used, and check the routing table carefully. Make sure that routes are being learned through the correct protocols and from the correct neighbors. Then look for deeper issues. +686 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Layer 3 Protocol Troubleshooting and Commands + +In addition to the myriad protocol-specific troubleshooting commands that you’ve learned in previous chapters, this section addresses commands that can help you isolate problems through a solid understanding of the information they present. We’ll use a vari-ety of command output examples to illustrate the key parameters you should understand. Note that this section doesn’t address Layer 2–specific commands because Chapter 3 covers those areas in the troubleshooting section. + +IP Routing Processes + +The show ip protocols command reveals a great deal of helpful information, as shown in Example 11-12. Comments are inserted between lines and begin with an exclamation point for clarity. + +Example 11-12 show ip protocols Command + +Rush1# show ip protocols +Routing Protocol is "eigrp 1" +! Note the AS number. +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +! Note the filter list, which would be specified in these two lines. +Outgoing routes in Serial0/0.4 will have 1 added to metric if on list 11 +! This is an example of metric manipulation, which can have unintended +! consequences. +Default networks flagged in outgoing updates +Default networks accepted from incoming updates +EIGRP metric weight K1=0, K2=0, K3=1, K4=0, K5=0 +EIGRP maximum hopcount 100 +! These two lines show configuration options that must match throughout +! the EIGRP AS 1 domain for correct EIGRP operation. +EIGRP maximum metric variance 1 +Redistributing: eigrp 1 +! Provides details of redistribution, including less obvious sources +! of redistribution such as connected and static routes. +EIGRP NSF-aware route hold timer is 240s +Automatic network summarization is not in effect +Maximum path: 4 +Routing for Networks: +172.31.0.0 +! The list of networks being advertised can provide clues to routing +! problems. +Routing Information Sources: + +Gateway +172.31.14.2 + +Distance +90 + +Last Update +2d18h + +Distance: internal 90 external 170 +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 687 + +! Administrative distances are shown. In most cases these should +! match from router to router within a routing domain. Watch for +! non-default AD settings. + +Routing Protocol is "ospf 1" +! Note the process ID. +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +Router ID 150.1.1.1 +It is an area border router +Number of areas in this router is 2. 2 normal 0 stub 0 nssa +Details of areas and area types, as well as the router's role (ABR). +Maximum path: 4 +Routing for Networks: +144.222.100.0 0.0.0.255 area 0 +144.254.254.0 0.0.0.255 area 0 +150.1.1.0 0.0.0.255 area 1 +Routing Information Sources: + +Gateway +150.1.3.129 +150.1.1.1 + +Distance +110 +110 + +Last Update +2d20h +2d20h + +Distance: (default is 110) + +Routing Protocol is "bgp 200" +Outgoing update filter list for all interfaces is not set +Incoming update filter list for all interfaces is not set +IGP synchronization is disabled +Automatic route summarization is disabled +! These two lines show important information about fundamentals of BGP +! configuration. +Neighbor(s): +Address FiltIn FiltOut DistIn DistOut Weight RouteMap +172.31.14.2 +Maximum path: 1 +Routing Information Sources: +Gateway Distance Last Update +Distance: external 20 internal 200 local 200 + +Next, consider what interface statistics from a router can point toward the source of trou-ble in Layer 3 protocols. Example 11-13 shows settings and statistics on a serial interface, with comments as in the previous example. In this example, we show two interface show commands (show interfaces and show ip interface) for the same interface, to illustrate the differences between them and the significance of a small difference in a command. Example 11-14 examines the differences between these commands on an Ethernet inter-face to show the difference between serial Frame Relay interfaces and Ethernet interfaces. +688 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Example 11-13 show interfaces and show ip interface Commands + +RDXC# show interfaces s0/0.4 +Serial0/0.4 is up, line protocol is up +Hardware is PowerQUICC Serial +Internet address is 172.31.14.1/30 +MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, +reliability 255/255, txload 1/255, rxload 1/255 +! Reliability shows that the link is not experiencing any receive errors. +! Remember to check the other end of the link, because this parameter +! shows only inbound errors. +! The txload and rxload parameters indicate that the link is not near its +! load limits in either direction. +Encapsulation FRAME-RELAY +Last clearing of "show interface" counters never +RDXC# sh ip int s0/0.4 +Serial0/0.4 is up, line protocol is up +Internet address is 172.31.14.1/30 +Broadcast address is 255.255.255.255 +Address determined by non-volatile memory +MTU is 1500 bytes +! MTU configuration can affect protocol operation. +Helper address is not set +Directed broadcast forwarding is disabled +Multicast reserved groups joined: 224.0.0.10 +! Multicast is enabled and operating on the interface. +Outgoing access list is not set +Inbound access list is not set +Proxy ARP is enabled +Local Proxy ARP is disabled +! Proxy ARP configuration affects protocol operation through an +! interface. +Security level is default +Split horizon is enabled +! Split horizon affects distance-vector routing protocol operation. +ICMP redirects are always sent +ICMP unreachables are always sent +ICMP mask replies are never sent +IP fast switching is enabled +IP fast switching on the same interface is enabled +IP Flow switching is disabled +IP CEF switching is disabled +IP Fast switching turbo vector +IP multicast fast switching is enabled +IP multicast distributed fast switching is disabled +IP route-cache flags are Fast +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 689 + +Router Discovery is disabled +IP output packet accounting is disabled +IP access violation accounting is disabled +TCP/IP header compression is disabled +RTP/IP header compression is disabled +Policy routing is disabled +Network address translation is disabled +! NAT can adversely affect many protocols if the appropriate exceptions +! aren't made. +WCCP Redirect outbound is disabled +WCCP Redirect inbound is disabled +WCCP Redirect exclude is disabled +BGP Policy Mapping is disabled + +Along the same lines as Example 11-13, Example 11-14 shows the same show commands on an Ethernet interface with the appropriate annotations. + +Example 11-14 show interfaces and show ip interface Commands on Fast Ethernet + +R9# show interfaces fa0/0 +FastEthernet0/0 is up, line protocol is up +Hardware is PQUICC_FEC, address is 000b.be90.5907 (bia 000b.be90.5907) +Internet address is 204.12.1.9/24 +MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, +reliability 255/255, txload 1/255, rxload 1/255 +! Key interface settings and statistics. See Example 11-13 for more details. +Encapsulation ARPA, loopback not set +Keepalive set (10 sec) +Full-duplex, 100Mb/s, 100BaseTX/FX +! Details of speed and duplex settings, which must be configured +! appropriately or unexpected consequences will develop. +ARP type: ARPA, ARP Timeout 04:00:00 +Last input 00:00:11, output 00:00:08, output hang never +Last clearing of "show interface" counters never +Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 +! The queuing stats include drops, which can cause L3 protocol problems. +Queueing strategy: fifo +Output queue: 0/40 (size/max) +5 minute input rate 0 bits/sec, 0 packets/sec +5 minute output rate 0 bits/sec, 0 packets/sec +992849 packets input, 114701010 bytes +Received 992541 broadcasts, 0 runts, 0 giants, 0 throttles +0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored +! On a healthy Ethernet interface, this is what you should see. A large +! number for any of these metrics usually indicates a Layer 1 problem +! or a Layer 2 configuration issue such as a duplex mismatch. +0 watchdog +690 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +0 input packets with dribble condition detected +785572 packets output, 89170479 bytes, 0 underruns +3 output errors, 0 collisions, 3 interface resets +2 unknown protocol drops +0 babbles, 0 late collision, 0 deferred +3 lost carrier, 0 no carrier +0 output buffer failures, 0 output buffers swapped out +! Depending on how many input and output packets the interface +! shows, and when the interface timers were last reset, the stats +! shown on these lines can indicate Layer 1 or Layer 2 problems. +R9# show ip interface fa0/0 +FastEthernet0/0 is up, line protocol is up +Internet address is 204.12.1.9/24 +Broadcast address is 255.255.255.255 +Address determined by setup command +MTU is 1500 bytes +! Remaining output is omitted because it duplicates that in +! Example 11-13 from this point onward + +Among the other useful troubleshooting commands in diagnosing Layer 3 problems are the following: + +■ show ip nat translations + +■ show ip access-list + +■ show ip interface brief + +■ show dampening + +■ show logging + +■ show policy-map + +■ traceroute + +■ ping (and extended ping) + +■ show route-map + +■ show standby + +■ show vrrp + +■ show track + +■ show ip route prefix + +In your use of show commands, don’t overlook the amount of information available in the show ip route command and its more detailed variant, show ip route prefix. For example, you can use the show ip route 172.31.14.0 command to learn detailed informa-tion about the 172.31.14.0 network, including its next hop and other pertinent informa-tion. Example 11-15 shows a sample of that output. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 691 + +Example 11-15 Displaying Detailed Information for a Prefix + +Routing entry for 172.31.14.0/30 +Known via "eigrp 1", distance 90, metric 1024000, type internal +Redistributing via eigrp 1 +Last update from 172.31.24.1 on Serial0/0.4, 01:23:40 ago +Routing Descriptor Blocks: +* 172.31.24.1, from 172.31.24.1, 01:23:40 ago, via Serial0/0.4 +Route metric is 1024000, traffic share count is 1 +Total delay is 40000 microseconds, minimum bandwidth is 64 Kbit +Reliability 255/255, minimum MTU 1500 bytes +Loading 1/255, Hops 1 + +Note the details that this command provides for an individual prefix in the routing table under the Routing Descriptor Blocks. The same command for an OSPF route includes information on key items such as the type of route (that is, inter-area or intra-area) that can be helpful in troubleshooting. + +Another command that yields considerable detail is the extended ping command. Example 11-16 shows the variety of configuration options it provides. Of particular note is this command’s ability to test using multiple protocols including IPv4 and IPv6, to sweep a range of packet sizes to test for MTU-related issues, to permit testing with vari-ous ToS values in the packet headers, and to specify the source interface to help deter-mine the source of routing issues. + +Example 11-16 Using the Extended ping Command + +R8# ping +Protocol [ip]: +Target IP address: 192.10.1.8 +Repeat count [5]: 100 +Datagram size [100]: +Timeout in seconds [2]: +Extended commands [n]: y +Source address or interface: fastethernet0/0 +Type of service [0]: 3 +Set DF bit in IP header? [no]: +Validate reply data? [no]: +Data pattern [0xABCD]: +Loose, Strict, Record, Timestamp, Verbose[none]: +Sweep range of sizes [n]: y +Sweep min size [36]: +Sweep max size [18024]: +Sweep interval [1]: +Type escape sequence to abort. +Sending 1798900, [36..18024]-byte ICMP Echos to 192.10.1.8, timeout is 2 seconds: +Packet sent with a source address of 192.10.1.8 +692 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +[output omitted] +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Success rate is 100 percent (3565/3565), round-trip min/avg/max = 1/4/76 ms + +The idea of using the ping utility is to see whether the path to a destination prefix is operational, and thanks to the echo reply mechanism, we know that both the send and receive paths are okay. However, if there are problems, ping cannot be used to find where the problems might exist in the infrastructure; for that, we need to rely on the traceroute utility. + +If you execute the traceroute command on a route, that device will send IP packets toward the destination with a Time To Live (TTL) value that will increment up to the defined maximum specified hop count. This is 30 by default. Typically, each router in the path toward the destination decrements the TTL field by 1 unit while it forwards these packets. When a router in the middle of the path finds a packet with TTL = 1, it responds with an Internet Control Message Protocol (ICMP) “time exceeded” message to the source. This message lets the source know that the packet traversed that particular router as a hop. + +The TTL for the initial User Datagram Protocol (UDP) datagram probe is set to 1 in the basic traceroute utility. The destination UDP port of the initial datagram probe is set to 33434 by default. The source UDP port of the initial datagram probe is randomized and has logical operator OR with 0x8000 (ensures a minimum source port of 0x8000). These steps illustrate what happens when the UDP datagram is launched: +Step 1. The UDP datagram is sent with TTL = 1, destination UDP port = 33434, and the source port randomized. + +Step 2. The UDP destination port is incremented, the source UDP port is random-ized, and the second datagram is dispatched. (This process is repeated for up to three probes. For each of the probes sent, a “TTL exceeded” message is received, which is used to build a step-by-step path to the destination host.) + +The TTL is incremented, and this cycle repeats with incremental destination port numbers if the ICMP “time exceeded” message is received. You can also get one of these mes-sages: + +■ An ICMP type 3, code 3 (“destination unreachable,” “port unreachable”) message, which indicates that a host has been reached + +■ A “host unreachable,” “net unreachable,” “maximum TTL exceeded,” or “timeout” type of message, which means that the probe is resent + +Cisco routers send UDP probe packets with a random source port and an incremental destination port (to distinguish the different probes). Cisco routers send the ICMP mes-sage “time exceeded” back to the source from where the UDP/ICMP packet was received. We can see how to employ the extended version of traceroute in Example 11-17. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 693 + +Example 11-17 Using the Extended traceroute Command + +Router A> enable +Router A# traceroute +Protocol [ip]: +Target IP address: 192.168.40.2 +Source address: 172.16.23.2 +Numeric display [n]: +Timeout in seconds [3]: +Probe count [3]: +Minimum Time to Live [1]: +Maximum Time to Live [30]: +Port Number [33434]: +Loose, Strict, Record, Timestamp, Verbose[none]: +Type escape sequence to abort. +Tracing the route to 192.168.40.2 + +1 172.31.20.2 16 msec 16 msec 16 msec +2 172.20.10.2 28 msec 28 msec 32 msec +3 192.168.40.2 32 msec 28 msec * + +The extended traceroute command can be used to see what path packets take to get to a destination. The command can also be used to check routing at the same time. This is helpful for when you troubleshoot routing loops, or for when you determine where pack-ets are getting lost. You can use the extended ping command to determine the type of connectivity problem, and then use the extended traceroute command to narrow down where the problem occurs. + +A “time exceeded” error message indicates that an intermediate communication server has seen and discarded the packet. A “destination unreachable” error message indicates that the destination node has received the probe and discarded it because it could not deliver the packet. If the timer goes off before a response comes in, traceroute prints an asterisk (*). The command terminates when any of these happens, the destination +responds, the maximum TTL is exceeded, or the user interrupts the trace with the escape sequence. In Cisco routers, the codes for a traceroute command reply are + +■ ! — success + +■ * — time out + +■ N — network unreachable + +■ H — host unreachable + +■ P — protocol unreachable + +■ A — admin denied + +■ Q — source quench received (congestion) + +■ ? — unknown (any other ICMP message) +694 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +These commands make it easier for us to actually interpret the results of our traceroute test and should not be overlooked when learning how to use this utility. + +Perhaps the most powerful Cisco IOS troubleshooting tools are the array of debug com-mands that Cisco provides. The most appropriate debug command for tracking down Layer 3 problems is debug ip routing, which reveals a great deal about the Layer 3 envi-ronment. Although this command might be of limited help in the qualification exam, understanding what it can provide in the way of information is especially helpful for lab exam preparation, where you will use this command and its IPv6 sibling, debug ipv6 routing, extensively. Example 11-18 shows some debug ip routing output to show the information it provides. + +Example 11-18 Output from the debug ip routing Command + +R2# debug ip routing +R2# +May 25 22:03:03.664: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 172.31.24.1 (Serial0/0.4) is down: peer restarted +! An EIGRP neighbor in AS 1 went down because it was restarted. +May 25 22:03:03.664: RT: delete route to 172.31.14.0 via 172.31.24.1, eigrp metric [90/1024000] +May 25 22:03:03.664: RT: no routes to 172.31.14.0 +May 25 22:03:03.664: RT: NET-RED 172.31.14.0/30 +May 25 22:03:03.668: RT: NET-RED queued, Queue size 1 +May 25 22:03:03.668: RT: delete subnet route to 172.31.14.0/30 +! The route to 172.31.14.0 was removed from the routing table. +May 25 22:03:03.668: RT: NET-RED 172.31.14.0/30 +May 25 22:03:03.668: RT: NET-RED queued, Queue size 2 +May 25 22:03:03.672: destroy peer: 172.31.24.1 +May 25 22:03:05.071: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 172.31.24.1 (Serial0/0.4) is up: new adjacency +! The EIGRP neighbor came back up. +May 25 22:03:05.668: RT: add 172.31.14.0/30 via 172.31.24.1, eigrp metric [90/1024000] +May 25 22:03:05.668: RT: NET-RED 172.31.14.0/30 +! The route to 172.31.14.0 was restored to the routing table. +May 25 22:03:05.668: RT: NET-RED queued, Queue size 1 + +Not shown in this example, but particularly helpful, is what happens if a route or a set of routes is flapping because of a loop. You’ll see a consistent set of learn/withdraw mes-sages from each routing source, usually quite evenly timed, indicating the loop’s pres-ence. The ping and traceroute commands are usually your first clue to a loop. + +If you need to dig really deep into a particular issue, you can use the debug ip packet detail acl command to filter the IP packet debugging function through an access list. Create an access list that filters all but the specific information you’re seeking; otherwise, you’ll get so much information that it’s difficult, at best, to interpret. At worst, it can cause the router to hang or reboot. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 695 + +Approaches to Resolving Layer 3 Issues + +In this final section of the chapter, we present a table with several generalized types of issues and ways of approaching them, including the relevant Cisco IOS commands. Table 11-11 summarizes these techniques. + + +Table 11-11 + +Problem + + +Troubleshooting Approach and Commands + +Approach + + + +Helpful IOS Commands + + + +Intermittent reachability to a subnet. + + +Use ping to gather information. + +Verify that the route(s) exist in the routing tables. Find where the routing information stops or becomes unstable. + +Eliminate Layer 1 issues with show interface commands. + +Use traceroute to verify the path. + + +show interface + +show ip interface + +ping + +traceroute + +show ip route prefix + +debug ip routing + + + +Redistributed routes do not Verify the maximum number of hops make it to all the desired (EIGRP) configured using the metric routers. hopcount x EIGRP subcommand. + +Check split horizon configuration in a multipoint network. + +show ip protocols + +show ip route + +show ip interface + + + +A router does not appear to be advertising prefixes that it should be configured to advertise. + +Verify configuration using show ip protocols. + +Verify summarization. + +Check metrics and administrative distance. + +Check interface filters. + +Check route maps. + +Check for split-horizon issues. + +show ip protocols + +show ip interface + +show ip route + +show ip route prefix + +show route-map +696 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Foundation Summary + + +This section lists additional details and facts to round out the coverage of the topics in this chapter. Unlike most of the Cisco Press Exam Certification Guides, this “Foundation Summary” does not repeat information presented in the “Foundation Topics” section of the chapter. Please take the time to read and study the details in the “Foundation Topics” section of the chapter, as well as review items noted with a Key Topic icon. + +Table 11-12 lists some of the most relevant Cisco IOS commands related to the topics in this chapter. Also refer to Tables 11-2 and 11-3 for the match and set commands. + + +Table 11-12 + +Command + + +Command Reference for Chapter 11 + +Command Mode and Description + + + +redistribute protocol [process-id ] {level-1 | level-1-2 | level-2 } [as-number ] [metric metric-value] [metric-type type-value ] +[match {internal | external 1 | external 2}] [tag tag-value] [route-map map-tag ] [subnets] + +ip prefix-list list-name [seq seq-value] {deny network/length | permit network/length} +[ge ge-value] [le le-value] + +ip prefix-list list-name sequence-number description text + +distance value {ip-address {wildcard-mask }} [ip-standard-list] [ip-extended-list] + + + +distance eigrp internal-distance external-distance + +distance ospf {[intra-area dist1] [inter-area dist2] [external dist3]} + +ip summary-address eigrp as-number network-address subnet-mask [admin-distance] + +ip summary-address rip ip-address ip-network-mask + +area area-id range ip-address mask [advertise | not-advertise] [cost cost] + +summary-address {{ip-address mask } | {prefix mask }} [not-advertise] [tag tag ] + +Router config mode; defines the routing protocol from which to take routes, several matching parameters, and several things that can be marked on the redistributed routes. + + +Global config mode; defines members of a prefix list that match a prefix (subnet) and prefix length (subnet mask). + +Global config; sets a description to a line in a prefix list. + +Router config mode; identifies the route source, and an optional ACL to define a subnet of routes, for which this router’s AD is changed. Influences the selection of routes by selectively overriding the default AD. +EIGRP config; sets the AD for all internal and external routes. + +OSPF config; sets the AD for all intra-area, inter-area, and external routes. + +Interface mode; configures an EIGRP route summary. + +Interface mode; configures a RIP route summary. + +OSPF mode; configures an OSPF summary between areas. + +OSPF mode; configures an OSPF summary of external routes. +Chapter 11: IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting 697 + + + +Command +ip default-network network-number + +default-information originate [route-map map-name ] +default-information originate [always] +[metric metric-value] [metric-type type-value] [route-map map-name ] + +ip route prefix mask {ip-address | interface-type interface-number [ip-address ]} +[distance] [name ] [permanent] [tag tag ] + +debug ip routing + +debug ipv6 routing + +debug + + + +ping + + + + +traceroute + +show ip route [prefix] + + +pfr + + +show pfr border defined + +show pfr master defined + +show pfr master nbar application + +Command Mode and Description +Global config; sets a network from which to derive default routes. +IS-IS config; tells IS-IS to advertise a default route if it is in the routing table. +OSPF config; tells OSPF to advertise a default route, either if it is in the routing table or always. +Global config; used to create static IP routes, including static routes to 0.0.0.0 0.0.0.0, which denotes a default route. + +Enables displaying output of all IPv4 routing table events for troubleshooting purposes. +Enables displaying output of all IPv6 routing table events for troubleshooting purposes. +Provides many protocol-specific debug functions for indicating routing protocol events (such as debug ip ospf neighbor events, as one example). +Allows extended testing of reachability using packets of different sizes, ToS values, and other variables for testing reachability issues, with a specified source interface for testing routing-related reachability issues. +Similar to the extended ping command, provides extended traceroute capability. +Provides specific routing information for individual IPv4 prefixes present in the routing table. +Enables a PfR process and configures a router as a PfR border router or as a PfR Master Controller. +Displays all applications that are defined to be monitored by a PfR border router. +Displays all applications that are defined on a PfR Master Controller. +Displays information about the status of an application identified using Network-Based Application Recognition (NBAR) for each PfR border router. +698 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Memory Builders + +The CCIE Routing and Switching written exam, like all Cisco CCIE written exams, covers a fairly broad set of topics. This section provides some basic tools to help you exercise your memory about some of the broader topics covered in this chapter. + +Fill In Key Tables from Memory + +Appendix E, “Key Tables for CCIE Study,” on the CD in the back of this book, contains empty sets of some of the key summary tables in each chapter. Print Appendix E, refer to this chapter’s tables in it, and fill in the tables from memory. Refer to Appendix F, “Solutions for Key Tables for CCIE Study,” on the CD to check your answers. + +Definitions + +Next, take a few moments to write down the definitions for the following terms: + +default route, route redistribution, external route, aggregate route, route map, IP pre-fix list, summary route, component route, gateway of last resort +Refer to the glossary to check your answers. + + +Further Reading + +Routing TCP/IP, Volume I, Second Edition, by Jeff Doyle and Jennifer DeHaven Carroll + +CCIE Practical Studies, Volume II, by Karl Solie and Leah Lynch + +“Troubleshooting IP Routing Protocols,” www.ciscopress.com/bookstore/ product.asp?isbn=1587050196 + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + +The first 11 chapters of this book cover the portion of technologies, protocols, and considerations required to be prepared to pass the 400-101 CCIE Routing and +Switching written exam. While these chapters supply the detailed information, most people need more preparation than simply reading the first 11 chapters of this book. This chapter details a set of tools and a study plan to help you complete your preparation for the exams. + +This short chapter has two main sections. The first sec-tion lists the exam preparation tools useful at this point in the study process. The second section lists a suggested study plan now that you have completed all the earlier chapters in this book. + + +Note Appendix E, “Key Tables for CCIE Study,” and Appendix F, “Solutions for Key Tables for CCIE Study,” exist as soft-copy appendices on the CD included in the back of this book. +CHAPTER 12 + + + + + + +Final Preparation + + + +Tools for Final Preparation + +This section lists some information about the available tools and how to access the tools. + + +Pearson Cert Practice Test Engine and Questions on the CD + +The CD in the back of the book includes the Pearson Cert Practice Test engine—soft-ware that displays and grades a set of exam-realistic multiple-choice questions. Using the Pearson Cert Practice Test engine, you can either study by going through the questions in Study Mode, or take a simulated (timed) CCIE Routing and Switching Written Exam. + +The installation process requires two major steps. The CD in the back of this book has a recent copy of the Pearson Cert Practice Test engine. The practice exam—the database of CCIE Routing and Switching exam questions—is not on the CD. + + +Note The cardboard CD case in the back of this book includes the CD and a piece of paper. The paper lists the activation key for the practice exam associated with this book. Do not lose the activation key. + + + +Install the Software from the CD + +The software installation process is pretty routine as compared with other software installation processes. To be complete, the following steps outline the installation pro-cess: +Step 1. Insert the CD into your PC. + +Step 2. The software that automatically runs is the Cisco Press software to access and use all CD-based features, including the exam engine and the CD-only appen-dices. From the main menu, click the option to Install the Exam Engine. +Step 3. Respond to Windows prompts as with any typical software installation process. +702 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The installation process will give you the option to activate your exam with the activation code supplied on the paper in the CD sleeve. This process requires that you establish a Pearson website login. You will need this login to activate the exam, so please do register when prompted. If you already have a Pearson website login, there is no need to register again. Just use your existing login. + +Activate and Download the Practice Exam + +After the exam engine is installed, you should then activate the exam associated with this book (if you did not do so during the installation process) as follows: +Step 1. Start the Pearson Cert Practice Test (PCPT) software from the Windows Start menu or from your desktop shortcut icon. + +Step 2. To activate and download the exam associated with this book, from the My Products or Tools tab, click the Activate button. + +Step 3. At the next screen, enter the activation key from the paper inside the card-board CD holder in the back of the book. After it is entered, click the Activate button. +Step 4. The activation process will download the practice exam. Click Next, and then click Finish. + +After the activation process is completed, the My Products tab should list your new exam. If you do not see the exam, make sure that you have selected the My Products tab on the menu. At this point, the software and practice exam are ready to use. Simply select the exam and click the Use button. + +To update a particular exam that you have already activated and downloaded, simply select the Tools tab and click the Update Products button. Updating your exams will ensure that you have the latest changes and updates to the exam data. + +If you want to check for updates to the Pearson Cert Practice Test exam engine software, simply select the Tools tab and click the Update Application button. This will ensure that you are running the latest version of the software engine. + +Activating Other Exams + +The exam software installation process, and the registration process, only has to happen once. Then, for each new exam, only a few steps are required. For example, if you buy another new Cisco Press Official Cert Guide or Pearson IT Certification Cert Guide, extract the activation code from the CD sleeve in the back of that book—you don’t even need the CD at this point. From there, all you have to do is start the exam engine (if not still up and running), and perform Steps 2 through 4 from the previous list. +Chapter 12: Final Preparation 703 + +Premium Edition + +In addition to the free practice exam provided on the CD-ROM, you can purchase addi-tional exams with expanded functionality directly from Pearson IT Certification. The Premium Edition of this title contains an additional two full practice exams as well as an eBook (in both PDF and ePub format). In addition, the Premium Edition title also has remediation for each question to the specific part of the eBook that relates to that question. + +Because you have purchased the print version of this title, you can purchase the Premium Edition at a deep discount. There is a coupon code in the CD sleeve that contains a one-time use code as well as instructions for where you can purchase the Premium Edition. + +To view the Premium Edition product page, go to www.informit.com/title/ 9780133481648. + +The Cisco Learning Network + +Cisco provides a wide variety of CCIE Routing and Switching preparation tools at a Cisco Systems website called the Cisco Learning Network. This site includes a large vari-ety of exam preparation tools, including sample questions, forums on each Cisco exam, learning video games, and information about each exam. + +To reach the Cisco Learning Network, go to www.cisco.com/go/learningnetwork, or just search for “Cisco Learning Network.” You will need to use the login that you created at www.cisco.com. If you don’t have such a login, you can register for free. To register, sim-ply go to www.cisco.com, click Register at the top of the page, and supply the requested information. + +Memory Tables + +Like most Official Cert Guides from Cisco Press, this book purposefully organizes infor-mation into tables and lists for easier study and review. Rereading these tables can be very useful before the exam. However, it is easy to skim over the tables without paying atten-tion to every detail, especially when you remember having seen the table’s contents when reading the chapter. + +Instead of simply reading the tables in the various chapters, this book’s Appendices E and F give you another review tool. Appendix E lists partially completed versions of many of the tables from the book. You can open Appendix F (a PDF on the CD that comes with this book) and print the appendix. For review, you can attempt to complete the tables. This exercise can help you focus on the review. It also exercises the memory connectors in your brain; plus it makes you think about the information without as much informa-tion, which forces a little more contemplation about the facts. + +Appendix F, also a PDF located on the CD, lists the completed tables to check yourself. You can also just refer to the tables as printed in the book. +704 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter-Ending Review Tools + +Chapters 1–11 have several features in the “Foundation Summary” sections at the end of the chapter. You might have already worked through these in each chapter. It can also be useful to use these tools again as you make your final preparations for the exam. + +Suggested Plan for Final Review/Study + +This section lists a suggested study plan from the point at which you finish reading the last chapter of Volume 2 of this book, until you take the 400-101 CCIE Routing and Switching written exam. Certainly, you can ignore this plan, use it as is, or just take sug-gestions from it. + +The plan uses three steps: + +Step 1. Review Key Topics and DIKTA Questions: You can use the table that lists the key topics in each chapter, or just flip through the pages looking for key topics. Also, reviewing the “Do I Know This Already?” (DIKTA) questions from the beginning of the chapter can be helpful for review. +Step 2. Complete Memory Tables: Open Appendix E on the CD and print the entire appendix, or print the tables by major part. Then complete the tables. + +Step 3. Use the Pearson Cert Practice Test Engine to Practice: The Pearson Cert Practice Test engine on the CD can be used to study using a bank of unique exam-realistic questions available only with this book. + +Using the Exam Engine + +The Pearson Cert Practice Test engine on the CD includes a database of questions cre-ated specifically for this book. The Pearson Cert Practice Test engine can be used either in study mode or practice exam mode, as follows: + +■ Study mode: Study mode is most useful when you want to use the questions for learning and practicing. In study mode, you can select options like randomizing the order of the questions and answers, automatically viewing answers to the questions as you go, testing on specific topics, and many other options. + +■ Practice Exam mode: This mode presents questions in a timed environment, provid-ing you with a more exam-realistic experience. It also restricts your ability to see your score as you progress through the exam and view answers to questions as you are taking the exam. These timed exams not only allow you to study for the actual 400-101 CCIE Routing and Switching written exam, but they also help you simulate the time pressure that can occur on the actual exam. + +When doing your final preparation, you can use study mode, practice exam mode, or both. However, after you have seen each question a couple of times, you will likely start to remember the questions, and the usefulness of the exam database might go down. So, consider the following options when using the exam engine: +Chapter 12: Final Preparation 705 + +■ Use this question database for review. Use study mode to study the questions by chapter, just as with the other final review steps listed in this chapter. Plan on getting another exam (possibly from the Premium Edition) if you want to take additional simulated exams. + +■ Save the question database, not using it for review during your review of each book part. Save it until the end so that you will not have seen the questions before. Then, use practice exam mode to simulate the exam. + +Picking the correct mode from the exam engine’s user interface is pretty obvious. The following steps show how to move to the screen from which to select study or practice exam mode: +Step 1. Click the My Products tab if you are not already in that screen. + +Step 2. Select the exam that you want to use from the list of available exams. + +Step 3. Click the Use button. + +When you take these actions, the engine should display a window from which you can choose Study Mode or Practice Exam Mode. When in study mode, you can further choose the book chapters, limiting the questions to those explained in the specified chapters of the book. + +Summary + +The tools and suggestions listed in this chapter have been designed with one goal in mind: to help you develop the skills required to pass the 400-101 CCIE Routing and Switching written exam. This book has been developed from the beginning to not just tell you the facts but also to help you learn how to apply the facts. No matter what your experience level leading up to taking the exams, it is our hope that the broad range of preparation tools, and even the structure of the book, will help you pass the exam with ease. We hope you do well on the exam. + + + + + + + + + + +This page intentionally left blank +APPENDIX A + + + + +Answers to the “Do I Know This Already?” Quizzes + + +Chapter 1 Chapter 3 + +1. C and E + +2. A + +3. D + +4. B and C + +5. B and C + +6. B + +7. A, B, and D + +8. C + +9. C + +1. B + +2. C + +3. A and C + +4. B and C + +5. C + +6. D + +7. C, D, and F + +8. E + +9. A, B, and C + + + +10. D + +11. C + +12. D + + +Chapter 2 + +10. C + +11. D + + +Chapter 4 +1. D + + + +1. A and D + +2. A and B + +3. C + +4. B + +5. A + +6. A + +7. A and B + +8. A, B, and C + +2. C + +3. D + +4. A and D + +5. A + +6. C and D + +7. B + +8. A and B + +9. B + + +9. A, C, and D 10. C + +10. C 11. A +708 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 5 Chapter 7 + +1. C and D + +2. A and E + +3. B and D + +4. D + +5. D + +6. D + +7. B and D + +1. A, B, and C + +2. A + +3. B and C + +4. A + +5. A and E + +6. A, B, D, and E + +7. B and D + + +8. A, C, and D +9. C Chapter 8 + +10. A + +11. A + +12. A, B, C, and D + +13. E + +14. A + +15. B + + +Chapter 6 + +1. C and D + +2. A, C, E, and H + +3. B, D, F, and G + +4. D + +5. A, C, and D + +6. A, B, C, D, and G + +7. C, D, E, F, and G + +8. A, C, and D + +1. C 9. C and E + + +2. C + +3. B + +4. C, D, and E + +5. B and D + +6. A + +7. E + +8. E + +9. C + +10. C, D, E, F, and G + +11. A, B, C, D, E, F, and G + +12. A + +13. B + +14. C + +15. B + +16. B + +17. A + + + +10. C + +11. A and C + +18. A + +19. B, C, D, and F + +20. B, C, and E + +21. B + +22. D +Appendix A: Answers to the “Do I Know This Already?” Quizzes 709 + +23. B 4. G + +24. C 5. B + +25. B, D, and E 6. C + +26. C, D, and F 7. D + +27. C and E 8. A + +28. A and C 9. A + + +29. B, D, and F + +30. A, B, and C + +31. B and C + + +Chapter 9 + +10. A, D, F, G, and H + +11. D + +12. D + +13. B, D, and E + +14. B + + + +1. B and C + +2. A and C + +3. C + +4. B and D + +5. A + +6. C and D + +7. A and B + +8. B + +9. B and D + + +15. C and D + +16. A, B, and F + +17. D + +18. A, C, and D + +19. A + +20. C + +21. B + +22. A and D + +23. A, B, and D + + + +10. A and E + +11. C and F + +12. A + +13. A, D, and E + +14. B, C, and D + +15. C and E + +16. B, E, and F + + +Chapter 10 + + +24. B + +25. C, E, and G + +26. A and D + +27. B, D, and H + +28. C and E + +29. D + +30. A, B, and C + +31. B + +32. B and C + +1. D 33. A and B 2. C +3. B +710 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 11 1. A and D +2. C and D + +3. A + +4. A and B + +5. C + +6. A + +7. D + +8. A and C + +9. B, D, and E + +10. D + +11. D + +12. B + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + +This page intentionally left blank +APPENDIX B + + + + + + +CCIE Exam Updates + + +Over time, reader feedback enables Cisco Press to gauge which topics give our readers the most problems when taking the exams. Additionally, Cisco might make small changes in the breadth of exam topics or in the emphasis of certain topics. To assist readers with those topics, the author creates new materials clarifying and expanding upon those trou-blesome exam topics. + +The document you are viewing is Version 1.0 of this appendix and there are no updates. You can check for an updated version at www.ciscopress.com/title/9781587143960. + +Index + + + + + + + + +Numerics + +2-Way state, OSPF routers, 463 +802.1d STP. See STP (Spanning Tree Protocol) +802.1Q trunking, 69-70 configuring, 71-75 +802.1Q-in-Q tunneling, 79-83 +802.1s. See MST (Multiple Spanning Trees) +802.1w RSTP. See RSTP (Rapid STP) + +A + +ABRs (Area Border Routers), 480 best path selection, 502-505 +access ports, protecting BPDU Filter, 150-151 BPDU Guard, 149-150 +accessing Cisco IOS routers and switches +HTTPS access, implementing, 257-258 +SSH access, implementing, 258 Telnet access, implementing, 258 +ACK packets (EIGRP), 372-373 +Acknowledgment field, EIGRP pack-ets, 369 +Active state (EIGRP), 381 active switches (VSS), 30 active VLANs, 76 +Add-Path support (EIGRP), 421-423 + + +Address Family configuration mode, 414-415 +address family support, OSPFv3, 548-551 +addresses, Ethernet, 15-18 format, 17-18 +most significant byte, 17 adjacencies, IS-IS, 578-579, 587 Adjacency State TLV, 589-591 adjusting +administrative distance (EIGRP), 360 EIGRP hop-count limitations, 359 +administrative distance, 644 EIGRP, adjusting, 360 +preventing suboptimal routes, 656-659 +advertising default routes, 665-672 +using default-information originate command, 669 +using ip default-network command, 670-671 +using redistribute static command, 667-668 +AFI (Authority and Format Identifier), 573-574 +AFT (Address Family Translation), 220 +agents (SNMP), 244 +AH (Authentication Header), 546 alarms (RMON), 255 +allowed VLANs, 76 Alternate Ports (RSTP), 130 +anycast addresses, 216 + + + + + + + + + + + +architecture, CEF, 275-276 areas +ABRs, best path selection, 502-505 IS-IS +inter-area routing, 598-600 intra-area routing, 599 +stubby areas, 496-501 configuring, 498-501 NSSAs, 498-499 +ARP (Address Resolution Protocol), 232-233 +ASBRs (Autonomous System Boundary Routers), 481 +ATT flag (LSPs), 602-603 Attempt state, OSPF routers, 463 authentication +EIGRP, 356, 432-435 IS-IS, 608-610 +key chains, 337 OSPF +configuring, 517-520 +SHA-HMAC, configuring, 520-522 +on virtual links, configuring, 520 +OSPFv3, 546-547 PfR, 674-675 RIPng, 340 +RIPv2, configuring, 337 SNMP, 245 +automatic route summarization, 428 + +autonegotiation (Ethernet), 9 autosummarization, 335-337 +AVG (Active Virtual Gateway), 239 + +B + +bandwidth metric component, 361 basic configuration, SPAN, 26 BDRs (backup DRs), 469 +best path selection, 317 OSPF, 502-505 +BGP (Border Gateway Protocol), 317 binary shortcuts +exclusive summary routes, finding, 204-205 +finding all subnets of a network, 196-198 +inclusive summary routes, finding, 202-203 +bitwise Boolean ANDs, 193 Blocking state (STP), 107 +transitioning to Forwarding state, 119 +BOOTP (Bootstrap Protocol), 233-234 +comparing with DHCP and RARP, 236 +border routers (PfR), 676-677 configuring, 681-683 +BPDU Filter, 150-151 +BPDU Guard, 149-150 +716 BPDUs (Bridge Protocol Data Units) + + +BPDUs (Bridge Protocol Data Units), 107-109 +Configuration BPDUs, 108 Dispute mechanism, 154 format, 107 +priorities, 108 RBID, 109 RSTP, 132-133 +Topology Change BPDUs, 108 +BRAS (Broadband Remote Access Server), 96 +Bridge Assurance, 154 +broadcast address, discovering, 195-196 broadcast links, 587 +IS-IS over, 592-598 +DIS, election process, 592-593 +IS-IS router synchronization, 593-594 +pseudonodes, 594-598 broadcast MAC addresses, 15 broadcast networks, 473 broadcast subnets, 192 + +C + +cabling +Category 5, 8-9 crossover, 8 straight-through, 8 +calculating +composite metric, 363-364 OSPF cost, 508-509 +CAM (Content Addressable Memory), updating, 117-119 +canonical bit order, 17 Category 5 wiring, 8-9 +CD (Computed Distance), 386-387 +CDP (Cisco Discovery Protocol), trou-bleshooting Layer 2 issues, 163-165 +CEF (Cisco Express Forwarding), 273-285 + +architecture, 275-276 example of, 277-281 FIB, 274 +load sharing, 282-285 algorithms, 285 +lookup process, 274 polarization, 284-285 RIB, 274 +channel-group command, 33 channel-protocol command, 161 Checksum field, EIGRP packets, 369 +CIDR (classless interdomain routing), 206-207 +Cisco Catalyst switches, SPAN, 22-25 Cisco Flexible NetFlow, 250-252 +configuring, 251-252 +Cisco IOS Embedded Event Manager, 253-254 +Cisco IOS IP SLA, 249-250 configuring, 250 +Cisco Learning Network, 703 +Cisco switch ports, configuring, 11-14 +CIST (Common and Internal Spanning Tree), 140-141 +Class Metrics, 360-362 classful addressing, 189-191 classic mode (EIGRP), 410 +classic OSPF authentication, configur-ing, 517-520 +classless addressing, 191 +clear eigrp address-family command, 444 +clear ip ospf process command, 508-509 +clear ip route command, 444 clearing +IP routing table, 444 OSPF process, 507-510 +CLNP (ConnectionLess-mode Network Protocol), 572 +clusters, 247 +configuring 717 + + +collision domains, 10-11 collisions, CSMA/CD, 10 commands +channel-group, 33 channel-protocol, 161 +clear eigrp address-family, 444 clear ip ospf process, 508-509 clear ip route, 444 +debug pppoe, 98 +default-information originate, 669 distance, 658-659 +distribute-list, 511-513 extended ping, 691-692 extended traceroute, 693-694 ip cef, 282 +ip cef load-sharing algorithm, 285 ip default-network, 670-671 +ip eigrp traffic, 371-372 ip ftp, 256 +ip load-share, 283 +is-is circuit-type, 618 network 0.0.0.0, 436 passive-interface, 431-432 pppoe session, 98 redistribute, 645 +redistribute static command, 667-668 route-map, 638-640 +router isis, 616 +router process, 425-426 +set commands (PBR), 296-299 show clns, 620-622 +show interfaces, 167-169, 688-690 show ip ospf database, 488 +show ip protocols, 426-427, 686-687 show ip route isis, 617 +show ip route ospf, 516-517 show ip sla monitor statistics, 250 show isis database, 601-603 +show isis hostname, 581-583 +show rmon alarm, 255 + +show rmon event, 255 +show running-config, 240-241 show sdm prefer, 299 +switch convert mode virtual, 33-34 tftp-server, 257 +communication rules for Private VLANs, 64-65 +communities (SNMP), 242 community VLANs, 61 comparing +ARP and Proxy ARP, 232 +BOOTP with DHCP and RARP, 236 ISL and 802.1Q, 69 +LSAs and LSPs, 584-585 OSPFv2 and OSPFv3, 533-534 +complex configuration, SPAN, 26 component metrics, 360-361 +bandwidth, 361 delay, 361-362 hop count, 363 +influencing path selection with, 368 load, 362-363 +MTU, 363 reliability, 362 +component routes, 663 +composite metric, calculating, 363-364 Conditional Receive, 375 Configuration BPDUs, 108-109 +configuration files, copying with FTP, 256 +configuring +802.1Q trunking, 71-75 +Cisco Flexible NetFlow, 251-252 +Cisco IOS Embedded Event Manager, 254 +Cisco IOS IP SLA, 250 Cisco switch ports, 11-14 DHCP, 235-236 +Dynamic NAT without PAT, 212-214 +718 configuring + + +EIGRP +Add-Path feature, 422-423 authentication, 432-435 named mode, 410-417 OTP, 439-442 +route summarization, 430-431 ERSPAN, 27-28 +EtherChannel Port-channels, 157-161 HSRP, 237-238 +IPv6 +host addresses, 216-217 +Stateless Address Autoconfiguration, 217 +IS-IS, 613-624 authentication, 608-610 +ISL, 71-75 MLS, 291-295 MST, 144-148 NTP, 240-241 OSPF, 505-507 +authentication, 517-520 incremental SPF, 527-528 LSA Throttling, 526-527 SPF Throttling, 524-525 stubby areas, 498-501 virtual links, 515-517 +OSPFv3, 537-545 +over Frame Relay, 537 +PAT (Port Address Translation), 212-214 PfR (Performance Routing), 677 +border routers, 681-683 MC, 677-681 +PPPoE, 96-98 +Private VLANs, 67-68 RIPng, 340-341 RIPv2, 334-339 +authentication, 337 +RMON, 255 + +route maps +match commands, 640-641 +with route-map command, 638-640 +RSPAN, 26-27 SNMP, 245 SPAN +basic configuration, 26 complex configuration, 26 +STP, 124-128 +stub routing, 529-530 trunking +options, 76-77 on routers, 77-79 +VLANs, 51-52 +in configuration mode, 56-57 interfaces, 55-56 +operational states, 57-69 VSS, 31-34 +VTP, 89-95 +extended-range VLANs, 94 +global configuration options, 90-91 +normal-range VLANs, 94 storing the configuration, 94-95 +WCCP, 248-249 +confirming Wide Metric support, 365-366 +conflicts, 88 +connection-mode operation (OSI), 572 +connectionless-mode operation, OSI net-work layer, 572 +content engines, WCCP, 246-249 +contents of EIGRP topology table, 382-384 +Control field (Ethernet), 15 +control plane, 266 +DHCP (Dynamic Host Configuration Protocol) 719 + + +convergence RIPv2, 334 +steady-state operation, 327-328 +timers for stalled routing update reception, 331-333 +triggered updates, 328-331 STP, 115-117 +copying +configuration files with FTP, 256 SCP, 257 +costs +OSPF, 507-510 STP, 113 +Counting to Infinity, 322 +creating VLANs in VLAN database con-figuration mode, 52-55 +crossover cabling, 8 +CSMA/CD (Carrier Sense Multiple Access with Collision Detection), 10 +CSNP (Complete Sequence Numbers PDU) packets, 585-586 +CST (Common Spanning Tree), 120-124 + +D + +data plane, 266 +database exchange, OSPF +DD packet exchange, 466-468 dead interval, 465 +DRs, 469 +Hello messages, 464-466 LSAs +requesting, 468-469 sequence numbers, 468 +neighbor states, 462-464 RIDs, 460-461 +transmitting LSA headers to neighbors, 466 +DBD (Database Description) messages, 461 + +DD (Database Description) packet exchange, 466-468 +deactivating current IGPs, 301-303 dead interval (OSPF), 465 +debug commands, troubleshooting Layer 3 issues, 694 +debug pppoe command, 98 decimal shortcuts +all subnets of a network, finding, 198-200 +broadcast address, finding, 195-196 +inclusive summary routes, finding, 203-204 +subnet number, finding, 194-196 +default-information originate command, 669 +default routing, 665-672 EIGRP, 435-436 +using default-information originate command, 669 +using ip default-network command, 670-671 +using redistribute static command, 667-668 +using route summarization, 671-672 +default settings for route redistribution, 646-649 +delay metric component, 361-362 +DES (Digital Encryption Standard), 245 designing OSPF networks, 496 +ABRs, 480 ASBRs, 481 +path selection, 482 +Destination Service Access Point field (Ethernet), 15 +DHCP (Dynamic Host Configuration Protocol), 233-236 +configuring, 235-236 +database agents, 235 +720 DHCPv6 + + +DHCPv6, 217-218 +diagnostic commands, IS-IS, 620-622 +diffusing computation (EIGRP), 359, 392-396 +Dijkstra SPF algorithm, 479 DIS (Designated IS), 579 +election process, 592-593 discard routes, 429 Discarding state (RSTP), 129 displaying RID, 419-420 +Dispute mechanism (BPDUs), 154 distance command, 658-659 +distance-vector routing protocols, 316-317 +best path selection, 317 Counting to Infinity, 322 EIGRP +ACK packets, 372-373 +Add-Path support, 421-423 +administrative distance, adjusting, 360 +authentication, 432-435 bandwidth metric component, 361 clearing IP routing table, 444 +composite metric, calculating, 363-364 +default routing, 435-436 +delay metric component, 361-362 diffusing computations, 359 DUAL, 359, 380-410 +dynamic neighbor discovery, 376 event logging, 443 +Feasibility Condition, 359 Graceful Shutdown, 432 Hello packets, 372 +Hello protocol, 358 history of, 357 +hop count metric component, 363 +hop-count limitations, adjusting, 359 + + +load metric component, 362-363 metrics, 360-361 +neighbor table, 379 offset lists, 444 OTP, 437-442 packets, 368-374 +passive interfaces, 431-432 Query packets, 374 +reliability metric component, 362 Reply packets, 374 +RID, 417-420 +route filtering, 443-444 +route summarization, 427-431, 664-665 +router adjacencies, 376-379 RTP, 358, 374-376 Sequence number, 374 +SIA-Query packets, 374 SIA-Reply packets, 374 Split Horizon, 436-437 stub routing, 423-427 topology table, 384-385 +unequal-cost load balancing, 420-421 +unreachable routes, 362 Update packets, 373 Wide Metrics, 364-368 +migration strategy, 299-308 activating new IGP, 300-301 +deactivating current IGPs, 301-303 +verifying working database con-tents, 301 +path-vector routing protocols, 317 RIPv2, 318-320 +autosummarization, 335-337 configuring, 334-339 convergence, 334 +distribute lists, 338-339 +features, 318 +EIGRP (Enhanced Interior Gateway Routing Protocol) 721 + + +Flushed after timer, 326 Holddown timer, 324-325 Invalid timer, 324-325 loop prevention, 320-326 messages, 319-320 metrics, 320 +next-hop feature, 338 offset lists, 338 prefix lists, 338-339 Route Poisoning, 323 +Split Horizon, 322, 338 +steady-state convergence, 327-328 +timers for stalled routing update reception, 331-333 +triggered updates, 323, 328-331 distribute lists, 338-339 +distribute-list command, 511-513 Down state, OSPF routers, 463 downloading practice exam, 702 +DP (Designated Port), selecting, 113-115 +draft-savage-eigrp, 356 DRs (designated routers) +on LANs, 469 +election process, 471-472 optimizing, 470-471 +on WANs, 472-474 +DSCP (Differentiated Services Code Point), 251 +DSP (Domain Specific Part), 573-574 +DUAL (Diffusing Update Algorithm), 359, 380-410 +FSM, 397-402 +SIA states, 402-410 topology table, 380-384 +dual stack, 218-219 +duplex settings, 9 + +Dynamic NAT without PAT, 210-211 configuring, 212-214 +dynamic neighbor discovery (EIGRP), 376 +dynamic routing, 316-318 + +E + +edge routers, WCCP, 246-247 +EIGRP (Enhanced Interior Gateway Routing Protocol) +Add-Path support, 421-423 administrative distance, adjusting, 360 authentication, 356, 432-435 +Class Metrics, 362 default routing, 435-436 +diffusing computations, 359 DUAL, 359, 380-410 +SIA states, 402-410 topology table, 380-384 +dynamic neighbor discovery, 376 event logging, 443 +Feasibility Condition, 359 features, 356 +Graceful Shutdown, 432 Hello protocol, 358 history of, 357 +hop-count limitations, adjusting, 359 IP routing table, clearing, 444 +LISP, 437-438 +manual route summarization, 357 metrics, 360-361 +bandwidth, 361 +composite metric, calculating, 363-364 +delay, 361-362 +hop count, 363 +722 EIGRP (Enhanced Interior Gateway Routing Protocol) + + +influencing path selection with, 368 +load, 362-363 MTU, 363 reliability, 362 +Wide Metrics, 364-368 named mode, 410-417 +Address Family configuration mode, 414-415 +Per-AF Interface configuration mode, 415 +Per-AF Topology configuration mode, 416-417 +neighbor table, 379 offset lists, 444 +open source implementation, 356 OTP, 437-442 +configuring, 439-442 packets, 368-374 +ACK packets, 372-373 format, 368-371 +Hello packets, 372 Query packets, 374 Reply packets, 374 +SIA-Query packets, 374 SIA-Reply packets, 374 TLVs, 369 +Update packets, 373 passive interfaces, 431-432 RID, 417-420 +displaying, 419-420 value selection, 419 +route filtering, 443-444 route redistribution +into OSPF, 650 +route summarization, 427-431, 664-665 +automatic route summarization, 428 +configuring, 430-431 + +discard routes, 429 +manual route summarization, 428 route tags, 356 +router adjacencies, 376-379 Hold time, 377 Pending state, 378 +Q Cnt, 379 Up state, 378 +RTP, 358, 374-376 Conditional Receive, 375 +Sequence number, 374 Split Horizon, 436-437 stub routing, 423-427 +Query handling, 424 topology table, 384-385 +Active state, 381 CD, 386-387 contents of, 382-384 +diffusing computation, 392-396 FD, 387-391 +local computation, 392 Passive state, 381 +RD, 386-387 +show commands, 385-387 topology changes, 391-396 +unequal-cost load balancing, 420-421 unreachable routes, 362 +Wide Metrics latency, 366 throughput, 366 +election process DISs, 592-593 DRs, 471-472 +root switch, 110-111 +Embedded Event Manager. See Cisco IOS Embedded Event Manager +external routes (OSPF) 723 + + +enabling OSPFv3, 537-545 +ERSPAN (Encapsulated Remote SPAN), 22-25 +configuring, 27-28 restrictions, 24-25 traffic supported, 25 +ES (End System), 571 +ESP (Encapsulating Security Payload), 546 +EtherChannel, 154-161 CSMA/CD, 10 +LACP, 159-161 +load balancing, 154-156 MEC, 31 +PAgP, 159-161 +Port-channels, configuring, 157-161 RJ-45 pinouts, 8-9 +switching loops, 159 troubleshooting, 174-175 +Ethernet, 3-2 addresses, 15-18 +format, 17-18 +most significant byte, 17 autonegotiation, 9 +Category 5 cabling, 8-9 +Cisco switch ports, configuring, 11-14 collision domains, 10-11 +duplex settings, 9 framing, 14-15 +Length field, 18 Type field, 18 +header fields, 15 hubs, 10 +PPPoE, configuring, 96-98 SNAP headers, 14 +speed, 9 + +switches, 11 +MAC address learning process, 19-22 +VSS, 28-38 +active and standby switches, 30 configuring, 31-34 +MEC, 31 verifying, 35-38 VSL, 30 +event detectors, 253 event logging +Cisco IOS Embedded Event Manager, 253-254 +EIGRP, 443 Syslog, 245-246 +events (RMON), 254 examples +of CEF operation, 277-281 +of OSPF over NBMA networks, 474-479 +of prefix lists, 643 of RITE, 252 +exception dumps, sending with FTP, 256 Exchange state, OSPF routers, 463 +exclusive summary routes, finding, 204-205 +ExStart state, OSPF routers, 463 +extended cryptographic OSPF authenti-cation, configuring, 517-520 +Extended Local Circuit IDs, 587-589 extended metrics (EIGRP), 366 extended ping command, 691-692 extended traceroute command, 693-694 extended-range VLANs, configuring, 94 external costs (MST), 140 +external interfaces, 674 +external routes (OSPF), 492-495 +724 fast switching + + +F + +fast switching, 272-273 +FD (Feasible Distance), 387-391 FDX (full duplex), 9 +Feasibility Condition (EIGRP), 359 Feasible Successors +diffusing computation, 392-396 unequal-cost load balancing, 420-421 +features EIGRP, 356 of RIPv2, 318 of VTP, 84 +FED (Forwarding Engine Driver), 40 +FFM (Forwarding and Feature Manager), 40 +FIB (Forwarding Information Base), 274 fields +of EIGRP packets, 368-371 of Ethernet headers, 15 +filtering OSPF +route filtering, 510-513 +Type 3 LSA filtering, 513-515 finding +all subnets of a network binary shortcut, 196-198 decimal shortcut, 198-200 +broadcast address, decimal shortcut, 195-196 +exclusive summary routes, binary short-cut, 204-205 +inclusive summary routes binary shortcut, 202-203 decimal shortcut, 203-204 +subnet number, decimal shortcut, 194-196 +valid range of IP addresses, decimal shortcut, 194-196 +Flags field, EIGRP packets, 369 + + +flooding +double flooding, 469 LSAs, 469 +LSPs, 591-592 +flow exporters (NetFlow), 251 flow monitors (NetFlow), 251 flow samplers (NetFlow), 251 Flushed after timer, 326 format +of BPDUs, 107 +of EIGRP packets, 368-371 of Ethernet addresses, 17-18 of IP addresses, 192 +of IPv6 addresses, 215 +of NSAP addresses, 574-575 Forwarding state (STP), 119 fragmentation, 214 +LSPs, 581 +Frame Relay, configuring OSPFv3 over, 537 +framing, Ethernet, 14-15 Length field (Ethernet), 18 Type field, 18 +FSM (DUAL Finite State Machine), 397-402 +FTP (File Transfer Protocol), 255-256 Full state, OSPF routers, 464 + +G + +Garcia-Luna-Aceves, Dr. J. J., 390 +GLBP (Gateway Load Balancing Protocol), 239 +global configuration options, VTP, 90-91 GR (Graceful Restart), 530-532 Graceful Shutdown, 432 +OSPF, 532 +OSPFv3, 552 +IP addressing 725 + + +H + +HDX (half duplex), 9 +Hello messages (OSPF), 461, 464-466 Hello packets +EIGRP, 372 +IS-IS, 579-580 authentication, 608-610 +Hello protocol (EIGRP), 358 history of EIGRP, 357 +HO-DSP (High-Order Domain Specific Part), 574 +Hold time, 377 +Holddown timer (RIPv2), 324-325 hop count metric component, 363 +hop-count limitations (EIGRP), adjust-ing, 359 +host addresses (IPv6), configuring, 216-217 +HSRP (Hot Standby Router Protocol), 236-239 +configuring, 237-238 MHSRP, 239 +HTTPS access, implementing, 257-258 +hub-and-spoke networks, stub routing, 425 +hubs (Ethernet), 10 + +I + +IDI (Initial Domain Identifier), 573-574 IDP (Initial Domain Part), 573 +IDSs (intrusion detection systems), RITE implementation, 252-253 +IETF Internet Drafts, draft-savage-eigrp, 356 +I/G (Individual/Group) bit, 17-18 + + +IGRP (Interior Gateway Routing Protocol), 357 +timers, 357-358 +Update packets, 357-358 weaknesses of, 358 +IIH (IS-IS Hello) packets Adjacency State TLV, 589-591 authentication, 608-610 +implementing +Cisco IOS IP SLA, 249-250 NetFlow, 250-252 +RITE, 252-253 RMON, 254-255 +inclusive summary routes, finding binary shortcut, 202-203 decimal shortcut, 203-204 +incremental SPF, 527-528 inferior BPDUs, 108 +influencing route redistribution with metrics, 661-663 +Init state, OSPF routers, 463 initiating FTP transfers, 256 +installing Pearson Cert Practice Test engine, 700-702 +Integrated IS-IS, 571 +inter-area routing (IS-IS), 598-600 interface states (STP), 119 +interface subcommands, configuring OSPF, 518-520 +interfaces, creating on VLANs, 55-56 internal interfaces, 674 +internal usage VLANs, 288-290 internetworks, 191 +intra-area routing (IS-IS), 599 Invalid timer (RIPv2), 324-325 IOS-XE, 38-40 +IP addressing. See also IPv6 address format, 192 +bitwise Boolean ANDs, 193 +CIDR, 206-207 +726 IP addressing + + +classful addressing, 189-191 classless addressing, 191 fragmentation, 214 +IP, 187 +NAT, 207-208 +Dynamic NAT without PAT, 210-214 +PAT, 211-214 +Static NAT, 209-210 private addressing, 207 +route summarization, 201-205 +inclusive summary routes, finding, 202-204 +subnetting. See subnetting TCP, 187-188 +UDP, 188 VLSM, 200-201 +ip cef command, 282 +ip cef load-sharing algorithm command, 285 +ip default-network command, 670-671 ip eigrp traffic command, 371-372 +ip ftp command, 256 +ip load-share command, 283 +ip ospf process-id area area-id interface subcommand, 510 +IP routing +CEF, 273-285 architecture, 275-276 example of, 277-281 FIB, 274 +load sharing, 282-285 lookup process, 274 polarization, 284-285 RIB, 274 +fast switching, 272-273 +forwarding process, 271-272 + +MLS, 286-295 configuring, 291-295 +Layer 3 interfaces, 291 logic, 286-287 +Port-channels, 291 routed ports, 287-291 SVI, 286-287 +PBR, 296-299 logic, 296 +matching criteria, specifying, 296 SDM templates, 299 +set commands, 296-299 IP routing table, clearing, 444 IP services +ARP, 232-233 BOOTP, 233-234 DHCP, 233-236 +configuring, 235-236 database agents, 235 +FTP, 255-256 GLBP, 239 HSRP, 236-239 +HTTPS access, implementing, 257-258 MHSRP, 239 +NTP, 240-241 +Proxy ARP, 232-233 RARP, 233-234 +SCP, 257 SNMP, 241-245 +communities, 242 configuring, 245 MIB, 242, 244 +protocol messages, 243-244 RMON, 244 +security, 245 Traps, 244 versions, 242 +Syslog, 245-246 +IST (Internal Spanning Tree) 727 + + +Telnet access, implementing, 258 VRRP, 239 +WCCP, 246-249 +IP SLA. See Cisco IOS IP SLA +IP Traffic Export. See RITE (Router IP Traffic Export) +IPCP (IP Configuration Protocol), 96 IPsec, OSPFv3 configuration, 546-547 IPv6, 214-220 +address format, 215 address types, 216 DHCPv6, 217-218 fragmentation, 214 +host address, configuring, 216-217 IS-IS support for, 610-613 network prefix, 215-216 +RIPng, 339-341 authentication, 340 messages, 339 +Stateless Address Autoconfiguration, 217 +stateless DHCPv6, 218 transition technologies, 218-220 +IS-IS +adjacencies, 578-579, 587 areas, 598-608 +inter-area routing, 598-600 intra-area routing, 599 +authentication, 608-610 broadcast links, 587 configuring, 613-624 diagnostic commands, 620-622 DIS, 579 +IPv6 support, 610-613 +link-state database in multiarea net-works, 603-608 +metrics, 577-578 +NSAP addressing, 571 + +over broadcast links, 592-598 +DIS, election process, 592-593 +IS-IS router synchronization, 593-594 +pseudonodes, 594-598 +over point-to-point links, 587-592 Local Circuit IDs, 588 +three-way handshakes, 589-592 packets, 579-586 +CSNP packets, 585-586 Hello packets, 579-580 LSPs, 580-585 +PSNP packets, 585-586 System IDs, creating, 613 +is-is circuit-type command, 618 ISL (Inter-Switch Link), 69-70 +configuring, 71-75 +ISO OSI (International Standards Organization Open Systems Interconnection) +ES, 571 +Extended Local Circuit IDs, 587-589 Level 0 routing, 576 +Level 1 routing, 576 Level 2 routing, 576-577 Level 3 routing, 577 Local Circuit IDs, 587 +network layer (OSI), modes of opera-tion, 572 +NSAP addressing, 573-576 DSP, 574 +format, 574-575 IDP, 573 +NSEL, 574 SNPA, 576 +Isolated PVLAN Trunks, 66-67 isolated VLANs, 61 +IST (Internal Spanning Tree), 139-140 +728 key chains + + +J-K + +key chains, 337 K-values, 364 + +L + +L4 port algorithm, 285 +LACNIC (Latin American and Caribbean Internet Addresses Registry), 207 +LACP (Link Aggregation Control Protocol), 159-161 +LANs DRs, 469 +election process, 471-472 optimizing, 470-471 +switch forwarding behavior, 19 Layer 2 +frame rewrites, 273 troubleshooting, 161-169, 175-176 +with CDP, 163-165 with LLDP, 165-167 +show interfaces command, 167-169 +Layer 3 +MLS interfaces, 291 troubleshooting, 695 +debug commands, 694 +extended ping command, 691-692 +extended traceroute command, 693-694 +show commands, 690-691 +show interfaces command, 688-690 +show ip interface command, 688-690 +show ip protocols command, 686-687 +Length field (Ethernet), 15, 18 +Level 0 routing, 576 + + +Level 1 routing, 576 Level 2 routing, 576-577 Level 3 routing, 577 +Link Aggregation, 154-161 load balancing, 154-156 +link-state database (IS-IS) in multiarea networks, 603-608 +link-state routing protocols, 317-318 IS-IS +adjacencies, 578-579, 587 broadcast links, 587 +DIS, 579 +IPv6 support, 610-613 metrics, 577-578 NSAP addressing, 571 +over broadcast links, 592-598 over point-to-point links, 587-592 packets, 579-586 +System IDs, creating, 613 migration strategy, 299-308 +activating new IGP, 300-301 +deactivating current IGPs, 301-303 +verifying working database con-tents, 301 +OSPF, 464-466 ABRs, 480 ASBRs, 481 +best path selection, 502-505 configuring, 505-507 +costs, 507-510 DRs, 469 +external routes, 492-495 GR, 530-532 +Graceful Shutdown, 532 incremental SPF, 527-528 LSA Throttling, 526-527 messages, 461-462 neighbor states, 462-464 +network types, 473 +LSR (Link-State Request) messages 729 + + +NSF, 530-532 +over NBMA networks, 474-479 path selection, 482 +prefix suppression (OSPF), 528-529 +RIDs, 460-461 +route summarization, 665 SPF calculation, 479 steady-state operation, 480 +stub routers, configuring, 529-530 stubby areas, 496-501 +transmitting LSA headers to neighbors, 466 +TTL Security Check, 522-523 Type 1 LSAs, 484-488 +Type 2 LSAs, 484-488 Type 3 LSAs, 488-492 Type 4 LSAs, 492-495 Type 5 LSAs, 492-495 +LISP (Locator/Identifier Separation Protocol), 437-438 +LLDP (Link Layer Discovery Protocol), troubleshooting Layer 2 issues, +165-167 +load balancing EtherChannel, 154-156 GLBP, 239 +methods for switching paths, 281 PVST+, 119-124 +unequal-cost load balancing, 420-421 load metric component, 362-363 +load sharing, CEF, 282-285 algorithms, 285 +Loading state, OSPF routers, 464 Local Circuit IDs, 587 +local computation, 392 local interfaces, 674 logging +EIGRP, 443 +Syslog, 245-246 + +logic +MLS, 286-287 PBR, 296 +of prefix lists, 642 route maps, 638-640 +lookup process, CEF, 274 Loop Guard, 259 +loop prevention +best path selection side effects on, 502-505 +RIPv2, 320-326 loopback networks, 473 LSA Throttling, 526-527 +LSAck (Link-State Acknowledgment) messages, 461 +LSAs +comparing with LSPs, 584-585 flooding, 469 +OSPFv3 types, 534-536 pseudonodes, 485 requesting, 468-469 sequence numbers, 468 +transmitting headers to neighbors, 466 Type 1 LSAs, 484-488 +Type 2 LSAs, 484-488 Type 3 LSAs, 488-492 filtering, 513-515 Type 4 LSAs, 492-495 Type 5 LSAs, 492-495 +LSDBs (Link-State Databases), 481-482 +LSPs (Link State Protocol Data Units), 580-585 +ATT flag, 602-603 +comparing with LSAs, 584-585 flooding, 591-592 fragmentation, 581 +O flag, 603 +Partition repair flag, 603 Remaining Lifetime value, 581 sequence numbers, 580-581 +LSR (Link-State Request) messages, 461 +730 MAC addresses + + +M + +MAC addresses, 15-18 format, 17-18 +switch learning process, 19-22 managers (SNMP), 244 +manual route summarization, 357, 428 +master/slave relationship, DD packet exchange, 466-468 +match commands for route maps, 640-641 +matching criteria for PBR, specifying, 296 +math used in subnetting, 192 +MC (Master Controller), 675-676 configuring, 677-681 +measuring performance, Cisco IOS IP SLA, 249-250 +MEC (Multichassis EtherChannel), 31 messages +OSPF, 461-462 +Hello process, 464-466 RIPng, 339 +RIPv2, 319-320 +SNMP protocol messages, 243-244 VTP, 85-86 +metrics +EIGRP, 360-361 bandwidth, 361 +composite metric, calculating, 363-364 +delay, 361-362 extended metrics, 366 hop count, 363 +influencing path selection with, 368 +load, 362-363 MTU, 363 reliability, 362 +Wide Metrics, 364-368 + + +IS-IS, 577-578 RIPv2, 320 +route redistribution, influencing, 661-663 +setting for route redistribution, 649 Wide Metrics, 365-368 +latency, 366 +support for, confirming, 365-366 MHSRP (Multiple HSRP), 239 +MIB (Management Information Base), 242, 244 +migration strategy for routing protocols, 299-308 +activating new IGP, 300-301 deactivating current IGPs, 301-303 +distance-vector routing protocols, 303-308 +verifying working database contents, 301 +MLS (Multilayer Switching), 286-295 configuring, 291-295 +Layer 3 interfaces, 291 logic, 286-287 +Port-channels, 291 routed ports, 287-291 SVI, 286-287 +modifying VLAN operational states, 57-69 +most significant byte, 17 +MST (Multiple Spanning Trees), 137-148 Bridge Assurance, 154 +CIST, 140-141 configuring, 144-148 external costs, 140 +interoperability with other STP versions, 141-144 +PortFast, 148-149 +principles of operation, 138-141 MTU metric component, 363 +multiaccess links, IS-IS, 587 +OSI (Open Systems Interconnection) 731 + + +multicast +naïve reliable multicast, 375 reliable multicast, 374 +multicast addresses, 216 multicast MAC addresses, 15 +mutual redistribution at multiple routers, 654-656 + +N + +naïve reliable multicast, 375 named mode (EIGRP), 410-417 +Address Family configuration mode, 414-415 +Per-AF Interface configuration mode, 415 +Per-AF Topology configuration mode, 416-417 +NAT (Network Address Translation), 207-208 +Dynamic NAT without PAT, 210-211 PAT, 211-212 +Static NAT, 209-210 NBMA networks, 473 +OSPF over caveats, 474 +example, 474-479 OSPFv3 over, 536-537 +neighbor states (OSPF), 462-464 neighbor table (EIGRP), 379 NetFlow +configuring, 251-252 implementing, 250-252 +network 0.0.0.0 command, 436 +network layer (OSI), modes of opera-tion, 572 +network prefix (IPv6), 215-216 network types, OSPF, 473 +Next Multicast Sequence TLV, 375 +next-hop feature (RIPv2), 338 + +Non-Edge Designated ports, 135 normal-range VLANs, configuring, 94 +NSAP (Network Service Access Point) addressing, 571, 573-576 +DSP, 574 format, 574-575 IDP, 573 +NSEL (NSAP Selector), 574 +NSF (Non Stop Forwarding), 530-532 NSSAs (not-so-stubby areas), 498-499 NTP (Network Time Protocol), 240-241 + +O + +O flag (LSPs), 603 offset lists, 338 +offset lists (EIGRP), 444 +Opcode field, EIGRP packets, 369 +open source EIGRP implementation, 356 operating systems, IOS-XE, 38-40 operational roles, PfR, 675 +operational states of VLANs, modifying, 57-69 +optimizing +DRs on LANs, 470-471 STP with PortFast, 148-149 +OSI (Open Systems Interconnection) ES, 571 +Extended Local Circuit IDs, 587-589 IS-IS dependence on, 571 +Level 0 routing, 576 Level 1 routing, 576 Level 2 routing, 576-577 Level 3 routing, 577 Local Circuit IDs, 587 +network layer, modes of operation, 572 NSAP addressing, 573-576 +DSP, 574 format, 574-575 +IDP, 573 +732 OSI (Open Systems Interconnection) + + +NSEL, 574 SNPA, 576 +OSPF. See also OSPFv3 ABRs, 480 +ASBRs, 481 authentication +classic OSPF authentication, con-figuring, 517-520 +SHA-HMAC, configuring, 520-522 +configuring, 505-507 costs, 507-510 database exchange +DD packet exchange, 466-468 LSAs, 468-469 +transmitting LSA headers to neighbors, 466 +dead interval, 465 DRs +on LANs, 469 optimizing, 470-471 on WANs, 472-474 +external routes, 492-495 filtering +route filtering, 510-513 +Type 3 LSA filtering, 513-515 GR, 530-532 +Graceful Shutdown, 532 incremental SPF, 527-528 LSAs +Type 1 LSAs, 484-488 Type 2 LSAs, 484-488 Type 3 LSAs, 488-492 Type 4 LSAs, 492-495 Type 5 LSAs, 492-495 +messages, 461-462 +Hello process, 464-466 neighbor states, 462-464 network types, 473 +NSF, 530-532 + +versus OSPFv3, 533-534 over NBMA networks +caveats, 474 example of, 474-479 +path selection +best path selection, 502-505 path choices not using cost, 502 +performance tuning +LSA Throttling, 526-527 SPF Throttling, 524-525 +prefix suppression, 528-529 RIDs, 460-461 +route redistribution into EIGRP, 650 route summarization, 665 +SPF calculation, 479 steady-state operation, 480 +stub routers, configuring, 529-530 stubby areas, 496-501 +TTL Security Check, 522-523 virtual links +authentication, configuring, 520 configuring, 515-517 +OSPFv3 +address family support, 548-551 authentication, 546-547 configuring, 537-545 +Graceful Shutdown, 552 LSA types, 534-536 NBMA networks, 536-537 versus OSPFv2, 533-534 +over Frame Relay, configuring, 537 SPI, 546 +verifying configuration, 541-545 virtual links, 534 +OTP (Over the ToP), 437-442 configuring, 439-442 +LISP, 437-438 +OUI (Organizationally Unique Identifier) field, 15 +point-to-multipoint nonbroadcast networks 733 + + +P + +packets. See also IP routing +EIGRP, 368-374. See also RTP (Reliable Transport Protocol) +ACK packets, 372-373 format, 368-371 +Hello packets, 372 Query packets, 374 Reply packets, 374 +SIA-Query packets, 374 SIA-Reply packets, 374 TLVs, 369 +Update packets, 373 forwarding process, 271-272 +fast switching, 272-273 IGRP, Update packets, 357-358 IS-IS, 579-586 +authentication, 608-610 CSNP packets, 585-586 Hello packets, 579-580 LSPs, 580-585 +PSNP packets, 585-586 +PAgP (Port Aggregation Protocol), 159-161 +Partition repair flag (LSPs), 603 passive interfaces (EIGRP), 431-432 Passive state (EIGRP), 381 +passive-interface command, 431-432 passwords, VTP, 87 +PAT (Port Address Translation), 211-212 configuring, 212-214 +path selection +influencing with interface metrics, 368 OSPF, 482 +best path selection, 502-505 path choices not using cost, 502 +path-vector routing protocols, 317 + + +PBR (Policy-Based Routing), 296-299 logic, 296 +SDM templates, 299 set commands, 296-299 +specifying matching criteria, 296 +Pearson Cert Practice Test engine, 700-705 +installing, 700-702 +practice exam, downloading, 702 Pending state (EIGRP), 378 +Per-AF Interface configuration mode (EIGRP), 415 +Per-AF Topology configuration mode (EIGRP), 416-417 +per-destination load sharing, 282-283 performance +Cisco IOS IP SLA, 249-250 OSPF +LSA Throttling, 526-527 SPF Throttling, 524-525 +per-packet load sharing, 282 +PfR (Performance Routing), 672-683 authentication, 674-675 +border routers, 676-677 configuring, 681-683 +configuring, 677 external interfaces, 674 internal interfaces, 674 local interfaces, 674 MC, 675-676 +configuring, 677-681 operational roles, 675 phases wheel, 673-674 +phases wheel (PfR), 673-674 PID (process ID), 465 pinouts, RJ-45, 8-9 +point-to-multipoint networks, 473 +point-to-multipoint nonbroadcast net-works, 473 +734 point-to-point links, IS-IS over + + +point-to-point links, IS-IS over, 587-592 Local Circuit IDs, 588 +three-way handshakes, 589-592 point-to-point networks, 473 polarization, CEF, 284, 285 +policy routing. See PBR (Policy-Based Routing) +Port-channels, 291 configuring, 157-161 +PortFast, 148-149 ports +Cisco switch ports, configuring, 11-14 promiscuous ports, 65 +routed ports, 287-291 RSTP, 128-131 +Alternate ports, 130 Backup Ports, 130 +Non-Edge Designated ports, 135 roles, 129 +types, 131 +VSL, configuring, 33 +PPPoE (Point-to-Point Protocol over Ethernet), configuring, 96-98 +pppoe session command, 98 practice exam, downloading, 702 Preamble field (Ethernet), 15 prefix lists, 338-339, 641-643 +examples, 643 logic, 642 +prefix suppression OSPF, 528-529 OSPFv3, 552 +prefixes, 191 +Premium Edition of this book, 703 preparing for exam +Cisco Learning Network, 703 memory tables, 703 +Pearson Cert Practice Test engine, 700-705 + +preventing suboptimal routes +setting administrative distance, 656-659 using route tags, 659-661 +primary servers, 88 +principles of MST operation, 138-141 priorities, 108 +private addressing, 207 Private VLANs, 60-68 +communication rules, 64-65 configuring, 67-68 +Isolated PVLAN Trunks, 66-67 secondary VLANs, 61-63 tagging rules, 64 +on trunks, 65-67 +Promiscuous PVLAN Trunks, 66 promiscuous ports, 65 +Promiscuous PVLAN Trunks, 66 +Proposal/Agreement process (RSTP), 133-136 +protocol messages (SNMP), 243-244 Proxy ARP, 232-233 +pseudonodes, 485 IS-IS, 594-598 +PVST+ (Per VLAN Spanning Tree Plus), 119-124 + +Q + +Q Cnt, 379 +QoS (Quality of Service), evaluating with Cisco IOS IP SLA, 249-250 +Quagga, 356 +Query packets (EIGRP), 374 +handling by stub routers, 424 +route-map command 735 + + +R + +RARP (Reverse ARP), 233-234 comparing with BOOTP and DHCP, 236 +RBID (Root Bridge ID), 109 +RD (Reported Distance), 386-387 records (NetFlow), 251 redistribute command, 645 +redistribute static command, 667-668 reliability metric component, 362 reliable multicast, 374 +Remaining Lifetime value (LSPs), 581 Reply packets (EIGRP), 374 requesting LSAs, 468-469 +resolving +Layer 2 issues, 175-176 Layer 3 issues, 695 +restrictions of SPAN, 24-25 revision numbers, VTP, 86-87 RFC 1195, 571 +RFC 6860, 528 +RIB (Routing Information Base), 274, 368 +RID (Router ID), 417-420 displaying, 419-420 OSPF, 460-461 +value selection, 419 +RIPng (RIP next generation), 339-341 authentication, 340 +configuring, 340-341 messages, 339 +RIPv1 (Routing Information Protocol version 1), 357 +RIPv2 (Routing Information Protocol version 2), 318-320 +authentication, configuring, 337 + + +autosummarization, 335-337 configuring, 334-339 convergence, 334 +steady-state operation, 327-328 +timers for stalled routing update reception, 331-333 +distribute lists, 338-339 features, 318 +Flushed after timer, 326 Holddown timer, 324-325 Invalid timer, 324-325 loop prevention, 320-326 messages, 319-320 metrics, 320 +next-hop feature, 338 offset lists, 338 prefix lists, 338-339 Route Poisoning, 323 +Split Horizon, 322, 338 triggered updates, 323, 328-331 +RITE (Router IP Traffic Export), 252-253 +RMON (Remote Monitoring), 244, 254-255 +alarms, 255 configuring, 255 events, 254 +roles of RSTP ports, 129 Root Guard, 149 +root switch, election process, 110-111 route filtering +EIGRP, 443-444 OSPF, 510-513 +Type 3 LSA filtering, 513-515 +route-map command, 638-640 +736 route maps + + +route maps, 650-653 +configuring with route-map command, 638-640 +logic, 638-640 +match commands, 640-641 set commands, 641 +Route Poisoning, 323 +route redistribution, 645-663 EIGRP into OSPF, 650 influencing with metrics, 661-663 metrics, setting, 649 +mutual redistribution at multiple rout-ers, 654-656 +OSPF into EIGRP, 650 prefix lists, 641-643 redistribute command, 645 +route maps, 638-640, 650-653 set commands, 641 +suboptimal routes, 655-656 +preventing by setting administra-tive distance, 656-659 +preventing using route tags, 659-661 +using default settings, 646-649 +route summarization, 201-205, 427-431, 663-665 +automatic route summarization, 428 component routes, 663 +configuring, 430-431 default routing, 671-672 discard routes, 429 EIGRP, 664-665 +exclusive summary routes, finding, 204-205 +manual route summarization, 428 OSPF, 665 +route tags, 356 +suboptimal routes, preventing, 659-661 + +routed ports, 287-291 +router adjacencies (EIGRP), 376-379 Hold time, 377 +Pending state, 378 Q Cnt, 379 +Up state, 378 +router isis command, 616 +router process command, 425-426 routers +configuring trunking on, 77-79 implementing TFTP on, 256-257 +routing loops (EIGRP), Feasibility Condition, 359 +routing protocols, migration strategy, 299-308 +activating new IGP, 300-301 deactivating current IGPs, 301-303 +distance-vector routing protocols, 303-308 +verifying working database contents, 301 +“routing through a failure,” 531 RP (Root Port) +selecting, 109, 111-113 RPC (Root Path Cost), 108 +RPID (Receiver Port ID), 109 +RPVST+ (Rapid Per-VLAN Spanning Tree Plus), 137 +Bridge Assurance, 154 RSPAN (Remote SPAN), 22-25 +configuring, 26-27 restrictions, 24-25 traffic supported, 25 +RSTP (Rapid STP), 107, 128-137 BPDUs, 132-133 +Discarding state, 129 links, 131 +PortFast, 148-149 +SLSM (static length subnet masking) 737 + + +ports, 128-131 +Alternate Ports, 130 +Non-Edge Designated ports, 135 roles, 129 +types, 131 +proposal/agreement process, 133-136 RPVST+, 137 +topology change handling, 136-137 RTO (retransmission timeout), 376 +RTP (Reliable Transport Protocol), 358, 374-376 +Conditional Receive, 375 +RTR (Response Time Reporter). See Cisco IOS IP SLA + +S + +SAA (Service Assurance Agent). See Cisco IOS IP SLA +SBID (Sender Bridge ID), 108 SCP (Secure Copy Protocol), 257 +SDM (Switch Database Management) templates, 299 +secondary servers, 88 secondary VLANs, 61-63 security +authentication +EIGRP, 356, 432-435 IS-IS, 608-610 OSPF, 517-520 OSPFv3, 546-547 PfR, 674-675 +IDSs, RITE implementation, 252-253 +as motivating factor in VLAN design, 60 +SNMP, 245 +VTP passwords, 87 selecting RPs, 109 +sending exception dumps with FTP, 256 +Sequence field, EIGRP packets, 369 + +sequence numbers, 374 LSAs, 468 +LSPs, 580-581 Sequence TLV, 375 +Set command (SNMP), 244 set commands +for PBR, 296-299 for route maps, 641 +setting +administrative distance to prevent sub-optimal routes, 656-659 +metrics for route redistribution, 649 +SHA-HMAC (Secure Hash Algorithm Hash Message Authentication Code), OSPF configuration, 517-520 +show clns command, 620-622 +show interfaces command, 167-169, 688-690 +show ip interface command, 688-690 show ip ospf database command, 488 show ip protocols command, 426-427 +troubleshooting Layer 3 issues, 686-687 show ip route isis command, 617 +show ip route ospf command, 516-517 +show ip sla monitor statistics command, 250 +show isis database command, 601-603 show isis hostname command, 581-583 show rmon alarm command, 255 +show rmon event command, 255 +show running-config command, 240-241 show sdm prefer command, 299 +SIA (Stuck-In-Active) states, 402-410 SIA-Query packets (EIGRP), 374 +SIA-Reply packets (EIGRP), 374 +slave/master relationship, DD packet exchange, 466-468 +SLSM (static length subnet masking), 197, 200 +738 SNAP (Sub-Network Access Protocol) + + +SNAP (Sub-Network Access Protocol), 14 +SNMP (Simple Network Management Protocol), 241-245 +agents, 244 communities, 242 configuring, 245 managers, 244 MIBs, 242, 244 +protocol messages, 243-244 RMON, 244 +security, 245 Traps, 244 versions, 242 +SNPA (Sub Network Point of Attachment), 576 +Source Service Access Point field (Ethernet), 15 +SPAN (Switch Port Analyzer), 22-25 configuring +basic configuration, 26 complex configuration, 26 +restrictions, 24-25 traffic supported, 25 +speed (Ethernet), 9 +speed interface subcommand, 9 +SPF Throttling, tuning OSPF perfor-mance with, 524-525 +SPI (Security Parameter Index), 546 SPID (Sender Port ID), 109 +Split Horizon, 322, 338, 436-437 +Split Horizon with Poisoned Reverse, 321 +spoke routers, stub routing, 423-427 +SPs (service providers), Private VLANs, 60 +SRTT (smooth round-trip time), 376 +SSH (Secure Shell), 257-258 + +standby switches (VSS), 30 +Start of Frame Delimiter field (Ethernet), 15 +Stateless Address Autoconfiguration, 217 +stateless DHCPv6, 218 Static NAT, 209-210 static routing, 316 +steady-state convergence, RIPv2, 327-328 +steady-state operation (OSPF), 480 storing VTP configuration, 94-95 STP (Spanning Tree Protocol) +Blocking state, 107 +transitioning to Forwarding state, 119 +BPDU Filter, 150-151 BPDU Guard, 149-150 BPDUs, 107-109 +RBID, 109 +CAM, updating, 117-119 configuring, 124-128 +converging to new topology, 115-117 costs, 113 +CST, 120-124 +DP, selecting, 113-115 interface states, 119 Loop Guard, 259 MST, 137-148 +CIST, 140-141 configuring, 144-148 external costs, 140 +interoperability with other STP versions, 141-144 +principles of operation, 138-141 PortFast, 148-149 +PVST+, 119-124 +root ports, selecting, 109 +tftp-server command 739 + + +root switch, election process, 110-111 RP, selecting, 111-113 +RSTP, 128-137 BPDUs, 132-133 +Discarding state, 129 links, 131 +ports, 128-131 +Proposal/Agreement process, 133-136 +RPVST+, 137 +topology change handling, 136-137 +System ID Extension, 111 TCN, 117-119 troubleshooting, 170 UDLD, 152-154 unidirectional links, 151-154 +straight-through cabling, 8 stub routing, 423-427 +configuring, 529-530 Query handling, 424 +stubby areas, 496-501 configuring, 498-501 +subnet number, discovering, 194-196 subnetting, 188-205 +all subnets of a network, finding binary shortcut, 196-198 decimal shortcut, 198-200 +bitwise Boolean ANDs, 193 broadcast address, finding, 195-196 broadcast subnets, 192 +classful addressing, 189-191 classless addressing, 191 math used in, 192 +subnet number, finding, 194-196 +valid range of IP addresses, finding, 194-196 +VLSM, 200-201 +zero subnets, 192 + +suboptimal routes, preventing +setting administrative distance, 656-659 using route tags, 659-661 +summarization (EIGRP), 427-431 automatic route summarization, 428 configuring, 430-431 +discard routes, 429 +manual route summarization, 428 superior BPDUs, 108 +SVI (switched virtual interfaces), 286-287 +switch convert mode virtual command, 33-34 +switches +IOS-XE, 38-40 +MAC address learning process, 19-22 SPAN, 22-25 +VLANs, 51 +Private VLANs, 60-68 VSS, 28-38 +switching loops (EtherChannel), 159 +synchronization of IS-IS routers, 593-594 +Syslog, 245-246 +System ID Extension, 111 System IDs (IS-IS), creating, 613 + +T + +tagging rules for Private VLANs, 64 +TCN (Topology Change Notification), 117-119 +TCP (Transport Control Protocol), 187-188 +Telnet access, implementing, 258 +TFTP (Trivial File Transfer Protocol) servers, implementing on routers, 256-257 +tftp-server command, 257 +740 three-way handshakes (IS-IS) + + +three-way handshakes (IS-IS), 589-592 throughput metric, 366 +timers +Flushed after timer, 326 Holddown timer, 324-325 IGRP, 357-358 +Invalid timer, 324-325 +TLVs (Type-Length-Values), 369-371 Adjacency State TLV, 589-591 +Next Multicast Sequence TLV, 375 Sequence TLV, 375 +topologies +changes in, RSTP handling of, 136-137 STP convergence, 115-117 +Topology Change BPDUs, 108-109 topology table, 384-385 +Active state, 381 CD, 386-387 contents of, 382-384 +diffusing computation, 392-396 DUAL +FSM, 397-402 +SIA states, 402-410 FD, 387-391 +Feasible Successors, unequal-cost load balancing, 420-421 +local computation, 392 Passive state, 381 +RD, 386-387 +show commands, 385-387 topology changes, 391-396 +transfers (FTP), initiating, 256 +transition technologies for IPv6, 218-220 +translation, IPv6, 220 Traps (SNMP), 244 +triggered updates, 323, 328-331 + +troubleshooting EtherChannel, 174-175 Layer 2 issues, 161-169 +with CDP, 163-165 with LLDP, 165-167 +with show interfaces command, 167-169 +Layer 3 issues, 683-695 debug commands, 694 +extended ping command, 691-692 +extended traceroute command, 693-694 +show commands, 690-691 +show interfaces command, 688-690 +show ip interface command, 688-690 +show ip protocols command, 686-687 +STP, 170 trunking, 171-172 VTP, 172-173 +trunking 802.1Q, 69-70 +configuring, 71-75 802.1Q-in-Q tunneling, 79-83 active VLANs, 76 +allowed VLANs, 76 configuring +options, 76-77 on routers, 77-79 +ISL, 69-70 configuring, 71-75 +Private VLANs, 65-67 +Isolated PVLAN Trunks, 66-67 Promiscuous PVLAN Trunks, 66 +troubleshooting, 171-172 VTP, 83-95 +configuring, 89-95 +conflicts, 88 +VLANs 741 + + +messages, 85-86 revision numbers, 86-87 +storing the configuration, 94-95 update process, 86-87 +versions of, 83-84 +TTL Security Check, 522-523 tuning performance of OSPF +with LSA Throttling, 526-527 with SPF Throttling, 524-525 +tunnel load-sharing algorithm, 285 tunneling +802.1Q-in-Q tunneling, 79-83 IPv6, 219-220 +Txload, 363 +Type field (Ethernet), 15, 18 types of LSAs, 482-496 + +U + +UDLD (Unidirectional Link Detection), 152-154 +UDP (User Datagram Protocol), 188 U/L (Universal/Local) bit, 17-18 unequal-cost load balancing, 420-421 unicast addresses, 216 +unicast MAC addresses, 15 unidirectional links, 151-154 Universal ID, 284 +universal load-sharing algorithm, 285 unreachable routes, 362 +Up state (EIGRP), 378 Update packets (EIGRP), 373 +Update packets (IGRP), 357-358 update process, VTP, 86-89 updates, EIGRP, 356 +updating CAMs, 117-119 + +V + +valid range of IP addresses, finding, 194-196 +value selection (RID), 419 vectors, 322 +verifying +Cisco IOS IP SLA performance, 250 NetFlow configuration, 252 OSPFv3 configuration, 541-545 VSS, 35-38 +Version field, EIGRP packets, 369 versions +of SNMP, 242 of VTP, 83-84 +virtual links OSPF +authentication, configuring, 520 configuring, 515-517 +OSPFv3, 534 +Virtual Router ID field, EIGRP packets, 369 +VLAN database configuration mode VLANs +creating, 52-55 +interfaces, configuring, 55-56 VLANs, 51 +configuring, 51-52 +in configuration mode, 56-57 interfaces, configuring, 55-56 internal usage VLANs, 288-290 operational state, modifying, 57-69 Private VLANs, 60-68 +configuring, 67-68 +Isolated PVLAN Trunks, 66-67 Promiscuous PVLAN Trunks, 66 secondary VLANs, 61-63 tagging rules, 64 +trunking, 65-67 +742 VLANs + + +trunking +802.1Q, 69-75 +802.1Q-in-Q tunneling, 79-83 active VLANs, 76 +allowed VLANs, 76 configuring, 76-79 ISL, 69-75 +troubleshooting, 171-172 VTP +configuring, 89-95 troubleshooting, 172-173 +VLSM (variable-length subnet masking), 200-201 +VPNs, OTP, 437-442 +VRRP (Virtual Router Redundancy Protocol), 239 +VSL (Virtual Switch Link), 30 +VSS (Virtual Switch System), 28-38 active switches, 30 +configuring, 31-34 MEC, 31 +standby switches, 30 verifying, 35-38 VSL, 30 +VTP (VLAN Trunking Protocol), 83-95 +configuring, 89-95 +extended-range VLANs, 94 +global configuration options, 90-91 +normal-range VLANs, 94 + +conflicts, 88 passwords, 87 +revision numbers, 86-87 +storing the configuration, 94-95 troubleshooting, 172-173 versions of, 83-84 +VTPv1 +messages, 85-86 update process, 86-87 +VTPv2 +messages, 85-86 update process, 86-87 +VTPv3, update process, 87-89 + +W + +WANs, DRs, 472-474 +WCCP (Web Cache Communication Protocol), 246-249 +weaknesses of IGRP, 358 +websites, Cisco Learning Network, 703 Wide Metrics, 360-361, 364-368 +latency, 366 +support for, confirming, 365-366 throughput, 366 +wiring, Category 5, 8-9 + +X-Y-Z + +zero subnets, 192 + + + + +Check out the NEW learning materials for v5.0 exam release! + + + + + + + + + +Increase learning, comprehension, and certification readiness with these Cisco Press products! + + +Cisco CCIE Routing and Switching v5.0 +Configuration Practice Labs +9780133786316 + +Cisco CCIE Routing and Switching v5.0 Troubleshooting Practice Labs +9780133786330 + +Cisco CCIE Routing and Switching v5.0 Configuration and Troubleshooting Practice Labs Bundle +9780133786323 + +Cisco CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 +9781587143960 + +New Resource +Cisco CCIE +Routing and Switching v5.0 Official Cert Guide, Volume 1 Premium Edition eBook/Practice Test +9780133481648 + +Cisco CCIE Routing +and Switching v5.0 Official Cert Guide, Volume 2 +9781587144912 + +New Resource +Cisco CCIE Routing and Switching v5.0 Official Cert Guide, Volume 2 Premium Edition eBook/Practice Test +9780133591057 + +Cisco CCIE Routing and Switching v5.0 Official Cert Guide Library +9781587144929 + +New Resource +CCIE Routing and Switching v5.0 Exam Roundup LiveLessons (Networking Talks) +9780789754035 + + + +SAVE ON ALL NEW CCIE R&S v5.0 Products +www.CiscoPress.com/CCIE + + + +FREE +Online Edition + + + + + + + +Your purchase of CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 includes access to a free online edition for 45 days through the Safari Books Online subscription service. Nearly every Cisco Press book is available online through Safari Books Online, along with thousands of books and videos from publishers such as Addison-Wesley Professional, Exam Cram, IBM Press, O’Reilly Media, Prentice Hall, Que, Sams, and VMware Press. + +Safari Books Online is a digital library providing searchable, on-demand access to thousands of technology, digital media, and professional development books and videos from leading publishers. With one monthly or yearly subscription price, you get unlimited access to learning +tools and information on topics including mobile app and software development, tips and tricks on using your favorite gadgets, networking, project management, graphic design, and much more. + + + +Activate your FREE Online Edition at informit.com/safarifree +STEP 1: Enter the coupon code: TZNSSZG. + +STEP 2: New Safari users, complete the brief registration form. Safari subscribers, just log in. + +If you have diffi culty registering on Safari or accessing the online edition, please e-mail customer-service@safaribooksonline.com + + + + + + + + + + +This page intentionally left blank +APPENDIX C + + + + + + +Decimal to Binary Conversion Table + + +This appendix provides a handy reference for converting between decimal and binary formats for the decimal numbers 0 through 255. Feel free to refer to this table when prac-ticing the subnetting problems in Appendix D, “IP Addressing Practice,” which is on the CD. + +Although this appendix is useful as a reference tool, note that if you plan to convert val-ues between decimal and binary when doing subnetting-related exam questions, instead of using the shortcut processes that mostly avoid binary math, you will likely want to practice converting between the two formats before the exam. For practice, just pick any decimal value between 0 and 255, convert it to 8-bit binary, and then use this table to find out whether you have the right answer. Also, pick any 8-bit binary number, convert it to decimal, and again use this table to check your work. +4 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Dec Bin Value Value +0 00000000 + +1 00000001 + +2 00000010 + +3 00000011 + +4 00000100 + +5 00000101 + +6 00000110 + +7 00000111 + +8 00001000 + +9 00001001 + +10 00001010 + +11 00001011 + +12 00001100 + +13 00001101 + +14 00001110 + +15 00001111 + +16 00010000 + +17 00010001 + +18 00010010 + +19 00010011 + +20 00010100 + +21 00010101 + +22 00010110 + +23 00010111 + +24 00011000 + +25 00011001 + +26 00011010 + +27 00011011 + +28 00011100 + +29 00011101 + +30 00011110 + +31 00011111 + +Dec Bin Value Value +32 00100000 + +33 00100001 + +34 00100010 + +35 00100011 + +36 00100100 + +37 00100101 + +38 00100110 + +39 00100111 + +40 00101000 + +41 00101001 + +42 00101010 + +43 00101011 + +44 00101100 + +45 00101101 + +46 00101110 + +47 00101111 + +48 00110000 + +49 00110001 + +50 00110010 + +51 00110011 + +52 00110100 + +53 00110101 + +54 00110110 + +55 00110111 + +56 00111000 + +57 00111001 + +58 00111010 + +59 00111011 + +60 00111100 + +61 00111101 + +62 00111110 + +63 00111111 + +Dec Bin Value Value +64 01000000 + +65 01000001 + +66 01000010 + +67 01000011 + +68 01000100 + +69 01000101 + +70 01000110 + +71 01000111 + +72 01001000 + +73 01001001 + +74 01001010 + +75 01001011 + +76 01001100 + +77 01001101 + +78 01001110 + +79 01001111 + +80 01010000 + +81 01010001 + +82 01010010 + +83 01010011 + +84 01010100 + +85 01010101 + +86 01010110 + +87 01010111 + +88 01011000 + +89 01011001 + +90 01011010 + +91 01011011 + +92 01011100 + +93 01011101 + +94 01011110 + +95 01011111 + +Dec Bin Value Value +96 01100000 + +97 01100001 + +98 01100010 + +99 01100011 + +100 01100100 + +101 01100101 + +102 01100110 + +103 01100111 + +104 01101000 + +105 01101001 + +106 01101010 + +107 01101011 + +108 01101100 + +109 01101101 + +110 01101110 + +111 01101111 + +112 01110000 + +113 01110001 + +114 01110010 + +115 01110011 + +116 01110100 + +117 01110101 + +118 01110110 + +119 01110111 + +120 01111000 + +121 01111001 + +122 01111010 + +123 01111011 + +124 01111100 + +125 01111101 + +126 01111110 + +127 01111111 +Appendix C: Decimal to Binary Conversion Table 5 + + + +Dec Bin Value Value +128 10000000 + +129 10000001 + +130 10000010 + +131 10000011 + +132 10000100 + +133 10000101 + +134 10000110 + +135 10000111 + +136 10001000 + +137 10001001 + +138 10001010 + +139 10001011 + +140 10001100 + +141 10001101 + +142 10001110 + +143 10001111 + +144 10010000 + +145 10010001 + +146 10010010 + +147 10010011 + +148 10010100 + +149 10010101 + +150 10010110 + +151 10010111 + +152 10011000 + +153 10011001 + +154 10011010 + +155 10011011 + +156 10011100 + +157 10011101 + +158 10011110 + +159 10011111 + +Dec Bin Value Value +160 10100000 + +161 10100001 + +162 10100010 + +163 10100011 + +164 10100100 + +165 10100101 + +166 10100110 + +167 10100111 + +168 10101000 + +169 10101001 + +170 10101010 + +171 10101011 + +172 10101100 + +173 10101101 + +174 10101110 + +175 10101111 + +176 10110000 + +177 10110001 + +178 10110010 + +179 10110011 + +180 10110100 + +181 10110101 + +182 10110110 + +183 10110111 + +184 10111000 + +185 10111001 + +186 10111010 + +187 10111011 + +188 10111100 + +189 10111101 + +190 10111110 + +191 10111111 + +Dec Bin Value Value +192 11000000 + +193 11000001 + +194 11000010 + +195 11000011 + +196 11000100 + +197 11000101 + +198 11000110 + +199 11000111 + +200 11001000 + +201 11001001 + +202 11001010 + +203 11001011 + +204 11001100 + +205 11001101 + +206 11001110 + +207 11001111 + +208 11010000 + +209 11010001 + +210 11010010 + +211 11010011 + +212 11010100 + +213 11010101 + +214 11010110 + +215 11010111 + +216 11011000 + +217 11011001 + +218 11011010 + +219 11011011 + +220 11011100 + +221 11011101 + +222 11011110 + +223 11011111 + +Dec Bin Value Value +224 11100000 + +225 11100001 + +226 11100010 + +227 11100011 + +228 11100100 + +229 11100101 + +230 11100110 + +231 11100111 + +232 11101000 + +233 11101001 + +234 11101010 + +235 11101011 + +236 11101100 + +237 11101101 + +238 11101110 + +239 11101111 + +240 11110000 + +241 11110001 + +242 11110010 + +243 11110011 + +244 11110100 + +245 11110101 + +246 11110110 + +247 11110111 + +248 11111000 + +249 11111001 + +250 11111010 + +251 11111011 + +252 11111100 + +253 11111101 + +254 11111110 + +255 11111111 + + + + + + + + + + +This page intentionally left blank +APPENDIX D + + + + + + +IP Addressing Practice + + +Chapter 4, “IP Addressing,” covers many details related to analyzing IP addresses, sub-nets, and summarized IP routes. That chapter suggests some decimal math algorithms that allow you to find the answers to some typical questions without having to perform time-consuming conversions between binary and decimal. + +As promised in Chapter 4, this appendix provides some practice problems that should help you perfect the use of the algorithms in Chapter 4. Note that the goal of this prac-tice is not to make you memorize the algorithms. Instead, the goal is to help you become so familiar with the patterns in the decimal math that you can look at a problem and visu-alize the answer quickly. The intent is to enable you, after you have practiced enough, to simply look at a problem and do the math in your head, ignoring the specific steps in the book. + +This appendix covers the decimal math processes to answer the following four types of questions: +1. Given an IP address and mask/prefix length, list the number of subnets (assuming SLSM), the number of hosts per subnet (assuming SLSM), the subnet number, the broadcast address, and the range of valid IP addresses in that same subnet. +2. Given an IP network and a static mask/prefix length, list the subnet numbers. + +3. Given a set of routes, find the smallest inclusive summary route. + +4. Given a set of routes, find the smallest exclusive summary route(s). + +These topics are covered in order in this appendix. + + +Subnetting Practice + +This appendix lists 25 separate questions, asking you to derive the subnet number, broad-cast address, and range of valid IP addresses. In the solutions, the binary math is shown, as is the process that avoids binary math using the “subnet chart” described in Chapter 4. You might want to review Chapter 4’s section on IP addressing before trying to answer these questions. +4 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +25 Subnetting Questions + +Given each IP address and mask, supply the following information for each of these 25 examples: + +■ Size of the network part of the address + +■ Size of the subnet part of the address + +■ Size of the host part of the address + +■ The number of hosts per subnet + +■ The number of subnets in this network + +■ The subnet number + +■ The broadcast address + +■ The range of valid IP addresses in this network: + +1. 10.180.10.18, mask 255.192.0.0 2. 10.200.10.18, mask 255.224.0.0 3. 10.100.18.18, mask 255.240.0.0 4. 10.100.18.18, mask 255.248.0.0 +5. 10.150.200.200, mask 255.252.0.0 6. 10.150.200.200, mask 255.254.0.0 7. 10.220.100.18, mask 255.255.0.0 +8. 10.220.100.18, mask 255.255.128.0 9. 172.31.100.100, mask 255.255.192.0 +10. 172.31.100.100, mask 255.255.224.0 11. 172.31.200.10, mask 255.255.240.0 12. 172.31.200.10, mask 255.255.248.0 13. 172.31.50.50, mask 255.255.252.0 14. 172.31.50.50, mask 255.255.254.0 15. 172.31.140.14, mask 255.255.255.0 16. 172.31.140.14, mask 255.255.255.128 +17. 192.168.15.150, mask 255.255.255.192 18. 192.168.15.150, mask 255.255.255.224 19. 192.168.100.100, mask 255.255.255.240 20. 192.168.100.100, mask 255.255.255.248 21. 192.168.15.230, mask 255.255.255.252 22. 10.1.1.1, mask 255.248.0.0 +23. 172.16.1.200, mask 255.255.240.0 24. 172.16.0.200, mask 255.255.255.192 25. 10.1.1.1, mask 255.0.0.0 +Appendix D: IP Addressing Practice 5 + +Suggestions on How to Attack the Problem + +If you are ready to go ahead and start answering the questions, go ahead! If you want more explanation of how to attack such questions, refer to the section on IP subnetting in Chapter 4. However, if you have already read Chapter 4, a reminder of the steps in the process to answer these questions, with a little binary math, is repeated here: + + +Note The examples shown here assume classful IP addressing, so the number of subnets per IP network is listed as 2n – 2. If using classless IP addressing, the numbers would sim-ply be 2n. + + +Step 1. Identify the structure of the IP address. + +a. Identify the size of the network part of the address, based on Class A, B, and C rules. + +b. Identify the size of the host part of the address, based on the number of binary 0s in the mask. If the mask is “tricky,” use the chart of typical mask values to convert the mask to binary more quickly. +c. The size of the subnet part in bits is what’s “left over”; mathematically, it is 32 – (network + host). + +d. Declare the number of subnets, which is 2number-of-subnet-bits – 2. + +e. Declare the number of hosts per subnet, which is 2number-of-host-bits – 2. Step 2. Create the subnet chart that will be used in Steps 3 and 4. + +a. Create a generic subnet chart. + +b. Write the decimal IP address and subnet mask in the first two rows of the chart. + +c. If an easy mask is used, draw a vertical line between the 255s and the 0s in the mask, from top to bottom of the chart. If a hard mask is used, draw a box around the interesting octet. +d. Copy the address octets to the left of the line or the box into the final four rows of the chart. +Step 3. Derive the subnet number and the first valid IP address. + +a. On the line on the chart where you are writing the subnet number, write 0s in the octets to the right of the line or the box. +6 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +b. If the mask is difficult, so that there is a box in the chart, use the magic number trick to find the decimal value of the subnet’s interesting octet, and write it down. Remember, the magic number is found by subtracting the interesting (non-0 or 255) mask value from 256. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. +c. To derive the first valid IP address, copy the first three octets of the sub-net number and add 1 to the fourth octet of the subnet number. +Step 4. Derive the broadcast address and the last valid IP address for this subnet. + +a. Write down 255s in the broadcast address octets to the right of the line or the box. + +b. If the mask is difficult, so that there is a box in the chart, use the magic number trick to find the value of the broadcast address’s interesting octet. In this case, you add the subnet number’s interesting octet value to the magic number, and subtract 1. +c. To derive the last valid IP address, copy the first three octets of the broadcast address and subtract 1 from the fourth octet of the broadcast address. + +Question 1: Answer + +The answers begin with the analysis of the three parts of the address, the number of hosts per subnet, and the number of subnets of this network using the stated mask. The binary math for subnet and broadcast address calculation follows. The answer finishes with the easier mental calculations using the subnet chart described in Chapter 4. + +Table D-1 Question 1: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Item +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +10.180.10.18 + +255.192.0.0 + +8 + +22 + +2 + +22 – 2 = 2 + +2 22 – 2 = 4,194,302 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 +Appendix D: IP Addressing Practice 7 + +The binary calculations of the subnet number and broadcast address are shown in Table D-2. To calculate the two numbers, perform a Boolean AND on the address and mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the sub-net number. The host bits are in bold print in the table. + +Table D-2 Question 1: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.180.10.18 + +255.192.0.0 + +10.128.0.0 + +10.191.255.255 + +0000 1010 10 11 0100 0000 1010 0001 0010 + +1111 1111 11 00 0000 0000 0000 0000 0000 + +0000 1010 10 00 0000 0000 0000 0000 0000 + +0000 1010 10 11 1111 1111 1111 1111 1111 + + + +To get the first valid IP address, just add 1 to the subnet number; to get the last valid IP address, just subtract 1 from the broadcast address. In this case: + +10.128.0.1 through 10.191.255.254 10.128.0.0 + 1= 10.128.0.1 10.191.255.255 – 1= 10.191.255.254 +Steps 2, 3, and 4 in the process use a table like Table D-3, which lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Figure D-1 at the end of this problem shows the fields in Table D-3 that are filled in at each step in the process. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-3 Question 1: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + + +Address + +Mask + +Subnet number + +First valid address + +Broadcast + +Last valid address + +Octet 1 Octet 2 10 180 +255 192 + +10 128 + +10 128 + +10 191 + +10 191 + +Octet 3 Octet 4 10 18 +0 0 + +0 0 + +0 1 + +255 255 + +255 254 + +Comments N/A +N/A + +Magic number = 256 – 192 = 64 +Add 1 to last octet of subnet + +128 + 64 – 1 = 191 + +Subtract 1 from last octet + + +Subnet rule: Multiple of magic number closest to, but not more than, IP address value in interesting octet + +Broadcast rule: Subnet + magic – 1 +8 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – the mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 128 is the multiple of 64 that’s closest to 180 but not larger than 180. So, the second octet of the subnet number is 128. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 128 + 64 – 1 = 191. + +Finally, Figure D-1 shows Table D-3 with comments about when each part of the table was filled in, based on the steps in the process at the beginning of the chapter. + +2C: draw box + +2A: create chart +Address + +Mask + +Subnet number + +First address + +Broadcast + +Last address + + +Octet Octet Octet #1 #2 #3 + +10 180 10 + +255 192 0 + +10 128 3B 0 + +10 128 0 + +10 191 4B 255 + +10 191 255 + + +Octet Comments #4 + +18 2B: Write down address + +0 2B: Write down mask + +0 3A Magic number = 256 – 192 = 64 + +1 3C Add 1 to last octet of subnet + +255 4A 128 + 64 – 1 = 191 + +254 4C Subract 1 from last octet + + +2D: copy address + +Figure D-1 Steps 2, 3, and 4 for Question 1 + + +Question 2: Answer + +Table D-4 Question 2: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Example +10.200.10.18 + +255.224.0.0 + +Rules to Remember +N/A + +N/A +Appendix D: IP Addressing Practice 9 + + + +Step +Number of network bits Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example 8 +21 + +3 + +23 – 2 = 6 + +221 – 2 = 2,097,150 + +Rules to Remember +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +Table D-5 presents the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-5 Question 2: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.200.10.18 + +255.224.0.0 + +10.192.0.0 + +10.223.255.255 + +0000 1010 110 0 1000 0000 1010 0001 0010 + +1111 1111 111 0 0000 0000 0000 0000 0000 + +0000 1010 110 0 0000 0000 0000 0000 0000 + +0000 1010 110 1 1111 1111 1111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.192.0.1 through 10.223.255.254 +Table D-6 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 224 = 32 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 192 is the multiple of 32 that’s closest to 200 but not larger than 200. So, the second octet of the subnet number is 192. +10 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-6 Question 2: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + + +Address + +Mask + +Subnet number + +Octet 1 Octet 2 +10 200 + +255 224 + +10 192 + +Octet 3 Octet 4 +10 18 + +0 0 + +0 0 + +Comments +N/A + +N/A + +Magic number = 256 – 224 = 32 + +First valid address 10 192 0 1 Add 1 to last octet of subnet + + +Broadcast 10 + +Last valid address 10 + +223 255 255 + +223 255 254 + +192 + 32 – 1 = 223 + +Subtract 1 from last octet + + +Subnet rule: Multiple of magic number closest to, but not more than, IP address value in interesting octet + +Broadcast rule: Subnet + magic – 1 + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 192 + 32 – 1 = 223. + +Question 3: Answer + +Table D-7 Question 3: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +10.100.18.18 + +255.240.0.0 + +8 + +20 + +4 + +24 – 2 = 14 + +220 – 2 = 1,048,574 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 +Appendix D: IP Addressing Practice 11 + +The binary calculations of the subnet number and broadcast address are shown in Table D-8. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-8 Question 3: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) + +10.100.18.18 + +255.240.0.0 + +10.96.0.0 + +0000 1010 0110 0100 0001 00100001 0010 + +1111 1111 1111 0000 0000 0000 0000 0000 + +0000 1010 0110 0000 0000 0000 0000 0000 + +Change host to 1s 10.111.255.255 0000 1010 0110 1111 1111 1111 1111 1111 (broadcast address) + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.96.0.1 through 10.111.255.254 +Table D-9 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-9 Question 3: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + + +Address + +Mask + +Subnet number + +First valid address + +Broadcast + +Last valid address + +Octet 1 Octet 2 +10 100 + +255 240 + +10 96 + +10 96 + +10 111 + +10 111 + +Octet 3 Octet 4 +18 18 + +0 0 + +0 0 + +0 1 + +255 255 + +255 254 + +Comments +N/A + +N/A + +Magic number = 256 – 240 = 16 +Add 1 to last octet of subnet + +96 + 16 – 1 = 111 + +Subtract 1 from last octet + + +Subnet rule: Multiple of magic number closest to, but not more than, IP address value in interesting octet + +Broadcast rule: Subnet + magic – 1 +12 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 16 that’s closest to 100 but not larger than 100. So, the second octet of the subnet number is 96. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 96 + 16 – 1 = 111. + +Question 4: Answer + +Table D-10 Question 4: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +10.100.18.18 + +255.248.0.0 + +8 + +19 + +5 + +2 5 – 2 = 30 + +219 – 2 = 524,286 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +The binary calculations of the subnet number and broadcast address are shown in Table D-11. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-11 Question 4: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.100.18.18 + +255.248.0.0 + +10.96.0.0 + +10.103.255.255 + +0000 1010 0110 0 100 0001 00100001 0010 + +1111 1111 1111 1 000 0000 0000 0000 0000 + +0000 1010 0110 0 000 0000 0000 0000 0000 + +0000 1010 0110 0 111 1111 1111 1111 1111 +Appendix D: IP Addressing Practice 13 + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.96.0.1 through 10.103.255.254 +Table D-12 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-12 Question 4: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + + +Address + +Mask + +Subnet number + +Octet 1 Octet 2 +10 100 + +255 248 + +10 96 + +Octet 3 Octet 4 +18 18 + +0 0 + +0 0 + +Comments +N/A + +N/A + +Magic number = 256 – 248 = 8 + + +First valid address 10 96 0 1 Add 1 to last octet of subnet + + +Broadcast 10 + +Last valid address 10 + +103 255 255 + +103 255 254 + +96 + 8 – 1 = 103 + +Subtract 1 from last octet + + +Subnet rule: Multiple of magic number closest to, but not more than, IP address value in interesting octet + +Broadcast rule: Subnet + magic – 1 + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 8 that’s closest to 100 but not larger than 100. So, the second octet of the subnet number is 96. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 96 + 8 – 1 = 103. +14 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Question 5: Answer + +Table D-13 Question 5: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits +Number of host bits + +Number of subnet bits +Number of subnets + +Number of hosts + +Example +10.150.200.200 + +255.252.0.0 + +8 + +18 + +6 + +26 – 2 = 62 + +218 – 2 = 262,142 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +The binary calculations of the subnet number and broadcast address are shown in Table D-14. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + + +Table D-14 + +Address + + +Question 5: Binary Calculation of Subnet and Broadcast Addresses + +10.150.200.200 0000 1010 1001 01 10 1100 1000 1100 1000 + + + +Mask + +AND result (subnet number) + +255.252.0.0 + +10.148.0.0 + +1111 1111 1111 11 00 0000 0000 0000 0000 + +0000 1010 0110 01 00 0000 0000 0000 0000 + +Change host to 1s 10.151.255.255 0000 1010 0110 01 11 1111 1111 1111 1111 (broadcast address) + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.148.0.1 through 10.151.255.254 +Table D-15 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. +Appendix D: IP Addressing Practice 15 + +Table D-15 Question 5: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + + +Address + +Mask + +Subnet number + +First valid address +Broadcast + +Last valid address + +Octet 1 Octet 2 +10 150 + +255 252 + +10 148 + +10 148 + +10 151 + +10 151 + +Octet 3 Octet 4 +200 200 + +0 0 + +0 0 + +0 1 + +255 255 + +255 254 + +Comments +N/A + +N/A + +Magic number = 256 – 252 = 4 + +Add 1 to last octet of subnet + +148 + 4 – 1 = 151 + +Subtract 1 from last octet + + +Subnet rule: Multiple of magic number closest to, but not more than, IP address value in interesting octet + +Broadcast rule: Subnet + magic – 1 + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 252 = 4 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 148 is the multiple of 4 that’s closest to 150 but not larger than 150. So, the second octet of the subnet number is 148. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 148 + 4 – 1 = 151. + +Question 6: Answer + +Table D-16 Question 6: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Example +10.150.200.200 + +255.254.0.0 + +Rules to Remember +N/A + +N/A + + +Number of network bits 8 Always defined by Class A, B, C + +Number of host bits 17 Always defined as number of binary 0s in mask +16 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Step +Number of subnet bits Number of subnets +Number of hosts + +Example 7 +27 – 2 = 126 + +217 – 2 = 131,070 + +Rules to Remember +32 – (network size + host size) 2number-of-subnet-bits – 2 +2number-of-host-bits – 2 + + + +The binary calculations of the subnet number and broadcast address are shown in Table D-17. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-17 Question 6: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.150.200.200 + +255.254.0.0 + +10.150.0.0 + +10.151.255.255 + + +0000 1010 1001 011 0 1100 1000 1100 1000 + +1111 1111 1111 111 0 0000 0000 0000 0000 + +0000 1010 0110 011 0 0000 0000 0000 0000 + +0000 1010 0110 011 1 1111 1111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.150.0.1 through 10.151.255.254 +Table D-18 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-18 Question 6: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 10 150 200 200 + +Mask 255 254 0 0 + +Subnet number 10 150 0 0 + +First valid address 10 150 0 1 + +Broadcast 10 151 255 255 + +Last valid address 10 151 255 254 +Appendix D: IP Addressing Practice 17 + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 254 = 2 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 150 is the multiple of 2 that’s closest to 150 but not larger than 150. So, the second octet of the subnet number is 150. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 150 + 2 – 1 = 151. + +Question 7: Answer + +Table D-19 Question 7: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +10.220.100.18 + +255.255.0.0 + +8 + +16 + +8 + +28 – 2 = 254 + +216 – 2 = 65,534 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +The binary calculations of the subnet number and broadcast address are shown in Table D-20. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-20 Question 7: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.220.100.18 + +255.255.0.0 + +10.220.0.0 + +10.220.255.255 + +0000 1010 1101 1100 0110 0100 0001 0010 + +1111 1111 1111 1111 0000 0000 0000 0000 + +0000 1010 1101 1100 0000 0000 0000 0000 + +0000 1010 1101 1100 1111 1111 1111 1111 +18 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.220.0.1 through 10.220.255.254 +Table D-21 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. + +Table D-21 Question 7: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 10 220 100 18 + +Mask 255 255 0 0 + +Subnet number 10 220 0 0 + +First valid address 10 220 0 1 + +Broadcast 10 220 255 255 + +Last valid address 10 220 255 254 + + +This subnetting scheme uses an easy mask because all the octets are a 0 or a 255. No math tricks are needed! + +Question 8: Answer + +Table D-22 Question 8: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +10.220.100.18 + +255.255.128.0 + +8 + +15 + +9 + +29 – 2 = 510 + +215 – 2 = 32,766 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 +Appendix D: IP Addressing Practice 19 + +The binary calculations of the subnet number and broadcast address are shown in Table D-23. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-23 Question 8: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.220.100.18 + +255.255.128.0 + +10.220.0.0 + +10.220.127.255 + +0000 1010 1101 1100 0 110 0100 0001 0010 + +1111 1111 1111 1111 1 000 0000 0000 0000 + +0000 1010 1101 1100 0 000 0000 0000 0000 + +0000 1010 1101 1100 0 111 1111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.220.0.1 through 10.220.127.254 +Table D-24 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-24 Question 8: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 10 220 100 18 + +Mask 255 255 128 0 + +Subnet number 10 220 0 0 + +First valid address 10 220 0 1 + +Broadcast 10 220 127 255 + +Last valid address 10 220 127 254 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 128 = 128 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 0 is the multiple of 128 that’s closest to 100 but not larger than 100. So, the third octet of the subnet number is 0. +20 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 0 + 128 – 1 = 127. + +This example tends to confuse people because a mask with 128 in it gives you subnet numbers that just do not seem to look right. Table D-25 gives you the answers for the first several subnets, just to make sure that you are clear about the subnets when using this mask with a Class A network. + +Table D-25 Question 8: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + + + +Subnet + +First address + +Last address + +Broadcast + +Zero Subnet + +10.0.0.0 + +10.0.0.1 + +10.0.127.254 + +10.0.127.255 + +First Valid Subnet +10.0.128.0 + +10.0.128.1 + +10.0.255.254 + +10.0.255.255 + +Second Valid Subnet +10.1.0.0 + +10.1.0.1 + +10.1.127.254 + +10.1.127.255 + +Third Valid Subnet +10.1.128.0 + +10.1.128.1 + +10.1.255.254 + +10.1.255.255 + + + + +Question 9: Answer + +Table D-26 Question 9: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.31.100.100 + +255.255.192.0 + +16 + +14 + +2 + +22 – 2 = 2 + +214 – 2 = 16,382 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +The binary calculations of the subnet number and broadcast address are shown in Table D-27. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. +Appendix D: IP Addressing Practice 21 + +Table D-27 Question 9: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.100.100 + +255.255.192.0 + +172.31.64.0 + +172.31.127.255 + +1010 1100 0001 1111 01 10 0100 0110 0100 + +1111 1111 1111 1111 11 00 0000 0000 0000 + +1010 1100 0001 1111 01 00 0000 0000 0000 + +1010 1100 0001 1111 01 11 1111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.64.1 through 172.31.127.254 +Table D-28 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-28 Question 9: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 +Address 172 + +Mask 255 + +Subnet number 172 + +First valid address 172 + +Broadcast 172 + +Last valid address 172 + +Octet 2 Octet 3 Octet 4 +31 100 100 + +255 192 0 + +31 64 0 + +31 64 1 + +31 127 255 + +31 127 254 + + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 64 is the multiple of 64 that’s closest to 100 but not larger than 100. So, the third octet of the subnet number is 64. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 64 + 64 – 1 = 127. +22 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Question 10: Answer + +Table D-29 Question 10: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.31.100.100 + +255.255.224.0 + +16 + +13 + +3 + +2 3 – 2 = 6 + +213 – 2 = 8190 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 + + + +The binary calculations of the subnet number and broadcast address are shown in Table D-30. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-30 Question 10: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.100.100 + +255.255.224.0 + +172.31.96.0 + +172.31.127.255 + + +1010 1100 0001 1111 011 0 0100 0110 0100 + +1111 1111 1111 1111 111 0 0000 0000 0000 + +1010 1100 0001 1111 011 0 0000 0000 0000 + +1010 1100 0001 1111 011 1 1111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.96.1 through 172.31.127.254 +Table D-31 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. +Appendix D: IP Addressing Practice 23 + +Table D-31 Question 10: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 Octet 2 +Address 172 31 + +Mask 255 255 + +Subnet number 172 31 + +First valid address 172 31 + +Broadcast 172 31 + +Last valid address 172 31 + +Octet 3 Octet 4 +100 100 + +224 0 + +96 0 + +96 1 + +127 255 + +127 254 + + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 224 = 32 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 32 that’s closest to 100 but not larger than 100. So, the third octet of the subnet number is 96. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 96 + 32 – 1 = 127. + +Question 11: Answer + +Table D-32 Question 11: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.31.200.10 + +255.255.240.0 + +16 + +12 + +4 + +24 – 2 = 14 + +2 12 – 2 = 4094 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 +24 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-33 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-33 Question 11: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.200.10 + +255.255.240.0 + +172.31.192.0 + +172.31.207.255 + +1010 1100 0001 1111 1100 1000 0000 1010 + +1111 1111 1111 1111 1111 0000 0000 0000 + +1010 1100 0001 1111 1100 0000 0000 0000 + +1010 1100 0001 1111 1100 1111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.192.1 through 172.31.207.254 +Table D-34 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-34 Question 11: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 +Address 172 + +Mask 255 + +Subnet number 172 + +First valid address 172 + +Broadcast 172 + +Last valid address 172 + +Octet 2 Octet 3 Octet 4 +31 200 10 + +255 240 0 + +31 192 0 + +31 192 1 + +31 207 255 + +31 207 254 + + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 192 is the multiple of 16 that’s closest to 200 but not larger than 200. So, the third octet of the subnet number is 192. +Appendix D: IP Addressing Practice 25 + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 192 + 16 – 1 = 207. + +Question 12: Answer + +Table D-35 Question 12: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.31.200.10 + +255.255.248.0 + +16 + +11 + +5 + +2 5 – 2 = 30 + +211 – 2 = 2046 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 + + + +Table D-36 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-36 Question 12: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.200.10 + +255.255.248.0 + +172.31.200.0 + +172.31.207.255 + + +1010 1100 0001 1111 1100 1 000 0000 1010 + +1111 1111 1111 1111 1111 1 000 0000 0000 + +1010 1100 0001 1111 1100 1 000 0000 0000 + +1010 1100 0001 1111 1100 1 111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.200.1 through 172.31.207.254 +Table D-37 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value +26 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-37 Question 12: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 172 31 200 10 + +Mask 255 255 248 0 + +Subnet number 172 31 200 0 + +First valid address 172 31 200 1 + +Broadcast 172 31 207 255 + +Last valid address 172 31 207 254 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 200 is the multiple of 8 that’s closest to 200 but not larger than 200. So, the third octet of the subnet number is 200. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 200 + 8 – 1 = 207. + +Question 13: Answer + +Table D-38 Question 13: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.31.50.50 + +255.255.252.0 + +16 + +10 + +6 + +26 – 2 = 62 + +210 – 2 = 1022 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 +Appendix D: IP Addressing Practice 27 + +Table D-39 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-39 Question 13: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.50.50 + +255.255.252.0 + +172.31.48.0 + +172.31.51.255 + +1010 1100 0001 1111 0011 00 10 0011 0010 + +1111 1111 1111 1111 1111 11 00 0000 0000 + +1010 1100 0001 1111 0011 00 00 0000 0000 + +1010 1100 0001 1111 0011 00 11 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.48.1 through 172.31.51.254 +Table D-40 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-40 Question 13: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 172 31 50 50 + +Mask 255 255 252 0 + +Subnet number 172 31 48 0 + +First valid address 172 31 48 1 + +Broadcast 172 31 51 255 + +Last valid address 172 31 51 254 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 252 = 4 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 48 is the multiple of 4 that’s closest to 50 but not larger than 50. So, the third octet of the subnet number is 48. +28 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 48 + 4 – 1 = 51. + +Question 14: Answer + +Table D-41 Question 14: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.31.50.50 + +255.255.254.0 + +16 + +9 + +7 + +27 – 2 = 126 + +29 – 2 = 510 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 + + + +Table D-42 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-42 Question 14: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.50.50 + +255.255.254.0 + +172.31.50.0 + +172.31.51.255 + + +1010 1100 0001 1111 0011 001 0 0011 0010 + +1111 1111 1111 1111 1111 111 0 0000 0000 + +1010 1100 0001 1111 0011 001 0 0000 0000 + +1010 1100 0001 1111 0011 001 1 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.50.1 through 172.31.51.254 +Table D-43 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value +Appendix D: IP Addressing Practice 29 + +from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-43 Question 14: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 172 31 50 50 + +Mask 255 255 254 0 + +Subnet number 172 31 50 0 + +First valid address 172 31 50 1 + +Broadcast 172 31 51 255 + +Last valid address 172 31 51 254 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 254 = 2 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 50 is the multiple of 2 that’s closest to 50 but not larger than 50. So, the third octet of the subnet number is 50. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 50 + 2 – 1 = 51. + +Question 15: Answer + +Table D-44 Question 15: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.31.140.14 + +255.255.255.0 + +16 + +8 + +8 + +28 – 2 = 254 + +28 – 2 = 254 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 +30 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-45 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-45 Question 15: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.140.14 + +255.255.255.0 + +172.31.140.0 + +172.31.140.255 + +1010 1100 0001 1111 1000 1100 0000 1110 + +1111 1111 1111 1111 1111 1111 0000 0000 + +1010 1100 0001 1111 1000 1100 0000 0000 + +1010 1100 0001 1111 1000 1100 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.140.1 through 172.31.140.254 +Table D-46 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. + +Table D-46 Question 15: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 172 31 140 14 + +Mask 255 255 255 0 + +Subnet number 172 31 140 0 + +First valid address 172 31 140 1 + +Broadcast 172 31 140 255 + +Last valid address 172 31 140 254 + + +This subnetting scheme uses an easy mask because all the octets are a 0 or a 255. No math tricks are needed! +Appendix D: IP Addressing Practice 31 + +Question 16: Answer + +Table D-47 Question 16: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Example +172.31.140.14 + +Rules to Remember +N/A + + +Mask 255.255.255.128 N/A + + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +16 + +7 + +9 + +2 9 – 2 = 510 + +27 – 2 = 126 + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 + + + +Table D-48 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-48 Question 16: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.31.140.14 + +255.255.255.128 + +172.31.140.0 + +172.31.140.127 + + +1010 1100 0001 1111 1000 1100 0 000 1110 + +1111 1111 1111 1111 1111 1111 1 000 0000 + +1010 1100 0001 1111 1000 1100 0 000 0000 + +1010 1100 0001 1111 1000 1100 0 111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.31.140.1 through 172.31.140.126 +Table D-49 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. +32 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-49 Question 16: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 Octet 2 +Address 172 31 + +Mask 255 255 + +Subnet number 172 31 + +First valid address 172 31 + +Broadcast 172 31 + +Last valid address 172 31 + +Octet 3 Octet 4 +140 14 + +255 128 + +140 0 + +140 1 + +140 127 + +140 126 + + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 128 = 128 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 0 is the multiple of 128 that’s closest to 14 but not larger than 14. So, the fourth octet of the subnet number is 0. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 0 + 128 – 1 = 127. + +Question 17: Answer + +Table D-50 Question 17: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Example +192.168.15.150 + +Rules to Remember +N/A + + +Mask 255.255.255.192 N/A + + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +24 + +6 + +2 + +22 – 2 = 2 + +26 – 2 = 62 + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 +Appendix D: IP Addressing Practice 33 + +Table D-51 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-51 Question 17: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +192.168.15.150 + +255.255.255.192 + +192.168.15.128 + +192.168.15.191 + +1100 0000 1010 1000 0000 1111 10 01 0110 + +1111 1111 1111 1111 1111 1111 11 00 0000 + +1100 0000 1010 1000 0000 1111 10 00 0000 + +1100 0000 1010 1000 0000 1111 10 11 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.15.129 through 192.168.15.190 +Table D-52 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-52 Question 17: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 +Address 192 + +Mask 255 + +Subnet number 192 + +First valid address 192 + +Broadcast 192 + +Last valid address 192 + +Octet 2 Octet 3 Octet 4 +168 15 150 + +255 255 192 + +168 15 128 + +168 15 129 + +168 15 191 + +168 15 190 + + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 128 is the multiple of 64 that’s closest to 150 but not larger than 150. So, the fourth octet of the subnet number is 128. +34 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 128 + 64 – 1 = 191. + +Question 18: Answer + +Table D-53 Question 18: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Example +192.168.15.150 + +255.255.255.224 + +Rules to Remember +N/A + +N/A + + +Number of network bits 24 Always defined by Class A, B, C + + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +5 + +3 + +23 – 2 = 6 + +25 – 2 = 30 + +Always defined as number of binary 0s in mask + +32 – (network size +host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +Table D-54 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-54 Question 18: Binary Calculation of Subnet and Broadcast Addresses + +Address 192.168.15.150 1100 0000 1010 1000 0000 1111 100 1 0110 + +Mask 255.255.255.224 1111 1111 1111 1111 1111 1111 111 0 0000 + + +AND result (subnet number) +Change host to 1s (broadcast address) + +192.168.15.128 + +192.168.15.159 + + +1100 0000 1010 1000 0000 1111 100 0 0000 + +1100 0000 1010 1000 0000 1111 100 1 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.15.129 through 192.168.15.158 +Table D-55 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value +Appendix D: IP Addressing Practice 35 + +from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-55 Question 18: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 192 168 15 150 + +Mask 255 255 255 224 + +Subnet number 192 168 15 128 + +First valid address 192 168 15 129 + +Broadcast 192 168 15 159 + +Last valid address 192 168 15 158 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 224 = 32 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 128 is the multiple of 32 that’s closest to 150 but not larger than 150. So, the fourth octet of the subnet number is 128. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 128 + 32 – 1 = 159. + +Question 19: Answer + +Table D-56 Question 19: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits +Number of host bits + +Example +192.168.100.100 + +255.255.255.240 + +24 + +4 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + + +Number of subnet bits 4 32 – (network size + host size) +36 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Step +Number of subnets + +Number of hosts + +Example 24 – 2 = 14 +24 – 2 = 14 + +Rules to Remember 2number-of-subnet-bits – 2 +2number-of-host-bits – 2 + + + +Table D-57 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-57 Question 19: Binary Calculation of Subnet and Broadcast Addresses + +Address 192.168.100.100 1100 0000 1010 1000 0110 0100 0110 0100 + +Mask 255.255.255.240 1111 1111 1111 1111 1111 1111 1111 0000 + + +AND result (subnet number) +Change host to 1s (broadcast address) + +192.168.100.96 + +192.168.100.111 + + +1100 0000 1010 1000 0110 0100 0110 0000 + +1100 0000 1010 1000 0110 0100 0110 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.100.97 through 192.168.100.110 +Table D-58 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-58 Question 19: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 +Address 192 + +Mask 255 + +Subnet number 192 + +First valid address 192 + +Broadcast 192 + +Last valid address 192 + +Octet 2 Octet 3 Octet 4 +168 100 100 + +255 255 240 + +168 100 96 + +168 100 97 + +168 100 111 + +168 100 110 +Appendix D: IP Addressing Practice 37 + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 16 that’s closest to 100 but not larger than 100. So, the fourth octet of the subnet number is 96. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 96 + 16 – 1 = 111. + +Question 20: Answer + +Table D-59 Question 20: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +192.168.100.100 + +255.255.255.248 + +24 + +3 + +5 + +25 – 2 = 30 + +23 – 2 = 6 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 + + + +Table D-60 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-60 Question 20: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +192.168.100.100 + +255.255.255.248 + +192.168.100.96 + +192.168.100.103 + +1100 0000 1010 1000 0110 0100 0110 0 100 + +1111 1111 1111 1111 1111 1111 1111 1 000 + +1100 0000 1010 1000 0110 0100 0110 0 000 + +1100 0000 1010 1000 0110 0100 0110 0 111 +38 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.100.97 through 192.168.100.102 +Table D-61 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-61 Question 20: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 192 168 100 100 + +Mask 255 255 255 248 + +Subnet number 192 168 100 96 + +First valid address 192 168 100 97 + +Broadcast 192 168 100 103 + +Last valid address 192 168 100 102 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 96 is the multiple of 8 that’s closest to 100 but not larger than 100. So, the fourth octet of the subnet number is 96. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 96 + 8 – 1 = 103. +Appendix D: IP Addressing Practice 39 + +Question 21: Answer + +Table D-62 Question 21: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Example +192.168.15.230 + +Rules to Remember +N/A + + +Mask 255.255.255.252 N/A + + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +24 + +2 + +6 + +26 – 2 = 62 + +22 – 2 = 2 + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask + +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 + + + +Table D-63 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-63 Question 21: Binary Calculation of Subnet and Broadcast Addresses + +Address 192.168.15.230 1100 0000 1010 1000 0000 1111 1110 01 10 + +Mask 255.255.255.252 1111 1111 1111 1111 1111 1111 1111 11 00 + + +AND result (subnet number) +Change host to 1s (broadcast address) + +192.168.15.228 + +192.168.15.231 + + +1100 0000 1010 1000 0000 1111 1110 01 00 + +1100 0000 1010 1000 0000 1111 1110 01 11 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +192.168.15.229 through 192.168.15.230 +Table D-64 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. +40 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-64 Question 21: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 +Address 192 + +Mask 255 + +Subnet number 192 + +First valid address 192 + +Broadcast 192 + +Last valid address 192 + +Octet 2 Octet 3 Octet 4 +168 15 230 + +255 255 252 + +168 15 228 + +168 15 229 + +168 15 231 + +168 15 230 + + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 252 = 4 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 228 is the multiple of 4 that’s closest to 230 but not larger than 230. So, the fourth octet of the subnet number is 228. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 228 + 4 – 1 = 231. + +Question 22: Answer + +Table D-65 Question 22: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +10.1.1.1 + +255.248.0.0 + +8 + +19 + +5 + +25 – 2 = 30 + +219 – 2 = 524,286 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 +Appendix D: IP Addressing Practice 41 + +Table D-66 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-66 Question 22: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.1.1.1 + +255.248.0.0 + +10.0.0.0 + +10.7.255.255 + +0000 1010 0000 0 001 0000 0001 0000 0001 + +1111 1111 1111 1 000 0000 0000 0000 0000 + +0000 1010 0000 0 000 0000 0000 0000 0000 + +0000 1010 0000 0 111 1111 1111 1111 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.0.0.1 through 10.7.255.254 +Take a closer look at the subnet part of the subnet address, as is shown in bold here: 0000 1010 0000 0000 0000 0000 0000 0000. The subnet part of the address is all binary 0s, making this subnet a zero subnet. + +Table D-67 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-67 Question 22: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 10 1 1 1 + +Mask 255 248 0 0 + +Subnet number 10 0 0 0 + +First valid address 10 0 0 1 + +Broadcast 10 7 255 255 + +Last valid address 10 7 255 254 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The second octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 248 = 8 in this case (256 – +42 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 0 is the multiple of 8 that’s closest to 1 but not larger than 1. So, the second octet of the subnet number is 0. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 0 + +8 – 1 = 7. + + +Question 23: Answer + +Table D-68 Question 23: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.16.1.200 + +255.255.240.0 + +16 + +12 + +4 + +24 – 2 = 14 + +2 12 – 2 = 4094 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2 number-of-host-bits – 2 + + + +Table D-69 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-69 Question 23: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.16.1.200 + +255.255.240.0 + +172.16.0.0 + +172.16.15.255 + + +1010 1100 0001 0000 0000 0001 1100 1000 + +1111 1111 1111 1111 1111 0000 0000 0000 + +1010 1100 0001 0000 0000 0000 0000 0000 + +1010 1100 0001 0000 0000 1111 1111 1111 +Appendix D: IP Addressing Practice 43 + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.16.0.1 through 172.16.15.254 +Take a closer look at the subnet part of the subnet address, as shown in bold here: 1010 1100 0001 0000 0000 0000 0000 0000. The subnet part of the address is all binary 0s, making this subnet a zero subnet. + +Table D-70 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. + +Table D-70 Question 23: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 +Address 172 + +Mask 255 + +Subnet number 172 + +First valid address 172 + +Broadcast 172 + +Last valid address 172 + +Octet 2 Octet 3 Octet 4 +16 1 200 + +255 240 0 + +16 0 0 + +16 0 1 + +16 15 255 + +16 15 254 + + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The third octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 240 = 16 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 0 is the multiple of 16 that’s closest to 1 but not larger than 1. So, the third octet of the subnet number is 0. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 0 + 16 – 1 = 15. +44 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Question 24: Answer + +Table D-71 Question 24: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Number of network bits + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +Example +172.16.0.200 + +255.255.255.192 + +16 + +6 + +10 + +210 – 2 = 1022 + +26 – 2 = 62 + +Rules to Remember +N/A + +N/A + +Always defined by Class A, B, C + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2 number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +Table D-72 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-72 Question 24: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +172.16.0.200 + +255.255.255.192 + +172.16.0.192 + +172.16.0.255 + + +1010 1100 0001 0000 0000 0000 11 00 1000 + +1111 1111 1111 1111 1111 1111 11 00 0000 + +1010 1100 0001 0000 0000 0000 11 00 0000 + +1010 1100 0001 0000 0000 0000 11 11 1111 + + + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +172.16.0.193 through 172.16.0.254 +Table D-73 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. Remember, subtracting the interesting (non-0 or 255) mask value from 256 yields the magic number. The magic number multiple that’s closest to but not larger than the IP address’s interesting octet value is the subnet value in that octet. +Appendix D: IP Addressing Practice 45 + +Table D-73 Question 24: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + +Octet 1 Octet 2 Octet 3 Octet 4 +Address 172 16 0 200 + +Mask 255 255 255 192 + +Subnet number 172 16 0 192 + +First valid address 172 16 0 193 + +Broadcast 172 16 0 255 + +Last valid address 172 16 0 254 + + +This subnetting scheme uses a hard mask because one of the octets is not a 0 or a 255. The fourth octet is “interesting” in this case. The key part of the trick to get the right answers is to calculate the magic number, which is 256 – 192 = 64 in this case (256 – mask’s value in the interesting octet). The subnet number’s value in the interesting octet (inside the box) is the multiple of the magic number that’s not larger than the original IP address’s value in the interesting octet. In this case, 192 is the multiple of 64 that’s closest to 200 but not larger than 200. So, the fourth octet of the subnet number is 192. + +The second tricky part of this process calculates the subnet broadcast address. The full process is described in Chapter 4, but the tricky part is, as usual, in the “interesting” octet. Take the subnet number’s value in the interesting octet, add the magic number, and subtract 1. That’s the broadcast address’s value in the interesting octet. In this case, 192 + 64 – 1 = 255. + +You can easily forget that the subnet part of this address, when using this mask, actu-ally covers all the third octet as well as 2 bits of the fourth octet. For example, the valid subnet numbers in order are listed here, starting with the first valid subnet by avoiding subnet 172.16.0.0—the zero subnet in this case: + +172.16.0.64 172.16.0.128 172.16.0.192 172.16.1.0 172.16.1.64 172.16.1.128 172.16.1.192 172.16.2.0 172.16.2.64 172.16.2.128 172.16.2.192 +46 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +172.16.3.0 172.16.3.64 172.16.3.128 172.16.3.192 +And so on. + + +Question 25: Answer + +Congratulations, you made it through all the extra subnetting practice! Here’s an easy one to complete your review—one with no subnetting at all! + +Table D-74 Question 25: Size of Network, Subnet, Host, Number of Subnets, Number of Hosts + + +Step +Address + +Mask + +Example +10.1.1.1 + +255.0.0.0 + +Rules to Remember +N/A + +N/A + + +Number of network bits 8 Always defined by Class A, B, C + + +Number of host bits + +Number of subnet bits + +Number of subnets + +Number of hosts + +24 + +0 + +0 + +224 – 2 = 16,777,214 + +Always defined as number of binary 0s in mask +32 – (network size + host size) + +2number-of-subnet-bits – 2 + +2number-of-host-bits – 2 + + + +Table D-75 shows the binary calculations of the subnet number and broadcast address. To calculate the subnet number, perform a Boolean AND of the address with the subnet mask. To find the broadcast address for this subnet, change all the host bits to binary 1s in the subnet number. The host bits are in bold print in the table. + +Table D-75 Question 25: Binary Calculation of Subnet and Broadcast Addresses + + +Address + +Mask + +AND result (subnet number) +Change host to 1s (broadcast address) + +10.1.1.1 + +255.0.0.0 + +10.0.0.0 + +10.255.255.255 + + +0000 1010 0000 0001 0000 0001 0000 0001 + +1111 1111 0000 0000 0000 0000 0000 0000 + +0000 1010 0000 0000 0000 0000 0000 0000 + +0000 1010 1111 1111 1111 1111 1111 1111 +Appendix D: IP Addressing Practice 47 + +Just add 1 to the subnet number to get the first valid IP address; just subtract 1 from the broadcast address to get the last valid IP address. In this case: + +10.0.0.1 through 10.255.255.254 +Table D-76 lists the way to get the same answers using the subnet chart and magic math described in Chapter 4. + +Table D-76 Question 25: Subnet, Broadcast, and First and Last Addresses Calculated Using Subnet Chart + + +Octet 1 Octet 2 +Address 10 1 + +Mask 255 0 + +Network number 10 0 + +First valid address 10 0 + +Broadcast 10 255 + +Last valid address 10 255 + +Octet 3 Octet 4 +1 1 + +0 0 + +0 0 + +0 1 + +255 255 + +255 254 + + + + +Discovering All Subnets When Using SLSM: 13 Questions + +This section covers the second class of IP addressing problems mentioned in the intro-duction to this appendix. The question is as follows: + +Assuming SLSM, what are the subnets of this network? + +For practice, answer that question for the following networks and masks: + +1. 10.0.0.0, mask 255.192.0.0 + +2. 10.0.0.0, mask 255.224.0.0 + +3. 10.0.0.0, mask 255.248.0.0 + +4. 10.0.0.0, mask 255.252.0.0 + +5. 10.0.0.0, mask 255.255.128.0 + +6. 10.0.0.0, mask 255.255.192.0 + +7. 172.31.0.0, mask 255.255.224.0 + +8. 172.31.0.0, mask 255.255.240.0 + +9. 172.31.0.0, mask 255.255.252.0 + +10. 172.31.0.0, mask 255.255.255.224 +48 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +11. 192.168.15.0, mask 255.255.255.192 + +12. 192.168.15.0, mask 255.255.255.224 + +13. 192.168.15.0, mask 255.255.255.240 + +These questions are mostly a subset of the same 25 subnetting questions covered in the first section of this appendix. The explanations of the answers will be based on the seven-step algorithm from Chapter 4, repeated here for convenience. Also, keep in mind that this formal algorithm assumes that the subnet field is 8 bits in length or less. +However, some problems in this appendix have a longer subnet field. For those problems, the answer explains how to expand the logic in this baseline algorithm. +Step 1. Write the classful network number. + +Step 2. For the first (lowest numeric) subnet number, copy the entire network num-ber. That is the first subnet number, and is also the zero subnet. + +Step 3. Decide which octet contains the entire subnet field; call this octet the inter-esting octet. (Remember, this algorithm assumes 8 subnet bits or less.) + +Step 4. Calculate the magic number by subtracting the mask’s interesting octet value from 256. + +Step 5. Copy the previous subnet number’s noninteresting octets onto the next line as the next subnet number; only one octet is missing at this point. + +Step 6. Add the magic number to the previous subnet’s interesting octet, and write that as the next subnet number’s interesting octet, completing the next subnet number. +Step 7. Repeat Steps 5 and 6 until the new interesting octet is 256. That subnet is not valid. The previously calculated subnet is the last valid subnet, and also the broadcast subnet. + +Question 1: Answer + +This question begins with the following basic facts: + +Network 10.0.0.0 Mask 255.192.0.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 2nd +Magic number: 256 – 192 = 64 +From there, Table D-77 shows the rest of the steps for the process. +Appendix D: IP Addressing Practice 49 + +Table D-77 Question 1 Answer: Network 10.0.0.0, Mask 255.192.0.0 + + +Step Octet 1 +1) Network number 10 + +2) Zero subnet 10 + +5) Next subnet 10 + +6) Next subnet 10 + +6) Broadcast subnet 10 + +7) Invalid subnet* 10 + +Octet 2 Octet 3 Octet 4 +0 0 0 + +0 0 0 + +64 0 0 + +128 0 0 + +192 0 0 + +256 0 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the broadcast subnet number might not have been obvious until attempting to write the final (invalid) next subnet number, as seen in the last row of the table. You can follow the steps shown in the table, knowing that when the interesting octet’s value is 256, you have gone too far. The broadcast subnet is the subnet that was found one step prior. + +Alternately, you can find the broadcast subnet based on the following fact: The broadcast subnet’s interesting octet is equal to the subnet mask value in that same octet. + +Question 2: Answer + +This question begins with the following basic facts: + +Network 10.0.0.0 Mask 255.224.0.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 2nd +Magic number: 256 – 224 = 32 +From there, Table D-78 shows the rest of the steps for the process. + + +Table D-78 Question 2 Answer: Network 10.0.0.0, Mask 255.224.0.0 + + +Step +1) Network number + +2) Zero subnet + +5) Next subnet + +6) Next subnet + +6) Next subnet + +Octet 1 Octet 2 Octet 3 Octet 4 +10 0 0 0 + +10 0 0 0 + +10 32 0 0 + +10 64 0 0 + +10 96 0 0 +50 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Step +6) Generic representation of next subnet 6) Broadcast subnet +7) Invalid subnet* + +Octet 1 Octet 2 Octet 3 Octet 4 10 X 0 0 +10 224 0 0 + +10 256 0 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the subnet numbers’ interesting octet (second octet in this case) simply incre-ments by the magic number. To reduce the space required by the table, after the pattern is obvious, the table represents the remaining subnet numbers before the broadcast subnet as a generic value, 10.X.0.0. The subnets not specifically listed are 10.128.0.0, 10.160.0.0, and 10.192.0.0. + +Question 3: Answer + +This question begins with the following basic facts: + +Network 10.0.0.0 Mask 255.248.0.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 2nd +Magic number: 256 – 248 = 8 +From there, Table D-79 shows the rest of the steps for the process. + + +Table D-79 Question 3 Answer: Network 10.0.0.0, Mask 255.248.0.0 + + +Step +1) Network number + +2) Zero subnet + +5) Next subnet + +6) Next subnet + +6) Next subnet + +6) Generic representation of next subnet + +6) Broadcast subnet + +7) Invalid subnet* + +Octet 1 Octet 2 Octet 3 Octet 4 +10 0 0 0 + +10 0 0 0 + +10 8 0 0 + +10 16 0 0 + +10 24 0 0 + +10 X 0 0 + +10 248 0 0 + +10 256 0 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. +Appendix D: IP Addressing Practice 51 + +Note that the subnet numbers’ interesting octet (second octet in this case) simply incre-ments by the magic number. To reduce the space required by the table, after the pattern is obvious, the table represents the remaining subnet numbers before the broadcast subnet as a generic value, 10.X.0.0. The subnets not specifically listed simply have a multiple of 8 in the second octet. + +Question 4: Answer + +This question begins with the following basic facts: + +Network 10.0.0.0 Mask 255.252.0.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 2nd +Magic number: 256 – 252 = 4 +From there, Table D-80 shows the rest of the steps for the process. + + +Table D-80 Question 4 Answer: Network 10.0.0.0, Mask 255.252.0.0 + + +Step Octet 1 +1) Network number 10 + +2) Zero subnet 10 + +5) Next subnet 10 + +6) Next subnet 10 + +6) Next subnet 10 + +6) Generic representation of next subnet 10 + +6) Broadcast subnet 10 + +7) Invalid subnet* 10 + +Octet 2 Octet 3 Octet 4 +0 0 0 + +0 0 0 + +4 0 0 + +8 0 0 + +12 0 0 + +X 0 0 + +252 0 0 + +256 0 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the subnet numbers’ interesting octet (second octet in this case) simply incre-ments by the magic number. To reduce the space required by the table, after the pattern is obvious, the table represents the remaining subnet numbers before the broadcast subnet as a generic value, 10.X.0.0. The subnets not specifically listed simply have a multiple of 4 in the second octet. +52 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Question 5: Answer + +This question begins with the following basic facts: + +Network 10.0.0.0 Mask 255.255.128.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 3rd +Magic number: 256 – 128 = 128 +This question actually uses a subnet field that spans all the second octet, and a single bit in the third octet. As a result, the original seven-step process, which assumes a 1-octet-or-less subnet field, cannot be used. However, an expanded process is described along with the answer to this question. + + +Note Many of you might intuitively see the way to find the complete answer to this question, long before you finish reading the revised process listed here. If you think you are getting the idea, you probably are, so do not let the details in the text get in the way. + + +First, Table D-81 shows the beginning of the process, which occurs just like the earlier examples, except that the interesting octet is now the third octet. + +Table D-81 Question 5 Answer, Part 1: Network 10.0.0.0, Mask 255.255.128.0 + + +Step Octet 1 +1) Network number 10 + +2) Zero subnet 10 + +5) Next subnet 10 + +7) Invalid subnet* 10 + +Octet 2 Octet 3 Octet 4 +0 0 0 + +0 0 0 + +0 128 0 + +0 256 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +At this point, the last number is obviously an invalid subnet number due to the 256 in the third octet. Instead of that fact signifying the end of the process, it means that you should do the following: + +Record the next subnet, based on the following changes to the previous valid subnet number: Add 1 to the octet to the left of the interesting octet, and set the interesting octet to 0. +Appendix D: IP Addressing Practice 53 + +In this case, this new step runs as follows: + +■ The previous valid subnet is 10.0.128.0. + +■ Add 1 to the octet to the left of the interesting octet (value 0); the next subnet num-ber’s second octet will then be 1. + +■ The next subnet number’s interesting octet will be 0. + +Each time the next subnet number would have had a 256 in the interesting octet, you instead follow this new step. It is a little like normal decimal addition. For example, when you add 319 and 1, you add 1 and 9, write a 0, and carry the 1 to the next digit to the left. It is much more obvious through examples, though. So, to complete the logic, Table D-82 shows the example, with this new logic implemented. (Note that the new step has been labeled as Step 8.) + +Table D-82 Question 5 Answer, Part 2: Network 10.0.0.0, Mask 255.255.128.0 + + +Step +1) Network number + +2) Zero subnet + +5) Next subnet + +8) Increment in the octet to the left, and use 0 in the interesting octet +5) Next subnet + +8) Increment in the octet to the left, and use 0 in the interesting octet +5) Next subnet + +8) Increment in the octet to the left, and use 0 in the interesting octet +5) Next subnet + +8) Increment in the octet to the left, and use 0 in the interesting octet +5) Next subnet + +5) Generic view + +6) Broadcast subnet + +7) Invalid subnet* + +Octet 1 Octet 2 +10 0 + +10 0 + +10 0 + +10 1 + +10 1 + +10 2 + +10 2 + +10 3 + +10 3 + +10 4 + +10 4 + +10 X + +10 255 + +10 256 + +Octet 3 Octet 4 +0 0 + +0 0 + +128 0 + +0 0 + +128 0 + +0 0 + +128 0 + +0 0 + +128 0 + +0 0 + +128 0 + +0/128 0 + +128 0 + +0 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +The end of the table is found in this example when the octet to the left of the interesting octet reaches 256. The previously listed subnet is the broadcast subnet. +54 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Question 6: Answer + +This question begins with the following basic facts: + +Network 10.0.0.0 Mask 255.255.192.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 3rd +Magic number: 256 – 192 = 64 +Like the previous question, this question actually uses a subnet field larger than 1 octet. As a result, the expanded version of the seven-step process is used. First, Table D-83 shows the beginning of the process, which occurs just like the standard seven-step process. + +Table D-83 Question 6 Answer, Part 1: Network 10.0.0.0, Mask 255.255.192.0 + + +Step Octet 1 Octet 2 +1) Network number 10 0 + +2) Zero subnet 10 0 + +5) Next subnet 10 0 + +5) Next subnet 10 0 + +5) Next subnet 10 0 + +7) Invalid subnet* 10 0 + +Octet 3 Octet 4 +0 0 + +0 0 + +64 0 + +128 0 + +192 0 + +256 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +After finding a 256 in the interesting octet, the extra bit of logic is applied, as follows: + +Record the next subnet, based on the following changes to the previous valid subnet number: Add 1 to the octet to the left of the interesting octet, and set the interesting octet to 0. +Table D-84 shows the actual values. + + +Table D-84 Question 6 Answer, Part 2: Network 10.0.0.0, Mask 255.255.192.0 + + +Step +1) Network number + +2) Zero subnet + +5) Next subnet + +5) Next subnet + +5) Next subnet + +Octet 1 Octet 2 Octet 3 Octet 4 +10 0 0 0 + +10 0 0 0 + +10 0 64 0 + +10 0 128 0 + +10 0 192 0 +Appendix D: IP Addressing Practice 55 + + + +Step +8) Increment in the octet to the left, and use 0 in the interesting octet +5) Next subnet + +5) Next subnet + +5) Next subnet + +8) Increment in the octet to the left, and use 0 in the interesting octet +5) Next subnet + +5) Generic view + +6) Broadcast subnet + +7) Invalid subnet* + +Octet 1 Octet 2 10 1 + +10 1 + +10 1 + +10 1 + +10 2 + +10 2 + +10 X + +10 255 + +10 256 + +Octet 3 Octet 4 0 0 + +64 0 + +128 0 + +192 0 + +0 0 + +64 0 + +0/64/128/192 0 + +192 0 + +0 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +The end of the table is found in this example when the octet to the left of the interesting octet reaches 256. The previously listed subnet is the broadcast subnet. + +Question 7: Answer + +This question begins with the following basic facts: + +Network 172.31.0.0 Mask 255.255.224.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 3rd +Magic number: 256 – 224 = 32 +From there, Table D-85 shows the rest of the steps for the process. + + +Table D-85 Question 7 Answer: Network 172.31.0.0, Mask 255.255.224.0 + + +Step +1) Network number + +2) Zero subnet + +5) Next subnet + +5) Next subnet + +5) Next subnet + +5) Next subnet + +Octet 1 Octet 2 Octet 3 Octet 4 +172 31 0 0 + +172 31 0 0 + +172 31 32 0 + +172 31 64 0 + +172 31 96 0 + +172 31 128 0 +56 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Step +5) Next subnet 5) Next subnet +6) Broadcast subnet + +7) Invalid subnet* + +Octet 1 Octet 2 Octet 3 Octet 4 172 31 160 0 +172 31 192 0 172 31 224 0 +172 31 256 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the subnet numbers’ interesting octet (third octet in this case) simply incre-ments by the magic number. + +Question 8: Answer + +This question begins with the following basic facts: + +Network 172.31.0.0 Mask 255.255.240.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 3rd +Magic number: 256 – 240 = 16 +From there, Table D-86 shows the rest of the steps for the process. + + +Table D-86 Question 8 Answer: Network 172.31.0.0, Mask 255.255.240.0 + +Step Octet 1 Octet 2 Octet 3 Octet 4 +1) Network number 172 31 0 0 + +2) Zero subnet 172 31 0 0 + +5) Next subnet 172 31 16 0 + +5) Next subnet 172 31 32 0 + +5) Next subnet 172 31 48 0 + +5) Next subnet 172 31 64 0 + +5) Next subnet 172 31 X 0 + +6) Broadcast subnet 172 31 240 0 + +7) Invalid subnet* 172 31 256 0 + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the subnet numbers’ interesting octet (third octet in this case) simply increments by the magic number. To reduce the space required by the table, the table represents the remaining subnet numbers before the broadcast subnet as a generic value, 172.31.X.0. The subnets not specifically listed simply have a multiple of 16 in the third octet. +Appendix D: IP Addressing Practice 57 + +Question 9: Answer + +This question begins with the following basic facts: + +Network 172.31.0.0 Mask 255.255.252.0 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 3rd +Magic number: 256 – 252 = 4 +From there, Table D-87 shows the rest of the steps for the process. + + +Table D-87 Question 9 Answer: Network 172.31.0.0, Mask 255.255.252.0 + + +Step Octet 1 +1) Network number 172 + +2) Zero subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +6) Broadcast subnet 172 + +7) Invalid subnet* 172 + +Octet 2 Octet 3 Octet 4 +31 0 0 + +31 0 0 + +31 4 0 + +31 8 0 + +31 12 0 + +31 16 0 + +31 X 0 + +31 252 0 + +31 256 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the subnet numbers’ interesting octet (third octet in this case) simply incre-ments by the magic number. To reduce the space required by the table, the table rep-resents the remaining subnet numbers before the broadcast subnet as a generic value, 172.31.X.0. The subnets not specifically listed simply have a multiple of 4 in the third octet. + +Question 10: Answer + +This question begins with the following basic facts: + +Network 172.31.0.0 Mask 255.255.255.224 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 4th +Magic number: 256 – 224 = 32 +58 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +This question uses a subnet field larger than 1 octet, requiring the expanded version of the process as seen in Questions 5 and 6. Table D-88 shows the beginning of the process. + +Table D-88 Question 10 Answer, Part 1: Network 172.31.0.0, Mask 255.255.255.224 + +Step Octet 1 Octet 2 Octet 3 Octet 4 +1) Network number 172 31 0 0 + +2) Zero subnet 172 31 0 0 + +5) Next subnet 172 31 0 32 + +5) Next subnet 172 31 0 64 + +5) Next subnet 172 31 0 96 + +5) Next subnet 172 31 0 128 + +5) Next subnet 172 31 0 160 + +5) Next subnet 172 31 0 192 + +5) Next subnet 172 31 0 224 + +7) Invalid subnet* 172 31 0 256 + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +After finding a 256 in the interesting octet, the extra bit of logic is applied, as follows: + +Record the next subnet, based on the following changes to the previous valid subnet number: Add 1 to the octet to the left of the interesting octet, and set the interesting octet to 0. +Table D-89 shows the actual values. + + +Table D-89 Question 10 Answer, Part 2: Network 172.31.0.0, Mask 255.255.255.224 + + +Step Octet 1 +1) Network number 172 + +2) Zero subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +5) Next subnet 172 + +8) Increment in the octet to the left, and 172 use 0 in the interesting octet +5) Next subnet 172 + +Octet 2 Octet 3 Octet 4 +31 0 0 + +31 0 0 + +31 0 32 + +31 0 64 + +31 0 128 + +31 0 192 + +31 0 224 + +31 1 0 + +31 1 32 +Appendix D: IP Addressing Practice 59 + + + +Step Octet 1 5) Next subnet 172 +5) Next subnet 172 5) Next subnet 172 5) Next subnet 172 5) Next subnet 172 +8) Increment in the octet to the left, and 172 use 0 in the interesting octet +5) Generic view 172 + +6) Broadcast subnet 172 + +7) Invalid subnet* 172 + +Octet 2 Octet 3 Octet 4 31 1 64 +31 1 128 31 1 160 31 1 192 31 1 224 31 2 0 + +31 X Y + +31 255 224 + +31 256 0 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +The end of the table is found in this example when the octet to the left of the interesting octet reaches 256. The previously listed subnet is the broadcast subnet. + +Question 11: Answer + +This question begins with the following basic facts: + +Network 192.168.15.0 Mask 255.255.255.192 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 4th +Magic number: 256 – 192 = 64 +From there, Table D-90 shows the rest of the steps for the process. + + +Table D-90 Question 11 Answer: Network 192.168.15.0, Mask 255.255.255.192 + + +Step Octet 1 +1) Network number 192 + +2) Zero subnet 192 + +5) Next subnet 192 + +5) Next subnet 192 + +6) Broadcast subnet 192 + +7) Invalid subnet* 192 + +Octet 2 Octet 3 Octet 4 +168 15 0 + +168 15 0 + +168 15 64 + +168 15 128 + +168 15 192 + +168 15 256 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. +60 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Note that the subnet numbers’ interesting octet (fourth octet in this case) simply incre-ments by the magic number. + +Question 12: Answer + +This question begins with the following basic facts: + +Network 192.168.15.0 Mask 255.255.255.224 +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 4th +Magic number: 256 – 224 = 32 +From there, Table D-91 shows the rest of the steps for the process. + + +Table D-91 Question 12 Answer: Network 192.168.15.0, Mask 255.255.255.224 + + +Step +1) Network number + +2) Zero subnet + +5) Next subnet + +5) Next subnet + +5) Next subnet + +5) Generic view + +6) Broadcast subnet + +7) Invalid subnet* + +Octet 1 Octet 2 Octet 3 Octet 4 +192 168 15 0 + +192 168 15 0 + +192 168 15 32 + +192 168 15 64 + +192 168 15 96 + +192 168 15 X + +192 168 15 224 + +192 168 15 256 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the subnet numbers’ interesting octet (fourth octet in this case) simply incre-ments by the magic number. To reduce the space required by the table, the table rep-resents the remaining subnet numbers before the broadcast subnet as a generic value, 192.168.15.X. The subnets not specifically listed simply have a multiple of 32 in the fourth octet. + +Question 13: Answer + +This question begins with the following basic facts: + +Network 192.168.15.0 Mask 255.255.255.240 +Appendix D: IP Addressing Practice 61 + +From there, Steps 3 and 4 ask for the following pieces of information: + +Interesting octet: 4th +Magic number: 256 – 240 = 16 +From there, Table D-92 shows the rest of the steps for the process. + + +Table D-92 Question 13 Answer: Network 192.168.15.0, Mask 255.255.255.240 + + +Step +1) Network number + +2) Zero subnet + +5) Next subnet + +5) Next subnet + +5) Next subnet + +5) Generic view + +6) Broadcast subnet + +7) Invalid subnet* + +Octet 1 Octet 2 +192 168 + +192 168 + +192 168 + +192 168 + +192 168 + +192 168 + +192 168 + +192 168 + +Octet 3 Octet 4 +15 0 + +15 0 + +15 16 + +15 32 + +15 48 + +15 X + +15 240 + +15 256 + + +*The invalid subnet row is just a reminder used by this process as to when to stop. + +Note that the subnet numbers’ interesting octet (fourth octet in this case) simply incre-ments by the magic number. To reduce the space required by the table, the table rep-resents the remaining subnet numbers before the broadcast subnet as a generic value, 192.168.15.X. The subnets not specifically listed simply have a multiple of 16 in the fourth octet. + +Discovering the Smallest Inclusive Summary Route: 10 Questions + +The last two major sections of this appendix provide practice questions to find the best inclusive and exclusive summary routes, respectively. For the following ten lists of sub-nets, discover the subnet/mask or prefix/length for the smallest possible inclusive sum-mary route: +1. 10.20.30.0/24, 10.20.40.0/24, 10.20.35.0/24, 10.20.45.0/24 + +2. 10.20.7.0/24, 10.20.4.0/24, 10.20.5.0/24, 10.20.6.0/24 + +3. 10.20.3.0/24, 10.20.4.0/24, 10.20.5.0/24, 10.20.6.0/24, 10.20.7.0/24, 10.20.8.0/24 + +4. 172.16.200.0/23, 172.16.204.0/23, 172.16.208.0/23 + +5. 172.16.200.0/23, 172.16.204.0/23, 172.16.208.0/23, 172.16.202.0/23, 172.16.206.0/23 + +6. 172.16.120.0/22, 172.16.112.0/22, 172.16.124.0/22, 172.16.116.0/22 +62 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +7. 192.168.1.16/29, 192.168.1.32/29, 192.168.1.24/29 + +8. 192.168.1.16/29, 192.168.1.32/29 + +9. 10.1.80.0/25, 10.1.81.0/25, 10.1.81.128/25 + +10. 10.1.80.0/26, 10.1.81.0/26, 10.1.81.128/26 + +The following steps are a repeat of the algorithm found in Chapter 4. Chapter 4 only explained details assuming consecutive subnets and SLSM, but the algorithm works fine with SLSM or VLSM, and with nonconsecutive subnets. However, nonconsecutive sub-nets typically require more passes through the algorithm logic. If VLSM is used, at Step 2, you subtract y from the longest prefix length to start the process, again requiring many more steps through the process. +Step 1. Count the number of subnets; then, find the smallest value of y, such that 2y => that number of subnets. + +Step 2. For the next step, use a the longest prefix length used among the component subnets, minus y. + +Step 3. Pretend that the lowest subnet number in the list of component subnets is +an IP address. Using the new, smaller prefix from Step 2, calculate the subnet number in which this pretend address resides. +Step 4. Repeat Step 3 for the largest numeric component subnet number and the same prefix. If it is the same subnet derived as in Step 3, the resulting subnet is the best summarized route, using the new prefix. +Step 5. If Steps 3 and 4 do not yield the same resulting subnet, repeat Steps 3 and 4, with another new prefix length of 1 less than the last prefix length. + +Question 1: Answer + +This question begins with the following routes that need to be summarized: + +10.20.30.0/24 10.20.35.0/24 10.20.40.0/24 10.20.45.0/24 +The first two steps are as follows: + +1. y = 2, because there are 4 component routes, and 22 => 4 + +2. Start with a prefix length of 24 – 2 = 22 + +From there, Table D-93 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the two steps match. +Appendix D: IP Addressing Practice 63 + +Table D-93 Question 1 Answer: Inclusive Summary of 4 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +22 10.20.30.0/22 yields a subnet of 10.20.28.0/22 +21 10.20.30.0/21 yields a subnet of 10.20.24.0/21 +20 10.20.30.0/20 yields a subnet of 10.20.16.0/20 +19 10.20.30.0/19 yields a subnet of 10.20.0.0/19 +18 10.20.30.0/18 yields a subnet of 10.20.0.0/18 + +Step 4 (Highest Component Subnet) + +10.20.45.0/22 yields a subnet of 10.20.44.0/22 +10.20.45.0/21 yields a subnet of 10.20.40.0/21 +10.20.45.0/20 yields a subnet of 10.20.32.0/20 +10.20.45.0/19 yields a subnet of 10.20.32.0/19 +10.20.45.0/18 yields a subnet of 10.20.0.0/18 + + + +This question requires that you iterate through several progressively shorter prefix lengths until you find the correct answer. Finally, the process shows that 10.20.0.0/18 would be the smallest inclusive summary. For questions in which the component subnets are not consecutive, as was the case in this question, you might try to guess a better starting point for the prefix length (a few bits shorter) rather than starting with Steps 1 and 2 of the stated process. Regardless, the process will give you the right answer. + +Question 2: Answer + +This question begins with the following routes that need to be summarized: + +10.20.4.0/24 10.20.5.0/24 10.20.6.0/24 10.20.7.0/24 +The first two steps are as follows: + +1. y = 2, because there are 4 component routes, and 22 => 4 + +2. Start with a prefix length of 24 – 2 = 22 + +From there, Table D-94 shows the iterations through Steps 3 and 4. Remember, you do the math using the original smallest and largest component subnets as if they were IP addresses, using progressively shorter prefix lengths, until the results are the same. If the results are the same, you have found the smallest inclusive summary. +64 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-94 Question 2 Answer: Inclusive Summary of 4 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +22 10.20.4.0/22 yields a subnet of 10.20.4.0/22 + +Step 4 (Highest Component Subnet) + +10.20.7.0/22 yields a subnet of 10.20.4.0/22 + + + + +Question 3: Answer + +This question begins with the following routes that need to be summarized: + +10.20.3.0/24 10.20.4.0/24 10.20.5.0/24 10.20.6.0/24 10.20.7.0/24 10.20.8.0/24 +The first two steps are as follows: + +1. y = 3, because there are 6 component routes, and 23 => 6 + +2. Start with a prefix length of 24 – 3 = 21 + +From there, Table D-95 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. + +Table D-95 Question 3 Answer: Inclusive Summary of 6 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +21 10.20.3.0/21 yields a subnet of 10.20.0.0/21 +20 10.20.3.0/20 yields a subnet of 10.20.0.0/20 + +Step 4 (Highest Component Subnet) + +10.20.8.0/21 yields a subnet of 10.20.8.0/21 +10.20.8.0/20 yields a subnet of 10.20.0.0/20 + + + +After two passes through Steps 3 and 4, the results are equal, implying that 10.20.0.0/20 is the smallest inclusive summary. +Appendix D: IP Addressing Practice 65 + +Question 4: Answer + +This question begins with the following routes that need to be summarized: + +172.16.200.0/23 172.16.204.0/23 172.16.208.0/23 +Note that the subnets are not consecutive in this case, but the algorithm still works. The first two steps are as follows: +1. y = 2, because there are 3 component routes, and 22 => 3 + +2. Start with a prefix length of 23 – 2 = 21 + +From there, Table D-96 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. + +Table D-96 Question 4 Answer: Inclusive Summary of 3 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +21 172.16.200.0/21 yields a subnet of 172.16.200.0/21 +20 172.16.200.0/20 yields a subnet of 172.16.192.0/20 +19 172.16.200.0/19 yields a subnet of 172.16.192.0/19 + +Step 4 (Highest Component Subnet) + +172.16.208.0/21 yields a subnet of 172.16.208.0/21 +172.16.208.0/20 yields a subnet of 172.16.208.0/20 +172.16.208.0/19 yields a subnet of 172.16.192.0/19 + + + +After three passes through Steps 3 and 4, the results are equal, implying that 172.16.192.0/19 is the smallest inclusive summary. + +Question 5: Answer + +This question begins with the following routes that need to be summarized: + +172.16.200.0/23 172.16.202.0/23 172.16.204.0/23 172.16.206.0/23 172.16.208.0/23 +The first two steps are as follows: + +1. y = 3, because there are 5 component routes, and 23 => 5 + +2. Start with a prefix length of 23 – 3 = 20 +66 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +From there, Table D-97 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. + +Table D-97 Question 5 Answer: Inclusive Summary of 5 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +20 172.16.200.0/20 yields a subnet of 172.16.192.0/20 +19 172.16.200.0/19 yields a subnet of 172.16.192.0/19 + +Step 4 (Highest Component Subnet) + +172.16.208.0/20 yields a subnet of 172.16.208.0/20 +172.16.208.0/19 yields a subnet of 172.16.192.0/19 + + + +After two passes through Steps 3 and 4, the results are equal, implying that 172.16.192.0/19 is the smallest inclusive summary. + +Question 6: Answer + +This question begins with the following routes that need to be summarized: + +172.16.112.0/22 172.16.116.0/22 172.16.120.0/22 172.16.124.0/22 +The first two steps are as follows: + +1. y = 2, because there are 4 component routes, and 22 => 4 + +2. Start with a prefix length of 22 – 2 = 20 + +From there, Table D-98 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. + +Table D-98 Question 6 Answer: Inclusive Summary of 4 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +20 172.16.112.0/20 yields a subnet of 172.16.112.0/20 + +Step 4 (Highest Component Subnet) + +172.16.124.0/20 yields a subnet of 172.16.112.0/20 +Appendix D: IP Addressing Practice 67 + +Question 7: Answer + +This question begins with the following routes that need to be summarized: + +192.168.1.16/29 192.168.1.24/29 192.168.1.32/29 +The first two steps are as follows: + +1. y = 2, because there are 3 component routes, and 22 => 3 + +2. Start with a prefix length of 29 – 2 = 27 + +From there, Table D-99 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. + +Table D-99 Question 7 Answer: Inclusive Summary of 3 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +27 192.168.1.16/27 yields a subnet of 192.168.1.0/27 +26 192.168.1.16/26 yields a subnet of 192.168.1.0/26 + +Step 4 (Highest Component Subnet) + +192.168.1.32/27 yields a subnet of 192.168.1.32/27 +192.168.1.32/26 yields a subnet of 192.168.1.0/26 + + + + +Question 8: Answer + +This question begins with the following routes that need to be summarized: + +192.168.1.16/28 192.168.1.32/28 +The first two steps are as follows: + +1. y = 1, because there are 2 component routes, and 21 => 2 + +2. Start with a prefix length of 28 – 1 = 27 + +From there, Table D-100 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. +68 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-100 Question 8 Answer: Inclusive Summary of 2 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +27 192.168.1.16/27 yields a subnet of 192.168.1.0/27 +26 192.168.1.16/26 yields a subnet of 192.168.1.0/26 + +Step 4 (Highest Component Subnet) + +192.168.1.32/27 yields a subnet of 192.168.1.32/27 +192.168.1.32/26 yields a subnet of 192.168.1.0/26 + + + + +Question 9: Answer + +This question begins with the following routes that need to be summarized: + +10.1.80.0/25 10.1.81.0/25 10.1.81.128/25 +The first two steps are as follows: + +1. y = 2, because there are 3 component routes, and 22 => 3 + +2. Start with a prefix length of 25 – 2 = 23 + +From there, Table D-101 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. + +Table D-101 Question 9 Answer: Inclusive Summary of 3 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +23 10.1.80.0/23 yields a subnet of 10.1.80.0/23 + +Step 4 (Highest Component Subnet) + +10.1.81.128/23 yields a subnet of 10.1.80.0/23 + + + + +Question 10: Answer + +This question begins with the following routes that need to be summarized: + +10.1.80.0/26 10.1.81.0/26 10.1.81.128/26 +The first two steps are as follows: + +1. y = 2, because there are 3 component routes, and 22 => 3 + +2. Start with a prefix length of 26 – 2 = 24 +Appendix D: IP Addressing Practice 69 + +From there, Table D-102 shows the iterations through Steps 3 and 4, using progressively shorter prefix lengths, until the right answer is found. + +Table D-102 Question 10 Answer: Inclusive Summary of 3 Routes + + +Prefix Step 3 (Lowest Component Subnet) Length +24 10.1.80.0/24 yields a subnet of 10.1.80.0/24 +23 10.1.80.0/23 yields a subnet of 10.1.80.0/23 + +Step 4 (Highest Component Subnet) + +10.1.81.128/24 yields a subnet of 10.1.81.0/24 +10.1.81.128/23 yields a subnet of 10.1.80.0/23 + + + + +Discovering the Smallest Exclusive Summary Routes: 5 Questions + +The last section of this appendix provides practice problems and answers for finding exclusive summaries. Per Chapter 4’s conventions, an exclusive summary can include multiple prefixes/subnets, but it can only include address ranges inside the original com-ponent prefixes/subnets. + +For the following five lists of subnets, discover the set of exclusive summary routes: + +1. 10.20.7.0/24, 10.20.4.0/24, 10.20.5.0/24, 10.20.6.0/24 + +2. 10.20.3.0/24, 10.20.4.0/24, 10.20.5.0/24, 10.20.6.0/24, 10.20.7.0/24, 10.20.8.0/24 + +3. 172.16.200.0/23, 172.16.204.0/23, 172.16.208.0/23, 172.16.202.0/23, 172.16.206.0/23 + +4. 172.16.120.0/22, 172.16.112.0/22, 172.16.124.0/22, 172.16.116.0/22 + +5. 192.168.1.16/29, 192.168.1.32/29, 192.168.1.24/29 + +The following steps are a repeat of the decimal algorithm for finding exclusive summaries found in Chapter 4. Remember, the process assumes that all the component subnets have the same mask/prefix length. +Step 1. Find the best inclusive summary route; call it a candidate exclusive sum-mary route. + +Step 2. Determine whether the candidate summary includes any address ranges it should not. To do so, compare the summary’s implied address range with the implied address ranges of the component subnets. +Step 3. If the candidate summary only includes addresses in the ranges implied by the component subnets, the candidate summary is part of the best exclusive summarization of the original component subnets. +70 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Step 4. If instead the candidate summary includes some addresses matching the can-didate summary routes, and some addresses that do not match, split the cur-rent candidate summary in half, into two new candidate summary routes, each with a prefix 1 longer than before. +Step 5. If the candidate summary only includes addresses outside the ranges implied by the component subnets, the candidate summary is not part of the best exclusive summarization, and it should not be split further. +Step 6. Repeat Steps 2–4 for each of the two possible candidate summary routes cre-ated at Step 4. + +Question 1: Answer + +This question begins with the following routes that need to be summarized: + +10.20.4.0/24, range 10.20.4.0–10.20.4.255 10.20.5.0/24, range 10.20.5.0–10.20.5.255 10.20.6.0/24, range 10.20.6.0–10.20.6.255 10.20.7.0/24, range 10.20.7.0–10.20.7.255 +The inclusive summary for these routes is + +10.20.4.0/22 +Table D-103 shows what turns out to be a single pass through the algorithm, because the inclusive summary and exclusive summary are the same for this problem. + +Table D-103 Question 1 Answer: Exclusive Summary of 4 Routes + +Split Candidate Range of Analysis Exclusive Summary Addresses +Inclusive summary 10.20.4.0/22 10.20.4.0–10.20.7.255 Part of exclusive summary + + +Comparing the range of IP addresses in the problem statement with the range of address-es implied by the original inclusive summary, you can see that it is the exact same set of addresses. As a result, 10.20.4.0/22 is part of the exclusive summary—in fact, no other summary routes are required. + +Question 2: Answer + +This question begins with the following routes that need to be summarized: + +10.20.3.0/24, range 10.20.3.0–10.20.3.255 10.20.4.0/24, range 10.20.4.0–10.20.4.255 10.20.5.0/24, range 10.20.5.0–10.20.5.255 +Appendix D: IP Addressing Practice 71 + +10.20.6.0/24, range 10.20.6.0–10.20.6.255 10.20.7.0/24, range 10.20.7.0–10.20.7.255 10.20.8.0/24, range 10.20.8.0–10.20.8.255 +The inclusive summary for these routes is + +10.20.0.0/20 +Table D-104 begins by showing three passes through the algorithm. These three passes do not determine all the exclusive summary routes in the answer; Tables D-105 and D-106 complete the answer. + +Before examining Table D-104, first consider the overall flow of the repeated iterations through the table. Think of the original inclusive summary route as one large group of addresses. If it is not also the exclusive summary, you iterate through the algorithm again, halving the original inclusive summary. If that does not produce an answer, you halve each of the halves for the next iteration through the algorithm. So, you can think of the second splitting of the candidate summaries as breaking them into quarters. Another pass would break the original inclusive summary into eighths, and so on. The table’s first col-umn denotes what each row means based on whether it is for the original inclusive sum-mary, the first split (into halves), the second split (into quarters), and so on. + +Table D-104 Question 2 Answer: Inclusive Summary of 6 Routes, Part 1 + +Split Candidate Range Analysis Exclusive Summary + +Inclusive summary +1st split, lower half + +1st split, higher half + +2nd split, lowest quarter + +2nd split, 2nd quarter + +2nd split, 3rd quarter + +10.20.0.0/20 + +10.20.0.0/21 + + +10.20.8.0/21 + + +10.20.0.0/22 + + +10.20.4.0/22 + + +10.20.8.0/22 + +10.20.0.0–10.20.15.255 + +10.20.0.0–10.20.7.255 + + +10.20.8.0–10.20.15.255 + + +10.20.0.0–10.20.3.255 + + +10.20.4.0–10.20.7.255 + + +10.20.8.0–10.20.11.255 + +Includes too many addresses +Includes 10.20.0.0– 10.20.2.255, which should not be included +Includes 10.20.9.0– 10.20.15.255, which should not be included +Includes 10.20.0.0– 10.20.2.255, which should not be included +Includes only 10.20.4.0– 10.20.7.255; it is part of exclusive summary +Includes 10.20.9.0– 10.20.11.255, which should not be included + + + +2nd split, 10.20.12.0/22 highest +quarter + +10.20.12.0–10.20.15.255 Includes 10.20.12.0– 10.20.15.255, totally outside the range—don’t split again +72 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +The last four rows of the table show the results of the second split (per Step 4 in the algorithm). Two of these four candidate exclusive summaries need to be split again (10.20.0.0/22 and 10.20.8.0/22) because they contain some addresses within the original ranges, but some outside the range. One summary (10.20.4.0/22) holds only addresses inside the original ranges, so that route is one of the routes comprising the exclusive summary. Finally, one candidate route (10.20.12.0/22) contains only addresses outside the original range; as a result, you can stop splitting that range when looking for the exclusive summaries. + +Tables D-105 and D-106 complete the official algorithm, but through some basic inspec-tion, you might be able to (rightfully) guess that no additional summary routes will be found. Consider the original routes, and whether the process has found a summary route to include the addresses yet: + +10.20.3.0/24—still looking for summary 10.20.4.0/24—found summary 10.20.5.0/24—found summary 10.20.6.0/24—found summary 10.20.7.0/24—found summary 10.20.8.0/24—still looking for summary +Thinking about the problem from this point forward, the remaining component sub-nets—10.20.3.0/24 and 10.20.8.0/24—are separated by the previously discovered +10.20.4.0/22 summary. There is only one original route on each side of that summary. So, there is no possibility of summarizing those two individual routes. + +The algorithm will reach that same conclusion, as shown in the next two tables. The third split is in Table D-105 (Table D-104 showed up through the second split), and the fourth split is in Table D-106. Keep in mind that, per Table D-104, only two prefixes need split-ting for the next step in the process—10.20.0.0/22 and 10.20.8.0/22. The “Split” column in the table lists the halves of these two prefixes. + +Table D-105 Question 2 Answer, Third Split + + +Split + + +Lower half of 10.20.0.0/22 +Higher half of 10.20.0.0/22 +Lower half of 10.20.8.0/22 + +Candidate Exclusive Summary +10.20.0.0/23 + +10.20.2.0/23 + +10.20.8.0/23 + +Range + + +10.20.0.0–10.20.1.255 + +10.20.2.0–10.20.3.255 + +10.20.8.0–10.20.9.255 + +Analysis + + +Holds none of the original addresses—don’t split again +Includes too many addresses—split again +Includes too many addresses—split again + + + +Higher half of 10.20.8.0/22 + +10.20.10.0/23 10.20.10.0–10.20.11.255 Holds none of the original addresses—don’t split again +Appendix D: IP Addressing Practice 73 + +(Note: Per Table D-105, only 10.20.2.0/23 and 10.20.8.0/23 need splitting; their halves are noted in the first column.) + +Table D-106 Question 2 Answer: Fourth Split + + +Split + + +Lower half of 10.20.2.0/23 + +Candidate Exclusive Summary +10.20.2.0/24 + +Range + + +10.20.2.0–10.20.2.255 + +Analysis + + +Holds none of the original addresses—don’t split again + +Higher half of 10.20.3.0/24 10.20.3.0–10.20.3.255 Part of exclusive summary 10.20.2.0/23 +Lower half of 10.20.8.0/24 10.20.8.0–10.20.8.255 Part of exclusive summary 10.20.8.0/23 + +Higher half of 10.20.9.0/23 10.20.8.0/23 + +10.20.9.0–10.20.9.255 Holds none of the original addresses—don’t split again + + + +The other two components of the set of exclusive summary routes are finally found in Table D-106. As a result, looking at all three tables, the answer for this question is as fol-lows: + +10.20.3.0/24 10.20.4.0/22 10.20.8.0/24 + +Question 3: Answer + +This question begins with the following routes that need to be summarized: + +172.16.200.0/23, range 172.16.200.0–172.16.201.255 172.16.202.0/23, range 172.16.202.0–172.16.203.255 172.16.204.0/23, range 172.16.204.0–172.16.205.255 172.16.206.0/23, range 172.16.206.0–172.16.207.255 172.16.208.0/23, range 172.16.208.0–172.16.209.255 +The inclusive summary for these routes is + +172.16.192.0/19 +Table D-107 begins by showing three passes through the algorithm. These three passes do not determine all the summary routes in the answer. +74 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table D-107 Question 3 Answer: Inclusive Summary of 5 Routes + + +Split + + +Inclusive summary + +1st split, lower half + + +1st split, higher half + + +2nd split, lowest quarter + +2nd split, 2nd quarter + + +2nd split, 3rd quarter + +2nd split, highest quarter + + +Candidate Exclusive Summary +172.16.192.0/19 + +172.16.192.0/20 + + +172.16.208.0/20 + + +172.16.192.0/21 + + +172.16.200.0/21 + + +172.16.208.0/21 + +172.16.216.0/21 + +Range + + +172.16.192.0– 172.16.223.255 +172.16.192.0– 172.16.207.255 + +172.16.208.0– 172.16.223.255 + +172.16.192.0– 172.16.199.255 + +172.16.200.0– 172.16.207.255 + +172.16.208.0– 172.16.215.255 +172.16.216.0– 172.16.223.255 + +Analysis + + +Includes too many addresses + +Includes 172.16.192.0– 172.16.199.255, which should not be included +Includes 172.16.210.0– 172.16.223.255, which should not be included +Includes only addresses totally outside the range—don’t split again +Includes only addresses in the range—it’s part of exclusive summary +Includes some addresses that should not be included +Includes only addresses totally outside the range—don’t split again + + + +The last four rows of the table show the results of the second split (per Step 4 in the algorithm). Two of these four candidate exclusive summaries (172.16.192.0/21 and 172.16.216.0/21) only contain addresses outside the range that needs to be summarized, so these do not need to be split further. 172.16.200.0/21 is part of the exclusive summary, so it does not need to be split again. Only 172.16.208.0/21 needs further splitting at this point. + +Under closer examination, at this point in the process, no further work is actually needed. Only one original component subnet has not had its address range summarized. For ref-erence, the following list describes which ranges are part of the one exclusive summary route that has already been uncovered (172.16.200.0/21), and those that are not inside that summary route: + +172.16.200.0/24—part of summary 172.16.200.0/21 172.16.202.0/24—part of summary 172.16.200.0/21 172.16.204.0/24—part of summary 172.16.200.0/21 172.16.206.0/24—part of summary 172.16.200.0/21 172.16.208.0/24—still looking for summary +Appendix D: IP Addressing Practice 75 + +Because only one component subnet still needs to be summarized, there is no possibility that a larger exclusive summary route will be found, because there are no other compo-nent subnets to combine with 172.16.208.0/24. As a result, the final answer for this prob-lem (the exclusive summary routes for the component subnets) is as follows: + +172.16.200.0/21 172.16.208.0/24 + +Question 4: Answer + +This question begins with the following routes that need to be summarized: + +172.16.112.0/22, range 172.16.112.0–172.16.115.255 172.16.116.0/22, range 172.16.116.0–172.16.119.255 172.16.120.0/22, range 172.16.120.0–172.16.123.255 172.16.124.0/22, range 172.16.124.0–172.16.127.255 +The inclusive summary for these routes is + +172.16.112.0/20, range 172.16.112.0–172.16.127.255 +By simply inspecting the inclusive summary, you can see that it exactly matches the col-lective ranges of IP addresses in the four component subnets. So, the exclusive summary for these four subnets is also 172.16.112.0/20. + +Question 5: Answer + +This question begins with the following routes that need to be summarized: + +192.168.1.16/29, range 192.168.1.16–192.168.1.23 192.168.1.24/29, range 192.168.1.24–192.168.1.31 192.168.1.32/29, range 192.168.1.32–192.168.1.39 +The inclusive summary for these routes is + +192.168.1.0/26 +Table D-108 begins by showing three passes through the algorithm. These three passes do not determine all the summary routes in the answer. + +Table D-108 Question 2 Answer: Inclusive Summary of Three Routes + +Split Candidate Range Analysis Exclusive Summary + +Inclusive summary + +1st split, lower half + +192.168.1.0/26 + +192.168.1.0/27 + +192.168.1.0– 192.168.1.63 +192.168.1.0– 192.168.1.31 + +Includes too many addresses + +Includes too many addresses—split again +76 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Split Candidate Range Analysis Exclusive Summary + +1st split, higher half + +2nd split, lowest quarter + +2nd split, 2nd quarter + + +2nd split, 3rd quarter + +2nd split, highest quarter + +192.168.1.32/27 + +192.168.1.0/28 + + +192.168.1.16/28 + + +192.168.1.32/28 + +192.168.1.48/28 + +192.168.1.32– 192.168.1.63 +192.168.1.0– 192.168.1.15 + +192.168.1.16– 192.168.1.31 + +192.168.1.32– 192.168.1.47 +192.168.1.48– 192.168.1.63 + +Includes too many addresses—split again +Includes only addresses totally outside the range— don’t split again +Includes only addresses in the range—it’s part of exclusive summary +Includes some addresses that should not be included +Includes only addresses totally outside the range— don’t split again + + + +The last four rows of the table show the results of the second split (per Step 4 in the algorithm). Two of these four candidate exclusive summaries (192.168.1.0/28 and 192.168.1.48/28) only contain addresses outside the range that needs to be summarized, so these do not need to be split further. 192.168.1.16/28 is part of the exclusive summary, so it does not need to be split again. Only 192.168.32.0/28 needs further splitting at this point. + +Under closer examination, at this point in the process, no further work is actually needed. Only one original component subnet has not had its address range summarized. For ref-erence, the following list describes which ranges are part of the one exclusive summary route that has already been uncovered (192.168.1.16/28), and those that are not inside that summary route: + +192.168.1.16/29—part of summary 192.168.1.16/28 192.168.1.24/29—part of summary 192.168.1.16/28 192.168.1.16/29—still looking for summary +Because only one component subnet still needs to be summarized, there is no possibility that a larger exclusive summary route will be found. As a result, the final answer for this problem (the exclusive summary routes for the component subnets) is as follows: + +192.168.1.16/28 192.168.1.32/29 + + + + + + + + + + +This page intentionally left blank + + + + + + + + + + +This page intentionally left blank +APPENDIX E + + + + + + +Key Tables for CCIE Study + + +Chapter 1 + +Table 1-2 Ethernet Cabling Types + + +Type of Cable +Straight-through + +Crossover + +Pinouts Key Pins Connected +T568A (both ends) or T568B (both ends) + +T568A on one end, and T568B on the other + + + + + +Table 1-3 Ethernet Header Fields + +Field + + + +Description +Provides synchronization and signal transitions to allow proper clocking of the transmitted signal. Consists of 62 alternating 1s and 0s, and ends with a pair of 1s. +Same purpose and binary value as DIX preamble; 802.3 simply renames the 8-byte DIX preamble as a 7-byte preamble and a 1-byte Start of Frame Delimiter (SFD). + +Type (or Protocol Type) (DIX) + + + +Length (802.3) + + + +Destination Service Access Point (802.2) +4 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Field Description Source Service Access Point (802.2) + + + +Control (802.2) + + + +Organizationally Unique Identifier (SNAP) + + + +Type (SNAP) + + + + + + +Table 1-4 Three Types of Ethernet/MAC Address + + +Type of Ethernet/MAC Address + +Description and Notes + +Fancy term for an address that represents a single LAN interface. The I/G bit, the least significant bit in the most significant byte, is set to 0. +An address that means “all devices that reside on this LAN right now.” Always a value of hex FFFFFFFFFFFF. +A MAC address that implies some subset of all devices currently on the LAN. By definition, the I/G bit is set to 1. + + + + + +Table 1-5 + +Field +I/G + + +I/G and U/L Bits + +Meaning + + +U/L +Appendix E: Key Tables for CCIE Study 5 + +Table 1-7 LAN Switch Forwarding Behavior + +Type of Address Switch Action +Known unicast + +Unknown unicast + +Broadcast + +Multicast + + + + +Table 1-9 Switch Internal Processing + +Switching Method Description +The switch fully receives all bits in the frame (store) before forwarding the frame (forward). This allows the switch to check the frame check sequence (FCS) before forwarding the frame, thus ensuring that errored frames are not forwarded. +The switch performs the address table lookup as soon as the Destination Address field in the header is received. The first bits in the frame can be sent out the outbound port before the final bits in the incoming frame are received. This does not allow the switch to discard frames that fail the FCS check, but the forwarding action is faster, resulting in lower latency. +This performs like cut-through switching, but the switch waits for 64 bytes to be received before forwarding the first bytes of the outgoing frame. According to Ethernet specifications, collisions should be detected during the first 64 bytes of the frame, so frames that are in error because of a collision will not be forwarded. + + + +Table 1-12 Ethernet Types and Cabling Standards + + +Standard +10BASE5 + +10BASE2 + +10BASE-T + +100BASE-FX + +100BASE-T + +Cabling Maximum Single Cable Length +Thick coaxial + +Thin coaxial + +UTP Cat 3, 4, 5, 5e, 6 + +Two strands, multimode + +UTP Cat 3, 4, 5, 5e, 6, 2 pair +6 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Standard +100BASE-T4 + +Cabling Maximum Single Cable Length +UTP Cat 3, 4, 5, 5e, 6, 4 pair + + +100BASE-TX UTP Cat 3, 4, 5, 5e, 6, or STP, 2 pair + +1000BASE-LX + + +1000BASE-SX + +1000BASE-ZX + +1000BASE-CS + +1000BASE-T + +Long-wavelength laser, MM or SM fiber + +Short-wavelength laser, MM fiber +Extended wavelength, SM fiber +STP, 2 pair + +UTP Cat 5, 5e, 6, 4 pair + +(SM) + +(MM) + +____ m with 62.5-micron fiber; ____ m with 50-micron fiber + + + + +Chapter 2 + +Table 2-2 Private VLAN Communications Between Ports + + +Description of Who Can Talk to Whom + +Talk to ports in primary VLAN (promiscuous ports) +Talk to ports in the same secondary VLAN (host ports) +Talks to ports in another secondary VLAN + +Talk to trunks + +Primary VLAN Ports + +Community VLAN Ports1 + +Isolated VLAN Ports1 + + +1 Community and isolated VLANs are secondary VLANs. + +2 Promiscuous ports, by definition in the primary VLAN, can talk to all other ports. + + + +Table 2-6 VTP Modes and Features + +Function + + + +Server Client Mode Mode + + + +Transparent Off Mode Mode* + +Originates VTP advertisements + +Processes received advertisements to update its VLAN configuration +Forwards received VTP advertisements +Appendix E: Key Tables for CCIE Study 7 + + + +Function Server Mode +Saves VLAN configuration in NVRAM or vlan. dat +Can create, modify, or delete VLANs using configuration commands + +Client Transparent Off Mode Mode Mode* + + +* The Off mode is supported only with VTPv3. + + +Table 2-8 Valid VLAN Numbers, Normal and Extended + + +VLAN Normal or Number Extended? + +Can Be Advertised and Pruned by VTP Versions 1 and 2? + +Comments + + +Not available for use + +On Cisco switches, the default VLAN for all access ports; cannot be deleted or changed +— + +Defined specifically for use with FDDI and TR translational bridging +— + +Not available for use + + + + +Table 2-9 VLAN Configuration and Storage for VTPv1 and VTPv2 + + +Function + +Normal-range VLANs can be configured from +Extended-range VLANs can be configured from + +When in VTP Server Mode When in VTP Transparent Mode + +VTP and normal-range VLAN configuration commands are stored in +Extended-range VLAN configuration commands are stored in + +1 When a switch reloads, if the VTP mode or domain name in the vlan.dat file and the startup config file differs, the switch uses only the vlan.dat file’s contents for VLAN configuration. +8 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 3 + +Table 3-2 Three Major 802.1D STP Process Steps + +Major Step Description +Elect the root switch + + +Determine each switch’s Root Port + +Determine the Designated Port for each segment + + + + +Table 3-3 Default Port Costs + + +Port Speed +10 Mbps + +100 Mbps + +1 Gbps + +10 Gbps + +Pre-802.1D-1998 Cost 802.1D-1998 Cost 802.1D-2004 Cost +100 + +10 + +1 + +1 + + + + +Table 3-4 IEEE 802.1D Spanning Tree Interface States + + +State + +Blocking + +Listening + +Learning + +Forwarding + +Disabled + +Forwards Data Frames? + +Learns Source MACs of Received Frames? + +Transitory or Stable State? +Appendix E: Key Tables for CCIE Study 9 + +Table 3-5 RSTP and STP Port States + + +Administrative State +Disabled + +Enabled + +Enabled + +Enabled + +Enabled + +STP State (802.1D) RSTP State (802.1w) +Disabled + +Blocking + +Listening + +Learning + +Forwarding + + + + +Table 3-6 RSTP Port Roles + +RSTP Role Definition +Root Port + +Designated Port + +Alternate Port + + + + + + +Backup Port + + + + + + + + +Table 3-9 Types of STP Inconsistencies and Their Causes + +Inconsistency Type Description and Probable Cause of Inconsistency +Type + +(*TYPE_Inc) + +Port VLAN ID + +(*PVID_Inc) + +PVST Simulation + +(*PVST_Inc) +10 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Inconsistency Type Description and Probable Cause of Inconsistency Loop +(*LOOP_Inc) + +Root + +(*ROOT_Inc) + + + +Bridge Assurance (*BA_Inc) + + + + +Table 3-12 IEEE 802.1D STP Timers + +Timer Default Purpose +Hello + +Forward Delay + +MaxAge + + + +Chapter 4 + +Table 4-2 Classful Network Review + + +Class of Address + +A + +B + +C + +D + +E + +Size of Network and Host Parts of the Addresses + +Range of First Octet Values + +Default Mask for Each Class of Network + +Identifying Bits at Beginning of Address +Appendix E: Key Tables for CCIE Study 11 + +Table 4-3 Finding the Size of the Network, Subnet, and Host Fields in an IP Address + + +Name of Part of Process to Find Its Size the Address +Network + +Subnet + +Host + +Size per Figure 4-1 Example + + + + +Table 4-4 Binary Math to Calculate the Subnet Number and Broadcast Address + +Address + +Mask + +Subnet Number (Result of AND) +Broadcast + + + +Table 4-5 Quick Math to Find the Subnet Number—172.31.103.41, 255.255.252.0 + +Octet Comments + + + +Address + +Mask + +Subnet number results after Steps 1 and 2 + +1 2 3 4 + + +Equivalent to /22. + +Magic number will be 256 – 252 = 4. + + + +Subnet number after completing the interesting octet + +100 is the multiple of 4 closest to, but not exceeding, 103. + + + + +Table 4-6 Quick Math to Find the Broadcast Address—172.31.103.41, 255.255.252.0 + +Octet Comments + + +1 2 3 4 +Subnet number (per Step 1) + +Mask (for reference) + +Results after Steps 1 to 4 + +Subnet number after completing the empty octet + + + + +Equivalent to /22 + +Magic number will be 256 – 252 = 4 + +Subnet’s third octet (100), plus magic number (4), minus 1 is 103 +12 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 4-7 Binary Method to Find All Subnets—Steps 1 Through 4 + +Octet + + +Subnet +Network number/zero subnet + +2nd subnet + +3rd subnet + +4th subnet + +5th subnet + +6th subnet + +7th subnet + +1 10101100 +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +2 3 4 000 11111 +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + + +8th subnet (2y = 8); broadcast subnet 10101100 000 11111 + + + +Table 4-8 Binary Method to Find All Subnets—Step 5 + +Octet + + +Subnet +Network number/zero subnet + +2nd subnet + +3rd subnet + +4th subnet + +5th subnet + +6th subnet + +7th subnet + +8th subnet (2y = 8); broadcast subnet + +1 10101100 +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +2 3 4 00011111 +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +00011111 +Appendix E: Key Tables for CCIE Study 13 + +Table 4-10 Example of Finding the Best Inclusive Summary—Binary + +Octet 1 Octet 2 Octet 3 Octet 4 +172.31.20.0/24 + +172.31.21.0/24 + +172.31.22.0/24 + +172.31.23.0/24 + +Prefix length: 22 + +Inclusive summary + + + +Table 4-12 RFC 1918 Private Address Space + +Range of IP Addresses Class of Networks Number of Networks +10.0.0.0 to 10.255.255.255 + +172.16.0.0 to 172.31.255.255 + +192.168.0.0 to 192.168.255.255 + + + + +Table 4-13 + +Name + + +NAT Terminology + +Location of Host Represented by Address + + + +IP Address Space in Which Address Exists + +Inside Local address + +Inside Global address + +Outside Local address + +Outside Global address + + + + + +Table 4-16 + +Command + + +Command Reference for Chapter 4 + +Description + +ip address ip-address mask [secondary] + +ip nat {inside | outside} +14 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Command Description +ip nat inside source {list {access-list-number | access-list-name} | route-map name} {interface type number | pool pool-name} [overload] + +ip nat inside destination list {access-list-number | name } pool name + +ip nat outside source {list {access-list-number | access-list-name} | route-map name} pool pool-name [add-route] + +ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length } +[type rotary] + +show ip nat statistics + + +show ip nat translations [verbose] + +clear ip nat translation {* | [inside global-ip local-ip] [outside local-ip global-ip]} + +debug ip nat + +show ip interface [type number ] [brief] + + + + +Table 4-17 + +Field +Version + + +IP Header Fields + +Meaning + + + +Header Length + + + +DS Field +Appendix E: Key Tables for CCIE Study 15 + + +Field Meaning Packet Length + +Identification + + + +Flags + +Fragment Offset + +Time to Live (TTL) + + +Protocol + + +Header Checksum + + +Source IP Address + +Destination IP Address + +Optional Header Fields and Padding + + + + + + +Table 4-18 IP Protocol Field Values + +Protocol Name Protocol Number +ICMP + +TCP + +UDP + +EIGRP + +OSPF + +PIM +16 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Table 4-19 + +Field +Version + + +IPv6 Header Fields + +Meaning + + +Traffic Class + +Flow Label + +Payload Length + +Next Header + + +Hop Limit + + + + +Source Address + +Destination Address + + + +Chapter 5 + +Table 5-2 Comparing RARP, BOOTP, and DHCP + +Feature RARP BOOTP DHCP +Relies on server to allocate IP addresses + +Encapsulates messages inside IP and UDP so that they can be forwarded to a remote server +Client can discover its own mask, gateway, DNS, and download server +Dynamic address assignment from a pool of IP addresses, without requiring knowledge of client MACs +Allows temporary lease of IP address + +Includes extensions for registering client’s FQDN with a DNS +Appendix E: Key Tables for CCIE Study 17 + +Table 5-3 SNMP Version Summaries + +SNMP Version Description +1 + +2 + +2c + +3 + + + + +Table 5-4 SNMP Protocol Messages (RFCs 1157 and 1905) + + +Message + +Get + +GetNext + +Initial Response Version Message +1 + +1 + +Typically Main Purpose Sent By + + +GetBulk 2 + + + +Response 1 + +Set 1 + + +Trap 1 + + + +Inform 2 +18 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 5-6 Command Reference for Chapter 5 + +Command Description +ip dhcp pool name + +default-router address [address2... address8] + +dns-server address [address2... address8 ] + +lease {days [hours][minutes] | infinite} + +network network-number [mask | prefix-length] + +ip dhcp excluded-address [low-address high-address] + +host address [mask | prefix-length] + + +hardware-address hardware-address type + +show ip dhcp binding [ip-address] + +show ip dhcp server statistics + +standby [group-number ] ip [ip-address [secondary ]] + +track object-number interface type-number {line-protocol | ip routing } + +standby [group-number ] preempt [delay +{minimum delay | reload delay | sync delay}] + +show track [object-number [brief] | interface [brief] | ip route [brief] | resolution | timers ] + +standby [group-number ] priority priority + +standby [group-number ] timers [msec] hellotime [msec] holdtime + +standby [group-number ] track object-number + + +show standby [type number [group]] [brief | all] +Appendix E: Key Tables for CCIE Study 19 + + +Command Description +ntp peer ip-address [version number ] [key keyid] [source interface ] [prefer] + +ntp server ip-address [version number ] [key keyid] [source interface ] [prefer] + +ntp broadcast [version number] + +ntp broadcast client + +ntp master [stratum ] + +show ntp associations + +show ntp status + +logging trap level + + + + +logging host {{ip-address | hostname } | +{ipv6 ipv6-address | hostname}} [transport {udp [port port-number] | tcp [port port-number ]}] [alarm [severity]] + +ip wccp {web-cache | service-number} +[service-list service-access-list] [mode {open | closed}] [group-address multicast-address ] [redirect-list access-list] [group-list access-list] [password [0-7 ] password ] + +ip wccp {web-cache | service-number} redirect {in | out} + +show ip wccp + +snmp-server enable traps + +snmp-server host {hostname | ip-address} [vrf vrf-name] [traps | informs] [version {1 | 2c | 3 [auth | noauth | priv]}] community-string [udp-port port] [notification-type] +20 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Command Description +snmp-server community string [view view-name] [ro | rw ] [access-list-number] + + +show snmp mib ifmib ifindex interface-id + + +ip sla monitor operation-index + +type [jitter | udp-echo | echo protocol icmpecho | dns | ftp operation | http operation | mpls ping ipv4 | pathecho | pathjitter | tcpconnect | voip delay post-dial | udp-jitter | udp-jitter codec] + +ip sla key-chain key-chain-name + +ip sla monitor schedule operation-number [life {forever | seconds }] [start-time +{hh:mm [: ss] [month day | day month ] | pending | now | after hh: mm :ss}] [ ageout seconds ] [recurring] +ip sla monitor responder + + + +show ip sla monitor statistics [operation] detail + +show ip sla responder + + +ip ssh [timeout seconds | authentication-retries integer] +crypto key generate rsa + +transport input ssh + +ip http server + +ip http secure-server +Appendix E: Key Tables for CCIE Study 21 + + +Command Description +ip traffic-export profile profile-name + +ip traffic-export apply profile-name + +event manager applet applet-name [class class-options ] [trap] + +event cli pattern regular-expression +{[default] [enter] [questionmark] [tab]} [sync {yes | no skip {yes | no}] [mode variable ] +[occurs num-occurrences ] [period period-value] [maxrun maxruntime-number ] +ip flow-top-talkers + +flow monitor flow-name + +flow exporter exporter-name + + +rmon event + + +rmon alarm + +Copy + +tftp-server flash [partition-number: ] filename1 [alias filename2 ] [access-list-number] +aaa new-model + +aaa authentication + +aaa authorization + +ip scp server enable +22 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 6 + +Table 6-2 Matching Logic and Load-Balancing Options for Each Switching Path + + +Switching Path + +Process switching + +Fast switching + +Structures That Hold the Load-Balancing Method Forwarding Information + + +CEF + + + + +Chapter 7 + + +Table 7-2 + +Function + + +RIPv2 Feature Summary + +Description + +General characteristic +Transport protocol +Metric + +Hello interval + +Update destination +Update interval + +Full or partial updates + +Triggered updates +Authentication + +Route tags + +Next Hop field +Appendix E: Key Tables for CCIE Study 23 + + +Table 7-3 + +Function + + +RIPv2 Features Related to Convergence and Loop Prevention + +Description + +Counting to Infinity + + + + +Split Horizon + + +Split Horizon with Poisoned Reverse + +Route poisoning + + +Triggered update + + + + +Update timer + + +Invalid after timer + + + + + +Holddown timer + + + + + +Flushed after timer +24 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 7-4 RIPv2 Per-Interface Actions, and How to Disable Them When Enabled + +RIPv2 Function How to Disable +Sending RIPv2 updates + +Listening for RIPv2 updates + +Advertising the connected subnet + + + +Chapter 8 + + +Table 8-2 + +Feature +Transport + + +EIGRP Feature Summary + +Description + + + +Metric + +Hello interval + +Hold timer + + +Update destination address +Full or partial updates + +Authentication + +VLSM/classless + +Route Tags + +Next-hop field + +Manual route summarization +Multiprotocol +Appendix E: Key Tables for CCIE Study 25 + + +Table 8-4 + +Field +H + +Address + +Interface + +Hold + + +EIGRP Neighbor Table Columns + +Description + + +Uptime + +SRTT + +RTO + + +Q Cnt + +Seq Num + + + + + +Table 8-6 EIGRP Message Summary + +EIGRP Packet Purpose +Hello + +Ack + +Update + +Query + + +Reply + + +SIA-Query + + +SIA-Reply +26 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 9 + + +Table 9-2 + +Message +Hello + + +OSPF Messages + +Description + + +Database Description (DD or DBD) + +Link-State Request (LSR) + + +Link-State Update (LSU) + +Link-State Acknowledgment (LSAck) + + + +Table 9-3 OSPF Network Types + + +Interface Type + + +Broadcast + +Point-to-point +1 + +Non-broadcast2 (NBMA) + +Point-to-multipoint + +Point-to-multipoint nonbroadcast +Loopback3 + +Uses DR/BDR? + +Default Hello Requires Interval a neighbor +Command? + +More Than Two Hosts Allowed in the Subnet? + + +1 Default on Frame Relay point-to-point subinterfaces. + +2 Default on Frame Relay physical and multipoint subinterfaces. + +3 Cannot be configured manually—used on loopback interfaces automatically. +Appendix E: Key Tables for CCIE Study 27 + +Table 9-4 OSPF LSA Types + +LSA Type Common Name Description + +1 + + +2 + + +3 + + + +4 + + +5 + +6 + +7 + + +8 + + +9–11 + + + + + + + + + +Table 9-5 + +Router + + +Network + + +Net Summary + + + +ASBR Summary + + +AS External + +Group Membership + +NSSA External + + +External Attributes + + +Opaque + + + + + + + + + +OSPF Stubby Area Types + + + +Area Type + + +Stubby + +Totally stubby (TS) + +Not-so-stubby area (NSSA) + +Totally NSSA (NSSA-TS) + +Stops Injection of Type 4/5 LSAs? + +Stops Injection of Type 3 LSAs? + +Allows Creation of Type 7 LSAs Inside the Area? +28 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 9-6 Stub Area Configuration Options + +Stub Type Router OSPF Subcommand +NSSA + +Totally NSSA + +Stubby + +Totally stubby + + + +Table 9-7 OSPF Authentication Types + + +Type Meaning + +0 None + +1 Clear text + +2 MD5 + +Enabling Interface Subcommand + +Authentication Key Configuration Interface Subcommand + + + + + +Table 9-8 Effect of the area authentication Command on OSPF Interface Authentication Settings + +area authentication Command Interfaces in That Area Default to Use + + +area area-id authentication + +area area-id authentication message-digest + + + +Table 9-9 Configuring OSPF Authentication on Virtual Links + +Type Command Syntax for Virtual Links +0 + +1 + +2 +Appendix E: Key Tables for CCIE Study 29 + +Table 9-10 OSPFv3 LSA Types + + +LSA Type +1 + +Common Name Description Flooding Scope +Router LSA + + +2 Network LSA + +3 Inter-Area Prefix LSA + +4 Inter-Area Router LSA + +5 Autonomous System External LSA + +7 NSSA LSA + + +8 Link LSA + + + + +9 Intra-Area-Prefix LSA + + + + + + + + + + +Table 9-15 OSPF Neighbor States + +State Meaning +Down + +Attempt + +Init + +2-Way +30 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +State Meaning ExStart + +Exchange + +Loading + +Full + + + + +Chapter 10 + +Table 10-3 Adjacencies Between Routers + + +1st Neighbor’s Level +Level 1 only + +Level 1 only + +Level 1 only + +Level 1 + 2 + + +Level 1 + 2 + +Level 2 only + +2nd Neighbor’s Level Resulting Adjacency +Level 1 only + +Level 1 + 2 + +Level 2 only + +Level 1 + 2 + + +Level 2 only + +Level 2 only + + + + + +Table 10-7 + +Timer + + +IS-IS Timer Summary + +Meaning + +MaxAge, a.k.a. RemainingLifetime +ZeroAgeLifetime + +Hello + +Hold + + +CSNP Interval +Appendix E: Key Tables for CCIE Study 31 + +Table 10-8 IS Neighbor States + +State Meaning +Down + +Init + +Up + + + + +Table 10-9 OSI Terminology + +Term Meaning +System + +End System (ES) + +Intermediate System (IS) + +Domain + +Circuit + +Local Circuit ID + +Extended Local Circuit ID + +Network Service Access Point (NSAP) + +Network Entity Title + + +Initial Domain Part (IDP) + + +Domain Specific Part (DSP) + + +Address Format ID (AFI) + +Initial Domain ID (IDI) + +High-Order Domain Specific Part (HO-DSP) +32 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Term Meaning System ID +NSAP Selector (NSEL, SEL) + +Sub Network Point of Attachment (SNPA) +Designated IS (DIS) + +Network Layer Protocol ID (NLPID) + + + + +Chapter 11 + +Table 11-2 match Command Options for IGP Redistribution + +match Command Description + +match interface interface-type interface-number [... interface-type interface-number ] + +*match ip address {[access-list-number | access-list-name] | prefix-list prefix-list-name} + +*match ip next-hop {access-list-number | access-list-name} + +*match ip route-source {access-list-number | access-list-name} + +match metric metric-value [+ – deviation ] + + +match route-type {internal | external [type-1 | type-2] | level-1 | level-2 } + +match tag tag-value [...tag-value] + +*Can reference multiple numbered and named ACLs on a single command. +Appendix E: Key Tables for CCIE Study 33 + +Table 11-3 set Command Options for IGP Redistribution + +set Command Description +set level {level-1 | level-2 | level-1-2 | stub-area | backbone} + +set metric metric-value + +set metric bandwidth delay reliability loading mtu +set metric-type {internal | external | type-1 | type-2 } + +set tag tag-value + + + +Table 11-4 LE and GE Parameters on IP Prefix List, and the Implied Range of Prefix Lengths + +Prefix List Parameters Range of Prefix Lengths +Neither + +Only le + +Only ge + +Both ge and le + + + +Table 11-5 Example Prefix Lists Applied to the List of Routes + +prefix-list Command Routes Results Parameters Matched +10.0.0.0/8 1 + +10.128.0.0/9 2 + + +10.0.0.0/8 ge 9 2–6 + + +10.0.0.0/8 ge 24 le 24 3, 4 +34 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +prefix-list Command Routes Results Parameters Matched +10.0.0.0/8 le 28 1–4 + +0.0.0.0/0 None + + + +0.0.0.0/0 le 32 All + + + + + + +Table 11-6 Administrative Distances + +Route Type Administrative Distance +Connected + +Static + +EIGRP summary route + +EBGP + +EIGRP (internal) + +IGRP + +OSPF + +IS-IS + +RIP + +EIGRP (external) + +iBGP + +Unreachable +Appendix E: Key Tables for CCIE Study 35 + +Table 11-7 Default Metrics and Route Metric Types in IGP Route Redistribution + + +IGP into Which Routes Are Default Metric Redistributed +RIP + +EIGRP + +OSPF + +IS-IS + +Default (and Possible) Metric Types + + +* OSPF uses cost 20 when redistributing from an IGP, and cost 1 when redistributing from BGP. + + + +Table 11-8 Metric + +IGP +RIP + +EIGRP + +OSPF + +IS-IS + + +IGP Order of Precedence for Choosing Routes Before Considering the + + +Order of Precedence of Metric + + +* For E2 routes whose metric ties, OSPF also checks the cost to the advertising ASBR. + + +Table 11-9 OSPF Route Summarization Commands + +Where Used Command +ASBR + +ABR + + + + +Table 11-10 + +Feature + + +Four Methods for Learning Default Routes + +RIP EIGRP OSPF + +Static route to 0.0.0.0, with the redistribute static command + +The default-information originate command + +The ip default-network command + +Using summary routes + + + + + + + + + + +This page intentionally left blank +APPENDIX F + + + + +Solutions for Key Tables for CCIE Study + + +Chapter 1 + +Table 1-2 Ethernet Cabling Types + + +Type of Cable +Straight-through + +Crossover + +Pinouts +T568A (both ends) or T568B (both ends) + +T568A on one end, and T568B on the other + +Key Pins Connected +1–1; 2–2; 3–3; 6–6 + +1–3; 2–6; 3–1; 6–2 + + + + +Table 1-3 Ethernet Header Fields + +Field Description + +Preamble (DIX) + + + +Preamble and Start of Frame Delimiter (802.3) + + +Type (or Protocol Type) (DIX) + + + +Length (802.3) + + + +Destination Service Access Point (802.2) + +Provides synchronization and signal transitions to allow proper clocking of the transmitted signal. Consists of 62 alternating 1s and 0s, and ends with a pair of 1s. +Same purpose and binary value as DIX preamble; 802.3 simply renames the 8-byte DIX preamble as a 7-byte preamble and a 1-byte Start of Frame Delimiter (SFD). +2-byte field that identifies the type of protocol or protocol header that follows the header. Allows the receiver of the frame to know how to process a received frame. +Describes the length, in bytes, of the data following the Length field, up to the Ethernet trailer. Allows an Ethernet receiver to predict the end of the received frame. +DSAP; 1-byte protocol type field. The size limitations, along with other uses of the low-order bits, required the later addition of SNAP headers. +4 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Field +Source Service Access Point (802.2) + + +Control (802.2) + + + + +Organizationally Unique Identifier (SNAP) + + + +Type (SNAP) + +Description +SSAP; 1-byte protocol type field that describes the upper-layer protocol that created the frame. +1- or 2-byte field that provides mechanisms for both connectionless and connection-oriented operation. Generally used only +for connectionless operation by modern protocols, with a 1-byte value of 0x03. +OUI; 3-byte field, generally unused today, providing a place for the sender of the frame to code the OUI representing the manufacturer of the Ethernet NIC. +2-byte Type field, using same values as the DIX Type field, overcoming deficiencies with size and use of the DSAP field. + + + + +Table 1-4 Three Types of Ethernet/MAC Address + + +Type of Ethernet/MAC Address +Unicast + + +Broadcast + +Multicast + +Description and Notes + +Fancy term for an address that represents a single LAN interface. The I/G bit, the least significant bit in the most significant byte, is set to 0. +An address that means “all devices that reside on this LAN right now.” Always a value of hex FFFFFFFFFFFF. +A MAC address that implies some subset of all devices currently on the LAN. By definition, the I/G bit is set to 1. + + + + + +Table 1-5 + +Field +I/G + +U/L + + +I/G and U/L Bits + +Meaning +Binary 0 means that the address is a unicast; Binary 1 means that the address is a multicast or broadcast. +Binary 0 means that the address is vendor assigned; Binary 1 means that the address has been administratively assigned, overriding the vendor-assigned address. +Appendix F: Solutions for Key Tables for CCIE Study 5 + +Table 1-7 LAN Switch Forwarding Behavior + + +Type of Address +Known unicast + +Unknown unicast + +Broadcast + +Multicast + +Switch Action +Forwards frame out the single interface associated with the destination address +Floods frame out all interfaces, except the interface on which the frame was received +Floods frame identically to unknown unicasts + +Floods frame identically to unknown unicasts, unless multicast optimizations are configured + + + + +Table 1-9 Switch Internal Processing + + +Switching Method +Store-and-forward + + + +Cut-through + + + + + +Fragment-free + +Description +The switch fully receives all bits in the frame (store) before forwarding the frame (forward). This allows the switch to check the frame check sequence (FCS) before forwarding the frame, thus ensuring that errored frames are not forwarded. +The switch performs the address table lookup as soon as the Destination Address field in the header is received. The first bits in the frame can be sent out the outbound port before the final bits in the incoming frame are received. This does not allow the switch to discard frames that fail the FCS check, but the forwarding action is faster, resulting in lower latency. +This performs like cut-through switching, but the switch waits for 64 bytes to be received before forwarding the first bytes of the outgoing frame. According to Ethernet specifications, collisions should be detected during the first 64 bytes of the frame, so frames that are in error because of a collision will not be forwarded. + + + + + +Table 1-12 + +Standard +10BASE5 + +10BASE2 + +10BASE-T + + +Ethernet Types and Cabling Standards + +Cabling +Thick coaxial + +Thin coaxial + +UTP Cat 3, 4, 5, 5e, 6 + + + +Maximum Single Cable Length +500 m + +185 m + +100 m + + + +100BASE-FX + +100BASE-T + +Two strands, multimode 400 m + +UTP Cat 3, 4, 5, 5e, 6, 2 pair 100 m +6 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Standard 100BASE-T4 100BASE-TX + +1000BASE-LX + + +1000BASE-SX + +1000BASE-ZX + +1000BASE-CS + +1000BASE-T + +Cabling +UTP Cat 3, 4, 5, 5e, 6, 4 pair + +UTP Cat 3, 4, 5, 5e, 6, or STP, 2 pair +Long-wavelength laser, MM or SM fiber + +Short-wavelength laser, MM fiber +Extended wavelength, SM fiber +STP, 2 pair + +UTP Cat 5, 5e, 6, 4 pair + +Maximum Single Cable Length 100 m +100 m + +10 km (SM) + +3 km (MM) + +220 m with 62.5-micron fiber; 550 m with 50-micron fiber +100 km + +25 m + +100 m + + + + +Chapter 2 + +Table 2-2 Private VLAN Communications Between Ports + + +Description of Who Can Talk to Whom + +Talk to ports in primary VLAN (promiscuous ports) +Talk to ports in the same secondary VLAN (host ports) +Talks to ports in another secondary VLAN + +Talk to trunks + +Primary VLAN Ports +Yes + +N/A2 + +N/A2 + +Yes + +Community VLAN Ports1 +Yes + +Yes + +No + +Yes + +Isolated VLAN Ports1 +Yes + +No + +No + +Yes + + +1 Community and isolated VLANs are secondary VLANs. + +2 Promiscuous ports, by definition in the primary VLAN, can talk to all other ports. + + + +Table 2-6 VTP Modes and Features + +Function + + + +Server Client Mode Mode + + + +Transparent Off Mode Mode* + +Originates VTP advertisements Yes Yes No No + +Processes received advertisements to update its Yes Yes No No VLAN configuration +Forwards received VTP advertisements Yes Yes Yes No +Appendix F: Solutions for Key Tables for CCIE Study 7 +1 + + + +Function Server Client Mode Mode +Saves VLAN configuration in NVRAM or vlan. Yes Yes dat +Can create, modify, or delete VLANs using Yes No configuration commands + +Transparent Off Mode Mode* +Yes Yes + +Yes Yes + + +* The Off mode is supported only with VTPv3. + + +Table 2-8 Valid VLAN Numbers, Normal and Extended + + +VLAN Number + +0 + +1 + + +2–1001 + +1002–1005 + +1006–4094 + +4095 + +Normal or Extended? + +Reserved + +Normal + + +Normal + +Normal + +Extended + +Reserved + +Can Be Advertised and Pruned by VTP Versions 1 and 2? +— + +No + + +Yes + +No + +No + +No + +Comments + + +Not available for use + +On Cisco switches, the default VLAN for all access ports; cannot be deleted or changed +— + +Defined specifically for use with FDDI and TR translational bridging +— + +Not available for use + + + + +Table 2-9 VLAN Configuration and Storage for VTPv1 and VTPv2 + + +Function + +Normal-range VLANs can be configured from +Extended-range VLANs can be configured from + +When in VTP Server Mode + +Both VLAN database and configuration modes +Nowhere—cannot be configured + +When in VTP Transparent Mode +Both VLAN database and configuration modes +Configuration mode only + + + +VTP and normal-range VLAN vlan.dat in Flash configuration commands are +stored in + +Both vlan.dat in Flash and running configuration + + + +Extended-range VLAN configuration commands are stored in + +Nowhere—extended range Running configuration only not allowed in VTP server +mode + + +1 When a switch reloads, if the VTP mode or domain name in the vlan.dat file and the startup config file differs, the switch uses only the vlan.dat file’s contents for VLAN configuration. +8 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 3 + +Table 3-2 Three Major 802.1D STP Process Steps + + +Major Step +Elect the root switch + + +Determine each switch’s Root Port + +Determine the Designated Port for each segment + +Description +The switch with the lowest bridge ID; the standard bridge ID is 2-byte priority followed by a MAC address unique to that switch. +The one port on each nonroot switch that receives the superior resulting BPDU from among all received BPDUs on all its ports. +When multiple switches connect to the same segment, this is the switch that forwards the superior BPDU from among all forwarded BPDUs onto that segment. + + + + +Table 3-3 Default Port Costs + + +Port Speed +10 Mbps + +100 Mbps + +1 Gbps + +10 Gbps + +Pre-802.1D-1998 Cost +100 + +10 + +1 + +1 + +802.1D-1998 Cost +100 + +19 + +4 + +2 + +802.1D-2004 Cost +2000000 + +200000 + +20000 + +2000 + + + + +Table 3-4 IEEE 802.1D Spanning Tree Interface States + + +State + +Blocking + +Listening + +Learning + +Forwarding + +Disabled + +Forwards Data Frames? +No + +No + +No + +Yes + +No + +Learns Source MACs of Received Frames? +No + +No + +Yes + +Yes + +No + +Transitory or Stable State? +Stable + +Transitory + +Transitory + +Stable + +Stable +Appendix F: Solutions for Key Tables for CCIE Study 9 + +Table 3-5 RSTP and STP Port States + + +Administrative State +Disabled + +Enabled + +Enabled + +Enabled + +Enabled + +STP State (802.1D) +Disabled + +Blocking + +Listening + +Learning + +Forwarding + +RSTP State (802.1w) +Discarding + +Discarding + +Discarding + +Learning + +Forwarding + + + + +Table 3-6 RSTP Port Roles + + +RSTP Role +Root Port + +Designated Port + +Alternate Port + + + + + + +Backup Port + +Definition +Same as 802.1D Root Port. + +Same as 802.1D Designated Port. + +A replacement Root Port. Alternate ports are ports receiving BPDUs from other switches but not meeting requirements to become Root or Designated. Such a port is attached to a neighboring switch and provides a possible alternate path toward the root. Upon the loss of the current Root Port, the Alternate Port receiving the best resulting BPDUs will be rapidly promoted to the role of Root Port and moved to the Forwarding state. +A replacement Designated Port. Backup ports are ports receiving BPDUs from the same switch but not meeting requirements to become Designated. Such a port is attached to the same link as another port on the same switch, but the other port is Designated for that segment. The +Backup Port is ready to take over if the DP fails; however, this takeover is not rapid. Rather, it is driven by timers. + + + + +Table 3-9 Types of STP Inconsistencies and Their Causes + + +Inconsistency Type +Type + +(*TYPE_Inc) + +Port VLAN ID + +(*PVID_Inc) + +PVST Simulation + +(*PVST_Inc) + +Description and Probable Cause of Inconsistency +PVST+ BPDUs are received on a non-802.1Q port. Usually caused by interconnecting access and trunk ports. + +PVST+ BPDUs are received in a different VLAN than they were originated in. Usually caused by native VLAN mismatch on a trunk. +PVST+ BPDUs received on an MST boundary port do not meet the PVST Simulation consistency criteria. +10 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Inconsistency Type Loop +(*LOOP_Inc) + +Root + +(*ROOT_Inc) + + + +Bridge Assurance (*BA_Inc) + +Description and Probable Cause of Inconsistency +A Root or Alternate Port tried to become Designated after BPDUs stopped arriving. Seen only on Loop Guard–protected ports. +A port tried to become a Root Port after receiving superior BPDUs. Seen only on Root Guard–protected ports. Also, on older switches, this state was displayed in place of the PVST_ Inc state if PVST Simulation Inconsistency was encountered on a port. +A port stopped receiving BPDUs. Seen only on Bridge Assurance–protected ports. + + + + +Table 3-12 IEEE 802.1D STP Timers + + +Timer +Hello + +Forward Delay + +MaxAge + +Default +2 sec + +15 sec + +20 sec + +Purpose +Interval at which the root sends Configuration BPDUs + +Time that switch leaves a port in the Listening state and the Learning state; also used as the short CAM timeout timer +Time without hearing a Hello before expiring the stored BPDU + + + + +Chapter 4 + +Table 4-2 Classful Network Review + + +Class of Address + +A + +B + +C + +D + +E + +Size of Network and Host Parts of the Addresses +8/24 + +16/16 + +24/8 + +— + +— + +Range of First Octet Values + +1–126 + +128–191 + +192–223 + +224–239 + +240–255 + +Default Mask for Each Class of Network +255.0.0.0 + +255.255.0.0 + +255.255.255.0 + +— + +— + +Identifying Bits at Beginning of Address +0 + +10 + +110 + +1110 + +1111 +Appendix F: Solutions for Key Tables for CCIE Study 11 + +Table 4-3 Finding the Size of the Network, Subnet, and Host Fields in an IP Address + + +Name of Part of the Address +Network + +Subnet + +Host + +Process to Find Its Size + +8, 16, or 24 bits based on class rules + +32 minus network and host bits + +Equal to the number of binary 0s in the mask + +Size per Figure 4-1 Example +16 + +8 + +8 + + + + +Table 4-4 Binary Math to Calculate the Subnet Number and Broadcast Address + + +Address + +Mask + +Subnet Number (Result of AND) +Broadcast + +172.31.103.41 + +255.255.255.0 + +172.31.103.0 + +172.31.103.255 + + +1010 1100 0001 1111 0110 0111 0010 1001 + +1111 1111 1111 1111 1111 1111 0000 0000 + +1010 1100 0001 1111 0110 0111 0000 0000 + +1010 1100 0001 1111 0110 0111 1111 1111 + + + + +Table 4-5 Quick Math to Find the Subnet Number—172.31.103.41, 255.255.252.0 + +Octet Comments + + + +Address + +Mask + +Subnet number results after Steps 1 and 2 + +1 2 3 172 31 103 +255 255 252 + +172 31 + +4 41 +0 Equivalent to /22. + +0 Magic number will be 256 – 252 = 4. + + + +Subnet number after 172 31 completing the interesting octet + +100 0 100 is the multiple of 4 closest to, but not exceeding, 103. + + + + +Table 4-6 Quick Math to Find the Broadcast Address—172.31.103.41, 255.255.252.0 + +Octet Comments + + + +Subnet number (per Step 1) + +Mask (for reference) + +1 2 3 4 172 31 100 0 +255 255 252 0 Equivalent to /22 + + + +Results after Steps 1 to 4 172 31 + +Subnet number after 172 31 completing the empty octet + +255 Magic number will be 256 – 252 = 4 + +103 255 Subnet’s third octet (100), plus magic number (4), minus 1 is 103 +12 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 4-7 Binary Method to Find All Subnets—Steps 1 Through 4 + +Octet + + +Subnet +Network number/zero subnet + +2nd subnet + +3rd subnet + +4th subnet + +5th subnet + +6th subnet + +7th subnet + +8th subnet (2y = 8); broadcast subnet + +1 10101100 +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +2 +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +000 11111 + +3 +000 00000 + +00000 + +00000 + +00000 + +00000 + +00000 + +00000 + +00000 + +4 00000000 +00000000 + +00000000 + +00000000 + +00000000 + +00000000 + +00000000 + +00000000 + + + + +Table 4-8 Binary Method to Find All Subnets—Step 5 + +Octet + + +Subnet +Network number/zero subnet + +2nd subnet + +3rd subnet + +4th subnet + +5th subnet + +6th subnet + +7th subnet + +1 10101100 +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +10101100 + +2 00011111 +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +00011111 + +3 4 +000 00000 00000000 + +001 00000 00000000 + +010 00000 00000000 + +011 00000 00000000 + +100 00000 00000000 + +101 00000 00000000 + +110 00000 00000000 + + +8th subnet (2y = 8); broadcast subnet 10101100 00011111 111 00000 00000000 +Appendix F: Solutions for Key Tables for CCIE Study 13 + +Table 4-10 Example of Finding the Best Inclusive Summary—Binary + +Octet 1 Octet 2 Octet 3 Octet 4 + +172.31.20.0/24 + +172.31.21.0/24 + +172.31.22.0/24 + +172.31.23.0/24 + +Prefix length: 22 + +Inclusive summary + +10101100 + +10101100 + +10101100 + +10101100 + + +10101100 + +00011111 + +00011111 + +00011111 + +00011111 + + +00011111 + +000101 00 + +000101 01 + +000101 10 + +000101 11 + + +000101 00 + +00000000 + +00000000 + +00000000 + +00000000 + + +00000000 + + + + +Table 4-12 RFC 1918 Private Address Space + + +Range of IP Addresses +10.0.0.0 to 10.255.255.255 + +172.16.0.0 to 172.31.255.255 + +192.168.0.0 to 192.168.255.255 + +Class of Networks +A + +B + +C + +Number of Networks +1 + +16 + +256 + + + + + +Table 4-13 + +Name + + +NAT Terminology + +Location of Host Represented by Address + + + +IP Address Space in Which Address Exists + + + +Inside Local address + +Inside Global address + +Outside Local address +Outside Global address + +Inside the enterprise network + +Inside the enterprise network + +In the public Internet; or, outside the enterprise network +In the public Internet; or, outside the enterprise network + +Part of the enterprise IP address space; typically a private IP address +Part of the public IP address space + +Part of the enterprise IP address space; typically a private IP address +Part of the public IP address space + + + + + +Table 4-16 + +Command + + +Command Reference for Chapter 4 + +Description + + + +ip address ip-address mask [secondary] + +ip nat {inside | outside} + +Interface subcommand to assign an IPv4 address +Interface subcommand; identifies inside or outside part of network +14 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +ip nat inside source {list {access-list-number | access-list-name} | route-map name} {interface type number | pool pool-name} [overload] + +ip nat inside destination list {access-list-number | name} pool name + +ip nat outside source {list {access-list-number | access-list-name} | route-map name} pool pool-name [add-route] + +ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length } +[type rotary] + +show ip nat statistics + + +show ip nat translations [verbose] + +clear ip nat translation {* | [inside global-ip local-ip] [outside local-ip global-ip ]} + +debug ip nat + +show ip interface [type number ] [brief] + +Description +Global command that defines the set of inside addresses for which NAT will be performed, and corresponding outside addresses + +Global command used with destination NAT + +Global command used with both destination and dynamic NAT + +Global command to create a pool of addresses for dynamic NAT + +Lists counters for packets and for NAT table entries, as well as basic configuration information +Displays the NAT table + +Clears all or some of the dynamic entries in the NAT table, depending on which parameters are used +Issues log messages describing each packet whose IP address is translated with NAT +Lists information about IPv4 on interfaces + + + + + +Table 4-17 + +Field +Version + + +IP Header Fields + +Meaning +Version of the IP protocol. Most networks use IPv4 today, with IPv6 becoming more popular. The header format reflects IPv4. + + + +Header Length + + + +DS Field + +Defines the length of the IP header, including optional fields. Because the length of the IP header must always be a multiple of 4, the IP header length (IHL) is multiplied by 4 to give the actual number of bytes. +Differentiated Services Field. This byte was originally called the Type of Service (ToS) byte, but was redefined by RFC 2474 as the DS Field. It is used for marking packets for the purpose of applying different quality of service (QoS) levels to different packets. +Appendix F: Solutions for Key Tables for CCIE Study 15 + + + +Field +Packet Length + +Identification + + + +Flags + +Fragment Offset + +Time to Live (TTL) + + +Protocol + + +Header Checksum + + +Source IP Address + +Destination IP Address + +Optional Header Fields and Padding + +Meaning +Identifies the entire length of the IP packet, including the data. +Used by the IP packet fragmentation process. If a single packet is fragmented into multiple packets, all fragments of the original packet contain the same identifier so that the original packet can be reassembled. +3 bits used by the IP packet fragmentation process. + +A number set in a fragment of a larger packet that identifies the fragment’s location in the larger original packet. +A value used to prevent routing loops. Routers decrement this field by 1 each time the packet is forwarded; when it decrements to 0, the packet is discarded. +A field that identifies the contents of the data portion of the IP packet. For example, protocol 6 implies that a TCP header is the first thing in the IP packet data field. +A value used to store a frame check sequence (FCS) value, whose purpose is to determine whether any bit errors occurred in the IP header (not the data) during transmission. +The 32-bit IP address of the sender of the packet. + +The 32-bit IP address of the intended recipient of the packet. + +IP supports additional header fields for future expansion through optional headers. Also, if these optional headers do not use a multiple of 4 bytes, padding bytes are added, +composed of all binary 0s, so that the header is a multiple of 4 bytes in length. + + + + +Table 4-18 IP Protocol Field Values + + +Protocol Name +ICMP + +TCP + +UDP + +EIGRP + +OSPF + +PIM + +Protocol Number +1 + +6 + +17 + +88 + +89 + +103 +16 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + +Table 4-19 + +Field +Version + + +IPv6 Header Fields + +Meaning +4 bits. IPv6 version number. + + + +Traffic Class + +Flow Label + +Payload Length + +Next Header + + +Hop Limit + + + + +Source Address + +Destination Address + +8 bits. Internet traffic priority delivery value. + +20 bits. Used for specifying special router handling from the source to the destination(s) for a sequence of packets. +16 bits. Specifies the length of the data in the packet. When cleared to 0, the option is a hop-by-hop Jumbo payload. +8 bits. Specifies the next encapsulated protocol. The values are compatible with those specified for the IPv4 protocol field. +8 bits. For each router that forwards the packet, the hop limit is decremented by 1. When the hop limit field reaches 0, the packet is discarded. This replaces the TTL field in the IPv4 header that was originally intended to be used as a time-based hop limit. +16 bytes. The IPv6 address of the sending node. + +16 bytes. The IPv6 address of the destination node. + + + + +Chapter 5 + +Table 5-2 Comparing RARP, BOOTP, and DHCP + +Feature RARP BOOTP DHCP +Relies on server to allocate IP addresses Yes Yes Yes + +Encapsulates messages inside IP and UDP so that they can be No Yes Yes forwarded to a remote server +Client can discover its own mask, gateway, DNS, and No Yes Yes download server +Dynamic address assignment from a pool of IP addresses, No No Yes without requiring knowledge of client MACs +Allows temporary lease of IP address No No Yes + +Includes extensions for registering client’s FQDN with a DNS No No Yes +Appendix F: Solutions for Key Tables for CCIE Study 17 + +Table 5-3 SNMP Version Summaries + + +SNMP Version +1 + +2 + +2c + +3 + +Description +Uses SMIv1, simple authentication with communities, but used MIB-I originally. +Uses SMIv2, removed requirement for communities, added GetBulk and Inform messages, but began with MIB-II originally. +Pseudo-release (RFC 1905) that allowed SNMPv1-style communities with SNMPv2; otherwise, equivalent to SNMPv2. +Mostly identical to SNMPv2, but adds significantly better security, although it supports communities for backward compatibility. Uses MIB-II. + + + + +Table 5-4 SNMP Protocol Messages (RFCs 1157 and 1905) + + +Message Initial Response Version Message + +Typically Main Purpose Sent By + + + +Get 1 + +GetNext 1 + +GetBulk 2 + + + +Response 1 + +Set 1 + + +Trap 1 + + + +Inform 2 + +Response + +Response + +Response + + + +None + +Response + + +None + + + +Response + +Manager + +Manager + +Manager + + + +Agent + +Manager + + +Agent + + + +Manager + +A request for a single variable’s value. + +A request for the next single MIB leaf variable in the MIB tree. +A request for multiple consecutive MIB variables with one request. Useful for getting complex structures, for example, an IP routing table. +Used to respond with the information in Get and Set requests. +Sent by a manager to an agent to tell the agent to set a variable to a particular value. The agent replies with a Response message. +Allows agents to send unsolicited information to an SNMP manager. The manager does not reply with any SNMP message. +A message used between SNMP managers to allow MIB data to be exchanged. +18 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 5-6 Command Reference for Chapter 5 + + +Command +ip dhcp pool name + +default-router address [address2... address8] + +dns-server address [address2... address8 ] + +lease {days [hours][minutes] | infinite} + +network network-number [mask | prefix-length] + +ip dhcp excluded-address [low-address high-address] + +host address [mask | prefix-length] + + +hardware-address hardware-address type + +show ip dhcp binding [ip-address] + +show ip dhcp server statistics + +standby [group-number ] ip [ip-address [secondary]] + +track object-number interface type-number {line-protocol | ip routing} + +standby [group-number ] preempt [delay +{minimum delay | reload delay | sync delay}] + +show track [object-number [brief] | interface [ brief] | ip route [brief] | resolution | timers ] + +standby [group-number ] priority priority + +standby [group-number ] timers [msec] hellotime [msec] holdtime + +standby [group-number ] track object-number + + +show standby [type number [group]] [brief | all] + +Description +Creates DHCP pool. + +DHCP pool subcommand to list the gateways. +DHCP pool subcommand to list DNS servers. +DHCP pool subcommand to define the lease length. +DHCP pool subcommand to define IP addresses that can be assigned. + +Global command to disallow these addresses from being assigned. + +DHCP pool subcommand, used with hardware-address or client-identifier , to predefine a single host’s IP address. +DHCP pool subcommand to define MAC address; works with the host command. +Lists addresses allocated by DHCP. + +Lists stats for DHCP server operations. + +Interface subcommand to enable an HSRP group and define the virtual IP address. + +Configures a tracking object that can be used by HSRP, VRRP, or GLBP to track the status of an interface. +Interface subcommand to enable pre-emption and set delay timers. + +Displays status of tracked objects. + +Interface subcommand to set the HSRP group priority for this router. +Interface subcommand to set HSRP group timers. + +Interface subcommand to enable HSRP to track defined objects, usually for the purpose of switching active routers on an event related to that object. +Lists HSRP statistics. +Appendix F: Solutions for Key Tables for CCIE Study 19 + + + +Command +ntp peer ip-address [version number ] [key keyid] [source interface ] [prefer] + +ntp server ip-address [version number ] [key keyid] [source interface ] [prefer] + +ntp broadcast [version number] + +ntp broadcast client + +ntp master [stratum] + +show ntp associations + +show ntp status + +logging trap level + + + + +logging host {{ip-address | hostname } | +{ipv6 ipv6-address | hostname }} [transport {udp [port port-number] | tcp [port port-number]}] [alarm [severity]] + +ip wccp {web-cache | service-number} +[service-list service-access-list] [mode {open | closed}] [group-address multicast-address ] [redirect-list access-list] [group-list access-list] [password [0-7 ] password ] + +ip wccp {web-cache | service-number} redirect {in | out} + +show ip wccp + +snmp-server enable traps + +snmp-server host {hostname | ip-address} [vrf vrf-name ] [traps | informs] [version {1 | 2c | 3 [auth | noauth | priv]}] community-string [udp-port port] [notification-type] + +Description +Global command to enable symmetric active mode NTP. + +Global command to enable static client mode NTP. + +Interface subcommand on an NTP server to cause NTP broadcasts on the interface. +Interface subcommand on an NTP client to cause it to listen for NTP broadcasts. +Global command to enable NTP server. + +Lists associations with other NTP servers and clients. +Displays synchronization status, stratum level, and other basic information. +Sets the severity level for syslog messages; arguments are 0–7, where 0=emergencies, 1=alerts, 2=critical, 3=errors, 4=warnings, 5=notifications, 6=informational, 7=debugging (default). +Configures the IP or IPv6 address or host name to which to send syslog messages and permits setting the transport protocol and port number. + +Enables WCCP and configures filtering and service parameters. + + + +Interface configuration command to enable WCCP and configure it for outbound or inbound service. +Displays WCCP configuration settings and statistics. +Enables sending of all types of traps available on the router or switch. +Configures the SNMP server to send traps or informs to a particular host, along with options for setting the SNMP version for traps and the UDP port (default is 162). The notification-type field specifies the types of traps to send; if no types are specified, all available categories of traps will be sent. +20 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Command +snmp-server community string [view view-name] [ro | rw ] [access-list-number] + + +show snmp mib ifmib ifindex interface-id + + +ip sla monitor operation-index + +Description +Sets the read-only or read-write community string and access list for host filtering for access to SNMP reads and writes on the router or switch. +Shows the router’s interface ID for a particular interface. Particularly useful for RMON configuration. +Enters IP SLA monitor configuration mode for an individual monitor function. + +type [jitter | udp-echo | echo protocol Configures the IP SLA monitor type with icmpecho | dns | ftp operation | http options (not shown) including source and operation | mpls ping ipv4 | pathecho | destination IP address and source and pathjitter | tcpconnect | voip delay post-dial | destination port number, plus other relevant udp-jitter | udp-jitter codec] options to the particular type. + +ip sla key-chain key-chain-name + +ip sla monitor schedule operation-number [life {forever | seconds }] [start-time +{hh: mm[: ss] [month day | day month] | pending | now | after hh: mm :ss}] [ageout seconds ] [recurring] +ip sla monitor responder + + + +show ip sla monitor statistics [operation] detail + +show ip sla responder + + +ip ssh [timeout seconds | authentication-retries integer] +crypto key generate rsa + +transport input ssh + +ip http server + +ip http secure-server + +Configures a key chain for MD5 authentication of IP SLA operations. +Configures the schedule for a particular IP SLA monitor. If the IP SLA monitor is +deleted from the configuration, the schedule is also deleted. + +Enables the IP SLA responder function globally. More specific options for this command can be configured for specific responder types, ports, and so on. +Shows the statistics for a specified IP SLA operation or all configured IP SLA operations. +Shows currently configured IP SLA responders and recent activity (source IP address, and so on). +Sets SSH access crypto key. + +Generates RSA keys. Required for SSH configuration. +In vty configuration mode, permits SSH connections. +Enables HTTP server. + +Enables HTTPS server. +Appendix F: Solutions for Key Tables for CCIE Study 21 + + + +Command +ip traffic-export profile profile-name + +ip traffic-export apply profile-name + +event manager applet applet-name [class class-options ] [trap] + +event cli pattern regular-expression +{[default] [enter] [questionmark ] [tab]} [sync {yes | no skip {yes | no}] [mode variable ] +[occurs num-occurrences ] [period period-value] [maxrun maxruntime-number ] +ip flow-top-talkers + +flow monitor flow-name + +flow exporter exporter-name + + +rmon event + + +rmon alarm + +Copy + +tftp-server flash [partition-number: ] filename1 [alias filename2 ] [access-list-number ] +aaa new-model + +aaa authentication + +aaa authorization + +ip scp server enable + +Description +Enables and enters configuration mode for a RITE profile. +Applies a RITE profile to an interface. + +Enters EEM applet configuration mode. + +Configures EEM to match a CLI command string. + + + +NetFlow aggregator. Aggregates traffic for unclassified top talkers. +Enters configuration mode for a NetFlow monitor. +Configures a NetFlow exporter and the destination server to which to send NetFlow information for a particular flow monitor. +Configures an RMON event to monitor a particular SNMP object, along with rising and falling thresholds. +Configures an alarm action for an RMON event’s rising or falling threshold. +With FTP option in the source or destination field, copies a file to or from an FTP server. +Configures a TFTP server on the router to serve a file, optionally with an alias, and optionally through an ACL. + +Enables AAA on the router. + +Configures AAA authentication methods. + +Configures AAA authorization methods. + +Enables the SCP server on the router. Requires AAA authentication and AAA authorization to be configured. +22 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 6 + +Table 6-2 Matching Logic and Load-Balancing Options for Each Switching Path + + +Switching Path + +Process switching + +Fast switching + +CEF + +Structures That Hold the Forwarding Information +Routing table + +Fast-switching cache (per flow route cache) +FIB tree and adjacency table + +Load-Balancing Method + +Per packet + +Per destination IP address + +Per a hash of the packet source and destination, or per packet + + + + +Chapter 7 + + +Table 7-2 + +Function + + +RIPv2 Feature Summary + +Description + + + +General characteristic +Transport protocol +Metric + +Hello interval + +Update destination +Update interval + +Full or partial updates + +Triggered updates +Authentication + +Route tags + +Next Hop field + +Classless, distance-vector, timer-driven routing protocol + +User Datagram Protocol (UDP), port 520 + +Hop count, with 15 as the maximum usable metric, and 16 considered to be infinite +None; RIPv2 relies on the regular full routing updates instead + +224.0.0.9 multicast for RIPv2 + +30 seconds + +Full updates each interval. For on-demand circuits, allows RIPv2 to send full updates once, and then remain silent until changes occur, per RFC 2091 +Yes, when routes change + +Allows both plain-text and MD5 authentication + +Allows RIPv2 to tag routes as they are redistributed into RIPv2 + +Supports the assignment of a next-hop IP address for a route, allowing a router to advertise a next-hop router that is different from itself +Appendix F: Solutions for Key Tables for CCIE Study 23 + + +Table 7-3 + +Function + + +RIPv2 Features Related to Convergence and Loop Prevention + +Description + + + +Counting to Infinity + + + + +Split Horizon + + +Split Horizon with Poisoned Reverse + +Route poisoning + + +Triggered update + + + + +Update timer + + +Invalid after timer + + + + + +Holddown timer + + + + + +Flushed after timer + +If the next hop to a particular destination network advertises that network with a suddenly increased metric, accept the advertisement immediately and update our metric accordingly. If the updated metric reaches infinity, stop using that next hop. +Instead of advertising all routes out a particular interface, RIPv2 omits the routes whose outgoing interface field matches the interface out which the update would be sent. +A stronger variant of Split Horizon: All routes whose outgoing interface matches the interface out which the update would be sent are advertised with an infinite metric. +The process of sending an infinite-metric (hop count 16) route in routing updates when that route fails, prompting its rapid removal from routing tables. +The immediate sending of a new update when routing information changes, instead of waiting for the Update timer to expire. Only the changed network is sent in the triggered update. Complete updates continue to be sent in regular intervals. +The timer that specifies the time interval over which updates are sent. Each interface uses an independent timer, defaulting to 30 seconds. +A per-route timer (default 180 seconds) that is reset and begins after an update about a route has been received from its next hop. If the updates about the route from its next hop cease to be received and the Invalid after timer reaches its limit, the route is declared invalid and the Holddown timer starts for this route. +A per-route timer (default 180 seconds) that begins after a route has been declared invalid (that is, after the Invalid +after timer expires). The router starts advertising that route as unreachable, does not accept any updated information, and does not modify the routing table entry for that route until the Holddown timer for that route expires. +A per-route timer (default 240 seconds) that is reset and begins after an update about a route has been received from its next hop. If the updates about the route from its next hop cease to be received and the Flushed after timer reaches its limit, the router removes the route from the routing table entirely. +24 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 7-4 RIPv2 Per-Interface Actions, and How to Disable Them When Enabled + + +RIPv2 Function +Sending RIPv2 updates + +Listening for RIPv2 updates + +Advertising the connected subnet + +How to Disable +Make the interface passive: configure router rip, followed by passive-interface type number +Filter all incoming routes using a distribute list, or filter incoming RIPv2 packets using a per-interface ACL +Filter outbound advertisements on other interfaces using distribute lists, filtering an interface’s connected subnet + + + + +Chapter 8 + + +Table 8-2 + +Feature +Transport + + +Metric + + +EIGRP Feature Summary + +Description +IP, protocol type 88 (does not use UDP or TCP). Implements its own Reliable Transport Protocol, providing reliable unicast and multicast packet delivery. +Based on constrained bandwidth and cumulative delay by default, and optionally load reliability, and extended metrics. + + + +Hello interval + +Hold timer + + +Update destination address +Full or partial updates + +Authentication + +VLSM/classless + +Route Tags + +Next-hop field + +Manual route summarization +Multiprotocol + +Interval at which a router sends EIGRP Hello messages on an interface. +Timer used to determine when a neighboring router has failed, based on a router not receiving any EIGRP messages, including Hellos, in this timer period. +Normally sent to 224.0.0.10, with retransmissions being sent to each neighbor’s unicast IP address. +Full updates are used when new neighbors are discovered; otherwise, partial updates are used. +Supports MD5 and SHA-based authentication. + +EIGRP includes the mask with each route, also allowing it to support discontiguous networks and VLSM. +Allows EIGRP to tag routes as they are redistributed into EIGRP. + +Supports the advertisement of routes with a different next-hop router than the advertising router. +Enables EIGRP to tag and filter internal and external routes using distribute-lists and route-maps. +Supports the advertisement of IPv4 and IPv6. Former implementations also supported IPX and AppleTalk routes. +Appendix F: Solutions for Key Tables for CCIE Study 25 + + +Table 8-4 + +Field +H + +Address + +Interface + +Hold + +Uptime + +SRTT + +RTO + + +Q Cnt + +Seq Num + + + + + +Table 8-6 + + +EIGRP Neighbor Table Columns + +Description +Internal reference to a neighbor, also called a neighbor handle, starting at 0. + +The IP address of the neighbor. + +The interface toward the neighbor. + +The Hold timer for the neighbor. If it decreases to 0, the neighbor is considered down. +Timer for how long the neighbor relationship has been up. + +This is the Smooth Round Trip Time, which is the time it takes to send a reliable EIGRP packet and receive an acknowledgment. +This is the Retransmission Time Out, which is the amount of time the router will wait between retransmitting an EIGRP reliable packet if an Ack is not received. +This is the number of EIGRP reliable packets sent and waiting to be sent to the neighbor but not acknowledged yet. +This is the sequence number of the last EIGRP reliable packet received from the neighbor. This is to ensure that packets from the neighbor are processed in the correct order. + + + +EIGRP Message Summary + + + +EIGRP Packet +Hello + +Ack + +Update + +Query + + +Reply + + +SIA-Query + + +SIA-Reply + +Purpose +Identifies neighbors, exchanges parameters, and is sent periodically as a keepalive function +Acknowledges Update, Query, Reply, SIA-Query, and SIA-Reply packets + +Informs neighbors about updated routing information + +Asks neighboring routers to update their routing tables in a coordinated fashion and respond with their actual distance after having their routing tables updated +Sent by neighbors to reply to a Query, informing the router about the actual neighbor’s distance to the destination after processing the information in the Query +Asks a particular neighbor whose Reply to a Query packet is outstanding for a prolonged time to confirm whether it is still working on this router’s Query +Sent by a neighbor as a response to an SIA-Query to ascertain its state +26 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Chapter 9 + + +Table 9-2 + +Message +Hello + + +OSPF Messages + +Description +Used to discover neighbors, bring a neighbor relationship to a 2-Way state, and monitor a neighbor’s continuous liveliness + + + +Database Description (DD or DBD) + +Link-State Request (LSR) + + +Link-State Update (LSU) + +Link-State Acknowledgment (LSAck) + +Used to exchange LSA headers during the initial topology exchange, so that a router knows a list of that neighbor’s LSAs including their versions +A packet that identifies one or more LSAs about which the sending router would like the neighbor to supply full details about the LSAs +A packet that contains fully detailed LSAs, sent in response to an LSR message or in the event of a topological change +Sent to confirm receipt of an LSU message + + + + +Table 9-3 OSPF Network Types + + +Interface Type Uses Default Hello Requires DR/BDR? Interval a neighbor +Command? + +More Than Two Hosts Allowed in the Subnet? + +Broadcast Yes 10 No Yes + +Point-to-point No 10 No No +1 + +Nonbroadcast 2 (NBMA) Yes 30 Yes Yes + +Point-to-multipoint No 30 No Yes + +Point-to-multipoint No 30 Yes Yes nonbroadcast +Loopback3 No – – No + +1 Default on Frame Relay point-to-point subinterfaces. + +2 Default on Frame Relay physical and multipoint subinterfaces. + +3 Cannot be configured manually—used on loopback interfaces automatically. +Appendix F: Solutions for Key Tables for CCIE Study 27 + +Table 9-4 OSPF LSA Types + +LSA Type Common Name Description + +1 Router + + +2 Network + + +3 Net Summary + + + +4 ASBR Summary + + +5 AS External + +One per router per area, listing the router’s RID and all interface IP addresses in that area. Represents stub +networks as well. Flooded only within its area of origin. + +One per transit network. Created by the DR on the subnet, and represents the subnet and the router interfaces con-nected to the subnet. Flooded only within its area of origin. +Created by ABRs to represent networks present in one area when being advertised into another area. Defines the subnets in the origin area, and cost, but no topology data. Flooded only within its area of origin; reoriginated on ABRs. +Like a type 3 LSA, except it advertises a host route used to reach an ASBR. Flooded only within its area of origin; reoriginated on ABRs. +Created by ASBRs for external routes injected into OSPF. Flooded to all regular areas. + +6 Group Membership Defined for MOSPF; not supported by Cisco IOS. + + +7 NSSA External + + +8 External Attributes + + +9–11 Opaque + +Created by ASBRs inside an NSSA, instead of a type 5 LSA. Flooded only within its area of origin; converted to type 5 LSA on an ABR toward other areas. +Created by ASBRs during BGP-to-OSPF redistribution to preserve BGP attributes of redistributed networks. Not implemented in Cisco routers. +Used as generic LSAs to allow for easy future extension of OSPF; for example, type 10 has been adapted for MPLS traffic engineering. These LSAs have different flooding scope: Type 9 has link-local flooding scope, type 10 has area-local flooding scope, type 11 has autonomous system flooding scope equivalent to the flooding scope of type 5 LSAs (not flooded into stubby areas and NSSAs). + + + + +Table 9-5 OSPF Stubby Area Types + +Area Type Stops Injection of Stops Injection Allows Creation of Type 4/5 LSAs? of Type 3 LSAs? Type 7 LSAs Inside +the Area? +Stubby Yes No No + +Totally stubby (TS) Yes Yes No + +Not-so-stubby area (NSSA) Yes No Yes + +Totally NSSA (NSSA-TS) Yes Yes Yes +28 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Table 9-6 Stub Area Configuration Options + + +Stub Type +NSSA + +Totally NSSA + +Stubby + +Totally stubby + +Router OSPF Subcommand +area area-id nssa + +area area-id nssa no-summary + +area area-id stub + +area area-id stub no-summary + + + + +Table 9-7 OSPF Authentication Types + + +Type Meaning + +0 None + +1 Clear text + +2 MD5 + +Enabling Interface Subcommand +ip ospf authentication null + +ip ospf authentication + +ip ospf authentication message-digest + +Authentication Key Configuration Interface Subcommand +— + +ip ospf authentication-key key-value + +ip ospf message-digest-key key-number md5 key-value + + + + +Table 9-8 Effect of the area authentication Command on OSPF Interface Authentication Settings + + +area authentication Command + + +area area-id authentication + +area area-id authentication message-digest + +Interfaces in That Area Default to Use +Type 0 + +Type 1 + +Type 2 + + + + +Table 9-9 Configuring OSPF Authentication on Virtual Links + +Type Command Syntax for Virtual Links +0 area area-id virtual-link router-id authentication null + +1 area area-id virtual-link router-id authentication authentication-key key-value + +2 area area-id virtual-link router-id authentication message-digest message-digest-key key-num md5 key-value +Appendix F: Solutions for Key Tables for CCIE Study 29 + +Table 9-10 OSPFv3 LSA Types + +LSA Type Common Name Description Flooding Scope + +1 Router LSA + +2 Network LSA + + +3 Inter-Area Prefix LSA + +4 Inter-Area Router LSA +5 Autonomous System External LSA + +Describes a router and its links to its neighboring objects within one area. +Generated by a DR to represent the multiaccess transit network and its connection to member routers. +Originated by ABRs to describe inter-area networks in other areas. +Originated by ABRs to advertise the existence of ASBRs in other areas. +Originated by an ASBR in a regular area to describe networks learned from other protocols (redistributed routes). + +Area + +Area + + +Area + +Area + +Autonomous System + +7 NSSA LSA Originated by an ASBR in an NSSA Area to describe networks learned from +other protocols (redistributed routes). + +8 Link LSA Advertises link-local address and Link prefix(es) of a router to all other +routers on the link, as well as option information. Sent only if more than one router is present on a link. +9 Intra-Area-Prefix LSA Performs one of two functions: Area + +■ Associates a list of IPv6 prefixes with a transit network by pointing to a Network LSA. + +■ Associates a list of IPv6 prefixes with a router by pointing to a Router LSA. + + + +Table 9-15 OSPF Neighbor States + + +State +Down + +Attempt + +Init + +2-Way + +Meaning +No Hellos have been received from this neighbor for more than the dead interval. + +This router is sending Hellos to a manually configured neighbor. + +A Hello has been received from the neighbor, but it did not have the receiving router’s RID in it. +A Hello has been received from the neighbor, and it has the receiving router’s RID in it. This is a stable state for pairs of DROther neighbors. +30 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +State +ExStart + +Meaning +Currently negotiating the DD sequence numbers and master/slave logic used for DD packets. + +Exchange Finished negotiating and currently exchanging DD packets. + + +Loading + +Full + +All DD packets exchanged, and currently pulling the complete LSDB entries with LSU packets. +Neighbors are adjacent (fully adjacent), and should have identical LSDB entries for the area in which the link resides. Routing table calculations begin. + + + + +Chapter 10 + +Table 10-3 Adjacencies Between Routers + + +1st Neighbor’s Level +Level 1 only + +Level 1 only + +Level 1 only + +Level 1 + 2 + + +Level 1 + 2 + +Level 2 only + +2nd Neighbor’s Level +Level 1 only + +Level 1 + 2 + +Level 2 only + +Level 1 + 2 + + +Level 2 only + +Level 2 only + +Resulting Adjacency +Level 1 if area matches + +Level 1 if area matches + +No adjacency + +Level 1 if area matches + +Level 2 + +Level 2 + +Level 2 + + + + + +Table 10-7 + +Timer + + +IS-IS Timer Summary + +Meaning + +MaxAge, a.k.a. The maximum remaining lifetime of an LSP without receiving a newer RemainingLifetime copy of the LSP, before the LSP expires. Default is 1200 seconds. + +ZeroAgeLifetime + +Hello + +Hold + + +CSNP Interval + +The minimum time an LSP must be retained in the link-state database after expiring or initiating an LSP purge. Default is 60 seconds. +Per interface; time interval between Hellos. Default is 10 seconds. Independent for L1 and L2 Hellos on broadcast interfaces. +Per interface; time interval in which a Hello should be received from a neighbor. If not received, the neighbor is considered to have failed. Default is three times Hello. +Per interface; defines the time interval between sending consecutive CSNP packets if the router is a DIS on that interface. Defaults to 10 seconds. +Appendix F: Solutions for Key Tables for CCIE Study 31 + +Table 10-8 IS Neighbor States + +State Meaning +Down The initial state. No IIHs have been received from the neighbor. + +Init IIHs have been received from the neighbor, but it is not certain that the neighbor is properly receiving this router’s IIH. +Up IIHs have been received from the neighbor, and it is certain that the neighbor is properly receiving this router’s IIH. + + + + +Table 10-9 OSI Terminology + +Term +System + + + +Meaning +Network node. + + + +End System (ES) + +Intermediate System (IS) + +Domain + +Circuit + +Local Circuit ID + +Extended Local Circuit ID + +Network Service Access Point (NSAP) + +Network Entity Title + + +Initial Domain Part (IDP) + + +Domain Specific Part (DSP) + + +Address Format ID (AFI) + +Initial Domain ID (IDI) + +High-Order Domain Specific Part (HO-DSP) + +End node; host. + +Intermediate node; router. + +Autonomous system. + +Interface; working interconnection to another host or a router. +Internal enumeration of circuits by a router, 1 octet. + +Internal enumeration of point-to-point circuits for three-way handshaking purpose, 4 octets. +Layer 3 address of a node. + +NSAP address in which the SEL octet is set to 0; identifies the node itself without addressing any particular network service. +High-order octets of an NSAP address identifying its format and the domain in which the node is located. +Low-order octets of an NSAP address identifying the area, individual host, and network service that is being addressed. +The most significant octet of NSAP address; identifies the format of the address. +A part of the NSAP address following the AFI identifying the domain. +A part of the NSAP address following the IDI (if any) identifying the internal partitioning of the domain. +32 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +Term System ID +NSAP Selector (NSEL, SEL) + +Sub Network Point of Attachment (SNPA) +Designated IS (DIS) + +Network Layer Protocol ID (NLPID) + +Meaning +Identifier of the network node, 6 octets. + +Identifier of the network service on the node, 1 octet. +Layer 2 address relevant to an interface (if any). + +Designated router on a broadcast segment. + +Supported Layer 3 protocol (address family) on a router. + + + + +Chapter 11 + +Table 11-2 match Command Options for IGP Redistribution + + +match Command + +match interface interface-type interface-number [... interface-type interface-number ] + +*match ip address {[access-list-number | access-list-name] | prefix-list prefix-list-name} + +*match ip next-hop {access-list-number | access-list-name} + +*match ip route-source {access-list-number | access-list-name} + +match metric metric-value [+ – deviation ] + +Description +Looks at outgoing interface of routes + +Examines route prefix and prefix length + + +Examines route’s next-hop address + +Matches advertising router’s IP address + +Matches route’s metric exactly, or optionally a range of metrics (plus/minus the configured deviation) + +match route-type {internal | external [type-1 Matches route type | type-2] | level-1 | level-2 } +match tag tag-value [...tag-value] Tag must have been set earlier + +*Can reference multiple numbered and named ACLs on a single command. +Appendix F: Solutions for Key Tables for CCIE Study 33 + +Table 11-3 set Command Options for IGP Redistribution + +set Command Description +set level {level-1 | level-2 | level-1-2 | stub-area Defines database(s) into which the route is | backbone} redistributed + +set metric metric-value + +set metric bandwidth delay reliability loading mtu +set metric-type {internal | external | type-1 | type-2 } + +set tag tag-value + +Sets the route’s metric for OSPF, RIP, and IS-IS +Sets the IGRP/EIGRP route’s metric values + +Sets the type of route for IS-IS and OSPF + +Sets the unitless tag value in the route + + + + +Table 11-4 LE and GE Parameters on IP Prefix List, and the Implied Range of Prefix Lengths + + +Prefix List Parameters +Neither + +Only le + +Only ge + +Both ge and le + +Range of Prefix Lengths +conf-length = route-length + +conf-length <= route-length <= le-value + +ge-value <= route-length <= 32 + +ge-value <= route-length <= le-value + + + + +Table 11-5 Example Prefix Lists Applied to the List of Routes + + +prefix-list Command Parameters + +Routes Results Matched + + + +10.0.0.0/8 1 + +10.128.0.0/9 2 + + +10.0.0.0/8 ge 9 2–6 + + +10.0.0.0/8 ge 24 le 24 3, 4 + + +Without ge or le configured, both the prefix (10.0.0.0) and length (8) must be an exact match. +Without ge or le configured, the prefix (10.128.0.0) and length (9) must be an exact match; only the second route in the list is matched by this prefix list. +The 10.0.0.0/8 means “all routes whose first octet is 10,” effectively representing an address range. The prefix length must be between 9 and 32, inclusive. +The 10.0.0.0/8 means “all routes whose first octet is 10,” and the prefix range is 24 to 24—meaning only routes with prefix length 24. +34 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + + + +prefix-list Command Parameters + +Routes Results Matched + + + +10.0.0.0/8 le 28 + +0.0.0.0/0 + + + +0.0.0.0/0 le 32 + +1–4 The prefix length needs to be between 8 and 28, inclusive. +None 0.0.0.0/0 means “match all prefixes, with prefix length of exactly 0.” So, it would match all routes’ prefixes but none of their prefix lengths. Only a default route would match this prefix list. +All The range implied by 0.0.0.0/0 is all IPv4 addresses. The le 32 then implies any prefix length between 0 and 32, inclusive. This is the syntax for “match all” prefix list logic. + + + + +Table 11-6 Administrative Distances + + +Route Type +Connected + +Static + +EIGRP summary route + +EBGP + +EIGRP (internal) + +IGRP + +OSPF + +IS-IS + +RIP + +EIGRP (external) + +iBGP + +Unreachable + +Administrative Distance +0 + +1 + +5 + +20 + +90 + +100 + +110 + +115 + +120 + +170 + +200 + +255 +Appendix F: Solutions for Key Tables for CCIE Study 35 + +Table 11-7 Default Metrics and Route Metric Types in IGP Route Redistribution + + +IGP into Which Routes Are Redistributed +RIP + +EIGRP + +OSPF + +IS-IS + +Default Metric + +None + +None + +20/1* + +0 + +Default (and Possible) Metric Types +RIP has no concept of external routes + +External + +E2 (E1 or E2) + +L1 (L1, L2, L1/L2, or external) + + +* OSPF uses cost 20 when redistributing from an IGP, and cost 1 when redistributing from BGP. + + + +Table 11-8 + +IGP +RIP + +EIGRP + +OSPF + +IS-IS + + +IGP Order of Precedence for Choosing Routes Before Considering the Metric + +Order of Precedence of Metric +No other considerations + +Internal, then external + +Intra-area, inter-area, E1, then E2* + +L1, L2, external + + +* For E2 routes whose metric ties, OSPF also checks the cost to the advertising ASBR. + + +Table 11-9 OSPF Route Summarization Commands + + +Where Used +ASBR + +ABR + +Command + +summary-address {{ip-address mask} | {prefix mask }} [not-advertise] [tag tag ] + +area area-id range ip-address mask [advertise | not-advertise] [cost cost] + + + + +Table 11-10 Four Methods for Learning Default Routes + +Feature RIP EIGRP OSPF +Static route to 0.0.0.0, with the redistribute static command Yes Yes No + +The default-information originate command Yes No Yes + +The ip default-network command Yes Yes No + +Using summary routes No Yes No +Appendix G Study Planner + +Reading Task + + + +Element Task Goal Date First Date Completed + +Second Date Completed (Optional) + + + +Introduction + +1) Ethernet Basics + +1) Ethernet Basics + +2) Virtual LANs and VLAN Trunking + +2) Virtual LANs and VLAN Trunking + +3) Spanning Tree Protocol + +3) Spanning Tree Protocol + + +Part I Review + + + +4) IP Addressing + +4) IP Addressing + +5) IP Services + +5) IP Services + + +Part II Review + + + +6) IP Forwarding (Routing) + +6) IP Forwarding (Routing) + +7) RIPv2 and RIPng + +7) RIPv2 and RIPng + +8) EIGRP + +8) EIGRP + +9) OSPF + +9) OSPF + +10) IS-IS + +10) IS-IS + +Read Introduction + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for chapters 1-3 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Take practice test in study mode using Exam Bank #1 questions for chapters 4-5 in practice test software + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks + +Read Foundation Topics + +Do Exam Prep Tasks +11) IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting +11) IGP Route Redistribution, Route Summarization, Default Routing, and Troubleshooting + + +Part III Review + + + +12) Final Review + + +12) Final Review + +12) Final Review + +12) Final Review + + +12) Final Review + + +Read Foundation Topics + + +Do Exam Prep Tasks + + +Take practice test in study mode using Exam Bank #1 questions for chapters 6-11 in practice test software + +Take practice test in study mode for all Book Questions in practice test software +Reivew all Key Topics in all chapters +Complete all memory tables from appendix E +Practice CLI Skills + +Take practice test in practice exam mode using Exam Bank #2 questions for all chapters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +From the Library of Patriz Meulendijks +Glossary + + + + + + + + + + +Numerics + +224.0.0.5 + +224.0.0.6 routers. + + +The All OSPF Routers multicast IP address, listened for by all OSPF routers. + +The All OSPF DR Routers multicast IP address, listened for by DR and BDR + + +2-Way In OSPF, a neighbor state that signifies that the other router has reached the basic neighbor status, having passed the parameter and bidirectional visibility check. + +6to4 Tunnel An Internet transition mechanism for migrating from IPv4 to IPv6, a system that allows IPv6 packets to be transmitted over an IPv4 network (generally the IPv4 Internet) without the need to configure explicit tunnels by embedding the IPv4 tunnel endpoint address into the IPv6 address of hosts behind that endpoint. +802.1Q The IEEE standardized protocol for carrying VLAN membership information in Ethernet frames to implement VLAN trunking. + +802.1Q-in-Q A mechanism used to tag the original 802.1Q traffic with another 802.1Q tag, effectively allowing 802.1Q-tagged traffic to be enclosed into and carried within another VLAN. It allows a service provider to support transparent VLAN services with multiple cus-tomers, even if the customers use overlapping VLAN numbers. + +A +ABR See Area Border Router. + +Ack In TCP, one of header flags indicating that the Acknowledgment number in the TCP header is valid and shall be processed. In EIGRP, a packet type that is used to acknowledge reliable EIGRP packets, namely Update, Query, Reply, SIA-Query, and SIA-Reply. Acks do not require an Ack themselves. +active A state for a route in an EIGRP topology table that indicates that the router is ac-tively sending Query messages for this route, attempting to validate and/or learn the current best route to that subnet. +address family Addressing format as used by a particular routed protocol, and its particu-lar use in the device operation. For example, IPv4 unicast address family refers to the IPv4 addressing and the use of this addressing information to deliver unicast-addressed packets. +4 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Address Resolution Protocol Defined in RFC 826, a protocol used on LANs so that an IP host can discover the MAC address of another device that is using a particular IP address. + +adjacency Often used synonymously with neighbor, but with emphasis on the fact that all required parameters match, allowing routing updates to be exchanged between the routers. + +adjacency table A table used by CEF that holds preconstructed frame headers for each adjacent IP host to whom or through whom packets can be forwarded. + +adjacent Any OSPF neighbor for which the database synchronization process has com-pleted. + +AFI (Authority and Format Identifier) The first octet of an ISO OSI NSAP address indi-cating its format and structure. + +AFT (Address Family Translation) AFT involves the translation of an address from one IP address family to another. + +aggregate route Another term for summary route; however, aggregation is a term used often in relation to BGP, hinting at the possibility that the resulting aggregate route’s mask can be shorter than the natural classful mask, in effect aggregating multiple classful networks. +All OSPF DR Routers The multicast IP address 224.0.0.6, listened for by DR and BDR routers. + +All OSPF Routers The multicast IP address 224.0.0.5, listened for by all OSPF routers. + +Alternate role An 802.1w RSTP port role. An Alternate port is a possible replacement port for the Root Port. If the current Root Port fails, the Alternate port receiving the best resulting BPDUs will be promoted to the Root Port and moved to Forwarding state rapidly. +area In OSPF and IS-IS, a contiguous part of a network in which all member routers share the complete and detailed topology information. + +Area Border Router An OSPF router that connects to the backbone area and to one or more nonbackbone areas. + +ARP See Address Resolution Protocol. + +ASBR (Autonomous System Boundary Router) An OSPF router that redistributes routes from some other source into OSPF. + +ATTached bit A flag in an IS-IS Link State PDU indicating whether the originating router has a working connection to another area, that is, whether it can be used as a backbone router to reach other areas. +authentication With routing protocols, the process by which the router receiving a routing update determines whether the routing update came from a trusted router. + +autonegotiation Ethernet process by which devices attached to the same cable negotiate their speed and the duplex settings over the cable. +Glossary 5 + +B +backbone A part, or a subdomain, of a network that provides interconnection between different network areas. In OSPF, Area 0 serves as the backbone. In IS-IS, the backbone is the contiguous subdomain of the network consisting of Level-2-capable routers. +backbone area Area 0; the area that provides communication between other areas and to which all other OSPF areas must connect. + +Backup Designated Router (BDR) In OSPF, a router that is prepared to take over for the designated router. + +Backup role An 802.1w RSTP port role. A Backup Port is a possible replacement port for the Designated Port of the same switch on a common segment. If the current Designated Port fails, the Backup Port will be promoted to the Designated Port and moved to the Forwarding state gradually (the transition is not rapid; rather, it is driven by the forward_delay timer). +BDR See Backup Designated Router. + +Blocking state An 802.1D STP port state in which the port does not send or receive frames or learn MAC addresses, except for listening for received Hello BPDUs. + +BOOTP (Boot Protocol) A standard (RFC 951) protocol, a predecessor to DHCP, by +which a LAN-attached host can dynamically broadcast a request for a server to assign it an IP address, along with other configuration settings, including a subnet mask and default gateway IP address. +BPDU Guard Cisco-proprietary STP feature in which a switch port monitors for STP BPDUs of any kind, err-disabling the port upon receipt of any BPDU. + +broadcast address An address describing all possible receivers on a LAN. On Ethernet, the broadcast MAC address is FF:FF:FF:FF:FF:FF. In IPv4, the broadcast address is an IP address in which all host bits are set to 1. +broadcast domain A set of all devices that receive broadcast frames originating from any device within the set. Devices in the same VLAN are in the same broadcast domain. + +broadcast subnet When subnetting a Class A, B, or C network, the subnet for which all subnet bits are binary 1. The broadcast address in this subnet is numerically equal to the broadcast address of the former unsubnetted Class A, B, or C network. + +C +CEF (Cisco Express Forwarding) An optimized Layer 3 forwarding path through a router or a multilayer switch. CEF optimizes routing table lookup by creating a special, eas-ily searched structure based on the contents of the IP routing table, and preconstructs frame headers for directly connected end hosts and next hops. The forwarding information is called the Forwarding Information Base (FIB), and the frame rewrite information is called the adja-cency table. +6 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +CIDR (Classless Inter-Domain Routing) Defined in RFCs 1517–1520, a scheme to help reduce Internet routing table sizes by removing the classful address semantics and adminis-tratively allocating large blocks of consecutive IP network numbers to ISPs for use in differ-ent global geographies. CIDR results in large blocks of networks that can be summarized, or aggregated, into single routes. +circuit ISO OSI term for an interface. + +CIST (Common and Internal Spanning Tree) A spanning tree in MST created by joining together the Common Spanning Tree interconnecting individual MST regions with the Internal Spanning Tree within each of these regions. +classful IP addressing A particular semantics of IP addresses in which ranges, also called classes, of IP addresses were defined by convention and each class was assigned an implicit, also called classful, network mask. When a network was allocated from a class to a customer, the entire network according to the classful mask was always allocated; there were no provi-sions to allocate a smaller or a larger subnet. +classless IP addressing A particular semantics of IP addresses in which addressing infor-mation is always accompanied by an explicitly specified mask (alternatively called a prefix length), and the former address classes including their implicit netmasks and related limita-tions are ignored. +community port With private VLANs, a switched port associated with a particular sec-ondary community VLAN. + +community VLAN With private VLANs, a secondary VLAN in which the ports can send and receive frames with each other, with promiscuous ports and with trunks, but not with ports in other secondary VLANs. +component route A term used in this book to refer to a route that is included in a larger summary route. + +control plane A conceptual component of a network device that is responsible for creating, updating, and exchanging information that controls the device operation over data flows. As an example, in IP routing, the control plane refers to the building of IP routing tables by IP routing protocols. +counting to infinity An intrinsic routing loop resolution property of distance-vector pro-tocols. If a next hop to a particular destination suddenly advertises an increased metric, rout-ers using this next hop will accept the advertisement immediately and update their metrics accordingly. In a routing loop, routers derive their metrics from each other in sequence, caus-ing the metric to increment with each update, eventually arriving at a maximum allowed value after which the routing protocol no longer accepts the advertisement, finally breaking the routing loop. +crossover cable Copper cable with RJ-45 connectors in which the transmit and receive pairs are swapped on one end of the cable, allowing the interconnection of devices whose own sockets are connected identically to each other. A light crossover cable version exchang-es pins 1,2 with pins 3,6. A full crossover cable also exchanges pins 4,5 with pins 7,8. +Glossary 7 + +CSMA/CD (Carrier Sense Multiple Access with Collision Detection) A media-access mechanism where devices ready to transmit data first check the channel for a carrier. If no carrier is sensed for a specific period of time, a device can transmit. If two devices transmit simultaneously, a collision occurs and is detected by all transmitting devices. This collision subsequently causes each device to stop the transmission and back off for a random period of time before attempting to retransmit the data. +CSNP (Complete Sequence Number PDU) An IS-IS packet type used in the link-state database synchronization procedure between routers. + +CST (Common Spanning Tree) A single instance of STP that is applied to multiple VLANs, typically when using the 802.1Q trunking standard. Particularly in MST, CST refers to the spanning tree that interconnects individual MST regions and provides interoperation with non-MST regions. + +D +data plane A conceptual component of a network device that performs the actual opera-tion over data flows. As an example, in IP routing, this term refers to the process of forward-ing packets through a router. +DD (Database Description) A type of OSPF packet used to exchange LSA headers dur-ing the initial topology exchange so that a router knows a list of its neighbor’s LSAs including their versions. Sometimes called DBD. +dead time/interval With OSPF, the timer used to determine when a neighboring router has failed, based on a router not receiving any OSPF messages, including Hellos, in this timer period. +default route A route that is used for forwarding packets when the packet does not match any more specific routes in the IP routing table. + +Designated Port With Spanning Tree Protocol, the single port on each LAN segment from which the best Hello BPDU is forwarded. + +DHCP (Dynamic Host Configuration Protocol) A standard (RFC 2131) protocol by which a host can dynamically broadcast a request for a server to assign to it an IP address, along with other configuration settings, including a subnet mask and default gateway IP address. DHCP provides a great deal of flexibility and functionality compared with RARP and BOOTP. +DHCPv6 A network protocol that is used for configuring IPv6 hosts with IP addresses, IP prefixes, and/or other configuration required to operate on an IPv6 network. + +Dijkstra Alternate name for the SPF algorithm, named for its inventor, Edsger W. Dijkstra. + +DIS (Designated Intermediate System) An IS-IS router role analogous to OSPF Designated Router. A DIS is responsible for representing a multiaccess network segment in the link-state database and assists in the link-state database synchronization of routers con-nected to the multiaccess segment. +8 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Disabled state An 802.1D STP port state in which the port has been administratively disabled. + +Discarding state An 802.1w RSTP port state in which the port is not forwarding or receiv-ing; covers 802.1D port states disabled, blocking, and listening. + +distance vector The underlying fundamental principle of a class of routing protocols, based on the fact that for a routed network to converge in a finite time, it is sufficient for each router to advertise just a list (a vector) of known networks and its own distance to each of them. +distribution list A Cisco IOS configuration tool for routing protocols by which routing updates can be filtered. + +domain ISO OSI term for autonomous system. + +DR (Designated Router) With PIM on a multiaccess network, the PIM router with the highest IP address on the subnet. PIM DR is responsible for acting on behalf of directly con-nected hosts with respect to the PIM-SM protocol (sends Joins and Prunes as the result of IGMP signaling, and performs the Register process for local multicast senders). With OSPF, the OSPF router that wins an election among all current neighbors. The DR is responsible for flooding on the subnet, and for creating and flooding the type 2 LSA for the subnet. +DR election The process by which neighboring OSPF routers examine their Hello messages and elect the DR. The decision is based on priority (highest), or RID (highest) if priority is a tie. + +DROther The term that describes a router that is neither the DR nor the BDR on a subnet that elects a DR and BDR. + +DSL (Digital Subscriber Line) A common Internet access service type for residential and business customers. + +DSP (Domain Specific Part) A specific portion of an ISO OSI NSAP address local to the domain, usually containing information about the internal structure of the domain, identifica-tion of a host, and a requested network service. +DTP (Dynamic Trunking Protocol) A Cisco-proprietary protocol used to dynamically negotiate whether the devices on an Ethernet segment want to form a trunk and, if so, which type (ISL or 802.1Q). +DUAL (Diffusing Update Algorithm) In EIGRP, DUAL is a finite state machine that decides how topology changes should be handled, when a diffusing computation should be started, and how its results should be processed. + +E +E1 route An OSPF external route for which internal OSPF cost is added to the cost of the route as it was redistributed into OSPF. + +E2 route An OSPF external route for which internal OSPF cost is not added to the cost of the route as it was redistributed into OSPF. +Glossary 9 + +EIGRP stub router A router that should not be used to forward packets between other routers. An EIGRP stub router does not propagate EIGRP-learned routes, responds to Queries in a limited way, and instructs other routers not to send it Query packets. +encapsulation The process of taking a datagram and adding layer-specific headers and optionally trailers to create a new datagram. + +encapsulation replication Form of a SPAN session that retains the original encapsulation of monitored frames including VLAN tags, if any. + +ERSPAN (Encapsulated Remote Switched Port ANalyzer) Technology for remote monitoring of switched ports, utilizing GRE tunnels to carry the monitored traffic across a routed network to a remote monitoring destination. +ES (End System) An ISO OSI term for an end host. + +external route From the perspective of one routing protocol, a route that was learned from a different source by using route redistribution. + + +F +fast switching An optimized Layer 3 forwarding path through a router. Fast switching optimizes routing table lookup by creating a special, easily searched table of known flows between hosts (essentially a route lookup cache). +FD (Feasible Distance) With EIGRP, the lowest known distance to a particular destination since the last time the destination transitioned from Active to Passive state, in other words, the historical minimum of the distance to that destination. +feasibility condition With EIGRP, a sufficient condition for loop freedom. If, for a particu-lar destination, a neighbor’s Reported Distance is strictly less than the destination’s Feasible Distance, the neighbor provides a loop-free path. +feasible successor With EIGRP, for a particular destination, any neighboring router that satisfies the feasibility condition and thus provides a loop-free path. + +FED (Forwarding Engine Driver) / FFM (Forwarding and Feature Manager) In IOS-XE, the Control plane and Data plane separation are provided through Forward and Feature Manager, or FFM. FFM provides a set of APIs to the Control plane processes. FFM programs the Data plane through the Forward Engine Driver, or FED, and maintains the forwarding state for the system. +FIB (Forwarding Information Base) In CEF, Forwarding Information Base is an optimized copy of the Routing Information Base organized for rapid lookups, either as a tree-based soft-ware structure in RAM in software routers or downloaded into TCAM on multilayer switches. +flash updates See triggered updates . + +flooding scope In OSPF, the part of a network into which a particular LSA type can be flooded. OSPFv2 uses two flooding scopes, area-local and autonomous system, with an added link-local scope for specific opaque LSA types. OSPFv3 uses link-local, area-local, and auton-omous system flooding scopes as part of its basic operation. +10 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Flushed after timer A per-route timer in RIP that is reinitialized each time an update about a route has been received from its next hop. If the next hop ceases to advertise the network and the Flushed after timer reaches its limit, the router flushes the route from the routing table. +Forward Delay timer An STP timer that dictates how long a port should stay in the listen-ing state and the learning state. + +Forwarding state An 802.1D STP port state in which the port sends and receives data frames. + +full duplex Ethernet feature in which a NIC or Ethernet port can both transmit and receive at the same instant in time. It can be used only when there is no possibility of collisions. Loopback circuitry on NICs is disabled to use full duplex. +full SPF calculation An SPF calculation as a result of changes inside the same area as a router, for which the SPF run must examine the full LSDB. + +full update A routing protocol feature by which the routing update includes the entire set of routes, even if some of or all the routes are unchanged. + +fully adjacent Any OSPF neighbor for which the database flooding process has completed. + + +G +gateway of last resort The notation in a Cisco IOS IP routing table that identifies the route used by that router as the default route. + +Get In the context of SNMP, the Get command is sent by an SNMP manager, to an agent, requesting the value of a single MIB variable identified in the request. The Get request identi-fies the exact variable whose value the manager wants to retrieve. Introduced in SNMPv1. +GetBulk In the context of SNMP, the GetBulk command is sent by an SNMP manager, to an agent, requesting the values of multiple variables. The GetBulk command allows retrieval of complex structures, like a routing table, with a single command, as well as easier MIB walking. +GetNext In the context of SNMP, the GetNext command is sent by an SNMP manager, to an agent, requesting the value of a single MIB variable. The GetNext request identifies a vari-able for which the manager wants the variable name and value of the next MIB leaf variable in sequence. +GLBP (Gateway Load Balancing Protocol) A Cisco-proprietary feature by which mul-tiple routers can provide interface IP address redundancy, as well as cause a set of clients to load-balance their traffic across multiple routers inside the GLBP group. +going active EIGRP jargon meaning that EIGRP has placed a route into active status. + +Goodbye An EIGRP message that is used by a router to notify its neighbors when the router is gracefully shutting down. +Glossary 11 + +graceful restart As defined in RFC 3623, graceful restart allows for uninterrupted for-warding in the event that an OSPF router’s OSPF routing process must restart. The router does this by first notifying the neighbor routers that the restart is about to occur; the neighbors must be RFC 3623 compliant, and the restart must occur within the defined grace period. +graceful shutdown A feature in routing protocols allowing a router to inform its neighbors about its impending deactivation. The neighbors can react to this indication immediately, instead of waiting for the Hold or Dead intervals to expire. + +H +half duplex Ethernet feature in which a NIC or Ethernet port can only transmit or receive at the same instant in time, but not both. Half duplex is required when a possibility of collisions exists. +Hello A periodic message used in several protocols to advertise a device’s presence on a network, discover neighbors, perform configuration parameter verification, establish adjacen-cies, and monitor neighbor liveliness. Protocols such as EIGRP, OSPF, IS-IS, PIM, and LDP use Hello signaling. +hello interval With some routing protocols, the time period between successive Hello messages. + +Hello timer An STP timer that dictates the interval at which the Root switch generates and sends Hello BPDUs. + +HO-DSP (High Order Domain Specific Part) A specific portion of an ISO OSI NSAP address local to the domain, usually containing information about the internal structure of the domain, such as area number, down to but not including the identification of a host and the requested network service. +Hold timer With EIGRP, the timer used to determine when a neighboring router has failed, based on a router not receiving any EIGRP messages, including Hellos, in this timer period. + +Holddown timer With RIP, a per-route timer (default 180 seconds) that begins when a route has not been advertised by its next hop for a period longer than the Invalid after timer. During the time the Holddown timer runs for a route, this route is advertised as unreachable, any updates regarding the route are ignored, and the routing table entry is not modified. +HSRP (Hot Standby Router Protocol) A Cisco-proprietary feature by which multiple routers can provide interface IP address redundancy so that hosts using the shared, virtual IP address as their default gateway can still reach the rest of a network even if one or more rout-ers fail. +12 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +I +I/G bit Individual/Group bit. The least significant bit in the most significant octet of an Ethernet MAC address. Its value implies that the address is a unicast MAC address (binary 0) or a group address (binary 1). Note that in Ethernet, individual octets are transmitted in reverse order of bits, starting with the least-significant bit. The I/G bit will therefore be the first bit of the MAC address a NIC will see. +IDI (Initial Domain Identifier) A specific portion of an ISO OSI NSAP address identifying the domain where the host resides. + +IDP (Initial Domain Part) A specific portion of an ISO OSI NSAP address comprising the AFI and IDI fields. + +IIH (IS-IS Hello) Hello packet used in IS-IS between routers. + +inferior BPDU Out of two BPDUs being compared, the one that is “worse,” that is, the one that contained a higher numerical value in the first field that broke the tie (the fields are compared in the sequence Root Bridge ID, Root Path Cost, Sending Bridge ID, and Sending Port ID). +Inform In the context of SNMP, the Inform command is sent by an SNMP manager to com-municate a set of variables, and their values, to another SNMP manager. The main purpose is to allow multiple managers to exchange MIB information, and work together, without requir-ing each manager to individually use Get commands to gather the data. +input event Any occurrence that could change a router’s EIGRP topology table, including a received Update or Query, change in interface metrics, a failed interface, or the loss of a neighbor. +Inside Global address A NAT term describing the IP address of a host located in the inside part of the network, as seen by hosts in the outside part of the network (inside host’s IP address after possible translation). +Inside Local address A NAT term describing the IP address of a host located in the inside part of the network, as seen by other hosts in the inside part of the network (inside host’s true IP address). +instance ID A field in OSPFv3 packet headers, allowing multiple independent instances of OSPFv3 to be run over a single link. + +internal router In OSPF and IS-IS, a router whose interfaces are all located in the same single area. + +Invalid after timer A per-route timer that is reset and begins after an update about a route has been received from its next hop. If the updates about the route from its next hop cease to be received and the Invalid after timer reaches its limit, the route is declared invalid and the Holddown timer starts for this route. +IP forwarding The process of forwarding packets through a router. Also called IP routing . + +IP prefix list A Cisco IOS configuration tool that can be used to match routing updates based on a base network address, a prefix, and a range of possible masks used inside the val-ues defined by the base network address and prefix. +Glossary 13 + +IP routing The process of forwarding packets through a router. Also called IP forwarding. + +IPv4 Version 4 of the IP protocol, which is the generally deployed version worldwide (at press time) and uses 32-bit IP addresses. + +IPv6 The latest version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet. IPv6 was developed by the Internet Engineering Task Force (IETF) to deal with the long-anticipated problem of IPv4 address exhaustion. +IS (Intermediate System) An ISO OSI term for a router. + +ISATAP (Intra-Site Automatic Tunnel Addressing Protocol) An IPv6 transition mecha-nism meant to transmit IPv6 packets between dual-stack nodes on top of an IPv4 network. + +ISH (Intermediate System Hello) A PDU sent from routers toward end hosts to provide gateway discovery function. + +ISL (Inter-Switch Link) Cisco-proprietary VLAN trunking protocol. + +isolated port With private VLANs, a switched port associated with a particular secondary isolated VLAN. + +isolated VLAN With private VLANs, a secondary VLAN in which the ports can send and receive frames only with trunks and promiscuous ports in the associated primary VLAN. + + +K +K-value In EIGRP, configurable integer constants used in the composite metric calculation formula. Different K values correspond to different metric components (K1 controls band-width, K2 controls bandwidth and load, K3 controls delay, K4 and K5 control reliability, and K6 controls extended metric components), allowing EIGRP to ignore or take into account individual metric components and modify their weight. + +L +LACP (Link Aggregation Control Protocol) Defined in IEEE 802.1AX, defines a messag-ing protocol used to negotiate the dynamic creation of PortChannels (EtherChannels) and to choose which ports can be placed into an EtherChannel. +Layer 2 protocol tunneling Additional feature related to 802.1Q-in-Q, allowing the tunnel-ing of Layer 2 control protocols such as CDP, STP, and VTP across a VLAN-based network. + +lead content engine The content engine in a WCCP cluster that determines how traffic will be distributed within the cluster. + +Learning state An 802.1D STP transitory port state in which the port does not send or receive frames, but does learn the source MAC addresses from incoming frames. + + +Level 1 routing + +Level 2 routing + + +In IS-IS, routing between hosts within the same area. + +In IS-IS, routing between hosts in different areas. +14 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +Level 2 subdomain A contiguous part of the network consisting of Level-2-capable rout-ers, allowing inter-area communication and thus forming the backbone. + +limiting query scope An effort to reduce the query scope with EIGRP, using route sum-marization or EIGRP stub routers. + +link-state routing protocol Any routing protocol that uses the concept of using the SPF algorithm with an LSDB to compute routes. + +Listening state An 802.1D STP transitory port state in which the port does not send or receive frames, and does not learn MAC addresses, but still sends and receives BPDUs to determine its role in the spanning-tree topology. +local computation An EIGRP router’s reaction to an input event, leading to the use of the current successor or a feasible successor without going active on a route. + +Loop Guard Protects against problems caused by unidirectional links between two switches. Watches for loss of received Hello BPDUs, in which case it transitions to a loop-inconsistent state instead of transitioning to a forwarding state. +loopback circuitry A feature of Ethernet NICs. When the NIC transmits an electrical signal, it “loops” the transmitted electrical current back onto the receive pair. By doing so, if another NIC transmits a frame at the same time, the NIC can detect the overlapping received electrical signals and sense that a collision has occurred. +LSA (Link State Advertisement) The OSPF data structure that describes topology infor-mation. + +LSA flooding The process of successive neighboring routers exchanging LSAs such that all routers have an identical LSDB for each area to which they are attached. + +LSA type A definition that determines the data structure and information implied by a par-ticular LSA. + +LSAck (Link-State Acknowledgment) A type of OSPF packet used to acknowledge LSU packets. + + +LSDB (link-state database) + +LSP (Label Switched Path) + + +The data structure used by OSPF routers to hold LSAs. + +The combination of MPLS labels and links over which a pack- + +et will be forwarded over an MPLS network, from the point of ingress to the MPLS network to the point of egress. +LSP (Link State PDU) In IS-IS, a packet type that carries topological, addressing, and possibly other information about the router that has originated it. LSPs and their contents are stored in LSDB and processed during SPF computation. +LSP fragmentation In IS-IS, a process of originating a Link State PDU in several fragments if its size exceeds the MTU of router’s interfaces. IS-IS LSPs can only be fragmented by their originating router. +LSRefresh Link-State Refresh. A timer that determines how often the originating router should reflood an LSA, even if no changes have occurred to the LSA. + +LSU (Link-State Update) A type of OSPF packet, used to communicate LSAs to another router. +Glossary 15 + +M +Maxage An OSPF timer that determines how long an LSA can remain in the LSDB without having heard a reflooded copy of the LSA. + +MaxAge timer An STP timer that dictates the maximum time until a BPDU stored on a port can expire. + +MD5 (Message Digest 5) A widely used cryptographic hash function producing 128-bit results, used to verify the integrity of transmitted data and provide authentication informa-tion while protecting the shared secret that was used to compute the authentication infor-mation. +metric With routing protocols, the measurement of favorability that determines which entry will be installed in a routing table if more than one router is advertising that exact net-work and mask. +MIB (Management Information Base) The definitions for a particular set of data vari-ables, with those definitions following the SMI specifications. See also SMI. + +MIB walk In SNMP, the process of a manager using successive GetNext and GetBulk commands to discover the exact MIB structure supported by an SNMP agent. The process involves the manager asking for each successive MIB leaf variable. +MIB-I The original standardized set of generic SNMP MIB variables, defined in RFC 1158. + +MIB-II The most recent standardized set of generic SNMP MIB variables, defined in RFC 1213 and updated in RFCs 2011 through 2013. + +MLS (Multilayer Switching) A process whereby a switch, when making a forwarding deci-sion, uses not only Layer 2 logic but also other OSI layer equivalents as well. + +monitor session The command used to initialize a SPAN or RSPAN session on a Catalyst switch. + +MST (Multiple Spanning Trees) Defined in IEEE 802.1s, a specification for multiple STP instances when using 802.1Q trunks. + +multicast address An address describing a group of receivers. On Ethernet, multicast MAC addresses have their first octet as an odd number. In IPv4, the range of multicast addresses is 224.0.0.0/4. In IPv6, the range of multicast addresses is FF00::/8. + +N +Named Mode A new style of EIGRP process configuration in which a process is identified by its verbal name, and all EIGRP-related configuration is contained within this named pro-cess section. +NAT (Network Address Translation) Defined in RFC 1631, a method of translating IP addresses in headers with the goal of allowing multiple hosts to share single public IP address-es, thereby reducing IPv4 public address depletion. +16 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +native VLAN The one VLAN on an 802.1Q trunk for which the endpoints do not add the +4-byte 802.1Q tag when transmitting frames in that VLAN, and to which they assign received frames without an 802.1Q tag. +neighbor With EIGRP, a router sharing the same primary subnet, with which Hellos are exchanged, parameters match, and with which routes can be exchanged. With OSPF, any other router, sharing a common data link, with which a router exchanges Hellos, and for which the parameters in the Hello pass the parameter-check process. +neighbor state A state variable kept by a router for each known neighbor or potential neighbor. + +NET (Network Entity Title) A specific type of ISO OSI NSAP address in which the Network Selector octet value is 0x00. NET is a complete address of a host without specifying any particular network service. +network type A characteristic of OSPF interfaces that determines whether a DR election is attempted, whether or not neighbors must be statically configured, and the default Hello and Dead timer settings. +Next Hop field With a routing update, or routing table entry, the portion of a route that defines the next router to which a packet should be sent to reach the destination subnet. With routing protocols, the Next Hop field can define a router other than the router sending the routing update. +NLPID (Network Layer Protocol ID) A field in the RFC 2427 header that is used as a Protocol Type field to identify the type of Layer 3 packet encapsulated inside a Frame Relay frame. Also a TLV type used by IS-IS to advertise the routed protocols supported on a router. +NSAP (Network Service Access Point) ISO OSI Layer 3 address format. + +NSSA (not-so-stubby area) A type of OSPF stub area that, unlike stub areas, can inject external routes using its own ASBR but does not receive external routes from the backbone area. +NTP (Network Time Protocol) An Internet standard (RFC 1305) that defines the messages and modes used for IP hosts to synchronize their time-of-day clocks. + +NTP client mode An NTP mode in which an NTP host adjusts its clock in relation to an NTP server’s clock. + +NTP server mode An NTP mode in which an NTP host does not adjust its clock, but in which it sends NTP messages to clients so that the clients can update their clocks based on the server’s clock. +NTP symmetric active mode An NTP mode in which two or more NTP servers mutually synchronize their clocks. +Glossary 17 + +O +offset list A Cisco IOS configuration tool for RIP and EIGRP for which the list matches routes in routing updates, and adds a defined value to the sent or received metric for the routes. The value added to the metric is the offset . +Outside Global address A NAT term describing the IP address of a host located in the outside part of the network, as seen by other hosts in the outside part of the network (outside host’s true IP address). +Outside Local address A NAT term describing the IP address of a host located in the out-side part of the network, as seen by hosts in the inside part of the network (outside host’s IP address after possible translation). +Overload bit A flag in an IS-IS Link State PDU. If set, it indicates that the router should not be considered as a transit router in the SPF calculation; only directly connected networks on that router shall be considered. +overloading Another term for Port Address Translation. + + +P +PAgP (Port Aggregation Protocol) A Cisco-proprietary messaging protocol used to negotiate the dynamic creation of EtherChannel bundles and to choose which ports can be placed into an EtherChannel bundle. +partial SPF calculation An SPF calculation for which a router does not need to run SPF for any LSAs inside its area, but instead runs a very simple algorithm for changes to LSAs out-side its own area. +partial update A routing protocol feature by which the routing update includes only routes that have changed rather than the entire set of routes. + +passive A state for a route in an EIGRP topology table that indicates that the router believes that the route is stable, and it is not currently looking for any new routes to that subnet. +PAT (Port Address Translation) A NAT term describing the process of multiplexing TCP and UDP flows, based on port numbers, to a small number of public IP addresses. Also called NAT overloading . +poison reverse Loop-prevention technique used in distance-vector routing protocols, the full name is Split Horizon with Poisoned Reverse. Under this technique, a network will be explicitly advertised as unreachable over the interface that is used to reach that network. +polarization In CEF load balancing, the undesirable effect of a path selection function producing the same result for all data flows that have already been load balanced, preventing these flows from ever being load balanced again. +policy routing Cisco IOS router feature by which a route map determines how to forward a packet, typically based on information in the packet other than the destination IP address. +18 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +PortFast Cisco-proprietary STP feature in which a switch port, known to not have a bridge or switch attached to it, transitions from the disabled to forwarding state without using any intermediate states. +PPPoE (Point-to-Point Protocol over Ethernet) An encapsulation protocol and related control protocol that allows creating and carrying PPP sessions over Ethernet. Very often used in DSL deployments. +prefix A numeric value between 0 and 32 for IPv4, or 0 and 128 for IPv6 (inclusive) that defines the number of beginning bits in an IP address for which all IP addresses in the same group have the same value. Alternative: The number of binary 1s beginning a subnet mask, written as a single decimal value, used as a more convenient form of representing the subnet mask. +prefix list A Cisco IOS configuration tool that can be used to match routing updates based on a base network address, a prefix, and a range of possible masks used inside the values defined by the base network address and prefix. +prefix suppression In OSPF, a feature that prevents prefixes on transit links from being advertised. + +priority In OSPF, an administrative setting, included in Hellos, that is the first criterion for electing a DR. The highest priority wins, with values from 1 to 255, with priority 0 meaning that a router cannot become DR or BDR. +private addresses RFC 1918–defined IPv4 network numbers that are not assigned as pub-lic IP address ranges, and are not routable on the Internet. Intended for use inside enterprise networks. +private VLAN A Cisco switch feature that allows separation of ports as if they were in separate VLANs, while allowing the use of a single IP subnet for all ports. + +process switching A Layer 3 forwarding path through a router that does not optimize the forwarding path through the router. + +promiscuous port With private VLANs, a port that can send and receive frames with all other ports in the private VLAN and associated secondary VLANs. + +proxy ARP A router feature used when a router sees an ARP request searching for an IP host’s MAC, when the router believes that the IP host could not be on that LAN because the host is in another subnet. If the router has a route to reach the subnet where the ARP- +determined host resides, the router replies to the ARP request with the router’s MAC address. + +pseudonode In OSPF and IS-IS, the concept of representing a multiaccess network as a standalone node (a pseudonode) in the link-state database. OSPF represents each multiaccess network by a corresponding type 2 LSA. IS-IS generates a standalone Link State PDU. +PSNP (Partial Sequence Number PDU) An IS-IS packet type used in the link-state data-base synchronization procedure between routers. + +PVST+ (Per-VLAN Spanning Tree Plus) A Cisco-proprietary STP implementation, cre-ated many years before IEEE 802.1s and 802.1w, that speeds convergence and allows for one STP instance for each VLAN. +Glossary 19 + +Q +quartet A set of four hex digits listed in an IPv6 address. Each quartet is separated by a colon. + +query An EIGRP message that is used to ask neighboring routers to verify their route to a particular subnet. Query messages require an Ack. + +query scope The characterization of how far EIGRP Query messages flow away from the router that first notices a failed route and goes active for a particular subnet. + + +R +RARP (Reverse ARP) A standard (RFC 903) protocol by which a LAN-attached host can dynamically broadcast a request for a server to assign it an IP address. See also ARP. + +RD (reported distance) In EIGRP, the metric (distance) of a route as reported by a neigh-boring router. + +RD (Route Distinguisher) A 64-bit extension to the BGP NLRI field, used by MPLS for the purpose of making MPLS VPN customer routes unique to BGP and its operation in spite of the possibility of overlapping IPv4 address spaces in different customer networks. +remote VLAN The destination VLAN for an RSPAN session. + +Reply An EIGRP message that is used by neighbors to reply to a query. Reply messages require an Ack. + +Response In the context of SNMP, the Response command is sent by an SNMP agent, back to a manager, in response to any of the three types of Get requests, or in response to a Set request. It is also used by a manager in response to a received Inform command from another SNMP manager. The Response holds the value(s) of the requested variables. +RIB (Routing Information Base) The basic, unoptimized routing table on a router that serves as a master copy of routing information used to build CEF FIB. RIB can also refer to internal routing tables maintained by individual routing protocols. Routes in these per- +protocol internal routing tables can be used in the routing protocol operation, and best routes can be offered to the router’s routing table manager. +RID (router ID) The 32-bit number used to represent a router in a particular protocol. OSPF, EIGRP, BGP, and LDP are examples of protocols that make use of router IDs. + +Root Guard Cisco-proprietary STP feature in which a switch port monitors for incoming superior Hellos, and reacts to a superior Hello by putting the port into the root-inconsistent blocking state to prevent any switch connected to that port from becoming root. +Root Port The single port on each nonroot switch upon which the best resulting Hello BPDU is received. + +route map A configuration tool in Cisco IOS that allows basic programming logic to be applied to a set of items. Often used for decisions about what routes to redistribute, and for setting particular characteristics of those routes—for example, metric values. +20 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +route poisoning The process of sending an infinite-metric route in routing updates when that route fails. + +route redistribution The process of taking routes known through one routing protocol and advertising those routes with another routing protocol. + +Route Tag field A field within a route entry in a routing update, used to associate a generic number with the route. It is used when passing routes between routing protocols, allowing an intermediate routing protocol to pass information about a route that is not natively defined to that intermediate routing protocol. Frequently used for identifying certain routes for filtering by a downstream routing process. +routed interface An interface on a Cisco IOS–based switch that is treated as if it were an interface on a router. + +RPVST+ (Rapid Per-VLAN Spanning Tree Plus) The combination of PVST+ and Rapid Spanning Tree. It provides subsecond convergence time and is compatible with PVST+ and MSTP. +RSPAN (Remote Switched Port Analyzer) A method of collecting traffic received on a switch port or a VLAN and sending it to specific destination ports on a switch other than the one on which it was received. +RSTP (Rapid Spanning Tree Protocol) Defined in IEEE 802.1w, a specification to enhance the 802.1D standard to improve the speed of STP convergence. + +RTO (Retransmission Timeout) With EIGRP, a timer starts when a reliable (to be acknowledged) message is transmitted. For any neighbor(s) failing to respond in its RTO, the RTP protocol causes retransmission. RTO is calculated based on SRTT. +RTP (Reliable Transport Protocol) A protocol used for reliable multicast and unicast transmissions. Used by EIGRP. + + +S +SEL (Selector) Also known as Network Selector. The last octet of an ISO OSI NSAP address describing the requested network service on the host identified by the NSAP address. If the value of the SEL octet is 0x00, the NSAP address refers to the host as a unit, not to any particular network service, and is also called the Network Entity Title (NET). +sequence number In many protocols, the sequence number is a datagram number or a pointer into a data stream, used to facilitate ordered and optionally reliable delivery and data-gram loss detection. In Weighted Fair Queuing, a term for the number assigned to a packet as it is enqueued into a WFQ. WFQ schedules the currently lowest SN packet next. +Set In the context of SNMP, the Set command is sent by an SNMP manager, to an agent, requesting that the agent set a single identified variable to the stated value. The main purpose is to allow remote configuration and remote operation, such as shutting down an interface by using an SNMP Set of an interface state MIB variable. +SLSM (static length subnet masking) A strategy for subnetting a classful network for which all masks/prefixes are the same value for all subnets of that one classful network. +Glossary 21 + +SMI (Structure of Management Information) The SNMP specifications, standardized in RFCs, defining the rules by which SNMP MIB variables should be defined. + +SNMP agent A process on a computing device that accepts SNMP requests, responds with SNMP-structured MIB data, and initiates unsolicited Trap messages back to an SNMP man-agement station. +SNMP manager A process on a computing device that issues requests for SNMP MIB vari-ables from SNMP agents, receives and processes the MIB data, and accepts unsolicited Trap messages from SNMP agents. +SNPA (Sub Network Point of Attachment) ISO OSI term for a Layer 2 address. + +SPAN (Switched Port Analyzer) A method of collecting traffic received on a switch port or a VLAN and sending it to specific destination ports on the same switch. + +SPF algorithm The algorithm used by OSPF and IS-IS to compute routes based on the LSDB. + +SPF calculation The process of running the SPF algorithm against the LSDB, with the result being the determination of the current best route(s) to each subnet. + +split horizon Instead of advertising all routes out a particular interface, the routing protocol omits the routes whose outgoing interface field matches the interface out which the update would be sent. +SRTT (Smoothed Round-Trip Time) With EIGRP, a purposefully slowly changing mea-surement of round-trip time between neighbors, from which the EIGRP RTO is calculated. + +STP (Spanning Tree Protocol) Defined in IEEE 802.1D, a protocol used on LAN bridges and switches to dynamically define a logical network topology that allows all devices to be reached, but prevents the formation of loops. +straight-through cable Copper cable with RJ-45 connectors in which both ends of a cable use an identical pinout. + +stub area An OSPF area into which external (type 5) LSAs are not introduced by its ABRs; instead, the ABRs originate and inject default routes into the area. + +stub area type See stub area. + +stub network A network/subnet to which only one OSPF router is connected. + +stub router In EIGRP, a router that should not be used to forward packets between other routers. A stub router will not propagate EIGRP-learned routes and will respond to Queries in a limited way. Other routers will not send Query messages to a stub router. In OSPF, a router that should either permanently or temporarily not be used as a transit router. Can wait a cer-tain time after the OSPF process starts, or after BGP notifies OSPF that BGP has converged, before ceasing to be a stub router. +stuck-in-active The condition in which a route has been in an EIGRP active state for longer than the router’s Active timer. +22 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +subnet A subset of a classful IP network, as defined by a subnet mask, which is used to address IP hosts on the same Layer 2 network in much the same way as a classful network is used. +subnet broadcast address A single address in each subnet for which packets sent to this address will be broadcast to all hosts in the subnet. It is the highest numeric value in the range of IP addresses implied by a subnet number and prefix/mask. +subnet mask A dotted-decimal number used to help define the structure of an IP address. The binary 0s in the mask identify the host portion of an address, and the binary 1s identify either the combined network and subnet part (when thinking classfully) or the network prefix (when thinking classlessly). +subnet number A dotted-decimal number that represents a subnet. It is the lowest numeric value in the range of IP addresses implied by a subnet number and prefix/mask. + +subnet zero When subnetting a Class A, B, or C address, the subnet for which all subnet bits are binary 0. The network address of this subnet is numerically identical to the address of the former unsubnetted Class A, B, or C network. +successor route With EIGRP, for a particular destination, a route through the successor, meaning a route whose total metric is the lowest available, and that uses a neighbor guaran-teed to provide a loop-free path. +summary route A route that is created to represent one or more smaller component routes, typically in an effort to reduce the size of routing and topology tables. + +superior BPDU Out of two BPDUs being compared, the one that is “better,” that is, the one that contained a lower numerical value in the first field that broke the tie (the fields are compared in the sequence Root Bridge ID, Root Path Cost, Sending Bridge ID, and Sending Port ID). +switched interface An interface on a Cisco IOS–based switch that is treated as if it were an interface on a switch. + + +T +three-way handshake A process of establishing a communication relation in which both communication parties mutually and explicitly indicate their willingness to engage into the relation and acknowledge the other party’s indication. The three-way handshake is used in several protocols including TCP, EIGRP (during initial adjacency creation), and IS-IS (during initial adjacency creation on point-to-point links). +TLV (Type-Length-Value) A particular format of storing and transmitting information of multiple types in a single datagram. + +totally NSSA area A type of OSPF NSSA area for which neither external (type 5) LSAs are introduced, nor type 3 summary LSAs; instead, the ABRs originate and inject default routes into the area. External routes can be injected into a totally NSSA area by its own ASBR. +Glossary 23 + +totally stubby area A type of OSPF stub area for which neither external (type 5) LSAs are introduced, nor type 3 summary LSAs; instead, the ABRs originate and inject default routes into the area. External routes cannot be injected into a totally stubby area. +transit network A network/subnet over which two or more OSPF routers have become neighbors, thereby being able to forward packets from one router to another across that network. +transit router A router that is allowed to receive a packet from an OSPF router and then forward the packet to another OSPF router. + +Trap In the context of SNMP, the Trap command is sent by an SNMP agent, to a manager, when the agent wants to send unsolicited information to the manager. Trap is not followed by a Response message from the receiving SNMP manager. +Triggered Extensions to RIPv2 for On-Demand Circuits Defined in RFC 2091, the extensions define how RIP can send a full update once, and then send updates only when routes change, when an update is requested, or when a RIP interface changes state from down to up. +triggered updates A routing protocol feature for which the routing protocol sends routing updates immediately upon hearing about a changed route, even though it might normally only send updates on a regular update interval. +TTL (Time to Live) A field in the IP header that is decremented at each pass through a Layer 3 forwarding device. + + +U +U/L bit Universal/Local bit. The second least significant bit in the most significant byte of an Ethernet MAC address. A value of binary 0 implies that the address is a Universally +Administered Address (UAA) (also known as a Burned-In Address [BIA]), and a value of binary 1 implies that the MAC address is a locally configured address. +UDLD (UniDirectional Link Detection) Cisco-proprietary protocol used to detect unidi-rectional link conditions and deactivate such links to prevent a switching loop from occurring. + +unicast address An address describing a single receiver. + +Update An EIGRP message that informs neighbors about routing information. Update mes-sages require an Ack. + +Update timer With RIP, the regular interval at which updates are sent. Each interface uses an independent timer, defaulting to 30 seconds. +24 CCIE Routing and Switching v5.0 Official Cert Guide, Volume 1 + +V +variance An integer setting for EIGRP. Allows using paths provided by feasible successors as long as these are at most variance times longer than the corresponding shortest paths. + +virtual IP address The IP address used by hosts as the default gateway in a VRRP configu-ration. This address is shared by two or more VRRP routers. + +virtual link With OSPF, the encapsulation of OSPF messages inside IP, to a router with which no common subnet is shared, for the purpose of either mending partitioned areas or providing a connection from some remote area to the backbone area. +VLAN (virtual LAN) A group of devices on one or more LANs that are configured (using management software) so that they can communicate as if they were attached to the same wire, when, in fact, they are located on a number of different LAN segments. Because VLANs are based on logical instead of physical connections, they are extremely flexible. +VLAN filtering Removing unwanted VLANs from a Layer 2 path. + +VLSM (variable-length subnet masking) A strategy for subnetting a classful network for which masks/prefixes are different for some subnets of that one classful network. + +VRRP (Virtual Router Redundancy Protocol) A standard (RFC 3768) feature by which multiple routers can provide interface IP address redundancy so that hosts using the shared, virtual IP address as their default gateway can still reach the rest of a network even if one or more routers fail. +VRRP Master router The router in a VRRP group that is currently actively forwarding IP packets. Conceptually the same as an HSRP Active router. + +VSL (Virtual Switch Link) An interchassis link carrying control and data traffic between a pair of Catalyst 4500 or 6500 series switches that are combined into a single network element using the Virtual Switching System technology. See also VSS. +VSS (Virtual Switching System) Cisco-proprietary technology that allows a pair of Catalyst 4500 or 6500 Series switches to be interconnected and combined into a single net-work element. +VTP pruning VTP process that prevents the flow of broadcasts and unknown unicast Ethernet frames in a VLAN from being sent to switches that have no ports in that VLAN. diff --git a/Comprehensive-Guide-to-CSS conv.txt b/Comprehensive-Guide-to-CSS conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..c008e7e3d11d491c94b7fd78e56498d7674a6c3e --- /dev/null +++ b/Comprehensive-Guide-to-CSS conv.txt @@ -0,0 +1,2058 @@ + + + +Comprehensive Guide to CSS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Welcome to the comprehensive guide on CSS (Cascading Style Sheets)! CSS is a cornerstone technology of the web, enabling you to create visually appealing and responsive websites. This guide is designed to take you from the basics of CSS to more advanced topics, complete with code examples, detailed explanations, exercises, and multiple-choice questions to test your understanding. +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +1 + + + + +Comprehensive Guide to CSS 1 1. Introduction to CSS 5 What is CSS? 5 +Why Use CSS? 5 Basic Example 5 +2. CSS Syntax and Selectors 6 Basic Syntax 6 Basic Selectors 7 Element Selector 7 +Class Selector 7 ID Selector 7 +Grouping Selectors 7 Combinators 8 Descendant Selector 8 Child Selector 8 Adjacent Sibling Selector 8 General Sibling Selector 8 Pseudo-classes and Pseudo-elements 9 Pseudo-classes 9 Pseudo-elements 9 Attribute Selectors 9 +3. CSS Box Model 10 Understanding the Box Model 10 Box Sizing 11 Content-box (Default) 11 Border-box 11 Example: Box Model in Action 12 +4. CSS Colors and Backgrounds 13 Color Values 13 Background Properties 14 Background Color 14 Background Image 14 Background Repeat 14 Background Position 14 Background Size 15 Shorthand Background Property 15 Example: Styling a Header with Background 15 +5. CSS Typography 16 + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +2 + + +Font Properties 16 font-family 16 font-size 17 font-weight 17 font-style 17 line-height 17 Text Properties 18 color 18 text-align 18 text-decoration 18 text-transform 18 letter-spacing and word-spacing 18 Example: Styling Text 19 +6. CSS Layout 20 Display Property 20 Block 20 +Inline 21 Inline-block 21 None 21 Positioning 21 Static 21 Relative 21 Absolute 22 Fixed 22 Sticky 22 Flexbox 23 Basic Flexbox Example 23 Common Flexbox Properties 24 CSS Grid 24 Basic Grid Example 25 Advanced Grid Features 26 Example: Creating a Responsive Layout with Flexbox and Grid 27 +7. Responsive Design 29 Media Queries 29 Fluid Layouts and Units 30 Relative Units 30 Flexible Grid Systems 31 +Mobile-First Approach 31 Example: Responsive Image Gallery 32 +8. CSS Transitions and Animations 33 Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +3 + + +Transitions 33 Transition Shorthand 34 Animations 34 Advanced Animation Example 35 Example: Hover Animation 35 +9. CSS Variables (Custom Properties) 36 Defining and Using CSS Variables 36 Fallback Values 37 Dynamic Themes with CSS Variables 37 10. Advanced Selectors and Specificity 39 Specificity 39 Advanced Selectors 40 Universal Selector 40 +Child Combinator 40 Adjacent Sibling Selector 41 General Sibling Selector 41 Attribute Selectors 41 Pseudo-classes and Pseudo-elements 41 Descendant Selector 42 Combining Selectors 42 +11. CSS Best Practices 42 1. Keep CSS Organized 42 2. Avoid Over-Specificity 43 3. Use Comments 43 4. Leverage CSS Variables 43 5. Minimize Use of !important 43 6. Optimize for Performance 44 7. Responsive Design 44 8. Accessibility 44 Example: Organized and Maintainable CSS 44 +12. Projects and Exercises 46 Project 1: Personal Portfolio Website 46 Exercise 1: Creating and Styling a Navigation Bar 48 Exercise 2: Building a Responsive Grid Layout 50 Exercise 3: Implementing a Hover Effect with Transition 51 13. Multiple Choice Questions 52 Question 1 52 Question 2 53 Question 3 53 Question 4 54 +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +4 + + +Question 5 54 Question 6 55 Question 7 55 Question 8 56 Question 9 56 Question 10 56 Question 11 57 Question 12 57 Question 13 58 Question 14 58 Question 15 59 14. Conclusion 59 + + + + +1. Introduction to CSS + +What is CSS? + +CSS (Cascading Style Sheets) is a stylesheet language used to describe the presentation of a document written in HTML or XML. CSS defines how elements should be displayed on screen, on paper, in speech, or on other media. + +Why Use CSS? + +● Separation of Concerns: Separates content (HTML) from presentation (CSS). ● Reusability: Apply the same styles to multiple elements. +● Maintainability: Easier to update and manage styles across large websites. ● Enhanced Design: Create visually appealing and responsive layouts. + +Basic Example + + + +CSS Example +

Welcome to CSS!

+ + +Explanation: + +● The + +
This is a box. +
+ +Explanation: + +● The .boxelement has a set width, padding, border, and margin. +● box-sizing: border-box;ensures the total width remains 200px. +● Changing to content-boxwould make the total width 200px + 40px + 10px = 250px. + + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +12 + +4. CSS Colors and Backgrounds + +Colors and backgrounds are essential for creating visually appealing websites. CSS provides various ways to specify colors and manage backgrounds. + +Color Values + +CSS allows you to specify colors using different formats: + +Named Colors: Predefined color names. + + +p { +color: navy; } +Hexadecimal Notation: #RRGGBBor shorthand #RGB. + + +h1 { +color: #ff5733; } +RGB: rgb(red, green, blue)with values from 0 to 255. + + +div { +background-color: rgb(255, 0, 0); /* Red */ } +RGBA: rgba(red, green, blue, alpha)where alpha is opacity (0 to 1). + + +div { +background-color: rgba(0, 0, 255, 0.5); /* Semi-transparent blue */ +} +HSL: hsl(hue, saturation%, lightness%). + + +span { +color: hsl(120, 100%, 50%); /* Green */ } + + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +13 + +HSLA: hsla(hue, saturation%, lightness%, alpha). + + +span { +color: hsla(240, 100%, 50%, 0.3); /* Semi-transparent blue */ +} + +Background Properties + +CSS provides a range of properties to control backgrounds. + +Background Color + +Sets the background color of an element. + +body { +background-color: #f0f8ff; /* AliceBlue */ } + +Background Image + +Sets a background image for an element. + +div { +background-image: url('images/background.jpg'); } + +Background Repeat + +Controls how the background image repeats. + +div { +background-repeat: no-repeat; /* Options: repeat, repeat-x, repeat-y, no-repeat */ +} + +Background Position + +Sets the initial position of the background image. + +div { +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +14 + +background-position: center center; /* Options: top, bottom, left, right, center, or specific coordinates */ +} + +Background Size + +Specifies the size of the background image. + +div { +background-size: cover; /* Options: auto, cover, contain, or specific dimensions */ +} + +Shorthand Background Property + +Combines multiple background properties into one. + +div { +background: url('images/bg.png') no-repeat center center / cover #ffffff; +} + +Explanation: + +● url('images/bg.png')sets the background image. ● no-repeatprevents repetition. +● center centerpositions the image at the center. +● / coversets the background size to cover the element. ● #ffffffsets the background color to white. + +Example: Styling a Header with Background + + + +Background Example + +
Welcome to My Website +
+ +Explanation: + +● The .headerdiv has a background image that covers the entire area. ● Flexbox centers the text both vertically and horizontally. +● Text color is set to white for contrast. + + +5. CSS Typography + +Typography plays a crucial role in web design, affecting readability and user experience. CSS provides extensive control over text styling. + +Font Properties + +font-family + +Specifies the typeface to be used for text. + +body { + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +16 + +font-family: "Helvetica Neue", Arial, sans-serif; } + +Explanation: + +● Lists fonts in order of preference. +● If the first font isn't available, the browser tries the next one. + +font-size + +Sets the size of the font. + +h1 { +font-size: 2em; /* Relative to the parent element's font size */ +} +p { +font-size: 16px; /* Absolute size */ } + +font-weight + +Sets the weight (boldness) of the font. + +strong { +font-weight: bold; } +.light-text { +font-weight: 300; } + +font-style + +Sets the style of the font (e.g., italic). + +em { +font-style: italic; } + +line-height + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +17 + +Sets the height between lines of text. + +p { +line-height: 1.5; } + +Text Properties + +color + +Sets the color of the text. + +h2 { +color: darkgreen; } + +text-align + +Sets the horizontal alignment of text. + +p { +text-align: justify; } + +text-decoration + +Adds decorations to text, such as underline. + +a { +text-decoration: none; } + +text-transform + +Controls the capitalization of text. + +.uppercase { +text-transform: uppercase; } + +letter-spacing and word-spacing + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +18 + +Adjusts spacing between letters and words. + +h3 { +letter-spacing: 2px; } +p { +word-spacing: 4px; } + +Example: Styling Text + + + +Typography Example +

Welcome to My Blog

+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Read more about our latest updates and +features.

+ + +Explanation: + +● The body uses a serif font with a comfortable line height. ● The

is large, centered, and uppercase. +● Paragraphs are slightly larger and justified. +● Links are styled with a distinct color and underline on hover. + + +6. CSS Layout + +CSS provides powerful tools to create complex and responsive layouts. This section covers various layout techniques. + +Display Property + +The displayproperty defines how an element is rendered on the page. + +Block + +Elements occupy the full width available and start on a new line. + +div { +display: block; } + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +20 + +Inline + +Elements occupy only the width necessary and do not start on a new line. + +span { +display: inline; } + +Inline-block + +Elements behave like inline elements but can have set widths and heights. + +img { +display: inline-block; width: 100px; +height: 100px; } + +None + +Elements are not displayed on the page. + +.hidden { +display: none; } + +Positioning + +The positionproperty controls how an element is positioned in the document. + +Static + +Default positioning. Elements follow the normal flow of the page. + +p { +position: static; } + +Relative + +Positions the element relative to its normal position. + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +21 + +.box { +position: relative; +top: 10px; /* Moves the element 10px down */ +left: 20px; /* Moves the element 20px to the right */ } + +Absolute + +Positions the element relative to its first positioned ancestor. + +.container { +position: relative; } +.box { +position: absolute; top: 50px; +right: 30px; } + +Explanation: + +● .boxis positioned 50px from the top and 30px from the right of .container. ● If .containerhas position: relative;, .boxis positioned within +.container. + +Fixed + +Positions the element relative to the viewport, remaining in the same place even when scrolling. + +.navbar { +position: fixed; top: 0; +width: 100%; } + +Sticky + + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +22 + +Positions the element based on the user's scroll position. It toggles between relative and fixed. + +.header { +position: sticky; top: 0; +background-color: white; } + +Explanation: + +● .headersticks to the top of the viewport when scrolled to its position. + +Flexbox + +Flexbox is a one-dimensional layout method for arranging items in rows or columns. + +Basic Flexbox Example + + +Flexbox <style> +.container + +Example + + +{ + +display: flex; +justify-content: space-between; /* Align items horizontally */ +align-items: center; /* Align items vertically */ height: 100vh; +padding: 20px; +background-color: #f8f8f8; } +.box { +width: 100px; height: 100px; +background-color: #3498db; color: white; +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +23 + +display: flex; +align-items: center; justify-content: center; border-radius: 5px; +} + +
+ +
+ + +class="box">1
class="box">2
+class="box">3 + + +Explanation: + +● .containeruses display: flex;to create a flex container. +● justify-content: space-between;distributes space between items. ● align-items: center;centers items vertically. +● .boxelements are flex items, centered both horizontally and vertically. + +Common Flexbox Properties + +● flex-direction: Defines the direction of the flex items (row, column, row-reverse, column-reverse). +● justify-content: Aligns items along the main axis (flex-start, flex-end, center, space-between, space-around). +● align-items: Aligns items along the cross axis (flex-start, flex-end, center, stretch). +● flex-wrap: Controls whether flex items should wrap onto multiple lines (nowrap, wrap, wrap-reverse). + +CSS Grid + + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +24 + +CSS Grid is a two-dimensional layout system for creating complex and responsive grid-based layouts. + +Basic Grid Example + +Grid Example + +
+ +
+ + +class="grid-item">1
class="grid-item">2
class="grid-item">3 class="grid-item">4 class="grid-item">5 +class="grid-item">6 + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +25 + +Explanation: + +● .grid-containeruses display: grid;to establish a grid layout. +● grid-template-columns: repeat(3, 1fr);creates three equal-width columns. +● grid-gap: 10px;sets the spacing between grid items. ● .grid-itemstyles individual grid cells. + +Advanced Grid Features Grid Areas: + +.grid-container { display: grid; +grid-template-areas: "header header" "sidebar content" + + + +} +.header + +"footer footer"; + + +{ + +grid-area: header; } +.sidebar { +grid-area: sidebar; } +.content { +grid-area: content; } +.footer { +grid-area: footer; } +Responsive Grid: + + +@media (max-width: 600px) { .grid-container { +grid-template-columns: 1fr; grid-template-areas: +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +26 + +"header" "content" "sidebar" "footer"; +} } + +Explanation: + +● grid-template-areasdefines named grid areas for easier placement of elements. +● Media queries adjust the grid layout for different screen sizes, ensuring responsiveness. + +Example: Creating a Responsive Layout with Flexbox and Grid + + + +Responsive Layout + + +
+

Main Content

+ +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +28 + +

Welcome to the main content area.

+
+ + +Explanation: + +● Navbar and Footer: Use full-width grid areas. +● Container: Uses CSS Grid to layout the sidebar and content. +● Responsive Design: At screen widths below 800px, the layout stacks vertically. + + +7. Responsive Design + +Responsive design ensures that web pages look and function well on all devices, from desktops to smartphones. CSS offers several tools to achieve responsiveness. + +Media Queries + +Media queries apply CSS rules based on device characteristics like screen width, height, orientation, and resolution. + +Syntax: + +@media (condition) { /* CSS rules */ +} + +Example: + +/* Styles for screens wider than 600px */ @media (min-width: 600px) { +.container { display: flex; +} + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +29 + +} +/* Styles for screens 600px or narrower */ @media (max-width: 600px) { +.container { display: block; +} } + +Common Breakpoints: + +● Mobile: max-width: 600px +● Tablet: min-width: 601pxand max-width: 1024px ● Desktop: min-width: 1025px + +Fluid Layouts and Units + +Using relative units makes layouts more adaptable to different screen sizes. + +Relative Units +% (Percentage): Relative to the parent element. + + +.box { +width: 50%; /* 50% of the parent’s width */ } +em: Relative to the font-size of the element. + + +p { +font-size: 1.2em; /* 1.2 times the parent’s font-size */ } +rem: Relative to the root (html) font-size. + + +h1 { +font-size: 2rem; /* 2 times the root font-size */ } +vw and vh: Relative to the viewport’s width and height. + + +.banner { + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +30 + +width: 100vw; /* 100% of the viewport width */ height: 50vh; /* 50% of the viewport height */ +} + +Flexible Grid Systems + +Using percentages and relative units to create flexible grid layouts that adjust to screen sizes. + +Example: + +.container { display: flex; flex-wrap: wrap; +} +.column { +flex: 1 1 300px; /* Grow, shrink, basis */ margin: 10px; +} + +Explanation: + +● .columnelements will flexibly adjust their width, wrapping to new lines as needed based on available space. + +Mobile-First Approach + +Designing for mobile devices first and then enhancing for larger screens. + +Example: + +/* Mobile styles */ .container { +display: block; } +/* Enhancements for larger screens */ @media (min-width: 600px) { +.container { display: flex; +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +31 + +} } + +Advantages: + +● Prioritizes essential content and performance for mobile users. ● Easier to add enhancements for larger screens. + +Example: Responsive Image Gallery + + + +Responsive Gallery + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +32 + + + +Explanation: + +● Grid Layout: Uses auto-filland minmaxto create a responsive grid that adjusts the number of columns based on available space. +● Images: Set to width: 100%to fill their grid cells and maintain aspect ratio with height: auto. + +8. CSS Transitions and Animations + +Enhance user experience by adding dynamic visual effects using CSS transitions and animations. + +Transitions + +Transitions allow you to change property values smoothly over a specified duration. + +Syntax: + +selector { +transition: property duration timing-function delay; } + +Example: + +.button { +background-color: #3498db; +transition: background-color 0.3s ease; } +.button:hover { +background-color: #2980b9; } + +Explanation: + +● The .buttonchanges its background color smoothly over 0.3 seconds when hovered. +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +33 + +● easedefines the transition timing function. + +Transition Shorthand +transition: background-color 0.3s ease 0s; + +Animations + +Animations allow more complex and multi-step transitions. + +Syntax: + +selector { +animation: name duration timing-function delay iteration-count direction fill-mode; +} + +@keyframes Rule: + +Defines the animation sequence. + +Example: + +/* Define the animation */ @keyframes fadeIn { +from { opacity: 0; } to { opacity: 1; } +} +.box { +width: 100px; height: 100px; +background-color: #e74c3c; animation: fadeIn 2s ease-in-out; +} + +Explanation: + +● @keyframes fadeIndefines an animation that changes opacity from 0to 1. ● .boxapplies the fadeInanimation over 2 seconds with an ease-in-out +timing function. +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +34 + +Advanced Animation Example @keyframes moveRight { +0% { transform: translateX(0); } +50% { transform: translateX(100px); } 100% { transform: translateX(0); } +} +.moving-box { width: 50px; height: 50px; +background-color: #2ecc71; animation: moveRight 3s infinite; +} + +Explanation: + +● The .moving-boxmoves 100px to the right and back to the original position repeatedly every 3 seconds. + +Example: Hover Animation + + + +Hover Animation +
Hover Me! +
+ +Explanation: + +● The .cardmoves up by 10px and its shadow becomes more prominent when hovered, creating a lifting effect. + +9. CSS Variables (Custom Properties) + +CSS Variables, also known as Custom Properties, allow you to store reusable values directly in your CSS. They enhance maintainability and make it easier to implement themes. + +Defining and Using CSS Variables + +Syntax: + +:root { +--primary-color: #3498db; +--secondary-color: #2ecc71; +--font-stack: 'Helvetica Neue', Arial, sans-serif; } +.button { +background-color: var(--primary-color); +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +36 + +color: white; +font-family: var(--font-stack); } +.button-secondary { +background-color: var(--secondary-color); color: white; +font-family: var(--font-stack); } + +Explanation: + +● :rootis a pseudo-class that matches the document's root element (). Variables defined here are globally accessible. +● --primary-color, --secondary-color, and --font-stackare custom properties. +● var(--property-name)is used to retrieve the value of a custom property. + +Fallback Values + +Provide fallback values in case the variable is not defined. + +p { +color: var(--text-color, #333); } + +Explanation: + +● If --text-coloris not defined, the color defaults to #333. + +Dynamic Themes with CSS Variables + +Changing variables at runtime allows for dynamic theming. + +Example: + + + +CSS Variables Theme +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +37 + + +

Welcome!

+

This is an example of CSS variables.

Learn more +

+ + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +38 + +Explanation: + +● CSS variables define default theme colors. +● The .dark-themeclass overrides these variables. +● Clicking the button toggles the .dark-themeclass, switching between light and dark themes. + +10. Advanced Selectors and Specificity + +Mastering selectors and understanding specificity is key to writing effective and conflict-free CSS. + +Specificity + +Specificity determines which CSS rule is applied when multiple rules target the same element. + +Specificity Hierarchy: + +1. Inline styles: Highest specificity (e.g., style="color: red;"). 2. IDs: High specificity (e.g., #header). +3. Classes, attributes, pseudo-classes: Medium specificity (e.g., .button, [type="text"], :hover). +4. Elements and pseudo-elements: Low specificity (e.g., div, p, ::before). + +Calculating Specificity: + +● Inline styles: 1000 ● IDs: 100 per ID +● Classes, attributes, pseudo-classes: 10 per item ● Elements and pseudo-elements: 1 per item + +Example: + +/* Specificity score: 10 */ .button { +color: blue; } +/* Specificity score: 100 */ + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +39 + +#submit-button { color: green; +} +/* Specificity score: 11 */ button[type="submit"] { +color: red; } +/* Specificity score: 1 */ button { +color: black; } + +Explanation: + +● An element with id="submit-button"will have its color set to green, overriding other rules. +● If an element has both a class and an element selector, the class selector takes precedence. + +Advanced Selectors + +Universal Selector + +Targets all elements. + +* { +box-sizing: border-box; } + +Explanation: + +● Applies box-sizing: border-box;to all elements, simplifying layout calculations. + +Child Combinator + +Targets direct children of an element. + +ul > li { + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +40 + +list-style-type: disc; } + +Adjacent Sibling Selector + +Targets an element that is immediately preceded by another. + +h2 + p { +margin-top: 0; } + +General Sibling Selector + +Targets all siblings after a specified element. + +h2 ~ p { +color: gray; } + +Attribute Selectors + +Select elements based on attribute values. + +input[type="email"] { border: 2px solid blue; +} + +Pseudo-classes and Pseudo-elements + +Pseudo-classes: Target elements in a specific state. + +a:hover { color: red; +} + +Pseudo-elements: Target specific parts of an element. + +p::first-line { +font-weight: bold; } + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +41 + +Descendant Selector + +Targets elements nested within other elements. + +div p { +margin-bottom: 10px; } + +Explanation: + +● Applies to all

elements inside

elements, regardless of depth. + +Combining Selectors + +Combine multiple selectors to target specific elements. + +/* Targets elements inside
+ + +Explanation: + +● .grid-containeruses CSS Grid to create three equal columns with gaps. ● .grid-itemelements are styled with background color and padding. +● Media query changes the layout to a single column on screens narrower than 600px. + +Exercise 3: Implementing a Hover Effect with Transition + +Task: Create a square div that changes its background color and scales up slightly when hovered, using CSS transitions. + +Solution: + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +51 + + +Hover Effect + +
+ + +Explanation: + +● .squareis a green square with smooth transitions. +● On hover, the background color darkens, and the square scales up by 10%. + + +13. Multiple Choice Questions + +Test your understanding of CSS with the following multiple-choice questions. Answers and explanations are provided after each question. + +Question 1 + + + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +52 + +Which of the following is the correct way to apply a class named "active" to a
element in CSS? + +A) div.active { /* styles */ } + +B) div .active { /* styles */ } + +C) div #active { /* styles */ } + +D) .div.active { /* styles */ } + +Answer: A) div.active { /* styles */ } + +Explanation: + +● div.activetargets
elements with the class active. +● Option B (div .active) targets elements with class activeinside a
. ● Option C uses ID selector instead of class. +● Option D incorrectly uses a dot before div. + +Question 2 + +What does the flex-direction: column;property do in Flexbox? + +A) Aligns items horizontally. + +B) Aligns items vertically. + +C) Reverses the order of items. + +D) Wraps items onto multiple lines. + +Answer: B) Aligns items vertically. + +Explanation: + +● flex-direction: column;stacks flex items vertically from top to bottom. + +Question 3 + +Which property is used to change the text color of an element? + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +53 + +A) background-color + +B) font-color + +C) color + +D) text-color + +Answer: C) color + +Explanation: + +● The colorproperty sets the color of the text. + +Question 4 + +How can you make a text bold in CSS? + +A) font-style: bold; + +B) text-weight: bold; + +C) font-weight: bold; + +D) text-style: bold; + +Answer: C) font-weight: bold; + +Explanation: + +● The font-weightproperty controls the boldness of the text. + +Question 5 + +Which CSS property controls the space between lines of text? + +A) letter-spacing + +B) line-height + +C) text-spacing + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +54 + +D) word-spacing + +Answer: B) line-height + +Explanation: + +● The line-heightproperty sets the height between lines of text. + +Question 6 + +What does the box-sizing: border-box;property do? + +A) Includes padding and border in the element's total width and height. + +B) Excludes padding and border from the element's total width and height. + +C) Sets the box to have a fixed size. + +D) Makes the box responsive to content size. + +Answer: A) Includes padding and border in the element's total width and height. + +Explanation: + +● box-sizing: border-box;ensures that widthand heightinclude content, padding, and border. + +Question 7 + +Which of the following is NOT a valid CSS color format? + +A) rgb(255, 0, 0) + +B) #FF0000 + +C) hsl(0, 100%, 50%) + +D) rgba(255, 0, 0, 256) + +Answer: D) rgba(255, 0, 0, 256) + +Explanation: + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +55 + +● The alpha value in rgbashould be between 0and 1. 256is invalid. + +Question 8 + +Which CSS property is used to create space between the border and the content of an element? + +A) margin + +B) padding + +C) border-spacing + +D) gap + +Answer: B) padding + +Explanation: + +● paddingcreates space inside the element between the border and content. + +Question 9 + +How do you select all

elements that are direct children of a

? + +A) div p { /* styles */ } + +B) div > p { /* styles */ } + +C) div + p { /* styles */ } + +D) div ~ p { /* styles */ } + +Answer: B) div > p { /* styles */ } + +Explanation: + +● The >combinator targets direct children only. + +Question 10 + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +56 + +Which property is used to make an element stay fixed in place even when the page is scrolled? + + +A) position: + +B) position: + + +relative; + +absolute; + + + +C) position: + +D) position: + + +fixed; + +sticky; + + +Answer: C) position: fixed; + +Explanation: + +● position: fixed;fixes the element relative to the viewport, maintaining its position during scroll. + +Question 11 + +Which CSS property allows you to control the opacity of an element? + +A) visibility + +B) opacity + +C) display + +D) z-index + +Answer: B) opacity + +Explanation: + +● The opacityproperty sets the transparency level of an element. + +Question 12 + +What is the default value of the displayproperty for elements? + +A) block + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +57 + +B) inline + +C) inline-block + +D) flex + +Answer: B) inline + +Explanation: + +● elements are inline by default. + +Question 13 + +Which CSS property is used to change the font of an element? + +A) font-style + +B) font-weight + +C) font-family + +D) font-size + +Answer: C) font-family + +Explanation: + +● font-familyspecifies the typeface for text. + +Question 14 + +How can you center a block-level element horizontally within its container? + +A) text-align: center; + +B) margin: auto; + +C) display: flex; justify-content: center; + +D) All of the above + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +58 + +Answer: D) All of the above + +Explanation: + +● Option A: text-align: center;centers inline and inline-block elements. ● Option B: margin: auto;centers block-level elements with a defined width. ● Option C: Using Flexbox to center elements. + +Question 15 + +Which pseudo-class would you use to style an element when it is being hovered over by the mouse? + +A) :active + +B) :focus + +C) :hover + +D) :visited + +Answer: C) :hover + +Explanation: + +● :hoverapplies styles when the user hovers over an element. + + +14. Conclusion + +Congratulations! You've completed the comprehensive guide to CSS. This guide has covered everything from the basics of CSS syntax and selectors to advanced topics like Flexbox, Grid, responsive design, transitions, animations, and best practices. By working through the code examples, exercises, and multiple-choice questions, you've built a solid foundation in CSS that will empower you to create stunning and responsive web designs. + + + + + + + + +Learn more HTML, CSS, JavaScript Web Development at https://basescripts.com/ Laurence Svekis + +59 diff --git a/Fundamentals-of-Plumbing-Engineering-Volume-1 conv.txt b/Fundamentals-of-Plumbing-Engineering-Volume-1 conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc69dc295feed5ff2a92104758ca5417a59194fa --- /dev/null +++ b/Fundamentals-of-Plumbing-Engineering-Volume-1 conv.txt @@ -0,0 +1,21288 @@ +American Society of Plumbing Engineers Plumbing Engineering +Design Handbook + + + + +A Plumbing Engineer’s Guide to System Design and Specifications + + + +Volume 1 + + +Fundamentals of +Plumbing Engineering + + + + + + + + + + + + + + + + + + + + + + +American Society of Plumbing Engineers 8614 W. Catalpa Avenue, Suite 1007 Chicago, IL 60656-1116 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The ASPE Plumbing Engineering Design Handbook is designed to provide accurate and authoritative information for the design and specification of plumbing systems. The publisher makes no guarantees or warranties, expressed or implied, regarding the data and infor-mation contained in this publication. All data and information are provided with the understanding that the publisher is not engaged in renderinglegal,consulting,engineering,orotherprofessionalservices.Iflegal,consulting,orengineeringadviceorotherexpertassistance is required, the services of a competent professional should be engaged. + + + + + + +American Society of Plumbing Engineers 8614 W. Catalpa Avenue, Suite 1007 Chicago, IL 60656-1116 +(773) 693-ASPE • Fax: (773) 695-9007 +E-mail: aspehq@aol.com • Internet: www.aspe.org + + +Copyright © 2004 by American Society of Plumbing Engineers + +All rights reserved, including rights of reproduction and use in any form or by any means, including the making of copies by any photographic process, or by any electronic or mechanical device, printed or written or oral, or recording for sound or visual reproduction, or for use in any knowledge or retrieval system or device, unless permission in writing is obtained from the publisher. + + + +ISBN 1–891255–21–5 +Printed in the United States of America + +10 9 8 7 6 5 4 3 2 1 +Plumbing Engineering Design Handbook +Volume 1 Fundamentals of Plumbing Engineering + + +Plumbing Engineering Design Handbook Chairperson: +ASPE Vice-Presidents, Technical: Technical and Editorial Review: +Chairperson: + + +Alan Otts, P.E., CIPE +J. Joe Scott, CPD (2003-2004) Jill Dirksen & Jim Camillo +Richard Ellis + + +CONTRIBUTORS + +Chapter 1 +Formulas, Symbols and Terminology C. David Hudson, CPD + +Chapter 2 +Standards for Plumbing Materials and Equipment Julius Ballanco, P.E. + +Chapter 3 Specifications Joe Manning, CPD + +Chapter 4 Plumbing Cost Estimation +Steven Skattebo, P.E. + +Chapter 5 +Job Preparation, Drawings and Field Checklists Steven Skattebo, P.E. + +Chapter 6 +Plumbing for People (or Persons) with Disabilities Patrick McClellan, CPD + +Chapter 7 +Energy and Resource Conservation in Plumbing Systems Aaron Kelly, CPD + +Chapter 8 Corrosion Jill Dirksen + +Chapter 9 +Seismic Protection of Plumbing Equipment Rich Lloyd + +Chapter 10 Acoustics in Plumbing Systems +Ted Carnes Bill Johnson Tom Rose + +Chapter 11 +Basics of Value Engineering Stanley Wolfson + +Chapter 12 +Green Design for Plumbing Systems J. Joe Scott, CPD +About ASPE + +The American Society of Plumbing Engineers (ASPE) is the international organization for professionals skilled in the design and specification of plumbing systems. ASPE is dedicated to the advancement of the science of plumbing engineering, to the professional growth and advancement of its members, and to the health, welfare, and safety of the public. +The Society disseminates technical data and information, sponsors activities that facilitate interaction with fellow professionals, and, through research and education programs, expands the base of knowledge of the plumbing engineering industry. ASPE members are leaders in innovative plumbing design, effective materials and energy use, and the application of advanced techniques from around the world. +WORLDWIDE MEMBERSHIP — ASPE was founded in 1964 and currently has 7,500 members. Spanning the globe, members are located in the United States, Canada, Asia, Mexico, South America, the South Pacific, Australia, and Europe. They represent an extensive network of experienced engineers, designers, contractors, educators, code officials, and manufacturers interested in furthering their careers, their profession, and the industry. ASPE is at the forefront of technology. In addition, ASPE represents members and promotes the profession among all segments of the construction industry. +ASPE MEMBERSHIP COMMUNICATION — All members belong to ASPE worldwide and have the opportunity to belong and participate in one of the 62 state, provincial or local chapters throughout the U.S. and Canada. ASPE chaptersprovidethemajorcommunicationlinksandthefirstlineofservicesandprogramsfortheindividualmember. Communications with the membership is enhanced through the Society’s bimonthly magazine, Plumbing Systems and Design, and the bimonthly newsletter ASPE Report which is incorporated as part of the magazine. +TECHNICAL PUBLICATIONS — The Society maintains a comprehensive publishing program, spearheaded by the profession’s basic reference text, the ASPE Plumbing Engineering Design Handbook. The Plumbing Engineering DesignHandbook,encompassing47chaptersinfourvolumes,providescomprehensivedetailsoftheacceptedpractices and design criteria used in the field of plumbing engineering. New additions that will shortly join ASPE’s published libraryofprofessionaltechnicalmanualsandhandbooksinclude:PharmaceuticalFacilitiesDesignManual,Electronic Facilities Design Manual, Health Care Facilities and Hospitals Design Manual, and Water Reuse Design Manual. +CONVENTION AND TECHNICAL SYMPOSIUM — The Society hosts biennial Conventions in even-numbered years and Technical Symposia in odd-numbered years to allow professional plumbing engineers and designers to improve their skills, learn original concepts, and make important networking contacts to help them stay abreast of current trends and technologies. In conjunction with each Convention there is an Engineered Plumbing Exposition, the greatest, largest gathering of plumbing engineering and design products, equipment, and services. Everything from pipes to pumps to fixtures, from compressors to computers to consulting services is on display, giving engineers and specifiers the opportunity to view the newest and most innovative materials and equipment available to them. +CERTIFIED IN PLUMBING DESIGN — ASPE sponsors a national certification program for engineers and designers of plumbing systems, which carries the designation “Certified in Plumbing Design” or CPD. The certification program provides the profession, the plumbing industry, and the general public with a single, comprehensive qualification of professional competence for engineers and designers of plumbing systems. The CPD, designed exclusively by and for plumbing engineers, tests hundreds of engineers and designers at centers throughout the United States biennially. Createdtoprovideasingle,uniformnationalcredentialinthefieldofengineeredplumbingsystems,theCPDprogram is not in any way connected to state-regulated Professional Engineer (P.E.) registration. +ASPE RESEARCH FOUNDATION — The ASPE Research Foundation, established in 1976, is the only independent, impartial organization involved in plumbing engineering and design research. The science of plumbing engineering affects everything… from the quality of our drinking water to the conservation of our water resources to the building codes for plumbing systems. Our lives are impacted daily by the advances made in plumbing engineering technology through the Foundation’s research and development. +American Society of Plumbing Engineers Plumbing Engineering Design Handbook (4 Volumes — 47 Chapters) + + +Volume 2 Chapter 1 +2 3 4 5 6 7 8 9 10 11 12 + +Volume 3 Chapter 1 +2 3 4 5 6 7 8 9 10 + +Volume 4 Chapter 1 +2 3 4 5 6 7 8 9 10 11 12 13 + +Plumbing Systems (Estimated date: Fall 2005) Sanitary Drainage Systems +Gray-Water Systems +Vents and Venting Systems Storm-Drainage Systems Cold-Water Systems +Domestic Water-Heating System Fuel-Gas Piping Systems +Private Sewage-Disposal Systems Private Water Systems +Vacuum Systems Pure Water, Systems Lab-Waste Systems + +Special Plumbing Systems (Estimated date: Fall 2006) Fire Protection Systems +Plumbing Design for Health-Care Facilities Industrial Waste-Water Treatment Irrigation Systems +Reflecting Pools and Fountains Public Swimming Pools Gasoline and Diesel-Oil Systems Steam and Condensate Systems Compressed Air Systems +Site Utility Systems + +Plumbing Components and Equipment (Estimated revision date: Fall 2007) Plumbing Fixtures +Piping Systems Valves +Pumps +Piping Insulation Hangers and Supports Vibration Isolation Grease Interceptors Cross Connection Control Water Treatment Thermal Expansion +Potable Water Coolers and Central Water Systems Bioremediation Pretreatment Systems + + +(The chapters and subjects listed for these volume are subject to modification, adjustment and change. The contents shown for each volume are proposed and may not represent the final contents of the volume. A final listing of included chapters for each volume will appear in the actual publication.) + + +Table of Contents + + + + + + + + + +Chapter 1, Formulas, Symbols and Terminology . . . . . . . . . . . . . . . . . . . .1 Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Plumbing Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 +Recommended Practice for Conversion to the International System of Units. . . . . . . . 32 Terminology and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Types of Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 +Si Unit Conversion Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 + +Chapter 2, Standards for Plumbing Materials and Equipment. . . . . . .41 + +Chapter 3, Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Construction Contract Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Definition of Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Project Manual. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Uniformat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Masterformat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Masterformat 2004—an Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Methods of Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Creating the Specification Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 +Part 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Part 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Part 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Use of Computers in Producing Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Appendix 3-A1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Appendix 3-A2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Appendix 3-A3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Division 1 General Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Division 2 Site Construction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Division 3 Concrete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Division 4 Masonry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 +ii ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Division 5 Metals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Division 6 Wood and Plastics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Division 7 Thermal and Moisture Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Division 8 Doors and Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Division 9 Finishes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Division 10 Specialties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Division 11 Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Division 12 Furnishings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Division 13 Special Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Division 14 Conveying Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Division 15 Mechanical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Division 16 Electrical. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Appendix 3-A4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Appendix 3-A5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Appendix 3-B1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 +CSI Masterformat Divisions (2004 Edition) Procurement and +Contracting Documents Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 +Specifications Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 General Requirements Subgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Facility Construction Subgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Facility Services Subgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Site and Infrastructure Subgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Process Equipment Subgroup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Appendix 3-B2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Appendix 3-B3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Appendix 3-B4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Appendix 3-B5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Appendix 3-C Section Shell Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Part 1—General. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 +1.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 1.2 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 1.3 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 1.4 System Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 1.5 System Performance Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 1.6 Submittals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 1.7 Quality Assurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 1.8 Delivery, Storage, and Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 1.9 Project Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 1.10 Sequencing and Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 1.11 Warranty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 1.12 Maintenance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 1.13 Extra Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Part 2—Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 2.1 Manufacturers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 2.2 Materials [Product Name]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 +Table of Contents iii + + +2.3 Materials, General [Products, General]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 2.4 Equipment [Name of Manufactured Unit]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 2.5 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 2.6 Accessories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 2.7 Mixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 2.8 Fabrication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 2.9 Source of Quality Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 PART 3—Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 3.1 Examination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 3.2 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 3.3 Installation, General [Application, General] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 3.4 Installation {Of [Name]} {Application of [Name]}. . . . . . . . . . . . . . . . . . . . . . . 91 3.5 Connections (Not A CSI Article—but Useful for Division 15) . . . . . . . . . . . . . . 91 3.6 Field Quality Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 3.7 Adjusting [Cleaning] [Adjusting and Cleaning]. . . . . . . . . . . . . . . . . . . . . . . . . . 92 +3.8 Commissioning (Not A CSI Article — +But Useful for Division 15 [Demonstration]) . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 +3.9 Protection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 3.10 Schedules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 + +Chapter 4, Plumbing Cost Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . .93 Labor Costs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Take-off Estimating Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Productivity Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Other Estimating Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Other Cost Factors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 + +Chapter 5, Job Preparation, Drawings, and Field Reports . . . . . . . . . .99 Job-preparation Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Plumbing Drawing Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Plumbing-Drawings Checklist. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 +Plans. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Risers and Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Schedules and Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Field Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Building Drains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Water and Gas Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Above Grade Rough-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Final . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 + +Chapter 6, Plumbing for People (Or Persons) with Disabilities . . . . .105 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Legislation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Clear Floor Or Ground Space for Wheelchairs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 +iv ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Anthropometrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Plumbing Elements and Facilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 + +Chapter 7, Energy and Resource Conservation in Plumbing Systems125 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Domestic Hot Water System Energy Conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 +Design Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Domestic Hot Water Heating Equipment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Water Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Design Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Water-management Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 + +Chapter 8, Corrosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Fundamental Corrosion Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 +Basic Relations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Electrochemical Equivalents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Common Forms of Corrosion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 The Galvanic Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Electromotive Force Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Factors Affecting the Rate of Corrosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 General. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Acidity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Oxygen Content. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Film Formation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Velocity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Homogeneity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Corrosion Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Materials Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Design to Reduce Corrosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Passivation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Coating. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Cathodic Protection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Inhibitors (Water Treatment). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 + +Chapter 9, Seismic Protection of Plumbing Equipment. . . . . . . . . . . .155 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Causes and Effects of Earthquakes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 +Plate Tectonics and Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Damage From Earthquakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 Earthquake Measurement and Seismic Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 +Table of Contents v + + +Ground Shaking and Dynamic Response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 The Response Spectrum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Learning From Past Earthquakes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Damage to Plumbing Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 The 1964 Alaska Earthquake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Damage Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 The 1971 San Fernando Earthquake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Seismic Protection Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 General. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Piping Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Design Philosophy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Code Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 Analysis Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Determination of Seismic Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Determination of Anchorage Forces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Computer Analysis of Piping Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Design Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Loads in Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Potential Problems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Additional Considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 + +Chapter 10, Acoustics in Plumbing Systems . . . . . . . . . . . . . . . . . . . . .193 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Acceptable Acoustical Levels in Buildings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Acoustical Performance of Building Materials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 +Insulation Against Airborne Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Acoustical Ratings of Plumbing Fixtures and Appliances. . . . . . . . . . . . . . . . . . . . . . . 194 General Acoustical Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Water Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Occupied Domestic Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Pumps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Flow Velocity and Water Hammer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Design Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Noise and Vibration Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 System Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 + +Chapter 11, Basics of Value Engineering. . . . . . . . . . . . . . . . . . . . . . . . .211 The Intent of Value Engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 What Is Value? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 +Elements of Value Engineering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Phase One: Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 +vi ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Phase Two: Analysis/function Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Rules of Function Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Function Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Fast. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Purpose of the Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Creativity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Creative Thinking Personified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Divergent Thinking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 +In Concert With . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Refining, Combining, Evaluating By Comparison. . . . . . . . . . . . . . . . . . . . . . . . . . 235 Cost Analysis and Evaluation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Incorporating the Functional Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 The Pencil: Another Look . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Development/ Investigation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Consultation and Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Second Creativity, Evaluation, Cost Anaylsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Final Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 The Gut Feel Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Cost Analysis, More. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Are We there Yet?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Recommendation/Presentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Present Costs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Present Recommendation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Making the Presentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 +Is It Value Engineering? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Cost Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Level the Playing Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 The Déja Vu of the “Science” of Value Engineering . . . . . . . . . . . . . . . . . . . . . . . . 258 Solution to Nine Dots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Solution to Equilateral Triangle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 + +Chapter 12, Green Design for Plumbing Systems . . . . . . . . . . . . . . . . .263 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Leadership in Energy and Environmental Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Wastewater Technologies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Water-use Reduction Credit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Cautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Plumbing Products. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Additional Leed Points—Energy Savers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Innovative Ideas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Green Roofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Grey Water Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 +Table of Contents vii + + + + +Figures + + + + + + + + + + +Figure 1-1 Figure 1-2 Figure 1-3 Figure 1-4 Figure 1-5 Figure 1-6 Figure 1-7 Figure 1-8 +Figure 1-9 + +Square . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Rhombus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Rhomboid. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Trapezoid. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Trapezium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Right-Angle Triangle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Isosceles Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 +Ellipse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 + + + +Figure 1-10 Figure 1-11 Figure 1-12 Figure 1-13 Figure 1-14 +Figure 1-15 + +Cylinder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Cube or Rectangular Solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Pyramid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Cone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Circle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 +Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 + + + +Figure 6-1 Figure 6-2 Figure 6-3 Figure 6-4 Figure 6-5 Figure 6-6 Figure 6-7 Figure 6-8 +Figure 6-9 + +Dimensions of Adult-Sized Wheelchairs . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Clear Floor Space for Wheelchairs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Wheelchair Approaches. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Clear Floor Space in Alcoves. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Unobstructed Forward Reach Limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Forward Reach Over an Obstruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Unobstructed Side Reach Limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Obstructed Side Reach Limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 +Cantilevered Drinking Fountains and Water Coolers. . . . . . . . . . . . . . . . 112 + + + +Figure 6-10 Figure 6-11 Figure 6-12 Figure 6-13 Figure 6-14 Figure 6-15 Figure 6-16 Figure 6-17 Figure 6-18 +Figure 6-19 + +Horizontal Angle of Water Stream — Plan View . . . . . . . . . . . . . . . . . . 113 Leg Clearances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Ambulatory Accessible Stall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Wheelchair Accessible Toilet Stalls — Door Swing Out . . . . . . . . . . . . . 114 Clear Floor Space at Water Closets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Water Closet — Side View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Water Closet — Front View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Wheelchair Accessible Toilet Stalls — Door Swing In . . . . . . . . . . . . . . 116 Clear Floor Space atLavatories and Sinks. . . . . . . . . . . . . . . . . . . . . . . . 117 +Clear Floor Space at Bathtubs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 +viii ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Figure 6-20 Figure 6-21 Figure 6-22 Figure 6-23 Figure 6-24 +Figure 6-25 + +Bathtub Accessories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Transfer Type Shower Stall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Roll-in Type Shower Stall. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Grab Bars at Shower Stalls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Size and Spacing of Grab Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 +Shower Seat Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 + + + +Figure 7-1 Figure 7-2 Figure 7-3 Figure 7-4 Figure 7-5 Figure 8-1 Figure 8-2 Figure 8-3 Figure 8-4 Figure 8-5 Figure 8-6 Figure 8-7 Figure 8-8 +Figure 8-9 + +Energy Savings fromReduced Faucet Flow Rates. . . . . . . . . . . . . . . . . . . 127 Refrigeration Waste-Heat Recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Condenser Water Heat Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Condenser Water Heat Recovery with Storage Tank . . . . . . . . . . . . . . . . 133 Waste Water Heat Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Basic Corrosion Cell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Basic Cell Applied to an Underground Structure . . . . . . . . . . . . . . . . . . . 140 Uniform Attack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Pitting Corrosion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Galvanic Corrosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Concentration Cells. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Impingement Attack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Stress Corrosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 +(A) Plug-Type Dezincification(B) Layer-Type Dezincification . . . . . . . . . 142 + + + +Figure 8-10 Figure 8-11 Figure 8-12 Figure 8-13 +Figure 8-14 + +Stray Current Corrosion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Corrosion by Differential Environmental Conditions. . . . . . . . . . . . . . . 143 Cathodic Protection by the Sacrificial Anode Method. . . . . . . . . . . . . . . 148 Typical Sacrificial Anode Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 +Cathodic Protection by the Impressed Current Method. . . . . . . . . . . . . 149 + +Figure 9-1 Significant Earthquakes in the United States. . . . . . . . . . . . . . . . . . . . . . 155 +Figure 9-2 (A) Seismic Zone Map of the United States; (B) Map of Seismic Zones and Effective, Peak-Velocity-Related Acceleration (Av) for Contiguous 48 States.. . . . 157 +Figure 9-3 World Map Showing Relation Between the Major +Tectonic Plates and Recent Earthquakes and Volcanoes.. . . . . . . . . . . . . . . . . . . . 156 + +Figure 9-4 +Figure 9-5 + +Elastic Rebound Theory of Earthquake Movement . . . . . . . . . . . . . . . . . 158 +Earthquake Ground Accelerations in Epicentral Regions . . . . . . . . . . . . 159 + +Figure 9-6 Undamped Mechanical Systems: (A) Single-Degree-of-Freedom Systems; (B) Multiple-Degree-of-Freedom Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 + +Figure 9-7 Figure 9-8 Figure 9-9 +Figure 9-8 + +Response Spectrum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Snubbing Devices: (A) Three-Dimensional Cylinder Snubber. . . . . . . . . 164 Isolators with Built-In Seismic Restraint . . . . . . . . . . . . . . . . . . . . . . . . . 164 +Snubbing Devices: (B) Three-Directional Angle Snubbers. . . . . . . . . . . . 165 + + + +Figure 9-10 Figure 9-11 Figure 9-11 +Figure 9-11 + +Parameters to Be Considered for Pipe Bracing. . . . . . . . . . . . . . . . . . . . 167 Pipe Bracing Systems: (A) Typical Pipe Bracing. . . . . . . . . . . . . . . . . . . 168 Pipe Bracing Systems: (B) Tension 360. . . . . . . . . . . . . . . . . . . . . . . . . . 169 +Pipe Bracing Systems: (C) Superstrut. . . . . . . . . . . . . . . . . . . . . . . . . . . 170 + +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(A) Transverse Bracing for Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(B) Longitudinal Bracing for Pipes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 +Table of Contents ix + + +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(C) Strut Bracing for Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(D) Alternate Attachment to Hanger for Pipe Bracing. . . . . . . . . . . . . . . . . . . . . . 174 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(E) Alternate Bracing for Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(F) Strut Bracing for Pipe Trapeze. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(G) Connections to Steel Beams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(H) Connections to Open-Web Steel Joists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(I) Connections to Steel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(J) Hanger Rod Connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(K) Hubless Cast-Iron Pipe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(L) Riser Bracing for Hubless Pipes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 +Figure 9-12 Construction Details of Seismic Protection for Pipes: +(M) Connections for Pipes on Trapeze. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 + +Figure 9-13 Figure 9-14 Figure 9-14 Figure 9-15 Figure 9-16 Figure 9-17 +Figure 10-1 + +Sway Bracing, 0.5 G Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 A Seismic Bracing Method: (A) Lateral Sway Bracing . . . . . . . . . . . . . . 181 A Seismic Bracing Method: (B) Lateral and Longitudinal Sway Bracing.182 Acceptable Types of Sway Bracing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Forces for Seismic Design: (A) Equipment; (B) Piping. . . . . . . . . . . . . . 188 Potential Problems in Equipment Anchorage or Pipe Bracing . . . . . . . 189 +Pipe-Sleeve Floor Penetration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 + +Figure 10-2 Acoustical Treatment for Pipe-Sleeve Penetration at Spaces with +Inner Wall on Neoprene Isolators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 + +Figure 10-3 Figure 10-4 Figure 10-5 Figure 10-6 Figure 10-7 Figure 10-8 +Figure 10-9 + +Acoustical Pipe-Penetration Seals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Installation of an Air Lock in a Residential Plumbing System . . . . . . . 201 Examples of Suction-Piping Installations . . . . . . . . . . . . . . . . . . . . . . . . 202 Typical Vibration-Isolation Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Typical Flexible Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 Bathtub and/or Shower Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 +Suggested Mounting of Piping and Plumbing Fixture . . . . . . . . . . . . . . 206 + +Figure 10-10 Suggested Installation of Plumbing Fixtures . . . . . . . . . . . . . . . . . . . . 207 +Figure 10-11 Vibration Isolation of Flexible-Coupled, Horizontally Split, +Centrifugal Pumps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 + +Figure 10-12 +Figure 10-13 + +Common Errors Found in Installation of Vibration-Isolated Pumps. . 208 +Vibration Isolation of a Sump Pump . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 + +Figure 10-14 Typical Pipe Run Installations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Figure 10-15 Typical Flexible Pipe-Connector Installations . . . . . . . . . . . . . . . . . . . 210 + +Figure 11-1 Figure 11-2 +Figure 11-3 + +Qualitative Results From the Implementation of Value Engineering . . 212 Value Engineering Job Plan Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 213 +Information Gathering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 +x ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Figure 11-4A +Figure 11-4B + +General Project Information Collection . . . . . . . . . . . . . . . . . . . . . . . . 215 +Detailed Basic Project Information Collection . . . . . . . . . . . . . . . . . . . 216 + + + +Figure 11-5 Figure 11-6 Figure 11-7 Figure 11-8 +Figure 11-9 + +Project Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Information and Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Cost Structure of Product/Service/Material. . . . . . . . . . . . . . . . . . . . . . . 222 Generalized Total Cost to Each User. . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 +Cost Breakdown Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 + + + +Figure 11-10 Figure 11-11 Figure 11-12 Figure 11-13 +Figure 11-14 + +Function Definition Verbs and Nouns . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Function Analysis/Definition Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Function Analysis Systems Technique (FAST) Model . . . . . . . . . . . . . 229 HOW and WHY Relationship with Example. . . . . . . . . . . . . . . . . . . . . 230 +Creativity Worksheet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 + + + +Figure 11-15A +Figure 11-15B + +Creativity Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 +Creativity Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 + +Figure 11-16 Creativity Worksheet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 + +Figure 11-17A Figure 11-17B Figure 11-18A +Figure 11-18A + +Basic Idea Evaluation Worksheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Initial Example — Idea Evaluation Worksheet. . . . . . . . . . . . . . . . . . 238 Functional Development Sketch Worksheet — Blank . . . . . . . . . . . . 239 +Functional Development Sketch Worksheet — Example. . . . . . . . . . 240 + +Figure 11-18B Functional Idea Development and Estimated Cost +Worksheet — Blank. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 +Figure 11-18B Functional Idea Development and Estimated Cost +Worksheet — Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 + +Figure 11-19 +Figure 11-19 + +Functional Evaluation Worksheet — Part 1, Blank . . . . . . . . . . . . . . . 244 +Functional Evaluation Worksheet — Part 2, Blank . . . . . . . . . . . . . . . 245 + + + +Figure 11-20A Figure 11-20B +Figure 11-20C + +Functional Evaluation Worksheet — Part 1, Example. . . . . . . . . . . . 246 Functional Evaluation Worksheet — Part 2, Example. . . . . . . . . . . . 247 +Functional Evaluation Worksheet — Part 1, Example. . . . . . . . . . . . 248 + +Figure 11-21 Completion of Functional Definition and Analysis Worksheet. . . . . . . 249 + +Figure 11-22A Figure 11-22B +Figure 11-22C + +Functional Evaluation, Part 1, Step 1. . . . . . . . . . . . . . . . . . . . . . . . . 250 Functional Evaluation, Part 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 +Functional Evaluation, Part 1, Step 2. . . . . . . . . . . . . . . . . . . . . . . . . 252 + +Figure 11-23 Completed Idea Evaluation Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 + +Figure 11-24A +Figure 11-24B + +In-progress Alternative Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 +In-progress Alternative Idea Development and Cost Estimates . . . . 256 + + + +Figure 11-25 Figure 11-26 +Figure 11-27 + +Risk Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Value Engineering Team Recommendation. . . . . . . . . . . . . . . . . . . . . . 259 +Example of Value Engineering Change Proposal Contract Clause . . . 260 +Table of Contents xi + + + +Tables + + + + + + + + + +Table 1-1 Table 1-2 Table 1-3 Table 1-4 Table 1-5 Table 2-1 Table 2-2 Table 2-3 Table 4-1 Table 4-2 Table 4-3 Table 4-4 Table 4-5 Table 4-6 Table 4-7 Table 4-8 +Table 4-9 + +Standard Plumbing and Piping Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Standard Fire-Protection Piping Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Abbreviations for Text, Drawings, and Computer Programs. . . . . . . . . . . . 14 Temperature Conversion Chart, °F – °C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Conversion to SI Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Codes and Standards Listed by Category . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Complete List of Standards By Standard-Writing Organization . . . . . . . . . 46 Organization Abbreviation, Address, and Phone Number Listing . . . . . . . 58 Piping Take-off Sample. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Hours to Excavate 100 Feet [30.5 m] of Trench . . . . . . . . . . . . . . . . . . . . . . 95 To Sawcut 100 Feet [30.5 m] of ConcreteTrench . . . . . . . . . . . . . . . . . . . . . 95 To Break 100 Feet [30.5 m] of Pavement. . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Hours to Backfill 100 Feet [30.5 m] of Trench . . . . . . . . . . . . . . . . . . . . . . . 96 Hours to Complete 100 Joints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Hours to Install 100 Pipe Hangers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Hours to Install Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 +Adjustments From Standard Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 + + + +Table 4-10 +Table 4-11 + +Solution to Example 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 +Solution to Example 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 + + + +Table 6-1 Table 7-3 Table 7-1 Table 7-2 Table 8-1 Table 8-2 Table 8-3 Table 8-4 Table 9-1 Table 9-2 +Table 9-3 + +Graphic Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 The Effect of Stopping Circulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Energy Savings Chart for Steel Hot Water Pipes and Tanks. . . . . . . . . . . 128 Energy Savings Chart for Copper Hot Water Pipes . . . . . . . . . . . . . . . . . . 128 Electrochemical Metal Lossesof Some Common Metals. . . . . . . . . . . . . . . 139 Galvanic Series of Metals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Electromotive Force Series. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Corrosion Rates for Common Metals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Piping Weights for Determining Horizontal Load . . . . . . . . . . . . . . . . . . . 184 Assigned Load Table for Lateral and Longitudinal Sway Bracing. . . . . . . 184 +Maximum Horizontal Loads for Sway Bracing. . . . . . . . . . . . . . . . . . . . . . 185 + + + +Table 10-1 +Table 10-2 + +Recommended Static Deflection for Pump Vibration-Isolation Devices . 205 +Typical Sound Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 +xii ASPE Plumbing Engineering Design Handbook — Volume 1 +1 + + + + + +Formulas, Symbols and Terminology + +FORMULAE COMMONLY USED IN PLUMBING ENGINEERING +For the convenience of ASPE members, the Society has gathered some of the basic formulae commonly referred to and utilized in plumbing engineering and design. It is extremely important to convert to values of the proper units whenever using these equations. +Take note that gravitational acceleration and gravitational constant have the same numerical value, but the units are not the same. This term is frequently left out of equations with no effect to the numerical value. However, the units will not be dimensionally correct and do not cancel out. Due to the English system of measurement utilizing pounds to indicate mass and force, pounds-mass (lbm) and pounds-force (lbf) are used to distinguish between the two. +ThisisnotanissueforTheInternationalSystem of Units (SI). Equations listed in parenthesis () are used to represent equations that are unit-system specific to SI units and differ when using English units. +Equation 1-1, the Manning Formula Used for determining the velocity (V) of uniform flow (de-fined as the flow that is achieved in open channels of constantshapeandsizeanduniformslope)insloping drains. Note that the slope of the water surface is equal to the slope of the channel, and that the flows in such open channels do not depend on the pressure applied to the water but on the gravitational force induced by the slope of the drain and the height of the water in that drain. +Equation 1-1 +V = 1.486 R2⁄3 S½ +n + +where +V = Velocity of flow, ft/s (m/s) +n = Coefficient representing roughness of pipe surface, degree of fouling, and pipe diameter + +R = Hydraulic radius, ft (m) +S = Hydraulic slope of surface of flow, ft/ft (m/ m) +The hydraulic radius (R) can be calculated using Equation 1-3. The roughness coefficient (n) and several values for the hydraulic radii are given in Baumeister and Marks’s “Standard Handbook for Mechanical Engineers.” +Equation 1-2, Rate of flow Used for deter-mining the amount of water passing through a pipe. This quantity of water, for a given time, depends on the cross-sectional area of the pipe and the velocity of the water. +Equation 1-2 +Q = AV +where +Q = Flow rate of water, ft3/s (m3/s) +A = Cross-sectional area of pipe, ft2 (m2) V = Flow velocity of water, ft/s (m/s) +(a) Therefore, substituting Equation 1-2 in Equation 1-1, the Manning Formula can be represented as follows: +Equation 1-2a +Q = 1.486 AR2⁄3 S½ +n + +Equation 1-3, Hydraulic radius (R) Usually referred to as the hydraulic mean depth of flow, the ratio of the cross-sectional area of flow to the wetted perimeter of pipe surface. +Equation 1-3 +R = Area of flow/Wetted perimeter +For half-full (HF) and full-flow (FF) conditions, the hydraulic radii can be represented as: +Equation 1-3a +RHF = RFF = 4 where +D +D = Diameter of pipe, ft (m) +RHF = Hydraulic radius, half-full condition, ft (m) +2 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +RFF = Hydraulic radius, full-flow condition, ft (m) +Equation 1-4, Water flow in pipes Two types of water flow exist: Laminar and turbulent. Each type is characterized by the Reynolds number, a dimensionless quantity. The physical characteristics of the water, the velocity of the flow, and the internal diameterofthepipearefactorsforconsideration,and the Reynolds number is represented as: + +Equation 1-5a + +P = 144 +γ +h +where +P = Pressure, lbf/in2 (kPa) +γ = Specific Weight of substance, lbf/ft3 (N/m3) h = Static head, ft (m) +(b) Therefore, Equation 1-5 may be represented as: + + + +Equation 1-4 + +Re = + +Equation 1-5b +VDρ P = c +µg + + +γ fLV2 +288gD + + + +where +Re = Reynolds number, dimensionless V = Velocity of flow, ft/s (m/s) +D = Diameter of pipe, ft (m) +ρ= Density, lbm/ft3 (kg/m3) +µ = Absolute viscosity of fluid, lb-s/ft2 (m2/s) gc = Gravitational Contstant, 32.2 lbm-ft/lbf-s2 +Values of viscosity are tabulated in the ASHRAE “Handbook of Fundamentals.” In laminar flow, the fluid particles move in layers in straight parallel paths, the viscosity of the fluid is dominant, and its upperlimitisrepresentedbyRe=2000.Inturbulent flow, the fluid particles move in a haphazard fashion in all directions, the path of an individual fluid par-ticle is not possible to trace, and Re is above 4000. Flows with Re between 2000 and 4000 are classified as critical flows. Re is necessary to calculate friction coefficients which, in turn, are used to determine pressure losses. +Equation1-5,Frictionheadloss Wheneverflow occurs, a continuous pressure loss exists along the piping in the direction of flow, and this head loss is affected by the density of the fluid, its temperature, the pipe roughness, the length of the run, and the fluid velocity. The friction head loss is represented by Darcy’s Friction Formula: +Equation 1-5 +fLV2 += +h +2gD +where +h = Friction head loss, ft (m) +f = Friction coefficient, dimensionless L = Length of pipe, ft (m) +V = Velocity of flow, ft/s (m/s) +g = Gravitational acceleration, 32.2 ft/s2 (9.8 m/s2) +D = Internal diameter of pipe, ft (m) +(a) The static head is the pressure (P) exerted at any point by the height of the substance above that point. To convert from feet (m) of head to pounds per square inch (kPa or kg/m2), the following relation-ship is used: + +(c) To convert pressure in meters of head to pressure in kilopascals, use +Equation 1-5c +kPa = 9.81 (m head) +(d) To calculate the friction loss, the Hazen-Williams Formula is used: +Equation 1-5d +h = 0.002082L(100 1.85 ( d4.8655 ) where +) +q +1.8 +C +C = Friction factor for Hazen-Williams q = Flow rate, gpm (L/s) +d = Actual inside diameter of pipe, in. (mm) L = Length of pipe, ft (m) +f = Friction factor +Values for f and C are tabulated in Baumeister and Marks’s “Handbook for Mechanical Engineers.” +Equation 1-6, Potential energy (PE) Defined as theenergyofabodyduetoitselevationaboveagiven level and expressed as: +Equation 1-6 +PE = Wh = mgh +g +c (PE =Wh) +where +PE = Potential energy, ft-lbf (J) W = Weight of body, lbf (N) +h = Height above level, ft (m) +g = Gravitational acceleration, 32.2 ft/s2 (9.8 m/s2) gc =Gravitational constant, 32.2 lbm-ft/lbf-s2 +Equation 1-7, Kinetic energy (KE) Defined as the energy of a body due to its motion and expressed as: +Equation 1-7 +mV2 WV2 += = +KE +2gc 2g (KE = mV2 ) +2 +where +KE = Kinetic energy, ft-lbf (J) m = Mass of body, lbm (kg) +V = Velocity, ft/s (m/s) +Chapter 1 — Formulas, Symbols and Terminology 3 + + + +W = Weight of body, lbf (kg) +g = Gravitational acceleration, 32.2 ft/s2 (9.8 /s2) gc =Gravitational constant, 32.2 lbm-ft/lbf-s2 + +Equation 1-11, Flow rate in fixture drain The flow rate in a fixture drain should equal the flow rate at the fixture outlet and is expressed as: + + + +Equation 1-8, Flow at outlet Can be determined by using the following relationship: + + +Equation 1-11 +Q = 13.17 d2 h½ + + + +Equation 1-8 +Q = 29.87Cdd2 P½ +where +Q = Flow at outlet, gpm (L/s) Cd = Discharge Coefficient +d = Inside diameter of outlet, in. (mm) P = Flow pressure, lbf/in2 (kPa) +The discharge coefficient (Cd) may be obtained from Baumeister and Marks’s “Handbook for Mechanical Engineers.” +Equation 1-9, Length of vent piping Can be determined by combining Darcy’s Friction +Formula (Equation 1-5) and the flow equation and is expressed as: + +Equation 1-9 +2226d5 += +L +fQ2 +where +L = Length of pipe, ft (m) +d = Diameter of pipe, in. (mm) +f = Friction coefficient, dimensionless Q = Rate of flow, gpm (L/s) +Equation 1-10, Stacks (a) Terminal velocity +Equation 1-10a +VT = 3 (d )5 +Q +⁄ +2 +where +VT = Terminal velocity in stack, ft/s (m/s) Q = Rate of flow, gpm (L/s) +d = Diameter of stack, in. (mm) +(b) Terminal length + + +where +Q = Discharge flow rate, gpm (L/s) +d = Diameter of outlet orifice, in. (mm) +h = Mean vertical height of water surface above the point of outlet orifice, ft (m) +Equation 1-12, Pipe expansion and con-traction All pipes that are subject to temperature changes expand and contract. Piping expands with an increase in temperature and contracts with a de-crease in temperature. The rate of change in length due to temperature is referred to as the expansion coefficient. The changes in length can be calculated by using the following relation: +Equation 1-12 +L2 – L1 = CEL1 (T2 – T1) +where +L2 = Final length of pipe, ft (m) L1 = Initial length of pipe, ft (m) +CE = Coefficient of expansion of material (A material’s expansion coefficient may be obtained from the ASHRAE “Handbook of Fundamentals.”) +T2 = Final temperature, °F (°C) T1 = Initial temperature, °F (°C) +Equation 1-13, Various formulae for areas and volumes, in ft2 (m2) and ft3 (m3), respectively. + +Equation 1-13a, Square (See Figure 1-1.) +A = bh + +Equation 1-10b +LT = 0.052 VT2 Figure 1-1 Square + +where +LT = Terminal length below point of flow entry, ft (m) + +(c) Capacity + + +Equation 1-13b, Rectangle (See Figure 1-2.) A = bh + +Equation 1-10c +Q = 27.8 r⁄3 d⁄3 Figure 1-2 Rectangle where +5 8 +Q = Maximum permissible flow rate in stack, gpm (L/s) +r = Ratio of cross-sectional area of the sheet of water to cross-sectional area of stack. +d = Diameter of stack, in. (mm) +4 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Equation 1-13c, Rhombus (See Figure 1-3.) + +A = bh + +Equation 1-13i, Ellipse (See Figure 1-9.) + +A = πab +where +a = D b = d + + +Figure 1-3 Rhombus Figure 1-9 Ellipse + +Equation 1-13d, Rhomboid (See Figure 1-4.) + +A = bh + + +Equation 1-13j, Cylinder (See Figure 1-10.) + +A = πDh +V = πR2h + + + +Figure 1-4 Rhomboid + + +Equation 1-13e, Trapezoid (See Figure 1-5.) + +h (a + b) += +A +2 + + +Figure 1-10 Cylinder + +Equation 1-13k, Cube or rectangular solid (See Figure 1-11.) +V = whl + + + +Figure 1-5 Trapezoid + +Equation 1-13f, Trapezium (See Figure 1-6.) +(H + h)a + bh + cH += +A +2 +Figure 1-11 Cube or +Rectangular Solid + +Equation 1-13l, Pyramid (See Figure 1-12.) + +Figure 1-6 Trapezium ab3h += +V +Equation 1-13g, Right-angle triangle (See Figure 1-7.) + +b2h += +A + +Figure 1-12 Pyramid + + + +Figure 1-7 Right-Angle Triangle + +Equation 1-13h, Isosceles triangle (See Figure 1-8.) + +bh += +A +2 + +Equation 1-13m, Cone (See Figure 1-13.) + +πDs += +A +2 +πR2h += +V +3 +where +D = b +R = b Figure 1-13 Cone +2 + +Equation 1-13n, Circle (See Figure 1-14.) +Figure 1-8 Isosceles Triangle C = 2πR +Chapter 1 — Formulas, Symbols and Terminology + + +Equation 1-13o, Circle (See Figure 1-14.) + +A = πR2 + + + + + +Figure 1-14 Circle +Equation 1-13p, Triangle3 (See Figure 1-15.) +Known: 2 angles Required: Third angle +Solution: A = 180° – (B + C) +Equation 1-13q, Triangle3 (See Figure 1-15.) +Known: 3 sides Required: Any angle +Solution: cos A = b2 + c2 – a2 +2bc + +Equation 1-13r, Triangle3 (See Figure 1-15.) +Known: 2 sides and included angle Required: Third side +Solution: c = (a2 + b2 – 2ab cos C)½ +Equation 1-13s, Triangle3 (See Figure 1-15.) +Known: 2 sides and included angle Required: Third angle +a sin C +Solution: tan A = b – a cos C +Equation 1-13t, Triangle3 (See Figure 1-15.) +Known: 2 sides and excluded angle Required: Third side +Solution: c = b cos A ± (a2 – b2 sin2 A)½ +Equation 1-13u, Triangle3 (See Figure 1-15.) +Known: 1 side and adjacent angles Required: Adjacent side +Solution: c = a sin C +sin A + + + + + + + +Figure 1-15 Triangle +Equation 1-14, Flow rate in outlet With Equa-tion 1-11, we determined that the flow rate (Q) in the outlet should be equal to the flow rate in the fixture drain. The maximum discharge rate is expressed as: +Equation 1-14 +QD = cDQI where +QD = Actual discharge quantity, gpm (L/s) cD = Discharge coefficient +QI = Ideal discharge quantity, gpm (L/s) + +5 + + +The discharge coefficients (cD) may be obtained from Baumeister and Marks’s “Handbook for Mechanical Engineers.” +Equation 1-15, Gravity circulation This prin-ciple is used to keep the sanitary system free of foul odors and the growth of slime and fungi. The circu-lation is induced by the pressure difference between the outdoor air and the air in the vent piping. This pressure difference is due to the difference in tem-perature (T) and density (ρ) between the two and the height (h) of the air column in the vent piping. The gravity circulation is determined by using the following formula: +Equation 1-15 +P = 0.1925 (γO – γI) hs where +P = Natural draft pressure, in. (mm) +γ +γ +O = Specific Weight of outside air, lbf/ft3 (N/m3) I = Specific Weight of air in pipe, lbf/ft3 (N/m3) +hs = Height of air column in stack, ft (m) +The outside and inside air densities (ρO and ρI) may be obtained from the ASHRAE “Handbook of Fun-damentals.” +Equation1-16,Velocityhead(h) Whenthewater in a piping system is at rest, it has potential energy (PE). When the water in a piping system is flowing, it has kinetic energy (KE). For the water to flow, some of the potential energy (PE) must be converted to kineticenergy(KE).Thedecreaseinpotentialenergy (static head) is referred to as the velocity head (h) and is expressed as: +Equation 1-16 +V +2 +h = 2g where +h = Height of the fall, ft (m) +V = Velocity at any moment, ft/s (m/s) +g = Gravitational acceleration, 32.2 ft/s2 (9.8 m/s2) +Equation1-17,Bernoulli’sEquation Sinceener-gycannotbecreatedordestroyed,Bernoullideveloped a theorem to express this energy conservation. It is represented by the following equation: +Equation 1-17 +ET = Zg+ P +V2 +ρ +g +2g +c +c +(ET = Zg+ P +V2 ) where +ρ +2 +ET = Total energy ft-lbf/lbm (J/kg) +Z = Height of point above datum, ft (m) P = Pressure, lbf/ft2 (kPa) +ρ = Density, lbm/ft3 (N/m3) V = Velocity, ft/s (m/s) +6 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +g = Gravitational acceleration, 32.2 ft/s2 (9.8 m/s2) +gc =Gravitational constant, 32.2 lbm-ft/lbf-s2 +(a) For two points in the system, Equation 1-17 can be expressed as: +Equation 1-17a +Z1g + P⁄ρ + V12 = Z2g + P2 + V22 c c c c +1 +ρ +g 2g g 2g +Subscripts 1 and 2 represent points in the system. +Equation 1-18, Friction head (hf) When water flows in a pipe, friction is produced by the rubbing of water particles against each other and against the walls of the pipe. This causes a pressure loss in the lineofflow,calledthefrictionhead,whichisexpressed by using Bernoulli’s equation: +Equation 1-18 +hf = ( gg + h1 + 2gc )– (gg+ h2 + 2gc ) +Z V Z V +1 1 2 2 +2 2 +c c +where +hf = Friction head, ft (m) Z = Height of point, ft (m) +h = P/ρ = static head or height of liquid column, ft (m) +V = Velocity at outlet, ft/s (m/s) +g = Gravitational acceleration, 32.2 ft/s2 (9.8 m/s2) +gc = Gravitational constant, 32.2 lbm ft/lbf·s2 +Subscripts 1 and 2 represent points in the system. +Equation 1-19, Flow from outlets This velocity can be expressed by the following: +Equation 1-19 +V = CD (2gh)½ where +V = Velocity at outlet, ft/s (m/s) +CD = Coefficient of discharge (usually 0.67) +g = Gravitational acceleration, 32.2 ft/s2 (9.8 m/s2) +h = Static head or height of liquid column, ft (m) +Equation1-20,Hydraulicshock Themagnitude of the pressure wave can be expressed by the follow-ing relationship: +Equation 1-20 γ adV +P = +144g where +P = Pressure in excess of flow pressure, lb/in2 (kPa) +γ = Specific weight of liquid, lbf/ft3 (N/m3) +a = Velocity of propagation of elastic vibration in the pipe, ft/s (m/s) +dV = Change in flow velocity, ft/s (m/s) +g = Gravitational acceleration, 32.2 ft/s2 (9.8 m/s2) + +(a) The velocity of propagation of elastic vibration in the pipe can be defined as: +Equation 1-20a +4660 +a = +(1 + KB)½ where +a = Propagation velocity, ft/s (m/s) 4660 = Velocity of sound in water, ft/s (m/s) +K = Ratio of modulus of elasticity of fluid to modulus of elasticity of pipe +B = Ratio of pipe diameter to wall thickness +Thevaluesforspecificweights(γ),K,andBaregiven or can be calculated from the ASHRAE “Handbook of Fundamentals.” +(b) The time interval required for the pressure wave to travel back and forth in the pipe can be ex-pressed as: +Equation 1-20b +t = 2L +a +where +t = Time interval, s +L = Length of pipe from point of closure to point of relief, ft (m) +Equation1-21,Pumpaffinitylaws Affinitylaws describe the relationships among the capacity, head, brake horsepower, speed, and impeller diameter of a given pump. +The first law states the performance data of con-stant impeller diameter with change in speed. +Equation 1-21a +Q2 = N2 and H2 =(N2) +Q N H +1 1 1 +N +1 +2 +and = +1 1 +( ) +2 +H +BHP N 3 +BHP N2 +or N1 = Q1 =(H1)½ =(BHP2)3 +BHP +1 +⁄ +1 +N Q +2 2 +2 +where +Q = Capacity, gpm (m3/H) N = Speed, rpm (r/s) +H = Head, ft (m) +BHP = Brake horspower, W +Thesecondlawassumestheperformancedataofcon-stant speed with change in diameter of the impeller. +Equation 1-21b +Q1 = D1 and H1 = D12 andBHP1= D13 2 2 2 2 2 2 +Q D H D BHP D +2 3 += = +or = +( ) ( ) +D1 Q1 H1 ½ BHP1 1⁄3 D2 Q2 H2 BHP2 +where +D = Impeller diameter, in. (m) +Equation1-22, Pumpefficiency Theefficiencyof a pump is represented by the following equation: +Chapter 1 — Formulas, Symbols and Terminology + + +Equation 1-22 + +Ep = BHP +WH +where +Ep = Pump efficiency as a decimal equivalent +WHP = Water horsepower derived from: +gal 8.33 lb HP +ft Hd × × × +WHP = +min gal 33,000 ft-lb/min BHP = Brake horsepower input to pump +From Equation 1-22, the brake horsepower can be represented as: +Equation 1-22a +WHP ft Hd × gpm +BHP = or +Ep 3960 × Ep + +Equation 1-23, Rational method of storm de-sign Calculates the peak storm-water runoff. +Equation 1-23 +Q = CIA +where +Q = Runoff, ft3/s (m3/s) +C = Runoff coefficient (surface roughness in drained area) +I = Rainfall intensity, in/h (mm/h) A = Drainage area, acres (m2) +Equation1-24,SpitzglassFormula Usedtosize gas piping in systems operating at a pressure of less than 1 psi. +Equation 1-24 +Q = 3550(1 + 3.6d + 0.03d ) (SL ) +5 +d h +½ ½ +⁄ +where +Q = Flow rate, ft3/h (m3/h) +d = Diameter of pipe, in. (mm) +h = Pressure drop over length, in. wc S = Specific gravity +L = Length of pipe, ft (m) +Equation 1-25, Weymouth Formula Used to size gas piping in systems operating at a pressure in excess of 1 psi. +Equation 1-25 +⁄ +[ ] +SL +Q = 28.05 (P12 – P22) d163 ½ + +where +Q = Flow rate, ft3/h (m3/h) P1 = Initial gas pressure, psi P2 = Final gas pressure, psi +d = Diameter of pipe, in. (mm) S = Specific gravity +L = Length of pipe, mi (km) + +7 + + +Equation 1-26, Slope The slope of a pipe is repre-sentted by the following formula: +s = h +l +h = l × s l = h +s + +where +s = Slope, in./ft (mm/m) h = Fall, in. (m) +l = Length, ft (m) +Equation 1-27, Discharge from Rectangular Weir with end contractions: +Q = 1494.6 (L-0.2H)H1.5 +where +Q = Rate of flow, ft3/s (m3/s) +L = Length of weir opening, ft (Should be longer than 2H) +H = Head of water, ft (m) +a = Should be at least 3H (Refer to Volume 2 Chapter 4 Storm-Drainage Systems (Table 4-5) of “Plumbing Engineering Design Handbook” for diagram.) +Equation 1-28, Heat Loss Formula: q = Tp – Ta +n +D +2 +( ) +D +1 +1 1 1 +πD1hi + l 2πk +πD2hco +πD2ho +where +q = Heat loss per unit length of pipe, BTU/h × ft (W/m) +Tp = Maintenance temperautre desired, °F (°C) Ta = Design ambient temperature, °F (°C) +D1 = Inside diameter of the insulation, ft (m) hi = Inside air-contact coefficient from pipe to +inside insulation surface, BTU/h × ft2 × °F (W/m2 × °C) +D2 = Outside diameter of the insulation, ft (m) k = Thermal conductivity of the insulation +evaluated at its mean temperature, BTU/h × ft × °F (W/m2 × °C) +hco = Inside air contact coefficient of weather barrier, BTU/h × ft2 × °F (W/m2 × °C) +ho = Outside air film coefficient from weather barrier to ambient, BTU/h × ft2 × °F (W/m2 × °C) + +SYMBOLS +The standardized plumbing and piping-related symbols in Tables 1-1 and 1-2 and the abbreviations inTable1-3havebeentabulatedbytheAmericanSo-cietyofPlumbingEngineersforuseinthedesignand preparation of drawings. Users of these symbols are cautionedthatsomegovernmentalagencies,industry groups, and other clients may have a list of symbols thatarerequiredfortheirprojects.Allsymbolsshould beappliedwithaconsiderationfordraftingandclarity if drawings are to be reduced. +8 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Table 1-1 Symbol +—————— SD —————— + +Standard Plumbing and Piping Symbols Description +Storm drain, rainwater drain + + +Abbreviation +SD, ST + +——— ———– SSD ———— Subsoil drain, footing drain SSD + +—————— SS —————— — — — — — — — — — — —————— AW —————— — — — — AV — — — — — –—————— D ——————– —————— PD —————— –—————— – ——————– —————— – – —————— –————— – – – —————– ————–—– TW —————— —————— TWR —————– —————— DWS —————– —————— DWR —————– —————— SCW ————— —————— CD —————— —————— DI ——————– —————— DE ——————– —————— RO ——————– —————— CWS —————– —————— CWR —————– —————— LS ——————– –—————— F ——————– –—————— G ——————– —————— MG –—————— —————— HG –—————— — — — — GV — — — — — —————— FOS —————— —————— FOR —————— +— — — — FOV — — — — — —————— LO –—————— — — — — LOV — — — — — —————— WO —————— — — — — WOV — — — — —————— O 2 –—————— —————— LO 2 —————— –—————— A ——————– —————— X#A —————— —————— MA –—————— —————— LA –—————— +—————— HPCA ————— + +Soil, waste, or sanitary sewer Vent +Acid waste Acid vent Indirect drain +Pump discharge line Cold water +Hot water supply (140°F)a +Hot water recirculating (140°F)a Tempered water (temp. °F)b +Tempered water recirculating (temp. °F)b (Chilled) drinking water supply +(Chilled) drinking water recirculating Soft cold water +Condensate drain Distilled water Deionized water Reverse osmosis water Chilled water supply Chilled water return Lawn sprinkler supply +Fire protection water supply Gas–low-pressure +Gas–medium-pressure Gas–high-pressure Gas vent +Fuel oil supply Fuel oil return Fuel oil vent Lubricating oil +Lubricating oil vent Waste oil +Waste oil vent Oxygen +Liquid oxygen Compressed airc Compressed air–X#c Medical compressed air Laboratory compressed air +High pressure compressed air + +S, W, SAN, SS V +AW AV D PD CW HW +HWR +TEMP. HW, TW TEMP. HWR, TWR DWS +DWR SCW CD Dl DE RO CWS CWR LS +F G +MG HG GV FOS FOR FOV LO LOV WO WOV O2 LO2 +A X#A MA LA HPCA +(CONTINUED) +Chapter 1 — Formulas, Symbols and Terminology 9 + + + +Table 1-1 +Symbol + +Standard Plumbing and Piping Symbols (continued) +Description Abbreviation + + + +—————– HHWS ————— —————– HHWR ————— –—————— V ——————– —————– NPCW ————— —————– NPHW ————— —————— NPHWR ———— ————— MV –—————— —————— SV –—————— —————— LV –—————— +–—————— N 2 ——————– —————— N 2O —————— —————— CO 2 —————— —————— WVC —————– +—————— DVC —————– —————— LPS —————– — — — — LPC — — — — —————— MPS —————– — — — — MPC — — — — —————— HPS —————– — — — — HPC — — — — +— — — — ATV — — — — + +(Heating) hot water supply HHWS (Heating) hot water return HHWR Vacuum VAC Non-potable cold water NPCW Non-potable hot water NPHW Non-potable hot water return NPHWR Medical vacuum MV Surgical vacuum SV Laboratory vacuum LV Nitrogen N2 Nitrous oxide N2O Carbon dioxide CO2 +Wet vacuum cleaning WVC Dry vacuum cleaning DVC Low-pressure steam supply LPS Low-pressure condensate LPC Medium-pressure steam supply MPS Medium-pressure condensate MPC High-pressure steam supply HPS High-pressure condensate HPC Atmospheric vent (steam or hot vapor) ATV +Gate valve GV + +Globe valve GLV + + +Angle valve AV + +Ball valve BV + +Butterfly valve BFV + +Gas cock, gas stop + +Balancing valve (specify type) BLV + +Check valve CV + +Plug valve PV + +Solenoid valve + + +Motor-operated valve (specify type) + +Pressure-reducing valve PRV + +(CONTINUED) +10 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Table 1-1 +Symbol + +Standard Plumbing and Piping Symbols (continued) +Description Abbreviation + + + +Pressure-relief valve + + +Temperature-pressure-relief valve + + +Backflow preventer + +Hose bibb + +Recessed-box hose bibb or wall hydrant + +Valve in yard box (valve type symbol as required for valve use) +Union (screwed) + +Union (flanged) + +Strainer (specify type) + +Pipe anchor + +Pipe guide + +Expansion joint + +Flexible connector + +RV + + +TPV + + +RZBP + +HB + +WH + +YB + + + + + + +PA + + +EJ + +FC + + +Tee + +Concentric reducer + +Eccentric reducer + +Aquastat + + +Flow switch FS + +Pressure switch PS + +Water hammer arrester WHA + +Pressure gauge with gauge cock PG + +Thermometer (specify type) + +Automatic air vent AAV + +Valve in riser (type as specified or noted) + + +Riser down (elbow) + +Riser up (elbow) + +Air chamber + + + + +AC + +(CONTINUED) +Chapter 1 — Formulas, Symbols and Terminology 11 + + + +Table 1-1 +Symbol + +Standard Plumbing and Piping Symbols (continued) +Description Abbreviation + +Rise or drop + + +Branch–top connection + + +Branch–bottom connection + + +Branch–side connection + +Cap on end of pipe + +Cleanout plug CO + +Floor cleanout FCO + +Wall cleanout WCO + + +Yard cleanout or cleanout to grade CO + +Drain (all types) (specify) D + +Pitch down or up–in direction of arrow Flow–in direction of arrow +Point of connection POC + +Outlet (specify type) + +Steam trap (all types) + +Floor drain with p-trap FD + +a Hot water (140°F) and hot water return (140°F). Use for normal hot water distribution system, usually but not necessarily (140°F). Change temperature designation if required. +b Hot water (temp. °F) and hot water return (temp. °F). Use for any domestic hot water system (e.g., tempered or sanitizing) required in addition to the normal system (see note “a” above). Insert system supply temperature where “temp.” is indicated. +c Compressed air and compressed air X#. Use pressure designations (X#) when compressed air is to be distributed at more than one pressure. +12 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 1-2 Standard Fire-Protection Piping Symbols +Referent (Synonym) Symbol Comments Water supply and distribution symbols +Mains, pipe + +Riser + +Hydrants + + +Public hydrant, two hose outlets + + +Public hydrant, two hose outlets, and pumper connection + + +Wall hydrant, two hose outlets + +Indicate size,a type of thread, or connection. + + + +Indicate size,a type of thread, or connection. + + + +Indicate size,a type of thread, or connection. + + + +Fire department connections + + +Siamese fire department connection + +Free-standing siamese ire department connection + +Fire pumps + +Fire pump + + +Test header + +Symbols for control panels + +Control panel + +(a) + +Symbols for fire extinguishing system Symbols for various types of extinguishing systemsb +Supplementary symbols + +Fully sprinklered space + +Specify type, size, and angle. + + +Sidewalk or pit type, specify size. + + +Free-standing. Specify number and sizes of outlets. + +Wall + + + +Basic shape + +Fire alarm control panel + + +Partially sprinklered space + +Nonsprinklered space +Chapter 1 — Formulas, Symbols and Terminology 13 + + +Table 1-2 Standard Fire-Protection Piping Symbols (continued) Referent (Synonym) Symbol Comments +Symbols for fire sprinkler heads + +Upright sprinklerc + +Pendent sprinklerc, d + +Upright sprinkler, nippled up + +Pendent sprinkler, on drop nipplec, d + + +Sidewall sprinklerc + +Symbols for piping, valves, control devices, and hangerse + +Pipe hanger + + +Alarm check valve + + +Dry pipe valve + +Deluge valve + +Preaction valve + +Symbols for portable fire extinguishers + +Portable fire extinguisher + +Symbols for firefighting equipment + +Hose station, dry standpipe + + + + +This symbol is a diagonal stroke imposed on the pipe that it supports. + +Specify size, direction of flow. + + +Specify size. + +Specify size and type. + +Specify size and type. + + +Portable fire extinguisher + + +Hose station, changed standpipe + +Source: National Fire Protection Association (NFPA), Standard 170. +a Symbol element can be utilized in any combination to fit the type of hydrant. +b These symbols are intended for use in identifying the type of system installed to protect an area within a building. +c Temperature rating of sprinkler and other characteristics can be shown via legends where a limited number of an individual type of sprinkler is called for by the design. +d Can notate “DP” on drawing and/or in specifications where dry pendent sprinklers are employed. e See also NFPA Standard 170, Section 5-4, for related symbols. +14 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 1-3 Abbreviations for Text, Drawings, and Computer Programs + +Term Text Drawings Program Term Text Drawings Program + +Above finished floor Absolute Accumulat(-e, -or) +Air condition(-ing, -ed) Air-conditioning unit(s) Air-handling unit +Air horsepower Alteration Alternating current Altitude +Ambient +American National Standards Institutea +American wire gage Ampere (amp, amps) Angle +Angle of incidence Apparatus dew point Approximate +Area Atmosphere Average Azimuth Azimuth, solar Azimuth, wall +Baromet(-er, -ric) Bill of material Boiling point Brake horsepower +Brown & Sharpe wire gage British thermal unit +Celsius +Center to center Circuit Clockwise Coefficient +Coefficient, valve flow Coil +Compressor +Condens(-er, -ing, -ation) Conductance Conductivity +Conductors, number of (3) Contact factor +Cooling load Counterclockwise Cubic feet +Cubic inch +Cubic feet per minute +cfm, standard conditions + +– abs acc – +– – +ahp altrn ac alt amb ANSI + +AWG amp – +– adp +approx. – +atm avg az – +– baro b/m bp bhp B&S Btu °C +c to c ckt cw coeff. Cv +– cprsr cond – cndct 3/c +– +clg load ccw +ft3 in3 cfm +scfm + +AFF ABS ACCUM +AIR COND ACU +AHU AHP ALTRN AC ALT AMB ANSI + +AWG AMP – +– ADP +APPROX – +ATM AVG AZ +– – +BARO BOM BP BHP B&S BTU °C +C TO C CKT CW COEF Cv +– CMPR COND – CNDCT 3/c +– +CLG LOAD CCW +CU FT CU IN CFM +SCFM + +– ABS +ACCUM – +ACU AHU AHP – AC ALT +AMB – + +– +AMP, AMPS ANG +ANGI ADP – +A – +AVG AZ SAZ WAZ – +– BP BHP – BTU °C +– CKT – COEF CV COIL +CMPR COND C +K – CF +CLOAD – +CUFT, CFT CUIN, CIN CFM +SCFM + + +Cubic ft per sec, standard Decibel +Degree Density Depth or deep +Dew-point temperature Diameter +Diameter, inside Diameter, outside Difference or delta Diffuse radiation Direct current Direct radiation Dry +Dry-bulb temperature Effectiveness Effective temperatureb Efficiency +Efficiency, fin Efficiency, surface Electromotive force Elevation +Entering +Entering air temperature Entering water temperature Enthalpy +Entropy +Equivalent direct radiation Equivalent feet +Equivalent inches Evaporat(-e, -ing, -ed, -or) Expansion +Face area Face to face Face velocity +Factor, correction + +Factor, friction Fahrenheit Fan +Feet per minute Feet per second +Film coefficient, insidec Film coefficient, outsidec Flow rate, air +Flow rate, fluid Flow rate, gas Foot or feet Foot-pound +Freezing point + + +scfs dB +deg. or ° dens +dp dpt dia. ID OD +diff., ∆ – +dc +dir radn – +dbt – ET* eff – +– emf elev. entr EAT EWT – +– edr +eqiv ft eqiv in evap exp +fa +f to f fvel – + +– °F – fpm fps – +– – – – ft +ft-lb +fp + + +SCFS DB +DEG or ° DENS DP +DPT DIA ID OD DIFF – DC +DIR RADN – +DBT – ET* EFF – +– EMF EL ENT EAT EWT – +– EDR +EQIV FT EQIV IN EVAP EXP +FA +F to F FVEL – + +– °F – +FPM FPS – +– – – – FT +FT LB +FP + + +SCFS DB DEG RHO DPTH DPT DIA ID OD +D, DELTA DFRAD DC DIRAD DRY +DB, DBT EFT +ET EFF FEFF SEFF – ELEV ENT EAT EWT H +S – +EQFT EQIN EVAP XPAN FA +– FV +CFAC, CFACT +FFACT, FF F +FAN FPM FPS FI, HI FO, HO +QAR, QAIR QFL +QGA, QGAS FT +– +FP + +(CONTINUED) (CONTINUED) +Chapter 1 — Formulas, Symbols and Terminology 15 + + +Table 1-3 Abbreviations for Text, Drawings, and Computer Programs (con’t) +Term Text Drawings Program Term Text Drawings Program + +Frequency Hz Gage or gauge ga Gallons gal Gallons per hour gph gph, standard std gph Gallons per day gpd Grains gr Gravitational constant g +Greatest temperature GTD difference +Head hd Heat – Heater – Heat gain HG Heat gain, latent LHG Heat gain, sensible SHG Heat loss – Heat transfer – Heat transfer coefficient U Height hgt High-pressure steam hps High-temperature hot water hthw Horsepower hp Hour(s) h Humidity ratio W Humidity, relative rh Incident angle – Indicated horsepower ihp International Pipe Std. IPS Iron pipe size ips Kelvin K Kilowatt kW Kilowatt hour kWh Latent heat LH Least mean temp. differenced LMTD Least temperature differenced LTD Leaving air temperature lat Leaving water temperature lwt Length lg Linear feet lin ft Liquid liq Logarithm (natural) ln Logarithm to base 10 log Low-pressure steam lps Low-temperature hot water lthw Mach number Mach Mass flow rate mfr Maximum max. Mean effective temperature MET +Mean temp. difference MTD + +HZ – +GA GA, GAGE GAL GAL +GPH GPH SGPH SGPH GPD GPD GR GR +G G GTD GTD + +HD HD – HT – HTR +HG HG, HEATG LHG HGL +SHG HGS +– HL, HEATL – Q +U U +HGT HGT, HT HPS HPS HTHW HTHW HP HP +HR HR W W RH RH +– INANG IHP – +IPS – IPS – K K +kW KW KWH KWH +LH LH, LHEAT LMTD LMTD +LTD LTD LAT LAT LWT LWT LG LG, L LF LF LIQ LIQ LN LN LOG LOG LPS LPS LTHW LTHW MACH – MFR MFR MAX MAX MET MET MTD MTD +(CONTINUED) + +Medium-pressure steam +Medium-temperature hot water +Mercury Miles per hour Minimum Noise criteria +Normally closed Normally open Not applicable Not in contract Not to scale Number +Number of circuits Number of tubes Ounce +Outside air Parts per million Percent +Phase (electrical) Pipe +Pounds +Pounds per square foot psf absolute +psf gage +Pounds per square inch psi absolute +psi gage Pressure +Pressure, barometric Pressure, critical +Pressure drop or difference Pressure, dynamic (velocity) Pressure, static +Pressure, vapor Primary +Quart Radian +Radiat(-e, -or) Radiation Radius Rankine Receiver Recirculate +Refrigerant (12, 22, etc.) Relative humidity Resist(-ance, -ivity, -or) Return air +Revolutions +Revolutions per minute + +mps mthw + +Hg mph min. NC n c n o na +n i c – no. – +– oz oa +ppm % ph +– lb psf +psfa psfg psi psia psig – +baro pr – +PD vp sp +vap pr pri +qt – – – – °R +rcvr recirc. +R-12, R-22 rh +res ra rev +rpm + +MPS MTHW + +HG MPH MIN NC N C N O N/A N I C NTS NO – +– OZ OA +PPM % PH +– LBS PSF PSFA PSFG PSI PSIA PSIG +PRESS BARO PR – +PD VP SP +VAP PR PRI +QT – RAD +RADN – +°R RCVR RECIRC +R12, R22 RH +RES RA REV +RPM + +MPS MTHW + +HG MPH MIN – +– – – – – +N, NO NC NT OZ OA PPM PCT +– PIPE LBS PSF PSFA PSFG PSI PSIA PSIG +PRES, P BP CRIP +PD, DELTP VP +SP VAP PRIM QT RAD – RAD R +R REC +RCIR, RECIR R12, R22 RH +RES, OHMS RA +REV RPM +(CONTINUED) +16 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 1-3 Abbreviations for Text, Drawings, and Computer Programs (con’t) + +Term Text Drawings Program Term Text Drawings Program + +Revolutions per second rps Roughness rgh Safety factor sf Saturation sat. Saybolt seconds Furol ssf Saybolt seconds Universal ssu Sea level sl Second s Sensible heat SH Sensible heat gain SHG Sensible heat ratio SHR Shading coefficient – Shaft horsepower sft hp Solar – Specification spec Specific gravity SG Specific heat sp ht +sp ht at constant pressure cp + +RPS RPS RGH RGH, E SF SF SAT SAT SSF SSF SSU SSU SL SE +s SEC SH SH SHG SHG SHR SHR – SC SFT HP SHP – SOL SPEC – SG – SP HT C +cp CP + +Ton +Tons of refrigeration Total +Total heat Transmissivity U-factor +Unit Vacuum Valve Vapor proof Variable +Variable air volume Velocity +Velocity, wind Ventilation, vent Vertical Viscosity +Volt + +– – tons TONS – – +tot ht TOT HT – – +– – – – +vac VAC v V +vap prf VAP PRF var VAR VAV VAV +vel. VEL +w vel. W VEL vent VENT vert. VERT visc VISC +V V + +TON TONS TOT – TAU U UNIT VAC VLV +– VAR VAV +VEL, V W VEL VENT VERT +MU, VISC +E, VOLTS + + + +sp ht at constant volume Specific volume +Square Standard +Standard time meridian Static pressure +Suction +Summ(-er, -ary, -ation) Supply +Supply air Surface Surface, dry Surface, wet System Tabulat(-e, -ion) Tee Temperature +Temperature difference Temperature entering Temperature leaving Thermal conductivity Thermal expansion coeff. Thermal resistance Thermocouple Thermostat +Thick(-ness) Thousand circular mils Thousand cubic feet Thousand foot-pounds Thousand pounds +Time + + +cv cv +sp vol SP VOL sq. SQ +std STD – – SP SP +suct. SUCT – – sply SPLY sa SA +– – – – – – – – +tab TAB – – temp. TEMP TD, ∆t TD +TE TE TL TL k K – – R R tc TC +T STAT T STAT thkns THKNS Mcm MCM Mcf MCF kip ft KIP FT kip KIP +– T + + +CV +V, CVOL SQ +STD STM SP +SUCT, SUC SUM +SUP, SPLY SA +SUR, S SURD SURW SYS TAB TEE +T, TEMP TD, TDIF TE, TENT TL, TLEA K +TXPC RES, R TC, TCPL T STAT THK MCM MCF KIPFT KIP +T +(CONTINUED) + +Volt ampere VA VA VA Volume vol. VOL VOL Volumetric flow rate – – VFR Wall – – W, WAL Water – – WTR Watt W W WAT, W Watt-hour Wh WH WHR Weight wt WT WT +Wet bulb wb WB WB Wet-bulb temperature wbt WBT WBT Width – – WI Wind – – WD Wind direction wdir WDIR WDIR +Wind pressure wpr WPR WP, WPRES Yard yd YD YD +Year yr YR YR Zone z Z Z, ZN +Source: ASHRAE, 1997, Handbook of fundamentals. aAbbreviations of most proper names use capital letters in both text and drawings. +bThe asterisk (*) is used with “ET,” effective temperature. cThese are surface heat transfer coefficients. +dThe letter “L” is also used for “logarithm of” these temperature differences in computer programming. +Chapter 1 — Formulas, Symbols and Terminology + + +PLUMBING TERMINOLOGY4 +The following list of definitions and abbreviations that are frequently used in the plumbing industry hasbeencompiledbytheAmericanSocietyofPlumb-ing Engineers for use by those working in this and related fields. +ABS Abbreviation for “acrylonitrile-butadiene-styrene.” +Absolute pressure The total pressure measured from absolute vacuum. It equals the sum of gauge pressure and atmospheric pressure corresponding to the barometer, and is expressed in pounds per square inch (kiloPascals). +Absolute temperature Temperature measured from absolute zero. A point of temperature theoreti-callyequalto-459.72°F(-273.18°C).Thehypothetical point at which a substance would have no molecular motion and no heat. +Absolutezero Zeropointontheabsolutetempera-ture scale. A point at which there is a total absence of heat, equivalent to -459.72°F (-273.18°C). +Absorption Immersion in a fluid for a definite period of time, usually expressed as a percent of the weight of the dry pipe. +Access door Hinged panel mounted in a frame with a lock, normally in a wall or ceiling, to provide access to concealed valves or equipment that require frequent attention. +Accessible 1.a)(Whenappliedtoafixture,connec-tion, appliance, or piece of equipment) Having access thereto, though access may necessitate the removal of an access panel, door, or similar obstruction; b) (readily accessible) having direct access to without the necessity of removing or moving any panel, door, or similar obstruction. 2. (re: the physically chal-lenged)Termusedtodescribeasite,building,facility, or portion thereof, or a plumbing fixture that can be approached, entered, and/or used by physically chal-lenged individuals. +Accumulator A container in which fluid or gas is stored under pressure as a source of power. +Acid vent A pipe venting an acid-waste system. +Acidwaste Apipethatconveysliquidwastematter containing a pH of less than 7.0. +Acme thread A screw thread, the thread section of which is between the square and V threads, used extensively for feed screws. The included angle of space is 29°, compared to 60° of the National Coarse of U.S. Thread. +Acrylonitrile-butadiene-styrene Athermoplastic compound from which fittings, pipe, and tubing are made. + +17 + + +Activesludge Sewagesediment,richindestructive bacteria,thatcanbeusedtobreakdownfreshsewage more quickly. +Adapterfitting 1.Anyofvariousfittingsdesigned to mate, or fit to each other, two pipes or fittings that are different in design, when the connection would otherwise be impossible. 2. A fitting that serves to connect two different tubes or pipes to each other, such as copper tube to iron pipe. +Administrative authority The individual of-ficial, board, department, or agency established and authorized by a state, county, city, or other political subdivision created by law to administer and enforce the provisions of the plumbing code. Also known as AUTHORITY HAVING JURISDICTION. +Aeration An artificial method of bringing water and air into direct contact with each other. One pur-pose is to release certain dissolved gases that often cause water to have obnoxious odors or disagreeable tastes. Also used to furnish oxygen to waters that are oxygen deficient. The process may be accomplished bysprayingtheliquidintheair,bubblingairthrough the liquid, or agitating the liquid to promote surface absorption of the air. +Aerobic (re: bacteria) Living or active only in the presence of free oxygen. +AGA Abbreviation for American Gas Association. +Air break A physical separation in which a drain from a fixture, appliance, or device indirectly dis-charges into a fixture, receptacle, or interceptor at a point below the flood level rim of the receptacle to prevent backflow or back-siphonage. Also known as AIR GAP. +Air chamber A continuation of the water piping beyond the branch to fixtures that are finished with a cap designed to eliminate shock or vibration (wa-ter hammer) of the piping when the faucet is closed suddenly. +Air, compressed Air at any pressure greater than atmospheric pressure. +Air, free Air that is not contained and subject only to atmospheric conditions. +Air gap The unobstructed vertical distance, through the free atmosphere, between the lowest opening from a pipe or faucet conveying water or waste to a tank, plumbing-fixture receptor, or other device and the flood-level rim of the receptacle. (Usu-ally required to be a minimum of twice the diameter of the inlet.) +Air, standard Air having a temperature of 70°F (21.1°C) at standard density of 0.0075 lb/ft (0.11 kg/m) and under pressure of 14.70 psia (101.4 kPa). +18 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +The gas industry usually considers 60°F (15.6°C) the temperature of standard air. +Air test A test using compressed air or nitrogen applied to a plumbing system upon its completion but before the building is sheetrocked. +Alarm (FP) 1. Any audible or visible signal in-dicating existence of a fire or emergency requiring evacuationofoccupantsandresponseandemergency action on the part of the firefighting service. 2. The alarm device(s) by which fire and emergency signals are received. +Alarm check valve (FP) A check valve, equipped withasignalingdevice,thatwillannunciatearemote alarm when a sprinkler head(s) is discharging. +Alloy A substance composed of two or more metals or a metal and nonmetal intimately united, usually fused together and dissolving in each other when molten. +Alloy pipe A steel pipe with one or more elements, other than carbon, that give it greater resistance to corrosion and more strength than carbon steel pipe. +Ambient temperature The prevailing tempera-ture in the immediate vicinity of or the temperature of the medium surrounding an object. +Americanstandardpipethread Atypeofscrew thread commonly used on pipe and fittings. +Anaerobic (re: bacteria) Living or active in the absence of free oxygen. +Anchor A device used to fasten or secure pipes to the building or structure. +Angle of bend In a pipe, the angle between radial lines from the beginning and end of the bend to the center. +Angle stop Common term for right-angle valves used to control water supplies to plumbing fixtures. +Angle valve A device, usually of the globe type, in which the inlet and outlet are at right angles. +ANSI Abbreviation for American National Stan-dards Institute. +Approved Accepted or acceptable under an appli-cable specification or standard stated or cited for the proposed use under the procedures and authority of the administrative authority. +Approved testing agency An organization estab-lished for purposes of testing to approved standards and acceptable to the administrative authority. +Areadrain Areceptacledesignedtocollectsurface or rainwater from a determined or calculated open area. + +Arterial vent A vent serving the building drain and the public sewer. +ASHRAE Abbreviation for American Society of Heating, Refrigerating and Air Conditioning Engineers. +ASME Abbreviation for American Society of Me-chanical Engineers. +ASPE AbbreviationforAmericanSocietyofPlumb-ing Engineers. +ASPERF Abbreviation for American Society of Plumbing Engineers Research Foundation. +Aspirator A fitting or device supplied with water or other fluid under positive pressure that passes through an integral orifice or “constriction,” causing a vacuum. +ASSE Abbreviation for American Society of Sanitary Engineering or American Society of Safety Engineers. +ASTM Abbreviation for American Society for Test-ing and Materials. +Atmospheric vacuum breaker A mechanical device consisting of a check valve that opens to the atmosphere when the pressure in the piping drops to atmospheric. +Authority having jurisdiction (FP) The organi-zation, office, or individual responsible for approving equipment, materials, installation, or procedure. +AWWA Abbreviation for American Water Works Association. +Backfill Material used to cover piping laid in an earthen trench. +Backflow The flow of water or other liquids, mix-tures,orsubstancesfromanysource(s)otherthanthe one(s)intendedintothedistributingpipesofapotable supply of water. See BACK-SIPHONAGE. +Backflowconnection Aconnectioninanyarrange-ment whereby backflow can occur. +Backflow preventer A device or means to prevent backflow into the potable water system. +Backingring Ametalstripusedtopreventmelted metal,fromtheweldingprocess,fromenteringapipe in the process of making a butt-welded joint. +Back-siphonage The flowing back of used, con-taminated,orpollutedwaterfromaplumbingfixture or vessel into the potable water supply pipe due to a negative pressure in the pipe. See BACKFLOW. +Backup A condition where the waste water may flow back into another fixture or compartment but not backflow into the potable water system. +Chapter 1 — Formulas, Symbols and Terminology + + +Backwater valve A device that permits drainage in one direction but has a check valve that closes againstbackpressure.Sometimesusedconjunctively with gate valves designed for sewage. +Baffle plate A tray or partition placed in process equipment or tanks to direct or change the direction of flow. +Ball check valve A device used to stop the flow of media in one direction while allowing flow in an op-positedirection.Theclosurememberusedisspherical or ball-shaped. +Ball valve A spherical gate valve providing very tight shut-off; a quick-closing (quarter-turn) valve. +Barrier free See ACCESSIBLE, def. 2. +Base The lowest portion or lowest point of a stack of vertical pipe. +Batteryoffixtures Anygroupoftwoormoresimi-lar, adjacent fixtures that discharge into a common horizontal waste or soil branch. +Bell Thatportionofapipethat,forashortdistance, is sufficiently enlarged to receive the end of another pipe of the same diameter for the purpose of making a joint. +Bell-and-spigot joint A commonly used joint in cast-iron soil pipe. Each piece is made with an enlarged diameter or bell at one end into which the plain or spigot end of another piece is inserted. The joint is then made tight by cement, oakum, lead, or rubber caulked into the bell around the spigot. See also HUB-AND-SPIGOT. + +19 + + +Branch vent A vent connecting one or more indi-vidual vents with a vent stack or stack vent. +Brazing ends The ends of a valve or fitting that are prepared for silver brazing. +Bronze trim or bronze-mounted An indication that certain internal (water contact) parts of the valvesknownastrimmaterials(stem,disc,seatrings, etc.) are made of copper alloy. +Btu Abbreviation for “British thermal unit.” The amount of heat required to raise the temperature of 1 pound (0.45 kg) of water 1 degree Fahrenheit (0.565°C). +Btu/h Abbreviation for “British thermal units per hour.” +Bubble tight The condition of a valve seat that prohibits the leakage of visible bubbles when the valve is closed. +Building (house) A structure built, erected, and framed of component structural parts designed for thehousing,shelter,enclosure,orsupportofpersons, animals, or property of any kind. +Building (house) drain That part of the lowest pipingofadrainagesystemthatreceivesthedischarge from soil, waste, and other drainage pipes inside the walls of the building (house) and conveys it to the building (house) sewer, which begins outside the building (house) walls. +Building (house) drain, combined A building (house) drain that conveys both sewage and storm water or other drainage. + + + +Black pipe Steel pipe that has not been galva-nized. + +Building (house) drain, sanitary A building (house) drain that conveys only sewage. + + + +Blank flange A solid plate flange used to seal off flow in a pipe. +Boiler blow-off An outlet on a boiler to permit emptying or discharge of sediment. +Boiler blow-off tank A vessel designed to receive the discharge from a boiler blow-off outlet and cool the discharge to a temperature that permits its safe discharge to the drainage system. +Bonnet Thatpartofavalvethatconnectsthevalve actuatortothevalvebody;insomevalves,itmayalso contain the stem packing. +Branch Any part of a piping system other than a main, riser, or stack. +Branch interval A length of soil or waste stack corresponding, in general, to a story height, but in no case less than 8 feet (2.4 m), within which the hori-zontal branches from one floor or story of a building are connected to the stack. +Branch tee A tee having one side branch. + +Building(house)drain,storm Abuilding(house) drainthatconveysstormwaterorotherdrainagebut no sewage. +Building (house) sewer That part of the hori-zontal piping of a drainage system that extends from the end of the building (house) drain and receives the discharge from the building (house) drain and conveys it to a public sewer, private sewer, individual sewage-disposal system, or other approved point of disposal. +Building (house) subdrain That portion of a drainage system below the building (house) sewer that cannot drain by gravity in the building (house) sewer. +Building(house)trap Adevice,fitting,orassem-bly of fittings installed in the building (house) drain to prevent circulation of air between the drainage of the building (house) and the building (house) sewer. It is usually installed as a running trap. +20 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Bull head tee A tee in which the branch is larger than the run. +Burst pressure That pressure that can slowly be appliedtoavalveatroomtemperaturefor30seconds without causing rupture. +Bushing A pipe fitting for connecting a pipe with a female fitting of a larger size. It is a hollow plug with internal and external threads. Used in lieu of a reducer/increaser. +Butterfly valve A device deriving its name from the wing-like action of the disc, which operates at rightanglestotheflow.Thediscimpingesagainstthe resilient liner with low-operating torque. +Butt weld joint A welded pipe joint made with the ends of the two pipes butting each other, the weld being around the periphery. +Butt weld pipe Pipe welded along a seam butted edge to edge and not scarfed or lapped. +Bypass An auxiliary loop in a pipeline intended for diverting flow around a valve or other piece of equipment. +Bypass valve A device used to divert the flow past the part of the system through which it normally passes. +Capacity 1. The maximum or minimum flow obtainableundergivenconditionsofmedia,tempera-ture, pressure, velocity, etc. 2. The volume of media that may be stored in a container or receptacle. +Capillary The action by which the surface of a liquid, where it is in contact with a solid, is elevated or depressed, depending on the relative attraction of the molecules of the liquid for each other and for those of the solid. +Cathodic protection 1. The control of the elec-trolytic corrosion of an underground or underwater metallic structure by the application of an electric current in such a way that the structure is made to act as the cathode instead of the anode of an electro-lytic cell. 2. The use of materials and liquid to cause electricity to flow to avoid corrosion. +Caulking The method of rendering a joint tight againstwaterorgasbymeansofapplyingplasticsub-stances such as lead and oakum; a method of sealing between fixtures and adjacent surfaces. +Cavitation A localized gaseous condition (usually involving air) that is found within a liquid stream. +CDA Abbreviation for Copper Development As-sociation. +Cementjoint Theunionoftwofittingsbytheinser-tionofmaterial.Sometimesthisjointisaccomplished mechanically, sometimes chemically. + +Cesspool A lined excavation in the ground that receives the discharge of a drainage system, or part thereof,andissodesignedtoretaintheorganicmatter and solids discharged therein but permit the liquids to seep through the bottom and sides. +Chainwheel-operatedvalve Adeviceoperatedby a chain-driven wheel that opens and closes the valve seats. Usually required for larger valves. +Channel That trough through which any media may flow. +Chase A recess in a wall or a space between two walls in which pipes can be run. +Check valve A device designed to allow a fluid to pass through in one direction only. +Chemical waste system Piping that conveys cor-rosive or harmful industrial, chemical, or processed wastes to the drainage system. +Circuit Thedirectedroutetakenbyaflowofmedia from one point to another. +Circuitvent Abranchventthatservestwoormore trapsandextendsfrominfrontofthelastfixturecon-nection of a horizontal branch to the vent stack. +CISPI Abbreviation for Cast Iron Soil Pipe Institute. +Clamp gate valve A gate valve whose body and bonnet are held together by a U-bolt clamp. +Cleanout Aplugorcover(joinedtoanopeningina pipe) that can be removed for the purpose of cleaning or examining the interior of the pipe. +Clear-waterwaste Coolingwaterandcondensate drainage from refrigeration and air-conditioning equipment; cooled condensate from steam-heating systems; cooled boiler blowdown water; waste-water drainage from equipment rooms and other areas where water is used without an appreciable addition of oil, gasoline, solvent, acid, etc.; and treated efflu-ent in which impurities have been reduced below a minimum concentration considered harmful. +Close nipple A nipple with a length twice the length of a standard pipe thread. +Cock An original form of valve having a hole in a tapered plug that is rotated to provide passageway for fluid. +Code Those regulations, subsequent amendments thereto,andanyemergencyruleorregulationthatthe department having jurisdiction may lawfully adopt. +Coefficient of expansion The increase in unit length, area of volume for a 1-degree rise in tem-perature. +Chapter 1 — Formulas, Symbols and Terminology + + +Coliform group of bacteria All organisms con-sidered in the coli aerogenes group as set forth by the American Water Works Association. +Combinationfixture Afixturethatcombinesone sink and tray or a two- or three-compartment sink and/or tray in one unit. +Combined waste and vent system A specially designedsystemofwastepiping,embodyingthehori-zontal wet venting of one or more sinks, floor sinks, or floor drains by means of a common waste and vent pipe, adequately sized to provide free movement of air above the flow line of the drain. +Combustion efficiency The rated efficiency of a waterheaterorboilerdeterminedbytheequipment’s ability to completely burn fuel, leaving no products of combustion in the flue gas. +Commonvent Aventthatconnectsatthejunction of two fixture drains and serves as a vent for both fixtures. Also known as a DUAL VENT. +Companion flange A pipe flange to connect with another flange or with a flanged valve or fitting. It is attached to the pipe by threads, welding, or another method and differs from a flange that is an integral part of a pipe or fitting. +Compression joint A multi-piece joint with cup-shaped,threadednutsthat,whentightened,compress tapered sleeves so they form a tight joint on the pe-riphery of the tubing they connect. +Compressor Amechanicaldeviceforincreasingthe pressure of air or gas. +Condensate Waterthathasliquefied(cooled)from steam. +Conductor The piping from the roof to the build-ing storm drain, combined building sewer, or other approved means of disposal; it is located inside the building. +Conduit A pipe or channel for conveying media. +Confluent vent A vent serving more than one fixture vent or stack vent. +Contaminator A medium or condition that spoils the nature or quality of another medium. +Continuous vent A vent that is a continuation of the drain to which it connects. +Continuous waste A drain from two or three fix-tures connected to a single trap. +Control A device used to regulate the function of a component or system. +Controller (FP) The cabinet containing motor starter(s),circuitbreaker(s),disconnectswitch(s),and othercontroldevicesforthecontrolofelectricmotors and internal-combustion-engine-driven fire pumps. + +21 + + +Corporation cock A stopcock screwed into the street water main to supply the house service con-nection. +Coupling A pipe fitting with female threads used only to connect two pipes in a straight line. +CPVC Abbreviation for “chlorinated polyvinyl-chloride.” +Critical level The point on a backflow-preven-tion device or vacuum breaker that determines the minimum elevation above the flood level rim of the fixture or receptacle served at which the device may beinstalled;thepointconformstoapprovedstandards and is established by the recognized (approved) test-inglaboratory(usuallystampedormarkedCLorC/L onthedevicebythemanufacturer).Whenabackflow-preventiondevicedoesnotbearcritical-levelmarking, the bottom of the vacuum breaker or combination valve or the bottom of any such approved device shall constitute the critical level. +Cross A pipe fitting with four branches in pairs, each pair on one axis, and the axis at right angles. +Cross-connection Any physical connection or ar-rangement between two otherwise separated piping systems—oneofwhichcontainspotablewaterandthe otherofwhichcontainswateroranothersubstanceof unknown or questionable safety—whereby flow may occur from one system to the other, the direction of flow depending on the pressure differential between the two systems. See BACKFLOW and BACK-SI-PHONAGE. +Crossover A pipe fitting with a double offset, or shaped like the letter “U” with the ends turned out, used to pass the flow of one pipe past another when the pipes are in the same plane. +Crossvalve Avalvefittedonatransversepipesoas to open communication between two parallel pipes. +Crown Thatpartofatrapinwhichthedirectionof flow is changed from upward to horizontal. +Crown vent A vent pipe connected at the topmost point in the crown of a trap. +CS Abbreviation for Commercial Standards. +Curb box A device at the curb that contains a valve is used to shut off a supply line, usually of gas or water. +Dampen 1.Tocheckorreduce.2.Todeadenvibra-tion. +Dead end A branch leading from a soil, waste, or vent pipe; building (house) drain; or building (house) sewer that is terminated at a developed distance of 2 feet (0.6 m) or more by means of a plug or other closed fitting. +22 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Department having jurisdiction The adminis-trative authority—and any other law enforcement agency—affected by any provision of a code, whether such agency is specifically named or not. +Detector, smoke (FP) Listed device for sensing visible or invisible products of combustion. +Developedlength Thelengthalongthecenterline of the pipe and fittings. +Dewpoint The temperature of a gas or liquid at which condensation or evaporation occurs. +Diameter Unless specifically stated otherwise, the nominal diameter as designated commercially. +Diaphragm A flexible disc that is used to separate the control medium from the controlled medium and actuates the valve stem. +Diaphragm-controlvalve Acontrolvalvehaving a spring-diaphragm actuator. +Dielectricfitting Afittinghavinginsulatingparts ormaterialthatprohibitstheflowofelectriccurrent. Used to separate dissimilar metals. +Differential Thevariancebetweentwotargetval-ues, one of which is the high value of conditions, the other of which is the low value of conditions. +Digestion That portion of the sewage treatment process where biochemical decomposition of organic matter takes place, resulting in the formation of simple organic and mineral substances. +Disc That part of a valve that actually closes off the flow. +Dishwasher An appliance for washing dishes, glassware, flatware, and some utensils. +Displacement Thevolumeorweightofafluid,such as water, displaced by a floating body. +Disposer A motor-driven appliance for reducing food and other waste by grinding so that it can flow through the drainage system. +Domestic sewage The liquid and waterborne wastes derived from ordinary living processes that are free of industrial wastes and of such a character as to permit satisfactory disposal, without special treatment, into the public sewer or by means of a private sewage disposal system. +Dosing tank A watertight tank in a septic system placed between the septic tank and the distribution box and equipped with a pump or automatic siphon designed to discharge sewage intermittently to a dis-posal field. This is done so that rest periods may be provided between discharges. +Doubledisc Atwo-piecediscusedinthegatevalve. Thewedgesbetweenthediscfaces,uponcontactwith + +the seating faces in the valve, force them against the body seats to shut off the flow. +Double offset Two changes of direction installed in succession, or series, in continuous pipe. +Double-ported valve A valve having two ports to overcome line-pressure imbalance. +Double-sweep tee A tee made with easy (lon-ra-dius) curves between body and branch. +Double wedge A device used in gate valves that is similar to a double disc, in that the last downward turn of the stem spreads the split wedges, and each seals independently. +Down Term referring to piping running through the floor to a lower level. +Downspout The rainleader from the roof to the building storm drain, combined building sewer, or other means of disposal; it is located outside of the building. +Downstream Term referring to a location in the direction of flow after passing a referenced point. +Drain Any pipe that carries waste water or water-borne wastes in a building drainage system. +Drain field The area of a piping system arranged in troughs for the purpose of disposing unwanted liquid waste. +Drainage fitting A type of fitting used for drain-ing fluid from pipes. The fitting makes possible a smooth and continuous interior surface for the pip-ing system. +Drainage system The drainage piping within public or private premises (usually to 5 feet outside building walls) that conveys sewage, rainwater, or other liquid wastes to an approved point of disposal but does not include the mains of a public sewer system or a private or public sewage-treatment or disposal plant. +Drift The sustained deviation in a corresponding controller resulting from the predetermined rela-tion between values and the controlled variable and positions of the final control element. Also known as WANDER. +Droop Theamountbywhichthecontrolledvariable pressure, temperature, liquid level, or differential pressure deviates from the set value at minimum controllable flow to the rated capacity. +Drop Term referring to piping running to a lower elevation within the same floor level. +Drop elbow A small elbow having wings cast on eachside,thewingshavingcountersunkholessothey may be fastened by wood screws to a ceiling, wall, or framing timbers. +Chapter 1 — Formulas, Symbols and Terminology + + +Drop tee A tee having wings of the same type as the drop elbow. +Dross 1. The solid scum that forms on the surface of a metal, as lead or antimony, when it is molten or melting, largely as a result of oxidation but some-times because of the rising of dirt and impurities to the surface. 2. Waste or foreign matter mixed with a substanceorleftasaresidueafterthatsubstancehas been used or processed. +Dry-bulb temperature The temperature of air as measured by an ordinary thermometer. +Dry-pipe valve (FP) A valve used with a dry-pipe sprinkler system where water is on one side of the valve and air is on the other side. When a sprinkler head’s fusible link melts, releasing air from the sys-tem, this valve opens, allowing water to flow to the sprinkler head. +Dry-weather flow Sewage collected during the summer that contains little or no ground water by infiltration and no storm water at the time of col-lection. +Dry well See LEACHING WELL. Dual vent See COMMON VENT. +Durham system A term used to describe soil or waste systems where all piping is of threaded pipe, tubing or, other such material of rigid construction, and where recessed draining fittings corresponding to the type of piping are used. +Durion A high-silicon alloy that is resistant to practicallyallcorrosivewastes.Thesiliconcontentis approximately 14.5 percent, and the acid resistance is in the entire thickness of the metal. +Dwelling A one-family unit with or without acces-sory buildings. +DWV Abbreviationfor“drainage,waste,andvent.” A name for copper or plastic tubing used for drain, waste, or venting pipe. +Eccentricfittings Fittingswheretheopeningsare offset, allowing liquid to flow freely. +Effective opening The minimum cross-sectional areaatthepointofwater-supplydischarge,measured or expressed in terms of the diameter of a circle or, if the opening is not circular, the diameter of a circle of equivalent cross-sectional area. (This is applicable to an AIR GAP.) +Effluent Sewage,treatedorpartiallytreated,flow-ing out of sewage-treatment equipment. +Elastic limit The greatest stress that a material can withstand without permanent deformation after the release of the stress. + +23 + + +Elbow (Ell) A fitting that makes an angle between adjacentpipes.Theangleis90°,unlessanotherangle is specified. +Electrolysis The process of producing chemical changes by passage of an electric current through an electrolyte (as in a cell), the ions present carrying the currentbymigratingtotheelectrodeswheretheymay form new substances (as in the deposition of metals or the liberation of gases). +Elutriation A process of sludge conditioning in whichcertainconstituentsareremovedbysuccessive decontaminations with fresh water or plant efflu-ent, thereby reducing the demand for conditioning chemicals. +End connection A reference to the method of con-necting the parts of a piping system, e.g., threaded, flanged, butt-weld, socket-weld. +Engineered plumbing system Plumbing system designed by use of scientific engineering design cri-teria other than design criteria normally given in plumbing codes. +Erosion The gradual destruction of metal or other materialbytheabrasiveactionofliquids,gases,solids, or mixtures of these materials. +Evapotranspiration Loss of water from the soil bybothevaporationandtranspirationfromtheplants growing thereon. +Existing work A plumbing system, or any part thereof, that was installed prior to the effective date of an applicable code. +Expansionjoint Ajointwhoseprimarypurposeis to absorb longitudinal thermal expansion in the pipe line due to heat. +Expansion loop A large radius bend in a pipe line to absorb longitudinal thermal expansion in the line due to heat. +Extra heavy Description of piping material, usu-ally cast-iron, indicating piping that is thicker than standard pipe. +Face-to-face dimensions The dimensions from the face of the inlet port to the face of the outlet port of a valve or fitting. +Female thread Internal thread in pipe fittings, valves, etc., for making screwed connections. +Filter A device through which fluid is passed to separate contaminants from it. +Filter element or media A porous device that performs the process of filtration or filtering. +Fire alarm system (FP) A functionally related groupofdevicesthat,whenautomaticallyormanually +24 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +activated, will sound audio or visual warning devices on or off the protected premises, signaling a fire. +Fire department connection (FP) A piping con-nection for fire department use to supplement in supplyingwaterforstandpipesandsprinklersystems. See STANDPIPE SYSTEM. +Fire hazard (FP) Any thing or act that increases, or will cause an increase of, the hazard or menace of fire to a degree greater than what is customarily recognized as normal by persons in the public service regularly engaged in preventing, suppressing, or ex-tinguishingfire;orthatwillobstruct,delay,hinder,or interfere with the operations of the fire department or the egress of occupants in the event of fire. +Firehydrantvalve(FP) Avalvethat,whenclosed, drains at an underground level to prevent freezing. +Fire line (FP) A system of pipes and equipment used exclusively to supply water for extinguishing fires. +Fire pump types +Canpump(FP) Avertical-shaft,turbine-type pump in a can (suction vessel) for installation in a pipeline to raise water pressure. +Centrifugal pump (FP) A pump in which the pressure is developed principally by the action of centrifugal force. +End-suction pump (FP) A single-suction pump having its suction nozzle on the opposite sideofthecasingfromthestuffingboxandhav-ingthefaceofthesuctionnozzleperpendicular to the longitudinal axis of the shaft. +Excess pressure pump (FP) UL-listed and/ or FM-approved, low-flow, high-head pump for sprinkler systems not being supplied from a fire pump. The pump pressurizes the sprinkler systemsothatthelossofwater-supplypressure will not cause a false alarm. +Firepump(FP)UL-listedand/orFM-approved pumpwithdriver,controls,andaccessoriesused forfireprotectionservice.Firepumpsareofthe centrifugalorturbinetypeandusuallyhavean electric-motor or diesel-engine driver. +Horizontal pump (FP) A pump with the shaft normally in a horizontal position. +Horizontal split-case pump (FP) A cen-trifugal pump characterized by a housing that is split parallel to the shaft. +In-line pump (FP) A centrifugal pump in which the drive unit is supported by the pump, having its suction and discharge flanges on ap-proximately the same center line. + +Pressure maintenance (jockey) pump (FP) Pumpwithcontrolsandaccessoriesused tomaintainpressureinafireprotectionsystem without the operation of the fire pump. Does not have to be a listed pump. +Vertical shaft turbine pump (FP) A centrifugal pump with one or more impellers discharging into one or more bowls and a ver-tical educator or column pipe used to connect the bowl(s) to the discharge head on which the pump driver is mounted. +Fitting Theconnectororclosureforfluidlinesand passages. +Fitting, compression A fitting designed to join pipe or tubing by means of pressure or friction. +Fitting, flange A fitting that utilizes a radially extending collar for sealing and connection. +Fitting, welded A fitting attached by welding. +Fixture branch A pipe connecting several fixtures. +Fixture carrier A metal unit designed to support an off-the-floor plumbing fixture. +Fixture carrier fittings Special fittings for wall-mounted fixture carriers. Fittings have a sanitary drainage waterway with a minimum angle of 30 – 45 degrees so that there are no fouling areas. +Fixturedrain Thedrainfromthetrapofafixture to the junction of that drain with any other drain pipe. +Fixture, plumbing See PLUMBING FIXTURE. +Fixture supply A water supply pipe connecting the fixture to the fixture branch or directly to a main water supply pipe. +Fixture unit, drainage (dfu) A measure of prob-able discharge into the drainage system by various types of plumbing fixtures. The drainage fixture unit value for a particular fixture depends on its volume rate of drainage discharge, on the time duration of a single drainage operation, and on the average time betweensuccessiveoperations.Laboratorytestshave shown that the rate of discharge of an ordinary lava-torywithanominal1.2-inches(31.8-mm)outlet,trap, and waste is about 7.5 gpm (0.5 L/s). This figure is so nearto1ft3/min(0.5L/s)that“1ft3/min”(0.5L/s)has become the accepted flow rate of one fixture unit. +Fixtureunit,supply(sfu) Ameasureoftheprob-ablehydraulicdemandonthewatersupplybyvarious types of plumbing fixtures. The supply fixture unit value for a particular fixture depends on its volume rate of supply, the time duration of a single supply operation, and the average time between successive operations. +Chapter 1 — Formulas, Symbols and Terminology + + +Flange In pipe work, a ring-shaped plate on the end of a pipe at right angles to the end of the pipe and provided with holes for bolts to allow fastening the pipe to a similarly equipped adjoining pipe. The resulting joint is a flanged joint. +Flange bonnet A valve bonnet having a flange through which bolts connect it to a matching flange on the valve body. +Flange ends A valve or fitting having flanges for joining to other piping elements. Flange ends can be plain-faced, raised-face, large male-and-female, large tongue-and-groove, small tongue-and-groove, or ring-joint. +Flange faces Pipe flanges that have the entire surface of the flange faced straight across and use either a full-face or ring gasket. +Flap valve A non-return valve in the form of a hinged disc or flap, sometimes having leather or rubber faces. +Flashpoint Thetemperatureatwhichafluidfirst gives off sufficient flammable vapor to ignite when approached with a flame or spark. +Float valve A valve that is operated by means of a bulb or ball floating on the surface of a liquid within a tank. The rising and falling action operates a lever, which opens and closes the valve. +Flooded Theconditionwhenliquidrisestotheflood level rim of a fixture. +Flood level rim The top edge of a receptacle or fixture from which water overflows. +Flow pressure The pressure in the water supply pipe near the water outlet while the faucet or water outlet is fully open and flowing. +Flue An enclosed passage, primarily vertical, for removal of gaseous products of combustion to the outer air. +Flush valve A device located at the bottom of a tank for the purpose of flushing water closets and similar fixtures. +Flushing-type floor drain A floor drain that is equipped with an integral water supply, enabling flushing of the drain receptor and trap. +Flushometervalve Adevicethatdischargesapre-determined quantity of water to fixtures for flushing purposes and is actuated by direct water pressure. +Footing The part of a foundation wall or column resting on the bearing soil, rock, or piling that trans-mits the superimposed load to the bearing material. +Foot valve A check valve installed at the base of a pump-suction pipe. Its purpose is to maintain pump + +25 + + +prime by preventing pumped liquid from draining away from the pump. +French drain A drain consisting of an under-ground passage made by filling a trench with loose stones and covering with earth. Also known as RUBBLE DRAIN. +Fresh-air inlet A vent line connected with the building drain just inside the house trap and extend-ing to the outer air. It provides fresh air at the lowest point of the plumbing system, and with the vent stacks, provides a ventilated system. A fresh-air inlet is not required where a septic-tank system of sewage disposal is employed. +Frostproof closet A hopper that has no water in the bowl and has the trap and control valve for its water supply installed below the frost line. +FS Abbreviation for “federal specifications.” +Galvanic action When two dissimilar metals are immersed in the same electrolytic solution and connected electrically, there is an interchange of atoms carrying an electric charge between them. The anode metal with the higher electrode potential corrodes; the cathode is protected. Thus magnesium will protect iron; iron will protect copper. See also ELECTROLYSIS. +Galvanizing Aprocesswherethesurfaceofironor steel piping or plate is covered with a layer of zinc. +Generally accepted standard A document re-ferredtoinacodethatcoversaparticularsubjectand is accepted by the administrative authority. +Grade Theslopeorfallofalineofpipeinreference to a horizontal plane. In drainage, it is expressed as the fall in a fraction of an inch or percentage slope per foot (mm/m) length of pipe. +Greaseinterceptor Anautomaticormanualdevice used to separate and retain grease, with a capacity greater than 50 gal (227.3 L), and generally located outside a building. +Grease trap An automatic or manual device used to separate and retain grease, with a capacity of 50 gallons (227.3 L) or less, and generally located inside a building. +Grinder pump A special class of solids-handling pumpthatgrindssewagesolidstoafineslurry,rather than passing through entire spherical solids. +Halon 1301 (FP) Halon 1301 (bromtrifluoro-methane CBrF3) is a colorless, odorless, electrically non-conductive gas that is an effective medium for extinguishing fires. +Halon system types (FP) There are two types of systems recognized in this standard: “Total flooding systems” and “local application systems.” +26 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Totalfloodingsystem Consistsofasupplyof Halon1301arrangedtodischargedinto,andfill to the proper concentration, an enclosed space or enclosure around the hazard. +Localapplicationsystem Consistsofasup-plyofHalon1301arrangedtodischargedirectly on the burning material. +Hangers See SUPPORTS. +Hub-and-spigot Piping made with an enlarged diameter or hub at one end and being plain or having a spigot at the other end. The joint is made tight by oakumandleadorbyuseofaneoprenegasketcaulked or inserted in the hub around the spigot. +Hubless Soil piping with plain ends. The joint is made tight with a stainless steel or cast-iron clamp and neoprene gasket assembly. +Indirect waste pipe A pipe that does not connect directly with the drainage system but conveys liquid wastebydischargingintoaplumbingfixtureorrecep-tacle directly connected to the drainage system. +Individual vent A pipe that is installed to vent a fixture trap and connects with the vent system above the fixture served or terminates in the open air. +Induced siphonage Loss of liquid from a fixture trap due to pressure differential between the inlet and outlet of a trap, often caused by the discharge of another fixture. +Industrial waste All liquid or waterborne waste from industrial or commercial processes except do-mestic sewage. +Insanitary Aconditionthatiscontrarytosanitary principles or injurious to health. +Interceptor A device designed and installed so as to separate and retain deleterious, hazardous, or un-desirable matter from normal wastes and to permit normal sewage or liquid wastes to discharge into the disposal terminal by gravity. +Invert Term referring to the lowest point on the interior of a horizontal pipe. +Labeled Term describing equipment or materials bearing a label of a listing agency. +Lateral sewer A sewer that does not receive sew-age from any other common sewer except house connections. +Leaching well A pit or receptacle having porous wallsthatpermitthecontentstoseepintotheground. Also known as DRY WELL. +Leader The water conductor from the roof to the building (house) storm drain. Also known asDOWN-SPOUT. + +Liquid waste The discharge from any fixture, appliance, or appurtenance in connection with a plumbing system that does not receive fecal matter. +Listed Term describing equipment and materi-als included in a list published by an organization acceptable to the authority having jurisdiction and concerned (a listing agency). +Listingagency Anagencyacceptedbytheadminis-trativeauthoritythatlistsorlabelscertainmodelsofa productandmaintainsaperiodicinspectionprogram on the current production of listed models. It makes available a published report of its listing, including information indicating that the products have been tested,complywithgenerallyacceptedstandards,and are found safe for use in a specified manner. +Loadfactor Thepercentageofthetotalconnected fixture unit flow that is likely to occur at any point in the drainage system. The load factor represents the ratio of the probable load to the potential load and is determinedbytheaverageratesofflowofthevarious kinds of fixtures, the average frequency of use, the duration of flow during one use, and the number of fixtures installed. +Loop vent See VENT, LOOP. +Main Theprincipalarteryofasystemofcontinuous piping to which branches may be connected. +Main vent A vent header to which vent stacks are connected. +Malleable Capable of being extended or shaped by beating with a hammer, or by the pressure of rollers. Mostmetalsaremalleable.Theterm“malleableiron” also has the older meaning (still universal in Great Britain) of “wrought iron,” abbreviated “Mall.” +Master plumber An individual who is licensed and authorized to install and assume responsibility for contractual agreements pertaining to plumbing and to secure any required permits. The journeyman plumberisallowedtoinstallplumbingonlyunderthe responsibility of a master plumber. +MSS AbbreviationforManufacturersStandardiza-tion Society of the Valve and Fittings Industry, Inc. +NFPA Abbreviation for National Fire Protection Association. +NSF AbbreviationforNationalSanitationFounda-tion Testing Laboratory. +Offset A combination of pipe(s) and/or fittings that join two approximately parallel sections of a line of pipe. +Outfallsewers Sewersreceivingthesewagefroma collection system and carrying it to the point of final discharge or treatment. They are usually the largest sewers of an entire system. +Chapter 1 — Formulas, Symbols and Terminology + + +Oxidized sewage Sewage in which the organic matter has been combined with oxygen and become stable in nature. +PB Abbreviation for “polybutylene.” +PDI Abbreviation for Plumbing and Drainage Institute. +PE Abbreviation for “polyethylene.” +Percolation Theflowortricklingofaliquiddown-wardthroughacontactorfilteringmedium;theliquid may or may not fill the pores of the medium. +Pitch The amount of slope or grade given to hori-zontal piping and expressed in inches or vertically projected drop per foot (mm/m) on a horizontally projected run of pipe. +Plumbing The practice, materials, and fixtures used in the installation, maintenance, extension, and alteration of all piping, fixtures, appliances, and appurtenances in connection with any of the follow-ing: Sanitary drainage or storm drainage facilities; venting systems and public or private water-supply systems,withinoradjacenttoanybuilding,structure, orconveyance;watersupplysystemsand/orthestorm water,liquidwaste,orsewagesystemofanypremises to their connection with any point of public disposal or other acceptable terminal. +Plumbing appliance A plumbing fixture that is intended to perform a special plumbing func-tion. Its operation and/or control may be dependent upon one or more energized components, such as a motor, control, heating element, or pressure or tem-perature-sensingelement.Suchfixturesmayoperate automatically through one or more of the following actions:Atimecycle,atemperaturerange,apressure range, a measured volume, or weight; or the fixture may be manually adjusted or controlled by the user or operator. +Plumbing appurtenances A manufactured de-vice, prefabricated assembly, or on-the-job assembly ofcomponentpartsthatisanadjuncttothebasicpip-ing system and plumbing fixtures. An appurtenance demands no additional water supply, nor does it add anydischargeloadtoafixtureorthedrainagesystem. It is presumed perform some useful function in the operation,maintenance,servicing,economy,orsafety of the plumbing system. +Plumbingengineering Theapplicationofscientif-icprinciplestothedesign,installation,andoperation of efficient, economical, ecological, and energy-con-serving systems for the transport and distribution of liquids and gases. +Plumbing fixtures Installed receptacles, devices, or appliances are supplied with water or that re-ceive liquid or liquid-borne wastes and discharge + +27 + + +such wastes into the drainage system to which they may be directly or indirectly connected. Industrial or commercial tanks, vats, and similar processing equipment are not plumbing fixtures but may be connected to or discharged into approved traps or plumbing fixtures. +Plumbing inspector Any person who, under the supervision of the department having jurisdiction, is authorizedtoinspectplumbinganddrainagesystems as defined in the code for the municipality and com-plying with the laws of licensing and/or registration of the state, city, or county. +Plumbing system All potable water supply and distribution piping, plumbing fixtures and traps, drainage and vent pipe, and building (house) drains; includingtheirrespectivejoints,connections,devices, receptacles, and appurtenances within the property lines of the premises. Additional components in the system include: Potable water-treating or water-us-ing equipment, fuel gas piping, water heaters, and vents for same. +Polymer A chemical compound or mixture of com-pounds formed by polymerization and consisting essentially of repeating structural units. +Pool A water receptacle used for swimming or as a plunge or other bath, designed to accommodate more than one bather at a time. +Potablewater Waterthatissatisfactoryfordrink-ing, culinary, and domestic purposes and meets the requirementsofthehealthauthorityhavingjurisdic-tion. +Precipitation The total measurable supply of water received directly from the clouds as snow, rain, hail, and sleet. It is expressed in inches (mm) per day, month, or year. +Private sewage disposal system A septic tank with the effluent discharging into a subsurface dis-posalfield,oneormoreseepagepits,oracombination of subsurface disposal field and seepage pit, or of such other facilities as may be permitted under the procedures set forth in a code. +Privatesewer Asewerthatisprivatelyownedand not directly operated by public authority. +Private use Applies to plumbing fixtures in resi-dences and apartments, private bathrooms in hotels and hospitals, and rest rooms in commercial estab-lishments containing restricted-use single fixtures or groups of single fixtures and similar installations, wherethefixturesareintendedfortheuseofafamily or an individual. +Public sewer A common sewer directly operated by public authority. +28 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Public use Applies to toilet rooms and bathrooms used by employees, occupants, visitors, or patrons, in or about any premises, and locked toilet rooms or bathrooms to which several occupants or employees on the premises possess keys and have access. +Putrefaction Biological decomposition of organic matter with the production of ill-smelling products; usually takes place when there is a deficiency of oxygen. +PVC Abbreviation for “polyvinyl chloride.” PVDF Abbreviation for “polyvinyl-fluoridine.” Raw sewage Untreated sewage. +Receptor A plumbing fixture or device of such material, shape, and capacity that it will adequately receive the discharge from indirect waste pipes and, so constructed and located, that it can be readily cleaned. +Reducedsizevent Dryventsthataresmallerthan those allowed by model plumbing codes. +Reducer 1. A pipe fitting with inside threads that is larger at one end than at the other. 2. A fitting so shapedatoneendthatitcanreceivealargersizepipe in the direction of flow. +Reflectingpool Awaterreceptacleusedfordecora-tive purposes. +Relief vent A vent designed to provide circulation of air between drainage and vent systems or to act as an auxiliary vent. +Residual pressure (FP) Pressure less than static that varies with the flow discharged from outlets. +Return offset A double offset installed to return the pipe to its original alignment. +Revent pipe That part of a vent pipe line that con-nects directly with an individual waste pipe or group of waste pipes, underneath or at the back of the fix-ture, and extends either to the main or branch vent pipe. Also known as INDIVIDUAL VENT. +Rim An unobstructed open edge of a fixture. +Riser 1.Awatersupplypipethatextendsvertically one full story or more to convey water to branches or fixtures. 2. (FP) A vertical pipe used to carry water for fire protection to elevations above or below grade, such as a standpipe riser, sprinkler riser, etc. +Roof drain A drain installed to remove water col-lecting on the surface of a roof and discharge it into the leader (downspout). +Roughing in The installation of all parts of a plumbing system that can be completed prior to the installationoffixtures.Thisincludesdrainage,water supply and vent piping, and the necessary fixture supports. + +Sand filter A water-treatment device for remov-ing solid or colloidal material with sand as the filter medium. +Sanitarysewer Aconduitorpipecarryingsanitary sewage. It may include storm water and infiltrated ground water. +Seepage pit A lined excavation in the ground that receivesthedischargeofaseptictankthatisdesigned to permit effluent from the tank to seep through its bottom and sides. +Septic tank A watertight receptacle that receives the discharge of a drainage system, or part thereof, and is designed and constructed to separate solids from liquids and digest organic matter over a period of detention. +Sewage Any liquid waste containing animal, vege-table, or chemical wastes in suspension or solution. +Sewage ejector A mechanical device or pump for lifting sewage. +Siamese (FP) Ahosefittingforcombiningtheflow fromtwoormorelinesintoasinglestream.SeeFIRE DEPARTMENT CONNECTION. +Side vent A vent connected to the drain pipe through a fitting at an angle not greater than 45 degrees to the vertical. +Sludge The accumulated, suspended solids of sew-age deposited in tanks, beds, or basins, mixed with water to form a semiliquid mass. +Soil pipe Any pipe that conveys the discharge of water closets, urinals, or fixtures having similar functions, with or without the discharge from other fixtures, to the building (house) drain or building (house) sewer. +Special wastes Wastes that require some special method of handling, such as the use of indirect waste pipingandreceptors;corrosion-resistantpiping;sand, oil, or grease interceptors; condensers; or other pre-treatment facilities. +Sprinkler system (FP) An integrated system of underground and overhead piping designed in ac-cordance with fire-protection engineering standards. Theinstallationincludesoneormoreautomaticwater supplies. The portion of the sprinkler system above groundisanetworkofspeciallysizedorhydraulically designed piping installed in a building, structure, or area,generallyoverhead,andtowhichsprinklersare attached in a systematic pattern. The valve control-lingeachsystemriserislocatedinthesystemriseror itssupplypiping.Eachsprinklersystemriserincludes a device for actuating an alarm when the system is in operation. The system is activated by heat from a fire and discharges water over the fire area. +Chapter 1 — Formulas, Symbols and Terminology + + +Sprinkler system classification Automatic sprinkler system types (FP) +1. Wet-pipe systems. + +29 + + +and/or combustibility of contents is low and fires with relatively low rates of heat release are ex-pected. +Sprinkler types (FP) + + + +2. Dry-pipe systems. +3. Pre-action systems. + + +Concealed sprinklers Recessed sprinklers with cover plates. + + + +4. Deluge systems. +5. Combined dry-pipe and pre-action systems. +Sprinkler systems–special types Special-purpose systems employing departures from the requirements of standards, such as special water supplies and reduced pipe sizing, shall be installed in accordance with their listings. +Occupancy classification Relates to sprin-kler installations and their water supplies only, not intended to be a general classification of occupancy hazards. + +1. Extra hazard occupancies Occupancies or por-tions of other occupancies where quantity and combustibility of contents is very high, and flam-mableandcombustibleliquids,dust,lint,orother materialsarepresent,introducingtheprobability of rapidly developing fires with high rates of heat release. Extra hazard occupancies involve a wide range of variables that may produce severe fires. The following shall be used to evaluate the sever-ity of extra hazard occupancies: +A. Extra hazard group 1 Includes occupancies with little or no flammable or combustible liquids. +B. Extra hazard group 2 Includes occupancies with moderate to substantial amounts of flammable or combustible liquids or where shielding of combustibles is extensive. + +2. Ordinary hazard occupancies +A. Ordinary hazard group 1 Occupancies or portions of other occupancies where com-bustibility is low, quantity of combustibles does not exceed 8 feet (2.4 m), and fires with moderate rates of heat release are expected. +B. Ordinary hazard group 2 Occupancies or portionsofotheroccupancieswherequantity and combustibility of contents is moderate, stockpiles do not exceed 12 feet (3.7 m), and fires with moderate rates of heat release are expected. +C. Ordinary hazard group 3 Occupancies or portions of other occupancies where quan-tity and/or combustibility of contents is high and fires of high rates of heat release are expected. + +Corrosion-resistantsprinklers Sprinklers with special coatings or platings to be used in anatmospherethatwouldcorrodeanuncoated sprinkler. +Dry,pendentsprinklers Sprinklersforuse in a pendent position in a dry-pipe or wet-pipe system with the seal in a heated area. +Dry, upright sprinklers Sprinklers de-signed to be installed in an upright position, on a wet-pipe system, to extend into an unheated area with a seal in a heated area. +Extended-coverage sidewall sprinklers Sprinklers with special extended, directional, discharge patterns. +Flush sprinklers Sprinklers in which all or part of the body, including the shank thread, is mounted above the lower plane of the ceiling. +Intermediate-level sprinklers Sprinklers equipped with integral shields to protect their operatingelementsfromthedischargeofsprin-klers installed at high elevations. +Large-drop sprinklers Listed sprinklers that are characterized by a K factor between 11.0 and 11.5 and a proven ability to meet the prescribed penetration, cooling, and dis-tribution criteria prescribed in the large-drop sprinkler examination requirements. The deflector/discharge characteristics of the large-dropsprinklergeneratelargedropsofsuchsize and velocity as to enable effective penetration of a high-velocity fire plume. +Nozzles Devices for use in applications re-quiring special discharge patterns, directional spray, fine spray, or other unusual discharge characteristics. +Open sprinklers Sprinklers from which the actuating elements (fusible links) have been removed. +Ornamental sprinklers Sprinklers that have been painted or plated by the manufac-turer. +Pendant sprinklers Sprinklers designed to beinstalledinsuchawaythatthewaterstream is directed downward against the deflector. + +3. Light hazard occupancies Occupancies or por-tions of other occupancies where the quantity +30 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Quick-responsesprinklers Atypeofsprin-kler that is both a fast-response and a spray sprinkler. +Recessed sprinklers Sprinklers in which all or a part of the body, other than the shank thread, is mounted within a recessed housing. +Residential sprinklers Sprinklers that have been specifically listed for use in residen-tial occupancies. +Sidewall sprinklers Sprinklers having specialdeflectorsthataredesignedtodischarge most of the water away from a nearby wall in a pattern resembling a quarter of a sphere, with a small portion of the discharge directed at the wall behind the sprinkler. +Special sprinklers Sprinklers that have been tested and listed as having special limita-tions. +Upright sprinklers Sprinklers designed to be installed in such a way that the water spray is directed upward against the deflector. +Stack Theverticalmainofasystemofsoil,waste,or vent piping extending through one or more stories. +Stack group The location of fixtures in relation to the stack so that, by means of proper fittings, vents may be reduced to a minimum. +Stack vent The extension of a soil waste stack above the highest horizontal drain connected to the stack. Also known as WASTE or SOIL VENT. +Stack venting A method of venting a fixture or fixtures through the soil or waste stack. +Stale sewage Sewage that contains little or no oxygen and is free from putrefaction. +Standpipe Averticalpipegenerallyusedforthestor-age and distribution of water for fire extinguishing. +Standpipe system (FP) An arrangement of pip-ing, valves, hose connections, and allied equipment installed in a building or structure with the hose connections located in such a manner that water can be discharged in streams or spray patterns through attached hose and nozzles, for the purpose of extinguishing a fire and so protecting a building or structure and its contents as well as its occupants. This is accomplished by connections to water supply systems or by pumps, tanks, and other equipment necessary to provide an adequate supply of water to the hose connections. +Standpipe system class of service (FP) +Class I For use by fire departments and those trained in handling heavy fire streams (2½-inch hose). + +ClassII Foruseprimarilybythebuildingoc-cupantsuntilthearrivalofthefiredepartment (1½-inch hose). +Class III For use either by fire departments and those trained in handling heavy hose streams (2½-inch hose) or by the building oc-cupants (1½-inch hose). +Standpipe system types (FP) +Dry standpipe A system having no perma-nent water supply, maybe so arranged through the use of approved devices as to admit water to the system automatically by the opening of a hose valve. +Wet standpipe A system having the supply valve open and water pressure maintained in the system at all times. +Stop valve A valve used for the control of water supply, usually to a single fixture. Can be a straight or angle configuration. +Stormsewer Asewerusedforconveyingrainwater, surface water, condensate, cooling water, or similar liquid wastes, exclusive of sewage and industrial waste. +Strain Change of the shape or size of a body pro-duced by the action of stress. +Stress Reactions within a body resisting external forces acting on it. +Subsoil drain A drain that receives only subsur-face or seepage water and conveys it to an approved place of disposal. +Submain sewer A sewer into which the sewage from two or more lateral sewers is discharged. Also known as BRANCH SEWER. +Sump A tank or pit that receives sewage or liquid waste,islocatedbelowthenormalgradeofthegravity system, and must be emptied by mechanical means. +Sump pump A mechanical device for removing liquid waste from a sump. +Supervisory (tamper) switch (FP) A device at-tached to the handle of a valve that, when the valve is closed, annunciates a trouble signal at a remote location. +Supports Devicesforsupportingandsecuringpipe and fixtures to walls, ceilings, floors, or structural members. +Swimming pool A structure, basin, or tank con-taining water for swimming, diving, or recreation. +Tempered water Water ranging in temperature from 85 to 110°F (29 to 43°C) thermal efficiency. +Chapter 1 — Formulas, Symbols and Terminology + + +Thermalefficiency Theratiooftheenergyoutput from the system to energy input to the system. +Trailer park sewer That part of the horizontal piping of a drainage system that begins 2 feet (0.6 m) downstream from the last trailer site connection, receivesthedischargeofthetrailersite,andconveysit toapublicsewer,privatesewer,individualsewagedis-posal system, or other approved point of disposal. +Trap Afittingordevicedesignedandconstructedto provide, when properly vented, a liquid seal that will preventthebackpassageofairwithoutsignificantlyaf-fecting the flow of sewage or waste water through it. +Trapprimer Adeviceorsystemofpipingtomain-tain a water seal in a trap. +Trap seal The maximum vertical depth of liquid that a trap will retain, measured between the crown weir and the top of the dip of the trap. +Turbulence Any deviation from parallel flow in a pipe due to rough inner wall surfaces, obstructions, or directional changes. +Underground piping Piping in contact with the earth below grade. +Upstream Termreferringtoalocationinthedirec-tion of flow before reaching a referenced point. +Vacuum Any pressure less than that exerted by the atmosphere. Also known as NEGATIVE PRES-SURE. +Vacuum breaker See BACKFLOW PRE-VENTER. +Vacuumreliefvalve Adevicetopreventexcessive vacuum in a pressure vessel. +Velocity Time rate of motion in a given direction and sense. +Vent,loop Anyventconnectingahorizontalbranch or fixture drain with the stack vent of the originating waste or soil stack. +Vent stack A vertical vent pipe installed primarily for the purpose of providing circulation of air to and from any part of the drainage system. +Vertical pipe Any pipe or fitting installed in a vertical position or that makes an angle of not more than 45 degrees with the vertical. +Vitrified sewer pipe Conduit made of fired and glazedearthenwareinstalledtoreceivewasteorsew-age or sewerage. +Waste The discharge from any fixture, appliance, area, or appurtenance that does not contain fecal matter. + +31 + + +Waste pipe The discharge pipe from any fixture, appliance, or appurtenance in connection with the plumbing system that does not contain fecal matter. +Water-conditioning or treating device A device that conditions or treats a water supply to change its chemical content or remove suspended solids by filtration. +Water-distributing pipe A pipe that conveys potable water from the building supply pipe to the plumbing fixtures and other water outlets in the building. +Water hammer The forces, pounding noises, and vibration that develop in a piping system when a column of noncompressible liquid flowing through a pipeline at a given pressure and velocity is stopped abruptly. +Water hammer arrester A device, other than an air chamber, designed to provide protection against excessive surge pressure. +Water main The water supply pipe for public or community use. Normally under the jurisdiction of the municipality or water company. +Water riser A water supply pipe that extends vertically one full story or more to convey water to branches or fixtures. +Water-service pipe The pipe from the water main or other source of water supply to the building served. +Water supply system The building supply pipe, the water distributing pipes, and the necessary connecting pipes, fittings, control valves, and all ap-purtenances carrying or supplying potable water in, or adjacent to, the building or premises. +Wet vent A vent that also serves as a drain. +Yoke vent A pipe connecting upward from a soil or wastestacktoaventstackforthepurposeofprevent-ing pressure changes in the stacks. +32 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +RECOMMENDED PRACTICE FOR CONVERSION TO THE INTERNATIONAL SYSTEM OF UNITS +The International System of Units was developed by the General Conference of Weights and Measures, an international treaty organization, and has been officially abbreviated “SI” from the French term, “SystemeInternationalandd’Unites.”TheSIsystem of units is a preferred international measurement system that evolved from earlier decimal metric systems. +When President Ford signed the Metric Conver-sion Act (Public Law 94-168) on December 23, 1975, a metric system in the United States was declared and a United States Metric Board was established to coordinate the national voluntary conversion effort to the metric system. The Metric Conversion Act specificallydefinesthemetricsystemofmeasurement to be used as the International System of Units (SI), established by the General Conference of Weights andMeasuresandasinterpretedandmodifiedbythe Secretary of Commerce. +The“recommendedpractice”sectionthatfollows outlines a selection of SI units, including multiples and submultiples, for use in plumbing design and relatedfieldsofscienceandengineering.Itisintended to provide the technical basis for a comprehensive and authoritative standard guide for SI units to be used in plumbing design and related fields of science and engineering. +The section also is intended to provide the basic concepts and practices for the conversion of units given in several systems of measurement to the SI system. Rules and recommendations are detailed for the presentation of SI units and their corresponding symbols and numerical values used in conjunction with the SI system. +A selection of conversion factors to SI units for use in plumbing design and related fields of science and engineering is also given. It should be noted that the SI units, rules, and recommendations listed herein comply with those provisions set forth in the American National Standard Metric Practice, ANSI Z210.1 (ASTM E380). +Terminology and Abbreviations +Foruniformityintheinterpretationoftheprovisions set forth in this recommended practice section, the following definitions and abbreviations will apply: + +Accuracy The degree of conformity of a measured or calculated value to some recognized standard or specified value. + +Approximate value A quantity that is nearly, but not exactly, correct or accurate. + + +CGPM Abbreviation for the General Conference on Weights and Measures, from the French term, “Conference Generale de Poids et Measures.” + +Coherentunitsystem Asysteminwhichrelations between units contain as numerical factor only the number 1 (or unity). All derived units have a unity relationshiptotheconstituentbaseorsupplementary units. + +Deviation The variation from a specified dimen-sion or design requirement, defining the upper and lower limits. + +Digit One of the ten arabic numerals (0 to 9). +Dimension A geometric element in a design or the magnitude of such a quantity. + +Feature An individual characteristic of a compo-nent or part. + +Nominalvalue Avalueassignedforthepurposeof convenient designation, existing in name only. + +Precision Thedegreeofmutualagreementbetween individual measurements, namely, repeatability and reproducibility. + +Significant digit Any digit necessary to define a value or quantity. + +Tolerance The total range of variation permitted; the upper and lower limits between which a dimen-sion must be maintained. + +Unit The reference value of a given quantity as defined by CGPM. + +Types of Conversion +Exact These conversions denote the precise (or direct) conversion to the SI unit value, accurate to a number of decimal places. + +Soft Theseconversionsdenotetheconversiontothe SI unit value in the software only. The materials and products remain unchanged and minimal rounding off to the nearest integer is usually applied. + +Hard Theseconversionsdenotethattheproductor material characteristics are physically changed from existing values to preferred SI unit values. +Chapter 1 — Formulas, Symbols and Terminology + + +SI Units and Symbols5 + +The International System of Units has three types of units, as follows: + +33 + + +The following are classified as derived units with generic or complex names, expressed in various terms: +Quantity Unit Symbol + + + +Base units These units are used for independent quantities. There are seven base units: +Quantity Unit Symbol +Length meter m Mass kilogram kg Time second s Current (electric) ampere A +Temperature +(thermodynamic) kelvin K +Substance (amount) mole mol Intensity (luminous) candela cd + +Supplementary units These units are used to denote angles. There are two supplementary units: +Quantity Unit Symbol +Plane angle radian rad Solid angle steradian sr + +Derived units These units are defined in terms of their derivation from base and supplementary units. Derived units are classified in two categories: (1) derived units with special names and symbols and (2) derived units with generic or complex names, expressed in terms of a base unit, two or more base units, base units and/or derived units with special names, or supplementary units and base and/or de-rived units. + +Linear acceleration Angular acceleration Area +Density +Electric charge density Electric permittivity Electric permeability Electric resistivity Entropy +Luminance +Magnetic field strength Mass per unit length Mass per unit area Mass flow rate Moment of inertia Momentum +Torque Specific heat +Thermal conductivity Linear velocity Angular velocity Dynamic viscosity Kinematic viscosity Volume, capacity Volume flow rate Specific volume + +meter per second sq. m/s2 radian per second sq. rad/s2 meter squared m2 kilogram per cubic meter kg/m3 coulomb per cubic meter C/m3 farad per meter F/m henry per meter H/m ohm-meter Ω.m joule per kelvin J/K candela per meter sq. cd/m2 ampere per meter A/m kilogram per meter kg/m kilogram per meter sq. kg/m2 kilogram per second kg/s kilogram-meter sq. kg.m2 kilogram-meter per sec. kg.m/s newton-meter N.m joule per kg per kelvin J/kg.K watt per meter per kelvin W/m.K meter per second m/s radian per second rad/s pascal-second Pa.s meter squared per second m2/s cubic meter m3 cubic meter per second m3/s cubic meter per kilogram m3/kg + + + +Quantity +Frequency Force +Pressure, stress +Energy, work, heat (quantity) +Power +Electricity (quantity) +Electric potential, electromotive force +Electric capacitance Electric resistance Magnetic flux Illuminance +Electric inductance Conductance Magnetic flux density Luminous flux + +Unit Symbol +hertz Hz newton N pascal Pa + +joule J watt W coulomb C + +volt V farad F ohm Ω weber Wb lux lx henry H siemens S tesla T lumen lm +34 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Non-SI Units and Symbols for Use with the SI System + +There are several (non-SI) units that are traditional andacceptableforuseintheSIsystemofunitsdueto theirsignificanceinspecificandgeneralapplications. These units are as follows: +Quantity Unit Symbol +Area hectare ha Energy kilowatt-hour kW·h Mass metric ton t Temperature degree celsius C Time minute, hour, year min, h, y +(respectively) Velocity kilometer per hour km/h Volume liter L + +SI Units Style and Use + +1. Multiples and submultiples of SI units are to be formed by adding the appropriate SI prefixes to such units. +2. Except for the kilogram, SI prefixes are not to be used in the denominator of compound numbers. +3. Double prefixes are not to be used. +4. Except for exa (E), peta (P), teca (T), giga (G), and mega (M), SI prefixes are not capitalized. +5. The use of units from other systems of measure-ment is to be avoided. +6. Except when the SI unit is derived from a proper name, the symbol for SI units is not capitalized. + + + +SI Unit Prefixes and Symbols 7. + +SI unit symbols are always denoted in singular form. + + + +The SI unit system is based on multiples and sub-multiples. The following prefixes and corresponding symbols are accepted for use with SI units. +Factor Prefix Symbol +1018 exa E 1015 peta P 1012 tera T 109 giga G 106 mega M 103 kilo k 102 hectoa h 101 dekaa da 10-1 decia d 10-2 centia c 10-3 milli m 10-6 micro µ 10-9 nano n 10-12 pico p 10-15 femto f 10-18 atto a + +aUse of these prefixes should be avoided whenever possible. + + +8. Except at the end of a sentence, periods are not used after SI unit symbols. +9. Digits are placed in groups of three numbers, separated by a space to the left and to the right of the decimal point. In the case of four digits, spacing is optional. +10. A center dot indicates multiplication, and a slash indicates division (to the left of the slash is the numerator and to the right of the slash is the denominator). +11. When equations are used, such equations are to be restated using SI terms. +12. All units are to be denoted by either their sym-bols or their names written in full. Mixed use of symbols and names is not allowed. +Chapter 1 — Formulas, Symbols and Terminology 35 + + +SI UNIT CONVERSION FACTORS +To convert from other systems of measurement to SI values, the following conversion factors are to be used. (Note: For additional conversion equivalents not shown herein, refer to ANSI Z210.1–also issued as ASTM E380). + + +Acceleration, linear +foot per second squared = 0.3048 m/s2 inch per second squared = 0.0254 m/s2 +Area +acre = 4046.9 m2 +foot squared = 0.0929 m2 +inch squared = 0.000645 m2 = 645.16 mm2 mile squared = 2 589 988 m2 = 1.59 +yard squared = 0.836 m2 Bending movement (torque) +pound-force-inch = 0.113 N·m +pound-force-foot = 1.356 N·m + + +m/s2 = 3.28 ft/s2 m/s2 = 39.37 in/s2 + +m2 = 0.0000247 acre m2 = 10.76 ft2 +m2 = 1550.39 in2 km2 = 0.39 mi2 m2 = 1.2 yd2 + +N·m = 8.85 lbf-in +N·m = 0.74 lbf-ft + +Bending movement (torque) per unit length + +pound-force-inch per inch = 4.448 N·m/m pound-force-foot per inch = 53.379 N·m/m +Electricity and magnetism ampere = 1A +ampere-hour = 3600C coulomb = 1C +farad = 1F henry = 1H ohm = 1Ω volt = 1V +Energy (work) +British thermal unit (Btu) = 1055 J foot-pound-force = 1.356 J kilowatt-hour = 3 600 000 J +Energy per unit area per unit time Btu per foot squared-second = 11 349 W/m2 +Force +ounce-force = 0.287 N pound-force = 4.448 N kilogram-force = 9.807 N +Force per unit length +pound-force per inch = 175.1 N/m +pound-force per foot = 14.594 N/m + +N·m/m = 0.225 lbf-in/in N·m/m = 0.019 lbf-ft/in + + + + + + + + + + + +J = 0.000948 Btu J = 0.74 ft-lbf +J = 0.000000278 kW-h + + +W/m2 = 0.000088 Btu/ft2-s + + +N = 3.48 ozf N = 0.23 lbf N = 0.1 kgf + +N/m = 0.0057 lbf/in +N/m = 0.069 lbf/ft +36 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Heat +Btu-inch per second-foot squared-F = 519.2 W/m·K Btu-inch per hour-foot squared-F = 0.144 W/m·K Btu per foot squared = 11 357 J/m2 +Btu per hour-foot squared-F = 5.678 W/m2·K Btu per pound-mass = 2326 J/kg +Btu per pound-mass-F = 4186.8 J/kg·K +F-hour-foot squared per Btu = 0.176 K·m2/W Length +inch = 0.0254 m foot = 0.3048 m yard = 0.914 m mile = 1609.3 m +Light (illuminance) footcandle = 10.764 lx +Mass +ounce-mass = 0.028 kg pound-mass = 0.454 kg +Mass per unit area +pound-mass per foot squared = 4.882 kg/m2 Mass per unit length +pound-mass per foot = 1.488 kg/m Mass per unit time (flow) +pound-mass per hour = 0.0076 kg/s Mass per unit volume (density) +pound-mass per cubic foot = 16.019 kg/m3 pound-mass per cubic inch = 27 680 kg/m3 pound-mass per gallon = 119.8 kg/m3 +Moment of inertia pound-foot squared = 0.042 kg.m2 Plane angle +degree = 17.453 mrad minute = 290.89 µrad second = 4.848 µrad +Power +Btu per hour = 0.293 W +foot-pound-force per hour = 0.38 mW horsepower = 745.7 W +Pressure (stress), force per unit area inches water column = 25.4 mm water atmosphere = 101.325 kPa +inch of mercury (at 60°F) = 3.3769 kPa inch of water (at 60°F) = 248.8 Pa pound-force per foot squared = 47.88 Pa +pound-force per inch squared = 6.8948 kPa + + +W/m.K = 0.002 Btu-in/s-ft2F W/m.K = 6.94 Btu-in/h-ft2F J/m2 = 0.000088 Btu/ft2 W/m2.K = 0.176 Btu/h-ft2F J/kg = 0.00043 Btu/lbm J/kg.K = 0.000239 Btu/lbm F K·m2/W = 5.68 F-h-ft2/Btu + +m = 39.37 in m = 3.28 ft m = 1.1 yd +m = 0.000621 mi + + +lx = 0.093 ftcd + + +kg = 35.7 ozm kg = 2.2 lbm + +kg/m2 = 0.205 lbm/ft2 + + +kg/m = 0.67 lbm/ft + + +kg/s = 131.58 lbm/h + + +kg/m3 = 0.062 lbm/ft3 kg/m3 = 0.000036 lbm/in3 kg/m3 = 0.008347 lbm/gal + +kg.m2 = 23.8 lb-ft2 + + +mrad = 0.057 deg µrad = 0.00344 min µrad = 0.206 s + +W = 3.41 Btu/h mW = 2.63 ft-lbf/h W = 0.00134 hp + +mm water = 0.0394 in. wc kPa = 0.009869 atm +kPa = 0.296 in. Hg Pa = 0.004 in. H2O Pa = 0.02 lbf/ft2 +kPa = 0.145 lbf/in2 (psi) +Chapter 1 — Formulas, Symbols and Terminology 37 + + + +pounds per square inch = 0.0703 kg/cm3 pounds per square inch = 0.069 bars +Temperature equivalent tk = (tf + 459.67)/1.8 +tc = (tf – 32)/1.8 +Velocity (length per unit time) foot per hour = 0.085 mm/s +foot per minute = 5.08 mm/s foot per second = 0.3048 m/s inch per second = 0.0254 m/s mile per hour = 0.447 m/s +Volume +cubic foot = 0.028 m3 = 28.317 L cubic inch = 16 378 mL +gallon = 3.785 L ounce = 29.574 mL pint = 473.18 mL quart = 946.35 mL +acre-foot = 1233.49 m3 +Volume per unit time (flow) cubic foot per minute = 0.472 L/s +cubic inch per minute = 0.273 mL/s gallon per minute = 0.063 L/s +cubic feet per hour = 0.0283 m3/h +cubic feet per hour = 0.007866 L/s + +kg/cm3 = 14.22 psi bars = 14.50 psi + +tf = 1.8 tk – 459.67 tf = 1.8 tc + 32 + +mm/s = 11.76 ft/h mm/s = 0.197 ft/min m/s = 3.28 ft/s +m/s = 39.37 in./s m/s = 2.24 mi/h + +m3 = 35.71 ft3 mL = 0.061 in3 L = 0.264 gal mL = 0.034 oz mL = 0.002 pt mL = 0.001 qt +m3 = 0.00081 acre-ft + + +L/s = 2.12 ft3/min mL/s = 3.66 in.3/min L/s = 15.87 gal/min +m3/h = 35.31 ft3/h (cfh) +L/s = 127.13 cfh +38 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 1-4 Temperature Conversion Chart, °F – °C +The numbers in the center column refer to the known temperature, in either °F or °C, to be converted to the other scale. If converting from °F to °C, the number in the center column represents the known temperature, in °F, and its equivalent temperature, in °C, will be found in the left column. If converting from °C to °F, the number in the center represents the known temperature, in °C, and its equivalent temperature, in °F, will be found in the right column. + + +Known Temp. +°C (°F or °C) °F –59 –74 –101 –58 –73 –99 –58 –72 –98 –57 –71 –96 –57 –70 –94 –56 –69 –92 –56 –68 –90 –55 –67 –89 –54 –66 –87 –54 –65 –85 –53 –64 –83 –53 –63 –81 –52 –62 –80 –52 –61 –78 –51 –60 –76 –51 –59 –74 –50 –58 –72 –49 –57 –71 –49 –56 –69 –48 –55 –67 –48 –54 –65 –47 –53 –63 –47 –52 –62 –46 –51 –60 –45.6 –50 –58.0 –45.0 –49 –56.2 –44.4 –48 –54.4 –43.9 –47 –52.6 –43.3 –46 –50.8 –42.8 –45 –49.0 –42.2 –44 –47.2 –41.7 –43 –45.4 –41.1 –42 –43.6 –40.6 –41 –41.8 –40.0 –40 –40.0 –39.4 –39 –38.2 –38.9 –38 –36.4 –38.3 –37 –34.6 –37.8 –36 –32.8 –37.2 –35 –31.0 –36.7 –34 –29.2 –36.1 –33 –27.4 –35.5 –32 –25.6 –35.0 –31 –23.8 –34.4 –30 –22.0 –33.9 –29 –20.2 –33.3 –28 –18.4 –32.8 –27 –16.6 –32.2 –26 –14.8 –31.6 –25 –13.0 –31.1 –24 –11.2 –30.5 –23 –9.4 –30.0 –22 –7.6 –29.4 –21 –5.8 + +Known Temp. +°C (°F or °C) °F –28.9 –20 –4.0 –28.3 –19 –2.2 –27.7 –18 –0.4 –27.2 –17 1.4 –26.6 –16 3.2 –26.1 –15 5.0 –25.5 –14 6.8 –25.0 –13 8.6 –24.4 –12 10.4 –23.8 –11 12.2 –23.3 –10 14.0 –22.7 –9 15.8 –22.2 –8 17.6 –21.6 –7 19.4 –21.1 –6 21.2 –20.5 –5 23.0 –20.0 –4 24.8 –19.4 –3 26.6 –18.8 –2 28.4 –18.3 –1 30.2 –17.8 0 32.0 –17.2 1 33.8 –16.7 2 35.6 –16.1 3 37.4 –15.6 4 39.2 –15.0 5 41.0 –14.4 6 42.8 –13.9 7 44.6 –13.3 8 46.4 –12.8 9 48.2 –12.2 10 50.0 –11.7 11 51.8 –11.1 12 53.6 –10.6 13 55.4 –10.0 14 57.2 +–9.4 15 59.0 –8.9 16 60.8 –8.3 17 62.6 –7.8 18 64.4 –7.2 19 66.2 –6.7 20 68.0 –6.1 21 69.8 –5.6 22 71.6 –5.0 23 73.4 –4.4 24 75.2 –3.9 25 77.0 –3.3 26 78.8 –2.8 27 80.6 –2.2 28 82.4 –1.7 29 84.2 –1.1 30 86.0 –0.6 31 87.8 0 32 89.6 0.6 33 91.4 + +Known Temp. +°C (°F or °C) °F 1.1 34 93.2 1.7 35 95.0 2.2 36 96.8 2.8 37 98.6 3.3 38 100.4 3.9 39 102.2 4.4 40 104.0 5.0 41 105.8 5.6 42 107.6 6.1 43 109.4 6.7 44 111.2 7.2 45 113.0 7.8 46 114.8 8.3 47 116.6 8.9 48 118.4 9.4 49 120.2 +10.0 50 122.0 10.6 51 123.8 11.1 52 125.6 11.7 53 127.4 12.2 54 129.2 12.8 55 131.0 13.3 56 132.8 13.9 57 134.6 14.4 58 136.4 15.0 59 138.2 15.6 60 140.0 16.1 61 141.8 16.7 62 143.6 17.2 63 145.4 17.8 64 147.2 18.3 65 149.0 18.9 66 150.8 19.4 67 152.6 20.0 68 154.4 20.6 69 156.2 21.1 70 158.0 21.7 71 159.8 22.2 72 161.6 22.8 73 163.4 23.3 74 165.2 23.9 75 167.0 24.4 76 168.8 25.0 77 170.6 25.6 78 172.4 26.1 79 174.2 26.7 80 176.0 27.2 81 177.8 27.8 82 179.6 28.3 83 181.4 28.9 84 183.2 29.4 85 185.0 30.0 86 186.8 30.6 87 188.6 + +Known Temp. +°C (°F or °C) °F 31.1 88 190.4 31.7 89 192.2 32.2 90 194.0 32.8 91 195.8 33.3 92 197.6 33.9 93 199.4 34.4 94 201.2 35.0 95 203.0 35.6 96 204.8 36.1 97 206.6 36.7 98 208.4 37.2 99 210.2 37.8 100 212.0 43 110 230 49 120 248 54 130 266 60 140 284 66 150 302 71 160 320 77 170 338 82 180 356 88 190 374 93 200 392 99 210 410 +100 212 414 104 220 428 110 230 446 116 240 464 121 250 482 127 260 500 132 270 518 138 280 536 143 290 554 149 300 572 154 310 590 160 320 608 166 330 626 171 340 644 177 350 662 182 360 680 188 370 698 193 380 716 199 390 734 204 400 752 210 410 770 216 420 788 221 430 806 227 440 824 232 450 842 238 460 860 243 470 878 249 480 896 254 490 914 260 500 932 +Chapter 1 — Formulas, Symbols and Terminology 39 + + + + +Multiply acre +atmosphere (standard) bar +barrel (42 US gal, petroleum) + +Btu (International Table) Btu/ft2 +Btu/ft3 Btu/gal +Btu · ft/h · ft2 · °F +Btu · in/h · ft2 · °F +(thermal conductivity, k) +Btu/h Btu/h · ft2 +Btu/h · ft2 · °F (overall heat transfer coefficient, U) +Btu/lbm +Btu/lbm · °F +(specific heat, cp) +bushel calorie, gram +calorie, kilogram (kilocalorie) +centipoise +(dynamic viscosity, µ) +centistokes +(kinematic viscosity, v) +clo dyne/cm2 +EDR hot water (150 Btu/h) EDR steam (240 Btu/h) EER +ft + +ft/min, fpm ft/s, fps +ft of water +ft of water per 100 ft pipe ft2 +ft2 · h · °F/Btu (thermal resistance, R) +ft2/s (kinematic viscosity, v) ft3 + +ft3/min, cfm ft3/s, cfs +To Obtain + + +By 0.4047 101.325a 100a +159 0.159 +1.055 11.36 37.3 279 1.731 0.1442 + +0.2931 3.155 5.678 + +2.326a 4.186 + +0.03524 4.1868 4.1868 1.00a + +1.00a + +0.155 0.100a 44.0 70.3 0.293 +0.3048a 304.8a +0.00508a 0.3048a 2.99 0.0981 0.09290 0.176 + +92.900 +28.32 0.02832 +0.4719 28.32 +By + +Table 1-5 To Obtain ha +kPa kPa +L m3 +kJ kJ/m2 kJ/m3 kJ/m3 +W/(m · K) W/(m · K) + +W W/m2 +W/(m2 · K) + +kJ/kg kJ/(kg · K) + +m3 J kJ +mPa · s + +mm2/s + +m2 · K/W Pa +W W COP +m mm +m/s m/s kPa kPa/m m2 +m2 · K/W + +mm2/s +L m3 +L/s L/s +Divide + +Conversion to SI Units Multiply +ft · lbf (torque or moment) ft · lbf (work) +ft · lbf/lb (specific energy) ft · lbf/min (power) footcandle +gallon (US, 231 in3) gph +gpm gpm/ ft2 +gpm/ton refrigeration grain ( ⁄7000 lb) +1 +gr/gal gr/lb +horsepower (boiler) (33,470 Btu/h) +horsepower (550 ft · lbf/s) inch +in of mercury (60°F) in of water (60°F) +in/100 ft, thermal expansion in · lbf (torque or moment) in2 +in3 (volume) in3/min (SCIM) +in3 (section modulus) in4 (section moment) km/h +kWh kW/1000 cfm +kilopond (kg force) kip (1000 lbf) kip/in2 (ksi) +litre met +micron (µm) of mercury (60°F) +mile +mile, nautical mph + +millibar +mm of mercury (60°F) mm of water (60°F) +To Obtain + + +By 1.356 1.356 2.99 0.0226 10.76 3.7854 a 1.05 0.0631 0.6791 0.0179 0.0648 17.1 0.143 9.81 + +0.746 25.4a 3.377 249 0.833 113 645 16.4 0.273 16,400 +416,200 0.278 3.60a 2.12 9.81 4.45 6.895 0.001a 58.15 133 + +1.609 1.852a +1.609 0.447 +0.100a 0.133 9.80 +By + + +To Obtain N · m +J J/kg W lx +L mL/s L/s +L/(s · m2) mL/J +g g/m3 g/kg kW + +kW mm kPa Pa mm/m +mN · m mm2 mL mL/s mm3 mm4 m/s MJ kJ/m3 N +kN MPa m3 W/m2 mPa + +km km +km/h m/s +kPa kPa Pa +Divide +(CONTINUED) +40 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Table 1-5 Conversion to SI Units (continued) Multiply By To Obtain ounce (mass, avoirdupois) 28.35 g +ounce (force, thrust) 0.278 N + + +Notes: 1. Units are US values unless noted otherwise. 2. Litre is a special name for the cubic decimetre. 1 L = dm3 and 1 mL = 1 cm3. +aConversion factor is exact. + + + +ounce (liquid, US) 29.6 ounce inch (torque, moment) 7.06 +ounce (avoirdupois) 7.49 per gallon +perm (permeance) 57.45 + +mL +mN · m kg/m3 + +ng/(s · m2 · Pa) + + +REFERENCES +1. American Society of Heating, Refrigerating and Air-Conditioning Engineers (ASHRAE). 1997 [1982]. “Handbook of Fundamentals.” Atlanta, Ga.: ASHRAE. + + + +perm inch (permeability) pint (liquid, US) +pound +lbm (mass) + +lbf (force, thrust) lbm/ft (uniform load) +lbm/ft · h +(dynamic viscosity, µ) +lbm/ft · s +(dynamic viscosity, µ) +lbf · s/ft2 +(dynamic viscosity, µ) +lb/h lb/min +lb/h [steam at 212°F (100°C)] +lbf/ ft2 lbm/ ft2 +lbm/ft3 (density, ρ) lbm/gallon +ppm (by mass) psi +quad (1015 Btu) quart (liquid, US) square (100 ft2) tablespoon (approx.) teaspoon (approx.) therm (US) +ton, long (2240 lb) ton, short (2000 lb) +ton, refrigeration (12,000 Btu/h) +ton (1 mm Hg at 0°C) watt per square foot yd +yd2 yd3 +To Obtain + +1.46 473 + +0.4536 453.6 +4.45 1.49 0.413 + +1490 + +47.88 + +0.126 0.00756 0.284 + +47.9 4.88 16.0 120 1.00a 6.895 1.055 0.946 9.29 15 +5 105.5 1.016 0.907 3.517 + +133 10.76 0.9144a 0.836 0.7646 +By + +ng/(s · m · Pa) mL + +kg g +N kg/m +mPa · s + +mPa · s + +Pa · s + +g/s kg/s kW + +Pa kg/m2 kg/m3 kg/m3 mg/kg kPa EJ +L m2 mL mL MJ Mg +Mg; t (tonne) kW + +Pa W/m2 m +m2 m3 +Divide + + +2. Baumeister,Theodore,andLionelS.Marks.Stan-dard“HandbookforMechanicalEngineers.”New York: McGraw-Hill. +3. Chan, Wen-Yung W., and Milton Meckler. 1983. “PumpsandPumpSystems.”ShermanOaks,Ca-lif.: American Society of Plumbing Engineers. +4. National Fire Protection Association (NFPA). Standard 170. +5. Steele, Alfred. 1982. “Engineered Plumbing Design.” Elmhurst, Ill.: Construction Industry Press. +2 + + + + + +Standards for Plumbing Materials and Equipment + +Aplumbingengineer’slifeissurroundedbycodesand standards.Thischapterliststhemajorityofcodesand standards used and referenced by the profession. +Codes and standards often cross paths to the point that it is difficult to understand the difference betweenacodeandastandard.Acodetypicallyregu-latesabroadpartofconstruction,whereasastandard regulates a very specific area. Codes often include installation, material, and approval requirements. Codes rely on standards and normally reference standards for specific materials or installation re-quirements. State and local jurisdictions adopt codes to regulate construction. The standard only becomes a legally enforceable document when it is referenced in the adopted code. +Sometimes a standard crosses the line and be-comes a code. A good example is the National Fuel Gas Code. As the name implies, the document is a code that regulates the installation of fuel gas sys-tems. However, the National Fuel Gas Code is an NFPA standard, NFPA 54. Another document that regulates fuel gas systems is the International Fuel Gas Code. This document is a code and does not have a standard designation. +Codes and standards are continually updated. As a result, as soon as this Data Book is published, the list of standards is out-of-date. To identify the specific edition of a standard, the date is located in thenumericaldesignationofthestandard.Whenever using a standard, it is appropriate to check with the standard-promulgatingorganizationinordertoiden-tify the latest edition of that standard. +This chapter is separated into three sections: Standards Listed By Code and Standards Listed by Category (Table 2-1), Complete List of Standards By Standard Writing Organizations, and Organization Abbreviation, Address, and Phone Number Listing (Table 2-3). The first section identifies codes and standards based on their category. For example, the heading of water distribution piping aboveground lists the standards for each given material approved for such use. In this first section, only the standard + +acronym and number are identified. Not every stan-dard is listed in this section. The more complete listing of standards appears in the second portion of the chapter. The third section provides information to contact the organizations. +In the second section, the standard designa-tion, date, and full title of the standard appear. The standards are listed in alphabetical numerical order for each standard-promulgating agency. It should be noted that the American National Standards Insti-tute (ANSI) accredits many standards as American National Standards. ANSI is the organization in the United States that oversees the development of na-tional consensus standards. ANSI does not develop standards; they regulate (as an oversight organiza-tion) the agencies that promulgate standards, such as ASME. +ANSI identifies the standard by the acronym of the standard-promulgating agency. For example, the vitreous china fixture standard may be written as ANSI/ASME A112.19.2; however, both ANSI and ASME will also identify the same standard as ASME A112.19.2. For ease of identification, the ANSI has notbeenincludedinthetablefortheANSI-accredited standards. The only listings of ANSI standards are thefewremainingstandardsthatdonothaveanother acronym from a promulgating agency identifying the standard. A typical example is ANSI LC-1, which regulates corrugated stainless steel tubing. +Most standards are developed through a con-sensus process. This would include all ANSI, ASTM, and CSA standards. A consensus process requires the standards committee to be balanced between the various interest groups. For example, material standardswillhavemanufacturers(producers),users (engineers), and general-interest representatives on the committee. The consensus process also requires all negative comments to be resolved. As a result of the consensus process, the standards are of a higher caliber, developed through a fair and open process. +42 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 2-1 Codes and Standards Listed by Category CODES LISTED BY CATEGORY +Boiler Code ASME BPVC, IAPMO UMC, ICC IMC Building Code ICC IBC, NFPA 5000 +Energy Code ASHRAE 90.1, ASHRAE 90.2, ICC IECC Fuel Gas Code IAPMO UPC, ICC IFGC, NFPA 54, NFPA 58 Mechanical Code IAPMO UMC, ICC IMC +Plumbing Code IAPMO UPC, ICC IPC, PHCC-NA NSPC STANDARDS LISTED BY CATEGORY +Aboveground Sanitary (or Storm) Drainage and Vent Pipe +Acrylonitrile butadiene styrene (ABS) plastic pipe ASTM D 2661; ASTM F 628; CSA B181.1 Brass pipe ASTM B 43 +Cast-iron pipe ASTM A 74; ASTM A 888; CISPI 301 Coextruded composite ABS or PVC DWV pipe ASTM F 1488 +Copper or copper-alloy pipe ASTM B 42; ASTM B 302 +Copper or copper-alloy tubing ASTM B 75; ASTM B 88; ASTM B 251; ASTM B 306 Galvanized steel pipe ASTM A 53 +Glass pipe ASTM C 1053 Polyolefin pipe CAN/CSA-B181.2 +Polyvinyl chloride (PVC) plastic pipe (Type DWV) ASTM D 2665; ASTM D 2949; ASTM F 891; CAN/CSA-B181.2; ASTM F 1488 +Stainless steel drainage systems, types 304 and 316L ASME/ANSI A112.3. + +Backflow Preventers Air gap +Backflow preventer w/intermediate atmospheric vents Ballcock +Carbonated beverage dispensers backflow preventer Double check backflow prevention assembly +Dual-check-valve-type backflow preventer Faucet and fixture fitting backflow devices Hose connection backflow preventer +Hose-connection vacuum breaker Laboratory faucet backflow preventer +Pipe-applied atmospheric-type vacuum breaker Pressure vacuum breaker assembly +Reduced pressure principle backflow preventer +Building Storm Sewer Pipe +Acrylonitrile butadiene styrene (ABS) plastic pipe Asbestos-cement pipe +Cast-iron pipe Concrete pipe +Copper or copper-alloy tubing Polyvinyl chloride (PVC) plastic pipe + +Stainless steel drainage systems, Type 316L Vitrified clay pipe + + +ASME A112.1.2, ASME A112.1.3 ASSE 1012, CAN/CSA-B64.3 ASSE 1002 +ASSE 1022 +ASSE 1015, ASSE 1048, AWWA C510 ASSE 1024 +ASME A112.18.3 ASSE 1052 +ASSE 1011, ASSE 1019, CAN/CSA-B64.2.2 ASSE 1035, CSA B64.7 +ASSE 1001, CAN/CSA-B64.1.1 ASSE 1020, ASSE 1056 +ASSE 1013, ASSE 1047, AWWA C511, CAN/CSA-B64.4 + +ASTM D 2661; ASTM D 2751; ASTM F 628 ASTM C 428 +ASTM A 74; ASTM A 888; CISPI 301 +ASTM C 14; ASTM C 76; CSA A257.1; CSA CAN/CSA A257.2 ASTM B 75; ASTM B 88; ASTM B 251; ASTM B 306 +ASTM D 2665; ASTM D 3034; ASTM F 891; CSA B182.2; CAN/ CSA B182.4 +ASME/ANSI A112.3.1 ASTM C 4; ASTM C 700 + + + +Fire Protection Combustibility test Fire pumps +Fire resistance rating test +Flame spread and smoke developed +One- and two-family dwelling sprinkler design Residential sprinkler design + + +ASTM E 136 NFPA 20 ASTM E 119 ASTM E 84 NFPA 13D NFPA 13R +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 43 + + + +Table 2-1 Sprinkler design +Standpipe systems +Through penetration fire test +Gas Piping Aluminum +Copper and copper-alloy tubing Corrugated stainless steel tubing Plastic pipe (underground only) Steel pipe +Joints and Connections ABS solvent cement +Brazed filler metal +Cast iron hubless coupling CPVC solvent cement Elastomeric Seal + +Pipe thread +PVC solvent cement PVC primer +Solder filler metal Solder flux +Miscellaneous +Air admittance valves Backwater valves +Category II, III, IV vent systems Disinfecting methods +Drinking water material protection Factory built chimneys +Grease traps and interceptors Pipe hangers +Plastic pipe quality control Type B vents +Type L vents +Water hammer arresters Water heaters +Pipe Nipples Steel +Brass-, copper-, chromium-plated + +Codes and Standards Listed by Category (continued) NFPA 13 +NFPA 14 ASTM E 814 + +ASTM B 210; ASTM B 211; ASTM B 241 ASTM B 88; ASTM B 280 +ANSI LC1 ASTM D 2513 +ASTM A 53; ASTM A 106 + +ASTM D 2235; CSA B181.1 AWS A5.8 +ASTM C1277; CISPI 310 ASTM F 493 +ASTM C 425; ASTM C 443; ASTM C 477; ASTM C 564; ASTM C 1440; ASTM D 1869; CAN/CSA A257.3; CAN/CSA B602 +ASME B 1.20.1 +ASTM D 2564; CSA B137.3; CSA B181.2 ASTM F 656 +ASTM B 32 ASTM B 813 + +ASSE 1050, ASSE 1051 +ASME A112.14.1, CSA B181.1, CSA B181.2 UL 1738 +AWWA 651, AWWA 652 NSF 61 +UL 103 +ASME A112.14.3, ASME A112.14.4, PDI G101 MSS SP-58, MSS SP-69 +NSF 14 UL 441 UL 641 +ASSE 1010, PDI WH 201 +ANSI Z21.10.1, ANSI Z21.10.3, UL 732, UL 1261 + +ASTM A 733 ASTM B 687 + + + +Plumbing Fixtures Bathtubs + +Bidet +Dishwashing machines Drinking fountains + +Emergency shower and eyewash stations Faucets and fixture fittings +Fixture waste fittings Floor drains +Food waste grinders + + +ASME A112.19.1, ASME A112.19.4, ASME A112.19.7, ASME A112.19.9, ANSI Z124.1, CSA B45.2, CSA B45.3, CSA B45.5 ASME A112.19.2, ASME A112.19.9, CSA B45.1 +ASSE 1004, ASSE 1006, NSF 3 +ASME A112.19.1, ASME A112.19.2, ASME A112.19.9, ARI 1010 +ISEA Z358.1 +ASME A112.18.1, CSA B125 ASME A112.18.2 +ASME A112.3.1, ASME A112.6.3, CSA B79 ASSE 1008, ASSE 1009 +(CONTINUED) +44 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Table 2-1 Lavatories + + +Pressure balancing valves Roof drains +Showers Sinks + + +Thermostatic mixing valves Urinals +Wall carriers Water closets + +Codes and Standards Listed by Category (continued) +ASME A112.19.1, ASME A112.19.2, ASME A112.19.3, ASME A112.19.4, ASME A112.19.9, ANSI Z124.3, CSA B45.1, CSA B45.2, CSA B45.3, CSA B45.4 +ASSE 1016, ASSE 1066 +ASME A112.3.1, ASME A112.6.4 +ASME A112.19.9, ANSI Z124.2, CSA B45.5 +ASME A112.19.1, ASME A112.19.2, ASME A112.19.3, ASME A112.19.4, ASME A112.19.9, ANSI Z124.6, CSA B45.1, CSA B45.2, CSA B45.3, CSA B45.4 +ASSE 1016, ASSE 1017 +ASME A112.19.2, ANSI Z124.4, CSA B45.1, CSA B45.5 ASME A112.6.1, ASME A112.6.2 +ASME A112.19.2, ANSI Z124.4, CSA B45.1, CSA B45.4, CSA B45.5 + + + +Sanitary Drainage Pipe Fittings Acrylonitrile butadiene styrene (ABS) plastic Cast iron + +Copper or copper alloy + +Glass +Gray iron and ductile iron Malleable iron +Polyvinyl chloride (PVC) plastic Stainless steel drainage systems Steel +Sanitary Sewer Pipe Acrylonitrile butadiene styrene (ABS) +plastic pipe +Asbestos-cement pipe Cast-iron pipe +Coextruded composite ABS or PVC DWV pipe Concrete pipe +Copper or copper-alloy tubing Polyvinyl chloride (PVC) plastic pipe + +Stainless steel drainage systems, Type 316L Vitrified clay pipe +Subsoil Drainage Pipe Asbestos-cement pipe +Cast-iron pipe +Polyethylene (PE) plastic pipe Polyvinyl chloride (PVC) plastic pipe + +Stainless steel drainage systems, Type 316L Vitrified clay pipe + + +ASTM D 2661; ASTM D 3311; CSA B181.1 +ASME B16.4; ASME B16.12; ASTM A 74; ASTM A 888; CISPI 301 +ASME B16.15; ASME B16.18; ASME B16.22; ASME B16.23; ASME B16.26; ASME B16.29; ASME B16.32 +ASTM C 1053 AWWA C110 ASME B16.3 +ASTM D 3311; ASTM D 2665 ASME/ANSI A112.3.1 +ASME B16.9; ASME B16.11; ASME B16.28 + + +ASTM D 2661; ASTM D 2751; ASTM F 628 ASTM C 428 +ASTM A 74; ASTM A 888; CISPI 301 ASTM F 1488 +ASTM C 14; ASTM C 76; CSA A257.1; CAN/CSA A257.2 ASTM B 75; ASTM B 88; ASTM B 251 +ASTM D 2665; ASTM D 2949; ASTM D 3034; ASTM F 891; CSA B182.2; CAN/CSA-B182.4 +ASME/ANSI A112.3.1 ASTM C 4; ASTM C 700 + +ASTM C 508 +ASTM A 74; ASTM A 888; CISPI 301 ASTM F 405 +ASTM D 2729; ASTM F 891; CSA-B182.2; CSA CAN/CSA-B182.4 +ASME/ANSI A112.3.1 ASTM C 4; ASTM C 700 + +Underground Building Sanitary (or Storm) Drainage and Vent Pipe Acrylonitrile butadiene styrene (ABS) +plastic pipe ASTM D 2661; ASTM F 628; CSA B181.1 Asbestos-cement pipe ASTM C 428 +Cast-iron pipe ASTM A 74; ASTM A 888; CISPI 301 Coextruded composite ABS or PVC DWV pipe ASTM F 1488 +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 45 + + +Table 2-1 Codes and Standards Listed by Category (continued) + +Copper or copper-alloy tubing Polyolefin pipe +Polyvinyl chloride (PVC) plastic pipe (Type DWV) Stainless steel drainage systems, Type 316L +Water Distribution Piping (Aboveground) Brass pipe +Chlorinated polyvinyl chloride (CPVC) plastic pipe and tubing +Copper or copper-alloy pipe Copper or copper-alloy tubing +Cross-linked polyethylene (PEX) plastic tubing +Cross-linked polyethylene/aluminum/cross-linked polyeth-ylene (PEX-AL-PEX) pipe +Galvanized steel pipe +Polybutylene (PB) plastic pipe and tubing +Water Pipe Fittings +Acrylonitrile butadiene styrene (ABS) plastic Cast iron +Chlorinated polyvinyl chloride (CPVC) plastic Copper or copper alloy + +Gray iron and ductile iron Malleable iron +(PEX) Tubing Polyethylene (PE) plastic +Polyvinyl chloride (PVC) plastic Steel +Water Service Piping (Underground) Acrylonitrile butadiene styrene (ABS) plastic pipe Asbestos-cement pipe +Brass pipe +Copper or copper-alloy pipe Copper or copper-alloy tubing +Chlorinated polyvinyl chloride (CPVC) plastic pipe Cross-linked polyethylene (PEX) plastic tubing +Cross-linked polyethylene/ aluminum/cross-linked polyeth-ylene (PEX-AL-PEX) pipe +Ductile iron water pipe Galvanized steel pipe +Polybutylene (PB) plastic pipe and tubing Polyethylene (PE) plastic pipe Polyethylene (PE) plastic tubing +Polyethylene/aluminum/polyethylene (PE-AL-PE) pipe Polyvinyl chloride (PVC) plastic pipe + +ASTM B 75; ASTM B 88; ASTM B 251; ASTM B 306 CAN/CSA-B181.2 +ASTM D 2665; ASTM D 2949; ASTM F 891; CAN/CSA-B181.2 ASME/ANSI A112.3.1 + +ASTM B 43 +ASTM D 2846; ASTM F 441; ASTM F 442; CSA B137.6 + +ASTM B 42; ASTM B 302 +ASTM B 75; ASTM B 88; ASTM B 251; ASTM B 447 ASTM F 877; CAN/CSA B137.5 +ASTM F 1281; CAN/CSA B137.10 + +ASTM A 53 +ASTM D 3309; CSA CAN3-B137.8 + +ASTM D 2468 +ASME B16.4; ASME B16.12 +ASTM F 437; ASTM F 438; ASTM F 439 +ASME B16.18; ASME B16.22; ASME B16.23; ASME B16.26; ASME B16.29; ASME B16.32 +AWWA C110; AWWA C153 ASME B16.3 +ASTM F 1807 ASTM D 2609 +ASTM D 2464; ASTM D 2466; ASTM D 2467; CAN/CSA-B137.2 ASME B16.9; ASME B16.11; ASME B16.28 + +ASTM D 1527; ASTM D 2282 ASTM C 296 +ASTM B 43 +ASTM B 42; ASTM B 302 +ASTM B 75; ASTM B 88; ASTM B 251; ASTM B 447 ASTM D 2846; ASTM F 441; ASTM F 442; CSA B137.6 ASTM F 876; ASTM F 877; CSA CAN/CSA-B137.5 ASTM F 1281; CAN/CSA B137.10 + +AWWA C115; AWWA C151 ASTM A 53 +ASTM D 2662; ASTM D 2666; ASTM D 3309; CSA B137.8 ASTM D 2239; CAN/CSA-B137.1 +ASTM D 2737; CSA B137.1 ASTM F 1282; CAN/CSA-B137.9 +ASTM D 1785; ASTM D 2241; ASTM D 2672; CAN/CSA-B137.3 +46 + + + +ANSI + +ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 2-2 Complete List of Standards By Standard-Writing Organization American National Standards Institute +25 West 43rd Street, Fourth Floor New York, NY 10036 +www.ansi.org (212) 642-4900 +(212) 398-0023 facsimile + + + +LC1-97 (R2001) Z4.3-95 +Z21.8-94 (R2000) Z21.10.1-01 + +Z21.10.3-98 + +Z21.13-99 + +Z21.15-97 + +Z21.19-90 + +Z21.22-99 Z21.40.1-96 + +Z21.40.2-96 + +Z21.42-93 Z21.50-98 Z21.56-98 +Z21.61-83 (R1996) Z21.69-97 +Z21.83-98 Z21.84-99 + +Z21.88-99 Z83.11-00 + +Z124.1-95 Z124.2-95 Z124.3-95 Z124.4-96 Z124.5-97 Z124.6-97 Z124.7-97 Z124.9-94 + +ARI + + + + + +700-99 1010-02 + +Interior Gas Piping Systems Using Corrugated Stainless Steel Tubing Minimum Requirements for Nonsewered Waste-Disposal Systems Installation of Domestic Gas Conversion Burners +Gas Water Heaters – Volume I, Storage Water Heaters with Input Ratings of 75,000 Btu per Hour or Less +Gas Water Heaters – Volume III, Storage Water Heaters with Input Ratings Above 75,000 Btu per hour, Circulating and Instantaneous Water Heaters—with Z21.10.3a-99 Addendum +Gas-Fired Low-Pressure Steam and Hot Water Boilers— with Addenda Z21.13a-1993 and Z21.13b-1994 +Manually Operated Gas Valves for Appliances, Appliance Connector Valves, and Hose End Valves +Refrigerators Using Gas (R1999) Fuel—with Addenda Z721.19a-1992 (R1999) and Z21.19b-1995 (R1999) +Relief Valves for Hot Water Supply Systems +Gas-Fired Heat Activated Air Conditioning and Heat Pump Appliances—with Z21.40.1a-98 Addendum +Gas-Fired Work Activated Air Conditioning and Heat Pump Appliances (Internal Combus-tion)—with Z21.40.2a-97 Addendum +Gas-Fired Illuminating Appliances Vented Decorative Gas Appliances +Gas-Fired Pool Heaters—with Z21.56a-99 Addendum Toilets, Gas-Fired +Connectors for Movable Gas Appliances Fuel Cell Power Plants +Manually Lighted, Natural Gas Decorative Gas Appliances for Installation in Solid Fuel Burning Fireplaces +Vented Gas Fireplace Heaters +Gas Food Service Equipment (Ranges and Unit Broilers), Baking and Roasting Ovens, Fat Fryers, Counter Appliances and Kettles, Steam Cookers, and Steam Generators +Plastic Bathtub Units +Plastic Shower Receptors and Shower Stalls Plastic Lavatories +Plastic Water Closet Bowls and Tanks Plastic Toilet (Water Closet) Seats Plastic Sinks +Prefabricated Plastic Spa Shells Plastic Urinal Fixtures + +Air-Conditioning & Refrigeration Institute 4100 North Fairfax Drive, Suite 200 Arlington, VA 22203 +www.ari.org (703) 524-8800 +(703) 528-3816 facsimile +Specifications for Fluorocarbon and Other Refrigerants +Self-Contained, Mechanically Refrigerated Drinking-Water Coolers + + + +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 47 + + + +Table 2-2 ASHRAE + + + +15-2001 34-2001 90.1-2001 90.2-2001 100-1995 +118.1-2003 + +118.2-1993 124-1991 137-1995 + +146-1998 + +ASME + +Complete List of Standards By Standard-Writing Organization (continuted) + +American Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc. 1791 Tullie Circle, NE +Atlanta, GA 30329-2305 +www.ashrae.org (404) 636-8400 +(404) 321-5478 facsimile +Safety Standard for Refrigeration Systems Designation and Safety Classification of Refrigerants +Energy Standards for Buildings Except for Low Rise Residential Buildings Energy Efficient Design for Low Rise Residential Buildings +Energy Conservation in Existing Buildings +Method of Testing for Rating Commercial Gas, Electric, and Oil Service Water Heating Equip-ment +Method of Testing for Rating Residential Water Heaters +Method of Testing for Rating Combination Space Heating and Water Heating Appliances Method of Testing for Efficiency of Space Conditioning/Water Heating Appliances that Include a Desuperheater Water Heater +Method of Testing and Rating Pool Heaters + +American Society of Mechanical Engineers Three Park Avenue +New York, NY 10016-5990 +www.asme.org +800-THE-ASME (843-2763) +(973) 882-1717 facsimile (Inquiries) (212) 591-7674 facsimile (NY) + +A112.1.2-1991 (R2002) Air Gaps in Plumbing Systems +A112.1.3-2000 Air Gap Fittings for Use with Plumbing Fixtures, Appliances and Appurtenances +A112.3.1-1993 Performance Standard and Installation Procedures for Stainless Steel Drainage Systems or Sanitary, Storm and Chemical Applications, Above and Below Ground +A112.3.4-2000 Macerating Toilet Systems and Related Components A112.4.1-1993 (R2002) Water Heater Relief Valve Drain Tubes +A112.4.3-1999 Plastic Fittings for Connecting Water Closets to the Sanitary Drainage System A112.4.7-2002 Point of Use and Branch Water Submetering Systems +A112.6.1M-1997 (R2002) Floor-Affixed Supports for Off-the-Floor Plumbing Fixtures for Public Use A112.6.2-2000 Framing-Affixed Supports for Off-the-Floor Water Closets with Concealed Tanks A112.6.3-2001 Floor and Trench Drains +A112.6.4-2003 Roof, Deck, and Balcony Drains +A112.6.7-2001 Enameled and Epoxy-Coated Cast-Iron and PVC Plastic Sanitary Floor Sinks. A112.14.1-1975 (R1998) Backwater Valves. +A112.14.3-2000 Grease Interceptors A112.14.4-2001 Grease Removal Devices A112.18.1-2003 Plumbing Fixture Fittings +A112.18.2-2002 Plumbing Fixture Waste Fittings +A112.18.3M-2003 Performance Requirements for Backflow Protection Devices and Systems in Plumbing Fixture Fittings +A112.18.6-1999 Flexible Water Connectors +A112.18.7-99-2000 Deck mounted Bath/Shower Transfer Valves with Internal Backflow Protection A112.19.1M-1994 (R1999) Enameled Cast Iron Plumbing Fixtures +A112.19.2M-1998 Vitreous China Plumbing Fixtures +A112.19.3-2001 Stainless Steel Plumbing Fixtures (Designed for Residential Use) A112.19.4M-1994 (R1999) Porcelain Enameled Formed Steel Plumbing Fixtures +A112.19.5-1999 Trim for Water-Closet Bowls, Tanks, and Urinals +(CONTINUED) +48 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 2-2 Complete List of Standards By Standard-Writing Organization (continuted) + +A112.19.6-1995 Hydraulic Performance Requirements for Water Closets and Urinals A112.19.7M-1995 Whirlpool Bathtub Appliances +A112.19.8M-1987 (R1996) Suction Fittings for Use in Swimming Pools, Wading Pools, Spas, Hot Tubs, and Whirlpool Bathtub Appliances +A112.19.9M-1991 (R1998) Non-Vitreous Ceramic Plumbing Fixtures +A112.19.12-2000 Wall Mounted and Pedestal Mounted, Adjustable and Pivoting Lavatory and Sink Carrier Systems A112.19.13-2001-2002 Electrohydraulic Water Closets +A112.19.14-2001 Six-Liter Water Closets Equipped With a Dual Flushing Device A112.19.15-2001 Bathtub/Whirlpool Bathtubs with Pressure Sealed Doors +A112.19.17-2002 Manufacturers Safety Vacuum Release Systems (SVRS) for Residential and Commercial Swim-ming Pool, Spa, Hot Tub, and Wading Pool Suction Systems +A112.21.1M-1991 (R1998) Floor Drains A112.36.2M-1991 (R2002) Cleanouts +B1.20.1-1983 (R2001) Pipe Threads, General Purpose (inch) +B16.1-1998 Cast Iron Pipe Flanges and Flanged Fittings, Class 25, 125 and 250 B16.3-1998 Malleable Iron Threaded Fittings Classes 150 and 300 +B16.4-1998 Gray Iron Threaded Fittings Classes 125 and 250 +B16.5-1996 Pipe Flanges and Flanged Fittings NPS ½ through NPS 24—with B16.5a-1998 Addendum B16.9-2001 Factory-Made Wrought Steel Buttwelding Fittings +B16.11-2001 Forged Fittings, Socket-Welding and Threaded B16.12-1998 Cast-Iron Threaded Drainage Fittings +B16.15-1985(R1994) Cast Bronze Threaded Fittings, Classes 125 and 250 B16.18-2002 Cast Copper Alloy Solder Joint Pressure Fittings +B16.20-1998 MetallicGasketsforPipeFlangesRing-Joint,Spiral-Wound,andJacketed—withB16.20a-2000 Addendum +B16.22-2002 Wrought Copper and Copper Alloy Solder Joint Pressure Fittings B16.23-2002 Cast Copper Alloy Solder Joint Drainage Fittings DWV +B16.24-2002 Cast Copper Alloy Pipe Flanges and Flanged Fittings: Class 150, 300, 400, 600, 900, 1500 and 2500 +B16.26-1988 Cast Copper Alloy Fittings for Flared Copper Tubes +B16.28-1994 Wrought Steel Buttwelding Short Radius Elbows and Returns +B16.29-2001 Wrought Copper and Wrought Copper Alloy Solder Joint Drainage Fittings—DWV +B16.33-1990 Manually Operated Metallic Gas Valves for Use in Gas Piping Systems up to 125 psig (Sizes ½ through 2) +B16.50-2001-2002 Wrought Copper and Copper Alloy Braze-Joint Pressure Fittings B31.3-2002 Process Piping +B36.10M-2001 Welded and Seamless Wrought-Steel Pipe +BPVC-2001 Boiler & Pressure Vessel Code (Sections I, II, IV, V & VI) +CSD-1-1998 Control and Safety Devices for Automatically Fired Boilers with the ASME CSD-1a-1999 Ad-dendum + + +ASSE + + + + +1001 – 2002 1002 – 1999 1003 – 2001 1004 – 1990 1005 – 1999 1006 – 1986 1007 – 1992 + + +American Society of Sanitary Engineering 901 Canterbury Road, Suite A +Westlake, OH 44145 +www.asse-plumbing.org (440) 835-3040 +(440) 835-3488 facsimile +Atmospheric Type Vacuum Breakers Water Closet Flush Tank Ball Cocks +Water Pressure Reducing Valves for Domestic Water Supply Systems Backflow Prevention for Commercial Dishwashing Machines +Water Heater Drain Valves Residential Use Dishwashers Home Laundry Equipment +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 49 + + + +Table 2-2 + +1008 – 1986 1009 – 1990 1010 – 1998 1011 – 1995 1012 – 2002 1013 – 1999 + +1014 – 1989 1015 – 1999 + +1016 – 1996 + +1017 – 2003 1019 – 1997 1020 – 1998 1021 – 2001 1022 – 2003 1023 – 1979 1024 – 2003 1025 – 1978 1032 – 1980 1035 – 2002 1037 – 1990 1043 – 1992 1044 – 2002 1047 – 1999 1048 – 1999 1050 – 2002 1051 – 2002 1052 – 1994 1055 – 1997 1056 – 2001 1057 – 2001 1060 – 1996 1062 – 1997 1064 – 2002 1066 – 1997 + +Complete List of Standards By Standard-Writing Organization (continuted) + +Household Food Waste Disposer Units Commercial Food Waste Grinder Units Water Hammer Arresters +Hose Connection Vacuum Breakers +Backflow Preventer with Intermediate Atmospheric Vent ReducedPressurePrincipleBackflowPreventersandReducedPressurePrincipleFireProtection Backflow Preventers +Handheld Showers +Double Check Backflow Prevention Assemblies and Double Check Fire Protection Backflow Prevention Assemblies +Individual Thermostatic, Pressure Balancing and Combination Pressure Balancing and Thermo-static Control Valves for Individual Fixture Fittings +Temperature Actuated Mixing Valves for Hot Water Distribution Systems Vacuum Breaker Wall Hydrants, Freeze Resistant, Automatic Draining Type Vacuum Breakers, Anti-siphon, Pressure Type +Drain Air Gaps for Domestic Dishwashers +Backflow Preventer for Carbonated Beverage Dispensing Equipment +Plumbing Requirements for Hot Water Dispensers, Household Storage Type, Electrical Dual Check Valve Type Backflow Preventers—Revised 1994 +Diverters for Plumbing Faucets with Hose Spray, Anti-Siphon Type, Residential Applications Dual Check Valve Type Backflow Preventer for Carbonated Beverage Dispensers –Post Mix Type Laboratory Faucet Backflow Preventers +Pressurized Flushing Devices for Plumbing Fixtures Cast Iron Sovent Sanitary Drainage Systems +Trap Seal Primer Devices—Drainage Types and Electric Design Types Reduced Pressure Detector Fire Protection Backflow Prevention Assemblies Double Check Detector Fire Protection Backflow Prevention Assemblies +Air Admittance Valves for DWV Systems, Stack Type Device Air Admittance Valves for Plumbing Drainage Systems +Hose Connection Backflow Preventers Chemical Dispensing Systems +Spill Resistant Vacuum Breakers +Freeze Resistant Sanitary Yard Hydrants with Backflow Protection Outdoor Enclosures for Backflow Prevention Assemblies +Temperature Actuated, Flow Reduction (TAFR) Valves for Individual Fixture Fittings Backflow Prevention Assembly Field Test Kits +Individual Pressure Balancing in-Line Valves for Individual Fixture Fittings + + + +ASTM + + + + + +A 53/A 53M-02 A 74-03b +A 106-02a A 126-01 +A 254-97(2002) +A 312/A 312M-03 A 420/A 420M-03 + +A 539-99 + + +ASTM International 100 Barr Harbor Drive P.O. Box C700 +West Conshohocken, PA 19428-2959 +www.astm.org (610) 832-9585 +(610) 832-9555 facsimile +Specification for Pipe, Steel, Black and Hot-Dipped, Zinc-Coated Welded and Seamless Specification for Cast Iron Soil Pipe and Fittings +Specification for Seamless Carbon Steel Pipe for High-Temperature Service Specification for Gray Iron Castings for Valves, Flanges, and Pipe Fittings Specification for Copper-Brazed Steel Tubing +Specification for Seamless and Welded Austenitic Stainless Steel Pipes +Specification for Piping Fittings of Wrought Carbon Steel and Alloy Steel for Low-Temperature Service +Specification for Electric-Resistance-Welded Coiled Steel Tubing for Gas and Fuel Oil Lines +(CONTINUED) +50 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Table 2-2 + +A 733-03 A 778-01 A 888-03 + +B 32-03 +B 42-02e1 B 43-98e1 B 68-02 +B 75-02 B 88-03 B 135-02 +B 152/B 152M-00 B 210-02 +B 211-03 +B 241/B 241M-02 B 251-02e1 +B 280-03 B 302-02 B 306-02 B 447-02 B 687-99 +B 813-00e01 B 828-02 +C 4-03 C 14-03 C 76-03 +C 296-00 C 411-97 C 425-02 +C 428-97(2002) C 443-02a +C 508-00 C 564-03 C 700-02 C 913-98 C 1053-00 + +C 1173-02 C 1277-03 +C 1440-99e1 + +C 1460-00 + +C 1461-02 + + +D 1527-99 D 1785-99 +D 1869-95(2000) D 2235-01 + +D 2239-03 D 2241-00 D 2282-99 + +Complete List of Standards By Standard-Writing Organization (continuted) + +Specification for Welded and Seamless Carbon Steel and Austenitic Stainless Steel Pipe Nipples Specification for Welded, Unannealed Austenitic Stainless Steel Tubular Products +Specification for Hubless Cast Iron Soil Pipe and Fittings for Sanitary and Storm Drain, Waste and Vent Piping Applications +Specification for Solder Metal +Specification for Seamless Copper Pipe, Standard Sizes Specification for Seamless Red Brass Pipe, Standard Sizes Specification for Seamless Copper Tube, Bright Annealed Specification for Seamless Copper Tube +Specification for Seamless Copper Water Tube Specification for Seamless Brass Tube +Specification for Copper Sheet, Strip, Plate and Rolled Bar +Specification for Aluminum and Aluminum-Alloy Drawn Seamless Tubes Specification for Aluminum and Aluminum-Alloy Bar, Rod and Wire +Specification for Aluminum and Aluminum-Alloy Seamless Pipe and Seamless Extruded Tube Specification for General Requirements for Wrought Seamless Copper and Copper-Alloy Tube Specification for Seamless Copper Tube for Air Conditioning and Refrigeration Field Service Specification for Threadless Copper Pipe, Standard Sizes +Specification for Copper Drainage Tube (DWV) Specification for Welded Copper Tube +Specification for Brass, Copper, and Chromium-Plated Pipe Nipples +Specification for Liquid and Paste Fluxes for Soldering of Copper and Copper Alloy Tube Practice for Making Capillary Joints by Soldering of Copper and Copper Alloy Tube and Fittings Specification for Clay Drain Tile and Perforated Clay Drain Tile +Specification for Concrete Sewer, Storm Drain, and Culvert Pipe Specification for Reinforced Concrete Culvert, Storm Drain, and Sewer Pipe Specification for Asbestos-Cement Pressure Pipe +Test Method for Hot-Surface Performance of High-Temperature Thermal Insulation Specification for Compression Joints for Vitrified Clay Pipe and Fittings Specification for Asbestos-Cement Nonpressure Sewer Pipe +Specification for Joints for Concrete Pipe and Manholes, Using Rubber Gaskets Specification for Asbestos-Cement Underdrain Pipe +Specification for Rubber Gaskets for Cast Iron Soil Pipe and Fittings +Specification for Vitrified Clay Pipe, Extra Strength, Standard Strength, and Perforated Specification for Precast Concrete Water and Waste Water Structures +Specification for Borosilicate Glass Pipe and Fittings for Drain, Waste, and Vent (DWV) Applica-tions +Specification for Flexible Transition Couplings for Underground Piping Systems Specification for Shielded Coupling Joining Hubless Cast Iron Soil Pipe and Fittings +Specification for Thermoplastic Elastomeric (TPE) Gasket Materials for Drain, Waste, and Vent (DWV), Sewer, Sanitary and Storm Plumbing Systems +Specification for Shielded Transition Couplings for Use with Dissimilar DWV Pipe and Fittings Above Ground +Specification for Mechanical Couplings Using Thermoplastic Elastomeric (TPE) Gaskets for Join-ing Drain, Waste, and Vent (DWV) Sewer, Sanitary and Storm Plumbing Systems for Above and Below Ground Use +Specification for Acrylonitrile-Butadiene-Styrene (ABS) Plastic Pipe, Schedules 40 and 80 Specification for Poly (Vinyl Chloride) (PVC) Plastic Pipe, Schedules 40, 80 and 120 Specification for Rubber Rings for Asbestos-Cement Pipe +Specification for Solvent Cement for Acrylonitrile-Butadiene-Styrene (ABS) Plastic Pipe and Fit-tings +Specification for Polyethylene (PE) Plastic Pipe (SIDR-PR) Based on Controlled Inside Diameter Specification for Poly (Vinyl Chloride) (PVC) Pressure-Rated Pipe (SDR-Series) +Specification for Acrylonitrile-Butadiene-Styrene (ABS) Plastic Pipe (SDR-PR) + +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 51 + + + +Table 2-2 + +D 2447-03 + +D 2464-99 D 2466-02 D 2467-02 D 2468-96a D 2513-01A D 2564-02 D 2609-02 D 2657-03 D 2661-02 + +D 2662-96a +D 2665-02ae1 +D 2666-96a(2003) D 2672-96a(2003) D 2683-98 + +D 2729-96a D 2737-03 D 2751-96a +D 2846/D 2846M-99 + +D 2855-96(2002) + +D 2949-01a + +D 2996-01 + +D 3034-00 D 3035-01 D 3139-98 +D 3212-96a(2003) D 3309-96a(2002) D 3311-02 +D 3350-02a D 4068-01 + +D 4551-96(2001) + +E 84-03b E 119-00a +E 136-99e01 E 814-02 +F 405-97 F 409-02 F 437-99 +F 438-02e1 + +F 439-02e1 + +F 441/F 441M-02 F 442/F 442M-99 F 477-02e1 + +Complete List of Standards By Standard-Writing Organization (continuted) + +Specification for Polyethylene (PE) Plastic Pipe, Schedules 40 and 80, Based on Outside Diam-eter +Specification for Threaded Poly (Vinyl Chloride) (PVC) Plastic Pipe Fittings, Schedule 80 Specification for Poly (Vinyl Chloride) (PVC) Plastic Pipe Fittings, Schedule 40 Specification for Poly (Vinyl Chloride) (PVC) Plastic Pipe Fittings, Schedule 80 Specification for Acrylonitrile-Butadiene-Styrene (ABS) Plastic Pipe Fittings, Schedule 40 Specification for Thermoplastic Gas Pressure Pipe, Tubing, and Fittings +Specification for Solvent Cements for Poly (Vinyl Chloride) (PVC) Plastic Piping Systems Specification for Plastic Insert Fittings for Polyethylene (PE) Plastic Pipe +Standard Practice for Heat Fusion Joining of Polyolefin Pipe and Fittings +Specification for Acrylonitrile-Butadiene-Styrene (ABS) Schedule 40 Plastic Drain, Waste, and Vent Pipe and Fittings +Specification for Polybutylene (PB) Plastic Pipe (SDR-PR) Based on Controlled Inside Diameter Specification for Poly (Vinyl Chloride) (PVC) Plastic Drain, Waste, and Vent Pipe and Fittings Specification for Polybutylene (PB) Plastic Tubing +Specification for Joints for IPS PVC Pipe Using Solvent Cement +Specification for Socket-Type Polyethylene Fittings for Outside Diameter-Controlled Polyethylene Pipe and Tubing +Specification for Poly (Vinyl Chloride) (PVC) Sewer Pipe and Fittings Specification for Polyethylene (PE) Plastic Tubing +Specification for Acrylonitrile-Butadiene-Styrene (ABS) Sewer Pipe and Fittings +Specification for Chlorinated Poly (Vinyl Chloride) (CPVC) Plastic Hot and Cold Water Distribution Systems +Standard Practice for Making Solvent-Cemented Joints with Poly (Vinyl Chloride) (PVC) Pipe and Fittings +Specification for 3.25-In Outside Diameter Poly (Vinyl Chloride) (PVC) Plastic Drain, Waste, and Vent Pipe and Fittings +Specification for Filament-Wound “Fiberglass” (Glass Fiber Reinforced Thermosetting-Resin) Pipe +Specification for Type PSM Poly (Vinyl Chloride) (PVC) Sewer Pipe and Fittings +Specification for Polyethylene (PE) Plastic Pipe (DR-PR) Based on Controlled Outside Diameter Specification for Joints for Plastic Pressure Pipes Using Flexible Elastomeric Seals Specification for Joints for Drain and Sewer Plastic Pipes Using Flexible Elastomeric Seals Specification for Polybutylene (PB) Plastic Hot and Cold Water Distribution Systems Specification for Drain, Waste and Vent (DWV) Plastic Fittings Patterns +Specification for Polyethylene Plastics Pipe and Fittings Materials +Specification for Chlorinated Polyethylene (CPE) Sheeting for Concealed Water-Containment Membrane +Specification for Poly (Vinyl Chloride) (PVC) Plastic Flexible Concealed Water-Containment Mem-brane +Test Method for Surface Burning Characteristics of Building Materials Test Method for Fire Tests of Building Construction and Materials +Test Method for Behavior of Materials in a Vertical Tube Furnace at 750°C Test Method for Fire Tests of Through-Penetration Fire Stops Specification for Corrugated Polyethylene (PE) Tubing and Fittings +Specification for Thermoplastic Accessible and Replaceable Plastic Tube and Tubular Fittings Specification for Threaded Chlorinated Poly (Vinyl Chloride) (CPVC) Plastic Pipe Fittings, Schedule 80 Specification for Socket-Type Chlorinated Poly (Vinyl Chloride) (CPVC) Plastic Pipe Fittings, Schedule 40 +Specification for Socket-Type Chlorinated Poly (Vinyl Chloride) (CPVC) Plastic Pipe Fittings, Schedule 80 +Specification for Chlorinated Poly (Vinyl Chloride) (CPVC) Plastic Pipe, Schedules 40 and 80 Specification for Chlorinated Poly (Vinyl Chloride) (CPVC) Plastic Pipe (SDR-PR) Specification for Elastomeric Seals (Gaskets) for Joining Plastic Pipe + +(CONTINUED) +52 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Table 2-2 + +F 493-97 + +F 628-01 + +F 656-02 + +F 714-03 F 876-03a F 877-02e + +F 891-00e1 F 1055-98e1 + +F 1281-03 + +F 1282-03 F 1488-03 F 1807-03 + +F 1866-98 + +F 1960-03 + +F 1974-02 + +F 2080-02 + + +AWS + + + + +A5.8-92 + +Complete List of Standards By Standard-Writing Organization (continuted) + +Specification for Solvent Cements for Chlorinated Poly (Vinyl Chloride) (CPVC) Plastic Pipe and Fittings +Specification for Acrylonitrile-Butadiene-Styrene (ABS) Schedule 40 Plastic Drain, Waste, and Vent Pipe with a Cellular Core +Specification for Primers for Use in Solvent Cement Joints of Poly (Vinyl Chloride) (PVC) Plastic Pipe and Fittings +Specification for Polyethylene (PE) Plastic Pipe (SDR-PR) Based on Outside Diameter Specification for Cross-Linked Polyethylene (PEX) Tubing +Specification for Cross-Linked Polyethylene (PEX) Plastic Hot and Cold Water Distribution Sys-tems +Specification for Coextruded Poly (Vinyl Chloride) (PVC) Plastic Pipe with a Cellular Core Specification for Electrofusion Type Polyethylene Fittings for Outside Diameter Controlled Poly-ethylene Pipe and Tubing +Specification for Cross-Linked Polyethylene/Aluminum/Cross-linked Polyethylene (PEX-AL-PEX) Pressure Pipe +Specification for Polyethylene/Aluminum/Polyethylene (PE-AL-PE) Composite Pressure Pipe Specification for Coextruded Composite Pipe +Specification for Metal Insert Fittings Utilizing a Copper Crimp Ring for SDR9 Cross-Linked Poly-ethylene (PEX) Tubing +Specification for Poly (Vinyl Chloride) (PVC) Plastic Schedule 40 Drainage and DWV Fabricated Fittings +Specification for Cold Expansion Fittings with PEX Reinforcing Rings for use with Cross-Linked Polyethylene (PEX) Tubing +Specification for Metal Insert Fittings for Polyethylene/Aluminum/Polyethylene and Cross-Linked Polyethylene/Aluminum/Cross-Linked Polyethylene Composite Pressure Pipe +Specifications for Cold-Expansion Fittings with Metal Compression-Sleeves for Cross-Linked Polyethylene (PEX) Pipe + +American Welding Society 550 N.W. LeJeune Road Miami, FL 33126 +www.aws.org (800) 443-9353 +(305) 443-5951 facsimile +Specifications for Filler Metals for Brazing and Braze Welding + + + +AWWA + + + + + +C104-95 C110-98 C111-00 C115-99 +C151/A21.51-902 C153-00 + +C510-97 C511-97 C651-99 C652-02 + + +American Water Works Association 6666 West Quincy Avenue +Denver, CO 80235 +www.awwa.org (800) 926-7337 +(303) 347-0804 facsimile +Standard for Cement-Mortar Lining for Ductile-Iron Pipe and Fittings for Water Standard for Ductile-Iron and Gray-Iron Fittings, 3 Inches Through 48 Inches, for Water Standard for Rubber-Gasket Joints for Ductile-Iron Pressure Pipe and Fittings +Standard for Flanged Ductile-Iron Pipe with Ductile-Iron or Gray-Iron Threaded Flanges Standard for Ductile-Iron Pipe, Centrifugally Cast for Water +Standard for Ductile-Iron Compact Fittings, 3 in. Through 24 in. and 54 in. Through 64 in. for Water Service +Double Check Valve Backflow Prevention Assembly Reduced-Pressure Principle Backflow Prevention Assembly Disinfecting Water Mains +Disinfection of Water-Storage Facilities + +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 53 + + + +Table 2-2 CISPI + + + +301-00 + +310-97 + + +CGA + + + + + +S-1.1-(1994) S-1.2-(1995) S-1.3-(1995) + +CSA + +Complete List of Standards By Standard-Writing Organization (continuted) + +Cast Iron Soil Pipe Institute +5959 Shallowford Road, Suite 419 Chattanooga, TN 37421 +www.cispi.org (423) 892-0137 +(423) 892-0817 facsimile +Specification for Hubless Cast Iron Soil Pipe and Fittings for Sanitary and Storm Drain, Waste and Vent Piping Applications +Specification for Coupling for Use in Connection with Hubless Cast Iron Soil Pipe and Fittings for Sanitary and Storm Drain, Waste and Vent Piping Applications + +Compressed Gas Association 4221 Walney Rd., 5th Floor Chantilly, VA 20151-2923 +www.cganet.com (703) 788-2700 +(703) 961-1831 facsimile +Pressure Relief Device Standards-Part 1-Cylinders for Compressed Gases +Pressure Relief Device Standards-Part 2-Cargo and Portable Tanks for Compressed Gases Pressure Relief Device Standards-Part 3-Stationary Storage Containers for Compressed Gases + +Canadian Standards Association 178 Rexdale Blvd. +Toronto, Ontario, Canada M9W 1R3 +www.csa-international.org (416) 747-4000 or 866-797-4272 (416) 747-4149 facsimile + + + +B45.1-02 B45.2-02 B45.3-02 B45.4-02 B45.5-02 B45.9-02 B45.10-01 B64.7-01 +B79-94(2000) B125-01 B137.1-02 B137.2-02 B137.3-02 B137.5-02 + +B137.6-02 + +B137.8-99 B181.1-99 B181.2-99 B182.1-02 B182.2-02 +CAN3-B137.8M-99 CAN/CSA-A257.1M-92 CAN/CSA-A257.2M-92 + +Ceramic Plumbing Fixtures +Enameled Cast-Iron Plumbing Fixtures Porcelain Enameled Steel Plumbing Fixtures Stainless-Steel Plumbing Fixtures +Plastic Plumbing Fixtures +Macerating Systems and Related Components Hydromassage Bathtubs +Vacuum Breakers, Laboratory Faucet Type (LFVB) +Floor, Area and Shower Drains, and Cleanouts for Residential Construction Plumbing Fittings +Polyethylene Pipe, Tubing and Fittings for Cold Water Pressure Services PVC Injection-Moulded Gasketed Fittings for Pressure Applications Rigid Poly (Vinyl Chloride) (PVC) Pipe for Pressure Applications +Cross-Linked Polyethylene (PEX) Tubing Systems for Pressure Applications—with Revisions Through September 1992 +CPVC Pipe, Tubing and Fittings for Hot and Cold Water Distribution Systems—with Revisions Through May 1986 +Polybutylene (PB) Piping for Pressure Applications ABS Drain, Waste, and Vent Pipe and Pipe Fittings +PVC Drain, Waste, and Vent Pipe and Pipe Fittings—with Revisions Through December 1993 Plastic Drain and Sewer Pipe and Pipe Fittings +PVC Sewer Pipe and Fittings (PSM Type) +Polybutylene (PB) Piping for Pressure Applications—with Revisions through July 1992 Circular Concrete Culvert, Storm Drain, Sewer Pipe and Fittings +Reinforced Circular Concrete Culvert, Storm Drain, Sewer Pipe and Fittings + +(CONTINUED) +54 + + +Table 2-2 + +CAN/CSA-A257.3M0-92 + +CAN/CSA-B64.1.1-01 CAN/CSA-B64.2-01 CAN/CSA-B64.2.2-01 CAN/CSA-B64.3-01 CAN/CSA-B64.4-01 CAN/CSA-B64.10-01 + +CAN/CSA-B137.1-99 CAN/CSA-B137.3-99 CAN/CSA-B137.5-99 CAN/CSA-B137.9-02 CAN/CSA-B137.10M-02 CAN/CSA-B181.2-99 CAN/CSA-B181.3-02 CAN/CSA-B182.4-02 CAN/CSA-B602-02 + +DOTn + + + + +49 CFR + + + +FS* + + + + +TT-P-1536A(1975) WW-P-325B (1976) + + +IAPMO + + + + + +UMC-03 UPC-03 USEC-00 +USPC-00 + +ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Complete List of Standards By Standard-Writing Organization (continuted) + +Joints for Circular Concrete Sewer and Culvert Pipe, Manhole Sections, and Fittings Using Rubber Gaskets +Vacuum Breakers, Atmospheric Type (AVB) +Vacuum Breakers, Hose Connection Type (HCVB) 608.13.6 +Vacuum Breakers, Hose Connection Type (HCVB) with Automatic Draining Feature Backflow Preventers, Dual Check Valve Type with Atmospheric Port (DCAP) Backflow Preventers, Reduced Pressure Principle Type (RP) +Manual for the Selection, Installation, Maintenance and Field Testing of Backflow Prevention Devices +Polyethylene Piping (PE), Tubing, and Fittings for Cold-Water Pressure Services Rigid Polyvinyl Chloride (PVC) Pipe for Pressure Applications +Cross-Linked Polyethylene (PEX) Tubing Systems for Pressure Applications Polyethylene/Aluminum/Polyethylene Composite Pressure Pipe Systems +Cross-linked Polyethylene/Aluminum/Polyethylene Composite Pressure Pipe Systems PVC Drain, Waste, and Vent Pipe and Pipe Fittings +Polyolefin Laboratory Drainage Systems Profile PVC Sewer Pipe and Fittings +Mechanical Couplings for Drain, Waste, and Vent Pipe and Sewer Pipe + +Department of Transportation 400 Seventh St. SW Washington, DC 20590 +www.dot.gov (202) 366-4000 +Parts 192.281(e) & 192.283 (b) Transportation of Natural and Other Gas by Pipeline: Minimum Federal Safety Standards +Parts 100-180 Hazardous Materials Regulations + +Federal Specification +1941 Jefferson Davis Highway, Suite 104 Arlington, VA 22202 +* Standards are available from the Supt. of Documents, U.S. Government Print-ing Office, Washington, DC 20402-9325 +Federal Specification for Plumbing Fixture Setting Compound +Pipe, Bends, Traps, Caps and Plugs; Lead (for Industrial Pressure and Soil and Waste Applica-tions) + +International Association of Plumbing and Mechanical Officials 5001 E. Philadelphia St. +Ontario, CA 91761-2816 +www.iapmo.org 909-472-4100 +909-472-4150 facsimile + +Uniform Mechanical Code Uniform Plumbing Code Uniform Solar Energy Code +Uniform Swimming Pool, Spa and Hot Tub Code + + + + + + +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 55 + + + +Table 2-2 ICC + + + +IBC-03 ICC EC-03 IEBC-03 IECC-03 IFC-03 IFGC-03 IMC-03 IPC-03 IPSDC-03 IRC-03 + +ISEA + + + + + +Z358.1-2004 + +MSS + + + + +SP-6-2001 + +SP-58-2002 SP-69-2002 SP-70-1998 SP-72-1999 SP-80-2003 + +NFPA + +Complete List of Standards By Standard-Writing Organization (continuted) + +International Code Council 5203 Leesburg Pike, Suite 600 Falls Church, VA 22041 +www.iccsafe.org 703-931-4533 +703-379-1546 facsimile +International Building Code ICC Electrical Code +International Existing Building Code International Energy Conservation Code International Fire Code +International Fuel Gas Code International Mechanical Code International Plumbing Code +International Private Sewage Disposal Code International Residential Code + +Industry Safety Equipment Association 1901 N. Moore Street, Suite 808 Arlington, VA 22209-1762 +www.safetyequipment.org (703) 525-1695 +(703) 528-2148 facsimile +Emergency Eyewash and Shower Equipment + +Manufacturers Standardization Society of the Valve & Fittings Industry, Inc. 127 Park Street, N.E. +Vienna, VA 22180 +www.mss-hq.com (703) 281-6613 +(703) 281-6671 facsimile +Standard Finishes for Contact Faces of Pipe Flanges and Connecting-End Flanges of Valves and Fittings +Pipe Hangers and Supports—Materials, Design and Manufacture Pipe Hangers and Supports-Selection and Application +Cast Iron Gate Valves, Flanged and Threaded Ends +Ball Valves with Flanged or Butt-Welding Ends for General Service Bronze Gate, Globe, Angle and Check Valves + +National Fire Protection Association 1 Batterymarch Park +Quincy, MA 02269 +www.nfpa.org (617) 770-3000 +(617) 770-0700 facsimile + + + +1-03 Uniform Fire Code 13-02 +13D-02 13R-02 + +14-03 20-99 + + +Installation of Sprinkler Systems +Installation of Sprinkler Systems in One- and Two-Family Dwellings and Manufactured Homes Installation of Sprinkler Systems in Residential Occupancies up to and Including 4 Stories in Height +Installation of Standpipe, Private Hydrants and Hose Systems Installation of Stationary Pumps for Fire Protection +(CONTINUED) +56 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + +24-02 25-02 30-03 31-01 37-02 45-00 50-01 50A-99 51-02 + +54-02 58-01 69-02 70-02 72-02 85-01 88B-97 96-01 99-02 101-03 211-03 704-01 853-00 5000-03 8501-01 8502-99 8504-96 + +NSF + + + + + + +3-2003 14-2003 18-1996 40-2000 41-1999 42-2002 44-2002 53-2002 58-2002 61-2002 62-2002 + +PDI + +Table 2-2 Complete List of Standards By Standard-Writing Organization (continuted) + +Installation of Private Fire Service Mains and Their Appurtenances Inspection, Testing and Maintenance of Water-Based Fire Protection Systems Flammable and Combustible Liquids Code +Installation of Oil-Burning Equipment +Stationary Combustion Engines and Gas Turbines Fire Protection for Laboratories Using Chemicals Bulk Oxygen Systems at Consumer Sites Gaseous Hydrogen Systems at Consumer Sites +Design and Installation of Oxygen-Fuel Gas Systems for Welding, Cutting, and Allied Pro-cesses +National Fuel Gas Code Liquefied Petroleum Gas Code Explosion Prevention Systems National Electrical Code National Fire Alarm Code +Boiler and Construction Systems Hazards Code Repair Garages +Ventilation Control and Fire Protection of Commercial Cooking Operations Standard for Health Care Facilities +Life Safety Code +Chimneys, Fireplaces, Vents, and Solid Fuel-Burning Appliances Identification of the Hazards of Materials for Emergency Response Installation of Stationary Fuel Cell Power Plants +Building Construction and Safety Code Single Burner Boiler Operation +Prevention of Furnace Explosions/Implosions in Multiple Burner Boiler-Furnaces Atmospheric Fluidized-Bed Boiler Operation + +National Sanitation Foundation 789 N. Dixboro Road +P.O. Box 130140 +Ann Arbor, MI 48113-0140 +www.nsf.org 800-NSF-Mark +(734) 769-0109 facsimile +Commercial Warewashing Equipment +Plastic Piping System Components and Related Materials Manual Food and Beverage Dispensing Equipment Residential Wastewater Treatment Systems +Non-Liquid Saturated Treatment Systems (Composting Toilets) Drinking Water Treatment Units—Aesthetic Effects Residential Cation Exchange Water Softeners +Drinking Water Treatment Units—Health Effects Reverse Osmosis Drinking Water Treatment Systems Drinking Water System Components—Health Effects Drinking Water Distillation Systems + +Plumbing and Drainage Institute 800 Turnpike Street, Suite 300 North Andover, MA 01845 +www.pdionline.org (978) 557-0720 +(978) 557-0721 facsimile + + +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 57 + + + +Table 2-2 + +G101-2003 + +WH201-1994 + +PHCC-NA + + + + + + +NSPC-03 + +UL + + + + + +17-94 + +70-96 103-98 + +127-96 174-98 343-97 391-95 + +441-96 536-97 641-95 710-95 726-95 727-94 729-98 730-98 731-95 732-95 834-98 896-93 959-01 1261-96 1453-95 + +1738-93 + +1820-97 + +1887-96 + +Complete List of Standards By Standard-Writing Organization (continuted) + +Testing and Rating Procedure for Grease Interceptors with Appendix of Sizing and Installation Data +Water Hammer Arresters + +Plumbing Heating and Cooling Contractors National Association 180 S. Washington St. +P.O. Box 6808 +Falls Church, VA 22040 +www.phccweb.org (800) 533-7694 +(703) 237-7442 facsimile +National Standard Plumbing Code + +Underwriters Laboratories, Inc. 333 Pfingsten Road +Northbrook, IL 60062-2096 +www.ul.com (847) 272-8800 +(847) 272-8129 facsimile +Vent or Chimney Connector Dampers for Oil-Fired Appliances—with Revisions Through Sep-tember 1998 +Septic Tanks, Bituminous Coated Metal +Factory-Built Chimneys, Residential Type and Building Heating Appliance—with Revisions Through March 1999 +Factory-Built Fireplaces—with Revisions Through November 1999 +Household Electric Storage Tank Water Heaters—with Revisions Through October 1999 Pumps for Oil-Burning Appliances--with Revisions Through December 22, 1999 +Solid-FuelandCombination-FuelCentralandSupplementaryFurnaces—withRevisionsThrough May 1999 +Gas Vents – With Revisions Through April 1999 +Flexible metallic Hose—with Revisions Through October 2000 +Type L Low-Temperature Venting Systems—with Revisions Through April 1999 +Exhaust Hoods for Commercial Cooking Equipment— with Revisions Through April 1999 Oil-Fired Boiler Assemblies—with Revisions Through January 1999 +Oil-Fired Central Furnaces—with Revisions Through January 1999 Oil-Fired Floor Furnaces—with Revisions Through January 1999 Oil-Fired Wall Furnaces—with Revisions Through January 1999 Oil-Fired Unit Heaters—with Revisions Through January 1999 +Oil-Fired Storage Tank Water Heaters—With Revisions Through January 1999 +Heating, Water Supply and Power Boilers Electric—with Revisions Through November 1998 Oil-Burning Stoves—with Revisions Through November 1999 +Medium Heat Appliance Factory-Built Chimneys +Electric Water Heaters for Pools and Tubs—with Revisions Through November 25, 1998 Electronic Booster and Commercial Storage Tank Water Heaters—with Revisions Through September 1998 +Venting Systems for Gas Burning Appliances, Categories II, III and IV—with Revisions Through December 2000 +Fire Test of Pneumatic Tubing for Flame and Smoke Characteristics—with Revisions Through March 1999 +Fire Tests of Plastic Sprinkler Pipe for Visible Flame and Smoke Characteristics—with Revisions through June 1999 + + + + +(CONTINUED) +58 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 2-3 Organization Abbreviation, Address, and Phone Number Listing + + +ANSI +American National Standards Institute 25 West 43rd Street, Fourth Floor New York, NY 10036 +www.ansi.org (212) 642-4900 +(212) 398-0023 facsimile +ARI +Air-Conditioning & Refrigeration Institute 4100 North Fairfax Drive, Suite 200 Arlington, VA 22203 +www.ari.org (703) 524-8800 +(703) 528-3816 facsimile +ASHRAE +American Society of Heating, Refrigerating and Air-Condi-tioning Engineers, Inc. +1791 Tullie Circle, NE Atlanta, GA 30329-2305 www.ashrae.org +(404) 636-8400 +(404) 321-5478 facsimile +ASME +American Society of Mechanical Engineers Three Park Avenue +New York, NY 10016-5990 www.asme.org +800-THE-ASME (843-2763) +(973) 882-1717 facsimile (Inquiries) (212) 591-7674 facsimile (NY) +ASSE +American Society of Sanitary Engineering 901 Canterbury Road, Suite A +Westlake, OH 44145 www.asse-plumbing.org (440) 835-3040 +(440) 835-3488 facsimile +ASTM +ASTM International 100 Barr Harbor Drive P.O. Box C700 +West Conshohocken, PA 19428-2959 www.astm.org +(610) 832-9585 +(610) 832-9555 facsimile +AWS +American Welding Society 550 N.W. LeJeune Road Miami, FL 33126 www.aws.org +(800) 443-9353 +(305) 443-5951 facsimile + +AWWA +American Water Works Association 6666 West Quincy Avenue +Denver, CO 80235 www.awwa.org (800) 926-7337 +(303) 347-0804 facsimile +CISPI +Cast Iron Soil Pipe Institute +5959 Shallowford Road, Suite 419 Chattanooga, TN 37421 www.cispi.org +(423) 892-0137 +(423) 892-0817 facsimile +CGA +Compressed Gas Association 4221 Walney Rd., 5th Floor Chantilly, VA 20151-2923 www.cganet.com +(703) 788-2700 +(703) 961-1831 facsimile +CSA +Canadian Standards Association 178 Rexdale Blvd. +Toronto, Ontario, Canada M9W 1R3 www.csa-international.org +(416) 747-4000 or 866-797-4272 (416) 747-4149 facsimile +DOTn +Department of Transportation 400 Seventh St. SW Washington, DC 20590 www.dot.gov +(202) 366-4000 +FS* +Federal Specification +1941 Jefferson Davis Highway, Suite 104 Arlington, VA 22202 +* Standards are available from the Supt. of Documents, U.S. Government Printing Office, Washington, DC 20402-9325 +IAPMO +International Association of Plumbing and Mechanical Officials +5001 E. Philadelphia St. Ontario, CA 91761-2816 www.iapmo.org +909-472-4100 +909-472-4150 facsimile + + + +(CONTINUED) +Chapter 2 — Standards for Plumbing Materials and Equipment 59 + + + +ICC +International Code Council 5203 Leesburg Pike, Suite 600 Falls Church, VA 22041 www.iccsafe.org +703-931-4533 +703-379-1546 facsimile +ISEA +Industry Safety Equipment Association 1901 N. Moore Street, Suite 808 Arlington, VA 22209-1762 www.safetyequipment.org +(703) 525-1695 +(703) 528-2148 facsimile +MSS +Manufacturers Standardization +Society of the Valve & Fittings Industry, Inc. 127 Park Street, N.E. +Vienna, VA 22180 www.mss-hq.com (703) 281-6613 +(703) 281-6671 facsimile +NFPA +National Fire Protection Association 1 Batterymarch Park +Quincy, MA 02269 www.nfpa.org (617) 770-3000 +(617) 770-0700 facsimile +NSF +National Sanitation Foundation 789 N. Dixboro Road +P.O. Box 130140 +Ann Arbor, MI 48113-0140 www.nsf.org +800-NSF-Mark +(734) 769-0109 facsimile +PDI +Plumbing and Drainage Institute 800 Turnpike Street, Suite 300 North Andover, MA 01845 www.pdionline.org +(978) 557-0720 +(978) 557-0721 facsimile +PHCC-NA +Plumbing Heating and Cooling Contractors National Association 180 S. Washington St. +P.O. Box 6808 +Falls Church, VA 22040 www.phccweb.org (800) 533-7694 +(703) 237-7442 facsimile + +UL +Underwriters Laboratories, Inc. 333 Pfingsten Road Northbrook, IL 60062-2096 www.ul.com +(847) 272-8800 +(847) 272-8129 facsimile +60 ASPE Plumbing Engineering Design Handbook — Volume 1 +3Specifications + +INTRODUCTION +Plumbing drawings, plumbing specifications, gen-eral conditions, special conditions, and the addenda comprise the contract documents that make up the contractbetweentheownerandthecontractor.None of these items can stand alone: the drawings cannot serveasacontractwithoutthespecificationsandvice versa. The plumbing designer must, therefore, be familiar with specification writing. If others prepare the specifications, then the plumbing designer must be able to coordinate the drawings with the project specifications. +When writing specifications, the plumbing de-signer must use clear, precise, and exact language in order to convey to the reader the information re-quired. The essence of a well-written specification is clarity, brevity, correctness, and completeness. +Specification writers should follow established, uniform practices that will ensure good communica-tion between the designer and all other segments of the construction industry. The result will be a set of documents that allow an engineer in one part of the country to converse with a supplier or contractor in another location, and the specifications contain the same language and meanings for all parties. +CONSTRUCTION CONTRACT DOCUMENTS TheConstructionSpecificationsInstitute(CSI)devel-oped and implemented a set of documents known as theManualofPracticethathasbeenusednationwide for about 40 years. +This Manual is intended to provide an ordered, logical, simple, and flexible format for the specifica-tionwritertouseinthepreparationofspecifications. One of the principles of this format, which is known as Masterformat, is to establish a standard location where only specific information is stated. This loca-tionletsthereaderretrievetheinformationrequired in the least amount of time. It is essential that the plumbing specification writer be familiar with and + +understands all the components that constitute the Manual of Practice in order to write clear, concise specifications. The components discussed in this chapter are Uniformat, Masterformat, and Section-format. +DEFINITION OF TERMS +It is necessary to define some terms used in the con-struction contract documents so that one term, and only that one term, is used for any one part of the documents. +Bidder – The bidding and subsequent awarding of the contract. +Contractor – The successful bidder after the awarding of the contract. +Bidding documents – Construction documents issued to bidders before the owner/contractor agree-ment has been signed. +Bidding requirements – The explanation of pro-cedures to follow when preparing and submitting the bid. This is also used to attract potential bidders. +Contract documents – Documents that are the legally enforceable requirements that become part of the contract when the agreement is signed. +Projectmanual–Biddingrequirementscombined withtheotherconstructiondocuments.Thesearenot part of the contract documents. +Work–Theperformingofservices,thefurnishing oflabor,andsupplyingandincorporatingofmaterials and equipment into the construction. +Construction contract documents – The proposed constructionwhichisreferredtoasthe“work.”Many times these documents are referred to as the “con-tract documents” and erroneously, as the “plans and specifications.”Itshouldbenotedthatmanytimesin thesedocumentsareneitherplansnorspecifications. Instead of the use of the term “plans” when refer-ring to the graphic documents, the term “drawings” shouldbeused.Manytimestheterm“specifications” is expanded to generally refer to all written docu- +62 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +ments. The correct term when describing all of the documents, with the exception of the drawings, is “project manual.” + +PROJECT MANUAL +The project manual is an accurate and descriptive term to describe the collection of documents other than the drawings. This manual consists of the fol-lowing documents: +1. Pre-bid Information advises those prospective bidders about the proposed project. Private work going out for bid is usually advertised to the bidders by mail or by telephone. The Architect, Engineer, or the Owner invites these bidders, and bidding is restricted to those bidders invited. This method is usually referred to as “Bid by In-vitation.” Pre-bid information for public work is requiredbylawtobeadvertisedinallnewspapers of general subscription in the immediate area where the work is to be bid. These public notices, which are governed by local ordinances, are pub-lished for a predetermined period of time. +2. Instructions to Bidders are written to inform the prospective bidders how to prepare their bid so that all bids are in the same format and can be easily and fairly compared after the bid open-ing. +3. BidFormsarepreparedbytheArchitect/Engineer to provide uniform bid submittals by the bidders and to facilitate the comparison and evaluation of the bids received. +4. Bonds and Certificates are the legal documents that bind a third party into the contract as a suretythatthebidderandtheownerwillperform as agreed. This could also be used to insure that thecontractorandsubcontractorswillperformas agreed. The types of bonds commonly used are: +(a) BidBond–Assuresthatthebidderwillenter intoacontractwiththeownerorthecontrac-torifthebidderisselectedduringthebidding phase; +(b) Performance Bond – Assures that the work, once a contract has been signed, will be completed in compliance with the contract documents; +(c) LaborandMaterialsPaymentBond–Assures that workers on this project will be paid in full,andthatallsuppliersthathaveprovided materials for the project will be paid in full prior to the project closeout; +(d) Guaranty Bond – Guarantees that the contractor will be paid in full for all work performed to construct the project; +(e) Certificates – Certificates of insurance, or proof of insurance from the contractors and/ + +or subcontractors, as well as certificates of compliance with applicable codes, laws, and regulations. + +5. TheAgreementisthewrittendocumentsignedby theownerandthecontractor,orbythecontractor andasubcontractororamaterialsupplier,thatis the legal instrument binding these parties to the contract.Theagreementdefinestherelationships as well as the obligations between the signing parties. +6. General Conditions are the general clauses that establish how the project is to be administered. Theseclausescontainprovisionsthatarecommon practiceintheUnitedStates.TheAmericanInsti-tute of Architects, AIA, has developed Document A201, “General Conditions of the Contract for Construction.” A printed copy of which is usually included into the project manual and referenced by the other documents included in the manual. Generalconditionsdocumentsareavailablefrom other organizations such as the National Society of Professional Engineers (NSPE), the Ameri-can Consulting Engineers Council (ACEC), the AmericanSocietyofCivilEngineers(ASCE),and the Construction Specifications Institute (CSI). +7. Supplementary Conditions are the clauses that modify or supplement the general conditions, as needed, to provide for requirements specific to thatproject.Theyconsistofmodificationsand/or substitutions such as insurance requirements, prevailing wage rates, etc. It is important to remember that these are not standardized docu-mentslikeAIAA201andmustbepreparedbased on the requirements of the specific project. +8. Specificationsverballydescribetherequiredmate-rials and equipment, the level of quality required for installation and equipment, and the methods by which the materials and equipment are as-sembled and installed, and how they interface within the project as a whole. The specifications also set the administrative requirements for the contract. All items pertaining to the work under contract should be included in the specifications. The plumbing drawings graphically illustrate the scope of the design, the equipment location, the routing of piping, the quantity of materials required, and the interface with the other trades involved. +9. Addenda are the written or graphic documents that are issued prior to the bid to clarify, revise, add to, or delete information in the original bid-dingdocumentsorinpreviousaddenda.Itshould be noted that while an addendum is typically is-suedpriortothebidopening,AIAdocumentA201 allows for the issuance of an addendum any time up to the execution of the contract. This feature +Chapter 3 — Specifications + + +allowsforthenegotiatedadjustmentofaselected bid after the bid opening. In contrast, the similar documentbytheEngineersJointContractDocu-mentsCommittee(EJCDC)restrictstheissuance of addenda pre-bid opening. +10. Modifications are the written or graphic docu-ments that are issued after the construction agreement has been signed to allow for additions to, deletions from, or modifications of the work tobeperformed.Thesechangesareaccomplished by the use of change orders, construction change directives, work change directives, field orders, architect’s supplemental Instructions (ASI), and written amendments to the construction agree-ment. These changes or modifications can be issued anytime during the contract period. +Each of the above listed documents is a separate document, but when grouped together, they are col-lectively referred to as the “Front End Documents.” Although the specifications document usually com-prises the bulk of the project manual, it is only one of the required documents. If the project is primar-ily plumbing, then the plumbing engineer/designer may be responsible for the preparation of the entire project manual. + +SPECIFICATIONS +Originally all documentation for a given project was placed upon the drawings, but as the amount of information increased to where it would not fit the drawing, another way was needed to present this information. The designers simply started compiling all the notes that would not fit onto the drawings and over time designers have added additional informa-tion,productrequirements,contractualprovisions,as well as construction methods and systems to create a written document. The specification is used to define the qualitative requirements for products, materials and workmanship that will be used to construct a given project. +Asthepopularityofthespecificationgrewamong design professionals, so did the problems this new idea created. Among these problems, there were no “universal”guidelinestoinsureauniformdocument. Each designer wrote specifications using their own style according to what they thought was important. Even the specifications that came from large firms were lacking in consistency between documents. Materials, methods or items that were related were not grouped together in a logical manner but were scattered throughout the document in a seemingly random manner. This practice caused great diffi-culty when the contractor tried to prepare a specific bid, making it very easy to overlook important and costly items. Also, coordination between the various trades and the contractor would be difficult at best. + +63 + + +Last-minute changes were extremely difficult to ac-complish. +Specifications can be generated in as many ways. They may be produced by the designer as part of the design process or by a specific individual within the firm who is employed full time to writing project specifications. Large firms may even have a full-time specifications department. +Thefirstthingthedesignermusthaveisasmuch information as possible that pertains to the section to be written. This includes any reference materials that describe products and methods of construction to be described within the specification section. The project information would include the drawing set as prepared by the designer, the project notebook, the project scope of work and any applicable laws and/or building codes. Information for the products can be obtained through a variety of sources, which include: (1)previousprojectspecifications;(2)manufacturer’s information; (3) handbooks, pamphlets, etc for the various trade associations; (4) information from the manufacturer’s representatives; (5) reference standards from national standards organizations, governmental agencies, and trade associations; (6) technical and professional societies; (7) commer-cially prepared guide specifications; (8) information obtained from the trades, contractors, etc.; and (9) personal experience. +Never edit previous specifications for use in the new project, as they may not contain required lan-guage, the standards cited may have changed, the products specified may not be available any more, or the codes and/or laws may have changed since those specifications were first written. +Oncetheinformationthatwillbeneededhasbeen gathered the designer must now decide what type of format will be used as the basis of the specifications to be written. +Dependingonthesizeoftheprojectortheproject phase that the specification is being prepared for, the designermaychooseashortabbreviatedformatsuch as Uniformat developed by the CSI. For the larger, more complex projects the designer may choose the full format as is found in the Masterformat devel-oped by the CSI. Both Uniformat and Masterformat were developed in the early 1970s and 1960s, respec-tively. +In addition to the Uniformat and Masterformat specificationformatlistedabove,therearealsospeci-fications developed by the Engineer’s Joint Contract DocumentsCommittee(EJCDC),AmericanInstitute of Architects (AIA), National Society of Professional Engineers (NSPE), as well as various governmental agencies such as the Corps of Engineers (USACOE), the armed services, NASA, etc. +64 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +The designer needs to become knowledgeable of the different specifications that are available so they can decide which specification is best suited for the phase of the project being designed. + +UNIFORMAT +Uniformat is the specification system that was devel-oped during the early 1970s and is a system-based format. This format is used primarily during the schematicphaseaswellasthepreliminaryor“budget-ary” cost estimates. The Construction Specifications Institute (CSI) and the Construction Specifications Canada(CSC)recommendtheorganizationofproject data during the preliminary project phases. +Uniformat is divided into eight broad categories or sections: (A) substructure; +(B)shell;(C)interiors;(D)services;(E)equipment and furnishings; (F) other building construction; (G) sitework; and (Z) general. For more information and the subcategories found within each of the eight categories of this format, refer to Appendix 3-A1. Ad-ditional information on Uniformat may be obtained from CSI’s publication Manual of Practice. +OneofthebestfeaturesofUniformatisthateach category or sub-category can be easily expanded as more information is accumulated during the ongo-ing design process. As more information is added to the Uniformat, provides the estimator with valuable information to prepare an informed preliminary cost estimate. +Oncetheprojectprogressesfromthepreliminary orschematicphase(wheretheUniformatprovidesthe necessary information) to the design development or “DD” phase, more detailed information is required that Uniformat is not designed to handle. At this stage of the project, outline specifications are usually introduced to organize the required information. In some projects, the use of the outline specification may be required as part of the agreement between the owner and the architect/engineer (A/E). Refer to AIA document B141 and ESCDC document 1910-1 for additional information. +Drawings that are prepared during the design developmentphasecontainmoredetail,bothgeneral and specific, than the schematic phase drawings. + +MASTERFORMAT +Some designers organize their outline specifications at this point around CSI’s Masterformat because this format can be used from the design development phase through to the construction documents (CD). +Masterformat is a master list of the divisions numbers and titles that was developed during the Washington, D.C., conferences in 1962 and 1963 and later became the industry standard in both the United States and Canada. The core of this system + +is the five-digit numbers and titles that arrange construction/project data into an organized order of sequence. By having this universal standardized system, the placement and retrieval of information isgreatlyfacilitated,andcommunicationthroughout theentireconstructionphasealsoisgreatlyimproved. Under this format, group numbers and titles are organized under these headings: (1) introductory in-formation; (2) bidding requirements; (3) contracting requirements; (4) facilities and spaces; (5) systems and assemblies; and (6) construction products and activities (divisions 1-16). The first five groups, while theyarenotspecifications,areusuallyincludedinthe projectmanual.Thelastgroupformstheconstruction specifications. +Under the heading (6) construction products and activities, there are four levels of detail for each division. Level One consists of the titles for the 16 divisions (see Appendix 3-A2). The Level Two titles (or sections) are referred to as “broad scope” because they provide the widest scope in describing the work to be performed or the products to be utilized (see Appendix 3-A3). Level Three titles are sometimes referred to as “medium scope” since they cover work thatismorelimitedinscopethanundertheleveltwo titles. Level Three takes the titles listed under Level Two and further divides them in order to add a more definitivescope(seeAppendix3-A4).Thetitlesfound under Level Four are the most limited in scope and are often referred to as “narrow scope”. These titles cover elements of the work that are very specific (see Appendix 3-A5). +In the progression from Level One to Level Four, thetitles(orsections)becomemorenarroworspecial-ized. For example, using the spec for nitrogen piping, at Level One it would be 15000-Mechanical. Then, at Level Two the title is further defined to 15200-Pro-cess piping. At Level Three, this section is defined as 15210-Process Air and Gas Piping. Finally, at Level Four, the title is further defined to 15215-Nitrogen Piping. + +MASTERFORMAT 2004—AN OVERVIEW +Since last being updated in 1995, CSI’s Master-Format has been the staple of the architectural and engineering community. This document, while it was good, began to show some problems with respect to supporting the entire construction industry and it had very limited room for any future expansion. In 2001 a seventeen-member task force known as the MasterFormat expansion task team (MFETT) was formed by CSI to address problems of the document currently in use. Three years and many drafts later, thereviseddocumentknownasMasterFormat2004is +Chapter 3 — Specifications + + +now ready and will be available in late autumn 2004 through CSI at their website (www.CSINet.org) . +Significantchangeshavebeenmadeintheorgani-zationofthisdocument.Thefirstsignificantchangeto be made in the organization of the MasterFormat 95 is the reduction of the six groups to only two groups (Procurement and Contracting Requirements Group and Specifications Group). The Procurement and ContractingRequirementsGroupknown,bythemore familiarnamefrontenddocuments,containsthebid-ding information, project forms, contract conditions, etc. Essentially this is the same material, just with a new name and different location. The Specifications Group contains the administrative and technical requirements that govern a project. This group is dividedintofivesubgroups,whicharefurtherdivided intoatotalofforty-ninedivisions.Thefivesubgroups comprising the Specifications Group are: (1) General Requirements(Division01),(2)FacilityConstruction (Divisions 02-19), (3) Facility Services (Divisions 20-29),(4)SiteandInfrastructure(Divisions30-39),and (5) Process Equipment (Divisions 40-49). Appendix 3-B1 contains a complete list of subgroups and divi-sions and a short description of any changes. +The original numbering system consisted of a five-digit number (began in 1978) that organized the information throughout the sixteen divisions. The new system utilizes a six-digit number that consists of three pairs of two digit numbers. For example, 03200 found in MasterFormat 95 was replaced by 03 2000(thenewnumberforConcreteReinforcement). Level four numbers have been removed. However, recommendationsfortheirusehavebeenincludedin the supporting documents should the specifier wish to include level four. It should be noted that each level has two digits and this alone allows ten times as many subjects as was possible under the old five digit format. +Site construction was located in Division 2 under the old system and is now listed as Division 02-Ex-isting Conditions and all site construction subjects have been relocated to the Civil and Infrastructure Subgroup. Division 02 now contains subjects dealing withitemsandconditionsonthejobsiteatthestartof the project including selected demolition, subsurface and site investigation, surveying, site decontamina-tion and site remediation, etc., +Beginningwiththisedition,therewillbesections includedtoclassifyinformationforfacilityoperations and maintenance, repairs and commissioning. This information will be located in each division instead of being placed in its own division. +Another change is the relocation of certain items from one Division to other Divisions. Division 15 has now been reserved for future expansion. Plumbing items have been relocated to Division 22-Plumb- + +65 + + +ing and HVAC items have been moved to Division 23-Heating, Ventilation and Air Conditioning. Fire Suppression items that were located to Division 13 have been relocated to Division 21-Fire Suppression. Refer to Appendix 3-B2 for a listing of sections found in Division 21-Fire Suppression. For a more detailed breakdown of subjects listed in this Division refer to Appendix 3-B3. Appendix 3-B4 contains a listing of the sections found in Division 22-Plumbing, while Appendix 3-B5 contains a more detailed breakdown of the sections and subjects. +In conclusion, the changes discussed above and any others made to MasterFormat 2004 were made tofacilitateuseintheArchitecturalandEngineering fields for years to come. As when anything changes, there will be those who love, hate, use or ignore the new. However, MasterFormat 2004 deserves a chance. +While Masterformat provides standardization as well as the titles to be used in the project manual, it does not address the way in which information will be organized. This need for standardization within a section prompted the development of Sectionformat. Thisformatoroutlineproducesorganization,appear-ance, and completeness that is consistent from one section to the next. It may be used as a checklist to gather information for each section. +A good specification section will provide the an-swer to the following three questions: (1) How does the work defined in the section relate to the work defined for the rest of the project? (2) What materials and/or products are to be used to complete the work under this section? (3) How are these materials and/ or products to be incorporated into the work under this section and the project as a whole? The answers to these questions are grouped into three parts to form the outline for a given section. These parts are: Part I—GENERAL, Part 2—PRODUCTS, and Part 3—EXECUTION. Refer to Appendix 3-C1 for the shell outline developed by the American Institute of Architects (AIA) that conforms to the manual of practice as prepared by the Construction Specifica-tions Institute (CSI). The order in which these parts are used within a section is fixed in both name and order, providing a consistent format throughout all sections. This, in turn, simplifies the designer’s job and makes the finding of information by the reader much easier. +Masterformat and Sectionformat, when used together, will produce specifications that are clear, complete, accurate, and coordinated. This allows the information to flow from the divisions to the sections to the parts and vice versa. +66 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +METHODS OF SPECIFICATION Specifications are written using one of the follow-ing four methods of specifying products, materials, or workmanship. These four methods include: (1) descriptive specifications; (2) performance specifica-tions; (3) reference standard specifications; and (4) proprietary specifications. +A descriptive specification consists of a detailed written description of the required properties of a product, material, or piece of equipment and the workmanship required for its proper installation. When writing this type of specification, it is impor-tant to remember that proprietary or brand names of manufactured products are not to be used and the specifier assumes the burden of performance. This method of specifying was once widely used, but as projects became more complex, its use has declined. Writing this type of specification is very tedious and time consuming. Descriptive specifications are used when the use of proprietary names are prohibited by law (such as with federally funded projects) or it is notpossibletowriteareferencestandardspecification due to a lack of reference standards. +In order to write a descriptive specification, the specifier needs to adhere to certain basic steps. The specifier should:(1) Researchavailable products that willbeincludedinthissection;(2)Researchthecriti-cal features that will be required in this section, then analyze and compare these requirements with the products that are available; (3) Review the features that are required and determine which features are bestdescribedbythespecificationandwhichfeatures would be best shown on the drawings; (4) Be sure to describe features considered to be critical and the minimum acceptable requirements; and (5) be certain requirements can be met by the products to be supplied. The designer should take care in select-ing and specifying unique features from different products and manufacturers (picking features from one product and combining it with others, etc). This could create a descriptive specification of a particu-lar product that does not exist. When this happens, the designer must spend additional time to rewrite the description. Avoid any unnecessary features and minutely detailed requirements. +A performance specification is a statement or statements of the results and criteria the specifier requires to verify compliance. It should not contain unnecessary limitations on the methods for achiev-ing the required results. All desired end results the specifier wants must be spelled out completely. An incompleteperformancespecificationwillresultinthe designerlosingcontroloverthequantityofmaterials, equipment, and workmanship that will go into the project. Criteria for verifying compliance includes criteria for measurement, test evaluation, or other + + +means as required by the designer to assure that the standards of performance have been met. +When using the performance specification, it shouldberememberedthatonlyessentialrestrictions are to be placed upon the system while limitations on the means should be avoided. It also should be remembered that when performance specifications are the primary method of design and contracting procedure, specialized contract documents would be required.Thisisbecausethecontractdocumentswill be far more complex and often will involve a variety of participants in the contract proceedings. +The reference standard specification is the use of a nationally or internationally recognized standard to specify a product, materials, or workmanship instead of writing a detailed description. A standard is generally defined as a requirement defined by a recognized authority, custom, or general consensus. Trade associations, professional societies, standards organizations, or governmental and institutional organizationsusuallypublishthesestandards.Acom-mitteeofarchitects,engineers,scientists,technicians, manufacturers,andproductusersveryknowledgeable about that particular subject area usually author a standard. +There are six types of reference-based standards thatarecommonlyusedwhenwritingaspecification. These include: (1) basic material standards; (2) prod-uctstandards;(3)designstandards;(4)workmanship standards; (5) test-method standards; and (6) codes. The materials are addressed for the system. Basic materialstandards,suchasASTMB88-03“Standard SpecificationforSeamlessCopperWaterTube,”were writtenbytheAmericanSocietyofTestingMaterials (ASTM) and cover one item — in this case, copper watertubingsuitableforgeneralplumbingorsimilar applications for conveying fluids and commonly used with solder, flared, or compression fittings. Products are to conform to items identified in a standard. Product standards, such as ASME B16.22-2002 “Wrought Copper and Copper Alloy, Solder Joint, Pressure Fittings,” (written by the American Society of Mechanical Engineers (ASME)), establishes speci-fications for wrought copper and copper alloy, solder joint, seamless fittings designed for use with copper tube that conforms to ASTM B88-03. +Designrequirementsaresetforthforthesystem. A design standard, such as ACI-318 “Building Code Requirements for Reinforced Concrete,” is written by the American Concrete Institute (ACI) to cover the use of reinforced concrete in building assemblies. Workmanship standards describe the construc-tion procedures that are necessary. Workmanship standards include items such as ASTM B828-02, “Standard Practice Making Capillary Joints by Sol-deringCopperandCopperAlloyTubingandFittings.” +Chapter 3 — Specifications + + +This standard describes the procedure for making capillary (“sweat”) joints using solder, copper tube, and copper or copper alloy fittings. +Test method standards establish the minimum requirements of what is being tested and how to test systems for compliance to the standard. Test standards such as ASTM E53-02, “Standard Test Methods for Determination of Copper in Alloyed Copper by Gravimetry,” describe the test procedures and protocols required to obtain a chemical analysis ofcopperhavingaminimalpurityof99.75%bygravi-metricanalysis.Acodestandardcontainsregulations that govern materials to be used, how they are to be installed, etc. Code standards, such as the National Standard Plumbing Code published by the National Association of Plumbing-Heating-Cooling Contrac-tors is a body of code regulations adopted by local municipalities as their plumbing code. +When a designer wants to refer to or “cite” a standard, it is not necessary to include the entire text of the referenced standard into the body of the specification to be written. The desired standard can be included in the document by referring to its num-ber, title, or other designation. The most common form is to cite it with the initials of the organization that sponsors it and the number of the standard, such as ASTM B88-03. The last digits separated by the hyphen are the date the standard was written or last revised. Sometimes the standard will be seen withalowercase“a”afterthedate.Thisindicatesan amendmenttothestandard.These“cited”standards become part of the document just as surely as if the standard’s entire text were included. +When using the reference standard, the designer needs to remember certain things. First, there are bad reference standards as well as good ones. Next, the indiscriminate use of these standards within the document can result in duplication, contradiction, and general chaos for designer, contractor, and the owner. Finally, some of the standards may contain hidden choices that the designer may not know even exists, and their inclusion into the document may cause a myriad of problems with the enforcement of the contract conditions. These standards often only meet the minimum requirements. +Beforewritingareferencebasedspecification,the designers should thoroughly familiarize themselves with the standards they plan to use and how to incor-porate these standards into the document correctly, as well as how to enforce the requirements of the standard once it has been included. +Due to possible conflicts between the language of thewrittenstandardandthegeneralconditionsofthe contract, the designer should include a clause in the supplementary conditions of the contract that states thecontractconditionsshallgovernovertherequire- + +67 + + +mentsofthecitedreferencestandards.Anotherclause shouldstatethatshouldaconflictordiscrepancyarise between the reference standard and another cited reference and the specifications, the more stringent requirement shall apply. Once the standard has been specified, it becomes necessary for the designer to be able to enforce the requirements of that particular standard once the project begins. The most com-mon means to ensure compliance of the standard is to check the shop drawings and other submittals (including manufacturer’s literature, samples, and test reports) and make regular site visits to insure compliance of the workmanship standards. +The last method of specifying is the use of the proprietary specification. This method identifies the products to be used by manufacturer’s name, brand name,themodelnumber,typedesignation,orunique characteristics. A specification is considered propri-etary if the product to be specified is available from a single source. +The use of this type of specification has both advantages and disadvantages. Advantages include: allowing for closer control in the selection of the product;havingmoredetailedandcompletedrawings duetothemorepreciseinformationfromtheproduct supplier; having shorter specifications which result in shorter production time; allowing for removal of product pricing as a major variable; and narrowing of the competition which will simplify the bidding process. Disadvantages to the use of this method include: the elimination or narrowing down of the competition (preferential treatment might be shown foroneproductoveranotherandresentmentmightbe directed back to the designer); forcing the contractor to do work with a product with which they have very little or no prior experience (this could result in poor performancebythecontractor);andpossiblyspecify-ing a product to be provided by a manufacturer that no longer exists. +Therearetwotypesofproprietaryspecifications: closed and open. The difference between them lies in how the subject of substitutions of the specified products is handled. Open specifications usually allowsubstitutionoftheproducts,whileclosedspeci-fications usually do not allow any substitutions but restrict the selection to a limited number of choices. The closed proprietary specification allows the design to be completed with higher-level detail while reducingthevariables,thuspromotingmoreaccurate bids. It will not, however, provide protection against highercostscausedbyasupplierofaspecifiedproduct taking an unfair advantage of his proprietary posi-tion and increasing the price. The closed proprietary specification may either list one product or multiple products as the designer sees fit, and there are no substitutions allowed. The designer can control the +68 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +product selection through the use of the instructions found in section 01630-(“Product Substitution Pro-cedures”), which provides requirements for the use of the product or products specified. Under a closed proprietary specification, when only a single product is specified, the substitution of another product is not allowed, and the bids submitted will be based upon this product only. When a product is specified by naming several manufacturers, the substitution of other products shall not be allowed, and the bids submittedwillbebasedontheproductsspecified.The successful bidder is usually required to submit a list of the product or products they intend to use; within a specified time following the bid for approval, but priortopurchaseandinstallation.Ifthereareatleast three products named and competition is achieved in the bid process, it is up to the designer to make sure theproductsareequalandacceptableforthepurpose to which they are being specified. +The open proprietary specification specifies or names products or materials in the same manner as theclosedspecification.Thedifferenceisthatalterna-tives for the specified products or materials are also listed. The bidder must bid on those specified items and may also provide prices for the alternative items specified. These prices are usually included on the bid form in the spaces provided. To clarify bidding processes, the designer might include instructions to the bidder such as the following: “When the product is specified to only one manufacturer, substitution of products will not be allowed. If alternates to the base bidarerequested,thenthebiddermaysubmitbidsfor thealternateitems.Thesebidpricesshallincludethe amountrequiredtoincorporatethealternateproduct into the project. Requests for additional monies for alternate products or materials shall not be consid-ered after the agreement has been executed.” The openproprietaryspecificationremovestheproblemof overpricing, which is common in sole-source product or material bids. It also allows for the selection of al-ternate items and price quotations for those items. +The major problem with proprietary specifica-tions is the attempts by some bidders to introduce products or materials inferior in quality to those that werespecifiedoriginally.Thisproblemisthegreatest when the bidder is allowed to specify substitutions after the award of the contract. This leads to the practice known as “bid shopping.” This is unfair to those who submitted bids originally and pressure is put on the designer to accept these inferior product substitutions. +In order to prevent this situation, the designer must maintain control over the bidding process by including requirements in the specifications similar to the following: (1) All substitution requests are to be in writing from the bidders, only and any requests + +from manufacturers and suppliers will not be con-sidered. (2) The setting of a definite deadline for the submission of substitution requests by the bidder. This deadline should be a minimum of ten (10) days prior to the bid opening. (3) All requests for substitu-tionsshallbesubmittedwiththerequestforapproval. Submissionswithoutsupportingdocumentationshall not be considered. (4) The designer shall review all submissions and issue notification of any accepted substitutions to all bidders by addendum. The time period between the deadline for requests and the addendum is at the discretion of the designer, but should not be less than three (3) days to allow proper examination of the submitted materials. +The federal government and other public au-thorities forbid the use of the proprietary or other exclusionary specifications except under special con-ditions. + +CREATING THE SPECIFICATION SECTION +Having examined the methods by which products, materials, or workmanship are specified, we shall now look at how these methods are used to create a specification section for the project manual. Refer to Appendix 3-C1, Section Shell Outline, to help il-lustrate a specification section, in conformance with the Manual of Practice. +Beginning at the top, the first item to be com-pleted is the section number. The section number is a five-digit number corresponding to MasterFormat. This number may refer to any level from Level Two to Level Four, depending on how specific this section will be. Following the section number is the section title. The designer should keep this to a maximum of one line, 6-8 words. +UnderSectionformatasdiscussedearlier,aspeci-fication section is divided into three parts. These are (1) PART 1—GENERAL; PART 2—PRODUCTS; PART 3—EXECUTION. The section number is usu-ally either Level Two or Level Three. Level Four section numbers are not assigned. This provides the user with greater flexibility by allowing a location for the designer to add specifications if necessary. +PART 1—GENERAL includes: the scope of and, any necessary references to the related work, codes, and standards that are to be in force during the project; qualifications for both manufacturers and workmanship; required submittals, including the formatrequiredforsubmissionofthesubmittals;any samples required for examination by the designer; required information on product manufacturing and shipping schedules; receiving and storage require-ments; as well as any other information found to be necessary. +Chapter 3 — Specifications + + +PART2—PRODUCTSincludesthoseproductstobe usedontheprojectthatarepartoftheworkdescribed by this specification section. These products should be described as accurately, completely, and, above all, briefly as possible to give the reader the facts needed in least amount of text. Any descriptions of these products shall be to describe the product to be used andpresentanypertinentdatarequiredfortheuseof that product. The designer should not include instal-lation instructions and like information in this part, but should include it in PART 3—EXECUTION. +PART 3—EXECUTION contains the detailed in-structionsofhowtheproductslistedinPART2areto beusedorinstalledintheworkbeingperformed.Each product listed in PART 2 should have information as to its use in this part. Also, included in this section: anytestingthatistobeperformed(besuretoinclude instructions on who pays for the testing, as well as what tests and the number required); instructions for the coordination between the various trades; the acceptance of the substrate; and any required toler-ances for installations. + +PART 1 +Section 1.1 Summary +The first section of Part 1 is the summary. In this section, there is the description of the work to be performed, the listing of any products to be furnished but not installed, and products that are not furnished but are to be installed. This also is sometimesaclausereferredtoas“ownerfurnished, contractorinstalled.”ThenextitemfoundinPART 1 is the listing of the related sections. It is here that other sections in the specifications contain-ing requirements related to this particular section are listed. Some designers choose to omit this part because during last-minute changes, this often fails to get updated resulting in a confusing, flawed document. Also found in the summary are allow-ances,unitprices,andalternates.Anallowanceisa predeterminedmonetaryamountagreedtobyboth the designer and the owner to be inserted into the bid for certain items such as art work, furniture or even plumbing fixtures. A unit price is a fixed bid price amount for an item such as a water closet, lavatory, and per-foot price on a four-inch cast iron pipe, etc. An alternate is a defined portion of the work that is priced separately and provides the owner an option for to select for the final scope of the work. Alternates usually allow choices among the products to be used or to add or delete portions of the work from the project. +Section 1.2 References +Another item found in the first section is the refer-ences. It is here that the reference standards that + +69 + + +have been cited in this section are listed alphabeti-cally.Standardsareusuallywritteninthefollowing manner: (1) Standard number; (2) Standard title; (3) Standard society or agency; and (4) Date of the lastrevision.Forexample:ASMEB16.22,Wrought Copper and Copper Alloy Solder Joint, Pressure Fittings,AmericanSocietyofMechanicalEngineers (ASME), 2002. When there are multiple references by the same organization those references are ar-ranged in ascending numerical order. +Section 1.3 Definition +After the references, any special definitions re-quired to explain the work or products used are listed alphabetically. +Section 1.4 System Description +The system description is used by some designers and omitted by others. This is usually a brief but accurate description of how this spec section fits into the work. +Section 1.5 System Performance Criteria +The system performance requirements give the performance criteria, if necessary, for this work. Thissectionisusuallyomittedunlessaperformance specification is desired. +Section 1.6 Submittals +The next portion of PART 1 is probably one of the most important ones because it governs the submittals. It tells what is required for all prod-ucts used in the project. The designer must decide what information will be submitted for review and approval. On some government projects the sub-mittal process will be under governmental control not the designer. The information required for the submittalcaninclude:(1)Productdataasprepared by the manufacturer or third-party organization; (2) Shop drawings from either the manufacturer or the contractor; (3) Coordination drawings; (4) Wiring or piping diagrams from the manufacturer or contractor; (5) Product certification from manu-facturers that these products have been tested and are compliant with the appropriate standard cited bythemanufacturer;(6)Testreportsfromaninde-pendent (or third party) test laboratory certifying those products; (7) Qualification data for manufac-turers, firms, or individuals as required in Section 1.7QualityAssurance;and(8)Maintenancedatafor the materials and products used for inclusion into theoperationandmaintenance(O&M)manualsfor the owner (if required). +Section 1.7 Quality Assurance +This is the quality control for the project. In this section the designer can include what he feels is needed to assure the project is completed cor- +70 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +rectly. Included in this section are manufacturer and installer qualifications. It is here the level of experience,usuallyasetnumberofyears,isspelled out. The normal experience for a manufacturer is five years minimum; for an installer three years minimum is usual. Requirements for supervision and licensure can be included as well. For example, “allworkrequiredbythisspecificationsectionshall be performed by licensed, experienced tradesmen working under the direct supervision of a licensed, experiencedsupervisorwithaminimumof10years experience. No unsupervised work by unlicensed workers shall be allowed.” Requirements for test-ing laboratories, welding and welder certifications, compliance with U. L. standards, compliance with NFPA70(NEC),ASMEcompliance,andothersare also included within this section. +Section 1.8 Delivery, Storage, and Handling +This section includes the instructions on shipping and handling of materials or equipment from the manufacturer to the jobsite, as well as lifting and rigging instructions, onsite storage requirements, and coordination between shipping schedules, de-livery dates, and installation dates. +Section 1.9 Project Conditions +Site condition disclaimers and disclaimers for field measurements that direct the contractor to verify all measurements prior to start of work fall under thiscategory.Thissectionisoptionalatthedecision of the designer. +Section 1.10 Sequence and Scheduling +Thiscoordinatesthevariousportionsoftheproject andcancrosstrades.Thesectionisoptionalaswell because it is up to the general contractor, not the plumbingdesigner,toscheduleandcoordinatework that is under the contract. +Section 1.11 Warranty +The designer lists any special warranties required oranywarrantyconditionthatisdifferentfromthe manufacturer’s standard warranty. +Section 1.12 Maintenance +Containsanyspecialmaintenancerequirementsfor the equipment installed under this section. +Section 1.13 Extra Materials +A list of extra materials including those such as valve repair kits, faucet repair parts, extra belts, handles, lubricants, seals, elements, etc. Item and quantity required to be supplied to the owner by the contractor are also listed. + +PART 2 +This section deals with the products, materials, and equipment, as well as the manufacturers that will be included in the work. + +Section 2.1 Manufacturers +Under paragraph A, the contractor may supply products by any manufacturer that are compliant with the specification section covering that por-tion of the work. Most of the time the products to be supplied comply with the specifications but sometimes they do not. Paragraph B states that the designer decides which manufacturers of a particular product will be allowed and which will not. Under this paragraph, the contractor is given a list of approved manufacturers to choose from. The designer has both researched the product and tested manufacturers to make sure the products meet or exceed the standards set forth by that sec-tion of the specification. For example, a listing for a water closet would be: +1. Water closet, floor outlet, flushometer a) Manufacturer “A” +b) Manufacturer “B” c) Manufacturer “C” d) Manufacturer “D” e) Substitutions +Underthisarrangement,thecontractorwouldhave to supply the water closet by one of the four manu-facturerslistedabove.Withtheuseofasubstitution option,thedesignermayelecttoallowsubstitutions of a water closet by a non-listed manufacturer as long as it is proven to be equal to the others. Many designers feel that allowing no substitutions levels the bidding field and takes away the problems of a bidder getting a lower bid by using substandard product. Under this section, the decision can be madeabouttheproductaswellasthemanufacturer. Only one of these methods should be used—either specifythemanufacturerorproductbyan“open”as seen in paragraph A (of Appendix 3-C1) or “closed” as seen in paragraph B. The same is true for para-graphs C and D. As stated earlier in this chapter, the closed method gives the designer more control over the quality of the products being included in this project. +Sections 2.2, 2.3, and 2.4 are similar to Section 2.1. In Section 2.3 the materials that will be used are specified using either a descriptive specification or a performance specification. Both the performance and descriptive specification types were discussed earlier. +Sections 2.5, 2.6, 2.7, 2.8, and 2.9 are not usually included in plumbing specifications. However, that +Chapter 3 — Specifications + + +does not mean they cannot be used if the designer feels they are needed. + +PART 3 +Section 3.1 Examination +Thissectionisconcernedwiththeinstallationofthe productsormaterialsintotheproject.Thefirstpart involves instructions to the contractor to examine thesites,plans,existingorconstructedwalls,floors and ceilings that must be installed. This section should also instruct the contractor not to proceed with the work until all unsatisfactory items have been corrected. Following sections deal with the general and specific installation requirements of the products and/or materials being used. Often included, but not mandatory by CSI standards, is a section on connections (shown as Section 3.5). It is in this section that connection requirements for ownerfurnished,contractorinstalled(oftenseenas OFCI or GFCI on government projects) are found. A good example of this would be in the case of a commercial kitchen where the kitchen equipment supplier sets the equipment but the plumber con-nects them to the utilities. +Section 3.6 Field Quality Control +The designer deals with testing laboratory services (including who pays for it), which tests are to be made, and which standard(s) must be met. Also included is what remedy must be made if the tests prove that the products and/or materials are not compliant with the standard set forth in the speci-fication section. In addition, if a piece of equipment that is assembled onsite appears to be complicated, etc., this is where the designer could put a require-mentfortheservicesofafactory-authorizedservice technician to supervise the assembly. +Section 3.7 Adjusting and Cleaning +Asectionthatcoverstheadjustment,cleaning,and calibration of the products included in this project is well advised. One of the most common sections would probably be the cleaning and disinfection of the potable water system. +Section 3.8 Commissioning +Another section that is not mandated by the cur-rent CSI format, but is gaining in use and will probably be included as part of the new CSI format (tentativelyscheduledforreleaselate2004)isCom-missioning or placing the building into service for the owner to use. Items that should be addressed include: (1) Equipment start up by factory autho-rized service technicians; (2) Testing and adjusting of controls and safeties with the replacement of all malfunctioning parts; (3) Providing adequate training to the owner’s maintenance staff with + +71 + + +regard to the start up and shut down of equipment, troubleshooting, servicing, and maintenance; and (4) Reviewing the data in the O&M manuals with the maintenance staff. + +USE OF COMPUTERS IN PRODUCING SPECIFICATIONS +Very few plumbing specifications today are written as an original document, otherwise known as “from scratch.” In most cases, the project specifications are created using an office prepared “master specifica-tion,”orasetofcommerciallypreparedspecifications that have been published by various industry organi-zationssuchasMasterspecorSpectext.TheAmerican Institute of Architects (AIA) publishes Masterspec. Spectext is published by the Constructed Science Research Foundation, which is affiliated with the Construction Specifications Institute (CSI). The use of a master specification to prepare a project specifi-cation is certainly more cost efficient than “starting from scratch” with each new project. +The process begins with the designer or speci-fier choosing the sections that will be needed for the project manual. This list is then given to the word-processing department to put together the copy for eachsectionandreturnittothedesigner.Itisthenre-viewed and rewritten as required to suit the project’s particularrequirements.Therevised“master”copyis then returned to the word-processing department to make the necessary rewrite to the master copy. This revisedcopywillbereturnedtothedesigner,whowill proofreaditandmakeanyfurtherchangesthatmight be required. This process continues until the project is finalized. As you see, this method of specification is very labor intensive. +Fortunately for specification writers, there are computerized or computer assisted specification pro-grams to aid in the writing of specifications. These programs do for specification writing what computer aided drafting and design (CADD) did for drafting. Oneofthefirstcomputeraidswasutilizingword-pro-cessingprogramstowrite,edit,andmoreimportantly, store finished documents in an electronic format. This allows documents to be copied instantaneously instead of spending a lengthy time at the typewriter and/orcopymachine.Anotherbenefitthatcamewith the use of computers is the size of space required to store the specifications. A specification that might require an entire file cabinet drawer of information can be reduced to one or two floppy disks or one CD-ROM disk. +Thespecificationprogramsthathaveevolvedover past years and are available today have merged word processing, data storage, and acquisition programs intosinglepowerfulprogramsthatallowspecifications to be produced by a single person. This is a drastic +72 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +changefromthepastwhenittookthedesigner(s)and several other personnel to produce the specification. One of the best features of the new master specifica-tion programs is that there are periodic updates with new sections being added and obsolete sections being deleted. Also, in these updates, the reference stan-dardsthatareincludedineachsectionareupdatedto the latest standard. For any specifier who has spent several hours searching these standards, this feature is worth the price of the program. +Computer programs continue to improve at a dizzying speed. What was cutting edge technol-ogy five years ago is now obsolete. These programs have evolved beyond just being a specialized word processing program to an interactive program that contains checklists or interactive input dialogue for the specifier to utilize. Also, there are programs be-ing written and developed that will interface with the CADD systems to produce the specifications and even estimates. + +CONCLUSION +Writing good, effective specifications requires broad experience as a plumbing designer. In most engi-neering offices, specifications are prepared by the project engineer or team leader. The designer must remember that the essence of plumbing specifica-tionsiscommunicationbetweenthepersonsinvolved with the project. Plumbing specifiers must develop skills to communicate the project requirements in a clear, concise, and easy-to-understand manner. This requires the ability to write in a clear, precise, tech-nical style and a precise legal style combined into a single style. +Theonethingthatprobablyhaschangedtheleast in specification writing is the amount of time allotted bytheprojectmanagerstocompletethespecifications. The amount of time given is never enough. +Like most plumbing engineering skills, specifica-tion writing is “learned on the job.” This is because university level courses in specification writing are rare (actually almost non-existent). Classes may be availableascontinuingeducationprogramsofferedby theConstructionSpecificationsInstitute(CSI)atboth the national and local level. Local chapter members of CSI teach local courses. Interested parties should contacttheirlocalCSIchaptersformoreinformation about what is available. +Plumbing designers who have at least five years of specification writing experience can demonstrate their proficiency and understanding by taking the Certified Construction Specifier (CCS) Examination that is given by CSI. Successful completion of this exam willearnthe designerthe titleofCertified Con-structionSpecifier(CCS).Thereisagrowingnumber of plumbing engineers that can include “CCS” after + +“CPD” (Certified Plumbing Designer) when citing their professional credentials. +Inthisworldofcontinuallychangingworkplaces and corporate restructuring, the plumbing designer who demonstrates the ability to produce a clear, con-cise set of specification documents is a valuable asset to the project design teams. +Chapter 3 — Specifications + + +APPENDIX 3-A1 +CSI UNIFORMAT – UNIFORM CLASSIFICATION – (1995 Edition) +SUBSTRUCTURE A10 Foundations +A20 Basement Construction +SHELL +B10 Superstructure B20 Exterior Closure B30 Roofing +C. INTERIORS +C10 Interior Construction C20 Stairways +C30 Interior Finishes +D. SERVICES +D10 Conveying Systems D20 Plumbing Systems +D30 Heating Ventilation and Air Conditioning (HVAC) systems +D40 Fire Protection Systems D50 Electrical Systems +E. EQUIPMENT and FURNISHINGS E10 Equipment +E20 Furnishings +F. OTHER BUILDING CONSTRUCTION F10 Special Construction +F20 Selective Demolition +BUILDING SITEWORK G10 Site Preparation +G20 Site Improvements G30 Site Plumbing Utilities +G40 Site Heating, Ventilation, and Air Conditioning (HVAC) Utilities +G50 Site Electrical Utilities G60 Other Site Construction +Z. GENERAL +Z10 General Requirements +Z20 Bidding Requirements, Contract Forms, and Conditions +Z90 Project Cost Estimate + +APPENDIX 3-A2 +CSI MASTERFORMAT – LEVEL ONE DIVISION TITLES – (1995 Edition) +01000 DIVISION 1 GENERAL REQUIREMENTS 02000 DIVISION 2 SITE CONSTRUCTION 03000 DIVISION 3 CONCRETE +04000 DIVISION 4 MASONRY 05000 DIVISION 5 METALS +06000 DIVISION 6 WOOD and PLASTICS 07000 DIVISION 7 THERMAL and MOISTURE +PROTECTION +08000 DIVISION 8 DOORS AND WINDOWS 09000 DIVISION 9 FINISHES +10000 DIVISION 10 SPECIALTIES + +73 + + +11000 DIVISION 11 EQUIPMENT 12000 DIVISION 12 FURNISHINGS +13000 DIVISION 13 SPECIAL CONSTRUCTION 14000 DIVISION 14 CONVEYING SYSTEMS 15000 DIVISION 15 MECHANICAL +16000 DIVISION 16 ELECTRICAL + +APPENDIX 3-A3 +CSI MASTERFORMAT – LEVEL TWO SECTION TITLES – (1995 Edition) + +DIVISION 1 GENERAL REQUIREMENTS 01100 SUMMARY OF WORK +01200 PRICE and PAYMENT PROCEEDURES 01300 ADMINISTRATIVE REQUIREMENTS 01400 QUALITY PROCEDURES +01500 TEMPORARY FACILITIES and CONTROLS 01600 PRODUCT REQUIREMENTS +01700 EXECUTION REQUIREMENTS 01800 FACILITY OPERATION +01900 FACILITY DECOMMISSIONING + +DIVISION 2 SITE CONSTRUCTION 02050 BASIC SITE MATERIALS and METHODS 02100 SITE REMEDIATION +02200 SITE PREPARATION 02300 EARTHWORK +02400 TUNNELING, BORING, and JACKING 02450 FOUNDATION and LOAD BEARING +ELEMENTS +02500 UTILITY SERVICES +02600 DRAINAGE and CONTAINMENT +02700 BASES, BALLASTS, PAVEMENTS, and APPURTENANCES +02800 SITE IMPROVEMENTS and AMENITIES 02900 PLANTING +02950 SITE RESTORATION and REHABILITATION + +DIVISION 3 CONCRETE +03050 CONCRETE MATERIALS AND METHODS 03100 CONCRETE FORMS and ACCESSORIES 03200 CONCRETE REINFORCEMENT +03300 CAST-IN-PLACE CONCRETE 03400 PRE-CAST CONCRETE 03500 CEMENTITOUS DECKS and +UNDERLAYMENT 03600 GROUTS +03700 MASS CONCRETE +03900 CONCRETE RESTORATION and CLEANING + +DIVISION 4 MASONRY +04050 BASIC MASONRY MATERIALS AND METHODS +04200 MASONRY UNITS 04400 STONE +04500 REFRACTORIES +04600 CORROSION RESISTANT MASONRY 04700 SIMULATED MASONRY +04800 MASONRY ASSEMBLIES +74 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +04900 MASONRY RESTORATION AND CLEANING + +DIVISION 5 METALS +05050 BASIC METAL MATERIALS AND METHODS +05100 STRUCTURAL METAL FRAMING 05200 METAL JOISTS +05300 METAL DECK +05400 COLD FORMED METAL FRAMING 05500 METAL FABRICATIONS +05600 HYDRAULIC FABRICATIONS +05650 RAILROAD TRACK AND ACCESSORIES 05700 ORNAMENTAL METAL +05800 EXPANSION CONTROL +05900 METAL RESTORATION AND CLEANING + +DIVISION 6 WOOD AND PLASTICS 06050 BASIC WOOD AND PLASTIC MATERIALS +AND METHODS +06100 ROUGH CARPENTRY 06200 FINISH CARPENTRY +06400 ARCHITECTURAL WOODWORK 06500 STRUCTURAL PLASTICS +06600 PLASTIC FABRICATIONS +06900 WOOD AND PLASTIC RESTORATION AND CLEANING + +DIVISION 7 THERMAL AND MOISTURE PROTECTION +07050 BASIC THERMAL & MOISTURE PROTECTION MATERIALS AND METHODS +07100 DAMPPROOFING AND WATERPROOFING 07200 THERMAL PROTECTION +07300 SHINGLES, ROOF TILES AND ROOF COVERINGS +07400 ROOFING AND SIDING TILES 07500 MEMBRANE ROOFING +07600 FLASHING AND SHEET METAL +07700 ROOF SPECIALTIES AND ACCESSORIES 07800 FIRE AND SMOKE PROTECTION +07900 JOINT SEALERS + +DIVISION 8 DOORS AND WINDOWS 08050 BASIC DOORS AND WINDOWS +MATERIALS AND METHODS 08100 METAL DOORS AND FRAMES 08200 WOOD AND PLASTIC DOORS 08300 SPECIALTY DOORS +08400 ENTRANCES AND STORE FRONTS 08500 WINDOWS +08600 SKYLIGHTS 08700 HARDWARE 08800 GLAZING +08900 GLAZED CURTAIN WALL + +DIVISION 9 FINISHES +09050 BASIC FINISHES MATERIALS AND METHODS +09100 METAL SUPPORT ASSEMBLIES 09200 PLASTER AND GYPSUM BOARD + +09300 TILE +09400 TERRAZZO 09500 CEILINGS 09600 FLOORING +09700 WALL FINISHES +09800 ACOUSTICAL TREATMENT 09900 PAINTS AND COATINGS + +DIVISION 10 SPECIALTIES 10100 VISUAL DISPLAY BOARDS +10150 COMPARTMENTS AND CUBICLES 10200 LOUVERS AND VENTS +10240 GRILLS AND SCREENS 10250 SERVICE WALLS +10260 WALL AND CORNER GUARDS 10270 ACCESS FLOORING +10290 PEST CONTROL +10300 FIREPLACES AND STOVES 10340 MANUFACTURED EXTERIOR +SPECIALTIES 10350 FLAG POLES +10400 IDENTIFICATION DEVICES +10450 PEDESTRIAN CONTROL DEVICES 10500 LOCKERS +10520 FIRE PROTECTION SPECIALTIES 10530 PROTECTIVE COVERS +10550 POSTAL SPECIALTIES 10600 PARTITIONS +10670 STORAGE SHELVING 10700 EXTERIOR PROTECTION 10750 TELEPHONE SPECIALTIES +10800 TOILET, BATH AND LAUNDRY ACCESSORIES +10880 SCALES +10900 WARDROBE AND CLOSET SPECIALTIES + +DIVISION 11 EQUIPMENT 11010 MAINTENANCE EQUIPMENT +11020 SECURITY AND VAULT EQUIPMENT 11030 TELLER AND SERVICE EQUIPMENT 11040 ECCLESIASTICAL EQUIPMENT 11050 LIBRARY EQUIPMENT +11060 THEATER AND STAGE EQUIPMENT 11070 INSTRUMENTAL EQUIPMENT 11080 REGISTRATION EQUIPMENT +11090 CHECK ROOM EQUIPMENT 11100 MERCANTILE EQUIPMENT +11110 COMMERCIAL LAUNDRY AND DRY CLEANING EQUIPMENT +11120 VENDING EQUIPMENT 11130 AUDIO VISUAL EQUIPMENT +11140 VEHICLE SERVICE EQUIPMENT 11150 PARKING CONTROL EQUIPMENT 11160 LOADING DOCK +11170 SOLID WASTE HANDLING EQUIPMENT 11190 DETENTION EQUIPMENT +11200 WATER SUPPLY AND TREATMENT EQUIPMENT +11280 HYDRAULIC GATES AND VALVES 11300 FLUID WASTE TREATMENT AND +DISPOSAL EQUIPMENT +Chapter 3 — Specifications + + +11400 FOOD SERVICE EQUIPMENT 11450 RESIDENTIAL EQUIPMENT 11460 UNIT KITCHENS +11470 DARK ROOM EQUIPMENT 11480 ATHLETIC, RECREATIONAL AND +THERAPEUTIC EQUIPMENT +11500 INDUSTRIAL AND PROCESS EQUIPMENT 11600 LABORATORY EQUIPMENT +11650 PLANETARIUM EQUIPMENT 11660 OBSERVATORY EQUIPMENT 11680 OFFICE EQUIPMENT +11700 MEDICAL EQUIPMENT 11780 MORTUARY EQUIPMENT 11850 NAVIGATION EQUIPMENT +11870 AGRICULTURAL EQUIPMENT 11900 EXHIBIT EQUIPMENT + +DIVISION 12 FURNISHINGS 12050 FABRICS +12100 ART +12300 MANUFACTURED CASEWORK 12400 FURNISHINGS AND ACCESSORIES 12500 FURNITURE +12600 MULTIPLE SEATING 12700 SYSTEMS FURNITURE +12800 INTERIOR PLANTS AND PLANTERS 12900 FURNISHINGS RESTORATION AND +REPAIR + +DIVISION 13 SPECIAL CONSTRUCTION 13010 AIR SUPPORTED STRUCTURES +13020 BUILDING MODULES +13030 SPECIAL PURPOSE ROOMS +13080 SOUND, VIBRATION AND SEISMIC CONTROL +13090 RADIATION PROTECTION 13100 LIGHTNING PROTECTION 13110 CATHODIC PROTECTION +13120 PRE-ENGINEERED STRUCTURES 13150 SWIMMING POOLS +13160 AQUARIUMS +13165 AQUATIC PARK FACILITIES 13170 TUBS AND POOLS +13175 ICE RINKS +13185 KENNELS AND ANIMAL SHELTERS 13190 SITE CONSTRUCTED INCINERATORS 13200 STORAGE TANKS +13220 FILTER UNDERDRAINS AND MEDIA 13230 DIGESTER COVERS AND +APPURTENANCES +13240 OXYGENATION SYSTEMS +13260 SLUDGE CONDITIONING SYSTEMS 13280 HAZARDOUS MATERIAL REMEDIATION 13400 MEASUREMENT AND CONTROL +INSTRUMENTATION +13500 RECORDING INSTRUMENTATION 13550 TRANSPORTATION CONTROL +INSTRUMENTATION +13600 SOLAR AND WIND ENERGY EQUIPMENT\ 13700 SECURITY ACCESS AND SURVEILLANCE 13800 BUILDING AUTOMATION AND CONTROL + +75 + + +13850 DETECTION AND ALARM 13900 FIRE SUPPRESSION + +DIVISION 14 CONVEYING SYSTEMS 14100 DUMBWAITERS +14200 ELEVATORS +14300 ESCALATORS AND MOVING WALKS 14400 LIFTS +14500 MATERIAL HANDLING 14600 HOISTS AND CRANES 14700 TURNTABLES +14800 SCAFFOLDING 14900 TRANSPORTATION + +DIVISION 15 MECHANICAL +15050 BASIC MECHANICAL MATERIALS AND METHODS +15100 BUILDING SERVICES PIPING 15200 PROCESS PIPING +15300 FIRE PROTECTION PIPING (SEE 13900) 15400 PLUMBING FIXTURES AND EQUIPMENT 15500 HEAT GENERATION EQUIPMENT +15600 REFRIGERATION EQUIPMENT 15700 HEATING, VENTILATION AND AIR +CONDITIONING EQUIPMENT 15800 AIR DISTRIBUTION +15900 HVAC INSTRUMENTATION +15950 TESTING, ADJUSTING AND BALANCING + +DIVISION 16 ELECTRICAL +16050 BASIC ELECTRICAL MATERIALS AND METHODS +16100 WIRING METHODS 16200 ELECTRICAL POWER +16300 TRANSMISSION AND DISTRIBUTION 16400 LOW VOLTAGE DISTRIBUTION 16500 LIGHTING +16700 COMMUNICATIONS 16800 SOUND AND VIDEO +76 + + +APPENDIX 3-A4 + +ASPE Plumbing Engineering Design Handbook — Volume 1 + + +APPENDIX 3-A5 + + + +CSI MASTERFORMAT – LEVEL THREE SECTION TITLES – (1995 Edition) (SELECTED SECTIONS) +13900 FIRE SUPPRESSION +13920 BASIC FIRE SUPPRESSION MATERIALS AND METHODS +13930 WET-PIPE FIRE SUPPRESSION SPRINKLERS +13935 DRY-PIPE FIRE SUPPRESSION SPRINKLERS +13940 PRE-ACTION FIRE SUPPRESSION SPRINKLERS +13945 COMBINATION DRY-PIPE AND PRE-ACTION F.S.S. +13950 DELUGE FIRE SUPPRESSION SPRINKLERS +13955 FOAM FIRE EXTINGUISHING +13960 CARBON DIOXIDE FIRE EXTINGUISHING 13965 ALTERNATIVE FIRE EXTINGUISHING +SYSTEMS +13970 DRY CHEMICAL FIRE EXTINGUISHING 13975 STANDPIPES AND HOSES +15100 BUILDING SERVICES PIPING 15105 PIPES AND TUBES +15110 VALVES +15120 PIPING SPECIALTIES 15130 PUMPS +15140 DOMESTIC WATER PIPING +15150 SANITARY WASTE AND VENT PIPING 15160 STORM DRAINAGE PIPING +15170 SWIMMING POOL AND FOUNTAIN PIPING 15180 HEATING AND COOLING PIPING +15190 FUEL PIPING +15200 PROCESS PIPING +15210 PROCESS AIR AND GAS PIPING +15220 PROCESS WATER AND WASTE PIPING 15230 INDUSTRIAL PROCESS PIPING +15400 PLUMBING FIXTURES AND EQUIPMENT 15410 PLUMBING FIXTURES +15440 PLUMBING PUMPS +15450 POTABLE WATER STORAGE TANKS 15460 DOMESTIC WATER CONDITIONING +EQUIPMENT +15470 DOMESTIC WATER FILTRATION EQUIPMENT +15480 DOMESTIC WATER HEATERS 15490 POOL AND FOUNTAIN EQUIPMENT + +CSI MASTERFORMAT – LEVEL FOUR SECTION TITLES – (1995 Edition) (SECTION SELECTED FROM DIVISION 15; SECTION 200) +15200 PROCESS PIPING +15210 PROCESS AIR AND GAS PIPING 15211 AIR COMPRESSORS +15212 COMPRESSED AIR PIPING 15213 GAS EQUIPMENT +15214 GAS PIPING 15215 NITROGEN PIPING +15216 NITROUS OXIDE PIPING 15217 OXYGEN PIPING +15218 VACUUM PUMPS 15219 VACUUM PIPING +15220 PROCESS WATER AND WASTE PIPING 15221 DEIONIZED WATER PIPING +15223 DISTILLED WATER PIPING +15225 LABORATORY ACID WASTE AND VENT PIPING +15227 PROCESS PIPING INTERCEPTORS 15229 REVERSE OSMOSIS WATER PIPING +15230 INDUSTRIAL PROCESS PIPING 15231 DRY PRODUCT PIPING +15232 FLUID PRODUCT PIPING +Chapter 3 — Specifications + + +APPENDIX 3-B1 +CSI MASTERFORMAT DIVISIONS (2004 EDITION) PROCUREMENT and CONTRACTING DOCUMENTS GROUP +DIVISION 00 – PROCUREMENT and CONTRACTING REQUIREMENTS: This Division is essentially the same in scope as it was in MasterFormat95. +SPECIFICATIONS GROUP +GENERAL REQUIREMENTS SUBGROUP + +DIVISION 01 – GENERAL REQUIREMENTS: +The area for performance requirements was added to allow for the writing of performance requirements for the elements that are +found in more than one work section such as building envelope, structure, etc. This new feature will allow for the specifier to include a mixture of broad performance specifications and descriptive specifications into the project manual. +FACILITY CONSTRUCTION SUBGROUP +DIVISION 02 – EXISTING CONDITIONS: Division 2 is now restricted to the “existing conditions” that is, construction tasks that relate to the items at the site when the project commences – selective demolition, subsurface and +other investigations, surveying , site decontamination and/ or remediation to mention a few. (ALL site construction as well as heavy civil and infrastructure items including pavement and utilities has been relocated to the Site and Infrastructure Subgroup) +DIVISION 03 – CONCRETE: This division will remain essentially as it was under MasterFormat95 +DIVISION 04 – MASONRY: This division will remain essentially as it was under MasterFormat95 +DIVISION 05 – METALS: This division will remain essentially as it was under MasterFormat95 +DIVISION 06 – WOOD, PLASTICS and COMPOSITES: This Division will remain essentially as it was under MasterFormat95, but also will include expanded areas for plastics and other composite materials. +DIVISION 07 – THERMAL and MOISTURE PROTECTION: This division will remain essentially as it was Under MasterFormat95. +DIVISION 08 – OPENINGS: This section was Doors and Windows under MasterFormat95, and remains essentially unchanged but +was renamed to with the addition of other openings such as louvers and grilles + +77 + + +DIVISION 09 – FINISHES: This division will remain essentially as it was under MasterFormat95 +DIVISION 10 – SPECIALTIES: This division will remain essentially as it was under MasterFormat95 +DIVISION 11 – EQUIPMENT: This Division will remain as is with the exception of that equipment related to process engineering +has been relocated to the Process Equipment Subgroup and that equipment related to Infrastructure has been relocated to the Site and Infrastructure subgroup. +DIVISION 12 – FURNISHINGS: This division will remain essentially as it was under MasterFormat95 +DIVISION 13 – SPECIAL CONSTRUCTION: This division will remain essentially as it was under MasterFormat95 except that special construction related to process engineering has been relocated to the Process Equipment Subgroup. Security, building automation, detection and alarm as well as fire suppression have been relocated to the Facility Services Subgroup. +DIVISION 14 – CONVEYING EQUIPMENT: This division has been renamed with process related material Handling equipment relocated to the Process Equipment Subgroup +DIVISION 15 – RESERVED FOR FUTURE EXPANSION: This Division has been assigned for any future expansion and Division 15 has been separated and relocated to Division +22 – Plumbing a and Division 23 – Heating, Ventilation, and Air Conditioning in the Facility Services Subgroup. +DIVISION 16 – RESERVED FOR FUTURE EXPANSION: This Division has been assigned for any future expansion and Division 16 has been separated and relocated to Division 26 +– Electrical and Division 27 – Communications in the Facility Services Subgroup. +DIVISION 17 – RESERVED FOR FUTURE EXPANSION +DIVISION 18 – RESERVED FOR FUTURE EXPANSION +DIVISION 19 – RESERVED FOR FUTURE EXPANSION +FACILITY SERVICES SUBGROUP DIVISION 20 – RESERVED +DIVISION 21 – FIRE SUPPRESSION: This division contains the Fire Suppression sections relocated from Division 13 in MasterFormat95. +78 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +DIVISION 22 – PLUMBING: This division contains the Plumbing sections relocated from Division 15 in MasterFormat95. +DIVISION 23 – HEATING, VENTILATION and AIR CONDITIONING: This division contains the Heating Ventilation and Air Conditioning +Sections from Division 15 in MasterFormat95. +DIVISION 24 – RESERVED +DIVISION 25 – INTEGRATED AUTOMATION: This Division contains the expanded integrated automation sections that were relocated from Division 13 in MasterFormat95. +DIVISION 26 – ELECTRICAL: This Division contains the Electrical and Lighting sections relocated from Division 16 in MasterFormat95 +DIVISION 27 – COMMUNICATIONS: This Division contains the expanded Communications sections relocated from Division 16 in MasterFormat95 +DIVISION 28 – ELECTRONIC SAFETY and SECURITY: This Division contains the expanded Electronic Safety and Security sections relocated from Division 13 in MasterFormat95 +DIVISION 29 – RESERVED +SITE and INFRASTRUCTURE SUBGROUP + +DIVISION 30 – RESERVED FOR FUTURE EXPANSION +DIVISION 31 – EARTHWORK: Site Construction sections, predominately below grade, that have been relocated from Division 02 in MasterFormat95. +DIVISION 32 – EXTERIOR IMPROVEMENTS: Site Construction sections, predominately above grade, that have been relocated from Division 02 in MasterFormat95 +DIVISION 33 – UTILITIES: Utility sections with expansions that have been relocated from Division 02 in MasterFormat95. +DIVISION 34 – TRANSPORTATION: Transportation sections with expansions relocated from the various divisions in MasterFormat95 +DIVISION 35 – WATERWAY and MARINE: Expanded waterway and other marine section from Division 02 and other divisions in MasterFormat95. +DIVISION 36 – RESERVED FOR FUTURE EXPANSION +DIVISION 37 – RESERVED FOR FUTURE EXPANSION +DIVISION 38 – RESERVED FOR FUTURE EXPANSION + +DIVISION 39 – RESERVED FOR FUTURE EXPANSION +PROCESS EQUIPMENT SUBGROUP +DIVISION 40 – RESERVED FOR FUTURE EXPANSION +DIVISION 41 – MATERIAL PROCESSING and HANDLING EQUIPMENT: Equipment for the processing and conditioning of raw materials; material handling equipment for bulk materials as well as discrete units; manufacturing equipment and machinery; test equipment and packaging/ shipping systems. +DIVISION 42 – PROCESSING HEATING, COOLING and DRYING EQUIPMENT: Equipment for process heating, cooling and drying of materials, liquids, gases, and manufactured items and/or materials. +DIVISION 43 – PROCESS GAS and LIQUID HANDLING, PURIFICATION and STORAGE EQUIPMENT: Equipment for handling purification and storage of process liquids, gases, and slurries including atmospheric tanks as well as pressure vessels. +DIVISION 44 – POLLUTION CONTROL EQUIPMENT: Equipment for controlling emission of contaminants from manufacturing processes and treatment of air, soil, and water contaminants. +DIVISION 45 – INDUSTRY SPECIFIC MANUFACTURING EQUIPMENT: A division in which the owners can specify equipment that is used ONLY within a single industry. +(All industries currently identified in the North American Industry Classification System, NAICS, are allocated space within this division). +DIVISION 46 – SOLID WASTE EQUIPMENT: Not defined at this time +DIVISION 47 – RESERVED FOR FUTURE EXPANSION +DIVISION 48 – ELECTRICAL POWER GENERATION: Plants and equipment for the generation and control of electrical power from fossil fuel, nuclear energy, hydroelectric, wind, solar energy, geothermal energy, electrochemical energy and fuel cells. +DIVISION 49 – RESERVED FOR FUTURE EXPANSION +Chapter 3 — Specifications + + +APPENDIX 3-B2 MASTERFORMAT 2004 +FACILITY CONSTRUCTION SUBGROUP + +DIVISION 21 – FIRE SUPPRESSION 21 00 00 – FIRE SUPPRESSION +21 01 00 – OPERATION and MAINTENANCE of FIRE SUPPRESSION +21 02 00 – RESERVED 21 03 00 – RESERVED 21 04 00 – RESERVED +21 05 00 – COMMON WORK RESULTS for FIRE SUPPRESSION +21 06 00 – SCHEDULES for FIRE SUPPRESSION 21 07 00 – FIRE SUPPRESSION SYSTEMS +INSULATION +21 08 00 – COMMISIONING of FIRE SUPPRESSION SYSTEMS +21 09 00 – INSTRUMENTATION and CONTROL for FIRE SUPPRESSION SYSTEMS +21 10 00 – WATER BASED FIRE SUPPRESSION SYSTEMS +21 11 00 – FACILITY FIRE SUPPRESSION WATER SERVICE PIPING +21 12 00 – FIRE SUPPRESSION STANDPIPES 21 13 00 – FIRE SUPPRESSION SPRINKLER +SYSTEMS +21 14 00 – RESERVED 21 15 00 – RESERVED 21 16 00 – RESERVED 21 17 00 – RESERVED 21 18 00 – RESERVED 21 19 00 – RESERVED +21 20 00 – FIRE EXTINGUISHING SYSTEMS +21 21 00 – CARBON DIOXIDE FIRE EXTINGUISHING SYSTEMS +21 22 00 – CLEAN AGENT FIRE EXTINGUISHING SYSTEMS +21 23 00 – WET CHEMICAL FIRE EXTINGUISHING SYSTEMS +21 24 00 – DRY CHEMICAL FIRE EXTINGUISHING SYSTEMS +21 25 00 – RESERVED 21 26 00 – RESERVED 21 27 00 – RESERVED 21 28 00 – RESERVED 21 29 00 – RESERVED +21 30 00 – FIRE PUMPS +21 31 00 – CENTRIFUGAL FIRE PUMPS +21 32 00 – VERTICAL TURBINE FIRE PUMPS 21 33 00 – POSITIVE DISPLACEMENT FIRE +PUMPS +21 34 00 – RESERVED 21 35 00 – RESERVED 21 36 00 – RESERVED 21 37 00 – RESERVED 21 38 00 – RESERVED 21 39 00 – RESERVED + +79 + + +21 40 00 – FIRE SUPPRESSION WATER STORAGE +21 41 00 – STORAGE TANKS for FIRE SUPPRESSION WATER +21 42 00 – RESERVED 21 43 00 – RESERVED 21 44 00 – RESERVED 21 45 00 – RESERVED 21 46 00 – RESERVED 21 47 00 – RESERVED 21 48 00 – RESERVED 21 49 00 – RESERVED +21 50 00 – RESERVED 21 60 00 – RESERVED 21 70 00 – RESERVED 21 80 00 – RESERVED 21 90 00 – RESERVED + +APPENDIX 3-B3 MASTERFORMAT 2004 +FACILITY CONSTRUCTION SUBGROUP + +DIVISION 21 – FIRE SUPPRESSION 21 00 00 – FIRE SUPPRESSION +21 01 00 – OPERATION and MAINTENANCE of FIRE SUPPRESSION +21 01 10 – OPERATION and MAINTENANCE OF WATER BASED FIRE SUPPRESSION SYSTEMS +21 01 20 – OPERATION and MAINTENANCE of FIRE EXTINGUISHING SYSTEMS +21 01 30 – OPERATION and MAINTENANCE of FIRE SUPPRESSION EQUIPMENT +21 02 00 – RESERVED 21 03 00 – RESERVED 21 04 00 – RESERVED +21 05 00 – COMMON WORK RESULTS for FIRE SUPPRESSION +21 05 13 – COMMON MOTOR REQUIREMENTS for FIRE SUPPRESSION EQUIPMENT +21 05 16 – EXPANSION FITTINGS and LOOPS for FIRE SUPPRESSION PIPING +21 05 19 – METERS and GAGES for FIRE SUPPRESSION SYSTEMS +21 05 23 – GENERAL DUTY VALVES for WATER BASED FIRE SUPPRESSION PIPING +21 05 29 – HANGERS and SUPPORTS for FIRE SUPPRESSION PIPING and EQUIPMENT +21 05 33 – HEAT TRACING FOR FIRE SUPPRESSION PIPING +21 05 48 – VIBRATION and SEISMIC CONTROLS for FIRE SUPPRESSION PIPING and EQUIPMENT +21 05 53 – IDENTIFICATION for FIRE SUPPRESSION PIPING and EQUIPMENT +80 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +21 06 00 – SCHEDULES for FIRE SUPPRESSION +21 06 10 – SCHEDULES for WATER BASED FIRE SUPPRESSION SYSTEMS +21 06 20 – SCHEDULES for FIRE EXTINGUISHING SYSTEMS +21 06 30 – SCHEDULES for FIRE SUPPRESSION EQUIPMENT +21 07 00 – FIRE SUPPRESSION SYSTEMS INSULATION +21 07 10 – FIRE SUPPRESSION EQUIPMENT INSULATION +21 07 20 – FIRE SUPPRESSION PIPING INSULATION +21 08 00 – COMMISIONING of FIRE SUPPRESSION SYSTEMS +21 09 00 – INSTRUMENTATION and CONTROL for FIRE SUPPRESSION SYSTEMS +21 10 00 – WATER BASED FIRE SUPPRESSION SYSTEMS +21 11 00 – FACILITY FIRE SUPPRESSION WATER SERVICE PIPING +21 11 16 – FACILITY FIRE HYDRANTS +21 11 19 – FIRE DEPARTMENT CONNECTIONS +21 12 00 – FIRE SUPPRESSION STANDPIPES +21 12 13 – FIRE SUPPRESSION HOSES and NOZZLES +21 12 16 – FIRE SUPPRESSION HOSE REELS 21 12 19 – FIRE SUPPRESSION HOSE RACKS 21 12 23 – FIRE SUPPRESSION HOSE VALVES +21 12 26 – FIRE SUPPRESSION VALVE and HOSE CABINETS +21 13 00 – FIRE SUPPRESSION SPRINKLER SYSTEMS +21 13 13 – WET PIPE SPRINKLER SYSTEMS 21 13 16 – DRY PIPE SPRINKLER SYSTEMS +21 13 19 – PRE-ACTION SPRINKLER SYSTEMS 21 13 23 – COMBINED DRY and PRE-ACTION +SPRINKLER SYSTEMS +21 13 26 – DELUGE FIRE SUPPRESSION SPRINKLER SYSTEMS +21 13 29 – WATER SPRAY FIXED SYSTEMS 21 13 36 – ANTIFREEZE SPRINKLER SYSTEMS 21 13 39 – FOAM-WATER SYSTEMS +21 14 00 – RESERVED 21 15 00 – RESERVED 21 16 00 – RESERVED 21 17 00 – RESERVED 21 18 00 – RESERVED +21 19 00 – RESERVED +21 20 00 – FIRE EXTINGUISHING +SYSTEMS +21 21 00 – CARBON DIOXIDE FIRE EXTINGUISHING SYSTEMS + +21 21 13 – CARBON DIOXIDE FIRE EXTINGUISHING PIPING +21 21 16 – CARBON DIOXIDE FIRE EXTINGUISHING EQUIPMENT +21 22 00 – CLEAN AGENT FIRE EXTINGUISHING SYSTEMS +21 22 13 – CLEAN AGENT FIRE EXTINGUISHING PIPING +21 22 16 – CLEAN AGENT FIRE EXTINGUISHING EQUIPMENT +21 23 00 – WET CHEMICAL FIRE EXTINGUISHING SYSTEMS +21 23 13 – WET CHEMICAL FIRE EXTINGUISHING PIPING +21 23 16 – WET CHEMICAL FIRE EXTINGUISHING EQUIPMENT +21 24 00 – DRY CHEMICAL FIRE EXTINGUISHING SYSTEMS +21 24 13 – DRY CHEMICAL FIRE EXTINGUISHING PIPING +21 24 16 – DRY CHEMICAL FIRE EXTINGUISHING EQUIPMENT +21 25 00 – RESERVED 21 26 00 – RESERVED 21 27 00 – RESERVED 21 28 00 – RESERVED 21 29 00 – RESERVED +21 30 00 – FIRE PUMPS +21 31 00 – CENTRIFUGAL FIRE PUMPS +21 31 13 – ELECTRIC DRIVE, CENTRIFUGAL FIRE PUMPS +21 31 16 – DIESEL DRIVE, CENTRIFUGAL FIRE PUMPS +21 32 00 – VERTICAL TURBINE FIRE PUMPS +21 32 13 – ELECTRIC DRIVE, VERTICAL TURBINE FIRE PUMPS +21 32 16 – DIESEL DRIVE, VERTICAL TURBINE FIRE PUMPS +21 33 00 – POSITIVE DISPLACEMENT FIRE PUMPS +21 33 10 – ELECTRIC DRIVE, POSITIVE DISPLACEMENT FIRE PUMPS +21 33 16 – DIESEL DRIVE, POSITIVE DISPLACEMENT FIRE PUMPS +21 34 00 – RESERVED 21 35 00 – RESERVED 21 36 00 – RESERVED 21 37 00 – RESERVED 21 38 00 – RESERVED 21 39 00 – RESERVED +21 40 00 – FIRE SUPPRESSION WATER STORAGE +Chapter 3 — Specifications + + +21 41 10 – STORAGE TANKS for FIRE SUPPRESSION WATER + +81 + + +22 05 00 – COMMON WORK RESULTS for PLUMBING + + + +21 41 13 – PRESSURIZED STORAGE TANKS for FIRE SUPPRESSION WATER +21 41 16 – ELEVATED STORAGE TANKS for FIRE SUPPRESSION WATER +21 41 19 – ROOF MOUNTED STORAGE TANKS for FIRE SUPPRESSION WATER +21 41 23 – GROUND SUCTION STORAGE TANKS for FIRE SUPPRESSION WATER +21 41 26 – UNDERGROUND STORAGE TANKS for FIRE SUPPRESSION WATER +21 41 29 – STORAGE TANKS for FIRE SUPPRESSION WATER ADDITIVES +21 42 00 – RESERVED 21 43 00 – RESERVED 21 44 00 – RESERVED 21 45 00 – RESERVED 21 46 00 – RESERVED 21 47 00 – RESERVED 21 48 00 – RESERVED 21 49 00 – RESERVED 21 50 00 – RESERVED 21 60 00 – RESERVED 21 70 00 – RESERVED 21 80 00 – RESERVED 21 90 00 – RESERVED + +APPENDIX 3-B4 MASTERFORMAT 2004 +FACILITY CONSTRUCTION SUBGROUP 22 00 00 – PLUMBING +22 01 00 – OPERATION and MAINTENANCE of PLUMBING +22 01 10 – OPERATION and MAINTENANCE of PLUMBING PIPING and PUMPS +22 01 20 – RESERVED +22 01 30 – OPERATION and MAINTENANCE of PLUMBING EQUIPMENT +22 01 40 – OPERATION and MAINTENANCE of PLUMBING FIXTURES +22 01 50 – OPERATION and MAINTENANCE of POOL and FOUNTAIN PLUMBING SYSTEMS +22 01 60 – OPERATION and MAINTENANCE of LABORATORY and HEALTHCARE SYSTEMS +22 01 70 – RESERVED 22 01 80 – RESERVED 22 01 90 – RESERVED +22 02 00 – RESERVED 22 03 00 – RESERVED +22 04 00 – RESERVED + +22 05 13 – COMMON MOTOR REQUIREMENTS for PLUMBING EQUIPMENT +22 05 16 – EXPANSION FITTINGS and LOOPS for PLUMBING PIPING +22 05 19 – METERS and GAGES for PLUMBING PIPING +22 05 23 – GENERAL DUTY VALVES for PLUMBING PIPING +22 05 29 – HANGERS and SUPPORTS for PLUMBING PIPING and EQUIPMENT +22 05 33 – HEAT TRACING for PLUMBING PIPING 22 05 48 – VIBRATION and SEISMIC CONTROLS +for PLUMBING PIPING and EQUIPMENT 22 05 53 – IDENTIFICATION for PLUMBING +PIPING and EQUIPMENT +22 05 73 – FACILITY DRAINAGE MANHOLES 22 05 76 – FACILITY DRAINAGE CLEANOUTS +22 06 00 – SCHEDULES for PLUMBING +22 06 10 – SCHEDULES for PLUMBING PIPING and PUMPS +22 06 12 – SCHEDULES for FACILITY POTABLE WATER STORAGE +22 06 15 – SCHEDULES for GENERAL SERVICE COMPRESSED AIR EQUIPMENT +22 06 30 – SCHEDULES for PLUMBING EQUIPMENT +22 06 40 – SCHEDULES for PLUMBING FIXTURES +22 06 50 – SCHEDULES for POOL and FOUNTAIN PLUMBING SYSTEMS +22 06 60 – SCHEDULES for LABORATORY and HEALTHCARE SYSTEMS +22 07 00 – PLUMBING INSULATION +22 07 16 – PLUMBING EQUIPMENT INSULATION 22 07 19 – PLUMBING PIPING INSULATION +22 08 00 – COMMISSIONING of PLUMBING +22 09 00 – INSTRUMENTATION and CONTROL of PLUMBING +22 10 00 – PLUMBING PIPING and PUMPS +22 11 00 – FACILITY WATER DISTRIBUTION +22 11 13 – FACILITY WATER DISTRIBUTION PIPING +22 11 16 – DOMESTIC WATER PIPING 22 11 19 – DOMESTIC WATER PIPING +SPECIALTIES +22 11 23 – DOMESTIC WATER PUMPS +22 12 00 – FACILITY POTABLE WATER STORAGE TANKS +22 12 13 – FACILITY ROOF MOUNTED, POTABLE WATER STORAGE TANKS +22 12 16 – FACILITY ELEVATED, POTABLE WATER STORAGE TANKS +22 12 19 – FACILITY GROUND MOUNTED, POTABLE WATER STORAGE TANKS +82 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +22 12 23 – FACILITY INDOOR POTABLE WATER STORAGE TANKS +22 13 00 – FACILITY SANITARY SEWERAGE +22 13 13 – FACILITY SANITARY SEWERS +22 13 16 – SANITARY WASTE and VENT PIPING 22 13 19 – SANITARY WASTE PIPING +SPECIALTIES +22 13 23 – SANITARY WASTE INTERCEPTORS 22 13 26 – SANITARY WASTE SEPARATORS 22 13 29 – SANITARY SEWERAGE PUMPS +22 13 33 – PACKAGED, SUBMERSIBLE SEWERAGE PUMP UNITS +22 13 36 – PACKAGED, WASTEWATER PUMP UNITS +22 13 43 – FACILITY PACKAGED SEWAGE PUMPING STATIONS +22 13 53 – FACILITY SEPTIC TANKS +22 14 00 – FACILITY STORM DRAINAGE +22 14 13 – FACILITY STORM DRAINAGE PIPING 22 14 16 – RAINWATER LEADERS +22 14 19 – SUMP PUMP DISCHARGE PIPING 22 14 23 – STORM DRAINAGE PIPING +SPECIALTIES +22 14 26 – FACILITY STORM DRAINS 22 14 29 – SUMP PUMPS +22 14 33 – PACKAGED, PEDESTAL, DRAINAGE PUMP UNITS +22 14 36 – PACKAGED, SUBMERSIBLE, DRAINAGE PUMP UNITS +22 15 00 – GENERAL SERVICE COMPRESSED AIR SYSTEMS +22 15 13 – GENERAL SERVICE COMPRESSED AIR PIPING +22 15 16 – GENERAL SERVICE COMPRESSED AIR VALVES +22 15 19 – GENERAL SERVICE PACKAGED AIR COMPRESSORS and RECEIVERS +22 16 00 – RESERVED 22 17 00 – RESERVED 22 18 00 – RESERVED 22 19 00 – RESERVED +22 20 00 – RESERVED +22 30 00 – PLUMBING EQUIPMENT 22 31 00 – DOMESTIC WATER SOFTENERS +22 31 13 – RESIDENTIAL DOMESTIC WATER SOFTENERS +22 31 16 – COMMERCIAL DOMESTIC WATER SOFTENERS +22 32 00 – DOMESTIC WATER FILTRATION EQUIPMENT +22 32 13 – DOMESTIC WATER BAG TYPE FILTERS +22 32 16 – DOMESTIC WATER FREE STANDING CARTRIDGE FILTERS +22 32 19 – DOMESTIC WATER OFF FLOOR CARTRIDGE FILTERS + +22 32 23 – DOMESTIC WATER CARBON FILTERS 22 32 26 – DOMESTIC WATER SAND FILTERS +22 33 00 – ELECTRIC DOMESTIC WATER HEATERS +22 33 13 – INSTANTANEOUS ELECTRIC DOMESTIC WATER HEATERS +22 33 30 – RESIDENTIAL, ELECTRIC DOMESTIC WATER HEATERS +22 33 33 – LIGHT COMMERCIAL ELECTRIC DOMESTIC WATER HEATERS +22 33 36 – COMMERCIAL DOMESTIC WATER ELECTRIC BOOSTER HEATERS +22 34 00 – FUEL FIRED DOMESTIC WATER HEATERS +22 34 13 – INSTANTANEOUS, TANKLESS, GAS DOMESTIC WATER HEATERS +22 34 30 – RESIDENTIAL GAS DOMESTIC WATER HEATERS +22 34 36 – COMMERCIAL GAS DOMESTIC WATER HEATERS +22 34 46 – OIL FIRED DOMESTIC WATER HEATERS +22 34 56 – DUAL FUEL FIRED DOMESTIC WATER HEATERS +22 35 00 – DOMESTIC WATER HEAT EXCHANGERS +22 35 13 – INSTANTANEOUS DOMESTIC WATER HEAT EXCHANGERS +22 35 23 – CIRCULATING DOMESTIC WATER HEAT EXCHANGERS +22 35 29 – NON-CIRCULATING DOMESTIC WATER HEAT EXCHANGERS +22 35 36 – DOMESTIC WATER BRAZED PLATE HEAT EXCHANGERS +22 35 39 – DOMESTIC WATER PLATE and FRAME HEAT EXCHANGERS +22 35 43 – DOMESTIC WATER HEAT RECLAIMERS +22 36 00 – RESERVED 22 37 00 – RESERVED 22 38 00 – RESERVED 22 39 00 – RESERVED +22 40 00 – PLUMBING FIXTURES +22 41 00 – RESIDENTIAL PLUMBING FIXTURES +22 41 13 – RESIDENTIAL WATER CLOSETS, URINALS and BIDETS +22 41 16 – RESIDENTIAL LAVATORIES and SINKS +22 41 19 – RESIDENTIAL BATHTUBS +22 41 23 – RESIDENTIAL SHOWER RECEPTORS and BASINS +22 41 26 – RESIDENTIAL DISPOSERS +22 41 36 – RESIDENTIAL LAUNDRY TRAYS +22 41 39 – RESIDENTIAL FAUCETS, SUPPLIES and TRIM +22 42 00 – COMMERCIAL PLUMBING FIXTURES +Chapter 3 — Specifications + + +22 42 13 – COMMERCIAL WATER CLOSETS, URINALS and BIDETS +22 42 16 – COMMERCIAL LAVATORIES and SINKS +22 42 19 – COMMERCIAL BATHTUBS +22 42 23 – COMMERCIAL SHOWER RECEPTORS and BASINS +22 42 26 – COMMERCIAL DISPOSERS 22 42 29 – SHAMPOO BOWLS +22 42 33 – WASH FOUNTAINS +22 42 36 – COMMERCIAL LAUNDRY TRAYS +22 42 39 – COMMERCIAL FAUCETS, SUPPLIES and TRIM +22 42 43 – FLUSHOMETERS +22 43 00 – HEALTHCARE PLUMBING FIXTURES +22 43 13 – HEALTHCARE WATER CLOSETS 22 43 16 – HEALTHCARE SINKS +22 43 19 – HEALTHCARE BATHTUBS and SHOWERS +22 43 23 – HEALTHCARE SHOWER RECEPTORS and BASINS +22 43 26 – HEALTHCARE FAUCETS +22 43 43 – HEALTHCARE PLUMBING FIXTURE FLUSHOMETERS +22 44 00 – RESERVED +22 45 00 – EMERGENCY PLUMBING FIXTURES +22 45 13 – EMERGENCY SHOWERS 22 45 16 – EYEWASH EQUIPMENT +22 45 19 – SELF CONTAINED EYEWASH EQUIPMENT +22 45 23 – PERSONAL EYEWASH EQUIPMENT 22 45 26 – EYE/ FACE WASH EQUIPMENT +22 45 29 – HAND HELD EMERGENCY DRENCH HOSES +22 45 33 – COMBINATION EMERGENCY FIXTURE UNITS +22 45 36 – EMERGENCY FIXTURE WATER TEMPERING UNITS +22 46 00 – SECURITY PLUMBING FIXTURES +22 46 13 – SECURITY WATER CLOSETS and URINALS +22 46 16 – SECURITY LAVATORIES and SINKS 22 46 39 – SECURITY FAUCETS, SUPPLIES and +TRIM +22 46 43 – SECURITY PLUMBING FIXTURE FLUSHOMETERS +22 46 53 – SECURITY PLUMBING FIXTURE SUPPORTS +22 47 00 – DRINKING FOUNTAINS and WATER COOLERS +22 47 13 – DRINKING FOUNTAINS +22 47 16 – PRESSURE WATER COOLERS +22 47 19 – WATER STATION WATER COOLERS 22 47 23 – REMOTE WATER COOLERS +22 48 00 – RESERVED 22 49 00 – RESERVED +22 50 00 – POOL and FOUNTAIN PLUMBING SYSTEMS + +83 + + +22 51 00 – SWIMMING POOL PLUMBING SYSTEMS +22 51 13 – SWIMMING POOL PIPING 22 51 16 – SWIMMING POOL PUMPS 22 51 19 – SWIMMING POOL WATER +TREATMENT EQUIPMENT +22 51 23 – SWIMMING POOL EQUIPMENT CONTROLS +22 52 00 – FOUNTAIN PLUMBING SYSTEMS +22 52 13 – FOUNTAIN PIPING 22 52 16 – FOUNTAIN PUMPS +22 52 19 – FOUNTAIN WATER TREATMENT EQUIPMENT +22 52 23 – FOUNTAIN EQUIPMENT CONTROLS +22 53 00 – RESERVED 22 54 00 – RESERVED 22 55 00 – RESERVED 22 56 00 – RESERVED 22 57 00 – RESERVED 22 58 00 – RESERVED 22 59 00 – RESERVED +22 60 00 – GAS and VACUUM SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 61 00 – COMPRESSED AIR SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 61 13 – COMPRESSED AIR PIPING for LABORATORY and HEALTHCARE FACILITIES +22 61 19 – COMPRESSED AIR EQUIPMENT for LABORATORY and HEALTHCARE FACILITIES +22 62 00 – VACUUM SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 62 13 – VACUUM PIPING for LABORATORY and HEALTHCARE FACILITIES +22 62 19 – VACUUM EQUIPMENT for LABORATORY and HEALTHCARE FACILITIES +22 62 23 – WASTE ANESTHESIA GAS PIPING +22 63 00 – GAS SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 63 13 – GAS PIPING for LABORATORY and HEALTHCARE FACILITIES +22 63 19 – GAS STORAGE TANKS for LABORATORY and HEALTHCARE FACILITIES +22 64 00 – RESERVED 22 65 00 – RESERVED +22 66 00 – CHEMICAL WASTE SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 66 53 – LABORATORY CHEMICAL WASTE and VENT PIPING +22 66 70 – HEALTH CARE CHEMICAL WASTE and VENT PIPING +22 66 83 – CHEMICAL WASTE TANKS +22 67 00 – PROCESSED WATER SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +84 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +22 67 13 – PROCESSED WATER PIPING for LABORATORY and HEALTHCARE FACILITIES +22 67 19 – PROCESSED WATER EQUIPMENT for LABORATORY and HEALTHCARE FACILITIES +22 68 00 – RESERVED 22 69 00 – RESERVED 22 70 00 – RESERVED 22 80 00 – RESERVED 22 90 00 – RESERVED + +APPENDIX 3-B5 MASTERFORMAT 2004 +FACILITY CONSTRUCTION SUBGROUP 22 00 00 – PLUMBING +22 01 00 – OPERATION and MAINTENANCE of PLUMBING +22 01 10 – OPERATION and MAINTENANCE of PLUMBING PIPING and PUMPS +22 01 20 – RESERVED +22 01 30 – OPERATION and MAINTENANCE of PLUMBING EQUIPMENT +22 01 40 – OPERATION and MAINTENANCE of PLUMBING FIXTURES +22 01 50 – OPERATION and MAINTENANCE of POOL and FOUNTAIN PLUMBING SYSTEMS +22 01 60 – OPERATION and MAINTENANCE of LABORATORY and HEALTHCARE SYSTEMS +22 01 70 – RESERVED 22 01 80 – RESERVED 22 01 90 – RESERVED +22 02 00 – RESERVED 22 03 00 – RESERVED 22 04 00 – RESERVED +22 05 00 – COMMON WORK RESULTS for PLUMBING +22 05 13 – COMMON MOTOR REQUIREMENTS for PLUMBING EQUIPMENT +22 05 16 – EXPANSION FITTINGS and LOOPS for PLUMBING PIPING +22 05 19 – METERS and GAGES for PLUMBING PIPING +22 05 23 – GENERAL DUTY VALVES for PLUMBING PIPING +22 05 29 – HANGERS and SUPPORTS for PLUMBING PIPING and EQUIPMENT +22 05 33 – HEAT TRACING for PLUMBING PIPING 22 05 48 – VIBRATION and SEISMIC CONTROLS +for PLUMBING PIPING and EQUIPMENT 22 05 53 – IDENTIFICATION for PLUMBING +PIPING and EQUIPMENT +22 05 73 – FACILITY DRAINAGE MANHOLES 22 05 76 – FACILITY DRAINAGE CLEANOUTS +22 06 00 – SCHEDULES for PLUMBING +22 06 10 – SCHEDULES for PLUMBING PIPING and PUMPS + +22 06 10 13 – Plumbing Pump Schedule +22 06 12 – SCHEDULES for FACILITY POTABLE WATER STORAGE +22 06 15 – SCHEDULES for GENERAL SERVICE COMPRESSED AIR EQUIPMENT +22 06 30 – SCHEDULES for PLUMBING EQUIPMENT +22 06 30 13 – Domestic Water Heater Schedule 22 06 40 – SCHEDULES for PLUMBING +FIXTURES +22 06 40 13 – Plumbing Fixture Schedule +22 06 50 – SCHEDULES for POOL and FOUNTAIN PLUMBING SYSTEMS +22 06 60 – SCHEDULES for LABORATORY and HEALTHCARE SYSTEMS +22 07 00 – PLUMBING INSULATION +22 07 16 – PLUMBING EQUIPMENT INSULATION 22 07 19 – PLUMBING PIPING INSULATION +22 08 00 – COMMISSIONING of PLUMBING +22 09 00 – INSTRUMENTATION and CONTROL of PLUMBING +22 10 00 – PLUMBING PIPING and PUMPS +22 11 00 – FACILITY WATER DISTRIBUTION +22 11 13 – FACILITY WATER DISTRIBUTION PIPING +22 11 16 – DOMESTIC WATER PIPING 22 11 19 – DOMESTIC WATER PIPING +SPECIALTIES +22 11 23 – DOMESTIC WATER PUMPS +22 11 23 13 – Domestic Water Packaged Booster Pumps +22 11 23 23 – Close Coupled, In-Line, Seal-Less Centrifugal Domestic Water Pumps +22 11 23 26 – Close Coupled, Horizontally Mounted, In-Line, Centrifugal Domestic Water Pumps +22 11 23 29 – Close Coupled, Vertically Mounted, In-Line, Centrifugal Domestic Water Pumps +22 11 23 33 – Separately Coupled, In-Line, Centrifugal Domestic Water Pumps +22 11 23 36 – Separately Coupled, Horizontally Mounted, In-Line, Centrifugal Domestic Water Pumps +22 12 00 – FACILITY POTABLE WATER STORAGE TANKS +22 12 13 – FACILITY ROOF MOUNTED, POTABLE WATER STORAGE TANKS +22 12 16 – FACILITY ELEVATED, POTABLE WATER STORAGE TANKS +22 12 19 – FACILITY GROUND MOUNTED, POTABLE WATER STORAGE TANKS +22 12 23 – FACILITY INDOOR POTABLE WATER STORAGE TANKS +22 12 23 13 – Facility Steel, Indoor Potable Water Storage, Pressure Tanks +22 12 23 16 – Facility Steel, Indoor Potable Water Storage, Non-Pressure Tanks +Chapter 3 — Specifications + + +22 12 23 23 – Facility Plastic, Indoor Potable Water Storage, Pressure Tanks +22 12 23 26 – Facility Plastic, Indoor Potable Water Storage, Non-Pressure Tanks +22 13 00 – FACILITY SANITARY SEWERAGE +22 13 13 – FACILITY SANITARY SEWERS +22 13 16 – SANITARY WASTE and VENT PIPING 22 13 19 – SANITARY WASTE PIPING +SPECIALTIES +22 13 19 13 – Sanitary Drains +22 13 19 23 – Fats, Oils, and Grease Disposal Systems +22 13 19 26 – Grease Removal Devices 22 13 19 33 – Backwater Valves +22 13 19 36 – Air Admittance Valves +22 13 23 – SANITARY WASTE INTERCEPTORS 22 13 26 – SANITARY WASTE SEPARATORS 22 13 29 – SANITARY SEWERAGE PUMPS +22 13 29 13 – Wet Pit Mounted, Vertical Sewerage Pumps +22 13 29 16 – Submersible Sewerage Pumps 22 13 29 23 – Sewerage Pump Reverse Flow +Assemblies +22 13 29 33 – Sewerage Pump Basins and Pits 22 13 33 – PACKAGED, SUBMERSIBLE +SEWERAGE PUMP UNITS +22 13 36 – PACKAGED, WASTEWATER PUMP UNITS +22 13 43 – FACILITY PACKAGED SEWAGE PUMPING STATIONS +22 13 43 13 – Facility Dry Well Packaged Sewage Pumping Stations +22 13 43 16 – Facility Wet Well Packaged Sewage Pumping Stations +22 13 53 – FACILITY SEPTIC TANKS +22 14 00 – FACILITY STORM DRAINAGE +22 14 13 – FACILITY STORM DRAINAGE PIPING 22 14 16 – RAINWATER LEADERS +22 14 19 – SUMP PUMP DISCHARGE PIPING 22 14 23 – STORM DRAINAGE PIPING +SPECIALTIES +22 14 23.23 – Fats, Oils, and Grease Disposal Systems +22 14 23.26 – Grease Removal Devices 22 14 23.33 – Backwater Valves +22 14 23.36 – Air Admittance Valves +22 14 26 – FACILITY STORM DRAINS 22 14 26.13 – Roof Drains 22 14 26.16 – Facility Area Drains 22 14 26.19 – Facility Trench Drains +22 14 29 – SUMP PUMPS +22 14 29.13 – Wet Pit Mounted, Vertical Sump Pumps +22 14 29.16 – Submersible Sump Pumps 22 14 29.19 – Sump Pump Basins and Pits +22 14 33 – PACKAGED, PEDESTAL, DRAINAGE PUMP UNITS +22 14 36 – PACKAGED, SUBMERSIBLE, DRAINAGE PUMP UNITS +22 15 00 – GENERAL SERVICE COMPRESSED AIR SYSTEMS + +85 + + +22 15 13 – GENERAL SERVICE COMPRESSED AIR PIPING +22 15 16 – GENERAL SERVICE COMPRESSED AIR VALVES +22 15 19 – GENERAL SERVICE PACKAGED AIR COMPRESSORS and RECEIVERS +22 15 19.13 – General Service Packaged Reciprocating Air Compressors +22 15 19.16 – General Service Packaged Liquid Ring Air Compressors +22 15 19.19 – General Service Packaged Rotary Screw Air Compressors +22 15 19.23 – General Service Packaged Sliding Vane Air Compressors +22 16 00 – RESERVED 22 17 00 – RESERVED 22 18 00 – RESERVED 22 19 00 – RESERVED +22 20 00 – RESERVED +22 30 00 – PLUMBING EQUIPMENT 22 31 00 – DOMESTIC WATER SOFTENERS +22 31 13 – RESIDENTIAL DOMESTIC WATER SOFTENERS +22 31 16 – COMMERCIAL DOMESTIC WATER SOFTENERS +22 32 00 – DOMESTIC WATER FILTRATION EQUIPMENT +22 32 13 – DOMESTIC WATER BAG TYPE FILTERS +22 32 16 – DOMESTIC WATER FREE STANDING CARTRIDGE FILTERS +22 32 19 – DOMESTIC WATER OFF FLOOR CARTRIDGE FILTERS +22 32 23 – DOMESTIC WATER CARBON FILTERS 22 32 26 – DOMESTIC WATER SAND FILTERS +22 32 26.13 – Domestic Water Circulating Sand Filters +22 32 26.16 – Domestic Water Multimedia Sand Filters +22 32 26 19 – Domestic Water Greensand Filters +22 33 00 – ELECTRIC DOMESTIC WATER HEATERS +22 33 13 – INSTANTANEOUS ELECTRIC DOMESTIC WATER HEATERS +22 33 13.13 – Flow Control, Instantaneous Electric Domestic Water Heaters +22 33 13.16 – Thermostat Controlled, Instantaneous Electric Domestic Water Heaters +22 33 30 – RESIDENTIAL, ELECTRIC DOMESTIC WATER HEATERS +22 33 30.13 – Residential, Small Capacity Electric Domestic Water Heaters +22 33 30.16 – Residential, Storage Electric Domestic Water Heaters +22 33 30.23 – Residential, Collector to Tank, Solar – Electric Domestic Water Heaters +86 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +22 33 30.26 – Residential, Collector to Tank, Heat Exchanger Coil, Solar-Electric Domestic Water Heaters +22 33 33 – LIGHT COMMERCIAL ELECTRIC DOMESTIC WATER HEATERS +22 33 36 – COMMERCIAL DOMESTIC WATER ELECTRIC BOOSTER HEATERS +22 33 36.13 – Commercial Domestic Water Electric Booster Heaters +22 33 36.16 – Commercial Storage Electric Domestic Water Heaters +22 34 00 – FUEL FIRED DOMESTIC WATER HEATERS +22 34 13 – INSTANTANEOUS, TANKLESS, GAS DOMESTIC WATER HEATERS +22 34 30 – RESIDENTIAL GAS DOMESTIC WATER HEATERS +22 34 30.13 – Residential, Atmospheric, Gas Domestic Water Heaters +22 34 30.16 – Residential, Direct Vent, Gas Domestic Water Heaters +22 34 30.19 – Residential, Power Vent, Gas Domestic Water Heaters +22 34 36 – COMMERCIAL GAS DOMESTIC WATER HEATERS +22 34 36.13 – Commercial, Atmospheric, Gas Domestic Water Heaters +22 34 36.16 – Commercial, Power Burner, Gas Domestic Water Heaters +22 34 36.19 – Commercial, Power Vent, Gas Domestic Water Heaters +22 34 36.23 – Commercial, High Efficiency, Gas Domestic Water Heaters +22 34 36.26 – Commercial, Coil Type, Finned Tube, Gas Domestic Water Heaters +22 34 36.29 – Commercial, Grid Type, Finned Tube, Gas Domestic Water Heaters +22 34 46 – OIL FIRED DOMESTIC WATER HEATERS +22 34 46.13 – Large Capacity, Oil Fired Domestic Water Heaters +22 34 56 – DUAL FUEL FIRED DOMESTIC WATER HEATERS +22 35 00 – DOMESTIC WATER HEAT EXCHANGERS +22 35 13 – INSTANTANEOUS DOMESTIC WATER HEAT EXCHANGERS +22 35 13.13 – Heating Fluid in Coil, Instantaneous Domestic Water Heat Exchanger +22 35 13.16 – Domestic Water in Coil, Instantaneous Domestic Water Heat Exchanger +22 35 13.19 – Heating Fluid in a U-Tube Coil, Instantaneous Domestic Water Heat Exchanger +22 35 23 – CIRCULATING DOMESTIC WATER HEAT EXCHANGERS +22 35 23.13 – Circulating, Compact Domestic Water Heat Exchangers + +22 35 23.16 – Circulating, Storage Domestic Water Heat Exchangers +22 35 29 – NON-CIRCULATING DOMESTIC WATER HEAT EXCHANGERS +22 35 29.13 – Non-Circulating, Compact Domestic Water Heat Exchangers +22 35 29.16 – Non-Circulating, Storage Domestic Water Heat Exchangers +22 35 36 – DOMESTIC WATER BRAZED PLATE HEAT EXCHANGERS +22 35 39 – DOMESTIC WATER PLATE and FRAME HEAT EXCHANGERS +22 35 43 – DOMESTIC WATER HEAT RECLAIMERS +22 36 00 – RESERVED 22 37 00 – RESERVED 22 38 00 – RESERVED 22 39 00 – RESERVED +22 40 00 – PLUMBING FIXTURES +22 41 00 – RESIDENTIAL PLUMBING FIXTURES +22 41 13 – RESIDENTIAL WATER CLOSETS, URINALS and BIDETS +22 41 16 – RESIDENTIAL LAVATORIES and SINKS +22 41 19 – RESIDENTIAL BATHTUBS +22 41 23 – RESIDENTIAL SHOWER RECEPTORS and BASINS +22 41 26 – RESIDENTIAL DISPOSERS +22 41 36 – RESIDENTIAL LAUNDRY TRAYS +22 41 39 – RESIDENTIAL FAUCETS, SUPPLIES and TRIM +22 42 00 – COMMERCIAL PLUMBING FIXTURES +22 42 13 – COMMERCIAL WATER CLOSETS, URINALS and BIDETS +22 42 16 – COMMERCIAL LAVATORIES and SINKS +22 42 19 – COMMERCIAL BATHTUBS +22 42 23 – COMMERCIAL SHOWER RECEPTORS and BASINS +22 42 26 – COMMERCIAL DISPOSERS 22 42 29 – SHAMPOO BOWLS +22 42 33 – WASH FOUNTAINS +22 42 36 – COMMERCIAL LAUNDRY TRAYS +22 42 39 – COMMERCIAL FAUCETS, SUPPLIES and TRIM +22 42 43 – FLUSHOMETERS +22 43 00 – HEALTHCARE PLUMBING FIXTURES +22 43 13 – HEALTHCARE WATER CLOSETS 22 43 16 – HEALTHCARE SINKS +22 43 19 – HEALTHCARE BATHTUBS and SHOWERS +22 43 23 – HEALTHCARE SHOWER RECEPTORS and BASINS +22 43 26 – HEALTHCARE FAUCETS +22 43 43 – HEALTHCARE PLUMBING FIXTURE FLUSHOMETERS +22 44 00 – RESERVED +Chapter 3 — Specifications + + +22 45 00 – EMERGENCY PLUMBING FIXTURES +22 45 13 – EMERGENCY SHOWERS 22 45 16 – EYEWASH EQUIPMENT +22 45 19 – SELF CONTAINED EYEWASH EQUIPMENT +22 45 23 – PERSONAL EYEWASH EQUIPMENT 22 45 26 – EYE/ FACE WASH EQUIPMENT +22 45 29 – HAND HELD EMERGENCY DRENCH HOSES +22 45 33 – COMBINATION EMERGENCY FIXTURE UNITS +22 45 36 – EMERGENCY FIXTURE WATER TEMPERING UNITS +22 46 00 – SECURITY PLUMBING FIXTURES +22 46 13 – SECURITY WATER CLOSETS and URINALS +22 46 16 – SECURITY LAVATORIES and SINKS 22 46 39 – SECURITY FAUCETS, SUPPLIES and +TRIM +22 46 43 – SECURITY PLUMBING FIXTURE FLUSHOMETERS +22 46 53 – SECURITY PLUMBING FIXTURE SUPPORTS +22 47 00 – DRINKING FOUNTAINS and WATER COOLERS +22 47 13 – DRINKING FOUNTAINS +22 47 16 – PRESSURE WATER COOLERS +22 47 19 – WATER STATION WATER COOLERS 22 47 23 – REMOTE WATER COOLERS +22 48 00 – RESERVED 22 49 00 – RESERVED +22 50 00 – POOL and FOUNTAIN PLUMBING SYSTEMS +22 51 00 – SWIMMING POOL PLUMBING SYSTEMS +22 51 13 – SWIMMING POOL PIPING 22 51 16 – SWIMMING POOL PUMPS 22 51 19 – SWIMMING POOL WATER +TREATMENT EQUIPMENT +22 51 23 – SWIMMING POOL EQUIPMENT CONTROLS +22 52 00 – FOUNTAIN PLUMBING SYSTEMS +22 52 13 – FOUNTAIN PIPING 22 52 16 – FOUNTAIN PUMPS +22 52 19 – FOUNTAIN WATER TREATMENT EQUIPMENT +22 52 23 – FOUNTAIN EQUIPMENT CONTROLS +22 53 00 – RESERVED 22 54 00 – RESERVED 22 55 00 – RESERVED 22 56 00 – RESERVED 22 57 00 – RESERVED 22 58 00 – RESERVED +22 59 00 – RESERVED + +87 + + +22 60 00 – GAS and VACUUM SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 61 00 – COMPRESSED AIR SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 61 13 – COMPRESSED AIR PIPING for LABORATORY and HEALTHCARE FACILITIES +22 61 13.53 – Laboratory Compressed Air Piping 22 61 13.70 – Healthcare Compressed Air Piping 22 61 13.74 – Dental Compressed Air Piping +22 61 19 – COMPRESSED AIR EQUIPMENT for LABORATORY and HEALTHCARE FACILITIES +22 61 19.53 – Laboratory Compressed Air Equipment +22 61 19.70 – Healthcare Compressed Air Equipment +22 61 19.74 – Dental Compressed Air Equipment +22 62 00 – VACUUM SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 62 13 – VACUUM PIPING for LABORATORY and HEALTHCARE FACILITIES +22 62 13.53 – Laboratory Vacuum Piping 22 62 13.70 – Healthcare, Surgical Vacuum +Piping +22 62 13.74 – Dental Vacuum Piping 22 62 19 – VACUUM EQUIPMENT for +LABORATORY and HEALTHCARE FACILITIES 22 62 19.53 – Laboratory Vacuum Equipment +22 62 19.70 – Healthcare Vacuum Equipment 22 62 19.74 – Dental Vacuum and Evacuation +Equipment +22 62 23 – WASTE ANESTHESIA GAS PIPING +22 63 00 – GAS SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 63 13 – GAS PIPING for LABORATORY and HEALTHCARE FACILITIES +22 63 13.53 – Laboratory Gas Piping 22 63 13.70 – Healthcare Gas Piping 22 63 19 – GAS STORAGE TANKS for +LABORATORY and HEALTHCARE FACILITIES 22 63 19.53 – Laboratory Gas Storage Tanks +22 63 19.70 – Healthcare Gas Storage Tanks +22 64 00 – RESERVED 22 65 00 – RESERVED +22 66 00 – CHEMICAL WASTE SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +22 66 53 – LABORATORY CHEMICAL WASTE and VENT PIPING +22 66 70 – HEALTH CARE CHEMICAL WASTE and VENT PIPING +22 66 83 – CHEMICAL WASTE TANKS +22 66 83.13 – Chemical Waste Dilution Tanks 22 66 83.16 – Chemical Waste Neutralization +Tanks +22 67 00 – PROCESSED WATER SYSTEMS for LABORATORY and HEALTHCARE FACILITIES +88 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +22 67 13 – PROCESSED WATER PIPING for LABORATORY and HEALTHCARE FACILITIES +22 67 13.13 – Distilled Water piping +22 67 13.16 – Reverse Osmosis Water Piping 22 67 13.19 – De-ionized Water Piping +22 67 19 – PROCESSED WATER EQUIPMENT for LABORATORY and HEALTHCARE FACILITIES +22 67 19.13 – Distilled Water Equipment +22 67 19.16 – Reverse Osmosis Water Equipment 22 67 19.19 – De-ionized Water Equipment +22 68 00 – RESERVED 22 69 00 – RESERVED 22 70 00 – RESERVED 22 80 00 – RESERVED +22 90 00 – RESERVED + +APPENDIX 3-C +SECTION SHELL OUTLINE ThisshelloutlinehasbeendevelopedbytheAmerican InstituteofArchitectsconformingtotheCSIManual of Practice. + +SECTION XXXXX XXXXXXXXXXXXXXXXXXXX + +PART 1—GENERAL 1.1 SUMMARY +A. This section includes [description of essential unit of work included in section]. +B. Products furnished but not installed under this section include [description]. + +C. Products installed but not furnished under this section include [description]. +D. Related Sections: The following relate to this section: +1. Division[#]Section[“Title”]for[description of related unit of work]. +2. Division[#]Section[“Title”]for[description of related unit of work]. +3. Division[#]Section[“Title”]for[description of related unit of work]. +4. Division[#]Section[“Title”]for[description of related unit of work]. + +E. Allowances: F. Unit Prices: G. Alternates: +1.2 REFERENCES 1.3 DEFINITIONS +1.4 SYSTEM DESCRIPTION +1.5 SYSTEM PERFORMANCE REQUIREMENTS + +A. Performance Requirements: Provide [system] complyingwithperformancerequirementsspeci-fied. +1.6 SUBMITTALS +A. General: Submit the following: +B. Product data for each type of [products] speci-fied, including details of construction relative to materials, dimensions of individual components, profiles, and finishes. +C. Product data for the following products: 1. [Product]. +2. [Product]. +Chapter 3 — Specifications 89 + + + +3. [Product]. 4. [Product]. +D. Shop drawings from manufacturer detailing equipmentassembliesandindicatingdimensions, weights,loadings,requiredclearances,methodof fieldassembly,components,utilityrequirements, and location and size of each field connection. +E. Include setting drawings, templates, and direc-tions for installation of anchor bolts and other anchoragestobeinstalledasunitofworkofother sections. +F. Coordination drawings for [unit of work]. +G. Coordination drawings for reflected ceiling plans drawn accurately to scale and coordinating pen-etrations and ceiling-mounted items, including sprinklers,diffusers,grilles,lightfixtures,speak-ers, and access panels. + +who is on jobsite during times that [unit of work] is in progress. +C. TestingLaboratoryQualifications:Demonstrate experience and capability to conduct testing indicated without delaying progress of the work based on evaluation of laboratory-submitted cri-teria conforming to ASTM E 699. +D. Qualify welding process and welding operators in accordance with ASME “Boiler and Pressure Vessel Code,” Section IX, “Welding and Brazing Qualifications.” +E. Regulatory Requirements: Fabricate and stamp [product] to comply with [code]. +F. Regulatoryrequirements:Complywithfollowing codes. +1. [Itemize codes in form of separate subpara-graphs under above]. + + + +H. Wiring diagrams from manufacturer for electri-cally operated equipment. + +G. ULStandard:Provide[products]complyingwith UL [designation, title]. + + + +I. Wiring diagrams detailing wiring for power, sig-nal,andcontrolsystems,differentiatingbetween manufacturer and field-installed wiring. +J. Material certificates signed by manufacturer certifying that each material item complies with requirements, in lieu of laboratory test reports, when permitted by architect. +K. Product certificates signed by manufacturers of [products] certifying that their products comply with requirements. +L. Weldercertificatessignedbycontractorcertifying that welders comply with requirements of “qual-ity-assurance” article. +M. Qualificationsdataforfirmsandpersonsspecified in “quality-assurance” article to demonstrate their capabilities and experience. Include list of completed projects with project name, addresses, name of architects and owners, plus other infor-mation specified. +N. Test reports from, and based on tests performed by, qualified independent testing laboratory evidencing compliance of [product] with require-ments based on comprehensive testing. +O. Maintenance data for [materials and products], forinclusioninoperatingandmaintenancemanu-als. +1.7 QUALITY ASSURANCE +A. Installer Qualifications: Engage an experienced installer who has successfully completed [unit of work] similar in material, design, and extent to that indicated for project. + +H. Electrical Component Standard: Provide com-ponents complying with NFPA 70 “National Electrical Code” and which are listed and labeled by UL where available. +I. UL and NEMA Compliance: Provide [compo-nents] required as part of [product or system] which are listed and labeled by UL and comply with applicable NEMA standards. +J. ASME Compliance: Fabricate and stamp [prod-uct] to comply with ASME Boiler and Pressure Vessel Code, Section VIII, Division 1. +K. Single Source Responsibility: Obtain [system] components from single source having responsi-bility and accountability to answer and resolve problems regarding proper installation, compat-ibility, performance, and acceptance. +L. Manufacturer and Product Selection: The draw-ings indicate sizes, profiles, and dimensional requirements of [product or system]. A [product or system] having equal performance character-istics with deviations from indicated dimensions and profiles may be considered, provided devia-tionsdonotchangethedesignconceptorintended performance. The burden of proof of equality is on the proposer. +1.8 DELIVERY, STORAGE, AND HANDLING + +A. Deliver materials and equipment to site in such quantities and at such times to ensure continu-ity of installation. Store them at site to prevent cracking, distortion, staining, and other physical damage and so that markings are visible. + +B. Installer’s Field Supervision: Require installer to maintain an experienced full-time supervisor +90 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +B. Lift and support equipment only at designated liftingorsupportingpointsasshownonfinalshop drawings. +C. Deliver[product]asafactoryassembledunitwith protective crating and covering. +D. Store [products] on elevated platforms in a dry location. +E. Coordinatedeliveryof[product]insufficienttime to allow movement into building. +1.9 PROJECT CONDITIONS + +PART 2—PRODUCTS 2.1 MANUFACTURERS +A. AvailableManufacturers:Subjecttocompliancewith requirements, manufacturers offering products which may be incorporated in the work include, but are not limited to, the following: +B. Manufacturers: Subject to compliance with requirements, provide products by one of the following: +1. [Name of Product]: + + + +A. Site Information: Data on indicated subsurface conditions are not intended as representations or warranties of accuracy or continuity of these conditions {between soil borings}. It is expressly understood that owner and engineer will not be responsible for interpretations or conclusions drawn therefrom by contractor. Data are made available for convenience of contractor (and are not guaranteed to represent conditions that may be encountered). +B. Field Measurements: Verify dimensions by field measurements.Verifythat[nameofsystem,prod-uct,orequipment]maybeinstalledincompliance with the originaldesignandreferencedstandards. +1.10 SEQUENCING AND SCHEDULING +A. Coordinatethesizeandlocationofconcreteequip-ment pads. Cast anchor bolt inserts into pad. Concrete reinforcement and formwork require-ments are specified in Division 3. + +a. [Manufacturer’s Name]. b. [Manufacturer’s Name]. c. [Manufacturer’s Name]. +2. [Name of Product]: +a. [Manufacturers Name]. b. [Manufacturer’s Name]. +3. [Name of Product]: +a. [Manufacturer’s Names]. 4. [Name of Product]: +a. [Manufacturer’s Names]. + +C. Available Products: Subject to compliance with requirements, products which may be incorpo-rated in the work include, but are not limited to, the following: +D. Products: Subject to compliance with require-ments, provide one of the following: + + + +B. Coordinate the installation of roof penetrations. Roof specialties are specified in Division 7. +1.11 WARRANTY +A. Special Project Warrant: Submit written war-ranty, executed by manufacturer, agreeing to repairorreplace[product]whichfailsinmaterials orworkmanshipwithinspecifiedwarrantyperiod. This warranty shall be in addition to, and not limitation of, other rights the owner may have against the contractor under the contract docu-ments. +1. Warranty period is 1 year after date of sub-stantial completion. +1.12 MAINTENANCE 1.13 EXTRA MATERIALS +A. Deliver extra materials to owner. Furnish extra materials described below matching products installed, packaged with protective covering for storage and identified with labels clearly describ-ing contents. + + +E. Manufacturer: Subject to compliance with re-quirements, provide product by [Manufacturer’s Name]. +2.2 MATERIALS [PRODUCT NAME] +A. [Material or Product Name]: [Nonproprietary descriptionofmaterial]complyingwith[standard designation] (for type, grade, etc.). +B. [Material or Product Name]: [Nonproprietary descriptionofmaterial]complyingwith[standard designation] (for type, grade, etc.). +C. [Material or Product Name]: [Standard designa-tion],[type,grade,etc.asapplicabletoreferenced standard]. +D. [Material or Product Name]: [Standard designa-tion],[type,grade,etc.asapplicabletoreferenced standard]. +2.3 MATERIALS, GENERAL [PRODUCTS, GENERAL] + +A. [Description] Standard: Provide [product or material]whichcomplieswith[standarddesigna-tion]. +Chapter 3 — Specifications 91 + + + +B. [Description] Standard: Provide [product or material]whichcomplieswith[standarddesigna-tion]. + +B. Examine rough-in drawings for [name] piping systemstoverifyactuallocations ofpipingconnec-tionspriortoinstallation. + + + +C. [Kind of Performance] Characteristics: [Insert requirements for kind of performance involved and test method as applicable unless require-ments included under Part 1 Article (“System Description).] +D. [Kind of Performance] Characteristics: [Insert requirements for kind of performance involved and test method as applicable unless require-ments included under Part 1 Article (“System Description”).] +2.4 EQUIPMENT [NAME OF MANUFACTURED UNIT] + +A. [Equipment or Unit Name]: [Nonproprietary description of…] complying with [standard des-ignation] (for type, grade, etc.). +B. [Equipment or Unit Name]: [Nonproprietary description of…] complying with [standard des-ignation] (for type, grade, etc.). +C. [Equipment, Unit, or Product Name]: [standard designation], (type, grade, etc. as applicable to referencedstandard). +D. [Equipment, Unit, or Product Name]: [standard designation], (type, grade, etc. as applicable to referenced standard). +2.5 COMPONENTS +A. [Component Name]:… [Nonproprietary descrip-tion of…] complying with [standard designation] (for type, grade, etc.). +B. [ComponentName]:[Nonproprietarydescription of…] complying with [standard designation] (for type, grade, etc.). +2.6 ACCESSORIES + +C. Examine walls, floors, roof, and [description] for suitable conditions where [name of products or system] are to be installed. +D. Do not proceed until unsatisfactory conditions have been corrected. +3.2 PREPARATION A. Protection: +3.3 INSTALLATION, GENERAL [APPLICATION, GENERAL] +A. [Description] Standard: Install [name of product, material, or system] to comply with [standard designation]. +3.4 INSTALLATION {OF [NAME]} {APPLICATION OF [NAME]} + +A. Install [name of unit of work] level and plumb, in accordancewithmanu-facturer’swritteninstruc-tions,rough-indrawings,theoriginaldesign,and referenced standards. +3.5 CONNECTIONS (NOT A CSI ARTICLE—BUT USEFUL FOR DIVISION 15) + +A. Piping installation requirements are specified in other sections. Drawings indicate general ar-rangementofpiping,fittings,andspecialties.The following are specific connection requirements: +B. Install piping adjacent to equipment to allow servicing and maintenance. +3.6 FIELD QUALITY CONTROL +A. Testing Laboratory: Owner will employ and pay anindependenttestinglaboratorytoperformfield quality control testing. + + + +A. Manufacturer’s standard factory finish. 2.7 MIXES +2.8 FABRICATION +2.9 SOURCE OF QUALITY CONTROL + +PART 3—EXECUTION + +3.1 EXAMINATION +A. Examine [substrates] [areas] [and] [conditions] [with Installer present] for compliance with requirements for [maximum moisture content], installationtolerances,[otherspecificconditions], and other conditions affecting performance of [unitofworkofthissection].Donotproceedwith installation until unsatisfactory conditions have been corrected. + +B. Testing Laboratory: Provide the services of an independent testing laboratory experienced in the testing of [unit of work] and acceptable to theengineer,toperformfieldqualitycontroltest-ing. +C. Extent and Testing Methodology: Arrange for testing of completed [unit of work] in successive stages in areas of extent described below; do not proceed with [unit of work] of next area until test results for previously completed work verify compliance with requirements. +D. Testing laboratory shall report test results promptly and in writing to contractor and engi-neer. +E. Repair or replace [unit of work] within areas where test results indicate [unit of work] does not comply with requirements. +92 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +F. Manufacturer’s Field Service: Provide services of a factory-authorized service representative to supervise field assembly of components, installa-tion of [products] including piping and electrical connections, and to report results in writing. +3.7 ADJUSTING [CLEANING] [ADJUSTING AND CLEANING] +3.8 COMMISSIONING (NOT A CSI ARTICLE — BUT USEFUL FOR DIVISION 15 [DEMONSTRATION]) + +A. Start-Up Services, General: Provide services of a factory-authorized service representative to provide start-up service and to demonstrate and trainowner’smaintenancepersonnelasspecified below. +B. Test and adjust controls and safeties. Replace damaged or malfunctioning controls and equip-ment. +C. Train owner’s maintenance personnel on pro-cedures and schedules related to start-up and shut-down, troubleshooting, servicing, and pre-ventative maintenance. +D. Review data in operating and maintenance manuals. Refer to Division 1, Section [“Project Closeouts”][“OperatingandMaintenanceManu-als”]. +E. Schedule training with owner through architect, with at least 7 days advance notice. +3.9 PROTECTION 3.10 SCHEDULES +4 + + + + + +Plumbing Cost Estimation + +Cost estimating involves matching specific project information with a database of known construction costs to predict the cost of the project. When the proj-ect varies from the assumptions of the database, the predicted cost is adjusted appropriately. The specific project information is generally identified as groups ofrepeatedactivities.Thedatabase,calledunitcosts, isacompilationofcoststodoeachactivity.Quantities of each activity are multiplied by the unit costs and added up for a sum of costs. Multipliers are then ap-plied to this sum and the number is rounded up. +Mathematically, the process is multiplying two vectors, called a dot product, and then multiplying this dot product by a scalar. The first vector is the quantity of activities. The second vector is the cost of each activity. A database may be developed over time or obtained with a vendor’s estimating software program. The mathematics is generally set up with tabular sheets, an ordinary spreadsheet program, or a vendor’s program. +The database of unit costs is usually different for projects having a completed design than for projects in a schematic phase. For estimating design develop-ment, where final sizes are not known, approximate sizes are estimated, and the same database used on final projects is applied, but then a more liberal con-tingency factor is used. +Plumbingconstructioncostscanbebrokendown into these categories: +• Material +• Preparation • Fixtures +• Appurtenances +Material includes pipe, fittings, valves, pipe supports, sleeves, low-voltage wiring, fire stop-ping, insulation, drains, cleanouts, fixture carriers, sprinkler heads, medical gas outlets, and similar commodityitemsaswellasgeneralmaterialhandling. Preparation includes demolition work, excavation and backfill, cutting and patching, and survey and marking. Fixtures include water closets, lavatories, urinal, shower, and service sink. Appurtenances + +include interceptors, pumps, alarms, water meters, backflowpreventers,pressurevessels,waterheaters, and water-treatment equipment. +Cost estimating is broken down into two con-venient sets of sums: Material costs are estimated separately from labor costs. Thus, we have equations 4-1 and 4-2 to create a tabular take-off sheet for manual estimating or writing a spreadsheet. +Equation 4-1 +E1 = ([A][B] d + [C][D] w) where: +E1 = The estimate of one category of construction [A] = The quantity vector of each material on a +specific job +[B] = The unit price vector of each material, typically taken from a vendor’s catalog +d = A multiplier, such as 0.65, to represent a contractor’s discount +[C] = The quantity vector of each labor activity (it may be equal to [A]) +[D] = The time vector for a single worker to do each type of activity +w = A multiplier to represent the hourly cost for such a worker including all taxes, insurance costs, and benefits +Equation 4-2 +Et = Sum (E1, E2, E3…En) m + O +where: +Et = The sum of all categories of construction E1, E2, E3 …En = The estimate of one category of construction +m = The product of factors such as geography, job size, contingency, sales tax, and contractor overhead +O = A sum of fixed costs such as permits, equipment mobilization, bonds, chlorination, certification, record keeping costs, equipment rental, and submittal preparation +The product of factors, m, is often called a mark-up.Iftheconditionsoftheprojectmatchthedatabase andsalestaxdoesnotapply,thenmrangesfrom1.10 +94 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +to 1.12 to reflect a 10 to 12% overhead for the plumb-ingcontractor.Thefinalinstalledcostwillincludethe additionaloverheadofthegeneralcontractorranging from6to15%.Ifgeographyandjobsizeareideal,but thedesignisincomplete,thena15%contingencymay be considered as well as the 10% overhead. Thus, m = 1.15 x1.10 = 1.265. The geography factor ranges from0.87to1.10formostofNorthAmerica.Salestax ranges from 0 to 7% with state and local variations of how it is applied. The size of a job causes the largest range of factors and is discussed later in the chapter. Thus, a job’s mark-up on its sum of costs for geog-raphy, job size, contingency, sales tax, and plumbing contractoroverheadmaybe1.12,1.00,1.02,1.06,and 1.10, respectively, resulting in m = 1.33 (m = 1.12 x 1.00 x 1.02 x 1.06 x 1.10). +Some estimators prefer to consider each factor separately in terms of the amount of additional costs for each factor. Thus, in the last example, 12% of the sum of costs is derived to give the added cost for geography. Then the geography factor is added to the sumofcosts.The2%contingencyisderivedfromthis last sum. Then the 6% sales tax is similarly derived. The overhead may be derived before or after adding the sales tax, depending on local practice. +It should be noted how mark-ups are considered inestimatesforalternativematerialsorconstruction methods. The application of mark-ups should be the same to the original cost and to the alternate cost. If an alternate is presented without the mark-up, it may erroneously appear to be attractive over the original. Conversely, beware of an alternate includ-ing the mark-up when it is compared to the original that is part of a larger estimate. The original will not have the mark-up included if it is only a line item because the mark-up is applied later in the estimate. Hence, the alternate may not appear attractive, even though it is. + +Example 1 +Table 4-1 Piping Take-off Sample Item Qty. Unit Material Total Joints +1-in. [25mm] copper L , 50/50 solder +ft. [m] of pipe 237 [72.2] $2.05 $486 couplings 24 1.56 $ 37 2 elbows 19 1.78 $ 34 2 tees 5 4.03 $20 3 ball valves 2 31.80 $64 2 hangers (ring type) 46 3.48 $160 +Sub-total $801 Deduct Discount $280 +Elevated work adjustment (10%) Wage rate ($/hr per person) +Sub-Total (Materials and Installation) $520 +Total + +LABOR COSTS +The following parts of a labor rate are applied to the gross wage rate to reflect a labor cost of con-struction. +• SocialSecurityandMedicaretaxesthatemployers pay +• Workmens compensation insurance premium • Unemployment tax +• Health insurance premium • Holiday and vacation pay +• Retirement cost +The estimated cost of labor is the labor rate mul-tiplied by the estimated time to complete the work. + +TAKE-OFF ESTIMATING METHOD The take-off method requires measuring the +length of each size and type of pipe using scaled drawings. In addition, the method requires counting allfittings,valves,fixtures,appurtenances,andother material. This tedious process is then combined with known material costs, expected productivity rates, andlaborratestoobtainthesumofcosts.Themethod has an established record of providing accurate cost estimates. +One method to create the tabular take-off sheet is shown in Table 4-1. The material quantity vec-tor [A] is in the second column. The product of the second column and the fifth column will create the labor quantity vector. This method reflects some fit-tings having 2 joints while others have 3. The time accounted for preparing the hangers and joints will cover the labor for installing the pipe. Various work situations can be adjusted. Table 4-1 shows an extra 10percentadjustmenttoreflectworkonascissorslift. When piping is installed at two elevations, separate sheets are utilized to analyze cost at each level. +Each category of construc-tion is put into a table in a +similar manner. Tabulation +Unit Labor Total sheets are then added together beforebeingadjustedbythefac-tormtogivethefinalestimate. +If necessary, premium labor +0.25 12 hr rates are applied for non-stan-0.25 9.5 dard working hours. Overtime 0.25 3.8 laborratesarefurtheradjusted 0.25 1 toreflectlowerproductivityfor 0.50 23 longer workdays. +49.3 hr Another aspect of take-off estimationreflectsthefactcon- +54.2 hr struction consists of crews of +$55/hr varying skills and labor rates. $2980 Thedatabaseshowsproductiv- +$3500 ityofcertainsizesofcrews.For +Chapter 4 — Plumbing Cost Estimation 95 + + +Table 4-2 Hours to Excavate 100 Feet [30.5 m] of Trench +All Work by Hand Mechanical Final Depth Width Volume Modest Long Chain Hand +(ft) (in) (yd3) Sandy Medium Hard Length Length Trenchera Gradingb 1 18 6 7 11 16 1 1 2 3 1½ 18 8 11 17 24 2 1 3 3 +2 18 11 14 22 32 2 1 3 3 2½ 18 14 18 28 40 3 2 4 4 3 24 22 21 34 48 3 2 4 4 3½ 24 26 25 40 56 3 2 - 4 4 24 30 28 44 64 4 3 - 4 4½ 24 33 32 50 72 4 3 - 4 5 24 37 48 76 105 6 5 - 4 5½ 24 41 53 84 116 6 5 - 4 6 48 89 57 90 124 7 6 - 4 6½ 48 96 62 100 138 7 6 - 6 7 48 104 91 130 208 8 7 - 6 7½ 48 111 100 143 228 8 7 - 6 8 48 118 106 150 240 9 7 - 6 8½ 48 126 113 160 256 9 8 - 6 9 48 133 120 170 272 10 9 - 6 10 48 148 134 188 300 11 10 - 8 11 48 163 148 208 332 12 11 - 8 12 48 178 163 228 364 13 12 - 8 13 48 192 275 455 675 14 13 - 8 14 48 207 303 500 751 16 14 - 8 +Conversion factors: 1 in. = 25.4 mm, 1 ft. = 0.3048 m, 1 yd3 = 0.7646 m3, 1 ft3 = 0.037 yd3 Notes: +a “Chain Trencher” refers to a gasoline-driven trenching machine, which digs a maximum of 10 in. wide x 3 1⁄3 ft deep. b Add hand grading for mechanical trenching only if required. + + +example, one plumber and one apprentice, each with their own wage, can install so many feet of 3-inch [75 mm] PVC pipe per day. + +PRODUCTIVITY RATES +Tables 4-2 through 4-8 provide labor units for es-timatingaplumbingproject.Table4-9providessome modifiersforvariousjobconditions.Theinformation was originally derived from the National Association ofPlumbing-Heating-CoolingContractors(NAPHCC) basedonsurveyssolicitedof150plumbingcontractors from all areas of the United States. +Notice the cost difference between hand trench-ingandmachinetrenchinginTable4-2.Forexample, a trench 3 feet [0.91 m] deep 100 feet [30.5 m] long takes2or3hoursbymachineandupto48man-hours by hand. Four hours of additional time is applied to the machine method if hand grading is required. The trenchwidthandmaterialvolumearerevisedinTable 2 from earlier “Data Book” editions to reflect excava-tionwithtrenchboxesandothershoringmethods.For handwork, the volume should be adjusted to reflect a typical24-inchtrenchwidthforexcavationandbackfill volumes. For exterior work or other clear spaces ac-commodatinglargermachinery,hoursmaybereduced substantiallyfromthatindicated.Sawcuttingmaybe faster than as shown in Table 4-3 if space allows for larger equipment. Breaking pavement with heavier pneumatics or removing whole pieces of sawcut con-crete will reduce the times shown in Table 4-4. + +Table 4-5 shows the time for one laborer to hand backfillandmechanicallyhand-tampermediumback-fill (a trench 3 feet [0.91 m] deep 100 feet [30.5 m] long) is 17 hours. The same table shows the time to do it by machine is 1.8 hours. However, 12 additional hours are required for hand tamping the first layer of a 4-inch [100 mm] pipe and 0.8 hours of labor to assist the backfilling. If certain types of fill material are used, such as ¾- to 1-inch [19 to 25 mm] stone, compacting the fill is not required. +Notice in Table 4-6 that a single 4-inch [100 mm] brazed joint takes the most time (1.11 hours), and a single hubless joint takes the least time (0.4 hours). +Example 2 +Using Tables 4-2 and 4-5, estimate the cost to excavateandbackfillatrench5feet[1.52m]deep210 + +Table 4-3 To Sawcut 100 Feet +[30.5 m] of ConcreteTrench Depth +Inches 3 4 5 mm 75 100 125 Hours 5 6 7 + +Table 4-4 To Break 100 Feet [30.5 m] of Pavement Method Pavement Width Hours +Hand Concrete 24 in. 10 Pneumatic [600 mm] +96 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 4-5 Hours to Backfill 100 Feet [30.5 m] of Trench All Work by Hand Pipe Bedding +Depth Volume 3” 4-10” Mechanical Mechanical (ft) (yd3) Sandy Medium Hard dia dia Backfilla Compaction 1 6 5 6 7 8 12 0.3 - +1½ 8 7 8 11 8 12 0.4 0.5 2 11 9 11 15 8 12 0.5 0.5 2½ 14 11 14 20 8 12 0.6 0.5 3 23 14 17 24 8 12 0.8 1 3½ 26 16 20 28 8 12 0.9 1 +4 30 18 22 29 8 12 1 1 4½ 33 20 25 33 8 12 2 1 5 37 31 38 50 8 12 2 1 5½ 41 34 42 55 8 12 2 1 6 89 36 45 59 8 12 2 2 6½ 96 40 49 63 8 12 3 2 7 104 42 52 68 8 12 3 2 7½ 111 46 57 74 8 12 3 2 8 118 48 60 78 8 12 3 3 8½ 126 51 64 83 8 12 3 4 9 133 55 68 89 8 12 4 4 10 144 60 75 98 8 12 4 5 11 164 67 83 108 8 12 5 b 12 178 73 91 119 8 12 5 b 13 192 80 99 130 8 12 6 b 14 207 88 110 143 8 12 6 b +Conversion factors: 1 in. = 25.4 mm, 1 ft. = 0.3048 m, 1 yd3 = 0.7646 m3, 1 ft3 = 0.037 yd3 Notes: +a Must add for stand-by hand laborer. +b Call equipment company for hours to compact backfill. + + + +Method +Inch ½ Mm 13 +Screw thread 25 50/50 solder 20 +DWV solder -Brazed 26 +Groove steel -Groove copper - +Plastic 20 Hub and caulk - +Hub and gasket -Hubless - +Water main, mech. Joint -Water main, compression - + +Table 4-6 Hours to Complete 100 Joints +Size Note ¾ 1 1¼ 1½ 2 2½ 3 4 5 6 8 10 12 +19 25 32 38 51 64 76 102 127 152 203 254 305 27 30 36 38 40 90 95 100 145 150 200 - -21 25 27 30 32 63 75 85 123 127 170 - - +- - 33 36 39 76 90 102 148 153 204 - -27 33 35 39 42 82 96 111 160 165 - - - +- 30 36 38 40 72 76 80 116 120 160 184 208 - 30 36 38 40 72 76 80 116 120 160 184 208 +21 25 26 27 28 40 50 60 98 101 136 162 216 1 - - - - 50 - 55 60 65 70 120 130 150 2 - - - - 40 - 45 50 55 60 100 110 125 2 - - - 30 30 - 35 40 45 50 80 90 100 - +- - - - - - 60 62 - 70 72 80 82 3, 4 - - - - - - 47 48 - 50 52 54 56 3 + +Notes: +1 Solvent joint. For heat fusion, multiply value by 1.5 +2 Hub and spigot, service weight cast-iron pipe. For extra heavy, multiply value by 1.02. 3 Labor for 300 feet [90 m] minimum. Add crane cost. +4 Material weighing more than 150 lb. (68.2kg) + + + + +Type +Inch ¾ mm 19 Ringa 50 +Roller + +Table 4-7 Hours to Install 100 Pipe Hangers +Size +1 1¼ 1½ 2 2½ 3 4 5 6 8 10 12 25 32 38 51 64 76 102 127 152 203 254 305 50 50 50 50 60 60 70 70 80 100 100 100 +140 140 160 160 180 220 220 220 + +Notes: +a Included in hanger, rod, and insert +Chapter 4 — Plumbing Cost Estimation 97 + + +feet [64 m] long by machine. Final hand grading willberequired.Thepipewillbe4-inch[100mm], +and spoils will be backfilled. Table 4-8 Hours to Install Fixtures + +Solution: Select the required unit hours and apply it to the trench length of this example. Add equipment rental charge (or ownership hourly rate). Table 4-10 shows the take-off tabulation. +Example 3 +UsingTables4-2and4-5,estimatethecostto excavateandbackfilltrenches,bymachine,total-ing 120 feet, of 3-foot average depth; 130 feet, of 2-foot average depth; and a variety of trenches totaling 250 feet of 18 inch average depth. Ex-cavated material will be dumped offsite and replaced by new fill. Final hand grading will be required and the pipe will be 4-inch [100 mm]. +Solution: Determine the required unit hours and apply it to the various trench lengths. Add equipment rental charge (or ownership hourly rate). Add hauling cost of excavated material and delivery of backfill material. Since excavated material increases in volume by the excavation process, appropriately adjust the volume to ac-count for this swelling. Table 4-11 shows the take-off tabulation for each step. + +OTHER ESTIMATING METHODS A less-precise estimating method is to count fixtures and major appurtenances and apply time-proven costs per fixture or appurtenance to arrive at the total cost. Piping and material costs are included in the per-fixture cost. The particular level of trim and quality of the specific project should be comparable with those of the database. For example, if the project requires cast-brass faucets, caulked cast-iron piping, and frequent valves on the supply distribution, then apply a per-fixture cost derived from a project that used similar material. +The advantage of the per-fixture method is it can be performed without a piping layout. A disadvantage is it fails to distinguish between projectswithfixturesconcentratedinafewareas compared to fixtures spread about the building. +Anotherless-preciseestimatingmethodisthe square foot [m2] method. This method provides a reasonable cost estimate even with little project information.Acostestimateisdeterminedsimply by multiplying the building area by a per-area cost. Per-area cost must be carefully selected to the level of trim and quality of the particular project. Additionally, the concentration or dis-persed distribution of fixtures and the building application for fixtures must be addressed when per-area cost is applied. For example, a medical + + +Fixture Type Time Bathtub - 3.0 Drinking Fountain Wall mount 2.0 Lavatory Wall mount 2.0 Lavatory Counter 2.5 Mop Basin - 2.0 Shower Built-up stall 1.0 Sink Single compartment 2.0 Sink Double compartment 2.5 Service Sink - 3.0 Urinal Wall mount 2.8 Urinal Stall 3.8 Water closet Floor mount 1.8 Water closet Wall mount 2.7 Water cooler Wall mount 2.5 + +Table 4-9 Adjustments From Standard Conditions +Activity Condition Multiplier Crawl space or tunnel 3-foot [1 m] high 1.50 Distribution of material +Distance from stock: 100 feet [30 m] 1.00 300 feet [90 m] 1.03 +500 feet [150 m] 1.04 1000 feet [300 m] 1.05 +Equipment room piping - 1.20 Food service piping - 1.10 Laboratory piping - 1.10 Overhead piping 8-foot [2.5 m] ladder 1.00 10-foot [3 m] ladder 1.03 +powered lift 1.10 Trench piping 3-foot [1 m] deep 1.00 +5-foot [1.5 m] deep 1.10 8-foot [2.44 m ] deep-shored 2.00 10-foot [3.05 m] deep-shored 2.25 12-foot [3.66 m] deep-shored 2.50 + +Table 4-10 Solution to Example 2 +Item Length, Unit Total feet [m] Hours hours +Excavate 210 [64] 0.05 10.5 Hand grading 210 [64] 0.04 8.4 Pipe bedding 210 [64] 0.12 25.2 Backfill 210 [64] 0.02 4.2 Added labor 210 [64] 0.02 4.2 Compaction 210 [64] 0.01 2.1 +Total labor hours 54.6 Labor rate [$/hr per person] $55/hr +Total labor cost [$55/hr x 54.6 hrs] $3003 Total machine hours 17 +Machine cost [$120/hr x 17 hrs] $2040 +Total cost $5043 +98 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 4-11 Solution to Example 3 complicated.Thevendorshouldbeexperienced Length, Unit with building construction and offer upgrades +Item feet [m] Hours Hours Volume as the estimating technology evolves. +Trenches 1½ feet [457mm] deep +OTHER COST FACTORS +Excavate 250 [76] 0.02 5 +Hand grading 250 [76] 0.03 7.5 Most cost estimating assumes certain condi-Backfill 250 [76] 0.004 1 tions in establishing the estimator’s database. +Pipe bedding 250 [76] 0.12 30 +Added labor 250 [76] 0.004 1 Among such assumptions are quality of work, +Compaction 250 [76] 0.005 1.25 standard working hours, general crew produc-3 tivity,sizeofaproject,allotmentofareasonable +Hours +Cubic Yards [m ] 250 [76] 0.08 [0.06] +45.8 +20 [15.3] +Trenches 2 feet [610mm] deep timeframeforconstruction,neworrenovation +Excavate 130 [40] 0.02 2.6 of existing plumbing systems, geographic loca-Hand grading 130 [40] 0.03 3.9 tion of the project, weather, season of the year, contractor management, collective bargaining +Pipe bedding 130 [40] 0.12 15.6 +Backfill 130 [40] 0.005 0.65 +Added labor 130 [40] 0.005 0.65 agreements, utility availability, and general +Compaction 130 [40] 0.005 0.65 business conditions. The size of a job favors +Hours 24.1 larger projects because of economies of scale. +Cubic Yards [m3] 130 [40] 0.11 [0.08] 14.3 [10.93] The location of a job affects shipping costs as well as the market for skilled labor. +Trenches 3 feet [915mm] deep +Excavate 120 [37] 0.03 3.6 +Hand grading 120 [37] 0.04 4.8 For repair work and renovations, consider +Pipe bedding 120 [37] 0.12 14.4 slower work productivity because of limited Backfill 120 [37] 0.008 0.96 physicalaccess,material-handlingrestrictions, more-precisecuttingtomatchexistingsystems, +Added labor 120 [37] 0.008 0.96 +Compaction 120 [37] 0.01 1.2 +25.9 +Hours efforts to protect existing finishes, non-stan- +Cubic Yards [m3] 120 [37] 0.22 [0.17] 26.4 [20.19] dardworkhours,unexpecteddelays,unplanned Total labor hours 95.7 piping offsets, and general economies of scale. +Cubic Yards [m3] 60.7 [46.41] Existing job conditions are probably the most +Adjusted Cu. Yards [m3] (~15%) 69.8 [53.4] common reason for inaccurate estimates. +Labor Rate [$/hr per person] $55/hr +Total labor cost $5265 +For cost-estimating changes to an ongoing Total machine hours 16.9 construction project, other cost factors may be +Machine cost @ $120/hour $2028 necessary to consider even though they may +Haul excavated material @ i $6/cubic yard [$8/m3] $ 364 nothavebeenapplicabletotheoriginalproject. Total $8142 of a planned sequence, the time frame may be office usually has a higher number of fixtures per constricted, or the plumbing change is now +3 +Fill-material cost @ $8/cub c yard [$10/m ] $ 486 +For example, the size may be smaller and out +building area than an ordinary office building. Regu- within a finished space. +lations and probable demand vary with different Inconclusion,costestimatinginvolvesthematch-types of occupancy and will influence infrastructure ing of specific project information with a database requirements. of known construction costs. Variations from the More-precise estimating methods are now avail- database affect the cost estimate, and an appropriate able through computer programs and certain types adjustment is used to arrive at an accurate estimate. of hardware peripherals. While the value of using an The amount of adjustment involves many factors, appropriate database has already been emphasized, fromgeographytojobsize.Theestimator’sexperience several vendors are now addressing entering precise determinesthebestadjustment,whiletheestimator’s counts and lengths. The value of accurate data entry careful examination of the specific project gives the helpsavoidcostlyerrorsandspeedsuptheestimating needed information to match with established unit process. Some peripherals allow the user to overlay costs. Hence, seasoned judgment with tedious review scaled drawings over a digitizing pad so pipes can be oftheprojectdocumentsyieldsapreciseandaccurate +picked at each end and the software accounts for its prediction of plumbing costs. length.Othersoftwareworkswithelectronicversions +of the drawing, and the users highlight each pipe as theyenterkeyinformationsuchasitsdiameter.When thecountsandlengthsofmaterialareaccuratelyand quickly gathered, a more-precise cost estimate can be determined. However, a selected estimating pack-age should address current needs without being too +5 + + + + + +Job Preparation, Drawings, and Field Reports + +A significant portion of time spent on a project is de-voted to communication. While good design practices and accurate engineering analyses are important, it willbeoflittlebenefitifcommunicationfailstoreach the receiver. Hence, effective means are required to assureinformationispassedfaithfullyamongthede-signteam,contractors,andbuildingowner.Inproper preparation of a job, general expectations of the job are established including scope of work, regulatory requirements, specification formats (see Chapter 3), drawing title blocks, and design-team directory. +Thedrawingsarepreparedastheprimarymethod to communicate the design of the plumbing. Then, as constructionproceeds,theengineerprovidesfeedback totheplumbingcontractorafterobservingprogressof the plumbing work. To assist in providing thorough communication, engineering offices frequently use lists to prepare quality documents and to make field observations during construction. +(Note:RefertoChapter1fordefinitionsofterms. Refer to other data book chapters for further design information.) +JOB-PREPARATION GUIDELINES + +3. Contacttheplumbing-codeofficialandfire-protec-tionauthorityhavingjurisdiction.Contactwater, sewer, and gas utilities, and establish connection requirements. +4. Identifyphasingissuesandwhethertherewillbe concurrent occupancy. +5. Review survey and other documents for size, lo-cation, and depth of sanitary and storm sewers, water mains, and gas mains. (Work with civil engineer as well.) +6. Obtain water flow and pressure data (static and residual) at given elevation. Determine if a fire pump and a domestic booster pump are required. Select and size pumps as required. +7. For building alteration or addition, check if existing plumbing services, distribution, and equipment are adequate (capacity and life of systems or equipment), including water heaters, water-treatment equipment, pumps, compres-sors, water meter, backflow preventers, and interceptors. +8. Identify the energy source: gas, electric, steam, hydronic. + +1. Identify relevant codes and standards, including local amendments and date of issue. Relevant issues include: +• Energy and water conservation +• Hot-water production and maintenance • Cross-connection control +• Interceptors +• Clearwater disposal • Rainfall rates +• Secondary drainage +• Storm-water management +• Fire sprinklers and standpipes (occupancy class) +• Fuel gas code +• Medical gases and other healthcare matters +2. Establishdirectoryofprojectteammembers.Or-ganize project schedule with staff availability. + +9. Determineifwatertreatmentisrequired.Obtain water-quality analysis. +10. Determineifthereareunusualoccupancy-related plumbing requirements. +11. Within the limits of the code, determine the architect’s preferred method of cleanout design. +12. Establish and coordinate electrical voltages and phasesformotorsandcontrolswiththeelectrical engineer. +13. Determine the need for other systems, such as compressed air, vacuum, deionized water, acid waste, fuel oil, and steam. +14. Review the cost estimate and time estimate against recent project developments. +100 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +PLUMBING DRAWING GUIDELINES +1. Review elevation of storm and sanitary sewers to determine that gravity flow is feasible or if lift stations are needed. Determine that storm and sanitary drain pipes do not conflict. Consider backwater valves where appropriate. +2. Reviewutilityregulationsandprovidewater-ser-vicerequirements.Provideanapprovedbackflow preventer where required. Provide pressure-re-ducing valves for domestic water systems where the static pressure exceeds 80 psi (550 kPa). +3. Review fire-protection standards and local re-quirements, including class of standpipes and classification of occupancy. Determine water demand,includingflowatrequiredresidualpres-sure. Provide service with an approved backflow preventer or other approved cross-connection control. Select wet, dry, or anti-freeze type sprin-kler system. Special extinguishing systems may be required. +4. Coordinate fire-department-connection location andfire-hydrantrequirementswiththearchitect, site civil engineer, and landscape designer. +5. Review the code-minimum rainfall rate and whether a higher rate should be considered. Size roof drains, conductors, and storm drain accord-ingly. Review secondary drainage requirements and coordinate them with the architect. +6. Determine size and extent of subsoil drainage based on soils report and wall structural require-ments. +7. Reviewstorm-watermanagementissues.Review clearwater disposal restrictions. +8. Send electrical-control and power requirements of plumbing and fire-protection equipment to the electrical engineer. These requirements may include pumps, air compressors, water heaters, watercoolers,heattracing,solenoids,high-water alarms, medical gas alarms and manifolds, fire-sprinkler switches, and fire-alarm bells. Among various pumps consider fire pumps, domestic boosters, circulation pumps, vacuum pumps, sump pumps, and sewage ejectors. +9. Evaluatehot-water-demandrequirements.Select and size water heater, mixing valve, and circu-lation pump. Provide hot-water system with a circulating return unless the distance between the heater and the farthest fixture is relatively short. +10. Determine combustion air requirements for at-mospheric gas-fired water heaters. +11. Address scald-hazard concerns and pathological hazards within the hot-water system. + + +12. Determinewater-treatmentrequirements.Select and size treatment equipment for anticipated oc-cupancy demand and client preferences. +13. Review selection of pipe material for each part of the plumbing system from supply systems to drainsystems.Considerpurityrequirements,cor-rosion issues, fluid temperature, fluid pressure, joiningmethods,hangerspacing,codeissues,and physical protection. +14. Coordinate drawing details with specifications. +15. Review pipe-insulation requirements thermally and acoustically. +16. Review noise and vibration considerations of piping systems and plumbing equipment. Re-view water-hammer requirements. Review noise concerns from rotary vacuum pumps and similar equipment. +17. Consider building-expansion requirements and design concerns that affect tenant-occupancy changes. (Coordinate plumbing-system locations with architect.) +18. Arrange plumbing piping logically while con-sidering obstructions, occupancy restrictions, accessibility,control,futureexpansion,designer’s preferences, other building systems (existing or new),andeconomics.Ingeneral,runpipingclear of structural beams. Where necessary, in consul-tation with the structural engineer, penetrate through the web of steel beams and the middle third of wood or concrete beams. Keep piping out of elevator shafts, electric and data communica-tion rooms, similar restricted rooms, as well as stairsandexitdischargecorridors.Sizepipingfor required supply and drainage fixture units. +19. Provide pipe-expansion loops or expansion joints where required. +20. Provide valves on distribution branches, on branchesoffsupplyrisers,andatthebaseofsup-plyrisers.Providedrainvalveswithhosethreads at the base of risers and in the low portions of piping. +21. Provide hose bibs around the building. Select frost-proof hose bibs if required. Review land-scapeirrigationconnectionpointwhererequired. Confirm if hose bibs are to be key-operated. +22. Note piping elevation changes on plans. Pipes rising within a story should be noted as “rise”. Pipes rising to another story should be noted as “up”. Pipes dropping to another story should be notedas“down”.Pipesatceilingshouldbenoted as “at ceiling” when exposed and “above ceiling” whenconcealed.Pipesunderthefloor,otherthan obvious fixture drain pipes, should be noted as “belowfloor,”“atceilingbelow,”or“aboveceiling below.” +Chapter 5 — Job Preparation, Drawings and Field Checklists 101 + + + +23. Select location and spacing of cleanouts. Confirm compliance with local authority having jurisdic-tion. +24. Locate fire standpipes and hose connections. 25. Locate alarm panels and motor controllers. +26. Locate roof leaders, main stacks, and supply risers. Coordinate wall thicknesses, beam clear-ances, and footing clearances with the architect and structural engineer. +27. Coordinate structural penetrations and house-keeping pads with the architect and structural engineer.Reviewweightofwaterheaterandother equipment with the structural engineer. +28. Selectfixturesandfixturetrim,includingfaucets, shut-off valves, flush valves, carriers, strainers, drains, traps, and wall flanges. Send fixture cut sheets to the architect. Include dimensioned drawings of fixtures and fixture trim. +29. Select sprinkler-head designs including es-cutcheons or covers, finish type or color. Send sprinkler-head cut sheets to the architect. +30. Determine medical gas outlet types, shut-off valve box designs, and alarm panel layouts. Send equipment cut sheets to the architect. Include dimensioned drawings and selection of options. +31. Review plans for mop-basin, drinking fountain, and floor-drain requirements. +32. Provide floor drains for public toilet rooms, at least one floor drain at the lowest floor level of the building, and in pits such as elevator pits. +33. Review and coordinate water-supply connection and drain requirements for: +• Backflowpreventers(adequatedrainforrelief port) +• Beverage machines • Boilers +• Chillers +• Compressors +• Cooling towers +• Cooling coils (drain only) +• Emergency eyewash/shower +• Fire sprinklers and fire pumps +• Food-service areas, including dishwashers, walk-in refrigerators and +freezers, steam kettles, scullery sinks • High-efficiency burners (drain only) • Humidifiers +• Ice machines +• Laboratory equipment • Laundry +• Pressure relief valves (drain only) • Sterilizers +• Vacuum pumps +• Other equipment + +34. Review and coordinate natural-gas connections for water heaters, food-service equipment, and other equipment as required. +35. Select size and design of floor drains and recep-tors to meet requirements. If required, segregate clearwaterwastesfromsanitarywastes.Connect clearwater system to the storm-drain system. +36. Identify infrequently used drains and provide with trap primers. +37. Offset roof drains and vent terminals 12 to 18 inches [0.3 to 0.5 m] away from parapet walls, roof openings, and other roofing elements. +38. Reviewcanopiesandporte-cocheresforadequate drainage. +39. Provide cross-connection control for potable wa-tersupplyconnectionstobuildingequipmentand systems, for all fixtures, and for appurtenances as required. In particular, provide air gaps or approved backflow preventers for connections to boilers and to sprinkler supplies. Provide air gaps for relief ports of backflow preventers, for pressure-relief valves, and generally for fixture faucet outlets. +40. Provide interceptors as required, including sub-soil receivers, exterior-pavement catch basins, garage catch basins, grease interceptors, oil and sand interceptors, laundry interceptors, plaster interceptors,acidandcausticdilutionorneutral-ization basins, and special industrial treatment systems. + +PLUMBING-DRAWINGS CHECKLIST Modify checklist to suit client requirements and the policy of your firm. Initial checked items. Label NA where not applicable. +Plans +1. —— Is it evident that the architectural back- +grounds are current? Check at phases of job or other increments to be established. +2. —— Does the title block have correct format, +proper date, and proper nouns spelled correct-ly? +3. —— Are the drawings legible and of sufficient +scale? +4. —— Are arrangements coordinated so that +drawing sheet index and project-manual table of contentsmatchthefinalsetofdrawingsheetsand the final sections of the plumbing specification, respectively? +5. —— Are more recent requirements coordinated +with the architect, electrical engineer, HVAC engineer, and structural engineer? +102 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +6. —cei—lingDso, spkiypleigshctlse,aarnsdtrculecrteusrtaolrimese?mbers, high +7. s—h—ownD?oAarlel ipnivpeerst sehleovwatsiiozness?shAorwe nfi?xture units + +7. —me—ntsD?oes the fire-riser design meet require- +8. —pla—ns?Are detail references coordinated with the + +8. —— Are valves and cleanouts accessible? Schedules and Specifications + +9. —— Are all fixtures connected to supply, waste, +and vent piping? +10. —— Do toilet rooms have floor drains where +required? Lowest level, elevator pit, and other pits? +11. —— Ispipingkeptoutofelevatorshafts,electric +anddata-communicationrooms,similarrestricted rooms, stairs, and exit-discharge corridors? Are pipes clear of ductwork? +12. —— Are stacks, conductors, and risers within +interior partitions of sufficient thickness? + + +1. —con—sisItsenthteininbcoltuhstiohnedorf afiwxitnugrseas nadntdheeqsupiepcmifiecnat-tions? +2. —ref—ereAnrceedfioxntuprleasnsa, nrdiseerqsu, sipchmeednutlecso, nasnidstsepnetcliy-fications? +3. —he—ad?Are pumps selected for proper flow and +4. w—i—th sIcshveodltualgese,atnhde oetqhueirpemleecnttriscudpaptlaiecro, nasnidstethnet electrical engineer? + + + +13. —— Are ceiling spaces and similar concealed +spaces prone to freezing? +14. —— Is cutting and patching addressed clearly? +15. —— Do roof-drain locations coordinate with +architectural requirements? +16. —— Are drawing notes complete and edited for +the specific job? +17. —— Areplumbingventsspacedsufficientlyfrom +air intakes and operable windows? +18. —— Is the mechanical room coordinated and +well laid out with sufficient access to service equipment, including equipment removal? Are equipment connections and drains coordinated? +19. —— Does the direction of the north arrow agree +with the architect’s plans? Risers and Details +1. —— Are risers legible? Are references, such as +drawing references, room numbers and fixture tags,clearlypresented?Arefixturetrapsoriented correctly? +2. —— Are all vents properly connected? Are vent +stacks, relief vents, and yoke vents shown where required? +3. —— Arepipesizesconsistentbetweenrisersand +plans? +4. —— Are details shown for accessible fixtures, +interceptors, backflow preventers, water heat-ers, water-treatment systems, sump pumps, and sewage ejectors? +5. —— Arepipesupports,sleevesandfire-stopping +systems detailed properly? +6. —— Isthewater-servicedesigndetailedproperly +and coordinated with the utility? + + +5. —— Does the schedule of supply and drainage- +fixture units show the original total, removed total, and new total? +6. —— Isawater-supplyuniform-pressurecalcula- +tionorothersizingmethodincluded?Isthestreet pressure correct? Is the controlling-fixture pres-sure correct? Is the maximum length accurate? +7. —— Do faucets and flush valves meet water- +conservationrequirements?Doesthefixturetrim meet requirements for handle design, strainer design, and spout height? Does the client accept the vendor selection? +8. —— Are legends, symbols, and abbreviations +included? + +FIELD CHECKLIST +Field visits can be broken down into three phases: Underground, rough-in, and final. Important items to observe when visiting a job site are listed as fol-lows and shall be in reference to requirements of the constructiondocuments.Initialobserveditems.Label NA where not applicable. Add comments regarding deficiencies. +Building Drains +1. —— General alignment and conformity to +plans +2. —— Workmanshipofjoints,generalcompactness +of soil below, and around pipe +3. —— General slope of piping +4. —— Spacing and accessibility of cleanouts 5. —— Vent connections +6. —— Branchtobuildingdrainnotconnectednear +base of stack or conductor +7. —— Pipe sleeves and water stopping + +8. —— Pipe sizes and invert elevations +Chapter 5 — Job Preparation, Drawings and Field Checklists 103 + + + +9. —— Manholes,sumps,receivers,greaseintercep- +tors,sandandoilinterceptors,trenchdrains,and other structures; workmanship, specified size, invert elevations, and rim elevations +10. —— Trap-primer connections +11. —— Temporary terminations covered or capped +to prevent entry of foreign material +12. —— Acid-wasteandventpipingandacid-dilution +tank +Water and Gas Services +1. —— Compliance with water-service require- +ments, including service location, pipe depth, thrust blocks, and shut-off valves +2. —— Compliance with natural-gas-service re- +quirements, such as service location and shut-off valves +Above Grade Rough-in +1. —— Compliance with water-service require- +ments such as location, shut-off valves, meters, meter registers, pressure-reducing valves, by-passes,backflowpreventers,pressuregauges,and testing ports +2. —— Compliance with natural-gas-service re- +quirements such as location, shut-off valves, meters,meterregisters,pressure-reducingvalves, vent ports, and bypasses +3. —— Pipingatboosterpumps,waterheaters,and +water-treatment devices + +15. —— Branch to stack offset not connected near +upstream end of offset +16. —— Pipe labeling and valve tags +17. —— Installation of pipe insulation, including +covers over valves and fittings. +18. —— Adequacyofcooling-coil-condensatedrains, +combustion-condensatedrains,relief-valvedrains, and indirect waste pipes; supported properly and air break or air gap as required +19. —— Adequacy of floor slope to floor drains and +floor sinks; rims of indirect waste receptors are elevated to prevent entrance of debris +20. —— Installation of small interceptors +21. —— Vent terminals properly flashed, located +away from air intakes and operable windows +22. —— Motor starters, magnetic and manual +23. —— Connection of plumbing to other building +equipment, including boilers, chillers, cooling towers, air handlers or fan coils, food service, medical,laundry,andsimilarequipment;arrange-ment of piping, valves, cross-connection control, and drainage. +Final +1. —— Adequacy of hot water at remote fixture 2. —— ADA accessibility requirements +3. —— Fixture support +4. —— Water-closet bowl type and seat design + +4. —— Fire-protection-system piping 5. —— Flush-valve performance + +5. —— Medical-gas-system piping, valves, outlets, +panels, and source equipment such as cryogenic systems,high-pressuremanifolds,vacuumpumps, air compressors as well as attendant dew-point and carbon-monoxide monitors, air dryers, and inlet, discharge, or relief piping to the exterior +6. —— Adequacyofsumppumps,sub-soilreceivers, +and sewage ejectors +7. —— Generalalignment,arrangement,andsizes +of piping in conformity to plans +8. —— Workmanship of joints +9. —— Installation of pipe supports, expansion +joints or expansion loops, and pipe swing joints +10. —— Location of valves +11. —— Clearances around pipes within sleeves 12. —— Spacing and accessibility of cleanouts +13. —— Fire stopping at fire walls, fire-rated floors, +and other locations as required +14. —— Vent connections: Close enough to trap to +avoid air lock, above flood level, vertical where required + + +6. —— Strainers and traps +7. —— Faucethandles,outletflowrating,outletair +gap +8. —— Fixture supply-stop location +9. —— Fixturemixing-valvelocationandtempera- +ture setting +10. —— Mop-basin accessories 11. —— Caulking at fixture +12. —— Access panels for valves and cleanouts +13. —— Cross-connection control type, application, +installation, approval, product listing, drainage +14. —— Sprinklerheadsandstandpipehoseconnec- +tions +15. —— Medical-gas valves, outlets, panels 16. —— Owner equipment manuals +17. —— Record drawings and/or as-built drawings +18. —— Training and commissioning +104 + + +COMMENTS: + +ASPE Plumbing Engineering Design Handbook — Volume 1 + + +_________________________________________________________________ +6 + + + + + +Plumbing for People (or Persons) with Disabilities + +INTRODUCTION +The plumbing engineer must be prepared to pro-vide adequate facilities for people with disabilities, whether or not the requirements for these facilities are covered specifically in the local jurisdiction’s ap-plicablecode.MostU.S.plumbingcodestodayinclude some type of provision for people with disabilities. Also, the Americans with Disabilities Act (ADA) of 1990 includes plumbing provisions. The plumbing engineer must determine which codes are applicable to the project he or she is designing and incorporate anyprovisionsthesecodesrequire,inadditiontoADA requirements. +This chapter presents background information onpastandcurrentlegislationaffectingplumbingfor people with disabilities and design requirements for compliance with ANSI A117.1-1998 and the Ameri-cans with Disabilities Act Accessibility Guidelines for Buildings and Facilities (ADAAG), July 26, 1991. Throughout this chapter, there are references to standards and guidelines giving dates of issue. The readermustbesuretoreviewandreferencethelatest editionsofthesedocuments,inaccordancewiththose documents listed and referred to in local codes. +BACKGROUND +Many design and construction features of facilities cause problems for individuals with physical impair-ments. These architectural barriers make it difficult for people with disabilities to participate in educa-tional, employment, and recreational activities. +In1959,ageneralconferencewascalledandthose groups vitally interested in the problem of accessibil-itywereinvitedtoparticipateandberepresented.The attendeesrecommendedtheinitiationofastandards-developmentprojecttostudythecasesandtoprepare a national document. +In 1961, the American Standards Association (now the American National Standards Institute) issuedtheAmericanStandardSpecificationsforMak-ing Buildings and Facilities Usable by the Physically + +Handicapped, ASA A117.1-1961. This document was reaffirmed in 1971 with no changes and redesignated as A117.1-1961 (R1971). In 1998, the standard was renamed Accessible and Usable Buildings and Fa-cilities. +The U.S. Department of Housing and Urban Development (HUD), along with the National Eas-ter Seal Society and the President’s Committee on EmploymentoftheHandicapped(theoriginalco-sec-retariatoftheA117standardscommittee),sponsored two (2) years of research and development to revise the A117.1 standard in 1974. This work (extended to includeresidentialenvironments)resultedinthe1980 version of this standard. The scope of ANSI A117.1-1980 was greatly expanded. Curb ramps, accessible bathroomsandkitchens,andotherelementsofhous-ing were included in the standard; an appendix was addedinordertoassistthedesignerinunderstanding the standard’s minimum requirements; and more illustrations were incorporated. +The standard was also upgraded in 1985, in com-pliance with ANSI standard practice, which requires a review every five years at the minimum. The stan-dard,issuedasANSIA117.1-1986,furtherreinforced the concept that the standard is basically a resource for design specifications and leaves to the adopting, enforcing agency application criteria such as where, when, and to what extent such specifications will ap-ply. Clarification of this “how-to” function of ANSI A117.1-1986 facilitated its referencing in building codes and federal design standards—a major step to-ward achieving uniformity in design specifications. +The technical data contained in ANSI A117.1-1986wereexpandedgreatlytoincorporateadditional elevator and plumbing data as well as, for the first time, specifications for alarm and communications systems for use by individuals with visual or hearing impairments. +The technical data contained in the 1986 issue have been used as the basis of most state and local codes, as well as the Uniform Federal Accessibility +106 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Standard (UFAS) and the U.S. Architectural and TransportationBarriersComplianceBoard(ATBCB) requirements. +As part of an ongoing review process, the A117.1 committeewasreconvenedin1989withtheintention of reissuing the standard in 1990. The magnitude of the changes, both in technical data and in format, resulted in a delay in publication of the standard until December 15, 1992. This standard was the most comprehensive to date and the involvement from disability advocates and interested parties was remarkable. The 1992 standard is now referenced in several model codes and has resulted in improved accessibility in many regards. +In 1995, the A117.1 committee was called again and charged with the task of reviewing the standard for changes. The makeup of the committee had grown to include many disability advocacy groups, model code representatives, and associations—in-cludingtheAmericanSocietyofPlumbingEngineers (ASPE)—and design professionals. The committee worked for more than three (3) years, through three (3) public reviews, examining over 1,000 proposed changes, during 23 days of meetings, to produce the 1998 ANSI A117.1-1998 standard. The 1998 stan-dard has been developed to work in harmony with federal accessibility laws, including the current Fair Housing Accessibility Guidelines and the proposed Americans with Disabilities Act Accessibility Guide-lines (ADAAG). +New provisions for Type B dwelling units are in-tended to provide technical requirements consistent with the Fair Housing Accessibility Guidelines of the U.S. Department of Housing and Urban Develop-ment. HUD is currently in the process of reviewing the 1998 standard to determine equivalency with the guidelines. In addition, the A117.1 committee worked closely with the ADAAG Review Federal Advisory Committee to harmonize the 1998 edition with proposed revisions to ADAAG. The U.S. Archi-tectural and Transportation Barriers Compliance Board(AccessBoard)publisheda“noticeofproposed rule making” in the Federal Register, November 16, 1999. Twenty-five-hundred comments were received for the proposed rule. Until the rule is published in final form and the Federal Department modifies its standardtoreflecttherevisedguidelines,thecurrent standard would be in effect. + +LEGISLATION +In 1969, Public Law 90-480 (known as the Archi-tecturalBarriersActof1968)wassignedbyPresident Lyndon B. Johnson. The main thrust of this legisla-tionwasthatanybuildingconstructed,inwholeorin part, with federal funds must be made accessible to, and usable by, the physically challenged. Public Law + +93-112, known as the Rehabilitation Act of 1973, was passed by the federal government in 1973. +State and municipal governments also began is-suing their own ordinances regarding architectural barriers. These legislative acts were usually modified versionsoftheANSIA117.1document.Atthepresent time,just about every statehasadoptedsomelegisla-tion covering this subject; however, there are major differences from one ordinance to another. Like the federal government, the original legislation usually appliedtogovernment-ownedorgovernment-financed structures,butnowtherequirementsgenerallyapply to all public accommodations. +The Americans with Disabilities Act (ADA) was enacted by the Congress and signed by President GeorgeBushonJuly26,1990.TheADAprohibitsdis-criminationbasedonphysicalormentaldisabilitiesin privateplacesofemploymentandpublicaccommoda-tion, in addition to requiring transportation systems andcommunicationsystemstofacilitateaccessbythe disabled.TheActismodeled,toaconsiderableextent, on the Rehabilitation Act of 1973, which applies to federal grantees and contractors. +The ADA is essentially civil rights legislation, but its implementation has a major impact on the construction industry. In order to clarify construc-tion requirements, the Attorney General’s office commissioned the U.S. Architectural and Trans-portation Barrier Compliance Board (ATBCB) to prepare architectural guidelines to ensure that the construction industry understood what was required in order to comply with the Act. The ATBCB, which is represented on the A117.1 committee, used much of the completed how-to data that was available from A117.1, and where-to data from the ongoing scoping work being done by the Board for Coordination of Model Codes (BCMC), its governmental experiences, and public comments to produce the guidelines com-monly referred to as “ADAAG.” +After incorporating public comments, the “final rule” was issued on July 26, 1991, in the federal reg-ister (28 CFR Part 36) as “Nondiscrimination on the Basis of Disability by Public Accommodations and in Commercial Facilities.” The Act became effective on January26,1992,andappliestoallconstructionwith application for permit after January 26, 1992. This “final rule” preempted state and local laws affecting entities subject to the ADA, to the extent that those lawsdirectlyconflictwiththestatutoryrequirements of the ADA. The attorney general’s office established as a procedure for the certification of state and local accessibility codes or ordinances that they meet or exceed the requirements of the ADA. It was hoped that, with such a certified code enforced by local in-spectors, compliance with ADA would not be decided in the courts. +Chapter 6 — Plumbing for People (or Persons) with Disabilities 107 + + + +In 1994, the ATBCB commissioned a new com-mittee to make recommendations for an improved documenttoreplacethecurrentAmericanswithDis-abilities Act Accessibility Guidelines (ADAAG). This committee met for more than two (2) years to review proposed changes to the document and remove the ambiguities that have been a cause of contention to designers as well as code-enforcement officials. This new committee included 22 members representing: Advocacy groups (American Council of the Blind; Disability Rights Education and Defense Fund, Inc; Eastern Paralyzed Veterans Association; Maryland AssociationoftheDeaf;WorldInstituteonDisability), codeenforcementofficials[VirginiaBuildingandCode OfficialsAssociation;TexasDepartmentofLicensing and Regulation; Southern Building Code Congress International,Inc.(SBCCI);NationalFireProtection Association(NFPA);NationalConferenceofStateson BuildingCodesandStandards;InternationalConfer-enceofBuildingOfficials(ICBO);CouncilofAmerican Building Officials (CABO); Building Officials and Code Administrators International, Inc. (BOCA)], anddesigners[AmericanInstituteofArchitects(AIA), American Society of Interior Designers (ASID)]. The document that came from this committee’s work was presentedtotheATBCBonOctober10,1996.Design professionals must continue to review the ADA in its entirety, and forthcoming revisions, as well as state andlocalcodesforapplicationtotheirprojects.Some states require preapproval of accessible plumbing fixtures. Approval of the fixtures is the responsibility of the fixture manufacturers, but the specifier must specify and approve only those fixtures that have received approval. +There are still a number of concerns regarding whether the established standards properly address thespecificneedsofchildrenandtheelderly.Children cannot necessarily reach fixtures set at established heights for people with disabilities. Also, the elderly may have trouble accessing fixtures set low to meet established height requirements for people with dis-abilities. + +DESIGN +Although plumbing is only a small portion of the overall effort to create a totally barrier-free environ-ment,itisoneofthemostimportantareastobedealt with by engineers. +The following are the various classifications of disabilities: +• Non-ambulatorydisabilities—Thosethatconfine individuals to wheelchairs. +• Semi-ambulatorydisabilities—Thosethatneces-sitate individuals to require the aid of braces, crutches, walkers, or some other type of device in order to walk. + +• Sight disabilities—Total blindness and other types of impairment affecting an individual’s sight. +• Hearing disabilities—Total deafness and other types of impairment affecting an individual’s hearing. +• Coordinationdisabilities—Thosecausedbypalsy due to cerebral, spinal, or peripheral nerve in-jury. +• Aging disabilities—Those brought on by the natural process of aging, which reduces mobility, flexibility, coordination, and perceptiveness in individuals. (Note: To some extent, various na-tionalstandards—e.g.,HUD’sMinimumProperty Standards—differentiatetheelderlyfrom“people with disabilities.”) +The disability classifications that affect the plumbing engineer the most, in terms of design, are thenon-ambulatoryandthesemi-ambulatorygroups. Adequate plumbing facilities must be provided for these individuals. The architect is responsible for analyzing the needs of a person confined to a wheel-chair and those forced to use walking aids such as crutchesandbraces.However,theplumbingdesigner should become familiar with the characteristics of the wheelchair and various associated types of equip-ment. At the present time, there are many variations in wheelchair design available on the market. The specifications in these guidelines are based on adult dimensions and anthropometrics. An illustration of a typical wheelchair design is shown in Figure 6-1 (Refer to Table 6-1 for graphic conventions). +In addition to the dimensions of the wheelchair, the plumbing engineer must take into consideration how wheelchairs are employed and how the person in a wheelchair utilizes plumbing fixtures. +The following information on fixture require-ments for the use of people with disabilities is based on the recommended design criteria contained in the proposedANSIA117.1-1998.A117.1-2003isproposed tobepublishedMayof2004.Forconvenientreference to the ANSI A117.1 text, the corresponding ANSI article numbers have been used (e.g., “601.1” and “602.5”). Illustrations, in most cases, are the same as or similar to those in ANSI A117.1. Therefore, A117.1 figure numbers (such as “Figure B4.15.2.1” and “Figure B4.20.3.1”) have been included with the “Plumbing Engineering Design Handbook” figure numbers. +Explanatory notes have been added after the recommendations for each fixture, where deemed of value. Where there are differences between A117.1 and ADAAG other than of an editorial nature, it is also noted. +108 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + +Table 6-1 +Convention + +Graphic Conventions +Description + + +Typical dimension line showing US customary units (in in.) above the line and SI units (in mm) below. + +Dimensions for short distances indicated on extended line. + +Dimension line showing alternate dimensions required. + +Direction of approach. + +Maximum. + +Minimum. + +Boundary of clear floor area. + +Centerline. + +Note: Dimensions that are not marked “minumum” or “maximum” are absolute, unless indicated otherwise in text or captions. + + + + +US Customary units above line (or to left of line) and SI units below line (or to the right of line) + + + + + + + + + + + + + + + + + + + + + + + + + + +NOTE: Footrests may extend further for tall people +Figure 6-1 Dimensions of Adult-Sized Wheelchairs +Chapter 6 — Plumbing for People (or Persons) with Disabilities 109 + + + + + + + + + + + + + + + + + + + +Figure 6-2 Clear Floor Space +for Wheelchairs +Source: CABO/ANSI A117.1-1992, Reprinted with permission. + +CLEAR FLOOR OR GROUND SPACE FOR WHEELCHAIRS +The minimum clear floor or ground space required to accommodate a single, stationary wheelchair and oc-cupant is 30 inches – 48 inches (760 mm – 1220 mm). (SeeFigure6-2-B4.2.4.1.)Theminimumclearflooror ground space for wheelchairs may be positioned for forward or parallel approach to an object (see Figure 6-3-B4.2.4.2). Clear floor or ground space for wheel-chairs may be part of the knee space required under some objects. One full, unobstructed side of the clear floor or ground space for a wheelchair shall adjoin another wheelchair clear floor space. If a clear floor space is located in an alcove or otherwise confined on all or part of three sides, additional maneuvering clearances shall be provided as shown in Figure 6-4 (B4.2.4.4). +Anthropometrics +Forward reach If the clear floor space only allows forward approach to an object, the maximum high forward reach allowed shall be 48 inches (1220 mm). (SeeFigure6-5-B4.2.5.1.)Theminimumlowforward reachis15inches(380mm).Ifthehighforwardreach is over an obstruction, reach and clearances shall be as shown in Figure 6-6 (B4.2.5.2). +Side reach If the clear floor space allows parallel approach by a person in a wheelchair, the maximum highsidereachallowedshallbe48inches(1220mm), and the low side reach shall be 15 inches (380 mm) (see Figure 6-7-B4.2.6.1). If the side reach is over an obstruction, the reach and clearances shall be as shown in Figure 6-8 (B4.2.6.2). + +PLUMBING ELEMENTS AND FACILITIES1 +601 General +601.1 Scope Plumbing elements and facilities re-quired to be accessible by scoping provisions adopted bytheadministrativeauthorityshallcomplywiththe applicable provisions of this chapter. +602 Drinking Fountains and Water Coolers +602.1General Accessible fixed drinkingfountains and water coolers shall comply with 602. +602.2 Clear floor or ground space A clear floor or ground space complying with 305 shall be pro-vided.2 +602.2.1 Forward approach Where a forward approach is provided, the clear floor or ground space shall be centered on the unit and shall include knee and toe clearance complying with 306.2 +602.2.2 Parallel approach Where a parallel ap-proach is provided, the clear floor or ground space shall be centered on the unit. +602.3Operableparts Operablepartsshallcomply with 309.2 +602.4 Spout height Spout outlets shall be 36 inches(915mm)maximumabovethefloororground. (See Figure 6-9A-B4.15.2.1A.) +602.5 Spout location Units with a parallel ap-proach shall have the spout 3½ inches (89 mm) maximum from the front edge of the unit, including bumpers. Units with a forward approach shall have thespout15inches(380mm)minimumfromthever-tical support and 5 inches (125 mm) maximum from the front edge of the unit, including bumpers. +602.6 Water flow The spout shall provide a flow of water 4 inches (100 mm) high minimum to allow theinsertionofacuporglassundertheflowofwater. The angle of the water stream from spouts within 3 inches (75 mm) of the front of the unit shall be 30 degrees maximum. The angle of the water stream from spouts between 3 inches (75 mm) and 5 inches (125 mm) from the front of the unit shall be 15 de-grees maximum. The angle of the water stream shall be measured horizontally, relative to the front face of the unit. (See Figure 6-10-B4.15.2.3.) +602.7 Protruding objects Units shall comply with 307.2 +Drinking fountain note: +The easiest way for someone in a wheelchair to use a drinking fountain is to approach it from the side and lean to the side to reach the spout. The plumbing engineer should therefore spec-ify a fountain or cooler with a spout located as +110 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + +(a) Forward Approach (b) Parallel Approach + +Figure 6-3 Wheelchair Approaches Source: CABO/ANSI A117.1-1992, Reprinted with permission. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 6-4 Clear Floor Space in Alcoves Source: CABO/ANSI A117.1-1992, Reprinted with permission. +Chapter 6 — Plumbing for People (or Persons) with Disabilities 111 + + + + + + + + + + + + + + + + + + + + +Figure 6-5 Unobstructed Forward Reach Limit Source: CABO/ANSI A117.1-1992, Reprinted with permission. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 6-6 Forward Reach Over an Obstruction Source: CABO/ANSI A117.1-1992, Reprinted with permission. +Note: X = Reach depth, Y = Reach height, Z = Clear knee space. +Z is the clear space below the obstruction, which shall be at least as deep as the reach distance, X. +112 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + +Figure 6-7 Unobstructed Side Reach Limit Figure 6-8 Obstructed Side Reach Limit + +Source: CABO/ANSI A117.1-1992, Reprinted with +permission. + + + + + + + + + + + + + + + + + + +(a) Spout Height and Leg Clearance + +Source: CABO/ANSI A117.1-1992, Reprinted with permission. + + + + + + + + + + + + + + + + + + + +(b) Clear Floor Space + +Figure 6-9 Cantilevered Drinking Fountains and Water Coolers Source: CABO/ANSI A117.1-1992, Reprinted with permission. +Note: Figure 6-9a only: Equipment permitted within dashed lines if mounted below apron. + + +close to the front edge and as low as possible. There are self-contained units available that can be mounted so that spout heights of 33 to 34 inches (839 to 864 mm) can be obtained, with-out interfering with required leg clearances. +Parallel approach units are more diffi-cult to use than the cantilevered type and should be avoided if possible. If used, the +spout should be mounted as close to 30 inches (762 mm) as the fountain will permit. +It is desirable to provide some water coolers or fountains with spout heights of approximately 42 inches (1067 mm) to serve semi-ambulatory users who can have difficulty bending to lower elevations. +Drinking fountains must be provided not only for wheelchair-bound individuals but also for +1 Text source: CABO/ANSI A117.1-1998 2 See CABO/ANSI A117.1-1998 + +back-disabled individuals (ADAAG section 4.1.3, item no. 10, and appendix A4.15.2). Where only one (1) fountain is required by code, it must be an accessible bi-level unit, or two (2) separate accessible units mounted at different heights must be provided. Where more than one (1) foun-tain is required by code, 50 percent must be in-stalled for wheelchair-bound individuals. +603 Toilet and Bathing Rooms +603.1General Accessibletoiletandbathingrooms shall comply with 603. +603.2 Clearances +603.2.1 Wheelchair turning space A wheelchair turning space complying with 304 shall be provided within the room.2 +Chapter 6 — Plumbing for People (or Persons) with Disabilities 113 + + + + + + + + + + + + + + + + + +Figure 6-10 Horizontal Angle of Water +Stream — Plan View +Source: CABO/ANSI A117.1-1992, Reprinted with +permission. +603.2.2Overlap Clearfloororgroundspaces,clear-ancesatfixtures,andwheelchairturningspacesshall be permitted to overlap. +603.2.3 Doors Doors shall not swing into the clear floor or ground space or clearance for any fixture. +EXCEPTION: Where the room is for individual use, and a clear floor or ground space complying with 305.3 is provided within the room beyond the arc of the door swing.2 +603.3 Mirrors Mirrors shall be mounted with the bottom edge of the reflecting surface 40 inches (1015 mm)maximumabovethefloororground.(SeeFigure 6-11-B4.20.3.1.) +603.4 Coat hooks and shelves Coat hooks pro-vided within toilet rooms shall accommodate a for-ward reach or side reach complying with 308.2 Where provided, a fold-down shelf shall be 40 inches (1015 mm) minimum and 48 inches (1220 mm) maximum above the floor or ground. +Toilet and bathing rooms note: +When a door opens into a bathroom, suffi-cient maneuvering space is provided within the room for a person using a wheelchair to enter, close the door, use the fixtures, reopen the door, and exit without undue difficulty. +The wheelchair maneuvering space overlaps the required clear floor space at fixtures and extends under the lavatory 19 inches (480 mm) maxi-mum because knee space is provided. However, because toe or knee space is not available at the toilet, the wheelchair maneuvering space is clear of the toilet. Design and location of floor drains should not impede the use of plumbing fixtures. +Medical cabinets or other methods for storing medical and personal care items are very use- + +ful to people with disabilities. Shelves, drawers, and floor-mounted cabinets should be within the reach ranges of a physically challenged person. +If mirrors are to be used by both ambulatory people and wheelchair users, then they should be 74 inches (1880 mm) high minimum at their top-most edge and 40 inches (1015 mm) maximum at their lowest edge. A single full-length mirror accommodates all people, including children. +604 Water Closets and Toilet Compartments +604.1 General Accessible water closets and toilet compartments shall comply with 604. +604.2Location Thewaterclosetshallbepositioned with a wall or partition to the rear and to one side. The centerline of the water closet shall be 16 inches (405mm)minimumto18inches(455mm)maximum from the side wall or partition, except that the water closet shall be centered in the ambulatory accessible compartment specified in 604.8.2. (See Figure 6-12-B4.18.4.) +604.3 Clearance +604.3.1 Size Clearance around the water closet shall be 60 inches (1220 mm) minimum, measured perpendicularfromthesidewall,and56inches(1420 mm) minimum, measured perpendicular from the rear wall. No other fixtures or obstructions shall be + + + + + + + + + + + + + + + + + + + + + + + + +Figure 6-11 Leg Clearances Source: CABO/ANSI A117.1-1992, Reprinted with permission. +Note: Dashed line indicates dimensional clearance of optional, under-fixture +enclosure. +114 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +604.6Flushcontrols Flushcontrolsshallbehand operated or automatic. Hand-operated flush controls shall comply with 309.2 +604.7 Dispensers Toilet paper dispensers shall comply with 309.4 and shall be 7 inches (180 mm) minimum and 9 inches (230 mm) maximum in front of the water closet.2 The outlet of the dispenser shall be15inches(380mm)minimumand48inches(1220 mm)maximumabovethefloororground.Thereshall beaclearanceof1½inches.(38mm)minimumbelow and12inches(305mm)minimumabovethegrabbar. Dispensersshallnotbeofatypethatcontroldelivery, or that do not allow continuous paper flow. +604.8 Toilet compartments Accessible toilet compartments shall comply with 604.8.1 through 604.8.5. Compartments containing more than one plumbingfixtureshallcomplywith603.Waterclosets in accessible toilet compartments shall comply with +Figure 6-12 Ambulatory Accessible Stall 604.1 through 604.7. + +Source: CABO/ANSI A117.1-1992, Reprinted with permission. +within the water closet clearance. (See Figure 6-13-B4.18.3.1.) +604.3.2 Overlap The clearance around the water closet shall be permitted to overlap the fixture, asso-ciated grab bars, tissue dispensers, accessible routes and clear floor or ground space or clear-ancesatotherfixturesandthewheelchair turningspace.Clearfloorspaceshallcom- +ply with Figure 6-14 (B4.17.2). +604.4 Height The top of water closet seats shall be 17 inches (430 mm) mini-mum and 19 inches (485 mm) maximum above the floor or ground. Seats shall not return automatically to a lifted position. (See Figure 6-15-B4.17.3.) +604.5 Grab bars Grab bars for water closets shall comply with 609. Grab bars shall be provided on the rear wall and on the side wall closest to the water closet. +604.5.1 Side wall Side wall grab bar shall be 42 inches (1065 mm) long mini-mum,12inches(305mm)maximumfrom the rear wall and extending 54 inches (1370 mm) minimum from the rear wall. (See Figure 6-15-B4.17.3.) + + +604.8.1 Wheelchair accessible compartments +604.8.1.1Size Wheelchairaccessiblecompartments shall be 60 inches (1525 mm) wide minimum mea-sured perpendicular to the side wall, and 56 inches (1420mm)deepminimumforwall-hungwaterclosets and 59 inches (1500 mm) deep minimum for floor- + +604.5.2 Rear wall The rear wall grab bar shall be 24 in. (610 mm) long mini-mum,centeredonthewatercloset.Where space permits, the bar shall be 36 in. (915 mm) long minimum, with the additional lengthprovidedonthetransfersideofthe +water closet. (See Figure 6-16-B4.17.4.) Figure 6-13 Wheelchair Accessible Toilet Stalls — Door Swing Out +Source: CABO/ANSI A117.1-1992, Reprinted with permission. +Chapter 6 — Plumbing for People (or Persons) with Disabilities 115 + + + + + + + + + + + + + + + + + + + + + +Figure 6-14 Clear Floor Space at Water Closets Source: CABO/ANSI A117.1-1992, Reprinted with permission. +mounted water closets, measured perpendicular to the rear wall. (See Figure 6-13-B4.18.3.1.) +604.8.1.2 Doors Compartment doors shall not swing into the minimum required compartment area. (See Figure 6-17-B4.18.3.2.) +604.8.1.3 Approach Compartment arrangements shall be permitted for left-hand or right-hand ap-proach to the water closet. +604.8.1.4 Toe clearance In wheelchair-accessible compartments, the front partition and at least one side partition shall provide a toe clearance complying with 306.2 and extending 6 inches (150 mm) deep beyond the compartment-side face of the partition, exclusive of partition support members.2 Toe clearance at the front of the partition is not required in a compartment greater than 62 inches + +(1575 mm) deep with a wall-hung water closet or 65 inches (1650 mm) deep with a floor-mounted water closet. Toe clearance at the side partition is not required in a compartment greater than 66 inches (1675 mm) wide. +604.8.2 Ambulatory-accessible compart-ments Ambulatory-accessible compartments shall be60inches(1525mm)deepminimumand36inches (915 mm) wide. Compartment doors shall not swing into the minimum required compartment area. (See Figure 6-12-B4.18.4.) +604.8.3 Doors Toilet compartment doors shall comply with 404, except that if the approach is to the latch side of the compartment door, the clearance between the door side of the compartment and any obstruction shall be 42 inches (1065 mm) minimum. Thedoorshallbehinged4inches(100mm)maximum from the adjacent wall or partition farthest from the water closet. The door shall be self-closing. A door + + + + + + + + + + + + + + + + + +Figure 6-16 Water Closet — Front View +Source: CABO/ANSI A117.1-1992, Reprinted with permission. + + +pull complying with 404.2.7 shall be placed on both sides of the door near the latch.2 +604.8.4 Grab bars Grab bars shall comply with 609. + + + + + + + + + + + +Figure 6-15 Water Closet — Side View +Source: CABO/ANSI A117.1-1992, Reprinted with permission. + +604.8.4.1 Wheelchair-accessible compartments A side-wall grab bar complying with 604.5.1 shall be provided on the wall closest to the water closet, and a rear-wall grab bar complying with 604.5.2 shall be provided. (See Figure 6-13-B4.18.3.1.) +604.8.4.2 Ambulatory-accessible compartments A side-wall grab bar complying with 604.5.1 shall be provided on both sides of the compartment. (See Figure 6-12-B4.18.4.) +604.8.5 Coat hooks and shelves Coat hooks pro-vided within toilet compartments shall be 48 inches +116 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +(1220 mm) maximum above the floor or ground. Where provided, a fold-down shelf shall be 40 inches (1015mm)minimumand48inches(1220mm)maxi-mum above the floor or ground. +Water closets and toilet compartments note: +The centerline requirement for water closets has been adjusted to allow a range of 16 to 18 inches (407 to 457 mm) from the centerline of the fixture to the side wall, eliminating the fixed 18 inches (457 mm) dimensional requirement. Code enforcement officials in the field have successfully argued this change on the merits of allowing some flexibility. The greater or lesser accessibility of a water closet installed 16 inches (407 mm) from the side wall to the centerline of the toilet versus a water closet in-stalled 18 inches (457 mm) from the side wall has yet to be answered to a majority of either committee. +The toilet seat height of 17 to 19 inches (432 to 483 mm) in public areas is intended to minimize the dif-ference between the seat and the standard wheelchair seat height to aid the transfer process, without elevat-ing the toilet seat to the point that stability problems are created. +The 60 inches (1525 mm) wide wheelchair-ac-cessible compartment is preferred and should be designed. In the design of alterations to existing structures, it may not be possible to create the pre-ferred compartment by combining two existing compartments, or physical conditions may not per-mit the full 60 inches (1525 mm) width. In these cases, the authority having jurisdiction may per-mit a narrower compartment. In no case should a width of less than 48 inches (1220 mm) be used. +The needs of a semi-ambulatory user are best served by a narrower, 36 inches max. (915 mm + +max.), compartment which premises use of grab bars on either or both sides of the compartment. +ADAAG note: +ADAAG has an exception to the height require-ment of water closets and grab bars for water closets located in a toilet room for a single occu-pant, accessed only through a private office and not for common or public use. Where six (6) or more compartments are provided in a toilet room, one (1) must be a 60 inch (1525 mm) wheelchair-accessible compartment, and one (1) must be a +36 inch (915 mm) ambulatory compartment. +The flush valve handles should not exceed 44 inches (1118 mm) above the floor. The handles in standard accessible stalls must be at the wide side of the stall (ADAAG section 4.16.5). This means, depending on how the stall is config-ured, the handle must be on either the right or left side of the flush valve. This does not apply to tank-type units, although several manufacturers have now come up with a right-hand operator. +605 Urinals +605.1 General Accessible urinals shall comply with 605. +605.2 Height Urinals shall be of the stall type or shallbeofthewall-hungtypewiththerimat17inch-es (430 mm) maximum above the floor or ground. +605.3 Clear floor or ground space A clear floor or ground space complying with 305 positioned for forward approach shall be provided.2 +605.4Flushcontrols Flushcontrolsshallbehand operated or automatic. Hand-operated flush controls shall comply with 309.2 +Urinal note: + +It should be understood that the ref-erenced urinal is not intended to be used by a wheelchair occupant for the normal urination process. It is intended for the drainage of bladder bags, a function normally performed in a water closet compartment, if available. Where an accessible urinal is required, it can serve as a child’s +urinal. Urinals must be provided with an elongated rim (ADAAG section 4.18.2). Although ADAAG does not define what constitutes an elongated urinal, the Department of Justice de-ferred to ANSI, which defines these fixtures as having a lip that protrudes +Figure 6-17 Wheelchair Accessible Toilet Stalls — Door Swing In a minimum of 14 in. (356 mm) from +Source: CABO/ANSI A117.1-1992, Reprinted with permission +Chapter 6 — Plumbing for People (or Persons) with Disabilities 117 + + + +the wall. Flush valve handles should not ex-ceed 48 inches (1220 mm) above the floor. +606 Lavatories and Sinks + +607 Bathtubs +607.1 General Accessible bathtubs shall comply with 607. + + + +606.1General Accessiblelavatoriesandsinksshall comply with 606. +606.2 Clear floor or ground space A clear floor or ground space complying with 305.3, positioned for forward approach, shall be provided. Knee and toe clearancecomplyingwith306shallbeprovided.2 (See Figure 6-18-B4.20.3.2.) +EXCEPTIONS: + + +607.2 Clearance Clearance in front of bathtubs shall extend the length of the bathtub and shall be 30 inches (760 mm) wide minimum. A lavatory com-plying with 606 shall be permitted at the foot end of the clearance. (See Figure 6-19-B4.21.2.) Where a permanent seat is provided at the head end of the bathtub, the clearance shall extend a minimum of 15 inches (380 mm) beyond the wall at the head end of the bathtub. + + + +1. Aparallelapproachshallbepermittedtoakitchen sink in a space where a cook-top or conventional range is not provided. + + +607.3Seat Apermanentseatattheheadendofthe bathtub or a removable in-tub seat shall be provided. Seats shall comply with 610. + + + +2. The dip of the overflow shall not be considered in determining knee and toe clearances. + + +607.4Grabbars Grabbarsshallcomplywith607.4 and 609. + + + +606.3Heightandclearances Thefrontoflavato-ries and sinks shall be 34 inches (865 mm) maximum above the floor or ground, measured to the higher of the fixture rim or counter surface. +606.4 Faucets Faucets shall comply with 309.2 Hand-operated, self-closing faucets shall re-main open for 10 seconds minimum. +606.5 Bowl depth Sinks shall be 6½ inches (165 mm) deep maximum. Multiple-compartment sinks shall have at least one compartment complying with this requirement. +606.6Exposedpipesandsurfaces Watersupply and drain pipes under lavatories and sinks shall be insulated or otherwise configured to protect against contact. (See Figure 6-11-B4.20.3.1.) There shall be no sharp or abrasive surfaces under lavatories and sinks. +Lavatories and sinks note: +Conventional slab-type lavatories are available to meet the dimensional requirements of A117.1, since the dip of the overflow can be ignored. +Built-in lavatories in countertops should be placed as close as possible to the front edge of the counter-top to minimize the reach to the faucet. Single-lever faucets are preferred, but where aesthetics or fear of vandalism precludes their use, conventional quar-ter-turn handles are a good choice. Avoid faucets that require finger dexterity for grasping or twisting. +Both hot and cold water pipes, as well as drain pipes that are in the vicinity of the designated clear floor space under the fixture, must be con-cealed or insulated to protect wheelchair users who have no functioning sensory nerves. Insulation is not required on pipes beyond possible contact. + + +607.4.1 Bathtubs with permanent seats For bathtubs with permanent seats, grab bars complying with 607.4.1.1 and 607.4.1.2 shall be provided. +607.4.1.1Backwall Twograbbarsshallbeprovided on the back wall, one complying with 609.4 and the other9inches(230mm)abovetherimofthebathtub. Each grab bar shall be 15 inches (380 mm) maximum fromthehead-endwalland12inches(305mm)maxi-mum from the foot-end wall. + + + + + + + + + + + + + + + +Figure 6-18 Clear Floor Space at +Lavatories and Sinks +Source: CABO/ANSI A117.1-1992, Reprinted with +permission + +607.4.1.2 Foot-end wall A grab bar 24 inches (610 mm)longminimumshallbeprovidedonthefoot-end wall at the front edge of the bathtub. +607.4.2Bathtubswithoutpermanentseats For bathtubs without permanent seats, grab bars com-plying with 607.4.2.1 through 607.4.2.3 shall be provided. +118 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +607.4.2.1Backwall Twograbbarsshallbeprovided on the back wall, one complying with 609.4 and the other9inches(230mm)abovetherimofthebathtub. Each grab bar shall be 24 inches (610 mm) long mini-mumandshallbe24inches(610mm)maximumfrom the head-end wall and 12 inches (305 mm) maximum from the foot-end wall. +607.4.2.2 Foot-end wall A grab bar 24 inches (610 mm)longminimumshallbeprovidedonthefoot-end wall at the front edge of the bathtub. +607.4.2.3 Head-end wall A grab bar 12 inches (305 mm)longminimumshallbeprovidedonthehead-end wall at the front edge of the bathtub. +607.5Controls Controls,otherthandrainstoppers, shallbeonanendwall.Controlsshallbebetweenthe bathtub rim and grab bar, and between the open side of the bathtub and the midpoint of the width of the bathtub. Controls shall comply with 309.4.2 (See Figure 6-20-B4.21.4.) + +607.6 Shower unit A shower spray unit shall be provided, with a hose 59 inches (1500 mm) long minimum, that can be used as a fixed shower head and as a hand-held shower. If an adjustable-height shower head on a vertical bar is used, the bar shall not obstruct the use of grab bars. +607.7 Bathtub enclosures Bathtub enclosures shall not obstruct controls or transfer from wheel-chairs onto bathtub seats or into bathtubs. Bathtub enclosures shall not have tracks on the rim of the bathtub. +Bathtub note: +A fixed seat at the head of the tub adds safety and convenience for transfer purposes, as does the 17 to 19 inches (432 to 483 mm) rim height. The rim height that is more in line with the tub seat does not require the use of a deeper tub; it is better to use a tub with a deeper apron or use a tile filler. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(b) With Seat at Head of Tub +Figure 6-19 Clear Floor Space at Bathtubs Source: CABO/ANSI A117.1-1992, Reprinted with permission +Chapter 6 — Plumbing for People (or Persons) with Disabilities 119 + + + +Duetotheprobablelackofmaneuverabilityoftheuser, it is recommended that the plumbing engineer specify atemperatureand/orpressure-balanced,water-blend-ing valve with temperature-limit stops. +608 Shower Compartments +608.1 General Accessible shower compartments shall comply with 608. +608.2 Size and clearances +608.2.1 Transfer-type shower compart-ments Transfer-type shower compartments shall be 36 inches (915 mm) wide by 36 inches (915 mm) deep inside finished dimension, measured at the centerpoint of opposing sides, and shall have a mini-mum 36 inches (915 mm) wide entry on the face of the shower compartment. The clearance in front of the compartment shall be 48 inches (1220 mm) long minimum measured from the control wall and 36 + +inches (915 mm) wide minimum. (See Figure 6-21-B4.22.2.1.) +608.2.2 Standard roll-in type shower compart-ments Roll-in type shower compartments shall be 30 inches (760 mm) wide minimum by 60 inches (1525 mm) deep minimum, clear inside dimension, measured at the centerpoint of opposing sides and shallhaveaminimum60inches(1220mm)wideentry on the face of the shower. A 30 inches (760 mm) wide minimum by 60 inches (1525 mm) long minimum clearanceshallbeprovidedadjacenttotheopenfaceof the shower compartment. A lavatory complying with 606 shall be permitted at the end of the clear space, oppositetheshower-compartmentsidewhereshower controls are positioned. (See Figure 6-22-B4.22.2.2.) +608.2.3 Alternate roll-in type shower compart-ments Alternateroll-inshowercompartmentsshall + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(b) With Permanent Seat at Head of Tub +Figure 6-20 Bathtub Accessories Source: CABO/ANSI A117.1-1992, Reprinted with permission +120 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +be 36 inches (915 mm) wide and 60 inches (1220 mm) deepminimum.A36inches(915mm)wideminimum entry shall be provided at one end of the long side of the compartment. The shower unit and controls shall be mounted on the end wall farthest from the compartment entry. +608.3Grabbars Grabbarsshallcomplywith608.3 and 609 and shall be provided. +608.3.1 Transfer-type showers Grab bars shall be provided across the control wall and on the back wall to a point 18 inches (455 mm) from the control wall. (See Figure 6-23A-B4.22.4A.) +608.3.2 Roll-in type showers Grab bars shall be providedonthethreewallsoftheshower.(SeeFigure 6-23B-B4.22.4B.) Grab bars shall be 6 inches (150 mm) maximum from the adjacent wall. +EXCEPTIONS: Figure 6-21 Transfer Type Shower Stall +1. Where a seat is provided in a roll-in shower, grab Source: CABO/ANSI A117.1-1992, Reprinted with permission bars shall not extend over the seat at the control +wall and shall not be behind the seat. +2. In alternate roll-in type showers, grab bars shall not be required on the sidewall +opposite the control wall and shall not be behind the seat. + +608.4 Seats An attachable or integral seat shall be provided in transfer-type shower compartments. Seats shall comply with 610. +608.5Controls Showerorbathtub/showerfacilities shalldeliverwaterthatisthermal-shockprotectedto 120°F (49°C) maximum. Faucets and controls shall comply with 309.4.2 Controls in roll-in showers shall be above the grab bar but no higher than 48 inches (1220mm)abovetheshowerfloor.(SeeFigure6-23B-B4.22.4B.) In transfer type shower compartments, controls, faucets, and the shower unit shall be on the side wall opposite the seat 38 inches (965 mm) minimum and 48 inches (1220 mm) maximum above the shower floor. (See Figure 6-23A-B4.22.4A.) +608.6 Shower unit A shower spray unit shall be provided, with a hose 59 inches (1500 mm) long minimum, that can be used as a fixed shower head and as a hand-held shower. In transfer-type showers, the controls and shower unit shall be on the control wall within 15 inches (380 mm), left or right, of the centerline of the seat. In roll-in type showers, shower spray units mounted on the back wall shall be 27 inches (685 mm) maximum from the side wall. If an adjustable-height shower head mounted on a verti-cal bar is used, the bar shall not obstruct the use of grab bars. +608.7Thresholds Showercompartmentthresholds shall be ½ inches (13 mm) high maximum and shall comply with 303.2 + + + + + + + + + +Figure 6-22 Roll-in Type Shower Stall Source: CABO/ANSI A117.1-1992, Reprinted with permission + +608.8 Shower enclosures Shower compartment enclosures for shower compartments shall not ob-struct controls or obstruct transfer from wheelchairs onto shower seats. +Shower compartments note: +The recommended shower compartments are for independent use by an individual. Compart-ments between the two recommended sizes do not effectively serve people with disabilities who wish to use a shower without assistance. +Transfer-type shower compartments that are 36 inches by 36 inches (915 mm by 915 mm) provide additional safety to people who have difficulty maintaining balance because all grab bars and walls are within easy reach. Seated people use the walls of these showers for back support. +Chapter 6 — Plumbing for People (or Persons) with Disabilities 121 + + + +The shower compartment with inside finish dimen-sions of 36 inches by 36 inches (915 mm by 915 mm) has been designated a transfer-type compart-ment to indicate that wheelchair users can trans-fer from their chair to the required seat. These dimensions will allow a person of average size to reach and operate the controls without difficulty, while providing reasonable knee space for larger users. A transfer-type shower is also intended to serve persons without disabilities so a folding seat would provide more space for a standing person. Temperature may be limited to 105 to 110°F (40.5 to 43°C), depending on local code requirements. +609 Grab Bars +609.1 General Grab bars in accessible toilet or bathing facilities shall comply with 609. + +609.2 Size Grab bars shall have a circular cross section with a diameter of 1¼ in. (32 mm) minimum and 2 inches (51 mm) maximum, or shall provide equivalent grasp ability complying with 505.7.1.2 +609.2.1 Noncircular cross sections Grab bars with other shapes shall be permitted, provided they haveaperimeterdimensionof4inches(100mm)min-imum and 4.8 inches (160 mm) maximum and edges having an 8 inches (3.2 mm) minimum radius. +609.3 Spacing The space between the wall and the grab bar shall be 1½ inches (38 mm). The space between the grab bar and objects below and at the endsshallbe1½inches(38mm)minimum.Thespace between the grab bar and projecting objects above shall be 15 inches (355 mm) minimum. (See Figure 6-24-B4.24.2.1.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 6-23 Grab Bars at Shower Stalls Source: CABO/ANSI A117.1-1992, Reprinted with permission +Note: Figure 6-23b: Shower head and control area may be on back wall (as shown) or on either side wall. +122 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +EXCEPTION: The space between the grab bars and shower controls, shower fittings, and other grab bars above shall be 1½ inches (38 mm) minimum. +609.4 Position of grab bars Grab bars shall be mountedinahorizontalposition,33inches(840mm) minimum and 36 inches (915 mm) maximum above the floor. + + + + + + + + + + + + + + + +Figure 6-24 Size and Spacing of +Grab Bars +Source: CABO/ANSI A117.1-1992, Reprinted +with permission + + +EXCEPTION: Height of grab bars on the back wall of a bathtub shall comply with 607.4.1.1 and 607.4.2.1. +609.5Surface hazards Grab bars and any wall or other surfaces adjacent to grab bars shall be free of sharporabrasiveelements.Edgesshallhavearadius of 8 inches (3 mm) minimum. +609.6 Fittings Grab bars shall not rotate within their fittings. +609.7 Installation Grab bars shall be installed in any manner that provides a gripping surface at the locations specified in this standard and that does not obstruct the clear floor space. +609.8 Structural strength Allowable stresses in bending, shear, and tension shall not be exceeded for materials used where a vertical or horizontal force of 250 pounds (113.5 kg) is applied at any point on the grab bar, fastener mounting device, or supporting structure. +Grab bars note: +Many people with disabilities rely heavily upon grab bars to maintain balance and prevent serious falls. Many people brace their forearms between supports and walls to give them more leverage and stability in maintainingbalanceorforlifting.Thegrabbarsclear-ance of 1½ inches (38 mm) required in this standard + +is a safety clearance to prevent injuries from arms slipping through the opening. This clearance also provides a minimum space for gripping. +Grab bars that are wall mounted do not affect the measurement of required clear floor space where the space below the grab bar is clear and does not present a knee space encroachment. +610 Seats +610.1 General Seats in accessible bathtubs and shower compartments shall comply with 610. +610.2Bathtubseats Aremovablein-tubseatshall be 15 inches (380 mm) minimum and 16 inches (405 mm) deep maximum, and shall be capable of secure placement. A permanent seat shall be 15 inches (380 mm) deep minimum and be positioned at the head end of the bathtub. The top of the seat shall be 17 inches (430 mm) minimum and 19 inches (485 mm) maximum above the bathroom floor. +610.3 Shower compartment seats Where a seat isprovidedinaroll-inshowercompartment,itshallbe a folding type and shall be on the wall adjacent to the controls. Seats shall be L-shaped or rectangular. The top of the seat shall be 17 inches (430 mm) minimum and 19 inches (485 mm) maximum above the bath-room floor. In a transfer-type shower, the seat shall extend from the back wall to a point within 3 inches (75 mm) of the compartment entry. In a roll-in type shower, the seat shall extend from the control wall to a point within 3 inches (75 mm) of the minimum required seat wall width. +610.3.1Rectangularseats Therearedgeofarect-angular seat shall be 2½ inches (64 mm) maximum from the seat wall, and the front edge 15 inches (380 mm) minimum and 16 inches (405 mm) maximum from the seat wall. In a transfer-type shower, the side edge of a rectangular seat shall be 1½ inches (38 mm) maximum. In a roll-in type shower, the side edgeofarectangularseatshallbe1½inches(38mm) maximum from the control wall. +610.3.2 L-shaped seats The rear edge of an L-shaped seat shall be 2½ in. (64 mm) maximum from the seat wall, and the front edge 15 inches (380 mm) minimum and 16 inches (405 mm) maximum from the seat wall. The rear edge of the “L” portion of the seat shall be 1½ inches (38 mm) maximum from the wall and the front edge shall be 14 inches (355 mm) minimum and 15 inches. (380 mm) maximum from the wall. The end of the “L” shall be 22 inches (560 mm) minimum and 23 inches (585 mm) maximum from the main seat wall. (See Figure 6-25-B4.22.3.) +610.4 Structural strength Allowable stresses in bending, shear, and tension shall not be exceeded for materials used where a vertical or horizontal force of +Chapter 6 — Plumbing for People (or Persons) with Disabilities 123 + + + +250 lb (113.5 kg) is applied at any point on the seat, fastener mounting device, or supporting structure. +Seats note: +The seat in a shower is required to be nearly the full depth of the compartment; it should be as close to the front edge of the seat wall as possible to minimize the distance between the seat and the wheelchair so as to facilitate a transfer. The seat wall must be free of grab bars to allow a person to slide onto the seat, and a portion of the adjacent back wall must be without a grab bar so the person’s back can be placed against the walls for support. +611 Laundry Equipment +611.2 Clear floor or ground space A clear floor or ground space complying with 305 positioned for parallelapproachshallbeprovided.Theclearflooror ground space shall be centered on the appliance.2 + +REFERENCES +1. ADAAG Review Federal Advisory Committee. September30,1996.Recommendationsforanew ADAAG. + +2. Council of American Building Officials (CABO)/ International Code Council, Inc. 1998 [1992]. CABO/ANSIA117.1,Accessibleandusablebuild-ings and facilities. Falls Church, Va. + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 6-25 Shower Seat Design Source: CABO/ANSI A117.1-1992, Reprinted with permission + +611.3 Operable parts Operable parts, including doors, lint screens, detergent and bleach compart-ments, shall comply with 309.2 +611.4Height Top-loadingmachinesshallhavethe doortothelaundrycompartment34inches(865mm) maximum above the floor or ground. Front-loading machines shall have the bottom of the opening to the laundry compartment 15 inches (380 mm) minimum and 34 inches (865 mm) maximum above the floor or ground. +124 ASPE Plumbing Engineering Design Handbook — Volume 1 +7 + + + + + +Energy and Resource Conservation in Plumbing Systems + +INTRODUCTION +Priortothe1973-1974OPECoilembargo,energywas considered inexhaustible and expendable. As energy costsgrew,societyturneditsattentiontowardenergy conservation. The Energy Policy and Conservation Act (EPCA) of 1975 was the first major piece of leg-islation that addressed federal energy management. Additional laws soon followed such as: The Resource ConservationandRecoveryActof1976,theNational Energy Conservation Policy Act of 1978, the Federal Energy Management Improvement Act (FEMIA) of 1988, and the Energy Policy Act (EPACT) of 1992 that expanded upon the EPCA of 1975. Along with thefederalgovernment,othersectorsofsocietymade strides to reduce energy consumption. The automo-tive industry, which was heavily impacted by the oil embargo, was quick to adapt by producing smaller, lighter,morefuel-efficientcars.Theconstructionmar-ketalsomadestridesbyadoptingmodelenergycodes, efficiency standards, and alternate fuel sources. One of the highest energy-consuming plumbing systems is domestic hot water, often consuming 2 percent to 4 percent of the total energy used in an office building and 8 percent of residential properties. This plumb-ing system has a great need for energy-conservation measures. +Just as important as energy conservation is re-source conservation. A resource greatly affected by plumbing-systemdesigniswatermanagement.Water useintheUnitedStateshasmorethandoubledinthe past half-century from approximately 180 billion gal-lons per day in 1950 to more than 400 billion gallons adayin1995.Ithasbeendeterminedthat39percent of water use in commercial buildings is for domestic purposes.Itisimportanttonotethatbyreducinghot water use both energy and water is conserved. +This chapter is intended to provide a plumbing engineer with design techniques that conserve both energy and water and assist them in selecting energy and water-efficient equipment and systems. Where the recommendations set forth in this chapter do not + +meet the minimum provisions of the local code, the code shall apply. +DOMESTIC HOT WATER SYSTEM ENERGY CONSERVATION +Design Techniques +Hot water use can vary from hand washing, shower-ing, and janitorial needs, to cooking, dishwashing, and laundering needs. Design techniques that can be employed to conserve energy when creating hot water are: +1. Eliminate Leaks +2. Reduce Domestic Hot Water Temperature 3. Reduce Fixture Flow Rates +4. Apply Economical Thermal Insulation +5. Limit Water-Heater and Circulation-Pump Op-eration +6. Consume Off-Peak Power +7. Upgrade to More Efficient Equipment 8. Water Heater Location +1. Eliminate Leaks +One of the first and easiest actions to take to conserve energy is repairing leaky faucets and hot water piping. This will reduce the amount of hotwaterbeingwastedandavoidmoreexpensive repairs later due to faucet valve-stem and valve-seat corrosion and water damage from leaky piping. + +2. Reduce Domestic Hot Water Temperature +Many domestic water-heating systems are designed to deliver 140°F water based on the anticipated needs of kitchen and janitorial uses, though water for human contact is normally deliveredat105°F.Often105°Fwaterisproduced by blending 140°F hot water with cold water (see ASPE’s Plumbing Engineering Design Handbook Chapter “Domestic Water Heating +126 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +System Fundamentals”). While this reduces the amountofhotwaterrequireditdoesnotdecrease the energy required to heat the water. Many energy codes and standards for new buildings require the domestic hot water system be set at 110°F under the impression that this will automatically reduce energy in direct proportion to the reduced temperature differential (delta T). It is important to note that setting a water heater below 120°F to avoid blending may allow Legionella bacteria to grow inside the domestic hot water tank. Also, if the building is provided withakitchendishwasherrequiring180°Fwater, a booster heater will need to be sized carefully to adequatelyfunctionattheincreaseddeltaT.This is due to the reduction of the building domestic water-system temperature. +The temperature, after mixing two or more volumes (or flows) of water is calculated using the following equation: +Equation 7-1 +Q1 × t1 + Q2 × t2 m Q1 + Q2 +t = +where: +tm = Temperature of mixture t1 = Temperature of flow Q1 t2 = Temperature of flow Q2 +Q1 =Cold water, gpm (L/s) Q2 =Hot water, gpm (L/s) +Example 7-1 +Whatisthetemperatureof45gpm(2.84 L/s)of155°F (68.5°C) water mixed with 55 gpm (3.47 L/s) of 75°F (23.9°C) water? +45 × 155 + 55 × 75 = 111°F in SI units: +45 + 55 += 44°C +( ) +2.84 × 68.5 + 3.47 × 23.9 +2.84 + 3.47 +The ratio (%) of hot water required to be mixed with cold water to provide a mixed water requirement is determined using the following equation: +Equation 7-2 + +Ratio HW = t2 − t1 Example 7-2 +t − t +m 1 +(A) How much hot water is required to provide 80 gph (0.084 L/s) of 110°F (43°C) mixed water with 155°F (68.5°C) hot water and 75°F (23.9°C) cold water? +110 − 75 +155 − 75 = .44 or 44% hot water +80 gph × 0.44 = 35 gph of 155°F hot water +(0.084 L/s × 0.44 = 0.037 L/s of 68.5°C hot water) + +(B) How much hot water is required to provide 80 gph (0.084 L/s) of 110°F (43°C) mixed water with 125°F (51.5°C) hot water and 75°F (23.9°C) cold water? +125 − 75 = .70 or 70% hot water +110 − 75 +80 gph × 0.70 = 56 gph of 125°F hot water (0.084 L/s × 0.70 = 0.059 L/s of 51.5°C hot water) + +As shown, the reduction in domestic-water tempera-ture,initself,doesnotnecessarilyresultinareduction in energy input related to the water consumed. +3. Reduce Fixture Flow Rates +The Energy Policy Act (EPACT) of 1992 set maximum water usages for specific fixtures (e.g. 1.6 gallons per flush for water closets). Reduced flow rates result in less water needing to be pumped and heated, smaller pipe sizes, and less heatlossfrompiping,consequentlysavingenergy. Fixtureflowratesvarydependinguponthesupply fittingdesignandwaterpressure.Manufacturers’ test results have shown that flows for lavatories and showers can be quite high, making them prime candidates for fixture-flow reduction. Providing automatic flow-control fittings can reduce fixture flow rates. On lavatories the type of faucet and spout usually dictates the location of these fittings. In showers, the type of head and arm determines the fitting location. After being fitted with a flow-control device, reduced flow rates of one gallon per minute or less are usually seen in lavatories and 3 gallons per minute or less for showers. +Figure 7-1 provides a way to translate fixture flow rate to annual consumption and is useful in determining the most energy efficient design flow rate. By varying the percent of hot water at the fixture, annual energy consumption can be predicted. + +Example 7-3 +Faucet use at 3.25 gal (12.3 L) of 150°F (66°C) hot water per day with a 100% faucet flow rate equates to an annual energy use of 800 × 103 Btu (844 × 103 kJ) per year. A 67% flow rate reduces energy use to 475 × 103 Btu (507 × 103 kJ) per year, and a 33% flow rate reduces energy use to 225 × 103 Btu (237.4 × 103 kJ) per year or a 62% reduction from full faucet flow rate. +Figure 7-1 can be used as a design tool for many purposes, some of which are to predict energy consumption, anticipated utility costs, and payback calculations for fixture replacement. +Manufacturers of flow-control devices describe in greater detail their design and installation requirements. The installation of this water- +Chapter 7 — Energy and Resource Conservation in Plumbing Systems 127 +FAUCET FLOWRATE + + +protection against burns, reduction of noise, and controlofcondensation.TheNationalInsulation Contractors’ Association (NICA) is currently using and promoting a computer program called “Economic Thickness of Insulation” (ETI). This program determines the cost-effective insulation thickness for a project and allows the designer to factor in the effects of rising utility costs. +1 +5 +0 +° +F +H +O +T +WWW +T +AA +E +R +T +E +M +P +140°F +130°F +120°F +110°F +ANNUAL ENERGY USE PER YEAR +(×106 BTU) +Energy savings, in BTUs, can be determined by the following formula: +Equation 7-3 +S = g × L + + +▲ +▲▲ +VOLUME USED PER DAY +(GAL) + +where: +S = Energy savings, Btu/h (kJ/h) +g = Factors taken from Table 7-1 or 7-2 at a particular ∆T, Btu/h/ft (kJ/h/m) +L = System length, ft (m) +Hotwaterpipesshouldbecontinuouslyinsulated from the heater to the end use, while cold water lines should be insulated near the water heater tank to minimize convective losses. + + + + + + + + + + + + + + +Chart allows user to estimate domestic hot water heating use in terms of water temperature and faucet flow rate. +Figure 7-1 Energy Savings from +Reduced Faucet Flow Rates Source: Cassidy 1982. + +conserving device has resulted in the savings of millions of gallons of water per year throughout the country. This reduction in water demand translates into water the local utility company doesnothavetopump,thepurificationplantdoes not have to handle and process, and the waste-treatment plant does not have to treat. + +4. Apply Economical Thermal Insulation Economical thermal insulation is the amount of insulation that annually produces the lowest sum of energy lost versus the annual cost of insulation(seethe“PipingInsulation”chapterof ASPE’sPlumbingEngineeringDesignHandbook for the proper selection criteria). In addition to conserving energy by retarding heat loss, insulation provides such additional benefits as + +5. Limit Water-Heater and Circulation-Pump Operation +Buildings with large hot water distribution systemsusecirculatingloopstoensurehotwater isavailabletoallfixtureswithinatimelymanner. Bylimitingthehoursofoperationofthesepumps and water heaters, substantial savings can be realized. There are 113 hours of “off” time per week in a building if it is occupied 50 hours per week, and the system is brought up to operating temperature one hour prior to the building opening each day. Assuming the domestic hot water system can be shut off for 113 hours per week and the system contains 2,000 gallons of hot water, Table 7-3 indicates the energy saved by limiting the hours of circulation. However, if a fossil-fuel water heater is used, one must take intoaccounttheformationofcondensationwhen the system is brought up to temperature. + +Table 7-3 The Effect of Stopping Circulation +Piping Operating Insulation +Temperature, Thickness, Energy Conserved, °F (°C) in. (mm) Btu/yr (kJ/yr) +140 (60) ½ (12.7) 1428 × 106 (1506.5 × 106) 125 (51.5) ½ (12.7) 1153 × 106 (1216 × 106) 110 (43) ½ (12.7) 824 × 106 (869.3 × 106) 140 (60) 1 (25.4) 934 × 106 (985.4 × 106) 125 (51.5) 1 (25.4) 714 × 106 (753.3 × 106) 110 (43) 1 (25.4) 522 × 106 (550.7 × 106) + +Time clocks can be used to control the hot water circulating pumps. The energy saved when using time clocks can be calculated as follows: +128 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 7-1 Energy Savings Chart for Steel Hot Water Pipes and Tanks + +∆T °F (°C) + + +40 (4.4) 45 (7.2) 50 (10.0) 55 (12.8) 60 (13.6) 65 (18.3) 70 (21.1) 75 (23.9) 80 (26.7) 85 (28.4) 90 (32.2) 95 (35.0) 100 (37.8) +105 (38) 110 (43) 115 (46) 120 (49) + + + +½ (12.7) +14 (48.44) 16 (55.36) 18 (62.28) 20 (69.20) 23 (79.58) 25 (86.50) 28 (96.88) 30 (103.8) 33 (114.2) 36 (124.6) 38 (131.5) 42 (145.3) 45 (155.7) 47 (162.6) 51 (176.5) 54 (186.8) 56 (193.8) + + + +¾ (19.1) +17 (58.8) 20 (69.2) 22 (76.1) 25 (86.5) 28 (96.9) 31 (107.3) 34 (117.6) 36 (124.6) 41 (141.9) 44 (152.2) 47 (162.6) 51 (176.5) 54 (186.8) 58 (200.7) 62 (214.5) 65 (224.9) 69 (238.7) + + +Pipe Size, in. (mm) +1 1¼ 1½ (25.4) (31.8) (38.1) +21 (72.7) 26 (90.0) 29 (100.3) 24 (83.0) 30 (103.8) 33 (114.2) 27 (93.4) 34 (117.6) 38 (131.5) 31 (107.3) 38 (131.5) 42 (145.3) 35 (121.1) 42 (145.3) 48 (166.1) 38 (131.5) 47 (162.6) 53 (183.4) 42 (145.3) 52 (179.9) 58 (200.7) 46 (159.2) 56 (193.8) 64 (221.4) 50 (173.0) 61 (211.1) 69 (238.7) 54 (186.8) 67 (231.8) 74 (256.0) 58 (200.7) 72 (249.1) 80 (276.8) 62 (214.5) 77 (266.4) 86 (297.6) 66 (228.4) 82 (283.7) 93 (321.8) 72 (249.1) 87 (301.0) 98 (339.1) 75 (259.5) 93 (321.8) 104 (359.8) 80 (276.8) 98 (339.1) 110 (380.6) 85 (294.1) 104 (359.8) 117 (404.8) + + + +2 (50.8) +35 (121.1) 41 (141.9) 47 (162.6) 52 (179.9) 58 (200.7) 65 (224.9) 71 (245.7) 78 (269.9) 84 (290.6) 91 (314.9) 98 (339.1) 105 (363.3) 113 (391.0) 120 (415.2) 128 (442.9) 135 (467.1) 143 (494.8) + + + +2½ (63.5) +42 (145.3) 48 (166.1) 55 (190.3) 62 (214.5) 69 (238.7) 77 (266.4) 84 (290.6) 91 (314.9) 99 (342.5) 107 (370.2) 116 (401.4) 124 (429.0) 133 (460.2) 141 (487.9) +150 (519) 159 (550.1) 169 (584.7) + + +Hot Water Tanks, Btu/h/ft2 (kJ/h/m2) w/ w/o +Insulation Insulation +6 (68.1) 57 (647.3) 6 (68.1) 65 (738.2) 7 (79.5) 73 (829.1) 7 (79.5) 83 (942.6) 9 (102.2) 92 (1044.8) 9 (102.2) 102 (1158.4) 10 (113.6) 112 (1272.0) 11 (124.9) 122 (1385.6) 11 (124.9) 132 (1499.1) 12 (136.3) 142 (1612.7) 12 (136.3) 154 (1749.0) 14 (159.0) 164 (1862.5) 14 (159.0) 175 (1987.5) 15 (170.4) 187 (2123.8) 16 (181.7) 198 (2248.7) 16 (181.7) 210 (2385.0) 17 (193.1) 222 (2521.3) + +Source: San Diego Gas & Electric Co. Notes: +1. Savings are in Btu/h/linear ft. (kJ/h/linear m), unless otherwise indicated. 2. Figures are based on an assumption of 1 in. (25.4 mm) of insulation. +3. ∆T = to – ta where to = Hot water circulating temperature and ta = Air temperature surrounding piping system. + +Table 7-2 Energy Savings Chart for Copper Hot Water Pipes + +∆T °F (°C) + +40 (4.4) 45 (7.2) 50 (10.0) 55 (12.8) 60 (13.6) 65 (18.3) 70 (21.1) 75 (23.9) 80 (26.7) 85 (29.4) 90 (32.2) 95 (35.0) 100 (37.8) +105 (38) 110 (43) 115 (46) 120 (49) + + +½ (12.7) +8 (27.68) 10 (34.6) 12 (41.5) 13 (45.0) 15 (51.9) 16 (55.4) 18 (62.3) 20 (69.2) 21 (72.7) 22 (76.1) 24 (83.0) 26 (90.0) 28 (96.7) 30 (103.8) 32 (110.7) 34 (117.6) 36 (124.6) + + +¾ (19.1) +12 (41.5) 13 (45.0) 15 (51.9) 17 (58.8) 20 (69.2) 21 (72.7) 24 (83.0) 26 (90.0) 28 (96.7) 31 (107.3) 33 (114.2) 36 (124.6) 38 (131.5) 41 (141.9) 43 (148.8) 46 (159.2) 49 (169.5) + + +1 (25.4) +14 (48.4) 16 (55.5) 19 (65.7) 21 (72.7) 24 (83.0) 27 (93.4) 30 (103.8) 33 (114.2) 35 (121.1) 38 (131.5) 41 (141.9) 44 (152.2) 48 (166.1) 51 (176.5) 54 (186.8) 57 (197.2) 61 (211.1) + + +Pipe Size, in. (mm) 1¼ 1½ (31.8) (38.1) +17 (58.8) 20 (69.2) 20 (69.2) 23 (79.6) 23 (79.6) 26 (90.0) 26 (90.0) 30 (103.8) 29 (100.3) 34 (117.6) 32 (110.7) 37 (128.0) 35 (121.1) 41 (141.9) 39 (134.9) 44 (152.2) 42 (145.3) 49 (169.5) 45 (155.7) 53 (183.4) 49 (169.5) 57 (197.2) 53 (183.4) 61 (211.1) 57 (197.2) 65 (224.9) 60 (207.6) 70 (242.2) 65 (224.9) 74 (256.0) 68 (235.3) 78 (269.9) 72 (249.1) 83 (287.2) + + +2 (50.8) +25 (86.5) 29 (100.3) 33 (114.2) 38 (131.5) 42 (145.3) 47 (162.6) 52 (180.0) 56 (193.8) 61 (211.1) 66 (228.4) 71 (245.7) 76 (263.0) 82 (283.7) 87 (301.0) 93 (321.8) 98 (339.1) +104 (359.8) + + +2½ (63.5) +30 (103.8) 35 (121.1) 40 (138.4) 45 (155.7) 51 (176.5) 56 (193.8) 62 (214.5) 67 (231.8) 73 (252.6) 79 (273.3) 85 (294.1) 91 (314.9) 98 (339.1) 104 (359.8) 111 (384.1) 118 (408.3) 125 (432.5) + + +3 (76.2) +35 (121.1) 40 (138.4) 46 (159.2) 52 (179.9) 58 (200.7) 65 (224.9) 71 (245.7) 76 (263.0) 85 (294.1) 92 (318.3) 99 (342.5) 106 (366.7) 113 (391.0) 121 (418.7) 128 (442.9) 136 (470.6) 144 (498.2) + +Source: San Diego Gas & Electric Co. Notes: +1. Savings are in Btu/h/linear ft (kJ/h/linear m). +2. Figures are based on an assumption of 1 in. (25.4 mm) of insulation. +3. ∆T = to – ta where to = Hot water circulating temperature and ta = Air temperature surrounding piping system. + +Equation 7-4 +Motor kW × off hours × electric rate ($/kWh) = total savings ($) + +6. Consume Off-Peak Power +One of a plumbing engineer’s responsibilities is to size the domestic water-heating equipment to meet the needs of the building’s occupants in the most energy efficient manner. While using off-peak power to heat and circulate water does not change the number of British thermal units (Btu)required,itdoesallowthebuilding’sowner + +and tenants to benefit from lower utility costs. Power companies encourage their commercial customers to purchase power during off peak hours in hopes of flattening or evening out the demand on their generating equipment. Some utility companies not only offer lower rates for electricity purchased during off- and semi-peak periods but in many instances have no customer demand charges. The plumbing engineer can obtain electric-rate schedules from the utility serving the site and observe the off-peak periods to program the operation of domestic water- +Chapter 7 — Energy and Resource Conservation in Plumbing Systems 129 + + + +heatingequipment.Typicallythehighestdemand forhotwatertakesplacewhenelectricalcostsare at their peak. To account for this, the hot water system will maintain the heated water at an elevatedtemperature,whichisblendedtoachieve thedesiredtemperaturelevels,savingthesystem fromhavingtooperateduringtheday.Depending uponthedifferenceinelectricalrates,anoff-peak poweredhotwatersystemcangenerallypay(ina fewyears)fortheadditionalequipmentrequired, including the effects of equipment heat losses during periods of standby. +7. Upgrade to More Efficient Equipment Equipment specifications need to be examined to ensure only hot water heating equipment that meetsminimumenergystandardsisapprovedfor installation. The following factors contribute to the efficiency of gas-fired water heaters and need to be taken into consideration when selecting this equipment: Combustion equipment and its adjustment, tank insulation, heat exchanger effectiveness,firingrate,pickupanddemand,and standby stack losses. +8. Water Heater Location +Many hot water heaters are installed in central locationsrequiringlongsupplyandreturnpiping runs to reach plumbing fixtures. Moving these heaters close to the most-frequent points of use will minimize piping heat loss. + +Domestic Hot Water Heating Equipment Therearemanydifferentmeansofgeneratinghotwa-ter. Each has its own advantages and disadvantages, and, as plumbing engineers, it is our responsibility to determine which technology is best suited for an application.Inaddition,theperformanceefficiencyof equipmentspecifiedbytheplumbingengineershould match the recommendations of the Domestic Water Heating System Fundamentalschapter of the “ASPE Plumbing Engineering Design Handbook”. The recovery efficiency and standby losses of water-heat-ing equipment should comply with the latest codes and regulations for the manufacturer, e.g. American National Standards Institute (ANSI) C72.1, ANSI Z22.10.3, latest editions. State energy codes also mandate the use of energy-efficient equipment and should be checked by the plumbing engineer prior to the preparation of specifications. Listed below are several hot water heating technologies. +1. Tank-Type Water Heaters A. Electric +B. Gas-Fired +2. Tankless-Type Water Heaters A. Electric +B. Gas-Fired + +C. Condensing D. Steam-Fired E. Direct-Fired +3. Alternative Resources A. Solar Energy +B. Solid-Waste-Disposal Energy C. Geothermal Energy +4. Heat Recovery +A. Air Conditioning and Commercial Refrigera-tion +B Steam Condensate C. Cogeneration Plants D. Heat Pumps +E. Drainline Heat Reclaim Systems + +1. Tank-Type Water Heaters +Tank-type water heaters are self-contained units thatheatandstorewaterwithinthesamestorage tank. Insulation is added around the exterior of the tank to prevent heat from escaping. Many older tank-type water heaters were originally supplied with insufficient insulation. Making it energy efficient consisted of either replacing the insulation or the entire unit. +A. Electric +The heating element for electric tank-type water heaters is immersed directly into the water, allowing energy to transfer from the elementtothewaterfastandefficiently.They can be used for many applications ranging from commercial and industrial to booster heaters for dishwashing needs. +B. Gas-Fired +A gas-fired tank-type water heater uses natural or propane gas to heat stored water. Unlike an electric heater, there are standby lossesassociatedwiththeheater’sflue,which carries the unit’s products of combustion to the atmosphere. The flue is internal to the heater and not insulated, acting as a heat exchanger, allowing energy to escape from the heated water. + +2. Tankless-Type Water Heaters +Tankless-type water heaters, as their name suggests, do not store water. They are instantaneous heaters that provide hot water only when there is a demand. Because they have nowaterstoragecapability,theseunitseliminate standby heat loss and may reduce the risk of Legionella bacteria growth. +A. Electric +Electrictankless-typewaterheatersconsume largeamountsofenergywhenoperating.This has relegated their use to remote areas with +130 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +low fixture counts and infrequent use. They are usually installed near the point of use to minimize pipe heat loss. +B. Gas-Fired +These heaters can be found in commercial, industrial,andresidentialapplications.They have been gaining popularity among new construction and retrofitting of residential properties in warmer climate areas such as California, Florida, Tennessee, and Texas, where the incoming water temperatures are high. There are various models that can produce anywhere from 4 to 10 gallons per minute of hot water at a temperature rise of 77°F. They also can be combined to provide higher flow rates and temperature increases.Similartoelectrictanklessheaters, these units are typically installed near the point of use but are not recommended for remote areas with low fixture counts that areinfrequentlyused.Theseapplicationsare better left for the electric type because of the cost associated with the routing of gas piping and its flue. +C. Condensing +Condensing gas water heaters recover the heat created by the combustion gases. The recovered heat is referred to as the latent heat of vaporization and is directed back into the water, increasing the unit’s efficiency. A condensing water heater operates at approximately95percentefficiencycompared to80percent–85percentforanon-condensing waterheater.Thecondensategeneratedfrom a condensing unit needs to be drained, but care must be taken to account for its acidic nature. With a pH rating of approximately 5, the condensate is either diluted until it reaches an acceptable pH range or drained to a neutralization tank. +D Steam-Fired +Steam-fired tankless-type water heaters generate hot water through the use of a heat exchanger. They are used in hospitals, industrial plants, restaurants, apartment houses, laundries, universities, and hotels among other applications. They can be combined in parallel to meet high flow requirementswhilerequiringlessspacethan comparabletank-typeunits.Theinstallation of a mixing valve is recommended to ensure that steam does not enter the hot water system in the event of a heat-exchanger breach. + +E. Direct-Fired +Gas-fired heaters are used in applications where several hundred gallons of hot water are needed per minute. These units use a direct exchange between the water and combustionproductsproducedbytheburner assembly. This process eliminates standby losses and can achieve operating efficiencies in excess of 98 percent. +3. Alternative Resources +As the consumption of fossil fuels increases so does the need to develop alternative fuel sources. One of these sources is solar energy. Energy from the sun can be converted to operate cars, power lighting, and heat domestic water. Other forms of alternative energy are geothermal and solid wastes, which have been used to heat water while reducing the load placed on mainstream resources. The designer may choose to use alternative energy resources for all or part of the hot water system. This helps to meet restrictions placed upon the domestic water heating systems by energy codes in many parts of the country. +A. Solar Energy +Solar water heating is often thought of for warm and sunny climates only; however, an the climate in an area is one of many factors that determine the effectiveness of a solar system. Factors such as the cost of the fuels being replaced, hot water demand, usage patterns, and incoming water temperature help determine the effectiveness of a solar heating system. For most areas of the United States, solar heating can meet the domestic hot water demand during the summer months but often require supplemental heating during the winter. It has been estimated that a solar heating system can meet 40 percent to 80 percent of a building’s annual hot water demand. Refer to ASPE’s “Solar Energy System Design” manual as a sourceofinformationintheuseandselection of solar heating equipment. +B. Solid-Waste-Disposal Energy +Solid-waste collection and disposal systems produce various gases during decomposition. One of these is methane. It can be recovered and burned to produce heat. A second source of methane is leachate evaporation systems in landfill closures. Lastly, solid-waste incinerationsystemsconstructedtostringent pollution-control rules and regulations are a source of methane. These systems can potentially provide large volumes of steam and/or domestic hot water. The use of these +Chapter 7 — Energy and Resource Conservation in Plumbing Systems 131 + + + +alternate energy sources should be within reasonableproximitytotheresource.Typical applications include industrial plants with large volumes of burnable materials such as trash, paper, scrap wood, plastics, etc. A solid-waste incinerator system typically consists of a waste-disposal plant with a conveyer,loadingsystem,boiler,ash-disposal equipment,heatexchanger,insulatedpiping, circulating pump, and controls. +C. Geothermal Energy Geothermalenergyisheatfromtheearth.In states where this form of energy is believed to be available at reasonable depths, the U.S. Department of Energy (DOE) is supporting various state energy commissions in their fundingofgeothermalassessmentprograms. Thetemperatureoftheavailableliquidorgas (created when water flows through heated, permeable rock) and the cost of retrieval dictate the viability of geothermal energy. Some geothermal energy uses include steam in the generation of electricity, hot water with a minimum temperature of 150°F for building domestic hot water systems, and industrial parks for space and water heating needs. Three prime areas of concern must be addressed when planning and developing geothermal energy: +1. Competitive Institutional Processes +2. Adequate Temperature and Flow Rate +3. Thermal Loads To Make the System Economically Viable +Ageothermalenergysystemtypicallyconsists of production and disposal wells, water-to-waterheatexchangers[usuallyshell-and-tube type, two are required—one for operation while the other is being cleaned of deposits], insulated piping, a circulating pump, and a control system. The plumbing engineer should consult with the state energy office (Department of Energy or the Geothermal Resources Council) for resource information toapplythishigh-capital,low-operating-cost, alternate energy source. +4. Heat Recovery +Heat recovery is the capture and reuse of energy thatwouldnormallybelostfromafacility.Itcould be in the form of a liquid or a gas. Common waste heat sources are: +1. Heat rejectedfromair conditioningand com-mercial refrigeration processes +2. Heat reclaimed from steam condensate 3. Heat generated by cogeneration plants + +4. Heat pumps and heat reclamation systems 5. Heat from wastewater +When considering heat recovery, it is important todetermineifthehotwaterdemandjustifiesthe equipmentandmaintenancecosts,andiftheheat recovered is sufficient to serve as a heat source. Facilities that typically have the proper blend of demand and waste heat are hospitals, military bases, and industrial facilities. +A. Air Conditioning and Commercial Refrigeration +Systems with air- or water-cooled or evaporative condensers reject heat from air conditioning and refrigeration systems that can be reclaimed. +Within the refrigerant cycle there is a condenserthatrejectsheatwhileanevaporator creates a cooling effect. For example, for every 1 Btu/h of cooling effect produced by a 40°F evaporator, a 105°F condensing unit rejects 1.15 Btu/h of heat. Systems with an air-cooled or evaporative condensor can be supplemented with a heat exchanger in the compressor’shotgasdischargelinetocapture the rejected heat. (Refer to Figure 7-2.) Systems with water-cooled condensers can be supplemented with a heat exchanger in the hot water return line from the condenser to the cooling tower. (Refer to Figure 7-3.) System efficiency can be improved by providing a storage tank with a tube bundle. (Refer to Figure 7-4.) +An advantage of the system shown in Figure 7-4 is that simultaneous use of the domestic water and refrigeration systems does not need to occur for heat recovery. Another advantage of the system shown in Figure 7-4 is when there is an insufficient amount of heat rejected, a backup water heater can be usedtobringthewaterinthestoragetankto the proper design temperature. The backup heater can operate on fossil fuel, electricity, steam, or may be fitted with a tube bundle utilizing hot water. +B. Steam Condensate +When steam is used as a source for space heating,waterheating,orprocessworkthere is generally steam condensate. The heat content of the condensate can be captured and reused for heating with the use of a heat exchanger. Laundries are a prime example of facilities where heat reclaimed from steam condensatecanbeputtouseinheatrecovery. Itisessentialtoselectasystemwithadequate storage to compensate for fluctuations in +132 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + +Figure 7-2 Refrigeration Waste-Heat Recovery + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 7-3 Condenser Water Heat Recovery +Chapter 7 — Energy and Resource Conservation in Plumbing Systems 133 + + + + + + + + + + + + + + + + + + + +Figure 7-4 Condenser Water Heat Recovery with Storage Tank + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 7-5 Waste Water Heat Recovery +134 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +the condensate and domestic water flow. When deciding whether to capture and reuse steamcondensate,rememberthatenergywill not be saved if the boiler used to raise the temperature of the returned condensate is less efficient than the primary water heater. +C. Cogeneration Plants Theheatproducedasabyproductofgenerating electricity from reciprocating engines or gas turbines can be reclaimed from the cooling systems and exhaust gases by using a waste heat boiler and heat exchanger. The heat can then be used to produce steam or medium temperature water. To be economically viable, most systems must have a year-round thermal heat load. Reheating makeup water and maintaining temperature in a domestic hot water system are excellent ways to maintain high overall thermal efficiencies. +D. Heat Pumps +In today’s buildings where computer rooms are continuously generating heat and industrial plants are producing waste heat, heat pumps can be used to transfer this heat to the domestic hot water systems, resulting in energy conservation. +Eitherdirect-expansionorchilled-water-type heat pumps can be used to transfer heat through the refrigeration process from the surrounding air to a water storage tank. The mechanics of this system are to extract heat from a warm environment directly, either through a heat exchanger or cooling coil. +E. Drainline Heat Reclaim Systems +It has been estimated that 80 percent to 90 percentofallhotwaterenergyiswasted.The U.S. DOE estimates this amount of energy to be 235 billion kWh a year. One method of recouping some of this energy is using a drainline heat reclaim system. This device can be a passive or active piece of equipment installed in the wastewater drain line of a building. Passive devices use a copper coil wrapped around a vertical portion of a waste line.Domesticwaterisfedthroughthecopper coil to the hot water heater. As hot water is drained, heat is transferred from the drain line to the incoming domestic water. It has beenestimatedthattheseexchangershavean operating efficiency of up to 60 percent and can raise the incoming water temperature by as much as 36°F. Active systems utilize a wastewater circulating pump in conjunction with the heat exchanger. This system is shown in Figure 7-5. + +WATER MANAGEMENT +Design Techniques +Conserving water provides benefits to the building’s owner and local municipality. The owner saves by having lower utility costs, while the municipality saves resources by having to treat and circulate less water and wastewater. In order to realize these sav-ings, the plumbing engineer must provide designs that reduce water consumption without compromis-ing the fixture’s operation. Some design techniques previously mentioned are: +1. Eliminate Faucet and Pipe Leaks 2. Reduce Fixture Flow Rates +Other methods of unique water management are: +3. Alternate Sources of Fresh Water 4. Reclaimed and Graywater +Forawatermanagementprogramtobesuccessful inrenovationprojects,itisimportanttofirstestablish the building’s current water consumption. The U.S. DOEhasdeveloped8stepstomakeasuccessfulwater management plan: +1. Gather Information +2. Conduct a Comprehensive Facility Survey +3. Explore and Evaluate Water Management Op-tions +4. Conduct Life Cycle Cost Analysis and Explore Financing Options +5. Develop a Water Management Plan and Work Schedule +6. InformBuildingOccupantsaboutWaterManage-ment +7. Implement the Water Management Plan 8. Monitor the Water Management Plan +For more information refer to page 135 of the U.S.DOE’sGreeningFederalFacilitiesGuidesecond edition. +1. Eliminate Faucet and Pipe Leaks +Similar to hot water conservation, this is one of the easiest and first actions that should be taken. Leaksinboththecoldandhotwaterpipingshould be repaired as well as any leaking faucets. This willreducetheamountofwaterbeingwastedand avoid more expensive repairs later. + +2. Reduce Fixture Flow Rates +Toilets and urinals account for almost half of a typical building’s water consumption. Within a group of New York City apartment buildings, 1.3 million toilets were replaced with ultra low flow (ULF) toilets and resulted in a 29 percent +Chapter 7 — Energy and Resource Conservation in Plumbing Systems 135 + + + +reductioninwaterconsumption.Therearemany differenttypesoftoiletsandurinalsandeachhas its own benefits, which will be discussed later in this chapter. +Additional fixtures whose flow rates can be reduced are showers and faucets. In addition to applying flow-restrictor fittings, as previously discussed,meteredfaucetscanbeinstalledwhich provide water for a pre-determined time and then automatically close. The Americans with Disabilities Act specifies that these faucets must operate for at least 10 seconds. +Electronic sensor controls can be used on toilet and urinal flush valves and faucets. They reduce water consumption and are often used in prisons, military barracks, sporting facilities, andhospitals.Batteriesorhardwiringcanpower these controls. Battery controlled valves and faucets are typically used for renovation projects while new construction is hard wired. + +3. Alternate Sources of Fresh Water +Rainwater harvesting is the collection, storage, treatment, and use of rainwater. Harvested water can be used for irrigation, non-potable, and potable uses. A rainwater harvesting system typically starts with a catch area that collects rainwater, usually a building’s roof. To ensure potential contaminants and pollutants do not enter the system’s storage tank, a wash system isinstalledwhichdivertstheinitialportionofthe rainfallawayfromthestoragetankwhilecleaning thecatcharea.Ascreenisusuallyinstalledinthe catch area to keep out debris. Piping routes the collected rainwater to a storage tank, which can be located indoors, outdoors, aboveground, or underground. It is important to provide a lid on the storage tank to keep light out to discourage algaegrowth.Ifthecollectedwaterisintendedto be the sole source of water for the building, the storage tank should be sized based on a 30-year rainfall event. Water is typically delivered to the building through the use of a domestic water booster pump system, and final water treatment may be needed depending upon the application and quality of water collected. + +4. Reclaimed and Graywater +Reclaimed water and graywater collection systems can be used to reduce the amount of domestic water consumed by a building. Wastewater treatment plants provide reclaimed or recycled water to buildings through a second municipal water system where two water lines enter a building. One line is used to deliver potable water for domestic use and a second to provide treated wastewater that can be used + +for non-potable applications such as landscape irrigation,coolingtowermakeup,toiletflushing, and fire protection. +Graywater is typically collected from showers, tubs,lavatories,washingmachines,anddrinking fountains. It contains a minimal amount of contaminationandisreusedincertainlandscape applications such as subsurface irrigation of lawns, flowers, trees, and shrubs, but should not be used for vegetable gardens because of the potential absorption of cleaning and washing chemicals. Similar to rainwater harvesting, graywater is collected, stored, and filtered prior to use. A graywater storage container should be fitted with overflow protection that is connected to the sanitary sewer system in the event the amount of water collected is more than the amount of water being consumed, a distribution pipe becomes clogged, or collected water is not used in a timely manner. If graywater is stored for extended periods of time it often produces an offensive smell. +Water-Management Equipment +As previously stated, toilets and urinals account for almosthalfofatypicalbuilding’swaterconsumption. The U.S. Environmental Protection Agency (EPA) has determined that 4.8 billion gallons of water are flushedeachday.Replacingorretrofittingwaterclos-ets, urinals, showerheads, and faucets with low flow versions can considerably lower a building’s water consumption. +1. Water Closets and Urinals +Ultra low flow (ULF) water closets consume 1.6 gallons per flush (gpf) and are available in three different classifications: +A. Tank Type B. Flush Valve C. Specialties +While the problems associated with ULF toilets when they first became available have been corrected, some low-cost models continue to maintain poor performance. +A. Tank Type +Water is drained from this water closet by gravity and is most commonly used in residentialapplications.PriortoULFmodels these fixtures consumed 3.5 gpf. A low-cost method of conserving water in these earlier models and in today’s ULF is using a refill diverter. When a tank type water closet is flushed, water starts to refill the tank as it is emptying. The time elapsed between the openandclosedpositionoftheflapper,allows excess water to flow through the bowl, into +136 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +the bowl, and consequently, the drain. While refilling the tank, this water is wasted. A diverter keeps this water in the tank saving one-half to 1 gallon when installed on older toilets and a ¼ gallon on ULF models. +B. Flush Valve +Flush-valve water closets use the building’s waterpressuretoexertaforcewhenoperating. Theytypicallyrequire25to40psigtooperate and are most commonly used in commercial buildings. Older, non-ULF models can be retrofitted by adjusting the flush valve, but care must be used to not overly constrain the valve causing it to malfunction. Early closure devices also can be used to cause the flush valve to stop the flow of water sooner than normal, limiting the amount of water discharged. + +2. Showerheads and Faucets +The 1992 Energy Policy Act set the maximum flow rates for showerheads and faucets at 2.5 gallons per minute. Prior to the Energy Policy Act, showerhead flow rates were between 3 gallons per minute and 7 gallons per minute. Water conserving showerheads incorporate a more narrow spray jet and introduce a greater volume of air when compared to conventional heads. Additional measures that can be taken aretemporarystopleversthatcontroltheshower valve to reduce or inhibit water flow when used. This feature would be used while a person is soaping or shampooing him or herself. The use of flow restrictors in conventional showerheads is not recommended. They typically restrict the showerhead too much, providing poor water pressure from the head. + + + +C. Specialties +Some specialty water closets are pressure-assistedtank-type,dualflush,andcomposting. Pressure-assisttank-typewaterclosetscanbe used in applications where it is desired to use a gravity tank-type water closet, but there is a concern about flushing performance. When water conservation beyond ULF is desired, dual flush water closets can be used. Thesehavetwoflushsettings,onefornormal operationtoflushsolidsandasecondreduced amount for liquids, saving approximately 1 gallon per flush. Composting systems are high capital ventures that require a lot of space and are typically used in unique locations where there is no water supply. They are popular choices in state or county parks,campingfacilities,andnationalparks. Composting toilets are gaining acceptance in other areas of the world for mainstream use in households. + +ULF urinals consume 1 gallon per flush, but there are water conservation methods that can go beyond this level. Flush valves that consumeaone-halfgallonperflushhavebeen employedwithsuccess,andwaterlessurinals thatdonotconsumeanywaterarebeingused. Waterlessurinalsuseaspeciallydesignedtrap that uses biodegradable oil. This oil allows waste to pass through while maintaining the trap’s seal. Regular maintenance is required torefilltheoil,asasmallportionofitbecomes entrained in the waste when the fixture is used. If routine maintenance is not provided, enough oil could be removed to where it no longer seals the fixture’s trap, causing odors to enter the room. + +Faucetsmanufacturedafter1993consumenomore than 2.5 gallons per minute at 80 psig, meeting the requirements of the 1992 Energy Policy Act. Replacing the faucet’s tip with an aerator, which mixes air into the faucet’s discharge and reduces itsflowrateto2.5gpm,canretrofitolderfaucets, which consume between 3 gallons per minute and 5 gallons per minute. Aerators are typically used in residential faucets and prohibited from health care facilities because of their potential for harboring germs and pathogens. In these applications, low flow tips are used. + +GLOSSARY +British thermal unit (Btu) A heat unit equal to the amount of heat required to raise 1 pound of water 1 degree Fahrenheit. +Coefficient of performance (COP) The ratio of the rate of heat removal to the rate of energy input, in consistent units, generally relating to a refrigeration system under designated operating conditions. +Condenser A heat exchanger that removes heat from a vapor changing it to its liquid state. +Delta T (DT) Temperature differential. +Domestic-water heating Supply of hot water for domestic or commercial purposes other than comfort heating. +Domestic-water heating demand The maximum design rate of energy withdrawal from a domestic-water heating system in a specified period of time. +Efficiency, thermal (overall system) The ratio of useful energy at the point of ultimate use to the energy input. +Chapter 7 — Energy and Resource Conservation in Plumbing Systems 137 + + +Energy The force required for doing work. +Energy, nondepletable Energy derived from incoming solar radiation and phenomena resulting therefrom, including wind, waves, and tides, and lake or pond thermal differences, and energy derived from the internal heat of the +earth (geothermal)—including nocturnal thermal exchanges. +Energy, recovered A byproduct of energy used in a primary system that would otherwise be wasted from an energy utilization system. +Heat, latent The quantity of heat required to effect a change in state. +Heat, sensible Heat that results in a temperature change but not a change in state. +Life-cycle cost The cost of the equipment over its entire life, including operating and maintenance costs. +Makeup Water supplied to a system to replace that lost by blowdown, leakage, evaporation, etc. +Solar energy source Source of chemical, thermal, or electrical energy derived from the conversion of incident solar radiation. +System An arrangement of components (including controls, accessories, interconnecting means, and terminal elements) by which energy is transformed to perform a specific function. +Terminal element The means by which the transformed energy from a system is ultimately delivered. + +REFERENCES +1. Cassidy, Victor M. 1982. Energy saving and the plumbing system. Specifying Engineering (Feb-ruary). +2. San Diego Gas & Electric Company. Commercial Energy Conservation Manual. +3. U.S.DepartmentofEnergy,GreeningFederalFa-cilitiesAnEnergy,Environmental,andEconomic Resource. Guide for Federal Facility Managers and Designers (May 2001) +138 ASPE Plumbing Engineering Design Handbook — Volume 1 +8Corrosion + +INTRODUCTION +Corrosion is the degradation of a material by its environment. In the case of metals, corrosion is an electrochemical reaction between a metal and its environment. For iron piping, the iron reacts with oxygen to form iron oxide, or rust, which is the basic constituent of the magnetic iron ore (hematite) fromwhichtheironwasrefined.Themanyprocesses necessarytoproduceironorsteelpipe—fromrefining throughrolling,stamping,andfabricatingtofinished product—all impart large amounts of energy to the iron. The iron in a finished pipe is in a highly energized state and reacts readily with oxygen in the environment to form rust. Corrosion results from a flow of direct current through an electrolyte (soil or water) from one location on the metal surface to another location on the metal surface. The current flow is caused by a voltage difference between the two locations. +This chapter covers the fundamentals of corrosion as they relate to a building’s utility sys-tems, essentially dealing with piping materials for the conveyance of fluids, both liquid and gas. These pipesareinstalledeitherunderoraboveground,thus making the external environment of the pipe earth or air, respectively. The internal environment is the fluid conveyed inside the pipe. There are many envi-ronmentalconditionsthatmayaffecttheperformance of any given piping material. +FUNDAMENTAL CORROSION CELL +Basic Relations +Corrosion is, in effect, similar to a dry cell. In order for corrosion to occur, there must be four elements, namely: electrolyte, anode, cathode, and a return circuit. The electrolyte is an ionized material, such as earth or water, capable of conducting an electric current. +Figure8-1showstheactualcorrosioncell.Figure 8-2(practicalcase)showsthecurrentflowsassociated with corrosion: + +1. Currentflowsthroughelectrolytefromtheanode to the cathode. It returns to the anode through the return circuit. +2. Corrosion occurs wherever current leaves the metalandenterstheelectrolyte.Thepointwhere current leaves is called the anode. Corrosion, therefore, occurs at the anode. +3. Currentispickedupatthecathode.Nocorrosion occurs here, as the cathode is protected against corrosion(thisisthebasisofcathodicprotection). Polarization(hydrogenfilmbuildup)occursatthe cathode. +4. The flow of the current is caused by a potential (voltage) difference between the anode and the cathode. +Electrochemical Equivalents Dissimilarmetals,whencoupledtogetherinasuitable environment,willcorrodeaccordingtoFaraday’slaw; that is, it will require 26.8 ampere-hours (A-h), or 96,500 coulombs (C), to remove 1 gram-equivalent of the metal. At this rate of attack, the amount of metal that is removed by a current of 1 A flowing for 1 year is shown in Table 8-1. +Table 8-1 Electrochemical Metal Losses +of Some Common Metals +Metal Loss, lb/A-yr (kg/C) Iron (Fe2+) 20.1 (72.4) Aluminum (Al3+) 6.5 (23.4) +Lead (Pb2+) 74.5 (268.3) Copper (Cu2+) 45.0 (162.0) Zinc (Zn2+) 23.6 (85.0) Magnesium (Mg2+) 8.8 (31.7) Nickel (Ni2+) 21.1 (76.0) Tin (Sn+) 42.0 (151.2) Silver (Ag+) 77.6 (279.4) Carbon (C4+) 2.2 (7.9) +140 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-1 Basic Corrosion Cell + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-2 Basic Cell Applied to an Underground Structure +Chapter 8 — Corrosion + + +COMMON FORMS OF CORROSION Corrosion occurs in a number of common forms as follows: +Uniform attack (Figure 8-3) Uniform attack is characterized by a general dissolving of the metal wall. The material and its corrosion products are readily dissolved in the corrosive media. +Pitting corrosion (Figure 8-4) Pitting corrosion is usually the result of the localized breakdown of a protective film or layer of corrosion products. Anodic areas form at the breaks in the film and cathodic areas form at the unbroken portion of the film. The result is localized, concentrated corrosion, which forms deep pits. +Galvanic corrosion (Figure 8-5) Galvanic corrosion occurs when two dissimilar metals are in contact with an electrolyte. The example shown is iron and copper in a salt solution, the iron being the anode corroding toward the copper cathode. +Concentration cell attack (Figure 8-6) Concen-tration cell attack is caused by differences in the concentrationofasolution,suchasdifferencesinoxy-genconcentrationormetal-ionconcentration.These can occur in crevices, as shown in the example, or undermoundsofcontaminationonthemetalsurface. The area of low oxygen or metal-ion concentration becomes anodic to areas of higher concentration. +Crevice corrosion A form of concentration cell attack (see separate listing). +Impingement attack (Figure 8-7) Impingement attack is the result of turbulent fluid, at high velocity, breaking through protective or corrosion films on a metal surface. There usually is a definite direction to the corrosion formed. +Stresscorrosioncracking (Figure8-8)Stresscor-rosion cracking results from placing highly stressed parts in corrosive environments. Corrosion causes concentration of the stress, which eventually exceeds the yield strength of the material, and cracking oc-curs. +Selective attack (Figure 8-9) Selective attack is the corrosive destruction of one element of an alloy. Examples are dezincification of brass and graphitiza-tion of cast iron. +Stray current (Figure 8-10) Stray current cor-rosion is caused by the effects of a direct current source such as a cathodic protection rectifier. Pro-tective current may be picked up on a pipeline or structure that is not part of the protected system. This current follows to the other structure and at some point leaves the other structure and travels through the electrolyte (soil or water) back to the + +141 + + +protected structure. This causes severe corrosion at the point of current discharge. +Corrosion by differential environmental con-ditions (Figure 8-11) Examples of differential environmental cells are shown in Figure 8-11. It shouldbenotedthatvariationsinmoisturecontent, availability of oxygen, change in soil resistivity, or variations of all three may occur in some cases. As in allcorrosionphenomena,changesorvariationsinthe environment are a contributing factor. + +THE GALVANIC SERIES +The galvanic series of metals, listed in Table 8-2, is useful in predicting the effects of coupling various metals. Metals that are far apart in the series have a greater potential for galvanic corrosion than do met-als in the same group or metals close to each other in the series. Metals listed above other metals in the series are generally anodic (corrode) to metals listed below them. The relative area of the metals in the couplemustbeconsideredalongwiththepolarization characteristic of each metal. +Table 8-2 Galvanic Series of Metals Corroded end (anodic) +Magnesium Magnesium alloys Zinc +Aluminum 1100 Cadmium +Aluminum 2017 & 2024 Steel or iron +Cast iron +Chromium-iron (active) Ni-resist irons +18-8 SS (active) 18-8-3 SS (active) Lead-tin solders Lead +Tin +Nickel (active) Inconel (active) Hastelloy C (active) Brasses +Copper Bronzes +Copper-nickel alloys Monel +Silver solder Nickel (passive) Inconel (passive) +Chromium-iron (passive) 18-8 SS (passive) +18-8-3 SS (passive) Hastelloy C (passive) Silver +Titanium Graphite Gold Platinum +Protected end (cathode) +142 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + +Figure 8-3 + + + + + + + + + + + +Figure 8-4 + +Uniform Attack + + + + + + + + + + + +Pitting Corrosion + + + + + + + + + + + + +Figure 8-8 Stress Corrosion Figure 8-5 Galvanic Corrosion + + + + + + + + + +Figure 8-6 + + + + + + + + + +Figure 8-7 + +Concentration Cells + + + + + + + + + +Impingement Attack + + +(A) + + + + + + + +(B) +Figure 8-9 (A) Plug-Type Dezincification +(B) Layer-Type Dezincification +Chapter 8 — Corrosion 143 + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-10 Stray Current Corrosion + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-11 Corrosion by Differential Environmental Conditions +144 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +ELECTROMOTIVE FORCE SERIES An “electromotive force” is defined as a force that tends to cause a movement of electrical current through a conductor. Table 8-3, known as the “elec-tromotive force series,” lists the metals in their electromotive force order and defines their potential withrespecttoasaturatedcopper-coppersulfitehalf-cell. This list is arranged according to their standard electrodepotentials,withpositivepotentials(greater than1.0)forelementsthatarecathodictoastandard hydrogen electrode and negative potentials (less than 1.0) for elements that are anodic to a standard hydrogen electrode. In most cases, any metal in this series will displace the more positive metal from a solution and thus corrode to protect the more posi-tive metal. There are exceptions to this rule because of the effect of ion concentrations in a solution and because of different environments found in practice. Thisexceptionusuallyappliestometalsclosetogether in the series, which may suffer reversals of potential. Metalsfarapartintheserieswillbehaveasexpected, the more negative will corrode to the more positive. In an electrochemical reaction, the atoms of an ele-ment are changed to ions. If an atom loses one or moreelectrons(e-),itbecomesanionthatispositively charged and is called a cation (example: Fe2+). An atomthattakesononeormoreelectronsalsobecomes an ion, but it is negatively charged and is called an anion (example: OH-). The charges coincide with the valence of the elements. +The arrangement of a list of metals and alloys according to their relative potentials in a given envi-ronmentisagalvanicseries.Bydefinition,adifferent series could be developed for each environment. + +FACTORS AFFECTING THE RATE OF CORROSION +General +The rate of corrosion is directly proportional to the amount of current leaving the anode surface. This current is related to both the potential (voltage) between the anode and cathode and the circuit resis-tance. Voltage, resistance, and current are governed by Ohm’s Law: +Equation 8-1 +I = E +R +where: +I = Current (A or mA) E = Voltage (V or mV) R = Resistance (Ω) +Essentially, Ohm’s Law states that current is directly proportional to the voltage and inversely proportional to the resistance. + + +Table 8-3 Electromotive Force Series Potential +of Metals Magnesium (galvomag alloy)a 1.75 Magnesium (H-I alloy)a 1.55 Zinc 1.10 Aluminum 1.01 Cast iron 0.68 Carbon steel 0.68 Stainless steel type 430 (17% Cr)b 0.64 +Ni-resist cast iron (20% Ni) 0.61 Stainless steel type 304 (18% Cr, 8% Ni)b 0.60 Stainless steel type 410 (13% Cr)b 0.59 Ni-resist cast iron (30% Ni) 0.56 Ni-resist cast iron (20% Ni+Cu) 0.53 Naval rolled brass 0.47 Yellow brass 0.43 Copper 0.43 Red brass 0.40 Bronze 0.38 Admiralty brass 0.36 90:10 Cu-Ni+ (0.8% Fe) 0.35 70:30 Cu-Ni+ (0.06% Fe) 0.34 70:30 Cu-Ni+ (0.47% Fe) 0.32 Stainless steel type 430 (17% Cr)b 0.29 Nickel 0.27 Stainless steel type 316 (18% Cr, 12% Ni, 3% Mo)b 0.25 Inconel 0.24 Stainless steel type 410 (13% Cr)b 0.22 Titanium (commercial) 0.22 Silver 0.20 Titanium (high purity) 0.20 Stainless steel type 304 (18% Cr, 8% Ni)b 0.15 Hastelloy C 0.15 Monel 0.15 Stainless steel type 316 (18% Cr, 12% Ni, 3% Mo)b 0.12 +Note: Based on potential measurements in sea water, velocity of flow 13 ft/s (3.96 m/s), temperature 77°F (25°C). +a Based on data provided by the Dow Chemical Co. +b The stainless steels, as a class, exhibited erratic potentials depending on the incidence of pitting and corrosion in the crevices formed around the specimen supports. The values listed represent the extremes observed and, due to their erratic nature, should not be considered as establishing an invariable potential relation among the alloys that are covered. + +Effect of the Metal Itself +For a given current flow, the rate of corrosion of a metal depends on Faraday’s Law. +Equation 8-2 +w = KIt +where: +w = Weight loss +K = Electrochemical equivalent I = Current +t = Time +For practical purposes, the weight loss is usually expressed in pounds per ampere year (kilo-grams per coulomb). Loss rates for some common metals are given in Table 8-4. +Chapter 8 — Corrosion + + +Table 8-4 Corrosion Rates for +Common Metals +Loss Rate, Metal lb/A-yr (kg/C) +Iron or steel 20 (6.1) Lead 74 (22.5) Copper 45 (162.0) Zinc 23 (7.0) Aluminum 6.5 (23.4) Carbon 2.2 (7.9) +This indicates that if 1 ampere is discharged from a steel pipeline over a period of 1 year, 20 pounds (6.1 kilograms) of steel will be lost. +Corrosion of metals in aqueous solutions is also influenced by the following factors: Acidity, oxygen content, film formation, temperature, velocity, and homogeneity of the metal and the electrolyte. These factors are discussed below, since they are factors that can be measured or detected by suitable instru-ments. +Acidity +The acidity of a solution represents the concentra-tion of hydrogen ions or the pH. In general, low pH (acid) solutions are more corrosive than neutral (7.0 pH) or high pH (alkaline) solutions. Iron or steel, for example, suffers accelerated corrosion in solutions where the pH is 4.5 or less. Exceptions to this rule are amphoteric materials such as aluminum or lead, which corrode more rapidly in alkaline solutions. +Oxygen Content +The oxygen content of aqueous solutions causes cor-rosionbyreactingwithhydrogenatthemetalsurface to depolarize the cathode, resulting in the exposure of additional metal. Iron or steel corrodes at a rate proportional to the oxygen content. Most natural waters originating from rivers, lakes, or streams are saturated with oxygen. Reduction of oxygen is a part of the corrosion process in most of the corrosion found in practice. The possibility of corrosion being influenced by atmospheric oxygen should not be overlooked in design work. +Film Formation +Corrosion and its progress are often controlled by the corrosion products formed on the metal surface. The ability of these films to protect metal depends on howtheyformwhenthemetalisoriginallyexposedto theenvironment.Thin,hard,dense,tightlyadherent films afford protection, whereas thick, porous, loose filmsallowcorrosiontoproceedwithoutprovidingany protection. As an example, the iron oxide film that usually forms on iron pipe in contact with water is porous and easily washed away to expose more metal + +145 + + +to corrosion. The effective use of corrosion inhibitors in many cases depends on the type of film it forms on the surface to be protected. +Temperature +The effect of temperature on corrosion is complex because of its influence on other corrosion factors. Temperature can determine oxygen solubility, con-tent of dissolved gases, and nature of protective-film formation, thereby resulting in variations in the cor-rosion rate. Generally, in aqueous solutions, higher temperatures increase corrosion rates. In domestic hot water systems, for example, corrosion rates double for each 10°F (6°C) rise above 140°F (60°C) water temperature. Temperature can also reverse potentials, such as in the case of zinc-coated iron at approximately 160°F (71.1°C) water temperature, whenthezinccoatingcanbecomecathodictotheiron surface, accelerating the corrosion of iron. +Velocity +Velocity of the solution in many cases controls the rateofcorrosion.Increasingvelocityusuallyincreases corrosionrates.Themorerapidmovementofthesolu-tion causes corrosion chemicals, including oxygen, to be brought into contact with the metal surface at an increasedrate.Corrosionproductsorprotectivefilms are carried away from the surface at a faster rate. +Another important effect of high velocity is that turbulencecanresultinlocaldifferentialoxygencells or metal-ion concentration cells causing severe local attack. High velocities also tend to remove protective films causing rapid corrosion of the metal surfaces. +Homogeneity +The homogeneity of the metal and of the electrolyte isextremelyimportanttocorrosionrates.Ingeneral, nonhomogeneous metals or electrolytes cause local attack or pitting, which occurs at concentrated areas andis,therefore,moreseriousthanthegeneraloverall corrosionofamaterial.Examplesinclude:Concentra-tion cells, galvanic cells, microstructural differences, and differences in temperature and velocity. + +CORROSION CONTROL Corrosioncontrolistheregulation,control,orpreven-tion of a corrosion reaction for a specific goal. This may be accomplished through any one or a combina-tion of the following factors: +1. Materials selection. +2. Design to reduce corrosion. 3. Passivation. +4. Coating. +5. Cathodic protection. +6. Inhibitors (water treatment). +146 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Materials Selection +Corrosion resistance, along with other important properties,mustbeconsideredinselectingamaterial for any given environment. When a material is to be specified, the following steps should be used: +1. Determine the application requirements. +2. Evaluate possible material choices that meet the requirements. +3. Specify the most economical method. + +Factors to be considered include: 1. Material cost. +2. Corrosion-resistance data. +3. Ability to be formed or joined by welding or sol-dering. +4. Fabricating characteristics (bending, stamping, cutting, etc.). +5. Mechanicalproperties(tensileandyieldstrength, impact resistance, hardness, ductility, etc.). +6. Availability of material. +7. Electrical or thermal properties. +8. Compatibility with other materials in system. +9. Specific properties, such as nuclear-radiation absorption, low or high-temperature properties. +Initial cost is an important consideration, but the life cost as applied to the system, as a whole, is more important. For example, if an inexpensive part must be periodically replaced, the cost of downtime and labor to install it may make the inexpensive part the most expensive part when all factors are considered. +Design to Reduce Corrosion +Corrosion can be eliminated or substantially reduced byincorporatingsomebasicdesignsuggestionsinthe system design. The following five design suggestions can minimize corrosive attack: +1. Provide dielectric insulation between dissimilar metals, when dissimilar metals such as copper andsteelareconnectedtogether,e.g., at a water heater. In a pipeline, for example, dielectric insulation should beinstalled to prevent contact of the two metals. Without such insulation, the metalhigherinthegalvanicseries(steel)willsuf-fer accelerated corrosion because of the galvanic cell between copper and steel. When designing systems requiring dissimilar metals, the need for dielectric insulation should be investi-gated. +2. Avoid surface damage or marking. Areas on surfaces that have been damaged or marked can initiate corrosion. These areas usually become + + +anodic to the adjacent untouchedareasandcan lead to failures. The designer, therefore, should consider this when there is a need for machining or fabrication so that unnecessary damage does not occur. +3. Do not use excessive welding or soldering heat. Areas that are heated excessively during welding or solderingcanresultinchangesto the metals’ microstructure. Large grain growth can result in accelerated corrosion. The grain growth changes the physical properties of the metalandresultsinnonhomogeneityofthemetal wall. Designs can minimize this effect by using heavier wall thicknesses in areas to be welded. +4. Crevices should be avoided. Concentration cells usually form in crevices and can cause prema-ture failures. Regardless of the amount of force applied in bolting two plates together, it is not possible to prevent gradual penetration of liquid into the crevice between the plates. This forms concentrationcellswherethefluidinthecrevices is depleted and forms anodic areas. The most practical way of avoiding crevices is to design weldedconnectionsinplaceofmechanicalfasten-ers. +5. Otherdesignsuggestions:Corrosioncanbemini-mized if heat or chemicals near metal walls are avoided.Condensationofmoisturefromtheairon coldmetalsurfacescancauseextensivecorrosion if not prevented. The cold metal surface should be thermally insulated if possible. Any beams, angles, etc., should be installed so they drain easily and cannot collect moisture, or drain holes must be provided. + +Passivation +Passivation is the accelerated formation of a protec-tive coating on metal pipe (primarily stainless steel) by contact with a chemical specifically developed for this purpose.A thin, protective film is formed when reacting and bonding to the metal. This occurs at the point of potential metal loss (corrosion). Passivation prevents corrosion in the remaining pits left from free machining and the residual that gets trapped therein. Sulfides and iron particles act as initiation sites to corrosion. It is not a scale removal method,thus,surfacecuttingtoolcontaminatesneed to be removed prior to the passivation process. The use of citric acid for passivation is an alternate to us-ing nitric acid in the stainless steel industry. Due to it being safe, organic, and easy to use, citric acid has gained popularity. Care must be taken to ensure the balance of time, temperature, and concentrations to avoid “flash attack”. +Flash attacks are caused by contaminated pas-sivating solutions containing high levels of chlorides. A heavily etched, dark surface rather than an oxide +Chapter 8 — Corrosion + + +film occurs. Passivating solutions should be free of contaminants to prevent this from happening. +New methods are being discovered and tested to protect other material surfaces such as aluminum. Periodic testing after passivation ensures the metal surfaces is maintained. +Coating +Materials exposed to the atmosphere that do not have the ability to form natural protective coatings, such as nickel and aluminum, are best protected by the application of artificial protective coatings. The coatingisappliedtokeepthecorrodingmaterialfrom the surface at all times. +Oneofthemostimportantconsiderationsincoat-ing application is surface preparation. The surface must be properly cleaned, free of scale, rust, grease, and dirt to allow the coating to bond properly to the surface.Thebestcoatingintheworldwillgiveunsat-isfactoryresultsifthesurfaceispoorlyprepared.The surface may require pickling, sandblasting, scratch brushing, or flame cleaning to properly prepare it for application of a coating. +The actual coating that is applied depends on the application and may be either a metallic (such as galvanizing) or nonmetallic, organic (such as vinyl or epoxy)coating.Thecoatingmayactuallybeacoating system, such as primer, intermediate coat (to bond primer and top coat), and finish or top coat. Coat-ing manufacturers’ literature should be consulted regarding coating performance, surface preparatory application, handling of coated surfaces, etc. +For atmospheric exposure, coatings alone are relied on to provide protection in many applications. Coatings by themselves, however, are not considered adequateforcorrosioncontrolofburiedorsubmerged structures because there is no such thing as a perfect coating. All coatings have inherent holes or holidays. Often the coating is damaged during installation or adjacent construction. Concentrated corrosion at coating breaks often causes failures sooner on coated structures than on bare ones. In stray current areas, severe damage occurs frequently on coated pipe because of the high density of discharge current at coating faults. +The most important function of coating is in its relation to cathodic protection. Cathodic protection currentrequirements,andhenceoperatingcosts,are proportionaltotheamountofbaresurfaceexposedto soil. When structures are coated, it is necessary only to protect the small areas of coating faults. Careful applicationsofcoatingandcarefulhandlingofcoated structures lead to maximum coating effectiveness, thusminimizingprotectivecurrentrequirementsand costs. Also, lower current usage generally means less chance of stray current effects on other structures. + +147 + + +Cathodic Protection +Cathodic protection is an effective tool to control cor-rosion of metallic structures, such as water lines and tanks,buriedorimmersedinacontinuouselectrolyte bymakingthemetalstructurethecathodeandapply-ing direct current from an anode source. By making theentirestructurethecathode,allanodeareasfrom the local corrosion cells are eliminated, and DC cur-rent is prevented from leaving the structure, thereby stopping further corrosion. +The most common sacrificial anode is made of magnesium. Magnesium has the highest natural potential of the metals listed in the electromotive series and, therefore, the greatest current-producing capacityoftheseries.Zincanodesaresometimesused in very low-resistivity soils where current-producing capacity such as that of magnesium is not required. +Thetwoprovenmethodsofapplyingcathodicpro-tectionarewith(1)galvanicanodesand(2)impressed currentsystems.Thebasicdifferencebetweenthetwo types of protection is as follows: The galvanic anode system depends on the voltage difference generated between the anode material and the structure mate-rialtocauseaflowofDCcurrenttothestructure.The impressed current system utilizes an AC/DC rectifier to provide current to relatively inert anodes and can be adjusted to provide the necessary voltage to drive therequiredcurrenttothestructuresurfaces.Choice of the proper system depends on a number of factors. Each has its advantages, which are discussed below. Galvanic anodes Galvanic anodes are used most advantageously on coated structures in low soil re-sistivity where current requirements are low. Some advantages and disadvantages of galvanic anodes are as follows: +Advantages: +1. Relatively low installation cost. +2. Do not require external power source. 3. Low maintenance requirements. +4. Usually do not cause adverse effects on foreign structures. +5. Can be installed with pipe, minimizing right-of-way cost. +Disadvantages: +1. Driving voltage is low (approximately 0.15 V). 2. Current output is limited by soil resistivity. +3. Not applicable for large current requirements. +The galvanic anode system of an active metal anode, such as magnesium or zinc, is placed in the electrolyte (soil or water) near the structure and con-nected to it with a wire. This is illustrated in Figures 8-12 and 8-13. Cathodic protection is achieved by +148 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +current flow due to the potential difference between the anode (metal) and the cathode (structure). A corrosion cell or battery is created, and current flows from the corroding anode material through the soil to the cathode or protected structure. Hence the gal-vanic anode is deliberately caused to waste itself to preventcorrosionoftheprotectedstructure.Because the galvanic anode system relies on the difference in voltage between two metals, which in most cases is limited to 1.0 V or less, the current generated by the anodes is usually low (approximately 0.1 to 0.5 A per anode). +Galvanic anode systems are usually used for structures having small current requirements, such as well-coated, small-diameter pipes; water heaters; sewage lift stations; some offshore structures; and structures in congested areas where currents must be kept low to avoid detrimental effects on other structures.Galvanicanodesmaybeinstalledinbanks at specific locations. They are, however, usually dis-tributedaroundprotectedstructuresbecauseoftheir limited current output. + +Asanexample,consideringapipe-to-soilpotential of0.85Vasprotectionforasteelpipeline,thedriving potential of zinc anodes is 0.25 V and for magnesium is 500 A-h/lb (1795 C/kg). The actual life of anodes of a given weight at a known current output can be calculated using the following formulas: +Equation 8-3 +LM = 57.08 × w +i + +Equation 8-4 +Lz = 38.2i × w +where: +LM = Life of magnesium anode (yr) Lz = Life of zinc anode (yr) +w = Weight of anode, lb (kg) i = Output of anode (mA) +The controlling factor for current output of zinc and magnesium anodes is soil resistivity. When soil resistivity is known or determined, then the current outputofvariouslysizedanodesforeithermagnesium or zinc can be estimated as follows: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-12 Cathodic Protection by the Sacrificial Anode Method +Chapter 8 — Corrosion 149 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-13 Typical Sacrificial Anode Installation + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 8-14 Cathodic Protection by the Impressed Current Method +150 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Equation 8-5 +iM = 150,000 × f +p + +Equation 8-6 +iZ = 150,000 × f × 0.27 +p + +where: +iM = Current output of magnesium (mA) iZ = Current output of zinc (mA) +p = Soil resistivity (Ω-cm) f = Anode size factor +Cost of galvanic cathodic protection generally favors the use of zinc anodes over magnesium at soil resistances below 1500 Ω-cm and the use of magne-sium at soil resistances over 1500 Ω-cm. +Impressed current The impressed current system, illustrated in Figure 8-14, differs substantially from the galvanic anode system in that it is externally powered,usuallybyanAC-DCrectifier,which allows great freedom in adjustment of current output. Current requirements of several hundred amperes can be handled by impressed current systems. The impressed currentsystemusuallyconsistsofgraphite or high-silicon iron anodes connected to an AC-DC rectifier, which, in turn, is wired to the structure being protected. Current output is determined by adjustment of the rectifier voltage to provide current as required. The system is not limited by potential difference between metals, and voltage can be adjusted to provide adequate driving force to emit thenecessarycurrent.Impressedcurrentsystems are used for structures having large current require-ments,suchasbarepipe;tankfarms;large-diameter, cross-country pipe lines; cast-iron water lines; and many offshore facilities. +Impressed current cathodic protection has the following advantages and disadvantages: +Advantages: +1. Large current output. +2. Voltage adjustment over a wide range. +3. Can be used with a high soil resistivity environ-ment. +4. Can protect uncoated structures. +5. Can be used to protect larger structures. + +Disadvantages: +1. Higher installation and maintenance cost. 2. Power costs. +3. Can cause adverse effects (stray current) with foreign structures. +When designing impressed current cathodic protection systems, the engineer must determine + +the type and condition of the structure. Obtaining knowledge of the presence or lack of coating, size of structure, electrical continuity, and location is a nec-essary first step. Next, the availability of power and ease of installing the ground bed are required. After all of the above are satisfactorily done, it is generally necessary to perform a current-requirement test uti-lizing a portable DC generator or storage batteries. This defines an apparent DC current requirement to protectthestructure.Teststodetermineanyadverse effectsshouldalsobeconductedonforeignstructures atthistime.Anycurrentdrainedtoforeignstructures should be added to the current requirements. After the total current requirement is known, the ground bed is designed so that the circuit resistance is rela-tively low. Actual ground-bed design is dependent on soil resistivity. A number of empirical formulas are available to determine the number of parallel anodes required for a certain circuit resistance. +Cathodic protection criteria Criteria for de-termining adequate cathodic protection have been established by The National Association of Cor-rosion Engineers (NACE). These criteria are based onmeasuringstructure-to-electrodepotentialswith a copper-sulfate reference electrode. The criteria are listed for various metals, such as steel, cast iron, aluminum, and copper, and may be found in NACE Standard RP-01. +Cathodicprotectionservesitspurposebest,andis by far the most economical, when it is properly coor-dinated with the other methods of corrosion control, especially coating. In general, the least expensive, easiest to maintain, and most practical system is to apply a good-quality coating to a new structure and thenusecathodicprotectiontoeliminatecorrosionat the inevitable breaks in the coating. The reason for this is that it takes much more current and anodes to protect bare metal than it does to protect coated metal. The amount of protective current required is proportional to the area of metal exposed to the electrolyte. +In addition to using coatings, it is necessary to assure continuity of the structures to provide pro-tection of the whole structure. This also prevents undesirable accelerated stray current corrosion to the parts of the structure that are not electrically continuous.Therefore,allnoncontinuousjoints,such asmechanical,push-on,orscrewedjointsinpipelines, must be bonded. All tanks in a tank farm or piles on a wharf must be bonded together to ensure electrical continuity. +Other important components used in effective cathodic protection systems are dielectric insulation and test stations. Dielectric insulation is sometimes used to isolate underground protected structures from above-ground structures to reduce the amount +Chapter 8 — Corrosion + + +of cathodic protection current required. Care must be taken to avoid short-circuiting (bypassing) the insulation, or protection can be destroyed. Test sta-tionsarewiresattachedtotheundergroundstructure (pipeline or tank) to provide electrical contact for the purposeofdeterminingprotectioneffectiveness.Test stations are also used to make bonds or connections between structures when required to mitigate stray-current effects. +Costs of cathodic protection Corrosion of under-ground,ferrousmetalstructurescanbeeconomically controlled by cathodic protection. Cathodic protec-tion costs are added to the initial investment since they are a capital expense. To be economically sound, thespendingofthefundsmustyieldafairreturnover the expected life of the facility. +To protect a new facility requires an initial in-crease of perhaps 10% in capital investment. Payout time is usually 10 to 15 years; thereafter, appreciable savingsaccrueduetothisinvestment,whichprevents or reduces the frequency of leaks. Effective corrosion control through the application of cathodic protec-tion reduces the leak frequency for a structure to the minimum with minimum cost. +Cathodic protection systems must be prop-erly maintained. Rectifier outputs must be checked monthly.Changesoradditionstotheprotectedstruc-turemustbeconsideredtoseeifchangesoradditions to the cathodic protection system are required. An-nualinspectionsbyacorrosionengineerarerequired to ensure that all malfunctions are corrected, and cathodic protection continues unhampered. +Inhibitors (Water Treatment) +Plant utility services such as boiler feed water, con-densate, refrigerants, and cooling water require the addition of inhibitors or water treatment. Boiler feed watermustbetreatedtomaintainproperpHcontrol, dissolvedsolidlevels,andoxygencontent.Condensate requirestreatmenttocontrolcorrosionbyoxygenand carbon dioxide. Brine refrigerants and cooling water in closed-loop circulating systems require proper inhibitors to prevent corrosion. +Water treatment may consist of a simple adjust-mentofwaterhardnesstoproducenaturallyforming carbonate films. This carbonate film, if properly adjusted, will form to a controlled thickness just suf-ficient to prevent corrosion by keeping water from contacting the metal surface. In cooling water, where hardness control is not practical, inhibitors or film-forming compounds may be required. +Sodiumsilicateandsodiumhexameta-phosphate are examples of film-forming additives in potable water treatment. A tight, thin, continuous film of silica (water glass) or phosphate adheres to the metalsurface,preventingpipecontactwiththewater. + +151 + + +(Phosphate additives to potable water are limited or prohibited in some jurisdictions.) +In closed-loop cooling systems, and systems in-volvingheat-exchangesurfaces,itmaynotbepossible tousefilm-formingtreatmentbecauseofdetrimental effects on heat transfer. In these cases, inhibitors are used; these control corrosion by increasing polariza-tion of anodic or cathodic surfaces and are called “anodic” or “cathodic inhibitors,” respectively. The anodic or cathodic surfaces are covered, preventing completion of the corrosion cell by elimination of either the anode or cathode. +When water treatment or inhibitors are used, a testing program must be established to ensure that proper additive levels are maintained. In some cases, continuousmonitoringisrequired.Also,environmen-tal considerations in local areas must be determined before additives are used or before any treated water is discharged to the sanitary sewer or storm drainage system. + +GLOSSARY +Active The state in which a metal is in the process of corroding. +Active potential The capability of a metal cor-roding based on a transfer of electrical current. +Aeration cell An oxygen concentration cell– an electrolytic cell resulting from differences in the quantity of dissolved oxygen at two points. +Amphoteric corrosion Corrosion usually caused byachemicalreactionresultingfromaconcentration of alkaline products formed by the electrochemical process. Amphoteric materials are those materials thataresubjecttoattackfrombothacidicandalkaline environments. Aluminum and lead, commonly used in construction, are subject to amphoteric corrosion in highly alkaline environments. The use of cathodic protectioninhighlyalkalineenvironments,therefore, intensifies the formation of alkaline byproducts. +Anaerobic Free of air or uncombined oxygen. +Anion A negatively charged ion of an electrolyte that migrates toward the anode under the influence of a potential gradient. +Anode Negative in relation to the electrochemical process. The electrode at which oxidation or corrosion occurs. +Anodic protection An appreciable reduction in corrosion by making a metal an anode and maintain-ing this highly polarized condition with very little current flow. +Cathode Positive in relation to the electro-chemicalprocess.Theelectrodewherereduction(and practically no corrosion) occurs. +152 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Cathodic corrosion An unusual condition in which corrosion is accelerated at the cathode because cathodic reaction creates an alkaline condition corrosive to certain metals, such as alu-minum, zinc, and lead. +Cathodic protection Reduction or elimination of corrosion by making the metal a cathode by means of an impressed DC current or attachment to a sac-rificial anode. +Cathodic The electrolyte of an electrolytic cell adjacent to the cathode. +Cation A positively charged ion of an electrolyte that migrates toward the cathode under the influence of a potential gradient. +Caustic embrittlement Weakening of a metal resulting from contact with an alkaline solution. +Cavitation Formationandsuddencollapseofvapor bubbles in a liquid, usually resulting from local low pressures,suchasonthetrailingedgeof an impeller. This condition develops momentary high local pres-sure which can mechanically destroy a portion of the surface on which the bubbles collapse. +Cavitation-corrosion Corrosion damage result-ing from cavitation and corrosion: metal corrodes, pressure develops from collapse of the cavity and removes the corrosion product, exposing bare metal to repeated corrosion. +Cell Acircuitconsistingofananodeandacathodein electrical contact in a solid or liquid electrolyte. +Concentration cell A cell involving an electrolyte and two identical electrodes, with the potential resulting from differences in the chemistry of the environments adjacent to the two electrodes. +Concentration polarization That portion of the polarization of an electrolytic cell produced by con-centration changes resulting from passage of electric current through the electrolyte. +Contactcorrosion Corrosionofametalatanarea where contact is made with a (usually nonmetallic) material. +Corrosion Degradation of a metal by chemical or electrochemical reaction with its environment. +Corrosion fatigue Reduction of fatigue durability by a corrosive environment. +Corrosion fatigue limit The maximum repeated stress endured by a metal without failure in a stated number of stress applications under defined condi-tions of corrosion and stressing. +Corrosion mitigation The reduction of metal loss or damage through use of protective methods and devices. + +Corrosion prevention The halting or elimination of metal damage through use of corrosion-resisting materials, protective methods, and protective devices. +Corrosion potential The potential that a corroding metal exhibits under specific conditions of concentration, time, temperature, aeration, velocity, etc. +Couple A cell developed in an electrolyte resulting from electrical contact between two dissimilar met-als. +Cracking Separation in a brittle manner along a single or branched path. +Crevice corrosion Localized corrosion resulting from the formation of a concentration cell in a crack formed between a metal and a nonmetal, or between two metal surfaces. +Deactivation The process of prior removal of the active corrosion constituents, usually oxygen, from a corrosive liquid by controlled corrosion of expendable metal or by other chemical means. +Dealloying The selective leaching or corrosion of a specific constituent from an alloy. +Decomposition potential (or voltage) The practical minimum potential difference necessary to decompose the electrolyte of a cell at a continuous rate. +Depolarization The elimination or reduction of polarization by physical or chemical means; depolarization results in increased corrosion. +Deposit attack (deposition corrosion) Pitting corrosion resulting from accumulations on a metal surface that cause concentration cells. +Differentialaerationcell Anoxygenconcentra-tion cell resulting from a potential difference caused by different amounts of oxygen dissolved at two loca-tions. +Drainage Conductionofcurrent(positiveelectric-ity)fromanundergroundmetallicstructurebymeans of a metallic conductor. +Electrode A metal in contact with an electrolyte thatservesasasitewhereanelectricalcurrententers the metal or leaves the metal to enter the solution. +Electrolyte An ionic conductor (usually inaque-ous solution). +Electromotiveforceseries(e.m.f.series) Alistof elements arranged according to their standard elec-trodepotentials,thesignbeingpositiveforelements havingpotentialsthatarecathodictohydrogen and negative for elements having potentials that are anodic to hydrogen. (This convention of sign, histori-callyandcurrentlyusedinEuropean literature, has +Chapter 8 — Corrosion + + +been adopted by the Electrochemical Society and the National Bureau of Standards; it is employed in this publication. The opposite convention of G. N. Lewis has been adopted by the American Chemical Society.) +Electronegative potential A potential corres-ponding in sign to those of the active or anodic members of the e.m.f. series. Because of the existing confusion of sign in the literature, it is sug-gested that “anodic potential” be used whenever “electronegative potential” is implied. (See “electro-motive force series.”) +Electropositivepotential Apotentialcorrespond-ing in sign to potentials of the noble or cathodic members of the e.m.f. series. It is suggested that “cathodic potential” be used whenever “electroposi-tive potential” is implied. (See “electromotive force series.”) +Flash attack A heavily etched, dark surface re-sultingfromcontaminatedpassivatingsolutionswith high chloride levels. +Forceddrainage Drainageappliedtounderground metallic structures by means of an applied e.m.f. or sacrificial anode. +Galvanic cell A cell consisting of two dissimi-lar conductors in contact with an electrolyte, or two singular conductors in contact with dissimilar electrolytes. More generally, a galvanic cell converts energy liberated by a spontaneous chemical reaction directly into electrical energy. +Galvanic corrosion Corrosion that is increased because of the current caused by a galvanic cell (sometimes called “couple action”). +Galvanic series A list of metals arranged ac-cording to their relative corrosion potential in some specific environment; sea water is often used. + +153 + + +Impingementattack Localizederosion-corrosion caused by turbulence or impinging flow at certain points. +Inhibitor A substance that, when added in small amounts to water, acid, or other liquids, sharply re-duces corrosion. +Ion Anelectricallychargedatomorgroupofatoms known as “radicals.” +Natural drainage Drainagefromanunderground metallic structure to a more negative structure, such as the negative bus of a trolley substation. +Noble potential Apotentialsubstantiallycathodic compared to the standard hydrogen potential. +Open-circuit potential The measured potential of a cell during which no significant current flows in the external circuit. +Overvoltage The difference between the potential of an electrode at which a reaction is actively taking place and another electrode at equilibrium for the same reaction. +Oxidation Loss of electrons, as when a metal goes from the metallic state to the corroded state. Thus, when a metal reacts with oxygen, sulfur, etc., to form a compound as oxide, sulfide, etc., it is oxidized. +Oxygenconcentrationcell Agalvaniccellcaused by a difference in oxygen concentration at two points on a metal surface. +Passive The state of a metal when its behavior is much more noble (resists corrosion) than its position in the e.m.f. series would predict. This is a surface phenomenon. +pH A measure of the acidity or alkalinity of a solu-tion (from 0 to 14). A value of seven (7) is neutral; low numbers (0-6) are acidic, large numbers (8-14) are alkaline. + + + +General corrosion Corrosion in a uniform manner. + + +Pitting Localized light corrosion resulting in deep penetration at a small number of points. + + + +Graphitization(graphiticcorrosion) Corrosion of gray cast iron in which the metallic constituents are converted to corrosion products, leaving the graphite flakes intact. Graphitization is also used in a metallurgical sense to mean the decomposition of iron carbide to form iron and graphite. +Hydrogenembrittlement Hydrogenembrittlement causes a weakening of the metal by the entrance of hydrogen into the metal through, for example, pick-ling or cathodic polarization. +Hydrogen overvoltage A higher than expected difference in potential associated with the liberation of hydrogen gas. + + +Polarization The shift in electrode potential resulting from the effects of current flow, measured withrespecttothe“zero-flow”(reversible)potential, i.e.,thecounter-e.m.f.causedbytheproductsformed or concentration changes in the electrode. +Protective potential A term sometimes used in cathodic protection to define the minimum potential requiredtosuppresscorrosion.Forsteelinseawater, thisisclaimedtobeabout0.85Vasmeasuredagainst a saturated calomel cell. +Remote electrode (remote earth) Remote earth is any location away from the structure at which the potential gradient of the structure to earth is constant. The potential of a structure-to-earth will changerapidlynearthestructureandifremoteearth +154 ASPE Plumbing Engineering Design Handbook — Volume 1 + +is reached, there will be little or no variation in the voltage. +Resistivity The specific opposition of a material. Measured in ohms (Ω) to the flow of electricity. +Rusting Corrosion of iron or an iron-base alloy to form a reddish-brown product that is primarily hydrated ferric oxide. +Straycurrentcorrosion Corrosionthatiscaused by stray currents from some external source. +Stress corrosion/stress-accelerated corro-sion Corrosion that is accelerated by stress. +Stress corrosion cracking Cracking that results from stress corrosion. +Tuberculation Localized corrosion at scattered locations resulting in knob-like mounds. +Under-film corrosion Corrosion that occurs un-der lacquers and similar organic films in the form of randomly distributed hairlines (most common) or spots. +Weld decay Corrosion, notably at specific zones away from a weld. + +REFERENCES +1. Bosich, Joseph F. 1970. Corrosion prevention for practicing engineers. +2. ClaesandFitzgerald.1975-1976.Fundamentalsof underground corrosion control. Plant Engineer-ing Technical Publishing. Plant Engineering. New York: McGraw-Hill. +3. Fontana, Mars G., and Norbert D. Greene. 1967. Corrosion engineering. New York: McGraw-Hill. +4. Kullen, Howard P. Corrosion. Power. December 1956: 74-106. +5. Laque, F. L., and H. R. Copson. 1965. Corrosion and resistance of metals and alloys. 2nd ed. New York: Reinhold Publishing. +6. National Association of Corrosion Engineers. 1971. NACE basic corrosion course. Houston: National Association of Corrosion Engineers. +7. Peabody, A. W. 1967. Control of pipeline corro-sion.Houston:NationalAssociationofCorrosion Engineers. +8. Shreir, L. L. 1963. Corrosion control. Vol. 2 of Corrosion. New York: John Wiley and Sons. +9. Speller, Frank N. 1963. Corrosion causes and prevention. New York: McGraw-Hill. +10. Uhlig,HerbertH.1940.Corrosionhandbook.New York: John Wiley and Sons. +9 + + + + + +Seismic Protection of Plumbing Equipment + +INTRODUCTION +Every structure is designed for vertical, or gravity, loads. In the case of pipes, gravity loads include the weight of the pipe and its contents, and the direction of the loading is downward. Seismic loads are the horizontal forces exerted on a structure during an earthquake.Earthquakeforces can be in any direc-tion. The ordinary supports designed for gravity loads generally take care of the vertical loads during an earthquake. Therefore, the primary emphasis in seismic design is on lateral, or horizontal, forces. +Study of seismic risk maps, Figures 9-1 and 9-2, indicatesthatthepotentialfordamagingearthquake motion is far more pervasive than is commonly known.Completeseismicdesignrequirements,includ-ing construction of nonstructural elements (piping, ductwork, conduit, etc.), are in effect in only a small fraction of the areas that could be rated as having a + +highormoderaterisk. Seismic design requirements for nonstructural elements, except for heavy clad-ding panels, are seldom enforced even in California, which is considered the innovator in state building code requirements related to seismic movement. However, the nonstructural damage resulting from recentsmallearthquakesandthelargeUnitedStates and Japanese shocks shows that the major advance-ments in building structural design, by themselves, may not have produced an acceptable level of overall seismic protection. Now that—at least for modern structures designed and built in accordance with current seismic codes—thepotentialforcollapseor other direct, life-endangering structural behavior is quitesmall,attentionhasshiftedtononstructurallife safetyhazards,continuedfunctionality,andeconomic issues. The cost of an interruption in a building's ability to function—which could cause a loss of rent, + + + + + + + + + + + + + + + + + + + + + + + +Figure 9-1 Significant Earthquakes in the United States +156 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +disruption of normal business affairs, or curtailment of production—is coming more into focus. +The costs of seismic protection of plumbing components and equipment range from small—such as those to anchor small tanks—to a considerable percentage of installation costs—such as those for complete pipe bracing systems. Beyond protection of life,thepurposeorcost-benefitrelationshipofseismic protection must be clearly understood before the ap-propriateresponsetotheriskcanbemade.Thedesign professional responsible for any given element or system in a building is in the best position to provide that response. Seldom, however, can rational seismic protection be supplied solely by a single discipline. Building systems are interdependent in both design and function, and good seismic protection, like good overallbuildingdesign,isbestprovidedbyemploying a cooperative, interdisciplinary approach. +This chapter is intended to provide a basic un-derstanding of the mechanisms of seismic damage andtheparticularvulnerabilitiesofplumbingsystems and equipment. It is desirable that the professional sufficientlyunderstandtheprobleminordertoselect the appropriate seismic protection in any situation, based on a ranking of the damage susceptibility and a knowledge of the scope of mitigation techniques. +The seismic-protection techniques currently in use for buildings are described in general. Although specificseismic-protectiondetailsforsomesituations are discussed, it is suggested that structural-design + +assistancebeobtainedfromaprofessionalofthatdis-cipline. Care should be taken in the design of seismic controlsystems.Properdesignmayrequireassistance from an engineer experienced in these systems. In allcases,thecurrentlocalbuildingcoderequirements for seismic movement should be consulted and used as minimum standards. +Thedetailedanalysisanddesigntechniquesused for nuclear power plants and other heavyindustrial applications,whilesimilarinnaturetothosediscussed here,areconsideredinappropriateformostbuildings and are beyond the scope of this chapter. References are given throughout the text for additional study in specific areas of interest. + +CAUSES AND EFFECTS OF EARTHQUAKES +Plate Tectonics and Faults +All seismic activity on the earth’s surface, including earthquakes and volcanoes, are now understood to be caused by the relative movement of pieces of the earth’s crust. Ten of the largest pieces, called plates, and their prevailing motions, are shown in Figure 9-3. The edges of these plates make up the world’s primary fault systems, along which 90% of all earth-quakes occur. The balance of earthquakes occur on countless additional, smaller faults that lie within plate boundaries. The causes and exact mechanisms of these intraplate earthquakes, which affect much + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 9-3 World Map Showing Relation Between the Major +Tectonic Plates and Recent Earthquakes and Volcanoes. Note: Earthquake epicenters are denoted by small dots, volcanoes by large dots. +Chapter 9 — Seismic Protection of Plumbing Equipment 157 + + + + + + + + + + + + + + + + + + + + + + + + + + +(A) + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 9-2 (A) Seismic Zone Map of the United States; (B) Map of Seismic Zones and Effective, Peak-Velocity-Related +Acceleration (Av) for Contiguous 48 States. Note: Linear interpolation between contours is acceptable. +158 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +of the middle and eastern United States, are not well understood. +The relative movement at plate boundaries is often a sliding action, such as occurs along the San AndreasFaultalongthewestcoastofNorthAmerica. The plates can also converge, when one plate slides beneath another, or diverge, when molten rock from below rises to fill the voids that gradually form. Al-though overall plate movement is extremely slow, properly measured only in a geologic time frame, the local relative movement directly at the fault plane can occur either gradually (creep) or suddenly, when tremendous energy is released into the surrounding mass. +The most common mechanism used to describe earthquakes is the “elastic rebound theory,” wherein a length of fault that is locked together by friction is strained to its capacity by the continuing plate move-ment, and both sides spring back to their original positions (See Figure 9-4). Waves in a variety of pat-terns emanate from this fault movement and spread in every direction. These waves change throughout the duration of the earthquake, add to one another, andresultinextremelycomplicatedwavemotionsand vibrations.Atanysiteawayfromthefault,thethree-dimensionalmovementofthesurface,whichiscaused by combinations of direct, reflected, and refracted waves,isknownsimplyas“groundshaking.”Energy content or intensity of the ground shaking decreases with distance from the causative fault, although be-causecertainstructurescanbetunedintothemotion, this is not always apparent. The horizontal, vertical, androtationalforcesonstructuresareunpredictable in direction, strength, and duration. The structural load is proportional to the intensity of shaking and to the weight of the supported elements. +Bycombiningknowledgeofknownfaultlocations with historical and instrumented ground motion records, seismologists can construct maps showing zones of varying expected ground motion. Figure 9-2 + +shows such maps, which were used to develop design criteria zoning for a national seismic code. +Damage from Earthquakes +Four separate phenomena created by earthquakes can cause damage: +1. Surface fault slip (ground rupture). +2. Wave action in water created by seismic move-ment (called tsunamis in open bodies of water, seiches in closed bodies of water). +3. Ground shaking. +4. Groundfailure,suchasasuddenchangetoliquid characteristics in certain sands caused by in-creased pore water pressure called "liquefaction" and "landslides." +It is accepted that buildings and their contents are not designed to withstand ground rupture caused by seismic events. Protection from this is obtained by avoiding potentially dangerous sites. Underground piping can be severely damaged by either fault rup-tureorgroundfailure,andfrequentlypipelinesmust cross areas with these potential problems. Seismic design provisions for underground systems in these cases consist of special provisions for the consider-able distortion expected in the ground or redundant systems and valving, such that local damage can be accepted without serious consequences. + +EARTHQUAKE MEASUREMENT AND SEISMIC DESIGN +Ground Shaking and Dynamic Response The primary thrust of seismic design, as it relates to buildings, is to protect against the effects of ground shaking. Although recently there has been concern that surface waves may damage structures by pure distortion, virtually all design is done assuming the entire ground surface beneath a structure moves as a unit, producing a shaking or random motion whose + + + + + + + + + + + + + + +Figure 9-4 Elastic Rebound Theory of Earthquake Movement +According to the Elastic Rebound Theory, a fault is incapable of movement until strain has built up in the rocks on either side. As this strain accumulates, the earth’s crust gradually shifts (at a rate of about 2 inches a year along the San Andreas Fault). Rocks become distorted but hold their original positions. When the accumulated stress finally overcomes the resistance of the rocks, the earth snaps back into an unrestrained position. The “fling” of the rocks past each other +creates the shock waves we know as earthquakes. +Chapter 9 — Seismic Protection of Plumbing Equipment 159 + + + +unidirectionalcomponentscanbestudiedmathemati-cally and whose effects on structures can be analyzed using structural dynamics and modeling. The move-ment of the ground mass under a building during an earthquake is measured and recorded using the normalparametersofmotion,displacement,velocity, and acceleration. Two orthogonal plan components and one vertical component are used to completely describe the motion. The effect of each orthogonal plan component on the structure under design is considered separately. +The amplitude of displacement, velocity, and acceleration at any moment are, of course, related, as each measures the change in the other over time. Given the record of how one parameter has changed over time (time history), the other two can be calcu-lated. However, due to the direct relationship of force to acceleration (F-Ma) and also because acceleration is easiest to instrumentally measure, acceleration has become the standard measurement parameter. + +The characteristically spiked and jagged shape of the acceleration time history (accelergram, Figure 9-5) is universally recognized as being associated with earthquakes. +When any nonrigid structure, such as the pendu-lum or cart and spring of Figure 9-6(A) is subjected to a time history of base motion, the movement (D) of the mass (M) can be measured over time, and this recordofmotionsbecomesthedynamicresponse(K). Thedynamicresponsewillbedifferentthantheinput motion because of the inertial lag of the mass behind thebaseandtheresultantenergystoredbydistorting the connecting structure. The dynamic response to any input motion, then, will depend on the size of the mass and the stiffness of the supporting structure. +The Response Spectrum +Because of the difficulty of measuring all the varia-tions of distortion in a normal structure at each moment of time, a shorthand measure of maximum response is often used. The maximum response of a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 9-5 Earthquake Ground Accelerations in Epicentral Regions +160 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + +(A) + + + + + + + + + + + +(B) +Figure 9-6 Undamped Mechanical Systems: (A) Single-Degree-of-Freedom Systems; (B) Multiple-Degree-of- +Freedom Systems. + +seriesofsimplependulums(single-degree-of-freedom system)toagiventimehistoryofmotioniscalculated, and the resulting set of maximums is known as a "response spectrum." (See Figure 9-7.) The response parametercouldbedisplacement,velocity,oraccelera-tion, although acceleration is most often used. The variationindynamiccharacteristicsofeachpendulum in the infinite set is measured by the natural period of vibration. The natural period of any system is dependent on stiffness and mass and measures the length of one complete cycle of free (natural) vibra-tion. Frequency, or the inverse of the period, is also often used in place of the period. +If the input motion (or forcing function) for a structure is of constant frequency and matches the naturalfrequency,resonanceoccurs,andtheresponse istheoreticallyinfinite.Dampingthatoccurstosome degree in all real systems prevents infinite response, and the amplitude of the actual response will be proportional to the damping present. Damping is normally measured as a percentage of the amount of damping that would create zero response; that is, the pendulumwhensetinmotionwouldsimplyreturnto its at-rest position. The damping in most structures is between 2 and 10 percent. For any input motion, the response would depend on the amount of damp-ing present, and, therefore, responses (and response + +spectra) are often presented as families of similar curves, each corresponding to a different damping value. (Refer to Figure 9-7.) +By the response-spectrum technique, the maxi-mum single response to a given base motion of a structure with a known period and damping can be predicted. It must be remembered that the response spectra eliminates the time element from consider-ation because the maximums plotted for each period are likely to have occurred at different times during the time history. Every ground motion will have its own distinct response spectrum, which will show on a gross basis which vibratory frequencies were pre-dominant in motion. Since ground motions vary not only between earthquakes but between sites during the same earthquake, an infinite variety of response spectra must be considered possible. Fortunately, characteristics of wave transmission and physical properties of soil place upper bounds on spectral shapes. Using statistical analysis of many motions and curve fitting techniques, it is possible to create a design spectrum of energy stored by distorting the connecting structure. The spectrum that is theoreti-cally most appropriate for a dynamic response to any input motion, then, will depend upon the region or even the given site. +With such a design spectrum for acceleration, measured in units of the acceleration of gravity (e.g., the maximum horizontal force in single degree of freedom), systems can be closely approximated using the ordinate as a percentage of the system. +Just as the response of a structure on the ground can be calculated by consideration of the ground motion time history, the response of a system on any floor of a building can similarly be calculated if the time history of the floor motion is known. Using computers, it is possible to calculate such floor mo-tionsinstructuresusingbasegroundmotionasinput. Responsespectracanthenbecalculatedforeachfloor that would be appropriate for building contents or equipment. The vibratory response of the building is generally far more coherent than rock or soil, as the motion of floors is focused into the natural periods of the building. Floor response spectra are, therefore, often highly peaked around one or two frequencies, soresponsesnearertotheoreticalresonancearemore likely than they are on the ground. Responses 25 times greater than input acceleration can be calcu-lated in such circumstances where response spectra for ground motion usually show response multiples of 25. (See US Department of Defense 1973.) These extremeresponsesareunlikelyandarenotconsidered indesign,however,duetothemanynon-linearitiesin realstructuresandthelowpossibilityofnear-perfect resonance. +Chapter 9 — Seismic Protection of Plumbing Equipment 161 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 9-7 Response Spectrum + +The response of multidegree-of-freedom systems [Figure9-6(B)]cannotbesimplycalculatedfromare-sponsespectrum,butspectraareoftenusedtoquickly approximate the upper limit of the total lateral force on the system. A “pseudo-dynamic elastic analysis” can be done on any system using response spectra to obtain a close approximation of maximum forces or distortions. These analyses are typically done by an experienced engineer using a computer, as they can be labor intensive if performed manually. + +LEARNING FROM PAST EARTHQUAKES + +seismicjoints,or,onrareoccasions,evenbetween floors at a structure due to interstory drift. +An obvious method of determining failure modes and isolation elements susceptible to damage is to study the experience of past earthquakes. +Particularlyusefularethefollowingsummaries.1 (Concerningpiping,itshouldbepointedoutthatboth reports indicate that damage was light on an overall basis; the scattered damage found was as described below.) +The 1964 Alaska Earthquake +Damage summary + + + +Damage to Plumbing Equipment +Damage to plumbing equipment or systems in earth-quakes occurs in two ways: +1. Failure due to forces on the element resulting from dynamic response to ground or floor shak-ing. The most common example is the sliding or overturning of tanks. + +2. Failure due to forced distortions on the element caused by differential movement of two or more supports. This can occur at underground utility entrances to buildings, at building expansion or + + +1. Most pipe failures occurred at fittings. Most brazed or soldered joints were undamaged, many screwed joints failed, and a few caulked joints were pulled apart or twisted. +2. Failures in screwed joints often occurred where longunbracedhorizontalrunsofpipejoinedshort vertical risers or were connected to equipment. Small branch lines that were clamped tightly to the building were torn from large horizontal mains if these were unbraced and allowed to sway. + +1. Ayres, Sun, et al. 1973 and Ayres and Sun 1973. +162 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +3. Joints were loosened or pulled apart in long horizontal runs of unbraced cast-iron pipe, and hangers were bent, shifted, or broken. +4. Pipes crossing seismic joints were damaged if provisions were not made for the relative move-ments between structural units of buildings. +5. Thermalexpansionloopsandjointsweredamaged when the pipes were not properly guided. +6. Fire-sprinkler piping was practically undamaged because it was provided with lateral bracing. +7. Sand filter, water softener, domestic hot water, heating-hot-waterexpansionandcold-water-stor-age tanks shifted, toppled, or rolled over when they were not firmly anchored to buildings. +8. Hundredsofsmall,gas-firedandelectricdomestic waterheatersfellover.Manyofthelegsonwhich heatersstoodcollapsed,andventconnectorswere damaged. +9. Some plumbing fixtures were damaged by falling debris. +10. Vertical plumbing stacks in tall buildings were practically undamaged. + +2. Suspendedpipingsystemsshouldhaveconsistent freedom throughout; for example, branch lines should not be anchored to structural elements if the main line is allowed to sway. +3. If the piping system is allowed to sway, movable joints should be installed at equipment connec-tions. +4. Pipes leading to thermal expansion loops or flex-ible pipe connections should be guided to confine the degree of pipe movement. +5. Wheneverpossible,pipesshouldnotcrossseismic joints. Where they must cross seismic joints, ap-propriate allowance for differential movements must be provided. The crossing should be made at the lowest floor possible, and all pipe deflec-tions and stresses induced by the deflections should be carefully evaluated. Standards of the National Fire Protection Association (NFPA) for earthquake protection to fire-sprinkler systems should be referred to for successful, field-tested, installationdetailsthatareapplicabletoanypip-ing system. The latest revision to FM data sheet 2-8 for sprinkler systems is also valuable as a reference guide. + + + +The 1971 San Fernando Earthquake Damage summary +1. Unanchored heavy equipment and tanks moved and damaged the connected piping. +2. Heavy equipment installed with vibration isola-tion mounts moved excessively, often destroyed the isolators, and damaged the connected pip-ing. +3. Cast-iron supports for heavy cast-iron boilers failed. +4. Pipes failed at threaded connections to screwed fittings. Some cast-iron fittings were fractured. +5. Pipes were damaged when crossing separations between buildings. +6. Screwed pipe legs under heavy tanks failed, and angle iron legs were deformed. +7. Plumbing fixtures were loosened from mounts, and enamel was chipped. +8. Domestic water heater legs were bent or col-lapsed. +Theoverallrecommendationsapplicabletoplumbing equipmentfromtheAlaskareport,madeprimarilyas a response to observed damage, are worth relating: + + +6. Supports for tanks and heavy equipment should be designed to withstand earthquake forces and should be anchored to the floor or otherwise se-cured. +7. Suspended tanks should be strapped to their hanger systems and provided with lateral brac-ing. +8. Pipe sleeves through walls or floors should be large enough to allow for the anticipated move-ment of the pipes and ducts. +9. Domestic water heaters should be provided with legs that can withstand earthquake forces, and the legs should be anchored to the floor and/or strapped to a structurally sound wall. +10. Earthquake-sensitive shut-off valves on gas-ser-vice lines should be provided where maximum protection from gas leaks is required. +11. Vibratingandnoisyequipmentshould,ifpossible, be located far from critical occupancies, so that the equipment can be anchored to the structure, and vibration isolation is not required. +Avoid mounting heavy mechanical equipment on the top or upper floors of tall buildings unless all vibration-isolationmountsandsupportsarecare-fully analyzed for earthquake-resistant design. + + + +1. Pipelines should be tied to only one structural system. Where structural systems change, and relativedeflectionsareanticipated,movablejoints should be installed in the piping to allow for the same amount of movement. + +Whenequipmentandtheattachedpipingmustbe isolatedfromthestructurebyvibrationisolators, constraints should be used. +Chapter 9 — Seismic Protection of Plumbing Equipment 163 + + + +SEISMIC PROTECTION TECHNIQUES +General +Assuming that the building in which the piping sys-tems are supported is designed to perform safely in response to earthquake forces, the piping systems must be designed to resist the seismic forces through the strength of the building attachments. +The design professional must consider local, state,andfederalseismicrequirements,asapplicable, in the area of consideration. Only those engineers with seismic experience should design the supports required for seismic zones. Close coordination with the structural engineer is required to ensure the structural system properly supports the mechanical systems and equipment. +Equipment +Seismic protection of equipment in buildings, as controlled by the design professional, consists of preventing excessive movement that would either damagetheequipmentdirectlyorbreaktheconnected services.EquipmentcertificationisrequiredintheIn-ternational Building Code (IBC) 2000 for equipment with importance factor of 1.5. Also, piping systems with importance factor of 1.5 must be completely designedanddetailedontheplansincludingsupports and restraints. These are major issues. +Other than meeting the requirements set forth in IBC 2000, the ability of the equipment housing or working parts to withstand earthquake vibration is generally not formally considered for one or more of the following reasons: +1. Such failure would not endanger life. +2. Continued functioning is not always required. +3. Most equipment will experience transportation shocks or working vibrations that are similar to earthquakemotions,andthehousingandinternal parts are therefore considered adequate. +4. The design professional has little control over themanufacturingprocess.Competitivelypriced equipmentspeciallyqualifiedtoresistearthquake motion is not available. +5. Because of a lack of performance data for equip-ment that is anchored, the extent of the problem is unknown. +Movementtobepreventedisessentiallyoverturn-ing and sliding, although these effects can take place with a variety of characteristics: +1. Overturning (moment). +A. Overturn of equipment. + + +B. Failure in tension or compression of perim-eterlegs,vibrationisolators,hangers,ortheir supports. +C. Excessive foundation rotation. + +2. Sliding (shear). +A. Sliding of floor-mounted equipment. +B. Swinging of hung equipment. +C. Excessive sideways failure of legs, stands, tank mounts, vibration isolators, or other supports. Although these failures are often described as local overturning of the support structure, they are categorized as a shear or slidingfailurebecausetheyarecausedbythe straight lateral movement of the equipment rather than the tendency to overturn. +Prevention of overturning and sliding effects can best be discussed by considering the categories of mounting equipment, such as fixed or vibration-isolated, and floor-mounted or hung. +Fixed, floor-mounted equipment This group includes tanks, water heaters, boilers, and other equipmentthatcanrestdirectlyonthefloor.Although anchoring the base of such equipment to the floor is obvious, simple, and inexpensive, it is commonly omitted. Universal base anchorage of equipment un-doubtedly would be the single largest improvement and would yield the largest cost-benefit ratio in the entire field of seismic protection of plumbing equip-ment. This anchoring is almost always to concrete and is accomplished by cast-in-place anchor bolts or other inserts, or by drilled or shot-in concrete an-chors.Theconnectiontotheequipmentbaseistotally configuration dependent and may require angles or other hardware to supplement the manufactured base. For elements that have a high center of gravity, it may be most efficient to resist overturning by brac-ing at the top, either diagonally down to the floor, to the structure above, or to adjacent structural walls. Vertical steel beams, or “strongbacks,” can also be added on either side of tall equipment to span from floortofloor;averticalslipjointconnectionshouldbe placed at the top of such beams to avoid unexpected interaction between the floor structures. +Tanks supported on cast-iron legs or threaded pipes have proven to be particularly susceptible to supportfailure.Thesetypesoflegsshouldbeavoided or have supplemental bracing. +Thehorizontalearthquakeloadsfromequipment mountedonorwithinconcretestandsorsteelframes should be braced from the equipment through the support structure and out the base. Concrete tank saddles often are not attached to the tank, are of inadequate strength (particularly in the longitudinal direction), are not anchored to the floor foundation, +164 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +or have inadequate provisions for earthquake-gener-atedforcesinthefloororfoundation.Steelequipment frames often have similar problems, some of which can be solved by diagonal bracing between legs. +Fixed,suspendedequipment Themostcommon element in this group is the suspended tank. Seldom are these heavy elements laterally braced. The best solution is to install the tank tightly against the structural member above, thus eliminating the need for bracing. However, even these tanks should be secured to the suspension system to prevent slip-ping. Where the element is suspended below the supportingmember,cross-bracingshouldbeinstalled in all directions to provide lateral stability. Where a tank is suspended near a structural wall, struts to the wall may prove to be simpler and more effective than diagonal bracing. +Vibration-isolated, floor-mounted equip-ment This group includes units containing internal moving parts, such as pumps, motors, compressors, and engines. The entire concept of vibratory isolation by flotation on a nontransmitting material (spring, neoprene, cork, etc.), although + +necessary for equipment-operating movement, is at cross-purposeswithseismicanchorage.Theisolation material generally has poor lateral, force-carrying capacityinitself,plus the housing devices are prone to overturning. It is, therefore, necessary to either supplement conventional isolators with separate snubbing devices (Figure 9-8), or to install spe-cially designed isolators that have built-inrestraints and overturning resistance (Figure 9-9). Isolators withminimallateral-forceresistanceusedinexterior applications to resist wind are usually inadequate for large seismic forces and are also commonly made of brittle cast iron. The possibility of complete isola-tor unloading and ensuing tension forces due to overturning or vertical acceleration also must be considered.Manufacturers'ratingsoflateralloadsfor isolators should be carefully examined, for often the capacity is limited by the anchorage of the isolators themselves, which is normally unspecified. +The containment surfaces in these devices must be hard connections to the equipment or its base to avoid vibratory short circuits. Because this require-ment for complete operational clearance allows a small, ¼-d" (6.4-9.5 mm), movement before restraint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(A) +Figure 9-8 Snubbing Devices: +(A) Three-Dimensional Cylinder Snubber + + +Figure 9-9 Isolators with Built-In Seismic Restraint +Chapter 9 — Seismic Protection of Plumbing Equipment 165 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(B) +Figure 9-8 Snubbing Devices: (B) Three-Directional Angle Snubbers +166 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +begins,resilientpadsareaddedtoeasetheshockload that could be caused by impact. +Because of the stored energy in isolation springs, itismoreefficienttoanchortheassembly,asrestraint is built into the isolator rather than being a separate unit. In retrofit applications, or occasionally due to dimensional limitations, separate snubbers are pref-erable. Once snubbers are decided upon, those that restrain in three dimensions are preferred because that minimizes the number required. Although some unconfirmed rubber-in-shear isolators are intended to resist loads in several directions, there is little data to indicate adequacy to resist the concurrent large amplitude dynamic loading that could occur in an earthquake. Unless such isolators are considered for real earthquake loading (as opposed to code re-quirements) with a suitable safety factor, additional snubbing is recommended. Rubin-in-shear isolators with metal housing are more likely to have the over-load capacity that may be needed to resist seismic loading, but unless they are specifically tested and rated for this loading, ultimate capacities should be compared with expected real seismic loads. +Vibration-isolated,suspendedequipment This is by far the most difficult type of equipment to re-strain, particularly if only a small movement can be tolerated.Thebestmethodistoplaceanindependent, laterally stable frame around the equipment with proper operating gaps padded with resilient mate-rial, similar to a snubber. However, this frame and its supportsystemcanbeelaborateandawkward.Anal-ternatemethodistoprovideaself-contained,laterally stable, suspended platform upon which conventional seismic isolators or snubbers can be mounted. +Smaller equipment bolted or welded directly to thestructuredoesn’tneedrestraints,buttheboltsor welds must be designed for seismic loads. However, equipment suspended close to the structure requires restraints. Isolators within hangers should always be installed tight against the supporting structural member. When hanger rods are used to lower the unit, cross bracing or diagonal bracing should be installed. +Cable that is installed taut, but allowed to sag under its own weight will allow vibration isolation to function. Additional slack is not required and should notbeallowed.Useofneoprenegrommetsorbushings is not required. The cable sag and cable flexibility provide adequate cushioning. +Piping Systems +Normally, piping suspended by hangers less than 12 inches (305 mm) in length, as measured from the top of the pipe to the bottom of the support where the hanger is attached, do not require bracing. The following piping shall be braced: + +1. Fuel oil, gas, medical gas, and compressed air piping 1-inch (25.4-mm) nominal diameter and larger. +2. Piping in boiler rooms, mechanical rooms, and refrigeration mechanical rooms 1¼-inch (31.8-mm) nominal diameter and larger. +3. Allpiping2½-inches(63.5-mm)nominaldiameter and larger. +Conventionally installed piping systems have survived earthquakes with minimal damage. Fitting failuresgenerallyoccuratornearequipmentconnec-tors where equipment is allowed to move, or where a main is forced to move and small branches connected tothemainareclampedtothestructuralelements.In theory, then, a few well-placed pipe restraints in the problemareascouldprovideadequateseismicprotec-tion. In practice, however, the exact configuration of piping is seldom known to the designer, and even if it was,thekeybracelocationsarenoteasytodetermine. Often,partialrestraintinthewronglocationisworse than no restraint at all. Correct practice is therefore toprovidecompleterestraintwhenseismicprotection of piping systems is advisable. This restraint can be appliedthroughoutthesystemorinlocal,well-defined areas such as mechanical or service rooms. +Although there are many variables to consider whenrestrainingpipeagainstseismicmovement,the techniques to do so are simple and similar to those used for hanging equipment. Fixing pipe directly to structural slabs, beams, columns, or walls is, of course, the simplest method. Many codes and guide-linesconsiderhangersoflessthan12inches(305mm) as being equivalent to direct attachment. For pipes suspended more than 12 inches (305 mm), diagonal braces to the structure above or horizontal struts to an adjacent structure are normally installed at verti-cal hanger locations. Vertical suspension hardware is usually incorporated into braces, both for efficiency and because it is readily available. +Connection to the pipe at transverse braces is ac-complished by bearing the pipe or insulation on the pipeclamporhanger.Attachmenttothepipeatlongi-tudinal brace points is not as simple. For small loads, tight-fitting clamps (such as riser clamps) dependent on friction are often used. For larger loadings, details commonlyusedforanchorpointsinhigh-temperature systems with welded or brazed direct connections to the piping may be necessary. Welding should be done by certified welders in accordance with American Welding Society (AWS) D 1.1 and shall use either the shielded or submerged arc method. +Transverse bracing shall be at 40 feet (12.2 m) maximum spacing, except that fuel oil and gas piping shall be at 20 feet (6.1 m) maximum spacing. Longi-tudinal bracing shall be at 80 feet (24.4 m) maximum +Chapter 9 — Seismic Protection of Plumbing Equipment 167 + + + +spacing, except that fuel oil and gas piping shall be at 40 feet (12.2) maximum spacing. +The many parameters that must be considered before the exact details and layout of a pipe bracing system can be completed are shown schematically in Figure 9-10. These parameters are discussed in more detail below: +1.Weightofpipeandcontents Sincethemotionbeing restrained is a dynamic response, the forces that must be resisted in each brace are proportional to the tributary weight. +2. Location of pipe The strength of structural members, particularly compression members, is sensitive to length, so a pipe that must run far from a structural support may require more or longer braces. In boiler service rooms, a horizon-tal grid of structural beams has sometimes been placed at an intermediate height to facilitate bracing of pipes. +3. Typeofstructure Theconnectionofhangersand braces to the structure is an important factor in determining a bracing system, as demonstrated by the following considerations: Many light roof-deck systems cannot accept point loads except at beam locations; pipe locations and brace layout are thereby severely limited unless costly cross beams are placed at every brace. Other roof and floor systems have significant limitations on the magnitude of point loads, which limit brace spac-ing. +Itisoftenunacceptabletohaveanchorsdrilledor shot into the underneath of prestressed concrete + +floors.Limitationsondepthandlocationalsoexist inthebottomflangeofsteelorreinforcedconcrete beams and in the bottom chord of joists. +Many steel floor-deck styles have down flutes 1½ in. (38.1 mm) or less in width; the strength of drilled or shot-in anchors installed in these loca-tions is questionable. +The structures of buildings that employ intersti-tial space may have the capacity to brace pipe to either the top or the bottom of the space, which greatly increases bracing layout flexibility. +4. Piping material The strength and ductility of the material will affect brace spacing. The stiff-ness will affect dynamic response and therefore loading. +5. Joint type The joint has proven to be the ele-mentmostlikelytobedamagedinpipingsystems; threaded and bell-and-spigot joints have been particularly susceptible. The joint type also de-termines, in conjunction with the pipe material, the length of the span between braces. Brazed and soldered joints perform acceptably. Most no-hub joints, however, have virtually no stiff-ness; effective bracing of such systems is nearly impossible. Mechanical joints exhibit the most complex behavior, with spring-like flexibility (when pressurized) within a certain rotation and thenrigidity.Inaddition,thebehaviorofsuchsys-tems under earthquake conditions, which cause axial loadings necessary to transmit forces to longitudinal braces, is unknown. As a minimum, castironandglasspipe,andanyotherpipejoined + + + + + + + + + + + + + + + + + + + + + + + + +Figure 9-10 Parameters to be Considered for Pipe Bracing +168 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +with a shield-and-clamp assembly, where the top of the pipe exceeds 12 inches (305 mm) from the supportingstructure,shallbebracedoneachside of a change of direction of 90 degrees or more. Riser joints shall be braced or stabilized between floors. For hubless, pipe-riser joints unsupported betweenfloors,additionalbracingisrequired.All pipe vertical risers shall be laterally supported with a riser clamp at each floor. +6. Vibration Traditionally, unbraced pipe systems seldomcausevibrationtransmissionproblemsbe-causeoftheirinherentflexibility.Manyengineers are concerned that completely braced “tight” piping systems could cause unpredictable sound and vibration problems. +7. Temperaturemovement Pipeanchorsandguides used in high-temperature piping systems must be considered and integrated into a seismic brac- + +ing system. A misplaced longitudinal brace can become an unwanted anchor and cause severe damage. Thermal forces at anchor points, un-less released after the system is operational, are additive to tributary seismic forces. Potential interference between seismic and thermal sup-port systems is particularly high near pipe bends where a transverse brace can become an anchor for the perpendicular pipe run. +8. Condensation The need to thermally insulate high-temperature and chilled water lines from hanging hardware makes longitudinal brace attachment difficult. In some configurations of short runs with bends, transverse braces can be utilized near elbows to brace the system in both directions. Friction connections, using wax-impregnated oak or calcium-silicate sleeves as insulators, have been used. + +Conn. to structural support in a member to be same for vertical, and diagonal L's. + + + + + +Phillips redhead shown here for example +"L" 6'-0" (1.83m) max. + + +1/8 1-24 (3.2mm) + + +Add vertical angle when "L" greater than max. length per schedule + + + +Rod + + + + +2 +1 + +Diagonal angle + + +Bolt to angle + + + + +Hanger rod clilp Add pipe sleeve that has +± +an I.D. 1/4" (6.4 mm) larger than O.D. of bolt. + +When thermal insulated piping is used, do not connect bracing or hanger +(A) directly to piping. +Figure 9-11 Pipe Bracing Systems: (A) Typical Pipe Bracing Source: SMACNA +Chapter 9 — Seismic Protection of Plumbing Equipment 169 + + + + + + + + + +8 2 + + +2 +6 + + + +7 +5 + +3 3 + + + + +1 4 + + + + + + + + + + +1 5 +Triangle Plate 1/4" Plate +1/4"X1-1/4" Flat Bar + + +1-1/4"x1-1/4"x12 Ga. Channel Length Varies +(Not Included) + + +2 6 + +1/2" Flexible Connector 1/4" Angle Clip + + + +3 1/2" All-Thread Rod 7 (Not Included) +Length Varies +With Nylon Lock Nut + +4 8 + +Pipe Hanger +Size and Type Can Vary + + +1/4" Dia Mach. Bolt with Clamp Nut +30 Ft # Torque + + + +Phillips Sleeve Anchor + + + +(B) +Figure 9-11 Pipe Bracing Systems: (B) Tension 360 +170 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Rbh Rbv Rbv +Rbh Support structure connections + + + + +Flexible connector + + + +Flexible connector + + + +Longitudinal channel brace + +Hanger rod + + +Transverse channel brace + + + +Nut + + +Flexible connector + +HL + + + +Flexible connector +Ht + + + +Hanger + + + + + + + +Ht + + + +Figure 9-11 + +HL + + +P (C) +Pipe Bracing Systems: (C) Superstrut. + + + +Severalbracingsystemshavebeendevelopedthat contain some realistic and safe details governing a wide range of loading conditions and configura-tions. For example, SMACNA (Sheet Metal and Air Conditioning Contractors' National Association) and PPIC (Plumbing and Piping Industry Council) have preparedsomeguidelineson bracing systemsforuse by engineers, architects, contractors, and approving authorities. Some of these details for construction of seismic restraints are seen in Figures 9-11 and 9-12. + + +The guidelines set forth by SMACNA and PPIC utilize three pipe-bracing methods: +1. The structural angle. +2. The structural channel. +3. The aircraft cable method. (See Figure 9-12.) +Several manufacturers have developed their own seismic bracing methods. (See Figures 9-13 and 9-14.) +Chapter 9 — Seismic Protection of Plumbing Equipment 171 + + + +Whatever method is used, one should determine the adequacy of the supporting structure by properly applying acceptable engineering procedures. +Pipe risers seldom pose a problem because they arenormallyclampedateachfloorandmovementdue totemperaturechangesareroutinelyconsidered.Very largeorstiffconfigurations,whichcouldbeaffectedby interstorydrift,orsituationswherelong,free-hanging horizontal runs could be inadvertently “braced” by a riser, are possible exceptions. The effect of mid-span couplings with less strength or rigidity than the pipe itself must also be considered. +The techniques for handling the possible dif-ferential movement at locations of utility entrances to buildings or at building expansion joints are well developed because of the similarity to nonseismic problems of settlement, temperature movement, and wind drift. Expansion loops or combinations of mechanically flexible joints are normally employed. For threaded piping, flexibility may be provided by theinstallationofswingjoints.Formanufacturedball joints,thelengthofpipingoffsetshouldbecalculated usingseismicdriftof0.015feetperfoot(0.0046meter per meter) of height above the base where seismic separation occurs. The primary consideration in + +seismic applications is to recognize the possibility of repeated, large differential movements. + +CODES +Design Philosophy Theprocessoftheseismicdesignforbuildingshashad a reasonably long time to mature. Beginning in the 1920s, after engineers observed heavy building dam-age from earthquakes, they began to consider lateral forcesonbuildingsinthiscountryandJapan.Today’s procedures are based on analytical results as well as considerable design experience and observed per-formance in earthquakes of varying characteristics. Lateralforcesforbuildingsspecifiedinmostcodesare much lower than could be calculated from structural dynamics for a variety of reasons, including: +1. Observed acceptable performance at low design levels. +2. Expectedductileactionofbuildingsystems(abil-itytocontinuetowithstandforceanddistortafter yielding). Redundancy of resisting elements in most systems. +3. High damping as distortions increase, which cre-ates a self-limiting characteristic on response. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(A) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (A) Transverse Bracing for Pipes Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. +172 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(B) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (B) Longitudinal Bracing for Pipes Note: Movement due to temperature has been neglected in this example. +Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. +Chapter 9 — Seismic Protection of Plumbing Equipment 173 +174 + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 9-12 + +ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + +(D) +Construction Details of Seismic Protection for Pipes: (D) Alternate Attachment to Hanger for Pipe Bracing + +Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. + + + + + + + + + + + + + + + + + + + + + + + + + + +(E) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (E) Alternate Bracing for Pipes Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. +Chapter 9 — Seismic Protection of Plumbing Equipment 175 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(F) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (F) Strut Bracing for Pipe Trapeze Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. + + + + + + + + + + + + + + + + + + +(G) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (G) Connections to Steel Beams Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. +176 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(H) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (H) Connections to Open-Web Steel Joists Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. + + + + + + + + + + + + + + + + + + + + + + +(I) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (I) Connections to Steel Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. +Chapter 9 — Seismic Protection of Plumbing Equipment 177 + + + + + + + + + + + + + + + + + + + + + +(J) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (J) Hanger Rod Connections Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(K) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (K) Hubless Cast-Iron Pipe Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. +178 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + +(L) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (L) Riser Bracing for Hubless Pipes Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. + + + + + + + + + + + + + + + + + + + + + + + + + +(M) +Figure 9-12 Construction Details of Seismic Protection for Pipes: (M) Connections for Pipes on Trapeze. Source: SMACNA 1991. Note: For additional information, refer to SMACNA 1991. +Chapter 9 — Seismic Protection of Plumbing Equipment 179 + + +Support structure connection Support structure Rv Rbh Rbv Rbh + + +Hanger rod +Tranverse channel brace + +1 Clevis hanger 1 min. +Add bolt sleeve + + +1/2 x 15/16 (12.7 x 23.8 mm) screw with 1/2 clamp +nut typical + +Bracing may vary in slope by 45° above or below horizontal + + +DL + +Ht Ht + +P + +Support structure connection Support structure Rv Rbh Rbv Rbh + + +Hanger rod +Tranverse channel brace Nut +Stud is for longitudinal brace where required + + +Ht + + + + +1 1 min. +Bracing may vary in slope by 45° above +Ht or below horizontal DL + + +1/2 x 15/16 (12.7 x 23.8 mm) screw with 1/2 clamp +nut typical + + +P + + + +Support structure connection Support structure Rv Rbh Rbv Rbh + + +Hanger rod +Tranverse channel brace + + +Nut + + +Ht Ht + + +P + + + + + +1 1 min. +Bracing may vary in slope by 45° above +or below horizontal DL + + +1/2 x 15/16 (12.7 x 23.8 mm) screw with 1/2 clamp +nut typical + + + + + + +(A) + + + +Transverse Only + +Figure 9-13 Sway Bracing, 0.5 G Force +180 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +(B) + +Longitudinal and Transverse + + + + + + + + + + + + + + +(C) Longitudinal Only + +Figure 9-13 Sway Bracing, 0.5 G Force (continued) +Chapter 9 — Seismic Protection of Plumbing Equipment 181 + + + + + +8 2 + + + +6 + +2 + +7 +5 + +3 + + + + +3 1 +4 + + + + + + + + + + +1 Brace Plates 5 + +Type Thickness Links +1 3/8" (9.5mm) 1/2" (12.7mm) 2 1/2" (12.7mm) 5/8" (15.8mm) + +2 Connectors 6 + + +Strut + +Type +1 1-5/8"(41.3mm)x1-5/8"(41.3mm)x12 Ga 2 1-5/8"(41.3mm)x1-5/8"(41.3mm)x12 Ga + +Angle Clip + + + +Type Diameter +1 1/2" (12.7mm) 2 5/8" (15.8mm) + +Type +1 +2 + +Thickness Hole Dia. +3/8" (9.5mm) 9/16" (14.3mm) 1/2" (12.7mm) 11/16" (17.5mm) + + +3 All-Thread Rod & Nylock Nuts 7 Bolts & Clamping Nut + +Type Diameter +1 1/2" (12.7mm) 2 5/8" (15.8mm) + +Type Diameter +1 1/2" (12.7mm) 2 5/8" (15.8mm) + +(4 Tension Rods Required) +4 Pipe Clamp 8 Drilled Sleeve Anchor + +Model Selection per pipe Clamp & Accessory Detail + + + + + + +(A) +Figure 9-14 A Seismic Bracing Method: (A) Lateral Sway Bracing +182 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + +8 2 + + +2 +6 + + + +7 +5 + +3 3 + + + + +1 4 + + + + + + + + + +1 Brace Plates 5 +TypeThickness +1 3/8" (9.5mm) +2 1/2" (12.7mm) + +2 Connectors 6 + + +Strut + +1-5/8"(41.3mm) x 1-5/8"(41.3mm) x 12 Ga Length Varies + +Angle Clip + + + +Type Diameter +1 1/2" (12.7mm) 2 5/8" (15.8mm) + +Type Thickness Hole Dia. +1 3/8" (9.5mm) 9/16" (14.3mm) 2 1/2" (12.7mm) 11/16" (17.5mm) + + +3 All-Thread Rod & Nylock Nuts 7 Bolts & Clamping Nut + +Type Diameter +1 1/2" (12.7mm) 2 5/8" (15.8mm) + +Type Diameter +1 1/2" (12.7mm) 2 5/8" (15.8mm) + + +4 Pipe Clamp 8 Drilled Sleeve Anchor +Model Selection per pipe Clamp & Accessory Detail + + +(B) +Figure 9-14 A Seismic Bracing Method: (B) Lateral and Longitudinal Sway Bracing. +Chapter 9 — Seismic Protection of Plumbing Equipment 183 + + + +4. Less-than-perfect compliance of the foundation to the ground motion. +5. Economic restraints on building codes. +The fact that the actual response of a building during an earthquake could be 3 or 4 times that represented by code forces must be understood and considered in good seismic design. Traditionally, this isdonebyruleofthumbandgoodjudgmenttoensure that structural yielding is not sudden or does not produce a collapsed mechanism. More recently, the response of many buildings to real earthquake input is being considered more specifically using computer analysis. +Design of seismic protection for nonstructural elements,includingplumbingcomponentsandequip-ment, has neither the tradition nor a large number of in-place tests by actual earthquakes to enable much refinement of design force capability or design technique. Unfortunately, few of the effects listed above that mitigate the low force level for structures apply to plumbing or piping. Equipment and piping systems are generally simple and have low damping, and their lateral force resisting systems are usu-ally nonredundant. It is imperative, therefore, when designing seismic protection for these elements, to recognize whether force levels being utilized are arbitrarily low for “design” or realistic predictions of actual response. Even when predictions of actual response are used, earthquake forces are considered sufficientlyunpredictablewhenfrictionisnotallowed asameansof“anchorage.”Often,less-than-fulldead loadisusedtobothsimulateverticalaccelerationsand toprovideafurthersafetyfactoragainstoverturning or swinging action. +Code Requirements Allcurrentbuildingcodesrequiremoststructuresand portions of structures to be designed for a horizontal forcebasedonacertainpercentageofitsweight.Each code may vary in the method of determining this percentage, based on factors including the seismic zone, the importance of the structure, and the type of construction. +It is difficult to consider specific code require-mentsoutofcontext.Thecodedocumentsthemselves should be consulted for specific usage. Most codes currently in use, or being developed, can generally be discussed by considering these four: +1. Uniform Building Code 1997 (UBC). +2. California administrative code of regulations, parts 2 of 2001 Edition of Title 24 (Title 24, CAL). +3. International Building Code 2000 (IBC). +4. Seismicdesignforbuildings.Tri-ServicesManual. (See U.S. Department of Defense 1973.) + +5. Tentativeprovisionsforthedevelopmentofseismic regulations for buildings (ATC-3). (See Applied Technology Council 1978.). +Allofthesecodesrequireconsiderationofalateral force that must be placed at the center of gravity of the element. The lateral force, or “equivalent static force,” is calculated using some or all of the following parameters: +1. Zone Similar to Figure 9-2, the zone category affects the lateral force calculated by considering the size and frequency of potential earthquakes in the region. +2. Soils The effect of specific site soils on ground motion. +3. Force factor This considers the basic response of the element to ground motion and is affected by subparameters, which could include location within the building and possible resonance with the structure. +4. Importance A measure of the desirability of protection for a specific element. +5. Element weight All codes require calculation of a lateral force that is a percentage of the element weight. +6. Amplification factor This is defined by the natural period, damping ratio, and mass of the equipment and the structure. +7. Responsefactor Determinedbydrivenfrequency (equipment motors) and natural frequency. +It is of critical importance that the various build-ing codes and their requirements be obtained and adhered to. +Sprinkler systems: NFPA 13 Because of the potential for fire immediately after earthquakes, sprinkler piping has long received special atten-tion. The reference standard for installation of sprinkler piping, NFPA 13 (National Fire Protection Association 1996), is often cited as containing proto-type seismic bracing for piping systems. In fact, in thosecasesobserved,sprinklerpipinghasperformed well. The bracing guidelines followed for some time in seismically active areas are actually contained in Appendix A of NFPA 13. However, good earthquake performance by sprinkler piping is also due to other factors, such as limited pipe size, use of steel pipe, coherent layouts, and conservative suspension (for vertical loads). +Use of NFPA 13 guidelines for pipe bracing is not discouraged,butitshouldnotbeconsideredapanacea for all piping systems. Other organizations, such as Factory Mutual (FM), have developed guidelines for properties insured by them and in many cases are more restrictive. +184 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +For reference, the following three tables provide goodinformationfortheengineer.Table9-1provides weightsofsteelpipesfilledwithwaterfordetermining horizontal loads. Table 9-2 provides load information forthespacingofswaybracing,andTable9-3provides maximum horizontal loads for sway bracing. + +ANALYSIS TECHNIQUES +Determination of Seismic Forces +As discussed in the previous section, the most com-mon method of defining seismic forces is by use of codestaticequivalentsofdynamicearthquakeforces. Regardless of the parameters used, this procedure reduces to the following formula: +Equation 9-1 +Fp = KgWp + +Table 9-1 Piping Weights for Determining +Horizontal Load +Weight of Water- ½ Weight of Schedule 40 Pipe, Filled Pipe, Water-Filled Pipe, +in. (mm) lb/ft (kg/m) lb/ft (kg/m) +1 (25.4) 2.05 (0.28) 1.03 (0.14) 1¼ (31.8) 2.93 (0.40) 1.47 (0.20) 1½ (38.1) 3.61 (0.50) 1.81 (0.25) 2 (50.8) 5.13 (0.70) 2.57 (0.35) 2½ (63.5) 7.89 (1.08) 3.95 (0.54) 3 (76.2) 10.82 (1.48) 5.41 (0.74) 3½ (88.9) 13.48 (1.85) 6.74 (0.92) 4 (101.6) 16.40 (2.25) 8.20 (1.12) 5 (127) 23.47 (3.22) 11.74 (1.61) 6 (152.4) 31.69 (4.35) 15.85 (2.17) 8a (203.2) 47.70 (6.54) 23.85 (3.27) +Weight of Water- ½ Weight of Schedule 10 Pipe, Filled Pipe, Water-Filled Pipe, +in. (mm) lb/ft (kg/m) lb/ft (kg/m) +1 (25.4) 1.81 (0.25) 0.91 (0.12) 1¼ (31.8) 2.52 (0.35) 1.26 (0.17) 1½ (38.1) 3.04 (0.42) 1.52 (0.21) 2 (50.8) 4.22 (0.58) 2.11 (0.29) 2½ (63.5) 5.89 (0.81) 2.95 (0.40) 3 (76.2) 7.94 (1.09) 3.97 (0.54) 3½ (88.9) 9.78 (1.34) 4.89 (0.67) 4 (101.6) 11.78 (1.62) 5.89 (0.81) 5 (127) 17.30 (2.37) 8.65 (1.19) 6 (152.4) 23.03 (3.16) 11.52 (1.58) 8 (203.2) 40.08 (5.50) 20.04 (2.75) +a Schedule 30 + +where: +Fp = Lateral (seismic) force applied at element center of gravity +Kg = Coefficient considering the parameters discussed above, under "Codes." The final percentage of the element weight is often described in units of g, the acceleration of gravity, e. g., “0.5 g.” This is equivalent to specifying a percentage of the weight; thus 0.5 = 50% of W. +Wp = Weight tributary to anchorage (pipe and contents weight) + +SinceFp isarepresentationofvibratoryresponse, it can be applied in a plus or minus sense. +In piping systems, since vertical supports will probablybeplacedmorefrequentlythanlateralbrac-es, Wp will be greater than the dead load supported at thatpoint.ThismismatchingofFp andavailabledead load often causes uplift on the pipe, which should be taken into consideration. +Theloading(Fp)canalsobecalculatedusingare-sponsespectrumdeterminedfortheappropriatefloor orbymodelingtheequipmentorpipingaspartofthe structureand,bycomputer,inputtinganappropriate time history of motion at the base. In practice, these techniques are seldom used except in buildings of ex-tremeimportance,orwhenthemassoftheequipment becomesasignificantpercentageofthetotalbuilding mass (10% is sometimes used as the limit). +Vertical seismic load, Fp , of equipment or piping is normally considered by specifying a percentage of the horizontal force factor to be applied to the weight concurrently. In several codes the factor is taken as 30% Kg; therefore, Fpg = 0.3 KgW, where W is the tributary vertical load. +v +The three generalized loadings that must be con-sideredinthedesignofseismicrestraints,Fp,Fp ,and W, are shown schematically in Figure 9-15. +v +Determination of Anchorage Forces +In most cases, anchorage or reaction forces, Rh and Rv [Figure 9-16(A)], created by the loading described above, are calculated by simple statistics. Although trivialforaprofessionalfamiliarwithstatistics,calcu-lationstofindallmaximumsbecomenumerouswhen the center of gravity is off one or both plan centerline axes, or if the base support is nonsymmetrical. + +Table 9-2 Assigned Load Table for Lateral and Longitudinal Sway Bracing + +Spacing Spacing of Assigned Load for Pipe Size to Be Braced, lb (kg) of Lateral Longitudinal +Braces, ft (m) Braces, ft (m) 2 2½ 3 4 5 6 +10 (3.0) 20 (6.0) 380 (171) 395 (177.8) 410 (184.5) 435 (195.8) 470 (211.5) 655 (294.8) 20 (6.0) 40 (12.2) 760 (342) 785 (353.3) 815 (366.8) 870 (391.5) 940 (423) 1,305 (587.3) 25 (7.6) 50 (15.2) 950 (427.5) 980 (441) 1,020 (459) 1,090 (490.5) 1,175 (528.8) 1,630 (733.5) 30 (9.1) 60 (18.3) 1,140 (513) 1,180 (531) 1,225 (551.3) 1,305 (587.3) 1,410 (634.5) 1,960 (882) 40 (12.2) 80 (24.4) 1,515 (681.8) 1,570 (706.5) 1,630 (733.5) 1,740 (783) 1,880 (846) 2,610 (1174.5) 50 (15.2) 1,895 (852.8) 1,965 (884.3) 2,035 (915.8) 2,175 (978.8) 2,350 (1057.5) 3,260 (1467) +Note: Table based on half the weight of a water-filled pipe. + + + +9 +915 (411.8) 1,830 (823.5) 2,290 (1030.5) 2,745 (1235.3) 3,660 (1647) 4,575 (2058.8) +Chapter 9 — Seismic Protection of Plumbing Equipment 185 + +Table 9-3 Maximum Horizontal Loads for Sway Bracing + + + +Shape and Size, in. (mm) Pipe (Schedule 40) +1 (25.4) 1¼ (31.8) 1½ (38.1) 2 (50.8) +Pipe (Schedule 10) +1 (25.4) 1¼ (31.8) 1½ (38.1) 2 (50.8) +Angles + + +Least +Radius of Maximum Length for Gyration 1/r = 200 +r02 + r12 += +2 +0.42 7 ft 0 in (2.1 m) 0.54 9 ft 0 in (2.7 m) 0.623 10 ft 4 in (3.1 m) 0.787 13 ft 1 in (4 m) += r02 + r12 +2 +0.43 7 ft 2 in (2.2 m) 0.55 9 ft 2 in (2.8 m) 0.634 10 ft 7 in (3.2 m) 0.802 13 ft 4 in (4.1 m) + +Maximum Horizontal Load, lb (kg) +30-44° Angle 45-59° Angle 60-90° Angle from from Vertical from Vertical Vertical + + +1,767 (801.5) 2,500 (1134.0) 3,061 (1388.4) 2,393 (1085.4) 3,385 (1535.4) 4,145 (1880.1) 2,858 (1296.4) 4,043 (1833.9) 4,955 (2241.5) 3,828 (1736.3) 5,414 (2455.7) 6,630 (3007.3) + + +1,477 (670.0) 2,090 (948.0) 2,559 (1160.7) 1,900 (861.8) 2,687 (1218.8) 3,291 (1492.8) 2,194 (995.2) 3,103 (1407.5) 3,800 (1723.6) 2,771 (1256.9) 3,926 (1780.8) 4,803 (2178.6) + + + +1½ x 1½ x ¼ (38.1 x 38.1 x 6.4) 0.292 4 ft 10 in 2 x 2 x ¼ (50.8 x 50.8 x 6.4) 0.391 6 ft 6 in 2½ x 2 x ¼ (63.5 x 50.8 x 6.4) 0.424 7 ft 0 in 2½ x 2½ x ¼ (63.5 x 63.5 x 6.4) 0.491 8 ft 2 in 3 x 2½ x ¼ (76.2 x 63.5 x 6.4) 0.528 8 ft 10 in 3 x 3 x ¼ (76.2 x 76.2 x 6.4) 0.592 9 ft 10 in Rods = r +⁄8 (9.5) 0.094 1 ft 6 in ½ (12.7) 0.125 2 ft 6 in ⁄8 (15.9) 0.156 2 ft 7 in ¾ (19.1) 0.188 3 ft 1 in 7 8 (22.2) 0.219 3 ft 7 in +2 +3 +5 +⁄ += 0.29 h (where h is smaller of two +Flats +side dimensions) +1½ x ¼ (38.1 x 6.4) 0.0725 1 ft 2 in 2 x ¼ (50.8 x 6.4) 0.0725 1 ft 2 in 2 x ⁄8 (50.8 x 9.5) 0.109 1 ft 9 in Pipe (Schedule 40) = r02 + r12 +3 +2 + +1 (25.4) 0.42 3 ft 6 in 1¼ (31.8) 0.54 4 ft 6 in 1½ (38.1) 0.623 5 ft 2 in 2 (50.8) 0.787 6 ft 6 in Pipe (Schedule 10) = r02 + r12 +2 +1 (25.4) 0.43 3 ft 7 in 1¼ (31.8) 0.55 4 ft 7 in 1½ (38.1) 0.634 5 ft 3 in 2 (50.8) 0.802 6 ft 8 in +Rods = 2 +r +⁄8 (9.5) 0.094 0 ft 9 in ½ (12.7) 0.125 1 ft 0 in ⁄8 (15.9) 0.156 1 ft 3 in ¾ (19.1) 0.188 1 ft 6 in ⁄8 (22.2) 0.219 1 ft 9 in +3 +5 +7 +Pipe (Schedule 40) = r02 + r12 1/r = 300 +2 +1 (25.4) 0.42 10 ft 6 in 1¼ (31.8) 0.54 13 ft 6 in 1½ (38.1) 0.623 15 ft 7 in 2 (50.8) 0.787 19 ft 8 in Pipe (Schedule 10) = r02 + r12 +2 +1 (25.4) 0.43 10 ft 9 in 1¼ (31.8) 0.55 13 ft 9 in 1½ (38.1) 0.634 15 ft 10 in 2 (50.8) 0.802 20 ft 0 in + +(1.5 m) 2,461 (2 m) 3,356 (2.1 m) 3,792 (2.5 m) 4,257 (2.7 m) 4,687 (3 m) 5,152 + + +(0.5 m) 395 (0.8 m) 702 (0.8 m) 1,087 (0.9 m) 1,580 (1.1 m) 2,151 + + +(0.4 m) 1,118 (0.4 m) 1,789 (0.5 m) 2,683 + + +(1.1 m) 7,068 (1.4 m) 9,567 (1.6 m) 11,441 (2 m) 15,377 + + +(1.1 m) 5,910 (1.4 m) 7,600 (1.6 m) 8,777 (2 m) 11,105 + + +(0.2 m) 1,580 (0.3 m) 2,809 (0.4 m) 4,390 (0.5 m) 6,322 (0.5 m) 8,675 + +(3.2 m) 786 (4.1 m) 1,063 (4.7 m) 1,272 (6 m) 1,666 + + +(3.3 m) 656 (4.2 m) 844 (4.8 m) 975 (6.1 m) 1,234 + +(1116.3) 3,481 (1522.2) 4,746 (1720.0) 5,363 (1930.9) 6,021 (2126.0) 6,628 (2336.9) 7,286 + + +(179.2) 559 (318.4) 993 (493.1) 1,537 (716.7) 2,235 (975.7) 3,043 + + +(507.1) 1,581 (811.5) 2,530 (1217.0) 3,795 + + +(3206.0) 9,996 (4339.5) 13,530 (5189.5) 16,181 (6974.9) 21,746 + + +(2680.7) 8,359 (3447.3) 10,749 (3981.2) 12,412 (5037.1) 15,705 + + +(716.7) 2,234 (1274.1) 3,972 (1991.3) 6,209 (2867.6) 8,941 (3934.9) 12,169 + +(356.5) 1111 (482.2) 1,503 (577.0) 1,798 (755.7) 2,355 + + +(297.8) 928 (383.2) 1,194 (442.3) 1,379 (559.7) 1,745 + +(1578.9) 4,263 (2152.7) 5,813 (2432.6) 6,569 (2731.1) 7,374 (3006.4) 8,118 (3304.9) 8,923 + + +(253.6) 685 (450.4) 1,217 (697.2) 1,883 (1013.8) 2,737 (1380.3) 3,726 + + +(717.1) 1,936 (1147.6) 3,098 (1721.4) 4,648 + + +(4534.1) 12,242 (6137.1) 16,570 (7339.5) 19,817 (9863.8) 26,634 + + +(3791.6) 10,237 (4875.6) 13,164 (5630.0) 15,202 (7123.6) 19,235 + + +(1013.3) 2,737 (1801.7) 4,865 (2816.3) 7,605 (4055.5) 10,951 (5519.7) 14,904 + +(503.9) 1,360 (681.7) 1,841 (815.5) 2,202 (1068.2) 2,885 + + +(420.9) 1,137 (541.6) 1,463 (625.5) 1,194 (791.5) 2,137 + +(1933.7) (2636.7) (2979.6) (3344.8) (3682.2) (4047.4) + + +(310.7) (552.0) (854.1) (1241.5) (1690.1) + + +(878.2) (1405.2) (2108.3) + + +(5552.8) (7516.0) (8988.8) (12080.9) + + +(4643.4) (5971.1) (6895.5) (8724.8) + + +(1241.5) (2206.7) (3449.6) (4967.3) (6760.3) + +(616.9) (835.1) (998.8) (1308.6) + + +(515.7) (663.6) (541.6) (969.3) + +(CONTINUED) +186 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Table 9-3 Maximum Horizontal Loads for Sway Bracing (continued) + + + +Shape and Size, in. (mm) Rods +⁄8 (9.5) ½ (12.7) +3 +⁄8 (15.9) ¾ (19.1) ⁄8 (22.2) +5 +7 + + +Least Radius of Gyration +r += 2 0.094 0.125 0.156 0.188 0.219 + + +Maximum Length for 1/r = 200 + + +2 ft 4 in (0.7 m) 3 ft 1 in (0.9 m) 3 ft 11 in (1.2 m) 4 ft 8 in (1.4 m) 5 ft 6 in (1.7 m) + +Maximum Horizontal Load, lb (kg) +30-44° Angle 45-59° Angle 60-90° Angle from from Vertical from Vertical Vertical + + +176 (79.8) 248 (112.5) 304 (137.9) 312 (141.5) 441 (200.0) 540 (244.9) 488 (221.4) 690 (313.0) 845 (383.3) 702 (318.4) 993 (450.4) 1,217 (552.0) 956 (433.6) 1,352 (613.3) 1,656 (751.1) + + + +In typical pipe braces [Figure 9-16(B)], it is important to note that R, the gravity force in the hanger rod, is significantly affected by the addition of the brace and is not equal to W, as indicated previ-ously. Dealing with these loads is a huge problem. A tension rod hanger commonly goes into compression in such a situation. Cable restraints do not have this problem. + +COMPUTER ANALYSIS OF PIPING SYSTEMS +Computers programs have been used to analyze pip-ing systems for stress for some time. These programs were initially developed to consider thermal stresses andanchorpointload,butsoftwareisnowcommonly available that can consider seismic and settlement loading, spring or damping supports, snubbers (simi-lar to equipment snubbers), differing materials, and nonrigidcouplings.Theseismicloadingnormallycan be figured by using a full-time history, as a response spectrum, or equivalent static forces. The time his-toryhastheinherentproblemofrequiringasearchof eachtimeincrementforworst-casestressesandbrace loadings.Thecomputertimeandman-hoursrequired areseldomjustified.Infact,forseismicloadingalone, computeranalysisisalmostneverperformedbecause brace loadings can easily be determined by tributary lengthmethods,andrule-of-thumbpipespans(brace spacing) are contained in several publications (see National Fire Protection Association 1996; Hillman, Biddison, and Loevenguth; and U.S. Dept. of Defense 1973). Computer analysis may be appropriate, how-ever, when it is necessary to combine seismic loading with several of the following considerations: +1. Temperature changes and anchorage. +2. Nonlinearsupportconditions(springs,snubbers, etc.). +3. Complex geometry. +4. Several loading conditions. +5. Piping materials other than steel or copper. +6. Joints or couplings that are significantly more flexible or weaker than the pipe itself. + + +Because of the variety of computer programs availableandbecausemanyhaveproprietaryrestric-tions, specific programs are not listed here. Piping analysis programs are available at most computer service bureaus, many universities, and national computer program clearinghouses. + +DESIGN CONSIDERATIONS +Loads in Structures +It is always important to identify unusual equipment and piping loads during the first stages of project design to assure that the structural system being de-veloped is adequate. Consideration of seismic effects makesthiscoordinationevenmoreimportantbecause seismic forces produce unusual reactions. During an earthquake,notonlymusthorizontalforcesbetaken into the structure, but vertical load effects are inten-sified due to vertical accelerations and overturning movements. These reactions must be acceptable to the structure locally (at the point of connection) and globally (by the system as a whole). +If the structural system is properly designed for the appropriate weights of equipment and pip-ing, seismic reactions will seldom cause problems to the overall system. However, local problems are not uncommon. Most floors are required by code to withstand a 2000-pound (908 kg) concentrated load, so this is a reasonable load to consider acceptable without special provisions. However, seismic reac-tions to structures can easily exceed this figure; for example: +1. A longitudinal brace carrying a tributary load of 80 feet (24.8-m) of 8-inch (203-mm) steel pipe filled with water will generate reactions of this magnitude. +2. Transverse or longitudinal braces on trapezes often have larger reactions. +3. A 4000-pound (1816-kg) tank on legs could also yield such a concentrated load. In addition, pos-sible limitations on attachment methods due to structure type could reduce the effective maxi-mum allowable concentration. +Roof structures have no code-specified concen-trated load requirement and often are the source of +Chapter 9 — Seismic Protection of Plumbing Equipment 187 + + + +If not over 24" (610mm) + + + +If not over 24" (610mm) + +45° + + + + + +Pipe or L + +45° + + + + +45° 45° + +Pipe or L's + + + + + + +45° + +45° 45° + + + + + + + + +Angle or equal + + +2 bolts in each connection + + + + +Clip angle + +Vertical member of truss + + + + + +Figure 9-15 Acceptable Types of Sway Bracing +188 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Center of +Gravity + + + + +Fpv + +Fp + +Wp Structure + +Rh Rh + +Rv Floor or Rv +slab on grade + +(A) + + +R Rd + + +Rh + +Structure Fpv +Fp + + + + +W (B) +Figure 9-16 Forces for Seismic Design: +(A) Equipment; (B) Piping. + +problems, particularly concerning piping systems, because of the random nature of hanger-and-brace locations. Many roof-decking systems cannot accept concentrations greater than 50 pounds (22.7 kg) without spreaders or strengthening beams. Such limitations should be considered both in the selec-tion of a structural system and in the equipment and piping layout. +If equipment anchorage or pipe bracing is specified to be contractor supplied, attachment load limitations or other structural criteria should be giv-en. Compliance with such criteria should be checked to assure that the structure is not being damaged or overloaded. + +POTENTIAL PROBLEMS +It would be impractical to cover the details of struc-tural design for seismic anchorage and bracing in this chapter. The engineer can get design informa-tion and techniques from standard textbooks and design manuals or, preferably, obtain help from a professional experienced in seismic and/or structural design.Simple,typicaldetailsareseldomappropriate, and all-encompassing, seismic-protection “systems” quickly become complex. Certain common situations that have the potential to create problems can be identified,however;theseareshownschematicallyin Figure 9-17 (see page 194) and discussed below. +Condition 1 in Figure 9-17 occurs frequently in making attachments to concrete. Often an angle is used, as indicated. The seismic force, P, enters the connectoreccentrictothereaction,R,bythedistance e; this is equivalent to a concentric force plus the moment Pe. In order for the connector to perform as designed, this moment must be resisted by the con-nection of the angle either to the machine or to the concrete.Tousethemachinetoprovidethismoment, the machine base must be adequate, and the connec-tion from angle to base must be greatly increased over that required merely for P. Taking this moment into the concrete significantly increases the tension in the anchorage, R, which is known as “prying ac-tion.” The appropriate solution must be decided on a case-by-case basis, but eccentricities in connection should not be ignored. +Legs 18 inches (457 mm) or longer supporting tanks or machines clearly create a sideways problem and are commonly cross-braced. However, shorter legs or even rails often have no strength or stiffness in their weak direction, as shown in Condition 2, and should also be restrained against base failure. +Conditions 3 and 4 point out that spring isola-tors typically create a significant height, h, through whichlateralforcesmustbetransmitted.Thisheight, in turn, creates conditions similar to the problems shown in 1 or 2 and must be treated in the same manner. +Condition 5 is meant to indicate that seldom can the bottom flange of a steel beam resist a horizontal force; diagonal braces, which are often connected to bottom flanges, create such a horizontal force. This condition can be rectified by attaching the diagonal brace near the top flange or adding a stabilizing ele-ment to the bottom flange. +Condition 6 depicts a typical beam connection device (beam clamp), which slips over one flange. Although this is often acceptable, significant stresses can be introduced into the beam if the load is large or the beam small. Considering the variability and potential overload characteristics of seismic forces, this condition should probably be avoided. Condi- +Chapter 9 — Seismic Protection of Plumbing Equipment 189 +r + + + + +Potential Problems in Design Condition Probably Not Acceptable + + +Seismic Protection Probably Acceptable + + + +1. Eccentricity in connection + +e P P +Same as + + +M = P not resisted +e + + +P + +M + +M = M P from +machine or +M + + + +R +Structure + + +R + + +R +Mr from structure + + + +2. Sidesway or tipping +Legs + + +Rails + +Sidesway restrained by bracing or cross beams + + + +3. Isolators with no restraint + + + +4. Isolators with restraint + + + +5. Location of connection to structure (lateral force) + + + +h + + + + +h + + + +(bottom flange unbraced) + + +Added snubbers + + + + + + + + + + +Perpendicular beam + + + +See also item 1. + + + +Sidesway restrained See items 1 & 2 + + + +6. Location of connection to structure +(vertical force) + + +7. Type of connector + + + +(eccentric) + + + + +(friction only) +Restrainer + + + + +8. Brace configuration + + + +9. “Typical” details + + +Missing component + + + +L2 x 2 (50 x 50mm) + + + +Eccentricity + + + +L3 x 3 +(75 x 75mm) No limiting conditions + + +Stable triangle + + + + +Limited + + + +10. Trapeze +One longitudinal brace provided at center or end + + +Longitudinal braces each end + + + +Figure 9-17 Potential Problems in Equipment Anchorage or Pipe Bracing +190 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +tion 7 also shows a connector in common use, which is probably acceptable in a nonseismic environment but which should be secured in place as shown under dynamic conditions. +Most pipe bracing systems utilize bracing mem-bers in pure tension or compression for stiffness and efficiency.Thistruss-typeactionisonlypossiblewhen bracing configurations make up completed triangles, as shown on the right under condition 8. The brace configuration on the far left is technically unstable and the eccentric condition shown produces moment in the vertical support. +Aspreviouslyindicated,“typical”detailsmustbe carefullydesignedandpresentedtopreventtheirmis-use. Condition 9 shows the most common deficiency: A lack of limiting conditions. +Condition 10 shows a situation often seen in the field where interferences may prevent placement of longitudinalbracesattheendsofatrapezeandeither one is simply left out or two are replaced by one in the middle. Both of these “substitutions” can cause an undesirable twist of the trapeze and subsequent pipe damage. All field revisions to bracing schemes should be checked for adequacy. +Other potential problems that occur less fre-quentlyincludeincompatibilityofpipingsystemswith differential movement of the structure (drift) and inadvertent “self bracing” of piping through short, stiff service connections or branches that penetrate the structure. If the possibility of either is apparent, pipe stresses should be checked or the self-bracing restraint eliminated. +A few problems associated with making connec-tiontoastructurewerediscussedabove,inrelationto 9-17.Whenconnectingtostructuralsteel,inaddition tomanufacturedclipdevices,boltingandweldingare also used. Holes for bolting should never be placed in structuralsteelwithouttheapprovalofthestructural engineer responsible for the design. Field welding should consider the effects of elevated temperatures on loaded structural members. +The preferred method of connecting to concrete is through embedments, but this is seldom practical. Since the location of required anchorages or braces is often not known when concrete is poured, the use of drilled-in or shot-in anchors is prevalent for this purpose.Althoughtheseanchorsareextremelyuseful and practically necessary connecting devices, their adequacy has many sensitivities and they should be applied with thorough understanding and caution. Thefollowingitemsshouldbeconsideredinthedesign or installation of drilled or shot-in anchors: +1. Manufacturersoftenlistultimate(failure)values in their literature. Normally, factors of safety of 4 or 5 are applied to these values for design. + +2. Combinedshearandtensionshouldbeconsidered inthedesign.Aconservativeapproachcommonly used is the following equation: +Equation 9-2 +(T/Ta) + (V/V) < 1 where: +a +T = Tension, lbf/in2 +Ta = Allowable tension, lbf/in2 V = Shear, lbf/in2 +V = Allowable shear, lbf/in2 +a +3. Edge distances are important because of the expansive nature of these anchors. Six (6) diameters are normally required. +4. Review the embedments required for design values. It is difficult to install an expansion bolt over½-inch(12.7-mm)diameterinatypicalfloor system of 2½-inch (63.5-mm) concrete over steel decking. +5. Bolt sizes over ¼-inch (6.4-mm) diameter have embedments sufficient to penetrate the reinforc-ingenvelope.Boltsshouldthereforenotbeplaced in columns, the bottom flange of beams, or the bottom chord of joists. Bolts in slabs or walls are less critical, but the possibility of special and critical reinforcing bars being cut should always be considered. The critical nature of each strand of tendon in prestressed concrete, as well as the stored energy, generally dictates a complete pro-hibition of these anchors. +6. Installation technique has been shown to be ex-tremelyimportantindevelopingdesignstrength. Field testing of a certain percentage of anchors should be considered. + +Additional Considerations +Seismic anchorage and bracing, like all construction, should be thoroughly reviewed in the field. Consider-ing the lack of construction tradition, the likelihood of field changes or interferences, and other potential problems (discussed above), seismic work probably should be more clearly controlled, inspected, and/or tested than normal construction. +Another result of the relative newness of seismic protection of equipment and piping is the lack of per-formancedataforthedesignanddetailingtechniques now being used. Considerable failure data were col-lectedinAnchorageandSanFernando,butessentially no field data are available to assure that our present assumptions, although scientifically logical and ac-curate, will actually provide the desired protection. Willfirmanchorageofequipmentcausedamagetothe internal workings? Will the base cabinet, or frame-work (which is now seldom checked), of equipment be severely damaged by the anchorage? In contrast, the present requirements for structures are largely +Chapter 9 — Seismic Protection of Plumbing Equipment 191 + + + +the result of observations of damage to structures in actual earthquakes over 75 years. +Thenetresultofcurrentstandardsinseismicpro-tection can only be positive. The fine-tuning of scope, force levels, and detailing techniques must wait for additional, full-scale testing in real earthquakes. + +GLOSSARY +Anchor A device, such as an expansion bolt, for connecting pipe-bracing members into the structure of a building. +Attachment See "positive attachment." +Bracing Metal channels, cables, or hanger angles that prevent pipes from breaking away from the structureduringanearthquake.Seealso"longitudinal bracing" and "transverse bracing." Together, these resist lateral loads from any direction. + +Transverse bracing Bracing that prevents a pipe from moving from side to side. + +REFERENCES +1. American National Standards Institute. Draft. ANSI-ASSI:Buildingcoderequirementsforminimumdesign loads in buildings and other structures. New York. +2. AppliedTechnologyCouncil.1978.Tentativeprovisions for the development of seismic regulation for buildings (ATC-3). Washington, D.C.: U.S. Department of Com-merce, National Bureau of Standards. +3. Ayres, J. M., and T. Y. Sun. 1973. Non-structural damage.TheSanFernando,California,Earthquakeof February9,1971.Washington,D.C.:National Oceanic and Atmospheric Administration. +4. Ayres, J. M., T. Y. Sun, and F. R. Brown. 1973. Non-structural damage to buildings. The Great Alaska Earthquake of 1964: Engineering. Washington, D.C.: National Academy of Sciences. + + + +Dynamic properties of piping The tendency of pipes to change in weight and size because of the movement and temperature of fluids in them. This does not refer to movement due to seismic forces. +Essential facilities Buildings that must remain safe and usable for emergency purposes after an earthquakeinordertopreservethehealthandsafety of the general public. Examples include hospitals, emergency shelters, and fire stations. + +5. California, State of. 1988. California Code of Regula-tions. Division 122 of Title 24, Building Standards. +6. Hillman, Biddison, and Loevenguth. Guidelines for seismic restraints of mechanical systems. Los Angeles: Sheet Metal Industry Fund. +7. Hodnott,RobertM.Automaticsprinklersystemshand-book. Boston, Ma.: NFPA. +8. International Conference of Building Officials. 1988. Uniform Building Code 1988. Whittier, California: International Conference of Building Officials. + + + +Equipment Forthepurposesofthischapter,"equip-ment"referstothemechanicaldevicesassociatedwith pipes that have significant weight. Examples include pumps, tanks, and electric motors. +Gaspipe Forthepurposesofthischapter,"gaspipe" is any pipe that carries fuel gas, fuel oil, medical gas, vacuum, or compressed air. +Lateral force A force acting on a pipe in the hori-zontal plane. This force can be in any direction. +Longitudinal bracing Bracing that prevents a pipe from moving in the direction of its run. +Longitudinal force A lateral force that happens to be in the same direction as the pipe. +OSHPD Office of Statewide Health Planning and Development (California). +Positiveattachment Amechanicaldevicedesigned to resist seismic forces that connects a nonstructural element, such as a pipe, to a structural element, such as a beam. Bolts and screws are examples of positive attachments. Glue and friction due to gravity do not create positive attachments. +Seismic Related to an earthquake. Seismic loads on a structure are caused by wave movements in the earth during an earthquake. + +9. National Fire Protection Association (NFPA). 1996. Standard for the installation of sprinkler systems. NFPA no. 13. Boston, Ma: NFPA. +10. Sheet Metal and Air Conditioning Contractors' Na-tional Association, Inc. (SMACNA). 1991. Seismic restraint manual guidelines for mechanical systems. Chantilly, Va: SMACNA. +11. The Sheet Metal Industry Fund of Los Angeles, Calif., and the Plumbing and Piping Industry Council, Inc. 1982. Guidelines for seismic restraint of mechanical systems. Los Angeles, Calif. +12. U.S.DepartmentofDefense.April1973.Seismicdesign for buildings. In Department of Defense Tri-Services Manual. (TM-5-809-10. NAVFAC P-355, AFM SB-S Ch. 13) Washington, D.C.: Department of the Army, the Navy, and the Air Force. +13. U.S.GeneralServicesAdministrationPublicBuildings Service. Design guidelines. Earthquake Resistance of Buildings. Vol. 1. Washington, D.C.: Government Printing Office. +14. U.S. Veterans Administration. Earthquake resistant design requirements handbook (H-08-8). Washington, D.C.: Veterans Administration Office of Construction. +192 ASPE Plumbing Engineering Design Handbook — Volume 1 +10 + + + + + +Acoustics in Plumbing Systems + +INTRODUCTION +The plumbing system can be the source of one of the most intrusive, unwanted noises in high-rise apart-ment buildings, hospitals, hotels, and dormitories. It is essential, therefore, that plumbing engineers understand the terminology and theory of the field of acoustics in order to reduce the acoustical impact of plumbing. +ACCEPTABLE ACOUSTICAL LEVELS IN BUILDINGS +Acceptable acoustical levels in buildings are usually assessed in a number of ways, depending upon the classification of a building occupancy (or normal usage), the time of the day (or night), the extent of the intrusion of external noises from other sources (including traffic), and the socioeconomic nature of a building (or of the areas in which it is located). +Typical sound levels are normally established in terms of their relationship with a preexisting background sound level, which is often specified in standards. Thus, for example, the background sound levels for broadcast studios would be specified in the range of 10 to 25 decibels, A-weighted [dB(A)]; those for sleeping quarters would be specified in the range of20to35dB(A);andthoseforofficeswouldbespeci-fied in the range of 30 to 50 dB(A). + +ACOUSTICAL PERFORMANCE OF BUILDING MATERIALS +Insulation Against Airborne Sound +The noise reduction provided by a barrier, partition, or wall is dependent on the transmission loss of that particular barrier, partition, or wall, together with the acoustical characteristics (and, specifically, the amount of sound absorption) existing on each side of the element. + +For damped, single-leaf barriers, this transmis-sion loss will depend primarily on the product of the surfaceweightofthebarrierandthefrequencyofthe + +signalbeingattenuated.Thisphenomenaisdescribed as the “mass law.” Doubling the surface weight of the barrier only results in a 3-dB improvement in transmission loss. +For double-leaf barriers, the transmission loss is determined by the spacing between the leaves at the edgesofthebarriersystemandtherespectivesurface weightsofthetwoleaves.Maximizingthespacingbe-tween the leaves has the result that the performance of the barrier tends to be the highest possible value at all frequencies. At minimum spacing between the leaves, the maximum improvement is at the highest frequencies, while the typical improvement may be as little as 3 dB at the low frequencies. +In any barrier system, maximum performance requires the closing off and effective sealing of all holes and gaps, particularly around penetrations of the type required for pipe and pipe fittings. Such penetrationsusuallyrequireaneffectiveflexibleseal-ing in order to accommodate the thermal movement whilesimultaneouslyminimizingtheextentofvibra-tiontransmissionfromthepipeintothesurrounding barrier system. The preferred type of sealing system should incorporate fire-rated flexible fiberglass, mineral wool, or ceramic wool wrapping retained by sealant and, where required, metal sleeving for pro-tection or to span between the cavity access on the opposite sides of thick walls or large cavities. +Barrier systems used to surround or enclose piping should incorporate acoustic-absorbing linings or retained fiberglass or mineral wool together with effectively sealed external barriers of high-mass dry-wall construction fixed to steel stud framework, or masonry, as required. Barriers in close contact with pipeorfittingsshouldprovidenoisereductionorhave a sound-absorption capability not less than that in-dicated by laboratory tests carried out on large-scale samples evaluated under normal conditions. +194 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +ACOUSTICAL RATINGS OF The noise of the water flushing the closet bowl +PLUMBING FIXTURES AND is a function of the specific flow rate from the tank, the proximity of the tank to the closet bowl, and the +APPLIANCES +The acoustical rating tests for fixtures are still in methodofmountingthetankitself.Whilesoundlevels their infancy and have not yet been internationally older style fittings with the tank located as much as Germany,dohaveusefulstandards,theUnitedStates 6 feet (1.8 m) above the bowl, modern, close-coupled hasyettoformalizeanyplumbingacoustictests.The +as high as 90 dB(A) at 3 feet (0.9 m) are possible in +standardized. While some countries, most notably +tanks, when properly installed (with bowl cover +down), may be as low as 55 dB(A). +The noise of the tank refilling is a function of its +design, which includes the type of construction of +problem of adequately defining the direct airborne and structure-borne components of vibration still +constitutes a major problem in performing acoustic its envelope, the method of mounting to the wall (or +ratingtests.OnlytheGermanstandardDIN 52218, +Laboratory Testing on the Noise Emitted by Valves, closet bowl), the type of tank valve used, the water, FittingsandAppliancesUsedinWaterSupplyInstal- and the time required for the refill cycle. There are +lations (Part 1), has so far addressed this problem. many cases where the noise of the tank refilling is far Also,theInternationalOrganizationforStandardiza- more annoying than the noise produced by the toilet tion(ISO)haspublishedstandard3822/1,Laboratory flushing. The noise of toilet tanks refilling may be TestsonNoiseEmissionbyAppliancesandEquipment as low as 40 dB(A) at 3 feet (0.9 m) in well-designed UsedinWaterSupplyInstallations,andtheAmerican unitsincorporatingquietvalvesandsilenced,tail-pipe Society for Testing and Materials (ASTM) has assemblies.Inpoorlydesignedinstallationsoperating established a project E-33.08B, Plumbing Noise, to at the maximum flow rate, this noise may be as high investigate this problem.1 as 95 dB. Flush-valve operation can be as high as 95 The airborne sound radiated by showers, dish- dB, while blowout-type fixtures have been recorded +washers, waste-disposal units, washing machines, at as high as 120 dB. water closets and bathtubs is specified by the fixture/ +Urinals Thenoiseassociatedwithurinalsisafunc- +appliancemanufacturer.Thesoundratingsforfittings tion of the wall-mounting method used to install the +are normally expressed in terms of sound power or + +A-weighted and octave-band levels measured in a re- discharge into the fixture and the ejection of the ma-verberanttoiletroomorkitchen-typeenvironmentat terials. The flush-valve operation may be as high as +fixture and the flushing action of the urinal—water +adistanceof3feet(0.9m).Becauseofthedifferences 95 dB, with blowout units as high as 110 dB. in the reverberations between one environment and +another, the characteristics of the test environment Bathtubs The noise from bathtubs is usually should ideally have a reverberation time lying in the caused by the impact of a high-velocity water stream +into a glazed metallic, fiberglass, or acrylic bathtub. While this noise varies during the filling cycle, it may +range of 1 to 2 seconds and be independent of the +frequency. +also be significant during the drainage cycle. +Valves Thesoundlevelsfromvalvesaredependent uponthesizeofthefitting,themassflowrate,andthe +In both cases, this noise is a function of the +bathtub material and its structural design as well +pressure differential across the fitting. Sound levels as its method of installation, particularly the extent of its structural decoupling from the walls and floor +from taps and valves at a distance of 3 feet (0.9 m) +mayrangebetween30and50dB(A)forwell-designed +and properly installed fittings, 50 and 70 dB(A) for (in order to reduce the acoustical impact on adjacent adequatelydesignedandadequatelyinstalledfittings, countries, the building regulations specify stringent +rooms or other apartments). In many European +and 70 and 90 dB(A) for poorly designed and poorly +installedfittings.Improvementsintheperformanceof decoupling procedures to minimize the structure- +faucets are most notably achieved through the incor- borne noise propagation. Outside these countries, poration of aerators, which may result in reductions such procedures are relatively unknown and are not in noise levels of as much as 15 or more dB. generally utilized. The noise of a bathtub filling typi- +cally lies in the range of 60 to 100 dB(A) at 3 feet (0.9 +Water closets The noise from water closets can be m), depending on the flow rate. The point of impact of the water stream with the side of the bathtub is +subdivided into: +• The noise of the water flushing the closet bowl. generally reduced by using an aerator on the spout. Good design practice calls for the water spout to be +• The noise of the water refilling the tank. +installed so that the water stream is not directed to +• The noise of a flush-valve operation, including +strike the bottom of the bathtub. +water discharge into the fixture and the ejection Showers Shower noise is mostly a function of the floor surface in the shower enclosure and the type of +of materials from the closet bowl. +1Copies of the DIN and ISO standards are available from the American National Standards Institute (ANSI), 1430 Broadway, New York, NY 10018. +Chapter 10 — Acoustics in Plumbing Systems + + +showerhead.Theconstant-temperaturecontrolleris only significant when the water-pressure drop across it is unusually high or the method of supporting the pipe from the walls results in the generation of reso-nant noise. Shower noise typically lies in the range of 60 to 90 dB(A) at 3 feet (0.9 m). + +Dishwashers Dishwashernoiseisafunctionofthe basic design of the unit, the choice of the mounting procedures employed, and the extent to which the installer provides additional thermal and acousti-cal insulation. The noise from dishwashers can be minimizedbymountingtheunitsonrubberisolation devicesorbyprovidinglayersoffiberglassormineral wool insulation on their tops, rear and sides. Signifi-cantnoiseiscreatedbytheactivationofsolenoidsand solenoid-activated valves that create water hammer and sound propagation through the piping. +The use of flexible connections and the incorpo-ration of surge eliminators to minimize the water hammerarehighlyrecommended.Typicalnoiselevels from dishwashers are in the range of 65 to 85 dB(A) at 3 feet (0.9 m) with peaks as high as 105 dB(A) cre-ated by solenoid operation. +Waste-disposal units Sink orwaste-disposal-unit noise is a function of the design of the unit as well as the design of the sink or basin to which it is attached. Lightly constructed, stainless-steel sinks or basins willtendtoamplifythesoundenergy.Thesupporting cupboards or fixtures may also have a similar effect. The sinks and basins used to support such fittings should be designed to incorporate an effective damp-eningofthebowlthroughtheapplicationofdamping materials or framework. +The plumbing connection to the waste-disposal unitsshouldbeflexibleattheinletandthedischarge. The noise levels produced by these units can vary widely and most manufacturers do not publish the noise-rating data. Noise levels can vary between 75 and 105 dB(A) at 3 feet (0.9 m), depending on the method of mounting and the extent to which the protective covers are used. +Washing machines Washing-machine noise is a function of the design of the unit and, to a lesser extent, the method of mounting or type of plumbing connections used. The airborne noise levels can be somewhat reduced through the application of damp-ening material on the inside surfaces of the enclosing panels. +The incorporation of isolation mounts does not normally reduce the direct airborne sound but may drastically reduce the structure-borne component audible in adjacent apartments or rooms and per-ceptible vibration in the floor during spin cycle. The noise levels produced by washing machines range + +195 + + +between 65 and 90 dB(A) at 3 feet (0.9 m), and few manufacturers publish the sound-rating data. +An indirect discharge of the wastewater into a trough or hub drain may be very loud in the room but may have a reduced noise transmission through the piping system. + +GENERAL ACOUSTICAL DESIGN Water Pipes +Origin and spread of noise The causes of noise are the surge due to the sudden opening or closing of valvesandflowwherethecrosssectionsofsuchvalves aregreatlyrestricted.Inaddition,becauseofthehigh velocity, cavitation and turbulence are also created by the sudden changes in direction. The higher the pressure head of the fittings, the louder the noise. Water hammer arrestors (shock absorbers) may be beneficial in eliminating sound noise generated by these problems. +Noises originate when a stream of water strikes the base of the bathtub, sink, or lavatory. In the emp-tying operation, gurgling noises often occur because of the whirlpool action. These noises are conducted partly along the pipe and partly by the column of wa-ter. The pipes induce the walls and ceilings to vibrate and radiate sound. +Reducing the noise at its origin Fittings of satisfactory design with a low noise level should be employed whenever possible. +Flush tanks, in particular, can be substantially quieter than pressure flush valves, especially when insulated. Low-flush, gravity-flush valve fixtures will operate more quietly than high-velocity (blowout) type fixtures. +The largest possible cross sections for the pipes should be used and the water supply pipes in all criti-cal areas should be designed for a maximum velocity of 4 ft/s (1.2 m/s). +Theemptyingnoisecanbereducedbyusingwaste fittings to ensure that the air is simultaneously and uninterruptedly sucked out of the stream of water and carried away with it. +The pressure in the pipes inside of the building canbereducedtotheextentthattheoperatingcondi-tions allow closed-circuit pressure. +Reducingthespreadofnoise Thedesignermust make a distinction among the pipes laid on a wall, those in a wall, and those in shafts. +In the case of pipes installed on a wall or in pipe shafts,structure-borne,sound-dampingpacking(e.g., cork, felt, profiled strips of rubber, or other elastic materials) should be inserted between the fastenings and the pipe. The packing should not be compressed by excessive tightening of the pipe clips. Instead of +196 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +packing for structure-borne sound control, vibration isolation mounts should be used. +Pipes in the wall should be wrapped with sound-damping materials (e.g., felt, bituminized felt, or viscoelastic damping materials) without leaving any gaps.Thesameeffectmaybeachievedbyhavingpipes elasticity mounted in a firm outer casing. +Several pipes running in the same direction in shafts can be fastened to a single common rack. This rackshouldnothaveanystructural,noise-conducting connections with the walls. Common racks should be fastened to the wall with rubber/metal connections interposed. +When pipes pass through ceilings or walls, they should be taken through sound-control sleeves of fibrousdampingmaterialsandresilientsealant.This approachmustnotadverselyaffecttheairbornesound control (for instance, through joints), in particular in the case of party ceilings and walls of separate tenants. In the case of ceilings and walls that have to be fire resistant, this approach must be complied with when deciding on the fire-rated sleeves that will generally be sealed with a fire-rated silicone foam. +In the case of apparatus and equipment, such as washing machines, spin dryers, bathtubs, and wash sinks that generate noise or in which noise occurs duringfillingandemptying,resilientsound-damping materials should be used at the places where they touch or are attached to the structure. In the case of bathtubs,asolidjointbetweenthebathtuboutletand the waste pipe should be avoided. Rubber pads under the bathtub supports are recommended. +Bear in mind, in the case of water pipes and ap-paratus in or on walls that border occupied spaces, thatthepermissibleloudnesslevelsarenotexceeded. In such cases, conventional water-closet flush valves should be avoided and quiet-acting siphon jet actions should be used. +Occupied Domestic Spaces +Keeping within the maximum allowable loudness levels in occupied rooms requires that steps be taken during the planning and construction stages of the building. The term “occupied domestic spaces” gen-erally covers hotels, motels, dormitories, and other locations where, in addition to domestic appliances, the elevators, incinerators, ventilation equipment, switch gear, boilers, and refuse-disposal installations can cause unacceptable noise levels in habitable ar-eas, particularly sleeping quarters. As early as the planning stage, the various points requiring consid-eration must be taken into account by the plumbing designer. +Becauseofthemultiplicityofinfluencesinvolved, no simple or standard rules can be given for keeping within the permissible loudness levels. For some groups of installations, the following criteria apply: + +1. Apparatus and machines in which the noise is predominantly transmitted as structure-borne sound (e.g., motors, pumps, pressure-increasing installations, ventilation machinery, drives for elevators, gearing, and heavy switch gear) must be sound insulated/vibration isolated from the building. +2. In order to reduce the structure-borne sound transmission from the heating installations into occupiedrooms,aconcretefloatingfloorshouldbe added in the rooms where the solid fuel is stored and where there is heating equipment. The boil-ers must be supported on vibration isolators and beseparatedfromothercomponentsandfromthe floating floor. The pipes can be supported by col-lector blocks on the floating floor. Rigid fastening to ceilings, floors, or walls should be avoided. +3. Ceilingsoverroomswherethereisheatingequip-ment should be provided with a floating barrier consisting of plaster or gypsum board in order to increase the airborne soundproofing. +4. In the case of refuse-disposal installations, the inside shaft should be constructed in such a way that the building is insulated against structure-borne sounds. Whenever possible, low-noise materials should be used. Metal sheeting should be provided with a resilient impact-absorbing coating on the inside and/or covering. The roof of the shaft should be made of sound-absorbent material. +5. Refuse bins should stand on a floating concrete slab and be enclosed by walls and ceilings com-plying with the requirements for party walls and ceilings of apartments. If deflector plates are provided, these devices must be fixed in a flexible manner and with structure-borne sound insula-tion. +Pumps + +Sources of noise The following items are some of the major sources of noise from pumps in plumbing systems: + +1. Unbalanced motors. +2. Pulsation of the air mass flow from electric fans. (This is a major source of noise in 2-pole, fan-cooled, electric motors. The noise from the fan is usually so dominant that all other sources of noise in the electric motor can be neglected.) +3. Pulsation of the magnetic field in the electric motor. +4. Motor/gear/pump journal and thrust bearings. +5. Contacting of the components in parallel-shaft and epicyclic gears. +6. Imbalance of the pump impellers. +Chapter 10 — Acoustics in Plumbing Systems + + +7. Pulsation in the pumps. (Hydrodynamic noise generation is inherent in all types of pumps; the fundamental frequency of noise, when the pump runs at the design point, is governed by the number of blades and their interaction with the volute cut-water or diffuser guide vane ring. The intensity of the noise generated and the relative strength of the various harmonics produced are determined by the velocity profile shape leav-ing the impeller passages, vortex wakes shed by vanes,andtheimpulsiveeffectastheypassunder the volute cut-water. The impulse wave form, althoughverycomplex,canberesolvedintoafun-damental equal to the speed times the number of blades and a series of harmonics. Manufacturing errors, which produce angle or pitch variations between the blades, are instrumental in gener-ating a less-prominent series of harmonics with fundamental frequency equal to the speed with the amplitude and/or the frequency modulation of the blade-passing frequency. At off-design op-eration, unsteady flow conditions can arise due to flow separation and rotating stall effects.) +8. Cavitation.(Airisentrainedinthesolution,which can damage the pump; impellers constructed with open-grain material, such as cast iron, may disintegrate because of the implosive effect of cavitation.) + +Possible modifications Obviously, if the overall noise level of the pumping plant is considered to be too high to comply with the accepted specifications, identifying and reducing the noise output from the components and equipment in the plumbing system contributing the most noise will yield the most dra-matic results. +Some possible modifications the plumbing en-gineer should consider in order to reduce the noise output from the system are as follows: +1. Gearbox. A silencing enclosure or cladding should be provided. +2. Motor fan. A silencer should be provided at the air inlet and outlet or, if possible, the design should be modified. +3. Motor rotor. The number of slots should be changed or, if possible, its design should be modi-fied. +4. Pumpandpumpbearings.Sleevetypesshouldbe employed. +5. Pump operation. The pump should be operated near design flow conditions in order to achieve the correct system matching. (Modifying the characteristics of the system or altering the di-ameter of the impeller, resulting in operation at lower speeds, will make the pump operate more quietly.) + +197 + + +6. Pump impeller blades. The clearance between the tip of the impeller and cut-water should be increased (a maximum of 85% impeller diameter to volute diameter is recommended). +7. Impellerandguide-vanetips. Shouldbedressed in order to reduce the thickness and intensity of the trailing wakes. +8. Out of balance. Should be balanced to fine limits. Impeller, motor, blades, and rotor should be balanced at all rpms to eliminate—or mini-mize—vibrations. +9. Cavitation. The suction characteristics of the installation/system should be improved. (Ideally, the pump should always be under positive head at the pump suction.) + +Plantnoise Theresultingnoiseoutputoftheplant, as installed on the site, is dependent upon all of the above factors coupled with the induced resonance of theadjacentparts(suchaspipes,bedplates,fabricated stools, tanks, and panels). These factors form part of the final environment of the pump and are discussed under the section “Noise and Vibration Control,” which follows. The effects are best investigated by determining the natural frequency of these parts, by separateexcitation,orbyoperatingthepumpthrough its service-speed range. The natural frequency of the part can be modified by a simple trial-and-error stiffening or damping. +Other effects are also likely to appear for the first time on the site. One of them is the interaction of the pump with the intake sump. Testing a model of the sump intake before installation can prevent air-entraining vortices, eddies, and distorted flow distributions,whichcauseamismatchattheimpeller leading edges. Vortex formations generated entirely belowthewaterlevelcanbeparticularlytroublesome in actual practice, since these formations are caused by water spinning at high velocities, which causes submergedcavitatingvaporcorestobegeneratedand drawnintothesumpintake.Thesevorticescannotbe observed on the site; however, they can be prevented attheoutsetbytestingthesumpmodelwithobserva-tion windows fitted below the surface level. +Associated venturi-meters, valves, and pipes, in thefinalinstallation,contributetoraisingthegeneral noise level of the station. Water at high velocities passing through partially closed valves, particularly in high-pressure systems, can produce severe cavita-tion noise, which is generated by the rapid collapse of the vapor bubbles against the walls of the valve and downstream pipe. Sound-pressure levels of 110 dB have been recorded. +These high sound-pressure levels can be greatly reduced by using multistage pressure breakdown systemsandbypayingspecialattentiontothevalve’s +198 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +port design. Thick-walled pipe and external acoustic installation are only effective for localized noise reduction; they do not reduce the noise in the fluid stream but shroud it where treatment is used. Much of the noise is still carried downstream and, at times, upstream as well, depending on the system. Poor pipe design, involving many sharp bends and sudden expansionsandcontractions,caninduceconsiderable turbulence and noise. +Estimating the noise level of a pump Small, motor-driven pump sets, which are commonly em-ployed in plumbing systems, can be conveniently tested in an anechoic chamber with accurate results. However, the most important sources of sounds in large pumping stations are usually associated with custom-built units. +Pump noise levels are measured by the near-field technique 3 feet (0.9 m) from the unit in order to minimize the sound transmissions from pipe coupled to the pump. The sound-pressure level, at 3 feet (0.9 m) from the pump, can be estimated by using the following equation (presented in the International System of Units, or SI units, which is the best means for available test data): +Equation 10-1 +Pump sound-pressure level = 163.9 + +8.5 log (rpm · specific speed · impeller diam. · impeller width) +(volume flow rate · head) +where +Pump sound-pressure level = dB(A) Volume flow rate = L/s +Head = stages/m Specific speed = m/s +Width and diameter of impeller = mm +Where the noise characteristics of a particular pump are already known, the change of the noise level with the pump speed can readily be determined by using the following equation: +Equation 10-2 +dB = 50 log(N1 ) where +N2 +N1 and N2 = Pump speeds +Flow Velocity and Water Hammer +In simple terms, the magnitude of the pressure increase due to water hammer is a function of the velocityofthepressurewaveandtherateofexchange of the flow velocity. The velocity of the pressure wave (which is the same as the velocity of sound in the water contained in the pipe) depends on the physical properties of the water and of the pipe material. For all commercially available copper pipes, the velocity of the wave propagation has a value in the range of 3000 to 4000 ft/s (915 to 1220 m/s). + +If the flow velocity changes abruptly (e.g., by the suddenclosingofataporvalve),thepressureincrease can be determined by using the following equation: +Equation 10-3 + +where Pr = 144g +WaV +Pr = Pressure rise, lb/ft2 · s +W = Specific weight of liquid, lb/ft3 a = Velocity of pressure wave, ft/s2 +V = Change in flow velocity, ft/s +g = Acceleration due to gravity, ft/s2 +The pressure generated by water hammer may causestraightpipe lengthstovibrate.Ifthepipesare in close contact with the walls and not fixed at suf-ficientlyrigidshortintervals,theymaystrikeagainst the walls with a succession of blows. +Ifsuchfittings(solenoidvalves,foot-actionvalves, spring-loaded taps, and check valves) could be elimi-nated, then the incidence of water hammer could be greatly reduced. However, as these fittings are inte-gral parts of a plumbing installation, the designer mustallowforthiscondition.Thefollowingguidelines are recommended to the plumbing engineer: +• Maintain a water velocity in the range of 4 ft/s (1.2 m/s) at the appliance. +• Secure the piping so that it does not come into contact with the building structure. +• Use rubber isolators. +The use of air vessels (chambers) will reduce the effects of water hammer. A vessel with a flexible membrane to separate the air chamber from the water (water hammer arrestor or shock absorber) is recommended to prevent loss of air. +Design Procedures +To provide a plumbing system that conforms to spe-cific acoustic standards, the designer requires the following information: + +1. The maximum noise levels allowable in each habitable room. +2. Location of equipment with respect to adjacent spaces. +3. Thedataontheacousticperformanceofthebuild-ing materials and the method of construction. +4. The acoustic ratings of the plumbing appliances and fixtures, piping, and valves. +5. The acoustic performance of the noise-isolation devices that can be incorporated in the plumbing installation(i.e.,vibrationmountingsandrubber spacers). +6. The data on the effects of the background noises to screen out the effects of the plumbing noises. +Chapter 10 — Acoustics in Plumbing Systems + + +7. Supervisionoftheplumbinginstallationinorder to ensure adherence to the acoustic details. +Specific acoustic performance guarantees for plumbing installations should be avoided where sufficient research has not been carried out. On any critical projects, the retention of an acoustical con-sultant may be essential. In the end, the final results are as much dependent on the quality of the work-manship and supervision as they are on the design details. Many well-designed projects fail to achieve the required performance because of inadequate supervision, which is necessary in order to pinpoint and correct substandard details. +Noise and Vibration Control +All noise-control problems can be reduced to three basic elements: source, path, and receiver. +Noise-control problems frequently involve con-sideration of several sources of noise, several paths for the transmission of noise, and several different receivers.Therelationshipamongtheseelementsde-finestheseriousnessoftheproblem.Inordertosolve a noise problem, the source strength can be reduced, the path can be made less effective in transmitting sound, or the receiver can be made more tolerant of disturbance. However, most practical solutions involve a trade-off, so concentration on only a single aspect of the problem may result in over-design or an unsatisfactory solution. +For sources that not only produce noise and vi-bration problems but also have the potential to lead to damage or decrease the useful channel space for liquids, it is desirable to reduce the source strength. Cavitation is a typical example of this kind of prob-lem.Thesolutiontothisproblemhingesonthepump suction (i.e., net positive suction head, NPSH). One may consider placing the pump at a lower elevation, if practical, or one may improve the suction piping and raise or pressurize the supply tank. In recent years, efficient suction-assisting devices (such as booster pumps) have become commonly used where low NPSH must be handled at low cost. Several manufacturers supply add-on or built-in inducers for end-suction pumps. +For noise and vibration sources that do not in-fluence systems operating conditions or reliability, control of noise transmission (i.e., the path) from the source to the noise-sensitive area may be the most economical solution. Noise may be transmitted through structure-borne, airborne, and fluid-borne paths. Structure-borne noise travels in the form of high-frequency structural vibrations; airborne noise travels in the form of sound waves; and fluid-borne noisetravelsintheformofpressurefluctuations.The structure-borne path usually plays an important role because the noise source within the pump, or piping , + +199 + + +oftencancommunicatewiththesurroundingsonlyby settingtheenclosureintovibration.Thesevibrations may radiate sound directly or may be transmitted through the supporting structure, to be converted to airborne sound elsewhere. +Vibration isolators, such as resilient mounts and resilient pipe hangers, are commonly used to reduce structure-borne vibrations. Theoretically, in order to design an adequate isolation system, the engineer must realize how much vibratory force is generated bytheequipmentandthemaximumpermissibleforce transmission to the building. Since these design pa-rameters cannot readily be obtained, some practical guidelines have been formulated to provide effective isolation at a reasonable cost. These are generally adequate for all but the most critical or special ap-plications (such as very light or flexible structures or equipment installed above adjoining very quiet spaces). +To ensure that the desired noise isolation is achieved, a detailed vibration-control specification and its stringent enforcement are required. With increased public awareness of noise, government agencies such as the General Services Administra-tion (GSA Guide Specification Number 4-1515-71, Public Building Service) and Federal Housing Ad-ministration (FHA A Guide to Airborne, Impact and Structure-Borne Noise Control in Multifamily Dwell-ings) have established recommended guidelines on noise and vibration control. +However, it is not enough merely to have noise-control specifications. Adequate detailing techniques are most essential for communications between the design engineers and the contractors. For most situ-ations, acoustical details are well developed and are availableformostapplications.Fromapracticalpoint of view, most plumbing fixtures cannot be effectively isolated, although they can be installed to minimize vibration. +Whenpipesareconnectedtovibratingequipment installed on vibration isolators, sufficient flexibility must be built into the piping systems to match the equipment vibration isolators. In addition, adequate flexibility is required in order to protect the equip-ment from any strains imposed by misalignment and bythermalmovementofthepiping.Pipingflexibility can be achieved by the inherent resilience of the pipe insimplebend-and-loopconfigurations(ifthereissuf-ficientlength)orbytheuseofflexiblepipeconnectors, which also attenuate the transmission of noise and vibrationalongthepipingsystem.However,theiruse as vibration-isolation devices should be considered very carefully for the following reasons: +• They are the weakest component in the piping system.(Withoutproperspecificationofthemate- +200 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +rial, installation, and maintenance, they may fail and cause severe water damage.) +• In many instances, sound energy may flank the flexible pipe connectors so that pipe-wall noise is exiteddownstreamoftheresilientbreak.Indeed, the various restraints added by the manufactur-ers to reduce the possibility of failure make the flexiblepipeconnectorsalmostasrigidasthepipe itself. +Studies have found that flexible pipe connectors are most effective in the case of cavitation. Flexible pipe connectors have also been found to be effective in the attenuation of the tonal components at the impeller passage frequency of a pump. +Equipment design Quiet operation of pumps begins with proper design. Although today’s state-of-the-art design and development of pumps and plumbing fixtures has a long heritage, noise is still seldom considered by the manufacturer. This is per-haps because of the designer’s lack of awareness and experience, but even knowledgeable designers yield to economic pressures for cost reduction. +It is obvious that the primary purpose of a pump or plumbing fixture is to move liquids and to perform the necessary plumbing functions. These consider-ations must come first. However, noise and vibration controls should be integrated in the design and may then be expected to lead to improved performance with little or no cost penalty. Quite often, the cost of modification is negligible. The key to effective noise control is a complete understanding of the noise-gen-erating mechanisms. +By simply changing the cut-water clearance of a pump, a major reduction in the blade-passage-fre-quencynoiseisachieved.Similarly,waterfaucetscan easilybedesignedforquietoperation.Foraparticular value of pressure drop, a valve can be designed to minimize cavitation and its resulting noise within the water-pressure design range. +Some water-closet manufacturers indicate that, like dishwashers and food-waste disposers, economy models are noisier than more expensive ones. Nev-ertheless, quietness in water closets is a marketable attribute. One of the problems with flush-valve-op-erated water closets is the high initial noise impulse that is associated with the opening of the flush valve. However, if the valve discharges against a properly selectedresistance,thenoiseimpulsecanbesubstan-tially reduced. There is no doubt that a cost-saving, quiet fixture could be achieved with more research. + +SYSTEM DESIGN +Equipment selection To select a quiet unit, the engineer must have an understanding of the noise characteristics of plumbing fixtures and appliances. + +Good matching between machine characteristics and system requirements is essential for performance, as well as for noise control. For example, in a sys-tem operating over a narrow load range, a pump of single-volumedesign(selectedfornear-peakefficiency operation) is acceptable because the unbalanced radial load on the impeller is the least at optimum delivery. +Adequatecriteriashouldbeestablishedforequip-ment vibration to ensure that there are no excessive forcesthatmustbeisolatedorwilladverselyaffectthe performance or the life of the equipment. There are manywaystodevelopequipment-vibrationcriteria.A simple but satisfactory approach would be to use the criteria that have been developed on the basis of the experience of persons and firms involved with vibra-tion testing of mechanical equipment in the building construction industry. +Pressure Most model plumbing codes have estab-lished the rate of flow desirable for many common types of fixtures as well as the average pressure necessary to provide this rate of flow. Although the pressure varies with the design of the fixture, a pres-sure of 5 to 8 psi (34.5 to 55.2 kPa) at the entrance to the fixture is generally the minimum required for good service at lavatory faucets and tank-type water closets.Apressureof15psi(103.4kPa)maybeample for most of the manufacturer’s requirements. Some fixtures, especially wall-hung water closets, require a pressure up to 25 psi (172.4 kPa). +Waterpressureinmanymainsistypically50to80 psi (334.7 to 551.6 k Pa). As the water flows through a pipe, the pressure continually decreases along the pipe, due to the loss of energy from friction and the difference in elevation between the water main and the fixture. +From a noise-control point of view, it is desir-able to keep the fixture inlet water pressure as low as possible. This condition usually can be achieved by installing pressure-regulating devices in order to balance the pressure gradient in the water system. Many cities experience large pressure fluctuations in the hydraulic gradient of their water systems due to demand changes (such as after working hours). The inlet water pressure must be kept higher than the required minimum pressure to ensure good service. The alternative, if it were practical, would be to have continuousadjustmentsofthesystem’sinletpressure asthedemandchanges.Thesystempressurealsohas a great effect on the occurrence of cavitation. The plumbingsystemmustbeoperatedatapressurelevel high enough to prevent cavitation. +Speed Changes in the operating conditions of the pump have a significant effect upon the level of pres-sure fluctuations, particularly for plumbing systems +Chapter 10 — Acoustics in Plumbing Systems + + +in which resonance exists. It is possible that a 5% changeinthepumpspeedmayresultina70%change in the pressure fluctuations. Also, a valve’s pressure-flow characteristics and structural elasticity may be such that, at some operation point, it will oscillate (perhapsinresonancewithpartsofthepipingsystem) soastoproduceexcessivenoiseorevenphysicaldam-age. A change in the operating conditions or details of the valve geometry may then result in significant noise reduction. +Pipe sleeves One very important consideration for piping-system noise control that seldom receives any attention is the detailing of the piping sleeves at the wall and floor penetrations. Each type of piping sleeve has a specific application, and its acoustical treatment cannot easily be generalized. For example, the acoustical requirements for a piping sleeve used onwaterpipingthatpassesthroughafoundationwall will be different than those for a piping sleeve used for sprinkler pipes that pass through a double-wall construction enclosing a concert hall. However, each caseshouldbetreatedsothatthepipepenetrationwill matchtheacousticalvalueofthewallandprovidethe properseparationbetweenthepipingandthebuilding construction.Thisrequirementmustbemadeclearto the contractor, and entails showing the construction details on the contract drawings. +Most plumbing systems contain many points at which the piping must penetrate floors, walls, and ceilings.Ifsuchpenetrationsarenotproperlytreated, they provide a path for noise transmission that can destroytheacousticalintegrityoftheoccupiedspace. Accepted practice is to seal the openings with fibrous material and caulking in a manner similar to that illustrated in Figures 10-1 and 10-2. Some penetra-tion seals, as shown in Figure 10-3, are also available commercially. +Water hammer A common method of controlling water hammer noise is to install a shock absorber or air chamber where the water hammer is most likely to originate, such as at a faucet or a control valve. In many residential systems, it is common to install one similar to that shown in Figure 10-4. +Pipe wrapping The noise from a pipe may be re-duced by applying a wrapping (lagging) to the pipe. Suchawrappingnormallyconsistsofalayerofporous insulation material placed between the pipe surface and an external, impervious cover. The insulation shouldbeglassormineralfiber;donotuseclosed-cell spongerubberorrigidblowncellularglassorcalcium cilicate. The cover must be supported by the blanket with no structural ties between the outer cover and thepipe.Structuralconnectionsreducetheeffective-ness of the pipe wrapping. The porous insulating material serves three purposes: + +201 + + + + + + + + + + + + + + + + + +Figure 10-1 Pipe-Sleeve Floor Penetration + + + + + + + + + + + + + + + + + + +Figure 10-2 Acoustical Treatment for Pipe-Sleeve Penetration at Spaces with Inner Wall on Neoprene +Isolators + + + + + + + + + +Figure 10-3 Acoustical Pipe-Penetration Seals + + + + + + + +Figure 10-4 Installation of an Air Lock in a Residential +Plumbing System +202 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +• Itkeepstheexternal,imperviouscoverseparated from the surface. +• Itattenuatessound(particularly,athighfrequen-cies). +• It reduces the amplitude at the resonant fre-quency defined by the mass of the cover and the stiffness of the layer of porous material. +Thetypicalnoisereductionfromapipewrapping is in the range of 0 to 5 dB at low frequency and 15 to 25 dB at high frequency. +System layout A system that is undersized (or thatcontainsasectionofundersizedpiping)willusu-ally generate excessive noise. It is good engineering practice to use simple-design pipe layout (i.e., long straight runs with a minimum of elbows and tees ) and long radius elbows and connectors. The straight run can be estimated as being 12 times the diameter of the pipe. Piping layout near pumps and valves is alsoofgreatimportance.Figure10-5illustratessome examples of suction-piping installations. +Vibration isolation The sources most commonly responsible for the generation of noise in plumbing + +systems are discussed in this section. However, most plumbing noise problems are not caused directly by the noise radiated to the air from these sources. Usu-ally,theplumbingsystemtransmitsthesoundssothat themechanicalvibrationfollowsitssupportsystemto the surface and is eventually radiated as noise. +A complete discussion of vibration-isolation theory is beyond the scope of this chapter. Only the methods of vibration control that are readily applied and broadly useful in practical problems are consid-ered here. This chapter does not address the various, specific, vibration-control techniques that are useful only in the hands of a specialist or that require de-tailed measurements and analyses. +Selection criteria A vibration-isolating device should be selected using the following criteria: +1. It must be soft enough to provide the desired isolation effect and have a stiffness that is less than the local stiffness of each of the items it connects. +2. Itmustprovideanaturalfrequencythatisconsid-erablylowerthanthelowestexcitationfrequency of concern. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-5 Examples of Suction-Piping Installations +Chapter 10 — Acoustics in Plumbing Systems 203 + + + +3. It must be capable of carrying the loads imposed on it. +4. It must be able to withstand the environment to which it will be exposed. + +common vibration-isolation devices are illustrated in Figures 10-6 and 10-7. Additionally, refer to Table 10-1 for the recommended static deflection for pump vibration-isolation devices. + + + + +Vibration-control devices In plumbing systems, vibration-control devices generally consist of steel springs, air springs, rubber isolators, pads or slabs of fibrous (or other resilient) materials, isolation hangers, flexible pipe connectors, concrete bases, or any combination of these items. Some of the most + +Steel springs Steel springs are available for almost any desired deflection. These devices are generally usedasvibrationisolatorsthatmustcarryheavyloads wheremoreisolationperformanceisdesiredthanrub-berorglassfiberprovidesorwheretheenvironmental conditionsmakeothermaterialsunsuitable.Theyare generally available for deflection only up through 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-6 Typical Vibration-Isolation Devices +204 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-7 Typical Flexible Connectors + +inches. The basic types of steel spring mountings are as follows: +1. Housed-spring mountings. 2. Open-spring mountings. +3. Restrained-spring mountings. + +ryingawiderangeofloads.Theshape,ratherthanthe pressure,determinethespringfrequency.Airsprings have the advantage of virtually no transmission of high-frequency noise. They have the disadvantage of higher cost, higher maintenance, failure rates and low damping. +Rubberisolators(neoprenemountsandhangers) Rub-ber isolators are generally used where deflections of 0.3inches(7.6mm)orlessarerequired.Thesedevices can be molded in a wide variety of forms designed for several combinations of stiffness in the various directions. The stiffness of a rubber isolator depends on many factors, including the elastic modules of the material used. The elastic modules of the mate-rial vary with the temperature and frequency and are usually a characteristic of a durometer number, measured at room temperature. Materials in excess of 70 durometers are usually ineffective as vibration isolators. Rubber isolating devices can be relatively light, strong, and inexpensive; however, their stiff-ness can vary considerably with the temperature. They are effective primarily against high-frequency disturbances with very limited performance at low frequencies. +Precompressed, glass-fiber pads These devices are generally used where deflections of 0.25 inch (6.4 mm) or less are required. Precompressed, glass-fiber pads are available in a variety of densities and fiber diameters.Althoughglass-fiberpadsareusuallyspeci-fied in terms of their densities, the stiffness of the pads supplied by different manufacturers may differ greatly, even for pads of the same density. +Sponge rubber Sponge-rubber vibration-isolation materials are commercially available in many varia-tions and degrees of stiffness. The stiffness of such a material usually increases rapidly with increasing loadandincreasingfrequency.Thismaterialisrarely used in manufactured isolators but is often used in job-site fabricated installations. +Concrete base Concrete-base devices are usually masses of concrete, poured with steel channel, weld-in reinforcing bars and other inserts for equipment hold-down and vibration-isolator brackets. These devices perform the following functions: + + + +Becausesteelspringshavelittleinherentdamping and can increase their resonance in the audio-fre-quency range, all steel-spring mountings should be used in series with pads of rubber, fibrous or other resilient materials to interrupt any possible vibra-tion-transmission paths. +Air springs Air springs, as steel springs, are avail-ableforalmostanydesireddeflectionwhere6inches. (152.4 mm) or more is required. By varying the air pressureinthebladder,airspringsarecapableofcar- + +1. Maintain the alignment of the component parts. +2. Minimize the effects of unequal weight distribu-tion. +3. Reduce the effects of the reaction forces, such as when a vibration-isolating device is applied to a pump. +4. Lowerthecenterofgravityoftheisolatedsystem, thereby increasing its stability. +Chapter 10 — Acoustics in Plumbing Systems 205 + +Table 10-1 Recommended Static Deflection for Pump Vibration-Isolation Devices Indicated Floor Span, in. (mm) + +Equipment Location +Slab on grade + + + + + +Upper floor above noncritical areas + + + + + +Upper floor above critical areas + +Power Range, Speed, HP (kW) RPM +Up to 7.5 (5.6) 1800 3600 +Over 7.5 (5.6) 1800 3600 +50-125 (37.3-93.2) 1800 3600 +Up to 7.5 (5.6) 1800 3600 +Over 7.5 (5.6) 1800 3600 +50-125 (37.3-93.2) 1800 3600 +Up to 7.5 (5.6) 1800 3600 +Over 7.5 (5.6) 1800 3600 +50-125 (37.3-93.2) 1800 +3600 + +30 ft (9.1 m) +¾ (19.1) ¼ (6.4) 1 (25.4) ¾ (19.1) +1½ (38.1) 1 (25.4) ¾ (19.1) ¾ (19.1) 1 (25.4) ¾ (19.1) 1½ (38.1) 1 (25.4) +1 (25.4) ¾ (19.1) 1½ (38.1) 1 (25.4) +2 (50.8) +1½ (38.1) + +40 ft (12.2 m) +¾ (19.1) ¼ (6.4) 1 (25.4) ¾ (19.1) +1½ (38.1) 1 (25.4) ¾ (19.1) ¾ (19.1) 1½ (38.1) 1 (25.4) +2 (50.8) 1½ (38.1) 1½ (38.1) 1 (25.4) +2 (50.8) 1½ (38.1) 3 (76.2) +2 (50.8) + +50 ft (15.2 m) +¾ (19.1) ¼ (6.4) 1 (25.4) ¾ (19.1) +1½ (38.1) 1 (25.4) 1½ (38.1) 1 (25.4) +2 (50.8) 1½ (38.1) 2½ (63.5) 2 (50.8) +2 (50.8) 1½ (38.1) 3 (76.2) +2 (50.8) 4 (101.6) +3 (76.2) + + + +5. Reduce motion. +Concretebasescanbeemployedwithspringisola-tors, rubber vibration isolators, and neoprene pads. Usually, industrial practice is to make the base in a rectangular configuration approximately 6 inches (152.4 mm) larger in each dimension than the equip-ment being supported. The base depth needs not to exceed 12 inches (0.3 m) unless specifically required formass,rigidity,orcomponentalignment.Aconcrete baseshouldweighatleastasmuchastheitemsbeing isolated (preferably, the base should weigh twice as much as the items). The plumbing designer should utilize the services of a structural engineer when designing the concrete base. +Flexible connectors When providing vibration isolation for any plumbing system or component, the engineer must consider and treat all possible vibration-transmissionpathsthatmaybypass(short-circuit or bridge) the primary vibration isolator. Flexible connectors are commonly used in pipe con-necting between isolated and unisolated plumbing components.Flexiblepipeconnectorsareusuallyused for the following reasons: +1. To provide flexibility of the pipe and permit the vibration isolators to function properly. +2. To protect the plumbing equipment from strains due to the misalignment and expansion or con-traction of the piping. +3. To attenuate the transmission of the noise and vibration along the piping system. + +For plumbing systems, the flexible pipe connec-torsusuallyconsistofhoseconnectorsandexpansion joints. +Mostcommerciallyavailableflexiblepipeconnec-tors are designed for objectives (1) and (2) denoted aboveandnotprimarilyfornoisereduction.Fornoise control, resilient pipe isolators should be utilized. +Vibrationisolationofplumbingfixtures From a practical point of view, most plumbing fixtures cannot be effectively isolated, although these com-ponents can be installed in a manner to minimize vibrationtransmission.Figures10-8,10-9,10-10and 10-15illustratesomeexamplesofresilientlymounted plumbing fixtures. +Vibration isolation of pumps Concrete bases with spring isolators or neoprene pads are preferred for all floor-mounted pumps. It is common practice to isolate a pump in a manner similar to that illus-trated in Figure 10-11. Figure 10-12 shows some of the most common errors found in pump-isolation systems.Table10-1containstherecommendedstatic deflection for the selection of pump vibration-isola-tion devices. +Forcriticalsystemapplications,sumppumpsand roof drains should also be isolated. See Figure 10-13 for a typical installation. +Vibration isolation of piping All chilled, con-denser, domestic, and hot-water piping, including the heat exchanger and the hot-water storage tank, should be isolated in addition to the following: +206 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +should be a precompressed type in order to pre-vent a load transfer to the equipment when the piping systems are filled. +5. Theremainingvibrationisolatorsshouldprovide one-half (½) the deflection of the pump isolators or 0.75 inch (19.1 mm) deflection, whichever is larger. + + + + + + + + + + + + + +Figure 10-8 + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-9 + + + + + + + + + + + + + +Bathtub and/or Shower Installation + + + + + + + + + + + + + + + + + + + + + + + +Suggested Mounting of Piping and +Plumbing Fixture + +All piping connected to plumbing equipment should be resiliently supported or connected. See Figures 10-14 and 10-15 for typical installations. +Seismicprotection Theseismicprotectionofresil-ientlymountedsystemspresentsauniqueproblemfor vibration-isolationselectionandapplication.Sincere-silientlymountedsystemsaremuchmoresusceptible to earthquake damage (due to resonances inherent in the vibration isolators), a seismic specialist should be consulted if seismic protection of such a system is desired. (Refer to the Plumbing Engineering Design Handbook chapter “Seismic Protection of Plumbing Equipment” for more information on this topic.) + +GLOSSARY +Acoustics The study of airborne sound and struc-turalvibrationpropagationoverthefrequencyrange 2 to 20 kHz. +Decibel The unit used to qualify the level of sound (or loudness) relative to an arbitrary reference point [zeroisequalto20Pa(20x10-6 pascals)].Theseunits are also employed to quantify sound power. This unit isthesmallestincrementofchangeinsoundintensity that a normal human being can detect, while a 10-decibel change of increasing or decreasing sound is commonly regarded as a subjective doubling or halv-ing of loudness, respectively. Abbreviated “dB.” +Decibel(A)scale Afrequency-modifiedsoundlevel in which low-frequency and high-frequency sounds are attenuated in a similar manner to that in which the human ear responds to wide-range sounds. It is the most common unit used for sound measurement to relate sound intensity to normalized subjective loudness. Abbreviated “dB(A).” +Hertz The unit of frequency internationally ac-ceptedtobeequivalenttocyclespersecondofsound.1 Hertz is equal to 1 cycle/second. Abbreviated “Hz.” + + + +1. All piping in the equipment room. +2. All piping outside of the equipment room, within 50 feet (15.2 m) of the connected pump. +3. All piping over 2 inches in diameter (nominal size) and any piping suspended below or near a noise-sensitive area. +4. The first three (3) supports provide the same deflection as the pump vibration isolators. They + +Net positive suction head (NPSH) Actual fluid energy available or required at the inlet of a pump. +Noise criteria (NC) curves Employed to assess loudness or annoyance on an octave band basis. These noise criteria (NC) curves have been partially superseded by the “preferred noise criteria (PNC) curves.” +Octave A doubling of the frequency. Also used as the mostcommonfrequencydivisionforthespecification +Chapter 10 — Acoustics in Plumbing Systems 207 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-10 Suggested Installation of Plumbing Fixtures +208 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + +Figure 10-11 Vibration Isolation of Flexible-Coupled, +Horizontally Split, Centrifugal Pumps + +of filters employed for acoustical analyses. +PuretonesDetectableandgenerallyaudiblefrequen-cycomponentswithcharacteristicssimilartowhistles orshrieksgenerallyregardedasbeingmoreobtrusive and more likely to give rise to annoyance than other broadband sounds devoid of such components. +Sound power The total acoustical energy radiated by a device or fitting operating under normal work-ing conditions. +Sound-power level The acoustical output, in deci-bels, radiated by a device or fitting with reference to a sound power of watts and normally determined in octave bands and, typically, at octave bands center frequencies in the range between 63 Hz and 8 kHz. +Sound pressure The oscillation in pressure that gives rise to a sound field in a gas or a liquid. +Sound-pressure level The logarithmic value of sound pressure referenced to a point of absolute zero (usually 20 µPa) in order to provide a convenient nu-merical value, in decibels, typically occurring within the range 0 to 120 dB. Typical sound levels are de-noted in Table 10-2. + + + +Figure 10-12 Common Errors Found in Installation of +Vibration-Isolated Pumps + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-13 Vibration Isolation of a Sump Pump +Chapter 10 — Acoustics in Plumbing Systems 209 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-14 Typical Pipe Run Installations + + +Table 10-2 +Sound Level (dB) + +Typical Sound Levels + +Type of Operation + +100 Hammering on pipes 70 Normal speech levels +50 Background sound in office +30 Background sound in urban bedroom 10 Threshold of hearing for normal adult +Transmissionloss Ameasureofthesoundinsula-tionofapartitionorwall,indecibels.Itisequaltothe numberofdecibelsbywhichthesoundenergypassing through it is reduced. The value of the transmission loss is independent of the acoustical properties of the two spaces separated by the partition. +Vibration The generation of cylic or pulsating forcesthroughaphysicalmediumotherthanairthat converts to sound energy at the boundary between a solid and a gaseous medium. Sound energy may be converted to vibration at the interface between a gaseous medium and a solid medium. +210 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 10-15 Typical Flexible Pipe-Connector Installations +11 “Value Engineering” (VE)—the term alone, is of-ten enough to bring chills and a sweat to a design engineer’s brow, be it in plumbing or any construc-tion phase. Value Engineering’s intended definition is simply to apply a systematic and planned analysis to engineering and design applications in order to obtain some desired effect; in a perfect-world situa-tion, this result would equate to equal or improved performance at a reduced, or minimal total cost. All too often, unfortunately, the definition that has become synonymous with the term “Value Engineer-ing” is: Cutting application engineering and design, including the substitution of products and services, with the intended end result to be reduced costs, by any and all means. However, this is not the intended result of value engineering. +Fromahistoricalperspective,theconceptofvalue engineeringbeganin1947whentheGeneralElectric Company instituted a value-analysis approach to purchasing. The concept was actually nothing more than applying a “systematic” analysis to what was being purchased and how to get the best for the least cost. This systematic analysis approach evolved and begantobeemployedinallaspectsofbusiness—from products and services, to manufacturing, software engineering, and general business management. +Initsoriginalincarnation,valueengineeringwas envisioned to be an analysis approach that provided for cost controls to be instituted at any point in a project or product’s life cycle. The only standard or constant was emphasizing the reduction or elimina-tionofcosts.However,the“firstlaw”ofsuchanalysis was the requirement that any and all cost reductions maintaintheengineeredordesignstandards,quality, andreliabilityoftheprojectorproducttowhichitwas being applied. In fact, the definition from the Society of American Value Engineers is: +“Value Engineering is the systematic applica-tion of recognized techniques which identify the function of a product or service, establish a monetary value for that function, and provide + + + + + + +Basics of Value Engineering + + + + + + + + +the necessary function reliably at the lowest overall cost. “ +The key to the definition is that the objective of value engineering is to not diminish, devalue, or de-gradethequalityoreffectivenessoftheengineeringor designoftheprojectorproduct.Therefore,reductions in cost are not to be made to degrade or cheapen a project’s quality, effectiveness, or reliability. +A similar definition used by the U.S. federal gov-ernment as part of its procurement process is: +“Value Engineering is an organized study of functionstosatisfytheuser’sneeds,withaqual-ity product at the lowest life cycle cost through applied creativity. The study is conducted by a multi-disciplinary team that provides an inde-pendent look at the project. Value Engineering is directed at reducing cost, while maintaining or improving quality, maintainability, perfor-mance, and reliability.” +Unique to the government definition is the ad-dition of: +“In addition, emphasis is placed on preserving uniqueandimportantecological,aesthetic,and cultural values of our national heritage in ac-cord with the general environmental objectives of the Corps of Engineers.” +There are a lot of terms that have been used over the years to describe this concept, including value analysis, value control, value assurance, and value management — all tend to be synonymous terms for valueengineering.Allhavethesamebasicobjectives: Reduce costs, increase productivity, and improve quality. Value engineering is also unique in that it may be introduced at any point of the construction or life-cycle of a project. +What then is the purpose of value engineering? It is to provide a means to systematically analyze a project and control its total costs. It is designed to analyze the functions of a project and determine the “best value,” or the best relationship between its +212 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +worthanditscost.Forafacilitiesconstructionproject, “bestvalue”isafinishedprojectthatwillconsistently perform its required basic function and has the low-est total cost. Therefore, construction of a facility can yield maximum value when value engineering is incorporatedintotheproject.Thisisaccomplishedby providing and developing alternatives that produce the desired results and maintain the quality and reli-ability of the project utilizing the most efficient and effective mix of resources at the least cost. +Itwouldseemthatimplementingvalueengineer-ingwouldbefairlysimple;allyouneedtodoiscontrol and/or reduce costs. First, however, we need to have some perspective about where, how and why value engineering will be applied. For the plumbing engi-neer and designer, the most typical application is the creationofabuilding.Inthisregard,thereareatleast three major aspects of costs that will be of concern to the overall development/engineering/construction “team”: The development costs, the engineering and designcosts,andtheconstructioncosts.Withinthese three areas all related costs associated with the cre-ation of a building will be lumped, such as property acquisition, inspections, licenses and permits, build-out, finishing, etc. +In the end, there is one “person” or organization concerned with the total picture in the creation of a building—the owner or developer. And, as noted earlier, value engineering can be introduced at any point in the construction or life-cycle of the project. Therefore, for maximum efficiency and to assure maximum value, value engineering needs to be inte-gratedfromthebeginningandcontinuethroughouta + +project’slife-cycle.Inthisregard,itisimportantthat the concept of a “team” be immediately integrated intoallaspectsandphasesoftheproject.Foritisthis “team”thatneedstoultimatelyberesponsibleforthe finished project and its final total cost. +As with any project, there are three major com-ponents that comprise the cost cycle: Material costs, labor costs, and administrative and operation cost (which is typically described as overhead). It is up to the “team” to constantly monitor and evaluate all aspectsoftheproject,includinganychangesandmod-ifications that may affect the quality, life-expectancy or life-cycle, maintenance cycles, and reliability of eachaspectoftheproject;fromdevelopmentthrough engineering, design, and construction. Interestingly, although labor is a major component for each area of a building’s creation, it is not often subject to any in-depth analysis in value engineering. Instead, the maineffortofvalueengineeringisdirectedatthecost and value of “things” — the cost of the elements of construction, the functionality of each element, and the materials and products being utilized. +The Intent of Value Engineering In1965,theU.S.DepartmentofDefenseconduct- +ed a study to evaluate cost-saving opportunities that could accrue from the use of value engineering. The study examined a number of projects and analyzed 415 project changes that were considered successful “value changes.” The result of the study was that onlyalimitednumberoffactorscouldachieveover95 percentofcostsavings.Thesefactorswere:Excessive cost,additionaldesigneffort,advancesintechnology, and the questioning of specifications. + + + + +Reason for Change Advances in technology + +Additional design effort + +Change in user’s needs + +Feedback from test/use + + +Questioning specifications + +Design deficiencies + + +Excessive cost + +Other + +Percent Total Savings Achieved +23 + +15 + +12 + +4 + + +18 + +4 + + +22 + +2 + + +Change Definitions +Incorporation of new materials, components, techniques or processes not available a the time of the previous design effort. +Application of additional skills, ideas and information available but not utilized during previous design effort. +User’s modification or redefinition of mission, function or application of item. +Design modifications based on user tests or field experience suggesting that specified parameters governing previous design were unrealistic or exaggerated. +User’s specifications were examined, questioned, determined to be inappropriate, out-of-date or over specified. +Prior design proved inadequate in use (e.g., was characterized by inadequate performance, excessive failure rates or technical deficiency. +Prior design proved technically adequate, but subsequent cost analysis revealed excessive cost. + +Source: Directorate of Value Engineering, Office of the Assistant Director of Defense as taken from “Value Engineering Theory & Practice in +Industry,” Thomas R. King, 2000, Lawrence D. Miles Foundation, Washington, DC. +Figure 11-1 Qualitative Results From the Implementation of Value Engineering +Chapter 11 — Basics of Value Engineering + + +The study (see Figure 11-1) revealed: no single factor was ever dominant in the implementation of value engineering. It was rare for the implementa-tion of the change the result of a “bad” design; trying to “second-guess” a design looking for deficiencies provided little value, because the majority of designs perform as expected. What was discovered is that manydesignsdidnotalwaysprovidemaximumvalue due to excessive costs, over specifying and the lack of value for the project. +What is Value? +“Value” means different things to different people. Thus, there is no one perfect definition of value. For purposes of value engineering, value does not simply equate to “cost reduction.” There are all kinds of “values” — economic, moral, social, political, etc. In terms of value engineering, it is the economic value that most conforms to what is being measured or evaluated. Value, then, is: +The lowest cost to provide the necessary and required products, functions, or services at the chosentimetoitsneededplacewiththerequisite quality. +For engineering purposes, value can be best de-fined by the following formula: +Value = Worth +Cost +In this formula, when value is equal to or greater than 1 (V=1), it is understood that there is equality of value. As an example, consider the specification of a vacuum pump. The pump is vital to the function of the design. If the pump costs $1,000 and it is indeed worth $1,000, then there is equality of value (“good value”). If the pump is only worth $800 and cost $1,000,thenthereisimperfectvalue(“poorvalue”).If thepumpisworth$1,200andcost$1,000,thenthere is increased value (“outstanding value”). +Which then brings up the whole concept of cost and worth. Cost seems pretty straight forward. It’s what you pay for the product or service. But, what is worth? For value engineering purposes, worth is the concept of the value of a function, product, + +213 + + +system, etc. Or, alternately stated, worth is the least cost to provide the function, product, or service. Still confused? It’s no wonder. The concept of value and worthareamorphous;theyarenoteasilymeasuredor defined. A number of basic questions were developed as part of the concept of value engineering. To help determine “value” and “worth,” it is important to notethatthesequestionsrelatetothegeneralnature of value engineering, and are relevant for all types of engineering, from construction to manufacturing. They have been modified below to be more construc-tion specific.) +1. Are the products, systems, and materials neces-sary for the functionality of the project, and do they contribute value to the project? +2. Are the costs of the products, systems, or materi-als in proportion to their usefulness within the project? +3. Do the designed or specified products, systems, or materials need all the designated features? +4. Are there other products, systems, or materials available that will accomplish the intended use or purpose and provide better performance? +5. Are the exact products, systems, or materials available for less? +6. Are there other products, systems, or materials available that will accomplish the intended use or purpose at a lower cost? +7. Are there other products, systems or materials available that will accomplish the intended use and purpose with an equal performance? +8. Is there another dependable supplier that can provide the products, systems, or materials for less? +9. Does the total cost of the products, systems, or materials include all materials, reasonable labor, and overhead? +10. Aretheproducts,systems,ormaterialstheproper ones consideringthequantity available or manu- + + +Job Plan Phases +Noted Practitioners Name SAVE* + +Miles +Information Analysis Creativity Judgement Development Development Presentation Follow-up + +Fowler +Preparation Information Analysis Creativity Synthesis + +King +Information Function Analysis Creative Evaluation Implementation Presentation Implementation Follow-up + +Parker +Information Function Creative Judicial Development Investigation +Recommendation + +Mudge +General Information Function Creation Evaluation Presentation + +International +Information Function Analysis Creative Evaluation Development + + +Figure 11-2 Value Engineering Job Plan Examples * SAVE International, Society of American Value Engineers, International. +214 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +factured, or the quantity that is needed and will be used? + +ELEMENTS OF VALUE ENGINEERING +In the world and vernacular of value engineering, a value engineering analysis incorporates a VEJP (Value Engineering Job Plan). Because this analysis is in itself an engineering project, the job plan is di-vided into “phases.” The number of phases can vary (seeFigure11-2).Italldependsonwhat“expert”you have learned from, what books you’ve read and what direct experience you have had in conducting value engineering projects. +It doesn’t really matter how many phases there are in a VEJP. What is vital is that the engineer be comfortable with all the phases of his/her plan, understand the various techniques for each phase’s evaluation and analysis, and that the plan provide a systematic and consistent approach for imple-mentation of the project. This introduction to value engineeringintegratesthesixgeneralphasesaslisted by Society of American Value Engineers (SAVE) with thefivephasesfromLawrenceE.Mills(consideredthe “father” of value engineering) and incorporates the various techniques of implementation within each. +Phase One: Information +This phase addresses three questions: “What is it?” “Whatdoesitdo?”and“Whatdoesitcost.”Inpractice this phase describes the project and collects the nec-essary information, both critical components for the remainder of the value engineering project. Actually, gathering information is pretty simple and straight-forward. The really hard part is making sure the information gathered is factual, accurate, unbiased, untainted by opinion, and contains no assumptions. As every plumbing engineer knows, the hardest part of the project is collecting accurate and factual information. A project can only be engineered and designed according to the quality of information used. Likewise, value engineering is only as good and accurate as the quality and accuracy of the data and information collected and used throughout the +process. +The information phase of value engineering is the heart of the overall process. It is also undoubt-edly the hardest to explain and understand as the collection of the data that will be vital to a successful value engineered result is often colored by layers of subjectiveness, biases and lack of objectivity. +The key to successful information gathering is being prepared. The value engineer, like the plumb-ing engineer, depends on organization and structure and design standards. The value engineer collects the key information in a standardized format. The use of forms or checklists is helpful in this endeavor. + +The value engineer’s job is compounded by having to collect information from many individuals and disci-plines. For this reason, it is best to integrate value engineering throughout each phase of the project: Conception, design, engineering, bidding, construc-tion, commissioning, and occupancy. +For the plumbing design portion of a facility, the value engineer must follow the engineer’s thinking and collect and assemble the same information used bytheengineer(seefigure11-3).Thismeansdetailing every product and design element. + +ABC Project — Plumbing Design +Project Description Documents +Original Client Directions/Specifications Architectural Drawings +Engineering Drawings Detail Drawings Materials List +Details of Materials Examined/Considered Material Line Information +Product List +Details of Products Examined/Considered Product Line Information +Vendor Information +Figure 11-3 Information Gathering + +TherearemanyvariationsofVEworksheets,but typicallytheyincludethebasicinformationformthat describestheprojectandrelateddatasuchasinFigure 11-4A. Additional information forms such as Figure 11-4B, allow each detail of the project or design. +The next phase of the information collection pro-cess is to understand the background and purpose of the complete project and each of its elements. This requiresdevelopingtherightquestionsorchecklistof items that need to be collected, understood, and used for the remainder of the engineering process. Figure 11-5 is a sample of such a checklist. +As the VE collects all this information, he/she needstokeepadetailedrecordofinformationsources and types of actions needed or taken. This record provides the forensic trail that will backup the final conclusions. It is a way to track each stage of the information collection process and provides a refer-ence record and a source record for the analysis and recommendations. A sample of a source record form is shown in Figure 11-6. +With all the information and data that has been collected, the engineer must still make a qualitative determination of its value. The following can help make that determination of questions: +1. Does the information/data support the defini-tion/specifications/requirements of the project? +2. Doestheinformation/dataseemtobefactualand valid for the project/detail being analyzed? +Chapter 11 — Basics of Value Engineering 215 + + + +Value Engineering Consultants Project Information + +Reference Number: Date: + + +Name of Project: + + +Project Element: Project Detail: + + +Detail Name: + +Description: + + + + +Detail Location: + +Description: + + + + +Drawing Number: + + +Materials List Number: + + +Product List Number: + + + +Pertinent Information: + + + + + + + + + + + + + + + + +Figure 11-4A General Project Information Collection +216 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Value Engineering Consultants Project Information +Reference Number: Date: + + +Name of Project: Project Location: +Address: City: +Lot Number: +Owners: Address: City: +Telephone: +Developers: Address: City: Telephone: +Architects: Address: City: Telephone: +Engineers: Structural: Address: City: Telephone: +Electrical: Address: City: Telephone: +Plumbing: Address: City: Telephone: +HVAC: Address: City: Telephone: +Communications: Address: +City: Telephone: +Other: Address: City: Telephone: + + + + +State: +Lot Description: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + + +State: Fax: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + + + +Zip: + + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + + + + + + +Figure 11-4B Detailed Basic Project Information Collection (Continued) +Chapter 11 — Basics of Value Engineering 217 + + + +Value Engineering Consultants Project Information +Reference Number: Date: + + +Name of Project: Project Location: +Address: City: +Lot Number: +Owners: Address: City: +Telephone: +Developers: Address: City: Telephone: +Architects: Address: City: Telephone: +Engineers: Structural: Address: City: Telephone: +Electrical: Address: City: Telephone: +Plumbing: Address: City: Telephone: +HVAC: Address: City: Telephone: +Communications: Address: +City: Telephone: +Other: Address: City: Telephone: + + + + +State: +Lot Description: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + + +State: Fax: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + +State: Fax: + + + + +Zip: + + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + + + + + + +Figure 11-4B Detailed Basic Project Information Collection (Continued) +218 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Value Engineering Consultants Project Information — Continued +Reference Number: Date: + + +Contractors: Structural: Address: +City: State: Telephone: Fax: +Electrical: Address: +City: State: Telephone: Fax: +Plumbing: Address: +City: State: Telephone: Fax: +HVAC: Address: +City: State: Telephone: Fax: +Communications: Address: +City: State: Telephone: Fax: +Other: Address: +City: State: Telephone: Fax: +Suppliers: Structural: Address: +City: State: Telephone: Fax: +Electrical: Address: +City: State: Telephone: Fax: +Plumbing: Address: +City: State: Telephone: Fax: +HVAC: Address: +City: State: Telephone: Fax: +Communications: Address: +City: State: Telephone: Fax: +Other: Address: +City: State: Telephone: Fax: + + + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Zip: E-mail: + + +Figure 11-4B Detailed Basic Project Information Collection (Continued) +Chapter 11 — Basics of Value Engineering 219 + +Value Engineering Consultants Project Information Checklist + +Reference Number: Date: + +Project Details + +1. Detailed Specificatons established by user/owner: + +2. Detailed Requirements established by user/owner: + +3. Project Considerations: +A. Environmental Conditions (before, during, after): + +B. PhysicalSpaceLimitations: + +C. Desired/Required a. Reliability: +b. Serviceability: c. Maintainability: c. Operability: +4. Prior Experiences/Concerns A. Historyofprojects: +B. Operationofprojects: C. Maintenanceofprojects: +5. Anticipated Market A. Requirements: +B. Expected Percentage of Total Market: C. MarketExpectedtoServe: +6. Anticipated Life +A. OfOriginalBuiltProject: B. TotalLifeWithRehab: +7. Project Competitors: + +8. WhatLiscensingorPermitsNeedtobeConsidered: + +9. What Are Desired: +A. PhysicalRequirements: +B. PerformanceRequirements: C. WorkmanshipRequirements: +10. Is This Project to be Part of a Larger Project: + +11. What New Developments, Technology, State-of-the-Art Engineering/Design/Materials are Contemplated: + + +12. AreThereAnySpecialProcessesorUsesfortheProject: + +13. WhoIsResponsibleforOverseeingPurchasingforOverallProject: + +14. WhoIsResponsibleforOverseeingContractorsforOverallProject: + +15. Anticipated Project Milestones for: A. Changes/Modifications: +B. Improvements + +Figure 11-5 Project Description (Continued) +220 ASPE Plumbing Engineering Design Handbook — Volume 1 + +Value Engineering Consultants Project Information Checklist + +Reference Number: Date: + +Detail/Product/Material Specification + +Detail/Product/Material Description: + +1. Detailed Specificatons established by user/owner: + +2. Detailed Requirements established by user/owner: + +3. Detail/Product/Material Considerations: +A. Environmental Conditions (before, during, after): + +B. Physical Space Limitations: + +C. Desired/Required a. Reliability: +b. Serviceability: c. Maintainability: d. Operability: +e. Special Features: + +4. Prior Experiences/Concerns With This Detail/Product/Material A. History of Detail/Product/Material: +B. Operation of Detail/Product/Material: C. Maintenance ofDetail/Product/Material: +D. Reasons for Replacement Needs of Detail/Product/Material: E. OperatingLifeofDetail/Product/Material: +5. Anticipated General Market for This Detail/Product/Material A. Requirements: +B. Expected Percentage of Total Market: C. Market Expected to Serve: +6. Anticipated Life of Detail/Product/Material: + +7. Detail/Product/Material Competitors: + +8. Are There Any Liscensing or Use Limitations That Need to be Considered: + +9. For the Detail/Product/Material What Are Desired (consider weight, dimentsions, tolerances, shock and vibration, facility environment, operating environment, life, performance, appearance): +A. PhysicalRequirements: +B. PerformanceRequirements: C. WorkmanshipRequirements: +10. Is This Detail/Product/Material to be Part of a Larger Detail/Product/Material + +11. Is This Detail/Product/Material to be Used In Quantity? If So, Explain: + +12. What New Developments, Technology, State-of-the-Art Engineering/Design/Materials are Contemplated for the Detail/Product/Material: + +13. Are There Any Special Processes or Uses for the Detail/Product/Material: + +14. How Many Suppliers/Manufactures/Sources Are There for the Detail/Product/Material: + +15. Who Are the Suppliers/Manufactures/Sources for the Detail/Product/Material: + + +Figure 11-5 Project Description +Chapter 11 — Basics of Value Engineering 221 + +Value Engineering Consultants Project Information & Data Sources + +Reference Number: Date: Information/Data Collector: + + +Source of Information/Data Information/Data Received Action Taken + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 11-6 Information and Data Sources +222 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +3. Is all the information/data current and up-to-date? +4. Does the information/data form an integrated whole? Does each item support the other items? +5. Are there any conflicts within the information/ data collected? +6. Doestheinformation/dataconformtotheexpecta-tions of the investigator? +7. Is there information/data that is suspect? Does some of the information/data seem to be inaccu-rate or nonrepresentative of the project/detail? +8. Is there additional information/data that needs to be collected? +9. Dotherelationships/associationsbetweenthein-formation/data sets require further exploration? +10. Is there any reason to suspect that any of the information/data is biased, not objective? +11. Iftheinformation/datacausesanyconcernorcre-ates a restrain to the analysis can, it be verified by more than one source? +Determine/Collect Costs: Collection of the costs related to the project/detail/material being analyzed is the next step in the information/data collection phase. Cost determination can quickly become com-plexandoverwhelming.Sufficetosay,thesmallerthe design element of a project— such as a stand-alone product, like a pump or water heater that is being analyzed—the easier it will be to come to grips with a cost determination. The total value engineering of afacilitywillinvolvedeterminingcostsforallaspects ofthedevelopment,engineering,design,construction, and commissiong of the project. +Forthevalueengineer,thesecostsareameasure-menttoolfortheotherinformation/datathathasbeen collected and a determinant of the economic impact of the item under consideration (and thus a measure for the level of effort that should be applied.) + +Thearetwoprimaryelementsofestablishingthecost of a design/product/material: the material cost and the labor cost. It is important to note at this juncture that a cost is not the same as the acquisition price. Costdeterminationbecomescomplicatedbyeconomic forcesappliedthroughouttheprojectlife-cycle.There are project costs, development costs, product/assem-bly/material costs, labor costs, overhead costs and, of course, a markup for “profit.” +All the costs associated with a project need to be determined.Furthermore,theyneedtobesegregated into actual and estimated, and a record must be kept of the original source for the information/data. +What is Cost? Value engineering is big on the term “cost.” However, as noted earlier, cost can mean dif-ferent things to different people and for different reasons. The first important “law” is that, in most instances, cost and price are not synonymous. Con-sider cost to be the valuation of labor, time, and other resources used to achieve the end result. A “price” is a fixed sum for a given item or service that results in the transfer of ownership of the product or service. The difference between cost and price is often noth-ing more than perception (i.e., whether you are the buyer or the seller). So, for example, the cost of the product for the seller is included in the price to the buyer. On the other hand, the price to the buyer may be the “cost” and additional value will be added to determine a new and different price. +Invalueengineering,theprimaryelementiscost! Of course, to complicate matters there are product and producer costs and total cost to a user. For most facility projects, both of these cost structures are go-ing to be part of the analysis. +There are three costs involved with any proj-ect/design/material: The major or prime costs, the overhead costs, and the cost of goods. The best way to describe all this is with a simple diagram (see Figure 11-7). + + + +Cost Structure of Product/Service/Good +Indirect Labor +Direct Labor +{ + + +Profit +Purchased/ +} + +Selling Costs +} + +General and Administrative Costs Final Purchase/ +} +Selling Price Field Service and Miscellaneous Costs Overhead Costs Cost of Goods +Indirect Material Cost Acquisitio Installed Costs +} +Direct Material Cost Major/Prime Costs + +Figure 11-7 Cost Structure of Product/Service/Material +Chapter 11 — Basics of Value Engineering + + +In the facility “business” there may be myriad levelsofpurchasers—fromtheownertothedeveloper to the architect to the engineer/designer to the con-tractor.Therefore,thecoststructureactuallybecomes a pyramid of costs and prices with different “users” alongeachlinkintheprojectchain.Figure11-8gives ageneralizationofthecostmakeupforeach“user”at the different stages of the facility project process. +{ + + +Maintenance Costs + + +Operating Costs Total Installation Costs +Cost Cost of Shipping/Receiving/Storage Base Acquisition Costs + + +ice/First Cost + +Figure 11-8 Generalized Total Cost to Each User + +A wide variety of costs go into each element and aspect of a facility. These costs are divided into ongo-ing costs and one-time costs. Ongoing costs are those that will occur throughout the life of the project. The owner has one set of ongoing costs, while each prod-uct/service/materialproviderhasitsownongoingcost + +Ongoing Costs +Labor +Administration, Management, Operations Ongoing Staffing +Technical Support Field Services Quality Control +Administrative Support Documentation (In-house) Inspections +Purchase orders/paperwork +Reports: producing, receiving, sending Documentation +Handbooks, User Manuals Certifications +Training +Product/Services/Materials Basic Materials Subcontracts Intercompany Effort +Administration & Operations (e.g., reproduction) Indirect supplies, services materials +Other & General Travel +Equipment rental/leasing Contracted Services Shipping & Freight Inventory + +223 + + +structure.Likewise,thereareone-timecostsforallof these providers. Figure 11-9 offers an example of the differingcostelementsthatwillnotonlycomprisethe cost of a total project but also be considered at each stage of the project process. +Withallthecostscollectedanddetailed,theanaly-sis can proceed. The next step is to relate all of the coststoeachother,definerelationships,andestablish which of the costs are related to specifications for the project/design and which are imposed requirements. Costsassociatedwithspecificationsarethoseimposed bytheowner/developer/userofthefacility.Thesecosts canbeconnectedtotheland,constructionlimitations, or user-defined needs. +Required costs are those that different vendors, project managers, and contractors impose on the project due to his/her experience and knowledge. They are the “expert” costs that form the basis for the creation of the facility. +Itisthevalueengineer’sjobtodiscoverandunder-standallthesedifferentpotentialcosts.Then,aspart ofhis/heranalysis,theengineermustdifferentiatebe-tween costs that are “real”— based on specifications, availableinformation,andconditions—andthosethat are “imaginary” (skewed by bias, attitudes, habits, lack of information, old technology, lack of ideas and creativity, and temporary conditions). + +One-time Costs +Labor Engineering Design +Drafting and Review +Production planning and engineering Procurement +Development Testing & Review Field Engineering Training +Administrative Support Services Documentation +Licensing, Permits, Inspections Purchase orders/paperwork +Reports: producing, receiving, sending Documentation +Handbooks, User Manuals Certifications & Inspections +Products/Supplies/Materials Special Tools +Special Equipment (e.g., test equipment) Administration & Operations (e.g., reproduction Change orders, modification, corrections +Other & General Travel +Equipment rental/leasing Contracted Services Shipping & Freight +Disposition of Equipment/Materials + + +Figure 11-9 Cost Breakdown Checklist +224 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Value engineering has come about because users will inevitably overestimate their needs and have unrealistic expectations. This will be compounded by those involved in a facility project who often over-engineer and over-design at the beginning of a project due to the unrealistic expectations and over-estimates of the owner/user. It is the value engineer who must bring expectations, estimates, and reality into focus. +The Pareto Principle: Vilfredo Pareto devel-oped an economic theory regarding the distribution of wealth. This principle has found its way into many disciplines of engineering, and especially value engi-neering, where the principle is better known as the 80/20 Rule. In its original form, Pareto stated that 80 percent of all wealth is held by just 20 percent of all people. This 80/20 principle has been applied to everything from manufacturing to construction to engineering principles. In this chapter’s context, it states that 80 percent of a facility’s costs will be as-sociated with just 20 percent of its components. +Is it true? The principle is stated as the theory of the Law of Inverse Proportions and is actually a con-cept. It is very useful when examining the resources + +Active Verbs (Desirable) +Apply Amplify Attract Change Collect Conduct +Control Create Emit Enclose +Establish Filter Hold Induce +Impede Insulate Interrupt Modulate Prevent Protect Rectify Reduce Repel Shield Support Transmit +(Less Desirable) Provide + + + + +Passive Verbs (Desirable) +Create Decrease Establish Improve Increase + +available for a project and focusing on those that will providethelargesteconomicbenefitandresultinthe highest levels of return for the expended effort. +Phase Two: Analysis/Function Analysis Thequestions“Whatdoesitdo?”and“Whatisitsup-posed to do?” continue to be addressed in this phase and concisely sum up this concept. In this phase the engineerneedstoidentifythefunctionsoftheproject. The Analysis/Function phase is often considered the “heart”ofvalueengineeringbecauseitisinthisphase that the engineer has a methodology to reestablish the original project/element needs into simply work-able expressions. +For example, value engineering, the accepted definitions for “Function” are: +That which makes a product work or sell; that which satisfies the needs or requirements of the user. +If it were only that simple. The difficulty in this phase is the translation and giving of substance to the words used for project/element specifications and requirements. An engineering discipline has taken these words, brought them to life, and provided a vi- + +Measurable Nouns (Desirable) +Contamination Current Density Energy +Flow Fluid Force Friction +Heat Insulation Light Liquid Load Oxidation +Protection Radiation Torque Voltage Weight + + + +(Less Desirable) +Article Component Damage Device +Circuit Part Repair Table +Wire +Nonmeasurable Nouns (Desirable) +Appearance Beauty Convenience Costs +Exchange Features Style +(Less Desirable) Effect Form +Loops Symmetry + + +Figure 11-10 Function Definition Verbs and Nouns +Chapter 11 — Basics of Value Engineering + + +sualinterpretation.Thevalueengineermustnowalso examine those same words and provide a structured evaluation and analysis to them — which results in a functional analysis and/or definitions. + +RULES OF FUNCTION ANALYSIS There are three generally accepted rules for con-ducting functional analysis or creating functional definitions. +Rule 1: The expression of all functions must be accomplished using two words; onemust be an active verb, the other a descriptive or measurable noun. Figure 11-10 offers a sample listing of verbs and nouns typically used in value engineering functional definitions. +Rule 1 is based on the adage that less is more. The concept is if you cannot provide a definition of a functionintwowords,eitheryoudonothaveenough information about the project/element, or the item has not yet been defined in its simplest form. By be-ing limited to two words, you will be able to describe the simplest element of the project in a manner that reduces the potential for mis-communication or mis-understanding. +Rule 2: All functional definitions can be divided into one of two levels of importance: Work or ap-pearance (or selling). Work functions are expressed in action verbs and descriptive or measurable nouns that establish a quantitative statement for the item. AppearanceorSellfunctionsareexpressedinpassive verbs and in general or nonmeasurable nouns that describe a qualitative statement for the item. +Rule 2 provides meaning to the descriptive terms orrule1.Thedefinitionsherearedesignedtoamplify the meanings of the function under consideration. If thefunctioncannotbedescribedwithactionoractive verb,thefunctionalityoftheelementisquestionable. If there is no action, then nothing is being accom-plishedand,thus,thereisnoendresultorusefulness to the function. +By using measurable nouns, the evaluating en-gineer will establish a cost-to-function relationship. These nouns provide a quantitative measure to the function, and, therefore, provide a measurable level of usefulness for the function. +Why,then,haveappearanceorsellfactors,ifthey do not provide any quantifiable or measurable attri-bute?First,havingappearanceorsellfactorsinvolved in the function that can be separated out, will help in the assignment of some proportionate amount of the elements cost. Second, by identifying these function descriptors, the engineer will be providing a further description of the specifications and requirements of the function. This will help the owner in the final decision process regarding the function. While the value engineer may well find an equal element at + +225 + + +lower cost, it may be that the nonquantifiable part of the requirements is an overriding consideration. (E.g, color; while a basic white porcelain bowl may be less expensive, the use of a special color porcelain bowl may be an important and overriding appear-ance/selling requirement.) +Rule 3: All functional definitions can also be divided, into one of two descriptive uses: Basic or secondary. A basic function is one that describes the primary purpose for a product, system, or material. Secondary functions are all other functions of the product, system, or material that do not directly accomplish the primary purpose but support the primary purpose or are the result of a specific engi-neering or design approach. In functional analysis, the secondary functions are the ones that can be combined, modified, or eliminated. +This rule further enhances the ability to assign a relative importance to the function. For a majority ofprojects/products/materials,thereisonlyonebasic functiontobederived.Inthoserarecaseswhenmore than one basic function is stated, usually it is just a restatement of the original basic function. When there are secondary functions, they tend to fall into two categories: Specific and dependent. +Specific functionality requires a specific action to be accomplished. Dependent functionality are those functions that require some prior action before it can be performed. Secondary functions can exist because they are part of the specifications or requirements, or because they are inherent to the engineering or design approach used. +Function Definitions +With all the rules in place and understood, the value engineer begins the function analysis. Figure 11-11 shows a sample of the type of form that helps in this phase. The form is straightforward, and, given all the definitions and explanations supplied, should be self-evident.Themostimportant partofthisphaseis to define the function or the element under analysis and create its functional definitions. +Example3inFigure11-11isconsideredoneofthe quintessentialexamplesinvalueengineeringanalysis for explaining the use of two-word definitions. The pencilisaneverydayobjectthatrequiresasuccessive andseeminglyunnecessarynumberofitemstodefine it and all of its elements. However, this remains the crux of the value engineering definition phase. Ex-ample 4 in Figure 11 provides an example that could well be used to evaluate a product used in plumbing engineering. However, as should be obvious, in both theseexamples,theemphasisofthevalueengineering would be in the manufacture of the item and is not related to its role in a construction project. +OnlyaportionoftheforminFigure11-11isfilled out at this early stage of the analysis process. At a +226 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Value Engineering Consultants Functional Definiton and Analysis + +Reference Number: Date: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + + + + + + +Item Qty Descrp. + + +FUNCTIONS* + + +VERB NOUN + +Label Function +Cost per V= vital AP Function E = Essential +B S W SL (Estimate) N = Nice to Have + + + +Notes/ Comments + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Note: B — Basic +S — Secondary W — Work +AP/SL — Appearance/Sell + + +Figure 11-11 Function Analysis/Definition Form +Chapter 11 — Basics of Value Engineering 227 + + + + + + + +Item Qty Descrp. + +Example 1: Expansion Chamber +Label FUNCTIONS* Function +Cost per V= vital AP Function E = Essential +VERB NOUN B S W SL (Estimate) N = Nice to Have + + + + + +Notes/ Comments + + + + + +1 + +Contain Expansion Provide Tank + +Liquid X Pressure X + + + + + + + + + + + + + +Item Qty Descrp. + + + +FUNCTIONS* + +VERB NOUN + +Example 2: Wall Box +Label Function +Cost per V= vital AP Function E = Essential +B S W SL (Estimate) N = Nice to Have + + + + +Notes/ Comments + + + + + +1 + + +Wall Box + +Confine Store Protect Protect Prevent Enhance Establish + +Material X Material Inside Material X Loss Appearance Privacy + + +X X + +X +X X + + + + +Figure 11-11 Function Analysis/Definition Form (Continued) + +minimum, the function is defined, and, if necessary, its elements. At this stage, only basic and secondary indicators are marked. The remaining portion of the form will become part of the evaluation phase. +FAST +There is a second approach that is an adjunct to, and works in tandem with, function definitional analysis. This approach is known as FAST, which stands for Functional Analysis System Technique. The FAST process is essentially a diagraming process. With diagraming, a visual representation is created that highlightsthefunctionsofaproduct/system/material and the interrelations between them. +A basic FAST model diagram is shown in Figure 11-12. The FAST model is a building process that will: +• Help to avoid a random listing of functions. The requirement of functional analysis requires the use of verb–noun definitions. The FAST diagram will help sort out the functions and show inter-relationships. + +• Help to find any missing functions. +• Aid in the identification of the basic function and understanding the secondary functions. +• Provideavisualizationandbetterunderstanding of the product/system/material under study. +• Result in a team consensus in defining the prod-uct/system/material under study. +• Provide a test of the functions utilizing system analysis and determinate logic. +• Demonstrate the team approach has fully ana-lyzed the elements. +The parts of FAST shown in Figure 11-12 are: +1. ScopeLines:Thetwoverticaldottedlinesprovide a boundary to the function under study. It is that part of the function which is of concern. +2. Highest Order Function: The object or output side of the basic function under study is referred to as the highest order function. Additional func-tions to the left of another on the critical path is a “higher” order function. +228 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Example 3: Pencil +����������������������������� ��������������������������������� + +� ����������������� � ����� + + +��������������������������������������� ����������� ���������������������������������� + +Pencil +Make Marks + + + + + + +� � + +� � +� ����� ������ �������� + +� � ����������� +� � � � +����� ����� + +� � � � � ������ � � � � � �������� � � � � ���������� �������� +� � � ���� ��������� �������������� �� �� ������ ����������� ����������������� + + + +������ �������� + + + + + +1 Eraser + + + + +1 Band + +Remove + + + + +Secure Improve + +Marks X X + + + + +Eraser X Appearance X + + + + + +1 Body + +Support Lead X +Tansmit Force X Accomodate Grip +Display Info + + + +Protect 1 Paint Improve + +Wood Appearance X + + + +Make Marks X 1 Lead + + + + + + + + +����� � ��������� +� ������������� � �������� +� ����������������������� +Figure 11-11 Function Analysis/Definition Form (Continued) +Chapter 11 — Basics of Value Engineering 229 +� +� +One Time +Function +Ongoing +Function +WHY? +Project +Objectives +Project +Specifications +Independent +Function +(Supporting) +Dependent +Function +Dependent/ +Sequential +Function +Critical Path (Minor) +Independent +Function +Basic +Function +Dependent +Function +Dependent/ +Sequential +Function +Dependent/ +Sequential +Function +Dependent/ +Sequential +Function +Lower Order +Function +(Input) +Concurrent of +Synonymous +Function +Critical Path (Major) +Support +Function +Activity +Sequential +Function +Scope of Function Under Study +� +Higher Order +Functions +Scope Line +Lower Order +Functions +Scope Line +� +� + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +� +HOW? � +WHEN? +Higher Order +Function +(Output) + + + + +Figure 11-12 Function Analysis Systems Technique (FAST) Model +230 ASPE Plumbing Engineering Design Handbook — Volume 1 +� +� +� +� + + +WHEN +� + + + +Independent Function +� + + + +WHY �HOW +� + + +Higher Order Function + +WHEN +WHY Function HOW� + +WHEN + + +Lower Order Function + + +Activity + + + +WHEN +� +Independent Function +� + + + + + +Higher Order Function + +WHEN + +WHY Function HOW� + + +WHEN + + + +Lower Order Function + + + +Activity + + +Figure 11-13 HOW and WHY Relationship with Example + + +3. Lower Order Function: Functions to the right of another function on the critical path are a “lower” order functions. This is not to imply a relativeimportanceorrankingtothesefunctions. Rather,the“lower”functionsarethosenecessary to successfully perform the basic or higher order function. +4. Basic Function: The function under study. The basic function cannot change. +5. Objectives and Specifications: These are the parameters and requirements that must be achieved for the function to perform as needed in itsoperationalplaceintheproject.Objectivesand specifications are not themselves functions; they influence the selection of lower order functions. +6. Critical Path Functions: Any function that is on the HOW or WHY logic path is a critical path function. If the function is on the WHY path it is considered a major critical path. Otherwise, like the independent supporting functions or the dependent functions, it becomes a minor critical path item. Supporting functions tend to be of + +secondary value and exist to meet the perfor-mance requirements specified in the objectives and specifications. +7. Dependent/Sequential Functions: To exist, functions to the right of the Basic Function are dependent on the functions to their left and re-quire one to be completed before they enter as a performance requirement. +8. Independent Functions: These functions are aboveorbelowthecriticalpathlineandareneces-sarytosatisfytheWHENquestioninrelationship to the main or basic function. +9. Independent(supporting)Functions:Thesefunc-tions do not depend on another function as does a dependent/sequential function. However, they are still considered secondary functions to the basic function and the major critical path. +10. Function: The end event or purpose of the prod-uct/system/material under analysis. It must first be expressed in a verb–noun form. +Chapter 11 — Basics of Value Engineering + + +11. Activity: The method selected to perform a function. +For engineers familiar with systems-type dia-graming, it would appear that the FAST diagram is backwards. As an example, consider the position of the WHY part of the function. For systems analysis, it is on the left. But for FAST the HOW function is in the left position and dominates the analysis. In this position, all the functions/activities to the right are dependent on the basic function or moving toward the WHY of the function. +Figure 11-13 diagrams the how, why, and when relationship, relates it to the FAST diagram, and shows a simple how functional relationship. +Purpose of the Model +As it turns out, in the team environment the FAST model, while a means to an end, is not the vital part of this process. The vital part is the dialogue and dis-cussions between the team members as the model is formulatedandbuilt.Itistheprocessofidentification — functions, questions, justifications, relationships — that is the key to the structure of the function analysis and provides the team with a methodology to produce a desired result. In fact, once the model is created its only purpose remains as an explanatory, rationale,andcommunicationtothedecisionmakers and other engineering disciplines. +It would seem to be intuitive that the next step should be evaluation and cost determination. But in value engineering the next phase is creativy. +Creativity +The creative process evaluates the project with an emphasison,“Whatelsewilldothejob?”Thecreative part of the value engineering process is best summed by the trite expression, “start with a clean sheet of paper.” Again, this phase requires a team approach toengineeringdisciplines.Inthecreativityphasethe team needs to unstructure itself and separate itself from all of the previous phases. The team needs to leave the drawings, information, forms, and models behind and find a fresh environment in which to reassemble. In this creativity environment the only information permitted are the two-word, verb-noun functionsthatdescribeasingleproduct/system/mate-rial being analyzed. +It is up to the team to now develop creative ideas. Creativity is not an exact science; but it is teachable and thus learnable. The creative phase is to be the actofputtingtogetherunconnectedorseeminglyun-related factors or ideas to “create” a single new idea. Creativity is the art of bringing something new into existence.Itisanoriginalconceptnotanimitationof something else. The important element of creativity is perception: If the creative thought or idea is “new” to us, it is a creative act regardless of whether it may + +231 + + +haveexistedsomewhereelseatsomeothertime.Cre-ativity is also the mother of innovation, and both are importantelementsofthevalueengineeringprocess. If creativity is something “new”, then innovation is a “creative” or imaginative use or application of the concept. Innovation is adaptive of creativity. +Creativity is conceptualizing a pipe structure; basically a hollowed or formed material that can be connected, bent, twisted, buried, hung or laid flat or vertical. The innovation is to use the creative idea to carry liquids or gases from point A to point B. +Creativity is divergent thinking. It is overcoming perceptions, preconceived notions, emotional blocks, cultural divides, and habits. To be successful it is im-perative to avoid the path of least resistance: “Follow the past.” After all if it worked before it must still be a workable solution today. No sense “reinventing the wheel.” +Creative Thinking Personified +Positive creative thinking can be described by the invention of the cotton gin. Eli Whitney was trying to find a way to remove seed from raw cotton. One afternoon, on a walk, he noticed a cat trying to catch a chicken through a wire fence. The cat’s claw would stick through the fence whenever a chicken came close,butallthatcamethroughthefenceonthecat’s clawwasfeathers.Thiswastheobservationthatpro-vided the creative incentive. Whitney conceived the conceptofpullingthecotton(feathers)thoughacomb (fence). It was a subtle difference to all the thinking that went before. Instead of trying to remove seeds from the cotton by pulling on the seeds, Whitney’s solution was to pull the cotton away from the seeds. Inflexibility: An illustration of just the oppo- +site inflexible thinking is of an innovation made to an invention that to this day remains a world-wide standard despite its outmoded purpose. It is the com-puterkeyboardconfiguredintheQWERTYstyle.This style was an innovation of Christopher Sholes who, invented the typewriter. Because of the mechanics of the typewriter, and that gravity was the engine to move the keys back into position, Sholes found that fast typists would quickly create key jambs as they stroked faster than the keys could clear each other and return to rest. Through persistence and experimentation, he developed a keyboard layout that separated the most often used letter keys and thereby SLOWED down the typing process. Today, that same “slow down” mentality continues with the modern computer keyboard. This despite the Dvorak and American Standard system of keyboard layout that produces a faster result. Ingrained habit is hard to overcome. +Roadblocks to Creativity: Creativity takes work. Hard work. Of course, as an alternative to providing the creativity phase in value engineering, +232 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +the engineer can fall back on, and use one of the top Equilateral Triangles ten reasons for why value engineering should not be +used at this time: +1. It isn’t in the budget. +2 We don’t have the time. 3. Let’s form a committee. +4. Has anyone else tried it on this type of project? +5. Why change it? It’s always worked perfectly be-fore? +6. We tried that before. +7. The developers will never buy into it. 8. You’re years ahead of your time. + +9. Let’s shelve it for the time being. 10. It’s against company policy. +(Adapted form Value Management, General Services Administration, +Washington, DC.) +Divergent Thinking +Creativity in value engineering is best described as speculation and brainstorming. An all too often over-used and “trite” phrase, “Thinking Outside the Box” is an attempt to describe divergent thinking. +Outside the Box:What is outside the box think-ing? One much used example is the Nine Dots: +Nine Dots + + + + + + + + + + + + + + +First draw nine dots in the form of a square on a piece of paper as shown. +Next, without lifting you pencil from the pa-per, draw four straight connected lines that will go throughallninedots.Youmaynotbacktrackonaline and each line must go through each dot only once. +See the end of this chapter for the solution. Another often used example is the six sticks. You +are given six “sticks” (use toothpicks, straightened paperclips or matchsticks) of equal length as shown below. + + +Arrange the sticks to make four equilateral tri-angles.Alloftheendsofeach“stick”musttoucheach other.(And,asengineers,weallknowthatanequilat-eral triangle has three sides of the same length.) +See the end of this chapter for the solution. Finding Solutions: In this phase the team is +not trying to find solutions, only ideas. To help this process the “leader” has some help; a simple paper and pencil — and of course, a form can be created from this idea (see Figure 11-14). The brainstorm-ing or speculative process consists of two techniques: unassisted creativity and assisted creativity. +With unassisted creativity, one team member takes the creativity worksheet and is assigned one two-word definition for one of the functions. The individual lists every possible idea he/she has regard-ing that function, such as “create seal.” Once the individual has put down whatever ideas he/she has, the worksheet is moved on to another team member who then adds his/her own ideas. The sheet is passed to each team member in turn. +The second step, assisted creativity, is nothing more than a group exercise where each participant “hitchhikes” on each other’s ideas in order to create yetanother“new”idea.Togetstartedtheteamsplits into 3 parts: one group has the worksheet for one of thetwo-wordfunctiondefinitions,onegrouphasaset of “idea generators” or checklists to help the think-ing, and the third group has reference sources such asadictionaryandthesaurus.Asonesub-teamreads the list, the second could find new words and ideas using the alphabet concept (take a word and think of another word with a different starting letter of the alphabet) and the dictionary, while the third worked thechecklistscontinuallyquestioningallthethought processes.TwosamplechecklistsareshowninFigure 11-15A and Figure 11-15B. +Thereareacoupleofimportantelementstousing this process. The first is that the strong individual’s habitofbeing judgmental must be abated. To dothis, the group should decide beforehand how to indicate +Chapter 11 — Basics of Value Engineering 233 + + + +Value Engineering Consultants Creativity Worksheet + + +Reference Number: Date: Function: + +1. 31. 61. 2. 32. 62. 3. 33. 63. 4. 34. 64. 5. 35. 65. 6. 36. 66. 7. 37. 67. 8. 38. 68. 9. 39. 69. 10. 40. 70. 11. 41. 71. 12. 42. 72. 13. 43. 73. 14. 44. 74. 15. 45. 75. 16. 46. 76. 17. 47. 77. 18. 48. 78. 19. 49. 79. 20. 50. 80. 21. 51. 81. 22. 52. 82. 23. 53. 83. 24. 54. 84. 25. 55. 85. 26. 56. 86. 27. 57. 87. 28. 58. 88. 29. 59. 89. 30. 60. 90. + + + +Figure 11-14 Creativity Worksheet +234 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +How much of this is the result of custom, tradition, or opinions? Why does it have this shape? +How would I design it if I had to build it in my home workshop? What if this were turned inside out? Reversed? Upside down? What if this were larger? Higher? Wider? Thicker? Lower? Longer? What else can it be made to do? Suppose this were left out? +How can it be done piecemeal? How can it appeal to the senses? How about extra value? +Can this be multiplied? What if this were blown up? +What if this were carried to extremes? How can this be made more compact? +Would this be better symmetrical or asymmetrical? +In what form could this be-liquid, powder, paste, or solid? Rod, tube, triangle, cube, or sphere? +Can motion be added to it? Will it be better standing still? +What other layout might be better? + +Can cause and effect be reversed? Is one possibly the other? +Should it be put on the other end or in the middle? Should it slide instead of rotate? +Demonstrate or describe it by what it isn’t. +Has a search been made of the patent literature? Trade journals? Could a vendor supply this for less? +How could this be made easier to use? Can it be made safer? +How could this be changed for quicker assembly? What other materials would do this job? +What is similar to this but costs less? Why? What if it were made lighter or faster? What motion or power is wasted? +Could the package be used for something afterwards? +If all specifications could be forgotten, how else could the basic function be accomplished? +Could these be made to meet specifications? +How do competitors solve problems similar to this? + + +Figure 11-15A Creativity Checklist + + +1. Can the dimensions be changed? +Border Converge Deeper Delineate Encircle Intervene Invert (reverse) Larger +Longer +Make slanted or parallel More shallow +Place horizontally Shorter +Smaller +Stand vertically Stratify +Thicker Thinner +Use crosswise +2. Can the quantity be changed? +Add something +Combine with something Complete +Fractionate Join something Less +More +3. Can the order be changed? +Arrangement +Assembly or disassembly Beginning +Focus Precedence + + +4. Can the time element be changed? +Alternated Anticipated Chronologized Faster +Longer Perpetuated Recurrence Renewed Shorter Slower Synchronized +5. Can the cause or effect be changed? +Altered Counteracted Destroyed Energized +Influenced Louder Softer +Strengthened Stimulated +6. Can there be a change in character? +Add color Altered Change color Cheaper Interchanged +More expensive Resilient Reversed Stabilized Stronger Substituted Weaker + +Uniformity +7. Can the form be changed? +Accidents avoided Conformation Curved +Damage avoided Delays avoided Harder +Irregular +Notched Regular Rougher Smoother +Something added Softer +Straight Symmetrical Theft avoided +8. Can the motion be changed? +Admitted Animated Agitated Attracted Barred Deviated Directed Lifted Lowered Oscillated Repelled Rotated Slowed Speeded Stilled + + +9. Can the state or condition be changed? +Abraded Coagulated Colder Disposable Drier Effervesced Elasticized Harden Heavier Hotter Incorporated Insulated +Lighter automatic electric blanket Liquefied +Lubricated Open or closed Parted Preformed Pulverized Resistant Soften Solidified Vaporized Wetter +10. Can the use be adapted to a new market? +Children Elderly Foreigners Men +Physically Challenged Women + +Figure 11-15B Creativity Checklist +Chapter 11 — Basics of Value Engineering + + +someoneisbeingjudgmentalandthuscanmodifythe behavior (e.g., slapping the table with a palm). +Thetwosub-teamsswitchrolesfromtime-to-time untiltheyreachthepointofstagnationandagreethat they are finished. The team will by now have created a unique creative list of “new’ and “old” ideas for eachfunctionunderstudy.Afterthecreativeprocess, it becomes time for the evaluation phase. A possible result of this team effort for the two-word definition create-seal is shown in Figure 11-16. +Evaluation Theevaluationphaseisacontinuationofthecreativ-ity phase. It deals with a combination of appraisal, judgement,andselectiontothequalitativeandquan-titativecriteriaandideasdevelopedforeachfunction. In this phase, we go from divergent thinking to convergent thinking. Where, divergent thinking is problem identification and fact finding, convergent thinking is a mixing of appraisal, evaluation, judge-ment, selection, development, and implementation. +It is this phase that will create the final develop-ment of workable and meritorious alternatives. The introduction of appraisal, evaluation, and judgement willeliminateorreduceunnecessarycostsandcreate a preferred recommendation or course of action. +Yet also in this phase it is all too easy to impart a cost-reduction spiral that does not result in value engineering,butsimplecostreductionsforbudgetary reasons. It is in this phase that it is all too easy to degrade the product/system/material by reducing its quality, reliability, or maintainability. +Finally, in this phase ideas developed in the function and creativity phases will be refined and combined and evaluated by comparison. All of the costs of each function or idea will be established, and the team will continue to develop function alterna-tives.Todothiswillrequireacoupleofnewforms,an evaluationtechnique,andcontinuingthecompletion of the functional definition and analysis form. +In Concert With +Although this Evaluation Phase is shown as distinct from the Develpment/Investigation Phase, in reality inmanycases,thetwophasesoftenoverlapandthere is really only one. It is up to the value engineering team to decide how many phases will be needed and what will be done when. +Refining, Combining, Evaluating by Comparison +Idea generation is a dynamic process that doesn’t ever really stop. The creative thought process is an ongoing series of judgements and evaluations. In the evaluation phase ideas that seem unusable may well be combined with other ideas to create a better solu-tion.Someideaswillstandoutaspreferredsolutions, while others may be found to be lacking information. + +235 + + +It is important, however, that no idea be discarded out-of-hand,forwhateverreason.Allideashavesome merit, which is not always immediately obvious. +To get started, the team should use a worksheet tolisttheadvantagesanddisadvantagesofeachfunc-tion or idea that is an offshoot of a function. Figure 11-17A shows a sample of such a worksheet. The essence of this step is to be sure that no good ideas are overlooked, and that no efforts are misdirected. As the functions and ideas are refined, combined, and evaluated, it is important to be evaluating the time required to develop alternatives versus any potential gain. The gain is, of course, improvements in quality, maintainability, and reliability, as well as costadvantages.Similarly,anyimmediatelyperceived disadvantages may, with a little thought and creativ-ity, be turned into advantages. Figure 11-17B shows the information included. +At this stage, the form is fairly self-explanatory: In the first column is a simplified and short state-ment of an idea from the functional development; in the second and third columns, every advantage and disadvantage, no matter how large, how important, or how small or insignificant is identified. +If all this sounds a bit simplistic, it is. But, at the sametime,itisanimportantstep.Althoughwemake evaluations, simple and complex on a daily basis, we often do so intuitively. With this structured method-ology, the evaluation process will be seen to be more complex and exacting than simple intuition. +This worksheet is carried through the Develop-ment/InvestigationPhase.Inpractice,thisworksheet will be analyzed and evaluated twice — first in the evaluation phase by the value engineering team, and then in the Development/Investigation Phase, when similar forms will be used with other team components. +Cost Analysis and Evaluation +This step is also integrated into the development and investigation phase. In this initial evaluation step, a new worksheet is used to first draw a sketch of the function item being evaluated and then prepare a basic cost basis. Figure 11-18A shows the basic work-sheets,andFigure11-18Bshowsthesamesheetswith the information included. +Inthesketchstep,allthatisneededisafreehand drawing that incorporates the essential items. With the parameters clearly defined and set there will be fewer tangential discussions and considerations. +Using the simple concept of the wall box, in this phase the requirement may be for an off-shelf-unit suppliedoutofacatalogue.Itwillbeinthenextphase, the Development/Investigation, when the team is expanded and a second review and evaluation made that advantages/disadvantages and cost savings can be integrated with each other. +236 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Value Engineering Consultants Creativity Worksheet + + + +Reference Number: + +Function: + +Date: +CREATE SEAL + + + +1. Paint 2. Rubber 3. Rng +4. Plug +5. Dried blood 6. Varnish +7. Glue +8. Plastic 9. Epoxuy +10. Wax 11. Pitch +12. Chrome 13. Weld 14. Rivet 15. Fit +16. Washer 17. Soap 18. Gasket 19. Leather 20. Grease 21. Air +22. Heat 23. Freeze +24. Compress 25. Expand 26. Braze +27. Plate 28. Solder 29. Glass 30. Vacuum + + +31. Spigot 61. 32. Labyrinth 62. 33. Water 63. 34. Dovetail 64. 35. Cork 65. 36. Flange 66. 37. Paper 67. 38. Rod 68. 39. Foam plastic 69. 40. Stopper 70. 41. 71. 42. 72. 43. 73. 44. 74. 45. 75. 46. 76. 47. 77. 48. 78. 49. 79. 50. 80. 51. 81. 52. 82. 53. 83. 54. 84. 55. 85. 56. 86. 57. 87. 58. 88. 59. 89. +60. 90. + + + + +Figure 11-16 Creativity Worksheet +Chapter 11 — Basics of Value Engineering 237 + + +Value Engineering Consultants Idea and Function Evaluation + +Reference Number: Date: Team: +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + + + +IDEA FROM +FUNCTIONAL DEVELOPMENT ADVANTAGES DISADVANTAGES + + + + + + + + + + + + + + + + + + + + + + + + + + + +Plan(s)/Action(s) on Idea(s) + + + + + + + + + + +Figure 11-17A Basic Idea Evaluation Worksheet +238 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +����������������������������� ���������������������������� + +� ������������������ � ������ � ������ +��������������������������������������� ���������� Wall Box; Confine and Secure Material ���������������������������������� + + + + +���������� +� ����������������������� ����������� ������������� + + + +Provide 2’ by 2’ 10 gauge polished aluminum wall box to confine and secure on/off regu-lator valve for hot water for each fixture in each bathroom + + +1. Secures and Hides valve + + +2. Provides protection of material + + +1. Hides valve + + + +2. Not easily visible in emergency + + + + +3. Gives better appearance than plain valve + + +4. Quality Look and Finish + + +3. Requires identification on outside of box + + +4. Requires secure latching mechanism + + +5. Requires access to latch key or opening mechanism + +6. Additional Cost to Install + +������������������������������� + + + + + + + + + + + +Figure 11-17B Initial Example — Idea Evaluation Worksheet +Chapter 11 — Basics of Value Engineering 239 + + +Value Engineering Consultants Functional Development Sketch +Reference Number: Date: Team: +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Figure 11-18A Functional Development Sketch Worksheet — Blank +240 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Value Engineering Consultants Functional Development Sketch +Reference Number: Date: Team: +Detail/Product/Material Specification: +Function: Wall Box +Description (e.g., part number): Standard Wall Box: ABC Manufacturer +Model Number 123456-A Size 2’ X 2’ + + +Standard Wall Box + + +Piano Hinge + + + + +Wall Mounting Holes knock out plugs + + +Piping Entrance/Exit Knock out plugs + +Lock Mechanism + + + + + + +Door Overlap Lip + + + + + + + + + + + + + + + +Figure 11-18A Functional Development Sketch Worksheet — Example +Chapter 11 — Basics of Value Engineering 241 + + +Value Engineering Consultants Functional Development +Idea Development and Estimated Cost Reference Number: Date: +Team: +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + + + + + +ESTIMATED FUNCTION CREATIVE IDEA(S) & DEVELOPMENT COST + +CUMULATIVE ESTIMATED COST + + + + + + + + + + + + + + + + + + + + + + + +Total + + +Cost Summary +Material & Material Burden $ Direct Labor $ Direct Labor Burden $ Total $ + + + + +Figure 11-18B Functional Idea Development and Estimated Cost Worksheet — Blank +242 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Value Engineering Consultants Functional Development +Idea Development and Estimated Cost Reference Number: Date: +Team: +Detail/Product/Material Specification: Function: Wall Box +Description (e.g., part number): Standard Wall Box: ABC Manufacturer +Model Number 123456-A Size 2’ X 2’ + + + + +FUNCTION + + +Wall Box + + + +CREATIVE IDEA(S) & DEVELOPMENT + +Standard ABC Manufacturer Catalogue Wall Box + + +ESTIMATED COST + + +$12.75 + +CUMULATIVE ESTIMATED COST + + +$12.75 + + + + + + + + + + + + + + + + + + + + +Total $12.75 + + +Cost Summary +Material & Material Burden $ Direct Labor $ Direct Labor Burden $ Total $ + + + + + +Figure 11-18B Functional Idea Development and Estimated Cost Worksheet — Example +Chapter 11 — Basics of Value Engineering + + +In this evaluation phase, everything from quan-tity purchases to custom designed and manufactured items should be taken into account. The value engi-neering team is: Establishing the first benchmarks of the functional and cost analysis; examining any secondaryfunctionsthatshouldorcanbeconsidered; and ensuring that all of the project parameters have been met. The team must answer many questions: Are all the specifications and requirements met? Are all the two-word function definitions accounted for? Areallfunctionsandneedsbeingmet?Istheredupli-cation of effort or definitions that can be eliminated and, thus, reduce costs? +Incorporating the Functional Definitions In the information phase, the Functional Definitions Worksheet was initialized. The evaluation phase provides the information necessary to complete the final four sections of the worksheet: the Work versus Appearance evaluation, the estimated cost, the im-portance valuation of each element, and any notes or comments. The first step is to evaluate and compare the functional relationships and create a numerical weightingofthefunctions.Thisnumericalweighting will provide a basis for determining value or levels of importanceofthefunctions,aswellasthemagnitude of importance. To create a numerical evaluation, a Functional Evaluation Worksheet will be utilized as shown in Figure 11-19. +To start, use the function definition and analysis worksheet for detail/product/material. Continuing the Wall Box example, the worksheet identified eight functions for the wall box and listed them in order in the Functional Evaluation Worksheet—Part 1. This simply provides a list order for the items with appro-priate alphabetic identification. See Figure 11-20A. +Comparison of Functions: The value engi-neering team must know and compare each function with every other function. Starting with the function delineated as “A” or Confine Material, it is compared to function “B,” Store Material. Confine Materials is determined to be more important than Store Materi-als,andisthusaccordedalistingof“A”inthe“A”line under the “B” listing in the Functional Evaluation Worksheet — Part 2. +At the same time that the relative importance is being determined, the magnitude of the importance must also be established. The numerical weights provided in Part 2 are then used to establish this importancedifference.Asseen,theConfineMaterials is rated to be of major importance when compared to Store Materials. +Each of the remaining functions are evaluated and analyzed in a similar manner in relationship to all of the functions below it, as shown in Figure 11-20B. + +243 + + +With the evaluation and analysis complete, Fig-ure 11-20B shows that the functions in importance as follows: +Prevent Loss 15 Protect Inside 10 Confine Material 9 Protect Material 9 Establish Privacy 5 Enhance Appearance 1 Store Material 0 +Fromthisanalysis,thevalueengineeringteamwould declare the Prevent Loss function to be the basic function. The final weighted list shows the relative importance of each of the functions to each other and to the project. +With this information, the Function Definition and Analysis Worksheet can now be completed as shown in Figure 11-21. Note that the basic and sec-ondary functions have now been redefined based on the evaluation, and it can now be determined which of the elements are vital, essential, or would just be nice to have. +This analysis would continue to examine each of the system functions in relationship to the others and would, in turn, create a weighted evaluation of each of the separate products/systems/materials for the overall project being examined. +The Pencil: Another Look +An alternative evaluation and analysis could also be constructed by establishing idea criteria using a qualitative approach. In this method, each of the items of the function can be evaluated in the reverse of the function definitions and uses perscriptive connotations for expressing value. In this instance, the listing order might look like Figure 11-22A, the evaluation worksheet part 2 like Figure 11-22B, and the completed Evaluation worksheet part 1 like Figure 11-22C. +This alternate analysis can be conducted by the value engineering team or can wait until the next phase, Development/Investigation, and be conducted with an expanded value engineering team. + +DEVELOPMENT/ INVESTIGATION +Consultation and Evaluation +The evaluation phase is continued here in the Devel-opment/Investigationphasesasthevalueengineering team brings in other team members to provide addi-tional creativity and energy to the process. All of the functional development worksheets are prepared for review by the advanced team. In Figure 11-23, the Idea Evaluation Worksheet is recreated with only the ideas of the function development filled in. As +244 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + + +Value Engineering Consultants Functional Evaluation — Part 1 + +Reference Number: Date: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + + + +Evaluation Summary + +List +Order Functions Weight +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z + + + + + +Figure 11-19 Functional Evaluation Worksheet — Part 1, Blank +Chapter 11 — Basics of Value Engineering 245 + + + + +Value Engineering Consultants Functional Evaluation — Part 2 + +Reference Number: Date: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + + + +Numerical Evaluation: Weight Factors +1 = Nice to Have — Minor Importance 2 = Essential — Medium Importance +3 = Vital — Major Importance + +A B C D E F G H I J K L M N O P Q R S T U A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U + + + + +Figure 11-19 Functional Evaluation Worksheet — Part 2, Blank +246 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + +Value Engineering Consultants Functional Evaluation — Part 1 + + +Reference Number: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + +Date: + +Wall Box + + + + + +Evaluation Summary + +List +Order Functions Weight + +A Confine B Store +C Protect D Protect E Prevent F Enhance G Establish H +I J K L M N O P Q R S T U V W X Y Z + +Material Material Inside Material Loss Appearance Privacy + + + + +Figure 11-20A Functional Evaluation Worksheet — Part 1, Example +Chapter 11 — Basics of Value Engineering 247 + + + + + +Value Engineering Consultants Functional Evaluation — Part 2 + + +Reference Number: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + +Date: + +Wall Box + + + + + +Numerical Evaluation: Weight Factors +1 = Nice to Have — Minor Importance 2 = Essential — Medium Importance +3 = Vital — Major Importance + +A B C D E F G H I J K L M N O P Q R S T U A A-3 C-1 C-3 E-2 A-3 A-3 +B C-3 D-3 E-3 F-1 G-2 C D-2 E-2 C-1 C-2 +D E-3 D-3 D-1 +E E-3 E-2 F G-3 +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U + + + + +Figure 11-20B Functional Evaluation Worksheet — Part 2, Example +248 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + +Value Engineering Consultants Functional Evaluation — Part 1 + + +Reference Number: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + +Date: + +Wall Box + + + + + +Evaluation Summary + +List +Order Functions Weight + +A Confine B Store +C Protect D Protect E Prevent F Enhance G Establish H +I J K L M N O P Q R S T U V W X Y Z + +Material 9 Material 0 Inside 10 Material 9 Loss 15 Appearance 1 Privacy 5 + + + + + + +Figure 11-20C Functional Evaluation Worksheet — Part 1, Example +Chapter 11 — Basics of Value Engineering 249 + + + + +Value Engineering Consultants Functional Definiton and Analysis + +Reference Number: Date: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + + + + + + + +Qty + + +1 + + + +Item Descrp. + +Wall Box + + +FUNCTIONS* + +VERB NOUN B Confine Material X Store Material Protect Inside X +Protect Material +Prevent Loss X Enhance Appearance Establish Privacy + +Label Function +Cost per V= vital AP Function E = Essential +S W SL (Estimate) N = Nice to Have +X E +X X N +X E +X X E +X 12.75 V +X X N +X X N + + + +Notes/ Comments + + + +See Confine Mate-rial Above + + + + + + + + + + + + + + + + + + + + + + + + +Note: B — Basic +S — Secondary W — Work +AP/SL — Appearance/Sell + + +Figure 11-21 Completion of Functional Definition and Analysis Worksheet +250 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Value Engineering Consultants Functional Evaluation — Part 1 + +Reference Number: Date: + + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + +Pencil Make Marks + + + + + +Evaluation Summary + + +List Order +A Elimnate + + +Functions Weight +Paint + +B Reduce length of lead C Remove eraser +D Stain wood in lieu of paint E Make body out of plastic +F G H I J K L M N O P Q R S T U V W X Y Z + + + +Figure 11-22A Functional Evaluation, Part 1, Step +1 +Chapter 11 — Basics of Value Engineering 251 + + +Value Engineering Consultants Functional Evaluation — Part 2 + + +Reference Number: + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + + +Date: + +Pencil Make Marks + + + + + +Numerical Evaluation: Weight Factors +1 = Nice to Have — Minor Importance 2 = Essential — Medium Importance +3 = Vital — Major Importance + +A B C D E F G H I J K L M N O P Q R S T U +A B-2 A-1 D-1 A-1 B B-3 B-2 B-2 +C D-1 C-1 +D D-2 E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U + + + +Figure 11-22B Functional Evaluation, Part 2 +252 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +Value Engineering Consultants Functional Evaluation — Part 1 + +Reference Number: Date: + + +Detail/Product/Material Specification: Function: +Description (e.g., part number): + +Pencil Make Marks + + + + + +Evaluation Summary + +List +Order Functions Weight +A Elimnate Paint 2 B Reduce length of lead 9 C Remove eraser 1 D Stain wood in lieu of paint 5 E Make body out of plastic 0 F +G H I J K L M N O P Q R S T U V W X Y Z + + + + + +Figure 11-22C Functional Evaluation, Part 1, Step 2 +Chapter 11 — Basics of Value Engineering 253 + +����������������������������� ���������������������������� + + +� ������������������ � ����� +��������������������������������������� ����������� Wall Box; Confine and Secure ���������������������������������� + + +� ����� + + +Material + + + + + +���������� +� ����������������������� ����������� ������������� + + +Provide 2’ by 2’ 10 gauge polished aluminum wall box to confine and secure on/off regu-lator valve for hot water for each fixture in each bathroom + + + + + + + + + + + + + + + + + + + +������������������������������� + + + + + + + + + + + + +Figure 11-23 Completed Idea Evaluation Form +254 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +before, a Sketch is provided, as is the ideas develop-ment sheet. +Once again, the team sets down rules to follow similar to those that went before. In this phase addi-tionalteammembersmightincludethemanufacturer, contractor, and owner representative. This phase can provide an intense critique of the function/idea under discussion. It is this value-added group that reestablishedadvantagesanddisadvantages,withthe initial value engineering team providing input based on their initial worksheet. +Second Creativity, Evaluation, Cost Anaylsis +In this phase, the larger team will again do creativity andevaluation.AsseeninFigure11-24Aand11-24B, the sketch can be significantly modified, and a new, secondary approach to the idea development phase can result in a different evaluation that could result in significant cost savings. +As seen in Figure 11-24, in this development/in-vestigativephasetheemphasiswasonalternativesto a catalogue box and a “new” brainstorming session with different expertises and viewpoints. +Final Alternatives +With additional idea evaluation and cost estimates worksheetsandpossiblesketches,theexpandedvalue engineering team is ready to redevelop the idea. The teamwouldagainestablishadvantagesanddisadvan-tages using Figure 11-23 worksheet. At this stage, all of the engineering diciplines, contractors, and even the owners would help in the final development and investigation to determine the best outcome. +Withaworkableandbest-costideadeveloped,the finalstepistouseconstructionsuppliesandindustry standards to confirm the ability to meet the final engineering and design. +The Gut Feel Index TheGutFeelIndexiswhatengineershavedeveloped from the original Delphia method of evaluation. The Delphia method attempts to achieve a consensus of opinion within a group using questionnaires regard-ing future events and technical expertise. +The Gut Feel Index is similar, but uses the in-tuitive qualification of each developed idea using the technical expertise of the individuals. Each team member scores each idea on a scale of 1 to 10 based onitstechnicalmeritsandtheeconomicexpectations. Low technical requirements, low costs, and low risks get the highest mark. +High rankings by any individual are further ex-plained to the other goup members so all understand therationalebehindtherankings.Theaverageofthe scores are then computed. + +Finally, a Risk Guide is used to make the final determination as to each idea. Figure 11-25 defines a sample Risk Guide. +In this approach, the Risk 1 level can be imple-mented or accepted without much concern. All the other categories will require further investigation. +Cost Analysis, More Oneofthemajorelementsofvalueengineeringisthe final cost analysis that is done for the recommenda-tions and alternatives. Cost considerations are an important element of the value engineering process. Up to this point, the process has relied on creative techniques, brainstorming, functional analysis, and comparitive analysis. The concentration has been on the technical side of the equation. +The result for value analysis must also incor-porate the cost analysis side of value engineering. Interestingly, in many value engineering projects, a comparative-cost analysis is not often conducted. A cost analys will look at life-cycle costing, break-even analysis,andcomparitive-costanalysis.Forpurposes ofthisbasicoverview,thedetailsandin-depthreview of the various cost-analysis methodologies are not included. +Are We There Yet? +The evaluation phase was intended to provide vis-ibility to all ideas and flush out any constraints while offering alternative solutions. This phase, while seeming to repeat some of the evaluation phase, is the final organization and analysis phase. It is in this phase that the value engineering team prepares their final recommendations prior to presentation to the owners/clients. +The value engineering process reviewed here has used, depended and recommended the use of standardized worksheets. One major disadvange to this approach is the attempt to find a standardized processthatisallencompassingforallsituationsand projects. Alas, that is not the case. So why then have worksheets? +The primary purpose is use as a tool, to help pro-vide structure to the process and offer a presentation format.Alloftheworksheetshelpforma“picture”of thevalueengineeringprocessandprovideillustrative detail for support of the final recommendations. It is important that the end result show that there was depth to the engineering and analysis; that what is proposed is not “just” a suggestion or best guess but is based on engineering discipline. +Perhaps the best final step for the value engin-ering team is to have yet one more checklist; this one of questions that support the value engineering process. +Chapter 11 — Basics of Value Engineering 255 + + + +����������������������������� ���������������������� ������ +� ������������������ � ����� � ������ +�������������������������������������� +���������� Wall Box +���������������������������������� Standard Wall Box: +ABC Manufacturer +Model Number 123456-A Size 2’ X 2’ + + + + +Standard Wall Box + + +Piano Hinge +Spot Weld Plastic One-piece Hinge + + +Custom Wall Box + + +Plastic Composition + + + + + + + + +Use torx wrench rather than keyed lock + +Lock Mechanism + +Wall Mounting Holes knock out plugs +Pre-drill Mounting Holes + +Piping Entrance/Exit Knock out plugs +Pre-drill Entrance/Exit Holes + + + + + + +Door Overlap Lip + + + + + + + + + + + + + + +Figure 11-24A In-progress Alternative Sketch +256 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + + +Value Engineering Consultants Functional Development +Idea Development and Estimated Cost Reference Number: Date: +Team: +Detail/Product/Material Specification: Function: Wall Box +Description (e.g., part number): Standard Wall Box: ABC Manufacturer +Model Number 123456-A Size 2’ X 2’ + + + +ESTIMATED FUNCTION CREATIVE IDEA(S) & DEVELOPMENT COST + +CUMULATIVE ESTIMATED COST + + + +Wall Box Standard ABC Manufacturer Catalogue $12.75 $12.75 +Wall Box ___________________________________________________________________________________________________ + +Custom Box + +Plastic Composition $3.95 $3.95 Plastic Composition — vacuum Molded $3.10 $3.10 +Spot Weld Single Hinge $1.75 $5.70 Use Two Hinges instead of One Hinge $.75 $3.85 +Pre-cut Holes $1.75 $7.45 + +Drill Pipe Entrance/Exit on Site $1.25 $5.60 Drill Mounting Holes on Site $.75 $6.35 + + + + +Tota$6.35 $7.45 +l + + +Cost Summary +Material & Material Burden $ Direct Labor $ Direct Labor Burden $ Total $ + + + + + +Figure 11-24B In-progress Alternative Idea Development and Cost Estimates +Chapter 11 — Basics of Value Engineering 257 + + + + +Rank Risk Description +1 Recommendation/idea has low risk, good payback, minimal cost or investment risk, and change will not be owner/client sensitive. +2 Recommendation/idea has some technical risk, payback and/orcost/investmentisnotfullydefined,andchangewill not be sensitive to the owner/client. +3 Recommendation/idea is a new approach, needs some additional technical engineering/design work, cost/invest-ment is not expected to be excessive, but change is a new approach to owner/client. +4 Recommendation/idea is whole different technical concept with attendant risks, unknown cost/investment require-ments, and will be unknown to owner/client. + +GFI Range 7.5-10 + + +6-7.4 + + +4.5-5.9 + + + +2-4.4 + + +A Gut Feel Index of less than 2.0 would automatically be excluded. + + +Figure 11-25 + +1. Does the proposed solution or alternative satisfy all of the original requirements and specifica-tions? +2. Are there any issues or idea that remain unre-solved prior to final recommendations? +3. Areallreliabilityrequirementsandspecifications met by the alternative? +4. Are all of the recommendations and alternatives compatible with all other systems, processes and materials? +5. Do the recommendations or alternatives create any health or safety concerns? +6. Do the recommendations and alternatives meet theoperationalandmaintainabilityrequirements of the project/system? +7. Are the recommendations or alternatives able to be implemented within the guidelines of codes andregulations,andoffernoadditionaldelaysor costs over the original engineering and design? +8. Dotherecommendationsandalternativessupport the owners/clients requirements, specifications, and goals? +Everythingisnowinplaceandreadyforthefinal step — the presentation of the results. +Recommendation/Presentation +The presentation and recommendation phase is the culminationofallthepreviousphases.Willthevalue-engineering-teamreccommendationsandalternatives be accepted or rejected? +In the end, it all boils down to “salesmanship.” The recommendations and alternatives, no matter how they are couched, will be seen as an attack, + +Risk Guide + +repudiation, or rejection of another engineer’s work. Peoplereactindifferentways,butintheengineering/ design profession a couple of things can be counted on occuring. +First, because it is human nature, change, no matterhowslightorhowright,willberesisted.Over-coming resistance will require patience and “proof.” This requires that the value engineering team have all their worksheets for all aspects and phases of the process available for critical review. +Second, all recommendations and alternatives must be based on the same technical basis as the original specification. Not everyone will require ex-quisite detail to be convinced while, others will never be satisfied with whatever is provided. +To prevail, the value engineering team need only present two items: the facts and the truth. The pre-sentation of the facts must be accomplished in the samedeliberatemannerthatwasfollowedthroughout the value engineering process. Prepared with the worksheets and a written analysis, the presentation willbeabletoaccountforeveryrequirementandspec-ification, and be able to trace the path of the analysis from beginning to end with a clear understanding of the final recommendations/alternatives. +The worksheets used throughout the value en-ginering process will prove invaluable. They paint a picture for all to see and will provide a concise and complete visual explanation of the end result, along with compelling and unrefutable conclusion. +Present Costs Thewholeexerciseforvalueengineeringistoprovide cost savings on the total project. It is the presenta-tion of exacting support details that will result in a +258 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +successful and fully accepted modification. Because value engineering is a “team” approach and depends ona“TeamRecommendation,”anagreed-toconsuen-sus result is the one most sought after by everyone involved. +Present Recommendation +The final step is to present a team recommendation. A recommendation worksheet is shown in Figure 11-26. This worksheet will be a summary of all the support worksheets and will spell out the findings and recommendations. +Making the Presentation Thefinalpresentationshouldbebothawrittenreport of findings and a verbal description. Both need to be clearandconcise,andthepresentationconfidentand positive. The basic strategies for successful presenta-tions are: +1. Expain the Whys: Provide the facts, detail the modification/changes, and describe and acknowl-edge any risks. +2, List the Benefits: It’s important to concentrate on the benefits that will accrue because of the value engineering process. However, be sure not to exaggerate or oversell the results. +3. Make it a Participatory Presentation: Be sure to involve the audience in the discussion and presentation. Incorporate audience suggestions. Involvement is ownership. +4. Answer Questions Before They Are Asked: Be ready for the negativity that will be present by some individuals. +5. Be Prepared: Avoid surprises by being prepared, and don’t let emotions interfere with the presen-tation. +6. Acknowledge Difficulties or Unknowns: Don’t gloss over an obvious problem or a void in the presentation. Acknowledge the unknown and provide an interpretation or at least some alter-native response. +7. Repeat, Repeat, Repeat: Repetition is the road to understanding. However, in repeating, be sure youarepreparedwithalternativeroaddirections and maps. Repeating the same words over and over will not make the material understood any easier to be embraced. + +Is It Value Engineering? +In the construction industry, the emphasis is con-stantly on the cost side of the equation. All too often the quality of the engineering and design are “at-tacked” under the rubric of “value engineering.” As should be clear by this point, “true” value engineer-ing can be an expensive undertaking. It is why value engineering invokes the Pareto principle: Only 20 + +percentoftheproduct/project/systemwillproduce80 percent of the savings. It is for this 20 percent that a value engineering analysis is of value. +Unfortunately, most so-called “value engineer-ing” it is simly the misappropriation of a term that connotes structured and scientific analysis to the evaluation of a product/system/material. In reality, it isnothingmorethansimplecostcuttingorcostreduc-tionsforthesakeofsavingsalone.Thisprocessisnot value engineering, no matter what you may wish to call it. It is more appropriate to use the proper term for what all too often passes for “value engineering” — cost reductions. Or, if a analytical name needs to be used, Cost Fitting is appropriate. +Cost Fitting Costfittingiswhereengineers,designers,andthelike are often left out of the process and the designs and mechanicals are turned over to a “value engineer,” often nothing more than a contractor seeking the bid for the project. “The budget is the budget,” as developers and owners like to say. +In this iteration of cost fitting, the Pseudo Value Engineer (PVE) will offer replacement products or designs that can be installed for less money or “To meet the budgetary needs of the project.” There is no concern in cost fitting for the quality of the engineer-ing or design. One problem with cost fitting is that there is always an alternative to anyone’s choice of a product or design element. The PVE, knowing this, can offer cost savings over the design engineer’s original work. All too often, the cost savings result in increased profits for the PVE as he/she garners the business with an on-budget bid—only to use inferior or less-desirable products/systems/materials with greater markups for the supplier. +Level the Playing Field +One option open to engineers is to have included in their contracts a series of clauses that would provide or require “true” value engineering to be performed on their designs. The role of the engineer is not to inhibitgoodvalueengineeringofaproject.Asalready shown, value engineering is a discipline that, when properly applied, will result in cost savings without any sacrifice in quality of design. The following ex-ample in Figure 11-27 is not intended to be exact legal language or offered as a instant contract addi-tion. Rather, it is provided as a concept for insuring that proper value engineering is implemented on the engineers design and mechanicals. +The Déja Vu of the “Science” of Value Engineering +Does the “science” of value engineering seem very familiar? It should, because it contains many of the sameelementsfollowedinplumbingengineeringand design. As you read about value engineering, you +Chapter 11 — Basics of Value Engineering 259 + +����������������������������� ������������������������������������ + +������������������ � ������ +��������������������������������������� ����������� ���������������������������������� + + +���������������� + + +����������������������� ������������������������� + + + + + + + + + + + +������������������ ������������������� +������������������������������������������� + + + +����������������������������� + + + + + + + + + + + +���������������� ����������� ������������ +260 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +1. INTENT AND OBJECTIVES-This clause applies to any cost reduction proposal (hereafter referred to as a Value Engineering Change Proposal or VECP) initiated and developed by the Contractor for the purpose of changing any requirement of this contract. This clause does not, however, apply to any such proposal unless it is identified by the Contractor, at the time of its submission to the Owner, as a proposal submitted pursuant to this clause. +1.1 VECPs contemplated are those that would result in net savings to the Owner by providing either: (1) a decrease in the cost of performance of this contract, or; (2) a reduction in the cost of ownership (hereafter referred to as col-lateral costs) of the work provided by this contract, regardless of acquisition costs. VECPs must result in savings without impairing any required functions and characteristics such as service life, reliability, economy of operation, ease of maintenance, standardized features, esthetics, fire protection features, and safety features presently required by this contract. However, nothing herein precludes the submittal of VECPs where the Contractor considers that the required functions and characteristics could be combined, reduced, or eliminated as being nonessential or excessive for the function served by the work involved. +2. SUBCONTRACTOR INCLUSION—The Contractor shall include the provisions of this clause, with the pre-determined sharing arrangements contained herein, in all subcontracts in excess of $25,000, and any other sub-contracts which, in the judgment of the Contractor, is of such nature as to offer reasonable likelihood of value engineering cost reductions. At the option of the first-tier Subcontractor, this clause may be included in lower tier subcontracts. The Contractor shall encourage submission of VECPs from Sub-contractors; however, it is not mandatory that VECPs be submitted, nor is it mandatory that the Contractor accept and/or transmit to the Owner VECPs proposed by his Subcontractors. +3. DATA REQUIREMENTS—As a minimum, the following information shall be submitted by the Contractor with each VECP: +3.1 A description of the difference between the existing contract requirement and the proposed change, and the comparative advantages and disadvantages of each; including justification where function or characteristic of a work item is being reduced; +3.2 Separate detailed cost estimates for both the existing contract requirement and the proposed change, and an estimate of the change in contract price, including consideration of the costs of development and implementation of the VECP and the sharing arrangement set forth in this clause; +3.3 An estimate of the effects the VECP would have on collateral costs to the Owner, including an estimate of the sharing that the Contractor requests be paid by the Owner upon approval of the VECP; +3.4 Architectural, engineering, or other analysis in sufficient detail to identify and describe each requirement of the contract, which must be changed if the VECP is accepted, with recommendation as to how to accomplish each such change and its effect on unchanged work. + +Figure 11-27 Example of Value Engineering Change Proposal Contract Clause + + +should have been aware that this discipline is very much like that of plumbing engineering and design. In fact, the elements described could just as easily be transported to, and applied to a plumbing design project.Theelementstechniquesofvalueengineering aresimilartomostotherengineeringdisciplines,and almost exactly the same as used by many other disci-plines. Well then, if the plumbing engineer is already doing all this, why does it need to be done again? +For the project’s owner, developer, or manager it becomes an issue of perception. Each of the en-gineering and design disciplines used throughout the creation of a facility’s project are always open to suspect and suspicion. Engineers and designers are often seen not just as “engineers” doing their necessary and important work, but as “engineering artists.” The engineering artist is suspect as creating an enduring engineering work of art under the guise of “quality of design.” A forever lasting engineered productthatmaywellincluderedundancieswillmost likelyincludethemostup-to-dateandstate-of-the-art + +productsandmaterialsavailableonthemarket—and therefore, by inference, the most expensive products and materials. The perception is of the engineering artist over-engineering a project. The engineer is suspect of using materials and products that have a longerlife-cyclecostthanmayactuallybenecessaryin ordertoprovideanextrameasureofsafety,longevity, and quality of design. +It is this “quality of design” that is perceived by those financing the project to result in a more costly enterprise than is necessary, while still providing the safety and longevity desired. Enter the discipline of valueengineering.Thisengineeringstepateachstage of a project is perceived to be nothing more than an oversight function protecting the economic interests oftheownerandinsuringqualityofdesignatthebest possible cost. It is not intended to be cost reductions simply for the sake of cost reduction. +What the engineer often “sees” as being the end result of value engineering, and why many object to its use, is the misconception that lower costs equate +Chapter 11 — Basics of Value Engineering + + +directly with reduced quality. The plumbing engi-neer, like all other engineers and designers, needs to remain flexible and open to the integration of other discipline’s ideas and concepts. Value engineering is not a methodology designed to undermine the engi-neering,design,orspecificationsofaproject.Norisit intendedto“outsmart”or“out-think”theengineers. Value engineering is not intended or designed to re-ducequality,safety,professionalismorcreativity.Itis an analysis to identify and stop waste, thus lowering costs while maintaining quality. +Valueengineering,whenperformedproperly,will not affect performance and will not result in trade-offs to reliability, quality, or maintainability. And this may well be the crux of the conundrum inherent in thediscipline.Valueengineeringisonlyasgoodasthe processfollowed,theexperienceoftheengineers,and likeanyproject,subjecttovariousobviousandhidden agendasbynumerouspartiesinvolved.Moreover,itis not unheard of for many “value engineered changes” to be nothing more than an owner-mandated cost reduction disguised under the rubric of “value engi-neered.” Which is not much different than having a carefullyengineeredandspecifiedproductsubstituted by a contractor as something deemed “equal,” often for nothing more than increased profit potential and no real savings for the owner. Despite the negative connotation often is improperly designated with the valueengineeringlabel,theconceptneedstobelooked at as an adjunct to a project’s engineering, and each otherengineeringdisciplineneedstoembracethecon-cept and use it effectively within his/her discipline. + +261 + + +Solution to Equilateral Triangle Thesolutioncallsforthinkingoffthetwo-dimensional surface of a table and into three dimensions. The so-lution shown is as viewed from above. It’s a Pyramid shape. The base is, of course, one of the equilateral triangles. + + + + + + + + + + + + + + + +REFERENCES +1. Dell=Isola, Alphonse J. Value Engineering in the Construction Industry. New York: Construction Publishing Company, 1974 +2. Dell=Isola, PE, Alphonse. Value Engineering: PracticalApplications.Kingston,MA:R.S.Means Company, 1997. +3. Fallon, Carlos. Value Analysis, Second Revised Edition. Southport, NC:Miles Value Foundation, 1986. + + + +4. +Solution to Nine Dots + +Kaufman, Jerry J. Value Engineering for the Practitioner, 3rd Edition. Raleigh, NC: North Carolina State University, 1990. + +5. King, Thomas R. Value Engineering, Theory & & & & Practice in Industry. Washington, DC: Lawrence +D. Miles Value Foundation, 2000. +6. Mudge, CVS, Arthur E. Value Engineering, A Systematic Approach. Pittsburgh, PA: J. Pohl Associaties, 1996. +& & & 7. Miles, Lawrence D. Techniques of Value Analysis and Engineering, 3rd Edition. Washington, DC: Lawrence D. Miles Foundation, 1989. +8. Park, Richard. Value Engineering, A Plan for In-& & & vention. Boca Raton, Fl: CRC Press LLC, 1999. + + + + + + + + +The solution calls for thinking “Outside the box.” +262 ASPE Plumbing Engineering Design Handbook — Volume 1 +12 INTRODUCTION +An important part of a sustainable design plumbing system is the conservation of water. Seventy percent of the earth’s surface is covered with water, but only 0.5percentofthatwaterisfreshwaterthatisavailable for drinking water and is relatively easily obtainable. Of that 0.5percent, only 2percent is potable without someformoftreatment.Withsuchalimitedresource, it only makes sense that we should be trying to limit the consumption of water. +Sustainable design is gaining popularity in the building community, offering new and innovative ways to improve the built environment. The basic premise of sustainability is to reduce the use of non-renewable resources, and the amount of waste discarded, and provide a healthier environment to live and work in. Sustainabilityisgainingacceptance from a wide variety of places and is a required design philosophy by many governmental agencies such as theGeneralServicesAdministration(GSA).TheGSA requires all of the new buildings they are involved withtomeetcertainsustainablerequirementsdefined by the U.S. Green Building Council. +The U.S. Green Building Council was formed in 1993 and is the nation’s foremost coalition of leaders fromacrossthebuildingindustryworkingtopromote buildingsthatareenvironmentallyresponsible,prof-itable and healthy places to live and work. The U.S. GreenBuildingCouncil(USGBC)isleadinganational consensusforproducinganewgenerationofbuildings that deliver high performance inside and out. As the leadingorganizationrepresentingtheentireindustry onenvironmentalbuildingmatters,USGBC’sunique perspectiveandcollectivepowerprovidesitsmembers with enormous opportunity to effect change in the way buildings are designed, built, and maintained. +OneofthemethodstheUSGBChasdevelopedfor maintaining consistency in sustainable guidelines is through the development of a certification program for buildings known as Leadership in Energy & En-vironmental Design (LEED™). + + + + + + +Green Design for Plumbing Systems + + + + + +LEADERSHIP IN ENERGY AND ENVIRONMENTAL DESIGN +The LEED (Leadership in Energy and Environ-mental Design) Green Building Rating System™ is a voluntary, consensus-based national standard for developing high-performance, sustainable buildings. LEED provides a complete framework for assessing building performance and meeting sustainability goals. Based on well-founded scientific standards, LEED emphasizes state-of-the-art strategies for sustainable site development, water savings, energy efficiency, materials selection, and indoor environ-mental quality. LEED recognizes achievements and promotes expertise in green building through a comprehensive system offering project certification, professional accreditation, training, and practical resources. +The LEED program is based on a rating system thatisdividedintosixmainareasofdesign.Thesear-eas are Sustainable Sites, Water Efficiency, Energy & Atmosphere, Materials & Resources, Environmental Quality,andInnovation&DesignProcess.Eachofthe areashasspecificrequirementsandprerequisitesthat must be met in order to qualify for any certification levels. The certification levels and minimum points for each level in the LEED program are as follows: + +Certified 26-32 points Silver Level 33-38 points Gold Level 39-51 points +Platinum Level 52+ points with a possible 69 points available. +A complete listing of the LEED Rating system andotherrequirementsofthecertificationsystemare available from the USGBC at www.usgbc.org. +One of the listed areas in the LEED program is Water Efficiency. The area is broken down into three sub areas that allow points to be earned by achievingcertaincriteriaestablishedtoreducewater consumption.Thefirstcreditavailableisforutilizing water-efficient landscaping to reduce the amount of +264 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +potable water used for irrigation by 50 percent. This is typically accomplished by using a highly efficient irrigation system, capturing rainwater, or using re-cycledsitewatertoreducetheconsumptionofpotable water. Additionally another credit is available for the elimination of the use of potable water for irrigation purposes. + +WASTEWATER TECHNOLOGIES +For water efficiency, the area of credit is Innovative WastewaterTechnologies.Reductionoftheuseofmu-nicipally provided potable water for building sewage conveyance by a minimum of 50 percent or treating 100percentofthewastewateron-sitetotertiarystan-dardsisrequired.Thisistypicallyaccomplishedbythe use of storm water or grey water for the conveyance of sewage in the building drainage system. Addition-ally, the use of high-efficiency plumbing fixtures or dry fixtures can reduce the amount of potable water used in the plumbing system. +Ideas for ways to accomplish this point: +1. Automate the operation of equipment. +2. Connect cooling water for equipment to a closed-loopchilledwatersysteminsteadofusingpotable water. + +CAUTIONS +Many factors should be considered when sustain-able designs are required or even contemplated. For example, the reduction in the amount of water used in the system needs to be verified, and the effects on the system need to be considered. Reduction in the amount of wastewater generated can have another impactonthesizingofthewateranddrainagepiping inthebuilding.Wastepiping,inparticular,needstobe sized based on a flow velocity of two feet per second; reducing the flow rate of the fixtures changes the tablesandinformationcommonlyusedbytheplumb-ing designer and code officials. The model plumbing codes have been modified to reduce the number of fixture units attributed to the plumbing fixtures in thepipe-sizingcalculationsbasedonthereductionin water mandated by EPAC. Communication between the code official and designer is imperative to mini-mize potential problems in the plumbing system. +EPACT requires all manufacturers of plumb-ing products in the United States to meet or exceed water-usage requirements for plumbing fixtures as follows: + +Faucets: 2.5 gallons per minute (9.5 liters per minute, lpm) + + + +3. Monitor the water consumption of the equip-ment. + + +Metered Faucets: 0.25 gallons per cycle (0.9 liters per cycle, lpc) + + + +4. Use ultra-low-flow fixtures in the plumbing sys-tem. + +WATER-USE REDUCTION CREDIT Closely related to the reduction in wastewater through Innovative Wastewater Technologies is the Water-Use Reduction Credit. There are two of these credits available, one for reducing the use of potable waterby20percentoverandabovetherequirements of the Energy Policy Act of 1992 (EPACT), and an-other credit for reducing the potable water usage by an additional 10 percent for a total reduction in potable water usage of 30 percent. +Ideas for ways to accomplish this point: +1. Select equipment that provides for maximum water efficiency. +2. Provide ultra-low-consumption plumbing fix-tures. +3. Use metering or infrared faucets. 4. Use infrared flush valves. +5. Eliminate one-pass cooling for equipment. +6. Reducecooling-towerdriftlossesandotherequip-ment losses to save on the amount of makeup water. + +Shower Heads: 2.5 gallons per minute (9.5 liters per minute, lpm) +Water Closets: 1.6 gallons per flush (6.1 liters per flush, lpf) +Urinals: 1.0 gallons per flush (3.8 liters per flush, lpf) +It should be noted there are millions of plumbing fixtures installed in existing buildings that have not been modified to meet the requirements of EPACT and represent a significant opportunity to reduce the amount of water used by the plumbing system. + +PLUMBING PRODUCTS +Reductions in water usage beyond what is required by EPACT can be obtained by using products such as lavatory faucets with flow rates of 0.5 gallons per minute (1.9 lpm), showerheads with flow rates of 1.5 gallons per minute (5.7 lpm), and water closets that use dual-flush technology. Use of these ultra-low consumption fixtures should be cautioned without takingappropriatemeasuresinthesanitarydrainage system to accommodate the lower volume of water in the piping system. Usually, reducing the pipe size or increasing the slope of the pipe—thereby increasing the velocity of the water flowing through the piping system–accomplishes this. +Theuseofinfraredfaucetsandflushvalvesinthe plumbing systems can reduce the amount of water +Chapter 12 — Green Design for Plumbing Systems 265 + + + +consumed. The exact amount of reduction in water usage varies depending on the type of building and occupancy, but can be a significant amount upwards of 75 percent over conventional faucets. +Waterless urinals have been developed to use a biodegradable, immiscible fluid that is less dense than normal liquid waste and allows the waste to pass through a special trap and then to the drainage system.Theseproductsdonotconnecttothebuilding water supply and do not use water. There is quite a bitofcontroversyabouttheuseoftheseproductsand theirpotentialforincreasedmaintenancecosts.Some areashaveprovisionsintheplumbingcodethatwould prohibit the use of these fixtures and require special permissions or variances in order for the fixtures to beused.Careshouldbetakenbythedesignertofully understand the advantages and disadvantages and discuss these items with the building owner prior to using this type of fixture. +Composting water closet systems use little or no water, are not connected to a conventional plumbing system, and convert wastes into compost by means of an aerobic decomposition process carried out by micro and macro organisms. Another type of fixture that does not use water is an incinerating water closet, which utilizes a combustion chamber in order to incinerate wastes. Use of these units is typically limited to remote locations or locations where water availability is limited. Again, the limitations of code should be investigated prior to using these units. +Dual-flush water closets are available with con-trols to provide a reduced volume of water when a fullflushisnotrequired.Thesefixturesarebecoming more common in the United States. Several manu-facturers currently have units available. + +ADDITIONAL LEED POINTS— ENERGY SAVERS +Another area where LEED points are available is energy efficiency and energy-use reduction. There are many ways energy consumption can be reduced in a plumbing system. While the most common ways to conserve energy have to do with heating, ventilat-ing, and air-conditioning systems in a building, there are still ways to conserve energy in the plumbing system. +Using high-efficiency water heaters to heat do-mestic water is one of the first steps in saving energy in a plumbing system. Using solar water heating systems or photovoltaic technology and generating electricity to heat water can also be an option in some cases; capture an alternative energy source and reduce the amount of other types of energy used. Many of the alternatives for heating water will de-pend on the type of building being designed and the quantity of hot water your system requires. The use + +of a solar water-heating system may be an option for some buildings. However, if there is a high demand and you require a quick recovery on the water heat-ing system, then a solar water-heating system may not be advisable. The use of photovoltaic receptors to generate electricity to heat water can also be a vi-able option if your situation only requires a limited amount of hot water. +The use of small electric or natural gas-fired instantaneous water heaters, which only use energy when the water is flowing, is very much a viable op-tion--especially when the fixture is remotely located fromtherestofthebuilding,orthehotwaterdemand isonlyneededforashortperiodoftime.Understand-ing how the building uses hot water and accurately determiningthedemandofthebuildingareprerequi-sitestoprovidingawaterheaterthatisnotoversized, and, therefore, an energy-wasting device. +Reducing the amount of standby heat loss from the water heater or storage tank is all part of saving energy. Not storing quantities of hot water and using an instantaneous water heater may provide a great solution—if you have the right circumstances. How-ever, other types of facilities may need to have a large quantity of water stored for use during high-demand periods. It is important to have conversations with the client and understand the constraints the design will need to conform to. +Opportunities for the application of different water heating technologies are endless. Depending on the type of building you are designing, there may be multiple solutions for providing hot water to the building fixtures. +Hot-water recirculation systems conforming to ASHRAE90.1shouldalsobeprovided.Thesesystems require that the piping system be insulated with a minimum insulation thickness and the circulating pump be controlled by a temperature-sensing device or a time clock. This standard should be consulted prior to the design of a recirculation system. Another consideration to limit the energy lost in a hot-water recirculation system is the routing of the supply and return piping. Using the shortest route for the dis-tribution system will provide a more-efficient piping system, thereby saving energy from the heat loss of the system. These systems should also be balanced to provideuniformheatlossthroughoutthesystemand limit the temperature drop in the system. +In certain building types and installations, con-sideration may be given to using a central-chilled drinking-water system for energy conservation. The amount of energy consumed by electric water coolers spaced throughout a facility may actually be greater than the amount of energy consumed by a central chiller with a looped piping system to the drinking fountains and the recirculation pump—keeping the +266 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +water in the system moving and cool. As with a hot-water recirculation system, a chilled drinking-water system should also have the piping insulated to pre-vent heat gain and also prevent condensation on the piping system. Of course, using drinking fountains instead of electric water coolers would also save en-ergy, piping, and insulation costs associated with the system.Thebuildingownershouldbeconsultedprior toprovidinganon-chilleddrinking-watersolutionfor their building. +The possibilities are numerous for energy con-servation, and taking the time to stop and review the buildingbeingdesignedcanprovidesomeinteresting waystosaveenergy.Theuseofawaste-heat-recovery system to preheat the inlet water to domestic water heaterscantolimittheamountofenergyusedtoheat the domestic water. If a building system is connected toacentralsteamsystemwherethecondensateisnot returned,usingtheheatremaininginthecondensate is advisable. It is common to provide heat-recovery systems on large laundry and car-wash facilities, but common to apply them to other types of buildings. +Recovering the heat from dishwashers, glass washers, showers, and other devices that use hot waterhasnotbeenutilizedonawidebasis.Onetech-nology that allows heat recovery from these types of uses is the gravity-film heat exchanger. This device utilizes a vertical counter-flow heat exchanger that extracts heat from waste water and uses it to preheat thecoldwatertothewaterheater.Theheatexchanger consists of a copper drainage pipe with small-diam-eter copper piping coiled around the drainage piping over a given length. The heat is transferred from the drainage piping to smaller coils on the outside of the piping. The unit is installed in the vertical position so waste water in a vertical stack flows down the entire perimeter of the waste piping with a center core of air in the middle. This type of configuration would not be as efficient installed in the horizontal position, as water in the drainage piping would only be in contact with the coiled piping over half of the piping system perimeter. + +INNOVATIVE IDEAS Whenthinkingaboutsustainabledesignandportions of the plumbing system that could be modified to provide a more ecological solution to the installation of plumbing systems, there are several things that could be investigated. +Considering the use of mechanical joints or press joints with o-ring gaskets to limit the use of flux and solder and reduce the potential negative health effects of the byproducts of making soldered joints could be shown to be sustainable. While the use of lead pipe has declined to almost nothing, the retrofit of any system containing lead would be considered + +sustainable—even to the point of not using lead and oakum for joining cast-iron hub and spigot piping. Not many areas still use this method of joining pip-ing, but there are some areas where lead and oakum are still prevalent today. + +GREEN ROOFS +One portion of some sustainable designs is the use of green roofs or roofs that have a thin layer of soil, which contains vegetation and helps provide additional insulation and a thermal break for the building occupants. There are several types of these systems available, each with its own specific criteria and method of installation. Common to many of the different types of green roofs is the requirement to be able to provide some type of irrigation water for the plants. +Typically, the preferred solution in sustainable design would be to use some type of water other than the potable water supply to the building. Many of the potentialsolutionsforhowmuchwaterwillbeneeded for the irrigation systems, as well as the type of irri-gation system to be used, should be verified with the architect or landscape designer. It is recommended the plantings used in this type of situation be more drought resistant than conventional types of plants. This assists with the premise to save as much water as possible. Whether rainwater or clear water wastes from the building is collected to water the plants, there are several options available. The use of other types of water, not drinking water, will assist in the reduction of water use for the building. +It is common for the irrigation system of a green-roof installation to be a drip-type irrigation system. Other types of systems exist to limit the amount of run-off water into the roof-drainage system. The de-signer of the landscape portion of the green roofing system should be consulted on the type of irrigation system to be provided. The type of irrigation system used may depend on the type of vegetation planted on the roof, and whether or not water must be in a specific area for a predetermined length of time, or if another type of system is recommended. +The roof-drainage system used in a green roof setting is designed as a conventional roof drainage system would be. The plumbing code should be con-sultedregardingtheamountofrainwateranticipated and the requirements of storm durations. Pipe sizing for the storm-drainage system remains the same as it would for a conventional system. If a secondary drainage system is required for a conventional roof, and the green roof being designed contains the same attributes,(suchasparapets)thenasecondarydrain-age system with overflow drains or scuppers would also be required on the green roof. Green roofs are designed in many shapes and sizes, and each will be +Chapter 12 — Green Design for Plumbing Systems 267 + + + +differentdependingonthedesignerandtheareawith which they are working. +To help keep soil and other plants away from the roof drains, usually a small area around the drain is separated from the remainder of the green roof. Care should be taken when designing these systems to keep debris and other portions of the plantings from getting into the roof-drainage system and potentially creating a problem. Additional screening of the roof-drain strainers may be necessary. + +GREY WATER SYSTEMS +One of the technologies becoming more prevalent in thedesignofsustainableplumbingsystemsistheuse of grey water systems. The systems reuse previously usedwaterforanother.Typically,greywatersystems areusedtoflushwaterclosetsandurinalsandshould not come into any human contact. The collection of rainwater for use in this type of system is also gain-ing acceptance and can reduce the amount of potable water used for things other than drinking. +Typically these systems gather water from vari-ous uses (allowing the water to be classified as grey water) and bring that water back to a central loca-tion. Once the water is gathered into a tank, it can then be sent back to the system to be used again. The water must be filtered prior to distribution to water closets and urinals to remove substances from the water that may cause the flush valves or other components to fail. For example, small particles of sandorothermattercanclogthediaphragmsofflush valves so they run continuously. Distribution pumps are required to pressurize the system and allow it to function properly. +Greywatersystemsarecommonlyfoundinlaun-dry facilities, car washes, and other such facilities. Treatment of the waste water from these systems is usually required before the water can be used again. Various manufacturers of these systems are avail-able and should be consulted regarding the specific requirements of their systems. +Another potential resource for grey water usage iscondensategatheredfromhigh-efficiencycondens-ing-typewaterheaters,andboilers,andfromfan-coil units, air-handling units, etc. That water can be used to provide makeup water to the boiler or chiller makeup water systems. Condensate gathered from high-efficiency water heaters and boilers should be tested and potentially treated to reduce corrosive properties that may restrict it from being reused for anotherpurpose.Thecondensategatheredfromcool-ing coils or fan-coil units is generally water relatively free of impurities and can also reduce the amount of chemicaltreatmentofthemakeupwaterrequiredfor the other systems. + +Rainwater-collectionsystemsarebecomingmore prevalent for use in irrigation systems. These collec-tion systems require the storage of the rainwater, usually in underground storage tanks that can be quitelarge.Theamountofstoragedependsonthere-quirement for irrigation water, as well as the amount ofrainwateranticipated.Someamountofwatertreat-ment and filtration should be anticipated to keep the sprinkler heads from fouling and becoming clogged with debris, but not to the same extent as the water used to flush water closets and urinals. +If rainwater collection is being considered, the designer needs to investigate its potential impacts. Certain areas of the country prohibit the collection of rainwater because the rainwater serves other areas of the country as their primary water supply. Thus, rainwater collection in one area could create a significant shortfall in another water supply if the rainwater is not allowed to flow downstream. +268 ASPE Plumbing Engineering Design Handbook — Volume 1 + +Index + + + + + + + + + + + +∆ (delta), 2004 V1: 14 +µ (micro) prefix, 2004 V1: 34 Σ (ohms), 2004 V1: 33 +Σ cm (ohm-centimeter units), 2000 V3: 46 Σ m (ohm-meters), 2004 V1: 33 +% (percentages), 2004 V1: 15 +1-compartment septic tanks, 1999 V2: 229 1-compartment sinks, 2003 V4: 11 +1-family dwellings, numbers of fixtures for, 2003 V4: 20, 21 1-occupant toilet rooms, 2003 V4: 18, 23 +1-pass cooling for equipment, 2004 V1: 264 1-piece water closets, 2003 V4: 3 +1-pipe steam systems, 2000 V3: 178–180, 183, 186, 188 +1-pipe systems (Philadelphia systems), 1999 V2: 46, 47, 48 1-stage distillation, 1999 V2: 295 +1-tank residential filters, 2000 V3: 134 1-time costs, defined, 2004 V1: 223 +1-wall tanks, 2000 V3: 156 +2-bed deionizing units, 2000 V3: 46 +2-compartment sinks, 2003 V4: 11, 12 +2-family dwellings, numbers of fixtures for, 2003 V4: 20 2-pipe steam systems, 2000 V3: 178, 180–182, 185, 186– +187 +2-pipe venturi suction pumps, 1999 V2: 241 2-point vapor recovery, 2000 V3: 163 +2-pole fan-cooled electric motors, 2004 V1: 196 +2-step deionization (dual-bed), 1999 V2: 302, 303 +2-valve parallel pressure-regulated valves, 1999 V2: 153 2-word expressions of functions, 2004 V1: 225, 231 +3-compartment sinks, 2003 V4: 11, 12 +5-minute storm duration, 1999 V2: 69–70 10-minute storm duration, 1999 V2: 69–70 +10-year rainfall return periods, 1999 V2: 69–70 15-minute storm duration, 1999 V2: 69–70 +18-8 SS, 2004 V1: 141 18-8-3 SS, 2004 V1: 141 +28 CFR Part 36, 2004 V1: 106 70:30 Cu Ni, 2004 V1: 144 80/20 rule, 2004 V1: 224, 258 90:10 Cu Ni, 2004 V1: 144 +100-year rainfall return periods, 1999 V2: 69–70 1964 Alaska Earthquake, 2004 V1: 161–162 1971 San Francisco Earthquake, 2004 V1: 162 2406 MDPE pipe, 2003 V4: 58 +3408 HDPE. See HDPE (high density polyethylene) A, X#, X#A (compressed air). See compressed air + + +A/m (amperes per meter), 2004 V1: 33 A (amperes). See amperes +A (area). See area (A) +a (atto) prefix, 2004 V1: 34 +“A dimension,” 2000 V3: 187–188 +A-weighted sound levels, 2004 V1: 194 A-53 standard, 2003 V4: 48 +A-74 standard, 2003 V4: 28 A-106 standard, 2003 V4: 48 A-135 standard, 2003 V4: 48 A-888 standard, 2003 V4: 28 +AAMI (Association for the Advancement of Medical Instrumentation), 1999 V2: 279, 317, 319 +AAU (Amateur Athletic Union), 2000 V3: 151 AAV (automatic air vents), 2004 V1: 10 abandoned seepage pits, 1999 V2: 226 abandoned septic tanks, 1999 V2: 231 abandoned wells, 1999 V2: 243 +abbreviations +International System of Units, 2004 V1: 32 plumbing and piping symbols, 2004 V1: 7–13 text, drawings, and computer programs, 2004 V1: +14–16 +The ABC’s of Lawn Sprinkler Systems, 2000 V3: 105 above-finished floor (AFF), 2004 V1: 14 +above-grade fountains, 2000 V3: 108 aboveground piping +inspection checklist, 2004 V1: 103 materials for, 1999 V2: 14–15 +storm-drainage systems, 1999 V2: 68 aboveground sanitary piping codes, 2004 V1: 42 aboveground tank systems +codes and standards, 2000 V3: 154 connections and access, 2000 V3: 166 construction, 2000 V3: 165 +corrosion protection, 2000 V3: 165 electronic tank gauging, 2000 V3: 160 filling and spills, 2000 V3: 166–167 industrial wastes, 2000 V3: 91 +leak prevention and monitoring, 2000 V3:167–168 liquid fuel systems, 2000 V3: 165–169 +materials for, 2000 V3: 165 overfill prevention, 2000 V3:167 +product-dispensing systems, 2000 V3:168 tank protection, 2000 V3:169 +testing, 2000 V3:171 +270 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +vapor recovery, 2000 V3:168 venting, 2000 V3:167 +abrasion, 2004 V1: 146, 1999 V2: 18, 276 +ABS. See acrylonitrile-butadiene-styrene (ABS) abs, ABS (absolute), 2004 V1: 14 +absolute (abs, ABS), 2004 V1: 14 absolute pressure, 2000 V3: 200 +defined, 2004 V1: 17 +in vacuums, 1999 V2: 254 absolute temperature, 2004 V1: 17 absolute zero, 2004 V1: 17 +absorphan (carbon filtration). See activated carbon filtration (absorphan) +absorption +air drying, 2000 V3: 204 defined, 2004 V1: 17 +rates for soils, 1999 V2: 217–220, 2000 V3: 99 surfaces in seepage beds, 1999 V2: 224 trenches. See leaching trenches (leach fields) +absorptive silencers, 2000 V3: 202 +ac, AC (alternating current), 2004 V1: 14 AC (air chambers). See air chambers (AC) AC-DC rectifiers, 2004 V1: 150, 2004 V1:151 +acc (accumulate or accumulators), 2004 V1: 14, 17 acceleration +earthquakes, 2004 V1: 159, 160 linear, 2004 V1: 33, 35 measurements, 2004 V1: 33 +accelerators (dry-pipe systems), 2000 V3: 11, 12–13 accelergrams, 2004 V1: 159 +access +aboveground tank systems, 2000 V3: 166 clean agent gas fire containers, 2000 V3: 23 to equipment, piping and, 2003 V4: 25 +underground liquid fuel tanks, 2000 V3: 156–157 access doors, 2004 V1: 17 +accessibility, 2004 V1: 17. See also people with disabilities Accessibility Guidelines for Buildings and Facilities, 2004 +V1: 105 +Accessible and Usable Buildings and Facilities, 2004 V1: 105, 123, 2003 V4: 2 +accessories section in specifications, 2004 V1: 91 accreditation of health-care facilities, 2000 V3: 50 accumulate (acc, ACCUM), 2004 V1: 14 accumulators (acc, ACCUM), 2004 V1: 14, 17 accuracy +in measurements, 2004 V1: 32 +of pressure-regulating valves, 1999 V2: 152 +ACEC (American Consulting Engineers Council), 2004 V1: 62 +acfh (actual cfh), 1999 V2: 180 +acfm (actual cubic feet per minute), 1999 V2: 255–256, 257 defined, 2000 V3: 83, 200 +medical air compressors, 2000 V3: 65, 66 medical vacuum systems, 2000 V3: 69 +acid-containing inhibitors, 1999 V2: 305 acid fumes, 2000 V3: 42 +acid neutralization, 2000 V3: 40–41, 91 +acid-neutralization tanks, 2000 V3: 40–41, 42 acid radicals, 1999 V2: 281 +acid regenerants, 1999 V2: 295, 302, 305 acid resins, 1999 V2: 295 + +acid-resistant fixtures, 2003 V4: 1–2 acid-resistant floor drains, 1999 V2: 16 acid-resistant piping, 1999 V2: 14, 341 acid-resistant sinks, 2000 V3: 37 +acid vents (AV), 2004 V1: 8, 17 acid-waste systems +acid-waste treatment, 1999 V2: 334–337 continuous systems, 1999 V2: 338 +health and safety concerns, 1999 V2: 332 health-care facilities, 2000 V3: 39–40 introduction, 1999 V2: 329, 332–334 large facilities, 1999 V2: 336 +metering, 2000 V3: 41–42 +piping and joint material, 1999 V2: 334 solids interceptors, 2000 V3: 41, 43 +system design considerations, 1999 V2: 334 types of acid, 1999 V2: 332–334 +acid wastes (AW), 2004 V1: 8, 17, 2000 V3: 42 acidity +in corrosion rates, 2004 V1: 145 pH control, 2000 V3: 91–92 +swimming pool water, 2000 V3: 146–147 in water, 1999 V2: 244, 281, 285 +acids, defined, 1999 V2: 280 acme threads, 2004 V1: 17 acoustics in plumbing systems +acceptable levels in buildings, 2004 V1: 193 acoustics, defined, 2004 V1: 206 +building material acoustic insulation, 2004 V1: 193 cold-water systems, 1999 V2: 115 +design procedures, 2004 V1: 198–200 equipment selection, 2004 V1: 200 flow velocity, 2004 V1: 198 +glossary, 2004 V1: 206–210 +gurgling noises in pipes, 1999 V2: 35 introduction, 2004 V1: 193 +noise and vibration control, 2004 V1: 199–200 occupied domestic spaces, 2004 V1: 196 +pipe sleeves and, 2004 V1: 201 pressure and, 2004 V1: 200 +pumps, 2004 V1: 196–198, 201–202 +ratings for fixtures and appliances, 2004 V1: 194–195, 198 +silencers on vacuum systems, 1999 V2: 268 sound power levels, 2004 V1: 194 +system design, 2004 V1: 200–206 system layout, 2004 V1: 202 transmission in pipes, 1999 V2: 15, 121 vacuum systems, 1999 V2: 263 vibration isolation, 2004 V1: 202–206 +water hammer, 2004 V1: 198, 201, 1999 V2: 132 water piping design, 2004 V1: 195–196 +acoustics in swimming pools, 2000 V3: 129 acquisition costs +acquisition prices defined, 2004 V1: 222 base acquisition costs, 2004 V1: 223 +ACR/MED pipes, 2003 V4: 36 ACR piping, 2003 V4: 36 +acres, converting to SI units, 2004 V1: 39 acrylic fixtures, 2003 V4: 2 +acrylonitrile butadiene rubber (ABR), 2000 V3: 169 acrylonitrile-butadiene-styrene (ABS) +Index + + +defined, 2004 V1: 17 fixtures, 2003 V4: 2 +pipe characteristics, 2003 V4: 59–60 piping, 1999 V2: 14, 15, 68, 2000 V3: 48 plastic underdrains, 2000 V3: 131 weirs, 2000 V3: 146 +activated alumina air dryers, 2000 V3: 204 activated alumina water treatment, 1999 V2: 318 activated carbon filtration (absorphan) +in gray-water systems, 1999 V2: 27, 28 in gray-water treatment, 1999 V2: 29 illustrated, 1999 V2: 301 +overview, 1999 V2: 300 +pure-water systems, 1999 V2: 323 small water systems, 1999 V2: 318 well water, 1999 V2: 244, 245 +Activated Carbon Process for Treatment of Wastewater Containing Hexavalent Chromium (EPA 600/2-79-130), 2000 V3: 96 +activated sludge systems, 2000 V3: 95 active, defined, 2004 V1: 151 +active potential, defined, 2004 V1: 151 active sludge, 2004 V1: 17 +active verbs in function analysis, 2004 V1: 224, 225 activities in FAST approach, 2004 V1: 231 +actual cfh (acfh), 1999 V2: 180 +actual cubic feet per minute. See acfm (actual cubic feet per minute) +actual flow rates, 2000 V3: 5, 217 +actual liters per minute (aL/min), 2000 V3: 69, 200 actual pressure. See static pressure (SP) +actuator-control valves, 2000 V3: 119 ACU (air-conditioning units), 2004 V1: 14 ADA. See Americans with Disabilities Act +ADAAG (Americans with Disabilities Act Accessibility Guidelines), 2004 V1: 105, 106 +ADAAG Review Federal Advisory Committee, 2004 V1: 123 +adapter fittings, 2004 V1: 17 +addenda in contract documents, 2004 V1: 62–63 addresses of organizations and associations, 2004 V1: +58–59 +adiabatic processes, 2000 V3: 200 +adjustment section in specifications, 2004 V1: 71, 92 administrative and operation costs in value engineering. +See overhead +administrative authorities, 2004 V1: 17 admiralty brass, 2004 V1: 144 +adp, ADP (apparatus dew points), 2004 V1: 14 adsorption, 2000 V3: 204 +adult-sized wheelchairs, dimensions, 2004 V1: 108. See also wheelchairs +advanced oxidation water treatment, 1999 V2: 318 aerated lagoons, 2000 V3: 95 +aerating fountain nozzles, 2000 V3: 108, 119–120 aeration, 2004 V1: 17 +aeration cells, 2004 V1: 151 aerators +aeration treatment, 1999 V2: 292–294, 318 lavatories and sinks, 2000 V3: 33 +sovent aerators, 1999 V2: 19, 46, 54–56, 60, 62 aerobic, defined, 2004 V1: 17 + +271 + + +aerobic wastewater treatment plants, 1999 V2: 232–233 AFF (above-finished floor), 2004 V1: 14 +AFFF foam concentrates, 2000 V3: 21 after-coolers +air compressors, 2000 V3: 202–203 air dryers and, 2000 V3: 207 +medical air compressors, 2000 V3: 66 after-filters, 2000 V3: 203 +AGA (American Gas Association) +appliance venting standards, 1999 V2: 178 defined, 2004 V1: 17 +gas-train vent standards, 1999 V2: 177 relief valve standards, 1999 V2: 166 water heating standards, 1999 V2: 170 +age of water mains, 2000 V3: 8 +age-related disabilities, 2004 V1: 107 aggregation in soil structure, 1999 V2: 218 aggressiveness index, 1999 V2: 292 +aging disabilities, 2004 V1: 107 aging water mains, 2000 V3: 8 agitators in kill tanks, 1999 V2: 344 agreement documents, 2004 V1: 62 agreement states, 1999 V2: 340 agricultural drain tile, 1999 V2: 221 +AHJ. See authorities having jurisdiction ahp, AHP (air horsepower), 2004 V1: 14 AHU (air-handling units), 2004 V1: 14 AI (aggressiveness index), 1999 V2: 292 +AIA (American Institute of Architects). See American Institute of Architects +air +free, 2004 V1: 17, 2000 V3: 199, 200–201 oil-free, 2000 V3: 83 +in pipes, 1999 V2: 2 properties, 2000 V3: 199 standard, 2004 V1: 17–18 +water vapor in, 2000 V3: 200–201 +air, compressed. See compressed air (A, X#, X#A) air, free, 2004 V1: 17, 2000 V3: 199, 200–201 +air, oil-free, 2000 V3: 83 air, standard, 2004 V1: 17 +air-admittance valves, 2004 V1: 43, 1999 V2: 64 air binding, 2000 V3: 178, 180 +air-bleed vacuum controls, 1999 V2: 268–269 air breaks, 2004 V1: 17. See also air gaps +air chambers (AC) defined, 2004 V1: 17 +self-priming pumps, 2000 V3: 142 symbols for, 2004 V1: 10 +water hammer arresters, 2004 V1: 198, 201, 1999 V2: 132, 143 +air circuits in instrumentation, 2000 V3: 199 air compressors +accessories, 2000 V3: 202–203 +compressed air systems, 2000 V3: 201–202 dry-pipe systems, 2000 V3: 12 +medical systems, 2000 V3: 65 pulsation, 2000 V3: 205 selection factors, 2000 V3: 213 sizing, 2000 V3: 210–213 types of, 2000 V3: 201–202 vacuum pumps, 1999 V2: 259 +272 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +AIR COND (air conditioning). See air-conditioning systems +Air-Conditioning and Refrigeration Institute (ARI), 2004 V1: 46–47, 58 +air-conditioning cooling towers. See cooling-tower water air-conditioning engineers, 2000 V3: 27–28 +air-conditioning systems (AIR COND) fixture-unit values, 1999 V2: 9 pipes, 2003 V4: 36 +symbols, 2004 V1: 14 +waste heat usage, 2004 V1: 131 water demand, 1999 V2: 243 +air-conditioning units (ACU), 2004 V1: 14 air-consuming devices, 2000 V3: 206 +air-cooled after-coolers, 2000 V3: 203 air densities, calculating, 2004 V1: 5 air dryers +compressed air systems, 2000 V3: 203–204 deliquescent dryers, 2000 V3: 207 desiccant dryers, 2000 V3: 207 +medical air compressors, 2000 V3: 66 refrigerated air dryers, 2000 V3: 207 selection, 2000 V3: 204 +air ducts, 2000 V3: 23 +air flow rates, 2004 V1: 14 +air gaps. See also air breaks; effective openings +as cross-connection control devices, 1999 V2: 144, 145, 148 +defined, 2004 V1: 17 +air-gate valves, 1999 V2: 268 +air-handling units (AHU), 2004 V1: 14, 267 air horsepower (ahp, AHP), 2004 V1: 14 air intakes, 2000 V3: 211 +air locks, 2004 V1: 201 +air pressure, 1999 V2: 255–256, 2000 V3: 12 air receivers, 2000 V3: 205–206 +air-separation chambers, 1999 V2: 56 air springs, 2004 V1: 203, 210 +air temperatures +pool heating and, 2000 V3: 121 swimming pools and, 2000 V3: 129 +air tests +in cold-water systems, 1999 V2: 154 defined, 2004 V1: 18 +air velocity in vacuum cleaning systems, 1999 V2: 270 air vessels (chambers), 2004 V1: 198 +aircraft cable bracing method, 2004 V1: 171 aircraft fuel, 1999 V2: 13 +airport runways, piping underneath, 1999 V2: 250 aL/min (actual liters per minute), 2000 V3: 69, 200 ALARA (as low as reasonably achievable), 1999 V2: 341 alarm check valves, 2004 V1: 13, 18, 2000 V3: 9 +alarm lines on sprinklers, 2000 V3: 9 alarm relays, 2000 V3: 24 +alarms +aboveground tank leakage, 2000 V3: 168 defined, 2004 V1: 18, 2000 V3: 83 +on bulk oxygen supply, 2000 V3: 62 +on corrosive-waste systems, 2000 V3: 40 on hazardous waste systems, 2000 V3: 90 on kill tanks, 1999 V2: 345 +on medical gas systems + +area alarms, 2000 V3: 72 master alarms, 2000 V3: 72 testing, 2000 V3: 81 +on vacuum systems, 1999 V2: 259, 262 on water tanks, 1999 V2: 151 +overfill prevention, 2000 V3: 158, 167 pressurized fuel delivery systems, 2000 V3: 162 +Alaska Earthquake, 2004 V1: 161–162 Albern, W.F., 1999 V2: 277 +alcohol-resistant AFFF foam concentrates, 2000 V3: 21 algae, 1999 V2: 282, 289, 2000 V3: 148 +algaecides, 2000 V3: 150 alkalinity +alkaline solutions in corrosion rates, 2004 V1: 145 boiler feed water, 1999 V2: 314 +dealkalizing treatment, 1999 V2: 295 measuring, 1999 V2: 282–283, 2000 V3: 123 pH and, 1999 V2: 285, 329, 2000 V3: 91 predicting scale and corrosion, 1999 V2: 290 swimming pool water, 2000 V3: 147 +water saturation, 1999 V2: 293 +allowable leakage in compressed air systems, 2000 V3: 209 allowable radiation levels, 1999 V2: 339 +allowable vacuum system pressure loss, 1999 V2: 263 alloy pipes, 2004 V1: 18 +alloys, 2004 V1: 18 +alpha ray radiation, 1999 V2: 337 alt, ALT (altitude), 2004 V1: 14 +alteration (altrn, ALTRN), 2004 V1: 14 +alternate bracing attachments for pipes, 2004 V1: 174 alternating current (ac, AC), 2004 V1: 14 +alternative collection and treatment of waste water, 1999 V2: 232 +alternative energy solutions, 2004 V1: 263–267 alternative energy sources, 2004 V1: 130–131 alternative sketches in value engineering, 2004 V1: 254, +255 +alternative treatment of waste water, 1999 V2: 226–227 Alternatives for Small Wastewater Treatment Systems: +Cost-effectiveness Analysis”, 1999 V2: 238 Alternatives for Small Wastewater Treatment Systems: +On-site Disposal/Seepage Treatment and Disposal, 1999 V2: 238 +Alternatives for Small Wastewater Treatment Systems: Pressure Sewers/Vacuum Sewers, 1999 V2: 238 +alternators +medical air compressors, 2000 V3: 67 vacuum systems, 2000 V3: 70 +altitude (alt, ALT), 2004 V1: 14. See also elevation altitude valves, 1999 V2: 249 +altrn, ALTRN (alteration), 2004 V1: 14 alum, 1999 V2: 294, 2000 V3: 147, 150 aluminates, 2000 V3: 147 aluminosilicates, 2000 V3: 204 +aluminum, 2004 V1: 139, 144, 1999 V2: 281, 2000 V3: 20, 145 +aluminum 1100, 2004 V1: 141 aluminum 2017 and 2024, 2004 V1: 141 aluminum check valves, 1999 V2: 177 +aluminum hydroxide, 1999 V2: 281, 2000 V3: 149–150 aluminum piping, 1999 V2: 68, 176, 196, 2000 V3: 47, 210 aluminum silicates, 1999 V2: 301–302, 2000 V3: 134 +Index + + +aluminum sulfate, 1999 V2: 294, 2000 V3: 149–150 Amateur Athletic Union (AAU), 2000 V3: 151 amb, AMB (ambient), 2004 V1: 14 +ambient (amb, AMB), 2004 V1: 14 ambient temperature, 2004 V1: 18 ambulatory accessible stalls, 2004 V1: 114 American Chemical Society, 2004 V1: 153 +American Concrete Institute, 1999 V2: 102, 114 +American Consulting Engineers Council (ACEC), 2004 V1: 62 +American Gas Association (AGA) +appliance venting standards, 1999 V2: 178 defined, 2004 V1: 17 +gas-train vent standards, 1999 V2: 177 relief valve standards, 1999 V2: 166 water heating standards, 1999 V2: 170 +American Institute of Architects (AIA) +General Conditions of the Contract for Construction, 2004 V1: 62 +Masterspec, 2004 V1: 71 +medical-gas guidelines, 2000 V3: 50 specifications format, 2004 V1: 63 +American National Standards Institute (ANSI) abbreviation for, 2004 V1: 14, 18 +address, 2004 V1: 58, 2000 V3: 97 consensus process, 2004 V1: 41 gas piping standards, 1999 V2: 194 list of standards, 2004 V1: 46 publications, 2004 V1: 41 +ANSI A112.6.1, 2003 V4: 6 ANSI A112.18.3, 2003 V4: 14 ANSI A112.19.6, 2003 V4: 5, 9 ANSI A117.1-1980, 2004 V1: 105 ANSI A117.1-1986, 2004 V1: 105 +ANSI A117.1-1998, 2004 V1: 105, 106, 109–123, 2003 V4: 2, 14 +ANSI/ASME B16.15 Cast Bronze Threaded Fittings, 2003 V4: 34 +ANSI/ASME B16.24 Cast Copper Alloy Pipe Flanges and Flanged Fittings, 2003 V4: 34 +ANSI-ASSI: Building Code Requirements for Minimum Design Loads in Buildings and Other Structures, 2004 V1: 191 +ANSI/AWWA C104/A21.4 Cement Mortar Lining, 2003 V4: 32 +ANSI/AWWA C105/A21.5 Polyethylene Encasement, 2003 V4: 32 +ANSI/AWWA C110/A21.10 Fitting, 2003 V4: 32 ANSI/AWWA C111/A21.11 Rubber-Gasket Joints, +2003 V4: 32 +ANSI/AWWA C115/A21.15 Flanged Pipe, 2003 V4: 32 +ANSI/AWWA C116/A21.16 Fusion-Bonded Epoxy Coating, 2003 V4: 32 +ANSI/AWWA C150/A21.50 Thickness Design, 2003 V4: 32 +ANSI/AWWA C151/A21.51 Manufacturing, 2003 V4: 32 +ANSI/AWWA C153/A21.53 Compact Fittings, 2003 V4: 32 +ANSI/AWWA C600 Installation, 2003 V4: 32 ANSI B3.13: Chemical Plant and Petroleum + +273 + + +Refinery Piping, 2000 V3: 95 ANSI/NFPA Standard no. 54: National Fuel Gas +Code, 2000 V3: 248, 254 +ANSI/NSPI-1: Standard for Public Swimming Pools, 2000 V3: 125, 151 +ANSI/NSPI-5: Standard for Residential, In-ground Swimming Pools, 2000 V3: 151 +ANSI Z358.1, 2003 V4: 18 +ANSI ZE 86.1: Commodity Specification for Air, 2000 V3: 65, 86 +ASME/ANSI B16.22 Wrought Copper and Copper Alloy Solder-Joint Pressure Fittings, 2003 V4: 37 +ASME/ANSI B16.23 Cast Copper Alloy Solder-Joint Drainage Fittings, 2003 V4: 45 +ASME/ANSI B16.26 Cast Copper Alloy Fittings for Flared Copper Tube, 2003 V4: 37 +ASME/ANSI B16.29 Wrought Copper and Wrought Copper Alloy Solder-Joint Drainage Fittings, 2003 V4: 45 +B16.15 Cast Bronze Threaded Fittings, 2003 V4: 27 B16.24 Cast Copper Alloy Pipe Flanges and +Flanged Fittings, 2003 V4: 27 B36.1 standard, 2003 V4: 48 +standard air definition, 2000 V3: 200 water quality standards, 1999 V2: 319 +American Petroleum Institute address, 2000 V3: 97, 173 +emergency vent standards, 2000 V3: 167 publications +AOIRP 1004: Bottom Loading and Vapor Recovery for MC-306 Tank Motor Vehicles, 2000 V3: 173 +API Bulletin no. 1611: Service Station Tankage Guide, 2000 V3: 173 +API Bulletin no. 1615: Installation of Underground Gasoline Tanks and Piping at Service Stations, 2000 V3: 173 +API Specification 12D: Large Welded Petroleum Tanks, 2000 V3: 95 +API Specification 12F: Small Welded Petroleum Tanks, 2000 V3: 95 +API Standard 250: Steel Tanks for Oil Storage, 2000 V3: 95 +removal of globules standards, 1999 V2: 348 separators, 2000 V3: 93 +American Public Health Service, 1999 V2: 287 American Society for Testing and Materials (ASTM) +abbreviation for, 2004 V1: 18 address, 2004 V1: 58 +ASTM B819 tubing, 2000 V3: 77 consensus process, 2004 V1: 41 +electronics-grade water standards, 1999 V2: 320 high-purity water standards, 1999 V2: 317 +list of standards, 2004 V1: 41, 49–52 membrane filters, 1999 V2: 289 publications +A-53 standard, 2003 V4: 48 A-74 standard, 2003 V4: 28 A-106 standard, 2003 V4: 48 A-135 standard, 2003 V4: 48 +A-716 Culvert Pipe, 2003 V4: 32 +274 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +A-746 Gravity Sewer Pipe, 2003 V4: 32 A-888 standard, 2003 V4: 28 +ASME/ANSI B16.23 Cast Copper Alloy Solder-Joint Drainage Fittings, 2003 V4: 45 +ASTM D2863: Method for Measuring the Minimum Oxygen Concentration to Support Candle-like Combustion of Plastics, 2000 V3: 85 +B-16.9 standard, 2003 V4: 48 B-16.11 standard, 2003 V4: 48 B-16.28 standard, 2003 V4: 48 +B-16.50 Wrought Copper Braze Fittings, 2003 V4: 45 +B-29 standard, 2003 V4: 49 +B-42 Standard Specification for Seamless Copper Pipe, Standard Sizes, 2003 V4: 34 +B-43 Standard Specification for Seamless Red Brass Standard Sizes, 2003 V4: 27 +B-88 Specification for Seamless Copper Water Tube, 2003 V4: 35 +B-306 Specification for Copper Drainage Tube (DWV), 2003 V4: 35 +B-306 Standard Specification for Copper Drainage Tube (DWV), 2003 V4: 45 +B-813 Standard Specification for Liquid and Paste Fluxes for Soldering Applications of Copper and Copper Alloy Tube, 2003 V4: 37 +B-819 Specification for Seamless Copper Tube for Medical Gas Systems, 2003 V4: 35 +B-819 Standard Specification for Seamless Copper Tube for Medical Gas Systems, 2003 V4: 45 +B-828 Standard Practice for Making Capillary Joints by Soldering of Copper and Copper Alloy Tube and Fittings, 2003 V4: 37 +C-4 standard, 2003 V4: 49 C-12 standard, 2003 V4: 49 +C-14 Standard Specification for Concrete Sewer, Storm Drain, and Culvert Pipe for Non-reinforced Concrete, 2003 V4: 32 +C-76 Standard Specification for Reinforced Concrete Culverts, Storm Drain, and Sewer Pipe, 2003 V4: 32 +C-296 standard, 2003 V4: 26 C-301 standard, 2003 V4: 49 C-425 standard, 2003 V4: 49 C-428 standard, 2003 V4: 26 +C-443 Standard Specification for Joints for Circular Concrete Sewer and Culvert Pipe, Using Rubber Gaskets, 2003 V4: 32 +C-599-77 standard, 2003 V4: 48 +C-655 Standard Specification for Reinforced Concrete D-Load Culvert Storm Drain and Sewer Pipe for Reinforced Concrete Pipe, 2003 V4: 32 +C-700 standard, 2003 V4: 49 C-828 standard, 2003 V4: 49 C-896 standard, 2003 V4: 49 D-1148 standard, 2003 V4: 61 D-1784 standard, 2003 V4: 62 D-1785 standard, 2003 V4: 62 D-2239 standard, 2003 V4: 61 D-2241 standard, 2003 V4: 62 D-2464 standard, 2003 V4: 62 + +D-2466 standard, 2003 V4: 62 D-2467 standard, 2003 V4: 62 D-2609 standard, 2003 V4: 61 D-2662 standard, 2003 V4: 58 D-2665 standard, 2003 V4: 62 D-2666 standard, 2003 V4: 58 D-2672 standard, 2003 V4: 62 D-2737 standard, 2003 V4: 61 D-3139 standard, 2003 V4: 62 +E-33.08b Plumbing Noise, 2004 V1: 194 F-477 standard, 2003 V4: 62 +F-876 standard, 2003 V4: 61 F-877 standard, 2003 V4: 61 F-1281 standard, 2003 V4: 62 F-1282 standard, 2003 V4: 62 +reagent-grade water standards, 1999 V2: 279, 319 American Society of Civil Engineers (ASCE) +contract publications, 2004 V1: 62 sewer publications, 1999 V2: 95, 114 +American Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc. (ASHRAE) +address, 2004 V1: 58 defined, 2004 V1: 18 +hot-water recirculation systems, 2004 V1: 265 list of standards, 2004 V1: 47 +publications +Handbook of Fundamentals, 2004 V1: 2, 5, 6, 40, 2000 V3: 197 +Handbooks, 1999 V2: 214 +water heating codes and standards, 1999 V2: 170 American Society of Mechanical Engineers (ASME) +address, 2004 V1: 58, 2000 V3: 97 air receivers, 2000 V3: 205 defined, 2004 V1: 18 +fired and unfired pressure vessel standards, 1999 V2: 170 +list of standards, 2004 V1: 47–48 publications +ANSI/ASME A112.6.1, 2003 V4: 6 ANSI/ASME A112.18.1, 2003 V4: 14 ANSI/ASME A112.19.6, 2003 V4: 5, 9 ANSI/ASME B16.15 Cast Bronze Threaded +Fittings, 2003 V4: 34 +ANSI/ASME B16.24 Cast Copper Alloy Pipe Flanges and Flanged Fittings, 2003 V4: 34 +ASME A17.1 Safety Code for Elevators and Escalators, 2000 V3: 25 +ASME/ANSI B16.22 Wrought Copper and Copper Alloy Solder-Joint Pressure Fittings, 2003 V4: 37 +ASME/ANSI B16.24 Cast Copper Alloy Pipe Flanges and Flanged Fittings, 2003 V4: 37 +ASME/ANSI B16.26 Cast Copper Alloy Fittings for Flared Copper Tube, 2003 V4: 37 +ASME/ANSI B16.29 Wrought Copper and Wrought Copper Alloy Solder-Joint Drainage Fittings, 2003 V4: 45 +ASME Boiler and Pressure Vessel Code, 2000 V3: 95 B16.15 Cast Bronze Threaded Fittings, 2003 V4: 27 Fuel-Gas Piping, 1999 V2: 214 +relief valve standards, 1999 V2: 166 American Society of Plumbing Engineers (ASPE) +Index + + +ASPE Solar Energy System Design Handbook, 2004 V1: 130 +defined, 2004 V1: 18 +Domestic Water Heating Design Manual, 2000 V3: 45 medical gas station guidelines, 2000 V3: 50, 51–52 publications, 1999 V2: 65 +American Society of Plumbing Engineers Research Foundation (ASPERF), 2004 V1: 18 +American Society of Safety Engineers (ASSE), 2004 V1: 18 American Society of Sanitary Engineering (ASSE), 2004 +V1: 18 +address, 2004 V1: 58 ASSE 1002, 2003 V4: 8 +ASSE 6000 Professional Qualifications Standard for Medical Gas Systems Installers, Inspectors, Verifiers, Maintenance Personnel and Instructors, 2003 V4: 45 +list of standards, 2004 V1: 48–49 American standard pipe threads, 2004 V1: 18 +American Standards Association. See American National Standards Institute (ANSI) +American Water Works Association (AWWA) address, 2004 V1: 58 +defined, 2004 V1: 18 +list of standards, 2004 V1: 52 publications +ANSI/AWWA C104/A21.4 Cement Mortar Lining, 2003 V4: 32 +ANSI/AWWA C105/A21.5 Polyethylene Encasement, 2003 V4: 32 +ANSI/AWWA C110/A21.10 Fitting, 2003 V4: 32 ANSI/AWWA C111/A21.11 Rubber-Gasket Joints, +2003 V4: 32 +ANSI/AWWA C115/A21.15 Flanged Pipe, 2003 V4: 32 +ANSI/AWWA C116/A21.16 Fusion-Bonded Epoxy Coating, 2003 V4: 32 +ANSI/AWWA C150/A21.50 Thickness Design, 2003 V4: 32 +ANSI/AWWA C151/A21.51 Manufacturing, 2003 V4: 32 +ANSI/AWWA C153/A21.53 Compact Fittings, 2003 V4: 32 +ANSI/AWWA C600 Installation, 2003 V4: 32 AWWA Cross Connection Control Manual, 1999 V2: +155 +AWWA Standard for Disinfecting Water Mains, 1999 V2: 155 +AWWA Standard for Disinfection of Water Storage Facilities, 1999 V2: 155 +C-400 standard, 2003 V4: 26 C651 Disinfecting, 2003 V4: 32 +American Welding Society (AWS), 2004 V1: 52, 58, 167 American wire gage (AWG), 2004 V1: 14 +Americans with Disabilities Act Accessibility Guidelines (ADAAG), 2004 V1: 106 +Americans with Disabilities Act (ADA) +ADAAG Review Federal Advisory Committee, 2004 V1: 123 +faucet flow rates, 2004 V1: 135 fixture standards, 2003 V4: 2 history, 2004 V1: 106 + +275 + + +overview, 2004 V1: 105 Amin, P., 1999 V2: 325 ammonia, 1999 V2: 282, 294 +amp, AMP, AMPS (ampere). See amperes ampacity, 2000 V3: 83 +amperes (A, amp, AMP, AMPS) ampere-hours, 2004 V1: 139 amperes per meter, 2004 V1: 33 +measurement conversions, 2004 V1: 33 symbols for, 2004 V1: 14 +amphoteric corrosion, defined, 2004 V1: 151 amphoteric materials, 2004 V1: 145 +amusement parks, numbers of fixtures for, 2003 V4: 19 anaerobic bacteria in septic tanks, 1999 V2: 227 anaerobic wastewater treatment, 2000 V3: 95 anaerobic, defined, 2004 V1: 18, 151 +Analysis phase of value engineering, 2004 V1: 213, 224. See also Function Analysis phase in value engineering +analytical grade water, 1999 V2: 317 anchoring equipment +anchorage forces in earthquakes, 2004 V1: 186 anchors, defined, 2004 V1: 191 +fire-protection equipment, 2000 V3: 23 illustrations of potential problems, 2004 V1: 189 seismic protection, 2004 V1: 163 +anchoring pipes, 1999 V2: 18, 85 +anchors, defined, 2004 V1: 18, 12004 V1: 191 anechoic chambers, 2004 V1: 198 +anesthesia workrooms fixtures, 2000 V3: 36 +health-care facilities, 2000 V3: 32 medical air, 2000 V3: 53 +medical gas stations, 2000 V3: 51 anesthetic gas management, 2000 V3: 70–71 anesthetics, 2000 V3: 83 +anesthetizing locations, 2000 V3: 83 ANG (angle). See angles (ANG) +ANGI (angles of incidence), 2004 V1: 14 +angle grates in school shower rooms, 1999 V2: 11 angle snubbers, 2004 V1: 165 +angle stops, 2004 V1: 18 +angle valves (AV), 2004 V1: 9, 18 angles (ANG) +measurements, 2004 V1: 33 symbols, 2004 V1: 14 +angles of bend, 2004 V1: 18 +angles of incidence (ANGI), 2004 V1: 14 +angular acceleration measurements, 2004 V1: 33 angular velocity measurements, 2004 V1: 33 +animal research centers, 1999 V2: 147, 344, 2000 V3: 51 animal shelters, 1999 V2: 16 +animal treatment rooms, 2000 V3: 45 anions +anion resins, 1999 V2: 284, 305 defined, 2004 V1: 151, 1999 V2: 280 +in electromotive force series, 2004 V1: 144 in ion exchange, 1999 V2: 300, 301, 302 +in pH values, 1999 V2: 329 annealed temper (soft), 2003 V4: 37 +annual costs. See costs and economic concerns annular chambers in dry-pipe systems, 2000 V3: 11 +276 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +annular spaces in wells, 1999 V2: 240, 243 anodes +anode expected life, 2004 V1: 148 anodic protection, 2004 V1: 151–152 defined, 2004 V1: 139, 151 +galvanic series of metals, 2004 V1: 141 sacrificial anodes, 2004 V1: 147 +anodic inhibitors, 2004 V1: 151 +anodic potential (electronegative potential), 2004 V1: 153 anodic protection, defined, 2004 V1: 151–152 +ANSI. See American National Standards Institute (ANSI) anthracite coal filters, 1999 V2: 244, 300, 2000 V3: 132, +134 +anthropometrics for wheelchairs, 2004 V1: 109 anti-cross-connection precautions, 1999 V2: 32 anti-siphon ballcocks, 2003 V4: 8 +anti-vortex drains, 2000 V3: 117 anti-vortex grating, 2000 V3: 110 apartment buildings +firefighting demand flow rates, 2000 V3: 232 numbers of fixtures for, 2003 V4: 20, 21 +apparatus dew points (adp, ADP), 2004 V1: 14 appearance functions +defined, 2004 V1: 225 +in value engineering, 2004 V1: 243 appliances. See also fixtures +acoustic ratings, 2004 V1: 194–195, 198 appliance connectors, 1999 V2: 176 codes and standards, 2004 V1: 43–44 defined, 1999 V2: 213 +draft hoods on appliances, 1999 V2: 178, 213 gas regulators, 2000 V3: 251 +gravity vents for gas appliances, 1999 V2: 178 natural gas, 1999 V2: 175, 177–178 +oxygen depletion and gas appliances, 1999 V2: 178 Applied Technology Council (ATC), 2004 V1: 183, 191 approaches to toilet compartments, 2004 V1: 114 approvals +for radioactive materials systems, 1999 V2: 340 for special-waste drainage systems, 1999 V2: 328 +approved, defined, 2004 V1: 18 approved testing agencies, 2004 V1: 18 approximate (approx., APPROX) +approximate values, 2004 V1: 32 defined, 2004 V1: 14 +appurtenances, in plumbing cost estimation, 2004 V1: 93, 97 +aquastats, 2004 V1: 10, 2000 V3: 112, 125 Aqueous Film-Forming Foam (AFFF), 2000 V3: 21 aquifers +defined, 1999 V2: 240 +potentiometric surfaces, 1999 V2: 241 in private water systems, 1999 V2: 239 unconsolidated aquifers, 1999 V2: 241 +arabic numerals, 2004 V1: 32 +arcades, numbers of fixtures for, 2003 V4: 19 +Architect-engineers Turf Sprinkler Manual, 2000 V3: 105 architect’s supplemental instructions (ASI), 2004 V1: 63 Architectural Barriers Act (90-480), 2004 V1: 106 +area (A) +calculating, 2004 V1: 3–5 conversion factors, 2004 V1: 35 + +measurements, 2004 V1: 33 non-SI units, 2004 V1: 34 symbols, 2004 V1: 14 +area alarms, 2000 V3: 49, 72, 81 area drains, 2004 V1: 18 +areas of sprinkler operation, 2000 V3: 16 areaways, 1999 V2: 67, 69 +arenas, numbers of fixtures for, 2003 V4: 19 +ARI (Air Conditioning and Refrigeration Institute), 2004 V1: 46–47, 58 +arm baths, 2000 V3: 32, 35, 38 +Army Corps of Engineers, 2004 V1: 63 +arresters for water hammer. See water hammer arresters arterial vents, 2004 V1: 18, 1999 V2: 52 +articulated-ceiling medical gas systems, 2000 V3: 59 +“as low as reasonably achievable” (ALARA), 1999 V2: 341 ASA A117.1-1961, 2004 V1: 105 +asbestos cement piping, 1999 V2: 122, 2000 V3: 245 asbestos concrete piping, 2003 V4: 26 +ASCE. See American Society of Civil Engineers (ASCE) ASHRAE. See American Society of Heating, Refrigerating +and Air-Conditioning Engineers, Inc. (ASHRAE) ASI (architect’s supplemental instructions), 2004 V1: 63 ASME. See American Society of Mechanical Engineers +(ASME) +ASPE. See American Society of Plumbing Engineers (ASPE) +ASPERF (American Society of Plumbing Engineers Research Foundation), 2004 V1: 18 +aspirating nozzles on foam extinguishers, 2000 V3: 21 aspirators, 2004 V1: 18, 2000 V3: 38 +ASSE. See American Society of Safety Engineers (ASSE); American Society of Sanitary Engineering (ASSE) +assembly costs, 2004 V1: 222 assembly halls +numbers of fixtures for, 2003 V4: 19, 21 single-occupant toilet rooms, 2003 V4: 23 +assisted creativity, 2004 V1: 232 +assisted living facilities, numbers of fixtures for, 2003 V4: 20 +Association for the Advancement of Medical Instrumentation (AAMI), 1999 V2: 279, 317, 319 +ASTM. See American Society for Testing and Materials (ASTM) +ASTM A53 piping, 2000 V3: 254 ASTM A106 piping, 2000 V3: 254 +ASTs (aboveground storage tanks). See aboveground tank systems +ATBCB (U.S. Architectural and Transportation Barriers Compliance Board), 2004 V1: 106, 107 +ATC-3 (Tentative Provisions for the Development of Seismic Regulations for Buildings), 2004 V1: 183, 191 +Atienze, J., 1999 V2: 34 +atm, ATM (atmospheres). See atmospheres atmospheres (atm, ATM) +converting to SI units, 2004 V1: 39 symbols, 2004 V1: 14 +vacuum units, 1999 V2: 254 +atmospheric pressure in vacuum, 1999 V2: 254 atmospheric regulators, 2000 V3: 251 atmospheric tanks +Index + + +defined, 2000 V3: 153 foam, 2000 V3: 21 venting, 2000 V3: 157–158 +atmospheric vacuum breakers (AVB) cross-connection control, 1999 V2: 144 defined, 2004 V1: 18 +faucets, 2003 V4: 14 +hazard levels and, 1999 V2: 145 irrigation sprinklers, 2000 V3: 103, 104 spillage, 1999 V2: 148 +atmospheric vaporizers, 2000 V3: 61 +atmospheric vents (steam or hot vapor) (ATV), 2004 V1: 9 attachments, 2004 V1: 191 +“atto” prefix, 2004 V1: 34 +ATV (atmospheric vents), 2004 V1: 9 Auciello, Eugene P., 1999 V2: 114 +auditoriums, numbers of fixtures for, 2003 V4: 19, 21 authorities having jurisdiction +defined, 2004 V1: 17, 18, 2000 V3: 83 fire hazard evaluations, 2000 V3: 2 +fire-protection system design, 2000 V3: 1 gaseous fire-suppression systems, 2000 V3: 22 manholes, 2000 V3: 234 +medical gas stations, 2000 V3: 56 public sewer availability, 2000 V3: 234 swimming pools, 2000 V3: 127 +automatic air vents (AAV), 2004 V1: 10 automatic alternators, 2000 V3: 70 automatic drain valves, 2000 V3: 103 +automatic drains in vacuum systems, 2000 V3: 70 automatic fill lines makeup-water systems, 2000 V3: 124 automatic fire-detection devices, 2000 V3: 13 +automatic fire-protection systems, 2000 V3: 1–18 history and objectives, 2000 V3: 1–2 +pipes and hangers, 2000 V3: 15 automatic flushometer valves, 2003 V4: 8 automatic heat-up, 2000 V3: 191, 195, 196 automatic overfill prevention, 2000 V3: 167 +automatic overrides for irrigation controllers, 2000 V3: 104 +automatic skimmers, 2000 V3: 146 +Automatic Sprinkler and Standpipe Systems, 2000 V3: 29 automatic sprinkler systems +combined dry-pipe and pre-action, 2000 V3: 15 design density, 2000 V3: 15 +effectiveness statistics, 2000 V3: 2 elevator shafts, 2000 V3: 25 +fire hazard evaluation, 2000 V3: 2–3 fire pumps for, 2000 V3: 25 +gaseous fire-suppression systems and, 2000 V3: 22 history, 2000 V3: 1–2 +hydraulic design, 2000 V3: 15–18 materials, 2000 V3: 12 +numbers of sprinklers in operation, 2000 V3: 16 pipes and hangers, 2000 V3: 12, 15 +pre-action systems, 2000 V3: 13 system design, 2000 V3: 2–18 types, 2004 V1: 29, 2000 V3: 8–15 water supplies, 2000 V3: 3–8 +Automatic Sprinkler Systems Handbook, 2004 V1: 191 automatic storage water heaters, 1999 V2: 160 automatic tank gauging, 2000 V3: 159–160 + +277 + + +automatic trap primers, 1999 V2: 10, 14 automotive traffic, 1999 V2: 11, 223 autopsy rooms +fixtures, 2000 V3: 35, 38 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 51, 58 medical vacuum, 2000 V3: 54 +non-potable water, 2000 V3: 45 AV (acid vents), 2004 V1: 8, 17 +AV (angle valves), 2004 V1: 9, 18 availability. See demand +available vacuum, safety factors and, 1999 V2: 276 AVB. See atmospheric vacuum breakers (AVB) average (avg, AVG), defined, 2004 V1: 14 +average pressure drops in water systems, 1999 V2: 125, 126, 127 +avg, AVG (average), 2004 V1: 14 +AW (acid wastes), 2004 V1: 8, 17, 2000 V3: 42 AWG (American wire gage), 2004 V1: 14 AWS. See American Welding Society (AWS) +AWWA. See American Water Works Association (AWWA) Ayres, J.M., 2004 V1: 191 +az, AZ (azimuth). See azimuth (az, AZ) azimuth (az, AZ) +solar (SAZ), 2004 V1: 14 symbols for, 2004 V1: 14 wall (WAZ), 2004 V1: 14 + +B +B-16.9 standard, 2003 V4: 48 B-16.11 standard, 2003 V4: 48 +B-16.15 Cast Bronze Threaded Fittings, 2003 V4: 27 B-16.24 Cast Copper Alloy Pipe Flanges and Flanged +Fittings, 2003 V4: 27 B-16.28 standard, 2003 V4: 48 B-29 standard, 2003 V4: 49 +B-36.1 standard, 2003 V4: 48 +B-43 Standard Specification for Seamless Red Brass Standard Sizes, 2003 V4: 27 +b/m (bills of material), 2004 V1: 14 back pressure tests, 2003 V4: 5 +back pressures in pipes, 1999 V2: 2, 4, 35, 2000 V3: 251 back-siphonage, 2004 V1: 18, 1999 V2: 144, 145, 2000 V3: +103. See also backflow back-spud water closets, 2003 V4: 3 +back-to-back water closets, 2003 V4: 6–7 back venting, 1999 V2: 43, 47 backfilling +around septic tanks, 1999 V2: 228 +around subsurface drainage pipes, 1999 V2: 102 around water system pipes, 1999 V2: 250 backfill defined, 2004 V1: 18 +building sewers and, 1999 V2: 15 fountain piping systems, 2000 V3: 116 labor productivity rates, 2004 V1: 96 +in plumbing cost estimation, 2004 V1: 93 storage tanks, 2000 V3: 155, 172 +backflow. See also back-siphonage +backflow connections, defined, 2004 V1: 18 defined, 2004 V1: 18 +backflow preventers codes, 2004 V1: 42 +278 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +cold-water pressure losses and, 1999 V2: 125 cold-water systems, 1999 V2: 144–149 +cross-connection control devices, 1999 V2: 144–145 defined, 2004 V1: 18 +domestic water supply, 2000 V3: 221–224 faucets, 2003 V4: 13–14 +fire-protection connections, 2000 V3: 225, 226 fixtures in health-care facilities, 2000 V3: 33 hazard assessment, 1999 V2: 145 +installation, 1999 V2: 148–149 isolating premises, 1999 V2: 145–147 +makeup water in fountains, 2000 V3: 124 pressure loss, 2000 V3: 224 +reduced pressure zones, 2000 V3: 223 roof drains, 1999 V2: 84 +thermal expansion compensation and, 1999 V2: 167 vacuum breakers, 1999 V2: 144, 149, 2000 V3: 33, 45 +background levels of radiation, 1999 V2: 339 backing rings, 2004 V1: 18 +backup, defined, 2004 V1: 18 backup demineralizers, 2000 V3: 46 +backup storm-drainage systems, 1999 V2: 70, 79 backwash from pool filtration, 2000 V3: 112, 113, 137 backwash from water softeners, 1999 V2: 244, 307 backwash pits, 2000 V3: 137, 140, 143 +backwashing +diatomaceous earth filters, 2000 V3: 139 filters, 1999 V2: 300 +in regeneration cycle, 1999 V2: 304–305 sand filters, 2000 V3: 132 +vacuum diatomaceous earth filtration, 2000 V3: 135 backwater valves, 2004 V1: 19, 43, 1999 V2: 12, 13 bacteria +biological fouling, 1999 V2: 289, 316–317 chemical control, 1999 V2: 311–313 demineralizer systems, 2000 V3: 46 distilled water and, 2000 V3: 46 +in drinking water, 1999 V2: 244 in feed water, 1999 V2: 282 +in filters, 1999 V2: 300 in hot water, 2000 V3: 45 +in septic tanks, 1999 V2: 227 +in swimming pools, 2000 V3: 148 +in water-heating systems, 1999 V2: 169 in wells, 1999 V2: 243 +baffle systems, 2000 V3: 46 baffleplates, 2004 V1: 18 +baffles in septic tanks, 1999 V2: 228 bag-filter gross filtration, 1999 V2: 300 +Bahamas, gray-water systems in, 1999 V2: 33 bailers, 2000 V3: 162 +balancing pumps, 2004 V1: 197 +balancing valves (BLV), 2004 V1: 9, 2000 V3: 115 balcony drains, 1999 V2: 69 +ball-and-globe valves, 2000 V3: 118 ball check valves, 2004 V1: 18 +ball joints, bracing and, 2004 V1: 171 ball removal tests, 2003 V4: 5 +ball valves (BV), 2004 V1: 9, 18, 1999 V2: 332, 2000 V3: 72 Ballanco, Julius, 1999 V2: 114 +ballast pads, 2000 V3: 172 ballcocks, 2003 V4: 8 + +Baltimore Dept. of Public Works, 1999 V2: 34 +banned practices in asbestos concrete piping, 2003 V4: 26 banquet halls, numbers of fixtures for, 2003 V4: 19 +bare pipe, 2004 V1:150, 2004 V1: 150 barium, 1999 V2: 281 +baro, BARO (barometric), 2004 V1: 14 +baro pr, BARO PR (barometric pressure). See barometric pressure +barometers (baro, BARO) symbols for, 2004 V1: 14 vacuums and, 1999 V2: 254 +barometric (baro, BARO), defined, 2004 V1: 14 barometric loops, 1999 V2: 144 +barometric pressure (baro pr, BARO PR, BP), 2000 V3: 200 +altitude adjustments, 1999 V2: 257 barometric, defined, 2004 V1: 14 barometric pressure, defined, 2004 V1: 15 in vacuums, 1999 V2: 254, 275 +barrels +converting to SI units, 2004 V1: 39 dimensions, 2003 V4: 29–31 +barrier free, 2004 V1: 18. See also people with disabilities barriers +around tanks, 2000 V3: 169 +in sound insulation, 2004 V1: 193 bars, converting to SI units, 2004 V1: 39 bars, numbers of fixtures for, 2003 V4: 19 base acquisition costs, 2004 V1: 223 +base materials +base defined, 2004 V1: 18 compounds in water, 1999 V2: 280 pH control, 2000 V3: 91–92 +base units, 2004 V1: 33 +basic functions in value engineering, 2004 V1: 225, 227, 230 +basic material standards, 2004 V1: 66 +Basic Plumbing Code (BOCA), 2000 V3: 154 basket strainers +fountain pumps, 2000 V3: 116 head loss and, 2000 V3: 115 maintenance, 2000 V3: 110 materials, 2000 V3: 146 +pre-manufactured skimmers, 2000 V3: 137 pumps, 2000 V3: 115 +swimming pool pumps, 2000 V3: 140 bathhouses, 1999 V2: 235, 2000 V3: 129, 130 bathing rooms, 2004 V1: 112–113 +bathroom groups, 1999 V2: 43, 62, 63, 2000 V3: 217 bathtub fill valves, 2003 V4: 16 +bathtubs +accessibility design, 2004 V1: 117–119 acoustic ratings of, 2004 V1: 194 bathtub enclosures, 2004 V1: 118–119 estimated water flows from, 1999 V2: 25 fixture-unit loads, 1999 V2: 3 +grab bars, 2004 V1: 116, 117 +gray-water systems and, 2004 V1: 135, 1999 V2: 22 health-care facilities, 2000 V3: 32 +infant bathtubs, 2000 V3: 34 minimum numbers of, 2003 V4: 18–22 overflows, 2003 V4: 16 +Index + + +patient rooms, 2000 V3: 34 +resilient-mounting design, 2004 V1: 206 seats, 2004 V1: 122 +sound-damping materials, 2004 V1: 196 standards, 2003 V4: 2 +temperatures, 2000 V3: 45 +types and requirements, 2003 V4: 16 water fixture unit values, 2000 V3: 217 +batteries +corrosion cells in sacrificial anodes, 2004 V1: 148 of fixtures, 2004 V1: 18, 1999 V2: 64 +battery-controlled valves, 2004 V1: 135 Baumeister, Theodore, 2004 V1: 1, 2, 3, 5, 40 +BCMC (Board for Coordination of Model Codes), 2004 V1: 106 +BCuP brazing, 2003 V4: 45 +beach components in pools, 2000 V3: 128 bead-to-bead joints, 2003 V4: 47 +bead-to-cut-glass end joints, 2003 V4: 47 beam clamps, 2004 V1: 190 +Beausoliel, R.W., 1999 V2: 65 bed locator units, 2000 V3: 57 bedding and settlement +around septic tanks, 1999 V2: 228 building sewers and, 1999 V2: 15 defined, 2000 V3: 234 +illustrated, 2000 V3: 235 +pipe supports and, 1999 V2: 14 +protecting against settlement, 1999 V2: 19 settlement loads, 2004 V1: 186 +subsurface drainage pipes, 1999 V2: 102 water system piping, 1999 V2: 250, 251 +bedpan washers, 2000 V3: 32, 34, 36, 38 +bell-and-spigot joints and piping. See also hub-and-spigot piping and joints +defined, 2004 V1: 18 +earthquake protection and, 2004 V1: 167 underground, 1999 V2: 88 +bell holes, 1999 V2: 88 +bell hub depressions, 1999 V2: 15 bells, defined, 2004 V1: 18 +below-slab drainage, 1999 V2: 103 +bend-and-loop pipe configurations, 2004 V1: 199 bending movements, conversion factors, 2004 V1: 35 +benefits in value engineering presentations, 2004 V1: 258 Bennett, E.R., 1999 V2: 238 +bentonite clay, 1999 V2: 302 bentonite grout, 1999 V2: 243 Bernoulli’s equation, 2004 V1: 5–6 beta ray radiation, 1999 V2: 337 +beverage-processing plants, 1999 V2: 147 +BFP (backflow preventers). See backflow preventers BFV (butterfly valves), 2004 V1: 9, 20 +bhp, BHP (brake horsepower), 2004 V1: 6, 14 bicarbonates, 1999 V2: 281, 282, 290, 295 +bid bonds, 2004 V1: 62 +bid by invitation, 2004 V1: 62 bid shopping, 2004 V1: 68 bidders +defined, 2004 V1: 61 +information in project manuals, 2004 V1: 61 bidding documents, 2004 V1: 61 + +279 + + +bidding requirements, 2004 V1: 61 Biddison, 2004 V1: 191 +bidets, 2000 V3: 217, 2003 V4: 2, 16–17 bills of material (b/m, BOM), 2004 V1: 14 bimetallic traps, 2000 V3: 182 +binding, preventing in cleanouts, 1999 V2: 9 biochemical measurements of microorganisms, 1999 V2: +282 +biocides, 1999 V2: 311, 316, 317, 323 biodegradable foam extinguishers, 2000 V3: 21 biofouling, 1999 V2: 289, 316 +biohazardous materials. See infectious and biological waste systems +biological and biomedical laboratories. See laboratories biological characteristics of drinking water, 1999 V2: 316, +318 +biological control in pure water systems, 1999 V2: 323. See also microbial growth and control +biological fouling, 1999 V2: 289, 316 +biological oxygen demand (BOD), 2000 V3: 21, 93 biological treatment +in gray-water treatment, 1999 V2: 27 of oil spills, 1999 V2: 347 +of sewage in septic tanks, 1999 V2: 227 wastewater treatment plants, 2000 V3: 93 +biological waste systems. See infectious and biological waste systems +bio-pure water, 2000 V3: 46 biosafety cabinets, 1999 V2: 344 +biosafety levels (BL1-BL4), 1999 V2: 343–344 biostats, 1999 V2: 311, 317 +birthing rooms, 2000 V3: 36, 52, 58 bitumastic-enamel-lined piping, 1999 V2: 122 bituminized felt, 2004 V1: 196 +bituminous pipe joint compound, 1999 V2: 223 BL1-4 levels, 1999 V2: 343–344 +black iron coated pipe, 2003 V4: 48 black pipes, 2004 V1: 18 +black steel piping, 1999 V2: 68, 176, 196, 197–211, 2000 V3: 165, 254 +black-water systems +amount of generated black water, 1999 V2: 23 compared to gray water, 1999 V2: 21, 23 estimating sewage quantities, 1999 V2: 233–238 +bladder bags, 2004 V1: 116 bladder tanks, 2000 V3: 21 blades in pumps, 2004 V1: 197 Blake, Richard T., 1999 V2: 325 blank flanges, 2004 V1: 18 blast gates, 1999 V2: 268 +bleachers, numbers of fixtures for, 2003 V4: 19 bleaches, 1999 V2: 230 +bleed cocks, 2000 V3: 4 block-like soils, 1999 V2: 218 +block-method irrigation, 2000 V3: 100 blocking creativity, 2004 V1: 231–232 blocking water system pipes, 1999 V2: 250 blood analyzers, 1999 V2: 14 +blood or other objectionable materials, 1999 V2: 16. See also infectious and biological waste systems +blood-type floor drains, 2000 V3: 35 +blow-backs, reduced-size venting and, 1999 V2: 49 +280 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +blow-off in air compressors, 2000 V3: 205 blowdown +boiler blowdown, 1999 V2: 314, 315 cooling towers, 1999 V2: 316 removing sludge, 1999 V2: 289 steam traps, 2000 V3: 195 +blowout fixtures, acoustic design and, 2004 V1: 195 blowout urinals, 2003 V4: 8–9, 9 +blowout water closets, 2003 V4: 3 +blue dyes in gray water, 1999 V2: 22, 33 blue water in pools, 2000 V3: 148 +BLV (balancing valves), 2004 V1: 9, 2000 V3: 115 +Board for Coordination of Model Codes (BCMC), 2004 V1: 106 +boarding houses, numbers of fixtures for, 2003 V4: 20 bobbin-wound fiberglass filters, 2000 V3: 131 +BOCA. See Building Officials and Code Administrators International, Inc. (BOCA) +BOD (biological oxygen demand), 2000 V3: 21, 93 body sprays, 2003 V4: 16 +Boegly, W.J., 1999 V2: 238 +Boiler and Pressure Vessel Code, 2000 V3: 95 boiler blow-off tanks, 2004 V1: 18 +boiler blow-offs, 2004 V1: 18 boiler feed lines, 2003 V4: 34 +boiler room earthquake protection, 2004 V1: 166 Boiler Water Treatment, 1999 V2: 325 +boilers +cast-iron supports for, 2004 V1: 162 codes and standards, 2004 V1: 42 condensation, 2004 V1: 267 earthquake protection, 2004 V1: 163 feed lines, 2003 V4: 34 +feed pumps, 2000 V3: 188–189 feed receivers, 2000 V3: 188 +feed water corrosion inhibitors, 2004 V1: 151 feed water treatments, 1999 V2: 314–315 +gas train arrangements, 2000 V3: 251 natural gas systems and, 1999 V2: 174 scaling, 1999 V2: 289 +sediment buckets in drains, 1999 V2: 12 short cycling, 2000 V3: 180 +steam heating systems, 2000 V3: 178 swimming pool heaters, 2000 V3: 138 +boiling points (bp, BP) defined, 1999 V2: 213 liquid fuels, 2000 V3: 153 liquid oxygen, 2000 V3: 61 symbols for, 2004 V1: 14 +bollards, 2000 V3: 169, 172 +bolting problems in seismic protection, 2004 V1: 190 bolts for water closets, 2003 V4: 6 +BOM (bills of material), 2004 V1: 14 bonded joints, 2004 V1:150 +bonds and certificates, 2004 V1: 62 bonnets, 2004 V1: 18 +booster-pump systems connections, 2000 V3: 225 +constant pressure and, 1999 V2: 152 constant use and, 1999 V2: 121 domestic water service, 2000 V3: 216 fire-protection systems, 2000 V3: 8 + +in health-care facilities, 2000 V3: 44 low-pressure fire pumps, 2000 V3: 25 noise control, 2004 V1: 199 +booster water heaters, 2004 V1: 126, 129, 1999 V2: 160 boosting water pressure, 1999 V2: 149–152 +borate, 1999 V2: 282 +bore holes for wells, 1999 V2: 240 bored wells, 1999 V2: 241 borings +subsurface site drainage, 1999 V2: 100 wells, 1999 V2: 240 +borosilicate glass piping, 1999 V2: 14, 15, 122, 2000 V3: 40, 2003 V4: 47 +Bosich, Joseph F., 2004 V1: 154 bottled gas, 1999 V2: 174 bottled water, 2003 V4: 14 +Bottom Loading and Vapor Recovery for MC-306 Tank Motor Vehicles (AOIRP 1004), 2000 V3: 173 +Bourdon gauges, 1999 V2: 260 bowl depth of sinks, 2004 V1: 117 Boyle, W.C., 1999 V2: 34 +BP (barometric pressure). See barometric pressure bp, BP (boiling points). See boiling points (bp, BP) braces (walking aids), 2004 V1: 107 +bracing +aircraft cable method, 2004 V1: 171 +alternate attachments for pipes, 2004 V1: 174 avoiding potential earthquake problems, 2004 V1: 189 defined, 2004 V1: 191 +hanger rod connections, 2004 V1: 177 hanger rods, 2004 V1: 166 +hubless cast-iron pipe, 2004 V1: 177 lateral sway bracing, 2004 V1: 181–182 +longitudinal and transverse bracing, 2004 V1: 180 longitudinal-only bracing, 2004 V1: 172, 180 +open-web steel joists, 2004 V1: 176 pipes on trapeze and, 2004 V1: 175, 178 +piping systems for seismic protection, 2004 V1: 166– 182 +riser bracing for hubless pipes, 2004 V1: 178 self bracing, 2004 V1: 190 +spacing of, 2004 V1: 184 +steel beam connections, 2004 V1: 175 structural angle bracing, 2004 V1: 171 structural channel bracing, 2004 V1: 171 strut bracing, 2004 V1: 173, 175 superstrut, 2004 V1: 170 +sway bracing, 2004 V1: 179, 180, 181–182, 185–186, 187 +Tension 360 bracing, 2004 V1: 169 transverse bracing, 2004 V1: 171, 179 truss-type actions, 2004 V1: 190 +typical earthquake bracing, 2004 V1: 168 brainstorming in creativity, 2004 V1: 232 brake horsepower (bhp, BHP) +fire pumps, 2000 V3: 25 pumps, 2004 V1: 6 symbols for, 2004 V1: 14 +branch-bottom connections, 2004 V1: 11 branch intervals, 2004 V1: 18, 1999 V2: 64 branch lines, 2000 V3: 85 +branch sewers (submain sewers), 2004 V1: 30 +Index + + +branch tees, 2004 V1: 18 +branch-top connections, 2004 V1: 11 branch vents, 2004 V1: 18 +branches, defined, 2004 V1: 18 +brand names in specifications, 2004 V1: 66, 67 brass +dezincification, 2004 V1: 141 +in electromotive force series, 2004 V1: 144 in galvanic series, 2004 V1: 141 +brass (copper alloy) pipe, 1999 V2: 14, 2003 V4: 27 brass fittings, 1999 V2: 196 +brass floor drains, 1999 V2: 15, 16 +brass pipes, 1999 V2: 68, 122, 176, 196, 2000 V3: 116 brass pool lighting, 2000 V3: 145 +brazed joints +earthquake protection and, 2004 V1: 167 inspection, 2000 V3: 80 +medical gas tubing, 2000 V3: 77, 2003 V4: 45 brazing alloys on gas piping, 1999 V2: 196 brazing ends, 2004 V1: 18 +Brazing Joints for Copper and Copper Alloy Pressure Fittings, 2003 V4: 45 +break points (chlorination), 2000 V3: 149 breakdown chlorination, 2000 V3: 149 breathing apparatus +chlorine gas, 2000 V3: 148 diatomaceous earth and, 2000 V3: 134 for emergencies, 1999 V2: 332, 333 +brick dome covers on seepage pits, 1999 V2: 225 brines +hydrostatic monitoring systems, 2000 V3: 160 refrigerants, 2004 V1: 151 +in water softening, 1999 V2: 307 British thermal units (Btu, BTU) +British thermal units per hour (Btu/h), 2004 V1: 18, 2000 V3: 122 +Btu (J) (fire loads), 2000 V3: 3 +calculating hot water savings, 2004 V1: 127 converting to SI units, 2004 V1: 39 +defined, 2004 V1: 18, 136, 1999 V2: 213 natural gas services, 2000 V3: 249 symbols for, 2004 V1: 14 +bromine, 2000 V3: 123, 149 +bromtrifluoro-methane CBrF3 (halon 1301), 2004 V1: 25 bronze filtration tanks, 2000 V3: 131 +Bronze Fittings for Brazed Joints, 2003 V4: 27, 34 bronze floor drains, 1999 V2: 15 +bronze-mounted, defined, 2004 V1: 18 bronze pumps, 2000 V3: 115, 145 bronze sediment buckets, 1999 V2: 14 bronze trim, 2004 V1: 18 +bronze valves, 2000 V3: 145 +bronze, in electromotive force series, 2004 V1: 141 Brown & Sharpe wire gage (B&S), 2004 V1: 14 Brown, F.R., 2004 V1: 191 +Brown, J., 1999 V2: 325 brown water, 2000 V3: 147 Brownstein, E., 1999 V2: 65 +brushes for swimming pool cleaning, 2000 V3: 146 Bryan, John L., 2000 V3: 29 +B&S (Brown & Sharpe wire gage), 2004 V1: 14 + +281 + + +Btu, BTU (British Thermal units). See British Thermal units +Btu/h (British thermal units per hour), 2004 V1: 18, 2000 V3: 122 +Btu (J) (fire loads), 2000 V3: 3 bubble aerators, 1999 V2: 293 +bubbler irrigation heads, 2000 V3: 103 +bubbles, 1999 V2: 38, 2000 V3: 21. See also detergents; soaps; suds +buffing finishes on grates, 1999 V2: 11 building code list of agencies, 2004 V1: 42 +Building Code Requirements for Minimum Design Loads in Buildings and Other Structures, 2004 V1: 191 +building drains combined, 2004 V1: 19 +cross-sections of, 1999 V2: 2 defined, 2004 V1: 19, 1999 V2: 64 flow in, 1999 V2: 2 +inspection checklist, 2004 V1: 102–103 installation, 1999 V2: 15 +pneumatic pressure in, 1999 V2: 2 sanitary. See sanitary drainage systems sovent system connections, 1999 V2: 60–61 storm. See storm-drainage systems +building inspectors, 2000 V3: 2 +Building Officials and Code Administrators International, Inc. (BOCA), 1999 V2: 114, 2000 V3: 154 +BOCA Basic Plumbing Code, 1999 V2: 114, 2000 V3: 154 +building sewers (house drains), 2004 V1: 19, 1999 V2: 15 building sites. See site utilities; sites +building storm-sewer pipe codes, 2004 V1: 42 building subdrains, 2004 V1: 19 +Building Systems Design, 1999 V2: 277 building traps, 2004 V1: 19 +buildings +acceptable plumbing noise levels, 2004 V1: 193 building material acoustic insulation, 2004 V1: 193 construction and fire hazards, 2000 V3: 2 +defined, 2004 V1: 18 +essential facilities, 2004 V1: 191 expansion, 2000 V3: 49 +isolating premises with backflow hazards, 1999 V2: 145–147 +minimum numbers of fixtures, 2003 V4: 18–22 standard fire tests, 2000 V3: 3 +storm-drainage systems. See storm-drainage systems subdrains, 2004 V1: 19 +traps, 2004 V1: 19 +type of structure and earthquake protection, 2004 V1: 167 +utilities. See site utilities +built-in continuous pool gutters, 2000 V3: 137 built-in showers, 2003 V4: 15 +bulk media tests, 2003 V4: 6 +bulk oxygen systems, 2000 V3: 59, 61–62, 63 bulkhead fittings, 2000 V3: 163 +bull head tees, 2004 V1: 20 bumpers, 2000 V3: 228, 229 +Buna-N (nitrile butadiene), 2000 V3: 169 Bunsen burners, 1999 V2: 176 +buried piping. See underground piping +282 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +burners, defined, 1999 V2: 213 burning methane, 2004 V1: 130–131 +burning rates of plastic pipe, 2003 V4: 59–60 burst pressure, 2004 V1: 20 +Burton, Franklin L., 2000 V3: 125 +bushels, converting to SI units, 2004 V1: 39 bushings, 2004 V1: 20 +businesses, numbers of fixtures for, 2003 V4: 19 +butane, 1999 V2: 194, 213. See also fuel-gas piping systems butt caps on fire hydrants, 2000 V3: 4 +butt-welded standard weight pipe, 2003 V4: 48 butt welding +butt-weld end connections, 2004 V1: 23 butt weld joints, 2004 V1: 20 +butt weld pipes, 2004 V1: 20 +radioactive drainage systems, 1999 V2: 341 butterfly valves (BFV), 2004 V1: 9, 20, 2000 V3: 118 BV (ball valves), 2004 V1: 9, 18, 1999 V2: 332 bypass systems for pools, 2000 V3: 122, 144 +bypass valves, 2004 V1: 20, 2003 V4: 18 bypasses, 2004 V1: 20 + +C +C, °C (celsius), 2004 V1: 14, 34 c (centi) prefix, 2004 V1: 34 +C (conductance), 2004 V1: 14, 33 C (coulombs), 2004 V1: 33, 139 +c (curies), 1999 V2: 339 +C (specific heat). See specific heat +c to c, C TO C (center to center), 2004 V1: 14 C-4 standard, 2003 V4: 49 +C-12 standard, 2003 V4: 49 C-296 standard, 2003 V4: 26 C-301 standard, 2003 V4: 49 C-400 standard, 2003 V4: 26 C-425 standard, 2003 V4: 49 C-428 standard, 2003 V4: 26 +C-599-77 standard, 2003 V4: 48 C-700 standard, 2003 V4: 49 +C-828 standard, 2003 V4: 49 C-896 standard, 2003 V4: 49 +C/m3 (coulombs per cubic meter), 2004 V1: 33 CAAA (Clean Air Act Amendments), 2000 V3: 154 cables, earthquake protection and, 2004 V1: 166 +CABO (Council of American Building Officials), 2004 V1: 123 +cadmium, 2004 V1: 141 +calcification in filters, 2000 V3: 132, 150 calcium +defined, 1999 V2: 283 +scale formation and corrosion, 1999 V2: 290 in water, 1999 V2: 244, 281 +calcium 45, 1999 V2: 340 +calcium bicarbonate, 1999 V2: 281 +calcium carbonate (lime), 1999 V2: 281, 283, 285, 291, 2000 V3: 147 +calcium chloride, 1999 V2: 283 calcium hydroxide, 1999 V2: 283 +calcium hypochlorite, 1999 V2: 245, 2000 V3: 148–149, 149, 150–151 +calcium phosphate, 1999 V2: 283 +Calcium Saturation Index (CSI), 2000 V3: 123 + +calcium silicates, 1999 V2: 283 calcium sulfate, 1999 V2: 281 calculations. See equations +calendars for irrigation controllers, 2000 V3: 104 California Administrative Code of Regulations, 2004 V1: +183 +California Code of Regulations, 2004 V1: 191 California Plumbing Code, 1999 V2: 34 calories +caloric values of natural gas, 1999 V2: 173, 212, 214 converting to SI units, 2004 V1: 39 +calorific values in fire loads, 2000 V3: 2–3 Cameron’s Hydraulic Data, 2000 V3: 221 +camps, septic tank systems for, 1999 V2: 231–232 CAN/CSA-B137.1 standard, 2003 V4: 61 CAN/CSA-B137.2 standard, 2003 V4: 62 CAN/CSA-B137.3 standard, 2003 V4: 62 CAN/CSA-B137.9 standard, 2003 V4: 62 CAN/CSA-B137.10 standard, 2003 V4: 62 +can pumps, 2004 V1: 24 +CAN3-B137.8 standard, 2003 V4: 58 Canadian Standards Association (CSA) +address, 2004 V1: 58, 2000 V3: 86 consensus process, 2004 V1: 41 list of standards, 2004 V1: 53–54 +medical compressed air standards, 2000 V3: 67 publications +CAN/CSA-B137.1 standard, 2003 V4: 61 CAN/CSA-B137.2 standard, 2003 V4: 62 CAN/CSA-B137.3 standard, 2003 V4: 62 CAN/CSA-B137.9 standard, 2003 V4: 62 CAN/CSA-B137.10 standard, 2003 V4: 62 CAN3-B137.8 standard, 2003 V4: 58 +CSA Z-305.1: Non-flammable Medical Gas Piping Systems, 2000 V3: 86 +water closet standards, 2003 V4: 6 candelas (cd), 2004 V1: 33 +candelas per meter squared (cd/m2), 2004 V1: 33 cantilevered drinking fountains, 2004 V1: 112 +CAP (College of American Pathologists), 1999 V2: 279, 317, 319 +capacitance +measurements, 2004 V1: 33 tank gauging, 2000 V3: 160 +capacity (flow). See flow rates +capacity of swimming pools, 2000 V3: 127–128 capillaries, 2004 V1: 20 +caps on ends of pipes, 2004 V1: 11 +capture-type vacuum pumps, 1999 V2: 259 car traffic, 1999 V2: 11, 223 +car washes +gray-water use, 2004 V1: 267 +heat recovery systems, 2004 V1: 266 car-washing facilities, 1999 V2: 147 carbohydrazide, 1999 V2: 315 +carbon +adsorption of oil spills, 1999 V2: 347 corrosion, 2004 V1: 139, 145 +total organic carbon, 1999 V2: 288 in water, 1999 V2: 281 +carbon 14, 1999 V2: 340 carbon dioxide (CO2) +Index + + +color coding, 2000 V3: 56 decarbonation, 1999 V2: 295 extinguishing systems, 2000 V3: 20–21 medical gas system tests, 2000 V3: 83 portable fire extinguishers, 2000 V3: 27 in steam systems, 2000 V3: 190 symbols for, 2004 V1: 9 +in water, 1999 V2: 281, 284, 294 +Carbon Dioxide Extinguishing Systems (NFPA 12), 2000 V3: 20, 29 +carbon filtration (absorphan). See activated carbon filtration (absorphan) +carbon monoxide, 2000 V3: 83 +carbon steel, 2004 V1: 144, 2000 V3: 91, 92, 116, 210 carbon steel casings, 1999 V2: 179 +carbonate films, 2004 V1: 151 +carbonates, 1999 V2: 281, 282, 283, 290, 2000 V3: 147 carbonic acid, 1999 V2: 281 +carpets, vacuum calculations for, 1999 V2: 269 +cartridge filtration, 1999 V2: 300, 305–306, 312, 323, 2000 V3: 112, 113 +Cartwright, Peter, 1999 V2: 325 +cascade waterfall aerators, 1999 V2: 293 casings +driven wells, 1999 V2: 241 gas boosters, 1999 V2: 179 jetted wells, 1999 V2: 241 well casings, 1999 V2: 240 +Cassidy, Victor M., 2004 V1: 137 +cast-aluminum floor drains, 1999 V2: 15 cast bronze solder-joint fittings, 2003 V4: 38 cast bronze threaded fittings, 2003 V4: 27 +Cast Bronze Threaded Fittings, 2003 V4: 27, 34 +Cast Copper Alloy Fittings for Flared Copper Tube, 2003 V4: 37 +Cast Copper Alloy Pipe Flanges and Flanged Fittings, 2003 V4: 27, 34, 37 +Cast Copper Alloy Solder-Joint Drainage Fittings, 2003 V4: 45 +cast-filled acrylic fixtures, 2003 V4: 2 cast-filled fiberglass fixtures, 2003 V4: 2 cast glands, 2000 V3: 229 +cast-in-place anchor bolts, 2004 V1: 163 cast iron +in electromotive series, 2004 V1: 144 fountain pumps, 2000 V3: 115 +in galvanic series, 2004 V1: 141 graphitization, 2004 V1: 141 radiators, 2000 V3: 179, 180 +swimming pool main drains, 2000 V3: 143 cast-iron boiler supports, 2004 V1: 162 +cast-iron fittings, 1999 V2: 196 cast-iron fixtures +enameled, 2003 V4: 1–2 +in health-care facilities, 2000 V3: 33 standards, 2003 V4: 2 +cast-iron floor drains, 1999 V2: 16, 17 cast-iron piping +blocking, 1999 V2: 250 bracing, 2004 V1: 177 corrosion and, 2004 V1: 150 laboratories, 2000 V3: 40 + +283 + + +liquefied petroleum gas, 1999 V2: 196 Manning formula and, 2000 V3: 245 natural gas, 2000 V3: 254 +radioactive materials systems and, 1999 V2: 341 roughness, 1999 V2: 122 +sanitary drainage systems, 1999 V2: 14 storm-drainage systems, 1999 V2: 89–92 tree roots and, 1999 V2: 223 underground piping, 1999 V2: 68 +cast-iron soil pipe +dimensions of hubs, spigots and barrels, 2003 V4: 29–31 +telescoping and laying lengths, 2003 V4: 28 types, 2003 V4: 27–31 +Cast-iron Soil Pipe and Fittings Engineering Manual, 1999 V2: 114 +Cast Iron Soil Pipe Institute (CISPI), 2004 V1: 20, 53, 58, 1999 V2: 114 +CISPI 301 standard, 2003 V4: 28 CISPI 310 standard, 2003 V4: 28 +cast-iron tank legs, 2004 V1: 163 catch basins, 2000 V3: 157 +piping size, 1999 V2: 69 +in site storm systems, 1999 V2: 98 +Category II, III, or IV vent systems, 2004 V1: 43 cathodes +defined, 2004 V1: 139, 152 +galvanic series of metals, 2004 V1: 141 cathodic corrosion, 2004 V1: 152 +cathodic inhibitors, 2004 V1: 151 +cathodic potential (electropositive potential), 2004 V1: 153 cathodic protection +criteria, 2004 V1: 150–151 defined, 2004 V1: 20, 152 introduction, 2004 V1: 139 liquid fuel tanks, 2000 V3: 155 methods, 2004 V1: 147–151 +sand filtration tanks, 2000 V3: 131 cathodic, defined, 2004 V1: 152 cations +cation resins, 1999 V2: 284, 305 defined, 2004 V1: 152, 1999 V2: 280 +in ion exchange, 1999 V2: 300, 301, 302 in pH values, 1999 V2: 329 +caulking +caulked joints on floor drains, 1999 V2: 16 defined, 2004 V1: 20 +causes and effects +in creativity checklist, 2004 V1: 234 of earthquakes, 2004 V1: 156–158 +caustic embrittlement, 2004 V1: 152 +caustic soda, 1999 V2: 333, 337, 2000 V3: 93 +caustic waste from regeneration cycle, 1999 V2: 304 cavitation +anti-vortex drains, 2000 V3: 117 cavitation corrosion, 2004 V1: 152 defined, 2004 V1: 20, 152 +flexible pipe connectors and, 2004 V1: 200 fountain pumps, 2000 V3: 108 modifications to pump plants, 2004 V1: 197 pressure levels and, 2004 V1: 200 +reducing noise source strength, 2004 V1: 199 +284 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +water level in pools and, 2000 V3: 112 cavitation corrosion, 2004 V1: 152 +CCS (Certified Construction Specifier), 2004 V1: 72 ccw, CCW (counterclockwise), 2004 V1: 14 +CD. See construction contract documents (CD) cd (candelas), 2004 V1: 33 +CD (condensate drains), 2004 V1: 8, 1999 V2: 13 cd/m2, 2004 V1: 33 +CDA (Copper Development Association), 2004 V1: 20 CDI (continuous deionization), 1999 V2: 306–307 ceiling-mounted medical gas systems, 2000 V3: 57–59, +58–59 +ceiling-with-gas-stacks systems, 2000 V3: 58 ceilings, piping in, 2004 V1: 195, 201 +cell pairs, 1999 V2: 306 cells, defined, 2004 V1: 152 +cellulose acetate membranes, 1999 V2: 310, 311 cellulose gas filters, 2000 V3: 250 +cellulose tricetate membranes, 1999 V2: 310, 311 celsius (°C), 2004 V1: 14 +cement grout, 1999 V2: 243 cement joints, 2004 V1: 20 cement-lined piping +Manning formula and, 2000 V3: 245 roughness, 1999 V2: 122 +in sprinkler hydraulic calculations, 2000 V3: 17 water pipes, 2003 V4: 32 +Cement Mortar Lining, 2003 V4: 32 cement plaster joints, 2003 V4: 32 +center to center (c to c, C TO C), 2004 V1: 14 centerline spacing of gas outlets, 2000 V3: 56 centersets for faucets, 2003 V4: 10 +“centi” prefix, 2004 V1: 34 +Centigrade conversion factors, 2004 V1: 38 centipoise, 2004 V1: 39, 2000 V3: 154 +central chilled drinking water systems, 2004 V1: 265 central heating boilers, 2000 V3: 138 +central-supply rooms, 2000 V3: 46 +central-water purification equipment, 1999 V2: 323–325 centrally-located vacuum cleaning systems. See vacuum +cleaning systems +centrifugal air compressors, 2000 V3: 65, 202, 205 centrifugal drum traps, 2000 V3: 42 +centrifugal pumps +acid wastes and, 1999 V2: 332 defined, 2004 V1: 24 fountains, 2000 V3: 115 +shallow well discharge, 1999 V2: 247 vacuum pumps, 1999 V2: 259 +centrifugal separators +centrifugal-type vacuum separators, 1999 V2: 268 for oil spills, 1999 V2: 348 +centrifugal vacuum cleaning systems, 1999 V2: 276 centrifugation of oil, 1999 V2: 347 +ceramic fixtures standards, 2003 V4: 2 types of, 2003 V4: 1–2 +ceramic wool, 2004 V1: 193 +CERCLA (Comprehensive Environmental Response Compensation and Liability Act), 2000 V3:88, 2000 V3: 89–90 +certificates of insurance, 2004 V1: 62 + +certification +certification of performance, 1999 V2: 155 LEED program, 2004 V1: 263–264 medical gas systems, 2000 V3: 77–83 medical gas zones, 2000 V3: 72 +storage tanks, 2000 V3: 171 +Certified Construction Specifier (CCS), 2004 V1: 72 Certified Plumbing Designer (CPD), 2004 V1: 72 cesspools +defined, 2004 V1: 20 +irrigation systems and, 1999 V2: 27 CF (contact factors), 2004 V1: 14 +CFAC, CFACT (correction factors), 2004 V1: 14 CFCs (chlorofluorocarbons), 2000 V3: 22 +cfh (cubic feet per hour), 2000 V3: 200, 248 +cfm (cubic feet per minute). See cubic feet per minute CFR (Code of Federal Regulations), 2000 V3:88 +CFT (cubic feet), 2004 V1: 14 +cfus (colony forming units), 1999 V2: 282 CGA. See Compressed Gas Association, Inc. +cGMP (current good manufacturing practices), 1999 V2: 325, 328 +CGPM (General Conference of Weights and Measures), 2004 V1: 32 +chainwheel-operated valves, 2004 V1: 20 chambers (air chambers). See air chambers (AC) Chan, Wen-Yung W., 2004 V1: 40 +change orders, 2004 V1: 63 changed standpipes, 2004 V1: 13 channels, 2004 V1: 20 +character in creativity checklist, 2004 V1: 234 Characteristics and Safe Handling of Medical Gases (CGA +P-2), 2000 V3: 86 +Characteristics of Rural Household Waste Water, 1999 V2: 34 +chart recorders, 2000 V3: 142 chases, 2004 V1: 20 +check valves (CV) +aluminum check valves, 1999 V2: 177 defined, 2004 V1: 20 +dry-pipe systems, 2000 V3: 11 fountains, 2000 V3: 118–119 irrigation systems, 2000 V3: 103 multilevel pools, 2000 V3: 108 swimming pool pumps, 2000 V3: 142 symbols for, 2004 V1: 9 +thermal expansion compensation and, 1999 V2: 167 vacuum systems, 1999 V2: 262, 268 +with vent ports, 1999 V2: 145, 149 checklists and forms +creativity worksheets, 2004 V1: 233–234, 236 designs and drawings, 2004 V1: 100–102 detail/product/material specification checklist, 2004 +V1: 220 +evaluation checklists, 2004 V1: 237–238 field checklists, 2004 V1: 102–103 +final checklist, 2004 V1: 103 forms of agreement, 2004 V1: 62 fuel systems, 2000 V3: 171 +function definitions, 2004 V1: 225–227 +functional evaluation worksheets, 2004 V1: 243–251 general checklists for jobs, 2004 V1: 99 +Index + + +health-care facility medical gas and vacuum systems, 2000 V3: 49–50 +idea development and estimated cost forms, 2004 V1: 241–242 +idea evaluation worksheet, 2004 V1: 243, 253 project information checklists, 2004 V1: 215–220 project information sources checklists, 2004 V1: 221 recommendations worksheets, 2004 V1: 258, 259 storage tanks, 2000 V3: 173 +storm-drainage calculations, 1999 V2: 109–113 using in presentations, 2004 V1: 257 +value engineering checklists, 2004 V1: 214 chemical cleaning connections, 2000 V3: 47 +chemical feed pumps for pools, 2000 V3: 148, 150–151 chemical filtration, 2000 V3: 112 +Chemical Plant and Petroleum Refinery Piping (ANSI B3.13), 2000 V3: 95 +chemical plants, 1999 V2: 147, 2000 V3:87 chemical pretreatment of oils, 2000 V3: 93 +chemical regeneration in demineralizers, 2000 V3: 46 chemical-resistance testing, 2003 V4: 2 +chemical spill emergency fixtures, 2003 V4: 17 chemical-waste drains +glass pipe, 2003 V4: 47 plastic pipes, 2003 V4: 58 +chemical-waste systems +codes and standards, 1999 V2: 345 defined, 2004 V1: 20 +design considerations, 1999 V2: 346 +pipe and joint selection, 1999 V2: 345–346 chemically-stabilized emulsions, 1999 V2: 347 chemicals +analysis of swimming pool water, 2000 V3: 131 chemical characteristics of drinking water, 1999 V2: +316, 318 +chemical control of microbes in water, 1999 V2: 311 chemical treatment of oil spills, 1999 V2: 347, 348 emulsions, 2000 V3: 93 +feed pumps for pools, 2000 V3: 148, 150–151 filtration, 2000 V3: 112 +laboratory vacuum systems, 1999 V2: 262 material safety data sheets, 2000 V3: 90 in septic tanks, 1999 V2: 230–231 +in special-waste effluent, 1999 V2: 328 chemistry of water. See water chemistry children, fixtures and +fixture heights, 2004 V1: 107 water closets, 2003 V4: 4–5 water coolers, 2003 V4: 14 +chilled drinking water recirculating (DWR), 2004 V1: 8 chilled drinking water supply (DWS), 2004 V1: 8, 265, +2000 V3: 34 +chilled water returns (CWR), 2004 V1: 8 chilled water supply (CWS), 2004 V1: 8 chimneys +codes, 2004 V1: 43 defined, 1999 V2: 213 heights, 1999 V2: 178 +china fixtures, 2003 V4: 1–2 +chips in acid-neutralization tanks, 2000 V3: 40, 41 chloramines, 2000 V3: 149 +chlorides, 2004 V1: 147, 1999 V2: 281, 283, 302 + +285 + + +chlorimine, 1999 V2: 300 +chlorinated polyethylene sheet shower pans, 2003 V4: 15 chlorinated polyvinyl-chloride (CPVC) +defined, 2004 V1: 21 +industrial waste usage, 2000 V3: 93 +pipe characteristics, 2000 V3: 48, 2003 V4: 59–60 pipes, 1999 V2: 284, 2003 V4: 62 +VOCs and, 1999 V2: 284 chlorination +disinfecting water systems, 1999 V2: 252 domestic water systems, 1999 V2: 154 drinking water, 1999 V2: 245 +gray water, 1999 V2: 27, 28, 29 wells, 1999 V2: 243 +chlorine +as disinfectant in pools, 2000 V3: 123 bleaches, 1999 V2: 230 +breakdown chlorination, 2000 V3: 149 chlorine-resistant grates, 1999 V2: 15 cyanide and, 2000 V3: 93 +gas, 2000 V3: 146, 148 microbial control, 1999 V2: 311 +pure water systems, 1999 V2: 323 +reflecting pools and fountains, 2000 V3: 108 removing, 1999 V2: 300 +residuals, 2000 V3: 146, 147, 148 reverse osmosis and, 2000 V3: 47 +small drinking water systems, 1999 V2: 318 superchlorination, 2000 V3: 149 +swimming pool heaters and, 2000 V3: 138 swimming pool water chemistry, 2000 V3: 146 in water chemistry, 1999 V2: 281, 284 +chlorofluorocarbons (CFCs), 2000 V3: 22 chloroform, 2000 V3: 70 +chrome-plated brass, 2000 V3: 145 chromium III, 2000 V3: 93 chromium-iron, 2004 V1: 141 chromium VI, 2000 V3: 93 Church, James, 1999 V2: 114 +churches, numbers of fixtures for, 2003 V4: 19, 22 Ciba-Geigy Pipe Systems, Inc., 2000 V3: 97 cigarette burn testing, 2003 V4: 2 +CIN (cubic inches), 2004 V1: 14 cinders as backfill, 1999 V2: 222 circles, calculating area, 2004 V1: 5 +circuit venting, 2004 V1: 20, 1999 V2: 43–44, 64 circuits (ckt, CKT), 2004 V1: 14, 20 +circular lavatories, 2003 V4: 11 circulating pumps in pools, 2000 V3: 139 circulating water systems +in geothermal energy systems, 2004 V1: 131 hot water systems, 1999 V2: 165 +standby losses in, 2004 V1: 127 circulation loops, 2000 V3: 47 +CISPI (Cast Iron Soil Pipe Institute) abbreviation, 2004 V1: 20 address, 2004 V1: 58 +Cast Iron Soil Pipe and Fittings Engineering Manual, 1999 V2: 114 +CISPI 301 standard, 2003 V4: 28 CISPI 310 standard, 2003 V4: 28 publications, 2004 V1: 53 +286 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +cisterns, 1999 V2: 21, 247 +citing codes and standards, 2004 V1: 67 citric acid, 2004 V1: 146 +city rainfall rate tables, 1999 V2: 69–78 city water. See municipal water supply ckt, CKT (circuits), 2004 V1: 14, 20 CL, C/L (critical level), 2004 V1: 21 clad steel tanks, 2000 V3: 155, 165, 172 Claes, 2004 V1: 154 +clamp gate valves, 2004 V1: 20 clamp joints +cast iron pipes, 2003 V4: 28 clams, 1999 V2: 282 +clappers +deluge valves, 2000 V3: 14 dry-pipe systems, 2000 V3: 11 +clarification treatments for water, 1999 V2: 294, 314 clarifying tanks, 2000 V3: 40 +classes of service, standpipe systems, 2004 V1: 30, 2000 V3: 18, 19 +classifications +bedding, 2000 V3: 234, 235 disabilities, 2004 V1: 107 fires, 2000 V3: 3, 19, 27 liquid fuel, 2000 V3: 153–154 +steam and condensate systems, 2000 V3: 175–189 claw-type pumps, 1999 V2: 259 +clay loams, 2000 V3: 100, 243 clay pipe joints, 1999 V2: 223 clay piping +industrial discharge piping, 1999 V2: 346 noise insulation, 1999 V2: 15 +pipe sizing, 1999 V2: 89–92 surface roughness, 1999 V2: 122 underground piping, 1999 V2: 68 +vitrified clay pipe, 2003 V4: 49, 56–57 clay soils, 1999 V2: 26, 27 +clays +in feed water, 1999 V2: 289 in soil texture, 1999 V2: 218 +Clean Agent Extinguishing Systems (NFPA 2001), 2000 V3: 22, 23, 25, 29 +Clean Air Act Amendments (CAAA), 2000 V3: 154 clean extinguishing agents, 2000 V3: 22 +Clean Water Act, 1999 V2: 345, 2000 V3: 87, 88–89, 96 cleaning +cold-water systems, 1999 V2: 154–155 filters, 2000 V3: 150 +fixtures, 2003 V4: 1 +medical gas pipes, 2000 V3: 74, 80 pipes and piping, 2003 V4: 25 pool filters, 2000 V3: 137 +pools and fountains, 2000 V3: 107, 112 pure-water systems, 2000 V3: 47 radioactive waste piping, 1999 V2: 341 section in specifications, 2004 V1: 71, 92 septic tanks, 1999 V2: 228, 229–230 swimming pools, 2000 V3: 146 +cleanout plugs (CO), 2004 V1: 11 cleanouts +chemical-waste systems, 1999 V2: 346 cleaning drains, 1999 V2: 15–16 + +defined, 2004 V1: 20 +manholes, 1999 V2: 99, 2000 V3: 240, 241 radioactive waste systems, 1999 V2: 343 roof drainage, 1999 V2: 88 +roof leaders, 1999 V2: 86 +sanitary drainage systems, 1999 V2: 9–10 types, 1999 V2: 17–18 +vacuum cleaning systems, 1999 V2: 276 cleanouts to grade (CO), 2004 V1: 11 cleanup/utility rooms, 2000 V3: 32 +clear floor space +bathtub accessibility, 2004 V1: 117 bathtubs, 2004 V1: 117 +drinking fountains and water coolers, 2004 V1: 112 laundry equipment, 2004 V1: 123 +lavatories and sinks, 2004 V1: 117 urinal design, 2004 V1: 116 +water closet and toilet accessibility, 2004 V1: 113–116 for wheelchairs, 2004 V1: 109, 110 +clear space in septic tanks, 1999 V2: 228 clear-water wastes +defined, 2004 V1: 20 +in roof drains, 1999 V2: 84 clearance +clean agent gas fire containers, 2000 V3: 23 fixtures in health-care facilities, 2000 V3: 33 piping and, 2003 V4: 25 +clg load, CLG LOAD (cooling loads), 2004 V1: 14 climate, storm-drainage systems and, 1999 V2: 68 clinic sinks, 2000 V3: 32 +clinics, 1999 V2: 147, 2000 V3: 83 +clo, converting to SI units, 2004 V1: 39 CLOAD (cooling loads), 2004 V1: 14 clockwise (cw, CW), 2004 V1: 14 +clogging in leaching trenches, 1999 V2: 222 close-coupled centrifugal pumps, 2000 V3: 115 close-coupled water closets, 2003 V4: 3 +close nipples, 2004 V1: 20 +closed-circuit cooling systems, 2004 V1: 151, 1999 V2: 243 closed proprietary specifications, 2004 V1: 67 +closed-type sprinklers, 2000 V3: 9 +clothes washers. See laundry systems and washers cloudy water in pools, 2000 V3: 147 +CMPR (compressors). See compressors +cndct, CNDCT (conductivity), 2004 V1: 14, 33 CO (cleanout plugs), 2004 V1: 11 +CO (yard cleanouts or cleanouts to grade). See cleanouts; cleanouts to grade +CO2 (carbon dioxide). See carbon dioxide coagulants in clarification, 1999 V2: 294 +coagulation in gray-water treatment, 1999 V2: 27, 28 coal tar epoxy, 2000 V3: 156 +coalescence and filtration of oil spills, 1999 V2: 347 coalescing filters in vacuum systems, 1999 V2: 260 coalescing media, 2000 V3: 93 +coarse sands, 1999 V2: 26, 27, 103, 2000 V3: 100 coat hooks +accessibility in toilet and bathing rooms, 2004 V1: 113 ambulatory accessible toilet compartments, 2004 V1: +115–116 coated metal +cathodic protection, 2004 V1:150 +Index + + +coated steel filters, 2000 V3: 131 corrosion protection, 2004 V1: 147 natural gas piping, 1999 V2: 176 passivation, 2004 V1: 146–147 septic tanks, 1999 V2: 228 sprinkler head ratings, 2000 V3: 17 storage tanks, 2000 V3: 172 +storm piping, 1999 V2: 68 +coaxial truck delivery hoses, 2000 V3: 157 coaxial vapor recovery, 2000 V3: 163, 167 cocks, 2004 V1: 20 +Code of Federal Regulations (CFR), 1999 V2: 317, 2000 V3:88, 2000 V3: 96, 154 +codes and standards +chemical-waste systems, 1999 V2: 345 citing, 2004 V1: 67 +codes, defined, 2004 V1: 20 concrete pipe, 2003 V4: 32 +domestic water supply, 2000 V3: 216 ductile iron pipe, 2003 V4: 32 +fire protection, 2000 V3: 1, 225 fixtures, 2003 V4: 2 +gasoline and diesel-oil systems, 2000 V3: 154 gray-water systems, 1999 V2: 22 +health-care facilities, 2000 V3: 31–34 hot-water systems, 1999 V2: 170 +industrial wastewater treatment, 2000 V3:87–90 infectious and biological waste systems, 1999 V2: +343–344 +medical gas systems, 2000 V3: 83 natural gas services, 2000 V3: 248 NFPA standards, 2000 V3: 1 +plumbing materials and equipment, 2004 V1: 41–57 plumbing standards for people with disabilities, 2004 +V1: 105–106 +reference-based standards, 2004 V1: 66 searching, 2000 V3: 215 +seismic protection, 2004 V1: 171–184 +special-waste drainage systems, 1999 V2: 327–328 storm sewers, 2000 V3: 240 +swimming pools, 2000 V3: 127 +vacuum-cleaning systems, 1999 V2: 266 vacuum systems, 1999 V2: 262 +water analysis, treatment and purification, 1999 V2: 279, 317 +water heaters, 2004 V1: 129 coefficients (coeff., COEF), 2004 V1: 14 coefficients of expansion, 2004 V1: 20 +coefficients of hydrant discharge, 2000 V3: 4, 5 coefficients of permeability (K factor), 1999 V2: 100–101, +104–105, 242 +coefficients of transmissibility (Q factor), 1999 V2: 101– 102 +coefficients of valve flow (C, C, CV), 2004 V1: 14 +v v +coffee sinks, 1999 V2: 25. See also sinks and wash basins cogeneration systems, waste heat usage, 2004 V1: 134 coherent unit systems, 2004 V1: 32 +coils (COIL), 2004 V1: 14 cold water (CW), 2004 V1: 8 cold-water systems +backflow prevention, 1999 V2: 144–149 excess water pressure, 1999 V2: 152–154 + +287 + + +inadequate water pressure, 1999 V2: 149–152 introduction, 1999 V2: 115 +pipe codes, 2004 V1: 45 +pipe sizing, 1999 V2: 121–131, 133–142, 136 potable water systems, 2000 V3: 45 references, 1999 V2: 155 +residential systems, 1999 V2: 115–116 +testing, cleaning, and disinfection, 1999 V2: 154–155 water hammer, 1999 V2: 131–132 +water line sizing, 1999 V2: 116–131 coliform group of bacteria, 2004 V1: 21 coliform organism tests, 1999 V2: 155 coliseums, numbers of fixtures for, 2003 V4: 19 +collection legs in condensate drainage, 2000 V3: 191, 195 collective bargaining agreements, cost estimates and, 2004 +V1: 98 +collectors (dug wells), 1999 V2: 240 +College of American Pathologists (CAP), 1999 V2: 279, 317, 319 +Collentro, W.V., 1999 V2: 325 +colloidal particles, removing, 1999 V2: 294, 2000 V3: 93 colloidal silica, 1999 V2: 283 +colony forming units (cfus), 1999 V2: 282 color +of drinking water, 1999 V2: 316 of feed water, 1999 V2: 282, 287 of gray water, 1999 V2: 29, 33 +medical gas codes, 2000 V3: 54, 56 of pool lights, 2000 V3: 121 +of soils, 1999 V2: 218–219 +of swimming pool water, 2000 V3: 147 color codes +copper drainage tube, 2003 V4: 45 copper pipes, 2003 V4: 35–36 medical gas tube, 2003 V4: 45 +seamless copper water tube, 2003 V4: 37 column radiators, 2000 V3: 181 +columns in ion exchange systems, 1999 V2: 302 combination building water supplies, 2000 V3: 225–226 combination dry-pipe and pre-action systems, 2004 V1: 29, +2000 V3: 15 +combination fixtures, defined, 2004 V1: 21 +combination storm-drainage and sanitary sewers, 1999 V2: 12, 67, 93, 2000 V3: 247 +combination temperature and pressure relief valves, 1999 V2: 166 +combination thermostatic and pressure balancing valves, 2003 V4: 15, 16 +combination vacuum-cleaning systems, 1999 V2: 266 combination waste and vent systems, 2004 V1: 21, 1999 +V2: 45–46, 64 +combined building drains, 2004 V1: 20 combined residuals, 2000 V3: 146 combustibles +defined, 2000 V3: 83, 153 fire loads, 2000 V3: 2–3 metal fires, 2000 V3: 20 +combustion efficiency, 2004 V1: 21 +combustion exhaust from natural gas, 1999 V2: 177 combustion products, 2000 V3: 83 +Commercial Energy Conservation Manual, 2004 V1: 137 commercial facilities +288 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +commercial/industrial gas service, 2000 V3: 249 estimating sewage quantities, 1999 V2: 234 firefighting demand flow rates, 2000 V3: 232 gray-water systems, 1999 V2: 25 +grease interceptors, 1999 V2: 13 +natural gas appliance demand, 1999 V2: 175 oil interceptors in drains, 1999 V2: 12–13 +radioactive waste drainage and vents, 1999 V2: 337 commercial kitchen sinks, 2003 V4: 12, 13 +commercial laundries. See laundry systems and washers Commercial Standards (CS), 2004 V1: 21 +Commercial Water Use Research Project, 1999 V2: 34 commissioning section in specifications, 2004 V1: 71, 92 Commodity Specification for Air (CGA G-7.1/ANSI ZE +86.1), 2000 V3: 65, 83, 86 +Commodity Specification for Nitrogen (CGA G-10.1), 2000 V3: 86 +commodity tube, 2003 V4: 35 +common vents (dual vents), 2004 V1: 21, 1999 V2: 41, 64 community bathhouses, 1999 V2: 235 +Compact Fittings, 2003 V4: 32 +compacted fill, building sewers and, 1999 V2: 15 companion flanges, 2004 V1: 21 +comparative cost analysis, 2004 V1: 254 +comparing functions in value engineering, 2004 V1: 243 compartments in septic tanks, 1999 V2: 229 competition swimming pools, 2000 V3: 128, 129, 139 components section in specifications, 2004 V1: 91 composite tanks, 2000 V3: 156 +composting toilets, 2004 V1: 136, 265 compound gauges, 2000 V3: 144 +compound water meters, 1999 V2: 115, 116, 117 compounds in water, 1999 V2: 281 +Comprehensive Environmental Response Compensation and Liability Act (CERCLA), 2000 V3:88, 2000 V3: 89–90, 96 +compressed air (A, X#, X#A). See also compressed air systems +compared to free air, 2000 V3: 199 defined, 2004 V1: 18 +laboratory or medical compressed air, 2004 V1: 8, 2000 V3: 37–39, 65–68, 75, 82–83 +overview, 2000 V3: 199 piping, 1999 V2: 177 +supplies to water tanks, 1999 V2: 247 symbols for, 2004 V1: 8 +tools and equipment, 2000 V3: 208 uses, 2000 V3: 199 +water vapor in air, 2000 V3: 200–201 Compressed Air and Gas Data, 1999 V2: 214 Compressed Air and Gas Handbook, 2000 V3: 214 “Compressed Air Data,” 2000 V3: 214 +“Compressed Air Design for Industrial Plants,” 2000 V3: 214 +Compressed Air for Human Respiration (CGA G-7.0), 2000 V3: 86 +Compressed Air Fundamentals, 2000 V3: 214 Compressed Air Handbook, 2000 V3: 214 Compressed Air Magazine, 2000 V3: 214 compressed air systems +accessories, 2000 V3: 202–203 +air dryers, 2000 V3: 203–204, 207 + +air receivers, 2000 V3: 205–206 compressors, 2000 V3: 201–202, 210–213 condensate removal, 2000 V3: 213 conditioning, 2000 V3: 207 contaminants, 2000 V3: 201 +definitions, 2000 V3: 199–200 +earthquake bracing for piping, 2004 V1: 167 measurement units, 2000 V3: 200 +overview, 2000 V3: 199 +piping system design, 2000 V3: 206–213 +air-consuming devices, 2000 V3: 206–207 air dryers, 2000 V3: 207 +design sequence, 2000 V3: 206 duty cycles, 2000 V3: 207 filters, 2000 V3: 207 +future expansion, 2000 V3: 210 leakage, 2000 V3: 209 materials, 2000 V3: 210 +sizing piping, 2000 V3: 74, 78, 210 use factors, 2000 V3: 209 +pressure drops, 2000 V3: 212 references, 2000 V3: 214 regulation methods, 2000 V3: 205 starting unloaders, 2000 V3: 205 tools and equipment, 2000 V3: 208 +water vapor in air, 2000 V3: 200–201 compressed gas. See natural gas systems +Compressed Gas Association, Inc. (CGA), 2000 V3: 56 address, 2004 V1: 58, 2000 V3: 86 +list of standards, 2004 V1: 53 publications +CGA C-9: Standard for Color-marking of Compressed Gas Cylinders Intended for Medical Use, 2000 V3: 86 +CGA G-7.0: Compressed Air for Human Respiration, 2000 V3: 86 +CGA G-7.1/ANSI ZE 86.1: Commodity Specification for Air, 2000 V3: 83, 86 +CGA G-8.1: Standard for the Installation of Nitrous Oxide Systems at Consumer Sites, 2000 V3: 86 +CGA G-10.1: Commodity Specification for Nitrogen, 2000 V3: 86 +CGA P-2: Characteristics and Safe Handling of Medical Gases, 2000 V3: 86 +CGA P-9: Inert Gases: Argon, Nitrogen and Helium, 2000 V3: 81, 82, 86 +CGA V-5: Diameter-Index Safety System, 2000 V3: 83, 86 +Compressed Air and Gas Handbook, 2000 V3: 214 standard air definition, 2000 V3: 200 +compression couplings clay pipe, 2003 V4: 49 glass pipe, 2003 V4: 48 +compression fittings +cast iron, 2003 V4: 27, 28 defined, 2004 V1: 24 +compression joints, 2004 V1: 21 +compressive strength of plastic pipe, 2003 V4: 59–60 compressors (cprsr, CMPR) +defined, 2004 V1: 21 +earthquake protection, 2004 V1: 164 +Index + + +symbols for, 2004 V1: 14 +computer processing of specifications, 2004 V1: 71–72 computer programs +abbreviations in, 2004 V1: 14–16 +computer analysis of piping systems, 2004 V1: 186 ETI (Economic Thickness of Insulation), 2004 V1: 127 plumbing cost estimation, 2004 V1: 93, 98 specifications programs, 2004 V1: 71–72 +computer room waste heat usage, 2004 V1: 134 concealed piping, 2000 V3: 73 +concealed sprinklers, 2004 V1: 29 concentration cells +attack corrosion, 2004 V1: 141 defined, 2004 V1: 152 +concentration gradients, 1999 V2: 308 concentration polarization, 2004 V1: 152 concentration tests, 2000 V3: 82 +concentric reducers, 2004 V1: 10, 2000 V3: 115 concrete, 2000 V3: 147 +concrete anchors +floor-mounted equipment, 2004 V1: 163 problems in seismic protection, 2004 V1: 188 +concrete ballast pads, 2000 V3: 172 +concrete barriers around tanks, 2000 V3: 169 concrete base devices, 2004 V1: 204–205 concrete covers on seepage pits, 1999 V2: 225 concrete embedments, 2004 V1: 190 +concrete floors, leveling around, 1999 V2: 17 concrete inertia bases, 2004 V1: 203 Concrete Pipe Handbook, 1999 V2: 102, 114 concrete piping +flow rate, 2000 V3: 245 +noise insulation, 1999 V2: 15 pipe sizing, 1999 V2: 89–92 standards, 2003 V4: 32 +surface roughness, 1999 V2: 122 underground piping, 1999 V2: 68, 2003 V4: 32 +concrete restraints, 2000 V3: 229 concrete roofing drains, 1999 V2: 82, 83 concrete sand fill, 1999 V2: 103 concrete septic tanks, 1999 V2: 228 +concrete shielding from radiation, 1999 V2: 339 concrete-tank saddles, 2004 V1: 164 +concrete tanks, 2000 V3: 91, 165 concrete thrust blocks, 1999 V2: 251 +cond, COND (condensers, condensation). See condensation; condensers +condensate drains (CD), 2004 V1: 8, 1999 V2: 13 condensate grooving, 2000 V3: 190 +condensate receivers, 2000 V3: 188–189 condensate return methods, 2000 V3: 186–189 +gravity return, 2000 V3: 186–187 mechanical return, 2000 V3: 186–189 +boiler feed pumps, 2000 V3: 188–189 condensate transfer pumps, 2000 V3: 187 vacuum pumps, 2000 V3: 189 +condensate transfer pumps, 2000 V3: 188, 189 condensates, 2000 V3: 138. See also steam and condensate +systems +corrosion inhibitors, 2004 V1: 151 defined, 2004 V1: 21, 1999 V2: 213 +condensation (cond, COND) + +289 + + +air drying, 2000 V3: 204 +compressed air systems, 2000 V3: 213 corrosion and, 2004 V1: 146 +dew points, 2000 V3: 201 earthquakes and, 2004 V1: 170 gray water systems, 2004 V1: 267 +non-circulating hot water systems, 2004 V1: 127 protecting against, 1999 V2: 18 +swimming pools, 2000 V3: 129 symbols for, 2004 V1: 14 +condensation loads +equations, 2000 V3: 194, 195 safety factors, 2000 V3: 194 steam piping, 2000 V3: 193 +condensers +condenser system water treatments, 1999 V2: 315 distilled water systems, 2000 V3: 46 +scale deposits, 1999 V2: 289 symbols for, 2004 V1: 14 +waste heat reclamation, 2004 V1: 132, 133 water measurement in, 2000 V3: 124 +condensing gas water heaters, 2004 V1: 130 conditioning compressed air, 2000 V3: 207, 211 conditioning water. See water treatment conditions in creativity checklist, 2004 V1: 234 conductance (C), 2004 V1: 14, 33 +conductivity (cndct, CNDCT, K) evaporation and, 2000 V3: 121 measurements, 2004 V1: 33 +mho (specific conductivity), 1999 V2: 287 symbols for, 2004 V1: 14 +conductors +defined, 2004 V1: 21 number of, 2004 V1: 14 +conduits +defined, 2004 V1: 21 +seismic protection, 2004 V1: 155 cones +calculating volume, 2004 V1: 4 of depression, 1999 V2: 242 +“Conference Generale de Poids et Measures,” 2004 V1: 32 confluent vents, 2004 V1: 21, 1999 V2: 51, 52 +connected loads, defined, 1999 V2: 214 connected standbys, 2000 V3: 23 +connections section in specifications, 2004 V1: 91 conserving energy +alternate energy sources, 2004 V1: 130–131 Bernoulli’s equation, 2004 V1: 5–6 +domestic water temperatures, 2004 V1: 124–125 glossary, 2004 V1: 136–137 +hot water system improvements, 2004 V1: 127 introduction, 2004 V1: 124 +nondepletable and alternate energy sources, 2004 V1: 130–131 +off-peak power, 2004 V1: 128–129 +reduced water flow rates, 2004 V1: 126–127 references, 2004 V1: 137 +saving utility costs, 2004 V1: 128–130 +standby losses in circulating systems, 2004 V1: 127 thermal insulation thickness, 2004 V1: 127 +waste heat usage, 2004 V1: 131–134 conserving water +290 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +air-conditioning system water, 1999 V2: 243 design techniques, 2004 V1: 134–135 domestic water supply, 2000 V3: 43 +green design, 2004 V1: 263–267 +institutional wastewater systems, 1999 V2: 232 introduction, 2004 V1: 124 +large sewage systems and, 1999 V2: 231 urinals, 2003 V4: 8–9 +water closet fixtures, 2003 V4: 3 constant-speed pumps, 1999 V2: 152 constantly-used fixtures, 1999 V2: 121 +Constructed Science Research Foundation Spectext, 2004 V1: 71 +construction change directives, 2004 V1: 63 construction contract documents (CD) +contract documents defined, 2004 V1: 61 defined, 2004 V1: 61 +overview, 2004 V1: 61 +project manuals, 2004 V1: 62–63 +value engineering clauses in, 2004 V1: 258, 260 construction costs in value engineering, 2004 V1: 212 Construction Specifications Canada (CSC) Uniformat, +2004 V1: 64 +Construction Specifications Institute (CSI) classes, 2004 V1: 72 +Constructed Science Research Foundation, 2004 V1: 71 general conditions documents, 2004 V1: 62 +Manual of Practice, 2004 V1: 61 MasterFormat, 2004 V1: 64 +MasterFormat 2004, 2004 V1: 64–65, 77–88 MasterFormat Level Four (1995), 2004 V1: 76 MasterFormat Level One (1995), 2004 V1: 73 MasterFormat Level Three (1995), 2004 V1: 76 MasterFormat Level Two (1995), 2004 V1: 73–75 section shell outline, 2004 V1: 88–92 Sectionformat, 2004 V1: 65 +Uniformat, 2004 V1: 64, 73 web site, 2004 V1: 65 +Consultation phase in value engineering, 2004 V1: 243, 254 +consumption. See demand +contact corrosion, defined, 2004 V1: 152 contact factors (CF), 2004 V1: 14 contact sheets, 2000 V3: 215 +contact time for microbial control, 1999 V2: 311 Containment Control in Biotechnology Environments, 1999 +V2: 350 +containment floors or dikes, 2000 V3: 90 containment of biological wastes, 1999 V2: 343 containment pipes and gas piping, 1999 V2: 176 containment sumps, 2000 V3: 156, 163, 167 contamination issues +backflow prevention, 1999 V2: 144–149 bored wells, 1999 V2: 241 +compressed air, 2000 V3: 201 contaminant classification, 2000 V3: 222 contaminators, defined, 2004 V1: 21 +dug wells, 1999 V2: 240 +gray-water irrigation systems and, 1999 V2: 26 well protection, 1999 V2: 243 +contingency +plans for industrial wastes, 2000 V3: 89 + +in plumbing cost estimation, 2004 V1: 94 continuing education, 2004 V1: 72 +continuous acid-waste treatment systems, 1999 V2: 338 continuous deionization (CDI), 1999 V2: 306–307 continuous duty pumps, 2000 V3: 26 +continuous flow. See steady flow continuous flow pool gutters, 2000 V3: 142 +continuous vents, defined, 2004 V1: 21, 1999 V2: 64 continuous waste, 2004 V1: 21 +continuous wastewater treatment, 2000 V3: 95 continuous welding technique, 2003 V4: 48 +contract documents. See construction contract documents contraction of pipes +calculating, 2004 V1: 3 +pool temperature and, 2000 V3: 145 protecting against, 1999 V2: 18 +Control of Pipeline Corrosion, 2004 V1: 154 control panels +clean gas systems, 2000 V3: 24 fire alarm, 2004 V1: 12 fountains, 2000 V3: 120–121 +control systems in geothermal energy systems, 2004 V1: 131 +control valves +medical gas systems, 2000 V3: 71–72 swimming pools, 2000 V3: 139 +controlled-flow storm-drainage systems, 1999 V2: 88, 93–94 +controlled-substance spills, 1999 V2: 277 controllers +defined, 2004 V1: 21 +for irrigation systems, 2000 V3: 104 controls +in accessible shower compartments, 2004 V1: 120 in bathtubs, 2004 V1: 118 +defined, 2004 V1: 21 +on gas boosters, 1999 V2: 182 on water heaters, 1999 V2: 160 +vacuum systems, 1999 V2: 260, 268, 2000 V3: 70 convection, 2000 V3: 121 +convention halls, numbers of fixtures for, 2003 V4: 21 convergent thinking in evaluation, 2004 V1: 235 converging seismic plates, 2004 V1: 158 +conversion factors and converting Fahrenheit and Centigrade, 2004 V1: 38 +feet of head to pounds per square inch, 2004 V1: 2 fuel gas, 1999 V2: 212 +IP and metric units, 2000 V3: 29 +IP and SI, 2004 V1: 39–40, 1999 V2: 256 measurements, 2004 V1: 32 +meters of head to pressure in kilopascals, 2004 V1: 2 vacuum acfm and scfm, 1999 V2: 256, 257 +vacuum pressures, 1999 V2: 254 +water impurity measurements, 1999 V2: 285 cooling compressors, 2000 V3: 201 +cooling equipment, green building and, 2004 V1: 264 cooling fire areas, 2000 V3: 20 +cooling loads (clg load, CLG LOAD, CLOAD), 2004 V1: 14 cooling-tower water +constant use and, 1999 V2: 121 corrosion inhibitors, 2004 V1: 151 +exclusion from gray-water systems, 1999 V2: 21 +Index + + +Legionella pneumophila, 1999 V2: 169 reducing makeup water, 2004 V1: 264 use of gray water in, 1999 V2: 21 waste heat usage, 2004 V1: 131 +water demand, 1999 V2: 243 +water treatments, 1999 V2: 315–316 coordination disabilities, 2004 V1: 107 +coordination with other designers, 1999 V2: 79, 81, 84 COP (coefficient of performance), 2004 V1: 136 copper +corrosion, 2004 V1: 139 +in electromotive series, 2004 V1: 144 in galvanic series, 2004 V1: 141 +pool lighting, 2000 V3: 145 +swimming pool main drains, 2000 V3: 143 copper alloy piping, 1999 V2: 14, 2003 V4: 27 copper-copper sulfite half-cells, 2004 V1: 144 +Copper Development Association (CDA), 2004 V1: 20, 1999 V2: 65 +copper drainage tube, 2003 V4: 45, 46 copper joints, 1999 V2: 222 +copper-nickel alloys, 2004 V1: 141 +copper-phosphorous-silver brazing (BCuP), 2003 V4: 45 copper-phosphorus brazing, 2003 V4: 45 +copper piping +aboveground piping, 1999 V2: 14, 68 commodity tube, 2003 V4: 35 compressed air systems, 2000 V3: 210 conserving energy, 2004 V1: 128 copper K piping, 1999 V2: 262 +copper L piping, 1999 V2: 262 fountains, 2000 V3: 116 +fuel-gas piping, 1999 V2: 196 gas piping, 1999 V2: 176 +pure-water system, 2000 V3: 47 radioactive waste systems, 1999 V2: 341 roughness, 1999 V2: 122 +sizing, 1999 V2: 133 +sprinkler systems, 2000 V3: 12, 17 swimming pools, 2000 V3: 145 types, 2003 V4: 34–36 +copper rings over joints, 1999 V2: 223 copper salts, 2000 V3: 145, 148 +Copper Sovent Single-stack Plumbing System Handbook Supplement, 1999 V2: 65 +copper sulfate, 1999 V2: 223 +copper-sulfate electrodes, 2004 V1:150 copper tube size (CTS), 2003 V4: 59, 61 copper water tube, 2003 V4: 34–44 Copson, H.R., 2004 V1: 154 +corona-discharge generators, 1999 V2: 312 corporation cocks, 2004 V1: 21 +correction factors, 2004 V1: 14 +correctional centers, numbers of fixtures for, 2003 V4: 20 corroded end of galvanic series, 2004 V1: 141 +corrosion +backflow preventers and, 1999 V2: 149 boilers, 1999 V2: 314 +calcium carbonate and, 1999 V2: 291 cathodic protection, 2004 V1: 147–151 causes, 1999 V2: 289–290 +coatings, 2004 V1: 147 + +291 + + +control of, 2004 V1: 145–151, 1999 V2: 18, 244 cooling towers, 1999 V2: 316 +corrosion cells, 2004 V1: 139, 140, 148 corrosion mitigation, 2004 V1: 152 corrosion potential, 2004 V1: 152 +corrosion-resistant materials, 2004 V1: 146, 1999 V2: 15 +corrosion-resistant sprinklers, 2004 V1: 29 corrosive wastes, 1999 V2: 14 +deaeration and, 1999 V2: 294 defined, 2004 V1: 139, 152 +electromotive force series, 2004 V1: 144 factors in rate of, 2004 V1: 144–145 fatigue and fatigue limits, 2004 V1: 152 glossary, 2004 V1: 151–154 +hot-water relief valves, 1999 V2: 166 inhibitors, 2004 V1: 151 introduction, 2004 V1: 139 +natural gas piping, 1999 V2: 176 passivation, 2004 V1: 146–147 plastic water pipes, 1999 V2: 252 +predicting water deposits and corrosion, 1999 V2: 290–292 +prevention, 2004 V1: 152 protection, 2000 V3: 165 references, 2004 V1: 154 sacrificial anodes, 2004 V1: 148 steam systems, 2000 V3: 190 +storage tanks, 2000 V3: 91, 155, 165 swimming pool heaters, 2000 V3: 146 total organic carbon and, 1999 V2: 288 types of, 2004 V1: 141 +water mains, 2000 V3: 8 Corrosion, 2004 V1: 154 +Corrosion and Resistance of Metals and Alloys, 2004 V1: 154 +Corrosion Causes and Prevention, 2004 V1: 154 Corrosion Control, 2004 V1: 154 +Corrosion Engineering, 2004 V1: 154 corrosion fatigue, 2004 V1: 152 Corrosion Handbook, 2004 V1: 154 +Corrosion in Swimming Pools and General Guide to Materials Selection (NSPI 18), 2000 V3: 145 +corrosion mitigation, 2004 V1: 152 corrosion potential, 2004 V1: 152 corrosion prevention, 2004 V1: 152 +Corrosion Prevention for Practicing Engineers, 2004 V1: 154 +corrosion-resistant materials, 2004 V1: 146, 1999 V2: 15 Corrosion Resistant Materials Handbook, 2000 V3: 97 corrosion-resistant sprinklers, 2004 V1: 29 +corrosive wastes, 1999 V2: 14, 2000 V3: 40, 2003 V4: 27 corrugated steel piping, 1999 V2: 122, 2000 V3: 245 cosmic radiation, 1999 V2: 339 +Cost Analysis phase in value engineering, 2004 V1: 235, 241–243, 254 +costs and economic concerns +administrative and operation costs, 2004 V1: 212 collecting data on, 2004 V1: 222–225 construction costs, 2004 V1: 212 +cost fitting, defined, 2004 V1: 258 +292 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +cost information in value engineering, 2004 V1: 222– 225 +cost of goods, 2004 V1: 222 +cost-to-function relationship, 2004 V1: 225 defined, 2004 V1: 213, 222–225 development costs, 2004 V1: 212 +economic values, 2004 V1: 213–214 engineering and design costs, 2004 V1: 212 estimating costs, 2004 V1: 93–98 +idea development and estimated cost forms, 2004 V1: 241–242 +labor costs, 2004 V1: 212 life-cycle costs, 2004 V1: 137 material costs, 2004 V1: 212 overhead, 2004 V1: 212 +Pareto principle, 2004 V1: 224 relationships, 2004 V1: 223 specific applications +air dryers, 2000 V3: 207 +cathodic protection costs, 2004 V1:150, 2004 V1:151 controlled-flow systems, 1999 V2: 88, 93 +corrosion resistant materials, 2004 V1: 146 driven wells, 1999 V2: 241 +fuel product dispensing systems, 2000 V3: 164 galvanic cathodic protection costs, 2004 V1: 150 gas booster location, 1999 V2: 180 +gray-water system costs, 1999 V2: 29–32 hot-water systems, 1999 V2: 157 +ion-exchange cartridges, 1999 V2: 306, 323 ion-exchange resins, 1999 V2: 302, 305 laboratory acid-waste drainage, 1999 V2: 334 pool filtration systems, 2000 V3: 135 +reduced-size venting, 1999 V2: 50 sanitary drainage systems, 1999 V2: 1 +seismic protection costs, 2004 V1: 156, 183 single septic tank installations, 1999 V2: 231 +sovent single-stack plumbing systems, 1999 V2: 54 sovent system fittings, 1999 V2: 62 +special-waste drainage systems, 1999 V2: 328 subsurface site drainage, 1999 V2: 100 swimming pool heaters, 2000 V3: 138, 139 utility costs, 2004 V1: 128–130 +vacuum system piping, 1999 V2: 262 water distillers, 1999 V2: 298 +wet venting, 1999 V2: 49 in specifications, 2004 V1: 69 +supporting details for, 2004 V1: 257–258 types of, 2004 V1: 222–225 +value engineering process and, 2004 V1: 211 vs. prices, 2004 V1: 222 +cotton gin, creativity and, 2004 V1: 231 coulombs (C) +corrosion, 2004 V1: 139 SI units, 2004 V1: 33 +coulombs per cubic meter (C/m3), 2004 V1: 33 +Council for National Cooperation in Aquatics, 2000 V3: 151 +Council of American Building Officials (CABO), 2004 V1: 123 +countdown timer delays, 2000 V3: 24 counter-e.m.f.s, 2004 V1: 153 +counter-mounted kitchen sinks, 2003 V4: 12 + +counter-mounted lavatories, 2003 V4: 11 counter sinks, 2000 V3: 32 counterclockwise (ccw, CCW), 2004 V1: 14 +counterflow piping designs, 2000 V3: 178, 183 counterzoning, 2000 V3: 24 +couple action. See galvanic corrosion couples, defined, 2004 V1: 152 couplings +asbestos concrete piping, 2003 V4: 26 cast iron hubless pipes, 2003 V4: 28 defined, 2004 V1: 21 +glass pipe, 2003 V4: 47 +nonrigid couplings, 2004 V1: 186 course vacuum, 1999 V2: 253 +covers on seepage pits, 1999 V2: 225 +cp, cp, CP (sp ht at constant pressure), 2004 V1: 16 CPD (Certified Plumbing Designer), 2004 V1: 72 cprsr (compressors). See compressors +CPVC (chlorinated polyvinyl chloride). See chlorinated polyvinyl-chloride (CPVC) +cracking, defined, 2004 V1: 152 Craytor, J., 1999 V2: 34 creativity +assisted and unassisted, 2004 V1: 232 creativity worksheets, 2004 V1: 233–234, 236 +first phase in value engineering, 2004 V1: 213, 231–235 questions for, 2004 V1: 234 +second phase in value engineering, 2004 V1: 254 creep, pipe supports and, 1999 V2: 14 +crevice-attack corrosion +crud traps in radioactive-waste piping, 1999 V2: 341, 343 +defined, 2004 V1: 141, 152, 1999 V2: 290 reducing, 2004 V1: 146 +crimping tools, 2003 V4: 37 +CRIP (critical pressure), 2004 V1: 15 critical care areas, 2000 V3: 32, 57 critical flows, defined, 2004 V1: 2 critical level, defined, 2004 V1: 21 critical path functions, 2004 V1: 230 critical pressure, 2004 V1: 15 +cross connections +backflow prevention, 1999 V2: 144–149 backwash pits, 2000 V3: 137 +defined, 2004 V1: 21 +health-care facilities, 2000 V3: 45 medical gas pipe tests, 2000 V3: 80 taking precautions against, 1999 V2: 32 +types of prevention devices, 1999 V2: 144–145 cross-country pipe lines, 2004 V1: 150 +cross-flow filter media, 1999 V2: 284, 300 +cross-linked polyethylene/aluminum/cross-linked polyethylene (PEX-AL-PEX), 2003 V4: 61–62 +cross-linked polyethylene (PEX), 2003 V4: 61 cross-sections of ditches, 2000 V3: 247–248 cross-sections of drains, 1999 V2: 2, 3, 4 cross valves, 2004 V1: 21 +crosses, defined, 2004 V1: 21 crossovers, 2004 V1: 21 crown vents, 2004 V1: 21 crowns, 2004 V1: 21 +crud traps, 1999 V2: 290, 341, 343 +Index + + +crutches, 2004 V1: 107 cryogenic tanks, 2000 V3: 61, 62 +CS (Commercial Standards), 2004 V1: 21 +CSA. See Canadian Standards Association (CSA) +CSC (Construction Specifications Canada) Uniformat, 2004 V1: 64 +CSI and CSI format. See Construction Specifications Institute (CSI) +CSI (Calcium Saturation Index), 2000 V3: 123 CTS (copper tube size), 2003 V4: 59, 61 +CU IN (cubic inches), 2004 V1: 14 +CU FT (cubic feet), 2004 V1: 14, 2000 V3: 29 cubes, calculating volume, 2004 V1: 4 +cubic feet (ft3, CU FT, CUFT, CFT), 2004 V1: 14, 2000 V3: 29 +cubic feet per hour (cfh), 2000 V3: 200, 248 +cubic feet per minute (cfm, CFM), 2000 V3: 200. See also scfm, SCFM (standard cubic feet per minute) +compressed air systems, 2000 V3: 211 converting to metric units, 2000 V3: 29 defined, 1999 V2: 213 +medical vacuum systems, 2000 V3: 69 symbols for, 2004 V1: 14 +vacuum exhausters and, 1999 V2: 274–275 vacuum measurements, 1999 V2: 253, 255 +cubic feet per second, standard (scfs, SCFS), 2004 V1: 14 cubic foot meters (cfms) +defined, 1999 V2: 213 +vacuum exhausters and, 1999 V2: 274–275 vacuum measurements, 1999 V2: 253, 255 +cubic inches (in3, CU IN, CUIN, CIN), 2004 V1: 14 cubic meters, 2004 V1: 33 +cubic meters per kilogram, 2004 V1: 33 cubic meters per minute, 2000 V3: 200 cubic meters per second, 2004 V1: 33 +CUFT (cubic feet), 2004 V1: 14, 2000 V3: 29 cultured marble acrylic fixtures, 2003 V4: 2 cultured marble fixtures, 2003 V4: 2 Culvert Pipe, 2003 V4: 32 +culvert pipes, 1999 V2: 99 cup sinks, 2000 V3: 32, 37, 38 curb boxes, 2004 V1: 21 curies (c), 1999 V2: 339 current +cathodic protection, 2004 V1: 147 in corrosion, 2004 V1: 139, 144 +electromotive force series, 2004 V1: 144 +large anode current requirements, 2004 V1: 150 measurements, 2004 V1: 33 +current good manufacturing practices (cGMP), 1999 V2: 325, 328 +curve radii for water pipes, 1999 V2: 250 cuspidors, dental, 2000 V3: 38 +Cutting and Welding Processes, 1999 V2: 214 cutting oils, 1999 V2: 13 +CV (check valves). See check valves +cv, c, CV (sp ht at constant volume), 2004 V1: 16 Cv, C, CV (valve flow coefficients), 2004 V1: 14 +v +v +CVBs (check valves with vent ports), 1999 V2: 145, 149 CVOL (specific volume). See specific volume +CW (clockwise), 2004 V1: 14 cw, CW (clockwise), 2004 V1: 14 + +293 + + +CWA. See Clean Water Act +CWR (chilled water return), 2004 V1: 8 CWS (chilled water supply), 2004 V1: 8 cyanide, 2000 V3: 93 +cyanurates, 2000 V3: 149 cyanuric acid, 2000 V3: 123, 149 +cycle of concentration in cooling towers, 1999 V2: 315 cycling of pumps, 1999 V2: 151 +cyclopropane, 2000 V3: 56 cycolac skimmers, 2000 V3: 146 +cylinder-manifold-supply systems, 2000 V3: 59, 60, 62–63, 64, 65, 68 +cylinder snubbers, 2004 V1: 164 cylinders +calculating volume, 2004 V1: 4 +carbon dioxide extinguishing systems, 2000 V3: 20, 21 clean agent gas fire suppression, 2000 V3: 23 +cystoscopic rooms fixtures, 2000 V3: 35 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 51, 58 + +D +d (deci) prefix, 2004 V1: 34 +D (difference or delta), 2004 V1: 14 D (drains). See drains +D (indirect drains), 2004 V1: 8 D-1148 standard, 2003 V4: 61 D-1784 standard, 2003 V4: 62 D-1785 standard, 2003 V4: 62 D-2239 standard, 2003 V4: 61 D-2241 standard, 2003 V4: 62 D-2464 standard, 2003 V4: 62 D-2466 standard, 2003 V4: 62 D-2467 standard, 2003 V4: 62 D-2609 standard, 2003 V4: 61 D-2662 standard, 2003 V4: 58 D-2665 standard, 2003 V4: 62 D-2666 standard, 2003 V4: 58 D-2672 standard, 2003 V4: 62 D-2737 standard, 2003 V4: 61 D-3139 standard, 2003 V4: 62 da (deka) prefix, 2004 V1: 34 +damage. See bedding and settlement; corrosion; creep; hazards; scale and scale formation; seismic protection; water damage +damped, single-leaf barriers, 2004 V1: 193 dampen, defined, 2004 V1: 21 +damping +in earthquakes, 2004 V1: 160–161, 183, 186 sound damping, 2004 V1: 195 +dance halls, numbers of fixtures for, 2003 V4: 19 dancing fountains, 2000 V3: 111 +Darcy’s law, 2004 V1: 2, 3, 1999 V2: 7, 40, 242 +data storage for specifications programs, 2004 V1: 71 databases of plumbing costs, 2004 V1: 93, 98 Daugherty, Robert L., 1999 V2: 19 +Dawson, F.M., 1999 V2: 4, 19 daylights, 1999 V2: 88, 105 +dB, DB (decibels), 2004 V1: 14, 206 +DB (dry-bulb temperature), 2004 V1: 14, 23 dB(A) (decibel (A) scale), 2004 V1: 206 +294 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +dbt, DBT (dry-bulb temperature), 2004 V1: 23 dbt, DBT (effective temperature), 2004 V1: 14 DC current, 2004 V1: 14, 147, 1999 V2: 306 +dc, DC (direct current), 2004 V1: 14, 147, 1999 V2: 306 DCBP (double-check backflow preventers), 2004 V1: 10 DCV (double-check valves), 2000 V3: 223, 224, 226 +DCVA (double-check valve assemblies), 1999 V2: 144, 145, 149 +DD (design development phase), 2004 V1: 64 DE (deionized water), 2004 V1: 8 +DE (diatomaceous earth). See diatomaceous earth deactivation, defined, 2004 V1: 152 +dead-end service in pressure-regulated valves, 1999 V2: 152 +dead ends, defined, 2004 V1: 21 +dead legs in pure water systems, 1999 V2: 324 dead loads on roof, 1999 V2: 79 +“dead-man” abort stations, 2000 V3: 24 deaerators +boiler feed water, 1999 V2: 314 +deaeration water treatment, 1999 V2: 294–295 sovent deaerators +connections, 1999 V2: 60 fittings, 1999 V2: 54 illustrated, 1999 V2: 56, 61, 62 operations of, 1999 V2: 46 +in sovent systems, 1999 V2: 19 dealkalizing treatment, 1999 V2: 295 dealloying, defined, 2004 V1: 152 +debris in pools and fountains, 2000 V3: 108, 110, 138 decarbonation, 1999 V2: 295 +dechlorination, 2000 V3: 123 “deci” prefix, 2004 V1: 34 +decibel (A) scale (dB(A)), 2004 V1: 206 decibels (dB, DB) +defined, 2004 V1: 206 symbols for, 2004 V1: 14 +deck drains, 1999 V2: 69 decomposition potential, 2004 V1: 152 +decontaminating radioactive waste piping, 1999 V2: 341 decorative pools, gray water and, 1999 V2: 22 +deep-bed sand filtration, 1999 V2: 298, 300 deep chambers, 1999 V2: 149 +deep (dp, DP, DPTH). See depth +deep ends of swimming pools, 2000 V3: 128 deep fill, building sewers and, 1999 V2: 15 deep-seal p-traps, 1999 V2: 13, 84 +deep-seated fires, 2000 V3: 23 deep wells, 1999 V2: 240, 245 definitions. See glossaries +definitions section in specifications, 2004 V1: 69, 88 deg., °, DEG (degrees), 2004 V1: 14 +degasification, 1999 V2: 295 degradation of pure water, 1999 V2: 323 degrees (deg., °, DEG), 2004 V1: 14 degrees celsius, 2004 V1: 34 +DEHA (diethylhydroxylamine), 1999 V2: 315 +deionization, 1999 V2: 300. See also demineralizer systems deionized water (DE), 2004 V1: 8 +“deka” prefix, 2004 V1: 34 delay relays, 2000 V3: 24 +delays in clean gas extinguishing systems, 2000 V3: 24 + +deliquescent dryers, 2000 V3: 207 +delivery pressure in natural gas systems, 1999 V2: 183 delivery rooms. See birthing rooms +delivery section in specifications, 2004 V1: 70, 89–90 Delphia method of evaluation, 2004 V1: 254 +delta (diff., ), DIFF, D, DELTA), 2004 V1: 14 delta t (temperature differential), 2004 V1: 136 +DELTP (pressure drops or differences). See pressure drops or differences +Deluge Foam-water Sprinkler Systems and Foam-water Spray Systems (NFPA 16), 2000 V3: 21, 29 +deluge systems, 2004 V1: 29, 2000 V3: 13–15 deluge valves, 2004 V1: 13, 2000 V3: 13, 14 demand +cold-water systems, 1999 V2: 121 defined, 1999 V2: 213 +drinking water, 1999 V2: 243–244, 245 fire demand, 2000 V3: 3 +fire hydrant water demand, 2000 V3: 5–8 flow rates, 2000 V3: 230–232 +hot water, 2004 V1: 136, 1999 V2: 157 hydropneumatic-tank systems, 1999 V2: 150 medical air systems, 2000 V3: 66 +medical gas systems, 2000 V3: 49, 50, 53, 59 +medical school-laboratory water demand, 2000 V3: 45 natural gas, 1999 V2: 175, 177, 2000 V3: 253–254 sprinkler systems, 2000 V3: 3–8, 17 +vacuum systems, 2000 V3: 55, 70 +water conservation and paybacks, 2004 V1: 126 water heater types and, 1999 V2: 160 +water supply piping and, 1999 V2: 249 water treatment methods and, 1999 V2: 308 +demineralizer systems, 1999 V2: 295, 300, 2000 V3: 46–47 demolition work, in plumbing cost estimation, 2004 V1: 93 Denoncourt, 1999 V2: 325 +dens, DENS (density). See density density (dens, DENS, RHO) +measurements, 2004 V1: 33 of natural gas, 1999 V2: 180 symbols for, 2004 V1: 14 +dental equipment, 2000 V3: 39, 51 department connections, 2004 V1: 12 departments having jurisdiction, 2004 V1: 22 dependent functionality +defined, 2004 V1: 225 +in FAST approach, 2004 V1: 230 depolarization, defined, 2004 V1: 152 depolarizing cathodes, 2004 V1: 145 deposition corrosion, defined, 2004 V1: 152 +deposits from feed water, 1999 V2: 289–290. See also scale and scale formation; sediment; slime; sludge +depth (dp, DP, DPTH) +of leaching trenches, 1999 V2: 222 +of liquids in septic tanks, 1999 V2: 230 +of media beds in sand filters, 2000 V3: 132 of reflecting pools, 2000 V3: 107 +of septic tanks, 1999 V2: 228 of soils, 1999 V2: 219 symbols for, 2004 V1: 14 +of water pipes, 1999 V2: 251 of wells, 1999 V2: 240 +depth filters, 1999 V2: 308 +Index + + +derived units of measurement, 2004 V1: 33 description in value engineering phases, 2004 V1: 214 descriptive specifications, 2004 V1: 66 +desiccant air dryers, 2000 V3: 204, 207 design +for people with disabilities, 2004 V1: 107 reducing corrosion, 2004 V1: 146 seismic, 2004 V1: 160–161, 186–188 value engineering and, 2004 V1: 212 +design areas for sprinkler systems, 2000 V3: 16 design density, 2000 V3: 15 +design development phase (DD), 2004 V1: 64 design flow in gas boosters, 1999 V2: 182 +Design Information for Large Turf Irrigation Systems, 2000 V3: 105 +Design of Hoffman Industrial Vacuum Cleaning Systems, 1999 V2: 277 +design standards, 2004 V1: 66 design storms, 2000 V3: 242–244 desolver tanks, 1999 V2: 307 +destruction phase in ozonation, 1999 V2: 313 destructive forces in pipes. See water hammer details in projects, checklists, 2004 V1: 220 detector-check water meters, 1999 V2: 116 detectors, smoke, 2004 V1: 22 +detention centers, numbers of fixtures for, 2003 V4: 20 detention systems for storm water, 1999 V2: 105–107, 107 detention times for treated water, 1999 V2: 294 detergents +factors in trap seal loss, 1999 V2: 36 high-expansion foam, 2000 V3: 21 in septic tanks, 1999 V2: 230 venting for, 1999 V2: 36–37, 39 +developed length, 2004 V1: 22 developers +perception of engineering, 2004 V1: 260 value engineering and, 2004 V1: 212 +development costs defined, 2004 V1: 222 +in value engineering, 2004 V1: 212 Development phase in value engineering +activities, 2004 V1: 235, 243, 254 +idea development and estimated cost forms, 2004 V1: 241–242 +in process, 2004 V1: 213 sketches, 2004 V1: 254, 255 +Development Presentation phase in value engineering, 2004 V1: 213 +deviations in measurements, 2004 V1: 32 +dew-point temperature (dpt, DPT), 2004 V1: 14 dew points +defined, 2004 V1: 22, 2000 V3: 201 lowering, 2000 V3: 204 +medical gas system tests, 2000 V3: 83 monitors, 2000 V3: 66 +refrigerated air dryers, 2000 V3: 207 dezincification of brass, 2004 V1: 141 DFRAD (diffuse radiation), 2004 V1: 14 +dfu (drainage fixture units), 2004 V1: 24, 1999 V2: 64 DHEC (Department of Health and Environmental +Control), 1999 V2: 170 DI (deionization), 1999 V2: 300 + +295 + + +dia., DIA (diameters). See diameters diagnostic facilities, 1999 V2: 340 dialogue in FAST approach, 2004 V1: 231 dialysis machines, 2000 V3: 39 +Diameter-Index Safety System (CGA V-5), 2000 V3: 83, 86 diameters (dia., DIA) +defined, 2004 V1: 22 inside (ID), 2004 V1: 14 outside (OD), 2004 V1: 14 symbols for, 2004 V1: 14 +diaper changing stations, 2003 V4: 23 diaphragm gauges, 1999 V2: 260 diaphragm pumps, 1999 V2: 259 +diaphragm reciprocating compressors, 2000 V3: 201 diaphragm tanks, 2000 V3: 21 +diaphragm valves, 2004 V1: 22, 1999 V2: 332 diaphragms +defined, 2004 V1: 22 +in deluge valves, 2000 V3: 14 diatomaceous earth filtration +advantages and disadvantages, 1999 V2: 318 compared to sand filtration, 2000 V3: 135–137 maintenance, 2000 V3: 112 +materials for filter tanks, 2000 V3: 131 overview, 2000 V3: 134–135 +pressure and vacuum filters, 2000 V3: 132, 141 swimming pool usage, 2000 V3: 130, 131 +types of, 2000 V3: 139 die-cast metals, 2000 V3: 33 +dielectric fittings, 2004 V1: 22 +dielectric insulation, 2004 V1: 146, 2004 V1:151 dielectric isolation, 2000 V3: 116 +dielectric unions, 2000 V3: 156 diesel drivers, 2000 V3: 25 diesel engines, 2000 V3: 26 diesel fuel, 1999 V2: 13 +diesel-oil systems +aboveground tank systems, 2000 V3: 165–169 connections and access, 2000 V3: 166 construction, 2000 V3: 165 +corrosion protection, 2000 V3: 165 filling and spills, 2000 V3: 166–167 +leak prevention and monitoring, 2000 V3:167–168 materials, 2000 V3: 165 +overfill prevention, 2000 V3:167 +product dispensing systems, 2000 V3:168 tank protection, 2000 V3:169 +vapor recovery, 2000 V3:168 venting, 2000 V3:167 +codes and standards, 2000 V3: 154 components, 2000 V3: 155 +definitions and classifications, 2000 V3: 153–154 designing +installation considerations, 2000 V3:172–173 piping materials, 2000 V3:169 +piping sizing, 2000 V3:169–170 submersible pump sizing, 2000 V3:170 testing, 2000 V3:170–172 +overview, 2000 V3: 153 references, 2000 V3:173 resources, 2000 V3:173 +underground tank systems, 2000 V3: 155–165 +296 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +leak detection and system monitoring, 2000 V3: 158–163 +product dispensing systems, 2000 V3: 163–165 storage tanks, 2000 V3: 155–158 +vapor recovery systems, 2000 V3: 163 dietary services in health-care facilities, 2000 V3: 32 diethylhydroxylamine, 1999 V2: 315 +diff., DIFF (difference or delta), 2004 V1: 14 difference (diff., (, DIFF, D, DELTA), 2004 V1: 14 differential aeration cells, 2004 V1: 152 +differential environmental conditions, corrosion by, 2004 V1: 141 +differential movement in earthquakes, 2004 V1: 161 differential pressure +in sand filtration, 2000 V3: 113 +in sizing steam traps, 2000 V3: 193 differential regulators, 2000 V3: 251 differentials, defined, 2004 V1: 22 +difficulties in value engineering presentations, 2004 V1: 258 +diffuse radiation (DFRAD), 2004 V1: 14 diffuser plates, 2000 V3: 120 +diffusion aerators, 1999 V2: 293, 318 diffusion wells, 1999 V2: 105 digestion, 2004 V1: 22 +digits, 2004 V1: 32 dikes +for aboveground storage tanks, 2000 V3: 165, 167 for hazardous waste areas, 2000 V3: 90 +for leaching trenches, 1999 V2: 223 dilution air, defined, 1999 V2: 213 dilution, pollution and, 2000 V3:87 dimensions +in creativity checklist, 2004 V1: 234 defined, 2004 V1: 32 +wheelchairs, 2004 V1: 108 DIN 52218, 2004 V1: 194 +dir radn, DIR RADN (direct radiation), 2004 V1: 14 DIRAD (direct radiation), 2004 V1: 14 +direct-acting gas regulators, 2000 V3: 250 +direct-count epifluorescent microscopy, 1999 V2: 282 direct current (dc, DC) +cathodic protection, 2004 V1: 147 in deionization, 1999 V2: 306 symbols for, 2004 V1: 14 +direct-fill ports, 2000 V3: 156 +direct-filtration package plants, 1999 V2: 318 +direct-fired gas water heaters, 2004 V1: 130, 2000 V3: 138, 146 +direct-operated pressure-regulated valves, 1999 V2: 153 direct pump water supplies, 2000 V3: 8 +direct radiation (dir radn, DIR RADN, DIRAD), 2004 V1: 14 +directly-heated, automatic storage water heaters, 1999 V2: 160 +dirt cans for vacuum systems, 1999 V2: 268 dirt in feed water, 1999 V2: 289 +dirty filters, 2000 V3: 115 dirty gas, 2000 V3: 250 +disabled individuals. See people with disabilities disc water meters, 1999 V2: 116 +discharge characteristic fixture curves, 1999 V2: 3 + +discharge coefficients, 2004 V1: 5 discharge curves, 2000 V3: 220 discharge permits, 2000 V3: 88 +discharge piping for vacuum cleaning systems, 1999 V2: 274 +discharge times in fire suppression, 2000 V3: 23 discharge-type check valves, 1999 V2: 179 disconnect switches for pumps, 2000 V3: 120 +discontinuous regulation in air compressors, 2000 V3: 205 discs, defined, 2004 V1: 22 +discussions in FAST approach, 2004 V1: 231 dished ends on tanks, 2000 V3: 156 dishwashers +acoustic ratings of, 2004 V1: 195 defined, 2004 V1: 22 +fixture-unit loads, 1999 V2: 3 health-care facilities, 2000 V3: 36 +heat recovery systems, 2004 V1: 266 water fixture unit values, 2000 V3: 217 water temperatures, 2000 V3: 45 +disinfecting +codes for, 2004 V1: 43 +cold-water systems, 1999 V2: 154–155 decontaminating infectious wastes, 1999 V2: 344–345 disinfectant residuals, 2000 V3: 122 +drinking water, 1999 V2: 245 +feed water, 1999 V2: 289, 311–313 gray water, 1999 V2: 23, 27 +reflecting pools and fountains, 2000 V3: 123 septic tanks, 1999 V2: 230 +small drinking water systems, 1999 V2: 318 swimming pools +algaecides, 2000 V3: 150 +aluminum sulfate, 2000 V3: 149–150 breakdown chlorination, 2000 V3: 149 calcium hypochlorite, 2000 V3: 148–149 +chemical feeding equipment, 2000 V3: 150–151 chlorine gas, 2000 V3: 148 +cleaning filters, 2000 V3: 150 cyanurates, 2000 V3: 149 +sodium hypochlorite, 2000 V3: 149 sulfuric acid, 2000 V3: 150 superchlorination, 2000 V3: 149 +water systems, 1999 V2: 252 Disinfecting, 2003 V4: 32 +Disinfection of Escherichia Coli by Using Water Dissociation Effect on Ion Exchange Membranes, 1999 V2: 325 +disintegrations per second (dps), 1999 V2: 338, 339 disk filters, 1999 V2: 308 +dispenser pans, 2000 V3: 165 dispensers +aboveground tanks, 2000 V3: 168 +fuel product dispensers, 2000 V3: 164–165 high-rate dispensers, 2000 V3: 169 multiple dispenser flow rates, 2000 V3: 170 +dispersed oil, 1999 V2: 347 displacement +defined, 2004 V1: 22 +in earthquakes, 2004 V1: 159 swimming pools, 2000 V3: 143 water meters, 1999 V2: 117 +Index + + +displays in fountains +display piping, 2000 V3: 111–112 filtration turnover, 2000 V3: 110 height of, 2000 V3: 120 +piping for, 2000 V3: 119 pumps, 2000 V3: 113–115 remote controls, 2000 V3: 120 selecting, 2000 V3: 108–110 types of, 2000 V3: 111 +weirs and waterfalls, 2000 V3: 109 +disposal fields (sewage). See leaching trenches (leach fields) disposal wells in geothermal energy, 2004 V1: 131 disposers. See food waste grinders +DISS connectors, 2000 V3: 83 +dissolved elements and materials in water dissolved gases, 1999 V2: 284, 294, 314 dissolved inorganics, 1999 V2: 288 dissolved metals, 2000 V3: 93 dissolved minerals, 1999 V2: 314 dissolved oil, 1999 V2: 347 +dissolved organics, 1999 V2: 300 dissolved oxygen, 2000 V3: 93 dissolved solids, 1999 V2: 288 +distances in standpipe systems, 2000 V3: 18 distilled water (DL) +distillation treatment, 1999 V2: 295–298, 299 health-care facility stills, 2000 V3: 39 producing, 2000 V3: 46 +symbols for, 2004 V1: 8 distribution boxes, 1999 V2: 223, 231 +distribution gray-water pumps, 2004 V1: 267 distribution of wealth, 2004 V1: 224 +distribution system in seepage beds, 1999 V2: 224 ditches, 2000 V3: 247–248 +divergent thinking +in creativity, 2004 V1: 231–235 in evaluation, 2004 V1: 235 +diversity factor +compressed air tools, 2000 V3: 208 defined, 1999 V2: 213 +health-care facility systems, 2000 V3: 45 liquid fuel piping, 2000 V3:170 +medical gas, 2000 V3: 50, 75 medical vacuum, 2000 V3: 54, 55, 75 +natural gas systems, 1999 V2: 176–177, 194, 195, 2000 V3: 249, 253 +nitrogen systems, 2000 V3: 74, 75 nitrous oxide, 2000 V3: 75 oxygen, 2000 V3: 75 +vacuum systems, 1999 V2: 262–263, 263 diverter plates, 2000 V3: 119–120 +diverters, spray accessories on sinks, 2003 V4: 14 diving pools, 2000 V3: 128, 143 +divinyl benzene, 1999 V2: 302 division in SI units, 2004 V1: 34 +Divisions in MasterFormat 2004, 2004 V1: 65, 77–88 DL. See distilled water (DL) +DN (nominal diameter), 1999 V2: 253 DNA materials, 1999 V2: 344 +docks, 1999 V2: 147 +dolomite limestone chips, 1999 V2: 334 dome grates in shower rooms, 1999 V2: 11 + +297 + + +dome roof drains, 1999 V2: 80 dome strainers, 1999 V2: 82 domestic sewage, 2004 V1: 22 +domestic spaces, acoustic plumbing design for, 2004 V1: 196 +domestic systems. See domestic water supply; residential systems +Domestic Water Heating Design Manual, 1999 V2: 166, 2000 V3: 45 +domestic water supply +codes and standards, 2000 V3: 216 +combined with fire-protection supply, 2000 V3: 225– 226 +health-care facilities, 2000 V3: 43–48 overview, 2000 V3: 216 +preliminary information, 2000 V3: 215–216 service components and design, 2000 V3: 217–224 +backflow prevention, 2000 V3: 221–224 elevation differences, 2000 V3: 224 piping runs, 2000 V3: 221 +strainer losses, 2000 V3: 224 taps, 2000 V3: 221 +valves and fittings, 2000 V3: 221 water meters, 2000 V3: 224 +water pressure, 2000 V3: 217–221 service connection, 2000 V3: 221 system requirements, 2000 V3: 216–217 water fixture unit values, 2000 V3: 217 water mains, 2000 V3: 216 +water utility letters, 2000 V3: 216, 256 doors, accessibility and, 2004 V1: 113, 114, 115 dope, pipe, 1999 V2: 284 +dormitories +acoustic plumbing design for, 2004 V1: 196 numbers of fixtures for, 2003 V4: 20, 21 +doses of radiation, 1999 V2: 339 dosimeters, 1999 V2: 339 dosing tanks, 2004 V1: 22 +dot products, defined, 2004 V1: 93 +DOTn. See U.S. Department of Transportation (DOTn) double. See also entries beginning with dual-, multiple-, or +two- +double-acting altitude valves, 1999 V2: 249 +double-acting cylinders in compressors, 2000 V3: 201 double-check backflow preventers (DCBP), 2004 V1: 10 double-check valve assemblies, 1999 V2: 144, 145, 149 double-check valves (DCV), 2000 V3: 223, 224, 226 double-compartment sinks, 2003 V4: 11, 12 +double-contained piping systems, 1999 V2: 345, 346, 2000 V3: 40, 162–163 +double-contained tanks, 2000 V3: 156 double discs, 2004 V1: 22 +double extra-strong steel pipe, 2003 V4: 48 double-leaf barriers, 2004 V1: 193 +double offsets, 2004 V1: 22 double-ported valves, 2004 V1: 22 +double-seated pressure-regulated valves, 1999 V2: 152 double-side-entry fittings, 1999 V2: 62 +double-sweep tees, 2004 V1: 22 +double tees, 2000 V3: 119–120, 2003 V4: 6–7 double-wall piping, 1999 V2: 327 +double-wall tanks, 2000 V3: 156 +298 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +double wedges, 2004 V1: 22 +double wyes, common vents and, 1999 V2: 43 Dow Chemical Corp., 1999 V2: 325 +down, defined, 2004 V1: 22 downfeed risers, 2000 V3: 185 +downspouts and leaders. See also vertical stacks defined, 2004 V1: 22, 26 +roof drainage systems, 1999 V2: 81, 85–88 roof expansion and, 1999 V2: 85 +roof leaders, 1999 V2: 87 sizing, 1999 V2: 81 +downstream, defined, 2004 V1: 22 downward-tapered weirs, 2000 V3: 109 dp, DP (depth). See depth +dps (disintegrations per second), 1999 V2: 338, 339 dpt, DPT (dew-point temperature), 2004 V1: 14 DPTH (depth). See depth +draft hoods on appliances, 1999 V2: 178, 213 drain bodies. See sumps and sump pumps drain cleaners in septic tanks, 1999 V2: 230 drain-down times, 1999 V2: 94 +drain fields. See leaching trenches (leach fields) drain line carry tests, 2003 V4: 6 +drain outlets, types of, 1999 V2: 17–18 drain tiles, 1999 V2: 221 +drain valves, 2000 V3: 103, 191 +drain, waste, and vent branches (DWV), 1999 V2: 19, 54, 60 +drain, waste, and vent pipes (DWV) copper drainage tube, 2003 V4: 45 copper pipe, 2003 V4: 36 +defined, 2004 V1: 23 +DWV pattern schedule 40 plastic piping, 1999 V2: 14 DWV piping, 1999 V2: 68 +glass pipe, 2003 V4: 47 plastic pipes, 2003 V4: 58 PVC pipes, 2003 V4: 62 +drain, waste, and vent stacks (DWV) copper, 2003 V4: 34 +DWV stacks, 1999 V2: 19, 54, 60 +drainage channels, irrigation systems and, 1999 V2: 26 drainage (corrosion), defined, 2004 V1: 152 +drainage fittings, 2004 V1: 22 +drainage fixture units (dfu), 2004 V1: 24, 1999 V2: 64. See also fixture units and unit values +drainage inlets in site storm systems, 1999 V2: 98 drainage piping +acoustic ratings of fixtures, 2004 V1: 194 copper pipe, 2003 V4: 34 +glass pipe, 2003 V4: 45 +nonreinforced concrete pipe, 2003 V4: 32 drainage structures +defined, 2000 V3: 234–236 manholes, 2000 V3: 234–236 +drainage systems. See also specific types of drainage systems +air compressor systems, 2000 V3: 213 condensate drainage, 2000 V3: 189–197 defined, 2004 V1: 22, 1999 V2: 1 +health-care facilities, 2000 V3: 39–42 laboratories +acid-waste drainage, 2000 V3: 39–40 + +acid-waste metering, 2000 V3: 41–42 +acid-waste solids interceptors, 2000 V3: 41, 43 acidic-waste neutralization, 2000 V3: 40–41 corrosive-waste piping materials, 2000 V3: 40 discharge to sewers, 2000 V3: 40 +sink traps, 2000 V3: 42 +waste and vent piping, 2000 V3: 42 +reflecting pools and fountains, 2000 V3: 112, 125 storm water, 2000 V3: 245–247 +swimming pools, 2000 V3: 131, 143 +drainage, waste, and vents (DWV). See drain, waste, and vent +drainline heat reclamation, 2004 V1: 134 +drains (D). See also building drains; horizontal drains; specific types of drains +defined, 2004 V1: 22 multilevel pools, 2000 V3: 108 +pools and fountains, 2000 V3: 110 secondary containment areas, 2000 V3: 90 symbols for, 2004 V1: 11 +drawdowns (wells), 1999 V2: 242, 245 drawings, plumbing. See plumbing drawings drawn temper (hard), 2003 V4: 37, 45 +drawoff installations. See specific kinds of interceptors drench equipment for emergencies, 1999 V2: 332 drench showers, 2000 V3: 32, 37 +dressing facilities, 2000 V3: 130 drift +defined, 2004 V1: 22 +problems in seismic protection, 2004 V1: 190 drilled anchor bolts, 2004 V1: 163, 190 +drinking fountains +access to, 2004 V1: 109–112 energy use, 2004 V1: 266 +gray-water systems, 2004 V1: 135 health-care facilities, 2000 V3: 32, 33, 38 minimum numbers of, 2003 V4: 18–22 standards, 2003 V4: 2 +swimming pool bathhouses, 2000 V3: 130 types, 2003 V4: 14 +water fixture unit values, 2000 V3: 217 wheelchair approaches, 2004 V1: 112 +drinking water +amount of, 2004 V1: 263 chilled systems, 2004 V1: 265 +drinking water supply (DWS), 2004 V1: 8 +drinking water supply recirculating (DWR), 2004 V1: 8 drinking water systems. See private water systems health-care facilities, 2000 V3: 43, 45 +material codes, 2004 V1: 43 potable water, 2004 V1: 27, 263 +treatments for, 1999 V2: 316–317, 318 drip irrigation, 2004 V1: 266 +drip lips on weirs, 2000 V3: 109 drip pots, 2000 V3: 252 +drive impellers in gas boosters, 1999 V2: 179 drive points, 1999 V2: 241 +driven wells, 1999 V2: 241 droop, 2004 V1: 22 +drop elbows, 2004 V1: 22 +drop manholes, 2000 V3: 234, 238 +drop nipples on pendant sprinklers, 2004 V1: 13 +Index + + +drop tees, 2004 V1: 23 +drop tubes, 2000 V3: 157, 163 drops, 2004 V1: 11, 22, 2000 V3: 156 dross, 2004 V1: 23 +drug rooms, 2000 V3: 35 drum traps, 2000 V3: 42 dry (DRY), 2004 V1: 14 +dry acid (sulfuric acid), 2000 V3: 150 +dry-bulb temperature (dbt, DBT, DB), 2004 V1: 14, 23 dry cast pipe, 2003 V4: 32 +dry-chemical extinguishing systems, 2000 V3: 19–20, 27 Dry Chemical Extinguishing Systems (NFPA 17), 2000 V3: +20, 29 +dry chlorine, 2000 V3: 123 dry gas, 2000 V3: 254 +dry hose stations, 2004 V1: 13 dry ice, 2000 V3: 20 +dry nitrogen, 2000 V3: 20, 252 +dry pendent sprinklers, 2004 V1: 29 dry-pipe systems +accelerators, 2000 V3: 12–13 air compressors, 2000 V3: 12 +combined dry-pipe and pre-action systems, 2000 V3: 15 defined, 2004 V1: 29 +normal conditions, 2000 V3: 11–12 riser diagram, 2000 V3: 11 sprinklers, 2000 V3: 9–13 +dry-pipe valves, 2004 V1: 13, 23 +dry-powder extinguishing systems, 2000 V3: 20 dry pumps, 2000 V3: 113, 115 +dry returns, 2000 V3: 178–179, 183 dry standpipes, 2004 V1: 13, 30 +dry-storage water softeners, 1999 V2: 307 dry surfaces, 2004 V1: 16 +dry upright sprinklers, 2004 V1: 29 +dry-vacuum cleaning systems (DVC), 2004 V1: 9, 1999 V2: 266, 268, 275–276, 2000 V3: 69 +dry venting, reduced-size venting and, 1999 V2: 49 dry-weather flows, 2004 V1: 23 +dry wells (leaching wells), 2004 V1: 26, 2000 V3: 247 dryers in laundry facilities, 2000 V3: 36 +du Moulin, G.C., 1999 V2: 325 +dual. See also entries beginning with double-, multiple-, or two- +dual-bed deionization (two-step), 1999 V2: 302, 303 dual-flush water closets, 2004 V1: 136, 265 +dual-gas booster systems, 1999 V2: 181 dual sensors, 2000 V3: 125 +dual vents (common vents), 2004 V1: 21. See also common vents +dual water-supply systems, 2000 V3: 43 +ductile action of building systems, 2004 V1: 183 ductile iron fittings, 1999 V2: 196, 2000 V3: 116 ductile iron grates, 1999 V2: 15 +ductile iron piping +characteristics and standards, 2003 V4: 32–33 curve radii for, 1999 V2: 250 +radioactive waste and, 1999 V2: 341 sizing, 1999 V2: 89–92, 2000 V3: 245 underground piping, 1999 V2: 68 +ducts. See vents and venting systems dug wells, 1999 V2: 240 + +299 + + +Dumfries Triangle and Occoquan-Woodbridge Sanitary District, 1999 V2: 34 +dump loads, 2000 V3: 45 Dunleavy, M., 1999 V2: 325 +duplex. See also entries beginning with double-, dual-, or two- +duplex air compressors, 2000 V3: 66, 213 duplex bed pressure swing dryers, 2000 V3: 204 duplex manifolds, 2000 V3: 63, 65 +duplex sump pump systems, 1999 V2: 9, 69, 105 +duplex vacuum pump arrangements, 1999 V2: 262, 263 duration of rainfall, 1999 V2: 69–78, 2000 V3: 244 Durham systems, 2004 V1: 23 +durion, 2004 V1: 23 +duty cycles, 2000 V3: 206, 207, 211 duty-cycling controls, 2000 V3: 67, 70 +DVC (dry vacuum cleaning), 2004 V1: 9, 1999 V2: 266, 268, 275–276 +dwellings. See buildings +DWR (drinking water supply recirculating), 2004 V1: 8 DWS (drinking water supply), 2004 V1: 8 +DWV. See drain, waste, and vent stacks (DWV) DWV piping, 2003 V4: 36, 45 +dye tests, 2003 V4: 5, 9 +dyes in gray water, 1999 V2: 22, 29, 33 dynamic air compressors, 2000 V3: 65, 66, 201 dynamic fountain displays, 2000 V3: 111, 119 dynamic head, 1999 V2: 245 +dynamic pressure, 2004 V1: 15 +dynamic properties of piping, defined, 2004 V1: 191 dynamic response (K) to ground shaking, 2004 V1: 159, +161 dynamic viscosity +converting to SI units, 2004 V1: 39 measurements, 2004 V1: 33 +dyne, converting to SI units, 2004 V1: 39 + +E +E (exa) prefix, 2004 V1: 34 +E (roughness), 2004 V1: 16. See also roughness E (volts). See volts +E-33.08B (Plumbing Noise), 2004 V1: 194 early flame knockdown, 2000 V3: 20 +early-suppression fast-response systems (ESFR), 2000 V3: 2 +earth loads +on water pipes, 1999 V2: 250 in pipe selection, 2003 V4: 26 protecting against, 1999 V2: 18 +earthquake protection of plumbing equipment. See seismic protection +Earthquake Resistance of Buildings, 2004 V1: 191 Earthquake Resistant Design Requirements Handbook, +2004 V1: 191 +Eaton, Herbert N., 1999 V2: 4, 19, 38 eccentric fittings, 2004 V1: 23 +eccentric reducers, 2004 V1: 10, 2000 V3: 115 eccentricity in connections, 2004 V1: 189 +economic concerns. See costs and economic concerns Economic Thickness of Insulation, 2004 V1: 127 economic values, 2004 V1: 213–214 +Eddy, 1999 V2: 238 +300 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +edge distances, problems in seismic protection, 2004 V1: 190 +edr, EDR (equivalent direct radiation), 2004 V1: 14, 39, 2000 V3: 178, 180 +educating public on gray-water systems, 1999 V2: 33 educational facilities. See schools +eff, EFF (efficiency). See efficiency effect water in fountains, 2000 V3: 124 effective openings, 2004 V1: 23 +effective temperature (ET*, ET), 2004 V1: 14 effectiveness (EFT), 2004 V1: 14 +effects in multi-effect distillation, 1999 V2: 298 effects of earthquakes, 2004 V1: 156–158 efficiency (eff, EFF) +fin (FEFF), 2004 V1: 14 surface (SEFF), 2004 V1: 14 symbols for, 2004 V1: 14 thermal, 2004 V1: 136 +effluent +asbestos concrete piping, 2003 V4: 26 +chemicals in special-waste effluent, 1999 V2: 328 defined, 2004 V1: 23 +estimating sewage quantities, 1999 V2: 233–238 layers of in septic tanks, 1999 V2: 227 +samples of radioactive waste effluent, 1999 V2: 342 special-waste drainage systems, 1999 V2: 327 temperature of special-waste effluent, 1999 V2: 328 treatment of sewage effluent, 1999 V2: 227–228 +Effluent Guideline program, 2000 V3: 88–89 EFT (effectiveness), 2004 V1: 14 +Egozy, 1999 V2: 325 +EJ (expansion joints). See expansion joints EJCDC (Engineers Joint Contract Documents +Committee), 2004 V1: 63 ejector pumps and pits, 2000 V3: 236 ejectors +fixture-unit values, 1999 V2: 9 +in sanitary drainage systems, 1999 V2: 9 EL (elevation). See elevation +elastic limits, 2004 V1: 23 +elastic rebound theory, 2004 V1: 158 elastic vibration in pipes, 2004 V1: 6 elasticity of plastic pipes, 2003 V4: 60 elastomeric seals or gaskets +radiation and, 1999 V2: 341 reinforced concrete pipe, 2003 V4: 32 swimming pools, 2000 V3: 144 +water closets, 2003 V4: 6 elbows +ells, 2004 V1: 23 +risers up or down, 2004 V1: 10 elderly +aging disabilities, 2004 V1: 107 fixtures and, 2004 V1: 107 +electric capacitance measurements, 2004 V1: 33 electric charge density measurements, 2004 V1: 33 electric fire pumps, 2000 V3: 26 +electric hot-water heaters, 2004 V1: 129–130 electric inductance, 2004 V1: 33 +electric instantaneous water heaters, 2004 V1: 265 electric irrigation valves, 2000 V3: 103 +electric-operated, solenoid valve trap primers, 1999 V2: 14 + +electric permeability measurements, 2004 V1: 33 electric permitivity measurements, 2004 V1: 33 electric resistance, 2004 V1: 33 +electric-resistance welding (ERW), 2003 V4: 48 electric resistivity measurements, 2004 V1: 33 electric vaporizers, 2000 V3: 61 +electric water heaters, 1999 V2: 158–159, 2000 V3: 121 electrical components in gas boosters, 1999 V2: 179 electrical connections for pool heaters, 2000 V3: 138 electrical engineers, 2000 V3: 27–28 +electrical equipment fires, 2000 V3: 21 +installation of pipe and, 2003 V4: 25 electrical makeup water method, 2000 V3: 124 electrical phases, 2004 V1: 15 +electricity +conversion factors, 2004 V1: 35 measurements, 2004 V1: 33 +off-peak power savings, 2004 V1: 128–129 electrochemical equivalents in corrosion, 2004 V1: 139 Electrochemical Society, 2004 V1: 153 electrodeionization, 1999 V2: 306–307 +electrodes, defined, 2004 V1: 152 +electrolysis, 2004 V1: 23. See also galvanic action electrolytes +defined, 2004 V1: 139, 152, 1999 V2: 280 specific resistance, 1999 V2: 285–287 +electromagnetic radiation, 1999 V2: 338 electrometric compression liners, 2003 V4: 48 electromotive force (emf, EMF) +counter-e.m.f.s, 2004 V1: 153 electromotive force series, 2004 V1: 144 measurements, 2004 V1: 33 +symbols for, 2004 V1: 14 +electromotive force series, 2004 V1: 144, 152 electron microscopes, 2000 V3: 38, 39, 45, 51 electronegative potential, 2004 V1: 153 electronic grade water, 2003 V4: 58 electronic product level gauges, 2000 V3: 168 electronic tank gauging, 2000 V3: 160 electronics-grade water, 1999 V2: 317, 320 +electroplating wastewater treatment, 2000 V3: 94 electropositive potential, 2004 V1: 153 electroregeneration, 1999 V2: 307 +elements in water, 1999 V2: 281 elev., ELEV (elevation). See elevation +elevated water storage tanks, 1999 V2: 247 elevated water supplies, 2000 V3: 8 elevation (elev., EL, ELEV) +adjustments for vacuum, 1999 V2: 257, 275 air compressors and, 2000 V3: 66 +altitude (alt, ALT), 2004 V1: 14 altitude valves, 1999 V2: 249 compressed air and, 2000 V3: 199, 211 +medical vacuum systems and, 2000 V3: 69 pressure losses and, 2000 V3: 224 +in sprinkler hydraulic calculations, 2000 V3: 17 symbols for, 2004 V1: 14 +elevator shafts +medical gas piping and, 2000 V3: 73 protection systems, 2000 V3: 25 +ellipses, calculating area, 2004 V1: 4 +Index + + +ells (elbows), 2004 V1: 23 +elongated bowls on water closets, 2003 V4: 4 elutriation, 2004 V1: 23 +embedments, problems in seismic protection, 2004 V1: 190 emergency drains for pools and fountains, 2000 V3: 125 emergency equipment for acid spills, 1999 V2: 332, 333 emergency fixtures +emergency eyewashes, 2003 V4: 17–18 emergency showers, 2003 V4: 17–18 +floor drains (copy all HERE), 2003 V4: 17 standards, 2003 V4: 2 +Emergency Planning and Community Right-To-Know Act (EPCRA) (SARA Title III), 2000 V3: 154 +emergency power for fire pumps, 2000 V3: 26 emergency rooms, 2000 V3: 32 +fixtures, 2000 V3: 35 +medical gas stations, 2000 V3: 51, 58 medical vacuum, 2000 V3: 54 +water demand, 2000 V3: 45 emergency showers, 2000 V3: 32, 37 +emergency shutoffs for fuel dispensers, 2000 V3: 165 emergency tank vents, 2000 V3: 166, 167 +e.m.f. series, 2004 V1: 144, 152 +emitters in irrigation systems, 1999 V2: 27 empirical tank capacity equation, 1999 V2: 151 +employee facilities, numbers of fixtures for, 2003 V4: 20, 21 emptying noises, acoustic design and, 2004 V1: 195 emulsions, 1999 V2: 347 +enameled cast iron fixtures defined, 2003 V4: 1–2 +health care facilities, 2000 V3: 33 standards, 2003 V4: 2 +enameled floor drains, 1999 V2: 16 enameled sediment buckets, 1999 V2: 14 enclosures for showers, 2004 V1: 120 +The Encyclopedia of Chemical Technology, 2000 V3: 97 end connections, 2004 V1: 23 +end-head flows, 2000 V3: 17, 18 end-of-main vents, 2000 V3: 180 +end-suction pumps, 2004 V1: 24, 2000 V3: 115, 142 end-use restrictions +conserving energy, 2004 V1: 126 reduced water usage, 2004 V1: 126 +end venting, 1999 V2: 41 endotoxins, 1999 V2: 282, 288 energy +conversion factors, 2004 V1: 35 defined, 2004 V1: 137 measurements, 2004 V1: 33 non-SI units, 2004 V1: 34 +nondepletable, 2004 V1: 130–131, 137 recovered, 2004 V1: 137 +Energy & Atmosphere design (LEED), 2004 V1: 263 energy code list of agencies, 2004 V1: 42 +energy conservation. See conserving energy energy efficiency. See conserving energy +Energy Policy Act (EPACT), 2004 V1: 124, 136, 264 Energy Policy and Conservation Act (EPCA), 2004 V1: 124 Energy Saving and the Plumbing System, 2004 V1: 137 enflurane, 2000 V3: 70 +engineered dry-chemical systems, 2000 V3: 19 Engineered Plumbing Design, 2004 V1: 40, 1999 V2: 114 + +301 + + +engineered plumbing systems, 2004 V1: 23 engineering and design costs, 2004 V1: 212 +Engineering Manual of the War Department, 1999 V2: 97, 114 +Engineers Joint Contract Documents Committee (EJCDC), 2004 V1: 63 +engines, earthquake protection for, 2004 V1: 164 entering (entr, ENT), 2004 V1: 14 +enthalpy (H), 2004 V1: 14 entr (entering), 2004 V1: 14 entropy (S) +measurements, 2004 V1: 33 symbols for, 2004 V1: 14 +environmental conditions, corrosion by, 2004 V1: 141 environmental design, 2004 V1: 263–267 +Environmental Protection Agency. See U.S. Environmental Protection Agency +Environmental Quality design (LEED), 2004 V1: 263 environs (facilities with radiation), 1999 V2: 339 EPA. See U.S. Environmental Protection Agency +The EPA Effluent Guidelines Series (EPA 440), 2000 V3: 96 +EPACT (Energy Policy Act), 2004 V1: 124, 136, 264 +EPCA (Energy Policy and Conservation Act), 2004 V1: 124 EPCRA (Emergency Planning and Community Right-To- +Know Act) (SARA Title III), 2000 V3: 154 +EPDM (ethylene-propylene diene monomer), 2003 V4: 37 epicenters of earthquakes, 2004 V1: 156 +epicyclic gears, 2004 V1: 196 +epm (equivalents per million), 1999 V2: 285 epoxy +as thermoset, 2003 V4: 58 +coatings, 2004 V1: 147, 2000 V3: 169 linings for pipes, 2003 V4: 26 +EQFT (equivalent feet), 2004 V1: 14 EQIN (equivalent inches), 2004 V1: 14 +eqiv ft, EQIV FT (equivalent feet), 2004 V1: 14 eqiv in, EQIV IN (equivalent inches), 2004 V1: 14 equalization fittings, 2000 V3: 137 +equalizer lines, 2000 V3: 108 equations +acfm to scfm, 2000 V3: 65–66 air receiver sizing, 2000 V3: 206 +anode expected life, 2004 V1: 148 areas and volumes, 2004 V1: 3–5 Bernoulli’s equation, 2004 V1: 5–6 +calculating seismic forces, 2004 V1: 183–186 collection legs in condensate drainage, 2000 V3: 195 condensate loads, 2000 V3: 194 +corrosion rates, 2004 V1: 144 +Darcy’s Law, 2004 V1: 2, 3, 1999 V2: 7 Faraday’s Law, 2004 V1: 144 +flow at outlets, 2004 V1: 3, 5 +flow capacity in vertical stacks, 1999 V2: 4 flow from outlets, velocity of, 2004 V1: 6 flow rates, 2004 V1: 1 +fountain head formulas, 2000 V3: 118 friction head, 2004 V1: 6 +friction head loss, 2004 V1: 2 gas laws, 1999 V2: 179 gravity circulation, 2004 V1: 5 +302 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Hazen-Williams formula, 2004 V1: 2, 1999 V2: 7, 116, 118, 119, 121, 2000 V3: 118 +hot-water systems, 1999 V2: 158 hydrant flow tests, 2000 V3: 5 hydraulic shock, 2004 V1: 6 +International System of Units (SI), 2004 V1: 1 Joukowsky’s formula, 1999 V2: 132 +kinetic energy, 2004 V1: 2 +Manning formula, 2000 V3: 244–245, 246 +alternative sewage-disposal systems, 1999 V2: 226 open-channel flow, 2004 V1: 1, 1999 V2: 7, 8 runoff and, 1999 V2: 97 +site drainage and, 1999 V2: 98 sloping drains, 1999 V2: 8 +storm-drainage pipes, 1999 V2: 88 subsurface drainage rates, 1999 V2: 105 +medical gas pipe sizing, 2000 V3: 74 mixing flows of water, 2004 V1: 126 natural gas systems +natural gas equivalent length, 1999 V2: 184 NFPA formula, 1999 V2: 186, 187, 188, 189 Spitzglass formula, 1999 V2: 183, 210–211 Weymouth formula, 1999 V2: 183, 190, 191, 198– +209 +NFPA formula, 1999 V2: 186, 187, 188, 189 Ohm’s Law, 2004 V1: 144 +pipe expansion and contraction, 2004 V1: 3 plumbing cost estimation, 2004 V1: 93–98 potential energy, 2004 V1: 2 +Prandtl-Colebrook equation, 1999 V2: 60 pump affinity laws, 2004 V1: 6 +pump efficiency, 2004 V1: 6–7 pump noise levels, 2004 V1: 198 +Rational Method formulas, 2004 V1: 7, 1999 V2: 95– 98, 2000 V3: 242 +references, 2004 V1: 40 Reynold’s number, 2004 V1: 2 +site storm drainage, 1999 V2: 88, 95–98, 107–108 soil resistivity, 2004 V1: 150 +Spitzglass formula, 2004 V1: 7, 1999 V2: 183, 210–211 sprinkler demand, 2000 V3: 17 +sprinkler design density, 2000 V3: 16 sprinkler end-head pressures, 2000 V3: 18 square feet EDR, 2000 V3: 178 +stack terminal velocity and length, 2004 V1: 3 steady-state heat balance equations, 1999 V2: 158 steam system traps, 2000 V3: 194–195 +steam warm-up loads, 2000 V3: 195 storm drainage, 2004 V1: 7 +tank capacity empirical equation, 1999 V2: 151 tank capacity rule of thumb equation, 1999 V2: 151 terminal velocity and terminal length, 1999 V2: 1 vacuum system demand, 2000 V3: 70 +value, worth and cost, 2004 V1: 213 velocity head, 2004 V1: 5 +vent piping length, 2004 V1: 3 water flow in pipes, 2004 V1: 2 water hammer, 2004 V1: 198 +well equilibrium equations, 1999 V2: 242–243 Weymouth formula, 2004 V1: 7, 1999 V2: 183, 190, +191, 198–209 +equilibrium equations for wells, 1999 V2: 242–243 + +equipment +acoustic concerns in selection, 2004 V1: 200 defined, 2004 V1: 191 +section in specifications, 2004 V1: 91 seismic protection, 2004 V1: 163–171 +steam and condensate systems, 2000 V3: 178 equivalent direct radiation (edr, EDR) +cast iron radiators, 2000 V3: 180 EDR hot water, 2004 V1: 39 EDR steam, 2004 V1: 39 +operating pressure steam classification, 2000 V3: 178 steam heating, 2000 V3: 178 +symbols for, 2004 V1: 14 +equivalent feet (eqiv ft, EQIV FT, EQFT), 2004 V1: 14 equivalent inches (eqiv in, EQIV IN, EQIN), 2004 V1: 14 equivalent length +compressed air piping, 2000 V3: 211 defined, 1999 V2: 214 +medical gas piping, 2000 V3: 73 natural gas equations, 1999 V2: 184 +equivalent static force, calculating, 2004 V1: 183 equivalent weight, 1999 V2: 280, 281 equivalents per million, 1999 V2: 285 +erosion, 2004 V1: 23, 2000 V3: 47, 99 erosion corrosion, 1999 V2: 290 +ERW (electric-resistance welding), 2003 V4: 48 +ESFR (early-suppression fast-response systems), 2000 V3: 2 +essential facilities, defined, 2004 V1: 191 +estates, septic tank systems for, 1999 V2: 231–232 estimating costs. See also costs and economic concerns +factors in estimates, 2004 V1: 98 +idea development and estimated cost forms, 2004 V1: 241–242 +overestimating, 2004 V1: 224 per-area costs, 2004 V1: 97–98 +per-fixture or per-appurtenance estimates, 2004 V1: 97 plumbing cost estimation, 2004 V1: 93–98 +software for cost estimation, 2004 V1: 98 in value engineering, 2004 V1: 243 +estimating medical gas and vacuum stations, 2000 V3: 50, 51–52 +estimating sewage quantities, 1999 V2: 234, 235, 237 ET*, ET (effective temperature), 2004 V1: 14 +ethylene-propylene diene monomer (EPDM), 2003 V4: 37 ETI (Economic Thickness of Insulation), 2004 V1: 127 EVAC stations, 2000 V3: 51–52 +Evaluation phase in value engineering activities, 2004 V1: 235–243 checklists, 2004 V1: 237–238 comparing functions, 2004 V1: 243 +functional evaluation worksheets, 2004 V1: 243–251 idea evaluation checklist, 2004 V1: 243, 253 +in process, 2004 V1: 213 +second creativity, cost, and evaluation analysis, 2004 V1: 254 +evap, EVAP. See evaporation; evaporators evaporation (evap, EVAP) +staged, 1999 V2: 298 storage tanks, 2000 V3: 172 +swimming pools, 2000 V3: 131 symbols for, 2004 V1: 14 +Index + + +evaporative coolers. See cooling-tower water evaporators (evap, EVAP), 2004 V1: 14, 2000 V3: 46 evapotranspiration +defined, 2004 V1: 23 +in irrigation, 2000 V3: 105 sewage treatment, 1999 V2: 227 +“exa” prefix, 2004 V1: 34 exact conversions, 2004 V1: 32 exam/treatment rooms +fixtures, 2000 V3: 35 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 51 medical vacuum, 2000 V3: 54 +examination section in specifications, 2004 V1: 71, 91 excavation +labor productivity rates, 2004 V1: 95–97 plumbing cost estimation, 2004 V1: 93 +excess air, defined, 1999 V2: 213 excess pressure pumps, 2004 V1: 24 +excess water pressure, 1999 V2: 152–154 +excessive costs, value engineering and, 2004 V1: 212 exchange capacity of resins, 1999 V2: 302 exchangers in distillers, 1999 V2: 298 +Execution section in specifications, 2004 V1: 69, 91–92 exhaust +filters on vacuum systems, 1999 V2: 262 natural gas combustion waste, 1999 V2: 177 pressure loss in vacuum systems, 1999 V2: 274 vacuum exhaust pipe sizing, 1999 V2: 263 +vacuum system piping, 1999 V2: 259, 274, 2000 V3: 70 vacuum system stacks, 2000 V3: 70 +exhausted cartridges in ion exchange, 1999 V2: 305–306 exhausters (dry-pipe systems), 2000 V3: 11 +exhausters (vacuum) +air-bleed controls, 1999 V2: 268–269 defined, 1999 V2: 266–269, 268 locating, 1999 V2: 270 +sizing, 1999 V2: 272, 274–275 +exhibition halls, numbers of fixtures for, 2003 V4: 19 existing work, 2004 V1: 23 +exp, EXP (expansion). See expansion expanded air in vacuums, 1999 V2: 256 expansion (exp, EXP, XPAN) +buildings, 2000 V3: 49 +calculating pipe expansion, 2004 V1: 3 enlargement of water systems, 1999 V2: 249 foam extinguishing agents, 2000 V3: 21 +future expansion of compressed air systems, 2000 V3: 210 +glass pipe, 2003 V4: 48 HDPE pipe, 2003 V4: 61 +hot-water systems and, 1999 V2: 167–168 linear expansion in PVC pipe, 2003 V4: 62 plastic pipe, 2003 V4: 60 +plastic pipe thermal expansion, 1999 V2: 251 protecting against pipe expansion, 1999 V2: 18 roof drains and, 1999 V2: 85, 87 +sanitary drainage systems, 1999 V2: 18 storage tanks and piping, 2000 V3: 172 swimming pool piping, 2000 V3: 145 symbols for, 2004 V1: 14 +thermal expansion tanks, 1999 V2: 167 + +303 + + +water pipes and, 1999 V2: 251–252 expansion bends, 1999 V2: 18 expansion joints (EJ) +defined, 2004 V1: 23 +plastic water pipes, 1999 V2: 251 roofs, 1999 V2: 79, 85, 87 symbols for, 2004 V1: 10 +thermal expansion and, 1999 V2: 18 expansion loops +bracing and, 2004 V1: 171 defined, 2004 V1: 23 +protecting against thermal expansion, 1999 V2: 18 expert costs, 2004 V1: 223 +explosions +explosion-proof (XP) construction, 1999 V2: 179 explosion-relief devices for vacuums, 1999 V2: 268 fire-protection systems, 2000 V3: 22 +hot-water heaters, 1999 V2: 157 nitric acid, 1999 V2: 333 +exposed ends of piping, 2003 V4: 25 exposures, fire hazards and, 2000 V3: 2 +extended-coverage sidewall sprinklers, 2004 V1: 29 exterior piping for storm drainage, 1999 V2: 98 extinguishing systems, 2004 V1: 12 +extra-hazard occupancies defined, 2004 V1: 29 +deluge systems, 2000 V3: 13 firefighting hose streams, 2000 V3: 230 +portable fire extinguishers, 2000 V3: 27, 28 +extra-heavy cast-iron soil pipe (XH), 2003 V4: 27, 29–30 extra-heavy piping, 2004 V1: 23 +extra materials section in specifications, 2004 V1: 70, 90 extra-strength vitrified clay piping, 1999 V2: 68 +extra-strong steel pipe, 2003 V4: 48 +extra-strong weight brass pipe (Schedule 40), 2003 V4: 27 extractors in laundry facilities, 2000 V3: 36 +extruded steel piping, 2003 V4: 48 eyeball inlet fittings, 2000 V3: 137 +eyewashes for emergencies, 1999 V2: 332, 2000 V3: 37, 2003 V4: 17–18 + +F +°F, F (Fahrenheit), 2004 V1: 14, 38 F (farads), 2004 V1: 33 +f (femto) prefix, 2004 V1: 34 +F (fire-protection water supply). See fire-protection systems +f to f, F TO F (face to face), 2004 V1: 14, 23 +f & t (flow and thermostatic traps), 2000 V3: 182, 194 F-477 standard, 2003 V4: 62 +F-876 standard, 2003 V4: 61 F-877 standard, 2003 V4: 61 F-1281 standard, 2003 V4: 62 F-1282 standard, 2003 V4: 62 +F/m (farads per meter), 2004 V1: 33 fa, FA (face area), 2004 V1: 14 +fabrication section in specifications, 2004 V1: 91 face area (fa, FA), 2004 V1: 14 +face-entry fittings on sovent systems, 1999 V2: 62 face piping, 2000 V3: 115 +face to face (f to f, F TO F) +face-to-face dimensions, defined, 2004 V1: 23 +304 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +symbols for, 2004 V1: 14 +face velocity (fvel, FVEL, FV), 2004 V1: 14 face washes, 2000 V3: 37 +faceplates for pool lighting fixtures, 2000 V3: 145 +Facility Piping System Handbook, 1999 V2: 277, 325, 350, 2000 V3: 173, 214 +factories, numbers of fixtures for, 2003 V4: 19 factors +correction factors (CFAC, CFACT), 2004 V1: 14 friction factors (FFACT, FF), 2004 V1: 14 +Factory Mutual Research Corporation (FM) +air compressors in dry-pipe systems, 2000 V3: 12 design density requirements, 2000 V3: 16 +Factory Mutual (FM) Loss Prevention Data Sheets, 1999 V2: 177, 2000 V3: 225 +gas-train vents, 1999 V2: 177 +seismic protection recommendations, 2004 V1: 184 Fahrenheit (°F, F) +conversion factors, 2004 V1: 38 symbols for, 2004 V1: 14 +fail-safe mixing valves, 2003 V4: 18 +Failsafe Neutralization of Wastewater Effluent, 1999 V2: 350 +failure values of anchors, 2004 V1: 190 +Fair Housing Accessibility Guidelines, 2004 V1: 106 fairly-rough piping, 1999 V2: 141 +fairly-smooth piping, 1999 V2: 140 fall-off pressure, 1999 V2: 122, 152 +false alarms for sprinkler systems, 2000 V3: 9 fan-coil units, 2004 V1: 267 +fan-cooled electric motors, 2004 V1: 196 fan pressurization tests, 2000 V3: 24–25 fans (FAN) +pulsation from, 2004 V1: 196 silencers, 2004 V1: 197 symbols for, 2004 V1: 14 +Faraday’s Law, 2004 V1: 139, 144 farads, 2004 V1: 33 +farads per meter, 2004 V1: 33 +FAST approach to function analysis, 2004 V1: 227–231 fasteners, sound damping, 2004 V1: 195 +fats in kitchens. See grease faucets +accessible shower compartments, 2004 V1: 120 acoustic design and pressure, 2004 V1: 200 backflow preventions, 2003 V4: 13–14 centersets, 2003 V4: 10 +Energy Policy Act requirements, 2004 V1: 264 flow rates, 2003 V4: 10, 13 +health-care facilities, 2000 V3: 33 leakage, 2004 V1: 134 +low flow, 2004 V1: 136 patient rooms, 2000 V3: 34 +reduced water usage, 2004 V1: 126–127 reducing flow rates, 2004 V1: 135 residential kitchen sinks, 2003 V4: 11 self-metering, 2003 V4: 13 +sinks, 2004 V1: 117 standards, 2003 V4: 2 types of, 2003 V4: 13–14 wasted water, 2004 V1: 136 +faults and fault zones, 2004 V1: 156–158 + + +FC (flexible connectors). See flexible connectors FCO (floor cleanouts), 2004 V1: 11 +FD (floor drains with p-traps), 2004 V1: 11 +FDA (Food and Drug Administration), 1999 V2: 279, 321, 324, 328 +features, defined, 2004 V1: 32 +fecal matter. See black-water systems; effluent federal agencies. See specific agencies under “US” +Federal Energy Management Improvement Act (FEMIA), 2004 V1: 124 +Federal Food, Drug and Cosmetic Act, 1999 V2: 317 Federal Register (FR), 2000 V3:88 +federal specifications (FS), 2004 V1: 25, 54, 58 Federation Internationale de Natation Amateur (FINA), +2000 V3: 127, 151 +feed-gas treatment units in ozone generators, 1999 V2: 312 +feed water +defined, 1999 V2: 280 +pure-water systems, 1999 V2: 320 feet (ft, FT) +converting to metric units, 2000 V3: 29 converting to SI units, 2004 V1: 39 +feet per minute (fpm, FPM), 2004 V1: 14, 2000 V3: 29 feet per second (fps, FPS), 2004 V1: 14 +foot-pounds (ft-lb, FT LB), 2004 V1: 14 of head, converting, 2004 V1: 2 symbols for, 2004 V1: 14 +FEFF (efficiency, fin), 2004 V1: 14 felt, 2004 V1: 195 +female threads, 2004 V1: 23 female urinals, 2003 V4: 9 +FEMIA (Federal Energy Management Improvement Act), 2004 V1: 124 +“femto” prefix, 2004 V1: 34 ferric hydroxide, 1999 V2: 281 ferric iron, 1999 V2: 281, 283 +ferrous bicarbonate, 1999 V2: 283 ferrous iron, 1999 V2: 281, 283 +ferrous pipes, 2004 V1: 51–52, 2000 V3: 12 FF (friction factors), 2004 V1: 14 +FF (full-flow conditions), 2004 V1: 1 FFACT (friction factors), 2004 V1: 14 FI (film coefficients), 2004 V1: 14 fiber piping, 1999 V2: 122 +fiberglass fixtures, 2003 V4: 2 fiberglass-reinforced plastic (FRP) +exposed piping on storage tanks, 2000 V3: 165 fixtures, 2003 V4: 2 +fuel product dispensing, 2000 V3: 169 liquid fuel tanks, 2000 V3: 155 storage tanks, 2000 V3: 165, 172 sulfuric acid and, 2000 V3: 93 velocity, 2000 V3: 170 +VOCs and, 1999 V2: 284 fiberglass-reinforced storage tanks +aboveground storage tanks, 2000 V3: 165 high-purity water, 1999 V2: 323 +liquid fuel tanks, 2000 V3: 155 storage tanks, 2000 V3: 172 +storage tanks and hazardous wastes, 2000 V3: 91 fiberglass sealants, 2004 V1: 193 +Index + + +fiberglass septic tanks, 1999 V2: 228 field checklists, 2004 V1: 102–103 field orders, 2004 V1: 63 +field quality control section in specifications, 2004 V1: 71, 91–92 +fill +fill layers, 1999 V2: 104 leaching trenches, 1999 V2: 223 sewers, 1999 V2: 15 +subsurface drainage pipes, 1999 V2: 102, 103 types of, around building sewers, 1999 V2: 15 water pipes, 1999 V2: 250 +fill hoses, 2000 V3: 157 +fill lines for pools, 2000 V3: 116 fill ports, 2000 V3: 166 +fill spouts in pools, 2000 V3: 145 filling +aboveground tank systems, 2000 V3: 166–167 swimming pools, 2000 V3: 144 +underground liquid fuel tanks, 2000 V3: 156–157 film coefficients +inside (FI, HI), 2004 V1: 14 outside (FO, HO), 2004 V1: 14 +film-processing areas, 2000 V3: 39, 45 films +carbonate, 2004 V1: 151 +film formation in rate of corrosion, 2004 V1: 145 sodium hexametaphosphate, 2004 V1: 151 sodium silicate, 2004 V1: 151 +filter alum, 1999 V2: 294 filter cakes, 2000 V3: 134 filter coats, 2000 V3: 134 filter intakes, 2000 V3: 66 +filter pumps, 2000 V3: 115–116, 120 filter tanks, 2000 V3: 131 +filters and filtration +air compressors, 2000 V3: 203 cleaning filters, 2000 V3: 150 compressed air systems, 2000 V3: 207 defined, 2004 V1: 23 +filter bags on vacuum systems, 1999 V2: 268 +filter elements or media, 2004 V1: 23, 2000 V3: 134– 135 +filtration water systems, 2000 V3: 47 fountains +design criteria, 2000 V3: 112–113 filter pumps, 2000 V3: 115–116 piping, 2000 V3: 111–112, 119 turnover time, 2000 V3: 110 +fuel dispensers, 2000 V3: 165 gas line filters, 2000 V3: 250 +granular filters, 2000 V3: 132–134 +gray water, 2004 V1: 267, 1999 V2: 22, 23, 27, 28, 29 infectious waste systems, 1999 V2: 345 +iron-removal filters, 2000 V3: 147 +membrane filtration and separation, 1999 V2: 308–311 microorganisms, 1999 V2: 312 +oil spills, 1999 V2: 347, 348 +pure water systems, 1999 V2: 322–323 sand filters, 2000 V3: 149–150 +slurry feeding, 2000 V3: 134–135 +small drinking water systems, 1999 V2: 318 + +305 + + +subsurface drainage, 1999 V2: 102, 103–104 swimming pools, 2000 V3: 131–137 +backwash, 2000 V3: 137 backwash pits, 2000 V3: 137, 140 +diatomaceous earth, 2000 V3: 134–135 filter tanks, 2000 V3: 131 +gutters and, 2000 V3: 137 housing, 2000 V3: 129 hydraulic design, 2000 V3: 140 inlet fittings, 2000 V3: 137 main drains, 2000 V3: 137 media types, 2000 V3: 131–137 return inlets, 2000 V3: 110–111 role, 2000 V3: 131 +selecting components, 2000 V3: 139–140 skimmers, 2000 V3: 137 +surge tanks, 2000 V3: 137 types of filters, 2000 V3: 130 +utility water, 1999 V2: 314 vacuum systems, 1999 V2: 268 water quality and, 1999 V2: 244 water systems, 1999 V2: 125 +water treatment, 1999 V2: 299, 300 fin efficiency (FEFF), 2004 V1: 14 +FINA (Federation Internationale de Natation Amateur), 2000 V3: 127, 151 +final checklists, 2004 V1: 103 fine sands +fill above subsurface drainage pipes, 1999 V2: 103 gray-water irrigation systems and, 1999 V2: 26, 27 irrigating, 2000 V3: 100 +fine vacuum, 1999 V2: 254 finish coats, 2004 V1: 147 finish inspection, 2004 V1: 103 +Finnemore, E. John, 1999 V2: 19 fire areas, 2000 V3: 16 +fire departments, 2000 V3: 2, 216 fire hydrants. See hydrants +fire loads, 2000 V3: 2–3 +fire marshals, 2000 V3: 2, 216 +Fire Protection Handbook, 2000 V3: 8, 29 +fire-protection systems. See also sprinkler systems (fire protection) +alarms +electric gongs, 2000 V3: 11 +fire alarm control panels, 2004 V1: 12, 2000 V3: 24 fire alarm systems, 2004 V1: 23–24 +automatic systems, 2000 V3: 1–18 codes and standards, 2004 V1: 42–43 defined, 1999 V2: 18 +detection, 2000 V3: 13, 19 +extinguishers, 2004 V1: 12, 13, 2000 V3: 27 +fire department connections, 2004 V1: 24, 2000 V3: 11 fire-department connections, 2004 V1: 12 +fire extinguishers, 2000 V3: 27 fire hazards +defined, 2004 V1: 24 evaluation, 2000 V3: 2–3 +fire loads and resistance ratings, 2000 V3: 2–3 flammable or volatile liquids, 1999 V2: 13, 347–349 oxygen storage areas, 2000 V3: 63 +fire lines +306 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +defined, 2004 V1: 24 +fire-line water meters, 1999 V2: 116 fire mains, 2000 V3: 8 +fire-protection engineers, 2000 V3: 28 +fire pumps, 2004 V1: 12, 24, 2000 V3: 25–26, 225 firefighting equipment, 2004 V1: 13 +firefighting water drainage, 1999 V2: 346–347 flow tests, 2000 V3: 3–4 +hydrants +distance between, 1999 V2: 250 flow tests, 1999 V2: 122 pressure drop and, 1999 V2: 249 public hydrants, 2004 V1: 12 valves, 2004 V1: 24 +other trades and, 2000 V3: 27–28 overview, 2000 V3: 1 +references, 2000 V3: 29 +seismic protection, 2004 V1: 183–184 +special extinguishing systems, 2000 V3: 19–25 carbon-dioxide systems, 2000 V3: 20–21 +dry-chemical extinguishing systems, 2000 V3: 19–20 +dry-powder extinguishing systems, 2000 V3: 20 elevator shaft protection systems, 2000 V3: 25 foam extinguishing systems, 2000 V3: 21–22 gaseous fire-suppression systems, 2000 V3: 22–25 +sprinkler systems. See sprinkler systems (fire protection) +standpipe systems, 2000 V3: 18–19 symbols, 2004 V1: 12–13 terminology, 2004 V1: 17–31 +water lines, 2003 V4: 35 water supply for +building water supply, 2000 V3: 225–226 codes and standards, 2000 V3: 225 +fire risers, 2000 V3: 16 +firefighting water systems, 1999 V2: 249, 250 flow rates, 2000 V3: 230–232 +graphs, 2000 V3: 5, 6 +guard posts, 2000 V3: 228, 229 hydrants, 2000 V3: 226–228 hydraulic calculations, 2000 V3: 17 joint restrainers, 2000 V3: 228–229 overview, 2000 V3: 224–225 +piping system layout, 2000 V3: 8 post indicator valves, 2000 V3: 228 +preliminary information, 2000 V3: 215–216 quantity and availability, 2000 V3: 3–8 reliability, 2000 V3: 8 +sizing system, 2000 V3: 229–232 standpipe systems, 2000 V3: 19 +symbols for water supply (F), 2004 V1: 8 tank capacity, 2000 V3: 232 +water demands, 1999 V2: 243–244, 247 fire-rated sealants, 2004 V1: 193 +Fire Resistance (UL 2085), 2000 V3: 154 fires +classes of, 2000 V3: 3 growth rate, 2000 V3: 2 +firm gas services, 2000 V3: 249 first-degree burns, 1999 V2: 169 Fitting, 2003 V4: 32 + + +fittings. See also specific types of fittings acoustic ratings, 2004 V1: 194–195 +cast bronze threaded fittings, 2003 V4: 27 cast iron radiators, 2000 V3: 179 +codes and standards, 2004 V1: 44 compressed air, 2000 V3: 210, 211 compression, 2004 V1: 24 +copper and bronze, 2003 V4: 37–38 copper drainage tubes, 2003 V4: 45, 46 copper pipe, 2003 V4: 34 +cross-linked polyethylene, 2003 V4: 61 defined, 2004 V1: 24 +domestic pressure drops and, 2000 V3: 221 ductile iron water and sewer pipe, 2003 V4: 32–33 earthquake damage, 2004 V1: 162 +earthquake protection, 2004 V1: 166 flanged, 2004 V1: 24 +fountains, 2000 V3: 119 friction loss and, 1999 V2: 128 glass pipe, 2003 V4: 48, 49–50 grab bars, 2004 V1: 121–122 hub and spigot, 2003 V4: 27 +hubless pipe and fittings, 2003 V4: 28 lead pipe, 2003 V4: 49 +liquefied petroleum gas, 1999 V2: 196 medical gas tube, 2003 V4: 45 natural gas fitting sizes, 1999 V2: 184 natural gas pipes, 2000 V3: 252 plastic pipes, 2003 V4: 58 +pressure drops in water systems and, 1999 V2: 125, 126, 127 +PVC piping, 2003 V4: 62 +radioactive waste systems, 1999 V2: 343 red brass pipe, 2003 V4: 27 +screwed fittings, 2004 V1: 162 +seamless copper water tube, 2003 V4: 37 standards, 2003 V4: 2 +steel or galvanized piping, 2003 V4: 48 steel pipe, 2003 V4: 48 +swimming pools, 2000 V3: 137, 144, 145 tank manways, 2000 V3: 156 +types of, 2003 V4: 1 +vacuum cleaning systems, 1999 V2: 269 welded, 2004 V1: 24 +Fitzgerald, 2004 V1: 154 +fixed costs, in plumbing cost estimation, 2004 V1: 93 fixed floor-mounted equipment, 2004 V1: 163 +fixed shower heads, 2004 V1: 120 +fixed suspended equipment, 2004 V1: 164 fixture branches, 2004 V1: 24 +fixture carrier fittings, 2004 V1: 24 fixture carriers, 2004 V1: 24 fixture drains +defined, 2004 V1: 24 +discharge characteristics, 1999 V2: 3 flow in, 1999 V2: 2 +flow rate in, 2004 V1: 3 +simultaneous use of fixtures, 1999 V2: 3, 4 fixture supplies, 2004 V1: 24 +fixture units and unit values +cold-water system demand, 1999 V2: 121 +Index + + +conversion to gpm, 1999 V2: 120, 124, 126, 2000 V3: 218, 234 +demand weight of fixtures, 1999 V2: 123 +drainage fixture units (dfu), 2004 V1: 24, 1999 V2: 64 drainage vents and, 1999 V2: 40–41 +fixture units (fu) defined, 1999 V2: 64 maximum for vertical stacks, 1999 V2: 4, 5 pipe sizing and, 1999 V2: 133–142, 136 reduced-size venting and, 1999 V2: 50 sanitary drainage system loads, 1999 V2: 3 slope of drains, 1999 V2: 7, 9 +sovent systems, 1999 V2: 57–59, 63 +steady flow in horizontal drains, 1999 V2: 9 supply fixture units (sfu), 2004 V1: 24 water hammer and, 1999 V2: 144 +fixtures and fixture outlets. See also specific types of fixtures (water closets, showers, etc.) +accessibility standards, 2003 V4: 2 +batteries of fixtures, 2004 V1: 18, 1999 V2: 64 building requirement tables, 2003 V4: 18–23 codes and standards, 2004 V1: 43–44 +cold-water system demand, 1999 V2: 121 defined, 2004 V1: 27, 2003 V4: 1 +demand weight of, 1999 V2: 123 domestic water supply and, 2000 V3: 216 fittings, 2003 V4: 1 +fixture traps and vents, 1999 V2: 40 +flow and pressure requirements, 1999 V2: 129 governing fixtures, 1999 V2: 125, 129 +health-care facilities, 2000 V3: 31–39 general requirements, 2000 V3: 33 kitchens and laundries, 2000 V3: 36 laboratory rooms, 2000 V3: 37–39 selection, 2000 V3: 31–34 +special equipment, 2000 V3: 39 specific areas, 2000 V3: 33–36 unique fixtures, 2000 V3: 37, 38 +inspection, 2004 V1: 103 +installation productivity rates, 2004 V1: 97 laboratory acid-waste drainage systems, 1999 V2: 334 materials, 2003 V4: 1–2 +minimum numbers of, 2003 V4: 18–22 per-fixture cost estimation, 2004 V1: 97 plumbing cost estimation, 2004 V1: 93 plumbing fixtures, defined, 2004 V1: 24 reduced water usage, 2004 V1: 126–127 reducing flow rates, 2004 V1: 134–135 +resilient-mounting design, 2004 V1: 206, 207 resiliently mounted plumbing fixtures, 2004 V1: 207 sizing vents, 1999 V2: 50 +standards, 2003 V4: 2 +supply-water trap primers, 1999 V2: 14 types of, 2003 V4: 1 +vibration of, 2004 V1: 205 wastewater trap primers, 1999 V2: 14 +water fixture unit values, 2000 V3: 217 water-saving fixtures, 2004 V1: 126 +flame arresters, 2000 V3: 158 +Flammable and Combustible Liquids Code (NFPA 30), 2000 V3: 29, 95, 173 +automatic fire-protection systems, 2000 V3: 2 dike construction, 2000 V3: 167 + +307 + + +foam systems, 2000 V3: 21 +liquid fuel system codes, 2000 V3: 154 liquid fuel system definitions, 2000 V3: 153 tank construction, 2000 V3: 165 +flammable gases, 2000 V3: 83 +flammable or volatile liquids, 1999 V2: 13, 347–349, 2000 V3: 153 +flanged end connections, 2004 V1: 23 Flanged Pipe, 2003 V4: 32 +flanges +bonnets, 2004 V1: 25 defined, 2004 V1: 25 fittings, 2004 V1: 25 flange ends, 2004 V1: 25 flange faces, 2004 V1: 25 +flanged fittings, 2003 V4: 38 +problems in seismic protection, 2004 V1: 190 flap valves, 2004 V1: 25 +flare nuts, frost proof, 1999 V2: 196 flared fittings, 2003 V4: 34 +flash attacks, 2004 V1: 146, 153 flash fires, 2000 V3: 16 +flash points +defined, 2004 V1: 25, 2000 V3: 83, 153 +foam extinguishing systems and, 2000 V3: 21 liquid fuels, 2000 V3: 153 +flash tanks, 2000 V3: 195, 196 +flash tubes for liquefied petroleum gas, 1999 V2: 197 flashing condensate, 2000 V3: 197 +flashing flanges, 1999 V2: 17 flashing flow, 2000 V3: 196–197 flashing L flanges, 1999 V2: 17 flashing rings, 1999 V2: 12, 17, 80 +flat-area leaching trenches, 1999 V2: 223–224 flat roof drains, 1999 V2: 80 +flat-spray irrigation sprinklers, 2000 V3: 103 flexible connectors (FC) +acoustics and, 2004 V1: 200 illustrated, 2004 V1: 204, 210 symbols for, 2004 V1: 10 +vibration control devices, 2004 V1: 203, 205 flexible gas hoses, 1999 V2: 196 +flexible hose connections, 2003 V4: 14 flexible plastic piping, 2000 V3: 169 +flexural strength of plastic pipe, 2003 V4: 60 float switches, 2000 V3: 188 +float-type level controls, 1999 V2: 249 +float valves, 2004 V1: 25, 2000 V3: 124, 144 floatation devices for oil spills, 1999 V2: 348 floatation of oil in spills, 1999 V2: 347 floatation vibration isolation, 2004 V1: 164 floating ball devices in tanks, 2000 V3: 158 floating floors, soundproofing, 2004 V1: 196 floc, 1999 V2: 294 +flocculation, 1999 V2: 294, 2000 V3: 150 flood level rims, 2004 V1: 25 +flooded, defined, 2004 V1: 25 flooding factors +clean agent gas fire suppression, 2000 V3: 23 rainfall, 2000 V3: 244 +underground storage tanks and, 2000 V3: 155 floor cleanouts (FCO), 2004 V1: 11 +308 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +floor drains (FD) +acid-resistant floor drains, 1999 V2: 16 blood-type, 2000 V3: 35 +chemical-waste systems, 1999 V2: 346 components, 1999 V2: 11 +end venting, 1999 V2: 41 +fire-suppression drainage and, 1999 V2: 347 fixture-unit loads, 1999 V2: 3 +floor leveling around, 1999 V2: 17 food-preparation areas, 2000 V3: 36 grate open areas, 1999 V2: 10 gravity drains, 2000 V3: 140 +health-care facilities, 2000 V3: 32, 38 +infectious and biological waste systems, 1999 V2: 345 kitchen areas, 1999 V2: 16–17, 17 +mechanical spaces and vaults, 2000 V3: 111 with p-traps (FD), 2004 V1: 11 +public areas in health-care facilities, 2000 V3: 34 radioactive waste systems, 1999 V2: 342 sanitary drainage systems, 1999 V2: 10 standards, 2003 V4: 2 +swimming pool bathhouses, 2000 V3: 130 types, 1999 V2: 17–18, 2003 V4: 17 waterproofing, 1999 V2: 17 +floor inlets in pools, 2000 V3: 137, 143 +floor-mounted back-outlet water closets, 2003 V4: 4 floor-mounted bidets, 2003 V4: 17 +floor-mounted pumps, 2004 V1: 205 floor mounted urinals, 2003 V4: 10 +floor-mounted vibration-isolated equipment, 2004 V1: 164–166 +floor-mounted water closets, 2003 V4: 4, 6–7 floor sinks, 1999 V2: 10, 16 +floors +bathhouses, 2000 V3: 130 +design considerations in seismic protection, 2004 V1: 186 +floor penetrations of pipes, 2004 V1: 201 leveling, 1999 V2: 17 +motions in earthquakes, 2004 V1: 160 shaking in earthquakes, 2004 V1: 161 +flow. See also flow rates at outlet, 2004 V1: 3 +building drains, 1999 V2: 2 critical flows, defined, 2004 V1: 2 +fixture drains, 2004 V1: 3, 1999 V2: 2 gravity and sheet actions, 1999 V2: 12 hydraulic jumps in, 1999 V2: 2, 6 +open-channel flow, 2004 V1: 1, 1999 V2: 7 outlet velocity, 2004 V1: 6 +overland flow for sites, 1999 V2: 96 rate of flow, calculating, 2004 V1: 1 stacks, 1999 V2: 1–2 +steady flow, 1999 V2: 6–7 surging flows, 1999 V2: 5 symbols for, 2004 V1: 11 +velocity and water hammer, 2004 V1: 198 velocity of uniform flow, 2004 V1: 1 +water flow in pipes, calculating, 2004 V1: 2 +flow and thermostatic traps (f & t), 2000 V3: 182, 194 flow-control storm devices, 1999 V2: 94 +flow equalization in gray-water treatment, 1999 V2: 27 + +flow hydrants, 2000 V3: 4 flow indicators, 2000 V3: 142 flow meters, 2000 V3: 140 flow pressure, 2004 V1: 25 +flow rate totalizers, 2000 V3: 142 flow rates +acoustic ratings and, 2004 V1: 194, 200 air flow in vacuum pressure, 1999 V2: 253 air flow rates (QAR, QAIR), 2004 V1: 14 altitude and, 1999 V2: 258 +at outlets, 2004 V1: 5 capacity, 2004 V1: 20, 33 +cold-water systems, 1999 V2: 115, 121, 153 compressed air systems, 2000 V3: 212 +air compressors, 2000 V3: 205 +air-consuming devices, 2000 V3: 206–207 measurements, 2000 V3: 200 +tools and equipment, 2000 V3: 208 conserving energy, 2004 V1: 126–127 conversion factors, 2004 V1: 37 diatomaceous earth filters, 2000 V3: 134, 139 domestic water supply, 2000 V3: 216 +emergency showers and eyewashes, 2003 V4: 18 Energy Policy Act requirements, 2004 V1: 264 faucets, 2003 V4: 13 +fire-protection demand, 2000 V3: 230–232 fixture drains, 2004 V1: 3 +fixture requirements, 1999 V2: 129 flash steam, 2000 V3: 197 +fluctuating flows in horizontal drains, 1999 V2: 5 fluid (QFL), 2004 V1: 14 +fountain systems +displays, 2000 V3: 108–110, 115 filtration, 2000 V3: 110, 112 +fuel-gas systems and boosters, 1999 V2: 178 fuel product dispensers, 2000 V3: 164–165 gas boosters, 1999 V2: 179, 180, 182 +gas flow rates (QGA, QGAS), 2004 V1: 14, 1999 V2: 173 +high-rate dispensers, 2000 V3: 169 hydrants, 2000 V3: 217 +kitchen sinks, 2003 V4: 11 lavatories, 2003 V4: 10 +liquid fuel piping, 2000 V3:169–170 measurements, 2004 V1: 33, 1999 V2: 253 medical air, 2000 V3: 74 +medical gas, 2000 V3: 50–54 medical oxygen, 2000 V3: 74 medical vacuum, 2000 V3: 74, 79 +natural gas systems, 1999 V2: 183, 2000 V3: 253 nitrogen, 2000 V3: 68, 74 +nitrous oxide, 2000 V3: 74 pump capacity, 2004 V1: 6 +rate of flow, calculating, 2004 V1: 1 +reduced-pressure backflow devices, 1999 V2: 148 reducing for fixtures, 2004 V1: 134–135 +resin bead regeneration, 1999 V2: 305 +roof drainage in horizontal branches, 1999 V2: 88 sand filters, 2000 V3: 113, 132 +showers, 2003 V4: 15 +special-waste drainage systems, 1999 V2: 329 sprinkler hydraulic calculations, 2000 V3: 16 +Index + + +steam piping, 2000 V3: 182 submersible fuel pumps, 2000 V3: 170 +swimming pool filtration, 2000 V3: 131, 139 urinals, 2003 V4: 10 +vacuum cleaning systems, 1999 V2: 270, 271 vacuum exhauster sizing, 1999 V2: 274 vacuum systems, 1999 V2: 255–256, 262 water closets, 2003 V4: 8 +water fountains, 2004 V1: 109 +water heater types and, 1999 V2: 160 weirs and waterfalls, 2000 V3: 108, 109 +flow restrictors, 2004 V1: 126 +flow switches (FS), 2004 V1: 10, 2000 V3: 121 flow tests +equations, 2000 V3: 5 +fire-protection systems, 2000 V3: 3–4 hydrants, 2000 V3: 217, 219 +medical gas systems, 2000 V3: 81 flowing pressure. See residual pressure flowing subsurface water, 1999 V2: 100 +fluctuating flows in horizontal drains, 1999 V2: 5 flue gases +defined, 1999 V2: 213 temperatures, 1999 V2: 178 +flues, 2004 V1: 25 +fluid flow rates, 2004 V1: 14 +Fluid Mechanics with Engineering Applications, 1999 V2: 19 +fluoride, 1999 V2: 245, 284 fluorine, 1999 V2: 281 +fluoroprotein-mixed chemical concentrates, 2000 V3: 21 flush controls +urinals, 2004 V1: 116 +water closet and toilet accessibility, 2004 V1: 114 water closet requirements, 2004 V1: 116 +flush sprinklers, 2004 V1: 29 +flush tanks, acoustic design, 2004 V1: 195 flush valves. See also flushometer valves +wasted water and, 2004 V1: 136 +water closet acoustic design, 2004 V1: 200 flushing +acoustic ratings of toilets, 2004 V1: 194 acoustic ratings of urinals, 2004 V1: 194 cold-water systems, 1999 V2: 154 +Energy Policy Act requirements, 2004 V1: 264 gray water use, 2004 V1: 267 +performance testing, 2003 V4: 5–6 resin beds, 1999 V2: 305 +urinal tests, 2003 V4: 9 +water closet system types, 2003 V4: 6–8 water conservation and toilets, 2003 V4: 3 water systems, 1999 V2: 252 +flushing rims, 1999 V2: 16 +flushing-type floor drains, 2004 V1: 25 flushometer tanks, 2003 V4: 3, 8 flushometer valves +back-siphonage and, 1999 V2: 14 defined, 2004 V1: 25, 2003 V4: 3, 8 sanitation and, 1999 V2: 16 urinals, 2003 V4: 10 +flushometer water closets, 2003 V4: 3, 8 flux + +309 + + +in joints, 2004 V1: 266 +membrane productivity, 1999 V2: 321 natural osmosis, 1999 V2: 308 standards, 2003 V4: 37 +FM. See Factory Mutual Research Corporation (FM) FMRC (Factory Mutual). See Factory Mutual Research +Corporation (FM) +FO (film coefficients), 2004 V1: 14 +foam extinguishing systems, 2000 V3: 21–22, 27 foam-water sprinkler heads, 2000 V3: 21 foaming in gray water, 1999 V2: 29 +fog nozzles, 1999 V2: 332 +fogging in swimming pools, 2000 V3: 129 +Follow-up phase in value engineering, 2004 V1: 213 Fontana, Mars G., 2004 V1: 154 +Food and Drug Administration (FDA), 1999 V2: 279, 321, 324, 328 +food courts, numbers of fixtures for, 2003 V4: 19 food dyes in gray water, 1999 V2: 33 +food-processing areas and kitchens drains, 1999 V2: 16–17 +grease interceptors, 1999 V2: 13 +health-care facility fixtures, 2000 V3: 36 medical gas piping and, 2000 V3: 73 natural gas and, 1999 V2: 174 +numbers of fixtures for, 2003 V4: 19 rates of sewage flows, 1999 V2: 237 sanitation, 1999 V2: 16 +sewage estimates, 1999 V2: 235 +typical gray-water demand, 1999 V2: 25 water fixture-unit values, 2000 V3: 217 water temperatures, 2000 V3: 45 +food-processing plants +cross-flow hazards, 1999 V2: 147 pure water and, 1999 V2: 317 +food waste grinders +acoustic ratings of, 2004 V1: 195 defined, 2004 V1: 22 +discharges from, 1999 V2: 237 fixture-unit loads, 1999 V2: 3 sink outlets and, 2003 V4: 11 +foot controls on faucets, 2000 V3: 33 foot or feet. See feet +foot pedals for nitrogen systems, 2000 V3: 68 foot-pounds (ft-lb, FT LB), 2004 V1: 14 +foot valves, 2004 V1: 25, 2000 V3: 119 +footing drains (subsoil drains, SSD), 2004 V1: 8, 30 footings of buildings +defined, 2004 V1: 25 +water pipes and, 1999 V2: 251 FOR (fuel oil return), 2004 V1: 8 force +conversion factors, 2004 V1: 35 +factors in seismic force calculations, 2004 V1: 183 measurements, 2004 V1: 33 +in seismic design, 2004 V1: 188 force mains, 2000 V3: 234, 236–240, 241 forced-air vaporizers, 2000 V3: 61 +forced distortions of piping, 2004 V1: 161 +forced drainage (corrosion), defined, 2004 V1: 153 forcing functions in earthquakes, 2004 V1: 160 forcing pipes, 2003 V4: 25 +310 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +formazin turbidity unit, 1999 V2: 287 forms. See checklists and forms formula rooms, 2000 V3: 32 formulas. See equations +forward approaches and reaches +approaches for wheelchairs, 2004 V1: 110 +drinking fountains and water coolers, 2004 V1: 109 reach for wheelchairs, 2004 V1: 109, 111 +FOS (fuel oil supply), 2004 V1: 8 fouling of water, 1999 V2: 289, 316 +Foundation for Cross-Connection Control and Hydraulic Research, 2000 V3: 224 +foundations of buildings, 1999 V2: 103, 231 foundations of pumps, 1999 V2: 243, 245 fountains +controls, 2000 V3: 120–121 discharge devices, 2000 V3: 119–120 filtration systems, 2000 V3: 112–113 gray water in, 1999 V2: 22 +lighting, 2000 V3: 121 +makeup-water systems, 2000 V3: 124–125 overflow and drainage, 2000 V3: 125 overview, 2000 V3: 107 +piping and valves, 2000 V3: 116–119 pool design, 2000 V3: 107–111 +displays and flow rates, 2000 V3: 108–110 general considerations, 2000 V3: 107–108 inlets, outlets, and devices, 2000 V3: 110–111 multilevel pools, 2000 V3: 108 +pumps, 2000 V3: 113–116 +display pumps, 2000 V3: 113–115 filter pumps, 2000 V3: 115–116 +references, 2000 V3: 125–126 +systems and components, 2000 V3: 111–112 display system, 2000 V3: 111 +illustrated, 2000 V3: 114 lighting systems, 2000 V3: 112 +make-up water system, 2000 V3: 112 overflow and drainage, 2000 V3: 112 piping systems, 2000 V3: 111–112 water-heating system, 2000 V3: 112 water-treatment system, 2000 V3: 112 +valves, 2000 V3: 118–119 +water-heating equipment, 2000 V3: 121–122 water-treatment systems, 2000 V3: 122–124 +FOV (fuel oil vents), 2004 V1: 8 +fp, FP (freezing points), 2004 V1: 14 +fpm, FPM (feet per minute), 2004 V1: 14, 2000 V3: 29 fps, FPS (feet per second), 2004 V1: 14 +FR (Federal Register), 2000 V3:88 fracture rooms, 2000 V3: 32, 36 +framing drawings for facilities, 2000 V3: 31 +Frankel, Michael, 1999 V2: 114, 277, 325, 350, 2000 V3: 173, 214 +Franzini, Joseph B., 1999 V2: 19 +fraternities and sororities, numbers of fixtures for, 2003 V4: 20 +Frederick, Ralph H., 1999 V2: 114 free air +defined, 2004 V1: 18, 2000 V3: 200 properties, 2000 V3: 199 +water vapor in, 2000 V3: 200–201 + +free chlorine, 2000 V3: 149 free-floating oils, 2000 V3: 93 free oil, 1999 V2: 347 +free residuals, 2000 V3: 146 free vibration, 2004 V1: 160 +freeboard in ditches, 2000 V3: 248 freestanding lights for fountains, 2000 V3: 121 +freestanding siamese fire-department connections, 2004 V1: 12 +freestanding sprinkler heads in irrigation, 2000 V3: 102 freezing points (fp, FP), 2004 V1: 14, 2003 V4: 61 “freezing,” preventing in cleanouts, 1999 V2: 9 +freezing temperatures +backflow preventers and, 1999 V2: 149 buried water pipes and, 1999 V2: 251 +dry-pipe sprinkler systems and, 2000 V3: 9, 11 fountains and, 2000 V3: 121–122 +frost lines, 2000 V3: 226 +gas piping and, 1999 V2: 196 +ice and oxygen storage, 2000 V3: 61 +ice inside water storage tanks, 1999 V2: 247 irrigation system valves and, 2000 V3: 103 leaching trenches and, 1999 V2: 222 reduced-size venting and, 1999 V2: 50 +swimming pool maintenance and, 2000 V3: 131 testing of cold-water systems, 1999 V2: 154 water meters and, 1999 V2: 115 +well heads and, 1999 V2: 243 french drains, 2004 V1: 25 French, John L., 1999 V2: 38 frequencies (Hz, HZ) +measurements, 2004 V1: 33 symbols for, 2004 V1: 15 +frequency of ion regeneration cycles, 1999 V2: 305 fresh-air inlets, 2004 V1: 25 +friction clamps, 2000 V3: 229 friction connectors, 2004 V1: 189 friction factors, 2004 V1: 14 +friction head, calculating, 2004 V1: 6 friction losses in flow +calculating friction head loss, 2004 V1: 2 compressed air, 2000 V3: 78, 210, 211 counterflow piping designs, 2000 V3: 178 fountain display pumps, 2000 V3: 115 fuel dispensers, 2000 V3: 170 +Hazen-Williams formula, 2004 V1: 2, 1999 V2: 116, 118, 119, 121 +liquid fuel piping, 2000 V3:170 medical air, 2000 V3: 68, 74, 78 medical gas piping, 2000 V3: 73 +medical vacuum systems, 2000 V3: 74, 79 natural gas systems, 1999 V2: 183, 2000 V3: 253 nitrogen systems, 2000 V3: 74, 77 +nitrous oxide, 2000 V3: 74, 76 oxygen, 2000 V3: 74, 76 +pipe pressure and, 1999 V2: 122–132 pressure and, 1999 V2: 125, 130 sizing of branches, 1999 V2: 127 standpipe systems, 2000 V3: 19 steam pipes, 2000 V3: 187 +submersible fuel pumps, 2000 V3: 170 swimming pool gutters and, 2000 V3: 142 +Index + + +vacuum cleaning systems, 1999 V2: 271, 272–274, 275 vacuum exhauster sizing, 1999 V2: 274 +valves and threaded fittings, 1999 V2: 128 water mains, 2000 V3: 8 +water supply piping and, 1999 V2: 249 well pumps, 1999 V2: 245 +front-end documents, 2004 V1: 63, 65 front-loading skimmers, 2000 V3: 110 frost. See freezing temperatures +frost lines, 2000 V3: 226 +frost proof flare nuts, 1999 V2: 196 frostproof closets, 2004 V1: 25 +FRP. See fiberglass-reinforced plastic +FS (federal specifications), 2004 V1: 25, 58 FS (flow switches), 2004 V1: 10 +ft, FT (feet). See feet +ft-lb, FT LB (foot-pounds), 2004 V1: 14 ft2 EDR, 2000 V3: 178, 180 +ft3 (cubic feet), 2004 V1: 14 +FTUs (formazin turbidity units), 1999 V2: 287 fu values. See fixture units and unit values fuel double containment systems, 2003 V4: 58 fuel gas codes, list of agencies, 2004 V1: 42 Fuel Gas Piping, 1999 V2: 214 +fuel-gas piping systems. See also diesel-oil systems; gasoline systems +conversion factors, 1999 V2: 212 fuel gas, defined, 1999 V2: 213 glossary, 1999 V2: 213–214 +liquefied petroleum gas, 1999 V2: 194, 196–197 methane, 2004 V1: 130 +natural gas systems, 1999 V2: 173–194, 2003 V4: 35, 36 +values of fuel gas, 1999 V2: 212 fuel loads (fire hazards), 2000 V3: 2 fuel oil +copper pipe, 2003 V4: 35 +fuel oil return (FOR), 2004 V1: 8 fuel oil supply (FOS), 2004 V1: 8 fuel oil vents (FOV), 2004 V1: 8 pipe bracing, 2004 V1: 166, 167 +full-flow conditions (FF), 2004 V1: 1 full-port ball valves, 2000 V3: 72 fully-sprinklered spaces, 2004 V1: 12 fume hoods, 1999 V2: 334, 342 fumes, hazardous. See also gases +acid-waste drainage systems, 2000 V3: 39 acids, 1999 V2: 332, 333 +filter cleaners, 2000 V3: 150 in soil profiles, 2000 V3: 162 vent piping, 2000 V3: 42 VOCs, 1999 V2: 284 +fuming grade sulfuric acid, 1999 V2: 332 Function Analysis phase in value engineering +defined, 2004 V1: 224 +FAST approach, 2004 V1: 227–231 +function definitions forms, 2004 V1: 225–227, 228 in process, 2004 V1: 213 +rules, 2004 V1: 225 +Function phase in value engineering, 2004 V1: 213 Functional Analysis System Technique (FAST), 2004 V1: +227–231 + +311 + + +functions +basic or secondary, 2004 V1: 225 +comparing in evaluation phase, 2004 V1: 243 cost-to-function relationship, 2004 V1: 225 defined, 2004 V1: 224 +evaluation checklists, 2004 V1: 237–241 in evaluation phase, 2004 V1: 235 +in FAST approach, 2004 V1: 230 interrelationships, 2004 V1: 227 levels of importance, 2004 V1: 225 ranking and comparing, 2004 V1: 243 sketches of, 2004 V1: 237, 239–240 specific and dependent, 2004 V1: 225 two-word expressions, 2004 V1: 225 +fundamental corrosion cells, defined, 2004 V1: 139 Fundamentals Handbook, 2000 V3: 197 +Fundamentals of Underground Corrosion Control, 2004 V1: 154 +fungi, 1999 V2: 282, 289 +funnel-type collectors for backflow devices, 1999 V2: 148 funnel-type drains, 1999 V2: 346, 2000 V3: 39 +furring-out requirements for roofs, 1999 V2: 79, 81 fusible link sprinklers, 2000 V3: 9 +Fusion-Bonded Epoxy Coating, 2003 V4: 32 fusion-joint plastic piping systems, 2000 V3: 42 +future expansion of compressed air systems, 2000 V3: 210 future expansion of water systems, 1999 V2: 249 +FV (face velocity), 2004 V1: 14 +fvel, FVEL (face velocity), 2004 V1: 14 + +G +G (giga) prefix, 2004 V1: 34 +G (low-pressure gas), 2004 V1: 8 +g, G (gravitational constants), 2004 V1: 15 G pipes, 2003 V4: 36 +ga, GA (gauges). See gauges Gabrielson, M. Alexander, 2000 V3: 151 +GACs (granulated carbon filters), 1999 V2: 318, 323. See also activated carbon filtration +GAGE (gages). See gages +gages (ga, GA, GAGE). See also gauges cast iron radiators, 2000 V3: 180 defined, 2004 V1: 15 +pressure, 2000 V3: 200 +gal, GAL (gallons). See gallons (gal, GAL) galleries, numbers of fixtures for, 2003 V4: 19 gallons (gal, GAL) +converting to metric units, 2000 V3: 29 converting to SI units, 2004 V1: 39 gallons per day (gpd, GPD), 2004 V1: 15 +gallons per hour (gph, GPH), 2004 V1: 15, 39 +gallons per minute (gpm), 1999 V2: 120, 124, 126, 240 converting to fixture units, 2000 V3: 218, 234 converting to metric units, 2000 V3: 29 +fountains, 2000 V3: 115 +grains per gallon (gpg), 1999 V2: 285 +standard gallons per hour (std gph, SGPH), 2004 V1: 15 +symbols for, 2004 V1: 15 +galvanic action, 2004 V1: 25. See also electrolysis galvanic anodes, 2004 V1: 147–150 +galvanic cells, defined, 2004 V1: 153 +312 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +galvanic corrosion, 2004 V1: 141, 153, 1999 V2: 290 galvanic series of metals +defined, 2004 V1: 153 +dielectric insulation and, 2004 V1: 146 listing, 2004 V1: 141 +galvanized coatings for corrosion prevention, 2004 V1: 147 galvanized-iron joints, 1999 V2: 222 +galvanized-iron piping, 1999 V2: 14, 136 galvanized pipe fittings, 2003 V4: 48 galvanized-steel filters, 2000 V3: 131 galvanized-steel piping +aboveground piping, 1999 V2: 14, 68 fountains and, 2000 V3: 116 +fuel product dispensing and, 2000 V3: 169 liquefied petroleum gas, 1999 V2: 196 vacuum systems, 1999 V2: 262 +galvanizing, defined, 2004 V1: 25 galvomag alloy, 2004 V1: 144 +gamma ray radiation, 1999 V2: 337, 338, 339 garbage disposers. See food waste grinders garnet in filters, 1999 V2: 300 +gas. See gases; medical-gas systems; natural gas systems; specific types of gases +Gas and Vacuum Systems, 2003 V4: 45 gas boosters +design considerations, 1999 V2: 180–182 gas laws, 1999 V2: 179 +glossary, 1999 V2: 182–183 +heat exchanger loop systems, 1999 V2: 181, 182 high-rise buildings, 1999 V2: 180 +materials and components, 1999 V2: 179 overview, 1999 V2: 178–183 +simplex and dual gas booster systems, 1999 V2: 181 sizing, 1999 V2: 182–183 +gas chlorinators +disinfecting swimming pools, 2000 V3: 148 iron removal, 2000 V3: 147 +gas-fired water heaters +conserving energy, 2004 V1: 129 defined, 2004 V1: 129–130 fountains, 2000 V3: 121 instantaneous heaters, 2004 V1: 265 net efficiency of, 2004 V1: 130 swimming pools, 2000 V3: 138 +gas flow rates, 2004 V1: 14, 1999 V2: 173 gas laws, 1999 V2: 179 +gas logs, defined, 1999 V2: 213 gas piping codes, 2004 V1: 42 +gas piping systems. See also fuel-gas piping systems; gasoline systems; liquefied petroleum gas; natural gas systems +bracing, 2004 V1: 167 defined, 2004 V1: 191 gas cocks, 2004 V1: 9 +gas line earthquake-sensitive valves, 2004 V1: 162 gas main inspection checklist, 2004 V1: 103 +gas pressure regulators, 1999 V2: 214, 2000 V3: 250– 252 +gas stops (gas cocks), 2004 V1: 9 gas-train vents, 1999 V2: 177, 213 +gas trains, 1999 V2: 213, 2000 V3: 251 gas turrets, 1999 V2: 177 + +gas vents (GV), 2004 V1: 8, 1999 V2: 213 high-pressure (HG), 2004 V1: 8 +line filters, 2000 V3: 250 low-pressure (G), 2004 V1: 8 +medium-pressure (MG), 2004 V1: 8 plastic pipes, 2003 V4: 58 +services at laboratory outlets, 2000 V3: 37–39 Spitzglass formula, 2004 V1: 7 +gas stations, 2000 V3: 166, 2003 V4: 20 gas stripping, 1999 V2: 288 +gas-transfer vacuum pumps, 1999 V2: 259 gaseous chlorine, 2000 V3: 123 +gaseous fire-suppression systems, 2000 V3: 22–25 +gases. See also fuel-gas piping systems; liquefied petroleum gas; natural gas systems +as fluids, 2000 V3: 199 +contamination in compressed air, 2000 V3: 201 dissolved gases in water, 1999 V2: 284 +forcing upward through terminal stack, 1999 V2: 36 hazardous, 1999 V2: 332 +nitrous fumes, 1999 V2: 333 +preventing concentration with vents, 1999 V2: 35 sulfuric acid, 1999 V2: 333 +volatile organic compounds, 1999 V2: 284 gaskets +fire-protection water supply, 2000 V3: 228–229 fuel piping, 2000 V3: 169 +special-waste systems, 1999 V2: 328 gasoline, 1999 V2: 13, 2000 V3: 154, 168 gasoline blends, 2000 V3: 154, 168 gasoline systems +aboveground tank systems, 2000 V3: 165–169 connections and access, 2000 V3: 166 construction, 2000 V3: 165 +corrosion protection, 2000 V3: 165 filling and spills, 2000 V3: 166–167 +leak prevention and monitoring, 2000 V3:167–168 materials, 2000 V3: 165 +overfill prevention, 2000 V3:167 +product dispensing systems, 2000 V3:168 tank protection, 2000 V3:169 +vapor recovery, 2000 V3:168 venting, 2000 V3:167 +codes and standards, 2000 V3: 154 components, 2000 V3: 155 +definitions and classifications, 2000 V3: 153–154 designing +installation considerations, 2000 V3:172–173 piping materials, 2000 V3:169 +piping sizing, 2000 V3:169–170 submersible pump sizing, 2000 V3:170 testing, 2000 V3:170–172 +overview, 2000 V3: 153 references, 2000 V3:173 resources, 2000 V3:173 +underground tank systems, 2000 V3: 155–165 +leak detection and system monitoring, 2000 V3: 158–163 +product dispensing systems, 2000 V3: 163–165 storage tanks, 2000 V3: 155–158 +vapor recovery systems, 2000 V3: 163 gate valves (GV), 2004 V1: 9, 1999 V2: 332 +Index + + +gauge pressure, 2000 V3: 200 gauge taps, 2000 V3: 115 +gauges (ga, GA, GAGE). See also gages (ga, GA, GAGE) fuel product level gauging, 2000 V3: 167, 168 +gauge pressure, 1999 V2: 253, 254 hazardous materials, 2000 V3: 90 medical gas systems, 2000 V3: 72 symbols for, 2004 V1: 15 +vacuum systems, 1999 V2: 260 gear journals, 2004 V1: 196 +gear pumps, 1999 V2: 247 +gearbox silencing enclosures, 2004 V1: 197 gears, acoustic problems, 2004 V1: 196 Geiger-Mueller counters, 1999 V2: 339 +gel-coated plastic fixtures, 2003 V4: 2 +general conditions in contract documents, 2004 V1: 62 General Conditions of the Contract for Construction, 2004 +V1: 62 +General Conference of Weights and Measures (CGPM), 2004 V1: 32 +general corrosion, 2004 V1: 153, 1999 V2: 289–290 General Electric Company, 2004 V1: 211 +general laboratory-grade water, 1999 V2: 317 General phase in value engineering, 2004 V1: 213 General section in specifications, 2004 V1: 68 +General Services Administration (GSA), 2004 V1: 263 General Storage (NFPA 231), 2000 V3: 2, 29 generalized total costs, 2004 V1: 223 +generally-accepted standards, defined, 2004 V1: 25 Geogehegan, R.F., 1999 V2: 350 +geography +cost estimates and, 2004 V1: 98 +in plumbing cost estimation, 2004 V1: 94 geological stability of sites, 1999 V2: 26 geothermal energy, 2004 V1: 131 geothermal heat pumps, 1999 V2: 243 +Get Your Process Water to Come Clean, 1999 V2: 325 GFCI (government furnished, contractor installed), 2004 +V1: 71 +“giga” prefix, 2004 V1: 34 +glass borosilicate piping, 1999 V2: 14, 15, 122 glass-bulb sprinklers, 2000 V3: 9 +glass-lined pipes, 2000 V3: 48 glass piping +characteristics, 2003 V4: 45–48 expansion, 2003 V4: 48 fittings, 2003 V4: 48, 49–50 +special wastes, 1999 V2: 334, 341 glass washers +demineralized water, 2000 V3: 46 health-care facilities, 2000 V3: 32, 36 heat recovery systems, 2004 V1: 266 laboratory rooms, 2000 V3: 37 +pure water systems for, 2000 V3: 46 glazed fixture surfaces, 2003 V4: 1 Glidden, R., 1999 V2: 277 +globe valves (GLV), 2004 V1: 9 glossaries +acoustics in plumbing systems, 2004 V1: 206–210 conserving energy, 2004 V1: 136–137 +corrosion, 2004 V1: 151–154 +fuel-gas systems, 1999 V2: 213–214 + +313 + + +gas boosters, 1999 V2: 182–183 health-care facilities, 2000 V3: 83–86 industrial wastewater, 2000 V3: 88 measurement units, 2004 V1: 32 +plumbing terminology, 2004 V1: 17–31 pressure-regulating valves, 1999 V2: 152 references for, 2004 V1: 40 +seismic protection, 2004 V1: 191 vents and venting, 1999 V2: 64 +glove boxes, 1999 V2: 342, 343 +GLSP (good large-scale production), 1999 V2: 343 glues, 1999 V2: 284 +GLV (globe valves), 2004 V1: 9 gold, 2004 V1: 141 +Gold-level LEED certification, 2004 V1: 263 golf clubs, 1999 V2: 237 +good engineering practice, 1999 V2: 329 +good large-scale production (GLSP), 1999 V2: 343 “good value,” defined, 2004 V1: 213 +goods, costs of, 2004 V1: 222 gooseneck spouts, 2003 V4: 14 Gorry, M., 1999 V2: 325 +governing fixtures, 1999 V2: 125, 129 +government furnished, contractor installed (GFCI), 2004 V1: 71 +gpd, GPD (gallons per day), 2004 V1: 15 gpg (grains per gallon), 1999 V2: 285 gph, GPH (gallons per hour), 2004 V1: 15 +gph, standard (std gph, SGPH), 2004 V1: 15 gpm (gallons per minute) +converting to fixture units, 1999 V2: 120, 124, 126, 2000 V3: 218, 234 +converting to metric units, 2000 V3: 29 fountains, 2000 V3: 115 +orifice size and, 2000 V3: 7 wells, 1999 V2: 240 +gr, GR (grains). See grains grab bars +ambulatory accessible toilet compartments, 2004 V1: 115 +bathtub accessibility, 2004 V1: 117 clearance, 2004 V1: 122 +health care facilities, 2000 V3: 34 shower stalls, 2004 V1: 121–122 standards for, 2004 V1: 114–122 +water closet and toilet accessibility, 2004 V1: 114 grades +defined, 2004 V1: 25 +maintaining for piping, 2003 V4: 25 grain size, 2000 V3: 132 +grains (gr, GR) +converting to SI units, 2004 V1: 39 grains per gallon, 1999 V2: 285 symbols for, 2004 V1: 15 +grandstands, numbers of fixtures for, 2003 V4: 19 granular filters +compared to diatomaceous earth filtration, 2000 V3: 135–137 +overview, 2000 V3: 132–134 +swimming pool usage, 2000 V3: 131–134 types of, 2000 V3: 139 +314 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +granulated carbon filters, 1999 V2: 318, 323. See also activated carbon filtration +granule tests, 2003 V4: 5 +graphic annunciators, 2000 V3: 24 +graphic conventions in plumbing drawings, 2004 V1: 108 graphite, 2004 V1: 141 +graphite anodes, 2004 V1: 150 graphitic corrosion, 2004 V1: 153 graphitization +cast iron, 2004 V1: 141 defined, 2004 V1: 153 +graphs, water supply, 2000 V3: 5, 6 +grate-type inlets in site storm systems, 1999 V2: 98 grates +anti-vortex grating, 2000 V3: 110 buffing, 1999 V2: 11 +grate open areas for floor drains, 1999 V2: 10 materials for, 1999 V2: 14 +on swimming pool drains, 2000 V3: 143 sanitary drainage systems, 1999 V2: 10–12 +gravel filters, 2000 V3: 132 gravels +fill above subsurface drainage pipes, 1999 V2: 103 gray-water irrigation systems and, 1999 V2: 26, 27 +gravimetric measurement of solids, 1999 V2: 287 gravitational acceleration units, 2004 V1: 1 gravitational constants (g, G), 2004 V1: 1, 15 gravity +acceleration of water, 1999 V2: 1–2 forces in earthquakes, 2004 V1: 186 loads, 2004 V1: 155 +gravity circulation, 2004 V1: 5 +gravity drainage, 1999 V2: 329, 2000 V3: 140 gravity drops, 2000 V3: 156 +gravity-film heat exchangers, 2004 V1: 266 gravity-flow systems, 2003 V4: 32, 49 gravity flushes, 2004 V1: 195, 2003 V4: 6–8 gravity returns, 2000 V3: 186–187, 188 gravity sand filtration, 2000 V3: 132, 134 gravity separators in oil spills, 1999 V2: 348 Gravity Sewer Pipe, 2003 V4: 32 +gravity sewers, 1999 V2: 226 gravity tank systems +fire-protection connections, 2000 V3: 225, 227 fire-protection water supply, 2000 V3: 232 operation of, 1999 V2: 150–152 +suction piping and, 1999 V2: 248 supply piping, 1999 V2: 249 +gravity valves, 2000 V3: 118 +gravity vents for gas appliances, 1999 V2: 178 gravity water filters, 1999 V2: 244 +gray cast-iron pressure pipe, 2003 V4: 32 Gray, G.D., 1999 V2: 34 +gray-water systems +amount of generated gray water, 1999 V2: 23 benefits of water reuse, 2004 V1: 135 +codes and standards, 1999 V2: 22 +designing for supply and consumption, 1999 V2: 23–27 economic analysis of, 1999 V2: 29–32 +green uses of gray water, 2004 V1: 264 health-care facilities, 2000 V3: 43, 45 introduction, 1999 V2: 21 + +overview, 2004 V1: 267 precautions, 1999 V2: 32–33 +public concerns and acceptance, 1999 V2: 33 reasons for using, 1999 V2: 21 +reclaimed water, 2004 V1: 135 references, 1999 V2: 34 +system description and components, 1999 V2: 22–23 treatment systems, 1999 V2: 27–29 +Gray-water Systems, 1999 V2: 34 grease +exclusion from gray-water systems, 1999 V2: 21 fats in kitchens, 1999 V2: 13, 2000 V3: 36 grease traps, defined, 2004 V1: 25 +horizontal wet-vented systems and, 1999 V2: 46 interceptors. See grease interceptors +grease interceptors codes, 2004 V1: 43 +commercial kitchen sinks and, 1999 V2: 13, 2003 V4: 12 +defined, 2004 V1: 25 +private sewage-disposal systems, 1999 V2: 235 septic tanks and, 1999 V2: 230, 232 +grease traps +codes, 2004 V1: 43 +commercial kitchen sinks and, 2003 V4: 12 greatest temperature difference (GTD), 2004 V1: 15 Green Building Council, 2004 V1: 263 +Green Building Rating System (LEED), 2004 V1: 263–265 green design, 2004 V1: 263–267 +green roof designs, 2004 V1: 266–267 green sands, 1999 V2: 302 +green water in pools, 2000 V3: 148 Greene, Norbert D., 2004 V1: 154 +Greening Federal Facilities, 2004 V1: 134, 137 gridded systems, 2000 V3: 8 +grinder pumps +defined, 2004 V1: 25 +in sewage tanks, 1999 V2: 226 Grossel, S.F., 1999 V2: 350 ground failure, 2004 V1: 158 +ground floor space. See clear floor space ground-motion time history, 2004 V1: 160 +ground-mounted water storage tanks, 1999 V2: 247 ground ruptures, 2004 V1: 158 +ground shaking, 2004 V1: 158–159, 161 ground water +defined, 1999 V2: 282 +determining quantities, 1999 V2: 100–101 disposal of, 1999 V2: 105 +feed water for pure water systems, 1999 V2: 321 gray-water irrigation systems and, 1999 V2: 26 monitoring, 2000 V3: 162 +private water systems, 1999 V2: 239 storage tanks and, 2000 V3: 172 storm-drainage systems, 1999 V2: 67 +swimming pool locations and, 2000 V3: 128 underground tanks and, 2000 V3: 155 wicking into buildings, 1999 V2: 99 +groundspace for wheelchairs. See clear floor space group washups, 2003 V4: 11 +grouts in wells, 1999 V2: 243 growth rate of fires, 2000 V3: 2 +Index + + +GSA (General Services Administration), 2004 V1: 263 GSA Guide Specification Number 3-1515-71 (Public +Building Service), 2004 V1: 199 +GTD (greatest temperature difference), 2004 V1: 15 guaranty bonds, 2004 V1: 62 +guard posts for hydrants, 2000 V3: 228, 229 +A Guide to Airborne, Impact and Structure-Borne Noise Control in Multifamily Dwellings, 2004 V1: 199 +guide-vane tips, acoustic modifications, 2004 V1: 197 Guidelines for Seismic Restraints of Mechanical Systems, +2004 V1: 191 +Gut Feel Index, 2004 V1: 254 gutters (pools) +drains, 2000 V3: 142 filtration and, 2000 V3: 137 skimmers and, 2000 V3: 137 +surge tanks and, 2000 V3: 137 gutters (roofs), 1999 V2: 81, 86 gutters (street), 1999 V2: 99 +GV (gas vents), 2004 V1: 8, 1999 V2: 213 GV (gate valves), 2004 V1: 9, 1999 V2: 332 +gymnasiums, numbers of fixtures for, 2003 V4: 19 gypsum board, lining with lead, 1999 V2: 340 + +H +H (enthalpy), 2004 V1: 14 +h (hecto) prefix, 2004 V1: 34 H (henrys), 2004 V1: 33 +h (hours), 2004 V1: 15, 34 +h (velocity head), 2004 V1: 5 H-I alloy, 2004 V1: 144 +H/m (henrys per meter), 2004 V1: 33 ha (hectares), 2004 V1: 34 +hair strainers, 2000 V3: 150 HALAR piping, 2000 V3: 48 +half-circle rotary sprinkler heads, 2000 V3: 102 half-dome ends on tanks, 2000 V3: 156 +half-full conditions (HF), 2004 V1: 1 half lives, defined, 1999 V2: 340 +halogenated agents, 2000 V3: 22, 27, 70, 83 halon 1211, 2000 V3: 22 +halon 1301, 2004 V1: 25, 2000 V3: 22 +Halon 1301 Fire Extinguishing Systems (NFPA 12A), 2000 V3: 23, 29 +halon system types, 2004 V1: 25–26 halothane, 2000 V3: 70 +hammer. See water hammer +hand-held extinguishers, 2000 V3: 19, 20 hand-held shower heads, 2004 V1: 120 +hand tools for vacuum cleaning systems, 1999 V2: 269–270 hand trenching, labor productivity rates, 2004 V1: 95–97 Handbook for Mechanical Engineers, 2004 V1: 2, 3, 5, 40 Handbook of Chlorination, 1999 V2: 155 +Handbook of Corrosion Resistant Pipeline, 2000 V3: 97 Handbook of Fundamentals, 2004 V1: 2, 5, 6, 40 Handbooks (ASHRAE), 1999 V2: 214 +handicapped individuals. See people with disabilities handling section in specifications, 2004 V1: 70, 89–90 hands-free controls on sinks, 2000 V3: 33, 34 handwashing lavatories, 2000 V3: 32, 36, 45 hangers. See supports and hangers +hard conversions, 2004 V1: 32 + +315 + + +hard-temper tubing, 1999 V2: 14, 68, 2000 V3: 73 hardness of water +boiler feed water, 1999 V2: 314 degrees of hardness, 1999 V2: 283 +ion exchange treatment, 1999 V2: 300 pH and alkalinity, 1999 V2: 293 private water systems, 1999 V2: 244 swimming pools and, 2000 V3: 147 +water softener treatments, 1999 V2: 307–308 Harris, Nigel, 1999 V2: 277 +Hastelloy B, 1999 V2: 333 Hastelloy C, 2004 V1: 141, 144 +hazardous materials, emergency fixtures and, 2003 V4: 17 hazardous wastes +defined, 2000 V3: 88 permits, 2000 V3: 89 +hazards +accidental acid spills, 1999 V2: 332 asbestos, 2003 V4: 26 +backflow prevention, 1999 V2: 145, 146 +chemical material safety data sheets, 2000 V3: 90 classes of hazard occupancies, 2004 V1: 29, 2000 V3: +17 +cold-water systems, 1999 V2: 115 controlled substance spills, 1999 V2: 277 diatomaceous earth filters, 2000 V3: 134 +exposed piping and accessibility, 2004 V1: 117 fire hazards, 2004 V1: 24, 2000 V3: 2–3 flammable and volatile liquids, 1999 V2: 347–349 gas appliances, 1999 V2: 178 +gas boosters, 1999 V2: 179 +gases in septic tanks, 1999 V2: 230 gray-water systems, 1999 V2: 32–33 hazardous gases, 1999 V2: 332 +hazardous materials, defined, 2000 V3: 88 hazardous substances, defined, 2000 V3: 88 hazardous wastes, defined, 2000 V3: 88 +hot-water systems, 1999 V2: 157, 169–170 liquefied petroleum gas, 1999 V2: 194, 197 plumbing systems and, 2004 V1: 266 radiation, 1999 V2: 337–338 +radioactive waste-drainage systems, 1999 V2: 341 sanitary precautions for wells, 1999 V2: 243 types of acids, 1999 V2: 332–334 +vacuum cleaning system issues, 1999 V2: 276 Hazen-Williams formula +chart explanation, 1999 V2: 121 charts, 1999 V2: 118, 119 defined, 2004 V1: 2, 1999 V2: 7 +friction losses, 1999 V2: 116, 2000 V3: 118 HB (hose bibbs), 2004 V1: 10, 1999 V2: 121 HCFCs (hydrochlorofluorocarbons), 2000 V3: 22 hd, HD (head). See pressure (PRESS, PRES, P) +HDPE (high density polyethylene), 2000 V3: 252, 254, 2003 V4: 58, 61 +head (hd, HD). See pressure (PRESS, PRES, P) +head loss. See pressure drops or differences (PD, DELTP) head walls on culverts, 1999 V2: 99 +header systems, 1999 V2: 127 headroom around pipes, 2003 V4: 25 headwall gas systems, 2000 V3: 56–57 health-care facilities +316 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +defined, 2000 V3: 84 +drainage systems, 2000 V3: 39–42 +acid-waste metering, 2000 V3: 41–42 +acid-waste solids interceptors, 2000 V3: 41, 43 acidic-waste neutralization, 2000 V3: 40–41 discharge to sewers, 2000 V3: 40 +sink traps, 2000 V3: 42 +waste and vent piping, 2000 V3: 42 fixtures and equipment, 2000 V3: 31–39 +general requirements, 2000 V3: 33 kitchens and laundries, 2000 V3: 36 laboratory rooms, 2000 V3: 37–39 numbers of fixtures for, 2003 V4: 20 selection process, 2000 V3: 31–34 special equipment, 2000 V3: 39 +for specific areas, 2000 V3: 33–36 unique fixtures, 2000 V3: 37, 38 +glossary, 2000 V3: 83–86 +medical gas and vacuum systems, 2000 V3: 49–83 certification, 2000 V3: 77–83 +codes and standards, 2000 V3: 83 design checklist, 2000 V3: 49–50 dispensing equipment, 2000 V3: 54–59 gas flow rates, 2000 V3: 50–54 +gas storage, 2000 V3: 59–68 number of stations, 2000 V3: 50 piping, 2000 V3: 73–77 +system control valves, 2000 V3: 71–72 vacuum systems, 2000 V3: 54, 68–70 warning systems, 2000 V3: 72–73 +waste anesthetic gas management, 2000 V3: 70–71 plumbing overview, 2000 V3: 32 +references, 2000 V3: 86 resources, 2000 V3: 86 +water-supply systems, 2000 V3: 43–48 non-potable water, 2000 V3: 45 potable water, 2000 V3: 45 +pure-water systems, 2000 V3: 46–48 +Health-Care Facilities (NFPA 99), 2000 V3: 50, 56, 66–67, 68, 77 +health hazards. See hazards hearing disabilities, 2004 V1: 107 +heart-and-lung machines, 2000 V3: 39 heat (HT) +compression, 2000 V3: 204 conversion factors, 2004 V1: 36 heat detectors, 2000 V3: 25 latent, 2004 V1: 15, 137 measurements, 2004 V1: 33 protecting against, 1999 V2: 19 sensible, 2004 V1: 16, 137 symbols for, 2004 V1: 15 +water-heater heat recovery, 1999 V2: 158–159 heat-activated air dryers, 2000 V3: 204 +heat-actuated devices (H.A.D), 2000 V3: 13 heat distortion of plastic pipe, 2003 V4: 60 Heat Exchange Institute, 1999 V2: 265 heat exchangers and exchange systems +air dryers, 2000 V3: 204 +corrosion inhibitors, 2004 V1: 151 geothermal energy, 2004 V1: 131 in green building, 2004 V1: 266 + +heat exchanger loop gas booster systems, 1999 V2: 181, 182 +mineral deposits and, 2000 V3: 147 swimming pools, 2000 V3: 138 vibration isolation, 2004 V1: 205 waste heat usage, 2004 V1: 131–134 +heat fusion joints +heat-fused socket joints, 1999 V2: 334 PEX piping, 2003 V4: 61 +special wastes and, 2000 V3: 40 heat gain (HG, HEATG) +latent (LHG, HGL), 2004 V1: 15 sensible (SHG, HGS), 2004 V1: 15, 16 symbols for, 2004 V1: 15 +heat loss (HL, HEATL) defined, 2004 V1: 15 +heat loss retardants, 2000 V3: 150 swimming pools, 2000 V3: 144 +water heater energy savings and, 2004 V1: 265 water heater location and, 2004 V1: 129 +heat pumps, waste heat usage, 2004 V1: 134 heat recovery systems, 2004 V1: 134, 266 heat-trace systems, 1999 V2: 165–166 +heat transfer (Q) +condensate drainage and, 2000 V3: 189 +heat transfer coefficients (U, U), 2004 V1: 15 symbols for, 2004 V1: 15 +heat-up method of condensate drainage, 2000 V3: 191 heated water. See hot-water systems +heaters (HTR), 2004 V1: 15. See also water heaters HEATG (heat gain). See heat gain +heating engineers, 2000 V3: 27–28 heating feed water +for microbial control, 1999 V2: 312 for pure water systems, 1999 V2: 322 +heating hot water return (HHWR), 2004 V1: 9 heating hot water supply (HHWS), 2004 V1: 9 heating systems. See HVAC systems +heating values of natural gas, 1999 V2: 173, 212, 214 heating, ventilation, and air-conditioning systems. See +HVAC systems +heating water. See water heaters HEATL (heat loss), 2004 V1: 15 heavy clay loams, 2000 V3: 100 +heavy equipment earthquake recommendations, 2004 V1: 163 +heavy metals, 2000 V3: 95 +heavy process gas service, 2000 V3: 249 hectares, 2004 V1: 34 +“hecto” prefix, 2004 V1: 34 +heel inlets on traps, 1999 V2: 16 heel-proof grates, 1999 V2: 10 heel-proof strainers, 1999 V2: 80 height (hgt, HGT, HT) +of fountains, 2000 V3: 120 +grab bars for accessibility, 2004 V1: 114 laundry equipment, 2004 V1: 123 sinks, 2004 V1: 117 +symbols for, 2004 V1: 15 toilet seats, 2004 V1: 114 +helium, 2000 V3: 56 +Henriques, F.C., Jr., 1999 V2: 169, 170 +Index + + +henrys, 2004 V1: 33 +henrys per meter, 2004 V1: 33 HEPA filters, 1999 V2: 268, 345 +heptafluorocarbons (HFCs), 2000 V3: 22 heptafluoropropane, 2000 V3: 22 herbicides, 1999 V2: 230 +hermetic gas boosters, 1999 V2: 179 hertz, 2004 V1: 33, 206 +Hesser, Henry H., 1999 V2: 277 hexametaphosphate, 1999 V2: 244 HF (half-full conditions), 2004 V1: 1 +HFCs (heptafluorocarbons), 2000 V3: 22 HG (heat gain). See heat gain +Hg, HG (mercury), 2004 V1: 15 HG (high-pressure gas), 2004 V1: 8 +HGL (latent heat gain), 2004 V1: 15 HGS (sensible heat gain), 2004 V1: 15, 16 hgt, HGT (height). See height +HHWR (heating hot water return), 2004 V1: 9 HHWS (heating hot water supply), 2004 V1: 9 HI (film coefficients), 2004 V1: 14 +Hicks, Tyler G., 1999 V2: 114 +high-backflow hazard, 2000 V3: 222 high-capacity wells, 1999 V2: 240 +high-density polyethylene (HDPE), 2000 V3: 252, 254 high-efficiency water heaters, 2004 V1: 265, 267 +high-energy beta radiation, 1999 V2: 337 +high-expansion foam extinguishers, 2000 V3: 21 high-hazard fires, 2000 V3: 16 +high-hose retrievers, 2000 V3: 165 +high-level water tank alarms, 1999 V2: 151, 2000 V3: 90 high-piled storage, 2000 V3: 230 +high-pressure carbon dioxide systems, 2000 V3: 20–21 high-pressure condensate (HPC), 2004 V1: 9 +high-pressure cylinders, 2000 V3: 49 high-pressure gas (HG), 2004 V1: 8 +high-pressure nitrogen systems, 2000 V3: 68 high-pressure piping, 2000 V3: 196–197 +high-pressure steam (hps, HPS), 2004 V1: 9, 15, 2000 V3: 175, 182 +high-pressurization air drying, 2000 V3: 203–204 high-purity water. See water purification +high-radiation areas, 1999 V2: 339, 341 high-rate dispensers, 2000 V3: 169 high-rate filters, 2000 V3: 113, 132 high-rise buildings, 1999 V2: 180, 195 High-rise Plumbing, 1999 V2: 114 +high-silicas cast iron piping, 1999 V2: 14, 15, 2000 V3: 40, 42 +high-silicon iron anodes, 2004 V1: 150 high-suds detergents, 1999 V2: 36–37, 39 +High Temperature Condensate Return (TES 582), 2000 V3: 197 +high-temperature hot water (hthw, HTHW), 2004 V1: 15 high-temperature withstand, 1999 V2: 166 +high-to-low pressure loss in vacuum systems, 1999 V2: 263 high vacuum, 1999 V2: 262 +high-velocity filters, 2000 V3: 139 +high-velocity fixtures, acoustic design and, 2004 V1: 195 high-velocity jetted well digging, 1999 V2: 241 +high-volume sprinklers in irrigation, 2000 V3: 100 highest order functions, 2004 V1: 227 + +317 + + +Hillman, 2004 V1: 191 hip baths, 2000 V3: 35 history +of earthquake damage, 2004 V1: 161–163 of fire-protection systems, 2000 V3: 1–2 +HL (heat loss), 2004 V1: 15 +HO (film coefficients), 2004 V1: 14 Hodnott, Robert M., 2004 V1: 191 Hoffman Industries, 1999 V2: 277 +Hoffman Steam Heating Systems Design Manual and Engineering Data (TES 181), 2000 V3: 197 +hoists for immersion baths, 2000 V3: 35 +hold-down straps on storage tanks, 2000 V3: 172 holding rooms, 2000 V3: 58 +holes +in coatings, 2004 V1: 147 for perc tests, 1999 V2: 219 +holidays +in coatings, 2004 V1: 147, 2000 V3: 172 in labor costs, 2004 V1: 94 +hollow-fiber modules +in cross-flow filtration, 1999 V2: 311 in reverse osmosis, 1999 V2: 289, 309 +homogeneity in rate of corrosion, 2004 V1: 145 horizontal branches +branch intervals, 1999 V2: 64 defined, 1999 V2: 64 +laboratory gas piping, 1999 V2: 177 roof drainage, 1999 V2: 88 +sovent systems, 1999 V2: 57–60 +storm drainage calculation form, 1999 V2: 110 horizontal drains +cross-sections of, 1999 V2: 2 fixture loads, 1999 V2: 7, 9 flow in, 1999 V2: 2 +hydraulic jumps in, 1999 V2: 6 minimum slope of piping, 1999 V2: 7 +sloping drains in sanitary drainage systems, 1999 V2: 5–9 +steady flow in, 1999 V2: 6–7 horizontal filters, 2000 V3: 131 +horizontal loads of piping, 2004 V1: 184, 185–186 horizontal pressure-media filters, 1999 V2: 300 horizontal pumps +centrifugal, 2000 V3: 140 defined, 2004 V1: 24 +split-case pumps, 2004 V1: 24, 2000 V3: 25, 115, 142 horizontal wet-vented systems, 1999 V2: 45–46 horsepower (hp, HP) +air horsepower (ahp, AHP), 2004 V1: 14 brake horsepower (bhp, BHP), 2004 V1: 6, 14 converting to SI units, 2004 V1: 39 +indicated horsepower (ihp, IHP), 2004 V1: 15 +shaft horsepower (sft hp, SFT HP, SHP), 2004 V1: 16 symbols for, 2004 V1: 15 +hose bibbs (HB), 2004 V1: 10, 1999 V2: 121, 2000 V3: 36, 2003 V4: 25 +hose demand, 2000 V3: 17 hose outlets, 2004 V1: 12 +hose stations, dry, 2004 V1: 13, 2000 V3: 27 hose streams in firefighting, 2000 V3: 230 hose thread outlets, 2003 V4: 14 +318 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +hose valves, 2000 V3: 18 hoses +bed pans, 2000 V3: 38 +compressed air pipe sizing, 2000 V3: 210 flexible gas hoses, 1999 V2: 196 +fuel dispensers, 2000 V3: 165 medical gas tubing, 2000 V3: 77 retrievers, 2000 V3: 165 +vacuum cleaning hose capacity, 1999 V2: 270 vacuum cleaning hose materials, 2000 V3: 146 vacuum cleaning systems. See tubing +hosing out cartridge filters, 2000 V3: 113 +hospitals, 1999 V2: 16, 147, 2003 V4: 20, 21. See also health-care facilities +hot fluids, glass piping and, 2003 V4: 47 hot-vapor atmospheric vents, 2004 V1: 9 hot-water heat exchangers, 2000 V3: 121 +hot water recirculating (HWR), 2004 V1: 8, 265 hot-water returns, 2004 V1: 8 +hot-water supply (HW) +heating hot water supply, 2004 V1: 8 potable water, 2000 V3: 45 +symbols for, 2004 V1: 8 hot-water systems +avoiding standby losses, 2004 V1: 127 circulation systems, 1999 V2: 165 codes and standards, 1999 V2: 170 components, 1999 V2: 166 +conserving energy, 2004 V1: 124–125, 127, 128 corrosion rates, 2004 V1: 145 +earthquake damage, 2004 V1: 162 equations, 1999 V2: 158 +exposed piping and accessibility, 2004 V1: 117 heat exchangers, 2000 V3: 121 +hot water properties, 1999 V2: 168 +hot-water temperatures, 2004 V1: 120, 1999 V2: 159, 161–165, 2000 V3: 36, 45, 139 +insulation, 1999 V2: 166 introduction, 1999 V2: 157–158 +maintaining temperatures, 1999 V2: 165 mixed-water temperatures, 1999 V2: 159–160 natural gas heating, 1999 V2: 174 +pipe codes, 2004 V1: 45 +pipe vibration isolation, 2004 V1: 205 relief valves, 1999 V2: 166–167 +safety and health concerns, 1999 V2: 169–170 scalding water, 1999 V2: 169–170 +thermal efficiency, 1999 V2: 169 thermal expansion, 1999 V2: 167–168 +types of domestic systems, 2004 V1: 129–134 waste heat usage, 2004 V1: 131–134 +water heater heat recovery, 1999 V2: 158–159 water heaters, 1999 V2: 160–165 +hot-water temperatures +accessible shower compartments, 2004 V1: 120 charts, 1999 V2: 161–164 +health-care facilities, 2000 V3: 36, 45 high-temperature hot water, 2004 V1: 15 maintaining temperatures, 1999 V2: 165 +mixed-water temperatures, 1999 V2: 159–160 scalding water, 1999 V2: 169–170 +swimming pools, 2000 V3: 139 + +hotels +acoustic plumbing design for, 2004 V1: 196 numbers of fixtures for, 2003 V4: 20 +septic tank/soil-absorption systems for, 1999 V2: 231–232 +vacuum calculations for, 1999 V2: 269 hours (h, HR), 2004 V1: 15, 34 +house drains. See building drains housed-spring mountings, 2004 V1: 204 houses. See buildings +housing project sewers, 1999 V2: 231–232 housings for gas boosters, 1999 V2: 179 housings for gas filters, 2000 V3: 250 HOW logic path, 2004 V1: 230, 231 +How to Design Spencer Central Vacuum Cleaners, 1999 V2: 277 +hp, HP (horsepower). See horsepower +HPC (high-pressure condensate), 2004 V1: 9 hps, HPS (high-pressure steam), 2004 V1: 9, 15 HR (hours), 2004 V1: 15, 34 +HT (heat). See heat HT (height). See height +hthw, HTHW (high-temperature hot water), 2004 V1: 15. See also hot-water temperatures +HTR (heaters), 2004 V1: 15. See also water heaters +hub-and-spigot piping and joints. See also bell-and-spigot joints and piping +acid wastes and, 2000 V3: 42 +cast-iron soil pipe, 2003 V4: 27, 29–31 defined, 2004 V1: 26 +sanitary piping, 1999 V2: 14 hubless piping +bracing cast-iron pipe, 2004 V1: 177 cast-iron soil pipe, 2003 V4: 27, 28, 31 hubless, defined, 2004 V1: 26 +riser bracing for hubless pipes, 2004 V1: 178 sanitary piping, 1999 V2: 14 +HUD (Housing and Urban Development), 2004 V1: 105, 106 +humidity +humidity ratios (W, W), 2004 V1: 15 relative (rh, RH), 2004 V1: 15 +Hunter, Roy B., 1999 V2: 3, 4, 49, 65, 155 Hunter’s curve for peak load, 1999 V2: 60 Hurricane filters, 1999 V2: 300 +HVAC engineers, 2000 V3: 27–28, 213 HVAC systems +copper pipes, 2003 V4: 35, 36 exhaust ducts, 1999 V2: 274 glass pipes, 2003 V4: 47 heating systems, 2000 V3: 178 roof drains, 1999 V2: 83 +steel pipe, 2003 V4: 48 +HW (hot water supply), 2004 V1: 8 +HWR (hot water recirculating), 2004 V1: 8, 265 hybrid vaporizers, 2000 V3: 61 +hydrant wrenches, 2000 V3: 4 hydrants +butt caps, 2000 V3: 4, 219 +coefficients of discharge, 2000 V3: 4, 5 distance between, 1999 V2: 250 +fire-protection water supply, 2000 V3: 226–228 +Index + + +fire pumps for, 2000 V3: 25 +flow tests, 1999 V2: 122, 2000 V3: 4, 5, 217, 219 guards, 2000 V3: 228, 229 +hydrant butts, 2000 V3: 7, 8 outlets, 2000 V3: 5 +pressure drop and, 1999 V2: 249 public hydrants, 2004 V1: 12 valves, 2004 V1: 24 +wall hydrants, 2004 V1: 10, 12 +hydraulic balancing in fountains, 2000 V3: 117–118 hydraulic calculations +fountain displays, 2000 V3: 121 sprinkler systems, 2000 V3: 15, 16–17 +hydraulic design +sprinkler systems, 2000 V3: 15–18 swimming pool filters, 2000 V3: 140 +hydraulic irrigation valves, 2000 V3: 103 hydraulic jumps in flow, 1999 V2: 2, 6, 67 hydraulic mean depth of flow, 2004 V1: 1 hydraulic radii (R), 2004 V1: 1 +hydraulic shock, calculating, 2004 V1: 6 hydraulic soil conditions, 1999 V2: 217–220 hydraulics of wells, 1999 V2: 241–243 hydrazine, 1999 V2: 315 +Hydro 35 (National Weather Service), 2000 V3: 242 hydrobromic acid, 1999 V2: 333 +hydrocarbons +classifications, 2000 V3: 153–154 contamination in compressed air, 2000 V3: 201 medical gas system tests, 2000 V3: 83 +hydrochloric acid +in laboratory wastes, 1999 V2: 333 in pools, 2000 V3: 146, 148 +in regeneration, 1999 V2: 295, 305 in water chemistry, 1999 V2: 281 +hydrochlorofluorocarbons (HCFCs), 2000 V3: 22 hydrodynamic noise generation, 2004 V1: 197 hydrogen, 1999 V2: 281, 302, 329, 2000 V3: 91 hydrogen embrittlement, 2004 V1: 153 hydrogen film buildup, 2004 V1: 139 +hydrogen fluoride, 2000 V3: 22 hydrogen overvoltage, 2004 V1: 153 +hydrogen peroxide, 1999 V2: 311, 2000 V3: 48 hydrogen sulfide, 1999 V2: 284, 292, 294 Hydronics Institute, 2000 V3: 178, 197 hydrophilic well piping, 2000 V3: 109 hydropneumatic-tank systems, 1999 V2: 150, 247 hydroquinone, 1999 V2: 315 +hydrostatic monitoring systems, 2000 V3: 160, 161 hydrostatic pressure, 1999 V2: 4, 2000 V3: 191 hydrostatic relief valves, 2000 V3: 144 +hydrostatic tests, 2000 V3: 171 hydrotherapy immersion baths, 2000 V3: 35 hydroxides, 1999 V2: 281, 282, 2000 V3: 91 hydroxyl, 1999 V2: 302, 313, 329 hyperbaric, 2000 V3: 84, 85 hyperchlorination, 2000 V3: 123 +hypobaric, 2000 V3: 84 +hypochlorinators, 2000 V3: 148, 149, 150–151 hypochlorous acid, 2000 V3: 146, 148 +Hz (hertz), 2004 V1: 33, 206 +Hz, HZ (frequencies), 2004 V1: 15, 33 + +319 + +I +IAPMO (International Association of Plumbing and Mechanical Officials), 2004 V1: 54, 58, 1999 V2: 34, 214, 2003 V4: 18 +ICBO (International Conference of Building Officials), 2004 V1: 191 +ICC (International Code Council), 2004 V1: 55, 59, 60 ice. See freezing temperatures +ice makers, 2000 V3: 32 +icfm (inlet cubic feet per minute) dynamic air compressors, 2000 V3: 66 medical air compressors, 2000 V3: 65 vacuum piping systems, 1999 V2: 256 +ID (inside diameters), 2004 V1: 14 +idea evaluation checklists, 2004 V1: 237–241 idea generators, 2004 V1: 232 +ideal water-system sizing method, 1999 V2: 127 identifying parts of gray-water systems, 1999 V2: 22, 33 ignition (torch) testing, 2003 V4: 2 +ihp, IHP (indicated horsepower), 2004 V1: 15 illegal connections to water meters, 1999 V2: 115 illuminance +conversion factors, 2004 V1: 36 measurements, 2004 V1: 33 +Illustrated National Plumbing Code Design Manual, 1999 V2: 114 +imaginary costs, 2004 V1: 223 +imaging-science facilities, 1999 V2: 340 immediate strip concrete methods, 2003 V4: 32 immersion baths, 2000 V3: 32, 35, 38 +immersion-type vacuum separators, 1999 V2: 268 immiscible liquids, 1999 V2: 280 +impact heads in sprinkler systems, 2000 V3: 102–103 impaired individuals. See people with disabilities impellers +acoustic modifications for blades, 2004 V1: 197 pump impeller diameters, 2004 V1: 6 +sources of noise in pumps, 2004 V1: 197 imperviousness factor, 2000 V3: 242–243 impingement attack corrosion, 2004 V1: 141, 153 +Implementation Follow-up phase in value engineering, 2004 V1: 213 +Implementation Presentation phase in value engineering, 2004 V1: 213 +importance +assigning in function analysis, 2004 V1: 225 +of equipment or systems in seismic force calculations, 2004 V1: 183 +impoundment basins, 2000 V3: 167 impressed current systems, 2004 V1: 147, 150 impulse traps, 2000 V3: 182 +impurities in water, 1999 V2: 280–284 +in-ground vapor monitoring, 2000 V3: 162 in. Hg (inches of mercury), 1999 V2: 254, 257 in-line filters, 2000 V3: 66 +in-line pumps, 2004 V1: 24 +in-line shut-off valves, 2000 V3: 71 in-plant isolation, 1999 V2: 145–147 +in-wall piping, acoustic design and, 2004 V1: 195 in3 (cubic inches), 2004 V1: 14 +inadequate water pressure, 1999 V2: 149–152 inch-pound units (IP) +320 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +converting, 1999 V2: 256, 2000 V3: 29 +flow rates and pressure measurements, 2000 V3: 200 natural gas piping sizing, 1999 V2: 197 +use of, 1999 V2: 253 inches +converting to metric units, 2000 V3: 29 converting to SI units, 2004 V1: 39 +of mercury (in. Hg), 2004 V1: 39, 1999 V2: 254, 257 per hour (in./h), 2000 V3: 99 +incident angles (INANG), 2004 V1: 15 incineration systems, 2004 V1: 130–131 incinerator toilets, 2004 V1: 265 inconel, 2004 V1: 141, 144 +incrustation in water, 1999 V2: 244 +independent functions in FAST approach, 2004 V1: 230 indicated horsepower (ihp, IHP), 2004 V1: 15 +indirect discharges, 2000 V3: 89 indirect drains (D), 2004 V1: 8 +indirect-fired gas water heaters, 2000 V3: 138, 146 indirect waste pipes, 2004 V1: 26, 2003 V4: 12 +indirect waste receptors, 1999 V2: 16, 17, 2003 V4: 17. See also floor sinks +individual aerobic waste treatment plants, 1999 V2: 232–233 +Individual Home Wastewater Characterization and Treatment, 1999 V2: 238 +individual vents, 2004 V1: 26. See also revent pipes indoor gas boosters, 1999 V2: 180 +indoor gas hose connectors, 1999 V2: 196 +indoor swimming pools. See also swimming pools components for, 2000 V3: 139 +considerations, 2000 V3: 129 +induced siphonage, 2004 V1: 26, 1999 V2: 36, 39–40 industrial acid-waste drainage systems +acid-waste treatment, 1999 V2: 334–337 continuous acid-waste treatment systems, 1999 V2: +338 +defined, 1999 V2: 332 +health and safety concerns, 1999 V2: 332 large facilities, 1999 V2: 336 +types of acids, 1999 V2: 332–334 +industrial chemical-waste systems, 1999 V2: 345–346 industrial facilities +asbestos concrete piping, 2003 V4: 26 firefighting demand flow rates, 2000 V3: 232 firefighting water drainage, 1999 V2: 346–347 industrial steam systems, 2000 V3: 175 numbers of fixtures for, 2003 V4: 19, 21 radiation in, 1999 V2: 340 +water content in wastes, 2000 V3: 99 +Industrial Risk Insurers (IRI), 1999 V2: 177, 2000 V3: 16 industrial waste, defined, 2004 V1: 26 +industrial wastewater treatment codes and standards, 2000 V3: 95 definitions, 2000 V3: 88 +designing systems, 2000 V3: 90–91 government publications, 2000 V3: 96 industry and technical handbooks, 2000 V3: 97 overview, 2000 V3:87 +permits, 2000 V3:87 references, 2000 V3: 95–97 +regulatory framework, 2000 V3:87–90 + +resources, 2000 V3: 97 +system elements, 2000 V3: 91–95 inert gases, 2000 V3: 22 +Inert Gases: Argon, Nitrogen and Helium (CGA P-9), 2000 V3: 81, 82, 86 +inert materials, 2000 V3: 47 inertia +conversion factors, 2004 V1: 36 measurements, 2004 V1: 33 +inerting atmospheres, 2000 V3: 20 infant bathtubs, 2000 V3: 32, 34 +infectious and biological waste systems. See also disinfecting; microorganisms +biosafety levels, 1999 V2: 343–344 codes and standards, 1999 V2: 343–344 components, 1999 V2: 345 introduction, 1999 V2: 343 +liquid-waste decontamination systems, 1999 V2: 344–345 +infectious disease rooms, 2000 V3: 45 infiltration rates +pipes, 1999 V2: 102 soils, 1999 V2: 96, 104 +inflexibility, creativity and, 2004 V1: 231 +Information phase in value engineering, 2004 V1: 213, 214–222 +information sources in value engineering, 221, 2004 V1: 214 +infrared controls on faucets and fixtures, 2004 V1: 135, 264 +infrequently-used fixtures, 1999 V2: 121 +Ingersoll-Rand Company, 1999 V2: 214, 2000 V3: 214 inhibitors (corrosion), 2004 V1: 151, 153 +initial pressure in natural gas systems, 1999 V2: 193, 194 initial vacuum pressure, 1999 V2: 272 +ink tests, 2003 V4: 5, 9 +inlet cubic feet per minute (icfm), 1999 V2: 256, 2000 V3: 65, 66 +inlets. See also outlets; stations gas boosters, 1999 V2: 179 gas or vacuum. See stations +inlet filters in pools, 2000 V3: 203, 211 +inlet filters on vacuum systems, 1999 V2: 260 inlet inverts on septic tanks, 1999 V2: 228 +inlet pressure in cold-water systems, 1999 V2: 153 inlet pressure in gas boosters, 1999 V2: 182 +inlet times, 2000 V3: 244, 245 louver velocity, 2000 V3: 212 +number of in vacuum systems, 1999 V2: 262 +for reflecting pools and fountains, 2000 V3: 110–111 for storage tanks, 1999 V2: 248 +for storm drainage, 1999 V2: 98 +for swimming pools, 2000 V3: 137, 143, 145 +for vacuum cleaning systems, 1999 V2: 268, 269–270, 272, 274 +in vacuum sizing calculations, 1999 V2: 263 Innovation & Design Process (LEED), 2004 V1: 263 innovation in green building, 2004 V1: 266 Innovative Wastewater Technologies, 2004 V1: 264 input motion of earthquakes, 2004 V1: 160 insanitary, defined, 2004 V1: 26, 1999 V2: 64 +inside-caulk outlets, 1999 V2: 17 +Index + + +inside diameters (ID), 2004 V1: 14, 2000 V3: 156 inside film coefficients, 2004 V1: 14 +inspecting. See also cleanouts checklists, 2004 V1: 102–103 +drains in sanitary drainage systems, 1999 V2: 9 hazardous waste systems, 2000 V3: 90 +septic tanks, 1999 V2: 229–230 sewage-disposal systems, 1999 V2: 238 +installation +anchor bolts, seismic problems, 2004 V1: 190 backflow preventers, 1999 V2: 148–149 condensate traps, 2000 V3: 195 +estimating productivity rates, 2004 V1: 97 grab bars, 2004 V1: 121–122 +installation costs, 2004 V1: 223 lavatories, 2003 V4: 11 +liquid fuel storage systems, 2000 V3:172–173 medical gas piping, 2000 V3: 73 +pressure-regulated valves, 1999 V2: 153–154 reduced-size venting, 1999 V2: 52 +section in specifications, 2004 V1: 91 showers, 2003 V4: 16 +sovent systems, 1999 V2: 62 steam traps, 2000 V3: 195 +storage tank checklist, 2000 V3: 173 urinals, 2003 V4: 9–10 +water closets, 2003 V4: 6–7 +water system pipes, 1999 V2: 250–252 Installation, 2003 V4: 32 +Installation of Centrifugal Fire Pumps (NFPA 20), 2000 V3: 25, 29 +Installation of Closed-head Foam-water Sprinkler Systems (NFPA 16A), 2000 V3: 21, 29 +Installation of Private Fire Mains (FM 3-10), 2000 V3: 225 Installation of Private Fire Service Mains and Their +Appurtenances (NFPA 24), 2000 V3: 29, 225 Installation of Sprinkler Systems (NFPA 13), 2000 V3: 2, +12, 15, 16, 21, 29, 232 +Installation of Standpipe and Hose Systems (NFPA 14), 2000 V3: 2, 18, 29 +Installation of Underground Gasoline Tanks and Piping at Service Stations (API 1615), 2000 V3: 173 +instantaneous water heaters, 1999 V2: 160 institutional facilities +estimating sewage quantities, 1999 V2: 234 numbers of fixtures for, 2003 V4: 20, 21 septic tank systems for, 1999 V2: 231–232 +instructions to bidders, 2004 V1: 62 instrument sterilizers, 2000 V3: 36, 38 +instruments, nitrogen-pressure-driven, 2000 V3: 68 insulation +airborne sound, 2004 V1: 193 dielectric insulation, 2004 V1: 146 energy savings and, 2004 V1: 265 +in geothermal energy systems, 2004 V1: 131 hot-water systems, 2004 V1: 127, 1999 V2: 166 noise insulation, 1999 V2: 15 +pure water systems, 1999 V2: 324 roof drainage, 1999 V2: 85 +short-circuiting installations, 2004 V1:151 thickness and energy conservation, 2004 V1: 127 +insurance + +321 + + +certificates, 2004 V1: 62 in labor costs, 2004 V1: 94 +insurance carriers, 2000 V3: 1, 2, 22, 216 intake silencers on compressors, 2000 V3: 202 intake sump acoustic problems, 2004 V1: 197 +integral check valves on gas turrets, 1999 V2: 177 intensity-duration-frequency curves, 2000 V3: 242, 243 intensity (luminous), 2004 V1: 33 +intensive-care rooms fixtures, 2000 V3: 35 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 51, 58 +interceptors, 2004 V1: 26. See also specific kinds of interceptors +interface controls for medical gas systems, 2000 V3: 73 intergranular corrosion, 1999 V2: 290 +interlocking, gas boosters and, 1999 V2: 182 intermediate chambers in dry-pipe systems, 2000 V3: 11 intermediate coats, 2004 V1: 147 +intermediate gas regulators, 2000 V3: 251 intermediate-level sprinklers, 2004 V1: 29 intermittent flow in roof drainage, 1999 V2: 88 intermittent heating in pools, 2000 V3: 145 intermittent sand filters, 1999 V2: 232 +International Association of Plumbing and Mechanical Officials (IAPMO), 2004 V1: 54, 58, 1999 V2: 34, 214, 2003 V4: 18 +International Building Code, 2004 V1: 183 International Code Council (ICC), 2004 V1: 55, 59 International Conference of Building Officials (ICBO), +2004 V1: 191 +International Organization for Standardization (ISO), 2004 V1: 194 +International Pipe Standard (IPS), 2004 V1: 15 International Plumbing Code, 1999 V2: 39, 2003 V4: 18 International Safety Equipment Association (ISEA), 2004 +V1: 59 +international swimming meets, 2000 V3: 128 International System of Units (SI) +conversion factors, 2004 V1: 39–40 +converting, 2004 V1: 39, 1999 V2: 256, 2000 V3: 29 equations, 2004 V1: 1 +listing, 2004 V1: 32–40 +natural gas piping sizing, 1999 V2: 197 non-SI units, 2004 V1: 34 +prefixes and symbols, 2004 V1: 34 +pressure and flow rate measurements, 2000 V3: 200 style and use, 2004 V1: 34, 1999 V2: 253 +interrelationships of functions, 2004 V1: 227, 230 interruptible gas services, 2000 V3: 249 interruption of water service, 1999 V2: 239 interstitial monitoring, 2000 V3: 160–161 interstitial spaces in tanks, 2000 V3: 156, 165 +inventory control in storage tanks, 2000 V3: 161–162 invertebrates, 1999 V2: 282 +inverted bucket traps, 2000 V3: 182, 186, 194 inverted-membrane roofs, 1999 V2: 82 inverts +defined, 2004 V1: 26 +on septic tanks, 1999 V2: 228 +322 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +An Investigation of the Adequacy of Performance of Reduced-size Vents Installed on a Ten-Story Drain, Waste and Vent System, 1999 V2: 65 +Investigation phase in value engineering, 2004 V1: 213, 235, 243, 254 +iodine, 2000 V3: 149 iodine 131, 1999 V2: 340 +ion-exchange and removal systems, 1999 V2: 300–308 continuous deionization, 1999 V2: 306 +design considerations, 1999 V2: 308 regenerable ion exchange, 1999 V2: 301 regeneration cycle, 1999 V2: 302–305 resins, 1999 V2: 301 +service deionization, 1999 V2: 305 +small drinking water systems, 1999 V2: 318 total dissolved solids and, 1999 V2: 288 water softening, 1999 V2: 307 +ionized salts (NaCI), 2000 V3: 46 ions +defined, 2004 V1: 153 +in electromotive force series, 2004 V1: 144 in pH values, 1999 V2: 329 +IP units, 1999 V2: 197, 253, 256, 2000 V3: 200 +IPS. See International Pipe Standard (IPS); iron pipe size (IPS) +IPS outlets, 1999 V2: 18 +IRI (Industrial Risk Insurers), 1999 V2: 177 iron +corrosion, 2004 V1: 139 +in electromotive force series, 2004 V1: 144 in galvanic series, 2004 V1: 141 +removing, 1999 V2: 292 sludge and, 1999 V2: 289 in soils, 1999 V2: 219 +in water, 1999 V2: 244, 245, 281, 283 iron bacteria, 1999 V2: 282 +iron coagulants, 1999 V2: 294 +iron oxide, 2004 V1: 139, 2000 V3: 147 iron oxide films, 2004 V1: 145 +iron pipe size (IPS), 2004 V1: 15, 2003 V4: 59, 61 iron piping +corrosion, 2004 V1: 139 +ductile iron water and sewer pipe, 2003 V4: 32–33 iron-removal filters, 2000 V3: 147 +irradiation treatment of water, 1999 V2: 245, 311–312, 318, 323, 324 +Irrigation Association +The ABC’s of Lawn Sprinkler Systems, 2000 V3: 105 address, 2000 V3: 105 +irrigation systems +design information, 2000 V3: 104–105 gray-water demand, 1999 V2: 26–27 +gray-water systems and, 1999 V2: 21, 22, 30 green roof designs, 2004 V1: 266 +methods, 2000 V3: 100–101 overview, 2000 V3: 99 +rainwater harvesting, 2004 V1: 135, 267 references, 2000 V3: 105 +resources, 2000 V3: 105 +sample information sheet, 2000 V3: 106 soil considerations, 2000 V3: 99–100 system components, 2000 V3: 101–104 + +water conservation and, 2004 V1: 264 water demand, 1999 V2: 243 +water quality and requirements, 2000 V3: 99 water supply, 2000 V3: 105 +ischoric processes, 2000 V3: 199 +ISEA (International Safety Equipment Association), 2004 V1: 59 +island venting, 2000 V3: 42 +ISO 3822/1 (Laboratory Tests on Noise Emission by Appliances and Equipment Used in Water Supply Installations), 2004 V1: 194 +ISO (International Organization for Standardization), 2004 V1: 194 +isoascorbic acid, 1999 V2: 315 isobaric processes, 2000 V3: 199 +isolating medical gas zones, 2000 V3: 71 +isolating premises with backflow hazards, 1999 V2: 145– 147 +isolating valves, 1999 V2: 149 isolation rooms, 2000 V3: 32, 45, 51 isolation valves, 2000 V3: 49, 115 isolation, vibration +dishwasher isolation mounts, 2004 V1: 195 flexibility and, 2004 V1: 199 +isolation hangers, 2004 V1: 203, 204 isolation springs, 2004 V1: 166 isolators within hangers, 2004 V1: 166 in piping systems, 2004 V1: 202–206 +problems in seismic protection, 2004 V1: 188–191, 189, 206 +types of vibration control devices, 2004 V1: 203–206 washing machine isolation mounts, 2004 V1: 195 +isolators, 2000 V3: 213 +isosceles triangles, calculating area, 2004 V1: 4 isothermal processes, 2000 V3: 199 +isotopes, 1999 V2: 337, 340 ITT Fluid Handling +Training Manual TES 181: Hoffman Steam Heating Systems Design Manual and Engineering Data, 2000 V3: 197 +Training Manual TES 582: High Temperature Condensate Return, 2000 V3: 197 +Izod impact, 2003 V4: 60 + +J +J (joules), 2004 V1: 33 +J/K (joules per kelvin), 2004 V1: 33 +J/kg K (joules per kg per kelvin), 2004 V1: 33 Jackson, T., 1999 V2: 65 +Jackson turbidity units (JTUs), 1999 V2: 287 janitors’ closets, 2000 V3: 32, 2003 V4: 13 Janoschek, R., 1999 V2: 325 +Jayawardena, N., 1999 V2: 325 +JCAHO (Joint Commission for the Accreditation of Hospitals Organization), 2000 V3: 33, 50 +jet pumps, 1999 V2: 241 jetted wells, 1999 V2: 241 +job preparation checklists, 2004 V1: 99 jockey pumps, 2004 V1: 24, 2000 V3: 26 +Joint Commission for the Accreditation of Hospitals Organization (JCAHO), 2000 V3: 33, 50 +joint compounds, 1999 V2: 223 +Index + + +joints +acid-waste systems, 1999 V2: 334 asbestos concrete piping, 2003 V4: 26 +bonded joints and cathodic protection, 2004 V1:150 bronze joints and fittings, 2003 V4: 37–38 +cast-iron soil pipes, 2003 V4: 27 +caulked joints on floor drains, 1999 V2: 16 chemical-waste systems, 1999 V2: 345–346 clay pipe joints, 1999 V2: 223 +copper drainage tubes, 2003 V4: 45, 46 copper joints, 1999 V2: 222, 2003 V4: 37–38 copper rings over joints, 1999 V2: 223 copper water tube, 2003 V4: 37 +CPVC piping, 2003 V4: 62 +cross-linked polyethylene, 2003 V4: 61 +cross-linked polyethylene/aluminum/cross-linked polyethylene (PEX-AL-PEX), 2003 V4: 61–62 +ductile iron water and sewer pipe, 2003 V4: 32–33 earthquake damage to, 2004 V1: 162 +earthquake protection and, 2004 V1: 167 expansion joints, 1999 V2: 18, 79, 85, 87, 251 fill and pipe joints, 1999 V2: 15 +for fountains, 2000 V3: 119 galvanized iron joints, 1999 V2: 222 glass pipe, 2003 V4: 47–48 +heat-fused socket joints, 1999 V2: 334 inspection, 2000 V3: 80 +joint compounds, 1999 V2: 223 +labor productivity rates, 2004 V1: 96 lead pipe, 2003 V4: 49 +liquefied petroleum gas and, 1999 V2: 196 materials, 2004 V1: 43 +mechanical clay pipe joints, 1999 V2: 223 medical gas tubing, 2000 V3: 77, 2003 V4: 45 mortar joints on septic tanks, 1999 V2: 228 natural gas systems, 2000 V3: 254 +o-ring gaskets, 2004 V1: 266 plastic joints, 1999 V2: 222 plastic pipes, 2003 V4: 59–60 pure-water systems, 2000 V3: 47 PVC piping, 2003 V4: 62 +radioactive waste systems, 1999 V2: 341 red brass pipe, 2003 V4: 27 +reinforced concrete pipe, 2003 V4: 32 restrainers, 2000 V3: 228–229 sanitary, 2000 V3: 48 +screwed mechanical joints, 1999 V2: 334 seamless copper pipe, 2003 V4: 34 +special-waste drainage systems, 1999 V2: 328 steel pipe, 2003 V4: 48 +tubing, 1999 V2: 196 +welded joints in radioactive waste systems, 1999 V2: 341 +Joukowsky’s formula, 1999 V2: 132 joules, 2004 V1: 33 +joules per kelvin, 2004 V1: 33 +joules per kg per kelvin, 2004 V1: 33 journeyman plumbers, 2004 V1: 26 +JTUs (Jackson turbidity units), 1999 V2: 287 judgementalism, 2004 V1: 232–235 +Judgment phase in value engineering, 2004 V1: 213 juveniles. See children, fixtures and + +323 + +K +k, K (conductivity), 2004 V1: 14, 16, 33 +K (dynamic response to ground shaking), 2004 V1: 159, 161 +K (kelvin), 2004 V1: 15, 34 k (kilo) prefix, 2004 V1: 34 +K factor (coefficient of permeability), 1999 V2: 100–101, 104–105, 242 +K factor (sprinkler heads), 2000 V3: 17 K piping. See Type K copper +Kalinske, A.A., 1999 V2: 19 Kaminsky, G., 1999 V2: 350 +KE (kinetic energy), 2004 V1: 2, 5 kelvin (K), 2004 V1: 15, 33 kerosene, 1999 V2: 13, 2000 V3: 154 +keyboards, inflexible thinking and, 2004 V1: 231 kg (kilograms). See kilograms +kg/m (kilograms per meter), 2004 V1: 33 +kg/m2 (kilograms per meter squared), 2004 V1: 33 kg/m3 (kilograms per meter cubed), 2004 V1: 33 kg/ms (kilogram-meters per second), 2004 V1: 33 kg/s (kilograms per second), 2004 V1: 33 +kill tanks, 1999 V2: 344–345 “kilo” prefix, 2004 V1: 34 +kilocalories, converting to SI units, 2004 V1: 39 kilograms (kg) +defined, 2004 V1: 33 +kilograms per cubic meter, 2004 V1: 33 kilograms per meter, 2004 V1: 33 kilograms per meter squared, 2004 V1: 33 kilograms per second, 2004 V1: 33 +kilometers (km) +converting to SI units, 2004 V1: 39 kilometers per hour, 2004 V1: 34 +kilopascals (kPa) +converting meters of head loss to, 2004 V1: 2 converting to psi, 2000 V3: 29 +in SI units, 2000 V3: 200 +vacuum pump ratings, 1999 V2: 257 vacuum work forces, 1999 V2: 254 +kiloponds, converting to SI units, 2004 V1: 39 kilowatt hours (kWh, KWH), 2004 V1: 15, 34 kilowatts (kW, KW), 2004 V1: 15 +kinematic viscosity +converting to SI units, 2004 V1: 39 measurements, 2004 V1: 33 +water temperature variations, 1999 V2: 121 Kinematic Viscosity Centistokes, 2000 V3: 154 kinetic energy (KE) +calculating, 2004 V1: 2 velocity head and, 2004 V1: 5 +kip ft, KIP FT (thousand foot-pounds), 2004 V1: 16 kip, KIP (thousand pounds), 2004 V1: 16 +KIPFT (thousand foot-pounds), 2004 V1: 16 kitchen sinks +faucets, 2003 V4: 13 types, 2003 V4: 11–12 +kitchens. See food-processing areas and kitchens km/h (kilometers per hour), 2004 V1: 34 +knee space for wheelchairs, 2004 V1: 109 +knockout panels for swimming pool filters, 2000 V3: 140 knockout pots in vacuum systems, 1999 V2: 260 +324 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +Konen, Thomas K., 1999 V2: 34, 65 Kowalsky, L., 2000 V3: 125 +kPa (kilopascals). See kilopascals Kullen, Howard P., 2004 V1: 154 kW, KW (kilowatts), 2004 V1: 15 +kWh, KWH (kilowatt hours), 2004 V1: 15, 34 KYNAR piping, 2000 V3: 48 + +L +L (length). See length L (liters). See liters +L/min (liters per minute), 2000 V3: 66, 69, 200 L piping. See Type L copper +L/s (liters per second), 2000 V3: 7, 200 L-shaped bath seats, 2004 V1: 122 +LA (laboratory compressed air), 2004 V1: 8 labels +labeled, defined, 2004 V1: 26 labeled fire pumps, 2000 V3: 25 medical gas tubing, 2000 V3: 77, 81 medical gas valves, 2000 V3: 71 +parts of gray-water systems, 1999 V2: 22, 33 labor and materials payment bonds, 2004 V1: 62 labor costs +defined, 2004 V1: 222 factors in, 2004 V1: 94 +ongoing and one-time, 2004 V1: 223 overtime, 2004 V1: 94 +in plumbing cost estimation, 2004 V1: 93 productivity rates, 2004 V1: 95–97 +in take-off estimating method, 2004 V1: 94 in value engineering, 2004 V1: 212 +labor rooms +fixtures, 2000 V3: 36 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 52, 58 +laboratories +acid-waste drainage systems, 1999 V2: 332, 2000 V3: 39–42 +acid-waste treatment, 1999 V2: 334–337, 2000 V3: 40–41 +continuous acid-waste treatment systems, 1999 V2: 338 +discharge to sewers, 2000 V3: 40 +health and safety concerns, 1999 V2: 332 large facilities, 1999 V2: 336 +metering, 2000 V3: 41–42 +piping and joint material, 1999 V2: 334 sink traps, 2000 V3: 42 +solids interceptors, 2000 V3: 41, 43 +system design considerations, 1999 V2: 334 types of acids, 1999 V2: 332–334 +waste and vent piping, 2000 V3: 42 classroom water demand, 2000 V3: 45 compressed air use factors, 2000 V3: 209 defined, 2000 V3: 84 +fixtures and pipe sizing, 1999 V2: 328 gas service outlets, 2000 V3: 37–39 gas systems, 1999 V2: 176–177 +in health-care facilities, 2000 V3: 32, 37–39 infectious waste systems, 1999 V2: 343 isolating, 1999 V2: 147 + +lab animals, 1999 V2: 344 medical gas stations, 2000 V3: 51 natural gas piping, 1999 V2: 177 plastic pipes, 2003 V4: 58 +pure water systems for, 1999 V2: 317–325, 2000 V3: 46 radioactive isotopes in, 1999 V2: 337 +vacuum systems +codes and standards, 1999 V2: 262 +diversity factor calculations for vacuums, 1999 V2: 263 +leakage, 1999 V2: 265, 267 piping, 1999 V2: 262 +pump assemblies, 1999 V2: 261 sizing, 1999 V2: 262–266 +vacuum-pump systems, 2000 V3: 70 water systems filtration, 1999 V2: 300 +laboratory compressed air (LA), 2004 V1: 8 Laboratory Studies of the Hydraulic Performance of +One-story and Split-level Residential Plumbing Systems with Reduced-size Vents, 1999 V2: 65 +Laboratory Testing on the Noise Emitted by Valves, Fittings, and Appliances Used in Water Supply Installations, 2004 V1: 194 +Laboratory Tests on Noise Emission by Appliances and Equipment Used in Water Supply Installations, 2004 V1: 194 +laboratory vacuum (LV), 2004 V1: 9 ladders +aboveground storage tanks, 2000 V3: 165 swimming pools, 2000 V3: 145–146 +lagging (pipe wrappings), 2004 V1: 196, 201–202, 1999 V2: 68, 196 +lagoons, 1999 V2: 232 +laid mat filters, 2000 V3: 131 lakes, 1999 V2: 26, 27 +LAL test, 1999 V2: 282 +laminar flow devices, 2000 V3: 33 laminar flow in pipes, 2004 V1: 2 landscaping +irrigation. See irrigation systems water efficient, 2004 V1: 263–264 +landslides, 2004 V1: 158 +lanes in swimming pools, 2000 V3: 128 +Langelier saturation index (LSI), 1999 V2: 291–292, 2000 V3: 123 +Langelier, W.F., 1999 V2: 291 Laque, F.L., 2004 V1: 154 large buildings +acid-waste systems, 1999 V2: 336 enlargement of water systems, 1999 V2: 249 fixture drainage loads, 1999 V2: 3 +large private sewage-disposal systems, 1999 V2: 231–232 +sovent single-stack plumbing systems, 1999 V2: 19 large-drop sprinklers, 2004 V1: 29, 2000 V3: 2 +large-scale biohazard facilities, 1999 V2: 343 +Large Welded Petroleum Tanks (API 12D), 2000 V3: 95 lat, LAT (leaving air temperature), 2004 V1: 15 +latent heat (LH, LHEAT), 2004 V1: 15, 137, 2000 V3: 175, 189 +latent heat gain, 2004 V1: 15 +Index + + +lateral and longitudinal sway bracing, 2004 V1: 181–182, 184–186 +lateral force +calculating for seismic protection, 2004 V1: 183 defined, 2004 V1: 191 +problems in seismic protection, 2004 V1: 189 lateral lines, 2000 V3: 85 +lateral sewers, 2004 V1: 26 +lateral stability of suspended equipment, 2004 V1: 164 laterals in leaching fields, 1999 V2: 221 +laundry sinks or trays, 2003 V4: 13 laundry systems and washers +accessibility, 2004 V1: 123 +acoustic ratings of machines, 2004 V1: 195 clothes washer fixture-unit loads, 1999 V2: 3 commercial laundries, 1999 V2: 121, 147 +gray water use, 2004 V1: 135, 267, 1999 V2: 22, 25 health-care facilities, 2000 V3: 32, 36 +heat recovery systems, 2004 V1: 266 +laundry sinks and clothes washers, 2003 V4: 13 laundry tray fixture-unit loads, 1999 V2: 3 natural gas and, 1999 V2: 174 +rates of sewage flows, 1999 V2: 237 sound damping materials, 2004 V1: 196 suds problems, 1999 V2: 37, 39 +waste heat usage, 2004 V1: 131–134 water fixture unit values, 2000 V3: 217 water temperatures, 2000 V3: 45 +lavatories. See also sinks and wash basins accessibility, 2004 V1: 117 +faucets and overflows, 2003 V4: 10–11, 13 fixture-unit loads, 1999 V2: 3 +flow rates, 2003 V4: 10 +gray-water systems, 2004 V1: 135, 1999 V2: 22 health-care facilities, 2000 V3: 32, 33, 38 installation requirements, 2003 V4: 11 minimum numbers of, 2003 V4: 18–22 +patient rooms, 2000 V3: 34 recovery rooms, 2000 V3: 36 +reduced water usage, 2004 V1: 126–127 shapes and sizes, 2003 V4: 10–11 sovent systems, 1999 V2: 62 +standards, 2003 V4: 2 temperatures, 2000 V3: 45 +typical gray-water supply, 1999 V2: 25 typical use, 1999 V2: 25 +vents, 1999 V2: 37 +Law of Inverse Proportions, 2004 V1: 224 lawn imperviousness factors, 2000 V3: 243 +lawn sprinkler supply (LS), 2004 V1: 8, 1999 V2: 121 layer-type dezincification, 2004 V1: 142 +layers of effluent in septic tanks, 1999 V2: 227 layers of fill, 1999 V2: 15 +lb, LBS (pounds). See pounds leaching trenches (leach fields) +choosing absorption systems, 1999 V2: 220 construction of, 1999 V2: 222–223 +drain fields defined, 2004 V1: 23 flat areas, 1999 V2: 223–224 introduction, 1999 V2: 221–224 +serial distribution, 1999 V2: 223–224 sloping area trenches, 1999 V2: 224 + +325 + + +leaching wells, 2004 V1: 26. See also dry wells lead +corrosion, 2004 V1: 139 +in electromotive force series, 2004 V1: 144 in galvanic series, 2004 V1: 141 +joint seals, 2003 V4: 27, 28 +lead-caulked, cast-iron piping, 1999 V2: 223 lead-lined concrete blocks, 1999 V2: 340 lead-lined lath for plaster, 1999 V2: 340 +lead piping, 2004 V1: 266, 1999 V2: 14, 68, 122, 2003 V4: 48–49 +lead shielding on radioactive drainage systems, 1999 V2: 339–340 +lead-tin solders, 2004 V1: 141 +leaders. See downspouts and leaders; vertical stacks Leadership in Energy and Environmental Design (LEED), +2004 V1: 263–265 leakage +clean agent gas fire suppression, 2000 V3: 23 compressed air systems, 2000 V3: 209, 211 eliminating, 2004 V1: 134 +leaking oil into water, 1999 V2: 347–349 +waste anesthetic gas management, 2000 V3: 71 water conservation and, 2004 V1: 124 +leakage detection +aboveground tank systems, 2000 V3:167–168 annuciators, 2000 V3: 167 +chemical wastes, 1999 V2: 345, 346 connectors, 2000 V3: 166 industrial waste, 2000 V3: 90 +infectious waste drainage systems, 1999 V2: 344 ion exchange systems, 1999 V2: 308 +special-waste drainage systems, 1999 V2: 327 underground liquid fuel storage tanks, 2000 V3: +158–163 leakage tests +cold-water systems, 1999 V2: 154 +liquefied petroleum gas systems, 1999 V2: 197 private water systems, 1999 V2: 252 +storage tanks, 2000 V3: 172 vacuum systems, 1999 V2: 265, 267 +least mean temperature difference (LMTD), 2004 V1: 15 least temperature difference (LTD), 2004 V1: 15 +leaving air temperature (lat, LAT), 2004 V1: 15 leaving water temperature (lwt, LWT), 2004 V1: 15 lecture halls, numbers of fixtures for, 2003 V4: 19 +LEED (Leadership in Energy and Environmental Design), 2004 V1: 263–265 +leg baths, 2000 V3: 32, 35, 38 leg clearances +drinking fountains and water coolers, 2004 V1: 112 toilet and bathing rooms, 2004 V1: 113 +Legionella pneumophila, 1999 V2: 144, 169 +legislation regarding people with disabilities, 2004 V1: 106–107 +legs in piping systems, 2000 V3: 47 legs on tanks +cast-iron tank legs, 2004 V1: 163 +problems in seismic protection, 2004 V1: 188, 189 Lehr, Valentine A., 1999 V2: 34 +length (lg, LG, L) +conversion factors, 2004 V1: 36 +326 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +in measurements, 2004 V1: 33 of stacks, 2004 V1: 3 +symbols for, 2004 V1: 15 of vent piping, 2004 V1: 3 +Level I vacuum systems, 2000 V3: 85 Level III alarm systems, 2000 V3: 83 Level III vacuum systems, 2000 V3: 86 level sensors +boiler feed pumps, 2000 V3: 188 hazardous materials, 2000 V3: 90 tank gauges, 2000 V3: 158 +levels in water tanks, 1999 V2: 249 levels of radiation, 1999 V2: 339 Lewis, G.N., 2004 V1: 153 +LF (linear feet), 2004 V1: 15 lg, LG (length). See length +LH (latent heat), 2004 V1: 15, 137 LHEAT (latent heat), 2004 V1: 15, 137 LHG (latent heat gain), 2004 V1: 15 +libraries, numbers of fixtures for, 2003 V4: 19 life-cycle costs, 2004 V1: 137 +life safety +in fire protection, 2000 V3: 1 +residential sprinkler systems, 2000 V3: 2 lifts of fill, 1999 V2: 15 +light conversion factors, 2004 V1: 36 light hazard occupancies +defined, 2004 V1: 29 +firefighting hose streams, 2000 V3: 230 portable fire extinguishers, 2000 V3: 27, 28 +light heating oil, 2000 V3: 154 +light process gas service, 2000 V3: 249 light wall pipe (Schedule 10), 2003 V4: 48 +lighting systems in pools and fountains, 2000 V3: 112, 121, 125, 145 +lightwall pipes, 2000 V3: 17 +lime (calcium carbonate), 2000 V3: 147 +lime-soda method of water softening, 1999 V2: 244, 307 limestone chips, 1999 V2: 334 +limited-care facilities, 2000 V3: 84 +limited-discharge roof drains, 2000 V3: 247 +limiting conditions in seismic protection, 2004 V1: 189, 190 +limulus amoebocyte lysate test, 1999 V2: 282 lin ft (linear feet), 2004 V1: 15 +Lin, S.H., 1999 V2: 325 +line-pressure sensors, 2000 V3: 72 line regulators, 2000 V3: 251 linear acceleration +conversion factors, 2004 V1: 35 measurements, 2004 V1: 33 +linear expansion in PVC pipe, 2003 V4: 62 linear feet (lin ft, LF), 2004 V1: 15 +linear velocity measurements, 2004 V1: 33 lined piping, 2003 V4: 26 +lined steel +storage tanks and hazardous wastes, 2000 V3: 91 sulfuric acid and, 2000 V3: 93 +linen holding areas, 2000 V3: 32 lining materials +for dug wells, 1999 V2: 240 for seepage pits, 1999 V2: 225 + +Linstedt, K.C., 1999 V2: 238 +lint interceptors, 2000 V3: 36, 150 liq, LIQ (liquid). See liquids liquefaction, 2004 V1: 158 +liquefied petroleum gas. See also fuel-gas piping systems codes and standards, 2004 V1: 43 +defined, 1999 V2: 214 +flexible gas hoses, 1999 V2: 196 gas boosters, 1999 V2: 178–183 glossary, 1999 V2: 213–214 introduction, 1999 V2: 194 pipes, 2003 V4: 35, 36 +storage, 1999 V2: 194 +system materials, 1999 V2: 196 warnings, 1999 V2: 197 +liquid chlorine, 2000 V3: 123 +liquid contamination in compressed air, 2000 V3: 201 liquid fuel systems. See diesel-oil systems; gasoline systems liquid monitoring, 2000 V3: 160 +liquid oxygen (LOX) defined, 2000 V3: 85 +fire hazards, 2000 V3: 61 medical gas systems, 2000 V3: 60 symbol, 2004 V1: 8 +liquid petroleum, 2000 V3: 154 +liquid piston compressors, 2000 V3: 201 liquid ring compressors, 2000 V3: 67, 201 liquid ring pumps, 1999 V2: 259, 260, 262 liquid waste +decontamination systems, 1999 V2: 344–345 defined, 2004 V1: 26 +liquid waterproofing, 2000 V3: 144 liquids (liq, LIQ) +levels in septic tanks, 1999 V2: 228–229 symbols for, 2004 V1: 15 +vacuuming, 1999 V2: 266 listed, defined, 2004 V1: 26 listing agencies, 2004 V1: 26 liters +converting to gallons units, 2000 V3: 29 converting to SI units, 2004 V1: 39 +liters per minute (L/min, Lpm), 1999 V2: 253, 2000 V3: 66, 69, 200 +liters per second (L/s), 1999 V2: 124, 126, 2000 V3: 7, 200 +non-SI units, 2004 V1: 34 live loads +on roof, 1999 V2: 79 +in pipe selection, 2003 V4: 26 living roof designs, 2004 V1: 266–267 lm (lumens), 2004 V1: 33 +LMTD (least mean temperature difference), 2004 V1: 15 ln, LN (logarithms, natural), 2004 V1: 15 +LO (lubricating oil), 2004 V1: 8, 1999 V2: 13 loading tables +fixture-unit values in drainage systems, 1999 V2: 3 sovent systems, 1999 V2: 63 +subsurface piping loads, 1999 V2: 102 vertical stacks, 1999 V2: 4 +loads +computer analysis of loads, 2004 V1: 186 connected loads, defined, 1999 V2: 214 +Index + + +design considerations in seismic protection, 2004 V1: 186–188 +earth load on water pipes, 1999 V2: 250 horizontal loads of piping, 2004 V1: 184 live loads on roof, 1999 V2: 79 +load factors, defined, 2004 V1: 26 settlement loads, 2004 V1: 186 sway bracing, 2004 V1: 185–186 vertical seismic load, 2004 V1: 184 +vibration control materials, 2004 V1: 203 loams, 2000 V3: 100 +local alarms, 2000 V3: 83. See also area alarms +local application systems (carbon dioxide), 2000 V3: 20 local application systems (halon), 2004 V1: 26 +local authorities, 1999 V2: 68, 327 +local barometric pressure in vacuums, 1999 V2: 254 local rainfall rate tables, 1999 V2: 69–78 +localized corrosion, 1999 V2: 289–290 +location of piping, earthquake protection and, 2004 V1: 167 +lock-out regulators, 2000 V3: 252 locker rooms, 2000 V3: 32 Loevenguth, 2004 V1: 191 +log, LOG (logarithm to base 10), 2004 V1: 15 logarithms +logarithm to base 10 (log, LOG), 2004 V1: 15 natural (ln, LN), 2004 V1: 15 +long runs in vacuum cleaning systems, 1999 V2: 274–275 long-term thermal stability for hot-water systems, 1999 +V2: 166 +long-turn tee-wyes, 1999 V2: 4 longitudinal bracing +defined, 2004 V1: 191 +longitudinal and transverse bracing, 2004 V1: 180 longitudinal brace points, 2004 V1: 168 longitudinal-only bracing, 2004 V1: 180 +seismic protection, 2004 V1: 172 sway bracing, 2004 V1: 184–186 +longitudinal forces, 2004 V1: 191 +Looking to Treat Wastewater? Try Ozone, 1999 V2: 325 loop systems +fire hydrants, 1999 V2: 249 fire mains, 2000 V3: 8 +loop vents, 2004 V1: 31, 1999 V2: 43–44, 64, 2000 V3: 42 louvers in air compression, 2000 V3: 212 +LOV (lubricating oil vents), 2004 V1: 8 low backflow hazard, 2000 V3: 222 +low-expansion borosilicate glass, 2003 V4: 47 Low-expansion Foam (NFPA 11), 2000 V3: 21, 29 low-expansion foams, 2000 V3: 21 +low-fire input in gas boosters, 1999 V2: 182 low-flow fixtures +green building and, 2004 V1: 264 low-flow control valves, 2000 V3: 103 +low-flush toilets and water closets acoustic design, 2004 V1: 195 conserving water in, 1999 V2: 232 +low-flow water closets, 1999 V2: 19, 232 +ultra-low-flow water closets, 2004 V1: 134–136, 264, 1999 V2: 19 +low-level water tank alarms, 1999 V2: 151 +low-pressure carbon dioxide systems, 2000 V3: 20–21 + +327 + + +low-pressure condensate (LPC), 2004 V1: 9 low-pressure fire pumps, 2000 V3: 25 +low-pressure gas (G), 2004 V1: 8 +low-pressure natural gas systems, 1999 V2: 173–194, 192, 194 +low-pressure steam (lps, LPS), 2004 V1: 9, 15, 2000 V3: 175, 182, 187 +low-pressure tanks, 2000 V3: 153 +low-temperature hot water (lthw, LTHW), 2004 V1: 15 low-velocity pressure sand filters, 2000 V3: 139 +low-voltage lighting, 2000 V3: 121 low-water cutoffs, 2000 V3: 124 +low-water pressure, 1999 V2: 149–152 lower order functions, 2004 V1: 230 Lowther plate units, 1999 V2: 313 LOX (liquid oxygen), 2004 V1: 8 +LP-gases at Utility Gas Plants, 1999 V2: 214 LPC (low-pressure condensate), 2004 V1: 9 lpg. See liquefied petroleum gas +Lpm (liters per minute). See liters +lps, LPS (low-pressure steam), 2004 V1: 9, 15 LS (lawn sprinkler supply), 2004 V1: 8 +LSI (Langelier saturation index), 1999 V2: 291–292 LTD (least temperature difference), 2004 V1: 15 +lthw, LTHW (low-temperature hot water), 2004 V1: 15 lubricating oil (LO), 2004 V1: 8, 1999 V2: 13 lubricating oil vents (LOV), 2004 V1: 8 +lubricators +in compressed air pipe sizing, 2000 V3: 210 compressed air systems, 2000 V3: 207 +lumens, 2004 V1: 33 +luminance measurements, 2004 V1: 33 luminous flux, 2004 V1: 33 +luminous measurements, 2004 V1: 33 lump copper sulfate, 1999 V2: 223 lux, 2004 V1: 33 +LV (laboratory vacuum), 2004 V1: 9 +LWDS (liquid-waste decontamination systems), 1999 V2: 344–345 +LWT (leaving water temperature), 2004 V1: 15 lx (lux), 2004 V1: 33 +lye (sodium hydroxide), 2000 V3: 150 + +M +M alkalinity, 1999 V2: 282 +M (mega) prefix, 2004 V1: 34 +m (meters). See meters (measurements) m (milli) prefix, 2004 V1: 34 +M piping. See Type M copper +m/s (meters per second), 2004 V1: 33 +m/s2 (meters per second squared), 2004 V1: 33 m2 (meters squared), 2004 V1: 33 +m2/s (meters squared per second), 2004 V1: 33 m3 (cubic meters), 2004 V1: 33 +m3/kg (cubic meters per kilogram), 2004 V1: 33 m3/min (cubic meters per minute), 2000 V3: 200 m3/s (cubic meters per second), 2004 V1: 33 MA. See medical compressed air +Mach numbers (Mach, MACH), 2004 V1: 15 MacHatton, J.G., 1999 V2: 238 +machine trenching, labor productivity rates, 2004 V1: 95–97 +328 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +magnesium +corrosion, 2004 V1: 139 +dry-power extinguishing systems, 2000 V3: 20 in electromotive force series, 2004 V1: 144 +in galvanic series, 2004 V1: 141 lifespan of anodes, 2004 V1: 150 sacrificial anodes, 2004 V1: 147 in water, 1999 V2: 281, 283 zeolite process and, 1999 V2: 244 +magnesium alloys, 2004 V1: 141 magnesium anodes, 2000 V3: 131 magnesium bicarbonate, 1999 V2: 283 +magnesium carbonate, 1999 V2: 281, 283, 290 magnesium chloride, 1999 V2: 283 magnesium hydroxide, 1999 V2: 281 magnesium sulfate, 1999 V2: 281 +magnetic field pulsation, 2004 V1: 196 +magnetic field strength measurements, 2004 V1: 33 magnetic flux density, 2004 V1: 33 +magnetic flux measurements, 2004 V1: 33 magnetism, conversion factors, 2004 V1: 35 magnetostrictive tank gauging, 2000 V3: 160 main drains +head loss and, 2000 V3: 115 +reflecting pools and fountains, 2000 V3: 110 swimming pools, 2000 V3: 137, 143, 145 +main relief valves, 2000 V3: 25 main shut-off valves, 2000 V3: 71 +main vents, 2004 V1: 26, 2000 V3: 184 mains. See also water mains +defined, 2004 V1: 26, 2000 V3: 85 fire mains, 2000 V3: 8 +force mains, 2000 V3: 234, 236–240, 241 natural gas mains, 2000 V3: 253 +pipe, 2004 V1: 12 +steam, 2000 V3: 182, 187 maintenance +air compressors, 2000 V3: 213 costs, 2004 V1: 223 +fountains and pools, 2000 V3: 107 section in specifications, 2004 V1: 70, 90 swimming pool filters, 2000 V3: 139 +maintenance hot-water temperatures, 1999 V2: 166 major or prime costs, 2004 V1: 222 +makeup +defined, 2004 V1: 137 reducing use of, 2004 V1: 264 +makeup water systems +condensation usage, 2004 V1: 267 piping for, 2000 V3: 116 +pools and fountains, 2000 V3: 112, 119, 124–125 swimming pools, 2000 V3: 144 +malleable (mall) defined, 2004 V1: 26 +iron fittings, 1999 V2: 196 malls, 1999 V2: 25, 2003 V4: 20 +Management of Small Waste Flows, 1999 V2: 34 Manas, Vincent T., 1999 V2: 65, 114, 155 manganese, 1999 V2: 245, 292 +manholes +acid-waste systems, 1999 V2: 334, 335 chemical-waste systems, 1999 V2: 346 + +cleanouts, 2000 V3: 240, 241 +drop manholes, 2000 V3: 234, 238 precast manholes, 2000 V3: 234, 237 sampling manholes, 2000 V3: 41–42, 44 +sanitary sewer systems, 2000 V3: 234–236, 237 septic tanks, 1999 V2: 228, 229 +shallow manholes, 2000 V3: 234, 238 spacing, 2000 V3: 236, 240 +steps and covers, 2000 V3: 111, 236 storm-drainage systems, 1999 V2: 98, 99 venting, 2000 V3: 236, 239 +waterproof, 2000 V3: 236, 239 manifolds +compressed air, 2000 V3: 65 nitrogen systems, 2000 V3: 68 +nitrous oxide systems, 2000 V3: 64, 65 oxygen, 2000 V3: 59, 62–63, 64 +Manning formula +alternative sewage-disposal systems, 1999 V2: 226 ditches, 2000 V3: 247–248 +open-channel flow, 2004 V1: 1, 1999 V2: 7, 8 runoff and, 1999 V2: 97 +site drainage and, 1999 V2: 98 +sloping drains, 1999 V2: 8, 2000 V3: 233 +storm-drainage pipes, 1999 V2: 88, 2000 V3: 244–245, 246 +subsurface drainage rates, 1999 V2: 105 manual-control irrigation valves, 2000 V3: 103 manual fill lines, 2000 V3: 124 +manual fill valves, 2000 V3: 124 manual flushometer valves, 2003 V4: 8 Manual of Practice +introduction, 2004 V1: 61 +section shell outline, 2004 V1: 88–92 Uniformat, 2004 V1: 64 +Manual of Septic Tank Practice, 1999 V2: 237, 238 Manual on the Design and Construction of Sanitary and +Storm Sewers, 1999 V2: 95, 114 manual overfill prevention, 2000 V3: 167 manual overrides, 2000 V3: 104 +manual pull stations, 2000 V3: 19 manual release stations, 2000 V3: 24 manual tank gauging, 2000 V3: 159 manual trap primers, 1999 V2: 10, 14 manufacturers +in specifications, 2004 V1: 70, 90 +Manufacturers Standardization Society of the Valve and Fittings Industry, Inc. (MSS), 2004 V1: 26, 55, 59, 2003 V4: 45 +Manufacturing, 2003 V4: 32 manufacturing facilities, 2000 V3:87 +manways in tanks, 2000 V3: 156, 157, 163, 169 maps +frost lines, 2000 V3: 226 +seismic risk maps, 2004 V1: 155–157 soils, 1999 V2: 218 +marble acrylic fixtures, 2003 V4: 2 marble fixtures, 2003 V4: 2 marinas, 1999 V2: 147 +mark-ups, in plumbing cost estimation, 2004 V1: 93–94, 94 markets +in creativity checklist, 2004 V1: 234 +Index + + +sanitation in, 1999 V2: 16 markings, corrosion and, 2004 V1: 146 Marks, Lionel S., 2004 V1: 1, 2, 3, 5, 40 mass +conversion factors, 2004 V1: 36 mass law in acoustics, 2004 V1: 193 +mass per unit area measurements, 2004 V1: 33 mass per unit length measurements, 2004 V1: 33 in measurements, 2004 V1: 33 +non-SI units, 2004 V1: 34 mass flow, 1999 V2: 255 mass flow rates (mfr, MFR) +measurements, 2004 V1: 33 symbols for, 2004 V1: 15 +massive soil structure, 1999 V2: 218 master alarms +defined, 2000 V3: 83 +medical gas systems, 2000 V3: 49, 72, 81 master plumbers, 2004 V1: 26 MasterFormat +defined, 2004 V1: 64 +specifications sections, 2004 V1: 68–71 MasterFormat 2004, 2004 V1: 64–65, 77–88 +MasterFormat expansion task team (MFETT), 2004 V1: 64 MasterFormat Level Four (1995), 2004 V1: 76 MasterFormat Level One (1995), 2004 V1: 73 MasterFormat Level Three (1995), 2004 V1: 76 MasterFormat Level Two (1995), 2004 V1: 73–75 Masterspec, 2004 V1: 71 +material costs +defined, 2004 V1: 222 +in plumbing cost estimation, 2004 V1: 93 in take-off estimating method, 2004 V1: 94 in value engineering, 2004 V1: 212 +material safety data sheets, 2000 V3: 90 materials. See specific materials or system fixtures +detail/product/material specification checklist, 2004 V1: 220 +fixtures, 2003 V4: 1–2 +ongoing and one-time costs, 2004 V1: 223 in plumbing cost estimation, 2004 V1: 93 +value engineering questions, 2004 V1: 213–214 Materials & Resources design (LEED), 2004 V1: 263 materials section in specifications, 2004 V1: 70, 90–91 maximum (max., MAX), 2004 V1: 15 +maximum capacity rating (MCR), 1999 V2: 182 maximum design flow, 1999 V2: 182 +maximum discharge rates, 2004 V1: 5 +maximum outlet pressure in gas boosters, 1999 V2: 183 maximum resistance values, 1999 V2: 286 +mbars (millibars), 1999 V2: 254 mc (millicuries), 1999 V2: 339 McClelland, Nina I., 1999 V2: 238 +Mcf, MCF (thousand cubic feet), 2004 V1: 16 Mcm, MCM (thousand circular mils), 2004 V1: 16 MCR (maximum capacity rating), 1999 V2: 182 McSweeney, D.P., 1999 V2: 277 +MDPE (medium density) 2406 pipe, 2003 V4: 58 mean effective temperatures (MET), 2004 V1: 15 mean temperature difference (MTD), 2004 V1: 15 +measurable nouns in function analysis, 2004 V1: 224, 225 measurement units + +329 + + +compressed air, 2000 V3: 200 converting, 2000 V3: 29 +earthquake measurement, 2004 V1: 160–161 flow rates, 1999 V2: 255–256 +International System of Units, 2004 V1: 32–40 microorganisms, 1999 V2: 282 +non-SI units, 2004 V1: 34 pressure, 2000 V3: 200 pure water, 2000 V3: 46 +radiation, 1999 V2: 338–339 types of conversions, 2004 V1: 32 units and symbols, 2004 V1: 33 usage of, 1999 V2: 253 +vacuum pressure, 1999 V2: 254–256 water impurities, 1999 V2: 285 +measuring tank leakage, 2000 V3: 159–162 +Measuring Water Purity by Specific Resistance, 1999 V2: 325 +mechanical aerators, 1999 V2: 293, 294 mechanical areas +grates and strainers, 1999 V2: 10 sediment buckets, 1999 V2: 12 trap primers in drains, 1999 V2: 13 +mechanical clay pipe joints, 1999 V2: 223 mechanical code agencies, 2004 V1: 42 +mechanical cross-connection protection devices, 1999 V2: 144 +mechanical emulsions, 2000 V3: 93 +Mechanical Engineering Reference Manual, 1999 V2: 214 mechanical filtration, 2000 V3: 112, 123 +mechanical foam extinguishers, 2000 V3: 21 +mechanical joints, 2004 V1: 168, 266, 2000 V3: 40, 228–229 mechanical rooms, earthquake protection, 2004 V1: 166 mechanical rotary-type vacuum pumps, 1999 V2: 259 mechanical spaces, 2000 V3: 111 +mechanical steam and condensate return, 2000 V3: 186– 189 +mechanical steam traps, 2000 V3: 182 mechanical tank gauging, 2000 V3: 159–160 mechanical water makeup, 2000 V3: 124 mechanically-dispersed oil, 1999 V2: 347 Meckler, Milton, 2004 V1: 40 +medical air systems. See also medical compressed air (MA) color coding, 2000 V3: 56 +concentrations, 2000 V3: 82 defined, 2000 V3: 84 +medical compressed air (MA) altitude and, 2000 V3: 66 compressors, 2000 V3: 49, 84 storage, 2000 V3: 65–68 surgical use, 2000 V3: 57 symbol, 2004 V1: 8 +system description, 2000 V3: 65 peak demand, 2000 V3: 53 +pipe sizing, 2000 V3: 74 stations, 2000 V3: 50, 51–52 testing, 2000 V3: 82–83 +medical cabinets, 2004 V1: 113 medical compressed air (MA) +altitude and, 2000 V3: 66 compressors, 2000 V3: 49, 84 storage, 2000 V3: 65–68 +330 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +surgical use, 2000 V3: 57 symbol, 2004 V1: 8 +system description, 2000 V3: 65 medical-gas systems +certification, 2000 V3: 77–83 codes and standards, 2000 V3: 83 color coding, 2000 V3: 54, 56 design checklist, 2000 V3: 49–50 +dispensing equipment, 2000 V3: 54–59 ceiling-mounted, 2000 V3: 57–59 nitrogen equipment, 2000 V3: 59 +patient headwall systems, 2000 V3: 56–57 station terminals, 2000 V3: 54–56 +types, 2000 V3: 58 diversity factors, 2000 V3: 75 +earthquake bracing for, 2004 V1: 166 gas flow rates, 2000 V3: 50–54 +gas storage, 2000 V3: 59–68 +medical compressed air, 2000 V3: 65–68 nitrogen, 2000 V3: 68 +nitrous oxide, 2000 V3: 64–65 oxygen, 2000 V3: 59–63 +health-care facilities, 2000 V3: 49–83 number of stations, 2000 V3: 50 piping, 2000 V3: 73–77 +installation, 2000 V3: 73 materials, 2000 V3: 74–77 sizing, 2000 V3: 73–74 +system control valves, 2000 V3: 71–72 typical storage layout, 2000 V3: 60 warning systems, 2000 V3: 72–73 +waste anesthetic gas management, 2000 V3: 70–71 medical-gas tube, 2000 V3: 77, 81, 2003 V4: 45 +medical laboratories. See health-care facilities; laboratories medical schools. See health-care facilities +medical vacuum (MV), 2004 V1: 9 +medical waste systems. See infectious and biological waste systems +Medicare taxes, in labor costs, 2004 V1: 94 medicine sinks, 2000 V3: 35 +Medium and High-expansion Foam Systems (NFPA 11A), 2000 V3: 21, 29 +medium-backflow hazard, 2000 V3: 222 medium-expansion foams, 2000 V3: 21 +medium-pressure condensate (MPC), 2004 V1: 9 medium-pressure gas (MG), 2004 V1: 8 +medium-pressure natural gas systems, 1999 V2: 173–194 medium-pressure steam (mps, MPS), 2004 V1: 9, 15, 2000 +V3: 175 +medium-temperature hot water (mthw, MTHW), 2004 V1: 15 +medium vacuum, 1999 V2: 254 “mega” prefix, 2004 V1: 34 megaohm-cm, 1999 V2: 285 Mellar, 2000 V3: 97 +membrane filtration +cross-flow filters, 1999 V2: 300, 310–311 gray-water systems, 1999 V2: 27 +in health care facilities, 2000 V3: 47 membrane flux, 1999 V2: 309 membrane productivity, 1999 V2: 321 + +membrane selection in reverse osmosis, 1999 V2: 310, 311 +overview, 1999 V2: 308–311 +pure water systems, 1999 V2: 321 reverse osmosis, 1999 V2: 308–309 tangential-flow filters, 1999 V2: 300 total dissolved solids and, 1999 V2: 288 +membrane flux, 1999 V2: 309 membrane productivity, 1999 V2: 321 +Membrane Technologies in the Power Industry, 1999 V2: 325 +membranes in waterproofing, 1999 V2: 17 memory metal couplings, 2000 V3: 77 mercantile facilities +numbers of fixtures for, 2003 V4: 20 single-occupant toilet rooms, 2003 V4: 23 +mercury (Hg, HG), 2004 V1: 15 mercury vapor lamps, 1999 V2: 312 Mermel, H., 1999 V2: 350 +Meslar, H.W., 1999 V2: 350 +MET (mean effective temperatures), 2004 V1: 15 metal-edged weirs, 2000 V3: 109 +metal flashing on roof drains, 1999 V2: 79 metal-plating plants, 1999 V2: 147 metallic pipes. See also specific metals +bedding, 2000 V3: 234, 235 +pure-water systems, 2000 V3: 47 metals. See also specific metals +corrosion losses, 2004 V1: 139 galvanic series table, 2004 V1: 141 metallic coatings, 2004 V1: 147 +Metcalf, 1999 V2: 238 +meter set assemblies, 1999 V2: 214 metered faucet requirements, 2004 V1: 264 meters (general devices) +acid wastes, 2000 V3: 41–42 fuel dispensers, 2000 V3: 165 natural gas, 2000 V3: 249, 250 +meters (measurements) converting units, 2000 V3: 29 meters, 2004 V1: 33 +meters of head, 2004 V1: 2 meters per second, 2004 V1: 33 +meters per second squared, 2004 V1: 33 meters squared, 2004 V1: 33 +meters squared per second, 2004 V1: 33 meters (water) +disk-type, 1999 V2: 127 +domestic cold water systems, 1999 V2: 115–116 flow pressure loss tables, 1999 V2: 117 irrigation, 2000 V3: 105 +locations for, 2000 V3: 217 pressure and, 1999 V2: 123 pressure losses, 2000 V3: 224 +sizing sewage systems and, 1999 V2: 233 methane. See fuel-gas piping systems Method for Measuring the Minimum Oxygen +Concentration to Support Candle-like Combustion of Plastics (ASTM D2863), 2000 V3: 85 +Methods of Estimating Loads in Plumbing Systems, 1999 V2: 155 +methoxyflurane, 2000 V3: 70 +Index + + +methyl orange alkalinity, 1999 V2: 282 Metric Conversion Act, 2004 V1: 32 metric tons, 2004 V1: 34 +metric units. See International System of Units Meyers, Vance A., 1999 V2: 114 +Meyrick, C.E., 1999 V2: 325 +MFETT (MasterFormat expansion task team), 2004 V1: 64 mfr, MFR (mass flow rates), 2004 V1: 15, 33 +mg/L (milligrams per liter), 1999 V2: 285 MG (medium-pressure gas), 2004 V1: 8 MH (manholes). See manholes +mho (specific conductivity), 1999 V2: 287 “micro” prefix, 2004 V1: 34 +microbial growth and control. See also bacteria; microorganisms; viruses in feed water +cooling towers, 1999 V2: 316 +drinking water, 1999 V2: 316–317, 318 feed water, 1999 V2: 321 +pure water systems, 1999 V2: 323 utility water, 1999 V2: 314 +water softeners, 1999 V2: 307, 308 water treatments, 1999 V2: 311–313 +microbiological fouling of water, 1999 V2: 289, 316 microbiological laboratories, 1999 V2: 343. See also +laboratories micromhos, 1999 V2: 287 microns +converting to SI units, 2004 V1: 39 vacuum units, 1999 V2: 254 +microorganisms. See also bacteria; microbial growth and control; viruses in feed water +infectious waste drainage systems, 1999 V2: 343 pure water systems, 1999 V2: 323, 2000 V3: 47 water analysis of, 1999 V2: 282 +water treatments, 1999 V2: 311–313, 318 microscopes, electron, 2000 V3: 38, 39, 45, 51 +MIL F-1183 Bronze Fittings for Brazed Joints, 2003 V4: 27, 34 +miles +converting to SI units, 2004 V1: 39 +miles per hour (mph, MPH), 2004 V1: 15 Millepore filters, 1999 V2: 288–289 +“milli” prefix, 2004 V1: 34 millibars (mbar) +converting to SI units, 2004 V1: 39 vacuum units, 1999 V2: 254 +millicuries (mc), 1999 V2: 339 milligrams per liter (mg/L), 1999 V2: 285 millimeters +converting to inches, 2000 V3: 29 converting to SI units, 2004 V1: 39 +millirems (mrem), 1999 V2: 339 Mills, Lawrence E., 2004 V1: 214 min (minutes), 2004 V1: 34 +min., MIN (minimum), 2004 V1: 15 mineral deposits +swimming pools, 2000 V3: 131, 147–148 well water, 2000 V3: 131 +mineral salts, 1999 V2: 288, 290 mineral solids, 1999 V2: 289 mineral wool, 2004 V1: 193 minimum (min., MIN), 2004 V1: 15 + +331 + + +minimum design flow, 1999 V2: 182 +minimum inlet pressure in gas boosters, 1999 V2: 182 minor backflow hazard, 1999 V2: 145, 146, 2000 V3: 222 minutes, 2004 V1: 34 +mirrors, 2004 V1: 113 +misaligned wells, pumps for, 1999 V2: 245 miscellaneous gases, 2000 V3: 84 +mist eliminators, 1999 V2: 295 +MIUS Technology Evaluation: Collection, Treatment and Disposal of Liquid Wastes, 1999 V2: 238 +mixed-bed deionization (single-step), 1999 V2: 302, 303, 304, 305, 2000 V3: 46 +mixed media filters, 2000 V3: 132, 133, 139 mixes in specifications, 2004 V1: 91 +mixing faucets, 2000 V3: 34 mixing flows of water +conserving energy, 2004 V1: 126 +mixed-water temperatures, 1999 V2: 159–160 mixing stations, 2000 V3: 36 +moderate backflow hazard, 1999 V2: 145, 146, 2000 V3: 222 +Modern Vacuum Practice, 1999 V2: 277 modifications section in project manual, 2004 V1: 63 modified header systems, 1999 V2: 127 +modular iron piping, 1999 V2: 196 Moffat, R., 1999 V2: 277 +mole (mol), 2004 V1: 33 +molecular weights of elements, 1999 V2: 281 moments of inertia +conversion factors, 2004 V1: 36 measurements, 2004 V1: 33 +momentum measurements, 2004 V1: 33 monel, 2004 V1: 141, 144 +monitor-type intermediate gas regulators, 2000 V3: 251 monitoring +aboveground tank systems, 2000 V3:167–168 ground water, 2000 V3: 162 +underground liquid fuel storage tanks, 2000 V3: 158–163 +measuring leakage, 2000 V3: 158–163 piping leaks, 2000 V3: 162 +remote leakage, 2000 V3: 162–163 +monthly inventory tank tightness testing, 2000 V3: 161– 162 +Montreal Protocol, 2000 V3: 22 mop basins, 2003 V4: 12 +mop sinks, 1999 V2: 25, 2000 V3: 32, 34 morgues and mortuaries, 1999 V2: 16, 147 Moritz, A.R., 1999 V2: 169, 170 +mortar joints on septic tanks, 1999 V2: 228 motels +acoustic plumbing design, 2004 V1: 196 numbers of fixtures for, 2003 V4: 20 septic tanks, 1999 V2: 231–232 +vacuum calculations for, 1999 V2: 269 motion +in creativity checklist, 2004 V1: 234 in earthquakes, 2004 V1: 158–159 +Motor Fuel Dispensing Facilities and Repair Garages Code (NFPA 30A), 2000 V3: 154 +motor lubrication oil, 2000 V3: 154 +motor-operated filter bag shakers, 1999 V2: 268 +332 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +motor-operated valves, 2004 V1: 9 motorized valves, 2000 V3: 119 motors +earthquake protection, 2004 V1: 164 fan acoustic problems, 2004 V1: 197 motor journals, 2004 V1: 196 +in pumps, 2004 V1: 196 +rotor acoustic modifications, 2004 V1: 197 mound soil-absorption systems, 1999 V2: 220, 226 mounting. See also installation +fire extinguishers, 2000 V3: 27, 28 water closets, 2003 V4: 4 +MPC (medium-pressure condensate), 2004 V1: 9 mph, MPH (miles per hour), 2004 V1: 15 +MPS (medium-pressure steam supply), 2004 V1: 9 mps, MPS (medium-pressure steam), 2004 V1: 15 mrem (millerems), 1999 V2: 339 +MSDS (material safety data sheets), 2000 V3: 90 +MSS (Manufacturers Standardization Society of the Valve and Fittings Industry, Inc.), 2004 V1: 26, 55, 59 +MTD (mean temperature difference), 2004 V1: 15 +mthw, MTHW (medium-temperature hot water), 2004 V1: 15 +MU (viscosity), 2004 V1: 2, 16, 33, 2000 V3: 154 mudballing in filters, 2000 V3: 132, 150 +muds in feed water, 1999 V2: 289 mufflers on vacuum systems, 2000 V3: 70 multi-effect distillation, 1999 V2: 298, 299 multi-graded sand filtration, 1999 V2: 298 multi-level pools, 2000 V3: 108, 109 +multimedia filtration, 1999 V2: 298, 300, 322–323 multiple. See also entries beginning with double-, multi-, +or two- +multiple-compartment septic tanks, 1999 V2: 229 multiple-degree-of-freedom systems, 2004 V1: 160, 161 multiple-family dwellings. See apartment buildings multiple-gang-service outlets, 2000 V3: 56 +multiple gas-train vents, 1999 V2: 177 multiple pools, 2000 V3: 108 +multiple pressure-regulated valve installation, 1999 V2: 153 +multiple-tray waterfall aerators, 1999 V2: 293 multiplication in SI units, 2004 V1: 34 multipurpose dry chemicals, 2000 V3: 19, 27 +multistage pressure breakdown systems for pump plants, 2004 V1: 197–198 +multistory buildings. See large buildings municipal sewers. See public sewers municipal water supply +fire-protection connections, 2000 V3: 225 irrigation usage, 2000 V3: 105 +sprinkler systems, 2000 V3: 3 types of, 2000 V3: 8 +water mains and pressure, 2000 V3: 216 +muriatic acid, 1999 V2: 305, 333, 2000 V3: 148, 149, 150 museums, numbers of fixtures for, 2003 V4: 19 +mussels, 1999 V2: 282 +MV (medical vacuum), 2004 V1: 9 + +N +n (nano) prefix, 2004 V1: 34 N (newtons), 2004 V1: 33 + + +N (nitrogen). See nitrogen N (numbers), 2004 V1: 15 +n c, N C (normally closed), 2004 V1: 15 n i c, N I C (not in contract), 2004 V1: 15 N m (newton-meters), 2004 V1: 33 +n o, N O (normally open), 2004 V1: 15 N1.85 graph paper, 2000 V3: 5 +N2O (nitrous oxide), 2004 V1: 9 +na, N/A (not applicable), 2004 V1: 15 +NACE Basic Corrosion Course, 2004 V1: 154 +NACE (National Association of Corrosion Engineers), 2004 V1: 150, 154 +NACE Standard RP-01, 2004 V1: 150 NaCI (ionized salts), 2000 V3: 46 nails, protecting against, 1999 V2: 19 Nalco Chemical Co., 1999 V2: 325 Nalco Water Handbook, 1999 V2: 325 “nano” prefix, 2004 V1: 34 +nanofilter membranes, 1999 V2: 284, 300, 308–311, 310 naphtha, 1999 V2: 13 +National Association of Corrosion Engineers (NACE), 2004 V1: 150, 154 +National Association of Home Builders Research Foundation, 1999 V2: 65 +National Association of Plumbing-Heating-Cooling Contractors. See Plumbing-Heating-Cooling Contractors–National Association (PHCC-NA) +National Board of Boiler and Pressure Vessel Inspectors (NBBPVI), 1999 V2: 166 +National Bureau of Standards electromotive force series, 2004 V1: 153 publications, 1999 V2: 19, 65, 155 reduced-size venting, 1999 V2: 49 +stack capacities study, 1999 V2: 4 National Coarse of U.S. Thread, 2004 V1: 17 +National Collegiate Athletic Association (NCAA), 2000 V3: 151 +National Committee for Clinical Laboratory Standards, Inc. (NCCLS), 1999 V2: 279, 317, 319 +National Easter Seal Society, 2004 V1: 111 +National Electrical Code (NEC), 1999 V2: 170, 2000 V3: 115, 121 +National Energy Conservation Policy Act, 2004 V1: 124 National Fire Alarm Code (NFPA 72), 2000 V3: 24, 29 National Fire Protection Association, Inc. +address, 2004 V1: 59, 2000 V3: 86, 97 +air compressors in dry-pipe systems, 2000 V3: 12 defined, 2004 V1: 26 +design density requirements, 2000 V3: 16 designing systems and, 2000 V3: 1 +fire hydrants, 1999 V2: 249 firefighting water tanks, 1999 V2: 247 +formulas in natural gas systems, 1999 V2: 186, 187, 188, 189 +fuel-gas pipe sizing, 1999 V2: 184 gas storage standards, 1999 V2: 194 +hot-water system standards, 1999 V2: 170 list of standards, 2004 V1: 55–56 +medical gas station guidelines, 2000 V3: 50 publications, 2004 V1: 40 +Automatic Sprinkler and Standpipe Systems, 2000 V3: 29 +Index + + +NFPA Fire Protection Handbook, 2000 V3: 8, 29 NFPA Standard no. 10: Standard for Portable Fire +Extinguishers, 2000 V3: 27, 29 +NFPA Standard no. 11: Low-expansion Foam, 2000 V3: 21, 29 +NFPA Standard no. 11A: Medium and High-expansion Foam Systems, 2000 V3: 21, 29 +NFPA Standard no. 12: Carbon Dioxide Extinguishing Systems, 2000 V3: 20, 29 +NFPA Standard no. 12A: Halon 1301 Fire Extinguishing Systems, 2000 V3: 23, 25, 29 +NFPA Standard no. 13: Installation of Sprinkler Systems, 2004 V1: 191, 2000 V3: 2, 12, 15, 16, 21, 29, 232 +NFPA Standard no. 14: Installation of Standpipe and Hose Systems, 2000 V3: 2, 18, 29 +NFPA Standard no. 15: Water Spray Fixed Systems for Fire Protection, 2000 V3: 2, 29 +NFPA Standard no. 16: Deluge Foam-water Sprinkler Systems and Foam-water Spray Systems, 2000 V3: 21, 29 +NFPA Standard no. 16A: Installation of Closed-head Foam-water Sprinkler Systems, 2000 V3: 21, 29 +NFPA Standard no. 17: Dry Chemical Extinguishing Systems, 2000 V3: 20, 29 +NFPA Standard no. 20: Installation of Centrifugal Fire Pumps, 2000 V3: 25, 29 +NFPA Standard no. 24: Installation of Private Fire Service Mains and Their Appurtenances, 2000 V3: 29, 225 +NFPA Standard no. 30: Flammable and Combustible Liquids Code, 2000 V3: 2, 21, 29, 95, 153, 154, 165, 167, 173 +NFPA Standard no. 30A: Motor Fuel Dispensing Facilities and Repair Garages Code, 2000 V3: 154 +NFPA Standard no. 50: Standard for Bulk Oxygen Systems at Consumer Sites, 2000 V3: 61, 86 +NFPA Standard no. 54: National Fuel Gas Code, 2000 V3: 248, 254 +NFPA Standard no. 59: LP-Gases at Utility Gas Plants, 1999 V2: 214 +NFPA Standard no. 65: Standard for the Processing and Finishing of Aluminum, 2000 V3: 20 +NFPA Standard no. 72: National Fire Alarm Code, 2000 V3: 24, 29 +NFPA Standard no. 99: Standard for Health Care Facilities, 2003 V4: 45 +NFPA Standard no. 99: Standard for Health-care Facilities, 2000 V3: 50, 56, 66–67, 68, 77, 86 +NFPA Standard no. 99C: Gas and Vacuum Systems, 2003 V4: 45 +NFPA Standard no. 231: General Storage, 2000 V3: 2, 29 +NFPA Standard no. 231C: Rack Storage of Materials, 2000 V3: 2, 29 +NFPA Standard no. 255: Standard Method of Test of Surface Burning Characteristics of Building Materials, 2000 V3: 77 +NFPA Standard no. 291: Standard on Flow Testing and Marking of Fire Hydrants, 2000 V3: 3 + +333 + + +NFPA Standard no. 329: Recommended Practice for Handling Releases of Flammable and Combustible Liquids and Gases, 2000 V3: 154 +NFPA Standard no. 385: Standard for Tank Vehicles for Flammable and Combustible Liquids, 2000 V3: 154 +NFPA Standard no. 480: Standard for the Storage, Handling and Processing of Magnesium Solids and Powders, 2000 V3: 20 +NFPA Standard no. 481: Standard for the Production, Processing, Handling and Storage of Titanium, 2000 V3: 20 +NFPA Standard no. 482: Standard for the Production, Processing, Handling and Storage of Zirconium, 2000 V3: 20 +NFPA Standard no. 651: Standard for the Machining and Finishing of Aluminum and the Production and Handling Aluminum Products, 2000 V3: 20 +NFPA Standard no. 2001: Clean Agent Extinguishing Systems, 2000 V3: 22, 23, 25, 29 +sprinkler piping, 2004 V1: 183–184 sprinkler system statistics, 2000 V3: 2 +National Fuel Gas Code (NFPA 54), 1999 V2: 214 equivalent lengths, 1999 V2: 184 +gas pressures, 1999 V2: 183 +industrial boiler gas trains, 1999 V2: 177 natural gas system design, 2000 V3: 248 pipe materials, 2000 V3: 254 +pipe sizing, 1999 V2: 194 +National Ground Water Association (NGWA), 1999 V2: 252 +National Institutes of Health, 1999 V2: 262, 343 +National Insulation Contractors’ Association (NICA), 2004 V1: 127 +National Oceanic and Atmospheric Administration (NOAA), 2000 V3: 242 +NOAA, National Weather Service 5-60 Minute Precipitation Frequency for the Eastern and Central United States, 1999 V2: 114 +Technical Paper no. 40, 2000 V3: 243 National Plumbing Code, 1999 V2: 65, 114, 155 National Pollutant Discharge Elimination System +(NPDES), 2000 V3:88, 2000 V3: 89 National Sanitation Foundation (NSF) +address, 2004 V1: 59 +hot-water system requirements, 1999 V2: 170 individual wastewater treatment plants, 1999 V2: 232 list of standards, 2004 V1: 56 +PVC plastic ratings, 2000 V3: 145 recycled wastewater quality, 1999 V2: 22 Standard 61, 2003 V4: 26 +swimming pool components, 2000 V3: 131 National Sanitation Foundation Testing Laboratory +(NSFTL), 2004 V1: 26 +National Society of Professional Engineers (NSPE), 2004 V1: 62, 63 +National Spa and Pool Institute (NSPI) address, 2000 V3: 151 +334 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +ANSI/NSPI-1: Standard for Public Swimming Pools, 2000 V3: 125, 151 +ANSI/NSPI-5: Standard for Residential, In-ground Swimming Pools, 2000 V3: 151 +Report no. 18: Corrosion in Swimming Pools and General Guide to Materials Selection, 2000 V3: 145 +swimming pool codes, 2000 V3: 127 +National Standard Plumbing Code, 1999 V2: 37, 65 National Technical Information Service (NTIS), 2000 V3: +97 +National Weather Service Hydro 35, 2000 V3: 242 natural drainage (corrosion), 2004 V1: 153 +natural frequency of vibration control materials, 2004 V1: 202 +natural gas. See fuel-gas piping systems; natural gas systems +natural gas systems, 2000 V3: 248–254 appliances, 1999 V2: 175, 177–178 bottled gas, 1999 V2: 174 +codes and standards, 2000 V3: 248 compressed gas fires, 2000 V3: 21 compressed gases defined, 2000 V3: 199 design considerations, 1999 V2: 173–176 gas boosters, 1999 V2: 178–183 +gas train vents, 1999 V2: 177 glossary, 1999 V2: 213–214 +high-rise buildings and, 1999 V2: 180 laboratory gas systems, 1999 V2: 176–177 +low and medium pressure systems, 1999 V2: 173–194 meters, 2000 V3: 250 +overview, 2000 V3: 248 +pipe sizing, 1999 V2: 183–194, 2000 V3: 252–254 preliminary information, 2000 V3: 215–216 pressure drops and sizing, 1999 V2: 192, 193 sample gas utility letter, 2000 V3: 249, 258–259 +sizing by NFPA formula, 1999 V2: 186, 187, 188, 189 sizing by Spitzglass formula, 1999 V2: 183, 210–211 sizing by Weymouth formula, 1999 V2: 183, 190, 191, +198–209 +system components, 2000 V3: 250–252 drip pots, 2000 V3: 252 +gas line filters, 2000 V3: 250 gas meters, 2000 V3: 250 +gas pressure regulators, 2000 V3: 250–252 natural gas pipes, 2003 V4: 35, 36 +testing and purging, 2000 V3: 252, 253 types of services, 2000 V3: 249 +natural gas water heaters. See gas-fired water heaters natural logarithms, 2004 V1: 15 +natural osmosis, 1999 V2: 308 +natural period of vibration, 2004 V1: 160 Natural Resources Defense Council, 2000 V3: 88 natural water, 1999 V2: 280, 320 +naturally-vented multiple tray aerators, 1999 V2: 293 naval rolled brass, 2004 V1: 144 +NBBPVI (National Board of Boiler and Pressure Vessel Inspectors), 1999 V2: 166 +NBR (acrylonitrile butadiene rubber), 2000 V3: 169 +NBS (National Bureau of Standards). See National Bureau of Standards +NC (noise criteria), 2004 V1: 15, 206 + +NC (number of circuits), 2004 V1: 15 +NCAA (National Collegiate Athletic Association), 2000 V3: 151 +NCCLS (National Committee for Clinical Laboratory Standards, Inc.), 1999 V2: 279, 317, 319 +NEC (National Electrical Code), 1999 V2: 170 negative gauge pressure, 1999 V2: 254 negative pressure. See vacuum +negativity in value engineering presentations, 2004 V1: 258 +NEMA 4 listing, 1999 V2: 179 NEMA 4X listing, 1999 V2: 166 NEMA 12 listing, 1999 V2: 179 +NEMA Class 1, Division 1, Group D listing, 1999 V2: 179 neoprene compression gaskets, 2003 V4: 27 +neoprene floor and hanger mounts, 2004 V1: 203, 204, 205 neoprene gaskets, 2000 V3: 42 +neoprene seal plugs in cleanouts, 1999 V2: 9 nephelometric test, 1999 V2: 287 +nephelometric turbidity units (NTUs), 1999 V2: 287 +net positive suction head (NPSH), 2004 V1: 199, 206, 1999 V2: 247, 2000 V3: 140 +neutralizing acid in waste water +discharge from laboratories, 2000 V3: 40 health-care facility systems, 2000 V3: 40 laboratories, 2000 V3: 40–41 +methods of treatment, 1999 V2: 334–337 sizing tanks, 2000 V3: 42 +solids interceptors, 2000 V3: 41, 43 +tank and pipe materials, 2000 V3: 91–92 types of acids, 1999 V2: 332, 333 +neutralizing tanks, 2000 V3: 42 neutrons, 1999 V2: 337 +New York City, ultra-low-flow toilets in, 2004 V1: 134–135 New York State Department of Environmental +Conservation address, 2000 V3: 97 +Technology for the Storage of Hazardous Liquids, 2000 V3: 96 +newton-meters, 2004 V1: 33 newtons, 2004 V1: 33 +NF nomographs, 1999 V2: 317 +NFPA. See National Fire Protection Association, Inc. NGWA (National Ground Water Association), 1999 V2: +252 +ni-resist cast iron, 2004 V1: 144 ni-resist ions, 2004 V1: 141 +NICA (National Insulation Contractors’ Association), 2004 V1: 127 +niche lights for pools, 2000 V3: 121, 145 nickel +corrosion, 2004 V1: 139 +electromotive force series, 2004 V1: 144 galvanic series, 2004 V1: 141 +in stainless steel, 2003 V4: 2 nickel-bronze grates, 1999 V2: 15, 16 +nightclubs, numbers of fixtures for, 2003 V4: 19 Nine Dots exercise, 2004 V1: 232, 261 +nippled-up sprinklers, 2004 V1: 13 +nipples for cast iron radiators, 2000 V3: 179 nitrates, 1999 V2: 281, 283 +nitric acid, 2004 V1: 146, 1999 V2: 333 +Index + + +nitrifying bacteria, 1999 V2: 282 +nitrile butadiene (Buna-N), 2000 V3: 169 nitrogen (N) +color coding outlets, 2000 V3: 56 control cabinets, 2000 V3: 58 cylinder supplies, 2000 V3: 60 defined, 2000 V3: 84 +dry nitrogen, 2000 V3: 252 +gas blankets in water tanks, 1999 V2: 324 +high-pressure dispensing equipment, 2000 V3: 59 laboratory outlets, 2000 V3: 37–39 +medical gas pipe sizing, 2000 V3: 74, 75, 77 medical gas stations, 2000 V3: 51–52 medical gas storage, 2000 V3: 68 +oil-free, 2003 V4: 45 +in raw water, 1999 V2: 284 surgical use, 2000 V3: 57 symbol, 2004 V1: 9 +testing concentrations, 2000 V3: 82 in water chemistry, 1999 V2: 281 +nitrogen NF, 2000 V3: 65, 84 nitrous fumes, 1999 V2: 333 nitrous oxide (N2O) +color coding outlets, 2000 V3: 56 cylinder supplies, 2000 V3: 60 defined, 2000 V3: 84 +medical gas pipe sizing, 2000 V3: 74, 76 medical gas storage, 2000 V3: 64–65 surgical use, 2000 V3: 57 +symbol, 2004 V1: 9 +testing concentrations, 2000 V3: 82 +waste anesthetic gas management, 2000 V3: 70 nL/min (normal liters per minute), 2000 V3: 200 nm3/min (normal cubic meters per minute), 2000 V3: 200 no-flow pressure in pressure-regulated valves, 1999 V2: +152 +no-hub joints, earthquake protection and, 2004 V1: 168 no-hub outlets, 1999 V2: 18 +no-man zones around building footers, 1999 V2: 103 no., NO (numbers), 2004 V1: 15 +“no observed adverse effect level,” 2000 V3: 22 no-slump concrete, 2003 V4: 32 +NOAA (National Oceanic and Atmospheric Administration) +NOAA, National Weather Service 5-60 Minute Precipitation Frequency for the Eastern and Central United States, 1999 V2: 114 +rainfall records, 2000 V3: 242 Technical Paper no. 40, 2000 V3: 243 +NOAEL (no observed adverse effect level), 2000 V3: 22 noble potential, defined, 2004 V1: 153 +noise. See acoustics in plumbing systems +noise criteria (NC), 2004 V1: 15, 206. See also preferred noise criteria (PNC) curves +nominal diameter (DN), 1999 V2: 253 +nominal pipe size (NPS), 1999 V2: 253, 2003 V4: 61, 62 nominal values, 2004 V1: 32 +nomographs, 1999 V2: 31–32 +non-agreement states, 1999 V2: 340 +non-ambulatory disabilities, 2004 V1: 107 non-aqueous liquid wastes, 2000 V3:87 non-aspirating nozzles, 2000 V3: 21 + +335 + + +non-circular grab bars, 2004 V1: 121 +non-circulating water systems, 2004 V1: 127 non-continuous joints, 2004 V1:150 +non-depletable energy sources, 2004 V1: 137 Nondiscrimination on the Basis of Disability by Public +Accommodations and in Commercial Facilities, 2004 V1: 106 +non-electrolytes, 1999 V2: 280 +non-flammable medical gas, 2000 V3: 49 +Non-flammable Medical Gas Piping Systems (CSA Z305.1), 2000 V3: 86 +non-looped piping systems, 2000 V3: 16 +non-measurable nouns in function analysis, 2004 V1: 224 non-metallic coatings, 2004 V1: 147 +non-oxidizing chemicals in microbial control, 1999 V2: 311 non-oxidizing piping, 1999 V2: 341 +non-porous piping, 1999 V2: 341 non-porous soils, 2000 V3: 105 +non-potable cold water (NPCW), 2004 V1: 9 non-potable hot water (NPHW), 2004 V1: 9 +non-potable hot water return (NPHWR), 2004 V1: 9 non-potable water systems. See gray-water systems non-pressure asbestos concrete pipe, 2003 V4: 26 non-pumping wells, 1999 V2: 241–243 +non-puncturing membrane flashing, 1999 V2: 17 non-reactive silica, 1999 V2: 283 +non-reinforced concrete pipe, 2003 V4: 32 non-rigid couplings, 2004 V1: 186 +non-SI units, 2004 V1: 34 +non-sprinklered spaces, 2004 V1: 12 +Non-structural Damage to Buildings, 2004 V1: 191 non-tilting grates, 1999 V2: 11 +non-vitreous china fixtures defined, 2003 V4: 1 standards, 2003 V4: 2 +“normal,” compared to “standard,” 2000 V3: 200 +normal cubic meters per minute (nm3/min), 2000 V3: 200 normal liters per minute (nL/min), 2000 V3: 200 normally closed (n c, N C), 2004 V1: 15 +normally open (n o, N O), 2004 V1: 15 nose pieces in deaerators, 1999 V2: 56 not applicable (na, N/A), 2004 V1: 15 not in contract (n i c, N I C), 2004 V1: 15 not to scale (NTS), 2004 V1: 15 +nouns in function analysis, 2004 V1: 224, 225, 231 nourishment stations in health-care facilities, 2000 V3: 32 nozzles +defined, 2004 V1: 29 +dry-chemical systems, 2000 V3: 19 +fountains, 2000 V3: 108–109, 112, 117–118, 119–120 fuel dispensers, 2000 V3: 165 +irrigation sprinklers, 2000 V3: 103 pressure, 2000 V3: 19, 219 pressure flow tables, 2000 V3: 4, 7 sprinklers, 2000 V3: 9 +standpipe systems, 2000 V3: 19 +water level in pools and, 2000 V3: 112 NPCW (non-potable cold water), 2004 V1: 9 +NPDES (National Pollutant Discharge Elimination System), 2000 V3:88, 2000 V3: 89 +NPHW (non-potable hot water), 2004 V1: 9 NPHWR (non-potable hot water return), 2004 V1: 9 +336 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +NPS (nominal pipe size), 1999 V2: 253 +NPSH (net positive suction head), 2004 V1: 199, 206, 1999 V2: 247, 2000 V3: 140 +NRC (Nuclear Regulatory Commission), 1999 V2: 339, 340 NSF. See National Sanitation Foundation (NSF) +NSPE (National Society of Professional Engineers), 2004 V1: 62, 63 +NSPI. See National Spa and Pool Institute (NSPI) NT (number of tubes), 2004 V1: 15 +NTIS (National Technical Information Service), 2000 V3: 97 +NTS (not to scale), 2004 V1: 15 +NTUs (nephelometric turbidity units), 1999 V2: 287 nuclear power plants +nuclear reactors, 1999 V2: 147 regulatory requirements, 1999 V2: 337 seismic protection, 2004 V1: 156 +Nuclear Regulatory Commission, 1999 V2: 339, 340 numbers (no., NO, N) +of circuits (NC), 2004 V1: 15 in CSI format, 2004 V1: 65 +in measurements, 2004 V1: 32 of swimmers, 2000 V3: 127–128 symbol, 2004 V1: 15 +of tubes (NT), 2004 V1: 15 +numerical weights in value engineering, 2004 V1: 243 nurse stations, 2000 V3: 32 +nurseries +fixtures for, 2000 V3: 34 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 52, 58 sinks, 2000 V3: 38 +nursing homes. See health-care facilities Nussbaum, O.J., 1999 V2: 325 + +O +O-rings, 2003 V4: 37 +o-ring gaskets, 2004 V1: 266 O2. See oxygen (O2, OX) +oa, OA (outside air), 2004 V1: 15 oakum seals, 2003 V4: 27, 28 +objectives in FAST approach, 2004 V1: 230 obstructions to wheelchairs, 2004 V1: 111, 112 +occupancy classification (sprinkler systems), 2004 V1: 29, 2000 V3: 2, 17 +occupancy of pools, 2000 V3: 127–128 occupant loads of buildings, 2003 V4: 18 +Occupational Safety and Health Administration (OSHA), 1999 V2: 333, 2000 V3: 153, 156 +occupied domestic spaces, acoustic plumbing design for, 2004 V1: 196 +ocean water, irrigation systems and, 1999 V2: 26 octave-band sound levels, 2004 V1: 194 +octaves, 2004 V1: 206 +OD (outside diameters), 2004 V1: 14 +odor control in drinking water, 1999 V2: 245, 316 +OFCI (owner furnished, contractor installed), 2004 V1: 71 off-peak power usage, 2004 V1: 128–129 +office buildings, numbers of fixtures for, 2003 V4: 19, 21–22 +Office of Statewide Health Planning and Development (OSHPD), 2004 V1: 191 + +offset stacks +defined, 1999 V2: 64 sizing, 1999 V2: 5, 6 venting, 1999 V2: 44–45 +offsets, defined, 2004 V1: 26 offshore facilities, 2004 V1: 150 +ohm-centimeter units (�-cm), 2000 V3: 46 ohm-meters, 2004 V1: 33 +Ohm's Law, 2004 V1: 144 +OHMS (resistance or resistors), 2004 V1: 15, 33 oil +as seal liquid in liquid ring pumps, 1999 V2: 260 contamination in compressed air, 2000 V3: 201 intercepting in acid-waste systems, 1999 V2: 336 intercepting in sanitary drainage systems, 1999 V2: +12–13 +oil-water separation, 2000 V3: 93 skimming, 2000 V3: 93 +spills and containment, 1999 V2: 347–349 storm-drainage systems and, 1999 V2: 67 vegetable oil, 1999 V2: 10 +oil draw-off pipes, 1999 V2: 13 +oil-free compressors, 2000 V3: 67, 201 oil interceptors, 1999 V2: 12–13, 349 +oil-mist filters in vacuums, 1999 V2: 260 oil-removal filters, 2000 V3: 203 +oil systems. See diesel-oil systems; gasoline systems oil-wet solids, 1999 V2: 347 +oilless compressors, 2000 V3: 67 oilless pumps, 1999 V2: 259, 262 oleums, 1999 V2: 332, 333 +on-site facility treatment systems. See special-waste drainage systems +on-site storm-water detention systems, 1999 V2: 105–107 On Site Wastewater Facilities for Small Communities and +Subdivisions, 1999 V2: 238 +on-site water reclamation. See gray-water systems one-compartment septic tanks, 1999 V2: 229 +one-compartment sinks, 2003 V4: 11 +one-family dwellings, numbers of fixtures for, 2003 V4: 20, 21 +one-occupant toilet rooms, 2003 V4: 18, 23 one-pass cooling for equipment, 2004 V1: 264 one-piece water closets, 2003 V4: 3 +one-pipe heat-trace systems, 1999 V2: 165 +one-pipe steam systems, 2000 V3: 178–180, 183, 186, 188 one-pipe systems (Philadelphia systems), 1999 V2: 46, 47, +48 +one-stage distillation, 1999 V2: 295 +one-tank residential filters, 2000 V3: 134 one-time costs, 2004 V1: 223 +one-wall tanks, 2000 V3: 156 ongoing costs, 2004 V1: 223 Ongontz valves, 2000 V3: 125 +open-channel flow, 2004 V1: 1, 1999 V2: 7 open-circuit potential, defined, 2004 V1: 153 open-head sprinklers, 2000 V3: 21 +open-joint piping, 1999 V2: 102 +open proprietary specifications, 2004 V1: 67, 68 +open-spring floor and hanger mounts, 2004 V1: 203, 204 open sprinklers, 2004 V1: 29 +open-type base pumps, 1999 V2: 243 +Index + + +open-web steel joists in pipe bracing, 2004 V1: 176 openings for tool access. See cleanouts +operating costs, 2004 V1: 223 +operating hot-water temperatures, 1999 V2: 166 operating-pressure steam classification, 2000 V3: 175–178 +equipment ratings, 2000 V3: 178 vacuum systems, 2000 V3: 178 vapor systems, 2000 V3: 175–178 +operating rooms +articulated ceiling medical gas systems, 2000 V3: 59 fixtures, 2000 V3: 35–36 +medical gas stations, 2000 V3: 52, 58 medical vacuum, 2000 V3: 54 +water demand, 2000 V3: 45 +operators of vacuum systems, 1999 V2: 269 oral surgery equipment, 2000 V3: 39, 52 orbital welding process, 1999 V2: 341 orders in creativity checklist, 2004 V1: 234 ordinary hazard occupancies +defined, 2004 V1: 29 +firefighting hose streams, 2000 V3: 230 portable fire extinguishers, 2000 V3: 27, 28 +ordinary lobe pumps, 1999 V2: 259 organic free water, 1999 V2: 317 organic materials in water, 2000 V3: 46 organic polyelectrolytes, 1999 V2: 294 +organisms in water, 1999 V2: 282, 2000 V3: 146. See also microorganisms +orifices +on hydrants, 2000 V3: 7 on nozzles, 2000 V3: 7 +ornamental sprinklers, 2004 V1: 29 +ORP (oxidation reduction potential), 2000 V3: 122, 123 orthotolidin tests, 1999 V2: 154 +oscillating-type monitors, 2000 V3: 21 oscillation in pumps, 2004 V1: 201 +OSHA (Occupational Safety and Health Administration), 1999 V2: 333 +OSHPD (Office of Statewide Health Planning and Development), 2004 V1: 191 +osmosis, defined, 1999 V2: 308 osmotic pressure, 1999 V2: 308 Otis, Richard J., 1999 V2: 238 OTO pumps, 1999 V2: 259 Otten, Gerald, 1999 V2: 325 Otto plate units, 1999 V2: 313 ounces (oz, OZ) +converting to SI units, 2004 V1: 40 symbols for, 2004 V1: 15 +out-of-sequence work conditions, cost estimates for projects and, 2004 V1: 98 +outdoor gas booster installation, 1999 V2: 180 outdoor gas hose connectors, 1999 V2: 196 outdoor swimming pools. See also swimming pools +components for, 2000 V3: 139 considerations, 2000 V3: 129 +outfall sewers, 2004 V1: 26 outlet pressures +outlet pressure regulators, 2000 V3: 14, 15 standpipe systems, 2000 V3: 19 +outlets. See also inlets; stations +flow rates at outlets, 2004 V1: 3, 5 + +337 + + +gas boosters, 1999 V2: 179, 183 gas or vacuum. See stations +pools and fountains, 2000 V3: 110–111 pressure in cold-water systems, 1999 V2: 153 septic tanks, 1999 V2: 228 +symbols for, 2004 V1: 11 +velocity of flow from outlets, 2004 V1: 6 outpatient-services rooms, 2000 V3: 32, 45 outside air (oa, OA), 2004 V1: 15 +outside diameters (OD), 2004 V1: 14 outside film coefficients, 2004 V1: 14 “outside the box” thinking, 2004 V1: 232 “outstanding value,” defined, 2004 V1: 213 +overall system thermal efficiency, 2004 V1: 136 overengineering, perception of, 2004 V1: 260 overestimating needs, 2004 V1: 224 +overfill prevention, 2000 V3: 90, 2000 V3:167, 2000 V3: 167 +overflow +for bathtubs, 2003 V4: 16 +for lavatories, 2003 V4: 10–11 +for pools and fountains, 2000 V3: 112, 125 +storm drains. See secondary storm-drainage systems overhead +costs in value engineering, 2004 V1: 212, 222 in plumbing cost estimation, 2004 V1: 93 +overhead steam return lines, 2000 V3: 196 overheating vacuum exhausters, 1999 V2: 268–269 overland flow rates for sites, 2000 V3: 242, 244, 245 overland flow times for sites, 1999 V2: 96, 97, 98, 111 overlap in toilet accessibility, 2004 V1: 114 +overload protection in fountain pumps, 2000 V3: 120 oversized steam traps, 2000 V3: 196 +overspray areas in irrigation, 2000 V3: 104 +overtime labor costs, in take-off estimating method, 2004 V1: 94 +overturning, preventing, 2004 V1: 163, 189 overvoltage, defined, 2004 V1: 153 +owner furnished, contractor installed (OFCI), 2004 V1: 71 owners +perception of engineering, 2004 V1: 260 value engineering and, 2004 V1: 212 +OX (oxygen). See oxygen (O2, OX) oxidation, defined, 2004 V1: 153 +oxidation reduction potential (ORP), 2000 V3: 122, 123 oxidized sewage, 2004 V1: 27 +oxidizing chemicals in microbial control, 1999 V2: 311 oxidizing gases, 2000 V3: 84 +OXY/ACR pipes, 2003 V4: 36 OXY/MED pipes, 2003 V4: 36 OXY, MED piping, 2003 V4: 36 +oxygen concentration cells, 2004 V1: 153 oxygen-delivery equipment, 2000 V3: 85 oxygen-enriched atmospheres, 2000 V3: 85 +Oxygen-fuel Gas Systems for Weldings and Cuttings, 1999 V2: 214 +oxygen index, 2000 V3: 85 oxygen (O2, OX) +bulk oxygen systems, 2000 V3: 61–62, 63 color coding outlets, 2000 V3: 56 +corrosion process, 2004 V1: 145, 1999 V2: 284 cylinder-manifold supply systems, 2000 V3: 62–63, 64 +338 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +defined, 2000 V3: 84–85 +medical gas pipe sizing, 2000 V3: 74, 75, 76 medical gas stations, 2000 V3: 50, 51–52 medical gas storage, 2000 V3: 59–63 medical gas systems, 2000 V3: 49 +medical reserve supply, 2000 V3: 60 +oxygen depletion and gas appliances, 1999 V2: 178 oxygen pitting, 2000 V3: 190 +oxygen USP, 2000 V3: 65, 84 +oxygenated water, 1999 V2: 245, 2000 V3: 116 reducing with carbon dioxide, 2000 V3: 20 removing, 1999 V2: 294 +saturation with, 1999 V2: 292–294 surgical use, 2000 V3: 57 +symbols for, 2004 V1: 8 +testing concentrations, 2000 V3: 82 in water, 1999 V2: 281 +oxygen scavengers, 1999 V2: 314, 315 oxygen toxicity, 2000 V3: 85 +oz, OZ (ounces), 2004 V1: 15, 40 ozonation +cooling tower water, 1999 V2: 316 pure water systems, 1999 V2: 323 +small drinking water systems, 1999 V2: 318 water treatments, 1999 V2: 245, 312–313 +ozone +layer, 2000 V3: 22 +in pools and fountains, 2000 V3: 123–124 ozone generators, 1999 V2: 313 + +P +P alkalinity, 1999 V2: 282 P (peta) prefix, 2004 V1: 34 p (pico) prefix, 2004 V1: 34 P (pressure). See pressure p-traps +floor drains with, 2004 V1: 11 laboratory sinks, 2000 V3: 42 +storm drainage systems, 1999 V2: 84 Pa (pascals), 2004 V1: 33 +PA (pipe anchors), 2004 V1: 10 Pa s (pascal-seconds), 2004 V1: 33 +packed-bed, activated-carbon filters, 1999 V2: 300, 301 packed tower aeration, 1999 V2: 318 +packerhead method, 2003 V4: 32 packing material +in seepage beds, 1999 V2: 224 sound damping, 2004 V1: 196 +in vacuum deaerators, 1999 V2: 295 padding +for glass pipe, 2003 V4: 47 +for vibration control, 2004 V1: 203, 204 pain, thresholds of, 1999 V2: 169 +painting cast iron radiators, 2000 V3: 179 paints in septic tanks, 1999 V2: 230 +Pair, Claude H., 2000 V3: 105 +panels, lining with lead, 1999 V2: 340 paper towel clogs, 1999 V2: 11, 231 paraffin, 1999 V2: 13 +paragraph numbering in CSI format, 2004 V1: 65 parallel approaches for wheelchairs, 2004 V1: 109, 110 parallel-condensate trapping, 2000 V3: 196 + +parallel-flow piping designs, 2000 V3: 178, 183 +parallel installation of pressure-regulated valves, 1999 V2: 153 +parallel-shaft gears, 2004 V1: 196 parapet wall scuppers, 1999 V2: 79, 82 Parekh, B.S., 1999 V2: 325 +Pareto principle, 2004 V1: 224, 258 Pareto, Vilfredo, 2004 V1: 224 +parking lot drainage pipes, 2003 V4: 32 Parmalee heads, 2000 V3: 1 +part-circle rotary sprinkler heads, 2000 V3: 102 partially-sprinklered spaces, 2004 V1: 12 +participation in value engineering presentations, 2004 V1: 258 +particle size in sand filters, 2000 V3: 132 particulate radiation, 1999 V2: 339 particulate silica, 1999 V2: 283 particulates +contamination in compressed air, 2000 V3: 201 in water, 1999 V2: 282, 287–288 +parts per million (ppm, PPM), 2004 V1: 15, 1999 V2: 285, 2000 V3: 46 +pascal-seconds, 2004 V1: 33 pascals, 2004 V1: 33 +passenger terminals, numbers of fixtures for, 2003 V4: 19 passivation, 2004 V1: 146–147 +passive, defined, 2004 V1: 153 +passive verbs in function analysis, 2004 V1: 224 pathogenic organisms, 1999 V2: 282 +paths +of acoustic problems, 2004 V1: 199 of discharge, 2000 V3: 4 +patient rooms +bathing areas, 2000 V3: 32 fixtures for, 2000 V3: 34 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 52, 58 medical vacuum, 2000 V3: 54 +patient head wall stations, 2000 V3: 58 patient vacuum (VAC), 2000 V3: 85 +paved areas +imperviousness factors, 2000 V3: 243 storm drainage, 1999 V2: 67 +PB (polybutylene). See polybutylene (PB) PCT (percentages), 2004 V1: 15 +PCUs (platinum cobalt units), 1999 V2: 287 +PD (pressure drops or differences). See pressure drops or differences +PD (pump discharge lines), 2004 V1: 8 +PDI (Plumbing and Drainage Institute). See Plumbing and Drainage Institute (PDI) +PDI symbols for water hammer arresters, 1999 V2: 144 PE-AL-PE (polyethylene/aluminum/polyethylene), 2003 +V4: 62 +PE (polyethylene). See polyethylene (PE) PE (potential energy), 2004 V1: 2, 5 +pea gravel backfill, 2000 V3: 172 Peabody, A.W., 2004 V1: 154 +peak consumption in gas boosters, 1999 V2: 182 peak demand +flushometer valves and, 2003 V4: 8 medical air, 2000 V3: 53, 66 +Index + + +medical gas, 2000 V3: 49 medical vacuum, 2000 V3: 55 +swimming pools, 2000 V3: 127–128 urinals, 2003 V4: 10 +vacuum systems, 2000 V3: 70 penal institutions, 2003 V4: 20, 22 +pendent sprinklers, 2004 V1: 13, 29, 2000 V3: 13 penetration of irrigation water, 2000 V3: 99, 105 penetrations of walls and floors, 2000 V3: 25 people with disabilities +ambulatory-accessible toilet compartments, 2004 V1: 114 +ANSI 117.1-1998, 2004 V1: 109–123 bathing rooms, 2004 V1: 112–113 +bathtub and shower seats, 2004 V1: 122–123 bathtub design, 2004 V1: 117–119 +design for, 2004 V1: 107 +drinking fountains and water coolers, 2004 V1: 109– 112 +exposed piping and accessibility, 2004 V1: 117 fixture design standards and, 2003 V4: 2 +grab bars, 2004 V1: 114–122 +history of design and construction standards, 2004 V1: 105–106 +introduction to plumbing for, 2004 V1: 105 laundry equipment, 2004 V1: 123 lavatories and sinks, 2004 V1: 117 legislation, 2004 V1: 106–107 +references, 2004 V1: 122 +shower compartments, 2004 V1: 119–122 swimming pool bathhouses, 2000 V3: 130 swimming pools, 2000 V3: 128 +urinal design, 2004 V1: 116 +water closets and toilets, 2004 V1: 113–116, 2003 V4: 5 per-area costs, 2004 V1: 97–98 +per-fixture estimations, cost estimations, 2004 V1: 97 percentages (%, PCT), 2004 V1: 15 +perception +in creativity, 2004 V1: 231 of engineers, 2004 V1: 260 +perched water, 1999 V2: 100 perchloric acid, 1999 V2: 333–334 percolation +defined, 2004 V1: 27 +rates for soils, 1999 V2: 217–220, 238 Perfect Gas law, 2000 V3: 66 +perfect vacuums, 1999 V2: 254, 2000 V3: 200 perfluorocarbons (PFCs), 2000 V3: 22 perfluorohexane, 2000 V3: 22 +perforated piping, 1999 V2: 102 performance bonds, 2004 V1: 62 +performance criteria in specifications, 2004 V1: 69, 88 Performance of Reduced-size Venting in Residential Drain, +Waste and Vent System, 1999 V2: 65 performance specifications, 2004 V1: 66 performance tests. See testing +perimeter diking, 2000 V3: 90 permeability +coefficient of (K factor), 1999 V2: 100–101, 104–105, 242 +converting to SI units, 2004 V1: 40 permeable strata in soils, 1999 V2: 219 + +339 + + +permeance, converting to SI units, 2004 V1: 40 permits +industrial wastewater, 2000 V3:87 RCRA hazardous waste, 2000 V3: 89 +Perry’s Chemical Engineering Handbook, 2000 V3: 97 persons with disabilities. See people with disabilities pesticides in septic tanks, 1999 V2: 230 +“peta” prefix, 2004 V1: 34 +petroleum-based fuel systems. See diesel-oil systems; gasoline systems +petroleum-processing plants, 1999 V2: 147 petroleum products, 2000 V3: 154 +PEX-AL-PEX (cross-linked polyethylene/aluminum/cross-linked polyethylene), 2003 V4: 61–62 +PEX (cross-linked polyethylene), 2003 V4: 61 PFCs (perfluorocarbons), 2000 V3: 22 +PG (pressure gauges with gauge cocks), 2004 V1: 10 pH +acid wastes, 1999 V2: 334–337 adjustments in pool water, 2000 V3: 123 adjustments to waste, 1999 V2: 328 alkalinity and, 1999 V2: 283 +boiler feed water, 1999 V2: 314 control systems, 2000 V3: 123 copper piping and, 2000 V3: 145 in corrosion rates, 2004 V1: 145 defined, 2004 V1: 153 +discharge from laboratories, 2000 V3: 40 +feed water for pure water systems, 1999 V2: 322 industrial wastewater systems, 2000 V3: 91–92 limits for sanitary drainage systems, 2000 V3: 42 measuring, 1999 V2: 285, 2000 V3: 123 predicting water deposits, 1999 V2: 290 saturation, 1999 V2: 291, 293 +swimming pools, 2000 V3: 147 testing in pools, 2000 V3: 147 values in waste, 1999 V2: 329 +pH Control of Chemical Waste, 1999 V2: 350 ph, PH (phases, electrical), 2004 V1: 15 pharmaceutical facilities, 2000 V3:87 +pharmaceutical pure water, 1999 V2: 317–325, 320, 322, 2000 V3: 46 +Pharmaceutical Water, 1999 V2: 325 pharmaceutical water pipe, 2003 V4: 58 pharmacies +fixtures, 2000 V3: 35 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 52 +Phase 1 vapor recovery, 2000 V3: 154, 163, 166, 168 Phase 2 vapor recovery, 2000 V3: 154, 163, 168 phases, electrical (ph, PH), 2004 V1: 15 +PHCC-NA. See Plumbing-Heating-Cooling Contractors– National Association (PHCC-NA) +phenolics as thermoset, 2003 V4: 58 phenolphthalein alkalinity, 1999 V2: 282 Philadelphia venting system, 1999 V2: 46, 47, 48 phosphates, 2004 V1: 151, 1999 V2: 281, 282 phosphoric acid, 1999 V2: 281, 333 +phosphorus, 1999 V2: 281 phosphorus 32, 1999 V2: 340 +photographic badges for radiation levels, 1999 V2: 339 photolytic oxidation, 1999 V2: 288 +340 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +photovoltaic water heaters, 2004 V1: 265 +physical characteristics of drinking water, 1999 V2: 316, 318 +physical therapy rooms, 2000 V3: 32, 35 +physically challenged people. See people with disabilities physics laboratories, 1999 V2: 262. See also laboratories “pico” prefix, 2004 V1: 34 +piers, 1999 V2: 147 pig lead, 2003 V4: 48 +pilot-operated gas regulators, 2000 V3: 250, 251 pilot-operated makeup valves, 2000 V3: 124 +pilot-operated pressure-regulated valves, 1999 V2: 153 pilot-valve discs, 2000 V3: 9 +pints, converting to SI units, 2004 V1: 40 pipe anchors (PA), 2004 V1: 10 +pipe dope, 1999 V2: 284 pipe glue, 1999 V2: 284 pipe guides, 2004 V1: 10 +pipe hangers. See supports and hangers pipe joints +acid-waste systems, 1999 V2: 334 +chemical-waste systems, 1999 V2: 345–346 clay pipe joints, 1999 V2: 223 +copper joints, 1999 V2: 222 fill and, 1999 V2: 15 +galvanized iron joints, 1999 V2: 222 heat-fused socket joints, 1999 V2: 334 inspection, 2000 V3: 80 +liquefied petroleum gas, 1999 V2: 196 material codes and standards, 2004 V1: 43 mechanical clay pipe joints, 1999 V2: 223 natural gas systems, 2000 V3: 254 +plastic joints, 1999 V2: 222 +plastic pipe expansion joints, 1999 V2: 251 pure-water systems, 2000 V3: 47 radioactive waste systems, 1999 V2: 341 restrainers, 2000 V3: 228–229 +sanitary, 2000 V3: 48 +screwed mechanical joints, 1999 V2: 334 special-waste drainage systems, 1999 V2: 328 thermal expansion and, 1999 V2: 18 +welded joints, 1999 V2: 341 pipe nipple codes, 2004 V1: 43 pipe shafts, 2000 V3: 73 +pipe sleeves +acoustic design, 2004 V1: 201 +earthquake recommendations, 2004 V1: 162 pipe solvents, 1999 V2: 284 +pipe supports. See supports and hangers +pipe wrappings, 2004 V1: 196, 201–202, 1999 V2: 68, 196 pipes and piping. See also sizing; specific kinds of piping or +piping functions bedding, 2000 V3: 234, 235 +calculating water capacity per foot, 2000 V3: 12 cleaning and covering exposed ends, 2003 V4: 25 codes and standards, 2004 V1: 42–45 compressed air systems, 2000 V3: 206–213 +computer analysis of piping systems, 2004 V1: 186 condensate drainage, 2000 V3: 191–196 +corrosive wastes, 2000 V3: 40 cost estimation, 2004 V1: 93 damage to pipes, 2003 V4: 25 + +defined, 2000 V3: 85 draining, 2003 V4: 25 +exposed piping on storage tanks, 2000 V3: 165 fire-protection systems, 2000 V3: 8, 23, 24 +fountain display and filter systems, 2000 V3: 111–112, 116–119 +hazardous waste incompatibilities, 2000 V3: 90, 91 heat loss and, 2000 V3: 122 +high-pressure piping, 2000 V3: 196–197 installation requirements, 2003 V4: 25 laboratory waste and vent piping, 2000 V3: 42 leakage, 2004 V1: 134 +liquid fuel systems, 2000 V3:169–170 medical gas systems, 2000 V3: 73–77 monitoring leakage, 2000 V3: 162 natural gas systems, 2000 V3: 252–254 pipe schedules, 2000 V3: 16, 18 +piping symbols, 2004 V1: 7–13 +pure-water systems, 2000 V3: 47–48 seismic protection, 2004 V1: 155, 166–182 specifications, 2003 V4: 25–26 +sprinkler system pipes, 2000 V3: 12, 15, 17 steam systems, 2000 V3: 177, 195 +storm sewers, 2000 V3: 244–245, 246 sustainable design and, 2004 V1: 264 swimming pools, 2000 V3: 145 symbols (PIPE), 2004 V1: 15 tightness testing, 2000 V3: 172 +types +asbestos concrete, 2003 V4: 26 +brass (copper alloy) pipe, 1999 V2: 14, 2003 V4: 27 cast-iron soil pipe, 2003 V4: 27–31 +chlorinated polyvinyl-chloride (CPVC), 1999 V2: 284, 2000 V3: 48, 2003 V4: 59–60, 62 +concrete pipe. See concrete piping copper drainage tube, 2003 V4: 45, 46 copper pipe. See copper piping +copper water tube, 2003 V4: 34–44 +cross-linked polyethylene/aluminum/cross-linked polyethylene (PEX-AL-PEX), 2003 V4: 61–62 +cross-linked polyethylene (PEX), 2003 V4: 61–62 ductile iron water and sewer pipe. See ductile iron +piping +glass pipe, 1999 V2: 334, 341, 2003 V4: 45–50 gray cast-iron pressure pipe, 2003 V4: 32 +lead piping, 2004 V1: 266, 1999 V2: 14, 68, 122, 2003 V4: 48–49 +medical gas tubing, 2000 V3: 77, 81, 2003 V4: 45 plastic. See plastic piping +polybutylene pipes, 2003 V4: 58–60 polyethylene/aluminum/polyethylene (PE-AL-PE), +2003 V4: 62 +polyvinyl chloride (PVC), 1999 V2: 68, 284, 2000 V3: 116, 119, 145, 2003 V4: 59–60, 62 +steel pipe. See steel piping +vitrified clay piping, 1999 V2: 122, 346, 2000 V3: 245, 2003 V4: 49, 56–57 +piping-arrangement steam classifications, 2000 V3: 178– 186 +one-pipe systems, 2000 V3: 178–180 traps, 2000 V3: 182–186 +Index + + +two-pipe systems, 2000 V3: 180–182 Piping Handbook, 1999 V2: 214 +Piping Specifications and Installation Practices, 2000 V3: 97 +Piping Systems Fundamentals and Application, 1999 V2: 155 +piston reciprocating compressors, 2000 V3: 201 pit-type fire-department connections, 2004 V1: 12 pitch +defined, 2004 V1: 27 +pitch down or up, 2004 V1: 11 radioactive waste systems, 1999 V2: 342 +special-waste drainage systems, 1999 V2: 329 vacuum cleaning systems, 1999 V2: 276 +pitless adapters, 1999 V2: 243 pitot pressure, 2000 V3: 5, 7, 220 pitot tubes, 2000 V3: 4, 217, 219 pitting, defined, 2004 V1: 153 +pitting corrosion, 2004 V1: 141, 1999 V2: 290, 2000 V3: 190 +PIV (post indicator valves), 2000 V3: 228 PL (Public Laws). See Public Laws +places of worship, numbers of fixtures for, 2003 V4: 19, 22 plain air chamvers, 1999 V2: 132, 143 +plain-end steel pipe, 2003 V4: 55 plane angles, 2004 V1: 33, 36 +plans. See construction contract documents; plumbing drawings +plant noise, 2004 V1: 197–198 planting area drains, 1999 V2: 83 plantings, types of, 2000 V3: 104 plaster, lining with lead, 1999 V2: 340 plaster traps, 2000 V3: 36 +plastic filtration tanks, 2000 V3: 131 plastic fixtures +standards, 2003 V4: 2 types of, 2003 V4: 2 +plastic joints, 1999 V2: 222 plastic piping +bedding, 2000 V3: 234, 235 codes, 2004 V1: 43 +compressed air systems, 2000 V3: 210 corrosion, 1999 V2: 252 +fittings, 2003 V4: 58 +fountain piping, 2000 V3: 116 +fuel product dispensing and, 2000 V3: 169 +gas piping, 1999 V2: 176, 196, 2000 V3: 253, 254 joints, 2003 V4: 59–60 +laboratory wastes, 2000 V3: 42 Manning formula and, 2000 V3: 245 polyolefin piping, 2003 V4: 61 +sanitary drainage systems, 1999 V2: 14 storm-drainage systems, 1999 V2: 68, 89–92 thermal expansion and, 1999 V2: 251 +types, 2003 V4: 58–65 plastic pumps, 2000 V3: 115 +plastic swimming pool main drains, 2000 V3: 143 plastic valves, 2000 V3: 145–146 +plastic-wrapped steel piping, 1999 V2: 196 plastic wraps on toilet seats, 2003 V4: 5 +plate and frame modules in reverse osmosis, 1999 V2: 309, 310 + +341 + + +plate tectonics, 2004 V1: 156–158 platform diving, 2000 V3: 128 platinum, 2004 V1: 141 +platinum cobalt units (PCUs), 1999 V2: 287 Platinum-level LEED certification, 2004 V1: 263 platy soils, 1999 V2: 218 +plot plans, irrigation systems and, 1999 V2: 26 plug-type dezincification, 2004 V1: 142 +plug valves (PV), 2004 V1: 9 plumbing +appliances, 2004 V1: 27 appurtenances, 2004 V1: 27 code agencies, 2004 V1: 42 +cost estimation, 2004 V1: 93–98 defined, 2004 V1: 27 +designs, 2004 V1: 100–102 fittings. See fittings fixtures. See fixtures +plumbing systems defined, 2004 V1: 27 specifications. See specifications symbols, 2004 V1: 7–13 +terminology, 2004 V1: 17–31 Plumbing and Drainage Institute (PDI) +abbreviation for, 2004 V1: 27 address, 2004 V1: 59 +list of standards, 2004 V1: 56–57 +PDI symbols for water hammer arresters, 1999 V2: 143, 144 +Plumbing and Piping Industry Council (PPIC), 2004 V1: 170, 191 +Plumbing Design and Installation Reference Guide, 1999 V2: 114 +Plumbing Design Manual, 1999 V2: 114 plumbing drawings +abbreviations, 2004 V1: 14–16 checklists, 2004 V1: 100–102 costs analysis phase, 2004 V1: 241 defined, 2004 V1: 61 +function evaluation, 2004 V1: 239–240 functional development, 2004 V1: 254, 255 graphic conventions, 2004 V1: 108 introduction, 2004 V1: 61 +in specifications, 2004 V1: 69 +Plumbing Efficiency through Gray-water Recycling, 1999 V2: 34 +plumbing engineering, 2004 V1: 27, 2000 V3: 27–28 Plumbing-Heating-Cooling Contractors–National +Association (PHCC-NA), 2004 V1: 57, 59, 95, 1999 V2: 65 +plumbing inspectors, 2004 V1: 27 Plumbing Manual, 1999 V2: 155 Plumbing Noise, 2004 V1: 194 +Plumbing Product Efficiency Act, 2003 V4: 3, 8, 10, 11 plumbing specifications. See specifications +PNC (preferred noise criteria curves), 2004 V1: 206 pneumatic pressures, 1999 V2: 2–3, 40, 2000 V3: 68 pneumatic tank gauging, 2000 V3: 160 +pneumatic valves, 2000 V3: 119 +POC (points of connection), 2004 V1: 11 point-of-use filters, 2000 V3: 203, 210 point-of-use ultrafiltration, 1999 V2: 300 +point-of-use water heating, 2004 V1: 129, 2000 V3: 45 +342 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +points of connection (POC), 2004 V1: 11 polar solvents, 2000 V3: 21 +polarization +defined, 2004 V1: 153 +hydrogen film buildup, 2004 V1: 139 polishing deionizers, 1999 V2: 301, 302, 307 +polishing water in pure water systems, 1999 V2: 321 pollution +contamination in compressed air, 2000 V3: 201 dilution, 2000 V3:87 +dispersion from gas appliances, 1999 V2: 178 filtering air pollution, 2000 V3: 66 +priority pollutants, 2000 V3: 88 +sanitary precautions for wells, 1999 V2: 243 polyamide membranes, 1999 V2: 310, 311 polybutylene (PB), 2004 V1: 27, 2003 V4: 59–60 polyelectrolytes, 1999 V2: 294 +polyester fixtures, 2003 V4: 2 polyethylene/aluminum/polyethylene (PE-AL-PE), 2003 +V4: 62 +Polyethylene Encasement, 2003 V4: 32 +polyethylene (PE), 2004 V1: 27, 2000 V3: 254, 2003 V4: 58–61 +polyethylene piping, 1999 V2: 284 polyethylene storage tanks, 1999 V2: 323 polymer membranes, 1999 V2: 310, 311 polymeric silica, 1999 V2: 283 +polymers, 2004 V1: 27 polyolefin piping, 2003 V4: 61 polypropylene piping +laboratories, 1999 V2: 334, 2000 V3: 40 pipe characteristics, 2003 V4: 59–60 pure-water systems, 2000 V3: 48 +soil and waste piping, 1999 V2: 14 sulfuric acid and, 2000 V3: 92 USP water, 1999 V2: 324 +VOCs and, 1999 V2: 284 +polypropylene storage tanks, 1999 V2: 323, 2000 V3: 91 polysulfone membranes, 1999 V2: 310, 311 +polytropic processes, 2000 V3: 200 polyvinyl chloride (PVC) +aboveground piping, 1999 V2: 68 defined, 2004 V1: 28 +fixtures, 2003 V4: 2 +fountain piping, 2000 V3: 116, 119 noise, 1999 V2: 15 +pipe characteristics, 2003 V4: 59–60 piping, 1999 V2: 284 +pure-water systems, 2000 V3: 48 sand filtration tanks, 2000 V3: 131 sanitary drainage, 1999 V2: 14 shower pans, 2003 V4: 15 +sizing, 1999 V2: 89–92 skimmers, 2000 V3: 146 +storage tanks and hazardous wastes, 2000 V3: 91 sulfuric acid and, 2000 V3: 92 +sunlight and, 2000 V3: 116 swimming pool piping, 2000 V3: 145 types of piping, 2003 V4: 62 +volatile organic compounds, 1999 V2: 284 weirs, 2000 V3: 146 +polyvinyl-fluoridine (PVDF), 2004 V1: 28 + +polyvinylidene fluoride piping, 1999 V2: 324, 2000 V3: 48 ponding +on roofs, 1999 V2: 79 +slow-release storm-water systems, 1999 V2: 106 storm water ponds, 1999 V2: 68 +ponds, stabilization, 1999 V2: 232 +Pool/Spa Operators Handbook, 2000 V3: 125 +pools, 2004 V1: 27. See also reflecting pools; swimming pools +“poor value,” defined, 2004 V1: 213 +pop-up sprinkler heads, 2000 V3: 101, 102 porcelain enameled steel fixtures +defined, 2003 V4: 2 standards, 2003 V4: 2 +pore size in filter membranes, 1999 V2: 310 porous piping, 1999 V2: 102 +porous soils, 2000 V3: 99–100 +portable fire extinguishers, 2004 V1: 13, 2000 V3: 27 portable vacuum systems, 2000 V3: 144 +positive attachments, defined, 2004 V1: 191 +positive-displacement air compressors, 2000 V3: 65, 201 positive-displacement water meters, 1999 V2: 115 positive pressure, backflow and, 1999 V2: 144 +post indicator valves (PIV), 2000 V3: 228 pot and pan sinks, 2000 V3: 36 +potable water. See drinking water; private water systems; wells +potash alum, 1999 V2: 294 potassium, 1999 V2: 281, 283 potassium bicarbonate, 1999 V2: 283 +potassium carbonate, 1999 V2: 283, 2000 V3: 207 potassium chloride, 1999 V2: 283 +potassium hydroxide, 1999 V2: 230 potassium permanganate, 1999 V2: 245 potential energy (PE) +calculating, 2004 V1: 2 velocity head and, 2004 V1: 5 +potentiometric surfaces of aquifers, 1999 V2: 241 POTW (Publicly Owned Treatment Works), 2000 V3: 89 POU filtration, 1999 V2: 300 +pounding forces in water. See water hammer pounds (lb, LBS) +converting to SI units, 2004 V1: 40 +pounds per square foot (psf, PSF), 2004 V1: 15 +pounds per square inch (psi, PSI), 2004 V1: 2, 15, 2000 V3: 29, 180, 200 +pounds per square inch absolute (psia), 2004 V1: 15, 1999 V2: 254, 2000 V3: 85, 200 +pounds per square inch gauge (psig), 2004 V1: 15, 1999 V2: 254, 2000 V3: 68, 85, 200 +symbols for, 2004 V1: 15 power +conversion factors, 2004 V1: 36 converting to SI units, 2004 V1: 39 measurements, 2004 V1: 33 +power company off-peak power savings, 2004 V1: 128–129 power control self-regulating index, 1999 V2: 166 +power steam, 1999 V2: 298 +power usage, economizing on, 2004 V1: 128–129 Powered Industrial Trucks, 1999 V2: 214 powered vaporizers, 2000 V3: 61 +PP. See polypropylene piping +Index + + +PPIC (Plumbing and Piping Industry Council), 2004 V1: 170, 191 +ppm, PPM (parts per million), 2004 V1: 15, 1999 V2: 285, 2000 V3: 46 +Practical Design of a High-purity Water System, 1999 V2: 325 +Practical Plumbing Design Guide, 1999 V2: 114 Prandtl-Colebrook equation, 1999 V2: 60 +pre-action systems, 2004 V1: 29, 2000 V3: 13, 15, 25 pre-action valves, 2004 V1: 13 +pre-bid information, 2004 V1: 62 pre-cast concrete pipe, 2003 V4: 32 +pre-cast manholes, 2000 V3: 234, 237 pre-cast septic tanks, 1999 V2: 228 +pre-cast water storage tanks, 1999 V2: 247 pre-coat cakes in filtration, 2000 V3: 134 +pre-compressed, glass-fiber pads, 2004 V1: 204 +pre-engineered cathodically protected steel tanks, 2000 V3: 155, 156 +pre-engineered dry-chemical systems, 2000 V3: 19 pre-engineered fountains, 2000 V3: 107 +pre-fabricated roofing drains, 1999 V2: 82 pre-fabricated septic tanks, 1999 V2: 228 pre-fabricated shower bases, 2003 V4: 15 +pre-fabricated shower enclosures, 2003 V4: 15 pre-fabricated water storage tanks, 1999 V2: 247 pre-heating input water, 2004 V1: 266 +pre-manufactured skimmers, 2000 V3: 137 +pre-treatment in pure water systems, 1999 V2: 321 pre-treatment ordinances, 2000 V3: 89 +precipitates in water, 1999 V2: 245, 291 precipitation. See rainwater and precipitation precision in measurements, 2004 V1: 32 +predicting water deposits and corrosion, 1999 V2: 290–292 preferred noise criteria (PNC) curves, 2004 V1: 206 prefilters +air compressors, 2000 V3: 203 feed water, 1999 V2: 289 +prefixes in SI units, 2004 V1: 34 premium grade PVC piping, 2000 V3: 48 preparation +checklists, 2004 V1: 99 +in plumbing cost estimation, 2004 V1: 93 section in specifications, 2004 V1: 91 +in value engineering presentations, 2004 V1: 258 Preparation phase in value engineering, 2004 V1: 213 preparing for jobs, checklists, 2004 V1: 99 +PRES (pressure). See pressure +Presentation phase in value engineering, 2004 V1: 213, 257–258, 259 +President’s Committee on Employment of the Handicapped, 2004 V1: 105 +press joints, 2004 V1: 266 PRESS (pressure). See pressure +pressure (PRESS, PRES, P). See also pressure drops or differences +acoustic design for water pipes, 2004 V1: 195–196 air-consuming devices, 2000 V3: 206–207 barometric. See barometric pressure +blocked storm leaders and, 1999 V2: 86 bottled gas, 1999 V2: 174 +carbon dioxide extinguishing systems, 2000 V3: 20 + +343 + + +cold-water systems, 1999 V2: 115 compressed air, 2000 V3: 200, 203, 207 conversion factors, 2004 V1: 36 critical (CRIP), 2004 V1: 15 +discharge pressure from gas boosters, 1999 V2: 178 domestic water supply, 2000 V3: 217–221 +dynamic (velocity) (vp, VP), 2004 V1: 15 eliminating with vents, 1999 V2: 35 +fall-off pressure, 1999 V2: 122 fire pumps, 2000 V3: 25 +fixture requirements, 1999 V2: 129 flow and air, 1999 V2: 2 +fluctuation warnings, 2000 V3: 72 fountains, 2000 V3: 118 +friction head, 2004 V1: 2, 6 +friction loss and, 2004 V1: 2, 1999 V2: 130 gas boosters, 1999 V2: 178–183 +heavy flow drains, 1999 V2: 9 +hot-water system pressures, 1999 V2: 157, 166–167 hydraulic shock, 2004 V1: 6 +hydrostatic pressure, 1999 V2: 4 induced siphonage, 1999 V2: 40 +interstitial tank monitoring, 2000 V3: 161 +low-pressure switches on gas boosters, 1999 V2: 179 measurements, 2004 V1: 33, 1999 V2: 4, 253 +natural gas pressure, 1999 V2: 173, 174, 183, 2000 V3: 249, 252–253 +nitrogen surgical instruments, 2000 V3: 59 nitrous oxide, 2000 V3: 64 +nozzle pressure flow tables, 2000 V3: 4 plastic piping systems, 2000 V3: 48 +pneumatic pressures in sanitary drains, 1999 V2: 2–3 pressure-regulating valves, 1999 V2: 152–154 pressure surges, 1999 V2: 35 +pressure-volume relationships (gas laws), 1999 V2: 179 pressure waves. See water hammer +pump affinity laws, 2004 V1: 6 +relative discharge curves, 2000 V3: 220 relief valves, 1999 V2: 166–167, 167 residual pressure, 1999 V2: 123, 131 soil pressures, 2000 V3: 155 +sprinkler systems, 2000 V3: 3, 17, 18 stack flow capacity and, 1999 V2: 4 static (sp, SP), 2004 V1: 15, 16 +static pressure loss, 1999 V2: 123 storm-drainage stacks, 1999 V2: 67 submersible fuel pumps, 2000 V3: 170 +suds pressure zones, 1999 V2: 37, 38, 39 swimming pool pumps, 2000 V3: 140 symbols for, 2004 V1: 15 +tests +fountain piping systems, 2000 V3: 117 medical gas systems, 2000 V3: 80, 82 storage tanks, 2000 V3: 171 +vacuum cleaning system requirements, 1999 V2: 270 vacuum defined, 1999 V2: 253 +vacuum pressure measurement, 1999 V2: 254–256 vapor (vap pr, VAP PR, VAP), 2004 V1: 15 +velocity head (h), 2004 V1: 5 +velocity of water in pipes and, 1999 V2: 122–132 water mains, 2000 V3: 216 +water pressure, 1999 V2: 149–152 +344 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +water supply piping and, 1999 V2: 249 water vapor in air and, 2000 V3: 200–201 +pressure-assist water closets, 2004 V1: 136 +pressure-balancing fixtures. See pressure-regulating or reducing valves (PRV) +pressure diatomaceous earth filtration, 2000 V3: 132, 135, 139, 141 +pressure differentials +condensate drainage, 2000 V3: 191–193 fittings, 2004 V1: 194 +pressure-differential-actuated valve trap primers, 1999 V2: 14 +steam systems, 2000 V3: 191 +pressure drops or differences (PD, DELTP) air filtration and, 2000 V3: 207 +average pressure drops in water systems, 1999 V2: 125, 126, 127 +backflow preventers and, 2000 V3: 224 calculating, 2004 V1: 2 +compressed air systems, 2000 V3: 78, 207, 210, 211, 212 +defined, 1999 V2: 214 +double-check valves and, 2000 V3: 224 filter pumps, 2000 V3: 115 +fire hydrants and, 1999 V2: 249 fittings, 2000 V3: 221 fountains, 2000 V3: 118 +friction loss of head, 1999 V2: 118, 119, 121 fuel system checklist, 2000 V3: 171 +gas boosters, 1999 V2: 182 +gas line filters and, 2000 V3: 250 gas meters and, 1999 V2: 176 installing taps, 2000 V3: 221 +liquefied petroleum gas storage, 1999 V2: 194 medical air, 2000 V3: 74 +medical gas, 2000 V3: 73 +natural gas systems, 1999 V2: 174, 183, 192, 193 piping runs, 2000 V3: 221 +sanitary drainage, 1999 V2: 2 sizing vacuum piping, 1999 V2: 263 +sprinkler hydraulic calculations, 2000 V3: 18 static pressure loss, 1999 V2: 123 +strainers and, 2000 V3: 224 swimming pool pumps, 2000 V3: 140 symbols for, 2004 V1: 15 +vacuum cleaning systems, 1999 V2: 272–274, 274 vacuum exhauster sizing, 1999 V2: 274 +vacuum pressures, 1999 V2: 258, 263 valves, 2000 V3: 221 +water meters, 2000 V3: 224 +pressure-equalizing lines in sovent systems, 1999 V2: 60 pressure gauges +with gauge cocks (PG), 2004 V1: 10 measurements, 1999 V2: 254 swimming pools, 2000 V3: 140, 144 +pressure loss. See pressure drops +pressure maintenance (jockey) pumps, 2004 V1: 24 pressure media filters, 1999 V2: 300 +pressure piping +asbestos concrete, 2003 V4: 26 glass pipe, 2003 V4: 45 +pressure-powered pumps, 2000 V3: 188 + +pressure product-dispensing systems, 2000 V3: 163–164 pressure-regulating or reducing valves (PRV) +acoustic design and pressure, 2004 V1: 200 fountains, 2000 V3: 119, 120 +glossary, 1999 V2: 152–154 +health-care water supplies, 2000 V3: 44 irrigation systems, 2000 V3: 103 shower valves, 2003 V4: 15 +steam systems, 2000 V3: 191, 195 symbols for, 2004 V1: 9 +tub valves, 2003 V4: 16 types of, 1999 V2: 153–154 +pressure regulators +cold-water systems, 1999 V2: 122 compressed air systems, 2000 V3: 207 deluge valves, 2000 V3: 14, 15 flushometer tanks, 2003 V4: 8 +gas train vents, 1999 V2: 177 +natural gas systems, 1999 V2: 174, 214, 2000 V3: 250–252 +outlet pressure protection in gas boosters, 1999 V2: 183 +water storage tanks, 1999 V2: 248–249 pressure-relief lines in sovent systems, 1999 V2: 61 pressure-relief outlets in deaerators, 1999 V2: 56 pressure-relief valves (RV), 2004 V1: 10 +pressure sand filters, 2000 V3: 112, 113, 132–133, 134, 139 Pressure Sewer Demonstration at the Borough of +Phoenixville, Pennsylvania, 1999 V2: 238 pressure sewers, 1999 V2: 226 +pressure surges, 1999 V2: 35 +pressure swing air dryers, 2000 V3: 207 +pressure switches (PS), 2004 V1: 10, 2000 V3: 121 pressure tanks, 2000 V3: 153 +pressure vacuum breakers, 1999 V2: 145, 148 +pressure-volume relationships (gas laws), 1999 V2: 179 pressure water filters, 1999 V2: 244 +pressure waves. See water hammer +pressurized fuel delivery systems, 2000 V3: 162, 170 pressurized steam return lines, 2000 V3: 196 +pri, PRI (primary), 2004 V1: 15 +prices, 2004 V1: 222. See also costs and economic concerns PRIM (primary), 2004 V1: 15 +primary (pri, PRI, PRIM), 2004 V1: 15 +primary barriers for infectious wastes, 1999 V2: 343 primary tanks +aboveground types, 2000 V3: 165, 167 construction, 2000 V3: 156 +interstitial monitoring, 2000 V3: 160–161 underground tanks, 2000 V3: 155 +prime costs, 2004 V1: 222 primers, 2004 V1: 147 +priming in dry-pipe systems, 2000 V3: 12 priority pollutants, 2000 V3: 88 +prism-like soils, 1999 V2: 218 +prisons, numbers of fixtures for, 2003 V4: 20, 22 privacy, urinals and, 2003 V4: 9, 10 +private sewage-disposal systems +aerobic wastewater treatment plants, 1999 V2: 232– 233 +collection and treatment alternatives, 1999 V2: 226– 227 +Index + + +defined, 2004 V1: 27 distribution boxes, 1999 V2: 231 +estimating sewage quantities, 1999 V2: 233–238 inspection, 1999 V2: 238 +introduction, 1999 V2: 217 +large systems, 1999 V2: 231–232 +primary collection and treatment systems, 1999 V2: 217 +private sewers, 2004 V1: 27 septic tanks, 1999 V2: 227–231 +soil-absorption systems, 1999 V2: 217–224 private use +defined, 2004 V1: 27 lavatories, 2003 V4: 10 +private water systems +drinking water demand, 1999 V2: 243–244 initial operation and maintenance, 1999 V2: 252 introduction, 1999 V2: 239–240 +matching water storage to pump flow, 1999 V2: 248 pipe installation, 1999 V2: 250–252 +sources of supply, 1999 V2: 239–240 system equipment, 1999 V2: 245–250 water quality, 1999 V2: 244–245 wells, 1999 V2: 240–243 +problems +in condensate drainage, 2000 V3: 189–191 in seismic protection, 2004 V1: 188–191, 189 +Proceedings of the Third National Conference on Individual On Site Wastewater Systems, 1999 V2: 238 +process steam systems, 2000 V3: 175 +Procurement and Contracting Requirements Group, 2004 V1: 65, 77 +producer costs, 2004 V1: 222 producers (vacuum) +defined, 1999 V2: 266–269, 268 locating, 1999 V2: 270 +sizing, 1999 V2: 272, 274–275 product costs, 2004 V1: 222, 223 product dispensing systems +aboveground tank systems, 2000 V3:168 underground tank systems, 2000 V3: 163–165 +dispenser pans, 2000 V3: 165 pressure dispensing, 2000 V3: 164 product dispensers, 2000 V3: 164–165 +product level gauging, 2000 V3: 167, 168 product standards, 2004 V1: 66 +product substitutions, 2004 V1: 68 product water. See treated water +production wells in geothermal energy, 2004 V1: 131 productivity rates, in cost estimation, 2004 V1: 95–97 products +costs, 2004 V1: 222, 223 +detail/product/material specification checklist, 2004 V1: 220 +green building, 2004 V1: 264–265 +section in specifications, 2004 V1: 69, 90–91 in specifications, 2004 V1: 70 +value engineering questions, 2004 V1: 213–214 + +345 + + +Professional Qualifications Standard for Medical Gas Systems Installers, Inspectors, Verifiers, +Maintenance Personnel and Instructors, 2003 V4: 45 +profit markup in cost determinations, 2004 V1: 222 programmers, irrigation systems, 2000 V3: 105 +project conditions section in specifications, 2004 V1: 70, 90 project costs, 2004 V1: 222 +project manuals +contents of, 2004 V1: 62–63 defined, 2004 V1: 61 +promenade drains, 1999 V2: 83 propagation velocity, 2004 V1: 6 +propane, 1999 V2: 194, 214. See also fuel-gas piping systems +propeller water meters, 1999 V2: 116 +property protection in fire protection, 2000 V3: 1 prophylactic additives to water, 1999 V2: 245 proportions of septic tanks, 1999 V2: 228 proprietary names in specifications, 2004 V1: 66, 67 proprietary specifications, 2004 V1: 67–68 protected end of galvanic series, 2004 V1: 141 protecting storage tanks, 2000 V3:169 +protection +section in specifications, 2004 V1: 92 +value engineering contract document clauses, 2004 V1: 258, 260 +protective coatings, 2004 V1: 147. See also coated metal protective potential, defined, 2004 V1: 153 +protein-mixed chemical concentrates, 2000 V3: 21 PRV (pressure-regulating or reducing valves). See +pressure-regulating or reducing valves prying actions in seismic protection, 2004 V1: 188 PS (pressure switches), 2004 V1: 10 +pseudo-dynamic elastic analysis, 2004 V1: 161 Pseudo Value Engineers, 2004 V1: 258 +psf, PSF (pounds per square foot) +psf absolute (psfa, PSFA), 2004 V1: 15, 1999 V2: 254 psf gage (psfg, PSFG), 2004 V1: 15, 1999 V2: 254 symbols for, 2004 V1: 15 +psfa, PSFA (psf absolute), 2004 V1: 15, 1999 V2: 254 psfg, PSFG (psf gage), 2004 V1: 15, 1999 V2: 254 psi, PSI (pounds per square inch) +cast iron radiators, 2000 V3: 180 converting to metric units, 2000 V3: 29 measurements, 2000 V3: 200 +psi absolute (psia, PSIA), 2004 V1: 15, 1999 V2: 254, 2000 V3: 85, 200 +psi gage (psig, PSIG), 2004 V1: 15, 1999 V2: 254, 2000 V3: 68, 85, 200 +symbols for, 2004 V1: 15 +psia, PSIA (psi absolute), 2004 V1: 15, 1999 V2: 254, 2000 V3: 85, 200 +psig, PSIG (psi gage), 2004 V1: 15, 1999 V2: 254, 2000 V3: 68, 85, 200 +public, educating on gray-water systems, 1999 V2: 33 public areas +estimating sewage quantities, 1999 V2: 236 fixtures for, 2000 V3: 33–34 +heel-proof grates, 1999 V2: 10 sediment buckets, 1999 V2: 12 +Public Building Service, 2004 V1: 199 +346 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +public facilities, numbers of fixtures for, 2003 V4: 21 public hydrants, 2004 V1: 12 +Public Law 90-480, 2004 V1: 106 Public Law 93-112, 2004 V1: 106 Public Law 98, 2000 V3: 154 Public Law 616, 2000 V3: 154 public sewers +availability of, 2000 V3: 234 defined, 2004 V1: 27 discharging into, 1999 V2: 328 +neutralizing acid wastes for, 1999 V2: 334–337 +public storm sewer systems, 1999 V2: 67, 98, 105, 2000 V3: 245–247 +radioactive waste systems and, 1999 V2: 342 public swimming pools. See swimming pools public use +defined, 2004 V1: 28 lavatories, 2003 V4: 10 +Publicly Owned Treatment Works (POTW), 2000 V3: 89 pubs, 2003 V4: 19, 22 +puddle flanges, 2000 V3: 116 +pull-out spray accessories, 2003 V4: 12, 14 pulsation +air compressors, 2000 V3: 212 electric fans, 2004 V1: 196 +magnetic field pulsation, 2004 V1: 196 pump discharge lines (PD), 2004 V1: 8 pump heads, 1999 V2: 105 +pumped sewage-disposal systems, 1999 V2: 226 pumper connections, 2004 V1: 12 +pumping +septic tanks, 1999 V2: 227, 230 wells, 1999 V2: 241–243 +pumping head, 1999 V2: 245 pumps +acoustics, 2004 V1: 196–197, 196–198, 198, 200–201 automatic shutdown, 2000 V3: 90 +bases, 1999 V2: 243, 245 bearings, 2004 V1: 197 +boiler feed pumps, 2000 V3: 188–189 cavitation, 2000 V3: 112 +circulating pump efficiency, 2004 V1: 265 condensate transfer pumps, 2000 V3: 188 design of, 2004 V1: 200 +earthquake protection, 2004 V1: 164 efficiency, 2004 V1: 6–7 +ejector pumps, 2000 V3: 236 fire pumps, 2000 V3: 25–26 +fountains, 2000 V3: 108, 112, 120, 125 geothermal energy systems, 2004 V1: 131 gravity tank systems, 1999 V2: 150–152 gray water use, 2004 V1: 267 hydropneumatic-tank systems, 1999 V2: 150 impellers, 2004 V1: 197 +liquid fuel systems, 2000 V3:170 +liquid-waste decontamination systems, 1999 V2: 344 matching water storage to pump flow, 1999 V2: 248 plant noise, 2004 V1: 197–198 +pulsation in, 2004 V1: 197 pump affinity laws, 2004 V1: 6 pump journals, 2004 V1: 196 pump speeds, 2004 V1: 200–201 + +pump suction, 1999 V2: 249 +secondary containment areas, 2000 V3: 90 starter controls, 2000 V3: 120 +static deflection for vibration, 2004 V1: 205 strainers and suction screens, 2000 V3: 116 +submersible, 1999 V2: 243, 2000 V3:170, 2000 V3: 170 sulfuric acid and, 1999 V2: 332 +sump pumps in sanitary drainage systems, 1999 V2: 9 swimming pools, 2000 V3: 129, 139, 140–142, 145–146 systems for water supplies, 1999 V2: 245–247 +vacuum pumps, 2000 V3: 189 vibration isolation, 2004 V1: 205, 206 well pumps, 1999 V2: 245–247 +Pumps and Pump Systems, 2004 V1: 40 +Pumps and Pump Systems Handbook, 1999 V2: 152 purchasers in cost equation, 2004 V1: 223 +pure tones, 2004 V1: 208 +pure-water systems. See also water purification defined, 1999 V2: 279 +health-care facilities, 2000 V3: 43, 46–48 piping materials, 2000 V3: 47–48 +types of pure water, 2000 V3: 46 purging +medical gas zones, 2000 V3: 72, 80, 81–82 natural gas systems, 2000 V3: 252 +purified water (PW), 1999 V2: 320, 2003 V4: 47. See also pure-water systems; water purification +purity +compressed air, 2000 V3: 207 +testing medical gas systems, 2000 V3: 82 push-on joints, 2000 V3: 228–229 +push-seal gasketed outlets, 1999 V2: 18 putrefaction, 2004 V1: 28 +Putting Industrial Vacuum to Work, 1999 V2: 277 puzzles +Nine Dots exercise, 2004 V1: 232, 261 Six Sticks exercise, 2004 V1: 232, 261 +PV (plug valves), 2004 V1: 9 +PVBs (pressure vacuum breakers), 1999 V2: 145, 148 PVC. See polyvinyl chloride (PVC) +PVDF (polyvinyl-fluoridine), 2004 V1: 28, 1999 V2: 14, 2000 V3: 48 +PVE (Pseudo Value Engineers), 2004 V1: 258 +PW (pure water), 1999 V2: 320. See also pure-water systems; water purification +pyramids, calculating volume, 2004 V1: 4 pyrogens, 1999 V2: 282, 310, 2000 V3: 46 + +Q +Q factor (coefficient of transmissibility), 1999 V2: 101–102 Q (heat transfer), 2004 V1: 15 +QAIR (air flow rates), 2004 V1: 14 QAR (air flow rates), 2004 V1: 14 QFL (fluid flow rates), 2004 V1: 14 +QGA, QGAS (gas flow rates), 2004 V1: 14, 1999 V2: 173 qt, QT (quarts), 2004 V1: 15, 40 +quads, converting to SI units, 2004 V1: 40 quality +in cost estimation, 2004 V1: 98 +quality assurance in specifications, 2004 V1: 69–70, 89 quality control section in specifications, 2004 V1: 71, +91 +Index + + +of water, 1999 V2: 33, 244–245. See also water analysis; water purification +quantities. See also demand clean gas agents, 2000 V3: 23 +in creativity checklist, 2004 V1: 234 irrigation water, 2000 V3: 99 +water supplies, 2000 V3: 3–8 +quarter-circle rotary sprinkler heads, 2000 V3: 102 quarts (qt, QT) +converting to SI units, 2004 V1: 40 symbols for, 2004 V1: 15 +questions in value engineering presentations, 2004 V1: 258 quick-coupling method of irrigation, 2000 V3: 100, 101 quick-disconnect couplings, 2000 V3: 210 +quick-opening devices, 2000 V3: 13 quick-response sprinklers, 2004 V1: 29 quick valve closure, 1999 V2: 131, 132 quieting pipes, 1999 V2: 15 + +R +R (hydraulic radii), 2004 V1: 1 +R, R- (refrigerants), 2004 V1: 15, 151 °R, R (rankines), 2004 V1: 15 +R, R (thermal resistance), 2004 V1: 16 R (radii), 2004 V1: 15 +R-13 and R-13A fire-protection systems, 2003 V4: 58 R-595 gas, 2000 V3: 22 +ra, RA (return air), 2004 V1: 15 +Rack Storage of Materials (NFPA 231C), 2000 V3: 2, 29 rad, RAD (radians). See radians +RAD (radiating or radiators), 2004 V1: 15 RAD (radiation). See radiation +rad/s (radians per second), 2004 V1: 33 +rad/s2 (radians per second squared), 2004 V1: 33 radians (RAD) +measurement unit conversions, 2004 V1: 33 radians per second, 2004 V1: 33 +radians per second squared, 2004 V1: 33 symbols for, 2004 V1: 15 +radiant heating in swimming pools, 2000 V3: 138, 146 radiating (RAD), 2004 V1: 15 +radiation (RADN, RAD) +heat loss and, 2000 V3: 121 nature of, 1999 V2: 337–338 +radiation equivalent to man (rem), 1999 V2: 339 rads (radioactive dosage), 1999 V2: 339 +symbols for, 2004 V1: 15 treatment facilities, 1999 V2: 340 +radiators (RAD), 2004 V1: 15, 2000 V3: 178, 181, 184 radicals (ions), 2004 V1: 144, 153, 1999 V2: 329 +radii (R), 2004 V1: 15 +radioactive waste drainage and vents allowable radiation levels, 1999 V2: 339 +approval process and applications, 1999 V2: 340 diluting radwaste, 1999 V2: 342 +introduction, 1999 V2: 337 +measuring radiation, 1999 V2: 338–339 nature of radiation, 1999 V2: 337–338 pipe selection, 1999 V2: 341–342 +radioactive-material-processing plants, 1999 V2: 147 radioactive materials, 1999 V2: 340 +shielding systems, 1999 V2: 339–340 + +347 + + +system design criteria, 1999 V2: 340–343 radioactivity +defined, 1999 V2: 337 +radioactive half lives, 1999 V2: 340 radioactive isotopes, 1999 V2: 337, 340 +radiological characteristics of drinking water, 1999 V2: 284, 317 +Radiological Safety Officers, 1999 V2: 340 radium 226, 1999 V2: 340 +RADN (radiation). See radiation radon gas in water, 1999 V2: 284, 317 +radwaste (waterborne radioactive waste), 1999 V2: 337 Rainbird Company, 2000 V3: 105 +rainwater and precipitation +capturing rainwater, 2004 V1: 135, 264, 267 cisterns, 1999 V2: 247 +duration, 2000 V3: 244 flow rates, 1999 V2: 68 +in gray-water systems, 1999 V2: 21 imperviousness factor, 2000 V3: 242–243 inlet times, 2000 V3: 244 +intensity-duration-frequency curves, 2000 V3: 242, 243 precipitation, 2004 V1: 27 +rainfall rates, 1999 V2: 69–78, 97, 2000 V3: 242, 243 rainwater drains (SD, ST). See storm-drainage systems return periods, 2000 V3: 243–244 +slow-release storm-water systems, 1999 V2: 106 storing in controlled flow systems, 1999 V2: 93–94 storm-drainage systems, 1999 V2: 67–68, 95–107 subsurface water and, 1999 V2: 99–105 swimming pools and, 2000 V3: 139 +raised-floor areas, 2000 V3: 23 ramp-drain grates, 1999 V2: 11 rankines (°R, R), 2004 V1: 15 +ranking functions in value engineering, 2004 V1: 243 rapid sand/direct filtration package plants, 1999 V2: 318 rate of corrosion +acidity, 2004 V1: 145 Faraday’s Law, 2004 V1: 144 film formation, 2004 V1: 145 homogeneity in, 2004 V1: 145 oxygen content, 2004 V1: 145 temperature, 2004 V1: 145 velocity in, 2004 V1: 145 +rate of flow. See flow rates +rate of temperature rise detection, 2000 V3: 13 rated vacuum levels, 1999 V2: 257–258 +ratings for portable fire extinguishers, 2000 V3: 27 Rational Method, 2004 V1: 7, 1999 V2: 95–98, 98, 107, +2000 V3: 242–244 raw sewage, 2004 V1: 28 raw water, 1999 V2: 280, 320 +RCIR (recirculate), 2004 V1: 15 +RCP (reinforced concrete pipe), 2003 V4: 32 +RCRA (Resource Conservation and Recovery Act), 1999 V2: 345, 2000 V3:87–88, 2000 V3: 89–90, 154 +rcvr, RCVR (receivers), 2004 V1: 15, 199, 1999 V2: 260, 262 +re-evaporation, 2000 V3: 197 re-flashing, 2000 V3: 20 +reaction forces in earthquakes, 2004 V1: 186 reactive silencers, 2000 V3: 202 +348 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +reactive silica, 1999 V2: 283 +reagent grade water, 1999 V2: 317, 319 real costs, 2004 V1: 223 +rear wall grab bars, 2004 V1: 114 +reasoning against value engineering, 2004 V1: 232 REC (receivers), 2004 V1: 15, 199, 1999 V2: 260, 262 receiver tanks +medical air compressors, 2000 V3: 66 vacuum systems, 2000 V3: 70 +receivers (rcvr, RCVR, REC) receivers of noise, 2004 V1: 199 symbols for, 2004 V1: 15 +in vacuum systems, 1999 V2: 260, 262 receiving costs, 2004 V1: 223 +receptors, 2004 V1: 28 +recessed-box hose bibbs, 2004 V1: 10 recessed sprinklers, 2004 V1: 29 recharge basins, 2000 V3: 247 +rechargeable air chambers, 1999 V2: 132, 143 recharging aquifers, 1999 V2: 240 +reciprocating air compressors, 2000 V3: 65, 66, 201, 205 reciprocating (rotary) piston pumps, 1999 V2: 259 recirculate (recirc., RECIRC, RCIR, RECIR), 2004 V1: 15 recirculating hot-water systems, 2004 V1: 265 recirculating sand filter sewage systems, 1999 V2: 227, 232 recirculation rates +gutters and, 2000 V3: 142 swimming pools, 2000 V3: 140 +recirculation systems +for high purity water, 2000 V3: 47 for hot water, 1999 V2: 165 +reclaimed water. See gray-water systems Recommendation phase in value engineering, 2004 V1: +213 +pre-recommendation questions, 2004 V1: 254–257 Recommendations for a New ADAAG, 2004 V1: 123 Recommended Minimum Requirements for Plumbing in +Dwellings and Similar Buildings, 1999 V2: 65 Recommended Practice for Handling Releases of +Flammable and Combustible Liquids and Gases (NFPA 329), 2000 V3: 154 +recovered energy, 2004 V1: 137 +recovering heat from water heaters, 1999 V2: 158–159 recovery in reverse osmosis, 1999 V2: 309 +recovery rooms fixtures, 2000 V3: 36 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 52, 58 medical vacuum, 2000 V3: 54 +recreational establishments +estimating sewage quantities, 1999 V2: 235, 237 septic tank/soil-absorption systems for, 1999 V2: +231–232 recreational pools, 2000 V3: 128 +rectangles, calculating area, 2004 V1: 3 rectangular bath seats, 2004 V1: 122 rectangular gutters, 1999 V2: 81, 86 rectangular leaders, 1999 V2: 81 +rectangular solids, calculating volume, 2004 V1: 4 rectifiers, 2004 V1: 150, 151 +recycled water in landscaping, 2004 V1: 264 recycled water systems. See gray-water systems + +red brass, 2004 V1: 144 +red brass piping, 1999 V2: 14, 2003 V4: 27 red water in pools, 2000 V3: 147 +reduced noise transmission, 1999 V2: 15 reduced pressure +conditions in water storage tanks, 1999 V2: 248 in pressure-regulated valves, 1999 V2: 152 +reduced-pressure backflow preventers, 1999 V2: 115, 144, 145, 148, 149 +reduced pressure zones (RPZ), 2000 V3: 223, 226 reduced pressure zones (RPZ), 2000 V3: 223, 226 reduced-size venting +confluent vent sizing, 1999 V2: 51 example, 1999 V2: 53, 54 installation, 1999 V2: 52 introduction, 1999 V2: 49 +reduced size vents, defined, 2004 V1: 28 sizing, 1999 V2: 50–53 +Reduced-size Venting Design, 1999 V2: 65 reduced water-flow rates, 2004 V1: 126–127 +reduced zone backflow preventers (RZBP), 2004 V1: 10 reducers, defined, 2004 V1: 28 +redundancy +fountain pumps, 2000 V3: 115 hazardous waste systems, 2000 V3: 90 +reference standard specifications, 2004 V1: 66–67 references +cold water systems, 1999 V2: 155 compressed air systems, 2000 V3: 214 conserving energy, 2004 V1: 137 +designing for people with disabilities, 2004 V1: 123 fire-protection systems, 2000 V3: 29 +formulae, symbols, and terminology, 2004 V1: 40 gasoline and diesel-oil systems, 2000 V3:173 gray-water systems, 1999 V2: 34 +health-care facilities, 2000 V3: 86 irrigation systems, 2000 V3: 105 +reflecting pools and fountains, 2000 V3: 125–126 sanitary drainage systems, 1999 V2: 19 +seismic protection, 2004 V1: 191 +special-waste drainage systems, 1999 V2: 350 steam and condensate systems, 2000 V3: 197 swimming pools, 2000 V3: 151 +vacuum systems, 1999 V2: 277 vents, 1999 V2: 65 +water treatment and purification, 1999 V2: 325 references section in specifications, 2004 V1: 69, 88 reflecting pools +controls, 2000 V3: 120–121 defined, 2004 V1: 28 design, 2000 V3: 107–111 +discharge devices, 2000 V3: 119–120 displays, 2000 V3: 108–110, 111, 113–115 +filtration systems, 2000 V3: 112–113, 115–116 flow rates, 2000 V3: 108–110 +inlets, outlets, and devices, 2000 V3: 110–111 lighting, 2000 V3: 112, 121 +makeup-water systems, 2000 V3: 112, 124–125 multilevel pools, 2000 V3: 108 +overflow and drainage, 2000 V3: 112, 125 overview, 2000 V3: 107 +piping and valves, 2000 V3: 111–112, 116–119 +Index + + +pumps, 2000 V3: 113–116 references, 2000 V3: 125–126 +systems and components, 2000 V3: 111–112 valves, 2000 V3: 118–119 +water-heating system, 2000 V3: 112, 121–122 water-treatment systems, 2000 V3: 112, 122–124 +reformatories, numbers of fixtures for, 2003 V4: 20 refrigerant after-coolers, 2000 V3: 203 refrigerants (R, R-), 2004 V1: 15, 151 +refrigerated air dryers, 2000 V3: 204, 207 refrigeration mechanical rooms, 2004 V1: 166 refrigeration piping, 2003 V4: 34, 36 refrigeration systems +heat reclamation, 2004 V1: 131 waste heat usage, 2004 V1: 131, 132 +refuse bins, 2004 V1: 196 +refuse disposal installations, soundproofing, 2004 V1: 196 regenerable ion exchange, 1999 V2: 301 +regenerants, dealkalizing and, 1999 V2: 295 regeneration cycle +in dealkalizing, 1999 V2: 295 +in deionizing, 1999 V2: 302, 304 in demineralizers, 2000 V3: 46 in ion exchange, 1999 V2: 305 in water softeners, 1999 V2: 307 +regional authorities, 1999 V2: 327 registers in fuel dispensers, 2000 V3: 165 regulated substances, 2000 V3: 153 regulations. See codes and standards regulators. See specific types of regulators +Rehabilitation Act of 1973 (93-112), 2004 V1: 106 reinforced concrete pipe (RCP), 2003 V4: 32 reinforcing ribs in tanks, 2000 V3: 155 +reject stream from reverse osmosis, 1999 V2: 309 relative discharge curves, 2000 V3: 220 +relative humidity (rh, RH), 2004 V1: 15, 2000 V3: 200, 201 Relative Importance of Time and Surface Temperature in +the Causation of Cutaneous Burns, 1999 V2: 170 relay interface controls, 2000 V3: 73 +reliability of water supplies, 2000 V3: 3, 8 relief valves +fire pumps, 2000 V3: 25 +gas regulators, 2000 V3: 251 +hot-water systems, 1999 V2: 166–167 liquefied petroleum gas, 1999 V2: 197 sizing, 1999 V2: 167 +water storage tanks, 1999 V2: 248 relief vents +circuit and loop venting, 1999 V2: 43 defined, 2004 V1: 28, 1999 V2: 64 gas trains, 2000 V3: 251 +soil and waste stacks, 1999 V2: 44, 45 sovent systems, 1999 V2: 61 +remote-control fountain controls, 2000 V3: 120 remote-control irrigation valves, 2000 V3: 103 remote-control pool panels, 2000 V3: 111 remote earth (remote electrodes), 2004 V1: 153 remote electrodes, 2004 V1: 153 +remote fill ports, 2000 V3: 156, 167 +remote leakage from tanks, 2000 V3: 162–163 remote portions of fire design areas, 2000 V3: 16 remote-readout water meters, 1999 V2: 116 + +349 + + +remote secondary-containment enclosures, 2000 V3: 167 Remove Organics by Activated Carbon Adsorption, 1999 +V2: 325 +rems (radiation equivalent to man), 1999 V2: 339 renovations, cost estimating and, 2004 V1: 98 repetition in value engineering presentations, 2004 V1: +258 +replacements for Halon gases, 2000 V3: 22 +Report on Hydraulics and Pneumatics of Plumbing Drainage Systems, 1999 V2: 19 +required costs, 2004 V1: 223 +res, RES (resistance or resistors), 2004 V1: 16 research facilities, radiation in, 1999 V2: 340 reserves (connected standbys), 2000 V3: 23 reservoirs +municipal, 2000 V3: 8 private, 1999 V2: 239 +residential care facilities, numbers of fixtures for, 2003 V4: 20 +residential kitchen sinks faucets, 2003 V4: 13 +types and requirements, 2003 V4: 11–12 residential systems +cold-water systems, 1999 V2: 115–116, 154–155 estimating sewage quantities, 1999 V2: 233 firefighting demand flow rates, 2000 V3: 232 fixture drainage loads, 1999 V2: 3 +hot-water systems. See hot-water systems irrigation, 2000 V3: 100 +lavatory flow rates, 2003 V4: 10 liquefied petroleum gas, 1999 V2: 194 +natural gas appliance demand, 1999 V2: 175 numbers of fixtures, 2003 V4: 20 +pool filters, 2000 V3: 112 +reduced-size venting, 1999 V2: 50 +sewage-disposal systems. See private sewage-disposal systems +sprinklers, 2004 V1: 30, 2000 V3: 2 +typical gray-water supply and demand, 1999 V2: 25 water supply. See domestic water supply +residual pressure +defined, 2004 V1: 28, 1999 V2: 123 +determining available pressure and, 1999 V2: 131 domestic water supply, 2000 V3: 217–221 +fire hydrants, 2000 V3: 4, 8 +sprinkler hydraulic calculations, 2000 V3: 16 residual radiation, 1999 V2: 341 +resilient mounts illustrated, 2004 V1: 207 +noise and vibration control, 2004 V1: 199, 205 pipe run installations, 2004 V1: 209 +seismic danger and, 2004 V1: 206 resilient pipe supports, 2004 V1: 199, 206 resin beads, 1999 V2: 304–305 +resins, ion-exchange +continuous deionization, 1999 V2: 306 defined, 1999 V2: 300 +in diluting compartments, 1999 V2: 307 overview, 1999 V2: 301–302 regenerating, 1999 V2: 304 +strong-acid and weak-acid, 1999 V2: 302 volatile organic compounds in, 1999 V2: 284 +350 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +resistance ratings (fire loads), 2000 V3: 2–3 resistance (res, RES, OHMS), 2004 V1: 15 resistivity +defined, 2004 V1: 154 soil, 2004 V1: 150 +resistors (res, RES, OHMS), 2004 V1: 15 “resonant” air compression systems, 2000 V3: 212 resource conservation, 2004 V1: 124 +Resource Conservation and Recovery Act, 2004 V1: 124, 1999 V2: 345, 2000 V3:87–90, 2000 V3: 96, 154 +resources +gasoline and diesel-oil systems, 2000 V3:173 health-care facilities, 2000 V3: 86 +industrial wastewater treatment, 2000 V3: 97 irrigation systems, 2000 V3: 105 +respirators. See breathing apparatus +response in pressure-regulated valves, 1999 V2: 152 response spectrum in earthquakes, 2004 V1: 160–161, 186 restaurants, 1999 V2: 231–232, 2003 V4: 19, 22. See also +food-processing areas and kitchens restrained-spring mountings, 2004 V1: 204 restraint systems +for earthquakes, 2004 V1: 166, 189 for fire-protection joints, 2000 V3: 229 +restricted areas (facilities with radiation), 1999 V2: 339 restrooms. See water-closet compartments; water closets retail stores, numbers of fixtures for, 2003 V4: 20 +retard chambers, 2000 V3: 9 retention basins, 2000 V3: 247 +retirement costs, in labor costs, 2004 V1: 94 retractable ceiling medical gas columns, 2000 V3: 58 return air (ra, RA), 2004 V1: 15 +return circuits, 2004 V1: 139 return offsets, 2004 V1: 28 +return periods in rainfall, 1999 V2: 69–78, 2000 V3: 243–244 +returns +condensate returns, 2000 V3: 186–189 fountain filtration, 2000 V3: 115, 117 +parallel flow piping designs, 2000 V3: 178–179 return lines, 2000 V3: 195, 196 +returning water to pools, 2000 V3: 119–120 swimming pools, 2000 V3: 143–144 +reusing water. See gray-water systems rev, REV (revolutions), 2004 V1: 15 +revent pipes, 2004 V1: 28. See also individual vents reverse osmosis +cartridges, 1999 V2: 289 +continuous deionization and, 1999 V2: 307 defined, 1999 V2: 308–309 +health-care facilities, 2000 V3: 47 membrane configurations, 1999 V2: 309 membrane selection, 1999 V2: 310 polymer membranes, 1999 V2: 311 silica and, 1999 V2: 283 +small drinking water systems, 1999 V2: 318 VOCs in membranes, 1999 V2: 284 +water supply (RO), 2004 V1: 8 +Reverse Osmosis and Nanofiltration System Design, 1999 V2: 325 +reverse osmosis water supply (RO), 2004 V1: 8 reverse-trap water closets, 2003 V4: 3 + +reversible potential, defined, 2004 V1: 153 revolutions (rev, REV) +revolutions per minute (rpm, RPM), 2004 V1: 15 revolutions per second (rps, RPS), 2004 V1: 16 +Reynold’s number for turbulence, 2004 V1: 2, 1999 V2: 41 rgh, RGH (roughness), 2004 V1: 16. See also roughness rh, RH (relative humidity). See relative humidity +RHO (density). See density +rhomboids, calculating area, 2004 V1: 4 rhombuses, calculating area, 2004 V1: 4 RI (Ryzner stability index), 1999 V2: 292 Richardson, D.W., Sr., 1999 V2: 325 +right-angle triangles, calculating area, 2004 V1: 4 rigid ceiling medical-gas columns, 2000 V3: 58 rigid plastic piping, 2000 V3: 169 +rim top test, 2003 V4: 6 rims +defined, 2004 V1: 28 +on urinals, 2004 V1: 116–117 rim top test, 2003 V4: 6 water closets, 2003 V4: 4–5 +ring-securing methods around drains, 1999 V2: 17 rinsing in regeneration cycle, 1999 V2: 304, 305 riser clamps, 1999 V2: 86 +riser-mounted sprinkler heads, 2000 V3: 102 risers +bracing, 2004 V1: 171, 178 checklists, 2004 V1: 102 +defined, 2004 V1: 28, 2000 V3: 85 +earthquake protection and joints, 2004 V1: 168 low-pressure steam (lps, LPS), 2000 V3: 187 riser clamps, 1999 V2: 86 +riser down (elbows), 2004 V1: 10 +riser-mounted sprinkler heads, 2000 V3: 102 riser up (elbows), 2004 V1: 10 +steam piping, 2000 V3: 182, 185 symbols for, 2004 V1: 12 +rises or drops, 2004 V1: 11 risk cabinets, 1999 V2: 344 +Risk Guides in value engineering, 2004 V1: 254, 257 riveted steel piping, 1999 V2: 122 +RO (reverse osmosis). See reverse osmosis roadblocks to creativity, 2004 V1: 231–232 roadway drainage pipes, 2003 V4: 32 +rock fill in seepage beds, 1999 V2: 224 rock guards for lights, 2000 V3: 121 rock salt, 1999 V2: 307 +Roentgens, 1999 V2: 339 +roll-in shower compartments, 2004 V1: 119–120 roll-out gutters, 2000 V3: 137 +roof drainage, 1999 V2: 79–94 +adjacent buildings and surfaces, 1999 V2: 80 avoiding septic tank disposal, 1999 V2: 231 controlled flow systems, 1999 V2: 88, 93–94 +coordination with other designers, 1999 V2: 79, 81, 84 drain locations, 1999 V2: 79–80 +drain types and components, 1999 V2: 80–81 expansion, 1999 V2: 85, 87 +Form 4-1, 1999 V2: 109 +green roof designs, 2004 V1: 266 gutters and downspouts, 1999 V2: 81 horizontal branches, 1999 V2: 88 +Index + + +insulation, 1999 V2: 85 leaders, 1999 V2: 81, 87 +limited-discharge roof drains, 2000 V3: 247 piping system design, 1999 V2: 81 +roof drain sizes, 1999 V2: 69 roof drains, defined, 2004 V1: 28 scuppers, 1999 V2: 93 +sizing pipes, 1999 V2: 85, 89–92 +storm-drainage systems and, 1999 V2: 67 roofing +design considerations in seismic protection, 2004 V1: 188 +green roofs, 2004 V1: 266–267 imperviousness factors, 2000 V3: 243 +root problems in leaching trenches, 1999 V2: 222 rope anchors in pools, 2000 V3: 145 +rotary lobe compressors, 2000 V3: 202 rotary lobe (roots) pumps, 1999 V2: 259 rotary piston pumps, 1999 V2: 259 +rotary pop-up sprinkler heads, 2000 V3: 102 rotary screw air compressors, 2000 V3: 65, 66, 202 rotary vane, once-through-oil pumps, 1999 V2: 259 rotating filters, 2000 V3: 95 +rotors +in gas boosters, 1999 V2: 179 in pump engines, 2004 V1: 197 +rough-ins +checklist, 2004 V1: 103 +roughing in, defined, 2004 V1: 28 water closets, 2003 V4: 4 +rough vacuum, 1999 V2: 253 roughness (rgh, RGH, E), 2004 V1: 16 roughness of pipes +factors in, 1999 V2: 88 +fairly rough pipe, 1999 V2: 141 fairly smooth pipe, 1999 V2: 140 +galvanized fairly rough pipe, 1999 V2: 136 rough pipe, 1999 V2: 142 +smooth pipe, 1999 V2: 139 turbulence and, 1999 V2: 41 types of pipes and, 1999 V2: 122 +round bowls on water closets, 2003 V4: 4 round leaders, 1999 V2: 81 +rounded-edge weirs, 2000 V3: 109 routing hot-water pipes, 2004 V1: 265 +RPBDs (reduced-pressure backflow preventers) +as cross-connection control devices, 1999 V2: 144 at building meters, 1999 V2: 115 +degrees of protection, 1999 V2: 145 flow rates, 1999 V2: 148 installation, 1999 V2: 148–149 +rpm, RPM (revolutions per minute), 2004 V1: 15 rps, RPS (revolutions per second), 2004 V1: 16 RPZ (reduced pressure zones), 2000 V3: 223, 226 RSOs (Radiological Safety Officers), 1999 V2: 340 rubber compression gaskets, 2003 V4: 27 +rubber facing in dry-pipe clappers, 2000 V3: 11 Rubber-Gasket Joints, 2003 V4: 32 +rubber gaskets, 2003 V4: 32 +rubber-in-shear isolators, 2004 V1: 166 rubber isolation devices +concrete bases and, 2004 V1: 204–205 + +351 + + +defined, 2004 V1: 204 dishwashers, 2004 V1: 195 +reducing water hammer, 2004 V1: 198 vibration control, 2004 V1: 203 +rubble drains (french drains), 2004 V1: 25 +rule-of-thumb tank capacity equation, 1999 V2: 151 rules in Function Analysis, 2004 V1: 225 +running traps, 2000 V3: 42 runoff +calculation sheet, 1999 V2: 111 +coefficients in site storm drains, 1999 V2: 95 diversion ditches for leaching trenches, 1999 V2: 223 imperviousness factor, 2000 V3: 242–243 +rational method and, 2000 V3: 242 +Rational method for calculating, 2004 V1: 7, 1999 V2: 95, 98, 107 +slow-release storm-water systems, 1999 V2: 106 weighted runoff coefficients, 1999 V2: 97 +runouts in steam piping, 2000 V3: 182 runways, piping underneath, 1999 V2: 250 rust +formation in iron pipes, 2004 V1: 139 in pools, 2000 V3: 147 +rusting, defined, 2004 V1: 154 +RV (pressure-relief valves). See pressure-regulating or reducing valves +Ryzner stability index (RI), 1999 V2: 292 +RZBP (reduced zone backflow preventers), 2004 V1: 10 + +S +S (entropy), 2004 V1: 14, 33 +s, SEC (seconds), 2004 V1: 16, 33 S (siemens), 2004 V1: 33 +S (soil sewers), 2004 V1: 8 S (surfaces), 2004 V1: 16 +s traps (unvented traps), 1999 V2: 46, 2000 V3: 42 sa, SA (supply air), 2004 V1: 16 +sacrificial anodes, 2004 V1: 147 saddles for tanks, 2000 V3: 172 +Safe Drinking Water Act of 1974, 1999 V2: 244, 279, 316 Safe Handling of Acids, 1999 V2: 350 +safety. See also hazards condensation loads, 2000 V3: 194 +controlled substance spills, 1999 V2: 277 flammable and volatile liquids, 1999 V2: 347–349 gas appliances, 1999 V2: 178 +gas boosters, 1999 V2: 179 +gases in septic tanks, 1999 V2: 230 +hot-water systems, 1999 V2: 157, 169–170 life safety +in fire protection, 2000 V3: 1 +residential sprinkler systems, 2000 V3: 2 liquefied petroleum gas, 1999 V2: 194, 197 radioactive waste-drainage systems, 1999 V2: 341 Radiological Safety Officers, 1999 V2: 340 reflecting pools and, 2000 V3: 107 +safety factors (sf, SF), 2004 V1: 16 +sanitary precautions for wells, 1999 V2: 243 types of acids, 1999 V2: 332–334 +vacuum cleaning system issues, 1999 V2: 276 safety cabinets, 1999 V2: 344 +safety shut-off devices, 1999 V2: 214 +352 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +sales tax, in plumbing cost estimation, 2004 V1: 94 salesmanship in value engineering, 2004 V1: 257 salt-air dryers, 2000 V3: 207 +salt splitting, 1999 V2: 295 salts +disinfecting water with, 2000 V3: 150 ions in reverse osmosis, 1999 V2: 280 in irrigation water, 2000 V3: 99 +saltwater pools, 2000 V3: 147 samples +acid wastes, 2000 V3: 41–42 +infectious waste systems, 1999 V2: 345 pure water systems, 1999 V2: 324 radioactive waste effluent, 1999 V2: 342 +sampling manholes, 2000 V3: 41–42, 44 +San Diego Gas & Electric Company, 2004 V1: 137 San Francisco Earthquake, 2004 V1: 162 +SAN (sanitary sewers), 2004 V1: 8, 28. See also sanitary drainage systems +sand filtration +aluminum sulfate, 2000 V3: 149–150 cleaning, 2000 V3: 150 +compared to diatomaceous earth, 2000 V3: 135–137 drinking water, 1999 V2: 244, 318 +earthquake damage to filters, 2004 V1: 162 fountains, 2000 V3: 112 +gravity and pressure systems, 2000 V3: 132 high-rate pressure filters, 2000 V3: 113 laboratory water, 1999 V2: 300 +pressure sand filters, 2000 V3: 132–133, 134 pumps and, 2000 V3: 140 +pure water systems, 1999 V2: 322–323 sand filters defined, 2004 V1: 28 sewage treatment, 1999 V2: 227, 232 swimming pools, 2000 V3: 130 +tanks, 2000 V3: 131 types of, 2000 V3: 139 +sand points, 1999 V2: 241 sand traps, 2000 V3: 113 sands +backfilling around water system pipes, 1999 V2: 250 fill above subsurface drainage pipes, 1999 V2: 103 gray-water irrigation systems and, 1999 V2: 26, 27 imperviousness factors, 2000 V3: 243 +porous soils, 2000 V3: 99–100, 105 in soil texture, 1999 V2: 218 +sanitary building drains. See also sanitary drainage systems +cast-iron soil pipe, 2003 V4: 27 defined, 2004 V1: 20 +sanitary drainage fitting codes, 2004 V1: 44 sanitary drainage systems, 2000 V3: 232–240 +alternative disposal methods, 2000 V3: 240 +building sewers (house drains), 1999 V2: 15, 2003 V4: 27 +components, 1999 V2: 9–14, 2000 V3: 234–236 connections, 2000 V3: 234, 236 +defined, 1999 V2: 1 drainage loads, 1999 V2: 3 +drainage structures, 2000 V3: 234–236 fittings, 2004 V1: 44 +fixture discharge characteristics, 1999 V2: 3 + +floor leveling around drains, 1999 V2: 17 flow in, 1999 V2: 1–2 +force mains, 2000 V3: 236–240 connections, 2000 V3: 239 sizing, 2000 V3: 236 +sizing ejector pumps and pits, 2000 V3: 236 gray-water systems and, 1999 V2: 22 +health-care facilities, 2000 V3: 39–42 joining methods, 1999 V2: 17–18 kitchen areas, 1999 V2: 16–17 laboratories +acid-waste metering, 2000 V3: 41–42 +acid-waste neutralization, 2000 V3: 40–41 acid-waste solids interceptors, 2000 V3: 41, 43 discharge to sewers, 2000 V3: 40 +sink traps, 2000 V3: 42 +waste and vent piping, 2000 V3: 42 materials for, 1999 V2: 14–15 overview, 2000 V3: 232 +pipes, 2004 V1: 44 +pneumatic pressures in, 1999 V2: 2–3 preliminary information, 2000 V3: 215–216 protection from damage, 1999 V2: 18–19 public sewer availability, 2000 V3: 234 research, 1999 V2: 19 +sample letters, 2000 V3: 232 +sanitary sewers (SAN, SS), 2004 V1: 8, 28 sanitation and cleaning, 1999 V2: 16 sizing, 2000 V3: 232–233 +sloping drain capacities, 1999 V2: 5–9 sovent systems, 1999 V2: 19, 20 +stack capacities, 1999 V2: 3–5 +storm-drainage systems and, 1999 V2: 67 thermal expansion, 1999 V2: 18 trenching and bedding, 2000 V3: 234, 235 waterproofing, 1999 V2: 17 +sanitary joints, 2000 V3: 48 +sanitary sewer pipe codes, 2004 V1: 44 +sanitary sewer systems. See sanitary drainage systems sanitary tees +common vents and, 1999 V2: 43 flow capacity and, 1999 V2: 4 +water closet installation, 2003 V4: 6–7 sanitaryware. See fixtures +sanitation. See also cleanouts feed water, 1999 V2: 289 +fixture materials and, 2003 V4: 1 floor drains, 2003 V4: 17 precautions for wells, 1999 V2: 243 sanitary seals on wells, 1999 V2: 240 water softeners, 1999 V2: 308 +sanitizers, 2000 V3: 38 Sansone, John T., 1999 V2: 114 +SARA Title III act (Superfund Amendment and Reauthorization Act of 1986), 2000 V3: 154 +sat., SAT (saturation). See saturation saturated steam, 2000 V3: 175, 176 saturation (sat., SAT) +of soils, 1999 V2: 219 symbols for, 2004 V1: 16 +of water with calcium carbonate, 1999 V2: 291 SAVE. See Society of American Value Engineering +Index + + +sawcutting trenches, labor productivity rates, 2004 V1: 96 Saybolt Seconds Furol (ssf, SSF), 2004 V1: 16, 2000 V3: +154 +Saybolt Seconds Universal (ssu, SSU), 2004 V1: 16, 2000 V3: 154 +SAZ (solar azimuth), 2004 V1: 14 +SBCCI (Southern Building Code Congress International, Inc.), 1999 V2: 114, 2000 V3: 154 +SC (shading coefficients), 2004 V1: 16 scalars, defined, 2004 V1: 93 +scalding water, 1999 V2: 157, 169–170 scale and scale formation +boilers, 1999 V2: 314 +chlorides and sulfates, 1999 V2: 283 cooling towers, 1999 V2: 316 hardness and, 1999 V2: 283 +heat transfer surfaces, 2000 V3: 190 Langelier saturation index, 1999 V2: 291–292 magnesium and, 1999 V2: 283 +pool water heaters and, 2000 V3: 138 +predicting water deposits and corrosion, 1999 V2: 290–292 +removing with water softening, 1999 V2: 307 Ryzner stability index, 1999 V2: 292 sequestering agents, 2000 V3: 150 swimming pools, 2000 V3: 147 +total dissolved solids and, 1999 V2: 288 +water deposits and corrosion, 1999 V2: 289–290 water piping systems, 1999 V2: 244 +scanning electron microscopy, 1999 V2: 282. See also electron microscopes +scavenging adapters, 2000 V3: 71 +SCCC (Spill Containment Control and Countermeasures), 2000 V3: 165 +scfh (standard cfh), 1999 V2: 180 +scfm, SCFM (standard cubic feet per minute) abbreviation, 2004 V1: 14 +ambient free air and, 1999 V2: 255–256 compressed air pipe sizing, 2000 V3: 210 compressed air tools, 2000 V3: 208 defined, 2000 V3: 85, 200 +medical air compressors, 2000 V3: 65, 66 medical vacuum systems, 2000 V3: 69 +scfs, SCFS (cubic feet per second), 2004 V1: 33 Schedule 10 steel pipe, 2003 V4: 48 +Schedule 40 brass pipe, 2003 V4: 27 Schedule 40 polyvinyl pipe, 2003 V4: 62 +Schedule 40 PVC plastic, 2000 V3: 17, 116, 2003 V4: 62 Schedule 40 steel pipe, 2003 V4: 51–52 +Schedule 80 brass pipe, 2003 V4: 27 Schedule 80 polyvinyl pipe, 2003 V4: 62 Schedule 80 PVC plastic, 2003 V4: 62 Schedule 80 steel pipe, 2003 V4: 53–54 schedules (project) +checklist, 2004 V1: 102 +section in specifications, 2004 V1: 70, 90, 92 school laboratories. See laboratories +schools +numbers of fixtures for, 2003 V4: 19, 22 septic tank systems for, 1999 V2: 231–232 shower room grates, 1999 V2: 11 swimming pools and, 2000 V3: 129 + +353 + + +vacuum calculations for, 1999 V2: 269 scope lines, 2004 V1: 227 +screening +in downspouts, 1999 V2: 81 +in gray-water treatment, 1999 V2: 27 urinals, 2003 V4: 10 +vacuum exhaust piping, 1999 V2: 274 screw compressors, 2000 V3: 201, 205 screw pumps, 1999 V2: 259 +screw threads, 2004 V1: 17 screwed fittings, 2004 V1: 162 +screwed mechanical joints, 1999 V2: 334 scrub-up sinks, 2000 V3: 32, 35–36, 38 “scuff-buff” grates, 1999 V2: 11 +scum +in septic tanks, 1999 V2: 227, 228, 229, 230 in swimming pools, 2000 V3: 150 +scuppers, 1999 V2: 79, 88, 93 SCW (soft cold water), 2004 V1: 8 +SD (storm or rainwater drains). See storm-drainage systems +SDI (silt density index), 1999 V2: 288–289 SDR (standard dimension ratio) +HDPE pipe, 2003 V4: 61 SDR21 PVC pipe, 2003 V4: 62 SDR26 PVC pipe, 2003 V4: 62 +SE (sea level). See sea level sea level (sl, SL, SE) +atmospheric pressure, 2000 V3: 200 symbols for, 2004 V1: 16 +vacuum ratings, 1999 V2: 257 sealed sprinklers, 2000 V3: 9, 11 sealing grouts in wells, 1999 V2: 243 seals +acoustic pipe-penetration seals, 2004 V1: 201 flashing rings, 1999 V2: 12 +floor drains in infectious waste systems, 1999 V2: 345 seal liquids in vacuum pumps, 1999 V2: 260 +sound insulation, 2004 V1: 193 +trap seals in floor drains, 1999 V2: 10 water closets, 2003 V4: 6 +well fixtures, 1999 V2: 243 seamless copper pipe, 2003 V4: 34–36 +seamless copper water tube, 2003 V4: 34–44 seamless steel piping, 2003 V4: 48 seasonable condensate drains, 1999 V2: 13 seats +accessible shower compartments, 2004 V1: 120 bathtub and shower seats, 2004 V1: 115, 117, 122–123 seat fouling tests, 2003 V4: 6 +water closets, 2003 V4: 5 +second-guessing designs, 2004 V1: 213 secondary containment +of hazardous wastes, 2000 V3: 90 of infectious wastes, 1999 V2: 343 +secondary containment tanks aboveground types, 2000 V3: 165, 167 +interstitial monitoring, 2000 V3: 160–161 interstitial spaces, 2000 V3: 156 underground tanks, 2000 V3: 155 +secondary functions, 2004 V1: 225, 227, 230 secondary pipe liquid monitoring, 2000 V3: 162 +354 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +secondary pipe vapor monitoring, 2000 V3: 162 secondary storm-drainage systems +controlled-flow systems, 1999 V2: 94 pipe sizing, 1999 V2: 69 +piping systems, 1999 V2: 81 planning for in design, 1999 V2: 70 rainfall frequency and, 1999 V2: 79 scuppers, 1999 V2: 93 +types of, 1999 V2: 88 Seconds Redwood, 2000 V3: 154 +seconds (s, SEC), 2004 V1: 16, 33 +Seconds Saybolt Furol (SSF), 2000 V3: 154 Seconds Saybolt Universal (SSU), 2000 V3: 154 Sectionformat, 2004 V1: 65, 68–71 +sections +in Manual of Practice, 2004 V1: 88–92 of pump equipment, 1999 V2: 245 +in specifications, 2004 V1: 63, 68–71 security of oxygen storage areas, 2000 V3: 63 sediment +removing, 1999 V2: 294 in water, 1999 V2: 282 +sediment buckets +kitchen drains, 1999 V2: 16 materials, 1999 V2: 14 +in oil collectors, 1999 V2: 13 +in sanitary drainage systems, 1999 V2: 12 sediment pits, 1999 V2: 105 +sedimentation +in gray-water treatment, 1999 V2: 27 in water treatment, 1999 V2: 294 +seepage beds, 1999 V2: 217, 220, 224–225, 232 seepage flanges, 1999 V2: 17 +seepage pits, 2004 V1: 28, 1999 V2: 27, 220, 225–226, 2000 V3: 240 +SEFF (surface efficiency), 2004 V1: 14 seiches, 2004 V1: 158 +seismic, defined, 2004 V1: 191 +Seismic Design for Buildings, 2004 V1: 183, 191 seismic joints, crossing, 2004 V1: 162 +seismic protection +air compressors and, 2000 V3: 213 calculating seismic forces, 2004 V1: 183–186 +causes and effects of earthquakes, 2004 V1: 156–158 codes and standards, 2004 V1: 171–184 +computer analysis of piping systems, 2004 V1: 186 damage from earthquakes, 2004 V1: 158 +design considerations, 2004 V1: 186–188 +earthquake measurement and seismic design, 2004 V1: 160–161 +equipment protection, 2004 V1: 163–171 glossary, 2004 V1: 191 +introduction, 2004 V1: 155–156 +learning from past earthquakes, 2004 V1: 161–163 pipe restraints, 2004 V1: 166–182, 1999 V2: 14, 19, +2000 V3: 15 +potential problems, 2004 V1: 188–191, 189 references, 2004 V1: 191 +seismic loads, defined, 2004 V1: 155 seismic risk maps, 2004 V1: 155–157 +underground storage tanks and, 2000 V3: 155 vibration isolation and, 2004 V1: 206 + + +Seismic Restraint Manual Guidelines for Mechanical Systems, 2004 V1: 191 +selective attack corrosion, 2004 V1: 141 selectivity coefficients, 1999 V2: 302 +self-bracing problems in seismic protection, 2004 V1: 190 self-closing valves, 2000 V3: 33 +self-contained breathing units, 1999 V2: 332, 333 self-contained fountains, 2000 V3: 107 +self-jetting well points, 1999 V2: 241 self-metering faucets, 2003 V4: 13 +self-priming dry pumps, 2000 V3: 113, 129–130, 142 self-regulating heat-trace systems, 1999 V2: 165–166 self-scouring traps, 1999 V2: 36 +self-scouring velocity in sewers, 2000 V3: 232 self-siphonage +defined, 1999 V2: 36 +in fixture drains, 1999 V2: 2 tests, 1999 V2: 38 +self-venting in sovent systems, 1999 V2: 19, 54 selling functions, 2004 V1: 225 +SEMI (Semiconductor Equipment Manufacturers Institute), 1999 V2: 279, 317 +semi-ambulatory individuals +semi-ambulatory disabilities, 2004 V1: 107 water closet requirements, 2004 V1: 116 +semi-circular gutters, 1999 V2: 81, 86 semi-circular lavatories, 2003 V4: 11 +semi-instantaneous water heaters, 1999 V2: 160 semi-permeable membranes, 2000 V3: 47 +Semiconductor Equipment Manufacturers Institute, 1999 V2: 279, 317 +Sendelbach, M.G., 1999 V2: 325 sensible heat (SH) +condensate drainage and, 2000 V3: 189 defined, 2004 V1: 137 +sensible heat gain (SHG), 2004 V1: 15, 16 sensible heat ratio (SHR), 2004 V1: 16 symbols for, 2004 V1: 16 +sensitivity in pressure-regulated valves, 1999 V2: 152 sensors +corrosive-waste systems, 2000 V3: 40 +electrical makeup water method, 2000 V3: 124, 125 faucet controls, 2004 V1: 135 +hazardous material level sensors, 2000 V3: 90 line-pressure sensors, 2000 V3: 72 +liquid fuel leakage, 2000 V3: 163 pH sensors, 2000 V3: 40 +water-level sensors, 2000 V3: 124 separating systems +for acid waste, 1999 V2: 329, 334 for oil, 1999 V2: 347–349 +separator/filters in air compressors, 2000 V3: 203 separators in vacuum cleaning systems +kinds of materials, 1999 V2: 275 location, 1999 V2: 270 +pressure loss, 1999 V2: 274 +types of systems, 1999 V2: 266, 268 septic tanks +biological treatment of sewage in, 1999 V2: 227 chemicals in, 1999 V2: 230–231 +cleaning, 1999 V2: 229–230 clogging materials, 1999 V2: 231 +Index + + +compartments, 1999 V2: 229 defined, 2004 V1: 28 +estimating sewage quantities, 1999 V2: 233–238 grease interceptors, 1999 V2: 230 +institutional and recreational establishments, 1999 V2: 231–232 +liquid discharge from, 1999 V2: 217 percolation rates and, 1999 V2: 238 sanitary sewers and, 2000 V3: 240 +single septic tank installations, 1999 V2: 231 sizing, 1999 V2: 227 +solids removal, 1999 V2: 227–228 specifications, 1999 V2: 228–229 usefulness and area served, 1999 V2: 231 venting, 1999 V2: 231 +septum filters, 1999 V2: 318, 2000 V3: 134, 135 sequence +of project phases, cost estimates and, 2004 V1: 98 section in specifications, 2004 V1: 70, 90 +sequential functions in FAST approach, 2004 V1: 230 sequential functions in FAST approach, 2004 V1: 230 sequestering agents, 2000 V3: 150 +serial distribution of leaching trenches, 1999 V2: 223–224 service cocks, 1999 V2: 154 +service deionization, 1999 V2: 305–306 service sinks, 2003 V4: 12–13, 18–22 +Service Station Tankage Guide (API 1611), 2000 V3: 173 service stations, 2000 V3: 166, 2003 V4: 20 +service-weight cast-iron soil pipe, 2003 V4: 27, 30–31 services +costs, 2004 V1: 222 +ongoing and one-time costs, 2004 V1: 223 +set pressure in pressure-regulated valves, 1999 V2: 152, 167 +settlement. See bedding and settlement; creep settling tanks, 2000 V3: 93 +severe backflow hazard, 1999 V2: 145, 146, 2000 V3: 222 sewage, defined, 2004 V1: 28. See also effluent +sewage effluent. See effluent sewage ejectors, 2004 V1: 28 sewage systems. See sewer systems +sewage treatment plants, 1999 V2: 22, 24, 147 sewer mains +asbestos concrete piping, 2003 V4: 26 nonreinforced concrete pipe, 2003 V4: 32 +sewer systems. See also building sewers; private sewage-disposal systems; public sewers; specific types of sewers +combined systems, 2000 V3: 247 discharge from laboratories, 2000 V3: 40 +preliminary information, 2000 V3: 215–216 sample sewer services letter, 2000 V3: 257 +sanitary sewer systems, 2000 V3: 232–240. See also sanitary drainage systems +alternative disposal methods, 2000 V3: 240 components and design, 2000 V3: 234–236 force mains, 2000 V3: 234–236 +overview, 2000 V3: 232 sample letters, 2000 V3: 232 sizing, 2000 V3: 232–233 +sewer video equipment, 1999 V2: 10 storm sewers, 2000 V3: 240–248 + +355 + + +calculations, 2000 V3: 244–245 codes and standards, 2000 V3: 240 disposal methods, 2000 V3: 245–247 overview, 2000 V3: 240 +rational method and design glow, 2000 V3: 242–244 sizing ditches, 2000 V3: 247–248 +swimming pool water and, 2000 V3: 131, 140 sf, SF (safety factors), 2004 V1: 16 +sft hp, SFT HP (shaft horsepower), 2004 V1: 16 sfu (supply fixture units), 2004 V1: 24 +SGPH (standard gallons per hour), 2004 V1: 15 SH (sensible heat), 2004 V1: 15, 16, 137 shading coefficients (SC), 2004 V1: 16 +shaft horsepower (sft hp, SFT HP, SHP), 2004 V1: 16 shafts, piping and acoustic design for, 2004 V1: 196 shaking vacuum filter bags, 1999 V2: 268 +shallow-end depth of swimming pools, 2000 V3: 128 shallow fill, building sewers and, 1999 V2: 15 shallow manholes, 2000 V3: 234, 238 +shallow septic tanks, 1999 V2: 228 shallow wells, 1999 V2: 240, 247 +shapes of swimming pools, 2000 V3: 129 +shear motions, preventing, 2004 V1: 163, 189, 190 sheet copper, 2003 V4: 15 +sheet flows, 2000 V3: 244 sheet lead, 2003 V4: 15 +Sheet Metal and Air Conditioning Contractors’ National Association (SMACNA), 2004 V1: 170, 191 +Sheet Metal Industry Fund of Los Angeles, 2004 V1: 191 shell-and-tube heat exchangers, 2004 V1: 131 +shelving +accessibility in toilet and bathing rooms, 2004 V1: 113 ambulatory accessible toilet compartments, 2004 V1: +115–116 Sherlin, G.C., 1999 V2: 65 +SHG (sensible heat gain), 2004 V1: 15, 16 +shielding on radioactive drainage systems, 1999 V2: 339–340 +shine. See radiation +shipping costs, 2004 V1: 98, 223 +shock absorbers. See water hammer arresters shock intensity of water hammer, 1999 V2: 132 +shock treatments in pools and fountains, 2000 V3: 123 Sholes, Christopher, 2004 V1: 231 +shopping centers, 1999 V2: 25, 2003 V4: 20 shops, numbers of fixtures for, 2003 V4: 20 short-circuiting installations, 2004 V1:151 short cycling in boilers, 2000 V3: 180 +shot-in concrete anchors, 2004 V1: 163, 190 shower pans, 2003 V4: 15 +shower valves +flow rates, 2003 V4: 16 installation, 2003 V4: 16 types, 2003 V4: 15–16 +showerheads +Energy Policy Act requirements, 2004 V1: 264 low flow, 2004 V1: 136 +wasted water, 2004 V1: 136 showers +acoustic ratings of, 2004 V1: 194–195 body sprays, 2003 V4: 16 +356 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +emergency showers, 1999 V2: 332, 333, 344, 2003 V4: 17–18 +enclosures, 2004 V1: 120 fixture-unit loads, 1999 V2: 3 flow rates, 2003 V4: 15 +grab bars, 2004 V1: 121–122 +grates in school shower rooms, 1999 V2: 11 gray-water supply and demand, 1999 V2: 25 gray-water systems, 2004 V1: 135 +health-care facilities, 2000 V3: 32, 38 heat recovery systems, 2004 V1: 266 hydrotherapy, 2000 V3: 35 +labor rooms, 2000 V3: 36 +minimum numbers of, 2003 V4: 18–22 patient rooms, 2000 V3: 34 +public areas in health-care facilities, 2000 V3: 33 rates of sewage flows, 1999 V2: 237 +reduced water usage, 2004 V1: 126 reducing flow rates, 2004 V1: 135 requirements, 2003 V4: 14–15 +resilient-mounting design, 2004 V1: 206 seats, 2004 V1: 122–123 +shower compartment accessibility, 2004 V1: 119–122 showerhead acoustic ratings, 2004 V1: 195 +spray units, 2004 V1: 118, 120 standards, 2003 V4: 2 +stop levers, 2004 V1: 136 +swimming pool bathhouses, 2000 V3: 130 temperatures, 2000 V3: 45 +thresholds, 2004 V1: 120 +water fixture unit values, 2000 V3: 217 SHP (shaft horsepower), 2004 V1: 16 +SHR (sensible heat ratio), 2004 V1: 16 Shreir, L.L., 2004 V1: 154 +shrinkage of ceramic fixtures, 2003 V4: 1 shrub sprinkler heads, 2000 V3: 103 Shumann, Eugene R., 1999 V2: 114 +shut-off devices +defined, 1999 V2: 214 +fuel dispensers, 2000 V3: 165 shut-off valves +earthquake-sensitive valves, 2004 V1: 162 fountains, 2000 V3: 118 +gas hose connectors, 1999 V2: 196 medical gases, 2000 V3: 71, 72 natural gas, 1999 V2: 176 +shutdown relays, 2000 V3: 24 Shweitzer, 2000 V3: 97 +SI units. See International System of Units +siamese fire-department connections, 2004 V1: 12, 28, 2000 V3: 11. See also fire-protection systems +side reach for wheelchairs, 2004 V1: 109, 112 side spray accessories, 2003 V4: 12, 14 +side vents, 2004 V1: 28 +sidesway prevention, 2004 V1: 189 +sidewalk fire-department connections, 2004 V1: 12 sidewall grab bars, 2004 V1: 114 +sidewall heat loss in pools, 2000 V3: 144 sidewall sprinklers, 2004 V1: 13, 30 Siegrist, R., 1999 V2: 34 +siemens, 2004 V1: 33 +sight disabilities, 2004 V1: 107 + +signals for fire alarms, 2000 V3: 9 significant digits, 2004 V1: 32 silencers +on air compressors, 2000 V3: 202, 212 on vacuum systems, 1999 V2: 268 +silica, 1999 V2: 283 silica gel, 2000 V3: 204 +silicates, 1999 V2: 282, 2000 V3: 147 silicon, 1999 V2: 281 +silicon iron piping, 1999 V2: 15 silt +content of water, 2000 V3: 99 loams, 2000 V3: 100 removing, 1999 V2: 294 +silt density index, 1999 V2: 288–289 in soil texture, 1999 V2: 218 +in water, 1999 V2: 282 +silt density index (SDI), 1999 V2: 288–289 silver, 2004 V1: 139, 141, 144 +Silver-level LEED certification, 2004 V1: 263 silver salt, 2000 V3: 150 +silver solder, 2004 V1: 141 +A Simple Method for Retention Basin Design, 1999 V2: 114 simplex air compressors, 2000 V3: 213 +simplex gas booster systems, 1999 V2: 181 +simultaneous operators of vacuum systems, 1999 V2: 269, 272 +simultaneous-use factors. See diversity factor single-acting altitude valves, 1999 V2: 249 +single-acting cylinders in compressors, 2000 V3: 201 single-compartment septic tanks, 1999 V2: 229 single-compartment sinks, 2003 V4: 11 +single-degree-of-freedom systems, 2004 V1: 160, 161 single-family dwellings, 2003 V4: 20, 21 +single-occupant toilet rooms, 2003 V4: 18, 23 +single-seated pressure-regulated valves, 1999 V2: 152 single-side-entry fittings in sovent systems, 1999 V2: 62 single-stage distillation, 1999 V2: 295 +single-step deionization (mixed bed), 1999 V2: 302, 303, 305 +single-tank residential filters, 2000 V3: 134 single-wall tanks, 2000 V3: 156 +sinistans, 2000 V3: 38 +sink-disposal units. See food waste grinders sinks and wash basins. See also lavatories +accessibility, 2004 V1: 117 faucets, 2003 V4: 13 +fixture-unit loads, 1999 V2: 3 food-preparation, 2000 V3: 36 general category of, 2003 V4: 13 +gray-water supply and demand, 1999 V2: 25 health-care facilities, 2000 V3: 32, 38 infectious waste drainage, 1999 V2: 344 kitchen sinks, 2003 V4: 11–12 +laboratory rooms, 2000 V3: 37 +laboratory sink drainage rates, 1999 V2: 337 laundry sinks, 2003 V4: 13 +neutralizing acid from, 1999 V2: 336 pharmacies and drug rooms, 2000 V3: 35 +public areas in health-care facilities, 2000 V3: 33 rates of sewage flows, 1999 V2: 237 +service sinks, 2003 V4: 12–13 +Index + + +sound-damping materials, 2004 V1: 196 standards, 2003 V4: 2 +suds problems, 1999 V2: 37, 39 +surgical scrub-up areas, 2000 V3: 35–36 traps and acid wastes, 2000 V3: 42 vents, 1999 V2: 37 +water fixture unit values, 2000 V3: 217 siphon jet urinals, 2003 V4: 9 +siphon jet water closets, 2003 V4: 3 siphonage +eliminating with vents, 1999 V2: 35 factors in trap seal loss, 1999 V2: 36 reducing trap seal losses, 1999 V2: 39–40 water closets and, 1999 V2: 36 +siphons in secondary containment areas, 2000 V3: 90 site storm drainage, 1999 V2: 95–107 +equations, 1999 V2: 107–108 +exterior piping and inlets, 1999 V2: 98–99 Rational Method formulas, 2004 V1: 7, 1999 V2: +95–98, 98, 107 +storm-water detention, 1999 V2: 105–107 subsurface drainage, 1999 V2: 99–105, 100 +site utilities +domestic water supply +codes and standards, 2000 V3: 216 overview, 2000 V3: 216 +sample water service letter, 2000 V3: 256 +service components and design, 2000 V3: 217–224 system requirements, 2000 V3: 216–217 +water mains and pressure, 2000 V3: 216 water utility letters, 2000 V3: 216 +fire-protection water supply, 2000 V3: 224–232 ancillary devices, 2000 V3: 226–229 building water supply, 2000 V3: 225–226 codes and standards, 2000 V3: 225 overview, 2000 V3: 224–225 +sizing system, 2000 V3: 229–232 natural gas services, 2000 V3: 248–254 +codes and standards, 2000 V3: 248 overview, 2000 V3: 248 +sample gas utility letter, 2000 V3: 258–259 site distribution, 2000 V3: 252 +sizing methods, 2000 V3: 252–254 system components, 2000 V3: 250–252 testing and purging, 2000 V3: 252 types of services, 2000 V3: 249 +off-peak power savings, 2004 V1: 128–129 overview, 2000 V3: 215 +preliminary information, 2000 V3: 215–216 sample general notes, 2000 V3: 255 sanitary sewer services, 2000 V3: 232–240 +alternative disposal methods, 2000 V3: 240 components and design, 2000 V3: 234–236 force mains, 2000 V3: 236–240 +overview, 2000 V3: 232 sample letters, 2000 V3: 232 +sample sewer services letter, 2000 V3: 257 sizing, 2000 V3: 232–233 +storm sewers, 2000 V3: 240–248 calculations, 2000 V3: 244–245 codes and standards, 2000 V3: 240 disposal methods, 2000 V3: 245–247 + +357 + + +overview, 2000 V3: 240 +rational method and design glow, 2000 V3: 242–244 sample sewer services letter, 2000 V3: 257 +sizing ditches, 2000 V3: 247–248 swimming pool locations and, 2000 V3: 128 +sites +geological stability of, 1999 V2: 26 irrigation system plans, 2000 V3: 104 obtaining plans, 2000 V3: 215 +overland flow times for sites, 1999 V2: 96, 97, 98, 111 site conditions and storm drainage, 1999 V2: 69 slope of site, 1999 V2: 101, 224 +sitz baths, 2000 V3: 32, 38 +Six Sticks exercise, 2004 V1: 232, 261 sizing +acid-neutralization tanks, 2000 V3: 40, 42 +acid-waste drainage system pipes, 1999 V2: 334 air compressors, 2000 V3: 68, 210–213 +air receivers, 2000 V3: 205–206 clean agent gas pipes, 2000 V3: 24 cleanouts, 1999 V2: 9 +cold-water system pipes, 1999 V2: 116–131, 133–142 condensate traps, 2000 V3: 193–195, 197 +cryogenic tanks, 2000 V3: 62 +fire extinguishers, 2000 V3: 27, 28 floor drains, 1999 V2: 10 +force mains, 2000 V3: 236 +fountain display pumps, 2000 V3: 115 fountain drains, 2000 V3: 110, 125 +fountain filtration systems, 2000 V3: 110, 112, 113, 115–116 +fountain nozzles, 2000 V3: 117–118 fountain return inlets, 2000 V3: 117–118 friction loss basis for pipes, 1999 V2: 127 gas boosters, 1999 V2: 182–183 +gas line filters, 2000 V3: 250 gas meters, 2000 V3: 250 gas piping, 2004 V1: 7 +gas regulators, 2000 V3: 251–252 grab bars, 2004 V1: 121 +gutters, 1999 V2: 86, 2000 V3: 142 +hot-water circulation systems, 1999 V2: 165 hypochlorinators, 2000 V3: 151 +irrigation, 2000 V3: 100 +liquid fuel piping, 2000 V3: 169, 2000 V3:169–170 medical air compressors, 2000 V3: 68 +medical air piping, 2000 V3: 210 +medical gas systems, 2000 V3: 49–50, 73–74, 75, 76–77 medical vacuum systems, 2000 V3: 69, 75 +multilevel pools, 2000 V3: 108 natural gas fittings, 1999 V2: 184 +natural gas piping, 1999 V2: 174–176, 183–194, 197– 211, 2000 V3: 252–254 +by NFPA formula, 1999 V2: 186, 187, 188, 189 by Spitzglass formula, 1999 V2: 210–211 +by Weymouth formula, 1999 V2: 190, 191, 198–209 pressure drops and, 1999 V2: 192, 193 +nitrogen gas systems, 2000 V3: 68, 75 nitrous oxide systems, 2000 V3: 65, 75, 76 nominal pipe size, 1999 V2: 253 +oxygen systems, 2000 V3: 63, 75, 76 +pressure and temperature relief valves, 1999 V2: 167 +358 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +pressure-regulated valves, 1999 V2: 153–154 pressurized fuel product piping, 2000 V3: 170 project size and cost estimates, 2004 V1: 98 roof drainage systems, 1999 V2: 81, 85, 89–92 sanitary sewer systems, 2000 V3: 232–233 septic tanks, 1999 V2: 227 +skimmers, 2000 V3: 110, 142 +special-waste system pipes, 1999 V2: 328–329, 329, 330, 331 +sprinkler system pipes, 2000 V3: 16, 18 standpipe systems, 2000 V3: 19 +steam systems, 2000 V3: 177, 186–187, 191 steam traps, 2000 V3: 191, 193–195, 196 storm drainage systems, 1999 V2: 69, 110 storm sewers, 2000 V3: 244–245, 246 storm water ditches, 2000 V3: 247–248 +submersible pumps, 2000 V3: 164, 2000 V3:170, 2000 V3: 170 +subsurface pipes, 1999 V2: 104 +sump pits for LSDS systems, 1999 V2: 344 surge chambers, 2000 V3: 143 +in sustainable designs, 2004 V1: 264 swimming pool return systems, 2000 V3: 143 +swimming pool water heaters, 2000 V3: 144–145 swimming pools, 2000 V3: 127–128 +toilet compartments, 2004 V1: 113–114 +vacuum systems, 1999 V2: 262–266, 2000 V3: 79 exhaust, 2000 V3: 70 +pumps, 2000 V3: 70 +vacuum cleaning inlets, tools, and tubing, 1999 V2: 269–270 +vacuum cleaning piping network, 1999 V2: 270– 274, 274 +vacuum cleaning system separators, 1999 V2: 275–276 +vacuum exhaust pipes, 1999 V2: 263 vacuum piping, 1999 V2: 263 +vacuum producers (exhausters), 1999 V2: 272 vacuum pumps, 1999 V2: 263–264 +vents, 1999 V2: 41–43, 50–63 vertical stacks, 1999 V2: 5, 6 +water hammer arresters, 1999 V2: 143–144 water mains, 2000 V3: 8 +water meters, 1999 V2: 116 +water storage tanks, 1999 V2: 247–248 wells, 1999 V2: 240 +skating rinks, numbers of fixtures for, 2003 V4: 19 sketches. See also plumbing drawings +costs analysis phase, 2004 V1: 241 function evaluation, 2004 V1: 239–240 functional development, 2004 V1: 254, 255 +skimmers +dissolving tablets in, 2000 V3: 149 head loss and, 2000 V3: 115 +pools and fountains, 2000 V3: 110 swimming pools, 2000 V3: 137, 142 +skimming oils, 2000 V3: 93 +sl, SL (sea level), 2004 V1: 16, 1999 V2: 257 slabs +below-slab drainage, 1999 V2: 103 +in radioactive waste systems, 1999 V2: 342 slack cables in earthquake protection, 2004 V1: 166 + +slaughterhouses, 1999 V2: 16 sliding motions +preventing for pipes or equipment, 2004 V1: 163 of seismic plates, 2004 V1: 158 +sliding vane compressors, 2000 V3: 201, 205 sliding vane pumps, 1999 V2: 262 +slime, 1999 V2: 289 +slime bacteria, 1999 V2: 282 +slip-resistant bases in baths, 2003 V4: 16 slope +of ditches, 2000 V3: 248 of floors, 2000 V3: 130 of sewers, 2000 V3: 233 +of sites, 1999 V2: 26, 101, 224, 2000 V3: 105, 244 sloping drains +fixture loads, 1999 V2: 7, 9 Manning formula, 2004 V1: 1 +minimum slope of piping, 1999 V2: 7 sanitary drainage systems, 1999 V2: 5 steady flow in, 1999 V2: 6–7 +ultra-low-flow fixtures and pipes, 2004 V1: 264 slow-release storm-water detention systems, 1999 V2: +105–107 +slow sand filtration, 1999 V2: 318 sludge +activated sludge systems, 2000 V3: 95 defined, 2004 V1: 28, 1999 V2: 289 from water softeners, 1999 V2: 244 removal, 2000 V3: 93 +in septic tanks, 1999 V2: 227, 228, 229, 230 slugs of water, 1999 V2: 2, 4, 38, 226 +slurry feeding in filtration, 2000 V3: 134–135 +SMACNA (Sheet Metal and Air Conditioning Contractors’ National Association), 2004 V1: 170, 191 +small bore pipes, 1999 V2: 341 +small-diameter gravity sewers, 1999 V2: 226 +Small Welded Petroleum Tanks (API 12F), 2000 V3: 95 smoke detectors, 2004 V1: 22, 2000 V3: 24 +smoke, vacuum systems and, 2000 V3: 69 smooth piping, 1999 V2: 139 +smothering fires, 2000 V3: 19 +sniffer systems for gas, 1999 V2: 197 snow melting piping, 2003 V4: 35 +snubbing devices for earthquake protection, 2004 V1: 164–166, 165, 186 +soaking combustibles in inerting atmosphere, 2000 V3: 20 soap dispensers, 2003 V4: 12 +soaps. See also suds +in gray water, 1999 V2: 29 +in septic tanks, 1999 V2: 230 soapstone fixtures, 2003 V4: 2, 13 +Social Security taxes, in labor costs, 2004 V1: 94 +Society of American Value Engineering (SAVE), 2004 V1: 211, 213 +socket-type joints, 2000 V3: 254 socket welding +defined, 1999 V2: 341 +socket-weld end connections, 2004 V1: 23 soda ash (sodium carbonate), 2000 V3: 148, 149 sodium, 1999 V2: 281, 283 +sodium aluminate, 1999 V2: 294 sodium bicarbonate, 1999 V2: 283 +Index + + +sodium bisulfate, 1999 V2: 245, 2000 V3: 93, 148, 149, 150 sodium carbonate (soda ash), 1999 V2: 283, 2000 V3: 148, +149 +sodium chloride, 1999 V2: 283 +sodium cycle ion exchange, 1999 V2: 307 +sodium hexametaphosphate, 2004 V1: 151, 1999 V2: 244 sodium hydroxide (lye), 1999 V2: 230, 305, 2000 V3: 93, +149, 150 +sodium hypochlorite, 1999 V2: 245, 2000 V3: 93, 149, 150–151 +sodium silicate, 2004 V1: 151 sodium sulfate, 1999 V2: 281 sodium thiosulfate, 1999 V2: 245 soft cold water (SCW), 2004 V1: 8 soft conversions, 2004 V1: 32 +soft water (SW). See water softeners softening water. See water softeners +softness of vibration control materials, 2004 V1: 202 software. See computer programs +soil-absorption sewage systems, 1999 V2: 217–224 allowable rates of sewage application, 1999 V2: 237 estimating sewage quantities, 1999 V2: 233–238 estimating soil absorption potential, 1999 V2: 217–220 individual wastewater treatment plants, 1999 V2: 232 inspection, 1999 V2: 238 +institutional and recreational establishments, 1999 V2: 231–232 +leaching trenches, 1999 V2: 220 locations, 1999 V2: 220 +mound systems, 1999 V2: 226 +percolation rates for soils, 1999 V2: 219–220 seepage beds, 1999 V2: 224–225 +seepage pits, 1999 V2: 225–226 selecting systems, 1999 V2: 220–221 +Soil Conservation Service, 1999 V2: 107, 114 soil-moisture monitors, 2000 V3: 104 +soil pipes, 2004 V1: 28 +soil sewers (S, SS), 2004 V1: 8 soil vents. See stack vents soils +color, 1999 V2: 218–219 depth, 1999 V2: 219 +gray-water irrigation systems and, 1999 V2: 26, 27 infiltration rates, 1999 V2: 96 +irrigation and, 2000 V3: 99–100, 104–105 K factors of, 1999 V2: 101, 104–105 maps of, 1999 V2: 218 +percolation tests, 1999 V2: 219–220 profiles, 2000 V3: 99–100, 216 resistivity, 2004 V1: 150 +in seismic force calculations, 2004 V1: 183 structure, 1999 V2: 218 +swelling characteristics, 1999 V2: 219 swimming pool locations and, 2000 V3: 128 texture, 1999 V2: 218 +underground tanks and, 2000 V3: 155 SOL (solar), 2004 V1: 16 +solar (SOL), defined, 2004 V1: 16 solar azimuth (SAZ), 2004 V1: 14 solar energy +copper pipe, 2003 V4: 35, 36 +heating for swimming pools, 2000 V3: 138 + +359 + + +solar (SOL), defined, 2004 V1: 16 +solar energy sources, defined, 2004 V1: 137 water heaters, 2004 V1: 130, 265 +soldering +clearance for, 2003 V4: 25 copper water tube, 2003 V4: 37 corrosion and, 2004 V1: 146 reducing, 2004 V1: 266 +soldered joints and earthquake protection, 2004 V1: 167 +solenoid valves +makeup water systems, 2000 V3: 124 solenoid valve trap primers, 1999 V2: 14 symbols for, 2004 V1: 9 +solid angles, 2004 V1: 33 solid chlorine, 2000 V3: 123 +solid expansion traps, 2000 V3: 182 solid toilet seats, 2003 V4: 5 +solid waste disposal +as energy source, 2004 V1: 130–131 +solid waste incineration systems, 2004 V1: 130–131 solids removal in septic tanks, 1999 V2: 227–228 +solids +loading in filtration beds, 2000 V3: 132 rectangular, 2004 V1: 4 +solids interceptors, 2000 V3: 41, 43 in water, 1999 V2: 288, 2000 V3: 132 +soluble silica, 1999 V2: 283 solute. See treated water solution sinks, 2000 V3: 35 +solutions to puzzles, 2004 V1: 261 solvents +PEX piping and, 2003 V4: 61 +in pure-water systems, 2000 V3: 48 sonic cleaners, 2000 V3: 38 +sound power +defined, 2004 V1: 208 levels, 2004 V1: 194, 208 +sound pressure, 2004 V1: 209 +sounds. See acoustics in plumbing systems sour gas, 2000 V3: 250 +source shut-off valves, 2000 V3: 71 source water +defined, 1999 V2: 280 +pure-water systems, 1999 V2: 320 sources of acoustic problems, 2004 V1: 199 +sources of information in value engineering, 221, 2004 V1: 214 +sources, vacuum, 1999 V2: 259–261, 262, 263–264 Southern Building Code Congress International, Inc. +(SBCCI), 1999 V2: 114, 2000 V3: 154 sovent aerators, 1999 V2: 54–56, 60, 62 sovent deaerators, 1999 V2: 54, 56, 60, 61, 62 sovent single-stack plumbing systems +building drain connections, 1999 V2: 60–61 components and sizing, 1999 V2: 54–63 illustrated, 1999 V2: 20 +installation, 1999 V2: 62 introduction, 1999 V2: 19 +pressure-equalizing lines, 1999 V2: 60 sizing, 1999 V2: 57–62 +venting, 1999 V2: 46–47 +360 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +sp, SP (static pressure), 2004 V1: 15, 16 sp ht, SP HT (specific heat) +measurements, 2004 V1: 33 +sp ht at constant pressure (cp, cp, CP), 2004 V1: 16 sp ht at constant volume (cv, c, CV), 2004 V1: 16 symbols for, 2004 V1: 16 +v +sp vol, SP VOL (specific volume). See specific volume space heating with natural gas, 1999 V2: 174 spacing +around water closets, 2003 V4: 6–7 drinking fountains, 2003 V4: 14 +grab bars for accessibility, 2004 V1: 121–122 lavatories, 2003 V4: 11 +of leaching trenches, 1999 V2: 222 manholes, 2000 V3: 236, 240 swimming pool inlets, 2000 V3: 143 urinals, 2003 V4: 9–10 +of vacuum inlets, 1999 V2: 269 spas, 2000 V3: 107 +spec, SPEC (specifications). See specifications special sprinklers, 2004 V1: 30 +special-waste drainage systems +acid-waste systems, 1999 V2: 329, 332–334 chemical-waste systems, 1999 V2: 345–346 codes and standards, 1999 V2: 327–328 +fire-suppression water drainage, 1999 V2: 346–347 flammable and volatile liquids, 1999 V2: 347–349 future growth of systems, 1999 V2: 329 +general design considerations, 1999 V2: 329 infectious and biological waste systems, 1999 V2: +343–345 introduction, 1999 V2: 327 +pH values in waste, 1999 V2: 329 piping and joint selection, 1999 V2: 328 +planning for larger systems, 1999 V2: 329 radioactive waste drainage and vents, 1999 V2: 337– +343 +references, 1999 V2: 350 separating systems, 1999 V2: 329 +sizing piping, 1999 V2: 328–329, 329, 330, 331 special wastes defined, 2004 V1: 28 +system approval requirements, 1999 V2: 328 specialty water closets, 2004 V1: 136 +specific conductance, 1999 V2: 287 +specific energy, converting to SI units, 2004 V1: 39 specific functionality, defined, 2004 V1: 225 specific gravity (SG) +defined, 1999 V2: 214, 2000 V3: 154 fuel gases, 1999 V2: 212 +natural gas, 1999 V2: 173, 185 plastic pipe, 2003 V4: 60 plastic pipe and, 2003 V4: 61 PVC pipe, 2003 V4: 62 symbols for, 2004 V1: 16 +specific heat (sp ht, SP HT, C) measurements, 2004 V1: 33 +sp ht at constant pressure (cp, cp, CP), 2004 V1: 16 sp ht at constant volume (cv, c, CV), 2004 V1: 16 symbols for, 2004 V1: 16 +v +specific resistance in water, 1999 V2: 285–287, 2000 V3: 46 specific volume (sp vol, SP VOL, V, CVOL) +measurements, 2004 V1: 33 + +symbols for, 2004 V1: 16 +Specification for Copper Drainage Tube (DWV), 2003 V4: 35 +Specification for Seamless Copper Tube for Medical Gas Systems, 2003 V4: 35 +Specification for Seamless Copper Water Tube, 2003 V4: 35 specifications (spec, SPEC). See also construction contract +documents; project manuals; names of specific listing agencies; titles of specific documents +checklist, 2004 V1: 102 +computer production of, 2004 V1: 71–72 contents of sections, 2004 V1: 68–71 costs associated with, 2004 V1: 223 +in FAST approach, 2004 V1: 230 formats, 2004 V1: 63–64 introduction, 2004 V1: 61 MasterFormat, 2004 V1: 64 MasterFormat 2004, 2004 V1: 77–88 +MasterFormat Level Four (1995), 2004 V1: 76 MasterFormat Level One (1995), 2004 V1: 73 MasterFormat Level Three (1995), 2004 V1: 76 MasterFormat Level Two (1995), 2004 V1: 73–75 methods for creating, 2004 V1: 66–68 +problems with reuse, 2004 V1: 63 in project manuals, 2004 V1: 62 +questioning in value engineering, 2004 V1: 212 “specifications” as incorrect term, 2004 V1: 61 symbols for, 2004 V1: 16 +Uniformat, 2004 V1: 64, 73 +Specifications for Making Buildings and Facilities Usable by the Physically Handicapped, 2004 V1: 105 +Specifications Group, 2004 V1: 65, 77–88 specimen-type water closets, 2000 V3: 35 Spectext, 2004 V1: 71 +speculation in creativity, 2004 V1: 232 speed of pumps, 2004 V1: 6 +Speller, Frank N., 2004 V1: 154 Spencer Turbine Co., 1999 V2: 277 spherical soil structure, 1999 V2: 218 spigot outlets, 1999 V2: 18 +Spill Containment Control and Countermeasure (40 CFR 112) (SCCC), 2000 V3: 154, 165 +spill lips on weirs, 2000 V3: 109 spills +aboveground tank systems, 2000 V3: 167 acids, 1999 V2: 332 +controlled substances, 1999 V2: 277 industrial waste, 2000 V3: 90 +oil, 1999 V2: 347–349 +underground liquid fuel tanks, 2000 V3: 157 spiral wound modules +in cross-flow filtration, 1999 V2: 311 +in reverse osmosis (SWRO), 1999 V2: 289, 309 Spitzglass formula, 2004 V1: 7, 1999 V2: 183, 210–211 splash screens for backflow devices, 1999 V2: 148 +split-case horizontal end-suction pumps, 1999 V2: 245, 2000 V3: 25, 115 +split rim toilet seats, 2003 V4: 5 sply., SPLY (supplies), 2004 V1: 16 +sponge rubber isolators, 2004 V1: 204 +sports facilities, numbers of fixtures for, 2003 V4: 19 spout location on water fountains, 2004 V1: 109 +Index + + +spray effects in fountains, 2000 V3: 108–109, 119–120 spray heads on irrigation sprinklers, 2000 V3: 101–102 spray nozzle waterfall aerators, 1999 V2: 293 +spray units +in bathtubs, 2004 V1: 118 in showers, 2004 V1: 120 +spring isolators +concrete bases and, 2004 V1: 205 +problems in seismic protection, 2004 V1: 188, 189 pump isolation and, 2004 V1: 205 +stored energy in, 2004 V1: 166 spring-loaded check valves, 2000 V3: 118 +spring-operated double-check valve devices, 1999 V2: 149 spring-operated pressure-regulating devices, 1999 V2: 122 spring supports, 2004 V1: 186 +springing pipes, 2003 V4: 25 Sprinkler Irrigation, 2000 V3: 105 +Sprinkler Irrigation Systems, 2000 V3: 105 sprinkler systems (fire protection) +automatic sprinkler system types, 2004 V1: 29 combined dry-pipe and pre-action, 2000 V3: 15 concealed sprinklers, 2004 V1: 29 +corrosion-resistant sprinklers, 2004 V1: 29 defined, 2004 V1: 28–37 +deluge systems, 2000 V3: 13–15 design density, 2000 V3: 15 +drop nipples on pendent sprinklers, 2004 V1: 13 dry upright sprinklers, 2004 V1: 29 +earthquake damage to, 2004 V1: 162 effectiveness statistics, 2000 V3: 2 in elevator shafts, 2000 V3: 25 +extended-coverage sidewall sprinklers, 2004 V1: 29 fire hazard evaluation, 2000 V3: 2–3 +fire pumps for, 2000 V3: 25 +firefighting water drainage, 1999 V2: 346–347 flush sprinklers, 2004 V1: 29 +foam extinguishers, 2000 V3: 21 fully-sprinklered spaces, 2004 V1: 12 +gaseous fire-suppression systems and, 2000 V3: 22 heads, 2004 V1: 13 +history of, 2000 V3: 1–2 hydraulic design, 2000 V3: 15–18 +intermediate-level sprinklers, 2004 V1: 29 large-drop sprinklers, 2004 V1: 29 nippled-up sprinklers, 2004 V1: 13 +non-sprinklered spaces, 2004 V1: 12 +numbers of sprinklers in operation, 2000 V3: 16 occupancy classification, 2004 V1: 29 +open sprinklers, 2004 V1: 29 ornamental sprinklers, 2004 V1: 29 partially-sprinklered spaces, 2004 V1: 12 pendent sprinklers, 2004 V1: 13, 29 +pipe materials, 2000 V3: 12 +pre-action systems, 2000 V3: 13 +quick-response sprinklers, 2004 V1: 29 recessed sprinklers, 2004 V1: 29 residential sprinklers, 2004 V1: 30 sediment buckets in drains, 1999 V2: 12 seismic protection and, 2004 V1: 183–184 sidewall sprinklers, 2004 V1: 13, 30 special sprinklers, 2004 V1: 30 +sprinkler types, 2004 V1: 29, 2000 V3: 8–15 + +361 + + +supports and hangers, 2000 V3: 15 system design, 2000 V3: 2–18 +water demands, 1999 V2: 243–244, 2000 V3: 3–8 sprinkler systems (irrigation) +concepts, 2000 V3: 100–101 impact heads, 2000 V3: 102–103 +lawn sprinklers, 2004 V1: 8, 1999 V2: 121 sample information sheet, 2000 V3: 106 shrub heads, 2000 V3: 103 +spray heads, 2000 V3: 101–102 trickle irrigation, 2000 V3: 103 +spurs, 2000 V3: 234 +sq., SQ (squares). See squares square feet, 2000 V3: 29 square feet EDR, 2000 V3: 178 +square foot [m2] method, defined, 2004 V1: 97–98 squares (sq., SQ) +calculating area, 2004 V1: 3 converting to SI units, 2004 V1: 40 symbols for, 2004 V1: 16 +sr (steradians), 2004 V1: 33 +SS (sanitary sewers), 2004 V1: 8, 28. See also sanitary drainage systems +SSD (subsoil or footing drains), 2004 V1: 8, 30 +ssf, SSF (Saybolt Seconds Furol), 2004 V1: 16, 2000 V3: 154 +ssu, SSU (Saybolt Seconds Universal), 2004 V1: 16, 2000 V3: 154 +ST (storm or rainwater drains). See storm-drainage systems +stability index (Ryzner), 1999 V2: 292 stabilization ponds, 1999 V2: 232 stack groups, 2004 V1: 30 +stack inlets in deaerators, 1999 V2: 56 stack vents +air in, 1999 V2: 2 +defined, 2004 V1: 30, 1999 V2: 64 fixtures and, 1999 V2: 41, 43 overview, 1999 V2: 47–49 +sizing, 1999 V2: 50 +stack venting defined, 2004 V1: 30 vent headers, 1999 V2: 45 +stacks. See vertical stacks +stadiums, numbers of fixtures for, 2003 V4: 19 staff areas (health-care facilities), 2000 V3: 33–34 staff lounges, 2000 V3: 32 +staged evaporation, 1999 V2: 298 +stages in pump equipment, 1999 V2: 245 stain-resistance testing, 2003 V4: 2 stainless steel +commercial sinks, 2003 V4: 12 electromotive force series, 2004 V1: 144 filtration tanks, 2000 V3: 131 +fixtures, 2000 V3: 33, 2003 V4: 2 fountains and, 2000 V3: 116 glass pipe couplings, 2003 V4: 48 nickel content, 2003 V4: 2 passivation, 2004 V1: 146–147 pump shafts, 2000 V3: 145 +stainless-steel drains, 1999 V2: 342, 2000 V3: 143 stainless-steel grates, 1999 V2: 16 +stainless-steel piping +362 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +compressed air systems, 2000 V3: 210 exposed piping on storage tanks, 2000 V3: 165 fountains and, 2000 V3: 119 +industrial waste pipe, 1999 V2: 341 pure-water system, 2000 V3: 47–48 soil and waste pipe, 1999 V2: 14 USP water, 1999 V2: 324 +vacuum systems, 1999 V2: 262 +stainless-steel storage tanks, 1999 V2: 323, 2000 V3: 91 stairs and stairwells +aboveground storage tanks, 2000 V3: 165, 166–167 stairwell drains, 1999 V2: 69 +standpipe systems, 2000 V3: 19 stale sewage, 2004 V1: 30 +stall urinals, 2003 V4: 9, 10 standard (std, STD), 2004 V1: 16 +standard air, 2004 V1: 18, 2000 V3: 200 standard atmospheric pressure +defined, 2000 V3: 200 +in vacuums, 1999 V2: 254 +standard cartridge depth filtration, 1999 V2: 300 standard cfh (scfh), 1999 V2: 180 +standard cubic feet per minute (scfm). See scfm, SCFM (standard cubic feet per minute) +standard dimension ratio (SDR), 2003 V4: 61 standard fire-protection symbols, 2004 V1: 12–13 standard fire tests, 2000 V3: 3 +Standard for Bulk Oxygen Systems at Consumer Sites (NFPA 50), 2000 V3: 61, 86 +Standard for Color-marking of Compressed Gas Cylinders Intended for Medical Use (CGA C-9), 2000 V3: 86 +Standard for Health Care Facilities, 2003 V4: 45 Standard for Health-care Facilities (NFPA 99), 1999 V2: +262, 2000 V3: 86 +Standard for Hypochlorites, 1999 V2: 155 Standard for Liquid Chlorine, 1999 V2: 155 +Standard for Portable Fire Extinguishers (NFPA 10), 2000 V3: 27, 29 +Standard for Public Swimming Pools (ANSI/NSPI-1), 2000 V3: 125, 151 +Standard for Residential, In-ground Swimming Pools (ANSI/NSPI-5), 2000 V3: 151 +Standard for Tank Vehicles for Flammable and Combustible Liquids (NFPA 385), 2000 V3: 154 +Standard for the Installation of Nitrous Oxide Systems at Consumer Sites (CGA G-8.1), 2000 V3: 86 +Standard for the Installation of Sprinkler Systems, 2004 V1: 191 +Standard for the Machining and Finishing of Aluminum and the Production and Handling Aluminum Products (NFPA 651), 2000 V3: 20 +Standard for the Processing and Finishing of Aluminum (NFPA 65), 2000 V3: 20 +Standard for the Production, Processing, Handling and Storage of Titanium (NFPA 481), 2000 V3: 20 +Standard for the Production, Processing, Handling and Storage of Zirconium (NFPA 482), 2000 V3: 20 +Standard for the Storage, Handling and Processing of Magnesium Solids and Powders (NFPA 480), 2000 V3: 20 +standard free air adjusting, 1999 V2: 257 + + +at atmospheric pressure (scfm). See scfm, SCFM (standard cubic feet per minute) +in vacuum sizing calculations, 1999 V2: 263 standard gallons per hour, 2004 V1: 15 +Standard Handbook for Mechanical Engineers, 2004 V1: 1 Standard Method of Test of Surface Burning +Characteristics of Building Materials (NFPA 255), 2000 V3: 77 +Standard on Flow Testing and Marking of Fire Hydrants (NFPA 291), 2000 V3: 3 +standard plumbing and piping symbols, 2004 V1: 7–13 Standard Plumbing Code, 1999 V2: 79, 114 +Standard Practice for Making Capillary Joints by Soldering of Copper and Copper Alloy Tube and Fittings, 2003 V4: 37 +standard reference points (compressed air), 2000 V3: 200 Standard Specification for Concrete Sewer, Storm Drain, +and Culvert Pipe for Non-reinforced Concrete, 2003 V4: 32 +Standard Specification for Copper Drainage Tube (DWV), 2003 V4: 45 +Standard Specification for Joints for Circular Concrete Sewer and Culvert Pipe, Using Rubber Gaskets, 2003 V4: 32 +Standard Specification for Liquid and Paste Fluxes for Soldering Applications of Copper and Copper Alloy Tube, 2003 V4: 37 +Standard Specification for Reinforced Concrete Culverts, Storm Drain, and Sewer Pipe, 2003 V4: 32 +Standard Specification for Reinforced Concrete D-Load Culvert Storm Drain and Sewer Pipe for Reinforced Concrete Pipe, 2003 V4: 32 +Standard Specification for Seamless Copper Pipe, Standard Sizes, 2003 V4: 34 +Standard Specification for Seamless Copper Tube for Medical Gas Systems, 2003 V4: 45 +Standard Specification for Seamless Red Brass Standard Sizes, 2003 V4: 27 +standard time meridian (STM), 2004 V1: 16 standard water closets, 2003 V4: 4 +standard-weight brass pipe (Schedule 40), 2003 V4: 27 standard-weight steel pipe, 2003 V4: 48 +standards. See codes and standards standby losses +in circulating systems, 2004 V1: 127 water heaters, 2004 V1: 265 +standpipe systems +classifications and characteristics, 2000 V3: 18–19 defined, 2004 V1: 24, 30 +fire pumps for, 2000 V3: 25 +flat land storage tanks, 1999 V2: 247 overflow standpipes, 2000 V3: 125 standpipe air chambers, 1999 V2: 132, 143 swimming pools and, 2000 V3: 139 symbols for, 2004 V1: 13 +system classes of service, 2004 V1: 30 system types, 2004 V1: 30 +starting unloaders, 2000 V3: 205 +startup conditions for gas appliances, 1999 V2: 178 state agencies, 1999 V2: 327, 340, 2000 V3: 88 state frost lines, 2000 V3: 226 +state rainfall rate tables, 1999 V2: 69–78 +Index + + +states in creativity checklist, 2004 V1: 234 +static deflection for pump vibration, 2004 V1: 205 static fountain displays, 2000 V3: 111, 119 +static head +calculating, 2004 V1: 2 +swimming pool gutters and, 2000 V3: 142 velocity head and, 2004 V1: 5 +well pumps, 1999 V2: 245 static pressure (SP) +domestic water supply, 2000 V3: 217–221 fire hydrants, 2000 V3: 4–5 +irrigation flow, 2000 V3: 105 +sprinkler hydraulic calculations, 2000 V3: 16 symbols, 2004 V1: 15, 16 +water mains, 2000 V3: 216 static pressure loss, 1999 V2: 123 static wells, 1999 V2: 241–243 stations (medical gas and vacuum) +ceiling outlets, 2000 V3: 57 +estimating number, 2000 V3: 50, 51–52 inlets, 2000 V3: 85 +medical gas diversity factors, 2000 V3: 75 medical vacuum, 2000 V3: 54 +order of gas outlets, 2000 V3: 56 outlets, 2000 V3: 85 +patient headwall gas systems, 2000 V3: 56–57 surgical ceiling columns, 2000 V3: 57–58 terminals, 2000 V3: 54–56 +types of, 2000 V3: 58 +std, STD (standard), 2004 V1: 16 +std gph (standard gallons per hour), 2004 V1: 15 steady flow +in horizontal drains, 1999 V2: 6–7, 9 roof drainage, 1999 V2: 88 +steady-state heat balance equations, 1999 V2: 158 steam and condensate systems +condensate drainage, 2000 V3: 189–197 +flashing flow and high-pressure piping, 2000 V3: 196–197 +problems, 2000 V3: 189–191 proper drainage, 2000 V3: 191–196 +distilling water from steam, 1999 V2: 295–298 geothermal, 2004 V1: 131 +high-pressure steam, 2004 V1: 9 low-pressure steam, 2004 V1: 9, 15 +medium-pressure steam, 2004 V1: 9, 15 overview, 2000 V3: 175 +references, 2000 V3: 197 sizing pipes, 2000 V3: 177 +steam atmospheric vents, 2004 V1: 9 steam tables, 2000 V3: 176 +steam traps. See steam traps +system classifications, 2000 V3: 175–189 condensate return methods, 2000 V3: 186–189 operating pressure range, 2000 V3: 175–178 piping arrangement classifications, 2000 V3: +178–186 +waste heat usage of condensate, 2004 V1: 131–134 steam deaerators, 1999 V2: 294 +steam-fired water heaters, 2004 V1: 130 steam heat exchangers, 2000 V3: 121 steam plants, 1999 V2: 147 + +363 + + +steam traps, 2000 V3: 182–186 collection legs and, 2000 V3: 191 oversizing, 2000 V3: 191, 196 parallel trapping, 2000 V3: 196 pressure differentials, 2000 V3: 191 seat pressure ratings, 2000 V3: 193 strainers, 2000 V3: 195 +symbol, 2004 V1: 11 steam vaporizers, 2000 V3: 61 steatite fixtures, 2003 V4: 2 +steel. See also stainless steel; steel piping +beam connections in pipe bracing, 2004 V1: 175, 176 in electromotive force series, 2004 V1: 144 +fittings, 1999 V2: 196 fixtures, 2003 V4: 2 +floor decks in earthquakes, 2004 V1: 167 in galvanic series, 2004 V1: 141 +roofing drains, 1999 V2: 82 springs, 2004 V1: 204, 208 +steel substrate roofing drains, 1999 V2: 82 storage tanks, 2000 V3: 155 +underground tanks, 2000 V3: 172 water tanks, 1999 V2: 247 +Steel Above Ground Tanks for Flammable and Combustible Liquids (UL 142), 2000 V3: 95, 154, 165 +steel fixtures, 2003 V4: 2 +steel piping. See also galvanized-steel piping; stainless-steel piping +dimensions, 2003 V4: 51–55 fittings, 2003 V4: 48 +fuel-product dispensing, 2000 V3: 169 liquefied petroleum gas, 1999 V2: 196 Manning formula and, 2000 V3: 245 natural gas, 2000 V3: 254 +radioactive wastes, 1999 V2: 341 sizing, 1999 V2: 89–92 +surface roughness, 1999 V2: 122 types, 2003 V4: 48, 51–55 +water systems, 1999 V2: 250 +Steel Tank Institute (STI), 2000 V3: 154 +Steel Tanks for Oil Storage (API 250), 2000 V3: 95 +Steel Underground Tanks for Flammable and Combustible Liquids (UL 58), 2000 V3: 95 +Steele, Alfred, 2004 V1: 40, 1999 V2: 114 Stenzel, Mark H., 1999 V2: 325 +step heaters, 2000 V3: 144 steradians, 2004 V1: 33 sterilization +feed water, 1999 V2: 289 +infectious waste systems, 1999 V2: 345 pure water systems, 1999 V2: 324 ultraviolet, 2000 V3: 47 +sterilizers, 2000 V3: 36, 38, 39 +Stevens Institute of Technology, 1999 V2: 65 +Stevens’s Building Technology Research Laboratory, 1999 V2: 49 +STI (Steel Tank Institute), 2000 V3: 154 sticking (manual tank gauging), 2000 V3: 159 stilling wells, 2000 V3: 124 +stills, 1999 V2: 295–298, 2000 V3: 39, 46 STM (standard time meridian), 2004 V1: 16 stop levers in showers, 2004 V1: 136 +364 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +stop valves, 2004 V1: 30, 2000 V3: 33 storage +costs, 2004 V1: 223 +fire hazard evaluation, 2000 V3: 2 of gray water, 1999 V2: 23, 26, 27 of medical gases +medical compressed air, 2000 V3: 65–68 nitrogen, 2000 V3: 68 +nitrous oxide, 2000 V3: 64–65 oxygen, 2000 V3: 59–63 +of pure water, 1999 V2: 323–324 of rainwater, 1999 V2: 93–94 +section in specifications, 2004 V1: 70, 89–90 of sewage in septic tanks, 1999 V2: 228–229 +storage plants, 1999 V2: 147, 2003 V4: 20 storage reservoirs, 2000 V3: 90 +storage rooms, 2000 V3: 73 storage tanks. See tanks +stores, numbers of fixtures for, 2003 V4: 20 +storm building drains. See storm-drainage systems Storm Drainage Design and Detention using the Rational +Method, 1999 V2: 114 +storm drainage pipe codes, 2004 V1: 42 +storm-drainage systems, 2000 V3: 240–248. See also rainwater and precipitation +building drainage systems, 1999 V2: 68–94 calculations, 2000 V3: 244–245 +cast-iron soil-pipe building drains, 2003 V4: 27 codes, 2004 V1: 42–44, 2000 V3: 240 controlled-flow systems, 1999 V2: 88, 93–94 design criteria, 1999 V2: 68–69 +design storms, 2000 V3: 242 disposal methods, 2000 V3: 245–247 +drywells, 2000 V3: 247 +existing flow paths, 2000 V3: 247 +limited-discharge roof drains, 2000 V3: 247 public sewers, 2000 V3: 245–247 +recharge basins, 2000 V3: 247 retention basins, 2000 V3: 247 +equations, 1999 V2: 107–108 +forms for calculations, 1999 V2: 109–113 green roof designs, 2004 V1: 266 +green uses of, 2004 V1: 264 introduction, 1999 V2: 67–68 materials, 1999 V2: 68 overview, 2000 V3: 240 +pipe sizing and layout, 1999 V2: 69 preliminary information, 2000 V3: 215–216 +Rational method, 2004 V1: 7, 1999 V2: 95, 98, 107, 2000 V3: 242–244 +reinforced concrete pipe building drains, 2003 V4: 32 roof drainage, 1999 V2: 79–94 +sample utility letters, 2000 V3: 240 secondary drainage systems, 1999 V2: 70, 79 site drainage, 1999 V2: 95–107 +sizing, 2000 V3: 244–245, 246 sizing ditches, 2000 V3: 247–248 storm drains (SD, ST), 2004 V1: 8 storm sewers defined, 2004 V1: 30 +storm water in pools and fountains, 2000 V3: 110 swimming pool water and, 2000 V3: 131, 139 +Storm Water Retention Methods, 1999 V2: 114 + +STPs (sewage treatment plants), 1999 V2: 22, 24, 147 straight lobe compressors, 2000 V3: 202 +strain, defined, 2004 V1: 30 strainers +backflow preventers, 1999 V2: 149 basket strainers. See basket strainers downspouts, 1999 V2: 81 +fountain pumps, 2000 V3: 116 pressure losses, 2000 V3: 224 roof drains, 1999 V2: 80, 82 +sanitary drainage systems, 1999 V2: 10–12 sediment buckets, 1999 V2: 12 +steam traps, 2000 V3: 195 symbols for, 2004 V1: 10 +strata of sites, 1999 V2: 101 +stratification in water heaters, 1999 V2: 160, 165 stray current corrosion, 2004 V1: 141, 154 stream-spray irrigation sprinklers, 2000 V3: 103 +streamline fittings (avoiding suds formation), 1999 V2: 37 streams, irrigation systems and, 1999 V2: 27 +street gutters, 1999 V2: 99 +street inlets in site storm systems, 1999 V2: 98 stress +conversion factors, 2004 V1: 36 measurements, 2004 V1: 33 +stress-accelerated corrosion, 2004 V1: 154 stress corrosion, 2004 V1: 154 +stress-corrosion cracking, 2004 V1: 141, 154, 1999 V2: 290 strip-chart recorder water meters, 1999 V2: 116 +strip methods in pipe manufacturing, 2003 V4: 32 strong-base regeneration, 1999 V2: 302, 305 strongbacks, 2004 V1: 163 +strontium 90, 1999 V2: 340 +structural angle bracing, 2004 V1: 171 structural channel bracing, 2004 V1: 171 structural strength +bath and shower seats, 2004 V1: 122–123 grab bars, 2004 V1: 122 +structure-borne sound, 2004 V1: 196, 199 strut bracing, 2004 V1: 173, 175 +styrofoam blocking on glass pipe, 2003 V4: 47 sub-micron cartridge filtration, 1999 V2: 300 sub-sterilizing rooms, 2000 V3: 32, 36 subdrains, building, 2004 V1: 20 +submain sewers, 2004 V1: 30 submersible pumps +fountain display pumps, 2000 V3: 113 protection of wells, 1999 V2: 243 shallow wells, 1999 V2: 247 +sizing, 2000 V3:170 +underground storage tanks, 2000 V3: 164 well pumps, 1999 V2: 245 +submittals section in specifications, 2004 V1: 69, 88–89 subsoil drainage pipe, 2004 V1: 44 +subsoil drains (SSD), 2004 V1: 8, 30 substances, amount (moles), 2004 V1: 33 substituting products +in proprietary specifications, 2004 V1: 68 value engineering process and, 2004 V1: 211 +subsurface drainage +determining quantities of water, 1999 V2: 100 filter materials, 1999 V2: 103–104 +Index + + +ground water disposal, 1999 V2: 105 site drainage, 1999 V2: 99–105 +site investigation, 1999 V2: 100 trenching, 1999 V2: 102–103 types of piping, 1999 V2: 102 +subsurface drip irrigation systems, 1999 V2: 27 subsurface obstructions, swimming pool locations and, +2000 V3: 128 +subsurface waste-disposal systems. See soil-absorption sewage systems +subsurface water. See ground water SUC (suction), 2004 V1: 16 +successive leaching trenches, 1999 V2: 223–224 suct., SUCT (suction), 2004 V1: 16 +suction (suct., SUCT, SUC), 2004 V1: 16 suction basket strainers, 2000 V3: 115 suction diffusers, 2000 V3: 116 +suction fuel-delivery systems, 2000 V3: 162–163 suction inlets +in fountains, 2000 V3: 117 +in storage tanks, 1999 V2: 248 +suction piping, 2004 V1: 202, 1999 V2: 248, 249, 2000 V3: 117 +suction sand filters, 2000 V3: 134 suction screens, 2000 V3: 116 +suction-type pumps, 1999 V2: 241, 245 suds +factors in trap seal loss, 1999 V2: 36 pressure zones, 1999 V2: 37, 38, 39 relief vents, 1999 V2: 37, 39 +sovent single-stack plumbing systems and, 1999 V2: 54 venting, 1999 V2: 36–37, 39 +sulfate-reducing bacteria, 1999 V2: 282 sulfates, 1999 V2: 281, 283, 302 sulfides, 2004 V1: 146 +sulfites, 1999 V2: 281, 315, 2000 V3: 147 sulfur, 1999 V2: 281 +sulfur-based joint compound, 1999 V2: 223 sulfur dioxide, 2000 V3: 93 +sulfuric acid +pool chemicals, 2000 V3: 150 in regeneration, 1999 V2: 305 +special wastes, 1999 V2: 332–333 storage tanks, 2000 V3: 91–92 +in water chemistry, 1999 V2: 281 sulfurous acid, 1999 V2: 281 +SUM (summary, summation), 2004 V1: 16 summary section in specifications, 2004 V1: 69, 88 summary, summation (SUM), 2004 V1: 16 +sumps and sump pumps +acoustic problems, 2004 V1: 197 containment sumps, 2000 V3: 156 duplex sump pump systems, 1999 V2: 9 fixture-unit values, 1999 V2: 9 +flexible pipe connectors, 2000 V3: 169 floor drains and, 1999 V2: 10 +ground water disposal, 1999 V2: 105 +liquid-waste decontamination systems, 1999 V2: 344 pool mechanical spaces, 2000 V3: 111 +roof drainage and, 1999 V2: 79, 80, 88 sanitary drainage systems, 1999 V2: 9 storm drains and, 1999 V2: 69 + +365 + + +subsurface water disposal, 1999 V2: 106 sump pits, 1999 V2: 344, 2000 V3: 111 sump pumps defined, 2004 V1: 30 sumps defined, 2004 V1: 30 +vibration isolation, 2004 V1: 208 Sun, T.Y., 2004 V1: 191 +sunlight +protecting against, 1999 V2: 19, 2000 V3: 116, 165 solar energy. See solar energy +SUP (supplies), 2004 V1: 16 superchlorination, 2000 V3: 147, 148, 149 +supercritical flow, 1999 V2: 67. See also hydraulic jumps in flow +Superfund Amendment and Reauthorization Act of 1986 (SARA Title III), 2000 V3:88, 2000 V3: 154 +superstrut bracing, 2004 V1: 170 supervised heat-up, 2000 V3: 191, 194 supervisory (tamper) switches, 2004 V1: 30 supplementary conditions, 2004 V1: 62 +supplementary units of measurement, 2004 V1: 33 supplies (sply., SPLY, SUP) +abbreviations, 2004 V1: 16 +ongoing and one-time costs, 2004 V1: 223 supply air (sa, SA), 2004 V1: 16 +supply fixture units, 2004 V1: 24 supply valves, 2000 V3: 179 +support mats in filtration, 2000 V3: 134 supports and hangers +alternate attachment to hangers, 2004 V1: 174 clean agent gas pipes, 2000 V3: 24 +codes, 2004 V1: 43 defined, 2004 V1: 30 +hanger rod connections in bracing, 2004 V1: 17l hanger rod gravity forces in earthquakes, 2004 V1: 186 installation productivity rates, 2004 V1: 96 +isolation hangers, 2004 V1: 203 materials, 2004 V1: 43 +medical gas piping, 2000 V3: 73 natural gas pipes, 1999 V2: 176 resilient pipe hangers, 2004 V1: 199 roof drainage, 1999 V2: 88 +in sanitary drainage systems, 1999 V2: 14 sprinkler systems, 2000 V3: 15 +symbols for, 2004 V1: 13 +vacuum cleaning tubing, 1999 V2: 269 SUR (surfaces), 2004 V1: 16 +SURD (surfaces, dry), 2004 V1: 16 surface abrasions +corrosion and, 2004 V1: 146 grab bars, 2004 V1: 122 +surface efficiency (SEFF), 2004 V1: 14 surface evaporation, 2000 V3: 121 surface fault slips, 2004 V1: 158 surface fires, 2000 V3: 19 +surface-mounted pumps, 1999 V2: 245 surface runoff. See runoff +surface skimmers. See skimmers +surface-type sprinkler spray heads, 2000 V3: 101 surface water +as feed water for pure water systems, 1999 V2: 321 defined, 1999 V2: 282 +discharge permits for, 2000 V3: 89 +366 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +private water systems, 1999 V2: 239 pumps for, 1999 V2: 245 +Surface Water Treatment Rule, 1999 V2: 316 surfaces (SUR, S) +dry (SURD), 2004 V1: 16 fixture materials, 2003 V4: 1 symbols for, 2004 V1: 16 +wet (SURW), 2004 V1: 16 +surge chambers, 2000 V3: 142, 143, 212 +surge loads in wet-vented systems, 1999 V2: 45–46 surge pits, 2000 V3: 108, 109 +surge pressure. See water hammer +surge tanks, 1999 V2: 27, 2000 V3: 137, 140 surges +in horizontal drains, 1999 V2: 5 pressure surges, 1999 V2: 35 swimming pool pumps, 2000 V3: 139 vacuum surges, 1999 V2: 35 +surgical ceiling columns, 2000 V3: 57–58 surgical clean-up areas, 2000 V3: 32 surgical gas track systems, 2000 V3: 58–59 surgical instruments, 2000 V3: 59, 68 surgical scrub areas, 2000 V3: 32 +surgical supply areas, 2000 V3: 32 surgical vacuum (SV), 2004 V1: 9 +surveys in plumbing cost estimation, 2004 V1: 93 SURW (surfaces, wet), 2004 V1: 16 +suspended equipment +fixed suspended equipment, 2004 V1: 164 +vibration-isolated, suspended equipment, 2004 V1: 166 suspended metals in wastes, 2000 V3: 93 +suspended piping, earthquake recommendations, 2004 V1: 162 +suspended solids defined, 1999 V2: 280 +filtration, 1999 V2: 298 removing, 1999 V2: 294 +total suspended solids, 1999 V2: 287–288 turbidity, 1999 V2: 282 +suspended tanks, 2004 V1: 162 suspension, defined, 1999 V2: 280 sustainable design, 2004 V1: 263–267 +Sustainable Sites design (LEED), 2004 V1: 263 SV (service) cast-iron soil pipe, 2003 V4: 27, 30–31 SV (surgical vacuum), 2004 V1: 9 +swamp gas, 1999 V2: 284 sway bracing +acceptable types, 2004 V1: 187 horizontal loads for, 2004 V1: 185–186 +lateral and longitudinal, 2004 V1: 181–182, 185–186 longitudinal and transverse, 2004 V1: 179, 180 potential problems, illustrated, 2004 V1: 189 +sway in piping, 2004 V1: 162 +swelling characteristics of soils, 1999 V2: 219 swimming pools +applying standards to reflecting pools, 2000 V3: 107 components and materials +backwash pits, 2000 V3: 143 cleaning equipment, 2000 V3: 146 +filtration systems, 2000 V3: 131–137, 139–140, 143–144 +fittings, 2000 V3: 137, 144, 145 + +flow indicators, 2000 V3: 142 gutters, 2000 V3: 142 heaters, 2000 V3: 144–145 ladders, 2000 V3: 145 +main drains, 2000 V3: 143 piping, 2000 V3: 145 pumps, 2000 V3: 140–142 +skimmers, 2000 V3: 142, 146 surge chambers, 2000 V3: 143 underwater lights, 2000 V3: 145 +vacuum cleaning lines, 2000 V3: 144 valves and pumps, 2000 V3: 145–146 water heaters, 2000 V3: 138–139, 146 water supply and drainage, 2000 V3: 131 +defined, 2004 V1: 30 +design parameters, 2000 V3: 127–130 bathhouses, toilets, and showers, 2000 V3: 130 location, 2000 V3: 128 +physical characteristics, 2000 V3: 128–130 size and capacity, 2000 V3: 127–128 +disinfection, 2000 V3: 148–151 algaecides, 2000 V3: 150 +aluminum sulfate, 2000 V3: 149–150 breakdown chlorination, 2000 V3: 149 calcium hypochlorite, 2000 V3: 148–149 +chemical feeding equipment, 2000 V3: 150–151 chlorine gas, 2000 V3: 148 +cleaning filters, 2000 V3: 150 cyanurates, 2000 V3: 149 +filtration turnover rates, 2000 V3: 140 sodium hypochlorite, 2000 V3: 149 sulfuric acid, 2000 V3: 150 superchlorination, 2000 V3: 149 +grate materials, 1999 V2: 15 +heat loss retardants, 2000 V3: 150 indoor and outdoor pools, 2000 V3: 139 numbers of fixtures for, 2003 V4: 19 numbers of swimmers, 2000 V3: 127–128 overview, 2000 V3: 127 +references, 2000 V3: 151 resources, 2000 V3: 151 sequestering agents, 2000 V3: 150 water chemistry, 2000 V3: 146–148 +mineral deposits, 2000 V3: 147–148 pH values, 2000 V3: 147 +water supply, 2000 V3: 131 +Swimming Pools: A Guide to their Design and Operations, 2000 V3: 151 +swing check valves, 1999 V2: 249, 2000 V3: 118 switch-gear rooms, 2000 V3: 73 +SWRO (spiral wound modules), 1999 V2: 289, 309 SYGEF piping, 2000 V3: 48 +symbols +fire protection, 2004 V1: 12–13 references, 2004 V1: 40 +standardized plumbing and piping symbols, 2004 V1: 7–13 +Synthesis phase in value engineering, 2004 V1: 213 synthetic fiber gas filters, 2000 V3: 250 +synthetic resins, 1999 V2: 302 SYS (systems), 2004 V1: 16, 137 +system descriptions in specifications, 2004 V1: 69, 88 +Index + + +system performance criteria in specifications, 2004 V1: 69, 88 +Systeme International and d’Unites, 2004 V1: 32 systems (SYS) +defined, 2004 V1: 137 diagramming, 2004 V1: 231 symbols for, 2004 V1: 16 +value engineering questions, 2004 V1: 213–214 + +T +t (metric tons), 2004 V1: 34 +T STAT (thermostats), 2004 V1: 16 +Ät, TD (temperature differences), 2004 V1: 16, 136 T (temperature). See temperature +T (tera) prefix, 2004 V1: 34 T (teslas), 2004 V1: 33 +T (time). See time +T-Y fittings, 1999 V2: 61 +tab, TAB (tabulation), 2004 V1: 16 table salt, 2000 V3: 150 +tablespoons, converting to SI units, 2004 V1: 40 tabular take-off sheets, in cost estimations, 2004 V1: 94 tabulation (tab, TAB), 2004 V1: 16 +take-off estimating method, cost estimating, 2004 V1: 94–95 +Take the Guesswork out of Demineralizer Design, 1999 V2: 325 +tamper switches, 2004 V1: 30 tamping fill +leaching trenches, 1999 V2: 223 sewers, 1999 V2: 16 +subsurface drainage pipes, 1999 V2: 102, 103 water pipes, 1999 V2: 250 +Tanaka, T., 1999 V2: 325 +tangential-flow filtration, 1999 V2: 300, 308 tank-mounted product dispensers, 2000 V3: 168 tank-refilling acoustics, 2004 V1: 194 +tank-type water closets, 2004 V1: 135–136 tank-type water heaters, 2004 V1: 129 tankless water heaters, 2004 V1: 129–130 tanks. See also septic tanks +aboveground tanks, 2000 V3: 90–91, 165–169 connections and access, 2000 V3: 166 construction, 2000 V3: 165 +corrosion protection, 2000 V3: 165 filling and spills, 2000 V3: 166–167 +leak prevention and monitoring, 2000 V3:167–168 materials, 2000 V3: 165 +overfill prevention, 2000 V3:167 +product dispensing systems, 2000 V3:168 tank protection, 2000 V3:169 +vapor recovery, 2000 V3:168 venting, 2000 V3:167 +carbon dioxide extinguishing systems, 2000 V3: 20, 21 cryogenic, 2000 V3: 62 +determining demand and capacity, 1999 V2: 151 distilled water systems, 2000 V3: 46 +drinking water storage, 1999 V2: 247–248 earthquake damage, 2004 V1: 161, 162 earthquake protection, 2004 V1: 163–164, 188, 189 fire-protection supplies, 2000 V3: 226 +gauges, 2000 V3: 166 + +367 + + +gravity tank systems, 1999 V2: 150–152 hazardous waste incompatibilities, 2000 V3: 90, 91 holding tanks +for firefighting drainage, 1999 V2: 347 for radioactive wastes, 1999 V2: 342 +hydropneumatic-tank systems, 1999 V2: 150 kill tanks, 1999 V2: 344–345 +liquefied natural gas tanks, 1999 V2: 194 liquid fuel tanks +connections and access, 2000 V3: 156–157 construction, 2000 V3: 156 +filling and spills, 2000 V3: 156–157 installation, 2000 V3:172 materials, 2000 V3: 155–156 overfill prevention, 2000 V3: 158 venting, 2000 V3: 157–158 +protection, 2000 V3:169 settling tanks, 2000 V3: 93 +storage tanks defined, 2000 V3: 153 suspended, 2004 V1: 164 +tank end deflection, 2000 V3: 172 tank farms, 2004 V1: 150 +thermal expansion tanks, 1999 V2: 167 +tightness testing, 2000 V3: 161–162, 171, 2000 V3:172, 2000 V3: 172 +underground tanks, 2000 V3: 90–91 illustrated, 2000 V3: 164 +liquid fuel tanks, 2000 V3: 155–158 venting, 2000 V3: 157–158, 166, 2000 V3:167 vibration isolation, 2004 V1: 205 +water storage tanks, 1999 V2: 239, 323–324, 2000 V3: 44 +tannin in water, 2000 V3: 147 +tapping illegally into water lines, 1999 V2: 115 tappings for cast iron radiators, 2000 V3: 179 taps +large wet tap excavations, 2000 V3: 222 pressure loss and, 2000 V3: 221 +target areas in water closets, 2003 V4: 4 taste of drinking water, 1999 V2: 245, 316 TAU (transmissivity), 2004 V1: 16 +taverns and bars, numbers of fixtures for, 2003 V4: 19, 22 taxes +in labor costs, 2004 V1: 94 +in plumbing cost estimation, 2004 V1: 94 tc, TC (thermocouple), 2004 V1: 16 Tchobanoglous, George, 2000 V3: 125 +TCPL (thermocouple), 2004 V1: 16 +TD (temperature differences), 2004 V1: 16, 136 TD (turndown ratio), 1999 V2: 182 +TDIF (temperature differences), 2004 V1: 16 TDS (total dissolved solids), 1999 V2: 288, 316 TE (temperature entering), 2004 V1: 16 teaspoons, converting to SI units, 2004 V1: 40 technetium 99, 1999 V2: 340 +technology advances, value engineering and, 2004 V1: 212 Technology for the Storage of Hazardous Liquids, 2000 V3: +96 +tectonic plates, 2004 V1: 156–158 +tee-wyes, flow capacity and, 1999 V2: 4 tees (TEE), 2004 V1: 10, 16 +Teflon, 1999 V2: 341, 2000 V3: 42 +368 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +temp., TEMP (temperatures). See temperature TEMP. HW (tempered hot water), 2004 V1: 8 +TEMP. HWR (tempered hot water recirculating), 2004 V1: 8 +temperature (temp., TEMP, T) acid wastes, 2000 V3: 40 +bathtub water notes, 2004 V1: 119 cast iron radiators, 2000 V3: 180 +compressed air systems and, 2000 V3: 211 conversion factors, 2004 V1: 37, 38 cooling air compressors, 2000 V3: 202 corrosion rates and, 2004 V1: 145 +CPVC vs. PVC piping, 2003 V4: 62 deaeration water temperatures, 1999 V2: 294 dew points, 2000 V3: 201 +feed water temperature and deposits, 1999 V2: 291, 312, 321–322 +flue gas temperatures, 1999 V2: 178 +high-temperature withstand for hot-water systems, 1999 V2: 166 +hot-water properties, 1999 V2: 168 +hot-water relief valves, 1999 V2: 166–167 +hot-water temperatures, 1999 V2: 159, 161–165, 165, 2000 V3: 36, 45 +maintenance hot-water temperatures, 1999 V2: 166 measurements, 2004 V1: 33 +microbial control in water, 1999 V2: 312 mixed-water temperatures, 1999 V2: 159–160 natural gas, 1999 V2: 179, 180 +non-SI units, 2004 V1: 34 +operating hot-water temperatures, 1999 V2: 166 pipe expansion and contraction, 2004 V1: 3 +PVC pipe and, 2003 V4: 62 +rate of rise detection, 2000 V3: 13 scalding water, 1999 V2: 169–170 +shower compartments, 2004 V1: 120, 2003 V4: 15 special-waste effluent, 1999 V2: 328 +specific resistance and, 1999 V2: 286 sprinkler head ratings, 2000 V3: 17 storage tanks and piping, 2000 V3: 172 stratification, 2000 V3: 172 +swimming pools, 2000 V3: 139 symbols for, 2004 V1: 16 +temperature differences (TD, )t, TDIF), 2004 V1: 16, 136 +temperature differentials, 2004 V1: 125–126 temperature entering (TE, TENT), 2004 V1: 16 temperature leaving (TL, TLEA), 2004 V1: 16 temperature stratification, 2000 V3: 172 +thermal support systems and earthquakes, 2004 V1: 168 +water heaters, 1999 V2: 157, 160 +water vapor in air and, 2000 V3: 200–201 Temperature Limits in Service Hot Water Systems, 1999 +V2: 170 +temperature-pressure-relief valves (TPV), 2004 V1: 10, 1999 V2: 166, 167 +temperature stratification, 2000 V3: 172 tempered water +defined, 2004 V1: 30 +tempered hot water (TEMP. HW, TW), 2004 V1: 8 + +tempered hot water recirculating (TEMP. HWR, TWR), 2004 V1: 8 +tennis courts, numbers of fixtures for, 2003 V4: 19 tensile strength +plastic pipe, 2003 V4: 60 PVC pipe and, 2003 V4: 62 +Tension 360 bracing, 2004 V1: 169 +tension problems in seismic protection, 2004 V1: 190 TENT (temperature entering), 2004 V1: 16 Tentative Provisions for the Development of Seismic +Regulations for Buildings, 2004 V1: 183, 191 “tera” prefix, 2004 V1: 34 +terminal elements, defined, 2004 V1: 137 terminal length, defined, 1999 V2: 1 terminal velocity +defined, 1999 V2: 1 +stack capacities and, 1999 V2: 4 stack terminal velocity, 2004 V1: 3 +terminal vents. See vent stack terminals terminals, passenger, 2003 V4: 19 termites, 2000 V3: 116 +tertiary treatment of gray water, 1999 V2: 28, 29 teslas, 2004 V1: 33 +test block conditions in gas boosters, 1999 V2: 182 test fittings, 2000 V3: 195 +test headers, 2004 V1: 12 +test-method standards, 2004 V1: 66 +test station cathodic protection, 2004 V1:151 testing +acoustic ratings of fixtures and appliances, 2004 V1: 194–195 +cold-water systems, 1999 V2: 154 fountain piping systems, 2000 V3: 117 +gaseous fire-suppression systems, 2000 V3: 24–25 hot-water relief valves, 1999 V2: 166 +hydrants, 2000 V3: 4 +hydraulic soil conditions, 1999 V2: 217–220 liquefied petroleum gas systems, 1999 V2: 197 liquid fuel systems, 2000 V3:170–172 +medical-gas alarms, 2000 V3: 81 medical-gas systems, 2000 V3: 77–83 natural gas services, 2000 V3: 252, 253 +percolation rates for soils, 1999 V2: 219–220 pipes for radioactive waste systems, 1999 V2: 342 plastic fixtures, 2003 V4: 2 +swimming pools, 2000 V3: 131 +tank tightness testing, 2000 V3: 161–162, 171, 2000 V3:172, 2000 V3: 172 +urinal tests, 2003 V4: 9 +water closet flushing, 2003 V4: 5–6 +welders for radioactive pipe systems, 1999 V2: 342 wells, 1999 V2: 243 +tetrafluoroethylene (TFE), 2003 V4: 48 text, abbreviations in, 2004 V1: 14–16 texture of soils, 1999 V2: 218 +theaters +numbers of fixtures for, 2003 V4: 19, 21 vacuum calculations for, 1999 V2: 269 +theft of backflow preventers, 1999 V2: 149 theoretical barometric pressure, 2000 V3: 200 +theoretical standard atmospheric pressure, 2000 V3: 200 therapy pools, 2000 V3: 128 +Index + + +therm, converting to SI units, 2004 V1: 40 thermal conductivity (k, K) +measurements, 2004 V1: 33 plastic pipe, 2003 V4: 60 symbols for, 2004 V1: 16 +thermal efficiency +defined, 2004 V1: 30, 136 +water heaters and, 1999 V2: 169 thermal expansion +converting to SI units, 2004 V1: 39 +hot-water systems and, 1999 V2: 167–168 plastic pipe thermal expansion, 1999 V2: 251 sanitary drainage systems, 1999 V2: 18 +thermal expansion coefficients (TXPC), 2004 V1: 16 thermal expansion tanks, 1999 V2: 167 +water pipes and, 1999 V2: 251–252 thermal expansion loops, 2004 V1: 162 +thermal-hydraulic irrigation valves, 2000 V3: 103 thermal insulation thickness, 2004 V1: 127 +thermal movement, sound insulation and, 2004 V1: 193 thermal resistance (R, R, RES), 2004 V1: 16 +thermal-shock protection, 2004 V1: 120 +thermal stability for hot-water systems, 1999 V2: 166 thermal-support systems, earthquakes and, 2004 V1: 168 thermocompression distillation, 1999 V2: 295–298 thermocouple (tc, TC, TCPL), 2004 V1: 16 +thermodisc traps, 2000 V3: 182, 186 thermodynamic steam traps, 2000 V3: 182, 194 thermometers, 2004 V1: 10 +thermoplastic pipes, 2003 V4: 58 +thermoset plastic, 2000 V3: 155, 2003 V4: 58 thermostatic bellows, 2000 V3: 182 +thermostatic-mixing shower valves, 2003 V4: 15, 18 thermostatic-mixing tub valves, 2003 V4: 16 thermostatic radiator vents, 2000 V3: 179 thermostatic steam traps, 2000 V3: 182, 186, 194, 196 thermostats (T STAT), 2004 V1: 16 +thickness (thkns, THKNS, THK) of soils, 1999 V2: 219 symbols for, 2004 V1: 16 +Thickness Design, 2003 V4: 32 thinking outside the box, 2004 V1: 232 +THK (thickness), 2004 V1: 16, 1999 V2: 219 +thkns, THKNS (thickness), 2004 V1: 16, 1999 V2: 219 thousand circular mils (Mcm, MCM), 2004 V1: 16 thousand cubic feet (Mcf, MCF), 2004 V1: 16 +thousand foot-pounds (kip ft, KIP FT, KIPFT), 2004 V1: 16 +thousand pounds (kip, KIP), 2004 V1: 16 threaded end connections, 2004 V1: 23 threaded joints, 2004 V1: 167 +threaded outlets, 1999 V2: 18 +three-compartment sinks, 2003 V4: 11, 12 thresholds in shower compartments, 2004 V1: 120 throttling damper devices, 2000 V3: 144 throttling valves, 2000 V3: 118, 140, 144 +thrust bearings, 2004 V1: 196 +thrust blocks, 1999 V2: 250–251, 2000 V3: 231 tie-in tests, 2000 V3: 82 +tie rods, 2000 V3: 229 +“tight” piping systems, 2004 V1: 168 tightness testing, 2000 V3: 161–162, 171, 172 + +369 + + +tiles in leaching trenches, 1999 V2: 221 time (T) +clean agent gas fire suppression, 2000 V3: 23 +of concentration in runoff, 1999 V2: 97, 2000 V3: 244 in creativity checklist, 2004 V1: 234 +intervals in hydraulic shock, 2004 V1: 6 in measurements, 2004 V1: 33 +non-SI units, 2004 V1: 34 symbols for, 2004 V1: 16 time in pipes, 2000 V3: 244 +time-temperature curves in fire tests, 2000 V3: 3 time delays +clean gas extinguishing systems, 2000 V3: 24 fountain relays, 2000 V3: 120–121 +time history +computer analysis, 2004 V1: 186 earthquakes, 2004 V1: 159, 160 +time switches for fountains, 2000 V3: 121 tin +corrosion, 2004 V1: 139 galvanic series, 2004 V1: 141 piping, 1999 V2: 122 +tin-lined copper pipes, 2000 V3: 47 tipping prevention, 2004 V1: 189 tissue-culture rooms, 2000 V3: 45 +titanium, 2004 V1: 141, 144, 2000 V3: 20 TL (temperature leaving), 2004 V1: 16 TLEA (temperature leaving), 2004 V1: 16 TOC (total organic carbon), 1999 V2: 288 +toe clearance in toilet compartments, 2004 V1: 113, 114 toilet compartments. See water-closet compartments toilet paper +dispensers, 2004 V1: 114 +in septic tanks, 1999 V2: 231 toilets. See also water closets +composting, 2004 V1: 265 incinerating, 2004 V1: 265 +tolerance, 2004 V1: 32 tons (TON) +converting to SI units, 2004 V1: 40 symbols for, 2004 V1: 16 +tons of refrigeration (tons, TONS), 2004 V1: 16 tools +tool access in cleanouts, 1999 V2: 9 +for vacuum cleaning systems, 1999 V2: 269–270 top coats, 2004 V1: 147 +top-entry fittings in sovent systems, 1999 V2: 62 top-spud water closets, 2003 V4: 3, 8 +torch testing, 2003 V4: 2 Toro Company, 2000 V3: 105 torque +conversion factors, 2004 V1: 35 converting to SI units, 2004 V1: 39 measurements, 2004 V1: 33 +torrs, 1999 V2: 254 +TOT HT (total heat), 2004 V1: 16 total (TOT), 2004 V1: 16 +total alkalinity, 1999 V2: 283 +total connected loads, 2000 V3: 50, 249, 253 total costs +defined, 2004 V1: 222 generalized, 2004 V1: 223 +370 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +total dissolved solids (TDS), 1999 V2: 288, 316, 2000 V3: 123 +total dynamic head, 1999 V2: 245 total flooding systems +carbon dioxide systems, 2000 V3: 20 defined, 2004 V1: 26 +dry-chemical extinguishing systems, 2000 V3: 19 total head, 1999 V2: 245 +total heat (tot ht, TOT HT), 2004 V1: 16 total organic carbon (TOC), 1999 V2: 288 total pumping head, 1999 V2: 245 +total suspended solids, 1999 V2: 287–288 +total work force in vacuum systems, 1999 V2: 259 towers in standpipe systems, 2000 V3: 19 +T&P valves (temperature and pressure relief), 1999 V2: 166, 167 +TPV (temperature-pressure-relief valves), 2004 V1: 10, 1999 V2: 166, 167 +trace elements in water, 1999 V2: 283–284 +Trace Level Analysis of High Purity Water, 1999 V2: 325 tractor-type grates, 1999 V2: 11 +traffic loads +automotive traffic and grates, 1999 V2: 11 cleanouts and, 1999 V2: 9 +grates and strainers, 1999 V2: 10 trailer parks +septic tank systems for, 1999 V2: 231–232 sewers, 2004 V1: 30 +transfer-type showers, 2004 V1: 121 transferring hazardous wastes, 2000 V3: 90 transition fittings, 2000 V3: 252 +transmissibility, coefficient of (Q factor), 1999 V2: 101 transmission loss (sound), 2004 V1: 209 +transmission of noise, 2004 V1: 199 transmissivity (TAU), 2004 V1: 16 transport trucks, 2000 V3: 61 +Transportation Department. See U.S. Department of Transportation +transportation gas services, 2000 V3: 249 transverse bracing, 2004 V1: 167, 171, 191 transverse sway bracing, 2004 V1: 179 trap arms +defined, 1999 V2: 64 +fixture vents and, 1999 V2: 38, 39 length of, 1999 V2: 50 +trap primers, 1999 V2: 13–14 trap seals +controlling induced siphonage, 1999 V2: 40 defined, 2004 V1: 31, 1999 V2: 64 +factors in trap seal loss, 1999 V2: 36 floor drains, 1999 V2: 10, 2003 V4: 17 maintaining, 1999 V2: 14 +primer devices, 2003 V4: 17 +reduced-size venting and, 1999 V2: 49 reducing trap seal losses, 1999 V2: 39–40 stack venting and, 1999 V2: 47 +tests, 2003 V4: 5 +trap siphonage and, 1999 V2: 35 vents and, 1999 V2: 36 +trapeze +bracing pipes on trapeze, 2004 V1: 175, 178 potential problems in bracing, 2004 V1: 189 + +trapeziums, calculating area, 2004 V1: 4 trapezoids, calculating area, 2004 V1: 4 traps. See also trap seals +building traps, defined, 2004 V1: 19 condensate traps, 2000 V3: 193–195, 195, 196 defined, 2004 V1: 31 +eliminating siphonage with vents, 1999 V2: 35 fixture traps and vents, 1999 V2: 40 +piping arrangement steam classifications, 2000 V3: 182–186 +roof drains, 1999 V2: 84 sink traps, 2000 V3: 42 +special-waste drainage systems, 1999 V2: 328 steam traps, 2000 V3: 180–182 +unvented traps, 1999 V2: 46 urinals, 2003 V4: 9 +vents and, 1999 V2: 36 +TRC (tubular modules in reverse osmosis), 1999 V2: 309, 310 +treated water. See also water treatment defined, 1999 V2: 280 +from reverse osmosis, 1999 V2: 309 systems. See gray-water systems +Treating Cooling Water, 1999 V2: 325 +treatment of black water, 1999 V2: 28, 227, 232–233 treatment of gray water, 1999 V2: 22, 23, 27–29, 28 treatment of oil in water, 1999 V2: 347–349 Treatment of Organic Chemical Manufacturing +Wastewater for Reuse (EPA 600), 2000 V3: 96 treatment rooms +fixtures, 2000 V3: 35 +health-care facilities, 2000 V3: 32 medical gas stations, 2000 V3: 51 medical vacuum, 2000 V3: 54 water demand, 2000 V3: 45 +tree piping systems, 2000 V3: 16 +tree-root problems in leaching trenches, 1999 V2: 222 trench drains +in chemical plants, 1999 V2: 346 defined, 2003 V4: 17 +trenches. See also leaching trenches absorption trenches, 1999 V2: 220 +labor productivity rates, 2004 V1: 95–97 near water pipes, 1999 V2: 250 +sanitary sewer services, 2000 V3: 234, 235 storage tank piping, 2000 V3: 172 +in subsurface drainage, 1999 V2: 102–103 Tri-Services Manual, 2004 V1: 183 +triage rooms, 2000 V3: 35 triangles +calculating area, 2004 V1: 4–5 exercise, 2004 V1: 232, 261 +rule for sink location, 2003 V4: 12 tributary areas for runoff, 1999 V2: 97 trichloroethylene, 2000 V3: 70 +trickle irrigation, 2000 V3: 103 trickling filters, 2000 V3: 95 +triggering clean agent gas fire suppression, 2000 V3: 24 trihalomethanes, 1999 V2: 311 +triplex air compressors, 2000 V3: 213 +triplex vacuum pump arrangements, 1999 V2: 263 trisodium phosphate, 1999 V2: 13 +Index + + +TROs (tubular modules in reverse osmosis), 1999 V2: 309, 310 +troughs for waterfalls, 2000 V3: 109 truss-type bracing, 2004 V1: 190 tsunamis, 2004 V1: 158 +tub fillers, 2003 V4: 16 +tube ozone units, 1999 V2: 313 tube washers, 2000 V3: 37 tuberculation, 2004 V1: 154 tubing +joints, 1999 V2: 196 +liquefied petroleum gas, 1999 V2: 196 vacuum cleaning hose capacity, 1999 V2: 270 vacuum cleaning systems, 1999 V2: 269–270 +tubular-bag separators, 1999 V2: 268 +tubular modules in reverse osmosis, 1999 V2: 309, 310 tunnel chases for swimming pool piping, 2000 V3: 144 turbidity +clarification of, 1999 V2: 294 defined, 1999 V2: 282 drinking water, 1999 V2: 316 measuring, 1999 V2: 287–288 removing, 1999 V2: 244 +turbine pumps, 1999 V2: 246, 247 +turbine water meters, 1999 V2: 115, 116, 117 turbo pumps, 1999 V2: 259 +turbo-surgical instruments, 2000 V3: 59 turbulence +defined, 2004 V1: 31 measurements, 1999 V2: 41 +in rate of corrosion, 2004 V1: 145 turbulent flow in pipes, 2004 V1: 2 +turf imperviousness factors, 2000 V3: 243 turndown ratio (TD), 1999 V2: 182 turnover rates +gutters and, 2000 V3: 142 swimming pools, 2000 V3: 140 +turrets, gas, 1999 V2: 177 +TW (tempered hot water), 2004 V1: 8 +twin-agent dry-chemical systems, 2000 V3: 20 twin-tower air dryers, 2000 V3: 207 +two. See also entries beginning with double-, dual-, or multiple- +two-bed deionizing units, 2000 V3: 46 +two-compartment septic tanks, 1999 V2: 229 two-compartment sinks, 2003 V4: 11, 12 +two-family dwellings, numbers of fixtures for, 2003 V4: 20 two-pipe steam systems, 2000 V3: 178, 180–182, 185, +186–187 +two-pipe venturi suction pumps, 1999 V2: 241 two-point vapor recovery, 2000 V3: 163 +two-stage reduction, 1999 V2: 153 +two-step deionization (dual-bed), 1999 V2: 302, 303 +two-valve parallel pressure-regulated valves, 1999 V2: 153 two-word expressions of functions, 2004 V1: 225, 231 TWR (tempered hot water recirculating), 2004 V1: 8 TXPC (thermal expansion coefficients), 2004 V1: 16 +Type 1 air compressors, 2000 V3: 65, 67 Type 2 air compressors, 2000 V3: 65 +Type A gray-water systems, 1999 V2: 31–32 Type ACR/MED pipes, 2003 V4: 36 +Type ACR pipes, 2003 V4: 36 + +371 + + +Type B gas vents, 1999 V2: 213 +Type B gray-water systems, 1999 V2: 31–32 Type B vent codes, 2004 V1: 43 +Type B-W gas vents, 1999 V2: 213 Type DWV pipes, 2003 V4: 36, 45 Type G copper, 2003 V4: 36 +Type K copper +copper water tube, 2003 V4: 37 dimensions and capacity, 2003 V4: 39–40 fuel-gas piping, 1999 V2: 196 +lengths, standards, and applications, 2003 V4: 35 medical gas tube, 2000 V3: 77, 2003 V4: 45 +Type L copper +cast in columns, 1999 V2: 68 copper water tube, 2003 V4: 37 +dimensions and capacity, 2003 V4: 41–42 fountains, 2000 V3: 119 +lengths, standards, and applications, 2003 V4: 35 medical gas tube, 1999 V2: 196, 2000 V3: 77, 2003 V4: +45 +natural gas, 2000 V3: 254 +pool water heating and, 2000 V3: 122 sizing, 1999 V2: 133 +Type L gas vents, 1999 V2: 214 Type L vent codes, 2004 V1: 43 Type M copper +copper water tube, 2003 V4: 37 dimensions and capacity, 2003 V4: 43–44 +lengths, standards, and applications, 2003 V4: 35 Type OXY/ACR pipes, 2003 V4: 36 +Type OXY, MED pipes, 2003 V4: 36 Type OXY/MED pipes, 2003 V4: 36 + +U +U-factor (U), 2004 V1: 16 +U, U (heat transfer coefficients), 2004 V1: 15 UF membranes, 1999 V2: 284 +UFAS (Uniform Federal Accessibility Standard), 2004 V1: 105–106 +UFC (Uniform Fire Code), 2000 V3: 154 Uhlig, Herbert H., 2004 V1: 154 +UL listings +address, 2004 V1: 59 +gas booster components, 1999 V2: 179 hot-water components, 1999 V2: 166, 170 list of standards, 2004 V1: 57 +pipe hangers, 2000 V3: 15 +ULF. See ultra-low-flow water closets ultra-high vacuum, 1999 V2: 254 +ultra-low-flow fixture green building credits, 2004 V1: 264 ultra-low-flow water closets +operation, 2004 V1: 135–136 +reduced-size venting and, 1999 V2: 19 water usage rates, 2004 V1: 134–135 +ultra-pure water systems, 1999 V2: 317 ultrafilters and ultrafiltration +cross-flow filtration, 1999 V2: 300, 310–311 membrane filters, 1999 V2: 308–311 +oil spills, 1999 V2: 347 +Ultraviolet Disinfection in Biotechnology: Myth vs. Practice, 1999 V2: 325 +372 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +ultraviolet radiation treatment of water, 1999 V2: 245, 311–312, 318, 323, 324 +ultraviolet rays +chlorine and, 2000 V3: 149 PVC pipes, 2000 V3: 116 sterilization, 2000 V3: 47 +swimming pool disinfection, 2000 V3: 150 unassisted creativity, 2004 V1: 232 unbalanced motors in pumps, 2004 V1: 196 unconsolidated aquifers, 1999 V2: 241 undamped mechanical systems, 2004 V1: 160 +under-counter mounted lavatories, 2003 V4: 11 under-counter mounted sinks, 2003 V4: 12 under-film corrosion, 2004 V1: 154 +under-floor areas, 2000 V3: 23 +under-table waste and vent piping, 2000 V3: 42 underdrain systems in sand filters, 2000 V3: 132 underground building sanitary pipe codes, 2004 V1: 44 underground inspections, 2004 V1: 102–103 underground piping +acid-waste piping, 1999 V2: 334 cast-iron soil pipe, 2003 V4: 27 coatings, 2004 V1: 147 +defined, 2004 V1: 31 fountains, 2000 V3: 116 glass pipe, 2003 V4: 47 materials for, 1999 V2: 14–15 +medical gas piping, 2000 V3: 73 natural gas systems, 1999 V2: 176 storm-drainage systems, 1999 V2: 68 +underground building sanitary pipe codes, 2004 V1: 44 water pipes, 1999 V2: 251 +underground pressurized fuel delivery systems, 2000 V3: 162 +underground site drainage, 1999 V2: 99–105 underground sprinklers, 2000 V3: 101 underground storage tanks (USTs) +codes and standards, 2000 V3: 154 defined, 2000 V3: 153 +hazardous wastes, 2000 V3: 90 illustrated, 2000 V3: 164 +liquid fuel storage tanks, 2000 V3: 155–158 connections and access, 2000 V3: 156–157 construction, 2000 V3: 156 +filling and spills, 2000 V3: 156–157 +leak detection and system monitoring, 2000 V3: 158–163 +materials, 2000 V3: 155–156 overfill prevention, 2000 V3: 158 venting, 2000 V3: 157–158 +product dispensing systems, 2000 V3: 163–165 dispenser pans, 2000 V3: 165 +pressure dispensing, 2000 V3: 164 product dispensers, 2000 V3: 164–165 +testing, 2000 V3:171 +vapor recovery systems, 2000 V3: 163 underground suction fuel delivery systems, 2000 V3: +162–163 +underwater lights, 2000 V3: 112, 121, 145 underwriters. See insurance carriers Underwriters Laboratories, Inc. (UL) +address, 2004 V1: 59, 2000 V3: 97 + +gas booster components, 1999 V2: 179 hot-water components, 1999 V2: 166, 170 list of standards, 2004 V1: 57 +pipe hangers, 2000 V3: 15 +UL 58: Steel Underground Tanks for Flammable and Combustible Liquids, 2000 V3: 95 +UL 142: Steel Above Ground Tanks for Flammable and Combustible Liquids, 2000 V3: 95, 154, 165 +UL 2085: Fire Resistance, 2000 V3: 154 unemployment taxes, in labor costs, 2004 V1: 94 ungridded piping systems, 2000 V3: 16 +uniform attack corrosion, 2004 V1: 142 +Uniform Building Code (UBC), 2004 V1: 183, 191 Uniform Federal Accessibility Standard (UFAS), 2004 V1: +105–106 +Uniform Fire Code (UFC), 2000 V3: 154 uniform flow +in horizontal drains, 1999 V2: 6–7 Manning formula, 2004 V1: 1 +Uniform Plumbing Code, 1999 V2: 22, 34, 214, 2003 V4: 18 Uniformat specification system, 2004 V1: 64, 73 uninterrupted water supplies, 2000 V3: 43 +uninterruptible gas services, 2000 V3: 249 unions (joins) +flanged, 2004 V1: 10 screwed, 2004 V1: 10 +unions (labor), cost estimates and, 2004 V1: 98 unisex toilet rooms, 2003 V4: 18, 23 +unit costs, in plumbing cost estimation, 2004 V1: 93 United States agencies and departments. See U.S. agencies +and departments +United States Pharmacopoeia. See U.S. Pharmacopoeia (USP) +units (UNIT) +symbols for, 2004 V1: 16 +units of measurement. See measurement units universities. See also laboratories +diversity factor calculations for vacuums, 1999 V2: 263 natural gas piping, 1999 V2: 177 +unknowns in value engineering presentations, 2004 V1: 258 +unlined piping, 2003 V4: 26 +unloading in air compressors, 2000 V3: 205 unobstructed reach for wheelchairs, 2004 V1: 111, 112 +unoccupied buildings, conserving energy in, 2004 V1: 127 unrestricted areas (facilities with radiation), 1999 V2: 339 unsanitary, defined, 1999 V2: 64 +untreated sewage, 2004 V1: 28 unvented traps (s traps), 1999 V2: 46 +unventilated spaces and gas systems, 1999 V2: 176 upfeed risers, 2000 V3: 185 +uplifting of buildings, 1999 V2: 99 upright sprinklers, 2004 V1: 13, 29, 30 upstream, defined, 2004 V1: 31 upward-tapered weirs, 2000 V3: 109 +Urban Hydrology for Small Watersheds, 1999 V2: 114 urinals. See also water closets +accessibility design, 2004 V1: 116–117 acoustic ratings of, 2004 V1: 194 +Energy Policy Act requirements, 2004 V1: 264 exclusion from gray-water systems, 1999 V2: 21 female, 2003 V4: 9 +Index + + +flushing requirements, 2003 V4: 10 +gray water use, 2004 V1: 267, 1999 V2: 21, 25 health-care facilities, 2000 V3: 32, 33 installation requirements, 2003 V4: 9–10 minimum number for buildings, 2003 V4: 21–22 reducing flow rates, 2004 V1: 134–135 screening, 2003 V4: 10 +specialty urinals, 2004 V1: 136 standards, 2003 V4: 2 +testing, 2003 V4: 9 traps, 2003 V4: 9 types, 2003 V4: 8–9 +typical use, 1999 V2: 25 +ultra low flow, 2004 V1: 135–136 +water fixture unit values, 2000 V3: 217 waterless, 2004 V1: 265, 2003 V4: 10 +U.S. Architectural and Transportation Barriers Compliance Board (ATBCB), 2004 V1: 106, 107 +U.S. Army Corps of Engineers specifications, 2004 V1: 63 +U.S. Army Corps of Engineers Manual, 1999 V2: 214 value engineering, 2004 V1: 211 +U.S. competitive swimming meets, 2000 V3: 128 +U.S. Department of Commerce, National Information Services, 1999 V2: 34 +U.S. Department of Defense, 2004 V1: 161, 185, 191, 212–213 +U.S. Department of Energy Greening Federal Facilities, 2004 V1: 134, 137 +U.S. Department of Health and Environmental Control, 1999 V2: 170 +U.S. Department of Health and Human Services, 2000 V3: 33 +U.S. Department of Housing and Urban Development, 2004 V1: 105, 106 +U.S. Department of the Army, 1999 V2: 114 +U.S. Department of Transportation (DOTn), 2004 V1: 54, 58, 1999 V2: 194, 2000 V3: 88 +U.S. Environmental Protection Agency address, 2000 V3: 173 aggressiveness index, 1999 V2: 292 brass pipe standards, 2003 V4: 27 +chemical waste system codes and, 1999 V2: 345 Effluent Guideline program, 2000 V3: 88–89 industrial waste water defined, 2000 V3:87 +potable water treatment technologies, 1999 V2: 279 publications, 1999 V2: 238 +EPA 440: The EPA Effluent Guidelines Series, 2000 V3: 96 +EPA 600/2-79-130: Activated Carbon Process for Treatment of Wastewater Containing Hexavalent Chromium, 2000 V3: 96 +EPA 600: Treatment of Organic Chemical Manufacturing Wastewater for Reuse, 2000 V3: 96 +regulations, 2000 V3:88 +Safe Drinking Water Act and, 1999 V2: 244 special waste drainage codes and, 1999 V2: 328 storage tank regulations, 2000 V3: 154 +tank leak detection regulations, 2000 V3: 158 water consumption statistics, 2004 V1: 135 +U.S. Federal Housing Administration, 2004 V1: 199 + +373 + + +U.S. Federal Specifications (FS), 2004 V1: 25, 58 +U.S. Food and Drug Administration, 1999 V2: 279, 321, 324, 328 +U.S. General Services Administration, 2004 V1: 191, 199, 263, 1999 V2: 34 +U.S. Government Printing Office address, 2000 V3: 97 +Clean Water Act, 2000 V3: 96 +Code of Federal Regulations, 2000 V3: 96 Comprehensive Environmental Response, +Compensation and Liability Act, 2000 V3: 96 Resource Conservation and Recovery Act, 2000 V3: 96 +U.S. Green Building Council, 2004 V1: 263 +U.S. Occupational Safety and Health Administration, 1999 V2: 333 +U.S. Pharmacopoeia (USP) +USP nomographs, 1999 V2: 317 +USP purified water, 1999 V2: 320, 321 water treatment standards, 1999 V2: 279 +U.S. Public Health Service (USPHS), 1999 V2: 238, 2000 V3: 151 +U.S. Veterans Administration, 2004 V1: 191 U.S. War Department, 1999 V2: 114 USACOE. See U.S. Army Corps of Engineers usages in swimming pools, 2000 V3: 128 +use factors +air compressors, 2000 V3: 206 compressed air systems, 2000 V3: 209 +users in cost equation, 2004 V1: 223 +USGBC (U.S. Green Building Council), 2004 V1: 263 USP. See U.S. Pharmacopoeia (USP) +USPHS. See U.S. Public Health Service (USPHS) USTs. See underground storage tanks (USTs) utilities. See site utilities +utility costs, lowering, 2004 V1: 128 utility gas. See fuel-gas piping systems utility sinks, 2000 V3: 32 +utility water treatment, 1999 V2: 313–314 UV (ultraviolet rays) +chlorine and, 2000 V3: 149 PVC pipes and, 2000 V3: 116 sterilization, 2000 V3: 47 +swimming pool disinfection, 2000 V3: 150 +UV treatment of water, 1999 V2: 245, 311–312, 318, 323, 324 + +V +v, V (valves). See valves +V (specific volume). See specific volume V (velocity of uniform flow), 2004 V1: 1 V (velocity). See velocity +V (vents). See vents and venting systems V (volts). See volts +v/v (volume to volume), 1999 V2: 285 VA (volt amperes), 2004 V1: 16 +vac, VAC (vacuum). See vacuum vacation pay, in labor costs, 2004 V1: 94 vacuum (vac, VAC) +defined, 2004 V1: 31, 1999 V2: 253 perfect vacuum, 2000 V3: 200 surgical use, 2000 V3: 57 +symbols for, 2004 V1: 8, 16 +374 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +vacuum breakers. See backflow preventers +vacuum cleaning systems, 1999 V2: 266–277. See also vacuum systems +cleanouts, 1999 V2: 276 +codes and standards, 1999 V2: 266 components, 1999 V2: 266–269, 268 friction losses, 1999 V2: 272–274, 274 inlet locations and spacing, 1999 V2: 269 piping, 1999 V2: 269 +separators, 1999 V2: 275–276 simultaneous operators, 1999 V2: 269 sizing exhausters, 1999 V2: 272, 274–275 swimming pools, 2000 V3: 145, 146 types, 1999 V2: 266 +Vacuum Cleaning Systems, 1999 V2: 277 vacuum condensate pumps, 2000 V3: 189 vacuum deaerators, 1999 V2: 294, 295 +vacuum diatomaceous earth filtration, 2000 V3: 132, 135, 136, 139 +vacuum levels +defined, 1999 V2: 253–254 +in exhauster sizing, 1999 V2: 274 +vacuum producers (exhausters), 1999 V2: 266–269, 270, 272, 274–275 +vacuum product dispensers, 2000 V3: 163, 168 +vacuum pumps, 1999 V2: 259, 263–264, 2000 V3: 49, 70, 71 +vacuum relief valves, 2004 V1: 31 Vacuum Sewage Collection, 1999 V2: 238 vacuum sewers, 1999 V2: 226 +vacuum sources, 1999 V2: 259–261, 262, 263–264 Vacuum Sources, 1999 V2: 277 +vacuum steam units, 2000 V3: 188, 189 +vacuum systems, 1999 V2: 266–277. See also vacuum cleaning systems +altitude adjustments, 1999 V2: 257 cast iron radiators, 2000 V3: 180 codes and standards, 1999 V2: 262 color coding, 2000 V3: 56 fundamentals, 1999 V2: 253–254 introduction, 1999 V2: 253 +laboratory systems, 1999 V2: 262–266, 2000 V3: 37–39 leakage, 1999 V2: 265, 267 +Level 1 defined, 2000 V3: 85 Level 3 defined, 2000 V3: 86 +medical gas system switches, 2000 V3: 72 medical vacuum +design checklist, 2000 V3: 49–50 diversity factors, 2000 V3: 75 laboratory outlets, 2000 V3: 37–39 number of stations, 2000 V3: 50, 51–52 oral surgery equipment, 2000 V3: 39 patient vacuum, 2000 V3: 85 +peak demand, 2000 V3: 55 +piping systems, 2000 V3: 54, 68–70 +operating pressure steam classification, 2000 V3: 178 operating pressures, 2000 V3: 175 +piping, 1999 V2: 262, 2000 V3: 74, 79 pressure drop, 1999 V2: 258 +pressure measurement, 1999 V2: 254–256 pump curves, 1999 V2: 258 +references, 1999 V2: 277 + +sizing, 1999 V2: 262–266, 2000 V3: 74, 79 surges, 1999 V2: 35 +swimming pools, 2000 V3: 144 +time to reach rated vacuum, 1999 V2: 257–258 vacuum-pressure gauges, 1999 V2: 260 vacuum reservoirs, 1999 V2: 262 +vacuum sources, 1999 V2: 259–261, 262, 263–264 velocity calculations, 1999 V2: 258–259 +work forces, 1999 V2: 259 valence, 1999 V2: 280, 281, 302 value, defined, 2004 V1: 213–214 +Value Engineering Change Proposals (VECP), 2004 V1: 260 +Value Engineering Job Plan (VEJP), 2004 V1: 214 value engineering (VE) +arguments against, 2004 V1: 232 checklists +creativity worksheets, 2004 V1: 233–234 detail/product/material specification checklists, +2004 V1: 220 +evaluation checklists, 2004 V1: 237–238 +function definitions forms, 2004 V1: 225–227, 228 functional evaluation worksheets, 2004 V1: 243– +251 +idea development and estimated cost forms, 2004 V1: 241–242 +idea evaluation worksheets, 2004 V1: 243, 253 project information checklists, 2004 V1: 215–220 project information sources checklists, 2004 V1: +221 +questions checklists, 2004 V1: 213–214 recommendation worksheets, 2004 V1: 258, 259 +compared to cost fitting, 2004 V1: 258 contract document clauses, 2004 V1: 258, 260 cost information, 2004 V1: 222–225 creativity process, 2004 V1: 231–235 +defined, 2004 V1: 211 elements of, 2004 V1: 214–225 +Evaluation phase, 2004 V1: 235–243 Function Analysis phase, 2004 V1: 224–243 +Functional Development sketches, 2004 V1: 237, 239–240 +Gut Feel Index, 2004 V1: 254 Information phase, 2004 V1: 214–222 job plan phases, 2004 V1: 213 overview, 2004 V1: 211–212 +pre-recommendation questions, 2004 V1: 254–257 purpose, 2004 V1: 211–212 +qualitative results, 2004 V1: 212 Recommendation/presentation phase, 2004 V1: 257– +258 +results of, 2004 V1: 261 +Risk Guides, 2004 V1: 254, 257 salesmanship in, 2004 V1: 257 science of, 2004 V1: 258–260 +second creativity, cost, and evaluation analysis, 2004 V1: 254 +teams, 2004 V1: 212 +value changes, 2004 V1: 212–213 “value” defined, 2004 V1: 213–214 +valve-in-head irrigation, 2000 V3: 101 +valve-per-sprinkler method of irrigation, 2000 V3: 100, 101 +Index + + +valved zones in irrigation systems, 1999 V2: 26 valves (v, V, VLV). See also specific types of valves +acoustic problems, 2004 V1: 197 acoustic ratings, 2004 V1: 194 automatic shutdown, 2000 V3: 90 battery-controlled, 2004 V1: 135 closing quickly, 1999 V2: 131 codes and standards, 2004 V1: 43 +compressed air systems, 2000 V3: 210 domestic pressure drops and, 2000 V3: 221 fountains, 2000 V3: 116–119, 118–119 friction loss in, 1999 V2: 128 +head loss and, 2000 V3: 115 +infectious waste systems, 1999 V2: 345 irrigation systems, 2000 V3: 103–104 medical air compressors, 2000 V3: 66 medical gas control valves, 2000 V3: 71–72 pure water systems, 1999 V2: 324 +in risers, 2004 V1: 10 +sizing natural gas fittings, 1999 V2: 184 sulfuric acid and, 1999 V2: 332 swimming pools, 2000 V3: 145–146 symbols for, 2004 V1: 16 +testing in medical gas systems, 2000 V3: 81 vacuum systems, 2000 V3: 70 +valve flow coefficients, 2004 V1: 14 in yard boxes (YB), 2004 V1: 10 +vandalism +backflow preventers, 1999 V2: 149 dressing rooms, 2000 V3: 130 +fasteners on grates and strainers, 1999 V2: 11 protecting against, 1999 V2: 19 +vane-type water-flow indicators, 2000 V3: 9, 10 VAP (vapor pressure), 2004 V1: 15 +vap pr, VAP PR (vapor pressure), 2004 V1: 15 vap prf, VAP PRF (vaporproof), 2004 V1: 16 vapor-compression distillation, 1999 V2: 295–298 vapor operating pressure, 2000 V3: 175 +vapor pressure, 2004 V1: 15 vapor recovery systems +aboveground tank systems, 2000 V3:168 classifications, 2000 V3: 154 +hazardous wastes, 2000 V3: 90 testing, 2000 V3: 171 +underground tank systems, 2000 V3: 163 vapor system pressure, 2000 V3: 175–178 vaporizers, 2000 V3: 61 +vaporproof (vap prf, VAP PRF), 2004 V1: 16 vapors, hazardous +acid wastes and, 1999 V2: 332, 333 +atmospheric tank venting and, 2000 V3: 157–158 contamination in compressed air, 2000 V3: 201 hydrocarbons, 2000 V3: 154 +monitoring, 2000 V3: 160, 162 vapor pockets, 2000 V3: 172 VOCs, 1999 V2: 284 +var, VAR (variables), 2004 V1: 16 variable air volume (VAV), 2004 V1: 16 variable-speed drivers, 2000 V3: 25 variables (var, VAR), 2004 V1: 16 varnishes in septic tanks, 1999 V2: 230 vaults + +375 + + +dry pumps in, 2000 V3: 115 +pools and fountains, 2000 V3: 111 VAV (variable air volume), 2004 V1: 16 +VECP (Value Engineering Change Proposals), 2004 V1: 260 +vegetable oil, 1999 V2: 10 vehicular traffic +grates and, 1999 V2: 11 +leaching trenches and, 1999 V2: 223 +VEJP (Value Engineering Job Plan), 2004 V1: 214 vel., VEL (velocity). See velocity +velocity (vel., VEL, V). See also dynamic pressure acoustic pump problems, 2004 V1: 197 +cold-water systems, 1999 V2: 121–122 conversion factors, 2004 V1: 37 counterflow piping designs, 2000 V3: 178 defined, 2004 V1: 31 +earthquakes, 2004 V1: 159 flow from outlets, 2004 V1: 6 hydraulic shock, 2004 V1: 6 +intake air in compression systems, 2000 V3: 212 liquid fuel piping, 2000 V3:170 +measurements, 2004 V1: 33 non-SI units, 2004 V1: 34 open-channel flow, 2004 V1: 1 +in rate of corrosion, 2004 V1: 145 +self-scouring velocity in sewers, 2000 V3: 232 site storm drainage, 1999 V2: 98 +sizing method for pipes, 1999 V2: 131 steam systems, 2000 V3: 175 +storm water in ditches, 2000 V3: 248 symbols for, 2004 V1: 16 +terminal velocity, defined, 1999 V2: 1 vacuum cleaning systems, 1999 V2: 270–272 vacuum systems, 1999 V2: 258–259 +water hammer and, 2004 V1: 198, 1999 V2: 144 water supply piping and, 1999 V2: 249 +wind (w vel., W VEL), 2004 V1: 16 velocity head (h), 2004 V1: 5 +vent connectors, defined, 1999 V2: 214 vent gases, defined, 1999 V2: 214 +vent pipes +cast-iron soil pipe, 2003 V4: 27 glass pipe, 2003 V4: 47 +vent stack terminals +defined, 1999 V2: 35–36, 64 +liquefied petroleum gas, 1999 V2: 197 natural gas, 1999 V2: 177 +vent stacks +air in, 1999 V2: 2 +defined, 2004 V1: 31, 1999 V2: 64 vent headers, 1999 V2: 45 +vent systems codes, 2004 V1: 43 +ventilated sleeves and gas piping, 1999 V2: 176 ventilation +oxygen storage areas, 2000 V3: 63 swimming pools, 2000 V3: 129 +ventilators, 2000 V3: 74 +vents and venting systems (V, vent, VENT). See also vent stack terminals; vent stacks +1-pipe steam systems, 2000 V3: 179–180 aboveground tank systems, 2000 V3:167 +376 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +acid-waste systems, 1999 V2: 332, 334, 2000 V3: 39 arterial vents, 1999 V2: 52 +atmospheric tank venting, 2000 V3: 167 chemical-waste systems, 1999 V2: 346 chimney heights, 1999 V2: 178 +circuit and loop venting, 1999 V2: 43–44 combination waste and vent systems, 1999 V2: 45–46 common vents, 1999 V2: 41 +confluent vents, 1999 V2: 51 +duct seismic protection, 2004 V1: 155 +ducts in clean agent gas fire suppression, 2000 V3: 23 end venting, 1999 V2: 41 +factors in trap seal loss, 1999 V2: 36 +fire-suppression drainage and, 1999 V2: 347 fixture units, 1999 V2: 40–41 +fixture vents, 1999 V2: 37–39 flash tanks, 2000 V3: 195 force mains, 2000 V3: 241 glossary of terms, 1999 V2: 64 +gravity vents for gas appliances, 1999 V2: 178 infectious waste systems, 1999 V2: 345 introduction, 1999 V2: 35 +laboratory waste and vent piping, 2000 V3: 42 loop venting, 2004 V1: 31, 1999 V2: 64 +main vents, 2000 V3: 184 manholes, 2000 V3: 236, 239 +natural gas appliance vents, 1999 V2: 177–178 offsets, 1999 V2: 44–45 +oil separators, 1999 V2: 349 Philadelphia system, 1999 V2: 46, 47, 48 purposes, 1999 V2: 35 +radiators, 2000 V3: 178, 184 +reduced-size venting, 1999 V2: 49, 53, 54 references, 1999 V2: 65 +relief vents, 1999 V2: 44, 45 septic tank vents, 1999 V2: 231 sewer vents, 1999 V2: 35 +sizes and lengths, 2004 V1: 3, 1999 V2: 41–43, 50–63 sovent systems, 1999 V2: 46–47, 54–63 +special-waste drainage systems, 1999 V2: 328 storm-drainage stacks, 1999 V2: 67 +suds venting, 1999 V2: 36–37, 39 sumps, 1999 V2: 105 +symbols for, 2004 V1: 8, 16 testing, 2000 V3: 171 +traps and trap seals, 1999 V2: 36, 39–40 underground liquid fuel tanks, 2000 V3: 157–158 vent headers, 1999 V2: 45 +vented inlet tees in septic tanks, 1999 V2: 228 waste anesthetic gas management, 2000 V3: 71 wet vents, 1999 V2: 43, 49 +venturi action in pools, 2000 V3: 108 venturi-meters, 2004 V1: 197 venturi suction pumps, 1999 V2: 241 +verbs in function analysis, 2004 V1: 224, 225, 231 vert., VERT (vertical). See vertical +vertical (vert., VERT), 2004 V1: 16 vertical filters, 2000 V3: 131 vertical forces, 2004 V1: 189 +vertical leaders, 1999 V2: 85–88, 109 vertical pipes, 2004 V1: 31 +vertical pressure media filters, 1999 V2: 300 + +vertical risers for vacuum systems, 1999 V2: 269 vertical seismic load, 2004 V1: 184 +vertical shaft turbine pumps, 2004 V1: 24 vertical stacks +calculating terminal velocity and length, 2004 V1: 3 defined, 2004 V1: 31 +fittings, 1999 V2: 1 flow in, 1999 V2: 1–2 +hydraulic jumps and, 1999 V2: 2 loading tables, 1999 V2: 4 +maximum fixture-unit values, 1999 V2: 4, 5 multistory stacks, 1999 V2: 5 +pneumatic pressure in, 1999 V2: 2 sizing, 1999 V2: 5, 6 +sovent systems, 1999 V2: 57 stack capacities, 1999 V2: 3–5 +storm-drainage stacks, 1999 V2: 67 vertical turbine pumps +fire pumps, 2000 V3: 25 illustrated, 1999 V2: 246 +private water systems, 1999 V2: 245 shallow wells, 1999 V2: 247 +swimming pool pumps, 2000 V3: 140, 142 VFR (volumetric flow rates), 2004 V1: 16 viable-count essays, 1999 V2: 282 +vibrating fill above sewers, 1999 V2: 16 vibration and vibration isolation +defined, 2004 V1: 209 earthquakes +earthquake vibration periods, 2004 V1: 160 floor-mounted equipment, 2004 V1: 164–166 isolators and, 2004 V1: 206 +piping and, 2004 V1: 168 +suspended equipment, 2004 V1: 166 equipment vibration criteria, 2004 V1: 202 fixtures, isolating, 2004 V1: 205, 207 natural or free vibration, 2004 V1: 160 +noise and vibration control, 2004 V1: 199–200 piping, 2004 V1: 168. See also water hammer pumps, 2004 V1: 205, 208 +static deflection for pump vibration, 2004 V1: 205 types of vibration control devices, 2004 V1: 203–206 vibration isolation mounts, 2004 V1: 162, 163 vibration isolators, 2004 V1: 199 +video equipment, 1999 V2: 10 vinyl coatings, 2004 V1: 147 +viruses in feed water, 1999 V2: 282, 311–313 viscosity (visc, VISC, MU) +calculating values of, 2004 V1: 2 defined, 2000 V3: 154 measurements, 2004 V1: 33 symbols for, 2004 V1: 16 +visitors’ facilities, numbers of fixtures for, 2003 V4: 20, 21 visualization in function analysis, 2004 V1: 227 +vitreous china fixtures, 2000 V3: 33, 2003 V4: 1, 2 +vitrified clay piping, 1999 V2: 122, 346, 2000 V3: 245, 2003 V4: 49, 56–57 +vitrified sewer pipes, 2004 V1: 31 VLV (valves). See valves +VOCs (volatile organic compounds), 1999 V2: 284, 292, 2000 V3: 154, 163 +vol., VOL (volume). See volume +Index + + +volatile liquids, 1999 V2: 13, 347–349 +volatile organic compounds (VOCs), 1999 V2: 284, 292, 2000 V3: 154, 163 +volcanoes, 2004 V1: 156 volts (V, E, VOLTS) +decomposition potential defined, 2004 V1: 152 measurement conversions, 2004 V1: 33 symbols for, 2004 V1: 16 +volt amperes (VA), 2004 V1: 16 volume (vol., VOL) +calculating, 2004 V1: 3–5 conversion factors, 2004 V1: 37 +flow rate measurements, 2004 V1: 33, 1999 V2: 255 gas particles, 2000 V3: 199 +non-SI units, 2004 V1: 34 symbols for, 2004 V1: 16 +volume to volume (v/v), 1999 V2: 285 volumetric flow rates (VFR), 2004 V1: 16 vortexes +anti-vortex grating, 2000 V3: 110 in drains, 1999 V2: 38 +from pumps, 2004 V1: 197 from sumps, 2004 V1: 197 +vp, VP (dynamic pressure or velocity), 2004 V1: 15 + +W +W, W (humidity ratios), 2004 V1: 15 W (walls). See walls +W (waste sewers), 2004 V1: 8 W (watts). See watts +W/m K (watts per meter per kelvin), 2004 V1: 33 w vel., W VEL (velocity, wind), 2004 V1: 16 +w/w (weight to weight), 1999 V2: 285 wading areas, 2000 V3: 128 +wafer butterfly valves, 1999 V2: 268 +WAG (waste anesthetic gases), 2000 V3: 70–71 +WAGD (waste anesthetic-gas disposal), 2000 V3: 57, 70–71, 86 +wages, in labor costs, 2004 V1: 94 waiting rooms, 2000 V3: 32 +WAL (walls). See walls +wall azimuth (WAZ), 2004 V1: 14 wall carriers, 2003 V4: 6 +wall cleanouts (WCO), 2004 V1: 11 wall-hung lavatories, 2003 V4: 11 wall-hung urinals, 2003 V4: 10 +wall-hung water closets, 2003 V4: 4, 6 wall hydrants (WH), 2004 V1: 10, 12 +wall-mounted medical gas stations, 2000 V3: 58 walls (W, WAL) +piping and acoustic design, 2004 V1: 195–196 symbols for, 2004 V1: 16 +wall penetrations of pipes, 2004 V1: 201 wander, 2004 V1: 22, 190 +ward rooms, 2000 V3: 34 +warehouses, numbers of fixtures for, 2003 V4: 20, 21 warm-up loads +automatic heat-up systems, 2000 V3: 196 equations, 2000 V3: 195 +steam piping, 2000 V3: 187, 191, 192 warning systems (medical gas), 2000 V3: 72–73 +area alarms, 2000 V3: 72 + +377 + + +master alarms, 2000 V3: 72 testing, 2000 V3: 81 +warranty section in specifications, 2004 V1: 70, 90 Warren, Alan W., 1999 V2: 114 +wash basins. See sinks and wash basins wash-down urinals, 2003 V4: 9 +wash-down water closets, 2003 V4: 3 washing floors with gray water, 1999 V2: 22 +washing machines. See laundry systems and washers washout urinals, 2003 V4: 9 +washout water closets, 2003 V4: 3 waste, defined, 2004 V1: 31 +waste anesthetic-gas disposal, 2000 V3: 57, 70–71, 86 waste brines, 1999 V2: 231, 307 +waste-disposal units. See food waste grinders waste fitting standards, 2003 V4: 2 +waste grinders, 2000 V3: 32 +waste-heat usage, 2004 V1: 131–134, 266 waste-heat vaporizers, 2000 V3: 61 waste oil (WO), 2004 V1: 8, 2000 V3: 154 waste oil vents (WOV), 2004 V1: 8 +waste or soil vents. See stack vents waste pipes, 2004 V1: 31, 2003 V4: 27 waste sewers (W), 2004 V1: 8 +waste streams +evaluation, 2000 V3: 90 segregating, 2000 V3: 94 +Wastewater Engineering: Treatment, Disposal, and Reuse, 2000 V3: 125 +Wastewater Engineering: Treatment/Disposal/Reuse, 1999 V2: 238 +wastewater heat recovery, 2004 V1: 133 +wastewater management. See also gray-water systems; private sewage-disposal systems +green building technologies, 2004 V1: 264 individual aerobic wastewater treatment, 1999 V2: +232–233 +industrial wastewater treatment. See industrial wastewater treatment +reclaimed and gray water systems, 2004 V1: 135, 1999 V2: 27–29 +swimming pools, 2000 V3: 131 WAT (watts). See watts +water (WTR). See also water analysis; water chemistry as seal liquid in liquid ring pumps, 1999 V2: 260 asbestos concrete piping, 2003 V4: 26 +clarity, 2000 V3: 135 +contamination in compressed air, 2000 V3: 201 density, 1999 V2: 116 +kinematic viscosity, 1999 V2: 121 oil-water separation, 2000 V3: 93 +portable fire extinguishers, 2000 V3: 27 potable amounts present, 2004 V1: 263 samples of, 1999 V2: 155 +subsurface water, 1999 V2: 99–105 +water absorption, plastic pipe and, 2003 V4: 60 water analysis +aggressiveness index, 1999 V2: 292 codes and standards, 1999 V2: 279 example report, 1999 V2: 286 introduction, 1999 V2: 284–285 pH, 1999 V2: 285, 291 +378 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +predicting water deposits and corrosion, 1999 V2: 290–292 +references, 1999 V2: 325 +Ryzner stability index, 1999 V2: 292 silt density index, 1999 V2: 288–289 specific conductance, 1999 V2: 287 total dissolved solids, 1999 V2: 288 total organic carbon, 1999 V2: 288 +total suspended solids, 1999 V2: 287–288 water chemistry +elements, acids, and radicals in water, 1999 V2: 281 heat loss retardants, 2000 V3: 150 +introduction, 1999 V2: 280–284 mineral deposits, 2000 V3: 147–148 pH values, 2000 V3: 147 +pools and fountains, 2000 V3: 123 sequestering agents, 2000 V3: 150 swimming pools, 2000 V3: 146–148 water impurities, 1999 V2: 280–284 +water-closet compartments accessibility, 2004 V1: 113–116 +ambulatory-accessible toilet compartments, 2004 V1: 114 +kitchen areas, 2000 V3: 36 patient rooms, 2000 V3: 34 +single-occupant unisex toilet rooms, 2003 V4: 18, 23 spacing, 2003 V4: 6–7 +swimming pool bathhouses, 2000 V3: 130 trap primers in, 1999 V2: 13 +water-closet flanges, 2003 V4: 6 water closets (WC). See also urinals +accessibility design, 2004 V1: 113–116 acoustic design, 2004 V1: 200 acoustic ratings of, 2004 V1: 194 bolts, 2003 V4: 6 +composting toilets, 2004 V1: 265 conserving water in, 1999 V2: 232 dual flush, 2004 V1: 265 +Energy Policy Act requirements, 2004 V1: 264 exclusion from gray-water systems, 1999 V2: 21 fixture-unit loads, 1999 V2: 3 +flushing performance testing, 2003 V4: 5–6 flushing systems, 2003 V4: 6–8 +gray water usage, 2004 V1: 267, 1999 V2: 21, 25 in health-care facilities, 2000 V3: 32, 33, 34 incinerators, 2004 V1: 265 +installation requirements, 2003 V4: 6–7 minimum numbers of, 2003 V4: 18–22 mounting, 2003 V4: 4 +rates of sewage flows, 1999 V2: 237 reducing flow rates, 2004 V1: 134–135 seats, 2003 V4: 5 +shapes and sizes, 2003 V4: 4–5 sovent systems, 1999 V2: 59, 62 specimen-type, 2000 V3: 35 standards, 2003 V4: 2, 6 +types of, 2004 V1: 135–136, 2003 V4: 3–4 typical use, 1999 V2: 25 +ultra-low-flow, 2004 V1: 135–136, 1999 V2: 19 water conservation, 2004 V1: 135–136 +water fixture unit values, 2000 V3: 217 water column (wc), 2003 V4: 5 + + +Water Conditional Manual, 1999 V2: 325 +water conditioning. See also water purification; water softeners; water treatment +defined, 1999 V2: 279 +water-conditioning or treating devices, 2004 V1: 31 water conservation. See conserving water +water consumption tests, 2003 V4: 5, 9 water-cooled after-coolers, 2000 V3: 202 water coolers +access to, 2004 V1: 109–112 gray-water output, 1999 V2: 25 +health-care facilities, 2000 V3: 32 +public areas in health-care facilities, 2000 V3: 33 standards, 2003 V4: 2 +types, 2003 V4: 14 +wheelchair space around, 2004 V1: 112 water damage +sprinkler systems, 2000 V3: 2 +swimming pool bathhouses, 2000 V3: 130 water deposits, 1999 V2: 289, 290–292 +Water Distributing Systems for Buildings, 1999 V2: 155 water-distribution pipes and systems. See also cold-water +systems; hot-water systems acoustic design, 2004 V1: 195–196 codes, 2004 V1: 45 +defined, 2004 V1: 31 pipe codes, 2004 V1: 45 +water supply and distribution symbols, 2004 V1: 12 water supply systems, 2004 V1: 31 +weight of water-filled pipes, 2004 V1: 184 Water Efficiency design (LEED), 2004 V1: 263–264 water-flow indicators, 2000 V3: 9, 10 +water for injection (WFI), 1999 V2: 317, 320, 321, 324 water glass, 2004 V1: 151 +water hammer +acoustic control of, 2004 V1: 201 air locks, 2004 V1: 201 +controlling water hammer, 1999 V2: 132, 143 counterflow piping designs, 2000 V3: 178 defined, 2004 V1: 31, 1999 V2: 131–144 +flow velocity and, 2004 V1: 198 fountains and, 2000 V3: 116 fuel dispensers, 2000 V3: 170 shock intensity, 1999 V2: 132 +sizing of arresters, 1999 V2: 143–144 steam systems, 2000 V3: 189, 190, 191 swimming pool pumps, 2000 V3: 139 symbols on arresters, 1999 V2: 143 +system protection and control, 1999 V2: 132, 143–144 velocity and, 1999 V2: 121 +water hammer arresters (WHA) +acoustic design in water pipes, 2004 V1: 195 as protection and control, 1999 V2: 132 codes, 2004 V1: 43 +defined, 2004 V1: 31 +flow velocity and, 2004 V1: 198 shock absorbers, 2004 V1: 198, 201 sizing, 1999 V2: 143–144 +symbols, 2004 V1: 10, 1999 V2: 143 water heaters. See also hot-water systems +avoiding standby losses, 2004 V1: 127 +booster water heaters, 2004 V1: 126, 129, 1999 V2: 160 +Index + + +codes, 2004 V1: 43 condensation use, 2004 V1: 267 +conserving energy, 2004 V1: 124–125, 127 earthquake damage, 2004 V1: 162 earthquake protection, 2004 V1: 162, 163 explosions, 1999 V2: 157 +gas water heaters, 2004 V1: 129 heat recovery, 1999 V2: 158 high-efficiency, 2004 V1: 265 instantaneous, 2004 V1: 265 locations of, 2004 V1: 129 +mineral deposits and, 2000 V3: 147 overview, 1999 V2: 160–165 +point-of-use booster heaters, 2000 V3: 45 recovering heat from water heaters, !1999 V2: 158 +reflecting pools and fountains, 2000 V3: 112, 121–122 step heaters, 2000 V3: 144 +stratification in water heaters, 1999 V2: 160, 165 swimming pools, 2000 V3: 138–139, 144–145, 146 temperature, 1999 V2: 157, 160 +thermal efficiency, 1999 V2: 169 types of systems, 2004 V1: 129–134 +water impurities +alkalinity, 1999 V2: 282–283 +analysis and measurement, 1999 V2: 284–289 biological fouling, 1999 V2: 289, 316 dissolved gases, 1999 V2: 284 +hardness, 1999 V2: 283 microorganisms, 1999 V2: 282 specific resistance, 1999 V2: 285–287 suspended solids, 1999 V2: 282 +treatment methods, 1999 V2: 292–313 volatile organic compounds, 1999 V2: 284 +water levels +in pools, 2000 V3: 112 sensors, 2000 V3: 124 +water-level dependent spray jets, 2000 V3: 119 water-level independent spray jets, 2000 V3: 119 +water mains +age and size, 2000 V3: 8 copper pipe, 2003 V4: 34, 35 defined, 2004 V1: 31 +fire-protection connections, 2000 V3: 225, 227 inspection checklist, 2004 V1: 103 +pressure and, 2000 V3: 216 sprinkler systems, 2000 V3: 3 +water makeup. See makeup water systems +Water Management: A Comprehensive Approach for Facility Managers, 1999 V2: 34 +water management plans, 2004 V1: 134–135 water meters +domestic water meters, 1999 V2: 115–116 estimating sewage disposal from, 1999 V2: 233 flow-pressure loss averages, 1999 V2: 117 friction losses, 1999 V2: 127 +irrigation, 2000 V3: 105 locations for, 2000 V3: 217 loss of pressure, 1999 V2: 123 pressure losses, 2000 V3: 224 +water motor gongs, 2000 V3: 9, 10 +water, oil, and gas (WOG) pressure rating, 2000 V3: 210 + +379 + + +water pipes. See cold-water systems; hot-water systems; water-distribution pipes and systems +water pressure +booster-pump system, 1999 V2: 152 excess water pressure, 1999 V2: 152–154 gravity-tank systems, 1999 V2: 150–152 +hydropneumatic-tank systems, 1999 V2: 150 inadequate water pressure, 1999 V2: 149–152 pressure-regulating devices, 1999 V2: 122 water hammer and, 1999 V2: 144 +water purification +central purification equipment, 1999 V2: 323–325 codes and standards, 1999 V2: 279, 317 +feed water, 1999 V2: 320 +high-purity water, 2000 V3: 46 methods, 2000 V3: 46–47 pharmaceutical systems, 1999 V2: 320 polishers and, 1999 V2: 308 +pure-water systems defined, 1999 V2: 279 references, 1999 V2: 325 +specific resistance of pure water, 1999 V2: 286 system design, 1999 V2: 321 +water impurities, 1999 V2: 280–284 water quality +Clean Water Act, 2000 V3: 88 +grades of laboratory water, 1999 V2: 317 gray-water systems, 1999 V2: 33 introduction, 1999 V2: 244 +references, 1999 V2: 325 +water-resistivity meters, 1999 V2: 286 +water-reuse systems. See gray-water systems water rise tests, 2003 V4: 5 +water risers, 2004 V1: 31 +water-seal self-scouring traps, 1999 V2: 36 water-service pipes, defined, 2004 V1: 31 water slides, 2000 V3: 128 +water softeners +earthquake damage, 2004 V1: 162 hardness of water, 1999 V2: 283 ion-exchange, 1999 V2: 300 leakage, 1999 V2: 308 +pressure losses and, 1999 V2: 125 pure water systems, 1999 V2: 323 types of, 1999 V2: 244, 307–308 utility water, 1999 V2: 314 +waste brines, 1999 V2: 231 water sports, 2000 V3: 128 +Water Spray Fixed Systems for Fire Protection (NFPA 15), 2000 V3: 2, 29 +water-spray systems, 2000 V3: 13 water-storage tanks +earthquake damage, 2004 V1: 162 +fire-protection water supply, 2000 V3: 232 pipe installation, 1999 V2: 250–252 piping, 1999 V2: 249–250 +pressure regulators, 1999 V2: 248–249 private water systems, 1999 V2: 239 types of, 1999 V2: 247–248 +water-air ratio in tanks, 1999 V2: 150 water levels in, 1999 V2: 151, 248 +380 ASPE Plumbing Engineering Design Handbook — Volume 1 + + + +water-supply systems. See cold-water systems; domestic water supply; fire-protection systems; hot-water systems; private water systems; water-distribution pipes and systems; wells +Water Systems for Pharmaceutical Facilities, 1999 V2: 325 water tables +underground storage tanks and, 2000 V3: 155 wells, 1999 V2: 241–243 +Water Tanks for Fire Protection, 1999 V2: 247 water temperature +bathtub water notes, 2004 V1: 119 deaeration water temperatures, 1999 V2: 294 +feed water temperature and deposits, 1999 V2: 291, 312, 321–322 +high-temperature withstand for hot-water systems, 1999 V2: 166 +hot-water properties, 1999 V2: 168 +hot-water relief valves, 1999 V2: 166–167 +hot-water temperatures, 1999 V2: 159, 161–165, 165, 2000 V3: 36, 45 +maintenance hot-water temperatures, 1999 V2: 166 mixed-water temperatures, 1999 V2: 159–160 operating hot-water temperatures, 1999 V2: 166 reflecting pools and fountains, 2000 V3: 108 scalding water, 1999 V2: 169–170 +shower compartments, 2004 V1: 120, 2003 V4: 15 swimming pools, 2000 V3: 129, 139 +water heaters, 1999 V2: 157, 160 water toys, 2000 V3: 128 +water treatment +aeration, 1999 V2: 292–294 aluminum sulfate, 2000 V3: 149–150 boiler feed water, 1999 V2: 314–315 clarification, 1999 V2: 294 +codes and standards, 1999 V2: 279 cooling towers, 1999 V2: 315–316 corrosion inhibitors, 2004 V1: 151 deaeration, 1999 V2: 294–295 dealkalizing, 1999 V2: 295 decarbonation, 1999 V2: 295 defined, 1999 V2: 279 +distillation, 1999 V2: 295–298 drinking water, 1999 V2: 316–317, 318 filtration, 1999 V2: 298, 300 +fountains and pools, 2000 V3: 107, 112, 122–124 ion-exchange and removal, 1999 V2: 300–308 membrane filtration and separation, 1999 V2: 300, +308–311 +microbial control, 1999 V2: 311–313 references, 1999 V2: 325 +swimming pools, 2000 V3: 130, 140, 146 utility water treatment, 1999 V2: 313–314 water impurities, 1999 V2: 280–284 +water purification, 1999 V2: 317–325 water softening, 1999 V2: 307 +Water Treatment for HVAC and Potable Water Systems, 1999 V2: 325 +Water Use in Office Buildings, 1999 V2: 34 +Water: Use of Treated Sewage on Rise in State, 1999 V2: 34 Water-Use Reduction Credit, 2004 V1: 264 +Water Uses Study, 1999 V2: 34 water utility letters, 2000 V3: 216 + +water vapor in air, 2000 V3: 200–201, 201 water wells. See wells +waterborne radioactive waste (radwaste), 1999 V2: 337 waterfall aerators, 1999 V2: 293 +waterfalls, 2000 V3: 108, 109 waterfront facilities, 1999 V2: 147 +waterless urinals, 2004 V1: 136, 265, 2003 V4: 10 waterproof manholes, 2000 V3: 236, 239 waterproofing drains, 1999 V2: 17, 79 +watertight joints, 2003 V4: 26 watt-hours (Wh, WH), 2004 V1: 16 watts (W, WAT) +converting to SI units, 2004 V1: 40 measurement conversions, 2004 V1: 33 symbols for, 2004 V1: 16 +W/m K (watts per meter per kelvin), 2004 V1: 33 wave actions in water (tsunamis), 2004 V1: 158 wave pools, 2000 V3: 128 +wax ring seals, 2003 V4: 6 +WAZ (wall azimuth), 2004 V1: 14 wb, WB (wet bulbs), 2004 V1: 16 Wb (webers), 2004 V1: 33 +wbt, WBT (wet-bulb temperature), 2004 V1: 16 wc (water column), 2003 V4: 5 +WCO (wall cleanouts), 2004 V1: 11 WD (wind). See wind +wdir, WDIR (wind direction), 2004 V1: 16 weak-base regeneration, 1999 V2: 302, 305 weakly-acidic resins, 1999 V2: 308 +weakly-basic resins, 1999 V2: 308 +weather conditions, 2004 V1: 98, 2000 V3: 100, 105, 165, 219 +webers, 2004 V1: 33 +weep holes, 1999 V2: 17, 2000 V3: 144, 2003 V4: 15 weight (wt, WT) +clean agent gas fire containers, 2000 V3: 23 horizontal loads of piping, 2004 V1: 184 +piping, earthquake protection and, 2004 V1: 167 in seismic force calculations, 2004 V1: 183 swimming pool filtration equipment, 2000 V3: 140 symbols for, 2004 V1: 16 +weight loss in corrosion, 2004 V1: 144 weight to weight (w/w), 1999 V2: 285 +weighted evaluations in value engineering, 2004 V1: 243 weighted runoff coefficients, 1999 V2: 97 +weirs +flow rates, 2000 V3: 109 materials, 2000 V3: 146 sizing, 1999 V2: 93 +swimming pools, 2000 V3: 142 water return in, 2000 V3: 119–120 waterfall rates and, 2000 V3: 108 +welded steel piping, 2003 V4: 48 welding +clearance for, 2003 V4: 25 corrosion and, 2004 V1: 146 +earthquake protection techniques, 2004 V1: 167 problems in seismic protection, 2004 V1: 190 weld decay defined, 2004 V1: 154 +welded fittings, 2004 V1: 24 +welded joints in radioactive waste systems, 1999 V2: 341 +Index + + +well screens, 2000 V3: 119–120 wells +bored wells, 1999 V2: 241 driven wells, 1999 V2: 241 dug wells, 1999 V2: 240 +equilibrium equations for wells, 1999 V2: 242–243 fire-protection connections, 2000 V3: 225 +gray-water irrigation systems and, 1999 V2: 26 hydraulics of, 1999 V2: 241 +initial operation and maintenance, 1999 V2: 252 introduction, 1999 V2: 240 +irrigation usage, 2000 V3: 105 jetted wells, 1999 V2: 241 +matching water storage to pump flow, 1999 V2: 248 monitoring fumes, 2000 V3: 162 +monitoring groundwater, 2000 V3: 162 pipe installation, 1999 V2: 250–252 protection of, 1999 V2: 243 +pumps, 1999 V2: 245–247 +swimming pool supplies, 2000 V3: 131 system equipment, 1999 V2: 245–250 water demand and, 1999 V2: 243–244 water quality, 1999 V2: 244–245 +wet-alarm valve risers, 2000 V3: 9, 10 +wet-bulb temperature (wbt, WBT), 2004 V1: 16 wet bulbs (wb, WB), 2004 V1: 16 +wet-cast pipe, 2003 V4: 32 +wet floors in chemical plants, 1999 V2: 346 wet gas, 2000 V3: 250 +wet-niche pool lighting, 2000 V3: 145 +wet-pipe systems, 2004 V1: 29, 2000 V3: 9 wet pits, 2000 V3: 142 +wet returns, 2000 V3: 179 wet standpipes, 2004 V1: 30 wet surfaces, 2004 V1: 16 +wet-tap excavations, 2000 V3: 222 wet vacuum-cleaning systems (WVC) +defined, 1999 V2: 266 illustrated, 1999 V2: 276 pitch, 1999 V2: 277 separators, 1999 V2: 268 symbols for, 2004 V1: 9 +wet venting +bathroom groups, 1999 V2: 43 +combination waste and vent systems, 1999 V2: 45–46 defined, 2004 V1: 31, 1999 V2: 64 +illustrated, 1999 V2: 49 +Weymouth formula, 2004 V1: 7, 1999 V2: 183, 190, 191, 198–209 +WFI (water for injection), 1999 V2: 317, 320, 321, 324 WH (wall hydrants), 2004 V1: 10, 12 +Wh, WH (watt-hours), 2004 V1: 16 +WHA (water hammer arresters). See water hammer arresters +What Future Role for Pressure Sewers?, 1999 V2: 238 wheel loads in pipe selection, 2003 V4: 26 wheelchairs +adult-sized, dimensions, 2004 V1: 108 anthropometrics for wheelchairs, 2004 V1: 109 approaches and reaches, 2004 V1: 110 +clear space for, 2004 V1: 109 +toilet and bathing rooms, 2004 V1: 112–113 + +381 + + +wheeled fire extinguishers, 2000 V3: 19, 27 WHEN relationship, 2004 V1: 230 whirlpool bathtubs, 2003 V4: 16 +White, George Clifford, 1999 V2: 155 Whitney, Eli, 2004 V1: 231 +WHY logic path, 2004 V1: 230, 231, 258 WI (width), 2004 V1: 16 +wide seepage beds, 1999 V2: 225 width (WI), 2004 V1: 16 +wind (WD) +direction (wdir, WDIR), 2004 V1: 16 +effect on irrigation sprinklers, 2000 V3: 102 fountains and, 2000 V3: 115, 120–121 +gas appliances and, 1999 V2: 178 reflecting pools and, 2000 V3: 108 speed and heat loss, 2000 V3: 121 symbols for, 2004 V1: 16 +velocity, 2004 V1: 16 +vent stack terminals and, 1999 V2: 36 +wind pressure (wpr, WPR, WP, WPRES), 2004 V1: 16 withstand for hot-water systems, 1999 V2: 166 +WO (waste oil), 2004 V1: 8 +WOG (water, oil, and gas pressure rating), 2000 V3: 210 wood shrinkage, protecting against, 1999 V2: 19 +wood stave piping, 1999 V2: 122 Woodcock, J.J., 1999 V2: 34 +word processing of specifications, 2004 V1: 71–72 work +conversion factors, 2004 V1: 35 converting to SI units, 2004 V1: 39 defined, 2004 V1: 61 measurements, 2004 V1: 33 +work change directives, 2004 V1: 63 +work functions in value engineering, 2004 V1: 225, 243 working deionizers, 1999 V2: 301, 302 +working hours, in cost estimation, 2004 V1: 98 working pressure +fuel gas, 1999 V2: 212 +in pipe selection, 2003 V4: 26 relief valves and, 1999 V2: 167 +vacuum systems, 1999 V2: 259, 262 workmanship standards, 2004 V1: 66 +workmen’s compensation, in labor costs, 2004 V1: 94 worksheets. See checklists and forms +worst case possibilities, radiation and, 1999 V2: 341 worth, defined, 2004 V1: 213 +WOV (waste oil vents), 2004 V1: 8 WP (wind pressure), 2004 V1: 16 +wpr, WPR (wind pressure), 2004 V1: 16 WPRES (wind pressure), 2004 V1: 16 wrapped piping +plastic-wrapped steel piping, 1999 V2: 196 sound damping, 2004 V1: 196, 201–202 wrapped storm piping, 1999 V2: 68 +wrist blades on faucets, 2000 V3: 33 written amendments, 2004 V1: 63 +Wrought Copper and Copper Alloy Solder-Joint Pressure Fittings, 2003 V4: 37 +Wrought Copper and Wrought Copper Alloy Solder-Joint Drainage Fittings, 2003 V4: 45 +Wrought Copper Braze Fittings, 2003 V4: 45 wrought iron piping, 1999 V2: 122, 176, 196 +382 ASPE Plumbing Engineering Design Handbook — Volume 1 + + +wt, WT (weight). See weight +WVC (wet vacuum cleaning). See wet vacuum-cleaning systems +wyes +avoiding suds formation, 1999 V2: 37 sovent systems, 1999 V2: 61 +water closet installation, 2003 V4: 6–7 Wyly, R.S., 1999 V2: 4, 19, 65 + +X +x-ray areas, 2000 V3: 39, 51 x-rays, 1999 V2: 337 +X#A (compressed air). See compressed air (A, X#, X#A) XH (extra heavy) cast iron soil pipe, 2003 V4: 29–30 +XH (extra heavy) cast-iron soil pipe, 2003 V4: 27 XP explosion-proof construction, 1999 V2: 179 XP junction boxes, 1999 V2: 179 +XPAN (expansion. See expansion + +Y +y (years), 2004 V1: 16, 34 +y-type strainers, 2000 V3: 116 yards (yd, YD) +converting to SI units, 2004 V1: 40 symbols for, 2004 V1: 16 +yards and lawns +lawn imperviousness factors, 2000 V3: 243 lawn sprinkler supply (LS), 2004 V1: 8 sprinkler systems (irrigation) +lawn sprinklers, 1999 V2: 121 +storm-drainage systems and, 1999 V2: 67 yard cleanouts (CO), 2004 V1: 11 +YB (valves in yard boxes), 2004 V1: 10 yd, YD (yards), 2004 V1: 16, 40 +year-round pools, 2000 V3: 129 years (yr, YR), 2004 V1: 16, 34 Yeh, K.L., 1999 V2: 325 +yellow brass, 2004 V1: 144 yoke vents, 2004 V1: 31 Young, Virgil E., 2000 V3: 105 yr, YR (years), 2004 V1: 16, 34 +Yrjanainen, Glen, 1999 V2: 114 + +Z +z, Z (zones), 2004 V1: 16, 183 Zelmanovich, Y., 1999 V2: 325 zeolite process, 1999 V2: 244 zeolites, 1999 V2: 302 +zero-flow potential, 2004 V1: 153 zero governors, 2000 V3: 251 zeta potential, 1999 V2: 294 +zinc +anodes, 2004 V1: 150 corrosion, 2004 V1: 139 +electromotive force series, 2004 V1: 144 galvanic series, 2004 V1: 141 +zirconium, 2000 V3: 20 +ZN (zones), 2004 V1: 16, 183 zone valves, 2000 V3: 49, 71 zones (z, Z, ZN) +in seismic force calculations, 2004 V1: 183 symbols for, 2004 V1: 16 +Index 383 diff --git a/JavaScript_The_Definitive_Guide conv.txt b/JavaScript_The_Definitive_Guide conv.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d51f4f6b47cf0bf791817f15de6b8a83eb44b00 --- /dev/null +++ b/JavaScript_The_Definitive_Guide conv.txt @@ -0,0 +1,29640 @@ + + + + +1. Preface + +a. Conventions Used in This Book + +b. Example Code + +c. O’Reilly Online Learning + +d. How to Contact Us + +e. Acknowledgments + +2. Introduction to JavaScript + +a. 1.1 Exploring JavaScript + +b. 1.2 Hello World + +c. 1.3 A Tour of JavaScript + +d. 1.4 Example: Character Frequency Histograms + +e. 1.5 Summary + +3. Lexical Structure + +a. 2.1 The Text of a JavaScript Program + +b. 2.2 Comments + +c. 2.3 Literals + +d. 2.4 Identifiers and Reserved Words + +i. 2.4.1 Reserved Words + +e. 2.5 Unicode + +i. 2.5.1 Unicode Escape Sequences + +ii. 2.5.2 Unicode Normalization + +f. 2.6 Optional Semicolons + +g. 2.7 Summary + +4. Types, Values, and Variables + +a. 3.1 Overview and Definitions + +b. 3.2 Numbers + +i. 3.2.1 Integer Literals + +ii. 3.2.2 Floating-Point Literals + +iii. 3.2.3 Arithmetic in JavaScript + +iv. 3.2.4 Binary Floating-Point and Rounding Errors + +v. 3.2.5 Arbitrary Precision Integers with BigInt + +vi. 3.2.6 Dates and Times + +c. 3.3 Text + +i. 3.3.1 String Literals + +ii. 3.3.2 Escape Sequences in String Literals + +iii. 3.3.3 Working with Strings + +iv. 3.3.4 Template Literals + +v. 3.3.5 Pattern Matching + +d. 3.4 Boolean Values + +e. 3.5 null and undefined + +f. 3.6 Symbols + +g. 3.7 The Global Object + +h. 3.8 Immutable Primitive Values and Mutable Object References + +i. 3.9 Type Conversions + +i. 3.9.1 Conversions and Equality + +ii. 3.9.2 Explicit Conversions + +iii. 3.9.3 Object to Primitive Conversions + +j. 3.10 Variable Declaration and Assignment + +i. 3.10.1 Declarations with let and const + +ii. 3.10.2 Variable Declarations with var + +iii. 3.10.3 Destructuring Assignment + +k. 3.11 Summary + +5. Expressions and Operators + +a. 4.1 Primary Expressions + +b. 4.2 Object and Array Initializers + +c. 4.3 Function Definition Expressions + +d. 4.4 Property Access Expressions + +i. 4.4.1 Conditional Property Access + +e. 4.5 Invocation Expressions + +i. 4.5.1 Conditional Invocation + +f. 4.6 Object Creation Expressions + +g. 4.7 Operator Overview + +i. 4.7.1 Number of Operands + +ii. 4.7.2 Operand and Result Type + +iii. 4.7.3 Operator Side Effects + +iv. 4.7.4 Operator Precedence + +v. 4.7.5 Operator Associativity + +vi. 4.7.6 Order of Evaluation + +h. 4.8 Arithmetic Expressions + +i. 4.8.1 The + Operator + +ii. 4.8.2 Unary Arithmetic Operators + +iii. 4.8.3 Bitwise Operators + +i. 4.9 Relational Expressions + +i. 4.9.1 Equality and Inequality Operators + +ii. 4.9.2 Comparison Operators + +iii. 4.9.3 The in Operator + +iv. 4.9.4 The instanceof Operator + +j. 4.10 Logical Expressions + +i. 4.10.1 Logical AND (&&) + +ii. 4.10.2 Logical OR (||) + +iii. 4.10.3 Logical NOT (!) + +k. 4.11 Assignment Expressions + +i. 4.11.1 Assignment with Operation + +l. 4.12 Evaluation Expressions + +i. 4.12.1 eval() + +ii. 4.12.2 Global eval() + +iii. 4.12.3 Strict eval() + +m. 4.13 Miscellaneous Operators + +i. 4.13.1 The Conditional Operator (?:) + +ii. 4.13.2 First-Defined (??) + +iii. 4.13.3 The typeof Operator + +iv. 4.13.4 The delete Operator + +v. 4.13.5 The await Operator + +vi. 4.13.6 The void Operator + +vii. 4.13.7 The comma Operator (,) + +n. 4.14 Summary + +6. Statements + +a. 5.1 Expression Statements + +b. 5.2 Compound and Empty Statements + +c. 5.3 Conditionals + +i. 5.3.1 if + +ii. 5.3.2 else if + +iii. 5.3.3 switch + +d. 5.4 Loops + +i. 5.4.1 while + +ii. 5.4.2 do/while + +iii. 5.4.3 for + +iv. 5.4.4 for/of + +v. 5.4.5 for/in + +e. 5.5 Jumps + +i. 5.5.1 Labeled Statements + +ii. 5.5.2 break + +iii. 5.5.3 continue + +iv. 5.5.4 return + +v. 5.5.5 yield + +vi. 5.5.6 throw + +vii. 5.5.7 try/catch/finally + +f. 5.6 Miscellaneous Statements + +i. 5.6.1 with + +ii. 5.6.2 debugger + +iii. 5.6.3 “use strict” + +g. 5.7 Declarations + +i. 5.7.1 const, let, and var + +ii. 5.7.2 function + +iii. 5.7.3 class + +iv. 5.7.4 import and export + +h. 5.8 Summary of JavaScript Statements + +7. Objects + +a. 6.1 Introduction to Objects + +b. 6.2 Creating Objects + +i. 6.2.1 Object Literals + +ii. 6.2.2 Creating Objects with new + +iii. 6.2.3 Prototypes + +iv. 6.2.4 Object.create() + +c. 6.3 Querying and Setting Properties + +i. 6.3.1 Objects As Associative Arrays + +ii. 6.3.2 Inheritance + +iii. 6.3.3 Property Access Errors + +d. 6.4 Deleting Properties + +e. 6.5 Testing Properties + +f. 6.6 Enumerating Properties + +i. 6.6.1 Property Enumeration Order + +g. 6.7 Extending Objects + +h. 6.8 Serializing Objects + +i. 6.9 Object Methods + +i. 6.9.1 The toString() Method + +ii. 6.9.2 The toLocaleString() Method + +iii. 6.9.3 The valueOf() Method + +iv. 6.9.4 The toJSON() Method + +j. 6.10 Extended Object Literal Syntax + +i. 6.10.1 Shorthand Properties + +ii. 6.10.2 Computed Property Names + +iii. 6.10.3 Symbols as Property Names + +iv. 6.10.4 Spread Operator + +v. 6.10.5 Shorthand Methods + +vi. 6.10.6 Property Getters and Setters + +k. 6.11 Summary + +8. Arrays + +a. 7.1 Creating Arrays + +i. 7.1.1 Array Literals + +ii. 7.1.2 The Spread Operator + +iii. 7.1.3 The Array() Constructor + +iv. 7.1.4 Array.of() + +v. 7.1.5 Array.from() + +b. 7.2 Reading and Writing Array Elements + +c. 7.3 Sparse Arrays + +d. 7.4 Array Length + +e. 7.5 Adding and Deleting Array Elements + +f. 7.6 Iterating Arrays + +g. 7.7 Multidimensional Arrays + +h. 7.8 Array Methods + +i. 7.8.1 Array Iterator Methods + +ii. 7.8.2 Flattening arrays with flat() and flatMap() + +iii. 7.8.3 Adding arrays with concat() + +iv. 7.8.4 Stacks and Queues with push(), pop(), shift(), and unshift() + +v. 7.8.5 Subarrays with slice(), splice(), fill(), and copyWithin() + +vi. 7.8.6 Array Searching and Sorting Methods + +vii. 7.8.7 Array to String Conversions + +viii. 7.8.8 Static Array Functions + +i. 7.9 Array-Like Objects + +j. 7.10 Strings as Arrays + +k. 7.11 Summary + +9. Functions + +a. 8.1 Defining Functions + +i. 8.1.1 Function Declarations + +ii. 8.1.2 Function Expressions + +iii. 8.1.3 Arrow Functions + +iv. 8.1.4 Nested Functions + +b. 8.2 Invoking Functions + +i. 8.2.1 Function Invocation + +ii. 8.2.2 Method Invocation + +iii. 8.2.3 Constructor Invocation + +iv. 8.2.4 Indirect Invocation + +v. 8.2.5 Implicit Function Invocation + +c. 8.3 Function Arguments and Parameters + +i. 8.3.1 Optional Parameters and Defaults + +ii. 8.3.2 Rest Parameters and Variable-Length Argument Lists + +iii. 8.3.3 The Arguments Object + +iv. 8.3.4 The Spread Operator for Function Calls + +v. 8.3.5 Destructuring Function Arguments into Parameters + +vi. 8.3.6 Argument Types + +d. 8.4 Functions as Values + +i. 8.4.1 Defining Your Own Function Properties + +e. 8.5 Functions as Namespaces + +f. 8.6 Closures + +g. 8.7 Function Properties, Methods, and Constructor + +i. 8.7.1 The length Property + +ii. 8.7.2 The name Property + +iii. 8.7.3 The prototype Property + +iv. 8.7.4 The call() and apply() Methods + +v. 8.7.5 The bind() Method + +vi. 8.7.6 The toString() Method + +vii. 8.7.7 The Function() Constructor + +h. 8.8 Functional Programming + +i. 8.8.1 Processing Arrays with Functions + +ii. 8.8.2 Higher-Order Functions + +iii. 8.8.3 Partial Application of Functions + +iv. 8.8.4 Memoization + +i. 8.9 Summary + +10. Classes + +a. 9.1 Classes and Prototypes + +b. 9.2 Classes and Constructors + +i. 9.2.1 Constructors, Class Identity, and instanceof + +ii. 9.2.2 The constructor Property + +c. 9.3 Classes with the class Keyword + +i. 9.3.1 Static Methods + +ii. 9.3.2 Getters, Setters, and other Method Forms + +iii. 9.3.3 Public, Private, and Static Fields + +iv. 9.3.4 Example: A Complex Number Class + +d. 9.4 Adding Methods to Existing Classes + +e. 9.5 Subclasses + +i. 9.5.1 Subclasses and Prototypes + +ii. 9.5.2 Subclasses with extends and super + +iii. 9.5.3 Delegation Instead of Inheritance + +iv. 9.5.4 Class Hierarchies and Abstract Classes + +f. 9.6 Summary + +11. Modules + +a. 10.1 Modules with Classes, Objects, and Closures + +i. 10.1.1 Automating Closure-Based Modularity + +b. 10.2 Modules in Node + +i. 10.2.1 Node Exports + +ii. 10.2.2 Node Imports + +iii. 10.2.3 Node-Style Modules on the Web + +c. 10.3 Modules in ES6 + +i. 10.3.1 ES6 Exports + +ii. 10.3.2 ES6 Imports + +iii. 10.3.3 Imports and Exports with Renaming + +iv. 10.3.4 Re-Exports + +v. 10.3.5 JavaScript Modules on the Web + +vi. 10.3.6 Dynamic Imports with import() + +vii. 10.3.7 import.meta.url + +d. 10.4 Summary + +12. The JavaScript Standard Library + +a. 11.1 Sets and Maps + +i. 11.1.1 The Set Class + +ii. 11.1.2 The Map Class + +iii. 11.1.3 WeakMap and WeakSet + +b. 11.2 Typed Arrays and Binary Data + +i. 11.2.1 Typed Array Types + +ii. 11.2.2 Creating Typed Arrays + +iii. 11.2.3 Using Typed Arrays + +iv. 11.2.4 Typed Array Methods and Properties + +v. 11.2.5 DataView and Endianness + +c. 11.3 Pattern Matching with Regular Expressions + +i. 11.3.1 Defining Regular Expressions + +ii. 11.3.2 String Methods for Pattern Matching + +iii. 11.3.3 The RegExp Class + +d. 11.4 Dates and Times + +i. 11.4.1 Timestamps + +ii. 11.4.2 Date Arithmetic + +iii. 11.4.3 Formatting and Parsing Date Strings + +e. 11.5 Error Classes + +f. 11.6 JSON Serialization and Parsing + +i. 11.6.1 JSON Customizations + +g. 11.7 The Internationalization API + +i. 11.7.1 Formatting Numbers + +ii. 11.7.2 Formatting Dates and Times + +iii. 11.7.3 Comparing Strings + +h. 11.8 The Console API + +i. 11.8.1 Formatted Output with Console + +i. 11.9 URL APIs + +i. 11.9.1 Legacy URL Functions + +j. 11.10 Timers + +k. 11.11 Summary + +13. Iterators and Generators + +a. 12.1 How Iterators Work + +b. 12.2 Implementing Iterable Objects + +i. 12.2.1 “Closing” an Iterator: The Return Method + +c. 12.3 Generators + +i. 12.3.1 Generator Examples + +ii. 12.3.2 yield* and Recursive Generators + +d. 12.4 Advanced Generator Features + +i. 12.4.1 The Return Value of a Generator + +Function + +ii. 12.4.2 The Value of a yield Expression + +iii. 12.4.3 The return() and throw() Methods of a Generator + +iv. 12.4.4 A Final Note About Generators + +e. 12.5 Summary + +14. Asynchronous JavaScript + +a. 13.1 Asynchronous Programming with Callbacks + +i. 13.1.1 Timers + +ii. 13.1.2 Events + +iii. 13.1.3 Network Events + +iv. 13.1.4 Callbacks and Events in Node + +b. 13.2 Promises + +i. 13.2.1 Using Promises + +ii. 13.2.2 Chaining Promises + +iii. 13.2.3 Resolving Promises + +iv. 13.2.4 More on Promises and Errors + +v. 13.2.5 Promises in Parallel + +vi. 13.2.6 Making Promises + +vii. 13.2.7 Promises in Sequence + +c. 13.3 async and await + +i. 13.3.1 await Expressions + +ii. 13.3.2 async Functions + +iii. 13.3.3 Awaiting Multiple Promises + +iv. 13.3.4 Implementation Details + +d. 13.4 Asynchronous Iteration + +i. 13.4.1 The for/await Loop + +ii. 13.4.2 Asynchronous Iterators + +iii. 13.4.3 Asynchronous Generators + +iv. 13.4.4 Implementing Asynchronous Iterators + +e. 13.5 Summary + +15. Metaprogramming + +a. 14.1 Property Attributes + +b. 14.2 Object Extensibility + +c. 14.3 The prototype Attribute + +d. 14.4 Well-Known Symbols + +i. 14.4.1 Symbol.iterator and Symbol.asyncIterator + +ii. 14.4.2 Symbol.hasInstance + +iii. 14.4.3 Symbol.toStringTag + +iv. 14.4.4 Symbol.species + +v. 14.4.5 Symbol.isConcatSpreadable + +vi. 14.4.6 Pattern-Matching Symbols + +vii. 14.4.7 Symbol.toPrimitive + +viii. 14.4.8 Symbol.unscopables + +e. 14.5 Template Tags + +f. 14.6 The Reflect API + + +g. 14.7 Proxy Objects + +i. 14.7.1 Proxy Invariants + +h. 14.8 Summary + +16. JavaScript in Web Browsers + +a. 15.1 Web Programming Basics + +i. 15.1.1 JavaScript in HTML + + + +The class and id attributes are two of the most common you will find used. + +They have a special meaning, and they are useful both in CSS and JavaScript. + +The difference between the two is that an id is unique in the context of a web page; it cannot be duplicated. + +Classes, on the other hand, can appear multiple times on multiple elements. + +Plus, an id is just one value. class can hold multiple values, separated by a space: + + +

A paragraph of text

+ +It's common to use the dash - to separate words in a class value, but it's just a convention. + +Those are just two of the possible attributes you can have. Some attributes are only used for one tag. They are highly specialized. + +Other attributes can be used in a more general way. You just saw id and class , but we have other ones too, like style which can be used to insert +inline CSS rules on an element. + + +Case insensitive + +HTML is case insensitive. Tags can be written in all caps, or lowercase. In the early days, caps were the norm. Today lowercase is the norm. It is a convention. + +You usually write like this: + + +

A paragraph of text

+ + + +not like this: + + +

A paragraph of text

+ + + + + +White space + +Pretty important. In HTML, even if you add multiple white spaces into a line, it's collapsed by the browser's CSS engine. + +For example the rendering of this paragraph + + +

A paragraph of text

+ +is the same as this: + + +

A paragraph of text

+ + + +and the same as this: + + +

A paragraph + +of +text

+ + + +Using the white-space CSS property you can change how things behave. You can find more information on how CSS processes white space in the CSS Spec + +I'd say use the syntax that makes things visually more organized and easier to read, but you can use any syntax you like. + +I typically favor + + +

A paragraph of text

+ + + +or + + +

+A paragraph of text

+ + + +Nested tags should be indented with 2 or 4 characters, depending on your preference: + + +

+A paragraph of text

+
    +
  • A list item
  • + +
+ + + +Note: this "white space is not relevant" feature means that if you want to add additional space, it can make you pretty mad. I suggest you use CSS to make more space when needed. + +Note: in special cases, you can use the   HTML entity (an acronym that means non-breaking space) - more on HTML entities later on. I think this should not be abused. CSS is always preferred to alter the visual presentation. + + +The document heading + + + + +The document heading + + +The head tag contains special tags that define the document properties. + +It's always written before the body tag, right after the opening html tag: + + + + ... + ... + + + + +We never use attributes on this tag. And we don't write content in it. + +It's just a container for other tags. Inside it we can have a wide variety of tags, depending on what you need to do: + + + +title + +script + +noscript + +link + +style + +base + +meta + + + +The title tag + + +The title tag determines the page title. The title browser, and it's especially important as it's one of Search Engine Optimization (SEO). + +is displayed in the the key factors for + +The script tag + +This tag is used to add JavaScript into the page. + +You can include it inline, using an opening tag, the JavaScript code and then the closing tag: + + + + + + +Or you can load an external JavaScript file by using the src attribute: + + + + + + +The type attribute by default is set to text/javascript , so it's completely optional. + +There is something pretty important to know about this tag. + +Sometimes this tag is used at the bottom of the page, just before the closing tag. Why? For performance reasons. + +Loading scripts by default blocks the rendering of the page until the script is parsed and loaded. + +By putting it at the bottom of the page, the script is loaded and executed after the whole page is already parsed and loaded, giving a better experience to the user over keeping it in the head tag. + +My opinion is that this is now bad practice. Let script live in the head tag. + +In modern JavaScript we have an alternative this is more performant than keeping the script at the bottom of the page -- the defer attribute. This is an example that loads a file.js file, relative to the current URL: + + + + +This is the scenario that triggers the faster path to a fast-loading page, and fast-loading JavaScript. + +Note: the async attribute is similar, but in my opinion a worse option than defer . I describe why, in more detail, on page https://flaviocopes.com/javascript-async-defer/ + + +The noscript tag + +This tag is used to detect when scripts are disabled in the browser. + +Note: users can choose to disable JavaScript scripts in the browser settings. Or the browser might not support them by default. + +It is used differently depending on whether it's put in the document head or in the document body. + +We're talking about the document head now, so let's first introduce this usage. + +In this case, the noscript tag can only contain other tags: + + +link tags style tags meta tags + +to alter the resources served by the page, or the meta information, if scripts are disabled. + +In this example I set an element with the no-script-alert class to display if scripts are disabled, as it was display: none by default: + + + + ... + + +... ... + + + + +Let's solve the other case: if put in the body, it can contain content, like paragraphs and other tags, which are rendered in the UI. + + +The link tag + +The link tag is used to set relationships between a document and other resources. + +It's mainly used to link an external CSS file to be loaded. + +This element has no closing tag. + +Usage: + + + + ... + ... + ... + + + + +The media attribute allows the loading of different stylesheets depending on the device capabilities: + + + + + + +We can also link to resources other than stylesheets. + +For example we can associate an RSS feed using + + + + + + +Or we can associate a favicon using: + + + + + + + + + +type="image/png" + + +type="image/png" + +sizes="32x32" + + +sizes="16x16" + +href="/assets/favicon- + + +href="/assets/favicon- + + + + +This tag was also used for multi-page content, to indicate the previous and next page using rel="prev" and rel="next" . Mostly for Google. As of 2019, Google announced it does not use this tag any more because it can find the correct page structure without it. + + +The style tag + +This tag can be used to add styles into the document, rather than loading an external stylesheet. + +Usage: + + + + + + +As with the link tag, you can use the media attribute to use that CSS only on the specified medium: + + + + +The base tag + +This tag is used to set a base URL for all relative URLs contained in the page. + + + + ... + ... + ... + + + + + + +The meta tag + +Meta tags perform a variety of tasks and they are very, very important. + +Especially for SEO. + +meta elements only have the starting tag. + +The most basic one is the description meta tag: + + + + + + +This might be used by Google to generate the page description in its result pages, if it finds it better describes the page than the on-page content (don't ask me how). + +The charset meta tag is used to set the page character encoding. utf-8 in most cases: + + + + +The robots meta tag instructs the Search Engine bots whether to index a page or not: + + + + + + +Or if they should follow links or not: + + + + + + +You can set nofollow on individual links, too. This is how you can set nofollow globally. + +You can combine them: + + + + + + +The default behavior is index, follow . + +You can use other properties, including nosnippet , noarchive , noimageindex and more. + +You can also just tell Google instead of targeting all search engines: + + + + + + +And other search engines might have their own meta tag, too. + +Speaking of which, we can tell Google to disable some features. This prevents the translate functionality in the search engine results: + + + + +The viewport meta tag is used to tell the browser to set the page width based on the device width. + + + + + + +See more on this tag. + +Another rather popular meta tag is the http-equiv="refresh" one. This line tells the browser to wait 3 seconds, then redirect to that other page: + + + + + + +Using 0 instead of 3 will redirect as soon as possible. + +This is not a full reference; Other less-used meta tags exist. + +After this document heading introduction, we can start diving into the document body. + + +The document body + + + + +The document body + + +After the closing head tag, we can only have one thing in an HTML document: the body element. + + + + ... + +... + + + + +Just like the head and html tags, we can only have one body tag in one page. + +Inside the body tag we have all the tags that define the content of the page. + +Technically, the start and ending tags are optional. But I consider it a good practice to add them. Just for clarity. + +In the next chapters we'll define the variety of tags you can use inside the page body. + +But before, we must introduce a difference between block elements and inline elements. + + + + +Block elements vs inline elements + +Visual elements, the ones defined in the page body, can be generally classified in 2 categories: + + + +block elements ( p , inline elements ( a , + +div , heading elements, lists and list items, ...) span , img , ...) + + +What is the difference? + +Block elements, when positioned in the page, do not allow other elements next to them. To the left, or to the right. + +Inline elements instead can sit next to other inline elements. + +The difference also lies in the visual properties we can edit using CSS. We can alter the width/height, margin, padding and border of block elements. We can't do that for inline elements. + + +Note that using CSS we can change the default for setting a p tag to be inline, for example, or a span element. + +each element, to be a block + + +Another difference is that inline elements can be contained in block elements. The reverse is not true. + +Some block elements can contain other block elements, but it depends. The p tag for example does not allow such option. + + +Tags that interact with text + + + + +Tags that interact with text + + +The p tag + +This tag defines a paragraph of text. + + +

Some text

+ + + +It's a block element. + +Inside it, we can add any inline element we like, like span or a . + +We cannot add block elements. + +We cannot nest a p element into another one. + +By default browsers style a paragraph with a margin on top and at the bottom. 16px in Chrome, but the exact value might vary between browsers. + +This causes two consecutive paragraphs to be spaced, replicating what we think of a "paragraph" in printed text. + + + + +The span tag + +This is an inline tag that can be used to create a section in a paragraph that can be targeted using CSS: + + +

A part of the text and here another part

+ + + + + + +The br tag + +This tag represents a line break. It's an inline element, and does not need a closing tag. + +We use it to create a new line inside a p tag, without creating a new paragraph. + +And compared to creating a new paragraph, it does not add additional spacing. + + +

Some text
A new line

+ + + + + + +The heading tags + +HTML provides us 6 heading tags. From most important to least important, we have h1 , h2 , h3 , h4 , h5 , h6 . + + +Typically a page will have one you might have one or more h2 + +h1 element, which is the page title. Then elements depending on the page content. + + +Headings, especially the heading organization, are also essential for SEO, and search engines use them in various ways. + +The browser by default will render the h1 tag bigger, and will make the elements size smaller as the number near h increases: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +All headings are block elements. They cannot contain other elements, just text. + + + + +The strong tag + +This tag is used to mark the text inside it as strong. This is pretty important, it's not a visual hint, but a semantic hint. Depending on the medium used, its interpretation will vary. + +Browsers by default make the text in this tag bold. + + + + +The em tag + +This tag is used to mark the text inside it as emphasized. Like with strong , it's not a visual hint but a semantic hint. + +Browsers by default make the text in this italic. + + + + +Quotes + +The blockquote HTML tag is useful to insert citations in the text. + +Browsers by default apply a margin to the blockquote element. Chrome applies a 40px left and right margin, and a 10px top and bottom margin. + +The q HTML tag is used for inline quotes. + + + + +Horizontal line + +Not really based on text, but the hr tag is often used inside a page. It means horizontal rule , and it adds a horizontal line in the page. + +Useful to separate sections in the page. + + + + +Code blocks + +The code tag is especially useful to show code, because browsers give it a monospaced font. + +That's typically the only thing that browsers do. This is the CSS applied by Chrome: + + +code { +font-family: monospace; } + + + +This tag is typically wrapped in a pre tag, because the code element ignores whitespace and line breaks. Like the p tag. + +Chrome gives pre this default styling: + + +pre { +display: block; +font-family: monospace; white-space: pre; margin: 1em 0px; +} + + + +which prevents white space collapsing and makes it a block element. + + + + +Lists + +We have 3 types of lists: + + +unordered lists ordered lists definition lists + +Unordered lists are created using the ul tag. Each item in the list is created with the li tag: + + +
  • First
  • +
  • Second
+ + + +Ordered lists are similar, just made with the ol tag: + + +
  1. First
  2. +
  3. Second
+ + + +The difference between the two is that ordered lists have a number before each item: + + + + + + + + + + + + + + + + + + + + + + + + + + +Definition lists are a bit different. You have a term, and its definition: + + +
Flavio
+
The name
Copes
The surname
+
+ + + +This is how browsers typically render them: + + + + + + + + + + + + + + + + + + +I must say you rarely see them in the wild, for sure not much as ul and ol , but sometimes they might be useful. + + + + +Other text tags + +There is a number of tags with presentational purposes: + + +the mark tag the ins tag the del tag the sup tag the sub tag the small tag the i tag the b tag + +This is an example of the visual rendering of them which is applied by default by browsers: + + + + + + + + + + + + + + + + + + + + + +You might wonder, how is b different than strong ? And how i is different than em ? + +The difference lies in the semantic meaning. While b and i are a direct hint at the browser to make a piece of text bold or italic, strong and em + +give the text a special meaning, and it's up to the browser to give the styling. Which happens to be exactly the same as b and i , by default. Although you can change that using CSS. + +There are a number of other, less used tags related to text. I just mentioned the ones that I see used the most. + + +Links + + + + +Links + + +Links are defined using the a tag. The link destination is set via its href attribute. + +Example: + + +click here + + + +Between the starting and closing tag we have the link text. + +The above example is an absolute URL. Links also work with relative URLs: + + +click here + + + +In this case, when clicking the link the user is moved to the /test URL on the current origin. + +Be careful with the / character. If omitted, instead of starting from the origin, the browser will just add the test string to the current URL. + +Example, I'm on the page https://flaviocopes.com/axios/ and I have these links: + + +/test once clicked brings me to https://flaviocopes.com/test +test once clicked brings me to https://flaviocopes.com/axios/test + +Link tags can include other things inside them, not just text. For example, images: + + + + + + + + +or any other elements, except other tags. + +If you want to open the link in a new tab, you can use the target attribute: + + +open in new tab + + +Container tags and page structure HTML + + + + +Container tags and page structure HTML + + +Container tags + +HTML provides a set of container tags. Those tags can contain an unspecified set of other tags. + +We have: + + + +article + +section + +div + +and it can be confusing to understand the difference between them. + +Let's see when to use each one of them. + + +article + +The article tag identifies a thing that can be independent from other things in a page. + +For example a list of blog posts in the homepage. + +Or a list of links. + + +
+ +We're not limited to lists: an article can be the main element in a page. + + +
+

A blog post

+

Here is the content...

+ + + +Inside an article tag we should have a title ( h1 - h6 ) and + + +section + +Represents a section of a document. Each section has a heading tag ( h1 - h6 ), then the section body. + +Example: + + +
+

A section of the page

...

+
+ + + +It's useful to break a long article into different sections. + +Shouldn't be used as a generic container element. div is made for this. + + +div + +div is the generic container element: + + +
... +
+ + + +You often add a class or id attribute to this element, to allow it to be styled using CSS. + +We use div in any place where we need a container but the existing tags are not suited. + + + + +Tags related to page + + +nav + +This tag is used to create the markup that defines the page navigation. Into this we typically add an ul or ol list: + + + + + + + + +aside + +The aside tag is used to add a piece of content that is related to the main content. + +A box where to add a quote, for example. Or a sidebar. + +Example: + + +
+

some text..

+

other text...

+ + + +Using aside is a signal that the things it contains are not part of the regular flow of the section it lives into. + +header + +The header tag represents a part of the page that is the introduction. It can for example contain one or more heading tag ( h1 - h6 ), the tagline for the article, an image. + + +
+

Article title

+...
+ + + + + +main + +The main tag represents the main part of a page: + + + ....
+

....

+ + + + + + +footer + +The footer tag is used to determine the footer of an article, or the footer of the page: + + +
.... +
+

Footer notes..

+
+ + +Forms + + + + +Forms + + +Forms are the way you can interact with a page, or an app, built with Web technologies. + +You have a set of controls, and when you submit the form, either with a click to a "submit" button or programmatically, the browser will send the data to the server. + +By default this data sending causes the page to reload after the data is sent, but using JavaScript you can alter this behavior (not going to explain how in this book). + +A form is created using the form tag: + + +
... +
+ + + +By default forms are submitted using the GET HTTP method. Which has its drawbacks, and usually you want to use POST. + +You can set the form to use POST when submitted by using the method attribute: + + +
... +
+ + + +The form is submitted, either using GET or POST, to the same URL where it resides. + +So if the form is in the https://flaviocopes.com/contacts page, pressing the "submit" button will make a request to that same URL. + +Which might result in nothing happening. + +You need something server-side to handle the request, and typically you "listen" for those form submit events on a dedicated URL. + +You can specify the URL via the action parameter: + + +
... +
+ + + +This will cause the browser to submit the form data using POST to the /new-contact URL on the same origin. + + +If the origin (protocol + domain + port) is https://flaviocopes.com the default), this means the form data will be +https://flaviocopes.com/new-contact . + +I talked about data. Which data? + +(port 80 is sent to + + +Data is provided by users via the set of controls that are available on the Web platform: + + +input boxes (single line text) text areas (multiline text) +select boxes (choose one option from a drop-down menu) radio buttons (choose one option from a list always visible) checkboxes (choose zero, one or more option) +file uploads and more! + +Let's introduce each one of them in the following form fields overview. + + + + +The input tag + +The input field is one of the most widely used form elements. It's also a very versatile element, and it can completely change behavior based on the +type attribute. + +The default behavior is to be a single-line text input control: + + + + + + +Equivalent to using: + + + + + + +As with all the other fields that follow, you need to give the field a name in order for its content to be sent to the server when the form is submitted: + + + + + + +The placeholder attribute is used to have some text showing up, in light gray, when the field is empty. Useful to add a hint to the user for what to type in: + + + + + + + + +Email + +Using type="email" will validate client-side (in the browser) an email for correctness (semantic correctness, not ensuring the email address is existing) before submitting. + + + + + + + + +Password + +Using type="password" will make every key entered appear as an asterisk (*) or dot, useful for fields that host a password. + + + + + + + + +Numbers + +You can have an input element accept only numbers: + + + + + + +You can specify a minimum and maximum value accepted: + + + + + + +The step attribute helps identify the steps between different values. For example this accepts a value between 10 and 50, at steps of 5: + + + + +Hidden field + +Fields can be hidden from the user. They will still be sent to the server upon the form submit: + + + + + + +This is commonly used to store values like a CSRF token, used for security and user identification, or even to detect robots sending spam, using special techniques. + +It can also just be used to identify a form and its action. + + +Setting a default value + +All those fields accept a predefined value. If the user does not change it, this will be the value sent to the server: + + + + + + +If you set a placeholder, that value will appear if the user clears the input field value: + + + + + + + + + +Form submit + +The type="submit" field is a button that, once pressed by the user, submits the form: + + + + + + +The value attribute sets the text on the button, which if missing shows the "Submit" text: + + + + + + + + + +Form validation + +Browsers provide client-side validation functionality to forms. + +You can set fields as required, ensuring they are filled, and enforce a specific format for the input of each field. + +Let's see both options. + + +Set fields as required + +The required attribute helps you with validation. If the field is not set, client-side validation fails and the browser does not submit the form: + + + + + + + + +Enforce a specific format + +I described the type="email" field above. It automatically validates the email address according to a format set in the specification. + +In the type="number" field, I mentioned the min and max attribute to limit values entered to an interval. + +You can do more. + +You can enforce a specific format on any field. + +The pattern attribute gives you the ability to set a regular expression to validate the value against. + +I recommend reading my Regular Expressions Guide at flaviocopes.com/javascript-regular-expressions/. + +pattern="https://.*" + + + + + + + + + +Other fields + + +File uploads + +You can load files from your local computer and send them to the server using a type="file" input element: + + + + + + +You can attach multiple files: + + + + + + +You can specify one or more file types allowed using the accept attribute. This accepts images: + + + + + + +You can use a specific MIME type, like application/json or set a file extension like .pdf . Or set multiple file extensions, like this: + + + + + + + + +Buttons + +The type="button" input fields can be used to add additional buttons to the form, that are not submit buttons: + + + + + + +They are used to programmatically do something, using JavaScript. + +There is a special field rendered as a button, whose special action is to clear the entire form and bring back the state of the fields to the initial one: + + + + + + + + +Radio buttons + +Radio buttons are used to create a set of choices, of which one is pressed and all the others are disabled. + +The name comes from old car radios that had this kind of interface. + +You define a set of type="radio" inputs, all with the same name attribute, and different value attribute: + + + + + + +Once the form is submitted, the color data property will have one single value. + +There's always one element checked. The first item is the one checked by default. + +You can set the value that's pre-selected using the checked attribute. You can use it only once per radio inputs group. + +Checkboxes + +Similar to radio boxes, but they allow multiple values to be chosen, or none at all. + + +You define a set of and different value + +type="checkbox" inputs, all with the same name attribute, attribute: + + + + + + + +All those checkboxes will be unchecked by default. Use the checked attribute to enable them on page load. + +Since this input field allows multiple values, upon form submit the value(s) will be sent to the server as an array. + + +Date and time + +We have a few input types to accept date values. + +The type="date" input field allows the user to enter a date, and shows a date picker if needed: + + + + + + +The type="time" input field allows the user to enter a time, and shows a time picker if needed: + + + + + + +The type="month" input field allows the user to enter a month and a year: + + + + + +The type="week" input field allows the user to enter a week and a year: + + + + + + +All those fields allow to limit the range and the step between each value. I recommend checking MDN for the little details on their usage. + +The type="datetime-local" field lets you choose a date and a time. + + + + + + +Here is a page to test them all: https://codepen.io/flaviocopes/pen/ZdWQPm + + +Color picker + +You can let users pick a color using the type="color" element: + + + + + + +You set a default value using the value attribute: + + + + + + +The browser will take care of showing a color picker to the user. + + +Range + +This input element shows a slider element. People can use it to move from a starting value to an ending value: + + + + + + +You can provide an optional step: + + + + + + + + +Telephone + +The type="tel" input field is used to enter a phone number: + + + + + + +The main selling point for using tel over text is on mobile, where the device can choose to show a numeric keyboard. + +Specify a pattern attribute for additional validation: + + + + + + + + +URL + +The type="url" field is used to enter a URL. + + + + +You can validate it using the pattern attribute: + + + + + + + + + +The textarea tag + +The textarea element allows users to enter multi-line text. Compared to input , it requires an ending tag: + + + + + + +You can set the dimensions using CSS, but also using the rows and cols attributes: + + + + + + +As with the other form tags, the name attribute determines the name in the data sent to the server: + + + + + + + + + +The select tag + +This tag is used to create a drop-down menu. + +The user can choose one of the options available. + +Each option is created using the option tag. You add a name to the select, and a value to each option: + + + + + + +You can set an option disabled: + + + + + + +You can have one empty option: + + + + + + +Options can be grouped using the optgroup tag. Each option group has a label attribute: + + + + + +Tables + + + + +Tables + + +In the early days of the web tables were a very important part of building layouts. + +Later on they were replaced by CSS and its layout capabilities, and today we have powerful tools like CSS Flexbox and CSS Grid to build layouts. Tables are now used just for, guess what, building tables! + + +The table tag + +You define a table using the table tag: + + + + +
+ + + +Inside the table we'll define the data. We reason in terms of rows, which means we add rows into a table (not columns). We'll define columns inside a row. + + +Rows + +A row is added using the tr tag, and that's the only thing we can add into a table element: + + + +
+ +This is a table with 3 rows. + +The first row can take the role of the header. + + +Column headers + +The table header contains the name of a column, typically in a bold font. + +Think about an Excel / Google Sheets document. The top A-B-C-D... header. + + + + + + + + + + + + + + + +We define the header using the th tag: + + + + + +
Column 1 Column 2 Column 3
+ + + + + +The table content + +The content of the table is defined using td tags, inside the other tr elements: + + + + + + + +
Column 1 Column 2 Column 3
Row 1 Column 1 Row 1 Column 2 Row 1 Column 3
Row 2 Column 1 Row 2 Column 2 Row 2 Column 3
+ + + +This is how browsers render it, if you don't add any CSS styling: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Adding this CSS: + + +th, td { padding: 10px; +border: 1px solid #333; } + + + +makes the table look more like a proper table: + + + + + + + + + + + + + + + +Span columns and rows + +A row can decide to span over 2 or more columns, using the colspan attribute: + + + + + + + + +
Column 1 Column 2 Column 3
Row 1 Columns 1-2 Row 1 Column 3
Row 2 Columns 1-3
+ + + + + + + + + + + + + + + +Or it can span over 2 or more rows, using the rowspan attribute: + + + + + + + +
Column 1 Column 2 Column 3
Rows 1-2 Columns 1-2 Row 1 Column 3
Row 2 Column 3
+ + + + + + + + + + + + + + + + +Row headings + +Before I explained how you can have column headings, using the th tag inside the first tr tag of the table. + +You can add a th tag as the first element inside a tr that's not the first tr of the table, to have row headings: + + + + + + + + + +
Column 2 Column 3
Row 1 Col 2 Col 3
Row 2 Col 2 Col 3
+ + + + + + + + + + + + + + + +More tags to organize the table + +You can add 3 more tags into a table, to have it more organized. + +This is best when using big tables. And to properly define a header and a footer, too. + +Those tags are + + + +thead + +tbody + +tfoot + +They wrap the tr tags to clearly define the different sections of the table. Here's an example: + + + + + + + + + + + + + + + +
Column 2 Column 3
Row 1 Col 2 Col 3
Row 2 Col 2 Col 3
Footer of Col 1 Footer of Col 2
+ + + + +Table caption + +A table should have a caption tag that describes its content. That tag should be put immediately after the opening table tag: + + + + + + + +
Dogs age
Dog Age
Roger 7
+ + +Multimedia tags: audio and video + + + + +Multimedia tags: audio and video + + + +In this section I want to show you the audio and video tags. + + + + +The audio tag + +This tag allows you to embed audio content in your HTML pages. + +This element can stream audio, maybe using a microphone via getUserMedia() , or it can play an audio source which you reference using the src attribute: + + +